[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a3Qx34-XNtaCjL0GxaG=75Cgcr2fS_4Nass=Ta0vrSQwQ@mail.gmail.com>
Date: Mon, 5 Aug 2019 13:52:33 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Hennie Muller <hm@...labs.co.za>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short
On Mon, Aug 5, 2019 at 11:11 AM Linus Walleij <linus.walleij@...aro.org> wrote:
>
> On Sun, Jul 21, 2019 at 2:53 PM Hennie Muller <hm@...labs.co.za> wrote:
>
> > cpu_to_be16 returns a __be16 value. This does not break anything
> > but does cause sparse to generate unnecessary warnings.
> >
> > Signed-off-by: Hennie Muller <hm@...labs.co.za>
> (...)
>
> > - gbmsg->val = cpu_to_be16(dir << offset);
> > - gbmsg->mask = cpu_to_be16(0x0001 << offset);
> > + gbmsg->val = (__force u16)cpu_to_be16(dir << offset);
> > + gbmsg->mask = (__force u16)cpu_to_be16(0x0001 << offset);
>
> Ugh I don't understand this.
>
> Arnd: you know this better than me: is this the right thing to do
> to get rid of sparse warnings from the code?
No, the structure should be modified to use __be16 fields instead of u16.
Arnd
Powered by blists - more mailing lists