diff options
-rw-r--r-- | arch/mips/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/boot/compressed/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/include/asm/fcntl.h | 1 | ||||
-rw-r--r-- | arch/mips/kernel/branch.c | 1 | ||||
-rw-r--r-- | arch/mips/kernel/ptrace.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/scall32-o32.S | 11 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-64.S | 7 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-n32.S | 6 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-o32.S | 9 | ||||
-rw-r--r-- | arch/mips/kernel/signal.c | 45 | ||||
-rw-r--r-- | arch/mips/kernel/signal_n32.c | 5 | ||||
-rw-r--r-- | arch/mips/kernel/unaligned.c | 2 | ||||
-rw-r--r-- | drivers/firewire/ohci.c | 19 | ||||
-rw-r--r-- | drivers/firewire/ohci.h | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_cursor.c | 28 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 24 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 12 | ||||
-rw-r--r-- | drivers/input/evdev.c | 8 | ||||
-rw-r--r-- | drivers/media/video/v4l2-compat-ioctl32.c | 32 | ||||
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 92 | ||||
-rw-r--r-- | net/rds/page.c | 27 |
21 files changed, 202 insertions, 145 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 5526faabfc21..4c9f402295dd 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -881,11 +881,15 @@ config NO_IOPORT | |||
881 | config GENERIC_ISA_DMA | 881 | config GENERIC_ISA_DMA |
882 | bool | 882 | bool |
883 | select ZONE_DMA if GENERIC_ISA_DMA_SUPPORT_BROKEN=n | 883 | select ZONE_DMA if GENERIC_ISA_DMA_SUPPORT_BROKEN=n |
884 | select ISA_DMA_API | ||
884 | 885 | ||
885 | config GENERIC_ISA_DMA_SUPPORT_BROKEN | 886 | config GENERIC_ISA_DMA_SUPPORT_BROKEN |
886 | bool | 887 | bool |
887 | select GENERIC_ISA_DMA | 888 | select GENERIC_ISA_DMA |
888 | 889 | ||
890 | config ISA_DMA_API | ||
891 | bool | ||
892 | |||
889 | config GENERIC_GPIO | 893 | config GENERIC_GPIO |
890 | bool | 894 | bool |
891 | 895 | ||
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index 5fd7f7a58b7e..5042d51b0512 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile | |||
@@ -105,4 +105,4 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec | |||
105 | vmlinuz.srec: vmlinuz | 105 | vmlinuz.srec: vmlinuz |
106 | $(call cmd,objcopy) | 106 | $(call cmd,objcopy) |
107 | 107 | ||
108 | clean-files := $(objtree)/vmlinuz.* | 108 | clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} |
diff --git a/arch/mips/include/asm/fcntl.h b/arch/mips/include/asm/fcntl.h index e482fe90fe88..75eddedcfc3e 100644 --- a/arch/mips/include/asm/fcntl.h +++ b/arch/mips/include/asm/fcntl.h | |||
@@ -56,6 +56,7 @@ | |||
56 | */ | 56 | */ |
57 | 57 | ||
58 | #ifdef CONFIG_32BIT | 58 | #ifdef CONFIG_32BIT |
59 | #include <linux/types.h> | ||
59 | 60 | ||
60 | struct flock { | 61 | struct flock { |
61 | short l_type; | 62 | short l_type; |
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index 0176ed015c89..32103cc2a257 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c | |||
@@ -40,7 +40,6 @@ int __compute_return_epc(struct pt_regs *regs) | |||
40 | return -EFAULT; | 40 | return -EFAULT; |
41 | } | 41 | } |
42 | 42 | ||
43 | regs->regs[0] = 0; | ||
44 | switch (insn.i_format.opcode) { | 43 | switch (insn.i_format.opcode) { |
45 | /* | 44 | /* |
46 | * jr and jalr are in r_format format. | 45 | * jr and jalr are in r_format format. |
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index c51b95ff8644..c8777333e198 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -536,7 +536,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) | |||
536 | { | 536 | { |
537 | /* do the secure computing check first */ | 537 | /* do the secure computing check first */ |
538 | if (!entryexit) | 538 | if (!entryexit) |
539 | secure_computing(regs->regs[0]); | 539 | secure_computing(regs->regs[2]); |
540 | 540 | ||
541 | if (unlikely(current->audit_context) && entryexit) | 541 | if (unlikely(current->audit_context) && entryexit) |
542 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]), | 542 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]), |
@@ -565,7 +565,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) | |||
565 | 565 | ||
566 | out: | 566 | out: |
567 | if (unlikely(current->audit_context) && !entryexit) | 567 | if (unlikely(current->audit_context) && !entryexit) |
568 | audit_syscall_entry(audit_arch(), regs->regs[0], | 568 | audit_syscall_entry(audit_arch(), regs->regs[2], |
569 | regs->regs[4], regs->regs[5], | 569 | regs->regs[4], regs->regs[5], |
570 | regs->regs[6], regs->regs[7]); | 570 | regs->regs[6], regs->regs[7]); |
571 | } | 571 | } |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 584415eef8c9..fbaabad0e6e2 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -63,9 +63,9 @@ stack_done: | |||
63 | sw t0, PT_R7(sp) # set error flag | 63 | sw t0, PT_R7(sp) # set error flag |
64 | beqz t0, 1f | 64 | beqz t0, 1f |
65 | 65 | ||
66 | lw t1, PT_R2(sp) # syscall number | ||
66 | negu v0 # error | 67 | negu v0 # error |
67 | sw v0, PT_R0(sp) # set flag for syscall | 68 | sw t1, PT_R0(sp) # save it for syscall restarting |
68 | # restarting | ||
69 | 1: sw v0, PT_R2(sp) # result | 69 | 1: sw v0, PT_R2(sp) # result |
70 | 70 | ||
71 | o32_syscall_exit: | 71 | o32_syscall_exit: |
@@ -104,9 +104,9 @@ syscall_trace_entry: | |||
104 | sw t0, PT_R7(sp) # set error flag | 104 | sw t0, PT_R7(sp) # set error flag |
105 | beqz t0, 1f | 105 | beqz t0, 1f |
106 | 106 | ||
107 | lw t1, PT_R2(sp) # syscall number | ||
107 | negu v0 # error | 108 | negu v0 # error |
108 | sw v0, PT_R0(sp) # set flag for syscall | 109 | sw t1, PT_R0(sp) # save it for syscall restarting |
109 | # restarting | ||
110 | 1: sw v0, PT_R2(sp) # result | 110 | 1: sw v0, PT_R2(sp) # result |
111 | 111 | ||
112 | j syscall_exit | 112 | j syscall_exit |
@@ -169,8 +169,7 @@ stackargs: | |||
169 | * We probably should handle this case a bit more drastic. | 169 | * We probably should handle this case a bit more drastic. |
170 | */ | 170 | */ |
171 | bad_stack: | 171 | bad_stack: |
172 | negu v0 # error | 172 | li v0, EFAULT |
173 | sw v0, PT_R0(sp) | ||
174 | sw v0, PT_R2(sp) | 173 | sw v0, PT_R2(sp) |
175 | li t0, 1 # set error flag | 174 | li t0, 1 # set error flag |
176 | sw t0, PT_R7(sp) | 175 | sw t0, PT_R7(sp) |
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 5573f8e4e326..3f4179283207 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -66,9 +66,9 @@ NESTED(handle_sys64, PT_SIZE, sp) | |||
66 | sd t0, PT_R7(sp) # set error flag | 66 | sd t0, PT_R7(sp) # set error flag |
67 | beqz t0, 1f | 67 | beqz t0, 1f |
68 | 68 | ||
69 | ld t1, PT_R2(sp) # syscall number | ||
69 | dnegu v0 # error | 70 | dnegu v0 # error |
70 | sd v0, PT_R0(sp) # set flag for syscall | 71 | sd t1, PT_R0(sp) # save it for syscall restarting |
71 | # restarting | ||
72 | 1: sd v0, PT_R2(sp) # result | 72 | 1: sd v0, PT_R2(sp) # result |
73 | 73 | ||
74 | n64_syscall_exit: | 74 | n64_syscall_exit: |
@@ -109,8 +109,9 @@ syscall_trace_entry: | |||
109 | sd t0, PT_R7(sp) # set error flag | 109 | sd t0, PT_R7(sp) # set error flag |
110 | beqz t0, 1f | 110 | beqz t0, 1f |
111 | 111 | ||
112 | ld t1, PT_R2(sp) # syscall number | ||
112 | dnegu v0 # error | 113 | dnegu v0 # error |
113 | sd v0, PT_R0(sp) # set flag for syscall restarting | 114 | sd t1, PT_R0(sp) # save it for syscall restarting |
114 | 1: sd v0, PT_R2(sp) # result | 115 | 1: sd v0, PT_R2(sp) # result |
115 | 116 | ||
116 | j syscall_exit | 117 | j syscall_exit |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 1e38ec97672e..38b226938db3 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -65,8 +65,9 @@ NESTED(handle_sysn32, PT_SIZE, sp) | |||
65 | sd t0, PT_R7(sp) # set error flag | 65 | sd t0, PT_R7(sp) # set error flag |
66 | beqz t0, 1f | 66 | beqz t0, 1f |
67 | 67 | ||
68 | ld t1, PT_R2(sp) # syscall number | ||
68 | dnegu v0 # error | 69 | dnegu v0 # error |
69 | sd v0, PT_R0(sp) # set flag for syscall restarting | 70 | sd t1, PT_R0(sp) # save it for syscall restarting |
70 | 1: sd v0, PT_R2(sp) # result | 71 | 1: sd v0, PT_R2(sp) # result |
71 | 72 | ||
72 | local_irq_disable # make sure need_resched and | 73 | local_irq_disable # make sure need_resched and |
@@ -106,8 +107,9 @@ n32_syscall_trace_entry: | |||
106 | sd t0, PT_R7(sp) # set error flag | 107 | sd t0, PT_R7(sp) # set error flag |
107 | beqz t0, 1f | 108 | beqz t0, 1f |
108 | 109 | ||
110 | ld t1, PT_R2(sp) # syscall number | ||
109 | dnegu v0 # error | 111 | dnegu v0 # error |
110 | sd v0, PT_R0(sp) # set flag for syscall restarting | 112 | sd t1, PT_R0(sp) # save it for syscall restarting |
111 | 1: sd v0, PT_R2(sp) # result | 113 | 1: sd v0, PT_R2(sp) # result |
112 | 114 | ||
113 | j syscall_exit | 115 | j syscall_exit |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 171979fc98e5..42fe14b52a33 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -93,8 +93,9 @@ NESTED(handle_sys, PT_SIZE, sp) | |||
93 | sd t0, PT_R7(sp) # set error flag | 93 | sd t0, PT_R7(sp) # set error flag |
94 | beqz t0, 1f | 94 | beqz t0, 1f |
95 | 95 | ||
96 | ld t1, PT_R2(sp) # syscall number | ||
96 | dnegu v0 # error | 97 | dnegu v0 # error |
97 | sd v0, PT_R0(sp) # flag for syscall restarting | 98 | sd t1, PT_R0(sp) # save it for syscall restarting |
98 | 1: sd v0, PT_R2(sp) # result | 99 | 1: sd v0, PT_R2(sp) # result |
99 | 100 | ||
100 | o32_syscall_exit: | 101 | o32_syscall_exit: |
@@ -142,8 +143,9 @@ trace_a_syscall: | |||
142 | sd t0, PT_R7(sp) # set error flag | 143 | sd t0, PT_R7(sp) # set error flag |
143 | beqz t0, 1f | 144 | beqz t0, 1f |
144 | 145 | ||
146 | ld t1, PT_R2(sp) # syscall number | ||
145 | dnegu v0 # error | 147 | dnegu v0 # error |
146 | sd v0, PT_R0(sp) # set flag for syscall restarting | 148 | sd t1, PT_R0(sp) # save it for syscall restarting |
147 | 1: sd v0, PT_R2(sp) # result | 149 | 1: sd v0, PT_R2(sp) # result |
148 | 150 | ||
149 | j syscall_exit | 151 | j syscall_exit |
@@ -154,8 +156,7 @@ trace_a_syscall: | |||
154 | * The stackpointer for a call with more than 4 arguments is bad. | 156 | * The stackpointer for a call with more than 4 arguments is bad. |
155 | */ | 157 | */ |
156 | bad_stack: | 158 | bad_stack: |
157 | dnegu v0 # error | 159 | li v0, EFAULT |
158 | sd v0, PT_R0(sp) | ||
159 | sd v0, PT_R2(sp) | 160 | sd v0, PT_R2(sp) |
160 | li t0, 1 # set error flag | 161 | li t0, 1 # set error flag |
161 | sd t0, PT_R7(sp) | 162 | sd t0, PT_R7(sp) |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 2099d5a4c4b7..5922342bca39 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -390,7 +390,6 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
390 | { | 390 | { |
391 | struct rt_sigframe __user *frame; | 391 | struct rt_sigframe __user *frame; |
392 | sigset_t set; | 392 | sigset_t set; |
393 | stack_t st; | ||
394 | int sig; | 393 | int sig; |
395 | 394 | ||
396 | frame = (struct rt_sigframe __user *) regs.regs[29]; | 395 | frame = (struct rt_sigframe __user *) regs.regs[29]; |
@@ -411,11 +410,9 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
411 | else if (sig) | 410 | else if (sig) |
412 | force_sig(sig, current); | 411 | force_sig(sig, current); |
413 | 412 | ||
414 | if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) | ||
415 | goto badframe; | ||
416 | /* It is more difficult to avoid calling this function than to | 413 | /* It is more difficult to avoid calling this function than to |
417 | call it and ignore errors. */ | 414 | call it and ignore errors. */ |
418 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); | 415 | do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]); |
419 | 416 | ||
420 | /* | 417 | /* |
421 | * Don't let your children do this ... | 418 | * Don't let your children do this ... |
@@ -550,23 +547,26 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
550 | struct mips_abi *abi = current->thread.abi; | 547 | struct mips_abi *abi = current->thread.abi; |
551 | void *vdso = current->mm->context.vdso; | 548 | void *vdso = current->mm->context.vdso; |
552 | 549 | ||
553 | switch(regs->regs[0]) { | 550 | if (regs->regs[0]) { |
554 | case ERESTART_RESTARTBLOCK: | 551 | switch(regs->regs[2]) { |
555 | case ERESTARTNOHAND: | 552 | case ERESTART_RESTARTBLOCK: |
556 | regs->regs[2] = EINTR; | 553 | case ERESTARTNOHAND: |
557 | break; | ||
558 | case ERESTARTSYS: | ||
559 | if (!(ka->sa.sa_flags & SA_RESTART)) { | ||
560 | regs->regs[2] = EINTR; | 554 | regs->regs[2] = EINTR; |
561 | break; | 555 | break; |
556 | case ERESTARTSYS: | ||
557 | if (!(ka->sa.sa_flags & SA_RESTART)) { | ||
558 | regs->regs[2] = EINTR; | ||
559 | break; | ||
560 | } | ||
561 | /* fallthrough */ | ||
562 | case ERESTARTNOINTR: | ||
563 | regs->regs[7] = regs->regs[26]; | ||
564 | regs->regs[2] = regs->regs[0]; | ||
565 | regs->cp0_epc -= 4; | ||
562 | } | 566 | } |
563 | /* fallthrough */ | ||
564 | case ERESTARTNOINTR: /* Userland will reload $v0. */ | ||
565 | regs->regs[7] = regs->regs[26]; | ||
566 | regs->cp0_epc -= 8; | ||
567 | } | ||
568 | 567 | ||
569 | regs->regs[0] = 0; /* Don't deal with this again. */ | 568 | regs->regs[0] = 0; /* Don't deal with this again. */ |
569 | } | ||
570 | 570 | ||
571 | if (sig_uses_siginfo(ka)) | 571 | if (sig_uses_siginfo(ka)) |
572 | ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset, | 572 | ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset, |
@@ -575,6 +575,9 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
575 | ret = abi->setup_frame(vdso + abi->signal_return_offset, | 575 | ret = abi->setup_frame(vdso + abi->signal_return_offset, |
576 | ka, regs, sig, oldset); | 576 | ka, regs, sig, oldset); |
577 | 577 | ||
578 | if (ret) | ||
579 | return ret; | ||
580 | |||
578 | spin_lock_irq(¤t->sighand->siglock); | 581 | spin_lock_irq(¤t->sighand->siglock); |
579 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | 582 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); |
580 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 583 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
@@ -622,17 +625,13 @@ static void do_signal(struct pt_regs *regs) | |||
622 | return; | 625 | return; |
623 | } | 626 | } |
624 | 627 | ||
625 | /* | ||
626 | * Who's code doesn't conform to the restartable syscall convention | ||
627 | * dies here!!! The li instruction, a single machine instruction, | ||
628 | * must directly be followed by the syscall instruction. | ||
629 | */ | ||
630 | if (regs->regs[0]) { | 628 | if (regs->regs[0]) { |
631 | if (regs->regs[2] == ERESTARTNOHAND || | 629 | if (regs->regs[2] == ERESTARTNOHAND || |
632 | regs->regs[2] == ERESTARTSYS || | 630 | regs->regs[2] == ERESTARTSYS || |
633 | regs->regs[2] == ERESTARTNOINTR) { | 631 | regs->regs[2] == ERESTARTNOINTR) { |
632 | regs->regs[2] = regs->regs[0]; | ||
634 | regs->regs[7] = regs->regs[26]; | 633 | regs->regs[7] = regs->regs[26]; |
635 | regs->cp0_epc -= 8; | 634 | regs->cp0_epc -= 4; |
636 | } | 635 | } |
637 | if (regs->regs[2] == ERESTART_RESTARTBLOCK) { | 636 | if (regs->regs[2] == ERESTART_RESTARTBLOCK) { |
638 | regs->regs[2] = current->thread.abi->restart; | 637 | regs->regs[2] = current->thread.abi->restart; |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index 2c5df818c65a..ee24d814d5b9 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
@@ -109,6 +109,7 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
109 | asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | 109 | asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
110 | { | 110 | { |
111 | struct rt_sigframe_n32 __user *frame; | 111 | struct rt_sigframe_n32 __user *frame; |
112 | mm_segment_t old_fs; | ||
112 | sigset_t set; | 113 | sigset_t set; |
113 | stack_t st; | 114 | stack_t st; |
114 | s32 sp; | 115 | s32 sp; |
@@ -143,7 +144,11 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
143 | 144 | ||
144 | /* It is more difficult to avoid calling this function than to | 145 | /* It is more difficult to avoid calling this function than to |
145 | call it and ignore errors. */ | 146 | call it and ignore errors. */ |
147 | old_fs = get_fs(); | ||
148 | set_fs(KERNEL_DS); | ||
146 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); | 149 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); |
150 | set_fs(old_fs); | ||
151 | |||
147 | 152 | ||
148 | /* | 153 | /* |
149 | * Don't let your children do this ... | 154 | * Don't let your children do this ... |
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c index 69b039ca8d83..33d5a5ce4a29 100644 --- a/arch/mips/kernel/unaligned.c +++ b/arch/mips/kernel/unaligned.c | |||
@@ -109,8 +109,6 @@ static void emulate_load_store_insn(struct pt_regs *regs, | |||
109 | unsigned long value; | 109 | unsigned long value; |
110 | unsigned int res; | 110 | unsigned int res; |
111 | 111 | ||
112 | regs->regs[0] = 0; | ||
113 | |||
114 | /* | 112 | /* |
115 | * This load never faults. | 113 | * This load never faults. |
116 | */ | 114 | */ |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 1b05896648bc..9dcb17d51aee 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2840,7 +2840,7 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2840 | const struct pci_device_id *ent) | 2840 | const struct pci_device_id *ent) |
2841 | { | 2841 | { |
2842 | struct fw_ohci *ohci; | 2842 | struct fw_ohci *ohci; |
2843 | u32 bus_options, max_receive, link_speed, version, link_enh; | 2843 | u32 bus_options, max_receive, link_speed, version; |
2844 | u64 guid; | 2844 | u64 guid; |
2845 | int i, err, n_ir, n_it; | 2845 | int i, err, n_ir, n_it; |
2846 | size_t size; | 2846 | size_t size; |
@@ -2894,23 +2894,6 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2894 | if (param_quirks) | 2894 | if (param_quirks) |
2895 | ohci->quirks = param_quirks; | 2895 | ohci->quirks = param_quirks; |
2896 | 2896 | ||
2897 | /* TI OHCI-Lynx and compatible: set recommended configuration bits. */ | ||
2898 | if (dev->vendor == PCI_VENDOR_ID_TI) { | ||
2899 | pci_read_config_dword(dev, PCI_CFG_TI_LinkEnh, &link_enh); | ||
2900 | |||
2901 | /* adjust latency of ATx FIFO: use 1.7 KB threshold */ | ||
2902 | link_enh &= ~TI_LinkEnh_atx_thresh_mask; | ||
2903 | link_enh |= TI_LinkEnh_atx_thresh_1_7K; | ||
2904 | |||
2905 | /* use priority arbitration for asynchronous responses */ | ||
2906 | link_enh |= TI_LinkEnh_enab_unfair; | ||
2907 | |||
2908 | /* required for aPhyEnhanceEnable to work */ | ||
2909 | link_enh |= TI_LinkEnh_enab_accel; | ||
2910 | |||
2911 | pci_write_config_dword(dev, PCI_CFG_TI_LinkEnh, link_enh); | ||
2912 | } | ||
2913 | |||
2914 | ar_context_init(&ohci->ar_request_ctx, ohci, | 2897 | ar_context_init(&ohci->ar_request_ctx, ohci, |
2915 | OHCI1394_AsReqRcvContextControlSet); | 2898 | OHCI1394_AsReqRcvContextControlSet); |
2916 | 2899 | ||
diff --git a/drivers/firewire/ohci.h b/drivers/firewire/ohci.h index 0e6c5a466908..ef5e7336da68 100644 --- a/drivers/firewire/ohci.h +++ b/drivers/firewire/ohci.h | |||
@@ -155,12 +155,4 @@ | |||
155 | 155 | ||
156 | #define OHCI1394_phy_tcode 0xe | 156 | #define OHCI1394_phy_tcode 0xe |
157 | 157 | ||
158 | /* TI extensions */ | ||
159 | |||
160 | #define PCI_CFG_TI_LinkEnh 0xf4 | ||
161 | #define TI_LinkEnh_enab_accel 0x00000002 | ||
162 | #define TI_LinkEnh_enab_unfair 0x00000080 | ||
163 | #define TI_LinkEnh_atx_thresh_mask 0x00003000 | ||
164 | #define TI_LinkEnh_atx_thresh_1_7K 0x00001000 | ||
165 | |||
166 | #endif /* _FIREWIRE_OHCI_H */ | 158 | #endif /* _FIREWIRE_OHCI_H */ |
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index 5731fc9b1ae3..3eef567b0421 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
@@ -203,6 +203,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
203 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 203 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
204 | struct radeon_device *rdev = crtc->dev->dev_private; | 204 | struct radeon_device *rdev = crtc->dev->dev_private; |
205 | int xorigin = 0, yorigin = 0; | 205 | int xorigin = 0, yorigin = 0; |
206 | int w = radeon_crtc->cursor_width; | ||
206 | 207 | ||
207 | if (x < 0) | 208 | if (x < 0) |
208 | xorigin = -x + 1; | 209 | xorigin = -x + 1; |
@@ -213,22 +214,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
213 | if (yorigin >= CURSOR_HEIGHT) | 214 | if (yorigin >= CURSOR_HEIGHT) |
214 | yorigin = CURSOR_HEIGHT - 1; | 215 | yorigin = CURSOR_HEIGHT - 1; |
215 | 216 | ||
216 | radeon_lock_cursor(crtc, true); | 217 | if (ASIC_IS_AVIVO(rdev)) { |
217 | if (ASIC_IS_DCE4(rdev)) { | ||
218 | /* cursors are offset into the total surface */ | ||
219 | x += crtc->x; | ||
220 | y += crtc->y; | ||
221 | DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y); | ||
222 | |||
223 | /* XXX: check if evergreen has the same issues as avivo chips */ | ||
224 | WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, | ||
225 | ((xorigin ? 0 : x) << 16) | | ||
226 | (yorigin ? 0 : y)); | ||
227 | WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); | ||
228 | WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, | ||
229 | ((radeon_crtc->cursor_width - 1) << 16) | (radeon_crtc->cursor_height - 1)); | ||
230 | } else if (ASIC_IS_AVIVO(rdev)) { | ||
231 | int w = radeon_crtc->cursor_width; | ||
232 | int i = 0; | 218 | int i = 0; |
233 | struct drm_crtc *crtc_p; | 219 | struct drm_crtc *crtc_p; |
234 | 220 | ||
@@ -260,7 +246,17 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
260 | if (w <= 0) | 246 | if (w <= 0) |
261 | w = 1; | 247 | w = 1; |
262 | } | 248 | } |
249 | } | ||
263 | 250 | ||
251 | radeon_lock_cursor(crtc, true); | ||
252 | if (ASIC_IS_DCE4(rdev)) { | ||
253 | WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, | ||
254 | ((xorigin ? 0 : x) << 16) | | ||
255 | (yorigin ? 0 : y)); | ||
256 | WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); | ||
257 | WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, | ||
258 | ((w - 1) << 16) | (radeon_crtc->cursor_height - 1)); | ||
259 | } else if (ASIC_IS_AVIVO(rdev)) { | ||
264 | WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, | 260 | WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, |
265 | ((xorigin ? 0 : x) << 16) | | 261 | ((xorigin ? 0 : x) << 16) | |
266 | (yorigin ? 0 : y)); | 262 | (yorigin ? 0 : y)); |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index b8feac5f2ef4..5795c8398c7c 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -331,21 +331,16 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
331 | INIT_COMPLETION(dev->cmd_complete); | 331 | INIT_COMPLETION(dev->cmd_complete); |
332 | dev->cmd_err = 0; | 332 | dev->cmd_err = 0; |
333 | 333 | ||
334 | /* Take I2C out of reset, configure it as master and set the | 334 | /* Take I2C out of reset and configure it as master */ |
335 | * start bit */ | 335 | flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST; |
336 | flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST | DAVINCI_I2C_MDR_STT; | ||
337 | 336 | ||
338 | /* if the slave address is ten bit address, enable XA bit */ | 337 | /* if the slave address is ten bit address, enable XA bit */ |
339 | if (msg->flags & I2C_M_TEN) | 338 | if (msg->flags & I2C_M_TEN) |
340 | flag |= DAVINCI_I2C_MDR_XA; | 339 | flag |= DAVINCI_I2C_MDR_XA; |
341 | if (!(msg->flags & I2C_M_RD)) | 340 | if (!(msg->flags & I2C_M_RD)) |
342 | flag |= DAVINCI_I2C_MDR_TRX; | 341 | flag |= DAVINCI_I2C_MDR_TRX; |
343 | if (stop) | 342 | if (msg->len == 0) |
344 | flag |= DAVINCI_I2C_MDR_STP; | ||
345 | if (msg->len == 0) { | ||
346 | flag |= DAVINCI_I2C_MDR_RM; | 343 | flag |= DAVINCI_I2C_MDR_RM; |
347 | flag &= ~DAVINCI_I2C_MDR_STP; | ||
348 | } | ||
349 | 344 | ||
350 | /* Enable receive or transmit interrupts */ | 345 | /* Enable receive or transmit interrupts */ |
351 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG); | 346 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG); |
@@ -358,17 +353,28 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
358 | dev->terminate = 0; | 353 | dev->terminate = 0; |
359 | 354 | ||
360 | /* | 355 | /* |
356 | * Write mode register first as needed for correct behaviour | ||
357 | * on OMAP-L138, but don't set STT yet to avoid a race with XRDY | ||
358 | * occuring before we have loaded DXR | ||
359 | */ | ||
360 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); | ||
361 | |||
362 | /* | ||
361 | * First byte should be set here, not after interrupt, | 363 | * First byte should be set here, not after interrupt, |
362 | * because transmit-data-ready interrupt can come before | 364 | * because transmit-data-ready interrupt can come before |
363 | * NACK-interrupt during sending of previous message and | 365 | * NACK-interrupt during sending of previous message and |
364 | * ICDXR may have wrong data | 366 | * ICDXR may have wrong data |
367 | * It also saves us one interrupt, slightly faster | ||
365 | */ | 368 | */ |
366 | if ((!(msg->flags & I2C_M_RD)) && dev->buf_len) { | 369 | if ((!(msg->flags & I2C_M_RD)) && dev->buf_len) { |
367 | davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG, *dev->buf++); | 370 | davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG, *dev->buf++); |
368 | dev->buf_len--; | 371 | dev->buf_len--; |
369 | } | 372 | } |
370 | 373 | ||
371 | /* write the data into mode register; start transmitting */ | 374 | /* Set STT to begin transmit now DXR is loaded */ |
375 | flag |= DAVINCI_I2C_MDR_STT; | ||
376 | if (stop && msg->len != 0) | ||
377 | flag |= DAVINCI_I2C_MDR_STP; | ||
372 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); | 378 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); |
373 | 379 | ||
374 | r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 380 | r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index d1ff9408dc1f..4c2a62b75b5c 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -159,15 +159,9 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) | |||
159 | 159 | ||
160 | static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) | 160 | static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) |
161 | { | 161 | { |
162 | int result; | 162 | wait_event_timeout(i2c_imx->queue, i2c_imx->i2csr & I2SR_IIF, HZ / 10); |
163 | |||
164 | result = wait_event_interruptible_timeout(i2c_imx->queue, | ||
165 | i2c_imx->i2csr & I2SR_IIF, HZ / 10); | ||
166 | 163 | ||
167 | if (unlikely(result < 0)) { | 164 | if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) { |
168 | dev_dbg(&i2c_imx->adapter.dev, "<%s> result < 0\n", __func__); | ||
169 | return result; | ||
170 | } else if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) { | ||
171 | dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); | 165 | dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); |
172 | return -ETIMEDOUT; | 166 | return -ETIMEDOUT; |
173 | } | 167 | } |
@@ -295,7 +289,7 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id) | |||
295 | i2c_imx->i2csr = temp; | 289 | i2c_imx->i2csr = temp; |
296 | temp &= ~I2SR_IIF; | 290 | temp &= ~I2SR_IIF; |
297 | writeb(temp, i2c_imx->base + IMX_I2C_I2SR); | 291 | writeb(temp, i2c_imx->base + IMX_I2C_I2SR); |
298 | wake_up_interruptible(&i2c_imx->queue); | 292 | wake_up(&i2c_imx->queue); |
299 | return IRQ_HANDLED; | 293 | return IRQ_HANDLED; |
300 | } | 294 | } |
301 | 295 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index c908c5f83645..9ddafc30f432 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -669,6 +669,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
669 | 669 | ||
670 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { | 670 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { |
671 | 671 | ||
672 | if (!dev->absinfo) | ||
673 | return -EINVAL; | ||
674 | |||
672 | t = _IOC_NR(cmd) & ABS_MAX; | 675 | t = _IOC_NR(cmd) & ABS_MAX; |
673 | abs = dev->absinfo[t]; | 676 | abs = dev->absinfo[t]; |
674 | 677 | ||
@@ -680,10 +683,13 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
680 | } | 683 | } |
681 | } | 684 | } |
682 | 685 | ||
683 | if (_IOC_DIR(cmd) == _IOC_READ) { | 686 | if (_IOC_DIR(cmd) == _IOC_WRITE) { |
684 | 687 | ||
685 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { | 688 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { |
686 | 689 | ||
690 | if (!dev->absinfo) | ||
691 | return -EINVAL; | ||
692 | |||
687 | t = _IOC_NR(cmd) & ABS_MAX; | 693 | t = _IOC_NR(cmd) & ABS_MAX; |
688 | 694 | ||
689 | if (copy_from_user(&abs, p, min_t(size_t, | 695 | if (copy_from_user(&abs, p, min_t(size_t, |
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 073f01390cdd..86294ed35c9b 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c | |||
@@ -193,17 +193,24 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u | |||
193 | struct video_code32 { | 193 | struct video_code32 { |
194 | char loadwhat[16]; /* name or tag of file being passed */ | 194 | char loadwhat[16]; /* name or tag of file being passed */ |
195 | compat_int_t datasize; | 195 | compat_int_t datasize; |
196 | unsigned char *data; | 196 | compat_uptr_t data; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static int get_microcode32(struct video_code *kp, struct video_code32 __user *up) | 199 | static struct video_code __user *get_microcode32(struct video_code32 *kp) |
200 | { | 200 | { |
201 | if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || | 201 | struct video_code __user *up; |
202 | copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) || | 202 | |
203 | get_user(kp->datasize, &up->datasize) || | 203 | up = compat_alloc_user_space(sizeof(*up)); |
204 | copy_from_user(kp->data, up->data, up->datasize)) | 204 | |
205 | return -EFAULT; | 205 | /* |
206 | return 0; | 206 | * NOTE! We don't actually care if these fail. If the |
207 | * user address is invalid, the native ioctl will do | ||
208 | * the error handling for us | ||
209 | */ | ||
210 | (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); | ||
211 | (void) put_user(kp->datasize, &up->datasize); | ||
212 | (void) put_user(compat_ptr(kp->data), &up->data); | ||
213 | return up; | ||
207 | } | 214 | } |
208 | 215 | ||
209 | #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) | 216 | #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) |
@@ -739,7 +746,7 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
739 | struct video_tuner vt; | 746 | struct video_tuner vt; |
740 | struct video_buffer vb; | 747 | struct video_buffer vb; |
741 | struct video_window vw; | 748 | struct video_window vw; |
742 | struct video_code vc; | 749 | struct video_code32 vc; |
743 | struct video_audio va; | 750 | struct video_audio va; |
744 | #endif | 751 | #endif |
745 | struct v4l2_format v2f; | 752 | struct v4l2_format v2f; |
@@ -818,8 +825,11 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
818 | break; | 825 | break; |
819 | 826 | ||
820 | case VIDIOCSMICROCODE: | 827 | case VIDIOCSMICROCODE: |
821 | err = get_microcode32(&karg.vc, up); | 828 | /* Copy the 32-bit "video_code32" to kernel space */ |
822 | compatible_arg = 0; | 829 | if (copy_from_user(&karg.vc, up, sizeof(karg.vc))) |
830 | return -EFAULT; | ||
831 | /* Convert the 32-bit version to a 64-bit version in user space */ | ||
832 | up = get_microcode32(&karg.vc); | ||
823 | break; | 833 | break; |
824 | 834 | ||
825 | case VIDIOCSFREQ: | 835 | case VIDIOCSFREQ: |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index b2828e84d243..214b03afdd48 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/irq.h> | ||
34 | #include <linux/completion.h> | ||
33 | 35 | ||
34 | #include <asm/mach/flash.h> | 36 | #include <asm/mach/flash.h> |
35 | #include <mach/mxc_nand.h> | 37 | #include <mach/mxc_nand.h> |
@@ -151,7 +153,7 @@ struct mxc_nand_host { | |||
151 | int irq; | 153 | int irq; |
152 | int eccsize; | 154 | int eccsize; |
153 | 155 | ||
154 | wait_queue_head_t irq_waitq; | 156 | struct completion op_completion; |
155 | 157 | ||
156 | uint8_t *data_buf; | 158 | uint8_t *data_buf; |
157 | unsigned int buf_start; | 159 | unsigned int buf_start; |
@@ -164,6 +166,7 @@ struct mxc_nand_host { | |||
164 | void (*send_read_id)(struct mxc_nand_host *); | 166 | void (*send_read_id)(struct mxc_nand_host *); |
165 | uint16_t (*get_dev_status)(struct mxc_nand_host *); | 167 | uint16_t (*get_dev_status)(struct mxc_nand_host *); |
166 | int (*check_int)(struct mxc_nand_host *); | 168 | int (*check_int)(struct mxc_nand_host *); |
169 | void (*irq_control)(struct mxc_nand_host *, int); | ||
167 | }; | 170 | }; |
168 | 171 | ||
169 | /* OOB placement block for use with hardware ecc generation */ | 172 | /* OOB placement block for use with hardware ecc generation */ |
@@ -216,9 +219,12 @@ static irqreturn_t mxc_nfc_irq(int irq, void *dev_id) | |||
216 | { | 219 | { |
217 | struct mxc_nand_host *host = dev_id; | 220 | struct mxc_nand_host *host = dev_id; |
218 | 221 | ||
219 | disable_irq_nosync(irq); | 222 | if (!host->check_int(host)) |
223 | return IRQ_NONE; | ||
220 | 224 | ||
221 | wake_up(&host->irq_waitq); | 225 | host->irq_control(host, 0); |
226 | |||
227 | complete(&host->op_completion); | ||
222 | 228 | ||
223 | return IRQ_HANDLED; | 229 | return IRQ_HANDLED; |
224 | } | 230 | } |
@@ -245,11 +251,54 @@ static int check_int_v1_v2(struct mxc_nand_host *host) | |||
245 | if (!(tmp & NFC_V1_V2_CONFIG2_INT)) | 251 | if (!(tmp & NFC_V1_V2_CONFIG2_INT)) |
246 | return 0; | 252 | return 0; |
247 | 253 | ||
248 | writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2); | 254 | if (!cpu_is_mx21()) |
255 | writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2); | ||
249 | 256 | ||
250 | return 1; | 257 | return 1; |
251 | } | 258 | } |
252 | 259 | ||
260 | /* | ||
261 | * It has been observed that the i.MX21 cannot read the CONFIG2:INT bit | ||
262 | * if interrupts are masked (CONFIG1:INT_MSK is set). To handle this, the | ||
263 | * driver can enable/disable the irq line rather than simply masking the | ||
264 | * interrupts. | ||
265 | */ | ||
266 | static void irq_control_mx21(struct mxc_nand_host *host, int activate) | ||
267 | { | ||
268 | if (activate) | ||
269 | enable_irq(host->irq); | ||
270 | else | ||
271 | disable_irq_nosync(host->irq); | ||
272 | } | ||
273 | |||
274 | static void irq_control_v1_v2(struct mxc_nand_host *host, int activate) | ||
275 | { | ||
276 | uint16_t tmp; | ||
277 | |||
278 | tmp = readw(NFC_V1_V2_CONFIG1); | ||
279 | |||
280 | if (activate) | ||
281 | tmp &= ~NFC_V1_V2_CONFIG1_INT_MSK; | ||
282 | else | ||
283 | tmp |= NFC_V1_V2_CONFIG1_INT_MSK; | ||
284 | |||
285 | writew(tmp, NFC_V1_V2_CONFIG1); | ||
286 | } | ||
287 | |||
288 | static void irq_control_v3(struct mxc_nand_host *host, int activate) | ||
289 | { | ||
290 | uint32_t tmp; | ||
291 | |||
292 | tmp = readl(NFC_V3_CONFIG2); | ||
293 | |||
294 | if (activate) | ||
295 | tmp &= ~NFC_V3_CONFIG2_INT_MSK; | ||
296 | else | ||
297 | tmp |= NFC_V3_CONFIG2_INT_MSK; | ||
298 | |||
299 | writel(tmp, NFC_V3_CONFIG2); | ||
300 | } | ||
301 | |||
253 | /* This function polls the NANDFC to wait for the basic operation to | 302 | /* This function polls the NANDFC to wait for the basic operation to |
254 | * complete by checking the INT bit of config2 register. | 303 | * complete by checking the INT bit of config2 register. |
255 | */ | 304 | */ |
@@ -259,10 +308,9 @@ static void wait_op_done(struct mxc_nand_host *host, int useirq) | |||
259 | 308 | ||
260 | if (useirq) { | 309 | if (useirq) { |
261 | if (!host->check_int(host)) { | 310 | if (!host->check_int(host)) { |
262 | 311 | INIT_COMPLETION(host->op_completion); | |
263 | enable_irq(host->irq); | 312 | host->irq_control(host, 1); |
264 | 313 | wait_for_completion(&host->op_completion); | |
265 | wait_event(host->irq_waitq, host->check_int(host)); | ||
266 | } | 314 | } |
267 | } else { | 315 | } else { |
268 | while (max_retries-- > 0) { | 316 | while (max_retries-- > 0) { |
@@ -799,6 +847,7 @@ static void preset_v3(struct mtd_info *mtd) | |||
799 | NFC_V3_CONFIG2_2CMD_PHASES | | 847 | NFC_V3_CONFIG2_2CMD_PHASES | |
800 | NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) | | 848 | NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) | |
801 | NFC_V3_CONFIG2_ST_CMD(0x70) | | 849 | NFC_V3_CONFIG2_ST_CMD(0x70) | |
850 | NFC_V3_CONFIG2_INT_MSK | | ||
802 | NFC_V3_CONFIG2_NUM_ADDR_PHASE0; | 851 | NFC_V3_CONFIG2_NUM_ADDR_PHASE0; |
803 | 852 | ||
804 | if (chip->ecc.mode == NAND_ECC_HW) | 853 | if (chip->ecc.mode == NAND_ECC_HW) |
@@ -1024,6 +1073,10 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1024 | host->send_read_id = send_read_id_v1_v2; | 1073 | host->send_read_id = send_read_id_v1_v2; |
1025 | host->get_dev_status = get_dev_status_v1_v2; | 1074 | host->get_dev_status = get_dev_status_v1_v2; |
1026 | host->check_int = check_int_v1_v2; | 1075 | host->check_int = check_int_v1_v2; |
1076 | if (cpu_is_mx21()) | ||
1077 | host->irq_control = irq_control_mx21; | ||
1078 | else | ||
1079 | host->irq_control = irq_control_v1_v2; | ||
1027 | } | 1080 | } |
1028 | 1081 | ||
1029 | if (nfc_is_v21()) { | 1082 | if (nfc_is_v21()) { |
@@ -1062,6 +1115,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1062 | host->send_read_id = send_read_id_v3; | 1115 | host->send_read_id = send_read_id_v3; |
1063 | host->check_int = check_int_v3; | 1116 | host->check_int = check_int_v3; |
1064 | host->get_dev_status = get_dev_status_v3; | 1117 | host->get_dev_status = get_dev_status_v3; |
1118 | host->irq_control = irq_control_v3; | ||
1065 | oob_smallpage = &nandv2_hw_eccoob_smallpage; | 1119 | oob_smallpage = &nandv2_hw_eccoob_smallpage; |
1066 | oob_largepage = &nandv2_hw_eccoob_largepage; | 1120 | oob_largepage = &nandv2_hw_eccoob_largepage; |
1067 | } else | 1121 | } else |
@@ -1093,14 +1147,34 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1093 | this->options |= NAND_USE_FLASH_BBT; | 1147 | this->options |= NAND_USE_FLASH_BBT; |
1094 | } | 1148 | } |
1095 | 1149 | ||
1096 | init_waitqueue_head(&host->irq_waitq); | 1150 | init_completion(&host->op_completion); |
1097 | 1151 | ||
1098 | host->irq = platform_get_irq(pdev, 0); | 1152 | host->irq = platform_get_irq(pdev, 0); |
1099 | 1153 | ||
1154 | /* | ||
1155 | * mask the interrupt. For i.MX21 explicitely call | ||
1156 | * irq_control_v1_v2 to use the mask bit. We can't call | ||
1157 | * disable_irq_nosync() for an interrupt we do not own yet. | ||
1158 | */ | ||
1159 | if (cpu_is_mx21()) | ||
1160 | irq_control_v1_v2(host, 0); | ||
1161 | else | ||
1162 | host->irq_control(host, 0); | ||
1163 | |||
1100 | err = request_irq(host->irq, mxc_nfc_irq, IRQF_DISABLED, DRIVER_NAME, host); | 1164 | err = request_irq(host->irq, mxc_nfc_irq, IRQF_DISABLED, DRIVER_NAME, host); |
1101 | if (err) | 1165 | if (err) |
1102 | goto eirq; | 1166 | goto eirq; |
1103 | 1167 | ||
1168 | host->irq_control(host, 0); | ||
1169 | |||
1170 | /* | ||
1171 | * Now that the interrupt is disabled make sure the interrupt | ||
1172 | * mask bit is cleared on i.MX21. Otherwise we can't read | ||
1173 | * the interrupt status bit on this machine. | ||
1174 | */ | ||
1175 | if (cpu_is_mx21()) | ||
1176 | irq_control_v1_v2(host, 1); | ||
1177 | |||
1104 | /* first scan to find the device and get the page size */ | 1178 | /* first scan to find the device and get the page size */ |
1105 | if (nand_scan_ident(mtd, 1, NULL)) { | 1179 | if (nand_scan_ident(mtd, 1, NULL)) { |
1106 | err = -ENXIO; | 1180 | err = -ENXIO; |
diff --git a/net/rds/page.c b/net/rds/page.c index 595a952d4b17..1dfbfea12e9b 100644 --- a/net/rds/page.c +++ b/net/rds/page.c | |||
@@ -57,30 +57,17 @@ int rds_page_copy_user(struct page *page, unsigned long offset, | |||
57 | unsigned long ret; | 57 | unsigned long ret; |
58 | void *addr; | 58 | void *addr; |
59 | 59 | ||
60 | if (to_user) | 60 | addr = kmap(page); |
61 | if (to_user) { | ||
61 | rds_stats_add(s_copy_to_user, bytes); | 62 | rds_stats_add(s_copy_to_user, bytes); |
62 | else | 63 | ret = copy_to_user(ptr, addr + offset, bytes); |
64 | } else { | ||
63 | rds_stats_add(s_copy_from_user, bytes); | 65 | rds_stats_add(s_copy_from_user, bytes); |
64 | 66 | ret = copy_from_user(addr + offset, ptr, bytes); | |
65 | addr = kmap_atomic(page, KM_USER0); | ||
66 | if (to_user) | ||
67 | ret = __copy_to_user_inatomic(ptr, addr + offset, bytes); | ||
68 | else | ||
69 | ret = __copy_from_user_inatomic(addr + offset, ptr, bytes); | ||
70 | kunmap_atomic(addr, KM_USER0); | ||
71 | |||
72 | if (ret) { | ||
73 | addr = kmap(page); | ||
74 | if (to_user) | ||
75 | ret = copy_to_user(ptr, addr + offset, bytes); | ||
76 | else | ||
77 | ret = copy_from_user(addr + offset, ptr, bytes); | ||
78 | kunmap(page); | ||
79 | if (ret) | ||
80 | return -EFAULT; | ||
81 | } | 67 | } |
68 | kunmap(page); | ||
82 | 69 | ||
83 | return 0; | 70 | return ret ? -EFAULT : 0; |
84 | } | 71 | } |
85 | EXPORT_SYMBOL_GPL(rds_page_copy_user); | 72 | EXPORT_SYMBOL_GPL(rds_page_copy_user); |
86 | 73 | ||