>-----Original Message----- >From: David Laight [mailto:David.Laight@xxxxxxxxxx] >Sent: Wednesday, November 02, 2011 5:07 PM >To: Xie Shaohui-B21989; linuxppc-dev@xxxxxxxxxxxxxxxx >Cc: linux-usb@xxxxxxxxxxxxxxx >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. Best Regards, Shaohui Xie -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html