On Fri, Feb 12, 2021 at 8:43 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > > 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? > It's been a long time since I looked at this, it seems to have had a few more changes in the 10 years since I was helping consolidate the implementations. The intention at the time was never to include the specific implementations directly (be_struct.h be_byteshift.h etc) and only to include asm/unaligned.h in the places where needed. Harvey > 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