* [PATCH] i3c: remove 'const' from FIFO helpers
@ 2025-08-07 4:31 Wolfram Sang
2025-08-07 20:21 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2025-08-07 4:31 UTC (permalink / raw)
To: linux-renesas-soc
Cc: linux-kernel, Wolfram Sang, kernel test robot, Alexandre Belloni,
Frank Li, Jorge Marques, linux-i3c
As buildbot reports, some architectures do not want const pointers.
Fixes: 733b439375b4 ("i3c: master: Add inline i3c_readl_fifo() and i3c_writel_fifo()")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508070438.TZZA3f2S-lkp@intel.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
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.
drivers/i3c/internals.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h
index 0d857cc68cc5..2b0b9c3a9131 100644
--- a/drivers/i3c/internals.h
+++ b/drivers/i3c/internals.h
@@ -30,8 +30,7 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev);
* @buf: Pointer to the data bytes to write
* @nbytes: Number of bytes to write
*/
-static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
- int nbytes)
+static inline void i3c_writel_fifo(void __iomem *addr, void *buf, int nbytes)
{
writesl(addr, buf, nbytes / 4);
if (nbytes & 3) {
@@ -48,8 +47,7 @@ static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
* @buf: Pointer to the buffer to store read bytes
* @nbytes: Number of bytes to read
*/
-static inline void i3c_readl_fifo(const void __iomem *addr, void *buf,
- int nbytes)
+static inline void i3c_readl_fifo(void __iomem *addr, void *buf, int nbytes)
{
readsl(addr, buf, nbytes / 4);
if (nbytes & 3) {
--
2.47.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i3c: remove 'const' from FIFO helpers
2025-08-07 4:31 [PATCH] i3c: remove 'const' from FIFO helpers Wolfram Sang
@ 2025-08-07 20:21 ` Alexandre Belloni
2025-08-08 9:43 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2025-08-07 20:21 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-renesas-soc, linux-kernel, kernel test robot, Frank Li,
Jorge Marques, linux-i3c
On 07/08/2025 06:31:24+0200, Wolfram Sang wrote:
> As buildbot reports, some architectures do not want const pointers.
>
> Fixes: 733b439375b4 ("i3c: master: Add inline i3c_readl_fifo() and i3c_writel_fifo()")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508070438.TZZA3f2S-lkp@intel.com/
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> 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.
> drivers/i3c/internals.h | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h
> index 0d857cc68cc5..2b0b9c3a9131 100644
> --- a/drivers/i3c/internals.h
> +++ b/drivers/i3c/internals.h
> @@ -30,8 +30,7 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev);
> * @buf: Pointer to the data bytes to write
> * @nbytes: Number of bytes to write
> */
> -static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
> - int nbytes)
> +static inline void i3c_writel_fifo(void __iomem *addr, void *buf, int nbytes)
> {
> writesl(addr, buf, nbytes / 4);
> if (nbytes & 3) {
> @@ -48,8 +47,7 @@ static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
> * @buf: Pointer to the buffer to store read bytes
> * @nbytes: Number of bytes to read
> */
> -static inline void i3c_readl_fifo(const void __iomem *addr, void *buf,
> - int nbytes)
> +static inline void i3c_readl_fifo(void __iomem *addr, void *buf, int nbytes)
> {
> readsl(addr, buf, nbytes / 4);
> if (nbytes & 3) {
> --
> 2.47.2
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i3c: remove 'const' from FIFO helpers
2025-08-07 20:21 ` Alexandre Belloni
@ 2025-08-08 9:43 ` Geert Uytterhoeven
2025-08-08 11:18 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2025-08-08 9:43 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Wolfram Sang, linux-renesas-soc, linux-kernel, kernel test robot,
Frank Li, Jorge Marques, linux-i3c, sparclinux, Arnd Bergmann
CC sparclinux, arnd
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:
> > As buildbot reports, some architectures do not want const pointers.
> >
> > Fixes: 733b439375b4 ("i3c: master: Add inline i3c_readl_fifo() and i3c_writel_fifo()")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202508070438.TZZA3f2S-lkp@intel.com/
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > ---
> >
> > 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.
> > --- a/drivers/i3c/internals.h
> > +++ b/drivers/i3c/internals.h
> > @@ -30,8 +30,7 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev);
> > * @buf: Pointer to the data bytes to write
> > * @nbytes: Number of bytes to write
> > */
> > -static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
> > - int nbytes)
> > +static inline void i3c_writel_fifo(void __iomem *addr, void *buf, int nbytes)
> > {
> > writesl(addr, buf, nbytes / 4);
> > if (nbytes & 3) {
> > @@ -48,8 +47,7 @@ static inline void i3c_writel_fifo(void __iomem *addr, const void *buf,
> > * @buf: Pointer to the buffer to store read bytes
> > * @nbytes: Number of bytes to read
> > */
> > -static inline void i3c_readl_fifo(const void __iomem *addr, void *buf,
> > - int nbytes)
> > +static inline void i3c_readl_fifo(void __iomem *addr, void *buf, int nbytes)
> > {
> > readsl(addr, buf, nbytes / 4);
> > if (nbytes & 3) {
> > --
> > 2.47.2
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i3c: remove 'const' from FIFO helpers
2025-08-08 9:43 ` Geert Uytterhoeven
@ 2025-08-08 11:18 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-08-08 11:18 UTC (permalink / raw)
To: Geert Uytterhoeven, Alexandre Belloni
Cc: Wolfram Sang, Linux-Renesas, linux-kernel, kernel test robot,
Frank Li, Jorge Marques, linux-i3c@lists.infradead.org,
sparclinux
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-08 11:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 4:31 [PATCH] i3c: remove 'const' from FIFO helpers Wolfram Sang
2025-08-07 20:21 ` Alexandre Belloni
2025-08-08 9:43 ` Geert Uytterhoeven
2025-08-08 11:18 ` Arnd Bergmann
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).