diff options
190 files changed, 2300 insertions, 1067 deletions
diff --git a/Documentation/devicetree/bindings/spi/mxs-spi.txt b/Documentation/devicetree/bindings/spi/mxs-spi.txt new file mode 100644 index 000000000000..e2e13957c2a4 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/mxs-spi.txt | |||
@@ -0,0 +1,22 @@ | |||
1 | * Freescale MX233/MX28 SSP/SPI | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "fsl,<soc>-spi", where soc is "imx23" or "imx28" | ||
5 | - reg: Offset and length of the register set for the device | ||
6 | - interrupts: Should contain SSP interrupts (error irq first, dma irq second) | ||
7 | - fsl,ssp-dma-channel: APBX DMA channel for the SSP | ||
8 | |||
9 | Optional properties: | ||
10 | - clock-frequency : Input clock frequency to the SPI block in Hz. | ||
11 | Default is 160000000 Hz. | ||
12 | |||
13 | Example: | ||
14 | |||
15 | ssp0: ssp@80010000 { | ||
16 | #address-cells = <1>; | ||
17 | #size-cells = <0>; | ||
18 | compatible = "fsl,imx28-spi"; | ||
19 | reg = <0x80010000 0x2000>; | ||
20 | interrupts = <96 82>; | ||
21 | fsl,ssp-dma-channel = <0>; | ||
22 | }; | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 53cc13c82cb1..b17587d9412f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3666,11 +3666,12 @@ F: Documentation/networking/README.ipw2200 | |||
3666 | F: drivers/net/wireless/ipw2x00/ | 3666 | F: drivers/net/wireless/ipw2x00/ |
3667 | 3667 | ||
3668 | INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) | 3668 | INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) |
3669 | M: Joseph Cihula <joseph.cihula@intel.com> | 3669 | M: Richard L Maliszewski <richard.l.maliszewski@intel.com> |
3670 | M: Gang Wei <gang.wei@intel.com> | ||
3670 | M: Shane Wang <shane.wang@intel.com> | 3671 | M: Shane Wang <shane.wang@intel.com> |
3671 | L: tboot-devel@lists.sourceforge.net | 3672 | L: tboot-devel@lists.sourceforge.net |
3672 | W: http://tboot.sourceforge.net | 3673 | W: http://tboot.sourceforge.net |
3673 | T: Mercurial http://www.bughost.org/repos.hg/tboot.hg | 3674 | T: hg http://tboot.hg.sourceforge.net:8000/hgroot/tboot/tboot |
3674 | S: Supported | 3675 | S: Supported |
3675 | F: Documentation/intel_txt.txt | 3676 | F: Documentation/intel_txt.txt |
3676 | F: include/linux/tboot.h | 3677 | F: include/linux/tboot.h |
@@ -1,8 +1,8 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 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-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/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/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/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/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/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/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/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/clk/mxs/Makefile b/drivers/clk/mxs/Makefile index 7bedeec08524..a6a22237e860 100644 --- a/drivers/clk/mxs/Makefile +++ b/drivers/clk/mxs/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for mxs specific clk | 2 | # Makefile for mxs specific clk |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += clk.o clk-pll.o clk-ref.o clk-div.o clk-frac.o | 5 | obj-y += clk.o clk-pll.o clk-ref.o clk-div.o clk-frac.o clk-ssp.o |
6 | 6 | ||
7 | obj-$(CONFIG_SOC_IMX23) += clk-imx23.o | 7 | obj-$(CONFIG_SOC_IMX23) += clk-imx23.o |
8 | obj-$(CONFIG_SOC_IMX28) += clk-imx28.o | 8 | obj-$(CONFIG_SOC_IMX28) += clk-imx28.o |
diff --git a/drivers/clk/mxs/clk-ssp.c b/drivers/clk/mxs/clk-ssp.c new file mode 100644 index 000000000000..af7bdbf9ebd7 --- /dev/null +++ b/drivers/clk/mxs/clk-ssp.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright 2012 DENX Software Engineering, GmbH | ||
3 | * | ||
4 | * Pulled from code: | ||
5 | * Portions copyright (C) 2003 Russell King, PXA MMCI Driver | ||
6 | * Portions copyright (C) 2004-2005 Pierre Ossman, W83L51xD SD/MMC driver | ||
7 | * | ||
8 | * Copyright 2008 Embedded Alley Solutions, Inc. | ||
9 | * Copyright 2009-2011 Freescale Semiconductor, Inc. | ||
10 | * | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/device.h> | ||
24 | #include <linux/io.h> | ||
25 | #include <linux/spi/mxs-spi.h> | ||
26 | |||
27 | void mxs_ssp_set_clk_rate(struct mxs_ssp *ssp, unsigned int rate) | ||
28 | { | ||
29 | unsigned int ssp_clk, ssp_sck; | ||
30 | u32 clock_divide, clock_rate; | ||
31 | u32 val; | ||
32 | |||
33 | ssp_clk = clk_get_rate(ssp->clk); | ||
34 | |||
35 | for (clock_divide = 2; clock_divide <= 254; clock_divide += 2) { | ||
36 | clock_rate = DIV_ROUND_UP(ssp_clk, rate * clock_divide); | ||
37 | clock_rate = (clock_rate > 0) ? clock_rate - 1 : 0; | ||
38 | if (clock_rate <= 255) | ||
39 | break; | ||
40 | } | ||
41 | |||
42 | if (clock_divide > 254) { | ||
43 | dev_err(ssp->dev, | ||
44 | "%s: cannot set clock to %d\n", __func__, rate); | ||
45 | return; | ||
46 | } | ||
47 | |||
48 | ssp_sck = ssp_clk / clock_divide / (1 + clock_rate); | ||
49 | |||
50 | val = readl(ssp->base + HW_SSP_TIMING(ssp)); | ||
51 | val &= ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE); | ||
52 | val |= BF_SSP(clock_divide, TIMING_CLOCK_DIVIDE); | ||
53 | val |= BF_SSP(clock_rate, TIMING_CLOCK_RATE); | ||
54 | writel(val, ssp->base + HW_SSP_TIMING(ssp)); | ||
55 | |||
56 | ssp->clk_rate = ssp_sck; | ||
57 | |||
58 | dev_dbg(ssp->dev, | ||
59 | "%s: clock_divide %d, clock_rate %d, ssp_clk %d, rate_actual %d, rate_requested %d\n", | ||
60 | __func__, clock_divide, clock_rate, ssp_clk, ssp_sck, rate); | ||
61 | } | ||
62 | EXPORT_SYMBOL_GPL(mxs_ssp_set_clk_rate); | ||
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/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/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/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/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 ca43901ed861..0af216d21f87 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -262,7 +262,10 @@ struct ipoib_ethtool_st { | |||
262 | u16 max_coalesced_frames; | 262 | u16 max_coalesced_frames; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | struct ipoib_neigh_table; | ||
266 | |||
265 | struct ipoib_neigh_hash { | 267 | struct ipoib_neigh_hash { |
268 | struct ipoib_neigh_table *ntbl; | ||
266 | struct ipoib_neigh __rcu **buckets; | 269 | struct ipoib_neigh __rcu **buckets; |
267 | struct rcu_head rcu; | 270 | struct rcu_head rcu; |
268 | u32 mask; | 271 | u32 mask; |
@@ -271,9 +274,9 @@ struct ipoib_neigh_hash { | |||
271 | 274 | ||
272 | struct ipoib_neigh_table { | 275 | struct ipoib_neigh_table { |
273 | struct ipoib_neigh_hash __rcu *htbl; | 276 | struct ipoib_neigh_hash __rcu *htbl; |
274 | rwlock_t rwlock; | ||
275 | atomic_t entries; | 277 | atomic_t entries; |
276 | struct completion flushed; | 278 | struct completion flushed; |
279 | struct completion deleted; | ||
277 | }; | 280 | }; |
278 | 281 | ||
279 | /* | 282 | /* |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 3e2085a3ee47..1e19b5ae7c47 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -546,15 +546,15 @@ static void neigh_add_path(struct sk_buff *skb, u8 *daddr, | |||
546 | struct ipoib_neigh *neigh; | 546 | struct ipoib_neigh *neigh; |
547 | unsigned long flags; | 547 | unsigned long flags; |
548 | 548 | ||
549 | spin_lock_irqsave(&priv->lock, flags); | ||
549 | neigh = ipoib_neigh_alloc(daddr, dev); | 550 | neigh = ipoib_neigh_alloc(daddr, dev); |
550 | if (!neigh) { | 551 | if (!neigh) { |
552 | spin_unlock_irqrestore(&priv->lock, flags); | ||
551 | ++dev->stats.tx_dropped; | 553 | ++dev->stats.tx_dropped; |
552 | dev_kfree_skb_any(skb); | 554 | dev_kfree_skb_any(skb); |
553 | return; | 555 | return; |
554 | } | 556 | } |
555 | 557 | ||
556 | spin_lock_irqsave(&priv->lock, flags); | ||
557 | |||
558 | path = __path_find(dev, daddr + 4); | 558 | path = __path_find(dev, daddr + 4); |
559 | if (!path) { | 559 | if (!path) { |
560 | path = path_rec_create(dev, daddr + 4); | 560 | path = path_rec_create(dev, daddr + 4); |
@@ -863,10 +863,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) | |||
863 | if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) | 863 | if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) |
864 | return; | 864 | return; |
865 | 865 | ||
866 | write_lock_bh(&ntbl->rwlock); | 866 | spin_lock_irqsave(&priv->lock, flags); |
867 | 867 | ||
868 | htbl = rcu_dereference_protected(ntbl->htbl, | 868 | htbl = rcu_dereference_protected(ntbl->htbl, |
869 | lockdep_is_held(&ntbl->rwlock)); | 869 | lockdep_is_held(&priv->lock)); |
870 | 870 | ||
871 | if (!htbl) | 871 | if (!htbl) |
872 | goto out_unlock; | 872 | goto out_unlock; |
@@ -883,16 +883,14 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) | |||
883 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; | 883 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; |
884 | 884 | ||
885 | while ((neigh = rcu_dereference_protected(*np, | 885 | while ((neigh = rcu_dereference_protected(*np, |
886 | lockdep_is_held(&ntbl->rwlock))) != NULL) { | 886 | lockdep_is_held(&priv->lock))) != NULL) { |
887 | /* was the neigh idle for two GC periods */ | 887 | /* was the neigh idle for two GC periods */ |
888 | if (time_after(neigh_obsolete, neigh->alive)) { | 888 | if (time_after(neigh_obsolete, neigh->alive)) { |
889 | rcu_assign_pointer(*np, | 889 | rcu_assign_pointer(*np, |
890 | rcu_dereference_protected(neigh->hnext, | 890 | rcu_dereference_protected(neigh->hnext, |
891 | lockdep_is_held(&ntbl->rwlock))); | 891 | lockdep_is_held(&priv->lock))); |
892 | /* remove from path/mc list */ | 892 | /* remove from path/mc list */ |
893 | spin_lock_irqsave(&priv->lock, flags); | ||
894 | list_del(&neigh->list); | 893 | list_del(&neigh->list); |
895 | spin_unlock_irqrestore(&priv->lock, flags); | ||
896 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 894 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
897 | } else { | 895 | } else { |
898 | np = &neigh->hnext; | 896 | np = &neigh->hnext; |
@@ -902,7 +900,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) | |||
902 | } | 900 | } |
903 | 901 | ||
904 | out_unlock: | 902 | out_unlock: |
905 | write_unlock_bh(&ntbl->rwlock); | 903 | spin_unlock_irqrestore(&priv->lock, flags); |
906 | } | 904 | } |
907 | 905 | ||
908 | static void ipoib_reap_neigh(struct work_struct *work) | 906 | static void ipoib_reap_neigh(struct work_struct *work) |
@@ -947,10 +945,8 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr, | |||
947 | struct ipoib_neigh *neigh; | 945 | struct ipoib_neigh *neigh; |
948 | u32 hash_val; | 946 | u32 hash_val; |
949 | 947 | ||
950 | write_lock_bh(&ntbl->rwlock); | ||
951 | |||
952 | htbl = rcu_dereference_protected(ntbl->htbl, | 948 | htbl = rcu_dereference_protected(ntbl->htbl, |
953 | lockdep_is_held(&ntbl->rwlock)); | 949 | lockdep_is_held(&priv->lock)); |
954 | if (!htbl) { | 950 | if (!htbl) { |
955 | neigh = NULL; | 951 | neigh = NULL; |
956 | goto out_unlock; | 952 | goto out_unlock; |
@@ -961,10 +957,10 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr, | |||
961 | */ | 957 | */ |
962 | hash_val = ipoib_addr_hash(htbl, daddr); | 958 | hash_val = ipoib_addr_hash(htbl, daddr); |
963 | for (neigh = rcu_dereference_protected(htbl->buckets[hash_val], | 959 | for (neigh = rcu_dereference_protected(htbl->buckets[hash_val], |
964 | lockdep_is_held(&ntbl->rwlock)); | 960 | lockdep_is_held(&priv->lock)); |
965 | neigh != NULL; | 961 | neigh != NULL; |
966 | neigh = rcu_dereference_protected(neigh->hnext, | 962 | neigh = rcu_dereference_protected(neigh->hnext, |
967 | lockdep_is_held(&ntbl->rwlock))) { | 963 | lockdep_is_held(&priv->lock))) { |
968 | if (memcmp(daddr, neigh->daddr, INFINIBAND_ALEN) == 0) { | 964 | if (memcmp(daddr, neigh->daddr, INFINIBAND_ALEN) == 0) { |
969 | /* found, take one ref on behalf of the caller */ | 965 | /* found, take one ref on behalf of the caller */ |
970 | if (!atomic_inc_not_zero(&neigh->refcnt)) { | 966 | if (!atomic_inc_not_zero(&neigh->refcnt)) { |
@@ -987,12 +983,11 @@ struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr, | |||
987 | /* put in hash */ | 983 | /* put in hash */ |
988 | rcu_assign_pointer(neigh->hnext, | 984 | rcu_assign_pointer(neigh->hnext, |
989 | rcu_dereference_protected(htbl->buckets[hash_val], | 985 | rcu_dereference_protected(htbl->buckets[hash_val], |
990 | lockdep_is_held(&ntbl->rwlock))); | 986 | lockdep_is_held(&priv->lock))); |
991 | rcu_assign_pointer(htbl->buckets[hash_val], neigh); | 987 | rcu_assign_pointer(htbl->buckets[hash_val], neigh); |
992 | atomic_inc(&ntbl->entries); | 988 | atomic_inc(&ntbl->entries); |
993 | 989 | ||
994 | out_unlock: | 990 | out_unlock: |
995 | write_unlock_bh(&ntbl->rwlock); | ||
996 | 991 | ||
997 | return neigh; | 992 | return neigh; |
998 | } | 993 | } |
@@ -1040,35 +1035,29 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh) | |||
1040 | struct ipoib_neigh *n; | 1035 | struct ipoib_neigh *n; |
1041 | u32 hash_val; | 1036 | u32 hash_val; |
1042 | 1037 | ||
1043 | write_lock_bh(&ntbl->rwlock); | ||
1044 | |||
1045 | htbl = rcu_dereference_protected(ntbl->htbl, | 1038 | htbl = rcu_dereference_protected(ntbl->htbl, |
1046 | lockdep_is_held(&ntbl->rwlock)); | 1039 | lockdep_is_held(&priv->lock)); |
1047 | if (!htbl) | 1040 | if (!htbl) |
1048 | goto out_unlock; | 1041 | return; |
1049 | 1042 | ||
1050 | hash_val = ipoib_addr_hash(htbl, neigh->daddr); | 1043 | hash_val = ipoib_addr_hash(htbl, neigh->daddr); |
1051 | np = &htbl->buckets[hash_val]; | 1044 | np = &htbl->buckets[hash_val]; |
1052 | for (n = rcu_dereference_protected(*np, | 1045 | for (n = rcu_dereference_protected(*np, |
1053 | lockdep_is_held(&ntbl->rwlock)); | 1046 | lockdep_is_held(&priv->lock)); |
1054 | n != NULL; | 1047 | n != NULL; |
1055 | n = rcu_dereference_protected(*np, | 1048 | n = rcu_dereference_protected(*np, |
1056 | lockdep_is_held(&ntbl->rwlock))) { | 1049 | lockdep_is_held(&priv->lock))) { |
1057 | if (n == neigh) { | 1050 | if (n == neigh) { |
1058 | /* found */ | 1051 | /* found */ |
1059 | rcu_assign_pointer(*np, | 1052 | rcu_assign_pointer(*np, |
1060 | rcu_dereference_protected(neigh->hnext, | 1053 | rcu_dereference_protected(neigh->hnext, |
1061 | lockdep_is_held(&ntbl->rwlock))); | 1054 | lockdep_is_held(&priv->lock))); |
1062 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 1055 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
1063 | goto out_unlock; | 1056 | return; |
1064 | } else { | 1057 | } else { |
1065 | np = &n->hnext; | 1058 | np = &n->hnext; |
1066 | } | 1059 | } |
1067 | } | 1060 | } |
1068 | |||
1069 | out_unlock: | ||
1070 | write_unlock_bh(&ntbl->rwlock); | ||
1071 | |||
1072 | } | 1061 | } |
1073 | 1062 | ||
1074 | static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) | 1063 | static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) |
@@ -1080,7 +1069,6 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) | |||
1080 | 1069 | ||
1081 | clear_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); | 1070 | clear_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); |
1082 | ntbl->htbl = NULL; | 1071 | ntbl->htbl = NULL; |
1083 | rwlock_init(&ntbl->rwlock); | ||
1084 | htbl = kzalloc(sizeof(*htbl), GFP_KERNEL); | 1072 | htbl = kzalloc(sizeof(*htbl), GFP_KERNEL); |
1085 | if (!htbl) | 1073 | if (!htbl) |
1086 | return -ENOMEM; | 1074 | return -ENOMEM; |
@@ -1095,6 +1083,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv) | |||
1095 | htbl->mask = (size - 1); | 1083 | htbl->mask = (size - 1); |
1096 | htbl->buckets = buckets; | 1084 | htbl->buckets = buckets; |
1097 | ntbl->htbl = htbl; | 1085 | ntbl->htbl = htbl; |
1086 | htbl->ntbl = ntbl; | ||
1098 | atomic_set(&ntbl->entries, 0); | 1087 | atomic_set(&ntbl->entries, 0); |
1099 | 1088 | ||
1100 | /* start garbage collection */ | 1089 | /* start garbage collection */ |
@@ -1111,9 +1100,11 @@ static void neigh_hash_free_rcu(struct rcu_head *head) | |||
1111 | struct ipoib_neigh_hash, | 1100 | struct ipoib_neigh_hash, |
1112 | rcu); | 1101 | rcu); |
1113 | struct ipoib_neigh __rcu **buckets = htbl->buckets; | 1102 | struct ipoib_neigh __rcu **buckets = htbl->buckets; |
1103 | struct ipoib_neigh_table *ntbl = htbl->ntbl; | ||
1114 | 1104 | ||
1115 | kfree(buckets); | 1105 | kfree(buckets); |
1116 | kfree(htbl); | 1106 | kfree(htbl); |
1107 | complete(&ntbl->deleted); | ||
1117 | } | 1108 | } |
1118 | 1109 | ||
1119 | void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | 1110 | void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) |
@@ -1125,10 +1116,10 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | |||
1125 | int i; | 1116 | int i; |
1126 | 1117 | ||
1127 | /* remove all neigh connected to a given path or mcast */ | 1118 | /* remove all neigh connected to a given path or mcast */ |
1128 | write_lock_bh(&ntbl->rwlock); | 1119 | spin_lock_irqsave(&priv->lock, flags); |
1129 | 1120 | ||
1130 | htbl = rcu_dereference_protected(ntbl->htbl, | 1121 | htbl = rcu_dereference_protected(ntbl->htbl, |
1131 | lockdep_is_held(&ntbl->rwlock)); | 1122 | lockdep_is_held(&priv->lock)); |
1132 | 1123 | ||
1133 | if (!htbl) | 1124 | if (!htbl) |
1134 | goto out_unlock; | 1125 | goto out_unlock; |
@@ -1138,16 +1129,14 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | |||
1138 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; | 1129 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; |
1139 | 1130 | ||
1140 | while ((neigh = rcu_dereference_protected(*np, | 1131 | while ((neigh = rcu_dereference_protected(*np, |
1141 | lockdep_is_held(&ntbl->rwlock))) != NULL) { | 1132 | lockdep_is_held(&priv->lock))) != NULL) { |
1142 | /* delete neighs belong to this parent */ | 1133 | /* delete neighs belong to this parent */ |
1143 | if (!memcmp(gid, neigh->daddr + 4, sizeof (union ib_gid))) { | 1134 | if (!memcmp(gid, neigh->daddr + 4, sizeof (union ib_gid))) { |
1144 | rcu_assign_pointer(*np, | 1135 | rcu_assign_pointer(*np, |
1145 | rcu_dereference_protected(neigh->hnext, | 1136 | rcu_dereference_protected(neigh->hnext, |
1146 | lockdep_is_held(&ntbl->rwlock))); | 1137 | lockdep_is_held(&priv->lock))); |
1147 | /* remove from parent list */ | 1138 | /* remove from parent list */ |
1148 | spin_lock_irqsave(&priv->lock, flags); | ||
1149 | list_del(&neigh->list); | 1139 | list_del(&neigh->list); |
1150 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1151 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 1140 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
1152 | } else { | 1141 | } else { |
1153 | np = &neigh->hnext; | 1142 | np = &neigh->hnext; |
@@ -1156,7 +1145,7 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid) | |||
1156 | } | 1145 | } |
1157 | } | 1146 | } |
1158 | out_unlock: | 1147 | out_unlock: |
1159 | write_unlock_bh(&ntbl->rwlock); | 1148 | spin_unlock_irqrestore(&priv->lock, flags); |
1160 | } | 1149 | } |
1161 | 1150 | ||
1162 | static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) | 1151 | static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) |
@@ -1164,37 +1153,44 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) | |||
1164 | struct ipoib_neigh_table *ntbl = &priv->ntbl; | 1153 | struct ipoib_neigh_table *ntbl = &priv->ntbl; |
1165 | struct ipoib_neigh_hash *htbl; | 1154 | struct ipoib_neigh_hash *htbl; |
1166 | unsigned long flags; | 1155 | unsigned long flags; |
1167 | int i; | 1156 | int i, wait_flushed = 0; |
1168 | 1157 | ||
1169 | write_lock_bh(&ntbl->rwlock); | 1158 | init_completion(&priv->ntbl.flushed); |
1159 | |||
1160 | spin_lock_irqsave(&priv->lock, flags); | ||
1170 | 1161 | ||
1171 | htbl = rcu_dereference_protected(ntbl->htbl, | 1162 | htbl = rcu_dereference_protected(ntbl->htbl, |
1172 | lockdep_is_held(&ntbl->rwlock)); | 1163 | lockdep_is_held(&priv->lock)); |
1173 | if (!htbl) | 1164 | if (!htbl) |
1174 | goto out_unlock; | 1165 | goto out_unlock; |
1175 | 1166 | ||
1167 | wait_flushed = atomic_read(&priv->ntbl.entries); | ||
1168 | if (!wait_flushed) | ||
1169 | goto free_htbl; | ||
1170 | |||
1176 | for (i = 0; i < htbl->size; i++) { | 1171 | for (i = 0; i < htbl->size; i++) { |
1177 | struct ipoib_neigh *neigh; | 1172 | struct ipoib_neigh *neigh; |
1178 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; | 1173 | struct ipoib_neigh __rcu **np = &htbl->buckets[i]; |
1179 | 1174 | ||
1180 | while ((neigh = rcu_dereference_protected(*np, | 1175 | while ((neigh = rcu_dereference_protected(*np, |
1181 | lockdep_is_held(&ntbl->rwlock))) != NULL) { | 1176 | lockdep_is_held(&priv->lock))) != NULL) { |
1182 | rcu_assign_pointer(*np, | 1177 | rcu_assign_pointer(*np, |
1183 | rcu_dereference_protected(neigh->hnext, | 1178 | rcu_dereference_protected(neigh->hnext, |
1184 | lockdep_is_held(&ntbl->rwlock))); | 1179 | lockdep_is_held(&priv->lock))); |
1185 | /* remove from path/mc list */ | 1180 | /* remove from path/mc list */ |
1186 | spin_lock_irqsave(&priv->lock, flags); | ||
1187 | list_del(&neigh->list); | 1181 | list_del(&neigh->list); |
1188 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1189 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); | 1182 | call_rcu(&neigh->rcu, ipoib_neigh_reclaim); |
1190 | } | 1183 | } |
1191 | } | 1184 | } |
1192 | 1185 | ||
1186 | free_htbl: | ||
1193 | rcu_assign_pointer(ntbl->htbl, NULL); | 1187 | rcu_assign_pointer(ntbl->htbl, NULL); |
1194 | call_rcu(&htbl->rcu, neigh_hash_free_rcu); | 1188 | call_rcu(&htbl->rcu, neigh_hash_free_rcu); |
1195 | 1189 | ||
1196 | out_unlock: | 1190 | out_unlock: |
1197 | write_unlock_bh(&ntbl->rwlock); | 1191 | spin_unlock_irqrestore(&priv->lock, flags); |
1192 | if (wait_flushed) | ||
1193 | wait_for_completion(&priv->ntbl.flushed); | ||
1198 | } | 1194 | } |
1199 | 1195 | ||
1200 | static void ipoib_neigh_hash_uninit(struct net_device *dev) | 1196 | static void ipoib_neigh_hash_uninit(struct net_device *dev) |
@@ -1203,7 +1199,7 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev) | |||
1203 | int stopped; | 1199 | int stopped; |
1204 | 1200 | ||
1205 | ipoib_dbg(priv, "ipoib_neigh_hash_uninit\n"); | 1201 | ipoib_dbg(priv, "ipoib_neigh_hash_uninit\n"); |
1206 | init_completion(&priv->ntbl.flushed); | 1202 | init_completion(&priv->ntbl.deleted); |
1207 | set_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); | 1203 | set_bit(IPOIB_NEIGH_TBL_FLUSH, &priv->flags); |
1208 | 1204 | ||
1209 | /* Stop GC if called at init fail need to cancel work */ | 1205 | /* Stop GC if called at init fail need to cancel work */ |
@@ -1211,10 +1207,9 @@ static void ipoib_neigh_hash_uninit(struct net_device *dev) | |||
1211 | if (!stopped) | 1207 | if (!stopped) |
1212 | cancel_delayed_work(&priv->neigh_reap_task); | 1208 | cancel_delayed_work(&priv->neigh_reap_task); |
1213 | 1209 | ||
1214 | if (atomic_read(&priv->ntbl.entries)) { | 1210 | ipoib_flush_neighs(priv); |
1215 | ipoib_flush_neighs(priv); | 1211 | |
1216 | wait_for_completion(&priv->ntbl.flushed); | 1212 | wait_for_completion(&priv->ntbl.deleted); |
1217 | } | ||
1218 | } | 1213 | } |
1219 | 1214 | ||
1220 | 1215 | ||
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/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/raid5.c b/drivers/md/raid5.c index adda94df5eb2..7031b865b3a0 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)) |
@@ -4192,7 +4196,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4192 | finish_wait(&conf->wait_for_overlap, &w); | 4196 | finish_wait(&conf->wait_for_overlap, &w); |
4193 | set_bit(STRIPE_HANDLE, &sh->state); | 4197 | set_bit(STRIPE_HANDLE, &sh->state); |
4194 | clear_bit(STRIPE_DELAYED, &sh->state); | 4198 | clear_bit(STRIPE_DELAYED, &sh->state); |
4195 | if ((bi->bi_rw & REQ_NOIDLE) && | 4199 | if ((bi->bi_rw & REQ_SYNC) && |
4196 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | 4200 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) |
4197 | atomic_inc(&conf->preread_active_stripes); | 4201 | atomic_inc(&conf->preread_active_stripes); |
4198 | release_stripe_plug(mddev, sh); | 4202 | release_stripe_plug(mddev, sh); |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index ad3fcea1269e..bb4c2bf04d09 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -41,91 +41,13 @@ | |||
41 | #include <linux/gpio.h> | 41 | #include <linux/gpio.h> |
42 | #include <linux/regulator/consumer.h> | 42 | #include <linux/regulator/consumer.h> |
43 | #include <linux/module.h> | 43 | #include <linux/module.h> |
44 | #include <linux/fsl/mxs-dma.h> | ||
45 | #include <linux/pinctrl/consumer.h> | 44 | #include <linux/pinctrl/consumer.h> |
46 | #include <linux/stmp_device.h> | 45 | #include <linux/stmp_device.h> |
47 | #include <linux/mmc/mxs-mmc.h> | 46 | #include <linux/mmc/mxs-mmc.h> |
47 | #include <linux/spi/mxs-spi.h> | ||
48 | 48 | ||
49 | #define DRIVER_NAME "mxs-mmc" | 49 | #define DRIVER_NAME "mxs-mmc" |
50 | 50 | ||
51 | /* card detect polling timeout */ | ||
52 | #define MXS_MMC_DETECT_TIMEOUT (HZ/2) | ||
53 | |||
54 | #define ssp_is_old(host) ((host)->devid == IMX23_MMC) | ||
55 | |||
56 | /* SSP registers */ | ||
57 | #define HW_SSP_CTRL0 0x000 | ||
58 | #define BM_SSP_CTRL0_RUN (1 << 29) | ||
59 | #define BM_SSP_CTRL0_SDIO_IRQ_CHECK (1 << 28) | ||
60 | #define BM_SSP_CTRL0_IGNORE_CRC (1 << 26) | ||
61 | #define BM_SSP_CTRL0_READ (1 << 25) | ||
62 | #define BM_SSP_CTRL0_DATA_XFER (1 << 24) | ||
63 | #define BP_SSP_CTRL0_BUS_WIDTH (22) | ||
64 | #define BM_SSP_CTRL0_BUS_WIDTH (0x3 << 22) | ||
65 | #define BM_SSP_CTRL0_WAIT_FOR_IRQ (1 << 21) | ||
66 | #define BM_SSP_CTRL0_LONG_RESP (1 << 19) | ||
67 | #define BM_SSP_CTRL0_GET_RESP (1 << 17) | ||
68 | #define BM_SSP_CTRL0_ENABLE (1 << 16) | ||
69 | #define BP_SSP_CTRL0_XFER_COUNT (0) | ||
70 | #define BM_SSP_CTRL0_XFER_COUNT (0xffff) | ||
71 | #define HW_SSP_CMD0 0x010 | ||
72 | #define BM_SSP_CMD0_DBL_DATA_RATE_EN (1 << 25) | ||
73 | #define BM_SSP_CMD0_SLOW_CLKING_EN (1 << 22) | ||
74 | #define BM_SSP_CMD0_CONT_CLKING_EN (1 << 21) | ||
75 | #define BM_SSP_CMD0_APPEND_8CYC (1 << 20) | ||
76 | #define BP_SSP_CMD0_BLOCK_SIZE (16) | ||
77 | #define BM_SSP_CMD0_BLOCK_SIZE (0xf << 16) | ||
78 | #define BP_SSP_CMD0_BLOCK_COUNT (8) | ||
79 | #define BM_SSP_CMD0_BLOCK_COUNT (0xff << 8) | ||
80 | #define BP_SSP_CMD0_CMD (0) | ||
81 | #define BM_SSP_CMD0_CMD (0xff) | ||
82 | #define HW_SSP_CMD1 0x020 | ||
83 | #define HW_SSP_XFER_SIZE 0x030 | ||
84 | #define HW_SSP_BLOCK_SIZE 0x040 | ||
85 | #define BP_SSP_BLOCK_SIZE_BLOCK_COUNT (4) | ||
86 | #define BM_SSP_BLOCK_SIZE_BLOCK_COUNT (0xffffff << 4) | ||
87 | #define BP_SSP_BLOCK_SIZE_BLOCK_SIZE (0) | ||
88 | #define BM_SSP_BLOCK_SIZE_BLOCK_SIZE (0xf) | ||
89 | #define HW_SSP_TIMING(h) (ssp_is_old(h) ? 0x050 : 0x070) | ||
90 | #define BP_SSP_TIMING_TIMEOUT (16) | ||
91 | #define BM_SSP_TIMING_TIMEOUT (0xffff << 16) | ||
92 | #define BP_SSP_TIMING_CLOCK_DIVIDE (8) | ||
93 | #define BM_SSP_TIMING_CLOCK_DIVIDE (0xff << 8) | ||
94 | #define BP_SSP_TIMING_CLOCK_RATE (0) | ||
95 | #define BM_SSP_TIMING_CLOCK_RATE (0xff) | ||
96 | #define HW_SSP_CTRL1(h) (ssp_is_old(h) ? 0x060 : 0x080) | ||
97 | #define BM_SSP_CTRL1_SDIO_IRQ (1 << 31) | ||
98 | #define BM_SSP_CTRL1_SDIO_IRQ_EN (1 << 30) | ||
99 | #define BM_SSP_CTRL1_RESP_ERR_IRQ (1 << 29) | ||
100 | #define BM_SSP_CTRL1_RESP_ERR_IRQ_EN (1 << 28) | ||
101 | #define BM_SSP_CTRL1_RESP_TIMEOUT_IRQ (1 << 27) | ||
102 | #define BM_SSP_CTRL1_RESP_TIMEOUT_IRQ_EN (1 << 26) | ||
103 | #define BM_SSP_CTRL1_DATA_TIMEOUT_IRQ (1 << 25) | ||
104 | #define BM_SSP_CTRL1_DATA_TIMEOUT_IRQ_EN (1 << 24) | ||
105 | #define BM_SSP_CTRL1_DATA_CRC_IRQ (1 << 23) | ||
106 | #define BM_SSP_CTRL1_DATA_CRC_IRQ_EN (1 << 22) | ||
107 | #define BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ (1 << 21) | ||
108 | #define BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ_EN (1 << 20) | ||
109 | #define BM_SSP_CTRL1_RECV_TIMEOUT_IRQ (1 << 17) | ||
110 | #define BM_SSP_CTRL1_RECV_TIMEOUT_IRQ_EN (1 << 16) | ||
111 | #define BM_SSP_CTRL1_FIFO_OVERRUN_IRQ (1 << 15) | ||
112 | #define BM_SSP_CTRL1_FIFO_OVERRUN_IRQ_EN (1 << 14) | ||
113 | #define BM_SSP_CTRL1_DMA_ENABLE (1 << 13) | ||
114 | #define BM_SSP_CTRL1_POLARITY (1 << 9) | ||
115 | #define BP_SSP_CTRL1_WORD_LENGTH (4) | ||
116 | #define BM_SSP_CTRL1_WORD_LENGTH (0xf << 4) | ||
117 | #define BP_SSP_CTRL1_SSP_MODE (0) | ||
118 | #define BM_SSP_CTRL1_SSP_MODE (0xf) | ||
119 | #define HW_SSP_SDRESP0(h) (ssp_is_old(h) ? 0x080 : 0x0a0) | ||
120 | #define HW_SSP_SDRESP1(h) (ssp_is_old(h) ? 0x090 : 0x0b0) | ||
121 | #define HW_SSP_SDRESP2(h) (ssp_is_old(h) ? 0x0a0 : 0x0c0) | ||
122 | #define HW_SSP_SDRESP3(h) (ssp_is_old(h) ? 0x0b0 : 0x0d0) | ||
123 | #define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100) | ||
124 | #define BM_SSP_STATUS_CARD_DETECT (1 << 28) | ||
125 | #define BM_SSP_STATUS_SDIO_IRQ (1 << 17) | ||
126 | |||
127 | #define BF_SSP(value, field) (((value) << BP_SSP_##field) & BM_SSP_##field) | ||
128 | |||
129 | #define MXS_MMC_IRQ_BITS (BM_SSP_CTRL1_SDIO_IRQ | \ | 51 | #define MXS_MMC_IRQ_BITS (BM_SSP_CTRL1_SDIO_IRQ | \ |
130 | BM_SSP_CTRL1_RESP_ERR_IRQ | \ | 52 | BM_SSP_CTRL1_RESP_ERR_IRQ | \ |
131 | BM_SSP_CTRL1_RESP_TIMEOUT_IRQ | \ | 53 | BM_SSP_CTRL1_RESP_TIMEOUT_IRQ | \ |
@@ -135,31 +57,17 @@ | |||
135 | BM_SSP_CTRL1_RECV_TIMEOUT_IRQ | \ | 57 | BM_SSP_CTRL1_RECV_TIMEOUT_IRQ | \ |
136 | BM_SSP_CTRL1_FIFO_OVERRUN_IRQ) | 58 | BM_SSP_CTRL1_FIFO_OVERRUN_IRQ) |
137 | 59 | ||
138 | #define SSP_PIO_NUM 3 | 60 | /* card detect polling timeout */ |
139 | 61 | #define MXS_MMC_DETECT_TIMEOUT (HZ/2) | |
140 | enum mxs_mmc_id { | ||
141 | IMX23_MMC, | ||
142 | IMX28_MMC, | ||
143 | }; | ||
144 | 62 | ||
145 | struct mxs_mmc_host { | 63 | struct mxs_mmc_host { |
64 | struct mxs_ssp ssp; | ||
65 | |||
146 | struct mmc_host *mmc; | 66 | struct mmc_host *mmc; |
147 | struct mmc_request *mrq; | 67 | struct mmc_request *mrq; |
148 | struct mmc_command *cmd; | 68 | struct mmc_command *cmd; |
149 | struct mmc_data *data; | 69 | struct mmc_data *data; |
150 | 70 | ||
151 | void __iomem *base; | ||
152 | int dma_channel; | ||
153 | struct clk *clk; | ||
154 | unsigned int clk_rate; | ||
155 | |||
156 | struct dma_chan *dmach; | ||
157 | struct mxs_dma_data dma_data; | ||
158 | unsigned int dma_dir; | ||
159 | enum dma_transfer_direction slave_dirn; | ||
160 | u32 ssp_pio_words[SSP_PIO_NUM]; | ||
161 | |||
162 | enum mxs_mmc_id devid; | ||
163 | unsigned char bus_width; | 71 | unsigned char bus_width; |
164 | spinlock_t lock; | 72 | spinlock_t lock; |
165 | int sdio_irq_en; | 73 | int sdio_irq_en; |
@@ -186,16 +94,18 @@ static int mxs_mmc_get_ro(struct mmc_host *mmc) | |||
186 | static int mxs_mmc_get_cd(struct mmc_host *mmc) | 94 | static int mxs_mmc_get_cd(struct mmc_host *mmc) |
187 | { | 95 | { |
188 | struct mxs_mmc_host *host = mmc_priv(mmc); | 96 | struct mxs_mmc_host *host = mmc_priv(mmc); |
97 | struct mxs_ssp *ssp = &host->ssp; | ||
189 | 98 | ||
190 | return !(readl(host->base + HW_SSP_STATUS(host)) & | 99 | return !(readl(ssp->base + HW_SSP_STATUS(ssp)) & |
191 | BM_SSP_STATUS_CARD_DETECT); | 100 | BM_SSP_STATUS_CARD_DETECT); |
192 | } | 101 | } |
193 | 102 | ||
194 | static void mxs_mmc_reset(struct mxs_mmc_host *host) | 103 | static void mxs_mmc_reset(struct mxs_mmc_host *host) |
195 | { | 104 | { |
105 | struct mxs_ssp *ssp = &host->ssp; | ||
196 | u32 ctrl0, ctrl1; | 106 | u32 ctrl0, ctrl1; |
197 | 107 | ||
198 | stmp_reset_block(host->base); | 108 | stmp_reset_block(ssp->base); |
199 | 109 | ||
200 | ctrl0 = BM_SSP_CTRL0_IGNORE_CRC; | 110 | ctrl0 = BM_SSP_CTRL0_IGNORE_CRC; |
201 | ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) | | 111 | ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) | |
@@ -211,15 +121,15 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host) | |||
211 | writel(BF_SSP(0xffff, TIMING_TIMEOUT) | | 121 | writel(BF_SSP(0xffff, TIMING_TIMEOUT) | |
212 | BF_SSP(2, TIMING_CLOCK_DIVIDE) | | 122 | BF_SSP(2, TIMING_CLOCK_DIVIDE) | |
213 | BF_SSP(0, TIMING_CLOCK_RATE), | 123 | BF_SSP(0, TIMING_CLOCK_RATE), |
214 | host->base + HW_SSP_TIMING(host)); | 124 | ssp->base + HW_SSP_TIMING(ssp)); |
215 | 125 | ||
216 | if (host->sdio_irq_en) { | 126 | if (host->sdio_irq_en) { |
217 | ctrl0 |= BM_SSP_CTRL0_SDIO_IRQ_CHECK; | 127 | ctrl0 |= BM_SSP_CTRL0_SDIO_IRQ_CHECK; |
218 | ctrl1 |= BM_SSP_CTRL1_SDIO_IRQ_EN; | 128 | ctrl1 |= BM_SSP_CTRL1_SDIO_IRQ_EN; |
219 | } | 129 | } |
220 | 130 | ||
221 | writel(ctrl0, host->base + HW_SSP_CTRL0); | 131 | writel(ctrl0, ssp->base + HW_SSP_CTRL0); |
222 | writel(ctrl1, host->base + HW_SSP_CTRL1(host)); | 132 | writel(ctrl1, ssp->base + HW_SSP_CTRL1(ssp)); |
223 | } | 133 | } |
224 | 134 | ||
225 | static void mxs_mmc_start_cmd(struct mxs_mmc_host *host, | 135 | static void mxs_mmc_start_cmd(struct mxs_mmc_host *host, |
@@ -230,21 +140,22 @@ static void mxs_mmc_request_done(struct mxs_mmc_host *host) | |||
230 | struct mmc_command *cmd = host->cmd; | 140 | struct mmc_command *cmd = host->cmd; |
231 | struct mmc_data *data = host->data; | 141 | struct mmc_data *data = host->data; |
232 | struct mmc_request *mrq = host->mrq; | 142 | struct mmc_request *mrq = host->mrq; |
143 | struct mxs_ssp *ssp = &host->ssp; | ||
233 | 144 | ||
234 | if (mmc_resp_type(cmd) & MMC_RSP_PRESENT) { | 145 | if (mmc_resp_type(cmd) & MMC_RSP_PRESENT) { |
235 | if (mmc_resp_type(cmd) & MMC_RSP_136) { | 146 | if (mmc_resp_type(cmd) & MMC_RSP_136) { |
236 | cmd->resp[3] = readl(host->base + HW_SSP_SDRESP0(host)); | 147 | cmd->resp[3] = readl(ssp->base + HW_SSP_SDRESP0(ssp)); |
237 | cmd->resp[2] = readl(host->base + HW_SSP_SDRESP1(host)); | 148 | cmd->resp[2] = readl(ssp->base + HW_SSP_SDRESP1(ssp)); |
238 | cmd->resp[1] = readl(host->base + HW_SSP_SDRESP2(host)); | 149 | cmd->resp[1] = readl(ssp->base + HW_SSP_SDRESP2(ssp)); |
239 | cmd->resp[0] = readl(host->base + HW_SSP_SDRESP3(host)); | 150 | cmd->resp[0] = readl(ssp->base + HW_SSP_SDRESP3(ssp)); |
240 | } else { | 151 | } else { |
241 | cmd->resp[0] = readl(host->base + HW_SSP_SDRESP0(host)); | 152 | cmd->resp[0] = readl(ssp->base + HW_SSP_SDRESP0(ssp)); |
242 | } | 153 | } |
243 | } | 154 | } |
244 | 155 | ||
245 | if (data) { | 156 | if (data) { |
246 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, | 157 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, |
247 | data->sg_len, host->dma_dir); | 158 | data->sg_len, ssp->dma_dir); |
248 | /* | 159 | /* |
249 | * If there was an error on any block, we mark all | 160 | * If there was an error on any block, we mark all |
250 | * data blocks as being in error. | 161 | * data blocks as being in error. |
@@ -277,13 +188,14 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void *dev_id) | |||
277 | struct mxs_mmc_host *host = dev_id; | 188 | struct mxs_mmc_host *host = dev_id; |
278 | struct mmc_command *cmd = host->cmd; | 189 | struct mmc_command *cmd = host->cmd; |
279 | struct mmc_data *data = host->data; | 190 | struct mmc_data *data = host->data; |
191 | struct mxs_ssp *ssp = &host->ssp; | ||
280 | u32 stat; | 192 | u32 stat; |
281 | 193 | ||
282 | spin_lock(&host->lock); | 194 | spin_lock(&host->lock); |
283 | 195 | ||
284 | stat = readl(host->base + HW_SSP_CTRL1(host)); | 196 | stat = readl(ssp->base + HW_SSP_CTRL1(ssp)); |
285 | writel(stat & MXS_MMC_IRQ_BITS, | 197 | writel(stat & MXS_MMC_IRQ_BITS, |
286 | host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_CLR); | 198 | ssp->base + HW_SSP_CTRL1(ssp) + STMP_OFFSET_REG_CLR); |
287 | 199 | ||
288 | spin_unlock(&host->lock); | 200 | spin_unlock(&host->lock); |
289 | 201 | ||
@@ -312,6 +224,7 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void *dev_id) | |||
312 | static struct dma_async_tx_descriptor *mxs_mmc_prep_dma( | 224 | static struct dma_async_tx_descriptor *mxs_mmc_prep_dma( |
313 | struct mxs_mmc_host *host, unsigned long flags) | 225 | struct mxs_mmc_host *host, unsigned long flags) |
314 | { | 226 | { |
227 | struct mxs_ssp *ssp = &host->ssp; | ||
315 | struct dma_async_tx_descriptor *desc; | 228 | struct dma_async_tx_descriptor *desc; |
316 | struct mmc_data *data = host->data; | 229 | struct mmc_data *data = host->data; |
317 | struct scatterlist * sgl; | 230 | struct scatterlist * sgl; |
@@ -320,24 +233,24 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma( | |||
320 | if (data) { | 233 | if (data) { |
321 | /* data */ | 234 | /* data */ |
322 | dma_map_sg(mmc_dev(host->mmc), data->sg, | 235 | dma_map_sg(mmc_dev(host->mmc), data->sg, |
323 | data->sg_len, host->dma_dir); | 236 | data->sg_len, ssp->dma_dir); |
324 | sgl = data->sg; | 237 | sgl = data->sg; |
325 | sg_len = data->sg_len; | 238 | sg_len = data->sg_len; |
326 | } else { | 239 | } else { |
327 | /* pio */ | 240 | /* pio */ |
328 | sgl = (struct scatterlist *) host->ssp_pio_words; | 241 | sgl = (struct scatterlist *) ssp->ssp_pio_words; |
329 | sg_len = SSP_PIO_NUM; | 242 | sg_len = SSP_PIO_NUM; |
330 | } | 243 | } |
331 | 244 | ||
332 | desc = dmaengine_prep_slave_sg(host->dmach, | 245 | desc = dmaengine_prep_slave_sg(ssp->dmach, |
333 | sgl, sg_len, host->slave_dirn, flags); | 246 | sgl, sg_len, ssp->slave_dirn, flags); |
334 | if (desc) { | 247 | if (desc) { |
335 | desc->callback = mxs_mmc_dma_irq_callback; | 248 | desc->callback = mxs_mmc_dma_irq_callback; |
336 | desc->callback_param = host; | 249 | desc->callback_param = host; |
337 | } else { | 250 | } else { |
338 | if (data) | 251 | if (data) |
339 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, | 252 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, |
340 | data->sg_len, host->dma_dir); | 253 | data->sg_len, ssp->dma_dir); |
341 | } | 254 | } |
342 | 255 | ||
343 | return desc; | 256 | return desc; |
@@ -345,6 +258,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma( | |||
345 | 258 | ||
346 | static void mxs_mmc_bc(struct mxs_mmc_host *host) | 259 | static void mxs_mmc_bc(struct mxs_mmc_host *host) |
347 | { | 260 | { |
261 | struct mxs_ssp *ssp = &host->ssp; | ||
348 | struct mmc_command *cmd = host->cmd; | 262 | struct mmc_command *cmd = host->cmd; |
349 | struct dma_async_tx_descriptor *desc; | 263 | struct dma_async_tx_descriptor *desc; |
350 | u32 ctrl0, cmd0, cmd1; | 264 | u32 ctrl0, cmd0, cmd1; |
@@ -358,17 +272,17 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host) | |||
358 | cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN; | 272 | cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN; |
359 | } | 273 | } |
360 | 274 | ||
361 | host->ssp_pio_words[0] = ctrl0; | 275 | ssp->ssp_pio_words[0] = ctrl0; |
362 | host->ssp_pio_words[1] = cmd0; | 276 | ssp->ssp_pio_words[1] = cmd0; |
363 | host->ssp_pio_words[2] = cmd1; | 277 | ssp->ssp_pio_words[2] = cmd1; |
364 | host->dma_dir = DMA_NONE; | 278 | ssp->dma_dir = DMA_NONE; |
365 | host->slave_dirn = DMA_TRANS_NONE; | 279 | ssp->slave_dirn = DMA_TRANS_NONE; |
366 | desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK); | 280 | desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK); |
367 | if (!desc) | 281 | if (!desc) |
368 | goto out; | 282 | goto out; |
369 | 283 | ||
370 | dmaengine_submit(desc); | 284 | dmaengine_submit(desc); |
371 | dma_async_issue_pending(host->dmach); | 285 | dma_async_issue_pending(ssp->dmach); |
372 | return; | 286 | return; |
373 | 287 | ||
374 | out: | 288 | out: |
@@ -378,6 +292,7 @@ out: | |||
378 | 292 | ||
379 | static void mxs_mmc_ac(struct mxs_mmc_host *host) | 293 | static void mxs_mmc_ac(struct mxs_mmc_host *host) |
380 | { | 294 | { |
295 | struct mxs_ssp *ssp = &host->ssp; | ||
381 | struct mmc_command *cmd = host->cmd; | 296 | struct mmc_command *cmd = host->cmd; |
382 | struct dma_async_tx_descriptor *desc; | 297 | struct dma_async_tx_descriptor *desc; |
383 | u32 ignore_crc, get_resp, long_resp; | 298 | u32 ignore_crc, get_resp, long_resp; |
@@ -399,17 +314,17 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host) | |||
399 | cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN; | 314 | cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN; |
400 | } | 315 | } |
401 | 316 | ||
402 | host->ssp_pio_words[0] = ctrl0; | 317 | ssp->ssp_pio_words[0] = ctrl0; |
403 | host->ssp_pio_words[1] = cmd0; | 318 | ssp->ssp_pio_words[1] = cmd0; |
404 | host->ssp_pio_words[2] = cmd1; | 319 | ssp->ssp_pio_words[2] = cmd1; |
405 | host->dma_dir = DMA_NONE; | 320 | ssp->dma_dir = DMA_NONE; |
406 | host->slave_dirn = DMA_TRANS_NONE; | 321 | ssp->slave_dirn = DMA_TRANS_NONE; |
407 | desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK); | 322 | desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK); |
408 | if (!desc) | 323 | if (!desc) |
409 | goto out; | 324 | goto out; |
410 | 325 | ||
411 | dmaengine_submit(desc); | 326 | dmaengine_submit(desc); |
412 | dma_async_issue_pending(host->dmach); | 327 | dma_async_issue_pending(ssp->dmach); |
413 | return; | 328 | return; |
414 | 329 | ||
415 | out: | 330 | out: |
@@ -447,6 +362,8 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
447 | unsigned int data_size = 0, log2_blksz; | 362 | unsigned int data_size = 0, log2_blksz; |
448 | unsigned int blocks = data->blocks; | 363 | unsigned int blocks = data->blocks; |
449 | 364 | ||
365 | struct mxs_ssp *ssp = &host->ssp; | ||
366 | |||
450 | u32 ignore_crc, get_resp, long_resp, read; | 367 | u32 ignore_crc, get_resp, long_resp, read; |
451 | u32 ctrl0, cmd0, cmd1, val; | 368 | u32 ctrl0, cmd0, cmd1, val; |
452 | 369 | ||
@@ -489,15 +406,15 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
489 | blocks = 1; | 406 | blocks = 1; |
490 | 407 | ||
491 | /* xfer count, block size and count need to be set differently */ | 408 | /* xfer count, block size and count need to be set differently */ |
492 | if (ssp_is_old(host)) { | 409 | if (ssp_is_old(ssp)) { |
493 | ctrl0 |= BF_SSP(data_size, CTRL0_XFER_COUNT); | 410 | ctrl0 |= BF_SSP(data_size, CTRL0_XFER_COUNT); |
494 | cmd0 |= BF_SSP(log2_blksz, CMD0_BLOCK_SIZE) | | 411 | cmd0 |= BF_SSP(log2_blksz, CMD0_BLOCK_SIZE) | |
495 | BF_SSP(blocks - 1, CMD0_BLOCK_COUNT); | 412 | BF_SSP(blocks - 1, CMD0_BLOCK_COUNT); |
496 | } else { | 413 | } else { |
497 | writel(data_size, host->base + HW_SSP_XFER_SIZE); | 414 | writel(data_size, ssp->base + HW_SSP_XFER_SIZE); |
498 | writel(BF_SSP(log2_blksz, BLOCK_SIZE_BLOCK_SIZE) | | 415 | writel(BF_SSP(log2_blksz, BLOCK_SIZE_BLOCK_SIZE) | |
499 | BF_SSP(blocks - 1, BLOCK_SIZE_BLOCK_COUNT), | 416 | BF_SSP(blocks - 1, BLOCK_SIZE_BLOCK_COUNT), |
500 | host->base + HW_SSP_BLOCK_SIZE); | 417 | ssp->base + HW_SSP_BLOCK_SIZE); |
501 | } | 418 | } |
502 | 419 | ||
503 | if ((cmd->opcode == MMC_STOP_TRANSMISSION) || | 420 | if ((cmd->opcode == MMC_STOP_TRANSMISSION) || |
@@ -512,18 +429,18 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
512 | } | 429 | } |
513 | 430 | ||
514 | /* set the timeout count */ | 431 | /* set the timeout count */ |
515 | timeout = mxs_ns_to_ssp_ticks(host->clk_rate, data->timeout_ns); | 432 | timeout = mxs_ns_to_ssp_ticks(ssp->clk_rate, data->timeout_ns); |
516 | val = readl(host->base + HW_SSP_TIMING(host)); | 433 | val = readl(ssp->base + HW_SSP_TIMING(ssp)); |
517 | val &= ~(BM_SSP_TIMING_TIMEOUT); | 434 | val &= ~(BM_SSP_TIMING_TIMEOUT); |
518 | val |= BF_SSP(timeout, TIMING_TIMEOUT); | 435 | val |= BF_SSP(timeout, TIMING_TIMEOUT); |
519 | writel(val, host->base + HW_SSP_TIMING(host)); | 436 | writel(val, ssp->base + HW_SSP_TIMING(ssp)); |
520 | 437 | ||
521 | /* pio */ | 438 | /* pio */ |
522 | host->ssp_pio_words[0] = ctrl0; | 439 | ssp->ssp_pio_words[0] = ctrl0; |
523 | host->ssp_pio_words[1] = cmd0; | 440 | ssp->ssp_pio_words[1] = cmd0; |
524 | host->ssp_pio_words[2] = cmd1; | 441 | ssp->ssp_pio_words[2] = cmd1; |
525 | host->dma_dir = DMA_NONE; | 442 | ssp->dma_dir = DMA_NONE; |
526 | host->slave_dirn = DMA_TRANS_NONE; | 443 | ssp->slave_dirn = DMA_TRANS_NONE; |
527 | desc = mxs_mmc_prep_dma(host, 0); | 444 | desc = mxs_mmc_prep_dma(host, 0); |
528 | if (!desc) | 445 | if (!desc) |
529 | goto out; | 446 | goto out; |
@@ -531,14 +448,14 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
531 | /* append data sg */ | 448 | /* append data sg */ |
532 | WARN_ON(host->data != NULL); | 449 | WARN_ON(host->data != NULL); |
533 | host->data = data; | 450 | host->data = data; |
534 | host->dma_dir = dma_data_dir; | 451 | ssp->dma_dir = dma_data_dir; |
535 | host->slave_dirn = slave_dirn; | 452 | ssp->slave_dirn = slave_dirn; |
536 | desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 453 | desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
537 | if (!desc) | 454 | if (!desc) |
538 | goto out; | 455 | goto out; |
539 | 456 | ||
540 | dmaengine_submit(desc); | 457 | dmaengine_submit(desc); |
541 | dma_async_issue_pending(host->dmach); | 458 | dma_async_issue_pending(ssp->dmach); |
542 | return; | 459 | return; |
543 | out: | 460 | out: |
544 | dev_warn(mmc_dev(host->mmc), | 461 | dev_warn(mmc_dev(host->mmc), |
@@ -579,42 +496,6 @@ static void mxs_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
579 | mxs_mmc_start_cmd(host, mrq->cmd); | 496 | mxs_mmc_start_cmd(host, mrq->cmd); |
580 | } | 497 | } |
581 | 498 | ||
582 | static void mxs_mmc_set_clk_rate(struct mxs_mmc_host *host, unsigned int rate) | ||
583 | { | ||
584 | unsigned int ssp_clk, ssp_sck; | ||
585 | u32 clock_divide, clock_rate; | ||
586 | u32 val; | ||
587 | |||
588 | ssp_clk = clk_get_rate(host->clk); | ||
589 | |||
590 | for (clock_divide = 2; clock_divide <= 254; clock_divide += 2) { | ||
591 | clock_rate = DIV_ROUND_UP(ssp_clk, rate * clock_divide); | ||
592 | clock_rate = (clock_rate > 0) ? clock_rate - 1 : 0; | ||
593 | if (clock_rate <= 255) | ||
594 | break; | ||
595 | } | ||
596 | |||
597 | if (clock_divide > 254) { | ||
598 | dev_err(mmc_dev(host->mmc), | ||
599 | "%s: cannot set clock to %d\n", __func__, rate); | ||
600 | return; | ||
601 | } | ||
602 | |||
603 | ssp_sck = ssp_clk / clock_divide / (1 + clock_rate); | ||
604 | |||
605 | val = readl(host->base + HW_SSP_TIMING(host)); | ||
606 | val &= ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE); | ||
607 | val |= BF_SSP(clock_divide, TIMING_CLOCK_DIVIDE); | ||
608 | val |= BF_SSP(clock_rate, TIMING_CLOCK_RATE); | ||
609 | writel(val, host->base + HW_SSP_TIMING(host)); | ||
610 | |||
611 | host->clk_rate = ssp_sck; | ||
612 | |||
613 | dev_dbg(mmc_dev(host->mmc), | ||
614 | "%s: clock_divide %d, clock_rate %d, ssp_clk %d, rate_actual %d, rate_requested %d\n", | ||
615 | __func__, clock_divide, clock_rate, ssp_clk, ssp_sck, rate); | ||
616 | } | ||
617 | |||
618 | static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | 499 | static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
619 | { | 500 | { |
620 | struct mxs_mmc_host *host = mmc_priv(mmc); | 501 | struct mxs_mmc_host *host = mmc_priv(mmc); |
@@ -627,12 +508,13 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
627 | host->bus_width = 0; | 508 | host->bus_width = 0; |
628 | 509 | ||
629 | if (ios->clock) | 510 | if (ios->clock) |
630 | mxs_mmc_set_clk_rate(host, ios->clock); | 511 | mxs_ssp_set_clk_rate(&host->ssp, ios->clock); |
631 | } | 512 | } |
632 | 513 | ||
633 | static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) | 514 | static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) |
634 | { | 515 | { |
635 | struct mxs_mmc_host *host = mmc_priv(mmc); | 516 | struct mxs_mmc_host *host = mmc_priv(mmc); |
517 | struct mxs_ssp *ssp = &host->ssp; | ||
636 | unsigned long flags; | 518 | unsigned long flags; |
637 | 519 | ||
638 | spin_lock_irqsave(&host->lock, flags); | 520 | spin_lock_irqsave(&host->lock, flags); |
@@ -641,19 +523,19 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) | |||
641 | 523 | ||
642 | if (enable) { | 524 | if (enable) { |
643 | writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, | 525 | writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, |
644 | host->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | 526 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); |
645 | writel(BM_SSP_CTRL1_SDIO_IRQ_EN, | 527 | writel(BM_SSP_CTRL1_SDIO_IRQ_EN, |
646 | host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_SET); | 528 | host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_SET); |
647 | } else { | 529 | } else { |
648 | writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, | 530 | writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, |
649 | host->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); | 531 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); |
650 | writel(BM_SSP_CTRL1_SDIO_IRQ_EN, | 532 | writel(BM_SSP_CTRL1_SDIO_IRQ_EN, |
651 | host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_CLR); | 533 | ssp->base + HW_SSP_CTRL1(ssp) + STMP_OFFSET_REG_CLR); |
652 | } | 534 | } |
653 | 535 | ||
654 | spin_unlock_irqrestore(&host->lock, flags); | 536 | spin_unlock_irqrestore(&host->lock, flags); |
655 | 537 | ||
656 | if (enable && readl(host->base + HW_SSP_STATUS(host)) & | 538 | if (enable && readl(ssp->base + HW_SSP_STATUS(ssp)) & |
657 | BM_SSP_STATUS_SDIO_IRQ) | 539 | BM_SSP_STATUS_SDIO_IRQ) |
658 | mmc_signal_sdio_irq(host->mmc); | 540 | mmc_signal_sdio_irq(host->mmc); |
659 | 541 | ||
@@ -670,34 +552,35 @@ static const struct mmc_host_ops mxs_mmc_ops = { | |||
670 | static bool mxs_mmc_dma_filter(struct dma_chan *chan, void *param) | 552 | static bool mxs_mmc_dma_filter(struct dma_chan *chan, void *param) |
671 | { | 553 | { |
672 | struct mxs_mmc_host *host = param; | 554 | struct mxs_mmc_host *host = param; |
555 | struct mxs_ssp *ssp = &host->ssp; | ||
673 | 556 | ||
674 | if (!mxs_dma_is_apbh(chan)) | 557 | if (!mxs_dma_is_apbh(chan)) |
675 | return false; | 558 | return false; |
676 | 559 | ||
677 | if (chan->chan_id != host->dma_channel) | 560 | if (chan->chan_id != ssp->dma_channel) |
678 | return false; | 561 | return false; |
679 | 562 | ||
680 | chan->private = &host->dma_data; | 563 | chan->private = &ssp->dma_data; |
681 | 564 | ||
682 | return true; | 565 | return true; |
683 | } | 566 | } |
684 | 567 | ||
685 | static struct platform_device_id mxs_mmc_ids[] = { | 568 | static struct platform_device_id mxs_ssp_ids[] = { |
686 | { | 569 | { |
687 | .name = "imx23-mmc", | 570 | .name = "imx23-mmc", |
688 | .driver_data = IMX23_MMC, | 571 | .driver_data = IMX23_SSP, |
689 | }, { | 572 | }, { |
690 | .name = "imx28-mmc", | 573 | .name = "imx28-mmc", |
691 | .driver_data = IMX28_MMC, | 574 | .driver_data = IMX28_SSP, |
692 | }, { | 575 | }, { |
693 | /* sentinel */ | 576 | /* sentinel */ |
694 | } | 577 | } |
695 | }; | 578 | }; |
696 | MODULE_DEVICE_TABLE(platform, mxs_mmc_ids); | 579 | MODULE_DEVICE_TABLE(platform, mxs_ssp_ids); |
697 | 580 | ||
698 | static const struct of_device_id mxs_mmc_dt_ids[] = { | 581 | static const struct of_device_id mxs_mmc_dt_ids[] = { |
699 | { .compatible = "fsl,imx23-mmc", .data = (void *) IMX23_MMC, }, | 582 | { .compatible = "fsl,imx23-mmc", .data = (void *) IMX23_SSP, }, |
700 | { .compatible = "fsl,imx28-mmc", .data = (void *) IMX28_MMC, }, | 583 | { .compatible = "fsl,imx28-mmc", .data = (void *) IMX28_SSP, }, |
701 | { /* sentinel */ } | 584 | { /* sentinel */ } |
702 | }; | 585 | }; |
703 | MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids); | 586 | MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids); |
@@ -716,6 +599,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
716 | dma_cap_mask_t mask; | 599 | dma_cap_mask_t mask; |
717 | struct regulator *reg_vmmc; | 600 | struct regulator *reg_vmmc; |
718 | enum of_gpio_flags flags; | 601 | enum of_gpio_flags flags; |
602 | struct mxs_ssp *ssp; | ||
719 | 603 | ||
720 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 604 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
721 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 605 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
@@ -729,28 +613,30 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
729 | return -ENOMEM; | 613 | return -ENOMEM; |
730 | 614 | ||
731 | host = mmc_priv(mmc); | 615 | host = mmc_priv(mmc); |
732 | host->base = devm_request_and_ioremap(&pdev->dev, iores); | 616 | ssp = &host->ssp; |
733 | if (!host->base) { | 617 | ssp->dev = &pdev->dev; |
618 | ssp->base = devm_request_and_ioremap(&pdev->dev, iores); | ||
619 | if (!ssp->base) { | ||
734 | ret = -EADDRNOTAVAIL; | 620 | ret = -EADDRNOTAVAIL; |
735 | goto out_mmc_free; | 621 | goto out_mmc_free; |
736 | } | 622 | } |
737 | 623 | ||
738 | if (np) { | 624 | if (np) { |
739 | host->devid = (enum mxs_mmc_id) of_id->data; | 625 | ssp->devid = (enum mxs_ssp_id) of_id->data; |
740 | /* | 626 | /* |
741 | * TODO: This is a temporary solution and should be changed | 627 | * TODO: This is a temporary solution and should be changed |
742 | * to use generic DMA binding later when the helpers get in. | 628 | * to use generic DMA binding later when the helpers get in. |
743 | */ | 629 | */ |
744 | ret = of_property_read_u32(np, "fsl,ssp-dma-channel", | 630 | ret = of_property_read_u32(np, "fsl,ssp-dma-channel", |
745 | &host->dma_channel); | 631 | &ssp->dma_channel); |
746 | if (ret) { | 632 | if (ret) { |
747 | dev_err(mmc_dev(host->mmc), | 633 | dev_err(mmc_dev(host->mmc), |
748 | "failed to get dma channel\n"); | 634 | "failed to get dma channel\n"); |
749 | goto out_mmc_free; | 635 | goto out_mmc_free; |
750 | } | 636 | } |
751 | } else { | 637 | } else { |
752 | host->devid = pdev->id_entry->driver_data; | 638 | ssp->devid = pdev->id_entry->driver_data; |
753 | host->dma_channel = dmares->start; | 639 | ssp->dma_channel = dmares->start; |
754 | } | 640 | } |
755 | 641 | ||
756 | host->mmc = mmc; | 642 | host->mmc = mmc; |
@@ -772,20 +658,20 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
772 | goto out_mmc_free; | 658 | goto out_mmc_free; |
773 | } | 659 | } |
774 | 660 | ||
775 | host->clk = clk_get(&pdev->dev, NULL); | 661 | ssp->clk = clk_get(&pdev->dev, NULL); |
776 | if (IS_ERR(host->clk)) { | 662 | if (IS_ERR(ssp->clk)) { |
777 | ret = PTR_ERR(host->clk); | 663 | ret = PTR_ERR(ssp->clk); |
778 | goto out_mmc_free; | 664 | goto out_mmc_free; |
779 | } | 665 | } |
780 | clk_prepare_enable(host->clk); | 666 | clk_prepare_enable(ssp->clk); |
781 | 667 | ||
782 | mxs_mmc_reset(host); | 668 | mxs_mmc_reset(host); |
783 | 669 | ||
784 | dma_cap_zero(mask); | 670 | dma_cap_zero(mask); |
785 | dma_cap_set(DMA_SLAVE, mask); | 671 | dma_cap_set(DMA_SLAVE, mask); |
786 | host->dma_data.chan_irq = irq_dma; | 672 | ssp->dma_data.chan_irq = irq_dma; |
787 | host->dmach = dma_request_channel(mask, mxs_mmc_dma_filter, host); | 673 | ssp->dmach = dma_request_channel(mask, mxs_mmc_dma_filter, host); |
788 | if (!host->dmach) { | 674 | if (!ssp->dmach) { |
789 | dev_err(mmc_dev(host->mmc), | 675 | dev_err(mmc_dev(host->mmc), |
790 | "%s: failed to request dma\n", __func__); | 676 | "%s: failed to request dma\n", __func__); |
791 | goto out_clk_put; | 677 | goto out_clk_put; |
@@ -822,9 +708,9 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
822 | 708 | ||
823 | mmc->max_segs = 52; | 709 | mmc->max_segs = 52; |
824 | mmc->max_blk_size = 1 << 0xf; | 710 | mmc->max_blk_size = 1 << 0xf; |
825 | mmc->max_blk_count = (ssp_is_old(host)) ? 0xff : 0xffffff; | 711 | mmc->max_blk_count = (ssp_is_old(ssp)) ? 0xff : 0xffffff; |
826 | mmc->max_req_size = (ssp_is_old(host)) ? 0xffff : 0xffffffff; | 712 | mmc->max_req_size = (ssp_is_old(ssp)) ? 0xffff : 0xffffffff; |
827 | mmc->max_seg_size = dma_get_max_seg_size(host->dmach->device->dev); | 713 | mmc->max_seg_size = dma_get_max_seg_size(ssp->dmach->device->dev); |
828 | 714 | ||
829 | platform_set_drvdata(pdev, mmc); | 715 | platform_set_drvdata(pdev, mmc); |
830 | 716 | ||
@@ -844,11 +730,11 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
844 | return 0; | 730 | return 0; |
845 | 731 | ||
846 | out_free_dma: | 732 | out_free_dma: |
847 | if (host->dmach) | 733 | if (ssp->dmach) |
848 | dma_release_channel(host->dmach); | 734 | dma_release_channel(ssp->dmach); |
849 | out_clk_put: | 735 | out_clk_put: |
850 | clk_disable_unprepare(host->clk); | 736 | clk_disable_unprepare(ssp->clk); |
851 | clk_put(host->clk); | 737 | clk_put(ssp->clk); |
852 | out_mmc_free: | 738 | out_mmc_free: |
853 | mmc_free_host(mmc); | 739 | mmc_free_host(mmc); |
854 | return ret; | 740 | return ret; |
@@ -858,16 +744,17 @@ static int mxs_mmc_remove(struct platform_device *pdev) | |||
858 | { | 744 | { |
859 | struct mmc_host *mmc = platform_get_drvdata(pdev); | 745 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
860 | struct mxs_mmc_host *host = mmc_priv(mmc); | 746 | struct mxs_mmc_host *host = mmc_priv(mmc); |
747 | struct mxs_ssp *ssp = &host->ssp; | ||
861 | 748 | ||
862 | mmc_remove_host(mmc); | 749 | mmc_remove_host(mmc); |
863 | 750 | ||
864 | platform_set_drvdata(pdev, NULL); | 751 | platform_set_drvdata(pdev, NULL); |
865 | 752 | ||
866 | if (host->dmach) | 753 | if (ssp->dmach) |
867 | dma_release_channel(host->dmach); | 754 | dma_release_channel(ssp->dmach); |
868 | 755 | ||
869 | clk_disable_unprepare(host->clk); | 756 | clk_disable_unprepare(ssp->clk); |
870 | clk_put(host->clk); | 757 | clk_put(ssp->clk); |
871 | 758 | ||
872 | mmc_free_host(mmc); | 759 | mmc_free_host(mmc); |
873 | 760 | ||
@@ -879,11 +766,12 @@ static int mxs_mmc_suspend(struct device *dev) | |||
879 | { | 766 | { |
880 | struct mmc_host *mmc = dev_get_drvdata(dev); | 767 | struct mmc_host *mmc = dev_get_drvdata(dev); |
881 | struct mxs_mmc_host *host = mmc_priv(mmc); | 768 | struct mxs_mmc_host *host = mmc_priv(mmc); |
769 | struct mxs_ssp *ssp = &host->ssp; | ||
882 | int ret = 0; | 770 | int ret = 0; |
883 | 771 | ||
884 | ret = mmc_suspend_host(mmc); | 772 | ret = mmc_suspend_host(mmc); |
885 | 773 | ||
886 | clk_disable_unprepare(host->clk); | 774 | clk_disable_unprepare(ssp->clk); |
887 | 775 | ||
888 | return ret; | 776 | return ret; |
889 | } | 777 | } |
@@ -892,9 +780,10 @@ static int mxs_mmc_resume(struct device *dev) | |||
892 | { | 780 | { |
893 | struct mmc_host *mmc = dev_get_drvdata(dev); | 781 | struct mmc_host *mmc = dev_get_drvdata(dev); |
894 | struct mxs_mmc_host *host = mmc_priv(mmc); | 782 | struct mxs_mmc_host *host = mmc_priv(mmc); |
783 | struct mxs_ssp *ssp = &host->ssp; | ||
895 | int ret = 0; | 784 | int ret = 0; |
896 | 785 | ||
897 | clk_prepare_enable(host->clk); | 786 | clk_prepare_enable(ssp->clk); |
898 | 787 | ||
899 | ret = mmc_resume_host(mmc); | 788 | ret = mmc_resume_host(mmc); |
900 | 789 | ||
@@ -910,7 +799,7 @@ static const struct dev_pm_ops mxs_mmc_pm_ops = { | |||
910 | static struct platform_driver mxs_mmc_driver = { | 799 | static struct platform_driver mxs_mmc_driver = { |
911 | .probe = mxs_mmc_probe, | 800 | .probe = mxs_mmc_probe, |
912 | .remove = mxs_mmc_remove, | 801 | .remove = mxs_mmc_remove, |
913 | .id_table = mxs_mmc_ids, | 802 | .id_table = mxs_ssp_ids, |
914 | .driver = { | 803 | .driver = { |
915 | .name = DRIVER_NAME, | 804 | .name = DRIVER_NAME, |
916 | .owner = THIS_MODULE, | 805 | .owner = THIS_MODULE, |
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/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index af20c6ee2cd9..e8e97a7d1d06 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 211753e01f81..0875ecfe3372 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -9831,12 +9831,13 @@ static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp) | |||
9831 | } | 9831 | } |
9832 | 9832 | ||
9833 | #ifdef CONFIG_PCI_MSI | 9833 | #ifdef CONFIG_PCI_MSI |
9834 | /* | 9834 | /* Due to new PF resource allocation by MFW T7.4 and above, it's |
9835 | * It's expected that number of CAM entries for this functions is equal | 9835 | * optional that number of CAM entries will not be equal to the value |
9836 | * to the number evaluated based on the MSI-X table size. We want a | 9836 | * advertised in PCI. |
9837 | * harsh warning if these values are different! | 9837 | * Driver should use the minimal value of both as the actual status |
9838 | * block count | ||
9838 | */ | 9839 | */ |
9839 | WARN_ON(bp->igu_sb_cnt != igu_sb_cnt); | 9840 | bp->igu_sb_cnt = min_t(int, bp->igu_sb_cnt, igu_sb_cnt); |
9840 | #endif | 9841 | #endif |
9841 | 9842 | ||
9842 | if (igu_sb_cnt == 0) | 9843 | 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 c08e5d40fecb..0daa66b8eca0 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 3bfbb8df8989..bde337ee1a34 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -3149,6 +3149,17 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3149 | return NETDEV_TX_OK; | 3149 | return NETDEV_TX_OK; |
3150 | } | 3150 | } |
3151 | 3151 | ||
3152 | /* On PCI/PCI-X HW, if packet size is less than ETH_ZLEN, | ||
3153 | * packets may get corrupted during padding by HW. | ||
3154 | * To WA this issue, pad all small packets manually. | ||
3155 | */ | ||
3156 | if (skb->len < ETH_ZLEN) { | ||
3157 | if (skb_pad(skb, ETH_ZLEN - skb->len)) | ||
3158 | return NETDEV_TX_OK; | ||
3159 | skb->len = ETH_ZLEN; | ||
3160 | skb_set_tail_pointer(skb, ETH_ZLEN); | ||
3161 | } | ||
3162 | |||
3152 | mss = skb_shinfo(skb)->gso_size; | 3163 | mss = skb_shinfo(skb)->gso_size; |
3153 | /* The controller does a simple calculation to | 3164 | /* The controller does a simple calculation to |
3154 | * make sure there is enough room in the FIFO before | 3165 | * 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/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/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/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 4fd48df6b989..32e31c5c5dc6 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -962,6 +962,10 @@ static const struct usb_device_id products [] = { | |||
962 | USB_DEVICE (0x2001, 0x3c05), | 962 | USB_DEVICE (0x2001, 0x3c05), |
963 | .driver_info = (unsigned long) &ax88772_info, | 963 | .driver_info = (unsigned long) &ax88772_info, |
964 | }, { | 964 | }, { |
965 | // DLink DUB-E100 H/W Ver C1 | ||
966 | USB_DEVICE (0x2001, 0x1a02), | ||
967 | .driver_info = (unsigned long) &ax88772_info, | ||
968 | }, { | ||
965 | // Linksys USB1000 | 969 | // Linksys USB1000 |
966 | USB_DEVICE (0x1737, 0x0039), | 970 | USB_DEVICE (0x1737, 0x0039), |
967 | .driver_info = (unsigned long) &ax88178_info, | 971 | .driver_info = (unsigned long) &ax88178_info, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index b1ba68f1a049..3543c9e57824 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -366,16 +366,20 @@ static const struct usb_device_id products[] = { | |||
366 | }, | 366 | }, |
367 | 367 | ||
368 | /* 2. Combined interface devices matching on class+protocol */ | 368 | /* 2. Combined interface devices matching on class+protocol */ |
369 | { /* Huawei E367 and possibly others in "Windows mode" */ | ||
370 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7), | ||
371 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
372 | }, | ||
369 | { /* Huawei E392, E398 and possibly others in "Windows mode" */ | 373 | { /* Huawei E392, E398 and possibly others in "Windows mode" */ |
370 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), | 374 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), |
371 | .driver_info = (unsigned long)&qmi_wwan_shared, | 375 | .driver_info = (unsigned long)&qmi_wwan_shared, |
372 | }, | 376 | }, |
373 | { /* Pantech UML290 */ | 377 | { /* Pantech UML290, P4200 and more */ |
374 | USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), | 378 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), |
375 | .driver_info = (unsigned long)&qmi_wwan_shared, | 379 | .driver_info = (unsigned long)&qmi_wwan_shared, |
376 | }, | 380 | }, |
377 | { /* Pantech UML290 - newer firmware */ | 381 | { /* Pantech UML290 - newer firmware */ |
378 | USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), | 382 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), |
379 | .driver_info = (unsigned long)&qmi_wwan_shared, | 383 | .driver_info = (unsigned long)&qmi_wwan_shared, |
380 | }, | 384 | }, |
381 | 385 | ||
@@ -383,6 +387,7 @@ static const struct usb_device_id products[] = { | |||
383 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ | 387 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ |
384 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ | 388 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ |
385 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ | 389 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ |
390 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ | ||
386 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ | 391 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ |
387 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ | 392 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
388 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ | 393 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 2588848f4a82..d066f2516e47 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -2982,6 +2982,10 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, | |||
2982 | case EEP_RX_MASK: | 2982 | case EEP_RX_MASK: |
2983 | return pBase->txrxMask & 0xf; | 2983 | return pBase->txrxMask & 0xf; |
2984 | case EEP_PAPRD: | 2984 | case EEP_PAPRD: |
2985 | if (AR_SREV_9462(ah)) | ||
2986 | return false; | ||
2987 | if (!ah->config.enable_paprd); | ||
2988 | return false; | ||
2985 | return !!(pBase->featureEnable & BIT(5)); | 2989 | return !!(pBase->featureEnable & BIT(5)); |
2986 | case EEP_CHAIN_MASK_REDUCE: | 2990 | case EEP_CHAIN_MASK_REDUCE: |
2987 | return (pBase->miscConfiguration >> 0x3) & 0x1; | 2991 | return (pBase->miscConfiguration >> 0x3) & 0x1; |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 68b643c8943c..c8ef30127adb 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -1577,6 +1577,8 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1577 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); | 1577 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); |
1578 | debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, | 1578 | debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, |
1579 | sc->debug.debugfs_phy, sc, &fops_disable_ani); | 1579 | sc->debug.debugfs_phy, sc, &fops_disable_ani); |
1580 | debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | ||
1581 | &sc->sc_ah->config.enable_paprd); | ||
1580 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1582 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1581 | sc, &fops_regidx); | 1583 | sc, &fops_regidx); |
1582 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1584 | 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 48af40151d23..4faf0a395876 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2497,10 +2497,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2497 | pCap->rx_status_len = sizeof(struct ar9003_rxs); | 2497 | pCap->rx_status_len = sizeof(struct ar9003_rxs); |
2498 | pCap->tx_desc_len = sizeof(struct ar9003_txc); | 2498 | pCap->tx_desc_len = sizeof(struct ar9003_txc); |
2499 | pCap->txs_len = sizeof(struct ar9003_txs); | 2499 | pCap->txs_len = sizeof(struct ar9003_txs); |
2500 | if (!ah->config.paprd_disable && | ||
2501 | ah->eep_ops->get_eeprom(ah, EEP_PAPRD) && | ||
2502 | !AR_SREV_9462(ah)) | ||
2503 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; | ||
2504 | } else { | 2500 | } else { |
2505 | pCap->tx_desc_len = sizeof(struct ath_desc); | 2501 | pCap->tx_desc_len = sizeof(struct ath_desc); |
2506 | if (AR_SREV_9280_20(ah)) | 2502 | 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 6599a75f01fe..de6968fc64f4 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -236,7 +236,6 @@ enum ath9k_hw_caps { | |||
236 | ATH9K_HW_CAP_LDPC = BIT(6), | 236 | ATH9K_HW_CAP_LDPC = BIT(6), |
237 | ATH9K_HW_CAP_FASTCLOCK = BIT(7), | 237 | ATH9K_HW_CAP_FASTCLOCK = BIT(7), |
238 | ATH9K_HW_CAP_SGI_20 = BIT(8), | 238 | ATH9K_HW_CAP_SGI_20 = BIT(8), |
239 | ATH9K_HW_CAP_PAPRD = BIT(9), | ||
240 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), | 239 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), |
241 | ATH9K_HW_CAP_2GHZ = BIT(11), | 240 | ATH9K_HW_CAP_2GHZ = BIT(11), |
242 | ATH9K_HW_CAP_5GHZ = BIT(12), | 241 | ATH9K_HW_CAP_5GHZ = BIT(12), |
@@ -287,12 +286,12 @@ struct ath9k_ops_config { | |||
287 | u8 pcie_clock_req; | 286 | u8 pcie_clock_req; |
288 | u32 pcie_waen; | 287 | u32 pcie_waen; |
289 | u8 analog_shiftreg; | 288 | u8 analog_shiftreg; |
290 | u8 paprd_disable; | ||
291 | u32 ofdm_trig_low; | 289 | u32 ofdm_trig_low; |
292 | u32 ofdm_trig_high; | 290 | u32 ofdm_trig_high; |
293 | u32 cck_trig_high; | 291 | u32 cck_trig_high; |
294 | u32 cck_trig_low; | 292 | u32 cck_trig_low; |
295 | u32 enable_ani; | 293 | u32 enable_ani; |
294 | u32 enable_paprd; | ||
296 | int serialize_regmode; | 295 | int serialize_regmode; |
297 | bool rx_intr_mitigation; | 296 | bool rx_intr_mitigation; |
298 | bool tx_intr_mitigation; | 297 | 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 49765d34b4e0..7c4ee72f9d56 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -638,6 +638,8 @@ static int brcmf_sdio_pd_probe(struct platform_device *pdev) | |||
638 | 638 | ||
639 | oobirq_entry = kzalloc(sizeof(struct brcmf_sdio_oobirq), | 639 | oobirq_entry = kzalloc(sizeof(struct brcmf_sdio_oobirq), |
640 | GFP_KERNEL); | 640 | GFP_KERNEL); |
641 | if (!oobirq_entry) | ||
642 | return -ENOMEM; | ||
641 | oobirq_entry->irq = res->start; | 643 | oobirq_entry->irq = res->start; |
642 | oobirq_entry->flags = res->flags & IRQF_TRIGGER_MASK; | 644 | oobirq_entry->flags = res->flags & IRQF_TRIGGER_MASK; |
643 | list_add_tail(&oobirq_entry->list, &oobirq_lh); | 645 | 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 2621dd3d7dcd..6f70953f0bad 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -764,8 +764,11 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode) | |||
764 | { | 764 | { |
765 | char iovbuf[32]; | 765 | char iovbuf[32]; |
766 | int retcode; | 766 | int retcode; |
767 | __le32 arp_mode_le; | ||
767 | 768 | ||
768 | brcmf_c_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); | 769 | arp_mode_le = cpu_to_le32(arp_mode); |
770 | brcmf_c_mkiovar("arp_ol", (char *)&arp_mode_le, 4, iovbuf, | ||
771 | sizeof(iovbuf)); | ||
769 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | 772 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, |
770 | iovbuf, sizeof(iovbuf)); | 773 | iovbuf, sizeof(iovbuf)); |
771 | retcode = retcode >= 0 ? 0 : retcode; | 774 | retcode = retcode >= 0 ? 0 : retcode; |
@@ -781,8 +784,11 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable) | |||
781 | { | 784 | { |
782 | char iovbuf[32]; | 785 | char iovbuf[32]; |
783 | int retcode; | 786 | int retcode; |
787 | __le32 arp_enable_le; | ||
784 | 788 | ||
785 | brcmf_c_mkiovar("arpoe", (char *)&arp_enable, 4, | 789 | arp_enable_le = cpu_to_le32(arp_enable); |
790 | |||
791 | brcmf_c_mkiovar("arpoe", (char *)&arp_enable_le, 4, | ||
786 | iovbuf, sizeof(iovbuf)); | 792 | iovbuf, sizeof(iovbuf)); |
787 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | 793 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, |
788 | iovbuf, sizeof(iovbuf)); | 794 | iovbuf, sizeof(iovbuf)); |
@@ -800,10 +806,10 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
800 | char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for | 806 | char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for |
801 | "event_msgs" + '\0' + bitvec */ | 807 | "event_msgs" + '\0' + bitvec */ |
802 | char buf[128], *ptr; | 808 | char buf[128], *ptr; |
803 | u32 roaming = 1; | 809 | __le32 roaming_le = cpu_to_le32(1); |
804 | uint bcn_timeout = 3; | 810 | __le32 bcn_timeout_le = cpu_to_le32(3); |
805 | int scan_assoc_time = 40; | 811 | __le32 scan_assoc_time_le = cpu_to_le32(40); |
806 | int scan_unassoc_time = 40; | 812 | __le32 scan_unassoc_time_le = cpu_to_le32(40); |
807 | int i; | 813 | int i; |
808 | struct brcmf_bus_dcmd *cmdlst; | 814 | struct brcmf_bus_dcmd *cmdlst; |
809 | struct list_head *cur, *q; | 815 | struct list_head *cur, *q; |
@@ -829,14 +835,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
829 | 835 | ||
830 | /* Setup timeout if Beacons are lost and roam is off to report | 836 | /* Setup timeout if Beacons are lost and roam is off to report |
831 | link down */ | 837 | link down */ |
832 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, | 838 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout_le, 4, iovbuf, |
833 | sizeof(iovbuf)); | 839 | sizeof(iovbuf)); |
834 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 840 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
835 | sizeof(iovbuf)); | 841 | sizeof(iovbuf)); |
836 | 842 | ||
837 | /* Enable/Disable build-in roaming to allowed ext supplicant to take | 843 | /* Enable/Disable build-in roaming to allowed ext supplicant to take |
838 | of romaing */ | 844 | of romaing */ |
839 | brcmf_c_mkiovar("roam_off", (char *)&roaming, 4, | 845 | brcmf_c_mkiovar("roam_off", (char *)&roaming_le, 4, |
840 | iovbuf, sizeof(iovbuf)); | 846 | iovbuf, sizeof(iovbuf)); |
841 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 847 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
842 | sizeof(iovbuf)); | 848 | sizeof(iovbuf)); |
@@ -848,9 +854,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
848 | sizeof(iovbuf)); | 854 | sizeof(iovbuf)); |
849 | 855 | ||
850 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME, | 856 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME, |
851 | (char *)&scan_assoc_time, sizeof(scan_assoc_time)); | 857 | (char *)&scan_assoc_time_le, sizeof(scan_assoc_time_le)); |
852 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME, | 858 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME, |
853 | (char *)&scan_unassoc_time, sizeof(scan_unassoc_time)); | 859 | (char *)&scan_unassoc_time_le, sizeof(scan_unassoc_time_le)); |
854 | 860 | ||
855 | /* Set and enable ARP offload feature */ | 861 | /* Set and enable ARP offload feature */ |
856 | brcmf_c_arp_offload_set(drvr, BRCMF_ARPOL_MODE); | 862 | 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 c36e92312443..50b5553b6964 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -500,8 +500,10 @@ static void wl_iscan_prep(struct brcmf_scan_params_le *params_le, | |||
500 | params_le->active_time = cpu_to_le32(-1); | 500 | params_le->active_time = cpu_to_le32(-1); |
501 | params_le->passive_time = cpu_to_le32(-1); | 501 | params_le->passive_time = cpu_to_le32(-1); |
502 | params_le->home_time = cpu_to_le32(-1); | 502 | params_le->home_time = cpu_to_le32(-1); |
503 | if (ssid && ssid->SSID_len) | 503 | if (ssid && ssid->SSID_len) { |
504 | memcpy(¶ms_le->ssid_le, ssid, sizeof(struct brcmf_ssid)); | 504 | params_le->ssid_le.SSID_len = cpu_to_le32(ssid->SSID_len); |
505 | memcpy(¶ms_le->ssid_le.SSID, ssid->SSID, ssid->SSID_len); | ||
506 | } | ||
505 | } | 507 | } |
506 | 508 | ||
507 | static s32 | 509 | 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/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 bd0da7ef290b..dd4bb0950a57 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 3aa927f8b9b9..7d8f96405f42 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/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..a3ac39b79192 100644 --- a/drivers/sh/pfc/pinctrl.c +++ b/drivers/sh/pfc/pinctrl.c | |||
@@ -211,7 +211,8 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, | |||
211 | break; | 211 | break; |
212 | default: | 212 | default: |
213 | pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type); | 213 | pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type); |
214 | return -ENOTSUPP; | 214 | ret = -ENOTSUPP; |
215 | goto err; | ||
215 | } | 216 | } |
216 | 217 | ||
217 | ret = 0; | 218 | ret = 0; |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 920bb4d22d40..63a79437aca1 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -370,6 +370,13 @@ config SPI_STMP3XXX | |||
370 | help | 370 | help |
371 | SPI driver for Freescale STMP37xx/378x SoC SSP interface | 371 | SPI driver for Freescale STMP37xx/378x SoC SSP interface |
372 | 372 | ||
373 | config SPI_MXS | ||
374 | tristate "Freescale MXS SPI controller" | ||
375 | depends on ARCH_MXS | ||
376 | select STMP_DEVICE | ||
377 | help | ||
378 | SPI driver for Freescale MXS devices. | ||
379 | |||
373 | config SPI_TEGRA | 380 | config SPI_TEGRA |
374 | tristate "Nvidia Tegra SPI controller" | 381 | tristate "Nvidia Tegra SPI controller" |
375 | depends on ARCH_TEGRA && (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA) | 382 | depends on ARCH_TEGRA && (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA) |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 7559c984db77..938705644bb6 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -36,6 +36,7 @@ obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o | |||
36 | obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o | 36 | obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o |
37 | obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o | 37 | obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o |
38 | obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o | 38 | obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o |
39 | obj-$(CONFIG_SPI_MXS) += spi-mxs.o | ||
39 | obj-$(CONFIG_SPI_NUC900) += spi-nuc900.o | 40 | obj-$(CONFIG_SPI_NUC900) += spi-nuc900.o |
40 | obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o | 41 | obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o |
41 | obj-$(CONFIG_SPI_OMAP_UWIRE) += spi-omap-uwire.o | 42 | obj-$(CONFIG_SPI_OMAP_UWIRE) += spi-omap-uwire.o |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c new file mode 100644 index 000000000000..edf1360ab09e --- /dev/null +++ b/drivers/spi/spi-mxs.c | |||
@@ -0,0 +1,674 @@ | |||
1 | /* | ||
2 | * Freescale MXS SPI master driver | ||
3 | * | ||
4 | * Copyright 2012 DENX Software Engineering, GmbH. | ||
5 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
6 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
7 | * | ||
8 | * Rework and transition to new API by: | ||
9 | * Marek Vasut <marex@denx.de> | ||
10 | * | ||
11 | * Based on previous attempt by: | ||
12 | * Fabio Estevam <fabio.estevam@freescale.com> | ||
13 | * | ||
14 | * Based on code from U-Boot bootloader by: | ||
15 | * Marek Vasut <marex@denx.de> | ||
16 | * | ||
17 | * Based on spi-stmp.c, which is: | ||
18 | * Author: Dmitry Pervushin <dimka@embeddedalley.com> | ||
19 | * | ||
20 | * This program is free software; you can redistribute it and/or modify | ||
21 | * it under the terms of the GNU General Public License as published by | ||
22 | * the Free Software Foundation; either version 2 of the License, or | ||
23 | * (at your option) any later version. | ||
24 | * | ||
25 | * This program is distributed in the hope that it will be useful, | ||
26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
28 | * GNU General Public License for more details. | ||
29 | */ | ||
30 | |||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/ioport.h> | ||
34 | #include <linux/of.h> | ||
35 | #include <linux/of_device.h> | ||
36 | #include <linux/of_gpio.h> | ||
37 | #include <linux/platform_device.h> | ||
38 | #include <linux/delay.h> | ||
39 | #include <linux/interrupt.h> | ||
40 | #include <linux/dma-mapping.h> | ||
41 | #include <linux/dmaengine.h> | ||
42 | #include <linux/highmem.h> | ||
43 | #include <linux/clk.h> | ||
44 | #include <linux/err.h> | ||
45 | #include <linux/completion.h> | ||
46 | #include <linux/gpio.h> | ||
47 | #include <linux/regulator/consumer.h> | ||
48 | #include <linux/module.h> | ||
49 | #include <linux/pinctrl/consumer.h> | ||
50 | #include <linux/stmp_device.h> | ||
51 | #include <linux/spi/spi.h> | ||
52 | #include <linux/spi/mxs-spi.h> | ||
53 | |||
54 | #define DRIVER_NAME "mxs-spi" | ||
55 | |||
56 | /* Use 10S timeout for very long transfers, it should suffice. */ | ||
57 | #define SSP_TIMEOUT 10000 | ||
58 | |||
59 | #define SG_MAXLEN 0xff00 | ||
60 | |||
61 | struct mxs_spi { | ||
62 | struct mxs_ssp ssp; | ||
63 | struct completion c; | ||
64 | }; | ||
65 | |||
66 | static int mxs_spi_setup_transfer(struct spi_device *dev, | ||
67 | struct spi_transfer *t) | ||
68 | { | ||
69 | struct mxs_spi *spi = spi_master_get_devdata(dev->master); | ||
70 | struct mxs_ssp *ssp = &spi->ssp; | ||
71 | uint8_t bits_per_word; | ||
72 | uint32_t hz = 0; | ||
73 | |||
74 | bits_per_word = dev->bits_per_word; | ||
75 | if (t && t->bits_per_word) | ||
76 | bits_per_word = t->bits_per_word; | ||
77 | |||
78 | if (bits_per_word != 8) { | ||
79 | dev_err(&dev->dev, "%s, unsupported bits_per_word=%d\n", | ||
80 | __func__, bits_per_word); | ||
81 | return -EINVAL; | ||
82 | } | ||
83 | |||
84 | hz = dev->max_speed_hz; | ||
85 | if (t && t->speed_hz) | ||
86 | hz = min(hz, t->speed_hz); | ||
87 | if (hz == 0) { | ||
88 | dev_err(&dev->dev, "Cannot continue with zero clock\n"); | ||
89 | return -EINVAL; | ||
90 | } | ||
91 | |||
92 | mxs_ssp_set_clk_rate(ssp, hz); | ||
93 | |||
94 | writel(BF_SSP_CTRL1_SSP_MODE(BV_SSP_CTRL1_SSP_MODE__SPI) | | ||
95 | BF_SSP_CTRL1_WORD_LENGTH | ||
96 | (BV_SSP_CTRL1_WORD_LENGTH__EIGHT_BITS) | | ||
97 | ((dev->mode & SPI_CPOL) ? BM_SSP_CTRL1_POLARITY : 0) | | ||
98 | ((dev->mode & SPI_CPHA) ? BM_SSP_CTRL1_PHASE : 0), | ||
99 | ssp->base + HW_SSP_CTRL1(ssp)); | ||
100 | |||
101 | writel(0x0, ssp->base + HW_SSP_CMD0); | ||
102 | writel(0x0, ssp->base + HW_SSP_CMD1); | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static int mxs_spi_setup(struct spi_device *dev) | ||
108 | { | ||
109 | int err = 0; | ||
110 | |||
111 | if (!dev->bits_per_word) | ||
112 | dev->bits_per_word = 8; | ||
113 | |||
114 | if (dev->mode & ~(SPI_CPOL | SPI_CPHA)) | ||
115 | return -EINVAL; | ||
116 | |||
117 | err = mxs_spi_setup_transfer(dev, NULL); | ||
118 | if (err) { | ||
119 | dev_err(&dev->dev, | ||
120 | "Failed to setup transfer, error = %d\n", err); | ||
121 | } | ||
122 | |||
123 | return err; | ||
124 | } | ||
125 | |||
126 | static uint32_t mxs_spi_cs_to_reg(unsigned cs) | ||
127 | { | ||
128 | uint32_t select = 0; | ||
129 | |||
130 | /* | ||
131 | * i.MX28 Datasheet: 17.10.1: HW_SSP_CTRL0 | ||
132 | * | ||
133 | * The bits BM_SSP_CTRL0_WAIT_FOR_CMD and BM_SSP_CTRL0_WAIT_FOR_IRQ | ||
134 | * in HW_SSP_CTRL0 register do have multiple usage, please refer to | ||
135 | * the datasheet for further details. In SPI mode, they are used to | ||
136 | * toggle the chip-select lines (nCS pins). | ||
137 | */ | ||
138 | if (cs & 1) | ||
139 | select |= BM_SSP_CTRL0_WAIT_FOR_CMD; | ||
140 | if (cs & 2) | ||
141 | select |= BM_SSP_CTRL0_WAIT_FOR_IRQ; | ||
142 | |||
143 | return select; | ||
144 | } | ||
145 | |||
146 | static void mxs_spi_set_cs(struct mxs_spi *spi, unsigned cs) | ||
147 | { | ||
148 | const uint32_t mask = | ||
149 | BM_SSP_CTRL0_WAIT_FOR_CMD | BM_SSP_CTRL0_WAIT_FOR_IRQ; | ||
150 | uint32_t select; | ||
151 | struct mxs_ssp *ssp = &spi->ssp; | ||
152 | |||
153 | writel(mask, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); | ||
154 | select = mxs_spi_cs_to_reg(cs); | ||
155 | writel(select, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
156 | } | ||
157 | |||
158 | static inline void mxs_spi_enable(struct mxs_spi *spi) | ||
159 | { | ||
160 | struct mxs_ssp *ssp = &spi->ssp; | ||
161 | |||
162 | writel(BM_SSP_CTRL0_LOCK_CS, | ||
163 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
164 | writel(BM_SSP_CTRL0_IGNORE_CRC, | ||
165 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); | ||
166 | } | ||
167 | |||
168 | static inline void mxs_spi_disable(struct mxs_spi *spi) | ||
169 | { | ||
170 | struct mxs_ssp *ssp = &spi->ssp; | ||
171 | |||
172 | writel(BM_SSP_CTRL0_LOCK_CS, | ||
173 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); | ||
174 | writel(BM_SSP_CTRL0_IGNORE_CRC, | ||
175 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
176 | } | ||
177 | |||
178 | static int mxs_ssp_wait(struct mxs_spi *spi, int offset, int mask, bool set) | ||
179 | { | ||
180 | const unsigned long timeout = jiffies + msecs_to_jiffies(SSP_TIMEOUT); | ||
181 | struct mxs_ssp *ssp = &spi->ssp; | ||
182 | uint32_t reg; | ||
183 | |||
184 | do { | ||
185 | reg = readl_relaxed(ssp->base + offset); | ||
186 | |||
187 | if (!set) | ||
188 | reg = ~reg; | ||
189 | |||
190 | reg &= mask; | ||
191 | |||
192 | if (reg == mask) | ||
193 | return 0; | ||
194 | } while (time_before(jiffies, timeout)); | ||
195 | |||
196 | return -ETIMEDOUT; | ||
197 | } | ||
198 | |||
199 | static void mxs_ssp_dma_irq_callback(void *param) | ||
200 | { | ||
201 | struct mxs_spi *spi = param; | ||
202 | complete(&spi->c); | ||
203 | } | ||
204 | |||
205 | static irqreturn_t mxs_ssp_irq_handler(int irq, void *dev_id) | ||
206 | { | ||
207 | struct mxs_ssp *ssp = dev_id; | ||
208 | dev_err(ssp->dev, "%s[%i] CTRL1=%08x STATUS=%08x\n", | ||
209 | __func__, __LINE__, | ||
210 | readl(ssp->base + HW_SSP_CTRL1(ssp)), | ||
211 | readl(ssp->base + HW_SSP_STATUS(ssp))); | ||
212 | return IRQ_HANDLED; | ||
213 | } | ||
214 | |||
215 | static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs, | ||
216 | unsigned char *buf, int len, | ||
217 | int *first, int *last, int write) | ||
218 | { | ||
219 | struct mxs_ssp *ssp = &spi->ssp; | ||
220 | struct dma_async_tx_descriptor *desc = NULL; | ||
221 | const bool vmalloced_buf = is_vmalloc_addr(buf); | ||
222 | const int desc_len = vmalloced_buf ? PAGE_SIZE : SG_MAXLEN; | ||
223 | const int sgs = DIV_ROUND_UP(len, desc_len); | ||
224 | int sg_count; | ||
225 | int min, ret; | ||
226 | uint32_t ctrl0; | ||
227 | struct page *vm_page; | ||
228 | void *sg_buf; | ||
229 | struct { | ||
230 | uint32_t pio[4]; | ||
231 | struct scatterlist sg; | ||
232 | } *dma_xfer; | ||
233 | |||
234 | if (!len) | ||
235 | return -EINVAL; | ||
236 | |||
237 | dma_xfer = kzalloc(sizeof(*dma_xfer) * sgs, GFP_KERNEL); | ||
238 | if (!dma_xfer) | ||
239 | return -ENOMEM; | ||
240 | |||
241 | INIT_COMPLETION(spi->c); | ||
242 | |||
243 | ctrl0 = readl(ssp->base + HW_SSP_CTRL0); | ||
244 | ctrl0 |= BM_SSP_CTRL0_DATA_XFER | mxs_spi_cs_to_reg(cs); | ||
245 | |||
246 | if (*first) | ||
247 | ctrl0 |= BM_SSP_CTRL0_LOCK_CS; | ||
248 | if (!write) | ||
249 | ctrl0 |= BM_SSP_CTRL0_READ; | ||
250 | |||
251 | /* Queue the DMA data transfer. */ | ||
252 | for (sg_count = 0; sg_count < sgs; sg_count++) { | ||
253 | min = min(len, desc_len); | ||
254 | |||
255 | /* Prepare the transfer descriptor. */ | ||
256 | if ((sg_count + 1 == sgs) && *last) | ||
257 | ctrl0 |= BM_SSP_CTRL0_IGNORE_CRC; | ||
258 | |||
259 | if (ssp->devid == IMX23_SSP) | ||
260 | ctrl0 |= min; | ||
261 | |||
262 | dma_xfer[sg_count].pio[0] = ctrl0; | ||
263 | dma_xfer[sg_count].pio[3] = min; | ||
264 | |||
265 | if (vmalloced_buf) { | ||
266 | vm_page = vmalloc_to_page(buf); | ||
267 | if (!vm_page) { | ||
268 | ret = -ENOMEM; | ||
269 | goto err_vmalloc; | ||
270 | } | ||
271 | sg_buf = page_address(vm_page) + | ||
272 | ((size_t)buf & ~PAGE_MASK); | ||
273 | } else { | ||
274 | sg_buf = buf; | ||
275 | } | ||
276 | |||
277 | sg_init_one(&dma_xfer[sg_count].sg, sg_buf, min); | ||
278 | ret = dma_map_sg(ssp->dev, &dma_xfer[sg_count].sg, 1, | ||
279 | write ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
280 | |||
281 | len -= min; | ||
282 | buf += min; | ||
283 | |||
284 | /* Queue the PIO register write transfer. */ | ||
285 | desc = dmaengine_prep_slave_sg(ssp->dmach, | ||
286 | (struct scatterlist *)dma_xfer[sg_count].pio, | ||
287 | (ssp->devid == IMX23_SSP) ? 1 : 4, | ||
288 | DMA_TRANS_NONE, | ||
289 | sg_count ? DMA_PREP_INTERRUPT : 0); | ||
290 | if (!desc) { | ||
291 | dev_err(ssp->dev, | ||
292 | "Failed to get PIO reg. write descriptor.\n"); | ||
293 | ret = -EINVAL; | ||
294 | goto err_mapped; | ||
295 | } | ||
296 | |||
297 | desc = dmaengine_prep_slave_sg(ssp->dmach, | ||
298 | &dma_xfer[sg_count].sg, 1, | ||
299 | write ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM, | ||
300 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
301 | |||
302 | if (!desc) { | ||
303 | dev_err(ssp->dev, | ||
304 | "Failed to get DMA data write descriptor.\n"); | ||
305 | ret = -EINVAL; | ||
306 | goto err_mapped; | ||
307 | } | ||
308 | } | ||
309 | |||
310 | /* | ||
311 | * The last descriptor must have this callback, | ||
312 | * to finish the DMA transaction. | ||
313 | */ | ||
314 | desc->callback = mxs_ssp_dma_irq_callback; | ||
315 | desc->callback_param = spi; | ||
316 | |||
317 | /* Start the transfer. */ | ||
318 | dmaengine_submit(desc); | ||
319 | dma_async_issue_pending(ssp->dmach); | ||
320 | |||
321 | ret = wait_for_completion_timeout(&spi->c, | ||
322 | msecs_to_jiffies(SSP_TIMEOUT)); | ||
323 | if (!ret) { | ||
324 | dev_err(ssp->dev, "DMA transfer timeout\n"); | ||
325 | ret = -ETIMEDOUT; | ||
326 | goto err_vmalloc; | ||
327 | } | ||
328 | |||
329 | ret = 0; | ||
330 | |||
331 | err_vmalloc: | ||
332 | while (--sg_count >= 0) { | ||
333 | err_mapped: | ||
334 | dma_unmap_sg(ssp->dev, &dma_xfer[sg_count].sg, 1, | ||
335 | write ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
336 | } | ||
337 | |||
338 | kfree(dma_xfer); | ||
339 | |||
340 | return ret; | ||
341 | } | ||
342 | |||
343 | static int mxs_spi_txrx_pio(struct mxs_spi *spi, int cs, | ||
344 | unsigned char *buf, int len, | ||
345 | int *first, int *last, int write) | ||
346 | { | ||
347 | struct mxs_ssp *ssp = &spi->ssp; | ||
348 | |||
349 | if (*first) | ||
350 | mxs_spi_enable(spi); | ||
351 | |||
352 | mxs_spi_set_cs(spi, cs); | ||
353 | |||
354 | while (len--) { | ||
355 | if (*last && len == 0) | ||
356 | mxs_spi_disable(spi); | ||
357 | |||
358 | if (ssp->devid == IMX23_SSP) { | ||
359 | writel(BM_SSP_CTRL0_XFER_COUNT, | ||
360 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); | ||
361 | writel(1, | ||
362 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
363 | } else { | ||
364 | writel(1, ssp->base + HW_SSP_XFER_SIZE); | ||
365 | } | ||
366 | |||
367 | if (write) | ||
368 | writel(BM_SSP_CTRL0_READ, | ||
369 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); | ||
370 | else | ||
371 | writel(BM_SSP_CTRL0_READ, | ||
372 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
373 | |||
374 | writel(BM_SSP_CTRL0_RUN, | ||
375 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
376 | |||
377 | if (mxs_ssp_wait(spi, HW_SSP_CTRL0, BM_SSP_CTRL0_RUN, 1)) | ||
378 | return -ETIMEDOUT; | ||
379 | |||
380 | if (write) | ||
381 | writel(*buf, ssp->base + HW_SSP_DATA(ssp)); | ||
382 | |||
383 | writel(BM_SSP_CTRL0_DATA_XFER, | ||
384 | ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); | ||
385 | |||
386 | if (!write) { | ||
387 | if (mxs_ssp_wait(spi, HW_SSP_STATUS(ssp), | ||
388 | BM_SSP_STATUS_FIFO_EMPTY, 0)) | ||
389 | return -ETIMEDOUT; | ||
390 | |||
391 | *buf = (readl(ssp->base + HW_SSP_DATA(ssp)) & 0xff); | ||
392 | } | ||
393 | |||
394 | if (mxs_ssp_wait(spi, HW_SSP_CTRL0, BM_SSP_CTRL0_RUN, 0)) | ||
395 | return -ETIMEDOUT; | ||
396 | |||
397 | buf++; | ||
398 | } | ||
399 | |||
400 | if (len <= 0) | ||
401 | return 0; | ||
402 | |||
403 | return -ETIMEDOUT; | ||
404 | } | ||
405 | |||
406 | static int mxs_spi_transfer_one(struct spi_master *master, | ||
407 | struct spi_message *m) | ||
408 | { | ||
409 | struct mxs_spi *spi = spi_master_get_devdata(master); | ||
410 | struct mxs_ssp *ssp = &spi->ssp; | ||
411 | int first, last; | ||
412 | struct spi_transfer *t, *tmp_t; | ||
413 | int status = 0; | ||
414 | int cs; | ||
415 | |||
416 | first = last = 0; | ||
417 | |||
418 | cs = m->spi->chip_select; | ||
419 | |||
420 | list_for_each_entry_safe(t, tmp_t, &m->transfers, transfer_list) { | ||
421 | |||
422 | status = mxs_spi_setup_transfer(m->spi, t); | ||
423 | if (status) | ||
424 | break; | ||
425 | |||
426 | if (&t->transfer_list == m->transfers.next) | ||
427 | first = 1; | ||
428 | if (&t->transfer_list == m->transfers.prev) | ||
429 | last = 1; | ||
430 | if ((t->rx_buf && t->tx_buf) || (t->rx_dma && t->tx_dma)) { | ||
431 | dev_err(ssp->dev, | ||
432 | "Cannot send and receive simultaneously\n"); | ||
433 | status = -EINVAL; | ||
434 | break; | ||
435 | } | ||
436 | |||
437 | /* | ||
438 | * Small blocks can be transfered via PIO. | ||
439 | * Measured by empiric means: | ||
440 | * | ||
441 | * dd if=/dev/mtdblock0 of=/dev/null bs=1024k count=1 | ||
442 | * | ||
443 | * DMA only: 2.164808 seconds, 473.0KB/s | ||
444 | * Combined: 1.676276 seconds, 610.9KB/s | ||
445 | */ | ||
446 | if (t->len < 32) { | ||
447 | writel(BM_SSP_CTRL1_DMA_ENABLE, | ||
448 | ssp->base + HW_SSP_CTRL1(ssp) + | ||
449 | STMP_OFFSET_REG_CLR); | ||
450 | |||
451 | if (t->tx_buf) | ||
452 | status = mxs_spi_txrx_pio(spi, cs, | ||
453 | (void *)t->tx_buf, | ||
454 | t->len, &first, &last, 1); | ||
455 | if (t->rx_buf) | ||
456 | status = mxs_spi_txrx_pio(spi, cs, | ||
457 | t->rx_buf, t->len, | ||
458 | &first, &last, 0); | ||
459 | } else { | ||
460 | writel(BM_SSP_CTRL1_DMA_ENABLE, | ||
461 | ssp->base + HW_SSP_CTRL1(ssp) + | ||
462 | STMP_OFFSET_REG_SET); | ||
463 | |||
464 | if (t->tx_buf) | ||
465 | status = mxs_spi_txrx_dma(spi, cs, | ||
466 | (void *)t->tx_buf, t->len, | ||
467 | &first, &last, 1); | ||
468 | if (t->rx_buf) | ||
469 | status = mxs_spi_txrx_dma(spi, cs, | ||
470 | t->rx_buf, t->len, | ||
471 | &first, &last, 0); | ||
472 | } | ||
473 | |||
474 | if (status) { | ||
475 | stmp_reset_block(ssp->base); | ||
476 | break; | ||
477 | } | ||
478 | |||
479 | m->actual_length += t->len; | ||
480 | first = last = 0; | ||
481 | } | ||
482 | |||
483 | m->status = 0; | ||
484 | spi_finalize_current_message(master); | ||
485 | |||
486 | return status; | ||
487 | } | ||
488 | |||
489 | static bool mxs_ssp_dma_filter(struct dma_chan *chan, void *param) | ||
490 | { | ||
491 | struct mxs_ssp *ssp = param; | ||
492 | |||
493 | if (!mxs_dma_is_apbh(chan)) | ||
494 | return false; | ||
495 | |||
496 | if (chan->chan_id != ssp->dma_channel) | ||
497 | return false; | ||
498 | |||
499 | chan->private = &ssp->dma_data; | ||
500 | |||
501 | return true; | ||
502 | } | ||
503 | |||
504 | static const struct of_device_id mxs_spi_dt_ids[] = { | ||
505 | { .compatible = "fsl,imx23-spi", .data = (void *) IMX23_SSP, }, | ||
506 | { .compatible = "fsl,imx28-spi", .data = (void *) IMX28_SSP, }, | ||
507 | { /* sentinel */ } | ||
508 | }; | ||
509 | MODULE_DEVICE_TABLE(of, mxs_spi_dt_ids); | ||
510 | |||
511 | static int __devinit mxs_spi_probe(struct platform_device *pdev) | ||
512 | { | ||
513 | const struct of_device_id *of_id = | ||
514 | of_match_device(mxs_spi_dt_ids, &pdev->dev); | ||
515 | struct device_node *np = pdev->dev.of_node; | ||
516 | struct spi_master *master; | ||
517 | struct mxs_spi *spi; | ||
518 | struct mxs_ssp *ssp; | ||
519 | struct resource *iores, *dmares; | ||
520 | struct pinctrl *pinctrl; | ||
521 | struct clk *clk; | ||
522 | void __iomem *base; | ||
523 | int devid, dma_channel, clk_freq; | ||
524 | int ret = 0, irq_err, irq_dma; | ||
525 | dma_cap_mask_t mask; | ||
526 | |||
527 | /* | ||
528 | * Default clock speed for the SPI core. 160MHz seems to | ||
529 | * work reasonably well with most SPI flashes, so use this | ||
530 | * as a default. Override with "clock-frequency" DT prop. | ||
531 | */ | ||
532 | const int clk_freq_default = 160000000; | ||
533 | |||
534 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
535 | irq_err = platform_get_irq(pdev, 0); | ||
536 | irq_dma = platform_get_irq(pdev, 1); | ||
537 | if (!iores || irq_err < 0 || irq_dma < 0) | ||
538 | return -EINVAL; | ||
539 | |||
540 | base = devm_request_and_ioremap(&pdev->dev, iores); | ||
541 | if (!base) | ||
542 | return -EADDRNOTAVAIL; | ||
543 | |||
544 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
545 | if (IS_ERR(pinctrl)) | ||
546 | return PTR_ERR(pinctrl); | ||
547 | |||
548 | clk = devm_clk_get(&pdev->dev, NULL); | ||
549 | if (IS_ERR(clk)) | ||
550 | return PTR_ERR(clk); | ||
551 | |||
552 | if (np) { | ||
553 | devid = (enum mxs_ssp_id) of_id->data; | ||
554 | /* | ||
555 | * TODO: This is a temporary solution and should be changed | ||
556 | * to use generic DMA binding later when the helpers get in. | ||
557 | */ | ||
558 | ret = of_property_read_u32(np, "fsl,ssp-dma-channel", | ||
559 | &dma_channel); | ||
560 | if (ret) { | ||
561 | dev_err(&pdev->dev, | ||
562 | "Failed to get DMA channel\n"); | ||
563 | return -EINVAL; | ||
564 | } | ||
565 | |||
566 | ret = of_property_read_u32(np, "clock-frequency", | ||
567 | &clk_freq); | ||
568 | if (ret) | ||
569 | clk_freq = clk_freq_default; | ||
570 | } else { | ||
571 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
572 | if (!dmares) | ||
573 | return -EINVAL; | ||
574 | devid = pdev->id_entry->driver_data; | ||
575 | dma_channel = dmares->start; | ||
576 | clk_freq = clk_freq_default; | ||
577 | } | ||
578 | |||
579 | master = spi_alloc_master(&pdev->dev, sizeof(*spi)); | ||
580 | if (!master) | ||
581 | return -ENOMEM; | ||
582 | |||
583 | master->transfer_one_message = mxs_spi_transfer_one; | ||
584 | master->setup = mxs_spi_setup; | ||
585 | master->mode_bits = SPI_CPOL | SPI_CPHA; | ||
586 | master->num_chipselect = 3; | ||
587 | master->dev.of_node = np; | ||
588 | master->flags = SPI_MASTER_HALF_DUPLEX; | ||
589 | |||
590 | spi = spi_master_get_devdata(master); | ||
591 | ssp = &spi->ssp; | ||
592 | ssp->dev = &pdev->dev; | ||
593 | ssp->clk = clk; | ||
594 | ssp->base = base; | ||
595 | ssp->devid = devid; | ||
596 | ssp->dma_channel = dma_channel; | ||
597 | |||
598 | init_completion(&spi->c); | ||
599 | |||
600 | ret = devm_request_irq(&pdev->dev, irq_err, mxs_ssp_irq_handler, 0, | ||
601 | DRIVER_NAME, ssp); | ||
602 | if (ret) | ||
603 | goto out_master_free; | ||
604 | |||
605 | dma_cap_zero(mask); | ||
606 | dma_cap_set(DMA_SLAVE, mask); | ||
607 | ssp->dma_data.chan_irq = irq_dma; | ||
608 | ssp->dmach = dma_request_channel(mask, mxs_ssp_dma_filter, ssp); | ||
609 | if (!ssp->dmach) { | ||
610 | dev_err(ssp->dev, "Failed to request DMA\n"); | ||
611 | goto out_master_free; | ||
612 | } | ||
613 | |||
614 | clk_prepare_enable(ssp->clk); | ||
615 | clk_set_rate(ssp->clk, clk_freq); | ||
616 | ssp->clk_rate = clk_get_rate(ssp->clk) / 1000; | ||
617 | |||
618 | stmp_reset_block(ssp->base); | ||
619 | |||
620 | platform_set_drvdata(pdev, master); | ||
621 | |||
622 | ret = spi_register_master(master); | ||
623 | if (ret) { | ||
624 | dev_err(&pdev->dev, "Cannot register SPI master, %d\n", ret); | ||
625 | goto out_free_dma; | ||
626 | } | ||
627 | |||
628 | return 0; | ||
629 | |||
630 | out_free_dma: | ||
631 | dma_release_channel(ssp->dmach); | ||
632 | clk_disable_unprepare(ssp->clk); | ||
633 | out_master_free: | ||
634 | spi_master_put(master); | ||
635 | return ret; | ||
636 | } | ||
637 | |||
638 | static int __devexit mxs_spi_remove(struct platform_device *pdev) | ||
639 | { | ||
640 | struct spi_master *master; | ||
641 | struct mxs_spi *spi; | ||
642 | struct mxs_ssp *ssp; | ||
643 | |||
644 | master = spi_master_get(platform_get_drvdata(pdev)); | ||
645 | spi = spi_master_get_devdata(master); | ||
646 | ssp = &spi->ssp; | ||
647 | |||
648 | spi_unregister_master(master); | ||
649 | |||
650 | dma_release_channel(ssp->dmach); | ||
651 | |||
652 | clk_disable_unprepare(ssp->clk); | ||
653 | |||
654 | spi_master_put(master); | ||
655 | |||
656 | return 0; | ||
657 | } | ||
658 | |||
659 | static struct platform_driver mxs_spi_driver = { | ||
660 | .probe = mxs_spi_probe, | ||
661 | .remove = __devexit_p(mxs_spi_remove), | ||
662 | .driver = { | ||
663 | .name = DRIVER_NAME, | ||
664 | .owner = THIS_MODULE, | ||
665 | .of_match_table = mxs_spi_dt_ids, | ||
666 | }, | ||
667 | }; | ||
668 | |||
669 | module_platform_driver(mxs_spi_driver); | ||
670 | |||
671 | MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); | ||
672 | MODULE_DESCRIPTION("MXS SPI master driver"); | ||
673 | MODULE_LICENSE("GPL"); | ||
674 | MODULE_ALIAS("platform:mxs-spi"); | ||
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/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..16521a9f2038 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; |
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/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/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/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/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h new file mode 100644 index 000000000000..61ae1306db23 --- /dev/null +++ b/include/linux/spi/mxs-spi.h | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | * include/linux/spi/mxs-spi.h | ||
3 | * | ||
4 | * Freescale i.MX233/i.MX28 SPI controller register definition | ||
5 | * | ||
6 | * Copyright 2008 Embedded Alley Solutions, Inc. | ||
7 | * Copyright 2009-2011 Freescale Semiconductor, Inc. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __LINUX_SPI_MXS_SPI_H__ | ||
25 | #define __LINUX_SPI_MXS_SPI_H__ | ||
26 | |||
27 | #include <linux/fsl/mxs-dma.h> | ||
28 | |||
29 | #define ssp_is_old(host) ((host)->devid == IMX23_SSP) | ||
30 | |||
31 | /* SSP registers */ | ||
32 | #define HW_SSP_CTRL0 0x000 | ||
33 | #define BM_SSP_CTRL0_RUN (1 << 29) | ||
34 | #define BM_SSP_CTRL0_SDIO_IRQ_CHECK (1 << 28) | ||
35 | #define BM_SSP_CTRL0_LOCK_CS (1 << 27) | ||
36 | #define BM_SSP_CTRL0_IGNORE_CRC (1 << 26) | ||
37 | #define BM_SSP_CTRL0_READ (1 << 25) | ||
38 | #define BM_SSP_CTRL0_DATA_XFER (1 << 24) | ||
39 | #define BP_SSP_CTRL0_BUS_WIDTH 22 | ||
40 | #define BM_SSP_CTRL0_BUS_WIDTH (0x3 << 22) | ||
41 | #define BM_SSP_CTRL0_WAIT_FOR_IRQ (1 << 21) | ||
42 | #define BM_SSP_CTRL0_WAIT_FOR_CMD (1 << 20) | ||
43 | #define BM_SSP_CTRL0_LONG_RESP (1 << 19) | ||
44 | #define BM_SSP_CTRL0_GET_RESP (1 << 17) | ||
45 | #define BM_SSP_CTRL0_ENABLE (1 << 16) | ||
46 | #define BP_SSP_CTRL0_XFER_COUNT 0 | ||
47 | #define BM_SSP_CTRL0_XFER_COUNT 0xffff | ||
48 | #define HW_SSP_CMD0 0x010 | ||
49 | #define BM_SSP_CMD0_DBL_DATA_RATE_EN (1 << 25) | ||
50 | #define BM_SSP_CMD0_SLOW_CLKING_EN (1 << 22) | ||
51 | #define BM_SSP_CMD0_CONT_CLKING_EN (1 << 21) | ||
52 | #define BM_SSP_CMD0_APPEND_8CYC (1 << 20) | ||
53 | #define BP_SSP_CMD0_BLOCK_SIZE 16 | ||
54 | #define BM_SSP_CMD0_BLOCK_SIZE (0xf << 16) | ||
55 | #define BP_SSP_CMD0_BLOCK_COUNT 8 | ||
56 | #define BM_SSP_CMD0_BLOCK_COUNT (0xff << 8) | ||
57 | #define BP_SSP_CMD0_CMD 0 | ||
58 | #define BM_SSP_CMD0_CMD 0xff | ||
59 | #define HW_SSP_CMD1 0x020 | ||
60 | #define HW_SSP_XFER_SIZE 0x030 | ||
61 | #define HW_SSP_BLOCK_SIZE 0x040 | ||
62 | #define BP_SSP_BLOCK_SIZE_BLOCK_COUNT 4 | ||
63 | #define BM_SSP_BLOCK_SIZE_BLOCK_COUNT (0xffffff << 4) | ||
64 | #define BP_SSP_BLOCK_SIZE_BLOCK_SIZE 0 | ||
65 | #define BM_SSP_BLOCK_SIZE_BLOCK_SIZE 0xf | ||
66 | #define HW_SSP_TIMING(h) (ssp_is_old(h) ? 0x050 : 0x070) | ||
67 | #define BP_SSP_TIMING_TIMEOUT 16 | ||
68 | #define BM_SSP_TIMING_TIMEOUT (0xffff << 16) | ||
69 | #define BP_SSP_TIMING_CLOCK_DIVIDE 8 | ||
70 | #define BM_SSP_TIMING_CLOCK_DIVIDE (0xff << 8) | ||
71 | #define BF_SSP_TIMING_CLOCK_DIVIDE(v) \ | ||
72 | (((v) << 8) & BM_SSP_TIMING_CLOCK_DIVIDE) | ||
73 | #define BP_SSP_TIMING_CLOCK_RATE 0 | ||
74 | #define BM_SSP_TIMING_CLOCK_RATE 0xff | ||
75 | #define BF_SSP_TIMING_CLOCK_RATE(v) \ | ||
76 | (((v) << 0) & BM_SSP_TIMING_CLOCK_RATE) | ||
77 | #define HW_SSP_CTRL1(h) (ssp_is_old(h) ? 0x060 : 0x080) | ||
78 | #define BM_SSP_CTRL1_SDIO_IRQ (1 << 31) | ||
79 | #define BM_SSP_CTRL1_SDIO_IRQ_EN (1 << 30) | ||
80 | #define BM_SSP_CTRL1_RESP_ERR_IRQ (1 << 29) | ||
81 | #define BM_SSP_CTRL1_RESP_ERR_IRQ_EN (1 << 28) | ||
82 | #define BM_SSP_CTRL1_RESP_TIMEOUT_IRQ (1 << 27) | ||
83 | #define BM_SSP_CTRL1_RESP_TIMEOUT_IRQ_EN (1 << 26) | ||
84 | #define BM_SSP_CTRL1_DATA_TIMEOUT_IRQ (1 << 25) | ||
85 | #define BM_SSP_CTRL1_DATA_TIMEOUT_IRQ_EN (1 << 24) | ||
86 | #define BM_SSP_CTRL1_DATA_CRC_IRQ (1 << 23) | ||
87 | #define BM_SSP_CTRL1_DATA_CRC_IRQ_EN (1 << 22) | ||
88 | #define BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ (1 << 21) | ||
89 | #define BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ_EN (1 << 20) | ||
90 | #define BM_SSP_CTRL1_RECV_TIMEOUT_IRQ (1 << 17) | ||
91 | #define BM_SSP_CTRL1_RECV_TIMEOUT_IRQ_EN (1 << 16) | ||
92 | #define BM_SSP_CTRL1_FIFO_OVERRUN_IRQ (1 << 15) | ||
93 | #define BM_SSP_CTRL1_FIFO_OVERRUN_IRQ_EN (1 << 14) | ||
94 | #define BM_SSP_CTRL1_DMA_ENABLE (1 << 13) | ||
95 | #define BM_SSP_CTRL1_PHASE (1 << 10) | ||
96 | #define BM_SSP_CTRL1_POLARITY (1 << 9) | ||
97 | #define BP_SSP_CTRL1_WORD_LENGTH 4 | ||
98 | #define BM_SSP_CTRL1_WORD_LENGTH (0xf << 4) | ||
99 | #define BF_SSP_CTRL1_WORD_LENGTH(v) \ | ||
100 | (((v) << 4) & BM_SSP_CTRL1_WORD_LENGTH) | ||
101 | #define BV_SSP_CTRL1_WORD_LENGTH__FOUR_BITS 0x3 | ||
102 | #define BV_SSP_CTRL1_WORD_LENGTH__EIGHT_BITS 0x7 | ||
103 | #define BV_SSP_CTRL1_WORD_LENGTH__SIXTEEN_BITS 0xF | ||
104 | #define BP_SSP_CTRL1_SSP_MODE 0 | ||
105 | #define BM_SSP_CTRL1_SSP_MODE 0xf | ||
106 | #define BF_SSP_CTRL1_SSP_MODE(v) \ | ||
107 | (((v) << 0) & BM_SSP_CTRL1_SSP_MODE) | ||
108 | #define BV_SSP_CTRL1_SSP_MODE__SPI 0x0 | ||
109 | #define BV_SSP_CTRL1_SSP_MODE__SSI 0x1 | ||
110 | #define BV_SSP_CTRL1_SSP_MODE__SD_MMC 0x3 | ||
111 | #define BV_SSP_CTRL1_SSP_MODE__MS 0x4 | ||
112 | |||
113 | #define HW_SSP_DATA(h) (ssp_is_old(h) ? 0x070 : 0x090) | ||
114 | |||
115 | #define HW_SSP_SDRESP0(h) (ssp_is_old(h) ? 0x080 : 0x0a0) | ||
116 | #define HW_SSP_SDRESP1(h) (ssp_is_old(h) ? 0x090 : 0x0b0) | ||
117 | #define HW_SSP_SDRESP2(h) (ssp_is_old(h) ? 0x0a0 : 0x0c0) | ||
118 | #define HW_SSP_SDRESP3(h) (ssp_is_old(h) ? 0x0b0 : 0x0d0) | ||
119 | #define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100) | ||
120 | #define BM_SSP_STATUS_CARD_DETECT (1 << 28) | ||
121 | #define BM_SSP_STATUS_SDIO_IRQ (1 << 17) | ||
122 | #define BM_SSP_STATUS_FIFO_EMPTY (1 << 5) | ||
123 | |||
124 | #define BF_SSP(value, field) (((value) << BP_SSP_##field) & BM_SSP_##field) | ||
125 | |||
126 | #define SSP_PIO_NUM 3 | ||
127 | |||
128 | enum mxs_ssp_id { | ||
129 | IMX23_SSP, | ||
130 | IMX28_SSP, | ||
131 | }; | ||
132 | |||
133 | struct mxs_ssp { | ||
134 | struct device *dev; | ||
135 | void __iomem *base; | ||
136 | struct clk *clk; | ||
137 | unsigned int clk_rate; | ||
138 | enum mxs_ssp_id devid; | ||
139 | |||
140 | int dma_channel; | ||
141 | struct dma_chan *dmach; | ||
142 | struct mxs_dma_data dma_data; | ||
143 | unsigned int dma_dir; | ||
144 | enum dma_transfer_direction slave_dirn; | ||
145 | u32 ssp_pio_words[SSP_PIO_NUM]; | ||
146 | }; | ||
147 | |||
148 | void mxs_ssp_set_clk_rate(struct mxs_ssp *ssp, unsigned int rate); | ||
149 | |||
150 | #endif /* __LINUX_SPI_MXS_SPI_H__ */ | ||
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 0fedbd8d747a..9fc7114159e8 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -111,9 +111,8 @@ struct rt6_info { | |||
111 | struct inet6_dev *rt6i_idev; | 111 | struct inet6_dev *rt6i_idev; |
112 | unsigned long _rt6i_peer; | 112 | unsigned long _rt6i_peer; |
113 | 113 | ||
114 | #ifdef CONFIG_XFRM | 114 | u32 rt6i_genid; |
115 | u32 rt6i_flow_cache_genid; | 115 | |
116 | #endif | ||
117 | /* more non-fragment space at head required */ | 116 | /* more non-fragment space at head required */ |
118 | unsigned short rt6i_nfheader_len; | 117 | unsigned short rt6i_nfheader_len; |
119 | 118 | ||
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index ae1cd6c9ba52..fd87963a0ea5 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -102,6 +102,7 @@ struct net { | |||
102 | #endif | 102 | #endif |
103 | struct netns_ipvs *ipvs; | 103 | struct netns_ipvs *ipvs; |
104 | struct sock *diag_nlsk; | 104 | struct sock *diag_nlsk; |
105 | atomic_t rt_genid; | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | 108 | ||
@@ -300,5 +301,14 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header) | |||
300 | } | 301 | } |
301 | #endif | 302 | #endif |
302 | 303 | ||
304 | static inline int rt_genid(struct net *net) | ||
305 | { | ||
306 | return atomic_read(&net->rt_genid); | ||
307 | } | ||
308 | |||
309 | static inline void rt_genid_bump(struct net *net) | ||
310 | { | ||
311 | atomic_inc(&net->rt_genid); | ||
312 | } | ||
303 | 313 | ||
304 | #endif /* __NET_NET_NAMESPACE_H */ | 314 | #endif /* __NET_NET_NAMESPACE_H */ |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 1474dd65c66f..eb24dbccd81e 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -65,7 +65,6 @@ struct netns_ipv4 { | |||
65 | unsigned int sysctl_ping_group_range[2]; | 65 | unsigned int sysctl_ping_group_range[2]; |
66 | long sysctl_tcp_mem[3]; | 66 | long sysctl_tcp_mem[3]; |
67 | 67 | ||
68 | atomic_t rt_genid; | ||
69 | atomic_t dev_addr_genid; | 68 | atomic_t dev_addr_genid; |
70 | 69 | ||
71 | #ifdef CONFIG_IP_MROUTE | 70 | #ifdef CONFIG_IP_MROUTE |
diff --git a/include/net/route.h b/include/net/route.h index 776a27f1ab78..da22243d2760 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -108,7 +108,7 @@ extern struct ip_rt_acct __percpu *ip_rt_acct; | |||
108 | 108 | ||
109 | struct in_device; | 109 | struct in_device; |
110 | extern int ip_rt_init(void); | 110 | extern int ip_rt_init(void); |
111 | extern void rt_cache_flush(struct net *net, int how); | 111 | extern void rt_cache_flush(struct net *net); |
112 | extern void rt_flush_dev(struct net_device *dev); | 112 | extern void rt_flush_dev(struct net_device *dev); |
113 | extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); | 113 | extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); |
114 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, | 114 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, |
diff --git a/include/net/sock.h b/include/net/sock.h index 72132aef53fc..adb7da20b5a1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1332,7 +1332,7 @@ static inline bool sk_wmem_schedule(struct sock *sk, int size) | |||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | static inline bool | 1334 | static inline bool |
1335 | sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, unsigned int size) | 1335 | sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size) |
1336 | { | 1336 | { |
1337 | if (!sk_has_account(sk)) | 1337 | if (!sk_has_account(sk)) |
1338 | return true; | 1338 | return true; |
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 b3c7fd554250..6144bab8fd8e 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -232,15 +232,19 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write, | |||
232 | */ | 232 | */ |
233 | 233 | ||
234 | tmp.data = ¤t->nsproxy->pid_ns->last_pid; | 234 | tmp.data = ¤t->nsproxy->pid_ns->last_pid; |
235 | return proc_dointvec(&tmp, write, buffer, lenp, ppos); | 235 | return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
236 | } | 236 | } |
237 | 237 | ||
238 | extern int pid_max; | ||
239 | static int zero = 0; | ||
238 | static struct ctl_table pid_ns_ctl_table[] = { | 240 | static struct ctl_table pid_ns_ctl_table[] = { |
239 | { | 241 | { |
240 | .procname = "ns_last_pid", | 242 | .procname = "ns_last_pid", |
241 | .maxlen = sizeof(int), | 243 | .maxlen = sizeof(int), |
242 | .mode = 0666, /* permissions are checked in the handler */ | 244 | .mode = 0666, /* permissions are checked in the handler */ |
243 | .proc_handler = pid_ns_ctl_handler, | 245 | .proc_handler = pid_ns_ctl_handler, |
246 | .extra1 = &zero, | ||
247 | .extra2 = &pid_max, | ||
244 | }, | 248 | }, |
245 | { } | 249 | { } |
246 | }; | 250 | }; |
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/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/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/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index 5e5f5b410e0b..1eaacf10d19d 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -58,7 +58,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
58 | switch (cmd) { | 58 | switch (cmd) { |
59 | case BNEPCONNADD: | 59 | case BNEPCONNADD: |
60 | if (!capable(CAP_NET_ADMIN)) | 60 | if (!capable(CAP_NET_ADMIN)) |
61 | return -EACCES; | 61 | return -EPERM; |
62 | 62 | ||
63 | if (copy_from_user(&ca, argp, sizeof(ca))) | 63 | if (copy_from_user(&ca, argp, sizeof(ca))) |
64 | return -EFAULT; | 64 | return -EFAULT; |
@@ -84,7 +84,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
84 | 84 | ||
85 | case BNEPCONNDEL: | 85 | case BNEPCONNDEL: |
86 | if (!capable(CAP_NET_ADMIN)) | 86 | if (!capable(CAP_NET_ADMIN)) |
87 | return -EACCES; | 87 | return -EPERM; |
88 | 88 | ||
89 | if (copy_from_user(&cd, argp, sizeof(cd))) | 89 | if (copy_from_user(&cd, argp, sizeof(cd))) |
90 | return -EFAULT; | 90 | return -EFAULT; |
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index 311668d14571..32dc83dcb6b2 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -72,7 +72,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
72 | switch (cmd) { | 72 | switch (cmd) { |
73 | case CMTPCONNADD: | 73 | case CMTPCONNADD: |
74 | if (!capable(CAP_NET_ADMIN)) | 74 | if (!capable(CAP_NET_ADMIN)) |
75 | return -EACCES; | 75 | return -EPERM; |
76 | 76 | ||
77 | if (copy_from_user(&ca, argp, sizeof(ca))) | 77 | if (copy_from_user(&ca, argp, sizeof(ca))) |
78 | return -EFAULT; | 78 | return -EFAULT; |
@@ -97,7 +97,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
97 | 97 | ||
98 | case CMTPCONNDEL: | 98 | case CMTPCONNDEL: |
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/hci_sock.c b/net/bluetooth/hci_sock.c index 19fdac78e555..d5ace1eda3ed 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 18b3f6892a36..b24fb3bd8625 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -56,7 +56,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
56 | switch (cmd) { | 56 | switch (cmd) { |
57 | case HIDPCONNADD: | 57 | case HIDPCONNADD: |
58 | if (!capable(CAP_NET_ADMIN)) | 58 | if (!capable(CAP_NET_ADMIN)) |
59 | return -EACCES; | 59 | return -EPERM; |
60 | 60 | ||
61 | if (copy_from_user(&ca, argp, sizeof(ca))) | 61 | if (copy_from_user(&ca, argp, sizeof(ca))) |
62 | return -EFAULT; | 62 | return -EFAULT; |
@@ -91,7 +91,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long | |||
91 | 91 | ||
92 | case HIDPCONNDEL: | 92 | case HIDPCONNDEL: |
93 | if (!capable(CAP_NET_ADMIN)) | 93 | if (!capable(CAP_NET_ADMIN)) |
94 | return -EACCES; | 94 | return -EPERM; |
95 | 95 | ||
96 | if (copy_from_user(&cd, argp, sizeof(cd))) | 96 | if (copy_from_user(&cd, argp, sizeof(cd))) |
97 | return -EFAULT; | 97 | return -EFAULT; |
diff --git a/net/core/dev.c b/net/core/dev.c index d7fe32c946c1..89e33a5d4d93 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2134,7 +2134,8 @@ static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) | |||
2134 | static netdev_features_t harmonize_features(struct sk_buff *skb, | 2134 | static netdev_features_t harmonize_features(struct sk_buff *skb, |
2135 | __be16 protocol, netdev_features_t features) | 2135 | __be16 protocol, netdev_features_t features) |
2136 | { | 2136 | { |
2137 | if (!can_checksum_protocol(features, protocol)) { | 2137 | if (skb->ip_summed != CHECKSUM_NONE && |
2138 | !can_checksum_protocol(features, protocol)) { | ||
2138 | features &= ~NETIF_F_ALL_CSUM; | 2139 | features &= ~NETIF_F_ALL_CSUM; |
2139 | features &= ~NETIF_F_SG; | 2140 | features &= ~NETIF_F_SG; |
2140 | } else if (illegal_highdma(skb->dev, skb)) { | 2141 | } else if (illegal_highdma(skb->dev, skb)) { |
@@ -3322,7 +3323,7 @@ ncls: | |||
3322 | 3323 | ||
3323 | if (pt_prev) { | 3324 | if (pt_prev) { |
3324 | if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) | 3325 | if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) |
3325 | ret = -ENOMEM; | 3326 | goto drop; |
3326 | else | 3327 | else |
3327 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); | 3328 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
3328 | } else { | 3329 | } else { |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index fe00d1208167..e33ebae519c8 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3502,7 +3502,9 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, | |||
3502 | if (!skb_cloned(from)) | 3502 | if (!skb_cloned(from)) |
3503 | skb_shinfo(from)->nr_frags = 0; | 3503 | skb_shinfo(from)->nr_frags = 0; |
3504 | 3504 | ||
3505 | /* if the skb is cloned this does nothing since we set nr_frags to 0 */ | 3505 | /* if the skb is not cloned this does nothing |
3506 | * since we set nr_frags to 0. | ||
3507 | */ | ||
3506 | for (i = 0; i < skb_shinfo(from)->nr_frags; i++) | 3508 | for (i = 0; i < skb_shinfo(from)->nr_frags; i++) |
3507 | skb_frag_ref(from, i); | 3509 | skb_frag_ref(from, i); |
3508 | 3510 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 77e87aff419a..47800459e4cb 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -1225,7 +1225,7 @@ static int arp_netdev_event(struct notifier_block *this, unsigned long event, | |||
1225 | switch (event) { | 1225 | switch (event) { |
1226 | case NETDEV_CHANGEADDR: | 1226 | case NETDEV_CHANGEADDR: |
1227 | neigh_changeaddr(&arp_tbl, dev); | 1227 | neigh_changeaddr(&arp_tbl, dev); |
1228 | rt_cache_flush(dev_net(dev), 0); | 1228 | rt_cache_flush(dev_net(dev)); |
1229 | break; | 1229 | break; |
1230 | default: | 1230 | default: |
1231 | break; | 1231 | break; |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 44bf82e3aef7..e12fad773852 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -725,7 +725,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
725 | break; | 725 | break; |
726 | 726 | ||
727 | case SIOCSIFFLAGS: | 727 | case SIOCSIFFLAGS: |
728 | ret = -EACCES; | 728 | ret = -EPERM; |
729 | if (!capable(CAP_NET_ADMIN)) | 729 | if (!capable(CAP_NET_ADMIN)) |
730 | goto out; | 730 | goto out; |
731 | break; | 731 | break; |
@@ -733,7 +733,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
733 | case SIOCSIFBRDADDR: /* Set the broadcast address */ | 733 | case SIOCSIFBRDADDR: /* Set the broadcast address */ |
734 | case SIOCSIFDSTADDR: /* Set the destination address */ | 734 | case SIOCSIFDSTADDR: /* Set the destination address */ |
735 | case SIOCSIFNETMASK: /* Set the netmask for the interface */ | 735 | case SIOCSIFNETMASK: /* Set the netmask for the interface */ |
736 | ret = -EACCES; | 736 | ret = -EPERM; |
737 | if (!capable(CAP_NET_ADMIN)) | 737 | if (!capable(CAP_NET_ADMIN)) |
738 | goto out; | 738 | goto out; |
739 | ret = -EINVAL; | 739 | ret = -EINVAL; |
@@ -1503,7 +1503,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1503 | if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1 || | 1503 | if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1 || |
1504 | i == IPV4_DEVCONF_ROUTE_LOCALNET - 1) | 1504 | i == IPV4_DEVCONF_ROUTE_LOCALNET - 1) |
1505 | if ((new_value == 0) && (old_value != 0)) | 1505 | if ((new_value == 0) && (old_value != 0)) |
1506 | rt_cache_flush(net, 0); | 1506 | rt_cache_flush(net); |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | return ret; | 1509 | return ret; |
@@ -1537,7 +1537,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1537 | dev_disable_lro(idev->dev); | 1537 | dev_disable_lro(idev->dev); |
1538 | } | 1538 | } |
1539 | rtnl_unlock(); | 1539 | rtnl_unlock(); |
1540 | rt_cache_flush(net, 0); | 1540 | rt_cache_flush(net); |
1541 | } | 1541 | } |
1542 | } | 1542 | } |
1543 | 1543 | ||
@@ -1554,7 +1554,7 @@ static int ipv4_doint_and_flush(ctl_table *ctl, int write, | |||
1554 | struct net *net = ctl->extra2; | 1554 | struct net *net = ctl->extra2; |
1555 | 1555 | ||
1556 | if (write && *valp != val) | 1556 | if (write && *valp != val) |
1557 | rt_cache_flush(net, 0); | 1557 | rt_cache_flush(net); |
1558 | 1558 | ||
1559 | return ret; | 1559 | return ret; |
1560 | } | 1560 | } |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index c43ae3fba792..8e2b475da9fa 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -148,7 +148,7 @@ static void fib_flush(struct net *net) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | if (flushed) | 150 | if (flushed) |
151 | rt_cache_flush(net, -1); | 151 | rt_cache_flush(net); |
152 | } | 152 | } |
153 | 153 | ||
154 | /* | 154 | /* |
@@ -999,11 +999,11 @@ static void nl_fib_lookup_exit(struct net *net) | |||
999 | net->ipv4.fibnl = NULL; | 999 | net->ipv4.fibnl = NULL; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static void fib_disable_ip(struct net_device *dev, int force, int delay) | 1002 | static void fib_disable_ip(struct net_device *dev, int force) |
1003 | { | 1003 | { |
1004 | if (fib_sync_down_dev(dev, force)) | 1004 | if (fib_sync_down_dev(dev, force)) |
1005 | fib_flush(dev_net(dev)); | 1005 | fib_flush(dev_net(dev)); |
1006 | rt_cache_flush(dev_net(dev), delay); | 1006 | rt_cache_flush(dev_net(dev)); |
1007 | arp_ifdown(dev); | 1007 | arp_ifdown(dev); |
1008 | } | 1008 | } |
1009 | 1009 | ||
@@ -1020,7 +1020,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1020 | fib_sync_up(dev); | 1020 | fib_sync_up(dev); |
1021 | #endif | 1021 | #endif |
1022 | atomic_inc(&net->ipv4.dev_addr_genid); | 1022 | atomic_inc(&net->ipv4.dev_addr_genid); |
1023 | rt_cache_flush(dev_net(dev), -1); | 1023 | rt_cache_flush(dev_net(dev)); |
1024 | break; | 1024 | break; |
1025 | case NETDEV_DOWN: | 1025 | case NETDEV_DOWN: |
1026 | fib_del_ifaddr(ifa, NULL); | 1026 | fib_del_ifaddr(ifa, NULL); |
@@ -1029,9 +1029,9 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1029 | /* Last address was deleted from this interface. | 1029 | /* Last address was deleted from this interface. |
1030 | * Disable IP. | 1030 | * Disable IP. |
1031 | */ | 1031 | */ |
1032 | fib_disable_ip(dev, 1, 0); | 1032 | fib_disable_ip(dev, 1); |
1033 | } else { | 1033 | } else { |
1034 | rt_cache_flush(dev_net(dev), -1); | 1034 | rt_cache_flush(dev_net(dev)); |
1035 | } | 1035 | } |
1036 | break; | 1036 | break; |
1037 | } | 1037 | } |
@@ -1045,7 +1045,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo | |||
1045 | struct net *net = dev_net(dev); | 1045 | struct net *net = dev_net(dev); |
1046 | 1046 | ||
1047 | if (event == NETDEV_UNREGISTER) { | 1047 | if (event == NETDEV_UNREGISTER) { |
1048 | fib_disable_ip(dev, 2, -1); | 1048 | fib_disable_ip(dev, 2); |
1049 | rt_flush_dev(dev); | 1049 | rt_flush_dev(dev); |
1050 | return NOTIFY_DONE; | 1050 | return NOTIFY_DONE; |
1051 | } | 1051 | } |
@@ -1062,14 +1062,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo | |||
1062 | fib_sync_up(dev); | 1062 | fib_sync_up(dev); |
1063 | #endif | 1063 | #endif |
1064 | atomic_inc(&net->ipv4.dev_addr_genid); | 1064 | atomic_inc(&net->ipv4.dev_addr_genid); |
1065 | rt_cache_flush(dev_net(dev), -1); | 1065 | rt_cache_flush(dev_net(dev)); |
1066 | break; | 1066 | break; |
1067 | case NETDEV_DOWN: | 1067 | case NETDEV_DOWN: |
1068 | fib_disable_ip(dev, 0, 0); | 1068 | fib_disable_ip(dev, 0); |
1069 | break; | 1069 | break; |
1070 | case NETDEV_CHANGEMTU: | 1070 | case NETDEV_CHANGEMTU: |
1071 | case NETDEV_CHANGE: | 1071 | case NETDEV_CHANGE: |
1072 | rt_cache_flush(dev_net(dev), 0); | 1072 | rt_cache_flush(dev_net(dev)); |
1073 | break; | 1073 | break; |
1074 | case NETDEV_UNREGISTER_BATCH: | 1074 | case NETDEV_UNREGISTER_BATCH: |
1075 | break; | 1075 | break; |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index a83d74e498d2..274309d3aded 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -259,7 +259,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule) | |||
259 | 259 | ||
260 | static void fib4_rule_flush_cache(struct fib_rules_ops *ops) | 260 | static void fib4_rule_flush_cache(struct fib_rules_ops *ops) |
261 | { | 261 | { |
262 | rt_cache_flush(ops->fro_net, -1); | 262 | rt_cache_flush(ops->fro_net); |
263 | } | 263 | } |
264 | 264 | ||
265 | static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = { | 265 | static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = { |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 57bd978483e1..d1b93595b4a7 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1286,7 +1286,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) | |||
1286 | 1286 | ||
1287 | fib_release_info(fi_drop); | 1287 | fib_release_info(fi_drop); |
1288 | if (state & FA_S_ACCESSED) | 1288 | if (state & FA_S_ACCESSED) |
1289 | rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); | 1289 | rt_cache_flush(cfg->fc_nlinfo.nl_net); |
1290 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, | 1290 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, |
1291 | tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE); | 1291 | tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE); |
1292 | 1292 | ||
@@ -1333,7 +1333,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) | |||
1333 | list_add_tail_rcu(&new_fa->fa_list, | 1333 | list_add_tail_rcu(&new_fa->fa_list, |
1334 | (fa ? &fa->fa_list : fa_head)); | 1334 | (fa ? &fa->fa_list : fa_head)); |
1335 | 1335 | ||
1336 | rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); | 1336 | rt_cache_flush(cfg->fc_nlinfo.nl_net); |
1337 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, | 1337 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, |
1338 | &cfg->fc_nlinfo, 0); | 1338 | &cfg->fc_nlinfo, 0); |
1339 | succeeded: | 1339 | succeeded: |
@@ -1708,7 +1708,7 @@ int fib_table_delete(struct fib_table *tb, struct fib_config *cfg) | |||
1708 | trie_leaf_remove(t, l); | 1708 | trie_leaf_remove(t, l); |
1709 | 1709 | ||
1710 | if (fa->fa_state & FA_S_ACCESSED) | 1710 | if (fa->fa_state & FA_S_ACCESSED) |
1711 | rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); | 1711 | rt_cache_flush(cfg->fc_nlinfo.nl_net); |
1712 | 1712 | ||
1713 | fib_release_info(fa->fa_info); | 1713 | fib_release_info(fa->fa_info); |
1714 | alias_free_mem_rcu(fa); | 1714 | alias_free_mem_rcu(fa); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 82cf2a722b23..fd9af60397b5 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 | { |
@@ -447,27 +442,9 @@ static inline bool rt_is_expired(const struct rtable *rth) | |||
447 | return rth->rt_genid != rt_genid(dev_net(rth->dst.dev)); | 442 | return rth->rt_genid != rt_genid(dev_net(rth->dst.dev)); |
448 | } | 443 | } |
449 | 444 | ||
450 | /* | 445 | void rt_cache_flush(struct net *net) |
451 | * Perturbation of rt_genid by a small quantity [1..256] | ||
452 | * Using 8 bits of shuffling ensure we can call rt_cache_invalidate() | ||
453 | * many times (2^24) without giving recent rt_genid. | ||
454 | * Jenkins hash is strong enough that litle changes of rt_genid are OK. | ||
455 | */ | ||
456 | static void rt_cache_invalidate(struct net *net) | ||
457 | { | 446 | { |
458 | unsigned char shuffle; | 447 | rt_genid_bump(net); |
459 | |||
460 | get_random_bytes(&shuffle, sizeof(shuffle)); | ||
461 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); | ||
462 | } | ||
463 | |||
464 | /* | ||
465 | * delay < 0 : invalidate cache (fast : entries will be deleted later) | ||
466 | * delay >= 0 : invalidate & flush cache (can be long) | ||
467 | */ | ||
468 | void rt_cache_flush(struct net *net, int delay) | ||
469 | { | ||
470 | rt_cache_invalidate(net); | ||
471 | } | 448 | } |
472 | 449 | ||
473 | static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, | 450 | static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, |
@@ -2345,7 +2322,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2345 | 2322 | ||
2346 | void ip_rt_multicast_event(struct in_device *in_dev) | 2323 | void ip_rt_multicast_event(struct in_device *in_dev) |
2347 | { | 2324 | { |
2348 | rt_cache_flush(dev_net(in_dev->dev), 0); | 2325 | rt_cache_flush(dev_net(in_dev->dev)); |
2349 | } | 2326 | } |
2350 | 2327 | ||
2351 | #ifdef CONFIG_SYSCTL | 2328 | #ifdef CONFIG_SYSCTL |
@@ -2354,16 +2331,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, | |||
2354 | size_t *lenp, loff_t *ppos) | 2331 | size_t *lenp, loff_t *ppos) |
2355 | { | 2332 | { |
2356 | if (write) { | 2333 | if (write) { |
2357 | int flush_delay; | 2334 | rt_cache_flush((struct net *)__ctl->extra1); |
2358 | ctl_table ctl; | ||
2359 | struct net *net; | ||
2360 | |||
2361 | memcpy(&ctl, __ctl, sizeof(ctl)); | ||
2362 | ctl.data = &flush_delay; | ||
2363 | proc_dointvec(&ctl, write, buffer, lenp, ppos); | ||
2364 | |||
2365 | net = (struct net *)__ctl->extra1; | ||
2366 | rt_cache_flush(net, flush_delay); | ||
2367 | return 0; | 2335 | return 0; |
2368 | } | 2336 | } |
2369 | 2337 | ||
@@ -2533,8 +2501,7 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { | |||
2533 | 2501 | ||
2534 | static __net_init int rt_genid_init(struct net *net) | 2502 | static __net_init int rt_genid_init(struct net *net) |
2535 | { | 2503 | { |
2536 | get_random_bytes(&net->ipv4.rt_genid, | 2504 | atomic_set(&net->rt_genid, 0); |
2537 | sizeof(net->ipv4.rt_genid)); | ||
2538 | get_random_bytes(&net->ipv4.dev_addr_genid, | 2505 | get_random_bytes(&net->ipv4.dev_addr_genid, |
2539 | sizeof(net->ipv4.dev_addr_genid)); | 2506 | sizeof(net->ipv4.dev_addr_genid)); |
2540 | return 0; | 2507 | return 0; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 2109ff4a1daf..5f6419341821 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1762,8 +1762,14 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1762 | } | 1762 | } |
1763 | 1763 | ||
1764 | #ifdef CONFIG_NET_DMA | 1764 | #ifdef CONFIG_NET_DMA |
1765 | if (tp->ucopy.dma_chan) | 1765 | if (tp->ucopy.dma_chan) { |
1766 | dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); | 1766 | if (tp->rcv_wnd == 0 && |
1767 | !skb_queue_empty(&sk->sk_async_wait_queue)) { | ||
1768 | tcp_service_net_dma(sk, true); | ||
1769 | tcp_cleanup_rbuf(sk, copied); | ||
1770 | } else | ||
1771 | dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); | ||
1772 | } | ||
1767 | #endif | 1773 | #endif |
1768 | if (copied >= target) { | 1774 | if (copied >= target) { |
1769 | /* Do not sleep, just process backlog. */ | 1775 | /* Do not sleep, just process backlog. */ |
@@ -2325,10 +2331,17 @@ static int tcp_repair_options_est(struct tcp_sock *tp, | |||
2325 | tp->rx_opt.mss_clamp = opt.opt_val; | 2331 | tp->rx_opt.mss_clamp = opt.opt_val; |
2326 | break; | 2332 | break; |
2327 | case TCPOPT_WINDOW: | 2333 | case TCPOPT_WINDOW: |
2328 | if (opt.opt_val > 14) | 2334 | { |
2329 | return -EFBIG; | 2335 | u16 snd_wscale = opt.opt_val & 0xFFFF; |
2336 | u16 rcv_wscale = opt.opt_val >> 16; | ||
2337 | |||
2338 | if (snd_wscale > 14 || rcv_wscale > 14) | ||
2339 | return -EFBIG; | ||
2330 | 2340 | ||
2331 | tp->rx_opt.snd_wscale = opt.opt_val; | 2341 | tp->rx_opt.snd_wscale = snd_wscale; |
2342 | tp->rx_opt.rcv_wscale = rcv_wscale; | ||
2343 | tp->rx_opt.wscale_ok = 1; | ||
2344 | } | ||
2332 | break; | 2345 | break; |
2333 | case TCPOPT_SACK_PERM: | 2346 | case TCPOPT_SACK_PERM: |
2334 | if (opt.opt_val != 0) | 2347 | if (opt.opt_val != 0) |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6e38c6c23caa..d377f4854cb8 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4661,7 +4661,7 @@ queue_and_out: | |||
4661 | 4661 | ||
4662 | if (eaten > 0) | 4662 | if (eaten > 0) |
4663 | kfree_skb_partial(skb, fragstolen); | 4663 | kfree_skb_partial(skb, fragstolen); |
4664 | else if (!sock_flag(sk, SOCK_DEAD)) | 4664 | if (!sock_flag(sk, SOCK_DEAD)) |
4665 | sk->sk_data_ready(sk, 0); | 4665 | sk->sk_data_ready(sk, 0); |
4666 | return; | 4666 | return; |
4667 | } | 4667 | } |
@@ -5556,8 +5556,7 @@ no_ack: | |||
5556 | #endif | 5556 | #endif |
5557 | if (eaten) | 5557 | if (eaten) |
5558 | kfree_skb_partial(skb, fragstolen); | 5558 | kfree_skb_partial(skb, fragstolen); |
5559 | else | 5559 | sk->sk_data_ready(sk, 0); |
5560 | sk->sk_data_ready(sk, 0); | ||
5561 | return 0; | 5560 | return 0; |
5562 | } | 5561 | } |
5563 | } | 5562 | } |
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/route.c b/net/ipv6/route.c index 8e80fd279100..854e4018d205 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -226,7 +226,7 @@ static 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 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 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 | } |
@@ -1031,6 +1032,13 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie) | |||
1031 | 1032 | ||
1032 | rt = (struct rt6_info *) dst; | 1033 | rt = (struct rt6_info *) dst; |
1033 | 1034 | ||
1035 | /* All IPV6 dsts are created with ->obsolete set to the value | ||
1036 | * DST_OBSOLETE_FORCE_CHK which forces validation calls down | ||
1037 | * into this function always. | ||
1038 | */ | ||
1039 | if (rt->rt6i_genid != rt_genid(dev_net(rt->dst.dev))) | ||
1040 | return NULL; | ||
1041 | |||
1034 | if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie)) { | 1042 | if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie)) { |
1035 | if (rt->rt6i_peer_genid != rt6_peer_genid()) { | 1043 | if (rt->rt6i_peer_genid != rt6_peer_genid()) { |
1036 | if (!rt6_has_peer(rt)) | 1044 | if (!rt6_has_peer(rt)) |
@@ -1397,8 +1405,6 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1397 | goto out; | 1405 | goto out; |
1398 | } | 1406 | } |
1399 | 1407 | ||
1400 | rt->dst.obsolete = -1; | ||
1401 | |||
1402 | if (cfg->fc_flags & RTF_EXPIRES) | 1408 | if (cfg->fc_flags & RTF_EXPIRES) |
1403 | rt6_set_expires(rt, jiffies + | 1409 | rt6_set_expires(rt, jiffies + |
1404 | clock_t_to_jiffies(cfg->fc_expires)); | 1410 | clock_t_to_jiffies(cfg->fc_expires)); |
@@ -2080,7 +2086,6 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
2080 | rt->dst.input = ip6_input; | 2086 | rt->dst.input = ip6_input; |
2081 | rt->dst.output = ip6_output; | 2087 | rt->dst.output = ip6_output; |
2082 | rt->rt6i_idev = idev; | 2088 | rt->rt6i_idev = idev; |
2083 | rt->dst.obsolete = -1; | ||
2084 | 2089 | ||
2085 | rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; | 2090 | rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; |
2086 | if (anycast) | 2091 | if (anycast) |
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 e4723d31fdd5..211a21217045 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/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 5a2aa17e4d3c..387848e90078 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -585,6 +585,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
585 | xfrm_pol_hold(policy); | 585 | xfrm_pol_hold(policy); |
586 | net->xfrm.policy_count[dir]++; | 586 | net->xfrm.policy_count[dir]++; |
587 | atomic_inc(&flow_cache_genid); | 587 | atomic_inc(&flow_cache_genid); |
588 | rt_genid_bump(net); | ||
588 | if (delpol) | 589 | if (delpol) |
589 | __xfrm_policy_unlink(delpol, dir); | 590 | __xfrm_policy_unlink(delpol, dir); |
590 | policy->index = delpol ? delpol->index : xfrm_gen_index(net, dir); | 591 | policy->index = delpol ? delpol->index : xfrm_gen_index(net, dir); |
@@ -1763,7 +1764,7 @@ static struct dst_entry *make_blackhole(struct net *net, u16 family, | |||
1763 | 1764 | ||
1764 | if (!afinfo) { | 1765 | if (!afinfo) { |
1765 | dst_release(dst_orig); | 1766 | dst_release(dst_orig); |
1766 | ret = ERR_PTR(-EINVAL); | 1767 | return ERR_PTR(-EINVAL); |
1767 | } else { | 1768 | } else { |
1768 | ret = afinfo->blackhole_route(net, dst_orig); | 1769 | ret = afinfo->blackhole_route(net, dst_orig); |
1769 | } | 1770 | } |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index e75d8e47f35c..289f4bf18ff0 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/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) |