From ae5b28a5bb1b5f5d53085a044aec69db41fd0336 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 27 May 2006 01:48:08 -0400 Subject: [PATCH] [PATCH] fix rio_copy_to_card() for OLDPCI case It replaced old rio_pcicopy(). That puppy did _not_ do readb() (unlike rio_memcpy_toio()) and current implementation is simply broken - readb(NULL) is never a valid thing to do. Signed-off-by: Al Viro --- drivers/char/rio/rio_linux.c | 2 +- drivers/char/rio/rio_linux.h | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 8f96b20090..aa43436d5d 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -335,7 +335,7 @@ int RIODelay_ni(struct Port *PortP, int njiffies) void rio_copy_to_card(void *from, void __iomem *to, int len) { - rio_memcpy_toio(NULL, to, from, len); + rio_copy_toio(to, from, len); } int rio_minor(struct tty_struct *tty) diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h index 99c7447b61..55b9c97e84 100644 --- a/drivers/char/rio/rio_linux.h +++ b/drivers/char/rio/rio_linux.h @@ -138,12 +138,23 @@ static inline void __iomem *rio_memcpy_toio(void __iomem *dummy, void __iomem *d while (n--) { writeb(*src++, dst++); - (void) readb(dummy); /* WTF? */ + (void) readb(dummy); } return dest; } +static inline void __iomem *rio_copy_toio(void __iomem *dest, void *source, int n) +{ + char __iomem *dst = dest; + char *src = source; + + while (n--) + writeb(*src++, dst++); + + return dest; +} + static inline void *rio_memcpy_fromio(void *dest, void __iomem *source, int n) { @@ -158,6 +169,7 @@ static inline void *rio_memcpy_fromio(void *dest, void __iomem *source, int n) #else #define rio_memcpy_toio(dummy,dest,source,n) memcpy_toio(dest, source, n) +#define rio_copy_toio memcpy_toio #define rio_memcpy_fromio memcpy_fromio #endif -- 2.11.4.GIT