aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/smp.c25
-rw-r--r--arch/arm/Kconfig5
-rw-r--r--arch/powerpc/kernel/signal_32.c18
-rw-r--r--arch/powerpc/kernel/signal_64.c4
-rw-r--r--arch/powerpc/platforms/powermac/pci.c89
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/s390/kernel/compat_linux.c83
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--arch/s390/kernel/traps.c2
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/io.c30
10 files changed, 125 insertions, 137 deletions
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 4b873527ce1c..02c2db08114a 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -73,9 +73,6 @@ cpumask_t cpu_online_map;
73 73
74EXPORT_SYMBOL(cpu_online_map); 74EXPORT_SYMBOL(cpu_online_map);
75 75
76/* cpus reported in the hwrpb */
77static unsigned long hwrpb_cpu_present_mask __initdata = 0;
78
79int smp_num_probed; /* Internal processor count */ 76int smp_num_probed; /* Internal processor count */
80int smp_num_cpus = 1; /* Number that came online. */ 77int smp_num_cpus = 1; /* Number that came online. */
81 78
@@ -442,7 +439,7 @@ setup_smp(void)
442 if ((cpu->flags & 0x1cc) == 0x1cc) { 439 if ((cpu->flags & 0x1cc) == 0x1cc) {
443 smp_num_probed++; 440 smp_num_probed++;
444 /* Assume here that "whami" == index */ 441 /* Assume here that "whami" == index */
445 hwrpb_cpu_present_mask |= (1UL << i); 442 cpu_set(i, cpu_possible_map);
446 cpu->pal_revision = boot_cpu_palrev; 443 cpu->pal_revision = boot_cpu_palrev;
447 } 444 }
448 445
@@ -453,12 +450,12 @@ setup_smp(void)
453 } 450 }
454 } else { 451 } else {
455 smp_num_probed = 1; 452 smp_num_probed = 1;
456 hwrpb_cpu_present_mask = (1UL << boot_cpuid); 453 cpu_set(boot_cpuid, cpu_possible_map);
457 } 454 }
458 cpu_present_mask = cpumask_of_cpu(boot_cpuid); 455 cpu_present_mask = cpumask_of_cpu(boot_cpuid);
459 456
460 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", 457 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
461 smp_num_probed, hwrpb_cpu_present_mask); 458 smp_num_probed, cpu_possible_map.bits[0]);
462} 459}
463 460
464/* 461/*
@@ -467,8 +464,6 @@ setup_smp(void)
467void __init 464void __init
468smp_prepare_cpus(unsigned int max_cpus) 465smp_prepare_cpus(unsigned int max_cpus)
469{ 466{
470 int cpu_count, i;
471
472 /* Take care of some initial bookkeeping. */ 467 /* Take care of some initial bookkeeping. */
473 memset(ipi_data, 0, sizeof(ipi_data)); 468 memset(ipi_data, 0, sizeof(ipi_data));
474 469
@@ -486,19 +481,7 @@ smp_prepare_cpus(unsigned int max_cpus)
486 481
487 printk(KERN_INFO "SMP starting up secondaries.\n"); 482 printk(KERN_INFO "SMP starting up secondaries.\n");
488 483
489 cpu_count = 1; 484 smp_num_cpus = smp_num_probed;
490 for (i = 0; (i < NR_CPUS) && (cpu_count < max_cpus); i++) {
491 if (i == boot_cpuid)
492 continue;
493
494 if (((hwrpb_cpu_present_mask >> i) & 1) == 0)
495 continue;
496
497 cpu_set(i, cpu_possible_map);
498 cpu_count++;
499 }
500
501 smp_num_cpus = cpu_count;
502} 485}
503 486
504void __devinit 487void __devinit
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5959e36c3b4c..4a63a8e2e452 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -69,6 +69,9 @@ config GENERIC_ISA_DMA
69config FIQ 69config FIQ
70 bool 70 bool
71 71
72config ARCH_MTD_XIP
73 bool
74
72source "init/Kconfig" 75source "init/Kconfig"
73 76
74menu "System Type" 77menu "System Type"
@@ -136,6 +139,7 @@ config ARCH_L7200
136 139
137config ARCH_PXA 140config ARCH_PXA
138 bool "PXA2xx-based" 141 bool "PXA2xx-based"
142 select ARCH_MTD_XIP
139 143
140config ARCH_RPC 144config ARCH_RPC
141 bool "RiscPC" 145 bool "RiscPC"
@@ -152,6 +156,7 @@ config ARCH_SA1100
152 bool "SA1100-based" 156 bool "SA1100-based"
153 select ISA 157 select ISA
154 select ARCH_DISCONTIGMEM_ENABLE 158 select ARCH_DISCONTIGMEM_ENABLE
159 select ARCH_MTD_XIP
155 160
156config ARCH_S3C2410 161config ARCH_S3C2410
157 bool "Samsung S3C2410" 162 bool "Samsung S3C2410"
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index c6d0595da6b5..bd837b5dbf06 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -142,11 +142,7 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
142 return 0; 142 return 0;
143} 143}
144 144
145static inline compat_uptr_t to_user_ptr(void *kp) 145#define to_user_ptr(p) ptr_to_compat(p)
146{
147 return (compat_uptr_t)(u64)kp;
148}
149
150#define from_user_ptr(p) compat_ptr(p) 146#define from_user_ptr(p) compat_ptr(p)
151 147
152static inline int save_general_regs(struct pt_regs *regs, 148static inline int save_general_regs(struct pt_regs *regs,
@@ -213,8 +209,8 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
213 return 0; 209 return 0;
214} 210}
215 211
216#define to_user_ptr(p) (p) 212#define to_user_ptr(p) ((unsigned long)(p))
217#define from_user_ptr(p) (p) 213#define from_user_ptr(p) ((void __user *)(p))
218 214
219static inline int save_general_regs(struct pt_regs *regs, 215static inline int save_general_regs(struct pt_regs *regs,
220 struct mcontext __user *frame) 216 struct mcontext __user *frame)
@@ -526,7 +522,7 @@ long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
526 522
527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 523 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
528 if (!ret && oact) { 524 if (!ret && oact) {
529 ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler); 525 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask); 526 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 527 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
532 } 528 }
@@ -675,8 +671,8 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
675int compat_sys_sigaltstack(u32 __new, u32 __old, int r5, 671int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
676 int r6, int r7, int r8, struct pt_regs *regs) 672 int r6, int r7, int r8, struct pt_regs *regs)
677{ 673{
678 stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; 674 stack_32_t __user * newstack = compat_ptr(__new);
679 stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; 675 stack_32_t __user * oldstack = compat_ptr(__old);
680 stack_t uss, uoss; 676 stack_t uss, uoss;
681 int ret; 677 int ret;
682 mm_segment_t old_fs; 678 mm_segment_t old_fs;
@@ -708,7 +704,7 @@ int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
708 set_fs(old_fs); 704 set_fs(old_fs);
709 /* Copy the stack information to the user output buffer */ 705 /* Copy the stack information to the user output buffer */
710 if (!ret && oldstack && 706 if (!ret && oldstack &&
711 (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || 707 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
712 __put_user(uoss.ss_flags, &oldstack->ss_flags) || 708 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
713 __put_user(uoss.ss_size, &oldstack->ss_size))) 709 __put_user(uoss.ss_size, &oldstack->ss_size)))
714 return -EFAULT; 710 return -EFAULT;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index b3193116e686..497a5d3df359 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -60,8 +60,8 @@ struct rt_sigframe {
60 struct ucontext uc; 60 struct ucontext uc;
61 unsigned long _unused[2]; 61 unsigned long _unused[2];
62 unsigned int tramp[TRAMP_SIZE]; 62 unsigned int tramp[TRAMP_SIZE];
63 struct siginfo *pinfo; 63 struct siginfo __user *pinfo;
64 void *puc; 64 void __user *puc;
65 struct siginfo info; 65 struct siginfo info;
66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ 66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */
67 char abigap[288]; 67 char abigap[288];
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f671ed253901..de3f30e6b333 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -136,14 +136,14 @@ static void __init fixup_bus_range(struct device_node *bridge)
136 |(((unsigned int)(off)) & 0xFCUL) \ 136 |(((unsigned int)(off)) & 0xFCUL) \
137 |1UL) 137 |1UL)
138 138
139static unsigned long macrisc_cfg_access(struct pci_controller* hose, 139static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose,
140 u8 bus, u8 dev_fn, u8 offset) 140 u8 bus, u8 dev_fn, u8 offset)
141{ 141{
142 unsigned int caddr; 142 unsigned int caddr;
143 143
144 if (bus == hose->first_busno) { 144 if (bus == hose->first_busno) {
145 if (dev_fn < (11 << 3)) 145 if (dev_fn < (11 << 3))
146 return 0; 146 return NULL;
147 caddr = MACRISC_CFA0(dev_fn, offset); 147 caddr = MACRISC_CFA0(dev_fn, offset);
148 } else 148 } else
149 caddr = MACRISC_CFA1(bus, dev_fn, offset); 149 caddr = MACRISC_CFA1(bus, dev_fn, offset);
@@ -154,14 +154,14 @@ static unsigned long macrisc_cfg_access(struct pci_controller* hose,
154 } while (in_le32(hose->cfg_addr) != caddr); 154 } while (in_le32(hose->cfg_addr) != caddr);
155 155
156 offset &= has_uninorth ? 0x07 : 0x03; 156 offset &= has_uninorth ? 0x07 : 0x03;
157 return ((unsigned long)hose->cfg_data) + offset; 157 return hose->cfg_data + offset;
158} 158}
159 159
160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
161 int offset, int len, u32 *val) 161 int offset, int len, u32 *val)
162{ 162{
163 struct pci_controller *hose; 163 struct pci_controller *hose;
164 unsigned long addr; 164 volatile void __iomem *addr;
165 165
166 hose = pci_bus_to_host(bus); 166 hose = pci_bus_to_host(bus);
167 if (hose == NULL) 167 if (hose == NULL)
@@ -177,13 +177,13 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
177 */ 177 */
178 switch (len) { 178 switch (len) {
179 case 1: 179 case 1:
180 *val = in_8((u8 *)addr); 180 *val = in_8(addr);
181 break; 181 break;
182 case 2: 182 case 2:
183 *val = in_le16((u16 *)addr); 183 *val = in_le16(addr);
184 break; 184 break;
185 default: 185 default:
186 *val = in_le32((u32 *)addr); 186 *val = in_le32(addr);
187 break; 187 break;
188 } 188 }
189 return PCIBIOS_SUCCESSFUL; 189 return PCIBIOS_SUCCESSFUL;
@@ -193,7 +193,7 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
193 int offset, int len, u32 val) 193 int offset, int len, u32 val)
194{ 194{
195 struct pci_controller *hose; 195 struct pci_controller *hose;
196 unsigned long addr; 196 volatile void __iomem *addr;
197 197
198 hose = pci_bus_to_host(bus); 198 hose = pci_bus_to_host(bus);
199 if (hose == NULL) 199 if (hose == NULL)
@@ -209,16 +209,16 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
209 */ 209 */
210 switch (len) { 210 switch (len) {
211 case 1: 211 case 1:
212 out_8((u8 *)addr, val); 212 out_8(addr, val);
213 (void) in_8((u8 *)addr); 213 (void) in_8(addr);
214 break; 214 break;
215 case 2: 215 case 2:
216 out_le16((u16 *)addr, val); 216 out_le16(addr, val);
217 (void) in_le16((u16 *)addr); 217 (void) in_le16(addr);
218 break; 218 break;
219 default: 219 default:
220 out_le32((u32 *)addr, val); 220 out_le32(addr, val);
221 (void) in_le32((u32 *)addr); 221 (void) in_le32(addr);
222 break; 222 break;
223 } 223 }
224 return PCIBIOS_SUCCESSFUL; 224 return PCIBIOS_SUCCESSFUL;
@@ -348,25 +348,23 @@ static int u3_ht_skip_device(struct pci_controller *hose,
348 + (((unsigned int)bus) << 16) \ 348 + (((unsigned int)bus) << 16) \
349 + 0x01000000UL) 349 + 0x01000000UL)
350 350
351static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 351static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose,
352 u8 bus, u8 devfn, u8 offset) 352 u8 bus, u8 devfn, u8 offset)
353{ 353{
354 if (bus == hose->first_busno) { 354 if (bus == hose->first_busno) {
355 /* For now, we don't self probe U3 HT bridge */ 355 /* For now, we don't self probe U3 HT bridge */
356 if (PCI_SLOT(devfn) == 0) 356 if (PCI_SLOT(devfn) == 0)
357 return 0; 357 return NULL;
358 return ((unsigned long)hose->cfg_data) + 358 return hose->cfg_data + U3_HT_CFA0(devfn, offset);
359 U3_HT_CFA0(devfn, offset);
360 } else 359 } else
361 return ((unsigned long)hose->cfg_data) + 360 return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
362 U3_HT_CFA1(bus, devfn, offset);
363} 361}
364 362
365static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 363static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
366 int offset, int len, u32 *val) 364 int offset, int len, u32 *val)
367{ 365{
368 struct pci_controller *hose; 366 struct pci_controller *hose;
369 unsigned long addr; 367 volatile void __iomem *addr;
370 368
371 hose = pci_bus_to_host(bus); 369 hose = pci_bus_to_host(bus);
372 if (hose == NULL) 370 if (hose == NULL)
@@ -400,13 +398,13 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
400 */ 398 */
401 switch (len) { 399 switch (len) {
402 case 1: 400 case 1:
403 *val = in_8((u8 *)addr); 401 *val = in_8(addr);
404 break; 402 break;
405 case 2: 403 case 2:
406 *val = in_le16((u16 *)addr); 404 *val = in_le16(addr);
407 break; 405 break;
408 default: 406 default:
409 *val = in_le32((u32 *)addr); 407 *val = in_le32(addr);
410 break; 408 break;
411 } 409 }
412 return PCIBIOS_SUCCESSFUL; 410 return PCIBIOS_SUCCESSFUL;
@@ -416,7 +414,7 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
416 int offset, int len, u32 val) 414 int offset, int len, u32 val)
417{ 415{
418 struct pci_controller *hose; 416 struct pci_controller *hose;
419 unsigned long addr; 417 volatile void __iomem *addr;
420 418
421 hose = pci_bus_to_host(bus); 419 hose = pci_bus_to_host(bus);
422 if (hose == NULL) 420 if (hose == NULL)
@@ -442,16 +440,16 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
442 */ 440 */
443 switch (len) { 441 switch (len) {
444 case 1: 442 case 1:
445 out_8((u8 *)addr, val); 443 out_8(addr, val);
446 (void) in_8((u8 *)addr); 444 (void) in_8(addr);
447 break; 445 break;
448 case 2: 446 case 2:
449 out_le16((u16 *)addr, val); 447 out_le16(addr, val);
450 (void) in_le16((u16 *)addr); 448 (void) in_le16(addr);
451 break; 449 break;
452 default: 450 default:
453 out_le32((u32 *)addr, val); 451 out_le32((u32 __iomem *)addr, val);
454 (void) in_le32((u32 *)addr); 452 (void) in_le32(addr);
455 break; 453 break;
456 } 454 }
457 return PCIBIOS_SUCCESSFUL; 455 return PCIBIOS_SUCCESSFUL;
@@ -476,7 +474,7 @@ static struct pci_ops u3_ht_pci_ops =
476 |(((unsigned int)(off)) & 0xfcU) \ 474 |(((unsigned int)(off)) & 0xfcU) \
477 |1UL) 475 |1UL)
478 476
479static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, 477static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose,
480 u8 bus, u8 dev_fn, int offset) 478 u8 bus, u8 dev_fn, int offset)
481{ 479{
482 unsigned int caddr; 480 unsigned int caddr;
@@ -492,14 +490,14 @@ static unsigned long u4_pcie_cfg_access(struct pci_controller* hose,
492 } while (in_le32(hose->cfg_addr) != caddr); 490 } while (in_le32(hose->cfg_addr) != caddr);
493 491
494 offset &= 0x03; 492 offset &= 0x03;
495 return ((unsigned long)hose->cfg_data) + offset; 493 return hose->cfg_data + offset;
496} 494}
497 495
498static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 496static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
499 int offset, int len, u32 *val) 497 int offset, int len, u32 *val)
500{ 498{
501 struct pci_controller *hose; 499 struct pci_controller *hose;
502 unsigned long addr; 500 volatile void __iomem *addr;
503 501
504 hose = pci_bus_to_host(bus); 502 hose = pci_bus_to_host(bus);
505 if (hose == NULL) 503 if (hose == NULL)
@@ -515,13 +513,13 @@ static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
515 */ 513 */
516 switch (len) { 514 switch (len) {
517 case 1: 515 case 1:
518 *val = in_8((u8 *)addr); 516 *val = in_8(addr);
519 break; 517 break;
520 case 2: 518 case 2:
521 *val = in_le16((u16 *)addr); 519 *val = in_le16(addr);
522 break; 520 break;
523 default: 521 default:
524 *val = in_le32((u32 *)addr); 522 *val = in_le32(addr);
525 break; 523 break;
526 } 524 }
527 return PCIBIOS_SUCCESSFUL; 525 return PCIBIOS_SUCCESSFUL;
@@ -531,7 +529,7 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
531 int offset, int len, u32 val) 529 int offset, int len, u32 val)
532{ 530{
533 struct pci_controller *hose; 531 struct pci_controller *hose;
534 unsigned long addr; 532 volatile void __iomem *addr;
535 533
536 hose = pci_bus_to_host(bus); 534 hose = pci_bus_to_host(bus);
537 if (hose == NULL) 535 if (hose == NULL)
@@ -547,16 +545,16 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
547 */ 545 */
548 switch (len) { 546 switch (len) {
549 case 1: 547 case 1:
550 out_8((u8 *)addr, val); 548 out_8(addr, val);
551 (void) in_8((u8 *)addr); 549 (void) in_8(addr);
552 break; 550 break;
553 case 2: 551 case 2:
554 out_le16((u16 *)addr, val); 552 out_le16(addr, val);
555 (void) in_le16((u16 *)addr); 553 (void) in_le16(addr);
556 break; 554 break;
557 default: 555 default:
558 out_le32((u32 *)addr, val); 556 out_le32(addr, val);
559 (void) in_le32((u32 *)addr); 557 (void) in_le32(addr);
560 break; 558 break;
561 } 559 }
562 return PCIBIOS_SUCCESSFUL; 560 return PCIBIOS_SUCCESSFUL;
@@ -773,8 +771,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
773 * the reg address cell, we shall fix that by killing struct 771 * the reg address cell, we shall fix that by killing struct
774 * reg_property and using some accessor functions instead 772 * reg_property and using some accessor functions instead
775 */ 773 */
776 hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 774 hose->cfg_data = ioremap(0xf2000000, 0x02000000);
777 0x02000000);
778 775
779 /* 776 /*
780 * /ht node doesn't expose a "ranges" property, so we "remove" 777 * /ht node doesn't expose a "ranges" property, so we "remove"
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 977de9db8754..6298264efe36 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -59,7 +59,7 @@ static unsigned long dart_tablesize;
59static u32 *dart_vbase; 59static u32 *dart_vbase;
60 60
61/* Mapped base address for the dart */ 61/* Mapped base address for the dart */
62static unsigned int *__iomem dart; 62static unsigned int __iomem *dart;
63 63
64/* Dummy val that entries are set to when unused */ 64/* Dummy val that entries are set to when unused */
65static unsigned int dart_emptyval; 65static unsigned int dart_emptyval;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index bf9a7a361b34..cc20f0e3a7d3 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -100,12 +100,12 @@
100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
102 102
103asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) 103asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
104{ 104{
105 return sys_chown(filename, low2highuid(user), low2highgid(group)); 105 return sys_chown(filename, low2highuid(user), low2highgid(group));
106} 106}
107 107
108asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) 108asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
109{ 109{
110 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 110 return sys_lchown(filename, low2highuid(user), low2highgid(group));
111} 111}
@@ -141,7 +141,7 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
141 low2highuid(suid)); 141 low2highuid(suid));
142} 142}
143 143
144asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) 144asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
145{ 145{
146 int retval; 146 int retval;
147 147
@@ -158,7 +158,7 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
158 low2highgid(sgid)); 158 low2highgid(sgid));
159} 159}
160 160
161asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) 161asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
162{ 162{
163 int retval; 163 int retval;
164 164
@@ -179,7 +179,7 @@ asmlinkage long sys32_setfsgid16(u16 gid)
179 return sys_setfsgid((gid_t)gid); 179 return sys_setfsgid((gid_t)gid);
180} 180}
181 181
182static int groups16_to_user(u16 *grouplist, struct group_info *group_info) 182static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
183{ 183{
184 int i; 184 int i;
185 u16 group; 185 u16 group;
@@ -193,7 +193,7 @@ static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
193 return 0; 193 return 0;
194} 194}
195 195
196static int groups16_from_user(struct group_info *group_info, u16 *grouplist) 196static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
197{ 197{
198 int i; 198 int i;
199 u16 group; 199 u16 group;
@@ -207,7 +207,7 @@ static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
207 return 0; 207 return 0;
208} 208}
209 209
210asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) 210asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
211{ 211{
212 int i; 212 int i;
213 213
@@ -231,7 +231,7 @@ out:
231 return i; 231 return i;
232} 232}
233 233
234asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) 234asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
235{ 235{
236 struct group_info *group_info; 236 struct group_info *group_info;
237 int retval; 237 int retval;
@@ -278,14 +278,14 @@ asmlinkage long sys32_getegid16(void)
278 278
279/* 32-bit timeval and related flotsam. */ 279/* 32-bit timeval and related flotsam. */
280 280
281static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
282{ 282{
283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) || 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
284 (__get_user(o->tv_sec, &i->tv_sec) || 284 (__get_user(o->tv_sec, &i->tv_sec) ||
285 __get_user(o->tv_usec, &i->tv_usec))); 285 __get_user(o->tv_usec, &i->tv_usec)));
286} 286}
287 287
288static inline long put_tv32(struct compat_timeval *o, struct timeval *i) 288static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
289{ 289{
290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
291 (__put_user(i->tv_sec, &o->tv_sec) || 291 (__put_user(i->tv_sec, &o->tv_sec) ||
@@ -341,7 +341,7 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
341 return -ENOSYS; 341 return -ENOSYS;
342} 342}
343 343
344asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low) 344asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
345{ 345{
346 if ((int)high < 0) 346 if ((int)high < 0)
347 return -EINVAL; 347 return -EINVAL;
@@ -357,7 +357,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
357 return sys_ftruncate(fd, (high << 32) | low); 357 return sys_ftruncate(fd, (high << 32) | low);
358} 358}
359 359
360int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 360int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
361{ 361{
362 int err; 362 int err;
363 363
@@ -591,7 +591,7 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
591 591
592extern struct timezone sys_tz; 592extern struct timezone sys_tz;
593 593
594asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 594asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
595{ 595{
596 if (tv) { 596 if (tv) {
597 struct timeval ktv; 597 struct timeval ktv;
@@ -606,7 +606,7 @@ asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *t
606 return 0; 606 return 0;
607} 607}
608 608
609static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 609static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
610{ 610{
611 long usec; 611 long usec;
612 612
@@ -620,7 +620,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
620 return 0; 620 return 0;
621} 621}
622 622
623asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 623asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
624{ 624{
625 struct timespec kts; 625 struct timespec kts;
626 struct timezone ktz; 626 struct timezone ktz;
@@ -645,7 +645,7 @@ asmlinkage long sys32_pause(void)
645 return -ERESTARTNOHAND; 645 return -ERESTARTNOHAND;
646} 646}
647 647
648asmlinkage long sys32_pread64(unsigned int fd, char *ubuf, 648asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
649 size_t count, u32 poshi, u32 poslo) 649 size_t count, u32 poshi, u32 poslo)
650{ 650{
651 if ((compat_ssize_t) count < 0) 651 if ((compat_ssize_t) count < 0)
@@ -653,7 +653,7 @@ asmlinkage long sys32_pread64(unsigned int fd, char *ubuf,
653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
654} 654}
655 655
656asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf, 656asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
657 size_t count, u32 poshi, u32 poslo) 657 size_t count, u32 poshi, u32 poslo)
658{ 658{
659 if ((compat_ssize_t) count < 0) 659 if ((compat_ssize_t) count < 0)
@@ -666,7 +666,7 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
667} 667}
668 668
669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count) 669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
670{ 670{
671 mm_segment_t old_fs = get_fs(); 671 mm_segment_t old_fs = get_fs();
672 int ret; 672 int ret;
@@ -686,7 +686,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
686} 686}
687 687
688asmlinkage long sys32_sendfile64(int out_fd, int in_fd, 688asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
689 compat_loff_t *offset, s32 count) 689 compat_loff_t __user *offset, s32 count)
690{ 690{
691 mm_segment_t old_fs = get_fs(); 691 mm_segment_t old_fs = get_fs();
692 int ret; 692 int ret;
@@ -722,7 +722,7 @@ struct timex32 {
722 722
723extern int do_adjtimex(struct timex *); 723extern int do_adjtimex(struct timex *);
724 724
725asmlinkage long sys32_adjtimex(struct timex32 *utp) 725asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
726{ 726{
727 struct timex txc; 727 struct timex txc;
728 int ret; 728 int ret;
@@ -789,12 +789,13 @@ struct __sysctl_args32 {
789 u32 __unused[4]; 789 u32 __unused[4];
790}; 790};
791 791
792asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) 792asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
793{ 793{
794 struct __sysctl_args32 tmp; 794 struct __sysctl_args32 tmp;
795 int error; 795 int error;
796 size_t oldlen, *oldlenp = NULL; 796 size_t oldlen;
797 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 797 size_t __user *oldlenp = NULL;
798 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
798 799
799 if (copy_from_user(&tmp, args, sizeof(tmp))) 800 if (copy_from_user(&tmp, args, sizeof(tmp)))
800 return -EFAULT; 801 return -EFAULT;
@@ -806,20 +807,20 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
806 basically copy the whole sysctl.c here, and 807 basically copy the whole sysctl.c here, and
807 glibc's __sysctl uses rw memory for the structure 808 glibc's __sysctl uses rw memory for the structure
808 anyway. */ 809 anyway. */
809 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 810 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
810 put_user(oldlen, (size_t *)addr)) 811 put_user(oldlen, (size_t __user *)addr))
811 return -EFAULT; 812 return -EFAULT;
812 oldlenp = (size_t *)addr; 813 oldlenp = (size_t __user *)addr;
813 } 814 }
814 815
815 lock_kernel(); 816 lock_kernel();
816 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 817 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
817 oldlenp, (void *)A(tmp.newval), tmp.newlen); 818 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
818 unlock_kernel(); 819 unlock_kernel();
819 if (oldlenp) { 820 if (oldlenp) {
820 if (!error) { 821 if (!error) {
821 if (get_user(oldlen, (size_t *)addr) || 822 if (get_user(oldlen, (size_t __user *)addr) ||
822 put_user(oldlen, (u32 *)A(tmp.oldlenp))) 823 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
823 error = -EFAULT; 824 error = -EFAULT;
824 } 825 }
825 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 826 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -853,7 +854,7 @@ struct stat64_emu31 {
853 unsigned long st_ino; 854 unsigned long st_ino;
854}; 855};
855 856
856static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat) 857static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
857{ 858{
858 struct stat64_emu31 tmp; 859 struct stat64_emu31 tmp;
859 860
@@ -877,7 +878,7 @@ static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat)
877 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 878 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
878} 879}
879 880
880asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf) 881asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf)
881{ 882{
882 struct kstat stat; 883 struct kstat stat;
883 int ret = vfs_stat(filename, &stat); 884 int ret = vfs_stat(filename, &stat);
@@ -886,7 +887,7 @@ asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf)
886 return ret; 887 return ret;
887} 888}
888 889
889asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf) 890asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf)
890{ 891{
891 struct kstat stat; 892 struct kstat stat;
892 int ret = vfs_lstat(filename, &stat); 893 int ret = vfs_lstat(filename, &stat);
@@ -895,7 +896,7 @@ asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf)
895 return ret; 896 return ret;
896} 897}
897 898
898asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf) 899asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf)
899{ 900{
900 struct kstat stat; 901 struct kstat stat;
901 int ret = vfs_fstat(fd, &stat); 902 int ret = vfs_fstat(fd, &stat);
@@ -952,7 +953,7 @@ out:
952 953
953 954
954asmlinkage unsigned long 955asmlinkage unsigned long
955old32_mmap(struct mmap_arg_struct_emu31 *arg) 956old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
956{ 957{
957 struct mmap_arg_struct_emu31 a; 958 struct mmap_arg_struct_emu31 a;
958 int error = -EFAULT; 959 int error = -EFAULT;
@@ -970,7 +971,7 @@ out:
970} 971}
971 972
972asmlinkage long 973asmlinkage long
973sys32_mmap2(struct mmap_arg_struct_emu31 *arg) 974sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
974{ 975{
975 struct mmap_arg_struct_emu31 a; 976 struct mmap_arg_struct_emu31 a;
976 int error = -EFAULT; 977 int error = -EFAULT;
@@ -982,7 +983,7 @@ out:
982 return error; 983 return error;
983} 984}
984 985
985asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count) 986asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
986{ 987{
987 if ((compat_ssize_t) count < 0) 988 if ((compat_ssize_t) count < 0)
988 return -EINVAL; 989 return -EINVAL;
@@ -990,7 +991,7 @@ asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count)
990 return sys_read(fd, buf, count); 991 return sys_read(fd, buf, count);
991} 992}
992 993
993asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count) 994asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
994{ 995{
995 if ((compat_ssize_t) count < 0) 996 if ((compat_ssize_t) count < 0)
996 return -EINVAL; 997 return -EINVAL;
@@ -1002,12 +1003,12 @@ asmlinkage long sys32_clone(struct pt_regs regs)
1002{ 1003{
1003 unsigned long clone_flags; 1004 unsigned long clone_flags;
1004 unsigned long newsp; 1005 unsigned long newsp;
1005 int *parent_tidptr, *child_tidptr; 1006 int __user *parent_tidptr, *child_tidptr;
1006 1007
1007 clone_flags = regs.gprs[3] & 0xffffffffUL; 1008 clone_flags = regs.gprs[3] & 0xffffffffUL;
1008 newsp = regs.orig_gpr2 & 0x7fffffffUL; 1009 newsp = regs.orig_gpr2 & 0x7fffffffUL;
1009 parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); 1010 parent_tidptr = compat_ptr(regs.gprs[4]);
1010 child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); 1011 child_tidptr = compat_ptr(regs.gprs[5]);
1011 if (!newsp) 1012 if (!newsp)
1012 newsp = regs.gprs[15]; 1013 newsp = regs.gprs[15];
1013 return do_fork(clone_flags, newsp, &regs, 0, 1014 return do_fork(clone_flags, newsp, &regs, 0,
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 6a63553493c5..e351780bb660 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -122,8 +122,8 @@ out:
122#ifndef CONFIG_64BIT 122#ifndef CONFIG_64BIT
123struct sel_arg_struct { 123struct sel_arg_struct {
124 unsigned long n; 124 unsigned long n;
125 fd_set *inp, *outp, *exp; 125 fd_set __user *inp, *outp, *exp;
126 struct timeval *tvp; 126 struct timeval __user *tvp;
127}; 127};
128 128
129asmlinkage long old_select(struct sel_arg_struct __user *arg) 129asmlinkage long old_select(struct sel_arg_struct __user *arg)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5d21e9e6e7b4..a46793beeddd 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -486,7 +486,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
486 info.si_signo = signal; 486 info.si_signo = signal;
487 info.si_errno = 0; 487 info.si_errno = 0;
488 info.si_code = ILL_ILLOPC; 488 info.si_code = ILL_ILLOPC;
489 info.si_addr = (void *) location; 489 info.si_addr = (void __user *) location;
490 do_trap(interruption_code, signal, 490 do_trap(interruption_code, signal,
491 "illegal operation", regs, &info); 491 "illegal operation", regs, &info);
492 } 492 }
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c
index c46f9154cfd5..123abbbc91e0 100644
--- a/arch/sh/boards/renesas/rts7751r2d/io.c
+++ b/arch/sh/boards/renesas/rts7751r2d/io.c
@@ -216,24 +216,26 @@ void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count)
216{ 216{
217 volatile __u8 *bp; 217 volatile __u8 *bp;
218 volatile __u16 *p; 218 volatile __u16 *p;
219 unsigned char *s = addr;
219 220
220 if (CHECK_AX88796L_PORT(port)) { 221 if (CHECK_AX88796L_PORT(port)) {
221 p = (volatile unsigned short *)port88796l(port, 0); 222 p = (volatile unsigned short *)port88796l(port, 0);
222 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 223 while (count--) *s++ = *p & 0xff;
223 } else if (PXSEG(port)) 224 } else if (PXSEG(port))
224 while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; 225 while (count--) *s++ = *(volatile unsigned char *)port;
225 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 226 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
226 bp = (__u8 *)PCI_IOMAP(port); 227 bp = (__u8 *)PCI_IOMAP(port);
227 while (count--) *((volatile unsigned char *) addr)++ = *bp; 228 while (count--) *s++ = *bp;
228 } else { 229 } else {
229 p = (volatile unsigned short *)port2adr(port); 230 p = (volatile unsigned short *)port2adr(port);
230 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 231 while (count--) *s++ = *p & 0xff;
231 } 232 }
232} 233}
233 234
234void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) 235void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
235{ 236{
236 volatile __u16 *p; 237 volatile __u16 *p;
238 __u16 *s = addr;
237 239
238 if (CHECK_AX88796L_PORT(port)) 240 if (CHECK_AX88796L_PORT(port))
239 p = (volatile unsigned short *)port88796l(port, 1); 241 p = (volatile unsigned short *)port88796l(port, 1);
@@ -243,7 +245,7 @@ void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
243 p = (volatile unsigned short *)PCI_IOMAP(port); 245 p = (volatile unsigned short *)PCI_IOMAP(port);
244 else 246 else
245 p = (volatile unsigned short *)port2adr(port); 247 p = (volatile unsigned short *)port2adr(port);
246 while (count--) *((__u16 *) addr)++ = *p; 248 while (count--) *s++ = *p;
247} 249}
248 250
249void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) 251void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
@@ -252,8 +254,9 @@ void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
252 maybebadio(insl, port); 254 maybebadio(insl, port);
253 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 255 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
254 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 256 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
257 __u32 *s = addr;
255 258
256 while (count--) *((__u32 *) addr)++ = *p; 259 while (count--) *s++ = *p;
257 } else 260 } else
258 maybebadio(insl, port); 261 maybebadio(insl, port);
259} 262}
@@ -262,24 +265,26 @@ void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count)
262{ 265{
263 volatile __u8 *bp; 266 volatile __u8 *bp;
264 volatile __u16 *p; 267 volatile __u16 *p;
268 const __u8 *s = addr;
265 269
266 if (CHECK_AX88796L_PORT(port)) { 270 if (CHECK_AX88796L_PORT(port)) {
267 p = (volatile unsigned short *)port88796l(port, 0); 271 p = (volatile unsigned short *)port88796l(port, 0);
268 while (count--) *p = *((unsigned char *) addr)++; 272 while (count--) *p = *s++;
269 } else if (PXSEG(port)) 273 } else if (PXSEG(port))
270 while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; 274 while (count--) *(volatile unsigned char *)port = *s++;
271 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 275 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
272 bp = (__u8 *)PCI_IOMAP(port); 276 bp = (__u8 *)PCI_IOMAP(port);
273 while (count--) *bp = *((volatile unsigned char *) addr)++; 277 while (count--) *bp = *s++;
274 } else { 278 } else {
275 p = (volatile unsigned short *)port2adr(port); 279 p = (volatile unsigned short *)port2adr(port);
276 while (count--) *p = *((unsigned char *) addr)++; 280 while (count--) *p = *s++;
277 } 281 }
278} 282}
279 283
280void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) 284void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
281{ 285{
282 volatile __u16 *p; 286 volatile __u16 *p;
287 const __u16 *s = addr;
283 288
284 if (CHECK_AX88796L_PORT(port)) 289 if (CHECK_AX88796L_PORT(port))
285 p = (volatile unsigned short *)port88796l(port, 1); 290 p = (volatile unsigned short *)port88796l(port, 1);
@@ -289,7 +294,7 @@ void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
289 p = (volatile unsigned short *)PCI_IOMAP(port); 294 p = (volatile unsigned short *)PCI_IOMAP(port);
290 else 295 else
291 p = (volatile unsigned short *)port2adr(port); 296 p = (volatile unsigned short *)port2adr(port);
292 while (count--) *p = *((__u16 *) addr)++; 297 while (count--) *p = *s++;
293} 298}
294 299
295void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) 300void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
@@ -298,8 +303,9 @@ void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
298 maybebadio(outsl, port); 303 maybebadio(outsl, port);
299 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 304 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
300 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 305 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
306 const __u32 *s = addr;
301 307
302 while (count--) *p = *((__u32 *) addr)++; 308 while (count--) *p = *s++;
303 } else 309 } else
304 maybebadio(outsl, port); 310 maybebadio(outsl, port);
305} 311}