Skip to content

Commit

Permalink
sh64: Move *_p() I/O routine variants to io.h.
Browse files Browse the repository at this point in the history
These were implemented using an ugly macro for just simple wrapping,
so we just make the wrapping explicit and move it to io.h instead.

Also fixes up some modules:

  CC [M]  drivers/net/8390.o
  In file included from drivers/net/8390.c:6:
  drivers/net/lib8390.c: In function 'ei_start_xmit':
  drivers/net/lib8390.c:329: error: implicit declaration of function 'outb_p'
  drivers/net/lib8390.c: In function '__ei_interrupt':
  drivers/net/lib8390.c:457: error: implicit declaration of function 'inb_p'
  make[2]: *** [drivers/net/8390.o] Error 1
  make[1]: *** [drivers/net] Error 2

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed Oct 1, 2007
1 parent a64314e commit 1ef7cbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
29 changes: 9 additions & 20 deletions arch/sh64/lib/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,11 @@
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <asm/system.h>
#include <asm/processor.h>
#include <asm/io.h>

/*
* readX/writeX() are used to access memory mapped devices. On some
* architectures the memory mapped IO stuff needs to be accessed
* differently. On the SuperH architecture, we just read/write the
* memory location directly.
*/

/* This is horrible at the moment - needs more work to do something sensible */
#define IO_DELAY()

#define OUT_DELAY(x,type) \
void out##x##_p(unsigned type value,unsigned long port){out##x(value,port);IO_DELAY();}

#define IN_DELAY(x,type) \
unsigned type in##x##_p(unsigned long port) {unsigned type tmp=in##x(port);IO_DELAY();return tmp;}

#if 1
OUT_DELAY(b, long) OUT_DELAY(w, long) OUT_DELAY(l, long)
IN_DELAY(b, long) IN_DELAY(w, long) IN_DELAY(l, long)
#endif
/* Now for the string version of these functions */
void outsb(unsigned long port, const void *addr, unsigned long count)
{
Expand All @@ -45,6 +26,7 @@ void outsb(unsigned long port, const void *addr, unsigned long count)
outb(*p, port);
}
}
EXPORT_SYMBOL(outsb);

void insb(unsigned long port, void *addr, unsigned long count)
{
Expand All @@ -55,6 +37,7 @@ void insb(unsigned long port, void *addr, unsigned long count)
*p = inb(port);
}
}
EXPORT_SYMBOL(insb);

/* For the 16 and 32 bit string functions, we have to worry about alignment.
* The SH does not do unaligned accesses, so we have to read as bytes and
Expand All @@ -74,6 +57,7 @@ void outsw(unsigned long port, const void *addr, unsigned long count)
outw(tmp, port);
}
}
EXPORT_SYMBOL(outsw);

void insw(unsigned long port, void *addr, unsigned long count)
{
Expand All @@ -87,6 +71,7 @@ void insw(unsigned long port, void *addr, unsigned long count)
p[1] = (tmp >> 8) & 0xff;
}
}
EXPORT_SYMBOL(insw);

void outsl(unsigned long port, const void *addr, unsigned long count)
{
Expand All @@ -100,6 +85,7 @@ void outsl(unsigned long port, const void *addr, unsigned long count)
outl(tmp, port);
}
}
EXPORT_SYMBOL(outsl);

void insl(unsigned long port, void *addr, unsigned long count)
{
Expand All @@ -116,6 +102,7 @@ void insl(unsigned long port, void *addr, unsigned long count)

}
}
EXPORT_SYMBOL(insl);

void memcpy_toio(void __iomem *to, const void *from, long count)
{
Expand All @@ -126,6 +113,7 @@ void memcpy_toio(void __iomem *to, const void *from, long count)
writeb(*p++, to++);
}
}
EXPORT_SYMBOL(memcpy_toio);

void memcpy_fromio(void *to, void __iomem *from, long count)
{
Expand All @@ -137,3 +125,4 @@ void memcpy_fromio(void *to, void __iomem *from, long count)
from++;
}
}
EXPORT_SYMBOL(memcpy_fromio);
7 changes: 7 additions & 0 deletions include/asm-sh64/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ void insw(unsigned long port, void *addr, unsigned long count);
void outsl(unsigned long port, const void *addr, unsigned long count);
void insl(unsigned long port, void *addr, unsigned long count);

#define inb_p(addr) inb(addr)
#define inw_p(addr) inw(addr)
#define inl_p(addr) inl(addr)
#define outb_p(x,addr) outb(x,addr)
#define outw_p(x,addr) outw(x,addr)
#define outl_p(x,addr) outl(x,addr)

#define __raw_readb readb
#define __raw_readw readw
#define __raw_readl readl
Expand Down

0 comments on commit 1ef7cbb

Please sign in to comment.