Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0302-4.9.203-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (hide annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (3 years, 10 months ago) by niro
File size: 220639 byte(s)
-added kerenl-alx-legacy pkg
1 niro 3608 diff --git a/Makefile b/Makefile
2     index 1e322e669301..174c0e2526ac 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 202
9     +SUBLEVEL = 203
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h
14     index 17ae0f3efac8..005bf4ff1b4c 100644
15     --- a/arch/arm/boot/compressed/libfdt_env.h
16     +++ b/arch/arm/boot/compressed/libfdt_env.h
17     @@ -5,6 +5,8 @@
18     #include <linux/string.h>
19     #include <asm/byteorder.h>
20    
21     +#define INT_MAX ((int)(~0U>>1))
22     +
23     typedef __be16 fdt16_t;
24     typedef __be32 fdt32_t;
25     typedef __be64 fdt64_t;
26     diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
27     index e82432c79f85..3f3ad09c7cd5 100644
28     --- a/arch/arm/boot/dts/am335x-evm.dts
29     +++ b/arch/arm/boot/dts/am335x-evm.dts
30     @@ -701,6 +701,7 @@
31     pinctrl-0 = <&cpsw_default>;
32     pinctrl-1 = <&cpsw_sleep>;
33     status = "okay";
34     + slaves = <1>;
35     };
36    
37     &davinci_mdio {
38     @@ -708,15 +709,14 @@
39     pinctrl-0 = <&davinci_mdio_default>;
40     pinctrl-1 = <&davinci_mdio_sleep>;
41     status = "okay";
42     -};
43    
44     -&cpsw_emac0 {
45     - phy_id = <&davinci_mdio>, <0>;
46     - phy-mode = "rgmii-txid";
47     + ethphy0: ethernet-phy@0 {
48     + reg = <0>;
49     + };
50     };
51    
52     -&cpsw_emac1 {
53     - phy_id = <&davinci_mdio>, <1>;
54     +&cpsw_emac0 {
55     + phy-handle = <&ethphy0>;
56     phy-mode = "rgmii-txid";
57     };
58    
59     diff --git a/arch/arm/boot/dts/arm-realview-eb.dtsi b/arch/arm/boot/dts/arm-realview-eb.dtsi
60     index e2e9599596e2..05379b6c1c13 100644
61     --- a/arch/arm/boot/dts/arm-realview-eb.dtsi
62     +++ b/arch/arm/boot/dts/arm-realview-eb.dtsi
63     @@ -334,7 +334,7 @@
64     clock-names = "uartclk", "apb_pclk";
65     };
66    
67     - ssp: ssp@1000d000 {
68     + ssp: spi@1000d000 {
69     compatible = "arm,pl022", "arm,primecell";
70     reg = <0x1000d000 0x1000>;
71     clocks = <&sspclk>, <&pclk>;
72     diff --git a/arch/arm/boot/dts/arm-realview-pb1176.dts b/arch/arm/boot/dts/arm-realview-pb1176.dts
73     index c789564f2803..c1fd5615ddfe 100644
74     --- a/arch/arm/boot/dts/arm-realview-pb1176.dts
75     +++ b/arch/arm/boot/dts/arm-realview-pb1176.dts
76     @@ -343,7 +343,7 @@
77     clock-names = "apb_pclk";
78     };
79    
80     - pb1176_ssp: ssp@1010b000 {
81     + pb1176_ssp: spi@1010b000 {
82     compatible = "arm,pl022", "arm,primecell";
83     reg = <0x1010b000 0x1000>;
84     interrupt-parent = <&intc_dc1176>;
85     diff --git a/arch/arm/boot/dts/arm-realview-pb11mp.dts b/arch/arm/boot/dts/arm-realview-pb11mp.dts
86     index 3944765ac4b0..e306f1cceb4e 100644
87     --- a/arch/arm/boot/dts/arm-realview-pb11mp.dts
88     +++ b/arch/arm/boot/dts/arm-realview-pb11mp.dts
89     @@ -480,7 +480,7 @@
90     clock-names = "uartclk", "apb_pclk";
91     };
92    
93     - ssp@1000d000 {
94     + spi@1000d000 {
95     compatible = "arm,pl022", "arm,primecell";
96     reg = <0x1000d000 0x1000>;
97     interrupt-parent = <&intc_pb11mp>;
98     diff --git a/arch/arm/boot/dts/arm-realview-pbx.dtsi b/arch/arm/boot/dts/arm-realview-pbx.dtsi
99     index aeb49c4bd773..2bf3958b2e6b 100644
100     --- a/arch/arm/boot/dts/arm-realview-pbx.dtsi
101     +++ b/arch/arm/boot/dts/arm-realview-pbx.dtsi
102     @@ -318,7 +318,7 @@
103     clock-names = "uartclk", "apb_pclk";
104     };
105    
106     - ssp: ssp@1000d000 {
107     + ssp: spi@1000d000 {
108     compatible = "arm,pl022", "arm,primecell";
109     reg = <0x1000d000 0x1000>;
110     clocks = <&sspclk>, <&pclk>;
111     diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
112     index b3501ae2a3bd..4fba898b8f4f 100644
113     --- a/arch/arm/boot/dts/at91sam9g45.dtsi
114     +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
115     @@ -546,7 +546,7 @@
116     };
117     };
118    
119     - uart1 {
120     + usart1 {
121     pinctrl_usart1: usart1-0 {
122     atmel,pins =
123     <AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB4 periph A with pullup */
124     diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
125     index af3cb633135f..ee32315e3d3a 100644
126     --- a/arch/arm/boot/dts/dove-cubox.dts
127     +++ b/arch/arm/boot/dts/dove-cubox.dts
128     @@ -86,7 +86,7 @@
129     status = "okay";
130     clock-frequency = <100000>;
131    
132     - si5351: clock-generator {
133     + si5351: clock-generator@60 {
134     compatible = "silabs,si5351a-msop";
135     reg = <0x60>;
136     #address-cells = <1>;
137     diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
138     index 698d58cea20d..11342aeccb73 100644
139     --- a/arch/arm/boot/dts/dove.dtsi
140     +++ b/arch/arm/boot/dts/dove.dtsi
141     @@ -152,7 +152,7 @@
142     0xffffe000 MBUS_ID(0x03, 0x01) 0 0x0000800 /* CESA SRAM 2k */
143     0xfffff000 MBUS_ID(0x0d, 0x00) 0 0x0000800>; /* PMU SRAM 2k */
144    
145     - spi0: spi-ctrl@10600 {
146     + spi0: spi@10600 {
147     compatible = "marvell,orion-spi";
148     #address-cells = <1>;
149     #size-cells = <0>;
150     @@ -165,7 +165,7 @@
151     status = "disabled";
152     };
153    
154     - i2c: i2c-ctrl@11000 {
155     + i2c: i2c@11000 {
156     compatible = "marvell,mv64xxx-i2c";
157     reg = <0x11000 0x20>;
158     #address-cells = <1>;
159     @@ -215,7 +215,7 @@
160     status = "disabled";
161     };
162    
163     - spi1: spi-ctrl@14600 {
164     + spi1: spi@14600 {
165     compatible = "marvell,orion-spi";
166     #address-cells = <1>;
167     #size-cells = <0>;
168     diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
169     index 6098dacd09f1..1b2709af2a42 100644
170     --- a/arch/arm/boot/dts/exynos5250-arndale.dts
171     +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
172     @@ -170,6 +170,8 @@
173     reg = <0x66>;
174     interrupt-parent = <&gpx3>;
175     interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
176     + pinctrl-names = "default";
177     + pinctrl-0 = <&s5m8767_irq>;
178    
179     vinb1-supply = <&main_dc_reg>;
180     vinb2-supply = <&main_dc_reg>;
181     @@ -547,6 +549,13 @@
182     cap-sd-highspeed;
183     };
184    
185     +&pinctrl_0 {
186     + s5m8767_irq: s5m8767-irq {
187     + samsung,pins = "gpx3-2";
188     + samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
189     + };
190     +};
191     +
192     &rtc {
193     status = "okay";
194     };
195     diff --git a/arch/arm/boot/dts/exynos5250-snow-rev5.dts b/arch/arm/boot/dts/exynos5250-snow-rev5.dts
196     index 90560c316f64..cb986175b69b 100644
197     --- a/arch/arm/boot/dts/exynos5250-snow-rev5.dts
198     +++ b/arch/arm/boot/dts/exynos5250-snow-rev5.dts
199     @@ -23,6 +23,14 @@
200    
201     samsung,model = "Snow-I2S-MAX98090";
202     samsung,audio-codec = <&max98090>;
203     +
204     + cpu {
205     + sound-dai = <&i2s0 0>;
206     + };
207     +
208     + codec {
209     + sound-dai = <&max98090 0>, <&hdmi>;
210     + };
211     };
212     };
213    
214     @@ -34,6 +42,9 @@
215     interrupt-parent = <&gpx0>;
216     pinctrl-names = "default";
217     pinctrl-0 = <&max98090_irq>;
218     + clocks = <&pmu_system_controller 0>;
219     + clock-names = "mclk";
220     + #sound-dai-cells = <1>;
221     };
222     };
223    
224     diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
225     index 8b754ae8c8f7..c9d379b1a166 100644
226     --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
227     +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
228     @@ -302,6 +302,7 @@
229     regulator-name = "vdd_1v35";
230     regulator-min-microvolt = <1350000>;
231     regulator-max-microvolt = <1350000>;
232     + regulator-always-on;
233     regulator-boot-on;
234     regulator-state-mem {
235     regulator-on-in-suspend;
236     @@ -323,6 +324,7 @@
237     regulator-name = "vdd_2v";
238     regulator-min-microvolt = <2000000>;
239     regulator-max-microvolt = <2000000>;
240     + regulator-always-on;
241     regulator-boot-on;
242     regulator-state-mem {
243     regulator-on-in-suspend;
244     @@ -333,6 +335,7 @@
245     regulator-name = "vdd_1v8";
246     regulator-min-microvolt = <1800000>;
247     regulator-max-microvolt = <1800000>;
248     + regulator-always-on;
249     regulator-boot-on;
250     regulator-state-mem {
251     regulator-on-in-suspend;
252     diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
253     index 1f90df2d7ecd..ae58b8d6f614 100644
254     --- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
255     +++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
256     @@ -302,6 +302,7 @@
257     regulator-name = "vdd_1v35";
258     regulator-min-microvolt = <1350000>;
259     regulator-max-microvolt = <1350000>;
260     + regulator-always-on;
261     regulator-boot-on;
262     regulator-state-mem {
263     regulator-on-in-suspend;
264     @@ -323,6 +324,7 @@
265     regulator-name = "vdd_2v";
266     regulator-min-microvolt = <2000000>;
267     regulator-max-microvolt = <2000000>;
268     + regulator-always-on;
269     regulator-boot-on;
270     regulator-state-mem {
271     regulator-on-in-suspend;
272     @@ -333,6 +335,7 @@
273     regulator-name = "vdd_1v8";
274     regulator-min-microvolt = <1800000>;
275     regulator-max-microvolt = <1800000>;
276     + regulator-always-on;
277     regulator-boot-on;
278     regulator-state-mem {
279     regulator-on-in-suspend;
280     diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
281     index 0d20aadc78bb..5fa3111731cb 100644
282     --- a/arch/arm/boot/dts/lpc32xx.dtsi
283     +++ b/arch/arm/boot/dts/lpc32xx.dtsi
284     @@ -179,7 +179,7 @@
285     * ssp0 and spi1 are shared pins;
286     * enable one in your board dts, as needed.
287     */
288     - ssp0: ssp@20084000 {
289     + ssp0: spi@20084000 {
290     compatible = "arm,pl022", "arm,primecell";
291     reg = <0x20084000 0x1000>;
292     interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
293     @@ -199,7 +199,7 @@
294     * ssp1 and spi2 are shared pins;
295     * enable one in your board dts, as needed.
296     */
297     - ssp1: ssp@2008c000 {
298     + ssp1: spi@2008c000 {
299     compatible = "arm,pl022", "arm,primecell";
300     reg = <0x2008c000 0x1000>;
301     interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
302     diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
303     index b3a8b1f24499..719150693449 100644
304     --- a/arch/arm/boot/dts/omap3-gta04.dtsi
305     +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
306     @@ -28,6 +28,7 @@
307    
308     aliases {
309     display0 = &lcd;
310     + display1 = &tv0;
311     };
312    
313     gpio-keys {
314     @@ -70,7 +71,7 @@
315     #sound-dai-cells = <0>;
316     };
317    
318     - spi_lcd {
319     + spi_lcd: spi_lcd {
320     compatible = "spi-gpio";
321     #address-cells = <0x1>;
322     #size-cells = <0x0>;
323     @@ -122,7 +123,7 @@
324     };
325    
326     tv0: connector {
327     - compatible = "svideo-connector";
328     + compatible = "composite-video-connector";
329     label = "tv";
330    
331     port {
332     @@ -134,7 +135,7 @@
333    
334     tv_amp: opa362 {
335     compatible = "ti,opa362";
336     - enable-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
337     + enable-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; /* GPIO_23 to enable video out amplifier */
338    
339     ports {
340     #address-cells = <1>;
341     @@ -273,6 +274,13 @@
342     OMAP3_CORE1_IOPAD(0x2134, PIN_INPUT_PULLUP | MUX_MODE4) /* gpio112 */
343     >;
344     };
345     +
346     + penirq_pins: pinmux_penirq_pins {
347     + pinctrl-single,pins = <
348     + /* here we could enable to wakeup the cpu from suspend by a pen touch */
349     + OMAP3_CORE1_IOPAD(0x2194, PIN_INPUT_PULLUP | MUX_MODE4) /* gpio160 */
350     + >;
351     + };
352     };
353    
354     &omap3_pmx_core2 {
355     @@ -410,10 +418,19 @@
356     tsc2007@48 {
357     compatible = "ti,tsc2007";
358     reg = <0x48>;
359     + pinctrl-names = "default";
360     + pinctrl-0 = <&penirq_pins>;
361     interrupt-parent = <&gpio6>;
362     interrupts = <0 IRQ_TYPE_EDGE_FALLING>; /* GPIO_160 */
363     - gpios = <&gpio6 0 GPIO_ACTIVE_LOW>;
364     + gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* GPIO_160 */
365     ti,x-plate-ohms = <600>;
366     + touchscreen-size-x = <480>;
367     + touchscreen-size-y = <640>;
368     + touchscreen-max-pressure = <1000>;
369     + touchscreen-fuzz-x = <3>;
370     + touchscreen-fuzz-y = <8>;
371     + touchscreen-fuzz-pressure = <10>;
372     + touchscreen-inverted-y;
373     };
374    
375     /* RFID EEPROM */
376     @@ -519,6 +536,12 @@
377     regulator-max-microvolt = <3150000>;
378     };
379    
380     +/* Needed to power the DPI pins */
381     +
382     +&vpll2 {
383     + regulator-always-on;
384     +};
385     +
386     &dss {
387     pinctrl-names = "default";
388     pinctrl-0 = < &dss_dpi_pins >;
389     @@ -539,10 +562,14 @@
390    
391     vdda-supply = <&vdac>;
392    
393     + #address-cells = <1>;
394     + #size-cells = <0>;
395     +
396     port {
397     + reg = <0>;
398     venc_out: endpoint {
399     remote-endpoint = <&opa_in>;
400     - ti,channels = <2>;
401     + ti,channels = <1>;
402     ti,invert-polarity;
403     };
404     };
405     @@ -586,22 +613,22 @@
406    
407     bootloaders@80000 {
408     label = "U-Boot";
409     - reg = <0x80000 0x1e0000>;
410     + reg = <0x80000 0x1c0000>;
411     };
412    
413     - bootloaders_env@260000 {
414     + bootloaders_env@240000 {
415     label = "U-Boot Env";
416     - reg = <0x260000 0x20000>;
417     + reg = <0x240000 0x40000>;
418     };
419    
420     kernel@280000 {
421     label = "Kernel";
422     - reg = <0x280000 0x400000>;
423     + reg = <0x280000 0x600000>;
424     };
425    
426     - filesystem@680000 {
427     + filesystem@880000 {
428     label = "File System";
429     - reg = <0x680000 0xf980000>;
430     + reg = <0x880000 0>; /* 0 = MTDPART_SIZ_FULL */
431     };
432     };
433     };
434     diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi
435     index 4caadb253249..e412373fe7bf 100644
436     --- a/arch/arm/boot/dts/omap5-board-common.dtsi
437     +++ b/arch/arm/boot/dts/omap5-board-common.dtsi
438     @@ -694,6 +694,11 @@
439     vbus-supply = <&smps10_out1_reg>;
440     };
441    
442     +&dwc3 {
443     + extcon = <&extcon_usb3>;
444     + dr_mode = "otg";
445     +};
446     +
447     &mcspi1 {
448    
449     };
450     diff --git a/arch/arm/boot/dts/orion5x-linkstation.dtsi b/arch/arm/boot/dts/orion5x-linkstation.dtsi
451     index ed456ab35fd8..c1bc8376d4eb 100644
452     --- a/arch/arm/boot/dts/orion5x-linkstation.dtsi
453     +++ b/arch/arm/boot/dts/orion5x-linkstation.dtsi
454     @@ -156,7 +156,7 @@
455     &i2c {
456     status = "okay";
457    
458     - rtc {
459     + rtc@32 {
460     compatible = "ricoh,rs5c372a";
461     reg = <0x32>;
462     };
463     diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi
464     index 9e73dc6b3ed3..0e1320afa156 100644
465     --- a/arch/arm/boot/dts/pxa27x.dtsi
466     +++ b/arch/arm/boot/dts/pxa27x.dtsi
467     @@ -70,7 +70,7 @@
468     clocks = <&clks CLK_PWM1>;
469     };
470    
471     - pwri2c: i2c@40f000180 {
472     + pwri2c: i2c@40f00180 {
473     compatible = "mrvl,pxa-i2c";
474     reg = <0x40f00180 0x24>;
475     interrupts = <6>;
476     diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi
477     index 4b7d97275c62..5ee84e3cb3e9 100644
478     --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
479     +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
480     @@ -211,7 +211,7 @@
481    
482     saw0: regulator@b089000 {
483     compatible = "qcom,saw2";
484     - reg = <0x02089000 0x1000>, <0x0b009000 0x1000>;
485     + reg = <0x0b089000 0x1000>, <0x0b009000 0x1000>;
486     regulator;
487     };
488    
489     diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi
490     index a935523a1eb8..147c73f68f1d 100644
491     --- a/arch/arm/boot/dts/rk3036.dtsi
492     +++ b/arch/arm/boot/dts/rk3036.dtsi
493     @@ -744,7 +744,7 @@
494     /* no rts / cts for uart2 */
495     };
496    
497     - spi {
498     + spi-pins {
499     spi_txd:spi-txd {
500     rockchip,pins = <1 29 RK_FUNC_3 &pcfg_pull_default>;
501     };
502     diff --git a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts
503     index afea3645ada4..89d55894d916 100644
504     --- a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts
505     +++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts
506     @@ -88,7 +88,7 @@
507     status = "okay";
508     speed-mode = <0>;
509    
510     - adxl345: adxl345@0 {
511     + adxl345: adxl345@53 {
512     compatible = "adi,adxl345";
513     reg = <0x53>;
514    
515     diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
516     index d309314f3a36..5f1769209526 100644
517     --- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
518     +++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
519     @@ -188,7 +188,7 @@
520     <0xa0410100 0x100>;
521     };
522    
523     - scu@a04100000 {
524     + scu@a0410000 {
525     compatible = "arm,cortex-a9-scu";
526     reg = <0xa0410000 0x100>;
527     };
528     @@ -864,7 +864,7 @@
529     power-domains = <&pm_domains DOMAIN_VAPE>;
530     };
531    
532     - ssp@80002000 {
533     + spi@80002000 {
534     compatible = "arm,pl022", "arm,primecell";
535     reg = <0x80002000 0x1000>;
536     interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
537     @@ -878,7 +878,7 @@
538     power-domains = <&pm_domains DOMAIN_VAPE>;
539     };
540    
541     - ssp@80003000 {
542     + spi@80003000 {
543     compatible = "arm,pl022", "arm,primecell";
544     reg = <0x80003000 0x1000>;
545     interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
546     diff --git a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
547     index 5c5cea232743..1ec193b0c506 100644
548     --- a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
549     +++ b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
550     @@ -607,16 +607,20 @@
551    
552     mcde {
553     lcd_default_mode: lcd_default {
554     - default_mux {
555     + default_mux1 {
556     /* Mux in VSI0 and all the data lines */
557     function = "lcd";
558     groups =
559     "lcdvsi0_a_1", /* VSI0 for LCD */
560     "lcd_d0_d7_a_1", /* Data lines */
561     "lcd_d8_d11_a_1", /* TV-out */
562     - "lcdaclk_b_1", /* Clock line for TV-out */
563     "lcdvsi1_a_1"; /* VSI1 for HDMI */
564     };
565     + default_mux2 {
566     + function = "lcda";
567     + groups =
568     + "lcdaclk_b_1"; /* Clock line for TV-out */
569     + };
570     default_cfg1 {
571     pins =
572     "GPIO68_E1", /* VSI0 */
573     diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi
574     index ece222d51717..cf8d03bc42c1 100644
575     --- a/arch/arm/boot/dts/ste-hrefprev60.dtsi
576     +++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi
577     @@ -57,7 +57,7 @@
578     };
579     };
580    
581     - ssp@80002000 {
582     + spi@80002000 {
583     /*
584     * On the first generation boards, this SSP/SPI port was connected
585     * to the AB8500.
586     diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
587     index 386eee6de232..272d36c3d223 100644
588     --- a/arch/arm/boot/dts/ste-snowball.dts
589     +++ b/arch/arm/boot/dts/ste-snowball.dts
590     @@ -386,7 +386,7 @@
591     pinctrl-1 = <&i2c3_sleep_mode>;
592     };
593    
594     - ssp@80002000 {
595     + spi@80002000 {
596     pinctrl-names = "default";
597     pinctrl-0 = <&ssp0_snowball_mode>;
598     };
599     diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts
600     index 2f5107ffeef0..ea6768b96a9d 100644
601     --- a/arch/arm/boot/dts/ste-u300.dts
602     +++ b/arch/arm/boot/dts/ste-u300.dts
603     @@ -441,7 +441,7 @@
604     dma-names = "rx";
605     };
606    
607     - spi: ssp@c0006000 {
608     + spi: spi@c0006000 {
609     compatible = "arm,pl022", "arm,primecell";
610     reg = <0xc0006000 0x1000>;
611     interrupt-parent = <&vica>;
612     diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
613     index b4bfa5586c23..23d4c837b87a 100644
614     --- a/arch/arm/boot/dts/tegra20-paz00.dts
615     +++ b/arch/arm/boot/dts/tegra20-paz00.dts
616     @@ -521,10 +521,10 @@
617     gpio-keys {
618     compatible = "gpio-keys";
619    
620     - power {
621     - label = "Power";
622     + wakeup {
623     + label = "Wakeup";
624     gpios = <&gpio TEGRA_GPIO(J, 7) GPIO_ACTIVE_LOW>;
625     - linux,code = <KEY_POWER>;
626     + linux,code = <KEY_WAKEUP>;
627     wakeup-source;
628     };
629     };
630     diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
631     index 192b95177aac..826bdd0b8a25 100644
632     --- a/arch/arm/boot/dts/tegra30-apalis.dtsi
633     +++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
634     @@ -147,14 +147,14 @@
635    
636     /* Apalis MMC1 */
637     sdmmc3_clk_pa6 {
638     - nvidia,pins = "sdmmc3_clk_pa6",
639     - "sdmmc3_cmd_pa7";
640     + nvidia,pins = "sdmmc3_clk_pa6";
641     nvidia,function = "sdmmc3";
642     nvidia,pull = <TEGRA_PIN_PULL_NONE>;
643     nvidia,tristate = <TEGRA_PIN_DISABLE>;
644     };
645     sdmmc3_dat0_pb7 {
646     - nvidia,pins = "sdmmc3_dat0_pb7",
647     + nvidia,pins = "sdmmc3_cmd_pa7",
648     + "sdmmc3_dat0_pb7",
649     "sdmmc3_dat1_pb6",
650     "sdmmc3_dat2_pb5",
651     "sdmmc3_dat3_pb4",
652     diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
653     index 5030065cbdfe..ad30d2a51af1 100644
654     --- a/arch/arm/boot/dts/tegra30.dtsi
655     +++ b/arch/arm/boot/dts/tegra30.dtsi
656     @@ -823,7 +823,7 @@
657     nvidia,elastic-limit = <16>;
658     nvidia,term-range-adj = <6>;
659     nvidia,xcvr-setup = <51>;
660     - nvidia.xcvr-setup-use-fuses;
661     + nvidia,xcvr-setup-use-fuses;
662     nvidia,xcvr-lsfslew = <1>;
663     nvidia,xcvr-lsrslew = <1>;
664     nvidia,xcvr-hsslew = <32>;
665     @@ -860,7 +860,7 @@
666     nvidia,elastic-limit = <16>;
667     nvidia,term-range-adj = <6>;
668     nvidia,xcvr-setup = <51>;
669     - nvidia.xcvr-setup-use-fuses;
670     + nvidia,xcvr-setup-use-fuses;
671     nvidia,xcvr-lsfslew = <2>;
672     nvidia,xcvr-lsrslew = <2>;
673     nvidia,xcvr-hsslew = <32>;
674     @@ -896,7 +896,7 @@
675     nvidia,elastic-limit = <16>;
676     nvidia,term-range-adj = <6>;
677     nvidia,xcvr-setup = <51>;
678     - nvidia.xcvr-setup-use-fuses;
679     + nvidia,xcvr-setup-use-fuses;
680     nvidia,xcvr-lsfslew = <2>;
681     nvidia,xcvr-lsrslew = <2>;
682     nvidia,xcvr-hsslew = <32>;
683     diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
684     index 409e069b3a84..00d7d28e86f0 100644
685     --- a/arch/arm/boot/dts/versatile-ab.dts
686     +++ b/arch/arm/boot/dts/versatile-ab.dts
687     @@ -303,7 +303,7 @@
688     clock-names = "apb_pclk";
689     };
690    
691     - ssp@101f4000 {
692     + spi@101f4000 {
693     compatible = "arm,pl022", "arm,primecell";
694     reg = <0x101f4000 0x1000>;
695     interrupts = <11>;
696     diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
697     index d69adfb3d79e..178a2a960659 100644
698     --- a/arch/arm/kernel/entry-common.S
699     +++ b/arch/arm/kernel/entry-common.S
700     @@ -263,16 +263,15 @@ __sys_trace:
701     cmp scno, #-1 @ skip the syscall?
702     bne 2b
703     add sp, sp, #S_OFF @ restore stack
704     - b ret_slow_syscall
705    
706     -__sys_trace_return:
707     - str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
708     +__sys_trace_return_nosave:
709     + enable_irq_notrace
710     mov r0, sp
711     bl syscall_trace_exit
712     b ret_slow_syscall
713    
714     -__sys_trace_return_nosave:
715     - enable_irq_notrace
716     +__sys_trace_return:
717     + str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
718     mov r0, sp
719     bl syscall_trace_exit
720     b ret_slow_syscall
721     diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
722     index b3d268a79f05..bb0d5e21d60b 100644
723     --- a/arch/arm/kvm/mmu.c
724     +++ b/arch/arm/kvm/mmu.c
725     @@ -366,7 +366,8 @@ static void stage2_flush_memslot(struct kvm *kvm,
726     pgd = kvm->arch.pgd + stage2_pgd_index(addr);
727     do {
728     next = stage2_pgd_addr_end(addr, end);
729     - stage2_flush_puds(kvm, pgd, addr, next);
730     + if (!stage2_pgd_none(*pgd))
731     + stage2_flush_puds(kvm, pgd, addr, next);
732     } while (pgd++, addr = next, addr != end);
733     }
734    
735     diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
736     index 1515e498d348..dd9eb3f14f45 100644
737     --- a/arch/arm/mach-imx/pm-imx6.c
738     +++ b/arch/arm/mach-imx/pm-imx6.c
739     @@ -602,6 +602,28 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata
740     IMX6Q_GPR1_GINT);
741     }
742    
743     +static void imx6_pm_stby_poweroff(void)
744     +{
745     + imx6_set_lpm(STOP_POWER_OFF);
746     + imx6q_suspend_finish(0);
747     +
748     + mdelay(1000);
749     +
750     + pr_emerg("Unable to poweroff system\n");
751     +}
752     +
753     +static int imx6_pm_stby_poweroff_probe(void)
754     +{
755     + if (pm_power_off) {
756     + pr_warn("%s: pm_power_off already claimed %p %pf!\n",
757     + __func__, pm_power_off, pm_power_off);
758     + return -EBUSY;
759     + }
760     +
761     + pm_power_off = imx6_pm_stby_poweroff;
762     + return 0;
763     +}
764     +
765     void __init imx6_pm_ccm_init(const char *ccm_compat)
766     {
767     struct device_node *np;
768     @@ -618,6 +640,9 @@ void __init imx6_pm_ccm_init(const char *ccm_compat)
769     val = readl_relaxed(ccm_base + CLPCR);
770     val &= ~BM_CLPCR_LPM;
771     writel_relaxed(val, ccm_base + CLPCR);
772     +
773     + if (of_property_read_bool(np, "fsl,pmic-stby-poweroff"))
774     + imx6_pm_stby_poweroff_probe();
775     }
776    
777     void __init imx6q_pm_init(void)
778     diff --git a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi
779     index bd3adeac374f..2973a14523ea 100644
780     --- a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi
781     +++ b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi
782     @@ -106,7 +106,7 @@
783     clock-names = "uartclk", "apb_pclk";
784     };
785    
786     - spi0: ssp@e1020000 {
787     + spi0: spi@e1020000 {
788     status = "disabled";
789     compatible = "arm,pl022", "arm,primecell";
790     reg = <0 0xe1020000 0 0x1000>;
791     @@ -116,7 +116,7 @@
792     clock-names = "apb_pclk";
793     };
794    
795     - spi1: ssp@e1030000 {
796     + spi1: spi@e1030000 {
797     status = "disabled";
798     compatible = "arm,pl022", "arm,primecell";
799     reg = <0 0xe1030000 0 0x1000>;
800     diff --git a/arch/arm64/boot/dts/lg/lg1312.dtsi b/arch/arm64/boot/dts/lg/lg1312.dtsi
801     index fbafa24cd533..5e0c5dc973e3 100644
802     --- a/arch/arm64/boot/dts/lg/lg1312.dtsi
803     +++ b/arch/arm64/boot/dts/lg/lg1312.dtsi
804     @@ -167,14 +167,14 @@
805     clock-names = "apb_pclk";
806     status="disabled";
807     };
808     - spi0: ssp@fe800000 {
809     + spi0: spi@fe800000 {
810     compatible = "arm,pl022", "arm,primecell";
811     reg = <0x0 0xfe800000 0x1000>;
812     interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
813     clocks = <&clk_bus>;
814     clock-names = "apb_pclk";
815     };
816     - spi1: ssp@fe900000 {
817     + spi1: spi@fe900000 {
818     compatible = "arm,pl022", "arm,primecell";
819     reg = <0x0 0xfe900000 0x1000>;
820     interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
821     diff --git a/arch/arm64/boot/dts/lg/lg1313.dtsi b/arch/arm64/boot/dts/lg/lg1313.dtsi
822     index e703e1149c75..f3b1ba6f7422 100644
823     --- a/arch/arm64/boot/dts/lg/lg1313.dtsi
824     +++ b/arch/arm64/boot/dts/lg/lg1313.dtsi
825     @@ -167,14 +167,14 @@
826     clock-names = "apb_pclk";
827     status="disabled";
828     };
829     - spi0: ssp@fe800000 {
830     + spi0: spi@fe800000 {
831     compatible = "arm,pl022", "arm,primecell";
832     reg = <0x0 0xfe800000 0x1000>;
833     interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
834     clocks = <&clk_bus>;
835     clock-names = "apb_pclk";
836     };
837     - spi1: ssp@fe900000 {
838     + spi1: spi@fe900000 {
839     compatible = "arm,pl022", "arm,primecell";
840     reg = <0x0 0xfe900000 0x1000>;
841     interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
842     diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
843     index 6a51d282ec63..d1e687b4911f 100644
844     --- a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
845     +++ b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
846     @@ -281,6 +281,7 @@
847     status = "okay";
848     bus-width = <8>;
849     non-removable;
850     + vqmmc-supply = <&vdd_1v8>;
851     };
852    
853     clocks {
854     diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S
855     index efbf610eaf4e..a814f32033b0 100644
856     --- a/arch/arm64/lib/clear_user.S
857     +++ b/arch/arm64/lib/clear_user.S
858     @@ -62,5 +62,7 @@ ENDPROC(__arch_clear_user)
859     .section .fixup,"ax"
860     .align 2
861     9: mov x0, x2 // return the original size
862     +ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
863     + CONFIG_ARM64_PAN)
864     ret
865     .previous
866     diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S
867     index 4fd67ea03bb0..580aca96c53c 100644
868     --- a/arch/arm64/lib/copy_from_user.S
869     +++ b/arch/arm64/lib/copy_from_user.S
870     @@ -80,5 +80,7 @@ ENDPROC(__arch_copy_from_user)
871     .section .fixup,"ax"
872     .align 2
873     9998: sub x0, end, dst // bytes not copied
874     +ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
875     + CONFIG_ARM64_PAN)
876     ret
877     .previous
878     diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
879     index 841bf8f7fab7..d9ca6a4f33b3 100644
880     --- a/arch/arm64/lib/copy_in_user.S
881     +++ b/arch/arm64/lib/copy_in_user.S
882     @@ -81,5 +81,7 @@ ENDPROC(__arch_copy_in_user)
883     .section .fixup,"ax"
884     .align 2
885     9998: sub x0, end, dst // bytes not copied
886     +ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
887     + CONFIG_ARM64_PAN)
888     ret
889     .previous
890     diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
891     index 7a7efe255034..e8bd40dc00cd 100644
892     --- a/arch/arm64/lib/copy_to_user.S
893     +++ b/arch/arm64/lib/copy_to_user.S
894     @@ -79,5 +79,7 @@ ENDPROC(__arch_copy_to_user)
895     .section .fixup,"ax"
896     .align 2
897     9998: sub x0, end, dst // bytes not copied
898     +ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \
899     + CONFIG_ARM64_PAN)
900     ret
901     .previous
902     diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
903     index 4b32168cf91a..b1e42bad69ac 100644
904     --- a/arch/arm64/mm/numa.c
905     +++ b/arch/arm64/mm/numa.c
906     @@ -424,7 +424,7 @@ static int __init dummy_numa_init(void)
907     if (numa_off)
908     pr_info("NUMA disabled\n"); /* Forced off on command line. */
909     pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n",
910     - 0LLU, PFN_PHYS(max_pfn) - 1);
911     + memblock_start_of_DRAM(), memblock_end_of_DRAM() - 1);
912    
913     for_each_memblock(memory, mblk) {
914     ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size);
915     diff --git a/arch/mips/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c
916     index e81ce4623070..06fb94370c7c 100644
917     --- a/arch/mips/bcm47xx/workarounds.c
918     +++ b/arch/mips/bcm47xx/workarounds.c
919     @@ -4,9 +4,8 @@
920     #include <bcm47xx_board.h>
921     #include <bcm47xx.h>
922    
923     -static void __init bcm47xx_workarounds_netgear_wnr3500l(void)
924     +static void __init bcm47xx_workarounds_enable_usb_power(int usb_power)
925     {
926     - const int usb_power = 12;
927     int err;
928    
929     err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power");
930     @@ -22,7 +21,10 @@ void __init bcm47xx_workarounds(void)
931    
932     switch (board) {
933     case BCM47XX_BOARD_NETGEAR_WNR3500L:
934     - bcm47xx_workarounds_netgear_wnr3500l();
935     + bcm47xx_workarounds_enable_usb_power(12);
936     + break;
937     + case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
938     + bcm47xx_workarounds_enable_usb_power(21);
939     break;
940     default:
941     /* No workaround(s) needed */
942     diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h
943     index 493a3cc7c39a..cfdbe66575f4 100644
944     --- a/arch/mips/include/asm/kexec.h
945     +++ b/arch/mips/include/asm/kexec.h
946     @@ -12,11 +12,11 @@
947     #include <asm/stacktrace.h>
948    
949     /* Maximum physical address we can use pages from */
950     -#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
951     +#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
952     /* Maximum address we can reach in physical address mode */
953     -#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
954     +#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
955     /* Maximum address we can use for the control code buffer */
956     -#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
957     +#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
958     /* Reserve 3*4096 bytes for board-specific info */
959     #define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096)
960    
961     diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
962     index a1d98b5c8fd6..5c53b8aa43d2 100644
963     --- a/arch/mips/txx9/generic/setup.c
964     +++ b/arch/mips/txx9/generic/setup.c
965     @@ -959,12 +959,11 @@ void __init txx9_sramc_init(struct resource *r)
966     goto exit_put;
967     err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
968     if (err) {
969     - device_unregister(&dev->dev);
970     iounmap(dev->base);
971     - kfree(dev);
972     + device_unregister(&dev->dev);
973     }
974     return;
975     exit_put:
976     + iounmap(dev->base);
977     put_device(&dev->dev);
978     - return;
979     }
980     diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h
981     index 7e3789ea396b..0b3db6322c79 100644
982     --- a/arch/powerpc/boot/libfdt_env.h
983     +++ b/arch/powerpc/boot/libfdt_env.h
984     @@ -4,6 +4,8 @@
985     #include <types.h>
986     #include <string.h>
987    
988     +#define INT_MAX ((int)(~0U>>1))
989     +
990     #include "of.h"
991    
992     typedef u32 uint32_t;
993     diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
994     index 5f202a566ec5..9bfdd2510fd5 100644
995     --- a/arch/powerpc/kernel/iommu.c
996     +++ b/arch/powerpc/kernel/iommu.c
997     @@ -765,9 +765,9 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
998    
999     vaddr = page_address(page) + offset;
1000     uaddr = (unsigned long)vaddr;
1001     - npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl));
1002    
1003     if (tbl) {
1004     + npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl));
1005     align = 0;
1006     if (tbl->it_page_shift < PAGE_SHIFT && size >= PAGE_SIZE &&
1007     ((unsigned long)vaddr & ~PAGE_MASK) == 0)
1008     diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
1009     index a309a7a29cc6..641f3e4c3380 100644
1010     --- a/arch/powerpc/kernel/rtas.c
1011     +++ b/arch/powerpc/kernel/rtas.c
1012     @@ -984,6 +984,7 @@ int rtas_ibm_suspend_me(u64 handle)
1013     goto out;
1014     }
1015    
1016     + cpu_hotplug_disable();
1017     stop_topology_update();
1018    
1019     /* Call function on all CPUs. One of us will make the
1020     @@ -998,6 +999,7 @@ int rtas_ibm_suspend_me(u64 handle)
1021     printk(KERN_ERR "Error doing global join\n");
1022    
1023     start_topology_update();
1024     + cpu_hotplug_enable();
1025    
1026     /* Take down CPUs not online prior to suspend */
1027     cpuret = rtas_offline_cpus_mask(offline_mask);
1028     diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S
1029     index 3745113fcc65..2a7eb5452aba 100644
1030     --- a/arch/powerpc/kernel/vdso32/datapage.S
1031     +++ b/arch/powerpc/kernel/vdso32/datapage.S
1032     @@ -37,6 +37,7 @@ data_page_branch:
1033     mtlr r0
1034     addi r3, r3, __kernel_datapage_offset-data_page_branch
1035     lwz r0,0(r3)
1036     + .cfi_restore lr
1037     add r3,r0,r3
1038     blr
1039     .cfi_endproc
1040     diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
1041     index 6b2b69616e77..7b341b86216c 100644
1042     --- a/arch/powerpc/kernel/vdso32/gettimeofday.S
1043     +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
1044     @@ -139,6 +139,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
1045     */
1046     99:
1047     li r0,__NR_clock_gettime
1048     + .cfi_restore lr
1049     sc
1050     blr
1051     .cfi_endproc
1052     diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S
1053     index abf17feffe40..bf9668691511 100644
1054     --- a/arch/powerpc/kernel/vdso64/datapage.S
1055     +++ b/arch/powerpc/kernel/vdso64/datapage.S
1056     @@ -37,6 +37,7 @@ data_page_branch:
1057     mtlr r0
1058     addi r3, r3, __kernel_datapage_offset-data_page_branch
1059     lwz r0,0(r3)
1060     + .cfi_restore lr
1061     add r3,r0,r3
1062     blr
1063     .cfi_endproc
1064     diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
1065     index 382021324883..09b2a49f6dd5 100644
1066     --- a/arch/powerpc/kernel/vdso64/gettimeofday.S
1067     +++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
1068     @@ -124,6 +124,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
1069     */
1070     99:
1071     li r0,__NR_clock_gettime
1072     + .cfi_restore lr
1073     sc
1074     blr
1075     .cfi_endproc
1076     diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
1077     index 73c3c127d858..209cad89a11a 100644
1078     --- a/arch/powerpc/kvm/book3s.c
1079     +++ b/arch/powerpc/kvm/book3s.c
1080     @@ -78,8 +78,11 @@ void kvmppc_unfixup_split_real(struct kvm_vcpu *vcpu)
1081     {
1082     if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) {
1083     ulong pc = kvmppc_get_pc(vcpu);
1084     + ulong lr = kvmppc_get_lr(vcpu);
1085     if ((pc & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS)
1086     kvmppc_set_pc(vcpu, pc & ~SPLIT_HACK_MASK);
1087     + if ((lr & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS)
1088     + kvmppc_set_lr(vcpu, lr & ~SPLIT_HACK_MASK);
1089     vcpu->arch.hflags &= ~BOOK3S_HFLAG_SPLIT_HACK;
1090     }
1091     }
1092     diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
1093     index 64c9a91773af..96c41b55b106 100644
1094     --- a/arch/powerpc/mm/slb.c
1095     +++ b/arch/powerpc/mm/slb.c
1096     @@ -321,7 +321,7 @@ void slb_initialize(void)
1097     #endif
1098     }
1099    
1100     - get_paca()->stab_rr = SLB_NUM_BOLTED;
1101     + get_paca()->stab_rr = SLB_NUM_BOLTED - 1;
1102    
1103     lflags = SLB_VSID_KERNEL | linear_llp;
1104     vflags = SLB_VSID_KERNEL | vmalloc_llp;
1105     diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
1106     index 39049e4884fb..7a4d172c9376 100644
1107     --- a/arch/powerpc/platforms/pseries/dtl.c
1108     +++ b/arch/powerpc/platforms/pseries/dtl.c
1109     @@ -150,7 +150,7 @@ static int dtl_start(struct dtl *dtl)
1110    
1111     /* Register our dtl buffer with the hypervisor. The HV expects the
1112     * buffer size to be passed in the second word of the buffer */
1113     - ((u32 *)dtl->buf)[1] = DISPATCH_LOG_BYTES;
1114     + ((u32 *)dtl->buf)[1] = cpu_to_be32(DISPATCH_LOG_BYTES);
1115    
1116     hwcpu = get_hard_smp_processor_id(dtl->cpu);
1117     addr = __pa(dtl->buf);
1118     @@ -185,7 +185,7 @@ static void dtl_stop(struct dtl *dtl)
1119    
1120     static u64 dtl_current_index(struct dtl *dtl)
1121     {
1122     - return lppaca_of(dtl->cpu).dtl_idx;
1123     + return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx);
1124     }
1125     #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
1126    
1127     diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
1128     index ca7c3c34f94b..2bb3a255e51a 100644
1129     --- a/arch/s390/kernel/vdso32/Makefile
1130     +++ b/arch/s390/kernel/vdso32/Makefile
1131     @@ -24,9 +24,10 @@ obj-y += vdso32_wrapper.o
1132     extra-y += vdso32.lds
1133     CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
1134    
1135     -# Disable gcov profiling and ubsan for VDSO code
1136     +# Disable gcov profiling, ubsan and kasan for VDSO code
1137     GCOV_PROFILE := n
1138     UBSAN_SANITIZE := n
1139     +KASAN_SANITIZE := n
1140    
1141     # Force dependency (incbin is bad)
1142     $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
1143     diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
1144     index 84af2b6b64c4..76c56b5382be 100644
1145     --- a/arch/s390/kernel/vdso64/Makefile
1146     +++ b/arch/s390/kernel/vdso64/Makefile
1147     @@ -24,9 +24,10 @@ obj-y += vdso64_wrapper.o
1148     extra-y += vdso64.lds
1149     CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
1150    
1151     -# Disable gcov profiling and ubsan for VDSO code
1152     +# Disable gcov profiling, ubsan and kasan for VDSO code
1153     GCOV_PROFILE := n
1154     UBSAN_SANITIZE := n
1155     +KASAN_SANITIZE := n
1156    
1157     # Force dependency (incbin is bad)
1158     $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
1159     diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
1160     index 1067f7668c4e..80636caee07c 100644
1161     --- a/arch/x86/Kconfig
1162     +++ b/arch/x86/Kconfig
1163     @@ -2614,8 +2614,7 @@ config OLPC
1164    
1165     config OLPC_XO1_PM
1166     bool "OLPC XO-1 Power Management"
1167     - depends on OLPC && MFD_CS5535 && PM_SLEEP
1168     - select MFD_CORE
1169     + depends on OLPC && MFD_CS5535=y && PM_SLEEP
1170     ---help---
1171     Add support for poweroff and suspend of the OLPC XO-1 laptop.
1172    
1173     diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
1174     index 14635c5ea025..76a35c1213d2 100644
1175     --- a/arch/x86/include/asm/atomic.h
1176     +++ b/arch/x86/include/asm/atomic.h
1177     @@ -49,7 +49,7 @@ static __always_inline void atomic_add(int i, atomic_t *v)
1178     {
1179     asm volatile(LOCK_PREFIX "addl %1,%0"
1180     : "+m" (v->counter)
1181     - : "ir" (i));
1182     + : "ir" (i) : "memory");
1183     }
1184    
1185     /**
1186     @@ -63,7 +63,7 @@ static __always_inline void atomic_sub(int i, atomic_t *v)
1187     {
1188     asm volatile(LOCK_PREFIX "subl %1,%0"
1189     : "+m" (v->counter)
1190     - : "ir" (i));
1191     + : "ir" (i) : "memory");
1192     }
1193    
1194     /**
1195     @@ -89,7 +89,7 @@ static __always_inline bool atomic_sub_and_test(int i, atomic_t *v)
1196     static __always_inline void atomic_inc(atomic_t *v)
1197     {
1198     asm volatile(LOCK_PREFIX "incl %0"
1199     - : "+m" (v->counter));
1200     + : "+m" (v->counter) :: "memory");
1201     }
1202    
1203     /**
1204     @@ -101,7 +101,7 @@ static __always_inline void atomic_inc(atomic_t *v)
1205     static __always_inline void atomic_dec(atomic_t *v)
1206     {
1207     asm volatile(LOCK_PREFIX "decl %0"
1208     - : "+m" (v->counter));
1209     + : "+m" (v->counter) :: "memory");
1210     }
1211    
1212     /**
1213     diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
1214     index 89ed2f6ae2f7..a3248402c36b 100644
1215     --- a/arch/x86/include/asm/atomic64_64.h
1216     +++ b/arch/x86/include/asm/atomic64_64.h
1217     @@ -44,7 +44,7 @@ static __always_inline void atomic64_add(long i, atomic64_t *v)
1218     {
1219     asm volatile(LOCK_PREFIX "addq %1,%0"
1220     : "=m" (v->counter)
1221     - : "er" (i), "m" (v->counter));
1222     + : "er" (i), "m" (v->counter) : "memory");
1223     }
1224    
1225     /**
1226     @@ -58,7 +58,7 @@ static inline void atomic64_sub(long i, atomic64_t *v)
1227     {
1228     asm volatile(LOCK_PREFIX "subq %1,%0"
1229     : "=m" (v->counter)
1230     - : "er" (i), "m" (v->counter));
1231     + : "er" (i), "m" (v->counter) : "memory");
1232     }
1233    
1234     /**
1235     @@ -85,7 +85,7 @@ static __always_inline void atomic64_inc(atomic64_t *v)
1236     {
1237     asm volatile(LOCK_PREFIX "incq %0"
1238     : "=m" (v->counter)
1239     - : "m" (v->counter));
1240     + : "m" (v->counter) : "memory");
1241     }
1242    
1243     /**
1244     @@ -98,7 +98,7 @@ static __always_inline void atomic64_dec(atomic64_t *v)
1245     {
1246     asm volatile(LOCK_PREFIX "decq %0"
1247     : "=m" (v->counter)
1248     - : "m" (v->counter));
1249     + : "m" (v->counter) : "memory");
1250     }
1251    
1252     /**
1253     diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
1254     index eb53c2c78a1f..a0f450b21d67 100644
1255     --- a/arch/x86/include/asm/barrier.h
1256     +++ b/arch/x86/include/asm/barrier.h
1257     @@ -105,8 +105,8 @@ do { \
1258     #endif
1259    
1260     /* Atomic operations are already serializing on x86 */
1261     -#define __smp_mb__before_atomic() barrier()
1262     -#define __smp_mb__after_atomic() barrier()
1263     +#define __smp_mb__before_atomic() do { } while (0)
1264     +#define __smp_mb__after_atomic() do { } while (0)
1265    
1266     #include <asm-generic/barrier.h>
1267    
1268     diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h
1269     index b3e32b010ab1..c2c01f84df75 100644
1270     --- a/arch/x86/include/asm/insn.h
1271     +++ b/arch/x86/include/asm/insn.h
1272     @@ -208,4 +208,22 @@ static inline int insn_offset_immediate(struct insn *insn)
1273     return insn_offset_displacement(insn) + insn->displacement.nbytes;
1274     }
1275    
1276     +#define POP_SS_OPCODE 0x1f
1277     +#define MOV_SREG_OPCODE 0x8e
1278     +
1279     +/*
1280     + * Intel SDM Vol.3A 6.8.3 states;
1281     + * "Any single-step trap that would be delivered following the MOV to SS
1282     + * instruction or POP to SS instruction (because EFLAGS.TF is 1) is
1283     + * suppressed."
1284     + * This function returns true if @insn is MOV SS or POP SS. On these
1285     + * instructions, single stepping is suppressed.
1286     + */
1287     +static inline int insn_masking_exception(struct insn *insn)
1288     +{
1289     + return insn->opcode.bytes[0] == POP_SS_OPCODE ||
1290     + (insn->opcode.bytes[0] == MOV_SREG_OPCODE &&
1291     + X86_MODRM_REG(insn->modrm.bytes[0]) == 2);
1292     +}
1293     +
1294     #endif /* _ASM_X86_INSN_H */
1295     diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
1296     index 282630e4c6ea..1624a7ffa95d 100644
1297     --- a/arch/x86/include/asm/kexec.h
1298     +++ b/arch/x86/include/asm/kexec.h
1299     @@ -66,7 +66,7 @@ struct kimage;
1300    
1301     /* Memory to backup during crash kdump */
1302     #define KEXEC_BACKUP_SRC_START (0UL)
1303     -#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */
1304     +#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */
1305    
1306     /*
1307     * CPU does not save ss and sp on stack if execution is already
1308     diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
1309     index 311d0fad17e6..a4f6e0ec4ba0 100644
1310     --- a/arch/x86/kernel/cpu/cyrix.c
1311     +++ b/arch/x86/kernel/cpu/cyrix.c
1312     @@ -434,7 +434,7 @@ static void cyrix_identify(struct cpuinfo_x86 *c)
1313     /* enable MAPEN */
1314     setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);
1315     /* enable cpuid */
1316     - setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);
1317     + setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80);
1318     /* disable MAPEN */
1319     setCx86(CX86_CCR3, ccr3);
1320     local_irq_restore(flags);
1321     diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
1322     index 3f3cfeca1083..dcd6df5943d6 100644
1323     --- a/arch/x86/kernel/kprobes/core.c
1324     +++ b/arch/x86/kernel/kprobes/core.c
1325     @@ -376,6 +376,10 @@ int __copy_instruction(u8 *dest, u8 *src)
1326     return 0;
1327     memcpy(dest, insn.kaddr, length);
1328    
1329     + /* We should not singlestep on the exception masking instructions */
1330     + if (insn_masking_exception(&insn))
1331     + return 0;
1332     +
1333     #ifdef CONFIG_X86_64
1334     if (insn_rip_relative(&insn)) {
1335     s64 newdisp;
1336     diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
1337     index e35466afe989..73391c1bd2a9 100644
1338     --- a/arch/x86/kernel/uprobes.c
1339     +++ b/arch/x86/kernel/uprobes.c
1340     @@ -296,6 +296,10 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool
1341     if (is_prefix_bad(insn))
1342     return -ENOTSUPP;
1343    
1344     + /* We should not singlestep on the exception masking instructions */
1345     + if (insn_masking_exception(insn))
1346     + return -ENOTSUPP;
1347     +
1348     if (x86_64)
1349     good_insns = good_insns_64;
1350     else
1351     @@ -983,7 +987,7 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs
1352     pr_err("uprobe: return address clobbered: pid=%d, %%sp=%#lx, "
1353     "%%ip=%#lx\n", current->pid, regs->sp, regs->ip);
1354    
1355     - force_sig_info(SIGSEGV, SEND_SIG_FORCED, current);
1356     + force_sig(SIGSEGV, current);
1357     }
1358    
1359     return -1;
1360     diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c
1361     index 7830d304dff6..d58224d80867 100644
1362     --- a/crypto/rsa-pkcs1pad.c
1363     +++ b/crypto/rsa-pkcs1pad.c
1364     @@ -267,15 +267,6 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
1365     pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf,
1366     ctx->key_size - 1 - req->src_len, req->src);
1367    
1368     - req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL);
1369     - if (!req_ctx->out_buf) {
1370     - kfree(req_ctx->in_buf);
1371     - return -ENOMEM;
1372     - }
1373     -
1374     - pkcs1pad_sg_set_buf(req_ctx->out_sg, req_ctx->out_buf,
1375     - ctx->key_size, NULL);
1376     -
1377     akcipher_request_set_tfm(&req_ctx->child_req, ctx->child);
1378     akcipher_request_set_callback(&req_ctx->child_req, req->base.flags,
1379     pkcs1pad_encrypt_sign_complete_cb, req);
1380     diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
1381     index 92fa47c6498c..20fd17aaa918 100644
1382     --- a/drivers/acpi/acpica/acevents.h
1383     +++ b/drivers/acpi/acpica/acevents.h
1384     @@ -247,6 +247,8 @@ acpi_status
1385     acpi_ev_initialize_region(union acpi_operand_object *region_obj,
1386     u8 acpi_ns_locked);
1387    
1388     +u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
1389     +
1390     /*
1391     * evsci - SCI (System Control Interrupt) handling/dispatch
1392     */
1393     diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
1394     index dff1207a6078..219bc576d127 100644
1395     --- a/drivers/acpi/acpica/aclocal.h
1396     +++ b/drivers/acpi/acpica/aclocal.h
1397     @@ -428,9 +428,9 @@ struct acpi_simple_repair_info {
1398     /* Info for running the _REG methods */
1399    
1400     struct acpi_reg_walk_info {
1401     - acpi_adr_space_type space_id;
1402     u32 function;
1403     u32 reg_run_count;
1404     + acpi_adr_space_type space_id;
1405     };
1406    
1407     /*****************************************************************************
1408     diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
1409     index 4c6f79514040..9cb60fdc77e5 100644
1410     --- a/drivers/acpi/acpica/evregion.c
1411     +++ b/drivers/acpi/acpica/evregion.c
1412     @@ -677,6 +677,19 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1413    
1414     ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
1415    
1416     + /*
1417     + * These address spaces do not need a call to _REG, since the ACPI
1418     + * specification defines them as: "must always be accessible". Since
1419     + * they never change state (never become unavailable), no need to ever
1420     + * call _REG on them. Also, a data_table is not a "real" address space,
1421     + * so do not call _REG. September 2018.
1422     + */
1423     + if ((space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) ||
1424     + (space_id == ACPI_ADR_SPACE_SYSTEM_IO) ||
1425     + (space_id == ACPI_ADR_SPACE_DATA_TABLE)) {
1426     + return_VOID;
1427     + }
1428     +
1429     info.space_id = space_id;
1430     info.function = function;
1431     info.reg_run_count = 0;
1432     @@ -738,8 +751,8 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1433     }
1434    
1435     /*
1436     - * We only care about regions.and objects that are allowed to have address
1437     - * space handlers
1438     + * We only care about regions and objects that are allowed to have
1439     + * address space handlers
1440     */
1441     if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
1442     return (AE_OK);
1443     diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
1444     index 75ddd160a716..c8646c397786 100644
1445     --- a/drivers/acpi/acpica/evrgnini.c
1446     +++ b/drivers/acpi/acpica/evrgnini.c
1447     @@ -50,9 +50,6 @@
1448     #define _COMPONENT ACPI_EVENTS
1449     ACPI_MODULE_NAME("evrgnini")
1450    
1451     -/* Local prototypes */
1452     -static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
1453     -
1454     /*******************************************************************************
1455     *
1456     * FUNCTION: acpi_ev_system_memory_region_setup
1457     @@ -67,7 +64,6 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
1458     * DESCRIPTION: Setup a system_memory operation region
1459     *
1460     ******************************************************************************/
1461     -
1462     acpi_status
1463     acpi_ev_system_memory_region_setup(acpi_handle handle,
1464     u32 function,
1465     @@ -347,7 +343,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
1466     *
1467     ******************************************************************************/
1468    
1469     -static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
1470     +u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
1471     {
1472     acpi_status status;
1473     struct acpi_pnp_device_id *hid;
1474     diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
1475     index d2743067126a..f87d59a05c68 100644
1476     --- a/drivers/acpi/acpica/evxfregn.c
1477     +++ b/drivers/acpi/acpica/evxfregn.c
1478     @@ -227,7 +227,6 @@ acpi_remove_address_space_handler(acpi_handle device,
1479     */
1480     region_obj =
1481     handler_obj->address_space.region_list;
1482     -
1483     }
1484    
1485     /* Remove this Handler object from the list */
1486     diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
1487     index 416953a42510..b9fade7a3bcf 100644
1488     --- a/drivers/acpi/osl.c
1489     +++ b/drivers/acpi/osl.c
1490     @@ -1126,6 +1126,7 @@ void acpi_os_wait_events_complete(void)
1491     flush_workqueue(kacpid_wq);
1492     flush_workqueue(kacpi_notify_wq);
1493     }
1494     +EXPORT_SYMBOL(acpi_os_wait_events_complete);
1495    
1496     struct acpi_hp_work {
1497     struct work_struct work;
1498     diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
1499     index b66815f35be6..317ecc2e5757 100644
1500     --- a/drivers/acpi/pci_root.c
1501     +++ b/drivers/acpi/pci_root.c
1502     @@ -454,8 +454,9 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
1503     decode_osc_support(root, "OS supports", support);
1504     status = acpi_pci_osc_support(root, support);
1505     if (ACPI_FAILURE(status)) {
1506     - dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n",
1507     - acpi_format_exception(status));
1508     + dev_info(&device->dev, "_OSC failed (%s)%s\n",
1509     + acpi_format_exception(status),
1510     + pcie_aspm_support_enabled() ? "; disabling ASPM" : "");
1511     *no_aspm = 1;
1512     return;
1513     }
1514     diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
1515     index 7a3431018e0a..5008ead4609a 100644
1516     --- a/drivers/acpi/sbshc.c
1517     +++ b/drivers/acpi/sbshc.c
1518     @@ -196,6 +196,7 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc)
1519     hc->callback = NULL;
1520     hc->context = NULL;
1521     mutex_unlock(&hc->lock);
1522     + acpi_os_wait_events_complete();
1523     return 0;
1524     }
1525    
1526     @@ -292,6 +293,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device)
1527    
1528     hc = acpi_driver_data(device);
1529     acpi_ec_remove_query_handler(hc->ec, hc->query_bit);
1530     + acpi_os_wait_events_complete();
1531     kfree(hc);
1532     device->driver_data = NULL;
1533     return 0;
1534     diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
1535     index 5d16fc4fa46c..a8d4f4b5a77e 100644
1536     --- a/drivers/ata/Kconfig
1537     +++ b/drivers/ata/Kconfig
1538     @@ -100,7 +100,8 @@ config SATA_AHCI_PLATFORM
1539    
1540     config AHCI_BRCM
1541     tristate "Broadcom AHCI SATA support"
1542     - depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP
1543     + depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP || \
1544     + ARCH_BCM_63XX
1545     help
1546     This option enables support for the AHCI SATA3 controller found on
1547     Broadcom SoC's.
1548     diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
1549     index a3d60ccafd9a..f5eb102a2cf7 100644
1550     --- a/drivers/ata/libata-scsi.c
1551     +++ b/drivers/ata/libata-scsi.c
1552     @@ -1734,6 +1734,21 @@ nothing_to_do:
1553     return 1;
1554     }
1555    
1556     +static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks)
1557     +{
1558     + struct request *rq = scmd->request;
1559     + u32 req_blocks;
1560     +
1561     + if (!blk_rq_is_passthrough(rq))
1562     + return true;
1563     +
1564     + req_blocks = blk_rq_bytes(rq) / scmd->device->sector_size;
1565     + if (n_blocks > req_blocks)
1566     + return false;
1567     +
1568     + return true;
1569     +}
1570     +
1571     /**
1572     * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one
1573     * @qc: Storage for translated ATA taskfile
1574     @@ -1776,6 +1791,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
1575     scsi_10_lba_len(cdb, &block, &n_block);
1576     if (cdb[1] & (1 << 3))
1577     tf_flags |= ATA_TFLAG_FUA;
1578     + if (!ata_check_nblocks(scmd, n_block))
1579     + goto invalid_fld;
1580     break;
1581     case READ_6:
1582     case WRITE_6:
1583     @@ -1790,6 +1807,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
1584     */
1585     if (!n_block)
1586     n_block = 256;
1587     + if (!ata_check_nblocks(scmd, n_block))
1588     + goto invalid_fld;
1589     break;
1590     case READ_16:
1591     case WRITE_16:
1592     @@ -1800,6 +1819,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
1593     scsi_16_lba_len(cdb, &block, &n_block);
1594     if (cdb[1] & (1 << 3))
1595     tf_flags |= ATA_TFLAG_FUA;
1596     + if (!ata_check_nblocks(scmd, n_block))
1597     + goto invalid_fld;
1598     break;
1599     default:
1600     DPRINTK("no-byte command\n");
1601     diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c
1602     index bd6b089c67a3..634c814cbeda 100644
1603     --- a/drivers/ata/pata_ep93xx.c
1604     +++ b/drivers/ata/pata_ep93xx.c
1605     @@ -659,7 +659,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data)
1606     * start of new transfer.
1607     */
1608     drv_data->dma_rx_data.port = EP93XX_DMA_IDE;
1609     - drv_data->dma_rx_data.direction = DMA_FROM_DEVICE;
1610     + drv_data->dma_rx_data.direction = DMA_DEV_TO_MEM;
1611     drv_data->dma_rx_data.name = "ep93xx-pata-rx";
1612     drv_data->dma_rx_channel = dma_request_channel(mask,
1613     ep93xx_pata_dma_filter, &drv_data->dma_rx_data);
1614     @@ -667,7 +667,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data)
1615     return;
1616    
1617     drv_data->dma_tx_data.port = EP93XX_DMA_IDE;
1618     - drv_data->dma_tx_data.direction = DMA_TO_DEVICE;
1619     + drv_data->dma_tx_data.direction = DMA_MEM_TO_DEV;
1620     drv_data->dma_tx_data.name = "ep93xx-pata-tx";
1621     drv_data->dma_tx_channel = dma_request_channel(mask,
1622     ep93xx_pata_dma_filter, &drv_data->dma_tx_data);
1623     @@ -678,7 +678,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data)
1624    
1625     /* Configure receive channel direction and source address */
1626     memset(&conf, 0, sizeof(conf));
1627     - conf.direction = DMA_FROM_DEVICE;
1628     + conf.direction = DMA_DEV_TO_MEM;
1629     conf.src_addr = drv_data->udma_in_phys;
1630     conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1631     if (dmaengine_slave_config(drv_data->dma_rx_channel, &conf)) {
1632     @@ -689,7 +689,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data)
1633    
1634     /* Configure transmit channel direction and destination address */
1635     memset(&conf, 0, sizeof(conf));
1636     - conf.direction = DMA_TO_DEVICE;
1637     + conf.direction = DMA_MEM_TO_DEV;
1638     conf.dst_addr = drv_data->udma_out_phys;
1639     conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1640     if (dmaengine_slave_config(drv_data->dma_tx_channel, &conf)) {
1641     diff --git a/drivers/base/component.c b/drivers/base/component.c
1642     index 89b032f2ffd2..08da6160e94d 100644
1643     --- a/drivers/base/component.c
1644     +++ b/drivers/base/component.c
1645     @@ -461,9 +461,9 @@ int component_bind_all(struct device *master_dev, void *data)
1646     }
1647    
1648     if (ret != 0) {
1649     - for (; i--; )
1650     - if (!master->match->compare[i].duplicate) {
1651     - c = master->match->compare[i].component;
1652     + for (; i > 0; i--)
1653     + if (!master->match->compare[i - 1].duplicate) {
1654     + c = master->match->compare[i - 1].component;
1655     component_unbind(c, master, data);
1656     }
1657     }
1658     diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
1659     index 8bf7e805fd34..1271315b0c25 100644
1660     --- a/drivers/clk/samsung/clk-cpu.c
1661     +++ b/drivers/clk/samsung/clk-cpu.c
1662     @@ -152,7 +152,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
1663     struct exynos_cpuclk *cpuclk, void __iomem *base)
1664     {
1665     const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg;
1666     - unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent);
1667     + unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent);
1668     unsigned long alt_div = 0, alt_div_mask = DIV_MASK;
1669     unsigned long div0, div1 = 0, mux_reg;
1670     unsigned long flags;
1671     @@ -280,7 +280,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
1672     struct exynos_cpuclk *cpuclk, void __iomem *base)
1673     {
1674     const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg;
1675     - unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent);
1676     + unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent);
1677     unsigned long alt_div = 0, alt_div_mask = DIV_MASK;
1678     unsigned long div0, div1 = 0, mux_reg;
1679     unsigned long flags;
1680     @@ -432,7 +432,7 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
1681     else
1682     cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb;
1683    
1684     - cpuclk->alt_parent = __clk_lookup(alt_parent);
1685     + cpuclk->alt_parent = __clk_get_hw(__clk_lookup(alt_parent));
1686     if (!cpuclk->alt_parent) {
1687     pr_err("%s: could not lookup alternate parent %s\n",
1688     __func__, alt_parent);
1689     diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h
1690     index d4b6b517fe1b..bd38c6aa3897 100644
1691     --- a/drivers/clk/samsung/clk-cpu.h
1692     +++ b/drivers/clk/samsung/clk-cpu.h
1693     @@ -49,7 +49,7 @@ struct exynos_cpuclk_cfg_data {
1694     */
1695     struct exynos_cpuclk {
1696     struct clk_hw hw;
1697     - struct clk *alt_parent;
1698     + struct clk_hw *alt_parent;
1699     void __iomem *ctrl_base;
1700     spinlock_t *lock;
1701     const struct exynos_cpuclk_cfg_data *cfg;
1702     diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
1703     index decaed448ebb..b4bd34429cc1 100644
1704     --- a/drivers/crypto/mxs-dcp.c
1705     +++ b/drivers/crypto/mxs-dcp.c
1706     @@ -28,9 +28,24 @@
1707    
1708     #define DCP_MAX_CHANS 4
1709     #define DCP_BUF_SZ PAGE_SIZE
1710     +#define DCP_SHA_PAY_SZ 64
1711    
1712     #define DCP_ALIGNMENT 64
1713    
1714     +/*
1715     + * Null hashes to align with hw behavior on imx6sl and ull
1716     + * these are flipped for consistency with hw output
1717     + */
1718     +const uint8_t sha1_null_hash[] =
1719     + "\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf"
1720     + "\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda";
1721     +
1722     +const uint8_t sha256_null_hash[] =
1723     + "\x55\xb8\x52\x78\x1b\x99\x95\xa4"
1724     + "\x4c\x93\x9b\x64\xe4\x41\xae\x27"
1725     + "\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a"
1726     + "\x14\x1c\xfc\x98\x42\xc4\xb0\xe3";
1727     +
1728     /* DCP DMA descriptor. */
1729     struct dcp_dma_desc {
1730     uint32_t next_cmd_addr;
1731     @@ -48,6 +63,7 @@ struct dcp_coherent_block {
1732     uint8_t aes_in_buf[DCP_BUF_SZ];
1733     uint8_t aes_out_buf[DCP_BUF_SZ];
1734     uint8_t sha_in_buf[DCP_BUF_SZ];
1735     + uint8_t sha_out_buf[DCP_SHA_PAY_SZ];
1736    
1737     uint8_t aes_key[2 * AES_KEYSIZE_128];
1738    
1739     @@ -209,6 +225,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
1740     dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
1741     DCP_BUF_SZ, DMA_FROM_DEVICE);
1742    
1743     + if (actx->fill % AES_BLOCK_SIZE) {
1744     + dev_err(sdcp->dev, "Invalid block size!\n");
1745     + ret = -EINVAL;
1746     + goto aes_done_run;
1747     + }
1748     +
1749     /* Fill in the DMA descriptor. */
1750     desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
1751     MXS_DCP_CONTROL0_INTERRUPT |
1752     @@ -238,6 +260,7 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
1753    
1754     ret = mxs_dcp_start_dma(actx);
1755    
1756     +aes_done_run:
1757     dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128,
1758     DMA_TO_DEVICE);
1759     dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
1760     @@ -264,13 +287,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
1761    
1762     uint8_t *out_tmp, *src_buf, *dst_buf = NULL;
1763     uint32_t dst_off = 0;
1764     + uint32_t last_out_len = 0;
1765    
1766     uint8_t *key = sdcp->coh->aes_key;
1767    
1768     int ret = 0;
1769     int split = 0;
1770     - unsigned int i, len, clen, rem = 0;
1771     + unsigned int i, len, clen, rem = 0, tlen = 0;
1772     int init = 0;
1773     + bool limit_hit = false;
1774    
1775     actx->fill = 0;
1776    
1777     @@ -289,6 +314,11 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
1778     for_each_sg(req->src, src, nents, i) {
1779     src_buf = sg_virt(src);
1780     len = sg_dma_len(src);
1781     + tlen += len;
1782     + limit_hit = tlen > req->nbytes;
1783     +
1784     + if (limit_hit)
1785     + len = req->nbytes - (tlen - len);
1786    
1787     do {
1788     if (actx->fill + len > out_off)
1789     @@ -305,13 +335,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
1790     * If we filled the buffer or this is the last SG,
1791     * submit the buffer.
1792     */
1793     - if (actx->fill == out_off || sg_is_last(src)) {
1794     + if (actx->fill == out_off || sg_is_last(src) ||
1795     + limit_hit) {
1796     ret = mxs_dcp_run_aes(actx, req, init);
1797     if (ret)
1798     return ret;
1799     init = 0;
1800    
1801     out_tmp = out_buf;
1802     + last_out_len = actx->fill;
1803     while (dst && actx->fill) {
1804     if (!split) {
1805     dst_buf = sg_virt(dst);
1806     @@ -334,6 +366,19 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
1807     }
1808     }
1809     } while (len);
1810     +
1811     + if (limit_hit)
1812     + break;
1813     + }
1814     +
1815     + /* Copy the IV for CBC for chaining */
1816     + if (!rctx->ecb) {
1817     + if (rctx->enc)
1818     + memcpy(req->info, out_buf+(last_out_len-AES_BLOCK_SIZE),
1819     + AES_BLOCK_SIZE);
1820     + else
1821     + memcpy(req->info, in_buf+(last_out_len-AES_BLOCK_SIZE),
1822     + AES_BLOCK_SIZE);
1823     }
1824    
1825     return ret;
1826     @@ -513,8 +558,6 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
1827     struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
1828     struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
1829     struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
1830     - struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
1831     -
1832     struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
1833    
1834     dma_addr_t digest_phys = 0;
1835     @@ -536,10 +579,23 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
1836     desc->payload = 0;
1837     desc->status = 0;
1838    
1839     + /*
1840     + * Align driver with hw behavior when generating null hashes
1841     + */
1842     + if (rctx->init && rctx->fini && desc->size == 0) {
1843     + struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
1844     + const uint8_t *sha_buf =
1845     + (actx->alg == MXS_DCP_CONTROL1_HASH_SELECT_SHA1) ?
1846     + sha1_null_hash : sha256_null_hash;
1847     + memcpy(sdcp->coh->sha_out_buf, sha_buf, halg->digestsize);
1848     + ret = 0;
1849     + goto done_run;
1850     + }
1851     +
1852     /* Set HASH_TERM bit for last transfer block. */
1853     if (rctx->fini) {
1854     - digest_phys = dma_map_single(sdcp->dev, req->result,
1855     - halg->digestsize, DMA_FROM_DEVICE);
1856     + digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf,
1857     + DCP_SHA_PAY_SZ, DMA_FROM_DEVICE);
1858     desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
1859     desc->payload = digest_phys;
1860     }
1861     @@ -547,9 +603,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
1862     ret = mxs_dcp_start_dma(actx);
1863    
1864     if (rctx->fini)
1865     - dma_unmap_single(sdcp->dev, digest_phys, halg->digestsize,
1866     + dma_unmap_single(sdcp->dev, digest_phys, DCP_SHA_PAY_SZ,
1867     DMA_FROM_DEVICE);
1868    
1869     +done_run:
1870     dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
1871    
1872     return ret;
1873     @@ -567,6 +624,7 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq)
1874     const int nents = sg_nents(req->src);
1875    
1876     uint8_t *in_buf = sdcp->coh->sha_in_buf;
1877     + uint8_t *out_buf = sdcp->coh->sha_out_buf;
1878    
1879     uint8_t *src_buf;
1880    
1881     @@ -621,11 +679,9 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq)
1882    
1883     actx->fill = 0;
1884    
1885     - /* For some reason, the result is flipped. */
1886     - for (i = 0; i < halg->digestsize / 2; i++) {
1887     - swap(req->result[i],
1888     - req->result[halg->digestsize - i - 1]);
1889     - }
1890     + /* For some reason the result is flipped */
1891     + for (i = 0; i < halg->digestsize; i++)
1892     + req->result[i] = out_buf[halg->digestsize - i - 1];
1893     }
1894    
1895     return 0;
1896     diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
1897     index 500e4090e2fd..5a37c075ee55 100644
1898     --- a/drivers/crypto/s5p-sss.c
1899     +++ b/drivers/crypto/s5p-sss.c
1900     @@ -298,7 +298,7 @@ static void s5p_unset_indata(struct s5p_aes_dev *dev)
1901     }
1902    
1903     static int s5p_make_sg_cpy(struct s5p_aes_dev *dev, struct scatterlist *src,
1904     - struct scatterlist **dst)
1905     + struct scatterlist **dst)
1906     {
1907     void *pages;
1908     int len;
1909     @@ -510,7 +510,7 @@ static int s5p_set_indata_start(struct s5p_aes_dev *dev,
1910     }
1911    
1912     static int s5p_set_outdata_start(struct s5p_aes_dev *dev,
1913     - struct ablkcipher_request *req)
1914     + struct ablkcipher_request *req)
1915     {
1916     struct scatterlist *sg;
1917     int err;
1918     diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
1919     index 141aefbe37ec..b0f798244a89 100644
1920     --- a/drivers/dma/Kconfig
1921     +++ b/drivers/dma/Kconfig
1922     @@ -120,7 +120,7 @@ config DMA_JZ4740
1923    
1924     config DMA_JZ4780
1925     tristate "JZ4780 DMA support"
1926     - depends on MACH_JZ4780 || COMPILE_TEST
1927     + depends on MIPS || COMPILE_TEST
1928     select DMA_ENGINE
1929     select DMA_VIRTUAL_CHANNELS
1930     help
1931     diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
1932     index 803cfb4523b0..aca2d6fd92d5 100644
1933     --- a/drivers/dma/dma-jz4780.c
1934     +++ b/drivers/dma/dma-jz4780.c
1935     @@ -580,7 +580,7 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan,
1936     to_jz4780_dma_desc(vdesc), 0);
1937     } else if (cookie == jzchan->desc->vdesc.tx.cookie) {
1938     txstate->residue = jz4780_dma_desc_residue(jzchan, jzchan->desc,
1939     - (jzchan->curr_hwdesc + 1) % jzchan->desc->count);
1940     + jzchan->curr_hwdesc + 1);
1941     } else
1942     txstate->residue = 0;
1943    
1944     diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
1945     index d139706f01fe..9d936584d331 100644
1946     --- a/drivers/dma/ioat/init.c
1947     +++ b/drivers/dma/ioat/init.c
1948     @@ -129,7 +129,7 @@ static void
1949     ioat_init_channel(struct ioatdma_device *ioat_dma,
1950     struct ioatdma_chan *ioat_chan, int idx);
1951     static void ioat_intr_quirk(struct ioatdma_device *ioat_dma);
1952     -static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma);
1953     +static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma);
1954     static int ioat3_dma_self_test(struct ioatdma_device *ioat_dma);
1955    
1956     static int ioat_dca_enabled = 1;
1957     @@ -573,7 +573,7 @@ static void ioat_dma_remove(struct ioatdma_device *ioat_dma)
1958     * ioat_enumerate_channels - find and initialize the device's channels
1959     * @ioat_dma: the ioat dma device to be enumerated
1960     */
1961     -static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma)
1962     +static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma)
1963     {
1964     struct ioatdma_chan *ioat_chan;
1965     struct device *dev = &ioat_dma->pdev->dev;
1966     @@ -592,7 +592,7 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma)
1967     xfercap_log = readb(ioat_dma->reg_base + IOAT_XFERCAP_OFFSET);
1968     xfercap_log &= 0x1f; /* bits [4:0] valid */
1969     if (xfercap_log == 0)
1970     - return 0;
1971     + return;
1972     dev_dbg(dev, "%s: xfercap = %d\n", __func__, 1 << xfercap_log);
1973    
1974     for (i = 0; i < dma->chancnt; i++) {
1975     @@ -609,7 +609,6 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma)
1976     }
1977     }
1978     dma->chancnt = i;
1979     - return i;
1980     }
1981    
1982     /**
1983     diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
1984     index 896bafb7a532..cf6588cc3efd 100644
1985     --- a/drivers/dma/timb_dma.c
1986     +++ b/drivers/dma/timb_dma.c
1987     @@ -545,7 +545,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
1988     }
1989    
1990     dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys,
1991     - td_desc->desc_list_len, DMA_MEM_TO_DEV);
1992     + td_desc->desc_list_len, DMA_TO_DEVICE);
1993    
1994     return &td_desc->txd;
1995     }
1996     diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
1997     index 537cec7583fc..cf88a0bfe99e 100644
1998     --- a/drivers/gpio/gpio-syscon.c
1999     +++ b/drivers/gpio/gpio-syscon.c
2000     @@ -122,7 +122,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val)
2001     BIT(offs % SYSCON_REG_BITS));
2002     }
2003    
2004     - priv->data->set(chip, offset, val);
2005     + chip->set(chip, offset, val);
2006    
2007     return 0;
2008     }
2009     diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
2010     index e6b49500c52a..8c9555313fc3 100644
2011     --- a/drivers/hwmon/ina3221.c
2012     +++ b/drivers/hwmon/ina3221.c
2013     @@ -38,9 +38,9 @@
2014     #define INA3221_WARN3 0x0c
2015     #define INA3221_MASK_ENABLE 0x0f
2016    
2017     -#define INA3221_CONFIG_MODE_SHUNT BIT(1)
2018     -#define INA3221_CONFIG_MODE_BUS BIT(2)
2019     -#define INA3221_CONFIG_MODE_CONTINUOUS BIT(3)
2020     +#define INA3221_CONFIG_MODE_SHUNT BIT(0)
2021     +#define INA3221_CONFIG_MODE_BUS BIT(1)
2022     +#define INA3221_CONFIG_MODE_CONTINUOUS BIT(2)
2023    
2024     #define INA3221_RSHUNT_DEFAULT 10000
2025    
2026     diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
2027     index fb03449de2e0..aa6333620c37 100644
2028     --- a/drivers/hwmon/pwm-fan.c
2029     +++ b/drivers/hwmon/pwm-fan.c
2030     @@ -231,8 +231,12 @@ static int pwm_fan_probe(struct platform_device *pdev)
2031    
2032     ctx->pwm = devm_of_pwm_get(&pdev->dev, pdev->dev.of_node, NULL);
2033     if (IS_ERR(ctx->pwm)) {
2034     - dev_err(&pdev->dev, "Could not get PWM\n");
2035     - return PTR_ERR(ctx->pwm);
2036     + ret = PTR_ERR(ctx->pwm);
2037     +
2038     + if (ret != -EPROBE_DEFER)
2039     + dev_err(&pdev->dev, "Could not get PWM: %d\n", ret);
2040     +
2041     + return ret;
2042     }
2043    
2044     platform_set_drvdata(pdev, ctx);
2045     diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
2046     index 44d6c29e2644..22079f886f45 100644
2047     --- a/drivers/hwtracing/coresight/coresight-etm4x.c
2048     +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
2049     @@ -35,6 +35,7 @@
2050     #include <linux/pm_runtime.h>
2051     #include <asm/sections.h>
2052     #include <asm/local.h>
2053     +#include <asm/virt.h>
2054    
2055     #include "coresight-etm4x.h"
2056     #include "coresight-etm-perf.h"
2057     @@ -615,7 +616,7 @@ static void etm4_set_default_config(struct etmv4_config *config)
2058     config->vinst_ctrl |= BIT(0);
2059     }
2060    
2061     -static u64 etm4_get_access_type(struct etmv4_config *config)
2062     +static u64 etm4_get_ns_access_type(struct etmv4_config *config)
2063     {
2064     u64 access_type = 0;
2065    
2066     @@ -626,17 +627,26 @@ static u64 etm4_get_access_type(struct etmv4_config *config)
2067     * Bit[13] Exception level 1 - OS
2068     * Bit[14] Exception level 2 - Hypervisor
2069     * Bit[15] Never implemented
2070     - *
2071     - * Always stay away from hypervisor mode.
2072     */
2073     - access_type = ETM_EXLEVEL_NS_HYP;
2074     -
2075     - if (config->mode & ETM_MODE_EXCL_KERN)
2076     - access_type |= ETM_EXLEVEL_NS_OS;
2077     + if (!is_kernel_in_hyp_mode()) {
2078     + /* Stay away from hypervisor mode for non-VHE */
2079     + access_type = ETM_EXLEVEL_NS_HYP;
2080     + if (config->mode & ETM_MODE_EXCL_KERN)
2081     + access_type |= ETM_EXLEVEL_NS_OS;
2082     + } else if (config->mode & ETM_MODE_EXCL_KERN) {
2083     + access_type = ETM_EXLEVEL_NS_HYP;
2084     + }
2085    
2086     if (config->mode & ETM_MODE_EXCL_USER)
2087     access_type |= ETM_EXLEVEL_NS_APP;
2088    
2089     + return access_type;
2090     +}
2091     +
2092     +static u64 etm4_get_access_type(struct etmv4_config *config)
2093     +{
2094     + u64 access_type = etm4_get_ns_access_type(config);
2095     +
2096     /*
2097     * EXLEVEL_S, bits[11:8], don't trace anything happening
2098     * in secure state.
2099     @@ -890,20 +900,10 @@ void etm4_config_trace_mode(struct etmv4_config *config)
2100    
2101     addr_acc = config->addr_acc[ETM_DEFAULT_ADDR_COMP];
2102     /* clear default config */
2103     - addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS);
2104     + addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS |
2105     + ETM_EXLEVEL_NS_HYP);
2106    
2107     - /*
2108     - * EXLEVEL_NS, bits[15:12]
2109     - * The Exception levels are:
2110     - * Bit[12] Exception level 0 - Application
2111     - * Bit[13] Exception level 1 - OS
2112     - * Bit[14] Exception level 2 - Hypervisor
2113     - * Bit[15] Never implemented
2114     - */
2115     - if (mode & ETM_MODE_EXCL_KERN)
2116     - addr_acc |= ETM_EXLEVEL_NS_OS;
2117     - else
2118     - addr_acc |= ETM_EXLEVEL_NS_APP;
2119     + addr_acc |= etm4_get_ns_access_type(config);
2120    
2121     config->addr_acc[ETM_DEFAULT_ADDR_COMP] = addr_acc;
2122     config->addr_acc[ETM_DEFAULT_ADDR_COMP + 1] = addr_acc;
2123     diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
2124     index d6941ea24d8d..14df4e34c21c 100644
2125     --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
2126     +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
2127     @@ -425,10 +425,10 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,
2128     case TMC_MEM_INTF_WIDTH_32BITS:
2129     case TMC_MEM_INTF_WIDTH_64BITS:
2130     case TMC_MEM_INTF_WIDTH_128BITS:
2131     - mask = GENMASK(31, 5);
2132     + mask = GENMASK(31, 4);
2133     break;
2134     case TMC_MEM_INTF_WIDTH_256BITS:
2135     - mask = GENMASK(31, 6);
2136     + mask = GENMASK(31, 5);
2137     break;
2138     }
2139    
2140     diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
2141     index 398e44a9ec45..5ffabc388630 100644
2142     --- a/drivers/hwtracing/coresight/coresight.c
2143     +++ b/drivers/hwtracing/coresight/coresight.c
2144     @@ -132,12 +132,14 @@ static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
2145     {
2146     int ret;
2147    
2148     - if (!csdev->enable) {
2149     - if (sink_ops(csdev)->enable) {
2150     - ret = sink_ops(csdev)->enable(csdev, mode);
2151     - if (ret)
2152     - return ret;
2153     - }
2154     + /*
2155     + * We need to make sure the "new" session is compatible with the
2156     + * existing "mode" of operation.
2157     + */
2158     + if (sink_ops(csdev)->enable) {
2159     + ret = sink_ops(csdev)->enable(csdev, mode);
2160     + if (ret)
2161     + return ret;
2162     csdev->enable = true;
2163     }
2164    
2165     @@ -331,8 +333,14 @@ int coresight_enable_path(struct list_head *path, u32 mode)
2166     switch (type) {
2167     case CORESIGHT_DEV_TYPE_SINK:
2168     ret = coresight_enable_sink(csdev, mode);
2169     + /*
2170     + * Sink is the first component turned on. If we
2171     + * failed to enable the sink, there are no components
2172     + * that need disabling. Disabling the path here
2173     + * would mean we could disrupt an existing session.
2174     + */
2175     if (ret)
2176     - goto err;
2177     + goto out;
2178     break;
2179     case CORESIGHT_DEV_TYPE_SOURCE:
2180     /* sources are enabled from either sysFS or Perf */
2181     diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
2182     index d252276feadf..759c621a860a 100644
2183     --- a/drivers/i2c/busses/Kconfig
2184     +++ b/drivers/i2c/busses/Kconfig
2185     @@ -397,12 +397,13 @@ config I2C_BCM_KONA
2186     If you do not need KONA I2C interface, say N.
2187    
2188     config I2C_BRCMSTB
2189     - tristate "BRCM Settop I2C controller"
2190     - depends on ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST
2191     + tristate "BRCM Settop/DSL I2C controller"
2192     + depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_63XX || \
2193     + COMPILE_TEST
2194     default y
2195     help
2196     If you say yes to this option, support will be included for the
2197     - I2C interface on the Broadcom Settop SoCs.
2198     + I2C interface on the Broadcom Settop/DSL SoCs.
2199    
2200     If you do not need I2C interface, say N.
2201    
2202     diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c
2203     index 3854d201a5d6..68dd0be1ac07 100644
2204     --- a/drivers/iio/dac/mcp4922.c
2205     +++ b/drivers/iio/dac/mcp4922.c
2206     @@ -94,17 +94,22 @@ static int mcp4922_write_raw(struct iio_dev *indio_dev,
2207     long mask)
2208     {
2209     struct mcp4922_state *state = iio_priv(indio_dev);
2210     + int ret;
2211    
2212     if (val2 != 0)
2213     return -EINVAL;
2214    
2215     switch (mask) {
2216     case IIO_CHAN_INFO_RAW:
2217     - if (val > GENMASK(chan->scan_type.realbits-1, 0))
2218     + if (val < 0 || val > GENMASK(chan->scan_type.realbits - 1, 0))
2219     return -EINVAL;
2220     val <<= chan->scan_type.shift;
2221     - state->value[chan->channel] = val;
2222     - return mcp4922_spi_write(state, chan->channel, val);
2223     +
2224     + ret = mcp4922_spi_write(state, chan->channel, val);
2225     + if (!ret)
2226     + state->value[chan->channel] = val;
2227     + return ret;
2228     +
2229     default:
2230     return -EINVAL;
2231     }
2232     diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
2233     index 717626046ee5..fbe662602f0a 100644
2234     --- a/drivers/infiniband/hw/hfi1/pcie.c
2235     +++ b/drivers/infiniband/hw/hfi1/pcie.c
2236     @@ -377,7 +377,9 @@ int pcie_speeds(struct hfi1_devdata *dd)
2237     /*
2238     * bus->max_bus_speed is set from the bridge's linkcap Max Link Speed
2239     */
2240     - if (parent && dd->pcidev->bus->max_bus_speed != PCIE_SPEED_8_0GT) {
2241     + if (parent &&
2242     + (dd->pcidev->bus->max_bus_speed == PCIE_SPEED_2_5GT ||
2243     + dd->pcidev->bus->max_bus_speed == PCIE_SPEED_5_0GT)) {
2244     dd_dev_info(dd, "Parent PCIe bridge does not support Gen3\n");
2245     dd->link_gen3_capable = 0;
2246     }
2247     diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
2248     index 85637696f6e9..282a726351c8 100644
2249     --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
2250     +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
2251     @@ -1652,7 +1652,7 @@ static enum i40iw_status_code i40iw_add_mqh_6(struct i40iw_device *iwdev,
2252     unsigned long flags;
2253    
2254     rtnl_lock();
2255     - for_each_netdev_rcu(&init_net, ip_dev) {
2256     + for_each_netdev(&init_net, ip_dev) {
2257     if ((((rdma_vlan_dev_vlan_id(ip_dev) < I40IW_NO_VLAN) &&
2258     (rdma_vlan_dev_real_dev(ip_dev) == iwdev->netdev)) ||
2259     (ip_dev == iwdev->netdev)) && (ip_dev->flags & IFF_UP)) {
2260     diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
2261     index ded76c101dde..834b06aacc2b 100644
2262     --- a/drivers/infiniband/hw/mthca/mthca_main.c
2263     +++ b/drivers/infiniband/hw/mthca/mthca_main.c
2264     @@ -989,7 +989,8 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type)
2265     goto err_free_dev;
2266     }
2267    
2268     - if (mthca_cmd_init(mdev)) {
2269     + err = mthca_cmd_init(mdev);
2270     + if (err) {
2271     mthca_err(mdev, "Failed to init command interface, aborting.\n");
2272     goto err_free_dev;
2273     }
2274     diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
2275     index df15b6d7b645..b03a6206d9be 100644
2276     --- a/drivers/infiniband/sw/rxe/rxe_comp.c
2277     +++ b/drivers/infiniband/sw/rxe/rxe_comp.c
2278     @@ -250,6 +250,17 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
2279     case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE:
2280     if (pkt->opcode != IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE &&
2281     pkt->opcode != IB_OPCODE_RC_RDMA_READ_RESPONSE_LAST) {
2282     + /* read retries of partial data may restart from
2283     + * read response first or response only.
2284     + */
2285     + if ((pkt->psn == wqe->first_psn &&
2286     + pkt->opcode ==
2287     + IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) ||
2288     + (wqe->first_psn == wqe->last_psn &&
2289     + pkt->opcode ==
2290     + IB_OPCODE_RC_RDMA_READ_RESPONSE_ONLY))
2291     + break;
2292     +
2293     return COMPST_ERROR;
2294     }
2295     break;
2296     @@ -486,11 +497,11 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp,
2297     struct rxe_pkt_info *pkt,
2298     struct rxe_send_wqe *wqe)
2299     {
2300     - qp->comp.opcode = -1;
2301     -
2302     - if (pkt) {
2303     - if (psn_compare(pkt->psn, qp->comp.psn) >= 0)
2304     - qp->comp.psn = (pkt->psn + 1) & BTH_PSN_MASK;
2305     + if (pkt && wqe->state == wqe_state_pending) {
2306     + if (psn_compare(wqe->last_psn, qp->comp.psn) >= 0) {
2307     + qp->comp.psn = (wqe->last_psn + 1) & BTH_PSN_MASK;
2308     + qp->comp.opcode = -1;
2309     + }
2310    
2311     if (qp->req.wait_psn) {
2312     qp->req.wait_psn = 0;
2313     diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
2314     index 0f9fe2ca2a91..6fb771290c56 100644
2315     --- a/drivers/infiniband/sw/rxe/rxe_req.c
2316     +++ b/drivers/infiniband/sw/rxe/rxe_req.c
2317     @@ -72,9 +72,6 @@ static void req_retry(struct rxe_qp *qp)
2318     int npsn;
2319     int first = 1;
2320    
2321     - wqe = queue_head(qp->sq.queue);
2322     - npsn = (qp->comp.psn - wqe->first_psn) & BTH_PSN_MASK;
2323     -
2324     qp->req.wqe_index = consumer_index(qp->sq.queue);
2325     qp->req.psn = qp->comp.psn;
2326     qp->req.opcode = -1;
2327     @@ -106,11 +103,17 @@ static void req_retry(struct rxe_qp *qp)
2328     if (first) {
2329     first = 0;
2330    
2331     - if (mask & WR_WRITE_OR_SEND_MASK)
2332     + if (mask & WR_WRITE_OR_SEND_MASK) {
2333     + npsn = (qp->comp.psn - wqe->first_psn) &
2334     + BTH_PSN_MASK;
2335     retry_first_write_send(qp, wqe, mask, npsn);
2336     + }
2337    
2338     - if (mask & WR_READ_MASK)
2339     + if (mask & WR_READ_MASK) {
2340     + npsn = (wqe->dma.length - wqe->dma.resid) /
2341     + qp->mtu;
2342     wqe->iova += npsn * qp->mtu;
2343     + }
2344     }
2345    
2346     wqe->state = wqe_state_posted;
2347     @@ -439,7 +442,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,
2348     if (pkt->mask & RXE_RETH_MASK) {
2349     reth_set_rkey(pkt, ibwr->wr.rdma.rkey);
2350     reth_set_va(pkt, wqe->iova);
2351     - reth_set_len(pkt, wqe->dma.length);
2352     + reth_set_len(pkt, wqe->dma.resid);
2353     }
2354    
2355     if (pkt->mask & RXE_IMMDT_MASK)
2356     diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
2357     index 81ae2e30dd12..27a7e4406f34 100644
2358     --- a/drivers/infiniband/ulp/iser/iser_initiator.c
2359     +++ b/drivers/infiniband/ulp/iser/iser_initiator.c
2360     @@ -590,13 +590,19 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc)
2361     ib_conn->post_recv_buf_count--;
2362     }
2363    
2364     -static inline void
2365     +static inline int
2366     iser_inv_desc(struct iser_fr_desc *desc, u32 rkey)
2367     {
2368     - if (likely(rkey == desc->rsc.mr->rkey))
2369     + if (likely(rkey == desc->rsc.mr->rkey)) {
2370     desc->rsc.mr_valid = 0;
2371     - else if (likely(rkey == desc->pi_ctx->sig_mr->rkey))
2372     + } else if (likely(desc->pi_ctx && rkey == desc->pi_ctx->sig_mr->rkey)) {
2373     desc->pi_ctx->sig_mr_valid = 0;
2374     + } else {
2375     + iser_err("Bogus remote invalidation for rkey %#x\n", rkey);
2376     + return -EINVAL;
2377     + }
2378     +
2379     + return 0;
2380     }
2381    
2382     static int
2383     @@ -624,12 +630,14 @@ iser_check_remote_inv(struct iser_conn *iser_conn,
2384    
2385     if (iser_task->dir[ISER_DIR_IN]) {
2386     desc = iser_task->rdma_reg[ISER_DIR_IN].mem_h;
2387     - iser_inv_desc(desc, rkey);
2388     + if (unlikely(iser_inv_desc(desc, rkey)))
2389     + return -EINVAL;
2390     }
2391    
2392     if (iser_task->dir[ISER_DIR_OUT]) {
2393     desc = iser_task->rdma_reg[ISER_DIR_OUT].mem_h;
2394     - iser_inv_desc(desc, rkey);
2395     + if (unlikely(iser_inv_desc(desc, rkey)))
2396     + return -EINVAL;
2397     }
2398     } else {
2399     iser_err("failed to get task for itt=%d\n", hdr->itt);
2400     diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
2401     index fcc6c3368182..ea3f0f5eb534 100644
2402     --- a/drivers/input/ff-memless.c
2403     +++ b/drivers/input/ff-memless.c
2404     @@ -501,6 +501,15 @@ static void ml_ff_destroy(struct ff_device *ff)
2405     {
2406     struct ml_device *ml = ff->private;
2407    
2408     + /*
2409     + * Even though we stop all playing effects when tearing down
2410     + * an input device (via input_device_flush() that calls into
2411     + * input_ff_flush() that stops and erases all effects), we
2412     + * do not actually stop the timer, and therefore we should
2413     + * do it here.
2414     + */
2415     + del_timer_sync(&ml->timer);
2416     +
2417     kfree(ml->private);
2418     }
2419    
2420     diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
2421     index 2e934aef3d2a..b669cdc8c8c6 100644
2422     --- a/drivers/input/rmi4/rmi_f54.c
2423     +++ b/drivers/input/rmi4/rmi_f54.c
2424     @@ -364,7 +364,7 @@ static const struct vb2_ops rmi_f54_queue_ops = {
2425     static const struct vb2_queue rmi_f54_queue = {
2426     .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
2427     .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ,
2428     - .buf_struct_size = sizeof(struct vb2_buffer),
2429     + .buf_struct_size = sizeof(struct vb2_v4l2_buffer),
2430     .ops = &rmi_f54_queue_ops,
2431     .mem_ops = &vb2_vmalloc_memops,
2432     .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
2433     @@ -617,7 +617,7 @@ static int rmi_f54_config(struct rmi_function *fn)
2434     {
2435     struct rmi_driver *drv = fn->rmi_dev->driver;
2436    
2437     - drv->set_irq_bits(fn->rmi_dev, fn->irq_mask);
2438     + drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask);
2439    
2440     return 0;
2441     }
2442     @@ -744,6 +744,7 @@ static void rmi_f54_remove(struct rmi_function *fn)
2443    
2444     video_unregister_device(&f54->vdev);
2445     v4l2_device_unregister(&f54->v4l2);
2446     + destroy_workqueue(f54->workqueue);
2447     }
2448    
2449     struct rmi_function_handler rmi_f54_handler = {
2450     diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
2451     index f502c8488be8..867772878c0c 100644
2452     --- a/drivers/input/touchscreen/silead.c
2453     +++ b/drivers/input/touchscreen/silead.c
2454     @@ -504,20 +504,33 @@ static int __maybe_unused silead_ts_suspend(struct device *dev)
2455     static int __maybe_unused silead_ts_resume(struct device *dev)
2456     {
2457     struct i2c_client *client = to_i2c_client(dev);
2458     + bool second_try = false;
2459     int error, status;
2460    
2461     silead_ts_set_power(client, SILEAD_POWER_ON);
2462    
2463     + retry:
2464     error = silead_ts_reset(client);
2465     if (error)
2466     return error;
2467    
2468     + if (second_try) {
2469     + error = silead_ts_load_fw(client);
2470     + if (error)
2471     + return error;
2472     + }
2473     +
2474     error = silead_ts_startup(client);
2475     if (error)
2476     return error;
2477    
2478     status = silead_ts_get_status(client);
2479     if (status != SILEAD_STATUS_OK) {
2480     + if (!second_try) {
2481     + second_try = true;
2482     + dev_dbg(dev, "Reloading firmware after unsuccessful resume\n");
2483     + goto retry;
2484     + }
2485     dev_err(dev, "Resume error, status: 0x%02x\n", status);
2486     return -ENODEV;
2487     }
2488     diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
2489     index e943678ce54c..f1c574d6be17 100644
2490     --- a/drivers/input/touchscreen/st1232.c
2491     +++ b/drivers/input/touchscreen/st1232.c
2492     @@ -203,6 +203,7 @@ static int st1232_ts_probe(struct i2c_client *client,
2493     input_dev->id.bustype = BUS_I2C;
2494     input_dev->dev.parent = &client->dev;
2495    
2496     + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
2497     __set_bit(EV_SYN, input_dev->evbit);
2498     __set_bit(EV_KEY, input_dev->evbit);
2499     __set_bit(EV_ABS, input_dev->evbit);
2500     diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
2501     index c5bc3e5e921e..080f9afcde8d 100644
2502     --- a/drivers/md/bcache/super.c
2503     +++ b/drivers/md/bcache/super.c
2504     @@ -904,6 +904,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
2505     bch_write_bdev_super(dc, &cl);
2506     closure_sync(&cl);
2507    
2508     + calc_cached_dev_sectors(dc->disk.c);
2509     bcache_device_detach(&dc->disk);
2510     list_move(&dc->list, &uncached_devices);
2511    
2512     diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c
2513     index f7299d3d8244..bcb51e87c72f 100644
2514     --- a/drivers/media/pci/ivtv/ivtv-yuv.c
2515     +++ b/drivers/media/pci/ivtv/ivtv-yuv.c
2516     @@ -935,7 +935,7 @@ static void ivtv_yuv_init(struct ivtv *itv)
2517     }
2518    
2519     /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */
2520     - yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL|__GFP_NOWARN);
2521     + yi->blanking_ptr = kzalloc(720 * 16, GFP_ATOMIC|__GFP_NOWARN);
2522     if (yi->blanking_ptr) {
2523     yi->blanking_dmaptr = pci_map_single(itv->pdev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE);
2524     } else {
2525     diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
2526     index ba887e8e1b17..a85c5199ccd3 100644
2527     --- a/drivers/media/pci/meye/meye.c
2528     +++ b/drivers/media/pci/meye/meye.c
2529     @@ -1469,7 +1469,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
2530     unsigned long page, pos;
2531    
2532     mutex_lock(&meye.lock);
2533     - if (size > gbuffers * gbufsize) {
2534     + if (size > gbuffers * gbufsize || offset > gbuffers * gbufsize - size) {
2535     mutex_unlock(&meye.lock);
2536     return -EINVAL;
2537     }
2538     diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
2539     index 99faea2e84c6..78e37cf3470f 100644
2540     --- a/drivers/media/platform/davinci/isif.c
2541     +++ b/drivers/media/platform/davinci/isif.c
2542     @@ -1106,7 +1106,8 @@ fail_nobase_res:
2543    
2544     while (i >= 0) {
2545     res = platform_get_resource(pdev, IORESOURCE_MEM, i);
2546     - release_mem_region(res->start, resource_size(res));
2547     + if (res)
2548     + release_mem_region(res->start, resource_size(res));
2549     i--;
2550     }
2551     vpfe_unregister_ccdc_device(&isif_hw_dev);
2552     diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
2553     index a9bc0175e4d3..c839003953a7 100644
2554     --- a/drivers/media/platform/davinci/vpbe_display.c
2555     +++ b/drivers/media/platform/davinci/vpbe_display.c
2556     @@ -518,7 +518,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev,
2557     else if (v_scale == 4)
2558     layer_info->v_zoom = ZOOM_X4;
2559     if (v_exp)
2560     - layer_info->h_exp = V_EXP_6_OVER_5;
2561     + layer_info->v_exp = V_EXP_6_OVER_5;
2562     } else {
2563     /* no scaling, only cropping. Set display area to crop area */
2564     cfg->ysize = expected_ysize;
2565     diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
2566     index 390d708c807a..3fab9f776afa 100644
2567     --- a/drivers/media/platform/pxa_camera.c
2568     +++ b/drivers/media/platform/pxa_camera.c
2569     @@ -2334,7 +2334,7 @@ static int pxa_camera_probe(struct platform_device *pdev)
2570     pcdev->res = res;
2571    
2572     pcdev->pdata = pdev->dev.platform_data;
2573     - if (&pdev->dev.of_node && !pcdev->pdata) {
2574     + if (pdev->dev.of_node && !pcdev->pdata) {
2575     err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd);
2576     } else {
2577     pcdev->platform_flags = pcdev->pdata->flags;
2578     diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
2579     index 38e73ee5c8fb..78f0bf8ee084 100644
2580     --- a/drivers/media/usb/au0828/au0828-core.c
2581     +++ b/drivers/media/usb/au0828/au0828-core.c
2582     @@ -639,7 +639,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
2583     /* Analog TV */
2584     retval = au0828_analog_register(dev, interface);
2585     if (retval) {
2586     - pr_err("%s() au0282_dev_register failed to register on V4L2\n",
2587     + pr_err("%s() au0828_analog_register failed to register on V4L2\n",
2588     __func__);
2589     goto done;
2590     }
2591     @@ -647,7 +647,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
2592     /* Digital TV */
2593     retval = au0828_dvb_register(dev);
2594     if (retval)
2595     - pr_err("%s() au0282_dev_register failed\n",
2596     + pr_err("%s() au0828_dvb_register failed\n",
2597     __func__);
2598    
2599     /* Remote controller */
2600     diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
2601     index 6414188ffdfa..cd973e780da9 100644
2602     --- a/drivers/media/usb/cx231xx/cx231xx-video.c
2603     +++ b/drivers/media/usb/cx231xx/cx231xx-video.c
2604     @@ -1389,7 +1389,7 @@ int cx231xx_g_register(struct file *file, void *priv,
2605     ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER,
2606     (u16)reg->reg, value, 4);
2607     reg->val = value[0] | value[1] << 8 |
2608     - value[2] << 16 | value[3] << 24;
2609     + value[2] << 16 | (u32)value[3] << 24;
2610     reg->size = 4;
2611     break;
2612     case 1: /* AFE - read byte */
2613     diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
2614     index 60286adbd6a1..e56f0844b98d 100644
2615     --- a/drivers/mfd/ti_am335x_tscadc.c
2616     +++ b/drivers/mfd/ti_am335x_tscadc.c
2617     @@ -295,11 +295,24 @@ static int ti_tscadc_remove(struct platform_device *pdev)
2618     return 0;
2619     }
2620    
2621     +static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data)
2622     +{
2623     + return device_may_wakeup(dev);
2624     +}
2625     +
2626     static int __maybe_unused tscadc_suspend(struct device *dev)
2627     {
2628     struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev);
2629    
2630     regmap_write(tscadc->regmap, REG_SE, 0x00);
2631     + if (device_for_each_child(dev, NULL, ti_tscadc_can_wakeup)) {
2632     + u32 ctrl;
2633     +
2634     + regmap_read(tscadc->regmap, REG_CTRL, &ctrl);
2635     + ctrl &= ~(CNTRLREG_POWERDOWN);
2636     + ctrl |= CNTRLREG_TSCSSENB;
2637     + regmap_write(tscadc->regmap, REG_CTRL, ctrl);
2638     + }
2639     pm_runtime_put_sync(dev);
2640    
2641     return 0;
2642     diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
2643     index 3e102cd6ed91..d08509cd978a 100644
2644     --- a/drivers/misc/cxl/guest.c
2645     +++ b/drivers/misc/cxl/guest.c
2646     @@ -1026,8 +1026,6 @@ err1:
2647    
2648     void cxl_guest_remove_afu(struct cxl_afu *afu)
2649     {
2650     - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
2651     -
2652     if (!afu)
2653     return;
2654    
2655     diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
2656     index b642b4fd731b..95584bffa4ea 100644
2657     --- a/drivers/misc/genwqe/card_utils.c
2658     +++ b/drivers/misc/genwqe/card_utils.c
2659     @@ -298,7 +298,7 @@ static int genwqe_sgl_size(int num_pages)
2660     int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2661     void __user *user_addr, size_t user_size)
2662     {
2663     - int rc;
2664     + int ret = -ENOMEM;
2665     struct pci_dev *pci_dev = cd->pci_dev;
2666    
2667     sgl->fpage_offs = offset_in_page((unsigned long)user_addr);
2668     @@ -317,7 +317,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2669     if (get_order(sgl->sgl_size) > MAX_ORDER) {
2670     dev_err(&pci_dev->dev,
2671     "[%s] err: too much memory requested!\n", __func__);
2672     - return -ENOMEM;
2673     + return ret;
2674     }
2675    
2676     sgl->sgl = __genwqe_alloc_consistent(cd, sgl->sgl_size,
2677     @@ -325,7 +325,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2678     if (sgl->sgl == NULL) {
2679     dev_err(&pci_dev->dev,
2680     "[%s] err: no memory available!\n", __func__);
2681     - return -ENOMEM;
2682     + return ret;
2683     }
2684    
2685     /* Only use buffering on incomplete pages */
2686     @@ -338,7 +338,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2687     /* Sync with user memory */
2688     if (copy_from_user(sgl->fpage + sgl->fpage_offs,
2689     user_addr, sgl->fpage_size)) {
2690     - rc = -EFAULT;
2691     + ret = -EFAULT;
2692     goto err_out;
2693     }
2694     }
2695     @@ -351,7 +351,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2696     /* Sync with user memory */
2697     if (copy_from_user(sgl->lpage, user_addr + user_size -
2698     sgl->lpage_size, sgl->lpage_size)) {
2699     - rc = -EFAULT;
2700     + ret = -EFAULT;
2701     goto err_out2;
2702     }
2703     }
2704     @@ -373,7 +373,8 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2705     sgl->sgl = NULL;
2706     sgl->sgl_dma_addr = 0;
2707     sgl->sgl_size = 0;
2708     - return -ENOMEM;
2709     +
2710     + return ret;
2711     }
2712    
2713     int genwqe_setup_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
2714     diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
2715     index bb3a76ad80da..fc8cb855c6e6 100644
2716     --- a/drivers/misc/kgdbts.c
2717     +++ b/drivers/misc/kgdbts.c
2718     @@ -979,6 +979,12 @@ static void kgdbts_run_tests(void)
2719     int nmi_sleep = 0;
2720     int i;
2721    
2722     + verbose = 0;
2723     + if (strstr(config, "V1"))
2724     + verbose = 1;
2725     + if (strstr(config, "V2"))
2726     + verbose = 2;
2727     +
2728     ptr = strchr(config, 'F');
2729     if (ptr)
2730     fork_test = simple_strtol(ptr + 1, NULL, 10);
2731     @@ -1062,13 +1068,6 @@ static int kgdbts_option_setup(char *opt)
2732     return -ENOSPC;
2733     }
2734     strcpy(config, opt);
2735     -
2736     - verbose = 0;
2737     - if (strstr(config, "V1"))
2738     - verbose = 1;
2739     - if (strstr(config, "V2"))
2740     - verbose = 2;
2741     -
2742     return 0;
2743     }
2744    
2745     @@ -1080,9 +1079,6 @@ static int configure_kgdbts(void)
2746    
2747     if (!strlen(config) || isspace(config[0]))
2748     goto noconfig;
2749     - err = kgdbts_option_setup(config);
2750     - if (err)
2751     - goto noconfig;
2752    
2753     final_ack = 0;
2754     run_plant_and_detach_test(1);
2755     diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
2756     index 2ff6140ea0b7..7f7af312e7ad 100644
2757     --- a/drivers/mmc/host/sdhci-of-at91.c
2758     +++ b/drivers/mmc/host/sdhci-of-at91.c
2759     @@ -318,7 +318,7 @@ static int sdhci_at91_probe(struct platform_device *pdev)
2760     pm_runtime_use_autosuspend(&pdev->dev);
2761    
2762     /* HS200 is broken at this moment */
2763     - host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200;
2764     + host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
2765    
2766     ret = sdhci_add_host(host);
2767     if (ret)
2768     diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
2769     index 3fad35942895..7a716bed1158 100644
2770     --- a/drivers/mtd/maps/physmap_of.c
2771     +++ b/drivers/mtd/maps/physmap_of.c
2772     @@ -29,7 +29,6 @@
2773     struct of_flash_list {
2774     struct mtd_info *mtd;
2775     struct map_info map;
2776     - struct resource *res;
2777     };
2778    
2779     struct of_flash {
2780     @@ -54,18 +53,10 @@ static int of_flash_remove(struct platform_device *dev)
2781     mtd_concat_destroy(info->cmtd);
2782     }
2783    
2784     - for (i = 0; i < info->list_size; i++) {
2785     + for (i = 0; i < info->list_size; i++)
2786     if (info->list[i].mtd)
2787     map_destroy(info->list[i].mtd);
2788    
2789     - if (info->list[i].map.virt)
2790     - iounmap(info->list[i].map.virt);
2791     -
2792     - if (info->list[i].res) {
2793     - release_resource(info->list[i].res);
2794     - kfree(info->list[i].res);
2795     - }
2796     - }
2797     return 0;
2798     }
2799    
2800     @@ -223,10 +214,11 @@ static int of_flash_probe(struct platform_device *dev)
2801    
2802     err = -EBUSY;
2803     res_size = resource_size(&res);
2804     - info->list[i].res = request_mem_region(res.start, res_size,
2805     - dev_name(&dev->dev));
2806     - if (!info->list[i].res)
2807     + info->list[i].map.virt = devm_ioremap_resource(&dev->dev, &res);
2808     + if (IS_ERR(info->list[i].map.virt)) {
2809     + err = PTR_ERR(info->list[i].map.virt);
2810     goto err_out;
2811     + }
2812    
2813     err = -ENXIO;
2814     width = of_get_property(dp, "bank-width", NULL);
2815     @@ -247,15 +239,6 @@ static int of_flash_probe(struct platform_device *dev)
2816     return err;
2817     }
2818    
2819     - err = -ENOMEM;
2820     - info->list[i].map.virt = ioremap(info->list[i].map.phys,
2821     - info->list[i].map.size);
2822     - if (!info->list[i].map.virt) {
2823     - dev_err(&dev->dev, "Failed to ioremap() flash"
2824     - " region\n");
2825     - goto err_out;
2826     - }
2827     -
2828     simple_map_init(&info->list[i].map);
2829    
2830     /*
2831     diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
2832     index 442ce619b3b6..d6c013f93b8c 100644
2833     --- a/drivers/mtd/nand/sh_flctl.c
2834     +++ b/drivers/mtd/nand/sh_flctl.c
2835     @@ -480,7 +480,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset)
2836    
2837     /* initiate DMA transfer */
2838     if (flctl->chan_fifo0_rx && rlen >= 32 &&
2839     - flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_DEV_TO_MEM) > 0)
2840     + flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0)
2841     goto convert; /* DMA success */
2842    
2843     /* do polling transfer */
2844     @@ -539,7 +539,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen,
2845    
2846     /* initiate DMA transfer */
2847     if (flctl->chan_fifo0_tx && rlen >= 32 &&
2848     - flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_MEM_TO_DEV) > 0)
2849     + flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0)
2850     return; /* DMA success */
2851    
2852     /* do polling transfer */
2853     diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
2854     index eb7173713bbc..a2c4048c07be 100644
2855     --- a/drivers/net/can/slcan.c
2856     +++ b/drivers/net/can/slcan.c
2857     @@ -613,6 +613,7 @@ err_free_chan:
2858     sl->tty = NULL;
2859     tty->disc_data = NULL;
2860     clear_bit(SLF_INUSE, &sl->flags);
2861     + free_netdev(sl->dev);
2862    
2863     err_exit:
2864     rtnl_unlock();
2865     diff --git a/drivers/net/ethernet/amd/am79c961a.c b/drivers/net/ethernet/amd/am79c961a.c
2866     index fcdf5dda448f..77d99c532917 100644
2867     --- a/drivers/net/ethernet/amd/am79c961a.c
2868     +++ b/drivers/net/ethernet/amd/am79c961a.c
2869     @@ -440,7 +440,7 @@ static void am79c961_timeout(struct net_device *dev)
2870     /*
2871     * Transmit a packet
2872     */
2873     -static int
2874     +static netdev_tx_t
2875     am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)
2876     {
2877     struct dev_priv *priv = netdev_priv(dev);
2878     diff --git a/drivers/net/ethernet/amd/atarilance.c b/drivers/net/ethernet/amd/atarilance.c
2879     index d2bc8e5dcd23..35a9f252ceb6 100644
2880     --- a/drivers/net/ethernet/amd/atarilance.c
2881     +++ b/drivers/net/ethernet/amd/atarilance.c
2882     @@ -339,7 +339,8 @@ static unsigned long lance_probe1( struct net_device *dev, struct lance_addr
2883     *init_rec );
2884     static int lance_open( struct net_device *dev );
2885     static void lance_init_ring( struct net_device *dev );
2886     -static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev );
2887     +static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
2888     + struct net_device *dev);
2889     static irqreturn_t lance_interrupt( int irq, void *dev_id );
2890     static int lance_rx( struct net_device *dev );
2891     static int lance_close( struct net_device *dev );
2892     @@ -770,7 +771,8 @@ static void lance_tx_timeout (struct net_device *dev)
2893    
2894     /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
2895    
2896     -static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
2897     +static netdev_tx_t
2898     +lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
2899     {
2900     struct lance_private *lp = netdev_priv(dev);
2901     struct lance_ioreg *IO = lp->iobase;
2902     diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c
2903     index 9e80a76c3dfe..76393ae4cf0a 100644
2904     --- a/drivers/net/ethernet/amd/declance.c
2905     +++ b/drivers/net/ethernet/amd/declance.c
2906     @@ -893,7 +893,7 @@ static void lance_tx_timeout(struct net_device *dev)
2907     netif_wake_queue(dev);
2908     }
2909    
2910     -static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
2911     +static netdev_tx_t lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
2912     {
2913     struct lance_private *lp = netdev_priv(dev);
2914     volatile struct lance_regs *ll = lp->ll;
2915     diff --git a/drivers/net/ethernet/amd/sun3lance.c b/drivers/net/ethernet/amd/sun3lance.c
2916     index 3d8c6b2cdea4..09271665712d 100644
2917     --- a/drivers/net/ethernet/amd/sun3lance.c
2918     +++ b/drivers/net/ethernet/amd/sun3lance.c
2919     @@ -235,7 +235,8 @@ struct lance_private {
2920     static int lance_probe( struct net_device *dev);
2921     static int lance_open( struct net_device *dev );
2922     static void lance_init_ring( struct net_device *dev );
2923     -static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev );
2924     +static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
2925     + struct net_device *dev);
2926     static irqreturn_t lance_interrupt( int irq, void *dev_id);
2927     static int lance_rx( struct net_device *dev );
2928     static int lance_close( struct net_device *dev );
2929     @@ -511,7 +512,8 @@ static void lance_init_ring( struct net_device *dev )
2930     }
2931    
2932    
2933     -static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
2934     +static netdev_tx_t
2935     +lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
2936     {
2937     struct lance_private *lp = netdev_priv(dev);
2938     int entry, len;
2939     diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c
2940     index 3153465d4d02..acbbe4e5a2f8 100644
2941     --- a/drivers/net/ethernet/amd/sunlance.c
2942     +++ b/drivers/net/ethernet/amd/sunlance.c
2943     @@ -1106,7 +1106,7 @@ static void lance_tx_timeout(struct net_device *dev)
2944     netif_wake_queue(dev);
2945     }
2946    
2947     -static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
2948     +static netdev_tx_t lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
2949     {
2950     struct lance_private *lp = netdev_priv(dev);
2951     int entry, skblen, len;
2952     diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
2953     index 1e4e8b245cd5..1df7f5da8411 100644
2954     --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
2955     +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
2956     @@ -1390,7 +1390,7 @@ static int xgbe_close(struct net_device *netdev)
2957     return 0;
2958     }
2959    
2960     -static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev)
2961     +static netdev_tx_t xgbe_xmit(struct sk_buff *skb, struct net_device *netdev)
2962     {
2963     struct xgbe_prv_data *pdata = netdev_priv(netdev);
2964     struct xgbe_hw_if *hw_if = &pdata->hw_if;
2965     @@ -1399,7 +1399,7 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev)
2966     struct xgbe_ring *ring;
2967     struct xgbe_packet_data *packet;
2968     struct netdev_queue *txq;
2969     - int ret;
2970     + netdev_tx_t ret;
2971    
2972     DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len);
2973    
2974     diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
2975     index c4078401b7de..900f2f706cbc 100644
2976     --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
2977     +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
2978     @@ -571,12 +571,13 @@ static irqreturn_t bcm_enet_isr_dma(int irq, void *dev_id)
2979     /*
2980     * tx request callback
2981     */
2982     -static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
2983     +static netdev_tx_t
2984     +bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
2985     {
2986     struct bcm_enet_priv *priv;
2987     struct bcm_enet_desc *desc;
2988     u32 len_stat;
2989     - int ret;
2990     + netdev_tx_t ret;
2991    
2992     priv = netdev_priv(dev);
2993    
2994     diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
2995     index a9681b191304..ce8a777b1e97 100644
2996     --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
2997     +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
2998     @@ -3540,6 +3540,16 @@ static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp)
2999     */
3000     static void bnx2x_config_mf_bw(struct bnx2x *bp)
3001     {
3002     + /* Workaround for MFW bug.
3003     + * MFW is not supposed to generate BW attention in
3004     + * single function mode.
3005     + */
3006     + if (!IS_MF(bp)) {
3007     + DP(BNX2X_MSG_MCP,
3008     + "Ignoring MF BW config in single function mode\n");
3009     + return;
3010     + }
3011     +
3012     if (bp->link_vars.link_up) {
3013     bnx2x_cmng_fns_init(bp, true, CMNG_FNS_MINMAX);
3014     bnx2x_link_sync_notify(bp);
3015     diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
3016     index f1b81187a201..dc7953894c35 100644
3017     --- a/drivers/net/ethernet/broadcom/sb1250-mac.c
3018     +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
3019     @@ -299,7 +299,7 @@ static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *,
3020     static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff);
3021     static uint64_t sbmac_addr2reg(unsigned char *ptr);
3022     static irqreturn_t sbmac_intr(int irq, void *dev_instance);
3023     -static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev);
3024     +static netdev_tx_t sbmac_start_tx(struct sk_buff *skb, struct net_device *dev);
3025     static void sbmac_setmulti(struct sbmac_softc *sc);
3026     static int sbmac_init(struct platform_device *pldev, long long base);
3027     static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed);
3028     @@ -2032,7 +2032,7 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance)
3029     * Return value:
3030     * nothing
3031     ********************************************************************* */
3032     -static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
3033     +static netdev_tx_t sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
3034     {
3035     struct sbmac_softc *sc = netdev_priv(dev);
3036     unsigned long flags;
3037     diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
3038     index 6ee2ed30626b..306b4b320616 100644
3039     --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
3040     +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
3041     @@ -266,8 +266,8 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap,
3042     enum cxgb4_dcb_state_input input =
3043     ((pcmd->u.dcb.control.all_syncd_pkd &
3044     FW_PORT_CMD_ALL_SYNCD_F)
3045     - ? CXGB4_DCB_STATE_FW_ALLSYNCED
3046     - : CXGB4_DCB_STATE_FW_INCOMPLETE);
3047     + ? CXGB4_DCB_INPUT_FW_ALLSYNCED
3048     + : CXGB4_DCB_INPUT_FW_INCOMPLETE);
3049    
3050     if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) {
3051     dcb_running_version = FW_PORT_CMD_DCB_VERSION_G(
3052     diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
3053     index ccf24d3dc982..2c418c405c50 100644
3054     --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
3055     +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
3056     @@ -67,7 +67,7 @@
3057     do { \
3058     if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \
3059     cxgb4_dcb_state_fsm((__dev), \
3060     - CXGB4_DCB_STATE_FW_ALLSYNCED); \
3061     + CXGB4_DCB_INPUT_FW_ALLSYNCED); \
3062     } while (0)
3063    
3064     /* States we can be in for a port's Data Center Bridging.
3065     diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
3066     index ebeeb3581b9c..b4b435276a18 100644
3067     --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
3068     +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
3069     @@ -3541,7 +3541,7 @@ int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op)
3070     c.param[0].mnem =
3071     cpu_to_be32(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
3072     FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWCACHE));
3073     - c.param[0].val = (__force __be32)op;
3074     + c.param[0].val = cpu_to_be32(op);
3075    
3076     return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL);
3077     }
3078     diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
3079     index 886378c5334f..043b69b5843b 100644
3080     --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
3081     +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
3082     @@ -11360,6 +11360,7 @@ static void i40e_remove(struct pci_dev *pdev)
3083     mutex_destroy(&hw->aq.asq_mutex);
3084    
3085     /* Clear all dynamic memory lists of rings, q_vectors, and VSIs */
3086     + rtnl_lock();
3087     i40e_clear_interrupt_scheme(pf);
3088     for (i = 0; i < pf->num_alloc_vsi; i++) {
3089     if (pf->vsi[i]) {
3090     @@ -11368,6 +11369,7 @@ static void i40e_remove(struct pci_dev *pdev)
3091     pf->vsi[i] = NULL;
3092     }
3093     }
3094     + rtnl_unlock();
3095    
3096     for (i = 0; i < I40E_MAX_VEB; i++) {
3097     kfree(pf->veb[i]);
3098     @@ -11513,7 +11515,13 @@ static void i40e_shutdown(struct pci_dev *pdev)
3099     wr32(hw, I40E_PFPM_WUFC,
3100     (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0));
3101    
3102     + /* Since we're going to destroy queues during the
3103     + * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this
3104     + * whole section
3105     + */
3106     + rtnl_lock();
3107     i40e_clear_interrupt_scheme(pf);
3108     + rtnl_unlock();
3109    
3110     if (system_state == SYSTEM_POWER_OFF) {
3111     pci_wake_from_d3(pdev, pf->wol_en);
3112     diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
3113     index f1feceab758a..41cbcb0ac2d9 100644
3114     --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
3115     +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
3116     @@ -604,7 +604,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf)
3117     if (!IS_ERR_OR_NULL(pf->ptp_clock))
3118     return 0;
3119    
3120     - strncpy(pf->ptp_caps.name, i40e_driver_name, sizeof(pf->ptp_caps.name));
3121     + strncpy(pf->ptp_caps.name, i40e_driver_name,
3122     + sizeof(pf->ptp_caps.name) - 1);
3123     pf->ptp_caps.owner = THIS_MODULE;
3124     pf->ptp_caps.max_adj = 999999999;
3125     pf->ptp_caps.n_ext_ts = 0;
3126     diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
3127     index 54b8ee2583f1..7484ad3c955d 100644
3128     --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
3129     +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
3130     @@ -2000,6 +2000,16 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
3131     ret = I40E_ERR_INVALID_MAC_ADDR;
3132     goto error_param;
3133     }
3134     +
3135     + if (vf->pf_set_mac &&
3136     + ether_addr_equal(al->list[i].addr,
3137     + vf->default_lan_addr.addr)) {
3138     + dev_err(&pf->pdev->dev,
3139     + "MAC addr %pM has been set by PF, cannot delete it for VF %d, reset VF to change MAC addr\n",
3140     + vf->default_lan_addr.addr, vf->vf_id);
3141     + ret = I40E_ERR_PARAM;
3142     + goto error_param;
3143     + }
3144     }
3145     vsi = pf->vsi[vf->lan_vsi_idx];
3146    
3147     diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
3148     index a5428b6abdac..8ad20b7852ed 100644
3149     --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
3150     +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
3151     @@ -4804,6 +4804,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
3152     struct ixgbe_hw *hw = &adapter->hw;
3153     struct hlist_node *node2;
3154     struct ixgbe_fdir_filter *filter;
3155     + u64 action;
3156    
3157     spin_lock(&adapter->fdir_perfect_lock);
3158    
3159     @@ -4812,12 +4813,17 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
3160    
3161     hlist_for_each_entry_safe(filter, node2,
3162     &adapter->fdir_filter_list, fdir_node) {
3163     + action = filter->action;
3164     + if (action != IXGBE_FDIR_DROP_QUEUE && action != 0)
3165     + action =
3166     + (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1;
3167     +
3168     ixgbe_fdir_write_perfect_filter_82599(hw,
3169     &filter->filter,
3170     filter->sw_idx,
3171     - (filter->action == IXGBE_FDIR_DROP_QUEUE) ?
3172     + (action == IXGBE_FDIR_DROP_QUEUE) ?
3173     IXGBE_FDIR_DROP_QUEUE :
3174     - adapter->rx_ring[filter->action]->reg_idx);
3175     + adapter->rx_ring[action]->reg_idx);
3176     }
3177    
3178     spin_unlock(&adapter->fdir_perfect_lock);
3179     diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3180     index 585a40cc6470..8460c4807567 100644
3181     --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3182     +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3183     @@ -2191,6 +2191,13 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port)
3184     MLXSW_REG_QEEC_MAS_DIS);
3185     if (err)
3186     return err;
3187     +
3188     + err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
3189     + MLXSW_REG_QEEC_HIERARCY_TC,
3190     + i + 8, i,
3191     + MLXSW_REG_QEEC_MAS_DIS);
3192     + if (err)
3193     + return err;
3194     }
3195    
3196     /* Map all priorities to traffic class 0. */
3197     diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c
3198     index 20cb85bc0c5f..6135d90f368f 100644
3199     --- a/drivers/net/ethernet/micrel/ks8695net.c
3200     +++ b/drivers/net/ethernet/micrel/ks8695net.c
3201     @@ -1156,7 +1156,7 @@ ks8695_timeout(struct net_device *ndev)
3202     * sk_buff and adds it to the TX ring. It then kicks the TX DMA
3203     * engine to ensure transmission begins.
3204     */
3205     -static int
3206     +static netdev_tx_t
3207     ks8695_start_xmit(struct sk_buff *skb, struct net_device *ndev)
3208     {
3209     struct ks8695_priv *ksp = netdev_priv(ndev);
3210     diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
3211     index 2fc5cd56c0a8..8dc1f0277117 100644
3212     --- a/drivers/net/ethernet/micrel/ks8851_mll.c
3213     +++ b/drivers/net/ethernet/micrel/ks8851_mll.c
3214     @@ -1020,9 +1020,9 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len)
3215     * spin_lock_irqsave is required because tx and rx should be mutual exclusive.
3216     * So while tx is in-progress, prevent IRQ interrupt from happenning.
3217     */
3218     -static int ks_start_xmit(struct sk_buff *skb, struct net_device *netdev)
3219     +static netdev_tx_t ks_start_xmit(struct sk_buff *skb, struct net_device *netdev)
3220     {
3221     - int retv = NETDEV_TX_OK;
3222     + netdev_tx_t retv = NETDEV_TX_OK;
3223     struct ks_net *ks = netdev_priv(netdev);
3224    
3225     disable_irq(netdev->irq);
3226     diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
3227     index cb49c9654f0a..323b3ac16bc0 100644
3228     --- a/drivers/net/ethernet/smsc/smc911x.c
3229     +++ b/drivers/net/ethernet/smsc/smc911x.c
3230     @@ -514,7 +514,8 @@ static void smc911x_hardware_send_pkt(struct net_device *dev)
3231     * now, or set the card to generates an interrupt when ready
3232     * for the packet.
3233     */
3234     -static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
3235     +static netdev_tx_t
3236     +smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
3237     {
3238     struct smc911x_local *lp = netdev_priv(dev);
3239     unsigned int free;
3240     diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
3241     index 73212590d04a..b0c72167bade 100644
3242     --- a/drivers/net/ethernet/smsc/smc91x.c
3243     +++ b/drivers/net/ethernet/smsc/smc91x.c
3244     @@ -637,7 +637,8 @@ done: if (!THROTTLE_TX_PKTS)
3245     * now, or set the card to generates an interrupt when ready
3246     * for the packet.
3247     */
3248     -static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
3249     +static netdev_tx_t
3250     +smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
3251     {
3252     struct smc_local *lp = netdev_priv(dev);
3253     void __iomem *ioaddr = lp->base;
3254     diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
3255     index 734caa7a557b..4143659615e1 100644
3256     --- a/drivers/net/ethernet/smsc/smsc911x.c
3257     +++ b/drivers/net/ethernet/smsc/smsc911x.c
3258     @@ -1776,7 +1776,8 @@ static int smsc911x_stop(struct net_device *dev)
3259     }
3260    
3261     /* Entry point for transmitting a packet */
3262     -static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
3263     +static netdev_tx_t
3264     +smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
3265     {
3266     struct smsc911x_data *pdata = netdev_priv(dev);
3267     unsigned int freespace;
3268     diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
3269     index 272f2b1cb7ad..34f843795531 100644
3270     --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
3271     +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
3272     @@ -845,9 +845,9 @@ static int gelic_card_kick_txdma(struct gelic_card *card,
3273     * @skb: packet to send out
3274     * @netdev: interface device structure
3275     *
3276     - * returns 0 on success, <0 on failure
3277     + * returns NETDEV_TX_OK on success, NETDEV_TX_BUSY on failure
3278     */
3279     -int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
3280     +netdev_tx_t gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
3281     {
3282     struct gelic_card *card = netdev_card(netdev);
3283     struct gelic_descr *descr;
3284     diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.h b/drivers/net/ethernet/toshiba/ps3_gelic_net.h
3285     index 8505196be9f5..d123644bd720 100644
3286     --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.h
3287     +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.h
3288     @@ -370,7 +370,7 @@ void gelic_card_up(struct gelic_card *card);
3289     void gelic_card_down(struct gelic_card *card);
3290     int gelic_net_open(struct net_device *netdev);
3291     int gelic_net_stop(struct net_device *netdev);
3292     -int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
3293     +netdev_tx_t gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
3294     void gelic_net_set_multi(struct net_device *netdev);
3295     void gelic_net_tx_timeout(struct net_device *netdev);
3296     int gelic_net_change_mtu(struct net_device *netdev, int new_mtu);
3297     diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c
3298     index 36a6e8b54d94..108598794621 100644
3299     --- a/drivers/net/ethernet/toshiba/spider_net.c
3300     +++ b/drivers/net/ethernet/toshiba/spider_net.c
3301     @@ -880,9 +880,9 @@ out:
3302     * @skb: packet to send out
3303     * @netdev: interface device structure
3304     *
3305     - * returns 0 on success, !0 on failure
3306     + * returns NETDEV_TX_OK on success, NETDEV_TX_BUSY on failure
3307     */
3308     -static int
3309     +static netdev_tx_t
3310     spider_net_xmit(struct sk_buff *skb, struct net_device *netdev)
3311     {
3312     int cnt;
3313     diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
3314     index 47ebac456ae5..9b84ee736fdc 100644
3315     --- a/drivers/net/ethernet/toshiba/tc35815.c
3316     +++ b/drivers/net/ethernet/toshiba/tc35815.c
3317     @@ -474,7 +474,8 @@ static void free_rxbuf_skb(struct pci_dev *hwdev, struct sk_buff *skb, dma_addr_
3318     /* Index to functions, as function prototypes. */
3319    
3320     static int tc35815_open(struct net_device *dev);
3321     -static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev);
3322     +static netdev_tx_t tc35815_send_packet(struct sk_buff *skb,
3323     + struct net_device *dev);
3324     static irqreturn_t tc35815_interrupt(int irq, void *dev_id);
3325     static int tc35815_rx(struct net_device *dev, int limit);
3326     static int tc35815_poll(struct napi_struct *napi, int budget);
3327     @@ -1249,7 +1250,8 @@ tc35815_open(struct net_device *dev)
3328     * invariant will hold if you make sure that the netif_*_queue()
3329     * calls are done at the proper times.
3330     */
3331     -static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
3332     +static netdev_tx_t
3333     +tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
3334     {
3335     struct tc35815_local *lp = netdev_priv(dev);
3336     struct TxFD *txfd;
3337     diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
3338     index a9bd665fd122..545f60877bb7 100644
3339     --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
3340     +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
3341     @@ -673,7 +673,8 @@ static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag)
3342     return 0;
3343     }
3344    
3345     -static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
3346     +static netdev_tx_t
3347     +temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
3348     {
3349     struct temac_local *lp = netdev_priv(ndev);
3350     struct cdmac_bd *cur_p;
3351     diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
3352     index 5f21ddff9e0f..46fcf3ec2caf 100644
3353     --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
3354     +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
3355     @@ -655,7 +655,8 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp,
3356     * start the transmission. Additionally if checksum offloading is supported,
3357     * it populates AXI Stream Control fields with appropriate values.
3358     */
3359     -static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
3360     +static netdev_tx_t
3361     +axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
3362     {
3363     u32 ii;
3364     u32 num_frag;
3365     diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
3366     index aa02a03a6d8d..034b36442ee7 100644
3367     --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
3368     +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
3369     @@ -1005,9 +1005,10 @@ static int xemaclite_close(struct net_device *dev)
3370     * deferred and the Tx queue is stopped so that the deferred socket buffer can
3371     * be transmitted when the Emaclite device is free to transmit data.
3372     *
3373     - * Return: 0, always.
3374     + * Return: NETDEV_TX_OK, always.
3375     */
3376     -static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
3377     +static netdev_tx_t
3378     +xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
3379     {
3380     struct net_local *lp = netdev_priv(dev);
3381     struct sk_buff *new_skb;
3382     @@ -1028,7 +1029,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
3383     /* Take the time stamp now, since we can't do this in an ISR. */
3384     skb_tx_timestamp(new_skb);
3385     spin_unlock_irqrestore(&lp->reset_lock, flags);
3386     - return 0;
3387     + return NETDEV_TX_OK;
3388     }
3389     spin_unlock_irqrestore(&lp->reset_lock, flags);
3390    
3391     @@ -1037,7 +1038,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev)
3392     dev->stats.tx_bytes += len;
3393     dev_consume_skb_any(new_skb);
3394    
3395     - return 0;
3396     + return NETDEV_TX_OK;
3397     }
3398    
3399     /**
3400     diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
3401     index 9ed6d1c1ee45..b2317b3a542a 100644
3402     --- a/drivers/net/slip/slip.c
3403     +++ b/drivers/net/slip/slip.c
3404     @@ -860,6 +860,7 @@ err_free_chan:
3405     sl->tty = NULL;
3406     tty->disc_data = NULL;
3407     clear_bit(SLF_INUSE, &sl->flags);
3408     + free_netdev(sl->dev);
3409    
3410     err_exit:
3411     rtnl_unlock();
3412     diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c
3413     index 49a3bc107d05..2c50497cc4ed 100644
3414     --- a/drivers/net/usb/ax88172a.c
3415     +++ b/drivers/net/usb/ax88172a.c
3416     @@ -215,7 +215,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf)
3417    
3418     /* Get the MAC address */
3419     ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);
3420     - if (ret < 0) {
3421     + if (ret < ETH_ALEN) {
3422     netdev_err(dev->net, "Failed to read MAC address: %d\n", ret);
3423     goto free;
3424     }
3425     diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
3426     index cbb9b4343d1e..be4e56826daf 100644
3427     --- a/drivers/net/usb/cdc_ncm.c
3428     +++ b/drivers/net/usb/cdc_ncm.c
3429     @@ -577,7 +577,7 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size)
3430     err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE,
3431     USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
3432     0, iface_no, &max_datagram_size, sizeof(max_datagram_size));
3433     - if (err < sizeof(max_datagram_size)) {
3434     + if (err != sizeof(max_datagram_size)) {
3435     dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n");
3436     goto out;
3437     }
3438     diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
3439     index e143a7fe9320..a3f9d8f05db4 100644
3440     --- a/drivers/net/usb/lan78xx.c
3441     +++ b/drivers/net/usb/lan78xx.c
3442     @@ -2621,6 +2621,11 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
3443     int i;
3444    
3445     ret = lan78xx_get_endpoints(dev, intf);
3446     + if (ret) {
3447     + netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n",
3448     + ret);
3449     + return ret;
3450     + }
3451    
3452     dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL);
3453    
3454     diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
3455     index da770af83036..125b5c31b2b0 100644
3456     --- a/drivers/net/wireless/ath/ath10k/ahb.c
3457     +++ b/drivers/net/wireless/ath/ath10k/ahb.c
3458     @@ -658,10 +658,10 @@ static void ath10k_ahb_hif_stop(struct ath10k *ar)
3459     ath10k_ahb_irq_disable(ar);
3460     synchronize_irq(ar_ahb->irq);
3461    
3462     - ath10k_pci_flush(ar);
3463     -
3464     napi_synchronize(&ar->napi);
3465     napi_disable(&ar->napi);
3466     +
3467     + ath10k_pci_flush(ar);
3468     }
3469    
3470     static int ath10k_ahb_hif_power_up(struct ath10k *ar)
3471     diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
3472     index 90c0c4a7175d..414153cd5784 100644
3473     --- a/drivers/net/wireless/ath/ath10k/core.h
3474     +++ b/drivers/net/wireless/ath/ath10k/core.h
3475     @@ -811,6 +811,7 @@ struct ath10k {
3476    
3477     struct completion install_key_done;
3478    
3479     + int last_wmi_vdev_start_status;
3480     struct completion vdev_setup_done;
3481    
3482     struct workqueue_struct *workqueue;
3483     diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
3484     index 1588fe8110d0..2294ba311c47 100644
3485     --- a/drivers/net/wireless/ath/ath10k/mac.c
3486     +++ b/drivers/net/wireless/ath/ath10k/mac.c
3487     @@ -947,7 +947,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar)
3488     if (time_left == 0)
3489     return -ETIMEDOUT;
3490    
3491     - return 0;
3492     + return ar->last_wmi_vdev_start_status;
3493     }
3494    
3495     static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
3496     diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
3497     index 25b8d501d437..b7bac14d1487 100644
3498     --- a/drivers/net/wireless/ath/ath10k/pci.c
3499     +++ b/drivers/net/wireless/ath/ath10k/pci.c
3500     @@ -1781,9 +1781,9 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
3501    
3502     ath10k_pci_irq_disable(ar);
3503     ath10k_pci_irq_sync(ar);
3504     - ath10k_pci_flush(ar);
3505     napi_synchronize(&ar->napi);
3506     napi_disable(&ar->napi);
3507     + ath10k_pci_flush(ar);
3508    
3509     spin_lock_irqsave(&ar_pci->ps_lock, flags);
3510     WARN_ON(ar_pci->ps_wake_refcount > 0);
3511     diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
3512     index bbfe7be214e1..af3bc06b4aed 100644
3513     --- a/drivers/net/wireless/ath/ath10k/wmi.c
3514     +++ b/drivers/net/wireless/ath/ath10k/wmi.c
3515     @@ -2384,7 +2384,8 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
3516     status->freq, status->band, status->signal,
3517     status->rate_idx);
3518    
3519     - ieee80211_rx(ar->hw, skb);
3520     + ieee80211_rx_ni(ar->hw, skb);
3521     +
3522     return 0;
3523     }
3524    
3525     @@ -3102,18 +3103,31 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
3526     {
3527     struct wmi_vdev_start_ev_arg arg = {};
3528     int ret;
3529     + u32 status;
3530    
3531     ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n");
3532    
3533     + ar->last_wmi_vdev_start_status = 0;
3534     +
3535     ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
3536     if (ret) {
3537     ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret);
3538     - return;
3539     + ar->last_wmi_vdev_start_status = ret;
3540     + goto out;
3541     }
3542    
3543     - if (WARN_ON(__le32_to_cpu(arg.status)))
3544     - return;
3545     + status = __le32_to_cpu(arg.status);
3546     + if (WARN_ON_ONCE(status)) {
3547     + ath10k_warn(ar, "vdev-start-response reports status error: %d (%s)\n",
3548     + status, (status == WMI_VDEV_START_CHAN_INVALID) ?
3549     + "chan-invalid" : "unknown");
3550     + /* Setup is done one way or another though, so we should still
3551     + * do the completion, so don't return here.
3552     + */
3553     + ar->last_wmi_vdev_start_status = -EINVAL;
3554     + }
3555    
3556     +out:
3557     complete(&ar->vdev_setup_done);
3558     }
3559    
3560     diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
3561     index 9b8562ff6698..cce028ea9b57 100644
3562     --- a/drivers/net/wireless/ath/ath10k/wmi.h
3563     +++ b/drivers/net/wireless/ath/ath10k/wmi.h
3564     @@ -6248,11 +6248,17 @@ struct wmi_ch_info_ev_arg {
3565     __le32 rx_frame_count;
3566     };
3567    
3568     +/* From 10.4 firmware, not sure all have the same values. */
3569     +enum wmi_vdev_start_status {
3570     + WMI_VDEV_START_OK = 0,
3571     + WMI_VDEV_START_CHAN_INVALID,
3572     +};
3573     +
3574     struct wmi_vdev_start_ev_arg {
3575     __le32 vdev_id;
3576     __le32 req_id;
3577     __le32 resp_type; /* %WMI_VDEV_RESP_ */
3578     - __le32 status;
3579     + __le32 status; /* See wmi_vdev_start_status enum above */
3580     };
3581    
3582     struct wmi_peer_kick_ev_arg {
3583     diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
3584     index eedf86b67cf5..807fbe31e930 100644
3585     --- a/drivers/net/wireless/ath/ath9k/common-spectral.c
3586     +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
3587     @@ -411,7 +411,7 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs,
3588    
3589     ath_dbg(common, SPECTRAL_SCAN,
3590     "Calculated new upper max 0x%X at %i\n",
3591     - tmp_mag, i);
3592     + tmp_mag, fft_sample_40.upper_max_index);
3593     } else
3594     for (i = dc_pos; i < SPECTRAL_HT20_40_NUM_BINS; i++) {
3595     if (fft_sample_40.data[i] == (upper_mag >> max_exp))
3596     diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
3597     index b868f02ced89..abc997427bae 100644
3598     --- a/drivers/net/wireless/ath/ath9k/main.c
3599     +++ b/drivers/net/wireless/ath/ath9k/main.c
3600     @@ -1250,7 +1250,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
3601     struct ath_node *an = &avp->mcast_node;
3602    
3603     mutex_lock(&sc->mutex);
3604     -
3605     if (IS_ENABLED(CONFIG_ATH9K_TX99)) {
3606     if (sc->cur_chan->nvifs >= 1) {
3607     mutex_unlock(&sc->mutex);
3608     diff --git a/drivers/net/wireless/ath/ath9k/tx99.c b/drivers/net/wireless/ath/ath9k/tx99.c
3609     index 8e9480cc33e1..096902e0fdf5 100644
3610     --- a/drivers/net/wireless/ath/ath9k/tx99.c
3611     +++ b/drivers/net/wireless/ath/ath9k/tx99.c
3612     @@ -56,11 +56,6 @@ static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
3613     struct sk_buff *skb;
3614     struct ath_vif *avp;
3615    
3616     - if (!sc->tx99_vif)
3617     - return NULL;
3618     -
3619     - avp = (struct ath_vif *)sc->tx99_vif->drv_priv;
3620     -
3621     skb = alloc_skb(len, GFP_KERNEL);
3622     if (!skb)
3623     return NULL;
3624     @@ -77,7 +72,10 @@ static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
3625     memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN);
3626     memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN);
3627    
3628     - hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
3629     + if (sc->tx99_vif) {
3630     + avp = (struct ath_vif *) sc->tx99_vif->drv_priv;
3631     + hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
3632     + }
3633    
3634     tx_info = IEEE80211_SKB_CB(skb);
3635     memset(tx_info, 0, sizeof(*tx_info));
3636     diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
3637     index f78d91b69287..aac9c97d2255 100644
3638     --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
3639     +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
3640     @@ -74,7 +74,7 @@
3641     #define P2P_AF_MAX_WAIT_TIME msecs_to_jiffies(2000)
3642     #define P2P_INVALID_CHANNEL -1
3643     #define P2P_CHANNEL_SYNC_RETRY 5
3644     -#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(1500)
3645     +#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(450)
3646     #define P2P_DEFAULT_SLEEP_TIME_VSDB 200
3647    
3648     /* WiFi P2P Public Action Frame OUI Subtypes */
3649     @@ -1139,7 +1139,6 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p)
3650     {
3651     struct afx_hdl *afx_hdl = &p2p->afx_hdl;
3652     struct brcmf_cfg80211_vif *pri_vif;
3653     - unsigned long duration;
3654     s32 retry;
3655    
3656     brcmf_dbg(TRACE, "Enter\n");
3657     @@ -1155,7 +1154,6 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p)
3658     * pending action frame tx is cancelled.
3659     */
3660     retry = 0;
3661     - duration = msecs_to_jiffies(P2P_AF_FRM_SCAN_MAX_WAIT);
3662     while ((retry < P2P_CHANNEL_SYNC_RETRY) &&
3663     (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) {
3664     afx_hdl->is_listen = false;
3665     @@ -1163,7 +1161,8 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p)
3666     retry);
3667     /* search peer on peer's listen channel */
3668     schedule_work(&afx_hdl->afx_work);
3669     - wait_for_completion_timeout(&afx_hdl->act_frm_scan, duration);
3670     + wait_for_completion_timeout(&afx_hdl->act_frm_scan,
3671     + P2P_AF_FRM_SCAN_MAX_WAIT);
3672     if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) ||
3673     (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
3674     &p2p->status)))
3675     @@ -1176,7 +1175,7 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p)
3676     afx_hdl->is_listen = true;
3677     schedule_work(&afx_hdl->afx_work);
3678     wait_for_completion_timeout(&afx_hdl->act_frm_scan,
3679     - duration);
3680     + P2P_AF_FRM_SCAN_MAX_WAIT);
3681     }
3682     if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) ||
3683     (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
3684     @@ -1463,10 +1462,12 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
3685     return 0;
3686    
3687     if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) {
3688     - if (e->status == BRCMF_E_STATUS_SUCCESS)
3689     + if (e->status == BRCMF_E_STATUS_SUCCESS) {
3690     set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,
3691     &p2p->status);
3692     - else {
3693     + if (!p2p->wait_for_offchan_complete)
3694     + complete(&p2p->send_af_done);
3695     + } else {
3696     set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status);
3697     /* If there is no ack, we don't need to wait for
3698     * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event
3699     @@ -1517,6 +1518,17 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
3700     p2p->af_sent_channel = le32_to_cpu(af_params->channel);
3701     p2p->af_tx_sent_jiffies = jiffies;
3702    
3703     + if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) &&
3704     + p2p->af_sent_channel ==
3705     + ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq))
3706     + p2p->wait_for_offchan_complete = false;
3707     + else
3708     + p2p->wait_for_offchan_complete = true;
3709     +
3710     + brcmf_dbg(TRACE, "Waiting for %s tx completion event\n",
3711     + (p2p->wait_for_offchan_complete) ?
3712     + "off-channel" : "on-channel");
3713     +
3714     timeout = wait_for_completion_timeout(&p2p->send_af_done,
3715     P2P_AF_MAX_WAIT_TIME);
3716    
3717     diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
3718     index 8ce9447533ef..fbee51148904 100644
3719     --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
3720     +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
3721     @@ -124,6 +124,7 @@ struct afx_hdl {
3722     * @gon_req_action: about to send go negotiation requets frame.
3723     * @block_gon_req_tx: drop tx go negotiation requets frame.
3724     * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
3725     + * @wait_for_offchan_complete: wait for off-channel tx completion event.
3726     */
3727     struct brcmf_p2p_info {
3728     struct brcmf_cfg80211_info *cfg;
3729     @@ -144,6 +145,7 @@ struct brcmf_p2p_info {
3730     bool gon_req_action;
3731     bool block_gon_req_tx;
3732     bool p2pdev_dynamically;
3733     + bool wait_for_offchan_complete;
3734     };
3735    
3736     s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
3737     diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
3738     index 207d8ae1e116..19052efe53f1 100644
3739     --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
3740     +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
3741     @@ -935,8 +935,10 @@ int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
3742     {
3743     struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {};
3744     struct iwl_wowlan_tkip_params_cmd tkip_cmd = {};
3745     + bool unified = fw_has_capa(&mvm->fw->ucode_capa,
3746     + IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
3747     struct wowlan_key_data key_data = {
3748     - .configure_keys = !d0i3,
3749     + .configure_keys = !d0i3 && !unified,
3750     .use_rsc_tsc = false,
3751     .tkip = &tkip_cmd,
3752     .use_tkip = false,
3753     diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
3754     index 1aa74b87599f..63dcea640d07 100644
3755     --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
3756     +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
3757     @@ -1303,6 +1303,14 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
3758     break;
3759     }
3760    
3761     + /*
3762     + * If we are freeing multiple frames, mark all the frames
3763     + * but the first one as acked, since they were acknowledged
3764     + * before
3765     + * */
3766     + if (skb_freed > 1)
3767     + info->flags |= IEEE80211_TX_STAT_ACK;
3768     +
3769     iwl_mvm_tx_status_check_trigger(mvm, status);
3770    
3771     info->status.rates[0].count = tx_resp->failure_frame + 1;
3772     diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c
3773     index c2d5b495c179..c089540116fa 100644
3774     --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c
3775     +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c
3776     @@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev,
3777     led->dev = dev;
3778     led->ledpin = ledpin;
3779     led->is_radio = is_radio;
3780     - strncpy(led->name, name, sizeof(led->name));
3781     + strlcpy(led->name, name, sizeof(led->name));
3782    
3783     led->led_dev.name = led->name;
3784     led->led_dev.default_trigger = default_trigger;
3785     diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
3786     index e1f47b6ea3b7..46008f284550 100644
3787     --- a/drivers/net/xen-netback/interface.c
3788     +++ b/drivers/net/xen-netback/interface.c
3789     @@ -171,7 +171,8 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
3790     return vif->hash.mapping[skb_get_hash_raw(skb) % size];
3791     }
3792    
3793     -static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
3794     +static netdev_tx_t
3795     +xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
3796     {
3797     struct xenvif *vif = netdev_priv(dev);
3798     struct xenvif_queue *queue = NULL;
3799     diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
3800     index 9ca24e4d5d49..2a0c5f3b0e50 100644
3801     --- a/drivers/nvmem/core.c
3802     +++ b/drivers/nvmem/core.c
3803     @@ -609,7 +609,7 @@ static struct nvmem_device *nvmem_find(const char *name)
3804     d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match);
3805    
3806     if (!d)
3807     - return NULL;
3808     + return ERR_PTR(-ENOENT);
3809    
3810     return to_nvmem_device(d);
3811     }
3812     diff --git a/drivers/of/base.c b/drivers/of/base.c
3813     index f366af135d5b..c66cdc4307fd 100644
3814     --- a/drivers/of/base.c
3815     +++ b/drivers/of/base.c
3816     @@ -2281,7 +2281,7 @@ struct device_node *of_find_next_cache_node(const struct device_node *np)
3817     /* OF on pmac has nodes instead of properties named "l2-cache"
3818     * beneath CPU nodes.
3819     */
3820     - if (!strcmp(np->type, "cpu"))
3821     + if (IS_ENABLED(CONFIG_PPC_PMAC) && !strcmp(np->type, "cpu"))
3822     for_each_child_of_node(np, child)
3823     if (!strcmp(child->type, "cache"))
3824     return child;
3825     diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
3826     index 547ca7b3f098..ddb530ee2255 100644
3827     --- a/drivers/phy/phy-twl4030-usb.c
3828     +++ b/drivers/phy/phy-twl4030-usb.c
3829     @@ -144,6 +144,7 @@
3830     #define PMBR1 0x0D
3831     #define GPIO_USB_4PIN_ULPI_2430C (3 << 0)
3832    
3833     +static irqreturn_t twl4030_usb_irq(int irq, void *_twl);
3834     /*
3835     * If VBUS is valid or ID is ground, then we know a
3836     * cable is present and we need to be runtime-enabled
3837     @@ -392,6 +393,33 @@ static void __twl4030_phy_power(struct twl4030_usb *twl, int on)
3838     WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0);
3839     }
3840    
3841     +static int __maybe_unused twl4030_usb_suspend(struct device *dev)
3842     +{
3843     + struct twl4030_usb *twl = dev_get_drvdata(dev);
3844     +
3845     + /*
3846     + * we need enabled runtime on resume,
3847     + * so turn irq off here, so we do not get it early
3848     + * note: wakeup on usb plug works independently of this
3849     + */
3850     + dev_dbg(twl->dev, "%s\n", __func__);
3851     + disable_irq(twl->irq);
3852     +
3853     + return 0;
3854     +}
3855     +
3856     +static int __maybe_unused twl4030_usb_resume(struct device *dev)
3857     +{
3858     + struct twl4030_usb *twl = dev_get_drvdata(dev);
3859     +
3860     + dev_dbg(twl->dev, "%s\n", __func__);
3861     + enable_irq(twl->irq);
3862     + /* check whether cable status changed */
3863     + twl4030_usb_irq(0, twl);
3864     +
3865     + return 0;
3866     +}
3867     +
3868     static int __maybe_unused twl4030_usb_runtime_suspend(struct device *dev)
3869     {
3870     struct twl4030_usb *twl = dev_get_drvdata(dev);
3871     @@ -652,6 +680,7 @@ static const struct phy_ops ops = {
3872     static const struct dev_pm_ops twl4030_usb_pm_ops = {
3873     SET_RUNTIME_PM_OPS(twl4030_usb_runtime_suspend,
3874     twl4030_usb_runtime_resume, NULL)
3875     + SET_SYSTEM_SLEEP_PM_OPS(twl4030_usb_suspend, twl4030_usb_resume)
3876     };
3877    
3878     static int twl4030_usb_probe(struct platform_device *pdev)
3879     diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
3880     index 88ba9c50cc8e..b596f45426ea 100644
3881     --- a/drivers/pinctrl/pinctrl-at91-pio4.c
3882     +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
3883     @@ -479,7 +479,6 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
3884     unsigned num_pins, num_configs, reserve;
3885     unsigned long *configs;
3886     struct property *pins;
3887     - bool has_config;
3888     u32 pinfunc;
3889     int ret, i;
3890    
3891     @@ -495,9 +494,6 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
3892     return ret;
3893     }
3894    
3895     - if (num_configs)
3896     - has_config = true;
3897     -
3898     num_pins = pins->length / sizeof(u32);
3899     if (!num_pins) {
3900     dev_err(pctldev->dev, "no pins found in node %s\n",
3901     @@ -511,7 +507,7 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
3902     * map for each pin.
3903     */
3904     reserve = 1;
3905     - if (has_config && num_pins >= 1)
3906     + if (num_configs)
3907     reserve++;
3908     reserve *= num_pins;
3909     ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps, num_maps,
3910     @@ -534,7 +530,7 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
3911     pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, num_maps,
3912     group, func);
3913    
3914     - if (has_config) {
3915     + if (num_configs) {
3916     ret = pinctrl_utils_add_map_configs(pctldev, map,
3917     reserved_maps, num_maps, group,
3918     configs, num_configs,
3919     diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
3920     index 9f0904185909..9401a0630e80 100644
3921     --- a/drivers/pinctrl/pinctrl-at91.c
3922     +++ b/drivers/pinctrl/pinctrl-at91.c
3923     @@ -1545,16 +1545,6 @@ void at91_pinctrl_gpio_resume(void)
3924     #define gpio_irq_set_wake NULL
3925     #endif /* CONFIG_PM */
3926    
3927     -static struct irq_chip gpio_irqchip = {
3928     - .name = "GPIO",
3929     - .irq_ack = gpio_irq_ack,
3930     - .irq_disable = gpio_irq_mask,
3931     - .irq_mask = gpio_irq_mask,
3932     - .irq_unmask = gpio_irq_unmask,
3933     - /* .irq_set_type is set dynamically */
3934     - .irq_set_wake = gpio_irq_set_wake,
3935     -};
3936     -
3937     static void gpio_irq_handler(struct irq_desc *desc)
3938     {
3939     struct irq_chip *chip = irq_desc_get_chip(desc);
3940     @@ -1595,12 +1585,22 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
3941     struct gpio_chip *gpiochip_prev = NULL;
3942     struct at91_gpio_chip *prev = NULL;
3943     struct irq_data *d = irq_get_irq_data(at91_gpio->pioc_virq);
3944     + struct irq_chip *gpio_irqchip;
3945     int ret, i;
3946    
3947     + gpio_irqchip = devm_kzalloc(&pdev->dev, sizeof(*gpio_irqchip), GFP_KERNEL);
3948     + if (!gpio_irqchip)
3949     + return -ENOMEM;
3950     +
3951     at91_gpio->pioc_hwirq = irqd_to_hwirq(d);
3952    
3953     - /* Setup proper .irq_set_type function */
3954     - gpio_irqchip.irq_set_type = at91_gpio->ops->irq_type;
3955     + gpio_irqchip->name = "GPIO";
3956     + gpio_irqchip->irq_ack = gpio_irq_ack;
3957     + gpio_irqchip->irq_disable = gpio_irq_mask;
3958     + gpio_irqchip->irq_mask = gpio_irq_mask;
3959     + gpio_irqchip->irq_unmask = gpio_irq_unmask;
3960     + gpio_irqchip->irq_set_wake = gpio_irq_set_wake,
3961     + gpio_irqchip->irq_set_type = at91_gpio->ops->irq_type;
3962    
3963     /* Disable irqs of this PIO controller */
3964     writel_relaxed(~0, at91_gpio->regbase + PIO_IDR);
3965     @@ -1611,7 +1611,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
3966     * interrupt.
3967     */
3968     ret = gpiochip_irqchip_add(&at91_gpio->chip,
3969     - &gpio_irqchip,
3970     + gpio_irqchip,
3971     0,
3972     handle_edge_irq,
3973     IRQ_TYPE_NONE);
3974     @@ -1629,7 +1629,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
3975     if (!gpiochip_prev) {
3976     /* Then register the chain on the parent IRQ */
3977     gpiochip_set_chained_irqchip(&at91_gpio->chip,
3978     - &gpio_irqchip,
3979     + gpio_irqchip,
3980     at91_gpio->pioc_virq,
3981     gpio_irq_handler);
3982     return 0;
3983     diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c
3984     index 90b0b5a70ce5..04ca990e8f6c 100644
3985     --- a/drivers/power/reset/at91-sama5d2_shdwc.c
3986     +++ b/drivers/power/reset/at91-sama5d2_shdwc.c
3987     @@ -246,6 +246,9 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
3988     if (!pdev->dev.of_node)
3989     return -ENODEV;
3990    
3991     + if (at91_shdwc)
3992     + return -EBUSY;
3993     +
3994     at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL);
3995     if (!at91_shdwc)
3996     return -ENOMEM;
3997     diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
3998     index 2199f673118c..ea8c26a108f0 100644
3999     --- a/drivers/power/supply/ab8500_fg.c
4000     +++ b/drivers/power/supply/ab8500_fg.c
4001     @@ -2437,17 +2437,14 @@ static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf,
4002     size_t count)
4003     {
4004     unsigned long charge_full;
4005     - ssize_t ret;
4006     + int ret;
4007    
4008     ret = kstrtoul(buf, 10, &charge_full);
4009     + if (ret)
4010     + return ret;
4011    
4012     - dev_dbg(di->dev, "Ret %zd charge_full %lu", ret, charge_full);
4013     -
4014     - if (!ret) {
4015     - di->bat_cap.max_mah = (int) charge_full;
4016     - ret = count;
4017     - }
4018     - return ret;
4019     + di->bat_cap.max_mah = (int) charge_full;
4020     + return count;
4021     }
4022    
4023     static ssize_t charge_now_show(struct ab8500_fg *di, char *buf)
4024     @@ -2459,20 +2456,16 @@ static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf,
4025     size_t count)
4026     {
4027     unsigned long charge_now;
4028     - ssize_t ret;
4029     + int ret;
4030    
4031     ret = kstrtoul(buf, 10, &charge_now);
4032     + if (ret)
4033     + return ret;
4034    
4035     - dev_dbg(di->dev, "Ret %zd charge_now %lu was %d",
4036     - ret, charge_now, di->bat_cap.prev_mah);
4037     -
4038     - if (!ret) {
4039     - di->bat_cap.user_mah = (int) charge_now;
4040     - di->flags.user_cap = true;
4041     - ret = count;
4042     - queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0);
4043     - }
4044     - return ret;
4045     + di->bat_cap.user_mah = (int) charge_now;
4046     + di->flags.user_cap = true;
4047     + queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0);
4048     + return count;
4049     }
4050    
4051     static struct ab8500_fg_sysfs_entry charge_full_attr =
4052     diff --git a/drivers/power/supply/max8998_charger.c b/drivers/power/supply/max8998_charger.c
4053     index b64cf0f14142..66438029bdd0 100644
4054     --- a/drivers/power/supply/max8998_charger.c
4055     +++ b/drivers/power/supply/max8998_charger.c
4056     @@ -85,7 +85,7 @@ static const struct power_supply_desc max8998_battery_desc = {
4057     static int max8998_battery_probe(struct platform_device *pdev)
4058     {
4059     struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
4060     - struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev);
4061     + struct max8998_platform_data *pdata = iodev->pdata;
4062     struct power_supply_config psy_cfg = {};
4063     struct max8998_battery_data *max8998;
4064     struct i2c_client *i2c;
4065     diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
4066     index bcd4dc304f27..5b1f147b11cb 100644
4067     --- a/drivers/power/supply/twl4030_charger.c
4068     +++ b/drivers/power/supply/twl4030_charger.c
4069     @@ -449,7 +449,8 @@ static void twl4030_current_worker(struct work_struct *data)
4070    
4071     if (v < USB_MIN_VOLT) {
4072     /* Back up and stop adjusting. */
4073     - bci->usb_cur -= USB_CUR_STEP;
4074     + if (bci->usb_cur >= USB_CUR_STEP)
4075     + bci->usb_cur -= USB_CUR_STEP;
4076     bci->usb_cur_target = bci->usb_cur;
4077     } else if (bci->usb_cur >= bci->usb_cur_target ||
4078     bci->usb_cur + USB_CUR_STEP > USB_MAX_CURRENT) {
4079     @@ -468,6 +469,7 @@ static void twl4030_current_worker(struct work_struct *data)
4080     static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable)
4081     {
4082     int ret;
4083     + u32 reg;
4084    
4085     if (bci->usb_mode == CHARGE_OFF)
4086     enable = false;
4087     @@ -481,14 +483,38 @@ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable)
4088     bci->usb_enabled = 1;
4089     }
4090    
4091     - if (bci->usb_mode == CHARGE_AUTO)
4092     + if (bci->usb_mode == CHARGE_AUTO) {
4093     + /* Enable interrupts now. */
4094     + reg = ~(u32)(TWL4030_ICHGLOW | TWL4030_ICHGEOC |
4095     + TWL4030_TBATOR2 | TWL4030_TBATOR1 |
4096     + TWL4030_BATSTS);
4097     + ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, reg,
4098     + TWL4030_INTERRUPTS_BCIIMR1A);
4099     + if (ret < 0) {
4100     + dev_err(bci->dev,
4101     + "failed to unmask interrupts: %d\n",
4102     + ret);
4103     + return ret;
4104     + }
4105     /* forcing the field BCIAUTOUSB (BOOT_BCI[1]) to 1 */
4106     ret = twl4030_clear_set_boot_bci(0, TWL4030_BCIAUTOUSB);
4107     + }
4108    
4109     /* forcing USBFASTMCHG(BCIMFSTS4[2]) to 1 */
4110     ret = twl4030_clear_set(TWL_MODULE_MAIN_CHARGE, 0,
4111     TWL4030_USBFASTMCHG, TWL4030_BCIMFSTS4);
4112     if (bci->usb_mode == CHARGE_LINEAR) {
4113     + /* Enable interrupts now. */
4114     + reg = ~(u32)(TWL4030_ICHGLOW | TWL4030_TBATOR2 |
4115     + TWL4030_TBATOR1 | TWL4030_BATSTS);
4116     + ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, reg,
4117     + TWL4030_INTERRUPTS_BCIIMR1A);
4118     + if (ret < 0) {
4119     + dev_err(bci->dev,
4120     + "failed to unmask interrupts: %d\n",
4121     + ret);
4122     + return ret;
4123     + }
4124     twl4030_clear_set_boot_bci(TWL4030_BCIAUTOAC|TWL4030_CVENAC, 0);
4125     /* Watch dog key: WOVF acknowledge */
4126     ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x33,
4127     diff --git a/drivers/reset/core.c b/drivers/reset/core.c
4128     index 188205a55261..d0ebca301afc 100644
4129     --- a/drivers/reset/core.c
4130     +++ b/drivers/reset/core.c
4131     @@ -324,28 +324,29 @@ struct reset_control *__of_reset_control_get(struct device_node *node,
4132     break;
4133     }
4134     }
4135     - of_node_put(args.np);
4136    
4137     if (!rcdev) {
4138     - mutex_unlock(&reset_list_mutex);
4139     - return ERR_PTR(-EPROBE_DEFER);
4140     + rstc = ERR_PTR(-EPROBE_DEFER);
4141     + goto out;
4142     }
4143    
4144     if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) {
4145     - mutex_unlock(&reset_list_mutex);
4146     - return ERR_PTR(-EINVAL);
4147     + rstc = ERR_PTR(-EINVAL);
4148     + goto out;
4149     }
4150    
4151     rstc_id = rcdev->of_xlate(rcdev, &args);
4152     if (rstc_id < 0) {
4153     - mutex_unlock(&reset_list_mutex);
4154     - return ERR_PTR(rstc_id);
4155     + rstc = ERR_PTR(rstc_id);
4156     + goto out;
4157     }
4158    
4159     /* reset_list_mutex also protects the rcdev's reset_control list */
4160     rstc = __reset_control_get_internal(rcdev, rstc_id, shared);
4161    
4162     +out:
4163     mutex_unlock(&reset_list_mutex);
4164     + of_node_put(args.np);
4165    
4166     return rstc;
4167     }
4168     diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
4169     index 6ba4e921d2fd..51152681aba6 100644
4170     --- a/drivers/s390/net/qeth_l2_main.c
4171     +++ b/drivers/s390/net/qeth_l2_main.c
4172     @@ -991,7 +991,10 @@ static int __qeth_l2_open(struct net_device *dev)
4173    
4174     if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) {
4175     napi_enable(&card->napi);
4176     + local_bh_disable();
4177     napi_schedule(&card->napi);
4178     + /* kick-start the NAPI softirq: */
4179     + local_bh_enable();
4180     } else
4181     rc = -EIO;
4182     return rc;
4183     diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
4184     index 6e6ba1baf9c4..b40a61d9ad9e 100644
4185     --- a/drivers/s390/net/qeth_l3_main.c
4186     +++ b/drivers/s390/net/qeth_l3_main.c
4187     @@ -3005,7 +3005,10 @@ static int __qeth_l3_open(struct net_device *dev)
4188    
4189     if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) {
4190     napi_enable(&card->napi);
4191     + local_bh_disable();
4192     napi_schedule(&card->napi);
4193     + /* kick-start the NAPI softirq: */
4194     + local_bh_enable();
4195     } else
4196     rc = -EIO;
4197     return rc;
4198     diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
4199     index 3cfab8868c98..27270631c70c 100644
4200     --- a/drivers/scsi/NCR5380.c
4201     +++ b/drivers/scsi/NCR5380.c
4202     @@ -617,16 +617,15 @@ static void complete_cmd(struct Scsi_Host *instance,
4203    
4204     if (hostdata->sensing == cmd) {
4205     /* Autosense processing ends here */
4206     - if ((cmd->result & 0xff) != SAM_STAT_GOOD) {
4207     + if (status_byte(cmd->result) != GOOD) {
4208     scsi_eh_restore_cmnd(cmd, &hostdata->ses);
4209     - set_host_byte(cmd, DID_ERROR);
4210     - } else
4211     + } else {
4212     scsi_eh_restore_cmnd(cmd, &hostdata->ses);
4213     + set_driver_byte(cmd, DRIVER_SENSE);
4214     + }
4215     hostdata->sensing = NULL;
4216     }
4217    
4218     - hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
4219     -
4220     cmd->scsi_done(cmd);
4221     }
4222    
4223     @@ -1798,6 +1797,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
4224     cmd->result = DID_ERROR << 16;
4225     complete_cmd(instance, cmd);
4226     hostdata->connected = NULL;
4227     + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
4228     return;
4229     #endif
4230     case PHASE_DATAIN:
4231     @@ -1880,6 +1880,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
4232     cmd, scmd_id(cmd), cmd->device->lun);
4233    
4234     hostdata->connected = NULL;
4235     + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
4236    
4237     cmd->result &= ~0xffff;
4238     cmd->result |= cmd->SCp.Status;
4239     @@ -2039,6 +2040,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
4240     NCR5380_transfer_pio(instance, &phase, &len, &data);
4241     if (msgout == ABORT) {
4242     hostdata->connected = NULL;
4243     + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
4244     cmd->result = DID_ERROR << 16;
4245     complete_cmd(instance, cmd);
4246     maybe_release_dma_irq(instance);
4247     @@ -2101,8 +2103,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
4248     NCR5380_write(MODE_REG, MR_BASE);
4249    
4250     target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
4251     -
4252     - dsprintk(NDEBUG_RESELECTION, instance, "reselect\n");
4253     + if (!target_mask || target_mask & (target_mask - 1)) {
4254     + shost_printk(KERN_WARNING, instance,
4255     + "reselect: bad target_mask 0x%02x\n", target_mask);
4256     + return;
4257     + }
4258    
4259     /*
4260     * At this point, we have detected that our SCSI ID is on the bus,
4261     @@ -2116,6 +2121,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
4262     NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
4263     if (NCR5380_poll_politely(instance,
4264     STATUS_REG, SR_SEL, 0, 2 * HZ) < 0) {
4265     + shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n");
4266     NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
4267     return;
4268     }
4269     @@ -2127,6 +2133,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
4270    
4271     if (NCR5380_poll_politely(instance,
4272     STATUS_REG, SR_REQ, SR_REQ, 2 * HZ) < 0) {
4273     + if ((NCR5380_read(STATUS_REG) & (SR_BSY | SR_SEL)) == 0)
4274     + /* BUS FREE phase */
4275     + return;
4276     + shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n");
4277     do_abort(instance);
4278     return;
4279     }
4280     @@ -2188,13 +2198,16 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
4281     dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
4282     "reselect: removed %p from disconnected queue\n", tmp);
4283     } else {
4284     + int target = ffs(target_mask) - 1;
4285     +
4286     shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
4287     target_mask, lun);
4288     /*
4289     * Since we have an established nexus that we can't do anything
4290     * with, we must abort it.
4291     */
4292     - do_abort(instance);
4293     + if (do_abort(instance) == 0)
4294     + hostdata->busy[target] &= ~(1 << lun);
4295     return;
4296     }
4297    
4298     @@ -2356,15 +2369,16 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
4299     if (list_del_cmd(&hostdata->autosense, cmd)) {
4300     dsprintk(NDEBUG_ABORT, instance,
4301     "abort: removed %p from sense queue\n", cmd);
4302     - set_host_byte(cmd, DID_ERROR);
4303     complete_cmd(instance, cmd);
4304     }
4305    
4306     out:
4307     if (result == FAILED)
4308     dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
4309     - else
4310     + else {
4311     + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
4312     dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
4313     + }
4314    
4315     queue_work(hostdata->work_q, &hostdata->main_task);
4316     maybe_release_dma_irq(instance);
4317     @@ -2392,7 +2406,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
4318     spin_lock_irqsave(&hostdata->lock, flags);
4319    
4320     #if (NDEBUG & NDEBUG_ANY)
4321     - scmd_printk(KERN_INFO, cmd, __func__);
4322     + shost_printk(KERN_INFO, instance, __func__);
4323     #endif
4324     NCR5380_dprint(NDEBUG_ANY, instance);
4325     NCR5380_dprint_phase(NDEBUG_ANY, instance);
4326     @@ -2410,10 +2424,13 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
4327     * commands!
4328     */
4329    
4330     - if (list_del_cmd(&hostdata->unissued, cmd)) {
4331     + list_for_each_entry(ncmd, &hostdata->unissued, list) {
4332     + struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
4333     +
4334     cmd->result = DID_RESET << 16;
4335     cmd->scsi_done(cmd);
4336     }
4337     + INIT_LIST_HEAD(&hostdata->unissued);
4338    
4339     if (hostdata->selecting) {
4340     hostdata->selecting->result = DID_RESET << 16;
4341     @@ -2432,7 +2449,6 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
4342     list_for_each_entry(ncmd, &hostdata->autosense, list) {
4343     struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
4344    
4345     - set_host_byte(cmd, DID_RESET);
4346     cmd->scsi_done(cmd);
4347     }
4348     INIT_LIST_HEAD(&hostdata->autosense);
4349     diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
4350     index 400eee9d7783..d44f18f773c0 100644
4351     --- a/drivers/scsi/libsas/sas_expander.c
4352     +++ b/drivers/scsi/libsas/sas_expander.c
4353     @@ -2049,14 +2049,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
4354     return res;
4355     }
4356    
4357     - /* delete the old link */
4358     - if (SAS_ADDR(phy->attached_sas_addr) &&
4359     - SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) {
4360     - SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
4361     - SAS_ADDR(dev->sas_addr), phy_id,
4362     - SAS_ADDR(phy->attached_sas_addr));
4363     - sas_unregister_devs_sas_addr(dev, phy_id, last);
4364     - }
4365     + /* we always have to delete the old device when we went here */
4366     + SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
4367     + SAS_ADDR(dev->sas_addr), phy_id,
4368     + SAS_ADDR(phy->attached_sas_addr));
4369     + sas_unregister_devs_sas_addr(dev, phy_id, last);
4370    
4371     return sas_discover_new(dev, phy_id);
4372     }
4373     diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
4374     index 10546faac58c..f374abfb7f1f 100644
4375     --- a/drivers/scsi/pm8001/pm8001_hwi.c
4376     +++ b/drivers/scsi/pm8001/pm8001_hwi.c
4377     @@ -1479,6 +1479,12 @@ u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
4378     } else {
4379     u32 producer_index;
4380     void *pi_virt = circularQ->pi_virt;
4381     + /* spurious interrupt during setup if
4382     + * kexec-ing and driver doing a doorbell access
4383     + * with the pre-kexec oq interrupt setup
4384     + */
4385     + if (!pi_virt)
4386     + break;
4387     /* Update the producer index from SPC */
4388     producer_index = pm8001_read_32(pi_virt);
4389     circularQ->producer_index = cpu_to_le32(producer_index);
4390     diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
4391     index ce584c31d36e..e64a13f0bce1 100644
4392     --- a/drivers/scsi/pm8001/pm8001_sas.c
4393     +++ b/drivers/scsi/pm8001/pm8001_sas.c
4394     @@ -374,6 +374,13 @@ static int pm8001_task_exec(struct sas_task *task,
4395     return 0;
4396     }
4397     pm8001_ha = pm8001_find_ha_by_dev(task->dev);
4398     + if (pm8001_ha->controller_fatal_error) {
4399     + struct task_status_struct *ts = &t->task_status;
4400     +
4401     + ts->resp = SAS_TASK_UNDELIVERED;
4402     + t->task_done(t);
4403     + return 0;
4404     + }
4405     PM8001_IO_DBG(pm8001_ha, pm8001_printk("pm8001_task_exec device \n "));
4406     spin_lock_irqsave(&pm8001_ha->lock, flags);
4407     do {
4408     @@ -466,7 +473,7 @@ err_out:
4409     dev_printk(KERN_ERR, pm8001_ha->dev, "pm8001 exec failed[%d]!\n", rc);
4410     if (!sas_protocol_ata(t->task_proto))
4411     if (n_elem)
4412     - dma_unmap_sg(pm8001_ha->dev, t->scatter, n_elem,
4413     + dma_unmap_sg(pm8001_ha->dev, t->scatter, t->num_scatter,
4414     t->data_dir);
4415     out_done:
4416     spin_unlock_irqrestore(&pm8001_ha->lock, flags);
4417     diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
4418     index 6628cc38316c..d8768ac41ebb 100644
4419     --- a/drivers/scsi/pm8001/pm8001_sas.h
4420     +++ b/drivers/scsi/pm8001/pm8001_sas.h
4421     @@ -531,6 +531,7 @@ struct pm8001_hba_info {
4422     u32 logging_level;
4423     u32 fw_status;
4424     u32 smp_exp_mode;
4425     + bool controller_fatal_error;
4426     const struct firmware *fw_image;
4427     struct isr_param irq_vector[PM8001_MAX_MSIX_VEC];
4428     };
4429     diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
4430     index eb4fee61df72..9edd61c063a1 100644
4431     --- a/drivers/scsi/pm8001/pm80xx_hwi.c
4432     +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
4433     @@ -572,6 +572,9 @@ static void update_main_config_table(struct pm8001_hba_info *pm8001_ha)
4434     pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size);
4435     pm8001_mw32(address, MAIN_PCS_EVENT_LOG_OPTION,
4436     pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity);
4437     + /* Update Fatal error interrupt vector */
4438     + pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |=
4439     + ((pm8001_ha->number_of_intr - 1) << 8);
4440     pm8001_mw32(address, MAIN_FATAL_ERROR_INTERRUPT,
4441     pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt);
4442     pm8001_mw32(address, MAIN_EVENT_CRC_CHECK,
4443     @@ -1099,6 +1102,9 @@ static int pm80xx_chip_init(struct pm8001_hba_info *pm8001_ha)
4444     return -EBUSY;
4445     }
4446    
4447     + /* Initialize the controller fatal error flag */
4448     + pm8001_ha->controller_fatal_error = false;
4449     +
4450     /* Initialize pci space address eg: mpi offset */
4451     init_pci_device_addresses(pm8001_ha);
4452     init_default_table_values(pm8001_ha);
4453     @@ -1207,13 +1213,17 @@ pm80xx_chip_soft_rst(struct pm8001_hba_info *pm8001_ha)
4454     u32 bootloader_state;
4455     u32 ibutton0, ibutton1;
4456    
4457     - /* Check if MPI is in ready state to reset */
4458     - if (mpi_uninit_check(pm8001_ha) != 0) {
4459     - PM8001_FAIL_DBG(pm8001_ha,
4460     - pm8001_printk("MPI state is not ready\n"));
4461     - return -1;
4462     + /* Process MPI table uninitialization only if FW is ready */
4463     + if (!pm8001_ha->controller_fatal_error) {
4464     + /* Check if MPI is in ready state to reset */
4465     + if (mpi_uninit_check(pm8001_ha) != 0) {
4466     + regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1);
4467     + PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
4468     + "MPI state is not ready scratch1 :0x%x\n",
4469     + regval));
4470     + return -1;
4471     + }
4472     }
4473     -
4474     /* checked for reset register normal state; 0x0 */
4475     regval = pm8001_cr32(pm8001_ha, 0, SPC_REG_SOFT_RESET);
4476     PM8001_INIT_DBG(pm8001_ha,
4477     @@ -3717,6 +3727,46 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
4478     }
4479     }
4480    
4481     +static void print_scratchpad_registers(struct pm8001_hba_info *pm8001_ha)
4482     +{
4483     + PM8001_FAIL_DBG(pm8001_ha,
4484     + pm8001_printk("MSGU_SCRATCH_PAD_0: 0x%x\n",
4485     + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_0)));
4486     + PM8001_FAIL_DBG(pm8001_ha,
4487     + pm8001_printk("MSGU_SCRATCH_PAD_1:0x%x\n",
4488     + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1)));
4489     + PM8001_FAIL_DBG(pm8001_ha,
4490     + pm8001_printk("MSGU_SCRATCH_PAD_2: 0x%x\n",
4491     + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_2)));
4492     + PM8001_FAIL_DBG(pm8001_ha,
4493     + pm8001_printk("MSGU_SCRATCH_PAD_3: 0x%x\n",
4494     + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_3)));
4495     + PM8001_FAIL_DBG(pm8001_ha,
4496     + pm8001_printk("MSGU_HOST_SCRATCH_PAD_0: 0x%x\n",
4497     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_0)));
4498     + PM8001_FAIL_DBG(pm8001_ha,
4499     + pm8001_printk("MSGU_HOST_SCRATCH_PAD_1: 0x%x\n",
4500     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_1)));
4501     + PM8001_FAIL_DBG(pm8001_ha,
4502     + pm8001_printk("MSGU_HOST_SCRATCH_PAD_2: 0x%x\n",
4503     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_2)));
4504     + PM8001_FAIL_DBG(pm8001_ha,
4505     + pm8001_printk("MSGU_HOST_SCRATCH_PAD_3: 0x%x\n",
4506     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_3)));
4507     + PM8001_FAIL_DBG(pm8001_ha,
4508     + pm8001_printk("MSGU_HOST_SCRATCH_PAD_4: 0x%x\n",
4509     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_4)));
4510     + PM8001_FAIL_DBG(pm8001_ha,
4511     + pm8001_printk("MSGU_HOST_SCRATCH_PAD_5: 0x%x\n",
4512     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_5)));
4513     + PM8001_FAIL_DBG(pm8001_ha,
4514     + pm8001_printk("MSGU_RSVD_SCRATCH_PAD_0: 0x%x\n",
4515     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_6)));
4516     + PM8001_FAIL_DBG(pm8001_ha,
4517     + pm8001_printk("MSGU_RSVD_SCRATCH_PAD_1: 0x%x\n",
4518     + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_7)));
4519     +}
4520     +
4521     static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
4522     {
4523     struct outbound_queue_table *circularQ;
4524     @@ -3724,10 +3774,28 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
4525     u8 uninitialized_var(bc);
4526     u32 ret = MPI_IO_STATUS_FAIL;
4527     unsigned long flags;
4528     + u32 regval;
4529    
4530     + if (vec == (pm8001_ha->number_of_intr - 1)) {
4531     + regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1);
4532     + if ((regval & SCRATCH_PAD_MIPSALL_READY) !=
4533     + SCRATCH_PAD_MIPSALL_READY) {
4534     + pm8001_ha->controller_fatal_error = true;
4535     + PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
4536     + "Firmware Fatal error! Regval:0x%x\n", regval));
4537     + print_scratchpad_registers(pm8001_ha);
4538     + return ret;
4539     + }
4540     + }
4541     spin_lock_irqsave(&pm8001_ha->lock, flags);
4542     circularQ = &pm8001_ha->outbnd_q_tbl[vec];
4543     do {
4544     + /* spurious interrupt during setup if kexec-ing and
4545     + * driver doing a doorbell access w/ the pre-kexec oq
4546     + * interrupt setup.
4547     + */
4548     + if (!circularQ->pi_virt)
4549     + break;
4550     ret = pm8001_mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc);
4551     if (MPI_IO_STATUS_SUCCESS == ret) {
4552     /* process the outbound message */
4553     diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h
4554     index 7a443bad6163..411b414a9a0e 100644
4555     --- a/drivers/scsi/pm8001/pm80xx_hwi.h
4556     +++ b/drivers/scsi/pm8001/pm80xx_hwi.h
4557     @@ -1288,6 +1288,9 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;
4558     #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0
4559     #define SCRATCH_PAD_IOP0_READY 0xC00
4560     #define SCRATCH_PAD_IOP1_READY 0x3000
4561     +#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \
4562     + SCRATCH_PAD_IOP0_READY | \
4563     + SCRATCH_PAD_RAAE_READY)
4564    
4565     /* boot loader state */
4566     #define SCRATCH_PAD1_BOOTSTATE_MASK 0x70 /* Bit 4-6 */
4567     diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
4568     index c6425e3df5a0..f1c771437752 100644
4569     --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
4570     +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
4571     @@ -4371,6 +4371,13 @@ static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym
4572     OUTB(np, HS_PRT, HS_BUSY);
4573     }
4574    
4575     +#define sym_printk(lvl, tp, cp, fmt, v...) do { \
4576     + if (cp) \
4577     + scmd_printk(lvl, cp->cmd, fmt, ##v); \
4578     + else \
4579     + starget_printk(lvl, tp->starget, fmt, ##v); \
4580     +} while (0)
4581     +
4582     /*
4583     * chip exception handler for programmed interrupts.
4584     */
4585     @@ -4416,7 +4423,7 @@ static void sym_int_sir(struct sym_hcb *np)
4586     * been selected with ATN. We do not want to handle that.
4587     */
4588     case SIR_SEL_ATN_NO_MSG_OUT:
4589     - scmd_printk(KERN_WARNING, cp->cmd,
4590     + sym_printk(KERN_WARNING, tp, cp,
4591     "No MSG OUT phase after selection with ATN\n");
4592     goto out_stuck;
4593     /*
4594     @@ -4424,7 +4431,7 @@ static void sym_int_sir(struct sym_hcb *np)
4595     * having reselected the initiator.
4596     */
4597     case SIR_RESEL_NO_MSG_IN:
4598     - scmd_printk(KERN_WARNING, cp->cmd,
4599     + sym_printk(KERN_WARNING, tp, cp,
4600     "No MSG IN phase after reselection\n");
4601     goto out_stuck;
4602     /*
4603     @@ -4432,7 +4439,7 @@ static void sym_int_sir(struct sym_hcb *np)
4604     * an IDENTIFY.
4605     */
4606     case SIR_RESEL_NO_IDENTIFY:
4607     - scmd_printk(KERN_WARNING, cp->cmd,
4608     + sym_printk(KERN_WARNING, tp, cp,
4609     "No IDENTIFY after reselection\n");
4610     goto out_stuck;
4611     /*
4612     @@ -4461,7 +4468,7 @@ static void sym_int_sir(struct sym_hcb *np)
4613     case SIR_RESEL_ABORTED:
4614     np->lastmsg = np->msgout[0];
4615     np->msgout[0] = M_NOOP;
4616     - scmd_printk(KERN_WARNING, cp->cmd,
4617     + sym_printk(KERN_WARNING, tp, cp,
4618     "message %x sent on bad reselection\n", np->lastmsg);
4619     goto out;
4620     /*
4621     diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
4622     index fefb688a3432..2f4df804c4d8 100644
4623     --- a/drivers/spi/spi-pic32.c
4624     +++ b/drivers/spi/spi-pic32.c
4625     @@ -320,7 +320,7 @@ static int pic32_spi_dma_transfer(struct pic32_spi *pic32s,
4626     desc_rx = dmaengine_prep_slave_sg(master->dma_rx,
4627     xfer->rx_sg.sgl,
4628     xfer->rx_sg.nents,
4629     - DMA_FROM_DEVICE,
4630     + DMA_DEV_TO_MEM,
4631     DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
4632     if (!desc_rx) {
4633     ret = -EINVAL;
4634     @@ -330,7 +330,7 @@ static int pic32_spi_dma_transfer(struct pic32_spi *pic32s,
4635     desc_tx = dmaengine_prep_slave_sg(master->dma_tx,
4636     xfer->tx_sg.sgl,
4637     xfer->tx_sg.nents,
4638     - DMA_TO_DEVICE,
4639     + DMA_MEM_TO_DEV,
4640     DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
4641     if (!desc_tx) {
4642     ret = -EINVAL;
4643     diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
4644     index 0f89c2169c24..3a94f465e8e0 100644
4645     --- a/drivers/spi/spi-rockchip.c
4646     +++ b/drivers/spi/spi-rockchip.c
4647     @@ -443,6 +443,9 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
4648     struct dma_slave_config rxconf, txconf;
4649     struct dma_async_tx_descriptor *rxdesc, *txdesc;
4650    
4651     + memset(&rxconf, 0, sizeof(rxconf));
4652     + memset(&txconf, 0, sizeof(txconf));
4653     +
4654     spin_lock_irqsave(&rs->lock, flags);
4655     rs->state &= ~RXBUSY;
4656     rs->state &= ~TXBUSY;
4657     diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
4658     index 2e05046f866b..f4ea286b0121 100644
4659     --- a/drivers/spi/spidev.c
4660     +++ b/drivers/spi/spidev.c
4661     @@ -751,11 +751,9 @@ static int spidev_probe(struct spi_device *spi)
4662     * compatible string, it is a Linux implementation thing
4663     * rather than a description of the hardware.
4664     */
4665     - if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) {
4666     - dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n");
4667     - WARN_ON(spi->dev.of_node &&
4668     - !of_match_device(spidev_dt_ids, &spi->dev));
4669     - }
4670     + WARN(spi->dev.of_node &&
4671     + of_device_is_compatible(spi->dev.of_node, "spidev"),
4672     + "%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node);
4673    
4674     spidev_probe_acpi(spi);
4675    
4676     diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
4677     index 1d9d778828ba..515bf18c8294 100644
4678     --- a/drivers/tty/serial/mxs-auart.c
4679     +++ b/drivers/tty/serial/mxs-auart.c
4680     @@ -1635,8 +1635,9 @@ static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s)
4681    
4682     /*
4683     * If something went wrong, rollback.
4684     + * Be careful: i may be unsigned.
4685     */
4686     - while (err && (--i >= 0))
4687     + while (err && (i-- > 0))
4688     if (irq[i] >= 0)
4689     free_irq(irq[i], s);
4690    
4691     diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
4692     index f36a1ac3bfbd..b8650210be0f 100644
4693     --- a/drivers/usb/chipidea/otg.c
4694     +++ b/drivers/usb/chipidea/otg.c
4695     @@ -206,14 +206,17 @@ static void ci_otg_work(struct work_struct *work)
4696     }
4697    
4698     pm_runtime_get_sync(ci->dev);
4699     +
4700     if (ci->id_event) {
4701     ci->id_event = false;
4702     ci_handle_id_switch(ci);
4703     - } else if (ci->b_sess_valid_event) {
4704     + }
4705     +
4706     + if (ci->b_sess_valid_event) {
4707     ci->b_sess_valid_event = false;
4708     ci_handle_vbus_change(ci);
4709     - } else
4710     - dev_err(ci->dev, "unexpected event occurs at %s\n", __func__);
4711     + }
4712     +
4713     pm_runtime_put_sync(ci->dev);
4714    
4715     enable_irq(ci->irq);
4716     diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
4717     index 20d02a5e418d..c6577f489d0f 100644
4718     --- a/drivers/usb/chipidea/usbmisc_imx.c
4719     +++ b/drivers/usb/chipidea/usbmisc_imx.c
4720     @@ -273,6 +273,8 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
4721     } else if (data->oc_polarity == 1) {
4722     /* High active */
4723     reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
4724     + } else {
4725     + reg &= ~(MX6_BM_OVER_CUR_DIS);
4726     }
4727     writel(reg, usbmisc->base + data->index * 4);
4728    
4729     diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
4730     index d7dcd39fe12c..3d843e14447b 100644
4731     --- a/drivers/usb/gadget/function/uvc_configfs.c
4732     +++ b/drivers/usb/gadget/function/uvc_configfs.c
4733     @@ -543,6 +543,7 @@ static int uvcg_control_class_allow_link(struct config_item *src,
4734     unlock:
4735     mutex_unlock(&opts->lock);
4736     out:
4737     + config_item_put(header);
4738     mutex_unlock(su_mutex);
4739     return ret;
4740     }
4741     @@ -584,6 +585,7 @@ static int uvcg_control_class_drop_link(struct config_item *src,
4742     unlock:
4743     mutex_unlock(&opts->lock);
4744     out:
4745     + config_item_put(header);
4746     mutex_unlock(su_mutex);
4747     return ret;
4748     }
4749     @@ -770,6 +772,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
4750     format_ptr->fmt = target_fmt;
4751     list_add_tail(&format_ptr->entry, &src_hdr->formats);
4752     ++src_hdr->num_fmt;
4753     + ++target_fmt->linked;
4754    
4755     out:
4756     mutex_unlock(&opts->lock);
4757     @@ -808,6 +811,8 @@ static int uvcg_streaming_header_drop_link(struct config_item *src,
4758     break;
4759     }
4760    
4761     + --target_fmt->linked;
4762     +
4763     out:
4764     mutex_unlock(&opts->lock);
4765     mutex_unlock(su_mutex);
4766     @@ -2047,6 +2052,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
4767     unlock:
4768     mutex_unlock(&opts->lock);
4769     out:
4770     + config_item_put(header);
4771     mutex_unlock(su_mutex);
4772     return ret;
4773     }
4774     @@ -2091,6 +2097,7 @@ static int uvcg_streaming_class_drop_link(struct config_item *src,
4775     unlock:
4776     mutex_unlock(&opts->lock);
4777     out:
4778     + config_item_put(header);
4779     mutex_unlock(su_mutex);
4780     return ret;
4781     }
4782     diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
4783     index 0f01c04d7cbd..d6bab12b0b47 100644
4784     --- a/drivers/usb/gadget/function/uvc_video.c
4785     +++ b/drivers/usb/gadget/function/uvc_video.c
4786     @@ -129,6 +129,21 @@ uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video,
4787     * Request handling
4788     */
4789    
4790     +static int uvcg_video_ep_queue(struct uvc_video *video, struct usb_request *req)
4791     +{
4792     + int ret;
4793     +
4794     + ret = usb_ep_queue(video->ep, req, GFP_ATOMIC);
4795     + if (ret < 0) {
4796     + printk(KERN_INFO "Failed to queue request (%d).\n", ret);
4797     + /* Isochronous endpoints can't be halted. */
4798     + if (usb_endpoint_xfer_bulk(video->ep->desc))
4799     + usb_ep_set_halt(video->ep);
4800     + }
4801     +
4802     + return ret;
4803     +}
4804     +
4805     /*
4806     * I somehow feel that synchronisation won't be easy to achieve here. We have
4807     * three events that control USB requests submission:
4808     @@ -193,14 +208,13 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
4809    
4810     video->encode(req, video, buf);
4811    
4812     - if ((ret = usb_ep_queue(ep, req, GFP_ATOMIC)) < 0) {
4813     - printk(KERN_INFO "Failed to queue request (%d).\n", ret);
4814     - usb_ep_set_halt(ep);
4815     - spin_unlock_irqrestore(&video->queue.irqlock, flags);
4816     + ret = uvcg_video_ep_queue(video, req);
4817     + spin_unlock_irqrestore(&video->queue.irqlock, flags);
4818     +
4819     + if (ret < 0) {
4820     uvcg_queue_cancel(queue, 0);
4821     goto requeue;
4822     }
4823     - spin_unlock_irqrestore(&video->queue.irqlock, flags);
4824    
4825     return;
4826    
4827     @@ -320,15 +334,13 @@ int uvcg_video_pump(struct uvc_video *video)
4828     video->encode(req, video, buf);
4829    
4830     /* Queue the USB request */
4831     - ret = usb_ep_queue(video->ep, req, GFP_ATOMIC);
4832     + ret = uvcg_video_ep_queue(video, req);
4833     + spin_unlock_irqrestore(&queue->irqlock, flags);
4834     +
4835     if (ret < 0) {
4836     - printk(KERN_INFO "Failed to queue request (%d)\n", ret);
4837     - usb_ep_set_halt(video->ep);
4838     - spin_unlock_irqrestore(&queue->irqlock, flags);
4839     uvcg_queue_cancel(queue, 0);
4840     break;
4841     }
4842     - spin_unlock_irqrestore(&queue->irqlock, flags);
4843     }
4844    
4845     spin_lock_irqsave(&video->req_lock, flags);
4846     diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
4847     index 95df2b3bb6a1..76e991557116 100644
4848     --- a/drivers/usb/gadget/udc/fotg210-udc.c
4849     +++ b/drivers/usb/gadget/udc/fotg210-udc.c
4850     @@ -744,7 +744,7 @@ static void fotg210_get_status(struct fotg210_udc *fotg210,
4851     fotg210->ep0_req->length = 2;
4852    
4853     spin_unlock(&fotg210->lock);
4854     - fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL);
4855     + fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC);
4856     spin_lock(&fotg210->lock);
4857     }
4858    
4859     diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
4860     index 73f763c4f5f5..144674913c78 100644
4861     --- a/drivers/usb/host/xhci-mtk-sch.c
4862     +++ b/drivers/usb/host/xhci-mtk-sch.c
4863     @@ -122,7 +122,9 @@ static void setup_sch_info(struct usb_device *udev,
4864     }
4865    
4866     if (ep_type == ISOC_IN_EP || ep_type == ISOC_OUT_EP) {
4867     - if (esit_pkts <= sch_ep->esit)
4868     + if (sch_ep->esit == 1)
4869     + sch_ep->pkts = esit_pkts;
4870     + else if (esit_pkts <= sch_ep->esit)
4871     sch_ep->pkts = 1;
4872     else
4873     sch_ep->pkts = roundup_pow_of_two(esit_pkts)
4874     diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
4875     index bbeeb2bd55a8..2c915be1db4c 100644
4876     --- a/drivers/usb/serial/cypress_m8.c
4877     +++ b/drivers/usb/serial/cypress_m8.c
4878     @@ -773,7 +773,7 @@ send:
4879    
4880     usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev,
4881     usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress),
4882     - port->interrupt_out_buffer, port->interrupt_out_size,
4883     + port->interrupt_out_buffer, actual_size,
4884     cypress_write_int_callback, port, priv->write_urb_interval);
4885     result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
4886     if (result) {
4887     diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
4888     index a1a712d18e02..da3f0ed18c76 100644
4889     --- a/drivers/vfio/pci/vfio_pci.c
4890     +++ b/drivers/vfio/pci/vfio_pci.c
4891     @@ -426,10 +426,14 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type)
4892     {
4893     if (irq_type == VFIO_PCI_INTX_IRQ_INDEX) {
4894     u8 pin;
4895     +
4896     + if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) ||
4897     + vdev->nointx || vdev->pdev->is_virtfn)
4898     + return 0;
4899     +
4900     pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin);
4901     - if (IS_ENABLED(CONFIG_VFIO_PCI_INTX) && !vdev->nointx && pin)
4902     - return 1;
4903    
4904     + return pin ? 1 : 0;
4905     } else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) {
4906     u8 pos;
4907     u16 flags;
4908     diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
4909     index 7b8a957b008d..84905d074c4f 100644
4910     --- a/drivers/vfio/pci/vfio_pci_config.c
4911     +++ b/drivers/vfio/pci/vfio_pci_config.c
4912     @@ -1182,8 +1182,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
4913     return -ENOMEM;
4914    
4915     ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags);
4916     - if (ret)
4917     + if (ret) {
4918     + kfree(vdev->msi_perm);
4919     return ret;
4920     + }
4921    
4922     return len;
4923     }
4924     @@ -1606,6 +1608,15 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev)
4925     return 0;
4926     }
4927    
4928     +/*
4929     + * Nag about hardware bugs, hopefully to have vendors fix them, but at least
4930     + * to collect a list of dependencies for the VF INTx pin quirk below.
4931     + */
4932     +static const struct pci_device_id known_bogus_vf_intx_pin[] = {
4933     + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x270c) },
4934     + {}
4935     +};
4936     +
4937     /*
4938     * For each device we allocate a pci_config_map that indicates the
4939     * capability occupying each dword and thus the struct perm_bits we
4940     @@ -1671,6 +1682,24 @@ int vfio_config_init(struct vfio_pci_device *vdev)
4941     if (pdev->is_virtfn) {
4942     *(__le16 *)&vconfig[PCI_VENDOR_ID] = cpu_to_le16(pdev->vendor);
4943     *(__le16 *)&vconfig[PCI_DEVICE_ID] = cpu_to_le16(pdev->device);
4944     +
4945     + /*
4946     + * Per SR-IOV spec rev 1.1, 3.4.1.18 the interrupt pin register
4947     + * does not apply to VFs and VFs must implement this register
4948     + * as read-only with value zero. Userspace is not readily able
4949     + * to identify whether a device is a VF and thus that the pin
4950     + * definition on the device is bogus should it violate this
4951     + * requirement. We already virtualize the pin register for
4952     + * other purposes, so we simply need to replace the bogus value
4953     + * and consider VFs when we determine INTx IRQ count.
4954     + */
4955     + if (vconfig[PCI_INTERRUPT_PIN] &&
4956     + !pci_match_id(known_bogus_vf_intx_pin, pdev))
4957     + pci_warn(pdev,
4958     + "Hardware bug: VF reports bogus INTx pin %d\n",
4959     + vconfig[PCI_INTERRUPT_PIN]);
4960     +
4961     + vconfig[PCI_INTERRUPT_PIN] = 0; /* Gratuitous for good VFs */
4962     }
4963    
4964     if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) || vdev->nointx)
4965     diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
4966     index cd50df5807ea..086611c7bc03 100644
4967     --- a/drivers/video/backlight/lm3639_bl.c
4968     +++ b/drivers/video/backlight/lm3639_bl.c
4969     @@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client)
4970    
4971     regmap_write(pchip->regmap, REG_ENABLE, 0x00);
4972    
4973     - if (&pchip->cdev_torch)
4974     - led_classdev_unregister(&pchip->cdev_torch);
4975     - if (&pchip->cdev_flash)
4976     - led_classdev_unregister(&pchip->cdev_flash);
4977     + led_classdev_unregister(&pchip->cdev_torch);
4978     + led_classdev_unregister(&pchip->cdev_flash);
4979     if (pchip->bled)
4980     device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
4981     return 0;
4982     diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
4983     index 62c0cf79674f..63ec9c71fe84 100644
4984     --- a/drivers/video/fbdev/core/fbmon.c
4985     +++ b/drivers/video/fbdev/core/fbmon.c
4986     @@ -997,97 +997,6 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs)
4987     DPRINTK("========================================\n");
4988     }
4989    
4990     -/**
4991     - * fb_edid_add_monspecs() - add monitor video modes from E-EDID data
4992     - * @edid: 128 byte array with an E-EDID block
4993     - * @spacs: monitor specs to be extended
4994     - */
4995     -void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
4996     -{
4997     - unsigned char *block;
4998     - struct fb_videomode *m;
4999     - int num = 0, i;
5000     - u8 svd[64], edt[(128 - 4) / DETAILED_TIMING_DESCRIPTION_SIZE];
5001     - u8 pos = 4, svd_n = 0;
5002     -
5003     - if (!edid)
5004     - return;
5005     -
5006     - if (!edid_checksum(edid))
5007     - return;
5008     -
5009     - if (edid[0] != 0x2 ||
5010     - edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE)
5011     - return;
5012     -
5013     - DPRINTK(" Short Video Descriptors\n");
5014     -
5015     - while (pos < edid[2]) {
5016     - u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7;
5017     - pr_debug("Data block %u of %u bytes\n", type, len);
5018     - if (type == 2) {
5019     - for (i = pos; i < pos + len; i++) {
5020     - u8 idx = edid[pos + i] & 0x7f;
5021     - svd[svd_n++] = idx;
5022     - pr_debug("N%sative mode #%d\n",
5023     - edid[pos + i] & 0x80 ? "" : "on-n", idx);
5024     - }
5025     - } else if (type == 3 && len >= 3) {
5026     - /* Check Vendor Specific Data Block. For HDMI,
5027     - it is always 00-0C-03 for HDMI Licensing, LLC. */
5028     - if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc &&
5029     - edid[pos + 3] == 0)
5030     - specs->misc |= FB_MISC_HDMI;
5031     - }
5032     - pos += len + 1;
5033     - }
5034     -
5035     - block = edid + edid[2];
5036     -
5037     - DPRINTK(" Extended Detailed Timings\n");
5038     -
5039     - for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE;
5040     - i++, block += DETAILED_TIMING_DESCRIPTION_SIZE)
5041     - if (PIXEL_CLOCK)
5042     - edt[num++] = block - edid;
5043     -
5044     - /* Yikes, EDID data is totally useless */
5045     - if (!(num + svd_n))
5046     - return;
5047     -
5048     - m = kzalloc((specs->modedb_len + num + svd_n) *
5049     - sizeof(struct fb_videomode), GFP_KERNEL);
5050     -
5051     - if (!m)
5052     - return;
5053     -
5054     - memcpy(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode));
5055     -
5056     - for (i = specs->modedb_len; i < specs->modedb_len + num; i++) {
5057     - get_detailed_timing(edid + edt[i - specs->modedb_len], &m[i]);
5058     - if (i == specs->modedb_len)
5059     - m[i].flag |= FB_MODE_IS_FIRST;
5060     - pr_debug("Adding %ux%u@%u\n", m[i].xres, m[i].yres, m[i].refresh);
5061     - }
5062     -
5063     - for (i = specs->modedb_len + num; i < specs->modedb_len + num + svd_n; i++) {
5064     - int idx = svd[i - specs->modedb_len - num];
5065     - if (!idx || idx >= ARRAY_SIZE(cea_modes)) {
5066     - pr_warning("Reserved SVD code %d\n", idx);
5067     - } else if (!cea_modes[idx].xres) {
5068     - pr_warning("Unimplemented SVD code %d\n", idx);
5069     - } else {
5070     - memcpy(&m[i], cea_modes + idx, sizeof(m[i]));
5071     - pr_debug("Adding SVD #%d: %ux%u@%u\n", idx,
5072     - m[i].xres, m[i].yres, m[i].refresh);
5073     - }
5074     - }
5075     -
5076     - kfree(specs->modedb);
5077     - specs->modedb = m;
5078     - specs->modedb_len = specs->modedb_len + num + svd_n;
5079     -}
5080     -
5081     /*
5082     * VESA Generalized Timing Formula (GTF)
5083     */
5084     @@ -1497,9 +1406,6 @@ int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
5085     void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs)
5086     {
5087     }
5088     -void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
5089     -{
5090     -}
5091     void fb_destroy_modedb(struct fb_videomode *modedb)
5092     {
5093     }
5094     @@ -1607,7 +1513,6 @@ EXPORT_SYMBOL(fb_firmware_edid);
5095    
5096     EXPORT_SYMBOL(fb_parse_edid);
5097     EXPORT_SYMBOL(fb_edid_to_monspecs);
5098     -EXPORT_SYMBOL(fb_edid_add_monspecs);
5099     EXPORT_SYMBOL(fb_get_mode);
5100     EXPORT_SYMBOL(fb_validate_mode);
5101     EXPORT_SYMBOL(fb_destroy_modedb);
5102     diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
5103     index 455a15f70172..a9d76e1b4378 100644
5104     --- a/drivers/video/fbdev/core/modedb.c
5105     +++ b/drivers/video/fbdev/core/modedb.c
5106     @@ -289,63 +289,6 @@ static const struct fb_videomode modedb[] = {
5107     };
5108    
5109     #ifdef CONFIG_FB_MODE_HELPERS
5110     -const struct fb_videomode cea_modes[65] = {
5111     - /* #1: 640x480p@59.94/60Hz */
5112     - [1] = {
5113     - NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0,
5114     - FB_VMODE_NONINTERLACED, 0,
5115     - },
5116     - /* #3: 720x480p@59.94/60Hz */
5117     - [3] = {
5118     - NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0,
5119     - FB_VMODE_NONINTERLACED, 0,
5120     - },
5121     - /* #5: 1920x1080i@59.94/60Hz */
5122     - [5] = {
5123     - NULL, 60, 1920, 1080, 13763, 148, 88, 15, 2, 44, 5,
5124     - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
5125     - FB_VMODE_INTERLACED, 0,
5126     - },
5127     - /* #7: 720(1440)x480iH@59.94/60Hz */
5128     - [7] = {
5129     - NULL, 60, 1440, 480, 18554/*37108*/, 114, 38, 15, 4, 124, 3, 0,
5130     - FB_VMODE_INTERLACED, 0,
5131     - },
5132     - /* #9: 720(1440)x240pH@59.94/60Hz */
5133     - [9] = {
5134     - NULL, 60, 1440, 240, 18554, 114, 38, 16, 4, 124, 3, 0,
5135     - FB_VMODE_NONINTERLACED, 0,
5136     - },
5137     - /* #18: 720x576pH@50Hz */
5138     - [18] = {
5139     - NULL, 50, 720, 576, 37037, 68, 12, 39, 5, 64, 5, 0,
5140     - FB_VMODE_NONINTERLACED, 0,
5141     - },
5142     - /* #19: 1280x720p@50Hz */
5143     - [19] = {
5144     - NULL, 50, 1280, 720, 13468, 220, 440, 20, 5, 40, 5,
5145     - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
5146     - FB_VMODE_NONINTERLACED, 0,
5147     - },
5148     - /* #20: 1920x1080i@50Hz */
5149     - [20] = {
5150     - NULL, 50, 1920, 1080, 13480, 148, 528, 15, 5, 528, 5,
5151     - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
5152     - FB_VMODE_INTERLACED, 0,
5153     - },
5154     - /* #32: 1920x1080p@23.98/24Hz */
5155     - [32] = {
5156     - NULL, 24, 1920, 1080, 13468, 148, 638, 36, 4, 44, 5,
5157     - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
5158     - FB_VMODE_NONINTERLACED, 0,
5159     - },
5160     - /* #35: (2880)x480p4x@59.94/60Hz */
5161     - [35] = {
5162     - NULL, 60, 2880, 480, 9250, 240, 64, 30, 9, 248, 6, 0,
5163     - FB_VMODE_NONINTERLACED, 0,
5164     - },
5165     -};
5166     -
5167     const struct fb_videomode vesa_modes[] = {
5168     /* 0 640x350-85 VESA */
5169     { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3,
5170     diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c
5171     index 31c301d6be62..52e161dbd204 100644
5172     --- a/drivers/video/fbdev/sbuslib.c
5173     +++ b/drivers/video/fbdev/sbuslib.c
5174     @@ -105,11 +105,11 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
5175     struct fbtype __user *f = (struct fbtype __user *) arg;
5176    
5177     if (put_user(type, &f->fb_type) ||
5178     - __put_user(info->var.yres, &f->fb_height) ||
5179     - __put_user(info->var.xres, &f->fb_width) ||
5180     - __put_user(fb_depth, &f->fb_depth) ||
5181     - __put_user(0, &f->fb_cmsize) ||
5182     - __put_user(fb_size, &f->fb_cmsize))
5183     + put_user(info->var.yres, &f->fb_height) ||
5184     + put_user(info->var.xres, &f->fb_width) ||
5185     + put_user(fb_depth, &f->fb_depth) ||
5186     + put_user(0, &f->fb_cmsize) ||
5187     + put_user(fb_size, &f->fb_cmsize))
5188     return -EFAULT;
5189     return 0;
5190     }
5191     @@ -124,10 +124,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
5192     unsigned int index, count, i;
5193    
5194     if (get_user(index, &c->index) ||
5195     - __get_user(count, &c->count) ||
5196     - __get_user(ured, &c->red) ||
5197     - __get_user(ugreen, &c->green) ||
5198     - __get_user(ublue, &c->blue))
5199     + get_user(count, &c->count) ||
5200     + get_user(ured, &c->red) ||
5201     + get_user(ugreen, &c->green) ||
5202     + get_user(ublue, &c->blue))
5203     return -EFAULT;
5204    
5205     cmap.len = 1;
5206     @@ -164,13 +164,13 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
5207     u8 red, green, blue;
5208    
5209     if (get_user(index, &c->index) ||
5210     - __get_user(count, &c->count) ||
5211     - __get_user(ured, &c->red) ||
5212     - __get_user(ugreen, &c->green) ||
5213     - __get_user(ublue, &c->blue))
5214     + get_user(count, &c->count) ||
5215     + get_user(ured, &c->red) ||
5216     + get_user(ugreen, &c->green) ||
5217     + get_user(ublue, &c->blue))
5218     return -EFAULT;
5219    
5220     - if (index + count > cmap->len)
5221     + if (index > cmap->len || count > cmap->len - index)
5222     return -EINVAL;
5223    
5224     for (i = 0; i < count; i++) {
5225     diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
5226     index 4b7da4409c60..5b832e83772a 100644
5227     --- a/fs/compat_ioctl.c
5228     +++ b/fs/compat_ioctl.c
5229     @@ -160,6 +160,7 @@ struct compat_video_event {
5230     unsigned int frame_rate;
5231     } u;
5232     };
5233     +#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event)
5234    
5235     static int do_video_get_event(struct file *file,
5236     unsigned int cmd, struct compat_video_event __user *up)
5237     @@ -171,7 +172,7 @@ static int do_video_get_event(struct file *file,
5238     if (kevent == NULL)
5239     return -EFAULT;
5240    
5241     - err = do_ioctl(file, cmd, (unsigned long)kevent);
5242     + err = do_ioctl(file, VIDEO_GET_EVENT, (unsigned long)kevent);
5243     if (!err) {
5244     err = convert_in_user(&kevent->type, &up->type);
5245     err |= convert_in_user(&kevent->timestamp, &up->timestamp);
5246     @@ -190,6 +191,7 @@ struct compat_video_still_picture {
5247     compat_uptr_t iFrame;
5248     int32_t size;
5249     };
5250     +#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture)
5251    
5252     static int do_video_stillpicture(struct file *file,
5253     unsigned int cmd, struct compat_video_still_picture __user *up)
5254     @@ -212,7 +214,7 @@ static int do_video_stillpicture(struct file *file,
5255     if (err)
5256     return -EFAULT;
5257    
5258     - err = do_ioctl(file, cmd, (unsigned long) up_native);
5259     + err = do_ioctl(file, VIDEO_STILLPICTURE, (unsigned long) up_native);
5260    
5261     return err;
5262     }
5263     @@ -1484,9 +1486,9 @@ static long do_ioctl_trans(unsigned int cmd,
5264     return rtc_ioctl(file, cmd, argp);
5265    
5266     /* dvb */
5267     - case VIDEO_GET_EVENT:
5268     + case VIDEO_GET_EVENT32:
5269     return do_video_get_event(file, cmd, argp);
5270     - case VIDEO_STILLPICTURE:
5271     + case VIDEO_STILLPICTURE32:
5272     return do_video_stillpicture(file, cmd, argp);
5273     case VIDEO_SET_SPU_PALETTE:
5274     return do_video_set_spu_palette(file, cmd, argp);
5275     diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
5276     index 5c5ff9f6fe07..2a5e436ff8dd 100644
5277     --- a/fs/ecryptfs/inode.c
5278     +++ b/fs/ecryptfs/inode.c
5279     @@ -326,9 +326,9 @@ static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode)
5280     static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
5281     struct dentry *lower_dentry)
5282     {
5283     - struct inode *inode, *lower_inode = d_inode(lower_dentry);
5284     + struct path *path = ecryptfs_dentry_to_lower_path(dentry->d_parent);
5285     + struct inode *inode, *lower_inode;
5286     struct ecryptfs_dentry_info *dentry_info;
5287     - struct vfsmount *lower_mnt;
5288     int rc = 0;
5289    
5290     dentry_info = kmem_cache_alloc(ecryptfs_dentry_info_cache, GFP_KERNEL);
5291     @@ -340,16 +340,23 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
5292     return ERR_PTR(-ENOMEM);
5293     }
5294    
5295     - lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent));
5296     fsstack_copy_attr_atime(d_inode(dentry->d_parent),
5297     - d_inode(lower_dentry->d_parent));
5298     + d_inode(path->dentry));
5299     BUG_ON(!d_count(lower_dentry));
5300    
5301     ecryptfs_set_dentry_private(dentry, dentry_info);
5302     - dentry_info->lower_path.mnt = lower_mnt;
5303     + dentry_info->lower_path.mnt = mntget(path->mnt);
5304     dentry_info->lower_path.dentry = lower_dentry;
5305    
5306     - if (d_really_is_negative(lower_dentry)) {
5307     + /*
5308     + * negative dentry can go positive under us here - its parent is not
5309     + * locked. That's OK and that could happen just as we return from
5310     + * ecryptfs_lookup() anyway. Just need to be careful and fetch
5311     + * ->d_inode only once - it's not stable here.
5312     + */
5313     + lower_inode = READ_ONCE(lower_dentry->d_inode);
5314     +
5315     + if (!lower_inode) {
5316     /* We want to add because we couldn't find in lower */
5317     d_add(dentry, NULL);
5318     return NULL;
5319     diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
5320     index 759056e776e5..b1d62003cda6 100644
5321     --- a/fs/f2fs/gc.c
5322     +++ b/fs/f2fs/gc.c
5323     @@ -985,7 +985,7 @@ stop:
5324    
5325     put_gc_inode(&gc_list);
5326    
5327     - if (sync)
5328     + if (sync && !ret)
5329     ret = sec_freed ? 0 : -EAGAIN;
5330     return ret;
5331     }
5332     diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
5333     index 9de1480a86bd..e87b7d7e80fc 100644
5334     --- a/fs/f2fs/recovery.c
5335     +++ b/fs/f2fs/recovery.c
5336     @@ -179,6 +179,8 @@ static void recover_inode(struct inode *inode, struct page *page)
5337     char *name;
5338    
5339     inode->i_mode = le16_to_cpu(raw->i_mode);
5340     + i_uid_write(inode, le32_to_cpu(raw->i_uid));
5341     + i_gid_write(inode, le32_to_cpu(raw->i_gid));
5342     f2fs_i_size_write(inode, le64_to_cpu(raw->i_size));
5343     inode->i_atime.tv_sec = le64_to_cpu(raw->i_mtime);
5344     inode->i_ctime.tv_sec = le64_to_cpu(raw->i_ctime);
5345     diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
5346     index 9eff18c1f3e4..e0ac676e0a35 100644
5347     --- a/fs/f2fs/super.c
5348     +++ b/fs/f2fs/super.c
5349     @@ -1650,8 +1650,12 @@ static int init_percpu_info(struct f2fs_sb_info *sbi)
5350     if (err)
5351     return err;
5352    
5353     - return percpu_counter_init(&sbi->total_valid_inode_count, 0,
5354     + err = percpu_counter_init(&sbi->total_valid_inode_count, 0,
5355     GFP_KERNEL);
5356     + if (err)
5357     + percpu_counter_destroy(&sbi->alloc_valid_block_count);
5358     +
5359     + return err;
5360     }
5361    
5362     /*
5363     diff --git a/fs/fuse/control.c b/fs/fuse/control.c
5364     index e25c40c10f4f..97ac2f5843fc 100644
5365     --- a/fs/fuse/control.c
5366     +++ b/fs/fuse/control.c
5367     @@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file,
5368     if (!fc)
5369     return 0;
5370    
5371     - val = fc->max_background;
5372     + val = READ_ONCE(fc->max_background);
5373     fuse_conn_put(fc);
5374    
5375     return fuse_conn_limit_read(file, buf, len, ppos, val);
5376     @@ -144,7 +144,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file,
5377     if (!fc)
5378     return 0;
5379    
5380     - val = fc->congestion_threshold;
5381     + val = READ_ONCE(fc->congestion_threshold);
5382     fuse_conn_put(fc);
5383    
5384     return fuse_conn_limit_read(file, buf, len, ppos, val);
5385     diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
5386     index 073126707270..f77a38755aea 100644
5387     --- a/fs/gfs2/rgrp.c
5388     +++ b/fs/gfs2/rgrp.c
5389     @@ -1211,7 +1211,7 @@ static int update_rgrp_lvb(struct gfs2_rgrpd *rgd)
5390     rl_flags = be32_to_cpu(rgd->rd_rgl->rl_flags);
5391     rl_flags &= ~GFS2_RDF_MASK;
5392     rgd->rd_flags &= GFS2_RDF_MASK;
5393     - rgd->rd_flags |= (rl_flags | GFS2_RDF_UPTODATE | GFS2_RDF_CHECK);
5394     + rgd->rd_flags |= (rl_flags | GFS2_RDF_CHECK);
5395     if (rgd->rd_rgl->rl_unlinked == 0)
5396     rgd->rd_flags &= ~GFS2_RDF_CHECK;
5397     rgd->rd_free = be32_to_cpu(rgd->rd_rgl->rl_free);
5398     diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
5399     index e3ee387a6dfe..37496d83661a 100644
5400     --- a/fs/gfs2/super.c
5401     +++ b/fs/gfs2/super.c
5402     @@ -844,10 +844,10 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
5403     if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
5404     return error;
5405    
5406     + flush_workqueue(gfs2_delete_workqueue);
5407     kthread_stop(sdp->sd_quotad_process);
5408     kthread_stop(sdp->sd_logd_process);
5409    
5410     - flush_workqueue(gfs2_delete_workqueue);
5411     gfs2_quota_sync(sdp->sd_vfs, 0);
5412     gfs2_statfs_sync(sdp->sd_vfs, 0);
5413    
5414     diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
5415     index 80317b04c84a..e431a850f2f2 100644
5416     --- a/fs/kernfs/symlink.c
5417     +++ b/fs/kernfs/symlink.c
5418     @@ -63,6 +63,9 @@ static int kernfs_get_target_path(struct kernfs_node *parent,
5419     if (base == kn)
5420     break;
5421    
5422     + if ((s - path) + 3 >= PATH_MAX)
5423     + return -ENAMETOOLONG;
5424     +
5425     strcpy(s, "../");
5426     s += 3;
5427     base = base->parent;
5428     @@ -79,7 +82,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent,
5429     if (len < 2)
5430     return -EINVAL;
5431     len--;
5432     - if ((s - path) + len > PATH_MAX)
5433     + if ((s - path) + len >= PATH_MAX)
5434     return -ENAMETOOLONG;
5435    
5436     /* reverse fillup of target string from target to base */
5437     diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
5438     index 46afd7cdcc37..9a8830a0f31f 100644
5439     --- a/fs/nfs/delegation.c
5440     +++ b/fs/nfs/delegation.c
5441     @@ -101,7 +101,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags)
5442     return nfs4_do_check_delegation(inode, flags, false);
5443     }
5444    
5445     -static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid)
5446     +static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid *stateid)
5447     {
5448     struct inode *inode = state->inode;
5449     struct file_lock *fl;
5450     @@ -116,7 +116,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_
5451     spin_lock(&flctx->flc_lock);
5452     restart:
5453     list_for_each_entry(fl, list, fl_list) {
5454     - if (nfs_file_open_context(fl->fl_file) != ctx)
5455     + if (nfs_file_open_context(fl->fl_file)->state != state)
5456     continue;
5457     spin_unlock(&flctx->flc_lock);
5458     status = nfs4_lock_delegation_recall(fl, state, stateid);
5459     @@ -163,7 +163,7 @@ again:
5460     seq = raw_seqcount_begin(&sp->so_reclaim_seqcount);
5461     err = nfs4_open_delegation_recall(ctx, state, stateid, type);
5462     if (!err)
5463     - err = nfs_delegation_claim_locks(ctx, state, stateid);
5464     + err = nfs_delegation_claim_locks(state, stateid);
5465     if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq))
5466     err = -EAGAIN;
5467     mutex_unlock(&sp->so_delegreturn_mutex);
5468     diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c
5469     index a799546a67f7..f6172c3f83ba 100644
5470     --- a/fs/orangefs/orangefs-sysfs.c
5471     +++ b/fs/orangefs/orangefs-sysfs.c
5472     @@ -315,7 +315,7 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
5473     /* Can't do a service_operation if the client is not running... */
5474     rc = is_daemon_in_service();
5475     if (rc) {
5476     - pr_info("%s: Client not running :%d:\n",
5477     + pr_info_ratelimited("%s: Client not running :%d:\n",
5478     __func__,
5479     is_daemon_in_service());
5480     goto out;
5481     diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
5482     index 8ab782d8b33d..93d13f4010c1 100644
5483     --- a/fs/proc/vmcore.c
5484     +++ b/fs/proc/vmcore.c
5485     @@ -164,6 +164,16 @@ int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma,
5486     return remap_pfn_range(vma, from, pfn, size, prot);
5487     }
5488    
5489     +/*
5490     + * Architectures which support memory encryption override this.
5491     + */
5492     +ssize_t __weak
5493     +copy_oldmem_page_encrypted(unsigned long pfn, char *buf, size_t csize,
5494     + unsigned long offset, int userbuf)
5495     +{
5496     + return copy_oldmem_page(pfn, buf, csize, offset, userbuf);
5497     +}
5498     +
5499     /*
5500     * Copy to either kernel or user space
5501     */
5502     diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
5503     index bd738aafd432..7582a5712458 100644
5504     --- a/include/linux/blkdev.h
5505     +++ b/include/linux/blkdev.h
5506     @@ -212,6 +212,11 @@ struct request {
5507     (req)->cmd_flags |= flags; \
5508     } while (0)
5509    
5510     +static inline bool blk_rq_is_passthrough(struct request *rq)
5511     +{
5512     + return rq->cmd_type != REQ_TYPE_FS;
5513     +}
5514     +
5515     static inline unsigned short req_get_ioprio(struct request *req)
5516     {
5517     return req->ioprio;
5518     @@ -663,7 +668,7 @@ static inline void blk_clear_rl_full(struct request_list *rl, bool sync)
5519    
5520     static inline bool rq_mergeable(struct request *rq)
5521     {
5522     - if (rq->cmd_type != REQ_TYPE_FS)
5523     + if (blk_rq_is_passthrough(rq))
5524     return false;
5525    
5526     if (req_op(rq) == REQ_OP_FLUSH)
5527     @@ -910,7 +915,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
5528     {
5529     struct request_queue *q = rq->q;
5530    
5531     - if (unlikely(rq->cmd_type != REQ_TYPE_FS))
5532     + if (blk_rq_is_passthrough(rq))
5533     return q->limits.max_hw_sectors;
5534    
5535     if (!q->limits.chunk_sectors ||
5536     diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h
5537     index 986c06c88d81..84d3c81b5978 100644
5538     --- a/include/linux/cpufeature.h
5539     +++ b/include/linux/cpufeature.h
5540     @@ -45,7 +45,7 @@
5541     * 'asm/cpufeature.h' of your favorite architecture.
5542     */
5543     #define module_cpu_feature_match(x, __initfunc) \
5544     -static struct cpu_feature const cpu_feature_match_ ## x[] = \
5545     +static struct cpu_feature const __maybe_unused cpu_feature_match_ ## x[] = \
5546     { { .feature = cpu_feature(x) }, { } }; \
5547     MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \
5548     \
5549     diff --git a/include/linux/edac.h b/include/linux/edac.h
5550     index 9e0d78966552..c6233227720c 100644
5551     --- a/include/linux/edac.h
5552     +++ b/include/linux/edac.h
5553     @@ -17,6 +17,7 @@
5554     #include <linux/completion.h>
5555     #include <linux/workqueue.h>
5556     #include <linux/debugfs.h>
5557     +#include <linux/numa.h>
5558    
5559     struct device;
5560    
5561     @@ -778,6 +779,6 @@ struct mem_ctl_info {
5562     /*
5563     * Maximum number of memory controllers in the coherent fabric.
5564     */
5565     -#define EDAC_MAX_MCS 16
5566     +#define EDAC_MAX_MCS 2 * MAX_NUMNODES
5567    
5568     #endif
5569     diff --git a/include/linux/fb.h b/include/linux/fb.h
5570     index a964d076b4dc..493d6d7794de 100644
5571     --- a/include/linux/fb.h
5572     +++ b/include/linux/fb.h
5573     @@ -732,8 +732,6 @@ extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
5574     extern const unsigned char *fb_firmware_edid(struct device *device);
5575     extern void fb_edid_to_monspecs(unsigned char *edid,
5576     struct fb_monspecs *specs);
5577     -extern void fb_edid_add_monspecs(unsigned char *edid,
5578     - struct fb_monspecs *specs);
5579     extern void fb_destroy_modedb(struct fb_videomode *modedb);
5580     extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
5581     extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
5582     @@ -807,7 +805,6 @@ struct dmt_videomode {
5583    
5584     extern const char *fb_mode_option;
5585     extern const struct fb_videomode vesa_modes[];
5586     -extern const struct fb_videomode cea_modes[65];
5587     extern const struct dmt_videomode dmt_modes[];
5588    
5589     struct fb_modelist {
5590     diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
5591     index e353f6600b0b..27dbab59f034 100644
5592     --- a/include/linux/intel-iommu.h
5593     +++ b/include/linux/intel-iommu.h
5594     @@ -295,7 +295,8 @@ enum {
5595     #define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32)
5596     #define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16)
5597     #define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK)
5598     -#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52))
5599     +#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \
5600     + ((u64)((pfsid >> 4) & 0xfff) << 52))
5601     #define QI_DEV_IOTLB_SIZE 1
5602     #define QI_DEV_IOTLB_MAX_INVS 32
5603    
5604     @@ -320,7 +321,8 @@ enum {
5605     #define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32)
5606     #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16)
5607     #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4)
5608     -#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52))
5609     +#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \
5610     + ((u64)((pfsid >> 4) & 0xfff) << 52))
5611     #define QI_DEV_EIOTLB_MAX_INVS 32
5612    
5613     #define QI_PGRP_IDX(idx) (((u64)(idx)) << 55)
5614     diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h
5615     index 2a663c6bb428..8850e243c940 100644
5616     --- a/include/linux/libfdt_env.h
5617     +++ b/include/linux/libfdt_env.h
5618     @@ -1,6 +1,7 @@
5619     #ifndef _LIBFDT_ENV_H
5620     #define _LIBFDT_ENV_H
5621    
5622     +#include <linux/kernel.h> /* For INT_MAX */
5623     #include <linux/string.h>
5624    
5625     #include <asm/byteorder.h>
5626     diff --git a/include/linux/platform_data/dma-ep93xx.h b/include/linux/platform_data/dma-ep93xx.h
5627     index e82c642fa53c..5913be0793a2 100644
5628     --- a/include/linux/platform_data/dma-ep93xx.h
5629     +++ b/include/linux/platform_data/dma-ep93xx.h
5630     @@ -84,7 +84,7 @@ static inline enum dma_transfer_direction
5631     ep93xx_dma_chan_direction(struct dma_chan *chan)
5632     {
5633     if (!ep93xx_dma_chan_is_m2p(chan))
5634     - return DMA_NONE;
5635     + return DMA_TRANS_NONE;
5636    
5637     /* even channels are for TX, odd for RX */
5638     return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
5639     diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
5640     index 7ba040c797ec..da2791b5fe87 100644
5641     --- a/include/linux/sunrpc/sched.h
5642     +++ b/include/linux/sunrpc/sched.h
5643     @@ -185,7 +185,6 @@ struct rpc_timer {
5644     struct rpc_wait_queue {
5645     spinlock_t lock;
5646     struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */
5647     - pid_t owner; /* process id of last task serviced */
5648     unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
5649     unsigned char priority; /* current priority */
5650     unsigned char nr; /* # tasks remaining for cookie */
5651     @@ -201,7 +200,6 @@ struct rpc_wait_queue {
5652     * from a single cookie. The aim is to improve
5653     * performance of NFS operations such as read/write.
5654     */
5655     -#define RPC_BATCH_COUNT 16
5656     #define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0)
5657    
5658     /*
5659     diff --git a/include/net/llc.h b/include/net/llc.h
5660     index 82d989995d18..95e5ced4c133 100644
5661     --- a/include/net/llc.h
5662     +++ b/include/net/llc.h
5663     @@ -66,6 +66,7 @@ struct llc_sap {
5664     int sk_count;
5665     struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES];
5666     struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
5667     + struct rcu_head rcu;
5668     };
5669    
5670     static inline
5671     diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
5672     index 0638b8aeba34..1d9c701b1c7b 100644
5673     --- a/include/rdma/ib_verbs.h
5674     +++ b/include/rdma/ib_verbs.h
5675     @@ -1026,7 +1026,7 @@ struct ib_qp_init_attr {
5676     struct ib_qp_cap cap;
5677     enum ib_sig_type sq_sig_type;
5678     enum ib_qp_type qp_type;
5679     - enum ib_qp_create_flags create_flags;
5680     + u32 create_flags;
5681    
5682     /*
5683     * Only needed for special QP types, or when using the RW API.
5684     diff --git a/kernel/cpu.c b/kernel/cpu.c
5685     index 0ed3e9deda30..c2573e858009 100644
5686     --- a/kernel/cpu.c
5687     +++ b/kernel/cpu.c
5688     @@ -379,6 +379,7 @@ void __init cpu_smt_disable(bool force)
5689     pr_info("SMT: Force disabled\n");
5690     cpu_smt_control = CPU_SMT_FORCE_DISABLED;
5691     } else {
5692     + pr_info("SMT: disabled\n");
5693     cpu_smt_control = CPU_SMT_DISABLED;
5694     }
5695     }
5696     diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
5697     index fbfab5722254..8ddd29476c0d 100644
5698     --- a/kernel/events/uprobes.c
5699     +++ b/kernel/events/uprobes.c
5700     @@ -1846,7 +1846,7 @@ static void handle_trampoline(struct pt_regs *regs)
5701    
5702     sigill:
5703     uprobe_warn(current, "handle uretprobe, sending SIGILL.");
5704     - force_sig_info(SIGILL, SEND_SIG_FORCED, current);
5705     + force_sig(SIGILL, current);
5706    
5707     }
5708    
5709     @@ -1962,7 +1962,7 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs)
5710    
5711     if (unlikely(err)) {
5712     uprobe_warn(current, "execute the probed insn, sending SIGILL.");
5713     - force_sig_info(SIGILL, SEND_SIG_FORCED, current);
5714     + force_sig(SIGILL, current);
5715     }
5716     }
5717    
5718     diff --git a/kernel/kprobes.c b/kernel/kprobes.c
5719     index 11863e2b01c2..1b75fb8c7735 100644
5720     --- a/kernel/kprobes.c
5721     +++ b/kernel/kprobes.c
5722     @@ -514,8 +514,14 @@ static void do_free_cleaned_kprobes(void)
5723     struct optimized_kprobe *op, *tmp;
5724    
5725     list_for_each_entry_safe(op, tmp, &freeing_list, list) {
5726     - BUG_ON(!kprobe_unused(&op->kp));
5727     list_del_init(&op->list);
5728     + if (WARN_ON_ONCE(!kprobe_unused(&op->kp))) {
5729     + /*
5730     + * This must not happen, but if there is a kprobe
5731     + * still in use, keep it on kprobes hash list.
5732     + */
5733     + continue;
5734     + }
5735     free_aggr_kprobe(&op->kp);
5736     }
5737     }
5738     diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
5739     index 6607d77afe55..a0339c458c14 100644
5740     --- a/kernel/printk/printk.c
5741     +++ b/kernel/printk/printk.c
5742     @@ -383,6 +383,7 @@ static u32 clear_idx;
5743     /* record buffer */
5744     #define LOG_ALIGN __alignof__(struct printk_log)
5745     #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
5746     +#define LOG_BUF_LEN_MAX (u32)(1 << 31)
5747     static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
5748     static char *log_buf = __log_buf;
5749     static u32 log_buf_len = __LOG_BUF_LEN;
5750     @@ -983,18 +984,23 @@ void log_buf_kexec_setup(void)
5751     static unsigned long __initdata new_log_buf_len;
5752    
5753     /* we practice scaling the ring buffer by powers of 2 */
5754     -static void __init log_buf_len_update(unsigned size)
5755     +static void __init log_buf_len_update(u64 size)
5756     {
5757     + if (size > (u64)LOG_BUF_LEN_MAX) {
5758     + size = (u64)LOG_BUF_LEN_MAX;
5759     + pr_err("log_buf over 2G is not supported.\n");
5760     + }
5761     +
5762     if (size)
5763     size = roundup_pow_of_two(size);
5764     if (size > log_buf_len)
5765     - new_log_buf_len = size;
5766     + new_log_buf_len = (unsigned long)size;
5767     }
5768    
5769     /* save requested log_buf_len since it's too early to process it */
5770     static int __init log_buf_len_setup(char *str)
5771     {
5772     - unsigned int size;
5773     + u64 size;
5774    
5775     if (!str)
5776     return -EINVAL;
5777     @@ -1064,7 +1070,7 @@ void __init setup_log_buf(int early)
5778     }
5779    
5780     if (unlikely(!new_log_buf)) {
5781     - pr_err("log_buf_len: %ld bytes not available\n",
5782     + pr_err("log_buf_len: %lu bytes not available\n",
5783     new_log_buf_len);
5784     return;
5785     }
5786     @@ -1077,8 +1083,8 @@ void __init setup_log_buf(int early)
5787     memcpy(log_buf, __log_buf, __LOG_BUF_LEN);
5788     raw_spin_unlock_irqrestore(&logbuf_lock, flags);
5789    
5790     - pr_info("log_buf_len: %d bytes\n", log_buf_len);
5791     - pr_info("early log buf free: %d(%d%%)\n",
5792     + pr_info("log_buf_len: %u bytes\n", log_buf_len);
5793     + pr_info("early log buf free: %u(%u%%)\n",
5794     free, (free * 100) / __LOG_BUF_LEN);
5795     }
5796    
5797     diff --git a/kernel/signal.c b/kernel/signal.c
5798     index 2bb1f9dc86c7..30914b3c76b2 100644
5799     --- a/kernel/signal.c
5800     +++ b/kernel/signal.c
5801     @@ -71,6 +71,10 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force)
5802    
5803     handler = sig_handler(t, sig);
5804    
5805     + /* SIGKILL and SIGSTOP may not be sent to the global init */
5806     + if (unlikely(is_global_init(t) && sig_kernel_only(sig)))
5807     + return true;
5808     +
5809     if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) &&
5810     handler == SIG_DFL && !(force && sig_kernel_only(sig)))
5811     return 1;
5812     diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
5813     index eec1150125b9..e430e04997ee 100644
5814     --- a/mm/hugetlb_cgroup.c
5815     +++ b/mm/hugetlb_cgroup.c
5816     @@ -196,7 +196,7 @@ int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
5817     again:
5818     rcu_read_lock();
5819     h_cg = hugetlb_cgroup_from_task(current);
5820     - if (!css_tryget_online(&h_cg->css)) {
5821     + if (!css_tryget(&h_cg->css)) {
5822     rcu_read_unlock();
5823     goto again;
5824     }
5825     diff --git a/mm/memcontrol.c b/mm/memcontrol.c
5826     index 9ca63af4f37a..0f8422239dea 100644
5827     --- a/mm/memcontrol.c
5828     +++ b/mm/memcontrol.c
5829     @@ -741,7 +741,7 @@ static struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
5830     if (unlikely(!memcg))
5831     memcg = root_mem_cgroup;
5832     }
5833     - } while (!css_tryget_online(&memcg->css));
5834     + } while (!css_tryget(&memcg->css));
5835     rcu_read_unlock();
5836     return memcg;
5837     }
5838     diff --git a/mm/shmem.c b/mm/shmem.c
5839     index ac8a5fedc245..6266a7d1ba00 100644
5840     --- a/mm/shmem.c
5841     +++ b/mm/shmem.c
5842     @@ -2464,7 +2464,7 @@ static void shmem_tag_pins(struct address_space *mapping)
5843    
5844     spin_lock_irq(&mapping->tree_lock);
5845     radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) {
5846     - page = radix_tree_deref_slot(slot);
5847     + page = radix_tree_deref_slot_protected(slot, &mapping->tree_lock);
5848     if (!page || radix_tree_exception(page)) {
5849     if (radix_tree_deref_retry(page)) {
5850     slot = radix_tree_iter_retry(&iter);
5851     diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
5852     index 48d23abfe799..1306962a792a 100644
5853     --- a/net/bluetooth/l2cap_core.c
5854     +++ b/net/bluetooth/l2cap_core.c
5855     @@ -6811,6 +6811,16 @@ static int l2cap_le_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
5856     chan->sdu_len = sdu_len;
5857     chan->sdu_last_frag = skb;
5858    
5859     + /* Detect if remote is not able to use the selected MPS */
5860     + if (skb->len + L2CAP_SDULEN_SIZE < chan->mps) {
5861     + u16 mps_len = skb->len + L2CAP_SDULEN_SIZE;
5862     +
5863     + /* Adjust the number of credits */
5864     + BT_DBG("chan->mps %u -> %u", chan->mps, mps_len);
5865     + chan->mps = mps_len;
5866     + l2cap_chan_le_send_credits(chan);
5867     + }
5868     +
5869     return 0;
5870     }
5871    
5872     diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
5873     index b798862b6be5..7efe740c06eb 100644
5874     --- a/net/ipv4/gre_demux.c
5875     +++ b/net/ipv4/gre_demux.c
5876     @@ -86,13 +86,14 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
5877    
5878     options = (__be32 *)(greh + 1);
5879     if (greh->flags & GRE_CSUM) {
5880     - if (skb_checksum_simple_validate(skb)) {
5881     + if (!skb_checksum_simple_validate(skb)) {
5882     + skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
5883     + null_compute_pseudo);
5884     + } else if (csum_err) {
5885     *csum_err = true;
5886     return -EINVAL;
5887     }
5888    
5889     - skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
5890     - null_compute_pseudo);
5891     options++;
5892     }
5893    
5894     diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
5895     index 576f705d8180..9609ad71dd26 100644
5896     --- a/net/ipv4/ip_gre.c
5897     +++ b/net/ipv4/ip_gre.c
5898     @@ -224,13 +224,10 @@ static void gre_err(struct sk_buff *skb, u32 info)
5899     const int type = icmp_hdr(skb)->type;
5900     const int code = icmp_hdr(skb)->code;
5901     struct tnl_ptk_info tpi;
5902     - bool csum_err = false;
5903    
5904     - if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP),
5905     - iph->ihl * 4) < 0) {
5906     - if (!csum_err) /* ignore csum errors. */
5907     - return;
5908     - }
5909     + if (gre_parse_header(skb, &tpi, NULL, htons(ETH_P_IP),
5910     + iph->ihl * 4) < 0)
5911     + return;
5912    
5913     if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
5914     ipv4_update_pmtu(skb, dev_net(skb->dev), info,
5915     diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c
5916     index e896a2c53b12..f1e442a39db8 100644
5917     --- a/net/llc/llc_core.c
5918     +++ b/net/llc/llc_core.c
5919     @@ -127,9 +127,7 @@ void llc_sap_close(struct llc_sap *sap)
5920     list_del_rcu(&sap->node);
5921     spin_unlock_bh(&llc_sap_list_lock);
5922    
5923     - synchronize_rcu();
5924     -
5925     - kfree(sap);
5926     + kfree_rcu(sap, rcu);
5927     }
5928    
5929     static struct packet_type llc_packet_type __read_mostly = {
5930     diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
5931     index 30fbabf4bcbc..593184d14b3e 100644
5932     --- a/net/mac80211/rc80211_minstrel_ht.c
5933     +++ b/net/mac80211/rc80211_minstrel_ht.c
5934     @@ -128,7 +128,7 @@
5935    
5936     #define CCK_GROUP \
5937     [MINSTREL_CCK_GROUP] = { \
5938     - .streams = 0, \
5939     + .streams = 1, \
5940     .flags = 0, \
5941     .duration = { \
5942     CCK_DURATION_LIST(false), \
5943     diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
5944     index e7da29021b38..c23392482580 100644
5945     --- a/net/openvswitch/vport-internal_dev.c
5946     +++ b/net/openvswitch/vport-internal_dev.c
5947     @@ -44,7 +44,8 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev)
5948     }
5949    
5950     /* Called with rcu_read_lock_bh. */
5951     -static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
5952     +static netdev_tx_t
5953     +internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
5954     {
5955     int len, err;
5956    
5957     @@ -63,7 +64,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
5958     } else {
5959     netdev->stats.tx_errors++;
5960     }
5961     - return 0;
5962     + return NETDEV_TX_OK;
5963     }
5964    
5965     static int internal_dev_open(struct net_device *netdev)
5966     diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
5967     index 600eacce653a..0ef65822fdd3 100644
5968     --- a/net/sunrpc/sched.c
5969     +++ b/net/sunrpc/sched.c
5970     @@ -99,64 +99,78 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task)
5971     list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list);
5972     }
5973    
5974     -static void rpc_rotate_queue_owner(struct rpc_wait_queue *queue)
5975     -{
5976     - struct list_head *q = &queue->tasks[queue->priority];
5977     - struct rpc_task *task;
5978     -
5979     - if (!list_empty(q)) {
5980     - task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
5981     - if (task->tk_owner == queue->owner)
5982     - list_move_tail(&task->u.tk_wait.list, q);
5983     - }
5984     -}
5985     -
5986     static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority)
5987     {
5988     if (queue->priority != priority) {
5989     - /* Fairness: rotate the list when changing priority */
5990     - rpc_rotate_queue_owner(queue);
5991     queue->priority = priority;
5992     + queue->nr = 1U << priority;
5993     }
5994     }
5995    
5996     -static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid)
5997     -{
5998     - queue->owner = pid;
5999     - queue->nr = RPC_BATCH_COUNT;
6000     -}
6001     -
6002     static void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue)
6003     {
6004     rpc_set_waitqueue_priority(queue, queue->maxpriority);
6005     - rpc_set_waitqueue_owner(queue, 0);
6006     }
6007    
6008     /*
6009     - * Add new request to a priority queue.
6010     + * Add a request to a queue list
6011     */
6012     -static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue,
6013     - struct rpc_task *task,
6014     - unsigned char queue_priority)
6015     +static void
6016     +__rpc_list_enqueue_task(struct list_head *q, struct rpc_task *task)
6017     {
6018     - struct list_head *q;
6019     struct rpc_task *t;
6020    
6021     - INIT_LIST_HEAD(&task->u.tk_wait.links);
6022     - if (unlikely(queue_priority > queue->maxpriority))
6023     - queue_priority = queue->maxpriority;
6024     - if (queue_priority > queue->priority)
6025     - rpc_set_waitqueue_priority(queue, queue_priority);
6026     - q = &queue->tasks[queue_priority];
6027     list_for_each_entry(t, q, u.tk_wait.list) {
6028     if (t->tk_owner == task->tk_owner) {
6029     - list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links);
6030     + list_add_tail(&task->u.tk_wait.links,
6031     + &t->u.tk_wait.links);
6032     + /* Cache the queue head in task->u.tk_wait.list */
6033     + task->u.tk_wait.list.next = q;
6034     + task->u.tk_wait.list.prev = NULL;
6035     return;
6036     }
6037     }
6038     + INIT_LIST_HEAD(&task->u.tk_wait.links);
6039     list_add_tail(&task->u.tk_wait.list, q);
6040     }
6041    
6042     +/*
6043     + * Remove request from a queue list
6044     + */
6045     +static void
6046     +__rpc_list_dequeue_task(struct rpc_task *task)
6047     +{
6048     + struct list_head *q;
6049     + struct rpc_task *t;
6050     +
6051     + if (task->u.tk_wait.list.prev == NULL) {
6052     + list_del(&task->u.tk_wait.links);
6053     + return;
6054     + }
6055     + if (!list_empty(&task->u.tk_wait.links)) {
6056     + t = list_first_entry(&task->u.tk_wait.links,
6057     + struct rpc_task,
6058     + u.tk_wait.links);
6059     + /* Assume __rpc_list_enqueue_task() cached the queue head */
6060     + q = t->u.tk_wait.list.next;
6061     + list_add_tail(&t->u.tk_wait.list, q);
6062     + list_del(&task->u.tk_wait.links);
6063     + }
6064     + list_del(&task->u.tk_wait.list);
6065     +}
6066     +
6067     +/*
6068     + * Add new request to a priority queue.
6069     + */
6070     +static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue,
6071     + struct rpc_task *task,
6072     + unsigned char queue_priority)
6073     +{
6074     + if (unlikely(queue_priority > queue->maxpriority))
6075     + queue_priority = queue->maxpriority;
6076     + __rpc_list_enqueue_task(&queue->tasks[queue_priority], task);
6077     +}
6078     +
6079     /*
6080     * Add new request to wait queue.
6081     *
6082     @@ -194,13 +208,7 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue,
6083     */
6084     static void __rpc_remove_wait_queue_priority(struct rpc_task *task)
6085     {
6086     - struct rpc_task *t;
6087     -
6088     - if (!list_empty(&task->u.tk_wait.links)) {
6089     - t = list_entry(task->u.tk_wait.links.next, struct rpc_task, u.tk_wait.list);
6090     - list_move(&t->u.tk_wait.list, &task->u.tk_wait.list);
6091     - list_splice_init(&task->u.tk_wait.links, &t->u.tk_wait.links);
6092     - }
6093     + __rpc_list_dequeue_task(task);
6094     }
6095    
6096     /*
6097     @@ -212,7 +220,8 @@ static void __rpc_remove_wait_queue(struct rpc_wait_queue *queue, struct rpc_tas
6098     __rpc_disable_timer(queue, task);
6099     if (RPC_IS_PRIORITY(queue))
6100     __rpc_remove_wait_queue_priority(task);
6101     - list_del(&task->u.tk_wait.list);
6102     + else
6103     + list_del(&task->u.tk_wait.list);
6104     queue->qlen--;
6105     dprintk("RPC: %5u removed from queue %p \"%s\"\n",
6106     task->tk_pid, queue, rpc_qname(queue));
6107     @@ -481,17 +490,9 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q
6108     * Service a batch of tasks from a single owner.
6109     */
6110     q = &queue->tasks[queue->priority];
6111     - if (!list_empty(q)) {
6112     - task = list_entry(q->next, struct rpc_task, u.tk_wait.list);
6113     - if (queue->owner == task->tk_owner) {
6114     - if (--queue->nr)
6115     - goto out;
6116     - list_move_tail(&task->u.tk_wait.list, q);
6117     - }
6118     - /*
6119     - * Check if we need to switch queues.
6120     - */
6121     - goto new_owner;
6122     + if (!list_empty(q) && --queue->nr) {
6123     + task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
6124     + goto out;
6125     }
6126    
6127     /*
6128     @@ -503,7 +504,7 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q
6129     else
6130     q = q - 1;
6131     if (!list_empty(q)) {
6132     - task = list_entry(q->next, struct rpc_task, u.tk_wait.list);
6133     + task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
6134     goto new_queue;
6135     }
6136     } while (q != &queue->tasks[queue->priority]);
6137     @@ -513,8 +514,6 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q
6138    
6139     new_queue:
6140     rpc_set_waitqueue_priority(queue, (unsigned int)(q - &queue->tasks[0]));
6141     -new_owner:
6142     - rpc_set_waitqueue_owner(queue, task->tk_owner);
6143     out:
6144     return task;
6145     }
6146     diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
6147     index 060bc0cc8252..bb19be78aed7 100644
6148     --- a/net/wireless/nl80211.c
6149     +++ b/net/wireless/nl80211.c
6150     @@ -3058,7 +3058,7 @@ static void get_key_callback(void *c, struct key_params *params)
6151     params->cipher)))
6152     goto nla_put_failure;
6153    
6154     - if (nla_put_u8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx))
6155     + if (nla_put_u8(cookie->msg, NL80211_KEY_IDX, cookie->idx))
6156     goto nla_put_failure;
6157    
6158     nla_nest_end(cookie->msg, key);
6159     diff --git a/net/wireless/reg.c b/net/wireless/reg.c
6160     index 44befe9f9ff0..dde741f298de 100644
6161     --- a/net/wireless/reg.c
6162     +++ b/net/wireless/reg.c
6163     @@ -2616,8 +2616,54 @@ static void restore_regulatory_settings(bool reset_user)
6164     schedule_work(&reg_work);
6165     }
6166    
6167     +static bool is_wiphy_all_set_reg_flag(enum ieee80211_regulatory_flags flag)
6168     +{
6169     + struct cfg80211_registered_device *rdev;
6170     + struct wireless_dev *wdev;
6171     +
6172     + list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
6173     + list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
6174     + wdev_lock(wdev);
6175     + if (!(wdev->wiphy->regulatory_flags & flag)) {
6176     + wdev_unlock(wdev);
6177     + return false;
6178     + }
6179     + wdev_unlock(wdev);
6180     + }
6181     + }
6182     +
6183     + return true;
6184     +}
6185     +
6186     void regulatory_hint_disconnect(void)
6187     {
6188     + /* Restore of regulatory settings is not required when wiphy(s)
6189     + * ignore IE from connected access point but clearance of beacon hints
6190     + * is required when wiphy(s) supports beacon hints.
6191     + */
6192     + if (is_wiphy_all_set_reg_flag(REGULATORY_COUNTRY_IE_IGNORE)) {
6193     + struct reg_beacon *reg_beacon, *btmp;
6194     +
6195     + if (is_wiphy_all_set_reg_flag(REGULATORY_DISABLE_BEACON_HINTS))
6196     + return;
6197     +
6198     + spin_lock_bh(&reg_pending_beacons_lock);
6199     + list_for_each_entry_safe(reg_beacon, btmp,
6200     + &reg_pending_beacons, list) {
6201     + list_del(&reg_beacon->list);
6202     + kfree(reg_beacon);
6203     + }
6204     + spin_unlock_bh(&reg_pending_beacons_lock);
6205     +
6206     + list_for_each_entry_safe(reg_beacon, btmp,
6207     + &reg_beacon_list, list) {
6208     + list_del(&reg_beacon->list);
6209     + kfree(reg_beacon);
6210     + }
6211     +
6212     + return;
6213     + }
6214     +
6215     pr_debug("All devices are disconnected, going to restore regulatory settings\n");
6216     restore_regulatory_settings(false);
6217     }
6218     diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c
6219     index bb9988914a56..32234481ad7d 100644
6220     --- a/samples/mei/mei-amt-version.c
6221     +++ b/samples/mei/mei-amt-version.c
6222     @@ -370,7 +370,7 @@ static uint32_t amt_host_if_call(struct amt_host_if *acmd,
6223     unsigned int expected_sz)
6224     {
6225     uint32_t in_buf_sz;
6226     - uint32_t out_buf_sz;
6227     + ssize_t out_buf_sz;
6228     ssize_t written;
6229     uint32_t status;
6230     struct amt_host_if_resp_header *msg_hdr;
6231     diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
6232     index a84a1d3d23e5..c6888d76ca5e 100644
6233     --- a/sound/core/oss/pcm_plugin.c
6234     +++ b/sound/core/oss/pcm_plugin.c
6235     @@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames)
6236     while (plugin->next) {
6237     if (plugin->dst_frames)
6238     frames = plugin->dst_frames(plugin, frames);
6239     - if (snd_BUG_ON(frames <= 0))
6240     + if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0))
6241     return -ENXIO;
6242     plugin = plugin->next;
6243     err = snd_pcm_plugin_alloc(plugin, frames);
6244     @@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames)
6245     while (plugin->prev) {
6246     if (plugin->src_frames)
6247     frames = plugin->src_frames(plugin, frames);
6248     - if (snd_BUG_ON(frames <= 0))
6249     + if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0))
6250     return -ENXIO;
6251     plugin = plugin->prev;
6252     err = snd_pcm_plugin_alloc(plugin, frames);
6253     diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
6254     index 8ce1d0b40dce..ce1f1e4727ab 100644
6255     --- a/sound/core/seq/seq_system.c
6256     +++ b/sound/core/seq/seq_system.c
6257     @@ -123,6 +123,7 @@ int __init snd_seq_system_client_init(void)
6258     {
6259     struct snd_seq_port_callback pcallbacks;
6260     struct snd_seq_port_info *port;
6261     + int err;
6262    
6263     port = kzalloc(sizeof(*port), GFP_KERNEL);
6264     if (!port)
6265     @@ -144,7 +145,10 @@ int __init snd_seq_system_client_init(void)
6266     port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
6267     port->addr.client = sysclient;
6268     port->addr.port = SNDRV_SEQ_PORT_SYSTEM_TIMER;
6269     - snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port);
6270     + err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT,
6271     + port);
6272     + if (err < 0)
6273     + goto error_port;
6274    
6275     /* register announcement port */
6276     strcpy(port->name, "Announce");
6277     @@ -154,16 +158,24 @@ int __init snd_seq_system_client_init(void)
6278     port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
6279     port->addr.client = sysclient;
6280     port->addr.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE;
6281     - snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port);
6282     + err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT,
6283     + port);
6284     + if (err < 0)
6285     + goto error_port;
6286     announce_port = port->addr.port;
6287    
6288     kfree(port);
6289     return 0;
6290     +
6291     + error_port:
6292     + snd_seq_system_client_done();
6293     + kfree(port);
6294     + return err;
6295     }
6296    
6297    
6298     /* unregister our internal client */
6299     -void __exit snd_seq_system_client_done(void)
6300     +void snd_seq_system_client_done(void)
6301     {
6302     int oldsysclient = sysclient;
6303    
6304     diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
6305     index 0abab7926dca..d1a6d20ace0d 100644
6306     --- a/sound/pci/hda/patch_sigmatel.c
6307     +++ b/sound/pci/hda/patch_sigmatel.c
6308     @@ -77,6 +77,7 @@ enum {
6309     STAC_DELL_M6_BOTH,
6310     STAC_DELL_EQ,
6311     STAC_ALIENWARE_M17X,
6312     + STAC_ELO_VUPOINT_15MX,
6313     STAC_92HD89XX_HP_FRONT_JACK,
6314     STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
6315     STAC_92HD73XX_ASUS_MOBO,
6316     @@ -1875,6 +1876,18 @@ static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
6317     codec->no_jack_detect = 1;
6318     }
6319    
6320     +
6321     +static void stac92hd73xx_disable_automute(struct hda_codec *codec,
6322     + const struct hda_fixup *fix, int action)
6323     +{
6324     + struct sigmatel_spec *spec = codec->spec;
6325     +
6326     + if (action != HDA_FIXUP_ACT_PRE_PROBE)
6327     + return;
6328     +
6329     + spec->gen.suppress_auto_mute = 1;
6330     +}
6331     +
6332     static const struct hda_fixup stac92hd73xx_fixups[] = {
6333     [STAC_92HD73XX_REF] = {
6334     .type = HDA_FIXUP_FUNC,
6335     @@ -1900,6 +1913,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = {
6336     .type = HDA_FIXUP_FUNC,
6337     .v.func = stac92hd73xx_fixup_alienware_m17x,
6338     },
6339     + [STAC_ELO_VUPOINT_15MX] = {
6340     + .type = HDA_FIXUP_FUNC,
6341     + .v.func = stac92hd73xx_disable_automute,
6342     + },
6343     [STAC_92HD73XX_INTEL] = {
6344     .type = HDA_FIXUP_PINS,
6345     .v.pins = intel_dg45id_pin_configs,
6346     @@ -1938,6 +1955,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = {
6347     { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
6348     { .id = STAC_DELL_EQ, .name = "dell-eq" },
6349     { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
6350     + { .id = STAC_ELO_VUPOINT_15MX, .name = "elo-vupoint-15mx" },
6351     { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" },
6352     {}
6353     };
6354     @@ -1987,6 +2005,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
6355     "Alienware M17x", STAC_ALIENWARE_M17X),
6356     SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
6357     "Alienware M17x R3", STAC_DELL_EQ),
6358     + SND_PCI_QUIRK(0x1059, 0x1011,
6359     + "ELO VuPoint 15MX", STAC_ELO_VUPOINT_15MX),
6360     SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927,
6361     "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
6362     SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
6363     diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
6364     index 1bc98c867133..2286dfd72ff7 100644
6365     --- a/sound/pci/intel8x0m.c
6366     +++ b/sound/pci/intel8x0m.c
6367     @@ -1171,16 +1171,6 @@ static int snd_intel8x0m_create(struct snd_card *card,
6368     }
6369    
6370     port_inited:
6371     - if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED,
6372     - KBUILD_MODNAME, chip)) {
6373     - dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
6374     - snd_intel8x0m_free(chip);
6375     - return -EBUSY;
6376     - }
6377     - chip->irq = pci->irq;
6378     - pci_set_master(pci);
6379     - synchronize_irq(chip->irq);
6380     -
6381     /* initialize offsets */
6382     chip->bdbars_count = 2;
6383     tbl = intel_regs;
6384     @@ -1224,11 +1214,21 @@ static int snd_intel8x0m_create(struct snd_card *card,
6385     chip->int_sta_reg = ICH_REG_GLOB_STA;
6386     chip->int_sta_mask = int_sta_masks;
6387    
6388     + pci_set_master(pci);
6389     +
6390     if ((err = snd_intel8x0m_chip_init(chip, 1)) < 0) {
6391     snd_intel8x0m_free(chip);
6392     return err;
6393     }
6394    
6395     + if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED,
6396     + KBUILD_MODNAME, chip)) {
6397     + dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
6398     + snd_intel8x0m_free(chip);
6399     + return -EBUSY;
6400     + }
6401     + chip->irq = pci->irq;
6402     +
6403     if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
6404     snd_intel8x0m_free(chip);
6405     return err;
6406     diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
6407     index c602c4960924..88355d1719a3 100644
6408     --- a/sound/soc/codecs/hdac_hdmi.c
6409     +++ b/sound/soc/codecs/hdac_hdmi.c
6410     @@ -1267,6 +1267,12 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac,
6411     if (ret)
6412     return ret;
6413    
6414     + /* Filter out 44.1, 88.2 and 176.4Khz */
6415     + rates &= ~(SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |
6416     + SNDRV_PCM_RATE_176400);
6417     + if (!rates)
6418     + return -EINVAL;
6419     +
6420     sprintf(dai_name, "intel-hdmi-hifi%d", i+1);
6421     hdmi_dais[i].name = devm_kstrdup(&hdac->dev,
6422     dai_name, GFP_KERNEL);
6423     diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
6424     index 7406ea5c9a4f..39810b713d5f 100644
6425     --- a/sound/soc/codecs/sgtl5000.c
6426     +++ b/sound/soc/codecs/sgtl5000.c
6427     @@ -1217,7 +1217,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
6428     * Searching for a suitable index solving this formula:
6429     * idx = 40 * log10(vag_val / lo_cagcntrl) + 15
6430     */
6431     - vol_quot = (vag * 100) / lo_vag;
6432     + vol_quot = lo_vag ? (vag * 100) / lo_vag : 0;
6433     lo_vol = 0;
6434     for (i = 0; i < ARRAY_SIZE(vol_quot_table); i++) {
6435     if (vol_quot >= vol_quot_table[i])
6436     diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
6437     index 1d00f6e894ef..d69559e45872 100644
6438     --- a/sound/soc/soc-pcm.c
6439     +++ b/sound/soc/soc-pcm.c
6440     @@ -1592,7 +1592,7 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
6441     u64 formats)
6442     {
6443     runtime->hw.rate_min = stream->rate_min;
6444     - runtime->hw.rate_max = stream->rate_max;
6445     + runtime->hw.rate_max = min_not_zero(stream->rate_max, UINT_MAX);
6446     runtime->hw.channels_min = stream->channels_min;
6447     runtime->hw.channels_max = stream->channels_max;
6448     if (runtime->hw.formats)
6449     diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
6450     index b8044c6034b3..30aa5f2df6da 100644
6451     --- a/sound/usb/endpoint.c
6452     +++ b/sound/usb/endpoint.c
6453     @@ -403,6 +403,9 @@ static void snd_complete_urb(struct urb *urb)
6454     }
6455    
6456     prepare_outbound_urb(ep, ctx);
6457     + /* can be stopped during prepare callback */
6458     + if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
6459     + goto exit_clear;
6460     } else {
6461     retire_inbound_urb(ep, ctx);
6462     /* can be stopped during retire callback */
6463     diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
6464     index a02443717625..64fa1bbf0acb 100644
6465     --- a/sound/usb/mixer.c
6466     +++ b/sound/usb/mixer.c
6467     @@ -1046,7 +1046,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
6468     if (cval->min + cval->res < cval->max) {
6469     int last_valid_res = cval->res;
6470     int saved, test, check;
6471     - get_cur_mix_raw(cval, minchn, &saved);
6472     + if (get_cur_mix_raw(cval, minchn, &saved) < 0)
6473     + goto no_res_check;
6474     for (;;) {
6475     test = saved;
6476     if (test < cval->max)
6477     @@ -1066,6 +1067,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
6478     snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
6479     }
6480    
6481     +no_res_check:
6482     cval->initialized = 1;
6483     }
6484