Annotation of /trunk/kernel-alx/patches-5.4/0273-5.4.174-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(hide annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (18 months, 3 weeks ago) by niro
File size: 321099 byte(s)
Mon Oct 24 12:40:44 2022 UTC (18 months, 3 weeks ago) by niro
File size: 321099 byte(s)
-add missing
1 | niro | 3637 | diff --git a/Documentation/admin-guide/hw-vuln/spectre.rst b/Documentation/admin-guide/hw-vuln/spectre.rst |
2 | index e05e581af5cfe..985181dba0bac 100644 | ||
3 | --- a/Documentation/admin-guide/hw-vuln/spectre.rst | ||
4 | +++ b/Documentation/admin-guide/hw-vuln/spectre.rst | ||
5 | @@ -468,7 +468,7 @@ Spectre variant 2 | ||
6 | before invoking any firmware code to prevent Spectre variant 2 exploits | ||
7 | using the firmware. | ||
8 | |||
9 | - Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=y | ||
10 | + Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=y | ||
11 | and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes | ||
12 | attacks on the kernel generally more difficult. | ||
13 | |||
14 | diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | ||
15 | index fb747682006d9..92dc08b78a176 100644 | ||
16 | --- a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | ||
17 | +++ b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | ||
18 | @@ -10,6 +10,9 @@ title: Amlogic specific extensions to the Synopsys Designware HDMI Controller | ||
19 | maintainers: | ||
20 | - Neil Armstrong <narmstrong@baylibre.com> | ||
21 | |||
22 | +allOf: | ||
23 | + - $ref: /schemas/sound/name-prefix.yaml# | ||
24 | + | ||
25 | description: | | ||
26 | The Amlogic Meson Synopsys Designware Integration is composed of | ||
27 | - A Synopsys DesignWare HDMI Controller IP | ||
28 | @@ -101,6 +104,8 @@ properties: | ||
29 | "#sound-dai-cells": | ||
30 | const: 0 | ||
31 | |||
32 | + sound-name-prefix: true | ||
33 | + | ||
34 | required: | ||
35 | - compatible | ||
36 | - reg | ||
37 | diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | ||
38 | index d1205a6697a09..766b04501cb96 100644 | ||
39 | --- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | ||
40 | +++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | ||
41 | @@ -78,6 +78,10 @@ properties: | ||
42 | interrupts: | ||
43 | maxItems: 1 | ||
44 | |||
45 | + amlogic,canvas: | ||
46 | + description: should point to a canvas provider node | ||
47 | + $ref: /schemas/types.yaml#/definitions/phandle | ||
48 | + | ||
49 | power-domains: | ||
50 | maxItems: 1 | ||
51 | description: phandle to the associated power domain | ||
52 | @@ -106,6 +110,7 @@ required: | ||
53 | - port@1 | ||
54 | - "#address-cells" | ||
55 | - "#size-cells" | ||
56 | + - amlogic,canvas | ||
57 | |||
58 | examples: | ||
59 | - | | ||
60 | @@ -116,6 +121,7 @@ examples: | ||
61 | interrupts = <3>; | ||
62 | #address-cells = <1>; | ||
63 | #size-cells = <0>; | ||
64 | + amlogic,canvas = <&canvas>; | ||
65 | |||
66 | /* CVBS VDAC output port */ | ||
67 | port@0 { | ||
68 | diff --git a/Documentation/driver-api/dmaengine/dmatest.rst b/Documentation/driver-api/dmaengine/dmatest.rst | ||
69 | index ee268d445d38b..d2e1d8b58e7dc 100644 | ||
70 | --- a/Documentation/driver-api/dmaengine/dmatest.rst | ||
71 | +++ b/Documentation/driver-api/dmaengine/dmatest.rst | ||
72 | @@ -143,13 +143,14 @@ Part 5 - Handling channel allocation | ||
73 | Allocating Channels | ||
74 | ------------------- | ||
75 | |||
76 | -Channels are required to be configured prior to starting the test run. | ||
77 | -Attempting to run the test without configuring the channels will fail. | ||
78 | +Channels do not need to be configured prior to starting a test run. Attempting | ||
79 | +to run the test without configuring the channels will result in testing any | ||
80 | +channels that are available. | ||
81 | |||
82 | Example:: | ||
83 | |||
84 | % echo 1 > /sys/module/dmatest/parameters/run | ||
85 | - dmatest: Could not start test, no channels configured | ||
86 | + dmatest: No channels configured, continue with any | ||
87 | |||
88 | Channels are registered using the "channel" parameter. Channels can be requested by their | ||
89 | name, once requested, the channel is registered and a pending thread is added to the test list. | ||
90 | diff --git a/Documentation/driver-api/firewire.rst b/Documentation/driver-api/firewire.rst | ||
91 | index 94a2d7f01d999..d3cfa73cbb2b4 100644 | ||
92 | --- a/Documentation/driver-api/firewire.rst | ||
93 | +++ b/Documentation/driver-api/firewire.rst | ||
94 | @@ -19,7 +19,7 @@ of kernel interfaces is available via exported symbols in `firewire-core` module | ||
95 | Firewire char device data structures | ||
96 | ==================================== | ||
97 | |||
98 | -.. include:: /ABI/stable/firewire-cdev | ||
99 | +.. include:: ../ABI/stable/firewire-cdev | ||
100 | :literal: | ||
101 | |||
102 | .. kernel-doc:: include/uapi/linux/firewire-cdev.h | ||
103 | @@ -28,7 +28,7 @@ Firewire char device data structures | ||
104 | Firewire device probing and sysfs interfaces | ||
105 | ============================================ | ||
106 | |||
107 | -.. include:: /ABI/stable/sysfs-bus-firewire | ||
108 | +.. include:: ../ABI/stable/sysfs-bus-firewire | ||
109 | :literal: | ||
110 | |||
111 | .. kernel-doc:: drivers/firewire/core-device.c | ||
112 | diff --git a/Documentation/firmware-guide/acpi/dsd/data-node-references.rst b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst | ||
113 | index febccbc5689d0..1b05e8d0ddff7 100644 | ||
114 | --- a/Documentation/firmware-guide/acpi/dsd/data-node-references.rst | ||
115 | +++ b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst | ||
116 | @@ -5,7 +5,7 @@ | ||
117 | Referencing hierarchical data nodes | ||
118 | =================================== | ||
119 | |||
120 | -:Copyright: |copy| 2018 Intel Corporation | ||
121 | +:Copyright: |copy| 2018, 2021 Intel Corporation | ||
122 | :Author: Sakari Ailus <sakari.ailus@linux.intel.com> | ||
123 | |||
124 | ACPI in general allows referring to device objects in the tree only. | ||
125 | @@ -52,12 +52,14 @@ the ANOD object which is also the final target node of the reference. | ||
126 | Name (NOD0, Package() { | ||
127 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), | ||
128 | Package () { | ||
129 | + Package () { "reg", 0 }, | ||
130 | Package () { "random-property", 3 }, | ||
131 | } | ||
132 | }) | ||
133 | Name (NOD1, Package() { | ||
134 | ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), | ||
135 | Package () { | ||
136 | + Package () { "reg", 1 }, | ||
137 | Package () { "anothernode", "ANOD" }, | ||
138 | } | ||
139 | }) | ||
140 | @@ -74,7 +76,11 @@ the ANOD object which is also the final target node of the reference. | ||
141 | Name (_DSD, Package () { | ||
142 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), | ||
143 | Package () { | ||
144 | - Package () { "reference", ^DEV0, "node@1", "anothernode" }, | ||
145 | + Package () { | ||
146 | + "reference", Package () { | ||
147 | + ^DEV0, "node@1", "anothernode" | ||
148 | + } | ||
149 | + }, | ||
150 | } | ||
151 | }) | ||
152 | } | ||
153 | diff --git a/Makefile b/Makefile | ||
154 | index cb9e6cd0d0249..3075f06f77131 100644 | ||
155 | --- a/Makefile | ||
156 | +++ b/Makefile | ||
157 | @@ -1,7 +1,7 @@ | ||
158 | # SPDX-License-Identifier: GPL-2.0 | ||
159 | VERSION = 5 | ||
160 | PATCHLEVEL = 4 | ||
161 | -SUBLEVEL = 173 | ||
162 | +SUBLEVEL = 174 | ||
163 | EXTRAVERSION = | ||
164 | NAME = Kleptomaniac Octopus | ||
165 | |||
166 | diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S | ||
167 | index a5983588f96b8..dd53d6eb53ade 100644 | ||
168 | --- a/arch/arm/boot/compressed/efi-header.S | ||
169 | +++ b/arch/arm/boot/compressed/efi-header.S | ||
170 | @@ -9,16 +9,22 @@ | ||
171 | #include <linux/sizes.h> | ||
172 | |||
173 | .macro __nop | ||
174 | -#ifdef CONFIG_EFI_STUB | ||
175 | - @ This is almost but not quite a NOP, since it does clobber the | ||
176 | - @ condition flags. But it is the best we can do for EFI, since | ||
177 | - @ PE/COFF expects the magic string "MZ" at offset 0, while the | ||
178 | - @ ARM/Linux boot protocol expects an executable instruction | ||
179 | - @ there. | ||
180 | - .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 | ||
181 | -#else | ||
182 | AR_CLASS( mov r0, r0 ) | ||
183 | M_CLASS( nop.w ) | ||
184 | + .endm | ||
185 | + | ||
186 | + .macro __initial_nops | ||
187 | +#ifdef CONFIG_EFI_STUB | ||
188 | + @ This is a two-instruction NOP, which happens to bear the | ||
189 | + @ PE/COFF signature "MZ" in the first two bytes, so the kernel | ||
190 | + @ is accepted as an EFI binary. Booting via the UEFI stub | ||
191 | + @ will not execute those instructions, but the ARM/Linux | ||
192 | + @ boot protocol does, so we need some NOPs here. | ||
193 | + .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 | ||
194 | + eor r5, r5, 0x4d000 @ undo previous insn | ||
195 | +#else | ||
196 | + __nop | ||
197 | + __nop | ||
198 | #endif | ||
199 | .endm | ||
200 | |||
201 | diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S | ||
202 | index cbe126297f549..0a2410adc25b3 100644 | ||
203 | --- a/arch/arm/boot/compressed/head.S | ||
204 | +++ b/arch/arm/boot/compressed/head.S | ||
205 | @@ -165,7 +165,8 @@ start: | ||
206 | * were patching the initial instructions of the kernel, i.e | ||
207 | * had started to exploit this "patch area". | ||
208 | */ | ||
209 | - .rept 7 | ||
210 | + __initial_nops | ||
211 | + .rept 5 | ||
212 | __nop | ||
213 | .endr | ||
214 | #ifndef CONFIG_THUMB2_KERNEL | ||
215 | diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi | ||
216 | index 669da3a33d82c..5b82e58a1cf06 100644 | ||
217 | --- a/arch/arm/boot/dts/armada-38x.dtsi | ||
218 | +++ b/arch/arm/boot/dts/armada-38x.dtsi | ||
219 | @@ -165,7 +165,7 @@ | ||
220 | }; | ||
221 | |||
222 | uart0: serial@12000 { | ||
223 | - compatible = "marvell,armada-38x-uart"; | ||
224 | + compatible = "marvell,armada-38x-uart", "ns16550a"; | ||
225 | reg = <0x12000 0x100>; | ||
226 | reg-shift = <2>; | ||
227 | interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; | ||
228 | @@ -175,7 +175,7 @@ | ||
229 | }; | ||
230 | |||
231 | uart1: serial@12100 { | ||
232 | - compatible = "marvell,armada-38x-uart"; | ||
233 | + compatible = "marvell,armada-38x-uart", "ns16550a"; | ||
234 | reg = <0x12100 0x100>; | ||
235 | reg-shift = <2>; | ||
236 | interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; | ||
237 | diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemini-nas4220b.dts | ||
238 | index e1020e07e1366..60cec653ac7c6 100644 | ||
239 | --- a/arch/arm/boot/dts/gemini-nas4220b.dts | ||
240 | +++ b/arch/arm/boot/dts/gemini-nas4220b.dts | ||
241 | @@ -84,7 +84,7 @@ | ||
242 | partitions { | ||
243 | compatible = "redboot-fis"; | ||
244 | /* Eraseblock at 0xfe0000 */ | ||
245 | - fis-index-block = <0x1fc>; | ||
246 | + fis-index-block = <0x7f>; | ||
247 | }; | ||
248 | }; | ||
249 | |||
250 | diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | ||
251 | index ee949255ced3f..09ef73b99dd86 100644 | ||
252 | --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | ||
253 | +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | ||
254 | @@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void) | ||
255 | return -ENODEV; | ||
256 | |||
257 | for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) { | ||
258 | - if (!of_device_is_available(np)) | ||
259 | + if (!of_device_is_available(np)) { | ||
260 | + of_node_put(np); | ||
261 | break; | ||
262 | + } | ||
263 | |||
264 | ret = of_property_read_u32(np, "reg", &addr); | ||
265 | if (ret) /* Skip invalid entry and continue */ | ||
266 | @@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) | ||
267 | quirk = kzalloc(sizeof(*quirk), GFP_KERNEL); | ||
268 | if (!quirk) { | ||
269 | ret = -ENOMEM; | ||
270 | + of_node_put(np); | ||
271 | goto err_mem; | ||
272 | } | ||
273 | |||
274 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | ||
275 | index e3d17569d98ad..e94f09c2d4e32 100644 | ||
276 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | ||
277 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | ||
278 | @@ -6,6 +6,7 @@ | ||
279 | */ | ||
280 | |||
281 | #include "meson-gxbb.dtsi" | ||
282 | +#include <dt-bindings/gpio/gpio.h> | ||
283 | |||
284 | / { | ||
285 | aliases { | ||
286 | @@ -64,6 +65,7 @@ | ||
287 | regulator-name = "VDDIO_AO18"; | ||
288 | regulator-min-microvolt = <1800000>; | ||
289 | regulator-max-microvolt = <1800000>; | ||
290 | + regulator-always-on; | ||
291 | }; | ||
292 | |||
293 | vcc_3v3: regulator-vcc_3v3 { | ||
294 | @@ -157,6 +159,7 @@ | ||
295 | status = "okay"; | ||
296 | pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; | ||
297 | pinctrl-names = "default"; | ||
298 | + hdmi-supply = <&vddio_ao18>; | ||
299 | }; | ||
300 | |||
301 | &hdmi_tx_tmds_port { | ||
302 | diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts | ||
303 | index 078a5010228cd..0b3a93c4155d2 100644 | ||
304 | --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts | ||
305 | +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts | ||
306 | @@ -161,11 +161,6 @@ | ||
307 | vcc-supply = <&sb_3v3>; | ||
308 | }; | ||
309 | |||
310 | - rtc@51 { | ||
311 | - compatible = "nxp,pcf2129"; | ||
312 | - reg = <0x51>; | ||
313 | - }; | ||
314 | - | ||
315 | eeprom@56 { | ||
316 | compatible = "atmel,24c512"; | ||
317 | reg = <0x56>; | ||
318 | @@ -209,6 +204,15 @@ | ||
319 | |||
320 | }; | ||
321 | |||
322 | +&i2c1 { | ||
323 | + status = "okay"; | ||
324 | + | ||
325 | + rtc@51 { | ||
326 | + compatible = "nxp,pcf2129"; | ||
327 | + reg = <0x51>; | ||
328 | + }; | ||
329 | +}; | ||
330 | + | ||
331 | &enetc_port1 { | ||
332 | phy-handle = <&qds_phy1>; | ||
333 | phy-connection-type = "rgmii-id"; | ||
334 | diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts/nvidia/tegra186.dtsi | ||
335 | index 9abf0cb1dd67f..4457262750734 100644 | ||
336 | --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi | ||
337 | +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi | ||
338 | @@ -709,7 +709,7 @@ | ||
339 | |||
340 | ccplex@e000000 { | ||
341 | compatible = "nvidia,tegra186-ccplex-cluster"; | ||
342 | - reg = <0x0 0x0e000000 0x0 0x3fffff>; | ||
343 | + reg = <0x0 0x0e000000 0x0 0x400000>; | ||
344 | |||
345 | nvidia,bpmp = <&bpmp>; | ||
346 | }; | ||
347 | diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi | ||
348 | index 449843f2184d8..301c1c467c0b7 100644 | ||
349 | --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi | ||
350 | +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi | ||
351 | @@ -16,8 +16,8 @@ | ||
352 | #size-cells = <2>; | ||
353 | |||
354 | aliases { | ||
355 | - sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ | ||
356 | - sdhc2 = &sdhc_2; /* SDC2 SD card slot */ | ||
357 | + mmc0 = &sdhc_1; /* SDC1 eMMC slot */ | ||
358 | + mmc1 = &sdhc_2; /* SDC2 SD card slot */ | ||
359 | }; | ||
360 | |||
361 | chosen { }; | ||
362 | diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi | ||
363 | index d303df3887d9f..f1d3c51ea8d0d 100644 | ||
364 | --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi | ||
365 | +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi | ||
366 | @@ -2098,9 +2098,6 @@ | ||
367 | nvmem-cells = <&gpu_speed_bin>; | ||
368 | nvmem-cell-names = "speed_bin"; | ||
369 | |||
370 | - qcom,gpu-quirk-two-pass-use-wfi; | ||
371 | - qcom,gpu-quirk-fault-detect-mask; | ||
372 | - | ||
373 | operating-points-v2 = <&gpu_opp_table>; | ||
374 | |||
375 | gpu_opp_table: opp-table { | ||
376 | diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/k3-j721e.dtsi | ||
377 | index 43ea1ba979220..5a6e74636d6fc 100644 | ||
378 | --- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi | ||
379 | +++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi | ||
380 | @@ -60,7 +60,7 @@ | ||
381 | i-cache-sets = <256>; | ||
382 | d-cache-size = <0x8000>; | ||
383 | d-cache-line-size = <64>; | ||
384 | - d-cache-sets = <128>; | ||
385 | + d-cache-sets = <256>; | ||
386 | next-level-cache = <&L2_0>; | ||
387 | }; | ||
388 | |||
389 | @@ -74,7 +74,7 @@ | ||
390 | i-cache-sets = <256>; | ||
391 | d-cache-size = <0x8000>; | ||
392 | d-cache-line-size = <64>; | ||
393 | - d-cache-sets = <128>; | ||
394 | + d-cache-sets = <256>; | ||
395 | next-level-cache = <&L2_0>; | ||
396 | }; | ||
397 | }; | ||
398 | @@ -84,7 +84,7 @@ | ||
399 | cache-level = <2>; | ||
400 | cache-size = <0x100000>; | ||
401 | cache-line-size = <64>; | ||
402 | - cache-sets = <2048>; | ||
403 | + cache-sets = <1024>; | ||
404 | next-level-cache = <&msmc_l3>; | ||
405 | }; | ||
406 | |||
407 | diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c | ||
408 | index 8a223d0e4918c..fa10d51f62177 100644 | ||
409 | --- a/arch/ia64/kernel/kprobes.c | ||
410 | +++ b/arch/ia64/kernel/kprobes.c | ||
411 | @@ -396,10 +396,83 @@ static void kretprobe_trampoline(void) | ||
412 | { | ||
413 | } | ||
414 | |||
415 | +/* | ||
416 | + * At this point the target function has been tricked into | ||
417 | + * returning into our trampoline. Lookup the associated instance | ||
418 | + * and then: | ||
419 | + * - call the handler function | ||
420 | + * - cleanup by marking the instance as unused | ||
421 | + * - long jump back to the original return address | ||
422 | + */ | ||
423 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | ||
424 | { | ||
425 | - regs->cr_iip = __kretprobe_trampoline_handler(regs, | ||
426 | - dereference_function_descriptor(kretprobe_trampoline), NULL); | ||
427 | + struct kretprobe_instance *ri = NULL; | ||
428 | + struct hlist_head *head, empty_rp; | ||
429 | + struct hlist_node *tmp; | ||
430 | + unsigned long flags, orig_ret_address = 0; | ||
431 | + unsigned long trampoline_address = | ||
432 | + (unsigned long)dereference_function_descriptor(kretprobe_trampoline); | ||
433 | + | ||
434 | + INIT_HLIST_HEAD(&empty_rp); | ||
435 | + kretprobe_hash_lock(current, &head, &flags); | ||
436 | + | ||
437 | + /* | ||
438 | + * It is possible to have multiple instances associated with a given | ||
439 | + * task either because an multiple functions in the call path | ||
440 | + * have a return probe installed on them, and/or more than one return | ||
441 | + * return probe was registered for a target function. | ||
442 | + * | ||
443 | + * We can handle this because: | ||
444 | + * - instances are always inserted at the head of the list | ||
445 | + * - when multiple return probes are registered for the same | ||
446 | + * function, the first instance's ret_addr will point to the | ||
447 | + * real return address, and all the rest will point to | ||
448 | + * kretprobe_trampoline | ||
449 | + */ | ||
450 | + hlist_for_each_entry_safe(ri, tmp, head, hlist) { | ||
451 | + if (ri->task != current) | ||
452 | + /* another task is sharing our hash bucket */ | ||
453 | + continue; | ||
454 | + | ||
455 | + orig_ret_address = (unsigned long)ri->ret_addr; | ||
456 | + if (orig_ret_address != trampoline_address) | ||
457 | + /* | ||
458 | + * This is the real return address. Any other | ||
459 | + * instances associated with this task are for | ||
460 | + * other calls deeper on the call stack | ||
461 | + */ | ||
462 | + break; | ||
463 | + } | ||
464 | + | ||
465 | + regs->cr_iip = orig_ret_address; | ||
466 | + | ||
467 | + hlist_for_each_entry_safe(ri, tmp, head, hlist) { | ||
468 | + if (ri->task != current) | ||
469 | + /* another task is sharing our hash bucket */ | ||
470 | + continue; | ||
471 | + | ||
472 | + if (ri->rp && ri->rp->handler) | ||
473 | + ri->rp->handler(ri, regs); | ||
474 | + | ||
475 | + orig_ret_address = (unsigned long)ri->ret_addr; | ||
476 | + recycle_rp_inst(ri, &empty_rp); | ||
477 | + | ||
478 | + if (orig_ret_address != trampoline_address) | ||
479 | + /* | ||
480 | + * This is the real return address. Any other | ||
481 | + * instances associated with this task are for | ||
482 | + * other calls deeper on the call stack | ||
483 | + */ | ||
484 | + break; | ||
485 | + } | ||
486 | + kretprobe_assert(ri, orig_ret_address, trampoline_address); | ||
487 | + | ||
488 | + kretprobe_hash_unlock(current, &flags); | ||
489 | + | ||
490 | + hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { | ||
491 | + hlist_del(&ri->hlist); | ||
492 | + kfree(ri); | ||
493 | + } | ||
494 | /* | ||
495 | * By returning a non-zero value, we are telling | ||
496 | * kprobe_handler() that we don't want the post_handler | ||
497 | @@ -412,7 +485,6 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | ||
498 | struct pt_regs *regs) | ||
499 | { | ||
500 | ri->ret_addr = (kprobe_opcode_t *)regs->b0; | ||
501 | - ri->fp = NULL; | ||
502 | |||
503 | /* Replace the return addr with trampoline addr */ | ||
504 | regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline); | ||
505 | diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c | ||
506 | index aba6e2d6a736c..dcfa0ea912fe1 100644 | ||
507 | --- a/arch/mips/bcm63xx/clk.c | ||
508 | +++ b/arch/mips/bcm63xx/clk.c | ||
509 | @@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) | ||
510 | } | ||
511 | EXPORT_SYMBOL(clk_get_parent); | ||
512 | |||
513 | +int clk_set_parent(struct clk *clk, struct clk *parent) | ||
514 | +{ | ||
515 | + return 0; | ||
516 | +} | ||
517 | +EXPORT_SYMBOL(clk_set_parent); | ||
518 | + | ||
519 | unsigned long clk_get_rate(struct clk *clk) | ||
520 | { | ||
521 | if (!clk) | ||
522 | diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c | ||
523 | index 51685f893eab0..c214fe4e678bb 100644 | ||
524 | --- a/arch/mips/cavium-octeon/octeon-platform.c | ||
525 | +++ b/arch/mips/cavium-octeon/octeon-platform.c | ||
526 | @@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void) | ||
527 | |||
528 | pd->dev.platform_data = &octeon_ehci_pdata; | ||
529 | octeon_ehci_hw_start(&pd->dev); | ||
530 | + put_device(&pd->dev); | ||
531 | |||
532 | return ret; | ||
533 | } | ||
534 | @@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void) | ||
535 | |||
536 | pd->dev.platform_data = &octeon_ohci_pdata; | ||
537 | octeon_ohci_hw_start(&pd->dev); | ||
538 | + put_device(&pd->dev); | ||
539 | |||
540 | return ret; | ||
541 | } | ||
542 | diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c | ||
543 | index 4017398519cf9..e092d86e63581 100644 | ||
544 | --- a/arch/mips/cavium-octeon/octeon-usb.c | ||
545 | +++ b/arch/mips/cavium-octeon/octeon-usb.c | ||
546 | @@ -544,6 +544,7 @@ static int __init dwc3_octeon_device_init(void) | ||
547 | devm_iounmap(&pdev->dev, base); | ||
548 | devm_release_mem_region(&pdev->dev, res->start, | ||
549 | resource_size(res)); | ||
550 | + put_device(&pdev->dev); | ||
551 | } | ||
552 | } while (node != NULL); | ||
553 | |||
554 | diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h | ||
555 | index 62787765575ef..ce6e5fddce0bf 100644 | ||
556 | --- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h | ||
557 | +++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h | ||
558 | @@ -315,7 +315,7 @@ enum cvmx_chip_types_enum { | ||
559 | |||
560 | /* Functions to return string based on type */ | ||
561 | #define ENUM_BRD_TYPE_CASE(x) \ | ||
562 | - case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ | ||
563 | + case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ | ||
564 | static inline const char *cvmx_board_type_to_string(enum | ||
565 | cvmx_board_types_enum type) | ||
566 | { | ||
567 | @@ -404,7 +404,7 @@ static inline const char *cvmx_board_type_to_string(enum | ||
568 | } | ||
569 | |||
570 | #define ENUM_CHIP_TYPE_CASE(x) \ | ||
571 | - case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ | ||
572 | + case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ | ||
573 | static inline const char *cvmx_chip_type_to_string(enum | ||
574 | cvmx_chip_types_enum type) | ||
575 | { | ||
576 | diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c | ||
577 | index 4916cccf378fd..7a623684d9b5e 100644 | ||
578 | --- a/arch/mips/lantiq/clk.c | ||
579 | +++ b/arch/mips/lantiq/clk.c | ||
580 | @@ -164,6 +164,12 @@ struct clk *clk_get_parent(struct clk *clk) | ||
581 | } | ||
582 | EXPORT_SYMBOL(clk_get_parent); | ||
583 | |||
584 | +int clk_set_parent(struct clk *clk, struct clk *parent) | ||
585 | +{ | ||
586 | + return 0; | ||
587 | +} | ||
588 | +EXPORT_SYMBOL(clk_set_parent); | ||
589 | + | ||
590 | static inline u32 get_counter_resolution(void) | ||
591 | { | ||
592 | u32 res; | ||
593 | diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c | ||
594 | index 82fc011894889..2a1060d747a5d 100644 | ||
595 | --- a/arch/parisc/kernel/traps.c | ||
596 | +++ b/arch/parisc/kernel/traps.c | ||
597 | @@ -783,7 +783,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) | ||
598 | * unless pagefault_disable() was called before. | ||
599 | */ | ||
600 | |||
601 | - if (fault_space == 0 && !faulthandler_disabled()) | ||
602 | + if (faulthandler_disabled() || fault_space == 0) | ||
603 | { | ||
604 | /* Clean up and return if in exception table. */ | ||
605 | if (fixup_exception(regs)) | ||
606 | diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | ||
607 | index c90702b04a530..48e5cd61599c6 100644 | ||
608 | --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | ||
609 | +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | ||
610 | @@ -79,6 +79,7 @@ fman0: fman@400000 { | ||
611 | #size-cells = <0>; | ||
612 | compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; | ||
613 | reg = <0xfc000 0x1000>; | ||
614 | + fsl,erratum-a009885; | ||
615 | }; | ||
616 | |||
617 | xmdio0: mdio@fd000 { | ||
618 | @@ -86,6 +87,7 @@ fman0: fman@400000 { | ||
619 | #size-cells = <0>; | ||
620 | compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; | ||
621 | reg = <0xfd000 0x1000>; | ||
622 | + fsl,erratum-a009885; | ||
623 | }; | ||
624 | }; | ||
625 | |||
626 | diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c | ||
627 | index 6dfceaa820e42..b0e0b3cd91eec 100644 | ||
628 | --- a/arch/powerpc/kernel/btext.c | ||
629 | +++ b/arch/powerpc/kernel/btext.c | ||
630 | @@ -250,8 +250,10 @@ int __init btext_find_display(int allow_nonstdout) | ||
631 | rc = btext_initialize(np); | ||
632 | printk("result: %d\n", rc); | ||
633 | } | ||
634 | - if (rc == 0) | ||
635 | + if (rc == 0) { | ||
636 | + of_node_put(np); | ||
637 | break; | ||
638 | + } | ||
639 | } | ||
640 | return rc; | ||
641 | } | ||
642 | diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c | ||
643 | index 1b65fb7c0bdaa..7f4e2c031a9ab 100644 | ||
644 | --- a/arch/powerpc/kernel/prom_init.c | ||
645 | +++ b/arch/powerpc/kernel/prom_init.c | ||
646 | @@ -2919,7 +2919,7 @@ static void __init fixup_device_tree_efika_add_phy(void) | ||
647 | |||
648 | /* Check if the phy-handle property exists - bail if it does */ | ||
649 | rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); | ||
650 | - if (!rv) | ||
651 | + if (rv <= 0) | ||
652 | return; | ||
653 | |||
654 | /* | ||
655 | diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c | ||
656 | index c06cac543f188..4de63ec2e1551 100644 | ||
657 | --- a/arch/powerpc/kernel/smp.c | ||
658 | +++ b/arch/powerpc/kernel/smp.c | ||
659 | @@ -582,6 +582,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) | ||
660 | } | ||
661 | #endif | ||
662 | |||
663 | +#ifdef CONFIG_NMI_IPI | ||
664 | +static void crash_stop_this_cpu(struct pt_regs *regs) | ||
665 | +#else | ||
666 | +static void crash_stop_this_cpu(void *dummy) | ||
667 | +#endif | ||
668 | +{ | ||
669 | + /* | ||
670 | + * Just busy wait here and avoid marking CPU as offline to ensure | ||
671 | + * register data is captured appropriately. | ||
672 | + */ | ||
673 | + while (1) | ||
674 | + cpu_relax(); | ||
675 | +} | ||
676 | + | ||
677 | +void crash_smp_send_stop(void) | ||
678 | +{ | ||
679 | + static bool stopped = false; | ||
680 | + | ||
681 | + if (stopped) | ||
682 | + return; | ||
683 | + | ||
684 | + stopped = true; | ||
685 | + | ||
686 | +#ifdef CONFIG_NMI_IPI | ||
687 | + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); | ||
688 | +#else | ||
689 | + smp_call_function(crash_stop_this_cpu, NULL, 0); | ||
690 | +#endif /* CONFIG_NMI_IPI */ | ||
691 | +} | ||
692 | + | ||
693 | #ifdef CONFIG_NMI_IPI | ||
694 | static void nmi_stop_this_cpu(struct pt_regs *regs) | ||
695 | { | ||
696 | @@ -1296,10 +1326,12 @@ void start_secondary(void *unused) | ||
697 | BUG(); | ||
698 | } | ||
699 | |||
700 | +#ifdef CONFIG_PROFILING | ||
701 | int setup_profiling_timer(unsigned int multiplier) | ||
702 | { | ||
703 | return 0; | ||
704 | } | ||
705 | +#endif | ||
706 | |||
707 | #ifdef CONFIG_SCHED_SMT | ||
708 | /* cpumask of CPUs with asymetric SMT dependancy */ | ||
709 | diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c | ||
710 | index af3c15a1d41eb..75b2a6c4db5a5 100644 | ||
711 | --- a/arch/powerpc/kernel/watchdog.c | ||
712 | +++ b/arch/powerpc/kernel/watchdog.c | ||
713 | @@ -132,6 +132,10 @@ static void set_cpumask_stuck(const struct cpumask *cpumask, u64 tb) | ||
714 | { | ||
715 | cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); | ||
716 | cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); | ||
717 | + /* | ||
718 | + * See wd_smp_clear_cpu_pending() | ||
719 | + */ | ||
720 | + smp_mb(); | ||
721 | if (cpumask_empty(&wd_smp_cpus_pending)) { | ||
722 | wd_smp_last_reset_tb = tb; | ||
723 | cpumask_andnot(&wd_smp_cpus_pending, | ||
724 | @@ -217,13 +221,44 @@ static void wd_smp_clear_cpu_pending(int cpu, u64 tb) | ||
725 | |||
726 | cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); | ||
727 | wd_smp_unlock(&flags); | ||
728 | + } else { | ||
729 | + /* | ||
730 | + * The last CPU to clear pending should have reset the | ||
731 | + * watchdog so we generally should not find it empty | ||
732 | + * here if our CPU was clear. However it could happen | ||
733 | + * due to a rare race with another CPU taking the | ||
734 | + * last CPU out of the mask concurrently. | ||
735 | + * | ||
736 | + * We can't add a warning for it. But just in case | ||
737 | + * there is a problem with the watchdog that is causing | ||
738 | + * the mask to not be reset, try to kick it along here. | ||
739 | + */ | ||
740 | + if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) | ||
741 | + goto none_pending; | ||
742 | } | ||
743 | return; | ||
744 | } | ||
745 | + | ||
746 | cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); | ||
747 | + | ||
748 | + /* | ||
749 | + * Order the store to clear pending with the load(s) to check all | ||
750 | + * words in the pending mask to check they are all empty. This orders | ||
751 | + * with the same barrier on another CPU. This prevents two CPUs | ||
752 | + * clearing the last 2 pending bits, but neither seeing the other's | ||
753 | + * store when checking if the mask is empty, and missing an empty | ||
754 | + * mask, which ends with a false positive. | ||
755 | + */ | ||
756 | + smp_mb(); | ||
757 | if (cpumask_empty(&wd_smp_cpus_pending)) { | ||
758 | unsigned long flags; | ||
759 | |||
760 | +none_pending: | ||
761 | + /* | ||
762 | + * Double check under lock because more than one CPU could see | ||
763 | + * a clear mask with the lockless check after clearing their | ||
764 | + * pending bits. | ||
765 | + */ | ||
766 | wd_smp_lock(&flags); | ||
767 | if (cpumask_empty(&wd_smp_cpus_pending)) { | ||
768 | wd_smp_last_reset_tb = tb; | ||
769 | @@ -314,8 +349,12 @@ void arch_touch_nmi_watchdog(void) | ||
770 | { | ||
771 | unsigned long ticks = tb_ticks_per_usec * wd_timer_period_ms * 1000; | ||
772 | int cpu = smp_processor_id(); | ||
773 | - u64 tb = get_tb(); | ||
774 | + u64 tb; | ||
775 | |||
776 | + if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) | ||
777 | + return; | ||
778 | + | ||
779 | + tb = get_tb(); | ||
780 | if (tb - per_cpu(wd_timer_tb, cpu) >= ticks) { | ||
781 | per_cpu(wd_timer_tb, cpu) = tb; | ||
782 | wd_smp_clear_cpu_pending(cpu, tb); | ||
783 | diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c | ||
784 | index 9906d203d9d39..613d24b707abe 100644 | ||
785 | --- a/arch/powerpc/kvm/book3s_hv_nested.c | ||
786 | +++ b/arch/powerpc/kvm/book3s_hv_nested.c | ||
787 | @@ -510,7 +510,7 @@ long kvmhv_copy_tofrom_guest_nested(struct kvm_vcpu *vcpu) | ||
788 | if (eaddr & (0xFFFUL << 52)) | ||
789 | return H_PARAMETER; | ||
790 | |||
791 | - buf = kzalloc(n, GFP_KERNEL); | ||
792 | + buf = kzalloc(n, GFP_KERNEL | __GFP_NOWARN); | ||
793 | if (!buf) | ||
794 | return H_NO_MEM; | ||
795 | |||
796 | diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c | ||
797 | index ca9ffc1c8685d..a6a60e2b8f453 100644 | ||
798 | --- a/arch/powerpc/platforms/cell/iommu.c | ||
799 | +++ b/arch/powerpc/platforms/cell/iommu.c | ||
800 | @@ -976,6 +976,7 @@ static int __init cell_iommu_fixed_mapping_init(void) | ||
801 | if (hbase < dbase || (hend > (dbase + dsize))) { | ||
802 | pr_debug("iommu: hash window doesn't fit in" | ||
803 | "real DMA window\n"); | ||
804 | + of_node_put(np); | ||
805 | return -1; | ||
806 | } | ||
807 | } | ||
808 | diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c | ||
809 | index 6af3a6e600a70..80c9c4d715505 100644 | ||
810 | --- a/arch/powerpc/platforms/cell/pervasive.c | ||
811 | +++ b/arch/powerpc/platforms/cell/pervasive.c | ||
812 | @@ -77,6 +77,7 @@ static int cbe_system_reset_exception(struct pt_regs *regs) | ||
813 | switch (regs->msr & SRR1_WAKEMASK) { | ||
814 | case SRR1_WAKEDEC: | ||
815 | set_dec(1); | ||
816 | + break; | ||
817 | case SRR1_WAKEEE: | ||
818 | /* | ||
819 | * Handle these when interrupts get re-enabled and we take | ||
820 | diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c | ||
821 | index a1b7f79a8a152..de10c13de15c6 100644 | ||
822 | --- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c | ||
823 | +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c | ||
824 | @@ -215,6 +215,7 @@ void hlwd_pic_probe(void) | ||
825 | irq_set_chained_handler(cascade_virq, | ||
826 | hlwd_pic_irq_cascade); | ||
827 | hlwd_irq_host = host; | ||
828 | + of_node_put(np); | ||
829 | break; | ||
830 | } | ||
831 | } | ||
832 | diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c | ||
833 | index bf4be4b53b44d..210435a43bf95 100644 | ||
834 | --- a/arch/powerpc/platforms/powermac/low_i2c.c | ||
835 | +++ b/arch/powerpc/platforms/powermac/low_i2c.c | ||
836 | @@ -582,6 +582,7 @@ static void __init kw_i2c_add(struct pmac_i2c_host_kw *host, | ||
837 | bus->close = kw_i2c_close; | ||
838 | bus->xfer = kw_i2c_xfer; | ||
839 | mutex_init(&bus->mutex); | ||
840 | + lockdep_register_key(&bus->lock_key); | ||
841 | lockdep_set_class(&bus->mutex, &bus->lock_key); | ||
842 | if (controller == busnode) | ||
843 | bus->flags = pmac_i2c_multibus; | ||
844 | @@ -811,6 +812,7 @@ static void __init pmu_i2c_probe(void) | ||
845 | bus->hostdata = bus + 1; | ||
846 | bus->xfer = pmu_i2c_xfer; | ||
847 | mutex_init(&bus->mutex); | ||
848 | + lockdep_register_key(&bus->lock_key); | ||
849 | lockdep_set_class(&bus->mutex, &bus->lock_key); | ||
850 | bus->flags = pmac_i2c_multibus; | ||
851 | list_add(&bus->link, &pmac_i2c_busses); | ||
852 | @@ -934,6 +936,7 @@ static void __init smu_i2c_probe(void) | ||
853 | bus->hostdata = bus + 1; | ||
854 | bus->xfer = smu_i2c_xfer; | ||
855 | mutex_init(&bus->mutex); | ||
856 | + lockdep_register_key(&bus->lock_key); | ||
857 | lockdep_set_class(&bus->mutex, &bus->lock_key); | ||
858 | bus->flags = 0; | ||
859 | list_add(&bus->link, &pmac_i2c_busses); | ||
860 | diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c | ||
861 | index 608569082ba0b..123a0e799b7bd 100644 | ||
862 | --- a/arch/powerpc/platforms/powernv/opal-lpc.c | ||
863 | +++ b/arch/powerpc/platforms/powernv/opal-lpc.c | ||
864 | @@ -396,6 +396,7 @@ void __init opal_lpc_init(void) | ||
865 | if (!of_get_property(np, "primary", NULL)) | ||
866 | continue; | ||
867 | opal_lpc_chip_id = of_get_ibm_chip_id(np); | ||
868 | + of_node_put(np); | ||
869 | break; | ||
870 | } | ||
871 | if (opal_lpc_chip_id < 0) | ||
872 | diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c | ||
873 | index 46071be897ab0..90943bf3e5eec 100644 | ||
874 | --- a/arch/s390/mm/pgalloc.c | ||
875 | +++ b/arch/s390/mm/pgalloc.c | ||
876 | @@ -255,13 +255,15 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) | ||
877 | /* Free 2K page table fragment of a 4K page */ | ||
878 | bit = (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); | ||
879 | spin_lock_bh(&mm->context.lock); | ||
880 | - mask = atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); | ||
881 | + mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); | ||
882 | mask >>= 24; | ||
883 | if (mask & 3) | ||
884 | list_add(&page->lru, &mm->context.pgtable_list); | ||
885 | else | ||
886 | list_del(&page->lru); | ||
887 | spin_unlock_bh(&mm->context.lock); | ||
888 | + mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); | ||
889 | + mask >>= 24; | ||
890 | if (mask != 0) | ||
891 | return; | ||
892 | } else { | ||
893 | diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h | ||
894 | index 0c50fa6e8a55b..fbb709a222839 100644 | ||
895 | --- a/arch/um/include/shared/registers.h | ||
896 | +++ b/arch/um/include/shared/registers.h | ||
897 | @@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); | ||
898 | extern int save_fpx_registers(int pid, unsigned long *fp_regs); | ||
899 | extern int restore_fpx_registers(int pid, unsigned long *fp_regs); | ||
900 | extern int save_registers(int pid, struct uml_pt_regs *regs); | ||
901 | -extern int restore_registers(int pid, struct uml_pt_regs *regs); | ||
902 | -extern int init_registers(int pid); | ||
903 | +extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); | ||
904 | +extern int init_pid_registers(int pid); | ||
905 | extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); | ||
906 | extern unsigned long get_thread_reg(int reg, jmp_buf *buf); | ||
907 | extern int get_fp_registers(int pid, unsigned long *regs); | ||
908 | diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c | ||
909 | index 2d9270508e156..b123955be7acc 100644 | ||
910 | --- a/arch/um/os-Linux/registers.c | ||
911 | +++ b/arch/um/os-Linux/registers.c | ||
912 | @@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) | ||
913 | return 0; | ||
914 | } | ||
915 | |||
916 | -int restore_registers(int pid, struct uml_pt_regs *regs) | ||
917 | +int restore_pid_registers(int pid, struct uml_pt_regs *regs) | ||
918 | { | ||
919 | int err; | ||
920 | |||
921 | @@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) | ||
922 | static unsigned long exec_regs[MAX_REG_NR]; | ||
923 | static unsigned long exec_fp_regs[FP_SIZE]; | ||
924 | |||
925 | -int init_registers(int pid) | ||
926 | +int init_pid_registers(int pid) | ||
927 | { | ||
928 | int err; | ||
929 | |||
930 | diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c | ||
931 | index f79dc338279e6..b28373a2b8d2d 100644 | ||
932 | --- a/arch/um/os-Linux/start_up.c | ||
933 | +++ b/arch/um/os-Linux/start_up.c | ||
934 | @@ -336,7 +336,7 @@ void __init os_early_checks(void) | ||
935 | check_tmpexec(); | ||
936 | |||
937 | pid = start_ptraced_child(); | ||
938 | - if (init_registers(pid)) | ||
939 | + if (init_pid_registers(pid)) | ||
940 | fatal("Failed to initialize default registers"); | ||
941 | stop_ptraced_child(pid, 1, 1); | ||
942 | } | ||
943 | diff --git a/arch/x86/include/asm/realmode.h b/arch/x86/include/asm/realmode.h | ||
944 | index 09ecc32f65248..52d7512ea91ab 100644 | ||
945 | --- a/arch/x86/include/asm/realmode.h | ||
946 | +++ b/arch/x86/include/asm/realmode.h | ||
947 | @@ -82,6 +82,7 @@ static inline void set_real_mode_mem(phys_addr_t mem) | ||
948 | } | ||
949 | |||
950 | void reserve_real_mode(void); | ||
951 | +void load_trampoline_pgtable(void); | ||
952 | |||
953 | #endif /* __ASSEMBLY__ */ | ||
954 | |||
955 | diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c | ||
956 | index c2a9762d278dd..8a2b8e7913149 100644 | ||
957 | --- a/arch/x86/kernel/cpu/mce/core.c | ||
958 | +++ b/arch/x86/kernel/cpu/mce/core.c | ||
959 | @@ -310,11 +310,17 @@ static void wait_for_panic(void) | ||
960 | panic("Panicing machine check CPU died"); | ||
961 | } | ||
962 | |||
963 | -static void mce_panic(const char *msg, struct mce *final, char *exp) | ||
964 | +static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) | ||
965 | { | ||
966 | - int apei_err = 0; | ||
967 | struct llist_node *pending; | ||
968 | struct mce_evt_llist *l; | ||
969 | + int apei_err = 0; | ||
970 | + | ||
971 | + /* | ||
972 | + * Allow instrumentation around external facilities usage. Not that it | ||
973 | + * matters a whole lot since the machine is going to panic anyway. | ||
974 | + */ | ||
975 | + instrumentation_begin(); | ||
976 | |||
977 | if (!fake_panic) { | ||
978 | /* | ||
979 | @@ -329,7 +335,7 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) | ||
980 | } else { | ||
981 | /* Don't log too much for fake panic */ | ||
982 | if (atomic_inc_return(&mce_fake_panicked) > 1) | ||
983 | - return; | ||
984 | + goto out; | ||
985 | } | ||
986 | pending = mce_gen_pool_prepare_records(); | ||
987 | /* First print corrected ones that are still unlogged */ | ||
988 | @@ -367,6 +373,9 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) | ||
989 | panic(msg); | ||
990 | } else | ||
991 | pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); | ||
992 | + | ||
993 | +out: | ||
994 | + instrumentation_end(); | ||
995 | } | ||
996 | |||
997 | /* Support code for software error injection */ | ||
998 | @@ -691,7 +700,7 @@ static struct notifier_block mce_default_nb = { | ||
999 | /* | ||
1000 | * Read ADDR and MISC registers. | ||
1001 | */ | ||
1002 | -static void mce_read_aux(struct mce *m, int i) | ||
1003 | +static noinstr void mce_read_aux(struct mce *m, int i) | ||
1004 | { | ||
1005 | if (m->status & MCI_STATUS_MISCV) | ||
1006 | m->misc = mce_rdmsrl(msr_ops.misc(i)); | ||
1007 | @@ -1071,10 +1080,13 @@ static int mce_start(int *no_way_out) | ||
1008 | * Synchronize between CPUs after main scanning loop. | ||
1009 | * This invokes the bulk of the Monarch processing. | ||
1010 | */ | ||
1011 | -static int mce_end(int order) | ||
1012 | +static noinstr int mce_end(int order) | ||
1013 | { | ||
1014 | - int ret = -1; | ||
1015 | u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; | ||
1016 | + int ret = -1; | ||
1017 | + | ||
1018 | + /* Allow instrumentation around external facilities. */ | ||
1019 | + instrumentation_begin(); | ||
1020 | |||
1021 | if (!timeout) | ||
1022 | goto reset; | ||
1023 | @@ -1118,7 +1130,8 @@ static int mce_end(int order) | ||
1024 | /* | ||
1025 | * Don't reset anything. That's done by the Monarch. | ||
1026 | */ | ||
1027 | - return 0; | ||
1028 | + ret = 0; | ||
1029 | + goto out; | ||
1030 | } | ||
1031 | |||
1032 | /* | ||
1033 | @@ -1133,6 +1146,10 @@ reset: | ||
1034 | * Let others run again. | ||
1035 | */ | ||
1036 | atomic_set(&mce_executing, 0); | ||
1037 | + | ||
1038 | +out: | ||
1039 | + instrumentation_end(); | ||
1040 | + | ||
1041 | return ret; | ||
1042 | } | ||
1043 | |||
1044 | diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c | ||
1045 | index eb2d41c1816d6..e1fda5b19b6f6 100644 | ||
1046 | --- a/arch/x86/kernel/cpu/mce/inject.c | ||
1047 | +++ b/arch/x86/kernel/cpu/mce/inject.c | ||
1048 | @@ -347,7 +347,7 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf, | ||
1049 | char buf[MAX_FLAG_OPT_SIZE], *__buf; | ||
1050 | int err; | ||
1051 | |||
1052 | - if (cnt > MAX_FLAG_OPT_SIZE) | ||
1053 | + if (!cnt || cnt > MAX_FLAG_OPT_SIZE) | ||
1054 | return -EINVAL; | ||
1055 | |||
1056 | if (copy_from_user(&buf, ubuf, cnt)) | ||
1057 | diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c | ||
1058 | index 6f6b1d04dadf9..50225bc0383b9 100644 | ||
1059 | --- a/arch/x86/kernel/early-quirks.c | ||
1060 | +++ b/arch/x86/kernel/early-quirks.c | ||
1061 | @@ -515,6 +515,7 @@ static const struct intel_early_ops gen11_early_ops __initconst = { | ||
1062 | .stolen_size = gen9_stolen_size, | ||
1063 | }; | ||
1064 | |||
1065 | +/* Intel integrated GPUs for which we need to reserve "stolen memory" */ | ||
1066 | static const struct pci_device_id intel_early_ids[] __initconst = { | ||
1067 | INTEL_I830_IDS(&i830_early_ops), | ||
1068 | INTEL_I845G_IDS(&i845_early_ops), | ||
1069 | @@ -587,6 +588,13 @@ static void __init intel_graphics_quirks(int num, int slot, int func) | ||
1070 | u16 device; | ||
1071 | int i; | ||
1072 | |||
1073 | + /* | ||
1074 | + * Reserve "stolen memory" for an integrated GPU. If we've already | ||
1075 | + * found one, there's nothing to do for other (discrete) GPUs. | ||
1076 | + */ | ||
1077 | + if (resource_size(&intel_graphics_stolen_res)) | ||
1078 | + return; | ||
1079 | + | ||
1080 | device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); | ||
1081 | |||
1082 | for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) { | ||
1083 | @@ -699,7 +707,7 @@ static struct chipset early_qrk[] __initdata = { | ||
1084 | { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, | ||
1085 | PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, | ||
1086 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, | ||
1087 | - QFLAG_APPLY_ONCE, intel_graphics_quirks }, | ||
1088 | + 0, intel_graphics_quirks }, | ||
1089 | /* | ||
1090 | * HPET on the current version of the Baytrail platform has accuracy | ||
1091 | * problems: it will halt in deep idle state - so we disable it. | ||
1092 | diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c | ||
1093 | index d65d1afb27161..fdef27a84d713 100644 | ||
1094 | --- a/arch/x86/kernel/reboot.c | ||
1095 | +++ b/arch/x86/kernel/reboot.c | ||
1096 | @@ -113,17 +113,9 @@ void __noreturn machine_real_restart(unsigned int type) | ||
1097 | spin_unlock(&rtc_lock); | ||
1098 | |||
1099 | /* | ||
1100 | - * Switch back to the initial page table. | ||
1101 | + * Switch to the trampoline page table. | ||
1102 | */ | ||
1103 | -#ifdef CONFIG_X86_32 | ||
1104 | - load_cr3(initial_page_table); | ||
1105 | -#else | ||
1106 | - write_cr3(real_mode_header->trampoline_pgd); | ||
1107 | - | ||
1108 | - /* Exiting long mode will fail if CR4.PCIDE is set. */ | ||
1109 | - if (boot_cpu_has(X86_FEATURE_PCID)) | ||
1110 | - cr4_clear_bits(X86_CR4_PCIDE); | ||
1111 | -#endif | ||
1112 | + load_trampoline_pgtable(); | ||
1113 | |||
1114 | /* Jump to the identity-mapped low memory code */ | ||
1115 | #ifdef CONFIG_X86_32 | ||
1116 | diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c | ||
1117 | index de371e52cfa85..fac50ebb122b5 100644 | ||
1118 | --- a/arch/x86/realmode/init.c | ||
1119 | +++ b/arch/x86/realmode/init.c | ||
1120 | @@ -16,6 +16,32 @@ u32 *trampoline_cr4_features; | ||
1121 | /* Hold the pgd entry used on booting additional CPUs */ | ||
1122 | pgd_t trampoline_pgd_entry; | ||
1123 | |||
1124 | +void load_trampoline_pgtable(void) | ||
1125 | +{ | ||
1126 | +#ifdef CONFIG_X86_32 | ||
1127 | + load_cr3(initial_page_table); | ||
1128 | +#else | ||
1129 | + /* | ||
1130 | + * This function is called before exiting to real-mode and that will | ||
1131 | + * fail with CR4.PCIDE still set. | ||
1132 | + */ | ||
1133 | + if (boot_cpu_has(X86_FEATURE_PCID)) | ||
1134 | + cr4_clear_bits(X86_CR4_PCIDE); | ||
1135 | + | ||
1136 | + write_cr3(real_mode_header->trampoline_pgd); | ||
1137 | +#endif | ||
1138 | + | ||
1139 | + /* | ||
1140 | + * The CR3 write above will not flush global TLB entries. | ||
1141 | + * Stale, global entries from previous page tables may still be | ||
1142 | + * present. Flush those stale entries. | ||
1143 | + * | ||
1144 | + * This ensures that memory accessed while running with | ||
1145 | + * trampoline_pgd is *actually* mapped into trampoline_pgd. | ||
1146 | + */ | ||
1147 | + __flush_tlb_all(); | ||
1148 | +} | ||
1149 | + | ||
1150 | void __init reserve_real_mode(void) | ||
1151 | { | ||
1152 | phys_addr_t mem; | ||
1153 | diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c | ||
1154 | index 58f51667e2e4b..8249685b40960 100644 | ||
1155 | --- a/arch/x86/um/syscalls_64.c | ||
1156 | +++ b/arch/x86/um/syscalls_64.c | ||
1157 | @@ -11,6 +11,7 @@ | ||
1158 | #include <linux/uaccess.h> | ||
1159 | #include <asm/prctl.h> /* XXX This should get the constants from libc */ | ||
1160 | #include <os.h> | ||
1161 | +#include <registers.h> | ||
1162 | |||
1163 | long arch_prctl(struct task_struct *task, int option, | ||
1164 | unsigned long __user *arg2) | ||
1165 | @@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option, | ||
1166 | switch (option) { | ||
1167 | case ARCH_SET_FS: | ||
1168 | case ARCH_SET_GS: | ||
1169 | - ret = restore_registers(pid, ¤t->thread.regs.regs); | ||
1170 | + ret = restore_pid_registers(pid, ¤t->thread.regs.regs); | ||
1171 | if (ret) | ||
1172 | return ret; | ||
1173 | break; | ||
1174 | diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c | ||
1175 | index d3d2dbfba680c..cd3debefe990d 100644 | ||
1176 | --- a/drivers/acpi/acpica/exfield.c | ||
1177 | +++ b/drivers/acpi/acpica/exfield.c | ||
1178 | @@ -320,12 +320,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | ||
1179 | obj_desc->field.base_byte_offset, | ||
1180 | source_desc->buffer.pointer, data_length); | ||
1181 | |||
1182 | - if ((obj_desc->field.region_obj->region.address == | ||
1183 | - PCC_MASTER_SUBSPACE | ||
1184 | - && MASTER_SUBSPACE_COMMAND(obj_desc->field. | ||
1185 | - base_byte_offset)) | ||
1186 | - || GENERIC_SUBSPACE_COMMAND(obj_desc->field. | ||
1187 | - base_byte_offset)) { | ||
1188 | + if (MASTER_SUBSPACE_COMMAND(obj_desc->field.base_byte_offset)) { | ||
1189 | |||
1190 | /* Perform the write */ | ||
1191 | |||
1192 | diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c | ||
1193 | index 06e35ea098234..6d84618ba3871 100644 | ||
1194 | --- a/drivers/acpi/acpica/exoparg1.c | ||
1195 | +++ b/drivers/acpi/acpica/exoparg1.c | ||
1196 | @@ -1007,7 +1007,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | ||
1197 | (walk_state, return_desc, | ||
1198 | &temp_desc); | ||
1199 | if (ACPI_FAILURE(status)) { | ||
1200 | - goto cleanup; | ||
1201 | + return_ACPI_STATUS | ||
1202 | + (status); | ||
1203 | } | ||
1204 | |||
1205 | return_desc = temp_desc; | ||
1206 | diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c | ||
1207 | index aa502ae3b6b31..de0a59878e52d 100644 | ||
1208 | --- a/drivers/acpi/acpica/hwesleep.c | ||
1209 | +++ b/drivers/acpi/acpica/hwesleep.c | ||
1210 | @@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) | ||
1211 | |||
1212 | /* Flush caches, as per ACPI specification */ | ||
1213 | |||
1214 | - ACPI_FLUSH_CPU_CACHE(); | ||
1215 | + if (sleep_state < ACPI_STATE_S4) { | ||
1216 | + ACPI_FLUSH_CPU_CACHE(); | ||
1217 | + } | ||
1218 | |||
1219 | status = acpi_os_enter_sleep(sleep_state, sleep_control, 0); | ||
1220 | if (status == AE_CTRL_TERMINATE) { | ||
1221 | diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c | ||
1222 | index 5f7d63badbe9d..321aaad97e2f7 100644 | ||
1223 | --- a/drivers/acpi/acpica/hwsleep.c | ||
1224 | +++ b/drivers/acpi/acpica/hwsleep.c | ||
1225 | @@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) | ||
1226 | |||
1227 | /* Flush caches, as per ACPI specification */ | ||
1228 | |||
1229 | - ACPI_FLUSH_CPU_CACHE(); | ||
1230 | + if (sleep_state < ACPI_STATE_S4) { | ||
1231 | + ACPI_FLUSH_CPU_CACHE(); | ||
1232 | + } | ||
1233 | |||
1234 | status = acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); | ||
1235 | if (status == AE_CTRL_TERMINATE) { | ||
1236 | diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c | ||
1237 | index 79731efbe8fe2..4e3398819718d 100644 | ||
1238 | --- a/drivers/acpi/acpica/hwxfsleep.c | ||
1239 | +++ b/drivers/acpi/acpica/hwxfsleep.c | ||
1240 | @@ -162,8 +162,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void) | ||
1241 | return_ACPI_STATUS(status); | ||
1242 | } | ||
1243 | |||
1244 | - ACPI_FLUSH_CPU_CACHE(); | ||
1245 | - | ||
1246 | status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, | ||
1247 | (u32)acpi_gbl_FADT.s4_bios_request, 8); | ||
1248 | |||
1249 | diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c | ||
1250 | index 72d2c0b656339..cb1750e7a6281 100644 | ||
1251 | --- a/drivers/acpi/acpica/utdelete.c | ||
1252 | +++ b/drivers/acpi/acpica/utdelete.c | ||
1253 | @@ -422,6 +422,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | ||
1254 | ACPI_WARNING((AE_INFO, | ||
1255 | "Obj %p, Reference Count is already zero, cannot decrement\n", | ||
1256 | object)); | ||
1257 | + return; | ||
1258 | } | ||
1259 | |||
1260 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS, | ||
1261 | diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c | ||
1262 | index 6e96ed68b3379..4e0aea5f008e3 100644 | ||
1263 | --- a/drivers/acpi/battery.c | ||
1264 | +++ b/drivers/acpi/battery.c | ||
1265 | @@ -65,6 +65,7 @@ static int battery_bix_broken_package; | ||
1266 | static int battery_notification_delay_ms; | ||
1267 | static int battery_ac_is_broken; | ||
1268 | static int battery_check_pmic = 1; | ||
1269 | +static int battery_quirk_notcharging; | ||
1270 | static unsigned int cache_time = 1000; | ||
1271 | module_param(cache_time, uint, 0644); | ||
1272 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | ||
1273 | @@ -233,6 +234,8 @@ static int acpi_battery_get_property(struct power_supply *psy, | ||
1274 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | ||
1275 | else if (acpi_battery_is_charged(battery)) | ||
1276 | val->intval = POWER_SUPPLY_STATUS_FULL; | ||
1277 | + else if (battery_quirk_notcharging) | ||
1278 | + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
1279 | else | ||
1280 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
1281 | break; | ||
1282 | @@ -1337,6 +1340,12 @@ battery_do_not_check_pmic_quirk(const struct dmi_system_id *d) | ||
1283 | return 0; | ||
1284 | } | ||
1285 | |||
1286 | +static int __init battery_quirk_not_charging(const struct dmi_system_id *d) | ||
1287 | +{ | ||
1288 | + battery_quirk_notcharging = 1; | ||
1289 | + return 0; | ||
1290 | +} | ||
1291 | + | ||
1292 | static const struct dmi_system_id bat_dmi_table[] __initconst = { | ||
1293 | { | ||
1294 | /* NEC LZ750/LS */ | ||
1295 | @@ -1381,6 +1390,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { | ||
1296 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), | ||
1297 | }, | ||
1298 | }, | ||
1299 | + { | ||
1300 | + /* | ||
1301 | + * On Lenovo ThinkPads the BIOS specification defines | ||
1302 | + * a state when the bits for charging and discharging | ||
1303 | + * are both set to 0. That state is "Not Charging". | ||
1304 | + */ | ||
1305 | + .callback = battery_quirk_not_charging, | ||
1306 | + .ident = "Lenovo ThinkPad", | ||
1307 | + .matches = { | ||
1308 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
1309 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), | ||
1310 | + }, | ||
1311 | + }, | ||
1312 | {}, | ||
1313 | }; | ||
1314 | |||
1315 | diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c | ||
1316 | index 258a8df235cfb..e5b92958c299e 100644 | ||
1317 | --- a/drivers/acpi/ec.c | ||
1318 | +++ b/drivers/acpi/ec.c | ||
1319 | @@ -167,6 +167,7 @@ struct acpi_ec_query { | ||
1320 | struct transaction transaction; | ||
1321 | struct work_struct work; | ||
1322 | struct acpi_ec_query_handler *handler; | ||
1323 | + struct acpi_ec *ec; | ||
1324 | }; | ||
1325 | |||
1326 | static int acpi_ec_query(struct acpi_ec *ec, u8 *data); | ||
1327 | @@ -462,6 +463,7 @@ static void acpi_ec_submit_query(struct acpi_ec *ec) | ||
1328 | ec_dbg_evt("Command(%s) submitted/blocked", | ||
1329 | acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); | ||
1330 | ec->nr_pending_queries++; | ||
1331 | + ec->events_in_progress++; | ||
1332 | queue_work(ec_wq, &ec->work); | ||
1333 | } | ||
1334 | } | ||
1335 | @@ -528,7 +530,7 @@ static void acpi_ec_enable_event(struct acpi_ec *ec) | ||
1336 | #ifdef CONFIG_PM_SLEEP | ||
1337 | static void __acpi_ec_flush_work(void) | ||
1338 | { | ||
1339 | - drain_workqueue(ec_wq); /* flush ec->work */ | ||
1340 | + flush_workqueue(ec_wq); /* flush ec->work */ | ||
1341 | flush_workqueue(ec_query_wq); /* flush queries */ | ||
1342 | } | ||
1343 | |||
1344 | @@ -1119,7 +1121,7 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | ||
1345 | } | ||
1346 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); | ||
1347 | |||
1348 | -static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) | ||
1349 | +static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval) | ||
1350 | { | ||
1351 | struct acpi_ec_query *q; | ||
1352 | struct transaction *t; | ||
1353 | @@ -1127,11 +1129,13 @@ static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) | ||
1354 | q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); | ||
1355 | if (!q) | ||
1356 | return NULL; | ||
1357 | + | ||
1358 | INIT_WORK(&q->work, acpi_ec_event_processor); | ||
1359 | t = &q->transaction; | ||
1360 | t->command = ACPI_EC_COMMAND_QUERY; | ||
1361 | t->rdata = pval; | ||
1362 | t->rlen = 1; | ||
1363 | + q->ec = ec; | ||
1364 | return q; | ||
1365 | } | ||
1366 | |||
1367 | @@ -1148,13 +1152,21 @@ static void acpi_ec_event_processor(struct work_struct *work) | ||
1368 | { | ||
1369 | struct acpi_ec_query *q = container_of(work, struct acpi_ec_query, work); | ||
1370 | struct acpi_ec_query_handler *handler = q->handler; | ||
1371 | + struct acpi_ec *ec = q->ec; | ||
1372 | |||
1373 | ec_dbg_evt("Query(0x%02x) started", handler->query_bit); | ||
1374 | + | ||
1375 | if (handler->func) | ||
1376 | handler->func(handler->data); | ||
1377 | else if (handler->handle) | ||
1378 | acpi_evaluate_object(handler->handle, NULL, NULL, NULL); | ||
1379 | + | ||
1380 | ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit); | ||
1381 | + | ||
1382 | + spin_lock_irq(&ec->lock); | ||
1383 | + ec->queries_in_progress--; | ||
1384 | + spin_unlock_irq(&ec->lock); | ||
1385 | + | ||
1386 | acpi_ec_delete_query(q); | ||
1387 | } | ||
1388 | |||
1389 | @@ -1164,7 +1176,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) | ||
1390 | int result; | ||
1391 | struct acpi_ec_query *q; | ||
1392 | |||
1393 | - q = acpi_ec_create_query(&value); | ||
1394 | + q = acpi_ec_create_query(ec, &value); | ||
1395 | if (!q) | ||
1396 | return -ENOMEM; | ||
1397 | |||
1398 | @@ -1186,19 +1198,20 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) | ||
1399 | } | ||
1400 | |||
1401 | /* | ||
1402 | - * It is reported that _Qxx are evaluated in a parallel way on | ||
1403 | - * Windows: | ||
1404 | + * It is reported that _Qxx are evaluated in a parallel way on Windows: | ||
1405 | * https://bugzilla.kernel.org/show_bug.cgi?id=94411 | ||
1406 | * | ||
1407 | - * Put this log entry before schedule_work() in order to make | ||
1408 | - * it appearing before any other log entries occurred during the | ||
1409 | - * work queue execution. | ||
1410 | + * Put this log entry before queue_work() to make it appear in the log | ||
1411 | + * before any other messages emitted during workqueue handling. | ||
1412 | */ | ||
1413 | ec_dbg_evt("Query(0x%02x) scheduled", value); | ||
1414 | - if (!queue_work(ec_query_wq, &q->work)) { | ||
1415 | - ec_dbg_evt("Query(0x%02x) overlapped", value); | ||
1416 | - result = -EBUSY; | ||
1417 | - } | ||
1418 | + | ||
1419 | + spin_lock_irq(&ec->lock); | ||
1420 | + | ||
1421 | + ec->queries_in_progress++; | ||
1422 | + queue_work(ec_query_wq, &q->work); | ||
1423 | + | ||
1424 | + spin_unlock_irq(&ec->lock); | ||
1425 | |||
1426 | err_exit: | ||
1427 | if (result) | ||
1428 | @@ -1256,6 +1269,10 @@ static void acpi_ec_event_handler(struct work_struct *work) | ||
1429 | ec_dbg_evt("Event stopped"); | ||
1430 | |||
1431 | acpi_ec_check_event(ec); | ||
1432 | + | ||
1433 | + spin_lock_irqsave(&ec->lock, flags); | ||
1434 | + ec->events_in_progress--; | ||
1435 | + spin_unlock_irqrestore(&ec->lock, flags); | ||
1436 | } | ||
1437 | |||
1438 | static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, | ||
1439 | @@ -1972,6 +1989,7 @@ void acpi_ec_set_gpe_wake_mask(u8 action) | ||
1440 | |||
1441 | bool acpi_ec_dispatch_gpe(void) | ||
1442 | { | ||
1443 | + bool work_in_progress; | ||
1444 | u32 ret; | ||
1445 | |||
1446 | if (!first_ec) | ||
1447 | @@ -1992,8 +2010,19 @@ bool acpi_ec_dispatch_gpe(void) | ||
1448 | if (ret == ACPI_INTERRUPT_HANDLED) | ||
1449 | pm_pr_dbg("EC GPE dispatched\n"); | ||
1450 | |||
1451 | - /* Flush the event and query workqueues. */ | ||
1452 | - acpi_ec_flush_work(); | ||
1453 | + /* Drain EC work. */ | ||
1454 | + do { | ||
1455 | + acpi_ec_flush_work(); | ||
1456 | + | ||
1457 | + pm_pr_dbg("ACPI EC work flushed\n"); | ||
1458 | + | ||
1459 | + spin_lock_irq(&first_ec->lock); | ||
1460 | + | ||
1461 | + work_in_progress = first_ec->events_in_progress + | ||
1462 | + first_ec->queries_in_progress > 0; | ||
1463 | + | ||
1464 | + spin_unlock_irq(&first_ec->lock); | ||
1465 | + } while (work_in_progress && !pm_wakeup_pending()); | ||
1466 | |||
1467 | return false; | ||
1468 | } | ||
1469 | diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h | ||
1470 | index 159c422601bc4..62b6b36f3a37c 100644 | ||
1471 | --- a/drivers/acpi/internal.h | ||
1472 | +++ b/drivers/acpi/internal.h | ||
1473 | @@ -183,6 +183,8 @@ struct acpi_ec { | ||
1474 | struct work_struct work; | ||
1475 | unsigned long timestamp; | ||
1476 | unsigned long nr_pending_queries; | ||
1477 | + unsigned int events_in_progress; | ||
1478 | + unsigned int queries_in_progress; | ||
1479 | bool busy_polling; | ||
1480 | unsigned int polling_guard; | ||
1481 | }; | ||
1482 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
1483 | index 95d119ff76b65..5d4be80ee6cb4 100644 | ||
1484 | --- a/drivers/acpi/scan.c | ||
1485 | +++ b/drivers/acpi/scan.c | ||
1486 | @@ -1577,6 +1577,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) | ||
1487 | { | ||
1488 | struct list_head resource_list; | ||
1489 | bool is_serial_bus_slave = false; | ||
1490 | + static const struct acpi_device_id ignore_serial_bus_ids[] = { | ||
1491 | /* | ||
1492 | * These devices have multiple I2cSerialBus resources and an i2c-client | ||
1493 | * must be instantiated for each, each with its own i2c_device_id. | ||
1494 | @@ -1585,11 +1586,18 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) | ||
1495 | * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows | ||
1496 | * which i2c_device_id to use for each resource. | ||
1497 | */ | ||
1498 | - static const struct acpi_device_id i2c_multi_instantiate_ids[] = { | ||
1499 | {"BSG1160", }, | ||
1500 | {"BSG2150", }, | ||
1501 | {"INT33FE", }, | ||
1502 | {"INT3515", }, | ||
1503 | + /* | ||
1504 | + * HIDs of device with an UartSerialBusV2 resource for which userspace | ||
1505 | + * expects a regular tty cdev to be created (instead of the in kernel | ||
1506 | + * serdev) and which have a kernel driver which expects a platform_dev | ||
1507 | + * such as the rfkill-gpio driver. | ||
1508 | + */ | ||
1509 | + {"BCM4752", }, | ||
1510 | + {"LNV4752", }, | ||
1511 | {} | ||
1512 | }; | ||
1513 | |||
1514 | @@ -1603,8 +1611,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) | ||
1515 | fwnode_property_present(&device->fwnode, "baud"))) | ||
1516 | return true; | ||
1517 | |||
1518 | - /* Instantiate a pdev for the i2c-multi-instantiate drv to bind to */ | ||
1519 | - if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids)) | ||
1520 | + if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) | ||
1521 | return false; | ||
1522 | |||
1523 | INIT_LIST_HEAD(&resource_list); | ||
1524 | diff --git a/drivers/android/binder.c b/drivers/android/binder.c | ||
1525 | index 0512af0f04646..b9fb2a9269443 100644 | ||
1526 | --- a/drivers/android/binder.c | ||
1527 | +++ b/drivers/android/binder.c | ||
1528 | @@ -2660,8 +2660,8 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda, | ||
1529 | if (!ret) | ||
1530 | ret = binder_translate_fd(fd, offset, t, thread, | ||
1531 | in_reply_to); | ||
1532 | - if (ret < 0) | ||
1533 | - return ret; | ||
1534 | + if (ret) | ||
1535 | + return ret > 0 ? -EINVAL : ret; | ||
1536 | } | ||
1537 | return 0; | ||
1538 | } | ||
1539 | diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c | ||
1540 | index ac97a1e2e5ddc..02af4f109e59f 100644 | ||
1541 | --- a/drivers/block/floppy.c | ||
1542 | +++ b/drivers/block/floppy.c | ||
1543 | @@ -1003,7 +1003,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); | ||
1544 | static void cancel_activity(void) | ||
1545 | { | ||
1546 | do_floppy = NULL; | ||
1547 | - cancel_delayed_work_sync(&fd_timer); | ||
1548 | + cancel_delayed_work(&fd_timer); | ||
1549 | cancel_work_sync(&floppy_work); | ||
1550 | } | ||
1551 | |||
1552 | @@ -3112,6 +3112,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) | ||
1553 | } | ||
1554 | } | ||
1555 | |||
1556 | +#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) | ||
1557 | + | ||
1558 | static int raw_cmd_copyin(int cmd, void __user *param, | ||
1559 | struct floppy_raw_cmd **rcmd) | ||
1560 | { | ||
1561 | @@ -3149,7 +3151,7 @@ loop: | ||
1562 | ptr->resultcode = 0; | ||
1563 | |||
1564 | if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { | ||
1565 | - if (ptr->length <= 0) | ||
1566 | + if (ptr->length <= 0 || ptr->length >= MAX_LEN) | ||
1567 | return -EINVAL; | ||
1568 | ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); | ||
1569 | fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); | ||
1570 | diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c | ||
1571 | index 304178be1ef40..c2eb64bcd5d5d 100644 | ||
1572 | --- a/drivers/bluetooth/btmtksdio.c | ||
1573 | +++ b/drivers/bluetooth/btmtksdio.c | ||
1574 | @@ -1041,6 +1041,8 @@ static int btmtksdio_runtime_suspend(struct device *dev) | ||
1575 | if (!bdev) | ||
1576 | return 0; | ||
1577 | |||
1578 | + sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); | ||
1579 | + | ||
1580 | sdio_claim_host(bdev->func); | ||
1581 | |||
1582 | sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); | ||
1583 | diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c | ||
1584 | index 94ed734c1d7eb..c6bb380806f9b 100644 | ||
1585 | --- a/drivers/bluetooth/hci_bcm.c | ||
1586 | +++ b/drivers/bluetooth/hci_bcm.c | ||
1587 | @@ -1127,7 +1127,12 @@ static int bcm_probe(struct platform_device *pdev) | ||
1588 | return -ENOMEM; | ||
1589 | |||
1590 | dev->dev = &pdev->dev; | ||
1591 | - dev->irq = platform_get_irq(pdev, 0); | ||
1592 | + | ||
1593 | + ret = platform_get_irq(pdev, 0); | ||
1594 | + if (ret < 0) | ||
1595 | + return ret; | ||
1596 | + | ||
1597 | + dev->irq = ret; | ||
1598 | |||
1599 | if (has_acpi_companion(&pdev->dev)) { | ||
1600 | ret = bcm_acpi_probe(dev); | ||
1601 | diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h | ||
1602 | index 9ccb6b270b071..95164246afd1a 100644 | ||
1603 | --- a/drivers/char/mwave/3780i.h | ||
1604 | +++ b/drivers/char/mwave/3780i.h | ||
1605 | @@ -68,7 +68,7 @@ typedef struct { | ||
1606 | unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ | ||
1607 | unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ | ||
1608 | unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ | ||
1609 | - unsigned char Reserved:5; /* 0: Reserved */ | ||
1610 | + unsigned short Reserved:13; /* 0: Reserved */ | ||
1611 | } DSP_ISA_SLAVE_CONTROL; | ||
1612 | |||
1613 | |||
1614 | diff --git a/drivers/char/random.c b/drivers/char/random.c | ||
1615 | index 60b39af1279a4..19bfbaf135989 100644 | ||
1616 | --- a/drivers/char/random.c | ||
1617 | +++ b/drivers/char/random.c | ||
1618 | @@ -975,12 +975,14 @@ static struct crng_state *select_crng(void) | ||
1619 | |||
1620 | /* | ||
1621 | * crng_fast_load() can be called by code in the interrupt service | ||
1622 | - * path. So we can't afford to dilly-dally. | ||
1623 | + * path. So we can't afford to dilly-dally. Returns the number of | ||
1624 | + * bytes processed from cp. | ||
1625 | */ | ||
1626 | -static int crng_fast_load(const char *cp, size_t len) | ||
1627 | +static size_t crng_fast_load(const char *cp, size_t len) | ||
1628 | { | ||
1629 | unsigned long flags; | ||
1630 | char *p; | ||
1631 | + size_t ret = 0; | ||
1632 | |||
1633 | if (!spin_trylock_irqsave(&primary_crng.lock, flags)) | ||
1634 | return 0; | ||
1635 | @@ -991,7 +993,7 @@ static int crng_fast_load(const char *cp, size_t len) | ||
1636 | p = (unsigned char *) &primary_crng.state[4]; | ||
1637 | while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) { | ||
1638 | p[crng_init_cnt % CHACHA_KEY_SIZE] ^= *cp; | ||
1639 | - cp++; crng_init_cnt++; len--; | ||
1640 | + cp++; crng_init_cnt++; len--; ret++; | ||
1641 | } | ||
1642 | spin_unlock_irqrestore(&primary_crng.lock, flags); | ||
1643 | if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { | ||
1644 | @@ -1000,7 +1002,7 @@ static int crng_fast_load(const char *cp, size_t len) | ||
1645 | wake_up_interruptible(&crng_init_wait); | ||
1646 | pr_notice("random: fast init done\n"); | ||
1647 | } | ||
1648 | - return 1; | ||
1649 | + return ret; | ||
1650 | } | ||
1651 | |||
1652 | /* | ||
1653 | @@ -1353,7 +1355,7 @@ void add_interrupt_randomness(int irq, int irq_flags) | ||
1654 | if (unlikely(crng_init == 0)) { | ||
1655 | if ((fast_pool->count >= 64) && | ||
1656 | crng_fast_load((char *) fast_pool->pool, | ||
1657 | - sizeof(fast_pool->pool))) { | ||
1658 | + sizeof(fast_pool->pool)) > 0) { | ||
1659 | fast_pool->count = 0; | ||
1660 | fast_pool->last = now; | ||
1661 | } | ||
1662 | @@ -2501,8 +2503,11 @@ void add_hwgenerator_randomness(const char *buffer, size_t count, | ||
1663 | struct entropy_store *poolp = &input_pool; | ||
1664 | |||
1665 | if (unlikely(crng_init == 0)) { | ||
1666 | - crng_fast_load(buffer, count); | ||
1667 | - return; | ||
1668 | + size_t ret = crng_fast_load(buffer, count); | ||
1669 | + count -= ret; | ||
1670 | + buffer += ret; | ||
1671 | + if (!count || crng_init == 0) | ||
1672 | + return; | ||
1673 | } | ||
1674 | |||
1675 | /* Suspend writing if we're above the trickle threshold. | ||
1676 | diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c | ||
1677 | index 2fe26ec03552b..70f7859942287 100644 | ||
1678 | --- a/drivers/char/tpm/tpm_tis_core.c | ||
1679 | +++ b/drivers/char/tpm/tpm_tis_core.c | ||
1680 | @@ -877,7 +877,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, | ||
1681 | intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | | ||
1682 | TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; | ||
1683 | intmask &= ~TPM_GLOBAL_INT_ENABLE; | ||
1684 | + | ||
1685 | + rc = request_locality(chip, 0); | ||
1686 | + if (rc < 0) { | ||
1687 | + rc = -ENODEV; | ||
1688 | + goto out_err; | ||
1689 | + } | ||
1690 | + | ||
1691 | tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); | ||
1692 | + release_locality(chip, 0); | ||
1693 | |||
1694 | rc = tpm_chip_start(chip); | ||
1695 | if (rc) | ||
1696 | diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c | ||
1697 | index c5486537b9284..e637bd6b295bd 100644 | ||
1698 | --- a/drivers/clk/bcm/clk-bcm2835.c | ||
1699 | +++ b/drivers/clk/bcm/clk-bcm2835.c | ||
1700 | @@ -932,8 +932,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw) | ||
1701 | |||
1702 | static u32 bcm2835_clock_choose_div(struct clk_hw *hw, | ||
1703 | unsigned long rate, | ||
1704 | - unsigned long parent_rate, | ||
1705 | - bool round_up) | ||
1706 | + unsigned long parent_rate) | ||
1707 | { | ||
1708 | struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); | ||
1709 | const struct bcm2835_clock_data *data = clock->data; | ||
1710 | @@ -945,10 +944,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, | ||
1711 | |||
1712 | rem = do_div(temp, rate); | ||
1713 | div = temp; | ||
1714 | - | ||
1715 | - /* Round up and mask off the unused bits */ | ||
1716 | - if (round_up && ((div & unused_frac_mask) != 0 || rem != 0)) | ||
1717 | - div += unused_frac_mask + 1; | ||
1718 | div &= ~unused_frac_mask; | ||
1719 | |||
1720 | /* different clamping limits apply for a mash clock */ | ||
1721 | @@ -1079,7 +1074,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, | ||
1722 | struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); | ||
1723 | struct bcm2835_cprman *cprman = clock->cprman; | ||
1724 | const struct bcm2835_clock_data *data = clock->data; | ||
1725 | - u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false); | ||
1726 | + u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate); | ||
1727 | u32 ctl; | ||
1728 | |||
1729 | spin_lock(&cprman->regs_lock); | ||
1730 | @@ -1130,7 +1125,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw, | ||
1731 | |||
1732 | if (!(BIT(parent_idx) & data->set_rate_parent)) { | ||
1733 | *prate = clk_hw_get_rate(parent); | ||
1734 | - *div = bcm2835_clock_choose_div(hw, rate, *prate, true); | ||
1735 | + *div = bcm2835_clock_choose_div(hw, rate, *prate); | ||
1736 | |||
1737 | *avgrate = bcm2835_clock_rate_from_divisor(clock, *prate, *div); | ||
1738 | |||
1739 | @@ -1216,7 +1211,7 @@ static int bcm2835_clock_determine_rate(struct clk_hw *hw, | ||
1740 | rate = bcm2835_clock_choose_div_and_prate(hw, i, req->rate, | ||
1741 | &div, &prate, | ||
1742 | &avgrate); | ||
1743 | - if (rate > best_rate && rate <= req->rate) { | ||
1744 | + if (abs(req->rate - rate) < abs(req->rate - best_rate)) { | ||
1745 | best_parent = parent; | ||
1746 | best_prate = prate; | ||
1747 | best_rate = rate; | ||
1748 | diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c | ||
1749 | index 8f9f3d4a54fd2..20ed0955416a3 100644 | ||
1750 | --- a/drivers/clk/clk-si5341.c | ||
1751 | +++ b/drivers/clk/clk-si5341.c | ||
1752 | @@ -1303,7 +1303,7 @@ static int si5341_probe(struct i2c_client *client, | ||
1753 | clk_prepare(data->clk[i].hw.clk); | ||
1754 | } | ||
1755 | |||
1756 | - err = of_clk_add_hw_provider(client->dev.of_node, of_clk_si5341_get, | ||
1757 | + err = devm_of_clk_add_hw_provider(&client->dev, of_clk_si5341_get, | ||
1758 | data); | ||
1759 | if (err) { | ||
1760 | dev_err(&client->dev, "unable to add clk provider\n"); | ||
1761 | diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c | ||
1762 | index 5c75e3d906c20..682a18b392f08 100644 | ||
1763 | --- a/drivers/clk/clk-stm32f4.c | ||
1764 | +++ b/drivers/clk/clk-stm32f4.c | ||
1765 | @@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = { | ||
1766 | { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, | ||
1767 | { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, | ||
1768 | { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, | ||
1769 | - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, | ||
1770 | }; | ||
1771 | |||
1772 | static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { | ||
1773 | @@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { | ||
1774 | { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, | ||
1775 | { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, | ||
1776 | { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, | ||
1777 | - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, | ||
1778 | }; | ||
1779 | |||
1780 | static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { | ||
1781 | @@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { | ||
1782 | { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, | ||
1783 | { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, | ||
1784 | { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, | ||
1785 | - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, | ||
1786 | }; | ||
1787 | |||
1788 | static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { | ||
1789 | @@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { | ||
1790 | { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, | ||
1791 | { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, | ||
1792 | { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, | ||
1793 | - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, | ||
1794 | { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, | ||
1795 | }; | ||
1796 | |||
1797 | diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c | ||
1798 | index 58b5acee38306..882b42efd2582 100644 | ||
1799 | --- a/drivers/clk/imx/clk-imx8mn.c | ||
1800 | +++ b/drivers/clk/imx/clk-imx8mn.c | ||
1801 | @@ -358,9 +358,9 @@ static const char * const imx8mn_pdm_sels[] = {"osc_24m", "sys_pll2_100m", "audi | ||
1802 | |||
1803 | static const char * const imx8mn_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; | ||
1804 | |||
1805 | -static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "osc_27m", | ||
1806 | - "sys_pll1_200m", "audio_pll2_out", "vpu_pll", | ||
1807 | - "sys_pll1_80m", }; | ||
1808 | +static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "dummy", | ||
1809 | + "sys_pll1_200m", "audio_pll2_out", "sys_pll2_500m", | ||
1810 | + "dummy", "sys_pll1_80m", }; | ||
1811 | static const char * const imx8mn_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_400m", | ||
1812 | "sys_pll2_166m", "sys_pll3_out", "audio_pll1_out", | ||
1813 | "video_pll1_out", "osc_32k", }; | ||
1814 | diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c | ||
1815 | index 1f9c056e684ce..e8e36ec70b27f 100644 | ||
1816 | --- a/drivers/clk/meson/gxbb.c | ||
1817 | +++ b/drivers/clk/meson/gxbb.c | ||
1818 | @@ -712,6 +712,35 @@ static struct clk_regmap gxbb_mpll_prediv = { | ||
1819 | }; | ||
1820 | |||
1821 | static struct clk_regmap gxbb_mpll0_div = { | ||
1822 | + .data = &(struct meson_clk_mpll_data){ | ||
1823 | + .sdm = { | ||
1824 | + .reg_off = HHI_MPLL_CNTL7, | ||
1825 | + .shift = 0, | ||
1826 | + .width = 14, | ||
1827 | + }, | ||
1828 | + .sdm_en = { | ||
1829 | + .reg_off = HHI_MPLL_CNTL, | ||
1830 | + .shift = 25, | ||
1831 | + .width = 1, | ||
1832 | + }, | ||
1833 | + .n2 = { | ||
1834 | + .reg_off = HHI_MPLL_CNTL7, | ||
1835 | + .shift = 16, | ||
1836 | + .width = 9, | ||
1837 | + }, | ||
1838 | + .lock = &meson_clk_lock, | ||
1839 | + }, | ||
1840 | + .hw.init = &(struct clk_init_data){ | ||
1841 | + .name = "mpll0_div", | ||
1842 | + .ops = &meson_clk_mpll_ops, | ||
1843 | + .parent_hws = (const struct clk_hw *[]) { | ||
1844 | + &gxbb_mpll_prediv.hw | ||
1845 | + }, | ||
1846 | + .num_parents = 1, | ||
1847 | + }, | ||
1848 | +}; | ||
1849 | + | ||
1850 | +static struct clk_regmap gxl_mpll0_div = { | ||
1851 | .data = &(struct meson_clk_mpll_data){ | ||
1852 | .sdm = { | ||
1853 | .reg_off = HHI_MPLL_CNTL7, | ||
1854 | @@ -748,7 +777,16 @@ static struct clk_regmap gxbb_mpll0 = { | ||
1855 | .hw.init = &(struct clk_init_data){ | ||
1856 | .name = "mpll0", | ||
1857 | .ops = &clk_regmap_gate_ops, | ||
1858 | - .parent_hws = (const struct clk_hw *[]) { &gxbb_mpll0_div.hw }, | ||
1859 | + .parent_data = &(const struct clk_parent_data) { | ||
1860 | + /* | ||
1861 | + * Note: | ||
1862 | + * GXL and GXBB have different SDM_EN registers. We | ||
1863 | + * fallback to the global naming string mechanism so | ||
1864 | + * mpll0_div picks up the appropriate one. | ||
1865 | + */ | ||
1866 | + .name = "mpll0_div", | ||
1867 | + .index = -1, | ||
1868 | + }, | ||
1869 | .num_parents = 1, | ||
1870 | .flags = CLK_SET_RATE_PARENT, | ||
1871 | }, | ||
1872 | @@ -3036,7 +3074,7 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data = { | ||
1873 | [CLKID_VAPB_1] = &gxbb_vapb_1.hw, | ||
1874 | [CLKID_VAPB_SEL] = &gxbb_vapb_sel.hw, | ||
1875 | [CLKID_VAPB] = &gxbb_vapb.hw, | ||
1876 | - [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw, | ||
1877 | + [CLKID_MPLL0_DIV] = &gxl_mpll0_div.hw, | ||
1878 | [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw, | ||
1879 | [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw, | ||
1880 | [CLKID_MPLL_PREDIV] = &gxbb_mpll_prediv.hw, | ||
1881 | @@ -3430,7 +3468,7 @@ static struct clk_regmap *const gxl_clk_regmaps[] = { | ||
1882 | &gxbb_mpll0, | ||
1883 | &gxbb_mpll1, | ||
1884 | &gxbb_mpll2, | ||
1885 | - &gxbb_mpll0_div, | ||
1886 | + &gxl_mpll0_div, | ||
1887 | &gxbb_mpll1_div, | ||
1888 | &gxbb_mpll2_div, | ||
1889 | &gxbb_cts_amclk_div, | ||
1890 | diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c | ||
1891 | index cb7949a2ac0ca..af9f348048629 100644 | ||
1892 | --- a/drivers/cpufreq/cpufreq.c | ||
1893 | +++ b/drivers/cpufreq/cpufreq.c | ||
1894 | @@ -1393,7 +1393,7 @@ static int cpufreq_online(unsigned int cpu) | ||
1895 | |||
1896 | ret = freq_qos_add_request(&policy->constraints, | ||
1897 | policy->min_freq_req, FREQ_QOS_MIN, | ||
1898 | - policy->min); | ||
1899 | + FREQ_QOS_MIN_DEFAULT_VALUE); | ||
1900 | if (ret < 0) { | ||
1901 | /* | ||
1902 | * So we don't call freq_qos_remove_request() for an | ||
1903 | @@ -1413,7 +1413,7 @@ static int cpufreq_online(unsigned int cpu) | ||
1904 | |||
1905 | ret = freq_qos_add_request(&policy->constraints, | ||
1906 | policy->max_freq_req, FREQ_QOS_MAX, | ||
1907 | - policy->max); | ||
1908 | + FREQ_QOS_MAX_DEFAULT_VALUE); | ||
1909 | if (ret < 0) { | ||
1910 | policy->max_freq_req = NULL; | ||
1911 | goto out_destroy_policy; | ||
1912 | diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c | ||
1913 | index 6863d70976746..28692d068176f 100644 | ||
1914 | --- a/drivers/crypto/caam/caamalg_qi2.c | ||
1915 | +++ b/drivers/crypto/caam/caamalg_qi2.c | ||
1916 | @@ -5421,7 +5421,7 @@ int dpaa2_caam_enqueue(struct device *dev, struct caam_request *req) | ||
1917 | dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1])); | ||
1918 | dpaa2_fd_set_flc(&fd, req->flc_dma); | ||
1919 | |||
1920 | - ppriv = this_cpu_ptr(priv->ppriv); | ||
1921 | + ppriv = raw_cpu_ptr(priv->ppriv); | ||
1922 | for (i = 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) { | ||
1923 | err = dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv->req_fqid, | ||
1924 | &fd); | ||
1925 | diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c | ||
1926 | index 72edb10181b86..41ffb088831de 100644 | ||
1927 | --- a/drivers/crypto/omap-aes.c | ||
1928 | +++ b/drivers/crypto/omap-aes.c | ||
1929 | @@ -1318,7 +1318,7 @@ static int omap_aes_suspend(struct device *dev) | ||
1930 | |||
1931 | static int omap_aes_resume(struct device *dev) | ||
1932 | { | ||
1933 | - pm_runtime_resume_and_get(dev); | ||
1934 | + pm_runtime_get_sync(dev); | ||
1935 | return 0; | ||
1936 | } | ||
1937 | #endif | ||
1938 | diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c | ||
1939 | index 0853e74583ade..29b0bad2507b1 100644 | ||
1940 | --- a/drivers/crypto/qce/sha.c | ||
1941 | +++ b/drivers/crypto/qce/sha.c | ||
1942 | @@ -512,8 +512,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, | ||
1943 | |||
1944 | ret = crypto_register_ahash(alg); | ||
1945 | if (ret) { | ||
1946 | - kfree(tmpl); | ||
1947 | dev_err(qce->dev, "%s registration failed\n", base->cra_name); | ||
1948 | + kfree(tmpl); | ||
1949 | return ret; | ||
1950 | } | ||
1951 | |||
1952 | diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c | ||
1953 | index e68b856d03b6e..fb640e0ea6140 100644 | ||
1954 | --- a/drivers/crypto/stm32/stm32-crc32.c | ||
1955 | +++ b/drivers/crypto/stm32/stm32-crc32.c | ||
1956 | @@ -230,7 +230,7 @@ static struct shash_alg algs[] = { | ||
1957 | .digestsize = CHKSUM_DIGEST_SIZE, | ||
1958 | .base = { | ||
1959 | .cra_name = "crc32", | ||
1960 | - .cra_driver_name = DRIVER_NAME, | ||
1961 | + .cra_driver_name = "stm32-crc32-crc32", | ||
1962 | .cra_priority = 200, | ||
1963 | .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, | ||
1964 | .cra_blocksize = CHKSUM_BLOCK_SIZE, | ||
1965 | @@ -252,7 +252,7 @@ static struct shash_alg algs[] = { | ||
1966 | .digestsize = CHKSUM_DIGEST_SIZE, | ||
1967 | .base = { | ||
1968 | .cra_name = "crc32c", | ||
1969 | - .cra_driver_name = DRIVER_NAME, | ||
1970 | + .cra_driver_name = "stm32-crc32-crc32c", | ||
1971 | .cra_priority = 200, | ||
1972 | .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, | ||
1973 | .cra_blocksize = CHKSUM_BLOCK_SIZE, | ||
1974 | diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c | ||
1975 | index 9b3511236ba25..69c2468f1053d 100644 | ||
1976 | --- a/drivers/crypto/stm32/stm32-cryp.c | ||
1977 | +++ b/drivers/crypto/stm32/stm32-cryp.c | ||
1978 | @@ -639,7 +639,7 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err) | ||
1979 | /* Phase 4 : output tag */ | ||
1980 | err = stm32_cryp_read_auth_tag(cryp); | ||
1981 | |||
1982 | - if (!err && (!(is_gcm(cryp) || is_ccm(cryp)))) | ||
1983 | + if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp)))) | ||
1984 | stm32_cryp_get_iv(cryp); | ||
1985 | |||
1986 | if (cryp->sgs_copied) { | ||
1987 | @@ -669,8 +669,6 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err) | ||
1988 | else | ||
1989 | crypto_finalize_ablkcipher_request(cryp->engine, cryp->req, | ||
1990 | err); | ||
1991 | - | ||
1992 | - memset(cryp->ctx->key, 0, cryp->ctx->keylen); | ||
1993 | } | ||
1994 | |||
1995 | static int stm32_cryp_cpu_start(struct stm32_cryp *cryp) | ||
1996 | @@ -2036,8 +2034,6 @@ err_engine1: | ||
1997 | list_del(&cryp->list); | ||
1998 | spin_unlock(&cryp_list.lock); | ||
1999 | |||
2000 | - pm_runtime_disable(dev); | ||
2001 | - pm_runtime_put_noidle(dev); | ||
2002 | pm_runtime_disable(dev); | ||
2003 | pm_runtime_put_noidle(dev); | ||
2004 | |||
2005 | diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c | ||
2006 | index d3fbd950be944..3e07f961e2f3d 100644 | ||
2007 | --- a/drivers/dma-buf/dma-fence-array.c | ||
2008 | +++ b/drivers/dma-buf/dma-fence-array.c | ||
2009 | @@ -104,7 +104,11 @@ static bool dma_fence_array_signaled(struct dma_fence *fence) | ||
2010 | { | ||
2011 | struct dma_fence_array *array = to_dma_fence_array(fence); | ||
2012 | |||
2013 | - return atomic_read(&array->num_pending) <= 0; | ||
2014 | + if (atomic_read(&array->num_pending) > 0) | ||
2015 | + return false; | ||
2016 | + | ||
2017 | + dma_fence_array_clear_pending_error(array); | ||
2018 | + return true; | ||
2019 | } | ||
2020 | |||
2021 | static void dma_fence_array_release(struct dma_fence *fence) | ||
2022 | diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c | ||
2023 | index 6f1e97ba3e786..f63d141481a3f 100644 | ||
2024 | --- a/drivers/dma/at_xdmac.c | ||
2025 | +++ b/drivers/dma/at_xdmac.c | ||
2026 | @@ -89,6 +89,7 @@ | ||
2027 | #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enable */ | ||
2028 | #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Source Update */ | ||
2029 | #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Destination Update */ | ||
2030 | +#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) | ||
2031 | #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descriptor View 0 */ | ||
2032 | #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descriptor View 1 */ | ||
2033 | #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descriptor View 2 */ | ||
2034 | @@ -220,15 +221,15 @@ struct at_xdmac { | ||
2035 | |||
2036 | /* Linked List Descriptor */ | ||
2037 | struct at_xdmac_lld { | ||
2038 | - dma_addr_t mbr_nda; /* Next Descriptor Member */ | ||
2039 | - u32 mbr_ubc; /* Microblock Control Member */ | ||
2040 | - dma_addr_t mbr_sa; /* Source Address Member */ | ||
2041 | - dma_addr_t mbr_da; /* Destination Address Member */ | ||
2042 | - u32 mbr_cfg; /* Configuration Register */ | ||
2043 | - u32 mbr_bc; /* Block Control Register */ | ||
2044 | - u32 mbr_ds; /* Data Stride Register */ | ||
2045 | - u32 mbr_sus; /* Source Microblock Stride Register */ | ||
2046 | - u32 mbr_dus; /* Destination Microblock Stride Register */ | ||
2047 | + u32 mbr_nda; /* Next Descriptor Member */ | ||
2048 | + u32 mbr_ubc; /* Microblock Control Member */ | ||
2049 | + u32 mbr_sa; /* Source Address Member */ | ||
2050 | + u32 mbr_da; /* Destination Address Member */ | ||
2051 | + u32 mbr_cfg; /* Configuration Register */ | ||
2052 | + u32 mbr_bc; /* Block Control Register */ | ||
2053 | + u32 mbr_ds; /* Data Stride Register */ | ||
2054 | + u32 mbr_sus; /* Source Microblock Stride Register */ | ||
2055 | + u32 mbr_dus; /* Destination Microblock Stride Register */ | ||
2056 | }; | ||
2057 | |||
2058 | /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ | ||
2059 | @@ -338,9 +339,6 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, | ||
2060 | |||
2061 | dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); | ||
2062 | |||
2063 | - if (at_xdmac_chan_is_enabled(atchan)) | ||
2064 | - return; | ||
2065 | - | ||
2066 | /* Set transfer as active to not try to start it again. */ | ||
2067 | first->active_xfer = true; | ||
2068 | |||
2069 | @@ -356,7 +354,8 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, | ||
2070 | */ | ||
2071 | if (at_xdmac_chan_is_cyclic(atchan)) | ||
2072 | reg = AT_XDMAC_CNDC_NDVIEW_NDV1; | ||
2073 | - else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) | ||
2074 | + else if ((first->lld.mbr_ubc & | ||
2075 | + AT_XDMAC_CNDC_NDVIEW_MASK) == AT_XDMAC_MBR_UBC_NDV3) | ||
2076 | reg = AT_XDMAC_CNDC_NDVIEW_NDV3; | ||
2077 | else | ||
2078 | reg = AT_XDMAC_CNDC_NDVIEW_NDV2; | ||
2079 | @@ -427,13 +426,12 @@ static dma_cookie_t at_xdmac_tx_submit(struct dma_async_tx_descriptor *tx) | ||
2080 | spin_lock_irqsave(&atchan->lock, irqflags); | ||
2081 | cookie = dma_cookie_assign(tx); | ||
2082 | |||
2083 | + list_add_tail(&desc->xfer_node, &atchan->xfers_list); | ||
2084 | + spin_unlock_irqrestore(&atchan->lock, irqflags); | ||
2085 | + | ||
2086 | dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_list\n", | ||
2087 | __func__, atchan, desc); | ||
2088 | - list_add_tail(&desc->xfer_node, &atchan->xfers_list); | ||
2089 | - if (list_is_singular(&atchan->xfers_list)) | ||
2090 | - at_xdmac_start_xfer(atchan, desc); | ||
2091 | |||
2092 | - spin_unlock_irqrestore(&atchan->lock, irqflags); | ||
2093 | return cookie; | ||
2094 | } | ||
2095 | |||
2096 | @@ -1568,14 +1566,17 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan) | ||
2097 | struct at_xdmac_desc *desc; | ||
2098 | struct dma_async_tx_descriptor *txd; | ||
2099 | |||
2100 | - if (!list_empty(&atchan->xfers_list)) { | ||
2101 | - desc = list_first_entry(&atchan->xfers_list, | ||
2102 | - struct at_xdmac_desc, xfer_node); | ||
2103 | - txd = &desc->tx_dma_desc; | ||
2104 | - | ||
2105 | - if (txd->flags & DMA_PREP_INTERRUPT) | ||
2106 | - dmaengine_desc_get_callback_invoke(txd, NULL); | ||
2107 | + spin_lock_irq(&atchan->lock); | ||
2108 | + if (list_empty(&atchan->xfers_list)) { | ||
2109 | + spin_unlock_irq(&atchan->lock); | ||
2110 | + return; | ||
2111 | } | ||
2112 | + desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, | ||
2113 | + xfer_node); | ||
2114 | + spin_unlock_irq(&atchan->lock); | ||
2115 | + txd = &desc->tx_dma_desc; | ||
2116 | + if (txd->flags & DMA_PREP_INTERRUPT) | ||
2117 | + dmaengine_desc_get_callback_invoke(txd, NULL); | ||
2118 | } | ||
2119 | |||
2120 | static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) | ||
2121 | diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c | ||
2122 | index 7fe494fc50d4e..ec186cf8b8af1 100644 | ||
2123 | --- a/drivers/dma/mmp_pdma.c | ||
2124 | +++ b/drivers/dma/mmp_pdma.c | ||
2125 | @@ -728,12 +728,6 @@ static int mmp_pdma_config_write(struct dma_chan *dchan, | ||
2126 | |||
2127 | chan->dir = direction; | ||
2128 | chan->dev_addr = addr; | ||
2129 | - /* FIXME: drivers should be ported over to use the filter | ||
2130 | - * function. Once that's done, the following two lines can | ||
2131 | - * be removed. | ||
2132 | - */ | ||
2133 | - if (cfg->slave_id) | ||
2134 | - chan->drcmr = cfg->slave_id; | ||
2135 | |||
2136 | return 0; | ||
2137 | } | ||
2138 | diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c | ||
2139 | index 349fb312c8725..b4ef4f19f7dec 100644 | ||
2140 | --- a/drivers/dma/pxa_dma.c | ||
2141 | +++ b/drivers/dma/pxa_dma.c | ||
2142 | @@ -911,13 +911,6 @@ static void pxad_get_config(struct pxad_chan *chan, | ||
2143 | *dcmd |= PXA_DCMD_BURST16; | ||
2144 | else if (maxburst == 32) | ||
2145 | *dcmd |= PXA_DCMD_BURST32; | ||
2146 | - | ||
2147 | - /* FIXME: drivers should be ported over to use the filter | ||
2148 | - * function. Once that's done, the following two lines can | ||
2149 | - * be removed. | ||
2150 | - */ | ||
2151 | - if (chan->cfg.slave_id) | ||
2152 | - chan->drcmr = chan->cfg.slave_id; | ||
2153 | } | ||
2154 | |||
2155 | static struct dma_async_tx_descriptor * | ||
2156 | diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c | ||
2157 | index ee1cbf3be75d5..a05355d1292e8 100644 | ||
2158 | --- a/drivers/dma/stm32-mdma.c | ||
2159 | +++ b/drivers/dma/stm32-mdma.c | ||
2160 | @@ -184,7 +184,7 @@ | ||
2161 | #define STM32_MDMA_CTBR(x) (0x68 + 0x40 * (x)) | ||
2162 | #define STM32_MDMA_CTBR_DBUS BIT(17) | ||
2163 | #define STM32_MDMA_CTBR_SBUS BIT(16) | ||
2164 | -#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) | ||
2165 | +#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0) | ||
2166 | #define STM32_MDMA_CTBR_TSEL(n) STM32_MDMA_SET(n, \ | ||
2167 | STM32_MDMA_CTBR_TSEL_MASK) | ||
2168 | |||
2169 | diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c | ||
2170 | index 6becf3363ad57..d23a0782fb49c 100644 | ||
2171 | --- a/drivers/edac/synopsys_edac.c | ||
2172 | +++ b/drivers/edac/synopsys_edac.c | ||
2173 | @@ -1351,8 +1351,7 @@ static int mc_probe(struct platform_device *pdev) | ||
2174 | } | ||
2175 | } | ||
2176 | |||
2177 | - if (of_device_is_compatible(pdev->dev.of_node, | ||
2178 | - "xlnx,zynqmp-ddrc-2.40a")) | ||
2179 | + if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT) | ||
2180 | setup_address_map(priv); | ||
2181 | #endif | ||
2182 | |||
2183 | diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig | ||
2184 | index a3a6ca659ffa3..2fba0aa7fc54d 100644 | ||
2185 | --- a/drivers/firmware/google/Kconfig | ||
2186 | +++ b/drivers/firmware/google/Kconfig | ||
2187 | @@ -3,9 +3,9 @@ menuconfig GOOGLE_FIRMWARE | ||
2188 | bool "Google Firmware Drivers" | ||
2189 | default n | ||
2190 | help | ||
2191 | - These firmware drivers are used by Google's servers. They are | ||
2192 | - only useful if you are working directly on one of their | ||
2193 | - proprietary servers. If in doubt, say "N". | ||
2194 | + These firmware drivers are used by Google servers, | ||
2195 | + Chromebooks and other devices using coreboot firmware. | ||
2196 | + If in doubt, say "N". | ||
2197 | |||
2198 | if GOOGLE_FIRMWARE | ||
2199 | |||
2200 | diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c | ||
2201 | index 2820c59b5f071..22e0d6fcab1c4 100644 | ||
2202 | --- a/drivers/gpio/gpio-aspeed.c | ||
2203 | +++ b/drivers/gpio/gpio-aspeed.c | ||
2204 | @@ -53,7 +53,7 @@ struct aspeed_gpio_config { | ||
2205 | struct aspeed_gpio { | ||
2206 | struct gpio_chip chip; | ||
2207 | struct irq_chip irqc; | ||
2208 | - spinlock_t lock; | ||
2209 | + raw_spinlock_t lock; | ||
2210 | void __iomem *base; | ||
2211 | int irq; | ||
2212 | const struct aspeed_gpio_config *config; | ||
2213 | @@ -413,14 +413,14 @@ static void aspeed_gpio_set(struct gpio_chip *gc, unsigned int offset, | ||
2214 | unsigned long flags; | ||
2215 | bool copro; | ||
2216 | |||
2217 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2218 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2219 | copro = aspeed_gpio_copro_request(gpio, offset); | ||
2220 | |||
2221 | __aspeed_gpio_set(gc, offset, val); | ||
2222 | |||
2223 | if (copro) | ||
2224 | aspeed_gpio_copro_release(gpio, offset); | ||
2225 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2226 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2227 | } | ||
2228 | |||
2229 | static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) | ||
2230 | @@ -435,7 +435,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) | ||
2231 | if (!have_input(gpio, offset)) | ||
2232 | return -ENOTSUPP; | ||
2233 | |||
2234 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2235 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2236 | |||
2237 | reg = ioread32(addr); | ||
2238 | reg &= ~GPIO_BIT(offset); | ||
2239 | @@ -445,7 +445,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) | ||
2240 | if (copro) | ||
2241 | aspeed_gpio_copro_release(gpio, offset); | ||
2242 | |||
2243 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2244 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2245 | |||
2246 | return 0; | ||
2247 | } | ||
2248 | @@ -463,7 +463,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, | ||
2249 | if (!have_output(gpio, offset)) | ||
2250 | return -ENOTSUPP; | ||
2251 | |||
2252 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2253 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2254 | |||
2255 | reg = ioread32(addr); | ||
2256 | reg |= GPIO_BIT(offset); | ||
2257 | @@ -474,7 +474,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc, | ||
2258 | |||
2259 | if (copro) | ||
2260 | aspeed_gpio_copro_release(gpio, offset); | ||
2261 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2262 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2263 | |||
2264 | return 0; | ||
2265 | } | ||
2266 | @@ -492,11 +492,11 @@ static int aspeed_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) | ||
2267 | if (!have_output(gpio, offset)) | ||
2268 | return 1; | ||
2269 | |||
2270 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2271 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2272 | |||
2273 | val = ioread32(bank_reg(gpio, bank, reg_dir)) & GPIO_BIT(offset); | ||
2274 | |||
2275 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2276 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2277 | |||
2278 | return !val; | ||
2279 | |||
2280 | @@ -540,14 +540,14 @@ static void aspeed_gpio_irq_ack(struct irq_data *d) | ||
2281 | |||
2282 | status_addr = bank_reg(gpio, bank, reg_irq_status); | ||
2283 | |||
2284 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2285 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2286 | copro = aspeed_gpio_copro_request(gpio, offset); | ||
2287 | |||
2288 | iowrite32(bit, status_addr); | ||
2289 | |||
2290 | if (copro) | ||
2291 | aspeed_gpio_copro_release(gpio, offset); | ||
2292 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2293 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2294 | } | ||
2295 | |||
2296 | static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) | ||
2297 | @@ -566,7 +566,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) | ||
2298 | |||
2299 | addr = bank_reg(gpio, bank, reg_irq_enable); | ||
2300 | |||
2301 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2302 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2303 | copro = aspeed_gpio_copro_request(gpio, offset); | ||
2304 | |||
2305 | reg = ioread32(addr); | ||
2306 | @@ -578,7 +578,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) | ||
2307 | |||
2308 | if (copro) | ||
2309 | aspeed_gpio_copro_release(gpio, offset); | ||
2310 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2311 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2312 | } | ||
2313 | |||
2314 | static void aspeed_gpio_irq_mask(struct irq_data *d) | ||
2315 | @@ -630,7 +630,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type) | ||
2316 | return -EINVAL; | ||
2317 | } | ||
2318 | |||
2319 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2320 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2321 | copro = aspeed_gpio_copro_request(gpio, offset); | ||
2322 | |||
2323 | addr = bank_reg(gpio, bank, reg_irq_type0); | ||
2324 | @@ -650,7 +650,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type) | ||
2325 | |||
2326 | if (copro) | ||
2327 | aspeed_gpio_copro_release(gpio, offset); | ||
2328 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2329 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2330 | |||
2331 | irq_set_handler_locked(d, handler); | ||
2332 | |||
2333 | @@ -720,7 +720,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip, | ||
2334 | |||
2335 | treg = bank_reg(gpio, to_bank(offset), reg_tolerance); | ||
2336 | |||
2337 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2338 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2339 | copro = aspeed_gpio_copro_request(gpio, offset); | ||
2340 | |||
2341 | val = readl(treg); | ||
2342 | @@ -734,7 +734,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip, | ||
2343 | |||
2344 | if (copro) | ||
2345 | aspeed_gpio_copro_release(gpio, offset); | ||
2346 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2347 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2348 | |||
2349 | return 0; | ||
2350 | } | ||
2351 | @@ -860,7 +860,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, | ||
2352 | return rc; | ||
2353 | } | ||
2354 | |||
2355 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2356 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2357 | |||
2358 | if (timer_allocation_registered(gpio, offset)) { | ||
2359 | rc = unregister_allocated_timer(gpio, offset); | ||
2360 | @@ -920,7 +920,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, | ||
2361 | configure_timer(gpio, offset, i); | ||
2362 | |||
2363 | out: | ||
2364 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2365 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2366 | |||
2367 | return rc; | ||
2368 | } | ||
2369 | @@ -931,13 +931,13 @@ static int disable_debounce(struct gpio_chip *chip, unsigned int offset) | ||
2370 | unsigned long flags; | ||
2371 | int rc; | ||
2372 | |||
2373 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2374 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2375 | |||
2376 | rc = unregister_allocated_timer(gpio, offset); | ||
2377 | if (!rc) | ||
2378 | configure_timer(gpio, offset, 0); | ||
2379 | |||
2380 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2381 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2382 | |||
2383 | return rc; | ||
2384 | } | ||
2385 | @@ -1019,7 +1019,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc, | ||
2386 | return -EINVAL; | ||
2387 | bindex = offset >> 3; | ||
2388 | |||
2389 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2390 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2391 | |||
2392 | /* Sanity check, this shouldn't happen */ | ||
2393 | if (gpio->cf_copro_bankmap[bindex] == 0xff) { | ||
2394 | @@ -1040,7 +1040,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc, | ||
2395 | if (bit) | ||
2396 | *bit = GPIO_OFFSET(offset); | ||
2397 | bail: | ||
2398 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2399 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2400 | return rc; | ||
2401 | } | ||
2402 | EXPORT_SYMBOL_GPL(aspeed_gpio_copro_grab_gpio); | ||
2403 | @@ -1064,7 +1064,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc) | ||
2404 | return -EINVAL; | ||
2405 | bindex = offset >> 3; | ||
2406 | |||
2407 | - spin_lock_irqsave(&gpio->lock, flags); | ||
2408 | + raw_spin_lock_irqsave(&gpio->lock, flags); | ||
2409 | |||
2410 | /* Sanity check, this shouldn't happen */ | ||
2411 | if (gpio->cf_copro_bankmap[bindex] == 0) { | ||
2412 | @@ -1078,7 +1078,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc) | ||
2413 | aspeed_gpio_change_cmd_source(gpio, bank, bindex, | ||
2414 | GPIO_CMDSRC_ARM); | ||
2415 | bail: | ||
2416 | - spin_unlock_irqrestore(&gpio->lock, flags); | ||
2417 | + raw_spin_unlock_irqrestore(&gpio->lock, flags); | ||
2418 | return rc; | ||
2419 | } | ||
2420 | EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); | ||
2421 | @@ -1151,7 +1151,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) | ||
2422 | if (IS_ERR(gpio->base)) | ||
2423 | return PTR_ERR(gpio->base); | ||
2424 | |||
2425 | - spin_lock_init(&gpio->lock); | ||
2426 | + raw_spin_lock_init(&gpio->lock); | ||
2427 | |||
2428 | gpio_id = of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); | ||
2429 | if (!gpio_id) | ||
2430 | diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c | ||
2431 | index e3ddc99c105d4..13c6eee481da7 100644 | ||
2432 | --- a/drivers/gpio/gpiolib-acpi.c | ||
2433 | +++ b/drivers/gpio/gpiolib-acpi.c | ||
2434 | @@ -953,10 +953,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) | ||
2435 | irq_flags = acpi_dev_get_irq_type(info.triggering, | ||
2436 | info.polarity); | ||
2437 | |||
2438 | - /* Set type if specified and different than the current one */ | ||
2439 | - if (irq_flags != IRQ_TYPE_NONE && | ||
2440 | - irq_flags != irq_get_trigger_type(irq)) | ||
2441 | - irq_set_irq_type(irq, irq_flags); | ||
2442 | + /* | ||
2443 | + * If the IRQ is not already in use then set type | ||
2444 | + * if specified and different than the current one. | ||
2445 | + */ | ||
2446 | + if (can_request_irq(irq, irq_flags)) { | ||
2447 | + if (irq_flags != IRQ_TYPE_NONE && | ||
2448 | + irq_flags != irq_get_trigger_type(irq)) | ||
2449 | + irq_set_irq_type(irq, irq_flags); | ||
2450 | + } else { | ||
2451 | + dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); | ||
2452 | + } | ||
2453 | |||
2454 | return irq; | ||
2455 | } | ||
2456 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | ||
2457 | index 0d39e386f6e9c..0e1cacf731698 100644 | ||
2458 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | ||
2459 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | ||
2460 | @@ -389,6 +389,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) | ||
2461 | native_mode->vdisplay != 0 && | ||
2462 | native_mode->clock != 0) { | ||
2463 | mode = drm_mode_duplicate(dev, native_mode); | ||
2464 | + if (!mode) | ||
2465 | + return NULL; | ||
2466 | + | ||
2467 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; | ||
2468 | drm_mode_set_name(mode); | ||
2469 | |||
2470 | @@ -403,6 +406,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) | ||
2471 | * simpler. | ||
2472 | */ | ||
2473 | mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); | ||
2474 | + if (!mode) | ||
2475 | + return NULL; | ||
2476 | + | ||
2477 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; | ||
2478 | DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); | ||
2479 | } | ||
2480 | diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | ||
2481 | index ea764dd9245db..2975331a7b867 100644 | ||
2482 | --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | ||
2483 | +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | ||
2484 | @@ -524,10 +524,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev) | ||
2485 | static int gmc_v8_0_mc_init(struct amdgpu_device *adev) | ||
2486 | { | ||
2487 | int r; | ||
2488 | + u32 tmp; | ||
2489 | |||
2490 | adev->gmc.vram_width = amdgpu_atombios_get_vram_width(adev); | ||
2491 | if (!adev->gmc.vram_width) { | ||
2492 | - u32 tmp; | ||
2493 | int chansize, numchan; | ||
2494 | |||
2495 | /* Get VRAM informations */ | ||
2496 | @@ -571,8 +571,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) | ||
2497 | adev->gmc.vram_width = numchan * chansize; | ||
2498 | } | ||
2499 | /* size in MB on si */ | ||
2500 | - adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; | ||
2501 | - adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; | ||
2502 | + tmp = RREG32(mmCONFIG_MEMSIZE); | ||
2503 | + /* some boards may have garbage in the upper 16 bits */ | ||
2504 | + if (tmp & 0xffff0000) { | ||
2505 | + DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); | ||
2506 | + if (tmp & 0xffff) | ||
2507 | + tmp &= 0xffff; | ||
2508 | + } | ||
2509 | + adev->gmc.mc_vram_size = tmp * 1024ULL * 1024ULL; | ||
2510 | + adev->gmc.real_vram_size = adev->gmc.mc_vram_size; | ||
2511 | |||
2512 | if (!(adev->flags & AMD_IS_APU)) { | ||
2513 | r = amdgpu_device_resize_fb_bar(adev); | ||
2514 | diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | ||
2515 | index 914c569ab8c15..cab3f5c4e2fc8 100644 | ||
2516 | --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | ||
2517 | +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | ||
2518 | @@ -1086,11 +1086,21 @@ int analogix_dp_send_psr_spd(struct analogix_dp_device *dp, | ||
2519 | if (!blocking) | ||
2520 | return 0; | ||
2521 | |||
2522 | + /* | ||
2523 | + * db[1]!=0: entering PSR, wait for fully active remote frame buffer. | ||
2524 | + * db[1]==0: exiting PSR, wait for either | ||
2525 | + * (a) ACTIVE_RESYNC - the sink "must display the | ||
2526 | + * incoming active frames from the Source device with no visible | ||
2527 | + * glitches and/or artifacts", even though timings may still be | ||
2528 | + * re-synchronizing; or | ||
2529 | + * (b) INACTIVE - the transition is fully complete. | ||
2530 | + */ | ||
2531 | ret = readx_poll_timeout(analogix_dp_get_psr_status, dp, psr_status, | ||
2532 | psr_status >= 0 && | ||
2533 | ((vsc->db[1] && psr_status == DP_PSR_SINK_ACTIVE_RFB) || | ||
2534 | - (!vsc->db[1] && psr_status == DP_PSR_SINK_INACTIVE)), 1500, | ||
2535 | - DP_TIMEOUT_PSR_LOOP_MS * 1000); | ||
2536 | + (!vsc->db[1] && (psr_status == DP_PSR_SINK_ACTIVE_RESYNC || | ||
2537 | + psr_status == DP_PSR_SINK_INACTIVE))), | ||
2538 | + 1500, DP_TIMEOUT_PSR_LOOP_MS * 1000); | ||
2539 | if (ret) { | ||
2540 | dev_warn(dp->dev, "Failed to apply PSR %d\n", ret); | ||
2541 | return ret; | ||
2542 | diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | ||
2543 | index b050fd1f3d201..5302dd90a7a5f 100644 | ||
2544 | --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | ||
2545 | +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | ||
2546 | @@ -291,19 +291,10 @@ out: | ||
2547 | mutex_unlock(&ge_b850v3_lvds_dev_mutex); | ||
2548 | } | ||
2549 | |||
2550 | -static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, | ||
2551 | - const struct i2c_device_id *id) | ||
2552 | +static int ge_b850v3_register(void) | ||
2553 | { | ||
2554 | + struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c; | ||
2555 | struct device *dev = &stdp4028_i2c->dev; | ||
2556 | - int ret; | ||
2557 | - | ||
2558 | - ret = ge_b850v3_lvds_init(dev); | ||
2559 | - | ||
2560 | - if (ret) | ||
2561 | - return ret; | ||
2562 | - | ||
2563 | - ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; | ||
2564 | - i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); | ||
2565 | |||
2566 | /* drm bridge initialization */ | ||
2567 | ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; | ||
2568 | @@ -325,6 +316,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, | ||
2569 | "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); | ||
2570 | } | ||
2571 | |||
2572 | +static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, | ||
2573 | + const struct i2c_device_id *id) | ||
2574 | +{ | ||
2575 | + struct device *dev = &stdp4028_i2c->dev; | ||
2576 | + int ret; | ||
2577 | + | ||
2578 | + ret = ge_b850v3_lvds_init(dev); | ||
2579 | + | ||
2580 | + if (ret) | ||
2581 | + return ret; | ||
2582 | + | ||
2583 | + ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; | ||
2584 | + i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); | ||
2585 | + | ||
2586 | + /* Only register after both bridges are probed */ | ||
2587 | + if (!ge_b850v3_lvds_ptr->stdp2690_i2c) | ||
2588 | + return 0; | ||
2589 | + | ||
2590 | + return ge_b850v3_register(); | ||
2591 | +} | ||
2592 | + | ||
2593 | static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) | ||
2594 | { | ||
2595 | ge_b850v3_lvds_remove(); | ||
2596 | @@ -368,7 +380,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, | ||
2597 | ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; | ||
2598 | i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); | ||
2599 | |||
2600 | - return 0; | ||
2601 | + /* Only register after both bridges are probed */ | ||
2602 | + if (!ge_b850v3_lvds_ptr->stdp4028_i2c) | ||
2603 | + return 0; | ||
2604 | + | ||
2605 | + return ge_b850v3_register(); | ||
2606 | } | ||
2607 | |||
2608 | static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) | ||
2609 | diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c | ||
2610 | index f1de4bb6558ca..dbb4a374cb646 100644 | ||
2611 | --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c | ||
2612 | +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c | ||
2613 | @@ -115,6 +115,7 @@ static const struct regmap_config ti_sn_bridge_regmap_config = { | ||
2614 | .val_bits = 8, | ||
2615 | .volatile_table = &ti_sn_bridge_volatile_table, | ||
2616 | .cache_type = REGCACHE_NONE, | ||
2617 | + .max_register = 0xFF, | ||
2618 | }; | ||
2619 | |||
2620 | static void ti_sn_bridge_write_u16(struct ti_sn_bridge *pdata, | ||
2621 | diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c | ||
2622 | index a950d5db211c5..9d1bd8f491ad7 100644 | ||
2623 | --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c | ||
2624 | +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c | ||
2625 | @@ -248,6 +248,12 @@ static const struct dmi_system_id orientation_data[] = { | ||
2626 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), | ||
2627 | }, | ||
2628 | .driver_data = (void *)&lcd1200x1920_rightside_up, | ||
2629 | + }, { /* Lenovo Yoga Book X90F / X91F / X91L */ | ||
2630 | + .matches = { | ||
2631 | + /* Non exact match to match all versions */ | ||
2632 | + DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), | ||
2633 | + }, | ||
2634 | + .driver_data = (void *)&lcd1200x1920_rightside_up, | ||
2635 | }, { /* OneGX1 Pro */ | ||
2636 | .matches = { | ||
2637 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), | ||
2638 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | ||
2639 | index 7085b08b1db42..7d155938e2916 100644 | ||
2640 | --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | ||
2641 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | ||
2642 | @@ -471,6 +471,12 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, | ||
2643 | return -EINVAL; | ||
2644 | } | ||
2645 | |||
2646 | + if (args->stream_size > SZ_64K || args->nr_relocs > SZ_64K || | ||
2647 | + args->nr_bos > SZ_64K || args->nr_pmrs > 128) { | ||
2648 | + DRM_ERROR("submit arguments out of size limits\n"); | ||
2649 | + return -EINVAL; | ||
2650 | + } | ||
2651 | + | ||
2652 | /* | ||
2653 | * Copy the command submission and bo array to kernel space in | ||
2654 | * one go, and do this outside of any locks. | ||
2655 | diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c | ||
2656 | index d86b8d81a483a..155971c57b2d5 100644 | ||
2657 | --- a/drivers/gpu/drm/lima/lima_device.c | ||
2658 | +++ b/drivers/gpu/drm/lima/lima_device.c | ||
2659 | @@ -293,6 +293,7 @@ int lima_device_init(struct lima_device *ldev) | ||
2660 | struct resource *res; | ||
2661 | |||
2662 | dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32)); | ||
2663 | + dma_set_max_seg_size(ldev->dev, UINT_MAX); | ||
2664 | |||
2665 | err = lima_clk_init(ldev); | ||
2666 | if (err) | ||
2667 | diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | ||
2668 | index 58b0485dc3750..72f487692adbb 100644 | ||
2669 | --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | ||
2670 | +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | ||
2671 | @@ -88,8 +88,8 @@ static int _dpu_danger_signal_status(struct seq_file *s, | ||
2672 | &status); | ||
2673 | } else { | ||
2674 | seq_puts(s, "\nSafe signal status:\n"); | ||
2675 | - if (kms->hw_mdp->ops.get_danger_status) | ||
2676 | - kms->hw_mdp->ops.get_danger_status(kms->hw_mdp, | ||
2677 | + if (kms->hw_mdp->ops.get_safe_status) | ||
2678 | + kms->hw_mdp->ops.get_safe_status(kms->hw_mdp, | ||
2679 | &status); | ||
2680 | } | ||
2681 | pm_runtime_put_sync(&kms->pdev->dev); | ||
2682 | diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c | ||
2683 | index dc64863b5fd88..f517b39aba56b 100644 | ||
2684 | --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c | ||
2685 | +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c | ||
2686 | @@ -179,7 +179,7 @@ nv04_display_destroy(struct drm_device *dev) | ||
2687 | nvif_notify_fini(&disp->flip); | ||
2688 | |||
2689 | nouveau_display(dev)->priv = NULL; | ||
2690 | - kfree(disp); | ||
2691 | + vfree(disp); | ||
2692 | |||
2693 | nvif_object_unmap(&drm->client.device.object); | ||
2694 | } | ||
2695 | @@ -197,7 +197,7 @@ nv04_display_create(struct drm_device *dev) | ||
2696 | struct nv04_display *disp; | ||
2697 | int i, ret; | ||
2698 | |||
2699 | - disp = kzalloc(sizeof(*disp), GFP_KERNEL); | ||
2700 | + disp = vzalloc(sizeof(*disp)); | ||
2701 | if (!disp) | ||
2702 | return -ENOMEM; | ||
2703 | |||
2704 | diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | ||
2705 | index ea2e11771bca5..105b4be467a3e 100644 | ||
2706 | --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | ||
2707 | +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | ||
2708 | @@ -88,20 +88,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) | ||
2709 | return 0; | ||
2710 | } | ||
2711 | |||
2712 | -static int | ||
2713 | +static void | ||
2714 | nvkm_pmu_reset(struct nvkm_pmu *pmu) | ||
2715 | { | ||
2716 | struct nvkm_device *device = pmu->subdev.device; | ||
2717 | |||
2718 | if (!pmu->func->enabled(pmu)) | ||
2719 | - return 0; | ||
2720 | - | ||
2721 | - /* Inhibit interrupts, and wait for idle. */ | ||
2722 | - nvkm_wr32(device, 0x10a014, 0x0000ffff); | ||
2723 | - nvkm_msec(device, 2000, | ||
2724 | - if (!nvkm_rd32(device, 0x10a04c)) | ||
2725 | - break; | ||
2726 | - ); | ||
2727 | + return; | ||
2728 | |||
2729 | /* Reset. */ | ||
2730 | if (pmu->func->reset) | ||
2731 | @@ -112,25 +105,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) | ||
2732 | if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) | ||
2733 | break; | ||
2734 | ); | ||
2735 | - | ||
2736 | - return 0; | ||
2737 | } | ||
2738 | |||
2739 | static int | ||
2740 | nvkm_pmu_preinit(struct nvkm_subdev *subdev) | ||
2741 | { | ||
2742 | struct nvkm_pmu *pmu = nvkm_pmu(subdev); | ||
2743 | - return nvkm_pmu_reset(pmu); | ||
2744 | + nvkm_pmu_reset(pmu); | ||
2745 | + return 0; | ||
2746 | } | ||
2747 | |||
2748 | static int | ||
2749 | nvkm_pmu_init(struct nvkm_subdev *subdev) | ||
2750 | { | ||
2751 | struct nvkm_pmu *pmu = nvkm_pmu(subdev); | ||
2752 | - int ret = nvkm_pmu_reset(pmu); | ||
2753 | - if (ret == 0 && pmu->func->init) | ||
2754 | - ret = pmu->func->init(pmu); | ||
2755 | - return ret; | ||
2756 | + struct nvkm_device *device = pmu->subdev.device; | ||
2757 | + | ||
2758 | + if (!pmu->func->init) | ||
2759 | + return 0; | ||
2760 | + | ||
2761 | + if (pmu->func->enabled(pmu)) { | ||
2762 | + /* Inhibit interrupts, and wait for idle. */ | ||
2763 | + nvkm_wr32(device, 0x10a014, 0x0000ffff); | ||
2764 | + nvkm_msec(device, 2000, | ||
2765 | + if (!nvkm_rd32(device, 0x10a04c)) | ||
2766 | + break; | ||
2767 | + ); | ||
2768 | + | ||
2769 | + nvkm_pmu_reset(pmu); | ||
2770 | + } | ||
2771 | + | ||
2772 | + return pmu->func->init(pmu); | ||
2773 | } | ||
2774 | |||
2775 | static int | ||
2776 | diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c | ||
2777 | index d92d1c98878c1..df90b66079816 100644 | ||
2778 | --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c | ||
2779 | +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c | ||
2780 | @@ -509,6 +509,7 @@ static void innolux_panel_del(struct innolux_panel *innolux) | ||
2781 | static int innolux_panel_probe(struct mipi_dsi_device *dsi) | ||
2782 | { | ||
2783 | const struct panel_desc *desc; | ||
2784 | + struct innolux_panel *innolux; | ||
2785 | int err; | ||
2786 | |||
2787 | desc = of_device_get_match_data(&dsi->dev); | ||
2788 | @@ -520,7 +521,14 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi) | ||
2789 | if (err < 0) | ||
2790 | return err; | ||
2791 | |||
2792 | - return mipi_dsi_attach(dsi); | ||
2793 | + err = mipi_dsi_attach(dsi); | ||
2794 | + if (err < 0) { | ||
2795 | + innolux = mipi_dsi_get_drvdata(dsi); | ||
2796 | + innolux_panel_del(innolux); | ||
2797 | + return err; | ||
2798 | + } | ||
2799 | + | ||
2800 | + return 0; | ||
2801 | } | ||
2802 | |||
2803 | static int innolux_panel_remove(struct mipi_dsi_device *dsi) | ||
2804 | diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | ||
2805 | index 3ac04eb8d0fe5..1e7fecab72a9f 100644 | ||
2806 | --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | ||
2807 | +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | ||
2808 | @@ -424,7 +424,13 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi) | ||
2809 | if (err < 0) | ||
2810 | return err; | ||
2811 | |||
2812 | - return mipi_dsi_attach(dsi); | ||
2813 | + err = mipi_dsi_attach(dsi); | ||
2814 | + if (err < 0) { | ||
2815 | + kingdisplay_panel_del(kingdisplay); | ||
2816 | + return err; | ||
2817 | + } | ||
2818 | + | ||
2819 | + return 0; | ||
2820 | } | ||
2821 | |||
2822 | static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi) | ||
2823 | diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c | ||
2824 | index 03d3550ecc7cb..51db8b4f6d551 100644 | ||
2825 | --- a/drivers/gpu/drm/radeon/radeon_kms.c | ||
2826 | +++ b/drivers/gpu/drm/radeon/radeon_kms.c | ||
2827 | @@ -634,6 +634,8 @@ void radeon_driver_lastclose_kms(struct drm_device *dev) | ||
2828 | int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | ||
2829 | { | ||
2830 | struct radeon_device *rdev = dev->dev_private; | ||
2831 | + struct radeon_fpriv *fpriv; | ||
2832 | + struct radeon_vm *vm; | ||
2833 | int r; | ||
2834 | |||
2835 | file_priv->driver_priv = NULL; | ||
2836 | @@ -646,48 +648,52 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | ||
2837 | |||
2838 | /* new gpu have virtual address space support */ | ||
2839 | if (rdev->family >= CHIP_CAYMAN) { | ||
2840 | - struct radeon_fpriv *fpriv; | ||
2841 | - struct radeon_vm *vm; | ||
2842 | |||
2843 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); | ||
2844 | if (unlikely(!fpriv)) { | ||
2845 | r = -ENOMEM; | ||
2846 | - goto out_suspend; | ||
2847 | + goto err_suspend; | ||
2848 | } | ||
2849 | |||
2850 | if (rdev->accel_working) { | ||
2851 | vm = &fpriv->vm; | ||
2852 | r = radeon_vm_init(rdev, vm); | ||
2853 | - if (r) { | ||
2854 | - kfree(fpriv); | ||
2855 | - goto out_suspend; | ||
2856 | - } | ||
2857 | + if (r) | ||
2858 | + goto err_fpriv; | ||
2859 | |||
2860 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | ||
2861 | - if (r) { | ||
2862 | - radeon_vm_fini(rdev, vm); | ||
2863 | - kfree(fpriv); | ||
2864 | - goto out_suspend; | ||
2865 | - } | ||
2866 | + if (r) | ||
2867 | + goto err_vm_fini; | ||
2868 | |||
2869 | /* map the ib pool buffer read only into | ||
2870 | * virtual address space */ | ||
2871 | vm->ib_bo_va = radeon_vm_bo_add(rdev, vm, | ||
2872 | rdev->ring_tmp_bo.bo); | ||
2873 | + if (!vm->ib_bo_va) { | ||
2874 | + r = -ENOMEM; | ||
2875 | + goto err_vm_fini; | ||
2876 | + } | ||
2877 | + | ||
2878 | r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, | ||
2879 | RADEON_VA_IB_OFFSET, | ||
2880 | RADEON_VM_PAGE_READABLE | | ||
2881 | RADEON_VM_PAGE_SNOOPED); | ||
2882 | - if (r) { | ||
2883 | - radeon_vm_fini(rdev, vm); | ||
2884 | - kfree(fpriv); | ||
2885 | - goto out_suspend; | ||
2886 | - } | ||
2887 | + if (r) | ||
2888 | + goto err_vm_fini; | ||
2889 | } | ||
2890 | file_priv->driver_priv = fpriv; | ||
2891 | } | ||
2892 | |||
2893 | -out_suspend: | ||
2894 | + pm_runtime_mark_last_busy(dev->dev); | ||
2895 | + pm_runtime_put_autosuspend(dev->dev); | ||
2896 | + return 0; | ||
2897 | + | ||
2898 | +err_vm_fini: | ||
2899 | + radeon_vm_fini(rdev, vm); | ||
2900 | +err_fpriv: | ||
2901 | + kfree(fpriv); | ||
2902 | + | ||
2903 | +err_suspend: | ||
2904 | pm_runtime_mark_last_busy(dev->dev); | ||
2905 | pm_runtime_put_autosuspend(dev->dev); | ||
2906 | return r; | ||
2907 | diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | ||
2908 | index 8dc91c2d916a8..f7191ae2266fd 100644 | ||
2909 | --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | ||
2910 | +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | ||
2911 | @@ -231,6 +231,8 @@ struct dw_mipi_dsi_rockchip { | ||
2912 | struct dw_mipi_dsi *dmd; | ||
2913 | const struct rockchip_dw_dsi_chip_data *cdata; | ||
2914 | struct dw_mipi_dsi_plat_data pdata; | ||
2915 | + | ||
2916 | + bool dsi_bound; | ||
2917 | }; | ||
2918 | |||
2919 | struct dphy_pll_parameter_map { | ||
2920 | @@ -625,10 +627,6 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) | ||
2921 | if (mux < 0) | ||
2922 | return; | ||
2923 | |||
2924 | - pm_runtime_get_sync(dsi->dev); | ||
2925 | - if (dsi->slave) | ||
2926 | - pm_runtime_get_sync(dsi->slave->dev); | ||
2927 | - | ||
2928 | /* | ||
2929 | * For the RK3399, the clk of grf must be enabled before writing grf | ||
2930 | * register. And for RK3288 or other soc, this grf_clk must be NULL, | ||
2931 | @@ -647,20 +645,10 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) | ||
2932 | clk_disable_unprepare(dsi->grf_clk); | ||
2933 | } | ||
2934 | |||
2935 | -static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) | ||
2936 | -{ | ||
2937 | - struct dw_mipi_dsi_rockchip *dsi = to_dsi(encoder); | ||
2938 | - | ||
2939 | - if (dsi->slave) | ||
2940 | - pm_runtime_put(dsi->slave->dev); | ||
2941 | - pm_runtime_put(dsi->dev); | ||
2942 | -} | ||
2943 | - | ||
2944 | static const struct drm_encoder_helper_funcs | ||
2945 | dw_mipi_dsi_encoder_helper_funcs = { | ||
2946 | .atomic_check = dw_mipi_dsi_encoder_atomic_check, | ||
2947 | .enable = dw_mipi_dsi_encoder_enable, | ||
2948 | - .disable = dw_mipi_dsi_encoder_disable, | ||
2949 | }; | ||
2950 | |||
2951 | static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = { | ||
2952 | @@ -795,10 +783,14 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, | ||
2953 | put_device(second); | ||
2954 | } | ||
2955 | |||
2956 | + pm_runtime_get_sync(dsi->dev); | ||
2957 | + if (dsi->slave) | ||
2958 | + pm_runtime_get_sync(dsi->slave->dev); | ||
2959 | + | ||
2960 | ret = clk_prepare_enable(dsi->pllref_clk); | ||
2961 | if (ret) { | ||
2962 | DRM_DEV_ERROR(dev, "Failed to enable pllref_clk: %d\n", ret); | ||
2963 | - return ret; | ||
2964 | + goto out_pm_runtime; | ||
2965 | } | ||
2966 | |||
2967 | /* | ||
2968 | @@ -810,7 +802,7 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, | ||
2969 | ret = clk_prepare_enable(dsi->grf_clk); | ||
2970 | if (ret) { | ||
2971 | DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); | ||
2972 | - return ret; | ||
2973 | + goto out_pm_runtime; | ||
2974 | } | ||
2975 | |||
2976 | dw_mipi_dsi_rockchip_config(dsi); | ||
2977 | @@ -822,16 +814,25 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, | ||
2978 | ret = rockchip_dsi_drm_create_encoder(dsi, drm_dev); | ||
2979 | if (ret) { | ||
2980 | DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); | ||
2981 | - return ret; | ||
2982 | + goto out_pm_runtime; | ||
2983 | } | ||
2984 | |||
2985 | ret = dw_mipi_dsi_bind(dsi->dmd, &dsi->encoder); | ||
2986 | if (ret) { | ||
2987 | DRM_DEV_ERROR(dev, "Failed to bind: %d\n", ret); | ||
2988 | - return ret; | ||
2989 | + goto out_pm_runtime; | ||
2990 | } | ||
2991 | |||
2992 | + dsi->dsi_bound = true; | ||
2993 | + | ||
2994 | return 0; | ||
2995 | + | ||
2996 | +out_pm_runtime: | ||
2997 | + pm_runtime_put(dsi->dev); | ||
2998 | + if (dsi->slave) | ||
2999 | + pm_runtime_put(dsi->slave->dev); | ||
3000 | + | ||
3001 | + return ret; | ||
3002 | } | ||
3003 | |||
3004 | static void dw_mipi_dsi_rockchip_unbind(struct device *dev, | ||
3005 | @@ -843,9 +844,15 @@ static void dw_mipi_dsi_rockchip_unbind(struct device *dev, | ||
3006 | if (dsi->is_slave) | ||
3007 | return; | ||
3008 | |||
3009 | + dsi->dsi_bound = false; | ||
3010 | + | ||
3011 | dw_mipi_dsi_unbind(dsi->dmd); | ||
3012 | |||
3013 | clk_disable_unprepare(dsi->pllref_clk); | ||
3014 | + | ||
3015 | + pm_runtime_put(dsi->dev); | ||
3016 | + if (dsi->slave) | ||
3017 | + pm_runtime_put(dsi->slave->dev); | ||
3018 | } | ||
3019 | |||
3020 | static const struct component_ops dw_mipi_dsi_rockchip_ops = { | ||
3021 | @@ -903,6 +910,36 @@ static const struct dw_mipi_dsi_host_ops dw_mipi_dsi_rockchip_host_ops = { | ||
3022 | .detach = dw_mipi_dsi_rockchip_host_detach, | ||
3023 | }; | ||
3024 | |||
3025 | +static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev) | ||
3026 | +{ | ||
3027 | + struct dw_mipi_dsi_rockchip *dsi = dev_get_drvdata(dev); | ||
3028 | + int ret; | ||
3029 | + | ||
3030 | + /* | ||
3031 | + * Re-configure DSI state, if we were previously initialized. We need | ||
3032 | + * to do this before rockchip_drm_drv tries to re-enable() any panels. | ||
3033 | + */ | ||
3034 | + if (dsi->dsi_bound) { | ||
3035 | + ret = clk_prepare_enable(dsi->grf_clk); | ||
3036 | + if (ret) { | ||
3037 | + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); | ||
3038 | + return ret; | ||
3039 | + } | ||
3040 | + | ||
3041 | + dw_mipi_dsi_rockchip_config(dsi); | ||
3042 | + if (dsi->slave) | ||
3043 | + dw_mipi_dsi_rockchip_config(dsi->slave); | ||
3044 | + | ||
3045 | + clk_disable_unprepare(dsi->grf_clk); | ||
3046 | + } | ||
3047 | + | ||
3048 | + return 0; | ||
3049 | +} | ||
3050 | + | ||
3051 | +static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops = { | ||
3052 | + SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) | ||
3053 | +}; | ||
3054 | + | ||
3055 | static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) | ||
3056 | { | ||
3057 | struct device *dev = &pdev->dev; | ||
3058 | @@ -986,14 +1023,10 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) | ||
3059 | if (ret != -EPROBE_DEFER) | ||
3060 | DRM_DEV_ERROR(dev, | ||
3061 | "Failed to probe dw_mipi_dsi: %d\n", ret); | ||
3062 | - goto err_clkdisable; | ||
3063 | + return ret; | ||
3064 | } | ||
3065 | |||
3066 | return 0; | ||
3067 | - | ||
3068 | -err_clkdisable: | ||
3069 | - clk_disable_unprepare(dsi->pllref_clk); | ||
3070 | - return ret; | ||
3071 | } | ||
3072 | |||
3073 | static int dw_mipi_dsi_rockchip_remove(struct platform_device *pdev) | ||
3074 | @@ -1088,6 +1121,7 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = { | ||
3075 | .remove = dw_mipi_dsi_rockchip_remove, | ||
3076 | .driver = { | ||
3077 | .of_match_table = dw_mipi_dsi_rockchip_dt_ids, | ||
3078 | + .pm = &dw_mipi_dsi_rockchip_pm_ops, | ||
3079 | .name = "dw-mipi-dsi-rockchip", | ||
3080 | }, | ||
3081 | }; | ||
3082 | diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c | ||
3083 | index 07df64daf7dae..efce31d035ef5 100644 | ||
3084 | --- a/drivers/hid/hid-apple.c | ||
3085 | +++ b/drivers/hid/hid-apple.c | ||
3086 | @@ -389,7 +389,7 @@ static int apple_input_configured(struct hid_device *hdev, | ||
3087 | |||
3088 | if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { | ||
3089 | hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); | ||
3090 | - asc->quirks = 0; | ||
3091 | + asc->quirks &= ~APPLE_HAS_FN; | ||
3092 | } | ||
3093 | |||
3094 | return 0; | ||
3095 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c | ||
3096 | index ea4c97f5b0736..749558aa27e78 100644 | ||
3097 | --- a/drivers/hid/hid-input.c | ||
3098 | +++ b/drivers/hid/hid-input.c | ||
3099 | @@ -1288,6 +1288,12 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct | ||
3100 | |||
3101 | input = field->hidinput->input; | ||
3102 | |||
3103 | + if (usage->type == EV_ABS && | ||
3104 | + (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) || | ||
3105 | + ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) { | ||
3106 | + value = field->logical_maximum - value; | ||
3107 | + } | ||
3108 | + | ||
3109 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { | ||
3110 | int hat_dir = usage->hat_dir; | ||
3111 | if (!hat_dir) | ||
3112 | diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c | ||
3113 | index ed4ede52b017f..191aba9f6b497 100644 | ||
3114 | --- a/drivers/hid/hid-uclogic-params.c | ||
3115 | +++ b/drivers/hid/hid-uclogic-params.c | ||
3116 | @@ -65,7 +65,7 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struct hid_device *hdev, | ||
3117 | __u8 idx, size_t len) | ||
3118 | { | ||
3119 | int rc; | ||
3120 | - struct usb_device *udev = hid_to_usb_dev(hdev); | ||
3121 | + struct usb_device *udev; | ||
3122 | __u8 *buf = NULL; | ||
3123 | |||
3124 | /* Check arguments */ | ||
3125 | @@ -74,6 +74,8 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struct hid_device *hdev, | ||
3126 | goto cleanup; | ||
3127 | } | ||
3128 | |||
3129 | + udev = hid_to_usb_dev(hdev); | ||
3130 | + | ||
3131 | buf = kmalloc(len, GFP_KERNEL); | ||
3132 | if (buf == NULL) { | ||
3133 | rc = -ENOMEM; | ||
3134 | @@ -449,7 +451,7 @@ static int uclogic_params_frame_init_v1_buttonpad( | ||
3135 | { | ||
3136 | int rc; | ||
3137 | bool found = false; | ||
3138 | - struct usb_device *usb_dev = hid_to_usb_dev(hdev); | ||
3139 | + struct usb_device *usb_dev; | ||
3140 | char *str_buf = NULL; | ||
3141 | const size_t str_len = 16; | ||
3142 | |||
3143 | @@ -459,6 +461,8 @@ static int uclogic_params_frame_init_v1_buttonpad( | ||
3144 | goto cleanup; | ||
3145 | } | ||
3146 | |||
3147 | + usb_dev = hid_to_usb_dev(hdev); | ||
3148 | + | ||
3149 | /* | ||
3150 | * Enable generic button mode | ||
3151 | */ | ||
3152 | @@ -705,9 +709,9 @@ static int uclogic_params_huion_init(struct uclogic_params *params, | ||
3153 | struct hid_device *hdev) | ||
3154 | { | ||
3155 | int rc; | ||
3156 | - struct usb_device *udev = hid_to_usb_dev(hdev); | ||
3157 | - struct usb_interface *iface = to_usb_interface(hdev->dev.parent); | ||
3158 | - __u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; | ||
3159 | + struct usb_device *udev; | ||
3160 | + struct usb_interface *iface; | ||
3161 | + __u8 bInterfaceNumber; | ||
3162 | bool found; | ||
3163 | /* The resulting parameters (noop) */ | ||
3164 | struct uclogic_params p = {0, }; | ||
3165 | @@ -721,6 +725,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params, | ||
3166 | goto cleanup; | ||
3167 | } | ||
3168 | |||
3169 | + udev = hid_to_usb_dev(hdev); | ||
3170 | + iface = to_usb_interface(hdev->dev.parent); | ||
3171 | + bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; | ||
3172 | + | ||
3173 | /* If it's not a pen interface */ | ||
3174 | if (bInterfaceNumber != 0) { | ||
3175 | /* TODO: Consider marking the interface invalid */ | ||
3176 | @@ -832,10 +840,10 @@ int uclogic_params_init(struct uclogic_params *params, | ||
3177 | struct hid_device *hdev) | ||
3178 | { | ||
3179 | int rc; | ||
3180 | - struct usb_device *udev = hid_to_usb_dev(hdev); | ||
3181 | - __u8 bNumInterfaces = udev->config->desc.bNumInterfaces; | ||
3182 | - struct usb_interface *iface = to_usb_interface(hdev->dev.parent); | ||
3183 | - __u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; | ||
3184 | + struct usb_device *udev; | ||
3185 | + __u8 bNumInterfaces; | ||
3186 | + struct usb_interface *iface; | ||
3187 | + __u8 bInterfaceNumber; | ||
3188 | bool found; | ||
3189 | /* The resulting parameters (noop) */ | ||
3190 | struct uclogic_params p = {0, }; | ||
3191 | @@ -846,6 +854,11 @@ int uclogic_params_init(struct uclogic_params *params, | ||
3192 | goto cleanup; | ||
3193 | } | ||
3194 | |||
3195 | + udev = hid_to_usb_dev(hdev); | ||
3196 | + bNumInterfaces = udev->config->desc.bNumInterfaces; | ||
3197 | + iface = to_usb_interface(hdev->dev.parent); | ||
3198 | + bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; | ||
3199 | + | ||
3200 | /* | ||
3201 | * Set replacement report descriptor if the original matches the | ||
3202 | * specified size. Otherwise keep interface unchanged. | ||
3203 | diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c | ||
3204 | index 8fe3efcb83271..fc06d8bb42e0f 100644 | ||
3205 | --- a/drivers/hid/uhid.c | ||
3206 | +++ b/drivers/hid/uhid.c | ||
3207 | @@ -28,11 +28,22 @@ | ||
3208 | |||
3209 | struct uhid_device { | ||
3210 | struct mutex devlock; | ||
3211 | + | ||
3212 | + /* This flag tracks whether the HID device is usable for commands from | ||
3213 | + * userspace. The flag is already set before hid_add_device(), which | ||
3214 | + * runs in workqueue context, to allow hid_add_device() to communicate | ||
3215 | + * with userspace. | ||
3216 | + * However, if hid_add_device() fails, the flag is cleared without | ||
3217 | + * holding devlock. | ||
3218 | + * We guarantee that if @running changes from true to false while you're | ||
3219 | + * holding @devlock, it's still fine to access @hid. | ||
3220 | + */ | ||
3221 | bool running; | ||
3222 | |||
3223 | __u8 *rd_data; | ||
3224 | uint rd_size; | ||
3225 | |||
3226 | + /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ | ||
3227 | struct hid_device *hid; | ||
3228 | struct uhid_event input_buf; | ||
3229 | |||
3230 | @@ -63,9 +74,18 @@ static void uhid_device_add_worker(struct work_struct *work) | ||
3231 | if (ret) { | ||
3232 | hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); | ||
3233 | |||
3234 | - hid_destroy_device(uhid->hid); | ||
3235 | - uhid->hid = NULL; | ||
3236 | + /* We used to call hid_destroy_device() here, but that's really | ||
3237 | + * messy to get right because we have to coordinate with | ||
3238 | + * concurrent writes from userspace that might be in the middle | ||
3239 | + * of using uhid->hid. | ||
3240 | + * Just leave uhid->hid as-is for now, and clean it up when | ||
3241 | + * userspace tries to close or reinitialize the uhid instance. | ||
3242 | + * | ||
3243 | + * However, we do have to clear the ->running flag and do a | ||
3244 | + * wakeup to make sure userspace knows that the device is gone. | ||
3245 | + */ | ||
3246 | uhid->running = false; | ||
3247 | + wake_up_interruptible(&uhid->report_wait); | ||
3248 | } | ||
3249 | } | ||
3250 | |||
3251 | @@ -474,7 +494,7 @@ static int uhid_dev_create2(struct uhid_device *uhid, | ||
3252 | void *rd_data; | ||
3253 | int ret; | ||
3254 | |||
3255 | - if (uhid->running) | ||
3256 | + if (uhid->hid) | ||
3257 | return -EALREADY; | ||
3258 | |||
3259 | rd_size = ev->u.create2.rd_size; | ||
3260 | @@ -556,7 +576,7 @@ static int uhid_dev_create(struct uhid_device *uhid, | ||
3261 | |||
3262 | static int uhid_dev_destroy(struct uhid_device *uhid) | ||
3263 | { | ||
3264 | - if (!uhid->running) | ||
3265 | + if (!uhid->hid) | ||
3266 | return -EINVAL; | ||
3267 | |||
3268 | uhid->running = false; | ||
3269 | @@ -565,6 +585,7 @@ static int uhid_dev_destroy(struct uhid_device *uhid) | ||
3270 | cancel_work_sync(&uhid->worker); | ||
3271 | |||
3272 | hid_destroy_device(uhid->hid); | ||
3273 | + uhid->hid = NULL; | ||
3274 | kfree(uhid->rd_data); | ||
3275 | |||
3276 | return 0; | ||
3277 | diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c | ||
3278 | index e011839f19f89..de69ea5f5a4be 100644 | ||
3279 | --- a/drivers/hid/wacom_wac.c | ||
3280 | +++ b/drivers/hid/wacom_wac.c | ||
3281 | @@ -2566,6 +2566,24 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, | ||
3282 | } | ||
3283 | } | ||
3284 | |||
3285 | +static bool wacom_wac_slot_is_active(struct input_dev *dev, int key) | ||
3286 | +{ | ||
3287 | + struct input_mt *mt = dev->mt; | ||
3288 | + struct input_mt_slot *s; | ||
3289 | + | ||
3290 | + if (!mt) | ||
3291 | + return false; | ||
3292 | + | ||
3293 | + for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { | ||
3294 | + if (s->key == key && | ||
3295 | + input_mt_get_value(s, ABS_MT_TRACKING_ID) >= 0) { | ||
3296 | + return true; | ||
3297 | + } | ||
3298 | + } | ||
3299 | + | ||
3300 | + return false; | ||
3301 | +} | ||
3302 | + | ||
3303 | static void wacom_wac_finger_event(struct hid_device *hdev, | ||
3304 | struct hid_field *field, struct hid_usage *usage, __s32 value) | ||
3305 | { | ||
3306 | @@ -2613,9 +2631,14 @@ static void wacom_wac_finger_event(struct hid_device *hdev, | ||
3307 | } | ||
3308 | |||
3309 | if (usage->usage_index + 1 == field->report_count) { | ||
3310 | - if (equivalent_usage == wacom_wac->hid_data.last_slot_field && | ||
3311 | - wacom_wac->hid_data.confidence) | ||
3312 | - wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); | ||
3313 | + if (equivalent_usage == wacom_wac->hid_data.last_slot_field) { | ||
3314 | + bool touch_removed = wacom_wac_slot_is_active(wacom_wac->touch_input, | ||
3315 | + wacom_wac->hid_data.id) && !wacom_wac->hid_data.tipswitch; | ||
3316 | + | ||
3317 | + if (wacom_wac->hid_data.confidence || touch_removed) { | ||
3318 | + wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); | ||
3319 | + } | ||
3320 | + } | ||
3321 | } | ||
3322 | } | ||
3323 | |||
3324 | @@ -2631,6 +2654,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, | ||
3325 | |||
3326 | hid_data->confidence = true; | ||
3327 | |||
3328 | + hid_data->cc_report = 0; | ||
3329 | + hid_data->cc_index = -1; | ||
3330 | + hid_data->cc_value_index = -1; | ||
3331 | + | ||
3332 | for (i = 0; i < report->maxfield; i++) { | ||
3333 | struct hid_field *field = report->field[i]; | ||
3334 | int j; | ||
3335 | @@ -2664,11 +2691,14 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, | ||
3336 | hid_data->cc_index >= 0) { | ||
3337 | struct hid_field *field = report->field[hid_data->cc_index]; | ||
3338 | int value = field->value[hid_data->cc_value_index]; | ||
3339 | - if (value) | ||
3340 | + if (value) { | ||
3341 | hid_data->num_expected = value; | ||
3342 | + hid_data->num_received = 0; | ||
3343 | + } | ||
3344 | } | ||
3345 | else { | ||
3346 | hid_data->num_expected = wacom_wac->features.touch_max; | ||
3347 | + hid_data->num_received = 0; | ||
3348 | } | ||
3349 | } | ||
3350 | |||
3351 | @@ -2692,6 +2722,7 @@ static void wacom_wac_finger_report(struct hid_device *hdev, | ||
3352 | |||
3353 | input_sync(input); | ||
3354 | wacom_wac->hid_data.num_received = 0; | ||
3355 | + wacom_wac->hid_data.num_expected = 0; | ||
3356 | |||
3357 | /* keep touch state for pen event */ | ||
3358 | wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); | ||
3359 | diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c | ||
3360 | index a5f92e2889cb8..a330f58d45fc6 100644 | ||
3361 | --- a/drivers/hsi/hsi_core.c | ||
3362 | +++ b/drivers/hsi/hsi_core.c | ||
3363 | @@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, | ||
3364 | if (device_register(&cl->device) < 0) { | ||
3365 | pr_err("hsi: failed to register client: %s\n", info->name); | ||
3366 | put_device(&cl->device); | ||
3367 | + goto err; | ||
3368 | } | ||
3369 | |||
3370 | return cl; | ||
3371 | diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c | ||
3372 | index 05b35ac33ce33..735326e5eb8cf 100644 | ||
3373 | --- a/drivers/i2c/busses/i2c-designware-pcidrv.c | ||
3374 | +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c | ||
3375 | @@ -37,10 +37,10 @@ enum dw_pci_ctl_id_t { | ||
3376 | }; | ||
3377 | |||
3378 | struct dw_scl_sda_cfg { | ||
3379 | - u32 ss_hcnt; | ||
3380 | - u32 fs_hcnt; | ||
3381 | - u32 ss_lcnt; | ||
3382 | - u32 fs_lcnt; | ||
3383 | + u16 ss_hcnt; | ||
3384 | + u16 fs_hcnt; | ||
3385 | + u16 ss_lcnt; | ||
3386 | + u16 fs_lcnt; | ||
3387 | u32 sda_hold; | ||
3388 | }; | ||
3389 | |||
3390 | diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c | ||
3391 | index a959062ded4f8..4e6d0b722ddcd 100644 | ||
3392 | --- a/drivers/i2c/busses/i2c-i801.c | ||
3393 | +++ b/drivers/i2c/busses/i2c-i801.c | ||
3394 | @@ -785,6 +785,11 @@ static int i801_block_transaction(struct i801_priv *priv, | ||
3395 | int result = 0; | ||
3396 | unsigned char hostc; | ||
3397 | |||
3398 | + if (read_write == I2C_SMBUS_READ && command == I2C_SMBUS_BLOCK_DATA) | ||
3399 | + data->block[0] = I2C_SMBUS_BLOCK_MAX; | ||
3400 | + else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) | ||
3401 | + return -EPROTO; | ||
3402 | + | ||
3403 | if (command == I2C_SMBUS_I2C_BLOCK_DATA) { | ||
3404 | if (read_write == I2C_SMBUS_WRITE) { | ||
3405 | /* set I2C_EN bit in configuration register */ | ||
3406 | @@ -798,16 +803,6 @@ static int i801_block_transaction(struct i801_priv *priv, | ||
3407 | } | ||
3408 | } | ||
3409 | |||
3410 | - if (read_write == I2C_SMBUS_WRITE | ||
3411 | - || command == I2C_SMBUS_I2C_BLOCK_DATA) { | ||
3412 | - if (data->block[0] < 1) | ||
3413 | - data->block[0] = 1; | ||
3414 | - if (data->block[0] > I2C_SMBUS_BLOCK_MAX) | ||
3415 | - data->block[0] = I2C_SMBUS_BLOCK_MAX; | ||
3416 | - } else { | ||
3417 | - data->block[0] = 32; /* max for SMBus block reads */ | ||
3418 | - } | ||
3419 | - | ||
3420 | /* Experience has shown that the block buffer can only be used for | ||
3421 | SMBus (not I2C) block transactions, even though the datasheet | ||
3422 | doesn't mention this limitation. */ | ||
3423 | diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c | ||
3424 | index af349661fd769..8de8296d25831 100644 | ||
3425 | --- a/drivers/i2c/busses/i2c-mpc.c | ||
3426 | +++ b/drivers/i2c/busses/i2c-mpc.c | ||
3427 | @@ -105,23 +105,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) | ||
3428 | /* Sometimes 9th clock pulse isn't generated, and slave doesn't release | ||
3429 | * the bus, because it wants to send ACK. | ||
3430 | * Following sequence of enabling/disabling and sending start/stop generates | ||
3431 | - * the 9 pulses, so it's all OK. | ||
3432 | + * the 9 pulses, each with a START then ending with STOP, so it's all OK. | ||
3433 | */ | ||
3434 | static void mpc_i2c_fixup(struct mpc_i2c *i2c) | ||
3435 | { | ||
3436 | int k; | ||
3437 | - u32 delay_val = 1000000 / i2c->real_clk + 1; | ||
3438 | - | ||
3439 | - if (delay_val < 2) | ||
3440 | - delay_val = 2; | ||
3441 | + unsigned long flags; | ||
3442 | |||
3443 | for (k = 9; k; k--) { | ||
3444 | writeccr(i2c, 0); | ||
3445 | - writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); | ||
3446 | + writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ | ||
3447 | + writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ | ||
3448 | + readb(i2c->base + MPC_I2C_DR); /* init xfer */ | ||
3449 | + udelay(15); /* let it hit the bus */ | ||
3450 | + local_irq_save(flags); /* should not be delayed further */ | ||
3451 | + writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ | ||
3452 | readb(i2c->base + MPC_I2C_DR); | ||
3453 | - writeccr(i2c, CCR_MEN); | ||
3454 | - udelay(delay_val << 1); | ||
3455 | + if (k != 1) | ||
3456 | + udelay(5); | ||
3457 | + local_irq_restore(flags); | ||
3458 | } | ||
3459 | + writeccr(i2c, CCR_MEN); /* Initiate STOP */ | ||
3460 | + readb(i2c->base + MPC_I2C_DR); | ||
3461 | + udelay(15); /* Let STOP propagate */ | ||
3462 | + writeccr(i2c, 0); | ||
3463 | } | ||
3464 | |||
3465 | static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | ||
3466 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c | ||
3467 | index ec9e9598894f6..5e2b688e36fca 100644 | ||
3468 | --- a/drivers/infiniband/core/cma.c | ||
3469 | +++ b/drivers/infiniband/core/cma.c | ||
3470 | @@ -820,6 +820,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | ||
3471 | u16 pkey, index; | ||
3472 | u8 p; | ||
3473 | enum ib_port_state port_state; | ||
3474 | + int ret; | ||
3475 | int i; | ||
3476 | |||
3477 | cma_dev = NULL; | ||
3478 | @@ -838,9 +839,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | ||
3479 | |||
3480 | if (ib_get_cached_port_state(cur_dev->device, p, &port_state)) | ||
3481 | continue; | ||
3482 | - for (i = 0; !rdma_query_gid(cur_dev->device, | ||
3483 | - p, i, &gid); | ||
3484 | - i++) { | ||
3485 | + | ||
3486 | + for (i = 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; | ||
3487 | + ++i) { | ||
3488 | + ret = rdma_query_gid(cur_dev->device, p, i, | ||
3489 | + &gid); | ||
3490 | + if (ret) | ||
3491 | + continue; | ||
3492 | + | ||
3493 | if (!memcmp(&gid, dgid, sizeof(gid))) { | ||
3494 | cma_dev = cur_dev; | ||
3495 | sgid = gid; | ||
3496 | diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c | ||
3497 | index 256d379bba676..de66d7da1bf6e 100644 | ||
3498 | --- a/drivers/infiniband/core/device.c | ||
3499 | +++ b/drivers/infiniband/core/device.c | ||
3500 | @@ -2438,7 +2438,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, | ||
3501 | ++i) { | ||
3502 | ret = rdma_query_gid(device, port, i, &tmp_gid); | ||
3503 | if (ret) | ||
3504 | - return ret; | ||
3505 | + continue; | ||
3506 | + | ||
3507 | if (!memcmp(&tmp_gid, gid, sizeof *gid)) { | ||
3508 | *port_num = port; | ||
3509 | if (index) | ||
3510 | diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c | ||
3511 | index 3ac08f47a8ce4..b3fbafbf66555 100644 | ||
3512 | --- a/drivers/infiniband/hw/cxgb4/qp.c | ||
3513 | +++ b/drivers/infiniband/hw/cxgb4/qp.c | ||
3514 | @@ -2469,6 +2469,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | ||
3515 | memset(attr, 0, sizeof(*attr)); | ||
3516 | memset(init_attr, 0, sizeof(*init_attr)); | ||
3517 | attr->qp_state = to_ib_qp_state(qhp->attr.state); | ||
3518 | + attr->cur_qp_state = to_ib_qp_state(qhp->attr.state); | ||
3519 | init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; | ||
3520 | init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; | ||
3521 | init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; | ||
3522 | diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c | ||
3523 | index f23a341400c06..70991649dc693 100644 | ||
3524 | --- a/drivers/infiniband/hw/hns/hns_roce_main.c | ||
3525 | +++ b/drivers/infiniband/hw/hns/hns_roce_main.c | ||
3526 | @@ -279,6 +279,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device, | ||
3527 | static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index, | ||
3528 | u16 *pkey) | ||
3529 | { | ||
3530 | + if (index > 0) | ||
3531 | + return -EINVAL; | ||
3532 | + | ||
3533 | *pkey = PKEY_ID; | ||
3534 | |||
3535 | return 0; | ||
3536 | @@ -359,7 +362,7 @@ static int hns_roce_mmap(struct ib_ucontext *context, | ||
3537 | return rdma_user_mmap_io(context, vma, | ||
3538 | to_hr_ucontext(context)->uar.pfn, | ||
3539 | PAGE_SIZE, | ||
3540 | - pgprot_noncached(vma->vm_page_prot)); | ||
3541 | + pgprot_device(vma->vm_page_prot)); | ||
3542 | |||
3543 | /* vm_pgoff: 1 -- TPTR */ | ||
3544 | case 1: | ||
3545 | diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.c b/drivers/infiniband/sw/rxe/rxe_opcode.c | ||
3546 | index 4cf11063e0b59..0f166d6d0ccb0 100644 | ||
3547 | --- a/drivers/infiniband/sw/rxe/rxe_opcode.c | ||
3548 | +++ b/drivers/infiniband/sw/rxe/rxe_opcode.c | ||
3549 | @@ -137,7 +137,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = { | ||
3550 | } | ||
3551 | }, | ||
3552 | [IB_OPCODE_RC_SEND_MIDDLE] = { | ||
3553 | - .name = "IB_OPCODE_RC_SEND_MIDDLE]", | ||
3554 | + .name = "IB_OPCODE_RC_SEND_MIDDLE", | ||
3555 | .mask = RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK | ||
3556 | | RXE_MIDDLE_MASK, | ||
3557 | .length = RXE_BTH_BYTES, | ||
3558 | diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c | ||
3559 | index 4cb394937700c..909be90d26662 100644 | ||
3560 | --- a/drivers/iommu/io-pgtable-arm-v7s.c | ||
3561 | +++ b/drivers/iommu/io-pgtable-arm-v7s.c | ||
3562 | @@ -244,13 +244,17 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, | ||
3563 | __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); | ||
3564 | else if (lvl == 2) | ||
3565 | table = kmem_cache_zalloc(data->l2_tables, gfp); | ||
3566 | + | ||
3567 | + if (!table) | ||
3568 | + return NULL; | ||
3569 | + | ||
3570 | phys = virt_to_phys(table); | ||
3571 | if (phys != (arm_v7s_iopte)phys) { | ||
3572 | /* Doesn't fit in PTE */ | ||
3573 | dev_err(dev, "Page table does not fit in PTE: %pa", &phys); | ||
3574 | goto out_free; | ||
3575 | } | ||
3576 | - if (table && !cfg->coherent_walk) { | ||
3577 | + if (!cfg->coherent_walk) { | ||
3578 | dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); | ||
3579 | if (dma_mapping_error(dev, dma)) | ||
3580 | goto out_free; | ||
3581 | diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c | ||
3582 | index ca51036aa53c7..975237ca03267 100644 | ||
3583 | --- a/drivers/iommu/io-pgtable-arm.c | ||
3584 | +++ b/drivers/iommu/io-pgtable-arm.c | ||
3585 | @@ -351,11 +351,12 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data, | ||
3586 | static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, | ||
3587 | arm_lpae_iopte *ptep, | ||
3588 | arm_lpae_iopte curr, | ||
3589 | - struct io_pgtable_cfg *cfg) | ||
3590 | + struct arm_lpae_io_pgtable *data) | ||
3591 | { | ||
3592 | arm_lpae_iopte old, new; | ||
3593 | + struct io_pgtable_cfg *cfg = &data->iop.cfg; | ||
3594 | |||
3595 | - new = __pa(table) | ARM_LPAE_PTE_TYPE_TABLE; | ||
3596 | + new = paddr_to_iopte(__pa(table), data) | ARM_LPAE_PTE_TYPE_TABLE; | ||
3597 | if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) | ||
3598 | new |= ARM_LPAE_PTE_NSTABLE; | ||
3599 | |||
3600 | @@ -406,7 +407,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova, | ||
3601 | if (!cptep) | ||
3602 | return -ENOMEM; | ||
3603 | |||
3604 | - pte = arm_lpae_install_table(cptep, ptep, 0, cfg); | ||
3605 | + pte = arm_lpae_install_table(cptep, ptep, 0, data); | ||
3606 | if (pte) | ||
3607 | __arm_lpae_free_pages(cptep, tblsz, cfg); | ||
3608 | } else if (!cfg->coherent_walk && !(pte & ARM_LPAE_PTE_SW_SYNC)) { | ||
3609 | @@ -575,7 +576,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data, | ||
3610 | __arm_lpae_init_pte(data, blk_paddr, pte, lvl, &tablep[i]); | ||
3611 | } | ||
3612 | |||
3613 | - pte = arm_lpae_install_table(tablep, ptep, blk_pte, cfg); | ||
3614 | + pte = arm_lpae_install_table(tablep, ptep, blk_pte, data); | ||
3615 | if (pte != blk_pte) { | ||
3616 | __arm_lpae_free_pages(tablep, tablesz, cfg); | ||
3617 | /* | ||
3618 | diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c | ||
3619 | index 612cbf668adf8..906582a21124d 100644 | ||
3620 | --- a/drivers/iommu/iova.c | ||
3621 | +++ b/drivers/iommu/iova.c | ||
3622 | @@ -64,8 +64,7 @@ static void free_iova_flush_queue(struct iova_domain *iovad) | ||
3623 | if (!has_iova_flush_queue(iovad)) | ||
3624 | return; | ||
3625 | |||
3626 | - if (timer_pending(&iovad->fq_timer)) | ||
3627 | - del_timer(&iovad->fq_timer); | ||
3628 | + del_timer_sync(&iovad->fq_timer); | ||
3629 | |||
3630 | fq_destroy_all_entries(iovad); | ||
3631 | |||
3632 | diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c | ||
3633 | index 8aae0624a2971..6383afb88f319 100644 | ||
3634 | --- a/drivers/md/persistent-data/dm-btree.c | ||
3635 | +++ b/drivers/md/persistent-data/dm-btree.c | ||
3636 | @@ -83,14 +83,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, | ||
3637 | } | ||
3638 | |||
3639 | static int insert_at(size_t value_size, struct btree_node *node, unsigned index, | ||
3640 | - uint64_t key, void *value) | ||
3641 | - __dm_written_to_disk(value) | ||
3642 | + uint64_t key, void *value) | ||
3643 | + __dm_written_to_disk(value) | ||
3644 | { | ||
3645 | uint32_t nr_entries = le32_to_cpu(node->header.nr_entries); | ||
3646 | + uint32_t max_entries = le32_to_cpu(node->header.max_entries); | ||
3647 | __le64 key_le = cpu_to_le64(key); | ||
3648 | |||
3649 | if (index > nr_entries || | ||
3650 | - index >= le32_to_cpu(node->header.max_entries)) { | ||
3651 | + index >= max_entries || | ||
3652 | + nr_entries >= max_entries) { | ||
3653 | DMERR("too many entries in btree node for insert"); | ||
3654 | __dm_unbless_for_disk(value); | ||
3655 | return -ENOMEM; | ||
3656 | diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c | ||
3657 | index a213bf11738fb..85853ab629717 100644 | ||
3658 | --- a/drivers/md/persistent-data/dm-space-map-common.c | ||
3659 | +++ b/drivers/md/persistent-data/dm-space-map-common.c | ||
3660 | @@ -281,6 +281,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result) | ||
3661 | struct disk_index_entry ie_disk; | ||
3662 | struct dm_block *blk; | ||
3663 | |||
3664 | + if (b >= ll->nr_blocks) { | ||
3665 | + DMERR_LIMIT("metadata block out of bounds"); | ||
3666 | + return -EINVAL; | ||
3667 | + } | ||
3668 | + | ||
3669 | b = do_div(index, ll->entries_per_block); | ||
3670 | r = ll->load_ie(ll, index, &ie_disk); | ||
3671 | if (r < 0) | ||
3672 | diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c | ||
3673 | index aabb830e74689..4b332ea986168 100644 | ||
3674 | --- a/drivers/media/common/saa7146/saa7146_fops.c | ||
3675 | +++ b/drivers/media/common/saa7146/saa7146_fops.c | ||
3676 | @@ -525,7 +525,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) | ||
3677 | ERR("out of memory. aborting.\n"); | ||
3678 | kfree(vv); | ||
3679 | v4l2_ctrl_handler_free(hdl); | ||
3680 | - return -1; | ||
3681 | + return -ENOMEM; | ||
3682 | } | ||
3683 | |||
3684 | saa7146_video_uops.init(dev,vv); | ||
3685 | diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c | ||
3686 | index 44cd0e530bbd3..093ebe6f279f7 100644 | ||
3687 | --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c | ||
3688 | +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c | ||
3689 | @@ -154,7 +154,7 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs, | ||
3690 | buf->cookie = dma_alloc_attrs(dev, size, &buf->dma_addr, | ||
3691 | GFP_KERNEL | gfp_flags, buf->attrs); | ||
3692 | if (!buf->cookie) { | ||
3693 | - dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); | ||
3694 | + dev_err(dev, "dma_alloc_coherent of size %lu failed\n", size); | ||
3695 | kfree(buf); | ||
3696 | return ERR_PTR(-ENOMEM); | ||
3697 | } | ||
3698 | @@ -200,9 +200,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) | ||
3699 | |||
3700 | vma->vm_ops->open(vma); | ||
3701 | |||
3702 | - pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", | ||
3703 | - __func__, (unsigned long)buf->dma_addr, vma->vm_start, | ||
3704 | - buf->size); | ||
3705 | + pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", | ||
3706 | + __func__, (unsigned long)buf->dma_addr, vma->vm_start, | ||
3707 | + buf->size); | ||
3708 | |||
3709 | return 0; | ||
3710 | } | ||
3711 | diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c | ||
3712 | index f14a872d12687..e58cb8434dafe 100644 | ||
3713 | --- a/drivers/media/dvb-core/dmxdev.c | ||
3714 | +++ b/drivers/media/dvb-core/dmxdev.c | ||
3715 | @@ -1413,7 +1413,7 @@ static const struct dvb_device dvbdev_dvr = { | ||
3716 | }; | ||
3717 | int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) | ||
3718 | { | ||
3719 | - int i; | ||
3720 | + int i, ret; | ||
3721 | |||
3722 | if (dmxdev->demux->open(dmxdev->demux) < 0) | ||
3723 | return -EUSERS; | ||
3724 | @@ -1432,14 +1432,26 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) | ||
3725 | DMXDEV_STATE_FREE); | ||
3726 | } | ||
3727 | |||
3728 | - dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, | ||
3729 | + ret = dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, | ||
3730 | DVB_DEVICE_DEMUX, dmxdev->filternum); | ||
3731 | - dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, | ||
3732 | + if (ret < 0) | ||
3733 | + goto err_register_dvbdev; | ||
3734 | + | ||
3735 | + ret = dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, | ||
3736 | dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); | ||
3737 | + if (ret < 0) | ||
3738 | + goto err_register_dvr_dvbdev; | ||
3739 | |||
3740 | dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); | ||
3741 | |||
3742 | return 0; | ||
3743 | + | ||
3744 | +err_register_dvr_dvbdev: | ||
3745 | + dvb_unregister_device(dmxdev->dvbdev); | ||
3746 | +err_register_dvbdev: | ||
3747 | + vfree(dmxdev->filter); | ||
3748 | + dmxdev->filter = NULL; | ||
3749 | + return ret; | ||
3750 | } | ||
3751 | |||
3752 | EXPORT_SYMBOL(dvb_dmxdev_init); | ||
3753 | diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c | ||
3754 | index bb02354a48b81..d67f2dd997d06 100644 | ||
3755 | --- a/drivers/media/dvb-frontends/dib8000.c | ||
3756 | +++ b/drivers/media/dvb-frontends/dib8000.c | ||
3757 | @@ -4473,8 +4473,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad | ||
3758 | |||
3759 | state->timf_default = cfg->pll->timf; | ||
3760 | |||
3761 | - if (dib8000_identify(&state->i2c) == 0) | ||
3762 | + if (dib8000_identify(&state->i2c) == 0) { | ||
3763 | + kfree(fe); | ||
3764 | goto error; | ||
3765 | + } | ||
3766 | |||
3767 | dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr); | ||
3768 | |||
3769 | diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/flexcop-pci.c | ||
3770 | index a9d9520a94c6d..c9e6c7d663768 100644 | ||
3771 | --- a/drivers/media/pci/b2c2/flexcop-pci.c | ||
3772 | +++ b/drivers/media/pci/b2c2/flexcop-pci.c | ||
3773 | @@ -185,6 +185,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) | ||
3774 | dma_addr_t cur_addr = | ||
3775 | fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; | ||
3776 | u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; | ||
3777 | + if (cur_pos > fc_pci->dma[0].size * 2) | ||
3778 | + goto error; | ||
3779 | |||
3780 | deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", | ||
3781 | jiffies_to_usecs(jiffies - fc_pci->last_irq), | ||
3782 | @@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) | ||
3783 | ret = IRQ_NONE; | ||
3784 | } | ||
3785 | |||
3786 | +error: | ||
3787 | spin_unlock_irqrestore(&fc_pci->irq_lock, flags); | ||
3788 | return ret; | ||
3789 | } | ||
3790 | diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c | ||
3791 | index f962269306707..86d4e2abed82a 100644 | ||
3792 | --- a/drivers/media/pci/saa7146/hexium_gemini.c | ||
3793 | +++ b/drivers/media/pci/saa7146/hexium_gemini.c | ||
3794 | @@ -284,7 +284,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | ||
3795 | hexium_set_input(hexium, 0); | ||
3796 | hexium->cur_input = 0; | ||
3797 | |||
3798 | - saa7146_vv_init(dev, &vv_data); | ||
3799 | + ret = saa7146_vv_init(dev, &vv_data); | ||
3800 | + if (ret) { | ||
3801 | + i2c_del_adapter(&hexium->i2c_adapter); | ||
3802 | + kfree(hexium); | ||
3803 | + return ret; | ||
3804 | + } | ||
3805 | |||
3806 | vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; | ||
3807 | vv_data.vid_ops.vidioc_g_input = vidioc_g_input; | ||
3808 | diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c | ||
3809 | index bf5e55348f159..31388597386aa 100644 | ||
3810 | --- a/drivers/media/pci/saa7146/hexium_orion.c | ||
3811 | +++ b/drivers/media/pci/saa7146/hexium_orion.c | ||
3812 | @@ -355,10 +355,16 @@ static struct saa7146_ext_vv vv_data; | ||
3813 | static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) | ||
3814 | { | ||
3815 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | ||
3816 | + int ret; | ||
3817 | |||
3818 | DEB_EE("\n"); | ||
3819 | |||
3820 | - saa7146_vv_init(dev, &vv_data); | ||
3821 | + ret = saa7146_vv_init(dev, &vv_data); | ||
3822 | + if (ret) { | ||
3823 | + pr_err("Error in saa7146_vv_init()\n"); | ||
3824 | + return ret; | ||
3825 | + } | ||
3826 | + | ||
3827 | vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; | ||
3828 | vv_data.vid_ops.vidioc_g_input = vidioc_g_input; | ||
3829 | vv_data.vid_ops.vidioc_s_input = vidioc_s_input; | ||
3830 | diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c | ||
3831 | index 952ea250feda0..58fe4c1619eeb 100644 | ||
3832 | --- a/drivers/media/pci/saa7146/mxb.c | ||
3833 | +++ b/drivers/media/pci/saa7146/mxb.c | ||
3834 | @@ -683,10 +683,16 @@ static struct saa7146_ext_vv vv_data; | ||
3835 | static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) | ||
3836 | { | ||
3837 | struct mxb *mxb; | ||
3838 | + int ret; | ||
3839 | |||
3840 | DEB_EE("dev:%p\n", dev); | ||
3841 | |||
3842 | - saa7146_vv_init(dev, &vv_data); | ||
3843 | + ret = saa7146_vv_init(dev, &vv_data); | ||
3844 | + if (ret) { | ||
3845 | + ERR("Error in saa7146_vv_init()"); | ||
3846 | + return ret; | ||
3847 | + } | ||
3848 | + | ||
3849 | if (mxb_probe(dev)) { | ||
3850 | saa7146_vv_release(dev); | ||
3851 | return -1; | ||
3852 | diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c | ||
3853 | index 6dde49d9aa4c2..1e0867016bf37 100644 | ||
3854 | --- a/drivers/media/platform/aspeed-video.c | ||
3855 | +++ b/drivers/media/platform/aspeed-video.c | ||
3856 | @@ -477,6 +477,10 @@ static void aspeed_video_enable_mode_detect(struct aspeed_video *video) | ||
3857 | aspeed_video_update(video, VE_INTERRUPT_CTRL, 0, | ||
3858 | VE_INTERRUPT_MODE_DETECT); | ||
3859 | |||
3860 | + /* Disable mode detect in order to re-trigger */ | ||
3861 | + aspeed_video_update(video, VE_SEQ_CTRL, | ||
3862 | + VE_SEQ_CTRL_TRIG_MODE_DET, 0); | ||
3863 | + | ||
3864 | /* Trigger mode detect */ | ||
3865 | aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET); | ||
3866 | } | ||
3867 | @@ -529,6 +533,8 @@ static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay) | ||
3868 | set_bit(VIDEO_RES_CHANGE, &video->flags); | ||
3869 | clear_bit(VIDEO_FRAME_INPRG, &video->flags); | ||
3870 | |||
3871 | + video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL; | ||
3872 | + | ||
3873 | aspeed_video_off(video); | ||
3874 | aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR); | ||
3875 | |||
3876 | @@ -764,10 +770,6 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) | ||
3877 | return; | ||
3878 | } | ||
3879 | |||
3880 | - /* Disable mode detect in order to re-trigger */ | ||
3881 | - aspeed_video_update(video, VE_SEQ_CTRL, | ||
3882 | - VE_SEQ_CTRL_TRIG_MODE_DET, 0); | ||
3883 | - | ||
3884 | aspeed_video_check_and_set_polarity(video); | ||
3885 | |||
3886 | aspeed_video_enable_mode_detect(video); | ||
3887 | @@ -1315,7 +1317,6 @@ static void aspeed_video_resolution_work(struct work_struct *work) | ||
3888 | struct delayed_work *dwork = to_delayed_work(work); | ||
3889 | struct aspeed_video *video = container_of(dwork, struct aspeed_video, | ||
3890 | res_work); | ||
3891 | - u32 input_status = video->v4l2_input_status; | ||
3892 | |||
3893 | aspeed_video_on(video); | ||
3894 | |||
3895 | @@ -1328,8 +1329,7 @@ static void aspeed_video_resolution_work(struct work_struct *work) | ||
3896 | aspeed_video_get_resolution(video); | ||
3897 | |||
3898 | if (video->detected_timings.width != video->active_timings.width || | ||
3899 | - video->detected_timings.height != video->active_timings.height || | ||
3900 | - input_status != video->v4l2_input_status) { | ||
3901 | + video->detected_timings.height != video->active_timings.height) { | ||
3902 | static const struct v4l2_event ev = { | ||
3903 | .type = V4L2_EVENT_SOURCE_CHANGE, | ||
3904 | .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, | ||
3905 | diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platform/coda/imx-vdoa.c | ||
3906 | index 8bc0d83718193..dd6e2e320264e 100644 | ||
3907 | --- a/drivers/media/platform/coda/imx-vdoa.c | ||
3908 | +++ b/drivers/media/platform/coda/imx-vdoa.c | ||
3909 | @@ -287,7 +287,11 @@ static int vdoa_probe(struct platform_device *pdev) | ||
3910 | struct resource *res; | ||
3911 | int ret; | ||
3912 | |||
3913 | - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
3914 | + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
3915 | + if (ret) { | ||
3916 | + dev_err(&pdev->dev, "DMA enable failed\n"); | ||
3917 | + return ret; | ||
3918 | + } | ||
3919 | |||
3920 | vdoa = devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); | ||
3921 | if (!vdoa) | ||
3922 | diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c | ||
3923 | index 38d9423223025..3c36cefddec7c 100644 | ||
3924 | --- a/drivers/media/platform/imx-pxp.c | ||
3925 | +++ b/drivers/media/platform/imx-pxp.c | ||
3926 | @@ -1664,6 +1664,8 @@ static int pxp_probe(struct platform_device *pdev) | ||
3927 | if (irq < 0) | ||
3928 | return irq; | ||
3929 | |||
3930 | + spin_lock_init(&dev->irqlock); | ||
3931 | + | ||
3932 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler, | ||
3933 | IRQF_ONESHOT, dev_name(&pdev->dev), dev); | ||
3934 | if (ret < 0) { | ||
3935 | @@ -1681,8 +1683,6 @@ static int pxp_probe(struct platform_device *pdev) | ||
3936 | goto err_clk; | ||
3937 | } | ||
3938 | |||
3939 | - spin_lock_init(&dev->irqlock); | ||
3940 | - | ||
3941 | ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); | ||
3942 | if (ret) | ||
3943 | goto err_clk; | ||
3944 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | ||
3945 | index 1d82aa2b6017c..dea0ee2cb7245 100644 | ||
3946 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | ||
3947 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | ||
3948 | @@ -209,11 +209,11 @@ static int fops_vcodec_release(struct file *file) | ||
3949 | mtk_v4l2_debug(1, "[%d] encoder", ctx->id); | ||
3950 | mutex_lock(&dev->dev_mutex); | ||
3951 | |||
3952 | + v4l2_m2m_ctx_release(ctx->m2m_ctx); | ||
3953 | mtk_vcodec_enc_release(ctx); | ||
3954 | v4l2_fh_del(&ctx->fh); | ||
3955 | v4l2_fh_exit(&ctx->fh); | ||
3956 | v4l2_ctrl_handler_free(&ctx->ctrl_hdl); | ||
3957 | - v4l2_m2m_ctx_release(ctx->m2m_ctx); | ||
3958 | |||
3959 | list_del_init(&ctx->list); | ||
3960 | kfree(ctx); | ||
3961 | diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c | ||
3962 | index bbc430a003443..7b52d3e5d3f89 100644 | ||
3963 | --- a/drivers/media/platform/qcom/venus/core.c | ||
3964 | +++ b/drivers/media/platform/qcom/venus/core.c | ||
3965 | @@ -289,11 +289,11 @@ static int venus_probe(struct platform_device *pdev) | ||
3966 | |||
3967 | ret = venus_firmware_init(core); | ||
3968 | if (ret) | ||
3969 | - goto err_runtime_disable; | ||
3970 | + goto err_of_depopulate; | ||
3971 | |||
3972 | ret = venus_boot(core); | ||
3973 | if (ret) | ||
3974 | - goto err_runtime_disable; | ||
3975 | + goto err_firmware_deinit; | ||
3976 | |||
3977 | ret = hfi_core_resume(core, true); | ||
3978 | if (ret) | ||
3979 | @@ -329,6 +329,10 @@ err_core_deinit: | ||
3980 | hfi_core_deinit(core, false); | ||
3981 | err_venus_shutdown: | ||
3982 | venus_shutdown(core); | ||
3983 | +err_firmware_deinit: | ||
3984 | + venus_firmware_deinit(core); | ||
3985 | +err_of_depopulate: | ||
3986 | + of_platform_depopulate(dev); | ||
3987 | err_runtime_disable: | ||
3988 | pm_runtime_put_noidle(dev); | ||
3989 | pm_runtime_set_suspended(dev); | ||
3990 | diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c | ||
3991 | index e01f22bf826d4..db3d5d463f53e 100644 | ||
3992 | --- a/drivers/media/platform/rcar-vin/rcar-csi2.c | ||
3993 | +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c | ||
3994 | @@ -430,16 +430,23 @@ static int rcsi2_wait_phy_start(struct rcar_csi2 *priv) | ||
3995 | static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps) | ||
3996 | { | ||
3997 | const struct rcsi2_mbps_reg *hsfreq; | ||
3998 | + const struct rcsi2_mbps_reg *hsfreq_prev = NULL; | ||
3999 | |||
4000 | - for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) | ||
4001 | + for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) { | ||
4002 | if (hsfreq->mbps >= mbps) | ||
4003 | break; | ||
4004 | + hsfreq_prev = hsfreq; | ||
4005 | + } | ||
4006 | |||
4007 | if (!hsfreq->mbps) { | ||
4008 | dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); | ||
4009 | return -ERANGE; | ||
4010 | } | ||
4011 | |||
4012 | + if (hsfreq_prev && | ||
4013 | + ((mbps - hsfreq_prev->mbps) <= (hsfreq->mbps - mbps))) | ||
4014 | + hsfreq = hsfreq_prev; | ||
4015 | + | ||
4016 | rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg)); | ||
4017 | |||
4018 | return 0; | ||
4019 | @@ -904,10 +911,17 @@ static int rcsi2_phtw_write_mbps(struct rcar_csi2 *priv, unsigned int mbps, | ||
4020 | const struct rcsi2_mbps_reg *values, u16 code) | ||
4021 | { | ||
4022 | const struct rcsi2_mbps_reg *value; | ||
4023 | + const struct rcsi2_mbps_reg *prev_value = NULL; | ||
4024 | |||
4025 | - for (value = values; value->mbps; value++) | ||
4026 | + for (value = values; value->mbps; value++) { | ||
4027 | if (value->mbps >= mbps) | ||
4028 | break; | ||
4029 | + prev_value = value; | ||
4030 | + } | ||
4031 | + | ||
4032 | + if (prev_value && | ||
4033 | + ((mbps - prev_value->mbps) <= (value->mbps - mbps))) | ||
4034 | + value = prev_value; | ||
4035 | |||
4036 | if (!value->mbps) { | ||
4037 | dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); | ||
4038 | diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c | ||
4039 | index a972c0705ac79..76d39e2e87706 100644 | ||
4040 | --- a/drivers/media/radio/si470x/radio-si470x-i2c.c | ||
4041 | +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c | ||
4042 | @@ -368,7 +368,7 @@ static int si470x_i2c_probe(struct i2c_client *client) | ||
4043 | if (radio->hdl.error) { | ||
4044 | retval = radio->hdl.error; | ||
4045 | dev_err(&client->dev, "couldn't register control\n"); | ||
4046 | - goto err_dev; | ||
4047 | + goto err_all; | ||
4048 | } | ||
4049 | |||
4050 | /* video device initialization */ | ||
4051 | @@ -463,7 +463,6 @@ static int si470x_i2c_probe(struct i2c_client *client) | ||
4052 | return 0; | ||
4053 | err_all: | ||
4054 | v4l2_ctrl_handler_free(&radio->hdl); | ||
4055 | -err_dev: | ||
4056 | v4l2_device_unregister(&radio->v4l2_dev); | ||
4057 | err_initial: | ||
4058 | return retval; | ||
4059 | diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c | ||
4060 | index b981f7290c1b2..1e8276040ea5b 100644 | ||
4061 | --- a/drivers/media/rc/igorplugusb.c | ||
4062 | +++ b/drivers/media/rc/igorplugusb.c | ||
4063 | @@ -64,9 +64,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) | ||
4064 | if (start >= len) { | ||
4065 | dev_err(ir->dev, "receive overflow invalid: %u", overflow); | ||
4066 | } else { | ||
4067 | - if (overflow > 0) | ||
4068 | + if (overflow > 0) { | ||
4069 | dev_warn(ir->dev, "receive overflow, at least %u lost", | ||
4070 | overflow); | ||
4071 | + ir_raw_event_reset(ir->rc); | ||
4072 | + } | ||
4073 | |||
4074 | do { | ||
4075 | rawir.duration = ir->buf_in[i] * 85333; | ||
4076 | diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c | ||
4077 | index 31e56f4f34791..cfdd712e2adc3 100644 | ||
4078 | --- a/drivers/media/rc/mceusb.c | ||
4079 | +++ b/drivers/media/rc/mceusb.c | ||
4080 | @@ -1430,7 +1430,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) | ||
4081 | */ | ||
4082 | ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), | ||
4083 | USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, | ||
4084 | - data, USB_CTRL_MSG_SZ, HZ * 3); | ||
4085 | + data, USB_CTRL_MSG_SZ, 3000); | ||
4086 | dev_dbg(dev, "set address - ret = %d", ret); | ||
4087 | dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", | ||
4088 | data[0], data[1]); | ||
4089 | @@ -1438,20 +1438,20 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) | ||
4090 | /* set feature: bit rate 38400 bps */ | ||
4091 | ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), | ||
4092 | USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, | ||
4093 | - 0xc04e, 0x0000, NULL, 0, HZ * 3); | ||
4094 | + 0xc04e, 0x0000, NULL, 0, 3000); | ||
4095 | |||
4096 | dev_dbg(dev, "set feature - ret = %d", ret); | ||
4097 | |||
4098 | /* bRequest 4: set char length to 8 bits */ | ||
4099 | ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), | ||
4100 | 4, USB_TYPE_VENDOR, | ||
4101 | - 0x0808, 0x0000, NULL, 0, HZ * 3); | ||
4102 | + 0x0808, 0x0000, NULL, 0, 3000); | ||
4103 | dev_dbg(dev, "set char length - retB = %d", ret); | ||
4104 | |||
4105 | /* bRequest 2: set handshaking to use DTR/DSR */ | ||
4106 | ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), | ||
4107 | 2, USB_TYPE_VENDOR, | ||
4108 | - 0x0000, 0x0100, NULL, 0, HZ * 3); | ||
4109 | + 0x0000, 0x0100, NULL, 0, 3000); | ||
4110 | dev_dbg(dev, "set handshake - retC = %d", ret); | ||
4111 | |||
4112 | /* device resume */ | ||
4113 | diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c | ||
4114 | index aad9526f3754d..c392276610478 100644 | ||
4115 | --- a/drivers/media/rc/redrat3.c | ||
4116 | +++ b/drivers/media/rc/redrat3.c | ||
4117 | @@ -405,7 +405,7 @@ static int redrat3_send_cmd(int cmd, struct redrat3_dev *rr3) | ||
4118 | udev = rr3->udev; | ||
4119 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, | ||
4120 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
4121 | - 0x0000, 0x0000, data, sizeof(u8), HZ * 10); | ||
4122 | + 0x0000, 0x0000, data, sizeof(u8), 10000); | ||
4123 | |||
4124 | if (res < 0) { | ||
4125 | dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", | ||
4126 | @@ -481,7 +481,7 @@ static u32 redrat3_get_timeout(struct redrat3_dev *rr3) | ||
4127 | pipe = usb_rcvctrlpipe(rr3->udev, 0); | ||
4128 | ret = usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, | ||
4129 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
4130 | - RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); | ||
4131 | + RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); | ||
4132 | if (ret != len) | ||
4133 | dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); | ||
4134 | else { | ||
4135 | @@ -511,7 +511,7 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutns) | ||
4136 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, | ||
4137 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
4138 | RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), | ||
4139 | - HZ * 25); | ||
4140 | + 25000); | ||
4141 | dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", | ||
4142 | be32_to_cpu(*timeout), ret); | ||
4143 | |||
4144 | @@ -543,32 +543,32 @@ static void redrat3_reset(struct redrat3_dev *rr3) | ||
4145 | *val = 0x01; | ||
4146 | rc = usb_control_msg(udev, rxpipe, RR3_RESET, | ||
4147 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
4148 | - RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); | ||
4149 | + RR3_CPUCS_REG_ADDR, 0, val, len, 25000); | ||
4150 | dev_dbg(dev, "reset returned 0x%02x\n", rc); | ||
4151 | |||
4152 | *val = length_fuzz; | ||
4153 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | ||
4154 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
4155 | - RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); | ||
4156 | + RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); | ||
4157 | dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); | ||
4158 | |||
4159 | *val = (65536 - (minimum_pause * 2000)) / 256; | ||
4160 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | ||
4161 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
4162 | - RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); | ||
4163 | + RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); | ||
4164 | dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); | ||
4165 | |||
4166 | *val = periods_measure_carrier; | ||
4167 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | ||
4168 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
4169 | - RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); | ||
4170 | + RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); | ||
4171 | dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, | ||
4172 | rc); | ||
4173 | |||
4174 | *val = RR3_DRIVER_MAXLENS; | ||
4175 | rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, | ||
4176 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
4177 | - RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); | ||
4178 | + RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); | ||
4179 | dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); | ||
4180 | |||
4181 | kfree(val); | ||
4182 | @@ -586,7 +586,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) | ||
4183 | rc = usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), | ||
4184 | RR3_FW_VERSION, | ||
4185 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
4186 | - 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); | ||
4187 | + 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); | ||
4188 | |||
4189 | if (rc >= 0) | ||
4190 | dev_info(rr3->dev, "Firmware rev: %s", buffer); | ||
4191 | @@ -826,14 +826,14 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, | ||
4192 | |||
4193 | pipe = usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); | ||
4194 | ret = usb_bulk_msg(rr3->udev, pipe, irdata, | ||
4195 | - sendbuf_len, &ret_len, 10 * HZ); | ||
4196 | + sendbuf_len, &ret_len, 10000); | ||
4197 | dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); | ||
4198 | |||
4199 | /* now tell the hardware to transmit what we sent it */ | ||
4200 | pipe = usb_rcvctrlpipe(rr3->udev, 0); | ||
4201 | ret = usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, | ||
4202 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
4203 | - 0, 0, irdata, 2, HZ * 10); | ||
4204 | + 0, 0, irdata, 2, 10000); | ||
4205 | |||
4206 | if (ret < 0) | ||
4207 | dev_err(dev, "Error: control msg send failed, rc %d\n", ret); | ||
4208 | diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c | ||
4209 | index 78e6fd600d8ef..44247049a3190 100644 | ||
4210 | --- a/drivers/media/tuners/msi001.c | ||
4211 | +++ b/drivers/media/tuners/msi001.c | ||
4212 | @@ -442,6 +442,13 @@ static int msi001_probe(struct spi_device *spi) | ||
4213 | V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); | ||
4214 | dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, | ||
4215 | V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); | ||
4216 | + if (dev->hdl.error) { | ||
4217 | + ret = dev->hdl.error; | ||
4218 | + dev_err(&spi->dev, "Could not initialize controls\n"); | ||
4219 | + /* control init failed, free handler */ | ||
4220 | + goto err_ctrl_handler_free; | ||
4221 | + } | ||
4222 | + | ||
4223 | v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); | ||
4224 | dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, | ||
4225 | V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); | ||
4226 | diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c | ||
4227 | index a39e1966816bf..8db9f0eb98b52 100644 | ||
4228 | --- a/drivers/media/tuners/si2157.c | ||
4229 | +++ b/drivers/media/tuners/si2157.c | ||
4230 | @@ -80,7 +80,7 @@ static int si2157_init(struct dvb_frontend *fe) | ||
4231 | dev_dbg(&client->dev, "\n"); | ||
4232 | |||
4233 | /* Try to get Xtal trim property, to verify tuner still running */ | ||
4234 | - memcpy(cmd.args, "\x15\x00\x04\x02", 4); | ||
4235 | + memcpy(cmd.args, "\x15\x00\x02\x04", 4); | ||
4236 | cmd.wlen = 4; | ||
4237 | cmd.rlen = 4; | ||
4238 | ret = si2157_cmd_execute(client, &cmd); | ||
4239 | diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c | ||
4240 | index 198ddfb8d2b18..e51338d5eac0c 100644 | ||
4241 | --- a/drivers/media/usb/b2c2/flexcop-usb.c | ||
4242 | +++ b/drivers/media/usb/b2c2/flexcop-usb.c | ||
4243 | @@ -87,7 +87,7 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI, | ||
4244 | 0, | ||
4245 | fc_usb->data, | ||
4246 | sizeof(u32), | ||
4247 | - B2C2_WAIT_FOR_OPERATION_RDW * HZ); | ||
4248 | + B2C2_WAIT_FOR_OPERATION_RDW); | ||
4249 | |||
4250 | if (ret != sizeof(u32)) { | ||
4251 | err("error while %s dword from %d (%d).", read ? "reading" : | ||
4252 | @@ -155,7 +155,7 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, | ||
4253 | wIndex, | ||
4254 | fc_usb->data, | ||
4255 | buflen, | ||
4256 | - nWaitTime * HZ); | ||
4257 | + nWaitTime); | ||
4258 | if (ret != buflen) | ||
4259 | ret = -EIO; | ||
4260 | |||
4261 | @@ -249,13 +249,13 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, | ||
4262 | /* DKT 020208 - add this to support special case of DiSEqC */ | ||
4263 | case USB_FUNC_I2C_CHECKWRITE: | ||
4264 | pipe = B2C2_USB_CTRL_PIPE_OUT; | ||
4265 | - nWaitTime = 2; | ||
4266 | + nWaitTime = 2000; | ||
4267 | request_type |= USB_DIR_OUT; | ||
4268 | break; | ||
4269 | case USB_FUNC_I2C_READ: | ||
4270 | case USB_FUNC_I2C_REPEATREAD: | ||
4271 | pipe = B2C2_USB_CTRL_PIPE_IN; | ||
4272 | - nWaitTime = 2; | ||
4273 | + nWaitTime = 2000; | ||
4274 | request_type |= USB_DIR_IN; | ||
4275 | break; | ||
4276 | default: | ||
4277 | @@ -282,7 +282,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, | ||
4278 | wIndex, | ||
4279 | fc_usb->data, | ||
4280 | buflen, | ||
4281 | - nWaitTime * HZ); | ||
4282 | + nWaitTime); | ||
4283 | |||
4284 | if (ret != buflen) | ||
4285 | ret = -EIO; | ||
4286 | diff --git a/drivers/media/usb/b2c2/flexcop-usb.h b/drivers/media/usb/b2c2/flexcop-usb.h | ||
4287 | index e86faa0e06ca6..3dfd25fa4750f 100644 | ||
4288 | --- a/drivers/media/usb/b2c2/flexcop-usb.h | ||
4289 | +++ b/drivers/media/usb/b2c2/flexcop-usb.h | ||
4290 | @@ -91,13 +91,13 @@ typedef enum { | ||
4291 | UTILITY_SRAM_TESTVERIFY = 0x16, | ||
4292 | } flexcop_usb_utility_function_t; | ||
4293 | |||
4294 | -#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) | ||
4295 | -#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) | ||
4296 | -#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) | ||
4297 | +#define B2C2_WAIT_FOR_OPERATION_RW 1000 | ||
4298 | +#define B2C2_WAIT_FOR_OPERATION_RDW 3000 | ||
4299 | +#define B2C2_WAIT_FOR_OPERATION_WDW 1000 | ||
4300 | |||
4301 | -#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) | ||
4302 | -#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) | ||
4303 | -#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) | ||
4304 | +#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 | ||
4305 | +#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 | ||
4306 | +#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 | ||
4307 | |||
4308 | typedef enum { | ||
4309 | V8_MEMORY_PAGE_DVB_CI = 0x20, | ||
4310 | diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c | ||
4311 | index 76aac06f9fb8e..cba03b2864738 100644 | ||
4312 | --- a/drivers/media/usb/cpia2/cpia2_usb.c | ||
4313 | +++ b/drivers/media/usb/cpia2/cpia2_usb.c | ||
4314 | @@ -550,7 +550,7 @@ static int write_packet(struct usb_device *udev, | ||
4315 | 0, /* index */ | ||
4316 | buf, /* buffer */ | ||
4317 | size, | ||
4318 | - HZ); | ||
4319 | + 1000); | ||
4320 | |||
4321 | kfree(buf); | ||
4322 | return ret; | ||
4323 | @@ -582,7 +582,7 @@ static int read_packet(struct usb_device *udev, | ||
4324 | 0, /* index */ | ||
4325 | buf, /* buffer */ | ||
4326 | size, | ||
4327 | - HZ); | ||
4328 | + 1000); | ||
4329 | |||
4330 | if (ret >= 0) | ||
4331 | memcpy(registers, buf, size); | ||
4332 | diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c | ||
4333 | index ef62dd6c5ae44..07d5e94578775 100644 | ||
4334 | --- a/drivers/media/usb/dvb-usb/dib0700_core.c | ||
4335 | +++ b/drivers/media/usb/dvb-usb/dib0700_core.c | ||
4336 | @@ -616,8 +616,6 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | ||
4337 | deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); | ||
4338 | if (onoff) | ||
4339 | st->channel_state |= 1 << (adap->id); | ||
4340 | - else | ||
4341 | - st->channel_state |= 1 << ~(adap->id); | ||
4342 | } else { | ||
4343 | if (onoff) | ||
4344 | st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); | ||
4345 | diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c | ||
4346 | index b960abd00d483..8493ebb377c4d 100644 | ||
4347 | --- a/drivers/media/usb/dvb-usb/dw2102.c | ||
4348 | +++ b/drivers/media/usb/dvb-usb/dw2102.c | ||
4349 | @@ -2098,46 +2098,153 @@ static struct dvb_usb_device_properties s6x0_properties = { | ||
4350 | } | ||
4351 | }; | ||
4352 | |||
4353 | -static const struct dvb_usb_device_description d1100 = { | ||
4354 | - "Prof 1100 USB ", | ||
4355 | - {&dw2102_table[PROF_1100], NULL}, | ||
4356 | - {NULL}, | ||
4357 | -}; | ||
4358 | +static struct dvb_usb_device_properties p1100_properties = { | ||
4359 | + .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
4360 | + .usb_ctrl = DEVICE_SPECIFIC, | ||
4361 | + .size_of_priv = sizeof(struct dw2102_state), | ||
4362 | + .firmware = P1100_FIRMWARE, | ||
4363 | + .no_reconnect = 1, | ||
4364 | |||
4365 | -static const struct dvb_usb_device_description d660 = { | ||
4366 | - "TeVii S660 USB", | ||
4367 | - {&dw2102_table[TEVII_S660], NULL}, | ||
4368 | - {NULL}, | ||
4369 | -}; | ||
4370 | + .i2c_algo = &s6x0_i2c_algo, | ||
4371 | + .rc.core = { | ||
4372 | + .rc_interval = 150, | ||
4373 | + .rc_codes = RC_MAP_TBS_NEC, | ||
4374 | + .module_name = "dw2102", | ||
4375 | + .allowed_protos = RC_PROTO_BIT_NEC, | ||
4376 | + .rc_query = prof_rc_query, | ||
4377 | + }, | ||
4378 | |||
4379 | -static const struct dvb_usb_device_description d480_1 = { | ||
4380 | - "TeVii S480.1 USB", | ||
4381 | - {&dw2102_table[TEVII_S480_1], NULL}, | ||
4382 | - {NULL}, | ||
4383 | + .generic_bulk_ctrl_endpoint = 0x81, | ||
4384 | + .num_adapters = 1, | ||
4385 | + .download_firmware = dw2102_load_firmware, | ||
4386 | + .read_mac_address = s6x0_read_mac_address, | ||
4387 | + .adapter = { | ||
4388 | + { | ||
4389 | + .num_frontends = 1, | ||
4390 | + .fe = {{ | ||
4391 | + .frontend_attach = stv0288_frontend_attach, | ||
4392 | + .stream = { | ||
4393 | + .type = USB_BULK, | ||
4394 | + .count = 8, | ||
4395 | + .endpoint = 0x82, | ||
4396 | + .u = { | ||
4397 | + .bulk = { | ||
4398 | + .buffersize = 4096, | ||
4399 | + } | ||
4400 | + } | ||
4401 | + }, | ||
4402 | + } }, | ||
4403 | + } | ||
4404 | + }, | ||
4405 | + .num_device_descs = 1, | ||
4406 | + .devices = { | ||
4407 | + {"Prof 1100 USB ", | ||
4408 | + {&dw2102_table[PROF_1100], NULL}, | ||
4409 | + {NULL}, | ||
4410 | + }, | ||
4411 | + } | ||
4412 | }; | ||
4413 | |||
4414 | -static const struct dvb_usb_device_description d480_2 = { | ||
4415 | - "TeVii S480.2 USB", | ||
4416 | - {&dw2102_table[TEVII_S480_2], NULL}, | ||
4417 | - {NULL}, | ||
4418 | -}; | ||
4419 | +static struct dvb_usb_device_properties s660_properties = { | ||
4420 | + .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
4421 | + .usb_ctrl = DEVICE_SPECIFIC, | ||
4422 | + .size_of_priv = sizeof(struct dw2102_state), | ||
4423 | + .firmware = S660_FIRMWARE, | ||
4424 | + .no_reconnect = 1, | ||
4425 | |||
4426 | -static const struct dvb_usb_device_description d7500 = { | ||
4427 | - "Prof 7500 USB DVB-S2", | ||
4428 | - {&dw2102_table[PROF_7500], NULL}, | ||
4429 | - {NULL}, | ||
4430 | -}; | ||
4431 | + .i2c_algo = &s6x0_i2c_algo, | ||
4432 | + .rc.core = { | ||
4433 | + .rc_interval = 150, | ||
4434 | + .rc_codes = RC_MAP_TEVII_NEC, | ||
4435 | + .module_name = "dw2102", | ||
4436 | + .allowed_protos = RC_PROTO_BIT_NEC, | ||
4437 | + .rc_query = dw2102_rc_query, | ||
4438 | + }, | ||
4439 | |||
4440 | -static const struct dvb_usb_device_description d421 = { | ||
4441 | - "TeVii S421 PCI", | ||
4442 | - {&dw2102_table[TEVII_S421], NULL}, | ||
4443 | - {NULL}, | ||
4444 | + .generic_bulk_ctrl_endpoint = 0x81, | ||
4445 | + .num_adapters = 1, | ||
4446 | + .download_firmware = dw2102_load_firmware, | ||
4447 | + .read_mac_address = s6x0_read_mac_address, | ||
4448 | + .adapter = { | ||
4449 | + { | ||
4450 | + .num_frontends = 1, | ||
4451 | + .fe = {{ | ||
4452 | + .frontend_attach = ds3000_frontend_attach, | ||
4453 | + .stream = { | ||
4454 | + .type = USB_BULK, | ||
4455 | + .count = 8, | ||
4456 | + .endpoint = 0x82, | ||
4457 | + .u = { | ||
4458 | + .bulk = { | ||
4459 | + .buffersize = 4096, | ||
4460 | + } | ||
4461 | + } | ||
4462 | + }, | ||
4463 | + } }, | ||
4464 | + } | ||
4465 | + }, | ||
4466 | + .num_device_descs = 3, | ||
4467 | + .devices = { | ||
4468 | + {"TeVii S660 USB", | ||
4469 | + {&dw2102_table[TEVII_S660], NULL}, | ||
4470 | + {NULL}, | ||
4471 | + }, | ||
4472 | + {"TeVii S480.1 USB", | ||
4473 | + {&dw2102_table[TEVII_S480_1], NULL}, | ||
4474 | + {NULL}, | ||
4475 | + }, | ||
4476 | + {"TeVii S480.2 USB", | ||
4477 | + {&dw2102_table[TEVII_S480_2], NULL}, | ||
4478 | + {NULL}, | ||
4479 | + }, | ||
4480 | + } | ||
4481 | }; | ||
4482 | |||
4483 | -static const struct dvb_usb_device_description d632 = { | ||
4484 | - "TeVii S632 USB", | ||
4485 | - {&dw2102_table[TEVII_S632], NULL}, | ||
4486 | - {NULL}, | ||
4487 | +static struct dvb_usb_device_properties p7500_properties = { | ||
4488 | + .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
4489 | + .usb_ctrl = DEVICE_SPECIFIC, | ||
4490 | + .size_of_priv = sizeof(struct dw2102_state), | ||
4491 | + .firmware = P7500_FIRMWARE, | ||
4492 | + .no_reconnect = 1, | ||
4493 | + | ||
4494 | + .i2c_algo = &s6x0_i2c_algo, | ||
4495 | + .rc.core = { | ||
4496 | + .rc_interval = 150, | ||
4497 | + .rc_codes = RC_MAP_TBS_NEC, | ||
4498 | + .module_name = "dw2102", | ||
4499 | + .allowed_protos = RC_PROTO_BIT_NEC, | ||
4500 | + .rc_query = prof_rc_query, | ||
4501 | + }, | ||
4502 | + | ||
4503 | + .generic_bulk_ctrl_endpoint = 0x81, | ||
4504 | + .num_adapters = 1, | ||
4505 | + .download_firmware = dw2102_load_firmware, | ||
4506 | + .read_mac_address = s6x0_read_mac_address, | ||
4507 | + .adapter = { | ||
4508 | + { | ||
4509 | + .num_frontends = 1, | ||
4510 | + .fe = {{ | ||
4511 | + .frontend_attach = prof_7500_frontend_attach, | ||
4512 | + .stream = { | ||
4513 | + .type = USB_BULK, | ||
4514 | + .count = 8, | ||
4515 | + .endpoint = 0x82, | ||
4516 | + .u = { | ||
4517 | + .bulk = { | ||
4518 | + .buffersize = 4096, | ||
4519 | + } | ||
4520 | + } | ||
4521 | + }, | ||
4522 | + } }, | ||
4523 | + } | ||
4524 | + }, | ||
4525 | + .num_device_descs = 1, | ||
4526 | + .devices = { | ||
4527 | + {"Prof 7500 USB DVB-S2", | ||
4528 | + {&dw2102_table[PROF_7500], NULL}, | ||
4529 | + {NULL}, | ||
4530 | + }, | ||
4531 | + } | ||
4532 | }; | ||
4533 | |||
4534 | static struct dvb_usb_device_properties su3000_properties = { | ||
4535 | @@ -2209,6 +2316,59 @@ static struct dvb_usb_device_properties su3000_properties = { | ||
4536 | } | ||
4537 | }; | ||
4538 | |||
4539 | +static struct dvb_usb_device_properties s421_properties = { | ||
4540 | + .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
4541 | + .usb_ctrl = DEVICE_SPECIFIC, | ||
4542 | + .size_of_priv = sizeof(struct dw2102_state), | ||
4543 | + .power_ctrl = su3000_power_ctrl, | ||
4544 | + .num_adapters = 1, | ||
4545 | + .identify_state = su3000_identify_state, | ||
4546 | + .i2c_algo = &su3000_i2c_algo, | ||
4547 | + | ||
4548 | + .rc.core = { | ||
4549 | + .rc_interval = 150, | ||
4550 | + .rc_codes = RC_MAP_SU3000, | ||
4551 | + .module_name = "dw2102", | ||
4552 | + .allowed_protos = RC_PROTO_BIT_RC5, | ||
4553 | + .rc_query = su3000_rc_query, | ||
4554 | + }, | ||
4555 | + | ||
4556 | + .read_mac_address = su3000_read_mac_address, | ||
4557 | + | ||
4558 | + .generic_bulk_ctrl_endpoint = 0x01, | ||
4559 | + | ||
4560 | + .adapter = { | ||
4561 | + { | ||
4562 | + .num_frontends = 1, | ||
4563 | + .fe = {{ | ||
4564 | + .streaming_ctrl = su3000_streaming_ctrl, | ||
4565 | + .frontend_attach = m88rs2000_frontend_attach, | ||
4566 | + .stream = { | ||
4567 | + .type = USB_BULK, | ||
4568 | + .count = 8, | ||
4569 | + .endpoint = 0x82, | ||
4570 | + .u = { | ||
4571 | + .bulk = { | ||
4572 | + .buffersize = 4096, | ||
4573 | + } | ||
4574 | + } | ||
4575 | + } | ||
4576 | + } }, | ||
4577 | + } | ||
4578 | + }, | ||
4579 | + .num_device_descs = 2, | ||
4580 | + .devices = { | ||
4581 | + { "TeVii S421 PCI", | ||
4582 | + { &dw2102_table[TEVII_S421], NULL }, | ||
4583 | + { NULL }, | ||
4584 | + }, | ||
4585 | + { "TeVii S632 USB", | ||
4586 | + { &dw2102_table[TEVII_S632], NULL }, | ||
4587 | + { NULL }, | ||
4588 | + }, | ||
4589 | + } | ||
4590 | +}; | ||
4591 | + | ||
4592 | static struct dvb_usb_device_properties t220_properties = { | ||
4593 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
4594 | .usb_ctrl = DEVICE_SPECIFIC, | ||
4595 | @@ -2326,101 +2486,33 @@ static struct dvb_usb_device_properties tt_s2_4600_properties = { | ||
4596 | static int dw2102_probe(struct usb_interface *intf, | ||
4597 | const struct usb_device_id *id) | ||
4598 | { | ||
4599 | - int retval = -ENOMEM; | ||
4600 | - struct dvb_usb_device_properties *p1100; | ||
4601 | - struct dvb_usb_device_properties *s660; | ||
4602 | - struct dvb_usb_device_properties *p7500; | ||
4603 | - struct dvb_usb_device_properties *s421; | ||
4604 | - | ||
4605 | - p1100 = kmemdup(&s6x0_properties, | ||
4606 | - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
4607 | - if (!p1100) | ||
4608 | - goto err0; | ||
4609 | - | ||
4610 | - /* copy default structure */ | ||
4611 | - /* fill only different fields */ | ||
4612 | - p1100->firmware = P1100_FIRMWARE; | ||
4613 | - p1100->devices[0] = d1100; | ||
4614 | - p1100->rc.core.rc_query = prof_rc_query; | ||
4615 | - p1100->rc.core.rc_codes = RC_MAP_TBS_NEC; | ||
4616 | - p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach; | ||
4617 | - | ||
4618 | - s660 = kmemdup(&s6x0_properties, | ||
4619 | - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
4620 | - if (!s660) | ||
4621 | - goto err1; | ||
4622 | - | ||
4623 | - s660->firmware = S660_FIRMWARE; | ||
4624 | - s660->num_device_descs = 3; | ||
4625 | - s660->devices[0] = d660; | ||
4626 | - s660->devices[1] = d480_1; | ||
4627 | - s660->devices[2] = d480_2; | ||
4628 | - s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach; | ||
4629 | - | ||
4630 | - p7500 = kmemdup(&s6x0_properties, | ||
4631 | - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
4632 | - if (!p7500) | ||
4633 | - goto err2; | ||
4634 | - | ||
4635 | - p7500->firmware = P7500_FIRMWARE; | ||
4636 | - p7500->devices[0] = d7500; | ||
4637 | - p7500->rc.core.rc_query = prof_rc_query; | ||
4638 | - p7500->rc.core.rc_codes = RC_MAP_TBS_NEC; | ||
4639 | - p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach; | ||
4640 | - | ||
4641 | - | ||
4642 | - s421 = kmemdup(&su3000_properties, | ||
4643 | - sizeof(struct dvb_usb_device_properties), GFP_KERNEL); | ||
4644 | - if (!s421) | ||
4645 | - goto err3; | ||
4646 | - | ||
4647 | - s421->num_device_descs = 2; | ||
4648 | - s421->devices[0] = d421; | ||
4649 | - s421->devices[1] = d632; | ||
4650 | - s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach; | ||
4651 | - | ||
4652 | - if (0 == dvb_usb_device_init(intf, &dw2102_properties, | ||
4653 | - THIS_MODULE, NULL, adapter_nr) || | ||
4654 | - 0 == dvb_usb_device_init(intf, &dw2104_properties, | ||
4655 | - THIS_MODULE, NULL, adapter_nr) || | ||
4656 | - 0 == dvb_usb_device_init(intf, &dw3101_properties, | ||
4657 | - THIS_MODULE, NULL, adapter_nr) || | ||
4658 | - 0 == dvb_usb_device_init(intf, &s6x0_properties, | ||
4659 | - THIS_MODULE, NULL, adapter_nr) || | ||
4660 | - 0 == dvb_usb_device_init(intf, p1100, | ||
4661 | - THIS_MODULE, NULL, adapter_nr) || | ||
4662 | - 0 == dvb_usb_device_init(intf, s660, | ||
4663 | - THIS_MODULE, NULL, adapter_nr) || | ||
4664 | - 0 == dvb_usb_device_init(intf, p7500, | ||
4665 | - THIS_MODULE, NULL, adapter_nr) || | ||
4666 | - 0 == dvb_usb_device_init(intf, s421, | ||
4667 | - THIS_MODULE, NULL, adapter_nr) || | ||
4668 | - 0 == dvb_usb_device_init(intf, &su3000_properties, | ||
4669 | - THIS_MODULE, NULL, adapter_nr) || | ||
4670 | - 0 == dvb_usb_device_init(intf, &t220_properties, | ||
4671 | - THIS_MODULE, NULL, adapter_nr) || | ||
4672 | - 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, | ||
4673 | - THIS_MODULE, NULL, adapter_nr)) { | ||
4674 | - | ||
4675 | - /* clean up copied properties */ | ||
4676 | - kfree(s421); | ||
4677 | - kfree(p7500); | ||
4678 | - kfree(s660); | ||
4679 | - kfree(p1100); | ||
4680 | + if (!(dvb_usb_device_init(intf, &dw2102_properties, | ||
4681 | + THIS_MODULE, NULL, adapter_nr) && | ||
4682 | + dvb_usb_device_init(intf, &dw2104_properties, | ||
4683 | + THIS_MODULE, NULL, adapter_nr) && | ||
4684 | + dvb_usb_device_init(intf, &dw3101_properties, | ||
4685 | + THIS_MODULE, NULL, adapter_nr) && | ||
4686 | + dvb_usb_device_init(intf, &s6x0_properties, | ||
4687 | + THIS_MODULE, NULL, adapter_nr) && | ||
4688 | + dvb_usb_device_init(intf, &p1100_properties, | ||
4689 | + THIS_MODULE, NULL, adapter_nr) && | ||
4690 | + dvb_usb_device_init(intf, &s660_properties, | ||
4691 | + THIS_MODULE, NULL, adapter_nr) && | ||
4692 | + dvb_usb_device_init(intf, &p7500_properties, | ||
4693 | + THIS_MODULE, NULL, adapter_nr) && | ||
4694 | + dvb_usb_device_init(intf, &s421_properties, | ||
4695 | + THIS_MODULE, NULL, adapter_nr) && | ||
4696 | + dvb_usb_device_init(intf, &su3000_properties, | ||
4697 | + THIS_MODULE, NULL, adapter_nr) && | ||
4698 | + dvb_usb_device_init(intf, &t220_properties, | ||
4699 | + THIS_MODULE, NULL, adapter_nr) && | ||
4700 | + dvb_usb_device_init(intf, &tt_s2_4600_properties, | ||
4701 | + THIS_MODULE, NULL, adapter_nr))) { | ||
4702 | |||
4703 | return 0; | ||
4704 | } | ||
4705 | |||
4706 | - retval = -ENODEV; | ||
4707 | - kfree(s421); | ||
4708 | -err3: | ||
4709 | - kfree(p7500); | ||
4710 | -err2: | ||
4711 | - kfree(s660); | ||
4712 | -err1: | ||
4713 | - kfree(p1100); | ||
4714 | -err0: | ||
4715 | - return retval; | ||
4716 | + return -ENODEV; | ||
4717 | } | ||
4718 | |||
4719 | static void dw2102_disconnect(struct usb_interface *intf) | ||
4720 | diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c | ||
4721 | index d866a1990a7d2..7282f60226558 100644 | ||
4722 | --- a/drivers/media/usb/dvb-usb/m920x.c | ||
4723 | +++ b/drivers/media/usb/dvb-usb/m920x.c | ||
4724 | @@ -274,6 +274,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu | ||
4725 | /* Should check for ack here, if we knew how. */ | ||
4726 | } | ||
4727 | if (msg[i].flags & I2C_M_RD) { | ||
4728 | + char *read = kmalloc(1, GFP_KERNEL); | ||
4729 | + if (!read) { | ||
4730 | + ret = -ENOMEM; | ||
4731 | + kfree(read); | ||
4732 | + goto unlock; | ||
4733 | + } | ||
4734 | + | ||
4735 | for (j = 0; j < msg[i].len; j++) { | ||
4736 | /* Last byte of transaction? | ||
4737 | * Send STOP, otherwise send ACK. */ | ||
4738 | @@ -281,9 +288,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu | ||
4739 | |||
4740 | if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, | ||
4741 | 0x20 | stop, | ||
4742 | - &msg[i].buf[j], 1)) != 0) | ||
4743 | + read, 1)) != 0) | ||
4744 | goto unlock; | ||
4745 | + msg[i].buf[j] = read[0]; | ||
4746 | } | ||
4747 | + | ||
4748 | + kfree(read); | ||
4749 | } else { | ||
4750 | for (j = 0; j < msg[i].len; j++) { | ||
4751 | /* Last byte of transaction? Then send STOP. */ | ||
4752 | diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c | ||
4753 | index 3e96b4b711d75..bfca9d0a1fe15 100644 | ||
4754 | --- a/drivers/media/usb/em28xx/em28xx-cards.c | ||
4755 | +++ b/drivers/media/usb/em28xx/em28xx-cards.c | ||
4756 | @@ -3515,8 +3515,10 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, | ||
4757 | |||
4758 | if (dev->is_audio_only) { | ||
4759 | retval = em28xx_audio_setup(dev); | ||
4760 | - if (retval) | ||
4761 | - return -ENODEV; | ||
4762 | + if (retval) { | ||
4763 | + retval = -ENODEV; | ||
4764 | + goto err_deinit_media; | ||
4765 | + } | ||
4766 | em28xx_init_extension(dev); | ||
4767 | |||
4768 | return 0; | ||
4769 | @@ -3535,7 +3537,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, | ||
4770 | dev_err(&dev->intf->dev, | ||
4771 | "%s: em28xx_i2c_register bus 0 - error [%d]!\n", | ||
4772 | __func__, retval); | ||
4773 | - return retval; | ||
4774 | + goto err_deinit_media; | ||
4775 | } | ||
4776 | |||
4777 | /* register i2c bus 1 */ | ||
4778 | @@ -3551,9 +3553,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, | ||
4779 | "%s: em28xx_i2c_register bus 1 - error [%d]!\n", | ||
4780 | __func__, retval); | ||
4781 | |||
4782 | - em28xx_i2c_unregister(dev, 0); | ||
4783 | - | ||
4784 | - return retval; | ||
4785 | + goto err_unreg_i2c; | ||
4786 | } | ||
4787 | } | ||
4788 | |||
4789 | @@ -3561,6 +3561,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, | ||
4790 | em28xx_card_setup(dev); | ||
4791 | |||
4792 | return 0; | ||
4793 | + | ||
4794 | +err_unreg_i2c: | ||
4795 | + em28xx_i2c_unregister(dev, 0); | ||
4796 | +err_deinit_media: | ||
4797 | + em28xx_unregister_media_device(dev); | ||
4798 | + return retval; | ||
4799 | } | ||
4800 | |||
4801 | static int em28xx_duplicate_dev(struct em28xx *dev) | ||
4802 | diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c | ||
4803 | index af9216278024f..308bc029099d9 100644 | ||
4804 | --- a/drivers/media/usb/em28xx/em28xx-core.c | ||
4805 | +++ b/drivers/media/usb/em28xx/em28xx-core.c | ||
4806 | @@ -89,7 +89,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, | ||
4807 | mutex_lock(&dev->ctrl_urb_lock); | ||
4808 | ret = usb_control_msg(udev, pipe, req, | ||
4809 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
4810 | - 0x0000, reg, dev->urb_buf, len, HZ); | ||
4811 | + 0x0000, reg, dev->urb_buf, len, 1000); | ||
4812 | if (ret < 0) { | ||
4813 | em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %02x failed with error %i\n", | ||
4814 | pipe, | ||
4815 | @@ -158,7 +158,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, | ||
4816 | memcpy(dev->urb_buf, buf, len); | ||
4817 | ret = usb_control_msg(udev, pipe, req, | ||
4818 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
4819 | - 0x0000, reg, dev->urb_buf, len, HZ); | ||
4820 | + 0x0000, reg, dev->urb_buf, len, 1000); | ||
4821 | mutex_unlock(&dev->ctrl_urb_lock); | ||
4822 | |||
4823 | if (ret < 0) { | ||
4824 | diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c | ||
4825 | index 4c991eae53cdf..2f00679f65a0a 100644 | ||
4826 | --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c | ||
4827 | +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c | ||
4828 | @@ -1468,7 +1468,7 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | ||
4829 | for (address = 0; address < fwsize; address += 0x800) { | ||
4830 | memcpy(fw_ptr, fw_entry->data + address, 0x800); | ||
4831 | ret += usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, | ||
4832 | - 0, fw_ptr, 0x800, HZ); | ||
4833 | + 0, fw_ptr, 0x800, 1000); | ||
4834 | } | ||
4835 | |||
4836 | trace_firmware("Upload done, releasing device's CPU"); | ||
4837 | @@ -1606,7 +1606,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | ||
4838 | ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); | ||
4839 | |||
4840 | ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, | ||
4841 | - &actual_length, HZ); | ||
4842 | + &actual_length, 1000); | ||
4843 | ret |= (actual_length != bcnt); | ||
4844 | if (ret) break; | ||
4845 | fw_done += bcnt; | ||
4846 | @@ -3439,7 +3439,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, | ||
4847 | 0xa0,0xc0, | ||
4848 | address,0, | ||
4849 | hdw->fw_buffer+address, | ||
4850 | - 0x800,HZ); | ||
4851 | + 0x800,1000); | ||
4852 | if (ret < 0) break; | ||
4853 | } | ||
4854 | |||
4855 | @@ -3978,7 +3978,7 @@ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val) | ||
4856 | /* Write the CPUCS register on the 8051. The lsb of the register | ||
4857 | is the reset bit; a 1 asserts reset while a 0 clears it. */ | ||
4858 | pipe = usb_sndctrlpipe(hdw->usb_dev, 0); | ||
4859 | - ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); | ||
4860 | + ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); | ||
4861 | if (ret < 0) { | ||
4862 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | ||
4863 | "cpureset_assert(%d) error=%d",val,ret); | ||
4864 | diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c | ||
4865 | index 329ec80895927..7ed526306816a 100644 | ||
4866 | --- a/drivers/media/usb/s2255/s2255drv.c | ||
4867 | +++ b/drivers/media/usb/s2255/s2255drv.c | ||
4868 | @@ -1884,7 +1884,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, | ||
4869 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | | ||
4870 | USB_DIR_IN, | ||
4871 | Value, Index, buf, | ||
4872 | - TransferBufferLength, HZ * 5); | ||
4873 | + TransferBufferLength, USB_CTRL_SET_TIMEOUT); | ||
4874 | |||
4875 | if (r >= 0) | ||
4876 | memcpy(TransferBuffer, buf, TransferBufferLength); | ||
4877 | @@ -1893,7 +1893,7 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, | ||
4878 | r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | ||
4879 | Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
4880 | Value, Index, buf, | ||
4881 | - TransferBufferLength, HZ * 5); | ||
4882 | + TransferBufferLength, USB_CTRL_SET_TIMEOUT); | ||
4883 | } | ||
4884 | kfree(buf); | ||
4885 | return r; | ||
4886 | diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c | ||
4887 | index b4f8bc5db1389..4e1698f788187 100644 | ||
4888 | --- a/drivers/media/usb/stk1160/stk1160-core.c | ||
4889 | +++ b/drivers/media/usb/stk1160/stk1160-core.c | ||
4890 | @@ -65,7 +65,7 @@ int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value) | ||
4891 | return -ENOMEM; | ||
4892 | ret = usb_control_msg(dev->udev, pipe, 0x00, | ||
4893 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
4894 | - 0x00, reg, buf, sizeof(u8), HZ); | ||
4895 | + 0x00, reg, buf, sizeof(u8), 1000); | ||
4896 | if (ret < 0) { | ||
4897 | stk1160_err("read failed on reg 0x%x (%d)\n", | ||
4898 | reg, ret); | ||
4899 | @@ -85,7 +85,7 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value) | ||
4900 | |||
4901 | ret = usb_control_msg(dev->udev, pipe, 0x01, | ||
4902 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
4903 | - value, reg, NULL, 0, HZ); | ||
4904 | + value, reg, NULL, 0, 1000); | ||
4905 | if (ret < 0) { | ||
4906 | stk1160_err("write failed on reg 0x%x (%d)\n", | ||
4907 | reg, ret); | ||
4908 | diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h | ||
4909 | index 24e3d8c647e77..5f137400bebd6 100644 | ||
4910 | --- a/drivers/media/usb/uvc/uvcvideo.h | ||
4911 | +++ b/drivers/media/usb/uvc/uvcvideo.h | ||
4912 | @@ -179,7 +179,7 @@ | ||
4913 | /* Maximum status buffer size in bytes of interrupt URB. */ | ||
4914 | #define UVC_MAX_STATUS_SIZE 16 | ||
4915 | |||
4916 | -#define UVC_CTRL_CONTROL_TIMEOUT 500 | ||
4917 | +#define UVC_CTRL_CONTROL_TIMEOUT 5000 | ||
4918 | #define UVC_CTRL_STREAMING_TIMEOUT 5000 | ||
4919 | |||
4920 | /* Maximum allowed number of control mappings per device */ | ||
4921 | diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c | ||
4922 | index 98633fa5d46fd..3012e8ecffb94 100644 | ||
4923 | --- a/drivers/media/v4l2-core/v4l2-ioctl.c | ||
4924 | +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | ||
4925 | @@ -2046,6 +2046,7 @@ static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops, | ||
4926 | static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, | ||
4927 | struct file *file, void *fh, void *arg) | ||
4928 | { | ||
4929 | + struct video_device *vfd = video_devdata(file); | ||
4930 | struct v4l2_streamparm *p = arg; | ||
4931 | v4l2_std_id std; | ||
4932 | int ret = check_fmt(file, p->type); | ||
4933 | @@ -2057,7 +2058,8 @@ static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, | ||
4934 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && | ||
4935 | p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
4936 | return -EINVAL; | ||
4937 | - p->parm.capture.readbuffers = 2; | ||
4938 | + if (vfd->device_caps & V4L2_CAP_READWRITE) | ||
4939 | + p->parm.capture.readbuffers = 2; | ||
4940 | ret = ops->vidioc_g_std(file, fh, &std); | ||
4941 | if (ret == 0) | ||
4942 | v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); | ||
4943 | diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c | ||
4944 | index 884485c3f7232..3a0d2b052ed29 100644 | ||
4945 | --- a/drivers/misc/lattice-ecp3-config.c | ||
4946 | +++ b/drivers/misc/lattice-ecp3-config.c | ||
4947 | @@ -77,12 +77,12 @@ static void firmware_load(const struct firmware *fw, void *context) | ||
4948 | |||
4949 | if (fw == NULL) { | ||
4950 | dev_err(&spi->dev, "Cannot load firmware, aborting\n"); | ||
4951 | - return; | ||
4952 | + goto out; | ||
4953 | } | ||
4954 | |||
4955 | if (fw->size == 0) { | ||
4956 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); | ||
4957 | - return; | ||
4958 | + goto out; | ||
4959 | } | ||
4960 | |||
4961 | /* Fill dummy data (24 stuffing bits for commands) */ | ||
4962 | @@ -104,7 +104,7 @@ static void firmware_load(const struct firmware *fw, void *context) | ||
4963 | dev_err(&spi->dev, | ||
4964 | "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", | ||
4965 | jedec_id); | ||
4966 | - return; | ||
4967 | + goto out; | ||
4968 | } | ||
4969 | |||
4970 | dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); | ||
4971 | @@ -117,7 +117,7 @@ static void firmware_load(const struct firmware *fw, void *context) | ||
4972 | buffer = kzalloc(fw->size + 8, GFP_KERNEL); | ||
4973 | if (!buffer) { | ||
4974 | dev_err(&spi->dev, "Error: Can't allocate memory!\n"); | ||
4975 | - return; | ||
4976 | + goto out; | ||
4977 | } | ||
4978 | |||
4979 | /* | ||
4980 | @@ -156,7 +156,7 @@ static void firmware_load(const struct firmware *fw, void *context) | ||
4981 | "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", | ||
4982 | status); | ||
4983 | kfree(buffer); | ||
4984 | - return; | ||
4985 | + goto out; | ||
4986 | } | ||
4987 | |||
4988 | dev_info(&spi->dev, "Configuring the FPGA...\n"); | ||
4989 | @@ -182,7 +182,7 @@ static void firmware_load(const struct firmware *fw, void *context) | ||
4990 | release_firmware(fw); | ||
4991 | |||
4992 | kfree(buffer); | ||
4993 | - | ||
4994 | +out: | ||
4995 | complete(&data->fw_loaded); | ||
4996 | } | ||
4997 | |||
4998 | diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile | ||
4999 | index 30c8ac24635d4..4405fb2bc7a00 100644 | ||
5000 | --- a/drivers/misc/lkdtm/Makefile | ||
5001 | +++ b/drivers/misc/lkdtm/Makefile | ||
5002 | @@ -16,7 +16,7 @@ KCOV_INSTRUMENT_rodata.o := n | ||
5003 | |||
5004 | OBJCOPYFLAGS := | ||
5005 | OBJCOPYFLAGS_rodata_objcopy.o := \ | ||
5006 | - --rename-section .noinstr.text=.rodata,alloc,readonly,load | ||
5007 | + --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents | ||
5008 | targets += rodata.o rodata_objcopy.o | ||
5009 | $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE | ||
5010 | $(call if_changed,objcopy) | ||
5011 | diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c | ||
5012 | index 0bf33786fc5c5..9e0791332ef38 100644 | ||
5013 | --- a/drivers/mmc/core/sdio.c | ||
5014 | +++ b/drivers/mmc/core/sdio.c | ||
5015 | @@ -626,6 +626,8 @@ try_again: | ||
5016 | if (host->ops->init_card) | ||
5017 | host->ops->init_card(host, card); | ||
5018 | |||
5019 | + card->ocr = ocr_card; | ||
5020 | + | ||
5021 | /* | ||
5022 | * If the host and card support UHS-I mode request the card | ||
5023 | * to switch to 1.8V signaling level. No 1.8v signalling if | ||
5024 | @@ -738,7 +740,7 @@ try_again: | ||
5025 | goto mismatch; | ||
5026 | } | ||
5027 | } | ||
5028 | - card->ocr = ocr_card; | ||
5029 | + | ||
5030 | mmc_fixup_device(card, sdio_fixup_methods); | ||
5031 | |||
5032 | if (card->type == MMC_TYPE_SD_COMBO) { | ||
5033 | diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c | ||
5034 | index 360d523132bd5..780552a86ec08 100644 | ||
5035 | --- a/drivers/mmc/host/meson-mx-sdio.c | ||
5036 | +++ b/drivers/mmc/host/meson-mx-sdio.c | ||
5037 | @@ -665,6 +665,11 @@ static int meson_mx_mmc_probe(struct platform_device *pdev) | ||
5038 | } | ||
5039 | |||
5040 | irq = platform_get_irq(pdev, 0); | ||
5041 | + if (irq < 0) { | ||
5042 | + ret = irq; | ||
5043 | + goto error_free_mmc; | ||
5044 | + } | ||
5045 | + | ||
5046 | ret = devm_request_threaded_irq(host->controller_dev, irq, | ||
5047 | meson_mx_mmc_irq, | ||
5048 | meson_mx_mmc_irq_thread, IRQF_ONESHOT, | ||
5049 | diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c | ||
5050 | index 044adf9138546..64af6898131d6 100644 | ||
5051 | --- a/drivers/mtd/nand/bbt.c | ||
5052 | +++ b/drivers/mtd/nand/bbt.c | ||
5053 | @@ -123,7 +123,7 @@ int nanddev_bbt_set_block_status(struct nand_device *nand, unsigned int entry, | ||
5054 | unsigned int rbits = bits_per_block + offs - BITS_PER_LONG; | ||
5055 | |||
5056 | pos[1] &= ~GENMASK(rbits - 1, 0); | ||
5057 | - pos[1] |= val >> rbits; | ||
5058 | + pos[1] |= val >> (bits_per_block - rbits); | ||
5059 | } | ||
5060 | |||
5061 | return 0; | ||
5062 | diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | ||
5063 | index 60f146920b9f4..515094e253dcd 100644 | ||
5064 | --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | ||
5065 | +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | ||
5066 | @@ -710,14 +710,32 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, | ||
5067 | (use_half_period ? BM_GPMI_CTRL1_HALF_PERIOD : 0); | ||
5068 | } | ||
5069 | |||
5070 | -static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) | ||
5071 | +static int gpmi_nfc_apply_timings(struct gpmi_nand_data *this) | ||
5072 | { | ||
5073 | struct gpmi_nfc_hardware_timing *hw = &this->hw; | ||
5074 | struct resources *r = &this->resources; | ||
5075 | void __iomem *gpmi_regs = r->gpmi_regs; | ||
5076 | unsigned int dll_wait_time_us; | ||
5077 | + int ret; | ||
5078 | + | ||
5079 | + /* Clock dividers do NOT guarantee a clean clock signal on its output | ||
5080 | + * during the change of the divide factor on i.MX6Q/UL/SX. On i.MX7/8, | ||
5081 | + * all clock dividers provide these guarantee. | ||
5082 | + */ | ||
5083 | + if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) | ||
5084 | + clk_disable_unprepare(r->clock[0]); | ||
5085 | |||
5086 | - clk_set_rate(r->clock[0], hw->clk_rate); | ||
5087 | + ret = clk_set_rate(r->clock[0], hw->clk_rate); | ||
5088 | + if (ret) { | ||
5089 | + dev_err(this->dev, "cannot set clock rate to %lu Hz: %d\n", hw->clk_rate, ret); | ||
5090 | + return ret; | ||
5091 | + } | ||
5092 | + | ||
5093 | + if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) { | ||
5094 | + ret = clk_prepare_enable(r->clock[0]); | ||
5095 | + if (ret) | ||
5096 | + return ret; | ||
5097 | + } | ||
5098 | |||
5099 | writel(hw->timing0, gpmi_regs + HW_GPMI_TIMING0); | ||
5100 | writel(hw->timing1, gpmi_regs + HW_GPMI_TIMING1); | ||
5101 | @@ -736,6 +754,8 @@ static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) | ||
5102 | |||
5103 | /* Wait for the DLL to settle. */ | ||
5104 | udelay(dll_wait_time_us); | ||
5105 | + | ||
5106 | + return 0; | ||
5107 | } | ||
5108 | |||
5109 | static int gpmi_setup_data_interface(struct nand_chip *chip, int chipnr, | ||
5110 | @@ -1184,15 +1204,6 @@ static int gpmi_get_clks(struct gpmi_nand_data *this) | ||
5111 | r->clock[i] = clk; | ||
5112 | } | ||
5113 | |||
5114 | - if (GPMI_IS_MX6(this)) | ||
5115 | - /* | ||
5116 | - * Set the default value for the gpmi clock. | ||
5117 | - * | ||
5118 | - * If you want to use the ONFI nand which is in the | ||
5119 | - * Synchronous Mode, you should change the clock as you need. | ||
5120 | - */ | ||
5121 | - clk_set_rate(r->clock[0], 22000000); | ||
5122 | - | ||
5123 | return 0; | ||
5124 | |||
5125 | err_clock: | ||
5126 | @@ -2429,7 +2440,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, | ||
5127 | */ | ||
5128 | if (this->hw.must_apply_timings) { | ||
5129 | this->hw.must_apply_timings = false; | ||
5130 | - gpmi_nfc_apply_timings(this); | ||
5131 | + ret = gpmi_nfc_apply_timings(this); | ||
5132 | + if (ret) | ||
5133 | + return ret; | ||
5134 | } | ||
5135 | |||
5136 | dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); | ||
5137 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c | ||
5138 | index a7eaf80f500c0..ff50ccc7dceb1 100644 | ||
5139 | --- a/drivers/net/bonding/bond_main.c | ||
5140 | +++ b/drivers/net/bonding/bond_main.c | ||
5141 | @@ -792,9 +792,6 @@ static bool bond_should_notify_peers(struct bonding *bond) | ||
5142 | slave = rcu_dereference(bond->curr_active_slave); | ||
5143 | rcu_read_unlock(); | ||
5144 | |||
5145 | - netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", | ||
5146 | - slave ? slave->dev->name : "NULL"); | ||
5147 | - | ||
5148 | if (!slave || !bond->send_peer_notif || | ||
5149 | bond->send_peer_notif % | ||
5150 | max(1, bond->params.peer_notif_delay) != 0 || | ||
5151 | @@ -802,6 +799,9 @@ static bool bond_should_notify_peers(struct bonding *bond) | ||
5152 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | ||
5153 | return false; | ||
5154 | |||
5155 | + netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", | ||
5156 | + slave ? slave->dev->name : "NULL"); | ||
5157 | + | ||
5158 | return true; | ||
5159 | } | ||
5160 | |||
5161 | diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c | ||
5162 | index 2e93ee7923739..e5c939b63fa65 100644 | ||
5163 | --- a/drivers/net/can/softing/softing_cs.c | ||
5164 | +++ b/drivers/net/can/softing/softing_cs.c | ||
5165 | @@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia) | ||
5166 | return 0; | ||
5167 | |||
5168 | platform_failed: | ||
5169 | - kfree(dev); | ||
5170 | + platform_device_put(pdev); | ||
5171 | mem_failed: | ||
5172 | pcmcia_bad: | ||
5173 | pcmcia_failed: | ||
5174 | diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c | ||
5175 | index 8f44fdd8804bf..1c2afa17c26d1 100644 | ||
5176 | --- a/drivers/net/can/softing/softing_fw.c | ||
5177 | +++ b/drivers/net/can/softing/softing_fw.c | ||
5178 | @@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up) | ||
5179 | if (ret < 0) | ||
5180 | goto failed; | ||
5181 | } | ||
5182 | - /* enable_error_frame */ | ||
5183 | - /* | ||
5184 | + | ||
5185 | + /* enable_error_frame | ||
5186 | + * | ||
5187 | * Error reporting is switched off at the moment since | ||
5188 | * the receiving of them is not yet 100% verified | ||
5189 | * This should be enabled sooner or later | ||
5190 | - * | ||
5191 | - if (error_reporting) { | ||
5192 | + */ | ||
5193 | + if (0 && error_reporting) { | ||
5194 | ret = softing_fct_cmd(card, 51, "enable_error_frame"); | ||
5195 | if (ret < 0) | ||
5196 | goto failed; | ||
5197 | } | ||
5198 | - */ | ||
5199 | + | ||
5200 | /* initialize interface */ | ||
5201 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
5202 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
5203 | diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c | ||
5204 | index 0de39ebb35662..008d3d492bd1c 100644 | ||
5205 | --- a/drivers/net/can/xilinx_can.c | ||
5206 | +++ b/drivers/net/can/xilinx_can.c | ||
5207 | @@ -1753,7 +1753,12 @@ static int xcan_probe(struct platform_device *pdev) | ||
5208 | spin_lock_init(&priv->tx_lock); | ||
5209 | |||
5210 | /* Get IRQ for the device */ | ||
5211 | - ndev->irq = platform_get_irq(pdev, 0); | ||
5212 | + ret = platform_get_irq(pdev, 0); | ||
5213 | + if (ret < 0) | ||
5214 | + goto err_free; | ||
5215 | + | ||
5216 | + ndev->irq = ret; | ||
5217 | + | ||
5218 | ndev->flags |= IFF_ECHO; /* We support local echo */ | ||
5219 | |||
5220 | platform_set_drvdata(pdev, ndev); | ||
5221 | diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | ||
5222 | index c2a1fa75b2147..2affdddc12bf6 100644 | ||
5223 | --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c | ||
5224 | +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | ||
5225 | @@ -3507,10 +3507,12 @@ static int bcmgenet_probe(struct platform_device *pdev) | ||
5226 | |||
5227 | /* Request the WOL interrupt and advertise suspend if available */ | ||
5228 | priv->wol_irq_disabled = true; | ||
5229 | - err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, | ||
5230 | - dev->name, priv); | ||
5231 | - if (!err) | ||
5232 | - device_set_wakeup_capable(&pdev->dev, 1); | ||
5233 | + if (priv->wol_irq > 0) { | ||
5234 | + err = devm_request_irq(&pdev->dev, priv->wol_irq, | ||
5235 | + bcmgenet_wol_isr, 0, dev->name, priv); | ||
5236 | + if (!err) | ||
5237 | + device_set_wakeup_capable(&pdev->dev, 1); | ||
5238 | + } | ||
5239 | |||
5240 | /* Set the needed headroom to account for any possible | ||
5241 | * features enabling/disabling at runtime | ||
5242 | diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | ||
5243 | index d04a6c1634452..da8d10475a08e 100644 | ||
5244 | --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | ||
5245 | +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | ||
5246 | @@ -32,6 +32,7 @@ | ||
5247 | |||
5248 | #include <linux/tcp.h> | ||
5249 | #include <linux/ipv6.h> | ||
5250 | +#include <net/inet_ecn.h> | ||
5251 | #include <net/route.h> | ||
5252 | #include <net/ip6_route.h> | ||
5253 | |||
5254 | @@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *lldi, | ||
5255 | |||
5256 | rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, | ||
5257 | peer_port, local_port, IPPROTO_TCP, | ||
5258 | - tos, 0); | ||
5259 | + tos & ~INET_ECN_MASK, 0); | ||
5260 | if (IS_ERR(rt)) | ||
5261 | return NULL; | ||
5262 | n = dst_neigh_lookup(&rt->dst, &peer_ip); | ||
5263 | diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c | ||
5264 | index c9fb1ec625d8b..a8a8b77c1611e 100644 | ||
5265 | --- a/drivers/net/ethernet/cortina/gemini.c | ||
5266 | +++ b/drivers/net/ethernet/cortina/gemini.c | ||
5267 | @@ -304,21 +304,21 @@ static void gmac_speed_set(struct net_device *netdev) | ||
5268 | switch (phydev->speed) { | ||
5269 | case 1000: | ||
5270 | status.bits.speed = GMAC_SPEED_1000; | ||
5271 | - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) | ||
5272 | + if (phy_interface_mode_is_rgmii(phydev->interface)) | ||
5273 | status.bits.mii_rmii = GMAC_PHY_RGMII_1000; | ||
5274 | netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", | ||
5275 | phydev_name(phydev)); | ||
5276 | break; | ||
5277 | case 100: | ||
5278 | status.bits.speed = GMAC_SPEED_100; | ||
5279 | - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) | ||
5280 | + if (phy_interface_mode_is_rgmii(phydev->interface)) | ||
5281 | status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; | ||
5282 | netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", | ||
5283 | phydev_name(phydev)); | ||
5284 | break; | ||
5285 | case 10: | ||
5286 | status.bits.speed = GMAC_SPEED_10; | ||
5287 | - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) | ||
5288 | + if (phy_interface_mode_is_rgmii(phydev->interface)) | ||
5289 | status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; | ||
5290 | netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", | ||
5291 | phydev_name(phydev)); | ||
5292 | @@ -388,6 +388,9 @@ static int gmac_setup_phy(struct net_device *netdev) | ||
5293 | status.bits.mii_rmii = GMAC_PHY_GMII; | ||
5294 | break; | ||
5295 | case PHY_INTERFACE_MODE_RGMII: | ||
5296 | + case PHY_INTERFACE_MODE_RGMII_ID: | ||
5297 | + case PHY_INTERFACE_MODE_RGMII_TXID: | ||
5298 | + case PHY_INTERFACE_MODE_RGMII_RXID: | ||
5299 | netdev_dbg(netdev, | ||
5300 | "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); | ||
5301 | status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; | ||
5302 | diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c | ||
5303 | index 7ab8095db1928..147126e79986c 100644 | ||
5304 | --- a/drivers/net/ethernet/freescale/fman/mac.c | ||
5305 | +++ b/drivers/net/ethernet/freescale/fman/mac.c | ||
5306 | @@ -94,14 +94,17 @@ static void mac_exception(void *handle, enum fman_mac_exceptions ex) | ||
5307 | __func__, ex); | ||
5308 | } | ||
5309 | |||
5310 | -static void set_fman_mac_params(struct mac_device *mac_dev, | ||
5311 | - struct fman_mac_params *params) | ||
5312 | +static int set_fman_mac_params(struct mac_device *mac_dev, | ||
5313 | + struct fman_mac_params *params) | ||
5314 | { | ||
5315 | struct mac_priv_s *priv = mac_dev->priv; | ||
5316 | |||
5317 | params->base_addr = (typeof(params->base_addr)) | ||
5318 | devm_ioremap(priv->dev, mac_dev->res->start, | ||
5319 | resource_size(mac_dev->res)); | ||
5320 | + if (!params->base_addr) | ||
5321 | + return -ENOMEM; | ||
5322 | + | ||
5323 | memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); | ||
5324 | params->max_speed = priv->max_speed; | ||
5325 | params->phy_if = mac_dev->phy_if; | ||
5326 | @@ -112,6 +115,8 @@ static void set_fman_mac_params(struct mac_device *mac_dev, | ||
5327 | params->event_cb = mac_exception; | ||
5328 | params->dev_id = mac_dev; | ||
5329 | params->internal_phy_node = priv->internal_phy_node; | ||
5330 | + | ||
5331 | + return 0; | ||
5332 | } | ||
5333 | |||
5334 | static int tgec_initialization(struct mac_device *mac_dev) | ||
5335 | @@ -123,7 +128,9 @@ static int tgec_initialization(struct mac_device *mac_dev) | ||
5336 | |||
5337 | priv = mac_dev->priv; | ||
5338 | |||
5339 | - set_fman_mac_params(mac_dev, ¶ms); | ||
5340 | + err = set_fman_mac_params(mac_dev, ¶ms); | ||
5341 | + if (err) | ||
5342 | + goto _return; | ||
5343 | |||
5344 | mac_dev->fman_mac = tgec_config(¶ms); | ||
5345 | if (!mac_dev->fman_mac) { | ||
5346 | @@ -169,7 +176,9 @@ static int dtsec_initialization(struct mac_device *mac_dev) | ||
5347 | |||
5348 | priv = mac_dev->priv; | ||
5349 | |||
5350 | - set_fman_mac_params(mac_dev, ¶ms); | ||
5351 | + err = set_fman_mac_params(mac_dev, ¶ms); | ||
5352 | + if (err) | ||
5353 | + goto _return; | ||
5354 | |||
5355 | mac_dev->fman_mac = dtsec_config(¶ms); | ||
5356 | if (!mac_dev->fman_mac) { | ||
5357 | @@ -218,7 +227,9 @@ static int memac_initialization(struct mac_device *mac_dev) | ||
5358 | |||
5359 | priv = mac_dev->priv; | ||
5360 | |||
5361 | - set_fman_mac_params(mac_dev, ¶ms); | ||
5362 | + err = set_fman_mac_params(mac_dev, ¶ms); | ||
5363 | + if (err) | ||
5364 | + goto _return; | ||
5365 | |||
5366 | if (priv->max_speed == SPEED_10000) | ||
5367 | params.phy_if = PHY_INTERFACE_MODE_XGMII; | ||
5368 | diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c | ||
5369 | index c82c85ef5fb34..c37aea7ba8502 100644 | ||
5370 | --- a/drivers/net/ethernet/freescale/xgmac_mdio.c | ||
5371 | +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c | ||
5372 | @@ -301,9 +301,10 @@ err_ioremap: | ||
5373 | static int xgmac_mdio_remove(struct platform_device *pdev) | ||
5374 | { | ||
5375 | struct mii_bus *bus = platform_get_drvdata(pdev); | ||
5376 | + struct mdio_fsl_priv *priv = bus->priv; | ||
5377 | |||
5378 | mdiobus_unregister(bus); | ||
5379 | - iounmap(bus->priv); | ||
5380 | + iounmap(priv->mdio_base); | ||
5381 | mdiobus_free(bus); | ||
5382 | |||
5383 | return 0; | ||
5384 | diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c | ||
5385 | index 6436a98c5953f..90e237fdfbd0e 100644 | ||
5386 | --- a/drivers/net/ethernet/i825xx/sni_82596.c | ||
5387 | +++ b/drivers/net/ethernet/i825xx/sni_82596.c | ||
5388 | @@ -123,9 +123,10 @@ static int sni_82596_probe(struct platform_device *dev) | ||
5389 | netdevice->dev_addr[5] = readb(eth_addr + 0x06); | ||
5390 | iounmap(eth_addr); | ||
5391 | |||
5392 | - if (!netdevice->irq) { | ||
5393 | + if (netdevice->irq < 0) { | ||
5394 | printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", | ||
5395 | __FILE__, netdevice->base_addr); | ||
5396 | + retval = netdevice->irq; | ||
5397 | goto probe_failed; | ||
5398 | } | ||
5399 | |||
5400 | diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
5401 | index 48b395b9c15ad..3351d4f9363af 100644 | ||
5402 | --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
5403 | +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
5404 | @@ -215,7 +215,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, | ||
5405 | phylink_config); | ||
5406 | struct mtk_eth *eth = mac->hw; | ||
5407 | u32 mcr_cur, mcr_new, sid, i; | ||
5408 | - int val, ge_mode, err; | ||
5409 | + int val, ge_mode, err = 0; | ||
5410 | |||
5411 | /* MT76x8 has no hardware settings between for the MAC */ | ||
5412 | if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && | ||
5413 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | ||
5414 | index bf091a6c0cd2d..1a7aa078f3510 100644 | ||
5415 | --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | ||
5416 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | ||
5417 | @@ -147,8 +147,12 @@ static void cmd_ent_put(struct mlx5_cmd_work_ent *ent) | ||
5418 | if (!refcount_dec_and_test(&ent->refcnt)) | ||
5419 | return; | ||
5420 | |||
5421 | - if (ent->idx >= 0) | ||
5422 | - cmd_free_index(ent->cmd, ent->idx); | ||
5423 | + if (ent->idx >= 0) { | ||
5424 | + struct mlx5_cmd *cmd = ent->cmd; | ||
5425 | + | ||
5426 | + cmd_free_index(cmd, ent->idx); | ||
5427 | + up(ent->page_queue ? &cmd->pages_sem : &cmd->sem); | ||
5428 | + } | ||
5429 | |||
5430 | cmd_free_ent(ent); | ||
5431 | } | ||
5432 | @@ -883,25 +887,6 @@ static bool opcode_allowed(struct mlx5_cmd *cmd, u16 opcode) | ||
5433 | return cmd->allowed_opcode == opcode; | ||
5434 | } | ||
5435 | |||
5436 | -static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) | ||
5437 | -{ | ||
5438 | - unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); | ||
5439 | - int idx; | ||
5440 | - | ||
5441 | -retry: | ||
5442 | - idx = cmd_alloc_index(cmd); | ||
5443 | - if (idx < 0 && time_before(jiffies, alloc_end)) { | ||
5444 | - /* Index allocation can fail on heavy load of commands. This is a temporary | ||
5445 | - * situation as the current command already holds the semaphore, meaning that | ||
5446 | - * another command completion is being handled and it is expected to release | ||
5447 | - * the entry index soon. | ||
5448 | - */ | ||
5449 | - cpu_relax(); | ||
5450 | - goto retry; | ||
5451 | - } | ||
5452 | - return idx; | ||
5453 | -} | ||
5454 | - | ||
5455 | static void cmd_work_handler(struct work_struct *work) | ||
5456 | { | ||
5457 | struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); | ||
5458 | @@ -919,7 +904,7 @@ static void cmd_work_handler(struct work_struct *work) | ||
5459 | sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; | ||
5460 | down(sem); | ||
5461 | if (!ent->page_queue) { | ||
5462 | - alloc_ret = cmd_alloc_index_retry(cmd); | ||
5463 | + alloc_ret = cmd_alloc_index(cmd); | ||
5464 | if (alloc_ret < 0) { | ||
5465 | mlx5_core_err(dev, "failed to allocate command entry\n"); | ||
5466 | if (ent->callback) { | ||
5467 | @@ -1577,8 +1562,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force | ||
5468 | vector = vec & 0xffffffff; | ||
5469 | for (i = 0; i < (1 << cmd->log_sz); i++) { | ||
5470 | if (test_bit(i, &vector)) { | ||
5471 | - struct semaphore *sem; | ||
5472 | - | ||
5473 | ent = cmd->ent_arr[i]; | ||
5474 | |||
5475 | /* if we already completed the command, ignore it */ | ||
5476 | @@ -1601,10 +1584,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force | ||
5477 | dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) | ||
5478 | cmd_ent_put(ent); | ||
5479 | |||
5480 | - if (ent->page_queue) | ||
5481 | - sem = &cmd->pages_sem; | ||
5482 | - else | ||
5483 | - sem = &cmd->sem; | ||
5484 | ent->ts2 = ktime_get_ns(); | ||
5485 | memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); | ||
5486 | dump_command(dev, ent, 0); | ||
5487 | @@ -1658,7 +1637,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force | ||
5488 | */ | ||
5489 | complete(&ent->done); | ||
5490 | } | ||
5491 | - up(sem); | ||
5492 | } | ||
5493 | } | ||
5494 | } | ||
5495 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | ||
5496 | index dea884c94568c..2465165cbea73 100644 | ||
5497 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | ||
5498 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | ||
5499 | @@ -5053,9 +5053,13 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) | ||
5500 | } | ||
5501 | |||
5502 | if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { | ||
5503 | - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
5504 | - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
5505 | - netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
5506 | + netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | | ||
5507 | + NETIF_F_GSO_UDP_TUNNEL_CSUM; | ||
5508 | + netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL | | ||
5509 | + NETIF_F_GSO_UDP_TUNNEL_CSUM; | ||
5510 | + netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; | ||
5511 | + netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL | | ||
5512 | + NETIF_F_GSO_UDP_TUNNEL_CSUM; | ||
5513 | } | ||
5514 | |||
5515 | if (mlx5e_tunnel_proto_supported(mdev, IPPROTO_GRE)) { | ||
5516 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c b/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c | ||
5517 | index bdc7f915d80e3..101667c6b5843 100644 | ||
5518 | --- a/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c | ||
5519 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c | ||
5520 | @@ -265,10 +265,8 @@ static int mlx5_lag_fib_event(struct notifier_block *nb, | ||
5521 | fen_info = container_of(info, struct fib_entry_notifier_info, | ||
5522 | info); | ||
5523 | fi = fen_info->fi; | ||
5524 | - if (fi->nh) { | ||
5525 | - NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported"); | ||
5526 | - return notifier_from_errno(-EINVAL); | ||
5527 | - } | ||
5528 | + if (fi->nh) | ||
5529 | + return NOTIFY_DONE; | ||
5530 | fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev; | ||
5531 | if (fib_dev != ldev->pf[0].netdev && | ||
5532 | fib_dev != ldev->pf[1].netdev) { | ||
5533 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c | ||
5534 | index aa4fef7890841..ff331251a019a 100644 | ||
5535 | --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c | ||
5536 | +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c | ||
5537 | @@ -1876,6 +1876,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) | ||
5538 | { | ||
5539 | pci_driver->probe = mlxsw_pci_probe; | ||
5540 | pci_driver->remove = mlxsw_pci_remove; | ||
5541 | + pci_driver->shutdown = mlxsw_pci_remove; | ||
5542 | return pci_register_driver(pci_driver); | ||
5543 | } | ||
5544 | EXPORT_SYMBOL(mlxsw_pci_driver_register); | ||
5545 | diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c | ||
5546 | index 7072b249c8bd6..8157666209798 100644 | ||
5547 | --- a/drivers/net/ethernet/rocker/rocker_ofdpa.c | ||
5548 | +++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c | ||
5549 | @@ -2795,7 +2795,8 @@ static void ofdpa_fib4_abort(struct rocker *rocker) | ||
5550 | if (!ofdpa_port) | ||
5551 | continue; | ||
5552 | nh->fib_nh_flags &= ~RTNH_F_OFFLOAD; | ||
5553 | - ofdpa_flow_tbl_del(ofdpa_port, OFDPA_OP_FLAG_REMOVE, | ||
5554 | + ofdpa_flow_tbl_del(ofdpa_port, | ||
5555 | + OFDPA_OP_FLAG_REMOVE | OFDPA_OP_FLAG_NOWAIT, | ||
5556 | flow_entry); | ||
5557 | } | ||
5558 | spin_unlock_irqrestore(&ofdpa->flow_tbl_lock, flags); | ||
5559 | diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | ||
5560 | index f98318d93ce72..0ef806ea18327 100644 | ||
5561 | --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | ||
5562 | +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | ||
5563 | @@ -41,8 +41,9 @@ | ||
5564 | #include "xilinx_axienet.h" | ||
5565 | |||
5566 | /* Descriptors defines for Tx and Rx DMA */ | ||
5567 | -#define TX_BD_NUM_DEFAULT 64 | ||
5568 | +#define TX_BD_NUM_DEFAULT 128 | ||
5569 | #define RX_BD_NUM_DEFAULT 1024 | ||
5570 | +#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) | ||
5571 | #define TX_BD_NUM_MAX 4096 | ||
5572 | #define RX_BD_NUM_MAX 4096 | ||
5573 | |||
5574 | @@ -635,7 +636,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | ||
5575 | num_frag = skb_shinfo(skb)->nr_frags; | ||
5576 | cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; | ||
5577 | |||
5578 | - if (axienet_check_tx_bd_space(lp, num_frag)) { | ||
5579 | + if (axienet_check_tx_bd_space(lp, num_frag + 1)) { | ||
5580 | if (netif_queue_stopped(ndev)) | ||
5581 | return NETDEV_TX_BUSY; | ||
5582 | |||
5583 | @@ -645,7 +646,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | ||
5584 | smp_mb(); | ||
5585 | |||
5586 | /* Space might have just been freed - check again */ | ||
5587 | - if (axienet_check_tx_bd_space(lp, num_frag)) | ||
5588 | + if (axienet_check_tx_bd_space(lp, num_frag + 1)) | ||
5589 | return NETDEV_TX_BUSY; | ||
5590 | |||
5591 | netif_wake_queue(ndev); | ||
5592 | @@ -1223,7 +1224,8 @@ static int axienet_ethtools_set_ringparam(struct net_device *ndev, | ||
5593 | if (ering->rx_pending > RX_BD_NUM_MAX || | ||
5594 | ering->rx_mini_pending || | ||
5595 | ering->rx_jumbo_pending || | ||
5596 | - ering->rx_pending > TX_BD_NUM_MAX) | ||
5597 | + ering->tx_pending < TX_BD_NUM_MIN || | ||
5598 | + ering->tx_pending > TX_BD_NUM_MAX) | ||
5599 | return -EINVAL; | ||
5600 | |||
5601 | if (netif_running(ndev)) | ||
5602 | diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c | ||
5603 | index 9dbe625ad4477..a69317e944229 100644 | ||
5604 | --- a/drivers/net/phy/marvell.c | ||
5605 | +++ b/drivers/net/phy/marvell.c | ||
5606 | @@ -917,6 +917,12 @@ static int m88e1118_config_init(struct phy_device *phydev) | ||
5607 | if (err < 0) | ||
5608 | return err; | ||
5609 | |||
5610 | + if (phy_interface_is_rgmii(phydev)) { | ||
5611 | + err = m88e1121_config_aneg_rgmii_delays(phydev); | ||
5612 | + if (err < 0) | ||
5613 | + return err; | ||
5614 | + } | ||
5615 | + | ||
5616 | /* Adjust LED Control */ | ||
5617 | if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) | ||
5618 | err = phy_write(phydev, 0x10, 0x1100); | ||
5619 | diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c | ||
5620 | index bec73f0640d03..b0a439248ff69 100644 | ||
5621 | --- a/drivers/net/phy/mdio_bus.c | ||
5622 | +++ b/drivers/net/phy/mdio_bus.c | ||
5623 | @@ -433,7 +433,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) | ||
5624 | mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); | ||
5625 | |||
5626 | bus->state = MDIOBUS_REGISTERED; | ||
5627 | - pr_info("%s: probed\n", bus->name); | ||
5628 | + dev_dbg(&bus->dev, "probed\n"); | ||
5629 | return 0; | ||
5630 | |||
5631 | error: | ||
5632 | diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c | ||
5633 | index 9412669b579c7..84064120918f0 100644 | ||
5634 | --- a/drivers/net/phy/phy-core.c | ||
5635 | +++ b/drivers/net/phy/phy-core.c | ||
5636 | @@ -128,11 +128,11 @@ static const struct phy_setting settings[] = { | ||
5637 | PHY_SETTING( 2500, FULL, 2500baseT_Full ), | ||
5638 | PHY_SETTING( 2500, FULL, 2500baseX_Full ), | ||
5639 | /* 1G */ | ||
5640 | - PHY_SETTING( 1000, FULL, 1000baseKX_Full ), | ||
5641 | PHY_SETTING( 1000, FULL, 1000baseT_Full ), | ||
5642 | PHY_SETTING( 1000, HALF, 1000baseT_Half ), | ||
5643 | PHY_SETTING( 1000, FULL, 1000baseT1_Full ), | ||
5644 | PHY_SETTING( 1000, FULL, 1000baseX_Full ), | ||
5645 | + PHY_SETTING( 1000, FULL, 1000baseKX_Full ), | ||
5646 | /* 100M */ | ||
5647 | PHY_SETTING( 100, FULL, 100baseT_Full ), | ||
5648 | PHY_SETTING( 100, FULL, 100baseT1_Full ), | ||
5649 | diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c | ||
5650 | index c6c41a7836c93..a085213dc2eaa 100644 | ||
5651 | --- a/drivers/net/ppp/ppp_generic.c | ||
5652 | +++ b/drivers/net/ppp/ppp_generic.c | ||
5653 | @@ -69,6 +69,8 @@ | ||
5654 | #define MPHDRLEN 6 /* multilink protocol header length */ | ||
5655 | #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ | ||
5656 | |||
5657 | +#define PPP_PROTO_LEN 2 | ||
5658 | + | ||
5659 | /* | ||
5660 | * An instance of /dev/ppp can be associated with either a ppp | ||
5661 | * interface unit or a ppp channel. In both cases, file->private_data | ||
5662 | @@ -498,6 +500,9 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, | ||
5663 | |||
5664 | if (!pf) | ||
5665 | return -ENXIO; | ||
5666 | + /* All PPP packets should start with the 2-byte protocol */ | ||
5667 | + if (count < PPP_PROTO_LEN) | ||
5668 | + return -EINVAL; | ||
5669 | ret = -ENOMEM; | ||
5670 | skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); | ||
5671 | if (!skb) | ||
5672 | @@ -1544,7 +1549,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | ||
5673 | } | ||
5674 | |||
5675 | ++ppp->stats64.tx_packets; | ||
5676 | - ppp->stats64.tx_bytes += skb->len - 2; | ||
5677 | + ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; | ||
5678 | |||
5679 | switch (proto) { | ||
5680 | case PPP_IP: | ||
5681 | diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c | ||
5682 | index 09bfa6a4dfbc1..7e40e2e2f3723 100644 | ||
5683 | --- a/drivers/net/usb/mcs7830.c | ||
5684 | +++ b/drivers/net/usb/mcs7830.c | ||
5685 | @@ -108,8 +108,16 @@ static const char driver_name[] = "MOSCHIP usb-ethernet driver"; | ||
5686 | |||
5687 | static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) | ||
5688 | { | ||
5689 | - return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, | ||
5690 | - 0x0000, index, data, size); | ||
5691 | + int ret; | ||
5692 | + | ||
5693 | + ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, | ||
5694 | + 0x0000, index, data, size); | ||
5695 | + if (ret < 0) | ||
5696 | + return ret; | ||
5697 | + else if (ret < size) | ||
5698 | + return -ENODATA; | ||
5699 | + | ||
5700 | + return ret; | ||
5701 | } | ||
5702 | |||
5703 | static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) | ||
5704 | diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c | ||
5705 | index 4c57e79e5779a..58e189ec672f9 100644 | ||
5706 | --- a/drivers/net/wireless/ath/ar5523/ar5523.c | ||
5707 | +++ b/drivers/net/wireless/ath/ar5523/ar5523.c | ||
5708 | @@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) | ||
5709 | ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); | ||
5710 | return; | ||
5711 | } | ||
5712 | + if (!cmd->odata) { | ||
5713 | + ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); | ||
5714 | + return; | ||
5715 | + } | ||
5716 | memcpy(cmd->odata, hdr + 1, sizeof(u32)); | ||
5717 | cmd->olen = sizeof(u32); | ||
5718 | cmd->res = 0; | ||
5719 | diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c | ||
5720 | index c38e1963ebc05..f73ed1044390c 100644 | ||
5721 | --- a/drivers/net/wireless/ath/ath10k/htt_tx.c | ||
5722 | +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c | ||
5723 | @@ -147,6 +147,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) | ||
5724 | htt->num_pending_tx--; | ||
5725 | if (htt->num_pending_tx == htt->max_num_pending_tx - 1) | ||
5726 | ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); | ||
5727 | + | ||
5728 | + if (htt->num_pending_tx == 0) | ||
5729 | + wake_up(&htt->empty_tx_wq); | ||
5730 | } | ||
5731 | |||
5732 | int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) | ||
5733 | diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c | ||
5734 | index f46b9083bbf10..2c254f43790d2 100644 | ||
5735 | --- a/drivers/net/wireless/ath/ath10k/txrx.c | ||
5736 | +++ b/drivers/net/wireless/ath/ath10k/txrx.c | ||
5737 | @@ -80,8 +80,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, | ||
5738 | |||
5739 | ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); | ||
5740 | ath10k_htt_tx_dec_pending(htt); | ||
5741 | - if (htt->num_pending_tx == 0) | ||
5742 | - wake_up(&htt->empty_tx_wq); | ||
5743 | spin_unlock_bh(&htt->tx_lock); | ||
5744 | |||
5745 | rcu_read_lock(); | ||
5746 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
5747 | index 2ed98aaed6fb5..c8c7afe0e343e 100644 | ||
5748 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
5749 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
5750 | @@ -590,6 +590,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, | ||
5751 | return; | ||
5752 | } | ||
5753 | |||
5754 | + if (pkt_len > 2 * MAX_RX_BUF_SIZE) { | ||
5755 | + dev_err(&hif_dev->udev->dev, | ||
5756 | + "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); | ||
5757 | + RX_STAT_INC(skb_dropped); | ||
5758 | + return; | ||
5759 | + } | ||
5760 | + | ||
5761 | pad_len = 4 - (pkt_len & 0x3); | ||
5762 | if (pad_len == 4) | ||
5763 | pad_len = 0; | ||
5764 | diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c | ||
5765 | index 4da25e84793b7..c400261352bc8 100644 | ||
5766 | --- a/drivers/net/wireless/ath/wcn36xx/dxe.c | ||
5767 | +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c | ||
5768 | @@ -952,4 +952,9 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) | ||
5769 | |||
5770 | wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); | ||
5771 | wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); | ||
5772 | + | ||
5773 | + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_l_ch); | ||
5774 | + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_h_ch); | ||
5775 | + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_l_ch); | ||
5776 | + wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_h_ch); | ||
5777 | } | ||
5778 | diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c | ||
5779 | index a7532028bf9db..74cf173c186ff 100644 | ||
5780 | --- a/drivers/net/wireless/ath/wcn36xx/smd.c | ||
5781 | +++ b/drivers/net/wireless/ath/wcn36xx/smd.c | ||
5782 | @@ -2311,7 +2311,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, | ||
5783 | wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", | ||
5784 | tmp->bss_index); | ||
5785 | vif = wcn36xx_priv_to_vif(tmp); | ||
5786 | - ieee80211_connection_loss(vif); | ||
5787 | + ieee80211_beacon_loss(vif); | ||
5788 | } | ||
5789 | return 0; | ||
5790 | } | ||
5791 | @@ -2326,7 +2326,7 @@ static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn, | ||
5792 | wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", | ||
5793 | rsp->bss_index); | ||
5794 | vif = wcn36xx_priv_to_vif(tmp); | ||
5795 | - ieee80211_connection_loss(vif); | ||
5796 | + ieee80211_beacon_loss(vif); | ||
5797 | return 0; | ||
5798 | } | ||
5799 | } | ||
5800 | diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c | ||
5801 | index e68366f248fe3..83cb2ad03451b 100644 | ||
5802 | --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c | ||
5803 | +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c | ||
5804 | @@ -183,6 +183,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) | ||
5805 | |||
5806 | for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) | ||
5807 | iwl_free_fw_img(drv, drv->fw.img + i); | ||
5808 | + | ||
5809 | + /* clear the data for the aborted load case */ | ||
5810 | + memset(&drv->fw, 0, sizeof(drv->fw)); | ||
5811 | } | ||
5812 | |||
5813 | static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, | ||
5814 | @@ -1338,6 +1341,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | ||
5815 | int i; | ||
5816 | bool load_module = false; | ||
5817 | bool usniffer_images = false; | ||
5818 | + bool failure = true; | ||
5819 | |||
5820 | fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH; | ||
5821 | fw->ucode_capa.standard_phy_calibration_size = | ||
5822 | @@ -1595,15 +1599,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | ||
5823 | * else from proceeding if the module fails to load | ||
5824 | * or hangs loading. | ||
5825 | */ | ||
5826 | - if (load_module) { | ||
5827 | + if (load_module) | ||
5828 | request_module("%s", op->name); | ||
5829 | -#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR | ||
5830 | - if (err) | ||
5831 | - IWL_ERR(drv, | ||
5832 | - "failed to load module %s (error %d), is dynamic loading enabled?\n", | ||
5833 | - op->name, err); | ||
5834 | -#endif | ||
5835 | - } | ||
5836 | + failure = false; | ||
5837 | goto free; | ||
5838 | |||
5839 | try_again: | ||
5840 | @@ -1619,6 +1617,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) | ||
5841 | complete(&drv->request_firmware_complete); | ||
5842 | device_release_driver(drv->trans->dev); | ||
5843 | free: | ||
5844 | + if (failure) | ||
5845 | + iwl_dealloc_ucode(drv); | ||
5846 | + | ||
5847 | if (pieces) { | ||
5848 | for (i = 0; i < ARRAY_SIZE(pieces->img); i++) | ||
5849 | kfree(pieces->img[i].sec); | ||
5850 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
5851 | index c942255aa1dbc..29ad7804d77aa 100644 | ||
5852 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
5853 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
5854 | @@ -1696,6 +1696,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) | ||
5855 | struct iwl_mvm_mc_iter_data iter_data = { | ||
5856 | .mvm = mvm, | ||
5857 | }; | ||
5858 | + int ret; | ||
5859 | |||
5860 | lockdep_assert_held(&mvm->mutex); | ||
5861 | |||
5862 | @@ -1705,6 +1706,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) | ||
5863 | ieee80211_iterate_active_interfaces_atomic( | ||
5864 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
5865 | iwl_mvm_mc_iface_iterator, &iter_data); | ||
5866 | + | ||
5867 | + /* | ||
5868 | + * Send a (synchronous) ech command so that we wait for the | ||
5869 | + * multiple asynchronous MCAST_FILTER_CMD commands sent by | ||
5870 | + * the interface iterator. Otherwise, we might get here over | ||
5871 | + * and over again (by userspace just sending a lot of these) | ||
5872 | + * and the CPU can send them faster than the firmware can | ||
5873 | + * process them. | ||
5874 | + * Note that the CPU is still faster - but with this we'll | ||
5875 | + * actually send fewer commands overall because the CPU will | ||
5876 | + * not schedule the work in mac80211 as frequently if it's | ||
5877 | + * still running when rescheduled (possibly multiple times). | ||
5878 | + */ | ||
5879 | + ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); | ||
5880 | + if (ret) | ||
5881 | + IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); | ||
5882 | } | ||
5883 | |||
5884 | static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, | ||
5885 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | ||
5886 | index a6e2a30eb3109..52c6edc621ced 100644 | ||
5887 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | ||
5888 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | ||
5889 | @@ -177,12 +177,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb, | ||
5890 | struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; | ||
5891 | unsigned int headlen, fraglen, pad_len = 0; | ||
5892 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
5893 | + u8 mic_crc_len = u8_get_bits(desc->mac_flags1, | ||
5894 | + IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK) << 1; | ||
5895 | |||
5896 | if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) { | ||
5897 | len -= 2; | ||
5898 | pad_len = 2; | ||
5899 | } | ||
5900 | |||
5901 | + /* | ||
5902 | + * For non monitor interface strip the bytes the RADA might not have | ||
5903 | + * removed. As monitor interface cannot exist with other interfaces | ||
5904 | + * this removal is safe. | ||
5905 | + */ | ||
5906 | + if (mic_crc_len && !ieee80211_hw_check(mvm->hw, RX_INCLUDES_FCS)) { | ||
5907 | + u32 pkt_flags = le32_to_cpu(pkt->len_n_flags); | ||
5908 | + | ||
5909 | + /* | ||
5910 | + * If RADA was not enabled then decryption was not performed so | ||
5911 | + * the MIC cannot be removed. | ||
5912 | + */ | ||
5913 | + if (!(pkt_flags & FH_RSCSR_RADA_EN)) { | ||
5914 | + if (WARN_ON(crypt_len > mic_crc_len)) | ||
5915 | + return -EINVAL; | ||
5916 | + | ||
5917 | + mic_crc_len -= crypt_len; | ||
5918 | + } | ||
5919 | + | ||
5920 | + if (WARN_ON(mic_crc_len > len)) | ||
5921 | + return -EINVAL; | ||
5922 | + | ||
5923 | + len -= mic_crc_len; | ||
5924 | + } | ||
5925 | + | ||
5926 | /* If frame is small enough to fit in skb->head, pull it completely. | ||
5927 | * If not, only pull ieee80211_hdr (including crypto if present, and | ||
5928 | * an additional 8 bytes for SNAP/ethertype, see below) so that | ||
5929 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | ||
5930 | index 8aa567d7912c2..3a58267d3d710 100644 | ||
5931 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | ||
5932 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | ||
5933 | @@ -1700,7 +1700,7 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) | ||
5934 | return -EIO; | ||
5935 | } | ||
5936 | |||
5937 | -#define SCAN_TIMEOUT 20000 | ||
5938 | +#define SCAN_TIMEOUT 30000 | ||
5939 | |||
5940 | void iwl_mvm_scan_timeout_wk(struct work_struct *work) | ||
5941 | { | ||
5942 | diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c | ||
5943 | index 5fdffb114913d..fd12093863801 100644 | ||
5944 | --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c | ||
5945 | +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c | ||
5946 | @@ -364,10 +364,12 @@ static void mwifiex_process_uap_tx_pause(struct mwifiex_private *priv, | ||
5947 | sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac); | ||
5948 | if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) { | ||
5949 | sta_ptr->tx_pause = tp->tx_pause; | ||
5950 | + spin_unlock_bh(&priv->sta_list_spinlock); | ||
5951 | mwifiex_update_ralist_tx_pause(priv, tp->peermac, | ||
5952 | tp->tx_pause); | ||
5953 | + } else { | ||
5954 | + spin_unlock_bh(&priv->sta_list_spinlock); | ||
5955 | } | ||
5956 | - spin_unlock_bh(&priv->sta_list_spinlock); | ||
5957 | } | ||
5958 | } | ||
5959 | |||
5960 | @@ -399,11 +401,13 @@ static void mwifiex_process_sta_tx_pause(struct mwifiex_private *priv, | ||
5961 | sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac); | ||
5962 | if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) { | ||
5963 | sta_ptr->tx_pause = tp->tx_pause; | ||
5964 | + spin_unlock_bh(&priv->sta_list_spinlock); | ||
5965 | mwifiex_update_ralist_tx_pause(priv, | ||
5966 | tp->peermac, | ||
5967 | tp->tx_pause); | ||
5968 | + } else { | ||
5969 | + spin_unlock_bh(&priv->sta_list_spinlock); | ||
5970 | } | ||
5971 | - spin_unlock_bh(&priv->sta_list_spinlock); | ||
5972 | } | ||
5973 | } | ||
5974 | } | ||
5975 | diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c | ||
5976 | index cb8a9ad40cfe9..39cf713d5054c 100644 | ||
5977 | --- a/drivers/net/wireless/marvell/mwifiex/usb.c | ||
5978 | +++ b/drivers/net/wireless/marvell/mwifiex/usb.c | ||
5979 | @@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | ||
5980 | default: | ||
5981 | mwifiex_dbg(adapter, ERROR, | ||
5982 | "unknown recv_type %#x\n", recv_type); | ||
5983 | - return -1; | ||
5984 | + ret = -1; | ||
5985 | + goto exit_restore_skb; | ||
5986 | } | ||
5987 | break; | ||
5988 | case MWIFIEX_USB_EP_DATA: | ||
5989 | diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c | ||
5990 | index 441fda71f6289..d92337169ee3a 100644 | ||
5991 | --- a/drivers/net/wireless/rsi/rsi_91x_main.c | ||
5992 | +++ b/drivers/net/wireless/rsi/rsi_91x_main.c | ||
5993 | @@ -23,6 +23,7 @@ | ||
5994 | #include "rsi_common.h" | ||
5995 | #include "rsi_coex.h" | ||
5996 | #include "rsi_hal.h" | ||
5997 | +#include "rsi_usb.h" | ||
5998 | |||
5999 | u32 rsi_zone_enabled = /* INFO_ZONE | | ||
6000 | INIT_ZONE | | ||
6001 | @@ -167,6 +168,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len) | ||
6002 | frame_desc = &rx_pkt[index]; | ||
6003 | actual_length = *(u16 *)&frame_desc[0]; | ||
6004 | offset = *(u16 *)&frame_desc[2]; | ||
6005 | + if (!rcv_pkt_len && offset > | ||
6006 | + RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) | ||
6007 | + goto fail; | ||
6008 | |||
6009 | queueno = rsi_get_queueno(frame_desc, offset); | ||
6010 | length = rsi_get_length(frame_desc, offset); | ||
6011 | diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c | ||
6012 | index 68ce3d2bc5357..94bf2a7ca635d 100644 | ||
6013 | --- a/drivers/net/wireless/rsi/rsi_91x_usb.c | ||
6014 | +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c | ||
6015 | @@ -261,8 +261,12 @@ static void rsi_rx_done_handler(struct urb *urb) | ||
6016 | struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data; | ||
6017 | int status = -EINVAL; | ||
6018 | |||
6019 | + if (!rx_cb->rx_skb) | ||
6020 | + return; | ||
6021 | + | ||
6022 | if (urb->status) { | ||
6023 | dev_kfree_skb(rx_cb->rx_skb); | ||
6024 | + rx_cb->rx_skb = NULL; | ||
6025 | return; | ||
6026 | } | ||
6027 | |||
6028 | @@ -286,8 +290,10 @@ out: | ||
6029 | if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) | ||
6030 | rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); | ||
6031 | |||
6032 | - if (status) | ||
6033 | + if (status) { | ||
6034 | dev_kfree_skb(rx_cb->rx_skb); | ||
6035 | + rx_cb->rx_skb = NULL; | ||
6036 | + } | ||
6037 | } | ||
6038 | |||
6039 | static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) | ||
6040 | @@ -314,7 +320,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) | ||
6041 | struct sk_buff *skb; | ||
6042 | u8 dword_align_bytes = 0; | ||
6043 | |||
6044 | -#define RSI_MAX_RX_USB_PKT_SIZE 3000 | ||
6045 | skb = dev_alloc_skb(RSI_MAX_RX_USB_PKT_SIZE); | ||
6046 | if (!skb) | ||
6047 | return -ENOMEM; | ||
6048 | diff --git a/drivers/net/wireless/rsi/rsi_usb.h b/drivers/net/wireless/rsi/rsi_usb.h | ||
6049 | index 8702f434b5699..ad88f8c70a351 100644 | ||
6050 | --- a/drivers/net/wireless/rsi/rsi_usb.h | ||
6051 | +++ b/drivers/net/wireless/rsi/rsi_usb.h | ||
6052 | @@ -44,6 +44,8 @@ | ||
6053 | #define RSI_USB_BUF_SIZE 4096 | ||
6054 | #define RSI_USB_CTRL_BUF_SIZE 0x04 | ||
6055 | |||
6056 | +#define RSI_MAX_RX_USB_PKT_SIZE 3000 | ||
6057 | + | ||
6058 | struct rx_usb_ctrl_block { | ||
6059 | u8 *data; | ||
6060 | struct urb *rx_urb; | ||
6061 | diff --git a/drivers/of/base.c b/drivers/of/base.c | ||
6062 | index 1d667eb730e19..b5c84607a74bf 100644 | ||
6063 | --- a/drivers/of/base.c | ||
6064 | +++ b/drivers/of/base.c | ||
6065 | @@ -1366,9 +1366,14 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it) | ||
6066 | * property data length | ||
6067 | */ | ||
6068 | if (it->cur + count > it->list_end) { | ||
6069 | - pr_err("%pOF: %s = %d found %d\n", | ||
6070 | - it->parent, it->cells_name, | ||
6071 | - count, it->cell_count); | ||
6072 | + if (it->cells_name) | ||
6073 | + pr_err("%pOF: %s = %d found %td\n", | ||
6074 | + it->parent, it->cells_name, | ||
6075 | + count, it->list_end - it->cur); | ||
6076 | + else | ||
6077 | + pr_err("%pOF: phandle %s needs %d, found %td\n", | ||
6078 | + it->parent, of_node_full_name(it->node), | ||
6079 | + count, it->list_end - it->cur); | ||
6080 | goto err; | ||
6081 | } | ||
6082 | } | ||
6083 | diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c | ||
6084 | index e090978518f1a..4760f82def6ec 100644 | ||
6085 | --- a/drivers/parisc/pdc_stable.c | ||
6086 | +++ b/drivers/parisc/pdc_stable.c | ||
6087 | @@ -979,8 +979,10 @@ pdcs_register_pathentries(void) | ||
6088 | entry->kobj.kset = paths_kset; | ||
6089 | err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, | ||
6090 | "%s", entry->name); | ||
6091 | - if (err) | ||
6092 | + if (err) { | ||
6093 | + kobject_put(&entry->kobj); | ||
6094 | return err; | ||
6095 | + } | ||
6096 | |||
6097 | /* kobject is now registered */ | ||
6098 | write_lock(&entry->rw_lock); | ||
6099 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c | ||
6100 | index 9e208294946cd..d2f8cd3a9568b 100644 | ||
6101 | --- a/drivers/pci/controller/pci-aardvark.c | ||
6102 | +++ b/drivers/pci/controller/pci-aardvark.c | ||
6103 | @@ -863,7 +863,6 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, | ||
6104 | return PCI_BRIDGE_EMUL_HANDLED; | ||
6105 | } | ||
6106 | |||
6107 | - case PCI_CAP_LIST_ID: | ||
6108 | case PCI_EXP_DEVCAP: | ||
6109 | case PCI_EXP_DEVCTL: | ||
6110 | *value = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); | ||
6111 | @@ -944,6 +943,9 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) | ||
6112 | /* Support interrupt A for MSI feature */ | ||
6113 | bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE; | ||
6114 | |||
6115 | + /* Aardvark HW provides PCIe Capability structure in version 2 */ | ||
6116 | + bridge->pcie_conf.cap = cpu_to_le16(2); | ||
6117 | + | ||
6118 | /* Indicates supports for Completion Retry Status */ | ||
6119 | bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); | ||
6120 | |||
6121 | diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c | ||
6122 | index 5a2483e125a3f..09af97083ac09 100644 | ||
6123 | --- a/drivers/pci/controller/pci-mvebu.c | ||
6124 | +++ b/drivers/pci/controller/pci-mvebu.c | ||
6125 | @@ -576,6 +576,8 @@ struct pci_bridge_emul_ops mvebu_pci_bridge_emul_ops = { | ||
6126 | static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) | ||
6127 | { | ||
6128 | struct pci_bridge_emul *bridge = &port->bridge; | ||
6129 | + u32 pcie_cap = mvebu_readl(port, PCIE_CAP_PCIEXP); | ||
6130 | + u8 pcie_cap_ver = ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); | ||
6131 | |||
6132 | bridge->conf.vendor = PCI_VENDOR_ID_MARVELL; | ||
6133 | bridge->conf.device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; | ||
6134 | @@ -588,6 +590,12 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) | ||
6135 | bridge->conf.iolimit = PCI_IO_RANGE_TYPE_32; | ||
6136 | } | ||
6137 | |||
6138 | + /* | ||
6139 | + * Older mvebu hardware provides PCIe Capability structure only in | ||
6140 | + * version 1. New hardware provides it in version 2. | ||
6141 | + */ | ||
6142 | + bridge->pcie_conf.cap = cpu_to_le16(pcie_cap_ver); | ||
6143 | + | ||
6144 | bridge->has_pcie = true; | ||
6145 | bridge->data = port; | ||
6146 | bridge->ops = &mvebu_pci_bridge_emul_ops; | ||
6147 | diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c | ||
6148 | index 7dc10c2b4785d..715c85d4e688d 100644 | ||
6149 | --- a/drivers/pci/msi.c | ||
6150 | +++ b/drivers/pci/msi.c | ||
6151 | @@ -1294,19 +1294,24 @@ EXPORT_SYMBOL(pci_free_irq_vectors); | ||
6152 | |||
6153 | /** | ||
6154 | * pci_irq_vector - return Linux IRQ number of a device vector | ||
6155 | - * @dev: PCI device to operate on | ||
6156 | - * @nr: device-relative interrupt vector index (0-based). | ||
6157 | + * @dev: PCI device to operate on | ||
6158 | + * @nr: Interrupt vector index (0-based) | ||
6159 | + * | ||
6160 | + * @nr has the following meanings depending on the interrupt mode: | ||
6161 | + * MSI-X: The index in the MSI-X vector table | ||
6162 | + * MSI: The index of the enabled MSI vectors | ||
6163 | + * INTx: Must be 0 | ||
6164 | + * | ||
6165 | + * Return: The Linux interrupt number or -EINVAl if @nr is out of range. | ||
6166 | */ | ||
6167 | int pci_irq_vector(struct pci_dev *dev, unsigned int nr) | ||
6168 | { | ||
6169 | if (dev->msix_enabled) { | ||
6170 | struct msi_desc *entry; | ||
6171 | - int i = 0; | ||
6172 | |||
6173 | for_each_pci_msi_entry(entry, dev) { | ||
6174 | - if (i == nr) | ||
6175 | + if (entry->msi_attrib.entry_nr == nr) | ||
6176 | return entry->irq; | ||
6177 | - i++; | ||
6178 | } | ||
6179 | WARN_ON_ONCE(1); | ||
6180 | return -EINVAL; | ||
6181 | @@ -1330,17 +1335,22 @@ EXPORT_SYMBOL(pci_irq_vector); | ||
6182 | * pci_irq_get_affinity - return the affinity of a particular MSI vector | ||
6183 | * @dev: PCI device to operate on | ||
6184 | * @nr: device-relative interrupt vector index (0-based). | ||
6185 | + * | ||
6186 | + * @nr has the following meanings depending on the interrupt mode: | ||
6187 | + * MSI-X: The index in the MSI-X vector table | ||
6188 | + * MSI: The index of the enabled MSI vectors | ||
6189 | + * INTx: Must be 0 | ||
6190 | + * | ||
6191 | + * Return: A cpumask pointer or NULL if @nr is out of range | ||
6192 | */ | ||
6193 | const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) | ||
6194 | { | ||
6195 | if (dev->msix_enabled) { | ||
6196 | struct msi_desc *entry; | ||
6197 | - int i = 0; | ||
6198 | |||
6199 | for_each_pci_msi_entry(entry, dev) { | ||
6200 | - if (i == nr) | ||
6201 | + if (entry->msi_attrib.entry_nr == nr) | ||
6202 | return &entry->affinity->mask; | ||
6203 | - i++; | ||
6204 | } | ||
6205 | WARN_ON_ONCE(1); | ||
6206 | return NULL; | ||
6207 | diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c | ||
6208 | index 3026346ccb18c..0ca3b5eef53a7 100644 | ||
6209 | --- a/drivers/pci/pci-bridge-emul.c | ||
6210 | +++ b/drivers/pci/pci-bridge-emul.c | ||
6211 | @@ -287,11 +287,9 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge, | ||
6212 | |||
6213 | if (bridge->has_pcie) { | ||
6214 | bridge->conf.capabilities_pointer = PCI_CAP_PCIE_START; | ||
6215 | + bridge->conf.status |= cpu_to_le16(PCI_STATUS_CAP_LIST); | ||
6216 | bridge->pcie_conf.cap_id = PCI_CAP_ID_EXP; | ||
6217 | - /* Set PCIe v2, root port, slot support */ | ||
6218 | - bridge->pcie_conf.cap = | ||
6219 | - cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | | ||
6220 | - PCI_EXP_FLAGS_SLOT); | ||
6221 | + bridge->pcie_conf.cap |= cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); | ||
6222 | bridge->pcie_cap_regs_behavior = | ||
6223 | kmemdup(pcie_cap_regs_behavior, | ||
6224 | sizeof(pcie_cap_regs_behavior), | ||
6225 | @@ -300,6 +298,27 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge, | ||
6226 | kfree(bridge->pci_regs_behavior); | ||
6227 | return -ENOMEM; | ||
6228 | } | ||
6229 | + /* These bits are applicable only for PCI and reserved on PCIe */ | ||
6230 | + bridge->pci_regs_behavior[PCI_CACHE_LINE_SIZE / 4].ro &= | ||
6231 | + ~GENMASK(15, 8); | ||
6232 | + bridge->pci_regs_behavior[PCI_COMMAND / 4].ro &= | ||
6233 | + ~((PCI_COMMAND_SPECIAL | PCI_COMMAND_INVALIDATE | | ||
6234 | + PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_WAIT | | ||
6235 | + PCI_COMMAND_FAST_BACK) | | ||
6236 | + (PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | | ||
6237 | + PCI_STATUS_DEVSEL_MASK) << 16); | ||
6238 | + bridge->pci_regs_behavior[PCI_PRIMARY_BUS / 4].ro &= | ||
6239 | + ~GENMASK(31, 24); | ||
6240 | + bridge->pci_regs_behavior[PCI_IO_BASE / 4].ro &= | ||
6241 | + ~((PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | | ||
6242 | + PCI_STATUS_DEVSEL_MASK) << 16); | ||
6243 | + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].rw &= | ||
6244 | + ~((PCI_BRIDGE_CTL_MASTER_ABORT | | ||
6245 | + BIT(8) | BIT(9) | BIT(11)) << 16); | ||
6246 | + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].ro &= | ||
6247 | + ~((PCI_BRIDGE_CTL_FAST_BACK) << 16); | ||
6248 | + bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].w1c &= | ||
6249 | + ~(BIT(10) << 16); | ||
6250 | } | ||
6251 | |||
6252 | if (flags & PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR) { | ||
6253 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | ||
6254 | index cf3986d4413f7..2a4bc8df85639 100644 | ||
6255 | --- a/drivers/pci/quirks.c | ||
6256 | +++ b/drivers/pci/quirks.c | ||
6257 | @@ -4134,6 +4134,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120, | ||
6258 | quirk_dma_func1_alias); | ||
6259 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, | ||
6260 | quirk_dma_func1_alias); | ||
6261 | +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c136 */ | ||
6262 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, | ||
6263 | + quirk_dma_func1_alias); | ||
6264 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, | ||
6265 | quirk_dma_func1_alias); | ||
6266 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ | ||
6267 | diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c | ||
6268 | index e211e2619680c..f70197154a362 100644 | ||
6269 | --- a/drivers/pcmcia/cs.c | ||
6270 | +++ b/drivers/pcmcia/cs.c | ||
6271 | @@ -666,18 +666,16 @@ static int pccardd(void *__skt) | ||
6272 | if (events || sysfs_events) | ||
6273 | continue; | ||
6274 | |||
6275 | + set_current_state(TASK_INTERRUPTIBLE); | ||
6276 | if (kthread_should_stop()) | ||
6277 | break; | ||
6278 | |||
6279 | - set_current_state(TASK_INTERRUPTIBLE); | ||
6280 | - | ||
6281 | schedule(); | ||
6282 | |||
6283 | - /* make sure we are running */ | ||
6284 | - __set_current_state(TASK_RUNNING); | ||
6285 | - | ||
6286 | try_to_freeze(); | ||
6287 | } | ||
6288 | + /* make sure we are running before we exit */ | ||
6289 | + __set_current_state(TASK_RUNNING); | ||
6290 | |||
6291 | /* shut down socket, if a device is still present */ | ||
6292 | if (skt->state & SOCKET_PRESENT) { | ||
6293 | diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c | ||
6294 | index 9e6922c08ef62..3a512513cb32f 100644 | ||
6295 | --- a/drivers/pcmcia/rsrc_nonstatic.c | ||
6296 | +++ b/drivers/pcmcia/rsrc_nonstatic.c | ||
6297 | @@ -690,6 +690,9 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s, | ||
6298 | unsigned long min = base; | ||
6299 | int ret; | ||
6300 | |||
6301 | + if (!res) | ||
6302 | + return NULL; | ||
6303 | + | ||
6304 | data.mask = align - 1; | ||
6305 | data.offset = base & data.mask; | ||
6306 | data.map = &s_data->io_db; | ||
6307 | @@ -809,6 +812,9 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num, | ||
6308 | unsigned long min, max; | ||
6309 | int ret, i, j; | ||
6310 | |||
6311 | + if (!res) | ||
6312 | + return NULL; | ||
6313 | + | ||
6314 | low = low || !(s->features & SS_CAP_PAGE_REGS); | ||
6315 | |||
6316 | data.mask = align - 1; | ||
6317 | diff --git a/drivers/phy/socionext/phy-uniphier-usb3ss.c b/drivers/phy/socionext/phy-uniphier-usb3ss.c | ||
6318 | index a7577e316baf5..e63648b5c7547 100644 | ||
6319 | --- a/drivers/phy/socionext/phy-uniphier-usb3ss.c | ||
6320 | +++ b/drivers/phy/socionext/phy-uniphier-usb3ss.c | ||
6321 | @@ -22,11 +22,13 @@ | ||
6322 | #include <linux/reset.h> | ||
6323 | |||
6324 | #define SSPHY_TESTI 0x0 | ||
6325 | -#define SSPHY_TESTO 0x4 | ||
6326 | #define TESTI_DAT_MASK GENMASK(13, 6) | ||
6327 | #define TESTI_ADR_MASK GENMASK(5, 1) | ||
6328 | #define TESTI_WR_EN BIT(0) | ||
6329 | |||
6330 | +#define SSPHY_TESTO 0x4 | ||
6331 | +#define TESTO_DAT_MASK GENMASK(7, 0) | ||
6332 | + | ||
6333 | #define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) } | ||
6334 | |||
6335 | #define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */ | ||
6336 | @@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_u3ssphy_priv *priv, | ||
6337 | val = FIELD_PREP(TESTI_DAT_MASK, 1); | ||
6338 | val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); | ||
6339 | uniphier_u3ssphy_testio_write(priv, val); | ||
6340 | - val = readl(priv->base + SSPHY_TESTO); | ||
6341 | + val = readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK; | ||
6342 | |||
6343 | /* update value */ | ||
6344 | - val &= ~FIELD_PREP(TESTI_DAT_MASK, field_mask); | ||
6345 | + val &= ~field_mask; | ||
6346 | data = field_mask & (p->value << p->field.lsb); | ||
6347 | - val = FIELD_PREP(TESTI_DAT_MASK, data); | ||
6348 | + val = FIELD_PREP(TESTI_DAT_MASK, data | val); | ||
6349 | val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); | ||
6350 | uniphier_u3ssphy_testio_write(priv, val); | ||
6351 | uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN); | ||
6352 | diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c | ||
6353 | index 9d1ec8d677de6..5afe55119fe65 100644 | ||
6354 | --- a/drivers/power/supply/bq25890_charger.c | ||
6355 | +++ b/drivers/power/supply/bq25890_charger.c | ||
6356 | @@ -531,12 +531,12 @@ static void bq25890_handle_state_change(struct bq25890_device *bq, | ||
6357 | |||
6358 | if (!new_state->online) { /* power removed */ | ||
6359 | /* disable ADC */ | ||
6360 | - ret = bq25890_field_write(bq, F_CONV_START, 0); | ||
6361 | + ret = bq25890_field_write(bq, F_CONV_RATE, 0); | ||
6362 | if (ret < 0) | ||
6363 | goto error; | ||
6364 | } else if (!old_state.online) { /* power inserted */ | ||
6365 | /* enable ADC, to have control of charge current/voltage */ | ||
6366 | - ret = bq25890_field_write(bq, F_CONV_START, 1); | ||
6367 | + ret = bq25890_field_write(bq, F_CONV_RATE, 1); | ||
6368 | if (ret < 0) | ||
6369 | goto error; | ||
6370 | } | ||
6371 | diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c | ||
6372 | index 3b0828c79e2b5..e6601c28ab431 100644 | ||
6373 | --- a/drivers/regulator/qcom_smd-regulator.c | ||
6374 | +++ b/drivers/regulator/qcom_smd-regulator.c | ||
6375 | @@ -9,6 +9,7 @@ | ||
6376 | #include <linux/of_device.h> | ||
6377 | #include <linux/platform_device.h> | ||
6378 | #include <linux/regulator/driver.h> | ||
6379 | +#include <linux/regulator/of_regulator.h> | ||
6380 | #include <linux/soc/qcom/smd-rpm.h> | ||
6381 | |||
6382 | struct qcom_rpm_reg { | ||
6383 | @@ -776,52 +777,91 @@ static const struct of_device_id rpm_of_match[] = { | ||
6384 | }; | ||
6385 | MODULE_DEVICE_TABLE(of, rpm_of_match); | ||
6386 | |||
6387 | -static int rpm_reg_probe(struct platform_device *pdev) | ||
6388 | +/** | ||
6389 | + * rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-regulator | ||
6390 | + * @vreg: Pointer to the individual qcom_smd-regulator resource | ||
6391 | + * @dev: Pointer to the top level qcom_smd-regulator PMIC device | ||
6392 | + * @node: Pointer to the individual qcom_smd-regulator resource | ||
6393 | + * device node | ||
6394 | + * @rpm: Pointer to the rpm bus node | ||
6395 | + * @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator | ||
6396 | + * resources defined for the top level PMIC device | ||
6397 | + * | ||
6398 | + * Return: 0 on success, errno on failure | ||
6399 | + */ | ||
6400 | +static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct device *dev, | ||
6401 | + struct device_node *node, struct qcom_smd_rpm *rpm, | ||
6402 | + const struct rpm_regulator_data *pmic_rpm_data) | ||
6403 | { | ||
6404 | - const struct rpm_regulator_data *reg; | ||
6405 | - const struct of_device_id *match; | ||
6406 | - struct regulator_config config = { }; | ||
6407 | + struct regulator_config config = {}; | ||
6408 | + const struct rpm_regulator_data *rpm_data; | ||
6409 | struct regulator_dev *rdev; | ||
6410 | + int ret; | ||
6411 | + | ||
6412 | + for (rpm_data = pmic_rpm_data; rpm_data->name; rpm_data++) | ||
6413 | + if (of_node_name_eq(node, rpm_data->name)) | ||
6414 | + break; | ||
6415 | + | ||
6416 | + if (!rpm_data->name) { | ||
6417 | + dev_err(dev, "Unknown regulator %pOFn\n", node); | ||
6418 | + return -EINVAL; | ||
6419 | + } | ||
6420 | + | ||
6421 | + vreg->dev = dev; | ||
6422 | + vreg->rpm = rpm; | ||
6423 | + vreg->type = rpm_data->type; | ||
6424 | + vreg->id = rpm_data->id; | ||
6425 | + | ||
6426 | + memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc)); | ||
6427 | + vreg->desc.name = rpm_data->name; | ||
6428 | + vreg->desc.supply_name = rpm_data->supply; | ||
6429 | + vreg->desc.owner = THIS_MODULE; | ||
6430 | + vreg->desc.type = REGULATOR_VOLTAGE; | ||
6431 | + vreg->desc.of_match = rpm_data->name; | ||
6432 | + | ||
6433 | + config.dev = dev; | ||
6434 | + config.of_node = node; | ||
6435 | + config.driver_data = vreg; | ||
6436 | + | ||
6437 | + rdev = devm_regulator_register(dev, &vreg->desc, &config); | ||
6438 | + if (IS_ERR(rdev)) { | ||
6439 | + ret = PTR_ERR(rdev); | ||
6440 | + dev_err(dev, "%pOFn: devm_regulator_register() failed, ret=%d\n", node, ret); | ||
6441 | + return ret; | ||
6442 | + } | ||
6443 | + | ||
6444 | + return 0; | ||
6445 | +} | ||
6446 | + | ||
6447 | +static int rpm_reg_probe(struct platform_device *pdev) | ||
6448 | +{ | ||
6449 | + struct device *dev = &pdev->dev; | ||
6450 | + const struct rpm_regulator_data *vreg_data; | ||
6451 | + struct device_node *node; | ||
6452 | struct qcom_rpm_reg *vreg; | ||
6453 | struct qcom_smd_rpm *rpm; | ||
6454 | + int ret; | ||
6455 | |||
6456 | rpm = dev_get_drvdata(pdev->dev.parent); | ||
6457 | if (!rpm) { | ||
6458 | - dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); | ||
6459 | + dev_err(&pdev->dev, "Unable to retrieve handle to rpm\n"); | ||
6460 | return -ENODEV; | ||
6461 | } | ||
6462 | |||
6463 | - match = of_match_device(rpm_of_match, &pdev->dev); | ||
6464 | - if (!match) { | ||
6465 | - dev_err(&pdev->dev, "failed to match device\n"); | ||
6466 | + vreg_data = of_device_get_match_data(dev); | ||
6467 | + if (!vreg_data) | ||
6468 | return -ENODEV; | ||
6469 | - } | ||
6470 | |||
6471 | - for (reg = match->data; reg->name; reg++) { | ||
6472 | + for_each_available_child_of_node(dev->of_node, node) { | ||
6473 | vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); | ||
6474 | if (!vreg) | ||
6475 | return -ENOMEM; | ||
6476 | |||
6477 | - vreg->dev = &pdev->dev; | ||
6478 | - vreg->type = reg->type; | ||
6479 | - vreg->id = reg->id; | ||
6480 | - vreg->rpm = rpm; | ||
6481 | - | ||
6482 | - memcpy(&vreg->desc, reg->desc, sizeof(vreg->desc)); | ||
6483 | - | ||
6484 | - vreg->desc.id = -1; | ||
6485 | - vreg->desc.owner = THIS_MODULE; | ||
6486 | - vreg->desc.type = REGULATOR_VOLTAGE; | ||
6487 | - vreg->desc.name = reg->name; | ||
6488 | - vreg->desc.supply_name = reg->supply; | ||
6489 | - vreg->desc.of_match = reg->name; | ||
6490 | - | ||
6491 | - config.dev = &pdev->dev; | ||
6492 | - config.driver_data = vreg; | ||
6493 | - rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config); | ||
6494 | - if (IS_ERR(rdev)) { | ||
6495 | - dev_err(&pdev->dev, "failed to register %s\n", reg->name); | ||
6496 | - return PTR_ERR(rdev); | ||
6497 | + ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); | ||
6498 | + | ||
6499 | + if (ret < 0) { | ||
6500 | + of_node_put(node); | ||
6501 | + return ret; | ||
6502 | } | ||
6503 | } | ||
6504 | |||
6505 | diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c | ||
6506 | index e330ec4dfc337..c1d4990beab02 100644 | ||
6507 | --- a/drivers/rpmsg/rpmsg_core.c | ||
6508 | +++ b/drivers/rpmsg/rpmsg_core.c | ||
6509 | @@ -473,13 +473,25 @@ static int rpmsg_dev_probe(struct device *dev) | ||
6510 | err = rpdrv->probe(rpdev); | ||
6511 | if (err) { | ||
6512 | dev_err(dev, "%s: failed: %d\n", __func__, err); | ||
6513 | - if (ept) | ||
6514 | - rpmsg_destroy_ept(ept); | ||
6515 | - goto out; | ||
6516 | + goto destroy_ept; | ||
6517 | } | ||
6518 | |||
6519 | - if (ept && rpdev->ops->announce_create) | ||
6520 | + if (ept && rpdev->ops->announce_create) { | ||
6521 | err = rpdev->ops->announce_create(rpdev); | ||
6522 | + if (err) { | ||
6523 | + dev_err(dev, "failed to announce creation\n"); | ||
6524 | + goto remove_rpdev; | ||
6525 | + } | ||
6526 | + } | ||
6527 | + | ||
6528 | + return 0; | ||
6529 | + | ||
6530 | +remove_rpdev: | ||
6531 | + if (rpdrv->remove) | ||
6532 | + rpdrv->remove(rpdev); | ||
6533 | +destroy_ept: | ||
6534 | + if (ept) | ||
6535 | + rpmsg_destroy_ept(ept); | ||
6536 | out: | ||
6537 | return err; | ||
6538 | } | ||
6539 | diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c | ||
6540 | index cb28bbdc9e17f..c0dc03ffa8173 100644 | ||
6541 | --- a/drivers/rtc/rtc-cmos.c | ||
6542 | +++ b/drivers/rtc/rtc-cmos.c | ||
6543 | @@ -463,7 +463,10 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) | ||
6544 | min = t->time.tm_min; | ||
6545 | sec = t->time.tm_sec; | ||
6546 | |||
6547 | + spin_lock_irq(&rtc_lock); | ||
6548 | rtc_control = CMOS_READ(RTC_CONTROL); | ||
6549 | + spin_unlock_irq(&rtc_lock); | ||
6550 | + | ||
6551 | if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | ||
6552 | /* Writing 0xff means "don't care" or "match all". */ | ||
6553 | mon = (mon <= 12) ? bin2bcd(mon) : 0xff; | ||
6554 | diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c | ||
6555 | index d2f1d8f754bf3..cf8119b6d3204 100644 | ||
6556 | --- a/drivers/rtc/rtc-pxa.c | ||
6557 | +++ b/drivers/rtc/rtc-pxa.c | ||
6558 | @@ -330,6 +330,10 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) | ||
6559 | if (sa1100_rtc->irq_alarm < 0) | ||
6560 | return -ENXIO; | ||
6561 | |||
6562 | + sa1100_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); | ||
6563 | + if (IS_ERR(sa1100_rtc->rtc)) | ||
6564 | + return PTR_ERR(sa1100_rtc->rtc); | ||
6565 | + | ||
6566 | pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start, | ||
6567 | resource_size(pxa_rtc->ress)); | ||
6568 | if (!pxa_rtc->base) { | ||
6569 | diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h | ||
6570 | index 8943d42fc406e..0b69f4f713778 100644 | ||
6571 | --- a/drivers/scsi/lpfc/lpfc.h | ||
6572 | +++ b/drivers/scsi/lpfc/lpfc.h | ||
6573 | @@ -735,7 +735,6 @@ struct lpfc_hba { | ||
6574 | #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ | ||
6575 | #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ | ||
6576 | #define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */ | ||
6577 | -#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */ | ||
6578 | #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ | ||
6579 | #define HBA_FORCED_LINK_SPEED 0x40000 /* | ||
6580 | * Firmware supports Forced Link Speed | ||
6581 | @@ -744,6 +743,7 @@ struct lpfc_hba { | ||
6582 | #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ | ||
6583 | #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ | ||
6584 | |||
6585 | + struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ | ||
6586 | uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ | ||
6587 | struct lpfc_dmabuf slim2p; | ||
6588 | |||
6589 | diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c | ||
6590 | index f0ecfe565660a..1c541a600149b 100644 | ||
6591 | --- a/drivers/scsi/lpfc/lpfc_attr.c | ||
6592 | +++ b/drivers/scsi/lpfc/lpfc_attr.c | ||
6593 | @@ -1537,25 +1537,25 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) | ||
6594 | before_fc_flag = phba->pport->fc_flag; | ||
6595 | sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; | ||
6596 | |||
6597 | - /* Disable SR-IOV virtual functions if enabled */ | ||
6598 | - if (phba->cfg_sriov_nr_virtfn) { | ||
6599 | - pci_disable_sriov(pdev); | ||
6600 | - phba->cfg_sriov_nr_virtfn = 0; | ||
6601 | - } | ||
6602 | + if (opcode == LPFC_FW_DUMP) { | ||
6603 | + init_completion(&online_compl); | ||
6604 | + phba->fw_dump_cmpl = &online_compl; | ||
6605 | + } else { | ||
6606 | + /* Disable SR-IOV virtual functions if enabled */ | ||
6607 | + if (phba->cfg_sriov_nr_virtfn) { | ||
6608 | + pci_disable_sriov(pdev); | ||
6609 | + phba->cfg_sriov_nr_virtfn = 0; | ||
6610 | + } | ||
6611 | |||
6612 | - if (opcode == LPFC_FW_DUMP) | ||
6613 | - phba->hba_flag |= HBA_FW_DUMP_OP; | ||
6614 | + status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); | ||
6615 | |||
6616 | - status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); | ||
6617 | + if (status != 0) | ||
6618 | + return status; | ||
6619 | |||
6620 | - if (status != 0) { | ||
6621 | - phba->hba_flag &= ~HBA_FW_DUMP_OP; | ||
6622 | - return status; | ||
6623 | + /* wait for the device to be quiesced before firmware reset */ | ||
6624 | + msleep(100); | ||
6625 | } | ||
6626 | |||
6627 | - /* wait for the device to be quiesced before firmware reset */ | ||
6628 | - msleep(100); | ||
6629 | - | ||
6630 | reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + | ||
6631 | LPFC_CTL_PDEV_CTL_OFFSET); | ||
6632 | |||
6633 | @@ -1584,24 +1584,42 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) | ||
6634 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
6635 | "3153 Fail to perform the requested " | ||
6636 | "access: x%x\n", reg_val); | ||
6637 | + if (phba->fw_dump_cmpl) | ||
6638 | + phba->fw_dump_cmpl = NULL; | ||
6639 | return rc; | ||
6640 | } | ||
6641 | |||
6642 | /* keep the original port state */ | ||
6643 | - if (before_fc_flag & FC_OFFLINE_MODE) | ||
6644 | - goto out; | ||
6645 | - | ||
6646 | - init_completion(&online_compl); | ||
6647 | - job_posted = lpfc_workq_post_event(phba, &status, &online_compl, | ||
6648 | - LPFC_EVT_ONLINE); | ||
6649 | - if (!job_posted) | ||
6650 | + if (before_fc_flag & FC_OFFLINE_MODE) { | ||
6651 | + if (phba->fw_dump_cmpl) | ||
6652 | + phba->fw_dump_cmpl = NULL; | ||
6653 | goto out; | ||
6654 | + } | ||
6655 | |||
6656 | - wait_for_completion(&online_compl); | ||
6657 | + /* Firmware dump will trigger an HA_ERATT event, and | ||
6658 | + * lpfc_handle_eratt_s4 routine already handles bringing the port back | ||
6659 | + * online. | ||
6660 | + */ | ||
6661 | + if (opcode == LPFC_FW_DUMP) { | ||
6662 | + wait_for_completion(phba->fw_dump_cmpl); | ||
6663 | + } else { | ||
6664 | + init_completion(&online_compl); | ||
6665 | + job_posted = lpfc_workq_post_event(phba, &status, &online_compl, | ||
6666 | + LPFC_EVT_ONLINE); | ||
6667 | + if (!job_posted) | ||
6668 | + goto out; | ||
6669 | |||
6670 | + wait_for_completion(&online_compl); | ||
6671 | + } | ||
6672 | out: | ||
6673 | /* in any case, restore the virtual functions enabled as before */ | ||
6674 | if (sriov_nr_virtfn) { | ||
6675 | + /* If fw_dump was performed, first disable to clean up */ | ||
6676 | + if (opcode == LPFC_FW_DUMP) { | ||
6677 | + pci_disable_sriov(pdev); | ||
6678 | + phba->cfg_sriov_nr_virtfn = 0; | ||
6679 | + } | ||
6680 | + | ||
6681 | sriov_err = | ||
6682 | lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn); | ||
6683 | if (!sriov_err) | ||
6684 | diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c | ||
6685 | index 0dc1d56ff4709..0abce779fbb13 100644 | ||
6686 | --- a/drivers/scsi/lpfc/lpfc_hbadisc.c | ||
6687 | +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | ||
6688 | @@ -628,10 +628,16 @@ lpfc_work_done(struct lpfc_hba *phba) | ||
6689 | if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) | ||
6690 | lpfc_sli4_post_async_mbox(phba); | ||
6691 | |||
6692 | - if (ha_copy & HA_ERATT) | ||
6693 | + if (ha_copy & HA_ERATT) { | ||
6694 | /* Handle the error attention event */ | ||
6695 | lpfc_handle_eratt(phba); | ||
6696 | |||
6697 | + if (phba->fw_dump_cmpl) { | ||
6698 | + complete(phba->fw_dump_cmpl); | ||
6699 | + phba->fw_dump_cmpl = NULL; | ||
6700 | + } | ||
6701 | + } | ||
6702 | + | ||
6703 | if (ha_copy & HA_MBATT) | ||
6704 | lpfc_sli_handle_mb_event(phba); | ||
6705 | |||
6706 | diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c | ||
6707 | index 51bab0979527b..bd908dd273078 100644 | ||
6708 | --- a/drivers/scsi/lpfc/lpfc_sli.c | ||
6709 | +++ b/drivers/scsi/lpfc/lpfc_sli.c | ||
6710 | @@ -4498,12 +4498,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) | ||
6711 | phba->fcf.fcf_flag = 0; | ||
6712 | spin_unlock_irq(&phba->hbalock); | ||
6713 | |||
6714 | - /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */ | ||
6715 | - if (phba->hba_flag & HBA_FW_DUMP_OP) { | ||
6716 | - phba->hba_flag &= ~HBA_FW_DUMP_OP; | ||
6717 | - return rc; | ||
6718 | - } | ||
6719 | - | ||
6720 | /* Now physically reset the device */ | ||
6721 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | ||
6722 | "0389 Performing PCI function reset!\n"); | ||
6723 | diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c | ||
6724 | index c19ea7ab54cbd..d9a18124cfc9d 100644 | ||
6725 | --- a/drivers/scsi/scsi_debugfs.c | ||
6726 | +++ b/drivers/scsi/scsi_debugfs.c | ||
6727 | @@ -10,6 +10,7 @@ static const char *const scsi_cmd_flags[] = { | ||
6728 | SCSI_CMD_FLAG_NAME(TAGGED), | ||
6729 | SCSI_CMD_FLAG_NAME(UNCHECKED_ISA_DMA), | ||
6730 | SCSI_CMD_FLAG_NAME(INITIALIZED), | ||
6731 | + SCSI_CMD_FLAG_NAME(LAST), | ||
6732 | }; | ||
6733 | #undef SCSI_CMD_FLAG_NAME | ||
6734 | |||
6735 | diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c | ||
6736 | index 279dea628620d..310da62cda263 100644 | ||
6737 | --- a/drivers/scsi/sr.c | ||
6738 | +++ b/drivers/scsi/sr.c | ||
6739 | @@ -887,7 +887,7 @@ static void get_capabilities(struct scsi_cd *cd) | ||
6740 | |||
6741 | |||
6742 | /* allocate transfer buffer */ | ||
6743 | - buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); | ||
6744 | + buffer = kmalloc(512, GFP_KERNEL); | ||
6745 | if (!buffer) { | ||
6746 | sr_printk(KERN_ERR, cd, "out of memory.\n"); | ||
6747 | return; | ||
6748 | diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c | ||
6749 | index b9db2ec6d0361..996bccadd3866 100644 | ||
6750 | --- a/drivers/scsi/sr_vendor.c | ||
6751 | +++ b/drivers/scsi/sr_vendor.c | ||
6752 | @@ -113,7 +113,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) | ||
6753 | if (cd->vendor == VENDOR_TOSHIBA) | ||
6754 | density = (blocklength > 2048) ? 0x81 : 0x83; | ||
6755 | |||
6756 | - buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); | ||
6757 | + buffer = kmalloc(512, GFP_KERNEL); | ||
6758 | if (!buffer) | ||
6759 | return -ENOMEM; | ||
6760 | |||
6761 | @@ -161,7 +161,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) | ||
6762 | if (cd->cdi.mask & CDC_MULTI_SESSION) | ||
6763 | return 0; | ||
6764 | |||
6765 | - buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); | ||
6766 | + buffer = kmalloc(512, GFP_KERNEL); | ||
6767 | if (!buffer) | ||
6768 | return -ENOMEM; | ||
6769 | |||
6770 | diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g210-pci.c | ||
6771 | index 67a6a61154b71..4e471484539d2 100644 | ||
6772 | --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c | ||
6773 | +++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c | ||
6774 | @@ -135,7 +135,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
6775 | return err; | ||
6776 | } | ||
6777 | |||
6778 | - pci_set_drvdata(pdev, hba); | ||
6779 | pm_runtime_put_noidle(&pdev->dev); | ||
6780 | pm_runtime_allow(&pdev->dev); | ||
6781 | |||
6782 | diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c | ||
6783 | index 8d40dc918f4e1..10eec501f6b39 100644 | ||
6784 | --- a/drivers/scsi/ufs/ufshcd-pltfrm.c | ||
6785 | +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c | ||
6786 | @@ -436,8 +436,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, | ||
6787 | goto dealloc_host; | ||
6788 | } | ||
6789 | |||
6790 | - platform_set_drvdata(pdev, hba); | ||
6791 | - | ||
6792 | pm_runtime_set_active(&pdev->dev); | ||
6793 | pm_runtime_enable(&pdev->dev); | ||
6794 | |||
6795 | diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c | ||
6796 | index 29c7a76d2c658..ebf7ae1ef70d4 100644 | ||
6797 | --- a/drivers/scsi/ufs/ufshcd.c | ||
6798 | +++ b/drivers/scsi/ufs/ufshcd.c | ||
6799 | @@ -8328,6 +8328,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | ||
6800 | struct Scsi_Host *host = hba->host; | ||
6801 | struct device *dev = hba->dev; | ||
6802 | |||
6803 | + /* | ||
6804 | + * dev_set_drvdata() must be called before any callbacks are registered | ||
6805 | + * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, | ||
6806 | + * sysfs). | ||
6807 | + */ | ||
6808 | + dev_set_drvdata(dev, hba); | ||
6809 | + | ||
6810 | if (!mmio_base) { | ||
6811 | dev_err(hba->dev, | ||
6812 | "Invalid memory reference for mmio_base is NULL\n"); | ||
6813 | diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c | ||
6814 | index 75f25f08245fd..71afa2a99b17f 100644 | ||
6815 | --- a/drivers/soc/mediatek/mtk-scpsys.c | ||
6816 | +++ b/drivers/soc/mediatek/mtk-scpsys.c | ||
6817 | @@ -333,12 +333,17 @@ out: | ||
6818 | return ret; | ||
6819 | } | ||
6820 | |||
6821 | -static void init_clks(struct platform_device *pdev, struct clk **clk) | ||
6822 | +static int init_clks(struct platform_device *pdev, struct clk **clk) | ||
6823 | { | ||
6824 | int i; | ||
6825 | |||
6826 | - for (i = CLK_NONE + 1; i < CLK_MAX; i++) | ||
6827 | + for (i = CLK_NONE + 1; i < CLK_MAX; i++) { | ||
6828 | clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); | ||
6829 | + if (IS_ERR(clk[i])) | ||
6830 | + return PTR_ERR(clk[i]); | ||
6831 | + } | ||
6832 | + | ||
6833 | + return 0; | ||
6834 | } | ||
6835 | |||
6836 | static struct scp *init_scp(struct platform_device *pdev, | ||
6837 | @@ -348,7 +353,7 @@ static struct scp *init_scp(struct platform_device *pdev, | ||
6838 | { | ||
6839 | struct genpd_onecell_data *pd_data; | ||
6840 | struct resource *res; | ||
6841 | - int i, j; | ||
6842 | + int i, j, ret; | ||
6843 | struct scp *scp; | ||
6844 | struct clk *clk[CLK_MAX]; | ||
6845 | |||
6846 | @@ -403,7 +408,9 @@ static struct scp *init_scp(struct platform_device *pdev, | ||
6847 | |||
6848 | pd_data->num_domains = num; | ||
6849 | |||
6850 | - init_clks(pdev, clk); | ||
6851 | + ret = init_clks(pdev, clk); | ||
6852 | + if (ret) | ||
6853 | + return ERR_PTR(ret); | ||
6854 | |||
6855 | for (i = 0; i < num; i++) { | ||
6856 | struct scp_domain *scpd = &scp->domains[i]; | ||
6857 | diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c | ||
6858 | index c7b0399802913..cae934464f3dd 100644 | ||
6859 | --- a/drivers/spi/spi-meson-spifc.c | ||
6860 | +++ b/drivers/spi/spi-meson-spifc.c | ||
6861 | @@ -349,6 +349,7 @@ static int meson_spifc_probe(struct platform_device *pdev) | ||
6862 | return 0; | ||
6863 | out_clk: | ||
6864 | clk_disable_unprepare(spifc->clk); | ||
6865 | + pm_runtime_disable(spifc->dev); | ||
6866 | out_err: | ||
6867 | spi_master_put(master); | ||
6868 | return ret; | ||
6869 | diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c | ||
6870 | index a8cfea957868a..3e2fbcd20598a 100644 | ||
6871 | --- a/drivers/staging/greybus/audio_topology.c | ||
6872 | +++ b/drivers/staging/greybus/audio_topology.c | ||
6873 | @@ -145,6 +145,9 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb, | ||
6874 | |||
6875 | items = le32_to_cpu(gbenum->items); | ||
6876 | strings = devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); | ||
6877 | + if (!strings) | ||
6878 | + return NULL; | ||
6879 | + | ||
6880 | data = gbenum->names; | ||
6881 | |||
6882 | for (i = 0; i < items; i++) { | ||
6883 | @@ -662,6 +665,8 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb, | ||
6884 | /* since count=1, and reg is dummy */ | ||
6885 | gbe->max = le32_to_cpu(gb_enum->items); | ||
6886 | gbe->texts = gb_generate_enum_strings(gb, gb_enum); | ||
6887 | + if (!gbe->texts) | ||
6888 | + return -ENOMEM; | ||
6889 | |||
6890 | /* debug enum info */ | ||
6891 | dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, | ||
6892 | @@ -871,6 +876,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb, | ||
6893 | /* since count=1, and reg is dummy */ | ||
6894 | gbe->max = le32_to_cpu(gb_enum->items); | ||
6895 | gbe->texts = gb_generate_enum_strings(gb, gb_enum); | ||
6896 | + if (!gbe->texts) | ||
6897 | + return -ENOMEM; | ||
6898 | |||
6899 | /* debug enum info */ | ||
6900 | dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, | ||
6901 | @@ -1081,6 +1088,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, | ||
6902 | csize += le16_to_cpu(gbenum->names_length); | ||
6903 | control->texts = (const char * const *) | ||
6904 | gb_generate_enum_strings(module, gbenum); | ||
6905 | + if (!control->texts) { | ||
6906 | + ret = -ENOMEM; | ||
6907 | + goto error; | ||
6908 | + } | ||
6909 | control->items = le32_to_cpu(gbenum->items); | ||
6910 | } else { | ||
6911 | csize = sizeof(struct gb_audio_control); | ||
6912 | @@ -1190,6 +1201,10 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, | ||
6913 | csize += le16_to_cpu(gbenum->names_length); | ||
6914 | control->texts = (const char * const *) | ||
6915 | gb_generate_enum_strings(module, gbenum); | ||
6916 | + if (!control->texts) { | ||
6917 | + ret = -ENOMEM; | ||
6918 | + goto error; | ||
6919 | + } | ||
6920 | control->items = le32_to_cpu(gbenum->items); | ||
6921 | } else { | ||
6922 | csize = sizeof(struct gb_audio_control); | ||
6923 | diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c | ||
6924 | index 32e5966ba5c5f..58cf44045b396 100644 | ||
6925 | --- a/drivers/staging/media/hantro/hantro_drv.c | ||
6926 | +++ b/drivers/staging/media/hantro/hantro_drv.c | ||
6927 | @@ -823,7 +823,7 @@ static int hantro_probe(struct platform_device *pdev) | ||
6928 | ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks); | ||
6929 | if (ret) { | ||
6930 | dev_err(&pdev->dev, "Failed to prepare clocks\n"); | ||
6931 | - return ret; | ||
6932 | + goto err_pm_disable; | ||
6933 | } | ||
6934 | |||
6935 | ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev); | ||
6936 | @@ -879,6 +879,7 @@ err_v4l2_unreg: | ||
6937 | v4l2_device_unregister(&vpu->v4l2_dev); | ||
6938 | err_clk_unprepare: | ||
6939 | clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); | ||
6940 | +err_pm_disable: | ||
6941 | pm_runtime_dont_use_autosuspend(vpu->dev); | ||
6942 | pm_runtime_disable(vpu->dev); | ||
6943 | return ret; | ||
6944 | diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h | ||
6945 | index 2eeb9a43734e3..49bf3ad31f912 100644 | ||
6946 | --- a/drivers/staging/rtl8192e/rtllib.h | ||
6947 | +++ b/drivers/staging/rtl8192e/rtllib.h | ||
6948 | @@ -1982,7 +1982,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee); | ||
6949 | void rtllib_stop_send_beacons(struct rtllib_device *ieee); | ||
6950 | void notify_wx_assoc_event(struct rtllib_device *ieee); | ||
6951 | void rtllib_start_ibss(struct rtllib_device *ieee); | ||
6952 | -void rtllib_softmac_init(struct rtllib_device *ieee); | ||
6953 | +int rtllib_softmac_init(struct rtllib_device *ieee); | ||
6954 | void rtllib_softmac_free(struct rtllib_device *ieee); | ||
6955 | void rtllib_disassociate(struct rtllib_device *ieee); | ||
6956 | void rtllib_stop_scan(struct rtllib_device *ieee); | ||
6957 | diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c | ||
6958 | index 64d9feee1f392..f00ac94b2639b 100644 | ||
6959 | --- a/drivers/staging/rtl8192e/rtllib_module.c | ||
6960 | +++ b/drivers/staging/rtl8192e/rtllib_module.c | ||
6961 | @@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) | ||
6962 | err = rtllib_networks_allocate(ieee); | ||
6963 | if (err) { | ||
6964 | pr_err("Unable to allocate beacon storage: %d\n", err); | ||
6965 | - goto failed; | ||
6966 | + goto free_netdev; | ||
6967 | } | ||
6968 | rtllib_networks_initialize(ieee); | ||
6969 | |||
6970 | @@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) | ||
6971 | ieee->hwsec_active = 0; | ||
6972 | |||
6973 | memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); | ||
6974 | - rtllib_softmac_init(ieee); | ||
6975 | + err = rtllib_softmac_init(ieee); | ||
6976 | + if (err) | ||
6977 | + goto free_crypt_info; | ||
6978 | |||
6979 | ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); | ||
6980 | if (!ieee->pHTInfo) | ||
6981 | - return NULL; | ||
6982 | + goto free_softmac; | ||
6983 | |||
6984 | HTUpdateDefaultSetting(ieee); | ||
6985 | HTInitializeHTInfo(ieee); | ||
6986 | @@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv) | ||
6987 | |||
6988 | return dev; | ||
6989 | |||
6990 | - failed: | ||
6991 | +free_softmac: | ||
6992 | + rtllib_softmac_free(ieee); | ||
6993 | +free_crypt_info: | ||
6994 | + lib80211_crypt_info_free(&ieee->crypt_info); | ||
6995 | + rtllib_networks_free(ieee); | ||
6996 | +free_netdev: | ||
6997 | free_netdev(dev); | ||
6998 | + | ||
6999 | return NULL; | ||
7000 | } | ||
7001 | EXPORT_SYMBOL(alloc_rtllib); | ||
7002 | diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c | ||
7003 | index f2f7529e7c80e..4ff8fd694c600 100644 | ||
7004 | --- a/drivers/staging/rtl8192e/rtllib_softmac.c | ||
7005 | +++ b/drivers/staging/rtl8192e/rtllib_softmac.c | ||
7006 | @@ -2952,7 +2952,7 @@ void rtllib_start_protocol(struct rtllib_device *ieee) | ||
7007 | } | ||
7008 | } | ||
7009 | |||
7010 | -void rtllib_softmac_init(struct rtllib_device *ieee) | ||
7011 | +int rtllib_softmac_init(struct rtllib_device *ieee) | ||
7012 | { | ||
7013 | int i; | ||
7014 | |||
7015 | @@ -2963,7 +2963,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee) | ||
7016 | ieee->seq_ctrl[i] = 0; | ||
7017 | ieee->dot11d_info = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); | ||
7018 | if (!ieee->dot11d_info) | ||
7019 | - netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n"); | ||
7020 | + return -ENOMEM; | ||
7021 | + | ||
7022 | ieee->LinkDetectInfo.SlotIndex = 0; | ||
7023 | ieee->LinkDetectInfo.SlotNum = 2; | ||
7024 | ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0; | ||
7025 | @@ -3031,6 +3032,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) | ||
7026 | (void(*)(unsigned long)) rtllib_sta_ps, | ||
7027 | (unsigned long)ieee); | ||
7028 | |||
7029 | + return 0; | ||
7030 | } | ||
7031 | |||
7032 | void rtllib_softmac_free(struct rtllib_device *ieee) | ||
7033 | diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c | ||
7034 | index 0f16d9ffd8d12..85e0cef9e917e 100644 | ||
7035 | --- a/drivers/tee/tee_core.c | ||
7036 | +++ b/drivers/tee/tee_core.c | ||
7037 | @@ -84,8 +84,10 @@ void teedev_ctx_put(struct tee_context *ctx) | ||
7038 | |||
7039 | static void teedev_close_context(struct tee_context *ctx) | ||
7040 | { | ||
7041 | - tee_device_put(ctx->teedev); | ||
7042 | + struct tee_device *teedev = ctx->teedev; | ||
7043 | + | ||
7044 | teedev_ctx_put(ctx); | ||
7045 | + tee_device_put(teedev); | ||
7046 | } | ||
7047 | |||
7048 | static int tee_open(struct inode *inode, struct file *filp) | ||
7049 | diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c | ||
7050 | index 2c37d11726aba..13f882e5e7b76 100644 | ||
7051 | --- a/drivers/tty/serial/amba-pl010.c | ||
7052 | +++ b/drivers/tty/serial/amba-pl010.c | ||
7053 | @@ -452,14 +452,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, | ||
7054 | if ((termios->c_cflag & CREAD) == 0) | ||
7055 | uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; | ||
7056 | |||
7057 | - /* first, disable everything */ | ||
7058 | old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; | ||
7059 | |||
7060 | if (UART_ENABLE_MS(port, termios->c_cflag)) | ||
7061 | old_cr |= UART010_CR_MSIE; | ||
7062 | |||
7063 | - writel(0, uap->port.membase + UART010_CR); | ||
7064 | - | ||
7065 | /* Set baud rate */ | ||
7066 | quot -= 1; | ||
7067 | writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); | ||
7068 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c | ||
7069 | index 6741d0f3daf94..0bd8c05d72d60 100644 | ||
7070 | --- a/drivers/tty/serial/amba-pl011.c | ||
7071 | +++ b/drivers/tty/serial/amba-pl011.c | ||
7072 | @@ -2094,32 +2094,13 @@ static const char *pl011_type(struct uart_port *port) | ||
7073 | return uap->port.type == PORT_AMBA ? uap->type : NULL; | ||
7074 | } | ||
7075 | |||
7076 | -/* | ||
7077 | - * Release the memory region(s) being used by 'port' | ||
7078 | - */ | ||
7079 | -static void pl011_release_port(struct uart_port *port) | ||
7080 | -{ | ||
7081 | - release_mem_region(port->mapbase, SZ_4K); | ||
7082 | -} | ||
7083 | - | ||
7084 | -/* | ||
7085 | - * Request the memory region(s) being used by 'port' | ||
7086 | - */ | ||
7087 | -static int pl011_request_port(struct uart_port *port) | ||
7088 | -{ | ||
7089 | - return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") | ||
7090 | - != NULL ? 0 : -EBUSY; | ||
7091 | -} | ||
7092 | - | ||
7093 | /* | ||
7094 | * Configure/autoconfigure the port. | ||
7095 | */ | ||
7096 | static void pl011_config_port(struct uart_port *port, int flags) | ||
7097 | { | ||
7098 | - if (flags & UART_CONFIG_TYPE) { | ||
7099 | + if (flags & UART_CONFIG_TYPE) | ||
7100 | port->type = PORT_AMBA; | ||
7101 | - pl011_request_port(port); | ||
7102 | - } | ||
7103 | } | ||
7104 | |||
7105 | /* | ||
7106 | @@ -2134,6 +2115,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) | ||
7107 | ret = -EINVAL; | ||
7108 | if (ser->baud_base < 9600) | ||
7109 | ret = -EINVAL; | ||
7110 | + if (port->mapbase != (unsigned long) ser->iomem_base) | ||
7111 | + ret = -EINVAL; | ||
7112 | return ret; | ||
7113 | } | ||
7114 | |||
7115 | @@ -2151,8 +2134,6 @@ static const struct uart_ops amba_pl011_pops = { | ||
7116 | .flush_buffer = pl011_dma_flush_buffer, | ||
7117 | .set_termios = pl011_set_termios, | ||
7118 | .type = pl011_type, | ||
7119 | - .release_port = pl011_release_port, | ||
7120 | - .request_port = pl011_request_port, | ||
7121 | .config_port = pl011_config_port, | ||
7122 | .verify_port = pl011_verify_port, | ||
7123 | #ifdef CONFIG_CONSOLE_POLL | ||
7124 | @@ -2182,8 +2163,6 @@ static const struct uart_ops sbsa_uart_pops = { | ||
7125 | .shutdown = sbsa_uart_shutdown, | ||
7126 | .set_termios = sbsa_uart_set_termios, | ||
7127 | .type = pl011_type, | ||
7128 | - .release_port = pl011_release_port, | ||
7129 | - .request_port = pl011_request_port, | ||
7130 | .config_port = pl011_config_port, | ||
7131 | .verify_port = pl011_verify_port, | ||
7132 | #ifdef CONFIG_CONSOLE_POLL | ||
7133 | diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c | ||
7134 | index 8a909d5561859..3b2c25bd2e06b 100644 | ||
7135 | --- a/drivers/tty/serial/atmel_serial.c | ||
7136 | +++ b/drivers/tty/serial/atmel_serial.c | ||
7137 | @@ -1002,6 +1002,13 @@ static void atmel_tx_dma(struct uart_port *port) | ||
7138 | desc->callback = atmel_complete_tx_dma; | ||
7139 | desc->callback_param = atmel_port; | ||
7140 | atmel_port->cookie_tx = dmaengine_submit(desc); | ||
7141 | + if (dma_submit_error(atmel_port->cookie_tx)) { | ||
7142 | + dev_err(port->dev, "dma_submit_error %d\n", | ||
7143 | + atmel_port->cookie_tx); | ||
7144 | + return; | ||
7145 | + } | ||
7146 | + | ||
7147 | + dma_async_issue_pending(chan); | ||
7148 | } | ||
7149 | |||
7150 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
7151 | @@ -1262,6 +1269,13 @@ static int atmel_prepare_rx_dma(struct uart_port *port) | ||
7152 | desc->callback_param = port; | ||
7153 | atmel_port->desc_rx = desc; | ||
7154 | atmel_port->cookie_rx = dmaengine_submit(desc); | ||
7155 | + if (dma_submit_error(atmel_port->cookie_rx)) { | ||
7156 | + dev_err(port->dev, "dma_submit_error %d\n", | ||
7157 | + atmel_port->cookie_rx); | ||
7158 | + goto chan_err; | ||
7159 | + } | ||
7160 | + | ||
7161 | + dma_async_issue_pending(atmel_port->chan_rx); | ||
7162 | |||
7163 | return 0; | ||
7164 | |||
7165 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c | ||
7166 | index aad640b9e3f4b..7cc7bd8aca0f5 100644 | ||
7167 | --- a/drivers/tty/serial/serial_core.c | ||
7168 | +++ b/drivers/tty/serial/serial_core.c | ||
7169 | @@ -160,7 +160,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) | ||
7170 | int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); | ||
7171 | |||
7172 | if (raise) { | ||
7173 | - if (rs485_on && !RTS_after_send) { | ||
7174 | + if (rs485_on && RTS_after_send) { | ||
7175 | uart_set_mctrl(uport, TIOCM_DTR); | ||
7176 | uart_clear_mctrl(uport, TIOCM_RTS); | ||
7177 | } else { | ||
7178 | @@ -169,7 +169,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise) | ||
7179 | } else { | ||
7180 | unsigned int clear = TIOCM_DTR; | ||
7181 | |||
7182 | - clear |= (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; | ||
7183 | + clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; | ||
7184 | uart_clear_mctrl(uport, clear); | ||
7185 | } | ||
7186 | } | ||
7187 | @@ -2395,7 +2395,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, | ||
7188 | * We probably don't need a spinlock around this, but | ||
7189 | */ | ||
7190 | spin_lock_irqsave(&port->lock, flags); | ||
7191 | - port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); | ||
7192 | + port->mctrl &= TIOCM_DTR; | ||
7193 | + port->ops->set_mctrl(port, port->mctrl); | ||
7194 | spin_unlock_irqrestore(&port->lock, flags); | ||
7195 | |||
7196 | /* | ||
7197 | diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c | ||
7198 | index 56066d93a65b8..9a4049c894f7a 100644 | ||
7199 | --- a/drivers/tty/serial/uartlite.c | ||
7200 | +++ b/drivers/tty/serial/uartlite.c | ||
7201 | @@ -618,7 +618,7 @@ static struct uart_driver ulite_uart_driver = { | ||
7202 | * | ||
7203 | * Returns: 0 on success, <0 otherwise | ||
7204 | */ | ||
7205 | -static int ulite_assign(struct device *dev, int id, u32 base, int irq, | ||
7206 | +static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq, | ||
7207 | struct uartlite_data *pdata) | ||
7208 | { | ||
7209 | struct uart_port *port; | ||
7210 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
7211 | index 69dd48f9507e5..4cf0dc7f330dd 100644 | ||
7212 | --- a/drivers/usb/core/hub.c | ||
7213 | +++ b/drivers/usb/core/hub.c | ||
7214 | @@ -1108,7 +1108,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | ||
7215 | } else { | ||
7216 | hub_power_on(hub, true); | ||
7217 | } | ||
7218 | - } | ||
7219 | + /* Give some time on remote wakeup to let links to transit to U0 */ | ||
7220 | + } else if (hub_is_superspeed(hub->hdev)) | ||
7221 | + msleep(20); | ||
7222 | + | ||
7223 | init2: | ||
7224 | |||
7225 | /* | ||
7226 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c | ||
7227 | index 3f5c21f7f9905..2bea33b41553b 100644 | ||
7228 | --- a/drivers/usb/gadget/function/f_fs.c | ||
7229 | +++ b/drivers/usb/gadget/function/f_fs.c | ||
7230 | @@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) | ||
7231 | file->private_data = ffs; | ||
7232 | ffs_data_opened(ffs); | ||
7233 | |||
7234 | - return 0; | ||
7235 | + return stream_open(inode, file); | ||
7236 | } | ||
7237 | |||
7238 | static int ffs_ep0_release(struct inode *inode, struct file *file) | ||
7239 | @@ -1156,7 +1156,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) | ||
7240 | file->private_data = epfile; | ||
7241 | ffs_data_opened(epfile->ffs); | ||
7242 | |||
7243 | - return 0; | ||
7244 | + return stream_open(inode, file); | ||
7245 | } | ||
7246 | |||
7247 | static int ffs_aio_cancel(struct kiocb *kiocb) | ||
7248 | diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c | ||
7249 | index 70dbd95c3f063..be9e9db7cad10 100644 | ||
7250 | --- a/drivers/usb/host/uhci-platform.c | ||
7251 | +++ b/drivers/usb/host/uhci-platform.c | ||
7252 | @@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) | ||
7253 | num_ports); | ||
7254 | } | ||
7255 | if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || | ||
7256 | - of_device_is_compatible(np, "aspeed,ast2500-uhci")) { | ||
7257 | + of_device_is_compatible(np, "aspeed,ast2500-uhci") || | ||
7258 | + of_device_is_compatible(np, "aspeed,ast2600-uhci")) { | ||
7259 | uhci->is_aspeed = 1; | ||
7260 | dev_info(&pdev->dev, | ||
7261 | "Enabled Aspeed implementation workarounds\n"); | ||
7262 | diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c | ||
7263 | index cdee3af33ad7b..684800c66bb4d 100644 | ||
7264 | --- a/drivers/usb/misc/ftdi-elan.c | ||
7265 | +++ b/drivers/usb/misc/ftdi-elan.c | ||
7266 | @@ -202,6 +202,7 @@ static void ftdi_elan_delete(struct kref *kref) | ||
7267 | mutex_unlock(&ftdi_module_lock); | ||
7268 | kfree(ftdi->bulk_in_buffer); | ||
7269 | ftdi->bulk_in_buffer = NULL; | ||
7270 | + kfree(ftdi); | ||
7271 | } | ||
7272 | |||
7273 | static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) | ||
7274 | diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c | ||
7275 | index 8a640f1590784..06a9966f8c933 100644 | ||
7276 | --- a/drivers/w1/slaves/w1_ds28e04.c | ||
7277 | +++ b/drivers/w1/slaves/w1_ds28e04.c | ||
7278 | @@ -32,7 +32,7 @@ static int w1_strong_pullup = 1; | ||
7279 | module_param_named(strong_pullup, w1_strong_pullup, int, 0); | ||
7280 | |||
7281 | /* enable/disable CRC checking on DS28E04-100 memory accesses */ | ||
7282 | -static char w1_enable_crccheck = 1; | ||
7283 | +static bool w1_enable_crccheck = true; | ||
7284 | |||
7285 | #define W1_EEPROM_SIZE 512 | ||
7286 | #define W1_PAGE_COUNT 16 | ||
7287 | @@ -339,32 +339,18 @@ static BIN_ATTR_RW(pio, 1); | ||
7288 | static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, | ||
7289 | char *buf) | ||
7290 | { | ||
7291 | - if (put_user(w1_enable_crccheck + 0x30, buf)) | ||
7292 | - return -EFAULT; | ||
7293 | - | ||
7294 | - return sizeof(w1_enable_crccheck); | ||
7295 | + return sysfs_emit(buf, "%d\n", w1_enable_crccheck); | ||
7296 | } | ||
7297 | |||
7298 | static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr, | ||
7299 | const char *buf, size_t count) | ||
7300 | { | ||
7301 | - char val; | ||
7302 | - | ||
7303 | - if (count != 1 || !buf) | ||
7304 | - return -EINVAL; | ||
7305 | + int err = kstrtobool(buf, &w1_enable_crccheck); | ||
7306 | |||
7307 | - if (get_user(val, buf)) | ||
7308 | - return -EFAULT; | ||
7309 | + if (err) | ||
7310 | + return err; | ||
7311 | |||
7312 | - /* convert to decimal */ | ||
7313 | - val = val - 0x30; | ||
7314 | - if (val != 0 && val != 1) | ||
7315 | - return -EINVAL; | ||
7316 | - | ||
7317 | - /* set the new value */ | ||
7318 | - w1_enable_crccheck = val; | ||
7319 | - | ||
7320 | - return sizeof(w1_enable_crccheck); | ||
7321 | + return count; | ||
7322 | } | ||
7323 | |||
7324 | static DEVICE_ATTR_RW(crccheck); | ||
7325 | diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c | ||
7326 | index 7f644a58db511..c701a19fac533 100644 | ||
7327 | --- a/fs/btrfs/backref.c | ||
7328 | +++ b/fs/btrfs/backref.c | ||
7329 | @@ -1208,7 +1208,12 @@ again: | ||
7330 | ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); | ||
7331 | if (ret < 0) | ||
7332 | goto out; | ||
7333 | - BUG_ON(ret == 0); | ||
7334 | + if (ret == 0) { | ||
7335 | + /* This shouldn't happen, indicates a bug or fs corruption. */ | ||
7336 | + ASSERT(ret != 0); | ||
7337 | + ret = -EUCLEAN; | ||
7338 | + goto out; | ||
7339 | + } | ||
7340 | |||
7341 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | ||
7342 | if (trans && likely(trans->type != __TRANS_DUMMY) && | ||
7343 | @@ -1356,10 +1361,18 @@ again: | ||
7344 | goto out; | ||
7345 | if (!ret && extent_item_pos) { | ||
7346 | /* | ||
7347 | - * we've recorded that parent, so we must extend | ||
7348 | - * its inode list here | ||
7349 | + * We've recorded that parent, so we must extend | ||
7350 | + * its inode list here. | ||
7351 | + * | ||
7352 | + * However if there was corruption we may not | ||
7353 | + * have found an eie, return an error in this | ||
7354 | + * case. | ||
7355 | */ | ||
7356 | - BUG_ON(!eie); | ||
7357 | + ASSERT(eie); | ||
7358 | + if (!eie) { | ||
7359 | + ret = -EUCLEAN; | ||
7360 | + goto out; | ||
7361 | + } | ||
7362 | while (eie->next) | ||
7363 | eie = eie->next; | ||
7364 | eie->next = ref->inode_list; | ||
7365 | diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c | ||
7366 | index dac30b00d14b7..822c615840e84 100644 | ||
7367 | --- a/fs/btrfs/ctree.c | ||
7368 | +++ b/fs/btrfs/ctree.c | ||
7369 | @@ -2658,12 +2658,9 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root, | ||
7370 | { | ||
7371 | struct btrfs_fs_info *fs_info = root->fs_info; | ||
7372 | struct extent_buffer *b; | ||
7373 | - int root_lock; | ||
7374 | + int root_lock = 0; | ||
7375 | int level = 0; | ||
7376 | |||
7377 | - /* We try very hard to do read locks on the root */ | ||
7378 | - root_lock = BTRFS_READ_LOCK; | ||
7379 | - | ||
7380 | if (p->search_commit_root) { | ||
7381 | /* | ||
7382 | * The commit roots are read only so we always do read locks, | ||
7383 | @@ -2701,6 +2698,9 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root, | ||
7384 | goto out; | ||
7385 | } | ||
7386 | |||
7387 | + /* We try very hard to do read locks on the root */ | ||
7388 | + root_lock = BTRFS_READ_LOCK; | ||
7389 | + | ||
7390 | /* | ||
7391 | * If the level is set to maximum, we can skip trying to get the read | ||
7392 | * lock. | ||
7393 | @@ -2727,6 +2727,17 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root, | ||
7394 | level = btrfs_header_level(b); | ||
7395 | |||
7396 | out: | ||
7397 | + /* | ||
7398 | + * The root may have failed to write out at some point, and thus is no | ||
7399 | + * longer valid, return an error in this case. | ||
7400 | + */ | ||
7401 | + if (!extent_buffer_uptodate(b)) { | ||
7402 | + if (root_lock) | ||
7403 | + btrfs_tree_unlock_rw(b, root_lock); | ||
7404 | + free_extent_buffer(b); | ||
7405 | + return ERR_PTR(-EIO); | ||
7406 | + } | ||
7407 | + | ||
7408 | p->nodes[level] = b; | ||
7409 | if (!p->skip_locking) | ||
7410 | p->locks[level] = root_lock; | ||
7411 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
7412 | index b859ed50cf46c..7755a0362a3ad 100644 | ||
7413 | --- a/fs/btrfs/inode.c | ||
7414 | +++ b/fs/btrfs/inode.c | ||
7415 | @@ -10808,9 +10808,19 @@ static int btrfs_add_swap_extent(struct swap_info_struct *sis, | ||
7416 | struct btrfs_swap_info *bsi) | ||
7417 | { | ||
7418 | unsigned long nr_pages; | ||
7419 | + unsigned long max_pages; | ||
7420 | u64 first_ppage, first_ppage_reported, next_ppage; | ||
7421 | int ret; | ||
7422 | |||
7423 | + /* | ||
7424 | + * Our swapfile may have had its size extended after the swap header was | ||
7425 | + * written. In that case activating the swapfile should not go beyond | ||
7426 | + * the max size set in the swap header. | ||
7427 | + */ | ||
7428 | + if (bsi->nr_pages >= sis->max) | ||
7429 | + return 0; | ||
7430 | + | ||
7431 | + max_pages = sis->max - bsi->nr_pages; | ||
7432 | first_ppage = ALIGN(bsi->block_start, PAGE_SIZE) >> PAGE_SHIFT; | ||
7433 | next_ppage = ALIGN_DOWN(bsi->block_start + bsi->block_len, | ||
7434 | PAGE_SIZE) >> PAGE_SHIFT; | ||
7435 | @@ -10818,6 +10828,7 @@ static int btrfs_add_swap_extent(struct swap_info_struct *sis, | ||
7436 | if (first_ppage >= next_ppage) | ||
7437 | return 0; | ||
7438 | nr_pages = next_ppage - first_ppage; | ||
7439 | + nr_pages = min(nr_pages, max_pages); | ||
7440 | |||
7441 | first_ppage_reported = first_ppage; | ||
7442 | if (bsi->start == 0) | ||
7443 | diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c | ||
7444 | index bb034e19a2a8a..2ee61596164be 100644 | ||
7445 | --- a/fs/btrfs/qgroup.c | ||
7446 | +++ b/fs/btrfs/qgroup.c | ||
7447 | @@ -890,6 +890,14 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info) | ||
7448 | int ret = 0; | ||
7449 | int slot; | ||
7450 | |||
7451 | + /* | ||
7452 | + * We need to have subvol_sem write locked, to prevent races between | ||
7453 | + * concurrent tasks trying to enable quotas, because we will unlock | ||
7454 | + * and relock qgroup_ioctl_lock before setting fs_info->quota_root | ||
7455 | + * and before setting BTRFS_FS_QUOTA_ENABLED. | ||
7456 | + */ | ||
7457 | + lockdep_assert_held_write(&fs_info->subvol_sem); | ||
7458 | + | ||
7459 | mutex_lock(&fs_info->qgroup_ioctl_lock); | ||
7460 | if (fs_info->quota_root) | ||
7461 | goto out; | ||
7462 | @@ -1035,8 +1043,19 @@ out_add_root: | ||
7463 | goto out_free_path; | ||
7464 | } | ||
7465 | |||
7466 | + mutex_unlock(&fs_info->qgroup_ioctl_lock); | ||
7467 | + /* | ||
7468 | + * Commit the transaction while not holding qgroup_ioctl_lock, to avoid | ||
7469 | + * a deadlock with tasks concurrently doing other qgroup operations, such | ||
7470 | + * adding/removing qgroups or adding/deleting qgroup relations for example, | ||
7471 | + * because all qgroup operations first start or join a transaction and then | ||
7472 | + * lock the qgroup_ioctl_lock mutex. | ||
7473 | + * We are safe from a concurrent task trying to enable quotas, by calling | ||
7474 | + * this function, since we are serialized by fs_info->subvol_sem. | ||
7475 | + */ | ||
7476 | ret = btrfs_commit_transaction(trans); | ||
7477 | trans = NULL; | ||
7478 | + mutex_lock(&fs_info->qgroup_ioctl_lock); | ||
7479 | if (ret) | ||
7480 | goto out_free_path; | ||
7481 | |||
7482 | diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c | ||
7483 | index a32c5c7dcfd89..da87615ad69a7 100644 | ||
7484 | --- a/fs/debugfs/file.c | ||
7485 | +++ b/fs/debugfs/file.c | ||
7486 | @@ -146,7 +146,7 @@ static int debugfs_locked_down(struct inode *inode, | ||
7487 | struct file *filp, | ||
7488 | const struct file_operations *real_fops) | ||
7489 | { | ||
7490 | - if ((inode->i_mode & 07777) == 0444 && | ||
7491 | + if ((inode->i_mode & 07777 & ~0444) == 0 && | ||
7492 | !(filp->f_mode & FMODE_WRITE) && | ||
7493 | !real_fops->unlocked_ioctl && | ||
7494 | !real_fops->compat_ioctl && | ||
7495 | diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c | ||
7496 | index 18d81599522f3..53500b555bfa8 100644 | ||
7497 | --- a/fs/dlm/lock.c | ||
7498 | +++ b/fs/dlm/lock.c | ||
7499 | @@ -3975,6 +3975,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) | ||
7500 | int from = ms->m_header.h_nodeid; | ||
7501 | int error = 0; | ||
7502 | |||
7503 | + /* currently mixing of user/kernel locks are not supported */ | ||
7504 | + if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { | ||
7505 | + log_error(lkb->lkb_resource->res_ls, | ||
7506 | + "got user dlm message for a kernel lock"); | ||
7507 | + error = -EINVAL; | ||
7508 | + goto out; | ||
7509 | + } | ||
7510 | + | ||
7511 | switch (ms->m_type) { | ||
7512 | case DLM_MSG_CONVERT: | ||
7513 | case DLM_MSG_UNLOCK: | ||
7514 | @@ -4003,6 +4011,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) | ||
7515 | error = -EINVAL; | ||
7516 | } | ||
7517 | |||
7518 | +out: | ||
7519 | if (error) | ||
7520 | log_error(lkb->lkb_resource->res_ls, | ||
7521 | "ignore invalid message %d from %d %x %x %x %d", | ||
7522 | diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c | ||
7523 | index ba13fbb443d58..9fa20f9ba52b5 100644 | ||
7524 | --- a/fs/ext4/ioctl.c | ||
7525 | +++ b/fs/ext4/ioctl.c | ||
7526 | @@ -1120,8 +1120,6 @@ resizefs_out: | ||
7527 | sizeof(range))) | ||
7528 | return -EFAULT; | ||
7529 | |||
7530 | - range.minlen = max((unsigned int)range.minlen, | ||
7531 | - q->limits.discard_granularity); | ||
7532 | ret = ext4_trim_fs(sb, &range); | ||
7533 | if (ret < 0) | ||
7534 | return ret; | ||
7535 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c | ||
7536 | index b67ea979f0cf7..0307702d114db 100644 | ||
7537 | --- a/fs/ext4/mballoc.c | ||
7538 | +++ b/fs/ext4/mballoc.c | ||
7539 | @@ -5270,6 +5270,7 @@ out: | ||
7540 | */ | ||
7541 | int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) | ||
7542 | { | ||
7543 | + struct request_queue *q = bdev_get_queue(sb->s_bdev); | ||
7544 | struct ext4_group_info *grp; | ||
7545 | ext4_group_t group, first_group, last_group; | ||
7546 | ext4_grpblk_t cnt = 0, first_cluster, last_cluster; | ||
7547 | @@ -5288,6 +5289,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) | ||
7548 | start >= max_blks || | ||
7549 | range->len < sb->s_blocksize) | ||
7550 | return -EINVAL; | ||
7551 | + /* No point to try to trim less than discard granularity */ | ||
7552 | + if (range->minlen < q->limits.discard_granularity) { | ||
7553 | + minlen = EXT4_NUM_B2C(EXT4_SB(sb), | ||
7554 | + q->limits.discard_granularity >> sb->s_blocksize_bits); | ||
7555 | + if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) | ||
7556 | + goto out; | ||
7557 | + } | ||
7558 | if (end >= max_blks) | ||
7559 | end = max_blks - 1; | ||
7560 | if (end <= first_data_blk) | ||
7561 | diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c | ||
7562 | index be4ee3dcc5cf5..c5b2ea1a93729 100644 | ||
7563 | --- a/fs/ext4/migrate.c | ||
7564 | +++ b/fs/ext4/migrate.c | ||
7565 | @@ -455,12 +455,12 @@ int ext4_ext_migrate(struct inode *inode) | ||
7566 | percpu_down_write(&sbi->s_writepages_rwsem); | ||
7567 | |||
7568 | /* | ||
7569 | - * Worst case we can touch the allocation bitmaps, a bgd | ||
7570 | - * block, and a block to link in the orphan list. We do need | ||
7571 | - * need to worry about credits for modifying the quota inode. | ||
7572 | + * Worst case we can touch the allocation bitmaps and a block | ||
7573 | + * group descriptor block. We do need need to worry about | ||
7574 | + * credits for modifying the quota inode. | ||
7575 | */ | ||
7576 | handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, | ||
7577 | - 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); | ||
7578 | + 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); | ||
7579 | |||
7580 | if (IS_ERR(handle)) { | ||
7581 | retval = PTR_ERR(handle); | ||
7582 | @@ -477,6 +477,13 @@ int ext4_ext_migrate(struct inode *inode) | ||
7583 | ext4_journal_stop(handle); | ||
7584 | goto out_unlock; | ||
7585 | } | ||
7586 | + /* | ||
7587 | + * Use the correct seed for checksum (i.e. the seed from 'inode'). This | ||
7588 | + * is so that the metadata blocks will have the correct checksum after | ||
7589 | + * the migration. | ||
7590 | + */ | ||
7591 | + ei = EXT4_I(inode); | ||
7592 | + EXT4_I(tmp_inode)->i_csum_seed = ei->i_csum_seed; | ||
7593 | i_size_write(tmp_inode, i_size_read(inode)); | ||
7594 | /* | ||
7595 | * Set the i_nlink to zero so it will be deleted later | ||
7596 | @@ -485,7 +492,6 @@ int ext4_ext_migrate(struct inode *inode) | ||
7597 | clear_nlink(tmp_inode); | ||
7598 | |||
7599 | ext4_ext_tree_init(handle, tmp_inode); | ||
7600 | - ext4_orphan_add(handle, tmp_inode); | ||
7601 | ext4_journal_stop(handle); | ||
7602 | |||
7603 | /* | ||
7604 | @@ -510,17 +516,10 @@ int ext4_ext_migrate(struct inode *inode) | ||
7605 | |||
7606 | handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); | ||
7607 | if (IS_ERR(handle)) { | ||
7608 | - /* | ||
7609 | - * It is impossible to update on-disk structures without | ||
7610 | - * a handle, so just rollback in-core changes and live other | ||
7611 | - * work to orphan_list_cleanup() | ||
7612 | - */ | ||
7613 | - ext4_orphan_del(NULL, tmp_inode); | ||
7614 | retval = PTR_ERR(handle); | ||
7615 | goto out_tmp_inode; | ||
7616 | } | ||
7617 | |||
7618 | - ei = EXT4_I(inode); | ||
7619 | i_data = ei->i_data; | ||
7620 | memset(&lb, 0, sizeof(lb)); | ||
7621 | |||
7622 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c | ||
7623 | index f68dfef5939f4..5bc7fd0240a19 100644 | ||
7624 | --- a/fs/ext4/super.c | ||
7625 | +++ b/fs/ext4/super.c | ||
7626 | @@ -5912,10 +5912,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | ||
7627 | |||
7628 | lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); | ||
7629 | err = dquot_quota_on(sb, type, format_id, path); | ||
7630 | - if (err) { | ||
7631 | - lockdep_set_quota_inode(path->dentry->d_inode, | ||
7632 | - I_DATA_SEM_NORMAL); | ||
7633 | - } else { | ||
7634 | + if (!err) { | ||
7635 | struct inode *inode = d_inode(path->dentry); | ||
7636 | handle_t *handle; | ||
7637 | |||
7638 | @@ -5935,7 +5932,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | ||
7639 | ext4_journal_stop(handle); | ||
7640 | unlock_inode: | ||
7641 | inode_unlock(inode); | ||
7642 | + if (err) | ||
7643 | + dquot_quota_off(sb, type); | ||
7644 | } | ||
7645 | + if (err) | ||
7646 | + lockdep_set_quota_inode(path->dentry->d_inode, | ||
7647 | + I_DATA_SEM_NORMAL); | ||
7648 | return err; | ||
7649 | } | ||
7650 | |||
7651 | @@ -5998,8 +6000,19 @@ static int ext4_enable_quotas(struct super_block *sb) | ||
7652 | "Failed to enable quota tracking " | ||
7653 | "(type=%d, err=%d). Please run " | ||
7654 | "e2fsck to fix.", type, err); | ||
7655 | - for (type--; type >= 0; type--) | ||
7656 | + for (type--; type >= 0; type--) { | ||
7657 | + struct inode *inode; | ||
7658 | + | ||
7659 | + inode = sb_dqopt(sb)->files[type]; | ||
7660 | + if (inode) | ||
7661 | + inode = igrab(inode); | ||
7662 | dquot_quota_off(sb, type); | ||
7663 | + if (inode) { | ||
7664 | + lockdep_set_quota_inode(inode, | ||
7665 | + I_DATA_SEM_NORMAL); | ||
7666 | + iput(inode); | ||
7667 | + } | ||
7668 | + } | ||
7669 | |||
7670 | return err; | ||
7671 | } | ||
7672 | @@ -6101,7 +6114,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, | ||
7673 | struct buffer_head *bh; | ||
7674 | handle_t *handle = journal_current_handle(); | ||
7675 | |||
7676 | - if (EXT4_SB(sb)->s_journal && !handle) { | ||
7677 | + if (!handle) { | ||
7678 | ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" | ||
7679 | " cancelled because transaction is not started", | ||
7680 | (unsigned long long)off, (unsigned long long)len); | ||
7681 | diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h | ||
7682 | index 031a17bf52a24..5645502c156df 100644 | ||
7683 | --- a/fs/f2fs/f2fs.h | ||
7684 | +++ b/fs/f2fs/f2fs.h | ||
7685 | @@ -931,6 +931,7 @@ struct f2fs_sm_info { | ||
7686 | unsigned int segment_count; /* total # of segments */ | ||
7687 | unsigned int main_segments; /* # of segments in main area */ | ||
7688 | unsigned int reserved_segments; /* # of reserved segments */ | ||
7689 | + unsigned int additional_reserved_segments;/* reserved segs for IO align feature */ | ||
7690 | unsigned int ovp_segments; /* # of overprovision segments */ | ||
7691 | |||
7692 | /* a threshold to reclaim prefree segments */ | ||
7693 | @@ -1800,6 +1801,11 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, | ||
7694 | |||
7695 | if (!__allow_reserved_blocks(sbi, inode, true)) | ||
7696 | avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks; | ||
7697 | + | ||
7698 | + if (F2FS_IO_ALIGNED(sbi)) | ||
7699 | + avail_user_block_count -= sbi->blocks_per_seg * | ||
7700 | + SM_I(sbi)->additional_reserved_segments; | ||
7701 | + | ||
7702 | if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { | ||
7703 | if (avail_user_block_count > sbi->unusable_block_count) | ||
7704 | avail_user_block_count -= sbi->unusable_block_count; | ||
7705 | @@ -2045,6 +2051,11 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi, | ||
7706 | |||
7707 | if (!__allow_reserved_blocks(sbi, inode, false)) | ||
7708 | valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks; | ||
7709 | + | ||
7710 | + if (F2FS_IO_ALIGNED(sbi)) | ||
7711 | + valid_block_count += sbi->blocks_per_seg * | ||
7712 | + SM_I(sbi)->additional_reserved_segments; | ||
7713 | + | ||
7714 | user_block_count = sbi->user_block_count; | ||
7715 | if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) | ||
7716 | user_block_count -= sbi->unusable_block_count; | ||
7717 | diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c | ||
7718 | index 4b6c36208f552..16abb017e497f 100644 | ||
7719 | --- a/fs/f2fs/gc.c | ||
7720 | +++ b/fs/f2fs/gc.c | ||
7721 | @@ -633,6 +633,9 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, | ||
7722 | set_sbi_flag(sbi, SBI_NEED_FSCK); | ||
7723 | } | ||
7724 | |||
7725 | + if (f2fs_check_nid_range(sbi, dni->ino)) | ||
7726 | + return false; | ||
7727 | + | ||
7728 | *nofs = ofs_of_node(node_page); | ||
7729 | source_blkaddr = datablock_addr(NULL, node_page, ofs_in_node); | ||
7730 | f2fs_put_page(node_page, 1); | ||
7731 | diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h | ||
7732 | index 2034b9a07d632..15b343f656093 100644 | ||
7733 | --- a/fs/f2fs/segment.h | ||
7734 | +++ b/fs/f2fs/segment.h | ||
7735 | @@ -508,7 +508,8 @@ static inline unsigned int free_segments(struct f2fs_sb_info *sbi) | ||
7736 | |||
7737 | static inline int reserved_segments(struct f2fs_sb_info *sbi) | ||
7738 | { | ||
7739 | - return SM_I(sbi)->reserved_segments; | ||
7740 | + return SM_I(sbi)->reserved_segments + | ||
7741 | + SM_I(sbi)->additional_reserved_segments; | ||
7742 | } | ||
7743 | |||
7744 | static inline unsigned int free_sections(struct f2fs_sb_info *sbi) | ||
7745 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c | ||
7746 | index 41bf656658ba8..a6c9c9fdf21d1 100644 | ||
7747 | --- a/fs/f2fs/super.c | ||
7748 | +++ b/fs/f2fs/super.c | ||
7749 | @@ -277,6 +277,46 @@ static inline void limit_reserve_root(struct f2fs_sb_info *sbi) | ||
7750 | F2FS_OPTION(sbi).s_resgid)); | ||
7751 | } | ||
7752 | |||
7753 | +static inline int adjust_reserved_segment(struct f2fs_sb_info *sbi) | ||
7754 | +{ | ||
7755 | + unsigned int sec_blks = sbi->blocks_per_seg * sbi->segs_per_sec; | ||
7756 | + unsigned int avg_vblocks; | ||
7757 | + unsigned int wanted_reserved_segments; | ||
7758 | + block_t avail_user_block_count; | ||
7759 | + | ||
7760 | + if (!F2FS_IO_ALIGNED(sbi)) | ||
7761 | + return 0; | ||
7762 | + | ||
7763 | + /* average valid block count in section in worst case */ | ||
7764 | + avg_vblocks = sec_blks / F2FS_IO_SIZE(sbi); | ||
7765 | + | ||
7766 | + /* | ||
7767 | + * we need enough free space when migrating one section in worst case | ||
7768 | + */ | ||
7769 | + wanted_reserved_segments = (F2FS_IO_SIZE(sbi) / avg_vblocks) * | ||
7770 | + reserved_segments(sbi); | ||
7771 | + wanted_reserved_segments -= reserved_segments(sbi); | ||
7772 | + | ||
7773 | + avail_user_block_count = sbi->user_block_count - | ||
7774 | + sbi->current_reserved_blocks - | ||
7775 | + F2FS_OPTION(sbi).root_reserved_blocks; | ||
7776 | + | ||
7777 | + if (wanted_reserved_segments * sbi->blocks_per_seg > | ||
7778 | + avail_user_block_count) { | ||
7779 | + f2fs_err(sbi, "IO align feature can't grab additional reserved segment: %u, available segments: %u", | ||
7780 | + wanted_reserved_segments, | ||
7781 | + avail_user_block_count >> sbi->log_blocks_per_seg); | ||
7782 | + return -ENOSPC; | ||
7783 | + } | ||
7784 | + | ||
7785 | + SM_I(sbi)->additional_reserved_segments = wanted_reserved_segments; | ||
7786 | + | ||
7787 | + f2fs_info(sbi, "IO align feature needs additional reserved segment: %u", | ||
7788 | + wanted_reserved_segments); | ||
7789 | + | ||
7790 | + return 0; | ||
7791 | +} | ||
7792 | + | ||
7793 | static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) | ||
7794 | { | ||
7795 | if (!F2FS_OPTION(sbi).unusable_cap_perc) | ||
7796 | @@ -3450,6 +3490,10 @@ try_onemore: | ||
7797 | goto free_nm; | ||
7798 | } | ||
7799 | |||
7800 | + err = adjust_reserved_segment(sbi); | ||
7801 | + if (err) | ||
7802 | + goto free_nm; | ||
7803 | + | ||
7804 | /* For write statistics */ | ||
7805 | if (sb->s_bdev->bd_part) | ||
7806 | sbi->sectors_written_start = | ||
7807 | diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c | ||
7808 | index 3a5360e045cfd..84bb376650935 100644 | ||
7809 | --- a/fs/f2fs/sysfs.c | ||
7810 | +++ b/fs/f2fs/sysfs.c | ||
7811 | @@ -262,7 +262,9 @@ out: | ||
7812 | if (a->struct_type == RESERVED_BLOCKS) { | ||
7813 | spin_lock(&sbi->stat_lock); | ||
7814 | if (t > (unsigned long)(sbi->user_block_count - | ||
7815 | - F2FS_OPTION(sbi).root_reserved_blocks)) { | ||
7816 | + F2FS_OPTION(sbi).root_reserved_blocks - | ||
7817 | + sbi->blocks_per_seg * | ||
7818 | + SM_I(sbi)->additional_reserved_segments)) { | ||
7819 | spin_unlock(&sbi->stat_lock); | ||
7820 | return -EINVAL; | ||
7821 | } | ||
7822 | diff --git a/fs/fuse/file.c b/fs/fuse/file.c | ||
7823 | index 1de59998e0e75..5cf13196ce69e 100644 | ||
7824 | --- a/fs/fuse/file.c | ||
7825 | +++ b/fs/fuse/file.c | ||
7826 | @@ -3188,7 +3188,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) | ||
7827 | |||
7828 | static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end) | ||
7829 | { | ||
7830 | - int err = filemap_write_and_wait_range(inode->i_mapping, start, -1); | ||
7831 | + int err = filemap_write_and_wait_range(inode->i_mapping, start, LLONG_MAX); | ||
7832 | |||
7833 | if (!err) | ||
7834 | fuse_sync_writes(inode); | ||
7835 | diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c | ||
7836 | index f8fb89b10227c..34880a4c21732 100644 | ||
7837 | --- a/fs/jffs2/file.c | ||
7838 | +++ b/fs/jffs2/file.c | ||
7839 | @@ -135,20 +135,15 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | ||
7840 | struct page *pg; | ||
7841 | struct inode *inode = mapping->host; | ||
7842 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | ||
7843 | + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); | ||
7844 | pgoff_t index = pos >> PAGE_SHIFT; | ||
7845 | uint32_t pageofs = index << PAGE_SHIFT; | ||
7846 | int ret = 0; | ||
7847 | |||
7848 | - pg = grab_cache_page_write_begin(mapping, index, flags); | ||
7849 | - if (!pg) | ||
7850 | - return -ENOMEM; | ||
7851 | - *pagep = pg; | ||
7852 | - | ||
7853 | jffs2_dbg(1, "%s()\n", __func__); | ||
7854 | |||
7855 | if (pageofs > inode->i_size) { | ||
7856 | /* Make new hole frag from old EOF to new page */ | ||
7857 | - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); | ||
7858 | struct jffs2_raw_inode ri; | ||
7859 | struct jffs2_full_dnode *fn; | ||
7860 | uint32_t alloc_len; | ||
7861 | @@ -159,7 +154,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | ||
7862 | ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, | ||
7863 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); | ||
7864 | if (ret) | ||
7865 | - goto out_page; | ||
7866 | + goto out_err; | ||
7867 | |||
7868 | mutex_lock(&f->sem); | ||
7869 | memset(&ri, 0, sizeof(ri)); | ||
7870 | @@ -189,7 +184,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | ||
7871 | ret = PTR_ERR(fn); | ||
7872 | jffs2_complete_reservation(c); | ||
7873 | mutex_unlock(&f->sem); | ||
7874 | - goto out_page; | ||
7875 | + goto out_err; | ||
7876 | } | ||
7877 | ret = jffs2_add_full_dnode_to_inode(c, f, fn); | ||
7878 | if (f->metadata) { | ||
7879 | @@ -204,13 +199,26 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | ||
7880 | jffs2_free_full_dnode(fn); | ||
7881 | jffs2_complete_reservation(c); | ||
7882 | mutex_unlock(&f->sem); | ||
7883 | - goto out_page; | ||
7884 | + goto out_err; | ||
7885 | } | ||
7886 | jffs2_complete_reservation(c); | ||
7887 | inode->i_size = pageofs; | ||
7888 | mutex_unlock(&f->sem); | ||
7889 | } | ||
7890 | |||
7891 | + /* | ||
7892 | + * While getting a page and reading data in, lock c->alloc_sem until | ||
7893 | + * the page is Uptodate. Otherwise GC task may attempt to read the same | ||
7894 | + * page in read_cache_page(), which causes a deadlock. | ||
7895 | + */ | ||
7896 | + mutex_lock(&c->alloc_sem); | ||
7897 | + pg = grab_cache_page_write_begin(mapping, index, flags); | ||
7898 | + if (!pg) { | ||
7899 | + ret = -ENOMEM; | ||
7900 | + goto release_sem; | ||
7901 | + } | ||
7902 | + *pagep = pg; | ||
7903 | + | ||
7904 | /* | ||
7905 | * Read in the page if it wasn't already present. Cannot optimize away | ||
7906 | * the whole page write case until jffs2_write_end can handle the | ||
7907 | @@ -220,15 +228,17 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | ||
7908 | mutex_lock(&f->sem); | ||
7909 | ret = jffs2_do_readpage_nolock(inode, pg); | ||
7910 | mutex_unlock(&f->sem); | ||
7911 | - if (ret) | ||
7912 | - goto out_page; | ||
7913 | + if (ret) { | ||
7914 | + unlock_page(pg); | ||
7915 | + put_page(pg); | ||
7916 | + goto release_sem; | ||
7917 | + } | ||
7918 | } | ||
7919 | jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); | ||
7920 | - return ret; | ||
7921 | |||
7922 | -out_page: | ||
7923 | - unlock_page(pg); | ||
7924 | - put_page(pg); | ||
7925 | +release_sem: | ||
7926 | + mutex_unlock(&c->alloc_sem); | ||
7927 | +out_err: | ||
7928 | return ret; | ||
7929 | } | ||
7930 | |||
7931 | diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c | ||
7932 | index 2cbc3c36f3a8c..b37c6b1e33253 100644 | ||
7933 | --- a/fs/ubifs/super.c | ||
7934 | +++ b/fs/ubifs/super.c | ||
7935 | @@ -1835,7 +1835,6 @@ out: | ||
7936 | kthread_stop(c->bgt); | ||
7937 | c->bgt = NULL; | ||
7938 | } | ||
7939 | - free_wbufs(c); | ||
7940 | kfree(c->write_reserve_buf); | ||
7941 | c->write_reserve_buf = NULL; | ||
7942 | vfree(c->ileb_buf); | ||
7943 | diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h | ||
7944 | index 9373662cdb44f..ff5fecff51167 100644 | ||
7945 | --- a/include/acpi/actypes.h | ||
7946 | +++ b/include/acpi/actypes.h | ||
7947 | @@ -536,8 +536,14 @@ typedef u64 acpi_integer; | ||
7948 | * Can be used with access_width of struct acpi_generic_address and access_size of | ||
7949 | * struct acpi_resource_generic_register. | ||
7950 | */ | ||
7951 | -#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) | ||
7952 | -#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) | ||
7953 | +#define ACPI_ACCESS_BIT_SHIFT 2 | ||
7954 | +#define ACPI_ACCESS_BYTE_SHIFT -1 | ||
7955 | +#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) | ||
7956 | +#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) | ||
7957 | +#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) | ||
7958 | +#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) | ||
7959 | +#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) | ||
7960 | +#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) | ||
7961 | |||
7962 | /******************************************************************************* | ||
7963 | * | ||
7964 | diff --git a/include/linux/hid.h b/include/linux/hid.h | ||
7965 | index ad46ed41e8836..d5f9bbf8afa51 100644 | ||
7966 | --- a/include/linux/hid.h | ||
7967 | +++ b/include/linux/hid.h | ||
7968 | @@ -344,6 +344,8 @@ struct hid_item { | ||
7969 | /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ | ||
7970 | #define HID_QUIRK_ALWAYS_POLL BIT(10) | ||
7971 | #define HID_QUIRK_INPUT_PER_APP BIT(11) | ||
7972 | +#define HID_QUIRK_X_INVERT BIT(12) | ||
7973 | +#define HID_QUIRK_Y_INVERT BIT(13) | ||
7974 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) | ||
7975 | #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) | ||
7976 | #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) | ||
7977 | diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h | ||
7978 | index a90aba3d6afb4..bc8a70a7c5a13 100644 | ||
7979 | --- a/include/linux/mmzone.h | ||
7980 | +++ b/include/linux/mmzone.h | ||
7981 | @@ -929,6 +929,15 @@ static inline int is_highmem_idx(enum zone_type idx) | ||
7982 | #endif | ||
7983 | } | ||
7984 | |||
7985 | +#ifdef CONFIG_ZONE_DMA | ||
7986 | +bool has_managed_dma(void); | ||
7987 | +#else | ||
7988 | +static inline bool has_managed_dma(void) | ||
7989 | +{ | ||
7990 | + return false; | ||
7991 | +} | ||
7992 | +#endif | ||
7993 | + | ||
7994 | /** | ||
7995 | * is_highmem - helper function to quickly check if a struct zone is a | ||
7996 | * highmem zone or not. This is an attempt to keep references | ||
7997 | diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h | ||
7998 | index bac79e817776c..4cbd413e71a3f 100644 | ||
7999 | --- a/include/net/inet_frag.h | ||
8000 | +++ b/include/net/inet_frag.h | ||
8001 | @@ -116,8 +116,15 @@ int fqdir_init(struct fqdir **fqdirp, struct inet_frags *f, struct net *net); | ||
8002 | |||
8003 | static inline void fqdir_pre_exit(struct fqdir *fqdir) | ||
8004 | { | ||
8005 | - fqdir->high_thresh = 0; /* prevent creation of new frags */ | ||
8006 | - fqdir->dead = true; | ||
8007 | + /* Prevent creation of new frags. | ||
8008 | + * Pairs with READ_ONCE() in inet_frag_find(). | ||
8009 | + */ | ||
8010 | + WRITE_ONCE(fqdir->high_thresh, 0); | ||
8011 | + | ||
8012 | + /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() | ||
8013 | + * and ip6frag_expire_frag_queue(). | ||
8014 | + */ | ||
8015 | + WRITE_ONCE(fqdir->dead, true); | ||
8016 | } | ||
8017 | void fqdir_exit(struct fqdir *fqdir); | ||
8018 | |||
8019 | diff --git a/include/net/ipv6_frag.h b/include/net/ipv6_frag.h | ||
8020 | index a21e8b1381a10..e47a946bb77c9 100644 | ||
8021 | --- a/include/net/ipv6_frag.h | ||
8022 | +++ b/include/net/ipv6_frag.h | ||
8023 | @@ -67,7 +67,8 @@ ip6frag_expire_frag_queue(struct net *net, struct frag_queue *fq) | ||
8024 | struct sk_buff *head; | ||
8025 | |||
8026 | rcu_read_lock(); | ||
8027 | - if (fq->q.fqdir->dead) | ||
8028 | + /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ | ||
8029 | + if (READ_ONCE(fq->q.fqdir->dead)) | ||
8030 | goto out_rcu_unlock; | ||
8031 | spin_lock(&fq->q.lock); | ||
8032 | |||
8033 | diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h | ||
8034 | index 939fda8f97215..ae69059ba76d4 100644 | ||
8035 | --- a/include/net/sch_generic.h | ||
8036 | +++ b/include/net/sch_generic.h | ||
8037 | @@ -1264,6 +1264,7 @@ struct psched_ratecfg { | ||
8038 | u64 rate_bytes_ps; /* bytes per second */ | ||
8039 | u32 mult; | ||
8040 | u16 overhead; | ||
8041 | + u16 mpu; | ||
8042 | u8 linklayer; | ||
8043 | u8 shift; | ||
8044 | }; | ||
8045 | @@ -1273,6 +1274,9 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, | ||
8046 | { | ||
8047 | len += r->overhead; | ||
8048 | |||
8049 | + if (len < r->mpu) | ||
8050 | + len = r->mpu; | ||
8051 | + | ||
8052 | if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) | ||
8053 | return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; | ||
8054 | |||
8055 | @@ -1295,6 +1299,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, | ||
8056 | res->rate = min_t(u64, r->rate_bytes_ps, ~0U); | ||
8057 | |||
8058 | res->overhead = r->overhead; | ||
8059 | + res->mpu = r->mpu; | ||
8060 | res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); | ||
8061 | } | ||
8062 | |||
8063 | diff --git a/kernel/audit.c b/kernel/audit.c | ||
8064 | index d67fce9e3f8b8..146edff0c73ec 100644 | ||
8065 | --- a/kernel/audit.c | ||
8066 | +++ b/kernel/audit.c | ||
8067 | @@ -1528,6 +1528,20 @@ static void audit_receive(struct sk_buff *skb) | ||
8068 | nlh = nlmsg_next(nlh, &len); | ||
8069 | } | ||
8070 | audit_ctl_unlock(); | ||
8071 | + | ||
8072 | + /* can't block with the ctrl lock, so penalize the sender now */ | ||
8073 | + if (audit_backlog_limit && | ||
8074 | + (skb_queue_len(&audit_queue) > audit_backlog_limit)) { | ||
8075 | + DECLARE_WAITQUEUE(wait, current); | ||
8076 | + | ||
8077 | + /* wake kauditd to try and flush the queue */ | ||
8078 | + wake_up_interruptible(&kauditd_wait); | ||
8079 | + | ||
8080 | + add_wait_queue_exclusive(&audit_backlog_wait, &wait); | ||
8081 | + set_current_state(TASK_UNINTERRUPTIBLE); | ||
8082 | + schedule_timeout(audit_backlog_wait_time); | ||
8083 | + remove_wait_queue(&audit_backlog_wait, &wait); | ||
8084 | + } | ||
8085 | } | ||
8086 | |||
8087 | /* Run custom bind function on netlink socket group connect or bind requests. */ | ||
8088 | @@ -1772,7 +1786,9 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, | ||
8089 | * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() | ||
8090 | * using a PID anchored in the caller's namespace | ||
8091 | * 2. generator holding the audit_cmd_mutex - we don't want to block | ||
8092 | - * while holding the mutex */ | ||
8093 | + * while holding the mutex, although we do penalize the sender | ||
8094 | + * later in audit_receive() when it is safe to block | ||
8095 | + */ | ||
8096 | if (!(auditd_test_task(current) || audit_ctl_owner_current())) { | ||
8097 | long stime = audit_backlog_wait_time; | ||
8098 | |||
8099 | diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h | ||
8100 | index 4c4d7683a4e5b..173e3ce607900 100644 | ||
8101 | --- a/kernel/rcu/tree_exp.h | ||
8102 | +++ b/kernel/rcu/tree_exp.h | ||
8103 | @@ -382,6 +382,7 @@ retry_ipi: | ||
8104 | continue; | ||
8105 | } | ||
8106 | if (get_cpu() == cpu) { | ||
8107 | + mask_ofl_test |= mask; | ||
8108 | put_cpu(); | ||
8109 | continue; | ||
8110 | } | ||
8111 | diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c | ||
8112 | index 46ed4e1383e21..66188567778de 100644 | ||
8113 | --- a/kernel/sched/cputime.c | ||
8114 | +++ b/kernel/sched/cputime.c | ||
8115 | @@ -147,10 +147,10 @@ void account_guest_time(struct task_struct *p, u64 cputime) | ||
8116 | |||
8117 | /* Add guest time to cpustat. */ | ||
8118 | if (task_nice(p) > 0) { | ||
8119 | - cpustat[CPUTIME_NICE] += cputime; | ||
8120 | + task_group_account_field(p, CPUTIME_NICE, cputime); | ||
8121 | cpustat[CPUTIME_GUEST_NICE] += cputime; | ||
8122 | } else { | ||
8123 | - cpustat[CPUTIME_USER] += cputime; | ||
8124 | + task_group_account_field(p, CPUTIME_USER, cputime); | ||
8125 | cpustat[CPUTIME_GUEST] += cputime; | ||
8126 | } | ||
8127 | } | ||
8128 | diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c | ||
8129 | index 2dffb8762e16b..28c82dee13ea9 100644 | ||
8130 | --- a/kernel/sched/rt.c | ||
8131 | +++ b/kernel/sched/rt.c | ||
8132 | @@ -52,11 +52,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime) | ||
8133 | rt_b->rt_period_timer.function = sched_rt_period_timer; | ||
8134 | } | ||
8135 | |||
8136 | -static void start_rt_bandwidth(struct rt_bandwidth *rt_b) | ||
8137 | +static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) | ||
8138 | { | ||
8139 | - if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) | ||
8140 | - return; | ||
8141 | - | ||
8142 | raw_spin_lock(&rt_b->rt_runtime_lock); | ||
8143 | if (!rt_b->rt_period_active) { | ||
8144 | rt_b->rt_period_active = 1; | ||
8145 | @@ -75,6 +72,14 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) | ||
8146 | raw_spin_unlock(&rt_b->rt_runtime_lock); | ||
8147 | } | ||
8148 | |||
8149 | +static void start_rt_bandwidth(struct rt_bandwidth *rt_b) | ||
8150 | +{ | ||
8151 | + if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) | ||
8152 | + return; | ||
8153 | + | ||
8154 | + do_start_rt_bandwidth(rt_b); | ||
8155 | +} | ||
8156 | + | ||
8157 | void init_rt_rq(struct rt_rq *rt_rq) | ||
8158 | { | ||
8159 | struct rt_prio_array *array; | ||
8160 | @@ -983,13 +988,17 @@ static void update_curr_rt(struct rq *rq) | ||
8161 | |||
8162 | for_each_sched_rt_entity(rt_se) { | ||
8163 | struct rt_rq *rt_rq = rt_rq_of_se(rt_se); | ||
8164 | + int exceeded; | ||
8165 | |||
8166 | if (sched_rt_runtime(rt_rq) != RUNTIME_INF) { | ||
8167 | raw_spin_lock(&rt_rq->rt_runtime_lock); | ||
8168 | rt_rq->rt_time += delta_exec; | ||
8169 | - if (sched_rt_runtime_exceeded(rt_rq)) | ||
8170 | + exceeded = sched_rt_runtime_exceeded(rt_rq); | ||
8171 | + if (exceeded) | ||
8172 | resched_curr(rq); | ||
8173 | raw_spin_unlock(&rt_rq->rt_runtime_lock); | ||
8174 | + if (exceeded) | ||
8175 | + do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); | ||
8176 | } | ||
8177 | } | ||
8178 | } | ||
8179 | @@ -2659,8 +2668,12 @@ static int sched_rt_global_validate(void) | ||
8180 | |||
8181 | static void sched_rt_do_global(void) | ||
8182 | { | ||
8183 | + unsigned long flags; | ||
8184 | + | ||
8185 | + raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); | ||
8186 | def_rt_bandwidth.rt_runtime = global_rt_runtime(); | ||
8187 | def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period()); | ||
8188 | + raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); | ||
8189 | } | ||
8190 | |||
8191 | int sched_rt_handler(struct ctl_table *table, int write, | ||
8192 | diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c | ||
8193 | index 5de084dab4fa6..13ccf2f28987e 100644 | ||
8194 | --- a/kernel/trace/trace_kprobe.c | ||
8195 | +++ b/kernel/trace/trace_kprobe.c | ||
8196 | @@ -999,15 +999,18 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) | ||
8197 | { | ||
8198 | struct dyn_event *ev = v; | ||
8199 | struct trace_kprobe *tk; | ||
8200 | + unsigned long nmissed; | ||
8201 | |||
8202 | if (!is_trace_kprobe(ev)) | ||
8203 | return 0; | ||
8204 | |||
8205 | tk = to_trace_kprobe(ev); | ||
8206 | + nmissed = trace_kprobe_is_return(tk) ? | ||
8207 | + tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed; | ||
8208 | seq_printf(m, " %-44s %15lu %15lu\n", | ||
8209 | trace_probe_name(&tk->tp), | ||
8210 | trace_kprobe_nhit(tk), | ||
8211 | - tk->rp.kp.nmissed); | ||
8212 | + nmissed); | ||
8213 | |||
8214 | return 0; | ||
8215 | } | ||
8216 | diff --git a/lib/test_meminit.c b/lib/test_meminit.c | ||
8217 | index 9742e5cb853aa..ab00c79423a5f 100644 | ||
8218 | --- a/lib/test_meminit.c | ||
8219 | +++ b/lib/test_meminit.c | ||
8220 | @@ -319,6 +319,7 @@ static int __init do_kmem_cache_size_bulk(int size, int *total_failures) | ||
8221 | if (num) | ||
8222 | kmem_cache_free_bulk(c, num, objects); | ||
8223 | } | ||
8224 | + kmem_cache_destroy(c); | ||
8225 | *total_failures += fail; | ||
8226 | return 1; | ||
8227 | } | ||
8228 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c | ||
8229 | index 283ac9d9f6dd0..c3835915d1157 100644 | ||
8230 | --- a/mm/page_alloc.c | ||
8231 | +++ b/mm/page_alloc.c | ||
8232 | @@ -3767,7 +3767,9 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...) | ||
8233 | va_list args; | ||
8234 | static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); | ||
8235 | |||
8236 | - if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) | ||
8237 | + if ((gfp_mask & __GFP_NOWARN) || | ||
8238 | + !__ratelimit(&nopage_rs) || | ||
8239 | + ((gfp_mask & __GFP_DMA) && !has_managed_dma())) | ||
8240 | return; | ||
8241 | |||
8242 | va_start(args, fmt); | ||
8243 | @@ -8694,3 +8696,18 @@ bool set_hwpoison_free_buddy_page(struct page *page) | ||
8244 | return hwpoisoned; | ||
8245 | } | ||
8246 | #endif | ||
8247 | + | ||
8248 | +#ifdef CONFIG_ZONE_DMA | ||
8249 | +bool has_managed_dma(void) | ||
8250 | +{ | ||
8251 | + struct pglist_data *pgdat; | ||
8252 | + | ||
8253 | + for_each_online_pgdat(pgdat) { | ||
8254 | + struct zone *zone = &pgdat->node_zones[ZONE_DMA]; | ||
8255 | + | ||
8256 | + if (managed_zone(zone)) | ||
8257 | + return true; | ||
8258 | + } | ||
8259 | + return false; | ||
8260 | +} | ||
8261 | +#endif /* CONFIG_ZONE_DMA */ | ||
8262 | diff --git a/mm/shmem.c b/mm/shmem.c | ||
8263 | index b119c44435bff..aae2f408f9053 100644 | ||
8264 | --- a/mm/shmem.c | ||
8265 | +++ b/mm/shmem.c | ||
8266 | @@ -466,7 +466,7 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, | ||
8267 | struct shmem_inode_info *info; | ||
8268 | struct page *page; | ||
8269 | unsigned long batch = sc ? sc->nr_to_scan : 128; | ||
8270 | - int removed = 0, split = 0; | ||
8271 | + int split = 0; | ||
8272 | |||
8273 | if (list_empty(&sbinfo->shrinklist)) | ||
8274 | return SHRINK_STOP; | ||
8275 | @@ -481,7 +481,6 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, | ||
8276 | /* inode is about to be evicted */ | ||
8277 | if (!inode) { | ||
8278 | list_del_init(&info->shrinklist); | ||
8279 | - removed++; | ||
8280 | goto next; | ||
8281 | } | ||
8282 | |||
8283 | @@ -489,12 +488,12 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, | ||
8284 | if (round_up(inode->i_size, PAGE_SIZE) == | ||
8285 | round_up(inode->i_size, HPAGE_PMD_SIZE)) { | ||
8286 | list_move(&info->shrinklist, &to_remove); | ||
8287 | - removed++; | ||
8288 | goto next; | ||
8289 | } | ||
8290 | |||
8291 | list_move(&info->shrinklist, &list); | ||
8292 | next: | ||
8293 | + sbinfo->shrinklist_len--; | ||
8294 | if (!--batch) | ||
8295 | break; | ||
8296 | } | ||
8297 | @@ -514,7 +513,7 @@ next: | ||
8298 | inode = &info->vfs_inode; | ||
8299 | |||
8300 | if (nr_to_split && split >= nr_to_split) | ||
8301 | - goto leave; | ||
8302 | + goto move_back; | ||
8303 | |||
8304 | page = find_get_page(inode->i_mapping, | ||
8305 | (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); | ||
8306 | @@ -528,38 +527,44 @@ next: | ||
8307 | } | ||
8308 | |||
8309 | /* | ||
8310 | - * Leave the inode on the list if we failed to lock | ||
8311 | - * the page at this time. | ||
8312 | + * Move the inode on the list back to shrinklist if we failed | ||
8313 | + * to lock the page at this time. | ||
8314 | * | ||
8315 | * Waiting for the lock may lead to deadlock in the | ||
8316 | * reclaim path. | ||
8317 | */ | ||
8318 | if (!trylock_page(page)) { | ||
8319 | put_page(page); | ||
8320 | - goto leave; | ||
8321 | + goto move_back; | ||
8322 | } | ||
8323 | |||
8324 | ret = split_huge_page(page); | ||
8325 | unlock_page(page); | ||
8326 | put_page(page); | ||
8327 | |||
8328 | - /* If split failed leave the inode on the list */ | ||
8329 | + /* If split failed move the inode on the list back to shrinklist */ | ||
8330 | if (ret) | ||
8331 | - goto leave; | ||
8332 | + goto move_back; | ||
8333 | |||
8334 | split++; | ||
8335 | drop: | ||
8336 | list_del_init(&info->shrinklist); | ||
8337 | - removed++; | ||
8338 | -leave: | ||
8339 | + goto put; | ||
8340 | +move_back: | ||
8341 | + /* | ||
8342 | + * Make sure the inode is either on the global list or deleted | ||
8343 | + * from any local list before iput() since it could be deleted | ||
8344 | + * in another thread once we put the inode (then the local list | ||
8345 | + * is corrupted). | ||
8346 | + */ | ||
8347 | + spin_lock(&sbinfo->shrinklist_lock); | ||
8348 | + list_move(&info->shrinklist, &sbinfo->shrinklist); | ||
8349 | + sbinfo->shrinklist_len++; | ||
8350 | + spin_unlock(&sbinfo->shrinklist_lock); | ||
8351 | +put: | ||
8352 | iput(inode); | ||
8353 | } | ||
8354 | |||
8355 | - spin_lock(&sbinfo->shrinklist_lock); | ||
8356 | - list_splice_tail(&list, &sbinfo->shrinklist); | ||
8357 | - sbinfo->shrinklist_len -= removed; | ||
8358 | - spin_unlock(&sbinfo->shrinklist_lock); | ||
8359 | - | ||
8360 | return split; | ||
8361 | } | ||
8362 | |||
8363 | diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c | ||
8364 | index 7e052d6f759b6..e59c5aa27ee0b 100644 | ||
8365 | --- a/net/batman-adv/netlink.c | ||
8366 | +++ b/net/batman-adv/netlink.c | ||
8367 | @@ -1351,21 +1351,21 @@ static const struct genl_ops batadv_netlink_ops[] = { | ||
8368 | { | ||
8369 | .cmd = BATADV_CMD_TP_METER, | ||
8370 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8371 | - .flags = GENL_ADMIN_PERM, | ||
8372 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8373 | .doit = batadv_netlink_tp_meter_start, | ||
8374 | .internal_flags = BATADV_FLAG_NEED_MESH, | ||
8375 | }, | ||
8376 | { | ||
8377 | .cmd = BATADV_CMD_TP_METER_CANCEL, | ||
8378 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8379 | - .flags = GENL_ADMIN_PERM, | ||
8380 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8381 | .doit = batadv_netlink_tp_meter_cancel, | ||
8382 | .internal_flags = BATADV_FLAG_NEED_MESH, | ||
8383 | }, | ||
8384 | { | ||
8385 | .cmd = BATADV_CMD_GET_ROUTING_ALGOS, | ||
8386 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8387 | - .flags = GENL_ADMIN_PERM, | ||
8388 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8389 | .dumpit = batadv_algo_dump, | ||
8390 | }, | ||
8391 | { | ||
8392 | @@ -1380,68 +1380,68 @@ static const struct genl_ops batadv_netlink_ops[] = { | ||
8393 | { | ||
8394 | .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, | ||
8395 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8396 | - .flags = GENL_ADMIN_PERM, | ||
8397 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8398 | .dumpit = batadv_tt_local_dump, | ||
8399 | }, | ||
8400 | { | ||
8401 | .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, | ||
8402 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8403 | - .flags = GENL_ADMIN_PERM, | ||
8404 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8405 | .dumpit = batadv_tt_global_dump, | ||
8406 | }, | ||
8407 | { | ||
8408 | .cmd = BATADV_CMD_GET_ORIGINATORS, | ||
8409 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8410 | - .flags = GENL_ADMIN_PERM, | ||
8411 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8412 | .dumpit = batadv_orig_dump, | ||
8413 | }, | ||
8414 | { | ||
8415 | .cmd = BATADV_CMD_GET_NEIGHBORS, | ||
8416 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8417 | - .flags = GENL_ADMIN_PERM, | ||
8418 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8419 | .dumpit = batadv_hardif_neigh_dump, | ||
8420 | }, | ||
8421 | { | ||
8422 | .cmd = BATADV_CMD_GET_GATEWAYS, | ||
8423 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8424 | - .flags = GENL_ADMIN_PERM, | ||
8425 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8426 | .dumpit = batadv_gw_dump, | ||
8427 | }, | ||
8428 | { | ||
8429 | .cmd = BATADV_CMD_GET_BLA_CLAIM, | ||
8430 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8431 | - .flags = GENL_ADMIN_PERM, | ||
8432 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8433 | .dumpit = batadv_bla_claim_dump, | ||
8434 | }, | ||
8435 | { | ||
8436 | .cmd = BATADV_CMD_GET_BLA_BACKBONE, | ||
8437 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8438 | - .flags = GENL_ADMIN_PERM, | ||
8439 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8440 | .dumpit = batadv_bla_backbone_dump, | ||
8441 | }, | ||
8442 | { | ||
8443 | .cmd = BATADV_CMD_GET_DAT_CACHE, | ||
8444 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8445 | - .flags = GENL_ADMIN_PERM, | ||
8446 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8447 | .dumpit = batadv_dat_cache_dump, | ||
8448 | }, | ||
8449 | { | ||
8450 | .cmd = BATADV_CMD_GET_MCAST_FLAGS, | ||
8451 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8452 | - .flags = GENL_ADMIN_PERM, | ||
8453 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8454 | .dumpit = batadv_mcast_flags_dump, | ||
8455 | }, | ||
8456 | { | ||
8457 | .cmd = BATADV_CMD_SET_MESH, | ||
8458 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8459 | - .flags = GENL_ADMIN_PERM, | ||
8460 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8461 | .doit = batadv_netlink_set_mesh, | ||
8462 | .internal_flags = BATADV_FLAG_NEED_MESH, | ||
8463 | }, | ||
8464 | { | ||
8465 | .cmd = BATADV_CMD_SET_HARDIF, | ||
8466 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8467 | - .flags = GENL_ADMIN_PERM, | ||
8468 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8469 | .doit = batadv_netlink_set_hardif, | ||
8470 | .internal_flags = BATADV_FLAG_NEED_MESH | | ||
8471 | BATADV_FLAG_NEED_HARDIF, | ||
8472 | @@ -1457,7 +1457,7 @@ static const struct genl_ops batadv_netlink_ops[] = { | ||
8473 | { | ||
8474 | .cmd = BATADV_CMD_SET_VLAN, | ||
8475 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | ||
8476 | - .flags = GENL_ADMIN_PERM, | ||
8477 | + .flags = GENL_UNS_ADMIN_PERM, | ||
8478 | .doit = batadv_netlink_set_vlan, | ||
8479 | .internal_flags = BATADV_FLAG_NEED_MESH | | ||
8480 | BATADV_FLAG_NEED_VLAN, | ||
8481 | diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c | ||
8482 | index 0a2d78e811cf5..83eb84e8e688f 100644 | ||
8483 | --- a/net/bluetooth/cmtp/core.c | ||
8484 | +++ b/net/bluetooth/cmtp/core.c | ||
8485 | @@ -501,9 +501,7 @@ static int __init cmtp_init(void) | ||
8486 | { | ||
8487 | BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); | ||
8488 | |||
8489 | - cmtp_init_sockets(); | ||
8490 | - | ||
8491 | - return 0; | ||
8492 | + return cmtp_init_sockets(); | ||
8493 | } | ||
8494 | |||
8495 | static void __exit cmtp_exit(void) | ||
8496 | diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c | ||
8497 | index c50e3e8afbd34..2edaa601df13a 100644 | ||
8498 | --- a/net/bluetooth/hci_core.c | ||
8499 | +++ b/net/bluetooth/hci_core.c | ||
8500 | @@ -3387,6 +3387,7 @@ int hci_register_dev(struct hci_dev *hdev) | ||
8501 | return id; | ||
8502 | |||
8503 | err_wqueue: | ||
8504 | + debugfs_remove_recursive(hdev->debugfs); | ||
8505 | destroy_workqueue(hdev->workqueue); | ||
8506 | destroy_workqueue(hdev->req_workqueue); | ||
8507 | err: | ||
8508 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c | ||
8509 | index 31469ff084cd3..40f1593651e84 100644 | ||
8510 | --- a/net/bluetooth/hci_event.c | ||
8511 | +++ b/net/bluetooth/hci_event.c | ||
8512 | @@ -5506,7 +5506,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
8513 | struct hci_ev_le_advertising_info *ev = ptr; | ||
8514 | s8 rssi; | ||
8515 | |||
8516 | - if (ev->length <= HCI_MAX_AD_LENGTH) { | ||
8517 | + if (ev->length <= HCI_MAX_AD_LENGTH && | ||
8518 | + ev->data + ev->length <= skb_tail_pointer(skb)) { | ||
8519 | rssi = ev->data[ev->length]; | ||
8520 | process_adv_report(hdev, ev->evt_type, &ev->bdaddr, | ||
8521 | ev->bdaddr_type, NULL, 0, rssi, | ||
8522 | @@ -5516,6 +5517,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
8523 | } | ||
8524 | |||
8525 | ptr += sizeof(*ev) + ev->length + 1; | ||
8526 | + | ||
8527 | + if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { | ||
8528 | + bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); | ||
8529 | + break; | ||
8530 | + } | ||
8531 | } | ||
8532 | |||
8533 | hci_dev_unlock(hdev); | ||
8534 | diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c | ||
8535 | index 2371b833b2bcd..480e4111b24c1 100644 | ||
8536 | --- a/net/bridge/br_netfilter_hooks.c | ||
8537 | +++ b/net/bridge/br_netfilter_hooks.c | ||
8538 | @@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff | ||
8539 | if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) | ||
8540 | mtu = nf_bridge->frag_max_size; | ||
8541 | |||
8542 | + nf_bridge_update_protocol(skb); | ||
8543 | + nf_bridge_push_encap_header(skb); | ||
8544 | + | ||
8545 | if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { | ||
8546 | nf_bridge_info_free(skb); | ||
8547 | return br_dev_queue_push_xmit(net, sk, skb); | ||
8548 | @@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff | ||
8549 | |||
8550 | IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; | ||
8551 | |||
8552 | - nf_bridge_update_protocol(skb); | ||
8553 | - | ||
8554 | data = this_cpu_ptr(&brnf_frag_data_storage); | ||
8555 | |||
8556 | if (skb_vlan_tag_present(skb)) { | ||
8557 | @@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff | ||
8558 | |||
8559 | IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; | ||
8560 | |||
8561 | - nf_bridge_update_protocol(skb); | ||
8562 | - | ||
8563 | data = this_cpu_ptr(&brnf_frag_data_storage); | ||
8564 | data->encap_size = nf_bridge_encap_header_len(skb); | ||
8565 | data->size = ETH_HLEN + data->encap_size; | ||
8566 | diff --git a/net/core/filter.c b/net/core/filter.c | ||
8567 | index 5ebc973ed4c50..92ce4d46f02e4 100644 | ||
8568 | --- a/net/core/filter.c | ||
8569 | +++ b/net/core/filter.c | ||
8570 | @@ -4248,12 +4248,14 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, | ||
8571 | switch (optname) { | ||
8572 | case SO_RCVBUF: | ||
8573 | val = min_t(u32, val, sysctl_rmem_max); | ||
8574 | + val = min_t(int, val, INT_MAX / 2); | ||
8575 | sk->sk_userlocks |= SOCK_RCVBUF_LOCK; | ||
8576 | WRITE_ONCE(sk->sk_rcvbuf, | ||
8577 | max_t(int, val * 2, SOCK_MIN_RCVBUF)); | ||
8578 | break; | ||
8579 | case SO_SNDBUF: | ||
8580 | val = min_t(u32, val, sysctl_wmem_max); | ||
8581 | + val = min_t(int, val, INT_MAX / 2); | ||
8582 | sk->sk_userlocks |= SOCK_SNDBUF_LOCK; | ||
8583 | WRITE_ONCE(sk->sk_sndbuf, | ||
8584 | max_t(int, val * 2, SOCK_MIN_SNDBUF)); | ||
8585 | @@ -6910,9 +6912,9 @@ void bpf_warn_invalid_xdp_action(u32 act) | ||
8586 | { | ||
8587 | const u32 act_max = XDP_REDIRECT; | ||
8588 | |||
8589 | - WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", | ||
8590 | - act > act_max ? "Illegal" : "Driver unsupported", | ||
8591 | - act); | ||
8592 | + pr_warn_once("%s XDP return value %u, expect packet loss!\n", | ||
8593 | + act > act_max ? "Illegal" : "Driver unsupported", | ||
8594 | + act); | ||
8595 | } | ||
8596 | EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); | ||
8597 | |||
8598 | diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c | ||
8599 | index 05b0c60bfba2b..bcad7028bbf45 100644 | ||
8600 | --- a/net/core/net-sysfs.c | ||
8601 | +++ b/net/core/net-sysfs.c | ||
8602 | @@ -1661,6 +1661,9 @@ static void remove_queue_kobjects(struct net_device *dev) | ||
8603 | |||
8604 | net_rx_queue_update_kobjects(dev, real_rx, 0); | ||
8605 | netdev_queue_update_kobjects(dev, real_tx, 0); | ||
8606 | + | ||
8607 | + dev->real_num_rx_queues = 0; | ||
8608 | + dev->real_num_tx_queues = 0; | ||
8609 | #ifdef CONFIG_SYSFS | ||
8610 | kset_unregister(dev->queues_kset); | ||
8611 | #endif | ||
8612 | diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c | ||
8613 | index cd1d40195e461..62a972f04cefb 100644 | ||
8614 | --- a/net/core/net_namespace.c | ||
8615 | +++ b/net/core/net_namespace.c | ||
8616 | @@ -168,8 +168,10 @@ static void ops_exit_list(const struct pernet_operations *ops, | ||
8617 | { | ||
8618 | struct net *net; | ||
8619 | if (ops->exit) { | ||
8620 | - list_for_each_entry(net, net_exit_list, exit_list) | ||
8621 | + list_for_each_entry(net, net_exit_list, exit_list) { | ||
8622 | ops->exit(net); | ||
8623 | + cond_resched(); | ||
8624 | + } | ||
8625 | } | ||
8626 | if (ops->exit_batch) | ||
8627 | ops->exit_batch(net_exit_list); | ||
8628 | diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c | ||
8629 | index ce4b28f011485..692ba6d6180f8 100644 | ||
8630 | --- a/net/ipv4/fib_semantics.c | ||
8631 | +++ b/net/ipv4/fib_semantics.c | ||
8632 | @@ -29,6 +29,7 @@ | ||
8633 | #include <linux/init.h> | ||
8634 | #include <linux/slab.h> | ||
8635 | #include <linux/netlink.h> | ||
8636 | +#include <linux/hash.h> | ||
8637 | |||
8638 | #include <net/arp.h> | ||
8639 | #include <net/ip.h> | ||
8640 | @@ -318,11 +319,15 @@ static inline int nh_comp(struct fib_info *fi, struct fib_info *ofi) | ||
8641 | |||
8642 | static inline unsigned int fib_devindex_hashfn(unsigned int val) | ||
8643 | { | ||
8644 | - unsigned int mask = DEVINDEX_HASHSIZE - 1; | ||
8645 | + return hash_32(val, DEVINDEX_HASHBITS); | ||
8646 | +} | ||
8647 | + | ||
8648 | +static struct hlist_head * | ||
8649 | +fib_info_devhash_bucket(const struct net_device *dev) | ||
8650 | +{ | ||
8651 | + u32 val = net_hash_mix(dev_net(dev)) ^ dev->ifindex; | ||
8652 | |||
8653 | - return (val ^ | ||
8654 | - (val >> DEVINDEX_HASHBITS) ^ | ||
8655 | - (val >> (DEVINDEX_HASHBITS * 2))) & mask; | ||
8656 | + return &fib_info_devhash[fib_devindex_hashfn(val)]; | ||
8657 | } | ||
8658 | |||
8659 | static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope, | ||
8660 | @@ -432,12 +437,11 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev) | ||
8661 | { | ||
8662 | struct hlist_head *head; | ||
8663 | struct fib_nh *nh; | ||
8664 | - unsigned int hash; | ||
8665 | |||
8666 | spin_lock(&fib_info_lock); | ||
8667 | |||
8668 | - hash = fib_devindex_hashfn(dev->ifindex); | ||
8669 | - head = &fib_info_devhash[hash]; | ||
8670 | + head = fib_info_devhash_bucket(dev); | ||
8671 | + | ||
8672 | hlist_for_each_entry(nh, head, nh_hash) { | ||
8673 | if (nh->fib_nh_dev == dev && | ||
8674 | nh->fib_nh_gw4 == gw && | ||
8675 | @@ -1594,12 +1598,10 @@ link_it: | ||
8676 | } else { | ||
8677 | change_nexthops(fi) { | ||
8678 | struct hlist_head *head; | ||
8679 | - unsigned int hash; | ||
8680 | |||
8681 | if (!nexthop_nh->fib_nh_dev) | ||
8682 | continue; | ||
8683 | - hash = fib_devindex_hashfn(nexthop_nh->fib_nh_dev->ifindex); | ||
8684 | - head = &fib_info_devhash[hash]; | ||
8685 | + head = fib_info_devhash_bucket(nexthop_nh->fib_nh_dev); | ||
8686 | hlist_add_head(&nexthop_nh->nh_hash, head); | ||
8687 | } endfor_nexthops(fi) | ||
8688 | } | ||
8689 | @@ -1940,8 +1942,7 @@ void fib_nhc_update_mtu(struct fib_nh_common *nhc, u32 new, u32 orig) | ||
8690 | |||
8691 | void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) | ||
8692 | { | ||
8693 | - unsigned int hash = fib_devindex_hashfn(dev->ifindex); | ||
8694 | - struct hlist_head *head = &fib_info_devhash[hash]; | ||
8695 | + struct hlist_head *head = fib_info_devhash_bucket(dev); | ||
8696 | struct fib_nh *nh; | ||
8697 | |||
8698 | hlist_for_each_entry(nh, head, nh_hash) { | ||
8699 | @@ -1960,12 +1961,11 @@ void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) | ||
8700 | */ | ||
8701 | int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force) | ||
8702 | { | ||
8703 | - int ret = 0; | ||
8704 | - int scope = RT_SCOPE_NOWHERE; | ||
8705 | + struct hlist_head *head = fib_info_devhash_bucket(dev); | ||
8706 | struct fib_info *prev_fi = NULL; | ||
8707 | - unsigned int hash = fib_devindex_hashfn(dev->ifindex); | ||
8708 | - struct hlist_head *head = &fib_info_devhash[hash]; | ||
8709 | + int scope = RT_SCOPE_NOWHERE; | ||
8710 | struct fib_nh *nh; | ||
8711 | + int ret = 0; | ||
8712 | |||
8713 | if (force) | ||
8714 | scope = -1; | ||
8715 | @@ -2110,7 +2110,6 @@ out: | ||
8716 | int fib_sync_up(struct net_device *dev, unsigned char nh_flags) | ||
8717 | { | ||
8718 | struct fib_info *prev_fi; | ||
8719 | - unsigned int hash; | ||
8720 | struct hlist_head *head; | ||
8721 | struct fib_nh *nh; | ||
8722 | int ret; | ||
8723 | @@ -2126,8 +2125,7 @@ int fib_sync_up(struct net_device *dev, unsigned char nh_flags) | ||
8724 | } | ||
8725 | |||
8726 | prev_fi = NULL; | ||
8727 | - hash = fib_devindex_hashfn(dev->ifindex); | ||
8728 | - head = &fib_info_devhash[hash]; | ||
8729 | + head = fib_info_devhash_bucket(dev); | ||
8730 | ret = 0; | ||
8731 | |||
8732 | hlist_for_each_entry(nh, head, nh_hash) { | ||
8733 | diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c | ||
8734 | index 10d31733297d7..e0e8a65d561ec 100644 | ||
8735 | --- a/net/ipv4/inet_fragment.c | ||
8736 | +++ b/net/ipv4/inet_fragment.c | ||
8737 | @@ -204,9 +204,9 @@ void inet_frag_kill(struct inet_frag_queue *fq) | ||
8738 | /* The RCU read lock provides a memory barrier | ||
8739 | * guaranteeing that if fqdir->dead is false then | ||
8740 | * the hash table destruction will not start until | ||
8741 | - * after we unlock. Paired with inet_frags_exit_net(). | ||
8742 | + * after we unlock. Paired with fqdir_pre_exit(). | ||
8743 | */ | ||
8744 | - if (!fqdir->dead) { | ||
8745 | + if (!READ_ONCE(fqdir->dead)) { | ||
8746 | rhashtable_remove_fast(&fqdir->rhashtable, &fq->node, | ||
8747 | fqdir->f->rhash_params); | ||
8748 | refcount_dec(&fq->refcnt); | ||
8749 | @@ -321,9 +321,11 @@ static struct inet_frag_queue *inet_frag_create(struct fqdir *fqdir, | ||
8750 | /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ | ||
8751 | struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key) | ||
8752 | { | ||
8753 | + /* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ | ||
8754 | + long high_thresh = READ_ONCE(fqdir->high_thresh); | ||
8755 | struct inet_frag_queue *fq = NULL, *prev; | ||
8756 | |||
8757 | - if (!fqdir->high_thresh || frag_mem_limit(fqdir) > fqdir->high_thresh) | ||
8758 | + if (!high_thresh || frag_mem_limit(fqdir) > high_thresh) | ||
8759 | return NULL; | ||
8760 | |||
8761 | rcu_read_lock(); | ||
8762 | diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c | ||
8763 | index cfeb8890f94ee..fad803d2d711e 100644 | ||
8764 | --- a/net/ipv4/ip_fragment.c | ||
8765 | +++ b/net/ipv4/ip_fragment.c | ||
8766 | @@ -144,7 +144,8 @@ static void ip_expire(struct timer_list *t) | ||
8767 | |||
8768 | rcu_read_lock(); | ||
8769 | |||
8770 | - if (qp->q.fqdir->dead) | ||
8771 | + /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ | ||
8772 | + if (READ_ONCE(qp->q.fqdir->dead)) | ||
8773 | goto out_rcu_unlock; | ||
8774 | |||
8775 | spin_lock(&qp->q.lock); | ||
8776 | diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c | ||
8777 | index c4989e5903e43..f67f1d27f5655 100644 | ||
8778 | --- a/net/ipv4/ip_gre.c | ||
8779 | +++ b/net/ipv4/ip_gre.c | ||
8780 | @@ -577,8 +577,9 @@ static int gre_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) | ||
8781 | |||
8782 | key = &info->key; | ||
8783 | ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, | ||
8784 | - tunnel_id_to_key32(key->tun_id), key->tos, 0, | ||
8785 | - skb->mark, skb_get_hash(skb)); | ||
8786 | + tunnel_id_to_key32(key->tun_id), | ||
8787 | + key->tos & ~INET_ECN_MASK, 0, skb->mark, | ||
8788 | + skb_get_hash(skb)); | ||
8789 | rt = ip_route_output_key(dev_net(dev), &fl4); | ||
8790 | if (IS_ERR(rt)) | ||
8791 | return PTR_ERR(rt); | ||
8792 | diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c | ||
8793 | index 6bdb1ab8af617..63ebb87d85331 100644 | ||
8794 | --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c | ||
8795 | +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | ||
8796 | @@ -505,8 +505,11 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) | ||
8797 | if (IS_ERR(config)) | ||
8798 | return PTR_ERR(config); | ||
8799 | } | ||
8800 | - } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) | ||
8801 | + } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) { | ||
8802 | + clusterip_config_entry_put(config); | ||
8803 | + clusterip_config_put(config); | ||
8804 | return -EINVAL; | ||
8805 | + } | ||
8806 | |||
8807 | ret = nf_ct_netns_get(par->net, par->family); | ||
8808 | if (ret < 0) { | ||
8809 | diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c | ||
8810 | index 0cb8056d98003..5dbc280d43856 100644 | ||
8811 | --- a/net/ipv6/ip6_gre.c | ||
8812 | +++ b/net/ipv6/ip6_gre.c | ||
8813 | @@ -743,6 +743,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, | ||
8814 | fl6->daddr = key->u.ipv6.dst; | ||
8815 | fl6->flowlabel = key->label; | ||
8816 | fl6->flowi6_uid = sock_net_uid(dev_net(dev), NULL); | ||
8817 | + fl6->fl6_gre_key = tunnel_id_to_key32(key->tun_id); | ||
8818 | |||
8819 | dsfield = key->tos; | ||
8820 | flags = key->tun_flags & | ||
8821 | @@ -978,6 +979,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, | ||
8822 | fl6.daddr = key->u.ipv6.dst; | ||
8823 | fl6.flowlabel = key->label; | ||
8824 | fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); | ||
8825 | + fl6.fl6_gre_key = tunnel_id_to_key32(key->tun_id); | ||
8826 | |||
8827 | dsfield = key->tos; | ||
8828 | if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) | ||
8829 | @@ -1085,6 +1087,7 @@ static void ip6gre_tnl_link_config_common(struct ip6_tnl *t) | ||
8830 | fl6->flowi6_oif = p->link; | ||
8831 | fl6->flowlabel = 0; | ||
8832 | fl6->flowi6_proto = IPPROTO_GRE; | ||
8833 | + fl6->fl6_gre_key = t->parms.o_key; | ||
8834 | |||
8835 | if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) | ||
8836 | fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; | ||
8837 | @@ -1530,7 +1533,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev) | ||
8838 | static struct inet6_protocol ip6gre_protocol __read_mostly = { | ||
8839 | .handler = gre_rcv, | ||
8840 | .err_handler = ip6gre_err, | ||
8841 | - .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | ||
8842 | + .flags = INET6_PROTO_FINAL, | ||
8843 | }; | ||
8844 | |||
8845 | static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head) | ||
8846 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c | ||
8847 | index 282bf336b15a4..464029892478f 100644 | ||
8848 | --- a/net/mac80211/rx.c | ||
8849 | +++ b/net/mac80211/rx.c | ||
8850 | @@ -4693,7 +4693,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, | ||
8851 | goto drop; | ||
8852 | break; | ||
8853 | case RX_ENC_VHT: | ||
8854 | - if (WARN_ONCE(status->rate_idx > 9 || | ||
8855 | + if (WARN_ONCE(status->rate_idx > 11 || | ||
8856 | !status->nss || | ||
8857 | status->nss > 8, | ||
8858 | "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n", | ||
8859 | diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c | ||
8860 | index a7e861eede2d9..bd2174699af97 100644 | ||
8861 | --- a/net/nfc/llcp_sock.c | ||
8862 | +++ b/net/nfc/llcp_sock.c | ||
8863 | @@ -789,6 +789,11 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg, | ||
8864 | |||
8865 | lock_sock(sk); | ||
8866 | |||
8867 | + if (!llcp_sock->local) { | ||
8868 | + release_sock(sk); | ||
8869 | + return -ENODEV; | ||
8870 | + } | ||
8871 | + | ||
8872 | if (sk->sk_type == SOCK_DGRAM) { | ||
8873 | DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, | ||
8874 | msg->msg_name); | ||
8875 | diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c | ||
8876 | index d973f8a15e117..ae5847de94c88 100644 | ||
8877 | --- a/net/sched/sch_generic.c | ||
8878 | +++ b/net/sched/sch_generic.c | ||
8879 | @@ -1396,6 +1396,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, | ||
8880 | { | ||
8881 | memset(r, 0, sizeof(*r)); | ||
8882 | r->overhead = conf->overhead; | ||
8883 | + r->mpu = conf->mpu; | ||
8884 | r->rate_bytes_ps = max_t(u64, conf->rate, rate64); | ||
8885 | r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); | ||
8886 | r->mult = 1; | ||
8887 | diff --git a/net/unix/garbage.c b/net/unix/garbage.c | ||
8888 | index 12e2ddaf887f2..d45d5366115a7 100644 | ||
8889 | --- a/net/unix/garbage.c | ||
8890 | +++ b/net/unix/garbage.c | ||
8891 | @@ -192,8 +192,11 @@ void wait_for_unix_gc(void) | ||
8892 | { | ||
8893 | /* If number of inflight sockets is insane, | ||
8894 | * force a garbage collect right now. | ||
8895 | + * Paired with the WRITE_ONCE() in unix_inflight(), | ||
8896 | + * unix_notinflight() and gc_in_progress(). | ||
8897 | */ | ||
8898 | - if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) | ||
8899 | + if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && | ||
8900 | + !READ_ONCE(gc_in_progress)) | ||
8901 | unix_gc(); | ||
8902 | wait_event(unix_gc_wait, gc_in_progress == false); | ||
8903 | } | ||
8904 | @@ -213,7 +216,9 @@ void unix_gc(void) | ||
8905 | if (gc_in_progress) | ||
8906 | goto out; | ||
8907 | |||
8908 | - gc_in_progress = true; | ||
8909 | + /* Paired with READ_ONCE() in wait_for_unix_gc(). */ | ||
8910 | + WRITE_ONCE(gc_in_progress, true); | ||
8911 | + | ||
8912 | /* First, select candidates for garbage collection. Only | ||
8913 | * in-flight sockets are considered, and from those only ones | ||
8914 | * which don't have any external reference. | ||
8915 | @@ -299,7 +304,10 @@ void unix_gc(void) | ||
8916 | |||
8917 | /* All candidates should have been detached by now. */ | ||
8918 | BUG_ON(!list_empty(&gc_candidates)); | ||
8919 | - gc_in_progress = false; | ||
8920 | + | ||
8921 | + /* Paired with READ_ONCE() in wait_for_unix_gc(). */ | ||
8922 | + WRITE_ONCE(gc_in_progress, false); | ||
8923 | + | ||
8924 | wake_up(&unix_gc_wait); | ||
8925 | |||
8926 | out: | ||
8927 | diff --git a/net/unix/scm.c b/net/unix/scm.c | ||
8928 | index 8c40f2b323924..ce700b22eccee 100644 | ||
8929 | --- a/net/unix/scm.c | ||
8930 | +++ b/net/unix/scm.c | ||
8931 | @@ -59,7 +59,8 @@ void unix_inflight(struct user_struct *user, struct file *fp) | ||
8932 | } else { | ||
8933 | BUG_ON(list_empty(&u->link)); | ||
8934 | } | ||
8935 | - unix_tot_inflight++; | ||
8936 | + /* Paired with READ_ONCE() in wait_for_unix_gc() */ | ||
8937 | + WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); | ||
8938 | } | ||
8939 | user->unix_inflight++; | ||
8940 | spin_unlock(&unix_gc_lock); | ||
8941 | @@ -79,7 +80,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp) | ||
8942 | |||
8943 | if (atomic_long_dec_and_test(&u->inflight)) | ||
8944 | list_del_init(&u->link); | ||
8945 | - unix_tot_inflight--; | ||
8946 | + /* Paired with READ_ONCE() in wait_for_unix_gc() */ | ||
8947 | + WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); | ||
8948 | } | ||
8949 | user->unix_inflight--; | ||
8950 | spin_unlock(&unix_gc_lock); | ||
8951 | diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c | ||
8952 | index 74e90d78c3b46..08343201513a9 100644 | ||
8953 | --- a/net/xfrm/xfrm_interface.c | ||
8954 | +++ b/net/xfrm/xfrm_interface.c | ||
8955 | @@ -659,11 +659,16 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev, | ||
8956 | struct netlink_ext_ack *extack) | ||
8957 | { | ||
8958 | struct net *net = dev_net(dev); | ||
8959 | - struct xfrm_if_parms p; | ||
8960 | + struct xfrm_if_parms p = {}; | ||
8961 | struct xfrm_if *xi; | ||
8962 | int err; | ||
8963 | |||
8964 | xfrmi_netlink_parms(data, &p); | ||
8965 | + if (!p.if_id) { | ||
8966 | + NL_SET_ERR_MSG(extack, "if_id must be non zero"); | ||
8967 | + return -EINVAL; | ||
8968 | + } | ||
8969 | + | ||
8970 | xi = xfrmi_locate(net, &p); | ||
8971 | if (xi) | ||
8972 | return -EEXIST; | ||
8973 | @@ -688,7 +693,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[], | ||
8974 | { | ||
8975 | struct xfrm_if *xi = netdev_priv(dev); | ||
8976 | struct net *net = xi->net; | ||
8977 | - struct xfrm_if_parms p; | ||
8978 | + struct xfrm_if_parms p = {}; | ||
8979 | + | ||
8980 | + if (!p.if_id) { | ||
8981 | + NL_SET_ERR_MSG(extack, "if_id must be non zero"); | ||
8982 | + return -EINVAL; | ||
8983 | + } | ||
8984 | |||
8985 | xfrmi_netlink_parms(data, &p); | ||
8986 | xi = xfrmi_locate(net, &p); | ||
8987 | diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c | ||
8988 | index 32c8163427970..404823c5eb7d5 100644 | ||
8989 | --- a/net/xfrm/xfrm_policy.c | ||
8990 | +++ b/net/xfrm/xfrm_policy.c | ||
8991 | @@ -31,8 +31,10 @@ | ||
8992 | #include <linux/if_tunnel.h> | ||
8993 | #include <net/dst.h> | ||
8994 | #include <net/flow.h> | ||
8995 | +#include <net/inet_ecn.h> | ||
8996 | #include <net/xfrm.h> | ||
8997 | #include <net/ip.h> | ||
8998 | +#include <net/gre.h> | ||
8999 | #if IS_ENABLED(CONFIG_IPV6_MIP6) | ||
9000 | #include <net/mip6.h> | ||
9001 | #endif | ||
9002 | @@ -3281,7 +3283,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse) | ||
9003 | fl4->flowi4_proto = iph->protocol; | ||
9004 | fl4->daddr = reverse ? iph->saddr : iph->daddr; | ||
9005 | fl4->saddr = reverse ? iph->daddr : iph->saddr; | ||
9006 | - fl4->flowi4_tos = iph->tos; | ||
9007 | + fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK; | ||
9008 | |||
9009 | if (!ip_is_fragment(iph)) { | ||
9010 | switch (iph->protocol) { | ||
9011 | @@ -3443,6 +3445,26 @@ decode_session6(struct sk_buff *skb, struct flowi *fl, bool reverse) | ||
9012 | } | ||
9013 | fl6->flowi6_proto = nexthdr; | ||
9014 | return; | ||
9015 | + case IPPROTO_GRE: | ||
9016 | + if (!onlyproto && | ||
9017 | + (nh + offset + 12 < skb->data || | ||
9018 | + pskb_may_pull(skb, nh + offset + 12 - skb->data))) { | ||
9019 | + struct gre_base_hdr *gre_hdr; | ||
9020 | + __be32 *gre_key; | ||
9021 | + | ||
9022 | + nh = skb_network_header(skb); | ||
9023 | + gre_hdr = (struct gre_base_hdr *)(nh + offset); | ||
9024 | + gre_key = (__be32 *)(gre_hdr + 1); | ||
9025 | + | ||
9026 | + if (gre_hdr->flags & GRE_KEY) { | ||
9027 | + if (gre_hdr->flags & GRE_CSUM) | ||
9028 | + gre_key++; | ||
9029 | + fl6->fl6_gre_key = *gre_key; | ||
9030 | + } | ||
9031 | + } | ||
9032 | + fl6->flowi6_proto = nexthdr; | ||
9033 | + return; | ||
9034 | + | ||
9035 | #if IS_ENABLED(CONFIG_IPV6_MIP6) | ||
9036 | case IPPROTO_MH: | ||
9037 | offset += ipv6_optlen(exthdr); | ||
9038 | diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c | ||
9039 | index 0cee2d3c6e452..42ff32700d68b 100644 | ||
9040 | --- a/net/xfrm/xfrm_user.c | ||
9041 | +++ b/net/xfrm/xfrm_user.c | ||
9042 | @@ -621,8 +621,13 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, | ||
9043 | |||
9044 | xfrm_smark_init(attrs, &x->props.smark); | ||
9045 | |||
9046 | - if (attrs[XFRMA_IF_ID]) | ||
9047 | + if (attrs[XFRMA_IF_ID]) { | ||
9048 | x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); | ||
9049 | + if (!x->if_id) { | ||
9050 | + err = -EINVAL; | ||
9051 | + goto error; | ||
9052 | + } | ||
9053 | + } | ||
9054 | |||
9055 | err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); | ||
9056 | if (err) | ||
9057 | @@ -1328,8 +1333,13 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, | ||
9058 | |||
9059 | mark = xfrm_mark_get(attrs, &m); | ||
9060 | |||
9061 | - if (attrs[XFRMA_IF_ID]) | ||
9062 | + if (attrs[XFRMA_IF_ID]) { | ||
9063 | if_id = nla_get_u32(attrs[XFRMA_IF_ID]); | ||
9064 | + if (!if_id) { | ||
9065 | + err = -EINVAL; | ||
9066 | + goto out_noput; | ||
9067 | + } | ||
9068 | + } | ||
9069 | |||
9070 | if (p->info.seq) { | ||
9071 | x = xfrm_find_acq_byseq(net, mark, p->info.seq); | ||
9072 | @@ -1631,8 +1641,13 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us | ||
9073 | |||
9074 | xfrm_mark_get(attrs, &xp->mark); | ||
9075 | |||
9076 | - if (attrs[XFRMA_IF_ID]) | ||
9077 | + if (attrs[XFRMA_IF_ID]) { | ||
9078 | xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); | ||
9079 | + if (!xp->if_id) { | ||
9080 | + err = -EINVAL; | ||
9081 | + goto error; | ||
9082 | + } | ||
9083 | + } | ||
9084 | |||
9085 | return xp; | ||
9086 | error: | ||
9087 | @@ -2816,7 +2831,7 @@ static inline unsigned int xfrm_sa_len(struct xfrm_state *x) | ||
9088 | if (x->props.extra_flags) | ||
9089 | l += nla_total_size(sizeof(x->props.extra_flags)); | ||
9090 | if (x->xso.dev) | ||
9091 | - l += nla_total_size(sizeof(x->xso)); | ||
9092 | + l += nla_total_size(sizeof(struct xfrm_user_offload)); | ||
9093 | if (x->props.smark.v | x->props.smark.m) { | ||
9094 | l += nla_total_size(sizeof(x->props.smark.v)); | ||
9095 | l += nla_total_size(sizeof(x->props.smark.m)); | ||
9096 | diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff | ||
9097 | index 00fd4738a5877..ae6c766a56ccc 100755 | ||
9098 | --- a/scripts/dtc/dtx_diff | ||
9099 | +++ b/scripts/dtc/dtx_diff | ||
9100 | @@ -56,12 +56,8 @@ Otherwise DTx is treated as a dts source file (aka .dts). | ||
9101 | or '/include/' to be processed. | ||
9102 | |||
9103 | If DTx_1 and DTx_2 are in different architectures, then this script | ||
9104 | - may not work since \${ARCH} is part of the include path. Two possible | ||
9105 | - workarounds: | ||
9106 | - | ||
9107 | - `basename $0` \\ | ||
9108 | - <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ | ||
9109 | - <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) | ||
9110 | + may not work since \${ARCH} is part of the include path. The following | ||
9111 | + workaround can be used: | ||
9112 | |||
9113 | `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts | ||
9114 | `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts | ||
9115 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c | ||
9116 | index 91f2ba0b225b7..56418cf72069d 100644 | ||
9117 | --- a/security/selinux/hooks.c | ||
9118 | +++ b/security/selinux/hooks.c | ||
9119 | @@ -995,18 +995,22 @@ out: | ||
9120 | static int selinux_add_opt(int token, const char *s, void **mnt_opts) | ||
9121 | { | ||
9122 | struct selinux_mnt_opts *opts = *mnt_opts; | ||
9123 | + bool is_alloc_opts = false; | ||
9124 | |||
9125 | if (token == Opt_seclabel) /* eaten and completely ignored */ | ||
9126 | return 0; | ||
9127 | |||
9128 | + if (!s) | ||
9129 | + return -ENOMEM; | ||
9130 | + | ||
9131 | if (!opts) { | ||
9132 | opts = kzalloc(sizeof(struct selinux_mnt_opts), GFP_KERNEL); | ||
9133 | if (!opts) | ||
9134 | return -ENOMEM; | ||
9135 | *mnt_opts = opts; | ||
9136 | + is_alloc_opts = true; | ||
9137 | } | ||
9138 | - if (!s) | ||
9139 | - return -ENOMEM; | ||
9140 | + | ||
9141 | switch (token) { | ||
9142 | case Opt_context: | ||
9143 | if (opts->context || opts->defcontext) | ||
9144 | @@ -1031,6 +1035,10 @@ static int selinux_add_opt(int token, const char *s, void **mnt_opts) | ||
9145 | } | ||
9146 | return 0; | ||
9147 | Einval: | ||
9148 | + if (is_alloc_opts) { | ||
9149 | + kfree(opts); | ||
9150 | + *mnt_opts = NULL; | ||
9151 | + } | ||
9152 | pr_warn(SEL_MOUNT_FAIL_MSG); | ||
9153 | return -EINVAL; | ||
9154 | } | ||
9155 | diff --git a/sound/core/jack.c b/sound/core/jack.c | ||
9156 | index 8b209750c7a9c..b00ae6f39f054 100644 | ||
9157 | --- a/sound/core/jack.c | ||
9158 | +++ b/sound/core/jack.c | ||
9159 | @@ -54,10 +54,13 @@ static int snd_jack_dev_free(struct snd_device *device) | ||
9160 | struct snd_card *card = device->card; | ||
9161 | struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; | ||
9162 | |||
9163 | + down_write(&card->controls_rwsem); | ||
9164 | list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { | ||
9165 | list_del_init(&jack_kctl->list); | ||
9166 | snd_ctl_remove(card, jack_kctl->kctl); | ||
9167 | } | ||
9168 | + up_write(&card->controls_rwsem); | ||
9169 | + | ||
9170 | if (jack->private_free) | ||
9171 | jack->private_free(jack); | ||
9172 | |||
9173 | diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c | ||
9174 | index 9e31f4bd43826..841c0a12cc929 100644 | ||
9175 | --- a/sound/core/oss/pcm_oss.c | ||
9176 | +++ b/sound/core/oss/pcm_oss.c | ||
9177 | @@ -2055,7 +2055,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr | ||
9178 | int err, cmd; | ||
9179 | |||
9180 | #ifdef OSS_DEBUG | ||
9181 | - pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); | ||
9182 | + pr_debug("pcm_oss: trigger = 0x%x\n", trigger); | ||
9183 | #endif | ||
9184 | |||
9185 | psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; | ||
9186 | diff --git a/sound/core/pcm.c b/sound/core/pcm.c | ||
9187 | index 9a72d641743d9..f8ce961c28d6e 100644 | ||
9188 | --- a/sound/core/pcm.c | ||
9189 | +++ b/sound/core/pcm.c | ||
9190 | @@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); | ||
9191 | static void free_chmap(struct snd_pcm_str *pstr) | ||
9192 | { | ||
9193 | if (pstr->chmap_kctl) { | ||
9194 | - snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); | ||
9195 | + struct snd_card *card = pstr->pcm->card; | ||
9196 | + | ||
9197 | + down_write(&card->controls_rwsem); | ||
9198 | + snd_ctl_remove(card, pstr->chmap_kctl); | ||
9199 | + up_write(&card->controls_rwsem); | ||
9200 | pstr->chmap_kctl = NULL; | ||
9201 | } | ||
9202 | } | ||
9203 | diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c | ||
9204 | index 71a6ea62c3be7..4ff0b927230c2 100644 | ||
9205 | --- a/sound/core/seq/seq_queue.c | ||
9206 | +++ b/sound/core/seq/seq_queue.c | ||
9207 | @@ -234,12 +234,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *name) | ||
9208 | |||
9209 | /* -------------------------------------------------------- */ | ||
9210 | |||
9211 | +#define MAX_CELL_PROCESSES_IN_QUEUE 1000 | ||
9212 | + | ||
9213 | void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) | ||
9214 | { | ||
9215 | unsigned long flags; | ||
9216 | struct snd_seq_event_cell *cell; | ||
9217 | snd_seq_tick_time_t cur_tick; | ||
9218 | snd_seq_real_time_t cur_time; | ||
9219 | + int processed = 0; | ||
9220 | |||
9221 | if (q == NULL) | ||
9222 | return; | ||
9223 | @@ -262,6 +265,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) | ||
9224 | if (!cell) | ||
9225 | break; | ||
9226 | snd_seq_dispatch_event(cell, atomic, hop); | ||
9227 | + if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) | ||
9228 | + goto out; /* the rest processed at the next batch */ | ||
9229 | } | ||
9230 | |||
9231 | /* Process time queue... */ | ||
9232 | @@ -271,14 +276,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) | ||
9233 | if (!cell) | ||
9234 | break; | ||
9235 | snd_seq_dispatch_event(cell, atomic, hop); | ||
9236 | + if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) | ||
9237 | + goto out; /* the rest processed at the next batch */ | ||
9238 | } | ||
9239 | |||
9240 | + out: | ||
9241 | /* free lock */ | ||
9242 | spin_lock_irqsave(&q->check_lock, flags); | ||
9243 | if (q->check_again) { | ||
9244 | q->check_again = 0; | ||
9245 | - spin_unlock_irqrestore(&q->check_lock, flags); | ||
9246 | - goto __again; | ||
9247 | + if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { | ||
9248 | + spin_unlock_irqrestore(&q->check_lock, flags); | ||
9249 | + goto __again; | ||
9250 | + } | ||
9251 | } | ||
9252 | q->check_blocked = 0; | ||
9253 | spin_unlock_irqrestore(&q->check_lock, flags); | ||
9254 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c | ||
9255 | index 326f95ce5ceb1..c8847de8388f0 100644 | ||
9256 | --- a/sound/pci/hda/hda_codec.c | ||
9257 | +++ b/sound/pci/hda/hda_codec.c | ||
9258 | @@ -1721,8 +1721,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) | ||
9259 | { | ||
9260 | int i; | ||
9261 | struct hda_nid_item *items = codec->mixers.list; | ||
9262 | + | ||
9263 | + down_write(&codec->card->controls_rwsem); | ||
9264 | for (i = 0; i < codec->mixers.used; i++) | ||
9265 | snd_ctl_remove(codec->card, items[i].kctl); | ||
9266 | + up_write(&codec->card->controls_rwsem); | ||
9267 | snd_array_free(&codec->mixers); | ||
9268 | snd_array_free(&codec->nids); | ||
9269 | } | ||
9270 | diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c | ||
9271 | index 2943692f66edd..3610be1590fcc 100644 | ||
9272 | --- a/sound/soc/codecs/rt5663.c | ||
9273 | +++ b/sound/soc/codecs/rt5663.c | ||
9274 | @@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663) | ||
9275 | static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) | ||
9276 | { | ||
9277 | int table_size; | ||
9278 | + int ret; | ||
9279 | |||
9280 | device_property_read_u32(dev, "realtek,dc_offset_l_manual", | ||
9281 | &rt5663->pdata.dc_offset_l_manual); | ||
9282 | @@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) | ||
9283 | table_size = sizeof(struct impedance_mapping_table) * | ||
9284 | rt5663->pdata.impedance_sensing_num; | ||
9285 | rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); | ||
9286 | - device_property_read_u32_array(dev, | ||
9287 | + ret = device_property_read_u32_array(dev, | ||
9288 | "realtek,impedance_sensing_table", | ||
9289 | (u32 *)rt5663->imp_table, table_size); | ||
9290 | + if (ret) | ||
9291 | + return ret; | ||
9292 | } | ||
9293 | |||
9294 | return 0; | ||
9295 | @@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c, | ||
9296 | |||
9297 | if (pdata) | ||
9298 | rt5663->pdata = *pdata; | ||
9299 | - else | ||
9300 | - rt5663_parse_dp(rt5663, &i2c->dev); | ||
9301 | + else { | ||
9302 | + ret = rt5663_parse_dp(rt5663, &i2c->dev); | ||
9303 | + if (ret) | ||
9304 | + return ret; | ||
9305 | + } | ||
9306 | |||
9307 | for (i = 0; i < ARRAY_SIZE(rt5663->supplies); i++) | ||
9308 | rt5663->supplies[i].supply = rt5663_supply_names[i]; | ||
9309 | diff --git a/sound/soc/mediatek/mt8173/mt8173-max98090.c b/sound/soc/mediatek/mt8173/mt8173-max98090.c | ||
9310 | index 22c00600c999f..de1410c2c446f 100644 | ||
9311 | --- a/sound/soc/mediatek/mt8173/mt8173-max98090.c | ||
9312 | +++ b/sound/soc/mediatek/mt8173/mt8173-max98090.c | ||
9313 | @@ -180,6 +180,9 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) | ||
9314 | if (ret) | ||
9315 | dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", | ||
9316 | __func__, ret); | ||
9317 | + | ||
9318 | + of_node_put(codec_node); | ||
9319 | + of_node_put(platform_node); | ||
9320 | return ret; | ||
9321 | } | ||
9322 | |||
9323 | diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | ||
9324 | index 8717e87bfe264..6f8542329bab9 100644 | ||
9325 | --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | ||
9326 | +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | ||
9327 | @@ -218,6 +218,8 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) | ||
9328 | if (ret) | ||
9329 | dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", | ||
9330 | __func__, ret); | ||
9331 | + | ||
9332 | + of_node_put(platform_node); | ||
9333 | return ret; | ||
9334 | } | ||
9335 | |||
9336 | diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | ||
9337 | index 9d4dd97211548..727ff0f7f20b1 100644 | ||
9338 | --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | ||
9339 | +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | ||
9340 | @@ -285,6 +285,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) | ||
9341 | if (ret) | ||
9342 | dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", | ||
9343 | __func__, ret); | ||
9344 | + | ||
9345 | + of_node_put(platform_node); | ||
9346 | return ret; | ||
9347 | } | ||
9348 | |||
9349 | diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c | ||
9350 | index ef6f236752867..21e7d4d3ded5a 100644 | ||
9351 | --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c | ||
9352 | +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c | ||
9353 | @@ -309,6 +309,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) | ||
9354 | if (ret) | ||
9355 | dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", | ||
9356 | __func__, ret); | ||
9357 | + | ||
9358 | + of_node_put(platform_node); | ||
9359 | return ret; | ||
9360 | } | ||
9361 | |||
9362 | diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c | ||
9363 | index 65497cd477a50..47f6f5d70853d 100644 | ||
9364 | --- a/sound/soc/samsung/idma.c | ||
9365 | +++ b/sound/soc/samsung/idma.c | ||
9366 | @@ -363,6 +363,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) | ||
9367 | buf->addr = idma.lp_tx_addr; | ||
9368 | buf->bytes = idma_hardware.buffer_bytes_max; | ||
9369 | buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes); | ||
9370 | + if (!buf->area) | ||
9371 | + return -ENOMEM; | ||
9372 | |||
9373 | return 0; | ||
9374 | } | ||
9375 | diff --git a/sound/soc/uniphier/Kconfig b/sound/soc/uniphier/Kconfig | ||
9376 | index aa3592ee1358b..ddfa6424c656b 100644 | ||
9377 | --- a/sound/soc/uniphier/Kconfig | ||
9378 | +++ b/sound/soc/uniphier/Kconfig | ||
9379 | @@ -23,7 +23,6 @@ config SND_SOC_UNIPHIER_LD11 | ||
9380 | tristate "UniPhier LD11/LD20 Device Driver" | ||
9381 | depends on SND_SOC_UNIPHIER | ||
9382 | select SND_SOC_UNIPHIER_AIO | ||
9383 | - select SND_SOC_UNIPHIER_AIO_DMA | ||
9384 | help | ||
9385 | This adds ASoC driver for Socionext UniPhier LD11/LD20 | ||
9386 | input and output that can be used with other codecs. | ||
9387 | @@ -34,7 +33,6 @@ config SND_SOC_UNIPHIER_PXS2 | ||
9388 | tristate "UniPhier PXs2 Device Driver" | ||
9389 | depends on SND_SOC_UNIPHIER | ||
9390 | select SND_SOC_UNIPHIER_AIO | ||
9391 | - select SND_SOC_UNIPHIER_AIO_DMA | ||
9392 | help | ||
9393 | This adds ASoC driver for Socionext UniPhier PXs2 | ||
9394 | input and output that can be used with other codecs. | ||
9395 | diff --git a/tools/bpf/bpftool/Documentation/Makefile b/tools/bpf/bpftool/Documentation/Makefile | ||
9396 | index 815ac9804aee9..f79bba931cbfb 100644 | ||
9397 | --- a/tools/bpf/bpftool/Documentation/Makefile | ||
9398 | +++ b/tools/bpf/bpftool/Documentation/Makefile | ||
9399 | @@ -1,6 +1,5 @@ | ||
9400 | # SPDX-License-Identifier: GPL-2.0-only | ||
9401 | include ../../../scripts/Makefile.include | ||
9402 | -include ../../../scripts/utilities.mak | ||
9403 | |||
9404 | INSTALL ?= install | ||
9405 | RM ?= rm -f | ||
9406 | diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile | ||
9407 | index 39bc6f0f4f0bb..10ecd9dfeaf34 100644 | ||
9408 | --- a/tools/bpf/bpftool/Makefile | ||
9409 | +++ b/tools/bpf/bpftool/Makefile | ||
9410 | @@ -1,6 +1,5 @@ | ||
9411 | # SPDX-License-Identifier: GPL-2.0-only | ||
9412 | include ../../scripts/Makefile.include | ||
9413 | -include ../../scripts/utilities.mak | ||
9414 | |||
9415 | ifeq ($(srctree),) | ||
9416 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) | ||
9417 | diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c | ||
9418 | index 7d3cfb0ccbe61..4b03983acbefe 100644 | ||
9419 | --- a/tools/bpf/bpftool/main.c | ||
9420 | +++ b/tools/bpf/bpftool/main.c | ||
9421 | @@ -362,6 +362,8 @@ int main(int argc, char **argv) | ||
9422 | }; | ||
9423 | int opt, ret; | ||
9424 | |||
9425 | + setlinebuf(stdout); | ||
9426 | + | ||
9427 | last_do_help = do_help; | ||
9428 | pretty_output = false; | ||
9429 | json_output = false; | ||
9430 | diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h | ||
9431 | index 2551e9b71167b..b8cecb66d28b7 100644 | ||
9432 | --- a/tools/include/nolibc/nolibc.h | ||
9433 | +++ b/tools/include/nolibc/nolibc.h | ||
9434 | @@ -422,16 +422,22 @@ struct stat { | ||
9435 | }) | ||
9436 | |||
9437 | /* startup code */ | ||
9438 | +/* | ||
9439 | + * x86-64 System V ABI mandates: | ||
9440 | + * 1) %rsp must be 16-byte aligned right before the function call. | ||
9441 | + * 2) The deepest stack frame should be zero (the %rbp). | ||
9442 | + * | ||
9443 | + */ | ||
9444 | asm(".section .text\n" | ||
9445 | ".global _start\n" | ||
9446 | "_start:\n" | ||
9447 | "pop %rdi\n" // argc (first arg, %rdi) | ||
9448 | "mov %rsp, %rsi\n" // argv[] (second arg, %rsi) | ||
9449 | "lea 8(%rsi,%rdi,8),%rdx\n" // then a NULL then envp (third arg, %rdx) | ||
9450 | - "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned when | ||
9451 | - "sub $8, %rsp\n" // entering the callee | ||
9452 | + "xor %ebp, %ebp\n" // zero the stack frame | ||
9453 | + "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned before call | ||
9454 | "call main\n" // main() returns the status code, we'll exit with it. | ||
9455 | - "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits | ||
9456 | + "mov %eax, %edi\n" // retrieve exit code (32 bit) | ||
9457 | "mov $60, %rax\n" // NR_exit == 60 | ||
9458 | "syscall\n" // really exit | ||
9459 | "hlt\n" // ensure it does not return | ||
9460 | @@ -600,20 +606,28 @@ struct sys_stat_struct { | ||
9461 | }) | ||
9462 | |||
9463 | /* startup code */ | ||
9464 | +/* | ||
9465 | + * i386 System V ABI mandates: | ||
9466 | + * 1) last pushed argument must be 16-byte aligned. | ||
9467 | + * 2) The deepest stack frame should be set to zero | ||
9468 | + * | ||
9469 | + */ | ||
9470 | asm(".section .text\n" | ||
9471 | ".global _start\n" | ||
9472 | "_start:\n" | ||
9473 | "pop %eax\n" // argc (first arg, %eax) | ||
9474 | "mov %esp, %ebx\n" // argv[] (second arg, %ebx) | ||
9475 | "lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx) | ||
9476 | - "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned when | ||
9477 | + "xor %ebp, %ebp\n" // zero the stack frame | ||
9478 | + "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned before | ||
9479 | + "sub $4, %esp\n" // the call instruction (args are aligned) | ||
9480 | "push %ecx\n" // push all registers on the stack so that we | ||
9481 | "push %ebx\n" // support both regparm and plain stack modes | ||
9482 | "push %eax\n" | ||
9483 | "call main\n" // main() returns the status code in %eax | ||
9484 | - "movzbl %al, %ebx\n" // retrieve exit code from lower 8 bits | ||
9485 | - "movl $1, %eax\n" // NR_exit == 1 | ||
9486 | - "int $0x80\n" // exit now | ||
9487 | + "mov %eax, %ebx\n" // retrieve exit code (32-bit int) | ||
9488 | + "movl $1, %eax\n" // NR_exit == 1 | ||
9489 | + "int $0x80\n" // exit now | ||
9490 | "hlt\n" // ensure it does not | ||
9491 | ""); | ||
9492 | |||
9493 | @@ -797,7 +811,6 @@ asm(".section .text\n" | ||
9494 | "and %r3, %r1, $-8\n" // AAPCS : sp must be 8-byte aligned in the | ||
9495 | "mov %sp, %r3\n" // callee, an bl doesn't push (lr=pc) | ||
9496 | "bl main\n" // main() returns the status code, we'll exit with it. | ||
9497 | - "and %r0, %r0, $0xff\n" // limit exit code to 8 bits | ||
9498 | "movs r7, $1\n" // NR_exit == 1 | ||
9499 | "svc $0x00\n" | ||
9500 | ""); | ||
9501 | @@ -994,7 +1007,6 @@ asm(".section .text\n" | ||
9502 | "add x2, x2, x1\n" // + argv | ||
9503 | "and sp, x1, -16\n" // sp must be 16-byte aligned in the callee | ||
9504 | "bl main\n" // main() returns the status code, we'll exit with it. | ||
9505 | - "and x0, x0, 0xff\n" // limit exit code to 8 bits | ||
9506 | "mov x8, 93\n" // NR_exit == 93 | ||
9507 | "svc #0\n" | ||
9508 | ""); | ||
9509 | @@ -1199,7 +1211,7 @@ asm(".section .text\n" | ||
9510 | "addiu $sp,$sp,-16\n" // the callee expects to save a0..a3 there! | ||
9511 | "jal main\n" // main() returns the status code, we'll exit with it. | ||
9512 | "nop\n" // delayed slot | ||
9513 | - "and $a0, $v0, 0xff\n" // limit exit code to 8 bits | ||
9514 | + "move $a0, $v0\n" // retrieve 32-bit exit code from v0 | ||
9515 | "li $v0, 4001\n" // NR_exit == 4001 | ||
9516 | "syscall\n" | ||
9517 | ".end __start\n" | ||
9518 | @@ -1397,7 +1409,6 @@ asm(".section .text\n" | ||
9519 | "add a2,a2,a1\n" // + argv | ||
9520 | "andi sp,a1,-16\n" // sp must be 16-byte aligned | ||
9521 | "call main\n" // main() returns the status code, we'll exit with it. | ||
9522 | - "andi a0, a0, 0xff\n" // limit exit code to 8 bits | ||
9523 | "li a7, 93\n" // NR_exit == 93 | ||
9524 | "ecall\n" | ||
9525 | ""); | ||
9526 | diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c | ||
9527 | index e55114f0336f0..682146d043793 100644 | ||
9528 | --- a/tools/perf/util/debug.c | ||
9529 | +++ b/tools/perf/util/debug.c | ||
9530 | @@ -143,7 +143,7 @@ static int trace_event_printer(enum binary_printer_ops op, | ||
9531 | break; | ||
9532 | case BINARY_PRINT_CHAR_DATA: | ||
9533 | printed += color_fprintf(fp, color, "%c", | ||
9534 | - isprint(ch) ? ch : '.'); | ||
9535 | + isprint(ch) && isascii(ch) ? ch : '.'); | ||
9536 | break; | ||
9537 | case BINARY_PRINT_CHAR_PAD: | ||
9538 | printed += color_fprintf(fp, color, " "); |