1 |
commit: 72138b802a224b0ea95043b560d2ff322de5e3e1 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 27 11:38:29 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 27 11:38:29 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=72138b80 |
7 |
|
8 |
Linux patch 5.4.174 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1173_linux-5.4.174.patch | 9538 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 9542 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 65d034ea..865a37b6 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -735,6 +735,10 @@ Patch: 1172_linux-5.4.173.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.173 |
23 |
|
24 |
+Patch: 1173_linux-5.4.174.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.174 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1173_linux-5.4.174.patch b/1173_linux-5.4.174.patch |
33 |
new file mode 100644 |
34 |
index 00000000..ae472e08 |
35 |
--- /dev/null |
36 |
+++ b/1173_linux-5.4.174.patch |
37 |
@@ -0,0 +1,9538 @@ |
38 |
+diff --git a/Documentation/admin-guide/hw-vuln/spectre.rst b/Documentation/admin-guide/hw-vuln/spectre.rst |
39 |
+index e05e581af5cfe..985181dba0bac 100644 |
40 |
+--- a/Documentation/admin-guide/hw-vuln/spectre.rst |
41 |
++++ b/Documentation/admin-guide/hw-vuln/spectre.rst |
42 |
+@@ -468,7 +468,7 @@ Spectre variant 2 |
43 |
+ before invoking any firmware code to prevent Spectre variant 2 exploits |
44 |
+ using the firmware. |
45 |
+ |
46 |
+- Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=y |
47 |
++ Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=y |
48 |
+ and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes |
49 |
+ attacks on the kernel generally more difficult. |
50 |
+ |
51 |
+diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml |
52 |
+index fb747682006d9..92dc08b78a176 100644 |
53 |
+--- a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml |
54 |
++++ b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml |
55 |
+@@ -10,6 +10,9 @@ title: Amlogic specific extensions to the Synopsys Designware HDMI Controller |
56 |
+ maintainers: |
57 |
+ - Neil Armstrong <narmstrong@××××××××.com> |
58 |
+ |
59 |
++allOf: |
60 |
++ - $ref: /schemas/sound/name-prefix.yaml# |
61 |
++ |
62 |
+ description: | |
63 |
+ The Amlogic Meson Synopsys Designware Integration is composed of |
64 |
+ - A Synopsys DesignWare HDMI Controller IP |
65 |
+@@ -101,6 +104,8 @@ properties: |
66 |
+ "#sound-dai-cells": |
67 |
+ const: 0 |
68 |
+ |
69 |
++ sound-name-prefix: true |
70 |
++ |
71 |
+ required: |
72 |
+ - compatible |
73 |
+ - reg |
74 |
+diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml |
75 |
+index d1205a6697a09..766b04501cb96 100644 |
76 |
+--- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml |
77 |
++++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml |
78 |
+@@ -78,6 +78,10 @@ properties: |
79 |
+ interrupts: |
80 |
+ maxItems: 1 |
81 |
+ |
82 |
++ amlogic,canvas: |
83 |
++ description: should point to a canvas provider node |
84 |
++ $ref: /schemas/types.yaml#/definitions/phandle |
85 |
++ |
86 |
+ power-domains: |
87 |
+ maxItems: 1 |
88 |
+ description: phandle to the associated power domain |
89 |
+@@ -106,6 +110,7 @@ required: |
90 |
+ - port@1 |
91 |
+ - "#address-cells" |
92 |
+ - "#size-cells" |
93 |
++ - amlogic,canvas |
94 |
+ |
95 |
+ examples: |
96 |
+ - | |
97 |
+@@ -116,6 +121,7 @@ examples: |
98 |
+ interrupts = <3>; |
99 |
+ #address-cells = <1>; |
100 |
+ #size-cells = <0>; |
101 |
++ amlogic,canvas = <&canvas>; |
102 |
+ |
103 |
+ /* CVBS VDAC output port */ |
104 |
+ port@0 { |
105 |
+diff --git a/Documentation/driver-api/dmaengine/dmatest.rst b/Documentation/driver-api/dmaengine/dmatest.rst |
106 |
+index ee268d445d38b..d2e1d8b58e7dc 100644 |
107 |
+--- a/Documentation/driver-api/dmaengine/dmatest.rst |
108 |
++++ b/Documentation/driver-api/dmaengine/dmatest.rst |
109 |
+@@ -143,13 +143,14 @@ Part 5 - Handling channel allocation |
110 |
+ Allocating Channels |
111 |
+ ------------------- |
112 |
+ |
113 |
+-Channels are required to be configured prior to starting the test run. |
114 |
+-Attempting to run the test without configuring the channels will fail. |
115 |
++Channels do not need to be configured prior to starting a test run. Attempting |
116 |
++to run the test without configuring the channels will result in testing any |
117 |
++channels that are available. |
118 |
+ |
119 |
+ Example:: |
120 |
+ |
121 |
+ % echo 1 > /sys/module/dmatest/parameters/run |
122 |
+- dmatest: Could not start test, no channels configured |
123 |
++ dmatest: No channels configured, continue with any |
124 |
+ |
125 |
+ Channels are registered using the "channel" parameter. Channels can be requested by their |
126 |
+ name, once requested, the channel is registered and a pending thread is added to the test list. |
127 |
+diff --git a/Documentation/driver-api/firewire.rst b/Documentation/driver-api/firewire.rst |
128 |
+index 94a2d7f01d999..d3cfa73cbb2b4 100644 |
129 |
+--- a/Documentation/driver-api/firewire.rst |
130 |
++++ b/Documentation/driver-api/firewire.rst |
131 |
+@@ -19,7 +19,7 @@ of kernel interfaces is available via exported symbols in `firewire-core` module |
132 |
+ Firewire char device data structures |
133 |
+ ==================================== |
134 |
+ |
135 |
+-.. include:: /ABI/stable/firewire-cdev |
136 |
++.. include:: ../ABI/stable/firewire-cdev |
137 |
+ :literal: |
138 |
+ |
139 |
+ .. kernel-doc:: include/uapi/linux/firewire-cdev.h |
140 |
+@@ -28,7 +28,7 @@ Firewire char device data structures |
141 |
+ Firewire device probing and sysfs interfaces |
142 |
+ ============================================ |
143 |
+ |
144 |
+-.. include:: /ABI/stable/sysfs-bus-firewire |
145 |
++.. include:: ../ABI/stable/sysfs-bus-firewire |
146 |
+ :literal: |
147 |
+ |
148 |
+ .. kernel-doc:: drivers/firewire/core-device.c |
149 |
+diff --git a/Documentation/firmware-guide/acpi/dsd/data-node-references.rst b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst |
150 |
+index febccbc5689d0..1b05e8d0ddff7 100644 |
151 |
+--- a/Documentation/firmware-guide/acpi/dsd/data-node-references.rst |
152 |
++++ b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst |
153 |
+@@ -5,7 +5,7 @@ |
154 |
+ Referencing hierarchical data nodes |
155 |
+ =================================== |
156 |
+ |
157 |
+-:Copyright: |copy| 2018 Intel Corporation |
158 |
++:Copyright: |copy| 2018, 2021 Intel Corporation |
159 |
+ :Author: Sakari Ailus <sakari.ailus@×××××××××××.com> |
160 |
+ |
161 |
+ ACPI in general allows referring to device objects in the tree only. |
162 |
+@@ -52,12 +52,14 @@ the ANOD object which is also the final target node of the reference. |
163 |
+ Name (NOD0, Package() { |
164 |
+ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
165 |
+ Package () { |
166 |
++ Package () { "reg", 0 }, |
167 |
+ Package () { "random-property", 3 }, |
168 |
+ } |
169 |
+ }) |
170 |
+ Name (NOD1, Package() { |
171 |
+ ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), |
172 |
+ Package () { |
173 |
++ Package () { "reg", 1 }, |
174 |
+ Package () { "anothernode", "ANOD" }, |
175 |
+ } |
176 |
+ }) |
177 |
+@@ -74,7 +76,11 @@ the ANOD object which is also the final target node of the reference. |
178 |
+ Name (_DSD, Package () { |
179 |
+ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), |
180 |
+ Package () { |
181 |
+- Package () { "reference", ^DEV0, "node@1", "anothernode" }, |
182 |
++ Package () { |
183 |
++ "reference", Package () { |
184 |
++ ^DEV0, "node@1", "anothernode" |
185 |
++ } |
186 |
++ }, |
187 |
+ } |
188 |
+ }) |
189 |
+ } |
190 |
+diff --git a/Makefile b/Makefile |
191 |
+index cb9e6cd0d0249..3075f06f77131 100644 |
192 |
+--- a/Makefile |
193 |
++++ b/Makefile |
194 |
+@@ -1,7 +1,7 @@ |
195 |
+ # SPDX-License-Identifier: GPL-2.0 |
196 |
+ VERSION = 5 |
197 |
+ PATCHLEVEL = 4 |
198 |
+-SUBLEVEL = 173 |
199 |
++SUBLEVEL = 174 |
200 |
+ EXTRAVERSION = |
201 |
+ NAME = Kleptomaniac Octopus |
202 |
+ |
203 |
+diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S |
204 |
+index a5983588f96b8..dd53d6eb53ade 100644 |
205 |
+--- a/arch/arm/boot/compressed/efi-header.S |
206 |
++++ b/arch/arm/boot/compressed/efi-header.S |
207 |
+@@ -9,16 +9,22 @@ |
208 |
+ #include <linux/sizes.h> |
209 |
+ |
210 |
+ .macro __nop |
211 |
+-#ifdef CONFIG_EFI_STUB |
212 |
+- @ This is almost but not quite a NOP, since it does clobber the |
213 |
+- @ condition flags. But it is the best we can do for EFI, since |
214 |
+- @ PE/COFF expects the magic string "MZ" at offset 0, while the |
215 |
+- @ ARM/Linux boot protocol expects an executable instruction |
216 |
+- @ there. |
217 |
+- .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 |
218 |
+-#else |
219 |
+ AR_CLASS( mov r0, r0 ) |
220 |
+ M_CLASS( nop.w ) |
221 |
++ .endm |
222 |
++ |
223 |
++ .macro __initial_nops |
224 |
++#ifdef CONFIG_EFI_STUB |
225 |
++ @ This is a two-instruction NOP, which happens to bear the |
226 |
++ @ PE/COFF signature "MZ" in the first two bytes, so the kernel |
227 |
++ @ is accepted as an EFI binary. Booting via the UEFI stub |
228 |
++ @ will not execute those instructions, but the ARM/Linux |
229 |
++ @ boot protocol does, so we need some NOPs here. |
230 |
++ .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 |
231 |
++ eor r5, r5, 0x4d000 @ undo previous insn |
232 |
++#else |
233 |
++ __nop |
234 |
++ __nop |
235 |
+ #endif |
236 |
+ .endm |
237 |
+ |
238 |
+diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S |
239 |
+index cbe126297f549..0a2410adc25b3 100644 |
240 |
+--- a/arch/arm/boot/compressed/head.S |
241 |
++++ b/arch/arm/boot/compressed/head.S |
242 |
+@@ -165,7 +165,8 @@ start: |
243 |
+ * were patching the initial instructions of the kernel, i.e |
244 |
+ * had started to exploit this "patch area". |
245 |
+ */ |
246 |
+- .rept 7 |
247 |
++ __initial_nops |
248 |
++ .rept 5 |
249 |
+ __nop |
250 |
+ .endr |
251 |
+ #ifndef CONFIG_THUMB2_KERNEL |
252 |
+diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi |
253 |
+index 669da3a33d82c..5b82e58a1cf06 100644 |
254 |
+--- a/arch/arm/boot/dts/armada-38x.dtsi |
255 |
++++ b/arch/arm/boot/dts/armada-38x.dtsi |
256 |
+@@ -165,7 +165,7 @@ |
257 |
+ }; |
258 |
+ |
259 |
+ uart0: serial@12000 { |
260 |
+- compatible = "marvell,armada-38x-uart"; |
261 |
++ compatible = "marvell,armada-38x-uart", "ns16550a"; |
262 |
+ reg = <0x12000 0x100>; |
263 |
+ reg-shift = <2>; |
264 |
+ interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; |
265 |
+@@ -175,7 +175,7 @@ |
266 |
+ }; |
267 |
+ |
268 |
+ uart1: serial@12100 { |
269 |
+- compatible = "marvell,armada-38x-uart"; |
270 |
++ compatible = "marvell,armada-38x-uart", "ns16550a"; |
271 |
+ reg = <0x12100 0x100>; |
272 |
+ reg-shift = <2>; |
273 |
+ interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; |
274 |
+diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemini-nas4220b.dts |
275 |
+index e1020e07e1366..60cec653ac7c6 100644 |
276 |
+--- a/arch/arm/boot/dts/gemini-nas4220b.dts |
277 |
++++ b/arch/arm/boot/dts/gemini-nas4220b.dts |
278 |
+@@ -84,7 +84,7 @@ |
279 |
+ partitions { |
280 |
+ compatible = "redboot-fis"; |
281 |
+ /* Eraseblock at 0xfe0000 */ |
282 |
+- fis-index-block = <0x1fc>; |
283 |
++ fis-index-block = <0x7f>; |
284 |
+ }; |
285 |
+ }; |
286 |
+ |
287 |
+diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c |
288 |
+index ee949255ced3f..09ef73b99dd86 100644 |
289 |
+--- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c |
290 |
++++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c |
291 |
+@@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void) |
292 |
+ return -ENODEV; |
293 |
+ |
294 |
+ for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) { |
295 |
+- if (!of_device_is_available(np)) |
296 |
++ if (!of_device_is_available(np)) { |
297 |
++ of_node_put(np); |
298 |
+ break; |
299 |
++ } |
300 |
+ |
301 |
+ ret = of_property_read_u32(np, "reg", &addr); |
302 |
+ if (ret) /* Skip invalid entry and continue */ |
303 |
+@@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) |
304 |
+ quirk = kzalloc(sizeof(*quirk), GFP_KERNEL); |
305 |
+ if (!quirk) { |
306 |
+ ret = -ENOMEM; |
307 |
++ of_node_put(np); |
308 |
+ goto err_mem; |
309 |
+ } |
310 |
+ |
311 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
312 |
+index e3d17569d98ad..e94f09c2d4e32 100644 |
313 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
314 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
315 |
+@@ -6,6 +6,7 @@ |
316 |
+ */ |
317 |
+ |
318 |
+ #include "meson-gxbb.dtsi" |
319 |
++#include <dt-bindings/gpio/gpio.h> |
320 |
+ |
321 |
+ / { |
322 |
+ aliases { |
323 |
+@@ -64,6 +65,7 @@ |
324 |
+ regulator-name = "VDDIO_AO18"; |
325 |
+ regulator-min-microvolt = <1800000>; |
326 |
+ regulator-max-microvolt = <1800000>; |
327 |
++ regulator-always-on; |
328 |
+ }; |
329 |
+ |
330 |
+ vcc_3v3: regulator-vcc_3v3 { |
331 |
+@@ -157,6 +159,7 @@ |
332 |
+ status = "okay"; |
333 |
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; |
334 |
+ pinctrl-names = "default"; |
335 |
++ hdmi-supply = <&vddio_ao18>; |
336 |
+ }; |
337 |
+ |
338 |
+ &hdmi_tx_tmds_port { |
339 |
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts |
340 |
+index 078a5010228cd..0b3a93c4155d2 100644 |
341 |
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts |
342 |
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts |
343 |
+@@ -161,11 +161,6 @@ |
344 |
+ vcc-supply = <&sb_3v3>; |
345 |
+ }; |
346 |
+ |
347 |
+- rtc@51 { |
348 |
+- compatible = "nxp,pcf2129"; |
349 |
+- reg = <0x51>; |
350 |
+- }; |
351 |
+- |
352 |
+ eeprom@56 { |
353 |
+ compatible = "atmel,24c512"; |
354 |
+ reg = <0x56>; |
355 |
+@@ -209,6 +204,15 @@ |
356 |
+ |
357 |
+ }; |
358 |
+ |
359 |
++&i2c1 { |
360 |
++ status = "okay"; |
361 |
++ |
362 |
++ rtc@51 { |
363 |
++ compatible = "nxp,pcf2129"; |
364 |
++ reg = <0x51>; |
365 |
++ }; |
366 |
++}; |
367 |
++ |
368 |
+ &enetc_port1 { |
369 |
+ phy-handle = <&qds_phy1>; |
370 |
+ phy-connection-type = "rgmii-id"; |
371 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
372 |
+index 9abf0cb1dd67f..4457262750734 100644 |
373 |
+--- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
374 |
++++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi |
375 |
+@@ -709,7 +709,7 @@ |
376 |
+ |
377 |
+ ccplex@e000000 { |
378 |
+ compatible = "nvidia,tegra186-ccplex-cluster"; |
379 |
+- reg = <0x0 0x0e000000 0x0 0x3fffff>; |
380 |
++ reg = <0x0 0x0e000000 0x0 0x400000>; |
381 |
+ |
382 |
+ nvidia,bpmp = <&bpmp>; |
383 |
+ }; |
384 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
385 |
+index 449843f2184d8..301c1c467c0b7 100644 |
386 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
387 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
388 |
+@@ -16,8 +16,8 @@ |
389 |
+ #size-cells = <2>; |
390 |
+ |
391 |
+ aliases { |
392 |
+- sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ |
393 |
+- sdhc2 = &sdhc_2; /* SDC2 SD card slot */ |
394 |
++ mmc0 = &sdhc_1; /* SDC1 eMMC slot */ |
395 |
++ mmc1 = &sdhc_2; /* SDC2 SD card slot */ |
396 |
+ }; |
397 |
+ |
398 |
+ chosen { }; |
399 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
400 |
+index d303df3887d9f..f1d3c51ea8d0d 100644 |
401 |
+--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi |
402 |
++++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
403 |
+@@ -2098,9 +2098,6 @@ |
404 |
+ nvmem-cells = <&gpu_speed_bin>; |
405 |
+ nvmem-cell-names = "speed_bin"; |
406 |
+ |
407 |
+- qcom,gpu-quirk-two-pass-use-wfi; |
408 |
+- qcom,gpu-quirk-fault-detect-mask; |
409 |
+- |
410 |
+ operating-points-v2 = <&gpu_opp_table>; |
411 |
+ |
412 |
+ gpu_opp_table: opp-table { |
413 |
+diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/k3-j721e.dtsi |
414 |
+index 43ea1ba979220..5a6e74636d6fc 100644 |
415 |
+--- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi |
416 |
++++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi |
417 |
+@@ -60,7 +60,7 @@ |
418 |
+ i-cache-sets = <256>; |
419 |
+ d-cache-size = <0x8000>; |
420 |
+ d-cache-line-size = <64>; |
421 |
+- d-cache-sets = <128>; |
422 |
++ d-cache-sets = <256>; |
423 |
+ next-level-cache = <&L2_0>; |
424 |
+ }; |
425 |
+ |
426 |
+@@ -74,7 +74,7 @@ |
427 |
+ i-cache-sets = <256>; |
428 |
+ d-cache-size = <0x8000>; |
429 |
+ d-cache-line-size = <64>; |
430 |
+- d-cache-sets = <128>; |
431 |
++ d-cache-sets = <256>; |
432 |
+ next-level-cache = <&L2_0>; |
433 |
+ }; |
434 |
+ }; |
435 |
+@@ -84,7 +84,7 @@ |
436 |
+ cache-level = <2>; |
437 |
+ cache-size = <0x100000>; |
438 |
+ cache-line-size = <64>; |
439 |
+- cache-sets = <2048>; |
440 |
++ cache-sets = <1024>; |
441 |
+ next-level-cache = <&msmc_l3>; |
442 |
+ }; |
443 |
+ |
444 |
+diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c |
445 |
+index 8a223d0e4918c..fa10d51f62177 100644 |
446 |
+--- a/arch/ia64/kernel/kprobes.c |
447 |
++++ b/arch/ia64/kernel/kprobes.c |
448 |
+@@ -396,10 +396,83 @@ static void kretprobe_trampoline(void) |
449 |
+ { |
450 |
+ } |
451 |
+ |
452 |
++/* |
453 |
++ * At this point the target function has been tricked into |
454 |
++ * returning into our trampoline. Lookup the associated instance |
455 |
++ * and then: |
456 |
++ * - call the handler function |
457 |
++ * - cleanup by marking the instance as unused |
458 |
++ * - long jump back to the original return address |
459 |
++ */ |
460 |
+ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) |
461 |
+ { |
462 |
+- regs->cr_iip = __kretprobe_trampoline_handler(regs, |
463 |
+- dereference_function_descriptor(kretprobe_trampoline), NULL); |
464 |
++ struct kretprobe_instance *ri = NULL; |
465 |
++ struct hlist_head *head, empty_rp; |
466 |
++ struct hlist_node *tmp; |
467 |
++ unsigned long flags, orig_ret_address = 0; |
468 |
++ unsigned long trampoline_address = |
469 |
++ (unsigned long)dereference_function_descriptor(kretprobe_trampoline); |
470 |
++ |
471 |
++ INIT_HLIST_HEAD(&empty_rp); |
472 |
++ kretprobe_hash_lock(current, &head, &flags); |
473 |
++ |
474 |
++ /* |
475 |
++ * It is possible to have multiple instances associated with a given |
476 |
++ * task either because an multiple functions in the call path |
477 |
++ * have a return probe installed on them, and/or more than one return |
478 |
++ * return probe was registered for a target function. |
479 |
++ * |
480 |
++ * We can handle this because: |
481 |
++ * - instances are always inserted at the head of the list |
482 |
++ * - when multiple return probes are registered for the same |
483 |
++ * function, the first instance's ret_addr will point to the |
484 |
++ * real return address, and all the rest will point to |
485 |
++ * kretprobe_trampoline |
486 |
++ */ |
487 |
++ hlist_for_each_entry_safe(ri, tmp, head, hlist) { |
488 |
++ if (ri->task != current) |
489 |
++ /* another task is sharing our hash bucket */ |
490 |
++ continue; |
491 |
++ |
492 |
++ orig_ret_address = (unsigned long)ri->ret_addr; |
493 |
++ if (orig_ret_address != trampoline_address) |
494 |
++ /* |
495 |
++ * This is the real return address. Any other |
496 |
++ * instances associated with this task are for |
497 |
++ * other calls deeper on the call stack |
498 |
++ */ |
499 |
++ break; |
500 |
++ } |
501 |
++ |
502 |
++ regs->cr_iip = orig_ret_address; |
503 |
++ |
504 |
++ hlist_for_each_entry_safe(ri, tmp, head, hlist) { |
505 |
++ if (ri->task != current) |
506 |
++ /* another task is sharing our hash bucket */ |
507 |
++ continue; |
508 |
++ |
509 |
++ if (ri->rp && ri->rp->handler) |
510 |
++ ri->rp->handler(ri, regs); |
511 |
++ |
512 |
++ orig_ret_address = (unsigned long)ri->ret_addr; |
513 |
++ recycle_rp_inst(ri, &empty_rp); |
514 |
++ |
515 |
++ if (orig_ret_address != trampoline_address) |
516 |
++ /* |
517 |
++ * This is the real return address. Any other |
518 |
++ * instances associated with this task are for |
519 |
++ * other calls deeper on the call stack |
520 |
++ */ |
521 |
++ break; |
522 |
++ } |
523 |
++ kretprobe_assert(ri, orig_ret_address, trampoline_address); |
524 |
++ |
525 |
++ kretprobe_hash_unlock(current, &flags); |
526 |
++ |
527 |
++ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { |
528 |
++ hlist_del(&ri->hlist); |
529 |
++ kfree(ri); |
530 |
++ } |
531 |
+ /* |
532 |
+ * By returning a non-zero value, we are telling |
533 |
+ * kprobe_handler() that we don't want the post_handler |
534 |
+@@ -412,7 +485,6 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, |
535 |
+ struct pt_regs *regs) |
536 |
+ { |
537 |
+ ri->ret_addr = (kprobe_opcode_t *)regs->b0; |
538 |
+- ri->fp = NULL; |
539 |
+ |
540 |
+ /* Replace the return addr with trampoline addr */ |
541 |
+ regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline); |
542 |
+diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c |
543 |
+index aba6e2d6a736c..dcfa0ea912fe1 100644 |
544 |
+--- a/arch/mips/bcm63xx/clk.c |
545 |
++++ b/arch/mips/bcm63xx/clk.c |
546 |
+@@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) |
547 |
+ } |
548 |
+ EXPORT_SYMBOL(clk_get_parent); |
549 |
+ |
550 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
551 |
++{ |
552 |
++ return 0; |
553 |
++} |
554 |
++EXPORT_SYMBOL(clk_set_parent); |
555 |
++ |
556 |
+ unsigned long clk_get_rate(struct clk *clk) |
557 |
+ { |
558 |
+ if (!clk) |
559 |
+diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c |
560 |
+index 51685f893eab0..c214fe4e678bb 100644 |
561 |
+--- a/arch/mips/cavium-octeon/octeon-platform.c |
562 |
++++ b/arch/mips/cavium-octeon/octeon-platform.c |
563 |
+@@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void) |
564 |
+ |
565 |
+ pd->dev.platform_data = &octeon_ehci_pdata; |
566 |
+ octeon_ehci_hw_start(&pd->dev); |
567 |
++ put_device(&pd->dev); |
568 |
+ |
569 |
+ return ret; |
570 |
+ } |
571 |
+@@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void) |
572 |
+ |
573 |
+ pd->dev.platform_data = &octeon_ohci_pdata; |
574 |
+ octeon_ohci_hw_start(&pd->dev); |
575 |
++ put_device(&pd->dev); |
576 |
+ |
577 |
+ return ret; |
578 |
+ } |
579 |
+diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c |
580 |
+index 4017398519cf9..e092d86e63581 100644 |
581 |
+--- a/arch/mips/cavium-octeon/octeon-usb.c |
582 |
++++ b/arch/mips/cavium-octeon/octeon-usb.c |
583 |
+@@ -544,6 +544,7 @@ static int __init dwc3_octeon_device_init(void) |
584 |
+ devm_iounmap(&pdev->dev, base); |
585 |
+ devm_release_mem_region(&pdev->dev, res->start, |
586 |
+ resource_size(res)); |
587 |
++ put_device(&pdev->dev); |
588 |
+ } |
589 |
+ } while (node != NULL); |
590 |
+ |
591 |
+diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
592 |
+index 62787765575ef..ce6e5fddce0bf 100644 |
593 |
+--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
594 |
++++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
595 |
+@@ -315,7 +315,7 @@ enum cvmx_chip_types_enum { |
596 |
+ |
597 |
+ /* Functions to return string based on type */ |
598 |
+ #define ENUM_BRD_TYPE_CASE(x) \ |
599 |
+- case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ |
600 |
++ case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ |
601 |
+ static inline const char *cvmx_board_type_to_string(enum |
602 |
+ cvmx_board_types_enum type) |
603 |
+ { |
604 |
+@@ -404,7 +404,7 @@ static inline const char *cvmx_board_type_to_string(enum |
605 |
+ } |
606 |
+ |
607 |
+ #define ENUM_CHIP_TYPE_CASE(x) \ |
608 |
+- case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ |
609 |
++ case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ |
610 |
+ static inline const char *cvmx_chip_type_to_string(enum |
611 |
+ cvmx_chip_types_enum type) |
612 |
+ { |
613 |
+diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c |
614 |
+index 4916cccf378fd..7a623684d9b5e 100644 |
615 |
+--- a/arch/mips/lantiq/clk.c |
616 |
++++ b/arch/mips/lantiq/clk.c |
617 |
+@@ -164,6 +164,12 @@ struct clk *clk_get_parent(struct clk *clk) |
618 |
+ } |
619 |
+ EXPORT_SYMBOL(clk_get_parent); |
620 |
+ |
621 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
622 |
++{ |
623 |
++ return 0; |
624 |
++} |
625 |
++EXPORT_SYMBOL(clk_set_parent); |
626 |
++ |
627 |
+ static inline u32 get_counter_resolution(void) |
628 |
+ { |
629 |
+ u32 res; |
630 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
631 |
+index 82fc011894889..2a1060d747a5d 100644 |
632 |
+--- a/arch/parisc/kernel/traps.c |
633 |
++++ b/arch/parisc/kernel/traps.c |
634 |
+@@ -783,7 +783,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
635 |
+ * unless pagefault_disable() was called before. |
636 |
+ */ |
637 |
+ |
638 |
+- if (fault_space == 0 && !faulthandler_disabled()) |
639 |
++ if (faulthandler_disabled() || fault_space == 0) |
640 |
+ { |
641 |
+ /* Clean up and return if in exception table. */ |
642 |
+ if (fixup_exception(regs)) |
643 |
+diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
644 |
+index c90702b04a530..48e5cd61599c6 100644 |
645 |
+--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
646 |
++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
647 |
+@@ -79,6 +79,7 @@ fman0: fman@400000 { |
648 |
+ #size-cells = <0>; |
649 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
650 |
+ reg = <0xfc000 0x1000>; |
651 |
++ fsl,erratum-a009885; |
652 |
+ }; |
653 |
+ |
654 |
+ xmdio0: mdio@fd000 { |
655 |
+@@ -86,6 +87,7 @@ fman0: fman@400000 { |
656 |
+ #size-cells = <0>; |
657 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
658 |
+ reg = <0xfd000 0x1000>; |
659 |
++ fsl,erratum-a009885; |
660 |
+ }; |
661 |
+ }; |
662 |
+ |
663 |
+diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c |
664 |
+index 6dfceaa820e42..b0e0b3cd91eec 100644 |
665 |
+--- a/arch/powerpc/kernel/btext.c |
666 |
++++ b/arch/powerpc/kernel/btext.c |
667 |
+@@ -250,8 +250,10 @@ int __init btext_find_display(int allow_nonstdout) |
668 |
+ rc = btext_initialize(np); |
669 |
+ printk("result: %d\n", rc); |
670 |
+ } |
671 |
+- if (rc == 0) |
672 |
++ if (rc == 0) { |
673 |
++ of_node_put(np); |
674 |
+ break; |
675 |
++ } |
676 |
+ } |
677 |
+ return rc; |
678 |
+ } |
679 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
680 |
+index 1b65fb7c0bdaa..7f4e2c031a9ab 100644 |
681 |
+--- a/arch/powerpc/kernel/prom_init.c |
682 |
++++ b/arch/powerpc/kernel/prom_init.c |
683 |
+@@ -2919,7 +2919,7 @@ static void __init fixup_device_tree_efika_add_phy(void) |
684 |
+ |
685 |
+ /* Check if the phy-handle property exists - bail if it does */ |
686 |
+ rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); |
687 |
+- if (!rv) |
688 |
++ if (rv <= 0) |
689 |
+ return; |
690 |
+ |
691 |
+ /* |
692 |
+diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c |
693 |
+index c06cac543f188..4de63ec2e1551 100644 |
694 |
+--- a/arch/powerpc/kernel/smp.c |
695 |
++++ b/arch/powerpc/kernel/smp.c |
696 |
+@@ -582,6 +582,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) |
697 |
+ } |
698 |
+ #endif |
699 |
+ |
700 |
++#ifdef CONFIG_NMI_IPI |
701 |
++static void crash_stop_this_cpu(struct pt_regs *regs) |
702 |
++#else |
703 |
++static void crash_stop_this_cpu(void *dummy) |
704 |
++#endif |
705 |
++{ |
706 |
++ /* |
707 |
++ * Just busy wait here and avoid marking CPU as offline to ensure |
708 |
++ * register data is captured appropriately. |
709 |
++ */ |
710 |
++ while (1) |
711 |
++ cpu_relax(); |
712 |
++} |
713 |
++ |
714 |
++void crash_smp_send_stop(void) |
715 |
++{ |
716 |
++ static bool stopped = false; |
717 |
++ |
718 |
++ if (stopped) |
719 |
++ return; |
720 |
++ |
721 |
++ stopped = true; |
722 |
++ |
723 |
++#ifdef CONFIG_NMI_IPI |
724 |
++ smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); |
725 |
++#else |
726 |
++ smp_call_function(crash_stop_this_cpu, NULL, 0); |
727 |
++#endif /* CONFIG_NMI_IPI */ |
728 |
++} |
729 |
++ |
730 |
+ #ifdef CONFIG_NMI_IPI |
731 |
+ static void nmi_stop_this_cpu(struct pt_regs *regs) |
732 |
+ { |
733 |
+@@ -1296,10 +1326,12 @@ void start_secondary(void *unused) |
734 |
+ BUG(); |
735 |
+ } |
736 |
+ |
737 |
++#ifdef CONFIG_PROFILING |
738 |
+ int setup_profiling_timer(unsigned int multiplier) |
739 |
+ { |
740 |
+ return 0; |
741 |
+ } |
742 |
++#endif |
743 |
+ |
744 |
+ #ifdef CONFIG_SCHED_SMT |
745 |
+ /* cpumask of CPUs with asymetric SMT dependancy */ |
746 |
+diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c |
747 |
+index af3c15a1d41eb..75b2a6c4db5a5 100644 |
748 |
+--- a/arch/powerpc/kernel/watchdog.c |
749 |
++++ b/arch/powerpc/kernel/watchdog.c |
750 |
+@@ -132,6 +132,10 @@ static void set_cpumask_stuck(const struct cpumask *cpumask, u64 tb) |
751 |
+ { |
752 |
+ cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); |
753 |
+ cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); |
754 |
++ /* |
755 |
++ * See wd_smp_clear_cpu_pending() |
756 |
++ */ |
757 |
++ smp_mb(); |
758 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
759 |
+ wd_smp_last_reset_tb = tb; |
760 |
+ cpumask_andnot(&wd_smp_cpus_pending, |
761 |
+@@ -217,13 +221,44 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb) |
762 |
+ |
763 |
+ cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); |
764 |
+ wd_smp_unlock(&flags); |
765 |
++ } else { |
766 |
++ /* |
767 |
++ * The last CPU to clear pending should have reset the |
768 |
++ * watchdog so we generally should not find it empty |
769 |
++ * here if our CPU was clear. However it could happen |
770 |
++ * due to a rare race with another CPU taking the |
771 |
++ * last CPU out of the mask concurrently. |
772 |
++ * |
773 |
++ * We can't add a warning for it. But just in case |
774 |
++ * there is a problem with the watchdog that is causing |
775 |
++ * the mask to not be reset, try to kick it along here. |
776 |
++ */ |
777 |
++ if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) |
778 |
++ goto none_pending; |
779 |
+ } |
780 |
+ return; |
781 |
+ } |
782 |
++ |
783 |
+ cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); |
784 |
++ |
785 |
++ /* |
786 |
++ * Order the store to clear pending with the load(s) to check all |
787 |
++ * words in the pending mask to check they are all empty. This orders |
788 |
++ * with the same barrier on another CPU. This prevents two CPUs |
789 |
++ * clearing the last 2 pending bits, but neither seeing the other's |
790 |
++ * store when checking if the mask is empty, and missing an empty |
791 |
++ * mask, which ends with a false positive. |
792 |
++ */ |
793 |
++ smp_mb(); |
794 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
795 |
+ unsigned long flags; |
796 |
+ |
797 |
++none_pending: |
798 |
++ /* |
799 |
++ * Double check under lock because more than one CPU could see |
800 |
++ * a clear mask with the lockless check after clearing their |
801 |
++ * pending bits. |
802 |
++ */ |
803 |
+ wd_smp_lock(&flags); |
804 |
+ if (cpumask_empty(&wd_smp_cpus_pending)) { |
805 |
+ wd_smp_last_reset_tb = tb; |
806 |
+@@ -314,8 +349,12 @@ void arch_touch_nmi_watchdog(void) |
807 |
+ { |
808 |
+ unsigned long ticks = tb_ticks_per_usec * wd_timer_period_ms * 1000; |
809 |
+ int cpu = smp_processor_id(); |
810 |
+- u64 tb = get_tb(); |
811 |
++ u64 tb; |
812 |
+ |
813 |
++ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
814 |
++ return; |
815 |
++ |
816 |
++ tb = get_tb(); |
817 |
+ if (tb - per_cpu(wd_timer_tb, cpu) >= ticks) { |
818 |
+ per_cpu(wd_timer_tb, cpu) = tb; |
819 |
+ wd_smp_clear_cpu_pending(cpu, tb); |
820 |
+diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c |
821 |
+index 9906d203d9d39..613d24b707abe 100644 |
822 |
+--- a/arch/powerpc/kvm/book3s_hv_nested.c |
823 |
++++ b/arch/powerpc/kvm/book3s_hv_nested.c |
824 |
+@@ -510,7 +510,7 @@ long kvmhv_copy_tofrom_guest_nested(struct kvm_vcpu *vcpu) |
825 |
+ if (eaddr & (0xFFFUL << 52)) |
826 |
+ return H_PARAMETER; |
827 |
+ |
828 |
+- buf = kzalloc(n, GFP_KERNEL); |
829 |
++ buf = kzalloc(n, GFP_KERNEL | __GFP_NOWARN); |
830 |
+ if (!buf) |
831 |
+ return H_NO_MEM; |
832 |
+ |
833 |
+diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c |
834 |
+index ca9ffc1c8685d..a6a60e2b8f453 100644 |
835 |
+--- a/arch/powerpc/platforms/cell/iommu.c |
836 |
++++ b/arch/powerpc/platforms/cell/iommu.c |
837 |
+@@ -976,6 +976,7 @@ static int __init cell_iommu_fixed_mapping_init(void) |
838 |
+ if (hbase < dbase || (hend > (dbase + dsize))) { |
839 |
+ pr_debug("iommu: hash window doesn't fit in" |
840 |
+ "real DMA window\n"); |
841 |
++ of_node_put(np); |
842 |
+ return -1; |
843 |
+ } |
844 |
+ } |
845 |
+diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c |
846 |
+index 6af3a6e600a70..80c9c4d715505 100644 |
847 |
+--- a/arch/powerpc/platforms/cell/pervasive.c |
848 |
++++ b/arch/powerpc/platforms/cell/pervasive.c |
849 |
+@@ -77,6 +77,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs) |
850 |
+ switch (regs->msr & SRR1_WAKEMASK) { |
851 |
+ case SRR1_WAKEDEC: |
852 |
+ set_dec(1); |
853 |
++ break; |
854 |
+ case SRR1_WAKEEE: |
855 |
+ /* |
856 |
+ * Handle these when interrupts get re-enabled and we take |
857 |
+diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
858 |
+index a1b7f79a8a152..de10c13de15c6 100644 |
859 |
+--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
860 |
++++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
861 |
+@@ -215,6 +215,7 @@ void hlwd_pic_probe(void) |
862 |
+ irq_set_chained_handler(cascade_virq, |
863 |
+ hlwd_pic_irq_cascade); |
864 |
+ hlwd_irq_host = host; |
865 |
++ of_node_put(np); |
866 |
+ break; |
867 |
+ } |
868 |
+ } |
869 |
+diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c |
870 |
+index bf4be4b53b44d..210435a43bf95 100644 |
871 |
+--- a/arch/powerpc/platforms/powermac/low_i2c.c |
872 |
++++ b/arch/powerpc/platforms/powermac/low_i2c.c |
873 |
+@@ -582,6 +582,7 @@ static void __init kw_i2c_add(struct pmac_i2c_host_kw *host, |
874 |
+ bus->close = kw_i2c_close; |
875 |
+ bus->xfer = kw_i2c_xfer; |
876 |
+ mutex_init(&bus->mutex); |
877 |
++ lockdep_register_key(&bus->lock_key); |
878 |
+ lockdep_set_class(&bus->mutex, &bus->lock_key); |
879 |
+ if (controller == busnode) |
880 |
+ bus->flags = pmac_i2c_multibus; |
881 |
+@@ -811,6 +812,7 @@ static void __init pmu_i2c_probe(void) |
882 |
+ bus->hostdata = bus + 1; |
883 |
+ bus->xfer = pmu_i2c_xfer; |
884 |
+ mutex_init(&bus->mutex); |
885 |
++ lockdep_register_key(&bus->lock_key); |
886 |
+ lockdep_set_class(&bus->mutex, &bus->lock_key); |
887 |
+ bus->flags = pmac_i2c_multibus; |
888 |
+ list_add(&bus->link, &pmac_i2c_busses); |
889 |
+@@ -934,6 +936,7 @@ static void __init smu_i2c_probe(void) |
890 |
+ bus->hostdata = bus + 1; |
891 |
+ bus->xfer = smu_i2c_xfer; |
892 |
+ mutex_init(&bus->mutex); |
893 |
++ lockdep_register_key(&bus->lock_key); |
894 |
+ lockdep_set_class(&bus->mutex, &bus->lock_key); |
895 |
+ bus->flags = 0; |
896 |
+ list_add(&bus->link, &pmac_i2c_busses); |
897 |
+diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c |
898 |
+index 608569082ba0b..123a0e799b7bd 100644 |
899 |
+--- a/arch/powerpc/platforms/powernv/opal-lpc.c |
900 |
++++ b/arch/powerpc/platforms/powernv/opal-lpc.c |
901 |
+@@ -396,6 +396,7 @@ void __init opal_lpc_init(void) |
902 |
+ if (!of_get_property(np, "primary", NULL)) |
903 |
+ continue; |
904 |
+ opal_lpc_chip_id = of_get_ibm_chip_id(np); |
905 |
++ of_node_put(np); |
906 |
+ break; |
907 |
+ } |
908 |
+ if (opal_lpc_chip_id < 0) |
909 |
+diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c |
910 |
+index 46071be897ab0..90943bf3e5eec 100644 |
911 |
+--- a/arch/s390/mm/pgalloc.c |
912 |
++++ b/arch/s390/mm/pgalloc.c |
913 |
+@@ -255,13 +255,15 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) |
914 |
+ /* Free 2K page table fragment of a 4K page */ |
915 |
+ bit = (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); |
916 |
+ spin_lock_bh(&mm->context.lock); |
917 |
+- mask = atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); |
918 |
++ mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); |
919 |
+ mask >>= 24; |
920 |
+ if (mask & 3) |
921 |
+ list_add(&page->lru, &mm->context.pgtable_list); |
922 |
+ else |
923 |
+ list_del(&page->lru); |
924 |
+ spin_unlock_bh(&mm->context.lock); |
925 |
++ mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); |
926 |
++ mask >>= 24; |
927 |
+ if (mask != 0) |
928 |
+ return; |
929 |
+ } else { |
930 |
+diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h |
931 |
+index 0c50fa6e8a55b..fbb709a222839 100644 |
932 |
+--- a/arch/um/include/shared/registers.h |
933 |
++++ b/arch/um/include/shared/registers.h |
934 |
+@@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); |
935 |
+ extern int save_fpx_registers(int pid, unsigned long *fp_regs); |
936 |
+ extern int restore_fpx_registers(int pid, unsigned long *fp_regs); |
937 |
+ extern int save_registers(int pid, struct uml_pt_regs *regs); |
938 |
+-extern int restore_registers(int pid, struct uml_pt_regs *regs); |
939 |
+-extern int init_registers(int pid); |
940 |
++extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); |
941 |
++extern int init_pid_registers(int pid); |
942 |
+ extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); |
943 |
+ extern unsigned long get_thread_reg(int reg, jmp_buf *buf); |
944 |
+ extern int get_fp_registers(int pid, unsigned long *regs); |
945 |
+diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c |
946 |
+index 2d9270508e156..b123955be7acc 100644 |
947 |
+--- a/arch/um/os-Linux/registers.c |
948 |
++++ b/arch/um/os-Linux/registers.c |
949 |
+@@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) |
950 |
+ return 0; |
951 |
+ } |
952 |
+ |
953 |
+-int restore_registers(int pid, struct uml_pt_regs *regs) |
954 |
++int restore_pid_registers(int pid, struct uml_pt_regs *regs) |
955 |
+ { |
956 |
+ int err; |
957 |
+ |
958 |
+@@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) |
959 |
+ static unsigned long exec_regs[MAX_REG_NR]; |
960 |
+ static unsigned long exec_fp_regs[FP_SIZE]; |
961 |
+ |
962 |
+-int init_registers(int pid) |
963 |
++int init_pid_registers(int pid) |
964 |
+ { |
965 |
+ int err; |
966 |
+ |
967 |
+diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c |
968 |
+index f79dc338279e6..b28373a2b8d2d 100644 |
969 |
+--- a/arch/um/os-Linux/start_up.c |
970 |
++++ b/arch/um/os-Linux/start_up.c |
971 |
+@@ -336,7 +336,7 @@ void __init os_early_checks(void) |
972 |
+ check_tmpexec(); |
973 |
+ |
974 |
+ pid = start_ptraced_child(); |
975 |
+- if (init_registers(pid)) |
976 |
++ if (init_pid_registers(pid)) |
977 |
+ fatal("Failed to initialize default registers"); |
978 |
+ stop_ptraced_child(pid, 1, 1); |
979 |
+ } |
980 |
+diff --git a/arch/x86/include/asm/realmode.h b/arch/x86/include/asm/realmode.h |
981 |
+index 09ecc32f65248..52d7512ea91ab 100644 |
982 |
+--- a/arch/x86/include/asm/realmode.h |
983 |
++++ b/arch/x86/include/asm/realmode.h |
984 |
+@@ -82,6 +82,7 @@ static inline void set_real_mode_mem(phys_addr_t mem) |
985 |
+ } |
986 |
+ |
987 |
+ void reserve_real_mode(void); |
988 |
++void load_trampoline_pgtable(void); |
989 |
+ |
990 |
+ #endif /* __ASSEMBLY__ */ |
991 |
+ |
992 |
+diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c |
993 |
+index c2a9762d278dd..8a2b8e7913149 100644 |
994 |
+--- a/arch/x86/kernel/cpu/mce/core.c |
995 |
++++ b/arch/x86/kernel/cpu/mce/core.c |
996 |
+@@ -310,11 +310,17 @@ static void wait_for_panic(void) |
997 |
+ panic("Panicing machine check CPU died"); |
998 |
+ } |
999 |
+ |
1000 |
+-static void mce_panic(const char *msg, struct mce *final, char *exp) |
1001 |
++static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) |
1002 |
+ { |
1003 |
+- int apei_err = 0; |
1004 |
+ struct llist_node *pending; |
1005 |
+ struct mce_evt_llist *l; |
1006 |
++ int apei_err = 0; |
1007 |
++ |
1008 |
++ /* |
1009 |
++ * Allow instrumentation around external facilities usage. Not that it |
1010 |
++ * matters a whole lot since the machine is going to panic anyway. |
1011 |
++ */ |
1012 |
++ instrumentation_begin(); |
1013 |
+ |
1014 |
+ if (!fake_panic) { |
1015 |
+ /* |
1016 |
+@@ -329,7 +335,7 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) |
1017 |
+ } else { |
1018 |
+ /* Don't log too much for fake panic */ |
1019 |
+ if (atomic_inc_return(&mce_fake_panicked) > 1) |
1020 |
+- return; |
1021 |
++ goto out; |
1022 |
+ } |
1023 |
+ pending = mce_gen_pool_prepare_records(); |
1024 |
+ /* First print corrected ones that are still unlogged */ |
1025 |
+@@ -367,6 +373,9 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) |
1026 |
+ panic(msg); |
1027 |
+ } else |
1028 |
+ pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); |
1029 |
++ |
1030 |
++out: |
1031 |
++ instrumentation_end(); |
1032 |
+ } |
1033 |
+ |
1034 |
+ /* Support code for software error injection */ |
1035 |
+@@ -691,7 +700,7 @@ static struct notifier_block mce_default_nb = { |
1036 |
+ /* |
1037 |
+ * Read ADDR and MISC registers. |
1038 |
+ */ |
1039 |
+-static void mce_read_aux(struct mce *m, int i) |
1040 |
++static noinstr void mce_read_aux(struct mce *m, int i) |
1041 |
+ { |
1042 |
+ if (m->status & MCI_STATUS_MISCV) |
1043 |
+ m->misc = mce_rdmsrl(msr_ops.misc(i)); |
1044 |
+@@ -1071,10 +1080,13 @@ static int mce_start(int *no_way_out) |
1045 |
+ * Synchronize between CPUs after main scanning loop. |
1046 |
+ * This invokes the bulk of the Monarch processing. |
1047 |
+ */ |
1048 |
+-static int mce_end(int order) |
1049 |
++static noinstr int mce_end(int order) |
1050 |
+ { |
1051 |
+- int ret = -1; |
1052 |
+ u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; |
1053 |
++ int ret = -1; |
1054 |
++ |
1055 |
++ /* Allow instrumentation around external facilities. */ |
1056 |
++ instrumentation_begin(); |
1057 |
+ |
1058 |
+ if (!timeout) |
1059 |
+ goto reset; |
1060 |
+@@ -1118,7 +1130,8 @@ static int mce_end(int order) |
1061 |
+ /* |
1062 |
+ * Don't reset anything. That's done by the Monarch. |
1063 |
+ */ |
1064 |
+- return 0; |
1065 |
++ ret = 0; |
1066 |
++ goto out; |
1067 |
+ } |
1068 |
+ |
1069 |
+ /* |
1070 |
+@@ -1133,6 +1146,10 @@ reset: |
1071 |
+ * Let others run again. |
1072 |
+ */ |
1073 |
+ atomic_set(&mce_executing, 0); |
1074 |
++ |
1075 |
++out: |
1076 |
++ instrumentation_end(); |
1077 |
++ |
1078 |
+ return ret; |
1079 |
+ } |
1080 |
+ |
1081 |
+diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c |
1082 |
+index eb2d41c1816d6..e1fda5b19b6f6 100644 |
1083 |
+--- a/arch/x86/kernel/cpu/mce/inject.c |
1084 |
++++ b/arch/x86/kernel/cpu/mce/inject.c |
1085 |
+@@ -347,7 +347,7 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf, |
1086 |
+ char buf[MAX_FLAG_OPT_SIZE], *__buf; |
1087 |
+ int err; |
1088 |
+ |
1089 |
+- if (cnt > MAX_FLAG_OPT_SIZE) |
1090 |
++ if (!cnt || cnt > MAX_FLAG_OPT_SIZE) |
1091 |
+ return -EINVAL; |
1092 |
+ |
1093 |
+ if (copy_from_user(&buf, ubuf, cnt)) |
1094 |
+diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c |
1095 |
+index 6f6b1d04dadf9..50225bc0383b9 100644 |
1096 |
+--- a/arch/x86/kernel/early-quirks.c |
1097 |
++++ b/arch/x86/kernel/early-quirks.c |
1098 |
+@@ -515,6 +515,7 @@ static const struct intel_early_ops gen11_early_ops __initconst = { |
1099 |
+ .stolen_size = gen9_stolen_size, |
1100 |
+ }; |
1101 |
+ |
1102 |
++/* Intel integrated GPUs for which we need to reserve "stolen memory" */ |
1103 |
+ static const struct pci_device_id intel_early_ids[] __initconst = { |
1104 |
+ INTEL_I830_IDS(&i830_early_ops), |
1105 |
+ INTEL_I845G_IDS(&i845_early_ops), |
1106 |
+@@ -587,6 +588,13 @@ static void __init intel_graphics_quirks(int num, int slot, int func) |
1107 |
+ u16 device; |
1108 |
+ int i; |
1109 |
+ |
1110 |
++ /* |
1111 |
++ * Reserve "stolen memory" for an integrated GPU. If we've already |
1112 |
++ * found one, there's nothing to do for other (discrete) GPUs. |
1113 |
++ */ |
1114 |
++ if (resource_size(&intel_graphics_stolen_res)) |
1115 |
++ return; |
1116 |
++ |
1117 |
+ device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); |
1118 |
+ |
1119 |
+ for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) { |
1120 |
+@@ -699,7 +707,7 @@ static struct chipset early_qrk[] __initdata = { |
1121 |
+ { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, |
1122 |
+ PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, |
1123 |
+ { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, |
1124 |
+- QFLAG_APPLY_ONCE, intel_graphics_quirks }, |
1125 |
++ 0, intel_graphics_quirks }, |
1126 |
+ /* |
1127 |
+ * HPET on the current version of the Baytrail platform has accuracy |
1128 |
+ * problems: it will halt in deep idle state - so we disable it. |
1129 |
+diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
1130 |
+index d65d1afb27161..fdef27a84d713 100644 |
1131 |
+--- a/arch/x86/kernel/reboot.c |
1132 |
++++ b/arch/x86/kernel/reboot.c |
1133 |
+@@ -113,17 +113,9 @@ void __noreturn machine_real_restart(unsigned int type) |
1134 |
+ spin_unlock(&rtc_lock); |
1135 |
+ |
1136 |
+ /* |
1137 |
+- * Switch back to the initial page table. |
1138 |
++ * Switch to the trampoline page table. |
1139 |
+ */ |
1140 |
+-#ifdef CONFIG_X86_32 |
1141 |
+- load_cr3(initial_page_table); |
1142 |
+-#else |
1143 |
+- write_cr3(real_mode_header->trampoline_pgd); |
1144 |
+- |
1145 |
+- /* Exiting long mode will fail if CR4.PCIDE is set. */ |
1146 |
+- if (boot_cpu_has(X86_FEATURE_PCID)) |
1147 |
+- cr4_clear_bits(X86_CR4_PCIDE); |
1148 |
+-#endif |
1149 |
++ load_trampoline_pgtable(); |
1150 |
+ |
1151 |
+ /* Jump to the identity-mapped low memory code */ |
1152 |
+ #ifdef CONFIG_X86_32 |
1153 |
+diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c |
1154 |
+index de371e52cfa85..fac50ebb122b5 100644 |
1155 |
+--- a/arch/x86/realmode/init.c |
1156 |
++++ b/arch/x86/realmode/init.c |
1157 |
+@@ -16,6 +16,32 @@ u32 *trampoline_cr4_features; |
1158 |
+ /* Hold the pgd entry used on booting additional CPUs */ |
1159 |
+ pgd_t trampoline_pgd_entry; |
1160 |
+ |
1161 |
++void load_trampoline_pgtable(void) |
1162 |
++{ |
1163 |
++#ifdef CONFIG_X86_32 |
1164 |
++ load_cr3(initial_page_table); |
1165 |
++#else |
1166 |
++ /* |
1167 |
++ * This function is called before exiting to real-mode and that will |
1168 |
++ * fail with CR4.PCIDE still set. |
1169 |
++ */ |
1170 |
++ if (boot_cpu_has(X86_FEATURE_PCID)) |
1171 |
++ cr4_clear_bits(X86_CR4_PCIDE); |
1172 |
++ |
1173 |
++ write_cr3(real_mode_header->trampoline_pgd); |
1174 |
++#endif |
1175 |
++ |
1176 |
++ /* |
1177 |
++ * The CR3 write above will not flush global TLB entries. |
1178 |
++ * Stale, global entries from previous page tables may still be |
1179 |
++ * present. Flush those stale entries. |
1180 |
++ * |
1181 |
++ * This ensures that memory accessed while running with |
1182 |
++ * trampoline_pgd is *actually* mapped into trampoline_pgd. |
1183 |
++ */ |
1184 |
++ __flush_tlb_all(); |
1185 |
++} |
1186 |
++ |
1187 |
+ void __init reserve_real_mode(void) |
1188 |
+ { |
1189 |
+ phys_addr_t mem; |
1190 |
+diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c |
1191 |
+index 58f51667e2e4b..8249685b40960 100644 |
1192 |
+--- a/arch/x86/um/syscalls_64.c |
1193 |
++++ b/arch/x86/um/syscalls_64.c |
1194 |
+@@ -11,6 +11,7 @@ |
1195 |
+ #include <linux/uaccess.h> |
1196 |
+ #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
1197 |
+ #include <os.h> |
1198 |
++#include <registers.h> |
1199 |
+ |
1200 |
+ long arch_prctl(struct task_struct *task, int option, |
1201 |
+ unsigned long __user *arg2) |
1202 |
+@@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option, |
1203 |
+ switch (option) { |
1204 |
+ case ARCH_SET_FS: |
1205 |
+ case ARCH_SET_GS: |
1206 |
+- ret = restore_registers(pid, ¤t->thread.regs.regs); |
1207 |
++ ret = restore_pid_registers(pid, ¤t->thread.regs.regs); |
1208 |
+ if (ret) |
1209 |
+ return ret; |
1210 |
+ break; |
1211 |
+diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c |
1212 |
+index d3d2dbfba680c..cd3debefe990d 100644 |
1213 |
+--- a/drivers/acpi/acpica/exfield.c |
1214 |
++++ b/drivers/acpi/acpica/exfield.c |
1215 |
+@@ -320,12 +320,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, |
1216 |
+ obj_desc->field.base_byte_offset, |
1217 |
+ source_desc->buffer.pointer, data_length); |
1218 |
+ |
1219 |
+- if ((obj_desc->field.region_obj->region.address == |
1220 |
+- PCC_MASTER_SUBSPACE |
1221 |
+- && MASTER_SUBSPACE_COMMAND(obj_desc->field. |
1222 |
+- base_byte_offset)) |
1223 |
+- || GENERIC_SUBSPACE_COMMAND(obj_desc->field. |
1224 |
+- base_byte_offset)) { |
1225 |
++ if (MASTER_SUBSPACE_COMMAND(obj_desc->field.base_byte_offset)) { |
1226 |
+ |
1227 |
+ /* Perform the write */ |
1228 |
+ |
1229 |
+diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c |
1230 |
+index 06e35ea098234..6d84618ba3871 100644 |
1231 |
+--- a/drivers/acpi/acpica/exoparg1.c |
1232 |
++++ b/drivers/acpi/acpica/exoparg1.c |
1233 |
+@@ -1007,7 +1007,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) |
1234 |
+ (walk_state, return_desc, |
1235 |
+ &temp_desc); |
1236 |
+ if (ACPI_FAILURE(status)) { |
1237 |
+- goto cleanup; |
1238 |
++ return_ACPI_STATUS |
1239 |
++ (status); |
1240 |
+ } |
1241 |
+ |
1242 |
+ return_desc = temp_desc; |
1243 |
+diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c |
1244 |
+index aa502ae3b6b31..de0a59878e52d 100644 |
1245 |
+--- a/drivers/acpi/acpica/hwesleep.c |
1246 |
++++ b/drivers/acpi/acpica/hwesleep.c |
1247 |
+@@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) |
1248 |
+ |
1249 |
+ /* Flush caches, as per ACPI specification */ |
1250 |
+ |
1251 |
+- ACPI_FLUSH_CPU_CACHE(); |
1252 |
++ if (sleep_state < ACPI_STATE_S4) { |
1253 |
++ ACPI_FLUSH_CPU_CACHE(); |
1254 |
++ } |
1255 |
+ |
1256 |
+ status = acpi_os_enter_sleep(sleep_state, sleep_control, 0); |
1257 |
+ if (status == AE_CTRL_TERMINATE) { |
1258 |
+diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c |
1259 |
+index 5f7d63badbe9d..321aaad97e2f7 100644 |
1260 |
+--- a/drivers/acpi/acpica/hwsleep.c |
1261 |
++++ b/drivers/acpi/acpica/hwsleep.c |
1262 |
+@@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) |
1263 |
+ |
1264 |
+ /* Flush caches, as per ACPI specification */ |
1265 |
+ |
1266 |
+- ACPI_FLUSH_CPU_CACHE(); |
1267 |
++ if (sleep_state < ACPI_STATE_S4) { |
1268 |
++ ACPI_FLUSH_CPU_CACHE(); |
1269 |
++ } |
1270 |
+ |
1271 |
+ status = acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); |
1272 |
+ if (status == AE_CTRL_TERMINATE) { |
1273 |
+diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c |
1274 |
+index 79731efbe8fe2..4e3398819718d 100644 |
1275 |
+--- a/drivers/acpi/acpica/hwxfsleep.c |
1276 |
++++ b/drivers/acpi/acpica/hwxfsleep.c |
1277 |
+@@ -162,8 +162,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void) |
1278 |
+ return_ACPI_STATUS(status); |
1279 |
+ } |
1280 |
+ |
1281 |
+- ACPI_FLUSH_CPU_CACHE(); |
1282 |
+- |
1283 |
+ status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, |
1284 |
+ (u32)acpi_gbl_FADT.s4_bios_request, 8); |
1285 |
+ |
1286 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
1287 |
+index 72d2c0b656339..cb1750e7a6281 100644 |
1288 |
+--- a/drivers/acpi/acpica/utdelete.c |
1289 |
++++ b/drivers/acpi/acpica/utdelete.c |
1290 |
+@@ -422,6 +422,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
1291 |
+ ACPI_WARNING((AE_INFO, |
1292 |
+ "Obj %p, Reference Count is already zero, cannot decrement\n", |
1293 |
+ object)); |
1294 |
++ return; |
1295 |
+ } |
1296 |
+ |
1297 |
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS, |
1298 |
+diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c |
1299 |
+index 6e96ed68b3379..4e0aea5f008e3 100644 |
1300 |
+--- a/drivers/acpi/battery.c |
1301 |
++++ b/drivers/acpi/battery.c |
1302 |
+@@ -65,6 +65,7 @@ static int battery_bix_broken_package; |
1303 |
+ static int battery_notification_delay_ms; |
1304 |
+ static int battery_ac_is_broken; |
1305 |
+ static int battery_check_pmic = 1; |
1306 |
++static int battery_quirk_notcharging; |
1307 |
+ static unsigned int cache_time = 1000; |
1308 |
+ module_param(cache_time, uint, 0644); |
1309 |
+ MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
1310 |
+@@ -233,6 +234,8 @@ static int acpi_battery_get_property(struct power_supply *psy, |
1311 |
+ val->intval = POWER_SUPPLY_STATUS_CHARGING; |
1312 |
+ else if (acpi_battery_is_charged(battery)) |
1313 |
+ val->intval = POWER_SUPPLY_STATUS_FULL; |
1314 |
++ else if (battery_quirk_notcharging) |
1315 |
++ val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; |
1316 |
+ else |
1317 |
+ val->intval = POWER_SUPPLY_STATUS_UNKNOWN; |
1318 |
+ break; |
1319 |
+@@ -1337,6 +1340,12 @@ battery_do_not_check_pmic_quirk(const struct dmi_system_id *d) |
1320 |
+ return 0; |
1321 |
+ } |
1322 |
+ |
1323 |
++static int __init battery_quirk_not_charging(const struct dmi_system_id *d) |
1324 |
++{ |
1325 |
++ battery_quirk_notcharging = 1; |
1326 |
++ return 0; |
1327 |
++} |
1328 |
++ |
1329 |
+ static const struct dmi_system_id bat_dmi_table[] __initconst = { |
1330 |
+ { |
1331 |
+ /* NEC LZ750/LS */ |
1332 |
+@@ -1381,6 +1390,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { |
1333 |
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), |
1334 |
+ }, |
1335 |
+ }, |
1336 |
++ { |
1337 |
++ /* |
1338 |
++ * On Lenovo ThinkPads the BIOS specification defines |
1339 |
++ * a state when the bits for charging and discharging |
1340 |
++ * are both set to 0. That state is "Not Charging". |
1341 |
++ */ |
1342 |
++ .callback = battery_quirk_not_charging, |
1343 |
++ .ident = "Lenovo ThinkPad", |
1344 |
++ .matches = { |
1345 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
1346 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), |
1347 |
++ }, |
1348 |
++ }, |
1349 |
+ {}, |
1350 |
+ }; |
1351 |
+ |
1352 |
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
1353 |
+index 258a8df235cfb..e5b92958c299e 100644 |
1354 |
+--- a/drivers/acpi/ec.c |
1355 |
++++ b/drivers/acpi/ec.c |
1356 |
+@@ -167,6 +167,7 @@ struct acpi_ec_query { |
1357 |
+ struct transaction transaction; |
1358 |
+ struct work_struct work; |
1359 |
+ struct acpi_ec_query_handler *handler; |
1360 |
++ struct acpi_ec *ec; |
1361 |
+ }; |
1362 |
+ |
1363 |
+ static int acpi_ec_query(struct acpi_ec *ec, u8 *data); |
1364 |
+@@ -462,6 +463,7 @@ static void acpi_ec_submit_query(struct acpi_ec *ec) |
1365 |
+ ec_dbg_evt("Command(%s) submitted/blocked", |
1366 |
+ acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); |
1367 |
+ ec->nr_pending_queries++; |
1368 |
++ ec->events_in_progress++; |
1369 |
+ queue_work(ec_wq, &ec->work); |
1370 |
+ } |
1371 |
+ } |
1372 |
+@@ -528,7 +530,7 @@ static void acpi_ec_enable_event(struct acpi_ec *ec) |
1373 |
+ #ifdef CONFIG_PM_SLEEP |
1374 |
+ static void __acpi_ec_flush_work(void) |
1375 |
+ { |
1376 |
+- drain_workqueue(ec_wq); /* flush ec->work */ |
1377 |
++ flush_workqueue(ec_wq); /* flush ec->work */ |
1378 |
+ flush_workqueue(ec_query_wq); /* flush queries */ |
1379 |
+ } |
1380 |
+ |
1381 |
+@@ -1119,7 +1121,7 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) |
1382 |
+ } |
1383 |
+ EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); |
1384 |
+ |
1385 |
+-static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) |
1386 |
++static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval) |
1387 |
+ { |
1388 |
+ struct acpi_ec_query *q; |
1389 |
+ struct transaction *t; |
1390 |
+@@ -1127,11 +1129,13 @@ static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) |
1391 |
+ q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); |
1392 |
+ if (!q) |
1393 |
+ return NULL; |
1394 |
++ |
1395 |
+ INIT_WORK(&q->work, acpi_ec_event_processor); |
1396 |
+ t = &q->transaction; |
1397 |
+ t->command = ACPI_EC_COMMAND_QUERY; |
1398 |
+ t->rdata = pval; |
1399 |
+ t->rlen = 1; |
1400 |
++ q->ec = ec; |
1401 |
+ return q; |
1402 |
+ } |
1403 |
+ |
1404 |
+@@ -1148,13 +1152,21 @@ static void acpi_ec_event_processor(struct work_struct *work) |
1405 |
+ { |
1406 |
+ struct acpi_ec_query *q = container_of(work, struct acpi_ec_query, work); |
1407 |
+ struct acpi_ec_query_handler *handler = q->handler; |
1408 |
++ struct acpi_ec *ec = q->ec; |
1409 |
+ |
1410 |
+ ec_dbg_evt("Query(0x%02x) started", handler->query_bit); |
1411 |
++ |
1412 |
+ if (handler->func) |
1413 |
+ handler->func(handler->data); |
1414 |
+ else if (handler->handle) |
1415 |
+ acpi_evaluate_object(handler->handle, NULL, NULL, NULL); |
1416 |
++ |
1417 |
+ ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit); |
1418 |
++ |
1419 |
++ spin_lock_irq(&ec->lock); |
1420 |
++ ec->queries_in_progress--; |
1421 |
++ spin_unlock_irq(&ec->lock); |
1422 |
++ |
1423 |
+ acpi_ec_delete_query(q); |
1424 |
+ } |
1425 |
+ |
1426 |
+@@ -1164,7 +1176,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) |
1427 |
+ int result; |
1428 |
+ struct acpi_ec_query *q; |
1429 |
+ |
1430 |
+- q = acpi_ec_create_query(&value); |
1431 |
++ q = acpi_ec_create_query(ec, &value); |
1432 |
+ if (!q) |
1433 |
+ return -ENOMEM; |
1434 |
+ |
1435 |
+@@ -1186,19 +1198,20 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) |
1436 |
+ } |
1437 |
+ |
1438 |
+ /* |
1439 |
+- * It is reported that _Qxx are evaluated in a parallel way on |
1440 |
+- * Windows: |
1441 |
++ * It is reported that _Qxx are evaluated in a parallel way on Windows: |
1442 |
+ * https://bugzilla.kernel.org/show_bug.cgi?id=94411 |
1443 |
+ * |
1444 |
+- * Put this log entry before schedule_work() in order to make |
1445 |
+- * it appearing before any other log entries occurred during the |
1446 |
+- * work queue execution. |
1447 |
++ * Put this log entry before queue_work() to make it appear in the log |
1448 |
++ * before any other messages emitted during workqueue handling. |
1449 |
+ */ |
1450 |
+ ec_dbg_evt("Query(0x%02x) scheduled", value); |
1451 |
+- if (!queue_work(ec_query_wq, &q->work)) { |
1452 |
+- ec_dbg_evt("Query(0x%02x) overlapped", value); |
1453 |
+- result = -EBUSY; |
1454 |
+- } |
1455 |
++ |
1456 |
++ spin_lock_irq(&ec->lock); |
1457 |
++ |
1458 |
++ ec->queries_in_progress++; |
1459 |
++ queue_work(ec_query_wq, &q->work); |
1460 |
++ |
1461 |
++ spin_unlock_irq(&ec->lock); |
1462 |
+ |
1463 |
+ err_exit: |
1464 |
+ if (result) |
1465 |
+@@ -1256,6 +1269,10 @@ static void acpi_ec_event_handler(struct work_struct *work) |
1466 |
+ ec_dbg_evt("Event stopped"); |
1467 |
+ |
1468 |
+ acpi_ec_check_event(ec); |
1469 |
++ |
1470 |
++ spin_lock_irqsave(&ec->lock, flags); |
1471 |
++ ec->events_in_progress--; |
1472 |
++ spin_unlock_irqrestore(&ec->lock, flags); |
1473 |
+ } |
1474 |
+ |
1475 |
+ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, |
1476 |
+@@ -1972,6 +1989,7 @@ void acpi_ec_set_gpe_wake_mask(u8 action) |
1477 |
+ |
1478 |
+ bool acpi_ec_dispatch_gpe(void) |
1479 |
+ { |
1480 |
++ bool work_in_progress; |
1481 |
+ u32 ret; |
1482 |
+ |
1483 |
+ if (!first_ec) |
1484 |
+@@ -1992,8 +2010,19 @@ bool acpi_ec_dispatch_gpe(void) |
1485 |
+ if (ret == ACPI_INTERRUPT_HANDLED) |
1486 |
+ pm_pr_dbg("EC GPE dispatched\n"); |
1487 |
+ |
1488 |
+- /* Flush the event and query workqueues. */ |
1489 |
+- acpi_ec_flush_work(); |
1490 |
++ /* Drain EC work. */ |
1491 |
++ do { |
1492 |
++ acpi_ec_flush_work(); |
1493 |
++ |
1494 |
++ pm_pr_dbg("ACPI EC work flushed\n"); |
1495 |
++ |
1496 |
++ spin_lock_irq(&first_ec->lock); |
1497 |
++ |
1498 |
++ work_in_progress = first_ec->events_in_progress + |
1499 |
++ first_ec->queries_in_progress > 0; |
1500 |
++ |
1501 |
++ spin_unlock_irq(&first_ec->lock); |
1502 |
++ } while (work_in_progress && !pm_wakeup_pending()); |
1503 |
+ |
1504 |
+ return false; |
1505 |
+ } |
1506 |
+diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h |
1507 |
+index 159c422601bc4..62b6b36f3a37c 100644 |
1508 |
+--- a/drivers/acpi/internal.h |
1509 |
++++ b/drivers/acpi/internal.h |
1510 |
+@@ -183,6 +183,8 @@ struct acpi_ec { |
1511 |
+ struct work_struct work; |
1512 |
+ unsigned long timestamp; |
1513 |
+ unsigned long nr_pending_queries; |
1514 |
++ unsigned int events_in_progress; |
1515 |
++ unsigned int queries_in_progress; |
1516 |
+ bool busy_polling; |
1517 |
+ unsigned int polling_guard; |
1518 |
+ }; |
1519 |
+diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c |
1520 |
+index 95d119ff76b65..5d4be80ee6cb4 100644 |
1521 |
+--- a/drivers/acpi/scan.c |
1522 |
++++ b/drivers/acpi/scan.c |
1523 |
+@@ -1577,6 +1577,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) |
1524 |
+ { |
1525 |
+ struct list_head resource_list; |
1526 |
+ bool is_serial_bus_slave = false; |
1527 |
++ static const struct acpi_device_id ignore_serial_bus_ids[] = { |
1528 |
+ /* |
1529 |
+ * These devices have multiple I2cSerialBus resources and an i2c-client |
1530 |
+ * must be instantiated for each, each with its own i2c_device_id. |
1531 |
+@@ -1585,11 +1586,18 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) |
1532 |
+ * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows |
1533 |
+ * which i2c_device_id to use for each resource. |
1534 |
+ */ |
1535 |
+- static const struct acpi_device_id i2c_multi_instantiate_ids[] = { |
1536 |
+ {"BSG1160", }, |
1537 |
+ {"BSG2150", }, |
1538 |
+ {"INT33FE", }, |
1539 |
+ {"INT3515", }, |
1540 |
++ /* |
1541 |
++ * HIDs of device with an UartSerialBusV2 resource for which userspace |
1542 |
++ * expects a regular tty cdev to be created (instead of the in kernel |
1543 |
++ * serdev) and which have a kernel driver which expects a platform_dev |
1544 |
++ * such as the rfkill-gpio driver. |
1545 |
++ */ |
1546 |
++ {"BCM4752", }, |
1547 |
++ {"LNV4752", }, |
1548 |
+ {} |
1549 |
+ }; |
1550 |
+ |
1551 |
+@@ -1603,8 +1611,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) |
1552 |
+ fwnode_property_present(&device->fwnode, "baud"))) |
1553 |
+ return true; |
1554 |
+ |
1555 |
+- /* Instantiate a pdev for the i2c-multi-instantiate drv to bind to */ |
1556 |
+- if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids)) |
1557 |
++ if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) |
1558 |
+ return false; |
1559 |
+ |
1560 |
+ INIT_LIST_HEAD(&resource_list); |
1561 |
+diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
1562 |
+index 0512af0f04646..b9fb2a9269443 100644 |
1563 |
+--- a/drivers/android/binder.c |
1564 |
++++ b/drivers/android/binder.c |
1565 |
+@@ -2660,8 +2660,8 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda, |
1566 |
+ if (!ret) |
1567 |
+ ret = binder_translate_fd(fd, offset, t, thread, |
1568 |
+ in_reply_to); |
1569 |
+- if (ret < 0) |
1570 |
+- return ret; |
1571 |
++ if (ret) |
1572 |
++ return ret > 0 ? -EINVAL : ret; |
1573 |
+ } |
1574 |
+ return 0; |
1575 |
+ } |
1576 |
+diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c |
1577 |
+index ac97a1e2e5ddc..02af4f109e59f 100644 |
1578 |
+--- a/drivers/block/floppy.c |
1579 |
++++ b/drivers/block/floppy.c |
1580 |
+@@ -1003,7 +1003,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); |
1581 |
+ static void cancel_activity(void) |
1582 |
+ { |
1583 |
+ do_floppy = NULL; |
1584 |
+- cancel_delayed_work_sync(&fd_timer); |
1585 |
++ cancel_delayed_work(&fd_timer); |
1586 |
+ cancel_work_sync(&floppy_work); |
1587 |
+ } |
1588 |
+ |
1589 |
+@@ -3112,6 +3112,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) |
1590 |
+ } |
1591 |
+ } |
1592 |
+ |
1593 |
++#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) |
1594 |
++ |
1595 |
+ static int raw_cmd_copyin(int cmd, void __user *param, |
1596 |
+ struct floppy_raw_cmd **rcmd) |
1597 |
+ { |
1598 |
+@@ -3149,7 +3151,7 @@ loop: |
1599 |
+ ptr->resultcode = 0; |
1600 |
+ |
1601 |
+ if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { |
1602 |
+- if (ptr->length <= 0) |
1603 |
++ if (ptr->length <= 0 || ptr->length >= MAX_LEN) |
1604 |
+ return -EINVAL; |
1605 |
+ ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); |
1606 |
+ fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); |
1607 |
+diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
1608 |
+index 304178be1ef40..c2eb64bcd5d5d 100644 |
1609 |
+--- a/drivers/bluetooth/btmtksdio.c |
1610 |
++++ b/drivers/bluetooth/btmtksdio.c |
1611 |
+@@ -1041,6 +1041,8 @@ static int btmtksdio_runtime_suspend(struct device *dev) |
1612 |
+ if (!bdev) |
1613 |
+ return 0; |
1614 |
+ |
1615 |
++ sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); |
1616 |
++ |
1617 |
+ sdio_claim_host(bdev->func); |
1618 |
+ |
1619 |
+ sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); |
1620 |
+diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c |
1621 |
+index 94ed734c1d7eb..c6bb380806f9b 100644 |
1622 |
+--- a/drivers/bluetooth/hci_bcm.c |
1623 |
++++ b/drivers/bluetooth/hci_bcm.c |
1624 |
+@@ -1127,7 +1127,12 @@ static int bcm_probe(struct platform_device *pdev) |
1625 |
+ return -ENOMEM; |
1626 |
+ |
1627 |
+ dev->dev = &pdev->dev; |
1628 |
+- dev->irq = platform_get_irq(pdev, 0); |
1629 |
++ |
1630 |
++ ret = platform_get_irq(pdev, 0); |
1631 |
++ if (ret < 0) |
1632 |
++ return ret; |
1633 |
++ |
1634 |
++ dev->irq = ret; |
1635 |
+ |
1636 |
+ if (has_acpi_companion(&pdev->dev)) { |
1637 |
+ ret = bcm_acpi_probe(dev); |
1638 |
+diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h |
1639 |
+index 9ccb6b270b071..95164246afd1a 100644 |
1640 |
+--- a/drivers/char/mwave/3780i.h |
1641 |
++++ b/drivers/char/mwave/3780i.h |
1642 |
+@@ -68,7 +68,7 @@ typedef struct { |
1643 |
+ unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ |
1644 |
+ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ |
1645 |
+ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ |
1646 |
+- unsigned char Reserved:5; /* 0: Reserved */ |
1647 |
++ unsigned short Reserved:13; /* 0: Reserved */ |
1648 |
+ } DSP_ISA_SLAVE_CONTROL; |
1649 |
+ |
1650 |
+ |
1651 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
1652 |
+index 60b39af1279a4..19bfbaf135989 100644 |
1653 |
+--- a/drivers/char/random.c |
1654 |
++++ b/drivers/char/random.c |
1655 |
+@@ -975,12 +975,14 @@ static struct crng_state *select_crng(void) |
1656 |
+ |
1657 |
+ /* |
1658 |
+ * crng_fast_load() can be called by code in the interrupt service |
1659 |
+- * path. So we can't afford to dilly-dally. |
1660 |
++ * path. So we can't afford to dilly-dally. Returns the number of |
1661 |
++ * bytes processed from cp. |
1662 |
+ */ |
1663 |
+-static int crng_fast_load(const char *cp, size_t len) |
1664 |
++static size_t crng_fast_load(const char *cp, size_t len) |
1665 |
+ { |
1666 |
+ unsigned long flags; |
1667 |
+ char *p; |
1668 |
++ size_t ret = 0; |
1669 |
+ |
1670 |
+ if (!spin_trylock_irqsave(&primary_crng.lock, flags)) |
1671 |
+ return 0; |
1672 |
+@@ -991,7 +993,7 @@ static int crng_fast_load(const char *cp, size_t len) |
1673 |
+ p = (unsigned char *) &primary_crng.state[4]; |
1674 |
+ while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) { |
1675 |
+ p[crng_init_cnt % CHACHA_KEY_SIZE] ^= *cp; |
1676 |
+- cp++; crng_init_cnt++; len--; |
1677 |
++ cp++; crng_init_cnt++; len--; ret++; |
1678 |
+ } |
1679 |
+ spin_unlock_irqrestore(&primary_crng.lock, flags); |
1680 |
+ if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { |
1681 |
+@@ -1000,7 +1002,7 @@ static int crng_fast_load(const char *cp, size_t len) |
1682 |
+ wake_up_interruptible(&crng_init_wait); |
1683 |
+ pr_notice("random: fast init done\n"); |
1684 |
+ } |
1685 |
+- return 1; |
1686 |
++ return ret; |
1687 |
+ } |
1688 |
+ |
1689 |
+ /* |
1690 |
+@@ -1353,7 +1355,7 @@ void add_interrupt_randomness(int irq, int irq_flags) |
1691 |
+ if (unlikely(crng_init == 0)) { |
1692 |
+ if ((fast_pool->count >= 64) && |
1693 |
+ crng_fast_load((char *) fast_pool->pool, |
1694 |
+- sizeof(fast_pool->pool))) { |
1695 |
++ sizeof(fast_pool->pool)) > 0) { |
1696 |
+ fast_pool->count = 0; |
1697 |
+ fast_pool->last = now; |
1698 |
+ } |
1699 |
+@@ -2501,8 +2503,11 @@ void add_hwgenerator_randomness(const char *buffer, size_t count, |
1700 |
+ struct entropy_store *poolp = &input_pool; |
1701 |
+ |
1702 |
+ if (unlikely(crng_init == 0)) { |
1703 |
+- crng_fast_load(buffer, count); |
1704 |
+- return; |
1705 |
++ size_t ret = crng_fast_load(buffer, count); |
1706 |
++ count -= ret; |
1707 |
++ buffer += ret; |
1708 |
++ if (!count || crng_init == 0) |
1709 |
++ return; |
1710 |
+ } |
1711 |
+ |
1712 |
+ /* Suspend writing if we're above the trickle threshold. |
1713 |
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
1714 |
+index 2fe26ec03552b..70f7859942287 100644 |
1715 |
+--- a/drivers/char/tpm/tpm_tis_core.c |
1716 |
++++ b/drivers/char/tpm/tpm_tis_core.c |
1717 |
+@@ -877,7 +877,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
1718 |
+ intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | |
1719 |
+ TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; |
1720 |
+ intmask &= ~TPM_GLOBAL_INT_ENABLE; |
1721 |
++ |
1722 |
++ rc = request_locality(chip, 0); |
1723 |
++ if (rc < 0) { |
1724 |
++ rc = -ENODEV; |
1725 |
++ goto out_err; |
1726 |
++ } |
1727 |
++ |
1728 |
+ tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); |
1729 |
++ release_locality(chip, 0); |
1730 |
+ |
1731 |
+ rc = tpm_chip_start(chip); |
1732 |
+ if (rc) |
1733 |
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
1734 |
+index c5486537b9284..e637bd6b295bd 100644 |
1735 |
+--- a/drivers/clk/bcm/clk-bcm2835.c |
1736 |
++++ b/drivers/clk/bcm/clk-bcm2835.c |
1737 |
+@@ -932,8 +932,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw) |
1738 |
+ |
1739 |
+ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
1740 |
+ unsigned long rate, |
1741 |
+- unsigned long parent_rate, |
1742 |
+- bool round_up) |
1743 |
++ unsigned long parent_rate) |
1744 |
+ { |
1745 |
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); |
1746 |
+ const struct bcm2835_clock_data *data = clock->data; |
1747 |
+@@ -945,10 +944,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
1748 |
+ |
1749 |
+ rem = do_div(temp, rate); |
1750 |
+ div = temp; |
1751 |
+- |
1752 |
+- /* Round up and mask off the unused bits */ |
1753 |
+- if (round_up && ((div & unused_frac_mask) != 0 || rem != 0)) |
1754 |
+- div += unused_frac_mask + 1; |
1755 |
+ div &= ~unused_frac_mask; |
1756 |
+ |
1757 |
+ /* different clamping limits apply for a mash clock */ |
1758 |
+@@ -1079,7 +1074,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, |
1759 |
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); |
1760 |
+ struct bcm2835_cprman *cprman = clock->cprman; |
1761 |
+ const struct bcm2835_clock_data *data = clock->data; |
1762 |
+- u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false); |
1763 |
++ u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate); |
1764 |
+ u32 ctl; |
1765 |
+ |
1766 |
+ spin_lock(&cprman->regs_lock); |
1767 |
+@@ -1130,7 +1125,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw, |
1768 |
+ |
1769 |
+ if (!(BIT(parent_idx) & data->set_rate_parent)) { |
1770 |
+ *prate = clk_hw_get_rate(parent); |
1771 |
+- *div = bcm2835_clock_choose_div(hw, rate, *prate, true); |
1772 |
++ *div = bcm2835_clock_choose_div(hw, rate, *prate); |
1773 |
+ |
1774 |
+ *avgrate = bcm2835_clock_rate_from_divisor(clock, *prate, *div); |
1775 |
+ |
1776 |
+@@ -1216,7 +1211,7 @@ static int bcm2835_clock_determine_rate(struct clk_hw *hw, |
1777 |
+ rate = bcm2835_clock_choose_div_and_prate(hw, i, req->rate, |
1778 |
+ &div, &prate, |
1779 |
+ &avgrate); |
1780 |
+- if (rate > best_rate && rate <= req->rate) { |
1781 |
++ if (abs(req->rate - rate) < abs(req->rate - best_rate)) { |
1782 |
+ best_parent = parent; |
1783 |
+ best_prate = prate; |
1784 |
+ best_rate = rate; |
1785 |
+diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c |
1786 |
+index 8f9f3d4a54fd2..20ed0955416a3 100644 |
1787 |
+--- a/drivers/clk/clk-si5341.c |
1788 |
++++ b/drivers/clk/clk-si5341.c |
1789 |
+@@ -1303,7 +1303,7 @@ static int si5341_probe(struct i2c_client *client, |
1790 |
+ clk_prepare(data->clk[i].hw.clk); |
1791 |
+ } |
1792 |
+ |
1793 |
+- err = of_clk_add_hw_provider(client->dev.of_node, of_clk_si5341_get, |
1794 |
++ err = devm_of_clk_add_hw_provider(&client->dev, of_clk_si5341_get, |
1795 |
+ data); |
1796 |
+ if (err) { |
1797 |
+ dev_err(&client->dev, "unable to add clk provider\n"); |
1798 |
+diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c |
1799 |
+index 5c75e3d906c20..682a18b392f08 100644 |
1800 |
+--- a/drivers/clk/clk-stm32f4.c |
1801 |
++++ b/drivers/clk/clk-stm32f4.c |
1802 |
+@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = { |
1803 |
+ { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, |
1804 |
+ { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, |
1805 |
+ { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, |
1806 |
+- { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, |
1807 |
+ }; |
1808 |
+ |
1809 |
+ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { |
1810 |
+@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { |
1811 |
+ { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, |
1812 |
+ { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, |
1813 |
+ { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, |
1814 |
+- { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, |
1815 |
+ }; |
1816 |
+ |
1817 |
+ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { |
1818 |
+@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { |
1819 |
+ { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, |
1820 |
+ { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, |
1821 |
+ { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, |
1822 |
+- { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, |
1823 |
+ }; |
1824 |
+ |
1825 |
+ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { |
1826 |
+@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { |
1827 |
+ { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, |
1828 |
+ { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, |
1829 |
+ { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, |
1830 |
+- { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, |
1831 |
+ { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, |
1832 |
+ }; |
1833 |
+ |
1834 |
+diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c |
1835 |
+index 58b5acee38306..882b42efd2582 100644 |
1836 |
+--- a/drivers/clk/imx/clk-imx8mn.c |
1837 |
++++ b/drivers/clk/imx/clk-imx8mn.c |
1838 |
+@@ -358,9 +358,9 @@ static const char * const imx8mn_pdm_sels[] = {"osc_24m", "sys_pll2_100m", "audi |
1839 |
+ |
1840 |
+ static const char * const imx8mn_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; |
1841 |
+ |
1842 |
+-static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "osc_27m", |
1843 |
+- "sys_pll1_200m", "audio_pll2_out", "vpu_pll", |
1844 |
+- "sys_pll1_80m", }; |
1845 |
++static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "dummy", |
1846 |
++ "sys_pll1_200m", "audio_pll2_out", "sys_pll2_500m", |
1847 |
++ "dummy", "sys_pll1_80m", }; |
1848 |
+ static const char * const imx8mn_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_400m", |
1849 |
+ "sys_pll2_166m", "sys_pll3_out", "audio_pll1_out", |
1850 |
+ "video_pll1_out", "osc_32k", }; |
1851 |
+diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c |
1852 |
+index 1f9c056e684ce..e8e36ec70b27f 100644 |
1853 |
+--- a/drivers/clk/meson/gxbb.c |
1854 |
++++ b/drivers/clk/meson/gxbb.c |
1855 |
+@@ -712,6 +712,35 @@ static struct clk_regmap gxbb_mpll_prediv = { |
1856 |
+ }; |
1857 |
+ |
1858 |
+ static struct clk_regmap gxbb_mpll0_div = { |
1859 |
++ .data = &(struct meson_clk_mpll_data){ |
1860 |
++ .sdm = { |
1861 |
++ .reg_off = HHI_MPLL_CNTL7, |
1862 |
++ .shift = 0, |
1863 |
++ .width = 14, |
1864 |
++ }, |
1865 |
++ .sdm_en = { |
1866 |
++ .reg_off = HHI_MPLL_CNTL, |
1867 |
++ .shift = 25, |
1868 |
++ .width = 1, |
1869 |
++ }, |
1870 |
++ .n2 = { |
1871 |
++ .reg_off = HHI_MPLL_CNTL7, |
1872 |
++ .shift = 16, |
1873 |
++ .width = 9, |
1874 |
++ }, |
1875 |
++ .lock = &meson_clk_lock, |
1876 |
++ }, |
1877 |
++ .hw.init = &(struct clk_init_data){ |
1878 |
++ .name = "mpll0_div", |
1879 |
++ .ops = &meson_clk_mpll_ops, |
1880 |
++ .parent_hws = (const struct clk_hw *[]) { |
1881 |
++ &gxbb_mpll_prediv.hw |
1882 |
++ }, |
1883 |
++ .num_parents = 1, |
1884 |
++ }, |
1885 |
++}; |
1886 |
++ |
1887 |
++static struct clk_regmap gxl_mpll0_div = { |
1888 |
+ .data = &(struct meson_clk_mpll_data){ |
1889 |
+ .sdm = { |
1890 |
+ .reg_off = HHI_MPLL_CNTL7, |
1891 |
+@@ -748,7 +777,16 @@ static struct clk_regmap gxbb_mpll0 = { |
1892 |
+ .hw.init = &(struct clk_init_data){ |
1893 |
+ .name = "mpll0", |
1894 |
+ .ops = &clk_regmap_gate_ops, |
1895 |
+- .parent_hws = (const struct clk_hw *[]) { &gxbb_mpll0_div.hw }, |
1896 |
++ .parent_data = &(const struct clk_parent_data) { |
1897 |
++ /* |
1898 |
++ * Note: |
1899 |
++ * GXL and GXBB have different SDM_EN registers. We |
1900 |
++ * fallback to the global naming string mechanism so |
1901 |
++ * mpll0_div picks up the appropriate one. |
1902 |
++ */ |
1903 |
++ .name = "mpll0_div", |
1904 |
++ .index = -1, |
1905 |
++ }, |
1906 |
+ .num_parents = 1, |
1907 |
+ .flags = CLK_SET_RATE_PARENT, |
1908 |
+ }, |
1909 |
+@@ -3036,7 +3074,7 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data = { |
1910 |
+ [CLKID_VAPB_1] = &gxbb_vapb_1.hw, |
1911 |
+ [CLKID_VAPB_SEL] = &gxbb_vapb_sel.hw, |
1912 |
+ [CLKID_VAPB] = &gxbb_vapb.hw, |
1913 |
+- [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw, |
1914 |
++ [CLKID_MPLL0_DIV] = &gxl_mpll0_div.hw, |
1915 |
+ [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw, |
1916 |
+ [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw, |
1917 |
+ [CLKID_MPLL_PREDIV] = &gxbb_mpll_prediv.hw, |
1918 |
+@@ -3430,7 +3468,7 @@ static struct clk_regmap *const gxl_clk_regmaps[] = { |
1919 |
+ &gxbb_mpll0, |
1920 |
+ &gxbb_mpll1, |
1921 |
+ &gxbb_mpll2, |
1922 |
+- &gxbb_mpll0_div, |
1923 |
++ &gxl_mpll0_div, |
1924 |
+ &gxbb_mpll1_div, |
1925 |
+ &gxbb_mpll2_div, |
1926 |
+ &gxbb_cts_amclk_div, |
1927 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
1928 |
+index cb7949a2ac0ca..af9f348048629 100644 |
1929 |
+--- a/drivers/cpufreq/cpufreq.c |
1930 |
++++ b/drivers/cpufreq/cpufreq.c |
1931 |
+@@ -1393,7 +1393,7 @@ static int cpufreq_online(unsigned int cpu) |
1932 |
+ |
1933 |
+ ret = freq_qos_add_request(&policy->constraints, |
1934 |
+ policy->min_freq_req, FREQ_QOS_MIN, |
1935 |
+- policy->min); |
1936 |
++ FREQ_QOS_MIN_DEFAULT_VALUE); |
1937 |
+ if (ret < 0) { |
1938 |
+ /* |
1939 |
+ * So we don't call freq_qos_remove_request() for an |
1940 |
+@@ -1413,7 +1413,7 @@ static int cpufreq_online(unsigned int cpu) |
1941 |
+ |
1942 |
+ ret = freq_qos_add_request(&policy->constraints, |
1943 |
+ policy->max_freq_req, FREQ_QOS_MAX, |
1944 |
+- policy->max); |
1945 |
++ FREQ_QOS_MAX_DEFAULT_VALUE); |
1946 |
+ if (ret < 0) { |
1947 |
+ policy->max_freq_req = NULL; |
1948 |
+ goto out_destroy_policy; |
1949 |
+diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c |
1950 |
+index 6863d70976746..28692d068176f 100644 |
1951 |
+--- a/drivers/crypto/caam/caamalg_qi2.c |
1952 |
++++ b/drivers/crypto/caam/caamalg_qi2.c |
1953 |
+@@ -5421,7 +5421,7 @@ int dpaa2_caam_enqueue(struct device *dev, struct caam_request *req) |
1954 |
+ dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1])); |
1955 |
+ dpaa2_fd_set_flc(&fd, req->flc_dma); |
1956 |
+ |
1957 |
+- ppriv = this_cpu_ptr(priv->ppriv); |
1958 |
++ ppriv = raw_cpu_ptr(priv->ppriv); |
1959 |
+ for (i = 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) { |
1960 |
+ err = dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv->req_fqid, |
1961 |
+ &fd); |
1962 |
+diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c |
1963 |
+index 72edb10181b86..41ffb088831de 100644 |
1964 |
+--- a/drivers/crypto/omap-aes.c |
1965 |
++++ b/drivers/crypto/omap-aes.c |
1966 |
+@@ -1318,7 +1318,7 @@ static int omap_aes_suspend(struct device *dev) |
1967 |
+ |
1968 |
+ static int omap_aes_resume(struct device *dev) |
1969 |
+ { |
1970 |
+- pm_runtime_resume_and_get(dev); |
1971 |
++ pm_runtime_get_sync(dev); |
1972 |
+ return 0; |
1973 |
+ } |
1974 |
+ #endif |
1975 |
+diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c |
1976 |
+index 0853e74583ade..29b0bad2507b1 100644 |
1977 |
+--- a/drivers/crypto/qce/sha.c |
1978 |
++++ b/drivers/crypto/qce/sha.c |
1979 |
+@@ -512,8 +512,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, |
1980 |
+ |
1981 |
+ ret = crypto_register_ahash(alg); |
1982 |
+ if (ret) { |
1983 |
+- kfree(tmpl); |
1984 |
+ dev_err(qce->dev, "%s registration failed\n", base->cra_name); |
1985 |
++ kfree(tmpl); |
1986 |
+ return ret; |
1987 |
+ } |
1988 |
+ |
1989 |
+diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c |
1990 |
+index e68b856d03b6e..fb640e0ea6140 100644 |
1991 |
+--- a/drivers/crypto/stm32/stm32-crc32.c |
1992 |
++++ b/drivers/crypto/stm32/stm32-crc32.c |
1993 |
+@@ -230,7 +230,7 @@ static struct shash_alg algs[] = { |
1994 |
+ .digestsize = CHKSUM_DIGEST_SIZE, |
1995 |
+ .base = { |
1996 |
+ .cra_name = "crc32", |
1997 |
+- .cra_driver_name = DRIVER_NAME, |
1998 |
++ .cra_driver_name = "stm32-crc32-crc32", |
1999 |
+ .cra_priority = 200, |
2000 |
+ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, |
2001 |
+ .cra_blocksize = CHKSUM_BLOCK_SIZE, |
2002 |
+@@ -252,7 +252,7 @@ static struct shash_alg algs[] = { |
2003 |
+ .digestsize = CHKSUM_DIGEST_SIZE, |
2004 |
+ .base = { |
2005 |
+ .cra_name = "crc32c", |
2006 |
+- .cra_driver_name = DRIVER_NAME, |
2007 |
++ .cra_driver_name = "stm32-crc32-crc32c", |
2008 |
+ .cra_priority = 200, |
2009 |
+ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, |
2010 |
+ .cra_blocksize = CHKSUM_BLOCK_SIZE, |
2011 |
+diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c |
2012 |
+index 9b3511236ba25..69c2468f1053d 100644 |
2013 |
+--- a/drivers/crypto/stm32/stm32-cryp.c |
2014 |
++++ b/drivers/crypto/stm32/stm32-cryp.c |
2015 |
+@@ -639,7 +639,7 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err) |
2016 |
+ /* Phase 4 : output tag */ |
2017 |
+ err = stm32_cryp_read_auth_tag(cryp); |
2018 |
+ |
2019 |
+- if (!err && (!(is_gcm(cryp) || is_ccm(cryp)))) |
2020 |
++ if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp)))) |
2021 |
+ stm32_cryp_get_iv(cryp); |
2022 |
+ |
2023 |
+ if (cryp->sgs_copied) { |
2024 |
+@@ -669,8 +669,6 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err) |
2025 |
+ else |
2026 |
+ crypto_finalize_ablkcipher_request(cryp->engine, cryp->req, |
2027 |
+ err); |
2028 |
+- |
2029 |
+- memset(cryp->ctx->key, 0, cryp->ctx->keylen); |
2030 |
+ } |
2031 |
+ |
2032 |
+ static int stm32_cryp_cpu_start(struct stm32_cryp *cryp) |
2033 |
+@@ -2036,8 +2034,6 @@ err_engine1: |
2034 |
+ list_del(&cryp->list); |
2035 |
+ spin_unlock(&cryp_list.lock); |
2036 |
+ |
2037 |
+- pm_runtime_disable(dev); |
2038 |
+- pm_runtime_put_noidle(dev); |
2039 |
+ pm_runtime_disable(dev); |
2040 |
+ pm_runtime_put_noidle(dev); |
2041 |
+ |
2042 |
+diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c |
2043 |
+index d3fbd950be944..3e07f961e2f3d 100644 |
2044 |
+--- a/drivers/dma-buf/dma-fence-array.c |
2045 |
++++ b/drivers/dma-buf/dma-fence-array.c |
2046 |
+@@ -104,7 +104,11 @@ static bool dma_fence_array_signaled(struct dma_fence *fence) |
2047 |
+ { |
2048 |
+ struct dma_fence_array *array = to_dma_fence_array(fence); |
2049 |
+ |
2050 |
+- return atomic_read(&array->num_pending) <= 0; |
2051 |
++ if (atomic_read(&array->num_pending) > 0) |
2052 |
++ return false; |
2053 |
++ |
2054 |
++ dma_fence_array_clear_pending_error(array); |
2055 |
++ return true; |
2056 |
+ } |
2057 |
+ |
2058 |
+ static void dma_fence_array_release(struct dma_fence *fence) |
2059 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
2060 |
+index 6f1e97ba3e786..f63d141481a3f 100644 |
2061 |
+--- a/drivers/dma/at_xdmac.c |
2062 |
++++ b/drivers/dma/at_xdmac.c |
2063 |
+@@ -89,6 +89,7 @@ |
2064 |
+ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enable */ |
2065 |
+ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Source Update */ |
2066 |
+ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Destination Update */ |
2067 |
++#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) |
2068 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descriptor View 0 */ |
2069 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descriptor View 1 */ |
2070 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descriptor View 2 */ |
2071 |
+@@ -220,15 +221,15 @@ struct at_xdmac { |
2072 |
+ |
2073 |
+ /* Linked List Descriptor */ |
2074 |
+ struct at_xdmac_lld { |
2075 |
+- dma_addr_t mbr_nda; /* Next Descriptor Member */ |
2076 |
+- u32 mbr_ubc; /* Microblock Control Member */ |
2077 |
+- dma_addr_t mbr_sa; /* Source Address Member */ |
2078 |
+- dma_addr_t mbr_da; /* Destination Address Member */ |
2079 |
+- u32 mbr_cfg; /* Configuration Register */ |
2080 |
+- u32 mbr_bc; /* Block Control Register */ |
2081 |
+- u32 mbr_ds; /* Data Stride Register */ |
2082 |
+- u32 mbr_sus; /* Source Microblock Stride Register */ |
2083 |
+- u32 mbr_dus; /* Destination Microblock Stride Register */ |
2084 |
++ u32 mbr_nda; /* Next Descriptor Member */ |
2085 |
++ u32 mbr_ubc; /* Microblock Control Member */ |
2086 |
++ u32 mbr_sa; /* Source Address Member */ |
2087 |
++ u32 mbr_da; /* Destination Address Member */ |
2088 |
++ u32 mbr_cfg; /* Configuration Register */ |
2089 |
++ u32 mbr_bc; /* Block Control Register */ |
2090 |
++ u32 mbr_ds; /* Data Stride Register */ |
2091 |
++ u32 mbr_sus; /* Source Microblock Stride Register */ |
2092 |
++ u32 mbr_dus; /* Destination Microblock Stride Register */ |
2093 |
+ }; |
2094 |
+ |
2095 |
+ /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ |
2096 |
+@@ -338,9 +339,6 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
2097 |
+ |
2098 |
+ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); |
2099 |
+ |
2100 |
+- if (at_xdmac_chan_is_enabled(atchan)) |
2101 |
+- return; |
2102 |
+- |
2103 |
+ /* Set transfer as active to not try to start it again. */ |
2104 |
+ first->active_xfer = true; |
2105 |
+ |
2106 |
+@@ -356,7 +354,8 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
2107 |
+ */ |
2108 |
+ if (at_xdmac_chan_is_cyclic(atchan)) |
2109 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV1; |
2110 |
+- else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) |
2111 |
++ else if ((first->lld.mbr_ubc & |
2112 |
++ AT_XDMAC_CNDC_NDVIEW_MASK) == AT_XDMAC_MBR_UBC_NDV3) |
2113 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV3; |
2114 |
+ else |
2115 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV2; |
2116 |
+@@ -427,13 +426,12 @@ static dma_cookie_t at_xdmac_tx_submit(struct dma_async_tx_descriptor *tx) |
2117 |
+ spin_lock_irqsave(&atchan->lock, irqflags); |
2118 |
+ cookie = dma_cookie_assign(tx); |
2119 |
+ |
2120 |
++ list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
2121 |
++ spin_unlock_irqrestore(&atchan->lock, irqflags); |
2122 |
++ |
2123 |
+ dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_list\n", |
2124 |
+ __func__, atchan, desc); |
2125 |
+- list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
2126 |
+- if (list_is_singular(&atchan->xfers_list)) |
2127 |
+- at_xdmac_start_xfer(atchan, desc); |
2128 |
+ |
2129 |
+- spin_unlock_irqrestore(&atchan->lock, irqflags); |
2130 |
+ return cookie; |
2131 |
+ } |
2132 |
+ |
2133 |
+@@ -1568,14 +1566,17 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan) |
2134 |
+ struct at_xdmac_desc *desc; |
2135 |
+ struct dma_async_tx_descriptor *txd; |
2136 |
+ |
2137 |
+- if (!list_empty(&atchan->xfers_list)) { |
2138 |
+- desc = list_first_entry(&atchan->xfers_list, |
2139 |
+- struct at_xdmac_desc, xfer_node); |
2140 |
+- txd = &desc->tx_dma_desc; |
2141 |
+- |
2142 |
+- if (txd->flags & DMA_PREP_INTERRUPT) |
2143 |
+- dmaengine_desc_get_callback_invoke(txd, NULL); |
2144 |
++ spin_lock_irq(&atchan->lock); |
2145 |
++ if (list_empty(&atchan->xfers_list)) { |
2146 |
++ spin_unlock_irq(&atchan->lock); |
2147 |
++ return; |
2148 |
+ } |
2149 |
++ desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, |
2150 |
++ xfer_node); |
2151 |
++ spin_unlock_irq(&atchan->lock); |
2152 |
++ txd = &desc->tx_dma_desc; |
2153 |
++ if (txd->flags & DMA_PREP_INTERRUPT) |
2154 |
++ dmaengine_desc_get_callback_invoke(txd, NULL); |
2155 |
+ } |
2156 |
+ |
2157 |
+ static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) |
2158 |
+diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c |
2159 |
+index 7fe494fc50d4e..ec186cf8b8af1 100644 |
2160 |
+--- a/drivers/dma/mmp_pdma.c |
2161 |
++++ b/drivers/dma/mmp_pdma.c |
2162 |
+@@ -728,12 +728,6 @@ static int mmp_pdma_config_write(struct dma_chan *dchan, |
2163 |
+ |
2164 |
+ chan->dir = direction; |
2165 |
+ chan->dev_addr = addr; |
2166 |
+- /* FIXME: drivers should be ported over to use the filter |
2167 |
+- * function. Once that's done, the following two lines can |
2168 |
+- * be removed. |
2169 |
+- */ |
2170 |
+- if (cfg->slave_id) |
2171 |
+- chan->drcmr = cfg->slave_id; |
2172 |
+ |
2173 |
+ return 0; |
2174 |
+ } |
2175 |
+diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c |
2176 |
+index 349fb312c8725..b4ef4f19f7dec 100644 |
2177 |
+--- a/drivers/dma/pxa_dma.c |
2178 |
++++ b/drivers/dma/pxa_dma.c |
2179 |
+@@ -911,13 +911,6 @@ static void pxad_get_config(struct pxad_chan *chan, |
2180 |
+ *dcmd |= PXA_DCMD_BURST16; |
2181 |
+ else if (maxburst == 32) |
2182 |
+ *dcmd |= PXA_DCMD_BURST32; |
2183 |
+- |
2184 |
+- /* FIXME: drivers should be ported over to use the filter |
2185 |
+- * function. Once that's done, the following two lines can |
2186 |
+- * be removed. |
2187 |
+- */ |
2188 |
+- if (chan->cfg.slave_id) |
2189 |
+- chan->drcmr = chan->cfg.slave_id; |
2190 |
+ } |
2191 |
+ |
2192 |
+ static struct dma_async_tx_descriptor * |
2193 |
+diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c |
2194 |
+index ee1cbf3be75d5..a05355d1292e8 100644 |
2195 |
+--- a/drivers/dma/stm32-mdma.c |
2196 |
++++ b/drivers/dma/stm32-mdma.c |
2197 |
+@@ -184,7 +184,7 @@ |
2198 |
+ #define STM32_MDMA_CTBR(x) (0x68 + 0x40 * (x)) |
2199 |
+ #define STM32_MDMA_CTBR_DBUS BIT(17) |
2200 |
+ #define STM32_MDMA_CTBR_SBUS BIT(16) |
2201 |
+-#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) |
2202 |
++#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0) |
2203 |
+ #define STM32_MDMA_CTBR_TSEL(n) STM32_MDMA_SET(n, \ |
2204 |
+ STM32_MDMA_CTBR_TSEL_MASK) |
2205 |
+ |
2206 |
+diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c |
2207 |
+index 6becf3363ad57..d23a0782fb49c 100644 |
2208 |
+--- a/drivers/edac/synopsys_edac.c |
2209 |
++++ b/drivers/edac/synopsys_edac.c |
2210 |
+@@ -1351,8 +1351,7 @@ static int mc_probe(struct platform_device *pdev) |
2211 |
+ } |
2212 |
+ } |
2213 |
+ |
2214 |
+- if (of_device_is_compatible(pdev->dev.of_node, |
2215 |
+- "xlnx,zynqmp-ddrc-2.40a")) |
2216 |
++ if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT) |
2217 |
+ setup_address_map(priv); |
2218 |
+ #endif |
2219 |
+ |
2220 |
+diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig |
2221 |
+index a3a6ca659ffa3..2fba0aa7fc54d 100644 |
2222 |
+--- a/drivers/firmware/google/Kconfig |
2223 |
++++ b/drivers/firmware/google/Kconfig |
2224 |
+@@ -3,9 +3,9 @@ menuconfig GOOGLE_FIRMWARE |
2225 |
+ bool "Google Firmware Drivers" |
2226 |
+ default n |
2227 |
+ help |
2228 |
+- These firmware drivers are used by Google's servers. They are |
2229 |
+- only useful if you are working directly on one of their |
2230 |
+- proprietary servers. If in doubt, say "N". |
2231 |
++ These firmware drivers are used by Google servers, |
2232 |
++ Chromebooks and other devices using coreboot firmware. |
2233 |
++ If in doubt, say "N". |
2234 |
+ |
2235 |
+ if GOOGLE_FIRMWARE |
2236 |
+ |
2237 |
+diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c |
2238 |
+index 2820c59b5f071..22e0d6fcab1c4 100644 |
2239 |
+--- a/drivers/gpio/gpio-aspeed.c |
2240 |
++++ b/drivers/gpio/gpio-aspeed.c |
2241 |
+@@ -53,7 +53,7 @@ struct aspeed_gpio_config { |
2242 |
+ struct aspeed_gpio { |
2243 |
+ struct gpio_chip chip; |
2244 |
+ struct irq_chip irqc; |
2245 |
+- spinlock_t lock; |
2246 |
++ raw_spinlock_t lock; |
2247 |
+ void __iomem *base; |
2248 |
+ int irq; |
2249 |
+ const struct aspeed_gpio_config *config; |
2250 |
+@@ -413,14 +413,14 @@ static void aspeed_gpio_set(struct gpio_chip *gc, unsigned int offset, |
2251 |
+ unsigned long flags; |
2252 |
+ bool copro; |
2253 |
+ |
2254 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2255 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2256 |
+ copro = aspeed_gpio_copro_request(gpio, offset); |
2257 |
+ |
2258 |
+ __aspeed_gpio_set(gc, offset, val); |
2259 |
+ |
2260 |
+ if (copro) |
2261 |
+ aspeed_gpio_copro_release(gpio, offset); |
2262 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2263 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2264 |
+ } |
2265 |
+ |
2266 |
+ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) |
2267 |
+@@ -435,7 +435,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) |
2268 |
+ if (!have_input(gpio, offset)) |
2269 |
+ return -ENOTSUPP; |
2270 |
+ |
2271 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2272 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2273 |
+ |
2274 |
+ reg = ioread32(addr); |
2275 |
+ reg &= ~GPIO_BIT(offset); |
2276 |
+@@ -445,7 +445,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) |
2277 |
+ if (copro) |
2278 |
+ aspeed_gpio_copro_release(gpio, offset); |
2279 |
+ |
2280 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2281 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2282 |
+ |
2283 |
+ return 0; |
2284 |
+ } |
2285 |
+@@ -463,7 +463,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, |
2286 |
+ if (!have_output(gpio, offset)) |
2287 |
+ return -ENOTSUPP; |
2288 |
+ |
2289 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2290 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2291 |
+ |
2292 |
+ reg = ioread32(addr); |
2293 |
+ reg |= GPIO_BIT(offset); |
2294 |
+@@ -474,7 +474,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, |
2295 |
+ |
2296 |
+ if (copro) |
2297 |
+ aspeed_gpio_copro_release(gpio, offset); |
2298 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2299 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2300 |
+ |
2301 |
+ return 0; |
2302 |
+ } |
2303 |
+@@ -492,11 +492,11 @@ static int aspeed_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) |
2304 |
+ if (!have_output(gpio, offset)) |
2305 |
+ return 1; |
2306 |
+ |
2307 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2308 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2309 |
+ |
2310 |
+ val = ioread32(bank_reg(gpio, bank, reg_dir)) & GPIO_BIT(offset); |
2311 |
+ |
2312 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2313 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2314 |
+ |
2315 |
+ return !val; |
2316 |
+ |
2317 |
+@@ -540,14 +540,14 @@ static void aspeed_gpio_irq_ack(struct irq_data *d) |
2318 |
+ |
2319 |
+ status_addr = bank_reg(gpio, bank, reg_irq_status); |
2320 |
+ |
2321 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2322 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2323 |
+ copro = aspeed_gpio_copro_request(gpio, offset); |
2324 |
+ |
2325 |
+ iowrite32(bit, status_addr); |
2326 |
+ |
2327 |
+ if (copro) |
2328 |
+ aspeed_gpio_copro_release(gpio, offset); |
2329 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2330 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2331 |
+ } |
2332 |
+ |
2333 |
+ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) |
2334 |
+@@ -566,7 +566,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) |
2335 |
+ |
2336 |
+ addr = bank_reg(gpio, bank, reg_irq_enable); |
2337 |
+ |
2338 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2339 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2340 |
+ copro = aspeed_gpio_copro_request(gpio, offset); |
2341 |
+ |
2342 |
+ reg = ioread32(addr); |
2343 |
+@@ -578,7 +578,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) |
2344 |
+ |
2345 |
+ if (copro) |
2346 |
+ aspeed_gpio_copro_release(gpio, offset); |
2347 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2348 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2349 |
+ } |
2350 |
+ |
2351 |
+ static void aspeed_gpio_irq_mask(struct irq_data *d) |
2352 |
+@@ -630,7 +630,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type) |
2353 |
+ return -EINVAL; |
2354 |
+ } |
2355 |
+ |
2356 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2357 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2358 |
+ copro = aspeed_gpio_copro_request(gpio, offset); |
2359 |
+ |
2360 |
+ addr = bank_reg(gpio, bank, reg_irq_type0); |
2361 |
+@@ -650,7 +650,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type) |
2362 |
+ |
2363 |
+ if (copro) |
2364 |
+ aspeed_gpio_copro_release(gpio, offset); |
2365 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2366 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2367 |
+ |
2368 |
+ irq_set_handler_locked(d, handler); |
2369 |
+ |
2370 |
+@@ -720,7 +720,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip, |
2371 |
+ |
2372 |
+ treg = bank_reg(gpio, to_bank(offset), reg_tolerance); |
2373 |
+ |
2374 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2375 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2376 |
+ copro = aspeed_gpio_copro_request(gpio, offset); |
2377 |
+ |
2378 |
+ val = readl(treg); |
2379 |
+@@ -734,7 +734,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip, |
2380 |
+ |
2381 |
+ if (copro) |
2382 |
+ aspeed_gpio_copro_release(gpio, offset); |
2383 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2384 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2385 |
+ |
2386 |
+ return 0; |
2387 |
+ } |
2388 |
+@@ -860,7 +860,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, |
2389 |
+ return rc; |
2390 |
+ } |
2391 |
+ |
2392 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2393 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2394 |
+ |
2395 |
+ if (timer_allocation_registered(gpio, offset)) { |
2396 |
+ rc = unregister_allocated_timer(gpio, offset); |
2397 |
+@@ -920,7 +920,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, |
2398 |
+ configure_timer(gpio, offset, i); |
2399 |
+ |
2400 |
+ out: |
2401 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2402 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2403 |
+ |
2404 |
+ return rc; |
2405 |
+ } |
2406 |
+@@ -931,13 +931,13 @@ static int disable_debounce(struct gpio_chip *chip, unsigned int offset) |
2407 |
+ unsigned long flags; |
2408 |
+ int rc; |
2409 |
+ |
2410 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2411 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2412 |
+ |
2413 |
+ rc = unregister_allocated_timer(gpio, offset); |
2414 |
+ if (!rc) |
2415 |
+ configure_timer(gpio, offset, 0); |
2416 |
+ |
2417 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2418 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2419 |
+ |
2420 |
+ return rc; |
2421 |
+ } |
2422 |
+@@ -1019,7 +1019,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc, |
2423 |
+ return -EINVAL; |
2424 |
+ bindex = offset >> 3; |
2425 |
+ |
2426 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2427 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2428 |
+ |
2429 |
+ /* Sanity check, this shouldn't happen */ |
2430 |
+ if (gpio->cf_copro_bankmap[bindex] == 0xff) { |
2431 |
+@@ -1040,7 +1040,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc, |
2432 |
+ if (bit) |
2433 |
+ *bit = GPIO_OFFSET(offset); |
2434 |
+ bail: |
2435 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2436 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2437 |
+ return rc; |
2438 |
+ } |
2439 |
+ EXPORT_SYMBOL_GPL(aspeed_gpio_copro_grab_gpio); |
2440 |
+@@ -1064,7 +1064,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc) |
2441 |
+ return -EINVAL; |
2442 |
+ bindex = offset >> 3; |
2443 |
+ |
2444 |
+- spin_lock_irqsave(&gpio->lock, flags); |
2445 |
++ raw_spin_lock_irqsave(&gpio->lock, flags); |
2446 |
+ |
2447 |
+ /* Sanity check, this shouldn't happen */ |
2448 |
+ if (gpio->cf_copro_bankmap[bindex] == 0) { |
2449 |
+@@ -1078,7 +1078,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc) |
2450 |
+ aspeed_gpio_change_cmd_source(gpio, bank, bindex, |
2451 |
+ GPIO_CMDSRC_ARM); |
2452 |
+ bail: |
2453 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
2454 |
++ raw_spin_unlock_irqrestore(&gpio->lock, flags); |
2455 |
+ return rc; |
2456 |
+ } |
2457 |
+ EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); |
2458 |
+@@ -1151,7 +1151,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) |
2459 |
+ if (IS_ERR(gpio->base)) |
2460 |
+ return PTR_ERR(gpio->base); |
2461 |
+ |
2462 |
+- spin_lock_init(&gpio->lock); |
2463 |
++ raw_spin_lock_init(&gpio->lock); |
2464 |
+ |
2465 |
+ gpio_id = of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); |
2466 |
+ if (!gpio_id) |
2467 |
+diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c |
2468 |
+index e3ddc99c105d4..13c6eee481da7 100644 |
2469 |
+--- a/drivers/gpio/gpiolib-acpi.c |
2470 |
++++ b/drivers/gpio/gpiolib-acpi.c |
2471 |
+@@ -953,10 +953,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
2472 |
+ irq_flags = acpi_dev_get_irq_type(info.triggering, |
2473 |
+ info.polarity); |
2474 |
+ |
2475 |
+- /* Set type if specified and different than the current one */ |
2476 |
+- if (irq_flags != IRQ_TYPE_NONE && |
2477 |
+- irq_flags != irq_get_trigger_type(irq)) |
2478 |
+- irq_set_irq_type(irq, irq_flags); |
2479 |
++ /* |
2480 |
++ * If the IRQ is not already in use then set type |
2481 |
++ * if specified and different than the current one. |
2482 |
++ */ |
2483 |
++ if (can_request_irq(irq, irq_flags)) { |
2484 |
++ if (irq_flags != IRQ_TYPE_NONE && |
2485 |
++ irq_flags != irq_get_trigger_type(irq)) |
2486 |
++ irq_set_irq_type(irq, irq_flags); |
2487 |
++ } else { |
2488 |
++ dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); |
2489 |
++ } |
2490 |
+ |
2491 |
+ return irq; |
2492 |
+ } |
2493 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
2494 |
+index 0d39e386f6e9c..0e1cacf731698 100644 |
2495 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
2496 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
2497 |
+@@ -389,6 +389,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
2498 |
+ native_mode->vdisplay != 0 && |
2499 |
+ native_mode->clock != 0) { |
2500 |
+ mode = drm_mode_duplicate(dev, native_mode); |
2501 |
++ if (!mode) |
2502 |
++ return NULL; |
2503 |
++ |
2504 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
2505 |
+ drm_mode_set_name(mode); |
2506 |
+ |
2507 |
+@@ -403,6 +406,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
2508 |
+ * simpler. |
2509 |
+ */ |
2510 |
+ mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); |
2511 |
++ if (!mode) |
2512 |
++ return NULL; |
2513 |
++ |
2514 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
2515 |
+ DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); |
2516 |
+ } |
2517 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
2518 |
+index ea764dd9245db..2975331a7b867 100644 |
2519 |
+--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
2520 |
++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
2521 |
+@@ -524,10 +524,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev) |
2522 |
+ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) |
2523 |
+ { |
2524 |
+ int r; |
2525 |
++ u32 tmp; |
2526 |
+ |
2527 |
+ adev->gmc.vram_width = amdgpu_atombios_get_vram_width(adev); |
2528 |
+ if (!adev->gmc.vram_width) { |
2529 |
+- u32 tmp; |
2530 |
+ int chansize, numchan; |
2531 |
+ |
2532 |
+ /* Get VRAM informations */ |
2533 |
+@@ -571,8 +571,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) |
2534 |
+ adev->gmc.vram_width = numchan * chansize; |
2535 |
+ } |
2536 |
+ /* size in MB on si */ |
2537 |
+- adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
2538 |
+- adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
2539 |
++ tmp = RREG32(mmCONFIG_MEMSIZE); |
2540 |
++ /* some boards may have garbage in the upper 16 bits */ |
2541 |
++ if (tmp & 0xffff0000) { |
2542 |
++ DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); |
2543 |
++ if (tmp & 0xffff) |
2544 |
++ tmp &= 0xffff; |
2545 |
++ } |
2546 |
++ adev->gmc.mc_vram_size = tmp * 1024ULL * 1024ULL; |
2547 |
++ adev->gmc.real_vram_size = adev->gmc.mc_vram_size; |
2548 |
+ |
2549 |
+ if (!(adev->flags & AMD_IS_APU)) { |
2550 |
+ r = amdgpu_device_resize_fb_bar(adev); |
2551 |
+diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c |
2552 |
+index 914c569ab8c15..cab3f5c4e2fc8 100644 |
2553 |
+--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c |
2554 |
++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c |
2555 |
+@@ -1086,11 +1086,21 @@ int analogix_dp_send_psr_spd(struct analogix_dp_device *dp, |
2556 |
+ if (!blocking) |
2557 |
+ return 0; |
2558 |
+ |
2559 |
++ /* |
2560 |
++ * db[1]!=0: entering PSR, wait for fully active remote frame buffer. |
2561 |
++ * db[1]==0: exiting PSR, wait for either |
2562 |
++ * (a) ACTIVE_RESYNC - the sink "must display the |
2563 |
++ * incoming active frames from the Source device with no visible |
2564 |
++ * glitches and/or artifacts", even though timings may still be |
2565 |
++ * re-synchronizing; or |
2566 |
++ * (b) INACTIVE - the transition is fully complete. |
2567 |
++ */ |
2568 |
+ ret = readx_poll_timeout(analogix_dp_get_psr_status, dp, psr_status, |
2569 |
+ psr_status >= 0 && |
2570 |
+ ((vsc->db[1] && psr_status == DP_PSR_SINK_ACTIVE_RFB) || |
2571 |
+- (!vsc->db[1] && psr_status == DP_PSR_SINK_INACTIVE)), 1500, |
2572 |
+- DP_TIMEOUT_PSR_LOOP_MS * 1000); |
2573 |
++ (!vsc->db[1] && (psr_status == DP_PSR_SINK_ACTIVE_RESYNC || |
2574 |
++ psr_status == DP_PSR_SINK_INACTIVE))), |
2575 |
++ 1500, DP_TIMEOUT_PSR_LOOP_MS * 1000); |
2576 |
+ if (ret) { |
2577 |
+ dev_warn(dp->dev, "Failed to apply PSR %d\n", ret); |
2578 |
+ return ret; |
2579 |
+diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
2580 |
+index b050fd1f3d201..5302dd90a7a5f 100644 |
2581 |
+--- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
2582 |
++++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c |
2583 |
+@@ -291,19 +291,10 @@ out: |
2584 |
+ mutex_unlock(&ge_b850v3_lvds_dev_mutex); |
2585 |
+ } |
2586 |
+ |
2587 |
+-static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
2588 |
+- const struct i2c_device_id *id) |
2589 |
++static int ge_b850v3_register(void) |
2590 |
+ { |
2591 |
++ struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c; |
2592 |
+ struct device *dev = &stdp4028_i2c->dev; |
2593 |
+- int ret; |
2594 |
+- |
2595 |
+- ret = ge_b850v3_lvds_init(dev); |
2596 |
+- |
2597 |
+- if (ret) |
2598 |
+- return ret; |
2599 |
+- |
2600 |
+- ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; |
2601 |
+- i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); |
2602 |
+ |
2603 |
+ /* drm bridge initialization */ |
2604 |
+ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; |
2605 |
+@@ -325,6 +316,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
2606 |
+ "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); |
2607 |
+ } |
2608 |
+ |
2609 |
++static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, |
2610 |
++ const struct i2c_device_id *id) |
2611 |
++{ |
2612 |
++ struct device *dev = &stdp4028_i2c->dev; |
2613 |
++ int ret; |
2614 |
++ |
2615 |
++ ret = ge_b850v3_lvds_init(dev); |
2616 |
++ |
2617 |
++ if (ret) |
2618 |
++ return ret; |
2619 |
++ |
2620 |
++ ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; |
2621 |
++ i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); |
2622 |
++ |
2623 |
++ /* Only register after both bridges are probed */ |
2624 |
++ if (!ge_b850v3_lvds_ptr->stdp2690_i2c) |
2625 |
++ return 0; |
2626 |
++ |
2627 |
++ return ge_b850v3_register(); |
2628 |
++} |
2629 |
++ |
2630 |
+ static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) |
2631 |
+ { |
2632 |
+ ge_b850v3_lvds_remove(); |
2633 |
+@@ -368,7 +380,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, |
2634 |
+ ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; |
2635 |
+ i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); |
2636 |
+ |
2637 |
+- return 0; |
2638 |
++ /* Only register after both bridges are probed */ |
2639 |
++ if (!ge_b850v3_lvds_ptr->stdp4028_i2c) |
2640 |
++ return 0; |
2641 |
++ |
2642 |
++ return ge_b850v3_register(); |
2643 |
+ } |
2644 |
+ |
2645 |
+ static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) |
2646 |
+diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
2647 |
+index f1de4bb6558ca..dbb4a374cb646 100644 |
2648 |
+--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
2649 |
++++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
2650 |
+@@ -115,6 +115,7 @@ static const struct regmap_config ti_sn_bridge_regmap_config = { |
2651 |
+ .val_bits = 8, |
2652 |
+ .volatile_table = &ti_sn_bridge_volatile_table, |
2653 |
+ .cache_type = REGCACHE_NONE, |
2654 |
++ .max_register = 0xFF, |
2655 |
+ }; |
2656 |
+ |
2657 |
+ static void ti_sn_bridge_write_u16(struct ti_sn_bridge *pdata, |
2658 |
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
2659 |
+index a950d5db211c5..9d1bd8f491ad7 100644 |
2660 |
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c |
2661 |
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
2662 |
+@@ -248,6 +248,12 @@ static const struct dmi_system_id orientation_data[] = { |
2663 |
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), |
2664 |
+ }, |
2665 |
+ .driver_data = (void *)&lcd1200x1920_rightside_up, |
2666 |
++ }, { /* Lenovo Yoga Book X90F / X91F / X91L */ |
2667 |
++ .matches = { |
2668 |
++ /* Non exact match to match all versions */ |
2669 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), |
2670 |
++ }, |
2671 |
++ .driver_data = (void *)&lcd1200x1920_rightside_up, |
2672 |
+ }, { /* OneGX1 Pro */ |
2673 |
+ .matches = { |
2674 |
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), |
2675 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
2676 |
+index 7085b08b1db42..7d155938e2916 100644 |
2677 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
2678 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |
2679 |
+@@ -471,6 +471,12 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, |
2680 |
+ return -EINVAL; |
2681 |
+ } |
2682 |
+ |
2683 |
++ if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || |
2684 |
++ args->nr_bos > SZ_64K || args->nr_pmrs > 128) { |
2685 |
++ DRM_ERROR("submit arguments out of size limits\n"); |
2686 |
++ return -EINVAL; |
2687 |
++ } |
2688 |
++ |
2689 |
+ /* |
2690 |
+ * Copy the command submission and bo array to kernel space in |
2691 |
+ * one go, and do this outside of any locks. |
2692 |
+diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c |
2693 |
+index d86b8d81a483a..155971c57b2d5 100644 |
2694 |
+--- a/drivers/gpu/drm/lima/lima_device.c |
2695 |
++++ b/drivers/gpu/drm/lima/lima_device.c |
2696 |
+@@ -293,6 +293,7 @@ int lima_device_init(struct lima_device *ldev) |
2697 |
+ struct resource *res; |
2698 |
+ |
2699 |
+ dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32)); |
2700 |
++ dma_set_max_seg_size(ldev->dev, UINT_MAX); |
2701 |
+ |
2702 |
+ err = lima_clk_init(ldev); |
2703 |
+ if (err) |
2704 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
2705 |
+index 58b0485dc3750..72f487692adbb 100644 |
2706 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
2707 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
2708 |
+@@ -88,8 +88,8 @@ static int _dpu_danger_signal_status(struct seq_file *s, |
2709 |
+ &status); |
2710 |
+ } else { |
2711 |
+ seq_puts(s, "\nSafe signal status:\n"); |
2712 |
+- if (kms->hw_mdp->ops.get_danger_status) |
2713 |
+- kms->hw_mdp->ops.get_danger_status(kms->hw_mdp, |
2714 |
++ if (kms->hw_mdp->ops.get_safe_status) |
2715 |
++ kms->hw_mdp->ops.get_safe_status(kms->hw_mdp, |
2716 |
+ &status); |
2717 |
+ } |
2718 |
+ pm_runtime_put_sync(&kms->pdev->dev); |
2719 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c |
2720 |
+index dc64863b5fd88..f517b39aba56b 100644 |
2721 |
+--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c |
2722 |
++++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c |
2723 |
+@@ -179,7 +179,7 @@ nv04_display_destroy(struct drm_device *dev) |
2724 |
+ nvif_notify_fini(&disp->flip); |
2725 |
+ |
2726 |
+ nouveau_display(dev)->priv = NULL; |
2727 |
+- kfree(disp); |
2728 |
++ vfree(disp); |
2729 |
+ |
2730 |
+ nvif_object_unmap(&drm->client.device.object); |
2731 |
+ } |
2732 |
+@@ -197,7 +197,7 @@ nv04_display_create(struct drm_device *dev) |
2733 |
+ struct nv04_display *disp; |
2734 |
+ int i, ret; |
2735 |
+ |
2736 |
+- disp = kzalloc(sizeof(*disp), GFP_KERNEL); |
2737 |
++ disp = vzalloc(sizeof(*disp)); |
2738 |
+ if (!disp) |
2739 |
+ return -ENOMEM; |
2740 |
+ |
2741 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
2742 |
+index ea2e11771bca5..105b4be467a3e 100644 |
2743 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
2744 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
2745 |
+@@ -88,20 +88,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) |
2746 |
+ return 0; |
2747 |
+ } |
2748 |
+ |
2749 |
+-static int |
2750 |
++static void |
2751 |
+ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
2752 |
+ { |
2753 |
+ struct nvkm_device *device = pmu->subdev.device; |
2754 |
+ |
2755 |
+ if (!pmu->func->enabled(pmu)) |
2756 |
+- return 0; |
2757 |
+- |
2758 |
+- /* Inhibit interrupts, and wait for idle. */ |
2759 |
+- nvkm_wr32(device, 0x10a014, 0x0000ffff); |
2760 |
+- nvkm_msec(device, 2000, |
2761 |
+- if (!nvkm_rd32(device, 0x10a04c)) |
2762 |
+- break; |
2763 |
+- ); |
2764 |
++ return; |
2765 |
+ |
2766 |
+ /* Reset. */ |
2767 |
+ if (pmu->func->reset) |
2768 |
+@@ -112,25 +105,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
2769 |
+ if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) |
2770 |
+ break; |
2771 |
+ ); |
2772 |
+- |
2773 |
+- return 0; |
2774 |
+ } |
2775 |
+ |
2776 |
+ static int |
2777 |
+ nvkm_pmu_preinit(struct nvkm_subdev *subdev) |
2778 |
+ { |
2779 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
2780 |
+- return nvkm_pmu_reset(pmu); |
2781 |
++ nvkm_pmu_reset(pmu); |
2782 |
++ return 0; |
2783 |
+ } |
2784 |
+ |
2785 |
+ static int |
2786 |
+ nvkm_pmu_init(struct nvkm_subdev *subdev) |
2787 |
+ { |
2788 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
2789 |
+- int ret = nvkm_pmu_reset(pmu); |
2790 |
+- if (ret == 0 && pmu->func->init) |
2791 |
+- ret = pmu->func->init(pmu); |
2792 |
+- return ret; |
2793 |
++ struct nvkm_device *device = pmu->subdev.device; |
2794 |
++ |
2795 |
++ if (!pmu->func->init) |
2796 |
++ return 0; |
2797 |
++ |
2798 |
++ if (pmu->func->enabled(pmu)) { |
2799 |
++ /* Inhibit interrupts, and wait for idle. */ |
2800 |
++ nvkm_wr32(device, 0x10a014, 0x0000ffff); |
2801 |
++ nvkm_msec(device, 2000, |
2802 |
++ if (!nvkm_rd32(device, 0x10a04c)) |
2803 |
++ break; |
2804 |
++ ); |
2805 |
++ |
2806 |
++ nvkm_pmu_reset(pmu); |
2807 |
++ } |
2808 |
++ |
2809 |
++ return pmu->func->init(pmu); |
2810 |
+ } |
2811 |
+ |
2812 |
+ static int |
2813 |
+diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c |
2814 |
+index d92d1c98878c1..df90b66079816 100644 |
2815 |
+--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c |
2816 |
++++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c |
2817 |
+@@ -509,6 +509,7 @@ static void innolux_panel_del(struct innolux_panel *innolux) |
2818 |
+ static int innolux_panel_probe(struct mipi_dsi_device *dsi) |
2819 |
+ { |
2820 |
+ const struct panel_desc *desc; |
2821 |
++ struct innolux_panel *innolux; |
2822 |
+ int err; |
2823 |
+ |
2824 |
+ desc = of_device_get_match_data(&dsi->dev); |
2825 |
+@@ -520,7 +521,14 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi) |
2826 |
+ if (err < 0) |
2827 |
+ return err; |
2828 |
+ |
2829 |
+- return mipi_dsi_attach(dsi); |
2830 |
++ err = mipi_dsi_attach(dsi); |
2831 |
++ if (err < 0) { |
2832 |
++ innolux = mipi_dsi_get_drvdata(dsi); |
2833 |
++ innolux_panel_del(innolux); |
2834 |
++ return err; |
2835 |
++ } |
2836 |
++ |
2837 |
++ return 0; |
2838 |
+ } |
2839 |
+ |
2840 |
+ static int innolux_panel_remove(struct mipi_dsi_device *dsi) |
2841 |
+diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |
2842 |
+index 3ac04eb8d0fe5..1e7fecab72a9f 100644 |
2843 |
+--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |
2844 |
++++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |
2845 |
+@@ -424,7 +424,13 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi) |
2846 |
+ if (err < 0) |
2847 |
+ return err; |
2848 |
+ |
2849 |
+- return mipi_dsi_attach(dsi); |
2850 |
++ err = mipi_dsi_attach(dsi); |
2851 |
++ if (err < 0) { |
2852 |
++ kingdisplay_panel_del(kingdisplay); |
2853 |
++ return err; |
2854 |
++ } |
2855 |
++ |
2856 |
++ return 0; |
2857 |
+ } |
2858 |
+ |
2859 |
+ static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi) |
2860 |
+diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
2861 |
+index 03d3550ecc7cb..51db8b4f6d551 100644 |
2862 |
+--- a/drivers/gpu/drm/radeon/radeon_kms.c |
2863 |
++++ b/drivers/gpu/drm/radeon/radeon_kms.c |
2864 |
+@@ -634,6 +634,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev) |
2865 |
+ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
2866 |
+ { |
2867 |
+ struct radeon_device *rdev = dev->dev_private; |
2868 |
++ struct radeon_fpriv *fpriv; |
2869 |
++ struct radeon_vm *vm; |
2870 |
+ int r; |
2871 |
+ |
2872 |
+ file_priv->driver_priv = NULL; |
2873 |
+@@ -646,48 +648,52 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
2874 |
+ |
2875 |
+ /* new gpu have virtual address space support */ |
2876 |
+ if (rdev->family >= CHIP_CAYMAN) { |
2877 |
+- struct radeon_fpriv *fpriv; |
2878 |
+- struct radeon_vm *vm; |
2879 |
+ |
2880 |
+ fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
2881 |
+ if (unlikely(!fpriv)) { |
2882 |
+ r = -ENOMEM; |
2883 |
+- goto out_suspend; |
2884 |
++ goto err_suspend; |
2885 |
+ } |
2886 |
+ |
2887 |
+ if (rdev->accel_working) { |
2888 |
+ vm = &fpriv->vm; |
2889 |
+ r = radeon_vm_init(rdev, vm); |
2890 |
+- if (r) { |
2891 |
+- kfree(fpriv); |
2892 |
+- goto out_suspend; |
2893 |
+- } |
2894 |
++ if (r) |
2895 |
++ goto err_fpriv; |
2896 |
+ |
2897 |
+ r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
2898 |
+- if (r) { |
2899 |
+- radeon_vm_fini(rdev, vm); |
2900 |
+- kfree(fpriv); |
2901 |
+- goto out_suspend; |
2902 |
+- } |
2903 |
++ if (r) |
2904 |
++ goto err_vm_fini; |
2905 |
+ |
2906 |
+ /* map the ib pool buffer read only into |
2907 |
+ * virtual address space */ |
2908 |
+ vm->ib_bo_va = radeon_vm_bo_add(rdev, vm, |
2909 |
+ rdev->ring_tmp_bo.bo); |
2910 |
++ if (!vm->ib_bo_va) { |
2911 |
++ r = -ENOMEM; |
2912 |
++ goto err_vm_fini; |
2913 |
++ } |
2914 |
++ |
2915 |
+ r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, |
2916 |
+ RADEON_VA_IB_OFFSET, |
2917 |
+ RADEON_VM_PAGE_READABLE | |
2918 |
+ RADEON_VM_PAGE_SNOOPED); |
2919 |
+- if (r) { |
2920 |
+- radeon_vm_fini(rdev, vm); |
2921 |
+- kfree(fpriv); |
2922 |
+- goto out_suspend; |
2923 |
+- } |
2924 |
++ if (r) |
2925 |
++ goto err_vm_fini; |
2926 |
+ } |
2927 |
+ file_priv->driver_priv = fpriv; |
2928 |
+ } |
2929 |
+ |
2930 |
+-out_suspend: |
2931 |
++ pm_runtime_mark_last_busy(dev->dev); |
2932 |
++ pm_runtime_put_autosuspend(dev->dev); |
2933 |
++ return 0; |
2934 |
++ |
2935 |
++err_vm_fini: |
2936 |
++ radeon_vm_fini(rdev, vm); |
2937 |
++err_fpriv: |
2938 |
++ kfree(fpriv); |
2939 |
++ |
2940 |
++err_suspend: |
2941 |
+ pm_runtime_mark_last_busy(dev->dev); |
2942 |
+ pm_runtime_put_autosuspend(dev->dev); |
2943 |
+ return r; |
2944 |
+diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |
2945 |
+index 8dc91c2d916a8..f7191ae2266fd 100644 |
2946 |
+--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |
2947 |
++++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |
2948 |
+@@ -231,6 +231,8 @@ struct dw_mipi_dsi_rockchip { |
2949 |
+ struct dw_mipi_dsi *dmd; |
2950 |
+ const struct rockchip_dw_dsi_chip_data *cdata; |
2951 |
+ struct dw_mipi_dsi_plat_data pdata; |
2952 |
++ |
2953 |
++ bool dsi_bound; |
2954 |
+ }; |
2955 |
+ |
2956 |
+ struct dphy_pll_parameter_map { |
2957 |
+@@ -625,10 +627,6 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) |
2958 |
+ if (mux < 0) |
2959 |
+ return; |
2960 |
+ |
2961 |
+- pm_runtime_get_sync(dsi->dev); |
2962 |
+- if (dsi->slave) |
2963 |
+- pm_runtime_get_sync(dsi->slave->dev); |
2964 |
+- |
2965 |
+ /* |
2966 |
+ * For the RK3399, the clk of grf must be enabled before writing grf |
2967 |
+ * register. And for RK3288 or other soc, this grf_clk must be NULL, |
2968 |
+@@ -647,20 +645,10 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) |
2969 |
+ clk_disable_unprepare(dsi->grf_clk); |
2970 |
+ } |
2971 |
+ |
2972 |
+-static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) |
2973 |
+-{ |
2974 |
+- struct dw_mipi_dsi_rockchip *dsi = to_dsi(encoder); |
2975 |
+- |
2976 |
+- if (dsi->slave) |
2977 |
+- pm_runtime_put(dsi->slave->dev); |
2978 |
+- pm_runtime_put(dsi->dev); |
2979 |
+-} |
2980 |
+- |
2981 |
+ static const struct drm_encoder_helper_funcs |
2982 |
+ dw_mipi_dsi_encoder_helper_funcs = { |
2983 |
+ .atomic_check = dw_mipi_dsi_encoder_atomic_check, |
2984 |
+ .enable = dw_mipi_dsi_encoder_enable, |
2985 |
+- .disable = dw_mipi_dsi_encoder_disable, |
2986 |
+ }; |
2987 |
+ |
2988 |
+ static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = { |
2989 |
+@@ -795,10 +783,14 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, |
2990 |
+ put_device(second); |
2991 |
+ } |
2992 |
+ |
2993 |
++ pm_runtime_get_sync(dsi->dev); |
2994 |
++ if (dsi->slave) |
2995 |
++ pm_runtime_get_sync(dsi->slave->dev); |
2996 |
++ |
2997 |
+ ret = clk_prepare_enable(dsi->pllref_clk); |
2998 |
+ if (ret) { |
2999 |
+ DRM_DEV_ERROR(dev, "Failed to enable pllref_clk: %d\n", ret); |
3000 |
+- return ret; |
3001 |
++ goto out_pm_runtime; |
3002 |
+ } |
3003 |
+ |
3004 |
+ /* |
3005 |
+@@ -810,7 +802,7 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, |
3006 |
+ ret = clk_prepare_enable(dsi->grf_clk); |
3007 |
+ if (ret) { |
3008 |
+ DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); |
3009 |
+- return ret; |
3010 |
++ goto out_pm_runtime; |
3011 |
+ } |
3012 |
+ |
3013 |
+ dw_mipi_dsi_rockchip_config(dsi); |
3014 |
+@@ -822,16 +814,25 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, |
3015 |
+ ret = rockchip_dsi_drm_create_encoder(dsi, drm_dev); |
3016 |
+ if (ret) { |
3017 |
+ DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); |
3018 |
+- return ret; |
3019 |
++ goto out_pm_runtime; |
3020 |
+ } |
3021 |
+ |
3022 |
+ ret = dw_mipi_dsi_bind(dsi->dmd, &dsi->encoder); |
3023 |
+ if (ret) { |
3024 |
+ DRM_DEV_ERROR(dev, "Failed to bind: %d\n", ret); |
3025 |
+- return ret; |
3026 |
++ goto out_pm_runtime; |
3027 |
+ } |
3028 |
+ |
3029 |
++ dsi->dsi_bound = true; |
3030 |
++ |
3031 |
+ return 0; |
3032 |
++ |
3033 |
++out_pm_runtime: |
3034 |
++ pm_runtime_put(dsi->dev); |
3035 |
++ if (dsi->slave) |
3036 |
++ pm_runtime_put(dsi->slave->dev); |
3037 |
++ |
3038 |
++ return ret; |
3039 |
+ } |
3040 |
+ |
3041 |
+ static void dw_mipi_dsi_rockchip_unbind(struct device *dev, |
3042 |
+@@ -843,9 +844,15 @@ static void dw_mipi_dsi_rockchip_unbind(struct device *dev, |
3043 |
+ if (dsi->is_slave) |
3044 |
+ return; |
3045 |
+ |
3046 |
++ dsi->dsi_bound = false; |
3047 |
++ |
3048 |
+ dw_mipi_dsi_unbind(dsi->dmd); |
3049 |
+ |
3050 |
+ clk_disable_unprepare(dsi->pllref_clk); |
3051 |
++ |
3052 |
++ pm_runtime_put(dsi->dev); |
3053 |
++ if (dsi->slave) |
3054 |
++ pm_runtime_put(dsi->slave->dev); |
3055 |
+ } |
3056 |
+ |
3057 |
+ static const struct component_ops dw_mipi_dsi_rockchip_ops = { |
3058 |
+@@ -903,6 +910,36 @@ static const struct dw_mipi_dsi_host_ops dw_mipi_dsi_rockchip_host_ops = { |
3059 |
+ .detach = dw_mipi_dsi_rockchip_host_detach, |
3060 |
+ }; |
3061 |
+ |
3062 |
++static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev) |
3063 |
++{ |
3064 |
++ struct dw_mipi_dsi_rockchip *dsi = dev_get_drvdata(dev); |
3065 |
++ int ret; |
3066 |
++ |
3067 |
++ /* |
3068 |
++ * Re-configure DSI state, if we were previously initialized. We need |
3069 |
++ * to do this before rockchip_drm_drv tries to re-enable() any panels. |
3070 |
++ */ |
3071 |
++ if (dsi->dsi_bound) { |
3072 |
++ ret = clk_prepare_enable(dsi->grf_clk); |
3073 |
++ if (ret) { |
3074 |
++ DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); |
3075 |
++ return ret; |
3076 |
++ } |
3077 |
++ |
3078 |
++ dw_mipi_dsi_rockchip_config(dsi); |
3079 |
++ if (dsi->slave) |
3080 |
++ dw_mipi_dsi_rockchip_config(dsi->slave); |
3081 |
++ |
3082 |
++ clk_disable_unprepare(dsi->grf_clk); |
3083 |
++ } |
3084 |
++ |
3085 |
++ return 0; |
3086 |
++} |
3087 |
++ |
3088 |
++static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops = { |
3089 |
++ SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) |
3090 |
++}; |
3091 |
++ |
3092 |
+ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) |
3093 |
+ { |
3094 |
+ struct device *dev = &pdev->dev; |
3095 |
+@@ -986,14 +1023,10 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) |
3096 |
+ if (ret != -EPROBE_DEFER) |
3097 |
+ DRM_DEV_ERROR(dev, |
3098 |
+ "Failed to probe dw_mipi_dsi: %d\n", ret); |
3099 |
+- goto err_clkdisable; |
3100 |
++ return ret; |
3101 |
+ } |
3102 |
+ |
3103 |
+ return 0; |
3104 |
+- |
3105 |
+-err_clkdisable: |
3106 |
+- clk_disable_unprepare(dsi->pllref_clk); |
3107 |
+- return ret; |
3108 |
+ } |
3109 |
+ |
3110 |
+ static int dw_mipi_dsi_rockchip_remove(struct platform_device *pdev) |
3111 |
+@@ -1088,6 +1121,7 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = { |
3112 |
+ .remove = dw_mipi_dsi_rockchip_remove, |
3113 |
+ .driver = { |
3114 |
+ .of_match_table = dw_mipi_dsi_rockchip_dt_ids, |
3115 |
++ .pm = &dw_mipi_dsi_rockchip_pm_ops, |
3116 |
+ .name = "dw-mipi-dsi-rockchip", |
3117 |
+ }, |
3118 |
+ }; |
3119 |
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c |
3120 |
+index 07df64daf7dae..efce31d035ef5 100644 |
3121 |
+--- a/drivers/hid/hid-apple.c |
3122 |
++++ b/drivers/hid/hid-apple.c |
3123 |
+@@ -389,7 +389,7 @@ static int apple_input_configured(struct hid_device *hdev, |
3124 |
+ |
3125 |
+ if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { |
3126 |
+ hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); |
3127 |
+- asc->quirks = 0; |
3128 |
++ asc->quirks &= ~APPLE_HAS_FN; |
3129 |
+ } |
3130 |
+ |
3131 |
+ return 0; |
3132 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
3133 |
+index ea4c97f5b0736..749558aa27e78 100644 |
3134 |
+--- a/drivers/hid/hid-input.c |
3135 |
++++ b/drivers/hid/hid-input.c |
3136 |
+@@ -1288,6 +1288,12 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct |
3137 |
+ |
3138 |
+ input = field->hidinput->input; |
3139 |
+ |
3140 |
++ if (usage->type == EV_ABS && |
3141 |
++ (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) || |
3142 |
++ ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) { |
3143 |
++ value = field->logical_maximum - value; |
3144 |
++ } |
3145 |
++ |
3146 |
+ if (usage->hat_min < usage->hat_max || usage->hat_dir) { |
3147 |
+ int hat_dir = usage->hat_dir; |
3148 |
+ if (!hat_dir) |
3149 |
+diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c |
3150 |
+index ed4ede52b017f..191aba9f6b497 100644 |
3151 |
+--- a/drivers/hid/hid-uclogic-params.c |
3152 |
++++ b/drivers/hid/hid-uclogic-params.c |
3153 |
+@@ -65,7 +65,7 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struct hid_device *hdev, |
3154 |
+ __u8 idx, size_t len) |
3155 |
+ { |
3156 |
+ int rc; |
3157 |
+- struct usb_device *udev = hid_to_usb_dev(hdev); |
3158 |
++ struct usb_device *udev; |
3159 |
+ __u8 *buf = NULL; |
3160 |
+ |
3161 |
+ /* Check arguments */ |
3162 |
+@@ -74,6 +74,8 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struct hid_device *hdev, |
3163 |
+ goto cleanup; |
3164 |
+ } |
3165 |
+ |
3166 |
++ udev = hid_to_usb_dev(hdev); |
3167 |
++ |
3168 |
+ buf = kmalloc(len, GFP_KERNEL); |
3169 |
+ if (buf == NULL) { |
3170 |
+ rc = -ENOMEM; |
3171 |
+@@ -449,7 +451,7 @@ static int uclogic_params_frame_init_v1_buttonpad( |
3172 |
+ { |
3173 |
+ int rc; |
3174 |
+ bool found = false; |
3175 |
+- struct usb_device *usb_dev = hid_to_usb_dev(hdev); |
3176 |
++ struct usb_device *usb_dev; |
3177 |
+ char *str_buf = NULL; |
3178 |
+ const size_t str_len = 16; |
3179 |
+ |
3180 |
+@@ -459,6 +461,8 @@ static int uclogic_params_frame_init_v1_buttonpad( |
3181 |
+ goto cleanup; |
3182 |
+ } |
3183 |
+ |
3184 |
++ usb_dev = hid_to_usb_dev(hdev); |
3185 |
++ |
3186 |
+ /* |
3187 |
+ * Enable generic button mode |
3188 |
+ */ |
3189 |
+@@ -705,9 +709,9 @@ static int uclogic_params_huion_init(struct uclogic_params *params, |
3190 |
+ struct hid_device *hdev) |
3191 |
+ { |
3192 |
+ int rc; |
3193 |
+- struct usb_device *udev = hid_to_usb_dev(hdev); |
3194 |
+- struct usb_interface *iface = to_usb_interface(hdev->dev.parent); |
3195 |
+- __u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; |
3196 |
++ struct usb_device *udev; |
3197 |
++ struct usb_interface *iface; |
3198 |
++ __u8 bInterfaceNumber; |
3199 |
+ bool found; |
3200 |
+ /* The resulting parameters (noop) */ |
3201 |
+ struct uclogic_params p = {0, }; |
3202 |
+@@ -721,6 +725,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params, |
3203 |
+ goto cleanup; |
3204 |
+ } |
3205 |
+ |
3206 |
++ udev = hid_to_usb_dev(hdev); |
3207 |
++ iface = to_usb_interface(hdev->dev.parent); |
3208 |
++ bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; |
3209 |
++ |
3210 |
+ /* If it's not a pen interface */ |
3211 |
+ if (bInterfaceNumber != 0) { |
3212 |
+ /* TODO: Consider marking the interface invalid */ |
3213 |
+@@ -832,10 +840,10 @@ int uclogic_params_init(struct uclogic_params *params, |
3214 |
+ struct hid_device *hdev) |
3215 |
+ { |
3216 |
+ int rc; |
3217 |
+- struct usb_device *udev = hid_to_usb_dev(hdev); |
3218 |
+- __u8 bNumInterfaces = udev->config->desc.bNumInterfaces; |
3219 |
+- struct usb_interface *iface = to_usb_interface(hdev->dev.parent); |
3220 |
+- __u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; |
3221 |
++ struct usb_device *udev; |
3222 |
++ __u8 bNumInterfaces; |
3223 |
++ struct usb_interface *iface; |
3224 |
++ __u8 bInterfaceNumber; |
3225 |
+ bool found; |
3226 |
+ /* The resulting parameters (noop) */ |
3227 |
+ struct uclogic_params p = {0, }; |
3228 |
+@@ -846,6 +854,11 @@ int uclogic_params_init(struct uclogic_params *params, |
3229 |
+ goto cleanup; |
3230 |
+ } |
3231 |
+ |
3232 |
++ udev = hid_to_usb_dev(hdev); |
3233 |
++ bNumInterfaces = udev->config->desc.bNumInterfaces; |
3234 |
++ iface = to_usb_interface(hdev->dev.parent); |
3235 |
++ bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; |
3236 |
++ |
3237 |
+ /* |
3238 |
+ * Set replacement report descriptor if the original matches the |
3239 |
+ * specified size. Otherwise keep interface unchanged. |
3240 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
3241 |
+index 8fe3efcb83271..fc06d8bb42e0f 100644 |
3242 |
+--- a/drivers/hid/uhid.c |
3243 |
++++ b/drivers/hid/uhid.c |
3244 |
+@@ -28,11 +28,22 @@ |
3245 |
+ |
3246 |
+ struct uhid_device { |
3247 |
+ struct mutex devlock; |
3248 |
++ |
3249 |
++ /* This flag tracks whether the HID device is usable for commands from |
3250 |
++ * userspace. The flag is already set before hid_add_device(), which |
3251 |
++ * runs in workqueue context, to allow hid_add_device() to communicate |
3252 |
++ * with userspace. |
3253 |
++ * However, if hid_add_device() fails, the flag is cleared without |
3254 |
++ * holding devlock. |
3255 |
++ * We guarantee that if @running changes from true to false while you're |
3256 |
++ * holding @devlock, it's still fine to access @hid. |
3257 |
++ */ |
3258 |
+ bool running; |
3259 |
+ |
3260 |
+ __u8 *rd_data; |
3261 |
+ uint rd_size; |
3262 |
+ |
3263 |
++ /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ |
3264 |
+ struct hid_device *hid; |
3265 |
+ struct uhid_event input_buf; |
3266 |
+ |
3267 |
+@@ -63,9 +74,18 @@ static void uhid_device_add_worker(struct work_struct *work) |
3268 |
+ if (ret) { |
3269 |
+ hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); |
3270 |
+ |
3271 |
+- hid_destroy_device(uhid->hid); |
3272 |
+- uhid->hid = NULL; |
3273 |
++ /* We used to call hid_destroy_device() here, but that's really |
3274 |
++ * messy to get right because we have to coordinate with |
3275 |
++ * concurrent writes from userspace that might be in the middle |
3276 |
++ * of using uhid->hid. |
3277 |
++ * Just leave uhid->hid as-is for now, and clean it up when |
3278 |
++ * userspace tries to close or reinitialize the uhid instance. |
3279 |
++ * |
3280 |
++ * However, we do have to clear the ->running flag and do a |
3281 |
++ * wakeup to make sure userspace knows that the device is gone. |
3282 |
++ */ |
3283 |
+ uhid->running = false; |
3284 |
++ wake_up_interruptible(&uhid->report_wait); |
3285 |
+ } |
3286 |
+ } |
3287 |
+ |
3288 |
+@@ -474,7 +494,7 @@ static int uhid_dev_create2(struct uhid_device *uhid, |
3289 |
+ void *rd_data; |
3290 |
+ int ret; |
3291 |
+ |
3292 |
+- if (uhid->running) |
3293 |
++ if (uhid->hid) |
3294 |
+ return -EALREADY; |
3295 |
+ |
3296 |
+ rd_size = ev->u.create2.rd_size; |
3297 |
+@@ -556,7 +576,7 @@ static int uhid_dev_create(struct uhid_device *uhid, |
3298 |
+ |
3299 |
+ static int uhid_dev_destroy(struct uhid_device *uhid) |
3300 |
+ { |
3301 |
+- if (!uhid->running) |
3302 |
++ if (!uhid->hid) |
3303 |
+ return -EINVAL; |
3304 |
+ |
3305 |
+ uhid->running = false; |
3306 |
+@@ -565,6 +585,7 @@ static int uhid_dev_destroy(struct uhid_device *uhid) |
3307 |
+ cancel_work_sync(&uhid->worker); |
3308 |
+ |
3309 |
+ hid_destroy_device(uhid->hid); |
3310 |
++ uhid->hid = NULL; |
3311 |
+ kfree(uhid->rd_data); |
3312 |
+ |
3313 |
+ return 0; |
3314 |
+diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c |
3315 |
+index e011839f19f89..de69ea5f5a4be 100644 |
3316 |
+--- a/drivers/hid/wacom_wac.c |
3317 |
++++ b/drivers/hid/wacom_wac.c |
3318 |
+@@ -2566,6 +2566,24 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, |
3319 |
+ } |
3320 |
+ } |
3321 |
+ |
3322 |
++static bool wacom_wac_slot_is_active(struct input_dev *dev, int key) |
3323 |
++{ |
3324 |
++ struct input_mt *mt = dev->mt; |
3325 |
++ struct input_mt_slot *s; |
3326 |
++ |
3327 |
++ if (!mt) |
3328 |
++ return false; |
3329 |
++ |
3330 |
++ for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { |
3331 |
++ if (s->key == key && |
3332 |
++ input_mt_get_value(s, ABS_MT_TRACKING_ID) >= 0) { |
3333 |
++ return true; |
3334 |
++ } |
3335 |
++ } |
3336 |
++ |
3337 |
++ return false; |
3338 |
++} |
3339 |
++ |
3340 |
+ static void wacom_wac_finger_event(struct hid_device *hdev, |
3341 |
+ struct hid_field *field, struct hid_usage *usage, __s32 value) |
3342 |
+ { |
3343 |
+@@ -2613,9 +2631,14 @@ static void wacom_wac_finger_event(struct hid_device *hdev, |
3344 |
+ } |
3345 |
+ |
3346 |
+ if (usage->usage_index + 1 == field->report_count) { |
3347 |
+- if (equivalent_usage == wacom_wac->hid_data.last_slot_field && |
3348 |
+- wacom_wac->hid_data.confidence) |
3349 |
+- wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
3350 |
++ if (equivalent_usage == wacom_wac->hid_data.last_slot_field) { |
3351 |
++ bool touch_removed = wacom_wac_slot_is_active(wacom_wac->touch_input, |
3352 |
++ wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; |
3353 |
++ |
3354 |
++ if (wacom_wac->hid_data.confidence || touch_removed) { |
3355 |
++ wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); |
3356 |
++ } |
3357 |
++ } |
3358 |
+ } |
3359 |
+ } |
3360 |
+ |
3361 |
+@@ -2631,6 +2654,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
3362 |
+ |
3363 |
+ hid_data->confidence = true; |
3364 |
+ |
3365 |
++ hid_data->cc_report = 0; |
3366 |
++ hid_data->cc_index = -1; |
3367 |
++ hid_data->cc_value_index = -1; |
3368 |
++ |
3369 |
+ for (i = 0; i < report->maxfield; i++) { |
3370 |
+ struct hid_field *field = report->field[i]; |
3371 |
+ int j; |
3372 |
+@@ -2664,11 +2691,14 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, |
3373 |
+ hid_data->cc_index >= 0) { |
3374 |
+ struct hid_field *field = report->field[hid_data->cc_index]; |
3375 |
+ int value = field->value[hid_data->cc_value_index]; |
3376 |
+- if (value) |
3377 |
++ if (value) { |
3378 |
+ hid_data->num_expected = value; |
3379 |
++ hid_data->num_received = 0; |
3380 |
++ } |
3381 |
+ } |
3382 |
+ else { |
3383 |
+ hid_data->num_expected = wacom_wac->features.touch_max; |
3384 |
++ hid_data->num_received = 0; |
3385 |
+ } |
3386 |
+ } |
3387 |
+ |
3388 |
+@@ -2692,6 +2722,7 @@ static void wacom_wac_finger_report(struct hid_device *hdev, |
3389 |
+ |
3390 |
+ input_sync(input); |
3391 |
+ wacom_wac->hid_data.num_received = 0; |
3392 |
++ wacom_wac->hid_data.num_expected = 0; |
3393 |
+ |
3394 |
+ /* keep touch state for pen event */ |
3395 |
+ wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); |
3396 |
+diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c |
3397 |
+index a5f92e2889cb8..a330f58d45fc6 100644 |
3398 |
+--- a/drivers/hsi/hsi_core.c |
3399 |
++++ b/drivers/hsi/hsi_core.c |
3400 |
+@@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, |
3401 |
+ if (device_register(&cl->device) < 0) { |
3402 |
+ pr_err("hsi: failed to register client: %s\n", info->name); |
3403 |
+ put_device(&cl->device); |
3404 |
++ goto err; |
3405 |
+ } |
3406 |
+ |
3407 |
+ return cl; |
3408 |
+diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c |
3409 |
+index 05b35ac33ce33..735326e5eb8cf 100644 |
3410 |
+--- a/drivers/i2c/busses/i2c-designware-pcidrv.c |
3411 |
++++ b/drivers/i2c/busses/i2c-designware-pcidrv.c |
3412 |
+@@ -37,10 +37,10 @@ enum dw_pci_ctl_id_t { |
3413 |
+ }; |
3414 |
+ |
3415 |
+ struct dw_scl_sda_cfg { |
3416 |
+- u32 ss_hcnt; |
3417 |
+- u32 fs_hcnt; |
3418 |
+- u32 ss_lcnt; |
3419 |
+- u32 fs_lcnt; |
3420 |
++ u16 ss_hcnt; |
3421 |
++ u16 fs_hcnt; |
3422 |
++ u16 ss_lcnt; |
3423 |
++ u16 fs_lcnt; |
3424 |
+ u32 sda_hold; |
3425 |
+ }; |
3426 |
+ |
3427 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
3428 |
+index a959062ded4f8..4e6d0b722ddcd 100644 |
3429 |
+--- a/drivers/i2c/busses/i2c-i801.c |
3430 |
++++ b/drivers/i2c/busses/i2c-i801.c |
3431 |
+@@ -785,6 +785,11 @@ static int i801_block_transaction(struct i801_priv *priv, |
3432 |
+ int result = 0; |
3433 |
+ unsigned char hostc; |
3434 |
+ |
3435 |
++ if (read_write == I2C_SMBUS_READ && command == I2C_SMBUS_BLOCK_DATA) |
3436 |
++ data->block[0] = I2C_SMBUS_BLOCK_MAX; |
3437 |
++ else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) |
3438 |
++ return -EPROTO; |
3439 |
++ |
3440 |
+ if (command == I2C_SMBUS_I2C_BLOCK_DATA) { |
3441 |
+ if (read_write == I2C_SMBUS_WRITE) { |
3442 |
+ /* set I2C_EN bit in configuration register */ |
3443 |
+@@ -798,16 +803,6 @@ static int i801_block_transaction(struct i801_priv *priv, |
3444 |
+ } |
3445 |
+ } |
3446 |
+ |
3447 |
+- if (read_write == I2C_SMBUS_WRITE |
3448 |
+- || command == I2C_SMBUS_I2C_BLOCK_DATA) { |
3449 |
+- if (data->block[0] < 1) |
3450 |
+- data->block[0] = 1; |
3451 |
+- if (data->block[0] > I2C_SMBUS_BLOCK_MAX) |
3452 |
+- data->block[0] = I2C_SMBUS_BLOCK_MAX; |
3453 |
+- } else { |
3454 |
+- data->block[0] = 32; /* max for SMBus block reads */ |
3455 |
+- } |
3456 |
+- |
3457 |
+ /* Experience has shown that the block buffer can only be used for |
3458 |
+ SMBus (not I2C) block transactions, even though the datasheet |
3459 |
+ doesn't mention this limitation. */ |
3460 |
+diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
3461 |
+index af349661fd769..8de8296d25831 100644 |
3462 |
+--- a/drivers/i2c/busses/i2c-mpc.c |
3463 |
++++ b/drivers/i2c/busses/i2c-mpc.c |
3464 |
+@@ -105,23 +105,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) |
3465 |
+ /* Sometimes 9th clock pulse isn't generated, and slave doesn't release |
3466 |
+ * the bus, because it wants to send ACK. |
3467 |
+ * Following sequence of enabling/disabling and sending start/stop generates |
3468 |
+- * the 9 pulses, so it's all OK. |
3469 |
++ * the 9 pulses, each with a START then ending with STOP, so it's all OK. |
3470 |
+ */ |
3471 |
+ static void mpc_i2c_fixup(struct mpc_i2c *i2c) |
3472 |
+ { |
3473 |
+ int k; |
3474 |
+- u32 delay_val = 1000000 / i2c->real_clk + 1; |
3475 |
+- |
3476 |
+- if (delay_val < 2) |
3477 |
+- delay_val = 2; |
3478 |
++ unsigned long flags; |
3479 |
+ |
3480 |
+ for (k = 9; k; k--) { |
3481 |
+ writeccr(i2c, 0); |
3482 |
+- writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); |
3483 |
++ writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ |
3484 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ |
3485 |
++ readb(i2c->base + MPC_I2C_DR); /* init xfer */ |
3486 |
++ udelay(15); /* let it hit the bus */ |
3487 |
++ local_irq_save(flags); /* should not be delayed further */ |
3488 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ |
3489 |
+ readb(i2c->base + MPC_I2C_DR); |
3490 |
+- writeccr(i2c, CCR_MEN); |
3491 |
+- udelay(delay_val << 1); |
3492 |
++ if (k != 1) |
3493 |
++ udelay(5); |
3494 |
++ local_irq_restore(flags); |
3495 |
+ } |
3496 |
++ writeccr(i2c, CCR_MEN); /* Initiate STOP */ |
3497 |
++ readb(i2c->base + MPC_I2C_DR); |
3498 |
++ udelay(15); /* Let STOP propagate */ |
3499 |
++ writeccr(i2c, 0); |
3500 |
+ } |
3501 |
+ |
3502 |
+ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
3503 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
3504 |
+index ec9e9598894f6..5e2b688e36fca 100644 |
3505 |
+--- a/drivers/infiniband/core/cma.c |
3506 |
++++ b/drivers/infiniband/core/cma.c |
3507 |
+@@ -820,6 +820,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) |
3508 |
+ u16 pkey, index; |
3509 |
+ u8 p; |
3510 |
+ enum ib_port_state port_state; |
3511 |
++ int ret; |
3512 |
+ int i; |
3513 |
+ |
3514 |
+ cma_dev = NULL; |
3515 |
+@@ -838,9 +839,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) |
3516 |
+ |
3517 |
+ if (ib_get_cached_port_state(cur_dev->device, p, &port_state)) |
3518 |
+ continue; |
3519 |
+- for (i = 0; !rdma_query_gid(cur_dev->device, |
3520 |
+- p, i, &gid); |
3521 |
+- i++) { |
3522 |
++ |
3523 |
++ for (i = 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; |
3524 |
++ ++i) { |
3525 |
++ ret = rdma_query_gid(cur_dev->device, p, i, |
3526 |
++ &gid); |
3527 |
++ if (ret) |
3528 |
++ continue; |
3529 |
++ |
3530 |
+ if (!memcmp(&gid, dgid, sizeof(gid))) { |
3531 |
+ cma_dev = cur_dev; |
3532 |
+ sgid = gid; |
3533 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
3534 |
+index 256d379bba676..de66d7da1bf6e 100644 |
3535 |
+--- a/drivers/infiniband/core/device.c |
3536 |
++++ b/drivers/infiniband/core/device.c |
3537 |
+@@ -2438,7 +2438,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, |
3538 |
+ ++i) { |
3539 |
+ ret = rdma_query_gid(device, port, i, &tmp_gid); |
3540 |
+ if (ret) |
3541 |
+- return ret; |
3542 |
++ continue; |
3543 |
++ |
3544 |
+ if (!memcmp(&tmp_gid, gid, sizeof *gid)) { |
3545 |
+ *port_num = port; |
3546 |
+ if (index) |
3547 |
+diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
3548 |
+index 3ac08f47a8ce4..b3fbafbf66555 100644 |
3549 |
+--- a/drivers/infiniband/hw/cxgb4/qp.c |
3550 |
++++ b/drivers/infiniband/hw/cxgb4/qp.c |
3551 |
+@@ -2469,6 +2469,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
3552 |
+ memset(attr, 0, sizeof(*attr)); |
3553 |
+ memset(init_attr, 0, sizeof(*init_attr)); |
3554 |
+ attr->qp_state = to_ib_qp_state(qhp->attr.state); |
3555 |
++ attr->cur_qp_state = to_ib_qp_state(qhp->attr.state); |
3556 |
+ init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; |
3557 |
+ init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; |
3558 |
+ init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; |
3559 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c |
3560 |
+index f23a341400c06..70991649dc693 100644 |
3561 |
+--- a/drivers/infiniband/hw/hns/hns_roce_main.c |
3562 |
++++ b/drivers/infiniband/hw/hns/hns_roce_main.c |
3563 |
+@@ -279,6 +279,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device, |
3564 |
+ static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index, |
3565 |
+ u16 *pkey) |
3566 |
+ { |
3567 |
++ if (index > 0) |
3568 |
++ return -EINVAL; |
3569 |
++ |
3570 |
+ *pkey = PKEY_ID; |
3571 |
+ |
3572 |
+ return 0; |
3573 |
+@@ -359,7 +362,7 @@ static int hns_roce_mmap(struct ib_ucontext *context, |
3574 |
+ return rdma_user_mmap_io(context, vma, |
3575 |
+ to_hr_ucontext(context)->uar.pfn, |
3576 |
+ PAGE_SIZE, |
3577 |
+- pgprot_noncached(vma->vm_page_prot)); |
3578 |
++ pgprot_device(vma->vm_page_prot)); |
3579 |
+ |
3580 |
+ /* vm_pgoff: 1 -- TPTR */ |
3581 |
+ case 1: |
3582 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.c b/drivers/infiniband/sw/rxe/rxe_opcode.c |
3583 |
+index 4cf11063e0b59..0f166d6d0ccb0 100644 |
3584 |
+--- a/drivers/infiniband/sw/rxe/rxe_opcode.c |
3585 |
++++ b/drivers/infiniband/sw/rxe/rxe_opcode.c |
3586 |
+@@ -137,7 +137,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = { |
3587 |
+ } |
3588 |
+ }, |
3589 |
+ [IB_OPCODE_RC_SEND_MIDDLE] = { |
3590 |
+- .name = "IB_OPCODE_RC_SEND_MIDDLE]", |
3591 |
++ .name = "IB_OPCODE_RC_SEND_MIDDLE", |
3592 |
+ .mask = RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK |
3593 |
+ | RXE_MIDDLE_MASK, |
3594 |
+ .length = RXE_BTH_BYTES, |
3595 |
+diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c |
3596 |
+index 4cb394937700c..909be90d26662 100644 |
3597 |
+--- a/drivers/iommu/io-pgtable-arm-v7s.c |
3598 |
++++ b/drivers/iommu/io-pgtable-arm-v7s.c |
3599 |
+@@ -244,13 +244,17 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, |
3600 |
+ __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); |
3601 |
+ else if (lvl == 2) |
3602 |
+ table = kmem_cache_zalloc(data->l2_tables, gfp); |
3603 |
++ |
3604 |
++ if (!table) |
3605 |
++ return NULL; |
3606 |
++ |
3607 |
+ phys = virt_to_phys(table); |
3608 |
+ if (phys != (arm_v7s_iopte)phys) { |
3609 |
+ /* Doesn't fit in PTE */ |
3610 |
+ dev_err(dev, "Page table does not fit in PTE: %pa", &phys); |
3611 |
+ goto out_free; |
3612 |
+ } |
3613 |
+- if (table && !cfg->coherent_walk) { |
3614 |
++ if (!cfg->coherent_walk) { |
3615 |
+ dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); |
3616 |
+ if (dma_mapping_error(dev, dma)) |
3617 |
+ goto out_free; |
3618 |
+diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c |
3619 |
+index ca51036aa53c7..975237ca03267 100644 |
3620 |
+--- a/drivers/iommu/io-pgtable-arm.c |
3621 |
++++ b/drivers/iommu/io-pgtable-arm.c |
3622 |
+@@ -351,11 +351,12 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data, |
3623 |
+ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, |
3624 |
+ arm_lpae_iopte *ptep, |
3625 |
+ arm_lpae_iopte curr, |
3626 |
+- struct io_pgtable_cfg *cfg) |
3627 |
++ struct arm_lpae_io_pgtable *data) |
3628 |
+ { |
3629 |
+ arm_lpae_iopte old, new; |
3630 |
++ struct io_pgtable_cfg *cfg = &data->iop.cfg; |
3631 |
+ |
3632 |
+- new = __pa(table) | ARM_LPAE_PTE_TYPE_TABLE; |
3633 |
++ new = paddr_to_iopte(__pa(table), data) | ARM_LPAE_PTE_TYPE_TABLE; |
3634 |
+ if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) |
3635 |
+ new |= ARM_LPAE_PTE_NSTABLE; |
3636 |
+ |
3637 |
+@@ -406,7 +407,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova, |
3638 |
+ if (!cptep) |
3639 |
+ return -ENOMEM; |
3640 |
+ |
3641 |
+- pte = arm_lpae_install_table(cptep, ptep, 0, cfg); |
3642 |
++ pte = arm_lpae_install_table(cptep, ptep, 0, data); |
3643 |
+ if (pte) |
3644 |
+ __arm_lpae_free_pages(cptep, tblsz, cfg); |
3645 |
+ } else if (!cfg->coherent_walk && !(pte & ARM_LPAE_PTE_SW_SYNC)) { |
3646 |
+@@ -575,7 +576,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data, |
3647 |
+ __arm_lpae_init_pte(data, blk_paddr, pte, lvl, &tablep[i]); |
3648 |
+ } |
3649 |
+ |
3650 |
+- pte = arm_lpae_install_table(tablep, ptep, blk_pte, cfg); |
3651 |
++ pte = arm_lpae_install_table(tablep, ptep, blk_pte, data); |
3652 |
+ if (pte != blk_pte) { |
3653 |
+ __arm_lpae_free_pages(tablep, tablesz, cfg); |
3654 |
+ /* |
3655 |
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
3656 |
+index 612cbf668adf8..906582a21124d 100644 |
3657 |
+--- a/drivers/iommu/iova.c |
3658 |
++++ b/drivers/iommu/iova.c |
3659 |
+@@ -64,8 +64,7 @@ static void free_iova_flush_queue(struct iova_domain *iovad) |
3660 |
+ if (!has_iova_flush_queue(iovad)) |
3661 |
+ return; |
3662 |
+ |
3663 |
+- if (timer_pending(&iovad->fq_timer)) |
3664 |
+- del_timer(&iovad->fq_timer); |
3665 |
++ del_timer_sync(&iovad->fq_timer); |
3666 |
+ |
3667 |
+ fq_destroy_all_entries(iovad); |
3668 |
+ |
3669 |
+diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
3670 |
+index 8aae0624a2971..6383afb88f319 100644 |
3671 |
+--- a/drivers/md/persistent-data/dm-btree.c |
3672 |
++++ b/drivers/md/persistent-data/dm-btree.c |
3673 |
+@@ -83,14 +83,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
3674 |
+ } |
3675 |
+ |
3676 |
+ static int insert_at(size_t value_size, struct btree_node *node, unsigned index, |
3677 |
+- uint64_t key, void *value) |
3678 |
+- __dm_written_to_disk(value) |
3679 |
++ uint64_t key, void *value) |
3680 |
++ __dm_written_to_disk(value) |
3681 |
+ { |
3682 |
+ uint32_t nr_entries = le32_to_cpu(node->header.nr_entries); |
3683 |
++ uint32_t max_entries = le32_to_cpu(node->header.max_entries); |
3684 |
+ __le64 key_le = cpu_to_le64(key); |
3685 |
+ |
3686 |
+ if (index > nr_entries || |
3687 |
+- index >= le32_to_cpu(node->header.max_entries)) { |
3688 |
++ index >= max_entries || |
3689 |
++ nr_entries >= max_entries) { |
3690 |
+ DMERR("too many entries in btree node for insert"); |
3691 |
+ __dm_unbless_for_disk(value); |
3692 |
+ return -ENOMEM; |
3693 |
+diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c |
3694 |
+index a213bf11738fb..85853ab629717 100644 |
3695 |
+--- a/drivers/md/persistent-data/dm-space-map-common.c |
3696 |
++++ b/drivers/md/persistent-data/dm-space-map-common.c |
3697 |
+@@ -281,6 +281,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result) |
3698 |
+ struct disk_index_entry ie_disk; |
3699 |
+ struct dm_block *blk; |
3700 |
+ |
3701 |
++ if (b >= ll->nr_blocks) { |
3702 |
++ DMERR_LIMIT("metadata block out of bounds"); |
3703 |
++ return -EINVAL; |
3704 |
++ } |
3705 |
++ |
3706 |
+ b = do_div(index, ll->entries_per_block); |
3707 |
+ r = ll->load_ie(ll, index, &ie_disk); |
3708 |
+ if (r < 0) |
3709 |
+diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c |
3710 |
+index aabb830e74689..4b332ea986168 100644 |
3711 |
+--- a/drivers/media/common/saa7146/saa7146_fops.c |
3712 |
++++ b/drivers/media/common/saa7146/saa7146_fops.c |
3713 |
+@@ -525,7 +525,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) |
3714 |
+ ERR("out of memory. aborting.\n"); |
3715 |
+ kfree(vv); |
3716 |
+ v4l2_ctrl_handler_free(hdl); |
3717 |
+- return -1; |
3718 |
++ return -ENOMEM; |
3719 |
+ } |
3720 |
+ |
3721 |
+ saa7146_video_uops.init(dev,vv); |
3722 |
+diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c |
3723 |
+index 44cd0e530bbd3..093ebe6f279f7 100644 |
3724 |
+--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c |
3725 |
++++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c |
3726 |
+@@ -154,7 +154,7 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs, |
3727 |
+ buf->cookie = dma_alloc_attrs(dev, size, &buf->dma_addr, |
3728 |
+ GFP_KERNEL | gfp_flags, buf->attrs); |
3729 |
+ if (!buf->cookie) { |
3730 |
+- dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); |
3731 |
++ dev_err(dev, "dma_alloc_coherent of size %lu failed\n", size); |
3732 |
+ kfree(buf); |
3733 |
+ return ERR_PTR(-ENOMEM); |
3734 |
+ } |
3735 |
+@@ -200,9 +200,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) |
3736 |
+ |
3737 |
+ vma->vm_ops->open(vma); |
3738 |
+ |
3739 |
+- pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", |
3740 |
+- __func__, (unsigned long)buf->dma_addr, vma->vm_start, |
3741 |
+- buf->size); |
3742 |
++ pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", |
3743 |
++ __func__, (unsigned long)buf->dma_addr, vma->vm_start, |
3744 |
++ buf->size); |
3745 |
+ |
3746 |
+ return 0; |
3747 |
+ } |
3748 |
+diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c |
3749 |
+index f14a872d12687..e58cb8434dafe 100644 |
3750 |
+--- a/drivers/media/dvb-core/dmxdev.c |
3751 |
++++ b/drivers/media/dvb-core/dmxdev.c |
3752 |
+@@ -1413,7 +1413,7 @@ static const struct dvb_device dvbdev_dvr = { |
3753 |
+ }; |
3754 |
+ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) |
3755 |
+ { |
3756 |
+- int i; |
3757 |
++ int i, ret; |
3758 |
+ |
3759 |
+ if (dmxdev->demux->open(dmxdev->demux) < 0) |
3760 |
+ return -EUSERS; |
3761 |
+@@ -1432,14 +1432,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) |
3762 |
+ DMXDEV_STATE_FREE); |
3763 |
+ } |
3764 |
+ |
3765 |
+- dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, |
3766 |
++ ret = dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, |
3767 |
+ DVB_DEVICE_DEMUX, dmxdev->filternum); |
3768 |
+- dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, |
3769 |
++ if (ret < 0) |
3770 |
++ goto err_register_dvbdev; |
3771 |
++ |
3772 |
++ ret = dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, |
3773 |
+ dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); |
3774 |
++ if (ret < 0) |
3775 |
++ goto err_register_dvr_dvbdev; |
3776 |
+ |
3777 |
+ dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); |
3778 |
+ |
3779 |
+ return 0; |
3780 |
++ |
3781 |
++err_register_dvr_dvbdev: |
3782 |
++ dvb_unregister_device(dmxdev->dvbdev); |
3783 |
++err_register_dvbdev: |
3784 |
++ vfree(dmxdev->filter); |
3785 |
++ dmxdev->filter = NULL; |
3786 |
++ return ret; |
3787 |
+ } |
3788 |
+ |
3789 |
+ EXPORT_SYMBOL(dvb_dmxdev_init); |
3790 |
+diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c |
3791 |
+index bb02354a48b81..d67f2dd997d06 100644 |
3792 |
+--- a/drivers/media/dvb-frontends/dib8000.c |
3793 |
++++ b/drivers/media/dvb-frontends/dib8000.c |
3794 |
+@@ -4473,8 +4473,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad |
3795 |
+ |
3796 |
+ state->timf_default = cfg->pll->timf; |
3797 |
+ |
3798 |
+- if (dib8000_identify(&state->i2c) == 0) |
3799 |
++ if (dib8000_identify(&state->i2c) == 0) { |
3800 |
++ kfree(fe); |
3801 |
+ goto error; |
3802 |
++ } |
3803 |
+ |
3804 |
+ dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr); |
3805 |
+ |
3806 |
+diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/flexcop-pci.c |
3807 |
+index a9d9520a94c6d..c9e6c7d663768 100644 |
3808 |
+--- a/drivers/media/pci/b2c2/flexcop-pci.c |
3809 |
++++ b/drivers/media/pci/b2c2/flexcop-pci.c |
3810 |
+@@ -185,6 +185,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
3811 |
+ dma_addr_t cur_addr = |
3812 |
+ fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; |
3813 |
+ u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; |
3814 |
++ if (cur_pos > fc_pci->dma[0].size * 2) |
3815 |
++ goto error; |
3816 |
+ |
3817 |
+ deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", |
3818 |
+ jiffies_to_usecs(jiffies - fc_pci->last_irq), |
3819 |
+@@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
3820 |
+ ret = IRQ_NONE; |
3821 |
+ } |
3822 |
+ |
3823 |
++error: |
3824 |
+ spin_unlock_irqrestore(&fc_pci->irq_lock, flags); |
3825 |
+ return ret; |
3826 |
+ } |
3827 |
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
3828 |
+index f962269306707..86d4e2abed82a 100644 |
3829 |
+--- a/drivers/media/pci/saa7146/hexium_gemini.c |
3830 |
++++ b/drivers/media/pci/saa7146/hexium_gemini.c |
3831 |
+@@ -284,7 +284,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
3832 |
+ hexium_set_input(hexium, 0); |
3833 |
+ hexium->cur_input = 0; |
3834 |
+ |
3835 |
+- saa7146_vv_init(dev, &vv_data); |
3836 |
++ ret = saa7146_vv_init(dev, &vv_data); |
3837 |
++ if (ret) { |
3838 |
++ i2c_del_adapter(&hexium->i2c_adapter); |
3839 |
++ kfree(hexium); |
3840 |
++ return ret; |
3841 |
++ } |
3842 |
+ |
3843 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
3844 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
3845 |
+diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
3846 |
+index bf5e55348f159..31388597386aa 100644 |
3847 |
+--- a/drivers/media/pci/saa7146/hexium_orion.c |
3848 |
++++ b/drivers/media/pci/saa7146/hexium_orion.c |
3849 |
+@@ -355,10 +355,16 @@ static struct saa7146_ext_vv vv_data; |
3850 |
+ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
3851 |
+ { |
3852 |
+ struct hexium *hexium = (struct hexium *) dev->ext_priv; |
3853 |
++ int ret; |
3854 |
+ |
3855 |
+ DEB_EE("\n"); |
3856 |
+ |
3857 |
+- saa7146_vv_init(dev, &vv_data); |
3858 |
++ ret = saa7146_vv_init(dev, &vv_data); |
3859 |
++ if (ret) { |
3860 |
++ pr_err("Error in saa7146_vv_init()\n"); |
3861 |
++ return ret; |
3862 |
++ } |
3863 |
++ |
3864 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
3865 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
3866 |
+ vv_data.vid_ops.vidioc_s_input = vidioc_s_input; |
3867 |
+diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c |
3868 |
+index 952ea250feda0..58fe4c1619eeb 100644 |
3869 |
+--- a/drivers/media/pci/saa7146/mxb.c |
3870 |
++++ b/drivers/media/pci/saa7146/mxb.c |
3871 |
+@@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data; |
3872 |
+ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
3873 |
+ { |
3874 |
+ struct mxb *mxb; |
3875 |
++ int ret; |
3876 |
+ |
3877 |
+ DEB_EE("dev:%p\n", dev); |
3878 |
+ |
3879 |
+- saa7146_vv_init(dev, &vv_data); |
3880 |
++ ret = saa7146_vv_init(dev, &vv_data); |
3881 |
++ if (ret) { |
3882 |
++ ERR("Error in saa7146_vv_init()"); |
3883 |
++ return ret; |
3884 |
++ } |
3885 |
++ |
3886 |
+ if (mxb_probe(dev)) { |
3887 |
+ saa7146_vv_release(dev); |
3888 |
+ return -1; |
3889 |
+diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c |
3890 |
+index 6dde49d9aa4c2..1e0867016bf37 100644 |
3891 |
+--- a/drivers/media/platform/aspeed-video.c |
3892 |
++++ b/drivers/media/platform/aspeed-video.c |
3893 |
+@@ -477,6 +477,10 @@ static void aspeed_video_enable_mode_detect(struct aspeed_video *video) |
3894 |
+ aspeed_video_update(video, VE_INTERRUPT_CTRL, 0, |
3895 |
+ VE_INTERRUPT_MODE_DETECT); |
3896 |
+ |
3897 |
++ /* Disable mode detect in order to re-trigger */ |
3898 |
++ aspeed_video_update(video, VE_SEQ_CTRL, |
3899 |
++ VE_SEQ_CTRL_TRIG_MODE_DET, 0); |
3900 |
++ |
3901 |
+ /* Trigger mode detect */ |
3902 |
+ aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET); |
3903 |
+ } |
3904 |
+@@ -529,6 +533,8 @@ static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay) |
3905 |
+ set_bit(VIDEO_RES_CHANGE, &video->flags); |
3906 |
+ clear_bit(VIDEO_FRAME_INPRG, &video->flags); |
3907 |
+ |
3908 |
++ video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL; |
3909 |
++ |
3910 |
+ aspeed_video_off(video); |
3911 |
+ aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR); |
3912 |
+ |
3913 |
+@@ -764,10 +770,6 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
3914 |
+ return; |
3915 |
+ } |
3916 |
+ |
3917 |
+- /* Disable mode detect in order to re-trigger */ |
3918 |
+- aspeed_video_update(video, VE_SEQ_CTRL, |
3919 |
+- VE_SEQ_CTRL_TRIG_MODE_DET, 0); |
3920 |
+- |
3921 |
+ aspeed_video_check_and_set_polarity(video); |
3922 |
+ |
3923 |
+ aspeed_video_enable_mode_detect(video); |
3924 |
+@@ -1315,7 +1317,6 @@ static void aspeed_video_resolution_work(struct work_struct *work) |
3925 |
+ struct delayed_work *dwork = to_delayed_work(work); |
3926 |
+ struct aspeed_video *video = container_of(dwork, struct aspeed_video, |
3927 |
+ res_work); |
3928 |
+- u32 input_status = video->v4l2_input_status; |
3929 |
+ |
3930 |
+ aspeed_video_on(video); |
3931 |
+ |
3932 |
+@@ -1328,8 +1329,7 @@ static void aspeed_video_resolution_work(struct work_struct *work) |
3933 |
+ aspeed_video_get_resolution(video); |
3934 |
+ |
3935 |
+ if (video->detected_timings.width != video->active_timings.width || |
3936 |
+- video->detected_timings.height != video->active_timings.height || |
3937 |
+- input_status != video->v4l2_input_status) { |
3938 |
++ video->detected_timings.height != video->active_timings.height) { |
3939 |
+ static const struct v4l2_event ev = { |
3940 |
+ .type = V4L2_EVENT_SOURCE_CHANGE, |
3941 |
+ .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, |
3942 |
+diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platform/coda/imx-vdoa.c |
3943 |
+index 8bc0d83718193..dd6e2e320264e 100644 |
3944 |
+--- a/drivers/media/platform/coda/imx-vdoa.c |
3945 |
++++ b/drivers/media/platform/coda/imx-vdoa.c |
3946 |
+@@ -287,7 +287,11 @@ static int vdoa_probe(struct platform_device *pdev) |
3947 |
+ struct resource *res; |
3948 |
+ int ret; |
3949 |
+ |
3950 |
+- dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
3951 |
++ ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
3952 |
++ if (ret) { |
3953 |
++ dev_err(&pdev->dev, "DMA enable failed\n"); |
3954 |
++ return ret; |
3955 |
++ } |
3956 |
+ |
3957 |
+ vdoa = devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); |
3958 |
+ if (!vdoa) |
3959 |
+diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c |
3960 |
+index 38d9423223025..3c36cefddec7c 100644 |
3961 |
+--- a/drivers/media/platform/imx-pxp.c |
3962 |
++++ b/drivers/media/platform/imx-pxp.c |
3963 |
+@@ -1664,6 +1664,8 @@ static int pxp_probe(struct platform_device *pdev) |
3964 |
+ if (irq < 0) |
3965 |
+ return irq; |
3966 |
+ |
3967 |
++ spin_lock_init(&dev->irqlock); |
3968 |
++ |
3969 |
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler, |
3970 |
+ IRQF_ONESHOT, dev_name(&pdev->dev), dev); |
3971 |
+ if (ret < 0) { |
3972 |
+@@ -1681,8 +1683,6 @@ static int pxp_probe(struct platform_device *pdev) |
3973 |
+ goto err_clk; |
3974 |
+ } |
3975 |
+ |
3976 |
+- spin_lock_init(&dev->irqlock); |
3977 |
+- |
3978 |
+ ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); |
3979 |
+ if (ret) |
3980 |
+ goto err_clk; |
3981 |
+diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
3982 |
+index 1d82aa2b6017c..dea0ee2cb7245 100644 |
3983 |
+--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
3984 |
++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |
3985 |
+@@ -209,11 +209,11 @@ static int fops_vcodec_release(struct file *file) |
3986 |
+ mtk_v4l2_debug(1, "[%d] encoder", ctx->id); |
3987 |
+ mutex_lock(&dev->dev_mutex); |
3988 |
+ |
3989 |
++ v4l2_m2m_ctx_release(ctx->m2m_ctx); |
3990 |
+ mtk_vcodec_enc_release(ctx); |
3991 |
+ v4l2_fh_del(&ctx->fh); |
3992 |
+ v4l2_fh_exit(&ctx->fh); |
3993 |
+ v4l2_ctrl_handler_free(&ctx->ctrl_hdl); |
3994 |
+- v4l2_m2m_ctx_release(ctx->m2m_ctx); |
3995 |
+ |
3996 |
+ list_del_init(&ctx->list); |
3997 |
+ kfree(ctx); |
3998 |
+diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c |
3999 |
+index bbc430a003443..7b52d3e5d3f89 100644 |
4000 |
+--- a/drivers/media/platform/qcom/venus/core.c |
4001 |
++++ b/drivers/media/platform/qcom/venus/core.c |
4002 |
+@@ -289,11 +289,11 @@ static int venus_probe(struct platform_device *pdev) |
4003 |
+ |
4004 |
+ ret = venus_firmware_init(core); |
4005 |
+ if (ret) |
4006 |
+- goto err_runtime_disable; |
4007 |
++ goto err_of_depopulate; |
4008 |
+ |
4009 |
+ ret = venus_boot(core); |
4010 |
+ if (ret) |
4011 |
+- goto err_runtime_disable; |
4012 |
++ goto err_firmware_deinit; |
4013 |
+ |
4014 |
+ ret = hfi_core_resume(core, true); |
4015 |
+ if (ret) |
4016 |
+@@ -329,6 +329,10 @@ err_core_deinit: |
4017 |
+ hfi_core_deinit(core, false); |
4018 |
+ err_venus_shutdown: |
4019 |
+ venus_shutdown(core); |
4020 |
++err_firmware_deinit: |
4021 |
++ venus_firmware_deinit(core); |
4022 |
++err_of_depopulate: |
4023 |
++ of_platform_depopulate(dev); |
4024 |
+ err_runtime_disable: |
4025 |
+ pm_runtime_put_noidle(dev); |
4026 |
+ pm_runtime_set_suspended(dev); |
4027 |
+diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c |
4028 |
+index e01f22bf826d4..db3d5d463f53e 100644 |
4029 |
+--- a/drivers/media/platform/rcar-vin/rcar-csi2.c |
4030 |
++++ b/drivers/media/platform/rcar-vin/rcar-csi2.c |
4031 |
+@@ -430,16 +430,23 @@ static int rcsi2_wait_phy_start(struct rcar_csi2 *priv) |
4032 |
+ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps) |
4033 |
+ { |
4034 |
+ const struct rcsi2_mbps_reg *hsfreq; |
4035 |
++ const struct rcsi2_mbps_reg *hsfreq_prev = NULL; |
4036 |
+ |
4037 |
+- for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) |
4038 |
++ for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) { |
4039 |
+ if (hsfreq->mbps >= mbps) |
4040 |
+ break; |
4041 |
++ hsfreq_prev = hsfreq; |
4042 |
++ } |
4043 |
+ |
4044 |
+ if (!hsfreq->mbps) { |
4045 |
+ dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); |
4046 |
+ return -ERANGE; |
4047 |
+ } |
4048 |
+ |
4049 |
++ if (hsfreq_prev && |
4050 |
++ ((mbps - hsfreq_prev->mbps) <= (hsfreq->mbps - mbps))) |
4051 |
++ hsfreq = hsfreq_prev; |
4052 |
++ |
4053 |
+ rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg)); |
4054 |
+ |
4055 |
+ return 0; |
4056 |
+@@ -904,10 +911,17 @@ static int rcsi2_phtw_write_mbps(struct rcar_csi2 *priv, unsigned int mbps, |
4057 |
+ const struct rcsi2_mbps_reg *values, u16 code) |
4058 |
+ { |
4059 |
+ const struct rcsi2_mbps_reg *value; |
4060 |
++ const struct rcsi2_mbps_reg *prev_value = NULL; |
4061 |
+ |
4062 |
+- for (value = values; value->mbps; value++) |
4063 |
++ for (value = values; value->mbps; value++) { |
4064 |
+ if (value->mbps >= mbps) |
4065 |
+ break; |
4066 |
++ prev_value = value; |
4067 |
++ } |
4068 |
++ |
4069 |
++ if (prev_value && |
4070 |
++ ((mbps - prev_value->mbps) <= (value->mbps - mbps))) |
4071 |
++ value = prev_value; |
4072 |
+ |
4073 |
+ if (!value->mbps) { |
4074 |
+ dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); |
4075 |
+diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c |
4076 |
+index a972c0705ac79..76d39e2e87706 100644 |
4077 |
+--- a/drivers/media/radio/si470x/radio-si470x-i2c.c |
4078 |
++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c |
4079 |
+@@ -368,7 +368,7 @@ static int si470x_i2c_probe(struct i2c_client *client) |
4080 |
+ if (radio->hdl.error) { |
4081 |
+ retval = radio->hdl.error; |
4082 |
+ dev_err(&client->dev, "couldn't register control\n"); |
4083 |
+- goto err_dev; |
4084 |
++ goto err_all; |
4085 |
+ } |
4086 |
+ |
4087 |
+ /* video device initialization */ |
4088 |
+@@ -463,7 +463,6 @@ static int si470x_i2c_probe(struct i2c_client *client) |
4089 |
+ return 0; |
4090 |
+ err_all: |
4091 |
+ v4l2_ctrl_handler_free(&radio->hdl); |
4092 |
+-err_dev: |
4093 |
+ v4l2_device_unregister(&radio->v4l2_dev); |
4094 |
+ err_initial: |
4095 |
+ return retval; |
4096 |
+diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c |
4097 |
+index b981f7290c1b2..1e8276040ea5b 100644 |
4098 |
+--- a/drivers/media/rc/igorplugusb.c |
4099 |
++++ b/drivers/media/rc/igorplugusb.c |
4100 |
+@@ -64,9 +64,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) |
4101 |
+ if (start >= len) { |
4102 |
+ dev_err(ir->dev, "receive overflow invalid: %u", overflow); |
4103 |
+ } else { |
4104 |
+- if (overflow > 0) |
4105 |
++ if (overflow > 0) { |
4106 |
+ dev_warn(ir->dev, "receive overflow, at least %u lost", |
4107 |
+ overflow); |
4108 |
++ ir_raw_event_reset(ir->rc); |
4109 |
++ } |
4110 |
+ |
4111 |
+ do { |
4112 |
+ rawir.duration = ir->buf_in[i] * 85333; |
4113 |
+diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c |
4114 |
+index 31e56f4f34791..cfdd712e2adc3 100644 |
4115 |
+--- a/drivers/media/rc/mceusb.c |
4116 |
++++ b/drivers/media/rc/mceusb.c |
4117 |
+@@ -1430,7 +1430,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
4118 |
+ */ |
4119 |
+ ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), |
4120 |
+ USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, |
4121 |
+- data, USB_CTRL_MSG_SZ, HZ * 3); |
4122 |
++ data, USB_CTRL_MSG_SZ, 3000); |
4123 |
+ dev_dbg(dev, "set address - ret = %d", ret); |
4124 |
+ dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", |
4125 |
+ data[0], data[1]); |
4126 |
+@@ -1438,20 +1438,20 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
4127 |
+ /* set feature: bit rate 38400 bps */ |
4128 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
4129 |
+ USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, |
4130 |
+- 0xc04e, 0x0000, NULL, 0, HZ * 3); |
4131 |
++ 0xc04e, 0x0000, NULL, 0, 3000); |
4132 |
+ |
4133 |
+ dev_dbg(dev, "set feature - ret = %d", ret); |
4134 |
+ |
4135 |
+ /* bRequest 4: set char length to 8 bits */ |
4136 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
4137 |
+ 4, USB_TYPE_VENDOR, |
4138 |
+- 0x0808, 0x0000, NULL, 0, HZ * 3); |
4139 |
++ 0x0808, 0x0000, NULL, 0, 3000); |
4140 |
+ dev_dbg(dev, "set char length - retB = %d", ret); |
4141 |
+ |
4142 |
+ /* bRequest 2: set handshaking to use DTR/DSR */ |
4143 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
4144 |
+ 2, USB_TYPE_VENDOR, |
4145 |
+- 0x0000, 0x0100, NULL, 0, HZ * 3); |
4146 |
++ 0x0000, 0x0100, NULL, 0, 3000); |
4147 |
+ dev_dbg(dev, "set handshake - retC = %d", ret); |
4148 |
+ |
4149 |
+ /* device resume */ |
4150 |
+diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c |
4151 |
+index aad9526f3754d..c392276610478 100644 |
4152 |
+--- a/drivers/media/rc/redrat3.c |
4153 |
++++ b/drivers/media/rc/redrat3.c |
4154 |
+@@ -405,7 +405,7 @@ static int redrat3_send_cmd(int cmd, struct redrat3_dev *rr3) |
4155 |
+ udev = rr3->udev; |
4156 |
+ res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, |
4157 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
4158 |
+- 0x0000, 0x0000, data, sizeof(u8), HZ * 10); |
4159 |
++ 0x0000, 0x0000, data, sizeof(u8), 10000); |
4160 |
+ |
4161 |
+ if (res < 0) { |
4162 |
+ dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", |
4163 |
+@@ -481,7 +481,7 @@ static u32 redrat3_get_timeout(struct redrat3_dev *rr3) |
4164 |
+ pipe = usb_rcvctrlpipe(rr3->udev, 0); |
4165 |
+ ret = usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, |
4166 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
4167 |
+- RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); |
4168 |
++ RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); |
4169 |
+ if (ret != len) |
4170 |
+ dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); |
4171 |
+ else { |
4172 |
+@@ -511,7 +511,7 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutns) |
4173 |
+ ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, |
4174 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
4175 |
+ RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), |
4176 |
+- HZ * 25); |
4177 |
++ 25000); |
4178 |
+ dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", |
4179 |
+ be32_to_cpu(*timeout), ret); |
4180 |
+ |
4181 |
+@@ -543,32 +543,32 @@ static void redrat3_reset(struct redrat3_dev *rr3) |
4182 |
+ *val = 0x01; |
4183 |
+ rc = usb_control_msg(udev, rxpipe, RR3_RESET, |
4184 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
4185 |
+- RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); |
4186 |
++ RR3_CPUCS_REG_ADDR, 0, val, len, 25000); |
4187 |
+ dev_dbg(dev, "reset returned 0x%02x\n", rc); |
4188 |
+ |
4189 |
+ *val = length_fuzz; |
4190 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
4191 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
4192 |
+- RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); |
4193 |
++ RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); |
4194 |
+ dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); |
4195 |
+ |
4196 |
+ *val = (65536 - (minimum_pause * 2000)) / 256; |
4197 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
4198 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
4199 |
+- RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); |
4200 |
++ RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); |
4201 |
+ dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); |
4202 |
+ |
4203 |
+ *val = periods_measure_carrier; |
4204 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
4205 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
4206 |
+- RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); |
4207 |
++ RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); |
4208 |
+ dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, |
4209 |
+ rc); |
4210 |
+ |
4211 |
+ *val = RR3_DRIVER_MAXLENS; |
4212 |
+ rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, |
4213 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
4214 |
+- RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); |
4215 |
++ RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); |
4216 |
+ dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); |
4217 |
+ |
4218 |
+ kfree(val); |
4219 |
+@@ -586,7 +586,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) |
4220 |
+ rc = usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), |
4221 |
+ RR3_FW_VERSION, |
4222 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
4223 |
+- 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); |
4224 |
++ 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); |
4225 |
+ |
4226 |
+ if (rc >= 0) |
4227 |
+ dev_info(rr3->dev, "Firmware rev: %s", buffer); |
4228 |
+@@ -826,14 +826,14 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, |
4229 |
+ |
4230 |
+ pipe = usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); |
4231 |
+ ret = usb_bulk_msg(rr3->udev, pipe, irdata, |
4232 |
+- sendbuf_len, &ret_len, 10 * HZ); |
4233 |
++ sendbuf_len, &ret_len, 10000); |
4234 |
+ dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); |
4235 |
+ |
4236 |
+ /* now tell the hardware to transmit what we sent it */ |
4237 |
+ pipe = usb_rcvctrlpipe(rr3->udev, 0); |
4238 |
+ ret = usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, |
4239 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
4240 |
+- 0, 0, irdata, 2, HZ * 10); |
4241 |
++ 0, 0, irdata, 2, 10000); |
4242 |
+ |
4243 |
+ if (ret < 0) |
4244 |
+ dev_err(dev, "Error: control msg send failed, rc %d\n", ret); |
4245 |
+diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c |
4246 |
+index 78e6fd600d8ef..44247049a3190 100644 |
4247 |
+--- a/drivers/media/tuners/msi001.c |
4248 |
++++ b/drivers/media/tuners/msi001.c |
4249 |
+@@ -442,6 +442,13 @@ static int msi001_probe(struct spi_device *spi) |
4250 |
+ V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); |
4251 |
+ dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
4252 |
+ V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); |
4253 |
++ if (dev->hdl.error) { |
4254 |
++ ret = dev->hdl.error; |
4255 |
++ dev_err(&spi->dev, "Could not initialize controls\n"); |
4256 |
++ /* control init failed, free handler */ |
4257 |
++ goto err_ctrl_handler_free; |
4258 |
++ } |
4259 |
++ |
4260 |
+ v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); |
4261 |
+ dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
4262 |
+ V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); |
4263 |
+diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c |
4264 |
+index a39e1966816bf..8db9f0eb98b52 100644 |
4265 |
+--- a/drivers/media/tuners/si2157.c |
4266 |
++++ b/drivers/media/tuners/si2157.c |
4267 |
+@@ -80,7 +80,7 @@ static int si2157_init(struct dvb_frontend *fe) |
4268 |
+ dev_dbg(&client->dev, "\n"); |
4269 |
+ |
4270 |
+ /* Try to get Xtal trim property, to verify tuner still running */ |
4271 |
+- memcpy(cmd.args, "\x15\x00\x04\x02", 4); |
4272 |
++ memcpy(cmd.args, "\x15\x00\x02\x04", 4); |
4273 |
+ cmd.wlen = 4; |
4274 |
+ cmd.rlen = 4; |
4275 |
+ ret = si2157_cmd_execute(client, &cmd); |
4276 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
4277 |
+index 198ddfb8d2b18..e51338d5eac0c 100644 |
4278 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
4279 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
4280 |
+@@ -87,7 +87,7 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI, |
4281 |
+ 0, |
4282 |
+ fc_usb->data, |
4283 |
+ sizeof(u32), |
4284 |
+- B2C2_WAIT_FOR_OPERATION_RDW * HZ); |
4285 |
++ B2C2_WAIT_FOR_OPERATION_RDW); |
4286 |
+ |
4287 |
+ if (ret != sizeof(u32)) { |
4288 |
+ err("error while %s dword from %d (%d).", read ? "reading" : |
4289 |
+@@ -155,7 +155,7 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, |
4290 |
+ wIndex, |
4291 |
+ fc_usb->data, |
4292 |
+ buflen, |
4293 |
+- nWaitTime * HZ); |
4294 |
++ nWaitTime); |
4295 |
+ if (ret != buflen) |
4296 |
+ ret = -EIO; |
4297 |
+ |
4298 |
+@@ -249,13 +249,13 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
4299 |
+ /* DKT 020208 - add this to support special case of DiSEqC */ |
4300 |
+ case USB_FUNC_I2C_CHECKWRITE: |
4301 |
+ pipe = B2C2_USB_CTRL_PIPE_OUT; |
4302 |
+- nWaitTime = 2; |
4303 |
++ nWaitTime = 2000; |
4304 |
+ request_type |= USB_DIR_OUT; |
4305 |
+ break; |
4306 |
+ case USB_FUNC_I2C_READ: |
4307 |
+ case USB_FUNC_I2C_REPEATREAD: |
4308 |
+ pipe = B2C2_USB_CTRL_PIPE_IN; |
4309 |
+- nWaitTime = 2; |
4310 |
++ nWaitTime = 2000; |
4311 |
+ request_type |= USB_DIR_IN; |
4312 |
+ break; |
4313 |
+ default: |
4314 |
+@@ -282,7 +282,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
4315 |
+ wIndex, |
4316 |
+ fc_usb->data, |
4317 |
+ buflen, |
4318 |
+- nWaitTime * HZ); |
4319 |
++ nWaitTime); |
4320 |
+ |
4321 |
+ if (ret != buflen) |
4322 |
+ ret = -EIO; |
4323 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.h b/drivers/media/usb/b2c2/flexcop-usb.h |
4324 |
+index e86faa0e06ca6..3dfd25fa4750f 100644 |
4325 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.h |
4326 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.h |
4327 |
+@@ -91,13 +91,13 @@ typedef enum { |
4328 |
+ UTILITY_SRAM_TESTVERIFY = 0x16, |
4329 |
+ } flexcop_usb_utility_function_t; |
4330 |
+ |
4331 |
+-#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) |
4332 |
+-#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) |
4333 |
+-#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) |
4334 |
++#define B2C2_WAIT_FOR_OPERATION_RW 1000 |
4335 |
++#define B2C2_WAIT_FOR_OPERATION_RDW 3000 |
4336 |
++#define B2C2_WAIT_FOR_OPERATION_WDW 1000 |
4337 |
+ |
4338 |
+-#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) |
4339 |
+-#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) |
4340 |
+-#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) |
4341 |
++#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 |
4342 |
++#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 |
4343 |
++#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 |
4344 |
+ |
4345 |
+ typedef enum { |
4346 |
+ V8_MEMORY_PAGE_DVB_CI = 0x20, |
4347 |
+diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c |
4348 |
+index 76aac06f9fb8e..cba03b2864738 100644 |
4349 |
+--- a/drivers/media/usb/cpia2/cpia2_usb.c |
4350 |
++++ b/drivers/media/usb/cpia2/cpia2_usb.c |
4351 |
+@@ -550,7 +550,7 @@ static int write_packet(struct usb_device *udev, |
4352 |
+ 0, /* index */ |
4353 |
+ buf, /* buffer */ |
4354 |
+ size, |
4355 |
+- HZ); |
4356 |
++ 1000); |
4357 |
+ |
4358 |
+ kfree(buf); |
4359 |
+ return ret; |
4360 |
+@@ -582,7 +582,7 @@ static int read_packet(struct usb_device *udev, |
4361 |
+ 0, /* index */ |
4362 |
+ buf, /* buffer */ |
4363 |
+ size, |
4364 |
+- HZ); |
4365 |
++ 1000); |
4366 |
+ |
4367 |
+ if (ret >= 0) |
4368 |
+ memcpy(registers, buf, size); |
4369 |
+diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c |
4370 |
+index ef62dd6c5ae44..07d5e94578775 100644 |
4371 |
+--- a/drivers/media/usb/dvb-usb/dib0700_core.c |
4372 |
++++ b/drivers/media/usb/dvb-usb/dib0700_core.c |
4373 |
+@@ -616,8 +616,6 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
4374 |
+ deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); |
4375 |
+ if (onoff) |
4376 |
+ st->channel_state |= 1 << (adap->id); |
4377 |
+- else |
4378 |
+- st->channel_state |= 1 << ~(adap->id); |
4379 |
+ } else { |
4380 |
+ if (onoff) |
4381 |
+ st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); |
4382 |
+diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c |
4383 |
+index b960abd00d483..8493ebb377c4d 100644 |
4384 |
+--- a/drivers/media/usb/dvb-usb/dw2102.c |
4385 |
++++ b/drivers/media/usb/dvb-usb/dw2102.c |
4386 |
+@@ -2098,46 +2098,153 @@ static struct dvb_usb_device_properties s6x0_properties = { |
4387 |
+ } |
4388 |
+ }; |
4389 |
+ |
4390 |
+-static const struct dvb_usb_device_description d1100 = { |
4391 |
+- "Prof 1100 USB ", |
4392 |
+- {&dw2102_table[PROF_1100], NULL}, |
4393 |
+- {NULL}, |
4394 |
+-}; |
4395 |
++static struct dvb_usb_device_properties p1100_properties = { |
4396 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
4397 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
4398 |
++ .size_of_priv = sizeof(struct dw2102_state), |
4399 |
++ .firmware = P1100_FIRMWARE, |
4400 |
++ .no_reconnect = 1, |
4401 |
+ |
4402 |
+-static const struct dvb_usb_device_description d660 = { |
4403 |
+- "TeVii S660 USB", |
4404 |
+- {&dw2102_table[TEVII_S660], NULL}, |
4405 |
+- {NULL}, |
4406 |
+-}; |
4407 |
++ .i2c_algo = &s6x0_i2c_algo, |
4408 |
++ .rc.core = { |
4409 |
++ .rc_interval = 150, |
4410 |
++ .rc_codes = RC_MAP_TBS_NEC, |
4411 |
++ .module_name = "dw2102", |
4412 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
4413 |
++ .rc_query = prof_rc_query, |
4414 |
++ }, |
4415 |
+ |
4416 |
+-static const struct dvb_usb_device_description d480_1 = { |
4417 |
+- "TeVii S480.1 USB", |
4418 |
+- {&dw2102_table[TEVII_S480_1], NULL}, |
4419 |
+- {NULL}, |
4420 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
4421 |
++ .num_adapters = 1, |
4422 |
++ .download_firmware = dw2102_load_firmware, |
4423 |
++ .read_mac_address = s6x0_read_mac_address, |
4424 |
++ .adapter = { |
4425 |
++ { |
4426 |
++ .num_frontends = 1, |
4427 |
++ .fe = {{ |
4428 |
++ .frontend_attach = stv0288_frontend_attach, |
4429 |
++ .stream = { |
4430 |
++ .type = USB_BULK, |
4431 |
++ .count = 8, |
4432 |
++ .endpoint = 0x82, |
4433 |
++ .u = { |
4434 |
++ .bulk = { |
4435 |
++ .buffersize = 4096, |
4436 |
++ } |
4437 |
++ } |
4438 |
++ }, |
4439 |
++ } }, |
4440 |
++ } |
4441 |
++ }, |
4442 |
++ .num_device_descs = 1, |
4443 |
++ .devices = { |
4444 |
++ {"Prof 1100 USB ", |
4445 |
++ {&dw2102_table[PROF_1100], NULL}, |
4446 |
++ {NULL}, |
4447 |
++ }, |
4448 |
++ } |
4449 |
+ }; |
4450 |
+ |
4451 |
+-static const struct dvb_usb_device_description d480_2 = { |
4452 |
+- "TeVii S480.2 USB", |
4453 |
+- {&dw2102_table[TEVII_S480_2], NULL}, |
4454 |
+- {NULL}, |
4455 |
+-}; |
4456 |
++static struct dvb_usb_device_properties s660_properties = { |
4457 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
4458 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
4459 |
++ .size_of_priv = sizeof(struct dw2102_state), |
4460 |
++ .firmware = S660_FIRMWARE, |
4461 |
++ .no_reconnect = 1, |
4462 |
+ |
4463 |
+-static const struct dvb_usb_device_description d7500 = { |
4464 |
+- "Prof 7500 USB DVB-S2", |
4465 |
+- {&dw2102_table[PROF_7500], NULL}, |
4466 |
+- {NULL}, |
4467 |
+-}; |
4468 |
++ .i2c_algo = &s6x0_i2c_algo, |
4469 |
++ .rc.core = { |
4470 |
++ .rc_interval = 150, |
4471 |
++ .rc_codes = RC_MAP_TEVII_NEC, |
4472 |
++ .module_name = "dw2102", |
4473 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
4474 |
++ .rc_query = dw2102_rc_query, |
4475 |
++ }, |
4476 |
+ |
4477 |
+-static const struct dvb_usb_device_description d421 = { |
4478 |
+- "TeVii S421 PCI", |
4479 |
+- {&dw2102_table[TEVII_S421], NULL}, |
4480 |
+- {NULL}, |
4481 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
4482 |
++ .num_adapters = 1, |
4483 |
++ .download_firmware = dw2102_load_firmware, |
4484 |
++ .read_mac_address = s6x0_read_mac_address, |
4485 |
++ .adapter = { |
4486 |
++ { |
4487 |
++ .num_frontends = 1, |
4488 |
++ .fe = {{ |
4489 |
++ .frontend_attach = ds3000_frontend_attach, |
4490 |
++ .stream = { |
4491 |
++ .type = USB_BULK, |
4492 |
++ .count = 8, |
4493 |
++ .endpoint = 0x82, |
4494 |
++ .u = { |
4495 |
++ .bulk = { |
4496 |
++ .buffersize = 4096, |
4497 |
++ } |
4498 |
++ } |
4499 |
++ }, |
4500 |
++ } }, |
4501 |
++ } |
4502 |
++ }, |
4503 |
++ .num_device_descs = 3, |
4504 |
++ .devices = { |
4505 |
++ {"TeVii S660 USB", |
4506 |
++ {&dw2102_table[TEVII_S660], NULL}, |
4507 |
++ {NULL}, |
4508 |
++ }, |
4509 |
++ {"TeVii S480.1 USB", |
4510 |
++ {&dw2102_table[TEVII_S480_1], NULL}, |
4511 |
++ {NULL}, |
4512 |
++ }, |
4513 |
++ {"TeVii S480.2 USB", |
4514 |
++ {&dw2102_table[TEVII_S480_2], NULL}, |
4515 |
++ {NULL}, |
4516 |
++ }, |
4517 |
++ } |
4518 |
+ }; |
4519 |
+ |
4520 |
+-static const struct dvb_usb_device_description d632 = { |
4521 |
+- "TeVii S632 USB", |
4522 |
+- {&dw2102_table[TEVII_S632], NULL}, |
4523 |
+- {NULL}, |
4524 |
++static struct dvb_usb_device_properties p7500_properties = { |
4525 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
4526 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
4527 |
++ .size_of_priv = sizeof(struct dw2102_state), |
4528 |
++ .firmware = P7500_FIRMWARE, |
4529 |
++ .no_reconnect = 1, |
4530 |
++ |
4531 |
++ .i2c_algo = &s6x0_i2c_algo, |
4532 |
++ .rc.core = { |
4533 |
++ .rc_interval = 150, |
4534 |
++ .rc_codes = RC_MAP_TBS_NEC, |
4535 |
++ .module_name = "dw2102", |
4536 |
++ .allowed_protos = RC_PROTO_BIT_NEC, |
4537 |
++ .rc_query = prof_rc_query, |
4538 |
++ }, |
4539 |
++ |
4540 |
++ .generic_bulk_ctrl_endpoint = 0x81, |
4541 |
++ .num_adapters = 1, |
4542 |
++ .download_firmware = dw2102_load_firmware, |
4543 |
++ .read_mac_address = s6x0_read_mac_address, |
4544 |
++ .adapter = { |
4545 |
++ { |
4546 |
++ .num_frontends = 1, |
4547 |
++ .fe = {{ |
4548 |
++ .frontend_attach = prof_7500_frontend_attach, |
4549 |
++ .stream = { |
4550 |
++ .type = USB_BULK, |
4551 |
++ .count = 8, |
4552 |
++ .endpoint = 0x82, |
4553 |
++ .u = { |
4554 |
++ .bulk = { |
4555 |
++ .buffersize = 4096, |
4556 |
++ } |
4557 |
++ } |
4558 |
++ }, |
4559 |
++ } }, |
4560 |
++ } |
4561 |
++ }, |
4562 |
++ .num_device_descs = 1, |
4563 |
++ .devices = { |
4564 |
++ {"Prof 7500 USB DVB-S2", |
4565 |
++ {&dw2102_table[PROF_7500], NULL}, |
4566 |
++ {NULL}, |
4567 |
++ }, |
4568 |
++ } |
4569 |
+ }; |
4570 |
+ |
4571 |
+ static struct dvb_usb_device_properties su3000_properties = { |
4572 |
+@@ -2209,6 +2316,59 @@ static struct dvb_usb_device_properties su3000_properties = { |
4573 |
+ } |
4574 |
+ }; |
4575 |
+ |
4576 |
++static struct dvb_usb_device_properties s421_properties = { |
4577 |
++ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
4578 |
++ .usb_ctrl = DEVICE_SPECIFIC, |
4579 |
++ .size_of_priv = sizeof(struct dw2102_state), |
4580 |
++ .power_ctrl = su3000_power_ctrl, |
4581 |
++ .num_adapters = 1, |
4582 |
++ .identify_state = su3000_identify_state, |
4583 |
++ .i2c_algo = &su3000_i2c_algo, |
4584 |
++ |
4585 |
++ .rc.core = { |
4586 |
++ .rc_interval = 150, |
4587 |
++ .rc_codes = RC_MAP_SU3000, |
4588 |
++ .module_name = "dw2102", |
4589 |
++ .allowed_protos = RC_PROTO_BIT_RC5, |
4590 |
++ .rc_query = su3000_rc_query, |
4591 |
++ }, |
4592 |
++ |
4593 |
++ .read_mac_address = su3000_read_mac_address, |
4594 |
++ |
4595 |
++ .generic_bulk_ctrl_endpoint = 0x01, |
4596 |
++ |
4597 |
++ .adapter = { |
4598 |
++ { |
4599 |
++ .num_frontends = 1, |
4600 |
++ .fe = {{ |
4601 |
++ .streaming_ctrl = su3000_streaming_ctrl, |
4602 |
++ .frontend_attach = m88rs2000_frontend_attach, |
4603 |
++ .stream = { |
4604 |
++ .type = USB_BULK, |
4605 |
++ .count = 8, |
4606 |
++ .endpoint = 0x82, |
4607 |
++ .u = { |
4608 |
++ .bulk = { |
4609 |
++ .buffersize = 4096, |
4610 |
++ } |
4611 |
++ } |
4612 |
++ } |
4613 |
++ } }, |
4614 |
++ } |
4615 |
++ }, |
4616 |
++ .num_device_descs = 2, |
4617 |
++ .devices = { |
4618 |
++ { "TeVii S421 PCI", |
4619 |
++ { &dw2102_table[TEVII_S421], NULL }, |
4620 |
++ { NULL }, |
4621 |
++ }, |
4622 |
++ { "TeVii S632 USB", |
4623 |
++ { &dw2102_table[TEVII_S632], NULL }, |
4624 |
++ { NULL }, |
4625 |
++ }, |
4626 |
++ } |
4627 |
++}; |
4628 |
++ |
4629 |
+ static struct dvb_usb_device_properties t220_properties = { |
4630 |
+ .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
4631 |
+ .usb_ctrl = DEVICE_SPECIFIC, |
4632 |
+@@ -2326,101 +2486,33 @@ static struct dvb_usb_device_properties tt_s2_4600_properties = { |
4633 |
+ static int dw2102_probe(struct usb_interface *intf, |
4634 |
+ const struct usb_device_id *id) |
4635 |
+ { |
4636 |
+- int retval = -ENOMEM; |
4637 |
+- struct dvb_usb_device_properties *p1100; |
4638 |
+- struct dvb_usb_device_properties *s660; |
4639 |
+- struct dvb_usb_device_properties *p7500; |
4640 |
+- struct dvb_usb_device_properties *s421; |
4641 |
+- |
4642 |
+- p1100 = kmemdup(&s6x0_properties, |
4643 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
4644 |
+- if (!p1100) |
4645 |
+- goto err0; |
4646 |
+- |
4647 |
+- /* copy default structure */ |
4648 |
+- /* fill only different fields */ |
4649 |
+- p1100->firmware = P1100_FIRMWARE; |
4650 |
+- p1100->devices[0] = d1100; |
4651 |
+- p1100->rc.core.rc_query = prof_rc_query; |
4652 |
+- p1100->rc.core.rc_codes = RC_MAP_TBS_NEC; |
4653 |
+- p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach; |
4654 |
+- |
4655 |
+- s660 = kmemdup(&s6x0_properties, |
4656 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
4657 |
+- if (!s660) |
4658 |
+- goto err1; |
4659 |
+- |
4660 |
+- s660->firmware = S660_FIRMWARE; |
4661 |
+- s660->num_device_descs = 3; |
4662 |
+- s660->devices[0] = d660; |
4663 |
+- s660->devices[1] = d480_1; |
4664 |
+- s660->devices[2] = d480_2; |
4665 |
+- s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach; |
4666 |
+- |
4667 |
+- p7500 = kmemdup(&s6x0_properties, |
4668 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
4669 |
+- if (!p7500) |
4670 |
+- goto err2; |
4671 |
+- |
4672 |
+- p7500->firmware = P7500_FIRMWARE; |
4673 |
+- p7500->devices[0] = d7500; |
4674 |
+- p7500->rc.core.rc_query = prof_rc_query; |
4675 |
+- p7500->rc.core.rc_codes = RC_MAP_TBS_NEC; |
4676 |
+- p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach; |
4677 |
+- |
4678 |
+- |
4679 |
+- s421 = kmemdup(&su3000_properties, |
4680 |
+- sizeof(struct dvb_usb_device_properties), GFP_KERNEL); |
4681 |
+- if (!s421) |
4682 |
+- goto err3; |
4683 |
+- |
4684 |
+- s421->num_device_descs = 2; |
4685 |
+- s421->devices[0] = d421; |
4686 |
+- s421->devices[1] = d632; |
4687 |
+- s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach; |
4688 |
+- |
4689 |
+- if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
4690 |
+- THIS_MODULE, NULL, adapter_nr) || |
4691 |
+- 0 == dvb_usb_device_init(intf, &dw2104_properties, |
4692 |
+- THIS_MODULE, NULL, adapter_nr) || |
4693 |
+- 0 == dvb_usb_device_init(intf, &dw3101_properties, |
4694 |
+- THIS_MODULE, NULL, adapter_nr) || |
4695 |
+- 0 == dvb_usb_device_init(intf, &s6x0_properties, |
4696 |
+- THIS_MODULE, NULL, adapter_nr) || |
4697 |
+- 0 == dvb_usb_device_init(intf, p1100, |
4698 |
+- THIS_MODULE, NULL, adapter_nr) || |
4699 |
+- 0 == dvb_usb_device_init(intf, s660, |
4700 |
+- THIS_MODULE, NULL, adapter_nr) || |
4701 |
+- 0 == dvb_usb_device_init(intf, p7500, |
4702 |
+- THIS_MODULE, NULL, adapter_nr) || |
4703 |
+- 0 == dvb_usb_device_init(intf, s421, |
4704 |
+- THIS_MODULE, NULL, adapter_nr) || |
4705 |
+- 0 == dvb_usb_device_init(intf, &su3000_properties, |
4706 |
+- THIS_MODULE, NULL, adapter_nr) || |
4707 |
+- 0 == dvb_usb_device_init(intf, &t220_properties, |
4708 |
+- THIS_MODULE, NULL, adapter_nr) || |
4709 |
+- 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, |
4710 |
+- THIS_MODULE, NULL, adapter_nr)) { |
4711 |
+- |
4712 |
+- /* clean up copied properties */ |
4713 |
+- kfree(s421); |
4714 |
+- kfree(p7500); |
4715 |
+- kfree(s660); |
4716 |
+- kfree(p1100); |
4717 |
++ if (!(dvb_usb_device_init(intf, &dw2102_properties, |
4718 |
++ THIS_MODULE, NULL, adapter_nr) && |
4719 |
++ dvb_usb_device_init(intf, &dw2104_properties, |
4720 |
++ THIS_MODULE, NULL, adapter_nr) && |
4721 |
++ dvb_usb_device_init(intf, &dw3101_properties, |
4722 |
++ THIS_MODULE, NULL, adapter_nr) && |
4723 |
++ dvb_usb_device_init(intf, &s6x0_properties, |
4724 |
++ THIS_MODULE, NULL, adapter_nr) && |
4725 |
++ dvb_usb_device_init(intf, &p1100_properties, |
4726 |
++ THIS_MODULE, NULL, adapter_nr) && |
4727 |
++ dvb_usb_device_init(intf, &s660_properties, |
4728 |
++ THIS_MODULE, NULL, adapter_nr) && |
4729 |
++ dvb_usb_device_init(intf, &p7500_properties, |
4730 |
++ THIS_MODULE, NULL, adapter_nr) && |
4731 |
++ dvb_usb_device_init(intf, &s421_properties, |
4732 |
++ THIS_MODULE, NULL, adapter_nr) && |
4733 |
++ dvb_usb_device_init(intf, &su3000_properties, |
4734 |
++ THIS_MODULE, NULL, adapter_nr) && |
4735 |
++ dvb_usb_device_init(intf, &t220_properties, |
4736 |
++ THIS_MODULE, NULL, adapter_nr) && |
4737 |
++ dvb_usb_device_init(intf, &tt_s2_4600_properties, |
4738 |
++ THIS_MODULE, NULL, adapter_nr))) { |
4739 |
+ |
4740 |
+ return 0; |
4741 |
+ } |
4742 |
+ |
4743 |
+- retval = -ENODEV; |
4744 |
+- kfree(s421); |
4745 |
+-err3: |
4746 |
+- kfree(p7500); |
4747 |
+-err2: |
4748 |
+- kfree(s660); |
4749 |
+-err1: |
4750 |
+- kfree(p1100); |
4751 |
+-err0: |
4752 |
+- return retval; |
4753 |
++ return -ENODEV; |
4754 |
+ } |
4755 |
+ |
4756 |
+ static void dw2102_disconnect(struct usb_interface *intf) |
4757 |
+diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c |
4758 |
+index d866a1990a7d2..7282f60226558 100644 |
4759 |
+--- a/drivers/media/usb/dvb-usb/m920x.c |
4760 |
++++ b/drivers/media/usb/dvb-usb/m920x.c |
4761 |
+@@ -274,6 +274,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
4762 |
+ /* Should check for ack here, if we knew how. */ |
4763 |
+ } |
4764 |
+ if (msg[i].flags & I2C_M_RD) { |
4765 |
++ char *read = kmalloc(1, GFP_KERNEL); |
4766 |
++ if (!read) { |
4767 |
++ ret = -ENOMEM; |
4768 |
++ kfree(read); |
4769 |
++ goto unlock; |
4770 |
++ } |
4771 |
++ |
4772 |
+ for (j = 0; j < msg[i].len; j++) { |
4773 |
+ /* Last byte of transaction? |
4774 |
+ * Send STOP, otherwise send ACK. */ |
4775 |
+@@ -281,9 +288,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
4776 |
+ |
4777 |
+ if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
4778 |
+ 0x20 | stop, |
4779 |
+- &msg[i].buf[j], 1)) != 0) |
4780 |
++ read, 1)) != 0) |
4781 |
+ goto unlock; |
4782 |
++ msg[i].buf[j] = read[0]; |
4783 |
+ } |
4784 |
++ |
4785 |
++ kfree(read); |
4786 |
+ } else { |
4787 |
+ for (j = 0; j < msg[i].len; j++) { |
4788 |
+ /* Last byte of transaction? Then send STOP. */ |
4789 |
+diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c |
4790 |
+index 3e96b4b711d75..bfca9d0a1fe15 100644 |
4791 |
+--- a/drivers/media/usb/em28xx/em28xx-cards.c |
4792 |
++++ b/drivers/media/usb/em28xx/em28xx-cards.c |
4793 |
+@@ -3515,8 +3515,10 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
4794 |
+ |
4795 |
+ if (dev->is_audio_only) { |
4796 |
+ retval = em28xx_audio_setup(dev); |
4797 |
+- if (retval) |
4798 |
+- return -ENODEV; |
4799 |
++ if (retval) { |
4800 |
++ retval = -ENODEV; |
4801 |
++ goto err_deinit_media; |
4802 |
++ } |
4803 |
+ em28xx_init_extension(dev); |
4804 |
+ |
4805 |
+ return 0; |
4806 |
+@@ -3535,7 +3537,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
4807 |
+ dev_err(&dev->intf->dev, |
4808 |
+ "%s: em28xx_i2c_register bus 0 - error [%d]!\n", |
4809 |
+ __func__, retval); |
4810 |
+- return retval; |
4811 |
++ goto err_deinit_media; |
4812 |
+ } |
4813 |
+ |
4814 |
+ /* register i2c bus 1 */ |
4815 |
+@@ -3551,9 +3553,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
4816 |
+ "%s: em28xx_i2c_register bus 1 - error [%d]!\n", |
4817 |
+ __func__, retval); |
4818 |
+ |
4819 |
+- em28xx_i2c_unregister(dev, 0); |
4820 |
+- |
4821 |
+- return retval; |
4822 |
++ goto err_unreg_i2c; |
4823 |
+ } |
4824 |
+ } |
4825 |
+ |
4826 |
+@@ -3561,6 +3561,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, |
4827 |
+ em28xx_card_setup(dev); |
4828 |
+ |
4829 |
+ return 0; |
4830 |
++ |
4831 |
++err_unreg_i2c: |
4832 |
++ em28xx_i2c_unregister(dev, 0); |
4833 |
++err_deinit_media: |
4834 |
++ em28xx_unregister_media_device(dev); |
4835 |
++ return retval; |
4836 |
+ } |
4837 |
+ |
4838 |
+ static int em28xx_duplicate_dev(struct em28xx *dev) |
4839 |
+diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c |
4840 |
+index af9216278024f..308bc029099d9 100644 |
4841 |
+--- a/drivers/media/usb/em28xx/em28xx-core.c |
4842 |
++++ b/drivers/media/usb/em28xx/em28xx-core.c |
4843 |
+@@ -89,7 +89,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, |
4844 |
+ mutex_lock(&dev->ctrl_urb_lock); |
4845 |
+ ret = usb_control_msg(udev, pipe, req, |
4846 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
4847 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
4848 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
4849 |
+ if (ret < 0) { |
4850 |
+ em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %02x failed with error %i\n", |
4851 |
+ pipe, |
4852 |
+@@ -158,7 +158,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, |
4853 |
+ memcpy(dev->urb_buf, buf, len); |
4854 |
+ ret = usb_control_msg(udev, pipe, req, |
4855 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
4856 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
4857 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
4858 |
+ mutex_unlock(&dev->ctrl_urb_lock); |
4859 |
+ |
4860 |
+ if (ret < 0) { |
4861 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4862 |
+index 4c991eae53cdf..2f00679f65a0a 100644 |
4863 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4864 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4865 |
+@@ -1468,7 +1468,7 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) |
4866 |
+ for (address = 0; address < fwsize; address += 0x800) { |
4867 |
+ memcpy(fw_ptr, fw_entry->data + address, 0x800); |
4868 |
+ ret += usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, |
4869 |
+- 0, fw_ptr, 0x800, HZ); |
4870 |
++ 0, fw_ptr, 0x800, 1000); |
4871 |
+ } |
4872 |
+ |
4873 |
+ trace_firmware("Upload done, releasing device's CPU"); |
4874 |
+@@ -1606,7 +1606,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) |
4875 |
+ ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); |
4876 |
+ |
4877 |
+ ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, |
4878 |
+- &actual_length, HZ); |
4879 |
++ &actual_length, 1000); |
4880 |
+ ret |= (actual_length != bcnt); |
4881 |
+ if (ret) break; |
4882 |
+ fw_done += bcnt; |
4883 |
+@@ -3439,7 +3439,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, |
4884 |
+ 0xa0,0xc0, |
4885 |
+ address,0, |
4886 |
+ hdw->fw_buffer+address, |
4887 |
+- 0x800,HZ); |
4888 |
++ 0x800,1000); |
4889 |
+ if (ret < 0) break; |
4890 |
+ } |
4891 |
+ |
4892 |
+@@ -3978,7 +3978,7 @@ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val) |
4893 |
+ /* Write the CPUCS register on the 8051. The lsb of the register |
4894 |
+ is the reset bit; a 1 asserts reset while a 0 clears it. */ |
4895 |
+ pipe = usb_sndctrlpipe(hdw->usb_dev, 0); |
4896 |
+- ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); |
4897 |
++ ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); |
4898 |
+ if (ret < 0) { |
4899 |
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
4900 |
+ "cpureset_assert(%d) error=%d",val,ret); |
4901 |
+diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c |
4902 |
+index 329ec80895927..7ed526306816a 100644 |
4903 |
+--- a/drivers/media/usb/s2255/s2255drv.c |
4904 |
++++ b/drivers/media/usb/s2255/s2255drv.c |
4905 |
+@@ -1884,7 +1884,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, |
4906 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
4907 |
+ USB_DIR_IN, |
4908 |
+ Value, Index, buf, |
4909 |
+- TransferBufferLength, HZ * 5); |
4910 |
++ TransferBufferLength, USB_CTRL_SET_TIMEOUT); |
4911 |
+ |
4912 |
+ if (r >= 0) |
4913 |
+ memcpy(TransferBuffer, buf, TransferBufferLength); |
4914 |
+@@ -1893,7 +1893,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, |
4915 |
+ r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
4916 |
+ Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
4917 |
+ Value, Index, buf, |
4918 |
+- TransferBufferLength, HZ * 5); |
4919 |
++ TransferBufferLength, USB_CTRL_SET_TIMEOUT); |
4920 |
+ } |
4921 |
+ kfree(buf); |
4922 |
+ return r; |
4923 |
+diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c |
4924 |
+index b4f8bc5db1389..4e1698f788187 100644 |
4925 |
+--- a/drivers/media/usb/stk1160/stk1160-core.c |
4926 |
++++ b/drivers/media/usb/stk1160/stk1160-core.c |
4927 |
+@@ -65,7 +65,7 @@ int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value) |
4928 |
+ return -ENOMEM; |
4929 |
+ ret = usb_control_msg(dev->udev, pipe, 0x00, |
4930 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
4931 |
+- 0x00, reg, buf, sizeof(u8), HZ); |
4932 |
++ 0x00, reg, buf, sizeof(u8), 1000); |
4933 |
+ if (ret < 0) { |
4934 |
+ stk1160_err("read failed on reg 0x%x (%d)\n", |
4935 |
+ reg, ret); |
4936 |
+@@ -85,7 +85,7 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value) |
4937 |
+ |
4938 |
+ ret = usb_control_msg(dev->udev, pipe, 0x01, |
4939 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
4940 |
+- value, reg, NULL, 0, HZ); |
4941 |
++ value, reg, NULL, 0, 1000); |
4942 |
+ if (ret < 0) { |
4943 |
+ stk1160_err("write failed on reg 0x%x (%d)\n", |
4944 |
+ reg, ret); |
4945 |
+diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h |
4946 |
+index 24e3d8c647e77..5f137400bebd6 100644 |
4947 |
+--- a/drivers/media/usb/uvc/uvcvideo.h |
4948 |
++++ b/drivers/media/usb/uvc/uvcvideo.h |
4949 |
+@@ -179,7 +179,7 @@ |
4950 |
+ /* Maximum status buffer size in bytes of interrupt URB. */ |
4951 |
+ #define UVC_MAX_STATUS_SIZE 16 |
4952 |
+ |
4953 |
+-#define UVC_CTRL_CONTROL_TIMEOUT 500 |
4954 |
++#define UVC_CTRL_CONTROL_TIMEOUT 5000 |
4955 |
+ #define UVC_CTRL_STREAMING_TIMEOUT 5000 |
4956 |
+ |
4957 |
+ /* Maximum allowed number of control mappings per device */ |
4958 |
+diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c |
4959 |
+index 98633fa5d46fd..3012e8ecffb94 100644 |
4960 |
+--- a/drivers/media/v4l2-core/v4l2-ioctl.c |
4961 |
++++ b/drivers/media/v4l2-core/v4l2-ioctl.c |
4962 |
+@@ -2046,6 +2046,7 @@ static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops, |
4963 |
+ static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, |
4964 |
+ struct file *file, void *fh, void *arg) |
4965 |
+ { |
4966 |
++ struct video_device *vfd = video_devdata(file); |
4967 |
+ struct v4l2_streamparm *p = arg; |
4968 |
+ v4l2_std_id std; |
4969 |
+ int ret = check_fmt(file, p->type); |
4970 |
+@@ -2057,7 +2058,8 @@ static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, |
4971 |
+ if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && |
4972 |
+ p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) |
4973 |
+ return -EINVAL; |
4974 |
+- p->parm.capture.readbuffers = 2; |
4975 |
++ if (vfd->device_caps & V4L2_CAP_READWRITE) |
4976 |
++ p->parm.capture.readbuffers = 2; |
4977 |
+ ret = ops->vidioc_g_std(file, fh, &std); |
4978 |
+ if (ret == 0) |
4979 |
+ v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); |
4980 |
+diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c |
4981 |
+index 884485c3f7232..3a0d2b052ed29 100644 |
4982 |
+--- a/drivers/misc/lattice-ecp3-config.c |
4983 |
++++ b/drivers/misc/lattice-ecp3-config.c |
4984 |
+@@ -77,12 +77,12 @@ static void firmware_load(const struct firmware *fw, void *context) |
4985 |
+ |
4986 |
+ if (fw == NULL) { |
4987 |
+ dev_err(&spi->dev, "Cannot load firmware, aborting\n"); |
4988 |
+- return; |
4989 |
++ goto out; |
4990 |
+ } |
4991 |
+ |
4992 |
+ if (fw->size == 0) { |
4993 |
+ dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
4994 |
+- return; |
4995 |
++ goto out; |
4996 |
+ } |
4997 |
+ |
4998 |
+ /* Fill dummy data (24 stuffing bits for commands) */ |
4999 |
+@@ -104,7 +104,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
5000 |
+ dev_err(&spi->dev, |
5001 |
+ "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", |
5002 |
+ jedec_id); |
5003 |
+- return; |
5004 |
++ goto out; |
5005 |
+ } |
5006 |
+ |
5007 |
+ dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); |
5008 |
+@@ -117,7 +117,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
5009 |
+ buffer = kzalloc(fw->size + 8, GFP_KERNEL); |
5010 |
+ if (!buffer) { |
5011 |
+ dev_err(&spi->dev, "Error: Can't allocate memory!\n"); |
5012 |
+- return; |
5013 |
++ goto out; |
5014 |
+ } |
5015 |
+ |
5016 |
+ /* |
5017 |
+@@ -156,7 +156,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
5018 |
+ "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", |
5019 |
+ status); |
5020 |
+ kfree(buffer); |
5021 |
+- return; |
5022 |
++ goto out; |
5023 |
+ } |
5024 |
+ |
5025 |
+ dev_info(&spi->dev, "Configuring the FPGA...\n"); |
5026 |
+@@ -182,7 +182,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
5027 |
+ release_firmware(fw); |
5028 |
+ |
5029 |
+ kfree(buffer); |
5030 |
+- |
5031 |
++out: |
5032 |
+ complete(&data->fw_loaded); |
5033 |
+ } |
5034 |
+ |
5035 |
+diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile |
5036 |
+index 30c8ac24635d4..4405fb2bc7a00 100644 |
5037 |
+--- a/drivers/misc/lkdtm/Makefile |
5038 |
++++ b/drivers/misc/lkdtm/Makefile |
5039 |
+@@ -16,7 +16,7 @@ KCOV_INSTRUMENT_rodata.o := n |
5040 |
+ |
5041 |
+ OBJCOPYFLAGS := |
5042 |
+ OBJCOPYFLAGS_rodata_objcopy.o := \ |
5043 |
+- --rename-section .noinstr.text=.rodata,alloc,readonly,load |
5044 |
++ --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents |
5045 |
+ targets += rodata.o rodata_objcopy.o |
5046 |
+ $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE |
5047 |
+ $(call if_changed,objcopy) |
5048 |
+diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c |
5049 |
+index 0bf33786fc5c5..9e0791332ef38 100644 |
5050 |
+--- a/drivers/mmc/core/sdio.c |
5051 |
++++ b/drivers/mmc/core/sdio.c |
5052 |
+@@ -626,6 +626,8 @@ try_again: |
5053 |
+ if (host->ops->init_card) |
5054 |
+ host->ops->init_card(host, card); |
5055 |
+ |
5056 |
++ card->ocr = ocr_card; |
5057 |
++ |
5058 |
+ /* |
5059 |
+ * If the host and card support UHS-I mode request the card |
5060 |
+ * to switch to 1.8V signaling level. No 1.8v signalling if |
5061 |
+@@ -738,7 +740,7 @@ try_again: |
5062 |
+ goto mismatch; |
5063 |
+ } |
5064 |
+ } |
5065 |
+- card->ocr = ocr_card; |
5066 |
++ |
5067 |
+ mmc_fixup_device(card, sdio_fixup_methods); |
5068 |
+ |
5069 |
+ if (card->type == MMC_TYPE_SD_COMBO) { |
5070 |
+diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c |
5071 |
+index 360d523132bd5..780552a86ec08 100644 |
5072 |
+--- a/drivers/mmc/host/meson-mx-sdio.c |
5073 |
++++ b/drivers/mmc/host/meson-mx-sdio.c |
5074 |
+@@ -665,6 +665,11 @@ static int meson_mx_mmc_probe(struct platform_device *pdev) |
5075 |
+ } |
5076 |
+ |
5077 |
+ irq = platform_get_irq(pdev, 0); |
5078 |
++ if (irq < 0) { |
5079 |
++ ret = irq; |
5080 |
++ goto error_free_mmc; |
5081 |
++ } |
5082 |
++ |
5083 |
+ ret = devm_request_threaded_irq(host->controller_dev, irq, |
5084 |
+ meson_mx_mmc_irq, |
5085 |
+ meson_mx_mmc_irq_thread, IRQF_ONESHOT, |
5086 |
+diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c |
5087 |
+index 044adf9138546..64af6898131d6 100644 |
5088 |
+--- a/drivers/mtd/nand/bbt.c |
5089 |
++++ b/drivers/mtd/nand/bbt.c |
5090 |
+@@ -123,7 +123,7 @@ int nanddev_bbt_set_block_status(struct nand_device *nand, unsigned int entry, |
5091 |
+ unsigned int rbits = bits_per_block + offs - BITS_PER_LONG; |
5092 |
+ |
5093 |
+ pos[1] &= ~GENMASK(rbits - 1, 0); |
5094 |
+- pos[1] |= val >> rbits; |
5095 |
++ pos[1] |= val >> (bits_per_block - rbits); |
5096 |
+ } |
5097 |
+ |
5098 |
+ return 0; |
5099 |
+diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5100 |
+index 60f146920b9f4..515094e253dcd 100644 |
5101 |
+--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5102 |
++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5103 |
+@@ -710,14 +710,32 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, |
5104 |
+ (use_half_period ? BM_GPMI_CTRL1_HALF_PERIOD : 0); |
5105 |
+ } |
5106 |
+ |
5107 |
+-static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) |
5108 |
++static int gpmi_nfc_apply_timings(struct gpmi_nand_data *this) |
5109 |
+ { |
5110 |
+ struct gpmi_nfc_hardware_timing *hw = &this->hw; |
5111 |
+ struct resources *r = &this->resources; |
5112 |
+ void __iomem *gpmi_regs = r->gpmi_regs; |
5113 |
+ unsigned int dll_wait_time_us; |
5114 |
++ int ret; |
5115 |
++ |
5116 |
++ /* Clock dividers do NOT guarantee a clean clock signal on its output |
5117 |
++ * during the change of the divide factor on i.MX6Q/UL/SX. On i.MX7/8, |
5118 |
++ * all clock dividers provide these guarantee. |
5119 |
++ */ |
5120 |
++ if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) |
5121 |
++ clk_disable_unprepare(r->clock[0]); |
5122 |
+ |
5123 |
+- clk_set_rate(r->clock[0], hw->clk_rate); |
5124 |
++ ret = clk_set_rate(r->clock[0], hw->clk_rate); |
5125 |
++ if (ret) { |
5126 |
++ dev_err(this->dev, "cannot set clock rate to %lu Hz: %d\n", hw->clk_rate, ret); |
5127 |
++ return ret; |
5128 |
++ } |
5129 |
++ |
5130 |
++ if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) { |
5131 |
++ ret = clk_prepare_enable(r->clock[0]); |
5132 |
++ if (ret) |
5133 |
++ return ret; |
5134 |
++ } |
5135 |
+ |
5136 |
+ writel(hw->timing0, gpmi_regs + HW_GPMI_TIMING0); |
5137 |
+ writel(hw->timing1, gpmi_regs + HW_GPMI_TIMING1); |
5138 |
+@@ -736,6 +754,8 @@ static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) |
5139 |
+ |
5140 |
+ /* Wait for the DLL to settle. */ |
5141 |
+ udelay(dll_wait_time_us); |
5142 |
++ |
5143 |
++ return 0; |
5144 |
+ } |
5145 |
+ |
5146 |
+ static int gpmi_setup_data_interface(struct nand_chip *chip, int chipnr, |
5147 |
+@@ -1184,15 +1204,6 @@ static int gpmi_get_clks(struct gpmi_nand_data *this) |
5148 |
+ r->clock[i] = clk; |
5149 |
+ } |
5150 |
+ |
5151 |
+- if (GPMI_IS_MX6(this)) |
5152 |
+- /* |
5153 |
+- * Set the default value for the gpmi clock. |
5154 |
+- * |
5155 |
+- * If you want to use the ONFI nand which is in the |
5156 |
+- * Synchronous Mode, you should change the clock as you need. |
5157 |
+- */ |
5158 |
+- clk_set_rate(r->clock[0], 22000000); |
5159 |
+- |
5160 |
+ return 0; |
5161 |
+ |
5162 |
+ err_clock: |
5163 |
+@@ -2429,7 +2440,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
5164 |
+ */ |
5165 |
+ if (this->hw.must_apply_timings) { |
5166 |
+ this->hw.must_apply_timings = false; |
5167 |
+- gpmi_nfc_apply_timings(this); |
5168 |
++ ret = gpmi_nfc_apply_timings(this); |
5169 |
++ if (ret) |
5170 |
++ return ret; |
5171 |
+ } |
5172 |
+ |
5173 |
+ dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); |
5174 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
5175 |
+index a7eaf80f500c0..ff50ccc7dceb1 100644 |
5176 |
+--- a/drivers/net/bonding/bond_main.c |
5177 |
++++ b/drivers/net/bonding/bond_main.c |
5178 |
+@@ -792,9 +792,6 @@ static bool bond_should_notify_peers(struct bonding *bond) |
5179 |
+ slave = rcu_dereference(bond->curr_active_slave); |
5180 |
+ rcu_read_unlock(); |
5181 |
+ |
5182 |
+- netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
5183 |
+- slave ? slave->dev->name : "NULL"); |
5184 |
+- |
5185 |
+ if (!slave || !bond->send_peer_notif || |
5186 |
+ bond->send_peer_notif % |
5187 |
+ max(1, bond->params.peer_notif_delay) != 0 || |
5188 |
+@@ -802,6 +799,9 @@ static bool bond_should_notify_peers(struct bonding *bond) |
5189 |
+ test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
5190 |
+ return false; |
5191 |
+ |
5192 |
++ netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
5193 |
++ slave ? slave->dev->name : "NULL"); |
5194 |
++ |
5195 |
+ return true; |
5196 |
+ } |
5197 |
+ |
5198 |
+diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c |
5199 |
+index 2e93ee7923739..e5c939b63fa65 100644 |
5200 |
+--- a/drivers/net/can/softing/softing_cs.c |
5201 |
++++ b/drivers/net/can/softing/softing_cs.c |
5202 |
+@@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia) |
5203 |
+ return 0; |
5204 |
+ |
5205 |
+ platform_failed: |
5206 |
+- kfree(dev); |
5207 |
++ platform_device_put(pdev); |
5208 |
+ mem_failed: |
5209 |
+ pcmcia_bad: |
5210 |
+ pcmcia_failed: |
5211 |
+diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c |
5212 |
+index 8f44fdd8804bf..1c2afa17c26d1 100644 |
5213 |
+--- a/drivers/net/can/softing/softing_fw.c |
5214 |
++++ b/drivers/net/can/softing/softing_fw.c |
5215 |
+@@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up) |
5216 |
+ if (ret < 0) |
5217 |
+ goto failed; |
5218 |
+ } |
5219 |
+- /* enable_error_frame */ |
5220 |
+- /* |
5221 |
++ |
5222 |
++ /* enable_error_frame |
5223 |
++ * |
5224 |
+ * Error reporting is switched off at the moment since |
5225 |
+ * the receiving of them is not yet 100% verified |
5226 |
+ * This should be enabled sooner or later |
5227 |
+- * |
5228 |
+- if (error_reporting) { |
5229 |
++ */ |
5230 |
++ if (0 && error_reporting) { |
5231 |
+ ret = softing_fct_cmd(card, 51, "enable_error_frame"); |
5232 |
+ if (ret < 0) |
5233 |
+ goto failed; |
5234 |
+ } |
5235 |
+- */ |
5236 |
++ |
5237 |
+ /* initialize interface */ |
5238 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); |
5239 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); |
5240 |
+diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c |
5241 |
+index 0de39ebb35662..008d3d492bd1c 100644 |
5242 |
+--- a/drivers/net/can/xilinx_can.c |
5243 |
++++ b/drivers/net/can/xilinx_can.c |
5244 |
+@@ -1753,7 +1753,12 @@ static int xcan_probe(struct platform_device *pdev) |
5245 |
+ spin_lock_init(&priv->tx_lock); |
5246 |
+ |
5247 |
+ /* Get IRQ for the device */ |
5248 |
+- ndev->irq = platform_get_irq(pdev, 0); |
5249 |
++ ret = platform_get_irq(pdev, 0); |
5250 |
++ if (ret < 0) |
5251 |
++ goto err_free; |
5252 |
++ |
5253 |
++ ndev->irq = ret; |
5254 |
++ |
5255 |
+ ndev->flags |= IFF_ECHO; /* We support local echo */ |
5256 |
+ |
5257 |
+ platform_set_drvdata(pdev, ndev); |
5258 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5259 |
+index c2a1fa75b2147..2affdddc12bf6 100644 |
5260 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5261 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5262 |
+@@ -3507,10 +3507,12 @@ static int bcmgenet_probe(struct platform_device *pdev) |
5263 |
+ |
5264 |
+ /* Request the WOL interrupt and advertise suspend if available */ |
5265 |
+ priv->wol_irq_disabled = true; |
5266 |
+- err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, |
5267 |
+- dev->name, priv); |
5268 |
+- if (!err) |
5269 |
+- device_set_wakeup_capable(&pdev->dev, 1); |
5270 |
++ if (priv->wol_irq > 0) { |
5271 |
++ err = devm_request_irq(&pdev->dev, priv->wol_irq, |
5272 |
++ bcmgenet_wol_isr, 0, dev->name, priv); |
5273 |
++ if (!err) |
5274 |
++ device_set_wakeup_capable(&pdev->dev, 1); |
5275 |
++ } |
5276 |
+ |
5277 |
+ /* Set the needed headroom to account for any possible |
5278 |
+ * features enabling/disabling at runtime |
5279 |
+diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
5280 |
+index d04a6c1634452..da8d10475a08e 100644 |
5281 |
+--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
5282 |
++++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c |
5283 |
+@@ -32,6 +32,7 @@ |
5284 |
+ |
5285 |
+ #include <linux/tcp.h> |
5286 |
+ #include <linux/ipv6.h> |
5287 |
++#include <net/inet_ecn.h> |
5288 |
+ #include <net/route.h> |
5289 |
+ #include <net/ip6_route.h> |
5290 |
+ |
5291 |
+@@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *lldi, |
5292 |
+ |
5293 |
+ rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, |
5294 |
+ peer_port, local_port, IPPROTO_TCP, |
5295 |
+- tos, 0); |
5296 |
++ tos & ~INET_ECN_MASK, 0); |
5297 |
+ if (IS_ERR(rt)) |
5298 |
+ return NULL; |
5299 |
+ n = dst_neigh_lookup(&rt->dst, &peer_ip); |
5300 |
+diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c |
5301 |
+index c9fb1ec625d8b..a8a8b77c1611e 100644 |
5302 |
+--- a/drivers/net/ethernet/cortina/gemini.c |
5303 |
++++ b/drivers/net/ethernet/cortina/gemini.c |
5304 |
+@@ -304,21 +304,21 @@ static void gmac_speed_set(struct net_device *netdev) |
5305 |
+ switch (phydev->speed) { |
5306 |
+ case 1000: |
5307 |
+ status.bits.speed = GMAC_SPEED_1000; |
5308 |
+- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) |
5309 |
++ if (phy_interface_mode_is_rgmii(phydev->interface)) |
5310 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_1000; |
5311 |
+ netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", |
5312 |
+ phydev_name(phydev)); |
5313 |
+ break; |
5314 |
+ case 100: |
5315 |
+ status.bits.speed = GMAC_SPEED_100; |
5316 |
+- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) |
5317 |
++ if (phy_interface_mode_is_rgmii(phydev->interface)) |
5318 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; |
5319 |
+ netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", |
5320 |
+ phydev_name(phydev)); |
5321 |
+ break; |
5322 |
+ case 10: |
5323 |
+ status.bits.speed = GMAC_SPEED_10; |
5324 |
+- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) |
5325 |
++ if (phy_interface_mode_is_rgmii(phydev->interface)) |
5326 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; |
5327 |
+ netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", |
5328 |
+ phydev_name(phydev)); |
5329 |
+@@ -388,6 +388,9 @@ static int gmac_setup_phy(struct net_device *netdev) |
5330 |
+ status.bits.mii_rmii = GMAC_PHY_GMII; |
5331 |
+ break; |
5332 |
+ case PHY_INTERFACE_MODE_RGMII: |
5333 |
++ case PHY_INTERFACE_MODE_RGMII_ID: |
5334 |
++ case PHY_INTERFACE_MODE_RGMII_TXID: |
5335 |
++ case PHY_INTERFACE_MODE_RGMII_RXID: |
5336 |
+ netdev_dbg(netdev, |
5337 |
+ "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); |
5338 |
+ status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; |
5339 |
+diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c |
5340 |
+index 7ab8095db1928..147126e79986c 100644 |
5341 |
+--- a/drivers/net/ethernet/freescale/fman/mac.c |
5342 |
++++ b/drivers/net/ethernet/freescale/fman/mac.c |
5343 |
+@@ -94,14 +94,17 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) |
5344 |
+ __func__, ex); |
5345 |
+ } |
5346 |
+ |
5347 |
+-static void set_fman_mac_params(struct mac_device *mac_dev, |
5348 |
+- struct fman_mac_params *params) |
5349 |
++static int set_fman_mac_params(struct mac_device *mac_dev, |
5350 |
++ struct fman_mac_params *params) |
5351 |
+ { |
5352 |
+ struct mac_priv_s *priv = mac_dev->priv; |
5353 |
+ |
5354 |
+ params->base_addr = (typeof(params->base_addr)) |
5355 |
+ devm_ioremap(priv->dev, mac_dev->res->start, |
5356 |
+ resource_size(mac_dev->res)); |
5357 |
++ if (!params->base_addr) |
5358 |
++ return -ENOMEM; |
5359 |
++ |
5360 |
+ memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); |
5361 |
+ params->max_speed = priv->max_speed; |
5362 |
+ params->phy_if = mac_dev->phy_if; |
5363 |
+@@ -112,6 +115,8 @@ static void set_fman_mac_params(struct mac_device *mac_dev, |
5364 |
+ params->event_cb = mac_exception; |
5365 |
+ params->dev_id = mac_dev; |
5366 |
+ params->internal_phy_node = priv->internal_phy_node; |
5367 |
++ |
5368 |
++ return 0; |
5369 |
+ } |
5370 |
+ |
5371 |
+ static int tgec_initialization(struct mac_device *mac_dev) |
5372 |
+@@ -123,7 +128,9 @@ static int tgec_initialization(struct mac_device *mac_dev) |
5373 |
+ |
5374 |
+ priv = mac_dev->priv; |
5375 |
+ |
5376 |
+- set_fman_mac_params(mac_dev, ¶ms); |
5377 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
5378 |
++ if (err) |
5379 |
++ goto _return; |
5380 |
+ |
5381 |
+ mac_dev->fman_mac = tgec_config(¶ms); |
5382 |
+ if (!mac_dev->fman_mac) { |
5383 |
+@@ -169,7 +176,9 @@ static int dtsec_initialization(struct mac_device *mac_dev) |
5384 |
+ |
5385 |
+ priv = mac_dev->priv; |
5386 |
+ |
5387 |
+- set_fman_mac_params(mac_dev, ¶ms); |
5388 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
5389 |
++ if (err) |
5390 |
++ goto _return; |
5391 |
+ |
5392 |
+ mac_dev->fman_mac = dtsec_config(¶ms); |
5393 |
+ if (!mac_dev->fman_mac) { |
5394 |
+@@ -218,7 +227,9 @@ static int memac_initialization(struct mac_device *mac_dev) |
5395 |
+ |
5396 |
+ priv = mac_dev->priv; |
5397 |
+ |
5398 |
+- set_fman_mac_params(mac_dev, ¶ms); |
5399 |
++ err = set_fman_mac_params(mac_dev, ¶ms); |
5400 |
++ if (err) |
5401 |
++ goto _return; |
5402 |
+ |
5403 |
+ if (priv->max_speed == SPEED_10000) |
5404 |
+ params.phy_if = PHY_INTERFACE_MODE_XGMII; |
5405 |
+diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c |
5406 |
+index c82c85ef5fb34..c37aea7ba8502 100644 |
5407 |
+--- a/drivers/net/ethernet/freescale/xgmac_mdio.c |
5408 |
++++ b/drivers/net/ethernet/freescale/xgmac_mdio.c |
5409 |
+@@ -301,9 +301,10 @@ err_ioremap: |
5410 |
+ static int xgmac_mdio_remove(struct platform_device *pdev) |
5411 |
+ { |
5412 |
+ struct mii_bus *bus = platform_get_drvdata(pdev); |
5413 |
++ struct mdio_fsl_priv *priv = bus->priv; |
5414 |
+ |
5415 |
+ mdiobus_unregister(bus); |
5416 |
+- iounmap(bus->priv); |
5417 |
++ iounmap(priv->mdio_base); |
5418 |
+ mdiobus_free(bus); |
5419 |
+ |
5420 |
+ return 0; |
5421 |
+diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c |
5422 |
+index 6436a98c5953f..90e237fdfbd0e 100644 |
5423 |
+--- a/drivers/net/ethernet/i825xx/sni_82596.c |
5424 |
++++ b/drivers/net/ethernet/i825xx/sni_82596.c |
5425 |
+@@ -123,9 +123,10 @@ static int sni_82596_probe(struct platform_device *dev) |
5426 |
+ netdevice->dev_addr[5] = readb(eth_addr + 0x06); |
5427 |
+ iounmap(eth_addr); |
5428 |
+ |
5429 |
+- if (!netdevice->irq) { |
5430 |
++ if (netdevice->irq < 0) { |
5431 |
+ printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", |
5432 |
+ __FILE__, netdevice->base_addr); |
5433 |
++ retval = netdevice->irq; |
5434 |
+ goto probe_failed; |
5435 |
+ } |
5436 |
+ |
5437 |
+diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c |
5438 |
+index 48b395b9c15ad..3351d4f9363af 100644 |
5439 |
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c |
5440 |
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c |
5441 |
+@@ -215,7 +215,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, |
5442 |
+ phylink_config); |
5443 |
+ struct mtk_eth *eth = mac->hw; |
5444 |
+ u32 mcr_cur, mcr_new, sid, i; |
5445 |
+- int val, ge_mode, err; |
5446 |
++ int val, ge_mode, err = 0; |
5447 |
+ |
5448 |
+ /* MT76x8 has no hardware settings between for the MAC */ |
5449 |
+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && |
5450 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
5451 |
+index bf091a6c0cd2d..1a7aa078f3510 100644 |
5452 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
5453 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
5454 |
+@@ -147,8 +147,12 @@ static void cmd_ent_put(struct mlx5_cmd_work_ent *ent) |
5455 |
+ if (!refcount_dec_and_test(&ent->refcnt)) |
5456 |
+ return; |
5457 |
+ |
5458 |
+- if (ent->idx >= 0) |
5459 |
+- cmd_free_index(ent->cmd, ent->idx); |
5460 |
++ if (ent->idx >= 0) { |
5461 |
++ struct mlx5_cmd *cmd = ent->cmd; |
5462 |
++ |
5463 |
++ cmd_free_index(cmd, ent->idx); |
5464 |
++ up(ent->page_queue ? &cmd->pages_sem : &cmd->sem); |
5465 |
++ } |
5466 |
+ |
5467 |
+ cmd_free_ent(ent); |
5468 |
+ } |
5469 |
+@@ -883,25 +887,6 @@ static bool opcode_allowed(struct mlx5_cmd *cmd, u16 opcode) |
5470 |
+ return cmd->allowed_opcode == opcode; |
5471 |
+ } |
5472 |
+ |
5473 |
+-static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) |
5474 |
+-{ |
5475 |
+- unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); |
5476 |
+- int idx; |
5477 |
+- |
5478 |
+-retry: |
5479 |
+- idx = cmd_alloc_index(cmd); |
5480 |
+- if (idx < 0 && time_before(jiffies, alloc_end)) { |
5481 |
+- /* Index allocation can fail on heavy load of commands. This is a temporary |
5482 |
+- * situation as the current command already holds the semaphore, meaning that |
5483 |
+- * another command completion is being handled and it is expected to release |
5484 |
+- * the entry index soon. |
5485 |
+- */ |
5486 |
+- cpu_relax(); |
5487 |
+- goto retry; |
5488 |
+- } |
5489 |
+- return idx; |
5490 |
+-} |
5491 |
+- |
5492 |
+ static void cmd_work_handler(struct work_struct *work) |
5493 |
+ { |
5494 |
+ struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); |
5495 |
+@@ -919,7 +904,7 @@ static void cmd_work_handler(struct work_struct *work) |
5496 |
+ sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; |
5497 |
+ down(sem); |
5498 |
+ if (!ent->page_queue) { |
5499 |
+- alloc_ret = cmd_alloc_index_retry(cmd); |
5500 |
++ alloc_ret = cmd_alloc_index(cmd); |
5501 |
+ if (alloc_ret < 0) { |
5502 |
+ mlx5_core_err(dev, "failed to allocate command entry\n"); |
5503 |
+ if (ent->callback) { |
5504 |
+@@ -1577,8 +1562,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force |
5505 |
+ vector = vec & 0xffffffff; |
5506 |
+ for (i = 0; i < (1 << cmd->log_sz); i++) { |
5507 |
+ if (test_bit(i, &vector)) { |
5508 |
+- struct semaphore *sem; |
5509 |
+- |
5510 |
+ ent = cmd->ent_arr[i]; |
5511 |
+ |
5512 |
+ /* if we already completed the command, ignore it */ |
5513 |
+@@ -1601,10 +1584,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force |
5514 |
+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) |
5515 |
+ cmd_ent_put(ent); |
5516 |
+ |
5517 |
+- if (ent->page_queue) |
5518 |
+- sem = &cmd->pages_sem; |
5519 |
+- else |
5520 |
+- sem = &cmd->sem; |
5521 |
+ ent->ts2 = ktime_get_ns(); |
5522 |
+ memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); |
5523 |
+ dump_command(dev, ent, 0); |
5524 |
+@@ -1658,7 +1637,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force |
5525 |
+ */ |
5526 |
+ complete(&ent->done); |
5527 |
+ } |
5528 |
+- up(sem); |
5529 |
+ } |
5530 |
+ } |
5531 |
+ } |
5532 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
5533 |
+index dea884c94568c..2465165cbea73 100644 |
5534 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
5535 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
5536 |
+@@ -5053,9 +5053,13 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) |
5537 |
+ } |
5538 |
+ |
5539 |
+ if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { |
5540 |
+- netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; |
5541 |
+- netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; |
5542 |
+- netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL; |
5543 |
++ netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | |
5544 |
++ NETIF_F_GSO_UDP_TUNNEL_CSUM; |
5545 |
++ netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL | |
5546 |
++ NETIF_F_GSO_UDP_TUNNEL_CSUM; |
5547 |
++ netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; |
5548 |
++ netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL | |
5549 |
++ NETIF_F_GSO_UDP_TUNNEL_CSUM; |
5550 |
+ } |
5551 |
+ |
5552 |
+ if (mlx5e_tunnel_proto_supported(mdev, IPPROTO_GRE)) { |
5553 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c b/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c |
5554 |
+index bdc7f915d80e3..101667c6b5843 100644 |
5555 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c |
5556 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c |
5557 |
+@@ -265,10 +265,8 @@ static int mlx5_lag_fib_event(struct notifier_block *nb, |
5558 |
+ fen_info = container_of(info, struct fib_entry_notifier_info, |
5559 |
+ info); |
5560 |
+ fi = fen_info->fi; |
5561 |
+- if (fi->nh) { |
5562 |
+- NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported"); |
5563 |
+- return notifier_from_errno(-EINVAL); |
5564 |
+- } |
5565 |
++ if (fi->nh) |
5566 |
++ return NOTIFY_DONE; |
5567 |
+ fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev; |
5568 |
+ if (fib_dev != ldev->pf[0].netdev && |
5569 |
+ fib_dev != ldev->pf[1].netdev) { |
5570 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
5571 |
+index aa4fef7890841..ff331251a019a 100644 |
5572 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c |
5573 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
5574 |
+@@ -1876,6 +1876,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) |
5575 |
+ { |
5576 |
+ pci_driver->probe = mlxsw_pci_probe; |
5577 |
+ pci_driver->remove = mlxsw_pci_remove; |
5578 |
++ pci_driver->shutdown = mlxsw_pci_remove; |
5579 |
+ return pci_register_driver(pci_driver); |
5580 |
+ } |
5581 |
+ EXPORT_SYMBOL(mlxsw_pci_driver_register); |
5582 |
+diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c |
5583 |
+index 7072b249c8bd6..8157666209798 100644 |
5584 |
+--- a/drivers/net/ethernet/rocker/rocker_ofdpa.c |
5585 |
++++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c |
5586 |
+@@ -2795,7 +2795,8 @@ static void ofdpa_fib4_abort(struct rocker *rocker) |
5587 |
+ if (!ofdpa_port) |
5588 |
+ continue; |
5589 |
+ nh->fib_nh_flags &= ~RTNH_F_OFFLOAD; |
5590 |
+- ofdpa_flow_tbl_del(ofdpa_port, OFDPA_OP_FLAG_REMOVE, |
5591 |
++ ofdpa_flow_tbl_del(ofdpa_port, |
5592 |
++ OFDPA_OP_FLAG_REMOVE | OFDPA_OP_FLAG_NOWAIT, |
5593 |
+ flow_entry); |
5594 |
+ } |
5595 |
+ spin_unlock_irqrestore(&ofdpa->flow_tbl_lock, flags); |
5596 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
5597 |
+index f98318d93ce72..0ef806ea18327 100644 |
5598 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
5599 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
5600 |
+@@ -41,8 +41,9 @@ |
5601 |
+ #include "xilinx_axienet.h" |
5602 |
+ |
5603 |
+ /* Descriptors defines for Tx and Rx DMA */ |
5604 |
+-#define TX_BD_NUM_DEFAULT 64 |
5605 |
++#define TX_BD_NUM_DEFAULT 128 |
5606 |
+ #define RX_BD_NUM_DEFAULT 1024 |
5607 |
++#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) |
5608 |
+ #define TX_BD_NUM_MAX 4096 |
5609 |
+ #define RX_BD_NUM_MAX 4096 |
5610 |
+ |
5611 |
+@@ -635,7 +636,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
5612 |
+ num_frag = skb_shinfo(skb)->nr_frags; |
5613 |
+ cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; |
5614 |
+ |
5615 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) { |
5616 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) { |
5617 |
+ if (netif_queue_stopped(ndev)) |
5618 |
+ return NETDEV_TX_BUSY; |
5619 |
+ |
5620 |
+@@ -645,7 +646,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
5621 |
+ smp_mb(); |
5622 |
+ |
5623 |
+ /* Space might have just been freed - check again */ |
5624 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) |
5625 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) |
5626 |
+ return NETDEV_TX_BUSY; |
5627 |
+ |
5628 |
+ netif_wake_queue(ndev); |
5629 |
+@@ -1223,7 +1224,8 @@ static int axienet_ethtools_set_ringparam(struct net_device *ndev, |
5630 |
+ if (ering->rx_pending > RX_BD_NUM_MAX || |
5631 |
+ ering->rx_mini_pending || |
5632 |
+ ering->rx_jumbo_pending || |
5633 |
+- ering->rx_pending > TX_BD_NUM_MAX) |
5634 |
++ ering->tx_pending < TX_BD_NUM_MIN || |
5635 |
++ ering->tx_pending > TX_BD_NUM_MAX) |
5636 |
+ return -EINVAL; |
5637 |
+ |
5638 |
+ if (netif_running(ndev)) |
5639 |
+diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
5640 |
+index 9dbe625ad4477..a69317e944229 100644 |
5641 |
+--- a/drivers/net/phy/marvell.c |
5642 |
++++ b/drivers/net/phy/marvell.c |
5643 |
+@@ -917,6 +917,12 @@ static int m88e1118_config_init(struct phy_device *phydev) |
5644 |
+ if (err < 0) |
5645 |
+ return err; |
5646 |
+ |
5647 |
++ if (phy_interface_is_rgmii(phydev)) { |
5648 |
++ err = m88e1121_config_aneg_rgmii_delays(phydev); |
5649 |
++ if (err < 0) |
5650 |
++ return err; |
5651 |
++ } |
5652 |
++ |
5653 |
+ /* Adjust LED Control */ |
5654 |
+ if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) |
5655 |
+ err = phy_write(phydev, 0x10, 0x1100); |
5656 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
5657 |
+index bec73f0640d03..b0a439248ff69 100644 |
5658 |
+--- a/drivers/net/phy/mdio_bus.c |
5659 |
++++ b/drivers/net/phy/mdio_bus.c |
5660 |
+@@ -433,7 +433,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) |
5661 |
+ mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); |
5662 |
+ |
5663 |
+ bus->state = MDIOBUS_REGISTERED; |
5664 |
+- pr_info("%s: probed\n", bus->name); |
5665 |
++ dev_dbg(&bus->dev, "probed\n"); |
5666 |
+ return 0; |
5667 |
+ |
5668 |
+ error: |
5669 |
+diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c |
5670 |
+index 9412669b579c7..84064120918f0 100644 |
5671 |
+--- a/drivers/net/phy/phy-core.c |
5672 |
++++ b/drivers/net/phy/phy-core.c |
5673 |
+@@ -128,11 +128,11 @@ static const struct phy_setting settings[] = { |
5674 |
+ PHY_SETTING( 2500, FULL, 2500baseT_Full ), |
5675 |
+ PHY_SETTING( 2500, FULL, 2500baseX_Full ), |
5676 |
+ /* 1G */ |
5677 |
+- PHY_SETTING( 1000, FULL, 1000baseKX_Full ), |
5678 |
+ PHY_SETTING( 1000, FULL, 1000baseT_Full ), |
5679 |
+ PHY_SETTING( 1000, HALF, 1000baseT_Half ), |
5680 |
+ PHY_SETTING( 1000, FULL, 1000baseT1_Full ), |
5681 |
+ PHY_SETTING( 1000, FULL, 1000baseX_Full ), |
5682 |
++ PHY_SETTING( 1000, FULL, 1000baseKX_Full ), |
5683 |
+ /* 100M */ |
5684 |
+ PHY_SETTING( 100, FULL, 100baseT_Full ), |
5685 |
+ PHY_SETTING( 100, FULL, 100baseT1_Full ), |
5686 |
+diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c |
5687 |
+index c6c41a7836c93..a085213dc2eaa 100644 |
5688 |
+--- a/drivers/net/ppp/ppp_generic.c |
5689 |
++++ b/drivers/net/ppp/ppp_generic.c |
5690 |
+@@ -69,6 +69,8 @@ |
5691 |
+ #define MPHDRLEN 6 /* multilink protocol header length */ |
5692 |
+ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ |
5693 |
+ |
5694 |
++#define PPP_PROTO_LEN 2 |
5695 |
++ |
5696 |
+ /* |
5697 |
+ * An instance of /dev/ppp can be associated with either a ppp |
5698 |
+ * interface unit or a ppp channel. In both cases, file->private_data |
5699 |
+@@ -498,6 +500,9 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, |
5700 |
+ |
5701 |
+ if (!pf) |
5702 |
+ return -ENXIO; |
5703 |
++ /* All PPP packets should start with the 2-byte protocol */ |
5704 |
++ if (count < PPP_PROTO_LEN) |
5705 |
++ return -EINVAL; |
5706 |
+ ret = -ENOMEM; |
5707 |
+ skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); |
5708 |
+ if (!skb) |
5709 |
+@@ -1544,7 +1549,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) |
5710 |
+ } |
5711 |
+ |
5712 |
+ ++ppp->stats64.tx_packets; |
5713 |
+- ppp->stats64.tx_bytes += skb->len - 2; |
5714 |
++ ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; |
5715 |
+ |
5716 |
+ switch (proto) { |
5717 |
+ case PPP_IP: |
5718 |
+diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c |
5719 |
+index 09bfa6a4dfbc1..7e40e2e2f3723 100644 |
5720 |
+--- a/drivers/net/usb/mcs7830.c |
5721 |
++++ b/drivers/net/usb/mcs7830.c |
5722 |
+@@ -108,8 +108,16 @@ static const char driver_name[] = "MOSCHIP usb-ethernet driver"; |
5723 |
+ |
5724 |
+ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) |
5725 |
+ { |
5726 |
+- return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
5727 |
+- 0x0000, index, data, size); |
5728 |
++ int ret; |
5729 |
++ |
5730 |
++ ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
5731 |
++ 0x0000, index, data, size); |
5732 |
++ if (ret < 0) |
5733 |
++ return ret; |
5734 |
++ else if (ret < size) |
5735 |
++ return -ENODATA; |
5736 |
++ |
5737 |
++ return ret; |
5738 |
+ } |
5739 |
+ |
5740 |
+ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) |
5741 |
+diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c |
5742 |
+index 4c57e79e5779a..58e189ec672f9 100644 |
5743 |
+--- a/drivers/net/wireless/ath/ar5523/ar5523.c |
5744 |
++++ b/drivers/net/wireless/ath/ar5523/ar5523.c |
5745 |
+@@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) |
5746 |
+ ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); |
5747 |
+ return; |
5748 |
+ } |
5749 |
++ if (!cmd->odata) { |
5750 |
++ ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); |
5751 |
++ return; |
5752 |
++ } |
5753 |
+ memcpy(cmd->odata, hdr + 1, sizeof(u32)); |
5754 |
+ cmd->olen = sizeof(u32); |
5755 |
+ cmd->res = 0; |
5756 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c |
5757 |
+index c38e1963ebc05..f73ed1044390c 100644 |
5758 |
+--- a/drivers/net/wireless/ath/ath10k/htt_tx.c |
5759 |
++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c |
5760 |
+@@ -147,6 +147,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) |
5761 |
+ htt->num_pending_tx--; |
5762 |
+ if (htt->num_pending_tx == htt->max_num_pending_tx - 1) |
5763 |
+ ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); |
5764 |
++ |
5765 |
++ if (htt->num_pending_tx == 0) |
5766 |
++ wake_up(&htt->empty_tx_wq); |
5767 |
+ } |
5768 |
+ |
5769 |
+ int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) |
5770 |
+diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c |
5771 |
+index f46b9083bbf10..2c254f43790d2 100644 |
5772 |
+--- a/drivers/net/wireless/ath/ath10k/txrx.c |
5773 |
++++ b/drivers/net/wireless/ath/ath10k/txrx.c |
5774 |
+@@ -80,8 +80,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
5775 |
+ |
5776 |
+ ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); |
5777 |
+ ath10k_htt_tx_dec_pending(htt); |
5778 |
+- if (htt->num_pending_tx == 0) |
5779 |
+- wake_up(&htt->empty_tx_wq); |
5780 |
+ spin_unlock_bh(&htt->tx_lock); |
5781 |
+ |
5782 |
+ rcu_read_lock(); |
5783 |
+diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
5784 |
+index 2ed98aaed6fb5..c8c7afe0e343e 100644 |
5785 |
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
5786 |
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
5787 |
+@@ -590,6 +590,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, |
5788 |
+ return; |
5789 |
+ } |
5790 |
+ |
5791 |
++ if (pkt_len > 2 * MAX_RX_BUF_SIZE) { |
5792 |
++ dev_err(&hif_dev->udev->dev, |
5793 |
++ "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); |
5794 |
++ RX_STAT_INC(skb_dropped); |
5795 |
++ return; |
5796 |
++ } |
5797 |
++ |
5798 |
+ pad_len = 4 - (pkt_len & 0x3); |
5799 |
+ if (pad_len == 4) |
5800 |
+ pad_len = 0; |
5801 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c |
5802 |
+index 4da25e84793b7..c400261352bc8 100644 |
5803 |
+--- a/drivers/net/wireless/ath/wcn36xx/dxe.c |
5804 |
++++ b/drivers/net/wireless/ath/wcn36xx/dxe.c |
5805 |
+@@ -952,4 +952,9 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) |
5806 |
+ |
5807 |
+ wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); |
5808 |
+ wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); |
5809 |
++ |
5810 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_l_ch); |
5811 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_h_ch); |
5812 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_l_ch); |
5813 |
++ wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_h_ch); |
5814 |
+ } |
5815 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c |
5816 |
+index a7532028bf9db..74cf173c186ff 100644 |
5817 |
+--- a/drivers/net/wireless/ath/wcn36xx/smd.c |
5818 |
++++ b/drivers/net/wireless/ath/wcn36xx/smd.c |
5819 |
+@@ -2311,7 +2311,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, |
5820 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", |
5821 |
+ tmp->bss_index); |
5822 |
+ vif = wcn36xx_priv_to_vif(tmp); |
5823 |
+- ieee80211_connection_loss(vif); |
5824 |
++ ieee80211_beacon_loss(vif); |
5825 |
+ } |
5826 |
+ return 0; |
5827 |
+ } |
5828 |
+@@ -2326,7 +2326,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, |
5829 |
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", |
5830 |
+ rsp->bss_index); |
5831 |
+ vif = wcn36xx_priv_to_vif(tmp); |
5832 |
+- ieee80211_connection_loss(vif); |
5833 |
++ ieee80211_beacon_loss(vif); |
5834 |
+ return 0; |
5835 |
+ } |
5836 |
+ } |
5837 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
5838 |
+index e68366f248fe3..83cb2ad03451b 100644 |
5839 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
5840 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
5841 |
+@@ -183,6 +183,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) |
5842 |
+ |
5843 |
+ for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) |
5844 |
+ iwl_free_fw_img(drv, drv->fw.img + i); |
5845 |
++ |
5846 |
++ /* clear the data for the aborted load case */ |
5847 |
++ memset(&drv->fw, 0, sizeof(drv->fw)); |
5848 |
+ } |
5849 |
+ |
5850 |
+ static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, |
5851 |
+@@ -1338,6 +1341,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
5852 |
+ int i; |
5853 |
+ bool load_module = false; |
5854 |
+ bool usniffer_images = false; |
5855 |
++ bool failure = true; |
5856 |
+ |
5857 |
+ fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH; |
5858 |
+ fw->ucode_capa.standard_phy_calibration_size = |
5859 |
+@@ -1595,15 +1599,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
5860 |
+ * else from proceeding if the module fails to load |
5861 |
+ * or hangs loading. |
5862 |
+ */ |
5863 |
+- if (load_module) { |
5864 |
++ if (load_module) |
5865 |
+ request_module("%s", op->name); |
5866 |
+-#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR |
5867 |
+- if (err) |
5868 |
+- IWL_ERR(drv, |
5869 |
+- "failed to load module %s (error %d), is dynamic loading enabled?\n", |
5870 |
+- op->name, err); |
5871 |
+-#endif |
5872 |
+- } |
5873 |
++ failure = false; |
5874 |
+ goto free; |
5875 |
+ |
5876 |
+ try_again: |
5877 |
+@@ -1619,6 +1617,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
5878 |
+ complete(&drv->request_firmware_complete); |
5879 |
+ device_release_driver(drv->trans->dev); |
5880 |
+ free: |
5881 |
++ if (failure) |
5882 |
++ iwl_dealloc_ucode(drv); |
5883 |
++ |
5884 |
+ if (pieces) { |
5885 |
+ for (i = 0; i < ARRAY_SIZE(pieces->img); i++) |
5886 |
+ kfree(pieces->img[i].sec); |
5887 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5888 |
+index c942255aa1dbc..29ad7804d77aa 100644 |
5889 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5890 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5891 |
+@@ -1696,6 +1696,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
5892 |
+ struct iwl_mvm_mc_iter_data iter_data = { |
5893 |
+ .mvm = mvm, |
5894 |
+ }; |
5895 |
++ int ret; |
5896 |
+ |
5897 |
+ lockdep_assert_held(&mvm->mutex); |
5898 |
+ |
5899 |
+@@ -1705,6 +1706,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
5900 |
+ ieee80211_iterate_active_interfaces_atomic( |
5901 |
+ mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
5902 |
+ iwl_mvm_mc_iface_iterator, &iter_data); |
5903 |
++ |
5904 |
++ /* |
5905 |
++ * Send a (synchronous) ech command so that we wait for the |
5906 |
++ * multiple asynchronous MCAST_FILTER_CMD commands sent by |
5907 |
++ * the interface iterator. Otherwise, we might get here over |
5908 |
++ * and over again (by userspace just sending a lot of these) |
5909 |
++ * and the CPU can send them faster than the firmware can |
5910 |
++ * process them. |
5911 |
++ * Note that the CPU is still faster - but with this we'll |
5912 |
++ * actually send fewer commands overall because the CPU will |
5913 |
++ * not schedule the work in mac80211 as frequently if it's |
5914 |
++ * still running when rescheduled (possibly multiple times). |
5915 |
++ */ |
5916 |
++ ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); |
5917 |
++ if (ret) |
5918 |
++ IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); |
5919 |
+ } |
5920 |
+ |
5921 |
+ static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, |
5922 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
5923 |
+index a6e2a30eb3109..52c6edc621ced 100644 |
5924 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
5925 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c |
5926 |
+@@ -177,12 +177,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb, |
5927 |
+ struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; |
5928 |
+ unsigned int headlen, fraglen, pad_len = 0; |
5929 |
+ unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
5930 |
++ u8 mic_crc_len = u8_get_bits(desc->mac_flags1, |
5931 |
++ IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK) << 1; |
5932 |
+ |
5933 |
+ if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) { |
5934 |
+ len -= 2; |
5935 |
+ pad_len = 2; |
5936 |
+ } |
5937 |
+ |
5938 |
++ /* |
5939 |
++ * For non monitor interface strip the bytes the RADA might not have |
5940 |
++ * removed. As monitor interface cannot exist with other interfaces |
5941 |
++ * this removal is safe. |
5942 |
++ */ |
5943 |
++ if (mic_crc_len && !ieee80211_hw_check(mvm->hw, RX_INCLUDES_FCS)) { |
5944 |
++ u32 pkt_flags = le32_to_cpu(pkt->len_n_flags); |
5945 |
++ |
5946 |
++ /* |
5947 |
++ * If RADA was not enabled then decryption was not performed so |
5948 |
++ * the MIC cannot be removed. |
5949 |
++ */ |
5950 |
++ if (!(pkt_flags & FH_RSCSR_RADA_EN)) { |
5951 |
++ if (WARN_ON(crypt_len > mic_crc_len)) |
5952 |
++ return -EINVAL; |
5953 |
++ |
5954 |
++ mic_crc_len -= crypt_len; |
5955 |
++ } |
5956 |
++ |
5957 |
++ if (WARN_ON(mic_crc_len > len)) |
5958 |
++ return -EINVAL; |
5959 |
++ |
5960 |
++ len -= mic_crc_len; |
5961 |
++ } |
5962 |
++ |
5963 |
+ /* If frame is small enough to fit in skb->head, pull it completely. |
5964 |
+ * If not, only pull ieee80211_hdr (including crypto if present, and |
5965 |
+ * an additional 8 bytes for SNAP/ethertype, see below) so that |
5966 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
5967 |
+index 8aa567d7912c2..3a58267d3d710 100644 |
5968 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
5969 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c |
5970 |
+@@ -1700,7 +1700,7 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) |
5971 |
+ return -EIO; |
5972 |
+ } |
5973 |
+ |
5974 |
+-#define SCAN_TIMEOUT 20000 |
5975 |
++#define SCAN_TIMEOUT 30000 |
5976 |
+ |
5977 |
+ void iwl_mvm_scan_timeout_wk(struct work_struct *work) |
5978 |
+ { |
5979 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c |
5980 |
+index 5fdffb114913d..fd12093863801 100644 |
5981 |
+--- a/drivers/net/wireless/marvell/mwifiex/sta_event.c |
5982 |
++++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c |
5983 |
+@@ -364,10 +364,12 @@ static void mwifiex_process_uap_tx_pause(struct mwifiex_private *priv, |
5984 |
+ sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac); |
5985 |
+ if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) { |
5986 |
+ sta_ptr->tx_pause = tp->tx_pause; |
5987 |
++ spin_unlock_bh(&priv->sta_list_spinlock); |
5988 |
+ mwifiex_update_ralist_tx_pause(priv, tp->peermac, |
5989 |
+ tp->tx_pause); |
5990 |
++ } else { |
5991 |
++ spin_unlock_bh(&priv->sta_list_spinlock); |
5992 |
+ } |
5993 |
+- spin_unlock_bh(&priv->sta_list_spinlock); |
5994 |
+ } |
5995 |
+ } |
5996 |
+ |
5997 |
+@@ -399,11 +401,13 @@ static void mwifiex_process_sta_tx_pause(struct mwifiex_private *priv, |
5998 |
+ sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac); |
5999 |
+ if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) { |
6000 |
+ sta_ptr->tx_pause = tp->tx_pause; |
6001 |
++ spin_unlock_bh(&priv->sta_list_spinlock); |
6002 |
+ mwifiex_update_ralist_tx_pause(priv, |
6003 |
+ tp->peermac, |
6004 |
+ tp->tx_pause); |
6005 |
++ } else { |
6006 |
++ spin_unlock_bh(&priv->sta_list_spinlock); |
6007 |
+ } |
6008 |
+- spin_unlock_bh(&priv->sta_list_spinlock); |
6009 |
+ } |
6010 |
+ } |
6011 |
+ } |
6012 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c |
6013 |
+index cb8a9ad40cfe9..39cf713d5054c 100644 |
6014 |
+--- a/drivers/net/wireless/marvell/mwifiex/usb.c |
6015 |
++++ b/drivers/net/wireless/marvell/mwifiex/usb.c |
6016 |
+@@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, |
6017 |
+ default: |
6018 |
+ mwifiex_dbg(adapter, ERROR, |
6019 |
+ "unknown recv_type %#x\n", recv_type); |
6020 |
+- return -1; |
6021 |
++ ret = -1; |
6022 |
++ goto exit_restore_skb; |
6023 |
+ } |
6024 |
+ break; |
6025 |
+ case MWIFIEX_USB_EP_DATA: |
6026 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c |
6027 |
+index 441fda71f6289..d92337169ee3a 100644 |
6028 |
+--- a/drivers/net/wireless/rsi/rsi_91x_main.c |
6029 |
++++ b/drivers/net/wireless/rsi/rsi_91x_main.c |
6030 |
+@@ -23,6 +23,7 @@ |
6031 |
+ #include "rsi_common.h" |
6032 |
+ #include "rsi_coex.h" |
6033 |
+ #include "rsi_hal.h" |
6034 |
++#include "rsi_usb.h" |
6035 |
+ |
6036 |
+ u32 rsi_zone_enabled = /* INFO_ZONE | |
6037 |
+ INIT_ZONE | |
6038 |
+@@ -167,6 +168,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len) |
6039 |
+ frame_desc = &rx_pkt[index]; |
6040 |
+ actual_length = *(u16 *)&frame_desc[0]; |
6041 |
+ offset = *(u16 *)&frame_desc[2]; |
6042 |
++ if (!rcv_pkt_len && offset > |
6043 |
++ RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) |
6044 |
++ goto fail; |
6045 |
+ |
6046 |
+ queueno = rsi_get_queueno(frame_desc, offset); |
6047 |
+ length = rsi_get_length(frame_desc, offset); |
6048 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c |
6049 |
+index 68ce3d2bc5357..94bf2a7ca635d 100644 |
6050 |
+--- a/drivers/net/wireless/rsi/rsi_91x_usb.c |
6051 |
++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c |
6052 |
+@@ -261,8 +261,12 @@ static void rsi_rx_done_handler(struct urb *urb) |
6053 |
+ struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data; |
6054 |
+ int status = -EINVAL; |
6055 |
+ |
6056 |
++ if (!rx_cb->rx_skb) |
6057 |
++ return; |
6058 |
++ |
6059 |
+ if (urb->status) { |
6060 |
+ dev_kfree_skb(rx_cb->rx_skb); |
6061 |
++ rx_cb->rx_skb = NULL; |
6062 |
+ return; |
6063 |
+ } |
6064 |
+ |
6065 |
+@@ -286,8 +290,10 @@ out: |
6066 |
+ if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) |
6067 |
+ rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); |
6068 |
+ |
6069 |
+- if (status) |
6070 |
++ if (status) { |
6071 |
+ dev_kfree_skb(rx_cb->rx_skb); |
6072 |
++ rx_cb->rx_skb = NULL; |
6073 |
++ } |
6074 |
+ } |
6075 |
+ |
6076 |
+ static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) |
6077 |
+@@ -314,7 +320,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) |
6078 |
+ struct sk_buff *skb; |
6079 |
+ u8 dword_align_bytes = 0; |
6080 |
+ |
6081 |
+-#define RSI_MAX_RX_USB_PKT_SIZE 3000 |
6082 |
+ skb = dev_alloc_skb(RSI_MAX_RX_USB_PKT_SIZE); |
6083 |
+ if (!skb) |
6084 |
+ return -ENOMEM; |
6085 |
+diff --git a/drivers/net/wireless/rsi/rsi_usb.h b/drivers/net/wireless/rsi/rsi_usb.h |
6086 |
+index 8702f434b5699..ad88f8c70a351 100644 |
6087 |
+--- a/drivers/net/wireless/rsi/rsi_usb.h |
6088 |
++++ b/drivers/net/wireless/rsi/rsi_usb.h |
6089 |
+@@ -44,6 +44,8 @@ |
6090 |
+ #define RSI_USB_BUF_SIZE 4096 |
6091 |
+ #define RSI_USB_CTRL_BUF_SIZE 0x04 |
6092 |
+ |
6093 |
++#define RSI_MAX_RX_USB_PKT_SIZE 3000 |
6094 |
++ |
6095 |
+ struct rx_usb_ctrl_block { |
6096 |
+ u8 *data; |
6097 |
+ struct urb *rx_urb; |
6098 |
+diff --git a/drivers/of/base.c b/drivers/of/base.c |
6099 |
+index 1d667eb730e19..b5c84607a74bf 100644 |
6100 |
+--- a/drivers/of/base.c |
6101 |
++++ b/drivers/of/base.c |
6102 |
+@@ -1366,9 +1366,14 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it) |
6103 |
+ * property data length |
6104 |
+ */ |
6105 |
+ if (it->cur + count > it->list_end) { |
6106 |
+- pr_err("%pOF: %s = %d found %d\n", |
6107 |
+- it->parent, it->cells_name, |
6108 |
+- count, it->cell_count); |
6109 |
++ if (it->cells_name) |
6110 |
++ pr_err("%pOF: %s = %d found %td\n", |
6111 |
++ it->parent, it->cells_name, |
6112 |
++ count, it->list_end - it->cur); |
6113 |
++ else |
6114 |
++ pr_err("%pOF: phandle %s needs %d, found %td\n", |
6115 |
++ it->parent, of_node_full_name(it->node), |
6116 |
++ count, it->list_end - it->cur); |
6117 |
+ goto err; |
6118 |
+ } |
6119 |
+ } |
6120 |
+diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c |
6121 |
+index e090978518f1a..4760f82def6ec 100644 |
6122 |
+--- a/drivers/parisc/pdc_stable.c |
6123 |
++++ b/drivers/parisc/pdc_stable.c |
6124 |
+@@ -979,8 +979,10 @@ pdcs_register_pathentries(void) |
6125 |
+ entry->kobj.kset = paths_kset; |
6126 |
+ err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, |
6127 |
+ "%s", entry->name); |
6128 |
+- if (err) |
6129 |
++ if (err) { |
6130 |
++ kobject_put(&entry->kobj); |
6131 |
+ return err; |
6132 |
++ } |
6133 |
+ |
6134 |
+ /* kobject is now registered */ |
6135 |
+ write_lock(&entry->rw_lock); |
6136 |
+diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
6137 |
+index 9e208294946cd..d2f8cd3a9568b 100644 |
6138 |
+--- a/drivers/pci/controller/pci-aardvark.c |
6139 |
++++ b/drivers/pci/controller/pci-aardvark.c |
6140 |
+@@ -863,7 +863,6 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, |
6141 |
+ return PCI_BRIDGE_EMUL_HANDLED; |
6142 |
+ } |
6143 |
+ |
6144 |
+- case PCI_CAP_LIST_ID: |
6145 |
+ case PCI_EXP_DEVCAP: |
6146 |
+ case PCI_EXP_DEVCTL: |
6147 |
+ *value = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); |
6148 |
+@@ -944,6 +943,9 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) |
6149 |
+ /* Support interrupt A for MSI feature */ |
6150 |
+ bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE; |
6151 |
+ |
6152 |
++ /* Aardvark HW provides PCIe Capability structure in version 2 */ |
6153 |
++ bridge->pcie_conf.cap = cpu_to_le16(2); |
6154 |
++ |
6155 |
+ /* Indicates supports for Completion Retry Status */ |
6156 |
+ bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); |
6157 |
+ |
6158 |
+diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c |
6159 |
+index 5a2483e125a3f..09af97083ac09 100644 |
6160 |
+--- a/drivers/pci/controller/pci-mvebu.c |
6161 |
++++ b/drivers/pci/controller/pci-mvebu.c |
6162 |
+@@ -576,6 +576,8 @@ struct pci_bridge_emul_ops mvebu_pci_bridge_emul_ops = { |
6163 |
+ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) |
6164 |
+ { |
6165 |
+ struct pci_bridge_emul *bridge = &port->bridge; |
6166 |
++ u32 pcie_cap = mvebu_readl(port, PCIE_CAP_PCIEXP); |
6167 |
++ u8 pcie_cap_ver = ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); |
6168 |
+ |
6169 |
+ bridge->conf.vendor = PCI_VENDOR_ID_MARVELL; |
6170 |
+ bridge->conf.device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; |
6171 |
+@@ -588,6 +590,12 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) |
6172 |
+ bridge->conf.iolimit = PCI_IO_RANGE_TYPE_32; |
6173 |
+ } |
6174 |
+ |
6175 |
++ /* |
6176 |
++ * Older mvebu hardware provides PCIe Capability structure only in |
6177 |
++ * version 1. New hardware provides it in version 2. |
6178 |
++ */ |
6179 |
++ bridge->pcie_conf.cap = cpu_to_le16(pcie_cap_ver); |
6180 |
++ |
6181 |
+ bridge->has_pcie = true; |
6182 |
+ bridge->data = port; |
6183 |
+ bridge->ops = &mvebu_pci_bridge_emul_ops; |
6184 |
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c |
6185 |
+index 7dc10c2b4785d..715c85d4e688d 100644 |
6186 |
+--- a/drivers/pci/msi.c |
6187 |
++++ b/drivers/pci/msi.c |
6188 |
+@@ -1294,19 +1294,24 @@ EXPORT_SYMBOL(pci_free_irq_vectors); |
6189 |
+ |
6190 |
+ /** |
6191 |
+ * pci_irq_vector - return Linux IRQ number of a device vector |
6192 |
+- * @dev: PCI device to operate on |
6193 |
+- * @nr: device-relative interrupt vector index (0-based). |
6194 |
++ * @dev: PCI device to operate on |
6195 |
++ * @nr: Interrupt vector index (0-based) |
6196 |
++ * |
6197 |
++ * @nr has the following meanings depending on the interrupt mode: |
6198 |
++ * MSI-X: The index in the MSI-X vector table |
6199 |
++ * MSI: The index of the enabled MSI vectors |
6200 |
++ * INTx: Must be 0 |
6201 |
++ * |
6202 |
++ * Return: The Linux interrupt number or -EINVAl if @nr is out of range. |
6203 |
+ */ |
6204 |
+ int pci_irq_vector(struct pci_dev *dev, unsigned int nr) |
6205 |
+ { |
6206 |
+ if (dev->msix_enabled) { |
6207 |
+ struct msi_desc *entry; |
6208 |
+- int i = 0; |
6209 |
+ |
6210 |
+ for_each_pci_msi_entry(entry, dev) { |
6211 |
+- if (i == nr) |
6212 |
++ if (entry->msi_attrib.entry_nr == nr) |
6213 |
+ return entry->irq; |
6214 |
+- i++; |
6215 |
+ } |
6216 |
+ WARN_ON_ONCE(1); |
6217 |
+ return -EINVAL; |
6218 |
+@@ -1330,17 +1335,22 @@ EXPORT_SYMBOL(pci_irq_vector); |
6219 |
+ * pci_irq_get_affinity - return the affinity of a particular MSI vector |
6220 |
+ * @dev: PCI device to operate on |
6221 |
+ * @nr: device-relative interrupt vector index (0-based). |
6222 |
++ * |
6223 |
++ * @nr has the following meanings depending on the interrupt mode: |
6224 |
++ * MSI-X: The index in the MSI-X vector table |
6225 |
++ * MSI: The index of the enabled MSI vectors |
6226 |
++ * INTx: Must be 0 |
6227 |
++ * |
6228 |
++ * Return: A cpumask pointer or NULL if @nr is out of range |
6229 |
+ */ |
6230 |
+ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) |
6231 |
+ { |
6232 |
+ if (dev->msix_enabled) { |
6233 |
+ struct msi_desc *entry; |
6234 |
+- int i = 0; |
6235 |
+ |
6236 |
+ for_each_pci_msi_entry(entry, dev) { |
6237 |
+- if (i == nr) |
6238 |
++ if (entry->msi_attrib.entry_nr == nr) |
6239 |
+ return &entry->affinity->mask; |
6240 |
+- i++; |
6241 |
+ } |
6242 |
+ WARN_ON_ONCE(1); |
6243 |
+ return NULL; |
6244 |
+diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c |
6245 |
+index 3026346ccb18c..0ca3b5eef53a7 100644 |
6246 |
+--- a/drivers/pci/pci-bridge-emul.c |
6247 |
++++ b/drivers/pci/pci-bridge-emul.c |
6248 |
+@@ -287,11 +287,9 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge, |
6249 |
+ |
6250 |
+ if (bridge->has_pcie) { |
6251 |
+ bridge->conf.capabilities_pointer = PCI_CAP_PCIE_START; |
6252 |
++ bridge->conf.status |= cpu_to_le16(PCI_STATUS_CAP_LIST); |
6253 |
+ bridge->pcie_conf.cap_id = PCI_CAP_ID_EXP; |
6254 |
+- /* Set PCIe v2, root port, slot support */ |
6255 |
+- bridge->pcie_conf.cap = |
6256 |
+- cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | |
6257 |
+- PCI_EXP_FLAGS_SLOT); |
6258 |
++ bridge->pcie_conf.cap |= cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); |
6259 |
+ bridge->pcie_cap_regs_behavior = |
6260 |
+ kmemdup(pcie_cap_regs_behavior, |
6261 |
+ sizeof(pcie_cap_regs_behavior), |
6262 |
+@@ -300,6 +298,27 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge, |
6263 |
+ kfree(bridge->pci_regs_behavior); |
6264 |
+ return -ENOMEM; |
6265 |
+ } |
6266 |
++ /* These bits are applicable only for PCI and reserved on PCIe */ |
6267 |
++ bridge->pci_regs_behavior[PCI_CACHE_LINE_SIZE / 4].ro &= |
6268 |
++ ~GENMASK(15, 8); |
6269 |
++ bridge->pci_regs_behavior[PCI_COMMAND / 4].ro &= |
6270 |
++ ~((PCI_COMMAND_SPECIAL | PCI_COMMAND_INVALIDATE | |
6271 |
++ PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_WAIT | |
6272 |
++ PCI_COMMAND_FAST_BACK) | |
6273 |
++ (PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | |
6274 |
++ PCI_STATUS_DEVSEL_MASK) << 16); |
6275 |
++ bridge->pci_regs_behavior[PCI_PRIMARY_BUS / 4].ro &= |
6276 |
++ ~GENMASK(31, 24); |
6277 |
++ bridge->pci_regs_behavior[PCI_IO_BASE / 4].ro &= |
6278 |
++ ~((PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | |
6279 |
++ PCI_STATUS_DEVSEL_MASK) << 16); |
6280 |
++ bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].rw &= |
6281 |
++ ~((PCI_BRIDGE_CTL_MASTER_ABORT | |
6282 |
++ BIT(8) | BIT(9) | BIT(11)) << 16); |
6283 |
++ bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].ro &= |
6284 |
++ ~((PCI_BRIDGE_CTL_FAST_BACK) << 16); |
6285 |
++ bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].w1c &= |
6286 |
++ ~(BIT(10) << 16); |
6287 |
+ } |
6288 |
+ |
6289 |
+ if (flags & PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR) { |
6290 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
6291 |
+index cf3986d4413f7..2a4bc8df85639 100644 |
6292 |
+--- a/drivers/pci/quirks.c |
6293 |
++++ b/drivers/pci/quirks.c |
6294 |
+@@ -4134,6 +4134,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120, |
6295 |
+ quirk_dma_func1_alias); |
6296 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, |
6297 |
+ quirk_dma_func1_alias); |
6298 |
++/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c136 */ |
6299 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, |
6300 |
++ quirk_dma_func1_alias); |
6301 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, |
6302 |
+ quirk_dma_func1_alias); |
6303 |
+ /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ |
6304 |
+diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c |
6305 |
+index e211e2619680c..f70197154a362 100644 |
6306 |
+--- a/drivers/pcmcia/cs.c |
6307 |
++++ b/drivers/pcmcia/cs.c |
6308 |
+@@ -666,18 +666,16 @@ static int pccardd(void *__skt) |
6309 |
+ if (events || sysfs_events) |
6310 |
+ continue; |
6311 |
+ |
6312 |
++ set_current_state(TASK_INTERRUPTIBLE); |
6313 |
+ if (kthread_should_stop()) |
6314 |
+ break; |
6315 |
+ |
6316 |
+- set_current_state(TASK_INTERRUPTIBLE); |
6317 |
+- |
6318 |
+ schedule(); |
6319 |
+ |
6320 |
+- /* make sure we are running */ |
6321 |
+- __set_current_state(TASK_RUNNING); |
6322 |
+- |
6323 |
+ try_to_freeze(); |
6324 |
+ } |
6325 |
++ /* make sure we are running before we exit */ |
6326 |
++ __set_current_state(TASK_RUNNING); |
6327 |
+ |
6328 |
+ /* shut down socket, if a device is still present */ |
6329 |
+ if (skt->state & SOCKET_PRESENT) { |
6330 |
+diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c |
6331 |
+index 9e6922c08ef62..3a512513cb32f 100644 |
6332 |
+--- a/drivers/pcmcia/rsrc_nonstatic.c |
6333 |
++++ b/drivers/pcmcia/rsrc_nonstatic.c |
6334 |
+@@ -690,6 +690,9 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s, |
6335 |
+ unsigned long min = base; |
6336 |
+ int ret; |
6337 |
+ |
6338 |
++ if (!res) |
6339 |
++ return NULL; |
6340 |
++ |
6341 |
+ data.mask = align - 1; |
6342 |
+ data.offset = base & data.mask; |
6343 |
+ data.map = &s_data->io_db; |
6344 |
+@@ -809,6 +812,9 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num, |
6345 |
+ unsigned long min, max; |
6346 |
+ int ret, i, j; |
6347 |
+ |
6348 |
++ if (!res) |
6349 |
++ return NULL; |
6350 |
++ |
6351 |
+ low = low || !(s->features & SS_CAP_PAGE_REGS); |
6352 |
+ |
6353 |
+ data.mask = align - 1; |
6354 |
+diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/socionext/phy-uniphier-usb3ss.c |
6355 |
+index a7577e316baf5..e63648b5c7547 100644 |
6356 |
+--- a/drivers/phy/socionext/phy-uniphier-usb3ss.c |
6357 |
++++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c |
6358 |
+@@ -22,11 +22,13 @@ |
6359 |
+ #include <linux/reset.h> |
6360 |
+ |
6361 |
+ #define SSPHY_TESTI 0x0 |
6362 |
+-#define SSPHY_TESTO 0x4 |
6363 |
+ #define TESTI_DAT_MASK GENMASK(13, 6) |
6364 |
+ #define TESTI_ADR_MASK GENMASK(5, 1) |
6365 |
+ #define TESTI_WR_EN BIT(0) |
6366 |
+ |
6367 |
++#define SSPHY_TESTO 0x4 |
6368 |
++#define TESTO_DAT_MASK GENMASK(7, 0) |
6369 |
++ |
6370 |
+ #define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) } |
6371 |
+ |
6372 |
+ #define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */ |
6373 |
+@@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_u3ssphy_priv *priv, |
6374 |
+ val = FIELD_PREP(TESTI_DAT_MASK, 1); |
6375 |
+ val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); |
6376 |
+ uniphier_u3ssphy_testio_write(priv, val); |
6377 |
+- val = readl(priv->base + SSPHY_TESTO); |
6378 |
++ val = readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK; |
6379 |
+ |
6380 |
+ /* update value */ |
6381 |
+- val &= ~FIELD_PREP(TESTI_DAT_MASK, field_mask); |
6382 |
++ val &= ~field_mask; |
6383 |
+ data = field_mask & (p->value << p->field.lsb); |
6384 |
+- val = FIELD_PREP(TESTI_DAT_MASK, data); |
6385 |
++ val = FIELD_PREP(TESTI_DAT_MASK, data | val); |
6386 |
+ val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); |
6387 |
+ uniphier_u3ssphy_testio_write(priv, val); |
6388 |
+ uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN); |
6389 |
+diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c |
6390 |
+index 9d1ec8d677de6..5afe55119fe65 100644 |
6391 |
+--- a/drivers/power/supply/bq25890_charger.c |
6392 |
++++ b/drivers/power/supply/bq25890_charger.c |
6393 |
+@@ -531,12 +531,12 @@ static void bq25890_handle_state_change(struct bq25890_device *bq, |
6394 |
+ |
6395 |
+ if (!new_state->online) { /* power removed */ |
6396 |
+ /* disable ADC */ |
6397 |
+- ret = bq25890_field_write(bq, F_CONV_START, 0); |
6398 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 0); |
6399 |
+ if (ret < 0) |
6400 |
+ goto error; |
6401 |
+ } else if (!old_state.online) { /* power inserted */ |
6402 |
+ /* enable ADC, to have control of charge current/voltage */ |
6403 |
+- ret = bq25890_field_write(bq, F_CONV_START, 1); |
6404 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 1); |
6405 |
+ if (ret < 0) |
6406 |
+ goto error; |
6407 |
+ } |
6408 |
+diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c |
6409 |
+index 3b0828c79e2b5..e6601c28ab431 100644 |
6410 |
+--- a/drivers/regulator/qcom_smd-regulator.c |
6411 |
++++ b/drivers/regulator/qcom_smd-regulator.c |
6412 |
+@@ -9,6 +9,7 @@ |
6413 |
+ #include <linux/of_device.h> |
6414 |
+ #include <linux/platform_device.h> |
6415 |
+ #include <linux/regulator/driver.h> |
6416 |
++#include <linux/regulator/of_regulator.h> |
6417 |
+ #include <linux/soc/qcom/smd-rpm.h> |
6418 |
+ |
6419 |
+ struct qcom_rpm_reg { |
6420 |
+@@ -776,52 +777,91 @@ static const struct of_device_id rpm_of_match[] = { |
6421 |
+ }; |
6422 |
+ MODULE_DEVICE_TABLE(of, rpm_of_match); |
6423 |
+ |
6424 |
+-static int rpm_reg_probe(struct platform_device *pdev) |
6425 |
++/** |
6426 |
++ * rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-regulator |
6427 |
++ * @vreg: Pointer to the individual qcom_smd-regulator resource |
6428 |
++ * @dev: Pointer to the top level qcom_smd-regulator PMIC device |
6429 |
++ * @node: Pointer to the individual qcom_smd-regulator resource |
6430 |
++ * device node |
6431 |
++ * @rpm: Pointer to the rpm bus node |
6432 |
++ * @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator |
6433 |
++ * resources defined for the top level PMIC device |
6434 |
++ * |
6435 |
++ * Return: 0 on success, errno on failure |
6436 |
++ */ |
6437 |
++static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct device *dev, |
6438 |
++ struct device_node *node, struct qcom_smd_rpm *rpm, |
6439 |
++ const struct rpm_regulator_data *pmic_rpm_data) |
6440 |
+ { |
6441 |
+- const struct rpm_regulator_data *reg; |
6442 |
+- const struct of_device_id *match; |
6443 |
+- struct regulator_config config = { }; |
6444 |
++ struct regulator_config config = {}; |
6445 |
++ const struct rpm_regulator_data *rpm_data; |
6446 |
+ struct regulator_dev *rdev; |
6447 |
++ int ret; |
6448 |
++ |
6449 |
++ for (rpm_data = pmic_rpm_data; rpm_data->name; rpm_data++) |
6450 |
++ if (of_node_name_eq(node, rpm_data->name)) |
6451 |
++ break; |
6452 |
++ |
6453 |
++ if (!rpm_data->name) { |
6454 |
++ dev_err(dev, "Unknown regulator %pOFn\n", node); |
6455 |
++ return -EINVAL; |
6456 |
++ } |
6457 |
++ |
6458 |
++ vreg->dev = dev; |
6459 |
++ vreg->rpm = rpm; |
6460 |
++ vreg->type = rpm_data->type; |
6461 |
++ vreg->id = rpm_data->id; |
6462 |
++ |
6463 |
++ memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc)); |
6464 |
++ vreg->desc.name = rpm_data->name; |
6465 |
++ vreg->desc.supply_name = rpm_data->supply; |
6466 |
++ vreg->desc.owner = THIS_MODULE; |
6467 |
++ vreg->desc.type = REGULATOR_VOLTAGE; |
6468 |
++ vreg->desc.of_match = rpm_data->name; |
6469 |
++ |
6470 |
++ config.dev = dev; |
6471 |
++ config.of_node = node; |
6472 |
++ config.driver_data = vreg; |
6473 |
++ |
6474 |
++ rdev = devm_regulator_register(dev, &vreg->desc, &config); |
6475 |
++ if (IS_ERR(rdev)) { |
6476 |
++ ret = PTR_ERR(rdev); |
6477 |
++ dev_err(dev, "%pOFn: devm_regulator_register() failed, ret=%d\n", node, ret); |
6478 |
++ return ret; |
6479 |
++ } |
6480 |
++ |
6481 |
++ return 0; |
6482 |
++} |
6483 |
++ |
6484 |
++static int rpm_reg_probe(struct platform_device *pdev) |
6485 |
++{ |
6486 |
++ struct device *dev = &pdev->dev; |
6487 |
++ const struct rpm_regulator_data *vreg_data; |
6488 |
++ struct device_node *node; |
6489 |
+ struct qcom_rpm_reg *vreg; |
6490 |
+ struct qcom_smd_rpm *rpm; |
6491 |
++ int ret; |
6492 |
+ |
6493 |
+ rpm = dev_get_drvdata(pdev->dev.parent); |
6494 |
+ if (!rpm) { |
6495 |
+- dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); |
6496 |
++ dev_err(&pdev->dev, "Unable to retrieve handle to rpm\n"); |
6497 |
+ return -ENODEV; |
6498 |
+ } |
6499 |
+ |
6500 |
+- match = of_match_device(rpm_of_match, &pdev->dev); |
6501 |
+- if (!match) { |
6502 |
+- dev_err(&pdev->dev, "failed to match device\n"); |
6503 |
++ vreg_data = of_device_get_match_data(dev); |
6504 |
++ if (!vreg_data) |
6505 |
+ return -ENODEV; |
6506 |
+- } |
6507 |
+ |
6508 |
+- for (reg = match->data; reg->name; reg++) { |
6509 |
++ for_each_available_child_of_node(dev->of_node, node) { |
6510 |
+ vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); |
6511 |
+ if (!vreg) |
6512 |
+ return -ENOMEM; |
6513 |
+ |
6514 |
+- vreg->dev = &pdev->dev; |
6515 |
+- vreg->type = reg->type; |
6516 |
+- vreg->id = reg->id; |
6517 |
+- vreg->rpm = rpm; |
6518 |
+- |
6519 |
+- memcpy(&vreg->desc, reg->desc, sizeof(vreg->desc)); |
6520 |
+- |
6521 |
+- vreg->desc.id = -1; |
6522 |
+- vreg->desc.owner = THIS_MODULE; |
6523 |
+- vreg->desc.type = REGULATOR_VOLTAGE; |
6524 |
+- vreg->desc.name = reg->name; |
6525 |
+- vreg->desc.supply_name = reg->supply; |
6526 |
+- vreg->desc.of_match = reg->name; |
6527 |
+- |
6528 |
+- config.dev = &pdev->dev; |
6529 |
+- config.driver_data = vreg; |
6530 |
+- rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config); |
6531 |
+- if (IS_ERR(rdev)) { |
6532 |
+- dev_err(&pdev->dev, "failed to register %s\n", reg->name); |
6533 |
+- return PTR_ERR(rdev); |
6534 |
++ ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); |
6535 |
++ |
6536 |
++ if (ret < 0) { |
6537 |
++ of_node_put(node); |
6538 |
++ return ret; |
6539 |
+ } |
6540 |
+ } |
6541 |
+ |
6542 |
+diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c |
6543 |
+index e330ec4dfc337..c1d4990beab02 100644 |
6544 |
+--- a/drivers/rpmsg/rpmsg_core.c |
6545 |
++++ b/drivers/rpmsg/rpmsg_core.c |
6546 |
+@@ -473,13 +473,25 @@ static int rpmsg_dev_probe(struct device *dev) |
6547 |
+ err = rpdrv->probe(rpdev); |
6548 |
+ if (err) { |
6549 |
+ dev_err(dev, "%s: failed: %d\n", __func__, err); |
6550 |
+- if (ept) |
6551 |
+- rpmsg_destroy_ept(ept); |
6552 |
+- goto out; |
6553 |
++ goto destroy_ept; |
6554 |
+ } |
6555 |
+ |
6556 |
+- if (ept && rpdev->ops->announce_create) |
6557 |
++ if (ept && rpdev->ops->announce_create) { |
6558 |
+ err = rpdev->ops->announce_create(rpdev); |
6559 |
++ if (err) { |
6560 |
++ dev_err(dev, "failed to announce creation\n"); |
6561 |
++ goto remove_rpdev; |
6562 |
++ } |
6563 |
++ } |
6564 |
++ |
6565 |
++ return 0; |
6566 |
++ |
6567 |
++remove_rpdev: |
6568 |
++ if (rpdrv->remove) |
6569 |
++ rpdrv->remove(rpdev); |
6570 |
++destroy_ept: |
6571 |
++ if (ept) |
6572 |
++ rpmsg_destroy_ept(ept); |
6573 |
+ out: |
6574 |
+ return err; |
6575 |
+ } |
6576 |
+diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c |
6577 |
+index cb28bbdc9e17f..c0dc03ffa8173 100644 |
6578 |
+--- a/drivers/rtc/rtc-cmos.c |
6579 |
++++ b/drivers/rtc/rtc-cmos.c |
6580 |
+@@ -463,7 +463,10 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
6581 |
+ min = t->time.tm_min; |
6582 |
+ sec = t->time.tm_sec; |
6583 |
+ |
6584 |
++ spin_lock_irq(&rtc_lock); |
6585 |
+ rtc_control = CMOS_READ(RTC_CONTROL); |
6586 |
++ spin_unlock_irq(&rtc_lock); |
6587 |
++ |
6588 |
+ if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
6589 |
+ /* Writing 0xff means "don't care" or "match all". */ |
6590 |
+ mon = (mon <= 12) ? bin2bcd(mon) : 0xff; |
6591 |
+diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c |
6592 |
+index d2f1d8f754bf3..cf8119b6d3204 100644 |
6593 |
+--- a/drivers/rtc/rtc-pxa.c |
6594 |
++++ b/drivers/rtc/rtc-pxa.c |
6595 |
+@@ -330,6 +330,10 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) |
6596 |
+ if (sa1100_rtc->irq_alarm < 0) |
6597 |
+ return -ENXIO; |
6598 |
+ |
6599 |
++ sa1100_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
6600 |
++ if (IS_ERR(sa1100_rtc->rtc)) |
6601 |
++ return PTR_ERR(sa1100_rtc->rtc); |
6602 |
++ |
6603 |
+ pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start, |
6604 |
+ resource_size(pxa_rtc->ress)); |
6605 |
+ if (!pxa_rtc->base) { |
6606 |
+diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h |
6607 |
+index 8943d42fc406e..0b69f4f713778 100644 |
6608 |
+--- a/drivers/scsi/lpfc/lpfc.h |
6609 |
++++ b/drivers/scsi/lpfc/lpfc.h |
6610 |
+@@ -735,7 +735,6 @@ struct lpfc_hba { |
6611 |
+ #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ |
6612 |
+ #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ |
6613 |
+ #define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */ |
6614 |
+-#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */ |
6615 |
+ #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ |
6616 |
+ #define HBA_FORCED_LINK_SPEED 0x40000 /* |
6617 |
+ * Firmware supports Forced Link Speed |
6618 |
+@@ -744,6 +743,7 @@ struct lpfc_hba { |
6619 |
+ #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ |
6620 |
+ #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ |
6621 |
+ |
6622 |
++ struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ |
6623 |
+ uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ |
6624 |
+ struct lpfc_dmabuf slim2p; |
6625 |
+ |
6626 |
+diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c |
6627 |
+index f0ecfe565660a..1c541a600149b 100644 |
6628 |
+--- a/drivers/scsi/lpfc/lpfc_attr.c |
6629 |
++++ b/drivers/scsi/lpfc/lpfc_attr.c |
6630 |
+@@ -1537,25 +1537,25 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) |
6631 |
+ before_fc_flag = phba->pport->fc_flag; |
6632 |
+ sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; |
6633 |
+ |
6634 |
+- /* Disable SR-IOV virtual functions if enabled */ |
6635 |
+- if (phba->cfg_sriov_nr_virtfn) { |
6636 |
+- pci_disable_sriov(pdev); |
6637 |
+- phba->cfg_sriov_nr_virtfn = 0; |
6638 |
+- } |
6639 |
++ if (opcode == LPFC_FW_DUMP) { |
6640 |
++ init_completion(&online_compl); |
6641 |
++ phba->fw_dump_cmpl = &online_compl; |
6642 |
++ } else { |
6643 |
++ /* Disable SR-IOV virtual functions if enabled */ |
6644 |
++ if (phba->cfg_sriov_nr_virtfn) { |
6645 |
++ pci_disable_sriov(pdev); |
6646 |
++ phba->cfg_sriov_nr_virtfn = 0; |
6647 |
++ } |
6648 |
+ |
6649 |
+- if (opcode == LPFC_FW_DUMP) |
6650 |
+- phba->hba_flag |= HBA_FW_DUMP_OP; |
6651 |
++ status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
6652 |
+ |
6653 |
+- status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); |
6654 |
++ if (status != 0) |
6655 |
++ return status; |
6656 |
+ |
6657 |
+- if (status != 0) { |
6658 |
+- phba->hba_flag &= ~HBA_FW_DUMP_OP; |
6659 |
+- return status; |
6660 |
++ /* wait for the device to be quiesced before firmware reset */ |
6661 |
++ msleep(100); |
6662 |
+ } |
6663 |
+ |
6664 |
+- /* wait for the device to be quiesced before firmware reset */ |
6665 |
+- msleep(100); |
6666 |
+- |
6667 |
+ reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + |
6668 |
+ LPFC_CTL_PDEV_CTL_OFFSET); |
6669 |
+ |
6670 |
+@@ -1584,24 +1584,42 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) |
6671 |
+ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
6672 |
+ "3153 Fail to perform the requested " |
6673 |
+ "access: x%x\n", reg_val); |
6674 |
++ if (phba->fw_dump_cmpl) |
6675 |
++ phba->fw_dump_cmpl = NULL; |
6676 |
+ return rc; |
6677 |
+ } |
6678 |
+ |
6679 |
+ /* keep the original port state */ |
6680 |
+- if (before_fc_flag & FC_OFFLINE_MODE) |
6681 |
+- goto out; |
6682 |
+- |
6683 |
+- init_completion(&online_compl); |
6684 |
+- job_posted = lpfc_workq_post_event(phba, &status, &online_compl, |
6685 |
+- LPFC_EVT_ONLINE); |
6686 |
+- if (!job_posted) |
6687 |
++ if (before_fc_flag & FC_OFFLINE_MODE) { |
6688 |
++ if (phba->fw_dump_cmpl) |
6689 |
++ phba->fw_dump_cmpl = NULL; |
6690 |
+ goto out; |
6691 |
++ } |
6692 |
+ |
6693 |
+- wait_for_completion(&online_compl); |
6694 |
++ /* Firmware dump will trigger an HA_ERATT event, and |
6695 |
++ * lpfc_handle_eratt_s4 routine already handles bringing the port back |
6696 |
++ * online. |
6697 |
++ */ |
6698 |
++ if (opcode == LPFC_FW_DUMP) { |
6699 |
++ wait_for_completion(phba->fw_dump_cmpl); |
6700 |
++ } else { |
6701 |
++ init_completion(&online_compl); |
6702 |
++ job_posted = lpfc_workq_post_event(phba, &status, &online_compl, |
6703 |
++ LPFC_EVT_ONLINE); |
6704 |
++ if (!job_posted) |
6705 |
++ goto out; |
6706 |
+ |
6707 |
++ wait_for_completion(&online_compl); |
6708 |
++ } |
6709 |
+ out: |
6710 |
+ /* in any case, restore the virtual functions enabled as before */ |
6711 |
+ if (sriov_nr_virtfn) { |
6712 |
++ /* If fw_dump was performed, first disable to clean up */ |
6713 |
++ if (opcode == LPFC_FW_DUMP) { |
6714 |
++ pci_disable_sriov(pdev); |
6715 |
++ phba->cfg_sriov_nr_virtfn = 0; |
6716 |
++ } |
6717 |
++ |
6718 |
+ sriov_err = |
6719 |
+ lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn); |
6720 |
+ if (!sriov_err) |
6721 |
+diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c |
6722 |
+index 0dc1d56ff4709..0abce779fbb13 100644 |
6723 |
+--- a/drivers/scsi/lpfc/lpfc_hbadisc.c |
6724 |
++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c |
6725 |
+@@ -628,10 +628,16 @@ lpfc_work_done(struct lpfc_hba *phba) |
6726 |
+ if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) |
6727 |
+ lpfc_sli4_post_async_mbox(phba); |
6728 |
+ |
6729 |
+- if (ha_copy & HA_ERATT) |
6730 |
++ if (ha_copy & HA_ERATT) { |
6731 |
+ /* Handle the error attention event */ |
6732 |
+ lpfc_handle_eratt(phba); |
6733 |
+ |
6734 |
++ if (phba->fw_dump_cmpl) { |
6735 |
++ complete(phba->fw_dump_cmpl); |
6736 |
++ phba->fw_dump_cmpl = NULL; |
6737 |
++ } |
6738 |
++ } |
6739 |
++ |
6740 |
+ if (ha_copy & HA_MBATT) |
6741 |
+ lpfc_sli_handle_mb_event(phba); |
6742 |
+ |
6743 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
6744 |
+index 51bab0979527b..bd908dd273078 100644 |
6745 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
6746 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
6747 |
+@@ -4498,12 +4498,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) |
6748 |
+ phba->fcf.fcf_flag = 0; |
6749 |
+ spin_unlock_irq(&phba->hbalock); |
6750 |
+ |
6751 |
+- /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */ |
6752 |
+- if (phba->hba_flag & HBA_FW_DUMP_OP) { |
6753 |
+- phba->hba_flag &= ~HBA_FW_DUMP_OP; |
6754 |
+- return rc; |
6755 |
+- } |
6756 |
+- |
6757 |
+ /* Now physically reset the device */ |
6758 |
+ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
6759 |
+ "0389 Performing PCI function reset!\n"); |
6760 |
+diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c |
6761 |
+index c19ea7ab54cbd..d9a18124cfc9d 100644 |
6762 |
+--- a/drivers/scsi/scsi_debugfs.c |
6763 |
++++ b/drivers/scsi/scsi_debugfs.c |
6764 |
+@@ -10,6 +10,7 @@ static const char *const scsi_cmd_flags[] = { |
6765 |
+ SCSI_CMD_FLAG_NAME(TAGGED), |
6766 |
+ SCSI_CMD_FLAG_NAME(UNCHECKED_ISA_DMA), |
6767 |
+ SCSI_CMD_FLAG_NAME(INITIALIZED), |
6768 |
++ SCSI_CMD_FLAG_NAME(LAST), |
6769 |
+ }; |
6770 |
+ #undef SCSI_CMD_FLAG_NAME |
6771 |
+ |
6772 |
+diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
6773 |
+index 279dea628620d..310da62cda263 100644 |
6774 |
+--- a/drivers/scsi/sr.c |
6775 |
++++ b/drivers/scsi/sr.c |
6776 |
+@@ -887,7 +887,7 @@ static void get_capabilities(struct scsi_cd *cd) |
6777 |
+ |
6778 |
+ |
6779 |
+ /* allocate transfer buffer */ |
6780 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
6781 |
++ buffer = kmalloc(512, GFP_KERNEL); |
6782 |
+ if (!buffer) { |
6783 |
+ sr_printk(KERN_ERR, cd, "out of memory.\n"); |
6784 |
+ return; |
6785 |
+diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c |
6786 |
+index b9db2ec6d0361..996bccadd3866 100644 |
6787 |
+--- a/drivers/scsi/sr_vendor.c |
6788 |
++++ b/drivers/scsi/sr_vendor.c |
6789 |
+@@ -113,7 +113,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) |
6790 |
+ if (cd->vendor == VENDOR_TOSHIBA) |
6791 |
+ density = (blocklength > 2048) ? 0x81 : 0x83; |
6792 |
+ |
6793 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
6794 |
++ buffer = kmalloc(512, GFP_KERNEL); |
6795 |
+ if (!buffer) |
6796 |
+ return -ENOMEM; |
6797 |
+ |
6798 |
+@@ -161,7 +161,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) |
6799 |
+ if (cd->cdi.mask & CDC_MULTI_SESSION) |
6800 |
+ return 0; |
6801 |
+ |
6802 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
6803 |
++ buffer = kmalloc(512, GFP_KERNEL); |
6804 |
+ if (!buffer) |
6805 |
+ return -ENOMEM; |
6806 |
+ |
6807 |
+diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g210-pci.c |
6808 |
+index 67a6a61154b71..4e471484539d2 100644 |
6809 |
+--- a/drivers/scsi/ufs/tc-dwc-g210-pci.c |
6810 |
++++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c |
6811 |
+@@ -135,7 +135,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
6812 |
+ return err; |
6813 |
+ } |
6814 |
+ |
6815 |
+- pci_set_drvdata(pdev, hba); |
6816 |
+ pm_runtime_put_noidle(&pdev->dev); |
6817 |
+ pm_runtime_allow(&pdev->dev); |
6818 |
+ |
6819 |
+diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c |
6820 |
+index 8d40dc918f4e1..10eec501f6b39 100644 |
6821 |
+--- a/drivers/scsi/ufs/ufshcd-pltfrm.c |
6822 |
++++ b/drivers/scsi/ufs/ufshcd-pltfrm.c |
6823 |
+@@ -436,8 +436,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, |
6824 |
+ goto dealloc_host; |
6825 |
+ } |
6826 |
+ |
6827 |
+- platform_set_drvdata(pdev, hba); |
6828 |
+- |
6829 |
+ pm_runtime_set_active(&pdev->dev); |
6830 |
+ pm_runtime_enable(&pdev->dev); |
6831 |
+ |
6832 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
6833 |
+index 29c7a76d2c658..ebf7ae1ef70d4 100644 |
6834 |
+--- a/drivers/scsi/ufs/ufshcd.c |
6835 |
++++ b/drivers/scsi/ufs/ufshcd.c |
6836 |
+@@ -8328,6 +8328,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) |
6837 |
+ struct Scsi_Host *host = hba->host; |
6838 |
+ struct device *dev = hba->dev; |
6839 |
+ |
6840 |
++ /* |
6841 |
++ * dev_set_drvdata() must be called before any callbacks are registered |
6842 |
++ * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, |
6843 |
++ * sysfs). |
6844 |
++ */ |
6845 |
++ dev_set_drvdata(dev, hba); |
6846 |
++ |
6847 |
+ if (!mmio_base) { |
6848 |
+ dev_err(hba->dev, |
6849 |
+ "Invalid memory reference for mmio_base is NULL\n"); |
6850 |
+diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c |
6851 |
+index 75f25f08245fd..71afa2a99b17f 100644 |
6852 |
+--- a/drivers/soc/mediatek/mtk-scpsys.c |
6853 |
++++ b/drivers/soc/mediatek/mtk-scpsys.c |
6854 |
+@@ -333,12 +333,17 @@ out: |
6855 |
+ return ret; |
6856 |
+ } |
6857 |
+ |
6858 |
+-static void init_clks(struct platform_device *pdev, struct clk **clk) |
6859 |
++static int init_clks(struct platform_device *pdev, struct clk **clk) |
6860 |
+ { |
6861 |
+ int i; |
6862 |
+ |
6863 |
+- for (i = CLK_NONE + 1; i < CLK_MAX; i++) |
6864 |
++ for (i = CLK_NONE + 1; i < CLK_MAX; i++) { |
6865 |
+ clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); |
6866 |
++ if (IS_ERR(clk[i])) |
6867 |
++ return PTR_ERR(clk[i]); |
6868 |
++ } |
6869 |
++ |
6870 |
++ return 0; |
6871 |
+ } |
6872 |
+ |
6873 |
+ static struct scp *init_scp(struct platform_device *pdev, |
6874 |
+@@ -348,7 +353,7 @@ static struct scp *init_scp(struct platform_device *pdev, |
6875 |
+ { |
6876 |
+ struct genpd_onecell_data *pd_data; |
6877 |
+ struct resource *res; |
6878 |
+- int i, j; |
6879 |
++ int i, j, ret; |
6880 |
+ struct scp *scp; |
6881 |
+ struct clk *clk[CLK_MAX]; |
6882 |
+ |
6883 |
+@@ -403,7 +408,9 @@ static struct scp *init_scp(struct platform_device *pdev, |
6884 |
+ |
6885 |
+ pd_data->num_domains = num; |
6886 |
+ |
6887 |
+- init_clks(pdev, clk); |
6888 |
++ ret = init_clks(pdev, clk); |
6889 |
++ if (ret) |
6890 |
++ return ERR_PTR(ret); |
6891 |
+ |
6892 |
+ for (i = 0; i < num; i++) { |
6893 |
+ struct scp_domain *scpd = &scp->domains[i]; |
6894 |
+diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c |
6895 |
+index c7b0399802913..cae934464f3dd 100644 |
6896 |
+--- a/drivers/spi/spi-meson-spifc.c |
6897 |
++++ b/drivers/spi/spi-meson-spifc.c |
6898 |
+@@ -349,6 +349,7 @@ static int meson_spifc_probe(struct platform_device *pdev) |
6899 |
+ return 0; |
6900 |
+ out_clk: |
6901 |
+ clk_disable_unprepare(spifc->clk); |
6902 |
++ pm_runtime_disable(spifc->dev); |
6903 |
+ out_err: |
6904 |
+ spi_master_put(master); |
6905 |
+ return ret; |
6906 |
+diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c |
6907 |
+index a8cfea957868a..3e2fbcd20598a 100644 |
6908 |
+--- a/drivers/staging/greybus/audio_topology.c |
6909 |
++++ b/drivers/staging/greybus/audio_topology.c |
6910 |
+@@ -145,6 +145,9 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb, |
6911 |
+ |
6912 |
+ items = le32_to_cpu(gbenum->items); |
6913 |
+ strings = devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); |
6914 |
++ if (!strings) |
6915 |
++ return NULL; |
6916 |
++ |
6917 |
+ data = gbenum->names; |
6918 |
+ |
6919 |
+ for (i = 0; i < items; i++) { |
6920 |
+@@ -662,6 +665,8 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb, |
6921 |
+ /* since count=1, and reg is dummy */ |
6922 |
+ gbe->max = le32_to_cpu(gb_enum->items); |
6923 |
+ gbe->texts = gb_generate_enum_strings(gb, gb_enum); |
6924 |
++ if (!gbe->texts) |
6925 |
++ return -ENOMEM; |
6926 |
+ |
6927 |
+ /* debug enum info */ |
6928 |
+ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, |
6929 |
+@@ -871,6 +876,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb, |
6930 |
+ /* since count=1, and reg is dummy */ |
6931 |
+ gbe->max = le32_to_cpu(gb_enum->items); |
6932 |
+ gbe->texts = gb_generate_enum_strings(gb, gb_enum); |
6933 |
++ if (!gbe->texts) |
6934 |
++ return -ENOMEM; |
6935 |
+ |
6936 |
+ /* debug enum info */ |
6937 |
+ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, |
6938 |
+@@ -1081,6 +1088,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, |
6939 |
+ csize += le16_to_cpu(gbenum->names_length); |
6940 |
+ control->texts = (const char * const *) |
6941 |
+ gb_generate_enum_strings(module, gbenum); |
6942 |
++ if (!control->texts) { |
6943 |
++ ret = -ENOMEM; |
6944 |
++ goto error; |
6945 |
++ } |
6946 |
+ control->items = le32_to_cpu(gbenum->items); |
6947 |
+ } else { |
6948 |
+ csize = sizeof(struct gb_audio_control); |
6949 |
+@@ -1190,6 +1201,10 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, |
6950 |
+ csize += le16_to_cpu(gbenum->names_length); |
6951 |
+ control->texts = (const char * const *) |
6952 |
+ gb_generate_enum_strings(module, gbenum); |
6953 |
++ if (!control->texts) { |
6954 |
++ ret = -ENOMEM; |
6955 |
++ goto error; |
6956 |
++ } |
6957 |
+ control->items = le32_to_cpu(gbenum->items); |
6958 |
+ } else { |
6959 |
+ csize = sizeof(struct gb_audio_control); |
6960 |
+diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c |
6961 |
+index 32e5966ba5c5f..58cf44045b396 100644 |
6962 |
+--- a/drivers/staging/media/hantro/hantro_drv.c |
6963 |
++++ b/drivers/staging/media/hantro/hantro_drv.c |
6964 |
+@@ -823,7 +823,7 @@ static int hantro_probe(struct platform_device *pdev) |
6965 |
+ ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks); |
6966 |
+ if (ret) { |
6967 |
+ dev_err(&pdev->dev, "Failed to prepare clocks\n"); |
6968 |
+- return ret; |
6969 |
++ goto err_pm_disable; |
6970 |
+ } |
6971 |
+ |
6972 |
+ ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev); |
6973 |
+@@ -879,6 +879,7 @@ err_v4l2_unreg: |
6974 |
+ v4l2_device_unregister(&vpu->v4l2_dev); |
6975 |
+ err_clk_unprepare: |
6976 |
+ clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); |
6977 |
++err_pm_disable: |
6978 |
+ pm_runtime_dont_use_autosuspend(vpu->dev); |
6979 |
+ pm_runtime_disable(vpu->dev); |
6980 |
+ return ret; |
6981 |
+diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h |
6982 |
+index 2eeb9a43734e3..49bf3ad31f912 100644 |
6983 |
+--- a/drivers/staging/rtl8192e/rtllib.h |
6984 |
++++ b/drivers/staging/rtl8192e/rtllib.h |
6985 |
+@@ -1982,7 +1982,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee); |
6986 |
+ void rtllib_stop_send_beacons(struct rtllib_device *ieee); |
6987 |
+ void notify_wx_assoc_event(struct rtllib_device *ieee); |
6988 |
+ void rtllib_start_ibss(struct rtllib_device *ieee); |
6989 |
+-void rtllib_softmac_init(struct rtllib_device *ieee); |
6990 |
++int rtllib_softmac_init(struct rtllib_device *ieee); |
6991 |
+ void rtllib_softmac_free(struct rtllib_device *ieee); |
6992 |
+ void rtllib_disassociate(struct rtllib_device *ieee); |
6993 |
+ void rtllib_stop_scan(struct rtllib_device *ieee); |
6994 |
+diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c |
6995 |
+index 64d9feee1f392..f00ac94b2639b 100644 |
6996 |
+--- a/drivers/staging/rtl8192e/rtllib_module.c |
6997 |
++++ b/drivers/staging/rtl8192e/rtllib_module.c |
6998 |
+@@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) |
6999 |
+ err = rtllib_networks_allocate(ieee); |
7000 |
+ if (err) { |
7001 |
+ pr_err("Unable to allocate beacon storage: %d\n", err); |
7002 |
+- goto failed; |
7003 |
++ goto free_netdev; |
7004 |
+ } |
7005 |
+ rtllib_networks_initialize(ieee); |
7006 |
+ |
7007 |
+@@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) |
7008 |
+ ieee->hwsec_active = 0; |
7009 |
+ |
7010 |
+ memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); |
7011 |
+- rtllib_softmac_init(ieee); |
7012 |
++ err = rtllib_softmac_init(ieee); |
7013 |
++ if (err) |
7014 |
++ goto free_crypt_info; |
7015 |
+ |
7016 |
+ ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); |
7017 |
+ if (!ieee->pHTInfo) |
7018 |
+- return NULL; |
7019 |
++ goto free_softmac; |
7020 |
+ |
7021 |
+ HTUpdateDefaultSetting(ieee); |
7022 |
+ HTInitializeHTInfo(ieee); |
7023 |
+@@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv) |
7024 |
+ |
7025 |
+ return dev; |
7026 |
+ |
7027 |
+- failed: |
7028 |
++free_softmac: |
7029 |
++ rtllib_softmac_free(ieee); |
7030 |
++free_crypt_info: |
7031 |
++ lib80211_crypt_info_free(&ieee->crypt_info); |
7032 |
++ rtllib_networks_free(ieee); |
7033 |
++free_netdev: |
7034 |
+ free_netdev(dev); |
7035 |
++ |
7036 |
+ return NULL; |
7037 |
+ } |
7038 |
+ EXPORT_SYMBOL(alloc_rtllib); |
7039 |
+diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c |
7040 |
+index f2f7529e7c80e..4ff8fd694c600 100644 |
7041 |
+--- a/drivers/staging/rtl8192e/rtllib_softmac.c |
7042 |
++++ b/drivers/staging/rtl8192e/rtllib_softmac.c |
7043 |
+@@ -2952,7 +2952,7 @@ void rtllib_start_protocol(struct rtllib_device *ieee) |
7044 |
+ } |
7045 |
+ } |
7046 |
+ |
7047 |
+-void rtllib_softmac_init(struct rtllib_device *ieee) |
7048 |
++int rtllib_softmac_init(struct rtllib_device *ieee) |
7049 |
+ { |
7050 |
+ int i; |
7051 |
+ |
7052 |
+@@ -2963,7 +2963,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee) |
7053 |
+ ieee->seq_ctrl[i] = 0; |
7054 |
+ ieee->dot11d_info = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); |
7055 |
+ if (!ieee->dot11d_info) |
7056 |
+- netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n"); |
7057 |
++ return -ENOMEM; |
7058 |
++ |
7059 |
+ ieee->LinkDetectInfo.SlotIndex = 0; |
7060 |
+ ieee->LinkDetectInfo.SlotNum = 2; |
7061 |
+ ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0; |
7062 |
+@@ -3031,6 +3032,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) |
7063 |
+ (void(*)(unsigned long)) rtllib_sta_ps, |
7064 |
+ (unsigned long)ieee); |
7065 |
+ |
7066 |
++ return 0; |
7067 |
+ } |
7068 |
+ |
7069 |
+ void rtllib_softmac_free(struct rtllib_device *ieee) |
7070 |
+diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c |
7071 |
+index 0f16d9ffd8d12..85e0cef9e917e 100644 |
7072 |
+--- a/drivers/tee/tee_core.c |
7073 |
++++ b/drivers/tee/tee_core.c |
7074 |
+@@ -84,8 +84,10 @@ void teedev_ctx_put(struct tee_context *ctx) |
7075 |
+ |
7076 |
+ static void teedev_close_context(struct tee_context *ctx) |
7077 |
+ { |
7078 |
+- tee_device_put(ctx->teedev); |
7079 |
++ struct tee_device *teedev = ctx->teedev; |
7080 |
++ |
7081 |
+ teedev_ctx_put(ctx); |
7082 |
++ tee_device_put(teedev); |
7083 |
+ } |
7084 |
+ |
7085 |
+ static int tee_open(struct inode *inode, struct file *filp) |
7086 |
+diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c |
7087 |
+index 2c37d11726aba..13f882e5e7b76 100644 |
7088 |
+--- a/drivers/tty/serial/amba-pl010.c |
7089 |
++++ b/drivers/tty/serial/amba-pl010.c |
7090 |
+@@ -452,14 +452,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, |
7091 |
+ if ((termios->c_cflag & CREAD) == 0) |
7092 |
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; |
7093 |
+ |
7094 |
+- /* first, disable everything */ |
7095 |
+ old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; |
7096 |
+ |
7097 |
+ if (UART_ENABLE_MS(port, termios->c_cflag)) |
7098 |
+ old_cr |= UART010_CR_MSIE; |
7099 |
+ |
7100 |
+- writel(0, uap->port.membase + UART010_CR); |
7101 |
+- |
7102 |
+ /* Set baud rate */ |
7103 |
+ quot -= 1; |
7104 |
+ writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); |
7105 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
7106 |
+index 6741d0f3daf94..0bd8c05d72d60 100644 |
7107 |
+--- a/drivers/tty/serial/amba-pl011.c |
7108 |
++++ b/drivers/tty/serial/amba-pl011.c |
7109 |
+@@ -2094,32 +2094,13 @@ static const char *pl011_type(struct uart_port *port) |
7110 |
+ return uap->port.type == PORT_AMBA ? uap->type : NULL; |
7111 |
+ } |
7112 |
+ |
7113 |
+-/* |
7114 |
+- * Release the memory region(s) being used by 'port' |
7115 |
+- */ |
7116 |
+-static void pl011_release_port(struct uart_port *port) |
7117 |
+-{ |
7118 |
+- release_mem_region(port->mapbase, SZ_4K); |
7119 |
+-} |
7120 |
+- |
7121 |
+-/* |
7122 |
+- * Request the memory region(s) being used by 'port' |
7123 |
+- */ |
7124 |
+-static int pl011_request_port(struct uart_port *port) |
7125 |
+-{ |
7126 |
+- return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") |
7127 |
+- != NULL ? 0 : -EBUSY; |
7128 |
+-} |
7129 |
+- |
7130 |
+ /* |
7131 |
+ * Configure/autoconfigure the port. |
7132 |
+ */ |
7133 |
+ static void pl011_config_port(struct uart_port *port, int flags) |
7134 |
+ { |
7135 |
+- if (flags & UART_CONFIG_TYPE) { |
7136 |
++ if (flags & UART_CONFIG_TYPE) |
7137 |
+ port->type = PORT_AMBA; |
7138 |
+- pl011_request_port(port); |
7139 |
+- } |
7140 |
+ } |
7141 |
+ |
7142 |
+ /* |
7143 |
+@@ -2134,6 +2115,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) |
7144 |
+ ret = -EINVAL; |
7145 |
+ if (ser->baud_base < 9600) |
7146 |
+ ret = -EINVAL; |
7147 |
++ if (port->mapbase != (unsigned long) ser->iomem_base) |
7148 |
++ ret = -EINVAL; |
7149 |
+ return ret; |
7150 |
+ } |
7151 |
+ |
7152 |
+@@ -2151,8 +2134,6 @@ static const struct uart_ops amba_pl011_pops = { |
7153 |
+ .flush_buffer = pl011_dma_flush_buffer, |
7154 |
+ .set_termios = pl011_set_termios, |
7155 |
+ .type = pl011_type, |
7156 |
+- .release_port = pl011_release_port, |
7157 |
+- .request_port = pl011_request_port, |
7158 |
+ .config_port = pl011_config_port, |
7159 |
+ .verify_port = pl011_verify_port, |
7160 |
+ #ifdef CONFIG_CONSOLE_POLL |
7161 |
+@@ -2182,8 +2163,6 @@ static const struct uart_ops sbsa_uart_pops = { |
7162 |
+ .shutdown = sbsa_uart_shutdown, |
7163 |
+ .set_termios = sbsa_uart_set_termios, |
7164 |
+ .type = pl011_type, |
7165 |
+- .release_port = pl011_release_port, |
7166 |
+- .request_port = pl011_request_port, |
7167 |
+ .config_port = pl011_config_port, |
7168 |
+ .verify_port = pl011_verify_port, |
7169 |
+ #ifdef CONFIG_CONSOLE_POLL |
7170 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
7171 |
+index 8a909d5561859..3b2c25bd2e06b 100644 |
7172 |
+--- a/drivers/tty/serial/atmel_serial.c |
7173 |
++++ b/drivers/tty/serial/atmel_serial.c |
7174 |
+@@ -1002,6 +1002,13 @@ static void atmel_tx_dma(struct uart_port *port) |
7175 |
+ desc->callback = atmel_complete_tx_dma; |
7176 |
+ desc->callback_param = atmel_port; |
7177 |
+ atmel_port->cookie_tx = dmaengine_submit(desc); |
7178 |
++ if (dma_submit_error(atmel_port->cookie_tx)) { |
7179 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
7180 |
++ atmel_port->cookie_tx); |
7181 |
++ return; |
7182 |
++ } |
7183 |
++ |
7184 |
++ dma_async_issue_pending(chan); |
7185 |
+ } |
7186 |
+ |
7187 |
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
7188 |
+@@ -1262,6 +1269,13 @@ static int atmel_prepare_rx_dma(struct uart_port *port) |
7189 |
+ desc->callback_param = port; |
7190 |
+ atmel_port->desc_rx = desc; |
7191 |
+ atmel_port->cookie_rx = dmaengine_submit(desc); |
7192 |
++ if (dma_submit_error(atmel_port->cookie_rx)) { |
7193 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
7194 |
++ atmel_port->cookie_rx); |
7195 |
++ goto chan_err; |
7196 |
++ } |
7197 |
++ |
7198 |
++ dma_async_issue_pending(atmel_port->chan_rx); |
7199 |
+ |
7200 |
+ return 0; |
7201 |
+ |
7202 |
+diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
7203 |
+index aad640b9e3f4b..7cc7bd8aca0f5 100644 |
7204 |
+--- a/drivers/tty/serial/serial_core.c |
7205 |
++++ b/drivers/tty/serial/serial_core.c |
7206 |
+@@ -160,7 +160,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
7207 |
+ int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); |
7208 |
+ |
7209 |
+ if (raise) { |
7210 |
+- if (rs485_on && !RTS_after_send) { |
7211 |
++ if (rs485_on && RTS_after_send) { |
7212 |
+ uart_set_mctrl(uport, TIOCM_DTR); |
7213 |
+ uart_clear_mctrl(uport, TIOCM_RTS); |
7214 |
+ } else { |
7215 |
+@@ -169,7 +169,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) |
7216 |
+ } else { |
7217 |
+ unsigned int clear = TIOCM_DTR; |
7218 |
+ |
7219 |
+- clear |= (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; |
7220 |
++ clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; |
7221 |
+ uart_clear_mctrl(uport, clear); |
7222 |
+ } |
7223 |
+ } |
7224 |
+@@ -2395,7 +2395,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, |
7225 |
+ * We probably don't need a spinlock around this, but |
7226 |
+ */ |
7227 |
+ spin_lock_irqsave(&port->lock, flags); |
7228 |
+- port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); |
7229 |
++ port->mctrl &= TIOCM_DTR; |
7230 |
++ port->ops->set_mctrl(port, port->mctrl); |
7231 |
+ spin_unlock_irqrestore(&port->lock, flags); |
7232 |
+ |
7233 |
+ /* |
7234 |
+diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c |
7235 |
+index 56066d93a65b8..9a4049c894f7a 100644 |
7236 |
+--- a/drivers/tty/serial/uartlite.c |
7237 |
++++ b/drivers/tty/serial/uartlite.c |
7238 |
+@@ -618,7 +618,7 @@ static struct uart_driver ulite_uart_driver = { |
7239 |
+ * |
7240 |
+ * Returns: 0 on success, <0 otherwise |
7241 |
+ */ |
7242 |
+-static int ulite_assign(struct device *dev, int id, u32 base, int irq, |
7243 |
++static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq, |
7244 |
+ struct uartlite_data *pdata) |
7245 |
+ { |
7246 |
+ struct uart_port *port; |
7247 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
7248 |
+index 69dd48f9507e5..4cf0dc7f330dd 100644 |
7249 |
+--- a/drivers/usb/core/hub.c |
7250 |
++++ b/drivers/usb/core/hub.c |
7251 |
+@@ -1108,7 +1108,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
7252 |
+ } else { |
7253 |
+ hub_power_on(hub, true); |
7254 |
+ } |
7255 |
+- } |
7256 |
++ /* Give some time on remote wakeup to let links to transit to U0 */ |
7257 |
++ } else if (hub_is_superspeed(hub->hdev)) |
7258 |
++ msleep(20); |
7259 |
++ |
7260 |
+ init2: |
7261 |
+ |
7262 |
+ /* |
7263 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
7264 |
+index 3f5c21f7f9905..2bea33b41553b 100644 |
7265 |
+--- a/drivers/usb/gadget/function/f_fs.c |
7266 |
++++ b/drivers/usb/gadget/function/f_fs.c |
7267 |
+@@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) |
7268 |
+ file->private_data = ffs; |
7269 |
+ ffs_data_opened(ffs); |
7270 |
+ |
7271 |
+- return 0; |
7272 |
++ return stream_open(inode, file); |
7273 |
+ } |
7274 |
+ |
7275 |
+ static int ffs_ep0_release(struct inode *inode, struct file *file) |
7276 |
+@@ -1156,7 +1156,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) |
7277 |
+ file->private_data = epfile; |
7278 |
+ ffs_data_opened(epfile->ffs); |
7279 |
+ |
7280 |
+- return 0; |
7281 |
++ return stream_open(inode, file); |
7282 |
+ } |
7283 |
+ |
7284 |
+ static int ffs_aio_cancel(struct kiocb *kiocb) |
7285 |
+diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c |
7286 |
+index 70dbd95c3f063..be9e9db7cad10 100644 |
7287 |
+--- a/drivers/usb/host/uhci-platform.c |
7288 |
++++ b/drivers/usb/host/uhci-platform.c |
7289 |
+@@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) |
7290 |
+ num_ports); |
7291 |
+ } |
7292 |
+ if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || |
7293 |
+- of_device_is_compatible(np, "aspeed,ast2500-uhci")) { |
7294 |
++ of_device_is_compatible(np, "aspeed,ast2500-uhci") || |
7295 |
++ of_device_is_compatible(np, "aspeed,ast2600-uhci")) { |
7296 |
+ uhci->is_aspeed = 1; |
7297 |
+ dev_info(&pdev->dev, |
7298 |
+ "Enabled Aspeed implementation workarounds\n"); |
7299 |
+diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c |
7300 |
+index cdee3af33ad7b..684800c66bb4d 100644 |
7301 |
+--- a/drivers/usb/misc/ftdi-elan.c |
7302 |
++++ b/drivers/usb/misc/ftdi-elan.c |
7303 |
+@@ -202,6 +202,7 @@ static void ftdi_elan_delete(struct kref *kref) |
7304 |
+ mutex_unlock(&ftdi_module_lock); |
7305 |
+ kfree(ftdi->bulk_in_buffer); |
7306 |
+ ftdi->bulk_in_buffer = NULL; |
7307 |
++ kfree(ftdi); |
7308 |
+ } |
7309 |
+ |
7310 |
+ static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) |
7311 |
+diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c |
7312 |
+index 8a640f1590784..06a9966f8c933 100644 |
7313 |
+--- a/drivers/w1/slaves/w1_ds28e04.c |
7314 |
++++ b/drivers/w1/slaves/w1_ds28e04.c |
7315 |
+@@ -32,7 +32,7 @@ static int w1_strong_pullup = 1; |
7316 |
+ module_param_named(strong_pullup, w1_strong_pullup, int, 0); |
7317 |
+ |
7318 |
+ /* enable/disable CRC checking on DS28E04-100 memory accesses */ |
7319 |
+-static char w1_enable_crccheck = 1; |
7320 |
++static bool w1_enable_crccheck = true; |
7321 |
+ |
7322 |
+ #define W1_EEPROM_SIZE 512 |
7323 |
+ #define W1_PAGE_COUNT 16 |
7324 |
+@@ -339,32 +339,18 @@ static BIN_ATTR_RW(pio, 1); |
7325 |
+ static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, |
7326 |
+ char *buf) |
7327 |
+ { |
7328 |
+- if (put_user(w1_enable_crccheck + 0x30, buf)) |
7329 |
+- return -EFAULT; |
7330 |
+- |
7331 |
+- return sizeof(w1_enable_crccheck); |
7332 |
++ return sysfs_emit(buf, "%d\n", w1_enable_crccheck); |
7333 |
+ } |
7334 |
+ |
7335 |
+ static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr, |
7336 |
+ const char *buf, size_t count) |
7337 |
+ { |
7338 |
+- char val; |
7339 |
+- |
7340 |
+- if (count != 1 || !buf) |
7341 |
+- return -EINVAL; |
7342 |
++ int err = kstrtobool(buf, &w1_enable_crccheck); |
7343 |
+ |
7344 |
+- if (get_user(val, buf)) |
7345 |
+- return -EFAULT; |
7346 |
++ if (err) |
7347 |
++ return err; |
7348 |
+ |
7349 |
+- /* convert to decimal */ |
7350 |
+- val = val - 0x30; |
7351 |
+- if (val != 0 && val != 1) |
7352 |
+- return -EINVAL; |
7353 |
+- |
7354 |
+- /* set the new value */ |
7355 |
+- w1_enable_crccheck = val; |
7356 |
+- |
7357 |
+- return sizeof(w1_enable_crccheck); |
7358 |
++ return count; |
7359 |
+ } |
7360 |
+ |
7361 |
+ static DEVICE_ATTR_RW(crccheck); |
7362 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
7363 |
+index 7f644a58db511..c701a19fac533 100644 |
7364 |
+--- a/fs/btrfs/backref.c |
7365 |
++++ b/fs/btrfs/backref.c |
7366 |
+@@ -1208,7 +1208,12 @@ again: |
7367 |
+ ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); |
7368 |
+ if (ret < 0) |
7369 |
+ goto out; |
7370 |
+- BUG_ON(ret == 0); |
7371 |
++ if (ret == 0) { |
7372 |
++ /* This shouldn't happen, indicates a bug or fs corruption. */ |
7373 |
++ ASSERT(ret != 0); |
7374 |
++ ret = -EUCLEAN; |
7375 |
++ goto out; |
7376 |
++ } |
7377 |
+ |
7378 |
+ #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS |
7379 |
+ if (trans && likely(trans->type != __TRANS_DUMMY) && |
7380 |
+@@ -1356,10 +1361,18 @@ again: |
7381 |
+ goto out; |
7382 |
+ if (!ret && extent_item_pos) { |
7383 |
+ /* |
7384 |
+- * we've recorded that parent, so we must extend |
7385 |
+- * its inode list here |
7386 |
++ * We've recorded that parent, so we must extend |
7387 |
++ * its inode list here. |
7388 |
++ * |
7389 |
++ * However if there was corruption we may not |
7390 |
++ * have found an eie, return an error in this |
7391 |
++ * case. |
7392 |
+ */ |
7393 |
+- BUG_ON(!eie); |
7394 |
++ ASSERT(eie); |
7395 |
++ if (!eie) { |
7396 |
++ ret = -EUCLEAN; |
7397 |
++ goto out; |
7398 |
++ } |
7399 |
+ while (eie->next) |
7400 |
+ eie = eie->next; |
7401 |
+ eie->next = ref->inode_list; |
7402 |
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
7403 |
+index dac30b00d14b7..822c615840e84 100644 |
7404 |
+--- a/fs/btrfs/ctree.c |
7405 |
++++ b/fs/btrfs/ctree.c |
7406 |
+@@ -2658,12 +2658,9 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root, |
7407 |
+ { |
7408 |
+ struct btrfs_fs_info *fs_info = root->fs_info; |
7409 |
+ struct extent_buffer *b; |
7410 |
+- int root_lock; |
7411 |
++ int root_lock = 0; |
7412 |
+ int level = 0; |
7413 |
+ |
7414 |
+- /* We try very hard to do read locks on the root */ |
7415 |
+- root_lock = BTRFS_READ_LOCK; |
7416 |
+- |
7417 |
+ if (p->search_commit_root) { |
7418 |
+ /* |
7419 |
+ * The commit roots are read only so we always do read locks, |
7420 |
+@@ -2701,6 +2698,9 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root, |
7421 |
+ goto out; |
7422 |
+ } |
7423 |
+ |
7424 |
++ /* We try very hard to do read locks on the root */ |
7425 |
++ root_lock = BTRFS_READ_LOCK; |
7426 |
++ |
7427 |
+ /* |
7428 |
+ * If the level is set to maximum, we can skip trying to get the read |
7429 |
+ * lock. |
7430 |
+@@ -2727,6 +2727,17 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root, |
7431 |
+ level = btrfs_header_level(b); |
7432 |
+ |
7433 |
+ out: |
7434 |
++ /* |
7435 |
++ * The root may have failed to write out at some point, and thus is no |
7436 |
++ * longer valid, return an error in this case. |
7437 |
++ */ |
7438 |
++ if (!extent_buffer_uptodate(b)) { |
7439 |
++ if (root_lock) |
7440 |
++ btrfs_tree_unlock_rw(b, root_lock); |
7441 |
++ free_extent_buffer(b); |
7442 |
++ return ERR_PTR(-EIO); |
7443 |
++ } |
7444 |
++ |
7445 |
+ p->nodes[level] = b; |
7446 |
+ if (!p->skip_locking) |
7447 |
+ p->locks[level] = root_lock; |
7448 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
7449 |
+index b859ed50cf46c..7755a0362a3ad 100644 |
7450 |
+--- a/fs/btrfs/inode.c |
7451 |
++++ b/fs/btrfs/inode.c |
7452 |
+@@ -10808,9 +10808,19 @@ static int btrfs_add_swap_extent(struct swap_info_struct *sis, |
7453 |
+ struct btrfs_swap_info *bsi) |
7454 |
+ { |
7455 |
+ unsigned long nr_pages; |
7456 |
++ unsigned long max_pages; |
7457 |
+ u64 first_ppage, first_ppage_reported, next_ppage; |
7458 |
+ int ret; |
7459 |
+ |
7460 |
++ /* |
7461 |
++ * Our swapfile may have had its size extended after the swap header was |
7462 |
++ * written. In that case activating the swapfile should not go beyond |
7463 |
++ * the max size set in the swap header. |
7464 |
++ */ |
7465 |
++ if (bsi->nr_pages >= sis->max) |
7466 |
++ return 0; |
7467 |
++ |
7468 |
++ max_pages = sis->max - bsi->nr_pages; |
7469 |
+ first_ppage = ALIGN(bsi->block_start, PAGE_SIZE) >> PAGE_SHIFT; |
7470 |
+ next_ppage = ALIGN_DOWN(bsi->block_start + bsi->block_len, |
7471 |
+ PAGE_SIZE) >> PAGE_SHIFT; |
7472 |
+@@ -10818,6 +10828,7 @@ static int btrfs_add_swap_extent(struct swap_info_struct *sis, |
7473 |
+ if (first_ppage >= next_ppage) |
7474 |
+ return 0; |
7475 |
+ nr_pages = next_ppage - first_ppage; |
7476 |
++ nr_pages = min(nr_pages, max_pages); |
7477 |
+ |
7478 |
+ first_ppage_reported = first_ppage; |
7479 |
+ if (bsi->start == 0) |
7480 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
7481 |
+index bb034e19a2a8a..2ee61596164be 100644 |
7482 |
+--- a/fs/btrfs/qgroup.c |
7483 |
++++ b/fs/btrfs/qgroup.c |
7484 |
+@@ -890,6 +890,14 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info) |
7485 |
+ int ret = 0; |
7486 |
+ int slot; |
7487 |
+ |
7488 |
++ /* |
7489 |
++ * We need to have subvol_sem write locked, to prevent races between |
7490 |
++ * concurrent tasks trying to enable quotas, because we will unlock |
7491 |
++ * and relock qgroup_ioctl_lock before setting fs_info->quota_root |
7492 |
++ * and before setting BTRFS_FS_QUOTA_ENABLED. |
7493 |
++ */ |
7494 |
++ lockdep_assert_held_write(&fs_info->subvol_sem); |
7495 |
++ |
7496 |
+ mutex_lock(&fs_info->qgroup_ioctl_lock); |
7497 |
+ if (fs_info->quota_root) |
7498 |
+ goto out; |
7499 |
+@@ -1035,8 +1043,19 @@ out_add_root: |
7500 |
+ goto out_free_path; |
7501 |
+ } |
7502 |
+ |
7503 |
++ mutex_unlock(&fs_info->qgroup_ioctl_lock); |
7504 |
++ /* |
7505 |
++ * Commit the transaction while not holding qgroup_ioctl_lock, to avoid |
7506 |
++ * a deadlock with tasks concurrently doing other qgroup operations, such |
7507 |
++ * adding/removing qgroups or adding/deleting qgroup relations for example, |
7508 |
++ * because all qgroup operations first start or join a transaction and then |
7509 |
++ * lock the qgroup_ioctl_lock mutex. |
7510 |
++ * We are safe from a concurrent task trying to enable quotas, by calling |
7511 |
++ * this function, since we are serialized by fs_info->subvol_sem. |
7512 |
++ */ |
7513 |
+ ret = btrfs_commit_transaction(trans); |
7514 |
+ trans = NULL; |
7515 |
++ mutex_lock(&fs_info->qgroup_ioctl_lock); |
7516 |
+ if (ret) |
7517 |
+ goto out_free_path; |
7518 |
+ |
7519 |
+diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c |
7520 |
+index a32c5c7dcfd89..da87615ad69a7 100644 |
7521 |
+--- a/fs/debugfs/file.c |
7522 |
++++ b/fs/debugfs/file.c |
7523 |
+@@ -146,7 +146,7 @@ static int debugfs_locked_down(struct inode *inode, |
7524 |
+ struct file *filp, |
7525 |
+ const struct file_operations *real_fops) |
7526 |
+ { |
7527 |
+- if ((inode->i_mode & 07777) == 0444 && |
7528 |
++ if ((inode->i_mode & 07777 & ~0444) == 0 && |
7529 |
+ !(filp->f_mode & FMODE_WRITE) && |
7530 |
+ !real_fops->unlocked_ioctl && |
7531 |
+ !real_fops->compat_ioctl && |
7532 |
+diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c |
7533 |
+index 18d81599522f3..53500b555bfa8 100644 |
7534 |
+--- a/fs/dlm/lock.c |
7535 |
++++ b/fs/dlm/lock.c |
7536 |
+@@ -3975,6 +3975,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
7537 |
+ int from = ms->m_header.h_nodeid; |
7538 |
+ int error = 0; |
7539 |
+ |
7540 |
++ /* currently mixing of user/kernel locks are not supported */ |
7541 |
++ if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { |
7542 |
++ log_error(lkb->lkb_resource->res_ls, |
7543 |
++ "got user dlm message for a kernel lock"); |
7544 |
++ error = -EINVAL; |
7545 |
++ goto out; |
7546 |
++ } |
7547 |
++ |
7548 |
+ switch (ms->m_type) { |
7549 |
+ case DLM_MSG_CONVERT: |
7550 |
+ case DLM_MSG_UNLOCK: |
7551 |
+@@ -4003,6 +4011,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
7552 |
+ error = -EINVAL; |
7553 |
+ } |
7554 |
+ |
7555 |
++out: |
7556 |
+ if (error) |
7557 |
+ log_error(lkb->lkb_resource->res_ls, |
7558 |
+ "ignore invalid message %d from %d %x %x %x %d", |
7559 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
7560 |
+index ba13fbb443d58..9fa20f9ba52b5 100644 |
7561 |
+--- a/fs/ext4/ioctl.c |
7562 |
++++ b/fs/ext4/ioctl.c |
7563 |
+@@ -1120,8 +1120,6 @@ resizefs_out: |
7564 |
+ sizeof(range))) |
7565 |
+ return -EFAULT; |
7566 |
+ |
7567 |
+- range.minlen = max((unsigned int)range.minlen, |
7568 |
+- q->limits.discard_granularity); |
7569 |
+ ret = ext4_trim_fs(sb, &range); |
7570 |
+ if (ret < 0) |
7571 |
+ return ret; |
7572 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
7573 |
+index b67ea979f0cf7..0307702d114db 100644 |
7574 |
+--- a/fs/ext4/mballoc.c |
7575 |
++++ b/fs/ext4/mballoc.c |
7576 |
+@@ -5270,6 +5270,7 @@ out: |
7577 |
+ */ |
7578 |
+ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
7579 |
+ { |
7580 |
++ struct request_queue *q = bdev_get_queue(sb->s_bdev); |
7581 |
+ struct ext4_group_info *grp; |
7582 |
+ ext4_group_t group, first_group, last_group; |
7583 |
+ ext4_grpblk_t cnt = 0, first_cluster, last_cluster; |
7584 |
+@@ -5288,6 +5289,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
7585 |
+ start >= max_blks || |
7586 |
+ range->len < sb->s_blocksize) |
7587 |
+ return -EINVAL; |
7588 |
++ /* No point to try to trim less than discard granularity */ |
7589 |
++ if (range->minlen < q->limits.discard_granularity) { |
7590 |
++ minlen = EXT4_NUM_B2C(EXT4_SB(sb), |
7591 |
++ q->limits.discard_granularity >> sb->s_blocksize_bits); |
7592 |
++ if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) |
7593 |
++ goto out; |
7594 |
++ } |
7595 |
+ if (end >= max_blks) |
7596 |
+ end = max_blks - 1; |
7597 |
+ if (end <= first_data_blk) |
7598 |
+diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
7599 |
+index be4ee3dcc5cf5..c5b2ea1a93729 100644 |
7600 |
+--- a/fs/ext4/migrate.c |
7601 |
++++ b/fs/ext4/migrate.c |
7602 |
+@@ -455,12 +455,12 @@ int ext4_ext_migrate(struct inode *inode) |
7603 |
+ percpu_down_write(&sbi->s_writepages_rwsem); |
7604 |
+ |
7605 |
+ /* |
7606 |
+- * Worst case we can touch the allocation bitmaps, a bgd |
7607 |
+- * block, and a block to link in the orphan list. We do need |
7608 |
+- * need to worry about credits for modifying the quota inode. |
7609 |
++ * Worst case we can touch the allocation bitmaps and a block |
7610 |
++ * group descriptor block. We do need need to worry about |
7611 |
++ * credits for modifying the quota inode. |
7612 |
+ */ |
7613 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, |
7614 |
+- 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
7615 |
++ 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
7616 |
+ |
7617 |
+ if (IS_ERR(handle)) { |
7618 |
+ retval = PTR_ERR(handle); |
7619 |
+@@ -477,6 +477,13 @@ int ext4_ext_migrate(struct inode *inode) |
7620 |
+ ext4_journal_stop(handle); |
7621 |
+ goto out_unlock; |
7622 |
+ } |
7623 |
++ /* |
7624 |
++ * Use the correct seed for checksum (i.e. the seed from 'inode'). This |
7625 |
++ * is so that the metadata blocks will have the correct checksum after |
7626 |
++ * the migration. |
7627 |
++ */ |
7628 |
++ ei = EXT4_I(inode); |
7629 |
++ EXT4_I(tmp_inode)->i_csum_seed = ei->i_csum_seed; |
7630 |
+ i_size_write(tmp_inode, i_size_read(inode)); |
7631 |
+ /* |
7632 |
+ * Set the i_nlink to zero so it will be deleted later |
7633 |
+@@ -485,7 +492,6 @@ int ext4_ext_migrate(struct inode *inode) |
7634 |
+ clear_nlink(tmp_inode); |
7635 |
+ |
7636 |
+ ext4_ext_tree_init(handle, tmp_inode); |
7637 |
+- ext4_orphan_add(handle, tmp_inode); |
7638 |
+ ext4_journal_stop(handle); |
7639 |
+ |
7640 |
+ /* |
7641 |
+@@ -510,17 +516,10 @@ int ext4_ext_migrate(struct inode *inode) |
7642 |
+ |
7643 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); |
7644 |
+ if (IS_ERR(handle)) { |
7645 |
+- /* |
7646 |
+- * It is impossible to update on-disk structures without |
7647 |
+- * a handle, so just rollback in-core changes and live other |
7648 |
+- * work to orphan_list_cleanup() |
7649 |
+- */ |
7650 |
+- ext4_orphan_del(NULL, tmp_inode); |
7651 |
+ retval = PTR_ERR(handle); |
7652 |
+ goto out_tmp_inode; |
7653 |
+ } |
7654 |
+ |
7655 |
+- ei = EXT4_I(inode); |
7656 |
+ i_data = ei->i_data; |
7657 |
+ memset(&lb, 0, sizeof(lb)); |
7658 |
+ |
7659 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
7660 |
+index f68dfef5939f4..5bc7fd0240a19 100644 |
7661 |
+--- a/fs/ext4/super.c |
7662 |
++++ b/fs/ext4/super.c |
7663 |
+@@ -5912,10 +5912,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
7664 |
+ |
7665 |
+ lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); |
7666 |
+ err = dquot_quota_on(sb, type, format_id, path); |
7667 |
+- if (err) { |
7668 |
+- lockdep_set_quota_inode(path->dentry->d_inode, |
7669 |
+- I_DATA_SEM_NORMAL); |
7670 |
+- } else { |
7671 |
++ if (!err) { |
7672 |
+ struct inode *inode = d_inode(path->dentry); |
7673 |
+ handle_t *handle; |
7674 |
+ |
7675 |
+@@ -5935,7 +5932,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
7676 |
+ ext4_journal_stop(handle); |
7677 |
+ unlock_inode: |
7678 |
+ inode_unlock(inode); |
7679 |
++ if (err) |
7680 |
++ dquot_quota_off(sb, type); |
7681 |
+ } |
7682 |
++ if (err) |
7683 |
++ lockdep_set_quota_inode(path->dentry->d_inode, |
7684 |
++ I_DATA_SEM_NORMAL); |
7685 |
+ return err; |
7686 |
+ } |
7687 |
+ |
7688 |
+@@ -5998,8 +6000,19 @@ static int ext4_enable_quotas(struct super_block *sb) |
7689 |
+ "Failed to enable quota tracking " |
7690 |
+ "(type=%d, err=%d). Please run " |
7691 |
+ "e2fsck to fix.", type, err); |
7692 |
+- for (type--; type >= 0; type--) |
7693 |
++ for (type--; type >= 0; type--) { |
7694 |
++ struct inode *inode; |
7695 |
++ |
7696 |
++ inode = sb_dqopt(sb)->files[type]; |
7697 |
++ if (inode) |
7698 |
++ inode = igrab(inode); |
7699 |
+ dquot_quota_off(sb, type); |
7700 |
++ if (inode) { |
7701 |
++ lockdep_set_quota_inode(inode, |
7702 |
++ I_DATA_SEM_NORMAL); |
7703 |
++ iput(inode); |
7704 |
++ } |
7705 |
++ } |
7706 |
+ |
7707 |
+ return err; |
7708 |
+ } |
7709 |
+@@ -6101,7 +6114,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, |
7710 |
+ struct buffer_head *bh; |
7711 |
+ handle_t *handle = journal_current_handle(); |
7712 |
+ |
7713 |
+- if (EXT4_SB(sb)->s_journal && !handle) { |
7714 |
++ if (!handle) { |
7715 |
+ ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" |
7716 |
+ " cancelled because transaction is not started", |
7717 |
+ (unsigned long long)off, (unsigned long long)len); |
7718 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
7719 |
+index 031a17bf52a24..5645502c156df 100644 |
7720 |
+--- a/fs/f2fs/f2fs.h |
7721 |
++++ b/fs/f2fs/f2fs.h |
7722 |
+@@ -931,6 +931,7 @@ struct f2fs_sm_info { |
7723 |
+ unsigned int segment_count; /* total # of segments */ |
7724 |
+ unsigned int main_segments; /* # of segments in main area */ |
7725 |
+ unsigned int reserved_segments; /* # of reserved segments */ |
7726 |
++ unsigned int additional_reserved_segments;/* reserved segs for IO align feature */ |
7727 |
+ unsigned int ovp_segments; /* # of overprovision segments */ |
7728 |
+ |
7729 |
+ /* a threshold to reclaim prefree segments */ |
7730 |
+@@ -1800,6 +1801,11 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, |
7731 |
+ |
7732 |
+ if (!__allow_reserved_blocks(sbi, inode, true)) |
7733 |
+ avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks; |
7734 |
++ |
7735 |
++ if (F2FS_IO_ALIGNED(sbi)) |
7736 |
++ avail_user_block_count -= sbi->blocks_per_seg * |
7737 |
++ SM_I(sbi)->additional_reserved_segments; |
7738 |
++ |
7739 |
+ if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { |
7740 |
+ if (avail_user_block_count > sbi->unusable_block_count) |
7741 |
+ avail_user_block_count -= sbi->unusable_block_count; |
7742 |
+@@ -2045,6 +2051,11 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi, |
7743 |
+ |
7744 |
+ if (!__allow_reserved_blocks(sbi, inode, false)) |
7745 |
+ valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks; |
7746 |
++ |
7747 |
++ if (F2FS_IO_ALIGNED(sbi)) |
7748 |
++ valid_block_count += sbi->blocks_per_seg * |
7749 |
++ SM_I(sbi)->additional_reserved_segments; |
7750 |
++ |
7751 |
+ user_block_count = sbi->user_block_count; |
7752 |
+ if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) |
7753 |
+ user_block_count -= sbi->unusable_block_count; |
7754 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
7755 |
+index 4b6c36208f552..16abb017e497f 100644 |
7756 |
+--- a/fs/f2fs/gc.c |
7757 |
++++ b/fs/f2fs/gc.c |
7758 |
+@@ -633,6 +633,9 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, |
7759 |
+ set_sbi_flag(sbi, SBI_NEED_FSCK); |
7760 |
+ } |
7761 |
+ |
7762 |
++ if (f2fs_check_nid_range(sbi, dni->ino)) |
7763 |
++ return false; |
7764 |
++ |
7765 |
+ *nofs = ofs_of_node(node_page); |
7766 |
+ source_blkaddr = datablock_addr(NULL, node_page, ofs_in_node); |
7767 |
+ f2fs_put_page(node_page, 1); |
7768 |
+diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h |
7769 |
+index 2034b9a07d632..15b343f656093 100644 |
7770 |
+--- a/fs/f2fs/segment.h |
7771 |
++++ b/fs/f2fs/segment.h |
7772 |
+@@ -508,7 +508,8 @@ static inline unsigned int free_segments(struct f2fs_sb_info *sbi) |
7773 |
+ |
7774 |
+ static inline int reserved_segments(struct f2fs_sb_info *sbi) |
7775 |
+ { |
7776 |
+- return SM_I(sbi)->reserved_segments; |
7777 |
++ return SM_I(sbi)->reserved_segments + |
7778 |
++ SM_I(sbi)->additional_reserved_segments; |
7779 |
+ } |
7780 |
+ |
7781 |
+ static inline unsigned int free_sections(struct f2fs_sb_info *sbi) |
7782 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
7783 |
+index 41bf656658ba8..a6c9c9fdf21d1 100644 |
7784 |
+--- a/fs/f2fs/super.c |
7785 |
++++ b/fs/f2fs/super.c |
7786 |
+@@ -277,6 +277,46 @@ static inline void limit_reserve_root(struct f2fs_sb_info *sbi) |
7787 |
+ F2FS_OPTION(sbi).s_resgid)); |
7788 |
+ } |
7789 |
+ |
7790 |
++static inline int adjust_reserved_segment(struct f2fs_sb_info *sbi) |
7791 |
++{ |
7792 |
++ unsigned int sec_blks = sbi->blocks_per_seg * sbi->segs_per_sec; |
7793 |
++ unsigned int avg_vblocks; |
7794 |
++ unsigned int wanted_reserved_segments; |
7795 |
++ block_t avail_user_block_count; |
7796 |
++ |
7797 |
++ if (!F2FS_IO_ALIGNED(sbi)) |
7798 |
++ return 0; |
7799 |
++ |
7800 |
++ /* average valid block count in section in worst case */ |
7801 |
++ avg_vblocks = sec_blks / F2FS_IO_SIZE(sbi); |
7802 |
++ |
7803 |
++ /* |
7804 |
++ * we need enough free space when migrating one section in worst case |
7805 |
++ */ |
7806 |
++ wanted_reserved_segments = (F2FS_IO_SIZE(sbi) / avg_vblocks) * |
7807 |
++ reserved_segments(sbi); |
7808 |
++ wanted_reserved_segments -= reserved_segments(sbi); |
7809 |
++ |
7810 |
++ avail_user_block_count = sbi->user_block_count - |
7811 |
++ sbi->current_reserved_blocks - |
7812 |
++ F2FS_OPTION(sbi).root_reserved_blocks; |
7813 |
++ |
7814 |
++ if (wanted_reserved_segments * sbi->blocks_per_seg > |
7815 |
++ avail_user_block_count) { |
7816 |
++ f2fs_err(sbi, "IO align feature can't grab additional reserved segment: %u, available segments: %u", |
7817 |
++ wanted_reserved_segments, |
7818 |
++ avail_user_block_count >> sbi->log_blocks_per_seg); |
7819 |
++ return -ENOSPC; |
7820 |
++ } |
7821 |
++ |
7822 |
++ SM_I(sbi)->additional_reserved_segments = wanted_reserved_segments; |
7823 |
++ |
7824 |
++ f2fs_info(sbi, "IO align feature needs additional reserved segment: %u", |
7825 |
++ wanted_reserved_segments); |
7826 |
++ |
7827 |
++ return 0; |
7828 |
++} |
7829 |
++ |
7830 |
+ static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) |
7831 |
+ { |
7832 |
+ if (!F2FS_OPTION(sbi).unusable_cap_perc) |
7833 |
+@@ -3450,6 +3490,10 @@ try_onemore: |
7834 |
+ goto free_nm; |
7835 |
+ } |
7836 |
+ |
7837 |
++ err = adjust_reserved_segment(sbi); |
7838 |
++ if (err) |
7839 |
++ goto free_nm; |
7840 |
++ |
7841 |
+ /* For write statistics */ |
7842 |
+ if (sb->s_bdev->bd_part) |
7843 |
+ sbi->sectors_written_start = |
7844 |
+diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c |
7845 |
+index 3a5360e045cfd..84bb376650935 100644 |
7846 |
+--- a/fs/f2fs/sysfs.c |
7847 |
++++ b/fs/f2fs/sysfs.c |
7848 |
+@@ -262,7 +262,9 @@ out: |
7849 |
+ if (a->struct_type == RESERVED_BLOCKS) { |
7850 |
+ spin_lock(&sbi->stat_lock); |
7851 |
+ if (t > (unsigned long)(sbi->user_block_count - |
7852 |
+- F2FS_OPTION(sbi).root_reserved_blocks)) { |
7853 |
++ F2FS_OPTION(sbi).root_reserved_blocks - |
7854 |
++ sbi->blocks_per_seg * |
7855 |
++ SM_I(sbi)->additional_reserved_segments)) { |
7856 |
+ spin_unlock(&sbi->stat_lock); |
7857 |
+ return -EINVAL; |
7858 |
+ } |
7859 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
7860 |
+index 1de59998e0e75..5cf13196ce69e 100644 |
7861 |
+--- a/fs/fuse/file.c |
7862 |
++++ b/fs/fuse/file.c |
7863 |
+@@ -3188,7 +3188,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
7864 |
+ |
7865 |
+ static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end) |
7866 |
+ { |
7867 |
+- int err = filemap_write_and_wait_range(inode->i_mapping, start, -1); |
7868 |
++ int err = filemap_write_and_wait_range(inode->i_mapping, start, LLONG_MAX); |
7869 |
+ |
7870 |
+ if (!err) |
7871 |
+ fuse_sync_writes(inode); |
7872 |
+diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c |
7873 |
+index f8fb89b10227c..34880a4c21732 100644 |
7874 |
+--- a/fs/jffs2/file.c |
7875 |
++++ b/fs/jffs2/file.c |
7876 |
+@@ -135,20 +135,15 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
7877 |
+ struct page *pg; |
7878 |
+ struct inode *inode = mapping->host; |
7879 |
+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
7880 |
++ struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
7881 |
+ pgoff_t index = pos >> PAGE_SHIFT; |
7882 |
+ uint32_t pageofs = index << PAGE_SHIFT; |
7883 |
+ int ret = 0; |
7884 |
+ |
7885 |
+- pg = grab_cache_page_write_begin(mapping, index, flags); |
7886 |
+- if (!pg) |
7887 |
+- return -ENOMEM; |
7888 |
+- *pagep = pg; |
7889 |
+- |
7890 |
+ jffs2_dbg(1, "%s()\n", __func__); |
7891 |
+ |
7892 |
+ if (pageofs > inode->i_size) { |
7893 |
+ /* Make new hole frag from old EOF to new page */ |
7894 |
+- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
7895 |
+ struct jffs2_raw_inode ri; |
7896 |
+ struct jffs2_full_dnode *fn; |
7897 |
+ uint32_t alloc_len; |
7898 |
+@@ -159,7 +154,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
7899 |
+ ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, |
7900 |
+ ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
7901 |
+ if (ret) |
7902 |
+- goto out_page; |
7903 |
++ goto out_err; |
7904 |
+ |
7905 |
+ mutex_lock(&f->sem); |
7906 |
+ memset(&ri, 0, sizeof(ri)); |
7907 |
+@@ -189,7 +184,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
7908 |
+ ret = PTR_ERR(fn); |
7909 |
+ jffs2_complete_reservation(c); |
7910 |
+ mutex_unlock(&f->sem); |
7911 |
+- goto out_page; |
7912 |
++ goto out_err; |
7913 |
+ } |
7914 |
+ ret = jffs2_add_full_dnode_to_inode(c, f, fn); |
7915 |
+ if (f->metadata) { |
7916 |
+@@ -204,13 +199,26 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
7917 |
+ jffs2_free_full_dnode(fn); |
7918 |
+ jffs2_complete_reservation(c); |
7919 |
+ mutex_unlock(&f->sem); |
7920 |
+- goto out_page; |
7921 |
++ goto out_err; |
7922 |
+ } |
7923 |
+ jffs2_complete_reservation(c); |
7924 |
+ inode->i_size = pageofs; |
7925 |
+ mutex_unlock(&f->sem); |
7926 |
+ } |
7927 |
+ |
7928 |
++ /* |
7929 |
++ * While getting a page and reading data in, lock c->alloc_sem until |
7930 |
++ * the page is Uptodate. Otherwise GC task may attempt to read the same |
7931 |
++ * page in read_cache_page(), which causes a deadlock. |
7932 |
++ */ |
7933 |
++ mutex_lock(&c->alloc_sem); |
7934 |
++ pg = grab_cache_page_write_begin(mapping, index, flags); |
7935 |
++ if (!pg) { |
7936 |
++ ret = -ENOMEM; |
7937 |
++ goto release_sem; |
7938 |
++ } |
7939 |
++ *pagep = pg; |
7940 |
++ |
7941 |
+ /* |
7942 |
+ * Read in the page if it wasn't already present. Cannot optimize away |
7943 |
+ * the whole page write case until jffs2_write_end can handle the |
7944 |
+@@ -220,15 +228,17 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, |
7945 |
+ mutex_lock(&f->sem); |
7946 |
+ ret = jffs2_do_readpage_nolock(inode, pg); |
7947 |
+ mutex_unlock(&f->sem); |
7948 |
+- if (ret) |
7949 |
+- goto out_page; |
7950 |
++ if (ret) { |
7951 |
++ unlock_page(pg); |
7952 |
++ put_page(pg); |
7953 |
++ goto release_sem; |
7954 |
++ } |
7955 |
+ } |
7956 |
+ jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); |
7957 |
+- return ret; |
7958 |
+ |
7959 |
+-out_page: |
7960 |
+- unlock_page(pg); |
7961 |
+- put_page(pg); |
7962 |
++release_sem: |
7963 |
++ mutex_unlock(&c->alloc_sem); |
7964 |
++out_err: |
7965 |
+ return ret; |
7966 |
+ } |
7967 |
+ |
7968 |
+diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c |
7969 |
+index 2cbc3c36f3a8c..b37c6b1e33253 100644 |
7970 |
+--- a/fs/ubifs/super.c |
7971 |
++++ b/fs/ubifs/super.c |
7972 |
+@@ -1835,7 +1835,6 @@ out: |
7973 |
+ kthread_stop(c->bgt); |
7974 |
+ c->bgt = NULL; |
7975 |
+ } |
7976 |
+- free_wbufs(c); |
7977 |
+ kfree(c->write_reserve_buf); |
7978 |
+ c->write_reserve_buf = NULL; |
7979 |
+ vfree(c->ileb_buf); |
7980 |
+diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h |
7981 |
+index 9373662cdb44f..ff5fecff51167 100644 |
7982 |
+--- a/include/acpi/actypes.h |
7983 |
++++ b/include/acpi/actypes.h |
7984 |
+@@ -536,8 +536,14 @@ typedef u64 acpi_integer; |
7985 |
+ * Can be used with access_width of struct acpi_generic_address and access_size of |
7986 |
+ * struct acpi_resource_generic_register. |
7987 |
+ */ |
7988 |
+-#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) |
7989 |
+-#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) |
7990 |
++#define ACPI_ACCESS_BIT_SHIFT 2 |
7991 |
++#define ACPI_ACCESS_BYTE_SHIFT -1 |
7992 |
++#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) |
7993 |
++#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) |
7994 |
++#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) |
7995 |
++#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) |
7996 |
++#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) |
7997 |
++#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) |
7998 |
+ |
7999 |
+ /******************************************************************************* |
8000 |
+ * |
8001 |
+diff --git a/include/linux/hid.h b/include/linux/hid.h |
8002 |
+index ad46ed41e8836..d5f9bbf8afa51 100644 |
8003 |
+--- a/include/linux/hid.h |
8004 |
++++ b/include/linux/hid.h |
8005 |
+@@ -344,6 +344,8 @@ struct hid_item { |
8006 |
+ /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ |
8007 |
+ #define HID_QUIRK_ALWAYS_POLL BIT(10) |
8008 |
+ #define HID_QUIRK_INPUT_PER_APP BIT(11) |
8009 |
++#define HID_QUIRK_X_INVERT BIT(12) |
8010 |
++#define HID_QUIRK_Y_INVERT BIT(13) |
8011 |
+ #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) |
8012 |
+ #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) |
8013 |
+ #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) |
8014 |
+diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h |
8015 |
+index a90aba3d6afb4..bc8a70a7c5a13 100644 |
8016 |
+--- a/include/linux/mmzone.h |
8017 |
++++ b/include/linux/mmzone.h |
8018 |
+@@ -929,6 +929,15 @@ static inline int is_highmem_idx(enum zone_type idx) |
8019 |
+ #endif |
8020 |
+ } |
8021 |
+ |
8022 |
++#ifdef CONFIG_ZONE_DMA |
8023 |
++bool has_managed_dma(void); |
8024 |
++#else |
8025 |
++static inline bool has_managed_dma(void) |
8026 |
++{ |
8027 |
++ return false; |
8028 |
++} |
8029 |
++#endif |
8030 |
++ |
8031 |
+ /** |
8032 |
+ * is_highmem - helper function to quickly check if a struct zone is a |
8033 |
+ * highmem zone or not. This is an attempt to keep references |
8034 |
+diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h |
8035 |
+index bac79e817776c..4cbd413e71a3f 100644 |
8036 |
+--- a/include/net/inet_frag.h |
8037 |
++++ b/include/net/inet_frag.h |
8038 |
+@@ -116,8 +116,15 @@ int fqdir_init(struct fqdir **fqdirp, struct inet_frags *f, struct net *net); |
8039 |
+ |
8040 |
+ static inline void fqdir_pre_exit(struct fqdir *fqdir) |
8041 |
+ { |
8042 |
+- fqdir->high_thresh = 0; /* prevent creation of new frags */ |
8043 |
+- fqdir->dead = true; |
8044 |
++ /* Prevent creation of new frags. |
8045 |
++ * Pairs with READ_ONCE() in inet_frag_find(). |
8046 |
++ */ |
8047 |
++ WRITE_ONCE(fqdir->high_thresh, 0); |
8048 |
++ |
8049 |
++ /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() |
8050 |
++ * and ip6frag_expire_frag_queue(). |
8051 |
++ */ |
8052 |
++ WRITE_ONCE(fqdir->dead, true); |
8053 |
+ } |
8054 |
+ void fqdir_exit(struct fqdir *fqdir); |
8055 |
+ |
8056 |
+diff --git a/include/net/ipv6_frag.h b/include/net/ipv6_frag.h |
8057 |
+index a21e8b1381a10..e47a946bb77c9 100644 |
8058 |
+--- a/include/net/ipv6_frag.h |
8059 |
++++ b/include/net/ipv6_frag.h |
8060 |
+@@ -67,7 +67,8 @@ ip6frag_expire_frag_queue(struct net *net, struct frag_queue *fq) |
8061 |
+ struct sk_buff *head; |
8062 |
+ |
8063 |
+ rcu_read_lock(); |
8064 |
+- if (fq->q.fqdir->dead) |
8065 |
++ /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ |
8066 |
++ if (READ_ONCE(fq->q.fqdir->dead)) |
8067 |
+ goto out_rcu_unlock; |
8068 |
+ spin_lock(&fq->q.lock); |
8069 |
+ |
8070 |
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
8071 |
+index 939fda8f97215..ae69059ba76d4 100644 |
8072 |
+--- a/include/net/sch_generic.h |
8073 |
++++ b/include/net/sch_generic.h |
8074 |
+@@ -1264,6 +1264,7 @@ struct psched_ratecfg { |
8075 |
+ u64 rate_bytes_ps; /* bytes per second */ |
8076 |
+ u32 mult; |
8077 |
+ u16 overhead; |
8078 |
++ u16 mpu; |
8079 |
+ u8 linklayer; |
8080 |
+ u8 shift; |
8081 |
+ }; |
8082 |
+@@ -1273,6 +1274,9 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, |
8083 |
+ { |
8084 |
+ len += r->overhead; |
8085 |
+ |
8086 |
++ if (len < r->mpu) |
8087 |
++ len = r->mpu; |
8088 |
++ |
8089 |
+ if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) |
8090 |
+ return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; |
8091 |
+ |
8092 |
+@@ -1295,6 +1299,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, |
8093 |
+ res->rate = min_t(u64, r->rate_bytes_ps, ~0U); |
8094 |
+ |
8095 |
+ res->overhead = r->overhead; |
8096 |
++ res->mpu = r->mpu; |
8097 |
+ res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); |
8098 |
+ } |
8099 |
+ |
8100 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
8101 |
+index d67fce9e3f8b8..146edff0c73ec 100644 |
8102 |
+--- a/kernel/audit.c |
8103 |
++++ b/kernel/audit.c |
8104 |
+@@ -1528,6 +1528,20 @@ static void audit_receive(struct sk_buff *skb) |
8105 |
+ nlh = nlmsg_next(nlh, &len); |
8106 |
+ } |
8107 |
+ audit_ctl_unlock(); |
8108 |
++ |
8109 |
++ /* can't block with the ctrl lock, so penalize the sender now */ |
8110 |
++ if (audit_backlog_limit && |
8111 |
++ (skb_queue_len(&audit_queue) > audit_backlog_limit)) { |
8112 |
++ DECLARE_WAITQUEUE(wait, current); |
8113 |
++ |
8114 |
++ /* wake kauditd to try and flush the queue */ |
8115 |
++ wake_up_interruptible(&kauditd_wait); |
8116 |
++ |
8117 |
++ add_wait_queue_exclusive(&audit_backlog_wait, &wait); |
8118 |
++ set_current_state(TASK_UNINTERRUPTIBLE); |
8119 |
++ schedule_timeout(audit_backlog_wait_time); |
8120 |
++ remove_wait_queue(&audit_backlog_wait, &wait); |
8121 |
++ } |
8122 |
+ } |
8123 |
+ |
8124 |
+ /* Run custom bind function on netlink socket group connect or bind requests. */ |
8125 |
+@@ -1772,7 +1786,9 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, |
8126 |
+ * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() |
8127 |
+ * using a PID anchored in the caller's namespace |
8128 |
+ * 2. generator holding the audit_cmd_mutex - we don't want to block |
8129 |
+- * while holding the mutex */ |
8130 |
++ * while holding the mutex, although we do penalize the sender |
8131 |
++ * later in audit_receive() when it is safe to block |
8132 |
++ */ |
8133 |
+ if (!(auditd_test_task(current) || audit_ctl_owner_current())) { |
8134 |
+ long stime = audit_backlog_wait_time; |
8135 |
+ |
8136 |
+diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h |
8137 |
+index 4c4d7683a4e5b..173e3ce607900 100644 |
8138 |
+--- a/kernel/rcu/tree_exp.h |
8139 |
++++ b/kernel/rcu/tree_exp.h |
8140 |
+@@ -382,6 +382,7 @@ retry_ipi: |
8141 |
+ continue; |
8142 |
+ } |
8143 |
+ if (get_cpu() == cpu) { |
8144 |
++ mask_ofl_test |= mask; |
8145 |
+ put_cpu(); |
8146 |
+ continue; |
8147 |
+ } |
8148 |
+diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c |
8149 |
+index 46ed4e1383e21..66188567778de 100644 |
8150 |
+--- a/kernel/sched/cputime.c |
8151 |
++++ b/kernel/sched/cputime.c |
8152 |
+@@ -147,10 +147,10 @@ void account_guest_time(struct task_struct *p, u64 cputime) |
8153 |
+ |
8154 |
+ /* Add guest time to cpustat. */ |
8155 |
+ if (task_nice(p) > 0) { |
8156 |
+- cpustat[CPUTIME_NICE] += cputime; |
8157 |
++ task_group_account_field(p, CPUTIME_NICE, cputime); |
8158 |
+ cpustat[CPUTIME_GUEST_NICE] += cputime; |
8159 |
+ } else { |
8160 |
+- cpustat[CPUTIME_USER] += cputime; |
8161 |
++ task_group_account_field(p, CPUTIME_USER, cputime); |
8162 |
+ cpustat[CPUTIME_GUEST] += cputime; |
8163 |
+ } |
8164 |
+ } |
8165 |
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
8166 |
+index 2dffb8762e16b..28c82dee13ea9 100644 |
8167 |
+--- a/kernel/sched/rt.c |
8168 |
++++ b/kernel/sched/rt.c |
8169 |
+@@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime) |
8170 |
+ rt_b->rt_period_timer.function = sched_rt_period_timer; |
8171 |
+ } |
8172 |
+ |
8173 |
+-static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
8174 |
++static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) |
8175 |
+ { |
8176 |
+- if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
8177 |
+- return; |
8178 |
+- |
8179 |
+ raw_spin_lock(&rt_b->rt_runtime_lock); |
8180 |
+ if (!rt_b->rt_period_active) { |
8181 |
+ rt_b->rt_period_active = 1; |
8182 |
+@@ -75,6 +72,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
8183 |
+ raw_spin_unlock(&rt_b->rt_runtime_lock); |
8184 |
+ } |
8185 |
+ |
8186 |
++static void start_rt_bandwidth(struct rt_bandwidth *rt_b) |
8187 |
++{ |
8188 |
++ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
8189 |
++ return; |
8190 |
++ |
8191 |
++ do_start_rt_bandwidth(rt_b); |
8192 |
++} |
8193 |
++ |
8194 |
+ void init_rt_rq(struct rt_rq *rt_rq) |
8195 |
+ { |
8196 |
+ struct rt_prio_array *array; |
8197 |
+@@ -983,13 +988,17 @@ static void update_curr_rt(struct rq *rq) |
8198 |
+ |
8199 |
+ for_each_sched_rt_entity(rt_se) { |
8200 |
+ struct rt_rq *rt_rq = rt_rq_of_se(rt_se); |
8201 |
++ int exceeded; |
8202 |
+ |
8203 |
+ if (sched_rt_runtime(rt_rq) != RUNTIME_INF) { |
8204 |
+ raw_spin_lock(&rt_rq->rt_runtime_lock); |
8205 |
+ rt_rq->rt_time += delta_exec; |
8206 |
+- if (sched_rt_runtime_exceeded(rt_rq)) |
8207 |
++ exceeded = sched_rt_runtime_exceeded(rt_rq); |
8208 |
++ if (exceeded) |
8209 |
+ resched_curr(rq); |
8210 |
+ raw_spin_unlock(&rt_rq->rt_runtime_lock); |
8211 |
++ if (exceeded) |
8212 |
++ do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); |
8213 |
+ } |
8214 |
+ } |
8215 |
+ } |
8216 |
+@@ -2659,8 +2668,12 @@ static int sched_rt_global_validate(void) |
8217 |
+ |
8218 |
+ static void sched_rt_do_global(void) |
8219 |
+ { |
8220 |
++ unsigned long flags; |
8221 |
++ |
8222 |
++ raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); |
8223 |
+ def_rt_bandwidth.rt_runtime = global_rt_runtime(); |
8224 |
+ def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period()); |
8225 |
++ raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); |
8226 |
+ } |
8227 |
+ |
8228 |
+ int sched_rt_handler(struct ctl_table *table, int write, |
8229 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
8230 |
+index 5de084dab4fa6..13ccf2f28987e 100644 |
8231 |
+--- a/kernel/trace/trace_kprobe.c |
8232 |
++++ b/kernel/trace/trace_kprobe.c |
8233 |
+@@ -999,15 +999,18 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) |
8234 |
+ { |
8235 |
+ struct dyn_event *ev = v; |
8236 |
+ struct trace_kprobe *tk; |
8237 |
++ unsigned long nmissed; |
8238 |
+ |
8239 |
+ if (!is_trace_kprobe(ev)) |
8240 |
+ return 0; |
8241 |
+ |
8242 |
+ tk = to_trace_kprobe(ev); |
8243 |
++ nmissed = trace_kprobe_is_return(tk) ? |
8244 |
++ tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed; |
8245 |
+ seq_printf(m, " %-44s %15lu %15lu\n", |
8246 |
+ trace_probe_name(&tk->tp), |
8247 |
+ trace_kprobe_nhit(tk), |
8248 |
+- tk->rp.kp.nmissed); |
8249 |
++ nmissed); |
8250 |
+ |
8251 |
+ return 0; |
8252 |
+ } |
8253 |
+diff --git a/lib/test_meminit.c b/lib/test_meminit.c |
8254 |
+index 9742e5cb853aa..ab00c79423a5f 100644 |
8255 |
+--- a/lib/test_meminit.c |
8256 |
++++ b/lib/test_meminit.c |
8257 |
+@@ -319,6 +319,7 @@ static int __init do_kmem_cache_size_bulk(int size, int *total_failures) |
8258 |
+ if (num) |
8259 |
+ kmem_cache_free_bulk(c, num, objects); |
8260 |
+ } |
8261 |
++ kmem_cache_destroy(c); |
8262 |
+ *total_failures += fail; |
8263 |
+ return 1; |
8264 |
+ } |
8265 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
8266 |
+index 283ac9d9f6dd0..c3835915d1157 100644 |
8267 |
+--- a/mm/page_alloc.c |
8268 |
++++ b/mm/page_alloc.c |
8269 |
+@@ -3767,7 +3767,9 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...) |
8270 |
+ va_list args; |
8271 |
+ static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); |
8272 |
+ |
8273 |
+- if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) |
8274 |
++ if ((gfp_mask & __GFP_NOWARN) || |
8275 |
++ !__ratelimit(&nopage_rs) || |
8276 |
++ ((gfp_mask & __GFP_DMA) && !has_managed_dma())) |
8277 |
+ return; |
8278 |
+ |
8279 |
+ va_start(args, fmt); |
8280 |
+@@ -8694,3 +8696,18 @@ bool set_hwpoison_free_buddy_page(struct page *page) |
8281 |
+ return hwpoisoned; |
8282 |
+ } |
8283 |
+ #endif |
8284 |
++ |
8285 |
++#ifdef CONFIG_ZONE_DMA |
8286 |
++bool has_managed_dma(void) |
8287 |
++{ |
8288 |
++ struct pglist_data *pgdat; |
8289 |
++ |
8290 |
++ for_each_online_pgdat(pgdat) { |
8291 |
++ struct zone *zone = &pgdat->node_zones[ZONE_DMA]; |
8292 |
++ |
8293 |
++ if (managed_zone(zone)) |
8294 |
++ return true; |
8295 |
++ } |
8296 |
++ return false; |
8297 |
++} |
8298 |
++#endif /* CONFIG_ZONE_DMA */ |
8299 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
8300 |
+index b119c44435bff..aae2f408f9053 100644 |
8301 |
+--- a/mm/shmem.c |
8302 |
++++ b/mm/shmem.c |
8303 |
+@@ -466,7 +466,7 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
8304 |
+ struct shmem_inode_info *info; |
8305 |
+ struct page *page; |
8306 |
+ unsigned long batch = sc ? sc->nr_to_scan : 128; |
8307 |
+- int removed = 0, split = 0; |
8308 |
++ int split = 0; |
8309 |
+ |
8310 |
+ if (list_empty(&sbinfo->shrinklist)) |
8311 |
+ return SHRINK_STOP; |
8312 |
+@@ -481,7 +481,6 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
8313 |
+ /* inode is about to be evicted */ |
8314 |
+ if (!inode) { |
8315 |
+ list_del_init(&info->shrinklist); |
8316 |
+- removed++; |
8317 |
+ goto next; |
8318 |
+ } |
8319 |
+ |
8320 |
+@@ -489,12 +488,12 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
8321 |
+ if (round_up(inode->i_size, PAGE_SIZE) == |
8322 |
+ round_up(inode->i_size, HPAGE_PMD_SIZE)) { |
8323 |
+ list_move(&info->shrinklist, &to_remove); |
8324 |
+- removed++; |
8325 |
+ goto next; |
8326 |
+ } |
8327 |
+ |
8328 |
+ list_move(&info->shrinklist, &list); |
8329 |
+ next: |
8330 |
++ sbinfo->shrinklist_len--; |
8331 |
+ if (!--batch) |
8332 |
+ break; |
8333 |
+ } |
8334 |
+@@ -514,7 +513,7 @@ next: |
8335 |
+ inode = &info->vfs_inode; |
8336 |
+ |
8337 |
+ if (nr_to_split && split >= nr_to_split) |
8338 |
+- goto leave; |
8339 |
++ goto move_back; |
8340 |
+ |
8341 |
+ page = find_get_page(inode->i_mapping, |
8342 |
+ (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); |
8343 |
+@@ -528,38 +527,44 @@ next: |
8344 |
+ } |
8345 |
+ |
8346 |
+ /* |
8347 |
+- * Leave the inode on the list if we failed to lock |
8348 |
+- * the page at this time. |
8349 |
++ * Move the inode on the list back to shrinklist if we failed |
8350 |
++ * to lock the page at this time. |
8351 |
+ * |
8352 |
+ * Waiting for the lock may lead to deadlock in the |
8353 |
+ * reclaim path. |
8354 |
+ */ |
8355 |
+ if (!trylock_page(page)) { |
8356 |
+ put_page(page); |
8357 |
+- goto leave; |
8358 |
++ goto move_back; |
8359 |
+ } |
8360 |
+ |
8361 |
+ ret = split_huge_page(page); |
8362 |
+ unlock_page(page); |
8363 |
+ put_page(page); |
8364 |
+ |
8365 |
+- /* If split failed leave the inode on the list */ |
8366 |
++ /* If split failed move the inode on the list back to shrinklist */ |
8367 |
+ if (ret) |
8368 |
+- goto leave; |
8369 |
++ goto move_back; |
8370 |
+ |
8371 |
+ split++; |
8372 |
+ drop: |
8373 |
+ list_del_init(&info->shrinklist); |
8374 |
+- removed++; |
8375 |
+-leave: |
8376 |
++ goto put; |
8377 |
++move_back: |
8378 |
++ /* |
8379 |
++ * Make sure the inode is either on the global list or deleted |
8380 |
++ * from any local list before iput() since it could be deleted |
8381 |
++ * in another thread once we put the inode (then the local list |
8382 |
++ * is corrupted). |
8383 |
++ */ |
8384 |
++ spin_lock(&sbinfo->shrinklist_lock); |
8385 |
++ list_move(&info->shrinklist, &sbinfo->shrinklist); |
8386 |
++ sbinfo->shrinklist_len++; |
8387 |
++ spin_unlock(&sbinfo->shrinklist_lock); |
8388 |
++put: |
8389 |
+ iput(inode); |
8390 |
+ } |
8391 |
+ |
8392 |
+- spin_lock(&sbinfo->shrinklist_lock); |
8393 |
+- list_splice_tail(&list, &sbinfo->shrinklist); |
8394 |
+- sbinfo->shrinklist_len -= removed; |
8395 |
+- spin_unlock(&sbinfo->shrinklist_lock); |
8396 |
+- |
8397 |
+ return split; |
8398 |
+ } |
8399 |
+ |
8400 |
+diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c |
8401 |
+index 7e052d6f759b6..e59c5aa27ee0b 100644 |
8402 |
+--- a/net/batman-adv/netlink.c |
8403 |
++++ b/net/batman-adv/netlink.c |
8404 |
+@@ -1351,21 +1351,21 @@ static const struct genl_ops batadv_netlink_ops[] = { |
8405 |
+ { |
8406 |
+ .cmd = BATADV_CMD_TP_METER, |
8407 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8408 |
+- .flags = GENL_ADMIN_PERM, |
8409 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8410 |
+ .doit = batadv_netlink_tp_meter_start, |
8411 |
+ .internal_flags = BATADV_FLAG_NEED_MESH, |
8412 |
+ }, |
8413 |
+ { |
8414 |
+ .cmd = BATADV_CMD_TP_METER_CANCEL, |
8415 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8416 |
+- .flags = GENL_ADMIN_PERM, |
8417 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8418 |
+ .doit = batadv_netlink_tp_meter_cancel, |
8419 |
+ .internal_flags = BATADV_FLAG_NEED_MESH, |
8420 |
+ }, |
8421 |
+ { |
8422 |
+ .cmd = BATADV_CMD_GET_ROUTING_ALGOS, |
8423 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8424 |
+- .flags = GENL_ADMIN_PERM, |
8425 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8426 |
+ .dumpit = batadv_algo_dump, |
8427 |
+ }, |
8428 |
+ { |
8429 |
+@@ -1380,68 +1380,68 @@ static const struct genl_ops batadv_netlink_ops[] = { |
8430 |
+ { |
8431 |
+ .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, |
8432 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8433 |
+- .flags = GENL_ADMIN_PERM, |
8434 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8435 |
+ .dumpit = batadv_tt_local_dump, |
8436 |
+ }, |
8437 |
+ { |
8438 |
+ .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, |
8439 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8440 |
+- .flags = GENL_ADMIN_PERM, |
8441 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8442 |
+ .dumpit = batadv_tt_global_dump, |
8443 |
+ }, |
8444 |
+ { |
8445 |
+ .cmd = BATADV_CMD_GET_ORIGINATORS, |
8446 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8447 |
+- .flags = GENL_ADMIN_PERM, |
8448 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8449 |
+ .dumpit = batadv_orig_dump, |
8450 |
+ }, |
8451 |
+ { |
8452 |
+ .cmd = BATADV_CMD_GET_NEIGHBORS, |
8453 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8454 |
+- .flags = GENL_ADMIN_PERM, |
8455 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8456 |
+ .dumpit = batadv_hardif_neigh_dump, |
8457 |
+ }, |
8458 |
+ { |
8459 |
+ .cmd = BATADV_CMD_GET_GATEWAYS, |
8460 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8461 |
+- .flags = GENL_ADMIN_PERM, |
8462 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8463 |
+ .dumpit = batadv_gw_dump, |
8464 |
+ }, |
8465 |
+ { |
8466 |
+ .cmd = BATADV_CMD_GET_BLA_CLAIM, |
8467 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8468 |
+- .flags = GENL_ADMIN_PERM, |
8469 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8470 |
+ .dumpit = batadv_bla_claim_dump, |
8471 |
+ }, |
8472 |
+ { |
8473 |
+ .cmd = BATADV_CMD_GET_BLA_BACKBONE, |
8474 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8475 |
+- .flags = GENL_ADMIN_PERM, |
8476 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8477 |
+ .dumpit = batadv_bla_backbone_dump, |
8478 |
+ }, |
8479 |
+ { |
8480 |
+ .cmd = BATADV_CMD_GET_DAT_CACHE, |
8481 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8482 |
+- .flags = GENL_ADMIN_PERM, |
8483 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8484 |
+ .dumpit = batadv_dat_cache_dump, |
8485 |
+ }, |
8486 |
+ { |
8487 |
+ .cmd = BATADV_CMD_GET_MCAST_FLAGS, |
8488 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8489 |
+- .flags = GENL_ADMIN_PERM, |
8490 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8491 |
+ .dumpit = batadv_mcast_flags_dump, |
8492 |
+ }, |
8493 |
+ { |
8494 |
+ .cmd = BATADV_CMD_SET_MESH, |
8495 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8496 |
+- .flags = GENL_ADMIN_PERM, |
8497 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8498 |
+ .doit = batadv_netlink_set_mesh, |
8499 |
+ .internal_flags = BATADV_FLAG_NEED_MESH, |
8500 |
+ }, |
8501 |
+ { |
8502 |
+ .cmd = BATADV_CMD_SET_HARDIF, |
8503 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8504 |
+- .flags = GENL_ADMIN_PERM, |
8505 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8506 |
+ .doit = batadv_netlink_set_hardif, |
8507 |
+ .internal_flags = BATADV_FLAG_NEED_MESH | |
8508 |
+ BATADV_FLAG_NEED_HARDIF, |
8509 |
+@@ -1457,7 +1457,7 @@ static const struct genl_ops batadv_netlink_ops[] = { |
8510 |
+ { |
8511 |
+ .cmd = BATADV_CMD_SET_VLAN, |
8512 |
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
8513 |
+- .flags = GENL_ADMIN_PERM, |
8514 |
++ .flags = GENL_UNS_ADMIN_PERM, |
8515 |
+ .doit = batadv_netlink_set_vlan, |
8516 |
+ .internal_flags = BATADV_FLAG_NEED_MESH | |
8517 |
+ BATADV_FLAG_NEED_VLAN, |
8518 |
+diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c |
8519 |
+index 0a2d78e811cf5..83eb84e8e688f 100644 |
8520 |
+--- a/net/bluetooth/cmtp/core.c |
8521 |
++++ b/net/bluetooth/cmtp/core.c |
8522 |
+@@ -501,9 +501,7 @@ static int __init cmtp_init(void) |
8523 |
+ { |
8524 |
+ BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); |
8525 |
+ |
8526 |
+- cmtp_init_sockets(); |
8527 |
+- |
8528 |
+- return 0; |
8529 |
++ return cmtp_init_sockets(); |
8530 |
+ } |
8531 |
+ |
8532 |
+ static void __exit cmtp_exit(void) |
8533 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
8534 |
+index c50e3e8afbd34..2edaa601df13a 100644 |
8535 |
+--- a/net/bluetooth/hci_core.c |
8536 |
++++ b/net/bluetooth/hci_core.c |
8537 |
+@@ -3387,6 +3387,7 @@ int hci_register_dev(struct hci_dev *hdev) |
8538 |
+ return id; |
8539 |
+ |
8540 |
+ err_wqueue: |
8541 |
++ debugfs_remove_recursive(hdev->debugfs); |
8542 |
+ destroy_workqueue(hdev->workqueue); |
8543 |
+ destroy_workqueue(hdev->req_workqueue); |
8544 |
+ err: |
8545 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
8546 |
+index 31469ff084cd3..40f1593651e84 100644 |
8547 |
+--- a/net/bluetooth/hci_event.c |
8548 |
++++ b/net/bluetooth/hci_event.c |
8549 |
+@@ -5506,7 +5506,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
8550 |
+ struct hci_ev_le_advertising_info *ev = ptr; |
8551 |
+ s8 rssi; |
8552 |
+ |
8553 |
+- if (ev->length <= HCI_MAX_AD_LENGTH) { |
8554 |
++ if (ev->length <= HCI_MAX_AD_LENGTH && |
8555 |
++ ev->data + ev->length <= skb_tail_pointer(skb)) { |
8556 |
+ rssi = ev->data[ev->length]; |
8557 |
+ process_adv_report(hdev, ev->evt_type, &ev->bdaddr, |
8558 |
+ ev->bdaddr_type, NULL, 0, rssi, |
8559 |
+@@ -5516,6 +5517,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
8560 |
+ } |
8561 |
+ |
8562 |
+ ptr += sizeof(*ev) + ev->length + 1; |
8563 |
++ |
8564 |
++ if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { |
8565 |
++ bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); |
8566 |
++ break; |
8567 |
++ } |
8568 |
+ } |
8569 |
+ |
8570 |
+ hci_dev_unlock(hdev); |
8571 |
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
8572 |
+index 2371b833b2bcd..480e4111b24c1 100644 |
8573 |
+--- a/net/bridge/br_netfilter_hooks.c |
8574 |
++++ b/net/bridge/br_netfilter_hooks.c |
8575 |
+@@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
8576 |
+ if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) |
8577 |
+ mtu = nf_bridge->frag_max_size; |
8578 |
+ |
8579 |
++ nf_bridge_update_protocol(skb); |
8580 |
++ nf_bridge_push_encap_header(skb); |
8581 |
++ |
8582 |
+ if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { |
8583 |
+ nf_bridge_info_free(skb); |
8584 |
+ return br_dev_queue_push_xmit(net, sk, skb); |
8585 |
+@@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
8586 |
+ |
8587 |
+ IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; |
8588 |
+ |
8589 |
+- nf_bridge_update_protocol(skb); |
8590 |
+- |
8591 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
8592 |
+ |
8593 |
+ if (skb_vlan_tag_present(skb)) { |
8594 |
+@@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
8595 |
+ |
8596 |
+ IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; |
8597 |
+ |
8598 |
+- nf_bridge_update_protocol(skb); |
8599 |
+- |
8600 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
8601 |
+ data->encap_size = nf_bridge_encap_header_len(skb); |
8602 |
+ data->size = ETH_HLEN + data->encap_size; |
8603 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
8604 |
+index 5ebc973ed4c50..92ce4d46f02e4 100644 |
8605 |
+--- a/net/core/filter.c |
8606 |
++++ b/net/core/filter.c |
8607 |
+@@ -4248,12 +4248,14 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, |
8608 |
+ switch (optname) { |
8609 |
+ case SO_RCVBUF: |
8610 |
+ val = min_t(u32, val, sysctl_rmem_max); |
8611 |
++ val = min_t(int, val, INT_MAX / 2); |
8612 |
+ sk->sk_userlocks |= SOCK_RCVBUF_LOCK; |
8613 |
+ WRITE_ONCE(sk->sk_rcvbuf, |
8614 |
+ max_t(int, val * 2, SOCK_MIN_RCVBUF)); |
8615 |
+ break; |
8616 |
+ case SO_SNDBUF: |
8617 |
+ val = min_t(u32, val, sysctl_wmem_max); |
8618 |
++ val = min_t(int, val, INT_MAX / 2); |
8619 |
+ sk->sk_userlocks |= SOCK_SNDBUF_LOCK; |
8620 |
+ WRITE_ONCE(sk->sk_sndbuf, |
8621 |
+ max_t(int, val * 2, SOCK_MIN_SNDBUF)); |
8622 |
+@@ -6910,9 +6912,9 @@ void bpf_warn_invalid_xdp_action(u32 act) |
8623 |
+ { |
8624 |
+ const u32 act_max = XDP_REDIRECT; |
8625 |
+ |
8626 |
+- WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", |
8627 |
+- act > act_max ? "Illegal" : "Driver unsupported", |
8628 |
+- act); |
8629 |
++ pr_warn_once("%s XDP return value %u, expect packet loss!\n", |
8630 |
++ act > act_max ? "Illegal" : "Driver unsupported", |
8631 |
++ act); |
8632 |
+ } |
8633 |
+ EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); |
8634 |
+ |
8635 |
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c |
8636 |
+index 05b0c60bfba2b..bcad7028bbf45 100644 |
8637 |
+--- a/net/core/net-sysfs.c |
8638 |
++++ b/net/core/net-sysfs.c |
8639 |
+@@ -1661,6 +1661,9 @@ static void remove_queue_kobjects(struct net_device *dev) |
8640 |
+ |
8641 |
+ net_rx_queue_update_kobjects(dev, real_rx, 0); |
8642 |
+ netdev_queue_update_kobjects(dev, real_tx, 0); |
8643 |
++ |
8644 |
++ dev->real_num_rx_queues = 0; |
8645 |
++ dev->real_num_tx_queues = 0; |
8646 |
+ #ifdef CONFIG_SYSFS |
8647 |
+ kset_unregister(dev->queues_kset); |
8648 |
+ #endif |
8649 |
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
8650 |
+index cd1d40195e461..62a972f04cefb 100644 |
8651 |
+--- a/net/core/net_namespace.c |
8652 |
++++ b/net/core/net_namespace.c |
8653 |
+@@ -168,8 +168,10 @@ static void ops_exit_list(const struct pernet_operations *ops, |
8654 |
+ { |
8655 |
+ struct net *net; |
8656 |
+ if (ops->exit) { |
8657 |
+- list_for_each_entry(net, net_exit_list, exit_list) |
8658 |
++ list_for_each_entry(net, net_exit_list, exit_list) { |
8659 |
+ ops->exit(net); |
8660 |
++ cond_resched(); |
8661 |
++ } |
8662 |
+ } |
8663 |
+ if (ops->exit_batch) |
8664 |
+ ops->exit_batch(net_exit_list); |
8665 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
8666 |
+index ce4b28f011485..692ba6d6180f8 100644 |
8667 |
+--- a/net/ipv4/fib_semantics.c |
8668 |
++++ b/net/ipv4/fib_semantics.c |
8669 |
+@@ -29,6 +29,7 @@ |
8670 |
+ #include <linux/init.h> |
8671 |
+ #include <linux/slab.h> |
8672 |
+ #include <linux/netlink.h> |
8673 |
++#include <linux/hash.h> |
8674 |
+ |
8675 |
+ #include <net/arp.h> |
8676 |
+ #include <net/ip.h> |
8677 |
+@@ -318,11 +319,15 @@ static inline int nh_comp(struct fib_info *fi, struct fib_info *ofi) |
8678 |
+ |
8679 |
+ static inline unsigned int fib_devindex_hashfn(unsigned int val) |
8680 |
+ { |
8681 |
+- unsigned int mask = DEVINDEX_HASHSIZE - 1; |
8682 |
++ return hash_32(val, DEVINDEX_HASHBITS); |
8683 |
++} |
8684 |
++ |
8685 |
++static struct hlist_head * |
8686 |
++fib_info_devhash_bucket(const struct net_device *dev) |
8687 |
++{ |
8688 |
++ u32 val = net_hash_mix(dev_net(dev)) ^ dev->ifindex; |
8689 |
+ |
8690 |
+- return (val ^ |
8691 |
+- (val >> DEVINDEX_HASHBITS) ^ |
8692 |
+- (val >> (DEVINDEX_HASHBITS * 2))) & mask; |
8693 |
++ return &fib_info_devhash[fib_devindex_hashfn(val)]; |
8694 |
+ } |
8695 |
+ |
8696 |
+ static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope, |
8697 |
+@@ -432,12 +437,11 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev) |
8698 |
+ { |
8699 |
+ struct hlist_head *head; |
8700 |
+ struct fib_nh *nh; |
8701 |
+- unsigned int hash; |
8702 |
+ |
8703 |
+ spin_lock(&fib_info_lock); |
8704 |
+ |
8705 |
+- hash = fib_devindex_hashfn(dev->ifindex); |
8706 |
+- head = &fib_info_devhash[hash]; |
8707 |
++ head = fib_info_devhash_bucket(dev); |
8708 |
++ |
8709 |
+ hlist_for_each_entry(nh, head, nh_hash) { |
8710 |
+ if (nh->fib_nh_dev == dev && |
8711 |
+ nh->fib_nh_gw4 == gw && |
8712 |
+@@ -1594,12 +1598,10 @@ link_it: |
8713 |
+ } else { |
8714 |
+ change_nexthops(fi) { |
8715 |
+ struct hlist_head *head; |
8716 |
+- unsigned int hash; |
8717 |
+ |
8718 |
+ if (!nexthop_nh->fib_nh_dev) |
8719 |
+ continue; |
8720 |
+- hash = fib_devindex_hashfn(nexthop_nh->fib_nh_dev->ifindex); |
8721 |
+- head = &fib_info_devhash[hash]; |
8722 |
++ head = fib_info_devhash_bucket(nexthop_nh->fib_nh_dev); |
8723 |
+ hlist_add_head(&nexthop_nh->nh_hash, head); |
8724 |
+ } endfor_nexthops(fi) |
8725 |
+ } |
8726 |
+@@ -1940,8 +1942,7 @@ void fib_nhc_update_mtu(struct fib_nh_common *nhc, u32 new, u32 orig) |
8727 |
+ |
8728 |
+ void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) |
8729 |
+ { |
8730 |
+- unsigned int hash = fib_devindex_hashfn(dev->ifindex); |
8731 |
+- struct hlist_head *head = &fib_info_devhash[hash]; |
8732 |
++ struct hlist_head *head = fib_info_devhash_bucket(dev); |
8733 |
+ struct fib_nh *nh; |
8734 |
+ |
8735 |
+ hlist_for_each_entry(nh, head, nh_hash) { |
8736 |
+@@ -1960,12 +1961,11 @@ void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) |
8737 |
+ */ |
8738 |
+ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force) |
8739 |
+ { |
8740 |
+- int ret = 0; |
8741 |
+- int scope = RT_SCOPE_NOWHERE; |
8742 |
++ struct hlist_head *head = fib_info_devhash_bucket(dev); |
8743 |
+ struct fib_info *prev_fi = NULL; |
8744 |
+- unsigned int hash = fib_devindex_hashfn(dev->ifindex); |
8745 |
+- struct hlist_head *head = &fib_info_devhash[hash]; |
8746 |
++ int scope = RT_SCOPE_NOWHERE; |
8747 |
+ struct fib_nh *nh; |
8748 |
++ int ret = 0; |
8749 |
+ |
8750 |
+ if (force) |
8751 |
+ scope = -1; |
8752 |
+@@ -2110,7 +2110,6 @@ out: |
8753 |
+ int fib_sync_up(struct net_device *dev, unsigned char nh_flags) |
8754 |
+ { |
8755 |
+ struct fib_info *prev_fi; |
8756 |
+- unsigned int hash; |
8757 |
+ struct hlist_head *head; |
8758 |
+ struct fib_nh *nh; |
8759 |
+ int ret; |
8760 |
+@@ -2126,8 +2125,7 @@ int fib_sync_up(struct net_device *dev, unsigned char nh_flags) |
8761 |
+ } |
8762 |
+ |
8763 |
+ prev_fi = NULL; |
8764 |
+- hash = fib_devindex_hashfn(dev->ifindex); |
8765 |
+- head = &fib_info_devhash[hash]; |
8766 |
++ head = fib_info_devhash_bucket(dev); |
8767 |
+ ret = 0; |
8768 |
+ |
8769 |
+ hlist_for_each_entry(nh, head, nh_hash) { |
8770 |
+diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c |
8771 |
+index 10d31733297d7..e0e8a65d561ec 100644 |
8772 |
+--- a/net/ipv4/inet_fragment.c |
8773 |
++++ b/net/ipv4/inet_fragment.c |
8774 |
+@@ -204,9 +204,9 @@ void inet_frag_kill(struct inet_frag_queue *fq) |
8775 |
+ /* The RCU read lock provides a memory barrier |
8776 |
+ * guaranteeing that if fqdir->dead is false then |
8777 |
+ * the hash table destruction will not start until |
8778 |
+- * after we unlock. Paired with inet_frags_exit_net(). |
8779 |
++ * after we unlock. Paired with fqdir_pre_exit(). |
8780 |
+ */ |
8781 |
+- if (!fqdir->dead) { |
8782 |
++ if (!READ_ONCE(fqdir->dead)) { |
8783 |
+ rhashtable_remove_fast(&fqdir->rhashtable, &fq->node, |
8784 |
+ fqdir->f->rhash_params); |
8785 |
+ refcount_dec(&fq->refcnt); |
8786 |
+@@ -321,9 +321,11 @@ static struct inet_frag_queue *inet_frag_create(struct fqdir *fqdir, |
8787 |
+ /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ |
8788 |
+ struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key) |
8789 |
+ { |
8790 |
++ /* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ |
8791 |
++ long high_thresh = READ_ONCE(fqdir->high_thresh); |
8792 |
+ struct inet_frag_queue *fq = NULL, *prev; |
8793 |
+ |
8794 |
+- if (!fqdir->high_thresh || frag_mem_limit(fqdir) > fqdir->high_thresh) |
8795 |
++ if (!high_thresh || frag_mem_limit(fqdir) > high_thresh) |
8796 |
+ return NULL; |
8797 |
+ |
8798 |
+ rcu_read_lock(); |
8799 |
+diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c |
8800 |
+index cfeb8890f94ee..fad803d2d711e 100644 |
8801 |
+--- a/net/ipv4/ip_fragment.c |
8802 |
++++ b/net/ipv4/ip_fragment.c |
8803 |
+@@ -144,7 +144,8 @@ static void ip_expire(struct timer_list *t) |
8804 |
+ |
8805 |
+ rcu_read_lock(); |
8806 |
+ |
8807 |
+- if (qp->q.fqdir->dead) |
8808 |
++ /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ |
8809 |
++ if (READ_ONCE(qp->q.fqdir->dead)) |
8810 |
+ goto out_rcu_unlock; |
8811 |
+ |
8812 |
+ spin_lock(&qp->q.lock); |
8813 |
+diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
8814 |
+index c4989e5903e43..f67f1d27f5655 100644 |
8815 |
+--- a/net/ipv4/ip_gre.c |
8816 |
++++ b/net/ipv4/ip_gre.c |
8817 |
+@@ -577,8 +577,9 @@ static int gre_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) |
8818 |
+ |
8819 |
+ key = &info->key; |
8820 |
+ ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, |
8821 |
+- tunnel_id_to_key32(key->tun_id), key->tos, 0, |
8822 |
+- skb->mark, skb_get_hash(skb)); |
8823 |
++ tunnel_id_to_key32(key->tun_id), |
8824 |
++ key->tos & ~INET_ECN_MASK, 0, skb->mark, |
8825 |
++ skb_get_hash(skb)); |
8826 |
+ rt = ip_route_output_key(dev_net(dev), &fl4); |
8827 |
+ if (IS_ERR(rt)) |
8828 |
+ return PTR_ERR(rt); |
8829 |
+diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c |
8830 |
+index 6bdb1ab8af617..63ebb87d85331 100644 |
8831 |
+--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c |
8832 |
++++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c |
8833 |
+@@ -505,8 +505,11 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) |
8834 |
+ if (IS_ERR(config)) |
8835 |
+ return PTR_ERR(config); |
8836 |
+ } |
8837 |
+- } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) |
8838 |
++ } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) { |
8839 |
++ clusterip_config_entry_put(config); |
8840 |
++ clusterip_config_put(config); |
8841 |
+ return -EINVAL; |
8842 |
++ } |
8843 |
+ |
8844 |
+ ret = nf_ct_netns_get(par->net, par->family); |
8845 |
+ if (ret < 0) { |
8846 |
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c |
8847 |
+index 0cb8056d98003..5dbc280d43856 100644 |
8848 |
+--- a/net/ipv6/ip6_gre.c |
8849 |
++++ b/net/ipv6/ip6_gre.c |
8850 |
+@@ -743,6 +743,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, |
8851 |
+ fl6->daddr = key->u.ipv6.dst; |
8852 |
+ fl6->flowlabel = key->label; |
8853 |
+ fl6->flowi6_uid = sock_net_uid(dev_net(dev), NULL); |
8854 |
++ fl6->fl6_gre_key = tunnel_id_to_key32(key->tun_id); |
8855 |
+ |
8856 |
+ dsfield = key->tos; |
8857 |
+ flags = key->tun_flags & |
8858 |
+@@ -978,6 +979,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, |
8859 |
+ fl6.daddr = key->u.ipv6.dst; |
8860 |
+ fl6.flowlabel = key->label; |
8861 |
+ fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); |
8862 |
++ fl6.fl6_gre_key = tunnel_id_to_key32(key->tun_id); |
8863 |
+ |
8864 |
+ dsfield = key->tos; |
8865 |
+ if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) |
8866 |
+@@ -1085,6 +1087,7 @@ static void ip6gre_tnl_link_config_common(struct ip6_tnl *t) |
8867 |
+ fl6->flowi6_oif = p->link; |
8868 |
+ fl6->flowlabel = 0; |
8869 |
+ fl6->flowi6_proto = IPPROTO_GRE; |
8870 |
++ fl6->fl6_gre_key = t->parms.o_key; |
8871 |
+ |
8872 |
+ if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) |
8873 |
+ fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; |
8874 |
+@@ -1530,7 +1533,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev) |
8875 |
+ static struct inet6_protocol ip6gre_protocol __read_mostly = { |
8876 |
+ .handler = gre_rcv, |
8877 |
+ .err_handler = ip6gre_err, |
8878 |
+- .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
8879 |
++ .flags = INET6_PROTO_FINAL, |
8880 |
+ }; |
8881 |
+ |
8882 |
+ static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head) |
8883 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
8884 |
+index 282bf336b15a4..464029892478f 100644 |
8885 |
+--- a/net/mac80211/rx.c |
8886 |
++++ b/net/mac80211/rx.c |
8887 |
+@@ -4693,7 +4693,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, |
8888 |
+ goto drop; |
8889 |
+ break; |
8890 |
+ case RX_ENC_VHT: |
8891 |
+- if (WARN_ONCE(status->rate_idx > 9 || |
8892 |
++ if (WARN_ONCE(status->rate_idx > 11 || |
8893 |
+ !status->nss || |
8894 |
+ status->nss > 8, |
8895 |
+ "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n", |
8896 |
+diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c |
8897 |
+index a7e861eede2d9..bd2174699af97 100644 |
8898 |
+--- a/net/nfc/llcp_sock.c |
8899 |
++++ b/net/nfc/llcp_sock.c |
8900 |
+@@ -789,6 +789,11 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
8901 |
+ |
8902 |
+ lock_sock(sk); |
8903 |
+ |
8904 |
++ if (!llcp_sock->local) { |
8905 |
++ release_sock(sk); |
8906 |
++ return -ENODEV; |
8907 |
++ } |
8908 |
++ |
8909 |
+ if (sk->sk_type == SOCK_DGRAM) { |
8910 |
+ DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, |
8911 |
+ msg->msg_name); |
8912 |
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c |
8913 |
+index d973f8a15e117..ae5847de94c88 100644 |
8914 |
+--- a/net/sched/sch_generic.c |
8915 |
++++ b/net/sched/sch_generic.c |
8916 |
+@@ -1396,6 +1396,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, |
8917 |
+ { |
8918 |
+ memset(r, 0, sizeof(*r)); |
8919 |
+ r->overhead = conf->overhead; |
8920 |
++ r->mpu = conf->mpu; |
8921 |
+ r->rate_bytes_ps = max_t(u64, conf->rate, rate64); |
8922 |
+ r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); |
8923 |
+ r->mult = 1; |
8924 |
+diff --git a/net/unix/garbage.c b/net/unix/garbage.c |
8925 |
+index 12e2ddaf887f2..d45d5366115a7 100644 |
8926 |
+--- a/net/unix/garbage.c |
8927 |
++++ b/net/unix/garbage.c |
8928 |
+@@ -192,8 +192,11 @@ void wait_for_unix_gc(void) |
8929 |
+ { |
8930 |
+ /* If number of inflight sockets is insane, |
8931 |
+ * force a garbage collect right now. |
8932 |
++ * Paired with the WRITE_ONCE() in unix_inflight(), |
8933 |
++ * unix_notinflight() and gc_in_progress(). |
8934 |
+ */ |
8935 |
+- if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) |
8936 |
++ if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && |
8937 |
++ !READ_ONCE(gc_in_progress)) |
8938 |
+ unix_gc(); |
8939 |
+ wait_event(unix_gc_wait, gc_in_progress == false); |
8940 |
+ } |
8941 |
+@@ -213,7 +216,9 @@ void unix_gc(void) |
8942 |
+ if (gc_in_progress) |
8943 |
+ goto out; |
8944 |
+ |
8945 |
+- gc_in_progress = true; |
8946 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
8947 |
++ WRITE_ONCE(gc_in_progress, true); |
8948 |
++ |
8949 |
+ /* First, select candidates for garbage collection. Only |
8950 |
+ * in-flight sockets are considered, and from those only ones |
8951 |
+ * which don't have any external reference. |
8952 |
+@@ -299,7 +304,10 @@ void unix_gc(void) |
8953 |
+ |
8954 |
+ /* All candidates should have been detached by now. */ |
8955 |
+ BUG_ON(!list_empty(&gc_candidates)); |
8956 |
+- gc_in_progress = false; |
8957 |
++ |
8958 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
8959 |
++ WRITE_ONCE(gc_in_progress, false); |
8960 |
++ |
8961 |
+ wake_up(&unix_gc_wait); |
8962 |
+ |
8963 |
+ out: |
8964 |
+diff --git a/net/unix/scm.c b/net/unix/scm.c |
8965 |
+index 8c40f2b323924..ce700b22eccee 100644 |
8966 |
+--- a/net/unix/scm.c |
8967 |
++++ b/net/unix/scm.c |
8968 |
+@@ -59,7 +59,8 @@ void unix_inflight(struct user_struct *user, struct file *fp) |
8969 |
+ } else { |
8970 |
+ BUG_ON(list_empty(&u->link)); |
8971 |
+ } |
8972 |
+- unix_tot_inflight++; |
8973 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
8974 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); |
8975 |
+ } |
8976 |
+ user->unix_inflight++; |
8977 |
+ spin_unlock(&unix_gc_lock); |
8978 |
+@@ -79,7 +80,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp) |
8979 |
+ |
8980 |
+ if (atomic_long_dec_and_test(&u->inflight)) |
8981 |
+ list_del_init(&u->link); |
8982 |
+- unix_tot_inflight--; |
8983 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
8984 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); |
8985 |
+ } |
8986 |
+ user->unix_inflight--; |
8987 |
+ spin_unlock(&unix_gc_lock); |
8988 |
+diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
8989 |
+index 74e90d78c3b46..08343201513a9 100644 |
8990 |
+--- a/net/xfrm/xfrm_interface.c |
8991 |
++++ b/net/xfrm/xfrm_interface.c |
8992 |
+@@ -659,11 +659,16 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev, |
8993 |
+ struct netlink_ext_ack *extack) |
8994 |
+ { |
8995 |
+ struct net *net = dev_net(dev); |
8996 |
+- struct xfrm_if_parms p; |
8997 |
++ struct xfrm_if_parms p = {}; |
8998 |
+ struct xfrm_if *xi; |
8999 |
+ int err; |
9000 |
+ |
9001 |
+ xfrmi_netlink_parms(data, &p); |
9002 |
++ if (!p.if_id) { |
9003 |
++ NL_SET_ERR_MSG(extack, "if_id must be non zero"); |
9004 |
++ return -EINVAL; |
9005 |
++ } |
9006 |
++ |
9007 |
+ xi = xfrmi_locate(net, &p); |
9008 |
+ if (xi) |
9009 |
+ return -EEXIST; |
9010 |
+@@ -688,7 +693,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[], |
9011 |
+ { |
9012 |
+ struct xfrm_if *xi = netdev_priv(dev); |
9013 |
+ struct net *net = xi->net; |
9014 |
+- struct xfrm_if_parms p; |
9015 |
++ struct xfrm_if_parms p = {}; |
9016 |
++ |
9017 |
++ if (!p.if_id) { |
9018 |
++ NL_SET_ERR_MSG(extack, "if_id must be non zero"); |
9019 |
++ return -EINVAL; |
9020 |
++ } |
9021 |
+ |
9022 |
+ xfrmi_netlink_parms(data, &p); |
9023 |
+ xi = xfrmi_locate(net, &p); |
9024 |
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
9025 |
+index 32c8163427970..404823c5eb7d5 100644 |
9026 |
+--- a/net/xfrm/xfrm_policy.c |
9027 |
++++ b/net/xfrm/xfrm_policy.c |
9028 |
+@@ -31,8 +31,10 @@ |
9029 |
+ #include <linux/if_tunnel.h> |
9030 |
+ #include <net/dst.h> |
9031 |
+ #include <net/flow.h> |
9032 |
++#include <net/inet_ecn.h> |
9033 |
+ #include <net/xfrm.h> |
9034 |
+ #include <net/ip.h> |
9035 |
++#include <net/gre.h> |
9036 |
+ #if IS_ENABLED(CONFIG_IPV6_MIP6) |
9037 |
+ #include <net/mip6.h> |
9038 |
+ #endif |
9039 |
+@@ -3281,7 +3283,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse) |
9040 |
+ fl4->flowi4_proto = iph->protocol; |
9041 |
+ fl4->daddr = reverse ? iph->saddr : iph->daddr; |
9042 |
+ fl4->saddr = reverse ? iph->daddr : iph->saddr; |
9043 |
+- fl4->flowi4_tos = iph->tos; |
9044 |
++ fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK; |
9045 |
+ |
9046 |
+ if (!ip_is_fragment(iph)) { |
9047 |
+ switch (iph->protocol) { |
9048 |
+@@ -3443,6 +3445,26 @@ decode_session6(struct sk_buff *skb, struct flowi *fl, bool reverse) |
9049 |
+ } |
9050 |
+ fl6->flowi6_proto = nexthdr; |
9051 |
+ return; |
9052 |
++ case IPPROTO_GRE: |
9053 |
++ if (!onlyproto && |
9054 |
++ (nh + offset + 12 < skb->data || |
9055 |
++ pskb_may_pull(skb, nh + offset + 12 - skb->data))) { |
9056 |
++ struct gre_base_hdr *gre_hdr; |
9057 |
++ __be32 *gre_key; |
9058 |
++ |
9059 |
++ nh = skb_network_header(skb); |
9060 |
++ gre_hdr = (struct gre_base_hdr *)(nh + offset); |
9061 |
++ gre_key = (__be32 *)(gre_hdr + 1); |
9062 |
++ |
9063 |
++ if (gre_hdr->flags & GRE_KEY) { |
9064 |
++ if (gre_hdr->flags & GRE_CSUM) |
9065 |
++ gre_key++; |
9066 |
++ fl6->fl6_gre_key = *gre_key; |
9067 |
++ } |
9068 |
++ } |
9069 |
++ fl6->flowi6_proto = nexthdr; |
9070 |
++ return; |
9071 |
++ |
9072 |
+ #if IS_ENABLED(CONFIG_IPV6_MIP6) |
9073 |
+ case IPPROTO_MH: |
9074 |
+ offset += ipv6_optlen(exthdr); |
9075 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
9076 |
+index 0cee2d3c6e452..42ff32700d68b 100644 |
9077 |
+--- a/net/xfrm/xfrm_user.c |
9078 |
++++ b/net/xfrm/xfrm_user.c |
9079 |
+@@ -621,8 +621,13 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, |
9080 |
+ |
9081 |
+ xfrm_smark_init(attrs, &x->props.smark); |
9082 |
+ |
9083 |
+- if (attrs[XFRMA_IF_ID]) |
9084 |
++ if (attrs[XFRMA_IF_ID]) { |
9085 |
+ x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); |
9086 |
++ if (!x->if_id) { |
9087 |
++ err = -EINVAL; |
9088 |
++ goto error; |
9089 |
++ } |
9090 |
++ } |
9091 |
+ |
9092 |
+ err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); |
9093 |
+ if (err) |
9094 |
+@@ -1328,8 +1333,13 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, |
9095 |
+ |
9096 |
+ mark = xfrm_mark_get(attrs, &m); |
9097 |
+ |
9098 |
+- if (attrs[XFRMA_IF_ID]) |
9099 |
++ if (attrs[XFRMA_IF_ID]) { |
9100 |
+ if_id = nla_get_u32(attrs[XFRMA_IF_ID]); |
9101 |
++ if (!if_id) { |
9102 |
++ err = -EINVAL; |
9103 |
++ goto out_noput; |
9104 |
++ } |
9105 |
++ } |
9106 |
+ |
9107 |
+ if (p->info.seq) { |
9108 |
+ x = xfrm_find_acq_byseq(net, mark, p->info.seq); |
9109 |
+@@ -1631,8 +1641,13 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us |
9110 |
+ |
9111 |
+ xfrm_mark_get(attrs, &xp->mark); |
9112 |
+ |
9113 |
+- if (attrs[XFRMA_IF_ID]) |
9114 |
++ if (attrs[XFRMA_IF_ID]) { |
9115 |
+ xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); |
9116 |
++ if (!xp->if_id) { |
9117 |
++ err = -EINVAL; |
9118 |
++ goto error; |
9119 |
++ } |
9120 |
++ } |
9121 |
+ |
9122 |
+ return xp; |
9123 |
+ error: |
9124 |
+@@ -2816,7 +2831,7 @@ static inline unsigned int xfrm_sa_len(struct xfrm_state *x) |
9125 |
+ if (x->props.extra_flags) |
9126 |
+ l += nla_total_size(sizeof(x->props.extra_flags)); |
9127 |
+ if (x->xso.dev) |
9128 |
+- l += nla_total_size(sizeof(x->xso)); |
9129 |
++ l += nla_total_size(sizeof(struct xfrm_user_offload)); |
9130 |
+ if (x->props.smark.v | x->props.smark.m) { |
9131 |
+ l += nla_total_size(sizeof(x->props.smark.v)); |
9132 |
+ l += nla_total_size(sizeof(x->props.smark.m)); |
9133 |
+diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff |
9134 |
+index 00fd4738a5877..ae6c766a56ccc 100755 |
9135 |
+--- a/scripts/dtc/dtx_diff |
9136 |
++++ b/scripts/dtc/dtx_diff |
9137 |
+@@ -56,12 +56,8 @@ Otherwise DTx is treated as a dts source file (aka .dts). |
9138 |
+ or '/include/' to be processed. |
9139 |
+ |
9140 |
+ If DTx_1 and DTx_2 are in different architectures, then this script |
9141 |
+- may not work since \${ARCH} is part of the include path. Two possible |
9142 |
+- workarounds: |
9143 |
+- |
9144 |
+- `basename $0` \\ |
9145 |
+- <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ |
9146 |
+- <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) |
9147 |
++ may not work since \${ARCH} is part of the include path. The following |
9148 |
++ workaround can be used: |
9149 |
+ |
9150 |
+ `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts |
9151 |
+ `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts |
9152 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
9153 |
+index 91f2ba0b225b7..56418cf72069d 100644 |
9154 |
+--- a/security/selinux/hooks.c |
9155 |
++++ b/security/selinux/hooks.c |
9156 |
+@@ -995,18 +995,22 @@ out: |
9157 |
+ static int selinux_add_opt(int token, const char *s, void **mnt_opts) |
9158 |
+ { |
9159 |
+ struct selinux_mnt_opts *opts = *mnt_opts; |
9160 |
++ bool is_alloc_opts = false; |
9161 |
+ |
9162 |
+ if (token == Opt_seclabel) /* eaten and completely ignored */ |
9163 |
+ return 0; |
9164 |
+ |
9165 |
++ if (!s) |
9166 |
++ return -ENOMEM; |
9167 |
++ |
9168 |
+ if (!opts) { |
9169 |
+ opts = kzalloc(sizeof(struct selinux_mnt_opts), GFP_KERNEL); |
9170 |
+ if (!opts) |
9171 |
+ return -ENOMEM; |
9172 |
+ *mnt_opts = opts; |
9173 |
++ is_alloc_opts = true; |
9174 |
+ } |
9175 |
+- if (!s) |
9176 |
+- return -ENOMEM; |
9177 |
++ |
9178 |
+ switch (token) { |
9179 |
+ case Opt_context: |
9180 |
+ if (opts->context || opts->defcontext) |
9181 |
+@@ -1031,6 +1035,10 @@ static int selinux_add_opt(int token, const char *s, void **mnt_opts) |
9182 |
+ } |
9183 |
+ return 0; |
9184 |
+ Einval: |
9185 |
++ if (is_alloc_opts) { |
9186 |
++ kfree(opts); |
9187 |
++ *mnt_opts = NULL; |
9188 |
++ } |
9189 |
+ pr_warn(SEL_MOUNT_FAIL_MSG); |
9190 |
+ return -EINVAL; |
9191 |
+ } |
9192 |
+diff --git a/sound/core/jack.c b/sound/core/jack.c |
9193 |
+index 8b209750c7a9c..b00ae6f39f054 100644 |
9194 |
+--- a/sound/core/jack.c |
9195 |
++++ b/sound/core/jack.c |
9196 |
+@@ -54,10 +54,13 @@ static int snd_jack_dev_free(struct snd_device *device) |
9197 |
+ struct snd_card *card = device->card; |
9198 |
+ struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; |
9199 |
+ |
9200 |
++ down_write(&card->controls_rwsem); |
9201 |
+ list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { |
9202 |
+ list_del_init(&jack_kctl->list); |
9203 |
+ snd_ctl_remove(card, jack_kctl->kctl); |
9204 |
+ } |
9205 |
++ up_write(&card->controls_rwsem); |
9206 |
++ |
9207 |
+ if (jack->private_free) |
9208 |
+ jack->private_free(jack); |
9209 |
+ |
9210 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
9211 |
+index 9e31f4bd43826..841c0a12cc929 100644 |
9212 |
+--- a/sound/core/oss/pcm_oss.c |
9213 |
++++ b/sound/core/oss/pcm_oss.c |
9214 |
+@@ -2055,7 +2055,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr |
9215 |
+ int err, cmd; |
9216 |
+ |
9217 |
+ #ifdef OSS_DEBUG |
9218 |
+- pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); |
9219 |
++ pr_debug("pcm_oss: trigger = 0x%x\n", trigger); |
9220 |
+ #endif |
9221 |
+ |
9222 |
+ psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
9223 |
+diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
9224 |
+index 9a72d641743d9..f8ce961c28d6e 100644 |
9225 |
+--- a/sound/core/pcm.c |
9226 |
++++ b/sound/core/pcm.c |
9227 |
+@@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); |
9228 |
+ static void free_chmap(struct snd_pcm_str *pstr) |
9229 |
+ { |
9230 |
+ if (pstr->chmap_kctl) { |
9231 |
+- snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); |
9232 |
++ struct snd_card *card = pstr->pcm->card; |
9233 |
++ |
9234 |
++ down_write(&card->controls_rwsem); |
9235 |
++ snd_ctl_remove(card, pstr->chmap_kctl); |
9236 |
++ up_write(&card->controls_rwsem); |
9237 |
+ pstr->chmap_kctl = NULL; |
9238 |
+ } |
9239 |
+ } |
9240 |
+diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c |
9241 |
+index 71a6ea62c3be7..4ff0b927230c2 100644 |
9242 |
+--- a/sound/core/seq/seq_queue.c |
9243 |
++++ b/sound/core/seq/seq_queue.c |
9244 |
+@@ -234,12 +234,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *name) |
9245 |
+ |
9246 |
+ /* -------------------------------------------------------- */ |
9247 |
+ |
9248 |
++#define MAX_CELL_PROCESSES_IN_QUEUE 1000 |
9249 |
++ |
9250 |
+ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
9251 |
+ { |
9252 |
+ unsigned long flags; |
9253 |
+ struct snd_seq_event_cell *cell; |
9254 |
+ snd_seq_tick_time_t cur_tick; |
9255 |
+ snd_seq_real_time_t cur_time; |
9256 |
++ int processed = 0; |
9257 |
+ |
9258 |
+ if (q == NULL) |
9259 |
+ return; |
9260 |
+@@ -262,6 +265,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
9261 |
+ if (!cell) |
9262 |
+ break; |
9263 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
9264 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
9265 |
++ goto out; /* the rest processed at the next batch */ |
9266 |
+ } |
9267 |
+ |
9268 |
+ /* Process time queue... */ |
9269 |
+@@ -271,14 +276,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
9270 |
+ if (!cell) |
9271 |
+ break; |
9272 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
9273 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
9274 |
++ goto out; /* the rest processed at the next batch */ |
9275 |
+ } |
9276 |
+ |
9277 |
++ out: |
9278 |
+ /* free lock */ |
9279 |
+ spin_lock_irqsave(&q->check_lock, flags); |
9280 |
+ if (q->check_again) { |
9281 |
+ q->check_again = 0; |
9282 |
+- spin_unlock_irqrestore(&q->check_lock, flags); |
9283 |
+- goto __again; |
9284 |
++ if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { |
9285 |
++ spin_unlock_irqrestore(&q->check_lock, flags); |
9286 |
++ goto __again; |
9287 |
++ } |
9288 |
+ } |
9289 |
+ q->check_blocked = 0; |
9290 |
+ spin_unlock_irqrestore(&q->check_lock, flags); |
9291 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
9292 |
+index 326f95ce5ceb1..c8847de8388f0 100644 |
9293 |
+--- a/sound/pci/hda/hda_codec.c |
9294 |
++++ b/sound/pci/hda/hda_codec.c |
9295 |
+@@ -1721,8 +1721,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) |
9296 |
+ { |
9297 |
+ int i; |
9298 |
+ struct hda_nid_item *items = codec->mixers.list; |
9299 |
++ |
9300 |
++ down_write(&codec->card->controls_rwsem); |
9301 |
+ for (i = 0; i < codec->mixers.used; i++) |
9302 |
+ snd_ctl_remove(codec->card, items[i].kctl); |
9303 |
++ up_write(&codec->card->controls_rwsem); |
9304 |
+ snd_array_free(&codec->mixers); |
9305 |
+ snd_array_free(&codec->nids); |
9306 |
+ } |
9307 |
+diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c |
9308 |
+index 2943692f66edd..3610be1590fcc 100644 |
9309 |
+--- a/sound/soc/codecs/rt5663.c |
9310 |
++++ b/sound/soc/codecs/rt5663.c |
9311 |
+@@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663) |
9312 |
+ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) |
9313 |
+ { |
9314 |
+ int table_size; |
9315 |
++ int ret; |
9316 |
+ |
9317 |
+ device_property_read_u32(dev, "realtek,dc_offset_l_manual", |
9318 |
+ &rt5663->pdata.dc_offset_l_manual); |
9319 |
+@@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) |
9320 |
+ table_size = sizeof(struct impedance_mapping_table) * |
9321 |
+ rt5663->pdata.impedance_sensing_num; |
9322 |
+ rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); |
9323 |
+- device_property_read_u32_array(dev, |
9324 |
++ ret = device_property_read_u32_array(dev, |
9325 |
+ "realtek,impedance_sensing_table", |
9326 |
+ (u32 *)rt5663->imp_table, table_size); |
9327 |
++ if (ret) |
9328 |
++ return ret; |
9329 |
+ } |
9330 |
+ |
9331 |
+ return 0; |
9332 |
+@@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, |
9333 |
+ |
9334 |
+ if (pdata) |
9335 |
+ rt5663->pdata = *pdata; |
9336 |
+- else |
9337 |
+- rt5663_parse_dp(rt5663, &i2c->dev); |
9338 |
++ else { |
9339 |
++ ret = rt5663_parse_dp(rt5663, &i2c->dev); |
9340 |
++ if (ret) |
9341 |
++ return ret; |
9342 |
++ } |
9343 |
+ |
9344 |
+ for (i = 0; i < ARRAY_SIZE(rt5663->supplies); i++) |
9345 |
+ rt5663->supplies[i].supply = rt5663_supply_names[i]; |
9346 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c |
9347 |
+index 22c00600c999f..de1410c2c446f 100644 |
9348 |
+--- a/sound/soc/mediatek/mt8173/mt8173-max98090.c |
9349 |
++++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c |
9350 |
+@@ -180,6 +180,9 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) |
9351 |
+ if (ret) |
9352 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
9353 |
+ __func__, ret); |
9354 |
++ |
9355 |
++ of_node_put(codec_node); |
9356 |
++ of_node_put(platform_node); |
9357 |
+ return ret; |
9358 |
+ } |
9359 |
+ |
9360 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
9361 |
+index 8717e87bfe264..6f8542329bab9 100644 |
9362 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
9363 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c |
9364 |
+@@ -218,6 +218,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) |
9365 |
+ if (ret) |
9366 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
9367 |
+ __func__, ret); |
9368 |
++ |
9369 |
++ of_node_put(platform_node); |
9370 |
+ return ret; |
9371 |
+ } |
9372 |
+ |
9373 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
9374 |
+index 9d4dd97211548..727ff0f7f20b1 100644 |
9375 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
9376 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c |
9377 |
+@@ -285,6 +285,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) |
9378 |
+ if (ret) |
9379 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
9380 |
+ __func__, ret); |
9381 |
++ |
9382 |
++ of_node_put(platform_node); |
9383 |
+ return ret; |
9384 |
+ } |
9385 |
+ |
9386 |
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
9387 |
+index ef6f236752867..21e7d4d3ded5a 100644 |
9388 |
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
9389 |
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c |
9390 |
+@@ -309,6 +309,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) |
9391 |
+ if (ret) |
9392 |
+ dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", |
9393 |
+ __func__, ret); |
9394 |
++ |
9395 |
++ of_node_put(platform_node); |
9396 |
+ return ret; |
9397 |
+ } |
9398 |
+ |
9399 |
+diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c |
9400 |
+index 65497cd477a50..47f6f5d70853d 100644 |
9401 |
+--- a/sound/soc/samsung/idma.c |
9402 |
++++ b/sound/soc/samsung/idma.c |
9403 |
+@@ -363,6 +363,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) |
9404 |
+ buf->addr = idma.lp_tx_addr; |
9405 |
+ buf->bytes = idma_hardware.buffer_bytes_max; |
9406 |
+ buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes); |
9407 |
++ if (!buf->area) |
9408 |
++ return -ENOMEM; |
9409 |
+ |
9410 |
+ return 0; |
9411 |
+ } |
9412 |
+diff --git a/sound/soc/uniphier/Kconfig b/sound/soc/uniphier/Kconfig |
9413 |
+index aa3592ee1358b..ddfa6424c656b 100644 |
9414 |
+--- a/sound/soc/uniphier/Kconfig |
9415 |
++++ b/sound/soc/uniphier/Kconfig |
9416 |
+@@ -23,7 +23,6 @@ config SND_SOC_UNIPHIER_LD11 |
9417 |
+ tristate "UniPhier LD11/LD20 Device Driver" |
9418 |
+ depends on SND_SOC_UNIPHIER |
9419 |
+ select SND_SOC_UNIPHIER_AIO |
9420 |
+- select SND_SOC_UNIPHIER_AIO_DMA |
9421 |
+ help |
9422 |
+ This adds ASoC driver for Socionext UniPhier LD11/LD20 |
9423 |
+ input and output that can be used with other codecs. |
9424 |
+@@ -34,7 +33,6 @@ config SND_SOC_UNIPHIER_PXS2 |
9425 |
+ tristate "UniPhier PXs2 Device Driver" |
9426 |
+ depends on SND_SOC_UNIPHIER |
9427 |
+ select SND_SOC_UNIPHIER_AIO |
9428 |
+- select SND_SOC_UNIPHIER_AIO_DMA |
9429 |
+ help |
9430 |
+ This adds ASoC driver for Socionext UniPhier PXs2 |
9431 |
+ input and output that can be used with other codecs. |
9432 |
+diff --git a/tools/bpf/bpftool/Documentation/Makefile b/tools/bpf/bpftool/Documentation/Makefile |
9433 |
+index 815ac9804aee9..f79bba931cbfb 100644 |
9434 |
+--- a/tools/bpf/bpftool/Documentation/Makefile |
9435 |
++++ b/tools/bpf/bpftool/Documentation/Makefile |
9436 |
+@@ -1,6 +1,5 @@ |
9437 |
+ # SPDX-License-Identifier: GPL-2.0-only |
9438 |
+ include ../../../scripts/Makefile.include |
9439 |
+-include ../../../scripts/utilities.mak |
9440 |
+ |
9441 |
+ INSTALL ?= install |
9442 |
+ RM ?= rm -f |
9443 |
+diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile |
9444 |
+index 39bc6f0f4f0bb..10ecd9dfeaf34 100644 |
9445 |
+--- a/tools/bpf/bpftool/Makefile |
9446 |
++++ b/tools/bpf/bpftool/Makefile |
9447 |
+@@ -1,6 +1,5 @@ |
9448 |
+ # SPDX-License-Identifier: GPL-2.0-only |
9449 |
+ include ../../scripts/Makefile.include |
9450 |
+-include ../../scripts/utilities.mak |
9451 |
+ |
9452 |
+ ifeq ($(srctree),) |
9453 |
+ srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
9454 |
+diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c |
9455 |
+index 7d3cfb0ccbe61..4b03983acbefe 100644 |
9456 |
+--- a/tools/bpf/bpftool/main.c |
9457 |
++++ b/tools/bpf/bpftool/main.c |
9458 |
+@@ -362,6 +362,8 @@ int main(int argc, char **argv) |
9459 |
+ }; |
9460 |
+ int opt, ret; |
9461 |
+ |
9462 |
++ setlinebuf(stdout); |
9463 |
++ |
9464 |
+ last_do_help = do_help; |
9465 |
+ pretty_output = false; |
9466 |
+ json_output = false; |
9467 |
+diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h |
9468 |
+index 2551e9b71167b..b8cecb66d28b7 100644 |
9469 |
+--- a/tools/include/nolibc/nolibc.h |
9470 |
++++ b/tools/include/nolibc/nolibc.h |
9471 |
+@@ -422,16 +422,22 @@ struct stat { |
9472 |
+ }) |
9473 |
+ |
9474 |
+ /* startup code */ |
9475 |
++/* |
9476 |
++ * x86-64 System V ABI mandates: |
9477 |
++ * 1) %rsp must be 16-byte aligned right before the function call. |
9478 |
++ * 2) The deepest stack frame should be zero (the %rbp). |
9479 |
++ * |
9480 |
++ */ |
9481 |
+ asm(".section .text\n" |
9482 |
+ ".global _start\n" |
9483 |
+ "_start:\n" |
9484 |
+ "pop %rdi\n" // argc (first arg, %rdi) |
9485 |
+ "mov %rsp, %rsi\n" // argv[] (second arg, %rsi) |
9486 |
+ "lea 8(%rsi,%rdi,8),%rdx\n" // then a NULL then envp (third arg, %rdx) |
9487 |
+- "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned when |
9488 |
+- "sub $8, %rsp\n" // entering the callee |
9489 |
++ "xor %ebp, %ebp\n" // zero the stack frame |
9490 |
++ "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned before call |
9491 |
+ "call main\n" // main() returns the status code, we'll exit with it. |
9492 |
+- "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits |
9493 |
++ "mov %eax, %edi\n" // retrieve exit code (32 bit) |
9494 |
+ "mov $60, %rax\n" // NR_exit == 60 |
9495 |
+ "syscall\n" // really exit |
9496 |
+ "hlt\n" // ensure it does not return |
9497 |
+@@ -600,20 +606,28 @@ struct sys_stat_struct { |
9498 |
+ }) |
9499 |
+ |
9500 |
+ /* startup code */ |
9501 |
++/* |
9502 |
++ * i386 System V ABI mandates: |
9503 |
++ * 1) last pushed argument must be 16-byte aligned. |
9504 |
++ * 2) The deepest stack frame should be set to zero |
9505 |
++ * |
9506 |
++ */ |
9507 |
+ asm(".section .text\n" |
9508 |
+ ".global _start\n" |
9509 |
+ "_start:\n" |
9510 |
+ "pop %eax\n" // argc (first arg, %eax) |
9511 |
+ "mov %esp, %ebx\n" // argv[] (second arg, %ebx) |
9512 |
+ "lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx) |
9513 |
+- "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned when |
9514 |
++ "xor %ebp, %ebp\n" // zero the stack frame |
9515 |
++ "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned before |
9516 |
++ "sub $4, %esp\n" // the call instruction (args are aligned) |
9517 |
+ "push %ecx\n" // push all registers on the stack so that we |
9518 |
+ "push %ebx\n" // support both regparm and plain stack modes |
9519 |
+ "push %eax\n" |
9520 |
+ "call main\n" // main() returns the status code in %eax |
9521 |
+- "movzbl %al, %ebx\n" // retrieve exit code from lower 8 bits |
9522 |
+- "movl $1, %eax\n" // NR_exit == 1 |
9523 |
+- "int $0x80\n" // exit now |
9524 |
++ "mov %eax, %ebx\n" // retrieve exit code (32-bit int) |
9525 |
++ "movl $1, %eax\n" // NR_exit == 1 |
9526 |
++ "int $0x80\n" // exit now |
9527 |
+ "hlt\n" // ensure it does not |
9528 |
+ ""); |
9529 |
+ |
9530 |
+@@ -797,7 +811,6 @@ asm(".section .text\n" |
9531 |
+ "and %r3, %r1, $-8\n" // AAPCS : sp must be 8-byte aligned in the |
9532 |
+ "mov %sp, %r3\n" // callee, an bl doesn't push (lr=pc) |
9533 |
+ "bl main\n" // main() returns the status code, we'll exit with it. |
9534 |
+- "and %r0, %r0, $0xff\n" // limit exit code to 8 bits |
9535 |
+ "movs r7, $1\n" // NR_exit == 1 |
9536 |
+ "svc $0x00\n" |
9537 |
+ ""); |
9538 |
+@@ -994,7 +1007,6 @@ asm(".section .text\n" |
9539 |
+ "add x2, x2, x1\n" // + argv |
9540 |
+ "and sp, x1, -16\n" // sp must be 16-byte aligned in the callee |
9541 |
+ "bl main\n" // main() returns the status code, we'll exit with it. |
9542 |
+- "and x0, x0, 0xff\n" // limit exit code to 8 bits |
9543 |
+ "mov x8, 93\n" // NR_exit == 93 |
9544 |
+ "svc #0\n" |
9545 |
+ ""); |
9546 |
+@@ -1199,7 +1211,7 @@ asm(".section .text\n" |
9547 |
+ "addiu $sp,$sp,-16\n" // the callee expects to save a0..a3 there! |
9548 |
+ "jal main\n" // main() returns the status code, we'll exit with it. |
9549 |
+ "nop\n" // delayed slot |
9550 |
+- "and $a0, $v0, 0xff\n" // limit exit code to 8 bits |
9551 |
++ "move $a0, $v0\n" // retrieve 32-bit exit code from v0 |
9552 |
+ "li $v0, 4001\n" // NR_exit == 4001 |
9553 |
+ "syscall\n" |
9554 |
+ ".end __start\n" |
9555 |
+@@ -1397,7 +1409,6 @@ asm(".section .text\n" |
9556 |
+ "add a2,a2,a1\n" // + argv |
9557 |
+ "andi sp,a1,-16\n" // sp must be 16-byte aligned |
9558 |
+ "call main\n" // main() returns the status code, we'll exit with it. |
9559 |
+- "andi a0, a0, 0xff\n" // limit exit code to 8 bits |
9560 |
+ "li a7, 93\n" // NR_exit == 93 |
9561 |
+ "ecall\n" |
9562 |
+ ""); |
9563 |
+diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c |
9564 |
+index e55114f0336f0..682146d043793 100644 |
9565 |
+--- a/tools/perf/util/debug.c |
9566 |
++++ b/tools/perf/util/debug.c |
9567 |
+@@ -143,7 +143,7 @@ static int trace_event_printer(enum binary_printer_ops op, |
9568 |
+ break; |
9569 |
+ case BINARY_PRINT_CHAR_DATA: |
9570 |
+ printed += color_fprintf(fp, color, "%c", |
9571 |
+- isprint(ch) ? ch : '.'); |
9572 |
++ isprint(ch) && isascii(ch) ? ch : '.'); |
9573 |
+ break; |
9574 |
+ case BINARY_PRINT_CHAR_PAD: |
9575 |
+ printed += color_fprintf(fp, color, " "); |