Skip to content

Commit c7db383

Browse files
arndbgeertu
authored andcommitted
m68k: io: Mark mmio read addresses as const
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. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] [geert: Fix missed rom_in_{8,be16,le16}()] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent b038c6a commit c7db383

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

arch/m68k/include/asm/raw_io.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
* two accesses to memory, which may be undesirable for some devices.
1818
*/
1919
#define in_8(addr) \
20-
({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; })
20+
({ u8 __v = (*(__force const volatile u8 *) (unsigned long)(addr)); __v; })
2121
#define in_be16(addr) \
22-
({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; })
22+
({ u16 __v = (*(__force const volatile u16 *) (unsigned long)(addr)); __v; })
2323
#define in_be32(addr) \
24-
({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; })
24+
({ u32 __v = (*(__force const volatile u32 *) (unsigned long)(addr)); __v; })
2525
#define in_le16(addr) \
26-
({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; })
26+
({ u16 __v = le16_to_cpu(*(__force const volatile __le16 *) (unsigned long)(addr)); __v; })
2727
#define in_le32(addr) \
28-
({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; })
28+
({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
2929

3030
#define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
3131
#define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
@@ -73,11 +73,11 @@
7373

7474
#if defined(CONFIG_ATARI_ROM_ISA)
7575
#define rom_in_8(addr) \
76-
({ u16 __v = (*(__force volatile u16 *) (addr)); __v >>= 8; __v; })
76+
({ u16 __v = (*(__force const volatile u16 *) (addr)); __v >>= 8; __v; })
7777
#define rom_in_be16(addr) \
78-
({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
78+
({ u16 __v = (*(__force const volatile u16 *) (addr)); __v; })
7979
#define rom_in_le16(addr) \
80-
({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })
80+
({ u16 __v = le16_to_cpu(*(__force const volatile u16 *) (addr)); __v; })
8181

8282
#define rom_out_8(addr, b) \
8383
(void)({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \
@@ -98,7 +98,8 @@
9898
#define raw_rom_outw(val, port) rom_out_be16((port), (val))
9999
#endif /* CONFIG_ATARI_ROM_ISA */
100100

101-
static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
101+
static inline void raw_insb(const volatile u8 __iomem *port, u8 *buf,
102+
unsigned int len)
102103
{
103104
unsigned int i;
104105

@@ -146,7 +147,7 @@ static inline void raw_outsb(volatile u8 __iomem *port, const u8 *buf,
146147
}
147148
}
148149

149-
static inline void raw_insw(volatile u16 __iomem *port, u16 *buf, unsigned int nr)
150+
static inline void raw_insw(volatile const u16 __iomem *port, u16 *buf, unsigned int nr)
150151
{
151152
unsigned int tmp;
152153

@@ -225,7 +226,7 @@ static inline void raw_outsw(volatile u16 __iomem *port, const u16 *buf,
225226
}
226227
}
227228

228-
static inline void raw_insl(volatile u32 __iomem *port, u32 *buf, unsigned int nr)
229+
static inline void raw_insl(const volatile u32 __iomem *port, u32 *buf, unsigned int nr)
229230
{
230231
unsigned int tmp;
231232

@@ -305,7 +306,7 @@ static inline void raw_outsl(volatile u32 __iomem *port, const u32 *buf,
305306
}
306307

307308

308-
static inline void raw_insw_swapw(volatile u16 __iomem *port, u16 *buf,
309+
static inline void raw_insw_swapw(const volatile u16 __iomem *port, u16 *buf,
309310
unsigned int nr)
310311
{
311312
if ((nr) % 8)
@@ -413,7 +414,8 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
413414

414415

415416
#if defined(CONFIG_ATARI_ROM_ISA)
416-
static inline void raw_rom_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
417+
static inline void raw_rom_insb(const volatile u8 __iomem *port, u8 *buf,
418+
unsigned int len)
417419
{
418420
unsigned int i;
419421

@@ -430,7 +432,7 @@ static inline void raw_rom_outsb(volatile u8 __iomem *port, const u8 *buf,
430432
rom_out_8(port, *buf++);
431433
}
432434

433-
static inline void raw_rom_insw(volatile u16 __iomem *port, u16 *buf,
435+
static inline void raw_rom_insw(const volatile u16 __iomem *port, u16 *buf,
434436
unsigned int nr)
435437
{
436438
unsigned int i;
@@ -448,7 +450,7 @@ static inline void raw_rom_outsw(volatile u16 __iomem *port, const u16 *buf,
448450
rom_out_be16(port, *buf++);
449451
}
450452

451-
static inline void raw_rom_insw_swapw(volatile u16 __iomem *port, u16 *buf,
453+
static inline void raw_rom_insw_swapw(const volatile u16 __iomem *port, u16 *buf,
452454
unsigned int nr)
453455
{
454456
unsigned int i;

0 commit comments

Comments
 (0)