usb: dwc2-otg: make regs_phy (in platdata) a uintptr_t
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Thu, 6 Dec 2018 00:26:39 +0000 (01:26 +0100)
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Thu, 6 Dec 2018 15:04:49 +0000 (16:04 +0100)
The regs_phy field of the platform data structure for dwc2-otg is
today declared an unsigned int, but will eventually be cast into a
void* for a writel operation.  This triggers errors on modern GCC
versions.

E.g. we get the following error with GCC 6.3:
  drivers/usb/phy/rockchip_usb2_phy.c: In function 'property_enable':
  arch/arm/include/asm/io.h:49:29: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   #define __arch_putl(v,a)  (*(volatile unsigned int *)(a) = (v))
                               ^
  arch/arm/include/asm/io.h:117:48: note: in expansion of macro '__arch_putl'
   #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; })
                                                  ^~~~~~~~~~~
  drivers/usb/phy/rockchip_usb2_phy.c:61:2: note: in expansion of macro 'writel'
    writel(val, pdata->regs_phy + reg->offset);
    ^~~~~~

This commit changes regs_phy to be a uintptr_t to ensure that it is
large enough to hold any valid pointer (and fix the associated
warning).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
include/usb/dwc2_udc.h

index 62e32365e21d45fbc42ba3c9cd7d5d27762f13da..4068de045dc2c4e204a0cc0ec9da3c7536ebaa7e 100644 (file)
@@ -14,7 +14,7 @@ struct dwc2_plat_otg_data {
        void            *priv;
        int             phy_of_node;
        int             (*phy_control)(int on);
-       unsigned int    regs_phy;
+       uintptr_t       regs_phy;
        uintptr_t       regs_otg;
        unsigned int    usb_phy_ctrl;
        unsigned int    usb_flags;