On Nov 2, 2011, at 4:39 AM, Xie Shaohui-B21989 wrote:

>> -----Original Message-----
>> From: David Laight [mailto:david.lai...@aculab.com]
>> Sent: Wednesday, November 02, 2011 5:07 PM
>> To: Xie Shaohui-B21989; linuxppc-dev@lists.ozlabs.org
>> Cc: linux-...@vger.kernel.org
>> Subject: RE: [PATCH] powerpc/usb: use ioremap instead of base plus offset
>> to access regs
>> 
>> 
>>> #ifndef CONFIG_ARCH_MXC
>>>     if (pdata->have_sysif_regs)
>>> -           usb_sys_regs = (struct usb_sys_interface *)
>>> -                           ((u32)dr_regs + USB_DR_SYS_OFFSET);
>>> +           usb_sys_regs = ioremap(res->start + USB_DR_SYS_OFFSET,
>>> +                           sizeof(struct
>> usb_sys_interface)/sizeof(int));
>>> #endif
>> 
>> That ioremap() doesn't look right.
>> Isn't the 'size' in bytes??
> [Xie Shaohui] Yes, should not use sizeof(int).
> 
>> (Although it will only matter if it crosses a page boundary.) Mind you,
>> I'd have though the original ioremap() should have covered the entire
>> structure??
> [Xie Shaohui] The original ioremap() did cover the entire structure, but the 
> sysif_regs are not defined in dr_regs,
> So regs of sysif_regs cannot be accessed as a member of a structure, current 
> driver handle this by type casting, this did work in 32-bit, but in 64-bit, 
> this is not safe. So I use ioremap() to cover it again.

What's status on a new version of this patch.

Also, make sure to CC: Greg (gre...@suse.de) on usb patches

- k
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to