iomap: Constify ioreadX() iomem argument
Subsystems (20)
v2 cover iomap: Constify ioreadX() iomem argument
Hi,
Changes since v1
================
https://lore.kernel.org/lkml/[email protected]/
1. Constify also ioreadX_rep() and mmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add acks and reviews,
4. Re-order patches so all optional driver changes are at the end.
Description
===========
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.
Patchset was only compile tested on affected architectures. No real testing.
volatile
========
There is still interface inconsistency between architectures around "volatile" qualifier:
- include/asm-generic/io.h:static inline u32 ioread32(const volatile void __iomem *addr)
- include/asm-generic/iomap.h:extern unsigned int ioread32(const void __iomem *);
This is still discussed and out of scope of this patchset.
Merging
=======
Multiple architectures are affected in first patch so acks are welcomed.
1. All patches depend on first patch,
2. Patches 2-4 unify the interface also in few drivers,
3. PAtches 5-9 are optional cleanup, without actual impact.
Best regards,
Krzysztof
Krzysztof Kozlowski (9):
iomap: Constify ioreadX() iomem argument (as in generic
implementation)
rtl818x: Constify ioreadX() iomem argument (as in generic
implementation)
ntb: intel: Constify ioreadX() iomem argument (as in generic
implementation)
virtio: pci: Constify ioreadX() iomem argument (as in generic
implementation)
arc: Constify ioreadX() iomem argument (as in generic implementation) drm/mgag200: Constify ioreadX() iomem argument (as in generic
implementation)
drm/nouveau: Constify ioreadX() iomem argument (as in generic
implementation)
media: fsl-viu: Constify ioreadX() iomem argument (as in generic
implementation)
ath5k: Constify ioreadX() iomem argument (as in generic
implementation)
arch/alpha/include/asm/core_apecs.h | 6 +- arch/alpha/include/asm/core_cia.h | 6 +- arch/alpha/include/asm/core_lca.h | 6 +- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++-- arch/alpha/include/asm/io_trivial.h | 16 ++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++-- arch/arc/plat-axs10x/axs10x.c | 4 +- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++---------- arch/powerpc/kernel/iomap.c | 28 ++++---- arch/sh/kernel/iomap.c | 22 +++--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- drivers/media/platform/fsl-viu.c | 2 +- drivers/net/wireless/ath/ath5k/ahb.c | 10 +-- .../realtek/rtl818x/rtl8180/rtl8180.h | 6 +- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/ntb/hw/intel/ntb_hw_gen3.h | 2 +- drivers/ntb/hw/intel/ntb_hw_intel.h | 2 +- drivers/virtio/virtio_pci_modern.c | 6 +- include/asm-generic/iomap.h | 28 ++++---- include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 ++++---- 30 files changed, 156 insertions(+), 156 deletions(-)
Signature · 1 line
2.17.1
PATCH RESEND v2 1/9 iomap: Constify ioreadX() iomem argument (as in generic implementation)
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.
---
Changes since v1:
1. Constify also ioreadX_rep() and mmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add Geert's review.
4. Add Arnd's review.
--- arch/alpha/include/asm/core_apecs.h | 6 +-- arch/alpha/include/asm/core_cia.h | 6 +-- arch/alpha/include/asm/core_lca.h | 6 +-- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +-- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++--- arch/alpha/include/asm/io_trivial.h | 16 +++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +-- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++--- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++++++-------------- arch/powerpc/kernel/iomap.c | 28 +++++------ arch/sh/kernel/iomap.c | 22 ++++---- include/asm-generic/iomap.h | 28 +++++------ include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 +++++------ 20 files changed, 136 insertions(+), 136 deletions(-)
arch/alpha/include/asm/core_apecs.h +3 -3
@@ -384,7 +384,7 @@ struct el_apecs_procdata } \ }while (0 ) -__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <APECS_DENSE_MEM )
arch/alpha/include/asm/core_cia.h +3 -3
@@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {#define vuip volatile unsigned int __force *#define vulp volatile unsigned long __force * -__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <CIA_DENSE_MEM )
arch/alpha/include/asm/core_lca.h +3 -3
@@ -230,7 +230,7 @@ union el_lca { }while (0 ) -__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <LCA_DENSE_MEM )
arch/alpha/include/asm/core_marvel.h +2 -2
@@ -332,10 +332,10 @@ struct io7 {#define vucp volatile unsigned char __force *#define vusp volatile unsigned short __force * -extern unsigned int marvel_ioread8 (void __iomem *); +extern unsigned int marvel_ioread8 (const void __iomem *);extern void marvel_iowrite8 (u8 b,void __iomem *); -__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) +__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr) {return __kernel_ldwu (*(vusp )addr); }
arch/alpha/include/asm/core_mcpcia.h +3 -3
@@ -267,7 +267,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)return (addr &0x80000000UL ) =0 ; } -__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -291,7 +291,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x00 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -315,7 +315,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x08 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr;
arch/alpha/include/asm/core_t2.h +1 -1
@@ -572,7 +572,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)it doesn't make sense to merge the pio and mmio routines. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ return t2_read##OS(xaddr); \
arch/alpha/include/asm/io.h +6 -6
@@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ alpha_mv.mv_##NAME(b, addr); \ } -REMAP1(unsigned int, ioread8, /**/) -REMAP1(unsigned int, ioread16, /**/) -REMAP1(unsigned int, ioread32, /**/) +REMAP1(unsigned int, ioread8, const) +REMAP1(unsigned int, ioread16, const) +REMAP1(unsigned int, ioread32, const) REMAP1(u8, readb, const volatile) REMAP1(u16, readw, const volatile) REMAP1(u32, readl, const volatile)
@@ -308,14 +308,14 @@ static inline int __is_mmio(const volatile void __iomem *addr)*/ #if IO_CONCAT (__IO_PREFIX,trivial_io_bw) -extern inline unsigned int ioread8 (void __iomem *addr) +extern inline unsigned int ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -extern inline unsigned int ioread16 (void __iomem *addr) +extern inline unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();
@@ -356,7 +356,7 @@ extern inline void outw(u16 b, unsigned long port)#endif #if IO_CONCAT (__IO_PREFIX,trivial_io_lq) -extern inline unsigned int ioread32 (void __iomem *addr) +extern inline unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
arch/alpha/include/asm/io_trivial.h +8 -8
@@ -7,15 +7,15 @@#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread8 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread8 )(const void __iomem *a) { -return __kernel_ldbu (*(volatile u8 __force *)a); +return __kernel_ldbu (*(const volatile u8 __force *)a); } __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread16 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread16 )(const void __iomem *a) { -return __kernel_ldwu (*(volatile u16 __force *)a); +return __kernel_ldwu (*(const volatile u16 __force *)a); }__EXTERN_INLINE void
@@ -33,9 +33,9 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread32 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread32 )(const void __iomem *a) { -return *(volatile u32 __force *)a; +return *(const volatile u32 __force *)a; }__EXTERN_INLINE void
@@ -73,14 +73,14 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) __EXTERN_INLINE u8IO_CONCAT (__IO_PREFIX ,readb )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread8)(addr); } __EXTERN_INLINE u16IO_CONCAT (__IO_PREFIX ,readw )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread16)(addr); }
arch/alpha/include/asm/jensen.h +1 -1
@@ -305,7 +305,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)that it doesn't make sense to merge them. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr) \ { \ if (jensen_is_mmio(xaddr)) \ return jensen_read##OS(xaddr - 0x100000000ul); \
arch/alpha/include/asm/machvec.h +3 -3
@@ -46,9 +46,9 @@ struct alpha_machine_vectorvoid (*mv_pci_tbi)(struct pci_controller *hose,dma_addr_t start,dma_addr_t end); -unsigned int (*mv_ioread8)(void __iomem *); -unsigned int (*mv_ioread16)(void __iomem *); -unsigned int (*mv_ioread32)(void __iomem *); +unsigned int (*mv_ioread8)(const void __iomem *); +unsigned int (*mv_ioread16)(const void __iomem *); +unsigned int (*mv_ioread32)(const void __iomem *);void (*mv_iowrite8)(u8 ,void __iomem *);void (*mv_iowrite16)(u16 ,void __iomem *);
arch/alpha/kernel/core_marvel.c +1 -1
@@ -807,7 +807,7 @@ void __iomem *marvel_ioportmap (unsigned long addr) }unsigned int -marvel_ioread8 (void __iomem *xaddr) +marvel_ioread8 (const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (__marvel_is_port_kbd (addr))
arch/alpha/kernel/io.c +6 -6
@@ -14,21 +14,21 @@"generic", which bumps through the machine vector. */ unsigned int -ioread8 (void __iomem *addr) +ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(writeq);/* * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ -void ioread8_rep (void __iomem *port,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *port,void *dst,unsigned long count) {while ((unsigned long )dst &0x3 ) {if (!count)
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(insb);* the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -void ioread16_rep (void __iomem *port,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {if (!count)
@@ -294,7 +294,7 @@ EXPORT_SYMBOL(insw);* but the interfaces seems to be slow: just using the inlined version * of the inl() breaks things. */ -void ioread32_rep (void __iomem *port,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {while (count--) {
arch/parisc/include/asm/io.h +2 -2
@@ -303,8 +303,8 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);#define ioread64be ioread64be#define iowrite64 iowrite64#define iowrite64be iowrite64be -extern u64 ioread64 (void __iomem *addr); -extern u64 ioread64be (void __iomem *addr); +extern u64 ioread64 (const void __iomem *addr); +extern u64 ioread64be (const void __iomem *addr);extern void iowrite64 (u64 val,void __iomem *addr);extern void iowrite64be (u64 val,void __iomem *addr);
arch/parisc/lib/iomap.c +36 -36
220 lines not on this page · raw message
arch/powerpc/kernel/iomap.c +14 -14
@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }
@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }
@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
arch/sh/kernel/iomap.c +11 -11
@@ -8,31 +8,31 @@#include <linux/module.h> #include <linux/io.h> -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); }EXPORT_SYMBOL (ioread8); -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); }EXPORT_SYMBOL (ioread16); -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return be16_to_cpu (__raw_readw (addr)); }EXPORT_SYMBOL (ioread16be); -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); }EXPORT_SYMBOL (ioread32); -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return be32_to_cpu (__raw_readl (addr)); }
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iowrite32be);* convert to CPU byte order. We write in "IO byte * order" (we also don't have IO barriers). */ -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -83,7 +83,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -92,7 +92,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -125,19 +125,19 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) } } -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insb (addr, dst, count); }EXPORT_SYMBOL (ioread8_rep); -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insw (addr, dst, count); }EXPORT_SYMBOL (ioread16_rep); -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insl (addr, dst, count); }
include/asm-generic/iomap.h +14 -14
@@ -26,14 +26,14 @@* in the low address range. Architectures for which this is not * true can't use this generic implementation. */ -extern unsigned int ioread8 (void __iomem *); -extern unsigned int ioread16 (void __iomem *); -extern unsigned int ioread16be (void __iomem *); -extern unsigned int ioread32 (void __iomem *); -extern unsigned int ioread32be (void __iomem *); +extern unsigned int ioread8 (const void __iomem *); +extern unsigned int ioread16 (const void __iomem *); +extern unsigned int ioread16be (const void __iomem *); +extern unsigned int ioread32 (const void __iomem *); +extern unsigned int ioread32be (const void __iomem *);#ifdef CONFIG_64BIT -extern u64 ioread64 (void __iomem *); -extern u64 ioread64be (void __iomem *); +extern u64 ioread64 (const void __iomem *); +extern u64 ioread64be (const void __iomem *);#endif #ifdef readq
@@ -41,10 +41,10 @@ extern u64 ioread64be(void __iomem *);#define ioread64_hi_lo ioread64_hi_lo#define ioread64be_lo_hi ioread64be_lo_hi#define ioread64be_hi_lo ioread64be_hi_lo -extern u64 ioread64_lo_hi (void __iomem *addr); -extern u64 ioread64_hi_lo (void __iomem *addr); -extern u64 ioread64be_lo_hi (void __iomem *addr); -extern u64 ioread64be_hi_lo (void __iomem *addr); +extern u64 ioread64_lo_hi (const void __iomem *addr); +extern u64 ioread64_hi_lo (const void __iomem *addr); +extern u64 ioread64be_lo_hi (const void __iomem *addr); +extern u64 ioread64be_hi_lo (const void __iomem *addr);#endif extern void iowrite8 (u8 ,void __iomem *);
@@ -79,9 +79,9 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr);* memory across multiple ports, use "memcpy_toio()" * and friends. */ -extern void ioread8_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread16_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread32_rep (void __iomem *port,void *buf,unsigned long count); +extern void ioread8_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread16_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread32_rep (const void __iomem *port,void *buf,unsigned long count);extern void iowrite8_rep (void __iomem *port,const void *buf,unsigned long count);extern void iowrite16_rep (void __iomem *port,const void *buf,unsigned long count);
include/linux/io-64-nonatomic-hi-lo.h +2 -2
@@ -57,7 +57,7 @@ static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_hi_lo#define ioread64_hi_lo ioread64_hi_lo -static inline u64 ioread64_hi_lo (void __iomem *addr) +static inline u64 ioread64_hi_lo (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_hi_lo(u64 val, void __iomem *addr)#ifndef ioread64be_hi_lo#define ioread64be_hi_lo ioread64be_hi_lo -static inline u64 ioread64be_hi_lo (void __iomem *addr) +static inline u64 ioread64be_hi_lo (const void __iomem *addr) {u32 low, high;
include/linux/io-64-nonatomic-lo-hi.h +2 -2
@@ -57,7 +57,7 @@ static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_lo_hi#define ioread64_lo_hi ioread64_lo_hi -static inline u64 ioread64_lo_hi (void __iomem *addr) +static inline u64 ioread64_lo_hi (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_lo_hi(u64 val, void __iomem *addr)#ifndef ioread64be_lo_hi#define ioread64be_lo_hi ioread64be_lo_hi -static inline u64 ioread64be_lo_hi (void __iomem *addr) +static inline u64 ioread64be_lo_hi (const void __iomem *addr) {u32 low, high;
lib/iomap.c +15 -15
@@ -70,27 +70,27 @@ static void bad_io_access(unsigned long port, const char *access)#define mmio_read64be (addr) swab64(readq(addr))#endif -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) { IO_COND(addr, return inb(port), return readb(addr));return 0xff ; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) { IO_COND(addr, return inw(port), return readw(addr));return 0xffff ; } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) { IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr));return 0xffff ; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) { IO_COND(addr, return inl(port), return readl(addr));return 0xffffffff ; } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) { IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr));return 0xffffffff ;
@@ -142,26 +142,26 @@ static u64 pio_read64be_hi_lo(unsigned long port)return lo | (hi <<32 ); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64be_lo_hi(port), return mmio_read64be(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64be_hi_lo(port), return mmio_read64be(addr));
@@ -275,7 +275,7 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* order" (we also don't have IO barriers). */ #ifndef mmio_insb -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -283,7 +283,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) dst++; } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -291,7 +291,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) dst++; } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -325,15 +325,15 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) }#endif -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insb (port,dst,count),mmio_insb (addr, dst, count)); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insw (port,dst,count),mmio_insw (addr, dst, count)); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insl (port,dst,count),mmio_insl (addr, dst, count)); }
Signature · 1 line
2.17.1
PATCH RESEND v2 1/9 iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe 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.
---
Changes since v1:
1. Constify also ioreadX_rep() and mmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add Geert's review.
4. Add Arnd's review.
--- arch/alpha/include/asm/core_apecs.h | 6 +-- arch/alpha/include/asm/core_cia.h | 6 +-- arch/alpha/include/asm/core_lca.h | 6 +-- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +-- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++--- arch/alpha/include/asm/io_trivial.h | 16 +++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +-- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++--- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++++++-------------- arch/powerpc/kernel/iomap.c | 28 +++++------ arch/sh/kernel/iomap.c | 22 ++++---- include/asm-generic/iomap.h | 28 +++++------ include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 +++++------ 20 files changed, 136 insertions(+), 136 deletions(-)
arch/alpha/include/asm/core_apecs.h +3 -3
@@ -384,7 +384,7 @@ struct el_apecs_procdata } \ }while (0 ) -__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <APECS_DENSE_MEM )
arch/alpha/include/asm/core_cia.h +3 -3
@@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {#define vuip volatile unsigned int __force *#define vulp volatile unsigned long __force * -__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <CIA_DENSE_MEM )
arch/alpha/include/asm/core_lca.h +3 -3
@@ -230,7 +230,7 @@ union el_lca { }while (0 ) -__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <LCA_DENSE_MEM )
arch/alpha/include/asm/core_marvel.h +2 -2
@@ -332,10 +332,10 @@ struct io7 {#define vucp volatile unsigned char __force *#define vusp volatile unsigned short __force * -extern unsigned int marvel_ioread8 (void __iomem *); +extern unsigned int marvel_ioread8 (const void __iomem *);extern void marvel_iowrite8 (u8 b,void __iomem *); -__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) +__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr) {return __kernel_ldwu (*(vusp )addr); }
arch/alpha/include/asm/core_mcpcia.h +3 -3
@@ -267,7 +267,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)return (addr &0x80000000UL ) ==0 ; } -__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -291,7 +291,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x00 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -315,7 +315,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x08 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr;
arch/alpha/include/asm/core_t2.h +1 -1
@@ -572,7 +572,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)it doesn't make sense to merge the pio and mmio routines. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ return t2_read##OS(xaddr); \
arch/alpha/include/asm/io.h +6 -6
@@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ alpha_mv.mv_##NAME(b, addr); \ } -REMAP1(unsigned int, ioread8, /**/) -REMAP1(unsigned int, ioread16, /**/) -REMAP1(unsigned int, ioread32, /**/) +REMAP1(unsigned int, ioread8, const) +REMAP1(unsigned int, ioread16, const) +REMAP1(unsigned int, ioread32, const) REMAP1(u8, readb, const volatile) REMAP1(u16, readw, const volatile) REMAP1(u32, readl, const volatile)
@@ -308,14 +308,14 @@ static inline int __is_mmio(const volatile void __iomem *addr)*/ #if IO_CONCAT (__IO_PREFIX,trivial_io_bw) -extern inline unsigned int ioread8 (void __iomem *addr) +extern inline unsigned int ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -extern inline unsigned int ioread16 (void __iomem *addr) +extern inline unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();
@@ -356,7 +356,7 @@ extern inline void outw(u16 b, unsigned long port)#endif #if IO_CONCAT (__IO_PREFIX,trivial_io_lq) -extern inline unsigned int ioread32 (void __iomem *addr) +extern inline unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
arch/alpha/include/asm/io_trivial.h +8 -8
@@ -7,15 +7,15 @@#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread8 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread8 )(const void __iomem *a) { -return __kernel_ldbu (*(volatile u8 __force *)a); +return __kernel_ldbu (*(const volatile u8 __force *)a); } __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread16 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread16 )(const void __iomem *a) { -return __kernel_ldwu (*(volatile u16 __force *)a); +return __kernel_ldwu (*(const volatile u16 __force *)a); }__EXTERN_INLINE void
@@ -33,9 +33,9 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread32 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread32 )(const void __iomem *a) { -return *(volatile u32 __force *)a; +return *(const volatile u32 __force *)a; }__EXTERN_INLINE void
@@ -73,14 +73,14 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) __EXTERN_INLINE u8IO_CONCAT (__IO_PREFIX ,readb )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread8)(addr); } __EXTERN_INLINE u16IO_CONCAT (__IO_PREFIX ,readw )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread16)(addr); }
arch/alpha/include/asm/jensen.h +1 -1
@@ -305,7 +305,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)that it doesn't make sense to merge them. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr) \ { \ if (jensen_is_mmio(xaddr)) \ return jensen_read##OS(xaddr - 0x100000000ul); \
arch/alpha/include/asm/machvec.h +3 -3
@@ -46,9 +46,9 @@ struct alpha_machine_vectorvoid (*mv_pci_tbi)(struct pci_controller *hose,dma_addr_t start,dma_addr_t end); -unsigned int (*mv_ioread8)(void __iomem *); -unsigned int (*mv_ioread16)(void __iomem *); -unsigned int (*mv_ioread32)(void __iomem *); +unsigned int (*mv_ioread8)(const void __iomem *); +unsigned int (*mv_ioread16)(const void __iomem *); +unsigned int (*mv_ioread32)(const void __iomem *);void (*mv_iowrite8)(u8 ,void __iomem *);void (*mv_iowrite16)(u16 ,void __iomem *);
arch/alpha/kernel/core_marvel.c +1 -1
@@ -807,7 +807,7 @@ void __iomem *marvel_ioportmap (unsigned long addr) }unsigned int -marvel_ioread8 (void __iomem *xaddr) +marvel_ioread8 (const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (__marvel_is_port_kbd (addr))
arch/alpha/kernel/io.c +6 -6
@@ -14,21 +14,21 @@"generic", which bumps through the machine vector. */ unsigned int -ioread8 (void __iomem *addr) +ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(writeq);/* * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ -void ioread8_rep (void __iomem *port,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *port,void *dst,unsigned long count) {while ((unsigned long )dst &0x3 ) {if (!count)
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(insb);* the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -void ioread16_rep (void __iomem *port,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {if (!count)
@@ -294,7 +294,7 @@ EXPORT_SYMBOL(insw);* but the interfaces seems to be slow: just using the inlined version * of the inl() breaks things. */ -void ioread32_rep (void __iomem *port,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {while (count--) {
arch/parisc/include/asm/io.h +2 -2
@@ -303,8 +303,8 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);#define ioread64be ioread64be#define iowrite64 iowrite64#define iowrite64be iowrite64be -extern u64 ioread64 (void __iomem *addr); -extern u64 ioread64be (void __iomem *addr); +extern u64 ioread64 (const void __iomem *addr); +extern u64 ioread64be (const void __iomem *addr);extern void iowrite64 (u64 val,void __iomem *addr);extern void iowrite64be (u64 val,void __iomem *addr);
arch/parisc/lib/iomap.c +36 -36
220 lines not on this page · raw message
arch/powerpc/kernel/iomap.c +14 -14
@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }
@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }
@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
arch/sh/kernel/iomap.c +11 -11
@@ -8,31 +8,31 @@#include <linux/module.h> #include <linux/io.h> -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); }EXPORT_SYMBOL (ioread8); -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); }EXPORT_SYMBOL (ioread16); -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return be16_to_cpu (__raw_readw (addr)); }EXPORT_SYMBOL (ioread16be); -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); }EXPORT_SYMBOL (ioread32); -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return be32_to_cpu (__raw_readl (addr)); }
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iowrite32be);* convert to CPU byte order. We write in "IO byte * order" (we also don't have IO barriers). */ -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -83,7 +83,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -92,7 +92,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -125,19 +125,19 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) } } -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insb (addr, dst, count); }EXPORT_SYMBOL (ioread8_rep); -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insw (addr, dst, count); }EXPORT_SYMBOL (ioread16_rep); -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insl (addr, dst, count); }
include/asm-generic/iomap.h +14 -14
@@ -26,14 +26,14 @@* in the low address range. Architectures for which this is not * true can't use this generic implementation. */ -extern unsigned int ioread8 (void __iomem *); -extern unsigned int ioread16 (void __iomem *); -extern unsigned int ioread16be (void __iomem *); -extern unsigned int ioread32 (void __iomem *); -extern unsigned int ioread32be (void __iomem *); +extern unsigned int ioread8 (const void __iomem *); +extern unsigned int ioread16 (const void __iomem *); +extern unsigned int ioread16be (const void __iomem *); +extern unsigned int ioread32 (const void __iomem *); +extern unsigned int ioread32be (const void __iomem *);#ifdef CONFIG_64BIT -extern u64 ioread64 (void __iomem *); -extern u64 ioread64be (void __iomem *); +extern u64 ioread64 (const void __iomem *); +extern u64 ioread64be (const void __iomem *);#endif #ifdef readq
@@ -41,10 +41,10 @@ extern u64 ioread64be(void __iomem *);#define ioread64_hi_lo ioread64_hi_lo#define ioread64be_lo_hi ioread64be_lo_hi#define ioread64be_hi_lo ioread64be_hi_lo -extern u64 ioread64_lo_hi (void __iomem *addr); -extern u64 ioread64_hi_lo (void __iomem *addr); -extern u64 ioread64be_lo_hi (void __iomem *addr); -extern u64 ioread64be_hi_lo (void __iomem *addr); +extern u64 ioread64_lo_hi (const void __iomem *addr); +extern u64 ioread64_hi_lo (const void __iomem *addr); +extern u64 ioread64be_lo_hi (const void __iomem *addr); +extern u64 ioread64be_hi_lo (const void __iomem *addr);#endif extern void iowrite8 (u8 ,void __iomem *);
@@ -79,9 +79,9 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr);* memory across multiple ports, use "memcpy_toio()" * and friends. */ -extern void ioread8_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread16_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread32_rep (void __iomem *port,void *buf,unsigned long count); +extern void ioread8_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread16_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread32_rep (const void __iomem *port,void *buf,unsigned long count);extern void iowrite8_rep (void __iomem *port,const void *buf,unsigned long count);extern void iowrite16_rep (void __iomem *port,const void *buf,unsigned long count);
include/linux/io-64-nonatomic-hi-lo.h +2 -2
@@ -57,7 +57,7 @@ static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_hi_lo#define ioread64_hi_lo ioread64_hi_lo -static inline u64 ioread64_hi_lo (void __iomem *addr) +static inline u64 ioread64_hi_lo (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_hi_lo(u64 val, void __iomem *addr)#ifndef ioread64be_hi_lo#define ioread64be_hi_lo ioread64be_hi_lo -static inline u64 ioread64be_hi_lo (void __iomem *addr) +static inline u64 ioread64be_hi_lo (const void __iomem *addr) {u32 low, high;
include/linux/io-64-nonatomic-lo-hi.h +2 -2
@@ -57,7 +57,7 @@ static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_lo_hi#define ioread64_lo_hi ioread64_lo_hi -static inline u64 ioread64_lo_hi (void __iomem *addr) +static inline u64 ioread64_lo_hi (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_lo_hi(u64 val, void __iomem *addr)#ifndef ioread64be_lo_hi#define ioread64be_lo_hi ioread64be_lo_hi -static inline u64 ioread64be_lo_hi (void __iomem *addr) +static inline u64 ioread64be_lo_hi (const void __iomem *addr) {u32 low, high;
lib/iomap.c +15 -15
@@ -70,27 +70,27 @@ static void bad_io_access(unsigned long port, const char *access)#define mmio_read64be (addr) swab64(readq(addr))#endif -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) { IO_COND(addr, return inb(port), return readb(addr));return 0xff ; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) { IO_COND(addr, return inw(port), return readw(addr));return 0xffff ; } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) { IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr));return 0xffff ; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) { IO_COND(addr, return inl(port), return readl(addr));return 0xffffffff ; } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) { IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr));return 0xffffffff ;
@@ -142,26 +142,26 @@ static u64 pio_read64be_hi_lo(unsigned long port)return lo | (hi <<32 ); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64be_lo_hi(port), return mmio_read64be(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64be_hi_lo(port), return mmio_read64be(addr));
@@ -275,7 +275,7 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* order" (we also don't have IO barriers). */ #ifndef mmio_insb -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -283,7 +283,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) dst++; } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -291,7 +291,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) dst++; } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -325,15 +325,15 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) }#endif -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insb (port,dst,count),mmio_insb (addr, dst, count)); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insw (port,dst,count),mmio_insw (addr, dst, count)); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insl (port,dst,count),mmio_insl (addr, dst, count)); }
Signature · 1 line
2.17.1
PATCH RESEND v2 1/9 iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe 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.
---
Changes since v1:
1. Constify also ioreadX_rep() and mmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add Geert's review.
4. Add Arnd's review.
--- arch/alpha/include/asm/core_apecs.h | 6 +-- arch/alpha/include/asm/core_cia.h | 6 +-- arch/alpha/include/asm/core_lca.h | 6 +-- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +-- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++--- arch/alpha/include/asm/io_trivial.h | 16 +++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +-- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++--- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++++++-------------- arch/powerpc/kernel/iomap.c | 28 +++++------ arch/sh/kernel/iomap.c | 22 ++++---- include/asm-generic/iomap.h | 28 +++++------ include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 +++++------ 20 files changed, 136 insertions(+), 136 deletions(-)
arch/alpha/include/asm/core_apecs.h +3 -3
@@ -384,7 +384,7 @@ struct el_apecs_procdata } \ }while (0 ) -__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <APECS_DENSE_MEM )
arch/alpha/include/asm/core_cia.h +3 -3
@@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {#define vuip volatile unsigned int __force *#define vulp volatile unsigned long __force * -__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <CIA_DENSE_MEM )
arch/alpha/include/asm/core_lca.h +3 -3
@@ -230,7 +230,7 @@ union el_lca { }while (0 ) -__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <LCA_DENSE_MEM )
arch/alpha/include/asm/core_marvel.h +2 -2
@@ -332,10 +332,10 @@ struct io7 {#define vucp volatile unsigned char __force *#define vusp volatile unsigned short __force * -extern unsigned int marvel_ioread8 (void __iomem *); +extern unsigned int marvel_ioread8 (const void __iomem *);extern void marvel_iowrite8 (u8 b,void __iomem *); -__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) +__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr) {return __kernel_ldwu (*(vusp )addr); }
arch/alpha/include/asm/core_mcpcia.h +3 -3
@@ -267,7 +267,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)return (addr &0x80000000UL ) ==0 ; } -__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -291,7 +291,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x00 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -315,7 +315,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x08 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr;
arch/alpha/include/asm/core_t2.h +1 -1
@@ -572,7 +572,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)it doesn't make sense to merge the pio and mmio routines. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ return t2_read##OS(xaddr); \
arch/alpha/include/asm/io.h +6 -6
@@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ alpha_mv.mv_##NAME(b, addr); \ } -REMAP1(unsigned int, ioread8, /**/) -REMAP1(unsigned int, ioread16, /**/) -REMAP1(unsigned int, ioread32, /**/) +REMAP1(unsigned int, ioread8, const) +REMAP1(unsigned int, ioread16, const) +REMAP1(unsigned int, ioread32, const) REMAP1(u8, readb, const volatile) REMAP1(u16, readw, const volatile) REMAP1(u32, readl, const volatile)
@@ -308,14 +308,14 @@ static inline int __is_mmio(const volatile void __iomem *addr)*/ #if IO_CONCAT (__IO_PREFIX,trivial_io_bw) -extern inline unsigned int ioread8 (void __iomem *addr) +extern inline unsigned int ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -extern inline unsigned int ioread16 (void __iomem *addr) +extern inline unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();
@@ -356,7 +356,7 @@ extern inline void outw(u16 b, unsigned long port)#endif #if IO_CONCAT (__IO_PREFIX,trivial_io_lq) -extern inline unsigned int ioread32 (void __iomem *addr) +extern inline unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
arch/alpha/include/asm/io_trivial.h +8 -8
@@ -7,15 +7,15 @@#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread8 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread8 )(const void __iomem *a) { -return __kernel_ldbu (*(volatile u8 __force *)a); +return __kernel_ldbu (*(const volatile u8 __force *)a); } __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread16 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread16 )(const void __iomem *a) { -return __kernel_ldwu (*(volatile u16 __force *)a); +return __kernel_ldwu (*(const volatile u16 __force *)a); }__EXTERN_INLINE void
@@ -33,9 +33,9 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread32 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread32 )(const void __iomem *a) { -return *(volatile u32 __force *)a; +return *(const volatile u32 __force *)a; }__EXTERN_INLINE void
@@ -73,14 +73,14 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) __EXTERN_INLINE u8IO_CONCAT (__IO_PREFIX ,readb )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread8)(addr); } __EXTERN_INLINE u16IO_CONCAT (__IO_PREFIX ,readw )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread16)(addr); }
arch/alpha/include/asm/jensen.h +1 -1
@@ -305,7 +305,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)that it doesn't make sense to merge them. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr) \ { \ if (jensen_is_mmio(xaddr)) \ return jensen_read##OS(xaddr - 0x100000000ul); \
arch/alpha/include/asm/machvec.h +3 -3
@@ -46,9 +46,9 @@ struct alpha_machine_vectorvoid (*mv_pci_tbi)(struct pci_controller *hose,dma_addr_t start,dma_addr_t end); -unsigned int (*mv_ioread8)(void __iomem *); -unsigned int (*mv_ioread16)(void __iomem *); -unsigned int (*mv_ioread32)(void __iomem *); +unsigned int (*mv_ioread8)(const void __iomem *); +unsigned int (*mv_ioread16)(const void __iomem *); +unsigned int (*mv_ioread32)(const void __iomem *);void (*mv_iowrite8)(u8 ,void __iomem *);void (*mv_iowrite16)(u16 ,void __iomem *);
arch/alpha/kernel/core_marvel.c +1 -1
@@ -807,7 +807,7 @@ void __iomem *marvel_ioportmap (unsigned long addr) }unsigned int -marvel_ioread8 (void __iomem *xaddr) +marvel_ioread8 (const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (__marvel_is_port_kbd (addr))
arch/alpha/kernel/io.c +6 -6
@@ -14,21 +14,21 @@"generic", which bumps through the machine vector. */ unsigned int -ioread8 (void __iomem *addr) +ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(writeq);/* * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ -void ioread8_rep (void __iomem *port,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *port,void *dst,unsigned long count) {while ((unsigned long )dst &0x3 ) {if (!count)
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(insb);* the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -void ioread16_rep (void __iomem *port,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {if (!count)
@@ -294,7 +294,7 @@ EXPORT_SYMBOL(insw);* but the interfaces seems to be slow: just using the inlined version * of the inl() breaks things. */ -void ioread32_rep (void __iomem *port,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {while (count--) {
arch/parisc/include/asm/io.h +2 -2
@@ -303,8 +303,8 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);#define ioread64be ioread64be#define iowrite64 iowrite64#define iowrite64be iowrite64be -extern u64 ioread64 (void __iomem *addr); -extern u64 ioread64be (void __iomem *addr); +extern u64 ioread64 (const void __iomem *addr); +extern u64 ioread64be (const void __iomem *addr);extern void iowrite64 (u64 val,void __iomem *addr);extern void iowrite64be (u64 val,void __iomem *addr);
arch/parisc/lib/iomap.c +36 -36
220 lines not on this page · raw message
arch/powerpc/kernel/iomap.c +14 -14
@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }
@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }
@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
arch/sh/kernel/iomap.c +11 -11
@@ -8,31 +8,31 @@#include <linux/module.h> #include <linux/io.h> -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); }EXPORT_SYMBOL (ioread8); -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); }EXPORT_SYMBOL (ioread16); -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return be16_to_cpu (__raw_readw (addr)); }EXPORT_SYMBOL (ioread16be); -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); }EXPORT_SYMBOL (ioread32); -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return be32_to_cpu (__raw_readl (addr)); }
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iowrite32be);* convert to CPU byte order. We write in "IO byte * order" (we also don't have IO barriers). */ -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -83,7 +83,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -92,7 +92,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -125,19 +125,19 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) } } -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insb (addr, dst, count); }EXPORT_SYMBOL (ioread8_rep); -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insw (addr, dst, count); }EXPORT_SYMBOL (ioread16_rep); -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insl (addr, dst, count); }
include/asm-generic/iomap.h +14 -14
@@ -26,14 +26,14 @@* in the low address range. Architectures for which this is not * true can't use this generic implementation. */ -extern unsigned int ioread8 (void __iomem *); -extern unsigned int ioread16 (void __iomem *); -extern unsigned int ioread16be (void __iomem *); -extern unsigned int ioread32 (void __iomem *); -extern unsigned int ioread32be (void __iomem *); +extern unsigned int ioread8 (const void __iomem *); +extern unsigned int ioread16 (const void __iomem *); +extern unsigned int ioread16be (const void __iomem *); +extern unsigned int ioread32 (const void __iomem *); +extern unsigned int ioread32be (const void __iomem *);#ifdef CONFIG_64BIT -extern u64 ioread64 (void __iomem *); -extern u64 ioread64be (void __iomem *); +extern u64 ioread64 (const void __iomem *); +extern u64 ioread64be (const void __iomem *);#endif #ifdef readq
@@ -41,10 +41,10 @@ extern u64 ioread64be(void __iomem *);#define ioread64_hi_lo ioread64_hi_lo#define ioread64be_lo_hi ioread64be_lo_hi#define ioread64be_hi_lo ioread64be_hi_lo -extern u64 ioread64_lo_hi (void __iomem *addr); -extern u64 ioread64_hi_lo (void __iomem *addr); -extern u64 ioread64be_lo_hi (void __iomem *addr); -extern u64 ioread64be_hi_lo (void __iomem *addr); +extern u64 ioread64_lo_hi (const void __iomem *addr); +extern u64 ioread64_hi_lo (const void __iomem *addr); +extern u64 ioread64be_lo_hi (const void __iomem *addr); +extern u64 ioread64be_hi_lo (const void __iomem *addr);#endif extern void iowrite8 (u8 ,void __iomem *);
@@ -79,9 +79,9 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr);* memory across multiple ports, use "memcpy_toio()" * and friends. */ -extern void ioread8_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread16_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread32_rep (void __iomem *port,void *buf,unsigned long count); +extern void ioread8_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread16_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread32_rep (const void __iomem *port,void *buf,unsigned long count);extern void iowrite8_rep (void __iomem *port,const void *buf,unsigned long count);extern void iowrite16_rep (void __iomem *port,const void *buf,unsigned long count);
include/linux/io-64-nonatomic-hi-lo.h +2 -2
@@ -57,7 +57,7 @@ static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_hi_lo#define ioread64_hi_lo ioread64_hi_lo -static inline u64 ioread64_hi_lo (void __iomem *addr) +static inline u64 ioread64_hi_lo (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_hi_lo(u64 val, void __iomem *addr)#ifndef ioread64be_hi_lo#define ioread64be_hi_lo ioread64be_hi_lo -static inline u64 ioread64be_hi_lo (void __iomem *addr) +static inline u64 ioread64be_hi_lo (const void __iomem *addr) {u32 low, high;
include/linux/io-64-nonatomic-lo-hi.h +2 -2
@@ -57,7 +57,7 @@ static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_lo_hi#define ioread64_lo_hi ioread64_lo_hi -static inline u64 ioread64_lo_hi (void __iomem *addr) +static inline u64 ioread64_lo_hi (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_lo_hi(u64 val, void __iomem *addr)#ifndef ioread64be_lo_hi#define ioread64be_lo_hi ioread64be_lo_hi -static inline u64 ioread64be_lo_hi (void __iomem *addr) +static inline u64 ioread64be_lo_hi (const void __iomem *addr) {u32 low, high;
lib/iomap.c +15 -15
@@ -70,27 +70,27 @@ static void bad_io_access(unsigned long port, const char *access)#define mmio_read64be (addr) swab64(readq(addr))#endif -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) { IO_COND(addr, return inb(port), return readb(addr));return 0xff ; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) { IO_COND(addr, return inw(port), return readw(addr));return 0xffff ; } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) { IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr));return 0xffff ; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) { IO_COND(addr, return inl(port), return readl(addr));return 0xffffffff ; } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) { IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr));return 0xffffffff ;
@@ -142,26 +142,26 @@ static u64 pio_read64be_hi_lo(unsigned long port)return lo | (hi <<32 ); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64be_lo_hi(port), return mmio_read64be(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64be_hi_lo(port), return mmio_read64be(addr));
@@ -275,7 +275,7 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* order" (we also don't have IO barriers). */ #ifndef mmio_insb -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -283,7 +283,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) dst++; } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -291,7 +291,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) dst++; } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -325,15 +325,15 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) }#endif -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insb (port,dst,count),mmio_insb (addr, dst, count)); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insw (port,dst,count),mmio_insw (addr, dst, count)); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insl (port,dst,count),mmio_insl (addr, dst, count)); }
Signature · 1 line
2.17.1
PATCH RESEND v2 1/9 iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe 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.
---
Changes since v1:
1. Constify also ioreadX_rep() and mmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add Geert's review.
4. Add Arnd's review.
--- arch/alpha/include/asm/core_apecs.h | 6 +-- arch/alpha/include/asm/core_cia.h | 6 +-- arch/alpha/include/asm/core_lca.h | 6 +-- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +-- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++--- arch/alpha/include/asm/io_trivial.h | 16 +++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +-- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++--- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++++++-------------- arch/powerpc/kernel/iomap.c | 28 +++++------ arch/sh/kernel/iomap.c | 22 ++++---- include/asm-generic/iomap.h | 28 +++++------ include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 +++++------ 20 files changed, 136 insertions(+), 136 deletions(-)
arch/alpha/include/asm/core_apecs.h +3 -3
@@ -384,7 +384,7 @@ struct el_apecs_procdata } \ }while (0 ) -__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <APECS_DENSE_MEM )
arch/alpha/include/asm/core_cia.h +3 -3
@@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {#define vuip volatile unsigned int __force *#define vulp volatile unsigned long __force * -__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <CIA_DENSE_MEM )
arch/alpha/include/asm/core_lca.h +3 -3
@@ -230,7 +230,7 @@ union el_lca { }while (0 ) -__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <LCA_DENSE_MEM )
arch/alpha/include/asm/core_marvel.h +2 -2
@@ -332,10 +332,10 @@ struct io7 {#define vucp volatile unsigned char __force *#define vusp volatile unsigned short __force * -extern unsigned int marvel_ioread8 (void __iomem *); +extern unsigned int marvel_ioread8 (const void __iomem *);extern void marvel_iowrite8 (u8 b,void __iomem *); -__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) +__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr) {return __kernel_ldwu (*(vusp )addr); }
arch/alpha/include/asm/core_mcpcia.h +3 -3
@@ -267,7 +267,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)return (addr &0x80000000UL ) ==0 ; } -__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -291,7 +291,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x00 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -315,7 +315,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x08 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr;
arch/alpha/include/asm/core_t2.h +1 -1
@@ -572,7 +572,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)it doesn't make sense to merge the pio and mmio routines. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ return t2_read##OS(xaddr); \
arch/alpha/include/asm/io.h +6 -6
@@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ alpha_mv.mv_##NAME(b, addr); \ } -REMAP1(unsigned int, ioread8, /**/) -REMAP1(unsigned int, ioread16, /**/) -REMAP1(unsigned int, ioread32, /**/) +REMAP1(unsigned int, ioread8, const) +REMAP1(unsigned int, ioread16, const) +REMAP1(unsigned int, ioread32, const) REMAP1(u8, readb, const volatile) REMAP1(u16, readw, const volatile) REMAP1(u32, readl, const volatile)
@@ -308,14 +308,14 @@ static inline int __is_mmio(const volatile void __iomem *addr)*/ #if IO_CONCAT (__IO_PREFIX,trivial_io_bw) -extern inline unsigned int ioread8 (void __iomem *addr) +extern inline unsigned int ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -extern inline unsigned int ioread16 (void __iomem *addr) +extern inline unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();
@@ -356,7 +356,7 @@ extern inline void outw(u16 b, unsigned long port)#endif #if IO_CONCAT (__IO_PREFIX,trivial_io_lq) -extern inline unsigned int ioread32 (void __iomem *addr) +extern inline unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
arch/alpha/include/asm/io_trivial.h +8 -8
@@ -7,15 +7,15 @@#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread8 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread8 )(const void __iomem *a) { -return __kernel_ldbu (*(volatile u8 __force *)a); +return __kernel_ldbu (*(const volatile u8 __force *)a); } __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread16 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread16 )(const void __iomem *a) { -return __kernel_ldwu (*(volatile u16 __force *)a); +return __kernel_ldwu (*(const volatile u16 __force *)a); }__EXTERN_INLINE void
@@ -33,9 +33,9 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread32 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread32 )(const void __iomem *a) { -return *(volatile u32 __force *)a; +return *(const volatile u32 __force *)a; }__EXTERN_INLINE void
@@ -73,14 +73,14 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) __EXTERN_INLINE u8IO_CONCAT (__IO_PREFIX ,readb )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread8)(addr); } __EXTERN_INLINE u16IO_CONCAT (__IO_PREFIX ,readw )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread16)(addr); }
arch/alpha/include/asm/jensen.h +1 -1
@@ -305,7 +305,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)that it doesn't make sense to merge them. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr) \ { \ if (jensen_is_mmio(xaddr)) \ return jensen_read##OS(xaddr - 0x100000000ul); \
arch/alpha/include/asm/machvec.h +3 -3
@@ -46,9 +46,9 @@ struct alpha_machine_vectorvoid (*mv_pci_tbi)(struct pci_controller *hose,dma_addr_t start,dma_addr_t end); -unsigned int (*mv_ioread8)(void __iomem *); -unsigned int (*mv_ioread16)(void __iomem *); -unsigned int (*mv_ioread32)(void __iomem *); +unsigned int (*mv_ioread8)(const void __iomem *); +unsigned int (*mv_ioread16)(const void __iomem *); +unsigned int (*mv_ioread32)(const void __iomem *);void (*mv_iowrite8)(u8 ,void __iomem *);void (*mv_iowrite16)(u16 ,void __iomem *);
arch/alpha/kernel/core_marvel.c +1 -1
@@ -807,7 +807,7 @@ void __iomem *marvel_ioportmap (unsigned long addr) }unsigned int -marvel_ioread8 (void __iomem *xaddr) +marvel_ioread8 (const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (__marvel_is_port_kbd (addr))
arch/alpha/kernel/io.c +6 -6
@@ -14,21 +14,21 @@"generic", which bumps through the machine vector. */ unsigned int -ioread8 (void __iomem *addr) +ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(writeq);/* * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ -void ioread8_rep (void __iomem *port,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *port,void *dst,unsigned long count) {while ((unsigned long )dst &0x3 ) {if (!count)
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(insb);* the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -void ioread16_rep (void __iomem *port,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {if (!count)
@@ -294,7 +294,7 @@ EXPORT_SYMBOL(insw);* but the interfaces seems to be slow: just using the inlined version * of the inl() breaks things. */ -void ioread32_rep (void __iomem *port,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {while (count--) {
arch/parisc/include/asm/io.h +2 -2
@@ -303,8 +303,8 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);#define ioread64be ioread64be#define iowrite64 iowrite64#define iowrite64be iowrite64be -extern u64 ioread64 (void __iomem *addr); -extern u64 ioread64be (void __iomem *addr); +extern u64 ioread64 (const void __iomem *addr); +extern u64 ioread64be (const void __iomem *addr);extern void iowrite64 (u64 val,void __iomem *addr);extern void iowrite64be (u64 val,void __iomem *addr);
arch/parisc/lib/iomap.c +36 -36
220 lines not on this page · raw message
arch/powerpc/kernel/iomap.c +14 -14
@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }
@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }
@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
arch/sh/kernel/iomap.c +11 -11
@@ -8,31 +8,31 @@#include <linux/module.h> #include <linux/io.h> -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); }EXPORT_SYMBOL (ioread8); -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); }EXPORT_SYMBOL (ioread16); -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return be16_to_cpu (__raw_readw (addr)); }EXPORT_SYMBOL (ioread16be); -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); }EXPORT_SYMBOL (ioread32); -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return be32_to_cpu (__raw_readl (addr)); }
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iowrite32be);* convert to CPU byte order. We write in "IO byte * order" (we also don't have IO barriers). */ -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -83,7 +83,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -92,7 +92,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -125,19 +125,19 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) } } -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insb (addr, dst, count); }EXPORT_SYMBOL (ioread8_rep); -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insw (addr, dst, count); }EXPORT_SYMBOL (ioread16_rep); -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insl (addr, dst, count); }
include/asm-generic/iomap.h +14 -14
@@ -26,14 +26,14 @@* in the low address range. Architectures for which this is not * true can't use this generic implementation. */ -extern unsigned int ioread8 (void __iomem *); -extern unsigned int ioread16 (void __iomem *); -extern unsigned int ioread16be (void __iomem *); -extern unsigned int ioread32 (void __iomem *); -extern unsigned int ioread32be (void __iomem *); +extern unsigned int ioread8 (const void __iomem *); +extern unsigned int ioread16 (const void __iomem *); +extern unsigned int ioread16be (const void __iomem *); +extern unsigned int ioread32 (const void __iomem *); +extern unsigned int ioread32be (const void __iomem *);#ifdef CONFIG_64BIT -extern u64 ioread64 (void __iomem *); -extern u64 ioread64be (void __iomem *); +extern u64 ioread64 (const void __iomem *); +extern u64 ioread64be (const void __iomem *);#endif #ifdef readq
@@ -41,10 +41,10 @@ extern u64 ioread64be(void __iomem *);#define ioread64_hi_lo ioread64_hi_lo#define ioread64be_lo_hi ioread64be_lo_hi#define ioread64be_hi_lo ioread64be_hi_lo -extern u64 ioread64_lo_hi (void __iomem *addr); -extern u64 ioread64_hi_lo (void __iomem *addr); -extern u64 ioread64be_lo_hi (void __iomem *addr); -extern u64 ioread64be_hi_lo (void __iomem *addr); +extern u64 ioread64_lo_hi (const void __iomem *addr); +extern u64 ioread64_hi_lo (const void __iomem *addr); +extern u64 ioread64be_lo_hi (const void __iomem *addr); +extern u64 ioread64be_hi_lo (const void __iomem *addr);#endif extern void iowrite8 (u8 ,void __iomem *);
@@ -79,9 +79,9 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr);* memory across multiple ports, use "memcpy_toio()" * and friends. */ -extern void ioread8_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread16_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread32_rep (void __iomem *port,void *buf,unsigned long count); +extern void ioread8_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread16_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread32_rep (const void __iomem *port,void *buf,unsigned long count);extern void iowrite8_rep (void __iomem *port,const void *buf,unsigned long count);extern void iowrite16_rep (void __iomem *port,const void *buf,unsigned long count);
include/linux/io-64-nonatomic-hi-lo.h +2 -2
@@ -57,7 +57,7 @@ static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_hi_lo#define ioread64_hi_lo ioread64_hi_lo -static inline u64 ioread64_hi_lo (void __iomem *addr) +static inline u64 ioread64_hi_lo (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_hi_lo(u64 val, void __iomem *addr)#ifndef ioread64be_hi_lo#define ioread64be_hi_lo ioread64be_hi_lo -static inline u64 ioread64be_hi_lo (void __iomem *addr) +static inline u64 ioread64be_hi_lo (const void __iomem *addr) {u32 low, high;
include/linux/io-64-nonatomic-lo-hi.h +2 -2
@@ -57,7 +57,7 @@ static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_lo_hi#define ioread64_lo_hi ioread64_lo_hi -static inline u64 ioread64_lo_hi (void __iomem *addr) +static inline u64 ioread64_lo_hi (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_lo_hi(u64 val, void __iomem *addr)#ifndef ioread64be_lo_hi#define ioread64be_lo_hi ioread64be_lo_hi -static inline u64 ioread64be_lo_hi (void __iomem *addr) +static inline u64 ioread64be_lo_hi (const void __iomem *addr) {u32 low, high;
lib/iomap.c +15 -15
@@ -70,27 +70,27 @@ static void bad_io_access(unsigned long port, const char *access)#define mmio_read64be (addr) swab64(readq(addr))#endif -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) { IO_COND(addr, return inb(port), return readb(addr));return 0xff ; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) { IO_COND(addr, return inw(port), return readw(addr));return 0xffff ; } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) { IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr));return 0xffff ; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) { IO_COND(addr, return inl(port), return readl(addr));return 0xffffffff ; } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) { IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr));return 0xffffffff ;
@@ -142,26 +142,26 @@ static u64 pio_read64be_hi_lo(unsigned long port)return lo | (hi <<32 ); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64be_lo_hi(port), return mmio_read64be(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64be_hi_lo(port), return mmio_read64be(addr));
@@ -275,7 +275,7 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* order" (we also don't have IO barriers). */ #ifndef mmio_insb -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -283,7 +283,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) dst++; } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -291,7 +291,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) dst++; } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -325,15 +325,15 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) }#endif -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insb (port,dst,count),mmio_insb (addr, dst, count)); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insw (port,dst,count),mmio_insw (addr, dst, count)); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insl (port,dst,count),mmio_insl (addr, dst, count)); }
Signature · 1 line
2.17.1
PATCH RESEND v2 2/9 rtl818x: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Kalle's ack. Fix subject prefix.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +3 -3
@@ -150,17 +150,17 @@ void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);void rtl8180_set_anaparam (struct rtl8180_priv *priv,u32 anaparam);void rtl8180_set_anaparam2 (struct rtl8180_priv *priv,u32 anaparam2); -static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,u8 __iomem *addr) +static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,__le16 __iomem *addr) +static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,__le32 __iomem *addr) +static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 2/9 rtl818x: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Kalle's ack. Fix subject prefix.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +3 -3
@@ -150,17 +150,17 @@ void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);void rtl8180_set_anaparam (struct rtl8180_priv *priv,u32 anaparam);void rtl8180_set_anaparam2 (struct rtl8180_priv *priv,u32 anaparam2); -static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,u8 __iomem *addr) +static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,__le16 __iomem *addr) +static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,__le32 __iomem *addr) +static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 2/9 rtl818x: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Kalle's ack. Fix subject prefix.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +3 -3
@@ -150,17 +150,17 @@ void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);void rtl8180_set_anaparam (struct rtl8180_priv *priv,u32 anaparam);void rtl8180_set_anaparam2 (struct rtl8180_priv *priv,u32 anaparam2); -static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,u8 __iomem *addr) +static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,__le16 __iomem *addr) +static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,__le32 __iomem *addr) +static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 2/9 rtl818x: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Kalle's ack. Fix subject prefix.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +3 -3
@@ -150,17 +150,17 @@ void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);void rtl8180_set_anaparam (struct rtl8180_priv *priv,u32 anaparam);void rtl8180_set_anaparam2 (struct rtl8180_priv *priv,u32 anaparam2); -static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,u8 __iomem *addr) +static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,__le16 __iomem *addr) +static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,__le32 __iomem *addr) +static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 3/9 ntb: intel: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Dave's ack.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/ntb/hw/intel/ntb_hw_gen3.h | 2 +- drivers/ntb/hw/intel/ntb_hw_intel.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +1 -1
@@ -1202,7 +1202,7 @@ int intel_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, int sidx, ndev->peer_reg->spad); } -static u64 xeon_db_ioread (void __iomem *mmio) +static u64 xeon_db_ioread (const void __iomem *mmio) {return (u64 )ioread16 (mmio); }
drivers/ntb/hw/intel/ntb_hw_gen3.h +1 -1
@@ -91,7 +91,7 @@#define GEN3_DB_TOTAL_SHIFT 33#define GEN3_SPAD_COUNT 16 -static inline u64 gen3_db_ioread (void __iomem *mmio) +static inline u64 gen3_db_ioread (const void __iomem *mmio) {return ioread64 (mmio); }
drivers/ntb/hw/intel/ntb_hw_intel.h +1 -1
@@ -102,7 +102,7 @@ struct intel_ntb_dev;struct intel_ntb_reg {int (*poll_link)(struct intel_ntb_dev *ndev);int (*link_is_up)(struct intel_ntb_dev *ndev); -u64 (*db_ioread)(void __iomem *mmio); +u64 (*db_ioread)(const void __iomem *mmio);void (*db_iowrite)(u64 db_bits,void __iomem *mmio);unsigned long ntb_ctl;resource_size_t db_size;
Signature · 1 line
2.17.1
PATCH RESEND v2 3/9 ntb: intel: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Dave's ack.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/ntb/hw/intel/ntb_hw_gen3.h | 2 +- drivers/ntb/hw/intel/ntb_hw_intel.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +1 -1
@@ -1202,7 +1202,7 @@ int intel_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, int sidx, ndev->peer_reg->spad); } -static u64 xeon_db_ioread (void __iomem *mmio) +static u64 xeon_db_ioread (const void __iomem *mmio) {return (u64 )ioread16 (mmio); }
drivers/ntb/hw/intel/ntb_hw_gen3.h +1 -1
@@ -91,7 +91,7 @@#define GEN3_DB_TOTAL_SHIFT 33#define GEN3_SPAD_COUNT 16 -static inline u64 gen3_db_ioread (void __iomem *mmio) +static inline u64 gen3_db_ioread (const void __iomem *mmio) {return ioread64 (mmio); }
drivers/ntb/hw/intel/ntb_hw_intel.h +1 -1
@@ -102,7 +102,7 @@ struct intel_ntb_dev;struct intel_ntb_reg {int (*poll_link)(struct intel_ntb_dev *ndev);int (*link_is_up)(struct intel_ntb_dev *ndev); -u64 (*db_ioread)(void __iomem *mmio); +u64 (*db_ioread)(const void __iomem *mmio);void (*db_iowrite)(u64 db_bits,void __iomem *mmio);unsigned long ntb_ctl;resource_size_t db_size;
Signature · 1 line
2.17.1
PATCH RESEND v2 3/9 ntb: intel: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Dave's ack.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/ntb/hw/intel/ntb_hw_gen3.h | 2 +- drivers/ntb/hw/intel/ntb_hw_intel.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +1 -1
@@ -1202,7 +1202,7 @@ int intel_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, int sidx, ndev->peer_reg->spad); } -static u64 xeon_db_ioread (void __iomem *mmio) +static u64 xeon_db_ioread (const void __iomem *mmio) {return (u64 )ioread16 (mmio); }
drivers/ntb/hw/intel/ntb_hw_gen3.h +1 -1
@@ -91,7 +91,7 @@#define GEN3_DB_TOTAL_SHIFT 33#define GEN3_SPAD_COUNT 16 -static inline u64 gen3_db_ioread (void __iomem *mmio) +static inline u64 gen3_db_ioread (const void __iomem *mmio) {return ioread64 (mmio); }
drivers/ntb/hw/intel/ntb_hw_intel.h +1 -1
@@ -102,7 +102,7 @@ struct intel_ntb_dev;struct intel_ntb_reg {int (*poll_link)(struct intel_ntb_dev *ndev);int (*link_is_up)(struct intel_ntb_dev *ndev); -u64 (*db_ioread)(void __iomem *mmio); +u64 (*db_ioread)(const void __iomem *mmio);void (*db_iowrite)(u64 db_bits,void __iomem *mmio);unsigned long ntb_ctl;resource_size_t db_size;
Signature · 1 line
2.17.1
PATCH RESEND v2 4/9 virtio: pci: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
--- drivers/virtio/virtio_pci_modern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci_modern.c +3 -3
@@ -26,16 +26,16 @@* method, i.e. 32-bit accesses for 32-bit fields, 16-bit accesses * for 16-bit fields and 8-bit accesses for 8-bit fields. */ -static inline u8 vp_ioread8 (u8 __iomem *addr) +static inline u8 vp_ioread8 (const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 vp_ioread16 (__le16 __iomem *addr) +static inline u16 vp_ioread16 (const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 vp_ioread32 (__le32 __iomem *addr) +static inline u32 vp_ioread32 (const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 4/9 virtio: pci: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
--- drivers/virtio/virtio_pci_modern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci_modern.c +3 -3
@@ -26,16 +26,16 @@* method, i.e. 32-bit accesses for 32-bit fields, 16-bit accesses * for 16-bit fields and 8-bit accesses for 8-bit fields. */ -static inline u8 vp_ioread8 (u8 __iomem *addr) +static inline u8 vp_ioread8 (const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 vp_ioread16 (__le16 __iomem *addr) +static inline u16 vp_ioread16 (const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 vp_ioread32 (__le32 __iomem *addr) +static inline u32 vp_ioread32 (const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 4/9 virtio: pci: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
--- drivers/virtio/virtio_pci_modern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci_modern.c +3 -3
@@ -26,16 +26,16 @@* method, i.e. 32-bit accesses for 32-bit fields, 16-bit accesses * for 16-bit fields and 8-bit accesses for 8-bit fields. */ -static inline u8 vp_ioread8 (u8 __iomem *addr) +static inline u8 vp_ioread8 (const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 vp_ioread16 (__le16 __iomem *addr) +static inline u16 vp_ioread16 (const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 vp_ioread32 (__le32 __iomem *addr) +static inline u32 vp_ioread32 (const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 4/9 virtio: pci: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
--- drivers/virtio/virtio_pci_modern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci_modern.c +3 -3
@@ -26,16 +26,16 @@* method, i.e. 32-bit accesses for 32-bit fields, 16-bit accesses * for 16-bit fields and 8-bit accesses for 8-bit fields. */ -static inline u8 vp_ioread8 (u8 __iomem *addr) +static inline u8 vp_ioread8 (const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 vp_ioread16 (__le16 __iomem *addr) +static inline u16 vp_ioread16 (const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 vp_ioread32 (__le32 __iomem *addr) +static inline u32 vp_ioread32 (const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 5/9 arc: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
---
Changes since v1:
1. Add Alexey's ack.
--- arch/arc/plat-axs10x/axs10x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/plat-axs10x/axs10x.c +2 -2
@@ -84,7 +84,7 @@ static void __init axs10x_print_board_ver(unsigned int creg, const char *str)unsigned int val; } board; - board.val =ioread32 ((void __iomem *)creg); + board.val =ioread32 ((const void __iomem *)creg);pr_info ("AXS: %s FPGA Date: %u-%u-%u\n" , str, board.d, board.m, board.y); }
@@ -95,7 +95,7 @@ static void __init axs10x_early_init(void)char mb[32 ];/* Determine motherboard version */ -if (ioread32 ((void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) +if (ioread32 ((const void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) mb_rev =3 ;/* HT-3 (rev3.0) */ else mb_rev =2 ;/* HT-2 (rev2.0) */
Signature · 1 line
2.17.1
PATCH RESEND v2 5/9 arc: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Alexey's ack.
--- arch/arc/plat-axs10x/axs10x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/plat-axs10x/axs10x.c +2 -2
@@ -84,7 +84,7 @@ static void __init axs10x_print_board_ver(unsigned int creg, const char *str)unsigned int val; } board; - board.val =ioread32 ((void __iomem *)creg); + board.val =ioread32 ((const void __iomem *)creg);pr_info ("AXS: %s FPGA Date: %u-%u-%u\n" , str, board.d, board.m, board.y); }
@@ -95,7 +95,7 @@ static void __init axs10x_early_init(void)char mb[32 ];/* Determine motherboard version */ -if (ioread32 ((void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) +if (ioread32 ((const void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) mb_rev =3 ;/* HT-3 (rev3.0) */ else mb_rev =2 ;/* HT-2 (rev2.0) */
Signature · 1 line
2.17.1
PATCH RESEND v2 5/9 arc: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Alexey's ack.
--- arch/arc/plat-axs10x/axs10x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/plat-axs10x/axs10x.c +2 -2
@@ -84,7 +84,7 @@ static void __init axs10x_print_board_ver(unsigned int creg, const char *str)unsigned int val; } board; - board.val =ioread32 ((void __iomem *)creg); + board.val =ioread32 ((const void __iomem *)creg);pr_info ("AXS: %s FPGA Date: %u-%u-%u\n" , str, board.d, board.m, board.y); }
@@ -95,7 +95,7 @@ static void __init axs10x_early_init(void)char mb[32 ];/* Determine motherboard version */ -if (ioread32 ((void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) +if (ioread32 ((const void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) mb_rev =3 ;/* HT-3 (rev3.0) */ else mb_rev =2 ;/* HT-2 (rev2.0) */
Signature · 1 line
2.17.1
PATCH RESEND v2 5/9 arc: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Alexey's ack.
--- arch/arc/plat-axs10x/axs10x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/plat-axs10x/axs10x.c +2 -2
@@ -84,7 +84,7 @@ static void __init axs10x_print_board_ver(unsigned int creg, const char *str)unsigned int val; } board; - board.val =ioread32 ((void __iomem *)creg); + board.val =ioread32 ((const void __iomem *)creg);pr_info ("AXS: %s FPGA Date: %u-%u-%u\n" , str, board.d, board.m, board.y); }
@@ -95,7 +95,7 @@ static void __init axs10x_early_init(void)char mb[32 ];/* Determine motherboard version */ -if (ioread32 ((void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) +if (ioread32 ((const void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) mb_rev =3 ;/* HT-3 (rev3.0) */ else mb_rev =2 ;/* HT-2 (rev2.0) */
Signature · 1 line
2.17.1
PATCH RESEND v2 6/9 drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
---
Changes since v1:
1. Add Thomas' review.
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +2 -2
@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 1 line
2.17.1
PATCH RESEND v2 6/9 drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Thomas' review.
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +2 -2
@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 1 line
2.17.1
PATCH RESEND v2 6/9 drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Thomas' review.
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +2 -2
@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 1 line
2.17.1
PATCH RESEND v2 6/9 drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Thomas' review.
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +2 -2
@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 1 line
2.17.1
PATCH RESEND v2 7/9 drm/nouveau: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
@@ -613,7 +613,7 @@ nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index) mem += index;if (is_iomem) -return ioread32_native ((void __force __iomem *)mem); +return ioread32_native ((const void __force __iomem *)mem);else return *mem; }
Signature · 1 line
2.17.1
PATCH RESEND v2 7/9 drm/nouveau: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
@@ -613,7 +613,7 @@ nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index) mem += index;if (is_iomem) -return ioread32_native ((void __force __iomem *)mem); +return ioread32_native ((const void __force __iomem *)mem);else return *mem; }
Signature · 1 line
2.17.1
PATCH RESEND v2 7/9 drm/nouveau: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
@@ -613,7 +613,7 @@ nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index) mem += index;if (is_iomem) -return ioread32_native ((void __force __iomem *)mem); +return ioread32_native ((const void __force __iomem *)mem);else return *mem; }
Signature · 1 line
2.17.1
PATCH RESEND v2 8/9 media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/fsl-viu.c +1 -1
@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Signature · 1 line
2.17.1
PATCH RESEND v2 8/9 media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/fsl-viu.c +1 -1
@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Signature · 1 line
2.17.1
PATCH RESEND v2 8/9 media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/fsl-viu.c +1 -1
@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Signature · 1 line
2.17.1
PATCH RESEND v2 8/9 media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/fsl-viu.c +1 -1
@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Signature · 1 line
2.17.1
PATCH RESEND v2 9/9 ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveThe ioreadX() 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.
--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ahb.c +5 -5
@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg |=AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL );/* Enable global WMAC swapping */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_BYTESWAP ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_BYTESWAP ); reg |=AR5K_AR2315_BYTESWAP_WMAC ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_BYTESWAP ); }else {/* Enable WMAC DMA access (assuming 5312 or 231x*/ /* TODO: check other platforms */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg |=AR5K_AR5312_ENABLE_WLAN0 ;else
@@ -202,12 +202,12 @@ static int ath_ahb_remove(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Disable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); }else {/*Stop DMA access */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg &= ~AR5K_AR5312_ENABLE_WLAN0 ;else
Signature · 1 line
2.17.1
PATCH RESEND v2 9/9 ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ahb.c +5 -5
@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg |=AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL );/* Enable global WMAC swapping */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_BYTESWAP ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_BYTESWAP ); reg |=AR5K_AR2315_BYTESWAP_WMAC ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_BYTESWAP ); }else {/* Enable WMAC DMA access (assuming 5312 or 231x*/ /* TODO: check other platforms */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id =0 ) reg |=AR5K_AR5312_ENABLE_WLAN0 ;else
@@ -202,12 +202,12 @@ static int ath_ahb_remove(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Disable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); }else {/*Stop DMA access */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id =0 ) reg &= ~AR5K_AR5312_ENABLE_WLAN0 ;else
Signature · 1 line
2.17.1
PATCH RESEND v2 9/9 ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ahb.c +5 -5
@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg |=AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL );/* Enable global WMAC swapping */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_BYTESWAP ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_BYTESWAP ); reg |=AR5K_AR2315_BYTESWAP_WMAC ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_BYTESWAP ); }else {/* Enable WMAC DMA access (assuming 5312 or 231x*/ /* TODO: check other platforms */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg |=AR5K_AR5312_ENABLE_WLAN0 ;else
@@ -202,12 +202,12 @@ static int ath_ahb_remove(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Disable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); }else {/*Stop DMA access */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg &= ~AR5K_AR5312_ENABLE_WLAN0 ;else
Signature · 1 line
2.17.1
PATCH RESEND v2 9/9 ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ahb.c +5 -5
@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg |=AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL );/* Enable global WMAC swapping */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_BYTESWAP ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_BYTESWAP ); reg |=AR5K_AR2315_BYTESWAP_WMAC ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_BYTESWAP ); }else {/* Enable WMAC DMA access (assuming 5312 or 231x*/ /* TODO: check other platforms */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg |=AR5K_AR5312_ENABLE_WLAN0 ;else
@@ -202,12 +202,12 @@ static int ath_ahb_remove(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Disable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); }else {/*Stop DMA access */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg &= ~AR5K_AR5312_ENABLE_WLAN0 ;else
Signature · 1 line
2.17.1
PATCH RESEND v2 1/9 iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe 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.
---
Changes since v1:
1. Constify also ioreadX_rep() and mmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add Geert's review.
4. Add Arnd's review.
--- arch/alpha/include/asm/core_apecs.h | 6 +-- arch/alpha/include/asm/core_cia.h | 6 +-- arch/alpha/include/asm/core_lca.h | 6 +-- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +-- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++--- arch/alpha/include/asm/io_trivial.h | 16 +++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +-- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++--- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++++++-------------- arch/powerpc/kernel/iomap.c | 28 +++++------ arch/sh/kernel/iomap.c | 22 ++++---- include/asm-generic/iomap.h | 28 +++++------ include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 +++++------ 20 files changed, 136 insertions(+), 136 deletions(-)
arch/alpha/include/asm/core_apecs.h +3 -3
@@ -384,7 +384,7 @@ struct el_apecs_procdata } \ }while (0 ) -__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <APECS_DENSE_MEM )
arch/alpha/include/asm/core_cia.h +3 -3
@@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {#define vuip volatile unsigned int __force *#define vulp volatile unsigned long __force * -__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <CIA_DENSE_MEM )
arch/alpha/include/asm/core_lca.h +3 -3
@@ -230,7 +230,7 @@ union el_lca { }while (0 ) -__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;unsigned long result, base_and_type;
@@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + base_and_type) = w; } -__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (addr <LCA_DENSE_MEM )
arch/alpha/include/asm/core_marvel.h +2 -2
@@ -332,10 +332,10 @@ struct io7 {#define vucp volatile unsigned char __force *#define vusp volatile unsigned short __force * -extern unsigned int marvel_ioread8 (void __iomem *); +extern unsigned int marvel_ioread8 (const void __iomem *);extern void marvel_iowrite8 (u8 b,void __iomem *); -__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) +__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr) {return __kernel_ldwu (*(vusp )addr); }
arch/alpha/include/asm/core_mcpcia.h +3 -3
@@ -267,7 +267,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)return (addr &0x80000000UL ) ==0 ; } -__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -291,7 +291,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x00 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr &MCPCIA_MEM_MASK ;unsigned long hose = (unsigned long )xaddr & ~MCPCIA_MEM_MASK ;
@@ -315,7 +315,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr) *(vuip) ((addr <<5 ) + hose +0x08 ) = w; } -__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) +__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr) {unsigned long addr = (unsigned long )xaddr;
arch/alpha/include/asm/core_t2.h +1 -1
@@ -572,7 +572,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)it doesn't make sense to merge the pio and mmio routines. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr) \ { \ if (t2_is_mmio(xaddr)) \ return t2_read##OS(xaddr); \
arch/alpha/include/asm/io.h +6 -6
@@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ alpha_mv.mv_##NAME(b, addr); \ } -REMAP1(unsigned int, ioread8, /**/) -REMAP1(unsigned int, ioread16, /**/) -REMAP1(unsigned int, ioread32, /**/) +REMAP1(unsigned int, ioread8, const) +REMAP1(unsigned int, ioread16, const) +REMAP1(unsigned int, ioread32, const) REMAP1(u8, readb, const volatile) REMAP1(u16, readw, const volatile) REMAP1(u32, readl, const volatile)
@@ -308,14 +308,14 @@ static inline int __is_mmio(const volatile void __iomem *addr)*/ #if IO_CONCAT (__IO_PREFIX,trivial_io_bw) -extern inline unsigned int ioread8 (void __iomem *addr) +extern inline unsigned int ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -extern inline unsigned int ioread16 (void __iomem *addr) +extern inline unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();
@@ -356,7 +356,7 @@ extern inline void outw(u16 b, unsigned long port)#endif #if IO_CONCAT (__IO_PREFIX,trivial_io_lq) -extern inline unsigned int ioread32 (void __iomem *addr) +extern inline unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
arch/alpha/include/asm/io_trivial.h +8 -8
@@ -7,15 +7,15 @@#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread8 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread8 )(const void __iomem *a) { -return __kernel_ldbu (*(volatile u8 __force *)a); +return __kernel_ldbu (*(const volatile u8 __force *)a); } __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread16 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread16 )(const void __iomem *a) { -return __kernel_ldwu (*(volatile u16 __force *)a); +return __kernel_ldwu (*(const volatile u16 __force *)a); }__EXTERN_INLINE void
@@ -33,9 +33,9 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) __EXTERN_INLINE unsigned int -IO_CONCAT (__IO_PREFIX ,ioread32 )(void __iomem *a) +IO_CONCAT (__IO_PREFIX ,ioread32 )(const void __iomem *a) { -return *(volatile u32 __force *)a; +return *(const volatile u32 __force *)a; }__EXTERN_INLINE void
@@ -73,14 +73,14 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) __EXTERN_INLINE u8IO_CONCAT (__IO_PREFIX ,readb )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread8)(addr); } __EXTERN_INLINE u16IO_CONCAT (__IO_PREFIX ,readw )(const volatile void __iomem *a) { -void __iomem *addr = (void __iomem *)a; +const void __iomem *addr = (const void __iomem *)a;return IO_CONCAT (__IO_PREFIX,ioread16)(addr); }
arch/alpha/include/asm/jensen.h +1 -1
@@ -305,7 +305,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)that it doesn't make sense to merge them. */ #define IOPORT (OS ,NS ) \ -__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ +__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr) \ { \ if (jensen_is_mmio(xaddr)) \ return jensen_read##OS(xaddr - 0x100000000ul); \
arch/alpha/include/asm/machvec.h +3 -3
@@ -46,9 +46,9 @@ struct alpha_machine_vectorvoid (*mv_pci_tbi)(struct pci_controller *hose,dma_addr_t start,dma_addr_t end); -unsigned int (*mv_ioread8)(void __iomem *); -unsigned int (*mv_ioread16)(void __iomem *); -unsigned int (*mv_ioread32)(void __iomem *); +unsigned int (*mv_ioread8)(const void __iomem *); +unsigned int (*mv_ioread16)(const void __iomem *); +unsigned int (*mv_ioread32)(const void __iomem *);void (*mv_iowrite8)(u8 ,void __iomem *);void (*mv_iowrite16)(u16 ,void __iomem *);
arch/alpha/kernel/core_marvel.c +1 -1
@@ -807,7 +807,7 @@ void __iomem *marvel_ioportmap (unsigned long addr) }unsigned int -marvel_ioread8 (void __iomem *xaddr) +marvel_ioread8 (const void __iomem *xaddr) {unsigned long addr = (unsigned long ) xaddr;if (__marvel_is_port_kbd (addr))
arch/alpha/kernel/io.c +6 -6
@@ -14,21 +14,21 @@"generic", which bumps through the machine vector. */ unsigned int -ioread8 (void __iomem *addr) +ioread8 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(writeq);/* * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ -void ioread8_rep (void __iomem *port,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *port,void *dst,unsigned long count) {while ((unsigned long )dst &0x3 ) {if (!count)
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(insb);* the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -void ioread16_rep (void __iomem *port,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {if (!count)
@@ -294,7 +294,7 @@ EXPORT_SYMBOL(insw);* but the interfaces seems to be slow: just using the inlined version * of the inl() breaks things. */ -void ioread32_rep (void __iomem *port,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *port,void *dst,unsigned long count) {if (unlikely ((unsigned long )dst &0x3 )) {while (count--) {
arch/parisc/include/asm/io.h +2 -2
@@ -303,8 +303,8 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);#define ioread64be ioread64be#define iowrite64 iowrite64#define iowrite64be iowrite64be -extern u64 ioread64 (void __iomem *addr); -extern u64 ioread64be (void __iomem *addr); +extern u64 ioread64 (const void __iomem *addr); +extern u64 ioread64be (const void __iomem *addr);extern void iowrite64 (u64 val,void __iomem *addr);extern void iowrite64be (u64 val,void __iomem *addr);
arch/parisc/lib/iomap.c +36 -36
220 lines not on this page · raw message
arch/powerpc/kernel/iomap.c +14 -14
@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }
@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }
@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
arch/sh/kernel/iomap.c +11 -11
@@ -8,31 +8,31 @@#include <linux/module.h> #include <linux/io.h> -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); }EXPORT_SYMBOL (ioread8); -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); }EXPORT_SYMBOL (ioread16); -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return be16_to_cpu (__raw_readw (addr)); }EXPORT_SYMBOL (ioread16be); -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); }EXPORT_SYMBOL (ioread32); -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return be32_to_cpu (__raw_readl (addr)); }
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iowrite32be);* convert to CPU byte order. We write in "IO byte * order" (we also don't have IO barriers). */ -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -83,7 +83,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -92,7 +92,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -125,19 +125,19 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) } } -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insb (addr, dst, count); }EXPORT_SYMBOL (ioread8_rep); -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insw (addr, dst, count); }EXPORT_SYMBOL (ioread16_rep); -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {mmio_insl (addr, dst, count); }
include/asm-generic/iomap.h +14 -14
@@ -26,14 +26,14 @@* in the low address range. Architectures for which this is not * true can't use this generic implementation. */ -extern unsigned int ioread8 (void __iomem *); -extern unsigned int ioread16 (void __iomem *); -extern unsigned int ioread16be (void __iomem *); -extern unsigned int ioread32 (void __iomem *); -extern unsigned int ioread32be (void __iomem *); +extern unsigned int ioread8 (const void __iomem *); +extern unsigned int ioread16 (const void __iomem *); +extern unsigned int ioread16be (const void __iomem *); +extern unsigned int ioread32 (const void __iomem *); +extern unsigned int ioread32be (const void __iomem *);#ifdef CONFIG_64BIT -extern u64 ioread64 (void __iomem *); -extern u64 ioread64be (void __iomem *); +extern u64 ioread64 (const void __iomem *); +extern u64 ioread64be (const void __iomem *);#endif #ifdef readq
@@ -41,10 +41,10 @@ extern u64 ioread64be(void __iomem *);#define ioread64_hi_lo ioread64_hi_lo#define ioread64be_lo_hi ioread64be_lo_hi#define ioread64be_hi_lo ioread64be_hi_lo -extern u64 ioread64_lo_hi (void __iomem *addr); -extern u64 ioread64_hi_lo (void __iomem *addr); -extern u64 ioread64be_lo_hi (void __iomem *addr); -extern u64 ioread64be_hi_lo (void __iomem *addr); +extern u64 ioread64_lo_hi (const void __iomem *addr); +extern u64 ioread64_hi_lo (const void __iomem *addr); +extern u64 ioread64be_lo_hi (const void __iomem *addr); +extern u64 ioread64be_hi_lo (const void __iomem *addr);#endif extern void iowrite8 (u8 ,void __iomem *);
@@ -79,9 +79,9 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr);* memory across multiple ports, use "memcpy_toio()" * and friends. */ -extern void ioread8_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread16_rep (void __iomem *port,void *buf,unsigned long count); -extern void ioread32_rep (void __iomem *port,void *buf,unsigned long count); +extern void ioread8_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread16_rep (const void __iomem *port,void *buf,unsigned long count); +extern void ioread32_rep (const void __iomem *port,void *buf,unsigned long count);extern void iowrite8_rep (void __iomem *port,const void *buf,unsigned long count);extern void iowrite16_rep (void __iomem *port,const void *buf,unsigned long count);
include/linux/io-64-nonatomic-hi-lo.h +2 -2
@@ -57,7 +57,7 @@ static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_hi_lo#define ioread64_hi_lo ioread64_hi_lo -static inline u64 ioread64_hi_lo (void __iomem *addr) +static inline u64 ioread64_hi_lo (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_hi_lo(u64 val, void __iomem *addr)#ifndef ioread64be_hi_lo#define ioread64be_hi_lo ioread64be_hi_lo -static inline u64 ioread64be_hi_lo (void __iomem *addr) +static inline u64 ioread64be_hi_lo (const void __iomem *addr) {u32 low, high;
include/linux/io-64-nonatomic-lo-hi.h +2 -2
@@ -57,7 +57,7 @@ static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr)#ifndef ioread64_lo_hi#define ioread64_lo_hi ioread64_lo_hi -static inline u64 ioread64_lo_hi (void __iomem *addr) +static inline u64 ioread64_lo_hi (const void __iomem *addr) {u32 low, high;
@@ -79,7 +79,7 @@ static inline void iowrite64_lo_hi(u64 val, void __iomem *addr)#ifndef ioread64be_lo_hi#define ioread64be_lo_hi ioread64be_lo_hi -static inline u64 ioread64be_lo_hi (void __iomem *addr) +static inline u64 ioread64be_lo_hi (const void __iomem *addr) {u32 low, high;
lib/iomap.c +15 -15
@@ -70,27 +70,27 @@ static void bad_io_access(unsigned long port, const char *access)#define mmio_read64be (addr) swab64(readq(addr))#endif -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) { IO_COND(addr, return inb(port), return readb(addr));return 0xff ; } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) { IO_COND(addr, return inw(port), return readw(addr));return 0xffff ; } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) { IO_COND(addr, return pio_read16be(port), return mmio_read16be(addr));return 0xffff ; } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) { IO_COND(addr, return inl(port), return readl(addr));return 0xffffffff ; } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) { IO_COND(addr, return pio_read32be(port), return mmio_read32be(addr));return 0xffffffff ;
@@ -142,26 +142,26 @@ static u64 pio_read64be_hi_lo(unsigned long port)return lo | (hi <<32 ); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) { IO_COND(addr, return pio_read64be_lo_hi(port), return mmio_read64be(addr));return 0xffffffffffffffffULL ; } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) { IO_COND(addr, return pio_read64be_hi_lo(port), return mmio_read64be(addr));
@@ -275,7 +275,7 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* order" (we also don't have IO barriers). */ #ifndef mmio_insb -static inline void mmio_insb (void __iomem *addr,u8 *dst,int count) +static inline void mmio_insb (const void __iomem *addr,u8 *dst,int count) {while (--count >=0 ) {u8 data =__raw_readb (addr);
@@ -283,7 +283,7 @@ static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) dst++; } } -static inline void mmio_insw (void __iomem *addr,u16 *dst,int count) +static inline void mmio_insw (const void __iomem *addr,u16 *dst,int count) {while (--count >=0 ) {u16 data =__raw_readw (addr);
@@ -291,7 +291,7 @@ static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) dst++; } } -static inline void mmio_insl (void __iomem *addr,u32 *dst,int count) +static inline void mmio_insl (const void __iomem *addr,u32 *dst,int count) {while (--count >=0 ) {u32 data =__raw_readl (addr);
@@ -325,15 +325,15 @@ static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) }#endif -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insb (port,dst,count),mmio_insb (addr, dst, count)); } -void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insw (port,dst,count),mmio_insw (addr, dst, count)); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {IO_COND (addr,insl (port,dst,count),mmio_insl (addr, dst, count)); }
Signature · 1 line
2.17.1
PATCH RESEND v2 2/9 rtl818x: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Kalle's ack. Fix subject prefix.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8180.h +3 -3
@@ -150,17 +150,17 @@ void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);void rtl8180_set_anaparam (struct rtl8180_priv *priv,u32 anaparam);void rtl8180_set_anaparam2 (struct rtl8180_priv *priv,u32 anaparam2); -static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,u8 __iomem *addr) +static inline u8 rtl818x_ioread8 (struct rtl8180_priv *priv,const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,__le16 __iomem *addr) +static inline u16 rtl818x_ioread16 (struct rtl8180_priv *priv,const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,__le32 __iomem *addr) +static inline u32 rtl818x_ioread32 (struct rtl8180_priv *priv,const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 3/9 ntb: intel: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
2. Add Dave's ack.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- drivers/ntb/hw/intel/ntb_hw_gen3.h | 2 +- drivers/ntb/hw/intel/ntb_hw_intel.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +1 -1
@@ -1202,7 +1202,7 @@ int intel_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, int sidx, ndev->peer_reg->spad); } -static u64 xeon_db_ioread (void __iomem *mmio) +static u64 xeon_db_ioread (const void __iomem *mmio) {return (u64 )ioread16 (mmio); }
drivers/ntb/hw/intel/ntb_hw_gen3.h +1 -1
@@ -91,7 +91,7 @@#define GEN3_DB_TOTAL_SHIFT 33#define GEN3_SPAD_COUNT 16 -static inline u64 gen3_db_ioread (void __iomem *mmio) +static inline u64 gen3_db_ioread (const void __iomem *mmio) {return ioread64 (mmio); }
drivers/ntb/hw/intel/ntb_hw_intel.h +1 -1
@@ -102,7 +102,7 @@ struct intel_ntb_dev;struct intel_ntb_reg {int (*poll_link)(struct intel_ntb_dev *ndev);int (*link_is_up)(struct intel_ntb_dev *ndev); -u64 (*db_ioread)(void __iomem *mmio); +u64 (*db_ioread)(const void __iomem *mmio);void (*db_iowrite)(u64 db_bits,void __iomem *mmio);unsigned long ntb_ctl;resource_size_t db_size;
Signature · 1 line
2.17.1
PATCH RESEND v2 4/9 virtio: pci: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Geert's review.
--- drivers/virtio/virtio_pci_modern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci_modern.c +3 -3
@@ -26,16 +26,16 @@* method, i.e. 32-bit accesses for 32-bit fields, 16-bit accesses * for 16-bit fields and 8-bit accesses for 8-bit fields. */ -static inline u8 vp_ioread8 (u8 __iomem *addr) +static inline u8 vp_ioread8 (const u8 __iomem *addr) {return ioread8 (addr); } -static inline u16 vp_ioread16 (__le16 __iomem *addr) +static inline u16 vp_ioread16 (const __le16 __iomem *addr) {return ioread16 (addr); } -static inline u32 vp_ioread32 (__le32 __iomem *addr) +static inline u32 vp_ioread32 (const __le32 __iomem *addr) {return ioread32 (addr); }
Signature · 1 line
2.17.1
PATCH RESEND v2 5/9 arc: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Alexey's ack.
--- arch/arc/plat-axs10x/axs10x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/plat-axs10x/axs10x.c +2 -2
@@ -84,7 +84,7 @@ static void __init axs10x_print_board_ver(unsigned int creg, const char *str)unsigned int val; } board; - board.val =ioread32 ((void __iomem *)creg); + board.val =ioread32 ((const void __iomem *)creg);pr_info ("AXS: %s FPGA Date: %u-%u-%u\n" , str, board.d, board.m, board.y); }
@@ -95,7 +95,7 @@ static void __init axs10x_early_init(void)char mb[32 ];/* Determine motherboard version */ -if (ioread32 ((void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) +if (ioread32 ((const void __iomem *)CREG_MB_CONFIG ) & (1 <<28 )) mb_rev =3 ;/* HT-3 (rev3.0) */ else mb_rev =2 ;/* HT-2 (rev2.0) */
Signature · 1 line
2.17.1
PATCH RESEND v2 6/9 drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
---
Changes since v1:
1. Add Thomas' review.
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +2 -2
@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 1 line
2.17.1
PATCH RESEND v2 7/9 drm/nouveau: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
@@ -613,7 +613,7 @@ nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index) mem += index;if (is_iomem) -return ioread32_native ((void __force __iomem *)mem); +return ioread32_native ((const void __force __iomem *)mem);else return *mem; }
Signature · 1 line
2.17.1
PATCH RESEND v2 8/9 media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/fsl-viu.c +1 -1
@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Signature · 1 line
2.17.1
PATCH RESEND v2 9/9 ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiThe ioreadX() 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.
--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ahb.c +5 -5
@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg |=AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL );/* Enable global WMAC swapping */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_BYTESWAP ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_BYTESWAP ); reg |=AR5K_AR2315_BYTESWAP_WMAC ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_BYTESWAP ); }else {/* Enable WMAC DMA access (assuming 5312 or 231x*/ /* TODO: check other platforms */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg |=AR5K_AR5312_ENABLE_WLAN0 ;else
@@ -202,12 +202,12 @@ static int ath_ahb_remove(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Disable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN ;iowrite32 (reg, (void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); }else {/*Stop DMA access */ - reg =ioread32 ((void __iomem *)AR5K_AR5312_ENABLE ); + reg =ioread32 ((const void __iomem *)AR5K_AR5312_ENABLE );if (to_platform_device (ah->dev)->id ==0 ) reg &= ~AR5K_AR5312_ENABLE_WLAN0 ;else
Signature · 1 line
2.17.1
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 18 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 5 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );
While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
thanks,
Signature · 1 line
js
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveQuoted 18 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 5 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );
While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
thanks,
Signature · 1 line
js
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 18 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 5 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );
While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
thanks,
Signature · 1 line
js
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 18 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 5 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );
While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
thanks,
Signature · 1 line
js
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Jiri SlabyQuoted 20 lines · Jiri Slaby
Quoted 19 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)
Quoted 8 lines
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 4 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
Because the argument is an int:
drivers/net/wireless/ath/ath5k/ahb.c: In function ‘ath_ahb_probe’:drivers/net/wireless/ath/ath5k/ahb.c:141:18: warning: passing argument 1 of ‘ioread32’ makes pointer from integer without a cast [-Wint-conversion]
reg = ioread32(AR5K_AR2315_AHB_ARB_CTL);
Best regards,
Krzysztof
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
Hi Krzysztof,
Quoted 30 lines · Krzysztof Kozlowski
Quoted 20 lines · Jiri Slaby
Quoted 19 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)Quoted 8 lines
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 4 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
Quoted 5 lines
Because the argument is an int:
drivers/net/wireless/ath/ath5k/ahb.c: In function ‘ath_ahb_probe’:drivers/net/wireless/ath/ath5k/ahb.c:141:18: warning: passing argument 1 of ‘ioread32’ makes pointer from integer without a cast [-Wint-conversion]
reg =ioread32(AR5K_AR2315_AHB_ARB_CTL);
That's an argument for keeping the cast to "void __iomem *", not for adding the "const", right?
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
RE: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
From: Geert Uytterhoeven
Quoted 2 lines
Sent: 24 February 2020 12:54
To: Krzysztof Kozlowski <[email protected]>
...
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/wireless/ath/ath5k/ahb.c +0
-0@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)Quoted 8 lines
drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 4 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
Because the argument is an int:
Quoted 7 lines
Quoted 2 lines
drivers/net/wireless/ath/ath5k/ahb.c: In function ‘ath_ahb_probe’:drivers/net/wireless/ath/ath5k/ahb.c:141:18: warning: passing argument 1 of ‘ioread32’ makes pointerfrom integer without a cast [-Wint-conversion]
Quoted 1 line
reg = ioread32(AR5K_AR2315_AHB_ARB_CTL);That's an argument for keeping the cast to "void
__iomem*", not for adding the "const", right?
Or more likely change the definitions to use a struct for the layout. That also stops the constants being used in the wrong place.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Geert UytterhoevenQuoted 33 lines · Geert Uytterhoeven
Hi Krzysztof,
Quoted 30 lines · Krzysztof Kozlowski
Quoted 28 lines · Jiri Slaby
Quoted 18 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Acked-by Kalle Valo <[email protected]>--- drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath5k/ahb.c +0
-0drivers/net/wireless/ath/ath5k/ahb.c static int ath_ahb_probe(struct platform_device *pdev) · line 141
Quoted 5 lines
drivers/net/wireless/ath/ath5k/ahb.c +1
-1@@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_device *pdev)if (bcfg->devid >=AR5K_SREV_AR2315_R6 ) {/* Enable WMAC AHB arbitration */ - reg =ioread32 ((void __iomem *)AR5K_AR2315_AHB_ARB_CTL ); + reg =ioread32 ((const void __iomem *)AR5K_AR2315_AHB_ARB_CTL );While I understand why the parameter of ioread32 should be const, I don't see a reason for these casts on the users' side. What does it bring except longer code to read?
Quoted 8 lines
Quoted 5 lines
Because the argument is an int:
drivers/net/wireless/ath/ath5k/ahb.c: In function ‘ath_ahb_probe’:drivers/net/wireless/ath/ath5k/ahb.c:141:18: warning: passing argument 1 of ‘ioread32’ makes pointer from integer without a cast [-Wint-conversion]
reg =ioread32(AR5K_AR2315_AHB_ARB_CTL);That's an argument for keeping the cast to "void
__iomem*", not for adding the "const", right?
Yes, correct. Maybe I misunderstood the question... The const on the other hand does not have to be in the cast. It is merely for making it consistent with interface. It is not required. I also mentioned it in the cover letter:
"PAtches 5-9 are optional cleanup, without actual impact"
Feel free to ignore this one if it is not worth the effort.
Best regards,
Krzysztof
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [RESEND PATCH v2 8/9] media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 8 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>
Regards,
Hans
Quoted 18 lines
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/fsl-viu.c +1
-1@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Re: [RESEND PATCH v2 8/9] media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 8 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>
Regards,
Hans
Quoted 18 lines
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/fsl-viu.c +1
-1@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Hans Verkuil
Acked-byRe: [RESEND PATCH v2 8/9] media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveQuoted 8 lines · Krzysztof Kozlowski
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>
Regards,
Hans
Quoted 18 lines
--- drivers/media/platform/fsl-viu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/fsl-viu.c +1
-1@@ -34,7 +34,7 @@/* Allow building this driver with COMPILE_TEST */ #if !defined(CONFIG_PPC ) && !defined(CONFIG_MICROBLAZE )#define out_be32 (v, a) iowrite32be(a, (void __iomem *)v) -#define in_be32 (a) ioread32be((void __iomem *)a) +#define in_be32 (a) ioread32be((const void __iomem *)a)#endif #define BUFFER_TIMEOUT msecs_to_jiffies(500)/* 0.5 seconds */
Thomas Zimmermann
maintainerRe: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiHi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Best regards
Thomas
Am 19.02.20 um 18:50 schrieb Krzysztof Kozlowski:
Quoted 35 lines
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Changes since v1:
1. Add Thomas' review.--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mgag200/mgag200_drv.h +2
-2@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Re: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveHi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Best regards
Thomas
Am 19.02.20 um 18:50 schrieb Krzysztof Kozlowski:
Quoted 35 lines
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Changes since v1:
1. Add Thomas' review.--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mgag200/mgag200_drv.h +2
-2@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Thomas Zimmermann
maintainerRe: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiHi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Best regards
Thomas
Am 19.02.20 um 18:50 schrieb Krzysztof Kozlowski:
Quoted 35 lines
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Changes since v1:
1. Add Thomas' review.--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mgag200/mgag200_drv.h +2
-2@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Thomas Zimmermann
maintainerRe: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiHi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Best regards
Thomas
Am 19.02.20 um 18:50 schrieb Krzysztof Kozlowski:
Quoted 35 lines
The
ioreadX()helpers have inconsistent interface. On some architectures void*__iomemaddress 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.Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>---
Changes since v1:
1. Add Thomas' review.--- drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mgag200/mgag200_drv.h +2
-2@@ -34,9 +34,9 @@#define MGAG200FB_CONN_LIMIT 1 -#define RREG8 (reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG8 (reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))#define WREG8 (reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) -#define RREG32 (reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) +#define RREG32 (reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))#define WREG32 (reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))#define ATTR_INDEX 0x1fc0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Re: [RESEND PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 76 lines · Krzysztof Kozlowski
arch/powerpc/kernel/iomap.c +12
-12@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); }
arch/powerpc/kernel/iomap.c EXPORT_SYMBOL(iowrite64be_hi_lo); · line 153
Quoted 10 lines
arch/powerpc/kernel/iomap.c +2
-2-void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
This looks OK to me.
cheers
Michael Ellerman
Acked-byRe: [RESEND PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to a message not in the archiveQuoted 76 lines · Krzysztof Kozlowski
arch/powerpc/kernel/iomap.c +12
-12@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); }
arch/powerpc/kernel/iomap.c EXPORT_SYMBOL(iowrite64be_hi_lo); · line 153
Quoted 10 lines
arch/powerpc/kernel/iomap.c +2
-2-void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
This looks OK to me.
cheers
Re: [RESEND PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 76 lines · Krzysztof Kozlowski
arch/powerpc/kernel/iomap.c +12
-12@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); }
arch/powerpc/kernel/iomap.c EXPORT_SYMBOL(iowrite64be_hi_lo); · line 153
Quoted 10 lines
arch/powerpc/kernel/iomap.c +2
-2-void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
This looks OK to me.
cheers
Re: [RESEND PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 76 lines · Krzysztof Kozlowski
arch/powerpc/kernel/iomap.c +12
-12@@ -15,23 +15,23 @@* Here comes the ppc64 implementation of the IOMAP * interfaces. */ -unsigned int ioread8 (void __iomem *addr) +unsigned int ioread8 (const void __iomem *addr) {return readb (addr); } -unsigned int ioread16 (void __iomem *addr) +unsigned int ioread16 (const void __iomem *addr) {return readw (addr); } -unsigned int ioread16be (void __iomem *addr) +unsigned int ioread16be (const void __iomem *addr) {return readw_be (addr); } -unsigned int ioread32 (void __iomem *addr) +unsigned int ioread32 (const void __iomem *addr) {return readl (addr); } -unsigned int ioread32be (void __iomem *addr) +unsigned int ioread32be (const void __iomem *addr) {return readl_be (addr); }@@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);EXPORT_SYMBOL (ioread32);EXPORT_SYMBOL (ioread32be);#ifdef __powerpc64__ -u64 ioread64 (void __iomem *addr) +u64 ioread64 (const void __iomem *addr) {return readq (addr); } -u64 ioread64_lo_hi (void __iomem *addr) +u64 ioread64_lo_hi (const void __iomem *addr) {return readq (addr); } -u64 ioread64_hi_lo (void __iomem *addr) +u64 ioread64_hi_lo (const void __iomem *addr) {return readq (addr); } -u64 ioread64be (void __iomem *addr) +u64 ioread64be (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_lo_hi (void __iomem *addr) +u64 ioread64be_lo_hi (const void __iomem *addr) {return readq_be (addr); } -u64 ioread64be_hi_lo (void __iomem *addr) +u64 ioread64be_hi_lo (const void __iomem *addr) {return readq_be (addr); }@@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);* FIXME! We could make these do EEH handling if we really * wanted. Not clear if we do. */ -void ioread8_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread8_rep (const void __iomem *addr,void *dst,unsigned long count) {readsb (addr, dst, count); }
arch/powerpc/kernel/iomap.c EXPORT_SYMBOL(iowrite64be_hi_lo); · line 153
Quoted 10 lines
arch/powerpc/kernel/iomap.c +2
-2-void ioread16_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread16_rep (const void __iomem *addr,void *dst,unsigned long count) {readsw (addr, dst, count); } -void ioread32_rep (void __iomem *addr,void *dst,unsigned long count) +void ioread32_rep (const void __iomem *addr,void *dst,unsigned long count) {readsl (addr, dst, count); }
This looks OK to me.
cheers
Re: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Thomas ZimmermannQuoted 5 lines · Thomas Zimmermann
Hi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Thanks but it depends on the first patch in the series so either it could go with your ack through other tree or I will send it later (once 1st patch gets to mainline).
Best regards,
Krzysztof
Re: [RESEND PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
The
ioreadX()andioreadX_rep()helpers have inconsistent interface. On some architectures void*__iomemaddress argument is a pointer to const, on some not.
Quoted 8 lines
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.Suggested-by Geert Uytterhoeven <[email protected]>Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>Reviewed-by Arnd Bergmann <[email protected]>
Hi Arnd,
This patch touches multipel file systems so no one is brave enough to pick it up. However you are mentioned as maintainer of generic asm headers so maybe you could apply it to arm-soc?
Best regards,
Krzysztof
Quoted 31 lines
---
Changes since v1:
1. Constify alsoioreadX_rep()andmmio_insX(),
2. Squash lib+alpha+powerpc+parisc+sh into one patch for bisectability,
3. Add Geert's review.
4. Add Arnd's review.--- arch/alpha/include/asm/core_apecs.h | 6 +-- arch/alpha/include/asm/core_cia.h | 6 +-- arch/alpha/include/asm/core_lca.h | 6 +-- arch/alpha/include/asm/core_marvel.h | 4 +- arch/alpha/include/asm/core_mcpcia.h | 6 +-- arch/alpha/include/asm/core_t2.h | 2 +- arch/alpha/include/asm/io.h | 12 ++--- arch/alpha/include/asm/io_trivial.h | 16 +++--- arch/alpha/include/asm/jensen.h | 2 +- arch/alpha/include/asm/machvec.h | 6 +-- arch/alpha/kernel/core_marvel.c | 2 +- arch/alpha/kernel/io.c | 12 ++--- arch/parisc/include/asm/io.h | 4 +- arch/parisc/lib/iomap.c | 72 +++++++++++++-------------- arch/powerpc/kernel/iomap.c | 28 +++++------ arch/sh/kernel/iomap.c | 22 ++++---- include/asm-generic/iomap.h | 28 +++++------ include/linux/io-64-nonatomic-hi-lo.h | 4 +- include/linux/io-64-nonatomic-lo-hi.h | 4 +- lib/iomap.c | 30 +++++------ 20 files changed, 136 insertions(+), 136 deletions(-)
Thomas Zimmermann
maintainerRe: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
In reply to Krzysztof KozlowskiHi
Am 14.03.20 um 11:59 schrieb Krzysztof Kozlowski:
Quoted 10 lines · Thomas Zimmermann
Quoted 5 lines
Hi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Thanks but it depends on the first patch in the series so either it could go with your ack through other tree or I will send it later (once 1st patch gets to mainline).
Ok. You're welcome to send it through any tree that works best for you. mgag200 sees only little change. I wouldn't expect major merge conflicts, if any.
Best regards
Thomas
Quoted 5 lines
Best regards,
Krzysztof
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer