On Thu, Dec 05, 2013 at 12:32:57PM +0100, Marc Kleine-Budde wrote: > This patch makes the controller register map ci_regs_nolpm and ci_regs_lpm as > "const". Further, as all offset fit into a single byte, the type is changed > from uintptr_t to u8. > > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > --- > drivers/usb/chipidea/core.c | 80 ++++++++++++++++++++++----------------------- > 1 file changed, 40 insertions(+), 40 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 02929ee..dae16b3 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -75,48 +75,48 @@ > #include "otg.h" > > /* Controller register map */ > -static uintptr_t ci_regs_nolpm[] = { > - [CAP_CAPLENGTH] = 0x000UL, > - [CAP_HCCPARAMS] = 0x008UL, > - [CAP_DCCPARAMS] = 0x024UL, > - [CAP_TESTMODE] = 0x038UL, > - [OP_USBCMD] = 0x000UL, > - [OP_USBSTS] = 0x004UL, > - [OP_USBINTR] = 0x008UL, > - [OP_DEVICEADDR] = 0x014UL, > - [OP_ENDPTLISTADDR] = 0x018UL, > - [OP_PORTSC] = 0x044UL, > - [OP_DEVLC] = 0x084UL, > - [OP_OTGSC] = 0x064UL, > - [OP_USBMODE] = 0x068UL, > - [OP_ENDPTSETUPSTAT] = 0x06CUL, > - [OP_ENDPTPRIME] = 0x070UL, > - [OP_ENDPTFLUSH] = 0x074UL, > - [OP_ENDPTSTAT] = 0x078UL, > - [OP_ENDPTCOMPLETE] = 0x07CUL, > - [OP_ENDPTCTRL] = 0x080UL, > +static const u8 ci_regs_nolpm[] = { > + [CAP_CAPLENGTH] = 0x00U, > + [CAP_HCCPARAMS] = 0x08U, > + [CAP_DCCPARAMS] = 0x24U, > + [CAP_TESTMODE] = 0x38U, > + [OP_USBCMD] = 0x00U, > + [OP_USBSTS] = 0x04U, > + [OP_USBINTR] = 0x08U, > + [OP_DEVICEADDR] = 0x14U, > + [OP_ENDPTLISTADDR] = 0x18U, > + [OP_PORTSC] = 0x44U, > + [OP_DEVLC] = 0x84U, > + [OP_OTGSC] = 0x64U, > + [OP_USBMODE] = 0x68U, > + [OP_ENDPTSETUPSTAT] = 0x6CU, > + [OP_ENDPTPRIME] = 0x70U, > + [OP_ENDPTFLUSH] = 0x74U, > + [OP_ENDPTSTAT] = 0x78U, > + [OP_ENDPTCOMPLETE] = 0x7CU, > + [OP_ENDPTCTRL] = 0x80U, > }; > > -static uintptr_t ci_regs_lpm[] = { > - [CAP_CAPLENGTH] = 0x000UL, > - [CAP_HCCPARAMS] = 0x008UL, > - [CAP_DCCPARAMS] = 0x024UL, > - [CAP_TESTMODE] = 0x0FCUL, > - [OP_USBCMD] = 0x000UL, > - [OP_USBSTS] = 0x004UL, > - [OP_USBINTR] = 0x008UL, > - [OP_DEVICEADDR] = 0x014UL, > - [OP_ENDPTLISTADDR] = 0x018UL, > - [OP_PORTSC] = 0x044UL, > - [OP_DEVLC] = 0x084UL, > - [OP_OTGSC] = 0x0C4UL, > - [OP_USBMODE] = 0x0C8UL, > - [OP_ENDPTSETUPSTAT] = 0x0D8UL, > - [OP_ENDPTPRIME] = 0x0DCUL, > - [OP_ENDPTFLUSH] = 0x0E0UL, > - [OP_ENDPTSTAT] = 0x0E4UL, > - [OP_ENDPTCOMPLETE] = 0x0E8UL, > - [OP_ENDPTCTRL] = 0x0ECUL, > +static const u8 ci_regs_lpm[] = { > + [CAP_CAPLENGTH] = 0x00U, > + [CAP_HCCPARAMS] = 0x08U, > + [CAP_DCCPARAMS] = 0x24U, > + [CAP_TESTMODE] = 0xFCU, > + [OP_USBCMD] = 0x00U, > + [OP_USBSTS] = 0x04U, > + [OP_USBINTR] = 0x08U, > + [OP_DEVICEADDR] = 0x14U, > + [OP_ENDPTLISTADDR] = 0x18U, > + [OP_PORTSC] = 0x44U, > + [OP_DEVLC] = 0x84U, > + [OP_OTGSC] = 0xC4U, > + [OP_USBMODE] = 0xC8U, > + [OP_ENDPTSETUPSTAT] = 0xD8U, > + [OP_ENDPTPRIME] = 0xDCU, > + [OP_ENDPTFLUSH] = 0xE0U, > + [OP_ENDPTSTAT] = 0xE4U, > + [OP_ENDPTCOMPLETE] = 0xE8U, > + [OP_ENDPTCTRL] = 0xECU, > }; > Add "const" is a good fix, but I can't see much benefit of change uintptr_t to u8 except reduce the kernel data segment. Using uintprt_t make the code easier to read as the reader can know it stands for pointer. -- Best Regards, Peter Chen -- 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