Re: [PATCH] i3c: remove 'const' from FIFO helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 8, 2025, at 11:43, Geert Uytterhoeven wrote:
> On Fri, 8 Aug 2025 at 01:09, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx> 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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux