* [PATCH] m68k: asm/io.h: mark mmio read addresses as const
@ 2023-09-25 15:53 Arnd Bergmann
2023-10-02 13:12 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-09-25 15:53 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Arnd Bergmann, kernel test robot, linux-m68k, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Passing constant __iomem tokens into the readl() family of helpers
or any of the others causes a warning on m68k:
include/asm-generic/io.h: In function 'ioread8_rep':
arch/m68k/include/asm/io_mm.h:375:44: warning: passing argument 1 of 'raw_insb' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
375 | #define readsb(port, buf, nr) raw_insb((port), (u8
Add a 'const' modifier to the pointers to shut up the warnings here.
Closes: https://lore.kernel.org/oe-kbuild-all/202309251926.bPl23AhG-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/m68k/include/asm/raw_io.h | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h
index 3ba40bc1dfaa9..4bc29e57e57fb 100644
--- a/arch/m68k/include/asm/raw_io.h
+++ b/arch/m68k/include/asm/raw_io.h
@@ -17,15 +17,15 @@
* two accesses to memory, which may be undesirable for some devices.
*/
#define in_8(addr) \
- ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; })
+ ({ u8 __v = (*(__force const volatile u8 *) (unsigned long)(addr)); __v; })
#define in_be16(addr) \
- ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; })
+ ({ u16 __v = (*(__force const volatile u16 *) (unsigned long)(addr)); __v; })
#define in_be32(addr) \
- ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; })
+ ({ u32 __v = (*(__force const volatile u32 *) (unsigned long)(addr)); __v; })
#define in_le16(addr) \
- ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; })
+ ({ u16 __v = le16_to_cpu(*(__force const volatile __le16 *) (unsigned long)(addr)); __v; })
#define in_le32(addr) \
- ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; })
+ ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
#define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
#define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
@@ -98,7 +98,8 @@
#define raw_rom_outw(val, port) rom_out_be16((port), (val))
#endif /* CONFIG_ATARI_ROM_ISA */
-static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
+static inline void raw_insb(const volatile u8 __iomem *port, u8 *buf,
+ unsigned int len)
{
unsigned int i;
@@ -146,7 +147,7 @@ static inline void raw_outsb(volatile u8 __iomem *port, const u8 *buf,
}
}
-static inline void raw_insw(volatile u16 __iomem *port, u16 *buf, unsigned int nr)
+static inline void raw_insw(volatile const u16 __iomem *port, u16 *buf, unsigned int nr)
{
unsigned int tmp;
@@ -225,7 +226,7 @@ static inline void raw_outsw(volatile u16 __iomem *port, const u16 *buf,
}
}
-static inline void raw_insl(volatile u32 __iomem *port, u32 *buf, unsigned int nr)
+static inline void raw_insl(const volatile u32 __iomem *port, u32 *buf, unsigned int nr)
{
unsigned int tmp;
@@ -305,7 +306,7 @@ static inline void raw_outsl(volatile u32 __iomem *port, const u32 *buf,
}
-static inline void raw_insw_swapw(volatile u16 __iomem *port, u16 *buf,
+static inline void raw_insw_swapw(const volatile u16 __iomem *port, u16 *buf,
unsigned int nr)
{
if ((nr) % 8)
@@ -413,7 +414,8 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
#if defined(CONFIG_ATARI_ROM_ISA)
-static inline void raw_rom_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
+static inline void raw_rom_insb(const volatile u8 __iomem *port, u8 *buf,
+ unsigned int len)
{
unsigned int i;
@@ -430,7 +432,7 @@ static inline void raw_rom_outsb(volatile u8 __iomem *port, const u8 *buf,
rom_out_8(port, *buf++);
}
-static inline void raw_rom_insw(volatile u16 __iomem *port, u16 *buf,
+static inline void raw_rom_insw(const volatile u16 __iomem *port, u16 *buf,
unsigned int nr)
{
unsigned int i;
@@ -448,7 +450,7 @@ static inline void raw_rom_outsw(volatile u16 __iomem *port, const u16 *buf,
rom_out_be16(port, *buf++);
}
-static inline void raw_rom_insw_swapw(volatile u16 __iomem *port, u16 *buf,
+static inline void raw_rom_insw_swapw(const volatile u16 __iomem *port, u16 *buf,
unsigned int nr)
{
unsigned int i;
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] m68k: asm/io.h: mark mmio read addresses as const
2023-09-25 15:53 [PATCH] m68k: asm/io.h: mark mmio read addresses as const Arnd Bergmann
@ 2023-10-02 13:12 ` Geert Uytterhoeven
2023-10-02 19:42 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2023-10-02 13:12 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: kernel test robot, linux-m68k, linux-kernel
Hi Arnd,
On Mon, Sep 25, 2023 at 5:53 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Passing constant __iomem tokens into the readl() family of helpers
> or any of the others causes a warning on m68k:
>
> include/asm-generic/io.h: In function 'ioread8_rep':
> arch/m68k/include/asm/io_mm.h:375:44: warning: passing argument 1 of 'raw_insb' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 375 | #define readsb(port, buf, nr) raw_insb((port), (u8
>
> Add a 'const' modifier to the pointers to shut up the warnings here.
>
> Closes: https://lore.kernel.org/oe-kbuild-all/202309251926.bPl23AhG-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks for your patch!
> --- a/arch/m68k/include/asm/raw_io.h
> +++ b/arch/m68k/include/asm/raw_io.h
> @@ -17,15 +17,15 @@
> * two accesses to memory, which may be undesirable for some devices.
> */
> #define in_8(addr) \
> - ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; })
> + ({ u8 __v = (*(__force const volatile u8 *) (unsigned long)(addr)); __v; })
> #define in_be16(addr) \
> - ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; })
> + ({ u16 __v = (*(__force const volatile u16 *) (unsigned long)(addr)); __v; })
> #define in_be32(addr) \
> - ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; })
> + ({ u32 __v = (*(__force const volatile u32 *) (unsigned long)(addr)); __v; })
> #define in_le16(addr) \
> - ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; })
> + ({ u16 __v = le16_to_cpu(*(__force const volatile __le16 *) (unsigned long)(addr)); __v; })
> #define in_le32(addr) \
> - ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; })
> + ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
>
> #define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
> #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
Shouldn't a similar change be made to rom_in_{8,be16,le16}()?
I can do that while applying...
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] m68k: asm/io.h: mark mmio read addresses as const
2023-10-02 13:12 ` Geert Uytterhoeven
@ 2023-10-02 19:42 ` Arnd Bergmann
2023-10-06 7:48 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-10-02 19:42 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: kernel test robot, linux-m68k, linux-kernel
On Mon, Oct 2, 2023, at 15:12, Geert Uytterhoeven wrote:
> On Mon, Sep 25, 2023 at 5:53 PM Arnd Bergmann <arnd@kernel.org> wrote:
>> #define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
>> #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
>
> Shouldn't a similar change be made to rom_in_{8,be16,le16}()?
Right, these seem to have escaped my regex searches.
> I can do that while applying...
Ok, thanks!
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] m68k: asm/io.h: mark mmio read addresses as const
2023-10-02 19:42 ` Arnd Bergmann
@ 2023-10-06 7:48 ` Geert Uytterhoeven
0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2023-10-06 7:48 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: kernel test robot, linux-m68k, linux-kernel
On Mon, Oct 2, 2023 at 9:42 PM Arnd Bergmann <arnd@kernel.org> wrote:
> On Mon, Oct 2, 2023, at 15:12, Geert Uytterhoeven wrote:
> > On Mon, Sep 25, 2023 at 5:53 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >> #define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
> >> #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
> >
> > Shouldn't a similar change be made to rom_in_{8,be16,le16}()?
>
> Right, these seem to have escaped my regex searches.
>
> > I can do that while applying...
>
> Ok, thanks!
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k for-v6.7 branch.
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
end of thread, other threads:[~2023-10-06 7:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 15:53 [PATCH] m68k: asm/io.h: mark mmio read addresses as const Arnd Bergmann
2023-10-02 13:12 ` Geert Uytterhoeven
2023-10-02 19:42 ` Arnd Bergmann
2023-10-06 7:48 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox