diff options
author | Brian Gerst <brgerst@gmail.com> | 2010-02-05 09:37:07 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-05 16:57:33 -0500 |
commit | 6175ddf06b6172046a329e3abfd9c901a43efd2e (patch) | |
tree | d721460533e8a4b083f5eeec8f0f5a2ec2062315 | |
parent | 2b4df4d4f7de1a834d252c7da3197fce634cbf0e (diff) |
x86: Clean up mem*io functions.
Iomem has no special significance on x86. Use the standard mem*
functions instead of trying to call other versions. Some fixups
are needed to match the function prototypes.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
LKML-Reference: <1265380629-3212-6-git-send-email-brgerst@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | arch/x86/boot/compressed/misc.c | 13 | ||||
-rw-r--r-- | arch/x86/include/asm/io_32.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/io_64.h | 22 | ||||
-rw-r--r-- | arch/x86/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/lib/io_64.c | 25 |
5 files changed, 23 insertions, 49 deletions
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 3b22fe8ab91b..88042e812d3c 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -19,11 +19,6 @@ | |||
19 | #define _ASM_X86_DESC_H 1 | 19 | #define _ASM_X86_DESC_H 1 |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifdef CONFIG_X86_64 | ||
23 | #define _LINUX_STRING_H_ 1 | ||
24 | #define __LINUX_BITMAP_H 1 | ||
25 | #endif | ||
26 | |||
27 | #include <linux/linkage.h> | 22 | #include <linux/linkage.h> |
28 | #include <linux/screen_info.h> | 23 | #include <linux/screen_info.h> |
29 | #include <linux/elf.h> | 24 | #include <linux/elf.h> |
@@ -131,8 +126,8 @@ static void error(char *m); | |||
131 | static struct boot_params *real_mode; /* Pointer to real-mode data */ | 126 | static struct boot_params *real_mode; /* Pointer to real-mode data */ |
132 | static int quiet; | 127 | static int quiet; |
133 | 128 | ||
134 | static void *memset(void *s, int c, unsigned n); | 129 | void *memset(void *s, int c, size_t n); |
135 | void *memcpy(void *dest, const void *src, unsigned n); | 130 | void *memcpy(void *dest, const void *src, size_t n); |
136 | 131 | ||
137 | static void __putstr(int, const char *); | 132 | static void __putstr(int, const char *); |
138 | #define putstr(__x) __putstr(0, __x) | 133 | #define putstr(__x) __putstr(0, __x) |
@@ -223,7 +218,7 @@ static void __putstr(int error, const char *s) | |||
223 | outb(0xff & (pos >> 1), vidport+1); | 218 | outb(0xff & (pos >> 1), vidport+1); |
224 | } | 219 | } |
225 | 220 | ||
226 | static void *memset(void *s, int c, unsigned n) | 221 | void *memset(void *s, int c, size_t n) |
227 | { | 222 | { |
228 | int i; | 223 | int i; |
229 | char *ss = s; | 224 | char *ss = s; |
@@ -233,7 +228,7 @@ static void *memset(void *s, int c, unsigned n) | |||
233 | return s; | 228 | return s; |
234 | } | 229 | } |
235 | 230 | ||
236 | void *memcpy(void *dest, const void *src, unsigned n) | 231 | void *memcpy(void *dest, const void *src, size_t n) |
237 | { | 232 | { |
238 | int i; | 233 | int i; |
239 | const char *s = src; | 234 | const char *s = src; |
diff --git a/arch/x86/include/asm/io_32.h b/arch/x86/include/asm/io_32.h index 72a6a4a930ae..685e33293468 100644 --- a/arch/x86/include/asm/io_32.h +++ b/arch/x86/include/asm/io_32.h | |||
@@ -49,21 +49,21 @@ | |||
49 | #define xlate_dev_kmem_ptr(p) p | 49 | #define xlate_dev_kmem_ptr(p) p |
50 | 50 | ||
51 | static inline void | 51 | static inline void |
52 | memset_io(volatile void __iomem *addr, unsigned char val, int count) | 52 | memset_io(volatile void __iomem *addr, unsigned char val, size_t count) |
53 | { | 53 | { |
54 | memset((void __force *)addr, val, count); | 54 | memset((void __force *)addr, val, count); |
55 | } | 55 | } |
56 | 56 | ||
57 | static inline void | 57 | static inline void |
58 | memcpy_fromio(void *dst, const volatile void __iomem *src, int count) | 58 | memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count) |
59 | { | 59 | { |
60 | __memcpy(dst, (const void __force *)src, count); | 60 | memcpy(dst, (const void __force *)src, count); |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline void | 63 | static inline void |
64 | memcpy_toio(volatile void __iomem *dst, const void *src, int count) | 64 | memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) |
65 | { | 65 | { |
66 | __memcpy((void __force *)dst, src, count); | 66 | memcpy((void __force *)dst, src, count); |
67 | } | 67 | } |
68 | 68 | ||
69 | /* | 69 | /* |
diff --git a/arch/x86/include/asm/io_64.h b/arch/x86/include/asm/io_64.h index 4a94aef5acf1..1305525813fc 100644 --- a/arch/x86/include/asm/io_64.h +++ b/arch/x86/include/asm/io_64.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_IO_64_H | 1 | #ifndef _ASM_X86_IO_64_H |
2 | #define _ASM_X86_IO_64_H | 2 | #define _ASM_X86_IO_64_H |
3 | 3 | ||
4 | #include <linux/string.h> | ||
5 | #include <linux/compiler.h> | ||
4 | 6 | ||
5 | /* | 7 | /* |
6 | * This file contains the definitions for the x86 IO instructions | 8 | * This file contains the definitions for the x86 IO instructions |
@@ -46,20 +48,22 @@ | |||
46 | */ | 48 | */ |
47 | #define xlate_dev_kmem_ptr(p) p | 49 | #define xlate_dev_kmem_ptr(p) p |
48 | 50 | ||
49 | void memset_io(volatile void __iomem *a, int b, size_t c); | 51 | static inline void |
52 | memset_io(volatile void __iomem *addr, unsigned char val, size_t count) | ||
53 | { | ||
54 | memset((void __force *)addr, val, count); | ||
55 | } | ||
50 | 56 | ||
51 | void __memcpy_fromio(void *, unsigned long, unsigned); | 57 | static inline void |
52 | static inline void memcpy_fromio(void *to, const volatile void __iomem *from, | 58 | memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count) |
53 | unsigned len) | ||
54 | { | 59 | { |
55 | __memcpy_fromio(to, (unsigned long)from, len); | 60 | memcpy(dst, (const void __force *)src, count); |
56 | } | 61 | } |
57 | 62 | ||
58 | void __memcpy_toio(unsigned long, const void *, unsigned); | 63 | static inline void |
59 | static inline void memcpy_toio(volatile void __iomem *to, const void *from, | 64 | memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) |
60 | unsigned len) | ||
61 | { | 65 | { |
62 | __memcpy_toio((unsigned long)to, from, len); | 66 | memcpy((void __force *)dst, src, count); |
63 | } | 67 | } |
64 | 68 | ||
65 | /* | 69 | /* |
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index cffd754f3039..fff14272dbad 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -34,7 +34,7 @@ ifneq ($(CONFIG_X86_CMPXCHG64),y) | |||
34 | endif | 34 | endif |
35 | lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o | 35 | lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o |
36 | else | 36 | else |
37 | obj-y += io_64.o iomap_copy_64.o | 37 | obj-y += iomap_copy_64.o |
38 | lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o | 38 | lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o |
39 | lib-y += thunk_64.o clear_page_64.o copy_page_64.o | 39 | lib-y += thunk_64.o clear_page_64.o copy_page_64.o |
40 | lib-y += memmove_64.o memset_64.o | 40 | lib-y += memmove_64.o memset_64.o |
diff --git a/arch/x86/lib/io_64.c b/arch/x86/lib/io_64.c deleted file mode 100644 index 3f1eb59b5f08..000000000000 --- a/arch/x86/lib/io_64.c +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #include <linux/string.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <asm/io.h> | ||
4 | |||
5 | void __memcpy_toio(unsigned long dst, const void *src, unsigned len) | ||
6 | { | ||
7 | __inline_memcpy((void *)dst, src, len); | ||
8 | } | ||
9 | EXPORT_SYMBOL(__memcpy_toio); | ||
10 | |||
11 | void __memcpy_fromio(void *dst, unsigned long src, unsigned len) | ||
12 | { | ||
13 | __inline_memcpy(dst, (const void *)src, len); | ||
14 | } | ||
15 | EXPORT_SYMBOL(__memcpy_fromio); | ||
16 | |||
17 | void memset_io(volatile void __iomem *a, int b, size_t c) | ||
18 | { | ||
19 | /* | ||
20 | * TODO: memset can mangle the IO patterns quite a bit. | ||
21 | * perhaps it would be better to use a dumb one: | ||
22 | */ | ||
23 | memset((void *)a, b, c); | ||
24 | } | ||
25 | EXPORT_SYMBOL(memset_io); | ||