sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Cc: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	linux-kernel@vger.kernel.org, "kernel test robot" <lkp@intel.com>,
	"Frank Li" <Frank.Li@nxp.com>,
	"Jorge Marques" <jorge.marques@analog.com>,
	"linux-i3c@lists.infradead.org" <linux-i3c@lists.infradead.org>,
	sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCH] i3c: remove 'const' from FIFO helpers
Date: Fri, 08 Aug 2025 13:18:46 +0200	[thread overview]
Message-ID: <b7cf1db6-317a-453b-a605-adec7e126fc6@app.fastmail.com> (raw)
In-Reply-To: <CAMuHMdUwC=TNvvwf0_sgSSYTBGeq8UX5kRFN5kg3mFJ7wVA3kw@mail.gmail.com>

On Fri, Aug 8, 2025, at 11:43, Geert Uytterhoeven wrote:
> On Fri, 8 Aug 2025 at 01:09, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:
>> On 07/08/2025 06:31:24+0200, Wolfram Sang wrote:
>> >
>> > I still wonder why SPARC discards the const but since nobody seems to be
>> > commenting on that, I guess the fastest way to get the build error out
>> > of Linus' tree is to adapt the usage in I3C.
>>
>> My plan was to let sparc people handle their mess, there is no reason
>> const should be discarded.
>
> Fully agreed.
>
> Note that it is not just the const keyword that is missing from the
> SPARC implementation, but also the volatile keyword.

The last time this came up, I actually tried doing a patch to
remove the 'volatile' keywords from all asm/io.h on all
architectures, and from all drivers that currently pass it,
as I don't think it has any effect other than avoid build
warnings for some prehistoric drivers.

On a related note, I'm fairly sure the i3c_readl_fifo() function
is not portable and breaks on most big-endian platforms: The 
readsl() implementation on big-endian targets usually skips the
implied byteswap from readl() since it is writing a bytestream,
but then the final readl() is defined as reading a four-byte
little-endian word, which tends to require an explicit swap
on big-endian targets. (there are some exceptions where the
PCI host bridge adds an extra byteswap, or where the CPU swaps
everything on 32-bit boundaries, rather than the unit of the
access).

I think using 

    readsl(addr, &tmp, 1);

instead of the final readl() should be portable here.
Same for the writel() of course.

     Arnd

      reply	other threads:[~2025-08-08 11:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250807043456.1624-2-wsa+renesas@sang-engineering.com>
     [not found] ` <2025080720214218750df5@mail.local>
2025-08-08  9:43   ` [PATCH] i3c: remove 'const' from FIFO helpers Geert Uytterhoeven
2025-08-08 11:18     ` Arnd Bergmann [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=b7cf1db6-317a-453b-a605-adec7e126fc6@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=geert@linux-m68k.org \
    --cc=jorge.marques@analog.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.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 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).