linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Hennie Muller <hm@bitlabs.co.za>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short
Date: Mon, 5 Aug 2019 13:52:33 +0200	[thread overview]
Message-ID: <CAK8P3a3Qx34-XNtaCjL0GxaG=75Cgcr2fS_4Nass=Ta0vrSQwQ@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdZ0OYt4q3a=kEWswKZ0z779aDFNg8wbm9Tqa+ddgiW3dA@mail.gmail.com>

On Mon, Aug 5, 2019 at 11:11 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Sun, Jul 21, 2019 at 2:53 PM Hennie Muller <hm@bitlabs.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@bitlabs.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

  reply	other threads:[~2019-08-05 11:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-21 12:52 [PATCH 1/2] [PATCH] gpio: Replace usage of bare 'unsigned' with 'unsigned int' Hennie Muller
2019-07-21 12:52 ` [PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short Hennie Muller
2019-08-05  9:10   ` Linus Walleij
2019-08-05 11:52     ` Arnd Bergmann [this message]
2019-07-22  2:05 ` [PATCH 1/2] [PATCH] gpio: Replace usage of bare 'unsigned' with 'unsigned int' Phil Reid
2019-07-22  4:51   ` Hennie Muller
2019-08-05  9:26     ` Linus Walleij
2019-08-05  9:27 ` 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='CAK8P3a3Qx34-XNtaCjL0GxaG=75Cgcr2fS_4Nass=Ta0vrSQwQ@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=hm@bitlabs.co.za \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 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).