Commit 5a07d8a0 authored by Hirokazu Takata's avatar Hirokazu Takata Committed by Linus Torvalds

[PATCH] m32r: update ioremap routine

Here is a patch to update ioremap*.c for m32r, taken from "Add __iomem
modifier to the return value type of __ioremap() for much stricter
type-checking."

	* arch/m32r/mm/ioremap.c: ditto.
	- Add __iomem modifier to the return value type of __ioremap()
	  for much stricter type-checking.

	* arch/m32r/mm/ioremap-nommu.c: ditto.

	* include/asm-m32r/io.h:
	- Modified for much stricter type-checking.
	- Change __inline__ to inline.
Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8cc48c03
/* /*
* linux/arch/m32r/mm/io_remap.c * linux/arch/m32r/mm/ioremap-nommu.c
* *
* Copyright (c) 2001, 2002 Hiroyuki Kondo * Copyright (c) 2001, 2002 Hiroyuki Kondo
* *
...@@ -38,14 +38,15 @@ ...@@ -38,14 +38,15 @@
#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) #define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL))
void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) void __iomem *
__ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
{ {
return (void *)phys_addr; return (void *)phys_addr;
} }
#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) #define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1)
void iounmap(void *addr) void iounmap(volatile void __iomem *addr)
{ {
} }
/* /*
* linux/arch/m32r/mm/io_remap.c * linux/arch/m32r/mm/ioremap.c
* *
* Copyright (c) 2001, 2002 Hiroyuki Kondo * Copyright (c) 2001, 2002 Hiroyuki Kondo
* *
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, static inline void
remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
unsigned long phys_addr, unsigned long flags) unsigned long phys_addr, unsigned long flags)
{ {
unsigned long end; unsigned long end;
...@@ -52,7 +53,8 @@ static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned l ...@@ -52,7 +53,8 @@ static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned l
} while (address && (address < end)); } while (address && (address < end));
} }
static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, static inline int
remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
unsigned long phys_addr, unsigned long flags) unsigned long phys_addr, unsigned long flags)
{ {
unsigned long end; unsigned long end;
...@@ -75,7 +77,8 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo ...@@ -75,7 +77,8 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo
return 0; return 0;
} }
static int remap_area_pages(unsigned long address, unsigned long phys_addr, static int
remap_area_pages(unsigned long address, unsigned long phys_addr,
unsigned long size, unsigned long flags) unsigned long size, unsigned long flags)
{ {
int error; int error;
...@@ -122,7 +125,8 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr, ...@@ -122,7 +125,8 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) #define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL))
void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) void __iomem *
__ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
{ {
void __iomem * addr; void __iomem * addr;
struct vm_struct * area; struct vm_struct * area;
...@@ -180,7 +184,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l ...@@ -180,7 +184,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) #define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1)
void iounmap(void *addr) void iounmap(volatile void __iomem *addr)
{ {
if (!IS_KSEG1(addr)) if (!IS_KSEG1(addr))
vfree((void *) (PAGE_MASK & (unsigned long) addr)); vfree((void *) (PAGE_MASK & (unsigned long) addr));
......
#ifndef _ASM_M32R_IO_H #ifndef _ASM_M32R_IO_H
#define _ASM_M32R_IO_H #define _ASM_M32R_IO_H
/* $Id$ */ #include <linux/string.h>
#include <linux/compiler.h>
#include <asm/page.h> /* __va */ #include <asm/page.h> /* __va */
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* this function * this function
*/ */
static __inline__ unsigned long virt_to_phys(volatile void * address) static inline unsigned long virt_to_phys(volatile void * address)
{ {
return __pa(address); return __pa(address);
} }
...@@ -40,12 +40,13 @@ static __inline__ unsigned long virt_to_phys(volatile void * address) ...@@ -40,12 +40,13 @@ static __inline__ unsigned long virt_to_phys(volatile void * address)
* this function * this function
*/ */
static __inline__ void *phys_to_virt(unsigned long address) static inline void *phys_to_virt(unsigned long address)
{ {
return __va(address); return __va(address);
} }
extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); extern void __iomem *
__ioremap(unsigned long offset, unsigned long size, unsigned long flags);
/** /**
* ioremap - map bus memory into CPU space * ioremap - map bus memory into CPU space
...@@ -59,12 +60,12 @@ extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long ...@@ -59,12 +60,12 @@ extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long
* address. * address.
*/ */
static __inline__ void * ioremap(unsigned long offset, unsigned long size) static inline void * ioremap(unsigned long offset, unsigned long size)
{ {
return __ioremap(offset, size, 0); return __ioremap(offset, size, 0);
} }
extern void iounmap(void *addr); extern void iounmap(volatile void __iomem *addr);
#define ioremap_nocache(off,size) ioremap(off,size) #define ioremap_nocache(off,size) ioremap(off,size)
/* /*
...@@ -95,32 +96,32 @@ extern void _outsl(unsigned int, const void *, unsigned long); ...@@ -95,32 +96,32 @@ extern void _outsl(unsigned int, const void *, unsigned long);
static inline unsigned char _readb(unsigned long addr) static inline unsigned char _readb(unsigned long addr)
{ {
return *(volatile unsigned char *)addr; return *(volatile unsigned char __force *)addr;
} }
static inline unsigned short _readw(unsigned long addr) static inline unsigned short _readw(unsigned long addr)
{ {
return *(volatile unsigned short *)addr; return *(volatile unsigned short __force *)addr;
} }
static inline unsigned long _readl(unsigned long addr) static inline unsigned long _readl(unsigned long addr)
{ {
return *(volatile unsigned long *)addr; return *(volatile unsigned long __force *)addr;
} }
static inline void _writeb(unsigned char b, unsigned long addr) static inline void _writeb(unsigned char b, unsigned long addr)
{ {
*(volatile unsigned char *)addr = b; *(volatile unsigned char __force *)addr = b;
} }
static inline void _writew(unsigned short w, unsigned long addr) static inline void _writew(unsigned short w, unsigned long addr)
{ {
*(volatile unsigned short *)addr = w; *(volatile unsigned short __force *)addr = w;
} }
static inline void _writel(unsigned long l, unsigned long addr) static inline void _writel(unsigned long l, unsigned long addr)
{ {
*(volatile unsigned long *)addr = l; *(volatile unsigned long __force *)addr = l;
} }
#define inb _inb #define inb _inb
...@@ -192,9 +193,23 @@ printk("isa_check_signature\n"); ...@@ -192,9 +193,23 @@ printk("isa_check_signature\n");
return retval; return retval;
} }
#define memset_io(a, b, c) memset((void *)(a), (b), (c)) static inline void
#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c)) memset_io(volatile void __iomem *addr, unsigned char val, int count)
#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c)) {
memset((void __force *) addr, val, count);
}
static inline void
memcpy_fromio(void *dst, volatile void __iomem *src, int count)
{
memcpy(dst, (void __force *) src, count);
}
static inline void
memcpy_toio(volatile void __iomem *dst, const void *src, int count)
{
memcpy((void __force *) dst, src, count);
}
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment