[PATCH 06/27] asm-generic: clean up asm-generic/io.h

From: Remis Lima Baima
Date: Thu Apr 30 2009 - 11:44:56 EST


Fix various aspects of the new asm-generic/io.h, in particular
warnings from sparse regarding __iomem annotations.

Signed-off-by: Remis Lima Baima <remis.developer@xxxxxxxxxxxxxx>
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
include/asm-generic/io.h | 37 ++++++++++++++++---------------------
1 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 8377715..5ae45e5 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -13,6 +13,7 @@

#include <asm/page.h> /* I/O is all done through memory accesses */
#include <asm/cacheflush.h>
+#include <linux/types.h>

#ifdef CONFIG_GENERIC_IOMAP
#include <asm-generic/iomap.h>
@@ -29,17 +30,17 @@
*/
static inline u8 __raw_readb(const volatile void __iomem *addr)
{
- return *(const volatile u8 *) addr;
+ return *(const volatile u8 __force *) addr;
}

static inline u16 __raw_readw(const volatile void __iomem *addr)
{
- return *(const volatile u16 *) addr;
+ return *(const volatile u16 __force *) addr;
}

static inline u32 __raw_readl(const volatile void __iomem *addr)
{
- return *(const volatile u32 *) addr;
+ return *(const volatile u32 __force *) addr;
}

#define readb __raw_readb
@@ -48,17 +49,17 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)

static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
{
- *(volatile u8 *) addr = b;
+ *(volatile u8 __force *) addr = b;
}

static inline void __raw_writew(u16 b, volatile void __iomem *addr)
{
- *(volatile u16 *) addr = b;
+ *(volatile u16 __force *) addr = b;
}

static inline void __raw_writel(u32 b, volatile void __iomem *addr)
{
- *(volatile u32 *) addr = b;
+ *(volatile u32 __force *) addr = b;
}

#define writeb __raw_writeb
@@ -68,13 +69,13 @@ static inline void __raw_writel(u32 b, volatile void __iomem *addr)
#ifdef CONFIG_64BIT
static inline u64 __raw_readq(const volatile void __iomem *addr)
{
- return *(const volatile u64 *) addr;
+ return *(const volatile u64 __force *) addr;
}
#define readq(addr) __le64_to_cpu(__raw_readq(addr))

static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
{
- *(volatile u64 *) addr = b;
+ *(volatile u64 __force *) addr = b;
}
#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
#endif
@@ -101,17 +102,17 @@ static inline u32 inl(unsigned long addr)

static inline void outb(u8 b, unsigned long addr)
{
- return writeb(b, (volatile void __iomem *) addr);
+ writeb(b, (volatile void __iomem *) addr);
}

static inline void outw(u16 b, unsigned long addr)
{
- return writew(b, (volatile void __iomem *) addr);
+ writew(b, (volatile void __iomem *) addr);
}

static inline void outl(u32 b, unsigned long addr)
{
- return writel(b, (volatile void __iomem *) addr);
+ writel(b, (volatile void __iomem *) addr);
}

#define inb_p(addr) inb(addr)
@@ -231,7 +232,7 @@ static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
*/
static inline unsigned long virt_to_phys(volatile void *address)
{
- return __pa(address);
+ return __pa((unsigned long)address);
}

static inline void *phys_to_virt(unsigned long address)
@@ -242,16 +243,12 @@ static inline void *phys_to_virt(unsigned long address)
/*
* Change "struct page" to physical address.
*/
-static inline void *__ioremap(unsigned long offset, unsigned long size,
- unsigned long flags)
+static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
{
return (void *) offset;
}

-static inline void *ioremap(unsigned long offset, unsigned long size)
-{
- return (void *) offset;
-}
+#define __ioremap(offset, size, flags) ioremap(offset, size)

#ifndef ioremap_nocache
#define ioremap_nocache ioremap
@@ -279,7 +276,7 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
extern void ioport_unmap(void __iomem *p);
#endif /* CONFIG_GENERIC_IOMAP */

-#define xlate_dev_kmem_ptr(p) ((void *) (p))
+#define xlate_dev_kmem_ptr(p) p
#define xlate_dev_mem_ptr(p) ((void *) (p))

#ifndef virt_to_bus
@@ -294,8 +291,6 @@ static inline void *bus_to_virt(unsigned long address)
}
#endif

-#define page_to_bus page_to_phys
-
#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
--
1.5.6.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/