[U-Boot] [PATCH v2 2/4] gadget: f_mass_storge: fix compilation error for MIPS.

Lukasz Majewski l.majewski at samsung.com
Mon Mar 7 15:33:30 CET 2016


Hi Purna,

> Compiling USB mass storage gadget for MIPS reports redefinition error.
> ------------------
> drivers/usb/gadget/f_mass_storage.c:286:13: error: redefinition of
> 'set_bit' inline void set_bit(int nr, volatile void *addr)
>              ^
> In file included from include/linux/bitops.h:123:0,
>                  from include/common.h:20,
>                  from drivers/usb/gadget/f_mass_storage.c:245:
> ./arch/mips/include/asm/bitops.h:328:24: note: previous definition of
> 'set_bit' was here static __inline__ void set_bit(int nr, volatile
> void * addr) ^
> drivers/usb/gadget/f_mass_storage.c:296:13: error: redefinition of
> 'clear_bit' inline void clear_bit(int nr, volatile void *addr)
>              ^
> In file included from include/linux/bitops.h:123:0,
>                  from include/common.h:20,
>                  from drivers/usb/gadget/f_mass_storage.c:245:
> ./arch/mips/include/asm/bitops.h:370:24: note: previous definition of
> 'clear_bit' was here static __inline__ void clear_bit(int nr,
> volatile void * addr) -------------
> Fixed it by allowing default implementation of set_bit(), clear_bit()
> for non MIPS.

I seems like MIPS (and few other architectures) is providing
implementation for {set|clear}_bit.

For ARM, those are declared as externs
at ./arch/arm/include/asm/bitops.h

I wonder why it is like that ...

Nonetheless, since I do not know how to fix this issue on ARM:

Acked-by: Lukasz Majewski <l.majewski at samsung.com>

> 
> Signed-off-by: Purna Chandra Mandal <purna.mandal at microchip.com>
> ---
> 
> Changes in v2: None
> 
>  drivers/usb/gadget/f_mass_storage.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index 1ecb92a..8ca02f2 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -283,6 +283,7 @@ static const char fsg_string_interface[] = "Mass
> Storage"; struct kref {int x; };
>  struct completion {int x; };
>  
> +#if !defined(CONFIG_MIPS)
>  inline void set_bit(int nr, volatile void *addr)
>  {
>  	int	mask;
> @@ -302,6 +303,7 @@ inline void clear_bit(int nr, volatile void *addr)
>  	mask = 1 << (nr & 0x1f);
>  	*a &= ~mask;
>  }
> +#endif
>  
>  struct fsg_dev;
>  struct fsg_common;



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list