diff options
346 files changed, 2451 insertions, 1633 deletions
diff --git a/Documentation/vfio.txt b/Documentation/vfio.txt index 0cb6685c8029..8eda3635a17d 100644 --- a/Documentation/vfio.txt +++ b/Documentation/vfio.txt | |||
@@ -133,7 +133,7 @@ character devices for this group: | |||
133 | $ lspci -n -s 0000:06:0d.0 | 133 | $ lspci -n -s 0000:06:0d.0 |
134 | 06:0d.0 0401: 1102:0002 (rev 08) | 134 | 06:0d.0 0401: 1102:0002 (rev 08) |
135 | # echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind | 135 | # echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind |
136 | # echo 1102 0002 > /sys/bus/pci/drivers/vfio/new_id | 136 | # echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id |
137 | 137 | ||
138 | Now we need to look at what other devices are in the group to free | 138 | Now we need to look at what other devices are in the group to free |
139 | it for use by VFIO: | 139 | it for use by VFIO: |
diff --git a/MAINTAINERS b/MAINTAINERS index 53cc13c82cb1..9a6c4da3b2ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3552,11 +3552,12 @@ K: \b(ABS|SYN)_MT_ | |||
3552 | 3552 | ||
3553 | INTEL C600 SERIES SAS CONTROLLER DRIVER | 3553 | INTEL C600 SERIES SAS CONTROLLER DRIVER |
3554 | M: Intel SCU Linux support <intel-linux-scu@intel.com> | 3554 | M: Intel SCU Linux support <intel-linux-scu@intel.com> |
3555 | M: Lukasz Dorau <lukasz.dorau@intel.com> | ||
3556 | M: Maciej Patelczyk <maciej.patelczyk@intel.com> | ||
3555 | M: Dave Jiang <dave.jiang@intel.com> | 3557 | M: Dave Jiang <dave.jiang@intel.com> |
3556 | M: Ed Nadolski <edmund.nadolski@intel.com> | ||
3557 | L: linux-scsi@vger.kernel.org | 3558 | L: linux-scsi@vger.kernel.org |
3558 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git | 3559 | T: git git://git.code.sf.net/p/intel-sas/isci |
3559 | S: Maintained | 3560 | S: Supported |
3560 | F: drivers/scsi/isci/ | 3561 | F: drivers/scsi/isci/ |
3561 | F: firmware/isci/ | 3562 | F: firmware/isci/ |
3562 | 3563 | ||
@@ -3666,11 +3667,12 @@ F: Documentation/networking/README.ipw2200 | |||
3666 | F: drivers/net/wireless/ipw2x00/ | 3667 | F: drivers/net/wireless/ipw2x00/ |
3667 | 3668 | ||
3668 | INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) | 3669 | INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) |
3669 | M: Joseph Cihula <joseph.cihula@intel.com> | 3670 | M: Richard L Maliszewski <richard.l.maliszewski@intel.com> |
3671 | M: Gang Wei <gang.wei@intel.com> | ||
3670 | M: Shane Wang <shane.wang@intel.com> | 3672 | M: Shane Wang <shane.wang@intel.com> |
3671 | L: tboot-devel@lists.sourceforge.net | 3673 | L: tboot-devel@lists.sourceforge.net |
3672 | W: http://tboot.sourceforge.net | 3674 | W: http://tboot.sourceforge.net |
3673 | T: Mercurial http://www.bughost.org/repos.hg/tboot.hg | 3675 | T: hg http://tboot.hg.sourceforge.net:8000/hgroot/tboot/tboot |
3674 | S: Supported | 3676 | S: Supported |
3675 | F: Documentation/intel_txt.txt | 3677 | F: Documentation/intel_txt.txt |
3676 | F: include/linux/tboot.h | 3678 | F: include/linux/tboot.h |
@@ -5543,6 +5545,8 @@ F: Documentation/devicetree/bindings/pwm/ | |||
5543 | F: include/linux/pwm.h | 5545 | F: include/linux/pwm.h |
5544 | F: include/linux/of_pwm.h | 5546 | F: include/linux/of_pwm.h |
5545 | F: drivers/pwm/ | 5547 | F: drivers/pwm/ |
5548 | F: drivers/video/backlight/pwm_bl.c | ||
5549 | F: include/linux/pwm_backlight.h | ||
5546 | 5550 | ||
5547 | PXA2xx/PXA3xx SUPPORT | 5551 | PXA2xx/PXA3xx SUPPORT |
5548 | M: Eric Miao <eric.y.miao@gmail.com> | 5552 | M: Eric Miao <eric.y.miao@gmail.com> |
@@ -1,8 +1,8 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Terrified Chipmunk |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
8 | # To see a list of typical targets execute "make help" | 8 | # To see a list of typical targets execute "make help" |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 81769c1341fa..bc67cbff3944 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -653,6 +653,7 @@ __armv7_mmu_cache_on: | |||
653 | mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs | 653 | mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs |
654 | #endif | 654 | #endif |
655 | mrc p15, 0, r0, c1, c0, 0 @ read control reg | 655 | mrc p15, 0, r0, c1, c0, 0 @ read control reg |
656 | bic r0, r0, #1 << 28 @ clear SCTLR.TRE | ||
656 | orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement | 657 | orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement |
657 | orr r0, r0, #0x003c @ write buffer | 658 | orr r0, r0, #0x003c @ write buffer |
658 | #ifdef CONFIG_MMU | 659 | #ifdef CONFIG_MMU |
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index 66389c1c6f62..7c95f76398de 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi | |||
@@ -104,6 +104,7 @@ | |||
104 | #gpio-cells = <2>; | 104 | #gpio-cells = <2>; |
105 | gpio-controller; | 105 | gpio-controller; |
106 | interrupt-controller; | 106 | interrupt-controller; |
107 | #interrupt-cells = <2>; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | pioB: gpio@fffff600 { | 110 | pioB: gpio@fffff600 { |
@@ -113,6 +114,7 @@ | |||
113 | #gpio-cells = <2>; | 114 | #gpio-cells = <2>; |
114 | gpio-controller; | 115 | gpio-controller; |
115 | interrupt-controller; | 116 | interrupt-controller; |
117 | #interrupt-cells = <2>; | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | pioC: gpio@fffff800 { | 120 | pioC: gpio@fffff800 { |
@@ -122,6 +124,7 @@ | |||
122 | #gpio-cells = <2>; | 124 | #gpio-cells = <2>; |
123 | gpio-controller; | 125 | gpio-controller; |
124 | interrupt-controller; | 126 | interrupt-controller; |
127 | #interrupt-cells = <2>; | ||
125 | }; | 128 | }; |
126 | 129 | ||
127 | dbgu: serial@fffff200 { | 130 | dbgu: serial@fffff200 { |
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index b460d6ce9eb5..195019b7ca0e 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi | |||
@@ -95,6 +95,7 @@ | |||
95 | #gpio-cells = <2>; | 95 | #gpio-cells = <2>; |
96 | gpio-controller; | 96 | gpio-controller; |
97 | interrupt-controller; | 97 | interrupt-controller; |
98 | #interrupt-cells = <2>; | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | pioB: gpio@fffff400 { | 101 | pioB: gpio@fffff400 { |
@@ -104,6 +105,7 @@ | |||
104 | #gpio-cells = <2>; | 105 | #gpio-cells = <2>; |
105 | gpio-controller; | 106 | gpio-controller; |
106 | interrupt-controller; | 107 | interrupt-controller; |
108 | #interrupt-cells = <2>; | ||
107 | }; | 109 | }; |
108 | 110 | ||
109 | pioC: gpio@fffff600 { | 111 | pioC: gpio@fffff600 { |
@@ -113,6 +115,7 @@ | |||
113 | #gpio-cells = <2>; | 115 | #gpio-cells = <2>; |
114 | gpio-controller; | 116 | gpio-controller; |
115 | interrupt-controller; | 117 | interrupt-controller; |
118 | #interrupt-cells = <2>; | ||
116 | }; | 119 | }; |
117 | 120 | ||
118 | pioD: gpio@fffff800 { | 121 | pioD: gpio@fffff800 { |
@@ -122,6 +125,7 @@ | |||
122 | #gpio-cells = <2>; | 125 | #gpio-cells = <2>; |
123 | gpio-controller; | 126 | gpio-controller; |
124 | interrupt-controller; | 127 | interrupt-controller; |
128 | #interrupt-cells = <2>; | ||
125 | }; | 129 | }; |
126 | 130 | ||
127 | pioE: gpio@fffffa00 { | 131 | pioE: gpio@fffffa00 { |
@@ -131,6 +135,7 @@ | |||
131 | #gpio-cells = <2>; | 135 | #gpio-cells = <2>; |
132 | gpio-controller; | 136 | gpio-controller; |
133 | interrupt-controller; | 137 | interrupt-controller; |
138 | #interrupt-cells = <2>; | ||
134 | }; | 139 | }; |
135 | 140 | ||
136 | dbgu: serial@ffffee00 { | 141 | dbgu: serial@ffffee00 { |
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index bafa8806fc17..63751b1e744b 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -113,6 +113,7 @@ | |||
113 | #gpio-cells = <2>; | 113 | #gpio-cells = <2>; |
114 | gpio-controller; | 114 | gpio-controller; |
115 | interrupt-controller; | 115 | interrupt-controller; |
116 | #interrupt-cells = <2>; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | pioB: gpio@fffff400 { | 119 | pioB: gpio@fffff400 { |
@@ -122,6 +123,7 @@ | |||
122 | #gpio-cells = <2>; | 123 | #gpio-cells = <2>; |
123 | gpio-controller; | 124 | gpio-controller; |
124 | interrupt-controller; | 125 | interrupt-controller; |
126 | #interrupt-cells = <2>; | ||
125 | }; | 127 | }; |
126 | 128 | ||
127 | pioC: gpio@fffff600 { | 129 | pioC: gpio@fffff600 { |
@@ -131,6 +133,7 @@ | |||
131 | #gpio-cells = <2>; | 133 | #gpio-cells = <2>; |
132 | gpio-controller; | 134 | gpio-controller; |
133 | interrupt-controller; | 135 | interrupt-controller; |
136 | #interrupt-cells = <2>; | ||
134 | }; | 137 | }; |
135 | 138 | ||
136 | pioD: gpio@fffff800 { | 139 | pioD: gpio@fffff800 { |
@@ -140,6 +143,7 @@ | |||
140 | #gpio-cells = <2>; | 143 | #gpio-cells = <2>; |
141 | gpio-controller; | 144 | gpio-controller; |
142 | interrupt-controller; | 145 | interrupt-controller; |
146 | #interrupt-cells = <2>; | ||
143 | }; | 147 | }; |
144 | 148 | ||
145 | pioE: gpio@fffffa00 { | 149 | pioE: gpio@fffffa00 { |
@@ -149,6 +153,7 @@ | |||
149 | #gpio-cells = <2>; | 153 | #gpio-cells = <2>; |
150 | gpio-controller; | 154 | gpio-controller; |
151 | interrupt-controller; | 155 | interrupt-controller; |
156 | #interrupt-cells = <2>; | ||
152 | }; | 157 | }; |
153 | 158 | ||
154 | dbgu: serial@ffffee00 { | 159 | dbgu: serial@ffffee00 { |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index bfac0dfc332c..ef9336ae9614 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
@@ -107,6 +107,7 @@ | |||
107 | #gpio-cells = <2>; | 107 | #gpio-cells = <2>; |
108 | gpio-controller; | 108 | gpio-controller; |
109 | interrupt-controller; | 109 | interrupt-controller; |
110 | #interrupt-cells = <2>; | ||
110 | }; | 111 | }; |
111 | 112 | ||
112 | pioB: gpio@fffff600 { | 113 | pioB: gpio@fffff600 { |
@@ -116,6 +117,7 @@ | |||
116 | #gpio-cells = <2>; | 117 | #gpio-cells = <2>; |
117 | gpio-controller; | 118 | gpio-controller; |
118 | interrupt-controller; | 119 | interrupt-controller; |
120 | #interrupt-cells = <2>; | ||
119 | }; | 121 | }; |
120 | 122 | ||
121 | pioC: gpio@fffff800 { | 123 | pioC: gpio@fffff800 { |
@@ -125,6 +127,7 @@ | |||
125 | #gpio-cells = <2>; | 127 | #gpio-cells = <2>; |
126 | gpio-controller; | 128 | gpio-controller; |
127 | interrupt-controller; | 129 | interrupt-controller; |
130 | #interrupt-cells = <2>; | ||
128 | }; | 131 | }; |
129 | 132 | ||
130 | pioD: gpio@fffffa00 { | 133 | pioD: gpio@fffffa00 { |
@@ -134,6 +137,7 @@ | |||
134 | #gpio-cells = <2>; | 137 | #gpio-cells = <2>; |
135 | gpio-controller; | 138 | gpio-controller; |
136 | interrupt-controller; | 139 | interrupt-controller; |
140 | #interrupt-cells = <2>; | ||
137 | }; | 141 | }; |
138 | 142 | ||
139 | dbgu: serial@fffff200 { | 143 | dbgu: serial@fffff200 { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 4a18c393b136..8a387a8d61b7 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -115,6 +115,7 @@ | |||
115 | #gpio-cells = <2>; | 115 | #gpio-cells = <2>; |
116 | gpio-controller; | 116 | gpio-controller; |
117 | interrupt-controller; | 117 | interrupt-controller; |
118 | #interrupt-cells = <2>; | ||
118 | }; | 119 | }; |
119 | 120 | ||
120 | pioB: gpio@fffff600 { | 121 | pioB: gpio@fffff600 { |
@@ -124,6 +125,7 @@ | |||
124 | #gpio-cells = <2>; | 125 | #gpio-cells = <2>; |
125 | gpio-controller; | 126 | gpio-controller; |
126 | interrupt-controller; | 127 | interrupt-controller; |
128 | #interrupt-cells = <2>; | ||
127 | }; | 129 | }; |
128 | 130 | ||
129 | pioC: gpio@fffff800 { | 131 | pioC: gpio@fffff800 { |
@@ -133,6 +135,7 @@ | |||
133 | #gpio-cells = <2>; | 135 | #gpio-cells = <2>; |
134 | gpio-controller; | 136 | gpio-controller; |
135 | interrupt-controller; | 137 | interrupt-controller; |
138 | #interrupt-cells = <2>; | ||
136 | }; | 139 | }; |
137 | 140 | ||
138 | pioD: gpio@fffffa00 { | 141 | pioD: gpio@fffffa00 { |
@@ -142,6 +145,7 @@ | |||
142 | #gpio-cells = <2>; | 145 | #gpio-cells = <2>; |
143 | gpio-controller; | 146 | gpio-controller; |
144 | interrupt-controller; | 147 | interrupt-controller; |
148 | #interrupt-cells = <2>; | ||
145 | }; | 149 | }; |
146 | 150 | ||
147 | dbgu: serial@fffff200 { | 151 | dbgu: serial@fffff200 { |
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 0cab47d4a83f..2fde5fd1acce 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
@@ -404,6 +404,7 @@ | |||
404 | #define __NR_setns (__NR_SYSCALL_BASE+375) | 404 | #define __NR_setns (__NR_SYSCALL_BASE+375) |
405 | #define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) | 405 | #define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) |
406 | #define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) | 406 | #define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) |
407 | /* 378 for kcmp */ | ||
407 | 408 | ||
408 | /* | 409 | /* |
409 | * The following SWIs are ARM private. | 410 | * The following SWIs are ARM private. |
@@ -483,6 +484,7 @@ | |||
483 | */ | 484 | */ |
484 | #define __IGNORE_fadvise64_64 | 485 | #define __IGNORE_fadvise64_64 |
485 | #define __IGNORE_migrate_pages | 486 | #define __IGNORE_migrate_pages |
487 | #define __IGNORE_kcmp | ||
486 | 488 | ||
487 | #endif /* __KERNEL__ */ | 489 | #endif /* __KERNEL__ */ |
488 | #endif /* __ASM_ARM_UNISTD_H */ | 490 | #endif /* __ASM_ARM_UNISTD_H */ |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 463ff4a0ec8a..e337879595e5 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -387,6 +387,7 @@ | |||
387 | /* 375 */ CALL(sys_setns) | 387 | /* 375 */ CALL(sys_setns) |
388 | CALL(sys_process_vm_readv) | 388 | CALL(sys_process_vm_readv) |
389 | CALL(sys_process_vm_writev) | 389 | CALL(sys_process_vm_writev) |
390 | CALL(sys_ni_syscall) /* reserved for sys_kcmp */ | ||
390 | #ifndef syscalls_counted | 391 | #ifndef syscalls_counted |
391 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 392 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
392 | #define syscalls_counted | 393 | #define syscalls_counted |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index fef42b21cecb..e1f906989bb8 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/cpufreq.h> | ||
15 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
16 | #include <linux/device.h> | 15 | #include <linux/device.h> |
17 | #include <linux/err.h> | 16 | #include <linux/err.h> |
@@ -96,7 +95,52 @@ static void twd_timer_stop(struct clock_event_device *clk) | |||
96 | disable_percpu_irq(clk->irq); | 95 | disable_percpu_irq(clk->irq); |
97 | } | 96 | } |
98 | 97 | ||
99 | #ifdef CONFIG_CPU_FREQ | 98 | #ifdef CONFIG_COMMON_CLK |
99 | |||
100 | /* | ||
101 | * Updates clockevent frequency when the cpu frequency changes. | ||
102 | * Called on the cpu that is changing frequency with interrupts disabled. | ||
103 | */ | ||
104 | static void twd_update_frequency(void *new_rate) | ||
105 | { | ||
106 | twd_timer_rate = *((unsigned long *) new_rate); | ||
107 | |||
108 | clockevents_update_freq(*__this_cpu_ptr(twd_evt), twd_timer_rate); | ||
109 | } | ||
110 | |||
111 | static int twd_rate_change(struct notifier_block *nb, | ||
112 | unsigned long flags, void *data) | ||
113 | { | ||
114 | struct clk_notifier_data *cnd = data; | ||
115 | |||
116 | /* | ||
117 | * The twd clock events must be reprogrammed to account for the new | ||
118 | * frequency. The timer is local to a cpu, so cross-call to the | ||
119 | * changing cpu. | ||
120 | */ | ||
121 | if (flags == POST_RATE_CHANGE) | ||
122 | smp_call_function(twd_update_frequency, | ||
123 | (void *)&cnd->new_rate, 1); | ||
124 | |||
125 | return NOTIFY_OK; | ||
126 | } | ||
127 | |||
128 | static struct notifier_block twd_clk_nb = { | ||
129 | .notifier_call = twd_rate_change, | ||
130 | }; | ||
131 | |||
132 | static int twd_clk_init(void) | ||
133 | { | ||
134 | if (twd_evt && *__this_cpu_ptr(twd_evt) && !IS_ERR(twd_clk)) | ||
135 | return clk_notifier_register(twd_clk, &twd_clk_nb); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | core_initcall(twd_clk_init); | ||
140 | |||
141 | #elif defined (CONFIG_CPU_FREQ) | ||
142 | |||
143 | #include <linux/cpufreq.h> | ||
100 | 144 | ||
101 | /* | 145 | /* |
102 | * Updates clockevent frequency when the cpu frequency changes. | 146 | * Updates clockevent frequency when the cpu frequency changes. |
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index 4431a62fff5b..d20d4795f4ea 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c | |||
@@ -241,6 +241,6 @@ int __init mx25_clocks_init(void) | |||
241 | clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); | 241 | clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); |
242 | clk_register_clkdev(clk[iim_ipg], "iim", NULL); | 242 | clk_register_clkdev(clk[iim_ipg], "iim", NULL); |
243 | 243 | ||
244 | mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); | 244 | mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1); |
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c index 2c6ab3273f9e..5985ed1b8c98 100644 --- a/arch/arm/mach-imx/mach-armadillo5x0.c +++ b/arch/arm/mach-imx/mach-armadillo5x0.c | |||
@@ -526,7 +526,8 @@ static void __init armadillo5x0_init(void) | |||
526 | imx31_add_mxc_nand(&armadillo5x0_nand_board_info); | 526 | imx31_add_mxc_nand(&armadillo5x0_nand_board_info); |
527 | 527 | ||
528 | /* set NAND page size to 2k if not configured via boot mode pins */ | 528 | /* set NAND page size to 2k if not configured via boot mode pins */ |
529 | __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR); | 529 | __raw_writel(__raw_readl(mx3_ccm_base + MXC_CCM_RCSR) | |
530 | (1 << 30), mx3_ccm_base + MXC_CCM_RCSR); | ||
530 | 531 | ||
531 | /* RTC */ | 532 | /* RTC */ |
532 | /* Get RTC IRQ and register the chip */ | 533 | /* Get RTC IRQ and register the chip */ |
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 8dabfe81d07c..ff886e01a0b0 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
@@ -261,7 +261,7 @@ static void __init apx4devkit_init(void) | |||
261 | enable_clk_enet_out(); | 261 | enable_clk_enet_out(); |
262 | 262 | ||
263 | if (IS_BUILTIN(CONFIG_PHYLIB)) | 263 | if (IS_BUILTIN(CONFIG_PHYLIB)) |
264 | phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, | 264 | phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK, |
265 | apx4devkit_phy_fixup); | 265 | apx4devkit_phy_fixup); |
266 | 266 | ||
267 | mxsfb_pdata.mode_list = apx4devkit_video_modes; | 267 | mxsfb_pdata.mode_list = apx4devkit_video_modes; |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 410291c67666..a6cd14ab1e4e 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -204,6 +204,13 @@ void __init orion5x_wdt_init(void) | |||
204 | void __init orion5x_init_early(void) | 204 | void __init orion5x_init_early(void) |
205 | { | 205 | { |
206 | orion_time_set_base(TIMER_VIRT_BASE); | 206 | orion_time_set_base(TIMER_VIRT_BASE); |
207 | |||
208 | /* | ||
209 | * Some Orion5x devices allocate their coherent buffers from atomic | ||
210 | * context. Increase size of atomic coherent pool to make sure such | ||
211 | * the allocations won't fail. | ||
212 | */ | ||
213 | init_dma_coherent_pool_size(SZ_1M); | ||
207 | } | 214 | } |
208 | 215 | ||
209 | int orion5x_tclk; | 216 | int orion5x_tclk; |
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 53b7ea92c32c..3b8a0171c3cb 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -346,11 +346,11 @@ static struct resource sh_mmcif_resources[] = { | |||
346 | .flags = IORESOURCE_MEM, | 346 | .flags = IORESOURCE_MEM, |
347 | }, | 347 | }, |
348 | [1] = { | 348 | [1] = { |
349 | .start = gic_spi(141), | 349 | .start = gic_spi(140), |
350 | .flags = IORESOURCE_IRQ, | 350 | .flags = IORESOURCE_IRQ, |
351 | }, | 351 | }, |
352 | [2] = { | 352 | [2] = { |
353 | .start = gic_spi(140), | 353 | .start = gic_spi(141), |
354 | .flags = IORESOURCE_IRQ, | 354 | .flags = IORESOURCE_IRQ, |
355 | }, | 355 | }, |
356 | }; | 356 | }; |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e59c4ab71bcb..13f555d62491 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -346,6 +346,8 @@ static int __init atomic_pool_init(void) | |||
346 | (unsigned)pool->size / 1024); | 346 | (unsigned)pool->size / 1024); |
347 | return 0; | 347 | return 0; |
348 | } | 348 | } |
349 | |||
350 | kfree(pages); | ||
349 | no_pages: | 351 | no_pages: |
350 | kfree(bitmap); | 352 | kfree(bitmap); |
351 | no_bitmap: | 353 | no_bitmap: |
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h index 627d94f1b010..ec466400a200 100644 --- a/arch/arm/plat-mxc/include/mach/mx25.h +++ b/arch/arm/plat-mxc/include/mach/mx25.h | |||
@@ -98,6 +98,7 @@ | |||
98 | #define MX25_INT_UART1 (NR_IRQS_LEGACY + 45) | 98 | #define MX25_INT_UART1 (NR_IRQS_LEGACY + 45) |
99 | #define MX25_INT_GPIO2 (NR_IRQS_LEGACY + 51) | 99 | #define MX25_INT_GPIO2 (NR_IRQS_LEGACY + 51) |
100 | #define MX25_INT_GPIO1 (NR_IRQS_LEGACY + 52) | 100 | #define MX25_INT_GPIO1 (NR_IRQS_LEGACY + 52) |
101 | #define MX25_INT_GPT1 (NR_IRQS_LEGACY + 54) | ||
101 | #define MX25_INT_FEC (NR_IRQS_LEGACY + 57) | 102 | #define MX25_INT_FEC (NR_IRQS_LEGACY + 57) |
102 | 103 | ||
103 | #define MX25_DMA_REQ_SSI2_RX1 22 | 104 | #define MX25_DMA_REQ_SSI2_RX1 22 |
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 65c5eca475e7..d1116e2dfbea 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -144,6 +144,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate) | |||
144 | 144 | ||
145 | int clk_set_rate(struct clk *clk, unsigned long rate) | 145 | int clk_set_rate(struct clk *clk, unsigned long rate) |
146 | { | 146 | { |
147 | unsigned long flags; | ||
147 | int ret; | 148 | int ret; |
148 | 149 | ||
149 | if (IS_ERR(clk)) | 150 | if (IS_ERR(clk)) |
@@ -159,9 +160,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
159 | if (clk->ops == NULL || clk->ops->set_rate == NULL) | 160 | if (clk->ops == NULL || clk->ops->set_rate == NULL) |
160 | return -EINVAL; | 161 | return -EINVAL; |
161 | 162 | ||
162 | spin_lock(&clocks_lock); | 163 | spin_lock_irqsave(&clocks_lock, flags); |
163 | ret = (clk->ops->set_rate)(clk, rate); | 164 | ret = (clk->ops->set_rate)(clk, rate); |
164 | spin_unlock(&clocks_lock); | 165 | spin_unlock_irqrestore(&clocks_lock, flags); |
165 | 166 | ||
166 | return ret; | 167 | return ret; |
167 | } | 168 | } |
@@ -173,17 +174,18 @@ struct clk *clk_get_parent(struct clk *clk) | |||
173 | 174 | ||
174 | int clk_set_parent(struct clk *clk, struct clk *parent) | 175 | int clk_set_parent(struct clk *clk, struct clk *parent) |
175 | { | 176 | { |
177 | unsigned long flags; | ||
176 | int ret = 0; | 178 | int ret = 0; |
177 | 179 | ||
178 | if (IS_ERR(clk)) | 180 | if (IS_ERR(clk)) |
179 | return -EINVAL; | 181 | return -EINVAL; |
180 | 182 | ||
181 | spin_lock(&clocks_lock); | 183 | spin_lock_irqsave(&clocks_lock, flags); |
182 | 184 | ||
183 | if (clk->ops && clk->ops->set_parent) | 185 | if (clk->ops && clk->ops->set_parent) |
184 | ret = (clk->ops->set_parent)(clk, parent); | 186 | ret = (clk->ops->set_parent)(clk, parent); |
185 | 187 | ||
186 | spin_unlock(&clocks_lock); | 188 | spin_unlock_irqrestore(&clocks_lock, flags); |
187 | 189 | ||
188 | return ret; | 190 | return ret; |
189 | } | 191 | } |
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index 3af601e31e66..f08e89183cda 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
@@ -2,6 +2,7 @@ include include/asm-generic/Kbuild.asm | |||
2 | 2 | ||
3 | generic-y += atomic.h | 3 | generic-y += atomic.h |
4 | generic-y += auxvec.h | 4 | generic-y += auxvec.h |
5 | generic-y += barrier.h | ||
5 | generic-y += bitsperlong.h | 6 | generic-y += bitsperlong.h |
6 | generic-y += bugs.h | 7 | generic-y += bugs.h |
7 | generic-y += cputime.h | 8 | generic-y += cputime.h |
diff --git a/arch/c6x/include/asm/barrier.h b/arch/c6x/include/asm/barrier.h deleted file mode 100644 index 538240e85909..000000000000 --- a/arch/c6x/include/asm/barrier.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * Port on Texas Instruments TMS320C6x architecture | ||
3 | * | ||
4 | * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated | ||
5 | * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef _ASM_C6X_BARRIER_H | ||
12 | #define _ASM_C6X_BARRIER_H | ||
13 | |||
14 | #define nop() asm("NOP\n"); | ||
15 | |||
16 | #define mb() barrier() | ||
17 | #define rmb() barrier() | ||
18 | #define wmb() barrier() | ||
19 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
20 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
21 | |||
22 | #define smp_mb() barrier() | ||
23 | #define smp_rmb() barrier() | ||
24 | #define smp_wmb() barrier() | ||
25 | #define smp_read_barrier_depends() do { } while (0) | ||
26 | |||
27 | #endif /* _ASM_C6X_BARRIER_H */ | ||
diff --git a/arch/m68k/platform/coldfire/clk.c b/arch/m68k/platform/coldfire/clk.c index 75f9ee967ea7..9cd13b4ce42b 100644 --- a/arch/m68k/platform/coldfire/clk.c +++ b/arch/m68k/platform/coldfire/clk.c | |||
@@ -146,9 +146,3 @@ struct clk_ops clk_ops1 = { | |||
146 | }; | 146 | }; |
147 | #endif /* MCFPM_PPMCR1 */ | 147 | #endif /* MCFPM_PPMCR1 */ |
148 | #endif /* MCFPM_PPMCR0 */ | 148 | #endif /* MCFPM_PPMCR0 */ |
149 | |||
150 | struct clk *devm_clk_get(struct device *dev, const char *id) | ||
151 | { | ||
152 | return NULL; | ||
153 | } | ||
154 | EXPORT_SYMBOL(devm_clk_get); | ||
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c index e7e03ecf5495..afc379ca3753 100644 --- a/arch/mips/kernel/smp-cmp.c +++ b/arch/mips/kernel/smp-cmp.c | |||
@@ -102,7 +102,7 @@ static void cmp_init_secondary(void) | |||
102 | c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE; | 102 | c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE; |
103 | #endif | 103 | #endif |
104 | #ifdef CONFIG_MIPS_MT_SMTC | 104 | #ifdef CONFIG_MIPS_MT_SMTC |
105 | c->tc_id = (read_c0_tcbind() >> TCBIND_CURTC_SHIFT) & TCBIND_CURTC; | 105 | c->tc_id = (read_c0_tcbind() & TCBIND_CURTC) >> TCBIND_CURTC_SHIFT; |
106 | #endif | 106 | #endif |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c index 33aadbcf170b..dcfd573871c1 100644 --- a/arch/mips/mm/gup.c +++ b/arch/mips/mm/gup.c | |||
@@ -152,6 +152,8 @@ static int gup_huge_pud(pud_t pud, unsigned long addr, unsigned long end, | |||
152 | do { | 152 | do { |
153 | VM_BUG_ON(compound_head(page) != head); | 153 | VM_BUG_ON(compound_head(page) != head); |
154 | pages[*nr] = page; | 154 | pages[*nr] = page; |
155 | if (PageTail(page)) | ||
156 | get_huge_page_tail(page); | ||
155 | (*nr)++; | 157 | (*nr)++; |
156 | page++; | 158 | page++; |
157 | refs++; | 159 | refs++; |
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index 7b13a4caeea4..fea823f18479 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -273,16 +273,19 @@ asmlinkage void plat_irq_dispatch(void) | |||
273 | unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM; | 273 | unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM; |
274 | int irq; | 274 | int irq; |
275 | 275 | ||
276 | if (unlikely(!pending)) { | ||
277 | spurious_interrupt(); | ||
278 | return; | ||
279 | } | ||
280 | |||
276 | irq = irq_ffs(pending); | 281 | irq = irq_ffs(pending); |
277 | 282 | ||
278 | if (irq == MIPSCPU_INT_I8259A) | 283 | if (irq == MIPSCPU_INT_I8259A) |
279 | malta_hw0_irqdispatch(); | 284 | malta_hw0_irqdispatch(); |
280 | else if (gic_present && ((1 << irq) & ipi_map[smp_processor_id()])) | 285 | else if (gic_present && ((1 << irq) & ipi_map[smp_processor_id()])) |
281 | malta_ipi_irqdispatch(); | 286 | malta_ipi_irqdispatch(); |
282 | else if (irq >= 0) | ||
283 | do_IRQ(MIPS_CPU_IRQ_BASE + irq); | ||
284 | else | 287 | else |
285 | spurious_interrupt(); | 288 | do_IRQ(MIPS_CPU_IRQ_BASE + irq); |
286 | } | 289 | } |
287 | 290 | ||
288 | #ifdef CONFIG_MIPS_MT_SMP | 291 | #ifdef CONFIG_MIPS_MT_SMP |
diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c index 4c35301720e7..80562b81f0f2 100644 --- a/arch/mips/mti-malta/malta-platform.c +++ b/arch/mips/mti-malta/malta-platform.c | |||
@@ -138,11 +138,6 @@ static int __init malta_add_devices(void) | |||
138 | if (err) | 138 | if (err) |
139 | return err; | 139 | return err; |
140 | 140 | ||
141 | /* | ||
142 | * Set RTC to BCD mode to support current alarm code. | ||
143 | */ | ||
144 | CMOS_WRITE(CMOS_READ(RTC_CONTROL) & ~RTC_DM_BINARY, RTC_CONTROL); | ||
145 | |||
146 | return 0; | 141 | return 0; |
147 | } | 142 | } |
148 | 143 | ||
diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h index 799ed0f1643d..2d6e6e380564 100644 --- a/arch/s390/include/asm/hugetlb.h +++ b/arch/s390/include/asm/hugetlb.h | |||
@@ -66,16 +66,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) | |||
66 | return pte; | 66 | return pte; |
67 | } | 67 | } |
68 | 68 | ||
69 | static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, | ||
70 | unsigned long addr, pte_t *ptep) | ||
71 | { | ||
72 | pte_t pte = huge_ptep_get(ptep); | ||
73 | |||
74 | mm->context.flush_mm = 1; | ||
75 | pmd_clear((pmd_t *) ptep); | ||
76 | return pte; | ||
77 | } | ||
78 | |||
79 | static inline void __pmd_csp(pmd_t *pmdp) | 69 | static inline void __pmd_csp(pmd_t *pmdp) |
80 | { | 70 | { |
81 | register unsigned long reg2 asm("2") = pmd_val(*pmdp); | 71 | register unsigned long reg2 asm("2") = pmd_val(*pmdp); |
@@ -117,6 +107,15 @@ static inline void huge_ptep_invalidate(struct mm_struct *mm, | |||
117 | __pmd_csp(pmdp); | 107 | __pmd_csp(pmdp); |
118 | } | 108 | } |
119 | 109 | ||
110 | static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, | ||
111 | unsigned long addr, pte_t *ptep) | ||
112 | { | ||
113 | pte_t pte = huge_ptep_get(ptep); | ||
114 | |||
115 | huge_ptep_invalidate(mm, addr, ptep); | ||
116 | return pte; | ||
117 | } | ||
118 | |||
120 | #define huge_ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \ | 119 | #define huge_ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \ |
121 | ({ \ | 120 | ({ \ |
122 | int __changed = !pte_same(huge_ptep_get(__ptep), __entry); \ | 121 | int __changed = !pte_same(huge_ptep_get(__ptep), __entry); \ |
@@ -131,10 +130,7 @@ static inline void huge_ptep_invalidate(struct mm_struct *mm, | |||
131 | ({ \ | 130 | ({ \ |
132 | pte_t __pte = huge_ptep_get(__ptep); \ | 131 | pte_t __pte = huge_ptep_get(__ptep); \ |
133 | if (pte_write(__pte)) { \ | 132 | if (pte_write(__pte)) { \ |
134 | (__mm)->context.flush_mm = 1; \ | 133 | huge_ptep_invalidate(__mm, __addr, __ptep); \ |
135 | if (atomic_read(&(__mm)->context.attach_count) > 1 || \ | ||
136 | (__mm) != current->active_mm) \ | ||
137 | huge_ptep_invalidate(__mm, __addr, __ptep); \ | ||
138 | set_huge_pte_at(__mm, __addr, __ptep, \ | 134 | set_huge_pte_at(__mm, __addr, __ptep, \ |
139 | huge_pte_wrprotect(__pte)); \ | 135 | huge_pte_wrprotect(__pte)); \ |
140 | } \ | 136 | } \ |
diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h index 9fde315f3a7c..1d8fe2b17ef6 100644 --- a/arch/s390/include/asm/tlbflush.h +++ b/arch/s390/include/asm/tlbflush.h | |||
@@ -90,12 +90,10 @@ static inline void __tlb_flush_mm(struct mm_struct * mm) | |||
90 | 90 | ||
91 | static inline void __tlb_flush_mm_cond(struct mm_struct * mm) | 91 | static inline void __tlb_flush_mm_cond(struct mm_struct * mm) |
92 | { | 92 | { |
93 | spin_lock(&mm->page_table_lock); | ||
94 | if (mm->context.flush_mm) { | 93 | if (mm->context.flush_mm) { |
95 | __tlb_flush_mm(mm); | 94 | __tlb_flush_mm(mm); |
96 | mm->context.flush_mm = 0; | 95 | mm->context.flush_mm = 0; |
97 | } | 96 | } |
98 | spin_unlock(&mm->page_table_lock); | ||
99 | } | 97 | } |
100 | 98 | ||
101 | /* | 99 | /* |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index f86c81e13c37..40b57693de38 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -974,11 +974,13 @@ static void __init setup_hwcaps(void) | |||
974 | if (MACHINE_HAS_HPAGE) | 974 | if (MACHINE_HAS_HPAGE) |
975 | elf_hwcap |= HWCAP_S390_HPAGE; | 975 | elf_hwcap |= HWCAP_S390_HPAGE; |
976 | 976 | ||
977 | #if defined(CONFIG_64BIT) | ||
977 | /* | 978 | /* |
978 | * 64-bit register support for 31-bit processes | 979 | * 64-bit register support for 31-bit processes |
979 | * HWCAP_S390_HIGH_GPRS is bit 9. | 980 | * HWCAP_S390_HIGH_GPRS is bit 9. |
980 | */ | 981 | */ |
981 | elf_hwcap |= HWCAP_S390_HIGH_GPRS; | 982 | elf_hwcap |= HWCAP_S390_HIGH_GPRS; |
983 | #endif | ||
982 | 984 | ||
983 | get_cpu_id(&cpu_id); | 985 | get_cpu_id(&cpu_id); |
984 | switch (cpu_id.machine) { | 986 | switch (cpu_id.machine) { |
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index 60ee2b883797..2d37bb861faf 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c | |||
@@ -2,69 +2,82 @@ | |||
2 | * User access functions based on page table walks for enhanced | 2 | * User access functions based on page table walks for enhanced |
3 | * system layout without hardware support. | 3 | * system layout without hardware support. |
4 | * | 4 | * |
5 | * Copyright IBM Corp. 2006 | 5 | * Copyright IBM Corp. 2006, 2012 |
6 | * Author(s): Gerald Schaefer (gerald.schaefer@de.ibm.com) | 6 | * Author(s): Gerald Schaefer (gerald.schaefer@de.ibm.com) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
10 | #include <linux/hardirq.h> | 10 | #include <linux/hardirq.h> |
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/hugetlb.h> | ||
12 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
13 | #include <asm/futex.h> | 14 | #include <asm/futex.h> |
14 | #include "uaccess.h" | 15 | #include "uaccess.h" |
15 | 16 | ||
16 | static inline pte_t *follow_table(struct mm_struct *mm, unsigned long addr) | 17 | |
18 | /* | ||
19 | * Returns kernel address for user virtual address. If the returned address is | ||
20 | * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address | ||
21 | * contains the (negative) exception code. | ||
22 | */ | ||
23 | static __always_inline unsigned long follow_table(struct mm_struct *mm, | ||
24 | unsigned long addr, int write) | ||
17 | { | 25 | { |
18 | pgd_t *pgd; | 26 | pgd_t *pgd; |
19 | pud_t *pud; | 27 | pud_t *pud; |
20 | pmd_t *pmd; | 28 | pmd_t *pmd; |
29 | pte_t *ptep; | ||
21 | 30 | ||
22 | pgd = pgd_offset(mm, addr); | 31 | pgd = pgd_offset(mm, addr); |
23 | if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) | 32 | if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) |
24 | return (pte_t *) 0x3a; | 33 | return -0x3aUL; |
25 | 34 | ||
26 | pud = pud_offset(pgd, addr); | 35 | pud = pud_offset(pgd, addr); |
27 | if (pud_none(*pud) || unlikely(pud_bad(*pud))) | 36 | if (pud_none(*pud) || unlikely(pud_bad(*pud))) |
28 | return (pte_t *) 0x3b; | 37 | return -0x3bUL; |
29 | 38 | ||
30 | pmd = pmd_offset(pud, addr); | 39 | pmd = pmd_offset(pud, addr); |
31 | if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) | 40 | if (pmd_none(*pmd)) |
32 | return (pte_t *) 0x10; | 41 | return -0x10UL; |
42 | if (pmd_huge(*pmd)) { | ||
43 | if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO)) | ||
44 | return -0x04UL; | ||
45 | return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK); | ||
46 | } | ||
47 | if (unlikely(pmd_bad(*pmd))) | ||
48 | return -0x10UL; | ||
49 | |||
50 | ptep = pte_offset_map(pmd, addr); | ||
51 | if (!pte_present(*ptep)) | ||
52 | return -0x11UL; | ||
53 | if (write && !pte_write(*ptep)) | ||
54 | return -0x04UL; | ||
33 | 55 | ||
34 | return pte_offset_map(pmd, addr); | 56 | return (pte_val(*ptep) & PAGE_MASK) + (addr & ~PAGE_MASK); |
35 | } | 57 | } |
36 | 58 | ||
37 | static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, | 59 | static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, |
38 | size_t n, int write_user) | 60 | size_t n, int write_user) |
39 | { | 61 | { |
40 | struct mm_struct *mm = current->mm; | 62 | struct mm_struct *mm = current->mm; |
41 | unsigned long offset, pfn, done, size; | 63 | unsigned long offset, done, size, kaddr; |
42 | pte_t *pte; | ||
43 | void *from, *to; | 64 | void *from, *to; |
44 | 65 | ||
45 | done = 0; | 66 | done = 0; |
46 | retry: | 67 | retry: |
47 | spin_lock(&mm->page_table_lock); | 68 | spin_lock(&mm->page_table_lock); |
48 | do { | 69 | do { |
49 | pte = follow_table(mm, uaddr); | 70 | kaddr = follow_table(mm, uaddr, write_user); |
50 | if ((unsigned long) pte < 0x1000) | 71 | if (IS_ERR_VALUE(kaddr)) |
51 | goto fault; | 72 | goto fault; |
52 | if (!pte_present(*pte)) { | ||
53 | pte = (pte_t *) 0x11; | ||
54 | goto fault; | ||
55 | } else if (write_user && !pte_write(*pte)) { | ||
56 | pte = (pte_t *) 0x04; | ||
57 | goto fault; | ||
58 | } | ||
59 | 73 | ||
60 | pfn = pte_pfn(*pte); | 74 | offset = uaddr & ~PAGE_MASK; |
61 | offset = uaddr & (PAGE_SIZE - 1); | ||
62 | size = min(n - done, PAGE_SIZE - offset); | 75 | size = min(n - done, PAGE_SIZE - offset); |
63 | if (write_user) { | 76 | if (write_user) { |
64 | to = (void *)((pfn << PAGE_SHIFT) + offset); | 77 | to = (void *) kaddr; |
65 | from = kptr + done; | 78 | from = kptr + done; |
66 | } else { | 79 | } else { |
67 | from = (void *)((pfn << PAGE_SHIFT) + offset); | 80 | from = (void *) kaddr; |
68 | to = kptr + done; | 81 | to = kptr + done; |
69 | } | 82 | } |
70 | memcpy(to, from, size); | 83 | memcpy(to, from, size); |
@@ -75,7 +88,7 @@ retry: | |||
75 | return n - done; | 88 | return n - done; |
76 | fault: | 89 | fault: |
77 | spin_unlock(&mm->page_table_lock); | 90 | spin_unlock(&mm->page_table_lock); |
78 | if (__handle_fault(uaddr, (unsigned long) pte, write_user)) | 91 | if (__handle_fault(uaddr, -kaddr, write_user)) |
79 | return n - done; | 92 | return n - done; |
80 | goto retry; | 93 | goto retry; |
81 | } | 94 | } |
@@ -84,27 +97,22 @@ fault: | |||
84 | * Do DAT for user address by page table walk, return kernel address. | 97 | * Do DAT for user address by page table walk, return kernel address. |
85 | * This function needs to be called with current->mm->page_table_lock held. | 98 | * This function needs to be called with current->mm->page_table_lock held. |
86 | */ | 99 | */ |
87 | static __always_inline unsigned long __dat_user_addr(unsigned long uaddr) | 100 | static __always_inline unsigned long __dat_user_addr(unsigned long uaddr, |
101 | int write) | ||
88 | { | 102 | { |
89 | struct mm_struct *mm = current->mm; | 103 | struct mm_struct *mm = current->mm; |
90 | unsigned long pfn; | 104 | unsigned long kaddr; |
91 | pte_t *pte; | ||
92 | int rc; | 105 | int rc; |
93 | 106 | ||
94 | retry: | 107 | retry: |
95 | pte = follow_table(mm, uaddr); | 108 | kaddr = follow_table(mm, uaddr, write); |
96 | if ((unsigned long) pte < 0x1000) | 109 | if (IS_ERR_VALUE(kaddr)) |
97 | goto fault; | ||
98 | if (!pte_present(*pte)) { | ||
99 | pte = (pte_t *) 0x11; | ||
100 | goto fault; | 110 | goto fault; |
101 | } | ||
102 | 111 | ||
103 | pfn = pte_pfn(*pte); | 112 | return kaddr; |
104 | return (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1)); | ||
105 | fault: | 113 | fault: |
106 | spin_unlock(&mm->page_table_lock); | 114 | spin_unlock(&mm->page_table_lock); |
107 | rc = __handle_fault(uaddr, (unsigned long) pte, 0); | 115 | rc = __handle_fault(uaddr, -kaddr, write); |
108 | spin_lock(&mm->page_table_lock); | 116 | spin_lock(&mm->page_table_lock); |
109 | if (!rc) | 117 | if (!rc) |
110 | goto retry; | 118 | goto retry; |
@@ -159,11 +167,9 @@ static size_t clear_user_pt(size_t n, void __user *to) | |||
159 | 167 | ||
160 | static size_t strnlen_user_pt(size_t count, const char __user *src) | 168 | static size_t strnlen_user_pt(size_t count, const char __user *src) |
161 | { | 169 | { |
162 | char *addr; | ||
163 | unsigned long uaddr = (unsigned long) src; | 170 | unsigned long uaddr = (unsigned long) src; |
164 | struct mm_struct *mm = current->mm; | 171 | struct mm_struct *mm = current->mm; |
165 | unsigned long offset, pfn, done, len; | 172 | unsigned long offset, done, len, kaddr; |
166 | pte_t *pte; | ||
167 | size_t len_str; | 173 | size_t len_str; |
168 | 174 | ||
169 | if (segment_eq(get_fs(), KERNEL_DS)) | 175 | if (segment_eq(get_fs(), KERNEL_DS)) |
@@ -172,19 +178,13 @@ static size_t strnlen_user_pt(size_t count, const char __user *src) | |||
172 | retry: | 178 | retry: |
173 | spin_lock(&mm->page_table_lock); | 179 | spin_lock(&mm->page_table_lock); |
174 | do { | 180 | do { |
175 | pte = follow_table(mm, uaddr); | 181 | kaddr = follow_table(mm, uaddr, 0); |
176 | if ((unsigned long) pte < 0x1000) | 182 | if (IS_ERR_VALUE(kaddr)) |
177 | goto fault; | ||
178 | if (!pte_present(*pte)) { | ||
179 | pte = (pte_t *) 0x11; | ||
180 | goto fault; | 183 | goto fault; |
181 | } | ||
182 | 184 | ||
183 | pfn = pte_pfn(*pte); | 185 | offset = uaddr & ~PAGE_MASK; |
184 | offset = uaddr & (PAGE_SIZE-1); | ||
185 | addr = (char *)(pfn << PAGE_SHIFT) + offset; | ||
186 | len = min(count - done, PAGE_SIZE - offset); | 186 | len = min(count - done, PAGE_SIZE - offset); |
187 | len_str = strnlen(addr, len); | 187 | len_str = strnlen((char *) kaddr, len); |
188 | done += len_str; | 188 | done += len_str; |
189 | uaddr += len_str; | 189 | uaddr += len_str; |
190 | } while ((len_str == len) && (done < count)); | 190 | } while ((len_str == len) && (done < count)); |
@@ -192,7 +192,7 @@ retry: | |||
192 | return done + 1; | 192 | return done + 1; |
193 | fault: | 193 | fault: |
194 | spin_unlock(&mm->page_table_lock); | 194 | spin_unlock(&mm->page_table_lock); |
195 | if (__handle_fault(uaddr, (unsigned long) pte, 0)) | 195 | if (__handle_fault(uaddr, -kaddr, 0)) |
196 | return 0; | 196 | return 0; |
197 | goto retry; | 197 | goto retry; |
198 | } | 198 | } |
@@ -225,11 +225,10 @@ static size_t copy_in_user_pt(size_t n, void __user *to, | |||
225 | const void __user *from) | 225 | const void __user *from) |
226 | { | 226 | { |
227 | struct mm_struct *mm = current->mm; | 227 | struct mm_struct *mm = current->mm; |
228 | unsigned long offset_from, offset_to, offset_max, pfn_from, pfn_to, | 228 | unsigned long offset_max, uaddr, done, size, error_code; |
229 | uaddr, done, size, error_code; | ||
230 | unsigned long uaddr_from = (unsigned long) from; | 229 | unsigned long uaddr_from = (unsigned long) from; |
231 | unsigned long uaddr_to = (unsigned long) to; | 230 | unsigned long uaddr_to = (unsigned long) to; |
232 | pte_t *pte_from, *pte_to; | 231 | unsigned long kaddr_to, kaddr_from; |
233 | int write_user; | 232 | int write_user; |
234 | 233 | ||
235 | if (segment_eq(get_fs(), KERNEL_DS)) { | 234 | if (segment_eq(get_fs(), KERNEL_DS)) { |
@@ -242,38 +241,23 @@ retry: | |||
242 | do { | 241 | do { |
243 | write_user = 0; | 242 | write_user = 0; |
244 | uaddr = uaddr_from; | 243 | uaddr = uaddr_from; |
245 | pte_from = follow_table(mm, uaddr_from); | 244 | kaddr_from = follow_table(mm, uaddr_from, 0); |
246 | error_code = (unsigned long) pte_from; | 245 | error_code = kaddr_from; |
247 | if (error_code < 0x1000) | 246 | if (IS_ERR_VALUE(error_code)) |
248 | goto fault; | ||
249 | if (!pte_present(*pte_from)) { | ||
250 | error_code = 0x11; | ||
251 | goto fault; | 247 | goto fault; |
252 | } | ||
253 | 248 | ||
254 | write_user = 1; | 249 | write_user = 1; |
255 | uaddr = uaddr_to; | 250 | uaddr = uaddr_to; |
256 | pte_to = follow_table(mm, uaddr_to); | 251 | kaddr_to = follow_table(mm, uaddr_to, 1); |
257 | error_code = (unsigned long) pte_to; | 252 | error_code = (unsigned long) kaddr_to; |
258 | if (error_code < 0x1000) | 253 | if (IS_ERR_VALUE(error_code)) |
259 | goto fault; | ||
260 | if (!pte_present(*pte_to)) { | ||
261 | error_code = 0x11; | ||
262 | goto fault; | 254 | goto fault; |
263 | } else if (!pte_write(*pte_to)) { | ||
264 | error_code = 0x04; | ||
265 | goto fault; | ||
266 | } | ||
267 | 255 | ||
268 | pfn_from = pte_pfn(*pte_from); | 256 | offset_max = max(uaddr_from & ~PAGE_MASK, |
269 | pfn_to = pte_pfn(*pte_to); | 257 | uaddr_to & ~PAGE_MASK); |
270 | offset_from = uaddr_from & (PAGE_SIZE-1); | ||
271 | offset_to = uaddr_from & (PAGE_SIZE-1); | ||
272 | offset_max = max(offset_from, offset_to); | ||
273 | size = min(n - done, PAGE_SIZE - offset_max); | 258 | size = min(n - done, PAGE_SIZE - offset_max); |
274 | 259 | ||
275 | memcpy((void *)(pfn_to << PAGE_SHIFT) + offset_to, | 260 | memcpy((void *) kaddr_to, (void *) kaddr_from, size); |
276 | (void *)(pfn_from << PAGE_SHIFT) + offset_from, size); | ||
277 | done += size; | 261 | done += size; |
278 | uaddr_from += size; | 262 | uaddr_from += size; |
279 | uaddr_to += size; | 263 | uaddr_to += size; |
@@ -282,7 +266,7 @@ retry: | |||
282 | return n - done; | 266 | return n - done; |
283 | fault: | 267 | fault: |
284 | spin_unlock(&mm->page_table_lock); | 268 | spin_unlock(&mm->page_table_lock); |
285 | if (__handle_fault(uaddr, error_code, write_user)) | 269 | if (__handle_fault(uaddr, -error_code, write_user)) |
286 | return n - done; | 270 | return n - done; |
287 | goto retry; | 271 | goto retry; |
288 | } | 272 | } |
@@ -341,7 +325,7 @@ int futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old) | |||
341 | return __futex_atomic_op_pt(op, uaddr, oparg, old); | 325 | return __futex_atomic_op_pt(op, uaddr, oparg, old); |
342 | spin_lock(¤t->mm->page_table_lock); | 326 | spin_lock(¤t->mm->page_table_lock); |
343 | uaddr = (u32 __force __user *) | 327 | uaddr = (u32 __force __user *) |
344 | __dat_user_addr((__force unsigned long) uaddr); | 328 | __dat_user_addr((__force unsigned long) uaddr, 1); |
345 | if (!uaddr) { | 329 | if (!uaddr) { |
346 | spin_unlock(¤t->mm->page_table_lock); | 330 | spin_unlock(¤t->mm->page_table_lock); |
347 | return -EFAULT; | 331 | return -EFAULT; |
@@ -378,7 +362,7 @@ int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr, | |||
378 | return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval); | 362 | return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval); |
379 | spin_lock(¤t->mm->page_table_lock); | 363 | spin_lock(¤t->mm->page_table_lock); |
380 | uaddr = (u32 __force __user *) | 364 | uaddr = (u32 __force __user *) |
381 | __dat_user_addr((__force unsigned long) uaddr); | 365 | __dat_user_addr((__force unsigned long) uaddr, 1); |
382 | if (!uaddr) { | 366 | if (!uaddr) { |
383 | spin_unlock(¤t->mm->page_table_lock); | 367 | spin_unlock(¤t->mm->page_table_lock); |
384 | return -EFAULT; | 368 | return -EFAULT; |
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S index b7cf6a547f11..7e605b95592a 100644 --- a/arch/sh/kernel/cpu/sh5/entry.S +++ b/arch/sh/kernel/cpu/sh5/entry.S | |||
@@ -933,7 +933,7 @@ ret_with_reschedule: | |||
933 | 933 | ||
934 | pta restore_all, tr1 | 934 | pta restore_all, tr1 |
935 | 935 | ||
936 | movi _TIF_SIGPENDING, r8 | 936 | movi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), r8 |
937 | and r8, r7, r8 | 937 | and r8, r7, r8 |
938 | pta work_notifysig, tr0 | 938 | pta work_notifysig, tr0 |
939 | bne r8, ZERO, tr0 | 939 | bne r8, ZERO, tr0 |
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S index f67601cb3f1f..b96489d8b27d 100644 --- a/arch/sh/kernel/entry-common.S +++ b/arch/sh/kernel/entry-common.S | |||
@@ -139,7 +139,7 @@ work_pending: | |||
139 | ! r8: current_thread_info | 139 | ! r8: current_thread_info |
140 | ! t: result of "tst #_TIF_NEED_RESCHED, r0" | 140 | ! t: result of "tst #_TIF_NEED_RESCHED, r0" |
141 | bf/s work_resched | 141 | bf/s work_resched |
142 | tst #_TIF_SIGPENDING, r0 | 142 | tst #(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME), r0 |
143 | work_notifysig: | 143 | work_notifysig: |
144 | bt/s __restore_all | 144 | bt/s __restore_all |
145 | mov r15, r4 | 145 | mov r15, r4 |
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 15e0a1693976..f1ddc0d23679 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c | |||
@@ -48,9 +48,7 @@ void *module_alloc(unsigned long size) | |||
48 | return NULL; | 48 | return NULL; |
49 | 49 | ||
50 | ret = module_map(size); | 50 | ret = module_map(size); |
51 | if (!ret) | 51 | if (ret) |
52 | ret = ERR_PTR(-ENOMEM); | ||
53 | else | ||
54 | memset(ret, 0, size); | 52 | memset(ret, 0, size); |
55 | 53 | ||
56 | return ret; | 54 | return ret; |
@@ -116,6 +114,10 @@ int apply_relocate_add(Elf_Shdr *sechdrs, | |||
116 | v = sym->st_value + rel[i].r_addend; | 114 | v = sym->st_value + rel[i].r_addend; |
117 | 115 | ||
118 | switch (ELF_R_TYPE(rel[i].r_info) & 0xff) { | 116 | switch (ELF_R_TYPE(rel[i].r_info) & 0xff) { |
117 | case R_SPARC_DISP32: | ||
118 | v -= (Elf_Addr) location; | ||
119 | *loc32 = v; | ||
120 | break; | ||
119 | #ifdef CONFIG_SPARC64 | 121 | #ifdef CONFIG_SPARC64 |
120 | case R_SPARC_64: | 122 | case R_SPARC_64: |
121 | location[0] = v >> 56; | 123 | location[0] = v >> 56; |
@@ -128,11 +130,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, | |||
128 | location[7] = v >> 0; | 130 | location[7] = v >> 0; |
129 | break; | 131 | break; |
130 | 132 | ||
131 | case R_SPARC_DISP32: | ||
132 | v -= (Elf_Addr) location; | ||
133 | *loc32 = v; | ||
134 | break; | ||
135 | |||
136 | case R_SPARC_WDISP19: | 133 | case R_SPARC_WDISP19: |
137 | v -= (Elf_Addr) location; | 134 | v -= (Elf_Addr) location; |
138 | *loc32 = (*loc32 & ~0x7ffff) | | 135 | *loc32 = (*loc32 & ~0x7ffff) | |
diff --git a/arch/tile/include/gxio/iorpc_trio.h b/arch/tile/include/gxio/iorpc_trio.h index 15fb77992083..58105c31228b 100644 --- a/arch/tile/include/gxio/iorpc_trio.h +++ b/arch/tile/include/gxio/iorpc_trio.h | |||
@@ -25,21 +25,23 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
27 | 27 | ||
28 | #define GXIO_TRIO_OP_ALLOC_ASIDS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1400) | 28 | #define GXIO_TRIO_OP_DEALLOC_ASID IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1400) |
29 | #define GXIO_TRIO_OP_ALLOC_ASIDS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1401) | ||
29 | 30 | ||
30 | #define GXIO_TRIO_OP_ALLOC_MEMORY_MAPS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1402) | 31 | #define GXIO_TRIO_OP_ALLOC_MEMORY_MAPS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1404) |
31 | 32 | ||
32 | #define GXIO_TRIO_OP_ALLOC_PIO_REGIONS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x140e) | 33 | #define GXIO_TRIO_OP_ALLOC_PIO_REGIONS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1412) |
33 | #define GXIO_TRIO_OP_INIT_PIO_REGION_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x140f) | ||
34 | 34 | ||
35 | #define GXIO_TRIO_OP_INIT_MEMORY_MAP_MMU_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1417) | 35 | #define GXIO_TRIO_OP_INIT_PIO_REGION_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1414) |
36 | #define GXIO_TRIO_OP_GET_PORT_PROPERTY IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1418) | ||
37 | #define GXIO_TRIO_OP_CONFIG_LEGACY_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x1419) | ||
38 | #define GXIO_TRIO_OP_CONFIG_MSI_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x141a) | ||
39 | 36 | ||
40 | #define GXIO_TRIO_OP_SET_MPS_MRS IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141c) | 37 | #define GXIO_TRIO_OP_INIT_MEMORY_MAP_MMU_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141e) |
41 | #define GXIO_TRIO_OP_FORCE_RC_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141d) | 38 | #define GXIO_TRIO_OP_GET_PORT_PROPERTY IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141f) |
42 | #define GXIO_TRIO_OP_FORCE_EP_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x141e) | 39 | #define GXIO_TRIO_OP_CONFIG_LEGACY_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x1420) |
40 | #define GXIO_TRIO_OP_CONFIG_MSI_INTR IORPC_OPCODE(IORPC_FORMAT_KERNEL_INTERRUPT, 0x1421) | ||
41 | |||
42 | #define GXIO_TRIO_OP_SET_MPS_MRS IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1423) | ||
43 | #define GXIO_TRIO_OP_FORCE_RC_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1424) | ||
44 | #define GXIO_TRIO_OP_FORCE_EP_LINK_UP IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1425) | ||
43 | #define GXIO_TRIO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) | 45 | #define GXIO_TRIO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) |
44 | #define GXIO_TRIO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) | 46 | #define GXIO_TRIO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001) |
45 | 47 | ||
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h index 69f1c57a8d0d..33a6a2423bd2 100644 --- a/arch/um/include/asm/processor-generic.h +++ b/arch/um/include/asm/processor-generic.h | |||
@@ -20,14 +20,6 @@ struct mm_struct; | |||
20 | 20 | ||
21 | struct thread_struct { | 21 | struct thread_struct { |
22 | struct task_struct *saved_task; | 22 | struct task_struct *saved_task; |
23 | /* | ||
24 | * This flag is set to 1 before calling do_fork (and analyzed in | ||
25 | * copy_thread) to mark that we are begin called from userspace (fork / | ||
26 | * vfork / clone), and reset to 0 after. It is left to 0 when called | ||
27 | * from kernelspace (i.e. kernel_thread() or fork_idle(), | ||
28 | * as of 2.6.11). | ||
29 | */ | ||
30 | int forking; | ||
31 | struct pt_regs regs; | 23 | struct pt_regs regs; |
32 | int singlestep_syscall; | 24 | int singlestep_syscall; |
33 | void *fault_addr; | 25 | void *fault_addr; |
@@ -58,7 +50,6 @@ struct thread_struct { | |||
58 | 50 | ||
59 | #define INIT_THREAD \ | 51 | #define INIT_THREAD \ |
60 | { \ | 52 | { \ |
61 | .forking = 0, \ | ||
62 | .regs = EMPTY_REGS, \ | 53 | .regs = EMPTY_REGS, \ |
63 | .fault_addr = NULL, \ | 54 | .fault_addr = NULL, \ |
64 | .prev_sched = NULL, \ | 55 | .prev_sched = NULL, \ |
diff --git a/arch/um/include/shared/common-offsets.h b/arch/um/include/shared/common-offsets.h index 40db8f71deae..2df313b6a586 100644 --- a/arch/um/include/shared/common-offsets.h +++ b/arch/um/include/shared/common-offsets.h | |||
@@ -7,16 +7,6 @@ DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK); | |||
7 | DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT); | 7 | DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT); |
8 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); | 8 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); |
9 | 9 | ||
10 | DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); | ||
11 | DEFINE_STR(UM_KERN_ALERT, KERN_ALERT); | ||
12 | DEFINE_STR(UM_KERN_CRIT, KERN_CRIT); | ||
13 | DEFINE_STR(UM_KERN_ERR, KERN_ERR); | ||
14 | DEFINE_STR(UM_KERN_WARNING, KERN_WARNING); | ||
15 | DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE); | ||
16 | DEFINE_STR(UM_KERN_INFO, KERN_INFO); | ||
17 | DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG); | ||
18 | DEFINE_STR(UM_KERN_CONT, KERN_CONT); | ||
19 | |||
20 | DEFINE(UM_ELF_CLASS, ELF_CLASS); | 10 | DEFINE(UM_ELF_CLASS, ELF_CLASS); |
21 | DEFINE(UM_ELFCLASS32, ELFCLASS32); | 11 | DEFINE(UM_ELFCLASS32, ELFCLASS32); |
22 | DEFINE(UM_ELFCLASS64, ELFCLASS64); | 12 | DEFINE(UM_ELFCLASS64, ELFCLASS64); |
diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h index 4fa82c055aab..cef068563336 100644 --- a/arch/um/include/shared/user.h +++ b/arch/um/include/shared/user.h | |||
@@ -26,6 +26,17 @@ | |||
26 | extern void panic(const char *fmt, ...) | 26 | extern void panic(const char *fmt, ...) |
27 | __attribute__ ((format (printf, 1, 2))); | 27 | __attribute__ ((format (printf, 1, 2))); |
28 | 28 | ||
29 | /* Requires preincluding include/linux/kern_levels.h */ | ||
30 | #define UM_KERN_EMERG KERN_EMERG | ||
31 | #define UM_KERN_ALERT KERN_ALERT | ||
32 | #define UM_KERN_CRIT KERN_CRIT | ||
33 | #define UM_KERN_ERR KERN_ERR | ||
34 | #define UM_KERN_WARNING KERN_WARNING | ||
35 | #define UM_KERN_NOTICE KERN_NOTICE | ||
36 | #define UM_KERN_INFO KERN_INFO | ||
37 | #define UM_KERN_DEBUG KERN_DEBUG | ||
38 | #define UM_KERN_CONT KERN_CONT | ||
39 | |||
29 | #ifdef UML_CONFIG_PRINTK | 40 | #ifdef UML_CONFIG_PRINTK |
30 | extern int printk(const char *fmt, ...) | 41 | extern int printk(const char *fmt, ...) |
31 | __attribute__ ((format (printf, 1, 2))); | 42 | __attribute__ ((format (printf, 1, 2))); |
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 6cade9366364..8c82786da823 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -39,34 +39,21 @@ void flush_thread(void) | |||
39 | 39 | ||
40 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | 40 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) |
41 | { | 41 | { |
42 | get_safe_registers(regs->regs.gp, regs->regs.fp); | ||
42 | PT_REGS_IP(regs) = eip; | 43 | PT_REGS_IP(regs) = eip; |
43 | PT_REGS_SP(regs) = esp; | 44 | PT_REGS_SP(regs) = esp; |
44 | } | 45 | current->ptrace &= ~PT_DTRACE; |
45 | EXPORT_SYMBOL(start_thread); | ||
46 | |||
47 | static long execve1(const char *file, | ||
48 | const char __user *const __user *argv, | ||
49 | const char __user *const __user *env) | ||
50 | { | ||
51 | long error; | ||
52 | |||
53 | error = do_execve(file, argv, env, ¤t->thread.regs); | ||
54 | if (error == 0) { | ||
55 | task_lock(current); | ||
56 | current->ptrace &= ~PT_DTRACE; | ||
57 | #ifdef SUBARCH_EXECVE1 | 46 | #ifdef SUBARCH_EXECVE1 |
58 | SUBARCH_EXECVE1(¤t->thread.regs.regs); | 47 | SUBARCH_EXECVE1(regs->regs); |
59 | #endif | 48 | #endif |
60 | task_unlock(current); | ||
61 | } | ||
62 | return error; | ||
63 | } | 49 | } |
50 | EXPORT_SYMBOL(start_thread); | ||
64 | 51 | ||
65 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) | 52 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) |
66 | { | 53 | { |
67 | long err; | 54 | long err; |
68 | 55 | ||
69 | err = execve1(file, argv, env); | 56 | err = do_execve(file, argv, env, ¤t->thread.regs); |
70 | if (!err) | 57 | if (!err) |
71 | UML_LONGJMP(current->thread.exec_buf, 1); | 58 | UML_LONGJMP(current->thread.exec_buf, 1); |
72 | return err; | 59 | return err; |
@@ -81,7 +68,7 @@ long sys_execve(const char __user *file, const char __user *const __user *argv, | |||
81 | filename = getname(file); | 68 | filename = getname(file); |
82 | error = PTR_ERR(filename); | 69 | error = PTR_ERR(filename); |
83 | if (IS_ERR(filename)) goto out; | 70 | if (IS_ERR(filename)) goto out; |
84 | error = execve1(filename, argv, env); | 71 | error = do_execve(filename, argv, env, ¤t->thread.regs); |
85 | putname(filename); | 72 | putname(filename); |
86 | out: | 73 | out: |
87 | return error; | 74 | return error; |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 57fc7028714a..c5f5afa50745 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -181,11 +181,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
181 | struct pt_regs *regs) | 181 | struct pt_regs *regs) |
182 | { | 182 | { |
183 | void (*handler)(void); | 183 | void (*handler)(void); |
184 | int kthread = current->flags & PF_KTHREAD; | ||
184 | int ret = 0; | 185 | int ret = 0; |
185 | 186 | ||
186 | p->thread = (struct thread_struct) INIT_THREAD; | 187 | p->thread = (struct thread_struct) INIT_THREAD; |
187 | 188 | ||
188 | if (current->thread.forking) { | 189 | if (!kthread) { |
189 | memcpy(&p->thread.regs.regs, ®s->regs, | 190 | memcpy(&p->thread.regs.regs, ®s->regs, |
190 | sizeof(p->thread.regs.regs)); | 191 | sizeof(p->thread.regs.regs)); |
191 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); | 192 | PT_REGS_SET_SYSCALL_RETURN(&p->thread.regs, 0); |
@@ -195,8 +196,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
195 | handler = fork_handler; | 196 | handler = fork_handler; |
196 | 197 | ||
197 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); | 198 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); |
198 | } | 199 | } else { |
199 | else { | ||
200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); | 200 | get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); |
201 | p->thread.request.u.thread = current->thread.request.u.thread; | 201 | p->thread.request.u.thread = current->thread.request.u.thread; |
202 | handler = new_thread_handler; | 202 | handler = new_thread_handler; |
@@ -204,7 +204,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
204 | 204 | ||
205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); | 205 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); |
206 | 206 | ||
207 | if (current->thread.forking) { | 207 | if (!kthread) { |
208 | clear_flushed_tls(p); | 208 | clear_flushed_tls(p); |
209 | 209 | ||
210 | /* | 210 | /* |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 7362d58efc29..cc9c2350e417 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -22,9 +22,13 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
22 | struct k_sigaction *ka, siginfo_t *info) | 22 | struct k_sigaction *ka, siginfo_t *info) |
23 | { | 23 | { |
24 | sigset_t *oldset = sigmask_to_save(); | 24 | sigset_t *oldset = sigmask_to_save(); |
25 | int singlestep = 0; | ||
25 | unsigned long sp; | 26 | unsigned long sp; |
26 | int err; | 27 | int err; |
27 | 28 | ||
29 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
30 | singlestep = 1; | ||
31 | |||
28 | /* Did we come from a system call? */ | 32 | /* Did we come from a system call? */ |
29 | if (PT_REGS_SYSCALL_NR(regs) >= 0) { | 33 | if (PT_REGS_SYSCALL_NR(regs) >= 0) { |
30 | /* If so, check system call restarting.. */ | 34 | /* If so, check system call restarting.. */ |
@@ -61,7 +65,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
61 | if (err) | 65 | if (err) |
62 | force_sigsegv(signr, current); | 66 | force_sigsegv(signr, current); |
63 | else | 67 | else |
64 | signal_delivered(signr, info, ka, regs, 0); | 68 | signal_delivered(signr, info, ka, regs, singlestep); |
65 | } | 69 | } |
66 | 70 | ||
67 | static int kern_do_signal(struct pt_regs *regs) | 71 | static int kern_do_signal(struct pt_regs *regs) |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index f958cb876ee3..a4c6d8eee74c 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -17,25 +17,25 @@ | |||
17 | 17 | ||
18 | long sys_fork(void) | 18 | long sys_fork(void) |
19 | { | 19 | { |
20 | long ret; | 20 | return do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), |
21 | |||
22 | current->thread.forking = 1; | ||
23 | ret = do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), | ||
24 | ¤t->thread.regs, 0, NULL, NULL); | 21 | ¤t->thread.regs, 0, NULL, NULL); |
25 | current->thread.forking = 0; | ||
26 | return ret; | ||
27 | } | 22 | } |
28 | 23 | ||
29 | long sys_vfork(void) | 24 | long sys_vfork(void) |
30 | { | 25 | { |
31 | long ret; | 26 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
32 | |||
33 | current->thread.forking = 1; | ||
34 | ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, | ||
35 | UPT_SP(¤t->thread.regs.regs), | 27 | UPT_SP(¤t->thread.regs.regs), |
36 | ¤t->thread.regs, 0, NULL, NULL); | 28 | ¤t->thread.regs, 0, NULL, NULL); |
37 | current->thread.forking = 0; | 29 | } |
38 | return ret; | 30 | |
31 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
32 | void __user *parent_tid, void __user *child_tid) | ||
33 | { | ||
34 | if (!newsp) | ||
35 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
36 | |||
37 | return do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
38 | child_tid); | ||
39 | } | 39 | } |
40 | 40 | ||
41 | long old_mmap(unsigned long addr, unsigned long len, | 41 | long old_mmap(unsigned long addr, unsigned long len, |
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules index d50270d26b42..15889df9b466 100644 --- a/arch/um/scripts/Makefile.rules +++ b/arch/um/scripts/Makefile.rules | |||
@@ -8,7 +8,7 @@ USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) | |||
8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) | 8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) |
9 | 9 | ||
10 | $(USER_OBJS:.o=.%): \ | 10 | $(USER_OBJS:.o=.%): \ |
11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h $(CFLAGS_$(basetarget).o) | 11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o) |
12 | 12 | ||
13 | # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of | 13 | # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of |
14 | # using it directly. | 14 | # using it directly. |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 8ec3a1aa4abd..50a1d1f9b6d3 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -746,10 +746,10 @@ config SWIOTLB | |||
746 | def_bool y if X86_64 | 746 | def_bool y if X86_64 |
747 | ---help--- | 747 | ---help--- |
748 | Support for software bounce buffers used on x86-64 systems | 748 | Support for software bounce buffers used on x86-64 systems |
749 | which don't have a hardware IOMMU (e.g. the current generation | 749 | which don't have a hardware IOMMU. Using this PCI devices |
750 | of Intel's x86-64 CPUs). Using this PCI devices which can only | 750 | which can only access 32-bits of memory can be used on systems |
751 | access 32-bits of memory can be used on systems with more than | 751 | with more than 3 GB of memory. |
752 | 3 GB of memory. If unsure, say Y. | 752 | If unsure, say Y. |
753 | 753 | ||
754 | config IOMMU_HELPER | 754 | config IOMMU_HELPER |
755 | def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) | 755 | def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 682e9c210baa..474ca35b1bce 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -142,7 +142,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,) | |||
142 | KBUILD_CFLAGS += $(mflags-y) | 142 | KBUILD_CFLAGS += $(mflags-y) |
143 | KBUILD_AFLAGS += $(mflags-y) | 143 | KBUILD_AFLAGS += $(mflags-y) |
144 | 144 | ||
145 | archscripts: | 145 | archscripts: scripts_basic |
146 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs | 146 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs |
147 | 147 | ||
148 | ### | 148 | ### |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 93971e841dd5..472b9b783019 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
@@ -51,7 +51,8 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s, | |||
51 | 51 | ||
52 | extern int m2p_add_override(unsigned long mfn, struct page *page, | 52 | extern int m2p_add_override(unsigned long mfn, struct page *page, |
53 | struct gnttab_map_grant_ref *kmap_op); | 53 | struct gnttab_map_grant_ref *kmap_op); |
54 | extern int m2p_remove_override(struct page *page, bool clear_pte); | 54 | extern int m2p_remove_override(struct page *page, |
55 | struct gnttab_map_grant_ref *kmap_op); | ||
55 | extern struct page *m2p_find_override(unsigned long mfn); | 56 | extern struct page *m2p_find_override(unsigned long mfn); |
56 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); | 57 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); |
57 | 58 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 6605a81ba339..8b6defe7eefc 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -586,6 +586,8 @@ extern struct event_constraint intel_westmere_pebs_event_constraints[]; | |||
586 | 586 | ||
587 | extern struct event_constraint intel_snb_pebs_event_constraints[]; | 587 | extern struct event_constraint intel_snb_pebs_event_constraints[]; |
588 | 588 | ||
589 | extern struct event_constraint intel_ivb_pebs_event_constraints[]; | ||
590 | |||
589 | struct event_constraint *intel_pebs_constraints(struct perf_event *event); | 591 | struct event_constraint *intel_pebs_constraints(struct perf_event *event); |
590 | 592 | ||
591 | void intel_pmu_pebs_enable(struct perf_event *event); | 593 | void intel_pmu_pebs_enable(struct perf_event *event); |
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c index 7bfb5bec8630..eebd5ffe1bba 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c +++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c | |||
@@ -209,6 +209,15 @@ static int perf_ibs_precise_event(struct perf_event *event, u64 *config) | |||
209 | return -EOPNOTSUPP; | 209 | return -EOPNOTSUPP; |
210 | } | 210 | } |
211 | 211 | ||
212 | static const struct perf_event_attr ibs_notsupp = { | ||
213 | .exclude_user = 1, | ||
214 | .exclude_kernel = 1, | ||
215 | .exclude_hv = 1, | ||
216 | .exclude_idle = 1, | ||
217 | .exclude_host = 1, | ||
218 | .exclude_guest = 1, | ||
219 | }; | ||
220 | |||
212 | static int perf_ibs_init(struct perf_event *event) | 221 | static int perf_ibs_init(struct perf_event *event) |
213 | { | 222 | { |
214 | struct hw_perf_event *hwc = &event->hw; | 223 | struct hw_perf_event *hwc = &event->hw; |
@@ -229,6 +238,9 @@ static int perf_ibs_init(struct perf_event *event) | |||
229 | if (event->pmu != &perf_ibs->pmu) | 238 | if (event->pmu != &perf_ibs->pmu) |
230 | return -ENOENT; | 239 | return -ENOENT; |
231 | 240 | ||
241 | if (perf_flags(&event->attr) & perf_flags(&ibs_notsupp)) | ||
242 | return -EINVAL; | ||
243 | |||
232 | if (config & ~perf_ibs->config_mask) | 244 | if (config & ~perf_ibs->config_mask) |
233 | return -EINVAL; | 245 | return -EINVAL; |
234 | 246 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 0d3d63afa76a..6bca492b8547 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -2048,7 +2048,6 @@ __init int intel_pmu_init(void) | |||
2048 | case 42: /* SandyBridge */ | 2048 | case 42: /* SandyBridge */ |
2049 | case 45: /* SandyBridge, "Romely-EP" */ | 2049 | case 45: /* SandyBridge, "Romely-EP" */ |
2050 | x86_add_quirk(intel_sandybridge_quirk); | 2050 | x86_add_quirk(intel_sandybridge_quirk); |
2051 | case 58: /* IvyBridge */ | ||
2052 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 2051 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
2053 | sizeof(hw_cache_event_ids)); | 2052 | sizeof(hw_cache_event_ids)); |
2054 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, | 2053 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, |
@@ -2073,6 +2072,29 @@ __init int intel_pmu_init(void) | |||
2073 | 2072 | ||
2074 | pr_cont("SandyBridge events, "); | 2073 | pr_cont("SandyBridge events, "); |
2075 | break; | 2074 | break; |
2075 | case 58: /* IvyBridge */ | ||
2076 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | ||
2077 | sizeof(hw_cache_event_ids)); | ||
2078 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, | ||
2079 | sizeof(hw_cache_extra_regs)); | ||
2080 | |||
2081 | intel_pmu_lbr_init_snb(); | ||
2082 | |||
2083 | x86_pmu.event_constraints = intel_snb_event_constraints; | ||
2084 | x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints; | ||
2085 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
2086 | x86_pmu.extra_regs = intel_snb_extra_regs; | ||
2087 | /* all extra regs are per-cpu when HT is on */ | ||
2088 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | ||
2089 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | ||
2090 | |||
2091 | /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */ | ||
2092 | intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = | ||
2093 | X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1); | ||
2094 | |||
2095 | pr_cont("IvyBridge events, "); | ||
2096 | break; | ||
2097 | |||
2076 | 2098 | ||
2077 | default: | 2099 | default: |
2078 | switch (x86_pmu.version) { | 2100 | switch (x86_pmu.version) { |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index e38d97bf4259..826054a4f2ee 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -407,6 +407,20 @@ struct event_constraint intel_snb_pebs_event_constraints[] = { | |||
407 | EVENT_CONSTRAINT_END | 407 | EVENT_CONSTRAINT_END |
408 | }; | 408 | }; |
409 | 409 | ||
410 | struct event_constraint intel_ivb_pebs_event_constraints[] = { | ||
411 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ | ||
412 | INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ | ||
413 | INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ | ||
414 | INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ | ||
415 | INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ | ||
416 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ | ||
417 | INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ | ||
418 | INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
419 | INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
420 | INTEL_EVENT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ | ||
421 | EVENT_CONSTRAINT_END | ||
422 | }; | ||
423 | |||
410 | struct event_constraint *intel_pebs_constraints(struct perf_event *event) | 424 | struct event_constraint *intel_pebs_constraints(struct perf_event *event) |
411 | { | 425 | { |
412 | struct event_constraint *c; | 426 | struct event_constraint *c; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 0a5571080e74..38e4894165b9 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -661,6 +661,11 @@ static void snb_uncore_msr_init_box(struct intel_uncore_box *box) | |||
661 | } | 661 | } |
662 | } | 662 | } |
663 | 663 | ||
664 | static struct uncore_event_desc snb_uncore_events[] = { | ||
665 | INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff,umask=0x00"), | ||
666 | { /* end: all zeroes */ }, | ||
667 | }; | ||
668 | |||
664 | static struct attribute *snb_uncore_formats_attr[] = { | 669 | static struct attribute *snb_uncore_formats_attr[] = { |
665 | &format_attr_event.attr, | 670 | &format_attr_event.attr, |
666 | &format_attr_umask.attr, | 671 | &format_attr_umask.attr, |
@@ -704,6 +709,7 @@ static struct intel_uncore_type snb_uncore_cbox = { | |||
704 | .constraints = snb_uncore_cbox_constraints, | 709 | .constraints = snb_uncore_cbox_constraints, |
705 | .ops = &snb_uncore_msr_ops, | 710 | .ops = &snb_uncore_msr_ops, |
706 | .format_group = &snb_uncore_format_group, | 711 | .format_group = &snb_uncore_format_group, |
712 | .event_descs = snb_uncore_events, | ||
707 | }; | 713 | }; |
708 | 714 | ||
709 | static struct intel_uncore_type *snb_msr_uncores[] = { | 715 | static struct intel_uncore_type *snb_msr_uncores[] = { |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index e0e6990723e9..ab1f6a93b527 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -319,7 +319,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
319 | */ | 319 | */ |
320 | int devmem_is_allowed(unsigned long pagenr) | 320 | int devmem_is_allowed(unsigned long pagenr) |
321 | { | 321 | { |
322 | if (pagenr <= 256) | 322 | if (pagenr < 256) |
323 | return 1; | 323 | return 1; |
324 | if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) | 324 | if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) |
325 | return 0; | 325 | return 0; |
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig index 9926e11a772d..aeaff8bef2f1 100644 --- a/arch/x86/um/Kconfig +++ b/arch/x86/um/Kconfig | |||
@@ -21,6 +21,7 @@ config 64BIT | |||
21 | config X86_32 | 21 | config X86_32 |
22 | def_bool !64BIT | 22 | def_bool !64BIT |
23 | select HAVE_AOUT | 23 | select HAVE_AOUT |
24 | select ARCH_WANT_IPC_PARSE_VERSION | ||
24 | 25 | ||
25 | config X86_64 | 26 | config X86_64 |
26 | def_bool 64BIT | 27 | def_bool 64BIT |
diff --git a/arch/x86/um/shared/sysdep/kernel-offsets.h b/arch/x86/um/shared/sysdep/kernel-offsets.h index 5868526b5eef..46a9df99f3c5 100644 --- a/arch/x86/um/shared/sysdep/kernel-offsets.h +++ b/arch/x86/um/shared/sysdep/kernel-offsets.h | |||
@@ -7,9 +7,6 @@ | |||
7 | #define DEFINE(sym, val) \ | 7 | #define DEFINE(sym, val) \ |
8 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 8 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
9 | 9 | ||
10 | #define STR(x) #x | ||
11 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) | ||
12 | |||
13 | #define BLANK() asm volatile("\n->" : : ) | 10 | #define BLANK() asm volatile("\n->" : : ) |
14 | 11 | ||
15 | #define OFFSET(sym, str, mem) \ | 12 | #define OFFSET(sym, str, mem) \ |
diff --git a/arch/x86/um/shared/sysdep/syscalls.h b/arch/x86/um/shared/sysdep/syscalls.h index bd9a89b67e41..ca255a805ed9 100644 --- a/arch/x86/um/shared/sysdep/syscalls.h +++ b/arch/x86/um/shared/sysdep/syscalls.h | |||
@@ -1,3 +1,5 @@ | |||
1 | extern long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
2 | void __user *parent_tid, void __user *child_tid); | ||
1 | #ifdef __i386__ | 3 | #ifdef __i386__ |
2 | #include "syscalls_32.h" | 4 | #include "syscalls_32.h" |
3 | #else | 5 | #else |
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c index a508cea13503..ba7363ecf896 100644 --- a/arch/x86/um/signal.c +++ b/arch/x86/um/signal.c | |||
@@ -416,9 +416,6 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig, | |||
416 | PT_REGS_AX(regs) = (unsigned long) sig; | 416 | PT_REGS_AX(regs) = (unsigned long) sig; |
417 | PT_REGS_DX(regs) = (unsigned long) 0; | 417 | PT_REGS_DX(regs) = (unsigned long) 0; |
418 | PT_REGS_CX(regs) = (unsigned long) 0; | 418 | PT_REGS_CX(regs) = (unsigned long) 0; |
419 | |||
420 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
421 | ptrace_notify(SIGTRAP); | ||
422 | return 0; | 419 | return 0; |
423 | } | 420 | } |
424 | 421 | ||
@@ -466,9 +463,6 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
466 | PT_REGS_AX(regs) = (unsigned long) sig; | 463 | PT_REGS_AX(regs) = (unsigned long) sig; |
467 | PT_REGS_DX(regs) = (unsigned long) &frame->info; | 464 | PT_REGS_DX(regs) = (unsigned long) &frame->info; |
468 | PT_REGS_CX(regs) = (unsigned long) &frame->uc; | 465 | PT_REGS_CX(regs) = (unsigned long) &frame->uc; |
469 | |||
470 | if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) | ||
471 | ptrace_notify(SIGTRAP); | ||
472 | return 0; | 466 | return 0; |
473 | } | 467 | } |
474 | 468 | ||
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c index 68d1dc91b37b..b5408cecac6c 100644 --- a/arch/x86/um/sys_call_table_32.c +++ b/arch/x86/um/sys_call_table_32.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #define ptregs_execve sys_execve | 28 | #define ptregs_execve sys_execve |
29 | #define ptregs_iopl sys_iopl | 29 | #define ptregs_iopl sys_iopl |
30 | #define ptregs_vm86old sys_vm86old | 30 | #define ptregs_vm86old sys_vm86old |
31 | #define ptregs_clone sys_clone | 31 | #define ptregs_clone i386_clone |
32 | #define ptregs_vm86 sys_vm86 | 32 | #define ptregs_vm86 sys_vm86 |
33 | #define ptregs_sigaltstack sys_sigaltstack | 33 | #define ptregs_sigaltstack sys_sigaltstack |
34 | #define ptregs_vfork sys_vfork | 34 | #define ptregs_vfork sys_vfork |
diff --git a/arch/x86/um/syscalls_32.c b/arch/x86/um/syscalls_32.c index b853e8600b9d..db444c7218fe 100644 --- a/arch/x86/um/syscalls_32.c +++ b/arch/x86/um/syscalls_32.c | |||
@@ -3,37 +3,24 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/sched.h" | 6 | #include <linux/syscalls.h> |
7 | #include "linux/shm.h" | 7 | #include <sysdep/syscalls.h> |
8 | #include "linux/ipc.h" | ||
9 | #include "linux/syscalls.h" | ||
10 | #include "asm/mman.h" | ||
11 | #include "asm/uaccess.h" | ||
12 | #include "asm/unistd.h" | ||
13 | 8 | ||
14 | /* | 9 | /* |
15 | * The prototype on i386 is: | 10 | * The prototype on i386 is: |
16 | * | 11 | * |
17 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls, int * child_tidptr) | 12 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls |
18 | * | 13 | * |
19 | * and the "newtls" arg. on i386 is read by copy_thread directly from the | 14 | * and the "newtls" arg. on i386 is read by copy_thread directly from the |
20 | * register saved on the stack. | 15 | * register saved on the stack. |
21 | */ | 16 | */ |
22 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | 17 | long i386_clone(unsigned long clone_flags, unsigned long newsp, |
23 | int __user *parent_tid, void *newtls, int __user *child_tid) | 18 | int __user *parent_tid, void *newtls, int __user *child_tid) |
24 | { | 19 | { |
25 | long ret; | 20 | return sys_clone(clone_flags, newsp, parent_tid, child_tid); |
26 | |||
27 | if (!newsp) | ||
28 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
29 | |||
30 | current->thread.forking = 1; | ||
31 | ret = do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
32 | child_tid); | ||
33 | current->thread.forking = 0; | ||
34 | return ret; | ||
35 | } | 21 | } |
36 | 22 | ||
23 | |||
37 | long sys_sigaction(int sig, const struct old_sigaction __user *act, | 24 | long sys_sigaction(int sig, const struct old_sigaction __user *act, |
38 | struct old_sigaction __user *oact) | 25 | struct old_sigaction __user *oact) |
39 | { | 26 | { |
diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c index f3d82bb6e15a..adb08eb5c22a 100644 --- a/arch/x86/um/syscalls_64.c +++ b/arch/x86/um/syscalls_64.c | |||
@@ -5,12 +5,9 @@ | |||
5 | * Licensed under the GPL | 5 | * Licensed under the GPL |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "linux/linkage.h" | 8 | #include <linux/sched.h> |
9 | #include "linux/personality.h" | 9 | #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
10 | #include "linux/utsname.h" | 10 | #include <os.h> |
11 | #include "asm/prctl.h" /* XXX This should get the constants from libc */ | ||
12 | #include "asm/uaccess.h" | ||
13 | #include "os.h" | ||
14 | 11 | ||
15 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) | 12 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) |
16 | { | 13 | { |
@@ -79,20 +76,6 @@ long sys_arch_prctl(int code, unsigned long addr) | |||
79 | return arch_prctl(current, code, (unsigned long __user *) addr); | 76 | return arch_prctl(current, code, (unsigned long __user *) addr); |
80 | } | 77 | } |
81 | 78 | ||
82 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
83 | void __user *parent_tid, void __user *child_tid) | ||
84 | { | ||
85 | long ret; | ||
86 | |||
87 | if (!newsp) | ||
88 | newsp = UPT_SP(¤t->thread.regs.regs); | ||
89 | current->thread.forking = 1; | ||
90 | ret = do_fork(clone_flags, newsp, ¤t->thread.regs, 0, parent_tid, | ||
91 | child_tid); | ||
92 | current->thread.forking = 0; | ||
93 | return ret; | ||
94 | } | ||
95 | |||
96 | void arch_switch_to(struct task_struct *to) | 79 | void arch_switch_to(struct task_struct *to) |
97 | { | 80 | { |
98 | if ((to->thread.arch.fs == 0) || (to->mm == NULL)) | 81 | if ((to->thread.arch.fs == 0) || (to->mm == NULL)) |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 9642d4a38602..1fbe75a95f15 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1452,6 +1452,10 @@ asmlinkage void __init xen_start_kernel(void) | |||
1452 | pci_request_acs(); | 1452 | pci_request_acs(); |
1453 | 1453 | ||
1454 | xen_acpi_sleep_register(); | 1454 | xen_acpi_sleep_register(); |
1455 | |||
1456 | /* Avoid searching for BIOS MP tables */ | ||
1457 | x86_init.mpparse.find_smp_config = x86_init_noop; | ||
1458 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; | ||
1455 | } | 1459 | } |
1456 | #ifdef CONFIG_PCI | 1460 | #ifdef CONFIG_PCI |
1457 | /* PCI BIOS service won't work from a PV guest. */ | 1461 | /* PCI BIOS service won't work from a PV guest. */ |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 76ba0e97e530..72213da605f5 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -828,9 +828,6 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
828 | 828 | ||
829 | xen_mc_issue(PARAVIRT_LAZY_MMU); | 829 | xen_mc_issue(PARAVIRT_LAZY_MMU); |
830 | } | 830 | } |
831 | /* let's use dev_bus_addr to record the old mfn instead */ | ||
832 | kmap_op->dev_bus_addr = page->index; | ||
833 | page->index = (unsigned long) kmap_op; | ||
834 | } | 831 | } |
835 | spin_lock_irqsave(&m2p_override_lock, flags); | 832 | spin_lock_irqsave(&m2p_override_lock, flags); |
836 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); | 833 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); |
@@ -857,7 +854,8 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
857 | return 0; | 854 | return 0; |
858 | } | 855 | } |
859 | EXPORT_SYMBOL_GPL(m2p_add_override); | 856 | EXPORT_SYMBOL_GPL(m2p_add_override); |
860 | int m2p_remove_override(struct page *page, bool clear_pte) | 857 | int m2p_remove_override(struct page *page, |
858 | struct gnttab_map_grant_ref *kmap_op) | ||
861 | { | 859 | { |
862 | unsigned long flags; | 860 | unsigned long flags; |
863 | unsigned long mfn; | 861 | unsigned long mfn; |
@@ -887,10 +885,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
887 | WARN_ON(!PagePrivate(page)); | 885 | WARN_ON(!PagePrivate(page)); |
888 | ClearPagePrivate(page); | 886 | ClearPagePrivate(page); |
889 | 887 | ||
890 | if (clear_pte) { | 888 | set_phys_to_machine(pfn, page->index); |
891 | struct gnttab_map_grant_ref *map_op = | 889 | if (kmap_op != NULL) { |
892 | (struct gnttab_map_grant_ref *) page->index; | ||
893 | set_phys_to_machine(pfn, map_op->dev_bus_addr); | ||
894 | if (!PageHighMem(page)) { | 890 | if (!PageHighMem(page)) { |
895 | struct multicall_space mcs; | 891 | struct multicall_space mcs; |
896 | struct gnttab_unmap_grant_ref *unmap_op; | 892 | struct gnttab_unmap_grant_ref *unmap_op; |
@@ -902,13 +898,13 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
902 | * issued. In this case handle is going to -1 because | 898 | * issued. In this case handle is going to -1 because |
903 | * it hasn't been modified yet. | 899 | * it hasn't been modified yet. |
904 | */ | 900 | */ |
905 | if (map_op->handle == -1) | 901 | if (kmap_op->handle == -1) |
906 | xen_mc_flush(); | 902 | xen_mc_flush(); |
907 | /* | 903 | /* |
908 | * Now if map_op->handle is negative it means that the | 904 | * Now if kmap_op->handle is negative it means that the |
909 | * hypercall actually returned an error. | 905 | * hypercall actually returned an error. |
910 | */ | 906 | */ |
911 | if (map_op->handle == GNTST_general_error) { | 907 | if (kmap_op->handle == GNTST_general_error) { |
912 | printk(KERN_WARNING "m2p_remove_override: " | 908 | printk(KERN_WARNING "m2p_remove_override: " |
913 | "pfn %lx mfn %lx, failed to modify kernel mappings", | 909 | "pfn %lx mfn %lx, failed to modify kernel mappings", |
914 | pfn, mfn); | 910 | pfn, mfn); |
@@ -918,8 +914,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
918 | mcs = xen_mc_entry( | 914 | mcs = xen_mc_entry( |
919 | sizeof(struct gnttab_unmap_grant_ref)); | 915 | sizeof(struct gnttab_unmap_grant_ref)); |
920 | unmap_op = mcs.args; | 916 | unmap_op = mcs.args; |
921 | unmap_op->host_addr = map_op->host_addr; | 917 | unmap_op->host_addr = kmap_op->host_addr; |
922 | unmap_op->handle = map_op->handle; | 918 | unmap_op->handle = kmap_op->handle; |
923 | unmap_op->dev_bus_addr = 0; | 919 | unmap_op->dev_bus_addr = 0; |
924 | 920 | ||
925 | MULTI_grant_table_op(mcs.mc, | 921 | MULTI_grant_table_op(mcs.mc, |
@@ -930,10 +926,9 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
930 | set_pte_at(&init_mm, address, ptep, | 926 | set_pte_at(&init_mm, address, ptep, |
931 | pfn_pte(pfn, PAGE_KERNEL)); | 927 | pfn_pte(pfn, PAGE_KERNEL)); |
932 | __flush_tlb_single(address); | 928 | __flush_tlb_single(address); |
933 | map_op->host_addr = 0; | 929 | kmap_op->host_addr = 0; |
934 | } | 930 | } |
935 | } else | 931 | } |
936 | set_phys_to_machine(pfn, page->index); | ||
937 | 932 | ||
938 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present | 933 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present |
939 | * somewhere in this domain, even before being added to the | 934 | * somewhere in this domain, even before being added to the |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index d11ca11d14fc..e2d62d697b5d 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/e820.h> | 17 | #include <asm/e820.h> |
18 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
19 | #include <asm/acpi.h> | 19 | #include <asm/acpi.h> |
20 | #include <asm/numa.h> | ||
20 | #include <asm/xen/hypervisor.h> | 21 | #include <asm/xen/hypervisor.h> |
21 | #include <asm/xen/hypercall.h> | 22 | #include <asm/xen/hypercall.h> |
22 | 23 | ||
@@ -544,4 +545,7 @@ void __init xen_arch_setup(void) | |||
544 | disable_cpufreq(); | 545 | disable_cpufreq(); |
545 | WARN_ON(set_pm_idle_to_default()); | 546 | WARN_ON(set_pm_idle_to_default()); |
546 | fiddle_vdso(); | 547 | fiddle_vdso(); |
548 | #ifdef CONFIG_NUMA | ||
549 | numa_off = 1; | ||
550 | #endif | ||
547 | } | 551 | } |
diff --git a/block/blk-core.c b/block/blk-core.c index 4b4dbdfbca89..ee3cb3a5e278 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -2254,9 +2254,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
2254 | error_type = "I/O"; | 2254 | error_type = "I/O"; |
2255 | break; | 2255 | break; |
2256 | } | 2256 | } |
2257 | printk(KERN_ERR "end_request: %s error, dev %s, sector %llu\n", | 2257 | printk_ratelimited(KERN_ERR "end_request: %s error, dev %s, sector %llu\n", |
2258 | error_type, req->rq_disk ? req->rq_disk->disk_name : "?", | 2258 | error_type, req->rq_disk ? |
2259 | (unsigned long long)blk_rq_pos(req)); | 2259 | req->rq_disk->disk_name : "?", |
2260 | (unsigned long long)blk_rq_pos(req)); | ||
2261 | |||
2260 | } | 2262 | } |
2261 | 2263 | ||
2262 | blk_account_io_completion(req, nr_bytes); | 2264 | blk_account_io_completion(req, nr_bytes); |
diff --git a/block/ioctl.c b/block/ioctl.c index 4476e0e85d16..4a85096f5410 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
41 | sizeof(long long) > sizeof(long)) { | 41 | sizeof(long long) > sizeof(long)) { |
42 | long pstart = start, plength = length; | 42 | long pstart = start, plength = length; |
43 | if (pstart != start || plength != length | 43 | if (pstart != start || plength != length |
44 | || pstart < 0 || plength < 0) | 44 | || pstart < 0 || plength < 0 || partno > 65535) |
45 | return -EINVAL; | 45 | return -EINVAL; |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 9628652e080c..e0596954290b 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -237,6 +237,16 @@ static int __acpi_bus_get_power(struct acpi_device *device, int *state) | |||
237 | } else if (result == ACPI_STATE_D3_HOT) { | 237 | } else if (result == ACPI_STATE_D3_HOT) { |
238 | result = ACPI_STATE_D3; | 238 | result = ACPI_STATE_D3; |
239 | } | 239 | } |
240 | |||
241 | /* | ||
242 | * If we were unsure about the device parent's power state up to this | ||
243 | * point, the fact that the device is in D0 implies that the parent has | ||
244 | * to be in D0 too. | ||
245 | */ | ||
246 | if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN | ||
247 | && result == ACPI_STATE_D0) | ||
248 | device->parent->power.state = ACPI_STATE_D0; | ||
249 | |||
240 | *state = result; | 250 | *state = result; |
241 | 251 | ||
242 | out: | 252 | out: |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index fc1803414629..40e38a06ba85 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -107,6 +107,7 @@ struct acpi_power_resource { | |||
107 | 107 | ||
108 | /* List of devices relying on this power resource */ | 108 | /* List of devices relying on this power resource */ |
109 | struct acpi_power_resource_device *devices; | 109 | struct acpi_power_resource_device *devices; |
110 | struct mutex devices_lock; | ||
110 | }; | 111 | }; |
111 | 112 | ||
112 | static struct list_head acpi_power_resource_list; | 113 | static struct list_head acpi_power_resource_list; |
@@ -225,7 +226,6 @@ static void acpi_power_on_device(struct acpi_power_managed_device *device) | |||
225 | 226 | ||
226 | static int __acpi_power_on(struct acpi_power_resource *resource) | 227 | static int __acpi_power_on(struct acpi_power_resource *resource) |
227 | { | 228 | { |
228 | struct acpi_power_resource_device *device_list = resource->devices; | ||
229 | acpi_status status = AE_OK; | 229 | acpi_status status = AE_OK; |
230 | 230 | ||
231 | status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); | 231 | status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); |
@@ -238,19 +238,15 @@ static int __acpi_power_on(struct acpi_power_resource *resource) | |||
238 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", | 238 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", |
239 | resource->name)); | 239 | resource->name)); |
240 | 240 | ||
241 | while (device_list) { | ||
242 | acpi_power_on_device(device_list->device); | ||
243 | |||
244 | device_list = device_list->next; | ||
245 | } | ||
246 | |||
247 | return 0; | 241 | return 0; |
248 | } | 242 | } |
249 | 243 | ||
250 | static int acpi_power_on(acpi_handle handle) | 244 | static int acpi_power_on(acpi_handle handle) |
251 | { | 245 | { |
252 | int result = 0; | 246 | int result = 0; |
247 | bool resume_device = false; | ||
253 | struct acpi_power_resource *resource = NULL; | 248 | struct acpi_power_resource *resource = NULL; |
249 | struct acpi_power_resource_device *device_list; | ||
254 | 250 | ||
255 | result = acpi_power_get_context(handle, &resource); | 251 | result = acpi_power_get_context(handle, &resource); |
256 | if (result) | 252 | if (result) |
@@ -266,10 +262,25 @@ static int acpi_power_on(acpi_handle handle) | |||
266 | result = __acpi_power_on(resource); | 262 | result = __acpi_power_on(resource); |
267 | if (result) | 263 | if (result) |
268 | resource->ref_count--; | 264 | resource->ref_count--; |
265 | else | ||
266 | resume_device = true; | ||
269 | } | 267 | } |
270 | 268 | ||
271 | mutex_unlock(&resource->resource_lock); | 269 | mutex_unlock(&resource->resource_lock); |
272 | 270 | ||
271 | if (!resume_device) | ||
272 | return result; | ||
273 | |||
274 | mutex_lock(&resource->devices_lock); | ||
275 | |||
276 | device_list = resource->devices; | ||
277 | while (device_list) { | ||
278 | acpi_power_on_device(device_list->device); | ||
279 | device_list = device_list->next; | ||
280 | } | ||
281 | |||
282 | mutex_unlock(&resource->devices_lock); | ||
283 | |||
273 | return result; | 284 | return result; |
274 | } | 285 | } |
275 | 286 | ||
@@ -355,7 +366,7 @@ static void __acpi_power_resource_unregister_device(struct device *dev, | |||
355 | if (acpi_power_get_context(res_handle, &resource)) | 366 | if (acpi_power_get_context(res_handle, &resource)) |
356 | return; | 367 | return; |
357 | 368 | ||
358 | mutex_lock(&resource->resource_lock); | 369 | mutex_lock(&resource->devices_lock); |
359 | prev = NULL; | 370 | prev = NULL; |
360 | curr = resource->devices; | 371 | curr = resource->devices; |
361 | while (curr) { | 372 | while (curr) { |
@@ -372,7 +383,7 @@ static void __acpi_power_resource_unregister_device(struct device *dev, | |||
372 | prev = curr; | 383 | prev = curr; |
373 | curr = curr->next; | 384 | curr = curr->next; |
374 | } | 385 | } |
375 | mutex_unlock(&resource->resource_lock); | 386 | mutex_unlock(&resource->devices_lock); |
376 | } | 387 | } |
377 | 388 | ||
378 | /* Unlink dev from all power resources in _PR0 */ | 389 | /* Unlink dev from all power resources in _PR0 */ |
@@ -414,10 +425,10 @@ static int __acpi_power_resource_register_device( | |||
414 | 425 | ||
415 | power_resource_device->device = powered_device; | 426 | power_resource_device->device = powered_device; |
416 | 427 | ||
417 | mutex_lock(&resource->resource_lock); | 428 | mutex_lock(&resource->devices_lock); |
418 | power_resource_device->next = resource->devices; | 429 | power_resource_device->next = resource->devices; |
419 | resource->devices = power_resource_device; | 430 | resource->devices = power_resource_device; |
420 | mutex_unlock(&resource->resource_lock); | 431 | mutex_unlock(&resource->devices_lock); |
421 | 432 | ||
422 | return 0; | 433 | return 0; |
423 | } | 434 | } |
@@ -462,7 +473,7 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle) | |||
462 | return ret; | 473 | return ret; |
463 | 474 | ||
464 | no_power_resource: | 475 | no_power_resource: |
465 | printk(KERN_WARNING PREFIX "Invalid Power Resource to register!"); | 476 | printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!"); |
466 | return -ENODEV; | 477 | return -ENODEV; |
467 | } | 478 | } |
468 | EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); | 479 | EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); |
@@ -721,6 +732,7 @@ static int acpi_power_add(struct acpi_device *device) | |||
721 | 732 | ||
722 | resource->device = device; | 733 | resource->device = device; |
723 | mutex_init(&resource->resource_lock); | 734 | mutex_init(&resource->resource_lock); |
735 | mutex_init(&resource->devices_lock); | ||
724 | strcpy(resource->name, device->pnp.bus_id); | 736 | strcpy(resource->name, device->pnp.bus_id); |
725 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); | 737 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); |
726 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); | 738 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index de0435e63b02..887f68f6d79a 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -35,6 +35,7 @@ new_skb(ulong len) | |||
35 | skb_reset_mac_header(skb); | 35 | skb_reset_mac_header(skb); |
36 | skb_reset_network_header(skb); | 36 | skb_reset_network_header(skb); |
37 | skb->protocol = __constant_htons(ETH_P_AOE); | 37 | skb->protocol = __constant_htons(ETH_P_AOE); |
38 | skb_checksum_none_assert(skb); | ||
38 | } | 39 | } |
39 | return skb; | 40 | return skb; |
40 | } | 41 | } |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 38aa6dda6b81..da3311129a0c 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -795,6 +795,7 @@ static void complete_scsi_command(CommandList_struct *c, int timeout, | |||
795 | } | 795 | } |
796 | break; | 796 | break; |
797 | case CMD_PROTOCOL_ERR: | 797 | case CMD_PROTOCOL_ERR: |
798 | cmd->result = DID_ERROR << 16; | ||
798 | dev_warn(&h->pdev->dev, | 799 | dev_warn(&h->pdev->dev, |
799 | "%p has protocol error\n", c); | 800 | "%p has protocol error\n", c); |
800 | break; | 801 | break; |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index a8fddeb3d638..f946d31d6917 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -1148,11 +1148,15 @@ static bool mtip_pause_ncq(struct mtip_port *port, | |||
1148 | reply = port->rxfis + RX_FIS_D2H_REG; | 1148 | reply = port->rxfis + RX_FIS_D2H_REG; |
1149 | task_file_data = readl(port->mmio+PORT_TFDATA); | 1149 | task_file_data = readl(port->mmio+PORT_TFDATA); |
1150 | 1150 | ||
1151 | if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) | 1151 | if (fis->command == ATA_CMD_SEC_ERASE_UNIT) |
1152 | clear_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag); | ||
1153 | |||
1154 | if ((task_file_data & 1)) | ||
1152 | return false; | 1155 | return false; |
1153 | 1156 | ||
1154 | if (fis->command == ATA_CMD_SEC_ERASE_PREP) { | 1157 | if (fis->command == ATA_CMD_SEC_ERASE_PREP) { |
1155 | set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | 1158 | set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); |
1159 | set_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag); | ||
1156 | port->ic_pause_timer = jiffies; | 1160 | port->ic_pause_timer = jiffies; |
1157 | return true; | 1161 | return true; |
1158 | } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && | 1162 | } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && |
@@ -1900,7 +1904,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
1900 | int rv = 0, xfer_sz = command[3]; | 1904 | int rv = 0, xfer_sz = command[3]; |
1901 | 1905 | ||
1902 | if (xfer_sz) { | 1906 | if (xfer_sz) { |
1903 | if (user_buffer) | 1907 | if (!user_buffer) |
1904 | return -EFAULT; | 1908 | return -EFAULT; |
1905 | 1909 | ||
1906 | buf = dmam_alloc_coherent(&port->dd->pdev->dev, | 1910 | buf = dmam_alloc_coherent(&port->dd->pdev->dev, |
@@ -2043,7 +2047,7 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | |||
2043 | *timeout = 240000; /* 4 minutes */ | 2047 | *timeout = 240000; /* 4 minutes */ |
2044 | break; | 2048 | break; |
2045 | case ATA_CMD_STANDBYNOW1: | 2049 | case ATA_CMD_STANDBYNOW1: |
2046 | *timeout = 10000; /* 10 seconds */ | 2050 | *timeout = 120000; /* 2 minutes */ |
2047 | break; | 2051 | break; |
2048 | case 0xF7: | 2052 | case 0xF7: |
2049 | case 0xFA: | 2053 | case 0xFA: |
@@ -2588,9 +2592,6 @@ static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, | |||
2588 | if (!len || size) | 2592 | if (!len || size) |
2589 | return 0; | 2593 | return 0; |
2590 | 2594 | ||
2591 | if (size < 0) | ||
2592 | return -EINVAL; | ||
2593 | |||
2594 | size += sprintf(&buf[size], "H/ S ACTive : [ 0x"); | 2595 | size += sprintf(&buf[size], "H/ S ACTive : [ 0x"); |
2595 | 2596 | ||
2596 | for (n = dd->slot_groups-1; n >= 0; n--) | 2597 | for (n = dd->slot_groups-1; n >= 0; n--) |
@@ -2660,9 +2661,6 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf, | |||
2660 | if (!len || size) | 2661 | if (!len || size) |
2661 | return 0; | 2662 | return 0; |
2662 | 2663 | ||
2663 | if (size < 0) | ||
2664 | return -EINVAL; | ||
2665 | |||
2666 | size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n", | 2664 | size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n", |
2667 | dd->port->flags); | 2665 | dd->port->flags); |
2668 | size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n", | 2666 | size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n", |
@@ -3214,8 +3212,8 @@ static int mtip_hw_init(struct driver_data *dd) | |||
3214 | "Unable to check write protect progress\n"); | 3212 | "Unable to check write protect progress\n"); |
3215 | else | 3213 | else |
3216 | dev_info(&dd->pdev->dev, | 3214 | dev_info(&dd->pdev->dev, |
3217 | "Write protect progress: %d%% (%d blocks)\n", | 3215 | "Write protect progress: %u%% (%u blocks)\n", |
3218 | attr242.cur, attr242.data); | 3216 | attr242.cur, le32_to_cpu(attr242.data)); |
3219 | return rv; | 3217 | return rv; |
3220 | 3218 | ||
3221 | out3: | 3219 | out3: |
@@ -3619,6 +3617,10 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3619 | bio_endio(bio, -ENODATA); | 3617 | bio_endio(bio, -ENODATA); |
3620 | return; | 3618 | return; |
3621 | } | 3619 | } |
3620 | if (unlikely(test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))) { | ||
3621 | bio_endio(bio, -ENODATA); | ||
3622 | return; | ||
3623 | } | ||
3622 | } | 3624 | } |
3623 | 3625 | ||
3624 | if (unlikely(!bio_has_data(bio))) { | 3626 | if (unlikely(!bio_has_data(bio))) { |
@@ -4168,7 +4170,13 @@ static void mtip_pci_shutdown(struct pci_dev *pdev) | |||
4168 | 4170 | ||
4169 | /* Table of device ids supported by this driver. */ | 4171 | /* Table of device ids supported by this driver. */ |
4170 | static DEFINE_PCI_DEVICE_TABLE(mtip_pci_tbl) = { | 4172 | static DEFINE_PCI_DEVICE_TABLE(mtip_pci_tbl) = { |
4171 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320_DEVICE_ID) }, | 4173 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320H_DEVICE_ID) }, |
4174 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320M_DEVICE_ID) }, | ||
4175 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320S_DEVICE_ID) }, | ||
4176 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P325M_DEVICE_ID) }, | ||
4177 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P420H_DEVICE_ID) }, | ||
4178 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P420M_DEVICE_ID) }, | ||
4179 | { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P425M_DEVICE_ID) }, | ||
4172 | { 0 } | 4180 | { 0 } |
4173 | }; | 4181 | }; |
4174 | 4182 | ||
@@ -4199,12 +4207,12 @@ static int __init mtip_init(void) | |||
4199 | { | 4207 | { |
4200 | int error; | 4208 | int error; |
4201 | 4209 | ||
4202 | printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); | 4210 | pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); |
4203 | 4211 | ||
4204 | /* Allocate a major block device number to use with this driver. */ | 4212 | /* Allocate a major block device number to use with this driver. */ |
4205 | error = register_blkdev(0, MTIP_DRV_NAME); | 4213 | error = register_blkdev(0, MTIP_DRV_NAME); |
4206 | if (error <= 0) { | 4214 | if (error <= 0) { |
4207 | printk(KERN_ERR "Unable to register block device (%d)\n", | 4215 | pr_err("Unable to register block device (%d)\n", |
4208 | error); | 4216 | error); |
4209 | return -EBUSY; | 4217 | return -EBUSY; |
4210 | } | 4218 | } |
@@ -4213,7 +4221,7 @@ static int __init mtip_init(void) | |||
4213 | if (!dfs_parent) { | 4221 | if (!dfs_parent) { |
4214 | dfs_parent = debugfs_create_dir("rssd", NULL); | 4222 | dfs_parent = debugfs_create_dir("rssd", NULL); |
4215 | if (IS_ERR_OR_NULL(dfs_parent)) { | 4223 | if (IS_ERR_OR_NULL(dfs_parent)) { |
4216 | printk(KERN_WARNING "Error creating debugfs parent\n"); | 4224 | pr_warn("Error creating debugfs parent\n"); |
4217 | dfs_parent = NULL; | 4225 | dfs_parent = NULL; |
4218 | } | 4226 | } |
4219 | } | 4227 | } |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index f51fc23d17bb..18627a1d04c5 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -76,7 +76,13 @@ | |||
76 | 76 | ||
77 | /* Micron Vendor ID & P320x SSD Device ID */ | 77 | /* Micron Vendor ID & P320x SSD Device ID */ |
78 | #define PCI_VENDOR_ID_MICRON 0x1344 | 78 | #define PCI_VENDOR_ID_MICRON 0x1344 |
79 | #define P320_DEVICE_ID 0x5150 | 79 | #define P320H_DEVICE_ID 0x5150 |
80 | #define P320M_DEVICE_ID 0x5151 | ||
81 | #define P320S_DEVICE_ID 0x5152 | ||
82 | #define P325M_DEVICE_ID 0x5153 | ||
83 | #define P420H_DEVICE_ID 0x5160 | ||
84 | #define P420M_DEVICE_ID 0x5161 | ||
85 | #define P425M_DEVICE_ID 0x5163 | ||
80 | 86 | ||
81 | /* Driver name and version strings */ | 87 | /* Driver name and version strings */ |
82 | #define MTIP_DRV_NAME "mtip32xx" | 88 | #define MTIP_DRV_NAME "mtip32xx" |
@@ -131,10 +137,12 @@ enum { | |||
131 | MTIP_PF_SVC_THD_STOP_BIT = 8, | 137 | MTIP_PF_SVC_THD_STOP_BIT = 8, |
132 | 138 | ||
133 | /* below are bit numbers in 'dd_flag' defined in driver_data */ | 139 | /* below are bit numbers in 'dd_flag' defined in driver_data */ |
140 | MTIP_DDF_SEC_LOCK_BIT = 0, | ||
134 | MTIP_DDF_REMOVE_PENDING_BIT = 1, | 141 | MTIP_DDF_REMOVE_PENDING_BIT = 1, |
135 | MTIP_DDF_OVER_TEMP_BIT = 2, | 142 | MTIP_DDF_OVER_TEMP_BIT = 2, |
136 | MTIP_DDF_WRITE_PROTECT_BIT = 3, | 143 | MTIP_DDF_WRITE_PROTECT_BIT = 3, |
137 | MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ | 144 | MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ |
145 | (1 << MTIP_DDF_SEC_LOCK_BIT) | \ | ||
138 | (1 << MTIP_DDF_OVER_TEMP_BIT) | \ | 146 | (1 << MTIP_DDF_OVER_TEMP_BIT) | \ |
139 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)), | 147 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)), |
140 | 148 | ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index d07c9f7fded6..0c03411c59eb 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -449,6 +449,14 @@ static void nbd_clear_que(struct nbd_device *nbd) | |||
449 | req->errors++; | 449 | req->errors++; |
450 | nbd_end_request(req); | 450 | nbd_end_request(req); |
451 | } | 451 | } |
452 | |||
453 | while (!list_empty(&nbd->waiting_queue)) { | ||
454 | req = list_entry(nbd->waiting_queue.next, struct request, | ||
455 | queuelist); | ||
456 | list_del_init(&req->queuelist); | ||
457 | req->errors++; | ||
458 | nbd_end_request(req); | ||
459 | } | ||
452 | } | 460 | } |
453 | 461 | ||
454 | 462 | ||
@@ -598,6 +606,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, | |||
598 | nbd->file = NULL; | 606 | nbd->file = NULL; |
599 | nbd_clear_que(nbd); | 607 | nbd_clear_que(nbd); |
600 | BUG_ON(!list_empty(&nbd->queue_head)); | 608 | BUG_ON(!list_empty(&nbd->queue_head)); |
609 | BUG_ON(!list_empty(&nbd->waiting_queue)); | ||
601 | if (file) | 610 | if (file) |
602 | fput(file); | 611 | fput(file); |
603 | return 0; | 612 | return 0; |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 9917943a3572..54a55f03115d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -246,13 +246,12 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) | |||
246 | { | 246 | { |
247 | struct rbd_device *rbd_dev = bdev->bd_disk->private_data; | 247 | struct rbd_device *rbd_dev = bdev->bd_disk->private_data; |
248 | 248 | ||
249 | rbd_get_dev(rbd_dev); | ||
250 | |||
251 | set_device_ro(bdev, rbd_dev->read_only); | ||
252 | |||
253 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) | 249 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) |
254 | return -EROFS; | 250 | return -EROFS; |
255 | 251 | ||
252 | rbd_get_dev(rbd_dev); | ||
253 | set_device_ro(bdev, rbd_dev->read_only); | ||
254 | |||
256 | return 0; | 255 | return 0; |
257 | } | 256 | } |
258 | 257 | ||
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 73f196ca713f..c6decb901e5e 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -337,7 +337,7 @@ static void xen_blkbk_unmap(struct pending_req *req) | |||
337 | invcount++; | 337 | invcount++; |
338 | } | 338 | } |
339 | 339 | ||
340 | ret = gnttab_unmap_refs(unmap, pages, invcount, false); | 340 | ret = gnttab_unmap_refs(unmap, NULL, pages, invcount); |
341 | BUG_ON(ret); | 341 | BUG_ON(ret); |
342 | } | 342 | } |
343 | 343 | ||
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 5869ea387054..72ce247a0e8d 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | # common clock types | 1 | # common clock types |
2 | obj-$(CONFIG_HAVE_CLK) += clk-devres.o | ||
2 | obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o | 3 | obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o |
3 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ | 4 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ |
4 | clk-mux.o clk-divider.o clk-fixed-factor.o | 5 | clk-mux.o clk-divider.o clk-fixed-factor.o |
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c new file mode 100644 index 000000000000..8f571548870f --- /dev/null +++ b/drivers/clk/clk-devres.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | */ | ||
6 | |||
7 | #include <linux/clk.h> | ||
8 | #include <linux/device.h> | ||
9 | #include <linux/export.h> | ||
10 | #include <linux/gfp.h> | ||
11 | |||
12 | static void devm_clk_release(struct device *dev, void *res) | ||
13 | { | ||
14 | clk_put(*(struct clk **)res); | ||
15 | } | ||
16 | |||
17 | struct clk *devm_clk_get(struct device *dev, const char *id) | ||
18 | { | ||
19 | struct clk **ptr, *clk; | ||
20 | |||
21 | ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL); | ||
22 | if (!ptr) | ||
23 | return ERR_PTR(-ENOMEM); | ||
24 | |||
25 | clk = clk_get(dev, id); | ||
26 | if (!IS_ERR(clk)) { | ||
27 | *ptr = clk; | ||
28 | devres_add(dev, ptr); | ||
29 | } else { | ||
30 | devres_free(ptr); | ||
31 | } | ||
32 | |||
33 | return clk; | ||
34 | } | ||
35 | EXPORT_SYMBOL(devm_clk_get); | ||
36 | |||
37 | static int devm_clk_match(struct device *dev, void *res, void *data) | ||
38 | { | ||
39 | struct clk **c = res; | ||
40 | if (!c || !*c) { | ||
41 | WARN_ON(!c || !*c); | ||
42 | return 0; | ||
43 | } | ||
44 | return *c == data; | ||
45 | } | ||
46 | |||
47 | void devm_clk_put(struct device *dev, struct clk *clk) | ||
48 | { | ||
49 | int ret; | ||
50 | |||
51 | ret = devres_release(dev, devm_clk_release, devm_clk_match, clk); | ||
52 | |||
53 | WARN_ON(ret); | ||
54 | } | ||
55 | EXPORT_SYMBOL(devm_clk_put); | ||
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index d423c9bdd71a..442a31363873 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c | |||
@@ -171,51 +171,6 @@ void clk_put(struct clk *clk) | |||
171 | } | 171 | } |
172 | EXPORT_SYMBOL(clk_put); | 172 | EXPORT_SYMBOL(clk_put); |
173 | 173 | ||
174 | static void devm_clk_release(struct device *dev, void *res) | ||
175 | { | ||
176 | clk_put(*(struct clk **)res); | ||
177 | } | ||
178 | |||
179 | struct clk *devm_clk_get(struct device *dev, const char *id) | ||
180 | { | ||
181 | struct clk **ptr, *clk; | ||
182 | |||
183 | ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL); | ||
184 | if (!ptr) | ||
185 | return ERR_PTR(-ENOMEM); | ||
186 | |||
187 | clk = clk_get(dev, id); | ||
188 | if (!IS_ERR(clk)) { | ||
189 | *ptr = clk; | ||
190 | devres_add(dev, ptr); | ||
191 | } else { | ||
192 | devres_free(ptr); | ||
193 | } | ||
194 | |||
195 | return clk; | ||
196 | } | ||
197 | EXPORT_SYMBOL(devm_clk_get); | ||
198 | |||
199 | static int devm_clk_match(struct device *dev, void *res, void *data) | ||
200 | { | ||
201 | struct clk **c = res; | ||
202 | if (!c || !*c) { | ||
203 | WARN_ON(!c || !*c); | ||
204 | return 0; | ||
205 | } | ||
206 | return *c == data; | ||
207 | } | ||
208 | |||
209 | void devm_clk_put(struct device *dev, struct clk *clk) | ||
210 | { | ||
211 | int ret; | ||
212 | |||
213 | ret = devres_destroy(dev, devm_clk_release, devm_clk_match, clk); | ||
214 | |||
215 | WARN_ON(ret); | ||
216 | } | ||
217 | EXPORT_SYMBOL(devm_clk_put); | ||
218 | |||
219 | void clkdev_add(struct clk_lookup *cl) | 174 | void clkdev_add(struct clk_lookup *cl) |
220 | { | 175 | { |
221 | mutex_lock(&clocks_mutex); | 176 | mutex_lock(&clocks_mutex); |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index c0e816468e30..1a40935c85fd 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/string.h> | 36 | #include <linux/string.h> |
37 | #include <linux/cpumask.h> | 37 | #include <linux/cpumask.h> |
38 | #include <linux/sched.h> /* for current / set_cpus_allowed() */ | ||
39 | #include <linux/io.h> | 38 | #include <linux/io.h> |
40 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
41 | 40 | ||
@@ -1139,16 +1138,23 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, | |||
1139 | return res; | 1138 | return res; |
1140 | } | 1139 | } |
1141 | 1140 | ||
1142 | /* Driver entry point to switch to the target frequency */ | 1141 | struct powernowk8_target_arg { |
1143 | static int powernowk8_target(struct cpufreq_policy *pol, | 1142 | struct cpufreq_policy *pol; |
1144 | unsigned targfreq, unsigned relation) | 1143 | unsigned targfreq; |
1144 | unsigned relation; | ||
1145 | }; | ||
1146 | |||
1147 | static long powernowk8_target_fn(void *arg) | ||
1145 | { | 1148 | { |
1146 | cpumask_var_t oldmask; | 1149 | struct powernowk8_target_arg *pta = arg; |
1150 | struct cpufreq_policy *pol = pta->pol; | ||
1151 | unsigned targfreq = pta->targfreq; | ||
1152 | unsigned relation = pta->relation; | ||
1147 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); | 1153 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
1148 | u32 checkfid; | 1154 | u32 checkfid; |
1149 | u32 checkvid; | 1155 | u32 checkvid; |
1150 | unsigned int newstate; | 1156 | unsigned int newstate; |
1151 | int ret = -EIO; | 1157 | int ret; |
1152 | 1158 | ||
1153 | if (!data) | 1159 | if (!data) |
1154 | return -EINVAL; | 1160 | return -EINVAL; |
@@ -1156,29 +1162,16 @@ static int powernowk8_target(struct cpufreq_policy *pol, | |||
1156 | checkfid = data->currfid; | 1162 | checkfid = data->currfid; |
1157 | checkvid = data->currvid; | 1163 | checkvid = data->currvid; |
1158 | 1164 | ||
1159 | /* only run on specific CPU from here on. */ | ||
1160 | /* This is poor form: use a workqueue or smp_call_function_single */ | ||
1161 | if (!alloc_cpumask_var(&oldmask, GFP_KERNEL)) | ||
1162 | return -ENOMEM; | ||
1163 | |||
1164 | cpumask_copy(oldmask, tsk_cpus_allowed(current)); | ||
1165 | set_cpus_allowed_ptr(current, cpumask_of(pol->cpu)); | ||
1166 | |||
1167 | if (smp_processor_id() != pol->cpu) { | ||
1168 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); | ||
1169 | goto err_out; | ||
1170 | } | ||
1171 | |||
1172 | if (pending_bit_stuck()) { | 1165 | if (pending_bit_stuck()) { |
1173 | printk(KERN_ERR PFX "failing targ, change pending bit set\n"); | 1166 | printk(KERN_ERR PFX "failing targ, change pending bit set\n"); |
1174 | goto err_out; | 1167 | return -EIO; |
1175 | } | 1168 | } |
1176 | 1169 | ||
1177 | pr_debug("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n", | 1170 | pr_debug("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n", |
1178 | pol->cpu, targfreq, pol->min, pol->max, relation); | 1171 | pol->cpu, targfreq, pol->min, pol->max, relation); |
1179 | 1172 | ||
1180 | if (query_current_values_with_pending_wait(data)) | 1173 | if (query_current_values_with_pending_wait(data)) |
1181 | goto err_out; | 1174 | return -EIO; |
1182 | 1175 | ||
1183 | if (cpu_family != CPU_HW_PSTATE) { | 1176 | if (cpu_family != CPU_HW_PSTATE) { |
1184 | pr_debug("targ: curr fid 0x%x, vid 0x%x\n", | 1177 | pr_debug("targ: curr fid 0x%x, vid 0x%x\n", |
@@ -1196,7 +1189,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, | |||
1196 | 1189 | ||
1197 | if (cpufreq_frequency_table_target(pol, data->powernow_table, | 1190 | if (cpufreq_frequency_table_target(pol, data->powernow_table, |
1198 | targfreq, relation, &newstate)) | 1191 | targfreq, relation, &newstate)) |
1199 | goto err_out; | 1192 | return -EIO; |
1200 | 1193 | ||
1201 | mutex_lock(&fidvid_mutex); | 1194 | mutex_lock(&fidvid_mutex); |
1202 | 1195 | ||
@@ -1209,9 +1202,8 @@ static int powernowk8_target(struct cpufreq_policy *pol, | |||
1209 | ret = transition_frequency_fidvid(data, newstate); | 1202 | ret = transition_frequency_fidvid(data, newstate); |
1210 | if (ret) { | 1203 | if (ret) { |
1211 | printk(KERN_ERR PFX "transition frequency failed\n"); | 1204 | printk(KERN_ERR PFX "transition frequency failed\n"); |
1212 | ret = 1; | ||
1213 | mutex_unlock(&fidvid_mutex); | 1205 | mutex_unlock(&fidvid_mutex); |
1214 | goto err_out; | 1206 | return 1; |
1215 | } | 1207 | } |
1216 | mutex_unlock(&fidvid_mutex); | 1208 | mutex_unlock(&fidvid_mutex); |
1217 | 1209 | ||
@@ -1220,12 +1212,25 @@ static int powernowk8_target(struct cpufreq_policy *pol, | |||
1220 | data->powernow_table[newstate].index); | 1212 | data->powernow_table[newstate].index); |
1221 | else | 1213 | else |
1222 | pol->cur = find_khz_freq_from_fid(data->currfid); | 1214 | pol->cur = find_khz_freq_from_fid(data->currfid); |
1223 | ret = 0; | ||
1224 | 1215 | ||
1225 | err_out: | 1216 | return 0; |
1226 | set_cpus_allowed_ptr(current, oldmask); | 1217 | } |
1227 | free_cpumask_var(oldmask); | 1218 | |
1228 | return ret; | 1219 | /* Driver entry point to switch to the target frequency */ |
1220 | static int powernowk8_target(struct cpufreq_policy *pol, | ||
1221 | unsigned targfreq, unsigned relation) | ||
1222 | { | ||
1223 | struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, | ||
1224 | .relation = relation }; | ||
1225 | |||
1226 | /* | ||
1227 | * Must run on @pol->cpu. cpufreq core is responsible for ensuring | ||
1228 | * that we're bound to the current CPU and pol->cpu stays online. | ||
1229 | */ | ||
1230 | if (smp_processor_id() == pol->cpu) | ||
1231 | return powernowk8_target_fn(&pta); | ||
1232 | else | ||
1233 | return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta); | ||
1229 | } | 1234 | } |
1230 | 1235 | ||
1231 | /* Driver entry point to verify the policy and range of frequencies */ | 1236 | /* Driver entry point to verify the policy and range of frequencies */ |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 3934fcc4e00b..7ab6e26664a7 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -661,7 +661,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
661 | flags); | 661 | flags); |
662 | 662 | ||
663 | if (unlikely(!atslave || !sg_len)) { | 663 | if (unlikely(!atslave || !sg_len)) { |
664 | dev_dbg(chan2dev(chan), "prep_dma_memcpy: length is zero!\n"); | 664 | dev_dbg(chan2dev(chan), "prep_slave_sg: sg length is zero!\n"); |
665 | return NULL; | 665 | return NULL; |
666 | } | 666 | } |
667 | 667 | ||
@@ -689,6 +689,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
689 | 689 | ||
690 | mem = sg_dma_address(sg); | 690 | mem = sg_dma_address(sg); |
691 | len = sg_dma_len(sg); | 691 | len = sg_dma_len(sg); |
692 | if (unlikely(!len)) { | ||
693 | dev_dbg(chan2dev(chan), | ||
694 | "prep_slave_sg: sg(%d) data length is zero\n", i); | ||
695 | goto err; | ||
696 | } | ||
692 | mem_width = 2; | 697 | mem_width = 2; |
693 | if (unlikely(mem & 3 || len & 3)) | 698 | if (unlikely(mem & 3 || len & 3)) |
694 | mem_width = 0; | 699 | mem_width = 0; |
@@ -724,6 +729,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
724 | 729 | ||
725 | mem = sg_dma_address(sg); | 730 | mem = sg_dma_address(sg); |
726 | len = sg_dma_len(sg); | 731 | len = sg_dma_len(sg); |
732 | if (unlikely(!len)) { | ||
733 | dev_dbg(chan2dev(chan), | ||
734 | "prep_slave_sg: sg(%d) data length is zero\n", i); | ||
735 | goto err; | ||
736 | } | ||
727 | mem_width = 2; | 737 | mem_width = 2; |
728 | if (unlikely(mem & 3 || len & 3)) | 738 | if (unlikely(mem & 3 || len & 3)) |
729 | mem_width = 0; | 739 | mem_width = 0; |
@@ -757,6 +767,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
757 | 767 | ||
758 | err_desc_get: | 768 | err_desc_get: |
759 | dev_err(chan2dev(chan), "not enough descriptors available\n"); | 769 | dev_err(chan2dev(chan), "not enough descriptors available\n"); |
770 | err: | ||
760 | atc_desc_put(atchan, first); | 771 | atc_desc_put(atchan, first); |
761 | return NULL; | 772 | return NULL; |
762 | } | 773 | } |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index e4feba6b03c0..f5843bc80baa 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -1567,17 +1567,19 @@ static int pl330_submit_req(void *ch_id, struct pl330_req *r) | |||
1567 | goto xfer_exit; | 1567 | goto xfer_exit; |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | /* Prefer Secure Channel */ | ||
1571 | if (!_manager_ns(thrd)) | ||
1572 | r->cfg->nonsecure = 0; | ||
1573 | else | ||
1574 | r->cfg->nonsecure = 1; | ||
1575 | 1570 | ||
1576 | /* Use last settings, if not provided */ | 1571 | /* Use last settings, if not provided */ |
1577 | if (r->cfg) | 1572 | if (r->cfg) { |
1573 | /* Prefer Secure Channel */ | ||
1574 | if (!_manager_ns(thrd)) | ||
1575 | r->cfg->nonsecure = 0; | ||
1576 | else | ||
1577 | r->cfg->nonsecure = 1; | ||
1578 | |||
1578 | ccr = _prepare_ccr(r->cfg); | 1579 | ccr = _prepare_ccr(r->cfg); |
1579 | else | 1580 | } else { |
1580 | ccr = readl(regs + CC(thrd->id)); | 1581 | ccr = readl(regs + CC(thrd->id)); |
1582 | } | ||
1581 | 1583 | ||
1582 | /* If this req doesn't have valid xfer settings */ | 1584 | /* If this req doesn't have valid xfer settings */ |
1583 | if (!_is_valid(ccr)) { | 1585 | if (!_is_valid(ccr)) { |
@@ -2928,6 +2930,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2928 | num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); | 2930 | num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); |
2929 | 2931 | ||
2930 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); | 2932 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); |
2933 | if (!pdmac->peripherals) { | ||
2934 | ret = -ENOMEM; | ||
2935 | dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n"); | ||
2936 | goto probe_err5; | ||
2937 | } | ||
2931 | 2938 | ||
2932 | for (i = 0; i < num_chan; i++) { | 2939 | for (i = 0; i < num_chan; i++) { |
2933 | pch = &pdmac->peripherals[i]; | 2940 | pch = &pdmac->peripherals[i]; |
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 616d90bcb3a4..d5dc9da7f99f 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -199,6 +199,36 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems) | |||
199 | return (void *)(((unsigned long)ptr) + align - r); | 199 | return (void *)(((unsigned long)ptr) + align - r); |
200 | } | 200 | } |
201 | 201 | ||
202 | static void _edac_mc_free(struct mem_ctl_info *mci) | ||
203 | { | ||
204 | int i, chn, row; | ||
205 | struct csrow_info *csr; | ||
206 | const unsigned int tot_dimms = mci->tot_dimms; | ||
207 | const unsigned int tot_channels = mci->num_cschannel; | ||
208 | const unsigned int tot_csrows = mci->nr_csrows; | ||
209 | |||
210 | if (mci->dimms) { | ||
211 | for (i = 0; i < tot_dimms; i++) | ||
212 | kfree(mci->dimms[i]); | ||
213 | kfree(mci->dimms); | ||
214 | } | ||
215 | if (mci->csrows) { | ||
216 | for (row = 0; row < tot_csrows; row++) { | ||
217 | csr = mci->csrows[row]; | ||
218 | if (csr) { | ||
219 | if (csr->channels) { | ||
220 | for (chn = 0; chn < tot_channels; chn++) | ||
221 | kfree(csr->channels[chn]); | ||
222 | kfree(csr->channels); | ||
223 | } | ||
224 | kfree(csr); | ||
225 | } | ||
226 | } | ||
227 | kfree(mci->csrows); | ||
228 | } | ||
229 | kfree(mci); | ||
230 | } | ||
231 | |||
202 | /** | 232 | /** |
203 | * edac_mc_alloc: Allocate and partially fill a struct mem_ctl_info structure | 233 | * edac_mc_alloc: Allocate and partially fill a struct mem_ctl_info structure |
204 | * @mc_num: Memory controller number | 234 | * @mc_num: Memory controller number |
@@ -413,24 +443,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
413 | return mci; | 443 | return mci; |
414 | 444 | ||
415 | error: | 445 | error: |
416 | if (mci->dimms) { | 446 | _edac_mc_free(mci); |
417 | for (i = 0; i < tot_dimms; i++) | ||
418 | kfree(mci->dimms[i]); | ||
419 | kfree(mci->dimms); | ||
420 | } | ||
421 | if (mci->csrows) { | ||
422 | for (chn = 0; chn < tot_channels; chn++) { | ||
423 | csr = mci->csrows[chn]; | ||
424 | if (csr) { | ||
425 | for (chn = 0; chn < tot_channels; chn++) | ||
426 | kfree(csr->channels[chn]); | ||
427 | kfree(csr); | ||
428 | } | ||
429 | kfree(mci->csrows[i]); | ||
430 | } | ||
431 | kfree(mci->csrows); | ||
432 | } | ||
433 | kfree(mci); | ||
434 | 447 | ||
435 | return NULL; | 448 | return NULL; |
436 | } | 449 | } |
@@ -445,6 +458,14 @@ void edac_mc_free(struct mem_ctl_info *mci) | |||
445 | { | 458 | { |
446 | edac_dbg(1, "\n"); | 459 | edac_dbg(1, "\n"); |
447 | 460 | ||
461 | /* If we're not yet registered with sysfs free only what was allocated | ||
462 | * in edac_mc_alloc(). | ||
463 | */ | ||
464 | if (!device_is_registered(&mci->dev)) { | ||
465 | _edac_mc_free(mci); | ||
466 | return; | ||
467 | } | ||
468 | |||
448 | /* the mci instance is freed here, when the sysfs object is dropped */ | 469 | /* the mci instance is freed here, when the sysfs object is dropped */ |
449 | edac_unregister_sysfs(mci); | 470 | edac_unregister_sysfs(mci); |
450 | } | 471 | } |
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c index 47180a08edad..b6653a6fc5d5 100644 --- a/drivers/edac/i3200_edac.c +++ b/drivers/edac/i3200_edac.c | |||
@@ -391,7 +391,7 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx) | |||
391 | for (j = 0; j < nr_channels; j++) { | 391 | for (j = 0; j < nr_channels; j++) { |
392 | struct dimm_info *dimm = csrow->channels[j]->dimm; | 392 | struct dimm_info *dimm = csrow->channels[j]->dimm; |
393 | 393 | ||
394 | dimm->nr_pages = nr_pages / nr_channels; | 394 | dimm->nr_pages = nr_pages; |
395 | dimm->grain = nr_pages << PAGE_SHIFT; | 395 | dimm->grain = nr_pages << PAGE_SHIFT; |
396 | dimm->mtype = MEM_DDR2; | 396 | dimm->mtype = MEM_DDR2; |
397 | dimm->dtype = DEV_UNKNOWN; | 397 | dimm->dtype = DEV_UNKNOWN; |
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index 39c63757c2a1..6a49dd00b81b 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
@@ -1012,6 +1012,10 @@ static void handle_channel(struct i5000_pvt *pvt, int slot, int channel, | |||
1012 | /* add the number of COLUMN bits */ | 1012 | /* add the number of COLUMN bits */ |
1013 | addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); | 1013 | addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr); |
1014 | 1014 | ||
1015 | /* Dual-rank memories have twice the size */ | ||
1016 | if (dinfo->dual_rank) | ||
1017 | addrBits++; | ||
1018 | |||
1015 | addrBits += 6; /* add 64 bits per DIMM */ | 1019 | addrBits += 6; /* add 64 bits per DIMM */ |
1016 | addrBits -= 20; /* divide by 2^^20 */ | 1020 | addrBits -= 20; /* divide by 2^^20 */ |
1017 | addrBits -= 3; /* 8 bits per bytes */ | 1021 | addrBits -= 3; /* 8 bits per bytes */ |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index f3b1f9fafa4b..5715b7c2c517 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
@@ -513,7 +513,8 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
513 | { | 513 | { |
514 | struct sbridge_pvt *pvt = mci->pvt_info; | 514 | struct sbridge_pvt *pvt = mci->pvt_info; |
515 | struct dimm_info *dimm; | 515 | struct dimm_info *dimm; |
516 | int i, j, banks, ranks, rows, cols, size, npages; | 516 | unsigned i, j, banks, ranks, rows, cols, npages; |
517 | u64 size; | ||
517 | u32 reg; | 518 | u32 reg; |
518 | enum edac_type mode; | 519 | enum edac_type mode; |
519 | enum mem_type mtype; | 520 | enum mem_type mtype; |
@@ -585,10 +586,10 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
585 | cols = numcol(mtr); | 586 | cols = numcol(mtr); |
586 | 587 | ||
587 | /* DDR3 has 8 I/O banks */ | 588 | /* DDR3 has 8 I/O banks */ |
588 | size = (rows * cols * banks * ranks) >> (20 - 3); | 589 | size = ((u64)rows * cols * banks * ranks) >> (20 - 3); |
589 | npages = MiB_TO_PAGES(size); | 590 | npages = MiB_TO_PAGES(size); |
590 | 591 | ||
591 | edac_dbg(0, "mc#%d: channel %d, dimm %d, %d Mb (%d pages) bank: %d, rank: %d, row: %#x, col: %#x\n", | 592 | edac_dbg(0, "mc#%d: channel %d, dimm %d, %Ld Mb (%d pages) bank: %d, rank: %d, row: %#x, col: %#x\n", |
592 | pvt->sbridge_dev->mc, i, j, | 593 | pvt->sbridge_dev->mc, i, j, |
593 | size, npages, | 594 | size, npages, |
594 | banks, ranks, rows, cols); | 595 | banks, ranks, rows, cols); |
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 920a609b2c35..38f9e52f358b 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -669,13 +669,18 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev) | |||
669 | } | 669 | } |
670 | info->dev = &pdev->dev; | 670 | info->dev = &pdev->dev; |
671 | info->max77693 = max77693; | 671 | info->max77693 = max77693; |
672 | info->max77693->regmap_muic = regmap_init_i2c(info->max77693->muic, | 672 | if (info->max77693->regmap_muic) |
673 | &max77693_muic_regmap_config); | 673 | dev_dbg(&pdev->dev, "allocate register map\n"); |
674 | if (IS_ERR(info->max77693->regmap_muic)) { | 674 | else { |
675 | ret = PTR_ERR(info->max77693->regmap_muic); | 675 | info->max77693->regmap_muic = devm_regmap_init_i2c( |
676 | dev_err(max77693->dev, | 676 | info->max77693->muic, |
677 | "failed to allocate register map: %d\n", ret); | 677 | &max77693_muic_regmap_config); |
678 | goto err_regmap; | 678 | if (IS_ERR(info->max77693->regmap_muic)) { |
679 | ret = PTR_ERR(info->max77693->regmap_muic); | ||
680 | dev_err(max77693->dev, | ||
681 | "failed to allocate register map: %d\n", ret); | ||
682 | goto err_regmap; | ||
683 | } | ||
679 | } | 684 | } |
680 | platform_set_drvdata(pdev, info); | 685 | platform_set_drvdata(pdev, info); |
681 | mutex_init(&info->mutex); | 686 | mutex_init(&info->mutex); |
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c index 8a420f13905e..ed94b4ea72e9 100644 --- a/drivers/gpio/gpio-lpc32xx.c +++ b/drivers/gpio/gpio-lpc32xx.c | |||
@@ -308,6 +308,7 @@ static int lpc32xx_gpio_dir_output_p012(struct gpio_chip *chip, unsigned pin, | |||
308 | { | 308 | { |
309 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); | 309 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); |
310 | 310 | ||
311 | __set_gpio_level_p012(group, pin, value); | ||
311 | __set_gpio_dir_p012(group, pin, 0); | 312 | __set_gpio_dir_p012(group, pin, 0); |
312 | 313 | ||
313 | return 0; | 314 | return 0; |
@@ -318,6 +319,7 @@ static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin, | |||
318 | { | 319 | { |
319 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); | 320 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); |
320 | 321 | ||
322 | __set_gpio_level_p3(group, pin, value); | ||
321 | __set_gpio_dir_p3(group, pin, 0); | 323 | __set_gpio_dir_p3(group, pin, 0); |
322 | 324 | ||
323 | return 0; | 325 | return 0; |
@@ -326,6 +328,9 @@ static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin, | |||
326 | static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin, | 328 | static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin, |
327 | int value) | 329 | int value) |
328 | { | 330 | { |
331 | struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip); | ||
332 | |||
333 | __set_gpo_level_p3(group, pin, value); | ||
329 | return 0; | 334 | return 0; |
330 | } | 335 | } |
331 | 336 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 489e2b162b27..274d25de521e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3242,7 +3242,8 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, | |||
3242 | { | 3242 | { |
3243 | int ret; | 3243 | int ret; |
3244 | 3244 | ||
3245 | BUG_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT); | 3245 | if (WARN_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) |
3246 | return -EBUSY; | ||
3246 | 3247 | ||
3247 | if (obj->gtt_space != NULL) { | 3248 | if (obj->gtt_space != NULL) { |
3248 | if ((alignment && obj->gtt_offset & (alignment - 1)) || | 3249 | if ((alignment && obj->gtt_offset & (alignment - 1)) || |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bc2ad348e5d8..c040aee1341c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -4191,12 +4191,6 @@ static void i8xx_update_pll(struct drm_crtc *crtc, | |||
4191 | POSTING_READ(DPLL(pipe)); | 4191 | POSTING_READ(DPLL(pipe)); |
4192 | udelay(150); | 4192 | udelay(150); |
4193 | 4193 | ||
4194 | I915_WRITE(DPLL(pipe), dpll); | ||
4195 | |||
4196 | /* Wait for the clocks to stabilize. */ | ||
4197 | POSTING_READ(DPLL(pipe)); | ||
4198 | udelay(150); | ||
4199 | |||
4200 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. | 4194 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. |
4201 | * This is an exception to the general rule that mode_set doesn't turn | 4195 | * This is an exception to the general rule that mode_set doesn't turn |
4202 | * things on. | 4196 | * things on. |
@@ -4204,6 +4198,12 @@ static void i8xx_update_pll(struct drm_crtc *crtc, | |||
4204 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 4198 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) |
4205 | intel_update_lvds(crtc, clock, adjusted_mode); | 4199 | intel_update_lvds(crtc, clock, adjusted_mode); |
4206 | 4200 | ||
4201 | I915_WRITE(DPLL(pipe), dpll); | ||
4202 | |||
4203 | /* Wait for the clocks to stabilize. */ | ||
4204 | POSTING_READ(DPLL(pipe)); | ||
4205 | udelay(150); | ||
4206 | |||
4207 | /* The pixel multiplier can only be updated once the | 4207 | /* The pixel multiplier can only be updated once the |
4208 | * DPLL is enabled and the clocks are stable. | 4208 | * DPLL is enabled and the clocks are stable. |
4209 | * | 4209 | * |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 98f602427eb8..12dc3308ab8c 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -609,7 +609,7 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) | |||
609 | u32 temp; | 609 | u32 temp; |
610 | u32 enable_bits = SDVO_ENABLE; | 610 | u32 enable_bits = SDVO_ENABLE; |
611 | 611 | ||
612 | if (intel_hdmi->has_audio) | 612 | if (intel_hdmi->has_audio || mode != DRM_MODE_DPMS_ON) |
613 | enable_bits |= SDVO_AUDIO_ENABLE; | 613 | enable_bits |= SDVO_AUDIO_ENABLE; |
614 | 614 | ||
615 | temp = I915_READ(intel_hdmi->sdvox_reg); | 615 | temp = I915_READ(intel_hdmi->sdvox_reg); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index ff23d88880e5..3ca240b4413d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
@@ -179,7 +179,7 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) | |||
179 | return 0; | 179 | return 0; |
180 | } else | 180 | } else |
181 | if (init->class == 0x906e) { | 181 | if (init->class == 0x906e) { |
182 | NV_ERROR(dev, "906e not supported yet\n"); | 182 | NV_DEBUG(dev, "906e not supported yet\n"); |
183 | return -EINVAL; | 183 | return -EINVAL; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_gpio.c b/drivers/gpu/drm/nouveau/nv50_gpio.c index f03490534893..c399d510b27a 100644 --- a/drivers/gpu/drm/nouveau/nv50_gpio.c +++ b/drivers/gpu/drm/nouveau/nv50_gpio.c | |||
@@ -22,6 +22,7 @@ | |||
22 | * Authors: Ben Skeggs | 22 | * Authors: Ben Skeggs |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/dmi.h> | ||
25 | #include "drmP.h" | 26 | #include "drmP.h" |
26 | #include "nouveau_drv.h" | 27 | #include "nouveau_drv.h" |
27 | #include "nouveau_hw.h" | 28 | #include "nouveau_hw.h" |
@@ -110,13 +111,25 @@ nv50_gpio_isr(struct drm_device *dev) | |||
110 | nv_wr32(dev, 0xe074, intr1); | 111 | nv_wr32(dev, 0xe074, intr1); |
111 | } | 112 | } |
112 | 113 | ||
114 | static struct dmi_system_id gpio_reset_ids[] = { | ||
115 | { | ||
116 | .ident = "Apple Macbook 10,1", | ||
117 | .matches = { | ||
118 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
119 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro10,1"), | ||
120 | } | ||
121 | }, | ||
122 | { } | ||
123 | }; | ||
124 | |||
113 | int | 125 | int |
114 | nv50_gpio_init(struct drm_device *dev) | 126 | nv50_gpio_init(struct drm_device *dev) |
115 | { | 127 | { |
116 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 128 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
117 | 129 | ||
118 | /* initialise gpios and routing to vbios defaults */ | 130 | /* initialise gpios and routing to vbios defaults */ |
119 | nouveau_gpio_reset(dev); | 131 | if (dmi_check_system(gpio_reset_ids)) |
132 | nouveau_gpio_reset(dev); | ||
120 | 133 | ||
121 | /* disable, and ack any pending gpio interrupts */ | 134 | /* disable, and ack any pending gpio interrupts */ |
122 | nv_wr32(dev, 0xe050, 0x00000000); | 135 | nv_wr32(dev, 0xe050, 0x00000000); |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index f704e942372e..f376c39310df 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
@@ -124,6 +124,7 @@ nvc0_fb_init(struct drm_device *dev) | |||
124 | priv = dev_priv->engine.fb.priv; | 124 | priv = dev_priv->engine.fb.priv; |
125 | 125 | ||
126 | nv_wr32(dev, 0x100c10, priv->r100c10 >> 8); | 126 | nv_wr32(dev, 0x100c10, priv->r100c10 >> 8); |
127 | nv_mask(dev, 0x17e820, 0x00100000, 0x00000000); /* NV_PLTCG_INTR_EN */ | ||
127 | return 0; | 128 | return 0; |
128 | } | 129 | } |
129 | 130 | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_fifo.c b/drivers/gpu/drm/nouveau/nvc0_fifo.c index 7d85553d518c..cd39eb99f5b1 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fifo.c +++ b/drivers/gpu/drm/nouveau/nvc0_fifo.c | |||
@@ -373,7 +373,8 @@ nvc0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit) | |||
373 | static void | 373 | static void |
374 | nvc0_fifo_isr(struct drm_device *dev) | 374 | nvc0_fifo_isr(struct drm_device *dev) |
375 | { | 375 | { |
376 | u32 stat = nv_rd32(dev, 0x002100); | 376 | u32 mask = nv_rd32(dev, 0x002140); |
377 | u32 stat = nv_rd32(dev, 0x002100) & mask; | ||
377 | 378 | ||
378 | if (stat & 0x00000100) { | 379 | if (stat & 0x00000100) { |
379 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); | 380 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); |
diff --git a/drivers/gpu/drm/nouveau/nve0_fifo.c b/drivers/gpu/drm/nouveau/nve0_fifo.c index e98d144e6eb9..281bece751b6 100644 --- a/drivers/gpu/drm/nouveau/nve0_fifo.c +++ b/drivers/gpu/drm/nouveau/nve0_fifo.c | |||
@@ -345,7 +345,8 @@ nve0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit) | |||
345 | static void | 345 | static void |
346 | nve0_fifo_isr(struct drm_device *dev) | 346 | nve0_fifo_isr(struct drm_device *dev) |
347 | { | 347 | { |
348 | u32 stat = nv_rd32(dev, 0x002100); | 348 | u32 mask = nv_rd32(dev, 0x002140); |
349 | u32 stat = nv_rd32(dev, 0x002100) & mask; | ||
349 | 350 | ||
350 | if (stat & 0x00000100) { | 351 | if (stat & 0x00000100) { |
351 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); | 352 | NV_INFO(dev, "PFIFO: unknown status 0x00000100\n"); |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index e721e3087b99..2817101fb167 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1479,98 +1479,14 @@ static void radeon_legacy_atom_fixup(struct drm_crtc *crtc) | |||
1479 | } | 1479 | } |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | /** | ||
1483 | * radeon_get_pll_use_mask - look up a mask of which pplls are in use | ||
1484 | * | ||
1485 | * @crtc: drm crtc | ||
1486 | * | ||
1487 | * Returns the mask of which PPLLs (Pixel PLLs) are in use. | ||
1488 | */ | ||
1489 | static u32 radeon_get_pll_use_mask(struct drm_crtc *crtc) | ||
1490 | { | ||
1491 | struct drm_device *dev = crtc->dev; | ||
1492 | struct drm_crtc *test_crtc; | ||
1493 | struct radeon_crtc *radeon_test_crtc; | ||
1494 | u32 pll_in_use = 0; | ||
1495 | |||
1496 | list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) { | ||
1497 | if (crtc == test_crtc) | ||
1498 | continue; | ||
1499 | |||
1500 | radeon_test_crtc = to_radeon_crtc(test_crtc); | ||
1501 | if (radeon_test_crtc->pll_id != ATOM_PPLL_INVALID) | ||
1502 | pll_in_use |= (1 << radeon_test_crtc->pll_id); | ||
1503 | } | ||
1504 | return pll_in_use; | ||
1505 | } | ||
1506 | |||
1507 | /** | ||
1508 | * radeon_get_shared_dp_ppll - return the PPLL used by another crtc for DP | ||
1509 | * | ||
1510 | * @crtc: drm crtc | ||
1511 | * | ||
1512 | * Returns the PPLL (Pixel PLL) used by another crtc/encoder which is | ||
1513 | * also in DP mode. For DP, a single PPLL can be used for all DP | ||
1514 | * crtcs/encoders. | ||
1515 | */ | ||
1516 | static int radeon_get_shared_dp_ppll(struct drm_crtc *crtc) | ||
1517 | { | ||
1518 | struct drm_device *dev = crtc->dev; | ||
1519 | struct drm_encoder *test_encoder; | ||
1520 | struct radeon_crtc *radeon_test_crtc; | ||
1521 | |||
1522 | list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) { | ||
1523 | if (test_encoder->crtc && (test_encoder->crtc != crtc)) { | ||
1524 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) { | ||
1525 | /* for DP use the same PLL for all */ | ||
1526 | radeon_test_crtc = to_radeon_crtc(test_encoder->crtc); | ||
1527 | if (radeon_test_crtc->pll_id != ATOM_PPLL_INVALID) | ||
1528 | return radeon_test_crtc->pll_id; | ||
1529 | } | ||
1530 | } | ||
1531 | } | ||
1532 | return ATOM_PPLL_INVALID; | ||
1533 | } | ||
1534 | |||
1535 | /** | ||
1536 | * radeon_atom_pick_pll - Allocate a PPLL for use by the crtc. | ||
1537 | * | ||
1538 | * @crtc: drm crtc | ||
1539 | * | ||
1540 | * Returns the PPLL (Pixel PLL) to be used by the crtc. For DP monitors | ||
1541 | * a single PPLL can be used for all DP crtcs/encoders. For non-DP | ||
1542 | * monitors a dedicated PPLL must be used. If a particular board has | ||
1543 | * an external DP PLL, return ATOM_PPLL_INVALID to skip PLL programming | ||
1544 | * as there is no need to program the PLL itself. If we are not able to | ||
1545 | * allocate a PLL, return ATOM_PPLL_INVALID to skip PLL programming to | ||
1546 | * avoid messing up an existing monitor. | ||
1547 | * | ||
1548 | * Asic specific PLL information | ||
1549 | * | ||
1550 | * DCE 6.1 | ||
1551 | * - PPLL2 is only available to UNIPHYA (both DP and non-DP) | ||
1552 | * - PPLL0, PPLL1 are available for UNIPHYB/C/D/E/F (both DP and non-DP) | ||
1553 | * | ||
1554 | * DCE 6.0 | ||
1555 | * - PPLL0 is available to all UNIPHY (DP only) | ||
1556 | * - PPLL1, PPLL2 are available for all UNIPHY (both DP and non-DP) and DAC | ||
1557 | * | ||
1558 | * DCE 5.0 | ||
1559 | * - DCPLL is available to all UNIPHY (DP only) | ||
1560 | * - PPLL1, PPLL2 are available for all UNIPHY (both DP and non-DP) and DAC | ||
1561 | * | ||
1562 | * DCE 3.0/4.0/4.1 | ||
1563 | * - PPLL1, PPLL2 are available for all UNIPHY (both DP and non-DP) and DAC | ||
1564 | * | ||
1565 | */ | ||
1566 | static int radeon_atom_pick_pll(struct drm_crtc *crtc) | 1482 | static int radeon_atom_pick_pll(struct drm_crtc *crtc) |
1567 | { | 1483 | { |
1568 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 1484 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
1569 | struct drm_device *dev = crtc->dev; | 1485 | struct drm_device *dev = crtc->dev; |
1570 | struct radeon_device *rdev = dev->dev_private; | 1486 | struct radeon_device *rdev = dev->dev_private; |
1571 | struct drm_encoder *test_encoder; | 1487 | struct drm_encoder *test_encoder; |
1572 | u32 pll_in_use; | 1488 | struct drm_crtc *test_crtc; |
1573 | int pll; | 1489 | uint32_t pll_in_use = 0; |
1574 | 1490 | ||
1575 | if (ASIC_IS_DCE61(rdev)) { | 1491 | if (ASIC_IS_DCE61(rdev)) { |
1576 | list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) { | 1492 | list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) { |
@@ -1582,40 +1498,32 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1582 | 1498 | ||
1583 | if ((test_radeon_encoder->encoder_id == | 1499 | if ((test_radeon_encoder->encoder_id == |
1584 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY) && | 1500 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY) && |
1585 | (dig->linkb == false)) | 1501 | (dig->linkb == false)) /* UNIPHY A uses PPLL2 */ |
1586 | /* UNIPHY A uses PPLL2 */ | ||
1587 | return ATOM_PPLL2; | 1502 | return ATOM_PPLL2; |
1588 | else if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) { | ||
1589 | /* UNIPHY B/C/D/E/F */ | ||
1590 | if (rdev->clock.dp_extclk) | ||
1591 | /* skip PPLL programming if using ext clock */ | ||
1592 | return ATOM_PPLL_INVALID; | ||
1593 | else { | ||
1594 | /* use the same PPLL for all DP monitors */ | ||
1595 | pll = radeon_get_shared_dp_ppll(crtc); | ||
1596 | if (pll != ATOM_PPLL_INVALID) | ||
1597 | return pll; | ||
1598 | } | ||
1599 | } | ||
1600 | break; | ||
1601 | } | 1503 | } |
1602 | } | 1504 | } |
1603 | /* UNIPHY B/C/D/E/F */ | 1505 | /* UNIPHY B/C/D/E/F */ |
1604 | pll_in_use = radeon_get_pll_use_mask(crtc); | 1506 | list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) { |
1605 | if (!(pll_in_use & (1 << ATOM_PPLL0))) | 1507 | struct radeon_crtc *radeon_test_crtc; |
1508 | |||
1509 | if (crtc == test_crtc) | ||
1510 | continue; | ||
1511 | |||
1512 | radeon_test_crtc = to_radeon_crtc(test_crtc); | ||
1513 | if ((radeon_test_crtc->pll_id == ATOM_PPLL0) || | ||
1514 | (radeon_test_crtc->pll_id == ATOM_PPLL1)) | ||
1515 | pll_in_use |= (1 << radeon_test_crtc->pll_id); | ||
1516 | } | ||
1517 | if (!(pll_in_use & 4)) | ||
1606 | return ATOM_PPLL0; | 1518 | return ATOM_PPLL0; |
1607 | if (!(pll_in_use & (1 << ATOM_PPLL1))) | 1519 | return ATOM_PPLL1; |
1608 | return ATOM_PPLL1; | ||
1609 | DRM_ERROR("unable to allocate a PPLL\n"); | ||
1610 | return ATOM_PPLL_INVALID; | ||
1611 | } else if (ASIC_IS_DCE4(rdev)) { | 1520 | } else if (ASIC_IS_DCE4(rdev)) { |
1612 | list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) { | 1521 | list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) { |
1613 | if (test_encoder->crtc && (test_encoder->crtc == crtc)) { | 1522 | if (test_encoder->crtc && (test_encoder->crtc == crtc)) { |
1614 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, | 1523 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, |
1615 | * depending on the asic: | 1524 | * depending on the asic: |
1616 | * DCE4: PPLL or ext clock | 1525 | * DCE4: PPLL or ext clock |
1617 | * DCE5: PPLL, DCPLL, or ext clock | 1526 | * DCE5: DCPLL or ext clock |
1618 | * DCE6: PPLL, PPLL0, or ext clock | ||
1619 | * | 1527 | * |
1620 | * Setting ATOM_PPLL_INVALID will cause SetPixelClock to skip | 1528 | * Setting ATOM_PPLL_INVALID will cause SetPixelClock to skip |
1621 | * PPLL/DCPLL programming and only program the DP DTO for the | 1529 | * PPLL/DCPLL programming and only program the DP DTO for the |
@@ -1623,34 +1531,31 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1623 | */ | 1531 | */ |
1624 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) { | 1532 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) { |
1625 | if (rdev->clock.dp_extclk) | 1533 | if (rdev->clock.dp_extclk) |
1626 | /* skip PPLL programming if using ext clock */ | ||
1627 | return ATOM_PPLL_INVALID; | 1534 | return ATOM_PPLL_INVALID; |
1628 | else if (ASIC_IS_DCE6(rdev)) | 1535 | else if (ASIC_IS_DCE6(rdev)) |
1629 | /* use PPLL0 for all DP */ | ||
1630 | return ATOM_PPLL0; | 1536 | return ATOM_PPLL0; |
1631 | else if (ASIC_IS_DCE5(rdev)) | 1537 | else if (ASIC_IS_DCE5(rdev)) |
1632 | /* use DCPLL for all DP */ | ||
1633 | return ATOM_DCPLL; | 1538 | return ATOM_DCPLL; |
1634 | else { | ||
1635 | /* use the same PPLL for all DP monitors */ | ||
1636 | pll = radeon_get_shared_dp_ppll(crtc); | ||
1637 | if (pll != ATOM_PPLL_INVALID) | ||
1638 | return pll; | ||
1639 | } | ||
1640 | } | 1539 | } |
1641 | break; | ||
1642 | } | 1540 | } |
1643 | } | 1541 | } |
1644 | /* all other cases */ | 1542 | |
1645 | pll_in_use = radeon_get_pll_use_mask(crtc); | 1543 | /* otherwise, pick one of the plls */ |
1646 | if (!(pll_in_use & (1 << ATOM_PPLL2))) | 1544 | list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) { |
1647 | return ATOM_PPLL2; | 1545 | struct radeon_crtc *radeon_test_crtc; |
1648 | if (!(pll_in_use & (1 << ATOM_PPLL1))) | 1546 | |
1547 | if (crtc == test_crtc) | ||
1548 | continue; | ||
1549 | |||
1550 | radeon_test_crtc = to_radeon_crtc(test_crtc); | ||
1551 | if ((radeon_test_crtc->pll_id >= ATOM_PPLL1) && | ||
1552 | (radeon_test_crtc->pll_id <= ATOM_PPLL2)) | ||
1553 | pll_in_use |= (1 << radeon_test_crtc->pll_id); | ||
1554 | } | ||
1555 | if (!(pll_in_use & 1)) | ||
1649 | return ATOM_PPLL1; | 1556 | return ATOM_PPLL1; |
1650 | DRM_ERROR("unable to allocate a PPLL\n"); | 1557 | return ATOM_PPLL2; |
1651 | return ATOM_PPLL_INVALID; | ||
1652 | } else | 1558 | } else |
1653 | /* use PPLL1 or PPLL2 */ | ||
1654 | return radeon_crtc->crtc_id; | 1559 | return radeon_crtc->crtc_id; |
1655 | 1560 | ||
1656 | } | 1561 | } |
@@ -1792,7 +1697,7 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) | |||
1792 | break; | 1697 | break; |
1793 | } | 1698 | } |
1794 | done: | 1699 | done: |
1795 | radeon_crtc->pll_id = ATOM_PPLL_INVALID; | 1700 | radeon_crtc->pll_id = -1; |
1796 | } | 1701 | } |
1797 | 1702 | ||
1798 | static const struct drm_crtc_helper_funcs atombios_helper_funcs = { | 1703 | static const struct drm_crtc_helper_funcs atombios_helper_funcs = { |
@@ -1841,6 +1746,6 @@ void radeon_atombios_init_crtc(struct drm_device *dev, | |||
1841 | else | 1746 | else |
1842 | radeon_crtc->crtc_offset = 0; | 1747 | radeon_crtc->crtc_offset = 0; |
1843 | } | 1748 | } |
1844 | radeon_crtc->pll_id = ATOM_PPLL_INVALID; | 1749 | radeon_crtc->pll_id = -1; |
1845 | drm_crtc_helper_add(&radeon_crtc->base, &atombios_helper_funcs); | 1750 | drm_crtc_helper_add(&radeon_crtc->base, &atombios_helper_funcs); |
1846 | } | 1751 | } |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 8acb34fd3fd5..8d7e33a0b243 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -1182,7 +1182,8 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
1182 | ring->ready = true; | 1182 | ring->ready = true; |
1183 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); | 1183 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); |
1184 | 1184 | ||
1185 | if (radeon_ring_supports_scratch_reg(rdev, ring)) { | 1185 | if (!ring->rptr_save_reg /* not resuming from suspend */ |
1186 | && radeon_ring_supports_scratch_reg(rdev, ring)) { | ||
1186 | r = radeon_scratch_get(rdev, &ring->rptr_save_reg); | 1187 | r = radeon_scratch_get(rdev, &ring->rptr_save_reg); |
1187 | if (r) { | 1188 | if (r) { |
1188 | DRM_ERROR("failed to get scratch reg for rptr save (%d).\n", r); | 1189 | DRM_ERROR("failed to get scratch reg for rptr save (%d).\n", r); |
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c index ba055e9ca007..8d9dc44f1f94 100644 --- a/drivers/gpu/drm/udl/udl_connector.c +++ b/drivers/gpu/drm/udl/udl_connector.c | |||
@@ -69,6 +69,13 @@ static int udl_get_modes(struct drm_connector *connector) | |||
69 | static int udl_mode_valid(struct drm_connector *connector, | 69 | static int udl_mode_valid(struct drm_connector *connector, |
70 | struct drm_display_mode *mode) | 70 | struct drm_display_mode *mode) |
71 | { | 71 | { |
72 | struct udl_device *udl = connector->dev->dev_private; | ||
73 | if (!udl->sku_pixel_limit) | ||
74 | return 0; | ||
75 | |||
76 | if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit) | ||
77 | return MODE_VIRTUAL_Y; | ||
78 | |||
72 | return 0; | 79 | return 0; |
73 | } | 80 | } |
74 | 81 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c index f2fb8f15e2f1..7e0743358dff 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | |||
@@ -1018,7 +1018,7 @@ int vmw_event_fence_action_create(struct drm_file *file_priv, | |||
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | 1020 | ||
1021 | event = kzalloc(sizeof(event->event), GFP_KERNEL); | 1021 | event = kzalloc(sizeof(*event), GFP_KERNEL); |
1022 | if (unlikely(event == NULL)) { | 1022 | if (unlikely(event == NULL)) { |
1023 | DRM_ERROR("Failed to allocate an event.\n"); | 1023 | DRM_ERROR("Failed to allocate an event.\n"); |
1024 | ret = -ENOMEM; | 1024 | ret = -ENOMEM; |
diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c index 77d2df04c97b..60c4e1e85913 100644 --- a/drivers/hid/hid-lenovo-tpkbd.c +++ b/drivers/hid/hid-lenovo-tpkbd.c | |||
@@ -519,6 +519,8 @@ static void tpkbd_remove_tp(struct hid_device *hdev) | |||
519 | led_classdev_unregister(&data_pointer->led_mute); | 519 | led_classdev_unregister(&data_pointer->led_mute); |
520 | 520 | ||
521 | hid_set_drvdata(hdev, NULL); | 521 | hid_set_drvdata(hdev, NULL); |
522 | kfree(data_pointer->led_micmute.name); | ||
523 | kfree(data_pointer->led_mute.name); | ||
522 | kfree(data_pointer); | 524 | kfree(data_pointer); |
523 | } | 525 | } |
524 | 526 | ||
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 4d524b5f52f5..9500f2f3f8fe 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -193,6 +193,7 @@ static struct hid_ll_driver logi_dj_ll_driver; | |||
193 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, | 193 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, |
194 | size_t count, | 194 | size_t count, |
195 | unsigned char report_type); | 195 | unsigned char report_type); |
196 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev); | ||
196 | 197 | ||
197 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, | 198 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, |
198 | struct dj_report *dj_report) | 199 | struct dj_report *dj_report) |
@@ -233,6 +234,7 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
233 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & | 234 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & |
234 | SPFUNCTION_DEVICE_LIST_EMPTY) { | 235 | SPFUNCTION_DEVICE_LIST_EMPTY) { |
235 | dbg_hid("%s: device list is empty\n", __func__); | 236 | dbg_hid("%s: device list is empty\n", __func__); |
237 | djrcv_dev->querying_devices = false; | ||
236 | return; | 238 | return; |
237 | } | 239 | } |
238 | 240 | ||
@@ -243,6 +245,12 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
243 | return; | 245 | return; |
244 | } | 246 | } |
245 | 247 | ||
248 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | ||
249 | /* The device is already known. No need to reallocate it. */ | ||
250 | dbg_hid("%s: device is already known\n", __func__); | ||
251 | return; | ||
252 | } | ||
253 | |||
246 | dj_hiddev = hid_allocate_device(); | 254 | dj_hiddev = hid_allocate_device(); |
247 | if (IS_ERR(dj_hiddev)) { | 255 | if (IS_ERR(dj_hiddev)) { |
248 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", | 256 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", |
@@ -306,6 +314,7 @@ static void delayedwork_callback(struct work_struct *work) | |||
306 | struct dj_report dj_report; | 314 | struct dj_report dj_report; |
307 | unsigned long flags; | 315 | unsigned long flags; |
308 | int count; | 316 | int count; |
317 | int retval; | ||
309 | 318 | ||
310 | dbg_hid("%s\n", __func__); | 319 | dbg_hid("%s\n", __func__); |
311 | 320 | ||
@@ -338,6 +347,25 @@ static void delayedwork_callback(struct work_struct *work) | |||
338 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); | 347 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); |
339 | break; | 348 | break; |
340 | default: | 349 | default: |
350 | /* A normal report (i. e. not belonging to a pair/unpair notification) | ||
351 | * arriving here, means that the report arrived but we did not have a | ||
352 | * paired dj_device associated to the report's device_index, this | ||
353 | * means that the original "device paired" notification corresponding | ||
354 | * to this dj_device never arrived to this driver. The reason is that | ||
355 | * hid-core discards all packets coming from a device while probe() is | ||
356 | * executing. */ | ||
357 | if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) { | ||
358 | /* ok, we don't know the device, just re-ask the | ||
359 | * receiver for the list of connected devices. */ | ||
360 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); | ||
361 | if (!retval) { | ||
362 | /* everything went fine, so just leave */ | ||
363 | break; | ||
364 | } | ||
365 | dev_err(&djrcv_dev->hdev->dev, | ||
366 | "%s:logi_dj_recv_query_paired_devices " | ||
367 | "error:%d\n", __func__, retval); | ||
368 | } | ||
341 | dbg_hid("%s: unexpected report type\n", __func__); | 369 | dbg_hid("%s: unexpected report type\n", __func__); |
342 | } | 370 | } |
343 | } | 371 | } |
@@ -368,6 +396,12 @@ static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev, | |||
368 | if (!djdev) { | 396 | if (!djdev) { |
369 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" | 397 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" |
370 | " is NULL, index %d\n", dj_report->device_index); | 398 | " is NULL, index %d\n", dj_report->device_index); |
399 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | ||
400 | |||
401 | if (schedule_work(&djrcv_dev->work) == 0) { | ||
402 | dbg_hid("%s: did not schedule the work item, was already " | ||
403 | "queued\n", __func__); | ||
404 | } | ||
371 | return; | 405 | return; |
372 | } | 406 | } |
373 | 407 | ||
@@ -398,6 +432,12 @@ static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev, | |||
398 | if (dj_device == NULL) { | 432 | if (dj_device == NULL) { |
399 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" | 433 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" |
400 | " is NULL, index %d\n", dj_report->device_index); | 434 | " is NULL, index %d\n", dj_report->device_index); |
435 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | ||
436 | |||
437 | if (schedule_work(&djrcv_dev->work) == 0) { | ||
438 | dbg_hid("%s: did not schedule the work item, was already " | ||
439 | "queued\n", __func__); | ||
440 | } | ||
401 | return; | 441 | return; |
402 | } | 442 | } |
403 | 443 | ||
@@ -439,6 +479,10 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
439 | struct dj_report *dj_report; | 479 | struct dj_report *dj_report; |
440 | int retval; | 480 | int retval; |
441 | 481 | ||
482 | /* no need to protect djrcv_dev->querying_devices */ | ||
483 | if (djrcv_dev->querying_devices) | ||
484 | return 0; | ||
485 | |||
442 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); | 486 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); |
443 | if (!dj_report) | 487 | if (!dj_report) |
444 | return -ENOMEM; | 488 | return -ENOMEM; |
@@ -450,6 +494,7 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
450 | return retval; | 494 | return retval; |
451 | } | 495 | } |
452 | 496 | ||
497 | |||
453 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, | 498 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, |
454 | unsigned timeout) | 499 | unsigned timeout) |
455 | { | 500 | { |
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h index fd28a5e0ca3b..4a4000340ce1 100644 --- a/drivers/hid/hid-logitech-dj.h +++ b/drivers/hid/hid-logitech-dj.h | |||
@@ -101,6 +101,7 @@ struct dj_receiver_dev { | |||
101 | struct work_struct work; | 101 | struct work_struct work; |
102 | struct kfifo notif_fifo; | 102 | struct kfifo notif_fifo; |
103 | spinlock_t lock; | 103 | spinlock_t lock; |
104 | bool querying_devices; | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | struct dj_device { | 107 | struct dj_device { |
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index cfec802cf9ca..f915eb1c29f7 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | static ssize_t ad7314_show_name(struct device *dev, | ||
91 | struct device_attribute *devattr, char *buf) | ||
92 | { | ||
93 | return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); | ||
94 | } | ||
95 | |||
96 | static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL); | ||
90 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, | 97 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, |
91 | ad7314_show_temperature, NULL, 0); | 98 | ad7314_show_temperature, NULL, 0); |
92 | 99 | ||
93 | static struct attribute *ad7314_attributes[] = { | 100 | static struct attribute *ad7314_attributes[] = { |
101 | &dev_attr_name.attr, | ||
94 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 102 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
95 | NULL, | 103 | NULL, |
96 | }; | 104 | }; |
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index e65c6e45d36b..7bf4ce3d405e 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c | |||
@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | static ssize_t ads7871_show_name(struct device *dev, | ||
143 | struct device_attribute *devattr, char *buf) | ||
144 | { | ||
145 | return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); | ||
146 | } | ||
147 | |||
142 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); | 148 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); |
143 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); | 149 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); |
144 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); | 150 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); |
@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); | |||
148 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); | 154 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); |
149 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); | 155 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); |
150 | 156 | ||
157 | static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); | ||
158 | |||
151 | static struct attribute *ads7871_attributes[] = { | 159 | static struct attribute *ads7871_attributes[] = { |
152 | &sensor_dev_attr_in0_input.dev_attr.attr, | 160 | &sensor_dev_attr_in0_input.dev_attr.attr, |
153 | &sensor_dev_attr_in1_input.dev_attr.attr, | 161 | &sensor_dev_attr_in1_input.dev_attr.attr, |
@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { | |||
157 | &sensor_dev_attr_in5_input.dev_attr.attr, | 165 | &sensor_dev_attr_in5_input.dev_attr.attr, |
158 | &sensor_dev_attr_in6_input.dev_attr.attr, | 166 | &sensor_dev_attr_in6_input.dev_attr.attr, |
159 | &sensor_dev_attr_in7_input.dev_attr.attr, | 167 | &sensor_dev_attr_in7_input.dev_attr.attr, |
168 | &dev_attr_name.attr, | ||
160 | NULL | 169 | NULL |
161 | }; | 170 | }; |
162 | 171 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 282708860517..8f3f6f2c45fd 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -53,10 +53,10 @@ | |||
53 | 53 | ||
54 | #define APPLESMC_MAX_DATA_LENGTH 32 | 54 | #define APPLESMC_MAX_DATA_LENGTH 32 |
55 | 55 | ||
56 | /* wait up to 32 ms for a status change. */ | 56 | /* wait up to 128 ms for a status change. */ |
57 | #define APPLESMC_MIN_WAIT 0x0010 | 57 | #define APPLESMC_MIN_WAIT 0x0010 |
58 | #define APPLESMC_RETRY_WAIT 0x0100 | 58 | #define APPLESMC_RETRY_WAIT 0x0100 |
59 | #define APPLESMC_MAX_WAIT 0x8000 | 59 | #define APPLESMC_MAX_WAIT 0x20000 |
60 | 60 | ||
61 | #define APPLESMC_READ_CMD 0x10 | 61 | #define APPLESMC_READ_CMD 0x10 |
62 | #define APPLESMC_WRITE_CMD 0x11 | 62 | #define APPLESMC_WRITE_CMD 0x11 |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0fa356fe82cc..984a3f13923b 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -815,17 +815,20 @@ static int __init coretemp_init(void) | |||
815 | if (err) | 815 | if (err) |
816 | goto exit; | 816 | goto exit; |
817 | 817 | ||
818 | get_online_cpus(); | ||
818 | for_each_online_cpu(i) | 819 | for_each_online_cpu(i) |
819 | get_core_online(i); | 820 | get_core_online(i); |
820 | 821 | ||
821 | #ifndef CONFIG_HOTPLUG_CPU | 822 | #ifndef CONFIG_HOTPLUG_CPU |
822 | if (list_empty(&pdev_list)) { | 823 | if (list_empty(&pdev_list)) { |
824 | put_online_cpus(); | ||
823 | err = -ENODEV; | 825 | err = -ENODEV; |
824 | goto exit_driver_unreg; | 826 | goto exit_driver_unreg; |
825 | } | 827 | } |
826 | #endif | 828 | #endif |
827 | 829 | ||
828 | register_hotcpu_notifier(&coretemp_cpu_notifier); | 830 | register_hotcpu_notifier(&coretemp_cpu_notifier); |
831 | put_online_cpus(); | ||
829 | return 0; | 832 | return 0; |
830 | 833 | ||
831 | #ifndef CONFIG_HOTPLUG_CPU | 834 | #ifndef CONFIG_HOTPLUG_CPU |
@@ -840,6 +843,7 @@ static void __exit coretemp_exit(void) | |||
840 | { | 843 | { |
841 | struct pdev_entry *p, *n; | 844 | struct pdev_entry *p, *n; |
842 | 845 | ||
846 | get_online_cpus(); | ||
843 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); | 847 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); |
844 | mutex_lock(&pdev_list_mutex); | 848 | mutex_lock(&pdev_list_mutex); |
845 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 849 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
@@ -848,6 +852,7 @@ static void __exit coretemp_exit(void) | |||
848 | kfree(p); | 852 | kfree(p); |
849 | } | 853 | } |
850 | mutex_unlock(&pdev_list_mutex); | 854 | mutex_unlock(&pdev_list_mutex); |
855 | put_online_cpus(); | ||
851 | platform_driver_unregister(&coretemp_driver); | 856 | platform_driver_unregister(&coretemp_driver); |
852 | } | 857 | } |
853 | 858 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 2764b78a784b..af69073b3fe8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
129 | * counter saturations resulting in bogus power readings. | 129 | * counter saturations resulting in bogus power readings. |
130 | * We correct this value ourselves to cope with older BIOSes. | 130 | * We correct this value ourselves to cope with older BIOSes. |
131 | */ | 131 | */ |
132 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | 132 | static const struct pci_device_id affected_device[] = { |
133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
134 | { 0 } | 134 | { 0 } |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | 137 | static void tweak_runavg_range(struct pci_dev *pdev) |
138 | { | 138 | { |
139 | u32 val; | 139 | u32 val; |
140 | 140 | ||
@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) | |||
158 | REG_TDP_RUNNING_AVERAGE, val); | 158 | REG_TDP_RUNNING_AVERAGE, val); |
159 | } | 159 | } |
160 | 160 | ||
161 | #ifdef CONFIG_PM | ||
162 | static int fam15h_power_resume(struct pci_dev *pdev) | ||
163 | { | ||
164 | tweak_runavg_range(pdev); | ||
165 | return 0; | ||
166 | } | ||
167 | #else | ||
168 | #define fam15h_power_resume NULL | ||
169 | #endif | ||
170 | |||
161 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 171 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
162 | struct fam15h_power_data *data) | 172 | struct fam15h_power_data *data) |
163 | { | 173 | { |
@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { | |||
256 | .id_table = fam15h_power_id_table, | 266 | .id_table = fam15h_power_id_table, |
257 | .probe = fam15h_power_probe, | 267 | .probe = fam15h_power_probe, |
258 | .remove = __devexit_p(fam15h_power_remove), | 268 | .remove = __devexit_p(fam15h_power_remove), |
269 | .resume = fam15h_power_resume, | ||
259 | }; | 270 | }; |
260 | 271 | ||
261 | module_pci_driver(fam15h_power_driver); | 272 | module_pci_driver(fam15h_power_driver); |
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index ee4ebc198a94..2e56c6ce9fb6 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c | |||
@@ -328,6 +328,7 @@ static int __init via_cputemp_init(void) | |||
328 | if (err) | 328 | if (err) |
329 | goto exit; | 329 | goto exit; |
330 | 330 | ||
331 | get_online_cpus(); | ||
331 | for_each_online_cpu(i) { | 332 | for_each_online_cpu(i) { |
332 | struct cpuinfo_x86 *c = &cpu_data(i); | 333 | struct cpuinfo_x86 *c = &cpu_data(i); |
333 | 334 | ||
@@ -347,12 +348,14 @@ static int __init via_cputemp_init(void) | |||
347 | 348 | ||
348 | #ifndef CONFIG_HOTPLUG_CPU | 349 | #ifndef CONFIG_HOTPLUG_CPU |
349 | if (list_empty(&pdev_list)) { | 350 | if (list_empty(&pdev_list)) { |
351 | put_online_cpus(); | ||
350 | err = -ENODEV; | 352 | err = -ENODEV; |
351 | goto exit_driver_unreg; | 353 | goto exit_driver_unreg; |
352 | } | 354 | } |
353 | #endif | 355 | #endif |
354 | 356 | ||
355 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); | 357 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); |
358 | put_online_cpus(); | ||
356 | return 0; | 359 | return 0; |
357 | 360 | ||
358 | #ifndef CONFIG_HOTPLUG_CPU | 361 | #ifndef CONFIG_HOTPLUG_CPU |
@@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void) | |||
367 | { | 370 | { |
368 | struct pdev_entry *p, *n; | 371 | struct pdev_entry *p, *n; |
369 | 372 | ||
373 | get_online_cpus(); | ||
370 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); | 374 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); |
371 | mutex_lock(&pdev_list_mutex); | 375 | mutex_lock(&pdev_list_mutex); |
372 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 376 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
@@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void) | |||
375 | kfree(p); | 379 | kfree(p); |
376 | } | 380 | } |
377 | mutex_unlock(&pdev_list_mutex); | 381 | mutex_unlock(&pdev_list_mutex); |
382 | put_online_cpus(); | ||
378 | platform_driver_unregister(&via_cputemp_driver); | 383 | platform_driver_unregister(&via_cputemp_driver); |
379 | } | 384 | } |
380 | 385 | ||
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 1201a15784c3..db713c0dfba4 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
@@ -552,7 +552,7 @@ EXPORT_SYMBOL_GPL(hwspin_lock_request_specific); | |||
552 | */ | 552 | */ |
553 | int hwspin_lock_free(struct hwspinlock *hwlock) | 553 | int hwspin_lock_free(struct hwspinlock *hwlock) |
554 | { | 554 | { |
555 | struct device *dev = hwlock->bank->dev; | 555 | struct device *dev; |
556 | struct hwspinlock *tmp; | 556 | struct hwspinlock *tmp; |
557 | int ret; | 557 | int ret; |
558 | 558 | ||
@@ -561,6 +561,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock) | |||
561 | return -EINVAL; | 561 | return -EINVAL; |
562 | } | 562 | } |
563 | 563 | ||
564 | dev = hwlock->bank->dev; | ||
564 | mutex_lock(&hwspinlock_tree_lock); | 565 | mutex_lock(&hwspinlock_tree_lock); |
565 | 566 | ||
566 | /* make sure the hwspinlock is used */ | 567 | /* make sure the hwspinlock is used */ |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 51f42061dae9..6cfd4d8fd0bd 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1361,11 +1361,11 @@ static int abort_rpl(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1361 | struct tid_info *t = dev->rdev.lldi.tids; | 1361 | struct tid_info *t = dev->rdev.lldi.tids; |
1362 | 1362 | ||
1363 | ep = lookup_tid(t, tid); | 1363 | ep = lookup_tid(t, tid); |
1364 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | ||
1365 | if (!ep) { | 1364 | if (!ep) { |
1366 | printk(KERN_WARNING MOD "Abort rpl to freed endpoint\n"); | 1365 | printk(KERN_WARNING MOD "Abort rpl to freed endpoint\n"); |
1367 | return 0; | 1366 | return 0; |
1368 | } | 1367 | } |
1368 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | ||
1369 | mutex_lock(&ep->com.mutex); | 1369 | mutex_lock(&ep->com.mutex); |
1370 | switch (ep->com.state) { | 1370 | switch (ep->com.state) { |
1371 | case ABORTING: | 1371 | case ABORTING: |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index cb5b7f7d4d38..b29a4246ef41 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -2219,7 +2219,6 @@ static bool ocrdma_poll_success_scqe(struct ocrdma_qp *qp, | |||
2219 | u32 wqe_idx; | 2219 | u32 wqe_idx; |
2220 | 2220 | ||
2221 | if (!qp->wqe_wr_id_tbl[tail].signaled) { | 2221 | if (!qp->wqe_wr_id_tbl[tail].signaled) { |
2222 | expand = true; /* CQE cannot be consumed yet */ | ||
2223 | *polled = false; /* WC cannot be consumed yet */ | 2222 | *polled = false; /* WC cannot be consumed yet */ |
2224 | } else { | 2223 | } else { |
2225 | ibwc->status = IB_WC_SUCCESS; | 2224 | ibwc->status = IB_WC_SUCCESS; |
@@ -2227,10 +2226,11 @@ static bool ocrdma_poll_success_scqe(struct ocrdma_qp *qp, | |||
2227 | ibwc->qp = &qp->ibqp; | 2226 | ibwc->qp = &qp->ibqp; |
2228 | ocrdma_update_wc(qp, ibwc, tail); | 2227 | ocrdma_update_wc(qp, ibwc, tail); |
2229 | *polled = true; | 2228 | *polled = true; |
2230 | wqe_idx = le32_to_cpu(cqe->wq.wqeidx) & OCRDMA_CQE_WQEIDX_MASK; | ||
2231 | if (tail != wqe_idx) | ||
2232 | expand = true; /* Coalesced CQE can't be consumed yet */ | ||
2233 | } | 2229 | } |
2230 | wqe_idx = le32_to_cpu(cqe->wq.wqeidx) & OCRDMA_CQE_WQEIDX_MASK; | ||
2231 | if (tail != wqe_idx) | ||
2232 | expand = true; /* Coalesced CQE can't be consumed yet */ | ||
2233 | |||
2234 | ocrdma_hwq_inc_tail(&qp->sq); | 2234 | ocrdma_hwq_inc_tail(&qp->sq); |
2235 | return expand; | 2235 | return expand; |
2236 | } | 2236 | } |
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c index 19f1e6c45fb6..ccb119143d20 100644 --- a/drivers/infiniband/hw/qib/qib_mad.c +++ b/drivers/infiniband/hw/qib/qib_mad.c | |||
@@ -471,9 +471,10 @@ static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev, | |||
471 | if (port_num != port) { | 471 | if (port_num != port) { |
472 | ibp = to_iport(ibdev, port_num); | 472 | ibp = to_iport(ibdev, port_num); |
473 | ret = check_mkey(ibp, smp, 0); | 473 | ret = check_mkey(ibp, smp, 0); |
474 | if (ret) | 474 | if (ret) { |
475 | ret = IB_MAD_RESULT_FAILURE; | 475 | ret = IB_MAD_RESULT_FAILURE; |
476 | goto bail; | 476 | goto bail; |
477 | } | ||
477 | } | 478 | } |
478 | } | 479 | } |
479 | 480 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 381f51b2ed61..ac48f86f2384 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -266,7 +266,10 @@ struct ipoib_ethtool_st { | |||
266 | u16 max_coalesced_frames; | 266 | u16 max_coalesced_frames; |
267 | }; | 267 | }; |
268 | 268 | ||
269 | struct ipoib_neigh_table; | ||
270 | |||
269 | struct ipoib_neigh_hash { | 271 | struct ipoib_neigh_hash { |
272 | struct ipoib_neigh_table *ntbl; | ||
270 | struct ipoib_neigh __rcu **buckets; | 273 | struct ipoib_neigh __rcu **buckets; |
271 | struct rcu_head rcu; | 274 | struct rcu_head rcu; |
272 | u32 mask; | 275 | u32 mask; |
@@ -275,9 +278,9 @@ struct ipoib_neigh_hash { | |||
275 | 278 | ||
276 | struct ipoib_neigh_table { | 279 | struct ipoib_neigh_table { |
277 | struct ipoib_neigh_hash __rcu *htbl; | 280 | struct ipoib_neigh_hash __rcu *htbl; |
278 | rwlock_t rwlock; | ||
279 | atomic_t entries; | 281 | atomic_t entries; |
280 | struct completion flushed; | 282 | struct completion flushed; |
283 | struct completion deleted; | ||
281 | }; | 284 | }; |
282 | 285 | ||
283 | /* | 286 | /* |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index b3e97096c446..128fab102054 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -551,15 +551,15 @@ static void neigh_add_path(struct sk_buff *skb, u8 *daddr, | |||
551 | struct ipoib_neigh *neigh; | 551 | struct ipoib_neigh *neigh; |
552 | unsigned long flags; | 552 | unsigned long flags; |
553 | 553 | ||
554 | spin_lock_irqsave(&priv->lock, flags); | ||
554 | neigh = ipoib_neigh_alloc(daddr, dev); | 555 | neigh = ipoib_neigh_alloc(daddr, dev); |
555 | if (!neigh) { | 556 | if (!neigh) { |
557 | spin_unlock_irqrestore(&priv->lock, flags); | ||
556 | ++dev->stats.tx_dropped; | 558 | ++dev->stats.tx_dropped; |
557 | dev_kfree_skb_any(skb); | 559 | dev_kfree_skb_any(skb); |
558 | return; | 560 | return; |
559 | } | 561 | } |
560 | 562 | ||
561 | spin_lock_irqsave(&priv->lock, flags); | ||
562 | |||
563 | path = __path_find(dev, daddr + 4); | 563 | path = __path_find(dev, daddr + 4); |
564 | if (!path) { | 564 | if (!path) { |
565 | path = path_rec_create(dev, daddr + 4); | 565 | path = path_rec_create(dev, daddr + 4); |
@@ -868,10 +868,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) | |||
868 | if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) | 868 | if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) |
869 | return; | 869 | return; |
870 | 870 | ||
871 | write_lock_bh(&ntbl->rwlock); | 871 | spin_lock_irqsave(&priv->lock, flags); |
872 | 872 | ||
873 | htbl = rcu_dereference_protected(ntbl->htbl, | 873 | htbl = rcu_dereference_protected(ntbl->htbl, |
874 | lockdep_is_held(&ntbl->rwlock)); | 874 | lockdep_is_held(&priv->lock)); |
875 | 875 | ||
876 | if (!htbl) | 876 | if (!htbl) |
877 | goto out_unlock; | 877 | goto out_unlock; |
@@ -888,16 +888,14 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) | |||
888 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; | 888 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; |
889 | 889 | ||
890 | while ((neigh = rcu_dereference_protected(*np, | 890 | while ((neigh = rcu_dereference_protected(*np, |
891 | lockdep_is_held(&ntbl->rwlock))) != NULL) { | 891 | lockdep_is_held(&priv->lock))) != NULL) { |
892 | /* was the neigh idle for two GC periods */ | 892 | /* was the neigh idle for two GC periods */ |
893 | if (time_after(neigh_obsolete, neigh->alive)) { | 893 | if (time_after(neigh_obsolete, neigh->alive)) { |
894 | rcu_assign_pointer(*np, | 894 | rcu_assign_pointer(*np, |
895 | rcu_dereference_protected(neigh->hnext, | 895 | rcu_dereference_protected(neigh->hnext, |
896 | lockdep_is_held(&ntbl->rwlock))); | 896 | lockdep_is_held(&priv->lock))); |
897 | /* remove from path/mc list */ | 897 | /* remove from path/mc list */ |
898 | spin_lock_irqsave(&priv->lock, flags); | ||
899 | list_del(&neigh->list); | 898 | list_del(&neigh->list); |
900 | spin_unlock_irqrestore(&priv->lock, flags); | ||
901 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 899 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
902 | } else { | 900 | } else { |
903 | np = &neigh->hnext; | 901 | np = &neigh->hnext; |
@@ -907,7 +905,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) | |||
907 | } | 905 | } |
908 | 906 | ||
909 | out_unlock: | 907 | out_unlock: |
910 | write_unlock_bh(&ntbl->rwlock); | 908 | spin_unlock_irqrestore(&priv->lock, flags); |
911 | } | 909 | } |
912 | 910 | ||
913 | static void ipoib_reap_neigh(struct work_struct *work) | 911 | static void ipoib_reap_neigh(struct work_struct *work) |
@@ -952,10 +950,8 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr, | |||
952 | struct ipoib_neigh *neigh; | 950 | struct ipoib_neigh *neigh; |
953 | u32 hash_val; | 951 | u32 hash_val; |
954 | 952 | ||
955 | write_lock_bh(&ntbl->rwlock); | ||
956 | |||
957 | htbl = rcu_dereference_protected(ntbl->htbl, | 953 | htbl = rcu_dereference_protected(ntbl->htbl, |
958 | lockdep_is_held(&ntbl->rwlock)); | 954 | lockdep_is_held(&priv->lock)); |
959 | if (!htbl) { | 955 | if (!htbl) { |
960 | neigh = NULL; | 956 | neigh = NULL; |
961 | goto out_unlock; | 957 | goto out_unlock; |
@@ -966,10 +962,10 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr, | |||
966 | */ | 962 | */ |
967 | hash_val = ipoib_addr_hash(htbl, daddr); | 963 | hash_val = ipoib_addr_hash(htbl, daddr); |
968 | for (neigh = rcu_dereference_protected(htbl->buckets[hash_val], | 964 | for (neigh = rcu_dereference_protected(htbl->buckets[hash_val], |
969 | lockdep_is_held(&ntbl->rwlock)); | 965 | lockdep_is_held(&priv->lock)); |
970 | neigh != NULL; | 966 | neigh != NULL; |
971 | neigh = rcu_dereference_protected(neigh->hnext, | 967 | neigh = rcu_dereference_protected(neigh->hnext, |
972 | lockdep_is_held(&ntbl->rwlock))) { | 968 | lockdep_is_held(&priv->lock))) { |
973 | if (memcmp(daddr, neigh->daddr, INFINIBAND_ALEN) == 0) { | 969 | if (memcmp(daddr, neigh->daddr, INFINIBAND_ALEN) == 0) { |
974 | /* found, take one ref on behalf of the caller */ | 970 | /* found, take one ref on behalf of the caller */ |
975 | if (!atomic_inc_not_zero(&neigh->refcnt)) { | 971 | if (!atomic_inc_not_zero(&neigh->refcnt)) { |
@@ -992,12 +988,11 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr, | |||
992 | /* put in hash */ | 988 | /* put in hash */ |
993 | rcu_assign_pointer(neigh->hnext, | 989 | rcu_assign_pointer(neigh->hnext, |
994 | rcu_dereference_protected(htbl->buckets[hash_val], | 990 | rcu_dereference_protected(htbl->buckets[hash_val], |
995 | lockdep_is_held(&ntbl->rwlock))); | 991 | lockdep_is_held(&priv->lock))); |
996 | rcu_assign_pointer(htbl->buckets[hash_val], neigh); | 992 | rcu_assign_pointer(htbl->buckets[hash_val], neigh); |
997 | atomic_inc(&ntbl->entries); | 993 | atomic_inc(&ntbl->entries); |
998 | 994 | ||
999 | out_unlock: | 995 | out_unlock: |
1000 | write_unlock_bh(&ntbl->rwlock); | ||
1001 | 996 | ||
1002 | return neigh; | 997 | return neigh; |
1003 | } | 998 | } |
@@ -1045,35 +1040,29 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh) | |||
1045 | struct ipoib_neigh *n; | 1040 | struct ipoib_neigh *n; |
1046 | u32 hash_val; | 1041 | u32 hash_val; |
1047 | 1042 | ||
1048 | write_lock_bh(&ntbl->rwlock); | ||
1049 | |||
1050 | htbl = rcu_dereference_protected(ntbl->htbl, | 1043 | htbl = rcu_dereference_protected(ntbl->htbl, |
1051 | lockdep_is_held(&ntbl->rwlock)); | 1044 | lockdep_is_held(&priv->lock)); |
1052 | if (!htbl) | 1045 | if (!htbl) |
1053 | goto out_unlock; | 1046 | return; |
1054 | 1047 | ||
1055 | hash_val = ipoib_addr_hash(htbl, neigh->daddr); | 1048 | hash_val = ipoib_addr_hash(htbl, neigh->daddr); |
1056 | np = &htbl->buckets[hash_val]; | 1049 | np = &htbl->buckets[hash_val]; |
1057 | for (n = rcu_dereference_protected(*np, | 1050 | for (n = rcu_dereference_protected(*np, |
1058 | lockdep_is_held(&ntbl->rwlock)); | 1051 | lockdep_is_held(&priv->lock)); |
1059 | n != NULL; | 1052 | n != NULL; |
1060 | n = rcu_dereference_protected(*np, | 1053 | n = rcu_dereference_protected(*np, |
1061 | lockdep_is_held(&ntbl->rwlock))) { | 1054 | lockdep_is_held(&priv->lock))) { |
1062 | if (n == neigh) { | 1055 | if (n == neigh) { |
1063 | /* found */ | 1056 | /* found */ |
1064 | rcu_assign_pointer(*np, | 1057 | rcu_assign_pointer(*np, |
1065 | rcu_dereference_protected(neigh->hnext, | 1058 | rcu_dereference_protected(neigh->hnext, |
1066 | lockdep_is_held(&ntbl->rwlock))); | 1059 | lockdep_is_held(&priv->lock))); |
1067 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 1060 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
1068 | goto out_unlock; | 1061 | return; |
1069 | } else { | 1062 | } else { |
1070 | np = &n->hnext; | 1063 | np = &n->hnext; |
1071 | } | 1064 | } |
1072 | } | 1065 | } |
1073 | |||
1074 | out_unlock: | ||
1075 | write_unlock_bh(&ntbl->rwlock); | ||
1076 | |||
1077 | } | 1066 | } |
1078 | 1067 | ||
1079 | static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) | 1068 | static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) |
@@ -1085,7 +1074,6 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) | |||
1085 | 1074 | ||
1086 | clear_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); | 1075 | clear_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); |
1087 | ntbl->htbl = NULL; | 1076 | ntbl->htbl = NULL; |
1088 | rwlock_init(&ntbl->rwlock); | ||
1089 | htbl = kzalloc(sizeof(*htbl), GFP_KERNEL); | 1077 | htbl = kzalloc(sizeof(*htbl), GFP_KERNEL); |
1090 | if (!htbl) | 1078 | if (!htbl) |
1091 | return -ENOMEM; | 1079 | return -ENOMEM; |
@@ -1100,6 +1088,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) | |||
1100 | htbl->mask = (size - 1); | 1088 | htbl->mask = (size - 1); |
1101 | htbl->buckets = buckets; | 1089 | htbl->buckets = buckets; |
1102 | ntbl->htbl = htbl; | 1090 | ntbl->htbl = htbl; |
1091 | htbl->ntbl = ntbl; | ||
1103 | atomic_set(&ntbl->entries, 0); | 1092 | atomic_set(&ntbl->entries, 0); |
1104 | 1093 | ||
1105 | /* start garbage collection */ | 1094 | /* start garbage collection */ |
@@ -1116,9 +1105,11 @@ static void neigh_hash_free_rcu(struct rcu_head *head) | |||
1116 | struct ipoib_neigh_hash, | 1105 | struct ipoib_neigh_hash, |
1117 | rcu); | 1106 | rcu); |
1118 | struct ipoib_neigh __rcu **buckets = htbl->buckets; | 1107 | struct ipoib_neigh __rcu **buckets = htbl->buckets; |
1108 | struct ipoib_neigh_table *ntbl = htbl->ntbl; | ||
1119 | 1109 | ||
1120 | kfree(buckets); | 1110 | kfree(buckets); |
1121 | kfree(htbl); | 1111 | kfree(htbl); |
1112 | complete(&ntbl->deleted); | ||
1122 | } | 1113 | } |
1123 | 1114 | ||
1124 | void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | 1115 | void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) |
@@ -1130,10 +1121,10 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | |||
1130 | int i; | 1121 | int i; |
1131 | 1122 | ||
1132 | /* remove all neigh connected to a given path or mcast */ | 1123 | /* remove all neigh connected to a given path or mcast */ |
1133 | write_lock_bh(&ntbl->rwlock); | 1124 | spin_lock_irqsave(&priv->lock, flags); |
1134 | 1125 | ||
1135 | htbl = rcu_dereference_protected(ntbl->htbl, | 1126 | htbl = rcu_dereference_protected(ntbl->htbl, |
1136 | lockdep_is_held(&ntbl->rwlock)); | 1127 | lockdep_is_held(&priv->lock)); |
1137 | 1128 | ||
1138 | if (!htbl) | 1129 | if (!htbl) |
1139 | goto out_unlock; | 1130 | goto out_unlock; |
@@ -1143,16 +1134,14 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | |||
1143 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; | 1134 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; |
1144 | 1135 | ||
1145 | while ((neigh = rcu_dereference_protected(*np, | 1136 | while ((neigh = rcu_dereference_protected(*np, |
1146 | lockdep_is_held(&ntbl->rwlock))) != NULL) { | 1137 | lockdep_is_held(&priv->lock))) != NULL) { |
1147 | /* delete neighs belong to this parent */ | 1138 | /* delete neighs belong to this parent */ |
1148 | if (!memcmp(gid, neigh->daddr + 4, sizeof (union ib_gid))) { | 1139 | if (!memcmp(gid, neigh->daddr + 4, sizeof (union ib_gid))) { |
1149 | rcu_assign_pointer(*np, | 1140 | rcu_assign_pointer(*np, |
1150 | rcu_dereference_protected(neigh->hnext, | 1141 | rcu_dereference_protected(neigh->hnext, |
1151 | lockdep_is_held(&ntbl->rwlock))); | 1142 | lockdep_is_held(&priv->lock))); |
1152 | /* remove from parent list */ | 1143 | /* remove from parent list */ |
1153 | spin_lock_irqsave(&priv->lock, flags); | ||
1154 | list_del(&neigh->list); | 1144 | list_del(&neigh->list); |
1155 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1156 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 1145 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
1157 | } else { | 1146 | } else { |
1158 | np = &neigh->hnext; | 1147 | np = &neigh->hnext; |
@@ -1161,7 +1150,7 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | |||
1161 | } | 1150 | } |
1162 | } | 1151 | } |
1163 | out_unlock: | 1152 | out_unlock: |
1164 | write_unlock_bh(&ntbl->rwlock); | 1153 | spin_unlock_irqrestore(&priv->lock, flags); |
1165 | } | 1154 | } |
1166 | 1155 | ||
1167 | static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) | 1156 | static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) |
@@ -1169,37 +1158,44 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) | |||
1169 | struct ipoib_neigh_table *ntbl = &priv->ntbl; | 1158 | struct ipoib_neigh_table *ntbl = &priv->ntbl; |
1170 | struct ipoib_neigh_hash *htbl; | 1159 | struct ipoib_neigh_hash *htbl; |
1171 | unsigned long flags; | 1160 | unsigned long flags; |
1172 | int i; | 1161 | int i, wait_flushed = 0; |
1173 | 1162 | ||
1174 | write_lock_bh(&ntbl->rwlock); | 1163 | init_completion(&priv->ntbl.flushed); |
1164 | |||
1165 | spin_lock_irqsave(&priv->lock, flags); | ||
1175 | 1166 | ||
1176 | htbl = rcu_dereference_protected(ntbl->htbl, | 1167 | htbl = rcu_dereference_protected(ntbl->htbl, |
1177 | lockdep_is_held(&ntbl->rwlock)); | 1168 | lockdep_is_held(&priv->lock)); |
1178 | if (!htbl) | 1169 | if (!htbl) |
1179 | goto out_unlock; | 1170 | goto out_unlock; |
1180 | 1171 | ||
1172 | wait_flushed = atomic_read(&priv->ntbl.entries); | ||
1173 | if (!wait_flushed) | ||
1174 | goto free_htbl; | ||
1175 | |||
1181 | for (i = 0; i < htbl->size; i++) { | 1176 | for (i = 0; i < htbl->size; i++) { |
1182 | struct ipoib_neigh *neigh; | 1177 | struct ipoib_neigh *neigh; |
1183 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; | 1178 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; |
1184 | 1179 | ||
1185 | while ((neigh = rcu_dereference_protected(*np, | 1180 | while ((neigh = rcu_dereference_protected(*np, |
1186 | lockdep_is_held(&ntbl->rwlock))) != NULL) { | 1181 | lockdep_is_held(&priv->lock))) != NULL) { |
1187 | rcu_assign_pointer(*np, | 1182 | rcu_assign_pointer(*np, |
1188 | rcu_dereference_protected(neigh->hnext, | 1183 | rcu_dereference_protected(neigh->hnext, |
1189 | lockdep_is_held(&ntbl->rwlock))); | 1184 | lockdep_is_held(&priv->lock))); |
1190 | /* remove from path/mc list */ | 1185 | /* remove from path/mc list */ |
1191 | spin_lock_irqsave(&priv->lock, flags); | ||
1192 | list_del(&neigh->list); | 1186 | list_del(&neigh->list); |
1193 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1194 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 1187 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
1195 | } | 1188 | } |
1196 | } | 1189 | } |
1197 | 1190 | ||
1191 | free_htbl: | ||
1198 | rcu_assign_pointer(ntbl->htbl, NULL); | 1192 | rcu_assign_pointer(ntbl->htbl, NULL); |
1199 | call_rcu(&htbl->rcu, neigh_hash_free_rcu); | 1193 | call_rcu(&htbl->rcu, neigh_hash_free_rcu); |
1200 | 1194 | ||
1201 | out_unlock: | 1195 | out_unlock: |
1202 | write_unlock_bh(&ntbl->rwlock); | 1196 | spin_unlock_irqrestore(&priv->lock, flags); |
1197 | if (wait_flushed) | ||
1198 | wait_for_completion(&priv->ntbl.flushed); | ||
1203 | } | 1199 | } |
1204 | 1200 | ||
1205 | static void ipoib_neigh_hash_uninit(struct net_device *dev) | 1201 | static void ipoib_neigh_hash_uninit(struct net_device *dev) |
@@ -1208,7 +1204,7 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev) | |||
1208 | int stopped; | 1204 | int stopped; |
1209 | 1205 | ||
1210 | ipoib_dbg(priv, "ipoib_neigh_hash_uninit\n"); | 1206 | ipoib_dbg(priv, "ipoib_neigh_hash_uninit\n"); |
1211 | init_completion(&priv->ntbl.flushed); | 1207 | init_completion(&priv->ntbl.deleted); |
1212 | set_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); | 1208 | set_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); |
1213 | 1209 | ||
1214 | /* Stop GC if called at init fail need to cancel work */ | 1210 | /* Stop GC if called at init fail need to cancel work */ |
@@ -1216,10 +1212,9 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev) | |||
1216 | if (!stopped) | 1212 | if (!stopped) |
1217 | cancel_delayed_work(&priv->neigh_reap_task); | 1213 | cancel_delayed_work(&priv->neigh_reap_task); |
1218 | 1214 | ||
1219 | if (atomic_read(&priv->ntbl.entries)) { | 1215 | ipoib_flush_neighs(priv); |
1220 | ipoib_flush_neighs(priv); | 1216 | |
1221 | wait_for_completion(&priv->ntbl.flushed); | 1217 | wait_for_completion(&priv->ntbl.deleted); |
1222 | } | ||
1223 | } | 1218 | } |
1224 | 1219 | ||
1225 | 1220 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 13f4aa7593c8..75367249f447 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -707,9 +707,7 @@ out: | |||
707 | neigh = ipoib_neigh_get(dev, daddr); | 707 | neigh = ipoib_neigh_get(dev, daddr); |
708 | spin_lock_irqsave(&priv->lock, flags); | 708 | spin_lock_irqsave(&priv->lock, flags); |
709 | if (!neigh) { | 709 | if (!neigh) { |
710 | spin_unlock_irqrestore(&priv->lock, flags); | ||
711 | neigh = ipoib_neigh_alloc(daddr, dev); | 710 | neigh = ipoib_neigh_alloc(daddr, dev); |
712 | spin_lock_irqsave(&priv->lock, flags); | ||
713 | if (neigh) { | 711 | if (neigh) { |
714 | kref_get(&mcast->ah->ref); | 712 | kref_get(&mcast->ah->ref); |
715 | neigh->ah = mcast->ah; | 713 | neigh->ah = mcast->ah; |
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index ce68e361558c..cdc252612c0b 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c | |||
@@ -516,9 +516,9 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev) | |||
516 | input_set_drvdata(input_dev, keypad); | 516 | input_set_drvdata(input_dev, keypad); |
517 | 517 | ||
518 | /* Ensure that the keypad will stay dormant until opened */ | 518 | /* Ensure that the keypad will stay dormant until opened */ |
519 | clk_enable(keypad->clk); | 519 | clk_prepare_enable(keypad->clk); |
520 | imx_keypad_inhibit(keypad); | 520 | imx_keypad_inhibit(keypad); |
521 | clk_disable(keypad->clk); | 521 | clk_disable_unprepare(keypad->clk); |
522 | 522 | ||
523 | error = request_irq(irq, imx_keypad_irq_handler, 0, | 523 | error = request_irq(irq, imx_keypad_irq_handler, 0, |
524 | pdev->name, keypad); | 524 | pdev->name, keypad); |
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index f06231b7cab1..84ec691c05aa 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c | |||
@@ -74,8 +74,8 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) | |||
74 | 74 | ||
75 | ponkey->idev = input; | 75 | ponkey->idev = input; |
76 | ponkey->ab8500 = ab8500; | 76 | ponkey->ab8500 = ab8500; |
77 | ponkey->irq_dbf = ab8500_irq_get_virq(ab8500, irq_dbf); | 77 | ponkey->irq_dbf = irq_dbf; |
78 | ponkey->irq_dbr = ab8500_irq_get_virq(ab8500, irq_dbr); | 78 | ponkey->irq_dbr = irq_dbr; |
79 | 79 | ||
80 | input->name = "AB8500 POn(PowerOn) Key"; | 80 | input->name = "AB8500 POn(PowerOn) Key"; |
81 | input->dev.parent = &pdev->dev; | 81 | input->dev.parent = &pdev->dev; |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 3f5649f19082..a261d8576919 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -721,6 +721,17 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
721 | 721 | ||
722 | switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { | 722 | switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { |
723 | case FSP_PKT_TYPE_ABS: | 723 | case FSP_PKT_TYPE_ABS: |
724 | |||
725 | if ((packet[0] == 0x48 || packet[0] == 0x49) && | ||
726 | packet[1] == 0 && packet[2] == 0) { | ||
727 | /* | ||
728 | * Ignore coordinate noise when finger leaving the | ||
729 | * surface, otherwise cursor may jump to upper-left | ||
730 | * corner. | ||
731 | */ | ||
732 | packet[3] &= 0xf0; | ||
733 | } | ||
734 | |||
724 | abs_x = GET_ABS_X(packet); | 735 | abs_x = GET_ABS_X(packet); |
725 | abs_y = GET_ABS_Y(packet); | 736 | abs_y = GET_ABS_Y(packet); |
726 | 737 | ||
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index 2ffd110bd5bc..2e77246c2e5a 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c | |||
@@ -72,7 +72,7 @@ static int amba_kmi_open(struct serio *io) | |||
72 | unsigned int divisor; | 72 | unsigned int divisor; |
73 | int ret; | 73 | int ret; |
74 | 74 | ||
75 | ret = clk_enable(kmi->clk); | 75 | ret = clk_prepare_enable(kmi->clk); |
76 | if (ret) | 76 | if (ret) |
77 | goto out; | 77 | goto out; |
78 | 78 | ||
@@ -92,7 +92,7 @@ static int amba_kmi_open(struct serio *io) | |||
92 | return 0; | 92 | return 0; |
93 | 93 | ||
94 | clk_disable: | 94 | clk_disable: |
95 | clk_disable(kmi->clk); | 95 | clk_disable_unprepare(kmi->clk); |
96 | out: | 96 | out: |
97 | return ret; | 97 | return ret; |
98 | } | 98 | } |
@@ -104,7 +104,7 @@ static void amba_kmi_close(struct serio *io) | |||
104 | writeb(0, KMICR); | 104 | writeb(0, KMICR); |
105 | 105 | ||
106 | free_irq(kmi->irq, kmi); | 106 | free_irq(kmi->irq, kmi); |
107 | clk_disable(kmi->clk); | 107 | clk_disable_unprepare(kmi->clk); |
108 | } | 108 | } |
109 | 109 | ||
110 | static int __devinit amba_kmi_probe(struct amba_device *dev, | 110 | static int __devinit amba_kmi_probe(struct amba_device *dev, |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 6918773ce024..d6cc77a53c7e 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -335,6 +335,12 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
335 | }, | 335 | }, |
336 | { | 336 | { |
337 | .matches = { | 337 | .matches = { |
338 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
339 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"), | ||
340 | }, | ||
341 | }, | ||
342 | { | ||
343 | .matches = { | ||
338 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), | 344 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), |
339 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), | 345 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), |
340 | }, | 346 | }, |
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index b06a5e3a665e..64957770b522 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c | |||
@@ -566,9 +566,12 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, | |||
566 | } | 566 | } |
567 | 567 | ||
568 | read = min_t(size_t, count, tsdata->raw_bufsize - *off); | 568 | read = min_t(size_t, count, tsdata->raw_bufsize - *off); |
569 | error = copy_to_user(buf, tsdata->raw_buffer + *off, read); | 569 | if (copy_to_user(buf, tsdata->raw_buffer + *off, read)) { |
570 | if (!error) | 570 | error = -EFAULT; |
571 | *off += read; | 571 | goto out; |
572 | } | ||
573 | |||
574 | *off += read; | ||
572 | out: | 575 | out: |
573 | mutex_unlock(&tsdata->mutex); | 576 | mutex_unlock(&tsdata->mutex); |
574 | return error ?: read; | 577 | return error ?: read; |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index e32709e0dd65..721fdb3597ca 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -304,6 +304,45 @@ static int e2i_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
304 | #define EGALAX_PKT_TYPE_REPT 0x80 | 304 | #define EGALAX_PKT_TYPE_REPT 0x80 |
305 | #define EGALAX_PKT_TYPE_DIAG 0x0A | 305 | #define EGALAX_PKT_TYPE_DIAG 0x0A |
306 | 306 | ||
307 | static int egalax_init(struct usbtouch_usb *usbtouch) | ||
308 | { | ||
309 | int ret, i; | ||
310 | unsigned char *buf; | ||
311 | struct usb_device *udev = interface_to_usbdev(usbtouch->interface); | ||
312 | |||
313 | /* | ||
314 | * An eGalax diagnostic packet kicks the device into using the right | ||
315 | * protocol. We send a "check active" packet. The response will be | ||
316 | * read later and ignored. | ||
317 | */ | ||
318 | |||
319 | buf = kmalloc(3, GFP_KERNEL); | ||
320 | if (!buf) | ||
321 | return -ENOMEM; | ||
322 | |||
323 | buf[0] = EGALAX_PKT_TYPE_DIAG; | ||
324 | buf[1] = 1; /* length */ | ||
325 | buf[2] = 'A'; /* command - check active */ | ||
326 | |||
327 | for (i = 0; i < 3; i++) { | ||
328 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
329 | 0, | ||
330 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
331 | 0, 0, buf, 3, | ||
332 | USB_CTRL_SET_TIMEOUT); | ||
333 | if (ret >= 0) { | ||
334 | ret = 0; | ||
335 | break; | ||
336 | } | ||
337 | if (ret != -EPIPE) | ||
338 | break; | ||
339 | } | ||
340 | |||
341 | kfree(buf); | ||
342 | |||
343 | return ret; | ||
344 | } | ||
345 | |||
307 | static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 346 | static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
308 | { | 347 | { |
309 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) | 348 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) |
@@ -1056,6 +1095,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
1056 | .process_pkt = usbtouch_process_multi, | 1095 | .process_pkt = usbtouch_process_multi, |
1057 | .get_pkt_len = egalax_get_pkt_len, | 1096 | .get_pkt_len = egalax_get_pkt_len, |
1058 | .read_data = egalax_read_data, | 1097 | .read_data = egalax_read_data, |
1098 | .init = egalax_init, | ||
1059 | }, | 1099 | }, |
1060 | #endif | 1100 | #endif |
1061 | 1101 | ||
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index d8abb90a6c2f..034233eefc82 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1555,6 +1555,7 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, | |||
1555 | unsigned long arg) | 1555 | unsigned long arg) |
1556 | { | 1556 | { |
1557 | struct multipath *m = ti->private; | 1557 | struct multipath *m = ti->private; |
1558 | struct pgpath *pgpath; | ||
1558 | struct block_device *bdev; | 1559 | struct block_device *bdev; |
1559 | fmode_t mode; | 1560 | fmode_t mode; |
1560 | unsigned long flags; | 1561 | unsigned long flags; |
@@ -1570,12 +1571,14 @@ again: | |||
1570 | if (!m->current_pgpath) | 1571 | if (!m->current_pgpath) |
1571 | __choose_pgpath(m, 0); | 1572 | __choose_pgpath(m, 0); |
1572 | 1573 | ||
1573 | if (m->current_pgpath) { | 1574 | pgpath = m->current_pgpath; |
1574 | bdev = m->current_pgpath->path.dev->bdev; | 1575 | |
1575 | mode = m->current_pgpath->path.dev->mode; | 1576 | if (pgpath) { |
1577 | bdev = pgpath->path.dev->bdev; | ||
1578 | mode = pgpath->path.dev->mode; | ||
1576 | } | 1579 | } |
1577 | 1580 | ||
1578 | if (m->queue_io) | 1581 | if ((pgpath && m->queue_io) || (!pgpath && m->queue_if_no_path)) |
1579 | r = -EAGAIN; | 1582 | r = -EAGAIN; |
1580 | else if (!bdev) | 1583 | else if (!bdev) |
1581 | r = -EIO; | 1584 | r = -EIO; |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index f90069029aae..100368eb7991 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -1212,6 +1212,41 @@ struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector) | |||
1212 | return &t->targets[(KEYS_PER_NODE * n) + k]; | 1212 | return &t->targets[(KEYS_PER_NODE * n) + k]; |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | static int count_device(struct dm_target *ti, struct dm_dev *dev, | ||
1216 | sector_t start, sector_t len, void *data) | ||
1217 | { | ||
1218 | unsigned *num_devices = data; | ||
1219 | |||
1220 | (*num_devices)++; | ||
1221 | |||
1222 | return 0; | ||
1223 | } | ||
1224 | |||
1225 | /* | ||
1226 | * Check whether a table has no data devices attached using each | ||
1227 | * target's iterate_devices method. | ||
1228 | * Returns false if the result is unknown because a target doesn't | ||
1229 | * support iterate_devices. | ||
1230 | */ | ||
1231 | bool dm_table_has_no_data_devices(struct dm_table *table) | ||
1232 | { | ||
1233 | struct dm_target *uninitialized_var(ti); | ||
1234 | unsigned i = 0, num_devices = 0; | ||
1235 | |||
1236 | while (i < dm_table_get_num_targets(table)) { | ||
1237 | ti = dm_table_get_target(table, i++); | ||
1238 | |||
1239 | if (!ti->type->iterate_devices) | ||
1240 | return false; | ||
1241 | |||
1242 | ti->type->iterate_devices(ti, count_device, &num_devices); | ||
1243 | if (num_devices) | ||
1244 | return false; | ||
1245 | } | ||
1246 | |||
1247 | return true; | ||
1248 | } | ||
1249 | |||
1215 | /* | 1250 | /* |
1216 | * Establish the new table's queue_limits and validate them. | 1251 | * Establish the new table's queue_limits and validate them. |
1217 | */ | 1252 | */ |
@@ -1354,17 +1389,25 @@ static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev, | |||
1354 | return q && blk_queue_nonrot(q); | 1389 | return q && blk_queue_nonrot(q); |
1355 | } | 1390 | } |
1356 | 1391 | ||
1357 | static bool dm_table_is_nonrot(struct dm_table *t) | 1392 | static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev, |
1393 | sector_t start, sector_t len, void *data) | ||
1394 | { | ||
1395 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
1396 | |||
1397 | return q && !blk_queue_add_random(q); | ||
1398 | } | ||
1399 | |||
1400 | static bool dm_table_all_devices_attribute(struct dm_table *t, | ||
1401 | iterate_devices_callout_fn func) | ||
1358 | { | 1402 | { |
1359 | struct dm_target *ti; | 1403 | struct dm_target *ti; |
1360 | unsigned i = 0; | 1404 | unsigned i = 0; |
1361 | 1405 | ||
1362 | /* Ensure that all underlying device are non-rotational. */ | ||
1363 | while (i < dm_table_get_num_targets(t)) { | 1406 | while (i < dm_table_get_num_targets(t)) { |
1364 | ti = dm_table_get_target(t, i++); | 1407 | ti = dm_table_get_target(t, i++); |
1365 | 1408 | ||
1366 | if (!ti->type->iterate_devices || | 1409 | if (!ti->type->iterate_devices || |
1367 | !ti->type->iterate_devices(ti, device_is_nonrot, NULL)) | 1410 | !ti->type->iterate_devices(ti, func, NULL)) |
1368 | return 0; | 1411 | return 0; |
1369 | } | 1412 | } |
1370 | 1413 | ||
@@ -1396,7 +1439,8 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
1396 | if (!dm_table_discard_zeroes_data(t)) | 1439 | if (!dm_table_discard_zeroes_data(t)) |
1397 | q->limits.discard_zeroes_data = 0; | 1440 | q->limits.discard_zeroes_data = 0; |
1398 | 1441 | ||
1399 | if (dm_table_is_nonrot(t)) | 1442 | /* Ensure that all underlying devices are non-rotational. */ |
1443 | if (dm_table_all_devices_attribute(t, device_is_nonrot)) | ||
1400 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); | 1444 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); |
1401 | else | 1445 | else |
1402 | queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q); | 1446 | queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q); |
@@ -1404,6 +1448,15 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
1404 | dm_table_set_integrity(t); | 1448 | dm_table_set_integrity(t); |
1405 | 1449 | ||
1406 | /* | 1450 | /* |
1451 | * Determine whether or not this queue's I/O timings contribute | ||
1452 | * to the entropy pool, Only request-based targets use this. | ||
1453 | * Clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not | ||
1454 | * have it set. | ||
1455 | */ | ||
1456 | if (blk_queue_add_random(q) && dm_table_all_devices_attribute(t, device_is_not_random)) | ||
1457 | queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q); | ||
1458 | |||
1459 | /* | ||
1407 | * QUEUE_FLAG_STACKABLE must be set after all queue settings are | 1460 | * QUEUE_FLAG_STACKABLE must be set after all queue settings are |
1408 | * visible to other CPUs because, once the flag is set, incoming bios | 1461 | * visible to other CPUs because, once the flag is set, incoming bios |
1409 | * are processed by request-based dm, which refers to the queue | 1462 | * are processed by request-based dm, which refers to the queue |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index af1fc3b2c2ad..c29410af1e22 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -509,9 +509,9 @@ enum pool_mode { | |||
509 | struct pool_features { | 509 | struct pool_features { |
510 | enum pool_mode mode; | 510 | enum pool_mode mode; |
511 | 511 | ||
512 | unsigned zero_new_blocks:1; | 512 | bool zero_new_blocks:1; |
513 | unsigned discard_enabled:1; | 513 | bool discard_enabled:1; |
514 | unsigned discard_passdown:1; | 514 | bool discard_passdown:1; |
515 | }; | 515 | }; |
516 | 516 | ||
517 | struct thin_c; | 517 | struct thin_c; |
@@ -580,7 +580,8 @@ struct pool_c { | |||
580 | struct dm_target_callbacks callbacks; | 580 | struct dm_target_callbacks callbacks; |
581 | 581 | ||
582 | dm_block_t low_water_blocks; | 582 | dm_block_t low_water_blocks; |
583 | struct pool_features pf; | 583 | struct pool_features requested_pf; /* Features requested during table load */ |
584 | struct pool_features adjusted_pf; /* Features used after adjusting for constituent devices */ | ||
584 | }; | 585 | }; |
585 | 586 | ||
586 | /* | 587 | /* |
@@ -1839,6 +1840,47 @@ static void __requeue_bios(struct pool *pool) | |||
1839 | /*---------------------------------------------------------------- | 1840 | /*---------------------------------------------------------------- |
1840 | * Binding of control targets to a pool object | 1841 | * Binding of control targets to a pool object |
1841 | *--------------------------------------------------------------*/ | 1842 | *--------------------------------------------------------------*/ |
1843 | static bool data_dev_supports_discard(struct pool_c *pt) | ||
1844 | { | ||
1845 | struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); | ||
1846 | |||
1847 | return q && blk_queue_discard(q); | ||
1848 | } | ||
1849 | |||
1850 | /* | ||
1851 | * If discard_passdown was enabled verify that the data device | ||
1852 | * supports discards. Disable discard_passdown if not. | ||
1853 | */ | ||
1854 | static void disable_passdown_if_not_supported(struct pool_c *pt) | ||
1855 | { | ||
1856 | struct pool *pool = pt->pool; | ||
1857 | struct block_device *data_bdev = pt->data_dev->bdev; | ||
1858 | struct queue_limits *data_limits = &bdev_get_queue(data_bdev)->limits; | ||
1859 | sector_t block_size = pool->sectors_per_block << SECTOR_SHIFT; | ||
1860 | const char *reason = NULL; | ||
1861 | char buf[BDEVNAME_SIZE]; | ||
1862 | |||
1863 | if (!pt->adjusted_pf.discard_passdown) | ||
1864 | return; | ||
1865 | |||
1866 | if (!data_dev_supports_discard(pt)) | ||
1867 | reason = "discard unsupported"; | ||
1868 | |||
1869 | else if (data_limits->max_discard_sectors < pool->sectors_per_block) | ||
1870 | reason = "max discard sectors smaller than a block"; | ||
1871 | |||
1872 | else if (data_limits->discard_granularity > block_size) | ||
1873 | reason = "discard granularity larger than a block"; | ||
1874 | |||
1875 | else if (block_size & (data_limits->discard_granularity - 1)) | ||
1876 | reason = "discard granularity not a factor of block size"; | ||
1877 | |||
1878 | if (reason) { | ||
1879 | DMWARN("Data device (%s) %s: Disabling discard passdown.", bdevname(data_bdev, buf), reason); | ||
1880 | pt->adjusted_pf.discard_passdown = false; | ||
1881 | } | ||
1882 | } | ||
1883 | |||
1842 | static int bind_control_target(struct pool *pool, struct dm_target *ti) | 1884 | static int bind_control_target(struct pool *pool, struct dm_target *ti) |
1843 | { | 1885 | { |
1844 | struct pool_c *pt = ti->private; | 1886 | struct pool_c *pt = ti->private; |
@@ -1847,31 +1889,16 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1847 | * We want to make sure that degraded pools are never upgraded. | 1889 | * We want to make sure that degraded pools are never upgraded. |
1848 | */ | 1890 | */ |
1849 | enum pool_mode old_mode = pool->pf.mode; | 1891 | enum pool_mode old_mode = pool->pf.mode; |
1850 | enum pool_mode new_mode = pt->pf.mode; | 1892 | enum pool_mode new_mode = pt->adjusted_pf.mode; |
1851 | 1893 | ||
1852 | if (old_mode > new_mode) | 1894 | if (old_mode > new_mode) |
1853 | new_mode = old_mode; | 1895 | new_mode = old_mode; |
1854 | 1896 | ||
1855 | pool->ti = ti; | 1897 | pool->ti = ti; |
1856 | pool->low_water_blocks = pt->low_water_blocks; | 1898 | pool->low_water_blocks = pt->low_water_blocks; |
1857 | pool->pf = pt->pf; | 1899 | pool->pf = pt->adjusted_pf; |
1858 | set_pool_mode(pool, new_mode); | ||
1859 | 1900 | ||
1860 | /* | 1901 | set_pool_mode(pool, new_mode); |
1861 | * If discard_passdown was enabled verify that the data device | ||
1862 | * supports discards. Disable discard_passdown if not; otherwise | ||
1863 | * -EOPNOTSUPP will be returned. | ||
1864 | */ | ||
1865 | /* FIXME: pull this out into a sep fn. */ | ||
1866 | if (pt->pf.discard_passdown) { | ||
1867 | struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); | ||
1868 | if (!q || !blk_queue_discard(q)) { | ||
1869 | char buf[BDEVNAME_SIZE]; | ||
1870 | DMWARN("Discard unsupported by data device (%s): Disabling discard passdown.", | ||
1871 | bdevname(pt->data_dev->bdev, buf)); | ||
1872 | pool->pf.discard_passdown = 0; | ||
1873 | } | ||
1874 | } | ||
1875 | 1902 | ||
1876 | return 0; | 1903 | return 0; |
1877 | } | 1904 | } |
@@ -1889,9 +1916,9 @@ static void unbind_control_target(struct pool *pool, struct dm_target *ti) | |||
1889 | static void pool_features_init(struct pool_features *pf) | 1916 | static void pool_features_init(struct pool_features *pf) |
1890 | { | 1917 | { |
1891 | pf->mode = PM_WRITE; | 1918 | pf->mode = PM_WRITE; |
1892 | pf->zero_new_blocks = 1; | 1919 | pf->zero_new_blocks = true; |
1893 | pf->discard_enabled = 1; | 1920 | pf->discard_enabled = true; |
1894 | pf->discard_passdown = 1; | 1921 | pf->discard_passdown = true; |
1895 | } | 1922 | } |
1896 | 1923 | ||
1897 | static void __pool_destroy(struct pool *pool) | 1924 | static void __pool_destroy(struct pool *pool) |
@@ -2119,13 +2146,13 @@ static int parse_pool_features(struct dm_arg_set *as, struct pool_features *pf, | |||
2119 | argc--; | 2146 | argc--; |
2120 | 2147 | ||
2121 | if (!strcasecmp(arg_name, "skip_block_zeroing")) | 2148 | if (!strcasecmp(arg_name, "skip_block_zeroing")) |
2122 | pf->zero_new_blocks = 0; | 2149 | pf->zero_new_blocks = false; |
2123 | 2150 | ||
2124 | else if (!strcasecmp(arg_name, "ignore_discard")) | 2151 | else if (!strcasecmp(arg_name, "ignore_discard")) |
2125 | pf->discard_enabled = 0; | 2152 | pf->discard_enabled = false; |
2126 | 2153 | ||
2127 | else if (!strcasecmp(arg_name, "no_discard_passdown")) | 2154 | else if (!strcasecmp(arg_name, "no_discard_passdown")) |
2128 | pf->discard_passdown = 0; | 2155 | pf->discard_passdown = false; |
2129 | 2156 | ||
2130 | else if (!strcasecmp(arg_name, "read_only")) | 2157 | else if (!strcasecmp(arg_name, "read_only")) |
2131 | pf->mode = PM_READ_ONLY; | 2158 | pf->mode = PM_READ_ONLY; |
@@ -2259,8 +2286,9 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2259 | pt->metadata_dev = metadata_dev; | 2286 | pt->metadata_dev = metadata_dev; |
2260 | pt->data_dev = data_dev; | 2287 | pt->data_dev = data_dev; |
2261 | pt->low_water_blocks = low_water_blocks; | 2288 | pt->low_water_blocks = low_water_blocks; |
2262 | pt->pf = pf; | 2289 | pt->adjusted_pf = pt->requested_pf = pf; |
2263 | ti->num_flush_requests = 1; | 2290 | ti->num_flush_requests = 1; |
2291 | |||
2264 | /* | 2292 | /* |
2265 | * Only need to enable discards if the pool should pass | 2293 | * Only need to enable discards if the pool should pass |
2266 | * them down to the data device. The thin device's discard | 2294 | * them down to the data device. The thin device's discard |
@@ -2268,12 +2296,14 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2268 | */ | 2296 | */ |
2269 | if (pf.discard_enabled && pf.discard_passdown) { | 2297 | if (pf.discard_enabled && pf.discard_passdown) { |
2270 | ti->num_discard_requests = 1; | 2298 | ti->num_discard_requests = 1; |
2299 | |||
2271 | /* | 2300 | /* |
2272 | * Setting 'discards_supported' circumvents the normal | 2301 | * Setting 'discards_supported' circumvents the normal |
2273 | * stacking of discard limits (this keeps the pool and | 2302 | * stacking of discard limits (this keeps the pool and |
2274 | * thin devices' discard limits consistent). | 2303 | * thin devices' discard limits consistent). |
2275 | */ | 2304 | */ |
2276 | ti->discards_supported = true; | 2305 | ti->discards_supported = true; |
2306 | ti->discard_zeroes_data_unsupported = true; | ||
2277 | } | 2307 | } |
2278 | ti->private = pt; | 2308 | ti->private = pt; |
2279 | 2309 | ||
@@ -2703,7 +2733,7 @@ static int pool_status(struct dm_target *ti, status_type_t type, | |||
2703 | format_dev_t(buf2, pt->data_dev->bdev->bd_dev), | 2733 | format_dev_t(buf2, pt->data_dev->bdev->bd_dev), |
2704 | (unsigned long)pool->sectors_per_block, | 2734 | (unsigned long)pool->sectors_per_block, |
2705 | (unsigned long long)pt->low_water_blocks); | 2735 | (unsigned long long)pt->low_water_blocks); |
2706 | emit_flags(&pt->pf, result, sz, maxlen); | 2736 | emit_flags(&pt->requested_pf, result, sz, maxlen); |
2707 | break; | 2737 | break; |
2708 | } | 2738 | } |
2709 | 2739 | ||
@@ -2732,20 +2762,21 @@ static int pool_merge(struct dm_target *ti, struct bvec_merge_data *bvm, | |||
2732 | return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); | 2762 | return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); |
2733 | } | 2763 | } |
2734 | 2764 | ||
2735 | static void set_discard_limits(struct pool *pool, struct queue_limits *limits) | 2765 | static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits) |
2736 | { | 2766 | { |
2737 | /* | 2767 | struct pool *pool = pt->pool; |
2738 | * FIXME: these limits may be incompatible with the pool's data device | 2768 | struct queue_limits *data_limits; |
2739 | */ | 2769 | |
2740 | limits->max_discard_sectors = pool->sectors_per_block; | 2770 | limits->max_discard_sectors = pool->sectors_per_block; |
2741 | 2771 | ||
2742 | /* | 2772 | /* |
2743 | * This is just a hint, and not enforced. We have to cope with | 2773 | * discard_granularity is just a hint, and not enforced. |
2744 | * bios that cover a block partially. A discard that spans a block | ||
2745 | * boundary is not sent to this target. | ||
2746 | */ | 2774 | */ |
2747 | limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; | 2775 | if (pt->adjusted_pf.discard_passdown) { |
2748 | limits->discard_zeroes_data = pool->pf.zero_new_blocks; | 2776 | data_limits = &bdev_get_queue(pt->data_dev->bdev)->limits; |
2777 | limits->discard_granularity = data_limits->discard_granularity; | ||
2778 | } else | ||
2779 | limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; | ||
2749 | } | 2780 | } |
2750 | 2781 | ||
2751 | static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) | 2782 | static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) |
@@ -2755,15 +2786,25 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
2755 | 2786 | ||
2756 | blk_limits_io_min(limits, 0); | 2787 | blk_limits_io_min(limits, 0); |
2757 | blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); | 2788 | blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); |
2758 | if (pool->pf.discard_enabled) | 2789 | |
2759 | set_discard_limits(pool, limits); | 2790 | /* |
2791 | * pt->adjusted_pf is a staging area for the actual features to use. | ||
2792 | * They get transferred to the live pool in bind_control_target() | ||
2793 | * called from pool_preresume(). | ||
2794 | */ | ||
2795 | if (!pt->adjusted_pf.discard_enabled) | ||
2796 | return; | ||
2797 | |||
2798 | disable_passdown_if_not_supported(pt); | ||
2799 | |||
2800 | set_discard_limits(pt, limits); | ||
2760 | } | 2801 | } |
2761 | 2802 | ||
2762 | static struct target_type pool_target = { | 2803 | static struct target_type pool_target = { |
2763 | .name = "thin-pool", | 2804 | .name = "thin-pool", |
2764 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2805 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2765 | DM_TARGET_IMMUTABLE, | 2806 | DM_TARGET_IMMUTABLE, |
2766 | .version = {1, 3, 0}, | 2807 | .version = {1, 4, 0}, |
2767 | .module = THIS_MODULE, | 2808 | .module = THIS_MODULE, |
2768 | .ctr = pool_ctr, | 2809 | .ctr = pool_ctr, |
2769 | .dtr = pool_dtr, | 2810 | .dtr = pool_dtr, |
@@ -3042,19 +3083,19 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
3042 | return 0; | 3083 | return 0; |
3043 | } | 3084 | } |
3044 | 3085 | ||
3086 | /* | ||
3087 | * A thin device always inherits its queue limits from its pool. | ||
3088 | */ | ||
3045 | static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) | 3089 | static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) |
3046 | { | 3090 | { |
3047 | struct thin_c *tc = ti->private; | 3091 | struct thin_c *tc = ti->private; |
3048 | struct pool *pool = tc->pool; | ||
3049 | 3092 | ||
3050 | blk_limits_io_min(limits, 0); | 3093 | *limits = bdev_get_queue(tc->pool_dev->bdev)->limits; |
3051 | blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); | ||
3052 | set_discard_limits(pool, limits); | ||
3053 | } | 3094 | } |
3054 | 3095 | ||
3055 | static struct target_type thin_target = { | 3096 | static struct target_type thin_target = { |
3056 | .name = "thin", | 3097 | .name = "thin", |
3057 | .version = {1, 3, 0}, | 3098 | .version = {1, 4, 0}, |
3058 | .module = THIS_MODULE, | 3099 | .module = THIS_MODULE, |
3059 | .ctr = thin_ctr, | 3100 | .ctr = thin_ctr, |
3060 | .dtr = thin_dtr, | 3101 | .dtr = thin_dtr, |
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 254d19268ad2..892ae2766aa6 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
@@ -718,8 +718,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
718 | v->hash_dev_block_bits = ffs(num) - 1; | 718 | v->hash_dev_block_bits = ffs(num) - 1; |
719 | 719 | ||
720 | if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 || | 720 | if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 || |
721 | num_ll << (v->data_dev_block_bits - SECTOR_SHIFT) != | 721 | (sector_t)(num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) |
722 | (sector_t)num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) { | 722 | >> (v->data_dev_block_bits - SECTOR_SHIFT) != num_ll) { |
723 | ti->error = "Invalid data blocks"; | 723 | ti->error = "Invalid data blocks"; |
724 | r = -EINVAL; | 724 | r = -EINVAL; |
725 | goto bad; | 725 | goto bad; |
@@ -733,8 +733,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
733 | } | 733 | } |
734 | 734 | ||
735 | if (sscanf(argv[6], "%llu%c", &num_ll, &dummy) != 1 || | 735 | if (sscanf(argv[6], "%llu%c", &num_ll, &dummy) != 1 || |
736 | num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT) != | 736 | (sector_t)(num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT)) |
737 | (sector_t)num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT)) { | 737 | >> (v->hash_dev_block_bits - SECTOR_SHIFT) != num_ll) { |
738 | ti->error = "Invalid hash start"; | 738 | ti->error = "Invalid hash start"; |
739 | r = -EINVAL; | 739 | r = -EINVAL; |
740 | goto bad; | 740 | goto bad; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 4e09b6ff5b49..67ffa391edcf 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -865,10 +865,14 @@ static void dm_done(struct request *clone, int error, bool mapped) | |||
865 | { | 865 | { |
866 | int r = error; | 866 | int r = error; |
867 | struct dm_rq_target_io *tio = clone->end_io_data; | 867 | struct dm_rq_target_io *tio = clone->end_io_data; |
868 | dm_request_endio_fn rq_end_io = tio->ti->type->rq_end_io; | 868 | dm_request_endio_fn rq_end_io = NULL; |
869 | 869 | ||
870 | if (mapped && rq_end_io) | 870 | if (tio->ti) { |
871 | r = rq_end_io(tio->ti, clone, error, &tio->info); | 871 | rq_end_io = tio->ti->type->rq_end_io; |
872 | |||
873 | if (mapped && rq_end_io) | ||
874 | r = rq_end_io(tio->ti, clone, error, &tio->info); | ||
875 | } | ||
872 | 876 | ||
873 | if (r <= 0) | 877 | if (r <= 0) |
874 | /* The target wants to complete the I/O */ | 878 | /* The target wants to complete the I/O */ |
@@ -1588,15 +1592,6 @@ static int map_request(struct dm_target *ti, struct request *clone, | |||
1588 | int r, requeued = 0; | 1592 | int r, requeued = 0; |
1589 | struct dm_rq_target_io *tio = clone->end_io_data; | 1593 | struct dm_rq_target_io *tio = clone->end_io_data; |
1590 | 1594 | ||
1591 | /* | ||
1592 | * Hold the md reference here for the in-flight I/O. | ||
1593 | * We can't rely on the reference count by device opener, | ||
1594 | * because the device may be closed during the request completion | ||
1595 | * when all bios are completed. | ||
1596 | * See the comment in rq_completed() too. | ||
1597 | */ | ||
1598 | dm_get(md); | ||
1599 | |||
1600 | tio->ti = ti; | 1595 | tio->ti = ti; |
1601 | r = ti->type->map_rq(ti, clone, &tio->info); | 1596 | r = ti->type->map_rq(ti, clone, &tio->info); |
1602 | switch (r) { | 1597 | switch (r) { |
@@ -1628,6 +1623,26 @@ static int map_request(struct dm_target *ti, struct request *clone, | |||
1628 | return requeued; | 1623 | return requeued; |
1629 | } | 1624 | } |
1630 | 1625 | ||
1626 | static struct request *dm_start_request(struct mapped_device *md, struct request *orig) | ||
1627 | { | ||
1628 | struct request *clone; | ||
1629 | |||
1630 | blk_start_request(orig); | ||
1631 | clone = orig->special; | ||
1632 | atomic_inc(&md->pending[rq_data_dir(clone)]); | ||
1633 | |||
1634 | /* | ||
1635 | * Hold the md reference here for the in-flight I/O. | ||
1636 | * We can't rely on the reference count by device opener, | ||
1637 | * because the device may be closed during the request completion | ||
1638 | * when all bios are completed. | ||
1639 | * See the comment in rq_completed() too. | ||
1640 | */ | ||
1641 | dm_get(md); | ||
1642 | |||
1643 | return clone; | ||
1644 | } | ||
1645 | |||
1631 | /* | 1646 | /* |
1632 | * q->request_fn for request-based dm. | 1647 | * q->request_fn for request-based dm. |
1633 | * Called with the queue lock held. | 1648 | * Called with the queue lock held. |
@@ -1657,14 +1672,21 @@ static void dm_request_fn(struct request_queue *q) | |||
1657 | pos = blk_rq_pos(rq); | 1672 | pos = blk_rq_pos(rq); |
1658 | 1673 | ||
1659 | ti = dm_table_find_target(map, pos); | 1674 | ti = dm_table_find_target(map, pos); |
1660 | BUG_ON(!dm_target_is_valid(ti)); | 1675 | if (!dm_target_is_valid(ti)) { |
1676 | /* | ||
1677 | * Must perform setup, that dm_done() requires, | ||
1678 | * before calling dm_kill_unmapped_request | ||
1679 | */ | ||
1680 | DMERR_LIMIT("request attempted access beyond the end of device"); | ||
1681 | clone = dm_start_request(md, rq); | ||
1682 | dm_kill_unmapped_request(clone, -EIO); | ||
1683 | continue; | ||
1684 | } | ||
1661 | 1685 | ||
1662 | if (ti->type->busy && ti->type->busy(ti)) | 1686 | if (ti->type->busy && ti->type->busy(ti)) |
1663 | goto delay_and_out; | 1687 | goto delay_and_out; |
1664 | 1688 | ||
1665 | blk_start_request(rq); | 1689 | clone = dm_start_request(md, rq); |
1666 | clone = rq->special; | ||
1667 | atomic_inc(&md->pending[rq_data_dir(clone)]); | ||
1668 | 1690 | ||
1669 | spin_unlock(q->queue_lock); | 1691 | spin_unlock(q->queue_lock); |
1670 | if (map_request(ti, clone, md)) | 1692 | if (map_request(ti, clone, md)) |
@@ -1684,8 +1706,6 @@ delay_and_out: | |||
1684 | blk_delay_queue(q, HZ / 10); | 1706 | blk_delay_queue(q, HZ / 10); |
1685 | out: | 1707 | out: |
1686 | dm_table_put(map); | 1708 | dm_table_put(map); |
1687 | |||
1688 | return; | ||
1689 | } | 1709 | } |
1690 | 1710 | ||
1691 | int dm_underlying_device_busy(struct request_queue *q) | 1711 | int dm_underlying_device_busy(struct request_queue *q) |
@@ -2409,7 +2429,7 @@ static void dm_queue_flush(struct mapped_device *md) | |||
2409 | */ | 2429 | */ |
2410 | struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) | 2430 | struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) |
2411 | { | 2431 | { |
2412 | struct dm_table *map = ERR_PTR(-EINVAL); | 2432 | struct dm_table *live_map, *map = ERR_PTR(-EINVAL); |
2413 | struct queue_limits limits; | 2433 | struct queue_limits limits; |
2414 | int r; | 2434 | int r; |
2415 | 2435 | ||
@@ -2419,6 +2439,19 @@ struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) | |||
2419 | if (!dm_suspended_md(md)) | 2439 | if (!dm_suspended_md(md)) |
2420 | goto out; | 2440 | goto out; |
2421 | 2441 | ||
2442 | /* | ||
2443 | * If the new table has no data devices, retain the existing limits. | ||
2444 | * This helps multipath with queue_if_no_path if all paths disappear, | ||
2445 | * then new I/O is queued based on these limits, and then some paths | ||
2446 | * reappear. | ||
2447 | */ | ||
2448 | if (dm_table_has_no_data_devices(table)) { | ||
2449 | live_map = dm_get_live_table(md); | ||
2450 | if (live_map) | ||
2451 | limits = md->queue->limits; | ||
2452 | dm_table_put(live_map); | ||
2453 | } | ||
2454 | |||
2422 | r = dm_calculate_queue_limits(table, &limits); | 2455 | r = dm_calculate_queue_limits(table, &limits); |
2423 | if (r) { | 2456 | if (r) { |
2424 | map = ERR_PTR(r); | 2457 | map = ERR_PTR(r); |
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 52eef493d266..6a99fefaa743 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -54,6 +54,7 @@ void dm_table_event_callback(struct dm_table *t, | |||
54 | void (*fn)(void *), void *context); | 54 | void (*fn)(void *), void *context); |
55 | struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index); | 55 | struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index); |
56 | struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector); | 56 | struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector); |
57 | bool dm_table_has_no_data_devices(struct dm_table *table); | ||
57 | int dm_calculate_queue_limits(struct dm_table *table, | 58 | int dm_calculate_queue_limits(struct dm_table *table, |
58 | struct queue_limits *limits); | 59 | struct queue_limits *limits); |
59 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | 60 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 3f6203a4c7ea..308e87b417e0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7619,6 +7619,8 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7619 | } | 7619 | } |
7620 | } | 7620 | } |
7621 | } | 7621 | } |
7622 | if (removed) | ||
7623 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | ||
7622 | return spares; | 7624 | return spares; |
7623 | } | 7625 | } |
7624 | 7626 | ||
@@ -7632,9 +7634,11 @@ static void reap_sync_thread(struct mddev *mddev) | |||
7632 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { | 7634 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { |
7633 | /* success...*/ | 7635 | /* success...*/ |
7634 | /* activate any spares */ | 7636 | /* activate any spares */ |
7635 | if (mddev->pers->spare_active(mddev)) | 7637 | if (mddev->pers->spare_active(mddev)) { |
7636 | sysfs_notify(&mddev->kobj, NULL, | 7638 | sysfs_notify(&mddev->kobj, NULL, |
7637 | "degraded"); | 7639 | "degraded"); |
7640 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | ||
7641 | } | ||
7638 | } | 7642 | } |
7639 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && | 7643 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && |
7640 | mddev->pers->finish_reshape) | 7644 | mddev->pers->finish_reshape) |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 1c2eb38f3c51..0138a727c1f3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1512,14 +1512,16 @@ static int _enough(struct r10conf *conf, struct geom *geo, int ignore) | |||
1512 | do { | 1512 | do { |
1513 | int n = conf->copies; | 1513 | int n = conf->copies; |
1514 | int cnt = 0; | 1514 | int cnt = 0; |
1515 | int this = first; | ||
1515 | while (n--) { | 1516 | while (n--) { |
1516 | if (conf->mirrors[first].rdev && | 1517 | if (conf->mirrors[this].rdev && |
1517 | first != ignore) | 1518 | this != ignore) |
1518 | cnt++; | 1519 | cnt++; |
1519 | first = (first+1) % geo->raid_disks; | 1520 | this = (this+1) % geo->raid_disks; |
1520 | } | 1521 | } |
1521 | if (cnt == 0) | 1522 | if (cnt == 0) |
1522 | return 0; | 1523 | return 0; |
1524 | first = (first + geo->near_copies) % geo->raid_disks; | ||
1523 | } while (first != 0); | 1525 | } while (first != 0); |
1524 | return 1; | 1526 | return 1; |
1525 | } | 1527 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index adda94df5eb2..0689173fd9f5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -393,6 +393,8 @@ static int calc_degraded(struct r5conf *conf) | |||
393 | degraded = 0; | 393 | degraded = 0; |
394 | for (i = 0; i < conf->previous_raid_disks; i++) { | 394 | for (i = 0; i < conf->previous_raid_disks; i++) { |
395 | struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); | 395 | struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); |
396 | if (rdev && test_bit(Faulty, &rdev->flags)) | ||
397 | rdev = rcu_dereference(conf->disks[i].replacement); | ||
396 | if (!rdev || test_bit(Faulty, &rdev->flags)) | 398 | if (!rdev || test_bit(Faulty, &rdev->flags)) |
397 | degraded++; | 399 | degraded++; |
398 | else if (test_bit(In_sync, &rdev->flags)) | 400 | else if (test_bit(In_sync, &rdev->flags)) |
@@ -417,6 +419,8 @@ static int calc_degraded(struct r5conf *conf) | |||
417 | degraded2 = 0; | 419 | degraded2 = 0; |
418 | for (i = 0; i < conf->raid_disks; i++) { | 420 | for (i = 0; i < conf->raid_disks; i++) { |
419 | struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); | 421 | struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); |
422 | if (rdev && test_bit(Faulty, &rdev->flags)) | ||
423 | rdev = rcu_dereference(conf->disks[i].replacement); | ||
420 | if (!rdev || test_bit(Faulty, &rdev->flags)) | 424 | if (!rdev || test_bit(Faulty, &rdev->flags)) |
421 | degraded2++; | 425 | degraded2++; |
422 | else if (test_bit(In_sync, &rdev->flags)) | 426 | else if (test_bit(In_sync, &rdev->flags)) |
@@ -1587,6 +1591,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
1587 | #ifdef CONFIG_MULTICORE_RAID456 | 1591 | #ifdef CONFIG_MULTICORE_RAID456 |
1588 | init_waitqueue_head(&nsh->ops.wait_for_ops); | 1592 | init_waitqueue_head(&nsh->ops.wait_for_ops); |
1589 | #endif | 1593 | #endif |
1594 | spin_lock_init(&nsh->stripe_lock); | ||
1590 | 1595 | ||
1591 | list_add(&nsh->lru, &newstripes); | 1596 | list_add(&nsh->lru, &newstripes); |
1592 | } | 1597 | } |
@@ -4192,7 +4197,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4192 | finish_wait(&conf->wait_for_overlap, &w); | 4197 | finish_wait(&conf->wait_for_overlap, &w); |
4193 | set_bit(STRIPE_HANDLE, &sh->state); | 4198 | set_bit(STRIPE_HANDLE, &sh->state); |
4194 | clear_bit(STRIPE_DELAYED, &sh->state); | 4199 | clear_bit(STRIPE_DELAYED, &sh->state); |
4195 | if ((bi->bi_rw & REQ_NOIDLE) && | 4200 | if ((bi->bi_rw & REQ_SYNC) && |
4196 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | 4201 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) |
4197 | atomic_inc(&conf->preread_active_stripes); | 4202 | atomic_inc(&conf->preread_active_stripes); |
4198 | release_stripe_plug(mddev, sh); | 4203 | release_stripe_plug(mddev, sh); |
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index b67a3018b136..ce229ea933d1 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c | |||
@@ -470,7 +470,8 @@ static int __devinit device_800_init(struct pm80x_chip *chip, | |||
470 | 470 | ||
471 | ret = | 471 | ret = |
472 | mfd_add_devices(chip->dev, 0, &onkey_devs[0], | 472 | mfd_add_devices(chip->dev, 0, &onkey_devs[0], |
473 | ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0); | 473 | ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0, |
474 | NULL); | ||
474 | if (ret < 0) { | 475 | if (ret < 0) { |
475 | dev_err(chip->dev, "Failed to add onkey subdev\n"); | 476 | dev_err(chip->dev, "Failed to add onkey subdev\n"); |
476 | goto out_dev; | 477 | goto out_dev; |
@@ -481,7 +482,7 @@ static int __devinit device_800_init(struct pm80x_chip *chip, | |||
481 | rtc_devs[0].platform_data = pdata->rtc; | 482 | rtc_devs[0].platform_data = pdata->rtc; |
482 | rtc_devs[0].pdata_size = sizeof(struct pm80x_rtc_pdata); | 483 | rtc_devs[0].pdata_size = sizeof(struct pm80x_rtc_pdata); |
483 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], | 484 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], |
484 | ARRAY_SIZE(rtc_devs), NULL, 0); | 485 | ARRAY_SIZE(rtc_devs), NULL, 0, NULL); |
485 | if (ret < 0) { | 486 | if (ret < 0) { |
486 | dev_err(chip->dev, "Failed to add rtc subdev\n"); | 487 | dev_err(chip->dev, "Failed to add rtc subdev\n"); |
487 | goto out_dev; | 488 | goto out_dev; |
diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 6146583589f6..c20a31136f04 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c | |||
@@ -216,7 +216,8 @@ static int __devinit device_805_init(struct pm80x_chip *chip) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | ret = mfd_add_devices(chip->dev, 0, &codec_devs[0], | 218 | ret = mfd_add_devices(chip->dev, 0, &codec_devs[0], |
219 | ARRAY_SIZE(codec_devs), &codec_resources[0], 0); | 219 | ARRAY_SIZE(codec_devs), &codec_resources[0], 0, |
220 | NULL); | ||
220 | if (ret < 0) { | 221 | if (ret < 0) { |
221 | dev_err(chip->dev, "Failed to add codec subdev\n"); | 222 | dev_err(chip->dev, "Failed to add codec subdev\n"); |
222 | goto out_codec; | 223 | goto out_codec; |
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index d09918cf1b15..b73f033b2c60 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c | |||
@@ -637,7 +637,7 @@ static void __devinit device_bk_init(struct pm860x_chip *chip, | |||
637 | bk_devs[i].resources = &bk_resources[j]; | 637 | bk_devs[i].resources = &bk_resources[j]; |
638 | ret = mfd_add_devices(chip->dev, 0, | 638 | ret = mfd_add_devices(chip->dev, 0, |
639 | &bk_devs[i], 1, | 639 | &bk_devs[i], 1, |
640 | &bk_resources[j], 0); | 640 | &bk_resources[j], 0, NULL); |
641 | if (ret < 0) { | 641 | if (ret < 0) { |
642 | dev_err(chip->dev, "Failed to add " | 642 | dev_err(chip->dev, "Failed to add " |
643 | "backlight subdev\n"); | 643 | "backlight subdev\n"); |
@@ -672,7 +672,7 @@ static void __devinit device_led_init(struct pm860x_chip *chip, | |||
672 | led_devs[i].resources = &led_resources[j], | 672 | led_devs[i].resources = &led_resources[j], |
673 | ret = mfd_add_devices(chip->dev, 0, | 673 | ret = mfd_add_devices(chip->dev, 0, |
674 | &led_devs[i], 1, | 674 | &led_devs[i], 1, |
675 | &led_resources[j], 0); | 675 | &led_resources[j], 0, NULL); |
676 | if (ret < 0) { | 676 | if (ret < 0) { |
677 | dev_err(chip->dev, "Failed to add " | 677 | dev_err(chip->dev, "Failed to add " |
678 | "led subdev\n"); | 678 | "led subdev\n"); |
@@ -709,7 +709,7 @@ static void __devinit device_regulator_init(struct pm860x_chip *chip, | |||
709 | regulator_devs[i].resources = ®ulator_resources[seq]; | 709 | regulator_devs[i].resources = ®ulator_resources[seq]; |
710 | 710 | ||
711 | ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[i], 1, | 711 | ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[i], 1, |
712 | ®ulator_resources[seq], 0); | 712 | ®ulator_resources[seq], 0, NULL); |
713 | if (ret < 0) { | 713 | if (ret < 0) { |
714 | dev_err(chip->dev, "Failed to add regulator subdev\n"); | 714 | dev_err(chip->dev, "Failed to add regulator subdev\n"); |
715 | goto out; | 715 | goto out; |
@@ -733,7 +733,7 @@ static void __devinit device_rtc_init(struct pm860x_chip *chip, | |||
733 | rtc_devs[0].resources = &rtc_resources[0]; | 733 | rtc_devs[0].resources = &rtc_resources[0]; |
734 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], | 734 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], |
735 | ARRAY_SIZE(rtc_devs), &rtc_resources[0], | 735 | ARRAY_SIZE(rtc_devs), &rtc_resources[0], |
736 | chip->irq_base); | 736 | chip->irq_base, NULL); |
737 | if (ret < 0) | 737 | if (ret < 0) |
738 | dev_err(chip->dev, "Failed to add rtc subdev\n"); | 738 | dev_err(chip->dev, "Failed to add rtc subdev\n"); |
739 | } | 739 | } |
@@ -752,7 +752,7 @@ static void __devinit device_touch_init(struct pm860x_chip *chip, | |||
752 | touch_devs[0].resources = &touch_resources[0]; | 752 | touch_devs[0].resources = &touch_resources[0]; |
753 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], | 753 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], |
754 | ARRAY_SIZE(touch_devs), &touch_resources[0], | 754 | ARRAY_SIZE(touch_devs), &touch_resources[0], |
755 | chip->irq_base); | 755 | chip->irq_base, NULL); |
756 | if (ret < 0) | 756 | if (ret < 0) |
757 | dev_err(chip->dev, "Failed to add touch subdev\n"); | 757 | dev_err(chip->dev, "Failed to add touch subdev\n"); |
758 | } | 758 | } |
@@ -770,7 +770,7 @@ static void __devinit device_power_init(struct pm860x_chip *chip, | |||
770 | power_devs[0].num_resources = ARRAY_SIZE(battery_resources); | 770 | power_devs[0].num_resources = ARRAY_SIZE(battery_resources); |
771 | power_devs[0].resources = &battery_resources[0], | 771 | power_devs[0].resources = &battery_resources[0], |
772 | ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1, | 772 | ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1, |
773 | &battery_resources[0], chip->irq_base); | 773 | &battery_resources[0], chip->irq_base, NULL); |
774 | if (ret < 0) | 774 | if (ret < 0) |
775 | dev_err(chip->dev, "Failed to add battery subdev\n"); | 775 | dev_err(chip->dev, "Failed to add battery subdev\n"); |
776 | 776 | ||
@@ -779,7 +779,7 @@ static void __devinit device_power_init(struct pm860x_chip *chip, | |||
779 | power_devs[1].num_resources = ARRAY_SIZE(charger_resources); | 779 | power_devs[1].num_resources = ARRAY_SIZE(charger_resources); |
780 | power_devs[1].resources = &charger_resources[0], | 780 | power_devs[1].resources = &charger_resources[0], |
781 | ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1, | 781 | ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1, |
782 | &charger_resources[0], chip->irq_base); | 782 | &charger_resources[0], chip->irq_base, NULL); |
783 | if (ret < 0) | 783 | if (ret < 0) |
784 | dev_err(chip->dev, "Failed to add charger subdev\n"); | 784 | dev_err(chip->dev, "Failed to add charger subdev\n"); |
785 | 785 | ||
@@ -788,7 +788,7 @@ static void __devinit device_power_init(struct pm860x_chip *chip, | |||
788 | power_devs[2].num_resources = ARRAY_SIZE(preg_resources); | 788 | power_devs[2].num_resources = ARRAY_SIZE(preg_resources); |
789 | power_devs[2].resources = &preg_resources[0], | 789 | power_devs[2].resources = &preg_resources[0], |
790 | ret = mfd_add_devices(chip->dev, 0, &power_devs[2], 1, | 790 | ret = mfd_add_devices(chip->dev, 0, &power_devs[2], 1, |
791 | &preg_resources[0], chip->irq_base); | 791 | &preg_resources[0], chip->irq_base, NULL); |
792 | if (ret < 0) | 792 | if (ret < 0) |
793 | dev_err(chip->dev, "Failed to add preg subdev\n"); | 793 | dev_err(chip->dev, "Failed to add preg subdev\n"); |
794 | } | 794 | } |
@@ -802,7 +802,7 @@ static void __devinit device_onkey_init(struct pm860x_chip *chip, | |||
802 | onkey_devs[0].resources = &onkey_resources[0], | 802 | onkey_devs[0].resources = &onkey_resources[0], |
803 | ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], | 803 | ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], |
804 | ARRAY_SIZE(onkey_devs), &onkey_resources[0], | 804 | ARRAY_SIZE(onkey_devs), &onkey_resources[0], |
805 | chip->irq_base); | 805 | chip->irq_base, NULL); |
806 | if (ret < 0) | 806 | if (ret < 0) |
807 | dev_err(chip->dev, "Failed to add onkey subdev\n"); | 807 | dev_err(chip->dev, "Failed to add onkey subdev\n"); |
808 | } | 808 | } |
@@ -815,7 +815,8 @@ static void __devinit device_codec_init(struct pm860x_chip *chip, | |||
815 | codec_devs[0].num_resources = ARRAY_SIZE(codec_resources); | 815 | codec_devs[0].num_resources = ARRAY_SIZE(codec_resources); |
816 | codec_devs[0].resources = &codec_resources[0], | 816 | codec_devs[0].resources = &codec_resources[0], |
817 | ret = mfd_add_devices(chip->dev, 0, &codec_devs[0], | 817 | ret = mfd_add_devices(chip->dev, 0, &codec_devs[0], |
818 | ARRAY_SIZE(codec_devs), &codec_resources[0], 0); | 818 | ARRAY_SIZE(codec_devs), &codec_resources[0], 0, |
819 | NULL); | ||
819 | if (ret < 0) | 820 | if (ret < 0) |
820 | dev_err(chip->dev, "Failed to add codec subdev\n"); | 821 | dev_err(chip->dev, "Failed to add codec subdev\n"); |
821 | } | 822 | } |
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index 44a3fdbadef4..f1beb4971f87 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c | |||
@@ -424,7 +424,7 @@ static int aat2870_i2c_probe(struct i2c_client *client, | |||
424 | } | 424 | } |
425 | 425 | ||
426 | ret = mfd_add_devices(aat2870->dev, 0, aat2870_devs, | 426 | ret = mfd_add_devices(aat2870->dev, 0, aat2870_devs, |
427 | ARRAY_SIZE(aat2870_devs), NULL, 0); | 427 | ARRAY_SIZE(aat2870_devs), NULL, 0, NULL); |
428 | if (ret != 0) { | 428 | if (ret != 0) { |
429 | dev_err(aat2870->dev, "Failed to add subdev: %d\n", ret); | 429 | dev_err(aat2870->dev, "Failed to add subdev: %d\n", ret); |
430 | goto out_disable; | 430 | goto out_disable; |
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index 78fca2902c8d..01781ae5d0d7 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -946,7 +946,7 @@ static int __devinit ab3100_probe(struct i2c_client *client, | |||
946 | } | 946 | } |
947 | 947 | ||
948 | err = mfd_add_devices(&client->dev, 0, ab3100_devs, | 948 | err = mfd_add_devices(&client->dev, 0, ab3100_devs, |
949 | ARRAY_SIZE(ab3100_devs), NULL, 0); | 949 | ARRAY_SIZE(ab3100_devs), NULL, 0, NULL); |
950 | 950 | ||
951 | ab3100_setup_debugfs(ab3100); | 951 | ab3100_setup_debugfs(ab3100); |
952 | 952 | ||
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 626b4ecaf647..47adf800024e 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -1418,25 +1418,25 @@ static int __devinit ab8500_probe(struct platform_device *pdev) | |||
1418 | 1418 | ||
1419 | ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs, | 1419 | ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs, |
1420 | ARRAY_SIZE(abx500_common_devs), NULL, | 1420 | ARRAY_SIZE(abx500_common_devs), NULL, |
1421 | ab8500->irq_base); | 1421 | ab8500->irq_base, ab8500->domain); |
1422 | if (ret) | 1422 | if (ret) |
1423 | goto out_freeirq; | 1423 | goto out_freeirq; |
1424 | 1424 | ||
1425 | if (is_ab9540(ab8500)) | 1425 | if (is_ab9540(ab8500)) |
1426 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, | 1426 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, |
1427 | ARRAY_SIZE(ab9540_devs), NULL, | 1427 | ARRAY_SIZE(ab9540_devs), NULL, |
1428 | ab8500->irq_base); | 1428 | ab8500->irq_base, ab8500->domain); |
1429 | else | 1429 | else |
1430 | ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs, | 1430 | ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs, |
1431 | ARRAY_SIZE(ab8500_devs), NULL, | 1431 | ARRAY_SIZE(ab8500_devs), NULL, |
1432 | ab8500->irq_base); | 1432 | ab8500->irq_base, ab8500->domain); |
1433 | if (ret) | 1433 | if (ret) |
1434 | goto out_freeirq; | 1434 | goto out_freeirq; |
1435 | 1435 | ||
1436 | if (is_ab9540(ab8500) || is_ab8505(ab8500)) | 1436 | if (is_ab9540(ab8500) || is_ab8505(ab8500)) |
1437 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_ab8505_devs, | 1437 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_ab8505_devs, |
1438 | ARRAY_SIZE(ab9540_ab8505_devs), NULL, | 1438 | ARRAY_SIZE(ab9540_ab8505_devs), NULL, |
1439 | ab8500->irq_base); | 1439 | ab8500->irq_base, ab8500->domain); |
1440 | if (ret) | 1440 | if (ret) |
1441 | goto out_freeirq; | 1441 | goto out_freeirq; |
1442 | 1442 | ||
@@ -1444,7 +1444,7 @@ static int __devinit ab8500_probe(struct platform_device *pdev) | |||
1444 | /* Add battery management devices */ | 1444 | /* Add battery management devices */ |
1445 | ret = mfd_add_devices(ab8500->dev, 0, ab8500_bm_devs, | 1445 | ret = mfd_add_devices(ab8500->dev, 0, ab8500_bm_devs, |
1446 | ARRAY_SIZE(ab8500_bm_devs), NULL, | 1446 | ARRAY_SIZE(ab8500_bm_devs), NULL, |
1447 | ab8500->irq_base); | 1447 | ab8500->irq_base, ab8500->domain); |
1448 | if (ret) | 1448 | if (ret) |
1449 | dev_err(ab8500->dev, "error adding bm devices\n"); | 1449 | dev_err(ab8500->dev, "error adding bm devices\n"); |
1450 | } | 1450 | } |
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index c7983e862549..1b48f2094806 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c | |||
@@ -316,7 +316,7 @@ int __devinit arizona_dev_init(struct arizona *arizona) | |||
316 | } | 316 | } |
317 | 317 | ||
318 | ret = mfd_add_devices(arizona->dev, -1, early_devs, | 318 | ret = mfd_add_devices(arizona->dev, -1, early_devs, |
319 | ARRAY_SIZE(early_devs), NULL, 0); | 319 | ARRAY_SIZE(early_devs), NULL, 0, NULL); |
320 | if (ret != 0) { | 320 | if (ret != 0) { |
321 | dev_err(dev, "Failed to add early children: %d\n", ret); | 321 | dev_err(dev, "Failed to add early children: %d\n", ret); |
322 | return ret; | 322 | return ret; |
@@ -516,11 +516,11 @@ int __devinit arizona_dev_init(struct arizona *arizona) | |||
516 | switch (arizona->type) { | 516 | switch (arizona->type) { |
517 | case WM5102: | 517 | case WM5102: |
518 | ret = mfd_add_devices(arizona->dev, -1, wm5102_devs, | 518 | ret = mfd_add_devices(arizona->dev, -1, wm5102_devs, |
519 | ARRAY_SIZE(wm5102_devs), NULL, 0); | 519 | ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); |
520 | break; | 520 | break; |
521 | case WM5110: | 521 | case WM5110: |
522 | ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, | 522 | ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, |
523 | ARRAY_SIZE(wm5102_devs), NULL, 0); | 523 | ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); |
524 | break; | 524 | break; |
525 | } | 525 | } |
526 | 526 | ||
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 683e18a23329..62f0883a7630 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -913,14 +913,14 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, | |||
913 | if (pdata->clock_rate) { | 913 | if (pdata->clock_rate) { |
914 | ds1wm_pdata.clock_rate = pdata->clock_rate; | 914 | ds1wm_pdata.clock_rate = pdata->clock_rate; |
915 | ret = mfd_add_devices(&pdev->dev, pdev->id, | 915 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
916 | &asic3_cell_ds1wm, 1, mem, asic->irq_base); | 916 | &asic3_cell_ds1wm, 1, mem, asic->irq_base, NULL); |
917 | if (ret < 0) | 917 | if (ret < 0) |
918 | goto out; | 918 | goto out; |
919 | } | 919 | } |
920 | 920 | ||
921 | if (mem_sdio && (irq >= 0)) { | 921 | if (mem_sdio && (irq >= 0)) { |
922 | ret = mfd_add_devices(&pdev->dev, pdev->id, | 922 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
923 | &asic3_cell_mmc, 1, mem_sdio, irq); | 923 | &asic3_cell_mmc, 1, mem_sdio, irq, NULL); |
924 | if (ret < 0) | 924 | if (ret < 0) |
925 | goto out; | 925 | goto out; |
926 | } | 926 | } |
@@ -934,7 +934,7 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, | |||
934 | asic3_cell_leds[i].pdata_size = sizeof(pdata->leds[i]); | 934 | asic3_cell_leds[i].pdata_size = sizeof(pdata->leds[i]); |
935 | } | 935 | } |
936 | ret = mfd_add_devices(&pdev->dev, 0, | 936 | ret = mfd_add_devices(&pdev->dev, 0, |
937 | asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0); | 937 | asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0, NULL); |
938 | } | 938 | } |
939 | 939 | ||
940 | out: | 940 | out: |
diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index 3419e726de47..2b282133c725 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c | |||
@@ -149,7 +149,7 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev, | |||
149 | } | 149 | } |
150 | 150 | ||
151 | err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, | 151 | err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, |
152 | ARRAY_SIZE(cs5535_mfd_cells), NULL, 0); | 152 | ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL); |
153 | if (err) { | 153 | if (err) { |
154 | dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); | 154 | dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); |
155 | goto err_disable; | 155 | goto err_disable; |
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index 2544910e1fd6..a0a62b24621b 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c | |||
@@ -803,7 +803,7 @@ int __devinit da9052_device_init(struct da9052 *da9052, u8 chip_id) | |||
803 | dev_err(da9052->dev, "DA9052 ADC IRQ failed ret=%d\n", ret); | 803 | dev_err(da9052->dev, "DA9052 ADC IRQ failed ret=%d\n", ret); |
804 | 804 | ||
805 | ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info, | 805 | ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info, |
806 | ARRAY_SIZE(da9052_subdev_info), NULL, 0); | 806 | ARRAY_SIZE(da9052_subdev_info), NULL, 0, NULL); |
807 | if (ret) | 807 | if (ret) |
808 | goto err; | 808 | goto err; |
809 | 809 | ||
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c index 4e2af2cb2d26..45e83a68641b 100644 --- a/drivers/mfd/davinci_voicecodec.c +++ b/drivers/mfd/davinci_voicecodec.c | |||
@@ -129,7 +129,7 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
129 | cell->pdata_size = sizeof(*davinci_vc); | 129 | cell->pdata_size = sizeof(*davinci_vc); |
130 | 130 | ||
131 | ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells, | 131 | ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells, |
132 | DAVINCI_VC_CELLS, NULL, 0); | 132 | DAVINCI_VC_CELLS, NULL, 0, NULL); |
133 | if (ret != 0) { | 133 | if (ret != 0) { |
134 | dev_err(&pdev->dev, "fail to register client devices\n"); | 134 | dev_err(&pdev->dev, "fail to register client devices\n"); |
135 | goto fail4; | 135 | goto fail4; |
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 7040a0081130..0e63cdd9b52a 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -3010,7 +3010,7 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev) | |||
3010 | prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); | 3010 | prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); |
3011 | 3011 | ||
3012 | err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, | 3012 | err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, |
3013 | ARRAY_SIZE(db8500_prcmu_devs), NULL, 0); | 3013 | ARRAY_SIZE(db8500_prcmu_devs), NULL, 0, NULL); |
3014 | if (err) { | 3014 | if (err) { |
3015 | pr_err("prcmu: Failed to add subdevices\n"); | 3015 | pr_err("prcmu: Failed to add subdevices\n"); |
3016 | return err; | 3016 | return err; |
diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c index 04c7093d6499..9e5453d21a68 100644 --- a/drivers/mfd/htc-pasic3.c +++ b/drivers/mfd/htc-pasic3.c | |||
@@ -168,7 +168,7 @@ static int __init pasic3_probe(struct platform_device *pdev) | |||
168 | /* the first 5 PASIC3 registers control the DS1WM */ | 168 | /* the first 5 PASIC3 registers control the DS1WM */ |
169 | ds1wm_resources[0].end = (5 << asic->bus_shift) - 1; | 169 | ds1wm_resources[0].end = (5 << asic->bus_shift) - 1; |
170 | ret = mfd_add_devices(&pdev->dev, pdev->id, | 170 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
171 | &ds1wm_cell, 1, r, irq); | 171 | &ds1wm_cell, 1, r, irq, NULL); |
172 | if (ret < 0) | 172 | if (ret < 0) |
173 | dev_warn(dev, "failed to register DS1WM\n"); | 173 | dev_warn(dev, "failed to register DS1WM\n"); |
174 | } | 174 | } |
@@ -176,7 +176,8 @@ static int __init pasic3_probe(struct platform_device *pdev) | |||
176 | if (pdata && pdata->led_pdata) { | 176 | if (pdata && pdata->led_pdata) { |
177 | led_cell.platform_data = pdata->led_pdata; | 177 | led_cell.platform_data = pdata->led_pdata; |
178 | led_cell.pdata_size = sizeof(struct pasic3_leds_machinfo); | 178 | led_cell.pdata_size = sizeof(struct pasic3_leds_machinfo); |
179 | ret = mfd_add_devices(&pdev->dev, pdev->id, &led_cell, 1, r, 0); | 179 | ret = mfd_add_devices(&pdev->dev, pdev->id, &led_cell, 1, r, |
180 | 0, NULL); | ||
180 | if (ret < 0) | 181 | if (ret < 0) |
181 | dev_warn(dev, "failed to register LED device\n"); | 182 | dev_warn(dev, "failed to register LED device\n"); |
182 | } | 183 | } |
diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c index 59df5584cb58..266bdc5bd96d 100644 --- a/drivers/mfd/intel_msic.c +++ b/drivers/mfd/intel_msic.c | |||
@@ -344,13 +344,13 @@ static int __devinit intel_msic_init_devices(struct intel_msic *msic) | |||
344 | continue; | 344 | continue; |
345 | 345 | ||
346 | ret = mfd_add_devices(&pdev->dev, -1, &msic_devs[i], 1, NULL, | 346 | ret = mfd_add_devices(&pdev->dev, -1, &msic_devs[i], 1, NULL, |
347 | pdata->irq[i]); | 347 | pdata->irq[i], NULL); |
348 | if (ret) | 348 | if (ret) |
349 | goto fail; | 349 | goto fail; |
350 | } | 350 | } |
351 | 351 | ||
352 | ret = mfd_add_devices(&pdev->dev, 0, msic_other_devs, | 352 | ret = mfd_add_devices(&pdev->dev, 0, msic_other_devs, |
353 | ARRAY_SIZE(msic_other_devs), NULL, 0); | 353 | ARRAY_SIZE(msic_other_devs), NULL, 0, NULL); |
354 | if (ret) | 354 | if (ret) |
355 | goto fail; | 355 | goto fail; |
356 | 356 | ||
diff --git a/drivers/mfd/janz-cmodio.c b/drivers/mfd/janz-cmodio.c index 2ea99989551a..965c4801df8a 100644 --- a/drivers/mfd/janz-cmodio.c +++ b/drivers/mfd/janz-cmodio.c | |||
@@ -147,7 +147,7 @@ static int __devinit cmodio_probe_submodules(struct cmodio_device *priv) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | return mfd_add_devices(&pdev->dev, 0, priv->cells, | 149 | return mfd_add_devices(&pdev->dev, 0, priv->cells, |
150 | num_probed, NULL, pdev->irq); | 150 | num_probed, NULL, pdev->irq, NULL); |
151 | } | 151 | } |
152 | 152 | ||
153 | /* | 153 | /* |
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c index 87662a17dec6..c6b6d7dda517 100644 --- a/drivers/mfd/jz4740-adc.c +++ b/drivers/mfd/jz4740-adc.c | |||
@@ -287,7 +287,8 @@ static int __devinit jz4740_adc_probe(struct platform_device *pdev) | |||
287 | writeb(0xff, adc->base + JZ_REG_ADC_CTRL); | 287 | writeb(0xff, adc->base + JZ_REG_ADC_CTRL); |
288 | 288 | ||
289 | ret = mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells, | 289 | ret = mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells, |
290 | ARRAY_SIZE(jz4740_adc_cells), mem_base, irq_base); | 290 | ARRAY_SIZE(jz4740_adc_cells), mem_base, |
291 | irq_base, NULL); | ||
291 | if (ret < 0) | 292 | if (ret < 0) |
292 | goto err_clk_put; | 293 | goto err_clk_put; |
293 | 294 | ||
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c index 0b2879b87fd9..24212f45b201 100644 --- a/drivers/mfd/lm3533-core.c +++ b/drivers/mfd/lm3533-core.c | |||
@@ -393,7 +393,8 @@ static int __devinit lm3533_device_als_init(struct lm3533 *lm3533) | |||
393 | lm3533_als_devs[0].platform_data = pdata->als; | 393 | lm3533_als_devs[0].platform_data = pdata->als; |
394 | lm3533_als_devs[0].pdata_size = sizeof(*pdata->als); | 394 | lm3533_als_devs[0].pdata_size = sizeof(*pdata->als); |
395 | 395 | ||
396 | ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL, 0); | 396 | ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL, |
397 | 0, NULL); | ||
397 | if (ret) { | 398 | if (ret) { |
398 | dev_err(lm3533->dev, "failed to add ALS device\n"); | 399 | dev_err(lm3533->dev, "failed to add ALS device\n"); |
399 | return ret; | 400 | return ret; |
@@ -422,7 +423,7 @@ static int __devinit lm3533_device_bl_init(struct lm3533 *lm3533) | |||
422 | } | 423 | } |
423 | 424 | ||
424 | ret = mfd_add_devices(lm3533->dev, 0, lm3533_bl_devs, | 425 | ret = mfd_add_devices(lm3533->dev, 0, lm3533_bl_devs, |
425 | pdata->num_backlights, NULL, 0); | 426 | pdata->num_backlights, NULL, 0, NULL); |
426 | if (ret) { | 427 | if (ret) { |
427 | dev_err(lm3533->dev, "failed to add backlight devices\n"); | 428 | dev_err(lm3533->dev, "failed to add backlight devices\n"); |
428 | return ret; | 429 | return ret; |
@@ -451,7 +452,7 @@ static int __devinit lm3533_device_led_init(struct lm3533 *lm3533) | |||
451 | } | 452 | } |
452 | 453 | ||
453 | ret = mfd_add_devices(lm3533->dev, 0, lm3533_led_devs, | 454 | ret = mfd_add_devices(lm3533->dev, 0, lm3533_led_devs, |
454 | pdata->num_leds, NULL, 0); | 455 | pdata->num_leds, NULL, 0, NULL); |
455 | if (ret) { | 456 | if (ret) { |
456 | dev_err(lm3533->dev, "failed to add LED devices\n"); | 457 | dev_err(lm3533->dev, "failed to add LED devices\n"); |
457 | return ret; | 458 | return ret; |
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index 027cc8f86132..092ad4b44b6d 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c | |||
@@ -750,7 +750,7 @@ gpe0_done: | |||
750 | 750 | ||
751 | lpc_ich_finalize_cell(&lpc_ich_cells[LPC_GPIO], id); | 751 | lpc_ich_finalize_cell(&lpc_ich_cells[LPC_GPIO], id); |
752 | ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_GPIO], | 752 | ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_GPIO], |
753 | 1, NULL, 0); | 753 | 1, NULL, 0, NULL); |
754 | 754 | ||
755 | gpio_done: | 755 | gpio_done: |
756 | if (acpi_conflict) | 756 | if (acpi_conflict) |
@@ -765,7 +765,6 @@ static int __devinit lpc_ich_init_wdt(struct pci_dev *dev, | |||
765 | u32 base_addr_cfg; | 765 | u32 base_addr_cfg; |
766 | u32 base_addr; | 766 | u32 base_addr; |
767 | int ret; | 767 | int ret; |
768 | bool acpi_conflict = false; | ||
769 | struct resource *res; | 768 | struct resource *res; |
770 | 769 | ||
771 | /* Setup power management base register */ | 770 | /* Setup power management base register */ |
@@ -780,20 +779,11 @@ static int __devinit lpc_ich_init_wdt(struct pci_dev *dev, | |||
780 | res = wdt_io_res(ICH_RES_IO_TCO); | 779 | res = wdt_io_res(ICH_RES_IO_TCO); |
781 | res->start = base_addr + ACPIBASE_TCO_OFF; | 780 | res->start = base_addr + ACPIBASE_TCO_OFF; |
782 | res->end = base_addr + ACPIBASE_TCO_END; | 781 | res->end = base_addr + ACPIBASE_TCO_END; |
783 | ret = acpi_check_resource_conflict(res); | ||
784 | if (ret) { | ||
785 | acpi_conflict = true; | ||
786 | goto wdt_done; | ||
787 | } | ||
788 | 782 | ||
789 | res = wdt_io_res(ICH_RES_IO_SMI); | 783 | res = wdt_io_res(ICH_RES_IO_SMI); |
790 | res->start = base_addr + ACPIBASE_SMI_OFF; | 784 | res->start = base_addr + ACPIBASE_SMI_OFF; |
791 | res->end = base_addr + ACPIBASE_SMI_END; | 785 | res->end = base_addr + ACPIBASE_SMI_END; |
792 | ret = acpi_check_resource_conflict(res); | 786 | |
793 | if (ret) { | ||
794 | acpi_conflict = true; | ||
795 | goto wdt_done; | ||
796 | } | ||
797 | lpc_ich_enable_acpi_space(dev); | 787 | lpc_ich_enable_acpi_space(dev); |
798 | 788 | ||
799 | /* | 789 | /* |
@@ -813,21 +803,13 @@ static int __devinit lpc_ich_init_wdt(struct pci_dev *dev, | |||
813 | res = wdt_mem_res(ICH_RES_MEM_GCS); | 803 | res = wdt_mem_res(ICH_RES_MEM_GCS); |
814 | res->start = base_addr + ACPIBASE_GCS_OFF; | 804 | res->start = base_addr + ACPIBASE_GCS_OFF; |
815 | res->end = base_addr + ACPIBASE_GCS_END; | 805 | res->end = base_addr + ACPIBASE_GCS_END; |
816 | ret = acpi_check_resource_conflict(res); | ||
817 | if (ret) { | ||
818 | acpi_conflict = true; | ||
819 | goto wdt_done; | ||
820 | } | ||
821 | } | 806 | } |
822 | 807 | ||
823 | lpc_ich_finalize_cell(&lpc_ich_cells[LPC_WDT], id); | 808 | lpc_ich_finalize_cell(&lpc_ich_cells[LPC_WDT], id); |
824 | ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_WDT], | 809 | ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_WDT], |
825 | 1, NULL, 0); | 810 | 1, NULL, 0, NULL); |
826 | 811 | ||
827 | wdt_done: | 812 | wdt_done: |
828 | if (acpi_conflict) | ||
829 | pr_warn("Resource conflict(s) found affecting %s\n", | ||
830 | lpc_ich_cells[LPC_WDT].name); | ||
831 | return ret; | 813 | return ret; |
832 | } | 814 | } |
833 | 815 | ||
diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c index 9f20abc5e393..f6b9c5c96b24 100644 --- a/drivers/mfd/lpc_sch.c +++ b/drivers/mfd/lpc_sch.c | |||
@@ -127,7 +127,8 @@ static int __devinit lpc_sch_probe(struct pci_dev *dev, | |||
127 | lpc_sch_cells[i].id = id->device; | 127 | lpc_sch_cells[i].id = id->device; |
128 | 128 | ||
129 | ret = mfd_add_devices(&dev->dev, 0, | 129 | ret = mfd_add_devices(&dev->dev, 0, |
130 | lpc_sch_cells, ARRAY_SIZE(lpc_sch_cells), NULL, 0); | 130 | lpc_sch_cells, ARRAY_SIZE(lpc_sch_cells), NULL, |
131 | 0, NULL); | ||
131 | if (ret) | 132 | if (ret) |
132 | goto out_dev; | 133 | goto out_dev; |
133 | 134 | ||
@@ -153,7 +154,8 @@ static int __devinit lpc_sch_probe(struct pci_dev *dev, | |||
153 | tunnelcreek_cells[i].id = id->device; | 154 | tunnelcreek_cells[i].id = id->device; |
154 | 155 | ||
155 | ret = mfd_add_devices(&dev->dev, 0, tunnelcreek_cells, | 156 | ret = mfd_add_devices(&dev->dev, 0, tunnelcreek_cells, |
156 | ARRAY_SIZE(tunnelcreek_cells), NULL, 0); | 157 | ARRAY_SIZE(tunnelcreek_cells), NULL, |
158 | 0, NULL); | ||
157 | } | 159 | } |
158 | 160 | ||
159 | return ret; | 161 | return ret; |
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index c03e12b51924..d9e24c849a00 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c | |||
@@ -126,7 +126,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
126 | max77686_irq_init(max77686); | 126 | max77686_irq_init(max77686); |
127 | 127 | ||
128 | ret = mfd_add_devices(max77686->dev, -1, max77686_devs, | 128 | ret = mfd_add_devices(max77686->dev, -1, max77686_devs, |
129 | ARRAY_SIZE(max77686_devs), NULL, 0); | 129 | ARRAY_SIZE(max77686_devs), NULL, 0, NULL); |
130 | 130 | ||
131 | if (ret < 0) | 131 | if (ret < 0) |
132 | goto err_mfd; | 132 | goto err_mfd; |
diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c index 2b403569e0a6..1029d018c739 100644 --- a/drivers/mfd/max77693-irq.c +++ b/drivers/mfd/max77693-irq.c | |||
@@ -137,6 +137,9 @@ static void max77693_irq_mask(struct irq_data *data) | |||
137 | const struct max77693_irq_data *irq_data = | 137 | const struct max77693_irq_data *irq_data = |
138 | irq_to_max77693_irq(max77693, data->irq); | 138 | irq_to_max77693_irq(max77693, data->irq); |
139 | 139 | ||
140 | if (irq_data->group >= MAX77693_IRQ_GROUP_NR) | ||
141 | return; | ||
142 | |||
140 | if (irq_data->group >= MUIC_INT1 && irq_data->group <= MUIC_INT3) | 143 | if (irq_data->group >= MUIC_INT1 && irq_data->group <= MUIC_INT3) |
141 | max77693->irq_masks_cur[irq_data->group] &= ~irq_data->mask; | 144 | max77693->irq_masks_cur[irq_data->group] &= ~irq_data->mask; |
142 | else | 145 | else |
@@ -149,6 +152,9 @@ static void max77693_irq_unmask(struct irq_data *data) | |||
149 | const struct max77693_irq_data *irq_data = | 152 | const struct max77693_irq_data *irq_data = |
150 | irq_to_max77693_irq(max77693, data->irq); | 153 | irq_to_max77693_irq(max77693, data->irq); |
151 | 154 | ||
155 | if (irq_data->group >= MAX77693_IRQ_GROUP_NR) | ||
156 | return; | ||
157 | |||
152 | if (irq_data->group >= MUIC_INT1 && irq_data->group <= MUIC_INT3) | 158 | if (irq_data->group >= MUIC_INT1 && irq_data->group <= MUIC_INT3) |
153 | max77693->irq_masks_cur[irq_data->group] |= irq_data->mask; | 159 | max77693->irq_masks_cur[irq_data->group] |= irq_data->mask; |
154 | else | 160 | else |
@@ -200,7 +206,7 @@ static irqreturn_t max77693_irq_thread(int irq, void *data) | |||
200 | 206 | ||
201 | if (irq_src & MAX77693_IRQSRC_MUIC) | 207 | if (irq_src & MAX77693_IRQSRC_MUIC) |
202 | /* MUIC INT1 ~ INT3 */ | 208 | /* MUIC INT1 ~ INT3 */ |
203 | max77693_bulk_read(max77693->regmap, MAX77693_MUIC_REG_INT1, | 209 | max77693_bulk_read(max77693->regmap_muic, MAX77693_MUIC_REG_INT1, |
204 | MAX77693_NUM_IRQ_MUIC_REGS, &irq_reg[MUIC_INT1]); | 210 | MAX77693_NUM_IRQ_MUIC_REGS, &irq_reg[MUIC_INT1]); |
205 | 211 | ||
206 | /* Apply masking */ | 212 | /* Apply masking */ |
@@ -255,7 +261,8 @@ int max77693_irq_init(struct max77693_dev *max77693) | |||
255 | { | 261 | { |
256 | struct irq_domain *domain; | 262 | struct irq_domain *domain; |
257 | int i; | 263 | int i; |
258 | int ret; | 264 | int ret = 0; |
265 | u8 intsrc_mask; | ||
259 | 266 | ||
260 | mutex_init(&max77693->irqlock); | 267 | mutex_init(&max77693->irqlock); |
261 | 268 | ||
@@ -287,19 +294,38 @@ int max77693_irq_init(struct max77693_dev *max77693) | |||
287 | &max77693_irq_domain_ops, max77693); | 294 | &max77693_irq_domain_ops, max77693); |
288 | if (!domain) { | 295 | if (!domain) { |
289 | dev_err(max77693->dev, "could not create irq domain\n"); | 296 | dev_err(max77693->dev, "could not create irq domain\n"); |
290 | return -ENODEV; | 297 | ret = -ENODEV; |
298 | goto err_irq; | ||
291 | } | 299 | } |
292 | max77693->irq_domain = domain; | 300 | max77693->irq_domain = domain; |
293 | 301 | ||
302 | /* Unmask max77693 interrupt */ | ||
303 | ret = max77693_read_reg(max77693->regmap, | ||
304 | MAX77693_PMIC_REG_INTSRC_MASK, &intsrc_mask); | ||
305 | if (ret < 0) { | ||
306 | dev_err(max77693->dev, "fail to read PMIC register\n"); | ||
307 | goto err_irq; | ||
308 | } | ||
309 | |||
310 | intsrc_mask &= ~(MAX77693_IRQSRC_CHG); | ||
311 | intsrc_mask &= ~(MAX77693_IRQSRC_FLASH); | ||
312 | intsrc_mask &= ~(MAX77693_IRQSRC_MUIC); | ||
313 | ret = max77693_write_reg(max77693->regmap, | ||
314 | MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask); | ||
315 | if (ret < 0) { | ||
316 | dev_err(max77693->dev, "fail to write PMIC register\n"); | ||
317 | goto err_irq; | ||
318 | } | ||
319 | |||
294 | ret = request_threaded_irq(max77693->irq, NULL, max77693_irq_thread, | 320 | ret = request_threaded_irq(max77693->irq, NULL, max77693_irq_thread, |
295 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 321 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
296 | "max77693-irq", max77693); | 322 | "max77693-irq", max77693); |
297 | |||
298 | if (ret) | 323 | if (ret) |
299 | dev_err(max77693->dev, "Failed to request IRQ %d: %d\n", | 324 | dev_err(max77693->dev, "Failed to request IRQ %d: %d\n", |
300 | max77693->irq, ret); | 325 | max77693->irq, ret); |
301 | 326 | ||
302 | return 0; | 327 | err_irq: |
328 | return ret; | ||
303 | } | 329 | } |
304 | 330 | ||
305 | void max77693_irq_exit(struct max77693_dev *max77693) | 331 | void max77693_irq_exit(struct max77693_dev *max77693) |
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index a1811cb50ec7..cc5155e20494 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
@@ -152,6 +152,20 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
152 | max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); | 152 | max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); |
153 | i2c_set_clientdata(max77693->haptic, max77693); | 153 | i2c_set_clientdata(max77693->haptic, max77693); |
154 | 154 | ||
155 | /* | ||
156 | * Initialize register map for MUIC device because use regmap-muic | ||
157 | * instance of MUIC device when irq of max77693 is initialized | ||
158 | * before call max77693-muic probe() function. | ||
159 | */ | ||
160 | max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic, | ||
161 | &max77693_regmap_config); | ||
162 | if (IS_ERR(max77693->regmap_muic)) { | ||
163 | ret = PTR_ERR(max77693->regmap_muic); | ||
164 | dev_err(max77693->dev, | ||
165 | "failed to allocate register map: %d\n", ret); | ||
166 | goto err_regmap; | ||
167 | } | ||
168 | |||
155 | ret = max77693_irq_init(max77693); | 169 | ret = max77693_irq_init(max77693); |
156 | if (ret < 0) | 170 | if (ret < 0) |
157 | goto err_irq; | 171 | goto err_irq; |
@@ -159,7 +173,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
159 | pm_runtime_set_active(max77693->dev); | 173 | pm_runtime_set_active(max77693->dev); |
160 | 174 | ||
161 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, | 175 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, |
162 | ARRAY_SIZE(max77693_devs), NULL, 0); | 176 | ARRAY_SIZE(max77693_devs), NULL, 0, NULL); |
163 | if (ret < 0) | 177 | if (ret < 0) |
164 | goto err_mfd; | 178 | goto err_mfd; |
165 | 179 | ||
diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 825a7f06d9ba..ee53757beca7 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c | |||
@@ -598,7 +598,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, | |||
598 | 598 | ||
599 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], | 599 | ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], |
600 | ARRAY_SIZE(rtc_devs), | 600 | ARRAY_SIZE(rtc_devs), |
601 | &rtc_resources[0], chip->irq_base); | 601 | &rtc_resources[0], chip->irq_base, NULL); |
602 | if (ret < 0) { | 602 | if (ret < 0) { |
603 | dev_err(chip->dev, "Failed to add rtc subdev\n"); | 603 | dev_err(chip->dev, "Failed to add rtc subdev\n"); |
604 | goto out; | 604 | goto out; |
@@ -606,7 +606,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, | |||
606 | 606 | ||
607 | ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], | 607 | ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], |
608 | ARRAY_SIZE(onkey_devs), | 608 | ARRAY_SIZE(onkey_devs), |
609 | &onkey_resources[0], 0); | 609 | &onkey_resources[0], 0, NULL); |
610 | if (ret < 0) { | 610 | if (ret < 0) { |
611 | dev_err(chip->dev, "Failed to add onkey subdev\n"); | 611 | dev_err(chip->dev, "Failed to add onkey subdev\n"); |
612 | goto out_dev; | 612 | goto out_dev; |
@@ -615,7 +615,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, | |||
615 | if (pdata) { | 615 | if (pdata) { |
616 | ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[0], | 616 | ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[0], |
617 | ARRAY_SIZE(regulator_devs), | 617 | ARRAY_SIZE(regulator_devs), |
618 | ®ulator_resources[0], 0); | 618 | ®ulator_resources[0], 0, NULL); |
619 | if (ret < 0) { | 619 | if (ret < 0) { |
620 | dev_err(chip->dev, "Failed to add regulator subdev\n"); | 620 | dev_err(chip->dev, "Failed to add regulator subdev\n"); |
621 | goto out_dev; | 621 | goto out_dev; |
@@ -625,7 +625,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, | |||
625 | if (pdata && pdata->backlight) { | 625 | if (pdata && pdata->backlight) { |
626 | ret = mfd_add_devices(chip->dev, 0, &backlight_devs[0], | 626 | ret = mfd_add_devices(chip->dev, 0, &backlight_devs[0], |
627 | ARRAY_SIZE(backlight_devs), | 627 | ARRAY_SIZE(backlight_devs), |
628 | &backlight_resources[0], 0); | 628 | &backlight_resources[0], 0, NULL); |
629 | if (ret < 0) { | 629 | if (ret < 0) { |
630 | dev_err(chip->dev, "Failed to add backlight subdev\n"); | 630 | dev_err(chip->dev, "Failed to add backlight subdev\n"); |
631 | goto out_dev; | 631 | goto out_dev; |
@@ -635,7 +635,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, | |||
635 | if (pdata && pdata->power) { | 635 | if (pdata && pdata->power) { |
636 | ret = mfd_add_devices(chip->dev, 0, &power_devs[0], | 636 | ret = mfd_add_devices(chip->dev, 0, &power_devs[0], |
637 | ARRAY_SIZE(power_devs), | 637 | ARRAY_SIZE(power_devs), |
638 | &power_supply_resources[0], 0); | 638 | &power_supply_resources[0], 0, NULL); |
639 | if (ret < 0) { | 639 | if (ret < 0) { |
640 | dev_err(chip->dev, "Failed to add power supply " | 640 | dev_err(chip->dev, "Failed to add power supply " |
641 | "subdev\n"); | 641 | "subdev\n"); |
@@ -646,7 +646,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, | |||
646 | if (pdata && pdata->touch) { | 646 | if (pdata && pdata->touch) { |
647 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], | 647 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], |
648 | ARRAY_SIZE(touch_devs), | 648 | ARRAY_SIZE(touch_devs), |
649 | &touch_resources[0], 0); | 649 | &touch_resources[0], 0, NULL); |
650 | if (ret < 0) { | 650 | if (ret < 0) { |
651 | dev_err(chip->dev, "Failed to add touch subdev\n"); | 651 | dev_err(chip->dev, "Failed to add touch subdev\n"); |
652 | goto out_dev; | 652 | goto out_dev; |
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 10b629c245b6..f123517065ec 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -160,7 +160,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
160 | 160 | ||
161 | mfd_add_devices(max8997->dev, -1, max8997_devs, | 161 | mfd_add_devices(max8997->dev, -1, max8997_devs, |
162 | ARRAY_SIZE(max8997_devs), | 162 | ARRAY_SIZE(max8997_devs), |
163 | NULL, 0); | 163 | NULL, 0, NULL); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * TODO: enable others (flash, muic, rtc, battery, ...) and | 166 | * TODO: enable others (flash, muic, rtc, battery, ...) and |
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 6ef56d28c056..d7218cc90945 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c | |||
@@ -161,13 +161,13 @@ static int max8998_i2c_probe(struct i2c_client *i2c, | |||
161 | switch (id->driver_data) { | 161 | switch (id->driver_data) { |
162 | case TYPE_LP3974: | 162 | case TYPE_LP3974: |
163 | ret = mfd_add_devices(max8998->dev, -1, | 163 | ret = mfd_add_devices(max8998->dev, -1, |
164 | lp3974_devs, ARRAY_SIZE(lp3974_devs), | 164 | lp3974_devs, ARRAY_SIZE(lp3974_devs), |
165 | NULL, 0); | 165 | NULL, 0, NULL); |
166 | break; | 166 | break; |
167 | case TYPE_MAX8998: | 167 | case TYPE_MAX8998: |
168 | ret = mfd_add_devices(max8998->dev, -1, | 168 | ret = mfd_add_devices(max8998->dev, -1, |
169 | max8998_devs, ARRAY_SIZE(max8998_devs), | 169 | max8998_devs, ARRAY_SIZE(max8998_devs), |
170 | NULL, 0); | 170 | NULL, 0, NULL); |
171 | break; | 171 | break; |
172 | default: | 172 | default: |
173 | ret = -EINVAL; | 173 | ret = -EINVAL; |
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index b801dc72f041..1ec79b54bd2f 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c | |||
@@ -612,7 +612,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx, | |||
612 | if (!cell.name) | 612 | if (!cell.name) |
613 | return -ENOMEM; | 613 | return -ENOMEM; |
614 | 614 | ||
615 | return mfd_add_devices(mc13xxx->dev, -1, &cell, 1, NULL, 0); | 615 | return mfd_add_devices(mc13xxx->dev, -1, &cell, 1, NULL, 0, NULL); |
616 | } | 616 | } |
617 | 617 | ||
618 | static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format) | 618 | static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format) |
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 0c3a01cde2f7..f8b77711ad2d 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -74,12 +74,11 @@ static int mfd_platform_add_cell(struct platform_device *pdev, | |||
74 | static int mfd_add_device(struct device *parent, int id, | 74 | static int mfd_add_device(struct device *parent, int id, |
75 | const struct mfd_cell *cell, | 75 | const struct mfd_cell *cell, |
76 | struct resource *mem_base, | 76 | struct resource *mem_base, |
77 | int irq_base) | 77 | int irq_base, struct irq_domain *domain) |
78 | { | 78 | { |
79 | struct resource *res; | 79 | struct resource *res; |
80 | struct platform_device *pdev; | 80 | struct platform_device *pdev; |
81 | struct device_node *np = NULL; | 81 | struct device_node *np = NULL; |
82 | struct irq_domain *domain = NULL; | ||
83 | int ret = -ENOMEM; | 82 | int ret = -ENOMEM; |
84 | int r; | 83 | int r; |
85 | 84 | ||
@@ -97,7 +96,6 @@ static int mfd_add_device(struct device *parent, int id, | |||
97 | for_each_child_of_node(parent->of_node, np) { | 96 | for_each_child_of_node(parent->of_node, np) { |
98 | if (of_device_is_compatible(np, cell->of_compatible)) { | 97 | if (of_device_is_compatible(np, cell->of_compatible)) { |
99 | pdev->dev.of_node = np; | 98 | pdev->dev.of_node = np; |
100 | domain = irq_find_host(parent->of_node); | ||
101 | break; | 99 | break; |
102 | } | 100 | } |
103 | } | 101 | } |
@@ -177,7 +175,7 @@ fail_alloc: | |||
177 | int mfd_add_devices(struct device *parent, int id, | 175 | int mfd_add_devices(struct device *parent, int id, |
178 | struct mfd_cell *cells, int n_devs, | 176 | struct mfd_cell *cells, int n_devs, |
179 | struct resource *mem_base, | 177 | struct resource *mem_base, |
180 | int irq_base) | 178 | int irq_base, struct irq_domain *domain) |
181 | { | 179 | { |
182 | int i; | 180 | int i; |
183 | int ret = 0; | 181 | int ret = 0; |
@@ -191,7 +189,8 @@ int mfd_add_devices(struct device *parent, int id, | |||
191 | for (i = 0; i < n_devs; i++) { | 189 | for (i = 0; i < n_devs; i++) { |
192 | atomic_set(&cnts[i], 0); | 190 | atomic_set(&cnts[i], 0); |
193 | cells[i].usage_count = &cnts[i]; | 191 | cells[i].usage_count = &cnts[i]; |
194 | ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base); | 192 | ret = mfd_add_device(parent, id, cells + i, mem_base, |
193 | irq_base, domain); | ||
195 | if (ret) | 194 | if (ret) |
196 | break; | 195 | break; |
197 | } | 196 | } |
@@ -247,7 +246,8 @@ int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones) | |||
247 | for (i = 0; i < n_clones; i++) { | 246 | for (i = 0; i < n_clones; i++) { |
248 | cell_entry.name = clones[i]; | 247 | cell_entry.name = clones[i]; |
249 | /* don't give up if a single call fails; just report error */ | 248 | /* don't give up if a single call fails; just report error */ |
250 | if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0)) | 249 | if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0, |
250 | NULL)) | ||
251 | dev_err(dev, "failed to create platform device '%s'\n", | 251 | dev_err(dev, "failed to create platform device '%s'\n", |
252 | clones[i]); | 252 | clones[i]); |
253 | } | 253 | } |
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index c4a69f193a1d..a345f9bb7b47 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -453,7 +453,8 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c, | |||
453 | 453 | ||
454 | ret = mfd_add_devices(palmas->dev, -1, | 454 | ret = mfd_add_devices(palmas->dev, -1, |
455 | children, ARRAY_SIZE(palmas_children), | 455 | children, ARRAY_SIZE(palmas_children), |
456 | NULL, regmap_irq_chip_get_base(palmas->irq_data)); | 456 | NULL, regmap_irq_chip_get_base(palmas->irq_data), |
457 | NULL); | ||
457 | kfree(children); | 458 | kfree(children); |
458 | 459 | ||
459 | if (ret < 0) | 460 | if (ret < 0) |
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index cdc1df7fa0e9..3a8fa88567b1 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c | |||
@@ -289,7 +289,7 @@ static int __devinit rc5t583_i2c_probe(struct i2c_client *i2c, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | ret = mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs, | 291 | ret = mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs, |
292 | ARRAY_SIZE(rc5t583_subdevs), NULL, 0); | 292 | ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL); |
293 | if (ret) { | 293 | if (ret) { |
294 | dev_err(&i2c->dev, "add mfd devices failed: %d\n", ret); | 294 | dev_err(&i2c->dev, "add mfd devices failed: %d\n", ret); |
295 | goto err_add_devs; | 295 | goto err_add_devs; |
diff --git a/drivers/mfd/rdc321x-southbridge.c b/drivers/mfd/rdc321x-southbridge.c index 685d61e431ad..0f70dce61160 100644 --- a/drivers/mfd/rdc321x-southbridge.c +++ b/drivers/mfd/rdc321x-southbridge.c | |||
@@ -87,7 +87,8 @@ static int __devinit rdc321x_sb_probe(struct pci_dev *pdev, | |||
87 | rdc321x_wdt_pdata.sb_pdev = pdev; | 87 | rdc321x_wdt_pdata.sb_pdev = pdev; |
88 | 88 | ||
89 | return mfd_add_devices(&pdev->dev, -1, | 89 | return mfd_add_devices(&pdev->dev, -1, |
90 | rdc321x_sb_cells, ARRAY_SIZE(rdc321x_sb_cells), NULL, 0); | 90 | rdc321x_sb_cells, ARRAY_SIZE(rdc321x_sb_cells), |
91 | NULL, 0, NULL); | ||
91 | } | 92 | } |
92 | 93 | ||
93 | static void __devexit rdc321x_sb_remove(struct pci_dev *pdev) | 94 | static void __devexit rdc321x_sb_remove(struct pci_dev *pdev) |
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 2988efde11eb..49d361a618d0 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -141,19 +141,19 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
141 | switch (sec_pmic->device_type) { | 141 | switch (sec_pmic->device_type) { |
142 | case S5M8751X: | 142 | case S5M8751X: |
143 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8751_devs, | 143 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8751_devs, |
144 | ARRAY_SIZE(s5m8751_devs), NULL, 0); | 144 | ARRAY_SIZE(s5m8751_devs), NULL, 0, NULL); |
145 | break; | 145 | break; |
146 | case S5M8763X: | 146 | case S5M8763X: |
147 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8763_devs, | 147 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8763_devs, |
148 | ARRAY_SIZE(s5m8763_devs), NULL, 0); | 148 | ARRAY_SIZE(s5m8763_devs), NULL, 0, NULL); |
149 | break; | 149 | break; |
150 | case S5M8767X: | 150 | case S5M8767X: |
151 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8767_devs, | 151 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8767_devs, |
152 | ARRAY_SIZE(s5m8767_devs), NULL, 0); | 152 | ARRAY_SIZE(s5m8767_devs), NULL, 0, NULL); |
153 | break; | 153 | break; |
154 | case S2MPS11X: | 154 | case S2MPS11X: |
155 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, | 155 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, |
156 | ARRAY_SIZE(s2mps11_devs), NULL, 0); | 156 | ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); |
157 | break; | 157 | break; |
158 | default: | 158 | default: |
159 | /* If this happens the probe function is problem */ | 159 | /* If this happens the probe function is problem */ |
diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c index d31fed07aefb..d35da6820bea 100644 --- a/drivers/mfd/sta2x11-mfd.c +++ b/drivers/mfd/sta2x11-mfd.c | |||
@@ -407,7 +407,7 @@ static int __devinit sta2x11_mfd_probe(struct pci_dev *pdev, | |||
407 | sta2x11_mfd_bar0, | 407 | sta2x11_mfd_bar0, |
408 | ARRAY_SIZE(sta2x11_mfd_bar0), | 408 | ARRAY_SIZE(sta2x11_mfd_bar0), |
409 | &pdev->resource[0], | 409 | &pdev->resource[0], |
410 | 0); | 410 | 0, NULL); |
411 | if (err) { | 411 | if (err) { |
412 | dev_err(&pdev->dev, "mfd_add_devices[0] failed: %d\n", err); | 412 | dev_err(&pdev->dev, "mfd_add_devices[0] failed: %d\n", err); |
413 | goto err_disable; | 413 | goto err_disable; |
@@ -417,7 +417,7 @@ static int __devinit sta2x11_mfd_probe(struct pci_dev *pdev, | |||
417 | sta2x11_mfd_bar1, | 417 | sta2x11_mfd_bar1, |
418 | ARRAY_SIZE(sta2x11_mfd_bar1), | 418 | ARRAY_SIZE(sta2x11_mfd_bar1), |
419 | &pdev->resource[1], | 419 | &pdev->resource[1], |
420 | 0); | 420 | 0, NULL); |
421 | if (err) { | 421 | if (err) { |
422 | dev_err(&pdev->dev, "mfd_add_devices[1] failed: %d\n", err); | 422 | dev_err(&pdev->dev, "mfd_add_devices[1] failed: %d\n", err); |
423 | goto err_disable; | 423 | goto err_disable; |
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 2dd8d49cb30b..c94f521f392c 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c | |||
@@ -962,7 +962,7 @@ static int __devinit stmpe_add_device(struct stmpe *stmpe, | |||
962 | struct mfd_cell *cell, int irq) | 962 | struct mfd_cell *cell, int irq) |
963 | { | 963 | { |
964 | return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, | 964 | return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, |
965 | NULL, stmpe->irq_base + irq); | 965 | NULL, stmpe->irq_base + irq, NULL); |
966 | } | 966 | } |
967 | 967 | ||
968 | static int __devinit stmpe_devices_init(struct stmpe *stmpe) | 968 | static int __devinit stmpe_devices_init(struct stmpe *stmpe) |
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 2d9e8799e733..b32940ec9034 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c | |||
@@ -388,7 +388,7 @@ static int t7l66xb_probe(struct platform_device *dev) | |||
388 | 388 | ||
389 | ret = mfd_add_devices(&dev->dev, dev->id, | 389 | ret = mfd_add_devices(&dev->dev, dev->id, |
390 | t7l66xb_cells, ARRAY_SIZE(t7l66xb_cells), | 390 | t7l66xb_cells, ARRAY_SIZE(t7l66xb_cells), |
391 | iomem, t7l66xb->irq_base); | 391 | iomem, t7l66xb->irq_base, NULL); |
392 | 392 | ||
393 | if (!ret) | 393 | if (!ret) |
394 | return 0; | 394 | return 0; |
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 048bf0532a09..b56ba6b43294 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c | |||
@@ -262,8 +262,8 @@ static int __devinit tc3589x_device_init(struct tc3589x *tc3589x) | |||
262 | 262 | ||
263 | if (blocks & TC3589x_BLOCK_GPIO) { | 263 | if (blocks & TC3589x_BLOCK_GPIO) { |
264 | ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio, | 264 | ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio, |
265 | ARRAY_SIZE(tc3589x_dev_gpio), NULL, | 265 | ARRAY_SIZE(tc3589x_dev_gpio), NULL, |
266 | tc3589x->irq_base); | 266 | tc3589x->irq_base, NULL); |
267 | if (ret) { | 267 | if (ret) { |
268 | dev_err(tc3589x->dev, "failed to add gpio child\n"); | 268 | dev_err(tc3589x->dev, "failed to add gpio child\n"); |
269 | return ret; | 269 | return ret; |
@@ -273,8 +273,8 @@ static int __devinit tc3589x_device_init(struct tc3589x *tc3589x) | |||
273 | 273 | ||
274 | if (blocks & TC3589x_BLOCK_KEYPAD) { | 274 | if (blocks & TC3589x_BLOCK_KEYPAD) { |
275 | ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad, | 275 | ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad, |
276 | ARRAY_SIZE(tc3589x_dev_keypad), NULL, | 276 | ARRAY_SIZE(tc3589x_dev_keypad), NULL, |
277 | tc3589x->irq_base); | 277 | tc3589x->irq_base, NULL); |
278 | if (ret) { | 278 | if (ret) { |
279 | dev_err(tc3589x->dev, "failed to keypad child\n"); | 279 | dev_err(tc3589x->dev, "failed to keypad child\n"); |
280 | return ret; | 280 | return ret; |
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c index d20a284ad4ba..413c891102f8 100644 --- a/drivers/mfd/tc6387xb.c +++ b/drivers/mfd/tc6387xb.c | |||
@@ -192,7 +192,7 @@ static int __devinit tc6387xb_probe(struct platform_device *dev) | |||
192 | printk(KERN_INFO "Toshiba tc6387xb initialised\n"); | 192 | printk(KERN_INFO "Toshiba tc6387xb initialised\n"); |
193 | 193 | ||
194 | ret = mfd_add_devices(&dev->dev, dev->id, tc6387xb_cells, | 194 | ret = mfd_add_devices(&dev->dev, dev->id, tc6387xb_cells, |
195 | ARRAY_SIZE(tc6387xb_cells), iomem, irq); | 195 | ARRAY_SIZE(tc6387xb_cells), iomem, irq, NULL); |
196 | 196 | ||
197 | if (!ret) | 197 | if (!ret) |
198 | return 0; | 198 | return 0; |
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 9612264f0e6d..dcab026fcbb2 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -700,8 +700,8 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
700 | tc6393xb_cells[TC6393XB_CELL_FB].pdata_size = sizeof(*tcpd->fb_data); | 700 | tc6393xb_cells[TC6393XB_CELL_FB].pdata_size = sizeof(*tcpd->fb_data); |
701 | 701 | ||
702 | ret = mfd_add_devices(&dev->dev, dev->id, | 702 | ret = mfd_add_devices(&dev->dev, dev->id, |
703 | tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), | 703 | tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), |
704 | iomem, tcpd->irq_base); | 704 | iomem, tcpd->irq_base, NULL); |
705 | 705 | ||
706 | if (!ret) | 706 | if (!ret) |
707 | return 0; | 707 | return 0; |
diff --git a/drivers/mfd/ti-ssp.c b/drivers/mfd/ti-ssp.c index 4fb0e6c8e8fe..7c3675a74f93 100644 --- a/drivers/mfd/ti-ssp.c +++ b/drivers/mfd/ti-ssp.c | |||
@@ -412,7 +412,7 @@ static int __devinit ti_ssp_probe(struct platform_device *pdev) | |||
412 | cells[id].data_size = data->pdata_size; | 412 | cells[id].data_size = data->pdata_size; |
413 | } | 413 | } |
414 | 414 | ||
415 | error = mfd_add_devices(dev, 0, cells, 2, NULL, 0); | 415 | error = mfd_add_devices(dev, 0, cells, 2, NULL, 0, NULL); |
416 | if (error < 0) { | 416 | if (error < 0) { |
417 | dev_err(dev, "cannot add mfd cells\n"); | 417 | dev_err(dev, "cannot add mfd cells\n"); |
418 | goto error_enable; | 418 | goto error_enable; |
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index a447f4ec11fb..cccc626c83c8 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c | |||
@@ -757,25 +757,25 @@ static int __devinit timb_probe(struct pci_dev *dev, | |||
757 | err = mfd_add_devices(&dev->dev, -1, | 757 | err = mfd_add_devices(&dev->dev, -1, |
758 | timberdale_cells_bar0_cfg0, | 758 | timberdale_cells_bar0_cfg0, |
759 | ARRAY_SIZE(timberdale_cells_bar0_cfg0), | 759 | ARRAY_SIZE(timberdale_cells_bar0_cfg0), |
760 | &dev->resource[0], msix_entries[0].vector); | 760 | &dev->resource[0], msix_entries[0].vector, NULL); |
761 | break; | 761 | break; |
762 | case TIMB_HW_VER1: | 762 | case TIMB_HW_VER1: |
763 | err = mfd_add_devices(&dev->dev, -1, | 763 | err = mfd_add_devices(&dev->dev, -1, |
764 | timberdale_cells_bar0_cfg1, | 764 | timberdale_cells_bar0_cfg1, |
765 | ARRAY_SIZE(timberdale_cells_bar0_cfg1), | 765 | ARRAY_SIZE(timberdale_cells_bar0_cfg1), |
766 | &dev->resource[0], msix_entries[0].vector); | 766 | &dev->resource[0], msix_entries[0].vector, NULL); |
767 | break; | 767 | break; |
768 | case TIMB_HW_VER2: | 768 | case TIMB_HW_VER2: |
769 | err = mfd_add_devices(&dev->dev, -1, | 769 | err = mfd_add_devices(&dev->dev, -1, |
770 | timberdale_cells_bar0_cfg2, | 770 | timberdale_cells_bar0_cfg2, |
771 | ARRAY_SIZE(timberdale_cells_bar0_cfg2), | 771 | ARRAY_SIZE(timberdale_cells_bar0_cfg2), |
772 | &dev->resource[0], msix_entries[0].vector); | 772 | &dev->resource[0], msix_entries[0].vector, NULL); |
773 | break; | 773 | break; |
774 | case TIMB_HW_VER3: | 774 | case TIMB_HW_VER3: |
775 | err = mfd_add_devices(&dev->dev, -1, | 775 | err = mfd_add_devices(&dev->dev, -1, |
776 | timberdale_cells_bar0_cfg3, | 776 | timberdale_cells_bar0_cfg3, |
777 | ARRAY_SIZE(timberdale_cells_bar0_cfg3), | 777 | ARRAY_SIZE(timberdale_cells_bar0_cfg3), |
778 | &dev->resource[0], msix_entries[0].vector); | 778 | &dev->resource[0], msix_entries[0].vector, NULL); |
779 | break; | 779 | break; |
780 | default: | 780 | default: |
781 | dev_err(&dev->dev, "Uknown IP setup: %d.%d.%d\n", | 781 | dev_err(&dev->dev, "Uknown IP setup: %d.%d.%d\n", |
@@ -792,7 +792,7 @@ static int __devinit timb_probe(struct pci_dev *dev, | |||
792 | 792 | ||
793 | err = mfd_add_devices(&dev->dev, 0, | 793 | err = mfd_add_devices(&dev->dev, 0, |
794 | timberdale_cells_bar1, ARRAY_SIZE(timberdale_cells_bar1), | 794 | timberdale_cells_bar1, ARRAY_SIZE(timberdale_cells_bar1), |
795 | &dev->resource[1], msix_entries[0].vector); | 795 | &dev->resource[1], msix_entries[0].vector, NULL); |
796 | if (err) { | 796 | if (err) { |
797 | dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err); | 797 | dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err); |
798 | goto err_mfd2; | 798 | goto err_mfd2; |
@@ -803,7 +803,7 @@ static int __devinit timb_probe(struct pci_dev *dev, | |||
803 | ((priv->fw.config & TIMB_HW_VER_MASK) == TIMB_HW_VER3)) { | 803 | ((priv->fw.config & TIMB_HW_VER_MASK) == TIMB_HW_VER3)) { |
804 | err = mfd_add_devices(&dev->dev, 1, timberdale_cells_bar2, | 804 | err = mfd_add_devices(&dev->dev, 1, timberdale_cells_bar2, |
805 | ARRAY_SIZE(timberdale_cells_bar2), | 805 | ARRAY_SIZE(timberdale_cells_bar2), |
806 | &dev->resource[2], msix_entries[0].vector); | 806 | &dev->resource[2], msix_entries[0].vector, NULL); |
807 | if (err) { | 807 | if (err) { |
808 | dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err); | 808 | dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err); |
809 | goto err_mfd2; | 809 | goto err_mfd2; |
diff --git a/drivers/mfd/tps6105x.c b/drivers/mfd/tps6105x.c index a293b978e27c..14051bdc714b 100644 --- a/drivers/mfd/tps6105x.c +++ b/drivers/mfd/tps6105x.c | |||
@@ -188,7 +188,7 @@ static int __devinit tps6105x_probe(struct i2c_client *client, | |||
188 | } | 188 | } |
189 | 189 | ||
190 | ret = mfd_add_devices(&client->dev, 0, tps6105x_cells, | 190 | ret = mfd_add_devices(&client->dev, 0, tps6105x_cells, |
191 | ARRAY_SIZE(tps6105x_cells), NULL, 0); | 191 | ARRAY_SIZE(tps6105x_cells), NULL, 0, NULL); |
192 | if (ret) | 192 | if (ret) |
193 | goto fail; | 193 | goto fail; |
194 | 194 | ||
diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index 33ba7723c967..1b203499c744 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c | |||
@@ -100,7 +100,7 @@ static int tps6507x_i2c_probe(struct i2c_client *i2c, | |||
100 | 100 | ||
101 | ret = mfd_add_devices(tps6507x->dev, -1, | 101 | ret = mfd_add_devices(tps6507x->dev, -1, |
102 | tps6507x_devs, ARRAY_SIZE(tps6507x_devs), | 102 | tps6507x_devs, ARRAY_SIZE(tps6507x_devs), |
103 | NULL, 0); | 103 | NULL, 0, NULL); |
104 | 104 | ||
105 | if (ret < 0) | 105 | if (ret < 0) |
106 | goto err; | 106 | goto err; |
diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c index 80e24f4b47bf..50fd87c87a1c 100644 --- a/drivers/mfd/tps65090.c +++ b/drivers/mfd/tps65090.c | |||
@@ -292,7 +292,7 @@ static int __devinit tps65090_i2c_probe(struct i2c_client *client, | |||
292 | } | 292 | } |
293 | 293 | ||
294 | ret = mfd_add_devices(tps65090->dev, -1, tps65090s, | 294 | ret = mfd_add_devices(tps65090->dev, -1, tps65090s, |
295 | ARRAY_SIZE(tps65090s), NULL, 0); | 295 | ARRAY_SIZE(tps65090s), NULL, 0, NULL); |
296 | if (ret) { | 296 | if (ret) { |
297 | dev_err(&client->dev, "add mfd devices failed with err: %d\n", | 297 | dev_err(&client->dev, "add mfd devices failed with err: %d\n", |
298 | ret); | 298 | ret); |
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 61c097a98f5d..a95e9421b735 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c | |||
@@ -24,11 +24,18 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/regmap.h> | 25 | #include <linux/regmap.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/regulator/of_regulator.h> | 27 | #include <linux/of.h> |
28 | #include <linux/of_device.h> | ||
28 | 29 | ||
29 | #include <linux/mfd/core.h> | 30 | #include <linux/mfd/core.h> |
30 | #include <linux/mfd/tps65217.h> | 31 | #include <linux/mfd/tps65217.h> |
31 | 32 | ||
33 | static struct mfd_cell tps65217s[] = { | ||
34 | { | ||
35 | .name = "tps65217-pmic", | ||
36 | }, | ||
37 | }; | ||
38 | |||
32 | /** | 39 | /** |
33 | * tps65217_reg_read: Read a single tps65217 register. | 40 | * tps65217_reg_read: Read a single tps65217 register. |
34 | * | 41 | * |
@@ -133,83 +140,48 @@ int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg, | |||
133 | } | 140 | } |
134 | EXPORT_SYMBOL_GPL(tps65217_clear_bits); | 141 | EXPORT_SYMBOL_GPL(tps65217_clear_bits); |
135 | 142 | ||
136 | #ifdef CONFIG_OF | ||
137 | static struct of_regulator_match reg_matches[] = { | ||
138 | { .name = "dcdc1", .driver_data = (void *)TPS65217_DCDC_1 }, | ||
139 | { .name = "dcdc2", .driver_data = (void *)TPS65217_DCDC_2 }, | ||
140 | { .name = "dcdc3", .driver_data = (void *)TPS65217_DCDC_3 }, | ||
141 | { .name = "ldo1", .driver_data = (void *)TPS65217_LDO_1 }, | ||
142 | { .name = "ldo2", .driver_data = (void *)TPS65217_LDO_2 }, | ||
143 | { .name = "ldo3", .driver_data = (void *)TPS65217_LDO_3 }, | ||
144 | { .name = "ldo4", .driver_data = (void *)TPS65217_LDO_4 }, | ||
145 | }; | ||
146 | |||
147 | static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) | ||
148 | { | ||
149 | struct device_node *node = client->dev.of_node; | ||
150 | struct tps65217_board *pdata; | ||
151 | struct device_node *regs; | ||
152 | int count = ARRAY_SIZE(reg_matches); | ||
153 | int ret, i; | ||
154 | |||
155 | regs = of_find_node_by_name(node, "regulators"); | ||
156 | if (!regs) | ||
157 | return NULL; | ||
158 | |||
159 | ret = of_regulator_match(&client->dev, regs, reg_matches, count); | ||
160 | of_node_put(regs); | ||
161 | if ((ret < 0) || (ret > count)) | ||
162 | return NULL; | ||
163 | |||
164 | count = ret; | ||
165 | pdata = devm_kzalloc(&client->dev, count * sizeof(*pdata), GFP_KERNEL); | ||
166 | if (!pdata) | ||
167 | return NULL; | ||
168 | |||
169 | for (i = 0; i < count; i++) { | ||
170 | if (!reg_matches[i].init_data || !reg_matches[i].of_node) | ||
171 | continue; | ||
172 | |||
173 | pdata->tps65217_init_data[i] = reg_matches[i].init_data; | ||
174 | pdata->of_node[i] = reg_matches[i].of_node; | ||
175 | } | ||
176 | |||
177 | return pdata; | ||
178 | } | ||
179 | |||
180 | static struct of_device_id tps65217_of_match[] = { | ||
181 | { .compatible = "ti,tps65217", }, | ||
182 | { }, | ||
183 | }; | ||
184 | #else | ||
185 | static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) | ||
186 | { | ||
187 | return NULL; | ||
188 | } | ||
189 | #endif | ||
190 | |||
191 | static struct regmap_config tps65217_regmap_config = { | 143 | static struct regmap_config tps65217_regmap_config = { |
192 | .reg_bits = 8, | 144 | .reg_bits = 8, |
193 | .val_bits = 8, | 145 | .val_bits = 8, |
194 | }; | 146 | }; |
195 | 147 | ||
148 | static const struct of_device_id tps65217_of_match[] = { | ||
149 | { .compatible = "ti,tps65217", .data = (void *)TPS65217 }, | ||
150 | { /* sentinel */ }, | ||
151 | }; | ||
152 | |||
196 | static int __devinit tps65217_probe(struct i2c_client *client, | 153 | static int __devinit tps65217_probe(struct i2c_client *client, |
197 | const struct i2c_device_id *ids) | 154 | const struct i2c_device_id *ids) |
198 | { | 155 | { |
199 | struct tps65217 *tps; | 156 | struct tps65217 *tps; |
200 | struct regulator_init_data *reg_data; | ||
201 | struct tps65217_board *pdata = client->dev.platform_data; | ||
202 | int i, ret; | ||
203 | unsigned int version; | 157 | unsigned int version; |
158 | unsigned int chip_id = ids->driver_data; | ||
159 | const struct of_device_id *match; | ||
160 | int ret; | ||
204 | 161 | ||
205 | if (!pdata && client->dev.of_node) | 162 | if (client->dev.of_node) { |
206 | pdata = tps65217_parse_dt(client); | 163 | match = of_match_device(tps65217_of_match, &client->dev); |
164 | if (!match) { | ||
165 | dev_err(&client->dev, | ||
166 | "Failed to find matching dt id\n"); | ||
167 | return -EINVAL; | ||
168 | } | ||
169 | chip_id = (unsigned int)match->data; | ||
170 | } | ||
171 | |||
172 | if (!chip_id) { | ||
173 | dev_err(&client->dev, "id is null.\n"); | ||
174 | return -ENODEV; | ||
175 | } | ||
207 | 176 | ||
208 | tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); | 177 | tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); |
209 | if (!tps) | 178 | if (!tps) |
210 | return -ENOMEM; | 179 | return -ENOMEM; |
211 | 180 | ||
212 | tps->pdata = pdata; | 181 | i2c_set_clientdata(client, tps); |
182 | tps->dev = &client->dev; | ||
183 | tps->id = chip_id; | ||
184 | |||
213 | tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); | 185 | tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); |
214 | if (IS_ERR(tps->regmap)) { | 186 | if (IS_ERR(tps->regmap)) { |
215 | ret = PTR_ERR(tps->regmap); | 187 | ret = PTR_ERR(tps->regmap); |
@@ -218,8 +190,12 @@ static int __devinit tps65217_probe(struct i2c_client *client, | |||
218 | return ret; | 190 | return ret; |
219 | } | 191 | } |
220 | 192 | ||
221 | i2c_set_clientdata(client, tps); | 193 | ret = mfd_add_devices(tps->dev, -1, tps65217s, |
222 | tps->dev = &client->dev; | 194 | ARRAY_SIZE(tps65217s), NULL, 0, NULL); |
195 | if (ret < 0) { | ||
196 | dev_err(tps->dev, "mfd_add_devices failed: %d\n", ret); | ||
197 | return ret; | ||
198 | } | ||
223 | 199 | ||
224 | ret = tps65217_reg_read(tps, TPS65217_REG_CHIPID, &version); | 200 | ret = tps65217_reg_read(tps, TPS65217_REG_CHIPID, &version); |
225 | if (ret < 0) { | 201 | if (ret < 0) { |
@@ -232,41 +208,21 @@ static int __devinit tps65217_probe(struct i2c_client *client, | |||
232 | (version & TPS65217_CHIPID_CHIP_MASK) >> 4, | 208 | (version & TPS65217_CHIPID_CHIP_MASK) >> 4, |
233 | version & TPS65217_CHIPID_REV_MASK); | 209 | version & TPS65217_CHIPID_REV_MASK); |
234 | 210 | ||
235 | for (i = 0; i < TPS65217_NUM_REGULATOR; i++) { | ||
236 | struct platform_device *pdev; | ||
237 | |||
238 | pdev = platform_device_alloc("tps65217-pmic", i); | ||
239 | if (!pdev) { | ||
240 | dev_err(tps->dev, "Cannot create regulator %d\n", i); | ||
241 | continue; | ||
242 | } | ||
243 | |||
244 | pdev->dev.parent = tps->dev; | ||
245 | pdev->dev.of_node = pdata->of_node[i]; | ||
246 | reg_data = pdata->tps65217_init_data[i]; | ||
247 | platform_device_add_data(pdev, reg_data, sizeof(*reg_data)); | ||
248 | tps->regulator_pdev[i] = pdev; | ||
249 | |||
250 | platform_device_add(pdev); | ||
251 | } | ||
252 | |||
253 | return 0; | 211 | return 0; |
254 | } | 212 | } |
255 | 213 | ||
256 | static int __devexit tps65217_remove(struct i2c_client *client) | 214 | static int __devexit tps65217_remove(struct i2c_client *client) |
257 | { | 215 | { |
258 | struct tps65217 *tps = i2c_get_clientdata(client); | 216 | struct tps65217 *tps = i2c_get_clientdata(client); |
259 | int i; | ||
260 | 217 | ||
261 | for (i = 0; i < TPS65217_NUM_REGULATOR; i++) | 218 | mfd_remove_devices(tps->dev); |
262 | platform_device_unregister(tps->regulator_pdev[i]); | ||
263 | 219 | ||
264 | return 0; | 220 | return 0; |
265 | } | 221 | } |
266 | 222 | ||
267 | static const struct i2c_device_id tps65217_id_table[] = { | 223 | static const struct i2c_device_id tps65217_id_table[] = { |
268 | {"tps65217", 0xF0}, | 224 | {"tps65217", TPS65217}, |
269 | {/* end of list */} | 225 | { /* sentinel */ } |
270 | }; | 226 | }; |
271 | MODULE_DEVICE_TABLE(i2c, tps65217_id_table); | 227 | MODULE_DEVICE_TABLE(i2c, tps65217_id_table); |
272 | 228 | ||
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 353c34812120..5f58370ccf55 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -493,7 +493,8 @@ static int __devinit tps6586x_i2c_probe(struct i2c_client *client, | |||
493 | } | 493 | } |
494 | 494 | ||
495 | ret = mfd_add_devices(tps6586x->dev, -1, | 495 | ret = mfd_add_devices(tps6586x->dev, -1, |
496 | tps6586x_cell, ARRAY_SIZE(tps6586x_cell), NULL, 0); | 496 | tps6586x_cell, ARRAY_SIZE(tps6586x_cell), |
497 | NULL, 0, NULL); | ||
497 | if (ret < 0) { | 498 | if (ret < 0) { |
498 | dev_err(&client->dev, "mfd_add_devices failed: %d\n", ret); | 499 | dev_err(&client->dev, "mfd_add_devices failed: %d\n", ret); |
499 | goto err_mfd_add; | 500 | goto err_mfd_add; |
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 1c563792c777..d3ce4d569deb 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c | |||
@@ -254,7 +254,7 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c, | |||
254 | 254 | ||
255 | ret = mfd_add_devices(tps65910->dev, -1, | 255 | ret = mfd_add_devices(tps65910->dev, -1, |
256 | tps65910s, ARRAY_SIZE(tps65910s), | 256 | tps65910s, ARRAY_SIZE(tps65910s), |
257 | NULL, 0); | 257 | NULL, 0, NULL); |
258 | if (ret < 0) { | 258 | if (ret < 0) { |
259 | dev_err(&i2c->dev, "mfd_add_devices failed: %d\n", ret); | 259 | dev_err(&i2c->dev, "mfd_add_devices failed: %d\n", ret); |
260 | return ret; | 260 | return ret; |
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c index 74fd8cb5f372..4658b5bdcd84 100644 --- a/drivers/mfd/tps65912-core.c +++ b/drivers/mfd/tps65912-core.c | |||
@@ -146,7 +146,7 @@ int tps65912_device_init(struct tps65912 *tps65912) | |||
146 | 146 | ||
147 | ret = mfd_add_devices(tps65912->dev, -1, | 147 | ret = mfd_add_devices(tps65912->dev, -1, |
148 | tps65912s, ARRAY_SIZE(tps65912s), | 148 | tps65912s, ARRAY_SIZE(tps65912s), |
149 | NULL, 0); | 149 | NULL, 0, NULL); |
150 | if (ret < 0) | 150 | if (ret < 0) |
151 | goto err; | 151 | goto err; |
152 | 152 | ||
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index 838ce4eb444e..77c9acb14583 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c | |||
@@ -223,7 +223,7 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev) | |||
223 | 223 | ||
224 | if (childs) | 224 | if (childs) |
225 | ret = mfd_add_devices(&pdev->dev, pdev->id, audio->cells, | 225 | ret = mfd_add_devices(&pdev->dev, pdev->id, audio->cells, |
226 | childs, NULL, 0); | 226 | childs, NULL, 0, NULL); |
227 | else { | 227 | else { |
228 | dev_err(&pdev->dev, "No platform data found for childs\n"); | 228 | dev_err(&pdev->dev, "No platform data found for childs\n"); |
229 | ret = -ENODEV; | 229 | ret = -ENODEV; |
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index b0fad0ffca56..3dca5c195a20 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -632,7 +632,7 @@ static int __devinit twl6040_probe(struct i2c_client *client, | |||
632 | } | 632 | } |
633 | 633 | ||
634 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, | 634 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, |
635 | NULL, 0); | 635 | NULL, 0, NULL); |
636 | if (ret) | 636 | if (ret) |
637 | goto mfd_err; | 637 | goto mfd_err; |
638 | 638 | ||
diff --git a/drivers/mfd/vx855.c b/drivers/mfd/vx855.c index 872aff21e4be..b9a636d44c7f 100644 --- a/drivers/mfd/vx855.c +++ b/drivers/mfd/vx855.c | |||
@@ -102,7 +102,7 @@ static __devinit int vx855_probe(struct pci_dev *pdev, | |||
102 | vx855_gpio_resources[1].end = vx855_gpio_resources[1].start + 3; | 102 | vx855_gpio_resources[1].end = vx855_gpio_resources[1].start + 3; |
103 | 103 | ||
104 | ret = mfd_add_devices(&pdev->dev, -1, vx855_cells, ARRAY_SIZE(vx855_cells), | 104 | ret = mfd_add_devices(&pdev->dev, -1, vx855_cells, ARRAY_SIZE(vx855_cells), |
105 | NULL, 0); | 105 | NULL, 0, NULL); |
106 | 106 | ||
107 | /* we always return -ENODEV here in order to enable other | 107 | /* we always return -ENODEV here in order to enable other |
108 | * drivers like old, not-yet-platform_device ported i2c-viapro */ | 108 | * drivers like old, not-yet-platform_device ported i2c-viapro */ |
diff --git a/drivers/mfd/wl1273-core.c b/drivers/mfd/wl1273-core.c index f39b756df561..86e0e4309fc2 100644 --- a/drivers/mfd/wl1273-core.c +++ b/drivers/mfd/wl1273-core.c | |||
@@ -241,7 +241,7 @@ static int __devinit wl1273_core_probe(struct i2c_client *client, | |||
241 | __func__, children); | 241 | __func__, children); |
242 | 242 | ||
243 | r = mfd_add_devices(&client->dev, -1, core->cells, | 243 | r = mfd_add_devices(&client->dev, -1, core->cells, |
244 | children, NULL, 0); | 244 | children, NULL, 0, NULL); |
245 | if (r) | 245 | if (r) |
246 | goto err; | 246 | goto err; |
247 | 247 | ||
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 946698fd2dc6..301731035940 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c | |||
@@ -1813,27 +1813,27 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1813 | case WM8310: | 1813 | case WM8310: |
1814 | ret = mfd_add_devices(wm831x->dev, wm831x_num, | 1814 | ret = mfd_add_devices(wm831x->dev, wm831x_num, |
1815 | wm8310_devs, ARRAY_SIZE(wm8310_devs), | 1815 | wm8310_devs, ARRAY_SIZE(wm8310_devs), |
1816 | NULL, 0); | 1816 | NULL, 0, NULL); |
1817 | break; | 1817 | break; |
1818 | 1818 | ||
1819 | case WM8311: | 1819 | case WM8311: |
1820 | ret = mfd_add_devices(wm831x->dev, wm831x_num, | 1820 | ret = mfd_add_devices(wm831x->dev, wm831x_num, |
1821 | wm8311_devs, ARRAY_SIZE(wm8311_devs), | 1821 | wm8311_devs, ARRAY_SIZE(wm8311_devs), |
1822 | NULL, 0); | 1822 | NULL, 0, NULL); |
1823 | if (!pdata || !pdata->disable_touch) | 1823 | if (!pdata || !pdata->disable_touch) |
1824 | mfd_add_devices(wm831x->dev, wm831x_num, | 1824 | mfd_add_devices(wm831x->dev, wm831x_num, |
1825 | touch_devs, ARRAY_SIZE(touch_devs), | 1825 | touch_devs, ARRAY_SIZE(touch_devs), |
1826 | NULL, 0); | 1826 | NULL, 0, NULL); |
1827 | break; | 1827 | break; |
1828 | 1828 | ||
1829 | case WM8312: | 1829 | case WM8312: |
1830 | ret = mfd_add_devices(wm831x->dev, wm831x_num, | 1830 | ret = mfd_add_devices(wm831x->dev, wm831x_num, |
1831 | wm8312_devs, ARRAY_SIZE(wm8312_devs), | 1831 | wm8312_devs, ARRAY_SIZE(wm8312_devs), |
1832 | NULL, 0); | 1832 | NULL, 0, NULL); |
1833 | if (!pdata || !pdata->disable_touch) | 1833 | if (!pdata || !pdata->disable_touch) |
1834 | mfd_add_devices(wm831x->dev, wm831x_num, | 1834 | mfd_add_devices(wm831x->dev, wm831x_num, |
1835 | touch_devs, ARRAY_SIZE(touch_devs), | 1835 | touch_devs, ARRAY_SIZE(touch_devs), |
1836 | NULL, 0); | 1836 | NULL, 0, NULL); |
1837 | break; | 1837 | break; |
1838 | 1838 | ||
1839 | case WM8320: | 1839 | case WM8320: |
@@ -1842,7 +1842,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1842 | case WM8326: | 1842 | case WM8326: |
1843 | ret = mfd_add_devices(wm831x->dev, wm831x_num, | 1843 | ret = mfd_add_devices(wm831x->dev, wm831x_num, |
1844 | wm8320_devs, ARRAY_SIZE(wm8320_devs), | 1844 | wm8320_devs, ARRAY_SIZE(wm8320_devs), |
1845 | NULL, 0); | 1845 | NULL, 0, NULL); |
1846 | break; | 1846 | break; |
1847 | 1847 | ||
1848 | default: | 1848 | default: |
@@ -1867,7 +1867,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1867 | if (ret & WM831X_XTAL_ENA) { | 1867 | if (ret & WM831X_XTAL_ENA) { |
1868 | ret = mfd_add_devices(wm831x->dev, wm831x_num, | 1868 | ret = mfd_add_devices(wm831x->dev, wm831x_num, |
1869 | rtc_devs, ARRAY_SIZE(rtc_devs), | 1869 | rtc_devs, ARRAY_SIZE(rtc_devs), |
1870 | NULL, 0); | 1870 | NULL, 0, NULL); |
1871 | if (ret != 0) { | 1871 | if (ret != 0) { |
1872 | dev_err(wm831x->dev, "Failed to add RTC: %d\n", ret); | 1872 | dev_err(wm831x->dev, "Failed to add RTC: %d\n", ret); |
1873 | goto err_irq; | 1873 | goto err_irq; |
@@ -1880,7 +1880,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1880 | /* Treat errors as non-critical */ | 1880 | /* Treat errors as non-critical */ |
1881 | ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, | 1881 | ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, |
1882 | ARRAY_SIZE(backlight_devs), NULL, | 1882 | ARRAY_SIZE(backlight_devs), NULL, |
1883 | 0); | 1883 | 0, NULL); |
1884 | if (ret < 0) | 1884 | if (ret < 0) |
1885 | dev_err(wm831x->dev, "Failed to add backlight: %d\n", | 1885 | dev_err(wm831x->dev, "Failed to add backlight: %d\n", |
1886 | ret); | 1886 | ret); |
diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c index 4b7d378551d5..639ca359242f 100644 --- a/drivers/mfd/wm8400-core.c +++ b/drivers/mfd/wm8400-core.c | |||
@@ -70,7 +70,7 @@ static int wm8400_register_codec(struct wm8400 *wm8400) | |||
70 | .pdata_size = sizeof(*wm8400), | 70 | .pdata_size = sizeof(*wm8400), |
71 | }; | 71 | }; |
72 | 72 | ||
73 | return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0); | 73 | return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0, NULL); |
74 | } | 74 | } |
75 | 75 | ||
76 | /* | 76 | /* |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index eec74aa55fdf..2febf88cfce8 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -414,7 +414,7 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
414 | ret = mfd_add_devices(wm8994->dev, -1, | 414 | ret = mfd_add_devices(wm8994->dev, -1, |
415 | wm8994_regulator_devs, | 415 | wm8994_regulator_devs, |
416 | ARRAY_SIZE(wm8994_regulator_devs), | 416 | ARRAY_SIZE(wm8994_regulator_devs), |
417 | NULL, 0); | 417 | NULL, 0, NULL); |
418 | if (ret != 0) { | 418 | if (ret != 0) { |
419 | dev_err(wm8994->dev, "Failed to add children: %d\n", ret); | 419 | dev_err(wm8994->dev, "Failed to add children: %d\n", ret); |
420 | goto err; | 420 | goto err; |
@@ -648,7 +648,7 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
648 | 648 | ||
649 | ret = mfd_add_devices(wm8994->dev, -1, | 649 | ret = mfd_add_devices(wm8994->dev, -1, |
650 | wm8994_devs, ARRAY_SIZE(wm8994_devs), | 650 | wm8994_devs, ARRAY_SIZE(wm8994_devs), |
651 | NULL, 0); | 651 | NULL, 0, NULL); |
652 | if (ret != 0) { | 652 | if (ret != 0) { |
653 | dev_err(wm8994->dev, "Failed to add children: %d\n", ret); | 653 | dev_err(wm8994->dev, "Failed to add children: %d\n", ret); |
654 | goto err_irq; | 654 | goto err_irq; |
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c index 98ee43819911..7edadee487ba 100644 --- a/drivers/net/can/janz-ican3.c +++ b/drivers/net/can/janz-ican3.c | |||
@@ -1391,7 +1391,6 @@ static irqreturn_t ican3_irq(int irq, void *dev_id) | |||
1391 | */ | 1391 | */ |
1392 | static int ican3_reset_module(struct ican3_dev *mod) | 1392 | static int ican3_reset_module(struct ican3_dev *mod) |
1393 | { | 1393 | { |
1394 | u8 val = 1 << mod->num; | ||
1395 | unsigned long start; | 1394 | unsigned long start; |
1396 | u8 runold, runnew; | 1395 | u8 runold, runnew; |
1397 | 1396 | ||
@@ -1405,8 +1404,7 @@ static int ican3_reset_module(struct ican3_dev *mod) | |||
1405 | runold = ioread8(mod->dpm + TARGET_RUNNING); | 1404 | runold = ioread8(mod->dpm + TARGET_RUNNING); |
1406 | 1405 | ||
1407 | /* reset the module */ | 1406 | /* reset the module */ |
1408 | iowrite8(val, &mod->ctrl->reset_assert); | 1407 | iowrite8(0x00, &mod->dpmctrl->hwreset); |
1409 | iowrite8(val, &mod->ctrl->reset_deassert); | ||
1410 | 1408 | ||
1411 | /* wait until the module has finished resetting and is running */ | 1409 | /* wait until the module has finished resetting and is running */ |
1412 | start = jiffies; | 1410 | start = jiffies; |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index 527dbcf95335..9ded21e79db5 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
@@ -984,12 +984,12 @@ static int __devexit ti_hecc_remove(struct platform_device *pdev) | |||
984 | struct net_device *ndev = platform_get_drvdata(pdev); | 984 | struct net_device *ndev = platform_get_drvdata(pdev); |
985 | struct ti_hecc_priv *priv = netdev_priv(ndev); | 985 | struct ti_hecc_priv *priv = netdev_priv(ndev); |
986 | 986 | ||
987 | unregister_candev(ndev); | ||
987 | clk_disable(priv->clk); | 988 | clk_disable(priv->clk); |
988 | clk_put(priv->clk); | 989 | clk_put(priv->clk); |
989 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 990 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
990 | iounmap(priv->base); | 991 | iounmap(priv->base); |
991 | release_mem_region(res->start, resource_size(res)); | 992 | release_mem_region(res->start, resource_size(res)); |
992 | unregister_candev(ndev); | ||
993 | free_candev(ndev); | 993 | free_candev(ndev); |
994 | platform_set_drvdata(pdev, NULL); | 994 | platform_set_drvdata(pdev, NULL); |
995 | 995 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 79cebd8525ce..e48312f2305d 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -8564,7 +8564,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8564 | return 0; | 8564 | return 0; |
8565 | 8565 | ||
8566 | error: | 8566 | error: |
8567 | iounmap(bp->regview); | 8567 | pci_iounmap(pdev, bp->regview); |
8568 | pci_release_regions(pdev); | 8568 | pci_release_regions(pdev); |
8569 | pci_disable_device(pdev); | 8569 | pci_disable_device(pdev); |
8570 | pci_set_drvdata(pdev, NULL); | 8570 | pci_set_drvdata(pdev, NULL); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index ca8048757c84..f67e700fe59d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -662,14 +662,16 @@ void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe, | |||
662 | struct bnx2x_fastpath *fp, | 662 | struct bnx2x_fastpath *fp, |
663 | struct bnx2x_eth_q_stats *qstats) | 663 | struct bnx2x_eth_q_stats *qstats) |
664 | { | 664 | { |
665 | /* Do nothing if no IP/L4 csum validation was done */ | 665 | /* Do nothing if no L4 csum validation was done. |
666 | 666 | * We do not check whether IP csum was validated. For IPv4 we assume | |
667 | * that if the card got as far as validating the L4 csum, it also | ||
668 | * validated the IP csum. IPv6 has no IP csum. | ||
669 | */ | ||
667 | if (cqe->fast_path_cqe.status_flags & | 670 | if (cqe->fast_path_cqe.status_flags & |
668 | (ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG | | 671 | ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG) |
669 | ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG)) | ||
670 | return; | 672 | return; |
671 | 673 | ||
672 | /* If both IP/L4 validation were done, check if an error was found. */ | 674 | /* If L4 validation was done, check if an error was found. */ |
673 | 675 | ||
674 | if (cqe->fast_path_cqe.type_error_flags & | 676 | if (cqe->fast_path_cqe.type_error_flags & |
675 | (ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG | | 677 | (ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG | |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 7a9157052c7c..c319e4c431fb 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -9841,12 +9841,13 @@ static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) | |||
9841 | } | 9841 | } |
9842 | 9842 | ||
9843 | #ifdef CONFIG_PCI_MSI | 9843 | #ifdef CONFIG_PCI_MSI |
9844 | /* | 9844 | /* Due to new PF resource allocation by MFW T7.4 and above, it's |
9845 | * It's expected that number of CAM entries for this functions is equal | 9845 | * optional that number of CAM entries will not be equal to the value |
9846 | * to the number evaluated based on the MSI-X table size. We want a | 9846 | * advertised in PCI. |
9847 | * harsh warning if these values are different! | 9847 | * Driver should use the minimal value of both as the actual status |
9848 | * block count | ||
9848 | */ | 9849 | */ |
9849 | WARN_ON(bp->igu_sb_cnt != igu_sb_cnt); | 9850 | bp->igu_sb_cnt = min_t(int, bp->igu_sb_cnt, igu_sb_cnt); |
9850 | #endif | 9851 | #endif |
9851 | 9852 | ||
9852 | if (igu_sb_cnt == 0) | 9853 | if (igu_sb_cnt == 0) |
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 77884191a8c6..4e980a7886fb 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -1086,7 +1086,7 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
1086 | /* Clock */ | 1086 | /* Clock */ |
1087 | lp->ether_clk = clk_get(&pdev->dev, "ether_clk"); | 1087 | lp->ether_clk = clk_get(&pdev->dev, "ether_clk"); |
1088 | if (IS_ERR(lp->ether_clk)) { | 1088 | if (IS_ERR(lp->ether_clk)) { |
1089 | res = -ENODEV; | 1089 | res = PTR_ERR(lp->ether_clk); |
1090 | goto err_ioumap; | 1090 | goto err_ioumap; |
1091 | } | 1091 | } |
1092 | clk_enable(lp->ether_clk); | 1092 | clk_enable(lp->ether_clk); |
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 8971921cc1c8..ab6762caa957 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c | |||
@@ -1773,6 +1773,7 @@ static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, | |||
1773 | } | 1773 | } |
1774 | 1774 | ||
1775 | int gfar_phc_index = -1; | 1775 | int gfar_phc_index = -1; |
1776 | EXPORT_SYMBOL(gfar_phc_index); | ||
1776 | 1777 | ||
1777 | static int gfar_get_ts_info(struct net_device *dev, | 1778 | static int gfar_get_ts_info(struct net_device *dev, |
1778 | struct ethtool_ts_info *info) | 1779 | struct ethtool_ts_info *info) |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index 18762a3ccce4..b9db0e040563 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -515,7 +515,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
515 | err = PTR_ERR(etsects->clock); | 515 | err = PTR_ERR(etsects->clock); |
516 | goto no_clock; | 516 | goto no_clock; |
517 | } | 517 | } |
518 | gfar_phc_clock = ptp_clock_index(etsects->clock); | 518 | gfar_phc_index = ptp_clock_index(etsects->clock); |
519 | 519 | ||
520 | dev_set_drvdata(&dev->dev, etsects); | 520 | dev_set_drvdata(&dev->dev, etsects); |
521 | 521 | ||
@@ -539,7 +539,7 @@ static int gianfar_ptp_remove(struct platform_device *dev) | |||
539 | gfar_write(&etsects->regs->tmr_temask, 0); | 539 | gfar_write(&etsects->regs->tmr_temask, 0); |
540 | gfar_write(&etsects->regs->tmr_ctrl, 0); | 540 | gfar_write(&etsects->regs->tmr_ctrl, 0); |
541 | 541 | ||
542 | gfar_phc_clock = -1; | 542 | gfar_phc_index = -1; |
543 | ptp_clock_unregister(etsects->clock); | 543 | ptp_clock_unregister(etsects->clock); |
544 | iounmap(etsects->regs); | 544 | iounmap(etsects->regs); |
545 | release_resource(etsects->rsrc); | 545 | release_resource(etsects->rsrc); |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 3a8368e42ede..f9ac229ce222 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -3150,6 +3150,17 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3150 | return NETDEV_TX_OK; | 3150 | return NETDEV_TX_OK; |
3151 | } | 3151 | } |
3152 | 3152 | ||
3153 | /* On PCI/PCI-X HW, if packet size is less than ETH_ZLEN, | ||
3154 | * packets may get corrupted during padding by HW. | ||
3155 | * To WA this issue, pad all small packets manually. | ||
3156 | */ | ||
3157 | if (skb->len < ETH_ZLEN) { | ||
3158 | if (skb_pad(skb, ETH_ZLEN - skb->len)) | ||
3159 | return NETDEV_TX_OK; | ||
3160 | skb->len = ETH_ZLEN; | ||
3161 | skb_set_tail_pointer(skb, ETH_ZLEN); | ||
3162 | } | ||
3163 | |||
3153 | mss = skb_shinfo(skb)->gso_size; | 3164 | mss = skb_shinfo(skb)->gso_size; |
3154 | /* The controller does a simple calculation to | 3165 | /* The controller does a simple calculation to |
3155 | * make sure there is enough room in the FIFO before | 3166 | * make sure there is enough room in the FIFO before |
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c index daf417923661..31d02649be41 100644 --- a/drivers/net/ethernet/mellanox/mlx4/icm.c +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c | |||
@@ -227,9 +227,10 @@ int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev) | |||
227 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); | 227 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); |
228 | } | 228 | } |
229 | 229 | ||
230 | int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj) | 230 | int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj) |
231 | { | 231 | { |
232 | int i = (obj & (table->num_obj - 1)) / (MLX4_TABLE_CHUNK_SIZE / table->obj_size); | 232 | u32 i = (obj & (table->num_obj - 1)) / |
233 | (MLX4_TABLE_CHUNK_SIZE / table->obj_size); | ||
233 | int ret = 0; | 234 | int ret = 0; |
234 | 235 | ||
235 | mutex_lock(&table->mutex); | 236 | mutex_lock(&table->mutex); |
@@ -262,16 +263,18 @@ out: | |||
262 | return ret; | 263 | return ret; |
263 | } | 264 | } |
264 | 265 | ||
265 | void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj) | 266 | void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj) |
266 | { | 267 | { |
267 | int i; | 268 | u32 i; |
269 | u64 offset; | ||
268 | 270 | ||
269 | i = (obj & (table->num_obj - 1)) / (MLX4_TABLE_CHUNK_SIZE / table->obj_size); | 271 | i = (obj & (table->num_obj - 1)) / (MLX4_TABLE_CHUNK_SIZE / table->obj_size); |
270 | 272 | ||
271 | mutex_lock(&table->mutex); | 273 | mutex_lock(&table->mutex); |
272 | 274 | ||
273 | if (--table->icm[i]->refcount == 0) { | 275 | if (--table->icm[i]->refcount == 0) { |
274 | mlx4_UNMAP_ICM(dev, table->virt + i * MLX4_TABLE_CHUNK_SIZE, | 276 | offset = (u64) i * MLX4_TABLE_CHUNK_SIZE; |
277 | mlx4_UNMAP_ICM(dev, table->virt + offset, | ||
275 | MLX4_TABLE_CHUNK_SIZE / MLX4_ICM_PAGE_SIZE); | 278 | MLX4_TABLE_CHUNK_SIZE / MLX4_ICM_PAGE_SIZE); |
276 | mlx4_free_icm(dev, table->icm[i], table->coherent); | 279 | mlx4_free_icm(dev, table->icm[i], table->coherent); |
277 | table->icm[i] = NULL; | 280 | table->icm[i] = NULL; |
@@ -280,9 +283,11 @@ void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj) | |||
280 | mutex_unlock(&table->mutex); | 283 | mutex_unlock(&table->mutex); |
281 | } | 284 | } |
282 | 285 | ||
283 | void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_handle) | 286 | void *mlx4_table_find(struct mlx4_icm_table *table, u32 obj, |
287 | dma_addr_t *dma_handle) | ||
284 | { | 288 | { |
285 | int idx, offset, dma_offset, i; | 289 | int offset, dma_offset, i; |
290 | u64 idx; | ||
286 | struct mlx4_icm_chunk *chunk; | 291 | struct mlx4_icm_chunk *chunk; |
287 | struct mlx4_icm *icm; | 292 | struct mlx4_icm *icm; |
288 | struct page *page = NULL; | 293 | struct page *page = NULL; |
@@ -292,7 +297,7 @@ void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_han | |||
292 | 297 | ||
293 | mutex_lock(&table->mutex); | 298 | mutex_lock(&table->mutex); |
294 | 299 | ||
295 | idx = (obj & (table->num_obj - 1)) * table->obj_size; | 300 | idx = (u64) (obj & (table->num_obj - 1)) * table->obj_size; |
296 | icm = table->icm[idx / MLX4_TABLE_CHUNK_SIZE]; | 301 | icm = table->icm[idx / MLX4_TABLE_CHUNK_SIZE]; |
297 | dma_offset = offset = idx % MLX4_TABLE_CHUNK_SIZE; | 302 | dma_offset = offset = idx % MLX4_TABLE_CHUNK_SIZE; |
298 | 303 | ||
@@ -326,10 +331,11 @@ out: | |||
326 | } | 331 | } |
327 | 332 | ||
328 | int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, | 333 | int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
329 | int start, int end) | 334 | u32 start, u32 end) |
330 | { | 335 | { |
331 | int inc = MLX4_TABLE_CHUNK_SIZE / table->obj_size; | 336 | int inc = MLX4_TABLE_CHUNK_SIZE / table->obj_size; |
332 | int i, err; | 337 | int err; |
338 | u32 i; | ||
333 | 339 | ||
334 | for (i = start; i <= end; i += inc) { | 340 | for (i = start; i <= end; i += inc) { |
335 | err = mlx4_table_get(dev, table, i); | 341 | err = mlx4_table_get(dev, table, i); |
@@ -349,9 +355,9 @@ fail: | |||
349 | } | 355 | } |
350 | 356 | ||
351 | void mlx4_table_put_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, | 357 | void mlx4_table_put_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
352 | int start, int end) | 358 | u32 start, u32 end) |
353 | { | 359 | { |
354 | int i; | 360 | u32 i; |
355 | 361 | ||
356 | for (i = start; i <= end; i += MLX4_TABLE_CHUNK_SIZE / table->obj_size) | 362 | for (i = start; i <= end; i += MLX4_TABLE_CHUNK_SIZE / table->obj_size) |
357 | mlx4_table_put(dev, table, i); | 363 | mlx4_table_put(dev, table, i); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.h b/drivers/net/ethernet/mellanox/mlx4/icm.h index a67744f53506..dee67fa39107 100644 --- a/drivers/net/ethernet/mellanox/mlx4/icm.h +++ b/drivers/net/ethernet/mellanox/mlx4/icm.h | |||
@@ -71,17 +71,17 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, | |||
71 | gfp_t gfp_mask, int coherent); | 71 | gfp_t gfp_mask, int coherent); |
72 | void mlx4_free_icm(struct mlx4_dev *dev, struct mlx4_icm *icm, int coherent); | 72 | void mlx4_free_icm(struct mlx4_dev *dev, struct mlx4_icm *icm, int coherent); |
73 | 73 | ||
74 | int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj); | 74 | int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj); |
75 | void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, int obj); | 75 | void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj); |
76 | int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, | 76 | int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
77 | int start, int end); | 77 | u32 start, u32 end); |
78 | void mlx4_table_put_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, | 78 | void mlx4_table_put_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
79 | int start, int end); | 79 | u32 start, u32 end); |
80 | int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table, | 80 | int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
81 | u64 virt, int obj_size, u32 nobj, int reserved, | 81 | u64 virt, int obj_size, u32 nobj, int reserved, |
82 | int use_lowmem, int use_coherent); | 82 | int use_lowmem, int use_coherent); |
83 | void mlx4_cleanup_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table); | 83 | void mlx4_cleanup_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table); |
84 | void *mlx4_table_find(struct mlx4_icm_table *table, int obj, dma_addr_t *dma_handle); | 84 | void *mlx4_table_find(struct mlx4_icm_table *table, u32 obj, dma_addr_t *dma_handle); |
85 | 85 | ||
86 | static inline void mlx4_icm_first(struct mlx4_icm *icm, | 86 | static inline void mlx4_icm_first(struct mlx4_icm *icm, |
87 | struct mlx4_icm_iter *iter) | 87 | struct mlx4_icm_iter *iter) |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index c42bbb16cdae..a688a2ddcfd6 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
@@ -722,10 +722,8 @@ static int octeon_mgmt_init_phy(struct net_device *netdev) | |||
722 | octeon_mgmt_adjust_link, 0, | 722 | octeon_mgmt_adjust_link, 0, |
723 | PHY_INTERFACE_MODE_MII); | 723 | PHY_INTERFACE_MODE_MII); |
724 | 724 | ||
725 | if (IS_ERR(p->phydev)) { | 725 | if (!p->phydev) |
726 | p->phydev = NULL; | ||
727 | return -1; | 726 | return -1; |
728 | } | ||
729 | 727 | ||
730 | phy_start_aneg(p->phydev); | 728 | phy_start_aneg(p->phydev); |
731 | 729 | ||
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index e559dfa06d6a..6fa74d530e44 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
@@ -1101,9 +1101,9 @@ static int pasemi_mac_phy_init(struct net_device *dev) | |||
1101 | phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, | 1101 | phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, |
1102 | PHY_INTERFACE_MODE_SGMII); | 1102 | PHY_INTERFACE_MODE_SGMII); |
1103 | 1103 | ||
1104 | if (IS_ERR(phydev)) { | 1104 | if (!phydev) { |
1105 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); | 1105 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); |
1106 | return PTR_ERR(phydev); | 1106 | return -ENODEV; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | mac->phydev = phydev; | 1109 | mac->phydev = phydev; |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 342b3a79bd0f..a77c558d8f40 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -1378,6 +1378,10 @@ static void netxen_mask_aer_correctable(struct netxen_adapter *adapter) | |||
1378 | struct pci_dev *root = pdev->bus->self; | 1378 | struct pci_dev *root = pdev->bus->self; |
1379 | u32 aer_pos; | 1379 | u32 aer_pos; |
1380 | 1380 | ||
1381 | /* root bus? */ | ||
1382 | if (!root) | ||
1383 | return; | ||
1384 | |||
1381 | if (adapter->ahw.board_type != NETXEN_BRDTYPE_P3_4_GB_MM && | 1385 | if (adapter->ahw.board_type != NETXEN_BRDTYPE_P3_4_GB_MM && |
1382 | adapter->ahw.board_type != NETXEN_BRDTYPE_P3_10G_TP) | 1386 | adapter->ahw.board_type != NETXEN_BRDTYPE_P3_10G_TP) |
1383 | return; | 1387 | return; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index b8ead696141e..2a179d087207 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -15,7 +15,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
15 | 15 | ||
16 | do { | 16 | do { |
17 | /* give atleast 1ms for firmware to respond */ | 17 | /* give atleast 1ms for firmware to respond */ |
18 | msleep(1); | 18 | mdelay(1); |
19 | 19 | ||
20 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) | 20 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) |
21 | return QLCNIC_CDRP_RSP_TIMEOUT; | 21 | return QLCNIC_CDRP_RSP_TIMEOUT; |
@@ -601,7 +601,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) | |||
601 | qlcnic_fw_cmd_destroy_tx_ctx(adapter); | 601 | qlcnic_fw_cmd_destroy_tx_ctx(adapter); |
602 | 602 | ||
603 | /* Allow dma queues to drain after context reset */ | 603 | /* Allow dma queues to drain after context reset */ |
604 | msleep(20); | 604 | mdelay(20); |
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c136162e6473..3be88331d17a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1066,7 +1066,7 @@ static int stmmac_open(struct net_device *dev) | |||
1066 | } else | 1066 | } else |
1067 | priv->tm->enable = 1; | 1067 | priv->tm->enable = 1; |
1068 | #endif | 1068 | #endif |
1069 | clk_enable(priv->stmmac_clk); | 1069 | clk_prepare_enable(priv->stmmac_clk); |
1070 | 1070 | ||
1071 | stmmac_check_ether_addr(priv); | 1071 | stmmac_check_ether_addr(priv); |
1072 | 1072 | ||
@@ -1188,7 +1188,7 @@ open_error: | |||
1188 | if (priv->phydev) | 1188 | if (priv->phydev) |
1189 | phy_disconnect(priv->phydev); | 1189 | phy_disconnect(priv->phydev); |
1190 | 1190 | ||
1191 | clk_disable(priv->stmmac_clk); | 1191 | clk_disable_unprepare(priv->stmmac_clk); |
1192 | 1192 | ||
1193 | return ret; | 1193 | return ret; |
1194 | } | 1194 | } |
@@ -1246,7 +1246,7 @@ static int stmmac_release(struct net_device *dev) | |||
1246 | #ifdef CONFIG_STMMAC_DEBUG_FS | 1246 | #ifdef CONFIG_STMMAC_DEBUG_FS |
1247 | stmmac_exit_fs(); | 1247 | stmmac_exit_fs(); |
1248 | #endif | 1248 | #endif |
1249 | clk_disable(priv->stmmac_clk); | 1249 | clk_disable_unprepare(priv->stmmac_clk); |
1250 | 1250 | ||
1251 | return 0; | 1251 | return 0; |
1252 | } | 1252 | } |
@@ -2178,7 +2178,7 @@ int stmmac_suspend(struct net_device *ndev) | |||
2178 | else { | 2178 | else { |
2179 | stmmac_set_mac(priv->ioaddr, false); | 2179 | stmmac_set_mac(priv->ioaddr, false); |
2180 | /* Disable clock in case of PWM is off */ | 2180 | /* Disable clock in case of PWM is off */ |
2181 | clk_disable(priv->stmmac_clk); | 2181 | clk_disable_unprepare(priv->stmmac_clk); |
2182 | } | 2182 | } |
2183 | spin_unlock_irqrestore(&priv->lock, flags); | 2183 | spin_unlock_irqrestore(&priv->lock, flags); |
2184 | return 0; | 2184 | return 0; |
@@ -2203,7 +2203,7 @@ int stmmac_resume(struct net_device *ndev) | |||
2203 | priv->hw->mac->pmt(priv->ioaddr, 0); | 2203 | priv->hw->mac->pmt(priv->ioaddr, 0); |
2204 | else | 2204 | else |
2205 | /* enable the clk prevously disabled */ | 2205 | /* enable the clk prevously disabled */ |
2206 | clk_enable(priv->stmmac_clk); | 2206 | clk_prepare_enable(priv->stmmac_clk); |
2207 | 2207 | ||
2208 | netif_device_attach(ndev); | 2208 | netif_device_attach(ndev); |
2209 | 2209 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c index 2a0e1abde7e7..4ccd4e2977b7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | |||
@@ -97,19 +97,19 @@ static struct clk *timer_clock; | |||
97 | static void stmmac_tmu_start(unsigned int new_freq) | 97 | static void stmmac_tmu_start(unsigned int new_freq) |
98 | { | 98 | { |
99 | clk_set_rate(timer_clock, new_freq); | 99 | clk_set_rate(timer_clock, new_freq); |
100 | clk_enable(timer_clock); | 100 | clk_prepare_enable(timer_clock); |
101 | } | 101 | } |
102 | 102 | ||
103 | static void stmmac_tmu_stop(void) | 103 | static void stmmac_tmu_stop(void) |
104 | { | 104 | { |
105 | clk_disable(timer_clock); | 105 | clk_disable_unprepare(timer_clock); |
106 | } | 106 | } |
107 | 107 | ||
108 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | 108 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) |
109 | { | 109 | { |
110 | timer_clock = clk_get(NULL, TMU_CHANNEL); | 110 | timer_clock = clk_get(NULL, TMU_CHANNEL); |
111 | 111 | ||
112 | if (timer_clock == NULL) | 112 | if (IS_ERR(timer_clock)) |
113 | return -1; | 113 | return -1; |
114 | 114 | ||
115 | if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) { | 115 | if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) { |
@@ -126,7 +126,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
126 | 126 | ||
127 | int stmmac_close_ext_timer(void) | 127 | int stmmac_close_ext_timer(void) |
128 | { | 128 | { |
129 | clk_disable(timer_clock); | 129 | clk_disable_unprepare(timer_clock); |
130 | tmu2_unregister_user(); | 130 | tmu2_unregister_user(); |
131 | clk_put(timer_clock); | 131 | clk_put(timer_clock); |
132 | return 0; | 132 | return 0; |
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c index 256eddf1f75a..795109425568 100644 --- a/drivers/net/irda/sh_sir.c +++ b/drivers/net/irda/sh_sir.c | |||
@@ -280,7 +280,7 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | clk = clk_get(NULL, "irda_clk"); | 282 | clk = clk_get(NULL, "irda_clk"); |
283 | if (!clk) { | 283 | if (IS_ERR(clk)) { |
284 | dev_err(dev, "can not get irda_clk\n"); | 284 | dev_err(dev, "can not get irda_clk\n"); |
285 | return -EIO; | 285 | return -EIO; |
286 | } | 286 | } |
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c index 2346b38b9837..799789518e87 100644 --- a/drivers/net/phy/bcm87xx.c +++ b/drivers/net/phy/bcm87xx.c | |||
@@ -229,3 +229,5 @@ static void __exit bcm87xx_exit(void) | |||
229 | ARRAY_SIZE(bcm87xx_driver)); | 229 | ARRAY_SIZE(bcm87xx_driver)); |
230 | } | 230 | } |
231 | module_exit(bcm87xx_exit); | 231 | module_exit(bcm87xx_exit); |
232 | |||
233 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index cf287e0eb408..2165d5fdb8c0 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -21,6 +21,12 @@ | |||
21 | #include <linux/phy.h> | 21 | #include <linux/phy.h> |
22 | #include <linux/micrel_phy.h> | 22 | #include <linux/micrel_phy.h> |
23 | 23 | ||
24 | /* Operation Mode Strap Override */ | ||
25 | #define MII_KSZPHY_OMSO 0x16 | ||
26 | #define KSZPHY_OMSO_B_CAST_OFF (1 << 9) | ||
27 | #define KSZPHY_OMSO_RMII_OVERRIDE (1 << 1) | ||
28 | #define KSZPHY_OMSO_MII_OVERRIDE (1 << 0) | ||
29 | |||
24 | /* general Interrupt control/status reg in vendor specific block. */ | 30 | /* general Interrupt control/status reg in vendor specific block. */ |
25 | #define MII_KSZPHY_INTCS 0x1B | 31 | #define MII_KSZPHY_INTCS 0x1B |
26 | #define KSZPHY_INTCS_JABBER (1 << 15) | 32 | #define KSZPHY_INTCS_JABBER (1 << 15) |
@@ -101,6 +107,13 @@ static int kszphy_config_init(struct phy_device *phydev) | |||
101 | return 0; | 107 | return 0; |
102 | } | 108 | } |
103 | 109 | ||
110 | static int ksz8021_config_init(struct phy_device *phydev) | ||
111 | { | ||
112 | const u16 val = KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE; | ||
113 | phy_write(phydev, MII_KSZPHY_OMSO, val); | ||
114 | return 0; | ||
115 | } | ||
116 | |||
104 | static int ks8051_config_init(struct phy_device *phydev) | 117 | static int ks8051_config_init(struct phy_device *phydev) |
105 | { | 118 | { |
106 | int regval; | 119 | int regval; |
@@ -128,9 +141,22 @@ static struct phy_driver ksphy_driver[] = { | |||
128 | .config_intr = ks8737_config_intr, | 141 | .config_intr = ks8737_config_intr, |
129 | .driver = { .owner = THIS_MODULE,}, | 142 | .driver = { .owner = THIS_MODULE,}, |
130 | }, { | 143 | }, { |
131 | .phy_id = PHY_ID_KS8041, | 144 | .phy_id = PHY_ID_KSZ8021, |
145 | .phy_id_mask = 0x00ffffff, | ||
146 | .name = "Micrel KSZ8021", | ||
147 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | | ||
148 | SUPPORTED_Asym_Pause), | ||
149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | ||
150 | .config_init = ksz8021_config_init, | ||
151 | .config_aneg = genphy_config_aneg, | ||
152 | .read_status = genphy_read_status, | ||
153 | .ack_interrupt = kszphy_ack_interrupt, | ||
154 | .config_intr = kszphy_config_intr, | ||
155 | .driver = { .owner = THIS_MODULE,}, | ||
156 | }, { | ||
157 | .phy_id = PHY_ID_KSZ8041, | ||
132 | .phy_id_mask = 0x00fffff0, | 158 | .phy_id_mask = 0x00fffff0, |
133 | .name = "Micrel KS8041", | 159 | .name = "Micrel KSZ8041", |
134 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | 160 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
135 | | SUPPORTED_Asym_Pause), | 161 | | SUPPORTED_Asym_Pause), |
136 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 162 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
@@ -141,9 +167,9 @@ static struct phy_driver ksphy_driver[] = { | |||
141 | .config_intr = kszphy_config_intr, | 167 | .config_intr = kszphy_config_intr, |
142 | .driver = { .owner = THIS_MODULE,}, | 168 | .driver = { .owner = THIS_MODULE,}, |
143 | }, { | 169 | }, { |
144 | .phy_id = PHY_ID_KS8051, | 170 | .phy_id = PHY_ID_KSZ8051, |
145 | .phy_id_mask = 0x00fffff0, | 171 | .phy_id_mask = 0x00fffff0, |
146 | .name = "Micrel KS8051", | 172 | .name = "Micrel KSZ8051", |
147 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | 173 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
148 | | SUPPORTED_Asym_Pause), | 174 | | SUPPORTED_Asym_Pause), |
149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 175 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
@@ -154,8 +180,8 @@ static struct phy_driver ksphy_driver[] = { | |||
154 | .config_intr = kszphy_config_intr, | 180 | .config_intr = kszphy_config_intr, |
155 | .driver = { .owner = THIS_MODULE,}, | 181 | .driver = { .owner = THIS_MODULE,}, |
156 | }, { | 182 | }, { |
157 | .phy_id = PHY_ID_KS8001, | 183 | .phy_id = PHY_ID_KSZ8001, |
158 | .name = "Micrel KS8001 or KS8721", | 184 | .name = "Micrel KSZ8001 or KS8721", |
159 | .phy_id_mask = 0x00ffffff, | 185 | .phy_id_mask = 0x00ffffff, |
160 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | 186 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
161 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 187 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
@@ -201,10 +227,11 @@ MODULE_LICENSE("GPL"); | |||
201 | 227 | ||
202 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { | 228 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { |
203 | { PHY_ID_KSZ9021, 0x000ffffe }, | 229 | { PHY_ID_KSZ9021, 0x000ffffe }, |
204 | { PHY_ID_KS8001, 0x00ffffff }, | 230 | { PHY_ID_KSZ8001, 0x00ffffff }, |
205 | { PHY_ID_KS8737, 0x00fffff0 }, | 231 | { PHY_ID_KS8737, 0x00fffff0 }, |
206 | { PHY_ID_KS8041, 0x00fffff0 }, | 232 | { PHY_ID_KSZ8021, 0x00ffffff }, |
207 | { PHY_ID_KS8051, 0x00fffff0 }, | 233 | { PHY_ID_KSZ8041, 0x00fffff0 }, |
234 | { PHY_ID_KSZ8051, 0x00fffff0 }, | ||
208 | { } | 235 | { } |
209 | }; | 236 | }; |
210 | 237 | ||
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 6d6192316b30..88e3991464e7 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
@@ -56,6 +56,32 @@ static int smsc_phy_config_init(struct phy_device *phydev) | |||
56 | return smsc_phy_ack_interrupt (phydev); | 56 | return smsc_phy_ack_interrupt (phydev); |
57 | } | 57 | } |
58 | 58 | ||
59 | static int lan87xx_config_init(struct phy_device *phydev) | ||
60 | { | ||
61 | /* | ||
62 | * Make sure the EDPWRDOWN bit is NOT set. Setting this bit on | ||
63 | * LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due | ||
64 | * to a bug on the chip. | ||
65 | * | ||
66 | * When the system is powered on with the network cable being | ||
67 | * disconnected all the way until after ifconfig ethX up is | ||
68 | * issued for the LAN port with this PHY, connecting the cable | ||
69 | * afterwards does not cause LINK change detection, while the | ||
70 | * expected behavior is the Link UP being detected. | ||
71 | */ | ||
72 | int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | ||
73 | if (rc < 0) | ||
74 | return rc; | ||
75 | |||
76 | rc &= ~MII_LAN83C185_EDPWRDOWN; | ||
77 | |||
78 | rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc); | ||
79 | if (rc < 0) | ||
80 | return rc; | ||
81 | |||
82 | return smsc_phy_ack_interrupt(phydev); | ||
83 | } | ||
84 | |||
59 | static int lan911x_config_init(struct phy_device *phydev) | 85 | static int lan911x_config_init(struct phy_device *phydev) |
60 | { | 86 | { |
61 | return smsc_phy_ack_interrupt(phydev); | 87 | return smsc_phy_ack_interrupt(phydev); |
@@ -162,7 +188,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
162 | /* basic functions */ | 188 | /* basic functions */ |
163 | .config_aneg = genphy_config_aneg, | 189 | .config_aneg = genphy_config_aneg, |
164 | .read_status = genphy_read_status, | 190 | .read_status = genphy_read_status, |
165 | .config_init = smsc_phy_config_init, | 191 | .config_init = lan87xx_config_init, |
166 | 192 | ||
167 | /* IRQ related */ | 193 | /* IRQ related */ |
168 | .ack_interrupt = smsc_phy_ack_interrupt, | 194 | .ack_interrupt = smsc_phy_ack_interrupt, |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index cbf7047decc0..20f31d0d1536 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
@@ -570,7 +570,7 @@ static int pppoe_release(struct socket *sock) | |||
570 | 570 | ||
571 | po = pppox_sk(sk); | 571 | po = pppox_sk(sk); |
572 | 572 | ||
573 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | 573 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { |
574 | dev_put(po->pppoe_dev); | 574 | dev_put(po->pppoe_dev); |
575 | po->pppoe_dev = NULL; | 575 | po->pppoe_dev = NULL; |
576 | } | 576 | } |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 9ce0c51a04d5..5c7547c4f802 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -967,7 +967,6 @@ static struct netpoll_info *team_netpoll_info(struct team *team) | |||
967 | #endif | 967 | #endif |
968 | 968 | ||
969 | static void __team_port_change_port_added(struct team_port *port, bool linkup); | 969 | static void __team_port_change_port_added(struct team_port *port, bool linkup); |
970 | |||
971 | static int team_dev_type_check_change(struct net_device *dev, | 970 | static int team_dev_type_check_change(struct net_device *dev, |
972 | struct net_device *port_dev); | 971 | struct net_device *port_dev); |
973 | 972 | ||
@@ -1890,8 +1889,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) | |||
1890 | 1889 | ||
1891 | hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq, | 1890 | hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq, |
1892 | &team_nl_family, 0, TEAM_CMD_NOOP); | 1891 | &team_nl_family, 0, TEAM_CMD_NOOP); |
1893 | if (IS_ERR(hdr)) { | 1892 | if (!hdr) { |
1894 | err = PTR_ERR(hdr); | 1893 | err = -EMSGSIZE; |
1895 | goto err_msg_put; | 1894 | goto err_msg_put; |
1896 | } | 1895 | } |
1897 | 1896 | ||
@@ -2091,8 +2090,8 @@ start_again: | |||
2091 | 2090 | ||
2092 | hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI, | 2091 | hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI, |
2093 | TEAM_CMD_OPTIONS_GET); | 2092 | TEAM_CMD_OPTIONS_GET); |
2094 | if (IS_ERR(hdr)) | 2093 | if (!hdr) |
2095 | return PTR_ERR(hdr); | 2094 | return -EMSGSIZE; |
2096 | 2095 | ||
2097 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) | 2096 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) |
2098 | goto nla_put_failure; | 2097 | goto nla_put_failure; |
@@ -2317,8 +2316,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb, | |||
2317 | 2316 | ||
2318 | hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags, | 2317 | hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags, |
2319 | TEAM_CMD_PORT_LIST_GET); | 2318 | TEAM_CMD_PORT_LIST_GET); |
2320 | if (IS_ERR(hdr)) | 2319 | if (!hdr) |
2321 | return PTR_ERR(hdr); | 2320 | return -EMSGSIZE; |
2322 | 2321 | ||
2323 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) | 2322 | if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) |
2324 | goto nla_put_failure; | 2323 | goto nla_put_failure; |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 8d5fdf103bcd..1df77f28c598 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -966,6 +966,10 @@ static const struct usb_device_id products [] = { | |||
966 | USB_DEVICE (0x2001, 0x3c05), | 966 | USB_DEVICE (0x2001, 0x3c05), |
967 | .driver_info = (unsigned long) &ax88772_info, | 967 | .driver_info = (unsigned long) &ax88772_info, |
968 | }, { | 968 | }, { |
969 | // DLink DUB-E100 H/W Ver C1 | ||
970 | USB_DEVICE (0x2001, 0x1a02), | ||
971 | .driver_info = (unsigned long) &ax88772_info, | ||
972 | }, { | ||
969 | // Linksys USB1000 | 973 | // Linksys USB1000 |
970 | USB_DEVICE (0x1737, 0x0039), | 974 | USB_DEVICE (0x1737, 0x0039), |
971 | .driver_info = (unsigned long) &ax88178_info, | 975 | .driver_info = (unsigned long) &ax88178_info, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index ca253206b73f..6883c371c59f 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -353,7 +353,7 @@ static const struct usb_device_id products[] = { | |||
353 | }, | 353 | }, |
354 | 354 | ||
355 | /* 2. Combined interface devices matching on class+protocol */ | 355 | /* 2. Combined interface devices matching on class+protocol */ |
356 | { /* Huawei E367 and possibly others in "Windows mode" */ | 356 | { /* Huawei E367 and possibly others in "Windows mode" */ |
357 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7), | 357 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7), |
358 | .driver_info = (unsigned long)&qmi_wwan_info, | 358 | .driver_info = (unsigned long)&qmi_wwan_info, |
359 | }, | 359 | }, |
@@ -361,7 +361,7 @@ static const struct usb_device_id products[] = { | |||
361 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), | 361 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), |
362 | .driver_info = (unsigned long)&qmi_wwan_info, | 362 | .driver_info = (unsigned long)&qmi_wwan_info, |
363 | }, | 363 | }, |
364 | { /* Pantech UML290, P4200 and more */ | 364 | { /* Pantech UML290, P4200 and more */ |
365 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), | 365 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), |
366 | .driver_info = (unsigned long)&qmi_wwan_info, | 366 | .driver_info = (unsigned long)&qmi_wwan_info, |
367 | }, | 367 | }, |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index f5ab6e613ec8..376143e8a1aa 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -1253,6 +1253,7 @@ static struct usb_driver smsc75xx_driver = { | |||
1253 | .probe = usbnet_probe, | 1253 | .probe = usbnet_probe, |
1254 | .suspend = usbnet_suspend, | 1254 | .suspend = usbnet_suspend, |
1255 | .resume = usbnet_resume, | 1255 | .resume = usbnet_resume, |
1256 | .reset_resume = usbnet_resume, | ||
1256 | .disconnect = usbnet_disconnect, | 1257 | .disconnect = usbnet_disconnect, |
1257 | .disable_hub_initiated_lpm = 1, | 1258 | .disable_hub_initiated_lpm = 1, |
1258 | }; | 1259 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index b5659cb688fe..884f9f0014ae 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -2987,6 +2987,10 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, | |||
2987 | case EEP_RX_MASK: | 2987 | case EEP_RX_MASK: |
2988 | return pBase->txrxMask & 0xf; | 2988 | return pBase->txrxMask & 0xf; |
2989 | case EEP_PAPRD: | 2989 | case EEP_PAPRD: |
2990 | if (AR_SREV_9462(ah)) | ||
2991 | return false; | ||
2992 | if (!ah->config.enable_paprd); | ||
2993 | return false; | ||
2990 | return !!(pBase->featureEnable & BIT(5)); | 2994 | return !!(pBase->featureEnable & BIT(5)); |
2991 | case EEP_CHAIN_MASK_REDUCE: | 2995 | case EEP_CHAIN_MASK_REDUCE: |
2992 | return (pBase->miscConfiguration >> 0x3) & 0x1; | 2996 | return (pBase->miscConfiguration >> 0x3) & 0x1; |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index ab3bc85a1f8a..e1041a6b457b 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -1580,6 +1580,8 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1580 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); | 1580 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); |
1581 | debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, | 1581 | debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, |
1582 | sc->debug.debugfs_phy, sc, &fops_disable_ani); | 1582 | sc->debug.debugfs_phy, sc, &fops_disable_ani); |
1583 | debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | ||
1584 | &sc->sc_ah->config.enable_paprd); | ||
1583 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1585 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1584 | sc, &fops_regidx); | 1586 | sc, &fops_regidx); |
1585 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1587 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 99cab44d2312..40f57aa2564e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2507,10 +2507,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2507 | pCap->rx_status_len = sizeof(struct ar9003_rxs); | 2507 | pCap->rx_status_len = sizeof(struct ar9003_rxs); |
2508 | pCap->tx_desc_len = sizeof(struct ar9003_txc); | 2508 | pCap->tx_desc_len = sizeof(struct ar9003_txc); |
2509 | pCap->txs_len = sizeof(struct ar9003_txs); | 2509 | pCap->txs_len = sizeof(struct ar9003_txs); |
2510 | if (!ah->config.paprd_disable && | ||
2511 | ah->eep_ops->get_eeprom(ah, EEP_PAPRD) && | ||
2512 | !AR_SREV_9462(ah)) | ||
2513 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; | ||
2514 | } else { | 2510 | } else { |
2515 | pCap->tx_desc_len = sizeof(struct ath_desc); | 2511 | pCap->tx_desc_len = sizeof(struct ath_desc); |
2516 | if (AR_SREV_9280_20(ah)) | 2512 | if (AR_SREV_9280_20(ah)) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 0d17ce0b0ff4..f0798cc50dc1 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -237,7 +237,6 @@ enum ath9k_hw_caps { | |||
237 | ATH9K_HW_CAP_LDPC = BIT(6), | 237 | ATH9K_HW_CAP_LDPC = BIT(6), |
238 | ATH9K_HW_CAP_FASTCLOCK = BIT(7), | 238 | ATH9K_HW_CAP_FASTCLOCK = BIT(7), |
239 | ATH9K_HW_CAP_SGI_20 = BIT(8), | 239 | ATH9K_HW_CAP_SGI_20 = BIT(8), |
240 | ATH9K_HW_CAP_PAPRD = BIT(9), | ||
241 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), | 240 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), |
242 | ATH9K_HW_CAP_2GHZ = BIT(11), | 241 | ATH9K_HW_CAP_2GHZ = BIT(11), |
243 | ATH9K_HW_CAP_5GHZ = BIT(12), | 242 | ATH9K_HW_CAP_5GHZ = BIT(12), |
@@ -288,12 +287,12 @@ struct ath9k_ops_config { | |||
288 | u8 pcie_clock_req; | 287 | u8 pcie_clock_req; |
289 | u32 pcie_waen; | 288 | u32 pcie_waen; |
290 | u8 analog_shiftreg; | 289 | u8 analog_shiftreg; |
291 | u8 paprd_disable; | ||
292 | u32 ofdm_trig_low; | 290 | u32 ofdm_trig_low; |
293 | u32 ofdm_trig_high; | 291 | u32 ofdm_trig_high; |
294 | u32 cck_trig_high; | 292 | u32 cck_trig_high; |
295 | u32 cck_trig_low; | 293 | u32 cck_trig_low; |
296 | u32 enable_ani; | 294 | u32 enable_ani; |
295 | u32 enable_paprd; | ||
297 | int serialize_regmode; | 296 | int serialize_regmode; |
298 | bool rx_intr_mitigation; | 297 | bool rx_intr_mitigation; |
299 | bool tx_intr_mitigation; | 298 | bool tx_intr_mitigation; |
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index 825a29cc9313..7b88b9c39ccd 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -423,7 +423,7 @@ set_timer: | |||
423 | cal_interval = min(cal_interval, (u32)short_cal_interval); | 423 | cal_interval = min(cal_interval, (u32)short_cal_interval); |
424 | 424 | ||
425 | mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); | 425 | mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); |
426 | if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) { | 426 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD) && ah->caldata) { |
427 | if (!ah->caldata->paprd_done) | 427 | if (!ah->caldata->paprd_done) |
428 | ieee80211_queue_work(sc->hw, &sc->paprd_work); | 428 | ieee80211_queue_work(sc->hw, &sc->paprd_work); |
429 | else if (!ah->paprd_table_write_done) | 429 | else if (!ah->paprd_table_write_done) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index e0b313c7f5ce..372f74eac1e7 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -640,6 +640,8 @@ static int brcmf_sdio_pd_probe(struct platform_device *pdev) | |||
640 | 640 | ||
641 | oobirq_entry = kzalloc(sizeof(struct brcmf_sdio_oobirq), | 641 | oobirq_entry = kzalloc(sizeof(struct brcmf_sdio_oobirq), |
642 | GFP_KERNEL); | 642 | GFP_KERNEL); |
643 | if (!oobirq_entry) | ||
644 | return -ENOMEM; | ||
643 | oobirq_entry->irq = res->start; | 645 | oobirq_entry->irq = res->start; |
644 | oobirq_entry->flags = res->flags & IRQF_TRIGGER_MASK; | 646 | oobirq_entry->flags = res->flags & IRQF_TRIGGER_MASK; |
645 | list_add_tail(&oobirq_entry->list, &oobirq_lh); | 647 | list_add_tail(&oobirq_entry->list, &oobirq_lh); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index f6b862d77986..8121dbabbff6 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -770,8 +770,11 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode) | |||
770 | { | 770 | { |
771 | char iovbuf[32]; | 771 | char iovbuf[32]; |
772 | int retcode; | 772 | int retcode; |
773 | __le32 arp_mode_le; | ||
773 | 774 | ||
774 | brcmf_c_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); | 775 | arp_mode_le = cpu_to_le32(arp_mode); |
776 | brcmf_c_mkiovar("arp_ol", (char *)&arp_mode_le, 4, iovbuf, | ||
777 | sizeof(iovbuf)); | ||
775 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | 778 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, |
776 | iovbuf, sizeof(iovbuf)); | 779 | iovbuf, sizeof(iovbuf)); |
777 | retcode = retcode >= 0 ? 0 : retcode; | 780 | retcode = retcode >= 0 ? 0 : retcode; |
@@ -787,8 +790,11 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable) | |||
787 | { | 790 | { |
788 | char iovbuf[32]; | 791 | char iovbuf[32]; |
789 | int retcode; | 792 | int retcode; |
793 | __le32 arp_enable_le; | ||
790 | 794 | ||
791 | brcmf_c_mkiovar("arpoe", (char *)&arp_enable, 4, | 795 | arp_enable_le = cpu_to_le32(arp_enable); |
796 | |||
797 | brcmf_c_mkiovar("arpoe", (char *)&arp_enable_le, 4, | ||
792 | iovbuf, sizeof(iovbuf)); | 798 | iovbuf, sizeof(iovbuf)); |
793 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | 799 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, |
794 | iovbuf, sizeof(iovbuf)); | 800 | iovbuf, sizeof(iovbuf)); |
@@ -806,10 +812,10 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
806 | char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for | 812 | char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for |
807 | "event_msgs" + '\0' + bitvec */ | 813 | "event_msgs" + '\0' + bitvec */ |
808 | char buf[128], *ptr; | 814 | char buf[128], *ptr; |
809 | u32 roaming = 1; | 815 | __le32 roaming_le = cpu_to_le32(1); |
810 | uint bcn_timeout = 3; | 816 | __le32 bcn_timeout_le = cpu_to_le32(3); |
811 | int scan_assoc_time = 40; | 817 | __le32 scan_assoc_time_le = cpu_to_le32(40); |
812 | int scan_unassoc_time = 40; | 818 | __le32 scan_unassoc_time_le = cpu_to_le32(40); |
813 | int i; | 819 | int i; |
814 | struct brcmf_bus_dcmd *cmdlst; | 820 | struct brcmf_bus_dcmd *cmdlst; |
815 | struct list_head *cur, *q; | 821 | struct list_head *cur, *q; |
@@ -835,14 +841,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
835 | 841 | ||
836 | /* Setup timeout if Beacons are lost and roam is off to report | 842 | /* Setup timeout if Beacons are lost and roam is off to report |
837 | link down */ | 843 | link down */ |
838 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, | 844 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout_le, 4, iovbuf, |
839 | sizeof(iovbuf)); | 845 | sizeof(iovbuf)); |
840 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 846 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
841 | sizeof(iovbuf)); | 847 | sizeof(iovbuf)); |
842 | 848 | ||
843 | /* Enable/Disable build-in roaming to allowed ext supplicant to take | 849 | /* Enable/Disable build-in roaming to allowed ext supplicant to take |
844 | of romaing */ | 850 | of romaing */ |
845 | brcmf_c_mkiovar("roam_off", (char *)&roaming, 4, | 851 | brcmf_c_mkiovar("roam_off", (char *)&roaming_le, 4, |
846 | iovbuf, sizeof(iovbuf)); | 852 | iovbuf, sizeof(iovbuf)); |
847 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 853 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
848 | sizeof(iovbuf)); | 854 | sizeof(iovbuf)); |
@@ -854,9 +860,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
854 | sizeof(iovbuf)); | 860 | sizeof(iovbuf)); |
855 | 861 | ||
856 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME, | 862 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME, |
857 | (char *)&scan_assoc_time, sizeof(scan_assoc_time)); | 863 | (char *)&scan_assoc_time_le, sizeof(scan_assoc_time_le)); |
858 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME, | 864 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME, |
859 | (char *)&scan_unassoc_time, sizeof(scan_unassoc_time)); | 865 | (char *)&scan_unassoc_time_le, sizeof(scan_unassoc_time_le)); |
860 | 866 | ||
861 | /* Set and enable ARP offload feature */ | 867 | /* Set and enable ARP offload feature */ |
862 | brcmf_c_arp_offload_set(drvr, BRCMF_ARPOL_MODE); | 868 | brcmf_c_arp_offload_set(drvr, BRCMF_ARPOL_MODE); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 65cf8f92cb3e..32ee05297ccf 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -501,8 +501,10 @@ static void brcmf_iscan_prep(struct brcmf_scan_params_le *params_le, | |||
501 | params_le->active_time = cpu_to_le32(-1); | 501 | params_le->active_time = cpu_to_le32(-1); |
502 | params_le->passive_time = cpu_to_le32(-1); | 502 | params_le->passive_time = cpu_to_le32(-1); |
503 | params_le->home_time = cpu_to_le32(-1); | 503 | params_le->home_time = cpu_to_le32(-1); |
504 | if (ssid && ssid->SSID_len) | 504 | if (ssid && ssid->SSID_len) { |
505 | memcpy(¶ms_le->ssid_le, ssid, sizeof(struct brcmf_ssid)); | 505 | params_le->ssid_le.SSID_len = cpu_to_le32(ssid->SSID_len); |
506 | memcpy(¶ms_le->ssid_le.SSID, ssid->SSID, ssid->SSID_len); | ||
507 | } | ||
506 | } | 508 | } |
507 | 509 | ||
508 | static s32 | 510 | static s32 |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c index 7ed7d7577024..64a48f06d68b 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c | |||
@@ -77,7 +77,7 @@ | |||
77 | NL80211_RRF_NO_IBSS) | 77 | NL80211_RRF_NO_IBSS) |
78 | 78 | ||
79 | static const struct ieee80211_regdomain brcms_regdom_x2 = { | 79 | static const struct ieee80211_regdomain brcms_regdom_x2 = { |
80 | .n_reg_rules = 7, | 80 | .n_reg_rules = 6, |
81 | .alpha2 = "X2", | 81 | .alpha2 = "X2", |
82 | .reg_rules = { | 82 | .reg_rules = { |
83 | BRCM_2GHZ_2412_2462, | 83 | BRCM_2GHZ_2412_2462, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 848851177e7e..76aa5031f7ba 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -1442,6 +1442,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
1442 | return err; | 1442 | return err; |
1443 | 1443 | ||
1444 | err_free_irq: | 1444 | err_free_irq: |
1445 | trans_pcie->irq_requested = false; | ||
1445 | free_irq(trans_pcie->irq, trans); | 1446 | free_irq(trans_pcie->irq, trans); |
1446 | error: | 1447 | error: |
1447 | iwl_free_isr_ict(trans); | 1448 | iwl_free_isr_ict(trans); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h index 04c3aef8a4f6..2925094b2d91 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h | |||
@@ -117,6 +117,7 @@ | |||
117 | 117 | ||
118 | #define CHIP_VER_B BIT(4) | 118 | #define CHIP_VER_B BIT(4) |
119 | #define CHIP_92C_BITMASK BIT(0) | 119 | #define CHIP_92C_BITMASK BIT(0) |
120 | #define CHIP_UNKNOWN BIT(7) | ||
120 | #define CHIP_92C_1T2R 0x03 | 121 | #define CHIP_92C_1T2R 0x03 |
121 | #define CHIP_92C 0x01 | 122 | #define CHIP_92C 0x01 |
122 | #define CHIP_88C 0x00 | 123 | #define CHIP_88C 0x00 |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index cc895828c0ea..86d73b32d995 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | |||
@@ -994,8 +994,16 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw) | |||
994 | version = (value32 & TYPE_ID) ? VERSION_A_CHIP_92C : | 994 | version = (value32 & TYPE_ID) ? VERSION_A_CHIP_92C : |
995 | VERSION_A_CHIP_88C; | 995 | VERSION_A_CHIP_88C; |
996 | } else { | 996 | } else { |
997 | version = (value32 & TYPE_ID) ? VERSION_B_CHIP_92C : | 997 | version = (enum version_8192c) (CHIP_VER_B | |
998 | VERSION_B_CHIP_88C; | 998 | ((value32 & TYPE_ID) ? CHIP_92C_BITMASK : 0) | |
999 | ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : 0)); | ||
1000 | if ((!IS_CHIP_VENDOR_UMC(version)) && (value32 & | ||
1001 | CHIP_VER_RTL_MASK)) { | ||
1002 | version = (enum version_8192c)(version | | ||
1003 | ((((value32 & CHIP_VER_RTL_MASK) == BIT(12)) | ||
1004 | ? CHIP_VENDOR_UMC_B_CUT : CHIP_UNKNOWN) | | ||
1005 | CHIP_VENDOR_UMC)); | ||
1006 | } | ||
999 | } | 1007 | } |
1000 | 1008 | ||
1001 | switch (version) { | 1009 | switch (version) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c index 60451eea4d82..ea2e1bd847c8 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | |||
@@ -162,10 +162,12 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) | |||
162 | 162 | ||
163 | /* request fw */ | 163 | /* request fw */ |
164 | if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && | 164 | if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && |
165 | !IS_92C_SERIAL(rtlhal->version)) | 165 | !IS_92C_SERIAL(rtlhal->version)) { |
166 | rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin"; | 166 | rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin"; |
167 | else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) | 167 | } else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { |
168 | rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin"; | 168 | rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin"; |
169 | pr_info("****** This B_CUT device may not work with kernels 3.6 and earlier\n"); | ||
170 | } | ||
169 | 171 | ||
170 | rtlpriv->max_fw_size = 0x4000; | 172 | rtlpriv->max_fw_size = 0x4000; |
171 | pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); | 173 | pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); |
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index 0b66d0f25922..4b6688909fee 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c | |||
@@ -100,6 +100,13 @@ static int ecap_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
100 | writel(period_cycles, pc->mmio_base + CAP3); | 100 | writel(period_cycles, pc->mmio_base + CAP3); |
101 | } | 101 | } |
102 | 102 | ||
103 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | ||
104 | reg_val = readw(pc->mmio_base + ECCTL2); | ||
105 | /* Disable APWM mode to put APWM output Low */ | ||
106 | reg_val &= ~ECCTL2_APWM_MODE; | ||
107 | writew(reg_val, pc->mmio_base + ECCTL2); | ||
108 | } | ||
109 | |||
103 | pm_runtime_put_sync(pc->chip.dev); | 110 | pm_runtime_put_sync(pc->chip.dev); |
104 | return 0; | 111 | return 0; |
105 | } | 112 | } |
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index c3756d1be194..b1996bcd5b78 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c | |||
@@ -104,6 +104,7 @@ struct ehrpwm_pwm_chip { | |||
104 | struct pwm_chip chip; | 104 | struct pwm_chip chip; |
105 | unsigned int clk_rate; | 105 | unsigned int clk_rate; |
106 | void __iomem *mmio_base; | 106 | void __iomem *mmio_base; |
107 | unsigned long period_cycles[NUM_PWM_CHANNEL]; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | static inline struct ehrpwm_pwm_chip *to_ehrpwm_pwm_chip(struct pwm_chip *chip) | 110 | static inline struct ehrpwm_pwm_chip *to_ehrpwm_pwm_chip(struct pwm_chip *chip) |
@@ -210,6 +211,7 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
210 | unsigned long long c; | 211 | unsigned long long c; |
211 | unsigned long period_cycles, duty_cycles; | 212 | unsigned long period_cycles, duty_cycles; |
212 | unsigned short ps_divval, tb_divval; | 213 | unsigned short ps_divval, tb_divval; |
214 | int i; | ||
213 | 215 | ||
214 | if (period_ns < 0 || duty_ns < 0 || period_ns > NSEC_PER_SEC) | 216 | if (period_ns < 0 || duty_ns < 0 || period_ns > NSEC_PER_SEC) |
215 | return -ERANGE; | 217 | return -ERANGE; |
@@ -229,6 +231,28 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
229 | duty_cycles = (unsigned long)c; | 231 | duty_cycles = (unsigned long)c; |
230 | } | 232 | } |
231 | 233 | ||
234 | /* | ||
235 | * Period values should be same for multiple PWM channels as IP uses | ||
236 | * same period register for multiple channels. | ||
237 | */ | ||
238 | for (i = 0; i < NUM_PWM_CHANNEL; i++) { | ||
239 | if (pc->period_cycles[i] && | ||
240 | (pc->period_cycles[i] != period_cycles)) { | ||
241 | /* | ||
242 | * Allow channel to reconfigure period if no other | ||
243 | * channels being configured. | ||
244 | */ | ||
245 | if (i == pwm->hwpwm) | ||
246 | continue; | ||
247 | |||
248 | dev_err(chip->dev, "Period value conflicts with channel %d\n", | ||
249 | i); | ||
250 | return -EINVAL; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | pc->period_cycles[pwm->hwpwm] = period_cycles; | ||
255 | |||
232 | /* Configure clock prescaler to support Low frequency PWM wave */ | 256 | /* Configure clock prescaler to support Low frequency PWM wave */ |
233 | if (set_prescale_div(period_cycles/PERIOD_MAX, &ps_divval, | 257 | if (set_prescale_div(period_cycles/PERIOD_MAX, &ps_divval, |
234 | &tb_divval)) { | 258 | &tb_divval)) { |
@@ -320,10 +344,15 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) | |||
320 | 344 | ||
321 | static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) | 345 | static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) |
322 | { | 346 | { |
347 | struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip); | ||
348 | |||
323 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { | 349 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { |
324 | dev_warn(chip->dev, "Removing PWM device without disabling\n"); | 350 | dev_warn(chip->dev, "Removing PWM device without disabling\n"); |
325 | pm_runtime_put_sync(chip->dev); | 351 | pm_runtime_put_sync(chip->dev); |
326 | } | 352 | } |
353 | |||
354 | /* set period value to zero on free */ | ||
355 | pc->period_cycles[pwm->hwpwm] = 0; | ||
327 | } | 356 | } |
328 | 357 | ||
329 | static const struct pwm_ops ehrpwm_pwm_ops = { | 358 | static const struct pwm_ops ehrpwm_pwm_ops = { |
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index 6caa222af77a..ab00cab905b7 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | 24 | ||
25 | #include <linux/regulator/of_regulator.h> | ||
25 | #include <linux/regulator/driver.h> | 26 | #include <linux/regulator/driver.h> |
26 | #include <linux/regulator/machine.h> | 27 | #include <linux/regulator/machine.h> |
27 | #include <linux/mfd/tps65217.h> | 28 | #include <linux/mfd/tps65217.h> |
@@ -281,37 +282,130 @@ static const struct regulator_desc regulators[] = { | |||
281 | NULL), | 282 | NULL), |
282 | }; | 283 | }; |
283 | 284 | ||
285 | #ifdef CONFIG_OF | ||
286 | static struct of_regulator_match reg_matches[] = { | ||
287 | { .name = "dcdc1", .driver_data = (void *)TPS65217_DCDC_1 }, | ||
288 | { .name = "dcdc2", .driver_data = (void *)TPS65217_DCDC_2 }, | ||
289 | { .name = "dcdc3", .driver_data = (void *)TPS65217_DCDC_3 }, | ||
290 | { .name = "ldo1", .driver_data = (void *)TPS65217_LDO_1 }, | ||
291 | { .name = "ldo2", .driver_data = (void *)TPS65217_LDO_2 }, | ||
292 | { .name = "ldo3", .driver_data = (void *)TPS65217_LDO_3 }, | ||
293 | { .name = "ldo4", .driver_data = (void *)TPS65217_LDO_4 }, | ||
294 | }; | ||
295 | |||
296 | static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) | ||
297 | { | ||
298 | struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); | ||
299 | struct device_node *node = tps->dev->of_node; | ||
300 | struct tps65217_board *pdata; | ||
301 | struct device_node *regs; | ||
302 | int i, count; | ||
303 | |||
304 | regs = of_find_node_by_name(node, "regulators"); | ||
305 | if (!regs) | ||
306 | return NULL; | ||
307 | |||
308 | count = of_regulator_match(pdev->dev.parent, regs, | ||
309 | reg_matches, TPS65217_NUM_REGULATOR); | ||
310 | of_node_put(regs); | ||
311 | if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) | ||
312 | return NULL; | ||
313 | |||
314 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
315 | if (!pdata) | ||
316 | return NULL; | ||
317 | |||
318 | for (i = 0; i < count; i++) { | ||
319 | if (!reg_matches[i].init_data || !reg_matches[i].of_node) | ||
320 | continue; | ||
321 | |||
322 | pdata->tps65217_init_data[i] = reg_matches[i].init_data; | ||
323 | pdata->of_node[i] = reg_matches[i].of_node; | ||
324 | } | ||
325 | |||
326 | return pdata; | ||
327 | } | ||
328 | #else | ||
329 | static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) | ||
330 | { | ||
331 | return NULL; | ||
332 | } | ||
333 | #endif | ||
334 | |||
284 | static int __devinit tps65217_regulator_probe(struct platform_device *pdev) | 335 | static int __devinit tps65217_regulator_probe(struct platform_device *pdev) |
285 | { | 336 | { |
337 | struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); | ||
338 | struct tps65217_board *pdata = dev_get_platdata(tps->dev); | ||
339 | struct regulator_init_data *reg_data; | ||
286 | struct regulator_dev *rdev; | 340 | struct regulator_dev *rdev; |
287 | struct tps65217 *tps; | ||
288 | struct tps_info *info = &tps65217_pmic_regs[pdev->id]; | ||
289 | struct regulator_config config = { }; | 341 | struct regulator_config config = { }; |
342 | int i, ret; | ||
290 | 343 | ||
291 | /* Already set by core driver */ | 344 | if (tps->dev->of_node) |
292 | tps = dev_to_tps65217(pdev->dev.parent); | 345 | pdata = tps65217_parse_dt(pdev); |
293 | tps->info[pdev->id] = info; | ||
294 | 346 | ||
295 | config.dev = &pdev->dev; | 347 | if (!pdata) { |
296 | config.of_node = pdev->dev.of_node; | 348 | dev_err(&pdev->dev, "Platform data not found\n"); |
297 | config.init_data = pdev->dev.platform_data; | 349 | return -EINVAL; |
298 | config.driver_data = tps; | 350 | } |
299 | 351 | ||
300 | rdev = regulator_register(®ulators[pdev->id], &config); | 352 | if (tps65217_chip_id(tps) != TPS65217) { |
301 | if (IS_ERR(rdev)) | 353 | dev_err(&pdev->dev, "Invalid tps chip version\n"); |
302 | return PTR_ERR(rdev); | 354 | return -ENODEV; |
355 | } | ||
303 | 356 | ||
304 | platform_set_drvdata(pdev, rdev); | 357 | platform_set_drvdata(pdev, tps); |
305 | 358 | ||
359 | for (i = 0; i < TPS65217_NUM_REGULATOR; i++) { | ||
360 | |||
361 | reg_data = pdata->tps65217_init_data[i]; | ||
362 | |||
363 | /* | ||
364 | * Regulator API handles empty constraints but not NULL | ||
365 | * constraints | ||
366 | */ | ||
367 | if (!reg_data) | ||
368 | continue; | ||
369 | |||
370 | /* Register the regulators */ | ||
371 | tps->info[i] = &tps65217_pmic_regs[i]; | ||
372 | |||
373 | config.dev = tps->dev; | ||
374 | config.init_data = reg_data; | ||
375 | config.driver_data = tps; | ||
376 | config.regmap = tps->regmap; | ||
377 | if (tps->dev->of_node) | ||
378 | config.of_node = pdata->of_node[i]; | ||
379 | |||
380 | rdev = regulator_register(®ulators[i], &config); | ||
381 | if (IS_ERR(rdev)) { | ||
382 | dev_err(tps->dev, "failed to register %s regulator\n", | ||
383 | pdev->name); | ||
384 | ret = PTR_ERR(rdev); | ||
385 | goto err_unregister_regulator; | ||
386 | } | ||
387 | |||
388 | /* Save regulator for cleanup */ | ||
389 | tps->rdev[i] = rdev; | ||
390 | } | ||
306 | return 0; | 391 | return 0; |
392 | |||
393 | err_unregister_regulator: | ||
394 | while (--i >= 0) | ||
395 | regulator_unregister(tps->rdev[i]); | ||
396 | |||
397 | return ret; | ||
307 | } | 398 | } |
308 | 399 | ||
309 | static int __devexit tps65217_regulator_remove(struct platform_device *pdev) | 400 | static int __devexit tps65217_regulator_remove(struct platform_device *pdev) |
310 | { | 401 | { |
311 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | 402 | struct tps65217 *tps = platform_get_drvdata(pdev); |
403 | unsigned int i; | ||
404 | |||
405 | for (i = 0; i < TPS65217_NUM_REGULATOR; i++) | ||
406 | regulator_unregister(tps->rdev[i]); | ||
312 | 407 | ||
313 | platform_set_drvdata(pdev, NULL); | 408 | platform_set_drvdata(pdev, NULL); |
314 | regulator_unregister(rdev); | ||
315 | 409 | ||
316 | return 0; | 410 | return 0; |
317 | } | 411 | } |
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 590cfafc7c17..1859f71372e2 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
@@ -1008,8 +1008,8 @@ static int rpmsg_probe(struct virtio_device *vdev) | |||
1008 | return 0; | 1008 | return 0; |
1009 | 1009 | ||
1010 | free_coherent: | 1010 | free_coherent: |
1011 | dma_free_coherent(vdev->dev.parent, RPMSG_TOTAL_BUF_SPACE, bufs_va, | 1011 | dma_free_coherent(vdev->dev.parent->parent, RPMSG_TOTAL_BUF_SPACE, |
1012 | vrp->bufs_dma); | 1012 | bufs_va, vrp->bufs_dma); |
1013 | vqs_del: | 1013 | vqs_del: |
1014 | vdev->config->del_vqs(vrp->vdev); | 1014 | vdev->config->del_vqs(vrp->vdev); |
1015 | free_vrp: | 1015 | free_vrp: |
@@ -1043,7 +1043,7 @@ static void __devexit rpmsg_remove(struct virtio_device *vdev) | |||
1043 | 1043 | ||
1044 | vdev->config->del_vqs(vrp->vdev); | 1044 | vdev->config->del_vqs(vrp->vdev); |
1045 | 1045 | ||
1046 | dma_free_coherent(vdev->dev.parent, RPMSG_TOTAL_BUF_SPACE, | 1046 | dma_free_coherent(vdev->dev.parent->parent, RPMSG_TOTAL_BUF_SPACE, |
1047 | vrp->rbufs, vrp->bufs_dma); | 1047 | vrp->rbufs, vrp->bufs_dma); |
1048 | 1048 | ||
1049 | kfree(vrp); | 1049 | kfree(vrp); |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index c5d06fe83bba..9277d945bf48 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -495,6 +495,11 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
495 | if (ret < 0) | 495 | if (ret < 0) |
496 | goto out1; | 496 | goto out1; |
497 | 497 | ||
498 | /* ensure interrupts are disabled, bootloaders can be strange */ | ||
499 | ret = twl_rtc_write_u8(0, REG_RTC_INTERRUPTS_REG); | ||
500 | if (ret < 0) | ||
501 | dev_warn(&pdev->dev, "unable to disable interrupt\n"); | ||
502 | |||
498 | /* init cached IRQ enable bits */ | 503 | /* init cached IRQ enable bits */ |
499 | ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); | 504 | ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); |
500 | if (ret < 0) | 505 | if (ret < 0) |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 15370a2c5ff0..0595c763dafd 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -534,11 +534,11 @@ static void dasd_change_state(struct dasd_device *device) | |||
534 | if (rc) | 534 | if (rc) |
535 | device->target = device->state; | 535 | device->target = device->state; |
536 | 536 | ||
537 | if (device->state == device->target) | ||
538 | wake_up(&dasd_init_waitq); | ||
539 | |||
540 | /* let user-space know that the device status changed */ | 537 | /* let user-space know that the device status changed */ |
541 | kobject_uevent(&device->cdev->dev.kobj, KOBJ_CHANGE); | 538 | kobject_uevent(&device->cdev->dev.kobj, KOBJ_CHANGE); |
539 | |||
540 | if (device->state == device->target) | ||
541 | wake_up(&dasd_init_waitq); | ||
542 | } | 542 | } |
543 | 543 | ||
544 | /* | 544 | /* |
@@ -2157,6 +2157,7 @@ static int _dasd_sleep_on(struct dasd_ccw_req *maincqr, int interruptible) | |||
2157 | test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && | 2157 | test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && |
2158 | (!dasd_eer_enabled(device))) { | 2158 | (!dasd_eer_enabled(device))) { |
2159 | cqr->status = DASD_CQR_FAILED; | 2159 | cqr->status = DASD_CQR_FAILED; |
2160 | cqr->intrc = -EAGAIN; | ||
2160 | continue; | 2161 | continue; |
2161 | } | 2162 | } |
2162 | /* Don't try to start requests if device is stopped */ | 2163 | /* Don't try to start requests if device is stopped */ |
@@ -3270,6 +3271,16 @@ void dasd_generic_path_event(struct ccw_device *cdev, int *path_event) | |||
3270 | dasd_schedule_device_bh(device); | 3271 | dasd_schedule_device_bh(device); |
3271 | } | 3272 | } |
3272 | if (path_event[chp] & PE_PATHGROUP_ESTABLISHED) { | 3273 | if (path_event[chp] & PE_PATHGROUP_ESTABLISHED) { |
3274 | if (!(device->path_data.opm & eventlpm) && | ||
3275 | !(device->path_data.tbvpm & eventlpm)) { | ||
3276 | /* | ||
3277 | * we can not establish a pathgroup on an | ||
3278 | * unavailable path, so trigger a path | ||
3279 | * verification first | ||
3280 | */ | ||
3281 | device->path_data.tbvpm |= eventlpm; | ||
3282 | dasd_schedule_device_bh(device); | ||
3283 | } | ||
3273 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", | 3284 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
3274 | "Pathgroup re-established\n"); | 3285 | "Pathgroup re-established\n"); |
3275 | if (device->discipline->kick_validate) | 3286 | if (device->discipline->kick_validate) |
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index 157defe5e069..6b556995bb33 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c | |||
@@ -384,6 +384,29 @@ static void _remove_device_from_lcu(struct alias_lcu *lcu, | |||
384 | group->next = NULL; | 384 | group->next = NULL; |
385 | }; | 385 | }; |
386 | 386 | ||
387 | static int | ||
388 | suborder_not_supported(struct dasd_ccw_req *cqr) | ||
389 | { | ||
390 | char *sense; | ||
391 | char reason; | ||
392 | char msg_format; | ||
393 | char msg_no; | ||
394 | |||
395 | sense = dasd_get_sense(&cqr->irb); | ||
396 | if (!sense) | ||
397 | return 0; | ||
398 | |||
399 | reason = sense[0]; | ||
400 | msg_format = (sense[7] & 0xF0); | ||
401 | msg_no = (sense[7] & 0x0F); | ||
402 | |||
403 | /* command reject, Format 0 MSG 4 - invalid parameter */ | ||
404 | if ((reason == 0x80) && (msg_format == 0x00) && (msg_no == 0x04)) | ||
405 | return 1; | ||
406 | |||
407 | return 0; | ||
408 | } | ||
409 | |||
387 | static int read_unit_address_configuration(struct dasd_device *device, | 410 | static int read_unit_address_configuration(struct dasd_device *device, |
388 | struct alias_lcu *lcu) | 411 | struct alias_lcu *lcu) |
389 | { | 412 | { |
@@ -435,6 +458,8 @@ static int read_unit_address_configuration(struct dasd_device *device, | |||
435 | 458 | ||
436 | do { | 459 | do { |
437 | rc = dasd_sleep_on(cqr); | 460 | rc = dasd_sleep_on(cqr); |
461 | if (rc && suborder_not_supported(cqr)) | ||
462 | return -EOPNOTSUPP; | ||
438 | } while (rc && (cqr->retries > 0)); | 463 | } while (rc && (cqr->retries > 0)); |
439 | if (rc) { | 464 | if (rc) { |
440 | spin_lock_irqsave(&lcu->lock, flags); | 465 | spin_lock_irqsave(&lcu->lock, flags); |
@@ -521,7 +546,7 @@ static void lcu_update_work(struct work_struct *work) | |||
521 | * processing the data | 546 | * processing the data |
522 | */ | 547 | */ |
523 | spin_lock_irqsave(&lcu->lock, flags); | 548 | spin_lock_irqsave(&lcu->lock, flags); |
524 | if (rc || (lcu->flags & NEED_UAC_UPDATE)) { | 549 | if ((rc && (rc != -EOPNOTSUPP)) || (lcu->flags & NEED_UAC_UPDATE)) { |
525 | DBF_DEV_EVENT(DBF_WARNING, device, "could not update" | 550 | DBF_DEV_EVENT(DBF_WARNING, device, "could not update" |
526 | " alias data in lcu (rc = %d), retry later", rc); | 551 | " alias data in lcu (rc = %d), retry later", rc); |
527 | schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ); | 552 | schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ); |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 2fb2b9ea97ec..c48c72abbefc 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1507,7 +1507,8 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device, | |||
1507 | * call might change behaviour of DASD devices. | 1507 | * call might change behaviour of DASD devices. |
1508 | */ | 1508 | */ |
1509 | static int | 1509 | static int |
1510 | dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav) | 1510 | dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav, |
1511 | unsigned long flags) | ||
1511 | { | 1512 | { |
1512 | struct dasd_ccw_req *cqr; | 1513 | struct dasd_ccw_req *cqr; |
1513 | int rc; | 1514 | int rc; |
@@ -1516,10 +1517,19 @@ dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav) | |||
1516 | if (IS_ERR(cqr)) | 1517 | if (IS_ERR(cqr)) |
1517 | return PTR_ERR(cqr); | 1518 | return PTR_ERR(cqr); |
1518 | 1519 | ||
1520 | /* | ||
1521 | * set flags e.g. turn on failfast, to prevent blocking | ||
1522 | * the calling function should handle failed requests | ||
1523 | */ | ||
1524 | cqr->flags |= flags; | ||
1525 | |||
1519 | rc = dasd_sleep_on(cqr); | 1526 | rc = dasd_sleep_on(cqr); |
1520 | if (!rc) | 1527 | if (!rc) |
1521 | /* trigger CIO to reprobe devices */ | 1528 | /* trigger CIO to reprobe devices */ |
1522 | css_schedule_reprobe(); | 1529 | css_schedule_reprobe(); |
1530 | else if (cqr->intrc == -EAGAIN) | ||
1531 | rc = -EAGAIN; | ||
1532 | |||
1523 | dasd_sfree_request(cqr, cqr->memdev); | 1533 | dasd_sfree_request(cqr, cqr->memdev); |
1524 | return rc; | 1534 | return rc; |
1525 | } | 1535 | } |
@@ -1527,7 +1537,8 @@ dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav) | |||
1527 | /* | 1537 | /* |
1528 | * Valide storage server of current device. | 1538 | * Valide storage server of current device. |
1529 | */ | 1539 | */ |
1530 | static void dasd_eckd_validate_server(struct dasd_device *device) | 1540 | static int dasd_eckd_validate_server(struct dasd_device *device, |
1541 | unsigned long flags) | ||
1531 | { | 1542 | { |
1532 | int rc; | 1543 | int rc; |
1533 | struct dasd_eckd_private *private; | 1544 | struct dasd_eckd_private *private; |
@@ -1536,17 +1547,18 @@ static void dasd_eckd_validate_server(struct dasd_device *device) | |||
1536 | private = (struct dasd_eckd_private *) device->private; | 1547 | private = (struct dasd_eckd_private *) device->private; |
1537 | if (private->uid.type == UA_BASE_PAV_ALIAS || | 1548 | if (private->uid.type == UA_BASE_PAV_ALIAS || |
1538 | private->uid.type == UA_HYPER_PAV_ALIAS) | 1549 | private->uid.type == UA_HYPER_PAV_ALIAS) |
1539 | return; | 1550 | return 0; |
1540 | if (dasd_nopav || MACHINE_IS_VM) | 1551 | if (dasd_nopav || MACHINE_IS_VM) |
1541 | enable_pav = 0; | 1552 | enable_pav = 0; |
1542 | else | 1553 | else |
1543 | enable_pav = 1; | 1554 | enable_pav = 1; |
1544 | rc = dasd_eckd_psf_ssc(device, enable_pav); | 1555 | rc = dasd_eckd_psf_ssc(device, enable_pav, flags); |
1545 | 1556 | ||
1546 | /* may be requested feature is not available on server, | 1557 | /* may be requested feature is not available on server, |
1547 | * therefore just report error and go ahead */ | 1558 | * therefore just report error and go ahead */ |
1548 | DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "PSF-SSC for SSID %04x " | 1559 | DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "PSF-SSC for SSID %04x " |
1549 | "returned rc=%d", private->uid.ssid, rc); | 1560 | "returned rc=%d", private->uid.ssid, rc); |
1561 | return rc; | ||
1550 | } | 1562 | } |
1551 | 1563 | ||
1552 | /* | 1564 | /* |
@@ -1556,7 +1568,13 @@ static void dasd_eckd_do_validate_server(struct work_struct *work) | |||
1556 | { | 1568 | { |
1557 | struct dasd_device *device = container_of(work, struct dasd_device, | 1569 | struct dasd_device *device = container_of(work, struct dasd_device, |
1558 | kick_validate); | 1570 | kick_validate); |
1559 | dasd_eckd_validate_server(device); | 1571 | if (dasd_eckd_validate_server(device, DASD_CQR_FLAGS_FAILFAST) |
1572 | == -EAGAIN) { | ||
1573 | /* schedule worker again if failed */ | ||
1574 | schedule_work(&device->kick_validate); | ||
1575 | return; | ||
1576 | } | ||
1577 | |||
1560 | dasd_put_device(device); | 1578 | dasd_put_device(device); |
1561 | } | 1579 | } |
1562 | 1580 | ||
@@ -1685,7 +1703,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1685 | if (rc) | 1703 | if (rc) |
1686 | goto out_err2; | 1704 | goto out_err2; |
1687 | 1705 | ||
1688 | dasd_eckd_validate_server(device); | 1706 | dasd_eckd_validate_server(device, 0); |
1689 | 1707 | ||
1690 | /* device may report different configuration data after LCU setup */ | 1708 | /* device may report different configuration data after LCU setup */ |
1691 | rc = dasd_eckd_read_conf(device); | 1709 | rc = dasd_eckd_read_conf(device); |
@@ -4153,7 +4171,7 @@ static int dasd_eckd_restore_device(struct dasd_device *device) | |||
4153 | rc = dasd_alias_make_device_known_to_lcu(device); | 4171 | rc = dasd_alias_make_device_known_to_lcu(device); |
4154 | if (rc) | 4172 | if (rc) |
4155 | return rc; | 4173 | return rc; |
4156 | dasd_eckd_validate_server(device); | 4174 | dasd_eckd_validate_server(device, DASD_CQR_FLAGS_FAILFAST); |
4157 | 4175 | ||
4158 | /* RE-Read Configuration Data */ | 4176 | /* RE-Read Configuration Data */ |
4159 | rc = dasd_eckd_read_conf(device); | 4177 | rc = dasd_eckd_read_conf(device); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index ed25c8740a9c..fc916f5d7314 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1426,6 +1426,8 @@ static enum io_sch_action sch_get_action(struct subchannel *sch) | |||
1426 | return IO_SCH_REPROBE; | 1426 | return IO_SCH_REPROBE; |
1427 | if (cdev->online) | 1427 | if (cdev->online) |
1428 | return IO_SCH_VERIFY; | 1428 | return IO_SCH_VERIFY; |
1429 | if (cdev->private->state == DEV_STATE_NOT_OPER) | ||
1430 | return IO_SCH_UNREG_ATTACH; | ||
1429 | return IO_SCH_NOP; | 1431 | return IO_SCH_NOP; |
1430 | } | 1432 | } |
1431 | 1433 | ||
@@ -1519,11 +1521,14 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process) | |||
1519 | goto out; | 1521 | goto out; |
1520 | break; | 1522 | break; |
1521 | case IO_SCH_UNREG_ATTACH: | 1523 | case IO_SCH_UNREG_ATTACH: |
1524 | spin_lock_irqsave(sch->lock, flags); | ||
1522 | if (cdev->private->flags.resuming) { | 1525 | if (cdev->private->flags.resuming) { |
1523 | /* Device will be handled later. */ | 1526 | /* Device will be handled later. */ |
1524 | rc = 0; | 1527 | rc = 0; |
1525 | goto out; | 1528 | goto out_unlock; |
1526 | } | 1529 | } |
1530 | sch_set_cdev(sch, NULL); | ||
1531 | spin_unlock_irqrestore(sch->lock, flags); | ||
1527 | /* Unregister ccw device. */ | 1532 | /* Unregister ccw device. */ |
1528 | ccw_device_unregister(cdev); | 1533 | ccw_device_unregister(cdev); |
1529 | break; | 1534 | break; |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 33d6630529de..91eec60252ee 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
@@ -1264,6 +1264,9 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) | |||
1264 | int rc = 0; | 1264 | int rc = 0; |
1265 | u64 mask64; | 1265 | u64 mask64; |
1266 | 1266 | ||
1267 | memset(&iscsi_init, 0x00, sizeof(struct iscsi_kwqe_init1)); | ||
1268 | memset(&iscsi_init2, 0x00, sizeof(struct iscsi_kwqe_init2)); | ||
1269 | |||
1267 | bnx2i_adjust_qp_size(hba); | 1270 | bnx2i_adjust_qp_size(hba); |
1268 | 1271 | ||
1269 | iscsi_init.flags = | 1272 | iscsi_init.flags = |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 796482badf13..2b4261cb7742 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -1315,8 +1315,9 @@ static void complete_scsi_command(struct CommandList *cp) | |||
1315 | } | 1315 | } |
1316 | break; | 1316 | break; |
1317 | case CMD_PROTOCOL_ERR: | 1317 | case CMD_PROTOCOL_ERR: |
1318 | cmd->result = DID_ERROR << 16; | ||
1318 | dev_warn(&h->pdev->dev, "cp %p has " | 1319 | dev_warn(&h->pdev->dev, "cp %p has " |
1319 | "protocol error \n", cp); | 1320 | "protocol error\n", cp); |
1320 | break; | 1321 | break; |
1321 | case CMD_HARDWARE_ERR: | 1322 | case CMD_HARDWARE_ERR: |
1322 | cmd->result = DID_ERROR << 16; | 1323 | cmd->result = DID_ERROR << 16; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index b25757d1e91b..9d5a56c4b332 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -1209,6 +1209,13 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc) | |||
1209 | u16 message_control; | 1209 | u16 message_control; |
1210 | 1210 | ||
1211 | 1211 | ||
1212 | /* Check whether controller SAS2008 B0 controller, | ||
1213 | if it is SAS2008 B0 controller use IO-APIC instead of MSIX */ | ||
1214 | if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 && | ||
1215 | ioc->pdev->revision == 0x01) { | ||
1216 | return -EINVAL; | ||
1217 | } | ||
1218 | |||
1212 | base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX); | 1219 | base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX); |
1213 | if (!base) { | 1220 | if (!base) { |
1214 | dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "msix not " | 1221 | dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "msix not " |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c7030fbee79c..3e79a2f00042 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -331,7 +331,7 @@ static void virtscsi_map_sgl(struct scatterlist *sg, unsigned int *p_idx, | |||
331 | int i; | 331 | int i; |
332 | 332 | ||
333 | for_each_sg(table->sgl, sg_elem, table->nents, i) | 333 | for_each_sg(table->sgl, sg_elem, table->nents, i) |
334 | sg_set_buf(&sg[idx++], sg_virt(sg_elem), sg_elem->length); | 334 | sg[idx++] = *sg_elem; |
335 | 335 | ||
336 | *p_idx = idx; | 336 | *p_idx = idx; |
337 | } | 337 | } |
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index 32c26d795ed0..8f32a1323a79 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c | |||
@@ -355,7 +355,7 @@ int __init register_intc_controller(struct intc_desc *desc) | |||
355 | if (unlikely(res)) { | 355 | if (unlikely(res)) { |
356 | if (res == -EEXIST) { | 356 | if (res == -EEXIST) { |
357 | res = irq_domain_associate(d->domain, | 357 | res = irq_domain_associate(d->domain, |
358 | irq, irq); | 358 | irq2, irq2); |
359 | if (unlikely(res)) { | 359 | if (unlikely(res)) { |
360 | pr_err("domain association " | 360 | pr_err("domain association " |
361 | "failure\n"); | 361 | "failure\n"); |
diff --git a/drivers/sh/pfc/pinctrl.c b/drivers/sh/pfc/pinctrl.c index 2804eaae804e..0646bf6e7889 100644 --- a/drivers/sh/pfc/pinctrl.c +++ b/drivers/sh/pfc/pinctrl.c | |||
@@ -208,10 +208,13 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, | |||
208 | 208 | ||
209 | break; | 209 | break; |
210 | case PINMUX_TYPE_GPIO: | 210 | case PINMUX_TYPE_GPIO: |
211 | case PINMUX_TYPE_INPUT: | ||
212 | case PINMUX_TYPE_OUTPUT: | ||
211 | break; | 213 | break; |
212 | default: | 214 | default: |
213 | pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type); | 215 | pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type); |
214 | return -ENOTSUPP; | 216 | ret = -ENOTSUPP; |
217 | goto err; | ||
215 | } | 218 | } |
216 | 219 | ||
217 | ret = 0; | 220 | ret = 0; |
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 695ea35f75b0..d0a7e408efe9 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c | |||
@@ -837,7 +837,7 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev) | |||
837 | } | 837 | } |
838 | 838 | ||
839 | ret = mfd_add_devices(nvec->dev, -1, nvec_devices, | 839 | ret = mfd_add_devices(nvec->dev, -1, nvec_devices, |
840 | ARRAY_SIZE(nvec_devices), base, 0); | 840 | ARRAY_SIZE(nvec_devices), base, 0, NULL); |
841 | if (ret) | 841 | if (ret) |
842 | dev_err(nvec->dev, "error adding subdevices\n"); | 842 | dev_err(nvec->dev, "error adding subdevices\n"); |
843 | 843 | ||
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 0694d9b1bce6..6aba4395e8d8 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -221,6 +221,7 @@ static int iscsi_login_zero_tsih_s1( | |||
221 | { | 221 | { |
222 | struct iscsi_session *sess = NULL; | 222 | struct iscsi_session *sess = NULL; |
223 | struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf; | 223 | struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf; |
224 | int ret; | ||
224 | 225 | ||
225 | sess = kzalloc(sizeof(struct iscsi_session), GFP_KERNEL); | 226 | sess = kzalloc(sizeof(struct iscsi_session), GFP_KERNEL); |
226 | if (!sess) { | 227 | if (!sess) { |
@@ -257,9 +258,17 @@ static int iscsi_login_zero_tsih_s1( | |||
257 | return -ENOMEM; | 258 | return -ENOMEM; |
258 | } | 259 | } |
259 | spin_lock(&sess_idr_lock); | 260 | spin_lock(&sess_idr_lock); |
260 | idr_get_new(&sess_idr, NULL, &sess->session_index); | 261 | ret = idr_get_new(&sess_idr, NULL, &sess->session_index); |
261 | spin_unlock(&sess_idr_lock); | 262 | spin_unlock(&sess_idr_lock); |
262 | 263 | ||
264 | if (ret < 0) { | ||
265 | pr_err("idr_get_new() for sess_idr failed\n"); | ||
266 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
267 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
268 | kfree(sess); | ||
269 | return -ENOMEM; | ||
270 | } | ||
271 | |||
263 | sess->creation_time = get_jiffies_64(); | 272 | sess->creation_time = get_jiffies_64(); |
264 | spin_lock_init(&sess->session_stats_lock); | 273 | spin_lock_init(&sess->session_stats_lock); |
265 | /* | 274 | /* |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 91799973081a..41641ba54828 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -218,6 +218,13 @@ int target_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
218 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 218 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
219 | return -EINVAL; | 219 | return -EINVAL; |
220 | } | 220 | } |
221 | if (cmd->data_length < 4) { | ||
222 | pr_warn("SET TARGET PORT GROUPS parameter list length %u too" | ||
223 | " small\n", cmd->data_length); | ||
224 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | ||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
221 | buf = transport_kmap_data_sg(cmd); | 228 | buf = transport_kmap_data_sg(cmd); |
222 | 229 | ||
223 | /* | 230 | /* |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index cf2c66f3c116..9fc9a6006ca0 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -669,6 +669,13 @@ int target_report_luns(struct se_cmd *se_cmd) | |||
669 | unsigned char *buf; | 669 | unsigned char *buf; |
670 | u32 lun_count = 0, offset = 8, i; | 670 | u32 lun_count = 0, offset = 8, i; |
671 | 671 | ||
672 | if (se_cmd->data_length < 16) { | ||
673 | pr_warn("REPORT LUNS allocation length %u too small\n", | ||
674 | se_cmd->data_length); | ||
675 | se_cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
676 | return -EINVAL; | ||
677 | } | ||
678 | |||
672 | buf = transport_kmap_data_sg(se_cmd); | 679 | buf = transport_kmap_data_sg(se_cmd); |
673 | if (!buf) | 680 | if (!buf) |
674 | return -ENOMEM; | 681 | return -ENOMEM; |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 76db75e836ed..9ba495477fd2 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -325,17 +325,30 @@ static int iblock_execute_unmap(struct se_cmd *cmd) | |||
325 | struct iblock_dev *ibd = dev->dev_ptr; | 325 | struct iblock_dev *ibd = dev->dev_ptr; |
326 | unsigned char *buf, *ptr = NULL; | 326 | unsigned char *buf, *ptr = NULL; |
327 | sector_t lba; | 327 | sector_t lba; |
328 | int size = cmd->data_length; | 328 | int size; |
329 | u32 range; | 329 | u32 range; |
330 | int ret = 0; | 330 | int ret = 0; |
331 | int dl, bd_dl; | 331 | int dl, bd_dl; |
332 | 332 | ||
333 | if (cmd->data_length < 8) { | ||
334 | pr_warn("UNMAP parameter list length %u too small\n", | ||
335 | cmd->data_length); | ||
336 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | ||
337 | return -EINVAL; | ||
338 | } | ||
339 | |||
333 | buf = transport_kmap_data_sg(cmd); | 340 | buf = transport_kmap_data_sg(cmd); |
334 | 341 | ||
335 | dl = get_unaligned_be16(&buf[0]); | 342 | dl = get_unaligned_be16(&buf[0]); |
336 | bd_dl = get_unaligned_be16(&buf[2]); | 343 | bd_dl = get_unaligned_be16(&buf[2]); |
337 | 344 | ||
338 | size = min(size - 8, bd_dl); | 345 | size = cmd->data_length - 8; |
346 | if (bd_dl > size) | ||
347 | pr_warn("UNMAP parameter list length %u too small, ignoring bd_dl %u\n", | ||
348 | cmd->data_length, bd_dl); | ||
349 | else | ||
350 | size = bd_dl; | ||
351 | |||
339 | if (size / 16 > dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 352 | if (size / 16 > dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
340 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | 353 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
341 | ret = -EINVAL; | 354 | ret = -EINVAL; |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 1e946502c378..956c84c6b666 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -1540,6 +1540,14 @@ static int core_scsi3_decode_spec_i_port( | |||
1540 | tidh_new->dest_local_nexus = 1; | 1540 | tidh_new->dest_local_nexus = 1; |
1541 | list_add_tail(&tidh_new->dest_list, &tid_dest_list); | 1541 | list_add_tail(&tidh_new->dest_list, &tid_dest_list); |
1542 | 1542 | ||
1543 | if (cmd->data_length < 28) { | ||
1544 | pr_warn("SPC-PR: Received PR OUT parameter list" | ||
1545 | " length too small: %u\n", cmd->data_length); | ||
1546 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | ||
1547 | ret = -EINVAL; | ||
1548 | goto out; | ||
1549 | } | ||
1550 | |||
1543 | buf = transport_kmap_data_sg(cmd); | 1551 | buf = transport_kmap_data_sg(cmd); |
1544 | /* | 1552 | /* |
1545 | * For a PERSISTENT RESERVE OUT specify initiator ports payload, | 1553 | * For a PERSISTENT RESERVE OUT specify initiator ports payload, |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 5552fa7426bc..9d7ce3daa262 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -667,7 +667,8 @@ static void pscsi_free_device(void *p) | |||
667 | kfree(pdv); | 667 | kfree(pdv); |
668 | } | 668 | } |
669 | 669 | ||
670 | static int pscsi_transport_complete(struct se_cmd *cmd, struct scatterlist *sg) | 670 | static void pscsi_transport_complete(struct se_cmd *cmd, struct scatterlist *sg, |
671 | unsigned char *sense_buffer) | ||
671 | { | 672 | { |
672 | struct pscsi_dev_virt *pdv = cmd->se_dev->dev_ptr; | 673 | struct pscsi_dev_virt *pdv = cmd->se_dev->dev_ptr; |
673 | struct scsi_device *sd = pdv->pdv_sd; | 674 | struct scsi_device *sd = pdv->pdv_sd; |
@@ -679,7 +680,7 @@ static int pscsi_transport_complete(struct se_cmd *cmd, struct scatterlist *sg) | |||
679 | * not been allocated because TCM is handling the emulation directly. | 680 | * not been allocated because TCM is handling the emulation directly. |
680 | */ | 681 | */ |
681 | if (!pt) | 682 | if (!pt) |
682 | return 0; | 683 | return; |
683 | 684 | ||
684 | cdb = &pt->pscsi_cdb[0]; | 685 | cdb = &pt->pscsi_cdb[0]; |
685 | result = pt->pscsi_result; | 686 | result = pt->pscsi_result; |
@@ -687,11 +688,11 @@ static int pscsi_transport_complete(struct se_cmd *cmd, struct scatterlist *sg) | |||
687 | * Hack to make sure that Write-Protect modepage is set if R/O mode is | 688 | * Hack to make sure that Write-Protect modepage is set if R/O mode is |
688 | * forced. | 689 | * forced. |
689 | */ | 690 | */ |
691 | if (!cmd->se_deve || !cmd->data_length) | ||
692 | goto after_mode_sense; | ||
693 | |||
690 | if (((cdb[0] == MODE_SENSE) || (cdb[0] == MODE_SENSE_10)) && | 694 | if (((cdb[0] == MODE_SENSE) || (cdb[0] == MODE_SENSE_10)) && |
691 | (status_byte(result) << 1) == SAM_STAT_GOOD) { | 695 | (status_byte(result) << 1) == SAM_STAT_GOOD) { |
692 | if (!cmd->se_deve) | ||
693 | goto after_mode_sense; | ||
694 | |||
695 | if (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY) { | 696 | if (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY) { |
696 | unsigned char *buf = transport_kmap_data_sg(cmd); | 697 | unsigned char *buf = transport_kmap_data_sg(cmd); |
697 | 698 | ||
@@ -708,7 +709,7 @@ static int pscsi_transport_complete(struct se_cmd *cmd, struct scatterlist *sg) | |||
708 | } | 709 | } |
709 | after_mode_sense: | 710 | after_mode_sense: |
710 | 711 | ||
711 | if (sd->type != TYPE_TAPE) | 712 | if (sd->type != TYPE_TAPE || !cmd->data_length) |
712 | goto after_mode_select; | 713 | goto after_mode_select; |
713 | 714 | ||
714 | /* | 715 | /* |
@@ -750,10 +751,10 @@ after_mode_sense: | |||
750 | } | 751 | } |
751 | after_mode_select: | 752 | after_mode_select: |
752 | 753 | ||
753 | if (status_byte(result) & CHECK_CONDITION) | 754 | if (sense_buffer && (status_byte(result) & CHECK_CONDITION)) { |
754 | return 1; | 755 | memcpy(sense_buffer, pt->pscsi_sense, TRANSPORT_SENSE_BUFFER); |
755 | 756 | cmd->se_cmd_flags |= SCF_TRANSPORT_TASK_SENSE; | |
756 | return 0; | 757 | } |
757 | } | 758 | } |
758 | 759 | ||
759 | enum { | 760 | enum { |
@@ -1184,13 +1185,6 @@ fail: | |||
1184 | return -ENOMEM; | 1185 | return -ENOMEM; |
1185 | } | 1186 | } |
1186 | 1187 | ||
1187 | static unsigned char *pscsi_get_sense_buffer(struct se_cmd *cmd) | ||
1188 | { | ||
1189 | struct pscsi_plugin_task *pt = cmd->priv; | ||
1190 | |||
1191 | return pt->pscsi_sense; | ||
1192 | } | ||
1193 | |||
1194 | /* pscsi_get_device_rev(): | 1188 | /* pscsi_get_device_rev(): |
1195 | * | 1189 | * |
1196 | * | 1190 | * |
@@ -1273,7 +1267,6 @@ static struct se_subsystem_api pscsi_template = { | |||
1273 | .check_configfs_dev_params = pscsi_check_configfs_dev_params, | 1267 | .check_configfs_dev_params = pscsi_check_configfs_dev_params, |
1274 | .set_configfs_dev_params = pscsi_set_configfs_dev_params, | 1268 | .set_configfs_dev_params = pscsi_set_configfs_dev_params, |
1275 | .show_configfs_dev_params = pscsi_show_configfs_dev_params, | 1269 | .show_configfs_dev_params = pscsi_show_configfs_dev_params, |
1276 | .get_sense_buffer = pscsi_get_sense_buffer, | ||
1277 | .get_device_rev = pscsi_get_device_rev, | 1270 | .get_device_rev = pscsi_get_device_rev, |
1278 | .get_device_type = pscsi_get_device_type, | 1271 | .get_device_type = pscsi_get_device_type, |
1279 | .get_blocks = pscsi_get_blocks, | 1272 | .get_blocks = pscsi_get_blocks, |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 4c861de538c9..388a922c8f6d 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -877,9 +877,11 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | |||
877 | static int spc_emulate_request_sense(struct se_cmd *cmd) | 877 | static int spc_emulate_request_sense(struct se_cmd *cmd) |
878 | { | 878 | { |
879 | unsigned char *cdb = cmd->t_task_cdb; | 879 | unsigned char *cdb = cmd->t_task_cdb; |
880 | unsigned char *buf; | 880 | unsigned char *rbuf; |
881 | u8 ua_asc = 0, ua_ascq = 0; | 881 | u8 ua_asc = 0, ua_ascq = 0; |
882 | int err = 0; | 882 | unsigned char buf[SE_SENSE_BUF]; |
883 | |||
884 | memset(buf, 0, SE_SENSE_BUF); | ||
883 | 885 | ||
884 | if (cdb[1] & 0x01) { | 886 | if (cdb[1] & 0x01) { |
885 | pr_err("REQUEST_SENSE description emulation not" | 887 | pr_err("REQUEST_SENSE description emulation not" |
@@ -888,20 +890,21 @@ static int spc_emulate_request_sense(struct se_cmd *cmd) | |||
888 | return -ENOSYS; | 890 | return -ENOSYS; |
889 | } | 891 | } |
890 | 892 | ||
891 | buf = transport_kmap_data_sg(cmd); | 893 | rbuf = transport_kmap_data_sg(cmd); |
892 | 894 | if (cmd->scsi_sense_reason != 0) { | |
893 | if (!core_scsi3_ua_clear_for_request_sense(cmd, &ua_asc, &ua_ascq)) { | 895 | /* |
896 | * Out of memory. We will fail with CHECK CONDITION, so | ||
897 | * we must not clear the unit attention condition. | ||
898 | */ | ||
899 | target_complete_cmd(cmd, CHECK_CONDITION); | ||
900 | return 0; | ||
901 | } else if (!core_scsi3_ua_clear_for_request_sense(cmd, &ua_asc, &ua_ascq)) { | ||
894 | /* | 902 | /* |
895 | * CURRENT ERROR, UNIT ATTENTION | 903 | * CURRENT ERROR, UNIT ATTENTION |
896 | */ | 904 | */ |
897 | buf[0] = 0x70; | 905 | buf[0] = 0x70; |
898 | buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; | 906 | buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; |
899 | 907 | ||
900 | if (cmd->data_length < 18) { | ||
901 | buf[7] = 0x00; | ||
902 | err = -EINVAL; | ||
903 | goto end; | ||
904 | } | ||
905 | /* | 908 | /* |
906 | * The Additional Sense Code (ASC) from the UNIT ATTENTION | 909 | * The Additional Sense Code (ASC) from the UNIT ATTENTION |
907 | */ | 910 | */ |
@@ -915,11 +918,6 @@ static int spc_emulate_request_sense(struct se_cmd *cmd) | |||
915 | buf[0] = 0x70; | 918 | buf[0] = 0x70; |
916 | buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; | 919 | buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; |
917 | 920 | ||
918 | if (cmd->data_length < 18) { | ||
919 | buf[7] = 0x00; | ||
920 | err = -EINVAL; | ||
921 | goto end; | ||
922 | } | ||
923 | /* | 921 | /* |
924 | * NO ADDITIONAL SENSE INFORMATION | 922 | * NO ADDITIONAL SENSE INFORMATION |
925 | */ | 923 | */ |
@@ -927,8 +925,11 @@ static int spc_emulate_request_sense(struct se_cmd *cmd) | |||
927 | buf[7] = 0x0A; | 925 | buf[7] = 0x0A; |
928 | } | 926 | } |
929 | 927 | ||
930 | end: | 928 | if (rbuf) { |
931 | transport_kunmap_data_sg(cmd); | 929 | memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); |
930 | transport_kunmap_data_sg(cmd); | ||
931 | } | ||
932 | |||
932 | target_complete_cmd(cmd, GOOD); | 933 | target_complete_cmd(cmd, GOOD); |
933 | return 0; | 934 | return 0; |
934 | } | 935 | } |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 4de3186dc44e..269f54488397 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -567,6 +567,34 @@ static void target_complete_failure_work(struct work_struct *work) | |||
567 | transport_generic_request_failure(cmd); | 567 | transport_generic_request_failure(cmd); |
568 | } | 568 | } |
569 | 569 | ||
570 | /* | ||
571 | * Used when asking transport to copy Sense Data from the underlying | ||
572 | * Linux/SCSI struct scsi_cmnd | ||
573 | */ | ||
574 | static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd) | ||
575 | { | ||
576 | unsigned char *buffer = cmd->sense_buffer; | ||
577 | struct se_device *dev = cmd->se_dev; | ||
578 | u32 offset = 0; | ||
579 | |||
580 | WARN_ON(!cmd->se_lun); | ||
581 | |||
582 | if (!dev) | ||
583 | return NULL; | ||
584 | |||
585 | if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) | ||
586 | return NULL; | ||
587 | |||
588 | offset = cmd->se_tfo->set_fabric_sense_len(cmd, TRANSPORT_SENSE_BUFFER); | ||
589 | |||
590 | /* Automatically padded */ | ||
591 | cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER + offset; | ||
592 | |||
593 | pr_debug("HBA_[%u]_PLUG[%s]: Requesting sense for SAM STATUS: 0x%02x\n", | ||
594 | dev->se_hba->hba_id, dev->transport->name, cmd->scsi_status); | ||
595 | return &buffer[offset]; | ||
596 | } | ||
597 | |||
570 | void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) | 598 | void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) |
571 | { | 599 | { |
572 | struct se_device *dev = cmd->se_dev; | 600 | struct se_device *dev = cmd->se_dev; |
@@ -580,11 +608,11 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) | |||
580 | cmd->transport_state &= ~CMD_T_BUSY; | 608 | cmd->transport_state &= ~CMD_T_BUSY; |
581 | 609 | ||
582 | if (dev && dev->transport->transport_complete) { | 610 | if (dev && dev->transport->transport_complete) { |
583 | if (dev->transport->transport_complete(cmd, | 611 | dev->transport->transport_complete(cmd, |
584 | cmd->t_data_sg) != 0) { | 612 | cmd->t_data_sg, |
585 | cmd->se_cmd_flags |= SCF_TRANSPORT_TASK_SENSE; | 613 | transport_get_sense_buffer(cmd)); |
614 | if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) | ||
586 | success = 1; | 615 | success = 1; |
587 | } | ||
588 | } | 616 | } |
589 | 617 | ||
590 | /* | 618 | /* |
@@ -1181,15 +1209,20 @@ int target_cmd_size_check(struct se_cmd *cmd, unsigned int size) | |||
1181 | /* Returns CHECK_CONDITION + INVALID_CDB_FIELD */ | 1209 | /* Returns CHECK_CONDITION + INVALID_CDB_FIELD */ |
1182 | goto out_invalid_cdb_field; | 1210 | goto out_invalid_cdb_field; |
1183 | } | 1211 | } |
1184 | 1212 | /* | |
1213 | * For the overflow case keep the existing fabric provided | ||
1214 | * ->data_length. Otherwise for the underflow case, reset | ||
1215 | * ->data_length to the smaller SCSI expected data transfer | ||
1216 | * length. | ||
1217 | */ | ||
1185 | if (size > cmd->data_length) { | 1218 | if (size > cmd->data_length) { |
1186 | cmd->se_cmd_flags |= SCF_OVERFLOW_BIT; | 1219 | cmd->se_cmd_flags |= SCF_OVERFLOW_BIT; |
1187 | cmd->residual_count = (size - cmd->data_length); | 1220 | cmd->residual_count = (size - cmd->data_length); |
1188 | } else { | 1221 | } else { |
1189 | cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; | 1222 | cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; |
1190 | cmd->residual_count = (cmd->data_length - size); | 1223 | cmd->residual_count = (cmd->data_length - size); |
1224 | cmd->data_length = size; | ||
1191 | } | 1225 | } |
1192 | cmd->data_length = size; | ||
1193 | } | 1226 | } |
1194 | 1227 | ||
1195 | return 0; | 1228 | return 0; |
@@ -1816,61 +1849,6 @@ execute: | |||
1816 | EXPORT_SYMBOL(target_execute_cmd); | 1849 | EXPORT_SYMBOL(target_execute_cmd); |
1817 | 1850 | ||
1818 | /* | 1851 | /* |
1819 | * Used to obtain Sense Data from underlying Linux/SCSI struct scsi_cmnd | ||
1820 | */ | ||
1821 | static int transport_get_sense_data(struct se_cmd *cmd) | ||
1822 | { | ||
1823 | unsigned char *buffer = cmd->sense_buffer, *sense_buffer = NULL; | ||
1824 | struct se_device *dev = cmd->se_dev; | ||
1825 | unsigned long flags; | ||
1826 | u32 offset = 0; | ||
1827 | |||
1828 | WARN_ON(!cmd->se_lun); | ||
1829 | |||
1830 | if (!dev) | ||
1831 | return 0; | ||
1832 | |||
1833 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
1834 | if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) { | ||
1835 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
1836 | return 0; | ||
1837 | } | ||
1838 | |||
1839 | if (!(cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE)) | ||
1840 | goto out; | ||
1841 | |||
1842 | if (!dev->transport->get_sense_buffer) { | ||
1843 | pr_err("dev->transport->get_sense_buffer is NULL\n"); | ||
1844 | goto out; | ||
1845 | } | ||
1846 | |||
1847 | sense_buffer = dev->transport->get_sense_buffer(cmd); | ||
1848 | if (!sense_buffer) { | ||
1849 | pr_err("ITT 0x%08x cmd %p: Unable to locate" | ||
1850 | " sense buffer for task with sense\n", | ||
1851 | cmd->se_tfo->get_task_tag(cmd), cmd); | ||
1852 | goto out; | ||
1853 | } | ||
1854 | |||
1855 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
1856 | |||
1857 | offset = cmd->se_tfo->set_fabric_sense_len(cmd, TRANSPORT_SENSE_BUFFER); | ||
1858 | |||
1859 | memcpy(&buffer[offset], sense_buffer, TRANSPORT_SENSE_BUFFER); | ||
1860 | |||
1861 | /* Automatically padded */ | ||
1862 | cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER + offset; | ||
1863 | |||
1864 | pr_debug("HBA_[%u]_PLUG[%s]: Set SAM STATUS: 0x%02x and sense\n", | ||
1865 | dev->se_hba->hba_id, dev->transport->name, cmd->scsi_status); | ||
1866 | return 0; | ||
1867 | |||
1868 | out: | ||
1869 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
1870 | return -1; | ||
1871 | } | ||
1872 | |||
1873 | /* | ||
1874 | * Process all commands up to the last received ORDERED task attribute which | 1852 | * Process all commands up to the last received ORDERED task attribute which |
1875 | * requires another blocking boundary | 1853 | * requires another blocking boundary |
1876 | */ | 1854 | */ |
@@ -1985,7 +1963,7 @@ static void transport_handle_queue_full( | |||
1985 | static void target_complete_ok_work(struct work_struct *work) | 1963 | static void target_complete_ok_work(struct work_struct *work) |
1986 | { | 1964 | { |
1987 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); | 1965 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); |
1988 | int reason = 0, ret; | 1966 | int ret; |
1989 | 1967 | ||
1990 | /* | 1968 | /* |
1991 | * Check if we need to move delayed/dormant tasks from cmds on the | 1969 | * Check if we need to move delayed/dormant tasks from cmds on the |
@@ -2002,23 +1980,19 @@ static void target_complete_ok_work(struct work_struct *work) | |||
2002 | schedule_work(&cmd->se_dev->qf_work_queue); | 1980 | schedule_work(&cmd->se_dev->qf_work_queue); |
2003 | 1981 | ||
2004 | /* | 1982 | /* |
2005 | * Check if we need to retrieve a sense buffer from | 1983 | * Check if we need to send a sense buffer from |
2006 | * the struct se_cmd in question. | 1984 | * the struct se_cmd in question. |
2007 | */ | 1985 | */ |
2008 | if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) { | 1986 | if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) { |
2009 | if (transport_get_sense_data(cmd) < 0) | 1987 | WARN_ON(!cmd->scsi_status); |
2010 | reason = TCM_NON_EXISTENT_LUN; | 1988 | ret = transport_send_check_condition_and_sense( |
2011 | 1989 | cmd, 0, 1); | |
2012 | if (cmd->scsi_status) { | 1990 | if (ret == -EAGAIN || ret == -ENOMEM) |
2013 | ret = transport_send_check_condition_and_sense( | 1991 | goto queue_full; |
2014 | cmd, reason, 1); | ||
2015 | if (ret == -EAGAIN || ret == -ENOMEM) | ||
2016 | goto queue_full; | ||
2017 | 1992 | ||
2018 | transport_lun_remove_cmd(cmd); | 1993 | transport_lun_remove_cmd(cmd); |
2019 | transport_cmd_check_stop_to_fabric(cmd); | 1994 | transport_cmd_check_stop_to_fabric(cmd); |
2020 | return; | 1995 | return; |
2021 | } | ||
2022 | } | 1996 | } |
2023 | /* | 1997 | /* |
2024 | * Check for a callback, used by amongst other things | 1998 | * Check for a callback, used by amongst other things |
@@ -2216,7 +2190,6 @@ void *transport_kmap_data_sg(struct se_cmd *cmd) | |||
2216 | struct page **pages; | 2190 | struct page **pages; |
2217 | int i; | 2191 | int i; |
2218 | 2192 | ||
2219 | BUG_ON(!sg); | ||
2220 | /* | 2193 | /* |
2221 | * We need to take into account a possible offset here for fabrics like | 2194 | * We need to take into account a possible offset here for fabrics like |
2222 | * tcm_loop who may be using a contig buffer from the SCSI midlayer for | 2195 | * tcm_loop who may be using a contig buffer from the SCSI midlayer for |
@@ -2224,13 +2197,17 @@ void *transport_kmap_data_sg(struct se_cmd *cmd) | |||
2224 | */ | 2197 | */ |
2225 | if (!cmd->t_data_nents) | 2198 | if (!cmd->t_data_nents) |
2226 | return NULL; | 2199 | return NULL; |
2227 | else if (cmd->t_data_nents == 1) | 2200 | |
2201 | BUG_ON(!sg); | ||
2202 | if (cmd->t_data_nents == 1) | ||
2228 | return kmap(sg_page(sg)) + sg->offset; | 2203 | return kmap(sg_page(sg)) + sg->offset; |
2229 | 2204 | ||
2230 | /* >1 page. use vmap */ | 2205 | /* >1 page. use vmap */ |
2231 | pages = kmalloc(sizeof(*pages) * cmd->t_data_nents, GFP_KERNEL); | 2206 | pages = kmalloc(sizeof(*pages) * cmd->t_data_nents, GFP_KERNEL); |
2232 | if (!pages) | 2207 | if (!pages) { |
2208 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
2233 | return NULL; | 2209 | return NULL; |
2210 | } | ||
2234 | 2211 | ||
2235 | /* convert sg[] to pages[] */ | 2212 | /* convert sg[] to pages[] */ |
2236 | for_each_sg(cmd->t_data_sg, sg, cmd->t_data_nents, i) { | 2213 | for_each_sg(cmd->t_data_sg, sg, cmd->t_data_nents, i) { |
@@ -2239,8 +2216,10 @@ void *transport_kmap_data_sg(struct se_cmd *cmd) | |||
2239 | 2216 | ||
2240 | cmd->t_data_vmap = vmap(pages, cmd->t_data_nents, VM_MAP, PAGE_KERNEL); | 2217 | cmd->t_data_vmap = vmap(pages, cmd->t_data_nents, VM_MAP, PAGE_KERNEL); |
2241 | kfree(pages); | 2218 | kfree(pages); |
2242 | if (!cmd->t_data_vmap) | 2219 | if (!cmd->t_data_vmap) { |
2220 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
2243 | return NULL; | 2221 | return NULL; |
2222 | } | ||
2244 | 2223 | ||
2245 | return cmd->t_data_vmap + cmd->t_data_sg[0].offset; | 2224 | return cmd->t_data_vmap + cmd->t_data_sg[0].offset; |
2246 | } | 2225 | } |
@@ -2326,19 +2305,14 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
2326 | * into the fabric for data transfers, go ahead and complete it right | 2305 | * into the fabric for data transfers, go ahead and complete it right |
2327 | * away. | 2306 | * away. |
2328 | */ | 2307 | */ |
2329 | if (!cmd->data_length) { | 2308 | if (!cmd->data_length && |
2309 | cmd->t_task_cdb[0] != REQUEST_SENSE && | ||
2310 | cmd->se_dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV) { | ||
2330 | spin_lock_irq(&cmd->t_state_lock); | 2311 | spin_lock_irq(&cmd->t_state_lock); |
2331 | cmd->t_state = TRANSPORT_COMPLETE; | 2312 | cmd->t_state = TRANSPORT_COMPLETE; |
2332 | cmd->transport_state |= CMD_T_ACTIVE; | 2313 | cmd->transport_state |= CMD_T_ACTIVE; |
2333 | spin_unlock_irq(&cmd->t_state_lock); | 2314 | spin_unlock_irq(&cmd->t_state_lock); |
2334 | 2315 | ||
2335 | if (cmd->t_task_cdb[0] == REQUEST_SENSE) { | ||
2336 | u8 ua_asc = 0, ua_ascq = 0; | ||
2337 | |||
2338 | core_scsi3_ua_clear_for_request_sense(cmd, | ||
2339 | &ua_asc, &ua_ascq); | ||
2340 | } | ||
2341 | |||
2342 | INIT_WORK(&cmd->work, target_complete_ok_work); | 2316 | INIT_WORK(&cmd->work, target_complete_ok_work); |
2343 | queue_work(target_completion_wq, &cmd->work); | 2317 | queue_work(target_completion_wq, &cmd->work); |
2344 | return 0; | 2318 | return 0; |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index d95696584762..3440812b4a84 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, | |||
624 | /* print devices for all busses */ | 624 | /* print devices for all busses */ |
625 | list_for_each_entry(bus, &usb_bus_list, bus_list) { | 625 | list_for_each_entry(bus, &usb_bus_list, bus_list) { |
626 | /* recurse through all children of the root hub */ | 626 | /* recurse through all children of the root hub */ |
627 | if (!bus->root_hub) | 627 | if (!bus_to_hcd(bus)->rh_registered) |
628 | continue; | 628 | continue; |
629 | usb_lock_device(bus->root_hub); | 629 | usb_lock_device(bus->root_hub); |
630 | ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, | 630 | ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bc84106ac057..75ba2091f9b4 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1011,10 +1011,7 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
1011 | if (retval) { | 1011 | if (retval) { |
1012 | dev_err (parent_dev, "can't register root hub for %s, %d\n", | 1012 | dev_err (parent_dev, "can't register root hub for %s, %d\n", |
1013 | dev_name(&usb_dev->dev), retval); | 1013 | dev_name(&usb_dev->dev), retval); |
1014 | } | 1014 | } else { |
1015 | mutex_unlock(&usb_bus_list_lock); | ||
1016 | |||
1017 | if (retval == 0) { | ||
1018 | spin_lock_irq (&hcd_root_hub_lock); | 1015 | spin_lock_irq (&hcd_root_hub_lock); |
1019 | hcd->rh_registered = 1; | 1016 | hcd->rh_registered = 1; |
1020 | spin_unlock_irq (&hcd_root_hub_lock); | 1017 | spin_unlock_irq (&hcd_root_hub_lock); |
@@ -1023,6 +1020,7 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
1023 | if (HCD_DEAD(hcd)) | 1020 | if (HCD_DEAD(hcd)) |
1024 | usb_hc_died (hcd); /* This time clean up */ | 1021 | usb_hc_died (hcd); /* This time clean up */ |
1025 | } | 1022 | } |
1023 | mutex_unlock(&usb_bus_list_lock); | ||
1026 | 1024 | ||
1027 | return retval; | 1025 | return retval; |
1028 | } | 1026 | } |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index aaa8d2bce217..0bf72f943b00 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -467,7 +467,8 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
467 | /* From the GPIO notifying the over-current situation, find | 467 | /* From the GPIO notifying the over-current situation, find |
468 | * out the corresponding port */ | 468 | * out the corresponding port */ |
469 | at91_for_each_port(port) { | 469 | at91_for_each_port(port) { |
470 | if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { | 470 | if (gpio_is_valid(pdata->overcurrent_pin[port]) && |
471 | gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { | ||
471 | gpio = pdata->overcurrent_pin[port]; | 472 | gpio = pdata->overcurrent_pin[port]; |
472 | break; | 473 | break; |
473 | } | 474 | } |
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 211a4920b88a..d8dedc7d3910 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
@@ -76,9 +76,24 @@ static int virqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key) | |||
76 | schedule_work(&virqfd->inject); | 76 | schedule_work(&virqfd->inject); |
77 | } | 77 | } |
78 | 78 | ||
79 | if (flags & POLLHUP) | 79 | if (flags & POLLHUP) { |
80 | /* The eventfd is closing, detach from VFIO */ | 80 | unsigned long flags; |
81 | virqfd_deactivate(virqfd); | 81 | spin_lock_irqsave(&virqfd->vdev->irqlock, flags); |
82 | |||
83 | /* | ||
84 | * The eventfd is closing, if the virqfd has not yet been | ||
85 | * queued for release, as determined by testing whether the | ||
86 | * vdev pointer to it is still valid, queue it now. As | ||
87 | * with kvm irqfds, we know we won't race against the virqfd | ||
88 | * going away because we hold wqh->lock to get here. | ||
89 | */ | ||
90 | if (*(virqfd->pvirqfd) == virqfd) { | ||
91 | *(virqfd->pvirqfd) = NULL; | ||
92 | virqfd_deactivate(virqfd); | ||
93 | } | ||
94 | |||
95 | spin_unlock_irqrestore(&virqfd->vdev->irqlock, flags); | ||
96 | } | ||
82 | 97 | ||
83 | return 0; | 98 | return 0; |
84 | } | 99 | } |
@@ -93,7 +108,6 @@ static void virqfd_ptable_queue_proc(struct file *file, | |||
93 | static void virqfd_shutdown(struct work_struct *work) | 108 | static void virqfd_shutdown(struct work_struct *work) |
94 | { | 109 | { |
95 | struct virqfd *virqfd = container_of(work, struct virqfd, shutdown); | 110 | struct virqfd *virqfd = container_of(work, struct virqfd, shutdown); |
96 | struct virqfd **pvirqfd = virqfd->pvirqfd; | ||
97 | u64 cnt; | 111 | u64 cnt; |
98 | 112 | ||
99 | eventfd_ctx_remove_wait_queue(virqfd->eventfd, &virqfd->wait, &cnt); | 113 | eventfd_ctx_remove_wait_queue(virqfd->eventfd, &virqfd->wait, &cnt); |
@@ -101,7 +115,6 @@ static void virqfd_shutdown(struct work_struct *work) | |||
101 | eventfd_ctx_put(virqfd->eventfd); | 115 | eventfd_ctx_put(virqfd->eventfd); |
102 | 116 | ||
103 | kfree(virqfd); | 117 | kfree(virqfd); |
104 | *pvirqfd = NULL; | ||
105 | } | 118 | } |
106 | 119 | ||
107 | static void virqfd_inject(struct work_struct *work) | 120 | static void virqfd_inject(struct work_struct *work) |
@@ -122,15 +135,11 @@ static int virqfd_enable(struct vfio_pci_device *vdev, | |||
122 | int ret = 0; | 135 | int ret = 0; |
123 | unsigned int events; | 136 | unsigned int events; |
124 | 137 | ||
125 | if (*pvirqfd) | ||
126 | return -EBUSY; | ||
127 | |||
128 | virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL); | 138 | virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL); |
129 | if (!virqfd) | 139 | if (!virqfd) |
130 | return -ENOMEM; | 140 | return -ENOMEM; |
131 | 141 | ||
132 | virqfd->pvirqfd = pvirqfd; | 142 | virqfd->pvirqfd = pvirqfd; |
133 | *pvirqfd = virqfd; | ||
134 | virqfd->vdev = vdev; | 143 | virqfd->vdev = vdev; |
135 | virqfd->handler = handler; | 144 | virqfd->handler = handler; |
136 | virqfd->thread = thread; | 145 | virqfd->thread = thread; |
@@ -154,6 +163,23 @@ static int virqfd_enable(struct vfio_pci_device *vdev, | |||
154 | virqfd->eventfd = ctx; | 163 | virqfd->eventfd = ctx; |
155 | 164 | ||
156 | /* | 165 | /* |
166 | * virqfds can be released by closing the eventfd or directly | ||
167 | * through ioctl. These are both done through a workqueue, so | ||
168 | * we update the pointer to the virqfd under lock to avoid | ||
169 | * pushing multiple jobs to release the same virqfd. | ||
170 | */ | ||
171 | spin_lock_irq(&vdev->irqlock); | ||
172 | |||
173 | if (*pvirqfd) { | ||
174 | spin_unlock_irq(&vdev->irqlock); | ||
175 | ret = -EBUSY; | ||
176 | goto fail; | ||
177 | } | ||
178 | *pvirqfd = virqfd; | ||
179 | |||
180 | spin_unlock_irq(&vdev->irqlock); | ||
181 | |||
182 | /* | ||
157 | * Install our own custom wake-up handling so we are notified via | 183 | * Install our own custom wake-up handling so we are notified via |
158 | * a callback whenever someone signals the underlying eventfd. | 184 | * a callback whenever someone signals the underlying eventfd. |
159 | */ | 185 | */ |
@@ -187,19 +213,29 @@ fail: | |||
187 | fput(file); | 213 | fput(file); |
188 | 214 | ||
189 | kfree(virqfd); | 215 | kfree(virqfd); |
190 | *pvirqfd = NULL; | ||
191 | 216 | ||
192 | return ret; | 217 | return ret; |
193 | } | 218 | } |
194 | 219 | ||
195 | static void virqfd_disable(struct virqfd *virqfd) | 220 | static void virqfd_disable(struct vfio_pci_device *vdev, |
221 | struct virqfd **pvirqfd) | ||
196 | { | 222 | { |
197 | if (!virqfd) | 223 | unsigned long flags; |
198 | return; | 224 | |
225 | spin_lock_irqsave(&vdev->irqlock, flags); | ||
226 | |||
227 | if (*pvirqfd) { | ||
228 | virqfd_deactivate(*pvirqfd); | ||
229 | *pvirqfd = NULL; | ||
230 | } | ||
199 | 231 | ||
200 | virqfd_deactivate(virqfd); | 232 | spin_unlock_irqrestore(&vdev->irqlock, flags); |
201 | 233 | ||
202 | /* Block until we know all outstanding shutdown jobs have completed. */ | 234 | /* |
235 | * Block until we know all outstanding shutdown jobs have completed. | ||
236 | * Even if we don't queue the job, flush the wq to be sure it's | ||
237 | * been released. | ||
238 | */ | ||
203 | flush_workqueue(vfio_irqfd_cleanup_wq); | 239 | flush_workqueue(vfio_irqfd_cleanup_wq); |
204 | } | 240 | } |
205 | 241 | ||
@@ -392,8 +428,8 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd) | |||
392 | static void vfio_intx_disable(struct vfio_pci_device *vdev) | 428 | static void vfio_intx_disable(struct vfio_pci_device *vdev) |
393 | { | 429 | { |
394 | vfio_intx_set_signal(vdev, -1); | 430 | vfio_intx_set_signal(vdev, -1); |
395 | virqfd_disable(vdev->ctx[0].unmask); | 431 | virqfd_disable(vdev, &vdev->ctx[0].unmask); |
396 | virqfd_disable(vdev->ctx[0].mask); | 432 | virqfd_disable(vdev, &vdev->ctx[0].mask); |
397 | vdev->irq_type = VFIO_PCI_NUM_IRQS; | 433 | vdev->irq_type = VFIO_PCI_NUM_IRQS; |
398 | vdev->num_ctx = 0; | 434 | vdev->num_ctx = 0; |
399 | kfree(vdev->ctx); | 435 | kfree(vdev->ctx); |
@@ -539,8 +575,8 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix) | |||
539 | vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix); | 575 | vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix); |
540 | 576 | ||
541 | for (i = 0; i < vdev->num_ctx; i++) { | 577 | for (i = 0; i < vdev->num_ctx; i++) { |
542 | virqfd_disable(vdev->ctx[i].unmask); | 578 | virqfd_disable(vdev, &vdev->ctx[i].unmask); |
543 | virqfd_disable(vdev->ctx[i].mask); | 579 | virqfd_disable(vdev, &vdev->ctx[i].mask); |
544 | } | 580 | } |
545 | 581 | ||
546 | if (msix) { | 582 | if (msix) { |
@@ -577,7 +613,7 @@ static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev, | |||
577 | vfio_send_intx_eventfd, NULL, | 613 | vfio_send_intx_eventfd, NULL, |
578 | &vdev->ctx[0].unmask, fd); | 614 | &vdev->ctx[0].unmask, fd); |
579 | 615 | ||
580 | virqfd_disable(vdev->ctx[0].unmask); | 616 | virqfd_disable(vdev, &vdev->ctx[0].unmask); |
581 | } | 617 | } |
582 | 618 | ||
583 | return 0; | 619 | return 0; |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 1eff743ec497..ae60406ea8a1 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -814,6 +814,9 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, | |||
814 | hpwdt_timer_reg = pci_mem_addr + 0x70; | 814 | hpwdt_timer_reg = pci_mem_addr + 0x70; |
815 | hpwdt_timer_con = pci_mem_addr + 0x72; | 815 | hpwdt_timer_con = pci_mem_addr + 0x72; |
816 | 816 | ||
817 | /* Make sure that timer is disabled until /dev/watchdog is opened */ | ||
818 | hpwdt_stop(); | ||
819 | |||
817 | /* Make sure that we have a valid soft_margin */ | 820 | /* Make sure that we have a valid soft_margin */ |
818 | if (hpwdt_change_timer(soft_margin)) | 821 | if (hpwdt_change_timer(soft_margin)) |
819 | hpwdt_change_timer(DEFAULT_MARGIN); | 822 | hpwdt_change_timer(DEFAULT_MARGIN); |
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index 6aa46a90ff02..3796434991fa 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c | |||
@@ -128,11 +128,12 @@ EXPORT_SYMBOL_GPL(watchdog_register_device); | |||
128 | void watchdog_unregister_device(struct watchdog_device *wdd) | 128 | void watchdog_unregister_device(struct watchdog_device *wdd) |
129 | { | 129 | { |
130 | int ret; | 130 | int ret; |
131 | int devno = wdd->cdev.dev; | 131 | int devno; |
132 | 132 | ||
133 | if (wdd == NULL) | 133 | if (wdd == NULL) |
134 | return; | 134 | return; |
135 | 135 | ||
136 | devno = wdd->cdev.dev; | ||
136 | ret = watchdog_dev_unregister(wdd); | 137 | ret = watchdog_dev_unregister(wdd); |
137 | if (ret) | 138 | if (ret) |
138 | pr_err("error unregistering /dev/watchdog (err=%d)\n", ret); | 139 | pr_err("error unregistering /dev/watchdog (err=%d)\n", ret); |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 1ffd03bf8e10..7f1241608489 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -314,8 +314,9 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages) | |||
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset, | 317 | err = gnttab_unmap_refs(map->unmap_ops + offset, |
318 | pages, true); | 318 | use_ptemod ? map->kmap_ops + offset : NULL, map->pages + offset, |
319 | pages); | ||
319 | if (err) | 320 | if (err) |
320 | return err; | 321 | return err; |
321 | 322 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 0bfc1ef11259..006726688baf 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -870,7 +870,8 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
870 | EXPORT_SYMBOL_GPL(gnttab_map_refs); | 870 | EXPORT_SYMBOL_GPL(gnttab_map_refs); |
871 | 871 | ||
872 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | 872 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, |
873 | struct page **pages, unsigned int count, bool clear_pte) | 873 | struct gnttab_map_grant_ref *kmap_ops, |
874 | struct page **pages, unsigned int count) | ||
874 | { | 875 | { |
875 | int i, ret; | 876 | int i, ret; |
876 | bool lazy = false; | 877 | bool lazy = false; |
@@ -888,7 +889,8 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | |||
888 | } | 889 | } |
889 | 890 | ||
890 | for (i = 0; i < count; i++) { | 891 | for (i = 0; i < count; i++) { |
891 | ret = m2p_remove_override(pages[i], clear_pte); | 892 | ret = m2p_remove_override(pages[i], kmap_ops ? |
893 | &kmap_ops[i] : NULL); | ||
892 | if (ret) | 894 | if (ret) |
893 | return ret; | 895 | return ret; |
894 | } | 896 | } |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 38b42e7bc91d..b65015581744 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1371,10 +1371,8 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, | |||
1371 | 1371 | ||
1372 | if (srcid) { | 1372 | if (srcid) { |
1373 | srcgroup = find_qgroup_rb(fs_info, srcid); | 1373 | srcgroup = find_qgroup_rb(fs_info, srcid); |
1374 | if (!srcgroup) { | 1374 | if (!srcgroup) |
1375 | ret = -EINVAL; | ||
1376 | goto unlock; | 1375 | goto unlock; |
1377 | } | ||
1378 | dstgroup->rfer = srcgroup->rfer - level_size; | 1376 | dstgroup->rfer = srcgroup->rfer - level_size; |
1379 | dstgroup->rfer_cmpr = srcgroup->rfer_cmpr - level_size; | 1377 | dstgroup->rfer_cmpr = srcgroup->rfer_cmpr - level_size; |
1380 | srcgroup->excl = level_size; | 1378 | srcgroup->excl = level_size; |
@@ -1383,10 +1381,8 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, | |||
1383 | qgroup_dirty(fs_info, srcgroup); | 1381 | qgroup_dirty(fs_info, srcgroup); |
1384 | } | 1382 | } |
1385 | 1383 | ||
1386 | if (!inherit) { | 1384 | if (!inherit) |
1387 | ret = -EINVAL; | ||
1388 | goto unlock; | 1385 | goto unlock; |
1389 | } | ||
1390 | 1386 | ||
1391 | i_qgroups = (u64 *)(inherit + 1); | 1387 | i_qgroups = (u64 *)(inherit + 1); |
1392 | for (i = 0; i < inherit->num_qgroups; ++i) { | 1388 | for (i = 0; i < inherit->num_qgroups; ++i) { |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 7dab9c04ad52..53cf2aabce87 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -328,7 +328,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
328 | } | 328 | } |
329 | 329 | ||
330 | ctoUTF16_out: | 330 | ctoUTF16_out: |
331 | return i; | 331 | return j; |
332 | } | 332 | } |
333 | 333 | ||
334 | #ifdef CONFIG_CIFS_SMB2 | 334 | #ifdef CONFIG_CIFS_SMB2 |
diff --git a/fs/dcache.c b/fs/dcache.c index 8086636bf796..0364af2311f4 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -389,7 +389,7 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) | |||
389 | * Inform try_to_ascend() that we are no longer attached to the | 389 | * Inform try_to_ascend() that we are no longer attached to the |
390 | * dentry tree | 390 | * dentry tree |
391 | */ | 391 | */ |
392 | dentry->d_flags |= DCACHE_DISCONNECTED; | 392 | dentry->d_flags |= DCACHE_DENTRY_KILLED; |
393 | if (parent) | 393 | if (parent) |
394 | spin_unlock(&parent->d_lock); | 394 | spin_unlock(&parent->d_lock); |
395 | dentry_iput(dentry); | 395 | dentry_iput(dentry); |
@@ -1048,7 +1048,7 @@ static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq | |||
1048 | * or deletion | 1048 | * or deletion |
1049 | */ | 1049 | */ |
1050 | if (new != old->d_parent || | 1050 | if (new != old->d_parent || |
1051 | (old->d_flags & DCACHE_DISCONNECTED) || | 1051 | (old->d_flags & DCACHE_DENTRY_KILLED) || |
1052 | (!locked && read_seqretry(&rename_lock, seq))) { | 1052 | (!locked && read_seqretry(&rename_lock, seq))) { |
1053 | spin_unlock(&new->d_lock); | 1053 | spin_unlock(&new->d_lock); |
1054 | new = NULL; | 1054 | new = NULL; |
@@ -1141,7 +1141,7 @@ rename_retry: | |||
1141 | EXPORT_SYMBOL(have_submounts); | 1141 | EXPORT_SYMBOL(have_submounts); |
1142 | 1142 | ||
1143 | /* | 1143 | /* |
1144 | * Search the dentry child list for the specified parent, | 1144 | * Search the dentry child list of the specified parent, |
1145 | * and move any unused dentries to the end of the unused | 1145 | * and move any unused dentries to the end of the unused |
1146 | * list for prune_dcache(). We descend to the next level | 1146 | * list for prune_dcache(). We descend to the next level |
1147 | * whenever the d_subdirs list is non-empty and continue | 1147 | * whenever the d_subdirs list is non-empty and continue |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 2340f6978d6e..c5ca6ae5a30c 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -526,73 +526,51 @@ struct array_data { | |||
526 | u32 elements; | 526 | u32 elements; |
527 | }; | 527 | }; |
528 | 528 | ||
529 | static int u32_array_open(struct inode *inode, struct file *file) | 529 | static size_t u32_format_array(char *buf, size_t bufsize, |
530 | { | 530 | u32 *array, int array_size) |
531 | file->private_data = NULL; | ||
532 | return nonseekable_open(inode, file); | ||
533 | } | ||
534 | |||
535 | static size_t format_array(char *buf, size_t bufsize, const char *fmt, | ||
536 | u32 *array, u32 array_size) | ||
537 | { | 531 | { |
538 | size_t ret = 0; | 532 | size_t ret = 0; |
539 | u32 i; | ||
540 | 533 | ||
541 | for (i = 0; i < array_size; i++) { | 534 | while (--array_size >= 0) { |
542 | size_t len; | 535 | size_t len; |
536 | char term = array_size ? ' ' : '\n'; | ||
543 | 537 | ||
544 | len = snprintf(buf, bufsize, fmt, array[i]); | 538 | len = snprintf(buf, bufsize, "%u%c", *array++, term); |
545 | len++; /* ' ' or '\n' */ | ||
546 | ret += len; | 539 | ret += len; |
547 | 540 | ||
548 | if (buf) { | 541 | buf += len; |
549 | buf += len; | 542 | bufsize -= len; |
550 | bufsize -= len; | ||
551 | buf[-1] = (i == array_size-1) ? '\n' : ' '; | ||
552 | } | ||
553 | } | 543 | } |
554 | |||
555 | ret++; /* \0 */ | ||
556 | if (buf) | ||
557 | *buf = '\0'; | ||
558 | |||
559 | return ret; | 544 | return ret; |
560 | } | 545 | } |
561 | 546 | ||
562 | static char *format_array_alloc(const char *fmt, u32 *array, | 547 | static int u32_array_open(struct inode *inode, struct file *file) |
563 | u32 array_size) | ||
564 | { | 548 | { |
565 | size_t len = format_array(NULL, 0, fmt, array, array_size); | 549 | struct array_data *data = inode->i_private; |
566 | char *ret; | 550 | int size, elements = data->elements; |
567 | 551 | char *buf; | |
568 | ret = kmalloc(len, GFP_KERNEL); | 552 | |
569 | if (ret == NULL) | 553 | /* |
570 | return NULL; | 554 | * Max size: |
555 | * - 10 digits + ' '/'\n' = 11 bytes per number | ||
556 | * - terminating NUL character | ||
557 | */ | ||
558 | size = elements*11; | ||
559 | buf = kmalloc(size+1, GFP_KERNEL); | ||
560 | if (!buf) | ||
561 | return -ENOMEM; | ||
562 | buf[size] = 0; | ||
563 | |||
564 | file->private_data = buf; | ||
565 | u32_format_array(buf, size, data->array, data->elements); | ||
571 | 566 | ||
572 | format_array(ret, len, fmt, array, array_size); | 567 | return nonseekable_open(inode, file); |
573 | return ret; | ||
574 | } | 568 | } |
575 | 569 | ||
576 | static ssize_t u32_array_read(struct file *file, char __user *buf, size_t len, | 570 | static ssize_t u32_array_read(struct file *file, char __user *buf, size_t len, |
577 | loff_t *ppos) | 571 | loff_t *ppos) |
578 | { | 572 | { |
579 | struct inode *inode = file->f_path.dentry->d_inode; | 573 | size_t size = strlen(file->private_data); |
580 | struct array_data *data = inode->i_private; | ||
581 | size_t size; | ||
582 | |||
583 | if (*ppos == 0) { | ||
584 | if (file->private_data) { | ||
585 | kfree(file->private_data); | ||
586 | file->private_data = NULL; | ||
587 | } | ||
588 | |||
589 | file->private_data = format_array_alloc("%u", data->array, | ||
590 | data->elements); | ||
591 | } | ||
592 | |||
593 | size = 0; | ||
594 | if (file->private_data) | ||
595 | size = strlen(file->private_data); | ||
596 | 574 | ||
597 | return simple_read_from_buffer(buf, len, ppos, | 575 | return simple_read_from_buffer(buf, len, ppos, |
598 | file->private_data, size); | 576 | file->private_data, size); |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index fb1a2bedbe97..8d80c990dffd 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -289,7 +289,6 @@ static void nlmsvc_free_block(struct kref *kref) | |||
289 | dprintk("lockd: freeing block %p...\n", block); | 289 | dprintk("lockd: freeing block %p...\n", block); |
290 | 290 | ||
291 | /* Remove block from file's list of blocks */ | 291 | /* Remove block from file's list of blocks */ |
292 | mutex_lock(&file->f_mutex); | ||
293 | list_del_init(&block->b_flist); | 292 | list_del_init(&block->b_flist); |
294 | mutex_unlock(&file->f_mutex); | 293 | mutex_unlock(&file->f_mutex); |
295 | 294 | ||
@@ -303,7 +302,7 @@ static void nlmsvc_free_block(struct kref *kref) | |||
303 | static void nlmsvc_release_block(struct nlm_block *block) | 302 | static void nlmsvc_release_block(struct nlm_block *block) |
304 | { | 303 | { |
305 | if (block != NULL) | 304 | if (block != NULL) |
306 | kref_put(&block->b_count, nlmsvc_free_block); | 305 | kref_put_mutex(&block->b_count, nlmsvc_free_block, &block->b_file->f_mutex); |
307 | } | 306 | } |
308 | 307 | ||
309 | /* | 308 | /* |
diff --git a/fs/namespace.c b/fs/namespace.c index 4d31f73e2561..7bdf7907413f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1886,8 +1886,14 @@ static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags) | |||
1886 | return err; | 1886 | return err; |
1887 | 1887 | ||
1888 | err = -EINVAL; | 1888 | err = -EINVAL; |
1889 | if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(real_mount(path->mnt))) | 1889 | if (unlikely(!check_mnt(real_mount(path->mnt)))) { |
1890 | goto unlock; | 1890 | /* that's acceptable only for automounts done in private ns */ |
1891 | if (!(mnt_flags & MNT_SHRINKABLE)) | ||
1892 | goto unlock; | ||
1893 | /* ... and for those we'd better have mountpoint still alive */ | ||
1894 | if (!real_mount(path->mnt)->mnt_ns) | ||
1895 | goto unlock; | ||
1896 | } | ||
1891 | 1897 | ||
1892 | /* Refuse the same filesystem on the same mount point */ | 1898 | /* Refuse the same filesystem on the same mount point */ |
1893 | err = -EBUSY; | 1899 | err = -EBUSY; |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index dfafeb2b05a0..eb7cc91b7258 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -462,9 +462,6 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, | |||
462 | 462 | ||
463 | err = ERR_PTR(-ENOMEM); | 463 | err = ERR_PTR(-ENOMEM); |
464 | inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); | 464 | inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); |
465 | if (h) | ||
466 | sysctl_head_finish(h); | ||
467 | |||
468 | if (!inode) | 465 | if (!inode) |
469 | goto out; | 466 | goto out; |
470 | 467 | ||
@@ -473,6 +470,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, | |||
473 | d_add(dentry, inode); | 470 | d_add(dentry, inode); |
474 | 471 | ||
475 | out: | 472 | out: |
473 | if (h) | ||
474 | sysctl_head_finish(h); | ||
476 | sysctl_head_finish(head); | 475 | sysctl_head_finish(head); |
477 | return err; | 476 | return err; |
478 | } | 477 | } |
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index d7a9dd735e1e..933b7930b863 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -96,6 +96,7 @@ xfs_buf_lru_add( | |||
96 | atomic_inc(&bp->b_hold); | 96 | atomic_inc(&bp->b_hold); |
97 | list_add_tail(&bp->b_lru, &btp->bt_lru); | 97 | list_add_tail(&bp->b_lru, &btp->bt_lru); |
98 | btp->bt_lru_nr++; | 98 | btp->bt_lru_nr++; |
99 | bp->b_lru_flags &= ~_XBF_LRU_DISPOSE; | ||
99 | } | 100 | } |
100 | spin_unlock(&btp->bt_lru_lock); | 101 | spin_unlock(&btp->bt_lru_lock); |
101 | } | 102 | } |
@@ -154,7 +155,8 @@ xfs_buf_stale( | |||
154 | struct xfs_buftarg *btp = bp->b_target; | 155 | struct xfs_buftarg *btp = bp->b_target; |
155 | 156 | ||
156 | spin_lock(&btp->bt_lru_lock); | 157 | spin_lock(&btp->bt_lru_lock); |
157 | if (!list_empty(&bp->b_lru)) { | 158 | if (!list_empty(&bp->b_lru) && |
159 | !(bp->b_lru_flags & _XBF_LRU_DISPOSE)) { | ||
158 | list_del_init(&bp->b_lru); | 160 | list_del_init(&bp->b_lru); |
159 | btp->bt_lru_nr--; | 161 | btp->bt_lru_nr--; |
160 | atomic_dec(&bp->b_hold); | 162 | atomic_dec(&bp->b_hold); |
@@ -1501,6 +1503,7 @@ xfs_buftarg_shrink( | |||
1501 | */ | 1503 | */ |
1502 | list_move(&bp->b_lru, &dispose); | 1504 | list_move(&bp->b_lru, &dispose); |
1503 | btp->bt_lru_nr--; | 1505 | btp->bt_lru_nr--; |
1506 | bp->b_lru_flags |= _XBF_LRU_DISPOSE; | ||
1504 | } | 1507 | } |
1505 | spin_unlock(&btp->bt_lru_lock); | 1508 | spin_unlock(&btp->bt_lru_lock); |
1506 | 1509 | ||
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index d03b73b9604e..7c0b6a0a1557 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h | |||
@@ -38,27 +38,28 @@ typedef enum { | |||
38 | XBRW_ZERO = 3, /* Zero target memory */ | 38 | XBRW_ZERO = 3, /* Zero target memory */ |
39 | } xfs_buf_rw_t; | 39 | } xfs_buf_rw_t; |
40 | 40 | ||
41 | #define XBF_READ (1 << 0) /* buffer intended for reading from device */ | 41 | #define XBF_READ (1 << 0) /* buffer intended for reading from device */ |
42 | #define XBF_WRITE (1 << 1) /* buffer intended for writing to device */ | 42 | #define XBF_WRITE (1 << 1) /* buffer intended for writing to device */ |
43 | #define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */ | 43 | #define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */ |
44 | #define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */ | 44 | #define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */ |
45 | #define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */ | 45 | #define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */ |
46 | #define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */ | 46 | #define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */ |
47 | 47 | ||
48 | /* I/O hints for the BIO layer */ | 48 | /* I/O hints for the BIO layer */ |
49 | #define XBF_SYNCIO (1 << 10)/* treat this buffer as synchronous I/O */ | 49 | #define XBF_SYNCIO (1 << 10)/* treat this buffer as synchronous I/O */ |
50 | #define XBF_FUA (1 << 11)/* force cache write through mode */ | 50 | #define XBF_FUA (1 << 11)/* force cache write through mode */ |
51 | #define XBF_FLUSH (1 << 12)/* flush the disk cache before a write */ | 51 | #define XBF_FLUSH (1 << 12)/* flush the disk cache before a write */ |
52 | 52 | ||
53 | /* flags used only as arguments to access routines */ | 53 | /* flags used only as arguments to access routines */ |
54 | #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ | 54 | #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ |
55 | #define XBF_UNMAPPED (1 << 17)/* do not map the buffer */ | 55 | #define XBF_UNMAPPED (1 << 17)/* do not map the buffer */ |
56 | 56 | ||
57 | /* flags used only internally */ | 57 | /* flags used only internally */ |
58 | #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ | 58 | #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ |
59 | #define _XBF_KMEM (1 << 21)/* backed by heap memory */ | 59 | #define _XBF_KMEM (1 << 21)/* backed by heap memory */ |
60 | #define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */ | 60 | #define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */ |
61 | #define _XBF_COMPOUND (1 << 23)/* compound buffer */ | 61 | #define _XBF_COMPOUND (1 << 23)/* compound buffer */ |
62 | #define _XBF_LRU_DISPOSE (1 << 24)/* buffer being discarded */ | ||
62 | 63 | ||
63 | typedef unsigned int xfs_buf_flags_t; | 64 | typedef unsigned int xfs_buf_flags_t; |
64 | 65 | ||
@@ -72,12 +73,13 @@ typedef unsigned int xfs_buf_flags_t; | |||
72 | { XBF_SYNCIO, "SYNCIO" }, \ | 73 | { XBF_SYNCIO, "SYNCIO" }, \ |
73 | { XBF_FUA, "FUA" }, \ | 74 | { XBF_FUA, "FUA" }, \ |
74 | { XBF_FLUSH, "FLUSH" }, \ | 75 | { XBF_FLUSH, "FLUSH" }, \ |
75 | { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ | 76 | { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ |
76 | { XBF_UNMAPPED, "UNMAPPED" }, /* ditto */\ | 77 | { XBF_UNMAPPED, "UNMAPPED" }, /* ditto */\ |
77 | { _XBF_PAGES, "PAGES" }, \ | 78 | { _XBF_PAGES, "PAGES" }, \ |
78 | { _XBF_KMEM, "KMEM" }, \ | 79 | { _XBF_KMEM, "KMEM" }, \ |
79 | { _XBF_DELWRI_Q, "DELWRI_Q" }, \ | 80 | { _XBF_DELWRI_Q, "DELWRI_Q" }, \ |
80 | { _XBF_COMPOUND, "COMPOUND" } | 81 | { _XBF_COMPOUND, "COMPOUND" }, \ |
82 | { _XBF_LRU_DISPOSE, "LRU_DISPOSE" } | ||
81 | 83 | ||
82 | typedef struct xfs_buftarg { | 84 | typedef struct xfs_buftarg { |
83 | dev_t bt_dev; | 85 | dev_t bt_dev; |
@@ -124,7 +126,12 @@ typedef struct xfs_buf { | |||
124 | xfs_buf_flags_t b_flags; /* status flags */ | 126 | xfs_buf_flags_t b_flags; /* status flags */ |
125 | struct semaphore b_sema; /* semaphore for lockables */ | 127 | struct semaphore b_sema; /* semaphore for lockables */ |
126 | 128 | ||
129 | /* | ||
130 | * concurrent access to b_lru and b_lru_flags are protected by | ||
131 | * bt_lru_lock and not by b_sema | ||
132 | */ | ||
127 | struct list_head b_lru; /* lru list */ | 133 | struct list_head b_lru; /* lru list */ |
134 | xfs_buf_flags_t b_lru_flags; /* internal lru status flags */ | ||
128 | wait_queue_head_t b_waiters; /* unpin waiters */ | 135 | wait_queue_head_t b_waiters; /* unpin waiters */ |
129 | struct list_head b_list; | 136 | struct list_head b_list; |
130 | struct xfs_perag *b_pag; /* contains rbtree root */ | 137 | struct xfs_perag *b_pag; /* contains rbtree root */ |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index bdaf4cb9f4a2..19e2380fb867 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -919,6 +919,7 @@ xfs_fs_put_super( | |||
919 | struct xfs_mount *mp = XFS_M(sb); | 919 | struct xfs_mount *mp = XFS_M(sb); |
920 | 920 | ||
921 | xfs_filestream_unmount(mp); | 921 | xfs_filestream_unmount(mp); |
922 | cancel_delayed_work_sync(&mp->m_sync_work); | ||
922 | xfs_unmountfs(mp); | 923 | xfs_unmountfs(mp); |
923 | xfs_syncd_stop(mp); | 924 | xfs_syncd_stop(mp); |
924 | xfs_freesb(mp); | 925 | xfs_freesb(mp); |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 991ef01cd77e..3748ec92dcbc 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -691,9 +691,11 @@ __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ | |||
691 | #define __NR_process_vm_writev 271 | 691 | #define __NR_process_vm_writev 271 |
692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ | 692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ |
693 | compat_sys_process_vm_writev) | 693 | compat_sys_process_vm_writev) |
694 | #define __NR_kcmp 272 | ||
695 | __SYSCALL(__NR_kcmp, sys_kcmp) | ||
694 | 696 | ||
695 | #undef __NR_syscalls | 697 | #undef __NR_syscalls |
696 | #define __NR_syscalls 272 | 698 | #define __NR_syscalls 273 |
697 | 699 | ||
698 | /* | 700 | /* |
699 | * All syscalls below here should go away really, | 701 | * All syscalls below here should go away really, |
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index 06023393fba9..4eb31752e2b7 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/platform_device.h> | 4 | #include <linux/platform_device.h> |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/io.h> | ||
6 | 7 | ||
7 | struct ssc_device { | 8 | struct ssc_device { |
8 | struct list_head list; | 9 | struct list_head list; |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 2f4079175afb..934bc34d5f99 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
@@ -49,6 +49,13 @@ | |||
49 | #endif | 49 | #endif |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #if __GNUC_MINOR__ >= 6 | ||
53 | /* | ||
54 | * Tell the optimizer that something else uses this function or variable. | ||
55 | */ | ||
56 | #define __visible __attribute__((externally_visible)) | ||
57 | #endif | ||
58 | |||
52 | #if __GNUC_MINOR__ > 0 | 59 | #if __GNUC_MINOR__ > 0 |
53 | #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) | 60 | #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) |
54 | #endif | 61 | #endif |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 923d093c9cea..f430e4162f41 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -278,6 +278,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
278 | # define __section(S) __attribute__ ((__section__(#S))) | 278 | # define __section(S) __attribute__ ((__section__(#S))) |
279 | #endif | 279 | #endif |
280 | 280 | ||
281 | #ifndef __visible | ||
282 | #define __visible | ||
283 | #endif | ||
284 | |||
281 | /* Are two types/vars the same type (ignoring qualifiers)? */ | 285 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
282 | #ifndef __same_type | 286 | #ifndef __same_type |
283 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | 287 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index caa34e50537e..59200795482e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -206,6 +206,8 @@ struct dentry_operations { | |||
206 | #define DCACHE_MANAGED_DENTRY \ | 206 | #define DCACHE_MANAGED_DENTRY \ |
207 | (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) | 207 | (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) |
208 | 208 | ||
209 | #define DCACHE_DENTRY_KILLED 0x100000 | ||
210 | |||
209 | extern seqlock_t rename_lock; | 211 | extern seqlock_t rename_lock; |
210 | 212 | ||
211 | static inline int dname_external(struct dentry *dentry) | 213 | static inline int dname_external(struct dentry *dentry) |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 594b419b7d20..2451f1f7a1d9 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -91,7 +91,7 @@ | |||
91 | { \ | 91 | { \ |
92 | typeof(x) __x = x; \ | 92 | typeof(x) __x = x; \ |
93 | typeof(divisor) __d = divisor; \ | 93 | typeof(divisor) __d = divisor; \ |
94 | (((typeof(x))-1) >= 0 || (__x) >= 0) ? \ | 94 | (((typeof(x))-1) > 0 || (__x) > 0) ? \ |
95 | (((__x) + ((__d) / 2)) / (__d)) : \ | 95 | (((__x) + ((__d) / 2)) / (__d)) : \ |
96 | (((__x) - ((__d) / 2)) / (__d)); \ | 96 | (((__x) - ((__d) / 2)) / (__d)); \ |
97 | } \ | 97 | } \ |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 1ac7f6e405f9..ff9a9f8e0ed9 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | 21 | ||
22 | #define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS) | 22 | #define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS) |
23 | 23 | ||
24 | struct memory_block { | 24 | struct memory_block { |
25 | unsigned long start_section_nr; | 25 | unsigned long start_section_nr; |
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index 3a8435a8058f..cebe97ee98b8 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h | |||
@@ -16,6 +16,8 @@ | |||
16 | 16 | ||
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | 18 | ||
19 | struct irq_domain; | ||
20 | |||
19 | /* | 21 | /* |
20 | * This struct describes the MFD part ("cell"). | 22 | * This struct describes the MFD part ("cell"). |
21 | * After registration the copy of this structure will become the platform data | 23 | * After registration the copy of this structure will become the platform data |
@@ -98,7 +100,7 @@ static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev) | |||
98 | extern int mfd_add_devices(struct device *parent, int id, | 100 | extern int mfd_add_devices(struct device *parent, int id, |
99 | struct mfd_cell *cells, int n_devs, | 101 | struct mfd_cell *cells, int n_devs, |
100 | struct resource *mem_base, | 102 | struct resource *mem_base, |
101 | int irq_base); | 103 | int irq_base, struct irq_domain *irq_domain); |
102 | 104 | ||
103 | extern void mfd_remove_devices(struct device *parent); | 105 | extern void mfd_remove_devices(struct device *parent); |
104 | 106 | ||
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h index 12c06870829a..7cd83d826ed8 100644 --- a/include/linux/mfd/tps65217.h +++ b/include/linux/mfd/tps65217.h | |||
@@ -22,6 +22,9 @@ | |||
22 | #include <linux/regulator/driver.h> | 22 | #include <linux/regulator/driver.h> |
23 | #include <linux/regulator/machine.h> | 23 | #include <linux/regulator/machine.h> |
24 | 24 | ||
25 | /* TPS chip id list */ | ||
26 | #define TPS65217 0xF0 | ||
27 | |||
25 | /* I2C ID for TPS65217 part */ | 28 | /* I2C ID for TPS65217 part */ |
26 | #define TPS65217_I2C_ID 0x24 | 29 | #define TPS65217_I2C_ID 0x24 |
27 | 30 | ||
@@ -248,13 +251,11 @@ struct tps_info { | |||
248 | struct tps65217 { | 251 | struct tps65217 { |
249 | struct device *dev; | 252 | struct device *dev; |
250 | struct tps65217_board *pdata; | 253 | struct tps65217_board *pdata; |
254 | unsigned int id; | ||
251 | struct regulator_desc desc[TPS65217_NUM_REGULATOR]; | 255 | struct regulator_desc desc[TPS65217_NUM_REGULATOR]; |
252 | struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; | 256 | struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; |
253 | struct tps_info *info[TPS65217_NUM_REGULATOR]; | 257 | struct tps_info *info[TPS65217_NUM_REGULATOR]; |
254 | struct regmap *regmap; | 258 | struct regmap *regmap; |
255 | |||
256 | /* Client devices */ | ||
257 | struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR]; | ||
258 | }; | 259 | }; |
259 | 260 | ||
260 | static inline struct tps65217 *dev_to_tps65217(struct device *dev) | 261 | static inline struct tps65217 *dev_to_tps65217(struct device *dev) |
@@ -262,6 +263,11 @@ static inline struct tps65217 *dev_to_tps65217(struct device *dev) | |||
262 | return dev_get_drvdata(dev); | 263 | return dev_get_drvdata(dev); |
263 | } | 264 | } |
264 | 265 | ||
266 | static inline int tps65217_chip_id(struct tps65217 *tps65217) | ||
267 | { | ||
268 | return tps65217->id; | ||
269 | } | ||
270 | |||
265 | int tps65217_reg_read(struct tps65217 *tps, unsigned int reg, | 271 | int tps65217_reg_read(struct tps65217 *tps, unsigned int reg, |
266 | unsigned int *val); | 272 | unsigned int *val); |
267 | int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, | 273 | int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, |
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 61f0905bdc48..de201203bc7c 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h | |||
@@ -1,3 +1,15 @@ | |||
1 | /* | ||
2 | * include/linux/micrel_phy.h | ||
3 | * | ||
4 | * Micrel PHY IDs | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
1 | #ifndef _MICREL_PHY_H | 13 | #ifndef _MICREL_PHY_H |
2 | #define _MICREL_PHY_H | 14 | #define _MICREL_PHY_H |
3 | 15 | ||
@@ -5,10 +17,11 @@ | |||
5 | 17 | ||
6 | #define PHY_ID_KSZ9021 0x00221610 | 18 | #define PHY_ID_KSZ9021 0x00221610 |
7 | #define PHY_ID_KS8737 0x00221720 | 19 | #define PHY_ID_KS8737 0x00221720 |
8 | #define PHY_ID_KS8041 0x00221510 | 20 | #define PHY_ID_KSZ8021 0x00221555 |
9 | #define PHY_ID_KS8051 0x00221550 | 21 | #define PHY_ID_KSZ8041 0x00221510 |
22 | #define PHY_ID_KSZ8051 0x00221550 | ||
10 | /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ | 23 | /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ |
11 | #define PHY_ID_KS8001 0x0022161A | 24 | #define PHY_ID_KSZ8001 0x0022161A |
12 | 25 | ||
13 | /* struct phy_device dev_flags definitions */ | 26 | /* struct phy_device dev_flags definitions */ |
14 | #define MICREL_PHY_50MHZ_CLK 0x00000001 | 27 | #define MICREL_PHY_50MHZ_CLK 0x00000001 |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 33ed9d605f91..bdb41612bfec 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -274,6 +274,8 @@ struct perf_event_attr { | |||
274 | __u64 branch_sample_type; /* enum branch_sample_type */ | 274 | __u64 branch_sample_type; /* enum branch_sample_type */ |
275 | }; | 275 | }; |
276 | 276 | ||
277 | #define perf_flags(attr) (*(&(attr)->read_format + 1)) | ||
278 | |||
277 | /* | 279 | /* |
278 | * Ioctls that can be done on a perf event fd: | 280 | * Ioctls that can be done on a perf event fd: |
279 | */ | 281 | */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index a8e2413f6bc3..439d35ab5673 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -954,7 +954,6 @@ struct sched_domain { | |||
954 | unsigned int smt_gain; | 954 | unsigned int smt_gain; |
955 | int flags; /* See SD_* */ | 955 | int flags; /* See SD_* */ |
956 | int level; | 956 | int level; |
957 | int idle_buddy; /* cpu assigned to select_idle_sibling() */ | ||
958 | 957 | ||
959 | /* Runtime fields. */ | 958 | /* Runtime fields. */ |
960 | unsigned long last_balance; /* init to jiffies. units in jiffies */ | 959 | unsigned long last_balance; /* init to jiffies. units in jiffies */ |
diff --git a/include/linux/security.h b/include/linux/security.h index 3dea6a9d568f..d143b8e01954 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -118,6 +118,7 @@ void reset_security_ops(void); | |||
118 | extern unsigned long mmap_min_addr; | 118 | extern unsigned long mmap_min_addr; |
119 | extern unsigned long dac_mmap_min_addr; | 119 | extern unsigned long dac_mmap_min_addr; |
120 | #else | 120 | #else |
121 | #define mmap_min_addr 0UL | ||
121 | #define dac_mmap_min_addr 0UL | 122 | #define dac_mmap_min_addr 0UL |
122 | #endif | 123 | #endif |
123 | 124 | ||
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 22e61fdf75a2..28e493b5b94c 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -84,6 +84,8 @@ struct xfrm_replay_state { | |||
84 | __u32 bitmap; | 84 | __u32 bitmap; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | #define XFRMA_REPLAY_ESN_MAX 4096 | ||
88 | |||
87 | struct xfrm_replay_state_esn { | 89 | struct xfrm_replay_state_esn { |
88 | unsigned int bmp_len; | 90 | unsigned int bmp_len; |
89 | __u32 oseq; | 91 | __u32 oseq; |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index cd64cf35a49f..8a2a203eb15d 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -112,9 +112,8 @@ struct rt6_info { | |||
112 | struct inet6_dev *rt6i_idev; | 112 | struct inet6_dev *rt6i_idev; |
113 | unsigned long _rt6i_peer; | 113 | unsigned long _rt6i_peer; |
114 | 114 | ||
115 | #ifdef CONFIG_XFRM | 115 | u32 rt6i_genid; |
116 | u32 rt6i_flow_cache_genid; | 116 | |
117 | #endif | ||
118 | /* more non-fragment space at head required */ | 117 | /* more non-fragment space at head required */ |
119 | unsigned short rt6i_nfheader_len; | 118 | unsigned short rt6i_nfheader_len; |
120 | 119 | ||
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index d61e2b36d9e3..4faf6612ecac 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -110,6 +110,7 @@ struct net { | |||
110 | #endif | 110 | #endif |
111 | struct netns_ipvs *ipvs; | 111 | struct netns_ipvs *ipvs; |
112 | struct sock *diag_nlsk; | 112 | struct sock *diag_nlsk; |
113 | atomic_t rt_genid; | ||
113 | }; | 114 | }; |
114 | 115 | ||
115 | /* | 116 | /* |
@@ -315,5 +316,14 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header) | |||
315 | } | 316 | } |
316 | #endif | 317 | #endif |
317 | 318 | ||
319 | static inline int rt_genid(struct net *net) | ||
320 | { | ||
321 | return atomic_read(&net->rt_genid); | ||
322 | } | ||
323 | |||
324 | static inline void rt_genid_bump(struct net *net) | ||
325 | { | ||
326 | atomic_inc(&net->rt_genid); | ||
327 | } | ||
318 | 328 | ||
319 | #endif /* __NET_NET_NAMESPACE_H */ | 329 | #endif /* __NET_NET_NAMESPACE_H */ |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 7d00583d53da..2ae2b8372cfd 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -64,7 +64,6 @@ struct netns_ipv4 { | |||
64 | kgid_t sysctl_ping_group_range[2]; | 64 | kgid_t sysctl_ping_group_range[2]; |
65 | long sysctl_tcp_mem[3]; | 65 | long sysctl_tcp_mem[3]; |
66 | 66 | ||
67 | atomic_t rt_genid; | ||
68 | atomic_t dev_addr_genid; | 67 | atomic_t dev_addr_genid; |
69 | 68 | ||
70 | #ifdef CONFIG_IP_MROUTE | 69 | #ifdef CONFIG_IP_MROUTE |
diff --git a/include/net/sock.h b/include/net/sock.h index bc476a19f28e..c9175562039f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1339,7 +1339,7 @@ static inline bool sk_wmem_schedule(struct sock *sk, int size) | |||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | static inline bool | 1341 | static inline bool |
1342 | sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, unsigned int size) | 1342 | sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size) |
1343 | { | 1343 | { |
1344 | if (!sk_has_account(sk)) | 1344 | if (!sk_has_account(sk)) |
1345 | return true; | 1345 | return true; |
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index f1405d335a96..941c84bf1065 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
@@ -23,7 +23,9 @@ struct se_subsystem_api { | |||
23 | struct se_device *(*create_virtdevice)(struct se_hba *, | 23 | struct se_device *(*create_virtdevice)(struct se_hba *, |
24 | struct se_subsystem_dev *, void *); | 24 | struct se_subsystem_dev *, void *); |
25 | void (*free_device)(void *); | 25 | void (*free_device)(void *); |
26 | int (*transport_complete)(struct se_cmd *cmd, struct scatterlist *); | 26 | void (*transport_complete)(struct se_cmd *cmd, |
27 | struct scatterlist *, | ||
28 | unsigned char *); | ||
27 | 29 | ||
28 | int (*parse_cdb)(struct se_cmd *cmd); | 30 | int (*parse_cdb)(struct se_cmd *cmd); |
29 | ssize_t (*check_configfs_dev_params)(struct se_hba *, | 31 | ssize_t (*check_configfs_dev_params)(struct se_hba *, |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 015cea01ae39..5be89373ceac 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -121,6 +121,7 @@ | |||
121 | 121 | ||
122 | #define SE_INQUIRY_BUF 512 | 122 | #define SE_INQUIRY_BUF 512 |
123 | #define SE_MODE_PAGE_BUF 512 | 123 | #define SE_MODE_PAGE_BUF 512 |
124 | #define SE_SENSE_BUF 96 | ||
124 | 125 | ||
125 | /* struct se_hba->hba_flags */ | 126 | /* struct se_hba->hba_flags */ |
126 | enum hba_flags_table { | 127 | enum hba_flags_table { |
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index 5f889f16b0c8..08fa27244da7 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h | |||
@@ -214,7 +214,7 @@ TRACE_EVENT(mm_page_alloc, | |||
214 | 214 | ||
215 | TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s", | 215 | TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s", |
216 | __entry->page, | 216 | __entry->page, |
217 | page_to_pfn(__entry->page), | 217 | __entry->page ? page_to_pfn(__entry->page) : 0, |
218 | __entry->order, | 218 | __entry->order, |
219 | __entry->migratetype, | 219 | __entry->migratetype, |
220 | show_gfp_flags(__entry->gfp_flags)) | 220 | show_gfp_flags(__entry->gfp_flags)) |
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(mm_page, | |||
240 | 240 | ||
241 | TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d", | 241 | TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d", |
242 | __entry->page, | 242 | __entry->page, |
243 | page_to_pfn(__entry->page), | 243 | __entry->page ? page_to_pfn(__entry->page) : 0, |
244 | __entry->order, | 244 | __entry->order, |
245 | __entry->migratetype, | 245 | __entry->migratetype, |
246 | __entry->order == 0) | 246 | __entry->order == 0) |
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 11e27c3af3cb..f19fff8650e9 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h | |||
@@ -187,6 +187,7 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
187 | struct gnttab_map_grant_ref *kmap_ops, | 187 | struct gnttab_map_grant_ref *kmap_ops, |
188 | struct page **pages, unsigned int count); | 188 | struct page **pages, unsigned int count); |
189 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | 189 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, |
190 | struct page **pages, unsigned int count, bool clear_pte); | 190 | struct gnttab_map_grant_ref *kunmap_ops, |
191 | struct page **pages, unsigned int count); | ||
191 | 192 | ||
192 | #endif /* __ASM_GNTTAB_H__ */ | 193 | #endif /* __ASM_GNTTAB_H__ */ |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index baa528d7dfbd..478bad2745e3 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -234,15 +234,19 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write, | |||
234 | */ | 234 | */ |
235 | 235 | ||
236 | tmp.data = ¤t->nsproxy->pid_ns->last_pid; | 236 | tmp.data = ¤t->nsproxy->pid_ns->last_pid; |
237 | return proc_dointvec(&tmp, write, buffer, lenp, ppos); | 237 | return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
238 | } | 238 | } |
239 | 239 | ||
240 | extern int pid_max; | ||
241 | static int zero = 0; | ||
240 | static struct ctl_table pid_ns_ctl_table[] = { | 242 | static struct ctl_table pid_ns_ctl_table[] = { |
241 | { | 243 | { |
242 | .procname = "ns_last_pid", | 244 | .procname = "ns_last_pid", |
243 | .maxlen = sizeof(int), | 245 | .maxlen = sizeof(int), |
244 | .mode = 0666, /* permissions are checked in the handler */ | 246 | .mode = 0666, /* permissions are checked in the handler */ |
245 | .proc_handler = pid_ns_ctl_handler, | 247 | .proc_handler = pid_ns_ctl_handler, |
248 | .extra1 = &zero, | ||
249 | .extra2 = &pid_max, | ||
246 | }, | 250 | }, |
247 | { } | 251 | { } |
248 | }; | 252 | }; |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a4ea245f3d85..649c9f876cb1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -6014,11 +6014,6 @@ static void destroy_sched_domains(struct sched_domain *sd, int cpu) | |||
6014 | * SD_SHARE_PKG_RESOURCE set (Last Level Cache Domain) for this | 6014 | * SD_SHARE_PKG_RESOURCE set (Last Level Cache Domain) for this |
6015 | * allows us to avoid some pointer chasing select_idle_sibling(). | 6015 | * allows us to avoid some pointer chasing select_idle_sibling(). |
6016 | * | 6016 | * |
6017 | * Iterate domains and sched_groups downward, assigning CPUs to be | ||
6018 | * select_idle_sibling() hw buddy. Cross-wiring hw makes bouncing | ||
6019 | * due to random perturbation self canceling, ie sw buddies pull | ||
6020 | * their counterpart to their CPU's hw counterpart. | ||
6021 | * | ||
6022 | * Also keep a unique ID per domain (we use the first cpu number in | 6017 | * Also keep a unique ID per domain (we use the first cpu number in |
6023 | * the cpumask of the domain), this allows us to quickly tell if | 6018 | * the cpumask of the domain), this allows us to quickly tell if |
6024 | * two cpus are in the same cache domain, see cpus_share_cache(). | 6019 | * two cpus are in the same cache domain, see cpus_share_cache(). |
@@ -6032,40 +6027,8 @@ static void update_top_cache_domain(int cpu) | |||
6032 | int id = cpu; | 6027 | int id = cpu; |
6033 | 6028 | ||
6034 | sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES); | 6029 | sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES); |
6035 | if (sd) { | 6030 | if (sd) |
6036 | struct sched_domain *tmp = sd; | ||
6037 | struct sched_group *sg, *prev; | ||
6038 | bool right; | ||
6039 | |||
6040 | /* | ||
6041 | * Traverse to first CPU in group, and count hops | ||
6042 | * to cpu from there, switching direction on each | ||
6043 | * hop, never ever pointing the last CPU rightward. | ||
6044 | */ | ||
6045 | do { | ||
6046 | id = cpumask_first(sched_domain_span(tmp)); | ||
6047 | prev = sg = tmp->groups; | ||
6048 | right = 1; | ||
6049 | |||
6050 | while (cpumask_first(sched_group_cpus(sg)) != id) | ||
6051 | sg = sg->next; | ||
6052 | |||
6053 | while (!cpumask_test_cpu(cpu, sched_group_cpus(sg))) { | ||
6054 | prev = sg; | ||
6055 | sg = sg->next; | ||
6056 | right = !right; | ||
6057 | } | ||
6058 | |||
6059 | /* A CPU went down, never point back to domain start. */ | ||
6060 | if (right && cpumask_first(sched_group_cpus(sg->next)) == id) | ||
6061 | right = false; | ||
6062 | |||
6063 | sg = right ? sg->next : prev; | ||
6064 | tmp->idle_buddy = cpumask_first(sched_group_cpus(sg)); | ||
6065 | } while ((tmp = tmp->child)); | ||
6066 | |||
6067 | id = cpumask_first(sched_domain_span(sd)); | 6031 | id = cpumask_first(sched_domain_span(sd)); |
6068 | } | ||
6069 | 6032 | ||
6070 | rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); | 6033 | rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); |
6071 | per_cpu(sd_llc_id, cpu) = id; | 6034 | per_cpu(sd_llc_id, cpu) = id; |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 42d9df6a5ca4..96e2b18b6283 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -2637,6 +2637,8 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
2637 | int cpu = smp_processor_id(); | 2637 | int cpu = smp_processor_id(); |
2638 | int prev_cpu = task_cpu(p); | 2638 | int prev_cpu = task_cpu(p); |
2639 | struct sched_domain *sd; | 2639 | struct sched_domain *sd; |
2640 | struct sched_group *sg; | ||
2641 | int i; | ||
2640 | 2642 | ||
2641 | /* | 2643 | /* |
2642 | * If the task is going to be woken-up on this cpu and if it is | 2644 | * If the task is going to be woken-up on this cpu and if it is |
@@ -2653,17 +2655,29 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
2653 | return prev_cpu; | 2655 | return prev_cpu; |
2654 | 2656 | ||
2655 | /* | 2657 | /* |
2656 | * Otherwise, check assigned siblings to find an elegible idle cpu. | 2658 | * Otherwise, iterate the domains and find an elegible idle cpu. |
2657 | */ | 2659 | */ |
2658 | sd = rcu_dereference(per_cpu(sd_llc, target)); | 2660 | sd = rcu_dereference(per_cpu(sd_llc, target)); |
2659 | |||
2660 | for_each_lower_domain(sd) { | 2661 | for_each_lower_domain(sd) { |
2661 | if (!cpumask_test_cpu(sd->idle_buddy, tsk_cpus_allowed(p))) | 2662 | sg = sd->groups; |
2662 | continue; | 2663 | do { |
2663 | if (idle_cpu(sd->idle_buddy)) | 2664 | if (!cpumask_intersects(sched_group_cpus(sg), |
2664 | return sd->idle_buddy; | 2665 | tsk_cpus_allowed(p))) |
2665 | } | 2666 | goto next; |
2666 | 2667 | ||
2668 | for_each_cpu(i, sched_group_cpus(sg)) { | ||
2669 | if (!idle_cpu(i)) | ||
2670 | goto next; | ||
2671 | } | ||
2672 | |||
2673 | target = cpumask_first_and(sched_group_cpus(sg), | ||
2674 | tsk_cpus_allowed(p)); | ||
2675 | goto done; | ||
2676 | next: | ||
2677 | sg = sg->next; | ||
2678 | } while (sg != sd->groups); | ||
2679 | } | ||
2680 | done: | ||
2667 | return target; | 2681 | return target; |
2668 | } | 2682 | } |
2669 | 2683 | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 34e5eac81424..d3b91e75cecd 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -303,10 +303,11 @@ void getnstimeofday(struct timespec *ts) | |||
303 | seq = read_seqbegin(&tk->lock); | 303 | seq = read_seqbegin(&tk->lock); |
304 | 304 | ||
305 | ts->tv_sec = tk->xtime_sec; | 305 | ts->tv_sec = tk->xtime_sec; |
306 | ts->tv_nsec = timekeeping_get_ns(tk); | 306 | nsecs = timekeeping_get_ns(tk); |
307 | 307 | ||
308 | } while (read_seqretry(&tk->lock, seq)); | 308 | } while (read_seqretry(&tk->lock, seq)); |
309 | 309 | ||
310 | ts->tv_nsec = 0; | ||
310 | timespec_add_ns(ts, nsecs); | 311 | timespec_add_ns(ts, nsecs); |
311 | } | 312 | } |
312 | EXPORT_SYMBOL(getnstimeofday); | 313 | EXPORT_SYMBOL(getnstimeofday); |
@@ -345,6 +346,7 @@ void ktime_get_ts(struct timespec *ts) | |||
345 | { | 346 | { |
346 | struct timekeeper *tk = &timekeeper; | 347 | struct timekeeper *tk = &timekeeper; |
347 | struct timespec tomono; | 348 | struct timespec tomono; |
349 | s64 nsec; | ||
348 | unsigned int seq; | 350 | unsigned int seq; |
349 | 351 | ||
350 | WARN_ON(timekeeping_suspended); | 352 | WARN_ON(timekeeping_suspended); |
@@ -352,13 +354,14 @@ void ktime_get_ts(struct timespec *ts) | |||
352 | do { | 354 | do { |
353 | seq = read_seqbegin(&tk->lock); | 355 | seq = read_seqbegin(&tk->lock); |
354 | ts->tv_sec = tk->xtime_sec; | 356 | ts->tv_sec = tk->xtime_sec; |
355 | ts->tv_nsec = timekeeping_get_ns(tk); | 357 | nsec = timekeeping_get_ns(tk); |
356 | tomono = tk->wall_to_monotonic; | 358 | tomono = tk->wall_to_monotonic; |
357 | 359 | ||
358 | } while (read_seqretry(&tk->lock, seq)); | 360 | } while (read_seqretry(&tk->lock, seq)); |
359 | 361 | ||
360 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, | 362 | ts->tv_sec += tomono.tv_sec; |
361 | ts->tv_nsec + tomono.tv_nsec); | 363 | ts->tv_nsec = 0; |
364 | timespec_add_ns(ts, nsec + tomono.tv_nsec); | ||
362 | } | 365 | } |
363 | EXPORT_SYMBOL_GPL(ktime_get_ts); | 366 | EXPORT_SYMBOL_GPL(ktime_get_ts); |
364 | 367 | ||
@@ -1244,6 +1247,7 @@ void get_monotonic_boottime(struct timespec *ts) | |||
1244 | { | 1247 | { |
1245 | struct timekeeper *tk = &timekeeper; | 1248 | struct timekeeper *tk = &timekeeper; |
1246 | struct timespec tomono, sleep; | 1249 | struct timespec tomono, sleep; |
1250 | s64 nsec; | ||
1247 | unsigned int seq; | 1251 | unsigned int seq; |
1248 | 1252 | ||
1249 | WARN_ON(timekeeping_suspended); | 1253 | WARN_ON(timekeeping_suspended); |
@@ -1251,14 +1255,15 @@ void get_monotonic_boottime(struct timespec *ts) | |||
1251 | do { | 1255 | do { |
1252 | seq = read_seqbegin(&tk->lock); | 1256 | seq = read_seqbegin(&tk->lock); |
1253 | ts->tv_sec = tk->xtime_sec; | 1257 | ts->tv_sec = tk->xtime_sec; |
1254 | ts->tv_nsec = timekeeping_get_ns(tk); | 1258 | nsec = timekeeping_get_ns(tk); |
1255 | tomono = tk->wall_to_monotonic; | 1259 | tomono = tk->wall_to_monotonic; |
1256 | sleep = tk->total_sleep_time; | 1260 | sleep = tk->total_sleep_time; |
1257 | 1261 | ||
1258 | } while (read_seqretry(&tk->lock, seq)); | 1262 | } while (read_seqretry(&tk->lock, seq)); |
1259 | 1263 | ||
1260 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec, | 1264 | ts->tv_sec += tomono.tv_sec + sleep.tv_sec; |
1261 | ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec); | 1265 | ts->tv_nsec = 0; |
1266 | timespec_add_ns(ts, nsec + tomono.tv_nsec + sleep.tv_nsec); | ||
1262 | } | 1267 | } |
1263 | EXPORT_SYMBOL_GPL(get_monotonic_boottime); | 1268 | EXPORT_SYMBOL_GPL(get_monotonic_boottime); |
1264 | 1269 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 1e1373bcb3e3..3c5a79e2134c 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1349,8 +1349,16 @@ static void busy_worker_rebind_fn(struct work_struct *work) | |||
1349 | struct worker *worker = container_of(work, struct worker, rebind_work); | 1349 | struct worker *worker = container_of(work, struct worker, rebind_work); |
1350 | struct global_cwq *gcwq = worker->pool->gcwq; | 1350 | struct global_cwq *gcwq = worker->pool->gcwq; |
1351 | 1351 | ||
1352 | if (worker_maybe_bind_and_lock(worker)) | 1352 | worker_maybe_bind_and_lock(worker); |
1353 | worker_clr_flags(worker, WORKER_REBIND); | 1353 | |
1354 | /* | ||
1355 | * %WORKER_REBIND must be cleared even if the above binding failed; | ||
1356 | * otherwise, we may confuse the next CPU_UP cycle or oops / get | ||
1357 | * stuck by calling idle_worker_rebind() prematurely. If CPU went | ||
1358 | * down again inbetween, %WORKER_UNBOUND would be set, so clearing | ||
1359 | * %WORKER_REBIND is always safe. | ||
1360 | */ | ||
1361 | worker_clr_flags(worker, WORKER_REBIND); | ||
1354 | 1362 | ||
1355 | spin_unlock_irq(&gcwq->lock); | 1363 | spin_unlock_irq(&gcwq->lock); |
1356 | } | 1364 | } |
@@ -3568,18 +3576,17 @@ static int __devinit workqueue_cpu_down_callback(struct notifier_block *nfb, | |||
3568 | #ifdef CONFIG_SMP | 3576 | #ifdef CONFIG_SMP |
3569 | 3577 | ||
3570 | struct work_for_cpu { | 3578 | struct work_for_cpu { |
3571 | struct completion completion; | 3579 | struct work_struct work; |
3572 | long (*fn)(void *); | 3580 | long (*fn)(void *); |
3573 | void *arg; | 3581 | void *arg; |
3574 | long ret; | 3582 | long ret; |
3575 | }; | 3583 | }; |
3576 | 3584 | ||
3577 | static int do_work_for_cpu(void *_wfc) | 3585 | static void work_for_cpu_fn(struct work_struct *work) |
3578 | { | 3586 | { |
3579 | struct work_for_cpu *wfc = _wfc; | 3587 | struct work_for_cpu *wfc = container_of(work, struct work_for_cpu, work); |
3588 | |||
3580 | wfc->ret = wfc->fn(wfc->arg); | 3589 | wfc->ret = wfc->fn(wfc->arg); |
3581 | complete(&wfc->completion); | ||
3582 | return 0; | ||
3583 | } | 3590 | } |
3584 | 3591 | ||
3585 | /** | 3592 | /** |
@@ -3594,19 +3601,11 @@ static int do_work_for_cpu(void *_wfc) | |||
3594 | */ | 3601 | */ |
3595 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | 3602 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) |
3596 | { | 3603 | { |
3597 | struct task_struct *sub_thread; | 3604 | struct work_for_cpu wfc = { .fn = fn, .arg = arg }; |
3598 | struct work_for_cpu wfc = { | ||
3599 | .completion = COMPLETION_INITIALIZER_ONSTACK(wfc.completion), | ||
3600 | .fn = fn, | ||
3601 | .arg = arg, | ||
3602 | }; | ||
3603 | 3605 | ||
3604 | sub_thread = kthread_create(do_work_for_cpu, &wfc, "work_for_cpu"); | 3606 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); |
3605 | if (IS_ERR(sub_thread)) | 3607 | schedule_work_on(cpu, &wfc.work); |
3606 | return PTR_ERR(sub_thread); | 3608 | flush_work(&wfc.work); |
3607 | kthread_bind(sub_thread, cpu); | ||
3608 | wake_up_process(sub_thread); | ||
3609 | wait_for_completion(&wfc.completion); | ||
3610 | return wfc.ret; | 3609 | return wfc.ret; |
3611 | } | 3610 | } |
3612 | EXPORT_SYMBOL_GPL(work_on_cpu); | 3611 | EXPORT_SYMBOL_GPL(work_on_cpu); |
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index c785554f9523..ebf3bac460b0 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c | |||
@@ -62,7 +62,7 @@ void fprop_global_destroy(struct fprop_global *p) | |||
62 | */ | 62 | */ |
63 | bool fprop_new_period(struct fprop_global *p, int periods) | 63 | bool fprop_new_period(struct fprop_global *p, int periods) |
64 | { | 64 | { |
65 | u64 events; | 65 | s64 events; |
66 | unsigned long flags; | 66 | unsigned long flags; |
67 | 67 | ||
68 | local_irq_save(flags); | 68 | local_irq_save(flags); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 57c4b9309015..141dbb695097 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1811,7 +1811,6 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page, | |||
1811 | src_page = pte_page(pteval); | 1811 | src_page = pte_page(pteval); |
1812 | copy_user_highpage(page, src_page, address, vma); | 1812 | copy_user_highpage(page, src_page, address, vma); |
1813 | VM_BUG_ON(page_mapcount(src_page) != 1); | 1813 | VM_BUG_ON(page_mapcount(src_page) != 1); |
1814 | VM_BUG_ON(page_count(src_page) != 2); | ||
1815 | release_pte_page(src_page); | 1814 | release_pte_page(src_page); |
1816 | /* | 1815 | /* |
1817 | * ptl mostly unnecessary, but preempt has to | 1816 | * ptl mostly unnecessary, but preempt has to |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 3ad25f9d1fc1..6a5b90d0cfd7 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -126,9 +126,6 @@ static void register_page_bootmem_info_section(unsigned long start_pfn) | |||
126 | struct mem_section *ms; | 126 | struct mem_section *ms; |
127 | struct page *page, *memmap; | 127 | struct page *page, *memmap; |
128 | 128 | ||
129 | if (!pfn_valid(start_pfn)) | ||
130 | return; | ||
131 | |||
132 | section_nr = pfn_to_section_nr(start_pfn); | 129 | section_nr = pfn_to_section_nr(start_pfn); |
133 | ms = __nr_to_section(section_nr); | 130 | ms = __nr_to_section(section_nr); |
134 | 131 | ||
@@ -187,9 +184,16 @@ void register_page_bootmem_info_node(struct pglist_data *pgdat) | |||
187 | end_pfn = pfn + pgdat->node_spanned_pages; | 184 | end_pfn = pfn + pgdat->node_spanned_pages; |
188 | 185 | ||
189 | /* register_section info */ | 186 | /* register_section info */ |
190 | for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) | 187 | for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) { |
191 | register_page_bootmem_info_section(pfn); | 188 | /* |
192 | 189 | * Some platforms can assign the same pfn to multiple nodes - on | |
190 | * node0 as well as nodeN. To avoid registering a pfn against | ||
191 | * multiple nodes we check that this pfn does not already | ||
192 | * reside in some other node. | ||
193 | */ | ||
194 | if (pfn_valid(pfn) && (pfn_to_nid(pfn) == node)) | ||
195 | register_page_bootmem_info_section(pfn); | ||
196 | } | ||
193 | } | 197 | } |
194 | #endif /* !CONFIG_SPARSEMEM_VMEMMAP */ | 198 | #endif /* !CONFIG_SPARSEMEM_VMEMMAP */ |
195 | 199 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c66fb875104a..c13ea7538891 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -584,7 +584,7 @@ static inline void __free_one_page(struct page *page, | |||
584 | combined_idx = buddy_idx & page_idx; | 584 | combined_idx = buddy_idx & page_idx; |
585 | higher_page = page + (combined_idx - page_idx); | 585 | higher_page = page + (combined_idx - page_idx); |
586 | buddy_idx = __find_buddy_index(combined_idx, order + 1); | 586 | buddy_idx = __find_buddy_index(combined_idx, order + 1); |
587 | higher_buddy = page + (buddy_idx - combined_idx); | 587 | higher_buddy = higher_page + (buddy_idx - combined_idx); |
588 | if (page_is_buddy(higher_page, higher_buddy, order + 1)) { | 588 | if (page_is_buddy(higher_page, higher_buddy, order + 1)) { |
589 | list_add_tail(&page->lru, | 589 | list_add_tail(&page->lru, |
590 | &zone->free_area[order].free_list[migratetype]); | 590 | &zone->free_area[order].free_list[migratetype]); |
@@ -983,7 +983,7 @@ static void *__ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac, | |||
983 | } | 983 | } |
984 | 984 | ||
985 | /* The caller cannot use PFMEMALLOC objects, find another one */ | 985 | /* The caller cannot use PFMEMALLOC objects, find another one */ |
986 | for (i = 1; i < ac->avail; i++) { | 986 | for (i = 0; i < ac->avail; i++) { |
987 | /* If a !PFMEMALLOC object is found, swap them */ | 987 | /* If a !PFMEMALLOC object is found, swap them */ |
988 | if (!is_obj_pfmemalloc(ac->entry[i])) { | 988 | if (!is_obj_pfmemalloc(ac->entry[i])) { |
989 | objp = ac->entry[i]; | 989 | objp = ac->entry[i]; |
@@ -1000,7 +1000,7 @@ static void *__ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac, | |||
1000 | l3 = cachep->nodelists[numa_mem_id()]; | 1000 | l3 = cachep->nodelists[numa_mem_id()]; |
1001 | if (!list_empty(&l3->slabs_free) && force_refill) { | 1001 | if (!list_empty(&l3->slabs_free) && force_refill) { |
1002 | struct slab *slabp = virt_to_slab(objp); | 1002 | struct slab *slabp = virt_to_slab(objp); |
1003 | ClearPageSlabPfmemalloc(virt_to_page(slabp->s_mem)); | 1003 | ClearPageSlabPfmemalloc(virt_to_head_page(slabp->s_mem)); |
1004 | clear_obj_pfmemalloc(&objp); | 1004 | clear_obj_pfmemalloc(&objp); |
1005 | recheck_pfmemalloc_active(cachep, ac); | 1005 | recheck_pfmemalloc_active(cachep, ac); |
1006 | return objp; | 1006 | return objp; |
@@ -1032,7 +1032,7 @@ static void *__ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, | |||
1032 | { | 1032 | { |
1033 | if (unlikely(pfmemalloc_active)) { | 1033 | if (unlikely(pfmemalloc_active)) { |
1034 | /* Some pfmemalloc slabs exist, check if this is one */ | 1034 | /* Some pfmemalloc slabs exist, check if this is one */ |
1035 | struct page *page = virt_to_page(objp); | 1035 | struct page *page = virt_to_head_page(objp); |
1036 | if (PageSlabPfmemalloc(page)) | 1036 | if (PageSlabPfmemalloc(page)) |
1037 | set_obj_pfmemalloc(&objp); | 1037 | set_obj_pfmemalloc(&objp); |
1038 | } | 1038 | } |
@@ -1524,12 +1524,13 @@ static inline void *acquire_slab(struct kmem_cache *s, | |||
1524 | } | 1524 | } |
1525 | 1525 | ||
1526 | static int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain); | 1526 | static int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain); |
1527 | static inline bool pfmemalloc_match(struct page *page, gfp_t gfpflags); | ||
1527 | 1528 | ||
1528 | /* | 1529 | /* |
1529 | * Try to allocate a partial slab from a specific node. | 1530 | * Try to allocate a partial slab from a specific node. |
1530 | */ | 1531 | */ |
1531 | static void *get_partial_node(struct kmem_cache *s, | 1532 | static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, |
1532 | struct kmem_cache_node *n, struct kmem_cache_cpu *c) | 1533 | struct kmem_cache_cpu *c, gfp_t flags) |
1533 | { | 1534 | { |
1534 | struct page *page, *page2; | 1535 | struct page *page, *page2; |
1535 | void *object = NULL; | 1536 | void *object = NULL; |
@@ -1545,9 +1546,13 @@ static void *get_partial_node(struct kmem_cache *s, | |||
1545 | 1546 | ||
1546 | spin_lock(&n->list_lock); | 1547 | spin_lock(&n->list_lock); |
1547 | list_for_each_entry_safe(page, page2, &n->partial, lru) { | 1548 | list_for_each_entry_safe(page, page2, &n->partial, lru) { |
1548 | void *t = acquire_slab(s, n, page, object == NULL); | 1549 | void *t; |
1549 | int available; | 1550 | int available; |
1550 | 1551 | ||
1552 | if (!pfmemalloc_match(page, flags)) | ||
1553 | continue; | ||
1554 | |||
1555 | t = acquire_slab(s, n, page, object == NULL); | ||
1551 | if (!t) | 1556 | if (!t) |
1552 | break; | 1557 | break; |
1553 | 1558 | ||
@@ -1614,7 +1619,7 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, | |||
1614 | 1619 | ||
1615 | if (n && cpuset_zone_allowed_hardwall(zone, flags) && | 1620 | if (n && cpuset_zone_allowed_hardwall(zone, flags) && |
1616 | n->nr_partial > s->min_partial) { | 1621 | n->nr_partial > s->min_partial) { |
1617 | object = get_partial_node(s, n, c); | 1622 | object = get_partial_node(s, n, c, flags); |
1618 | if (object) { | 1623 | if (object) { |
1619 | /* | 1624 | /* |
1620 | * Return the object even if | 1625 | * Return the object even if |
@@ -1643,7 +1648,7 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node, | |||
1643 | void *object; | 1648 | void *object; |
1644 | int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node; | 1649 | int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node; |
1645 | 1650 | ||
1646 | object = get_partial_node(s, get_node(s, searchnode), c); | 1651 | object = get_partial_node(s, get_node(s, searchnode), c, flags); |
1647 | if (object || node != NUMA_NO_NODE) | 1652 | if (object || node != NUMA_NO_NODE) |
1648 | return object; | 1653 | return object; |
1649 | 1654 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 8d01243d9560..99b434b674c0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -3102,6 +3102,7 @@ int kswapd_run(int nid) | |||
3102 | /* failure at boot is fatal */ | 3102 | /* failure at boot is fatal */ |
3103 | BUG_ON(system_state == SYSTEM_BOOTING); | 3103 | BUG_ON(system_state == SYSTEM_BOOTING); |
3104 | printk("Failed to start kswapd on node %d\n",nid); | 3104 | printk("Failed to start kswapd on node %d\n",nid); |
3105 | pgdat->kswapd = NULL; | ||
3105 | ret = -1; | 3106 | ret = -1; |
3106 | } | 3107 | } |
3107 | return ret; | 3108 | return ret; |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index df79300dcb7b..b02b75dae3a8 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -652,6 +652,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
652 | struct batadv_neigh_node *router = NULL; | 652 | struct batadv_neigh_node *router = NULL; |
653 | struct batadv_orig_node *orig_node_tmp; | 653 | struct batadv_orig_node *orig_node_tmp; |
654 | struct hlist_node *node; | 654 | struct hlist_node *node; |
655 | int if_num; | ||
655 | uint8_t sum_orig, sum_neigh; | 656 | uint8_t sum_orig, sum_neigh; |
656 | uint8_t *neigh_addr; | 657 | uint8_t *neigh_addr; |
657 | uint8_t tq_avg; | 658 | uint8_t tq_avg; |
@@ -738,12 +739,14 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
738 | if (router && (neigh_node->tq_avg == router->tq_avg)) { | 739 | if (router && (neigh_node->tq_avg == router->tq_avg)) { |
739 | orig_node_tmp = router->orig_node; | 740 | orig_node_tmp = router->orig_node; |
740 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 741 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
741 | sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | 742 | if_num = router->if_incoming->if_num; |
743 | sum_orig = orig_node_tmp->bcast_own_sum[if_num]; | ||
742 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 744 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
743 | 745 | ||
744 | orig_node_tmp = neigh_node->orig_node; | 746 | orig_node_tmp = neigh_node->orig_node; |
745 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 747 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
746 | sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | 748 | if_num = neigh_node->if_incoming->if_num; |
749 | sum_neigh = orig_node_tmp->bcast_own_sum[if_num]; | ||
747 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 750 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
748 | 751 | ||
749 | if (sum_orig >= sum_neigh) | 752 | if (sum_orig >= sum_neigh) |
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index a081ce1c0514..cebaae7e148b 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h | |||
@@ -20,8 +20,8 @@ | |||
20 | #ifndef _NET_BATMAN_ADV_BITARRAY_H_ | 20 | #ifndef _NET_BATMAN_ADV_BITARRAY_H_ |
21 | #define _NET_BATMAN_ADV_BITARRAY_H_ | 21 | #define _NET_BATMAN_ADV_BITARRAY_H_ |
22 | 22 | ||
23 | /* returns true if the corresponding bit in the given seq_bits indicates true | 23 | /* Returns 1 if the corresponding bit in the given seq_bits indicates true |
24 | * and curr_seqno is within range of last_seqno | 24 | * and curr_seqno is within range of last_seqno. Otherwise returns 0. |
25 | */ | 25 | */ |
26 | static inline int batadv_test_bit(const unsigned long *seq_bits, | 26 | static inline int batadv_test_bit(const unsigned long *seq_bits, |
27 | uint32_t last_seqno, uint32_t curr_seqno) | 27 | uint32_t last_seqno, uint32_t curr_seqno) |
@@ -32,7 +32,7 @@ static inline int batadv_test_bit(const unsigned long *seq_bits, | |||
32 | if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE) | 32 | if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE) |
33 | return 0; | 33 | return 0; |
34 | else | 34 | else |
35 | return test_bit(diff, seq_bits); | 35 | return test_bit(diff, seq_bits) != 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | /* turn corresponding bit on, so we can remember that we got the packet */ | 38 | /* turn corresponding bit on, so we can remember that we got the packet */ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 7b683e0bd668..b9a28d2dd3e8 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -107,18 +107,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) | |||
107 | { | 107 | { |
108 | struct batadv_priv *bat_priv = netdev_priv(dev); | 108 | struct batadv_priv *bat_priv = netdev_priv(dev); |
109 | struct sockaddr *addr = p; | 109 | struct sockaddr *addr = p; |
110 | uint8_t old_addr[ETH_ALEN]; | ||
110 | 111 | ||
111 | if (!is_valid_ether_addr(addr->sa_data)) | 112 | if (!is_valid_ether_addr(addr->sa_data)) |
112 | return -EADDRNOTAVAIL; | 113 | return -EADDRNOTAVAIL; |
113 | 114 | ||
115 | memcpy(old_addr, dev->dev_addr, ETH_ALEN); | ||
116 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
117 | |||
114 | /* only modify transtable if it has been initialized before */ | 118 | /* only modify transtable if it has been initialized before */ |
115 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { | 119 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { |
116 | batadv_tt_local_remove(bat_priv, dev->dev_addr, | 120 | batadv_tt_local_remove(bat_priv, old_addr, |
117 | "mac address changed", false); | 121 | "mac address changed", false); |
118 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); | 122 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); |
119 | } | 123 | } |
120 | 124 | ||
121 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
122 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; | 125 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; |
123 | return 0; | 126 | return 0; |
124 | } | 127 | } |
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index 5b6cc0bf4dec..e7154a58465f 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -64,7 +64,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
64 | switch (cmd) { | 64 | switch (cmd) { |
65 | case BNEPCONNADD: | 65 | case BNEPCONNADD: |
66 | if (!capable(CAP_NET_ADMIN)) | 66 | if (!capable(CAP_NET_ADMIN)) |
67 | return -EACCES; | 67 | return -EPERM; |
68 | 68 | ||
69 | if (copy_from_user(&ca, argp, sizeof(ca))) | 69 | if (copy_from_user(&ca, argp, sizeof(ca))) |
70 | return -EFAULT; | 70 | return -EFAULT; |
@@ -90,7 +90,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
90 | 90 | ||
91 | case BNEPCONNDEL: | 91 | case BNEPCONNDEL: |
92 | if (!capable(CAP_NET_ADMIN)) | 92 | if (!capable(CAP_NET_ADMIN)) |
93 | return -EACCES; | 93 | return -EPERM; |
94 | 94 | ||
95 | if (copy_from_user(&cd, argp, sizeof(cd))) | 95 | if (copy_from_user(&cd, argp, sizeof(cd))) |
96 | return -EFAULT; | 96 | return -EFAULT; |
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index d5cacef52748..aacb802d1ee4 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -78,7 +78,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
78 | switch (cmd) { | 78 | switch (cmd) { |
79 | case CMTPCONNADD: | 79 | case CMTPCONNADD: |
80 | if (!capable(CAP_NET_ADMIN)) | 80 | if (!capable(CAP_NET_ADMIN)) |
81 | return -EACCES; | 81 | return -EPERM; |
82 | 82 | ||
83 | if (copy_from_user(&ca, argp, sizeof(ca))) | 83 | if (copy_from_user(&ca, argp, sizeof(ca))) |
84 | return -EFAULT; | 84 | return -EFAULT; |
@@ -103,7 +103,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
103 | 103 | ||
104 | case CMTPCONNDEL: | 104 | case CMTPCONNDEL: |
105 | if (!capable(CAP_NET_ADMIN)) | 105 | if (!capable(CAP_NET_ADMIN)) |
106 | return -EACCES; | 106 | return -EPERM; |
107 | 107 | ||
108 | if (copy_from_user(&cd, argp, sizeof(cd))) | 108 | if (copy_from_user(&cd, argp, sizeof(cd))) |
109 | return -EFAULT; | 109 | return -EFAULT; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index fa974a19d365..8806869ad4d6 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -735,6 +735,8 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
735 | 735 | ||
736 | cancel_work_sync(&hdev->le_scan); | 736 | cancel_work_sync(&hdev->le_scan); |
737 | 737 | ||
738 | cancel_delayed_work(&hdev->power_off); | ||
739 | |||
738 | hci_req_cancel(hdev, ENODEV); | 740 | hci_req_cancel(hdev, ENODEV); |
739 | hci_req_lock(hdev); | 741 | hci_req_lock(hdev); |
740 | 742 | ||
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index bb64331db3b7..07f073935811 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -490,7 +490,7 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, | |||
490 | switch (cmd) { | 490 | switch (cmd) { |
491 | case HCISETRAW: | 491 | case HCISETRAW: |
492 | if (!capable(CAP_NET_ADMIN)) | 492 | if (!capable(CAP_NET_ADMIN)) |
493 | return -EACCES; | 493 | return -EPERM; |
494 | 494 | ||
495 | if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) | 495 | if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) |
496 | return -EPERM; | 496 | return -EPERM; |
@@ -510,12 +510,12 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, | |||
510 | 510 | ||
511 | case HCIBLOCKADDR: | 511 | case HCIBLOCKADDR: |
512 | if (!capable(CAP_NET_ADMIN)) | 512 | if (!capable(CAP_NET_ADMIN)) |
513 | return -EACCES; | 513 | return -EPERM; |
514 | return hci_sock_blacklist_add(hdev, (void __user *) arg); | 514 | return hci_sock_blacklist_add(hdev, (void __user *) arg); |
515 | 515 | ||
516 | case HCIUNBLOCKADDR: | 516 | case HCIUNBLOCKADDR: |
517 | if (!capable(CAP_NET_ADMIN)) | 517 | if (!capable(CAP_NET_ADMIN)) |
518 | return -EACCES; | 518 | return -EPERM; |
519 | return hci_sock_blacklist_del(hdev, (void __user *) arg); | 519 | return hci_sock_blacklist_del(hdev, (void __user *) arg); |
520 | 520 | ||
521 | default: | 521 | default: |
@@ -546,22 +546,22 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, | |||
546 | 546 | ||
547 | case HCIDEVUP: | 547 | case HCIDEVUP: |
548 | if (!capable(CAP_NET_ADMIN)) | 548 | if (!capable(CAP_NET_ADMIN)) |
549 | return -EACCES; | 549 | return -EPERM; |
550 | return hci_dev_open(arg); | 550 | return hci_dev_open(arg); |
551 | 551 | ||
552 | case HCIDEVDOWN: | 552 | case HCIDEVDOWN: |
553 | if (!capable(CAP_NET_ADMIN)) | 553 | if (!capable(CAP_NET_ADMIN)) |
554 | return -EACCES; | 554 | return -EPERM; |
555 | return hci_dev_close(arg); | 555 | return hci_dev_close(arg); |
556 | 556 | ||
557 | case HCIDEVRESET: | 557 | case HCIDEVRESET: |
558 | if (!capable(CAP_NET_ADMIN)) | 558 | if (!capable(CAP_NET_ADMIN)) |
559 | return -EACCES; | 559 | return -EPERM; |
560 | return hci_dev_reset(arg); | 560 | return hci_dev_reset(arg); |
561 | 561 | ||
562 | case HCIDEVRESTAT: | 562 | case HCIDEVRESTAT: |
563 | if (!capable(CAP_NET_ADMIN)) | 563 | if (!capable(CAP_NET_ADMIN)) |
564 | return -EACCES; | 564 | return -EPERM; |
565 | return hci_dev_reset_stat(arg); | 565 | return hci_dev_reset_stat(arg); |
566 | 566 | ||
567 | case HCISETSCAN: | 567 | case HCISETSCAN: |
@@ -573,7 +573,7 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, | |||
573 | case HCISETACLMTU: | 573 | case HCISETACLMTU: |
574 | case HCISETSCOMTU: | 574 | case HCISETSCOMTU: |
575 | if (!capable(CAP_NET_ADMIN)) | 575 | if (!capable(CAP_NET_ADMIN)) |
576 | return -EACCES; | 576 | return -EPERM; |
577 | return hci_dev_cmd(cmd, argp); | 577 | return hci_dev_cmd(cmd, argp); |
578 | 578 | ||
579 | case HCIINQUIRY: | 579 | case HCIINQUIRY: |
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index eca3889371c4..82a829d90b0f 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -62,7 +62,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
62 | switch (cmd) { | 62 | switch (cmd) { |
63 | case HIDPCONNADD: | 63 | case HIDPCONNADD: |
64 | if (!capable(CAP_NET_ADMIN)) | 64 | if (!capable(CAP_NET_ADMIN)) |
65 | return -EACCES; | 65 | return -EPERM; |
66 | 66 | ||
67 | if (copy_from_user(&ca, argp, sizeof(ca))) | 67 | if (copy_from_user(&ca, argp, sizeof(ca))) |
68 | return -EFAULT; | 68 | return -EFAULT; |
@@ -97,7 +97,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
97 | 97 | ||
98 | case HIDPCONNDEL: | 98 | case HIDPCONNDEL: |
99 | if (!capable(CAP_NET_ADMIN)) | 99 | if (!capable(CAP_NET_ADMIN)) |
100 | return -EACCES; | 100 | return -EPERM; |
101 | 101 | ||
102 | if (copy_from_user(&cd, argp, sizeof(cd))) | 102 | if (copy_from_user(&cd, argp, sizeof(cd))) |
103 | return -EFAULT; | 103 | return -EFAULT; |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index e0abaf3cb6a5..bda526edfb9e 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1025,7 +1025,7 @@ static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *c | |||
1025 | if (!conn) | 1025 | if (!conn) |
1026 | return; | 1026 | return; |
1027 | 1027 | ||
1028 | if (chan->mode == L2CAP_MODE_ERTM) { | 1028 | if (chan->mode == L2CAP_MODE_ERTM && chan->state == BT_CONNECTED) { |
1029 | __clear_retrans_timer(chan); | 1029 | __clear_retrans_timer(chan); |
1030 | __clear_monitor_timer(chan); | 1030 | __clear_monitor_timer(chan); |
1031 | __clear_ack_timer(chan); | 1031 | __clear_ack_timer(chan); |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index a3329cbd3e4d..e3296319606b 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2891,6 +2891,22 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) | |||
2891 | if (scan) | 2891 | if (scan) |
2892 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); | 2892 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); |
2893 | 2893 | ||
2894 | if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) { | ||
2895 | u8 ssp = 1; | ||
2896 | |||
2897 | hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp); | ||
2898 | } | ||
2899 | |||
2900 | if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { | ||
2901 | struct hci_cp_write_le_host_supported cp; | ||
2902 | |||
2903 | cp.le = 1; | ||
2904 | cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR); | ||
2905 | |||
2906 | hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, | ||
2907 | sizeof(cp), &cp); | ||
2908 | } | ||
2909 | |||
2894 | update_class(hdev); | 2910 | update_class(hdev); |
2895 | update_name(hdev, hdev->dev_name); | 2911 | update_name(hdev, hdev->dev_name); |
2896 | update_eir(hdev); | 2912 | update_eir(hdev); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 24c5eea8c45b..159aa8bef9e7 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -1073,16 +1073,13 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
1073 | BUG_ON(kaddr == NULL); | 1073 | BUG_ON(kaddr == NULL); |
1074 | base = kaddr + con->out_msg_pos.page_pos + bio_offset; | 1074 | base = kaddr + con->out_msg_pos.page_pos + bio_offset; |
1075 | crc = crc32c(crc, base, len); | 1075 | crc = crc32c(crc, base, len); |
1076 | kunmap(page); | ||
1076 | msg->footer.data_crc = cpu_to_le32(crc); | 1077 | msg->footer.data_crc = cpu_to_le32(crc); |
1077 | con->out_msg_pos.did_page_crc = true; | 1078 | con->out_msg_pos.did_page_crc = true; |
1078 | } | 1079 | } |
1079 | ret = ceph_tcp_sendpage(con->sock, page, | 1080 | ret = ceph_tcp_sendpage(con->sock, page, |
1080 | con->out_msg_pos.page_pos + bio_offset, | 1081 | con->out_msg_pos.page_pos + bio_offset, |
1081 | len, 1); | 1082 | len, 1); |
1082 | |||
1083 | if (do_datacrc) | ||
1084 | kunmap(page); | ||
1085 | |||
1086 | if (ret <= 0) | 1083 | if (ret <= 0) |
1087 | goto out; | 1084 | goto out; |
1088 | 1085 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 707b12425a79..3e645f3751bf 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2156,7 +2156,8 @@ static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) | |||
2156 | static netdev_features_t harmonize_features(struct sk_buff *skb, | 2156 | static netdev_features_t harmonize_features(struct sk_buff *skb, |
2157 | __be16 protocol, netdev_features_t features) | 2157 | __be16 protocol, netdev_features_t features) |
2158 | { | 2158 | { |
2159 | if (!can_checksum_protocol(features, protocol)) { | 2159 | if (skb->ip_summed != CHECKSUM_NONE && |
2160 | !can_checksum_protocol(features, protocol)) { | ||
2160 | features &= ~NETIF_F_ALL_CSUM; | 2161 | features &= ~NETIF_F_ALL_CSUM; |
2161 | features &= ~NETIF_F_SG; | 2162 | features &= ~NETIF_F_SG; |
2162 | } else if (illegal_highdma(skb->dev, skb)) { | 2163 | } else if (illegal_highdma(skb->dev, skb)) { |
@@ -3345,7 +3346,7 @@ ncls: | |||
3345 | 3346 | ||
3346 | if (pt_prev) { | 3347 | if (pt_prev) { |
3347 | if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) | 3348 | if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) |
3348 | ret = -ENOMEM; | 3349 | goto drop; |
3349 | else | 3350 | else |
3350 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); | 3351 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
3351 | } else { | 3352 | } else { |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 607a70ff2cc2..d607bae075d5 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3497,7 +3497,9 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, | |||
3497 | if (!skb_cloned(from)) | 3497 | if (!skb_cloned(from)) |
3498 | skb_shinfo(from)->nr_frags = 0; | 3498 | skb_shinfo(from)->nr_frags = 0; |
3499 | 3499 | ||
3500 | /* if the skb is cloned this does nothing since we set nr_frags to 0 */ | 3500 | /* if the skb is not cloned this does nothing |
3501 | * since we set nr_frags to 0. | ||
3502 | */ | ||
3501 | for (i = 0; i < skb_shinfo(from)->nr_frags; i++) | 3503 | for (i = 0; i < skb_shinfo(from)->nr_frags; i++) |
3502 | skb_frag_ref(from, i); | 3504 | skb_frag_ref(from, i); |
3503 | 3505 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index f5a426097236..7eac86463eb2 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -691,7 +691,8 @@ set_rcvbuf: | |||
691 | 691 | ||
692 | case SO_KEEPALIVE: | 692 | case SO_KEEPALIVE: |
693 | #ifdef CONFIG_INET | 693 | #ifdef CONFIG_INET |
694 | if (sk->sk_protocol == IPPROTO_TCP) | 694 | if (sk->sk_protocol == IPPROTO_TCP && |
695 | sk->sk_type == SOCK_STREAM) | ||
695 | tcp_set_keepalive(sk, valbool); | 696 | tcp_set_keepalive(sk, valbool); |
696 | #endif | 697 | #endif |
697 | sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); | 698 | sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7b00556e184b..2a6abc163ed2 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -722,7 +722,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
722 | break; | 722 | break; |
723 | 723 | ||
724 | case SIOCSIFFLAGS: | 724 | case SIOCSIFFLAGS: |
725 | ret = -EACCES; | 725 | ret = -EPERM; |
726 | if (!capable(CAP_NET_ADMIN)) | 726 | if (!capable(CAP_NET_ADMIN)) |
727 | goto out; | 727 | goto out; |
728 | break; | 728 | break; |
@@ -730,7 +730,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
730 | case SIOCSIFBRDADDR: /* Set the broadcast address */ | 730 | case SIOCSIFBRDADDR: /* Set the broadcast address */ |
731 | case SIOCSIFDSTADDR: /* Set the destination address */ | 731 | case SIOCSIFDSTADDR: /* Set the destination address */ |
732 | case SIOCSIFNETMASK: /* Set the netmask for the interface */ | 732 | case SIOCSIFNETMASK: /* Set the netmask for the interface */ |
733 | ret = -EACCES; | 733 | ret = -EPERM; |
734 | if (!capable(CAP_NET_ADMIN)) | 734 | if (!capable(CAP_NET_ADMIN)) |
735 | goto out; | 735 | goto out; |
736 | ret = -EINVAL; | 736 | ret = -EINVAL; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index e1e0a4e8fd34..c7527f6b9ad9 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -510,7 +510,10 @@ relookup: | |||
510 | secure_ipv6_id(daddr->addr.a6)); | 510 | secure_ipv6_id(daddr->addr.a6)); |
511 | p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; | 511 | p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; |
512 | p->rate_tokens = 0; | 512 | p->rate_tokens = 0; |
513 | p->rate_last = 0; | 513 | /* 60*HZ is arbitrary, but chosen enough high so that the first |
514 | * calculation of tokens is at its maximum. | ||
515 | */ | ||
516 | p->rate_last = jiffies - 60*HZ; | ||
514 | INIT_LIST_HEAD(&p->gc_list); | 517 | INIT_LIST_HEAD(&p->gc_list); |
515 | 518 | ||
516 | /* Link the node. */ | 519 | /* Link the node. */ |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index f2425785d40a..73d1e4df4bf6 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -131,18 +131,20 @@ found: | |||
131 | * 0 - deliver | 131 | * 0 - deliver |
132 | * 1 - block | 132 | * 1 - block |
133 | */ | 133 | */ |
134 | static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) | 134 | static int icmp_filter(const struct sock *sk, const struct sk_buff *skb) |
135 | { | 135 | { |
136 | int type; | 136 | struct icmphdr _hdr; |
137 | const struct icmphdr *hdr; | ||
137 | 138 | ||
138 | if (!pskb_may_pull(skb, sizeof(struct icmphdr))) | 139 | hdr = skb_header_pointer(skb, skb_transport_offset(skb), |
140 | sizeof(_hdr), &_hdr); | ||
141 | if (!hdr) | ||
139 | return 1; | 142 | return 1; |
140 | 143 | ||
141 | type = icmp_hdr(skb)->type; | 144 | if (hdr->type < 32) { |
142 | if (type < 32) { | ||
143 | __u32 data = raw_sk(sk)->filter.data; | 145 | __u32 data = raw_sk(sk)->filter.data; |
144 | 146 | ||
145 | return ((1 << type) & data) != 0; | 147 | return ((1U << hdr->type) & data) != 0; |
146 | } | 148 | } |
147 | 149 | ||
148 | /* Do not block unknown ICMP types */ | 150 | /* Do not block unknown ICMP types */ |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 940f4f4cb201..ff622069fcef 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -202,11 +202,6 @@ EXPORT_SYMBOL(ip_tos2prio); | |||
202 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); | 202 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); |
203 | #define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field) | 203 | #define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field) |
204 | 204 | ||
205 | static inline int rt_genid(struct net *net) | ||
206 | { | ||
207 | return atomic_read(&net->ipv4.rt_genid); | ||
208 | } | ||
209 | |||
210 | #ifdef CONFIG_PROC_FS | 205 | #ifdef CONFIG_PROC_FS |
211 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | 206 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) |
212 | { | 207 | { |
@@ -449,7 +444,7 @@ static inline bool rt_is_expired(const struct rtable *rth) | |||
449 | 444 | ||
450 | void rt_cache_flush(struct net *net) | 445 | void rt_cache_flush(struct net *net) |
451 | { | 446 | { |
452 | atomic_inc(&net->ipv4.rt_genid); | 447 | rt_genid_bump(net); |
453 | } | 448 | } |
454 | 449 | ||
455 | static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, | 450 | static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, |
@@ -2506,7 +2501,7 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { | |||
2506 | 2501 | ||
2507 | static __net_init int rt_genid_init(struct net *net) | 2502 | static __net_init int rt_genid_init(struct net *net) |
2508 | { | 2503 | { |
2509 | atomic_set(&net->ipv4.rt_genid, 0); | 2504 | atomic_set(&net->rt_genid, 0); |
2510 | get_random_bytes(&net->ipv4.dev_addr_genid, | 2505 | get_random_bytes(&net->ipv4.dev_addr_genid, |
2511 | sizeof(net->ipv4.dev_addr_genid)); | 2506 | sizeof(net->ipv4.dev_addr_genid)); |
2512 | return 0; | 2507 | return 0; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 72ea4752f21b..f32c02e2a543 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1738,8 +1738,14 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | #ifdef CONFIG_NET_DMA | 1740 | #ifdef CONFIG_NET_DMA |
1741 | if (tp->ucopy.dma_chan) | 1741 | if (tp->ucopy.dma_chan) { |
1742 | dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); | 1742 | if (tp->rcv_wnd == 0 && |
1743 | !skb_queue_empty(&sk->sk_async_wait_queue)) { | ||
1744 | tcp_service_net_dma(sk, true); | ||
1745 | tcp_cleanup_rbuf(sk, copied); | ||
1746 | } else | ||
1747 | dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); | ||
1748 | } | ||
1743 | #endif | 1749 | #endif |
1744 | if (copied >= target) { | 1750 | if (copied >= target) { |
1745 | /* Do not sleep, just process backlog. */ | 1751 | /* Do not sleep, just process backlog. */ |
@@ -2320,10 +2326,17 @@ static int tcp_repair_options_est(struct tcp_sock *tp, | |||
2320 | tp->rx_opt.mss_clamp = opt.opt_val; | 2326 | tp->rx_opt.mss_clamp = opt.opt_val; |
2321 | break; | 2327 | break; |
2322 | case TCPOPT_WINDOW: | 2328 | case TCPOPT_WINDOW: |
2323 | if (opt.opt_val > 14) | 2329 | { |
2324 | return -EFBIG; | 2330 | u16 snd_wscale = opt.opt_val & 0xFFFF; |
2331 | u16 rcv_wscale = opt.opt_val >> 16; | ||
2332 | |||
2333 | if (snd_wscale > 14 || rcv_wscale > 14) | ||
2334 | return -EFBIG; | ||
2325 | 2335 | ||
2326 | tp->rx_opt.snd_wscale = opt.opt_val; | 2336 | tp->rx_opt.snd_wscale = snd_wscale; |
2337 | tp->rx_opt.rcv_wscale = rcv_wscale; | ||
2338 | tp->rx_opt.wscale_ok = 1; | ||
2339 | } | ||
2327 | break; | 2340 | break; |
2328 | case TCPOPT_SACK_PERM: | 2341 | case TCPOPT_SACK_PERM: |
2329 | if (opt.opt_val != 0) | 2342 | if (opt.opt_val != 0) |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e037697c3b77..432c36649db3 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4634,7 +4634,7 @@ queue_and_out: | |||
4634 | 4634 | ||
4635 | if (eaten > 0) | 4635 | if (eaten > 0) |
4636 | kfree_skb_partial(skb, fragstolen); | 4636 | kfree_skb_partial(skb, fragstolen); |
4637 | else if (!sock_flag(sk, SOCK_DEAD)) | 4637 | if (!sock_flag(sk, SOCK_DEAD)) |
4638 | sk->sk_data_ready(sk, 0); | 4638 | sk->sk_data_ready(sk, 0); |
4639 | return; | 4639 | return; |
4640 | } | 4640 | } |
@@ -5529,8 +5529,7 @@ no_ack: | |||
5529 | #endif | 5529 | #endif |
5530 | if (eaten) | 5530 | if (eaten) |
5531 | kfree_skb_partial(skb, fragstolen); | 5531 | kfree_skb_partial(skb, fragstolen); |
5532 | else | 5532 | sk->sk_data_ready(sk, 0); |
5533 | sk->sk_data_ready(sk, 0); | ||
5534 | return 0; | 5533 | return 0; |
5535 | } | 5534 | } |
5536 | } | 5535 | } |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 0251a6005be8..c4f934176cab 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -175,33 +175,12 @@ void __inet6_csk_dst_store(struct sock *sk, struct dst_entry *dst, | |||
175 | const struct in6_addr *saddr) | 175 | const struct in6_addr *saddr) |
176 | { | 176 | { |
177 | __ip6_dst_store(sk, dst, daddr, saddr); | 177 | __ip6_dst_store(sk, dst, daddr, saddr); |
178 | |||
179 | #ifdef CONFIG_XFRM | ||
180 | { | ||
181 | struct rt6_info *rt = (struct rt6_info *)dst; | ||
182 | rt->rt6i_flow_cache_genid = atomic_read(&flow_cache_genid); | ||
183 | } | ||
184 | #endif | ||
185 | } | 178 | } |
186 | 179 | ||
187 | static inline | 180 | static inline |
188 | struct dst_entry *__inet6_csk_dst_check(struct sock *sk, u32 cookie) | 181 | struct dst_entry *__inet6_csk_dst_check(struct sock *sk, u32 cookie) |
189 | { | 182 | { |
190 | struct dst_entry *dst; | 183 | return __sk_dst_check(sk, cookie); |
191 | |||
192 | dst = __sk_dst_check(sk, cookie); | ||
193 | |||
194 | #ifdef CONFIG_XFRM | ||
195 | if (dst) { | ||
196 | struct rt6_info *rt = (struct rt6_info *)dst; | ||
197 | if (rt->rt6i_flow_cache_genid != atomic_read(&flow_cache_genid)) { | ||
198 | __sk_dst_reset(sk); | ||
199 | dst = NULL; | ||
200 | } | ||
201 | } | ||
202 | #endif | ||
203 | |||
204 | return dst; | ||
205 | } | 184 | } |
206 | 185 | ||
207 | static struct dst_entry *inet6_csk_route_socket(struct sock *sk, | 186 | static struct dst_entry *inet6_csk_route_socket(struct sock *sk, |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 13690d650c3e..286acfc21250 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -819,6 +819,10 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info) | |||
819 | offsetof(struct rt6_info, rt6i_src), | 819 | offsetof(struct rt6_info, rt6i_src), |
820 | allow_create, replace_required); | 820 | allow_create, replace_required); |
821 | 821 | ||
822 | if (IS_ERR(sn)) { | ||
823 | err = PTR_ERR(sn); | ||
824 | sn = NULL; | ||
825 | } | ||
822 | if (!sn) { | 826 | if (!sn) { |
823 | /* If it is failed, discard just allocated | 827 | /* If it is failed, discard just allocated |
824 | root, and then (in st_failure) stale node | 828 | root, and then (in st_failure) stale node |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 5b087c31d87b..0f9bdc5ee9f3 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -86,28 +86,30 @@ static int mip6_mh_len(int type) | |||
86 | 86 | ||
87 | static int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) | 87 | static int mip6_mh_filter(struct sock *sk, struct sk_buff *skb) |
88 | { | 88 | { |
89 | struct ip6_mh *mh; | 89 | struct ip6_mh _hdr; |
90 | const struct ip6_mh *mh; | ||
90 | 91 | ||
91 | if (!pskb_may_pull(skb, (skb_transport_offset(skb)) + 8) || | 92 | mh = skb_header_pointer(skb, skb_transport_offset(skb), |
92 | !pskb_may_pull(skb, (skb_transport_offset(skb) + | 93 | sizeof(_hdr), &_hdr); |
93 | ((skb_transport_header(skb)[1] + 1) << 3)))) | 94 | if (!mh) |
94 | return -1; | 95 | return -1; |
95 | 96 | ||
96 | mh = (struct ip6_mh *)skb_transport_header(skb); | 97 | if (((mh->ip6mh_hdrlen + 1) << 3) > skb->len) |
98 | return -1; | ||
97 | 99 | ||
98 | if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) { | 100 | if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) { |
99 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH message too short: %d vs >=%d\n", | 101 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH message too short: %d vs >=%d\n", |
100 | mh->ip6mh_hdrlen, mip6_mh_len(mh->ip6mh_type)); | 102 | mh->ip6mh_hdrlen, mip6_mh_len(mh->ip6mh_type)); |
101 | mip6_param_prob(skb, 0, ((&mh->ip6mh_hdrlen) - | 103 | mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_hdrlen) + |
102 | skb_network_header(skb))); | 104 | skb_network_header_len(skb)); |
103 | return -1; | 105 | return -1; |
104 | } | 106 | } |
105 | 107 | ||
106 | if (mh->ip6mh_proto != IPPROTO_NONE) { | 108 | if (mh->ip6mh_proto != IPPROTO_NONE) { |
107 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", | 109 | LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", |
108 | mh->ip6mh_proto); | 110 | mh->ip6mh_proto); |
109 | mip6_param_prob(skb, 0, ((&mh->ip6mh_proto) - | 111 | mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_proto) + |
110 | skb_network_header(skb))); | 112 | skb_network_header_len(skb)); |
111 | return -1; | 113 | return -1; |
112 | } | 114 | } |
113 | 115 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 7af88ef01657..d8e95c77db99 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -107,21 +107,20 @@ found: | |||
107 | * 0 - deliver | 107 | * 0 - deliver |
108 | * 1 - block | 108 | * 1 - block |
109 | */ | 109 | */ |
110 | static __inline__ int icmpv6_filter(struct sock *sk, struct sk_buff *skb) | 110 | static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb) |
111 | { | 111 | { |
112 | struct icmp6hdr *icmph; | 112 | struct icmp6hdr *_hdr; |
113 | struct raw6_sock *rp = raw6_sk(sk); | 113 | const struct icmp6hdr *hdr; |
114 | |||
115 | if (pskb_may_pull(skb, sizeof(struct icmp6hdr))) { | ||
116 | __u32 *data = &rp->filter.data[0]; | ||
117 | int bit_nr; | ||
118 | 114 | ||
119 | icmph = (struct icmp6hdr *) skb->data; | 115 | hdr = skb_header_pointer(skb, skb_transport_offset(skb), |
120 | bit_nr = icmph->icmp6_type; | 116 | sizeof(_hdr), &_hdr); |
117 | if (hdr) { | ||
118 | const __u32 *data = &raw6_sk(sk)->filter.data[0]; | ||
119 | unsigned int type = hdr->icmp6_type; | ||
121 | 120 | ||
122 | return (data[bit_nr >> 5] & (1 << (bit_nr & 31))) != 0; | 121 | return (data[type >> 5] & (1U << (type & 31))) != 0; |
123 | } | 122 | } |
124 | return 0; | 123 | return 1; |
125 | } | 124 | } |
126 | 125 | ||
127 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 126 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 0607ee3a0eac..d1ddbc6ddac5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -226,7 +226,7 @@ static const struct rt6_info ip6_null_entry_template = { | |||
226 | .dst = { | 226 | .dst = { |
227 | .__refcnt = ATOMIC_INIT(1), | 227 | .__refcnt = ATOMIC_INIT(1), |
228 | .__use = 1, | 228 | .__use = 1, |
229 | .obsolete = -1, | 229 | .obsolete = DST_OBSOLETE_FORCE_CHK, |
230 | .error = -ENETUNREACH, | 230 | .error = -ENETUNREACH, |
231 | .input = ip6_pkt_discard, | 231 | .input = ip6_pkt_discard, |
232 | .output = ip6_pkt_discard_out, | 232 | .output = ip6_pkt_discard_out, |
@@ -246,7 +246,7 @@ static const struct rt6_info ip6_prohibit_entry_template = { | |||
246 | .dst = { | 246 | .dst = { |
247 | .__refcnt = ATOMIC_INIT(1), | 247 | .__refcnt = ATOMIC_INIT(1), |
248 | .__use = 1, | 248 | .__use = 1, |
249 | .obsolete = -1, | 249 | .obsolete = DST_OBSOLETE_FORCE_CHK, |
250 | .error = -EACCES, | 250 | .error = -EACCES, |
251 | .input = ip6_pkt_prohibit, | 251 | .input = ip6_pkt_prohibit, |
252 | .output = ip6_pkt_prohibit_out, | 252 | .output = ip6_pkt_prohibit_out, |
@@ -261,7 +261,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = { | |||
261 | .dst = { | 261 | .dst = { |
262 | .__refcnt = ATOMIC_INIT(1), | 262 | .__refcnt = ATOMIC_INIT(1), |
263 | .__use = 1, | 263 | .__use = 1, |
264 | .obsolete = -1, | 264 | .obsolete = DST_OBSOLETE_FORCE_CHK, |
265 | .error = -EINVAL, | 265 | .error = -EINVAL, |
266 | .input = dst_discard, | 266 | .input = dst_discard, |
267 | .output = dst_discard, | 267 | .output = dst_discard, |
@@ -281,13 +281,14 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net, | |||
281 | struct fib6_table *table) | 281 | struct fib6_table *table) |
282 | { | 282 | { |
283 | struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, | 283 | struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, |
284 | 0, DST_OBSOLETE_NONE, flags); | 284 | 0, DST_OBSOLETE_FORCE_CHK, flags); |
285 | 285 | ||
286 | if (rt) { | 286 | if (rt) { |
287 | struct dst_entry *dst = &rt->dst; | 287 | struct dst_entry *dst = &rt->dst; |
288 | 288 | ||
289 | memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); | 289 | memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); |
290 | rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); | 290 | rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); |
291 | rt->rt6i_genid = rt_genid(net); | ||
291 | } | 292 | } |
292 | return rt; | 293 | return rt; |
293 | } | 294 | } |
@@ -1022,6 +1023,13 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie) | |||
1022 | 1023 | ||
1023 | rt = (struct rt6_info *) dst; | 1024 | rt = (struct rt6_info *) dst; |
1024 | 1025 | ||
1026 | /* All IPV6 dsts are created with ->obsolete set to the value | ||
1027 | * DST_OBSOLETE_FORCE_CHK which forces validation calls down | ||
1028 | * into this function always. | ||
1029 | */ | ||
1030 | if (rt->rt6i_genid != rt_genid(dev_net(rt->dst.dev))) | ||
1031 | return NULL; | ||
1032 | |||
1025 | if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie)) { | 1033 | if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie)) { |
1026 | if (rt->rt6i_peer_genid != rt6_peer_genid()) { | 1034 | if (rt->rt6i_peer_genid != rt6_peer_genid()) { |
1027 | if (!rt6_has_peer(rt)) | 1035 | if (!rt6_has_peer(rt)) |
@@ -1388,8 +1396,6 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1388 | goto out; | 1396 | goto out; |
1389 | } | 1397 | } |
1390 | 1398 | ||
1391 | rt->dst.obsolete = -1; | ||
1392 | |||
1393 | if (cfg->fc_flags & RTF_EXPIRES) | 1399 | if (cfg->fc_flags & RTF_EXPIRES) |
1394 | rt6_set_expires(rt, jiffies + | 1400 | rt6_set_expires(rt, jiffies + |
1395 | clock_t_to_jiffies(cfg->fc_expires)); | 1401 | clock_t_to_jiffies(cfg->fc_expires)); |
@@ -2084,7 +2090,6 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
2084 | rt->dst.input = ip6_input; | 2090 | rt->dst.input = ip6_input; |
2085 | rt->dst.output = ip6_output; | 2091 | rt->dst.output = ip6_output; |
2086 | rt->rt6i_idev = idev; | 2092 | rt->rt6i_idev = idev; |
2087 | rt->dst.obsolete = -1; | ||
2088 | 2093 | ||
2089 | rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; | 2094 | rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; |
2090 | if (anycast) | 2095 | if (anycast) |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index 6ec3f67ad3f1..6c4cc12c7414 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -80,8 +80,8 @@ static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) | |||
80 | 80 | ||
81 | hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq, | 81 | hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq, |
82 | &l2tp_nl_family, 0, L2TP_CMD_NOOP); | 82 | &l2tp_nl_family, 0, L2TP_CMD_NOOP); |
83 | if (IS_ERR(hdr)) { | 83 | if (!hdr) { |
84 | ret = PTR_ERR(hdr); | 84 | ret = -EMSGSIZE; |
85 | goto err_out; | 85 | goto err_out; |
86 | } | 86 | } |
87 | 87 | ||
@@ -250,8 +250,8 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla | |||
250 | 250 | ||
251 | hdr = genlmsg_put(skb, portid, seq, &l2tp_nl_family, flags, | 251 | hdr = genlmsg_put(skb, portid, seq, &l2tp_nl_family, flags, |
252 | L2TP_CMD_TUNNEL_GET); | 252 | L2TP_CMD_TUNNEL_GET); |
253 | if (IS_ERR(hdr)) | 253 | if (!hdr) |
254 | return PTR_ERR(hdr); | 254 | return -EMSGSIZE; |
255 | 255 | ||
256 | if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) || | 256 | if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) || |
257 | nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || | 257 | nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || |
@@ -617,8 +617,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl | |||
617 | sk = tunnel->sock; | 617 | sk = tunnel->sock; |
618 | 618 | ||
619 | hdr = genlmsg_put(skb, portid, seq, &l2tp_nl_family, flags, L2TP_CMD_SESSION_GET); | 619 | hdr = genlmsg_put(skb, portid, seq, &l2tp_nl_family, flags, L2TP_CMD_SESSION_GET); |
620 | if (IS_ERR(hdr)) | 620 | if (!hdr) |
621 | return PTR_ERR(hdr); | 621 | return -EMSGSIZE; |
622 | 622 | ||
623 | if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || | 623 | if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || |
624 | nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) || | 624 | nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) || |
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c index 5c22ce8ab309..a4c1e4528cac 100644 --- a/net/netfilter/xt_limit.c +++ b/net/netfilter/xt_limit.c | |||
@@ -117,11 +117,11 @@ static int limit_mt_check(const struct xt_mtchk_param *par) | |||
117 | 117 | ||
118 | /* For SMP, we only want to use one set of state. */ | 118 | /* For SMP, we only want to use one set of state. */ |
119 | r->master = priv; | 119 | r->master = priv; |
120 | /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies * | ||
121 | 128. */ | ||
122 | priv->prev = jiffies; | ||
123 | priv->credit = user2credits(r->avg * r->burst); /* Credits full. */ | ||
120 | if (r->cost == 0) { | 124 | if (r->cost == 0) { |
121 | /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies * | ||
122 | 128. */ | ||
123 | priv->prev = jiffies; | ||
124 | priv->credit = user2credits(r->avg * r->burst); /* Credits full. */ | ||
125 | r->credit_cap = priv->credit; /* Credits full. */ | 125 | r->credit_cap = priv->credit; /* Credits full. */ |
126 | r->cost = user2credits(r->avg); | 126 | r->cost = user2credits(r->avg); |
127 | } | 127 | } |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 1b9024ee963c..7261eb81974f 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -601,7 +601,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
601 | if (!capable(CAP_NET_BIND_SERVICE)) { | 601 | if (!capable(CAP_NET_BIND_SERVICE)) { |
602 | dev_put(dev); | 602 | dev_put(dev); |
603 | release_sock(sk); | 603 | release_sock(sk); |
604 | return -EACCES; | 604 | return -EPERM; |
605 | } | 605 | } |
606 | nr->user_addr = addr->fsa_digipeater[0]; | 606 | nr->user_addr = addr->fsa_digipeater[0]; |
607 | nr->source_addr = addr->fsa_ax25.sax25_call; | 607 | nr->source_addr = addr->fsa_ax25.sax25_call; |
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c index 25566208f12b..f0dd83cff906 100644 --- a/net/sched/sch_qfq.c +++ b/net/sched/sch_qfq.c | |||
@@ -865,7 +865,10 @@ static void qfq_update_start(struct qfq_sched *q, struct qfq_class *cl) | |||
865 | if (mask) { | 865 | if (mask) { |
866 | struct qfq_group *next = qfq_ffs(q, mask); | 866 | struct qfq_group *next = qfq_ffs(q, mask); |
867 | if (qfq_gt(roundedF, next->F)) { | 867 | if (qfq_gt(roundedF, next->F)) { |
868 | cl->S = next->F; | 868 | if (qfq_gt(limit, next->F)) |
869 | cl->S = next->F; | ||
870 | else /* preserve timestamp correctness */ | ||
871 | cl->S = limit; | ||
869 | return; | 872 | return; |
870 | } | 873 | } |
871 | } | 874 | } |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 1ad04e54014c..4de18ae18d34 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -350,6 +350,9 @@ static void reg_regdb_search(struct work_struct *work) | |||
350 | struct reg_regdb_search_request *request; | 350 | struct reg_regdb_search_request *request; |
351 | const struct ieee80211_regdomain *curdom, *regdom; | 351 | const struct ieee80211_regdomain *curdom, *regdom; |
352 | int i, r; | 352 | int i, r; |
353 | bool set_reg = false; | ||
354 | |||
355 | mutex_lock(&cfg80211_mutex); | ||
353 | 356 | ||
354 | mutex_lock(®_regdb_search_mutex); | 357 | mutex_lock(®_regdb_search_mutex); |
355 | while (!list_empty(®_regdb_search_list)) { | 358 | while (!list_empty(®_regdb_search_list)) { |
@@ -365,9 +368,7 @@ static void reg_regdb_search(struct work_struct *work) | |||
365 | r = reg_copy_regd(®dom, curdom); | 368 | r = reg_copy_regd(®dom, curdom); |
366 | if (r) | 369 | if (r) |
367 | break; | 370 | break; |
368 | mutex_lock(&cfg80211_mutex); | 371 | set_reg = true; |
369 | set_regdom(regdom); | ||
370 | mutex_unlock(&cfg80211_mutex); | ||
371 | break; | 372 | break; |
372 | } | 373 | } |
373 | } | 374 | } |
@@ -375,6 +376,11 @@ static void reg_regdb_search(struct work_struct *work) | |||
375 | kfree(request); | 376 | kfree(request); |
376 | } | 377 | } |
377 | mutex_unlock(®_regdb_search_mutex); | 378 | mutex_unlock(®_regdb_search_mutex); |
379 | |||
380 | if (set_reg) | ||
381 | set_regdom(regdom); | ||
382 | |||
383 | mutex_unlock(&cfg80211_mutex); | ||
378 | } | 384 | } |
379 | 385 | ||
380 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); | 386 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 741a32aa512e..f4e0a6a148a5 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -602,6 +602,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
602 | xfrm_pol_hold(policy); | 602 | xfrm_pol_hold(policy); |
603 | net->xfrm.policy_count[dir]++; | 603 | net->xfrm.policy_count[dir]++; |
604 | atomic_inc(&flow_cache_genid); | 604 | atomic_inc(&flow_cache_genid); |
605 | rt_genid_bump(net); | ||
605 | if (delpol) | 606 | if (delpol) |
606 | __xfrm_policy_unlink(delpol, dir); | 607 | __xfrm_policy_unlink(delpol, dir); |
607 | policy->index = delpol ? delpol->index : xfrm_gen_index(net, dir); | 608 | policy->index = delpol ? delpol->index : xfrm_gen_index(net, dir); |
@@ -1780,7 +1781,7 @@ static struct dst_entry *make_blackhole(struct net *net, u16 family, | |||
1780 | 1781 | ||
1781 | if (!afinfo) { | 1782 | if (!afinfo) { |
1782 | dst_release(dst_orig); | 1783 | dst_release(dst_orig); |
1783 | ret = ERR_PTR(-EINVAL); | 1784 | return ERR_PTR(-EINVAL); |
1784 | } else { | 1785 | } else { |
1785 | ret = afinfo->blackhole_route(net, dst_orig); | 1786 | ret = afinfo->blackhole_route(net, dst_orig); |
1786 | } | 1787 | } |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 5d6eb4b3c089..94a2a1f726f9 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -123,9 +123,21 @@ static inline int verify_replay(struct xfrm_usersa_info *p, | |||
123 | struct nlattr **attrs) | 123 | struct nlattr **attrs) |
124 | { | 124 | { |
125 | struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL]; | 125 | struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL]; |
126 | struct xfrm_replay_state_esn *rs; | ||
126 | 127 | ||
127 | if ((p->flags & XFRM_STATE_ESN) && !rt) | 128 | if (p->flags & XFRM_STATE_ESN) { |
128 | return -EINVAL; | 129 | if (!rt) |
130 | return -EINVAL; | ||
131 | |||
132 | rs = nla_data(rt); | ||
133 | |||
134 | if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8) | ||
135 | return -EINVAL; | ||
136 | |||
137 | if (nla_len(rt) < xfrm_replay_state_esn_len(rs) && | ||
138 | nla_len(rt) != sizeof(*rs)) | ||
139 | return -EINVAL; | ||
140 | } | ||
129 | 141 | ||
130 | if (!rt) | 142 | if (!rt) |
131 | return 0; | 143 | return 0; |
@@ -370,14 +382,15 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es | |||
370 | struct nlattr *rp) | 382 | struct nlattr *rp) |
371 | { | 383 | { |
372 | struct xfrm_replay_state_esn *up; | 384 | struct xfrm_replay_state_esn *up; |
385 | int ulen; | ||
373 | 386 | ||
374 | if (!replay_esn || !rp) | 387 | if (!replay_esn || !rp) |
375 | return 0; | 388 | return 0; |
376 | 389 | ||
377 | up = nla_data(rp); | 390 | up = nla_data(rp); |
391 | ulen = xfrm_replay_state_esn_len(up); | ||
378 | 392 | ||
379 | if (xfrm_replay_state_esn_len(replay_esn) != | 393 | if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen) |
380 | xfrm_replay_state_esn_len(up)) | ||
381 | return -EINVAL; | 394 | return -EINVAL; |
382 | 395 | ||
383 | return 0; | 396 | return 0; |
@@ -388,22 +401,28 @@ static int xfrm_alloc_replay_state_esn(struct xfrm_replay_state_esn **replay_esn | |||
388 | struct nlattr *rta) | 401 | struct nlattr *rta) |
389 | { | 402 | { |
390 | struct xfrm_replay_state_esn *p, *pp, *up; | 403 | struct xfrm_replay_state_esn *p, *pp, *up; |
404 | int klen, ulen; | ||
391 | 405 | ||
392 | if (!rta) | 406 | if (!rta) |
393 | return 0; | 407 | return 0; |
394 | 408 | ||
395 | up = nla_data(rta); | 409 | up = nla_data(rta); |
410 | klen = xfrm_replay_state_esn_len(up); | ||
411 | ulen = nla_len(rta) >= klen ? klen : sizeof(*up); | ||
396 | 412 | ||
397 | p = kmemdup(up, xfrm_replay_state_esn_len(up), GFP_KERNEL); | 413 | p = kzalloc(klen, GFP_KERNEL); |
398 | if (!p) | 414 | if (!p) |
399 | return -ENOMEM; | 415 | return -ENOMEM; |
400 | 416 | ||
401 | pp = kmemdup(up, xfrm_replay_state_esn_len(up), GFP_KERNEL); | 417 | pp = kzalloc(klen, GFP_KERNEL); |
402 | if (!pp) { | 418 | if (!pp) { |
403 | kfree(p); | 419 | kfree(p); |
404 | return -ENOMEM; | 420 | return -ENOMEM; |
405 | } | 421 | } |
406 | 422 | ||
423 | memcpy(p, up, ulen); | ||
424 | memcpy(pp, up, ulen); | ||
425 | |||
407 | *replay_esn = p; | 426 | *replay_esn = p; |
408 | *preplay_esn = pp; | 427 | *preplay_esn = pp; |
409 | 428 | ||
@@ -442,10 +461,11 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info * | |||
442 | * somehow made shareable and move it to xfrm_state.c - JHS | 461 | * somehow made shareable and move it to xfrm_state.c - JHS |
443 | * | 462 | * |
444 | */ | 463 | */ |
445 | static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs) | 464 | static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs, |
465 | int update_esn) | ||
446 | { | 466 | { |
447 | struct nlattr *rp = attrs[XFRMA_REPLAY_VAL]; | 467 | struct nlattr *rp = attrs[XFRMA_REPLAY_VAL]; |
448 | struct nlattr *re = attrs[XFRMA_REPLAY_ESN_VAL]; | 468 | struct nlattr *re = update_esn ? attrs[XFRMA_REPLAY_ESN_VAL] : NULL; |
449 | struct nlattr *lt = attrs[XFRMA_LTIME_VAL]; | 469 | struct nlattr *lt = attrs[XFRMA_LTIME_VAL]; |
450 | struct nlattr *et = attrs[XFRMA_ETIMER_THRESH]; | 470 | struct nlattr *et = attrs[XFRMA_ETIMER_THRESH]; |
451 | struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH]; | 471 | struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH]; |
@@ -555,7 +575,7 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, | |||
555 | goto error; | 575 | goto error; |
556 | 576 | ||
557 | /* override default values from above */ | 577 | /* override default values from above */ |
558 | xfrm_update_ae_params(x, attrs); | 578 | xfrm_update_ae_params(x, attrs, 0); |
559 | 579 | ||
560 | return x; | 580 | return x; |
561 | 581 | ||
@@ -689,6 +709,7 @@ out: | |||
689 | 709 | ||
690 | static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) | 710 | static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) |
691 | { | 711 | { |
712 | memset(p, 0, sizeof(*p)); | ||
692 | memcpy(&p->id, &x->id, sizeof(p->id)); | 713 | memcpy(&p->id, &x->id, sizeof(p->id)); |
693 | memcpy(&p->sel, &x->sel, sizeof(p->sel)); | 714 | memcpy(&p->sel, &x->sel, sizeof(p->sel)); |
694 | memcpy(&p->lft, &x->lft, sizeof(p->lft)); | 715 | memcpy(&p->lft, &x->lft, sizeof(p->lft)); |
@@ -742,7 +763,7 @@ static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb) | |||
742 | return -EMSGSIZE; | 763 | return -EMSGSIZE; |
743 | 764 | ||
744 | algo = nla_data(nla); | 765 | algo = nla_data(nla); |
745 | strcpy(algo->alg_name, auth->alg_name); | 766 | strncpy(algo->alg_name, auth->alg_name, sizeof(algo->alg_name)); |
746 | memcpy(algo->alg_key, auth->alg_key, (auth->alg_key_len + 7) / 8); | 767 | memcpy(algo->alg_key, auth->alg_key, (auth->alg_key_len + 7) / 8); |
747 | algo->alg_key_len = auth->alg_key_len; | 768 | algo->alg_key_len = auth->alg_key_len; |
748 | 769 | ||
@@ -878,6 +899,7 @@ static struct sk_buff *xfrm_state_netlink(struct sk_buff *in_skb, | |||
878 | { | 899 | { |
879 | struct xfrm_dump_info info; | 900 | struct xfrm_dump_info info; |
880 | struct sk_buff *skb; | 901 | struct sk_buff *skb; |
902 | int err; | ||
881 | 903 | ||
882 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); | 904 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); |
883 | if (!skb) | 905 | if (!skb) |
@@ -888,9 +910,10 @@ static struct sk_buff *xfrm_state_netlink(struct sk_buff *in_skb, | |||
888 | info.nlmsg_seq = seq; | 910 | info.nlmsg_seq = seq; |
889 | info.nlmsg_flags = 0; | 911 | info.nlmsg_flags = 0; |
890 | 912 | ||
891 | if (dump_one_state(x, 0, &info)) { | 913 | err = dump_one_state(x, 0, &info); |
914 | if (err) { | ||
892 | kfree_skb(skb); | 915 | kfree_skb(skb); |
893 | return NULL; | 916 | return ERR_PTR(err); |
894 | } | 917 | } |
895 | 918 | ||
896 | return skb; | 919 | return skb; |
@@ -1317,6 +1340,7 @@ static void copy_from_user_policy(struct xfrm_policy *xp, struct xfrm_userpolicy | |||
1317 | 1340 | ||
1318 | static void copy_to_user_policy(struct xfrm_policy *xp, struct xfrm_userpolicy_info *p, int dir) | 1341 | static void copy_to_user_policy(struct xfrm_policy *xp, struct xfrm_userpolicy_info *p, int dir) |
1319 | { | 1342 | { |
1343 | memset(p, 0, sizeof(*p)); | ||
1320 | memcpy(&p->sel, &xp->selector, sizeof(p->sel)); | 1344 | memcpy(&p->sel, &xp->selector, sizeof(p->sel)); |
1321 | memcpy(&p->lft, &xp->lft, sizeof(p->lft)); | 1345 | memcpy(&p->lft, &xp->lft, sizeof(p->lft)); |
1322 | memcpy(&p->curlft, &xp->curlft, sizeof(p->curlft)); | 1346 | memcpy(&p->curlft, &xp->curlft, sizeof(p->curlft)); |
@@ -1421,6 +1445,7 @@ static int copy_to_user_tmpl(struct xfrm_policy *xp, struct sk_buff *skb) | |||
1421 | struct xfrm_user_tmpl *up = &vec[i]; | 1445 | struct xfrm_user_tmpl *up = &vec[i]; |
1422 | struct xfrm_tmpl *kp = &xp->xfrm_vec[i]; | 1446 | struct xfrm_tmpl *kp = &xp->xfrm_vec[i]; |
1423 | 1447 | ||
1448 | memset(up, 0, sizeof(*up)); | ||
1424 | memcpy(&up->id, &kp->id, sizeof(up->id)); | 1449 | memcpy(&up->id, &kp->id, sizeof(up->id)); |
1425 | up->family = kp->encap_family; | 1450 | up->family = kp->encap_family; |
1426 | memcpy(&up->saddr, &kp->saddr, sizeof(up->saddr)); | 1451 | memcpy(&up->saddr, &kp->saddr, sizeof(up->saddr)); |
@@ -1546,6 +1571,7 @@ static struct sk_buff *xfrm_policy_netlink(struct sk_buff *in_skb, | |||
1546 | { | 1571 | { |
1547 | struct xfrm_dump_info info; | 1572 | struct xfrm_dump_info info; |
1548 | struct sk_buff *skb; | 1573 | struct sk_buff *skb; |
1574 | int err; | ||
1549 | 1575 | ||
1550 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 1576 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
1551 | if (!skb) | 1577 | if (!skb) |
@@ -1556,9 +1582,10 @@ static struct sk_buff *xfrm_policy_netlink(struct sk_buff *in_skb, | |||
1556 | info.nlmsg_seq = seq; | 1582 | info.nlmsg_seq = seq; |
1557 | info.nlmsg_flags = 0; | 1583 | info.nlmsg_flags = 0; |
1558 | 1584 | ||
1559 | if (dump_one_policy(xp, dir, 0, &info) < 0) { | 1585 | err = dump_one_policy(xp, dir, 0, &info); |
1586 | if (err) { | ||
1560 | kfree_skb(skb); | 1587 | kfree_skb(skb); |
1561 | return NULL; | 1588 | return ERR_PTR(err); |
1562 | } | 1589 | } |
1563 | 1590 | ||
1564 | return skb; | 1591 | return skb; |
@@ -1822,7 +1849,7 @@ static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1822 | goto out; | 1849 | goto out; |
1823 | 1850 | ||
1824 | spin_lock_bh(&x->lock); | 1851 | spin_lock_bh(&x->lock); |
1825 | xfrm_update_ae_params(x, attrs); | 1852 | xfrm_update_ae_params(x, attrs, 1); |
1826 | spin_unlock_bh(&x->lock); | 1853 | spin_unlock_bh(&x->lock); |
1827 | 1854 | ||
1828 | c.event = nlh->nlmsg_type; | 1855 | c.event = nlh->nlmsg_type; |
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst index c3f69ae275d1..4d908d16c035 100644 --- a/scripts/Makefile.fwinst +++ b/scripts/Makefile.fwinst | |||
@@ -27,7 +27,7 @@ endif | |||
27 | installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) | 27 | installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) |
28 | 28 | ||
29 | installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) | 29 | installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) |
30 | installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/. | 30 | installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./ |
31 | 31 | ||
32 | # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. | 32 | # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. |
33 | PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs | 33 | PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs |
@@ -42,7 +42,7 @@ quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@) | |||
42 | $(installed-fw-dirs): | 42 | $(installed-fw-dirs): |
43 | $(call cmd,mkdir) | 43 | $(call cmd,mkdir) |
44 | 44 | ||
45 | $(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $$(dir $(INSTALL_FW_PATH)/%) | 45 | $(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %) |
46 | $(call cmd,install) | 46 | $(call cmd,install) |
47 | 47 | ||
48 | PHONY += __fw_install __fw_modinst FORCE | 48 | PHONY += __fw_install __fw_modinst FORCE |
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index d24810fc6af6..fd8fa9aa7c4e 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh | |||
@@ -200,7 +200,7 @@ EOF | |||
200 | syscall_list() { | 200 | syscall_list() { |
201 | grep '^[0-9]' "$1" | sort -n | ( | 201 | grep '^[0-9]' "$1" | sort -n | ( |
202 | while read nr abi name entry ; do | 202 | while read nr abi name entry ; do |
203 | echo <<EOF | 203 | cat <<EOF |
204 | #if !defined(__NR_${name}) && !defined(__IGNORE_${name}) | 204 | #if !defined(__NR_${name}) && !defined(__IGNORE_${name}) |
205 | #warning syscall ${name} not implemented | 205 | #warning syscall ${name} not implemented |
206 | #endif | 206 | #endif |
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h index c220f314709c..65f67cb0aefb 100644 --- a/security/selinux/include/xfrm.h +++ b/security/selinux/include/xfrm.h | |||
@@ -51,6 +51,7 @@ int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall); | |||
51 | static inline void selinux_xfrm_notify_policyload(void) | 51 | static inline void selinux_xfrm_notify_policyload(void) |
52 | { | 52 | { |
53 | atomic_inc(&flow_cache_genid); | 53 | atomic_inc(&flow_cache_genid); |
54 | rt_genid_bump(&init_net); | ||
54 | } | 55 | } |
55 | #else | 56 | #else |
56 | static inline int selinux_xfrm_enabled(void) | 57 | static inline int selinux_xfrm_enabled(void) |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 228cdf93fa29..c4763c52eaf6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2701,6 +2701,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
2701 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2701 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2702 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2702 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
2703 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2703 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
2704 | SND_PCI_QUIRK(0x1043, 0x1ac3, "ASUS X53S", POS_FIX_POSBUF), | ||
2704 | SND_PCI_QUIRK(0x1043, 0x1b43, "ASUS K53E", POS_FIX_POSBUF), | 2705 | SND_PCI_QUIRK(0x1043, 0x1b43, "ASUS K53E", POS_FIX_POSBUF), |
2705 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2706 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
2706 | SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), | 2707 | SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 5c9cacaf2d52..1cf7a32d1b21 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -426,7 +426,7 @@ static const int arizona_44k1_bclk_rates[] = { | |||
426 | 940800, | 426 | 940800, |
427 | 1411200, | 427 | 1411200, |
428 | 1881600, | 428 | 1881600, |
429 | 2882400, | 429 | 2822400, |
430 | 3763200, | 430 | 3763200, |
431 | 5644800, | 431 | 5644800, |
432 | 7526400, | 432 | 7526400, |
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 8f726c063f42..115a40301810 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -659,7 +659,7 @@ static struct snd_soc_dai_driver mc13783_dai_async[] = { | |||
659 | .id = MC13783_ID_STEREO_DAC, | 659 | .id = MC13783_ID_STEREO_DAC, |
660 | .playback = { | 660 | .playback = { |
661 | .stream_name = "Playback", | 661 | .stream_name = "Playback", |
662 | .channels_min = 1, | 662 | .channels_min = 2, |
663 | .channels_max = 2, | 663 | .channels_max = 2, |
664 | .rates = SNDRV_PCM_RATE_8000_96000, | 664 | .rates = SNDRV_PCM_RATE_8000_96000, |
665 | .formats = MC13783_FORMATS, | 665 | .formats = MC13783_FORMATS, |
@@ -670,7 +670,7 @@ static struct snd_soc_dai_driver mc13783_dai_async[] = { | |||
670 | .id = MC13783_ID_STEREO_CODEC, | 670 | .id = MC13783_ID_STEREO_CODEC, |
671 | .capture = { | 671 | .capture = { |
672 | .stream_name = "Capture", | 672 | .stream_name = "Capture", |
673 | .channels_min = 1, | 673 | .channels_min = 2, |
674 | .channels_max = 2, | 674 | .channels_max = 2, |
675 | .rates = MC13783_RATES_RECORD, | 675 | .rates = MC13783_RATES_RECORD, |
676 | .formats = MC13783_FORMATS, | 676 | .formats = MC13783_FORMATS, |
@@ -692,14 +692,14 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = { | |||
692 | .id = MC13783_ID_SYNC, | 692 | .id = MC13783_ID_SYNC, |
693 | .playback = { | 693 | .playback = { |
694 | .stream_name = "Playback", | 694 | .stream_name = "Playback", |
695 | .channels_min = 1, | 695 | .channels_min = 2, |
696 | .channels_max = 2, | 696 | .channels_max = 2, |
697 | .rates = SNDRV_PCM_RATE_8000_96000, | 697 | .rates = SNDRV_PCM_RATE_8000_96000, |
698 | .formats = MC13783_FORMATS, | 698 | .formats = MC13783_FORMATS, |
699 | }, | 699 | }, |
700 | .capture = { | 700 | .capture = { |
701 | .stream_name = "Capture", | 701 | .stream_name = "Capture", |
702 | .channels_min = 1, | 702 | .channels_min = 2, |
703 | .channels_max = 2, | 703 | .channels_max = 2, |
704 | .rates = MC13783_RATES_RECORD, | 704 | .rates = MC13783_RATES_RECORD, |
705 | .formats = MC13783_FORMATS, | 705 | .formats = MC13783_FORMATS, |
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 3fd5b29dc933..a3acb7a85f6a 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
@@ -702,7 +702,7 @@ static bool wm2000_readable_reg(struct device *dev, unsigned int reg) | |||
702 | } | 702 | } |
703 | 703 | ||
704 | static const struct regmap_config wm2000_regmap = { | 704 | static const struct regmap_config wm2000_regmap = { |
705 | .reg_bits = 8, | 705 | .reg_bits = 16, |
706 | .val_bits = 8, | 706 | .val_bits = 8, |
707 | 707 | ||
708 | .max_register = WM2000_REG_IF_CTL, | 708 | .max_register = WM2000_REG_IF_CTL, |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 0013afe48e66..dc4262eea4b7 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -100,7 +100,7 @@ static const struct reg_default wm8904_reg_defaults[] = { | |||
100 | { 14, 0x0000 }, /* R14 - Power Management 2 */ | 100 | { 14, 0x0000 }, /* R14 - Power Management 2 */ |
101 | { 15, 0x0000 }, /* R15 - Power Management 3 */ | 101 | { 15, 0x0000 }, /* R15 - Power Management 3 */ |
102 | { 18, 0x0000 }, /* R18 - Power Management 6 */ | 102 | { 18, 0x0000 }, /* R18 - Power Management 6 */ |
103 | { 19, 0x945E }, /* R20 - Clock Rates 0 */ | 103 | { 20, 0x945E }, /* R20 - Clock Rates 0 */ |
104 | { 21, 0x0C05 }, /* R21 - Clock Rates 1 */ | 104 | { 21, 0x0C05 }, /* R21 - Clock Rates 1 */ |
105 | { 22, 0x0006 }, /* R22 - Clock Rates 2 */ | 105 | { 22, 0x0006 }, /* R22 - Clock Rates 2 */ |
106 | { 24, 0x0050 }, /* R24 - Audio Interface 0 */ | 106 | { 24, 0x0050 }, /* R24 - Audio Interface 0 */ |
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index fb21b17f17f5..199408ec4261 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c | |||
@@ -94,7 +94,7 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev) | |||
94 | dev_err(&pdev->dev, "audmux internal port setup failed\n"); | 94 | dev_err(&pdev->dev, "audmux internal port setup failed\n"); |
95 | return ret; | 95 | return ret; |
96 | } | 96 | } |
97 | imx_audmux_v2_configure_port(ext_port, | 97 | ret = imx_audmux_v2_configure_port(ext_port, |
98 | IMX_AUDMUX_V2_PTCR_SYN, | 98 | IMX_AUDMUX_V2_PTCR_SYN, |
99 | IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); | 99 | IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); |
100 | if (ret) { | 100 | if (ret) { |
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c index 009533ab8d18..df65f98211ec 100644 --- a/sound/soc/omap/am3517evm.c +++ b/sound/soc/omap/am3517evm.c | |||
@@ -59,7 +59,7 @@ static int am3517evm_hw_params(struct snd_pcm_substream *substream, | |||
59 | return ret; | 59 | return ret; |
60 | } | 60 | } |
61 | 61 | ||
62 | snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_FSR_SRC_FSX, 0, | 62 | ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_FSR_SRC_FSX, 0, |
63 | SND_SOC_CLOCK_IN); | 63 | SND_SOC_CLOCK_IN); |
64 | if (ret < 0) { | 64 | if (ret < 0) { |
65 | printk(KERN_ERR "can't set CPU system clock OMAP_MCBSP_FSR_SRC_FSX\n"); | 65 | printk(KERN_ERR "can't set CPU system clock OMAP_MCBSP_FSR_SRC_FSX\n"); |
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c index f3ebc38c10fe..b70964ea448c 100644 --- a/sound/soc/samsung/dma.c +++ b/sound/soc/samsung/dma.c | |||
@@ -34,9 +34,7 @@ static const struct snd_pcm_hardware dma_hardware = { | |||
34 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 34 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
35 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 35 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
36 | SNDRV_PCM_INFO_MMAP | | 36 | SNDRV_PCM_INFO_MMAP | |
37 | SNDRV_PCM_INFO_MMAP_VALID | | 37 | SNDRV_PCM_INFO_MMAP_VALID, |
38 | SNDRV_PCM_INFO_PAUSE | | ||
39 | SNDRV_PCM_INFO_RESUME, | ||
40 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | 38 | .formats = SNDRV_PCM_FMTBIT_S16_LE | |
41 | SNDRV_PCM_FMTBIT_U16_LE | | 39 | SNDRV_PCM_FMTBIT_U16_LE | |
42 | SNDRV_PCM_FMTBIT_U8 | | 40 | SNDRV_PCM_FMTBIT_U8 | |
@@ -248,15 +246,11 @@ static int dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
248 | 246 | ||
249 | switch (cmd) { | 247 | switch (cmd) { |
250 | case SNDRV_PCM_TRIGGER_START: | 248 | case SNDRV_PCM_TRIGGER_START: |
251 | case SNDRV_PCM_TRIGGER_RESUME: | ||
252 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
253 | prtd->state |= ST_RUNNING; | 249 | prtd->state |= ST_RUNNING; |
254 | prtd->params->ops->trigger(prtd->params->ch); | 250 | prtd->params->ops->trigger(prtd->params->ch); |
255 | break; | 251 | break; |
256 | 252 | ||
257 | case SNDRV_PCM_TRIGGER_STOP: | 253 | case SNDRV_PCM_TRIGGER_STOP: |
258 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
259 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
260 | prtd->state &= ~ST_RUNNING; | 254 | prtd->state &= ~ST_RUNNING; |
261 | prtd->params->ops->stop(prtd->params->ch); | 255 | prtd->params->ops->stop(prtd->params->ch); |
262 | break; | 256 | break; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dd7c49fafd75..f90139b5f50d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -291,8 +291,11 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, | |||
291 | if (dapm->codec->driver->set_bias_level) | 291 | if (dapm->codec->driver->set_bias_level) |
292 | ret = dapm->codec->driver->set_bias_level(dapm->codec, | 292 | ret = dapm->codec->driver->set_bias_level(dapm->codec, |
293 | level); | 293 | level); |
294 | } else | 294 | else |
295 | dapm->bias_level = level; | ||
296 | } else if (!card || dapm != &card->dapm) { | ||
295 | dapm->bias_level = level; | 297 | dapm->bias_level = level; |
298 | } | ||
296 | 299 | ||
297 | if (ret != 0) | 300 | if (ret != 0) |
298 | goto out; | 301 | goto out; |
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 97c2cac8e92c..8c7f23729446 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -138,7 +138,7 @@ static void spear_pcm_free(struct snd_pcm *pcm) | |||
138 | continue; | 138 | continue; |
139 | 139 | ||
140 | buf = &substream->dma_buffer; | 140 | buf = &substream->dma_buffer; |
141 | if (!buf && !buf->area) | 141 | if (!buf || !buf->area) |
142 | continue; | 142 | continue; |
143 | 143 | ||
144 | dma_free_writecombine(pcm->card->dev, buf->bytes, | 144 | dma_free_writecombine(pcm->card->dev, buf->bytes, |
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c index e463529b38bb..76cb1b363b71 100644 --- a/sound/soc/tegra/tegra_alc5632.c +++ b/sound/soc/tegra/tegra_alc5632.c | |||
@@ -89,7 +89,6 @@ static struct snd_soc_jack_gpio tegra_alc5632_hp_jack_gpio = { | |||
89 | .name = "Headset detection", | 89 | .name = "Headset detection", |
90 | .report = SND_JACK_HEADSET, | 90 | .report = SND_JACK_HEADSET, |
91 | .debounce_time = 150, | 91 | .debounce_time = 150, |
92 | .invert = 1, | ||
93 | }; | 92 | }; |
94 | 93 | ||
95 | static const struct snd_soc_dapm_widget tegra_alc5632_dapm_widgets[] = { | 94 | static const struct snd_soc_dapm_widget tegra_alc5632_dapm_widgets[] = { |
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index 5658bcec1931..8d6900c1ee47 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c | |||
@@ -334,11 +334,11 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream, | |||
334 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 334 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
335 | slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 335 | slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
336 | slave_config.dst_addr = dmap->addr; | 336 | slave_config.dst_addr = dmap->addr; |
337 | slave_config.src_maxburst = 0; | 337 | slave_config.dst_maxburst = 4; |
338 | } else { | 338 | } else { |
339 | slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 339 | slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
340 | slave_config.src_addr = dmap->addr; | 340 | slave_config.src_addr = dmap->addr; |
341 | slave_config.dst_maxburst = 0; | 341 | slave_config.src_maxburst = 4; |
342 | } | 342 | } |
343 | slave_config.slave_id = dmap->req_sel; | 343 | slave_config.slave_id = dmap->req_sel; |
344 | 344 | ||
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 5c472f335a64..eb85113d472a 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c | |||
@@ -663,7 +663,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
663 | struct ux500_msp **msp_p, | 663 | struct ux500_msp **msp_p, |
664 | struct msp_i2s_platform_data *platform_data) | 664 | struct msp_i2s_platform_data *platform_data) |
665 | { | 665 | { |
666 | int ret = 0; | ||
667 | struct resource *res = NULL; | 666 | struct resource *res = NULL; |
668 | struct i2s_controller *i2s_cont; | 667 | struct i2s_controller *i2s_cont; |
669 | struct ux500_msp *msp; | 668 | struct ux500_msp *msp; |
@@ -685,15 +684,14 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
685 | if (res == NULL) { | 684 | if (res == NULL) { |
686 | dev_err(&pdev->dev, "%s: ERROR: Unable to get resource!\n", | 685 | dev_err(&pdev->dev, "%s: ERROR: Unable to get resource!\n", |
687 | __func__); | 686 | __func__); |
688 | ret = -ENOMEM; | 687 | return -ENOMEM; |
689 | goto err_res; | ||
690 | } | 688 | } |
691 | 689 | ||
692 | msp->registers = ioremap(res->start, (res->end - res->start + 1)); | 690 | msp->registers = devm_ioremap(&pdev->dev, res->start, |
691 | resource_size(res)); | ||
693 | if (msp->registers == NULL) { | 692 | if (msp->registers == NULL) { |
694 | dev_err(&pdev->dev, "%s: ERROR: ioremap failed!\n", __func__); | 693 | dev_err(&pdev->dev, "%s: ERROR: ioremap failed!\n", __func__); |
695 | ret = -ENOMEM; | 694 | return -ENOMEM; |
696 | goto err_res; | ||
697 | } | 695 | } |
698 | 696 | ||
699 | msp->msp_state = MSP_STATE_IDLE; | 697 | msp->msp_state = MSP_STATE_IDLE; |
@@ -705,7 +703,7 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
705 | dev_err(&pdev->dev, | 703 | dev_err(&pdev->dev, |
706 | "%s: ERROR: Failed to allocate I2S-controller!\n", | 704 | "%s: ERROR: Failed to allocate I2S-controller!\n", |
707 | __func__); | 705 | __func__); |
708 | goto err_i2s_cont; | 706 | return -ENOMEM; |
709 | } | 707 | } |
710 | i2s_cont->dev.parent = &pdev->dev; | 708 | i2s_cont->dev.parent = &pdev->dev; |
711 | i2s_cont->data = (void *)msp; | 709 | i2s_cont->data = (void *)msp; |
@@ -716,14 +714,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
716 | msp->i2s_cont = i2s_cont; | 714 | msp->i2s_cont = i2s_cont; |
717 | 715 | ||
718 | return 0; | 716 | return 0; |
719 | |||
720 | err_i2s_cont: | ||
721 | iounmap(msp->registers); | ||
722 | |||
723 | err_res: | ||
724 | devm_kfree(&pdev->dev, msp); | ||
725 | |||
726 | return ret; | ||
727 | } | 717 | } |
728 | 718 | ||
729 | void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, | 719 | void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, |
@@ -732,11 +722,6 @@ void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, | |||
732 | dev_dbg(msp->dev, "%s: Enter (id = %d).\n", __func__, msp->id); | 722 | dev_dbg(msp->dev, "%s: Enter (id = %d).\n", __func__, msp->id); |
733 | 723 | ||
734 | device_unregister(&msp->i2s_cont->dev); | 724 | device_unregister(&msp->i2s_cont->dev); |
735 | devm_kfree(&pdev->dev, msp->i2s_cont); | ||
736 | |||
737 | iounmap(msp->registers); | ||
738 | |||
739 | devm_kfree(&pdev->dev, msp); | ||
740 | } | 725 | } |
741 | 726 | ||
742 | MODULE_LICENSE("GPL v2"); | 727 | MODULE_LICENSE("GPL v2"); |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index d6e2bb49c59c..060dccb9ec75 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -197,7 +197,13 @@ static void prepare_outbound_urb(struct snd_usb_endpoint *ep, | |||
197 | /* no data provider, so send silence */ | 197 | /* no data provider, so send silence */ |
198 | unsigned int offs = 0; | 198 | unsigned int offs = 0; |
199 | for (i = 0; i < ctx->packets; ++i) { | 199 | for (i = 0; i < ctx->packets; ++i) { |
200 | int counts = ctx->packet_size[i]; | 200 | int counts; |
201 | |||
202 | if (ctx->packet_size[i]) | ||
203 | counts = ctx->packet_size[i]; | ||
204 | else | ||
205 | counts = snd_usb_endpoint_next_packet_size(ep); | ||
206 | |||
201 | urb->iso_frame_desc[i].offset = offs * ep->stride; | 207 | urb->iso_frame_desc[i].offset = offs * ep->stride; |
202 | urb->iso_frame_desc[i].length = counts * ep->stride; | 208 | urb->iso_frame_desc[i].length = counts * ep->stride; |
203 | offs += counts; | 209 | offs += counts; |