aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/kernel/io_trapped.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 0bfdc9a34e1a..227547bae548 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -20,7 +20,6 @@
20#include <asm/io_trapped.h> 20#include <asm/io_trapped.h>
21 21
22#define TRAPPED_PAGES_MAX 16 22#define TRAPPED_PAGES_MAX 16
23#define MAX(a, b) (((a) >= (b)) ? (a) : (b))
24 23
25#ifdef CONFIG_HAS_IOPORT 24#ifdef CONFIG_HAS_IOPORT
26LIST_HEAD(trapped_io); 25LIST_HEAD(trapped_io);
@@ -211,7 +210,9 @@ static unsigned long from_device(void *dst, const void *src, unsigned long cnt)
211 if (!src_addr) 210 if (!src_addr)
212 return cnt; 211 return cnt;
213 212
214 tmp = copy_word(src_addr, MAX(cnt, (tiop->minimum_bus_width / 8)), 213 tmp = copy_word(src_addr,
214 max_t(unsigned long, cnt,
215 (tiop->minimum_bus_width / 8)),
215 (unsigned long)dst, cnt); 216 (unsigned long)dst, cnt);
216 217
217 pr_debug("trapped io read 0x%08lx -> 0x%08llx\n", src_addr, tmp); 218 pr_debug("trapped io read 0x%08lx -> 0x%08llx\n", src_addr, tmp);
@@ -233,7 +234,8 @@ static unsigned long to_device(void *dst, const void *src, unsigned long cnt)
233 return cnt; 234 return cnt;
234 235
235 tmp = copy_word((unsigned long)src, cnt, 236 tmp = copy_word((unsigned long)src, cnt,
236 dst_addr, MAX(cnt, (tiop->minimum_bus_width / 8))); 237 dst_addr, max_t(unsigned long, cnt,
238 (tiop->minimum_bus_width / 8)));
237 239
238 pr_debug("trapped io write 0x%08lx -> 0x%08llx\n", dst_addr, tmp); 240 pr_debug("trapped io write 0x%08lx -> 0x%08llx\n", dst_addr, tmp);
239 return 0; 241 return 0;