Skip to content

Commit

Permalink
x86: Clean up mem*io functions.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian Gerst authored and H. Peter Anvin committed Feb 5, 2010
1 parent 2b4df4d commit 6175ddf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 49 deletions.
13 changes: 4 additions & 9 deletions arch/x86/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
#define _ASM_X86_DESC_H 1
#endif

#ifdef CONFIG_X86_64
#define _LINUX_STRING_H_ 1
#define __LINUX_BITMAP_H 1
#endif

#include <linux/linkage.h>
#include <linux/screen_info.h>
#include <linux/elf.h>
Expand Down Expand Up @@ -131,8 +126,8 @@ static void error(char *m);
static struct boot_params *real_mode; /* Pointer to real-mode data */
static int quiet;

static void *memset(void *s, int c, unsigned n);
void *memcpy(void *dest, const void *src, unsigned n);
void *memset(void *s, int c, size_t n);
void *memcpy(void *dest, const void *src, size_t n);

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

static void *memset(void *s, int c, unsigned n)
void *memset(void *s, int c, size_t n)
{
int i;
char *ss = s;
Expand All @@ -233,7 +228,7 @@ static void *memset(void *s, int c, unsigned n)
return s;
}

void *memcpy(void *dest, const void *src, unsigned n)
void *memcpy(void *dest, const void *src, size_t n)
{
int i;
const char *s = src;
Expand Down
10 changes: 5 additions & 5 deletions arch/x86/include/asm/io_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@
#define xlate_dev_kmem_ptr(p) p

static inline void
memset_io(volatile void __iomem *addr, unsigned char val, int count)
memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
{
memset((void __force *)addr, val, count);
}

static inline void
memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
{
__memcpy(dst, (const void __force *)src, count);
memcpy(dst, (const void __force *)src, count);
}

static inline void
memcpy_toio(volatile void __iomem *dst, const void *src, int count)
memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
{
__memcpy((void __force *)dst, src, count);
memcpy((void __force *)dst, src, count);
}

/*
Expand Down
22 changes: 13 additions & 9 deletions arch/x86/include/asm/io_64.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _ASM_X86_IO_64_H
#define _ASM_X86_IO_64_H

#include <linux/string.h>
#include <linux/compiler.h>

/*
* This file contains the definitions for the x86 IO instructions
Expand Down Expand Up @@ -46,20 +48,22 @@
*/
#define xlate_dev_kmem_ptr(p) p

void memset_io(volatile void __iomem *a, int b, size_t c);
static inline void
memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
{
memset((void __force *)addr, val, count);
}

void __memcpy_fromio(void *, unsigned long, unsigned);
static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
unsigned len)
static inline void
memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
{
__memcpy_fromio(to, (unsigned long)from, len);
memcpy(dst, (const void __force *)src, count);
}

void __memcpy_toio(unsigned long, const void *, unsigned);
static inline void memcpy_toio(volatile void __iomem *to, const void *from,
unsigned len)
static inline void
memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
{
__memcpy_toio((unsigned long)to, from, len);
memcpy((void __force *)dst, src, count);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ifneq ($(CONFIG_X86_CMPXCHG64),y)
endif
lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
else
obj-y += io_64.o iomap_copy_64.o
obj-y += iomap_copy_64.o
lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
lib-y += thunk_64.o clear_page_64.o copy_page_64.o
lib-y += memmove_64.o memset_64.o
Expand Down
25 changes: 0 additions & 25 deletions arch/x86/lib/io_64.c

This file was deleted.

0 comments on commit 6175ddf

Please sign in to comment.