From: Stafford Horne <shorne@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] asm-generic/io.h: Fix sparse warnings on big-endian architectures
Date: Tue, 4 Aug 2020 08:47:14 +0900 [thread overview]
Message-ID: <20200803234714.GL80756@lianli.shorne-pla.net> (raw)
In-Reply-To: <CAK8P3a1m=PPg1sDdRsCz7BOu44-zD87b80SvdZbMuvfLTWsc-A@mail.gmail.com>
On Mon, Aug 03, 2020 at 09:50:59PM +0200, Arnd Bergmann wrote:
> On Mon, Aug 3, 2020 at 5:11 PM Stafford Horne <shorne@gmail.com> wrote:
> >
> > On big-endian architectures like OpenRISC, sparse outputs below warnings on
> > asm-generic/io.h. This is due to io statements like:
> >
> > __raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
> >
> > The __raw_writel() function expects native endianness, however
> > cpu_to_le32() returns __le32. On little-endian machines these match up
> > and there is no issue. However, on big-endian we get warnings, for IO
> > that is defined as little-endian the mismatch is expected.
> >
> > The fix I propose is to __force to native endian.
> >
> > Warnings:
> >
> > ./include/asm-generic/io.h:166:15: warning: cast to restricted __le16
> > ./include/asm-generic/io.h:166:15: warning: cast to restricted __le16
> > ./include/asm-generic/io.h:166:15: warning: cast to restricted __le16
> > ./include/asm-generic/io.h:166:15: warning: cast to restricted __le16
> > ./include/asm-generic/io.h:179:15: warning: cast to restricted __le32
> > ./include/asm-generic/io.h:179:15: warning: cast to restricted __le32
> > ./include/asm-generic/io.h:179:15: warning: cast to restricted __le32
> > ./include/asm-generic/io.h:179:15: warning: cast to restricted __le32
> > ./include/asm-generic/io.h:179:15: warning: cast to restricted __le32
> > ./include/asm-generic/io.h:179:15: warning: cast to restricted __le32
> > ./include/asm-generic/io.h:215:22: warning: incorrect type in argument 1 (different base types)
> > ./include/asm-generic/io.h:215:22: expected unsigned short [usertype] value
> > ./include/asm-generic/io.h:215:22: got restricted __le16 [usertype]
> > ./include/asm-generic/io.h:225:22: warning: incorrect type in argument 1 (different base types)
> > ./include/asm-generic/io.h:225:22: expected unsigned int [usertype] value
> > ./include/asm-generic/io.h:225:22: got restricted __le32 [usertype]
> >
> > Signed-off-by: Stafford Horne <shorne@gmail.com>
>
> Looks good to me.
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> Can you just merge that through your openrisc tree? I don't have
> any other asm-generic changes for this merge window.
That's fine with me. Thank you.
-Stafford
prev parent reply other threads:[~2020-08-03 23:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 15:11 Stafford Horne
2020-08-03 19:50 ` Arnd Bergmann
2020-08-03 23:47 ` Stafford Horne [this message]
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=20200803234714.GL80756@lianli.shorne-pla.net \
--to=shorne@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-arch@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
all inboxes | Powered by JetHome®