Commit 782cf01e authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] m68k I/O

m68k: Use explicit-sized types for I/O accesses
parent a6f199d3
...@@ -120,66 +120,66 @@ extern int isa_sex; ...@@ -120,66 +120,66 @@ extern int isa_sex;
* be compiled in so the case statement will be optimised away * be compiled in so the case statement will be optimised away
*/ */
static inline unsigned char *isa_itb(long addr) static inline u8 *isa_itb(long addr)
{ {
switch(ISA_TYPE) switch(ISA_TYPE)
{ {
#ifdef CONFIG_Q40 #ifdef CONFIG_Q40
case Q40_ISA: return (unsigned char *)Q40_ISA_IO_B(addr); case Q40_ISA: return (u8 *)Q40_ISA_IO_B(addr);
#endif #endif
#ifdef CONFIG_GG2 #ifdef CONFIG_GG2
case GG2_ISA: return (unsigned char *)GG2_ISA_IO_B(addr); case GG2_ISA: return (u8 *)GG2_ISA_IO_B(addr);
#endif #endif
#ifdef CONFIG_AMIGA_PCMCIA #ifdef CONFIG_AMIGA_PCMCIA
case AG_ISA: return (unsigned char *)AG_ISA_IO_B(addr); case AG_ISA: return (u8 *)AG_ISA_IO_B(addr);
#endif #endif
default: return 0; /* avoid warnings, just in case */ default: return 0; /* avoid warnings, just in case */
} }
} }
static inline unsigned short *isa_itw(long addr) static inline u16 *isa_itw(long addr)
{ {
switch(ISA_TYPE) switch(ISA_TYPE)
{ {
#ifdef CONFIG_Q40 #ifdef CONFIG_Q40
case Q40_ISA: return (unsigned short *)Q40_ISA_IO_W(addr); case Q40_ISA: return (u16 *)Q40_ISA_IO_W(addr);
#endif #endif
#ifdef CONFIG_GG2 #ifdef CONFIG_GG2
case GG2_ISA: return (unsigned short *)GG2_ISA_IO_W(addr); case GG2_ISA: return (u16 *)GG2_ISA_IO_W(addr);
#endif #endif
#ifdef CONFIG_AMIGA_PCMCIA #ifdef CONFIG_AMIGA_PCMCIA
case AG_ISA: return (unsigned short *)AG_ISA_IO_W(addr); case AG_ISA: return (u16 *)AG_ISA_IO_W(addr);
#endif #endif
default: return 0; /* avoid warnings, just in case */ default: return 0; /* avoid warnings, just in case */
} }
} }
static inline unsigned char *isa_mtb(long addr) static inline u8 *isa_mtb(long addr)
{ {
switch(ISA_TYPE) switch(ISA_TYPE)
{ {
#ifdef CONFIG_Q40 #ifdef CONFIG_Q40
case Q40_ISA: return (unsigned char *)Q40_ISA_MEM_B(addr); case Q40_ISA: return (u8 *)Q40_ISA_MEM_B(addr);
#endif #endif
#ifdef CONFIG_GG2 #ifdef CONFIG_GG2
case GG2_ISA: return (unsigned char *)GG2_ISA_MEM_B(addr); case GG2_ISA: return (u8 *)GG2_ISA_MEM_B(addr);
#endif #endif
#ifdef CONFIG_AMIGA_PCMCIA #ifdef CONFIG_AMIGA_PCMCIA
case AG_ISA: return (unsigned char *)addr; case AG_ISA: return (u8 *)addr;
#endif #endif
default: return 0; /* avoid warnings, just in case */ default: return 0; /* avoid warnings, just in case */
} }
} }
static inline unsigned short *isa_mtw(long addr) static inline u16 *isa_mtw(long addr)
{ {
switch(ISA_TYPE) switch(ISA_TYPE)
{ {
#ifdef CONFIG_Q40 #ifdef CONFIG_Q40
case Q40_ISA: return (unsigned short *)Q40_ISA_MEM_W(addr); case Q40_ISA: return (u16 *)Q40_ISA_MEM_W(addr);
#endif #endif
#ifdef CONFIG_GG2 #ifdef CONFIG_GG2
case GG2_ISA: return (unsigned short *)GG2_ISA_MEM_W(addr); case GG2_ISA: return (u16 *)GG2_ISA_MEM_W(addr);
#endif #endif
#ifdef CONFIG_AMIGA_PCMCIA #ifdef CONFIG_AMIGA_PCMCIA
case AG_ISA: return (unsigned short *)addr; case AG_ISA: return (u16 *)addr;
#endif #endif
default: return 0; /* avoid warnings, just in case */ default: return 0; /* avoid warnings, just in case */
} }
...@@ -213,7 +213,7 @@ static inline void isa_delay(void) ...@@ -213,7 +213,7 @@ static inline void isa_delay(void)
} }
} }
#define isa_inb_p(p) ({unsigned char v=isa_inb(p);isa_delay();v;}) #define isa_inb_p(p) ({u8 v=isa_inb(p);isa_delay();v;})
#define isa_outb_p(v,p) ({isa_outb((v),(p));isa_delay();}) #define isa_outb_p(v,p) ({isa_outb((v),(p));isa_delay();})
#define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (buf), (nr)) #define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (buf), (nr))
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm/types.h>
/* Values for nocacheflag and cmode */ /* Values for nocacheflag and cmode */
#define IOMAP_FULL_CACHING 0 #define IOMAP_FULL_CACHING 0
...@@ -28,21 +30,21 @@ extern void __iounmap(void *addr, unsigned long size); ...@@ -28,21 +30,21 @@ extern void __iounmap(void *addr, unsigned long size);
* two accesses to memory, which may be undesirable for some devices. * two accesses to memory, which may be undesirable for some devices.
*/ */
#define in_8(addr) \ #define in_8(addr) \
({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; }) ({ u8 __v = (*(volatile u8 *) (addr)); __v; })
#define in_be16(addr) \ #define in_be16(addr) \
({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; }) ({ u16 __v = (*(volatile u16 *) (addr)); __v; })
#define in_be32(addr) \ #define in_be32(addr) \
({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; }) ({ u32 __v = (*(volatile u32 *) (addr)); __v; })
#define in_le16(addr) \ #define in_le16(addr) \
({ unsigned short __v = le16_to_cpu(*(volatile unsigned short *) (addr)); __v; }) ({ u16 __v = le16_to_cpu(*(volatile u16 *) (addr)); __v; })
#define in_le32(addr) \ #define in_le32(addr) \
({ unsigned int __v = le32_to_cpu(*(volatile unsigned int *) (addr)); __v; }) ({ u32 __v = le32_to_cpu(*(volatile u32 *) (addr)); __v; })
#define out_8(addr,b) (void)((*(volatile unsigned char *) (addr)) = (b)) #define out_8(addr,b) (void)((*(volatile u8 *) (addr)) = (b))
#define out_be16(addr,w) (void)((*(volatile unsigned short *) (addr)) = (w)) #define out_be16(addr,w) (void)((*(volatile u16 *) (addr)) = (w))
#define out_be32(addr,l) (void)((*(volatile unsigned int *) (addr)) = (l)) #define out_be32(addr,l) (void)((*(volatile u32 *) (addr)) = (l))
#define out_le16(addr,w) (void)((*(volatile unsigned short *) (addr)) = cpu_to_le16(w)) #define out_le16(addr,w) (void)((*(volatile u16 *) (addr)) = cpu_to_le16(w))
#define out_le32(addr,l) (void)((*(volatile unsigned int *) (addr)) = cpu_to_le32(l)) #define out_le32(addr,l) (void)((*(volatile u32 *) (addr)) = cpu_to_le32(l))
#define raw_inb in_8 #define raw_inb in_8
#define raw_inw in_be16 #define raw_inw in_be16
...@@ -52,8 +54,7 @@ extern void __iounmap(void *addr, unsigned long size); ...@@ -52,8 +54,7 @@ extern void __iounmap(void *addr, unsigned long size);
#define raw_outw(val,port) out_be16((port),(val)) #define raw_outw(val,port) out_be16((port),(val))
#define raw_outl(val,port) out_be32((port),(val)) #define raw_outl(val,port) out_be32((port),(val))
static inline void raw_insb(volatile unsigned char *port, unsigned char *buf, static inline void raw_insb(volatile u8 *port, u8 *buf, unsigned int len)
unsigned int len)
{ {
unsigned int i; unsigned int i;
...@@ -61,8 +62,8 @@ static inline void raw_insb(volatile unsigned char *port, unsigned char *buf, ...@@ -61,8 +62,8 @@ static inline void raw_insb(volatile unsigned char *port, unsigned char *buf,
*buf++ = in_8(port); *buf++ = in_8(port);
} }
static inline void raw_outsb(volatile unsigned char *port, static inline void raw_outsb(volatile u8 *port, const u8 *buf,
const unsigned char *buf, unsigned int len) unsigned int len)
{ {
unsigned int i; unsigned int i;
...@@ -70,8 +71,7 @@ static inline void raw_outsb(volatile unsigned char *port, ...@@ -70,8 +71,7 @@ static inline void raw_outsb(volatile unsigned char *port,
out_8(port, *buf++); out_8(port, *buf++);
} }
static inline void raw_insw(volatile unsigned short *port, unsigned short *buf, static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr)
unsigned int nr)
{ {
unsigned int tmp; unsigned int tmp;
...@@ -110,8 +110,8 @@ static inline void raw_insw(volatile unsigned short *port, unsigned short *buf, ...@@ -110,8 +110,8 @@ static inline void raw_insw(volatile unsigned short *port, unsigned short *buf,
} }
} }
static inline void raw_outsw(volatile unsigned short *port, static inline void raw_outsw(volatile u16 *port, const u16 *buf,
const unsigned short *buf, unsigned int nr) unsigned int nr)
{ {
unsigned int tmp; unsigned int tmp;
...@@ -150,8 +150,7 @@ static inline void raw_outsw(volatile unsigned short *port, ...@@ -150,8 +150,7 @@ static inline void raw_outsw(volatile unsigned short *port,
} }
} }
static inline void raw_insl(volatile unsigned int *port, unsigned int *buf, static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr)
unsigned int nr)
{ {
unsigned int tmp; unsigned int tmp;
...@@ -190,8 +189,8 @@ static inline void raw_insl(volatile unsigned int *port, unsigned int *buf, ...@@ -190,8 +189,8 @@ static inline void raw_insl(volatile unsigned int *port, unsigned int *buf,
} }
} }
static inline void raw_outsl(volatile unsigned int *port, static inline void raw_outsl(volatile u32 *port, const u32 *buf,
const unsigned int *buf, unsigned int nr) unsigned int nr)
{ {
unsigned int tmp; unsigned int tmp;
...@@ -231,8 +230,8 @@ static inline void raw_outsl(volatile unsigned int *port, ...@@ -231,8 +230,8 @@ static inline void raw_outsl(volatile unsigned int *port,
} }
static inline void raw_insw_swapw(volatile unsigned short *port, static inline void raw_insw_swapw(volatile u16 *port, u16 *buf,
unsigned short *buf, unsigned int nr) unsigned int nr)
{ {
if ((nr) % 8) if ((nr) % 8)
__asm__ __volatile__ __asm__ __volatile__
...@@ -284,8 +283,8 @@ static inline void raw_insw_swapw(volatile unsigned short *port, ...@@ -284,8 +283,8 @@ static inline void raw_insw_swapw(volatile unsigned short *port,
: "d0", "a0", "a1", "d6"); : "d0", "a0", "a1", "d6");
} }
static inline void raw_outsw_swapw(volatile unsigned short *port, static inline void raw_outsw_swapw(volatile u16 *port, const u16 *buf,
const unsigned short *buf, unsigned int nr) unsigned int nr)
{ {
if ((nr) % 8) if ((nr) % 8)
__asm__ __volatile__ __asm__ __volatile__
......
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