diff mbox

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

Message ID 1457356777-4350-2-git-send-email-purna.mandal@microchip.com
State Superseded
Delegated to: Daniel Schwierzeck
Headers show

Commit Message

Purna Chandra Mandal March 7, 2016, 1:19 p.m. UTC
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.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
---

Changes in v2: None

 drivers/usb/gadget/f_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ɓukasz Majewski March 7, 2016, 2:33 p.m. UTC | #1
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@samsung.com>

> 
> Signed-off-by: Purna Chandra Mandal <purna.mandal@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;
Daniel Schwierzeck March 7, 2016, 3:40 p.m. UTC | #2
2016-03-07 15:33 GMT+01:00 Lukasz Majewski <l.majewski@samsung.com>:
> 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:

can't we simply remove those functions? Then the ones from
include/linux/bitops.h respectively the arch-specific ones should be
automatically used.

>
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
>
>>
>> Signed-off-by: Purna Chandra Mandal <purna.mandal@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
diff mbox

Patch

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;