Magellan Linux

Contents of /trunk/kernel-alx/patches-4.1/0112-4.1.13-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2748 - (show annotations) (download)
Mon Jan 11 12:00:45 2016 UTC (8 years, 4 months ago) by niro
File size: 110369 byte(s)
-linux-4.1 patches up to 4.1.15
1 diff --git a/Documentation/devicetree/bindings/mfd/mfd.txt b/Documentation/devicetree/bindings/mfd/mfd.txt
2 new file mode 100644
3 index 000000000000..af9d6931a1a2
4 --- /dev/null
5 +++ b/Documentation/devicetree/bindings/mfd/mfd.txt
6 @@ -0,0 +1,41 @@
7 +Multi-Function Devices (MFD)
8 +
9 +These devices comprise a nexus for heterogeneous hardware blocks containing
10 +more than one non-unique yet varying hardware functionality.
11 +
12 +A typical MFD can be:
13 +
14 +- A mixed signal ASIC on an external bus, sometimes a PMIC (Power Management
15 + Integrated Circuit) that is manufactured in a lower technology node (rough
16 + silicon) that handles analog drivers for things like audio amplifiers, LED
17 + drivers, level shifters, PHY (physical interfaces to things like USB or
18 + ethernet), regulators etc.
19 +
20 +- A range of memory registers containing "miscellaneous system registers" also
21 + known as a system controller "syscon" or any other memory range containing a
22 + mix of unrelated hardware devices.
23 +
24 +Optional properties:
25 +
26 +- compatible : "simple-mfd" - this signifies that the operating system should
27 + consider all subnodes of the MFD device as separate devices akin to how
28 + "simple-bus" inidicates when to see subnodes as children for a simple
29 + memory-mapped bus. For more complex devices, when the nexus driver has to
30 + probe registers to figure out what child devices exist etc, this should not
31 + be used. In the latter case the child devices will be determined by the
32 + operating system.
33 +
34 +Example:
35 +
36 +foo@1000 {
37 + compatible = "syscon", "simple-mfd";
38 + reg = <0x01000 0x1000>;
39 +
40 + led@08.0 {
41 + compatible = "register-bit-led";
42 + offset = <0x08>;
43 + mask = <0x01>;
44 + label = "myled";
45 + default-state = "on";
46 + };
47 +};
48 diff --git a/Makefile b/Makefile
49 index 2320f1911404..d5d229db61d5 100644
50 --- a/Makefile
51 +++ b/Makefile
52 @@ -1,6 +1,6 @@
53 VERSION = 4
54 PATCHLEVEL = 1
55 -SUBLEVEL = 12
56 +SUBLEVEL = 13
57 EXTRAVERSION =
58 NAME = Series 4800
59
60 diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts
61 index c9df40e5cd3b..e8397879d0a7 100644
62 --- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
63 +++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
64 @@ -354,11 +354,12 @@
65 /* SMPS9 unused */
66
67 ldo1_reg: ldo1 {
68 - /* VDD_SD */
69 + /* VDD_SD / VDDSHV8 */
70 regulator-name = "ldo1";
71 regulator-min-microvolt = <1800000>;
72 regulator-max-microvolt = <3300000>;
73 regulator-boot-on;
74 + regulator-always-on;
75 };
76
77 ldo2_reg: ldo2 {
78 diff --git a/arch/arm/boot/dts/armada-385-db-ap.dts b/arch/arm/boot/dts/armada-385-db-ap.dts
79 index 7219ac3a3d90..9f730e8e9f87 100644
80 --- a/arch/arm/boot/dts/armada-385-db-ap.dts
81 +++ b/arch/arm/boot/dts/armada-385-db-ap.dts
82 @@ -46,7 +46,7 @@
83
84 / {
85 model = "Marvell Armada 385 Access Point Development Board";
86 - compatible = "marvell,a385-db-ap", "marvell,armada385", "marvell,armada38x";
87 + compatible = "marvell,a385-db-ap", "marvell,armada385", "marvell,armada380";
88
89 chosen {
90 stdout-path = "serial1:115200n8";
91 diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
92 index 146e71118a72..a0ec8bff83dd 100644
93 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
94 +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
95 @@ -915,6 +915,11 @@
96 };
97 };
98
99 +&pmu_system_controller {
100 + assigned-clocks = <&pmu_system_controller 0>;
101 + assigned-clock-parents = <&clock CLK_FIN_PLL>;
102 +};
103 +
104 &rtc {
105 status = "okay";
106 clocks = <&clock CLK_RTC>, <&max77802 MAX77802_CLK_32K_AP>;
107 diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
108 index 02eb8b15374f..1171f347878a 100644
109 --- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
110 +++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
111 @@ -878,6 +878,11 @@
112 };
113 };
114
115 +&pmu_system_controller {
116 + assigned-clocks = <&pmu_system_controller 0>;
117 + assigned-clock-parents = <&clock CLK_FIN_PLL>;
118 +};
119 +
120 &rtc {
121 status = "okay";
122 clocks = <&clock CLK_RTC>, <&max77802 MAX77802_CLK_32K_AP>;
123 diff --git a/arch/arm/boot/dts/imx6dl-riotboard.dts b/arch/arm/boot/dts/imx6dl-riotboard.dts
124 index 43cb3fd76be7..5111f5170d53 100644
125 --- a/arch/arm/boot/dts/imx6dl-riotboard.dts
126 +++ b/arch/arm/boot/dts/imx6dl-riotboard.dts
127 @@ -305,8 +305,8 @@
128 &usdhc2 {
129 pinctrl-names = "default";
130 pinctrl-0 = <&pinctrl_usdhc2>;
131 - cd-gpios = <&gpio1 4 0>;
132 - wp-gpios = <&gpio1 2 0>;
133 + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
134 + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
135 vmmc-supply = <&reg_3p3v>;
136 status = "okay";
137 };
138 @@ -314,8 +314,8 @@
139 &usdhc3 {
140 pinctrl-names = "default";
141 pinctrl-0 = <&pinctrl_usdhc3>;
142 - cd-gpios = <&gpio7 0 0>;
143 - wp-gpios = <&gpio7 1 0>;
144 + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
145 + wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
146 vmmc-supply = <&reg_3p3v>;
147 status = "okay";
148 };
149 diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts
150 index 78df05e9d1ce..d6515f7a56c4 100644
151 --- a/arch/arm/boot/dts/imx6q-arm2.dts
152 +++ b/arch/arm/boot/dts/imx6q-arm2.dts
153 @@ -11,6 +11,7 @@
154 */
155
156 /dts-v1/;
157 +#include <dt-bindings/gpio/gpio.h>
158 #include "imx6q.dtsi"
159
160 / {
161 @@ -196,8 +197,8 @@
162 };
163
164 &usdhc3 {
165 - cd-gpios = <&gpio6 11 0>;
166 - wp-gpios = <&gpio6 14 0>;
167 + cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
168 + wp-gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>;
169 vmmc-supply = <&reg_3p3v>;
170 pinctrl-names = "default";
171 pinctrl-0 = <&pinctrl_usdhc3
172 diff --git a/arch/arm/boot/dts/imx6q-gk802.dts b/arch/arm/boot/dts/imx6q-gk802.dts
173 index 703539cf36d3..00bd63e63d0c 100644
174 --- a/arch/arm/boot/dts/imx6q-gk802.dts
175 +++ b/arch/arm/boot/dts/imx6q-gk802.dts
176 @@ -7,6 +7,7 @@
177 */
178
179 /dts-v1/;
180 +#include <dt-bindings/gpio/gpio.h>
181 #include "imx6q.dtsi"
182
183 / {
184 @@ -161,7 +162,7 @@
185 pinctrl-names = "default";
186 pinctrl-0 = <&pinctrl_usdhc3>;
187 bus-width = <4>;
188 - cd-gpios = <&gpio6 11 0>;
189 + cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
190 vmmc-supply = <&reg_3p3v>;
191 status = "okay";
192 };
193 diff --git a/arch/arm/boot/dts/imx6q-tbs2910.dts b/arch/arm/boot/dts/imx6q-tbs2910.dts
194 index a43abfa21e33..5645d52850a7 100644
195 --- a/arch/arm/boot/dts/imx6q-tbs2910.dts
196 +++ b/arch/arm/boot/dts/imx6q-tbs2910.dts
197 @@ -251,7 +251,7 @@
198 pinctrl-names = "default";
199 pinctrl-0 = <&pinctrl_usdhc2>;
200 bus-width = <4>;
201 - cd-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
202 + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
203 vmmc-supply = <&reg_3p3v>;
204 status = "okay";
205 };
206 @@ -260,7 +260,7 @@
207 pinctrl-names = "default";
208 pinctrl-0 = <&pinctrl_usdhc3>;
209 bus-width = <4>;
210 - cd-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
211 + cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
212 wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
213 vmmc-supply = <&reg_3p3v>;
214 status = "okay";
215 diff --git a/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi b/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi
216 index e6d9195a1da7..f4d6ae564ead 100644
217 --- a/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi
218 +++ b/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi
219 @@ -173,7 +173,7 @@
220 pinctrl-names = "default";
221 pinctrl-0 = <&pinctrl_usdhc1>;
222 vmmc-supply = <&reg_3p3v>;
223 - cd-gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>;
224 + cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>;
225 status = "okay";
226 };
227
228 @@ -181,7 +181,7 @@
229 pinctrl-names = "default";
230 pinctrl-0 = <&pinctrl_usdhc2>;
231 vmmc-supply = <&reg_3p3v>;
232 - cd-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>;
233 + cd-gpios = <&gpio4 8 GPIO_ACTIVE_LOW>;
234 status = "okay";
235 };
236
237 diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
238 index d033bb182060..6a846e0ef505 100644
239 --- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
240 +++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
241 @@ -259,6 +259,6 @@
242 pinctrl-names = "default";
243 pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>;
244 vmmc-supply = <&reg_3p3v>;
245 - cd-gpios = <&gpio1 4 0>;
246 + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
247 status = "okay";
248 };
249 diff --git a/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi b/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi
250 index 2c253d6d20bd..45e7c39e80d5 100644
251 --- a/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi
252 +++ b/arch/arm/boot/dts/imx6qdl-dfi-fs700-m60.dtsi
253 @@ -1,3 +1,5 @@
254 +#include <dt-bindings/gpio/gpio.h>
255 +
256 / {
257 regulators {
258 compatible = "simple-bus";
259 @@ -181,7 +183,7 @@
260 &usdhc2 { /* module slot */
261 pinctrl-names = "default";
262 pinctrl-0 = <&pinctrl_usdhc2>;
263 - cd-gpios = <&gpio2 2 0>;
264 + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
265 status = "okay";
266 };
267
268 diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
269 index b5756c21ea1d..4493f6e99330 100644
270 --- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
271 +++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
272 @@ -318,7 +318,7 @@
273 &usdhc3 {
274 pinctrl-names = "default";
275 pinctrl-0 = <&pinctrl_usdhc3>;
276 - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
277 + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
278 vmmc-supply = <&reg_3p3v>;
279 status = "okay";
280 };
281 diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
282 index 86f03c1b147c..a857d1294609 100644
283 --- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
284 +++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
285 @@ -324,7 +324,7 @@
286 &usdhc3 {
287 pinctrl-names = "default";
288 pinctrl-0 = <&pinctrl_usdhc3>;
289 - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
290 + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
291 vmmc-supply = <&reg_3p3v>;
292 status = "okay";
293 };
294 diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
295 index 4a8d97f47759..1afe3385e2d2 100644
296 --- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
297 +++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
298 @@ -417,7 +417,7 @@
299 &usdhc3 {
300 pinctrl-names = "default";
301 pinctrl-0 = <&pinctrl_usdhc3>;
302 - cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
303 + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
304 vmmc-supply = <&reg_3p3v>;
305 status = "okay";
306 };
307 diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi
308 index 151a3db2aea9..c6833d2b4ff5 100644
309 --- a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi
310 +++ b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi
311 @@ -41,6 +41,7 @@
312 */
313 #include "imx6qdl-microsom.dtsi"
314 #include "imx6qdl-microsom-ar8035.dtsi"
315 +#include <dt-bindings/gpio/gpio.h>
316
317 / {
318 chosen {
319 @@ -288,6 +289,6 @@
320 &pinctrl_hummingboard_usdhc2
321 >;
322 vmmc-supply = <&reg_3p3v>;
323 - cd-gpios = <&gpio1 4 0>;
324 + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
325 status = "okay";
326 };
327 diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
328 index 08218120e770..64e0b6178bf4 100644
329 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
330 +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
331 @@ -449,7 +449,7 @@
332 &usdhc3 {
333 pinctrl-names = "default";
334 pinctrl-0 = <&pinctrl_usdhc3>;
335 - cd-gpios = <&gpio7 0 0>;
336 + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
337 vmmc-supply = <&reg_3p3v>;
338 status = "okay";
339 };
340 @@ -457,7 +457,7 @@
341 &usdhc4 {
342 pinctrl-names = "default";
343 pinctrl-0 = <&pinctrl_usdhc4>;
344 - cd-gpios = <&gpio2 6 0>;
345 + cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
346 vmmc-supply = <&reg_3p3v>;
347 status = "okay";
348 };
349 diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
350 index 1ce6133b67f5..9e6ecd99b472 100644
351 --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
352 +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
353 @@ -409,8 +409,8 @@
354 &usdhc2 {
355 pinctrl-names = "default";
356 pinctrl-0 = <&pinctrl_usdhc2>;
357 - cd-gpios = <&gpio1 4 0>;
358 - wp-gpios = <&gpio1 2 0>;
359 + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
360 + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
361 status = "disabled";
362 };
363
364 @@ -418,7 +418,7 @@
365 pinctrl-names = "default";
366 pinctrl-0 = <&pinctrl_usdhc3
367 &pinctrl_usdhc3_cdwp>;
368 - cd-gpios = <&gpio1 27 0>;
369 - wp-gpios = <&gpio1 29 0>;
370 + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
371 + wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
372 status = "disabled";
373 };
374 diff --git a/arch/arm/boot/dts/imx6qdl-rex.dtsi b/arch/arm/boot/dts/imx6qdl-rex.dtsi
375 index 394a4ace351a..a50356243888 100644
376 --- a/arch/arm/boot/dts/imx6qdl-rex.dtsi
377 +++ b/arch/arm/boot/dts/imx6qdl-rex.dtsi
378 @@ -340,7 +340,7 @@
379 pinctrl-0 = <&pinctrl_usdhc2>;
380 bus-width = <4>;
381 cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
382 - wp-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
383 + wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
384 status = "okay";
385 };
386
387 @@ -349,6 +349,6 @@
388 pinctrl-0 = <&pinctrl_usdhc3>;
389 bus-width = <4>;
390 cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
391 - wp-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
392 + wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
393 status = "okay";
394 };
395 diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
396 index 3b24b12651b2..e329ca5c3322 100644
397 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
398 +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
399 @@ -467,8 +467,8 @@
400 pinctrl-0 = <&pinctrl_usdhc3>;
401 pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
402 pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
403 - cd-gpios = <&gpio6 15 0>;
404 - wp-gpios = <&gpio1 13 0>;
405 + cd-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>;
406 + wp-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
407 status = "okay";
408 };
409
410 diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
411 index 0b28a9d5241e..1e27485e4293 100644
412 --- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
413 +++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
414 @@ -444,8 +444,8 @@
415 &usdhc3 {
416 pinctrl-names = "default";
417 pinctrl-0 = <&pinctrl_usdhc3>;
418 - cd-gpios = <&gpio7 0 0>;
419 - wp-gpios = <&gpio7 1 0>;
420 + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
421 + wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
422 vmmc-supply = <&reg_3p3v>;
423 status = "okay";
424 };
425 @@ -453,7 +453,7 @@
426 &usdhc4 {
427 pinctrl-names = "default";
428 pinctrl-0 = <&pinctrl_usdhc4>;
429 - cd-gpios = <&gpio2 6 0>;
430 + cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
431 vmmc-supply = <&reg_3p3v>;
432 status = "okay";
433 };
434 diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
435 index a626e6dd8022..944eb81cb2b8 100644
436 --- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
437 +++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
438 @@ -562,8 +562,8 @@
439 pinctrl-names = "default";
440 pinctrl-0 = <&pinctrl_usdhc2>;
441 bus-width = <8>;
442 - cd-gpios = <&gpio2 2 0>;
443 - wp-gpios = <&gpio2 3 0>;
444 + cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
445 + wp-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
446 status = "okay";
447 };
448
449 @@ -571,8 +571,8 @@
450 pinctrl-names = "default";
451 pinctrl-0 = <&pinctrl_usdhc3>;
452 bus-width = <8>;
453 - cd-gpios = <&gpio2 0 0>;
454 - wp-gpios = <&gpio2 1 0>;
455 + cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
456 + wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
457 status = "okay";
458 };
459
460 diff --git a/arch/arm/boot/dts/imx6qdl-tx6.dtsi b/arch/arm/boot/dts/imx6qdl-tx6.dtsi
461 index f02b80b41d4f..da08de324e9e 100644
462 --- a/arch/arm/boot/dts/imx6qdl-tx6.dtsi
463 +++ b/arch/arm/boot/dts/imx6qdl-tx6.dtsi
464 @@ -680,7 +680,7 @@
465 pinctrl-0 = <&pinctrl_usdhc1>;
466 bus-width = <4>;
467 no-1-8-v;
468 - cd-gpios = <&gpio7 2 0>;
469 + cd-gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
470 fsl,wp-controller;
471 status = "okay";
472 };
473 @@ -690,7 +690,7 @@
474 pinctrl-0 = <&pinctrl_usdhc2>;
475 bus-width = <4>;
476 no-1-8-v;
477 - cd-gpios = <&gpio7 3 0>;
478 + cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
479 fsl,wp-controller;
480 status = "okay";
481 };
482 diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
483 index 5fb091675582..9e096d811bed 100644
484 --- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
485 +++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
486 @@ -9,6 +9,8 @@
487 *
488 */
489
490 +#include <dt-bindings/gpio/gpio.h>
491 +
492 / {
493 regulators {
494 compatible = "simple-bus";
495 @@ -250,13 +252,13 @@
496 &usdhc1 {
497 pinctrl-names = "default";
498 pinctrl-0 = <&pinctrl_usdhc1>;
499 - cd-gpios = <&gpio1 2 0>;
500 + cd-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
501 status = "okay";
502 };
503
504 &usdhc3 {
505 pinctrl-names = "default";
506 pinctrl-0 = <&pinctrl_usdhc3>;
507 - cd-gpios = <&gpio3 9 0>;
508 + cd-gpios = <&gpio3 9 GPIO_ACTIVE_LOW>;
509 status = "okay";
510 };
511 diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
512 index 945887d3fdb3..b84dff2e94ea 100644
513 --- a/arch/arm/boot/dts/imx6sl-evk.dts
514 +++ b/arch/arm/boot/dts/imx6sl-evk.dts
515 @@ -617,8 +617,8 @@
516 pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
517 pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
518 bus-width = <8>;
519 - cd-gpios = <&gpio4 7 0>;
520 - wp-gpios = <&gpio4 6 0>;
521 + cd-gpios = <&gpio4 7 GPIO_ACTIVE_LOW>;
522 + wp-gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>;
523 status = "okay";
524 };
525
526 @@ -627,8 +627,8 @@
527 pinctrl-0 = <&pinctrl_usdhc2>;
528 pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
529 pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
530 - cd-gpios = <&gpio5 0 0>;
531 - wp-gpios = <&gpio4 29 0>;
532 + cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
533 + wp-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
534 status = "okay";
535 };
536
537 @@ -637,6 +637,6 @@
538 pinctrl-0 = <&pinctrl_usdhc3>;
539 pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
540 pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
541 - cd-gpios = <&gpio3 22 0>;
542 + cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>;
543 status = "okay";
544 };
545 diff --git a/arch/arm/boot/dts/imx6sx-sabreauto.dts b/arch/arm/boot/dts/imx6sx-sabreauto.dts
546 index e3c0b63c2205..115f3fd78971 100644
547 --- a/arch/arm/boot/dts/imx6sx-sabreauto.dts
548 +++ b/arch/arm/boot/dts/imx6sx-sabreauto.dts
549 @@ -49,7 +49,7 @@
550 pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
551 pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
552 bus-width = <8>;
553 - cd-gpios = <&gpio7 10 GPIO_ACTIVE_HIGH>;
554 + cd-gpios = <&gpio7 10 GPIO_ACTIVE_LOW>;
555 wp-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
556 keep-power-in-suspend;
557 enable-sdio-wakeup;
558 @@ -61,7 +61,7 @@
559 pinctrl-names = "default";
560 pinctrl-0 = <&pinctrl_usdhc4>;
561 bus-width = <8>;
562 - cd-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>;
563 + cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>;
564 no-1-8-v;
565 keep-power-in-suspend;
566 enable-sdio-wakup;
567 diff --git a/arch/arm/boot/dts/imx6sx-sdb.dtsi b/arch/arm/boot/dts/imx6sx-sdb.dtsi
568 index cef04cef3a80..ac88c3467078 100644
569 --- a/arch/arm/boot/dts/imx6sx-sdb.dtsi
570 +++ b/arch/arm/boot/dts/imx6sx-sdb.dtsi
571 @@ -293,7 +293,7 @@
572 pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
573 pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
574 bus-width = <8>;
575 - cd-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
576 + cd-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
577 wp-gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>;
578 keep-power-in-suspend;
579 enable-sdio-wakeup;
580 @@ -304,7 +304,7 @@
581 &usdhc4 {
582 pinctrl-names = "default";
583 pinctrl-0 = <&pinctrl_usdhc4>;
584 - cd-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>;
585 + cd-gpios = <&gpio6 21 GPIO_ACTIVE_LOW>;
586 wp-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>;
587 status = "okay";
588 };
589 diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
590 index 2b4847c7cbd4..fa36571b755a 100644
591 --- a/arch/arm/boot/dts/sun7i-a20.dtsi
592 +++ b/arch/arm/boot/dts/sun7i-a20.dtsi
593 @@ -111,7 +111,7 @@
594 720000 1200000
595 528000 1100000
596 312000 1000000
597 - 144000 900000
598 + 144000 1000000
599 >;
600 #cooling-cells = <2>;
601 cooling-min-level = <0>;
602 diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
603 index f1f79d104309..60c1a0f4d67a 100644
604 --- a/arch/arm/kvm/Kconfig
605 +++ b/arch/arm/kvm/Kconfig
606 @@ -21,6 +21,7 @@ config KVM
607 depends on MMU && OF
608 select PREEMPT_NOTIFIERS
609 select ANON_INODES
610 + select ARM_GIC
611 select HAVE_KVM_CPU_RELAX_INTERCEPT
612 select HAVE_KVM_ARCH_TLB_FLUSH_ALL
613 select KVM_MMIO
614 diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
615 index f5b00f41c4f6..b8b6e22f9987 100644
616 --- a/arch/arm/plat-orion/common.c
617 +++ b/arch/arm/plat-orion/common.c
618 @@ -499,7 +499,7 @@ void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
619
620 d->netdev = &orion_ge00.dev;
621 for (i = 0; i < d->nr_chips; i++)
622 - d->chip[i].host_dev = &orion_ge00_shared.dev;
623 + d->chip[i].host_dev = &orion_ge_mvmdio.dev;
624 orion_switch_device.dev.platform_data = d;
625
626 platform_device_register(&orion_switch_device);
627 diff --git a/arch/arm/vdso/vdsomunge.c b/arch/arm/vdso/vdsomunge.c
628 index aedec81d1198..f6455273b2f8 100644
629 --- a/arch/arm/vdso/vdsomunge.c
630 +++ b/arch/arm/vdso/vdsomunge.c
631 @@ -45,7 +45,6 @@
632 * it does.
633 */
634
635 -#include <byteswap.h>
636 #include <elf.h>
637 #include <errno.h>
638 #include <fcntl.h>
639 @@ -59,6 +58,16 @@
640 #include <sys/types.h>
641 #include <unistd.h>
642
643 +#define swab16(x) \
644 + ((((x) & 0x00ff) << 8) | \
645 + (((x) & 0xff00) >> 8))
646 +
647 +#define swab32(x) \
648 + ((((x) & 0x000000ff) << 24) | \
649 + (((x) & 0x0000ff00) << 8) | \
650 + (((x) & 0x00ff0000) >> 8) | \
651 + (((x) & 0xff000000) >> 24))
652 +
653 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
654 #define HOST_ORDER ELFDATA2LSB
655 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
656 @@ -104,17 +113,17 @@ static void cleanup(void)
657
658 static Elf32_Word read_elf_word(Elf32_Word word, bool swap)
659 {
660 - return swap ? bswap_32(word) : word;
661 + return swap ? swab32(word) : word;
662 }
663
664 static Elf32_Half read_elf_half(Elf32_Half half, bool swap)
665 {
666 - return swap ? bswap_16(half) : half;
667 + return swap ? swab16(half) : half;
668 }
669
670 static void write_elf_word(Elf32_Word val, Elf32_Word *dst, bool swap)
671 {
672 - *dst = swap ? bswap_32(val) : val;
673 + *dst = swap ? swab32(val) : val;
674 }
675
676 int main(int argc, char **argv)
677 diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
678 index 141b2fcabaa6..0f74f05d662a 100644
679 --- a/arch/arm64/include/asm/cpuidle.h
680 +++ b/arch/arm64/include/asm/cpuidle.h
681 @@ -5,20 +5,16 @@
682
683 #ifdef CONFIG_CPU_IDLE
684 extern int arm_cpuidle_init(unsigned int cpu);
685 -extern int cpu_suspend(unsigned long arg);
686 +extern int arm_cpuidle_suspend(int index);
687 #else
688 static inline int arm_cpuidle_init(unsigned int cpu)
689 {
690 return -EOPNOTSUPP;
691 }
692
693 -static inline int cpu_suspend(unsigned long arg)
694 +static inline int arm_cpuidle_suspend(int index)
695 {
696 return -EOPNOTSUPP;
697 }
698 #endif
699 -static inline int arm_cpuidle_suspend(int index)
700 -{
701 - return cpu_suspend(index);
702 -}
703 #endif
704 diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h
705 index 003802f58963..59a5b0f1e81c 100644
706 --- a/arch/arm64/include/asm/suspend.h
707 +++ b/arch/arm64/include/asm/suspend.h
708 @@ -21,6 +21,6 @@ struct sleep_save_sp {
709 phys_addr_t save_ptr_stash_phys;
710 };
711
712 -extern int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
713 +extern int cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
714 extern void cpu_resume(void);
715 #endif
716 diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
717 index 7922c2e710ca..7ac3920b1356 100644
718 --- a/arch/arm64/kernel/armv8_deprecated.c
719 +++ b/arch/arm64/kernel/armv8_deprecated.c
720 @@ -279,22 +279,24 @@ static void register_insn_emulation_sysctl(struct ctl_table *table)
721 */
722 #define __user_swpX_asm(data, addr, res, temp, B) \
723 __asm__ __volatile__( \
724 - " mov %w2, %w1\n" \
725 - "0: ldxr"B" %w1, [%3]\n" \
726 - "1: stxr"B" %w0, %w2, [%3]\n" \
727 + "0: ldxr"B" %w2, [%3]\n" \
728 + "1: stxr"B" %w0, %w1, [%3]\n" \
729 " cbz %w0, 2f\n" \
730 " mov %w0, %w4\n" \
731 + " b 3f\n" \
732 "2:\n" \
733 + " mov %w1, %w2\n" \
734 + "3:\n" \
735 " .pushsection .fixup,\"ax\"\n" \
736 " .align 2\n" \
737 - "3: mov %w0, %w5\n" \
738 - " b 2b\n" \
739 + "4: mov %w0, %w5\n" \
740 + " b 3b\n" \
741 " .popsection" \
742 " .pushsection __ex_table,\"a\"\n" \
743 " .align 3\n" \
744 - " .quad 0b, 3b\n" \
745 - " .quad 1b, 3b\n" \
746 - " .popsection" \
747 + " .quad 0b, 4b\n" \
748 + " .quad 1b, 4b\n" \
749 + " .popsection\n" \
750 : "=&r" (res), "+r" (data), "=&r" (temp) \
751 : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT) \
752 : "memory")
753 diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c
754 index a78143a5c99f..2bbd0fee084f 100644
755 --- a/arch/arm64/kernel/cpuidle.c
756 +++ b/arch/arm64/kernel/cpuidle.c
757 @@ -37,7 +37,7 @@ int arm_cpuidle_init(unsigned int cpu)
758 * Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU
759 * operations back-end error code otherwise.
760 */
761 -int cpu_suspend(unsigned long arg)
762 +int arm_cpuidle_suspend(int index)
763 {
764 int cpu = smp_processor_id();
765
766 @@ -47,5 +47,5 @@ int cpu_suspend(unsigned long arg)
767 */
768 if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_suspend)
769 return -EOPNOTSUPP;
770 - return cpu_ops[cpu]->cpu_suspend(arg);
771 + return cpu_ops[cpu]->cpu_suspend(index);
772 }
773 diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
774 index ea18cb53921e..24d4733b7e3c 100644
775 --- a/arch/arm64/kernel/psci.c
776 +++ b/arch/arm64/kernel/psci.c
777 @@ -546,7 +546,7 @@ static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
778 if (state[index - 1].type == PSCI_POWER_STATE_TYPE_STANDBY)
779 ret = psci_ops.cpu_suspend(state[index - 1], 0);
780 else
781 - ret = __cpu_suspend(index, psci_suspend_finisher);
782 + ret = cpu_suspend(index, psci_suspend_finisher);
783
784 return ret;
785 }
786 diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
787 index 407991bf79f5..ccb6078ed9f2 100644
788 --- a/arch/arm64/kernel/stacktrace.c
789 +++ b/arch/arm64/kernel/stacktrace.c
790 @@ -48,11 +48,7 @@ int notrace unwind_frame(struct stackframe *frame)
791
792 frame->sp = fp + 0x10;
793 frame->fp = *(unsigned long *)(fp);
794 - /*
795 - * -4 here because we care about the PC at time of bl,
796 - * not where the return will go.
797 - */
798 - frame->pc = *(unsigned long *)(fp + 8) - 4;
799 + frame->pc = *(unsigned long *)(fp + 8);
800
801 return 0;
802 }
803 diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
804 index d7daf45ae7a2..53f1f8dccf6c 100644
805 --- a/arch/arm64/kernel/suspend.c
806 +++ b/arch/arm64/kernel/suspend.c
807 @@ -51,13 +51,13 @@ void __init cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *))
808 }
809
810 /*
811 - * __cpu_suspend
812 + * cpu_suspend
813 *
814 * arg: argument to pass to the finisher function
815 * fn: finisher function pointer
816 *
817 */
818 -int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
819 +int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
820 {
821 struct mm_struct *mm = current->active_mm;
822 int ret;
823 @@ -80,17 +80,21 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
824 if (ret == 0) {
825 /*
826 * We are resuming from reset with TTBR0_EL1 set to the
827 - * idmap to enable the MMU; restore the active_mm mappings in
828 - * TTBR0_EL1 unless the active_mm == &init_mm, in which case
829 - * the thread entered __cpu_suspend with TTBR0_EL1 set to
830 - * reserved TTBR0 page tables and should be restored as such.
831 + * idmap to enable the MMU; set the TTBR0 to the reserved
832 + * page tables to prevent speculative TLB allocations, flush
833 + * the local tlb and set the default tcr_el1.t0sz so that
834 + * the TTBR0 address space set-up is properly restored.
835 + * If the current active_mm != &init_mm we entered cpu_suspend
836 + * with mappings in TTBR0 that must be restored, so we switch
837 + * them back to complete the address space configuration
838 + * restoration before returning.
839 */
840 - if (mm == &init_mm)
841 - cpu_set_reserved_ttbr0();
842 - else
843 - cpu_switch_mm(mm->pgd, mm);
844 -
845 + cpu_set_reserved_ttbr0();
846 flush_tlb_all();
847 + cpu_set_default_tcr_t0sz();
848 +
849 + if (mm != &init_mm)
850 + cpu_switch_mm(mm->pgd, mm);
851
852 /*
853 * Restore per-cpu offset before any kernel
854 diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
855 index caffb10e7aa3..5607693f35cf 100644
856 --- a/arch/powerpc/kernel/rtas.c
857 +++ b/arch/powerpc/kernel/rtas.c
858 @@ -1041,6 +1041,9 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
859 if (!capable(CAP_SYS_ADMIN))
860 return -EPERM;
861
862 + if (!rtas.entry)
863 + return -EINVAL;
864 +
865 if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
866 return -EFAULT;
867
868 diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
869 index 0cdc154a22b5..4c3f76b425c1 100644
870 --- a/arch/x86/boot/compressed/eboot.c
871 +++ b/arch/x86/boot/compressed/eboot.c
872 @@ -667,6 +667,7 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,
873 bool conout_found = false;
874 void *dummy = NULL;
875 u32 h = handles[i];
876 + u32 current_fb_base;
877
878 status = efi_call_early(handle_protocol, h,
879 proto, (void **)&gop32);
880 @@ -678,7 +679,7 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,
881 if (status == EFI_SUCCESS)
882 conout_found = true;
883
884 - status = __gop_query32(gop32, &info, &size, &fb_base);
885 + status = __gop_query32(gop32, &info, &size, &current_fb_base);
886 if (status == EFI_SUCCESS && (!first_gop || conout_found)) {
887 /*
888 * Systems that use the UEFI Console Splitter may
889 @@ -692,6 +693,7 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,
890 pixel_format = info->pixel_format;
891 pixel_info = info->pixel_information;
892 pixels_per_scan_line = info->pixels_per_scan_line;
893 + fb_base = current_fb_base;
894
895 /*
896 * Once we've found a GOP supporting ConOut,
897 @@ -770,6 +772,7 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto,
898 bool conout_found = false;
899 void *dummy = NULL;
900 u64 h = handles[i];
901 + u32 current_fb_base;
902
903 status = efi_call_early(handle_protocol, h,
904 proto, (void **)&gop64);
905 @@ -781,7 +784,7 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto,
906 if (status == EFI_SUCCESS)
907 conout_found = true;
908
909 - status = __gop_query64(gop64, &info, &size, &fb_base);
910 + status = __gop_query64(gop64, &info, &size, &current_fb_base);
911 if (status == EFI_SUCCESS && (!first_gop || conout_found)) {
912 /*
913 * Systems that use the UEFI Console Splitter may
914 @@ -795,6 +798,7 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto,
915 pixel_format = info->pixel_format;
916 pixel_info = info->pixel_information;
917 pixels_per_scan_line = info->pixels_per_scan_line;
918 + fb_base = current_fb_base;
919
920 /*
921 * Once we've found a GOP supporting ConOut,
922 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
923 index 0cc657160cb6..a10ed8915bf4 100644
924 --- a/arch/x86/xen/enlighten.c
925 +++ b/arch/x86/xen/enlighten.c
926 @@ -33,7 +33,7 @@
927 #include <linux/memblock.h>
928 #include <linux/edd.h>
929
930 -#ifdef CONFIG_KEXEC_CORE
931 +#ifdef CONFIG_KEXEC
932 #include <linux/kexec.h>
933 #endif
934
935 @@ -1802,7 +1802,7 @@ static struct notifier_block xen_hvm_cpu_notifier = {
936 .notifier_call = xen_hvm_cpu_notify,
937 };
938
939 -#ifdef CONFIG_KEXEC_CORE
940 +#ifdef CONFIG_KEXEC
941 static void xen_hvm_shutdown(void)
942 {
943 native_machine_shutdown();
944 @@ -1836,7 +1836,7 @@ static void __init xen_hvm_guest_init(void)
945 x86_init.irqs.intr_init = xen_init_IRQ;
946 xen_hvm_init_time_ops();
947 xen_hvm_init_mmu_ops();
948 -#ifdef CONFIG_KEXEC_CORE
949 +#ifdef CONFIG_KEXEC
950 machine_ops.shutdown = xen_hvm_shutdown;
951 machine_ops.crash_shutdown = xen_hvm_crash_shutdown;
952 #endif
953 diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
954 index db201bca1581..523dd10e1751 100644
955 --- a/crypto/ablkcipher.c
956 +++ b/crypto/ablkcipher.c
957 @@ -698,7 +698,7 @@ struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
958 err:
959 if (err != -EAGAIN)
960 break;
961 - if (signal_pending(current)) {
962 + if (fatal_signal_pending(current)) {
963 err = -EINTR;
964 break;
965 }
966 diff --git a/crypto/algapi.c b/crypto/algapi.c
967 index d2627a3d4ed8..dda720c6ab08 100644
968 --- a/crypto/algapi.c
969 +++ b/crypto/algapi.c
970 @@ -337,7 +337,7 @@ static void crypto_wait_for_test(struct crypto_larval *larval)
971 crypto_alg_tested(larval->alg.cra_driver_name, 0);
972 }
973
974 - err = wait_for_completion_interruptible(&larval->completion);
975 + err = wait_for_completion_killable(&larval->completion);
976 WARN_ON(err);
977
978 out:
979 diff --git a/crypto/api.c b/crypto/api.c
980 index afe4610afc4b..bbc147cb5dec 100644
981 --- a/crypto/api.c
982 +++ b/crypto/api.c
983 @@ -172,7 +172,7 @@ static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
984 struct crypto_larval *larval = (void *)alg;
985 long timeout;
986
987 - timeout = wait_for_completion_interruptible_timeout(
988 + timeout = wait_for_completion_killable_timeout(
989 &larval->completion, 60 * HZ);
990
991 alg = larval->adult;
992 @@ -445,7 +445,7 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
993 err:
994 if (err != -EAGAIN)
995 break;
996 - if (signal_pending(current)) {
997 + if (fatal_signal_pending(current)) {
998 err = -EINTR;
999 break;
1000 }
1001 @@ -562,7 +562,7 @@ void *crypto_alloc_tfm(const char *alg_name,
1002 err:
1003 if (err != -EAGAIN)
1004 break;
1005 - if (signal_pending(current)) {
1006 + if (fatal_signal_pending(current)) {
1007 err = -EINTR;
1008 break;
1009 }
1010 diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
1011 index 41dfe762b7fb..edf2e3ea1740 100644
1012 --- a/crypto/crypto_user.c
1013 +++ b/crypto/crypto_user.c
1014 @@ -381,7 +381,7 @@ static struct crypto_alg *crypto_user_aead_alg(const char *name, u32 type,
1015 err = PTR_ERR(alg);
1016 if (err != -EAGAIN)
1017 break;
1018 - if (signal_pending(current)) {
1019 + if (fatal_signal_pending(current)) {
1020 err = -EINTR;
1021 break;
1022 }
1023 diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
1024 index 683dff272562..04c0e8f3183c 100644
1025 --- a/drivers/block/nvme-core.c
1026 +++ b/drivers/block/nvme-core.c
1027 @@ -590,6 +590,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
1028 struct nvme_iod *iod = ctx;
1029 struct request *req = iod_get_private(iod);
1030 struct nvme_cmd_info *cmd_rq = blk_mq_rq_to_pdu(req);
1031 + bool requeue = false;
1032
1033 u16 status = le16_to_cpup(&cqe->status) >> 1;
1034
1035 @@ -598,12 +599,13 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
1036 && (jiffies - req->start_time) < req->timeout) {
1037 unsigned long flags;
1038
1039 + requeue = true;
1040 blk_mq_requeue_request(req);
1041 spin_lock_irqsave(req->q->queue_lock, flags);
1042 if (!blk_queue_stopped(req->q))
1043 blk_mq_kick_requeue_list(req->q);
1044 spin_unlock_irqrestore(req->q->queue_lock, flags);
1045 - return;
1046 + goto release_iod;
1047 }
1048 req->errors = nvme_error_status(status);
1049 } else
1050 @@ -613,7 +615,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
1051 dev_warn(&nvmeq->dev->pci_dev->dev,
1052 "completing aborted command with status:%04x\n",
1053 status);
1054 -
1055 + release_iod:
1056 if (iod->nents) {
1057 dma_unmap_sg(&nvmeq->dev->pci_dev->dev, iod->sg, iod->nents,
1058 rq_data_dir(req) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1059 @@ -626,7 +628,8 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
1060 }
1061 nvme_free_iod(nvmeq->dev, iod);
1062
1063 - blk_mq_complete_request(req);
1064 + if (likely(!requeue))
1065 + blk_mq_complete_request(req);
1066 }
1067
1068 /* length is in bytes. gfp flags indicates whether we may sleep. */
1069 diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
1070 index fe8f1e4b4c7c..1ec6441fe2a5 100644
1071 --- a/drivers/block/rbd.c
1072 +++ b/drivers/block/rbd.c
1073 @@ -96,6 +96,8 @@ static int atomic_dec_return_safe(atomic_t *v)
1074 #define RBD_MINORS_PER_MAJOR 256
1075 #define RBD_SINGLE_MAJOR_PART_SHIFT 4
1076
1077 +#define RBD_MAX_PARENT_CHAIN_LEN 16
1078 +
1079 #define RBD_SNAP_DEV_NAME_PREFIX "snap_"
1080 #define RBD_MAX_SNAP_NAME_LEN \
1081 (NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1))
1082 @@ -425,7 +427,7 @@ static ssize_t rbd_add_single_major(struct bus_type *bus, const char *buf,
1083 size_t count);
1084 static ssize_t rbd_remove_single_major(struct bus_type *bus, const char *buf,
1085 size_t count);
1086 -static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping);
1087 +static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth);
1088 static void rbd_spec_put(struct rbd_spec *spec);
1089
1090 static int rbd_dev_id_to_minor(int dev_id)
1091 @@ -3797,6 +3799,9 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
1092 q->limits.discard_zeroes_data = 1;
1093
1094 blk_queue_merge_bvec(q, rbd_merge_bvec);
1095 + if (!ceph_test_opt(rbd_dev->rbd_client->client, NOCRC))
1096 + q->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES;
1097 +
1098 disk->queue = q;
1099
1100 q->queuedata = rbd_dev;
1101 @@ -5142,44 +5147,50 @@ out_err:
1102 return ret;
1103 }
1104
1105 -static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)
1106 +/*
1107 + * @depth is rbd_dev_image_probe() -> rbd_dev_probe_parent() ->
1108 + * rbd_dev_image_probe() recursion depth, which means it's also the
1109 + * length of the already discovered part of the parent chain.
1110 + */
1111 +static int rbd_dev_probe_parent(struct rbd_device *rbd_dev, int depth)
1112 {
1113 struct rbd_device *parent = NULL;
1114 - struct rbd_spec *parent_spec;
1115 - struct rbd_client *rbdc;
1116 int ret;
1117
1118 if (!rbd_dev->parent_spec)
1119 return 0;
1120 - /*
1121 - * We need to pass a reference to the client and the parent
1122 - * spec when creating the parent rbd_dev. Images related by
1123 - * parent/child relationships always share both.
1124 - */
1125 - parent_spec = rbd_spec_get(rbd_dev->parent_spec);
1126 - rbdc = __rbd_get_client(rbd_dev->rbd_client);
1127
1128 - ret = -ENOMEM;
1129 - parent = rbd_dev_create(rbdc, parent_spec);
1130 - if (!parent)
1131 + if (++depth > RBD_MAX_PARENT_CHAIN_LEN) {
1132 + pr_info("parent chain is too long (%d)\n", depth);
1133 + ret = -EINVAL;
1134 goto out_err;
1135 + }
1136
1137 - ret = rbd_dev_image_probe(parent, false);
1138 + parent = rbd_dev_create(rbd_dev->rbd_client, rbd_dev->parent_spec);
1139 + if (!parent) {
1140 + ret = -ENOMEM;
1141 + goto out_err;
1142 + }
1143 +
1144 + /*
1145 + * Images related by parent/child relationships always share
1146 + * rbd_client and spec/parent_spec, so bump their refcounts.
1147 + */
1148 + __rbd_get_client(rbd_dev->rbd_client);
1149 + rbd_spec_get(rbd_dev->parent_spec);
1150 +
1151 + ret = rbd_dev_image_probe(parent, depth);
1152 if (ret < 0)
1153 goto out_err;
1154 +
1155 rbd_dev->parent = parent;
1156 atomic_set(&rbd_dev->parent_ref, 1);
1157 -
1158 return 0;
1159 +
1160 out_err:
1161 - if (parent) {
1162 - rbd_dev_unparent(rbd_dev);
1163 + rbd_dev_unparent(rbd_dev);
1164 + if (parent)
1165 rbd_dev_destroy(parent);
1166 - } else {
1167 - rbd_put_client(rbdc);
1168 - rbd_spec_put(parent_spec);
1169 - }
1170 -
1171 return ret;
1172 }
1173
1174 @@ -5297,7 +5308,7 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev)
1175 * parent), initiate a watch on its header object before using that
1176 * object to get detailed information about the rbd image.
1177 */
1178 -static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
1179 +static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
1180 {
1181 int ret;
1182
1183 @@ -5315,7 +5326,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
1184 if (ret)
1185 goto err_out_format;
1186
1187 - if (mapping) {
1188 + if (!depth) {
1189 ret = rbd_dev_header_watch_sync(rbd_dev);
1190 if (ret) {
1191 if (ret == -ENOENT)
1192 @@ -5336,7 +5347,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
1193 * Otherwise this is a parent image, identified by pool, image
1194 * and snap ids - need to fill in names for those ids.
1195 */
1196 - if (mapping)
1197 + if (!depth)
1198 ret = rbd_spec_fill_snap_id(rbd_dev);
1199 else
1200 ret = rbd_spec_fill_names(rbd_dev);
1201 @@ -5358,12 +5369,12 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
1202 * Need to warn users if this image is the one being
1203 * mapped and has a parent.
1204 */
1205 - if (mapping && rbd_dev->parent_spec)
1206 + if (!depth && rbd_dev->parent_spec)
1207 rbd_warn(rbd_dev,
1208 "WARNING: kernel layering is EXPERIMENTAL!");
1209 }
1210
1211 - ret = rbd_dev_probe_parent(rbd_dev);
1212 + ret = rbd_dev_probe_parent(rbd_dev, depth);
1213 if (ret)
1214 goto err_out_probe;
1215
1216 @@ -5374,7 +5385,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
1217 err_out_probe:
1218 rbd_dev_unprobe(rbd_dev);
1219 err_out_watch:
1220 - if (mapping)
1221 + if (!depth)
1222 rbd_dev_header_unwatch_sync(rbd_dev);
1223 out_header_name:
1224 kfree(rbd_dev->header_name);
1225 @@ -5439,7 +5450,7 @@ static ssize_t do_rbd_add(struct bus_type *bus,
1226 rbdc = NULL; /* rbd_dev now owns this */
1227 spec = NULL; /* rbd_dev now owns this */
1228
1229 - rc = rbd_dev_image_probe(rbd_dev, true);
1230 + rc = rbd_dev_image_probe(rbd_dev, 0);
1231 if (rc < 0)
1232 goto err_out_rbd_dev;
1233
1234 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
1235 index 89c7371ab2dc..42ef86c409b6 100644
1236 --- a/drivers/block/xen-blkfront.c
1237 +++ b/drivers/block/xen-blkfront.c
1238 @@ -1925,7 +1925,8 @@ static void blkback_changed(struct xenbus_device *dev,
1239 break;
1240 /* Missed the backend's Closing state -- fallthrough */
1241 case XenbusStateClosing:
1242 - blkfront_closing(info);
1243 + if (info)
1244 + blkfront_closing(info);
1245 break;
1246 }
1247 }
1248 diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
1249 index e8d16997c5cb..1ee2ab58e37d 100644
1250 --- a/drivers/cpufreq/intel_pstate.c
1251 +++ b/drivers/cpufreq/intel_pstate.c
1252 @@ -761,6 +761,11 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
1253 local_irq_save(flags);
1254 rdmsrl(MSR_IA32_APERF, aperf);
1255 rdmsrl(MSR_IA32_MPERF, mperf);
1256 + if (cpu->prev_mperf == mperf) {
1257 + local_irq_restore(flags);
1258 + return;
1259 + }
1260 +
1261 local_irq_restore(flags);
1262
1263 cpu->last_sample_time = cpu->sample.time;
1264 diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
1265 index 1acf57ba4c86..cd6b9c72c8ac 100644
1266 --- a/drivers/edac/sb_edac.c
1267 +++ b/drivers/edac/sb_edac.c
1268 @@ -1608,6 +1608,7 @@ static int sbridge_mci_bind_devs(struct mem_ctl_info *mci,
1269 {
1270 struct sbridge_pvt *pvt = mci->pvt_info;
1271 struct pci_dev *pdev;
1272 + u8 saw_chan_mask = 0;
1273 int i;
1274
1275 for (i = 0; i < sbridge_dev->n_devs; i++) {
1276 @@ -1641,6 +1642,7 @@ static int sbridge_mci_bind_devs(struct mem_ctl_info *mci,
1277 {
1278 int id = pdev->device - PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0;
1279 pvt->pci_tad[id] = pdev;
1280 + saw_chan_mask |= 1 << id;
1281 }
1282 break;
1283 case PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_DDRIO:
1284 @@ -1661,10 +1663,8 @@ static int sbridge_mci_bind_devs(struct mem_ctl_info *mci,
1285 !pvt-> pci_tad || !pvt->pci_ras || !pvt->pci_ta)
1286 goto enodev;
1287
1288 - for (i = 0; i < NUM_CHANNELS; i++) {
1289 - if (!pvt->pci_tad[i])
1290 - goto enodev;
1291 - }
1292 + if (saw_chan_mask != 0x0f)
1293 + goto enodev;
1294 return 0;
1295
1296 enodev:
1297 diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
1298 index 2a2eb96caeda..109e776345d3 100644
1299 --- a/drivers/gpu/drm/drm_dp_mst_topology.c
1300 +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
1301 @@ -1179,17 +1179,18 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
1302
1303 list_for_each_entry(port, &mstb->ports, next) {
1304 if (port->port_num == port_num) {
1305 - if (!port->mstb) {
1306 + mstb = port->mstb;
1307 + if (!mstb) {
1308 DRM_ERROR("failed to lookup MSTB with lct %d, rad %02x\n", lct, rad[0]);
1309 - return NULL;
1310 + goto out;
1311 }
1312
1313 - mstb = port->mstb;
1314 break;
1315 }
1316 }
1317 }
1318 kref_get(&mstb->kref);
1319 +out:
1320 mutex_unlock(&mgr->lock);
1321 return mstb;
1322 }
1323 diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
1324 index 1719078c763a..ce175d05260b 100644
1325 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
1326 +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
1327 @@ -776,7 +776,10 @@ static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = {
1328 * Also note, that the object created here is not currently a "first class"
1329 * object, in that several ioctls are banned. These are the CPU access
1330 * ioctls: mmap(), pwrite and pread. In practice, you are expected to use
1331 - * direct access via your pointer rather than use those ioctls.
1332 + * direct access via your pointer rather than use those ioctls. Another
1333 + * restriction is that we do not allow userptr surfaces to be pinned to the
1334 + * hardware and so we reject any attempt to create a framebuffer out of a
1335 + * userptr.
1336 *
1337 * If you think this is a good interface to use to pass GPU memory between
1338 * drivers, please use dma-buf instead. In fact, wherever possible use
1339 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1340 index f208bbc6d58e..7b27a114b030 100644
1341 --- a/drivers/gpu/drm/i915/intel_display.c
1342 +++ b/drivers/gpu/drm/i915/intel_display.c
1343 @@ -1699,6 +1699,8 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
1344 I915_READ(DPLL(!crtc->pipe)) | DPLL_DVO_2X_MODE);
1345 }
1346
1347 + I915_WRITE(reg, dpll);
1348 +
1349 /* Wait for the clocks to stabilize. */
1350 POSTING_READ(reg);
1351 udelay(150);
1352 @@ -13212,6 +13214,11 @@ static int intel_user_framebuffer_create_handle(struct drm_framebuffer *fb,
1353 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
1354 struct drm_i915_gem_object *obj = intel_fb->obj;
1355
1356 + if (obj->userptr.mm) {
1357 + DRM_DEBUG("attempting to use a userptr for a framebuffer, denied\n");
1358 + return -EINVAL;
1359 + }
1360 +
1361 return drm_gem_handle_create(file, &obj->base, handle);
1362 }
1363
1364 diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
1365 index 9ab7c1c758ae..72f1bb8b0499 100644
1366 --- a/drivers/gpu/drm/i915/intel_lrc.c
1367 +++ b/drivers/gpu/drm/i915/intel_lrc.c
1368 @@ -1298,6 +1298,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
1369 if (flush_domains) {
1370 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;
1371 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;
1372 + flags |= PIPE_CONTROL_FLUSH_ENABLE;
1373 }
1374
1375 if (invalidate_domains) {
1376 diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
1377 index 005b5e04de4d..b7e20dee64c4 100644
1378 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
1379 +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
1380 @@ -342,6 +342,7 @@ gen7_render_ring_flush(struct intel_engine_cs *ring,
1381 if (flush_domains) {
1382 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;
1383 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;
1384 + flags |= PIPE_CONTROL_FLUSH_ENABLE;
1385 }
1386 if (invalidate_domains) {
1387 flags |= PIPE_CONTROL_TLB_INVALIDATE;
1388 @@ -412,6 +413,7 @@ gen8_render_ring_flush(struct intel_engine_cs *ring,
1389 if (flush_domains) {
1390 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;
1391 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;
1392 + flags |= PIPE_CONTROL_FLUSH_ENABLE;
1393 }
1394 if (invalidate_domains) {
1395 flags |= PIPE_CONTROL_TLB_INVALIDATE;
1396 diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
1397 index 0e690bf19fc9..58c959265b1a 100644
1398 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c
1399 +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
1400 @@ -227,11 +227,12 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem,
1401 struct nouveau_bo *nvbo = nouveau_gem_object(gem);
1402 struct nvkm_vma *vma;
1403
1404 - if (nvbo->bo.mem.mem_type == TTM_PL_TT)
1405 + if (is_power_of_2(nvbo->valid_domains))
1406 + rep->domain = nvbo->valid_domains;
1407 + else if (nvbo->bo.mem.mem_type == TTM_PL_TT)
1408 rep->domain = NOUVEAU_GEM_DOMAIN_GART;
1409 else
1410 rep->domain = NOUVEAU_GEM_DOMAIN_VRAM;
1411 -
1412 rep->offset = nvbo->bo.offset;
1413 if (cli->vm) {
1414 vma = nouveau_bo_vma_find(nvbo, cli->vm);
1415 diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
1416 index b4ff4c134fbb..5be50ef2b30e 100644
1417 --- a/drivers/gpu/drm/radeon/atombios_encoders.c
1418 +++ b/drivers/gpu/drm/radeon/atombios_encoders.c
1419 @@ -237,6 +237,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
1420 backlight_update_status(bd);
1421
1422 DRM_INFO("radeon atom DIG backlight initialized\n");
1423 + rdev->mode_info.bl_encoder = radeon_encoder;
1424
1425 return;
1426
1427 @@ -1624,9 +1625,14 @@ radeon_atom_encoder_dpms_avivo(struct drm_encoder *encoder, int mode)
1428 } else
1429 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
1430 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
1431 - struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1432 + if (rdev->mode_info.bl_encoder) {
1433 + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1434
1435 - atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
1436 + atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
1437 + } else {
1438 + args.ucAction = ATOM_LCD_BLON;
1439 + atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
1440 + }
1441 }
1442 break;
1443 case DRM_MODE_DPMS_STANDBY:
1444 @@ -1706,8 +1712,13 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
1445 if (ASIC_IS_DCE4(rdev))
1446 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
1447 }
1448 - if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
1449 - atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
1450 + if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
1451 + if (rdev->mode_info.bl_encoder)
1452 + atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
1453 + else
1454 + atombios_dig_transmitter_setup(encoder,
1455 + ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0);
1456 + }
1457 if (ext_encoder)
1458 atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE);
1459 break;
1460 diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
1461 index 46eb0fa75a61..91c3f60f8bac 100644
1462 --- a/drivers/gpu/drm/radeon/radeon.h
1463 +++ b/drivers/gpu/drm/radeon/radeon.h
1464 @@ -1656,6 +1656,7 @@ struct radeon_pm {
1465 u8 fan_max_rpm;
1466 /* dpm */
1467 bool dpm_enabled;
1468 + bool sysfs_initialized;
1469 struct radeon_dpm dpm;
1470 };
1471
1472 diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
1473 index ef99917f000d..c6ee80216cf4 100644
1474 --- a/drivers/gpu/drm/radeon/radeon_encoders.c
1475 +++ b/drivers/gpu/drm/radeon/radeon_encoders.c
1476 @@ -194,7 +194,6 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder,
1477 radeon_atom_backlight_init(radeon_encoder, connector);
1478 else
1479 radeon_legacy_backlight_init(radeon_encoder, connector);
1480 - rdev->mode_info.bl_encoder = radeon_encoder;
1481 }
1482 }
1483
1484 diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
1485 index 45715307db71..30de43366eae 100644
1486 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
1487 +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
1488 @@ -441,6 +441,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
1489 backlight_update_status(bd);
1490
1491 DRM_INFO("radeon legacy LVDS backlight initialized\n");
1492 + rdev->mode_info.bl_encoder = radeon_encoder;
1493
1494 return;
1495
1496 diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
1497 index 948c33105801..91764320c56f 100644
1498 --- a/drivers/gpu/drm/radeon/radeon_pm.c
1499 +++ b/drivers/gpu/drm/radeon/radeon_pm.c
1500 @@ -720,10 +720,14 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
1501 struct radeon_device *rdev = dev_get_drvdata(dev);
1502 umode_t effective_mode = attr->mode;
1503
1504 - /* Skip limit attributes if DPM is not enabled */
1505 + /* Skip attributes if DPM is not enabled */
1506 if (rdev->pm.pm_method != PM_METHOD_DPM &&
1507 (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||
1508 - attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr))
1509 + attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr ||
1510 + attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
1511 + attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
1512 + attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
1513 + attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
1514 return 0;
1515
1516 /* Skip fan attributes if fan is not present */
1517 @@ -1529,19 +1533,23 @@ int radeon_pm_late_init(struct radeon_device *rdev)
1518
1519 if (rdev->pm.pm_method == PM_METHOD_DPM) {
1520 if (rdev->pm.dpm_enabled) {
1521 - ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
1522 - if (ret)
1523 - DRM_ERROR("failed to create device file for dpm state\n");
1524 - ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
1525 - if (ret)
1526 - DRM_ERROR("failed to create device file for dpm state\n");
1527 - /* XXX: these are noops for dpm but are here for backwards compat */
1528 - ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1529 - if (ret)
1530 - DRM_ERROR("failed to create device file for power profile\n");
1531 - ret = device_create_file(rdev->dev, &dev_attr_power_method);
1532 - if (ret)
1533 - DRM_ERROR("failed to create device file for power method\n");
1534 + if (!rdev->pm.sysfs_initialized) {
1535 + ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
1536 + if (ret)
1537 + DRM_ERROR("failed to create device file for dpm state\n");
1538 + ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
1539 + if (ret)
1540 + DRM_ERROR("failed to create device file for dpm state\n");
1541 + /* XXX: these are noops for dpm but are here for backwards compat */
1542 + ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1543 + if (ret)
1544 + DRM_ERROR("failed to create device file for power profile\n");
1545 + ret = device_create_file(rdev->dev, &dev_attr_power_method);
1546 + if (ret)
1547 + DRM_ERROR("failed to create device file for power method\n");
1548 + if (!ret)
1549 + rdev->pm.sysfs_initialized = true;
1550 + }
1551
1552 mutex_lock(&rdev->pm.mutex);
1553 ret = radeon_dpm_late_enable(rdev);
1554 @@ -1557,7 +1565,8 @@ int radeon_pm_late_init(struct radeon_device *rdev)
1555 }
1556 }
1557 } else {
1558 - if (rdev->pm.num_power_states > 1) {
1559 + if ((rdev->pm.num_power_states > 1) &&
1560 + (!rdev->pm.sysfs_initialized)) {
1561 /* where's the best place to put these? */
1562 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1563 if (ret)
1564 @@ -1565,6 +1574,8 @@ int radeon_pm_late_init(struct radeon_device *rdev)
1565 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1566 if (ret)
1567 DRM_ERROR("failed to create device file for power method\n");
1568 + if (!ret)
1569 + rdev->pm.sysfs_initialized = true;
1570 }
1571 }
1572 return ret;
1573 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
1574 index 620bb5cf617c..15a8d7746fd2 100644
1575 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
1576 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
1577 @@ -1458,6 +1458,9 @@ static void __exit vmwgfx_exit(void)
1578 drm_pci_exit(&driver, &vmw_pci_driver);
1579 }
1580
1581 +MODULE_INFO(vmw_patch, "ed7d78b2");
1582 +MODULE_INFO(vmw_patch, "54c12bc3");
1583 +
1584 module_init(vmwgfx_init);
1585 module_exit(vmwgfx_exit);
1586
1587 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
1588 index d26a6daa9719..d8896ed41b9e 100644
1589 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
1590 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
1591 @@ -636,7 +636,8 @@ extern int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
1592 uint32_t size,
1593 bool shareable,
1594 uint32_t *handle,
1595 - struct vmw_dma_buffer **p_dma_buf);
1596 + struct vmw_dma_buffer **p_dma_buf,
1597 + struct ttm_base_object **p_base);
1598 extern int vmw_user_dmabuf_reference(struct ttm_object_file *tfile,
1599 struct vmw_dma_buffer *dma_buf,
1600 uint32_t *handle);
1601 @@ -650,7 +651,8 @@ extern uint32_t vmw_dmabuf_validate_node(struct ttm_buffer_object *bo,
1602 uint32_t cur_validate_node);
1603 extern void vmw_dmabuf_validate_clear(struct ttm_buffer_object *bo);
1604 extern int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile,
1605 - uint32_t id, struct vmw_dma_buffer **out);
1606 + uint32_t id, struct vmw_dma_buffer **out,
1607 + struct ttm_base_object **base);
1608 extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data,
1609 struct drm_file *file_priv);
1610 extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data,
1611 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
1612 index 97ad3bcb99a7..aee1c6ccc52d 100644
1613 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
1614 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
1615 @@ -887,7 +887,8 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
1616 struct vmw_relocation *reloc;
1617 int ret;
1618
1619 - ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo);
1620 + ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo,
1621 + NULL);
1622 if (unlikely(ret != 0)) {
1623 DRM_ERROR("Could not find or use MOB buffer.\n");
1624 ret = -EINVAL;
1625 @@ -949,7 +950,8 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv,
1626 struct vmw_relocation *reloc;
1627 int ret;
1628
1629 - ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo);
1630 + ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo,
1631 + NULL);
1632 if (unlikely(ret != 0)) {
1633 DRM_ERROR("Could not find or use GMR region.\n");
1634 ret = -EINVAL;
1635 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
1636 index 87e39f68e9d0..e1898982b44a 100644
1637 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
1638 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
1639 @@ -484,7 +484,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
1640 goto out_unlock;
1641 }
1642
1643 - ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &buf);
1644 + ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &buf, NULL);
1645 if (ret)
1646 goto out_unlock;
1647
1648 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
1649 index 210ef15b1d09..c5b4c47e86d6 100644
1650 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
1651 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
1652 @@ -356,7 +356,7 @@ int vmw_user_lookup_handle(struct vmw_private *dev_priv,
1653 }
1654
1655 *out_surf = NULL;
1656 - ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf);
1657 + ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf, NULL);
1658 return ret;
1659 }
1660
1661 @@ -483,7 +483,8 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
1662 uint32_t size,
1663 bool shareable,
1664 uint32_t *handle,
1665 - struct vmw_dma_buffer **p_dma_buf)
1666 + struct vmw_dma_buffer **p_dma_buf,
1667 + struct ttm_base_object **p_base)
1668 {
1669 struct vmw_user_dma_buffer *user_bo;
1670 struct ttm_buffer_object *tmp;
1671 @@ -517,6 +518,10 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
1672 }
1673
1674 *p_dma_buf = &user_bo->dma;
1675 + if (p_base) {
1676 + *p_base = &user_bo->prime.base;
1677 + kref_get(&(*p_base)->refcount);
1678 + }
1679 *handle = user_bo->prime.base.hash.key;
1680
1681 out_no_base_object:
1682 @@ -633,6 +638,7 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data,
1683 struct vmw_dma_buffer *dma_buf;
1684 struct vmw_user_dma_buffer *user_bo;
1685 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
1686 + struct ttm_base_object *buffer_base;
1687 int ret;
1688
1689 if ((arg->flags & (drm_vmw_synccpu_read | drm_vmw_synccpu_write)) == 0
1690 @@ -645,7 +651,8 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data,
1691
1692 switch (arg->op) {
1693 case drm_vmw_synccpu_grab:
1694 - ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &dma_buf);
1695 + ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &dma_buf,
1696 + &buffer_base);
1697 if (unlikely(ret != 0))
1698 return ret;
1699
1700 @@ -653,6 +660,7 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data,
1701 dma);
1702 ret = vmw_user_dmabuf_synccpu_grab(user_bo, tfile, arg->flags);
1703 vmw_dmabuf_unreference(&dma_buf);
1704 + ttm_base_object_unref(&buffer_base);
1705 if (unlikely(ret != 0 && ret != -ERESTARTSYS &&
1706 ret != -EBUSY)) {
1707 DRM_ERROR("Failed synccpu grab on handle 0x%08x.\n",
1708 @@ -694,7 +702,8 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data,
1709 return ret;
1710
1711 ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile,
1712 - req->size, false, &handle, &dma_buf);
1713 + req->size, false, &handle, &dma_buf,
1714 + NULL);
1715 if (unlikely(ret != 0))
1716 goto out_no_dmabuf;
1717
1718 @@ -723,7 +732,8 @@ int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data,
1719 }
1720
1721 int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile,
1722 - uint32_t handle, struct vmw_dma_buffer **out)
1723 + uint32_t handle, struct vmw_dma_buffer **out,
1724 + struct ttm_base_object **p_base)
1725 {
1726 struct vmw_user_dma_buffer *vmw_user_bo;
1727 struct ttm_base_object *base;
1728 @@ -745,7 +755,10 @@ int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile,
1729 vmw_user_bo = container_of(base, struct vmw_user_dma_buffer,
1730 prime.base);
1731 (void)ttm_bo_reference(&vmw_user_bo->dma.base);
1732 - ttm_base_object_unref(&base);
1733 + if (p_base)
1734 + *p_base = base;
1735 + else
1736 + ttm_base_object_unref(&base);
1737 *out = &vmw_user_bo->dma;
1738
1739 return 0;
1740 @@ -1006,7 +1019,7 @@ int vmw_dumb_create(struct drm_file *file_priv,
1741
1742 ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile,
1743 args->size, false, &args->handle,
1744 - &dma_buf);
1745 + &dma_buf, NULL);
1746 if (unlikely(ret != 0))
1747 goto out_no_dmabuf;
1748
1749 @@ -1034,7 +1047,7 @@ int vmw_dumb_map_offset(struct drm_file *file_priv,
1750 struct vmw_dma_buffer *out_buf;
1751 int ret;
1752
1753 - ret = vmw_user_dmabuf_lookup(tfile, handle, &out_buf);
1754 + ret = vmw_user_dmabuf_lookup(tfile, handle, &out_buf, NULL);
1755 if (ret != 0)
1756 return -EINVAL;
1757
1758 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
1759 index 6a4584a43aa6..d2751ada19b1 100644
1760 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
1761 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
1762 @@ -470,7 +470,7 @@ int vmw_shader_define_ioctl(struct drm_device *dev, void *data,
1763
1764 if (arg->buffer_handle != SVGA3D_INVALID_ID) {
1765 ret = vmw_user_dmabuf_lookup(tfile, arg->buffer_handle,
1766 - &buffer);
1767 + &buffer, NULL);
1768 if (unlikely(ret != 0)) {
1769 DRM_ERROR("Could not find buffer for shader "
1770 "creation.\n");
1771 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
1772 index 4ecdbf3e59da..17a4107639b2 100644
1773 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
1774 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
1775 @@ -43,6 +43,7 @@ struct vmw_user_surface {
1776 struct vmw_surface srf;
1777 uint32_t size;
1778 struct drm_master *master;
1779 + struct ttm_base_object *backup_base;
1780 };
1781
1782 /**
1783 @@ -652,6 +653,8 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
1784 struct vmw_resource *res = &user_srf->srf.res;
1785
1786 *p_base = NULL;
1787 + if (user_srf->backup_base)
1788 + ttm_base_object_unref(&user_srf->backup_base);
1789 vmw_resource_unreference(&res);
1790 }
1791
1792 @@ -846,7 +849,8 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
1793 res->backup_size,
1794 true,
1795 &backup_handle,
1796 - &res->backup);
1797 + &res->backup,
1798 + &user_srf->backup_base);
1799 if (unlikely(ret != 0)) {
1800 vmw_resource_unreference(&res);
1801 goto out_unlock;
1802 @@ -1309,7 +1313,8 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
1803
1804 if (req->buffer_handle != SVGA3D_INVALID_ID) {
1805 ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle,
1806 - &res->backup);
1807 + &res->backup,
1808 + &user_srf->backup_base);
1809 } else if (req->drm_surface_flags &
1810 drm_vmw_surface_flag_create_buffer)
1811 ret = vmw_user_dmabuf_alloc(dev_priv, tfile,
1812 @@ -1317,7 +1322,8 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
1813 req->drm_surface_flags &
1814 drm_vmw_surface_flag_shareable,
1815 &backup_handle,
1816 - &res->backup);
1817 + &res->backup,
1818 + &user_srf->backup_base);
1819
1820 if (unlikely(ret != 0)) {
1821 vmw_resource_unreference(&res);
1822 diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
1823 index 30059c1df2a3..5801227b97ab 100644
1824 --- a/drivers/i2c/busses/i2c-mv64xxx.c
1825 +++ b/drivers/i2c/busses/i2c-mv64xxx.c
1826 @@ -669,8 +669,6 @@ mv64xxx_i2c_can_offload(struct mv64xxx_i2c_data *drv_data)
1827 struct i2c_msg *msgs = drv_data->msgs;
1828 int num = drv_data->num_msgs;
1829
1830 - return false;
1831 -
1832 if (!drv_data->offload_enabled)
1833 return false;
1834
1835 diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
1836 index 211b13271c61..2ae7150442fc 100644
1837 --- a/drivers/iio/accel/st_accel_core.c
1838 +++ b/drivers/iio/accel/st_accel_core.c
1839 @@ -149,8 +149,6 @@
1840 #define ST_ACCEL_4_BDU_MASK 0x40
1841 #define ST_ACCEL_4_DRDY_IRQ_ADDR 0x21
1842 #define ST_ACCEL_4_DRDY_IRQ_INT1_MASK 0x04
1843 -#define ST_ACCEL_4_IG1_EN_ADDR 0x21
1844 -#define ST_ACCEL_4_IG1_EN_MASK 0x08
1845 #define ST_ACCEL_4_MULTIREAD_BIT true
1846
1847 static const struct iio_chan_spec st_accel_12bit_channels[] = {
1848 @@ -446,10 +444,6 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
1849 .drdy_irq = {
1850 .addr = ST_ACCEL_4_DRDY_IRQ_ADDR,
1851 .mask_int1 = ST_ACCEL_4_DRDY_IRQ_INT1_MASK,
1852 - .ig1 = {
1853 - .en_addr = ST_ACCEL_4_IG1_EN_ADDR,
1854 - .en_mask = ST_ACCEL_4_IG1_EN_MASK,
1855 - },
1856 },
1857 .multi_read_bit = ST_ACCEL_4_MULTIREAD_BIT,
1858 .bootime = 2, /* guess */
1859 diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
1860 index 0271608a51c4..0962b6821ce1 100644
1861 --- a/drivers/infiniband/core/cm.c
1862 +++ b/drivers/infiniband/core/cm.c
1863 @@ -859,6 +859,11 @@ retest:
1864 case IB_CM_SIDR_REQ_RCVD:
1865 spin_unlock_irq(&cm_id_priv->lock);
1866 cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT);
1867 + spin_lock_irq(&cm.lock);
1868 + if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node))
1869 + rb_erase(&cm_id_priv->sidr_id_node,
1870 + &cm.remote_sidr_table);
1871 + spin_unlock_irq(&cm.lock);
1872 break;
1873 case IB_CM_REQ_SENT:
1874 case IB_CM_MRA_REQ_RCVD:
1875 @@ -3098,7 +3103,10 @@ int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
1876 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
1877
1878 spin_lock_irqsave(&cm.lock, flags);
1879 - rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
1880 + if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) {
1881 + rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
1882 + RB_CLEAR_NODE(&cm_id_priv->sidr_id_node);
1883 + }
1884 spin_unlock_irqrestore(&cm.lock, flags);
1885 return 0;
1886
1887 diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
1888 index bc7eed67998a..4b9e31a5b3f8 100644
1889 --- a/drivers/input/mouse/alps.c
1890 +++ b/drivers/input/mouse/alps.c
1891 @@ -100,7 +100,7 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
1892 #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */
1893 #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with
1894 6-byte ALPS packet */
1895 -#define ALPS_DELL 0x100 /* device is a Dell laptop */
1896 +#define ALPS_STICK_BITS 0x100 /* separate stick button bits */
1897 #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */
1898
1899 static const struct alps_model_info alps_model_data[] = {
1900 @@ -159,6 +159,43 @@ static const struct alps_protocol_info alps_v8_protocol_data = {
1901 ALPS_PROTO_V8, 0x18, 0x18, 0
1902 };
1903
1904 +/*
1905 + * Some v2 models report the stick buttons in separate bits
1906 + */
1907 +static const struct dmi_system_id alps_dmi_has_separate_stick_buttons[] = {
1908 +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
1909 + {
1910 + /* Extrapolated from other entries */
1911 + .matches = {
1912 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1913 + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D420"),
1914 + },
1915 + },
1916 + {
1917 + /* Reported-by: Hans de Bruin <jmdebruin@xmsnet.nl> */
1918 + .matches = {
1919 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1920 + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D430"),
1921 + },
1922 + },
1923 + {
1924 + /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
1925 + .matches = {
1926 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1927 + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D620"),
1928 + },
1929 + },
1930 + {
1931 + /* Extrapolated from other entries */
1932 + .matches = {
1933 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1934 + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D630"),
1935 + },
1936 + },
1937 +#endif
1938 + { }
1939 +};
1940 +
1941 static void alps_set_abs_params_st(struct alps_data *priv,
1942 struct input_dev *dev1);
1943 static void alps_set_abs_params_mt(struct alps_data *priv,
1944 @@ -253,9 +290,8 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse)
1945 return;
1946 }
1947
1948 - /* Dell non interleaved V2 dualpoint has separate stick button bits */
1949 - if (priv->proto_version == ALPS_PROTO_V2 &&
1950 - priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) {
1951 + /* Some models have separate stick button bits */
1952 + if (priv->flags & ALPS_STICK_BITS) {
1953 left |= packet[0] & 1;
1954 right |= packet[0] & 2;
1955 middle |= packet[0] & 4;
1956 @@ -2544,8 +2580,6 @@ static int alps_set_protocol(struct psmouse *psmouse,
1957 priv->byte0 = protocol->byte0;
1958 priv->mask0 = protocol->mask0;
1959 priv->flags = protocol->flags;
1960 - if (dmi_name_in_vendors("Dell"))
1961 - priv->flags |= ALPS_DELL;
1962
1963 priv->x_max = 2000;
1964 priv->y_max = 1400;
1965 @@ -2560,6 +2594,8 @@ static int alps_set_protocol(struct psmouse *psmouse,
1966 priv->set_abs_params = alps_set_abs_params_st;
1967 priv->x_max = 1023;
1968 priv->y_max = 767;
1969 + if (dmi_check_system(alps_dmi_has_separate_stick_buttons))
1970 + priv->flags |= ALPS_STICK_BITS;
1971 break;
1972
1973 case ALPS_PROTO_V3:
1974 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
1975 index ca9f4edbb940..f0fd5352f8ef 100644
1976 --- a/drivers/iommu/amd_iommu.c
1977 +++ b/drivers/iommu/amd_iommu.c
1978 @@ -2099,8 +2099,8 @@ static void set_dte_entry(u16 devid, struct protection_domain *domain, bool ats)
1979 static void clear_dte_entry(u16 devid)
1980 {
1981 /* remove entry from the device table seen by the hardware */
1982 - amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
1983 - amd_iommu_dev_table[devid].data[1] = 0;
1984 + amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
1985 + amd_iommu_dev_table[devid].data[1] &= DTE_FLAG_MASK;
1986
1987 amd_iommu_apply_erratum_63(devid);
1988 }
1989 diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
1990 index 05030e523771..cbfd0f4c4608 100644
1991 --- a/drivers/iommu/amd_iommu_types.h
1992 +++ b/drivers/iommu/amd_iommu_types.h
1993 @@ -295,6 +295,7 @@
1994 #define IOMMU_PTE_IR (1ULL << 61)
1995 #define IOMMU_PTE_IW (1ULL << 62)
1996
1997 +#define DTE_FLAG_MASK (0x3ffULL << 32)
1998 #define DTE_FLAG_IOTLB (0x01UL << 32)
1999 #define DTE_FLAG_GV (0x01ULL << 55)
2000 #define DTE_GLX_SHIFT (56)
2001 diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
2002 index 3465faf1809e..45087c3e5c57 100644
2003 --- a/drivers/iommu/amd_iommu_v2.c
2004 +++ b/drivers/iommu/amd_iommu_v2.c
2005 @@ -508,6 +508,13 @@ static void do_fault(struct work_struct *work)
2006 goto out;
2007 }
2008
2009 + if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) {
2010 + /* handle_mm_fault would BUG_ON() */
2011 + up_read(&mm->mmap_sem);
2012 + handle_fault_error(fault);
2013 + goto out;
2014 + }
2015 +
2016 ret = handle_mm_fault(mm, vma, address, write);
2017 if (ret & VM_FAULT_ERROR) {
2018 /* failed to service fault */
2019 diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
2020 index c23427951ec1..8b0178db6a04 100644
2021 --- a/drivers/iommu/intel-iommu.c
2022 +++ b/drivers/iommu/intel-iommu.c
2023 @@ -2033,15 +2033,19 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
2024 return -ENOMEM;
2025 /* It is large page*/
2026 if (largepage_lvl > 1) {
2027 + unsigned long nr_superpages, end_pfn;
2028 +
2029 pteval |= DMA_PTE_LARGE_PAGE;
2030 lvl_pages = lvl_to_nr_pages(largepage_lvl);
2031 +
2032 + nr_superpages = sg_res / lvl_pages;
2033 + end_pfn = iov_pfn + nr_superpages * lvl_pages - 1;
2034 +
2035 /*
2036 * Ensure that old small page tables are
2037 - * removed to make room for superpage,
2038 - * if they exist.
2039 + * removed to make room for superpage(s).
2040 */
2041 - dma_pte_free_pagetable(domain, iov_pfn,
2042 - iov_pfn + lvl_pages - 1);
2043 + dma_pte_free_pagetable(domain, iov_pfn, end_pfn);
2044 } else {
2045 pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE;
2046 }
2047 diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c
2048 index f67bbd80433e..ab5353a96a82 100644
2049 --- a/drivers/irqchip/irq-tegra.c
2050 +++ b/drivers/irqchip/irq-tegra.c
2051 @@ -215,6 +215,7 @@ static struct irq_chip tegra_ictlr_chip = {
2052 .irq_unmask = tegra_unmask,
2053 .irq_retrigger = tegra_retrigger,
2054 .irq_set_wake = tegra_set_wake,
2055 + .irq_set_type = irq_chip_set_type_parent,
2056 .flags = IRQCHIP_MASK_ON_SUSPEND,
2057 #ifdef CONFIG_SMP
2058 .irq_set_affinity = irq_chip_set_affinity_parent,
2059 diff --git a/drivers/md/md.c b/drivers/md/md.c
2060 index e8c44fcb1ad1..78c1f77e7903 100644
2061 --- a/drivers/md/md.c
2062 +++ b/drivers/md/md.c
2063 @@ -8013,8 +8013,7 @@ static int remove_and_add_spares(struct mddev *mddev,
2064 !test_bit(Bitmap_sync, &rdev->flags)))
2065 continue;
2066
2067 - if (rdev->saved_raid_disk < 0)
2068 - rdev->recovery_offset = 0;
2069 + rdev->recovery_offset = 0;
2070 if (mddev->pers->
2071 hot_add_disk(mddev, rdev) == 0) {
2072 if (sysfs_link_rdev(mddev, rdev))
2073 diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c
2074 index 7c0d75547ccf..92cd09f3c69b 100644
2075 --- a/drivers/md/persistent-data/dm-btree-remove.c
2076 +++ b/drivers/md/persistent-data/dm-btree-remove.c
2077 @@ -301,11 +301,16 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
2078 {
2079 int s;
2080 uint32_t max_entries = le32_to_cpu(left->header.max_entries);
2081 - unsigned target = (nr_left + nr_center + nr_right) / 3;
2082 - BUG_ON(target > max_entries);
2083 + unsigned total = nr_left + nr_center + nr_right;
2084 + unsigned target_right = total / 3;
2085 + unsigned remainder = (target_right * 3) != total;
2086 + unsigned target_left = target_right + remainder;
2087 +
2088 + BUG_ON(target_left > max_entries);
2089 + BUG_ON(target_right > max_entries);
2090
2091 if (nr_left < nr_right) {
2092 - s = nr_left - target;
2093 + s = nr_left - target_left;
2094
2095 if (s < 0 && nr_center < -s) {
2096 /* not enough in central node */
2097 @@ -316,10 +321,10 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
2098 } else
2099 shift(left, center, s);
2100
2101 - shift(center, right, target - nr_right);
2102 + shift(center, right, target_right - nr_right);
2103
2104 } else {
2105 - s = target - nr_right;
2106 + s = target_right - nr_right;
2107 if (s > 0 && nr_center < s) {
2108 /* not enough in central node */
2109 shift(center, right, nr_center);
2110 @@ -329,7 +334,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
2111 } else
2112 shift(center, right, s);
2113
2114 - shift(left, center, nr_left - target);
2115 + shift(left, center, nr_left - target_left);
2116 }
2117
2118 *key_ptr(parent, c->index) = center->keys[0];
2119 diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
2120 index c7726cebc495..d6e47033b5e0 100644
2121 --- a/drivers/md/persistent-data/dm-btree.c
2122 +++ b/drivers/md/persistent-data/dm-btree.c
2123 @@ -523,7 +523,7 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key)
2124
2125 r = new_block(s->info, &right);
2126 if (r < 0) {
2127 - /* FIXME: put left */
2128 + unlock_block(s->info, left);
2129 return r;
2130 }
2131
2132 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
2133 index 5ce3cd5c4e1d..bff6c1c7fecb 100644
2134 --- a/drivers/md/raid1.c
2135 +++ b/drivers/md/raid1.c
2136 @@ -2248,7 +2248,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
2137 bio_trim(wbio, sector - r1_bio->sector, sectors);
2138 wbio->bi_iter.bi_sector += rdev->data_offset;
2139 wbio->bi_bdev = rdev->bdev;
2140 - if (submit_bio_wait(WRITE, wbio) == 0)
2141 + if (submit_bio_wait(WRITE, wbio) < 0)
2142 /* failure! */
2143 ok = rdev_set_badblocks(rdev, sector,
2144 sectors, 0)
2145 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
2146 index fe0122771642..adfc83a0f023 100644
2147 --- a/drivers/md/raid10.c
2148 +++ b/drivers/md/raid10.c
2149 @@ -2590,7 +2590,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
2150 choose_data_offset(r10_bio, rdev) +
2151 (sector - r10_bio->sector));
2152 wbio->bi_bdev = rdev->bdev;
2153 - if (submit_bio_wait(WRITE, wbio) == 0)
2154 + if (submit_bio_wait(WRITE, wbio) < 0)
2155 /* Failure! */
2156 ok = rdev_set_badblocks(rdev, sector,
2157 sectors, 0)
2158 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
2159 index 23af6772f146..0d767e31f455 100644
2160 --- a/drivers/md/raid5.c
2161 +++ b/drivers/md/raid5.c
2162 @@ -3494,6 +3494,7 @@ returnbi:
2163 }
2164 if (!discard_pending &&
2165 test_bit(R5_Discard, &sh->dev[sh->pd_idx].flags)) {
2166 + int hash;
2167 clear_bit(R5_Discard, &sh->dev[sh->pd_idx].flags);
2168 clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags);
2169 if (sh->qd_idx >= 0) {
2170 @@ -3507,16 +3508,17 @@ returnbi:
2171 * no updated data, so remove it from hash list and the stripe
2172 * will be reinitialized
2173 */
2174 - spin_lock_irq(&conf->device_lock);
2175 unhash:
2176 + hash = sh->hash_lock_index;
2177 + spin_lock_irq(conf->hash_locks + hash);
2178 remove_hash(sh);
2179 + spin_unlock_irq(conf->hash_locks + hash);
2180 if (head_sh->batch_head) {
2181 sh = list_first_entry(&sh->batch_list,
2182 struct stripe_head, batch_list);
2183 if (sh != head_sh)
2184 goto unhash;
2185 }
2186 - spin_unlock_irq(&conf->device_lock);
2187 sh = head_sh;
2188
2189 if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state))
2190 diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
2191 index 5db588ebfc24..391e98395b41 100644
2192 --- a/drivers/media/dvb-frontends/si2168.c
2193 +++ b/drivers/media/dvb-frontends/si2168.c
2194 @@ -457,6 +457,10 @@ static int si2168_init(struct dvb_frontend *fe)
2195 /* firmware is in the new format */
2196 for (remaining = fw->size; remaining > 0; remaining -= 17) {
2197 len = fw->data[fw->size - remaining];
2198 + if (len > SI2168_ARGLEN) {
2199 + ret = -EINVAL;
2200 + break;
2201 + }
2202 memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len);
2203 cmd.wlen = len;
2204 cmd.rlen = 1;
2205 diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
2206 index d74ae26621ca..c5dbba5b5bc9 100644
2207 --- a/drivers/media/tuners/si2157.c
2208 +++ b/drivers/media/tuners/si2157.c
2209 @@ -165,6 +165,10 @@ static int si2157_init(struct dvb_frontend *fe)
2210
2211 for (remaining = fw->size; remaining > 0; remaining -= 17) {
2212 len = fw->data[fw->size - remaining];
2213 + if (len > SI2157_ARGLEN) {
2214 + dev_err(&client->dev, "Bad firmware length\n");
2215 + goto err_release_firmware;
2216 + }
2217 memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len);
2218 cmd.wlen = len;
2219 cmd.rlen = 1;
2220 diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
2221 index 895441fe90f7..e862554952c1 100644
2222 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
2223 +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
2224 @@ -34,6 +34,14 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
2225 unsigned int pipe;
2226 u8 requesttype;
2227
2228 + mutex_lock(&d->usb_mutex);
2229 +
2230 + if (req->size > sizeof(dev->buf)) {
2231 + dev_err(&d->intf->dev, "too large message %u\n", req->size);
2232 + ret = -EINVAL;
2233 + goto err_mutex_unlock;
2234 + }
2235 +
2236 if (req->index & CMD_WR_FLAG) {
2237 /* write */
2238 memcpy(dev->buf, req->data, req->size);
2239 @@ -50,14 +58,17 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
2240 dvb_usb_dbg_usb_control_msg(d->udev, 0, requesttype, req->value,
2241 req->index, dev->buf, req->size);
2242 if (ret < 0)
2243 - goto err;
2244 + goto err_mutex_unlock;
2245
2246 /* read request, copy returned data to return buf */
2247 if (requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
2248 memcpy(req->data, dev->buf, req->size);
2249
2250 + mutex_unlock(&d->usb_mutex);
2251 +
2252 return 0;
2253 -err:
2254 +err_mutex_unlock:
2255 + mutex_unlock(&d->usb_mutex);
2256 dev_dbg(&d->intf->dev, "failed=%d\n", ret);
2257 return ret;
2258 }
2259 diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
2260 index 1b5d7ffb685e..1bdeda05d332 100644
2261 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
2262 +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
2263 @@ -69,7 +69,7 @@
2264
2265
2266 struct rtl28xxu_dev {
2267 - u8 buf[28];
2268 + u8 buf[128];
2269 u8 chip_id;
2270 u8 tuner;
2271 char *tuner_name;
2272 diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
2273 index f8d11efa7b0f..46a389c20bfc 100644
2274 --- a/drivers/net/wireless/ath/ath9k/init.c
2275 +++ b/drivers/net/wireless/ath/ath9k/init.c
2276 @@ -874,6 +874,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
2277 hw->max_rate_tries = 10;
2278 hw->sta_data_size = sizeof(struct ath_node);
2279 hw->vif_data_size = sizeof(struct ath_vif);
2280 + hw->extra_tx_headroom = 4;
2281
2282 hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
2283 hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
2284 diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
2285 index 1d2223df5cb0..e7d3566c714b 100644
2286 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c
2287 +++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
2288 @@ -1022,7 +1022,7 @@ static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw,
2289 u8 *pn = seq.ccmp.pn;
2290
2291 ieee80211_get_key_rx_seq(key, i, &seq);
2292 - aes_sc->pn = cpu_to_le64(
2293 + aes_sc[i].pn = cpu_to_le64(
2294 (u64)pn[5] |
2295 ((u64)pn[4] << 8) |
2296 ((u64)pn[3] << 16) |
2297 diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
2298 index 74ad278116be..fd83e30eaf00 100644
2299 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c
2300 +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
2301 @@ -325,6 +325,6 @@ const struct iwl_cfg iwl7265d_n_cfg = {
2302 };
2303
2304 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
2305 -MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
2306 +MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
2307 MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
2308 MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
2309 diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
2310 index 4310cf102d78..89d6a6100c88 100644
2311 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c
2312 +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
2313 @@ -298,12 +298,12 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
2314 u8 *pn = seq.ccmp.pn;
2315
2316 ieee80211_get_key_rx_seq(key, i, &seq);
2317 - aes_sc->pn = cpu_to_le64((u64)pn[5] |
2318 - ((u64)pn[4] << 8) |
2319 - ((u64)pn[3] << 16) |
2320 - ((u64)pn[2] << 24) |
2321 - ((u64)pn[1] << 32) |
2322 - ((u64)pn[0] << 40));
2323 + aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
2324 + ((u64)pn[4] << 8) |
2325 + ((u64)pn[3] << 16) |
2326 + ((u64)pn[2] << 24) |
2327 + ((u64)pn[1] << 32) |
2328 + ((u64)pn[0] << 40));
2329 }
2330 data->use_rsc_tsc = true;
2331 break;
2332 diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
2333 index df869633f4dd..1e1c77a59760 100644
2334 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c
2335 +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
2336 @@ -364,7 +364,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
2337 * abort after reading the nvm in case RF Kill is on, we will complete
2338 * the init seq later when RF kill will switch to off
2339 */
2340 - if (iwl_mvm_is_radio_killed(mvm)) {
2341 + if (iwl_mvm_is_radio_hw_killed(mvm)) {
2342 IWL_DEBUG_RF_KILL(mvm,
2343 "jump over all phy activities due to RF kill\n");
2344 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
2345 @@ -397,7 +397,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
2346 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
2347 MVM_UCODE_CALIB_TIMEOUT);
2348
2349 - if (ret && iwl_mvm_is_radio_killed(mvm)) {
2350 + if (ret && iwl_mvm_is_radio_hw_killed(mvm)) {
2351 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
2352 ret = 1;
2353 }
2354 diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
2355 index 60c138a9bf4f..9779c1e5688c 100644
2356 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
2357 +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
2358 @@ -2277,6 +2277,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
2359 iwl_mvm_remove_time_event(mvm, mvmvif,
2360 &mvmvif->time_event_data);
2361 RCU_INIT_POINTER(mvm->csa_vif, NULL);
2362 + mvmvif->csa_countdown = false;
2363 }
2364
2365 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) {
2366 diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
2367 index 6af21daaaaef..83273adfabdd 100644
2368 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
2369 +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
2370 @@ -870,6 +870,11 @@ static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
2371 test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
2372 }
2373
2374 +static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
2375 +{
2376 + return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
2377 +}
2378 +
2379 /* Must be called with rcu_read_lock() held and it can only be
2380 * released when mvmsta is not needed anymore.
2381 */
2382 diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
2383 index 2ea01238754e..8d4f287dca3b 100644
2384 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c
2385 +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
2386 @@ -589,6 +589,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
2387 ieee80211_unregister_hw(mvm->hw);
2388 iwl_mvm_leds_exit(mvm);
2389 out_free:
2390 + flush_delayed_work(&mvm->fw_dump_wk);
2391 iwl_phy_db_free(mvm->phy_db);
2392 kfree(mvm->scan_cmd);
2393 if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name)
2394 diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
2395 index b18569734922..8b16949a9cb9 100644
2396 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c
2397 +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
2398 @@ -412,6 +412,11 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
2399 {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)},
2400 {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)},
2401 {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)},
2402 + {IWL_PCI_DEVICE(0x095A, 0x5F10, iwl7265_2ac_cfg)},
2403 + {IWL_PCI_DEVICE(0x095B, 0x5212, iwl7265_2ac_cfg)},
2404 + {IWL_PCI_DEVICE(0x095B, 0x520A, iwl7265_2ac_cfg)},
2405 + {IWL_PCI_DEVICE(0x095A, 0x9000, iwl7265_2ac_cfg)},
2406 + {IWL_PCI_DEVICE(0x095A, 0x9400, iwl7265_2ac_cfg)},
2407
2408 /* 8000 Series */
2409 {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)},
2410 diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
2411 index d4567d12e07e..5da6703942d9 100644
2412 --- a/drivers/net/wireless/rtlwifi/pci.h
2413 +++ b/drivers/net/wireless/rtlwifi/pci.h
2414 @@ -247,6 +247,8 @@ struct rtl_pci {
2415 /* MSI support */
2416 bool msi_support;
2417 bool using_msi;
2418 + /* interrupt clear before set */
2419 + bool int_clear;
2420 };
2421
2422 struct mp_adapter {
2423 diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
2424 index 3fa2fb7c8e4e..76e52dfb2be5 100644
2425 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
2426 +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
2427 @@ -2253,11 +2253,28 @@ void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci)
2428 }
2429 }
2430
2431 +static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw)
2432 +{
2433 + struct rtl_priv *rtlpriv = rtl_priv(hw);
2434 + u32 tmp = rtl_read_dword(rtlpriv, REG_HISR);
2435 +
2436 + rtl_write_dword(rtlpriv, REG_HISR, tmp);
2437 +
2438 + tmp = rtl_read_dword(rtlpriv, REG_HISRE);
2439 + rtl_write_dword(rtlpriv, REG_HISRE, tmp);
2440 +
2441 + tmp = rtl_read_dword(rtlpriv, REG_HSISR);
2442 + rtl_write_dword(rtlpriv, REG_HSISR, tmp);
2443 +}
2444 +
2445 void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw)
2446 {
2447 struct rtl_priv *rtlpriv = rtl_priv(hw);
2448 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
2449
2450 + if (!rtlpci->int_clear)
2451 + rtl8821ae_clear_interrupt(hw);/*clear it here first*/
2452 +
2453 rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
2454 rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF);
2455 rtlpci->irq_enabled = true;
2456 diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
2457 index a4988121e1ab..8ee141a55bc5 100644
2458 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
2459 +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
2460 @@ -96,6 +96,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
2461
2462 rtl8821ae_bt_reg_init(hw);
2463 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
2464 + rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
2465 rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
2466
2467 rtlpriv->dm.dm_initialgain_enable = 1;
2468 @@ -167,6 +168,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
2469 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
2470 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
2471 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
2472 + rtlpci->msi_support = rtlpriv->cfg->mod_params->int_clear;
2473 if (rtlpriv->cfg->mod_params->disable_watchdog)
2474 pr_info("watchdog disabled\n");
2475 rtlpriv->psc.reg_fwctrl_lps = 3;
2476 @@ -308,6 +310,7 @@ static struct rtl_mod_params rtl8821ae_mod_params = {
2477 .swctrl_lps = false,
2478 .fwctrl_lps = true,
2479 .msi_support = true,
2480 + .int_clear = true,
2481 .debug = DBG_EMERG,
2482 .disable_watchdog = 0,
2483 };
2484 @@ -437,6 +440,7 @@ module_param_named(fwlps, rtl8821ae_mod_params.fwctrl_lps, bool, 0444);
2485 module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444);
2486 module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog,
2487 bool, 0444);
2488 +module_param_named(int_clear, rtl8821ae_mod_params.int_clear, bool, 0444);
2489 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
2490 MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
2491 MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
2492 @@ -444,6 +448,7 @@ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
2493 MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
2494 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
2495 MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n");
2496 +MODULE_PARM_DESC(int_clear, "Set to 1 to disable interrupt clear before set (default 0)\n");
2497
2498 static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
2499
2500 diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
2501 index 51572912c53d..f1fa8100f288 100644
2502 --- a/drivers/net/wireless/rtlwifi/wifi.h
2503 +++ b/drivers/net/wireless/rtlwifi/wifi.h
2504 @@ -2233,6 +2233,9 @@ struct rtl_mod_params {
2505
2506 /* default 0: 1 means disable */
2507 bool disable_watchdog;
2508 +
2509 + /* default 0: 1 means do not disable interrupts */
2510 + bool int_clear;
2511 };
2512
2513 struct rtl_hal_usbint_cfg {
2514 diff --git a/drivers/of/platform.c b/drivers/of/platform.c
2515 index a01f57c9e34e..ddf8e42c9367 100644
2516 --- a/drivers/of/platform.c
2517 +++ b/drivers/of/platform.c
2518 @@ -25,6 +25,7 @@
2519
2520 const struct of_device_id of_default_bus_match_table[] = {
2521 { .compatible = "simple-bus", },
2522 + { .compatible = "simple-mfd", },
2523 #ifdef CONFIG_ARM_AMBA
2524 { .compatible = "arm,amba-bus", },
2525 #endif /* CONFIG_ARM_AMBA */
2526 diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
2527 index 312f23a8429c..92618686604c 100644
2528 --- a/drivers/pci/pci-sysfs.c
2529 +++ b/drivers/pci/pci-sysfs.c
2530 @@ -216,7 +216,7 @@ static ssize_t numa_node_store(struct device *dev,
2531 if (ret)
2532 return ret;
2533
2534 - if (!node_online(node))
2535 + if (node >= MAX_NUMNODES || !node_online(node))
2536 return -EINVAL;
2537
2538 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
2539 diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
2540 index 2062c224e32f..b2602210784d 100644
2541 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
2542 +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
2543 @@ -146,7 +146,7 @@ struct byt_gpio_pin_context {
2544 struct byt_gpio {
2545 struct gpio_chip chip;
2546 struct platform_device *pdev;
2547 - spinlock_t lock;
2548 + raw_spinlock_t lock;
2549 void __iomem *reg_base;
2550 struct pinctrl_gpio_range *range;
2551 struct byt_gpio_pin_context *saved_context;
2552 @@ -174,11 +174,11 @@ static void byt_gpio_clear_triggering(struct byt_gpio *vg, unsigned offset)
2553 unsigned long flags;
2554 u32 value;
2555
2556 - spin_lock_irqsave(&vg->lock, flags);
2557 + raw_spin_lock_irqsave(&vg->lock, flags);
2558 value = readl(reg);
2559 value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL);
2560 writel(value, reg);
2561 - spin_unlock_irqrestore(&vg->lock, flags);
2562 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2563 }
2564
2565 static u32 byt_get_gpio_mux(struct byt_gpio *vg, unsigned offset)
2566 @@ -201,6 +201,9 @@ static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
2567 struct byt_gpio *vg = to_byt_gpio(chip);
2568 void __iomem *reg = byt_gpio_reg(chip, offset, BYT_CONF0_REG);
2569 u32 value, gpio_mux;
2570 + unsigned long flags;
2571 +
2572 + raw_spin_lock_irqsave(&vg->lock, flags);
2573
2574 /*
2575 * In most cases, func pin mux 000 means GPIO function.
2576 @@ -214,18 +217,16 @@ static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
2577 value = readl(reg) & BYT_PIN_MUX;
2578 gpio_mux = byt_get_gpio_mux(vg, offset);
2579 if (WARN_ON(gpio_mux != value)) {
2580 - unsigned long flags;
2581 -
2582 - spin_lock_irqsave(&vg->lock, flags);
2583 value = readl(reg) & ~BYT_PIN_MUX;
2584 value |= gpio_mux;
2585 writel(value, reg);
2586 - spin_unlock_irqrestore(&vg->lock, flags);
2587
2588 dev_warn(&vg->pdev->dev,
2589 "pin %u forcibly re-configured as GPIO\n", offset);
2590 }
2591
2592 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2593 +
2594 pm_runtime_get(&vg->pdev->dev);
2595
2596 return 0;
2597 @@ -250,7 +251,7 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
2598 if (offset >= vg->chip.ngpio)
2599 return -EINVAL;
2600
2601 - spin_lock_irqsave(&vg->lock, flags);
2602 + raw_spin_lock_irqsave(&vg->lock, flags);
2603 value = readl(reg);
2604
2605 WARN(value & BYT_DIRECT_IRQ_EN,
2606 @@ -269,7 +270,7 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
2607 else if (type & IRQ_TYPE_LEVEL_MASK)
2608 __irq_set_handler_locked(d->irq, handle_level_irq);
2609
2610 - spin_unlock_irqrestore(&vg->lock, flags);
2611 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2612
2613 return 0;
2614 }
2615 @@ -277,7 +278,15 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
2616 static int byt_gpio_get(struct gpio_chip *chip, unsigned offset)
2617 {
2618 void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG);
2619 - return readl(reg) & BYT_LEVEL;
2620 + struct byt_gpio *vg = to_byt_gpio(chip);
2621 + unsigned long flags;
2622 + u32 val;
2623 +
2624 + raw_spin_lock_irqsave(&vg->lock, flags);
2625 + val = readl(reg);
2626 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2627 +
2628 + return val & BYT_LEVEL;
2629 }
2630
2631 static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
2632 @@ -287,7 +296,7 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
2633 unsigned long flags;
2634 u32 old_val;
2635
2636 - spin_lock_irqsave(&vg->lock, flags);
2637 + raw_spin_lock_irqsave(&vg->lock, flags);
2638
2639 old_val = readl(reg);
2640
2641 @@ -296,7 +305,7 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
2642 else
2643 writel(old_val & ~BYT_LEVEL, reg);
2644
2645 - spin_unlock_irqrestore(&vg->lock, flags);
2646 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2647 }
2648
2649 static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
2650 @@ -306,13 +315,13 @@ static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
2651 unsigned long flags;
2652 u32 value;
2653
2654 - spin_lock_irqsave(&vg->lock, flags);
2655 + raw_spin_lock_irqsave(&vg->lock, flags);
2656
2657 value = readl(reg) | BYT_DIR_MASK;
2658 value &= ~BYT_INPUT_EN; /* active low */
2659 writel(value, reg);
2660
2661 - spin_unlock_irqrestore(&vg->lock, flags);
2662 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2663
2664 return 0;
2665 }
2666 @@ -326,7 +335,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
2667 unsigned long flags;
2668 u32 reg_val;
2669
2670 - spin_lock_irqsave(&vg->lock, flags);
2671 + raw_spin_lock_irqsave(&vg->lock, flags);
2672
2673 /*
2674 * Before making any direction modifications, do a check if gpio
2675 @@ -345,7 +354,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
2676 else
2677 writel(reg_val & ~BYT_LEVEL, reg);
2678
2679 - spin_unlock_irqrestore(&vg->lock, flags);
2680 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2681
2682 return 0;
2683 }
2684 @@ -354,18 +363,19 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
2685 {
2686 struct byt_gpio *vg = to_byt_gpio(chip);
2687 int i;
2688 - unsigned long flags;
2689 u32 conf0, val, offs;
2690
2691 - spin_lock_irqsave(&vg->lock, flags);
2692 -
2693 for (i = 0; i < vg->chip.ngpio; i++) {
2694 const char *pull_str = NULL;
2695 const char *pull = NULL;
2696 + unsigned long flags;
2697 const char *label;
2698 offs = vg->range->pins[i] * 16;
2699 +
2700 + raw_spin_lock_irqsave(&vg->lock, flags);
2701 conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG);
2702 val = readl(vg->reg_base + offs + BYT_VAL_REG);
2703 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2704
2705 label = gpiochip_is_requested(chip, i);
2706 if (!label)
2707 @@ -418,7 +428,6 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
2708
2709 seq_puts(s, "\n");
2710 }
2711 - spin_unlock_irqrestore(&vg->lock, flags);
2712 }
2713
2714 static void byt_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
2715 @@ -450,8 +459,10 @@ static void byt_irq_ack(struct irq_data *d)
2716 unsigned offset = irqd_to_hwirq(d);
2717 void __iomem *reg;
2718
2719 + raw_spin_lock(&vg->lock);
2720 reg = byt_gpio_reg(&vg->chip, offset, BYT_INT_STAT_REG);
2721 writel(BIT(offset % 32), reg);
2722 + raw_spin_unlock(&vg->lock);
2723 }
2724
2725 static void byt_irq_unmask(struct irq_data *d)
2726 @@ -463,9 +474,9 @@ static void byt_irq_unmask(struct irq_data *d)
2727 void __iomem *reg;
2728 u32 value;
2729
2730 - spin_lock_irqsave(&vg->lock, flags);
2731 -
2732 reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG);
2733 +
2734 + raw_spin_lock_irqsave(&vg->lock, flags);
2735 value = readl(reg);
2736
2737 switch (irqd_get_trigger_type(d)) {
2738 @@ -486,7 +497,7 @@ static void byt_irq_unmask(struct irq_data *d)
2739
2740 writel(value, reg);
2741
2742 - spin_unlock_irqrestore(&vg->lock, flags);
2743 + raw_spin_unlock_irqrestore(&vg->lock, flags);
2744 }
2745
2746 static void byt_irq_mask(struct irq_data *d)
2747 @@ -578,7 +589,7 @@ static int byt_gpio_probe(struct platform_device *pdev)
2748 if (IS_ERR(vg->reg_base))
2749 return PTR_ERR(vg->reg_base);
2750
2751 - spin_lock_init(&vg->lock);
2752 + raw_spin_lock_init(&vg->lock);
2753
2754 gc = &vg->chip;
2755 gc->label = dev_name(&pdev->dev);
2756 diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
2757 index 454536c49315..9c780740fb82 100644
2758 --- a/drivers/scsi/mvsas/mv_sas.c
2759 +++ b/drivers/scsi/mvsas/mv_sas.c
2760 @@ -887,6 +887,8 @@ static void mvs_slot_free(struct mvs_info *mvi, u32 rx_desc)
2761 static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task,
2762 struct mvs_slot_info *slot, u32 slot_idx)
2763 {
2764 + if (!slot)
2765 + return;
2766 if (!slot->task)
2767 return;
2768 if (!sas_protocol_ata(task->task_proto))
2769 diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c
2770 index 8589eade1057..de65a8730d88 100644
2771 --- a/drivers/staging/iio/accel/sca3000_ring.c
2772 +++ b/drivers/staging/iio/accel/sca3000_ring.c
2773 @@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r,
2774 if (ret)
2775 goto error_ret;
2776
2777 - for (i = 0; i < num_read; i++)
2778 + for (i = 0; i < num_read / sizeof(u16); i++)
2779 *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i);
2780
2781 if (copy_to_user(buf, rx, num_read))
2782 diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
2783 index d7c5223f1c3e..2931ea9b75d1 100644
2784 --- a/drivers/staging/iio/adc/mxs-lradc.c
2785 +++ b/drivers/staging/iio/adc/mxs-lradc.c
2786 @@ -919,11 +919,12 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
2787 case IIO_CHAN_INFO_OFFSET:
2788 if (chan->type == IIO_TEMP) {
2789 /* The calculated value from the ADC is in Kelvin, we
2790 - * want Celsius for hwmon so the offset is
2791 - * -272.15 * scale
2792 + * want Celsius for hwmon so the offset is -273.15
2793 + * The offset is applied before scaling so it is
2794 + * actually -213.15 * 4 / 1.012 = -1079.644268
2795 */
2796 - *val = -1075;
2797 - *val2 = 691699;
2798 + *val = -1079;
2799 + *val2 = 644268;
2800
2801 return IIO_VAL_INT_PLUS_MICRO;
2802 }
2803 diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
2804 index 21d01a491405..e508939daea3 100644
2805 --- a/drivers/tty/serial/8250/8250_dma.c
2806 +++ b/drivers/tty/serial/8250/8250_dma.c
2807 @@ -80,10 +80,6 @@ int serial8250_tx_dma(struct uart_8250_port *p)
2808 return 0;
2809
2810 dma->tx_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
2811 - if (dma->tx_size < p->port.fifosize) {
2812 - ret = -EINVAL;
2813 - goto err;
2814 - }
2815
2816 desc = dmaengine_prep_slave_single(dma->txchan,
2817 dma->tx_addr + xmit->tail,
2818 diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
2819 index 9373cca121d3..eb8adc2e68c1 100644
2820 --- a/drivers/tty/serial/8250/8250_pci.c
2821 +++ b/drivers/tty/serial/8250/8250_pci.c
2822 @@ -1998,6 +1998,7 @@ pci_wch_ch38x_setup(struct serial_private *priv,
2823 #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250
2824 #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470
2825
2826 +#define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358
2827 #define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358
2828
2829 #define PCI_VENDOR_ID_PERICOM 0x12D8
2830 @@ -2515,6 +2516,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
2831 },
2832 {
2833 .vendor = PCI_VENDOR_ID_EXAR,
2834 + .device = PCI_DEVICE_ID_EXAR_XR17V4358,
2835 + .subvendor = PCI_ANY_ID,
2836 + .subdevice = PCI_ANY_ID,
2837 + .setup = pci_xr17v35x_setup,
2838 + },
2839 + {
2840 + .vendor = PCI_VENDOR_ID_EXAR,
2841 .device = PCI_DEVICE_ID_EXAR_XR17V8358,
2842 .subvendor = PCI_ANY_ID,
2843 .subdevice = PCI_ANY_ID,
2844 @@ -2999,6 +3007,7 @@ enum pci_board_num_t {
2845 pbn_exar_XR17V352,
2846 pbn_exar_XR17V354,
2847 pbn_exar_XR17V358,
2848 + pbn_exar_XR17V4358,
2849 pbn_exar_XR17V8358,
2850 pbn_exar_ibm_saturn,
2851 pbn_pasemi_1682M,
2852 @@ -3690,6 +3699,14 @@ static struct pciserial_board pci_boards[] = {
2853 .reg_shift = 0,
2854 .first_offset = 0,
2855 },
2856 + [pbn_exar_XR17V4358] = {
2857 + .flags = FL_BASE0,
2858 + .num_ports = 12,
2859 + .base_baud = 7812500,
2860 + .uart_offset = 0x400,
2861 + .reg_shift = 0,
2862 + .first_offset = 0,
2863 + },
2864 [pbn_exar_XR17V8358] = {
2865 .flags = FL_BASE0,
2866 .num_ports = 16,
2867 @@ -5133,6 +5150,10 @@ static struct pci_device_id serial_pci_tbl[] = {
2868 PCI_ANY_ID, PCI_ANY_ID,
2869 0,
2870 0, pbn_exar_XR17V358 },
2871 + { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V4358,
2872 + PCI_ANY_ID, PCI_ANY_ID,
2873 + 0,
2874 + 0, pbn_exar_XR17V4358 },
2875 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17V8358,
2876 PCI_ANY_ID, PCI_ANY_ID,
2877 0,
2878 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
2879 index 2af32e26fafc..7e5c90eebb9c 100644
2880 --- a/drivers/usb/host/xhci-pci.c
2881 +++ b/drivers/usb/host/xhci-pci.c
2882 @@ -135,6 +135,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
2883 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
2884 pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
2885 xhci->quirks |= XHCI_SPURIOUS_REBOOT;
2886 + xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
2887 }
2888 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
2889 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
2890 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
2891 index ad975a2975ca..41d7a05f8af4 100644
2892 --- a/drivers/usb/host/xhci-ring.c
2893 +++ b/drivers/usb/host/xhci-ring.c
2894 @@ -2239,6 +2239,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2895 u32 trb_comp_code;
2896 int ret = 0;
2897 int td_num = 0;
2898 + bool handling_skipped_tds = false;
2899
2900 slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
2901 xdev = xhci->devs[slot_id];
2902 @@ -2372,6 +2373,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2903 ep->skip = true;
2904 xhci_dbg(xhci, "Miss service interval error, set skip flag\n");
2905 goto cleanup;
2906 + case COMP_PING_ERR:
2907 + ep->skip = true;
2908 + xhci_dbg(xhci, "No Ping response error, Skip one Isoc TD\n");
2909 + goto cleanup;
2910 default:
2911 if (xhci_is_vendor_info_code(xhci, trb_comp_code)) {
2912 status = 0;
2913 @@ -2508,13 +2513,18 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2914 ep, &status);
2915
2916 cleanup:
2917 +
2918 +
2919 + handling_skipped_tds = ep->skip &&
2920 + trb_comp_code != COMP_MISSED_INT &&
2921 + trb_comp_code != COMP_PING_ERR;
2922 +
2923 /*
2924 - * Do not update event ring dequeue pointer if ep->skip is set.
2925 - * Will roll back to continue process missed tds.
2926 + * Do not update event ring dequeue pointer if we're in a loop
2927 + * processing missed tds.
2928 */
2929 - if (trb_comp_code == COMP_MISSED_INT || !ep->skip) {
2930 + if (!handling_skipped_tds)
2931 inc_deq(xhci, xhci->event_ring);
2932 - }
2933
2934 if (ret) {
2935 urb = td->urb;
2936 @@ -2549,7 +2559,7 @@ cleanup:
2937 * Process them as short transfer until reach the td pointed by
2938 * the event.
2939 */
2940 - } while (ep->skip && trb_comp_code != COMP_MISSED_INT);
2941 + } while (handling_skipped_tds);
2942
2943 return 0;
2944 }
2945 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
2946 index ebcec8cda858..f49d262e926b 100644
2947 --- a/drivers/usb/serial/qcserial.c
2948 +++ b/drivers/usb/serial/qcserial.c
2949 @@ -153,6 +153,8 @@ static const struct usb_device_id id_table[] = {
2950 {DEVICE_SWI(0x1199, 0x9056)}, /* Sierra Wireless Modem */
2951 {DEVICE_SWI(0x1199, 0x9060)}, /* Sierra Wireless Modem */
2952 {DEVICE_SWI(0x1199, 0x9061)}, /* Sierra Wireless Modem */
2953 + {DEVICE_SWI(0x1199, 0x9070)}, /* Sierra Wireless MC74xx/EM74xx */
2954 + {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx/EM74xx */
2955 {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
2956 {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
2957 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
2958 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
2959 index af3dd3c55ef1..8b2c82ce36b3 100644
2960 --- a/fs/btrfs/ioctl.c
2961 +++ b/fs/btrfs/ioctl.c
2962 @@ -4494,7 +4494,7 @@ locked:
2963
2964 if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) {
2965 ret = -EINVAL;
2966 - goto out_bargs;
2967 + goto out_bctl;
2968 }
2969
2970 do_balance:
2971 @@ -4508,12 +4508,15 @@ do_balance:
2972 need_unlock = false;
2973
2974 ret = btrfs_balance(bctl, bargs);
2975 + bctl = NULL;
2976
2977 if (arg) {
2978 if (copy_to_user(arg, bargs, sizeof(*bargs)))
2979 ret = -EFAULT;
2980 }
2981
2982 +out_bctl:
2983 + kfree(bctl);
2984 out_bargs:
2985 kfree(bargs);
2986 out_unlock:
2987 diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
2988 index 84d693d37428..871fcb67be97 100644
2989 --- a/fs/overlayfs/copy_up.c
2990 +++ b/fs/overlayfs/copy_up.c
2991 @@ -81,11 +81,11 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
2992 if (len == 0)
2993 return 0;
2994
2995 - old_file = ovl_path_open(old, O_RDONLY);
2996 + old_file = ovl_path_open(old, O_LARGEFILE | O_RDONLY);
2997 if (IS_ERR(old_file))
2998 return PTR_ERR(old_file);
2999
3000 - new_file = ovl_path_open(new, O_WRONLY);
3001 + new_file = ovl_path_open(new, O_LARGEFILE | O_WRONLY);
3002 if (IS_ERR(new_file)) {
3003 error = PTR_ERR(new_file);
3004 goto out_fput;
3005 @@ -267,7 +267,7 @@ out:
3006
3007 out_cleanup:
3008 ovl_cleanup(wdir, newdentry);
3009 - goto out;
3010 + goto out2;
3011 }
3012
3013 /*
3014 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
3015 index 33f2d27a6792..d74af7f78fec 100644
3016 --- a/fs/overlayfs/super.c
3017 +++ b/fs/overlayfs/super.c
3018 @@ -474,6 +474,7 @@ static void ovl_put_super(struct super_block *sb)
3019 mntput(ufs->upper_mnt);
3020 for (i = 0; i < ufs->numlower; i++)
3021 mntput(ufs->lower_mnt[i]);
3022 + kfree(ufs->lower_mnt);
3023
3024 kfree(ufs->config.lowerdir);
3025 kfree(ufs->config.upperdir);
3026 @@ -981,6 +982,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
3027 oe->lowerstack[i].dentry = stack[i].dentry;
3028 oe->lowerstack[i].mnt = ufs->lower_mnt[i];
3029 }
3030 + kfree(stack);
3031
3032 root_dentry->d_fsdata = oe;
3033
3034 diff --git a/include/sound/soc.h b/include/sound/soc.h
3035 index f6226914acfe..8d948aa9c5c9 100644
3036 --- a/include/sound/soc.h
3037 +++ b/include/sound/soc.h
3038 @@ -85,7 +85,7 @@
3039 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
3040 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
3041 .tlv.p = (tlv_array),\
3042 - .info = snd_soc_info_volsw, \
3043 + .info = snd_soc_info_volsw_sx, \
3044 .get = snd_soc_get_volsw_sx,\
3045 .put = snd_soc_put_volsw_sx, \
3046 .private_value = (unsigned long)&(struct soc_mixer_control) \
3047 @@ -155,7 +155,7 @@
3048 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
3049 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
3050 .tlv.p = (tlv_array), \
3051 - .info = snd_soc_info_volsw, \
3052 + .info = snd_soc_info_volsw_sx, \
3053 .get = snd_soc_get_volsw_sx, \
3054 .put = snd_soc_put_volsw_sx, \
3055 .private_value = (unsigned long)&(struct soc_mixer_control) \
3056 @@ -563,6 +563,8 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
3057 struct snd_ctl_elem_value *ucontrol);
3058 int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
3059 struct snd_ctl_elem_info *uinfo);
3060 +int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
3061 + struct snd_ctl_elem_info *uinfo);
3062 #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
3063 int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
3064 struct snd_ctl_elem_value *ucontrol);
3065 diff --git a/include/sound/wm8904.h b/include/sound/wm8904.h
3066 index 898be3a8db9a..6d8f8fba3341 100644
3067 --- a/include/sound/wm8904.h
3068 +++ b/include/sound/wm8904.h
3069 @@ -119,7 +119,7 @@
3070 #define WM8904_MIC_REGS 2
3071 #define WM8904_GPIO_REGS 4
3072 #define WM8904_DRC_REGS 4
3073 -#define WM8904_EQ_REGS 25
3074 +#define WM8904_EQ_REGS 24
3075
3076 /**
3077 * DRC configurations are specified with a label and a set of register
3078 diff --git a/kernel/module.c b/kernel/module.c
3079 index cfc9e843a924..3b9ff966edb9 100644
3080 --- a/kernel/module.c
3081 +++ b/kernel/module.c
3082 @@ -906,11 +906,15 @@ void symbol_put_addr(void *addr)
3083 if (core_kernel_text(a))
3084 return;
3085
3086 - /* module_text_address is safe here: we're supposed to have reference
3087 - * to module from symbol_get, so it can't go away. */
3088 + /*
3089 + * Even though we hold a reference on the module; we still need to
3090 + * disable preemption in order to safely traverse the data structure.
3091 + */
3092 + preempt_disable();
3093 modaddr = __module_text_address(a);
3094 BUG_ON(!modaddr);
3095 module_put(modaddr);
3096 + preempt_enable();
3097 }
3098 EXPORT_SYMBOL_GPL(symbol_put_addr);
3099
3100 diff --git a/lib/fault-inject.c b/lib/fault-inject.c
3101 index f1cdeb024d17..6a823a53e357 100644
3102 --- a/lib/fault-inject.c
3103 +++ b/lib/fault-inject.c
3104 @@ -44,7 +44,7 @@ static void fail_dump(struct fault_attr *attr)
3105 printk(KERN_NOTICE "FAULT_INJECTION: forcing a failure.\n"
3106 "name %pd, interval %lu, probability %lu, "
3107 "space %d, times %d\n", attr->dname,
3108 - attr->probability, attr->interval,
3109 + attr->interval, attr->probability,
3110 atomic_read(&attr->space),
3111 atomic_read(&attr->times));
3112 if (attr->verbose > 1)
3113 diff --git a/mm/filemap.c b/mm/filemap.c
3114 index 6bf5e42d560a..1ffef05f1c1f 100644
3115 --- a/mm/filemap.c
3116 +++ b/mm/filemap.c
3117 @@ -2461,6 +2461,11 @@ again:
3118 break;
3119 }
3120
3121 + if (fatal_signal_pending(current)) {
3122 + status = -EINTR;
3123 + break;
3124 + }
3125 +
3126 status = a_ops->write_begin(file, mapping, pos, bytes, flags,
3127 &page, &fsdata);
3128 if (unlikely(status < 0))
3129 @@ -2498,10 +2503,6 @@ again:
3130 written += copied;
3131
3132 balance_dirty_pages_ratelimited(mapping);
3133 - if (fatal_signal_pending(current)) {
3134 - status = -EINTR;
3135 - break;
3136 - }
3137 } while (iov_iter_count(i));
3138
3139 return written ? written : status;
3140 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
3141 index 078832cf3636..8e792ec5e84c 100644
3142 --- a/mm/huge_memory.c
3143 +++ b/mm/huge_memory.c
3144 @@ -2137,7 +2137,8 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
3145 for (_pte = pte; _pte < pte+HPAGE_PMD_NR;
3146 _pte++, address += PAGE_SIZE) {
3147 pte_t pteval = *_pte;
3148 - if (pte_none(pteval) || is_zero_pfn(pte_pfn(pteval))) {
3149 + if (pte_none(pteval) || (pte_present(pteval) &&
3150 + is_zero_pfn(pte_pfn(pteval)))) {
3151 if (++none_or_zero <= khugepaged_max_ptes_none)
3152 continue;
3153 else
3154 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
3155 index 36e8f1236637..57197bef5f5b 100644
3156 --- a/sound/pci/hda/hda_codec.c
3157 +++ b/sound/pci/hda/hda_codec.c
3158 @@ -3833,10 +3833,8 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec)
3159 return -EINVAL;
3160
3161 err = snd_hda_codec_parse_pcms(codec);
3162 - if (err < 0) {
3163 - snd_hda_codec_reset(codec);
3164 + if (err < 0)
3165 return err;
3166 - }
3167
3168 /* attach a new PCM streams */
3169 list_for_each_entry(cpcm, &codec->pcm_list_head, list) {
3170 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3171 index 06cc9d57ba3d..488f4c7be33e 100644
3172 --- a/sound/pci/hda/patch_conexant.c
3173 +++ b/sound/pci/hda/patch_conexant.c
3174 @@ -819,6 +819,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
3175 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410),
3176 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
3177 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD),
3178 + SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
3179 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
3180 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
3181 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
3182 diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
3183 index 100d92b5b77e..05977ae1ff2a 100644
3184 --- a/sound/soc/soc-ops.c
3185 +++ b/sound/soc/soc-ops.c
3186 @@ -207,6 +207,34 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
3187 EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
3188
3189 /**
3190 + * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls
3191 + * @kcontrol: mixer control
3192 + * @uinfo: control element information
3193 + *
3194 + * Callback to provide information about a single mixer control, or a double
3195 + * mixer control that spans 2 registers of the SX TLV type. SX TLV controls
3196 + * have a range that represents both positive and negative values either side
3197 + * of zero but without a sign bit.
3198 + *
3199 + * Returns 0 for success.
3200 + */
3201 +int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
3202 + struct snd_ctl_elem_info *uinfo)
3203 +{
3204 + struct soc_mixer_control *mc =
3205 + (struct soc_mixer_control *)kcontrol->private_value;
3206 +
3207 + snd_soc_info_volsw(kcontrol, uinfo);
3208 + /* Max represents the number of levels in an SX control not the
3209 + * maximum value, so add the minimum value back on
3210 + */
3211 + uinfo->value.integer.max += mc->min;
3212 +
3213 + return 0;
3214 +}
3215 +EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
3216 +
3217 +/**
3218 * snd_soc_get_volsw - single mixer get callback
3219 * @kcontrol: mixer control
3220 * @ucontrol: control element information