Re: [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 12, 2021 at 12:53 AM kernel test robot <lkp@xxxxxxxxx> wrote:

But what kind of syntactic trainwreck is this!

(...)
> commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/10581] iio: magnetometer: Add driver for Yamaha YAS530
(...)
>    In file included from drivers/iio/magnetometer/yamaha-yas530.c:35:
>    include/linux/unaligned/be_byteshift.h: At top level:
> >> include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'
>       41 | static inline u16 get_unaligned_be16(const void *p)
>          |                   ^~~~~~~~~~~~~~~~~~
(...)
>                     from include/linux/regulator/consumer.h:35,
>                     from drivers/iio/magnetometer/yamaha-yas530.c:33:
>    include/linux/unaligned/be_struct.h:7:19: note: previous definition of 'get_unaligned_be16' was here
>        7 | static inline u16 get_unaligned_be16(const void *p)
>          |                   ^~~~~~~~~~~~~~~~~~

Inspecting be_byteshift.h and be_struct.h I do see that both of them
define get_unaligned_be16/32/64.

They both end up calling the different implementations of
__get_unaligned_be16/32/64 on top of that.

So include one or the other and never both at the same time?
Well that is hard to avoid if one of them is in turn included by other
headers such as the very generic <linux/regulator/consumer.h>
in this case.

Harvey, anyone: ideas on how to fix this?

One of them have to change name in the whole world I suppose?

I suppose my code is working either because they both do exactly
the same thing or thanks to the order I include the files :P

I have the feeling there is something I don't understand about how
this was thought out, like I must have missed something. All
the collisions are even in the same include directory :(

Yours,
Linus Walleij




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux