Skip to content

Commit 6175ddf

Browse files
Brian GerstH. Peter Anvin
authored andcommitted
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>
1 parent 2b4df4d commit 6175ddf

File tree

5 files changed

+23
-49
lines changed

5 files changed

+23
-49
lines changed

arch/x86/boot/compressed/misc.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
#define _ASM_X86_DESC_H 1
2020
#endif
2121

22-
#ifdef CONFIG_X86_64
23-
#define _LINUX_STRING_H_ 1
24-
#define __LINUX_BITMAP_H 1
25-
#endif
26-
2722
#include <linux/linkage.h>
2823
#include <linux/screen_info.h>
2924
#include <linux/elf.h>
@@ -131,8 +126,8 @@ static void error(char *m);
131126
static struct boot_params *real_mode; /* Pointer to real-mode data */
132127
static int quiet;
133128

134-
static void *memset(void *s, int c, unsigned n);
135-
void *memcpy(void *dest, const void *src, unsigned n);
129+
void *memset(void *s, int c, size_t n);
130+
void *memcpy(void *dest, const void *src, size_t n);
136131

137132
static void __putstr(int, const char *);
138133
#define putstr(__x) __putstr(0, __x)
@@ -223,7 +218,7 @@ static void __putstr(int error, const char *s)
223218
outb(0xff & (pos >> 1), vidport+1);
224219
}
225220

226-
static void *memset(void *s, int c, unsigned n)
221+
void *memset(void *s, int c, size_t n)
227222
{
228223
int i;
229224
char *ss = s;
@@ -233,7 +228,7 @@ static void *memset(void *s, int c, unsigned n)
233228
return s;
234229
}
235230

236-
void *memcpy(void *dest, const void *src, unsigned n)
231+
void *memcpy(void *dest, const void *src, size_t n)
237232
{
238233
int i;
239234
const char *s = src;

arch/x86/include/asm/io_32.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,21 @@
4949
#define xlate_dev_kmem_ptr(p) p
5050

5151
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)
5353
{
5454
memset((void __force *)addr, val, count);
5555
}
5656

5757
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)
5959
{
60-
__memcpy(dst, (const void __force *)src, count);
60+
memcpy(dst, (const void __force *)src, count);
6161
}
6262

6363
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)
6565
{
66-
__memcpy((void __force *)dst, src, count);
66+
memcpy((void __force *)dst, src, count);
6767
}
6868

6969
/*

arch/x86/include/asm/io_64.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef _ASM_X86_IO_64_H
22
#define _ASM_X86_IO_64_H
33

4+
#include <linux/string.h>
5+
#include <linux/compiler.h>
46

57
/*
68
* This file contains the definitions for the x86 IO instructions
@@ -46,20 +48,22 @@
4648
*/
4749
#define xlate_dev_kmem_ptr(p) p
4850

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+
}
5056

51-
void __memcpy_fromio(void *, unsigned long, unsigned);
52-
static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
53-
unsigned len)
57+
static inline void
58+
memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
5459
{
55-
__memcpy_fromio(to, (unsigned long)from, len);
60+
memcpy(dst, (const void __force *)src, count);
5661
}
5762

58-
void __memcpy_toio(unsigned long, const void *, unsigned);
59-
static inline void memcpy_toio(volatile void __iomem *to, const void *from,
60-
unsigned len)
63+
static inline void
64+
memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
6165
{
62-
__memcpy_toio((unsigned long)to, from, len);
66+
memcpy((void __force *)dst, src, count);
6367
}
6468

6569
/*

arch/x86/lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ifneq ($(CONFIG_X86_CMPXCHG64),y)
3434
endif
3535
lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
3636
else
37-
obj-y += io_64.o iomap_copy_64.o
37+
obj-y += iomap_copy_64.o
3838
lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
3939
lib-y += thunk_64.o clear_page_64.o copy_page_64.o
4040
lib-y += memmove_64.o memset_64.o

arch/x86/lib/io_64.c

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)