Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iomap: constify ioreadX() iomem argument (as in generic implementation)

Patch series "iomap: Constify ioreadX() iomem argument", v3.

The ioread8/16/32() and others have inconsistent interface among the
architectures: some taking address as const, some not.

It seems there is nothing really stopping all of them to take pointer to
const.

This patch (of 4):

The ioreadX() and ioreadX_rep() helpers have inconsistent interface. On
some architectures void *__iomem address argument is a pointer to const,
on some not.

Implementations of ioreadX() do not modify the memory under the address so
they can be converted to a "const" version for const-safety and
consistency among architectures.

[krzk@kernel.org: sh: clk: fix assignment from incompatible pointer type for ioreadX()]
Link: http://lkml.kernel.org/r/20200723082017.24053-1-krzk@kernel.org
[akpm@linux-foundation.org: fix drivers/mailbox/bcm-pdc-mailbox.c]
Link: http://lkml.kernel.org/r/202007132209.Rxmv4QyS%25lkp@intel.com

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Allen Hubbe <allenbh@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Link: http://lkml.kernel.org/r/20200709072837.5869-1-krzk@kernel.org
Link: http://lkml.kernel.org/r/20200709072837.5869-2-krzk@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Krzysztof Kozlowski and committed by
Linus Torvalds
8f28ca6b f9e7ff9c

+138 -138
+3 -3
arch/alpha/include/asm/core_apecs.h
··· 384 384 } \ 385 385 } while (0) 386 386 387 - __EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) 387 + __EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr) 388 388 { 389 389 unsigned long addr = (unsigned long) xaddr; 390 390 unsigned long result, base_and_type; ··· 420 420 *(vuip) ((addr << 5) + base_and_type) = w; 421 421 } 422 422 423 - __EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) 423 + __EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr) 424 424 { 425 425 unsigned long addr = (unsigned long) xaddr; 426 426 unsigned long result, base_and_type; ··· 456 456 *(vuip) ((addr << 5) + base_and_type) = w; 457 457 } 458 458 459 - __EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) 459 + __EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr) 460 460 { 461 461 unsigned long addr = (unsigned long) xaddr; 462 462 if (addr < APECS_DENSE_MEM)
+3 -3
arch/alpha/include/asm/core_cia.h
··· 342 342 #define vuip volatile unsigned int __force * 343 343 #define vulp volatile unsigned long __force * 344 344 345 - __EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) 345 + __EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr) 346 346 { 347 347 unsigned long addr = (unsigned long) xaddr; 348 348 unsigned long result, base_and_type; ··· 374 374 *(vuip) ((addr << 5) + base_and_type) = w; 375 375 } 376 376 377 - __EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) 377 + __EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr) 378 378 { 379 379 unsigned long addr = (unsigned long) xaddr; 380 380 unsigned long result, base_and_type; ··· 404 404 *(vuip) ((addr << 5) + base_and_type) = w; 405 405 } 406 406 407 - __EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) 407 + __EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr) 408 408 { 409 409 unsigned long addr = (unsigned long) xaddr; 410 410 if (addr < CIA_DENSE_MEM)
+3 -3
arch/alpha/include/asm/core_lca.h
··· 230 230 } while (0) 231 231 232 232 233 - __EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) 233 + __EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr) 234 234 { 235 235 unsigned long addr = (unsigned long) xaddr; 236 236 unsigned long result, base_and_type; ··· 266 266 *(vuip) ((addr << 5) + base_and_type) = w; 267 267 } 268 268 269 - __EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) 269 + __EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr) 270 270 { 271 271 unsigned long addr = (unsigned long) xaddr; 272 272 unsigned long result, base_and_type; ··· 302 302 *(vuip) ((addr << 5) + base_and_type) = w; 303 303 } 304 304 305 - __EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) 305 + __EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr) 306 306 { 307 307 unsigned long addr = (unsigned long) xaddr; 308 308 if (addr < LCA_DENSE_MEM)
+2 -2
arch/alpha/include/asm/core_marvel.h
··· 332 332 #define vucp volatile unsigned char __force * 333 333 #define vusp volatile unsigned short __force * 334 334 335 - extern unsigned int marvel_ioread8(void __iomem *); 335 + extern unsigned int marvel_ioread8(const void __iomem *); 336 336 extern void marvel_iowrite8(u8 b, void __iomem *); 337 337 338 - __EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) 338 + __EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr) 339 339 { 340 340 return __kernel_ldwu(*(vusp)addr); 341 341 }
+3 -3
arch/alpha/include/asm/core_mcpcia.h
··· 267 267 return (addr & 0x80000000UL) == 0; 268 268 } 269 269 270 - __EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) 270 + __EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr) 271 271 { 272 272 unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK; 273 273 unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK; ··· 291 291 *(vuip) ((addr << 5) + hose + 0x00) = w; 292 292 } 293 293 294 - __EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) 294 + __EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr) 295 295 { 296 296 unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK; 297 297 unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK; ··· 315 315 *(vuip) ((addr << 5) + hose + 0x08) = w; 316 316 } 317 317 318 - __EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) 318 + __EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr) 319 319 { 320 320 unsigned long addr = (unsigned long)xaddr; 321 321
+1 -1
arch/alpha/include/asm/core_t2.h
··· 572 572 it doesn't make sense to merge the pio and mmio routines. */ 573 573 574 574 #define IOPORT(OS, NS) \ 575 - __EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ 575 + __EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr) \ 576 576 { \ 577 577 if (t2_is_mmio(xaddr)) \ 578 578 return t2_read##OS(xaddr); \
+6 -6
arch/alpha/include/asm/io.h
··· 150 150 alpha_mv.mv_##NAME(b, addr); \ 151 151 } 152 152 153 - REMAP1(unsigned int, ioread8, /**/) 154 - REMAP1(unsigned int, ioread16, /**/) 155 - REMAP1(unsigned int, ioread32, /**/) 153 + REMAP1(unsigned int, ioread8, const) 154 + REMAP1(unsigned int, ioread16, const) 155 + REMAP1(unsigned int, ioread32, const) 156 156 REMAP1(u8, readb, const volatile) 157 157 REMAP1(u16, readw, const volatile) 158 158 REMAP1(u32, readl, const volatile) ··· 307 307 */ 308 308 309 309 #if IO_CONCAT(__IO_PREFIX,trivial_io_bw) 310 - extern inline unsigned int ioread8(void __iomem *addr) 310 + extern inline unsigned int ioread8(const void __iomem *addr) 311 311 { 312 312 unsigned int ret; 313 313 mb(); ··· 316 316 return ret; 317 317 } 318 318 319 - extern inline unsigned int ioread16(void __iomem *addr) 319 + extern inline unsigned int ioread16(const void __iomem *addr) 320 320 { 321 321 unsigned int ret; 322 322 mb(); ··· 359 359 #endif 360 360 361 361 #if IO_CONCAT(__IO_PREFIX,trivial_io_lq) 362 - extern inline unsigned int ioread32(void __iomem *addr) 362 + extern inline unsigned int ioread32(const void __iomem *addr) 363 363 { 364 364 unsigned int ret; 365 365 mb();
+8 -8
arch/alpha/include/asm/io_trivial.h
··· 7 7 8 8 #if IO_CONCAT(__IO_PREFIX,trivial_io_bw) 9 9 __EXTERN_INLINE unsigned int 10 - IO_CONCAT(__IO_PREFIX,ioread8)(void __iomem *a) 10 + IO_CONCAT(__IO_PREFIX,ioread8)(const void __iomem *a) 11 11 { 12 - return __kernel_ldbu(*(volatile u8 __force *)a); 12 + return __kernel_ldbu(*(const volatile u8 __force *)a); 13 13 } 14 14 15 15 __EXTERN_INLINE unsigned int 16 - IO_CONCAT(__IO_PREFIX,ioread16)(void __iomem *a) 16 + IO_CONCAT(__IO_PREFIX,ioread16)(const void __iomem *a) 17 17 { 18 - return __kernel_ldwu(*(volatile u16 __force *)a); 18 + return __kernel_ldwu(*(const volatile u16 __force *)a); 19 19 } 20 20 21 21 __EXTERN_INLINE void ··· 33 33 34 34 #if IO_CONCAT(__IO_PREFIX,trivial_io_lq) 35 35 __EXTERN_INLINE unsigned int 36 - IO_CONCAT(__IO_PREFIX,ioread32)(void __iomem *a) 36 + IO_CONCAT(__IO_PREFIX,ioread32)(const void __iomem *a) 37 37 { 38 - return *(volatile u32 __force *)a; 38 + return *(const volatile u32 __force *)a; 39 39 } 40 40 41 41 __EXTERN_INLINE void ··· 73 73 __EXTERN_INLINE u8 74 74 IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a) 75 75 { 76 - void __iomem *addr = (void __iomem *)a; 76 + const void __iomem *addr = (const void __iomem *)a; 77 77 return IO_CONCAT(__IO_PREFIX,ioread8)(addr); 78 78 } 79 79 80 80 __EXTERN_INLINE u16 81 81 IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a) 82 82 { 83 - void __iomem *addr = (void __iomem *)a; 83 + const void __iomem *addr = (const void __iomem *)a; 84 84 return IO_CONCAT(__IO_PREFIX,ioread16)(addr); 85 85 } 86 86
+1 -1
arch/alpha/include/asm/jensen.h
··· 305 305 that it doesn't make sense to merge them. */ 306 306 307 307 #define IOPORT(OS, NS) \ 308 - __EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ 308 + __EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr) \ 309 309 { \ 310 310 if (jensen_is_mmio(xaddr)) \ 311 311 return jensen_read##OS(xaddr - 0x100000000ul); \
+3 -3
arch/alpha/include/asm/machvec.h
··· 46 46 void (*mv_pci_tbi)(struct pci_controller *hose, 47 47 dma_addr_t start, dma_addr_t end); 48 48 49 - unsigned int (*mv_ioread8)(void __iomem *); 50 - unsigned int (*mv_ioread16)(void __iomem *); 51 - unsigned int (*mv_ioread32)(void __iomem *); 49 + unsigned int (*mv_ioread8)(const void __iomem *); 50 + unsigned int (*mv_ioread16)(const void __iomem *); 51 + unsigned int (*mv_ioread32)(const void __iomem *); 52 52 53 53 void (*mv_iowrite8)(u8, void __iomem *); 54 54 void (*mv_iowrite16)(u16, void __iomem *);
+1 -1
arch/alpha/kernel/core_marvel.c
··· 806 806 } 807 807 808 808 unsigned int 809 - marvel_ioread8(void __iomem *xaddr) 809 + marvel_ioread8(const void __iomem *xaddr) 810 810 { 811 811 unsigned long addr = (unsigned long) xaddr; 812 812 if (__marvel_is_port_kbd(addr))
+6 -6
arch/alpha/kernel/io.c
··· 14 14 "generic", which bumps through the machine vector. */ 15 15 16 16 unsigned int 17 - ioread8(void __iomem *addr) 17 + ioread8(const void __iomem *addr) 18 18 { 19 19 unsigned int ret; 20 20 mb(); ··· 23 23 return ret; 24 24 } 25 25 26 - unsigned int ioread16(void __iomem *addr) 26 + unsigned int ioread16(const void __iomem *addr) 27 27 { 28 28 unsigned int ret; 29 29 mb(); ··· 32 32 return ret; 33 33 } 34 34 35 - unsigned int ioread32(void __iomem *addr) 35 + unsigned int ioread32(const void __iomem *addr) 36 36 { 37 37 unsigned int ret; 38 38 mb(); ··· 257 257 /* 258 258 * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. 259 259 */ 260 - void ioread8_rep(void __iomem *port, void *dst, unsigned long count) 260 + void ioread8_rep(const void __iomem *port, void *dst, unsigned long count) 261 261 { 262 262 while ((unsigned long)dst & 0x3) { 263 263 if (!count) ··· 300 300 * the interfaces seems to be slow: just using the inlined version 301 301 * of the inw() breaks things. 302 302 */ 303 - void ioread16_rep(void __iomem *port, void *dst, unsigned long count) 303 + void ioread16_rep(const void __iomem *port, void *dst, unsigned long count) 304 304 { 305 305 if (unlikely((unsigned long)dst & 0x3)) { 306 306 if (!count) ··· 340 340 * but the interfaces seems to be slow: just using the inlined version 341 341 * of the inl() breaks things. 342 342 */ 343 - void ioread32_rep(void __iomem *port, void *dst, unsigned long count) 343 + void ioread32_rep(const void __iomem *port, void *dst, unsigned long count) 344 344 { 345 345 if (unlikely((unsigned long)dst & 0x3)) { 346 346 while (count--) {
+2 -2
arch/parisc/include/asm/io.h
··· 303 303 #define ioread64be ioread64be 304 304 #define iowrite64 iowrite64 305 305 #define iowrite64be iowrite64be 306 - extern u64 ioread64(void __iomem *addr); 307 - extern u64 ioread64be(void __iomem *addr); 306 + extern u64 ioread64(const void __iomem *addr); 307 + extern u64 ioread64be(const void __iomem *addr); 308 308 extern void iowrite64(u64 val, void __iomem *addr); 309 309 extern void iowrite64be(u64 val, void __iomem *addr); 310 310
+36 -36
arch/parisc/lib/iomap.c
··· 43 43 #endif 44 44 45 45 struct iomap_ops { 46 - unsigned int (*read8)(void __iomem *); 47 - unsigned int (*read16)(void __iomem *); 48 - unsigned int (*read16be)(void __iomem *); 49 - unsigned int (*read32)(void __iomem *); 50 - unsigned int (*read32be)(void __iomem *); 51 - u64 (*read64)(void __iomem *); 52 - u64 (*read64be)(void __iomem *); 46 + unsigned int (*read8)(const void __iomem *); 47 + unsigned int (*read16)(const void __iomem *); 48 + unsigned int (*read16be)(const void __iomem *); 49 + unsigned int (*read32)(const void __iomem *); 50 + unsigned int (*read32be)(const void __iomem *); 51 + u64 (*read64)(const void __iomem *); 52 + u64 (*read64be)(const void __iomem *); 53 53 void (*write8)(u8, void __iomem *); 54 54 void (*write16)(u16, void __iomem *); 55 55 void (*write16be)(u16, void __iomem *); ··· 57 57 void (*write32be)(u32, void __iomem *); 58 58 void (*write64)(u64, void __iomem *); 59 59 void (*write64be)(u64, void __iomem *); 60 - void (*read8r)(void __iomem *, void *, unsigned long); 61 - void (*read16r)(void __iomem *, void *, unsigned long); 62 - void (*read32r)(void __iomem *, void *, unsigned long); 60 + void (*read8r)(const void __iomem *, void *, unsigned long); 61 + void (*read16r)(const void __iomem *, void *, unsigned long); 62 + void (*read32r)(const void __iomem *, void *, unsigned long); 63 63 void (*write8r)(void __iomem *, const void *, unsigned long); 64 64 void (*write16r)(void __iomem *, const void *, unsigned long); 65 65 void (*write32r)(void __iomem *, const void *, unsigned long); ··· 69 69 70 70 #define ADDR2PORT(addr) ((unsigned long __force)(addr) & 0xffffff) 71 71 72 - static unsigned int ioport_read8(void __iomem *addr) 72 + static unsigned int ioport_read8(const void __iomem *addr) 73 73 { 74 74 return inb(ADDR2PORT(addr)); 75 75 } 76 76 77 - static unsigned int ioport_read16(void __iomem *addr) 77 + static unsigned int ioport_read16(const void __iomem *addr) 78 78 { 79 79 return inw(ADDR2PORT(addr)); 80 80 } 81 81 82 - static unsigned int ioport_read32(void __iomem *addr) 82 + static unsigned int ioport_read32(const void __iomem *addr) 83 83 { 84 84 return inl(ADDR2PORT(addr)); 85 85 } ··· 99 99 outl(datum, ADDR2PORT(addr)); 100 100 } 101 101 102 - static void ioport_read8r(void __iomem *addr, void *dst, unsigned long count) 102 + static void ioport_read8r(const void __iomem *addr, void *dst, unsigned long count) 103 103 { 104 104 insb(ADDR2PORT(addr), dst, count); 105 105 } 106 106 107 - static void ioport_read16r(void __iomem *addr, void *dst, unsigned long count) 107 + static void ioport_read16r(const void __iomem *addr, void *dst, unsigned long count) 108 108 { 109 109 insw(ADDR2PORT(addr), dst, count); 110 110 } 111 111 112 - static void ioport_read32r(void __iomem *addr, void *dst, unsigned long count) 112 + static void ioport_read32r(const void __iomem *addr, void *dst, unsigned long count) 113 113 { 114 114 insl(ADDR2PORT(addr), dst, count); 115 115 } ··· 150 150 151 151 /* Legacy I/O memory ops */ 152 152 153 - static unsigned int iomem_read8(void __iomem *addr) 153 + static unsigned int iomem_read8(const void __iomem *addr) 154 154 { 155 155 return readb(addr); 156 156 } 157 157 158 - static unsigned int iomem_read16(void __iomem *addr) 158 + static unsigned int iomem_read16(const void __iomem *addr) 159 159 { 160 160 return readw(addr); 161 161 } 162 162 163 - static unsigned int iomem_read16be(void __iomem *addr) 163 + static unsigned int iomem_read16be(const void __iomem *addr) 164 164 { 165 165 return __raw_readw(addr); 166 166 } 167 167 168 - static unsigned int iomem_read32(void __iomem *addr) 168 + static unsigned int iomem_read32(const void __iomem *addr) 169 169 { 170 170 return readl(addr); 171 171 } 172 172 173 - static unsigned int iomem_read32be(void __iomem *addr) 173 + static unsigned int iomem_read32be(const void __iomem *addr) 174 174 { 175 175 return __raw_readl(addr); 176 176 } 177 177 178 - static u64 iomem_read64(void __iomem *addr) 178 + static u64 iomem_read64(const void __iomem *addr) 179 179 { 180 180 return readq(addr); 181 181 } 182 182 183 - static u64 iomem_read64be(void __iomem *addr) 183 + static u64 iomem_read64be(const void __iomem *addr) 184 184 { 185 185 return __raw_readq(addr); 186 186 } ··· 220 220 __raw_writel(datum, addr); 221 221 } 222 222 223 - static void iomem_read8r(void __iomem *addr, void *dst, unsigned long count) 223 + static void iomem_read8r(const void __iomem *addr, void *dst, unsigned long count) 224 224 { 225 225 while (count--) { 226 226 *(u8 *)dst = __raw_readb(addr); ··· 228 228 } 229 229 } 230 230 231 - static void iomem_read16r(void __iomem *addr, void *dst, unsigned long count) 231 + static void iomem_read16r(const void __iomem *addr, void *dst, unsigned long count) 232 232 { 233 233 while (count--) { 234 234 *(u16 *)dst = __raw_readw(addr); ··· 236 236 } 237 237 } 238 238 239 - static void iomem_read32r(void __iomem *addr, void *dst, unsigned long count) 239 + static void iomem_read32r(const void __iomem *addr, void *dst, unsigned long count) 240 240 { 241 241 while (count--) { 242 242 *(u32 *)dst = __raw_readl(addr); ··· 297 297 }; 298 298 299 299 300 - unsigned int ioread8(void __iomem *addr) 300 + unsigned int ioread8(const void __iomem *addr) 301 301 { 302 302 if (unlikely(INDIRECT_ADDR(addr))) 303 303 return iomap_ops[ADDR_TO_REGION(addr)]->read8(addr); 304 304 return *((u8 *)addr); 305 305 } 306 306 307 - unsigned int ioread16(void __iomem *addr) 307 + unsigned int ioread16(const void __iomem *addr) 308 308 { 309 309 if (unlikely(INDIRECT_ADDR(addr))) 310 310 return iomap_ops[ADDR_TO_REGION(addr)]->read16(addr); 311 311 return le16_to_cpup((u16 *)addr); 312 312 } 313 313 314 - unsigned int ioread16be(void __iomem *addr) 314 + unsigned int ioread16be(const void __iomem *addr) 315 315 { 316 316 if (unlikely(INDIRECT_ADDR(addr))) 317 317 return iomap_ops[ADDR_TO_REGION(addr)]->read16be(addr); 318 318 return *((u16 *)addr); 319 319 } 320 320 321 - unsigned int ioread32(void __iomem *addr) 321 + unsigned int ioread32(const void __iomem *addr) 322 322 { 323 323 if (unlikely(INDIRECT_ADDR(addr))) 324 324 return iomap_ops[ADDR_TO_REGION(addr)]->read32(addr); 325 325 return le32_to_cpup((u32 *)addr); 326 326 } 327 327 328 - unsigned int ioread32be(void __iomem *addr) 328 + unsigned int ioread32be(const void __iomem *addr) 329 329 { 330 330 if (unlikely(INDIRECT_ADDR(addr))) 331 331 return iomap_ops[ADDR_TO_REGION(addr)]->read32be(addr); 332 332 return *((u32 *)addr); 333 333 } 334 334 335 - u64 ioread64(void __iomem *addr) 335 + u64 ioread64(const void __iomem *addr) 336 336 { 337 337 if (unlikely(INDIRECT_ADDR(addr))) 338 338 return iomap_ops[ADDR_TO_REGION(addr)]->read64(addr); 339 339 return le64_to_cpup((u64 *)addr); 340 340 } 341 341 342 - u64 ioread64be(void __iomem *addr) 342 + u64 ioread64be(const void __iomem *addr) 343 343 { 344 344 if (unlikely(INDIRECT_ADDR(addr))) 345 345 return iomap_ops[ADDR_TO_REGION(addr)]->read64be(addr); ··· 411 411 412 412 /* Repeating interfaces */ 413 413 414 - void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 414 + void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) 415 415 { 416 416 if (unlikely(INDIRECT_ADDR(addr))) { 417 417 iomap_ops[ADDR_TO_REGION(addr)]->read8r(addr, dst, count); ··· 423 423 } 424 424 } 425 425 426 - void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 426 + void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) 427 427 { 428 428 if (unlikely(INDIRECT_ADDR(addr))) { 429 429 iomap_ops[ADDR_TO_REGION(addr)]->read16r(addr, dst, count); ··· 435 435 } 436 436 } 437 437 438 - void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 438 + void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) 439 439 { 440 440 if (unlikely(INDIRECT_ADDR(addr))) { 441 441 iomap_ops[ADDR_TO_REGION(addr)]->read32r(addr, dst, count);
+14 -14
arch/powerpc/kernel/iomap.c
··· 15 15 * Here comes the ppc64 implementation of the IOMAP 16 16 * interfaces. 17 17 */ 18 - unsigned int ioread8(void __iomem *addr) 18 + unsigned int ioread8(const void __iomem *addr) 19 19 { 20 20 return readb(addr); 21 21 } 22 - unsigned int ioread16(void __iomem *addr) 22 + unsigned int ioread16(const void __iomem *addr) 23 23 { 24 24 return readw(addr); 25 25 } 26 - unsigned int ioread16be(void __iomem *addr) 26 + unsigned int ioread16be(const void __iomem *addr) 27 27 { 28 28 return readw_be(addr); 29 29 } 30 - unsigned int ioread32(void __iomem *addr) 30 + unsigned int ioread32(const void __iomem *addr) 31 31 { 32 32 return readl(addr); 33 33 } 34 - unsigned int ioread32be(void __iomem *addr) 34 + unsigned int ioread32be(const void __iomem *addr) 35 35 { 36 36 return readl_be(addr); 37 37 } ··· 41 41 EXPORT_SYMBOL(ioread32); 42 42 EXPORT_SYMBOL(ioread32be); 43 43 #ifdef __powerpc64__ 44 - u64 ioread64(void __iomem *addr) 44 + u64 ioread64(const void __iomem *addr) 45 45 { 46 46 return readq(addr); 47 47 } 48 - u64 ioread64_lo_hi(void __iomem *addr) 48 + u64 ioread64_lo_hi(const void __iomem *addr) 49 49 { 50 50 return readq(addr); 51 51 } 52 - u64 ioread64_hi_lo(void __iomem *addr) 52 + u64 ioread64_hi_lo(const void __iomem *addr) 53 53 { 54 54 return readq(addr); 55 55 } 56 - u64 ioread64be(void __iomem *addr) 56 + u64 ioread64be(const void __iomem *addr) 57 57 { 58 58 return readq_be(addr); 59 59 } 60 - u64 ioread64be_lo_hi(void __iomem *addr) 60 + u64 ioread64be_lo_hi(const void __iomem *addr) 61 61 { 62 62 return readq_be(addr); 63 63 } 64 - u64 ioread64be_hi_lo(void __iomem *addr) 64 + u64 ioread64be_hi_lo(const void __iomem *addr) 65 65 { 66 66 return readq_be(addr); 67 67 } ··· 139 139 * FIXME! We could make these do EEH handling if we really 140 140 * wanted. Not clear if we do. 141 141 */ 142 - void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 142 + void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) 143 143 { 144 144 readsb(addr, dst, count); 145 145 } 146 - void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 146 + void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) 147 147 { 148 148 readsw(addr, dst, count); 149 149 } 150 - void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 150 + void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) 151 151 { 152 152 readsl(addr, dst, count); 153 153 }
+11 -11
arch/sh/kernel/iomap.c
··· 8 8 #include <linux/module.h> 9 9 #include <linux/io.h> 10 10 11 - unsigned int ioread8(void __iomem *addr) 11 + unsigned int ioread8(const void __iomem *addr) 12 12 { 13 13 return readb(addr); 14 14 } 15 15 EXPORT_SYMBOL(ioread8); 16 16 17 - unsigned int ioread16(void __iomem *addr) 17 + unsigned int ioread16(const void __iomem *addr) 18 18 { 19 19 return readw(addr); 20 20 } 21 21 EXPORT_SYMBOL(ioread16); 22 22 23 - unsigned int ioread16be(void __iomem *addr) 23 + unsigned int ioread16be(const void __iomem *addr) 24 24 { 25 25 return be16_to_cpu(__raw_readw(addr)); 26 26 } 27 27 EXPORT_SYMBOL(ioread16be); 28 28 29 - unsigned int ioread32(void __iomem *addr) 29 + unsigned int ioread32(const void __iomem *addr) 30 30 { 31 31 return readl(addr); 32 32 } 33 33 EXPORT_SYMBOL(ioread32); 34 34 35 - unsigned int ioread32be(void __iomem *addr) 35 + unsigned int ioread32be(const void __iomem *addr) 36 36 { 37 37 return be32_to_cpu(__raw_readl(addr)); 38 38 } ··· 74 74 * convert to CPU byte order. We write in "IO byte 75 75 * order" (we also don't have IO barriers). 76 76 */ 77 - static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) 77 + static inline void mmio_insb(const void __iomem *addr, u8 *dst, int count) 78 78 { 79 79 while (--count >= 0) { 80 80 u8 data = __raw_readb(addr); ··· 83 83 } 84 84 } 85 85 86 - static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) 86 + static inline void mmio_insw(const void __iomem *addr, u16 *dst, int count) 87 87 { 88 88 while (--count >= 0) { 89 89 u16 data = __raw_readw(addr); ··· 92 92 } 93 93 } 94 94 95 - static inline void mmio_insl(void __iomem *addr, u32 *dst, int count) 95 + static inline void mmio_insl(const void __iomem *addr, u32 *dst, int count) 96 96 { 97 97 while (--count >= 0) { 98 98 u32 data = __raw_readl(addr); ··· 125 125 } 126 126 } 127 127 128 - void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 128 + void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) 129 129 { 130 130 mmio_insb(addr, dst, count); 131 131 } 132 132 EXPORT_SYMBOL(ioread8_rep); 133 133 134 - void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 134 + void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) 135 135 { 136 136 mmio_insw(addr, dst, count); 137 137 } 138 138 EXPORT_SYMBOL(ioread16_rep); 139 139 140 - void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 140 + void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) 141 141 { 142 142 mmio_insl(addr, dst, count); 143 143 }
+1 -1
drivers/mailbox/bcm-pdc-mailbox.c
··· 679 679 680 680 /* read last_rx_curr from register once */ 681 681 pdcs->last_rx_curr = 682 - (ioread32(&pdcs->rxregs_64->status0) & 682 + (ioread32((const void __iomem *)&pdcs->rxregs_64->status0) & 683 683 CRYPTO_D64_RS0_CD_MASK) / RING_ENTRY_SIZE; 684 684 685 685 do {
+1 -1
drivers/sh/clk/cpg.c
··· 40 40 { 41 41 sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk); 42 42 if (clk->status_reg) { 43 - unsigned int (*read)(void __iomem *addr); 43 + unsigned int (*read)(const void __iomem *addr); 44 44 int i; 45 45 void __iomem *mapped_status = (phys_addr_t)clk->status_reg - 46 46 (phys_addr_t)clk->enable_reg + clk->mapped_reg;
+14 -14
include/asm-generic/iomap.h
··· 26 26 * in the low address range. Architectures for which this is not 27 27 * true can't use this generic implementation. 28 28 */ 29 - extern unsigned int ioread8(void __iomem *); 30 - extern unsigned int ioread16(void __iomem *); 31 - extern unsigned int ioread16be(void __iomem *); 32 - extern unsigned int ioread32(void __iomem *); 33 - extern unsigned int ioread32be(void __iomem *); 29 + extern unsigned int ioread8(const void __iomem *); 30 + extern unsigned int ioread16(const void __iomem *); 31 + extern unsigned int ioread16be(const void __iomem *); 32 + extern unsigned int ioread32(const void __iomem *); 33 + extern unsigned int ioread32be(const void __iomem *); 34 34 #ifdef CONFIG_64BIT 35 - extern u64 ioread64(void __iomem *); 36 - extern u64 ioread64be(void __iomem *); 35 + extern u64 ioread64(const void __iomem *); 36 + extern u64 ioread64be(const void __iomem *); 37 37 #endif 38 38 39 39 #ifdef readq ··· 41 41 #define ioread64_hi_lo ioread64_hi_lo 42 42 #define ioread64be_lo_hi ioread64be_lo_hi 43 43 #define ioread64be_hi_lo ioread64be_hi_lo 44 - extern u64 ioread64_lo_hi(void __iomem *addr); 45 - extern u64 ioread64_hi_lo(void __iomem *addr); 46 - extern u64 ioread64be_lo_hi(void __iomem *addr); 47 - extern u64 ioread64be_hi_lo(void __iomem *addr); 44 + extern u64 ioread64_lo_hi(const void __iomem *addr); 45 + extern u64 ioread64_hi_lo(const void __iomem *addr); 46 + extern u64 ioread64be_lo_hi(const void __iomem *addr); 47 + extern u64 ioread64be_hi_lo(const void __iomem *addr); 48 48 #endif 49 49 50 50 extern void iowrite8(u8, void __iomem *); ··· 79 79 * memory across multiple ports, use "memcpy_toio()" 80 80 * and friends. 81 81 */ 82 - extern void ioread8_rep(void __iomem *port, void *buf, unsigned long count); 83 - extern void ioread16_rep(void __iomem *port, void *buf, unsigned long count); 84 - extern void ioread32_rep(void __iomem *port, void *buf, unsigned long count); 82 + extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); 83 + extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); 84 + extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); 85 85 86 86 extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); 87 87 extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
+2 -2
include/linux/io-64-nonatomic-hi-lo.h
··· 57 57 58 58 #ifndef ioread64_hi_lo 59 59 #define ioread64_hi_lo ioread64_hi_lo 60 - static inline u64 ioread64_hi_lo(void __iomem *addr) 60 + static inline u64 ioread64_hi_lo(const void __iomem *addr) 61 61 { 62 62 u32 low, high; 63 63 ··· 79 79 80 80 #ifndef ioread64be_hi_lo 81 81 #define ioread64be_hi_lo ioread64be_hi_lo 82 - static inline u64 ioread64be_hi_lo(void __iomem *addr) 82 + static inline u64 ioread64be_hi_lo(const void __iomem *addr) 83 83 { 84 84 u32 low, high; 85 85
+2 -2
include/linux/io-64-nonatomic-lo-hi.h
··· 57 57 58 58 #ifndef ioread64_lo_hi 59 59 #define ioread64_lo_hi ioread64_lo_hi 60 - static inline u64 ioread64_lo_hi(void __iomem *addr) 60 + static inline u64 ioread64_lo_hi(const void __iomem *addr) 61 61 { 62 62 u32 low, high; 63 63 ··· 79 79 80 80 #ifndef ioread64be_lo_hi 81 81 #define ioread64be_lo_hi ioread64be_lo_hi 82 - static inline u64 ioread64be_lo_hi(void __iomem *addr) 82 + static inline u64 ioread64be_lo_hi(const void __iomem *addr) 83 83 { 84 84 u32 low, high; 85 85
+15 -15
lib/iomap.c
··· 70 70 #define mmio_read64be(addr) swab64(readq(addr)) 71 71 #endif 72 72 73 - unsigned int ioread8(void __iomem *addr) 73 + unsigned int ioread8(const void __iomem *addr) 74 74 { 75 75 IO_COND(addr, return inb(port), return readb(addr)); 76 76 return 0xff; 77 77 } 78 - unsigned int ioread16(void __iomem *addr) 78 + unsigned int ioread16(const void __iomem *addr) 79 79 { 80 80 IO_COND(addr, return inw(port), return readw(addr)); 81 81 return 0xffff; 82 82 } 83 - unsigned int ioread16be(void __iomem *addr) 83 + unsigned int ioread16be(const void __iomem *addr) 84 84 { 85 85 IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr)); 86 86 return 0xffff; 87 87 } 88 - unsigned int ioread32(void __iomem *addr) 88 + unsigned int ioread32(const void __iomem *addr) 89 89 { 90 90 IO_COND(addr, return inl(port), return readl(addr)); 91 91 return 0xffffffff; 92 92 } 93 - unsigned int ioread32be(void __iomem *addr) 93 + unsigned int ioread32be(const void __iomem *addr) 94 94 { 95 95 IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr)); 96 96 return 0xffffffff; ··· 142 142 return lo | (hi << 32); 143 143 } 144 144 145 - u64 ioread64_lo_hi(void __iomem *addr) 145 + u64 ioread64_lo_hi(const void __iomem *addr) 146 146 { 147 147 IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr)); 148 148 return 0xffffffffffffffffULL; 149 149 } 150 150 151 - u64 ioread64_hi_lo(void __iomem *addr) 151 + u64 ioread64_hi_lo(const void __iomem *addr) 152 152 { 153 153 IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr)); 154 154 return 0xffffffffffffffffULL; 155 155 } 156 156 157 - u64 ioread64be_lo_hi(void __iomem *addr) 157 + u64 ioread64be_lo_hi(const void __iomem *addr) 158 158 { 159 159 IO_COND(addr, return pio_read64be_lo_hi(port), 160 160 return mmio_read64be(addr)); 161 161 return 0xffffffffffffffffULL; 162 162 } 163 163 164 - u64 ioread64be_hi_lo(void __iomem *addr) 164 + u64 ioread64be_hi_lo(const void __iomem *addr) 165 165 { 166 166 IO_COND(addr, return pio_read64be_hi_lo(port), 167 167 return mmio_read64be(addr)); ··· 275 275 * order" (we also don't have IO barriers). 276 276 */ 277 277 #ifndef mmio_insb 278 - static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) 278 + static inline void mmio_insb(const void __iomem *addr, u8 *dst, int count) 279 279 { 280 280 while (--count >= 0) { 281 281 u8 data = __raw_readb(addr); ··· 283 283 dst++; 284 284 } 285 285 } 286 - static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) 286 + static inline void mmio_insw(const void __iomem *addr, u16 *dst, int count) 287 287 { 288 288 while (--count >= 0) { 289 289 u16 data = __raw_readw(addr); ··· 291 291 dst++; 292 292 } 293 293 } 294 - static inline void mmio_insl(void __iomem *addr, u32 *dst, int count) 294 + static inline void mmio_insl(const void __iomem *addr, u32 *dst, int count) 295 295 { 296 296 while (--count >= 0) { 297 297 u32 data = __raw_readl(addr); ··· 325 325 } 326 326 #endif 327 327 328 - void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) 328 + void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) 329 329 { 330 330 IO_COND(addr, insb(port,dst,count), mmio_insb(addr, dst, count)); 331 331 } 332 - void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) 332 + void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) 333 333 { 334 334 IO_COND(addr, insw(port,dst,count), mmio_insw(addr, dst, count)); 335 335 } 336 - void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) 336 + void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) 337 337 { 338 338 IO_COND(addr, insl(port,dst,count), mmio_insl(addr, dst, count)); 339 339 }