From: David S. Miller Date: Wed, 31 Aug 2005 22:01:33 +0000 (-0700) Subject: [SPARC64]: Use 'unsigned long' for port argument to I/O string ops. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8a36895c0ddac143b7f0e87d46153f4f75d9fff7;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [SPARC64]: Use 'unsigned long' for port argument to I/O string ops. This kills warnings when building drivers/ide/ide-iops.c and puts us in-line with what other platforms do here. Signed-off-by: David S. Miller --- diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c index 3008d536e8c..3c6cfbb2036 100644 --- a/arch/sparc64/lib/PeeCeeI.c +++ b/arch/sparc64/lib/PeeCeeI.c @@ -7,28 +7,31 @@ #include #include -void outsb(void __iomem *addr, const void *src, unsigned long count) +void outsb(unsigned long __addr, const void *src, unsigned long count) { + void __iomem *addr = (void __iomem *) __addr; const u8 *p = src; - while(count--) + while (count--) outb(*p++, addr); } -void outsw(void __iomem *addr, const void *src, unsigned long count) +void outsw(unsigned long __addr, const void *src, unsigned long count) { - if(count) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { u16 *ps = (u16 *)src; u32 *pi; - if(((u64)src) & 0x2) { + if (((u64)src) & 0x2) { u16 val = le16_to_cpup(ps); outw(val, addr); ps++; count--; } pi = (u32 *)ps; - while(count >= 2) { + while (count >= 2) { u32 w = le32_to_cpup(pi); pi++; @@ -37,19 +40,21 @@ void outsw(void __iomem *addr, const void *src, unsigned long count) count -= 2; } ps = (u16 *)pi; - if(count) { + if (count) { u16 val = le16_to_cpup(ps); outw(val, addr); } } } -void outsl(void __iomem *addr, const void *src, unsigned long count) +void outsl(unsigned long __addr, const void *src, unsigned long count) { - if(count) { - if((((u64)src) & 0x3) == 0) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { + if ((((u64)src) & 0x3) == 0) { u32 *p = (u32 *)src; - while(count--) { + while (count--) { u32 val = cpu_to_le32p(p); outl(val, addr); p++; @@ -60,13 +65,13 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) u32 l = 0, l2; u32 *pi; - switch(((u64)src) & 0x3) { + switch (((u64)src) & 0x3) { case 0x2: count -= 1; l = cpu_to_le16p(ps) << 16; ps++; pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = cpu_to_le32p(pi); pi++; outl(((l >> 16) | (l2 << 16)), addr); @@ -86,7 +91,7 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) ps++; l |= (l2 << 16); pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = cpu_to_le32p(pi); pi++; outl(((l >> 8) | (l2 << 24)), addr); @@ -101,7 +106,7 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) pb = (u8 *)src; l = (*pb++ << 24); pi = (u32 *)pb; - while(count--) { + while (count--) { l2 = cpu_to_le32p(pi); pi++; outl(((l >> 24) | (l2 << 8)), addr); @@ -119,16 +124,18 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) } } -void insb(void __iomem *addr, void *dst, unsigned long count) +void insb(unsigned long __addr, void *dst, unsigned long count) { - if(count) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { u32 *pi; u8 *pb = dst; - while((((unsigned long)pb) & 0x3) && count--) + while ((((unsigned long)pb) & 0x3) && count--) *pb++ = inb(addr); pi = (u32 *)pb; - while(count >= 4) { + while (count >= 4) { u32 w; w = (inb(addr) << 24); @@ -139,23 +146,25 @@ void insb(void __iomem *addr, void *dst, unsigned long count) count -= 4; } pb = (u8 *)pi; - while(count--) + while (count--) *pb++ = inb(addr); } } -void insw(void __iomem *addr, void *dst, unsigned long count) +void insw(unsigned long __addr, void *dst, unsigned long count) { - if(count) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { u16 *ps = dst; u32 *pi; - if(((unsigned long)ps) & 0x2) { + if (((unsigned long)ps) & 0x2) { *ps++ = le16_to_cpu(inw(addr)); count--; } pi = (u32 *)ps; - while(count >= 2) { + while (count >= 2) { u32 w; w = (le16_to_cpu(inw(addr)) << 16); @@ -164,31 +173,33 @@ void insw(void __iomem *addr, void *dst, unsigned long count) count -= 2; } ps = (u16 *)pi; - if(count) + if (count) *ps = le16_to_cpu(inw(addr)); } } -void insl(void __iomem *addr, void *dst, unsigned long count) +void insl(unsigned long __addr, void *dst, unsigned long count) { - if(count) { - if((((unsigned long)dst) & 0x3) == 0) { + void __iomem *addr = (void __iomem *) __addr; + + if (count) { + if ((((unsigned long)dst) & 0x3) == 0) { u32 *pi = dst; - while(count--) + while (count--) *pi++ = le32_to_cpu(inl(addr)); } else { u32 l = 0, l2, *pi; u16 *ps; u8 *pb; - switch(((unsigned long)dst) & 3) { + switch (((unsigned long)dst) & 3) { case 0x2: ps = dst; count -= 1; l = le32_to_cpu(inl(addr)); *ps++ = l; pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = le32_to_cpu(inl(addr)); *pi++ = (l << 16) | (l2 >> 16); l = l2; @@ -205,7 +216,7 @@ void insl(void __iomem *addr, void *dst, unsigned long count) ps = (u16 *)pb; *ps++ = ((l >> 8) & 0xffff); pi = (u32 *)ps; - while(count--) { + while (count--) { l2 = le32_to_cpu(inl(addr)); *pi++ = (l << 24) | (l2 >> 8); l = l2; @@ -220,7 +231,7 @@ void insl(void __iomem *addr, void *dst, unsigned long count) l = le32_to_cpu(inl(addr)); *pb++ = l >> 24; pi = (u32 *)pb; - while(count--) { + while (count--) { l2 = le32_to_cpu(inl(addr)); *pi++ = (l << 8) | (l2 >> 24); l = l2; diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index afdcea90707..0056770e83a 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -100,18 +100,41 @@ static __inline__ void _outl(u32 l, unsigned long addr) #define inl_p(__addr) inl(__addr) #define outl_p(__l, __addr) outl(__l, __addr) -extern void outsb(void __iomem *addr, const void *src, unsigned long count); -extern void outsw(void __iomem *addr, const void *src, unsigned long count); -extern void outsl(void __iomem *addr, const void *src, unsigned long count); -extern void insb(void __iomem *addr, void *dst, unsigned long count); -extern void insw(void __iomem *addr, void *dst, unsigned long count); -extern void insl(void __iomem *addr, void *dst, unsigned long count); -#define ioread8_rep(a,d,c) insb(a,d,c) -#define ioread16_rep(a,d,c) insw(a,d,c) -#define ioread32_rep(a,d,c) insl(a,d,c) -#define iowrite8_rep(a,s,c) outsb(a,s,c) -#define iowrite16_rep(a,s,c) outsw(a,s,c) -#define iowrite32_rep(a,s,c) outsl(a,s,c) +extern void outsb(unsigned long, const void *, unsigned long); +extern void outsw(unsigned long, const void *, unsigned long); +extern void outsl(unsigned long, const void *, unsigned long); +extern void insb(unsigned long, void *, unsigned long); +extern void insw(unsigned long, void *, unsigned long); +extern void insl(unsigned long, void *, unsigned long); + +static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) +{ + insb((unsigned long __force)port, buf, count); +} +static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count) +{ + insw((unsigned long __force)port, buf, count); +} + +static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count) +{ + insl((unsigned long __force)port, buf, count); +} + +static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count) +{ + outsb((unsigned long __force)port, buf, count); +} + +static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count) +{ + outsw((unsigned long __force)port, buf, count); +} + +static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count) +{ + outsl((unsigned long __force)port, buf, count); +} /* Memory functions, same as I/O accesses on Ultra. */ static inline u8 _readb(const volatile void __iomem *addr)