All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: kernel test robot <lkp@intel.com>,
	Mark Brown <broonie@kernel.org>,
	 Bart Van Assche <bvanassche@acm.org>,
	kbuild-all@lists.01.org,
	 Linux Memory Management List <linux-mm@kvack.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	 Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [linux-next:master 2008/10581] include/linux/unaligned/be_byteshift.h:41:19: error: redefinition of 'get_unaligned_be16'
Date: Fri, 12 Feb 2021 09:37:58 -0800	[thread overview]
Message-ID: <CAHLZz10+ouAa+r_7WKzEUKq16BsigsAY8_FezCq-A08c6UOgsw@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdYsrz1NjjdisXa7C+jQEppT6AJUDPyX=MC4QbU_omXcmA@mail.gmail.com>

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


  reply	other threads:[~2021-02-12 17:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-11 23:52 ` kernel test robot
2021-02-12 16:43 ` Linus Walleij
2021-02-12 16:43   ` Linus Walleij
2021-02-12 17:37   ` Harvey Harrison [this message]
2021-02-14 21:05     ` Linus Walleij
2021-02-14 21:05       ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHLZz10+ouAa+r_7WKzEUKq16BsigsAY8_FezCq-A08c6UOgsw@mail.gmail.com \
    --to=harvey.harrison@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.