linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'
@ 2021-02-11 23:52 kernel test robot
  2021-02-12 16:43 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2021-02-11 23:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: kbuild-all, Linux Memory Management List, Jonathan Cameron,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 12574 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   671176b0016c80b3943cb5387312c886aba3308d
commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/10581] iio: magnetometer: Add driver for Yamaha YAS530
config: h8300-allyesconfig (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=de8860b1ed4701ea7e6f760f02d79ca6a3b656a1
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout de8860b1ed4701ea7e6f760f02d79ca6a3b656a1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/build_bug.h:5,
                    from include/linux/bitfield.h:10,
                    from drivers/iio/magnetometer/yamaha-yas530.c:22:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra]
      93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
         |                                                  ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
     137 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   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)
         |                   ^~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/unaligned.h:26,
                    from ./arch/h8300/include/generated/asm/unaligned.h:1,
                    from include/asm-generic/uaccess.h:13,
                    from ./arch/h8300/include/generated/asm/uaccess.h:1,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/cgroup.h:17,
                    from include/linux/memcontrol.h:13,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    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)
         |                   ^~~~~~~~~~~~~~~~~~
   In file included from drivers/iio/magnetometer/yamaha-yas530.c:35:
   include/linux/unaligned/be_byteshift.h:46:19: error: redefinition of 'get_unaligned_be32'
      46 | static inline u32 get_unaligned_be32(const void *p)
         |                   ^~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/unaligned.h:26,
                    from ./arch/h8300/include/generated/asm/unaligned.h:1,
                    from include/asm-generic/uaccess.h:13,
                    from ./arch/h8300/include/generated/asm/uaccess.h:1,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/cgroup.h:17,
                    from include/linux/memcontrol.h:13,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from include/linux/regulator/consumer.h:35,
                    from drivers/iio/magnetometer/yamaha-yas530.c:33:
   include/linux/unaligned/be_struct.h:12:19: note: previous definition of 'get_unaligned_be32' was here
      12 | static inline u32 get_unaligned_be32(const void *p)
         |                   ^~~~~~~~~~~~~~~~~~
   In file included from drivers/iio/magnetometer/yamaha-yas530.c:35:
   include/linux/unaligned/be_byteshift.h:51:19: error: redefinition of 'get_unaligned_be64'
      51 | static inline u64 get_unaligned_be64(const void *p)
         |                   ^~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/unaligned.h:26,
                    from ./arch/h8300/include/generated/asm/unaligned.h:1,
                    from include/asm-generic/uaccess.h:13,
                    from ./arch/h8300/include/generated/asm/uaccess.h:1,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/cgroup.h:17,
                    from include/linux/memcontrol.h:13,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from include/linux/regulator/consumer.h:35,
                    from drivers/iio/magnetometer/yamaha-yas530.c:33:
   include/linux/unaligned/be_struct.h:17:19: note: previous definition of 'get_unaligned_be64' was here
      17 | static inline u64 get_unaligned_be64(const void *p)
         |                   ^~~~~~~~~~~~~~~~~~
   In file included from drivers/iio/magnetometer/yamaha-yas530.c:35:
>> include/linux/unaligned/be_byteshift.h:56:20: error: redefinition of 'put_unaligned_be16'
      56 | static inline void put_unaligned_be16(u16 val, void *p)
         |                    ^~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/unaligned.h:26,
                    from ./arch/h8300/include/generated/asm/unaligned.h:1,
                    from include/asm-generic/uaccess.h:13,
                    from ./arch/h8300/include/generated/asm/uaccess.h:1,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/cgroup.h:17,
                    from include/linux/memcontrol.h:13,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from include/linux/regulator/consumer.h:35,
                    from drivers/iio/magnetometer/yamaha-yas530.c:33:
   include/linux/unaligned/be_struct.h:22:20: note: previous definition of 'put_unaligned_be16' was here
      22 | static inline void put_unaligned_be16(u16 val, void *p)
         |                    ^~~~~~~~~~~~~~~~~~
   In file included from drivers/iio/magnetometer/yamaha-yas530.c:35:
   include/linux/unaligned/be_byteshift.h:61:20: error: redefinition of 'put_unaligned_be32'
      61 | static inline void put_unaligned_be32(u32 val, void *p)
         |                    ^~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/unaligned.h:26,
                    from ./arch/h8300/include/generated/asm/unaligned.h:1,
                    from include/asm-generic/uaccess.h:13,
                    from ./arch/h8300/include/generated/asm/uaccess.h:1,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/cgroup.h:17,
                    from include/linux/memcontrol.h:13,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from include/linux/regulator/consumer.h:35,
                    from drivers/iio/magnetometer/yamaha-yas530.c:33:
   include/linux/unaligned/be_struct.h:27:20: note: previous definition of 'put_unaligned_be32' was here
      27 | static inline void put_unaligned_be32(u32 val, void *p)
         |                    ^~~~~~~~~~~~~~~~~~
   In file included from drivers/iio/magnetometer/yamaha-yas530.c:35:
   include/linux/unaligned/be_byteshift.h:66:20: error: redefinition of 'put_unaligned_be64'
      66 | static inline void put_unaligned_be64(u64 val, void *p)
         |                    ^~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/unaligned.h:26,
                    from ./arch/h8300/include/generated/asm/unaligned.h:1,
                    from include/asm-generic/uaccess.h:13,
                    from ./arch/h8300/include/generated/asm/uaccess.h:1,
                    from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/cgroup.h:17,
                    from include/linux/memcontrol.h:13,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from include/linux/regulator/consumer.h:35,
                    from drivers/iio/magnetometer/yamaha-yas530.c:33:
   include/linux/unaligned/be_struct.h:32:20: note: previous definition of 'put_unaligned_be64' was here
      32 | static inline void put_unaligned_be64(u64 val, void *p)
         |                    ^~~~~~~~~~~~~~~~~~


vim +/get_unaligned_be16 +41 include/linux/unaligned/be_byteshift.h

064106a91be5e76 Harvey Harrison 2008-04-29  40  
064106a91be5e76 Harvey Harrison 2008-04-29 @41  static inline u16 get_unaligned_be16(const void *p)
064106a91be5e76 Harvey Harrison 2008-04-29  42  {
19f747f7370fcf4 Bart Van Assche 2020-03-13  43  	return __get_unaligned_be16(p);
064106a91be5e76 Harvey Harrison 2008-04-29  44  }
064106a91be5e76 Harvey Harrison 2008-04-29  45  
064106a91be5e76 Harvey Harrison 2008-04-29  46  static inline u32 get_unaligned_be32(const void *p)
064106a91be5e76 Harvey Harrison 2008-04-29  47  {
19f747f7370fcf4 Bart Van Assche 2020-03-13  48  	return __get_unaligned_be32(p);
064106a91be5e76 Harvey Harrison 2008-04-29  49  }
064106a91be5e76 Harvey Harrison 2008-04-29  50  
064106a91be5e76 Harvey Harrison 2008-04-29  51  static inline u64 get_unaligned_be64(const void *p)
064106a91be5e76 Harvey Harrison 2008-04-29  52  {
19f747f7370fcf4 Bart Van Assche 2020-03-13  53  	return __get_unaligned_be64(p);
064106a91be5e76 Harvey Harrison 2008-04-29  54  }
064106a91be5e76 Harvey Harrison 2008-04-29  55  
064106a91be5e76 Harvey Harrison 2008-04-29 @56  static inline void put_unaligned_be16(u16 val, void *p)
064106a91be5e76 Harvey Harrison 2008-04-29  57  {
064106a91be5e76 Harvey Harrison 2008-04-29  58  	__put_unaligned_be16(val, p);
064106a91be5e76 Harvey Harrison 2008-04-29  59  }
064106a91be5e76 Harvey Harrison 2008-04-29  60  

:::::: The code at line 41 was first introduced by commit
:::::: 064106a91be5e76cb42c1ddf5d3871e3a1bd2a23 kernel: add common infrastructure for unaligned access

:::::: TO: Harvey Harrison <harvey.harrison@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 57911 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'
  2021-02-11 23:52 [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16' kernel test robot
@ 2021-02-12 16:43 ` Linus Walleij
  2021-02-12 17:37   ` Harvey Harrison
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2021-02-12 16:43 UTC (permalink / raw)
  To: kernel test robot, Mark Brown, Bart Van Assche, Harvey Harrison
  Cc: kbuild-all, Linux Memory Management List, Jonathan Cameron,
	Andy Shevchenko

On Fri, Feb 12, 2021 at 12:53 AM kernel test robot <lkp@intel.com> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'
  2021-02-12 16:43 ` Linus Walleij
@ 2021-02-12 17:37   ` Harvey Harrison
  2021-02-14 21:05     ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Harvey Harrison @ 2021-02-12 17:37 UTC (permalink / raw)
  To: Linus Walleij
  Cc: kernel test robot, Mark Brown, Bart Van Assche, kbuild-all,
	Linux Memory Management List, Jonathan Cameron, Andy Shevchenko

On Fri, Feb 12, 2021 at 8:43 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Fri, Feb 12, 2021 at 12:53 AM kernel test robot <lkp@intel.com> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'
  2021-02-12 17:37   ` Harvey Harrison
@ 2021-02-14 21:05     ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2021-02-14 21:05 UTC (permalink / raw)
  To: Harvey Harrison
  Cc: kernel test robot, Mark Brown, Bart Van Assche, kbuild-all,
	Linux Memory Management List, Jonathan Cameron, Andy Shevchenko

On Fri, Feb 12, 2021 at 6:38 PM Harvey Harrison
<harvey.harrison@gmail.com> wrote:

> 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.

Oh actually it is that simple I suspect. Will try that.

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-14 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 23:52 [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16' kernel test robot
2021-02-12 16:43 ` Linus Walleij
2021-02-12 17:37   ` Harvey Harrison
2021-02-14 21:05     ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).