diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-11-30 06:45:54 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-11-30 06:45:54 -0500 |
commit | 0560cf5aa51216b06874333a2fa26ca034d97bdb (patch) | |
tree | 4feb666ca357b708ec1f13c7bc52284018e107c8 /arch | |
parent | cd32a48dc5c2f415790bfbc4fe564b2b0e9c2414 (diff) |
[ARM] Add a common typesafe __io implementation
As Al did for Versatile in 2ad4f86b60b649fd7428265c08d73a3bd360c81b,
add a typesafe __io implementation for platforms to use. Convert
platforms to use this new simple typesafe implementation.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
23 files changed, 44 insertions, 65 deletions
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index a8094451be57..d2a59cfc30ce 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h | |||
@@ -80,6 +80,14 @@ extern void __iounmap(volatile void __iomem *addr); | |||
80 | extern void __readwrite_bug(const char *fn); | 80 | extern void __readwrite_bug(const char *fn); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * A typesafe __io() helper | ||
84 | */ | ||
85 | static inline void __iomem *__typesafe_io(unsigned long addr) | ||
86 | { | ||
87 | return (void __iomem *)addr; | ||
88 | } | ||
89 | |||
90 | /* | ||
83 | * Now, pick up the machine-defined IO definitions | 91 | * Now, pick up the machine-defined IO definitions |
84 | */ | 92 | */ |
85 | #include <mach/io.h> | 93 | #include <mach/io.h> |
diff --git a/arch/arm/mach-aaec2000/include/mach/io.h b/arch/arm/mach-aaec2000/include/mach/io.h index a283296b3175..ab4fe5d20eaf 100644 --- a/arch/arm/mach-aaec2000/include/mach/io.h +++ b/arch/arm/mach-aaec2000/include/mach/io.h | |||
@@ -12,7 +12,7 @@ | |||
12 | * We don't actually have real ISA nor PCI buses, but there is so many | 12 | * We don't actually have real ISA nor PCI buses, but there is so many |
13 | * drivers out there that might just work if we fake them... | 13 | * drivers out there that might just work if we fake them... |
14 | */ | 14 | */ |
15 | #define __io(a) ((void __iomem *)(a)) | 15 | #define __io(a) __typesafe_io(a) |
16 | #define __mem_pci(a) (a) | 16 | #define __mem_pci(a) (a) |
17 | 17 | ||
18 | #endif | 18 | #endif |
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h index 1611bd03f528..0b0cccc46e68 100644 --- a/arch/arm/mach-at91/include/mach/io.h +++ b/arch/arm/mach-at91/include/mach/io.h | |||
@@ -23,8 +23,8 @@ | |||
23 | 23 | ||
24 | #define IO_SPACE_LIMIT 0xFFFFFFFF | 24 | #define IO_SPACE_LIMIT 0xFFFFFFFF |
25 | 25 | ||
26 | #define __io(a) ((void __iomem *)(a)) | 26 | #define __io(a) __typesafe_io(a) |
27 | #define __mem_pci(a) (a) | 27 | #define __mem_pci(a) (a) |
28 | 28 | ||
29 | 29 | ||
30 | #ifndef __ASSEMBLY__ | 30 | #ifndef __ASSEMBLY__ |
diff --git a/arch/arm/mach-clps711x/include/mach/io.h b/arch/arm/mach-clps711x/include/mach/io.h index 49419f946046..2e0b3ced8f07 100644 --- a/arch/arm/mach-clps711x/include/mach/io.h +++ b/arch/arm/mach-clps711x/include/mach/io.h | |||
@@ -22,8 +22,8 @@ | |||
22 | 22 | ||
23 | #define IO_SPACE_LIMIT 0xffffffff | 23 | #define IO_SPACE_LIMIT 0xffffffff |
24 | 24 | ||
25 | #define __io(a) ((void __iomem *)(a)) | 25 | #define __io(a) __typesafe_io(a) |
26 | #define __mem_pci(a) (a) | 26 | #define __mem_pci(a) (a) |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * We don't support ins[lb]/outs[lb]. Make them fault. | 29 | * We don't support ins[lb]/outs[lb]. Make them fault. |
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h index b78ee9140496..a48795fd2417 100644 --- a/arch/arm/mach-davinci/include/mach/io.h +++ b/arch/arm/mach-davinci/include/mach/io.h | |||
@@ -29,8 +29,7 @@ | |||
29 | * We don't actually have real ISA nor PCI buses, but there is so many | 29 | * We don't actually have real ISA nor PCI buses, but there is so many |
30 | * drivers out there that might just work if we fake them... | 30 | * drivers out there that might just work if we fake them... |
31 | */ | 31 | */ |
32 | #define PCIO_BASE 0 | 32 | #define __io(a) __typesafe_io(a) |
33 | #define __io(a) ((void __iomem *)(PCIO_BASE + (a))) | ||
34 | #define __mem_pci(a) (a) | 33 | #define __mem_pci(a) (a) |
35 | #define __mem_isa(a) (a) | 34 | #define __mem_isa(a) (a) |
36 | 35 | ||
diff --git a/arch/arm/mach-ep93xx/include/mach/io.h b/arch/arm/mach-ep93xx/include/mach/io.h index 1ab9a90ad339..fd5f081cc8b7 100644 --- a/arch/arm/mach-ep93xx/include/mach/io.h +++ b/arch/arm/mach-ep93xx/include/mach/io.h | |||
@@ -4,5 +4,5 @@ | |||
4 | 4 | ||
5 | #define IO_SPACE_LIMIT 0xffffffff | 5 | #define IO_SPACE_LIMIT 0xffffffff |
6 | 6 | ||
7 | #define __io(p) ((void __iomem *)(p)) | 7 | #define __io(p) __typesafe_io(p) |
8 | #define __mem_pci(p) (p) | 8 | #define __mem_pci(p) (p) |
diff --git a/arch/arm/mach-h720x/include/mach/io.h b/arch/arm/mach-h720x/include/mach/io.h index f678e4f57e5f..2c8659c21a93 100644 --- a/arch/arm/mach-h720x/include/mach/io.h +++ b/arch/arm/mach-h720x/include/mach/io.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #define IO_SPACE_LIMIT 0xffffffff | 17 | #define IO_SPACE_LIMIT 0xffffffff |
18 | 18 | ||
19 | #define __io(a) ((void __iomem *)(a)) | 19 | #define __io(a) __typesafe_io(a) |
20 | #define __mem_pci(a) (a) | 20 | #define __mem_pci(a) (a) |
21 | 21 | ||
22 | #endif | 22 | #endif |
diff --git a/arch/arm/mach-imx/include/mach/io.h b/arch/arm/mach-imx/include/mach/io.h index 0a11b0f480e0..9e197ae4590f 100644 --- a/arch/arm/mach-imx/include/mach/io.h +++ b/arch/arm/mach-imx/include/mach/io.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #define IO_SPACE_LIMIT 0xffffffff | 23 | #define IO_SPACE_LIMIT 0xffffffff |
24 | 24 | ||
25 | #define __io(a) ((void __iomem *)(a)) | 25 | #define __io(a) __typesafe_io(a) |
26 | #define __mem_pci(a) (a) | 26 | #define __mem_pci(a) (a) |
27 | 27 | ||
28 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index b7f780f574fa..ce63048d45eb 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h | |||
@@ -239,7 +239,7 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count) | |||
239 | 239 | ||
240 | #ifndef CONFIG_PCI | 240 | #ifndef CONFIG_PCI |
241 | 241 | ||
242 | #define __io(v) v | 242 | #define __io(v) __typesafe_io(v) |
243 | 243 | ||
244 | #else | 244 | #else |
245 | 245 | ||
diff --git a/arch/arm/mach-ks8695/include/mach/io.h b/arch/arm/mach-ks8695/include/mach/io.h index f364f24ffe1e..a7a63ac3ba4e 100644 --- a/arch/arm/mach-ks8695/include/mach/io.h +++ b/arch/arm/mach-ks8695/include/mach/io.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #define IO_SPACE_LIMIT 0xffffffff | 14 | #define IO_SPACE_LIMIT 0xffffffff |
15 | 15 | ||
16 | #define __io(a) ((void __iomem *)(a)) | 16 | #define __io(a) __typesafe_io(a) |
17 | #define __mem_pci(a) (a) | 17 | #define __mem_pci(a) (a) |
18 | 18 | ||
19 | #endif | 19 | #endif |
diff --git a/arch/arm/mach-l7200/include/mach/io.h b/arch/arm/mach-l7200/include/mach/io.h index 64dc59459811..a770a89fb708 100644 --- a/arch/arm/mach-l7200/include/mach/io.h +++ b/arch/arm/mach-l7200/include/mach/io.h | |||
@@ -15,11 +15,7 @@ | |||
15 | /* | 15 | /* |
16 | * There are not real ISA nor PCI buses, so we fake it. | 16 | * There are not real ISA nor PCI buses, so we fake it. |
17 | */ | 17 | */ |
18 | static inline void __iomem *__io(unsigned long addr) | 18 | #define __io(a) __typesafe_io(a) |
19 | { | 19 | #define __mem_pci(a) (a) |
20 | return (void __iomem *)addr; | ||
21 | } | ||
22 | #define __io(a) __io(a) | ||
23 | #define __mem_pci(a) (a) | ||
24 | 20 | ||
25 | #endif | 21 | #endif |
diff --git a/arch/arm/mach-lh7a40x/include/mach/io.h b/arch/arm/mach-lh7a40x/include/mach/io.h index e41422db97a6..6ece45911cbc 100644 --- a/arch/arm/mach-lh7a40x/include/mach/io.h +++ b/arch/arm/mach-lh7a40x/include/mach/io.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #define IO_SPACE_LIMIT 0xffffffff | 14 | #define IO_SPACE_LIMIT 0xffffffff |
15 | 15 | ||
16 | /* No ISA or PCI bus on this machine. */ | 16 | /* No ISA or PCI bus on this machine. */ |
17 | #define __io(a) ((void __iomem *)(a)) | 17 | #define __io(a) __typesafe_io(a) |
18 | #define __mem_pci(a) (a) | 18 | #define __mem_pci(a) (a) |
19 | 19 | ||
20 | #endif /* __ASM_ARCH_IO_H */ | 20 | #endif /* __ASM_ARCH_IO_H */ |
diff --git a/arch/arm/mach-msm/include/mach/io.h b/arch/arm/mach-msm/include/mach/io.h index c6a2feb268b0..aab964591db4 100644 --- a/arch/arm/mach-msm/include/mach/io.h +++ b/arch/arm/mach-msm/include/mach/io.h | |||
@@ -23,11 +23,7 @@ | |||
23 | 23 | ||
24 | void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype); | 24 | void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype); |
25 | 25 | ||
26 | static inline void __iomem *__io(unsigned long addr) | 26 | #define __io(a) __typesafe_io(a) |
27 | { | ||
28 | return (void __iomem *)addr; | ||
29 | } | ||
30 | #define __io(a) __io(a) | ||
31 | #define __mem_pci(a) (a) | 27 | #define __mem_pci(a) (a) |
32 | 28 | ||
33 | #endif | 29 | #endif |
diff --git a/arch/arm/mach-netx/include/mach/io.h b/arch/arm/mach-netx/include/mach/io.h index 468b92a82585..c3921cb3b6a6 100644 --- a/arch/arm/mach-netx/include/mach/io.h +++ b/arch/arm/mach-netx/include/mach/io.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #define IO_SPACE_LIMIT 0xffffffff | 23 | #define IO_SPACE_LIMIT 0xffffffff |
24 | 24 | ||
25 | #define __io(a) ((void __iomem *)(a)) | 25 | #define __io(a) __typesafe_io(a) |
26 | #define __mem_pci(a) (a) | 26 | #define __mem_pci(a) (a) |
27 | 27 | ||
28 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-ns9xxx/include/mach/io.h b/arch/arm/mach-ns9xxx/include/mach/io.h index 027bf649645a..f08451d2e1bc 100644 --- a/arch/arm/mach-ns9xxx/include/mach/io.h +++ b/arch/arm/mach-ns9xxx/include/mach/io.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #define IO_SPACE_LIMIT 0xffffffff /* XXX */ | 14 | #define IO_SPACE_LIMIT 0xffffffff /* XXX */ |
15 | 15 | ||
16 | #define __io(a) ((void __iomem *)(a)) | 16 | #define __io(a) __typesafe_io(a) |
17 | #define __mem_pci(a) (a) | 17 | #define __mem_pci(a) (a) |
18 | #define __mem_isa(a) (IO_BASE + (a)) | 18 | #define __mem_isa(a) (IO_BASE + (a)) |
19 | 19 | ||
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h index f24b2513f7f3..c47b033bd999 100644 --- a/arch/arm/mach-orion5x/include/mach/io.h +++ b/arch/arm/mach-orion5x/include/mach/io.h | |||
@@ -38,14 +38,9 @@ __arch_iounmap(void __iomem *addr) | |||
38 | __iounmap(addr); | 38 | __iounmap(addr); |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline void __iomem *__io(unsigned long addr) | ||
42 | { | ||
43 | return (void __iomem *)addr; | ||
44 | } | ||
45 | |||
46 | #define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m) | 41 | #define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m) |
47 | #define __arch_iounmap(a) __arch_iounmap(a) | 42 | #define __arch_iounmap(a) __arch_iounmap(a) |
48 | #define __io(a) __io(a) | 43 | #define __io(a) __typesafe_io(a) |
49 | #define __mem_pci(a) (a) | 44 | #define __mem_pci(a) (a) |
50 | 45 | ||
51 | 46 | ||
diff --git a/arch/arm/mach-pnx4008/include/mach/io.h b/arch/arm/mach-pnx4008/include/mach/io.h index c6206f25839d..cbf0904540ea 100644 --- a/arch/arm/mach-pnx4008/include/mach/io.h +++ b/arch/arm/mach-pnx4008/include/mach/io.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define IO_SPACE_LIMIT 0xffffffff | 16 | #define IO_SPACE_LIMIT 0xffffffff |
17 | 17 | ||
18 | #define __io(a) ((void __iomem *)(a)) | 18 | #define __io(a) __typesafe_io(a) |
19 | #define __mem_pci(a) (a) | 19 | #define __mem_pci(a) (a) |
20 | 20 | ||
21 | #endif | 21 | #endif |
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h index 38cb2123e9b2..262691fb97d8 100644 --- a/arch/arm/mach-pxa/include/mach/io.h +++ b/arch/arm/mach-pxa/include/mach/io.h | |||
@@ -12,7 +12,7 @@ | |||
12 | * We don't actually have real ISA nor PCI buses, but there is so many | 12 | * We don't actually have real ISA nor PCI buses, but there is so many |
13 | * drivers out there that might just work if we fake them... | 13 | * drivers out there that might just work if we fake them... |
14 | */ | 14 | */ |
15 | #define __io(a) ((void __iomem *)(a)) | 15 | #define __io(a) __typesafe_io(a) |
16 | #define __mem_pci(a) (a) | 16 | #define __mem_pci(a) (a) |
17 | 17 | ||
18 | #endif | 18 | #endif |
diff --git a/arch/arm/mach-realview/include/mach/io.h b/arch/arm/mach-realview/include/mach/io.h index aa069424d310..f05bcdf605d8 100644 --- a/arch/arm/mach-realview/include/mach/io.h +++ b/arch/arm/mach-realview/include/mach/io.h | |||
@@ -22,12 +22,7 @@ | |||
22 | 22 | ||
23 | #define IO_SPACE_LIMIT 0xffffffff | 23 | #define IO_SPACE_LIMIT 0xffffffff |
24 | 24 | ||
25 | static inline void __iomem *__io(unsigned long addr) | 25 | #define __io(a) __typesafe_io(a) |
26 | { | 26 | #define __mem_pci(a) (a) |
27 | return (void __iomem *)addr; | ||
28 | } | ||
29 | |||
30 | #define __io(a) __io(a) | ||
31 | #define __mem_pci(a) (a) | ||
32 | 27 | ||
33 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h index 0c070a6149bc..d8b43f3dcd2d 100644 --- a/arch/arm/mach-sa1100/include/mach/io.h +++ b/arch/arm/mach-sa1100/include/mach/io.h | |||
@@ -16,11 +16,7 @@ | |||
16 | * We don't actually have real ISA nor PCI buses, but there is so many | 16 | * We don't actually have real ISA nor PCI buses, but there is so many |
17 | * drivers out there that might just work if we fake them... | 17 | * drivers out there that might just work if we fake them... |
18 | */ | 18 | */ |
19 | static inline void __iomem *__io(unsigned long addr) | 19 | #define __io(a) __typesafe_io(a) |
20 | { | 20 | #define __mem_pci(a) (a) |
21 | return (void __iomem *)addr; | ||
22 | } | ||
23 | #define __io(a) __io(a) | ||
24 | #define __mem_pci(a) (a) | ||
25 | 21 | ||
26 | #endif | 22 | #endif |
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h index c0b9dd1d0257..f067c14c7182 100644 --- a/arch/arm/mach-versatile/include/mach/io.h +++ b/arch/arm/mach-versatile/include/mach/io.h | |||
@@ -22,11 +22,7 @@ | |||
22 | 22 | ||
23 | #define IO_SPACE_LIMIT 0xffffffff | 23 | #define IO_SPACE_LIMIT 0xffffffff |
24 | 24 | ||
25 | static inline void __iomem *__io(unsigned long addr) | 25 | #define __io(a) __typesafe_io(a) |
26 | { | 26 | #define __mem_pci(a) (a) |
27 | return (void __iomem *)addr; | ||
28 | } | ||
29 | #define __io(a) __io(a) | ||
30 | #define __mem_pci(a) (a) | ||
31 | 27 | ||
32 | #endif | 28 | #endif |
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h index 5d4cb1196441..c0cb267e7403 100644 --- a/arch/arm/plat-mxc/include/mach/io.h +++ b/arch/arm/plat-mxc/include/mach/io.h | |||
@@ -35,8 +35,8 @@ __mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | |||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* io address mapping macro */ | 37 | /* io address mapping macro */ |
38 | #define __io(a) ((void __iomem *)(a)) | 38 | #define __io(a) __typesafe_io(a) |
39 | 39 | ||
40 | #define __mem_pci(a) (a) | 40 | #define __mem_pci(a) (a) |
41 | 41 | ||
42 | #endif | 42 | #endif |
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h index adc83b7b8205..d92bf7964481 100644 --- a/arch/arm/plat-omap/include/mach/io.h +++ b/arch/arm/plat-omap/include/mach/io.h | |||
@@ -42,8 +42,8 @@ | |||
42 | * We don't actually have real ISA nor PCI buses, but there is so many | 42 | * We don't actually have real ISA nor PCI buses, but there is so many |
43 | * drivers out there that might just work if we fake them... | 43 | * drivers out there that might just work if we fake them... |
44 | */ | 44 | */ |
45 | #define __io(a) ((void __iomem *)(PCIO_BASE + (a))) | 45 | #define __io(a) __typesafe_io(a) |
46 | #define __mem_pci(a) (a) | 46 | #define __mem_pci(a) (a) |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * ---------------------------------------------------------------------------- | 49 | * ---------------------------------------------------------------------------- |
@@ -51,8 +51,6 @@ | |||
51 | * ---------------------------------------------------------------------------- | 51 | * ---------------------------------------------------------------------------- |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #define PCIO_BASE 0 | ||
55 | |||
56 | #if defined(CONFIG_ARCH_OMAP1) | 54 | #if defined(CONFIG_ARCH_OMAP1) |
57 | 55 | ||
58 | #define IO_PHYS 0xFFFB0000 | 56 | #define IO_PHYS 0xFFFB0000 |