Contents of /trunk/kernel-alx/patches-5.4/0185-5.4.86-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(show annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (20 months ago) by niro
File size: 434239 byte(s)
Mon Oct 24 12:40:44 2022 UTC (20 months ago) by niro
File size: 434239 byte(s)
-add missing
1 | diff --git a/Documentation/x86/topology.rst b/Documentation/x86/topology.rst |
2 | index e29739904e37e..7f58010ea86af 100644 |
3 | --- a/Documentation/x86/topology.rst |
4 | +++ b/Documentation/x86/topology.rst |
5 | @@ -41,6 +41,8 @@ Package |
6 | Packages contain a number of cores plus shared resources, e.g. DRAM |
7 | controller, shared caches etc. |
8 | |
9 | +Modern systems may also use the term 'Die' for package. |
10 | + |
11 | AMD nomenclature for package is 'Node'. |
12 | |
13 | Package-related topology information in the kernel: |
14 | @@ -53,11 +55,18 @@ Package-related topology information in the kernel: |
15 | |
16 | The number of dies in a package. This information is retrieved via CPUID. |
17 | |
18 | + - cpuinfo_x86.cpu_die_id: |
19 | + |
20 | + The physical ID of the die. This information is retrieved via CPUID. |
21 | + |
22 | - cpuinfo_x86.phys_proc_id: |
23 | |
24 | The physical ID of the package. This information is retrieved via CPUID |
25 | and deduced from the APIC IDs of the cores in the package. |
26 | |
27 | + Modern systems use this value for the socket. There may be multiple |
28 | + packages within a socket. This value may differ from cpu_die_id. |
29 | + |
30 | - cpuinfo_x86.logical_proc_id: |
31 | |
32 | The logical ID of the package. As we do not trust BIOSes to enumerate the |
33 | diff --git a/Makefile b/Makefile |
34 | index a2a2546fcda80..e1a94c8d278e6 100644 |
35 | --- a/Makefile |
36 | +++ b/Makefile |
37 | @@ -1,7 +1,7 @@ |
38 | # SPDX-License-Identifier: GPL-2.0 |
39 | VERSION = 5 |
40 | PATCHLEVEL = 4 |
41 | -SUBLEVEL = 85 |
42 | +SUBLEVEL = 86 |
43 | EXTRAVERSION = |
44 | NAME = Kleptomaniac Octopus |
45 | |
46 | diff --git a/arch/Kconfig b/arch/Kconfig |
47 | index 84653a823d3b0..a8df66e645442 100644 |
48 | --- a/arch/Kconfig |
49 | +++ b/arch/Kconfig |
50 | @@ -131,6 +131,22 @@ config UPROBES |
51 | managed by the kernel and kept transparent to the probed |
52 | application. ) |
53 | |
54 | +config HAVE_64BIT_ALIGNED_ACCESS |
55 | + def_bool 64BIT && !HAVE_EFFICIENT_UNALIGNED_ACCESS |
56 | + help |
57 | + Some architectures require 64 bit accesses to be 64 bit |
58 | + aligned, which also requires structs containing 64 bit values |
59 | + to be 64 bit aligned too. This includes some 32 bit |
60 | + architectures which can do 64 bit accesses, as well as 64 bit |
61 | + architectures without unaligned access. |
62 | + |
63 | + This symbol should be selected by an architecture if 64 bit |
64 | + accesses are required to be 64 bit aligned in this way even |
65 | + though it is not a 64 bit architecture. |
66 | + |
67 | + See Documentation/unaligned-memory-access.txt for more |
68 | + information on the topic of unaligned memory accesses. |
69 | + |
70 | config HAVE_EFFICIENT_UNALIGNED_ACCESS |
71 | bool |
72 | help |
73 | diff --git a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
74 | index 267d0c178e55c..30abb4b64a1b6 100644 |
75 | --- a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
76 | +++ b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
77 | @@ -266,11 +266,6 @@ |
78 | reg = <0x11000 0x100>; |
79 | }; |
80 | |
81 | -&i2c1 { |
82 | - compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c"; |
83 | - reg = <0x11100 0x100>; |
84 | -}; |
85 | - |
86 | &mpic { |
87 | reg = <0x20a00 0x2d0>, <0x21070 0x58>; |
88 | }; |
89 | diff --git a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
90 | index 682f729ea25e1..c58230fea45f8 100644 |
91 | --- a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
92 | +++ b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
93 | @@ -81,11 +81,6 @@ |
94 | status = "okay"; |
95 | }; |
96 | |
97 | -&vuart { |
98 | - // VUART Host Console |
99 | - status = "okay"; |
100 | -}; |
101 | - |
102 | &uart1 { |
103 | // Host Console |
104 | status = "okay"; |
105 | diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
106 | index 22dade6393d06..d1dbe3b6ad5a7 100644 |
107 | --- a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
108 | +++ b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
109 | @@ -22,9 +22,9 @@ |
110 | #size-cells = <1>; |
111 | ranges; |
112 | |
113 | - vga_memory: framebuffer@7f000000 { |
114 | + vga_memory: framebuffer@9f000000 { |
115 | no-map; |
116 | - reg = <0x7f000000 0x01000000>; |
117 | + reg = <0x9f000000 0x01000000>; /* 16M */ |
118 | }; |
119 | }; |
120 | |
121 | diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
122 | index 61f068a7b362a..400eaf640fe42 100644 |
123 | --- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
124 | +++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
125 | @@ -242,6 +242,11 @@ |
126 | atmel,pins = |
127 | <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */ |
128 | }; |
129 | + pinctrl_usb_default: usb_default { |
130 | + atmel,pins = |
131 | + <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE |
132 | + AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; |
133 | + }; |
134 | }; |
135 | }; |
136 | }; |
137 | @@ -259,6 +264,8 @@ |
138 | &pioE 3 GPIO_ACTIVE_LOW |
139 | &pioE 4 GPIO_ACTIVE_LOW |
140 | >; |
141 | + pinctrl-names = "default"; |
142 | + pinctrl-0 = <&pinctrl_usb_default>; |
143 | status = "okay"; |
144 | }; |
145 | |
146 | diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts |
147 | index fdfc37d716e01..1d101067371b4 100644 |
148 | --- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts |
149 | +++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts |
150 | @@ -133,6 +133,11 @@ |
151 | atmel,pins = |
152 | <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; |
153 | }; |
154 | + pinctrl_usb_default: usb_default { |
155 | + atmel,pins = |
156 | + <AT91_PIOE 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE |
157 | + AT91_PIOE 14 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; |
158 | + }; |
159 | pinctrl_key_gpio: key_gpio_0 { |
160 | atmel,pins = |
161 | <AT91_PIOE 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; |
162 | @@ -158,6 +163,8 @@ |
163 | &pioE 11 GPIO_ACTIVE_HIGH |
164 | &pioE 14 GPIO_ACTIVE_HIGH |
165 | >; |
166 | + pinctrl-names = "default"; |
167 | + pinctrl-0 = <&pinctrl_usb_default>; |
168 | status = "okay"; |
169 | }; |
170 | |
171 | diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi |
172 | index ea024e4b6e095..0121bb0ecde16 100644 |
173 | --- a/arch/arm/boot/dts/at91sam9rl.dtsi |
174 | +++ b/arch/arm/boot/dts/at91sam9rl.dtsi |
175 | @@ -278,23 +278,26 @@ |
176 | atmel,adc-use-res = "highres"; |
177 | |
178 | trigger0 { |
179 | - trigger-name = "timer-counter-0"; |
180 | + trigger-name = "external-rising"; |
181 | trigger-value = <0x1>; |
182 | + trigger-external; |
183 | }; |
184 | + |
185 | trigger1 { |
186 | - trigger-name = "timer-counter-1"; |
187 | - trigger-value = <0x3>; |
188 | + trigger-name = "external-falling"; |
189 | + trigger-value = <0x2>; |
190 | + trigger-external; |
191 | }; |
192 | |
193 | trigger2 { |
194 | - trigger-name = "timer-counter-2"; |
195 | - trigger-value = <0x5>; |
196 | + trigger-name = "external-any"; |
197 | + trigger-value = <0x3>; |
198 | + trigger-external; |
199 | }; |
200 | |
201 | trigger3 { |
202 | - trigger-name = "external"; |
203 | - trigger-value = <0x13>; |
204 | - trigger-external; |
205 | + trigger-name = "continuous"; |
206 | + trigger-value = <0x6>; |
207 | }; |
208 | }; |
209 | |
210 | diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts b/arch/arm/boot/dts/exynos5410-odroidxu.dts |
211 | index e0db251e253f0..f68baaf58f9e3 100644 |
212 | --- a/arch/arm/boot/dts/exynos5410-odroidxu.dts |
213 | +++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts |
214 | @@ -327,6 +327,8 @@ |
215 | regulator-name = "vddq_lcd"; |
216 | regulator-min-microvolt = <1800000>; |
217 | regulator-max-microvolt = <1800000>; |
218 | + /* Supplies also GPK and GPJ */ |
219 | + regulator-always-on; |
220 | }; |
221 | |
222 | ldo8_reg: LDO8 { |
223 | @@ -637,11 +639,11 @@ |
224 | }; |
225 | |
226 | &usbdrd_dwc3_0 { |
227 | - dr_mode = "host"; |
228 | + dr_mode = "peripheral"; |
229 | }; |
230 | |
231 | &usbdrd_dwc3_1 { |
232 | - dr_mode = "peripheral"; |
233 | + dr_mode = "host"; |
234 | }; |
235 | |
236 | &usbdrd3_0 { |
237 | diff --git a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi |
238 | index 369a8a7f21050..481ee99aa9c97 100644 |
239 | --- a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi |
240 | +++ b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi |
241 | @@ -560,6 +560,34 @@ |
242 | interrupt-controller; |
243 | #interrupt-cells = <2>; |
244 | }; |
245 | + |
246 | + usb3_1_oc: usb3-1-oc { |
247 | + samsung,pins = "gpk2-4", "gpk2-5"; |
248 | + samsung,pin-function = <EXYNOS_PIN_FUNC_2>; |
249 | + samsung,pin-pud = <EXYNOS_PIN_PULL_UP>; |
250 | + samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>; |
251 | + }; |
252 | + |
253 | + usb3_1_vbusctrl: usb3-1-vbusctrl { |
254 | + samsung,pins = "gpk2-6", "gpk2-7"; |
255 | + samsung,pin-function = <EXYNOS_PIN_FUNC_2>; |
256 | + samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>; |
257 | + samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>; |
258 | + }; |
259 | + |
260 | + usb3_0_oc: usb3-0-oc { |
261 | + samsung,pins = "gpk3-0", "gpk3-1"; |
262 | + samsung,pin-function = <EXYNOS_PIN_FUNC_2>; |
263 | + samsung,pin-pud = <EXYNOS_PIN_PULL_UP>; |
264 | + samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>; |
265 | + }; |
266 | + |
267 | + usb3_0_vbusctrl: usb3-0-vbusctrl { |
268 | + samsung,pins = "gpk3-2", "gpk3-3"; |
269 | + samsung,pin-function = <EXYNOS_PIN_FUNC_2>; |
270 | + samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>; |
271 | + samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>; |
272 | + }; |
273 | }; |
274 | |
275 | &pinctrl_2 { |
276 | diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi |
277 | index e6f78b1cee7c8..d077373cf872d 100644 |
278 | --- a/arch/arm/boot/dts/exynos5410.dtsi |
279 | +++ b/arch/arm/boot/dts/exynos5410.dtsi |
280 | @@ -398,6 +398,8 @@ |
281 | &usbdrd3_0 { |
282 | clocks = <&clock CLK_USBD300>; |
283 | clock-names = "usbdrd30"; |
284 | + pinctrl-names = "default"; |
285 | + pinctrl-0 = <&usb3_0_oc>, <&usb3_0_vbusctrl>; |
286 | }; |
287 | |
288 | &usbdrd_phy0 { |
289 | @@ -409,6 +411,8 @@ |
290 | &usbdrd3_1 { |
291 | clocks = <&clock CLK_USBD301>; |
292 | clock-names = "usbdrd30"; |
293 | + pinctrl-names = "default"; |
294 | + pinctrl-0 = <&usb3_1_oc>, <&usb3_1_vbusctrl>; |
295 | }; |
296 | |
297 | &usbdrd_dwc3_1 { |
298 | diff --git a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi |
299 | index 81c7ebb4b3fbe..6acc8591219a7 100644 |
300 | --- a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi |
301 | +++ b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi |
302 | @@ -551,7 +551,7 @@ |
303 | |
304 | pinctrl_i2c3: i2c3grp { |
305 | fsl,pins = < |
306 | - MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1 |
307 | + MX6QDL_PAD_GPIO_5__I2C3_SCL 0x4001b8b1 |
308 | MX6QDL_PAD_GPIO_16__I2C3_SDA 0x4001b8b1 |
309 | >; |
310 | }; |
311 | diff --git a/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi |
312 | index 93909796885a0..b9b698f72b261 100644 |
313 | --- a/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi |
314 | +++ b/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi |
315 | @@ -166,7 +166,6 @@ |
316 | MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b030 |
317 | MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b030 |
318 | MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b030 |
319 | - MX6QDL_PAD_GPIO_6__ENET_IRQ 0x000b1 |
320 | >; |
321 | }; |
322 | |
323 | diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts |
324 | index a24eccc354b95..0f9c71137bed5 100644 |
325 | --- a/arch/arm/boot/dts/meson8b-odroidc1.dts |
326 | +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts |
327 | @@ -219,7 +219,7 @@ |
328 | reg = <0>; |
329 | |
330 | reset-assert-us = <10000>; |
331 | - reset-deassert-us = <30000>; |
332 | + reset-deassert-us = <80000>; |
333 | reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; |
334 | |
335 | interrupt-parent = <&gpio_intc>; |
336 | diff --git a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts |
337 | index d54477b1001ca..84b6ed51099db 100644 |
338 | --- a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts |
339 | +++ b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts |
340 | @@ -83,7 +83,7 @@ |
341 | reg = <0>; |
342 | |
343 | reset-assert-us = <10000>; |
344 | - reset-deassert-us = <30000>; |
345 | + reset-deassert-us = <80000>; |
346 | reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; |
347 | }; |
348 | }; |
349 | diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts |
350 | index 9dd307b526048..468ad1b641380 100644 |
351 | --- a/arch/arm/boot/dts/omap4-panda-es.dts |
352 | +++ b/arch/arm/boot/dts/omap4-panda-es.dts |
353 | @@ -46,7 +46,7 @@ |
354 | |
355 | button_pins: pinmux_button_pins { |
356 | pinctrl-single,pins = < |
357 | - OMAP4_IOPAD(0x11b, PIN_INPUT_PULLUP | MUX_MODE3) /* gpio_113 */ |
358 | + OMAP4_IOPAD(0x0fc, PIN_INPUT_PULLUP | MUX_MODE3) /* gpio_113 */ |
359 | >; |
360 | }; |
361 | }; |
362 | diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi |
363 | index 2e2c1a7b1d1dc..b05bab57f90a3 100644 |
364 | --- a/arch/arm/boot/dts/sama5d2.dtsi |
365 | +++ b/arch/arm/boot/dts/sama5d2.dtsi |
366 | @@ -648,6 +648,7 @@ |
367 | clocks = <&pmc PMC_TYPE_PERIPHERAL 51>; |
368 | #address-cells = <1>; |
369 | #size-cells = <1>; |
370 | + no-memory-wc; |
371 | ranges = <0 0xf8044000 0x1420>; |
372 | }; |
373 | |
374 | @@ -716,7 +717,7 @@ |
375 | |
376 | can0: can@f8054000 { |
377 | compatible = "bosch,m_can"; |
378 | - reg = <0xf8054000 0x4000>, <0x210000 0x4000>; |
379 | + reg = <0xf8054000 0x4000>, <0x210000 0x1c00>; |
380 | reg-names = "m_can", "message_ram"; |
381 | interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>, |
382 | <64 IRQ_TYPE_LEVEL_HIGH 7>; |
383 | @@ -938,7 +939,7 @@ |
384 | |
385 | can1: can@fc050000 { |
386 | compatible = "bosch,m_can"; |
387 | - reg = <0xfc050000 0x4000>, <0x210000 0x4000>; |
388 | + reg = <0xfc050000 0x4000>, <0x210000 0x3800>; |
389 | reg-names = "m_can", "message_ram"; |
390 | interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>, |
391 | <65 IRQ_TYPE_LEVEL_HIGH 7>; |
392 | @@ -948,7 +949,7 @@ |
393 | assigned-clocks = <&pmc PMC_TYPE_GCK 57>; |
394 | assigned-clock-parents = <&pmc PMC_TYPE_CORE PMC_UTMI>; |
395 | assigned-clock-rates = <40000000>; |
396 | - bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>; |
397 | + bosch,mram-cfg = <0x1c00 0 0 64 0 0 32 32>; |
398 | status = "disabled"; |
399 | }; |
400 | |
401 | diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts b/arch/arm/boot/dts/sun7i-a20-bananapi.dts |
402 | index bb3987e101c29..0b3d9ae756503 100644 |
403 | --- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts |
404 | +++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts |
405 | @@ -132,7 +132,7 @@ |
406 | pinctrl-names = "default"; |
407 | pinctrl-0 = <&gmac_rgmii_pins>; |
408 | phy-handle = <&phy1>; |
409 | - phy-mode = "rgmii"; |
410 | + phy-mode = "rgmii-id"; |
411 | phy-supply = <®_gmac_3v3>; |
412 | status = "okay"; |
413 | }; |
414 | diff --git a/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts b/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts |
415 | index fce2f7fcd084a..bf38c66c1815b 100644 |
416 | --- a/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts |
417 | +++ b/arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts |
418 | @@ -1,5 +1,5 @@ |
419 | /* |
420 | - * Copyright 2015 Adam Sampson <ats@offog.org> |
421 | + * Copyright 2015-2020 Adam Sampson <ats@offog.org> |
422 | * |
423 | * This file is dual-licensed: you can use it either under the terms |
424 | * of the GPL or the X11 license, at your option. Note that this dual |
425 | @@ -115,7 +115,7 @@ |
426 | pinctrl-names = "default"; |
427 | pinctrl-0 = <&gmac_rgmii_pins>; |
428 | phy-handle = <&phy1>; |
429 | - phy-mode = "rgmii"; |
430 | + phy-mode = "rgmii-id"; |
431 | status = "okay"; |
432 | }; |
433 | |
434 | diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi |
435 | index 2abcba35d27e6..50c32cf72c65c 100644 |
436 | --- a/arch/arm/boot/dts/sun8i-v3s.dtsi |
437 | +++ b/arch/arm/boot/dts/sun8i-v3s.dtsi |
438 | @@ -423,7 +423,7 @@ |
439 | gic: interrupt-controller@1c81000 { |
440 | compatible = "arm,gic-400"; |
441 | reg = <0x01c81000 0x1000>, |
442 | - <0x01c82000 0x1000>, |
443 | + <0x01c82000 0x2000>, |
444 | <0x01c84000 0x2000>, |
445 | <0x01c86000 0x2000>; |
446 | interrupt-controller; |
447 | diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts |
448 | index 15c22b06fc4b6..47954551f5735 100644 |
449 | --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts |
450 | +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts |
451 | @@ -120,7 +120,7 @@ |
452 | pinctrl-names = "default"; |
453 | pinctrl-0 = <&gmac_rgmii_pins>; |
454 | phy-handle = <&phy1>; |
455 | - phy-mode = "rgmii"; |
456 | + phy-mode = "rgmii-id"; |
457 | phy-supply = <®_dc1sw>; |
458 | status = "okay"; |
459 | }; |
460 | @@ -198,16 +198,16 @@ |
461 | }; |
462 | |
463 | ®_dc1sw { |
464 | - regulator-min-microvolt = <3000000>; |
465 | - regulator-max-microvolt = <3000000>; |
466 | + regulator-min-microvolt = <3300000>; |
467 | + regulator-max-microvolt = <3300000>; |
468 | regulator-name = "vcc-gmac-phy"; |
469 | }; |
470 | |
471 | ®_dcdc1 { |
472 | regulator-always-on; |
473 | - regulator-min-microvolt = <3000000>; |
474 | - regulator-max-microvolt = <3000000>; |
475 | - regulator-name = "vcc-3v0"; |
476 | + regulator-min-microvolt = <3300000>; |
477 | + regulator-max-microvolt = <3300000>; |
478 | + regulator-name = "vcc-3v3"; |
479 | }; |
480 | |
481 | ®_dcdc2 { |
482 | diff --git a/arch/arm/crypto/aes-ce-core.S b/arch/arm/crypto/aes-ce-core.S |
483 | index 4d1707388d941..312428d83eedb 100644 |
484 | --- a/arch/arm/crypto/aes-ce-core.S |
485 | +++ b/arch/arm/crypto/aes-ce-core.S |
486 | @@ -386,20 +386,32 @@ ENTRY(ce_aes_ctr_encrypt) |
487 | .Lctrloop4x: |
488 | subs r4, r4, #4 |
489 | bmi .Lctr1x |
490 | - add r6, r6, #1 |
491 | + |
492 | + /* |
493 | + * NOTE: the sequence below has been carefully tweaked to avoid |
494 | + * a silicon erratum that exists in Cortex-A57 (#1742098) and |
495 | + * Cortex-A72 (#1655431) cores, where AESE/AESMC instruction pairs |
496 | + * may produce an incorrect result if they take their input from a |
497 | + * register of which a single 32-bit lane has been updated the last |
498 | + * time it was modified. To work around this, the lanes of registers |
499 | + * q0-q3 below are not manipulated individually, and the different |
500 | + * counter values are prepared by successive manipulations of q7. |
501 | + */ |
502 | + add ip, r6, #1 |
503 | vmov q0, q7 |
504 | + rev ip, ip |
505 | + add lr, r6, #2 |
506 | + vmov s31, ip @ set lane 3 of q1 via q7 |
507 | + add ip, r6, #3 |
508 | + rev lr, lr |
509 | vmov q1, q7 |
510 | - rev ip, r6 |
511 | - add r6, r6, #1 |
512 | + vmov s31, lr @ set lane 3 of q2 via q7 |
513 | + rev ip, ip |
514 | vmov q2, q7 |
515 | - vmov s7, ip |
516 | - rev ip, r6 |
517 | - add r6, r6, #1 |
518 | + vmov s31, ip @ set lane 3 of q3 via q7 |
519 | + add r6, r6, #4 |
520 | vmov q3, q7 |
521 | - vmov s11, ip |
522 | - rev ip, r6 |
523 | - add r6, r6, #1 |
524 | - vmov s15, ip |
525 | + |
526 | vld1.8 {q4-q5}, [r1]! |
527 | vld1.8 {q6}, [r1]! |
528 | vld1.8 {q15}, [r1]! |
529 | diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S |
530 | index c49b39340ddbd..f1cdc1f369575 100644 |
531 | --- a/arch/arm/kernel/head.S |
532 | +++ b/arch/arm/kernel/head.S |
533 | @@ -671,12 +671,8 @@ ARM_BE8(rev16 ip, ip) |
534 | ldrcc r7, [r4], #4 @ use branch for delay slot |
535 | bcc 1b |
536 | bx lr |
537 | -#else |
538 | -#ifdef CONFIG_CPU_ENDIAN_BE8 |
539 | - moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction |
540 | #else |
541 | moveq r0, #0x400000 @ set bit 22, mov to mvn instruction |
542 | -#endif |
543 | b 2f |
544 | 1: ldr ip, [r7, r3] |
545 | #ifdef CONFIG_CPU_ENDIAN_BE8 |
546 | @@ -685,7 +681,7 @@ ARM_BE8(rev16 ip, ip) |
547 | tst ip, #0x000f0000 @ check the rotation field |
548 | orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24 |
549 | biceq ip, ip, #0x00004000 @ clear bit 22 |
550 | - orreq ip, ip, r0 @ mask in offset bits 7-0 |
551 | + orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0 |
552 | #else |
553 | bic ip, ip, #0x000000ff |
554 | tst ip, #0xf00 @ check the rotation field |
555 | diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c |
556 | index 933b6930f024f..a0ca5e7a68de2 100644 |
557 | --- a/arch/arm/mach-sunxi/sunxi.c |
558 | +++ b/arch/arm/mach-sunxi/sunxi.c |
559 | @@ -66,6 +66,7 @@ static const char * const sun8i_board_dt_compat[] = { |
560 | "allwinner,sun8i-h2-plus", |
561 | "allwinner,sun8i-h3", |
562 | "allwinner,sun8i-r40", |
563 | + "allwinner,sun8i-v3", |
564 | "allwinner,sun8i-v3s", |
565 | NULL, |
566 | }; |
567 | diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts |
568 | index 17155fb73fce9..c48125bf9d1e3 100644 |
569 | --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts |
570 | +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts |
571 | @@ -340,7 +340,7 @@ |
572 | eee-broken-1000t; |
573 | |
574 | reset-assert-us = <10000>; |
575 | - reset-deassert-us = <30000>; |
576 | + reset-deassert-us = <80000>; |
577 | reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; |
578 | |
579 | interrupt-parent = <&gpio_intc>; |
580 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
581 | index 233eb1cd79671..d94b695916a35 100644 |
582 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
583 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
584 | @@ -165,7 +165,7 @@ |
585 | reg = <0>; |
586 | |
587 | reset-assert-us = <10000>; |
588 | - reset-deassert-us = <30000>; |
589 | + reset-deassert-us = <80000>; |
590 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
591 | |
592 | interrupt-parent = <&gpio_intc>; |
593 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
594 | index b0b12e3898350..8828acb3fd4c5 100644 |
595 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
596 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
597 | @@ -138,7 +138,7 @@ |
598 | reg = <0>; |
599 | |
600 | reset-assert-us = <10000>; |
601 | - reset-deassert-us = <30000>; |
602 | + reset-deassert-us = <80000>; |
603 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
604 | |
605 | interrupt-parent = <&gpio_intc>; |
606 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
607 | index 43b11e3dfe119..29976215e1446 100644 |
608 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
609 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
610 | @@ -126,7 +126,7 @@ |
611 | reg = <0>; |
612 | |
613 | reset-assert-us = <10000>; |
614 | - reset-deassert-us = <30000>; |
615 | + reset-deassert-us = <80000>; |
616 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
617 | |
618 | interrupt-parent = <&gpio_intc>; |
619 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
620 | index 4c539881fbb73..e3d17569d98ad 100644 |
621 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
622 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
623 | @@ -147,7 +147,7 @@ |
624 | reg = <0>; |
625 | |
626 | reset-assert-us = <10000>; |
627 | - reset-deassert-us = <30000>; |
628 | + reset-deassert-us = <80000>; |
629 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
630 | }; |
631 | }; |
632 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts |
633 | index b08c4537f260d..b2ab05c220903 100644 |
634 | --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts |
635 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts |
636 | @@ -82,7 +82,7 @@ |
637 | |
638 | /* External PHY reset is shared with internal PHY Led signal */ |
639 | reset-assert-us = <10000>; |
640 | - reset-deassert-us = <30000>; |
641 | + reset-deassert-us = <80000>; |
642 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
643 | |
644 | interrupt-parent = <&gpio_intc>; |
645 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
646 | index 3f43716d5c453..c8a4205117f15 100644 |
647 | --- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
648 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
649 | @@ -251,7 +251,7 @@ |
650 | reg = <0>; |
651 | |
652 | reset-assert-us = <10000>; |
653 | - reset-deassert-us = <30000>; |
654 | + reset-deassert-us = <80000>; |
655 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
656 | |
657 | interrupt-parent = <&gpio_intc>; |
658 | @@ -395,7 +395,7 @@ |
659 | #size-cells = <1>; |
660 | compatible = "winbond,w25q16", "jedec,spi-nor"; |
661 | reg = <0>; |
662 | - spi-max-frequency = <3000000>; |
663 | + spi-max-frequency = <104000000>; |
664 | }; |
665 | }; |
666 | |
667 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |
668 | index c2bd4dbbf38c5..8dccf91d68da7 100644 |
669 | --- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |
670 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |
671 | @@ -112,7 +112,7 @@ |
672 | max-speed = <1000>; |
673 | |
674 | reset-assert-us = <10000>; |
675 | - reset-deassert-us = <30000>; |
676 | + reset-deassert-us = <80000>; |
677 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
678 | }; |
679 | }; |
680 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts |
681 | index ea45ae0c71b7f..8edbfe040805c 100644 |
682 | --- a/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts |
683 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts |
684 | @@ -64,7 +64,7 @@ |
685 | |
686 | /* External PHY reset is shared with internal PHY Led signal */ |
687 | reset-assert-us = <10000>; |
688 | - reset-deassert-us = <30000>; |
689 | + reset-deassert-us = <80000>; |
690 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
691 | |
692 | interrupt-parent = <&gpio_intc>; |
693 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
694 | index 5cd4d35006d09..f72d29e33a9e4 100644 |
695 | --- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
696 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
697 | @@ -114,7 +114,7 @@ |
698 | max-speed = <1000>; |
699 | |
700 | reset-assert-us = <10000>; |
701 | - reset-deassert-us = <30000>; |
702 | + reset-deassert-us = <80000>; |
703 | reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
704 | }; |
705 | }; |
706 | diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi |
707 | index 521573f3a5bab..8ba3555ca3693 100644 |
708 | --- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi |
709 | +++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi |
710 | @@ -90,7 +90,7 @@ |
711 | opp-microvolt = <790000>; |
712 | }; |
713 | |
714 | - opp-1512000000 { |
715 | + opp-1500000000 { |
716 | opp-hz = /bits/ 64 <1500000000>; |
717 | opp-microvolt = <800000>; |
718 | }; |
719 | diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
720 | index 0821489a874de..25549d9552ae2 100644 |
721 | --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi |
722 | +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
723 | @@ -90,8 +90,10 @@ |
724 | }; |
725 | |
726 | psci { |
727 | - compatible = "arm,psci-0.2"; |
728 | + compatible = "arm,psci"; |
729 | method = "smc"; |
730 | + cpu_off = <0x84000002>; |
731 | + cpu_on = <0xC4000003>; |
732 | }; |
733 | |
734 | soc: soc { |
735 | @@ -494,13 +496,6 @@ |
736 | pmu_system_controller: system-controller@105c0000 { |
737 | compatible = "samsung,exynos7-pmu", "syscon"; |
738 | reg = <0x105c0000 0x5000>; |
739 | - |
740 | - reboot: syscon-reboot { |
741 | - compatible = "syscon-reboot"; |
742 | - regmap = <&pmu_system_controller>; |
743 | - offset = <0x0400>; |
744 | - mask = <0x1>; |
745 | - }; |
746 | }; |
747 | |
748 | rtc: rtc@10590000 { |
749 | @@ -650,3 +645,4 @@ |
750 | }; |
751 | |
752 | #include "exynos7-pinctrl.dtsi" |
753 | +#include "arm/exynos-syscon-restart.dtsi" |
754 | diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
755 | index 9589b15693d6e..795d6ca4bbd1f 100644 |
756 | --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
757 | +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
758 | @@ -673,7 +673,7 @@ |
759 | ethernet@0,4 { |
760 | compatible = "fsl,enetc-ptp"; |
761 | reg = <0x000400 0 0 0 0>; |
762 | - clocks = <&clockgen 4 0>; |
763 | + clocks = <&clockgen 2 3>; |
764 | little-endian; |
765 | }; |
766 | }; |
767 | diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
768 | index c3668187b8446..aa52927e2e9c2 100644 |
769 | --- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
770 | +++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
771 | @@ -144,7 +144,7 @@ |
772 | pinctrl-names = "default"; |
773 | pinctrl-0 = <&rgmii_pins>; |
774 | phy-mode = "rgmii-id"; |
775 | - phy = <&phy1>; |
776 | + phy-handle = <&phy1>; |
777 | status = "okay"; |
778 | }; |
779 | |
780 | diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
781 | index 78f7e6e50beb0..0821754f0fd6d 100644 |
782 | --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
783 | +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
784 | @@ -144,7 +144,7 @@ |
785 | nvidia,schmitt = <TEGRA_PIN_DISABLE>; |
786 | nvidia,lpdr = <TEGRA_PIN_ENABLE>; |
787 | nvidia,enable-input = <TEGRA_PIN_DISABLE>; |
788 | - nvidia,io-high-voltage = <TEGRA_PIN_ENABLE>; |
789 | + nvidia,io-hv = <TEGRA_PIN_ENABLE>; |
790 | nvidia,tristate = <TEGRA_PIN_DISABLE>; |
791 | nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
792 | }; |
793 | @@ -156,7 +156,7 @@ |
794 | nvidia,schmitt = <TEGRA_PIN_DISABLE>; |
795 | nvidia,lpdr = <TEGRA_PIN_ENABLE>; |
796 | nvidia,enable-input = <TEGRA_PIN_ENABLE>; |
797 | - nvidia,io-high-voltage = <TEGRA_PIN_ENABLE>; |
798 | + nvidia,io-hv = <TEGRA_PIN_ENABLE>; |
799 | nvidia,tristate = <TEGRA_PIN_DISABLE>; |
800 | nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
801 | }; |
802 | diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
803 | index ded120d3aef58..f539b3655f6b9 100644 |
804 | --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
805 | +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
806 | @@ -244,23 +244,28 @@ |
807 | status = "okay"; |
808 | clock-frequency = <400000>; |
809 | |
810 | - hid@15 { |
811 | + tsel: hid@15 { |
812 | compatible = "hid-over-i2c"; |
813 | reg = <0x15>; |
814 | hid-descr-addr = <0x1>; |
815 | |
816 | - interrupts-extended = <&tlmm 37 IRQ_TYPE_EDGE_RISING>; |
817 | + interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>; |
818 | + |
819 | + pinctrl-names = "default"; |
820 | + pinctrl-0 = <&i2c3_hid_active>; |
821 | }; |
822 | |
823 | - hid@2c { |
824 | + tsc2: hid@2c { |
825 | compatible = "hid-over-i2c"; |
826 | reg = <0x2c>; |
827 | hid-descr-addr = <0x20>; |
828 | |
829 | - interrupts-extended = <&tlmm 37 IRQ_TYPE_EDGE_RISING>; |
830 | + interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>; |
831 | |
832 | pinctrl-names = "default"; |
833 | - pinctrl-0 = <&i2c2_hid_active>; |
834 | + pinctrl-0 = <&i2c3_hid_active>; |
835 | + |
836 | + status = "disabled"; |
837 | }; |
838 | }; |
839 | |
840 | @@ -268,15 +273,15 @@ |
841 | status = "okay"; |
842 | clock-frequency = <400000>; |
843 | |
844 | - hid@10 { |
845 | + tsc1: hid@10 { |
846 | compatible = "hid-over-i2c"; |
847 | reg = <0x10>; |
848 | hid-descr-addr = <0x1>; |
849 | |
850 | - interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>; |
851 | + interrupts-extended = <&tlmm 125 IRQ_TYPE_LEVEL_LOW>; |
852 | |
853 | pinctrl-names = "default"; |
854 | - pinctrl-0 = <&i2c6_hid_active>; |
855 | + pinctrl-0 = <&i2c5_hid_active>; |
856 | }; |
857 | }; |
858 | |
859 | @@ -284,7 +289,7 @@ |
860 | status = "okay"; |
861 | clock-frequency = <400000>; |
862 | |
863 | - hid@5c { |
864 | + ecsh: hid@5c { |
865 | compatible = "hid-over-i2c"; |
866 | reg = <0x5c>; |
867 | hid-descr-addr = <0x1>; |
868 | @@ -292,7 +297,7 @@ |
869 | interrupts-extended = <&tlmm 92 IRQ_TYPE_LEVEL_LOW>; |
870 | |
871 | pinctrl-names = "default"; |
872 | - pinctrl-0 = <&i2c12_hid_active>; |
873 | + pinctrl-0 = <&i2c11_hid_active>; |
874 | }; |
875 | }; |
876 | |
877 | @@ -335,7 +340,7 @@ |
878 | &tlmm { |
879 | gpio-reserved-ranges = <0 4>, <81 4>; |
880 | |
881 | - i2c2_hid_active: i2c2-hid-active { |
882 | + i2c3_hid_active: i2c2-hid-active { |
883 | pins = <37>; |
884 | function = "gpio"; |
885 | |
886 | @@ -344,7 +349,7 @@ |
887 | drive-strength = <2>; |
888 | }; |
889 | |
890 | - i2c6_hid_active: i2c6-hid-active { |
891 | + i2c5_hid_active: i2c5-hid-active { |
892 | pins = <125>; |
893 | function = "gpio"; |
894 | |
895 | @@ -353,7 +358,7 @@ |
896 | drive-strength = <2>; |
897 | }; |
898 | |
899 | - i2c12_hid_active: i2c12-hid-active { |
900 | + i2c11_hid_active: i2c11-hid-active { |
901 | pins = <92>; |
902 | function = "gpio"; |
903 | |
904 | diff --git a/arch/arm64/boot/dts/renesas/cat875.dtsi b/arch/arm64/boot/dts/renesas/cat875.dtsi |
905 | index aaefc3ae56d50..dbdb8b093e733 100644 |
906 | --- a/arch/arm64/boot/dts/renesas/cat875.dtsi |
907 | +++ b/arch/arm64/boot/dts/renesas/cat875.dtsi |
908 | @@ -22,7 +22,6 @@ |
909 | status = "okay"; |
910 | |
911 | phy0: ethernet-phy@0 { |
912 | - rxc-skew-ps = <1500>; |
913 | reg = <0>; |
914 | interrupt-parent = <&gpio2>; |
915 | interrupts = <21 IRQ_TYPE_LEVEL_LOW>; |
916 | diff --git a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi |
917 | index 4280b190dc682..6a001cdfd38e2 100644 |
918 | --- a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi |
919 | +++ b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi |
920 | @@ -23,7 +23,6 @@ |
921 | status = "okay"; |
922 | |
923 | phy0: ethernet-phy@0 { |
924 | - rxc-skew-ps = <1500>; |
925 | reg = <0>; |
926 | interrupt-parent = <&gpio2>; |
927 | interrupts = <11 IRQ_TYPE_LEVEL_LOW>; |
928 | diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts |
929 | index bb40c163b05dc..6c3368f795ca3 100644 |
930 | --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts |
931 | +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts |
932 | @@ -333,6 +333,7 @@ |
933 | }; |
934 | |
935 | &usb20_otg { |
936 | + dr_mode = "host"; |
937 | status = "okay"; |
938 | }; |
939 | |
940 | diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi |
941 | index 31cc1541f1f59..e0ed323935a4d 100644 |
942 | --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi |
943 | +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi |
944 | @@ -1190,8 +1190,8 @@ |
945 | |
946 | uart0 { |
947 | uart0_xfer: uart0-xfer { |
948 | - rockchip,pins = <1 RK_PB1 1 &pcfg_pull_up>, |
949 | - <1 RK_PB0 1 &pcfg_pull_none>; |
950 | + rockchip,pins = <1 RK_PB1 1 &pcfg_pull_none>, |
951 | + <1 RK_PB0 1 &pcfg_pull_up>; |
952 | }; |
953 | |
954 | uart0_cts: uart0-cts { |
955 | @@ -1209,8 +1209,8 @@ |
956 | |
957 | uart1 { |
958 | uart1_xfer: uart1-xfer { |
959 | - rockchip,pins = <3 RK_PA4 4 &pcfg_pull_up>, |
960 | - <3 RK_PA6 4 &pcfg_pull_none>; |
961 | + rockchip,pins = <3 RK_PA4 4 &pcfg_pull_none>, |
962 | + <3 RK_PA6 4 &pcfg_pull_up>; |
963 | }; |
964 | |
965 | uart1_cts: uart1-cts { |
966 | @@ -1228,15 +1228,15 @@ |
967 | |
968 | uart2-0 { |
969 | uart2m0_xfer: uart2m0-xfer { |
970 | - rockchip,pins = <1 RK_PA0 2 &pcfg_pull_up>, |
971 | - <1 RK_PA1 2 &pcfg_pull_none>; |
972 | + rockchip,pins = <1 RK_PA0 2 &pcfg_pull_none>, |
973 | + <1 RK_PA1 2 &pcfg_pull_up>; |
974 | }; |
975 | }; |
976 | |
977 | uart2-1 { |
978 | uart2m1_xfer: uart2m1-xfer { |
979 | - rockchip,pins = <2 RK_PA0 1 &pcfg_pull_up>, |
980 | - <2 RK_PA1 1 &pcfg_pull_none>; |
981 | + rockchip,pins = <2 RK_PA0 1 &pcfg_pull_none>, |
982 | + <2 RK_PA1 1 &pcfg_pull_up>; |
983 | }; |
984 | }; |
985 | |
986 | diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h |
987 | index 7140701f65f91..dfa6dc4575bec 100644 |
988 | --- a/arch/arm64/include/asm/kvm_host.h |
989 | +++ b/arch/arm64/include/asm/kvm_host.h |
990 | @@ -182,6 +182,7 @@ enum vcpu_sysreg { |
991 | #define c2_TTBR1 (TTBR1_EL1 * 2) /* Translation Table Base Register 1 */ |
992 | #define c2_TTBR1_high (c2_TTBR1 + 1) /* TTBR1 top 32 bits */ |
993 | #define c2_TTBCR (TCR_EL1 * 2) /* Translation Table Base Control R. */ |
994 | +#define c2_TTBCR2 (c2_TTBCR + 1) /* Translation Table Base Control R. 2 */ |
995 | #define c3_DACR (DACR32_EL2 * 2)/* Domain Access Control Register */ |
996 | #define c5_DFSR (ESR_EL1 * 2) /* Data Fault Status Register */ |
997 | #define c5_IFSR (IFSR32_EL2 * 2)/* Instruction Fault Status Register */ |
998 | diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c |
999 | index 1457a0ba83dbc..f2d2dbbbfca20 100644 |
1000 | --- a/arch/arm64/kernel/syscall.c |
1001 | +++ b/arch/arm64/kernel/syscall.c |
1002 | @@ -102,8 +102,8 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, |
1003 | regs->syscallno = scno; |
1004 | |
1005 | cortex_a76_erratum_1463225_svc_handler(); |
1006 | + user_exit_irqoff(); |
1007 | local_daif_restore(DAIF_PROCCTX); |
1008 | - user_exit(); |
1009 | |
1010 | if (has_syscall_work(flags)) { |
1011 | /* set default errno for user-issued syscall(-1) */ |
1012 | diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c |
1013 | index f1f4f42e8ef46..6478635ff2142 100644 |
1014 | --- a/arch/arm64/kvm/sys_regs.c |
1015 | +++ b/arch/arm64/kvm/sys_regs.c |
1016 | @@ -1837,6 +1837,7 @@ static const struct sys_reg_desc cp15_regs[] = { |
1017 | { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 }, |
1018 | { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 }, |
1019 | { Op1( 0), CRn( 2), CRm( 0), Op2( 2), access_vm_reg, NULL, c2_TTBCR }, |
1020 | + { Op1( 0), CRn( 2), CRm( 0), Op2( 3), access_vm_reg, NULL, c2_TTBCR2 }, |
1021 | { Op1( 0), CRn( 3), CRm( 0), Op2( 0), access_vm_reg, NULL, c3_DACR }, |
1022 | { Op1( 0), CRn( 5), CRm( 0), Op2( 0), access_vm_reg, NULL, c5_DFSR }, |
1023 | { Op1( 0), CRn( 5), CRm( 0), Op2( 1), access_vm_reg, NULL, c5_IFSR }, |
1024 | diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig |
1025 | index 6889f74e06f54..490bb6da74b7e 100644 |
1026 | --- a/arch/mips/bcm47xx/Kconfig |
1027 | +++ b/arch/mips/bcm47xx/Kconfig |
1028 | @@ -27,6 +27,7 @@ config BCM47XX_BCMA |
1029 | select BCMA |
1030 | select BCMA_HOST_SOC |
1031 | select BCMA_DRIVER_MIPS |
1032 | + select BCMA_DRIVER_PCI if PCI |
1033 | select BCMA_DRIVER_PCI_HOSTMODE if PCI |
1034 | select BCMA_DRIVER_GPIO |
1035 | default y |
1036 | diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c |
1037 | index b8884de89c81e..82e44b31aad59 100644 |
1038 | --- a/arch/mips/kernel/setup.c |
1039 | +++ b/arch/mips/kernel/setup.c |
1040 | @@ -529,8 +529,8 @@ static void __init request_crashkernel(struct resource *res) |
1041 | |
1042 | static void __init check_kernel_sections_mem(void) |
1043 | { |
1044 | - phys_addr_t start = PFN_PHYS(PFN_DOWN(__pa_symbol(&_text))); |
1045 | - phys_addr_t size = PFN_PHYS(PFN_UP(__pa_symbol(&_end))) - start; |
1046 | + phys_addr_t start = __pa_symbol(&_text); |
1047 | + phys_addr_t size = __pa_symbol(&_end) - start; |
1048 | |
1049 | if (!memblock_is_region_memory(start, size)) { |
1050 | pr_info("Kernel sections are not in the memory maps\n"); |
1051 | diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h |
1052 | index 7b6349be621a3..5325bd9c9b47b 100644 |
1053 | --- a/arch/powerpc/include/asm/book3s/32/pgtable.h |
1054 | +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h |
1055 | @@ -557,9 +557,9 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, |
1056 | if (pte_val(*ptep) & _PAGE_HASHPTE) |
1057 | flush_hash_entry(mm, ptep, addr); |
1058 | __asm__ __volatile__("\ |
1059 | - stw%U0%X0 %2,%0\n\ |
1060 | + stw%X0 %2,%0\n\ |
1061 | eieio\n\ |
1062 | - stw%U0%X0 %L2,%1" |
1063 | + stw%X1 %L2,%1" |
1064 | : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4)) |
1065 | : "r" (pte) : "memory"); |
1066 | |
1067 | diff --git a/arch/powerpc/include/asm/cpm1.h b/arch/powerpc/include/asm/cpm1.h |
1068 | index a116fe9317892..3bdd74739cb88 100644 |
1069 | --- a/arch/powerpc/include/asm/cpm1.h |
1070 | +++ b/arch/powerpc/include/asm/cpm1.h |
1071 | @@ -68,6 +68,7 @@ extern void cpm_reset(void); |
1072 | #define PROFF_SPI ((uint)0x0180) |
1073 | #define PROFF_SCC3 ((uint)0x0200) |
1074 | #define PROFF_SMC1 ((uint)0x0280) |
1075 | +#define PROFF_DSP1 ((uint)0x02c0) |
1076 | #define PROFF_SCC4 ((uint)0x0300) |
1077 | #define PROFF_SMC2 ((uint)0x0380) |
1078 | |
1079 | diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h |
1080 | index cf00ff0d121de..235911fb0e24f 100644 |
1081 | --- a/arch/powerpc/include/asm/cputable.h |
1082 | +++ b/arch/powerpc/include/asm/cputable.h |
1083 | @@ -367,7 +367,7 @@ static inline void cpu_feature_keys_init(void) { } |
1084 | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
1085 | #define CPU_FTRS_82XX (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_NOEXECUTE) |
1086 | #define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ |
1087 | - CPU_FTR_MAYBE_CAN_NAP) |
1088 | + CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NOEXECUTE) |
1089 | #define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \ |
1090 | CPU_FTR_MAYBE_CAN_NAP | \ |
1091 | CPU_FTR_COMMON | CPU_FTR_NOEXECUTE) |
1092 | @@ -407,7 +407,6 @@ static inline void cpu_feature_keys_init(void) { } |
1093 | CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ |
1094 | CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \ |
1095 | CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT) |
1096 | -#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) |
1097 | |
1098 | /* 64-bit CPUs */ |
1099 | #define CPU_FTRS_PPC970 (CPU_FTR_LWSYNC | \ |
1100 | @@ -507,8 +506,6 @@ enum { |
1101 | CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX | |
1102 | CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 | |
1103 | CPU_FTRS_CLASSIC32 | |
1104 | -#else |
1105 | - CPU_FTRS_GENERIC_32 | |
1106 | #endif |
1107 | #ifdef CONFIG_PPC_8xx |
1108 | CPU_FTRS_8XX | |
1109 | @@ -585,8 +582,6 @@ enum { |
1110 | CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX & |
1111 | CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 & |
1112 | CPU_FTRS_CLASSIC32 & |
1113 | -#else |
1114 | - CPU_FTRS_GENERIC_32 & |
1115 | #endif |
1116 | #ifdef CONFIG_PPC_8xx |
1117 | CPU_FTRS_8XX & |
1118 | diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h |
1119 | index 7fed9dc0f147a..3d2a78ab051a7 100644 |
1120 | --- a/arch/powerpc/include/asm/nohash/pgtable.h |
1121 | +++ b/arch/powerpc/include/asm/nohash/pgtable.h |
1122 | @@ -199,9 +199,9 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, |
1123 | */ |
1124 | if (IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_PTE_64BIT) && !percpu) { |
1125 | __asm__ __volatile__("\ |
1126 | - stw%U0%X0 %2,%0\n\ |
1127 | + stw%X0 %2,%0\n\ |
1128 | eieio\n\ |
1129 | - stw%U0%X0 %L2,%1" |
1130 | + stw%X1 %L2,%1" |
1131 | : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4)) |
1132 | : "r" (pte) : "memory"); |
1133 | return; |
1134 | diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile |
1135 | index 59260eb962916..afbd47b0a75cc 100644 |
1136 | --- a/arch/powerpc/kernel/Makefile |
1137 | +++ b/arch/powerpc/kernel/Makefile |
1138 | @@ -181,6 +181,9 @@ KCOV_INSTRUMENT_cputable.o := n |
1139 | KCOV_INSTRUMENT_setup_64.o := n |
1140 | KCOV_INSTRUMENT_paca.o := n |
1141 | |
1142 | +CFLAGS_setup_64.o += -fno-stack-protector |
1143 | +CFLAGS_paca.o += -fno-stack-protector |
1144 | + |
1145 | extra-$(CONFIG_PPC_FPU) += fpu.o |
1146 | extra-$(CONFIG_ALTIVEC) += vector.o |
1147 | extra-$(CONFIG_PPC64) += entry_64.o |
1148 | diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
1149 | index 780f527eabd2c..9019f1395d39a 100644 |
1150 | --- a/arch/powerpc/kernel/head_64.S |
1151 | +++ b/arch/powerpc/kernel/head_64.S |
1152 | @@ -420,6 +420,10 @@ generic_secondary_common_init: |
1153 | /* From now on, r24 is expected to be logical cpuid */ |
1154 | mr r24,r5 |
1155 | |
1156 | + /* Create a temp kernel stack for use before relocation is on. */ |
1157 | + ld r1,PACAEMERGSP(r13) |
1158 | + subi r1,r1,STACK_FRAME_OVERHEAD |
1159 | + |
1160 | /* See if we need to call a cpu state restore handler */ |
1161 | LOAD_REG_ADDR(r23, cur_cpu_spec) |
1162 | ld r23,0(r23) |
1163 | @@ -448,10 +452,6 @@ generic_secondary_common_init: |
1164 | sync /* order paca.run and cur_cpu_spec */ |
1165 | isync /* In case code patching happened */ |
1166 | |
1167 | - /* Create a temp kernel stack for use before relocation is on. */ |
1168 | - ld r1,PACAEMERGSP(r13) |
1169 | - subi r1,r1,STACK_FRAME_OVERHEAD |
1170 | - |
1171 | b __secondary_start |
1172 | #endif /* SMP */ |
1173 | |
1174 | @@ -992,7 +992,7 @@ start_here_common: |
1175 | bl start_kernel |
1176 | |
1177 | /* Not reached */ |
1178 | - trap |
1179 | +0: trap |
1180 | EMIT_BUG_ENTRY 0b, __FILE__, __LINE__, 0 |
1181 | |
1182 | /* |
1183 | diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c |
1184 | index 4ea0cca52e162..c786adfb9413f 100644 |
1185 | --- a/arch/powerpc/kernel/paca.c |
1186 | +++ b/arch/powerpc/kernel/paca.c |
1187 | @@ -176,7 +176,7 @@ static struct slb_shadow * __init new_slb_shadow(int cpu, unsigned long limit) |
1188 | struct paca_struct **paca_ptrs __read_mostly; |
1189 | EXPORT_SYMBOL(paca_ptrs); |
1190 | |
1191 | -void __init __nostackprotector initialise_paca(struct paca_struct *new_paca, int cpu) |
1192 | +void __init initialise_paca(struct paca_struct *new_paca, int cpu) |
1193 | { |
1194 | #ifdef CONFIG_PPC_PSERIES |
1195 | new_paca->lppaca_ptr = NULL; |
1196 | @@ -205,7 +205,7 @@ void __init __nostackprotector initialise_paca(struct paca_struct *new_paca, int |
1197 | } |
1198 | |
1199 | /* Put the paca pointer into r13 and SPRG_PACA */ |
1200 | -void __nostackprotector setup_paca(struct paca_struct *new_paca) |
1201 | +void setup_paca(struct paca_struct *new_paca) |
1202 | { |
1203 | /* Setup r13 */ |
1204 | local_paca = new_paca; |
1205 | diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
1206 | index c62ff66d44ad9..c1e2e351ebff8 100644 |
1207 | --- a/arch/powerpc/kernel/rtas.c |
1208 | +++ b/arch/powerpc/kernel/rtas.c |
1209 | @@ -978,7 +978,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = { |
1210 | { "ibm,display-message", -1, 0, -1, -1, -1 }, |
1211 | { "ibm,errinjct", -1, 2, -1, -1, -1, 1024 }, |
1212 | { "ibm,close-errinjct", -1, -1, -1, -1, -1 }, |
1213 | - { "ibm,open-errinct", -1, -1, -1, -1, -1 }, |
1214 | + { "ibm,open-errinjct", -1, -1, -1, -1, -1 }, |
1215 | { "ibm,get-config-addr-info2", -1, -1, -1, -1, -1 }, |
1216 | { "ibm,get-dynamic-sensor-state", -1, 1, -1, -1, -1 }, |
1217 | { "ibm,get-indices", -1, 2, 3, -1, -1 }, |
1218 | diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c |
1219 | index 25aaa39030009..f281d011f4b97 100644 |
1220 | --- a/arch/powerpc/kernel/setup-common.c |
1221 | +++ b/arch/powerpc/kernel/setup-common.c |
1222 | @@ -903,8 +903,6 @@ void __init setup_arch(char **cmdline_p) |
1223 | |
1224 | /* On BookE, setup per-core TLB data structures. */ |
1225 | setup_tlb_core_data(); |
1226 | - |
1227 | - smp_release_cpus(); |
1228 | #endif |
1229 | |
1230 | /* Print various info about the machine that has been gathered so far. */ |
1231 | @@ -925,6 +923,8 @@ void __init setup_arch(char **cmdline_p) |
1232 | exc_lvl_early_init(); |
1233 | emergency_stack_init(); |
1234 | |
1235 | + smp_release_cpus(); |
1236 | + |
1237 | initmem_init(); |
1238 | |
1239 | early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT); |
1240 | diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h |
1241 | index 1b02d338a5f55..c82577c4b15d3 100644 |
1242 | --- a/arch/powerpc/kernel/setup.h |
1243 | +++ b/arch/powerpc/kernel/setup.h |
1244 | @@ -8,12 +8,6 @@ |
1245 | #ifndef __ARCH_POWERPC_KERNEL_SETUP_H |
1246 | #define __ARCH_POWERPC_KERNEL_SETUP_H |
1247 | |
1248 | -#ifdef CONFIG_CC_IS_CLANG |
1249 | -#define __nostackprotector |
1250 | -#else |
1251 | -#define __nostackprotector __attribute__((__optimize__("no-stack-protector"))) |
1252 | -#endif |
1253 | - |
1254 | void initialize_cache_info(void); |
1255 | void irqstack_early_init(void); |
1256 | |
1257 | diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c |
1258 | index 480c236724da2..5bc7e753df4d0 100644 |
1259 | --- a/arch/powerpc/kernel/setup_64.c |
1260 | +++ b/arch/powerpc/kernel/setup_64.c |
1261 | @@ -284,7 +284,7 @@ void __init record_spr_defaults(void) |
1262 | * device-tree is not accessible via normal means at this point. |
1263 | */ |
1264 | |
1265 | -void __init __nostackprotector early_setup(unsigned long dt_ptr) |
1266 | +void __init early_setup(unsigned long dt_ptr) |
1267 | { |
1268 | static __initdata struct paca_struct boot_paca; |
1269 | |
1270 | diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c |
1271 | index 187047592d53c..bb01a862aaf8d 100644 |
1272 | --- a/arch/powerpc/mm/fault.c |
1273 | +++ b/arch/powerpc/mm/fault.c |
1274 | @@ -349,7 +349,6 @@ static inline void cmo_account_page_fault(void) |
1275 | static inline void cmo_account_page_fault(void) { } |
1276 | #endif /* CONFIG_PPC_SMLPAR */ |
1277 | |
1278 | -#ifdef CONFIG_PPC_BOOK3S |
1279 | static void sanity_check_fault(bool is_write, bool is_user, |
1280 | unsigned long error_code, unsigned long address) |
1281 | { |
1282 | @@ -366,6 +365,9 @@ static void sanity_check_fault(bool is_write, bool is_user, |
1283 | return; |
1284 | } |
1285 | |
1286 | + if (!IS_ENABLED(CONFIG_PPC_BOOK3S)) |
1287 | + return; |
1288 | + |
1289 | /* |
1290 | * For hash translation mode, we should never get a |
1291 | * PROTFAULT. Any update to pte to reduce access will result in us |
1292 | @@ -400,10 +402,6 @@ static void sanity_check_fault(bool is_write, bool is_user, |
1293 | |
1294 | WARN_ON_ONCE(error_code & DSISR_PROTFAULT); |
1295 | } |
1296 | -#else |
1297 | -static void sanity_check_fault(bool is_write, bool is_user, |
1298 | - unsigned long error_code, unsigned long address) { } |
1299 | -#endif /* CONFIG_PPC_BOOK3S */ |
1300 | |
1301 | /* |
1302 | * Define the correct "is_write" bit in error_code based |
1303 | diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c |
1304 | index 96ca90ce0264a..c48705c726ac6 100644 |
1305 | --- a/arch/powerpc/mm/mem.c |
1306 | +++ b/arch/powerpc/mm/mem.c |
1307 | @@ -530,7 +530,7 @@ void __flush_dcache_icache(void *p) |
1308 | * space occurs, before returning to user space. |
1309 | */ |
1310 | |
1311 | - if (cpu_has_feature(MMU_FTR_TYPE_44x)) |
1312 | + if (mmu_has_feature(MMU_FTR_TYPE_44x)) |
1313 | return; |
1314 | |
1315 | invalidate_icache_range(addr, addr + PAGE_SIZE); |
1316 | diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c |
1317 | index f582aa2d98078..02fc75ddcbb36 100644 |
1318 | --- a/arch/powerpc/perf/core-book3s.c |
1319 | +++ b/arch/powerpc/perf/core-book3s.c |
1320 | @@ -133,6 +133,9 @@ static void pmao_restore_workaround(bool ebb) { } |
1321 | |
1322 | bool is_sier_available(void) |
1323 | { |
1324 | + if (!ppmu) |
1325 | + return false; |
1326 | + |
1327 | if (ppmu->flags & PPMU_HAS_SIER) |
1328 | return true; |
1329 | |
1330 | @@ -2086,6 +2089,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val, |
1331 | local64_set(&event->hw.period_left, left); |
1332 | perf_event_update_userpage(event); |
1333 | |
1334 | + /* |
1335 | + * Due to hardware limitation, sometimes SIAR could sample a kernel |
1336 | + * address even when freeze on supervisor state (kernel) is set in |
1337 | + * MMCR2. Check attr.exclude_kernel and address to drop the sample in |
1338 | + * these cases. |
1339 | + */ |
1340 | + if (event->attr.exclude_kernel && record) |
1341 | + if (is_kernel_addr(mfspr(SPRN_SIAR))) |
1342 | + record = 0; |
1343 | + |
1344 | /* |
1345 | * Finally record data if requested. |
1346 | */ |
1347 | diff --git a/arch/powerpc/platforms/8xx/micropatch.c b/arch/powerpc/platforms/8xx/micropatch.c |
1348 | index c80bd7afd6c5e..b06c6d26dd722 100644 |
1349 | --- a/arch/powerpc/platforms/8xx/micropatch.c |
1350 | +++ b/arch/powerpc/platforms/8xx/micropatch.c |
1351 | @@ -361,6 +361,17 @@ void __init cpm_load_patch(cpm8xx_t *cp) |
1352 | if (IS_ENABLED(CONFIG_SMC_UCODE_PATCH)) { |
1353 | smc_uart_t *smp; |
1354 | |
1355 | + if (IS_ENABLED(CONFIG_PPC_EARLY_DEBUG_CPM)) { |
1356 | + int i; |
1357 | + |
1358 | + for (i = 0; i < sizeof(*smp); i += 4) { |
1359 | + u32 __iomem *src = (u32 __iomem *)&cp->cp_dparam[PROFF_SMC1 + i]; |
1360 | + u32 __iomem *dst = (u32 __iomem *)&cp->cp_dparam[PROFF_DSP1 + i]; |
1361 | + |
1362 | + out_be32(dst, in_be32(src)); |
1363 | + } |
1364 | + } |
1365 | + |
1366 | smp = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC1]; |
1367 | out_be16(&smp->smc_rpbase, 0x1ec0); |
1368 | smp = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC2]; |
1369 | diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c |
1370 | index eb2e75dac369a..b45ab455a18e8 100644 |
1371 | --- a/arch/powerpc/platforms/powernv/memtrace.c |
1372 | +++ b/arch/powerpc/platforms/powernv/memtrace.c |
1373 | @@ -30,6 +30,7 @@ struct memtrace_entry { |
1374 | char name[16]; |
1375 | }; |
1376 | |
1377 | +static DEFINE_MUTEX(memtrace_mutex); |
1378 | static u64 memtrace_size; |
1379 | |
1380 | static struct memtrace_entry *memtrace_array; |
1381 | @@ -67,6 +68,23 @@ static int change_memblock_state(struct memory_block *mem, void *arg) |
1382 | return 0; |
1383 | } |
1384 | |
1385 | +static void memtrace_clear_range(unsigned long start_pfn, |
1386 | + unsigned long nr_pages) |
1387 | +{ |
1388 | + unsigned long pfn; |
1389 | + |
1390 | + /* |
1391 | + * As pages are offline, we cannot trust the memmap anymore. As HIGHMEM |
1392 | + * does not apply, avoid passing around "struct page" and use |
1393 | + * clear_page() instead directly. |
1394 | + */ |
1395 | + for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) { |
1396 | + if (IS_ALIGNED(pfn, PAGES_PER_SECTION)) |
1397 | + cond_resched(); |
1398 | + clear_page(__va(PFN_PHYS(pfn))); |
1399 | + } |
1400 | +} |
1401 | + |
1402 | /* called with device_hotplug_lock held */ |
1403 | static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) |
1404 | { |
1405 | @@ -111,6 +129,11 @@ static u64 memtrace_alloc_node(u32 nid, u64 size) |
1406 | lock_device_hotplug(); |
1407 | for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) { |
1408 | if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) { |
1409 | + /* |
1410 | + * Clear the range while we still have a linear |
1411 | + * mapping. |
1412 | + */ |
1413 | + memtrace_clear_range(base_pfn, nr_pages); |
1414 | /* |
1415 | * Remove memory in memory block size chunks so that |
1416 | * iomem resources are always split to the same size and |
1417 | @@ -268,6 +291,7 @@ static int memtrace_online(void) |
1418 | |
1419 | static int memtrace_enable_set(void *data, u64 val) |
1420 | { |
1421 | + int rc = -EAGAIN; |
1422 | u64 bytes; |
1423 | |
1424 | /* |
1425 | @@ -280,25 +304,31 @@ static int memtrace_enable_set(void *data, u64 val) |
1426 | return -EINVAL; |
1427 | } |
1428 | |
1429 | + mutex_lock(&memtrace_mutex); |
1430 | + |
1431 | /* Re-add/online previously removed/offlined memory */ |
1432 | if (memtrace_size) { |
1433 | if (memtrace_online()) |
1434 | - return -EAGAIN; |
1435 | + goto out_unlock; |
1436 | } |
1437 | |
1438 | - if (!val) |
1439 | - return 0; |
1440 | + if (!val) { |
1441 | + rc = 0; |
1442 | + goto out_unlock; |
1443 | + } |
1444 | |
1445 | /* Offline and remove memory */ |
1446 | if (memtrace_init_regions_runtime(val)) |
1447 | - return -EINVAL; |
1448 | + goto out_unlock; |
1449 | |
1450 | if (memtrace_init_debugfs()) |
1451 | - return -EINVAL; |
1452 | + goto out_unlock; |
1453 | |
1454 | memtrace_size = val; |
1455 | - |
1456 | - return 0; |
1457 | + rc = 0; |
1458 | +out_unlock: |
1459 | + mutex_unlock(&memtrace_mutex); |
1460 | + return rc; |
1461 | } |
1462 | |
1463 | static int memtrace_enable_get(void *data, u64 *val) |
1464 | diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c |
1465 | index b95b9e3c4c98e..c640cb993209a 100644 |
1466 | --- a/arch/powerpc/platforms/powernv/npu-dma.c |
1467 | +++ b/arch/powerpc/platforms/powernv/npu-dma.c |
1468 | @@ -384,7 +384,8 @@ static void pnv_npu_peers_take_ownership(struct iommu_table_group *table_group) |
1469 | for (i = 0; i < npucomp->pe_num; ++i) { |
1470 | struct pnv_ioda_pe *pe = npucomp->pe[i]; |
1471 | |
1472 | - if (!pe->table_group.ops->take_ownership) |
1473 | + if (!pe->table_group.ops || |
1474 | + !pe->table_group.ops->take_ownership) |
1475 | continue; |
1476 | pe->table_group.ops->take_ownership(&pe->table_group); |
1477 | } |
1478 | @@ -400,7 +401,8 @@ static void pnv_npu_peers_release_ownership( |
1479 | for (i = 0; i < npucomp->pe_num; ++i) { |
1480 | struct pnv_ioda_pe *pe = npucomp->pe[i]; |
1481 | |
1482 | - if (!pe->table_group.ops->release_ownership) |
1483 | + if (!pe->table_group.ops || |
1484 | + !pe->table_group.ops->release_ownership) |
1485 | continue; |
1486 | pe->table_group.ops->release_ownership(&pe->table_group); |
1487 | } |
1488 | @@ -560,6 +562,11 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid, |
1489 | return -ENODEV; |
1490 | |
1491 | hose = pci_bus_to_host(npdev->bus); |
1492 | + if (hose->npu == NULL) { |
1493 | + dev_info_once(&npdev->dev, "Nvlink1 does not support contexts"); |
1494 | + return 0; |
1495 | + } |
1496 | + |
1497 | nphb = hose->private_data; |
1498 | |
1499 | dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=%u\n", |
1500 | @@ -607,6 +614,11 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev) |
1501 | return -ENODEV; |
1502 | |
1503 | hose = pci_bus_to_host(npdev->bus); |
1504 | + if (hose->npu == NULL) { |
1505 | + dev_info_once(&npdev->dev, "Nvlink1 does not support contexts"); |
1506 | + return 0; |
1507 | + } |
1508 | + |
1509 | nphb = hose->private_data; |
1510 | |
1511 | dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n", |
1512 | diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c |
1513 | index f789693f61f40..e5ecadfb5dea2 100644 |
1514 | --- a/arch/powerpc/platforms/pseries/suspend.c |
1515 | +++ b/arch/powerpc/platforms/pseries/suspend.c |
1516 | @@ -13,7 +13,6 @@ |
1517 | #include <asm/mmu.h> |
1518 | #include <asm/rtas.h> |
1519 | #include <asm/topology.h> |
1520 | -#include "../../kernel/cacheinfo.h" |
1521 | |
1522 | static u64 stream_id; |
1523 | static struct device suspend_dev; |
1524 | @@ -78,9 +77,7 @@ static void pseries_suspend_enable_irqs(void) |
1525 | * Update configuration which can be modified based on device tree |
1526 | * changes during resume. |
1527 | */ |
1528 | - cacheinfo_cpu_offline(smp_processor_id()); |
1529 | post_mobility_fixup(); |
1530 | - cacheinfo_cpu_online(smp_processor_id()); |
1531 | } |
1532 | |
1533 | /** |
1534 | @@ -190,7 +187,6 @@ static struct bus_type suspend_subsys = { |
1535 | |
1536 | static const struct platform_suspend_ops pseries_suspend_ops = { |
1537 | .valid = suspend_valid_only_mem, |
1538 | - .begin = pseries_suspend_begin, |
1539 | .prepare_late = pseries_prepare_late, |
1540 | .enter = pseries_suspend_enter, |
1541 | }; |
1542 | diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c |
1543 | index 5c1a50912229a..9b0d85bff021e 100644 |
1544 | --- a/arch/powerpc/xmon/nonstdio.c |
1545 | +++ b/arch/powerpc/xmon/nonstdio.c |
1546 | @@ -178,7 +178,7 @@ void xmon_printf(const char *format, ...) |
1547 | |
1548 | if (n && rc == 0) { |
1549 | /* No udbg hooks, fallback to printk() - dangerous */ |
1550 | - printk("%s", xmon_outbuf); |
1551 | + pr_cont("%s", xmon_outbuf); |
1552 | } |
1553 | } |
1554 | |
1555 | diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c |
1556 | index 66d7ba61803c8..659d99af91566 100644 |
1557 | --- a/arch/s390/kernel/smp.c |
1558 | +++ b/arch/s390/kernel/smp.c |
1559 | @@ -885,24 +885,12 @@ static void __no_sanitize_address smp_start_secondary(void *cpuvoid) |
1560 | /* Upping and downing of CPUs */ |
1561 | int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
1562 | { |
1563 | - struct pcpu *pcpu; |
1564 | - int base, i, rc; |
1565 | + struct pcpu *pcpu = pcpu_devices + cpu; |
1566 | + int rc; |
1567 | |
1568 | - pcpu = pcpu_devices + cpu; |
1569 | if (pcpu->state != CPU_STATE_CONFIGURED) |
1570 | return -EIO; |
1571 | - base = smp_get_base_cpu(cpu); |
1572 | - for (i = 0; i <= smp_cpu_mtid; i++) { |
1573 | - if (base + i < nr_cpu_ids) |
1574 | - if (cpu_online(base + i)) |
1575 | - break; |
1576 | - } |
1577 | - /* |
1578 | - * If this is the first CPU of the core to get online |
1579 | - * do an initial CPU reset. |
1580 | - */ |
1581 | - if (i > smp_cpu_mtid && |
1582 | - pcpu_sigp_retry(pcpu_devices + base, SIGP_INITIAL_CPU_RESET, 0) != |
1583 | + if (pcpu_sigp_retry(pcpu, SIGP_INITIAL_CPU_RESET, 0) != |
1584 | SIGP_CC_ORDER_CODE_ACCEPTED) |
1585 | return -EIO; |
1586 | |
1587 | diff --git a/arch/s390/purgatory/head.S b/arch/s390/purgatory/head.S |
1588 | index 5a10ce34b95d1..3d1c31e0cf3dd 100644 |
1589 | --- a/arch/s390/purgatory/head.S |
1590 | +++ b/arch/s390/purgatory/head.S |
1591 | @@ -62,14 +62,15 @@ |
1592 | jh 10b |
1593 | .endm |
1594 | |
1595 | -.macro START_NEXT_KERNEL base |
1596 | +.macro START_NEXT_KERNEL base subcode |
1597 | lg %r4,kernel_entry-\base(%r13) |
1598 | lg %r5,load_psw_mask-\base(%r13) |
1599 | ogr %r4,%r5 |
1600 | stg %r4,0(%r0) |
1601 | |
1602 | xgr %r0,%r0 |
1603 | - diag %r0,%r0,0x308 |
1604 | + lghi %r1,\subcode |
1605 | + diag %r0,%r1,0x308 |
1606 | .endm |
1607 | |
1608 | .text |
1609 | @@ -123,7 +124,7 @@ ENTRY(purgatory_start) |
1610 | je .start_crash_kernel |
1611 | |
1612 | /* start normal kernel */ |
1613 | - START_NEXT_KERNEL .base_crash |
1614 | + START_NEXT_KERNEL .base_crash 0 |
1615 | |
1616 | .return_old_kernel: |
1617 | lmg %r6,%r15,gprregs-.base_crash(%r13) |
1618 | @@ -227,7 +228,7 @@ ENTRY(purgatory_start) |
1619 | MEMCPY %r9,%r10,%r11 |
1620 | |
1621 | /* start crash kernel */ |
1622 | - START_NEXT_KERNEL .base_dst |
1623 | + START_NEXT_KERNEL .base_dst 1 |
1624 | |
1625 | |
1626 | load_psw_mask: |
1627 | diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c |
1628 | index e6d91819da921..28b9ffd85db0b 100644 |
1629 | --- a/arch/sparc/mm/init_64.c |
1630 | +++ b/arch/sparc/mm/init_64.c |
1631 | @@ -2904,7 +2904,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) |
1632 | if (!page) |
1633 | return NULL; |
1634 | if (!pgtable_pte_page_ctor(page)) { |
1635 | - free_unref_page(page); |
1636 | + __free_page(page); |
1637 | return NULL; |
1638 | } |
1639 | return (pte_t *) page_address(page); |
1640 | diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c |
1641 | index 4d80526a4236e..d8845d4aac6a7 100644 |
1642 | --- a/arch/um/drivers/chan_user.c |
1643 | +++ b/arch/um/drivers/chan_user.c |
1644 | @@ -26,10 +26,10 @@ int generic_read(int fd, char *c_out, void *unused) |
1645 | n = read(fd, c_out, sizeof(*c_out)); |
1646 | if (n > 0) |
1647 | return n; |
1648 | - else if (errno == EAGAIN) |
1649 | - return 0; |
1650 | else if (n == 0) |
1651 | return -EIO; |
1652 | + else if (errno == EAGAIN) |
1653 | + return 0; |
1654 | return -errno; |
1655 | } |
1656 | |
1657 | diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c |
1658 | index fc7f1e7467032..87ca4a47cd66e 100644 |
1659 | --- a/arch/um/drivers/xterm.c |
1660 | +++ b/arch/um/drivers/xterm.c |
1661 | @@ -18,6 +18,7 @@ |
1662 | struct xterm_chan { |
1663 | int pid; |
1664 | int helper_pid; |
1665 | + int chan_fd; |
1666 | char *title; |
1667 | int device; |
1668 | int raw; |
1669 | @@ -33,6 +34,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts) |
1670 | return NULL; |
1671 | *data = ((struct xterm_chan) { .pid = -1, |
1672 | .helper_pid = -1, |
1673 | + .chan_fd = -1, |
1674 | .device = device, |
1675 | .title = opts->xterm_title, |
1676 | .raw = opts->raw } ); |
1677 | @@ -149,6 +151,7 @@ static int xterm_open(int input, int output, int primary, void *d, |
1678 | goto out_kill; |
1679 | } |
1680 | |
1681 | + data->chan_fd = fd; |
1682 | new = xterm_fd(fd, &data->helper_pid); |
1683 | if (new < 0) { |
1684 | err = new; |
1685 | @@ -206,6 +209,8 @@ static void xterm_close(int fd, void *d) |
1686 | os_kill_process(data->helper_pid, 0); |
1687 | data->helper_pid = -1; |
1688 | |
1689 | + if (data->chan_fd != -1) |
1690 | + os_close_file(data->chan_fd); |
1691 | os_close_file(fd); |
1692 | } |
1693 | |
1694 | diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c |
1695 | index d508310ee5e1e..f1732c308c615 100644 |
1696 | --- a/arch/um/os-Linux/irq.c |
1697 | +++ b/arch/um/os-Linux/irq.c |
1698 | @@ -48,7 +48,7 @@ int os_epoll_triggered(int index, int events) |
1699 | int os_event_mask(int irq_type) |
1700 | { |
1701 | if (irq_type == IRQ_READ) |
1702 | - return EPOLLIN | EPOLLPRI; |
1703 | + return EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP | EPOLLRDHUP; |
1704 | if (irq_type == IRQ_WRITE) |
1705 | return EPOLLOUT; |
1706 | return 0; |
1707 | diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c |
1708 | index 44def53a11cd6..ea5c60f4393e9 100644 |
1709 | --- a/arch/um/os-Linux/umid.c |
1710 | +++ b/arch/um/os-Linux/umid.c |
1711 | @@ -137,20 +137,13 @@ static inline int is_umdir_used(char *dir) |
1712 | { |
1713 | char pid[sizeof("nnnnn\0")], *end, *file; |
1714 | int dead, fd, p, n, err; |
1715 | - size_t filelen; |
1716 | + size_t filelen = strlen(dir) + sizeof("/pid") + 1; |
1717 | |
1718 | - err = asprintf(&file, "%s/pid", dir); |
1719 | - if (err < 0) |
1720 | - return 0; |
1721 | - |
1722 | - filelen = strlen(file); |
1723 | + file = malloc(filelen); |
1724 | + if (!file) |
1725 | + return -ENOMEM; |
1726 | |
1727 | - n = snprintf(file, filelen, "%s/pid", dir); |
1728 | - if (n >= filelen) { |
1729 | - printk(UM_KERN_ERR "is_umdir_used - pid filename too long\n"); |
1730 | - err = -E2BIG; |
1731 | - goto out; |
1732 | - } |
1733 | + snprintf(file, filelen, "%s/pid", dir); |
1734 | |
1735 | dead = 0; |
1736 | fd = open(file, O_RDONLY); |
1737 | diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
1738 | index c4def90777475..b24c38090dd99 100644 |
1739 | --- a/arch/x86/events/intel/core.c |
1740 | +++ b/arch/x86/events/intel/core.c |
1741 | @@ -253,7 +253,8 @@ static struct event_constraint intel_icl_event_constraints[] = { |
1742 | INTEL_EVENT_CONSTRAINT_RANGE(0x48, 0x54, 0xf), |
1743 | INTEL_EVENT_CONSTRAINT_RANGE(0x60, 0x8b, 0xf), |
1744 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xff), /* CYCLE_ACTIVITY.STALLS_TOTAL */ |
1745 | - INTEL_UEVENT_CONSTRAINT(0x10a3, 0xff), /* CYCLE_ACTIVITY.STALLS_MEM_ANY */ |
1746 | + INTEL_UEVENT_CONSTRAINT(0x10a3, 0xff), /* CYCLE_ACTIVITY.CYCLES_MEM_ANY */ |
1747 | + INTEL_UEVENT_CONSTRAINT(0x14a3, 0xff), /* CYCLE_ACTIVITY.STALLS_MEM_ANY */ |
1748 | INTEL_EVENT_CONSTRAINT(0xa3, 0xf), /* CYCLE_ACTIVITY.* */ |
1749 | INTEL_EVENT_CONSTRAINT_RANGE(0xa8, 0xb0, 0xf), |
1750 | INTEL_EVENT_CONSTRAINT_RANGE(0xb7, 0xbd, 0xf), |
1751 | @@ -5057,7 +5058,7 @@ __init int intel_pmu_init(void) |
1752 | extra_skl_attr = skl_format_attr; |
1753 | mem_attr = icl_events_attrs; |
1754 | tsx_attr = icl_tsx_events_attrs; |
1755 | - x86_pmu.rtm_abort_event = X86_CONFIG(.event=0xca, .umask=0x02); |
1756 | + x86_pmu.rtm_abort_event = X86_CONFIG(.event=0xc9, .umask=0x04); |
1757 | x86_pmu.lbr_pt_coexist = true; |
1758 | intel_pmu_pebs_data_source_skl(pmem); |
1759 | pr_cont("Icelake events, "); |
1760 | diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c |
1761 | index 1aaba2c8a9ba6..eb8bd0eeace7d 100644 |
1762 | --- a/arch/x86/events/intel/ds.c |
1763 | +++ b/arch/x86/events/intel/ds.c |
1764 | @@ -1912,7 +1912,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) |
1765 | * that caused the PEBS record. It's called collision. |
1766 | * If collision happened, the record will be dropped. |
1767 | */ |
1768 | - if (p->status != (1ULL << bit)) { |
1769 | + if (pebs_status != (1ULL << bit)) { |
1770 | for_each_set_bit(i, (unsigned long *)&pebs_status, size) |
1771 | error[i]++; |
1772 | continue; |
1773 | diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h |
1774 | index 19e94af9cc5d7..6016559ed1713 100644 |
1775 | --- a/arch/x86/include/asm/apic.h |
1776 | +++ b/arch/x86/include/asm/apic.h |
1777 | @@ -259,6 +259,7 @@ static inline u64 native_x2apic_icr_read(void) |
1778 | |
1779 | extern int x2apic_mode; |
1780 | extern int x2apic_phys; |
1781 | +extern void __init x2apic_set_max_apicid(u32 apicid); |
1782 | extern void __init check_x2apic(void); |
1783 | extern void x2apic_setup(void); |
1784 | static inline int x2apic_enabled(void) |
1785 | diff --git a/arch/x86/include/asm/cacheinfo.h b/arch/x86/include/asm/cacheinfo.h |
1786 | index 86b63c7feab75..86b2e0dcc4bfe 100644 |
1787 | --- a/arch/x86/include/asm/cacheinfo.h |
1788 | +++ b/arch/x86/include/asm/cacheinfo.h |
1789 | @@ -2,7 +2,7 @@ |
1790 | #ifndef _ASM_X86_CACHEINFO_H |
1791 | #define _ASM_X86_CACHEINFO_H |
1792 | |
1793 | -void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id); |
1794 | -void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id); |
1795 | +void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu); |
1796 | +void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu); |
1797 | |
1798 | #endif /* _ASM_X86_CACHEINFO_H */ |
1799 | diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
1800 | index fce94c799f015..06fa808d72032 100644 |
1801 | --- a/arch/x86/kernel/apic/apic.c |
1802 | +++ b/arch/x86/kernel/apic/apic.c |
1803 | @@ -1886,20 +1886,22 @@ static __init void try_to_enable_x2apic(int remap_mode) |
1804 | return; |
1805 | |
1806 | if (remap_mode != IRQ_REMAP_X2APIC_MODE) { |
1807 | - /* IR is required if there is APIC ID > 255 even when running |
1808 | - * under KVM |
1809 | + /* |
1810 | + * Using X2APIC without IR is not architecturally supported |
1811 | + * on bare metal but may be supported in guests. |
1812 | */ |
1813 | - if (max_physical_apicid > 255 || |
1814 | - !x86_init.hyper.x2apic_available()) { |
1815 | + if (!x86_init.hyper.x2apic_available()) { |
1816 | pr_info("x2apic: IRQ remapping doesn't support X2APIC mode\n"); |
1817 | x2apic_disable(); |
1818 | return; |
1819 | } |
1820 | |
1821 | /* |
1822 | - * without IR all CPUs can be addressed by IOAPIC/MSI |
1823 | - * only in physical mode |
1824 | + * Without IR, all CPUs can be addressed by IOAPIC/MSI only |
1825 | + * in physical mode, and CPUs with an APIC ID that cannnot |
1826 | + * be addressed must not be brought online. |
1827 | */ |
1828 | + x2apic_set_max_apicid(255); |
1829 | x2apic_phys = 1; |
1830 | } |
1831 | x2apic_enable(); |
1832 | diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c |
1833 | index bc9693841353c..e14eae6d6ea71 100644 |
1834 | --- a/arch/x86/kernel/apic/x2apic_phys.c |
1835 | +++ b/arch/x86/kernel/apic/x2apic_phys.c |
1836 | @@ -8,6 +8,12 @@ |
1837 | int x2apic_phys; |
1838 | |
1839 | static struct apic apic_x2apic_phys; |
1840 | +static u32 x2apic_max_apicid __ro_after_init; |
1841 | + |
1842 | +void __init x2apic_set_max_apicid(u32 apicid) |
1843 | +{ |
1844 | + x2apic_max_apicid = apicid; |
1845 | +} |
1846 | |
1847 | static int __init set_x2apic_phys_mode(char *arg) |
1848 | { |
1849 | @@ -98,6 +104,9 @@ static int x2apic_phys_probe(void) |
1850 | /* Common x2apic functions, also used by x2apic_cluster */ |
1851 | int x2apic_apic_id_valid(u32 apicid) |
1852 | { |
1853 | + if (x2apic_max_apicid && apicid > x2apic_max_apicid) |
1854 | + return 0; |
1855 | + |
1856 | return 1; |
1857 | } |
1858 | |
1859 | diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
1860 | index c553cafd0736b..52373921af2eb 100644 |
1861 | --- a/arch/x86/kernel/cpu/amd.c |
1862 | +++ b/arch/x86/kernel/cpu/amd.c |
1863 | @@ -335,7 +335,6 @@ static void amd_get_topology_early(struct cpuinfo_x86 *c) |
1864 | */ |
1865 | static void amd_get_topology(struct cpuinfo_x86 *c) |
1866 | { |
1867 | - u8 node_id; |
1868 | int cpu = smp_processor_id(); |
1869 | |
1870 | /* get information required for multi-node processors */ |
1871 | @@ -345,7 +344,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) |
1872 | |
1873 | cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
1874 | |
1875 | - node_id = ecx & 0xff; |
1876 | + c->cpu_die_id = ecx & 0xff; |
1877 | |
1878 | if (c->x86 == 0x15) |
1879 | c->cu_id = ebx & 0xff; |
1880 | @@ -365,15 +364,15 @@ static void amd_get_topology(struct cpuinfo_x86 *c) |
1881 | if (!err) |
1882 | c->x86_coreid_bits = get_count_order(c->x86_max_cores); |
1883 | |
1884 | - cacheinfo_amd_init_llc_id(c, cpu, node_id); |
1885 | + cacheinfo_amd_init_llc_id(c, cpu); |
1886 | |
1887 | } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
1888 | u64 value; |
1889 | |
1890 | rdmsrl(MSR_FAM10H_NODE_ID, value); |
1891 | - node_id = value & 7; |
1892 | + c->cpu_die_id = value & 7; |
1893 | |
1894 | - per_cpu(cpu_llc_id, cpu) = node_id; |
1895 | + per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; |
1896 | } else |
1897 | return; |
1898 | |
1899 | @@ -398,7 +397,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c) |
1900 | /* Convert the initial APIC ID into the socket ID */ |
1901 | c->phys_proc_id = c->initial_apicid >> bits; |
1902 | /* use socket ID also for last level cache */ |
1903 | - per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; |
1904 | + per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id; |
1905 | } |
1906 | |
1907 | u16 amd_get_nb_id(int cpu) |
1908 | diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c |
1909 | index c7503be92f359..30f33b75209a1 100644 |
1910 | --- a/arch/x86/kernel/cpu/cacheinfo.c |
1911 | +++ b/arch/x86/kernel/cpu/cacheinfo.c |
1912 | @@ -646,7 +646,7 @@ static int find_num_cache_leaves(struct cpuinfo_x86 *c) |
1913 | return i; |
1914 | } |
1915 | |
1916 | -void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
1917 | +void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu) |
1918 | { |
1919 | /* |
1920 | * We may have multiple LLCs if L3 caches exist, so check if we |
1921 | @@ -657,7 +657,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
1922 | |
1923 | if (c->x86 < 0x17) { |
1924 | /* LLC is at the node level. */ |
1925 | - per_cpu(cpu_llc_id, cpu) = node_id; |
1926 | + per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; |
1927 | } else if (c->x86 == 0x17 && c->x86_model <= 0x1F) { |
1928 | /* |
1929 | * LLC is at the core complex level. |
1930 | @@ -684,7 +684,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
1931 | } |
1932 | } |
1933 | |
1934 | -void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
1935 | +void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu) |
1936 | { |
1937 | /* |
1938 | * We may have multiple LLCs if L3 caches exist, so check if we |
1939 | diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c |
1940 | index 4e28c1fc87499..62e9a982adaf9 100644 |
1941 | --- a/arch/x86/kernel/cpu/hygon.c |
1942 | +++ b/arch/x86/kernel/cpu/hygon.c |
1943 | @@ -64,7 +64,6 @@ static void hygon_get_topology_early(struct cpuinfo_x86 *c) |
1944 | */ |
1945 | static void hygon_get_topology(struct cpuinfo_x86 *c) |
1946 | { |
1947 | - u8 node_id; |
1948 | int cpu = smp_processor_id(); |
1949 | |
1950 | /* get information required for multi-node processors */ |
1951 | @@ -74,7 +73,7 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) |
1952 | |
1953 | cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
1954 | |
1955 | - node_id = ecx & 0xff; |
1956 | + c->cpu_die_id = ecx & 0xff; |
1957 | |
1958 | c->cpu_core_id = ebx & 0xff; |
1959 | |
1960 | @@ -92,14 +91,14 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) |
1961 | /* Socket ID is ApicId[6] for these processors. */ |
1962 | c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; |
1963 | |
1964 | - cacheinfo_hygon_init_llc_id(c, cpu, node_id); |
1965 | + cacheinfo_hygon_init_llc_id(c, cpu); |
1966 | } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
1967 | u64 value; |
1968 | |
1969 | rdmsrl(MSR_FAM10H_NODE_ID, value); |
1970 | - node_id = value & 7; |
1971 | + c->cpu_die_id = value & 7; |
1972 | |
1973 | - per_cpu(cpu_llc_id, cpu) = node_id; |
1974 | + per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; |
1975 | } else |
1976 | return; |
1977 | |
1978 | @@ -122,7 +121,7 @@ static void hygon_detect_cmp(struct cpuinfo_x86 *c) |
1979 | /* Convert the initial APIC ID into the socket ID */ |
1980 | c->phys_proc_id = c->initial_apicid >> bits; |
1981 | /* use socket ID also for last level cache */ |
1982 | - per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; |
1983 | + per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id; |
1984 | } |
1985 | |
1986 | static void srat_detect_node(struct cpuinfo_x86 *c) |
1987 | diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
1988 | index 62c39baea39e3..5294018535d0c 100644 |
1989 | --- a/arch/x86/kernel/kprobes/core.c |
1990 | +++ b/arch/x86/kernel/kprobes/core.c |
1991 | @@ -1019,6 +1019,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr) |
1992 | * So clear it by resetting the current kprobe: |
1993 | */ |
1994 | regs->flags &= ~X86_EFLAGS_TF; |
1995 | + /* |
1996 | + * Since the single step (trap) has been cancelled, |
1997 | + * we need to restore BTF here. |
1998 | + */ |
1999 | + restore_btf(); |
2000 | |
2001 | /* |
2002 | * If the TF flag was set before the kprobe hit, |
2003 | diff --git a/arch/x86/mm/ident_map.c b/arch/x86/mm/ident_map.c |
2004 | index fe7a12599d8eb..968d7005f4a72 100644 |
2005 | --- a/arch/x86/mm/ident_map.c |
2006 | +++ b/arch/x86/mm/ident_map.c |
2007 | @@ -62,6 +62,7 @@ static int ident_p4d_init(struct x86_mapping_info *info, p4d_t *p4d_page, |
2008 | unsigned long addr, unsigned long end) |
2009 | { |
2010 | unsigned long next; |
2011 | + int result; |
2012 | |
2013 | for (; addr < end; addr = next) { |
2014 | p4d_t *p4d = p4d_page + p4d_index(addr); |
2015 | @@ -73,13 +74,20 @@ static int ident_p4d_init(struct x86_mapping_info *info, p4d_t *p4d_page, |
2016 | |
2017 | if (p4d_present(*p4d)) { |
2018 | pud = pud_offset(p4d, 0); |
2019 | - ident_pud_init(info, pud, addr, next); |
2020 | + result = ident_pud_init(info, pud, addr, next); |
2021 | + if (result) |
2022 | + return result; |
2023 | + |
2024 | continue; |
2025 | } |
2026 | pud = (pud_t *)info->alloc_pgt_page(info->context); |
2027 | if (!pud) |
2028 | return -ENOMEM; |
2029 | - ident_pud_init(info, pud, addr, next); |
2030 | + |
2031 | + result = ident_pud_init(info, pud, addr, next); |
2032 | + if (result) |
2033 | + return result; |
2034 | + |
2035 | set_p4d(p4d, __p4d(__pa(pud) | info->kernpg_flag)); |
2036 | } |
2037 | |
2038 | diff --git a/block/blk-mq.c b/block/blk-mq.c |
2039 | index b748d1e63f9c8..057a634396a90 100644 |
2040 | --- a/block/blk-mq.c |
2041 | +++ b/block/blk-mq.c |
2042 | @@ -1205,6 +1205,23 @@ static void blk_mq_update_dispatch_busy(struct blk_mq_hw_ctx *hctx, bool busy) |
2043 | |
2044 | #define BLK_MQ_RESOURCE_DELAY 3 /* ms units */ |
2045 | |
2046 | +static void blk_mq_handle_dev_resource(struct request *rq, |
2047 | + struct list_head *list) |
2048 | +{ |
2049 | + struct request *next = |
2050 | + list_first_entry_or_null(list, struct request, queuelist); |
2051 | + |
2052 | + /* |
2053 | + * If an I/O scheduler has been configured and we got a driver tag for |
2054 | + * the next request already, free it. |
2055 | + */ |
2056 | + if (next) |
2057 | + blk_mq_put_driver_tag(next); |
2058 | + |
2059 | + list_add(&rq->queuelist, list); |
2060 | + __blk_mq_requeue_request(rq); |
2061 | +} |
2062 | + |
2063 | /* |
2064 | * Returns true if we did some work AND can potentially do more. |
2065 | */ |
2066 | @@ -1216,6 +1233,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
2067 | bool no_tag = false; |
2068 | int errors, queued; |
2069 | blk_status_t ret = BLK_STS_OK; |
2070 | + bool no_budget_avail = false; |
2071 | |
2072 | if (list_empty(list)) |
2073 | return false; |
2074 | @@ -1234,6 +1252,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
2075 | hctx = rq->mq_hctx; |
2076 | if (!got_budget && !blk_mq_get_dispatch_budget(hctx)) { |
2077 | blk_mq_put_driver_tag(rq); |
2078 | + no_budget_avail = true; |
2079 | break; |
2080 | } |
2081 | |
2082 | @@ -1274,17 +1293,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
2083 | |
2084 | ret = q->mq_ops->queue_rq(hctx, &bd); |
2085 | if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) { |
2086 | - /* |
2087 | - * If an I/O scheduler has been configured and we got a |
2088 | - * driver tag for the next request already, free it |
2089 | - * again. |
2090 | - */ |
2091 | - if (!list_empty(list)) { |
2092 | - nxt = list_first_entry(list, struct request, queuelist); |
2093 | - blk_mq_put_driver_tag(nxt); |
2094 | - } |
2095 | - list_add(&rq->queuelist, list); |
2096 | - __blk_mq_requeue_request(rq); |
2097 | + blk_mq_handle_dev_resource(rq, list); |
2098 | break; |
2099 | } |
2100 | |
2101 | @@ -1349,13 +1358,15 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
2102 | * |
2103 | * If driver returns BLK_STS_RESOURCE and SCHED_RESTART |
2104 | * bit is set, run queue after a delay to avoid IO stalls |
2105 | - * that could otherwise occur if the queue is idle. |
2106 | + * that could otherwise occur if the queue is idle. We'll do |
2107 | + * similar if we couldn't get budget and SCHED_RESTART is set. |
2108 | */ |
2109 | needs_restart = blk_mq_sched_needs_restart(hctx); |
2110 | if (!needs_restart || |
2111 | (no_tag && list_empty_careful(&hctx->dispatch_wait.entry))) |
2112 | blk_mq_run_hw_queue(hctx, true); |
2113 | - else if (needs_restart && (ret == BLK_STS_RESOURCE)) |
2114 | + else if (needs_restart && (ret == BLK_STS_RESOURCE || |
2115 | + no_budget_avail)) |
2116 | blk_mq_delay_run_hw_queue(hctx, BLK_MQ_RESOURCE_DELAY); |
2117 | |
2118 | blk_mq_update_dispatch_busy(hctx, true); |
2119 | diff --git a/block/blk-zoned.c b/block/blk-zoned.c |
2120 | index 4bc5f260248a6..b17c094cb977c 100644 |
2121 | --- a/block/blk-zoned.c |
2122 | +++ b/block/blk-zoned.c |
2123 | @@ -202,32 +202,14 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector, |
2124 | } |
2125 | EXPORT_SYMBOL_GPL(blkdev_report_zones); |
2126 | |
2127 | -/* |
2128 | - * Special case of zone reset operation to reset all zones in one command, |
2129 | - * useful for applications like mkfs. |
2130 | - */ |
2131 | -static int __blkdev_reset_all_zones(struct block_device *bdev, gfp_t gfp_mask) |
2132 | -{ |
2133 | - struct bio *bio = bio_alloc(gfp_mask, 0); |
2134 | - int ret; |
2135 | - |
2136 | - /* across the zones operations, don't need any sectors */ |
2137 | - bio_set_dev(bio, bdev); |
2138 | - bio_set_op_attrs(bio, REQ_OP_ZONE_RESET_ALL, 0); |
2139 | - |
2140 | - ret = submit_bio_wait(bio); |
2141 | - bio_put(bio); |
2142 | - |
2143 | - return ret; |
2144 | -} |
2145 | - |
2146 | static inline bool blkdev_allow_reset_all_zones(struct block_device *bdev, |
2147 | + sector_t sector, |
2148 | sector_t nr_sectors) |
2149 | { |
2150 | if (!blk_queue_zone_resetall(bdev_get_queue(bdev))) |
2151 | return false; |
2152 | |
2153 | - if (nr_sectors != part_nr_sects_read(bdev->bd_part)) |
2154 | + if (sector || nr_sectors != part_nr_sects_read(bdev->bd_part)) |
2155 | return false; |
2156 | /* |
2157 | * REQ_OP_ZONE_RESET_ALL can be executed only if the block device is |
2158 | @@ -271,9 +253,6 @@ int blkdev_reset_zones(struct block_device *bdev, |
2159 | /* Out of range */ |
2160 | return -EINVAL; |
2161 | |
2162 | - if (blkdev_allow_reset_all_zones(bdev, nr_sectors)) |
2163 | - return __blkdev_reset_all_zones(bdev, gfp_mask); |
2164 | - |
2165 | /* Check alignment (handle eventual smaller last zone) */ |
2166 | zone_sectors = blk_queue_zone_sectors(q); |
2167 | if (sector & (zone_sectors - 1)) |
2168 | @@ -285,17 +264,24 @@ int blkdev_reset_zones(struct block_device *bdev, |
2169 | |
2170 | blk_start_plug(&plug); |
2171 | while (sector < end_sector) { |
2172 | - |
2173 | bio = blk_next_bio(bio, 0, gfp_mask); |
2174 | - bio->bi_iter.bi_sector = sector; |
2175 | bio_set_dev(bio, bdev); |
2176 | - bio_set_op_attrs(bio, REQ_OP_ZONE_RESET, 0); |
2177 | |
2178 | + /* |
2179 | + * Special case for the zone reset operation that reset all |
2180 | + * zones, this is useful for applications like mkfs. |
2181 | + */ |
2182 | + if (blkdev_allow_reset_all_zones(bdev, sector, nr_sectors)) { |
2183 | + bio->bi_opf = REQ_OP_ZONE_RESET_ALL; |
2184 | + break; |
2185 | + } |
2186 | + |
2187 | + bio->bi_opf = REQ_OP_ZONE_RESET; |
2188 | + bio->bi_iter.bi_sector = sector; |
2189 | sector += zone_sectors; |
2190 | |
2191 | /* This may take a while, so be nice to others */ |
2192 | cond_resched(); |
2193 | - |
2194 | } |
2195 | |
2196 | ret = submit_bio_wait(bio); |
2197 | diff --git a/crypto/af_alg.c b/crypto/af_alg.c |
2198 | index 1d4b0157ee5dc..4a2e91baabdef 100644 |
2199 | --- a/crypto/af_alg.c |
2200 | +++ b/crypto/af_alg.c |
2201 | @@ -147,7 +147,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
2202 | const u32 allowed = CRYPTO_ALG_KERN_DRIVER_ONLY; |
2203 | struct sock *sk = sock->sk; |
2204 | struct alg_sock *ask = alg_sk(sk); |
2205 | - struct sockaddr_alg *sa = (void *)uaddr; |
2206 | + struct sockaddr_alg_new *sa = (void *)uaddr; |
2207 | const struct af_alg_type *type; |
2208 | void *private; |
2209 | int err; |
2210 | @@ -155,7 +155,11 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
2211 | if (sock->state == SS_CONNECTED) |
2212 | return -EINVAL; |
2213 | |
2214 | - if (addr_len < sizeof(*sa)) |
2215 | + BUILD_BUG_ON(offsetof(struct sockaddr_alg_new, salg_name) != |
2216 | + offsetof(struct sockaddr_alg, salg_name)); |
2217 | + BUILD_BUG_ON(offsetof(struct sockaddr_alg, salg_name) != sizeof(*sa)); |
2218 | + |
2219 | + if (addr_len < sizeof(*sa) + 1) |
2220 | return -EINVAL; |
2221 | |
2222 | /* If caller uses non-allowed flag, return error. */ |
2223 | @@ -163,7 +167,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
2224 | return -EINVAL; |
2225 | |
2226 | sa->salg_type[sizeof(sa->salg_type) - 1] = 0; |
2227 | - sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0; |
2228 | + sa->salg_name[addr_len - sizeof(*sa) - 1] = 0; |
2229 | |
2230 | type = alg_get_type(sa->salg_type); |
2231 | if (IS_ERR(type) && PTR_ERR(type) == -ENOENT) { |
2232 | diff --git a/crypto/ecdh.c b/crypto/ecdh.c |
2233 | index bd599053a8c4b..efa4ee72301f8 100644 |
2234 | --- a/crypto/ecdh.c |
2235 | +++ b/crypto/ecdh.c |
2236 | @@ -53,12 +53,13 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf, |
2237 | return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, |
2238 | ctx->private_key); |
2239 | |
2240 | - if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, |
2241 | - (const u64 *)params.key, params.key_size) < 0) |
2242 | - return -EINVAL; |
2243 | - |
2244 | memcpy(ctx->private_key, params.key, params.key_size); |
2245 | |
2246 | + if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, |
2247 | + ctx->private_key, params.key_size) < 0) { |
2248 | + memzero_explicit(ctx->private_key, params.key_size); |
2249 | + return -EINVAL; |
2250 | + } |
2251 | return 0; |
2252 | } |
2253 | |
2254 | diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c |
2255 | index f3039b93ff61a..101887528848d 100644 |
2256 | --- a/drivers/acpi/acpi_pnp.c |
2257 | +++ b/drivers/acpi/acpi_pnp.c |
2258 | @@ -317,6 +317,9 @@ static bool matching_id(const char *idstr, const char *list_id) |
2259 | { |
2260 | int i; |
2261 | |
2262 | + if (strlen(idstr) != strlen(list_id)) |
2263 | + return false; |
2264 | + |
2265 | if (memcmp(idstr, list_id, 3)) |
2266 | return false; |
2267 | |
2268 | diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c |
2269 | index 1a5956fb2cbce..72e6fad39a5e1 100644 |
2270 | --- a/drivers/acpi/device_pm.c |
2271 | +++ b/drivers/acpi/device_pm.c |
2272 | @@ -749,7 +749,7 @@ static void acpi_pm_notify_work_func(struct acpi_device_wakeup_context *context) |
2273 | static DEFINE_MUTEX(acpi_wakeup_lock); |
2274 | |
2275 | static int __acpi_device_wakeup_enable(struct acpi_device *adev, |
2276 | - u32 target_state, int max_count) |
2277 | + u32 target_state) |
2278 | { |
2279 | struct acpi_device_wakeup *wakeup = &adev->wakeup; |
2280 | acpi_status status; |
2281 | @@ -757,9 +757,10 @@ static int __acpi_device_wakeup_enable(struct acpi_device *adev, |
2282 | |
2283 | mutex_lock(&acpi_wakeup_lock); |
2284 | |
2285 | - if (wakeup->enable_count >= max_count) |
2286 | + if (wakeup->enable_count >= INT_MAX) { |
2287 | + acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n"); |
2288 | goto out; |
2289 | - |
2290 | + } |
2291 | if (wakeup->enable_count > 0) |
2292 | goto inc; |
2293 | |
2294 | @@ -799,7 +800,7 @@ out: |
2295 | */ |
2296 | static int acpi_device_wakeup_enable(struct acpi_device *adev, u32 target_state) |
2297 | { |
2298 | - return __acpi_device_wakeup_enable(adev, target_state, 1); |
2299 | + return __acpi_device_wakeup_enable(adev, target_state); |
2300 | } |
2301 | |
2302 | /** |
2303 | @@ -829,8 +830,12 @@ out: |
2304 | mutex_unlock(&acpi_wakeup_lock); |
2305 | } |
2306 | |
2307 | -static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable, |
2308 | - int max_count) |
2309 | +/** |
2310 | + * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device. |
2311 | + * @dev: Device to enable/disable to generate wakeup events. |
2312 | + * @enable: Whether to enable or disable the wakeup functionality. |
2313 | + */ |
2314 | +int acpi_pm_set_device_wakeup(struct device *dev, bool enable) |
2315 | { |
2316 | struct acpi_device *adev; |
2317 | int error; |
2318 | @@ -850,36 +855,14 @@ static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable, |
2319 | return 0; |
2320 | } |
2321 | |
2322 | - error = __acpi_device_wakeup_enable(adev, acpi_target_system_state(), |
2323 | - max_count); |
2324 | + error = __acpi_device_wakeup_enable(adev, acpi_target_system_state()); |
2325 | if (!error) |
2326 | dev_dbg(dev, "Wakeup enabled by ACPI\n"); |
2327 | |
2328 | return error; |
2329 | } |
2330 | - |
2331 | -/** |
2332 | - * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device. |
2333 | - * @dev: Device to enable/disable to generate wakeup events. |
2334 | - * @enable: Whether to enable or disable the wakeup functionality. |
2335 | - */ |
2336 | -int acpi_pm_set_device_wakeup(struct device *dev, bool enable) |
2337 | -{ |
2338 | - return __acpi_pm_set_device_wakeup(dev, enable, 1); |
2339 | -} |
2340 | EXPORT_SYMBOL_GPL(acpi_pm_set_device_wakeup); |
2341 | |
2342 | -/** |
2343 | - * acpi_pm_set_bridge_wakeup - Enable/disable remote wakeup for given bridge. |
2344 | - * @dev: Bridge device to enable/disable to generate wakeup events. |
2345 | - * @enable: Whether to enable or disable the wakeup functionality. |
2346 | - */ |
2347 | -int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) |
2348 | -{ |
2349 | - return __acpi_pm_set_device_wakeup(dev, enable, INT_MAX); |
2350 | -} |
2351 | -EXPORT_SYMBOL_GPL(acpi_pm_set_bridge_wakeup); |
2352 | - |
2353 | /** |
2354 | * acpi_dev_pm_low_power - Put ACPI device into a low-power state. |
2355 | * @dev: Device to put into a low-power state. |
2356 | diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c |
2357 | index 2a3e392751e0a..48ca9a844f06b 100644 |
2358 | --- a/drivers/acpi/resource.c |
2359 | +++ b/drivers/acpi/resource.c |
2360 | @@ -541,7 +541,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares, |
2361 | ret = c->preproc(ares, c->preproc_data); |
2362 | if (ret < 0) { |
2363 | c->error = ret; |
2364 | - return AE_CTRL_TERMINATE; |
2365 | + return AE_ABORT_METHOD; |
2366 | } else if (ret > 0) { |
2367 | return AE_OK; |
2368 | } |
2369 | diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
2370 | index b62b1ab6bb699..89b590c9573ff 100644 |
2371 | --- a/drivers/android/binder.c |
2372 | +++ b/drivers/android/binder.c |
2373 | @@ -3150,6 +3150,7 @@ static void binder_transaction(struct binder_proc *proc, |
2374 | t->buffer->debug_id = t->debug_id; |
2375 | t->buffer->transaction = t; |
2376 | t->buffer->target_node = target_node; |
2377 | + t->buffer->clear_on_free = !!(t->flags & TF_CLEAR_BUF); |
2378 | trace_binder_transaction_alloc_buf(t->buffer); |
2379 | |
2380 | if (binder_alloc_copy_user_to_buffer( |
2381 | diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c |
2382 | index 2048ba6c8b082..3526bb1488e5e 100644 |
2383 | --- a/drivers/android/binder_alloc.c |
2384 | +++ b/drivers/android/binder_alloc.c |
2385 | @@ -647,6 +647,8 @@ static void binder_free_buf_locked(struct binder_alloc *alloc, |
2386 | binder_insert_free_buffer(alloc, buffer); |
2387 | } |
2388 | |
2389 | +static void binder_alloc_clear_buf(struct binder_alloc *alloc, |
2390 | + struct binder_buffer *buffer); |
2391 | /** |
2392 | * binder_alloc_free_buf() - free a binder buffer |
2393 | * @alloc: binder_alloc for this proc |
2394 | @@ -657,6 +659,18 @@ static void binder_free_buf_locked(struct binder_alloc *alloc, |
2395 | void binder_alloc_free_buf(struct binder_alloc *alloc, |
2396 | struct binder_buffer *buffer) |
2397 | { |
2398 | + /* |
2399 | + * We could eliminate the call to binder_alloc_clear_buf() |
2400 | + * from binder_alloc_deferred_release() by moving this to |
2401 | + * binder_alloc_free_buf_locked(). However, that could |
2402 | + * increase contention for the alloc mutex if clear_on_free |
2403 | + * is used frequently for large buffers. The mutex is not |
2404 | + * needed for correctness here. |
2405 | + */ |
2406 | + if (buffer->clear_on_free) { |
2407 | + binder_alloc_clear_buf(alloc, buffer); |
2408 | + buffer->clear_on_free = false; |
2409 | + } |
2410 | mutex_lock(&alloc->mutex); |
2411 | binder_free_buf_locked(alloc, buffer); |
2412 | mutex_unlock(&alloc->mutex); |
2413 | @@ -753,6 +767,10 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc) |
2414 | /* Transaction should already have been freed */ |
2415 | BUG_ON(buffer->transaction); |
2416 | |
2417 | + if (buffer->clear_on_free) { |
2418 | + binder_alloc_clear_buf(alloc, buffer); |
2419 | + buffer->clear_on_free = false; |
2420 | + } |
2421 | binder_free_buf_locked(alloc, buffer); |
2422 | buffers++; |
2423 | } |
2424 | @@ -1086,6 +1104,36 @@ static struct page *binder_alloc_get_page(struct binder_alloc *alloc, |
2425 | return lru_page->page_ptr; |
2426 | } |
2427 | |
2428 | +/** |
2429 | + * binder_alloc_clear_buf() - zero out buffer |
2430 | + * @alloc: binder_alloc for this proc |
2431 | + * @buffer: binder buffer to be cleared |
2432 | + * |
2433 | + * memset the given buffer to 0 |
2434 | + */ |
2435 | +static void binder_alloc_clear_buf(struct binder_alloc *alloc, |
2436 | + struct binder_buffer *buffer) |
2437 | +{ |
2438 | + size_t bytes = binder_alloc_buffer_size(alloc, buffer); |
2439 | + binder_size_t buffer_offset = 0; |
2440 | + |
2441 | + while (bytes) { |
2442 | + unsigned long size; |
2443 | + struct page *page; |
2444 | + pgoff_t pgoff; |
2445 | + void *kptr; |
2446 | + |
2447 | + page = binder_alloc_get_page(alloc, buffer, |
2448 | + buffer_offset, &pgoff); |
2449 | + size = min_t(size_t, bytes, PAGE_SIZE - pgoff); |
2450 | + kptr = kmap(page) + pgoff; |
2451 | + memset(kptr, 0, size); |
2452 | + kunmap(page); |
2453 | + bytes -= size; |
2454 | + buffer_offset += size; |
2455 | + } |
2456 | +} |
2457 | + |
2458 | /** |
2459 | * binder_alloc_copy_user_to_buffer() - copy src user to tgt user |
2460 | * @alloc: binder_alloc for this proc |
2461 | diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h |
2462 | index db9c1b984695d..288d0f478aa38 100644 |
2463 | --- a/drivers/android/binder_alloc.h |
2464 | +++ b/drivers/android/binder_alloc.h |
2465 | @@ -23,6 +23,7 @@ struct binder_transaction; |
2466 | * @entry: entry alloc->buffers |
2467 | * @rb_node: node for allocated_buffers/free_buffers rb trees |
2468 | * @free: %true if buffer is free |
2469 | + * @clear_on_free: %true if buffer must be zeroed after use |
2470 | * @allow_user_free: %true if user is allowed to free buffer |
2471 | * @async_transaction: %true if buffer is in use for an async txn |
2472 | * @debug_id: unique ID for debugging |
2473 | @@ -40,9 +41,10 @@ struct binder_buffer { |
2474 | struct rb_node rb_node; /* free entry by size or allocated entry */ |
2475 | /* by address */ |
2476 | unsigned free:1; |
2477 | + unsigned clear_on_free:1; |
2478 | unsigned allow_user_free:1; |
2479 | unsigned async_transaction:1; |
2480 | - unsigned debug_id:29; |
2481 | + unsigned debug_id:28; |
2482 | |
2483 | struct binder_transaction *transaction; |
2484 | |
2485 | diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c |
2486 | index 192ca58cc3c7f..040d7bb213978 100644 |
2487 | --- a/drivers/block/xen-blkback/xenbus.c |
2488 | +++ b/drivers/block/xen-blkback/xenbus.c |
2489 | @@ -256,6 +256,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) |
2490 | |
2491 | if (ring->xenblkd) { |
2492 | kthread_stop(ring->xenblkd); |
2493 | + ring->xenblkd = NULL; |
2494 | wake_up(&ring->shutdown_wq); |
2495 | } |
2496 | |
2497 | @@ -643,7 +644,8 @@ static int xen_blkbk_probe(struct xenbus_device *dev, |
2498 | /* setup back pointer */ |
2499 | be->blkif->be = be; |
2500 | |
2501 | - err = xenbus_watch_pathfmt(dev, &be->backend_watch, backend_changed, |
2502 | + err = xenbus_watch_pathfmt(dev, &be->backend_watch, NULL, |
2503 | + backend_changed, |
2504 | "%s/%s", dev->nodename, "physical-device"); |
2505 | if (err) |
2506 | goto fail; |
2507 | diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
2508 | index b7de7cb8cca90..304178be1ef40 100644 |
2509 | --- a/drivers/bluetooth/btmtksdio.c |
2510 | +++ b/drivers/bluetooth/btmtksdio.c |
2511 | @@ -703,7 +703,7 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
2512 | err = mtk_hci_wmt_sync(hdev, &wmt_params); |
2513 | if (err < 0) { |
2514 | bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
2515 | - return err; |
2516 | + goto free_fw; |
2517 | } |
2518 | |
2519 | fw_ptr = fw->data; |
2520 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
2521 | index b326eeddaadf0..b92bd97b1c399 100644 |
2522 | --- a/drivers/bluetooth/btusb.c |
2523 | +++ b/drivers/bluetooth/btusb.c |
2524 | @@ -2812,7 +2812,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
2525 | err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); |
2526 | if (err < 0) { |
2527 | bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
2528 | - return err; |
2529 | + goto err_release_fw; |
2530 | } |
2531 | |
2532 | fw_ptr = fw->data; |
2533 | diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c |
2534 | index 5df0651b6cd55..e11af747395dd 100644 |
2535 | --- a/drivers/bluetooth/hci_h5.c |
2536 | +++ b/drivers/bluetooth/hci_h5.c |
2537 | @@ -244,6 +244,9 @@ static int h5_close(struct hci_uart *hu) |
2538 | skb_queue_purge(&h5->rel); |
2539 | skb_queue_purge(&h5->unrel); |
2540 | |
2541 | + kfree_skb(h5->rx_skb); |
2542 | + h5->rx_skb = NULL; |
2543 | + |
2544 | if (h5->vnd && h5->vnd->close) |
2545 | h5->vnd->close(h5); |
2546 | |
2547 | diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c |
2548 | index cc7bb900f5249..95672306d3714 100644 |
2549 | --- a/drivers/bus/fsl-mc/fsl-mc-allocator.c |
2550 | +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c |
2551 | @@ -292,8 +292,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, |
2552 | goto error; |
2553 | |
2554 | mc_adev = resource->data; |
2555 | - if (!mc_adev) |
2556 | + if (!mc_adev) { |
2557 | + error = -EINVAL; |
2558 | goto error; |
2559 | + } |
2560 | |
2561 | mc_adev->consumer_link = device_link_add(&mc_dev->dev, |
2562 | &mc_adev->dev, |
2563 | diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c |
2564 | index 1b14256376d24..7c1da45be166e 100644 |
2565 | --- a/drivers/bus/mips_cdmm.c |
2566 | +++ b/drivers/bus/mips_cdmm.c |
2567 | @@ -544,10 +544,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus) |
2568 | dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id); |
2569 | ++id; |
2570 | ret = device_register(&dev->dev); |
2571 | - if (ret) { |
2572 | + if (ret) |
2573 | put_device(&dev->dev); |
2574 | - kfree(dev); |
2575 | - } |
2576 | } |
2577 | } |
2578 | |
2579 | diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c |
2580 | index 7338a3bc71eb1..e3f4c8f20223a 100644 |
2581 | --- a/drivers/clk/at91/sam9x60.c |
2582 | +++ b/drivers/clk/at91/sam9x60.c |
2583 | @@ -162,7 +162,6 @@ static void __init sam9x60_pmc_setup(struct device_node *np) |
2584 | struct regmap *regmap; |
2585 | struct clk_hw *hw; |
2586 | int i; |
2587 | - bool bypass; |
2588 | |
2589 | i = of_property_match_string(np, "clock-names", "td_slck"); |
2590 | if (i < 0) |
2591 | @@ -197,10 +196,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) |
2592 | if (IS_ERR(hw)) |
2593 | goto err_free; |
2594 | |
2595 | - bypass = of_property_read_bool(np, "atmel,osc-bypass"); |
2596 | - |
2597 | - hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, |
2598 | - bypass); |
2599 | + hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, 0); |
2600 | if (IS_ERR(hw)) |
2601 | goto err_free; |
2602 | |
2603 | diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c |
2604 | index 2ce370c804aae..f19994ce7ca15 100644 |
2605 | --- a/drivers/clk/clk-s2mps11.c |
2606 | +++ b/drivers/clk/clk-s2mps11.c |
2607 | @@ -195,6 +195,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev) |
2608 | return ret; |
2609 | |
2610 | err_reg: |
2611 | + of_node_put(s2mps11_clks[0].clk_np); |
2612 | while (--i >= 0) |
2613 | clkdev_drop(s2mps11_clks[i].lookup); |
2614 | |
2615 | diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c |
2616 | index 6e963031cd873..7490d4f4d9366 100644 |
2617 | --- a/drivers/clk/ingenic/cgu.c |
2618 | +++ b/drivers/clk/ingenic/cgu.c |
2619 | @@ -393,15 +393,21 @@ static unsigned int |
2620 | ingenic_clk_calc_hw_div(const struct ingenic_cgu_clk_info *clk_info, |
2621 | unsigned int div) |
2622 | { |
2623 | - unsigned int i; |
2624 | + unsigned int i, best_i = 0, best = (unsigned int)-1; |
2625 | |
2626 | for (i = 0; i < (1 << clk_info->div.bits) |
2627 | && clk_info->div.div_table[i]; i++) { |
2628 | - if (clk_info->div.div_table[i] >= div) |
2629 | - return i; |
2630 | + if (clk_info->div.div_table[i] >= div && |
2631 | + clk_info->div.div_table[i] < best) { |
2632 | + best = clk_info->div.div_table[i]; |
2633 | + best_i = i; |
2634 | + |
2635 | + if (div == best) |
2636 | + break; |
2637 | + } |
2638 | } |
2639 | |
2640 | - return i - 1; |
2641 | + return best_i; |
2642 | } |
2643 | |
2644 | static unsigned |
2645 | diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig |
2646 | index dabeb435d0678..3f8dcdcdde499 100644 |
2647 | --- a/drivers/clk/meson/Kconfig |
2648 | +++ b/drivers/clk/meson/Kconfig |
2649 | @@ -103,6 +103,7 @@ config COMMON_CLK_G12A |
2650 | select COMMON_CLK_MESON_AO_CLKC |
2651 | select COMMON_CLK_MESON_EE_CLKC |
2652 | select COMMON_CLK_MESON_CPU_DYNDIV |
2653 | + select COMMON_CLK_MESON_VID_PLL_DIV |
2654 | select MFD_SYSCON |
2655 | help |
2656 | Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2 |
2657 | diff --git a/drivers/clk/mvebu/armada-37xx-xtal.c b/drivers/clk/mvebu/armada-37xx-xtal.c |
2658 | index e9e306d4e9af9..41271351cf1f4 100644 |
2659 | --- a/drivers/clk/mvebu/armada-37xx-xtal.c |
2660 | +++ b/drivers/clk/mvebu/armada-37xx-xtal.c |
2661 | @@ -13,8 +13,8 @@ |
2662 | #include <linux/platform_device.h> |
2663 | #include <linux/regmap.h> |
2664 | |
2665 | -#define NB_GPIO1_LATCH 0xC |
2666 | -#define XTAL_MODE BIT(31) |
2667 | +#define NB_GPIO1_LATCH 0x8 |
2668 | +#define XTAL_MODE BIT(9) |
2669 | |
2670 | static int armada_3700_xtal_clock_probe(struct platform_device *pdev) |
2671 | { |
2672 | diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c |
2673 | index 1907ee195a08c..f2dc625b745da 100644 |
2674 | --- a/drivers/clk/renesas/r9a06g032-clocks.c |
2675 | +++ b/drivers/clk/renesas/r9a06g032-clocks.c |
2676 | @@ -55,7 +55,7 @@ struct r9a06g032_clkdesc { |
2677 | u16 sel, g1, r1, g2, r2; |
2678 | } dual; |
2679 | }; |
2680 | -} __packed; |
2681 | +}; |
2682 | |
2683 | #define I_GATE(_clk, _rst, _rdy, _midle, _scon, _mirack, _mistat) \ |
2684 | { .gate = _clk, .reset = _rst, \ |
2685 | diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c |
2686 | index 5f66bf8797723..149cfde817cba 100644 |
2687 | --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c |
2688 | +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c |
2689 | @@ -389,6 +389,7 @@ static struct clk_div_table ths_div_table[] = { |
2690 | { .val = 1, .div = 2 }, |
2691 | { .val = 2, .div = 4 }, |
2692 | { .val = 3, .div = 6 }, |
2693 | + { /* Sentinel */ }, |
2694 | }; |
2695 | static const char * const ths_parents[] = { "osc24M" }; |
2696 | static struct ccu_div ths_clk = { |
2697 | diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
2698 | index 6b636362379ee..7e629a4493afd 100644 |
2699 | --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
2700 | +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
2701 | @@ -322,6 +322,7 @@ static struct clk_div_table ths_div_table[] = { |
2702 | { .val = 1, .div = 2 }, |
2703 | { .val = 2, .div = 4 }, |
2704 | { .val = 3, .div = 6 }, |
2705 | + { /* Sentinel */ }, |
2706 | }; |
2707 | static SUNXI_CCU_DIV_TABLE_WITH_GATE(ths_clk, "ths", "osc24M", |
2708 | 0x074, 0, 2, ths_div_table, BIT(31), 0); |
2709 | diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c |
2710 | index f8688c2ddf1ae..fdb46c5efc26c 100644 |
2711 | --- a/drivers/clk/tegra/clk-dfll.c |
2712 | +++ b/drivers/clk/tegra/clk-dfll.c |
2713 | @@ -1801,13 +1801,13 @@ static int dfll_fetch_pwm_params(struct tegra_dfll *td) |
2714 | &td->reg_init_uV); |
2715 | if (!ret) { |
2716 | dev_err(td->dev, "couldn't get initialized voltage\n"); |
2717 | - return ret; |
2718 | + return -EINVAL; |
2719 | } |
2720 | |
2721 | ret = read_dt_param(td, "nvidia,pwm-period-nanoseconds", &pwm_period); |
2722 | if (!ret) { |
2723 | dev_err(td->dev, "couldn't get PWM period\n"); |
2724 | - return ret; |
2725 | + return -EINVAL; |
2726 | } |
2727 | td->pwm_rate = (NSEC_PER_SEC / pwm_period) * (MAX_DFLL_VOLTAGES - 1); |
2728 | |
2729 | diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h |
2730 | index de466b4446da9..0efcb200dde5a 100644 |
2731 | --- a/drivers/clk/tegra/clk-id.h |
2732 | +++ b/drivers/clk/tegra/clk-id.h |
2733 | @@ -233,6 +233,7 @@ enum clk_id { |
2734 | tegra_clk_sdmmc4, |
2735 | tegra_clk_sdmmc4_8, |
2736 | tegra_clk_se, |
2737 | + tegra_clk_se_10, |
2738 | tegra_clk_soc_therm, |
2739 | tegra_clk_soc_therm_8, |
2740 | tegra_clk_sor0, |
2741 | diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c |
2742 | index 49b9f2f85bad6..4dc11e1e61ba8 100644 |
2743 | --- a/drivers/clk/tegra/clk-tegra-periph.c |
2744 | +++ b/drivers/clk/tegra/clk-tegra-periph.c |
2745 | @@ -636,7 +636,7 @@ static struct tegra_periph_init_data periph_clks[] = { |
2746 | INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8), |
2747 | INT8("host1x", mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_9), |
2748 | INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se), |
2749 | - INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se), |
2750 | + INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se_10), |
2751 | INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8), |
2752 | INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8), |
2753 | INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03), |
2754 | diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c |
2755 | index 95e36ba64accf..8024c6d2b9e95 100644 |
2756 | --- a/drivers/clk/ti/fapll.c |
2757 | +++ b/drivers/clk/ti/fapll.c |
2758 | @@ -498,6 +498,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, |
2759 | { |
2760 | struct clk_init_data *init; |
2761 | struct fapll_synth *synth; |
2762 | + struct clk *clk = ERR_PTR(-ENOMEM); |
2763 | |
2764 | init = kzalloc(sizeof(*init), GFP_KERNEL); |
2765 | if (!init) |
2766 | @@ -520,13 +521,19 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, |
2767 | synth->hw.init = init; |
2768 | synth->clk_pll = pll_clk; |
2769 | |
2770 | - return clk_register(NULL, &synth->hw); |
2771 | + clk = clk_register(NULL, &synth->hw); |
2772 | + if (IS_ERR(clk)) { |
2773 | + pr_err("failed to register clock\n"); |
2774 | + goto free; |
2775 | + } |
2776 | + |
2777 | + return clk; |
2778 | |
2779 | free: |
2780 | kfree(synth); |
2781 | kfree(init); |
2782 | |
2783 | - return ERR_PTR(-ENOMEM); |
2784 | + return clk; |
2785 | } |
2786 | |
2787 | static void __init ti_fapll_setup(struct device_node *node) |
2788 | diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c |
2789 | index 4be83b4de2a0a..39cdda2c9a98b 100644 |
2790 | --- a/drivers/clocksource/arm_arch_timer.c |
2791 | +++ b/drivers/clocksource/arm_arch_timer.c |
2792 | @@ -392,10 +392,10 @@ static void erratum_set_next_event_tval_generic(const int access, unsigned long |
2793 | ctrl &= ~ARCH_TIMER_CTRL_IT_MASK; |
2794 | |
2795 | if (access == ARCH_TIMER_PHYS_ACCESS) { |
2796 | - cval = evt + arch_counter_get_cntpct(); |
2797 | + cval = evt + arch_counter_get_cntpct_stable(); |
2798 | write_sysreg(cval, cntp_cval_el0); |
2799 | } else { |
2800 | - cval = evt + arch_counter_get_cntvct(); |
2801 | + cval = evt + arch_counter_get_cntvct_stable(); |
2802 | write_sysreg(cval, cntv_cval_el0); |
2803 | } |
2804 | |
2805 | @@ -818,15 +818,24 @@ static void arch_timer_evtstrm_enable(int divider) |
2806 | |
2807 | static void arch_timer_configure_evtstream(void) |
2808 | { |
2809 | - int evt_stream_div, pos; |
2810 | + int evt_stream_div, lsb; |
2811 | + |
2812 | + /* |
2813 | + * As the event stream can at most be generated at half the frequency |
2814 | + * of the counter, use half the frequency when computing the divider. |
2815 | + */ |
2816 | + evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2; |
2817 | + |
2818 | + /* |
2819 | + * Find the closest power of two to the divisor. If the adjacent bit |
2820 | + * of lsb (last set bit, starts from 0) is set, then we use (lsb + 1). |
2821 | + */ |
2822 | + lsb = fls(evt_stream_div) - 1; |
2823 | + if (lsb > 0 && (evt_stream_div & BIT(lsb - 1))) |
2824 | + lsb++; |
2825 | |
2826 | - /* Find the closest power of two to the divisor */ |
2827 | - evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ; |
2828 | - pos = fls(evt_stream_div); |
2829 | - if (pos > 1 && !(evt_stream_div & (1 << (pos - 2)))) |
2830 | - pos--; |
2831 | /* enable event stream */ |
2832 | - arch_timer_evtstrm_enable(min(pos, 15)); |
2833 | + arch_timer_evtstrm_enable(max(0, min(lsb, 15))); |
2834 | } |
2835 | |
2836 | static void arch_counter_set_user_access(void) |
2837 | diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c |
2838 | index 88fe2e9ba9a35..160bc6597de5b 100644 |
2839 | --- a/drivers/clocksource/timer-cadence-ttc.c |
2840 | +++ b/drivers/clocksource/timer-cadence-ttc.c |
2841 | @@ -411,10 +411,8 @@ static int __init ttc_setup_clockevent(struct clk *clk, |
2842 | ttcce->ttc.clk = clk; |
2843 | |
2844 | err = clk_prepare_enable(ttcce->ttc.clk); |
2845 | - if (err) { |
2846 | - kfree(ttcce); |
2847 | - return err; |
2848 | - } |
2849 | + if (err) |
2850 | + goto out_kfree; |
2851 | |
2852 | ttcce->ttc.clk_rate_change_nb.notifier_call = |
2853 | ttc_rate_change_clockevent_cb; |
2854 | @@ -424,7 +422,7 @@ static int __init ttc_setup_clockevent(struct clk *clk, |
2855 | &ttcce->ttc.clk_rate_change_nb); |
2856 | if (err) { |
2857 | pr_warn("Unable to register clock notifier.\n"); |
2858 | - return err; |
2859 | + goto out_kfree; |
2860 | } |
2861 | |
2862 | ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk); |
2863 | @@ -453,15 +451,17 @@ static int __init ttc_setup_clockevent(struct clk *clk, |
2864 | |
2865 | err = request_irq(irq, ttc_clock_event_interrupt, |
2866 | IRQF_TIMER, ttcce->ce.name, ttcce); |
2867 | - if (err) { |
2868 | - kfree(ttcce); |
2869 | - return err; |
2870 | - } |
2871 | + if (err) |
2872 | + goto out_kfree; |
2873 | |
2874 | clockevents_config_and_register(&ttcce->ce, |
2875 | ttcce->ttc.freq / PRESCALE, 1, 0xfffe); |
2876 | |
2877 | return 0; |
2878 | + |
2879 | +out_kfree: |
2880 | + kfree(ttcce); |
2881 | + return err; |
2882 | } |
2883 | |
2884 | /** |
2885 | diff --git a/drivers/clocksource/timer-orion.c b/drivers/clocksource/timer-orion.c |
2886 | index 7d487107e3cd8..32b2563e2ad1b 100644 |
2887 | --- a/drivers/clocksource/timer-orion.c |
2888 | +++ b/drivers/clocksource/timer-orion.c |
2889 | @@ -149,7 +149,8 @@ static int __init orion_timer_init(struct device_node *np) |
2890 | irq = irq_of_parse_and_map(np, 1); |
2891 | if (irq <= 0) { |
2892 | pr_err("%pOFn: unable to parse timer1 irq\n", np); |
2893 | - return -EINVAL; |
2894 | + ret = -EINVAL; |
2895 | + goto out_unprep_clk; |
2896 | } |
2897 | |
2898 | rate = clk_get_rate(clk); |
2899 | @@ -166,7 +167,7 @@ static int __init orion_timer_init(struct device_node *np) |
2900 | clocksource_mmio_readl_down); |
2901 | if (ret) { |
2902 | pr_err("Failed to initialize mmio timer\n"); |
2903 | - return ret; |
2904 | + goto out_unprep_clk; |
2905 | } |
2906 | |
2907 | sched_clock_register(orion_read_sched_clock, 32, rate); |
2908 | @@ -175,7 +176,7 @@ static int __init orion_timer_init(struct device_node *np) |
2909 | ret = setup_irq(irq, &orion_clkevt_irq); |
2910 | if (ret) { |
2911 | pr_err("%pOFn: unable to setup irq\n", np); |
2912 | - return ret; |
2913 | + goto out_unprep_clk; |
2914 | } |
2915 | |
2916 | ticks_per_jiffy = (clk_get_rate(clk) + HZ/2) / HZ; |
2917 | @@ -188,5 +189,9 @@ static int __init orion_timer_init(struct device_node *np) |
2918 | orion_delay_timer_init(rate); |
2919 | |
2920 | return 0; |
2921 | + |
2922 | +out_unprep_clk: |
2923 | + clk_disable_unprepare(clk); |
2924 | + return ret; |
2925 | } |
2926 | TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init); |
2927 | diff --git a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c |
2928 | index 39e34f5066d3d..b0fc5e84f8570 100644 |
2929 | --- a/drivers/cpufreq/armada-8k-cpufreq.c |
2930 | +++ b/drivers/cpufreq/armada-8k-cpufreq.c |
2931 | @@ -204,6 +204,12 @@ static void __exit armada_8k_cpufreq_exit(void) |
2932 | } |
2933 | module_exit(armada_8k_cpufreq_exit); |
2934 | |
2935 | +static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = { |
2936 | + { .compatible = "marvell,ap806-cpu-clock" }, |
2937 | + { }, |
2938 | +}; |
2939 | +MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match); |
2940 | + |
2941 | MODULE_AUTHOR("Gregory Clement <gregory.clement@bootlin.com>"); |
2942 | MODULE_DESCRIPTION("Armada 8K cpufreq driver"); |
2943 | MODULE_LICENSE("GPL"); |
2944 | diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c |
2945 | index 5a7f6dafcddb6..ac57cddc5f2fe 100644 |
2946 | --- a/drivers/cpufreq/highbank-cpufreq.c |
2947 | +++ b/drivers/cpufreq/highbank-cpufreq.c |
2948 | @@ -101,6 +101,13 @@ out_put_node: |
2949 | } |
2950 | module_init(hb_cpufreq_driver_init); |
2951 | |
2952 | +static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = { |
2953 | + { .compatible = "calxeda,highbank" }, |
2954 | + { .compatible = "calxeda,ecx-2000" }, |
2955 | + { }, |
2956 | +}; |
2957 | +MODULE_DEVICE_TABLE(of, hb_cpufreq_of_match); |
2958 | + |
2959 | MODULE_AUTHOR("Mark Langsdorf <mark.langsdorf@calxeda.com>"); |
2960 | MODULE_DESCRIPTION("Calxeda Highbank cpufreq driver"); |
2961 | MODULE_LICENSE("GPL"); |
2962 | diff --git a/drivers/cpufreq/loongson1-cpufreq.c b/drivers/cpufreq/loongson1-cpufreq.c |
2963 | index 0ea88778882ac..86f612593e497 100644 |
2964 | --- a/drivers/cpufreq/loongson1-cpufreq.c |
2965 | +++ b/drivers/cpufreq/loongson1-cpufreq.c |
2966 | @@ -216,6 +216,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = { |
2967 | |
2968 | module_platform_driver(ls1x_cpufreq_platdrv); |
2969 | |
2970 | +MODULE_ALIAS("platform:ls1x-cpufreq"); |
2971 | MODULE_AUTHOR("Kelvin Cheung <keguang.zhang@gmail.com>"); |
2972 | MODULE_DESCRIPTION("Loongson1 CPUFreq driver"); |
2973 | MODULE_LICENSE("GPL"); |
2974 | diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c |
2975 | index 0c98dd08273d0..927ebc582a385 100644 |
2976 | --- a/drivers/cpufreq/mediatek-cpufreq.c |
2977 | +++ b/drivers/cpufreq/mediatek-cpufreq.c |
2978 | @@ -540,6 +540,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = { |
2979 | |
2980 | { } |
2981 | }; |
2982 | +MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines); |
2983 | |
2984 | static int __init mtk_cpufreq_driver_init(void) |
2985 | { |
2986 | diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c |
2987 | index f0d2d5035413b..1e77d190f19f9 100644 |
2988 | --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c |
2989 | +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c |
2990 | @@ -305,6 +305,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = { |
2991 | { .compatible = "qcom,qcs404", .data = &match_data_qcs404 }, |
2992 | {}, |
2993 | }; |
2994 | +MODULE_DEVICE_TABLE(of, qcom_cpufreq_match_list); |
2995 | |
2996 | /* |
2997 | * Since the driver depends on smem and nvmem drivers, which may |
2998 | diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c |
2999 | index 2b51e0718c9f6..b341ffbf56bc3 100644 |
3000 | --- a/drivers/cpufreq/scpi-cpufreq.c |
3001 | +++ b/drivers/cpufreq/scpi-cpufreq.c |
3002 | @@ -239,6 +239,7 @@ static struct platform_driver scpi_cpufreq_platdrv = { |
3003 | }; |
3004 | module_platform_driver(scpi_cpufreq_platdrv); |
3005 | |
3006 | +MODULE_ALIAS("platform:scpi-cpufreq"); |
3007 | MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>"); |
3008 | MODULE_DESCRIPTION("ARM SCPI CPUFreq interface driver"); |
3009 | MODULE_LICENSE("GPL v2"); |
3010 | diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c |
3011 | index 2855b7878a204..7ade4070ca827 100644 |
3012 | --- a/drivers/cpufreq/sti-cpufreq.c |
3013 | +++ b/drivers/cpufreq/sti-cpufreq.c |
3014 | @@ -292,6 +292,13 @@ register_cpufreq_dt: |
3015 | } |
3016 | module_init(sti_cpufreq_init); |
3017 | |
3018 | +static const struct of_device_id __maybe_unused sti_cpufreq_of_match[] = { |
3019 | + { .compatible = "st,stih407" }, |
3020 | + { .compatible = "st,stih410" }, |
3021 | + { }, |
3022 | +}; |
3023 | +MODULE_DEVICE_TABLE(of, sti_cpufreq_of_match); |
3024 | + |
3025 | MODULE_DESCRIPTION("STMicroelectronics CPUFreq/OPP driver"); |
3026 | MODULE_AUTHOR("Ajitpal Singh <ajitpal.singh@st.com>"); |
3027 | MODULE_AUTHOR("Lee Jones <lee.jones@linaro.org>"); |
3028 | diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
3029 | index 9907a165135b7..2deed8d8773fa 100644 |
3030 | --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
3031 | +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
3032 | @@ -167,6 +167,7 @@ static const struct of_device_id sun50i_cpufreq_match_list[] = { |
3033 | { .compatible = "allwinner,sun50i-h6" }, |
3034 | {} |
3035 | }; |
3036 | +MODULE_DEVICE_TABLE(of, sun50i_cpufreq_match_list); |
3037 | |
3038 | static const struct of_device_id *sun50i_cpufreq_match_node(void) |
3039 | { |
3040 | diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig |
3041 | index 0952f059d967c..1f6308cdf79a2 100644 |
3042 | --- a/drivers/crypto/Kconfig |
3043 | +++ b/drivers/crypto/Kconfig |
3044 | @@ -544,6 +544,7 @@ config CRYPTO_DEV_ATMEL_SHA |
3045 | |
3046 | config CRYPTO_DEV_ATMEL_I2C |
3047 | tristate |
3048 | + select BITREVERSE |
3049 | |
3050 | config CRYPTO_DEV_ATMEL_ECC |
3051 | tristate "Support for Microchip / Atmel ECC hw accelerator" |
3052 | diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c |
3053 | index 7d6b695c4ab3f..230e8902c727c 100644 |
3054 | --- a/drivers/crypto/amcc/crypto4xx_core.c |
3055 | +++ b/drivers/crypto/amcc/crypto4xx_core.c |
3056 | @@ -916,7 +916,7 @@ int crypto4xx_build_pd(struct crypto_async_request *req, |
3057 | } |
3058 | |
3059 | pd->pd_ctl.w = PD_CTL_HOST_READY | |
3060 | - ((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AHASH) | |
3061 | + ((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AHASH) || |
3062 | (crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AEAD) ? |
3063 | PD_CTL_HASH_FINAL : 0); |
3064 | pd->pd_ctl_len.w = 0x00400000 | (assoclen + datalen); |
3065 | diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c |
3066 | index 991a4425f006a..4d9d97c59ee36 100644 |
3067 | --- a/drivers/crypto/inside-secure/safexcel.c |
3068 | +++ b/drivers/crypto/inside-secure/safexcel.c |
3069 | @@ -1467,7 +1467,7 @@ static int safexcel_probe_generic(void *pdev, |
3070 | |
3071 | priv->ring[i].rdr_req = devm_kcalloc(dev, |
3072 | EIP197_DEFAULT_RING_SIZE, |
3073 | - sizeof(priv->ring[i].rdr_req), |
3074 | + sizeof(*priv->ring[i].rdr_req), |
3075 | GFP_KERNEL); |
3076 | if (!priv->ring[i].rdr_req) |
3077 | return -ENOMEM; |
3078 | diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c |
3079 | index 2f53fbb741001..103e704c14697 100644 |
3080 | --- a/drivers/crypto/omap-aes.c |
3081 | +++ b/drivers/crypto/omap-aes.c |
3082 | @@ -1157,7 +1157,7 @@ static int omap_aes_probe(struct platform_device *pdev) |
3083 | if (err < 0) { |
3084 | dev_err(dev, "%s: failed to get_sync(%d)\n", |
3085 | __func__, err); |
3086 | - goto err_res; |
3087 | + goto err_pm_disable; |
3088 | } |
3089 | |
3090 | omap_aes_dma_stop(dd); |
3091 | @@ -1267,6 +1267,7 @@ err_engine: |
3092 | omap_aes_dma_cleanup(dd); |
3093 | err_irq: |
3094 | tasklet_kill(&dd->done_task); |
3095 | +err_pm_disable: |
3096 | pm_runtime_disable(dev); |
3097 | err_res: |
3098 | dd = NULL; |
3099 | diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c |
3100 | index ff149e176f649..dac130bb807ae 100644 |
3101 | --- a/drivers/crypto/qat/qat_common/qat_hal.c |
3102 | +++ b/drivers/crypto/qat/qat_common/qat_hal.c |
3103 | @@ -1189,7 +1189,7 @@ static int qat_hal_put_rel_rd_xfer(struct icp_qat_fw_loader_handle *handle, |
3104 | unsigned short mask; |
3105 | unsigned short dr_offset = 0x10; |
3106 | |
3107 | - status = ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES); |
3108 | + ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES); |
3109 | if (CE_INUSE_CONTEXTS & ctx_enables) { |
3110 | if (ctx & 0x1) { |
3111 | pr_err("QAT: bad 4-ctx mode,ctx=0x%x\n", ctx); |
3112 | diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
3113 | index 56e3068c9947a..b7c66fc0ae0c2 100644 |
3114 | --- a/drivers/crypto/talitos.c |
3115 | +++ b/drivers/crypto/talitos.c |
3116 | @@ -460,7 +460,7 @@ DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE) |
3117 | /* |
3118 | * locate current (offending) descriptor |
3119 | */ |
3120 | -static u32 current_desc_hdr(struct device *dev, int ch) |
3121 | +static __be32 current_desc_hdr(struct device *dev, int ch) |
3122 | { |
3123 | struct talitos_private *priv = dev_get_drvdata(dev); |
3124 | int tail, iter; |
3125 | @@ -478,7 +478,7 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
3126 | |
3127 | iter = tail; |
3128 | while (priv->chan[ch].fifo[iter].dma_desc != cur_desc && |
3129 | - priv->chan[ch].fifo[iter].desc->next_desc != cur_desc) { |
3130 | + priv->chan[ch].fifo[iter].desc->next_desc != cpu_to_be32(cur_desc)) { |
3131 | iter = (iter + 1) & (priv->fifo_len - 1); |
3132 | if (iter == tail) { |
3133 | dev_err(dev, "couldn't locate current descriptor\n"); |
3134 | @@ -486,7 +486,7 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
3135 | } |
3136 | } |
3137 | |
3138 | - if (priv->chan[ch].fifo[iter].desc->next_desc == cur_desc) { |
3139 | + if (priv->chan[ch].fifo[iter].desc->next_desc == cpu_to_be32(cur_desc)) { |
3140 | struct talitos_edesc *edesc; |
3141 | |
3142 | edesc = container_of(priv->chan[ch].fifo[iter].desc, |
3143 | @@ -501,13 +501,13 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
3144 | /* |
3145 | * user diagnostics; report root cause of error based on execution unit status |
3146 | */ |
3147 | -static void report_eu_error(struct device *dev, int ch, u32 desc_hdr) |
3148 | +static void report_eu_error(struct device *dev, int ch, __be32 desc_hdr) |
3149 | { |
3150 | struct talitos_private *priv = dev_get_drvdata(dev); |
3151 | int i; |
3152 | |
3153 | if (!desc_hdr) |
3154 | - desc_hdr = in_be32(priv->chan[ch].reg + TALITOS_DESCBUF); |
3155 | + desc_hdr = cpu_to_be32(in_be32(priv->chan[ch].reg + TALITOS_DESCBUF)); |
3156 | |
3157 | switch (desc_hdr & DESC_HDR_SEL0_MASK) { |
3158 | case DESC_HDR_SEL0_AFEU: |
3159 | diff --git a/drivers/dax/super.c b/drivers/dax/super.c |
3160 | index b936852881871..8074e5de815b9 100644 |
3161 | --- a/drivers/dax/super.c |
3162 | +++ b/drivers/dax/super.c |
3163 | @@ -720,6 +720,7 @@ err_chrdev: |
3164 | |
3165 | static void __exit dax_core_exit(void) |
3166 | { |
3167 | + dax_bus_exit(); |
3168 | unregister_chrdev_region(dax_devt, MINORMASK+1); |
3169 | ida_destroy(&dax_minor_ida); |
3170 | dax_fs_exit(); |
3171 | diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c |
3172 | index 709002515550c..242a9ec295cf8 100644 |
3173 | --- a/drivers/dma-buf/dma-resv.c |
3174 | +++ b/drivers/dma-buf/dma-resv.c |
3175 | @@ -161,7 +161,7 @@ int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences) |
3176 | max = max(old->shared_count + num_fences, |
3177 | old->shared_max * 2); |
3178 | } else { |
3179 | - max = 4; |
3180 | + max = max(4ul, roundup_pow_of_two(num_fences)); |
3181 | } |
3182 | |
3183 | new = dma_resv_list_alloc(max); |
3184 | diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c |
3185 | index e3850f04f6763..889a94af4c851 100644 |
3186 | --- a/drivers/dma/mv_xor_v2.c |
3187 | +++ b/drivers/dma/mv_xor_v2.c |
3188 | @@ -766,8 +766,10 @@ static int mv_xor_v2_probe(struct platform_device *pdev) |
3189 | goto disable_clk; |
3190 | |
3191 | msi_desc = first_msi_entry(&pdev->dev); |
3192 | - if (!msi_desc) |
3193 | + if (!msi_desc) { |
3194 | + ret = -ENODEV; |
3195 | goto free_msi_irqs; |
3196 | + } |
3197 | xor_dev->msi_desc = msi_desc; |
3198 | |
3199 | ret = devm_request_irq(&pdev->dev, msi_desc->irq, |
3200 | diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c |
3201 | index 125a44d5a69e3..aed0f26c9af5d 100644 |
3202 | --- a/drivers/edac/amd64_edac.c |
3203 | +++ b/drivers/edac/amd64_edac.c |
3204 | @@ -22,6 +22,9 @@ static struct ecc_settings **ecc_stngs; |
3205 | /* Number of Unified Memory Controllers */ |
3206 | static u8 num_umcs; |
3207 | |
3208 | +/* Device for the PCI component */ |
3209 | +static struct device *pci_ctl_dev; |
3210 | + |
3211 | /* |
3212 | * Valid scrub rates for the K8 hardware memory scrubber. We map the scrubbing |
3213 | * bandwidth to a valid bit pattern. The 'set' operation finds the 'matching- |
3214 | @@ -2672,6 +2675,9 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) |
3215 | return -ENODEV; |
3216 | } |
3217 | |
3218 | + if (!pci_ctl_dev) |
3219 | + pci_ctl_dev = &pvt->F0->dev; |
3220 | + |
3221 | edac_dbg(1, "F0: %s\n", pci_name(pvt->F0)); |
3222 | edac_dbg(1, "F3: %s\n", pci_name(pvt->F3)); |
3223 | edac_dbg(1, "F6: %s\n", pci_name(pvt->F6)); |
3224 | @@ -2696,6 +2702,9 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) |
3225 | return -ENODEV; |
3226 | } |
3227 | |
3228 | + if (!pci_ctl_dev) |
3229 | + pci_ctl_dev = &pvt->F2->dev; |
3230 | + |
3231 | edac_dbg(1, "F1: %s\n", pci_name(pvt->F1)); |
3232 | edac_dbg(1, "F2: %s\n", pci_name(pvt->F2)); |
3233 | edac_dbg(1, "F3: %s\n", pci_name(pvt->F3)); |
3234 | @@ -3626,21 +3635,10 @@ static void remove_one_instance(unsigned int nid) |
3235 | |
3236 | static void setup_pci_device(void) |
3237 | { |
3238 | - struct mem_ctl_info *mci; |
3239 | - struct amd64_pvt *pvt; |
3240 | - |
3241 | if (pci_ctl) |
3242 | return; |
3243 | |
3244 | - mci = edac_mc_find(0); |
3245 | - if (!mci) |
3246 | - return; |
3247 | - |
3248 | - pvt = mci->pvt_info; |
3249 | - if (pvt->umc) |
3250 | - pci_ctl = edac_pci_create_generic_ctl(&pvt->F0->dev, EDAC_MOD_STR); |
3251 | - else |
3252 | - pci_ctl = edac_pci_create_generic_ctl(&pvt->F2->dev, EDAC_MOD_STR); |
3253 | + pci_ctl = edac_pci_create_generic_ctl(pci_ctl_dev, EDAC_MOD_STR); |
3254 | if (!pci_ctl) { |
3255 | pr_warn("%s(): Unable to create PCI control\n", __func__); |
3256 | pr_warn("%s(): PCI error report via EDAC not set\n", __func__); |
3257 | @@ -3723,6 +3721,8 @@ static int __init amd64_edac_init(void) |
3258 | return 0; |
3259 | |
3260 | err_pci: |
3261 | + pci_ctl_dev = NULL; |
3262 | + |
3263 | msrs_free(msrs); |
3264 | msrs = NULL; |
3265 | |
3266 | @@ -3754,6 +3754,8 @@ static void __exit amd64_edac_exit(void) |
3267 | kfree(ecc_stngs); |
3268 | ecc_stngs = NULL; |
3269 | |
3270 | + pci_ctl_dev = NULL; |
3271 | + |
3272 | msrs_free(msrs); |
3273 | msrs = NULL; |
3274 | } |
3275 | diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c |
3276 | index c0c5b6ecdb2e4..dfcde7ed95006 100644 |
3277 | --- a/drivers/edac/i10nm_base.c |
3278 | +++ b/drivers/edac/i10nm_base.c |
3279 | @@ -6,6 +6,7 @@ |
3280 | */ |
3281 | |
3282 | #include <linux/kernel.h> |
3283 | +#include <linux/io.h> |
3284 | #include <asm/cpu_device_id.h> |
3285 | #include <asm/intel-family.h> |
3286 | #include <asm/mce.h> |
3287 | @@ -19,14 +20,16 @@ |
3288 | #define i10nm_printk(level, fmt, arg...) \ |
3289 | edac_printk(level, "i10nm", fmt, ##arg) |
3290 | |
3291 | -#define I10NM_GET_SCK_BAR(d, reg) \ |
3292 | +#define I10NM_GET_SCK_BAR(d, reg) \ |
3293 | pci_read_config_dword((d)->uracu, 0xd0, &(reg)) |
3294 | #define I10NM_GET_IMC_BAR(d, i, reg) \ |
3295 | pci_read_config_dword((d)->uracu, 0xd8 + (i) * 4, &(reg)) |
3296 | #define I10NM_GET_DIMMMTR(m, i, j) \ |
3297 | - (*(u32 *)((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4)) |
3298 | + readl((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4) |
3299 | #define I10NM_GET_MCDDRTCFG(m, i, j) \ |
3300 | - (*(u32 *)((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4)) |
3301 | + readl((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4) |
3302 | +#define I10NM_GET_MCMTR(m, i) \ |
3303 | + readl((m)->mbase + 0x20ef8 + (i) * 0x4000) |
3304 | |
3305 | #define I10NM_GET_SCK_MMIO_BASE(reg) (GET_BITFIELD(reg, 0, 28) << 23) |
3306 | #define I10NM_GET_IMC_MMIO_OFFSET(reg) (GET_BITFIELD(reg, 0, 10) << 12) |
3307 | @@ -134,7 +137,7 @@ static bool i10nm_check_ecc(struct skx_imc *imc, int chan) |
3308 | { |
3309 | u32 mcmtr; |
3310 | |
3311 | - mcmtr = *(u32 *)(imc->mbase + 0x20ef8 + chan * 0x4000); |
3312 | + mcmtr = I10NM_GET_MCMTR(imc, chan); |
3313 | edac_dbg(1, "ch%d mcmtr reg %x\n", chan, mcmtr); |
3314 | |
3315 | return !!GET_BITFIELD(mcmtr, 2, 2); |
3316 | diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c |
3317 | index ea622c6f3a393..c19640a453f22 100644 |
3318 | --- a/drivers/edac/mce_amd.c |
3319 | +++ b/drivers/edac/mce_amd.c |
3320 | @@ -975,7 +975,7 @@ static void decode_smca_error(struct mce *m) |
3321 | } |
3322 | |
3323 | if (bank_type == SMCA_UMC && xec == 0 && decode_dram_ecc) |
3324 | - decode_dram_ecc(cpu_to_node(m->extcpu), m); |
3325 | + decode_dram_ecc(topology_die_id(m->extcpu), m); |
3326 | } |
3327 | |
3328 | static inline void amd_decode_err_code(u16 ec) |
3329 | diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c |
3330 | index 32fc5a66ffa98..26c7041f70698 100644 |
3331 | --- a/drivers/extcon/extcon-max77693.c |
3332 | +++ b/drivers/extcon/extcon-max77693.c |
3333 | @@ -1277,4 +1277,4 @@ module_platform_driver(max77693_muic_driver); |
3334 | MODULE_DESCRIPTION("Maxim MAX77693 Extcon driver"); |
3335 | MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>"); |
3336 | MODULE_LICENSE("GPL"); |
3337 | -MODULE_ALIAS("platform:extcon-max77693"); |
3338 | +MODULE_ALIAS("platform:max77693-muic"); |
3339 | diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c |
3340 | index bb287f35cf408..a69b3faf51ef0 100644 |
3341 | --- a/drivers/gpio/gpio-eic-sprd.c |
3342 | +++ b/drivers/gpio/gpio-eic-sprd.c |
3343 | @@ -569,6 +569,7 @@ static int sprd_eic_probe(struct platform_device *pdev) |
3344 | const struct sprd_eic_variant_data *pdata; |
3345 | struct gpio_irq_chip *irq; |
3346 | struct sprd_eic *sprd_eic; |
3347 | + struct resource *res; |
3348 | int ret, i; |
3349 | |
3350 | pdata = of_device_get_match_data(&pdev->dev); |
3351 | @@ -595,9 +596,13 @@ static int sprd_eic_probe(struct platform_device *pdev) |
3352 | * have one bank EIC, thus base[1] and base[2] can be |
3353 | * optional. |
3354 | */ |
3355 | - sprd_eic->base[i] = devm_platform_ioremap_resource(pdev, i); |
3356 | + res = platform_get_resource(pdev, IORESOURCE_MEM, i); |
3357 | + if (!res) |
3358 | + break; |
3359 | + |
3360 | + sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res); |
3361 | if (IS_ERR(sprd_eic->base[i])) |
3362 | - continue; |
3363 | + return PTR_ERR(sprd_eic->base[i]); |
3364 | } |
3365 | |
3366 | sprd_eic->chip.label = sprd_eic_label_name[sprd_eic->type]; |
3367 | diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c |
3368 | index 6c06876943412..3985d6e1c17dc 100644 |
3369 | --- a/drivers/gpio/gpio-mvebu.c |
3370 | +++ b/drivers/gpio/gpio-mvebu.c |
3371 | @@ -1196,6 +1196,13 @@ static int mvebu_gpio_probe(struct platform_device *pdev) |
3372 | |
3373 | devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip); |
3374 | |
3375 | + /* Some MVEBU SoCs have simple PWM support for GPIO lines */ |
3376 | + if (IS_ENABLED(CONFIG_PWM)) { |
3377 | + err = mvebu_pwm_probe(pdev, mvchip, id); |
3378 | + if (err) |
3379 | + return err; |
3380 | + } |
3381 | + |
3382 | /* Some gpio controllers do not provide irq support */ |
3383 | if (!have_irqs) |
3384 | return 0; |
3385 | @@ -1205,7 +1212,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev) |
3386 | if (!mvchip->domain) { |
3387 | dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n", |
3388 | mvchip->chip.label); |
3389 | - return -ENODEV; |
3390 | + err = -ENODEV; |
3391 | + goto err_pwm; |
3392 | } |
3393 | |
3394 | err = irq_alloc_domain_generic_chips( |
3395 | @@ -1253,14 +1261,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev) |
3396 | mvchip); |
3397 | } |
3398 | |
3399 | - /* Some MVEBU SoCs have simple PWM support for GPIO lines */ |
3400 | - if (IS_ENABLED(CONFIG_PWM)) |
3401 | - return mvebu_pwm_probe(pdev, mvchip, id); |
3402 | - |
3403 | return 0; |
3404 | |
3405 | err_domain: |
3406 | irq_domain_remove(mvchip->domain); |
3407 | +err_pwm: |
3408 | + pwmchip_remove(&mvchip->mvpwm->chip); |
3409 | |
3410 | return err; |
3411 | } |
3412 | diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c |
3413 | index 7835aad6d1628..88b04d8a7fa7d 100644 |
3414 | --- a/drivers/gpio/gpio-zynq.c |
3415 | +++ b/drivers/gpio/gpio-zynq.c |
3416 | @@ -556,7 +556,7 @@ static int zynq_gpio_irq_reqres(struct irq_data *d) |
3417 | struct gpio_chip *chip = irq_data_get_irq_chip_data(d); |
3418 | int ret; |
3419 | |
3420 | - ret = pm_runtime_get_sync(chip->parent); |
3421 | + ret = pm_runtime_resume_and_get(chip->parent); |
3422 | if (ret < 0) |
3423 | return ret; |
3424 | |
3425 | @@ -884,7 +884,7 @@ static int zynq_gpio_probe(struct platform_device *pdev) |
3426 | |
3427 | pm_runtime_set_active(&pdev->dev); |
3428 | pm_runtime_enable(&pdev->dev); |
3429 | - ret = pm_runtime_get_sync(&pdev->dev); |
3430 | + ret = pm_runtime_resume_and_get(&pdev->dev); |
3431 | if (ret < 0) |
3432 | goto err_pm_dis; |
3433 | |
3434 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c |
3435 | index 1d3cd5c50d5f2..4a0ef9268918c 100644 |
3436 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c |
3437 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c |
3438 | @@ -1664,6 +1664,7 @@ static int kfd_ioctl_import_dmabuf(struct file *filep, |
3439 | } |
3440 | |
3441 | mutex_unlock(&p->mutex); |
3442 | + dma_buf_put(dmabuf); |
3443 | |
3444 | args->handle = MAKE_HANDLE(args->gpu_id, idr_handle); |
3445 | |
3446 | @@ -1673,6 +1674,7 @@ err_free: |
3447 | amdgpu_amdkfd_gpuvm_free_memory_of_gpu(dev->kgd, (struct kgd_mem *)mem); |
3448 | err_unlock: |
3449 | mutex_unlock(&p->mutex); |
3450 | + dma_buf_put(dmabuf); |
3451 | return r; |
3452 | } |
3453 | |
3454 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3455 | index d2dd387c95d86..09410971615c4 100644 |
3456 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3457 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3458 | @@ -1434,7 +1434,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) |
3459 | |
3460 | drm_connector_update_edid_property(connector, |
3461 | aconnector->edid); |
3462 | - drm_add_edid_modes(connector, aconnector->edid); |
3463 | + aconnector->num_modes = drm_add_edid_modes(connector, aconnector->edid); |
3464 | + drm_connector_list_update(connector); |
3465 | |
3466 | if (aconnector->dc_link->aux_mode) |
3467 | drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux, |
3468 | diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |
3469 | index dd92f9c295b45..9f301f8575a54 100644 |
3470 | --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |
3471 | +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |
3472 | @@ -97,8 +97,17 @@ void rn_update_clocks(struct clk_mgr *clk_mgr_base, |
3473 | new_clocks->dppclk_khz = 100000; |
3474 | } |
3475 | |
3476 | - if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) { |
3477 | - if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz) |
3478 | + /* |
3479 | + * Temporally ignore thew 0 cases for disp and dpp clks. |
3480 | + * We may have a new feature that requires 0 clks in the future. |
3481 | + */ |
3482 | + if (new_clocks->dppclk_khz == 0 || new_clocks->dispclk_khz == 0) { |
3483 | + new_clocks->dppclk_khz = clk_mgr_base->clks.dppclk_khz; |
3484 | + new_clocks->dispclk_khz = clk_mgr_base->clks.dispclk_khz; |
3485 | + } |
3486 | + |
3487 | + if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr_base->clks.dppclk_khz)) { |
3488 | + if (clk_mgr_base->clks.dppclk_khz > new_clocks->dppclk_khz) |
3489 | dpp_clock_lowered = true; |
3490 | clk_mgr_base->clks.dppclk_khz = new_clocks->dppclk_khz; |
3491 | update_dppclk = true; |
3492 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
3493 | index 47cefc05fd3f5..fa92b88bc5a13 100644 |
3494 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
3495 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
3496 | @@ -2909,8 +2909,12 @@ uint32_t dc_bandwidth_in_kbps_from_timing( |
3497 | |
3498 | #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT |
3499 | if (timing->flags.DSC) { |
3500 | - kbps = (timing->pix_clk_100hz * timing->dsc_cfg.bits_per_pixel); |
3501 | - kbps = kbps / 160 + ((kbps % 160) ? 1 : 0); |
3502 | + struct fixed31_32 link_bw_kbps; |
3503 | + |
3504 | + link_bw_kbps = dc_fixpt_from_int(timing->pix_clk_100hz); |
3505 | + link_bw_kbps = dc_fixpt_div_int(link_bw_kbps, 160); |
3506 | + link_bw_kbps = dc_fixpt_mul_int(link_bw_kbps, timing->dsc_cfg.bits_per_pixel); |
3507 | + kbps = dc_fixpt_ceil(link_bw_kbps); |
3508 | return kbps; |
3509 | } |
3510 | #endif |
3511 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
3512 | index 6dd2334dd5e60..959eb075d11ed 100644 |
3513 | --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
3514 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
3515 | @@ -3378,7 +3378,7 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) |
3516 | |
3517 | if (edp_config_set.bits.PANEL_MODE_EDP |
3518 | != panel_mode_edp) { |
3519 | - enum ddc_result result = DDC_RESULT_UNKNOWN; |
3520 | + enum dc_status result = DC_ERROR_UNEXPECTED; |
3521 | |
3522 | edp_config_set.bits.PANEL_MODE_EDP = |
3523 | panel_mode_edp; |
3524 | @@ -3388,7 +3388,7 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) |
3525 | &edp_config_set.raw, |
3526 | sizeof(edp_config_set.raw)); |
3527 | |
3528 | - ASSERT(result == DDC_RESULT_SUCESSFULL); |
3529 | + ASSERT(result == DC_OK); |
3530 | } |
3531 | } |
3532 | DC_LOG_DETECTION_DP_CAPS("Link: %d eDP panel mode supported: %d " |
3533 | diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
3534 | index 51d07a4561ce9..e042d8ce05b4a 100644 |
3535 | --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
3536 | +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
3537 | @@ -1576,7 +1576,7 @@ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma |
3538 | struct pwl_float_data_ex *rgb = rgb_regamma; |
3539 | const struct hw_x_point *coord_x = coordinates_x; |
3540 | |
3541 | - build_coefficients(&coeff, true); |
3542 | + build_coefficients(&coeff, TRANSFER_FUNCTION_SRGB); |
3543 | |
3544 | i = 0; |
3545 | while (i != hw_points_num + 1) { |
3546 | diff --git a/drivers/gpu/drm/aspeed/Kconfig b/drivers/gpu/drm/aspeed/Kconfig |
3547 | index 018383cfcfa79..5e95bcea43e92 100644 |
3548 | --- a/drivers/gpu/drm/aspeed/Kconfig |
3549 | +++ b/drivers/gpu/drm/aspeed/Kconfig |
3550 | @@ -3,6 +3,7 @@ config DRM_ASPEED_GFX |
3551 | tristate "ASPEED BMC Display Controller" |
3552 | depends on DRM && OF |
3553 | depends on (COMPILE_TEST || ARCH_ASPEED) |
3554 | + depends on MMU |
3555 | select DRM_KMS_HELPER |
3556 | select DRM_KMS_CMA_HELPER |
3557 | select DMA_CMA if HAVE_DMA_CONTIGUOUS |
3558 | diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c |
3559 | index 0cfb386754c37..0d7f90c00f042 100644 |
3560 | --- a/drivers/gpu/drm/drm_dp_aux_dev.c |
3561 | +++ b/drivers/gpu/drm/drm_dp_aux_dev.c |
3562 | @@ -63,7 +63,7 @@ static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index) |
3563 | |
3564 | mutex_lock(&aux_idr_mutex); |
3565 | aux_dev = idr_find(&aux_idr, index); |
3566 | - if (!kref_get_unless_zero(&aux_dev->refcount)) |
3567 | + if (aux_dev && !kref_get_unless_zero(&aux_dev->refcount)) |
3568 | aux_dev = NULL; |
3569 | mutex_unlock(&aux_idr_mutex); |
3570 | |
3571 | diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c |
3572 | index 2ff4b35151bf8..87738650dd90b 100644 |
3573 | --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c |
3574 | +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c |
3575 | @@ -2125,7 +2125,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev |
3576 | DRM_INFO("failed to retrieve link info, disabling eDP\n"); |
3577 | cdv_intel_dp_encoder_destroy(encoder); |
3578 | cdv_intel_dp_destroy(connector); |
3579 | - goto err_priv; |
3580 | + goto err_connector; |
3581 | } else { |
3582 | DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n", |
3583 | intel_dp->dpcd[0], intel_dp->dpcd[1], |
3584 | diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |
3585 | index 3d8dff2d894ae..7f7d59445faed 100644 |
3586 | --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |
3587 | +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |
3588 | @@ -367,7 +367,7 @@ eb_vma_misplaced(const struct drm_i915_gem_exec_object2 *entry, |
3589 | return true; |
3590 | |
3591 | if (!(flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) && |
3592 | - (vma->node.start + vma->node.size - 1) >> 32) |
3593 | + (vma->node.start + vma->node.size + 4095) >> 32) |
3594 | return true; |
3595 | |
3596 | if (flags & __EXEC_OBJECT_NEEDS_MAP && |
3597 | diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c |
3598 | index 16e5fb9ec784d..82946ffcb6d21 100644 |
3599 | --- a/drivers/gpu/drm/mcde/mcde_drv.c |
3600 | +++ b/drivers/gpu/drm/mcde/mcde_drv.c |
3601 | @@ -410,8 +410,8 @@ static int mcde_probe(struct platform_device *pdev) |
3602 | } |
3603 | |
3604 | irq = platform_get_irq(pdev, 0); |
3605 | - if (!irq) { |
3606 | - ret = -EINVAL; |
3607 | + if (irq < 0) { |
3608 | + ret = irq; |
3609 | goto clk_disable; |
3610 | } |
3611 | |
3612 | diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |
3613 | index 5223498502c49..23a74eb5d7f81 100644 |
3614 | --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |
3615 | +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |
3616 | @@ -84,8 +84,9 @@ mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy) |
3617 | hdmi_phy->conf->hdmi_phy_disable_tmds) |
3618 | return &mtk_hdmi_phy_dev_ops; |
3619 | |
3620 | - dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); |
3621 | - return NULL; |
3622 | + if (hdmi_phy) |
3623 | + dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); |
3624 | + return NULL; |
3625 | } |
3626 | |
3627 | static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy, |
3628 | diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
3629 | index aa9385d5bfff9..33033b94935ed 100644 |
3630 | --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
3631 | +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
3632 | @@ -559,6 +559,7 @@ static int dsi_pll_10nm_restore_state(struct msm_dsi_pll *pll) |
3633 | struct pll_10nm_cached_state *cached = &pll_10nm->cached_state; |
3634 | void __iomem *phy_base = pll_10nm->phy_cmn_mmio; |
3635 | u32 val; |
3636 | + int ret; |
3637 | |
3638 | val = pll_read(pll_10nm->mmio + REG_DSI_10nm_PHY_PLL_PLL_OUTDIV_RATE); |
3639 | val &= ~0x3; |
3640 | @@ -573,6 +574,13 @@ static int dsi_pll_10nm_restore_state(struct msm_dsi_pll *pll) |
3641 | val |= cached->pll_mux; |
3642 | pll_write(phy_base + REG_DSI_10nm_PHY_CMN_CLK_CFG1, val); |
3643 | |
3644 | + ret = dsi_pll_10nm_vco_set_rate(&pll->clk_hw, pll_10nm->vco_current_rate, pll_10nm->vco_ref_clk_rate); |
3645 | + if (ret) { |
3646 | + DRM_DEV_ERROR(&pll_10nm->pdev->dev, |
3647 | + "restore vco rate failed. ret=%d\n", ret); |
3648 | + return ret; |
3649 | + } |
3650 | + |
3651 | DBG("DSI PLL%d", pll_10nm->id); |
3652 | |
3653 | return 0; |
3654 | diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
3655 | index 252f5ebb1acc4..3dd6c0087edb6 100644 |
3656 | --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
3657 | +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
3658 | @@ -891,6 +891,7 @@ static int omap_dmm_probe(struct platform_device *dev) |
3659 | &omap_dmm->refill_pa, GFP_KERNEL); |
3660 | if (!omap_dmm->refill_va) { |
3661 | dev_err(&dev->dev, "could not allocate refill memory\n"); |
3662 | + ret = -ENOMEM; |
3663 | goto fail; |
3664 | } |
3665 | |
3666 | diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c |
3667 | index bc7cc32140f81..6833dfad7241b 100644 |
3668 | --- a/drivers/gpu/drm/tegra/drm.c |
3669 | +++ b/drivers/gpu/drm/tegra/drm.c |
3670 | @@ -256,7 +256,7 @@ static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp) |
3671 | if (!fpriv) |
3672 | return -ENOMEM; |
3673 | |
3674 | - idr_init(&fpriv->contexts); |
3675 | + idr_init_base(&fpriv->contexts, 1); |
3676 | mutex_init(&fpriv->lock); |
3677 | filp->driver_priv = fpriv; |
3678 | |
3679 | diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c |
3680 | index 75e65d9536d54..6c3d221652393 100644 |
3681 | --- a/drivers/gpu/drm/tegra/sor.c |
3682 | +++ b/drivers/gpu/drm/tegra/sor.c |
3683 | @@ -2899,6 +2899,7 @@ static int tegra_sor_init(struct host1x_client *client) |
3684 | if (err < 0) { |
3685 | dev_err(sor->dev, "failed to deassert SOR reset: %d\n", |
3686 | err); |
3687 | + clk_disable_unprepare(sor->clk); |
3688 | return err; |
3689 | } |
3690 | |
3691 | @@ -2906,12 +2907,17 @@ static int tegra_sor_init(struct host1x_client *client) |
3692 | } |
3693 | |
3694 | err = clk_prepare_enable(sor->clk_safe); |
3695 | - if (err < 0) |
3696 | + if (err < 0) { |
3697 | + clk_disable_unprepare(sor->clk); |
3698 | return err; |
3699 | + } |
3700 | |
3701 | err = clk_prepare_enable(sor->clk_dp); |
3702 | - if (err < 0) |
3703 | + if (err < 0) { |
3704 | + clk_disable_unprepare(sor->clk_safe); |
3705 | + clk_disable_unprepare(sor->clk); |
3706 | return err; |
3707 | + } |
3708 | |
3709 | /* |
3710 | * Enable and unmask the HDA codec SCRATCH0 register interrupt. This |
3711 | diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c |
3712 | index 416f24823c0aa..02836d4e80237 100644 |
3713 | --- a/drivers/gpu/drm/tve200/tve200_drv.c |
3714 | +++ b/drivers/gpu/drm/tve200/tve200_drv.c |
3715 | @@ -210,8 +210,8 @@ static int tve200_probe(struct platform_device *pdev) |
3716 | } |
3717 | |
3718 | irq = platform_get_irq(pdev, 0); |
3719 | - if (!irq) { |
3720 | - ret = -EINVAL; |
3721 | + if (irq < 0) { |
3722 | + ret = irq; |
3723 | goto clk_disable; |
3724 | } |
3725 | |
3726 | diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c |
3727 | index 35f3bfc3e6f59..8e0f67455c098 100644 |
3728 | --- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c |
3729 | +++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c |
3730 | @@ -405,6 +405,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { |
3731 | }, |
3732 | .driver_data = (void *)&sipodev_desc |
3733 | }, |
3734 | + { |
3735 | + .ident = "Vero K147", |
3736 | + .matches = { |
3737 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VERO"), |
3738 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "K147"), |
3739 | + }, |
3740 | + .driver_data = (void *)&sipodev_desc |
3741 | + }, |
3742 | { } /* Terminate list */ |
3743 | }; |
3744 | |
3745 | diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c |
3746 | index 4bc4a201f0f6c..2be9c01e175ca 100644 |
3747 | --- a/drivers/hsi/controllers/omap_ssi_core.c |
3748 | +++ b/drivers/hsi/controllers/omap_ssi_core.c |
3749 | @@ -355,7 +355,7 @@ static int ssi_add_controller(struct hsi_controller *ssi, |
3750 | |
3751 | err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL); |
3752 | if (err < 0) |
3753 | - goto out_err; |
3754 | + return err; |
3755 | ssi->id = err; |
3756 | |
3757 | ssi->owner = THIS_MODULE; |
3758 | diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c |
3759 | index 8a51dcf055eab..026f70d7c5a43 100644 |
3760 | --- a/drivers/hwmon/ina3221.c |
3761 | +++ b/drivers/hwmon/ina3221.c |
3762 | @@ -403,7 +403,7 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable) |
3763 | |
3764 | /* For enabling routine, increase refcount and resume() at first */ |
3765 | if (enable) { |
3766 | - ret = pm_runtime_get_sync(ina->pm_dev); |
3767 | + ret = pm_runtime_resume_and_get(ina->pm_dev); |
3768 | if (ret < 0) { |
3769 | dev_err(dev, "Failed to get PM runtime\n"); |
3770 | return ret; |
3771 | diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c |
3772 | index 3810290e6d07a..95cba1a2cddf2 100644 |
3773 | --- a/drivers/hwtracing/coresight/coresight-etb10.c |
3774 | +++ b/drivers/hwtracing/coresight/coresight-etb10.c |
3775 | @@ -176,6 +176,7 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data) |
3776 | unsigned long flags; |
3777 | struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
3778 | struct perf_output_handle *handle = data; |
3779 | + struct cs_buffers *buf = etm_perf_sink_config(handle); |
3780 | |
3781 | spin_lock_irqsave(&drvdata->spinlock, flags); |
3782 | |
3783 | @@ -186,7 +187,7 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data) |
3784 | } |
3785 | |
3786 | /* Get a handle on the pid of the process to monitor */ |
3787 | - pid = task_pid_nr(handle->event->owner); |
3788 | + pid = buf->pid; |
3789 | |
3790 | if (drvdata->pid != -1 && drvdata->pid != pid) { |
3791 | ret = -EBUSY; |
3792 | @@ -383,6 +384,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, |
3793 | if (!buf) |
3794 | return NULL; |
3795 | |
3796 | + buf->pid = task_pid_nr(event->owner); |
3797 | buf->snapshot = overwrite; |
3798 | buf->nr_pages = nr_pages; |
3799 | buf->data_pages = pages; |
3800 | diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h |
3801 | index 82e563cdc8794..56379d4a7ede7 100644 |
3802 | --- a/drivers/hwtracing/coresight/coresight-priv.h |
3803 | +++ b/drivers/hwtracing/coresight/coresight-priv.h |
3804 | @@ -86,6 +86,7 @@ enum cs_mode { |
3805 | * struct cs_buffer - keep track of a recording session' specifics |
3806 | * @cur: index of the current buffer |
3807 | * @nr_pages: max number of pages granted to us |
3808 | + * @pid: PID this cs_buffer belongs to |
3809 | * @offset: offset within the current buffer |
3810 | * @data_size: how much we collected in this run |
3811 | * @snapshot: is this run in snapshot mode |
3812 | @@ -94,6 +95,7 @@ enum cs_mode { |
3813 | struct cs_buffers { |
3814 | unsigned int cur; |
3815 | unsigned int nr_pages; |
3816 | + pid_t pid; |
3817 | unsigned long offset; |
3818 | local_t data_size; |
3819 | bool snapshot; |
3820 | diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
3821 | index 6375504ba8b00..a5d70d09d2bd1 100644 |
3822 | --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
3823 | +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
3824 | @@ -227,6 +227,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data) |
3825 | unsigned long flags; |
3826 | struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); |
3827 | struct perf_output_handle *handle = data; |
3828 | + struct cs_buffers *buf = etm_perf_sink_config(handle); |
3829 | |
3830 | spin_lock_irqsave(&drvdata->spinlock, flags); |
3831 | do { |
3832 | @@ -243,7 +244,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data) |
3833 | } |
3834 | |
3835 | /* Get a handle on the pid of the process to monitor */ |
3836 | - pid = task_pid_nr(handle->event->owner); |
3837 | + pid = buf->pid; |
3838 | |
3839 | if (drvdata->pid != -1 && drvdata->pid != pid) { |
3840 | ret = -EBUSY; |
3841 | @@ -399,6 +400,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, |
3842 | if (!buf) |
3843 | return NULL; |
3844 | |
3845 | + buf->pid = task_pid_nr(event->owner); |
3846 | buf->snapshot = overwrite; |
3847 | buf->nr_pages = nr_pages; |
3848 | buf->data_pages = pages; |
3849 | diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c |
3850 | index 625882bc8b08f..ed77c7f7b344b 100644 |
3851 | --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c |
3852 | +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c |
3853 | @@ -217,6 +217,8 @@ static int tmc_pages_alloc(struct tmc_pages *tmc_pages, |
3854 | } else { |
3855 | page = alloc_pages_node(node, |
3856 | GFP_KERNEL | __GFP_ZERO, 0); |
3857 | + if (!page) |
3858 | + goto err; |
3859 | } |
3860 | paddr = dma_map_page(real_dev, page, 0, PAGE_SIZE, dir); |
3861 | if (dma_mapping_error(real_dev, paddr)) |
3862 | @@ -1533,7 +1535,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, |
3863 | |
3864 | /* Insert barrier packets at the beginning, if there was an overflow */ |
3865 | if (lost) |
3866 | - tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); |
3867 | + tmc_etr_buf_insert_barrier_packet(etr_buf, offset); |
3868 | tmc_etr_sync_perf_buffer(etr_perf, offset, size); |
3869 | |
3870 | /* |
3871 | diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c |
3872 | index aafc76ee93e02..17abf60c94aeb 100644 |
3873 | --- a/drivers/i2c/busses/i2c-qcom-geni.c |
3874 | +++ b/drivers/i2c/busses/i2c-qcom-geni.c |
3875 | @@ -368,6 +368,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
3876 | geni_se_select_mode(se, GENI_SE_FIFO); |
3877 | |
3878 | writel_relaxed(len, se->base + SE_I2C_RX_TRANS_LEN); |
3879 | + geni_se_setup_m_cmd(se, I2C_READ, m_param); |
3880 | |
3881 | if (dma_buf && geni_se_rx_dma_prep(se, dma_buf, len, &rx_dma)) { |
3882 | geni_se_select_mode(se, GENI_SE_FIFO); |
3883 | @@ -375,8 +376,6 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
3884 | dma_buf = NULL; |
3885 | } |
3886 | |
3887 | - geni_se_setup_m_cmd(se, I2C_READ, m_param); |
3888 | - |
3889 | time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); |
3890 | if (!time_left) |
3891 | geni_i2c_abort_xfer(gi2c); |
3892 | @@ -410,6 +409,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
3893 | geni_se_select_mode(se, GENI_SE_FIFO); |
3894 | |
3895 | writel_relaxed(len, se->base + SE_I2C_TX_TRANS_LEN); |
3896 | + geni_se_setup_m_cmd(se, I2C_WRITE, m_param); |
3897 | |
3898 | if (dma_buf && geni_se_tx_dma_prep(se, dma_buf, len, &tx_dma)) { |
3899 | geni_se_select_mode(se, GENI_SE_FIFO); |
3900 | @@ -417,8 +417,6 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
3901 | dma_buf = NULL; |
3902 | } |
3903 | |
3904 | - geni_se_setup_m_cmd(se, I2C_WRITE, m_param); |
3905 | - |
3906 | if (!dma_buf) /* Get FIFO IRQ */ |
3907 | writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG); |
3908 | |
3909 | diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c |
3910 | index 582ba047c4a67..cddc3dfd2ab7b 100644 |
3911 | --- a/drivers/iio/adc/rockchip_saradc.c |
3912 | +++ b/drivers/iio/adc/rockchip_saradc.c |
3913 | @@ -372,7 +372,7 @@ static int rockchip_saradc_resume(struct device *dev) |
3914 | |
3915 | ret = clk_prepare_enable(info->clk); |
3916 | if (ret) |
3917 | - return ret; |
3918 | + clk_disable_unprepare(info->pclk); |
3919 | |
3920 | return ret; |
3921 | } |
3922 | diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c |
3923 | index 552c2be8d87ad..4b706949a67ff 100644 |
3924 | --- a/drivers/iio/adc/ti-ads124s08.c |
3925 | +++ b/drivers/iio/adc/ti-ads124s08.c |
3926 | @@ -97,6 +97,14 @@ struct ads124s_private { |
3927 | struct gpio_desc *reset_gpio; |
3928 | struct spi_device *spi; |
3929 | struct mutex lock; |
3930 | + /* |
3931 | + * Used to correctly align data. |
3932 | + * Ensure timestamp is naturally aligned. |
3933 | + * Note that the full buffer length may not be needed if not |
3934 | + * all channels are enabled, as long as the alignment of the |
3935 | + * timestamp is maintained. |
3936 | + */ |
3937 | + u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u32)] __aligned(8); |
3938 | u8 data[5] ____cacheline_aligned; |
3939 | }; |
3940 | |
3941 | @@ -270,7 +278,6 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p) |
3942 | struct iio_poll_func *pf = p; |
3943 | struct iio_dev *indio_dev = pf->indio_dev; |
3944 | struct ads124s_private *priv = iio_priv(indio_dev); |
3945 | - u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; |
3946 | int scan_index, j = 0; |
3947 | int ret; |
3948 | |
3949 | @@ -285,7 +292,7 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p) |
3950 | if (ret) |
3951 | dev_err(&priv->spi->dev, "Start ADC conversions failed\n"); |
3952 | |
3953 | - buffer[j] = ads124s_read(indio_dev, scan_index); |
3954 | + priv->buffer[j] = ads124s_read(indio_dev, scan_index); |
3955 | ret = ads124s_write_cmd(indio_dev, ADS124S08_STOP_CONV); |
3956 | if (ret) |
3957 | dev_err(&priv->spi->dev, "Stop ADC conversions failed\n"); |
3958 | @@ -293,7 +300,7 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p) |
3959 | j++; |
3960 | } |
3961 | |
3962 | - iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
3963 | + iio_push_to_buffers_with_timestamp(indio_dev, priv->buffer, |
3964 | pf->timestamp); |
3965 | |
3966 | iio_trigger_notify_done(indio_dev->trig); |
3967 | diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c |
3968 | index 6af65d6f1d280..a5994899e3965 100644 |
3969 | --- a/drivers/iio/imu/bmi160/bmi160_core.c |
3970 | +++ b/drivers/iio/imu/bmi160/bmi160_core.c |
3971 | @@ -411,8 +411,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) |
3972 | struct iio_poll_func *pf = p; |
3973 | struct iio_dev *indio_dev = pf->indio_dev; |
3974 | struct bmi160_data *data = iio_priv(indio_dev); |
3975 | - __le16 buf[16]; |
3976 | - /* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */ |
3977 | + __le16 buf[12]; |
3978 | + /* 2 sens x 3 axis x __le16 + 2 x __le16 pad + 4 x __le16 tstamp */ |
3979 | int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L; |
3980 | __le16 sample; |
3981 | |
3982 | diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c |
3983 | index 112225c0e4868..e099517283bef 100644 |
3984 | --- a/drivers/iio/industrialio-buffer.c |
3985 | +++ b/drivers/iio/industrialio-buffer.c |
3986 | @@ -845,12 +845,12 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev, |
3987 | indio_dev->masklength, |
3988 | in_ind + 1); |
3989 | while (in_ind != out_ind) { |
3990 | - in_ind = find_next_bit(indio_dev->active_scan_mask, |
3991 | - indio_dev->masklength, |
3992 | - in_ind + 1); |
3993 | length = iio_storage_bytes_for_si(indio_dev, in_ind); |
3994 | /* Make sure we are aligned */ |
3995 | in_loc = roundup(in_loc, length) + length; |
3996 | + in_ind = find_next_bit(indio_dev->active_scan_mask, |
3997 | + indio_dev->masklength, |
3998 | + in_ind + 1); |
3999 | } |
4000 | length = iio_storage_bytes_for_si(indio_dev, in_ind); |
4001 | out_loc = roundup(out_loc, length); |
4002 | diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c |
4003 | index a0a7aeae5a822..254c5b0199d4c 100644 |
4004 | --- a/drivers/iio/light/rpr0521.c |
4005 | +++ b/drivers/iio/light/rpr0521.c |
4006 | @@ -194,6 +194,17 @@ struct rpr0521_data { |
4007 | bool pxs_need_dis; |
4008 | |
4009 | struct regmap *regmap; |
4010 | + |
4011 | + /* |
4012 | + * Ensure correct naturally aligned timestamp. |
4013 | + * Note that the read will put garbage data into |
4014 | + * the padding but this should not be a problem |
4015 | + */ |
4016 | + struct { |
4017 | + __le16 channels[3]; |
4018 | + u8 garbage; |
4019 | + s64 ts __aligned(8); |
4020 | + } scan; |
4021 | }; |
4022 | |
4023 | static IIO_CONST_ATTR(in_intensity_scale_available, RPR0521_ALS_SCALE_AVAIL); |
4024 | @@ -449,8 +460,6 @@ static irqreturn_t rpr0521_trigger_consumer_handler(int irq, void *p) |
4025 | struct rpr0521_data *data = iio_priv(indio_dev); |
4026 | int err; |
4027 | |
4028 | - u8 buffer[16]; /* 3 16-bit channels + padding + ts */ |
4029 | - |
4030 | /* Use irq timestamp when reasonable. */ |
4031 | if (iio_trigger_using_own(indio_dev) && data->irq_timestamp) { |
4032 | pf->timestamp = data->irq_timestamp; |
4033 | @@ -461,11 +470,11 @@ static irqreturn_t rpr0521_trigger_consumer_handler(int irq, void *p) |
4034 | pf->timestamp = iio_get_time_ns(indio_dev); |
4035 | |
4036 | err = regmap_bulk_read(data->regmap, RPR0521_REG_PXS_DATA, |
4037 | - &buffer, |
4038 | + data->scan.channels, |
4039 | (3 * 2) + 1); /* 3 * 16-bit + (discarded) int clear reg. */ |
4040 | if (!err) |
4041 | iio_push_to_buffers_with_timestamp(indio_dev, |
4042 | - buffer, pf->timestamp); |
4043 | + &data->scan, pf->timestamp); |
4044 | else |
4045 | dev_err(&data->client->dev, |
4046 | "Trigger consumer can't read from sensor.\n"); |
4047 | diff --git a/drivers/iio/light/st_uvis25.h b/drivers/iio/light/st_uvis25.h |
4048 | index 78bc56aad1299..283086887caf5 100644 |
4049 | --- a/drivers/iio/light/st_uvis25.h |
4050 | +++ b/drivers/iio/light/st_uvis25.h |
4051 | @@ -27,6 +27,11 @@ struct st_uvis25_hw { |
4052 | struct iio_trigger *trig; |
4053 | bool enabled; |
4054 | int irq; |
4055 | + /* Ensure timestamp is naturally aligned */ |
4056 | + struct { |
4057 | + u8 chan; |
4058 | + s64 ts __aligned(8); |
4059 | + } scan; |
4060 | }; |
4061 | |
4062 | extern const struct dev_pm_ops st_uvis25_pm_ops; |
4063 | diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c |
4064 | index d262c254b895a..9aaff35f49b0f 100644 |
4065 | --- a/drivers/iio/light/st_uvis25_core.c |
4066 | +++ b/drivers/iio/light/st_uvis25_core.c |
4067 | @@ -234,17 +234,19 @@ static const struct iio_buffer_setup_ops st_uvis25_buffer_ops = { |
4068 | |
4069 | static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p) |
4070 | { |
4071 | - u8 buffer[ALIGN(sizeof(u8), sizeof(s64)) + sizeof(s64)]; |
4072 | struct iio_poll_func *pf = p; |
4073 | struct iio_dev *iio_dev = pf->indio_dev; |
4074 | struct st_uvis25_hw *hw = iio_priv(iio_dev); |
4075 | + unsigned int val; |
4076 | int err; |
4077 | |
4078 | - err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR, (int *)buffer); |
4079 | + err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR, &val); |
4080 | if (err < 0) |
4081 | goto out; |
4082 | |
4083 | - iio_push_to_buffers_with_timestamp(iio_dev, buffer, |
4084 | + hw->scan.chan = val; |
4085 | + |
4086 | + iio_push_to_buffers_with_timestamp(iio_dev, &hw->scan, |
4087 | iio_get_time_ns(iio_dev)); |
4088 | |
4089 | out: |
4090 | diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c |
4091 | index fb16cfdd6fa66..b7b98dd4d2cbf 100644 |
4092 | --- a/drivers/iio/magnetometer/mag3110.c |
4093 | +++ b/drivers/iio/magnetometer/mag3110.c |
4094 | @@ -56,6 +56,12 @@ struct mag3110_data { |
4095 | int sleep_val; |
4096 | struct regulator *vdd_reg; |
4097 | struct regulator *vddio_reg; |
4098 | + /* Ensure natural alignment of timestamp */ |
4099 | + struct { |
4100 | + __be16 channels[3]; |
4101 | + u8 temperature; |
4102 | + s64 ts __aligned(8); |
4103 | + } scan; |
4104 | }; |
4105 | |
4106 | static int mag3110_request(struct mag3110_data *data) |
4107 | @@ -387,10 +393,9 @@ static irqreturn_t mag3110_trigger_handler(int irq, void *p) |
4108 | struct iio_poll_func *pf = p; |
4109 | struct iio_dev *indio_dev = pf->indio_dev; |
4110 | struct mag3110_data *data = iio_priv(indio_dev); |
4111 | - u8 buffer[16]; /* 3 16-bit channels + 1 byte temp + padding + ts */ |
4112 | int ret; |
4113 | |
4114 | - ret = mag3110_read(data, (__be16 *) buffer); |
4115 | + ret = mag3110_read(data, data->scan.channels); |
4116 | if (ret < 0) |
4117 | goto done; |
4118 | |
4119 | @@ -399,10 +404,10 @@ static irqreturn_t mag3110_trigger_handler(int irq, void *p) |
4120 | MAG3110_DIE_TEMP); |
4121 | if (ret < 0) |
4122 | goto done; |
4123 | - buffer[6] = ret; |
4124 | + data->scan.temperature = ret; |
4125 | } |
4126 | |
4127 | - iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
4128 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
4129 | iio_get_time_ns(indio_dev)); |
4130 | |
4131 | done: |
4132 | diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c |
4133 | index d066f3c5a8a61..822b9e19688ef 100644 |
4134 | --- a/drivers/iio/pressure/mpl3115.c |
4135 | +++ b/drivers/iio/pressure/mpl3115.c |
4136 | @@ -144,7 +144,14 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p) |
4137 | struct iio_poll_func *pf = p; |
4138 | struct iio_dev *indio_dev = pf->indio_dev; |
4139 | struct mpl3115_data *data = iio_priv(indio_dev); |
4140 | - u8 buffer[16]; /* 32-bit channel + 16-bit channel + padding + ts */ |
4141 | + /* |
4142 | + * 32-bit channel + 16-bit channel + padding + ts |
4143 | + * Note that it is possible for only one of the first 2 |
4144 | + * channels to be enabled. If that happens, the first element |
4145 | + * of the buffer may be either 16 or 32-bits. As such we cannot |
4146 | + * use a simple structure definition to express this data layout. |
4147 | + */ |
4148 | + u8 buffer[16] __aligned(8); |
4149 | int ret, pos = 0; |
4150 | |
4151 | mutex_lock(&data->lock); |
4152 | diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c |
4153 | index a5e670726717f..58c1c30d5612b 100644 |
4154 | --- a/drivers/iio/trigger/iio-trig-hrtimer.c |
4155 | +++ b/drivers/iio/trigger/iio-trig-hrtimer.c |
4156 | @@ -102,7 +102,7 @@ static int iio_trig_hrtimer_set_state(struct iio_trigger *trig, bool state) |
4157 | |
4158 | if (state) |
4159 | hrtimer_start(&trig_info->timer, trig_info->period, |
4160 | - HRTIMER_MODE_REL); |
4161 | + HRTIMER_MODE_REL_HARD); |
4162 | else |
4163 | hrtimer_cancel(&trig_info->timer); |
4164 | |
4165 | @@ -132,7 +132,7 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name) |
4166 | trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops; |
4167 | trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups; |
4168 | |
4169 | - hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
4170 | + hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); |
4171 | trig_info->timer.function = iio_hrtimer_trig_handler; |
4172 | |
4173 | trig_info->sampling_frequency = HRTIMER_DEFAULT_SAMPLING_FREQUENCY; |
4174 | diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c |
4175 | index c1d6a068f50fe..fd7c84721b0de 100644 |
4176 | --- a/drivers/infiniband/core/cm.c |
4177 | +++ b/drivers/infiniband/core/cm.c |
4178 | @@ -1435,6 +1435,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id, |
4179 | id.local_id); |
4180 | if (IS_ERR(cm_id_priv->timewait_info)) { |
4181 | ret = PTR_ERR(cm_id_priv->timewait_info); |
4182 | + cm_id_priv->timewait_info = NULL; |
4183 | goto out; |
4184 | } |
4185 | |
4186 | @@ -1961,6 +1962,7 @@ static int cm_req_handler(struct cm_work *work) |
4187 | id.local_id); |
4188 | if (IS_ERR(cm_id_priv->timewait_info)) { |
4189 | ret = PTR_ERR(cm_id_priv->timewait_info); |
4190 | + cm_id_priv->timewait_info = NULL; |
4191 | goto destroy; |
4192 | } |
4193 | cm_id_priv->timewait_info->work.remote_id = req_msg->local_comm_id; |
4194 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
4195 | index 98d2d74b96f78..ecac62a7b59e8 100644 |
4196 | --- a/drivers/infiniband/core/cma.c |
4197 | +++ b/drivers/infiniband/core/cma.c |
4198 | @@ -530,6 +530,10 @@ static void cma_release_dev(struct rdma_id_private *id_priv) |
4199 | list_del(&id_priv->list); |
4200 | cma_deref_dev(id_priv->cma_dev); |
4201 | id_priv->cma_dev = NULL; |
4202 | + if (id_priv->id.route.addr.dev_addr.sgid_attr) { |
4203 | + rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr); |
4204 | + id_priv->id.route.addr.dev_addr.sgid_attr = NULL; |
4205 | + } |
4206 | mutex_unlock(&lock); |
4207 | } |
4208 | |
4209 | @@ -1879,9 +1883,6 @@ void rdma_destroy_id(struct rdma_cm_id *id) |
4210 | |
4211 | kfree(id_priv->id.route.path_rec); |
4212 | |
4213 | - if (id_priv->id.route.addr.dev_addr.sgid_attr) |
4214 | - rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr); |
4215 | - |
4216 | put_net(id_priv->id.route.addr.dev_addr.net); |
4217 | kfree(id_priv); |
4218 | } |
4219 | diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
4220 | index 59dc9f3cfb376..256d379bba676 100644 |
4221 | --- a/drivers/infiniband/core/device.c |
4222 | +++ b/drivers/infiniband/core/device.c |
4223 | @@ -1387,9 +1387,6 @@ int ib_register_device(struct ib_device *device, const char *name) |
4224 | } |
4225 | |
4226 | ret = enable_device_and_get(device); |
4227 | - dev_set_uevent_suppress(&device->dev, false); |
4228 | - /* Mark for userspace that device is ready */ |
4229 | - kobject_uevent(&device->dev.kobj, KOBJ_ADD); |
4230 | if (ret) { |
4231 | void (*dealloc_fn)(struct ib_device *); |
4232 | |
4233 | @@ -1409,8 +1406,12 @@ int ib_register_device(struct ib_device *device, const char *name) |
4234 | ib_device_put(device); |
4235 | __ib_unregister_device(device); |
4236 | device->ops.dealloc_driver = dealloc_fn; |
4237 | + dev_set_uevent_suppress(&device->dev, false); |
4238 | return ret; |
4239 | } |
4240 | + dev_set_uevent_suppress(&device->dev, false); |
4241 | + /* Mark for userspace that device is ready */ |
4242 | + kobject_uevent(&device->dev.kobj, KOBJ_ADD); |
4243 | ib_device_put(device); |
4244 | |
4245 | return 0; |
4246 | diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
4247 | index 3b05c0640338f..58c021648b7c8 100644 |
4248 | --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
4249 | +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
4250 | @@ -1793,6 +1793,7 @@ int bnxt_re_query_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, |
4251 | goto out; |
4252 | } |
4253 | qp_attr->qp_state = __to_ib_qp_state(qplib_qp->state); |
4254 | + qp_attr->cur_qp_state = __to_ib_qp_state(qplib_qp->cur_qp_state); |
4255 | qp_attr->en_sqd_async_notify = qplib_qp->en_sqd_async_notify ? 1 : 0; |
4256 | qp_attr->qp_access_flags = __to_ib_access_flags(qplib_qp->access); |
4257 | qp_attr->pkey_index = qplib_qp->pkey_index; |
4258 | diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c |
4259 | index b1bb61c65f4f6..16b74591a68db 100644 |
4260 | --- a/drivers/infiniband/hw/cxgb4/cq.c |
4261 | +++ b/drivers/infiniband/hw/cxgb4/cq.c |
4262 | @@ -1007,6 +1007,9 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, |
4263 | if (attr->flags) |
4264 | return -EINVAL; |
4265 | |
4266 | + if (entries < 1 || entries > ibdev->attrs.max_cqe) |
4267 | + return -EINVAL; |
4268 | + |
4269 | if (vector >= rhp->rdev.lldi.nciq) |
4270 | return -EINVAL; |
4271 | |
4272 | diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c |
4273 | index 119b2573c9a08..26c3408dcacae 100644 |
4274 | --- a/drivers/infiniband/hw/mthca/mthca_cq.c |
4275 | +++ b/drivers/infiniband/hw/mthca/mthca_cq.c |
4276 | @@ -604,7 +604,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev, |
4277 | entry->byte_len = MTHCA_ATOMIC_BYTE_LEN; |
4278 | break; |
4279 | default: |
4280 | - entry->opcode = MTHCA_OPCODE_INVALID; |
4281 | + entry->opcode = 0xFF; |
4282 | break; |
4283 | } |
4284 | } else { |
4285 | diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h |
4286 | index bfd4eebc1182f..58d46449b0e86 100644 |
4287 | --- a/drivers/infiniband/hw/mthca/mthca_dev.h |
4288 | +++ b/drivers/infiniband/hw/mthca/mthca_dev.h |
4289 | @@ -105,7 +105,6 @@ enum { |
4290 | MTHCA_OPCODE_ATOMIC_CS = 0x11, |
4291 | MTHCA_OPCODE_ATOMIC_FA = 0x12, |
4292 | MTHCA_OPCODE_BIND_MW = 0x18, |
4293 | - MTHCA_OPCODE_INVALID = 0xff |
4294 | }; |
4295 | |
4296 | enum { |
4297 | diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c |
4298 | index e5031172c0193..a4d6e0b7901e9 100644 |
4299 | --- a/drivers/infiniband/sw/rxe/rxe_req.c |
4300 | +++ b/drivers/infiniband/sw/rxe/rxe_req.c |
4301 | @@ -664,7 +664,8 @@ next_wqe: |
4302 | } |
4303 | |
4304 | if (unlikely(qp_type(qp) == IB_QPT_RC && |
4305 | - qp->req.psn > (qp->comp.psn + RXE_MAX_UNACKED_PSNS))) { |
4306 | + psn_compare(qp->req.psn, (qp->comp.psn + |
4307 | + RXE_MAX_UNACKED_PSNS)) > 0)) { |
4308 | qp->req.wait_psn = 1; |
4309 | goto exit; |
4310 | } |
4311 | diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c |
4312 | index 8d4d9786cc745..cae262b6ff398 100644 |
4313 | --- a/drivers/input/keyboard/cros_ec_keyb.c |
4314 | +++ b/drivers/input/keyboard/cros_ec_keyb.c |
4315 | @@ -183,6 +183,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev, |
4316 | "changed: [r%d c%d]: byte %02x\n", |
4317 | row, col, new_state); |
4318 | |
4319 | + input_event(idev, EV_MSC, MSC_SCAN, pos); |
4320 | input_report_key(idev, keycodes[pos], |
4321 | new_state); |
4322 | } |
4323 | diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c |
4324 | index d6c924032aaa8..dd16f7b3c7ef6 100644 |
4325 | --- a/drivers/input/keyboard/omap4-keypad.c |
4326 | +++ b/drivers/input/keyboard/omap4-keypad.c |
4327 | @@ -186,12 +186,8 @@ static int omap4_keypad_open(struct input_dev *input) |
4328 | return 0; |
4329 | } |
4330 | |
4331 | -static void omap4_keypad_close(struct input_dev *input) |
4332 | +static void omap4_keypad_stop(struct omap4_keypad *keypad_data) |
4333 | { |
4334 | - struct omap4_keypad *keypad_data = input_get_drvdata(input); |
4335 | - |
4336 | - disable_irq(keypad_data->irq); |
4337 | - |
4338 | /* Disable interrupts and wake-up events */ |
4339 | kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, |
4340 | OMAP4_VAL_IRQDISABLE); |
4341 | @@ -200,7 +196,15 @@ static void omap4_keypad_close(struct input_dev *input) |
4342 | /* clear pending interrupts */ |
4343 | kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, |
4344 | kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); |
4345 | +} |
4346 | + |
4347 | +static void omap4_keypad_close(struct input_dev *input) |
4348 | +{ |
4349 | + struct omap4_keypad *keypad_data; |
4350 | |
4351 | + keypad_data = input_get_drvdata(input); |
4352 | + disable_irq(keypad_data->irq); |
4353 | + omap4_keypad_stop(keypad_data); |
4354 | enable_irq(keypad_data->irq); |
4355 | |
4356 | pm_runtime_put_sync(input->dev.parent); |
4357 | @@ -223,13 +227,37 @@ static int omap4_keypad_parse_dt(struct device *dev, |
4358 | return 0; |
4359 | } |
4360 | |
4361 | +static int omap4_keypad_check_revision(struct device *dev, |
4362 | + struct omap4_keypad *keypad_data) |
4363 | +{ |
4364 | + unsigned int rev; |
4365 | + |
4366 | + rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); |
4367 | + rev &= 0x03 << 30; |
4368 | + rev >>= 30; |
4369 | + switch (rev) { |
4370 | + case KBD_REVISION_OMAP4: |
4371 | + keypad_data->reg_offset = 0x00; |
4372 | + keypad_data->irqreg_offset = 0x00; |
4373 | + break; |
4374 | + case KBD_REVISION_OMAP5: |
4375 | + keypad_data->reg_offset = 0x10; |
4376 | + keypad_data->irqreg_offset = 0x0c; |
4377 | + break; |
4378 | + default: |
4379 | + dev_err(dev, "Keypad reports unsupported revision %d", rev); |
4380 | + return -EINVAL; |
4381 | + } |
4382 | + |
4383 | + return 0; |
4384 | +} |
4385 | + |
4386 | static int omap4_keypad_probe(struct platform_device *pdev) |
4387 | { |
4388 | struct omap4_keypad *keypad_data; |
4389 | struct input_dev *input_dev; |
4390 | struct resource *res; |
4391 | unsigned int max_keys; |
4392 | - int rev; |
4393 | int irq; |
4394 | int error; |
4395 | |
4396 | @@ -269,41 +297,33 @@ static int omap4_keypad_probe(struct platform_device *pdev) |
4397 | goto err_release_mem; |
4398 | } |
4399 | |
4400 | + pm_runtime_enable(&pdev->dev); |
4401 | |
4402 | /* |
4403 | * Enable clocks for the keypad module so that we can read |
4404 | * revision register. |
4405 | */ |
4406 | - pm_runtime_enable(&pdev->dev); |
4407 | error = pm_runtime_get_sync(&pdev->dev); |
4408 | if (error) { |
4409 | dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n"); |
4410 | - goto err_unmap; |
4411 | - } |
4412 | - rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); |
4413 | - rev &= 0x03 << 30; |
4414 | - rev >>= 30; |
4415 | - switch (rev) { |
4416 | - case KBD_REVISION_OMAP4: |
4417 | - keypad_data->reg_offset = 0x00; |
4418 | - keypad_data->irqreg_offset = 0x00; |
4419 | - break; |
4420 | - case KBD_REVISION_OMAP5: |
4421 | - keypad_data->reg_offset = 0x10; |
4422 | - keypad_data->irqreg_offset = 0x0c; |
4423 | - break; |
4424 | - default: |
4425 | - dev_err(&pdev->dev, |
4426 | - "Keypad reports unsupported revision %d", rev); |
4427 | - error = -EINVAL; |
4428 | - goto err_pm_put_sync; |
4429 | + pm_runtime_put_noidle(&pdev->dev); |
4430 | + } else { |
4431 | + error = omap4_keypad_check_revision(&pdev->dev, |
4432 | + keypad_data); |
4433 | + if (!error) { |
4434 | + /* Ensure device does not raise interrupts */ |
4435 | + omap4_keypad_stop(keypad_data); |
4436 | + } |
4437 | + pm_runtime_put_sync(&pdev->dev); |
4438 | } |
4439 | + if (error) |
4440 | + goto err_pm_disable; |
4441 | |
4442 | /* input device allocation */ |
4443 | keypad_data->input = input_dev = input_allocate_device(); |
4444 | if (!input_dev) { |
4445 | error = -ENOMEM; |
4446 | - goto err_pm_put_sync; |
4447 | + goto err_pm_disable; |
4448 | } |
4449 | |
4450 | input_dev->name = pdev->name; |
4451 | @@ -349,28 +369,25 @@ static int omap4_keypad_probe(struct platform_device *pdev) |
4452 | goto err_free_keymap; |
4453 | } |
4454 | |
4455 | - device_init_wakeup(&pdev->dev, true); |
4456 | - pm_runtime_put_sync(&pdev->dev); |
4457 | - |
4458 | error = input_register_device(keypad_data->input); |
4459 | if (error < 0) { |
4460 | dev_err(&pdev->dev, "failed to register input device\n"); |
4461 | - goto err_pm_disable; |
4462 | + goto err_free_irq; |
4463 | } |
4464 | |
4465 | + device_init_wakeup(&pdev->dev, true); |
4466 | platform_set_drvdata(pdev, keypad_data); |
4467 | + |
4468 | return 0; |
4469 | |
4470 | -err_pm_disable: |
4471 | - pm_runtime_disable(&pdev->dev); |
4472 | +err_free_irq: |
4473 | free_irq(keypad_data->irq, keypad_data); |
4474 | err_free_keymap: |
4475 | kfree(keypad_data->keymap); |
4476 | err_free_input: |
4477 | input_free_device(input_dev); |
4478 | -err_pm_put_sync: |
4479 | - pm_runtime_put_sync(&pdev->dev); |
4480 | -err_unmap: |
4481 | +err_pm_disable: |
4482 | + pm_runtime_disable(&pdev->dev); |
4483 | iounmap(keypad_data->base); |
4484 | err_release_mem: |
4485 | release_mem_region(res->start, resource_size(res)); |
4486 | diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c |
4487 | index c1b524ab46232..ba50f57134239 100644 |
4488 | --- a/drivers/input/mouse/cyapa_gen6.c |
4489 | +++ b/drivers/input/mouse/cyapa_gen6.c |
4490 | @@ -573,7 +573,7 @@ static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa, |
4491 | |
4492 | memset(&cmd, 0, sizeof(cmd)); |
4493 | put_unaligned_le16(PIP_OUTPUT_REPORT_ADDR, &cmd.head.addr); |
4494 | - put_unaligned_le16(sizeof(cmd), &cmd.head.length - 2); |
4495 | + put_unaligned_le16(sizeof(cmd) - 2, &cmd.head.length); |
4496 | cmd.head.report_id = PIP_APP_CMD_REPORT_ID; |
4497 | cmd.head.cmd_code = PIP_RETRIEVE_DATA_STRUCTURE; |
4498 | put_unaligned_le16(read_offset, &cmd.read_offset); |
4499 | diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c |
4500 | index 51ddb204ca1ba..d247d0ae82d26 100644 |
4501 | --- a/drivers/input/touchscreen/ads7846.c |
4502 | +++ b/drivers/input/touchscreen/ads7846.c |
4503 | @@ -33,6 +33,7 @@ |
4504 | #include <linux/regulator/consumer.h> |
4505 | #include <linux/module.h> |
4506 | #include <asm/irq.h> |
4507 | +#include <asm/unaligned.h> |
4508 | |
4509 | /* |
4510 | * This code has been heavily tested on a Nokia 770, and lightly |
4511 | @@ -199,6 +200,26 @@ struct ads7846 { |
4512 | #define REF_ON (READ_12BIT_DFR(x, 1, 1)) |
4513 | #define REF_OFF (READ_12BIT_DFR(y, 0, 0)) |
4514 | |
4515 | +static int get_pendown_state(struct ads7846 *ts) |
4516 | +{ |
4517 | + if (ts->get_pendown_state) |
4518 | + return ts->get_pendown_state(); |
4519 | + |
4520 | + return !gpio_get_value(ts->gpio_pendown); |
4521 | +} |
4522 | + |
4523 | +static void ads7846_report_pen_up(struct ads7846 *ts) |
4524 | +{ |
4525 | + struct input_dev *input = ts->input; |
4526 | + |
4527 | + input_report_key(input, BTN_TOUCH, 0); |
4528 | + input_report_abs(input, ABS_PRESSURE, 0); |
4529 | + input_sync(input); |
4530 | + |
4531 | + ts->pendown = false; |
4532 | + dev_vdbg(&ts->spi->dev, "UP\n"); |
4533 | +} |
4534 | + |
4535 | /* Must be called with ts->lock held */ |
4536 | static void ads7846_stop(struct ads7846 *ts) |
4537 | { |
4538 | @@ -215,6 +236,10 @@ static void ads7846_stop(struct ads7846 *ts) |
4539 | static void ads7846_restart(struct ads7846 *ts) |
4540 | { |
4541 | if (!ts->disabled && !ts->suspended) { |
4542 | + /* Check if pen was released since last stop */ |
4543 | + if (ts->pendown && !get_pendown_state(ts)) |
4544 | + ads7846_report_pen_up(ts); |
4545 | + |
4546 | /* Tell IRQ thread that it may poll the device. */ |
4547 | ts->stopped = false; |
4548 | mb(); |
4549 | @@ -410,7 +435,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command) |
4550 | |
4551 | if (status == 0) { |
4552 | /* BE12 value, then padding */ |
4553 | - status = be16_to_cpu(*((u16 *)&req->sample[1])); |
4554 | + status = get_unaligned_be16(&req->sample[1]); |
4555 | status = status >> 3; |
4556 | status &= 0x0fff; |
4557 | } |
4558 | @@ -605,14 +630,6 @@ static const struct attribute_group ads784x_attr_group = { |
4559 | |
4560 | /*--------------------------------------------------------------------------*/ |
4561 | |
4562 | -static int get_pendown_state(struct ads7846 *ts) |
4563 | -{ |
4564 | - if (ts->get_pendown_state) |
4565 | - return ts->get_pendown_state(); |
4566 | - |
4567 | - return !gpio_get_value(ts->gpio_pendown); |
4568 | -} |
4569 | - |
4570 | static void null_wait_for_sync(void) |
4571 | { |
4572 | } |
4573 | @@ -785,10 +802,11 @@ static void ads7846_report_state(struct ads7846 *ts) |
4574 | /* compute touch pressure resistance using equation #2 */ |
4575 | Rt = z2; |
4576 | Rt -= z1; |
4577 | - Rt *= x; |
4578 | Rt *= ts->x_plate_ohms; |
4579 | + Rt = DIV_ROUND_CLOSEST(Rt, 16); |
4580 | + Rt *= x; |
4581 | Rt /= z1; |
4582 | - Rt = (Rt + 2047) >> 12; |
4583 | + Rt = DIV_ROUND_CLOSEST(Rt, 256); |
4584 | } else { |
4585 | Rt = 0; |
4586 | } |
4587 | @@ -867,16 +885,8 @@ static irqreturn_t ads7846_irq(int irq, void *handle) |
4588 | msecs_to_jiffies(TS_POLL_PERIOD)); |
4589 | } |
4590 | |
4591 | - if (ts->pendown && !ts->stopped) { |
4592 | - struct input_dev *input = ts->input; |
4593 | - |
4594 | - input_report_key(input, BTN_TOUCH, 0); |
4595 | - input_report_abs(input, ABS_PRESSURE, 0); |
4596 | - input_sync(input); |
4597 | - |
4598 | - ts->pendown = false; |
4599 | - dev_vdbg(&ts->spi->dev, "UP\n"); |
4600 | - } |
4601 | + if (ts->pendown && !ts->stopped) |
4602 | + ads7846_report_pen_up(ts); |
4603 | |
4604 | return IRQ_HANDLED; |
4605 | } |
4606 | diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c |
4607 | index 37b35ab97beb2..bfb945fc33a17 100644 |
4608 | --- a/drivers/input/touchscreen/goodix.c |
4609 | +++ b/drivers/input/touchscreen/goodix.c |
4610 | @@ -137,6 +137,18 @@ static const struct dmi_system_id rotated_screen[] = { |
4611 | DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"), |
4612 | }, |
4613 | }, |
4614 | + { |
4615 | + .ident = "Teclast X98 Pro", |
4616 | + .matches = { |
4617 | + /* |
4618 | + * Only match BIOS date, because the manufacturers |
4619 | + * BIOS does not report the board name at all |
4620 | + * (sometimes)... |
4621 | + */ |
4622 | + DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"), |
4623 | + DMI_MATCH(DMI_BIOS_DATE, "10/28/2015"), |
4624 | + }, |
4625 | + }, |
4626 | { |
4627 | .ident = "WinBook TW100", |
4628 | .matches = { |
4629 | diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c |
4630 | index 23a3b877f7f1d..ede02dc2bcd0b 100644 |
4631 | --- a/drivers/irqchip/irq-alpine-msi.c |
4632 | +++ b/drivers/irqchip/irq-alpine-msi.c |
4633 | @@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, |
4634 | return 0; |
4635 | |
4636 | err_sgi: |
4637 | - while (--i >= 0) |
4638 | - irq_domain_free_irqs_parent(domain, virq, i); |
4639 | + irq_domain_free_irqs_parent(domain, virq, i - 1); |
4640 | alpine_msix_free_sgi(priv, sgi, nr_irqs); |
4641 | return err; |
4642 | } |
4643 | diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c |
4644 | index ac83f5002ce5f..1c5133f71af39 100644 |
4645 | --- a/drivers/md/dm-ioctl.c |
4646 | +++ b/drivers/md/dm-ioctl.c |
4647 | @@ -1600,6 +1600,7 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para |
4648 | |
4649 | if (!argc) { |
4650 | DMWARN("Empty message received."); |
4651 | + r = -EINVAL; |
4652 | goto out_argv; |
4653 | } |
4654 | |
4655 | diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c |
4656 | index 13ad791126618..6dd56afa048c2 100644 |
4657 | --- a/drivers/md/dm-table.c |
4658 | +++ b/drivers/md/dm-table.c |
4659 | @@ -1320,12 +1320,6 @@ void dm_table_event_callback(struct dm_table *t, |
4660 | |
4661 | void dm_table_event(struct dm_table *t) |
4662 | { |
4663 | - /* |
4664 | - * You can no longer call dm_table_event() from interrupt |
4665 | - * context, use a bottom half instead. |
4666 | - */ |
4667 | - BUG_ON(in_interrupt()); |
4668 | - |
4669 | mutex_lock(&_event_lock); |
4670 | if (t->event_fn) |
4671 | t->event_fn(t->event_context); |
4672 | diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c |
4673 | index afbbc552c3275..794e1d5891046 100644 |
4674 | --- a/drivers/md/md-cluster.c |
4675 | +++ b/drivers/md/md-cluster.c |
4676 | @@ -664,9 +664,27 @@ out: |
4677 | * Takes the lock on the TOKEN lock resource so no other |
4678 | * node can communicate while the operation is underway. |
4679 | */ |
4680 | -static int lock_token(struct md_cluster_info *cinfo, bool mddev_locked) |
4681 | +static int lock_token(struct md_cluster_info *cinfo) |
4682 | { |
4683 | - int error, set_bit = 0; |
4684 | + int error; |
4685 | + |
4686 | + error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX); |
4687 | + if (error) { |
4688 | + pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n", |
4689 | + __func__, __LINE__, error); |
4690 | + } else { |
4691 | + /* Lock the receive sequence */ |
4692 | + mutex_lock(&cinfo->recv_mutex); |
4693 | + } |
4694 | + return error; |
4695 | +} |
4696 | + |
4697 | +/* lock_comm() |
4698 | + * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel. |
4699 | + */ |
4700 | +static int lock_comm(struct md_cluster_info *cinfo, bool mddev_locked) |
4701 | +{ |
4702 | + int rv, set_bit = 0; |
4703 | struct mddev *mddev = cinfo->mddev; |
4704 | |
4705 | /* |
4706 | @@ -677,34 +695,19 @@ static int lock_token(struct md_cluster_info *cinfo, bool mddev_locked) |
4707 | */ |
4708 | if (mddev_locked && !test_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, |
4709 | &cinfo->state)) { |
4710 | - error = test_and_set_bit_lock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, |
4711 | + rv = test_and_set_bit_lock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, |
4712 | &cinfo->state); |
4713 | - WARN_ON_ONCE(error); |
4714 | + WARN_ON_ONCE(rv); |
4715 | md_wakeup_thread(mddev->thread); |
4716 | set_bit = 1; |
4717 | } |
4718 | - error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX); |
4719 | - if (set_bit) |
4720 | - clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); |
4721 | |
4722 | - if (error) |
4723 | - pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n", |
4724 | - __func__, __LINE__, error); |
4725 | - |
4726 | - /* Lock the receive sequence */ |
4727 | - mutex_lock(&cinfo->recv_mutex); |
4728 | - return error; |
4729 | -} |
4730 | - |
4731 | -/* lock_comm() |
4732 | - * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel. |
4733 | - */ |
4734 | -static int lock_comm(struct md_cluster_info *cinfo, bool mddev_locked) |
4735 | -{ |
4736 | wait_event(cinfo->wait, |
4737 | !test_and_set_bit(MD_CLUSTER_SEND_LOCK, &cinfo->state)); |
4738 | - |
4739 | - return lock_token(cinfo, mddev_locked); |
4740 | + rv = lock_token(cinfo); |
4741 | + if (set_bit) |
4742 | + clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); |
4743 | + return rv; |
4744 | } |
4745 | |
4746 | static void unlock_comm(struct md_cluster_info *cinfo) |
4747 | @@ -784,9 +787,11 @@ static int sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg, |
4748 | { |
4749 | int ret; |
4750 | |
4751 | - lock_comm(cinfo, mddev_locked); |
4752 | - ret = __sendmsg(cinfo, cmsg); |
4753 | - unlock_comm(cinfo); |
4754 | + ret = lock_comm(cinfo, mddev_locked); |
4755 | + if (!ret) { |
4756 | + ret = __sendmsg(cinfo, cmsg); |
4757 | + unlock_comm(cinfo); |
4758 | + } |
4759 | return ret; |
4760 | } |
4761 | |
4762 | @@ -1061,7 +1066,7 @@ static int metadata_update_start(struct mddev *mddev) |
4763 | return 0; |
4764 | } |
4765 | |
4766 | - ret = lock_token(cinfo, 1); |
4767 | + ret = lock_token(cinfo); |
4768 | clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); |
4769 | return ret; |
4770 | } |
4771 | @@ -1255,7 +1260,10 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors) |
4772 | int raid_slot = -1; |
4773 | |
4774 | md_update_sb(mddev, 1); |
4775 | - lock_comm(cinfo, 1); |
4776 | + if (lock_comm(cinfo, 1)) { |
4777 | + pr_err("%s: lock_comm failed\n", __func__); |
4778 | + return; |
4779 | + } |
4780 | |
4781 | memset(&cmsg, 0, sizeof(cmsg)); |
4782 | cmsg.type = cpu_to_le32(METADATA_UPDATED); |
4783 | @@ -1407,7 +1415,8 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev) |
4784 | cmsg.type = cpu_to_le32(NEWDISK); |
4785 | memcpy(cmsg.uuid, uuid, 16); |
4786 | cmsg.raid_slot = cpu_to_le32(rdev->desc_nr); |
4787 | - lock_comm(cinfo, 1); |
4788 | + if (lock_comm(cinfo, 1)) |
4789 | + return -EAGAIN; |
4790 | ret = __sendmsg(cinfo, &cmsg); |
4791 | if (ret) { |
4792 | unlock_comm(cinfo); |
4793 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
4794 | index acef01e519d06..ec5dfb7ae4e16 100644 |
4795 | --- a/drivers/md/md.c |
4796 | +++ b/drivers/md/md.c |
4797 | @@ -6721,8 +6721,10 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev) |
4798 | goto busy; |
4799 | |
4800 | kick_rdev: |
4801 | - if (mddev_is_clustered(mddev)) |
4802 | - md_cluster_ops->remove_disk(mddev, rdev); |
4803 | + if (mddev_is_clustered(mddev)) { |
4804 | + if (md_cluster_ops->remove_disk(mddev, rdev)) |
4805 | + goto busy; |
4806 | + } |
4807 | |
4808 | md_kick_rdev_from_array(rdev); |
4809 | set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags); |
4810 | @@ -7052,6 +7054,7 @@ static int update_raid_disks(struct mddev *mddev, int raid_disks) |
4811 | return -EINVAL; |
4812 | if (mddev->sync_thread || |
4813 | test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || |
4814 | + test_bit(MD_RESYNCING_REMOTE, &mddev->recovery) || |
4815 | mddev->reshape_position != MaxSector) |
4816 | return -EBUSY; |
4817 | |
4818 | @@ -7371,8 +7374,11 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, |
4819 | err = -EBUSY; |
4820 | goto out; |
4821 | } |
4822 | - WARN_ON_ONCE(test_bit(MD_CLOSING, &mddev->flags)); |
4823 | - set_bit(MD_CLOSING, &mddev->flags); |
4824 | + if (test_and_set_bit(MD_CLOSING, &mddev->flags)) { |
4825 | + mutex_unlock(&mddev->open_mutex); |
4826 | + err = -EBUSY; |
4827 | + goto out; |
4828 | + } |
4829 | did_set_md_closing = true; |
4830 | mutex_unlock(&mddev->open_mutex); |
4831 | sync_blockdev(bdev); |
4832 | @@ -9420,8 +9426,11 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev) |
4833 | } |
4834 | } |
4835 | |
4836 | - if (mddev->raid_disks != le32_to_cpu(sb->raid_disks)) |
4837 | - update_raid_disks(mddev, le32_to_cpu(sb->raid_disks)); |
4838 | + if (mddev->raid_disks != le32_to_cpu(sb->raid_disks)) { |
4839 | + ret = update_raid_disks(mddev, le32_to_cpu(sb->raid_disks)); |
4840 | + if (ret) |
4841 | + pr_warn("md: updating array disks failed. %d\n", ret); |
4842 | + } |
4843 | |
4844 | /* |
4845 | * Since mddev->delta_disks has already updated in update_raid_disks, |
4846 | diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c |
4847 | index 88f90dfd368b1..ae17407e477a4 100644 |
4848 | --- a/drivers/media/common/siano/smsdvb-main.c |
4849 | +++ b/drivers/media/common/siano/smsdvb-main.c |
4850 | @@ -1169,12 +1169,15 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, |
4851 | rc = dvb_create_media_graph(&client->adapter, true); |
4852 | if (rc < 0) { |
4853 | pr_err("dvb_create_media_graph failed %d\n", rc); |
4854 | - goto client_error; |
4855 | + goto media_graph_error; |
4856 | } |
4857 | |
4858 | pr_info("DVB interface registered.\n"); |
4859 | return 0; |
4860 | |
4861 | +media_graph_error: |
4862 | + smsdvb_debugfs_release(client); |
4863 | + |
4864 | client_error: |
4865 | dvb_unregister_frontend(&client->frontend); |
4866 | |
4867 | diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c |
4868 | index 159a3a604f0ed..24659cb0d0833 100644 |
4869 | --- a/drivers/media/i2c/imx214.c |
4870 | +++ b/drivers/media/i2c/imx214.c |
4871 | @@ -785,7 +785,7 @@ static int imx214_s_stream(struct v4l2_subdev *subdev, int enable) |
4872 | if (ret < 0) |
4873 | goto err_rpm_put; |
4874 | } else { |
4875 | - ret = imx214_start_streaming(imx214); |
4876 | + ret = imx214_stop_streaming(imx214); |
4877 | if (ret < 0) |
4878 | goto err_rpm_put; |
4879 | pm_runtime_put(imx214->dev); |
4880 | diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c |
4881 | index 19a3ceea3bc20..a62d7e2ac3567 100644 |
4882 | --- a/drivers/media/i2c/max2175.c |
4883 | +++ b/drivers/media/i2c/max2175.c |
4884 | @@ -503,7 +503,7 @@ static void max2175_set_bbfilter(struct max2175 *ctx) |
4885 | } |
4886 | } |
4887 | |
4888 | -static bool max2175_set_csm_mode(struct max2175 *ctx, |
4889 | +static int max2175_set_csm_mode(struct max2175 *ctx, |
4890 | enum max2175_csm_mode new_mode) |
4891 | { |
4892 | int ret = max2175_poll_csm_ready(ctx); |
4893 | diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c |
4894 | index 1adfdc7ab0dbb..253f05aef3b1f 100644 |
4895 | --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c |
4896 | +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c |
4897 | @@ -799,6 +799,7 @@ static void cio2_vb2_return_all_buffers(struct cio2_queue *q, |
4898 | atomic_dec(&q->bufs_queued); |
4899 | vb2_buffer_done(&q->bufs[i]->vbb.vb2_buf, |
4900 | state); |
4901 | + q->bufs[i] = NULL; |
4902 | } |
4903 | } |
4904 | } |
4905 | @@ -1243,29 +1244,15 @@ static int cio2_subdev_get_fmt(struct v4l2_subdev *sd, |
4906 | struct v4l2_subdev_format *fmt) |
4907 | { |
4908 | struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev); |
4909 | - struct v4l2_subdev_format format; |
4910 | - int ret; |
4911 | - |
4912 | - if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { |
4913 | - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
4914 | - return 0; |
4915 | - } |
4916 | |
4917 | - if (fmt->pad == CIO2_PAD_SINK) { |
4918 | - format.which = V4L2_SUBDEV_FORMAT_ACTIVE; |
4919 | - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, |
4920 | - &format); |
4921 | + mutex_lock(&q->subdev_lock); |
4922 | |
4923 | - if (ret) |
4924 | - return ret; |
4925 | - /* update colorspace etc */ |
4926 | - q->subdev_fmt.colorspace = format.format.colorspace; |
4927 | - q->subdev_fmt.ycbcr_enc = format.format.ycbcr_enc; |
4928 | - q->subdev_fmt.quantization = format.format.quantization; |
4929 | - q->subdev_fmt.xfer_func = format.format.xfer_func; |
4930 | - } |
4931 | + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) |
4932 | + fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
4933 | + else |
4934 | + fmt->format = q->subdev_fmt; |
4935 | |
4936 | - fmt->format = q->subdev_fmt; |
4937 | + mutex_unlock(&q->subdev_lock); |
4938 | |
4939 | return 0; |
4940 | } |
4941 | @@ -1282,6 +1269,9 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd, |
4942 | struct v4l2_subdev_format *fmt) |
4943 | { |
4944 | struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev); |
4945 | + struct v4l2_mbus_framefmt *mbus; |
4946 | + u32 mbus_code = fmt->format.code; |
4947 | + unsigned int i; |
4948 | |
4949 | /* |
4950 | * Only allow setting sink pad format; |
4951 | @@ -1290,16 +1280,29 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd, |
4952 | if (fmt->pad == CIO2_PAD_SOURCE) |
4953 | return cio2_subdev_get_fmt(sd, cfg, fmt); |
4954 | |
4955 | - if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { |
4956 | - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; |
4957 | - } else { |
4958 | - /* It's the sink, allow changing frame size */ |
4959 | - q->subdev_fmt.width = fmt->format.width; |
4960 | - q->subdev_fmt.height = fmt->format.height; |
4961 | - q->subdev_fmt.code = fmt->format.code; |
4962 | - fmt->format = q->subdev_fmt; |
4963 | + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) |
4964 | + mbus = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
4965 | + else |
4966 | + mbus = &q->subdev_fmt; |
4967 | + |
4968 | + fmt->format.code = formats[0].mbus_code; |
4969 | + |
4970 | + for (i = 0; i < ARRAY_SIZE(formats); i++) { |
4971 | + if (formats[i].mbus_code == fmt->format.code) { |
4972 | + fmt->format.code = mbus_code; |
4973 | + break; |
4974 | + } |
4975 | } |
4976 | |
4977 | + fmt->format.width = min_t(u32, fmt->format.width, CIO2_IMAGE_MAX_WIDTH); |
4978 | + fmt->format.height = min_t(u32, fmt->format.height, |
4979 | + CIO2_IMAGE_MAX_LENGTH); |
4980 | + fmt->format.field = V4L2_FIELD_NONE; |
4981 | + |
4982 | + mutex_lock(&q->subdev_lock); |
4983 | + *mbus = fmt->format; |
4984 | + mutex_unlock(&q->subdev_lock); |
4985 | + |
4986 | return 0; |
4987 | } |
4988 | |
4989 | @@ -1558,6 +1561,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q) |
4990 | |
4991 | /* Initialize miscellaneous variables */ |
4992 | mutex_init(&q->lock); |
4993 | + mutex_init(&q->subdev_lock); |
4994 | |
4995 | /* Initialize formats to default values */ |
4996 | fmt = &q->subdev_fmt; |
4997 | @@ -1676,6 +1680,7 @@ fail_vdev_media_entity: |
4998 | fail_subdev_media_entity: |
4999 | cio2_fbpt_exit(q, &cio2->pci_dev->dev); |
5000 | fail_fbpt: |
5001 | + mutex_destroy(&q->subdev_lock); |
5002 | mutex_destroy(&q->lock); |
5003 | |
5004 | return r; |
5005 | @@ -1689,6 +1694,7 @@ static void cio2_queue_exit(struct cio2_device *cio2, struct cio2_queue *q) |
5006 | v4l2_device_unregister_subdev(&q->subdev); |
5007 | media_entity_cleanup(&q->subdev.entity); |
5008 | cio2_fbpt_exit(q, &cio2->pci_dev->dev); |
5009 | + mutex_destroy(&q->subdev_lock); |
5010 | mutex_destroy(&q->lock); |
5011 | } |
5012 | |
5013 | diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.h b/drivers/media/pci/intel/ipu3/ipu3-cio2.h |
5014 | index 7caab9b8c2b99..af5855662112a 100644 |
5015 | --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.h |
5016 | +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.h |
5017 | @@ -332,6 +332,7 @@ struct cio2_queue { |
5018 | |
5019 | /* Subdev, /dev/v4l-subdevX */ |
5020 | struct v4l2_subdev subdev; |
5021 | + struct mutex subdev_lock; /* Serialise acces to subdev_fmt field */ |
5022 | struct media_pad subdev_pads[CIO2_PADS]; |
5023 | struct v4l2_mbus_framefmt subdev_fmt; |
5024 | atomic_t frame_sequence; |
5025 | diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c |
5026 | index d4f12c250f91a..526042d8afae5 100644 |
5027 | --- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c |
5028 | +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c |
5029 | @@ -175,7 +175,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev) |
5030 | struct spi_master *master; |
5031 | struct netup_spi *nspi; |
5032 | |
5033 | - master = spi_alloc_master(&ndev->pci_dev->dev, |
5034 | + master = devm_spi_alloc_master(&ndev->pci_dev->dev, |
5035 | sizeof(struct netup_spi)); |
5036 | if (!master) { |
5037 | dev_err(&ndev->pci_dev->dev, |
5038 | @@ -208,6 +208,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev) |
5039 | ndev->pci_slot, |
5040 | ndev->pci_func); |
5041 | if (!spi_new_device(master, &netup_spi_board)) { |
5042 | + spi_unregister_master(master); |
5043 | ndev->spi = NULL; |
5044 | dev_err(&ndev->pci_dev->dev, |
5045 | "%s(): unable to create SPI device\n", __func__); |
5046 | @@ -226,13 +227,13 @@ void netup_spi_release(struct netup_unidvb_dev *ndev) |
5047 | if (!spi) |
5048 | return; |
5049 | |
5050 | + spi_unregister_master(spi->master); |
5051 | spin_lock_irqsave(&spi->lock, flags); |
5052 | reg = readw(&spi->regs->control_stat); |
5053 | writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat); |
5054 | reg = readw(&spi->regs->control_stat); |
5055 | writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat); |
5056 | spin_unlock_irqrestore(&spi->lock, flags); |
5057 | - spi_unregister_master(spi->master); |
5058 | ndev->spi = NULL; |
5059 | } |
5060 | |
5061 | diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c |
5062 | index e6a71c17566d2..952ea250feda0 100644 |
5063 | --- a/drivers/media/pci/saa7146/mxb.c |
5064 | +++ b/drivers/media/pci/saa7146/mxb.c |
5065 | @@ -641,16 +641,17 @@ static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio * |
5066 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
5067 | |
5068 | DEB_D("VIDIOC_S_AUDIO %d\n", a->index); |
5069 | - if (mxb_inputs[mxb->cur_input].audioset & (1 << a->index)) { |
5070 | - if (mxb->cur_audinput != a->index) { |
5071 | - mxb->cur_audinput = a->index; |
5072 | - tea6420_route(mxb, a->index); |
5073 | - if (mxb->cur_audinput == 0) |
5074 | - mxb_update_audmode(mxb); |
5075 | - } |
5076 | - return 0; |
5077 | + if (a->index >= 32 || |
5078 | + !(mxb_inputs[mxb->cur_input].audioset & (1 << a->index))) |
5079 | + return -EINVAL; |
5080 | + |
5081 | + if (mxb->cur_audinput != a->index) { |
5082 | + mxb->cur_audinput = a->index; |
5083 | + tea6420_route(mxb, a->index); |
5084 | + if (mxb->cur_audinput == 0) |
5085 | + mxb_update_audmode(mxb); |
5086 | } |
5087 | - return -EINVAL; |
5088 | + return 0; |
5089 | } |
5090 | |
5091 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
5092 | diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c |
5093 | index 30c8f2ec9c3cc..809e4e65bb6e7 100644 |
5094 | --- a/drivers/media/pci/solo6x10/solo6x10-g723.c |
5095 | +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c |
5096 | @@ -399,7 +399,7 @@ int solo_g723_init(struct solo_dev *solo_dev) |
5097 | |
5098 | ret = snd_ctl_add(card, snd_ctl_new1(&kctl, solo_dev)); |
5099 | if (ret < 0) |
5100 | - return ret; |
5101 | + goto snd_error; |
5102 | |
5103 | ret = solo_snd_pcm_init(solo_dev); |
5104 | if (ret < 0) |
5105 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
5106 | index 5a6ec8fb52daa..f9bbd0000bf3e 100644 |
5107 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
5108 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
5109 | @@ -48,11 +48,14 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev) |
5110 | dec_clk->clk_info = devm_kcalloc(&pdev->dev, |
5111 | dec_clk->clk_num, sizeof(*clk_info), |
5112 | GFP_KERNEL); |
5113 | - if (!dec_clk->clk_info) |
5114 | - return -ENOMEM; |
5115 | + if (!dec_clk->clk_info) { |
5116 | + ret = -ENOMEM; |
5117 | + goto put_device; |
5118 | + } |
5119 | } else { |
5120 | mtk_v4l2_err("Failed to get vdec clock count"); |
5121 | - return -EINVAL; |
5122 | + ret = -EINVAL; |
5123 | + goto put_device; |
5124 | } |
5125 | |
5126 | for (i = 0; i < dec_clk->clk_num; i++) { |
5127 | @@ -61,25 +64,29 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev) |
5128 | "clock-names", i, &clk_info->clk_name); |
5129 | if (ret) { |
5130 | mtk_v4l2_err("Failed to get clock name id = %d", i); |
5131 | - return ret; |
5132 | + goto put_device; |
5133 | } |
5134 | clk_info->vcodec_clk = devm_clk_get(&pdev->dev, |
5135 | clk_info->clk_name); |
5136 | if (IS_ERR(clk_info->vcodec_clk)) { |
5137 | mtk_v4l2_err("devm_clk_get (%d)%s fail", i, |
5138 | clk_info->clk_name); |
5139 | - return PTR_ERR(clk_info->vcodec_clk); |
5140 | + ret = PTR_ERR(clk_info->vcodec_clk); |
5141 | + goto put_device; |
5142 | } |
5143 | } |
5144 | |
5145 | pm_runtime_enable(&pdev->dev); |
5146 | - |
5147 | + return 0; |
5148 | +put_device: |
5149 | + put_device(pm->larbvdec); |
5150 | return ret; |
5151 | } |
5152 | |
5153 | void mtk_vcodec_release_dec_pm(struct mtk_vcodec_dev *dev) |
5154 | { |
5155 | pm_runtime_disable(dev->pm.dev); |
5156 | + put_device(dev->pm.larbvdec); |
5157 | } |
5158 | |
5159 | void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) |
5160 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
5161 | index 3e2bfded79a66..e682bdb1ed453 100644 |
5162 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
5163 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
5164 | @@ -49,14 +49,16 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
5165 | node = of_parse_phandle(dev->of_node, "mediatek,larb", 1); |
5166 | if (!node) { |
5167 | mtk_v4l2_err("no mediatek,larb found"); |
5168 | - return -ENODEV; |
5169 | + ret = -ENODEV; |
5170 | + goto put_larbvenc; |
5171 | } |
5172 | |
5173 | pdev = of_find_device_by_node(node); |
5174 | of_node_put(node); |
5175 | if (!pdev) { |
5176 | mtk_v4l2_err("no mediatek,larb device found"); |
5177 | - return -ENODEV; |
5178 | + ret = -ENODEV; |
5179 | + goto put_larbvenc; |
5180 | } |
5181 | |
5182 | pm->larbvenclt = &pdev->dev; |
5183 | @@ -69,11 +71,14 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
5184 | enc_clk->clk_info = devm_kcalloc(&pdev->dev, |
5185 | enc_clk->clk_num, sizeof(*clk_info), |
5186 | GFP_KERNEL); |
5187 | - if (!enc_clk->clk_info) |
5188 | - return -ENOMEM; |
5189 | + if (!enc_clk->clk_info) { |
5190 | + ret = -ENOMEM; |
5191 | + goto put_larbvenclt; |
5192 | + } |
5193 | } else { |
5194 | mtk_v4l2_err("Failed to get venc clock count"); |
5195 | - return -EINVAL; |
5196 | + ret = -EINVAL; |
5197 | + goto put_larbvenclt; |
5198 | } |
5199 | |
5200 | for (i = 0; i < enc_clk->clk_num; i++) { |
5201 | @@ -82,17 +87,24 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
5202 | "clock-names", i, &clk_info->clk_name); |
5203 | if (ret) { |
5204 | mtk_v4l2_err("venc failed to get clk name %d", i); |
5205 | - return ret; |
5206 | + goto put_larbvenclt; |
5207 | } |
5208 | clk_info->vcodec_clk = devm_clk_get(&pdev->dev, |
5209 | clk_info->clk_name); |
5210 | if (IS_ERR(clk_info->vcodec_clk)) { |
5211 | mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i, |
5212 | clk_info->clk_name); |
5213 | - return PTR_ERR(clk_info->vcodec_clk); |
5214 | + ret = PTR_ERR(clk_info->vcodec_clk); |
5215 | + goto put_larbvenclt; |
5216 | } |
5217 | } |
5218 | |
5219 | + return 0; |
5220 | + |
5221 | +put_larbvenclt: |
5222 | + put_device(pm->larbvenclt); |
5223 | +put_larbvenc: |
5224 | + put_device(pm->larbvenc); |
5225 | return ret; |
5226 | } |
5227 | |
5228 | diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c |
5229 | index e222b4c98be42..78c5a4d0f2794 100644 |
5230 | --- a/drivers/media/rc/sunxi-cir.c |
5231 | +++ b/drivers/media/rc/sunxi-cir.c |
5232 | @@ -137,6 +137,8 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id) |
5233 | } else if (status & REG_RXSTA_RPE) { |
5234 | ir_raw_event_set_idle(ir->rc, true); |
5235 | ir_raw_event_handle(ir->rc); |
5236 | + } else { |
5237 | + ir_raw_event_handle(ir->rc); |
5238 | } |
5239 | |
5240 | spin_unlock(&ir->ir_lock); |
5241 | diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c |
5242 | index c1b307bbe540d..4210826cc9106 100644 |
5243 | --- a/drivers/media/usb/gspca/gspca.c |
5244 | +++ b/drivers/media/usb/gspca/gspca.c |
5245 | @@ -1575,6 +1575,7 @@ out: |
5246 | input_unregister_device(gspca_dev->input_dev); |
5247 | #endif |
5248 | v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler); |
5249 | + v4l2_device_unregister(&gspca_dev->v4l2_dev); |
5250 | kfree(gspca_dev->usb_buf); |
5251 | kfree(gspca_dev); |
5252 | return ret; |
5253 | diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c |
5254 | index 65be6f140fe83..1c60dfb647e5c 100644 |
5255 | --- a/drivers/media/usb/msi2500/msi2500.c |
5256 | +++ b/drivers/media/usb/msi2500/msi2500.c |
5257 | @@ -1230,7 +1230,7 @@ static int msi2500_probe(struct usb_interface *intf, |
5258 | } |
5259 | |
5260 | dev->master = master; |
5261 | - master->bus_num = 0; |
5262 | + master->bus_num = -1; |
5263 | master->num_chipselect = 1; |
5264 | master->transfer_one_message = msi2500_transfer_one_message; |
5265 | spi_master_set_devdata(master, dev); |
5266 | diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c |
5267 | index c07a81a6cbe29..c46cbcfafab3f 100644 |
5268 | --- a/drivers/media/usb/tm6000/tm6000-video.c |
5269 | +++ b/drivers/media/usb/tm6000/tm6000-video.c |
5270 | @@ -461,11 +461,12 @@ static int tm6000_alloc_urb_buffers(struct tm6000_core *dev) |
5271 | if (dev->urb_buffer) |
5272 | return 0; |
5273 | |
5274 | - dev->urb_buffer = kmalloc_array(num_bufs, sizeof(void *), GFP_KERNEL); |
5275 | + dev->urb_buffer = kmalloc_array(num_bufs, sizeof(*dev->urb_buffer), |
5276 | + GFP_KERNEL); |
5277 | if (!dev->urb_buffer) |
5278 | return -ENOMEM; |
5279 | |
5280 | - dev->urb_dma = kmalloc_array(num_bufs, sizeof(dma_addr_t *), |
5281 | + dev->urb_dma = kmalloc_array(num_bufs, sizeof(*dev->urb_dma), |
5282 | GFP_KERNEL); |
5283 | if (!dev->urb_dma) |
5284 | return -ENOMEM; |
5285 | diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c |
5286 | index 3bd1888787eb3..48c3b9f72722a 100644 |
5287 | --- a/drivers/media/v4l2-core/v4l2-fwnode.c |
5288 | +++ b/drivers/media/v4l2-core/v4l2-fwnode.c |
5289 | @@ -93,7 +93,7 @@ v4l2_fwnode_bus_type_to_mbus(enum v4l2_fwnode_bus_type type) |
5290 | const struct v4l2_fwnode_bus_conv *conv = |
5291 | get_v4l2_fwnode_bus_conv_by_fwnode_bus(type); |
5292 | |
5293 | - return conv ? conv->mbus_type : V4L2_MBUS_UNKNOWN; |
5294 | + return conv ? conv->mbus_type : V4L2_MBUS_INVALID; |
5295 | } |
5296 | |
5297 | static const char * |
5298 | @@ -436,6 +436,10 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode, |
5299 | v4l2_fwnode_mbus_type_to_string(vep->bus_type), |
5300 | vep->bus_type); |
5301 | mbus_type = v4l2_fwnode_bus_type_to_mbus(bus_type); |
5302 | + if (mbus_type == V4L2_MBUS_INVALID) { |
5303 | + pr_debug("unsupported bus type %u\n", bus_type); |
5304 | + return -EINVAL; |
5305 | + } |
5306 | |
5307 | if (vep->bus_type != V4L2_MBUS_UNKNOWN) { |
5308 | if (mbus_type != V4L2_MBUS_UNKNOWN && |
5309 | diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c |
5310 | index ef03d6fafc5ce..12bc3f5a6cbbd 100644 |
5311 | --- a/drivers/memstick/core/memstick.c |
5312 | +++ b/drivers/memstick/core/memstick.c |
5313 | @@ -468,7 +468,6 @@ static void memstick_check(struct work_struct *work) |
5314 | host->card = card; |
5315 | if (device_register(&card->dev)) { |
5316 | put_device(&card->dev); |
5317 | - kfree(host->card); |
5318 | host->card = NULL; |
5319 | } |
5320 | } else |
5321 | diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c |
5322 | index dd3a1f3dcc191..d2ef46337191c 100644 |
5323 | --- a/drivers/memstick/host/r592.c |
5324 | +++ b/drivers/memstick/host/r592.c |
5325 | @@ -759,8 +759,10 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
5326 | goto error3; |
5327 | |
5328 | dev->mmio = pci_ioremap_bar(pdev, 0); |
5329 | - if (!dev->mmio) |
5330 | + if (!dev->mmio) { |
5331 | + error = -ENOMEM; |
5332 | goto error4; |
5333 | + } |
5334 | |
5335 | dev->irq = pdev->irq; |
5336 | spin_lock_init(&dev->irq_lock); |
5337 | @@ -786,12 +788,14 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
5338 | &dev->dummy_dma_page_physical_address, GFP_KERNEL); |
5339 | r592_stop_dma(dev , 0); |
5340 | |
5341 | - if (request_irq(dev->irq, &r592_irq, IRQF_SHARED, |
5342 | - DRV_NAME, dev)) |
5343 | + error = request_irq(dev->irq, &r592_irq, IRQF_SHARED, |
5344 | + DRV_NAME, dev); |
5345 | + if (error) |
5346 | goto error6; |
5347 | |
5348 | r592_update_card_detect(dev); |
5349 | - if (memstick_add_host(host)) |
5350 | + error = memstick_add_host(host); |
5351 | + if (error) |
5352 | goto error7; |
5353 | |
5354 | message("driver successfully loaded"); |
5355 | diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c |
5356 | index a7a4fed4d8995..3eeb1920ddb43 100644 |
5357 | --- a/drivers/misc/habanalabs/device.c |
5358 | +++ b/drivers/misc/habanalabs/device.c |
5359 | @@ -229,16 +229,16 @@ delete_cdev_device: |
5360 | |
5361 | static void device_cdev_sysfs_del(struct hl_device *hdev) |
5362 | { |
5363 | - /* device_release() won't be called so must free devices explicitly */ |
5364 | - if (!hdev->cdev_sysfs_created) { |
5365 | - kfree(hdev->dev_ctrl); |
5366 | - kfree(hdev->dev); |
5367 | - return; |
5368 | - } |
5369 | + if (!hdev->cdev_sysfs_created) |
5370 | + goto put_devices; |
5371 | |
5372 | hl_sysfs_fini(hdev); |
5373 | cdev_device_del(&hdev->cdev_ctrl, hdev->dev_ctrl); |
5374 | cdev_device_del(&hdev->cdev, hdev->dev); |
5375 | + |
5376 | +put_devices: |
5377 | + put_device(hdev->dev); |
5378 | + put_device(hdev->dev_ctrl); |
5379 | } |
5380 | |
5381 | /* |
5382 | @@ -1285,9 +1285,9 @@ sw_fini: |
5383 | early_fini: |
5384 | device_early_fini(hdev); |
5385 | free_dev_ctrl: |
5386 | - kfree(hdev->dev_ctrl); |
5387 | + put_device(hdev->dev_ctrl); |
5388 | free_dev: |
5389 | - kfree(hdev->dev); |
5390 | + put_device(hdev->dev); |
5391 | out_disabled: |
5392 | hdev->disabled = true; |
5393 | if (add_cdev_sysfs_on_err) |
5394 | diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c |
5395 | index b2bbcb09a49e6..953e7457137a2 100644 |
5396 | --- a/drivers/mmc/host/pxamci.c |
5397 | +++ b/drivers/mmc/host/pxamci.c |
5398 | @@ -729,6 +729,7 @@ static int pxamci_probe(struct platform_device *pdev) |
5399 | |
5400 | host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); |
5401 | if (IS_ERR(host->power)) { |
5402 | + ret = PTR_ERR(host->power); |
5403 | dev_err(dev, "Failed requesting gpio_power\n"); |
5404 | goto out; |
5405 | } |
5406 | diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5407 | index ef89947ee3191..2390ed077a2fc 100644 |
5408 | --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5409 | +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5410 | @@ -149,8 +149,10 @@ static int gpmi_init(struct gpmi_nand_data *this) |
5411 | int ret; |
5412 | |
5413 | ret = pm_runtime_get_sync(this->dev); |
5414 | - if (ret < 0) |
5415 | + if (ret < 0) { |
5416 | + pm_runtime_put_noidle(this->dev); |
5417 | return ret; |
5418 | + } |
5419 | |
5420 | ret = gpmi_reset_block(r->gpmi_regs, false); |
5421 | if (ret) |
5422 | @@ -2406,7 +2408,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
5423 | void *buf_read = NULL; |
5424 | const void *buf_write = NULL; |
5425 | bool direct = false; |
5426 | - struct completion *completion; |
5427 | + struct completion *dma_completion, *bch_completion; |
5428 | unsigned long to; |
5429 | |
5430 | this->ntransfers = 0; |
5431 | @@ -2414,8 +2416,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
5432 | this->transfers[i].direction = DMA_NONE; |
5433 | |
5434 | ret = pm_runtime_get_sync(this->dev); |
5435 | - if (ret < 0) |
5436 | + if (ret < 0) { |
5437 | + pm_runtime_put_noidle(this->dev); |
5438 | return ret; |
5439 | + } |
5440 | |
5441 | /* |
5442 | * This driver currently supports only one NAND chip. Plus, dies share |
5443 | @@ -2498,22 +2502,24 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
5444 | this->resources.bch_regs + HW_BCH_FLASH0LAYOUT1); |
5445 | } |
5446 | |
5447 | + desc->callback = dma_irq_callback; |
5448 | + desc->callback_param = this; |
5449 | + dma_completion = &this->dma_done; |
5450 | + bch_completion = NULL; |
5451 | + |
5452 | + init_completion(dma_completion); |
5453 | + |
5454 | if (this->bch && buf_read) { |
5455 | writel(BM_BCH_CTRL_COMPLETE_IRQ_EN, |
5456 | this->resources.bch_regs + HW_BCH_CTRL_SET); |
5457 | - completion = &this->bch_done; |
5458 | - } else { |
5459 | - desc->callback = dma_irq_callback; |
5460 | - desc->callback_param = this; |
5461 | - completion = &this->dma_done; |
5462 | + bch_completion = &this->bch_done; |
5463 | + init_completion(bch_completion); |
5464 | } |
5465 | |
5466 | - init_completion(completion); |
5467 | - |
5468 | dmaengine_submit(desc); |
5469 | dma_async_issue_pending(get_dma_chan(this)); |
5470 | |
5471 | - to = wait_for_completion_timeout(completion, msecs_to_jiffies(1000)); |
5472 | + to = wait_for_completion_timeout(dma_completion, msecs_to_jiffies(1000)); |
5473 | if (!to) { |
5474 | dev_err(this->dev, "DMA timeout, last DMA\n"); |
5475 | gpmi_dump_info(this); |
5476 | @@ -2521,6 +2527,16 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
5477 | goto unmap; |
5478 | } |
5479 | |
5480 | + if (this->bch && buf_read) { |
5481 | + to = wait_for_completion_timeout(bch_completion, msecs_to_jiffies(1000)); |
5482 | + if (!to) { |
5483 | + dev_err(this->dev, "BCH timeout, last DMA\n"); |
5484 | + gpmi_dump_info(this); |
5485 | + ret = -ETIMEDOUT; |
5486 | + goto unmap; |
5487 | + } |
5488 | + } |
5489 | + |
5490 | writel(BM_BCH_CTRL_COMPLETE_IRQ_EN, |
5491 | this->resources.bch_regs + HW_BCH_CTRL_CLR); |
5492 | gpmi_clear_bch(this); |
5493 | diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c |
5494 | index 1b82b687e5a50..ab7ab6a279aac 100644 |
5495 | --- a/drivers/mtd/nand/raw/meson_nand.c |
5496 | +++ b/drivers/mtd/nand/raw/meson_nand.c |
5497 | @@ -510,7 +510,7 @@ static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, void *databuf, |
5498 | } |
5499 | |
5500 | static void meson_nfc_dma_buffer_release(struct nand_chip *nand, |
5501 | - int infolen, int datalen, |
5502 | + int datalen, int infolen, |
5503 | enum dma_data_direction dir) |
5504 | { |
5505 | struct meson_nfc *nfc = nand_get_controller_data(nand); |
5506 | @@ -1041,9 +1041,12 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc) |
5507 | |
5508 | ret = clk_set_rate(nfc->device_clk, 24000000); |
5509 | if (ret) |
5510 | - goto err_phase_rx; |
5511 | + goto err_disable_rx; |
5512 | |
5513 | return 0; |
5514 | + |
5515 | +err_disable_rx: |
5516 | + clk_disable_unprepare(nfc->phase_rx); |
5517 | err_phase_rx: |
5518 | clk_disable_unprepare(nfc->phase_tx); |
5519 | err_phase_tx: |
5520 | diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
5521 | index c1c53b02b35f4..963ebcdfcbce3 100644 |
5522 | --- a/drivers/mtd/nand/raw/qcom_nandc.c |
5523 | +++ b/drivers/mtd/nand/raw/qcom_nandc.c |
5524 | @@ -1570,6 +1570,8 @@ static int check_flash_errors(struct qcom_nand_host *host, int cw_cnt) |
5525 | struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); |
5526 | int i; |
5527 | |
5528 | + nandc_read_buffer_sync(nandc, true); |
5529 | + |
5530 | for (i = 0; i < cw_cnt; i++) { |
5531 | u32 flash = le32_to_cpu(nandc->reg_read_buf[i]); |
5532 | |
5533 | diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c |
5534 | index 0d21c68bfe245..671700af91804 100644 |
5535 | --- a/drivers/mtd/nand/spi/core.c |
5536 | +++ b/drivers/mtd/nand/spi/core.c |
5537 | @@ -317,6 +317,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, |
5538 | buf += ret; |
5539 | } |
5540 | |
5541 | + if (req->ooblen) |
5542 | + memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, |
5543 | + req->ooblen); |
5544 | + |
5545 | return 0; |
5546 | } |
5547 | |
5548 | diff --git a/drivers/mtd/parsers/cmdlinepart.c b/drivers/mtd/parsers/cmdlinepart.c |
5549 | index 0625b25620ca7..0dca51549128d 100644 |
5550 | --- a/drivers/mtd/parsers/cmdlinepart.c |
5551 | +++ b/drivers/mtd/parsers/cmdlinepart.c |
5552 | @@ -218,7 +218,7 @@ static int mtdpart_setup_real(char *s) |
5553 | struct cmdline_mtd_partition *this_mtd; |
5554 | struct mtd_partition *parts; |
5555 | int mtd_id_len, num_parts; |
5556 | - char *p, *mtd_id, *semicol; |
5557 | + char *p, *mtd_id, *semicol, *open_parenth; |
5558 | |
5559 | /* |
5560 | * Replace the first ';' by a NULL char so strrchr can work |
5561 | @@ -228,6 +228,14 @@ static int mtdpart_setup_real(char *s) |
5562 | if (semicol) |
5563 | *semicol = '\0'; |
5564 | |
5565 | + /* |
5566 | + * make sure that part-names with ":" will not be handled as |
5567 | + * part of the mtd-id with an ":" |
5568 | + */ |
5569 | + open_parenth = strchr(s, '('); |
5570 | + if (open_parenth) |
5571 | + *open_parenth = '\0'; |
5572 | + |
5573 | mtd_id = s; |
5574 | |
5575 | /* |
5576 | @@ -237,6 +245,10 @@ static int mtdpart_setup_real(char *s) |
5577 | */ |
5578 | p = strrchr(s, ':'); |
5579 | |
5580 | + /* Restore the '(' now. */ |
5581 | + if (open_parenth) |
5582 | + *open_parenth = '('; |
5583 | + |
5584 | /* Restore the ';' now. */ |
5585 | if (semicol) |
5586 | *semicol = ';'; |
5587 | diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
5588 | index c84114b44ee07..d2bb9a87eff9a 100644 |
5589 | --- a/drivers/net/can/m_can/m_can.c |
5590 | +++ b/drivers/net/can/m_can/m_can.c |
5591 | @@ -379,10 +379,6 @@ void m_can_config_endisable(struct m_can_classdev *cdev, bool enable) |
5592 | cccr &= ~CCCR_CSR; |
5593 | |
5594 | if (enable) { |
5595 | - /* Clear the Clock stop request if it was set */ |
5596 | - if (cccr & CCCR_CSR) |
5597 | - cccr &= ~CCCR_CSR; |
5598 | - |
5599 | /* enable m_can configuration */ |
5600 | m_can_write(cdev, M_CAN_CCCR, cccr | CCCR_INIT); |
5601 | udelay(5); |
5602 | diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c |
5603 | index 8242fb287cbbe..16e3f55efa311 100644 |
5604 | --- a/drivers/net/can/softing/softing_main.c |
5605 | +++ b/drivers/net/can/softing/softing_main.c |
5606 | @@ -382,8 +382,13 @@ static int softing_netdev_open(struct net_device *ndev) |
5607 | |
5608 | /* check or determine and set bittime */ |
5609 | ret = open_candev(ndev); |
5610 | - if (!ret) |
5611 | - ret = softing_startstop(ndev, 1); |
5612 | + if (ret) |
5613 | + return ret; |
5614 | + |
5615 | + ret = softing_startstop(ndev, 1); |
5616 | + if (ret < 0) |
5617 | + close_candev(ndev); |
5618 | + |
5619 | return ret; |
5620 | } |
5621 | |
5622 | diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c |
5623 | index ff318472a3eef..95155a1f9f9dc 100644 |
5624 | --- a/drivers/net/ethernet/allwinner/sun4i-emac.c |
5625 | +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c |
5626 | @@ -845,13 +845,13 @@ static int emac_probe(struct platform_device *pdev) |
5627 | db->clk = devm_clk_get(&pdev->dev, NULL); |
5628 | if (IS_ERR(db->clk)) { |
5629 | ret = PTR_ERR(db->clk); |
5630 | - goto out_iounmap; |
5631 | + goto out_dispose_mapping; |
5632 | } |
5633 | |
5634 | ret = clk_prepare_enable(db->clk); |
5635 | if (ret) { |
5636 | dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret); |
5637 | - goto out_iounmap; |
5638 | + goto out_dispose_mapping; |
5639 | } |
5640 | |
5641 | ret = sunxi_sram_claim(&pdev->dev); |
5642 | @@ -910,6 +910,8 @@ out_release_sram: |
5643 | sunxi_sram_release(&pdev->dev); |
5644 | out_clk_disable_unprepare: |
5645 | clk_disable_unprepare(db->clk); |
5646 | +out_dispose_mapping: |
5647 | + irq_dispose_mapping(ndev->irq); |
5648 | out_iounmap: |
5649 | iounmap(db->membase); |
5650 | out: |
5651 | @@ -928,6 +930,7 @@ static int emac_remove(struct platform_device *pdev) |
5652 | unregister_netdev(ndev); |
5653 | sunxi_sram_release(&pdev->dev); |
5654 | clk_disable_unprepare(db->clk); |
5655 | + irq_dispose_mapping(ndev->irq); |
5656 | iounmap(db->membase); |
5657 | free_netdev(ndev); |
5658 | |
5659 | diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5660 | index 03f82786c0b98..b27da024aa9d9 100644 |
5661 | --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5662 | +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5663 | @@ -3584,8 +3584,10 @@ static int bcmgenet_probe(struct platform_device *pdev) |
5664 | clk_disable_unprepare(priv->clk); |
5665 | |
5666 | err = register_netdev(dev); |
5667 | - if (err) |
5668 | + if (err) { |
5669 | + bcmgenet_mii_exit(dev); |
5670 | goto err; |
5671 | + } |
5672 | |
5673 | return err; |
5674 | |
5675 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c |
5676 | index e3f29dc8b290a..f47841f3a69d5 100644 |
5677 | --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c |
5678 | +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c |
5679 | @@ -1195,6 +1195,11 @@ clear_counts: |
5680 | rc->total_packets = 0; |
5681 | } |
5682 | |
5683 | +static struct i40e_rx_buffer *i40e_rx_bi(struct i40e_ring *rx_ring, u32 idx) |
5684 | +{ |
5685 | + return &rx_ring->rx_bi[idx]; |
5686 | +} |
5687 | + |
5688 | /** |
5689 | * i40e_reuse_rx_page - page flip buffer and store it back on the ring |
5690 | * @rx_ring: rx descriptor ring to store buffers on |
5691 | @@ -1208,7 +1213,7 @@ static void i40e_reuse_rx_page(struct i40e_ring *rx_ring, |
5692 | struct i40e_rx_buffer *new_buff; |
5693 | u16 nta = rx_ring->next_to_alloc; |
5694 | |
5695 | - new_buff = &rx_ring->rx_bi[nta]; |
5696 | + new_buff = i40e_rx_bi(rx_ring, nta); |
5697 | |
5698 | /* update, and store next to alloc */ |
5699 | nta++; |
5700 | @@ -1272,7 +1277,7 @@ struct i40e_rx_buffer *i40e_clean_programming_status( |
5701 | ntc = rx_ring->next_to_clean; |
5702 | |
5703 | /* fetch, update, and store next to clean */ |
5704 | - rx_buffer = &rx_ring->rx_bi[ntc++]; |
5705 | + rx_buffer = i40e_rx_bi(rx_ring, ntc++); |
5706 | ntc = (ntc < rx_ring->count) ? ntc : 0; |
5707 | rx_ring->next_to_clean = ntc; |
5708 | |
5709 | @@ -1361,7 +1366,7 @@ void i40e_clean_rx_ring(struct i40e_ring *rx_ring) |
5710 | |
5711 | /* Free all the Rx ring sk_buffs */ |
5712 | for (i = 0; i < rx_ring->count; i++) { |
5713 | - struct i40e_rx_buffer *rx_bi = &rx_ring->rx_bi[i]; |
5714 | + struct i40e_rx_buffer *rx_bi = i40e_rx_bi(rx_ring, i); |
5715 | |
5716 | if (!rx_bi->page) |
5717 | continue; |
5718 | @@ -1576,7 +1581,7 @@ bool i40e_alloc_rx_buffers(struct i40e_ring *rx_ring, u16 cleaned_count) |
5719 | return false; |
5720 | |
5721 | rx_desc = I40E_RX_DESC(rx_ring, ntu); |
5722 | - bi = &rx_ring->rx_bi[ntu]; |
5723 | + bi = i40e_rx_bi(rx_ring, ntu); |
5724 | |
5725 | do { |
5726 | if (!i40e_alloc_mapped_page(rx_ring, bi)) |
5727 | @@ -1598,7 +1603,7 @@ bool i40e_alloc_rx_buffers(struct i40e_ring *rx_ring, u16 cleaned_count) |
5728 | ntu++; |
5729 | if (unlikely(ntu == rx_ring->count)) { |
5730 | rx_desc = I40E_RX_DESC(rx_ring, 0); |
5731 | - bi = rx_ring->rx_bi; |
5732 | + bi = i40e_rx_bi(rx_ring, 0); |
5733 | ntu = 0; |
5734 | } |
5735 | |
5736 | @@ -1864,6 +1869,7 @@ static inline bool i40e_page_is_reusable(struct page *page) |
5737 | * the adapter for another receive |
5738 | * |
5739 | * @rx_buffer: buffer containing the page |
5740 | + * @rx_buffer_pgcnt: buffer page refcount pre xdp_do_redirect() call |
5741 | * |
5742 | * If page is reusable, rx_buffer->page_offset is adjusted to point to |
5743 | * an unused region in the page. |
5744 | @@ -1886,7 +1892,8 @@ static inline bool i40e_page_is_reusable(struct page *page) |
5745 | * |
5746 | * In either case, if the page is reusable its refcount is increased. |
5747 | **/ |
5748 | -static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer) |
5749 | +static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer, |
5750 | + int rx_buffer_pgcnt) |
5751 | { |
5752 | unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; |
5753 | struct page *page = rx_buffer->page; |
5754 | @@ -1897,7 +1904,7 @@ static bool i40e_can_reuse_rx_page(struct i40e_rx_buffer *rx_buffer) |
5755 | |
5756 | #if (PAGE_SIZE < 8192) |
5757 | /* if we are only owner of page we can reuse it */ |
5758 | - if (unlikely((page_count(page) - pagecnt_bias) > 1)) |
5759 | + if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) |
5760 | return false; |
5761 | #else |
5762 | #define I40E_LAST_OFFSET \ |
5763 | @@ -1956,17 +1963,25 @@ static void i40e_add_rx_frag(struct i40e_ring *rx_ring, |
5764 | * i40e_get_rx_buffer - Fetch Rx buffer and synchronize data for use |
5765 | * @rx_ring: rx descriptor ring to transact packets on |
5766 | * @size: size of buffer to add to skb |
5767 | + * @rx_buffer_pgcnt: buffer page refcount |
5768 | * |
5769 | * This function will pull an Rx buffer from the ring and synchronize it |
5770 | * for use by the CPU. |
5771 | */ |
5772 | static struct i40e_rx_buffer *i40e_get_rx_buffer(struct i40e_ring *rx_ring, |
5773 | - const unsigned int size) |
5774 | + const unsigned int size, |
5775 | + int *rx_buffer_pgcnt) |
5776 | { |
5777 | struct i40e_rx_buffer *rx_buffer; |
5778 | |
5779 | - rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean]; |
5780 | - prefetchw(rx_buffer->page); |
5781 | + rx_buffer = i40e_rx_bi(rx_ring, rx_ring->next_to_clean); |
5782 | + *rx_buffer_pgcnt = |
5783 | +#if (PAGE_SIZE < 8192) |
5784 | + page_count(rx_buffer->page); |
5785 | +#else |
5786 | + 0; |
5787 | +#endif |
5788 | + prefetch_page_address(rx_buffer->page); |
5789 | |
5790 | /* we are reusing so sync this buffer for CPU use */ |
5791 | dma_sync_single_range_for_cpu(rx_ring->dev, |
5792 | @@ -2120,14 +2135,16 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring, |
5793 | * i40e_put_rx_buffer - Clean up used buffer and either recycle or free |
5794 | * @rx_ring: rx descriptor ring to transact packets on |
5795 | * @rx_buffer: rx buffer to pull data from |
5796 | + * @rx_buffer_pgcnt: rx buffer page refcount pre xdp_do_redirect() call |
5797 | * |
5798 | * This function will clean up the contents of the rx_buffer. It will |
5799 | * either recycle the buffer or unmap it and free the associated resources. |
5800 | */ |
5801 | static void i40e_put_rx_buffer(struct i40e_ring *rx_ring, |
5802 | - struct i40e_rx_buffer *rx_buffer) |
5803 | + struct i40e_rx_buffer *rx_buffer, |
5804 | + int rx_buffer_pgcnt) |
5805 | { |
5806 | - if (i40e_can_reuse_rx_page(rx_buffer)) { |
5807 | + if (i40e_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { |
5808 | /* hand second half of page back to the ring */ |
5809 | i40e_reuse_rx_page(rx_ring, rx_buffer); |
5810 | } else { |
5811 | @@ -2340,6 +2357,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) |
5812 | while (likely(total_rx_packets < (unsigned int)budget)) { |
5813 | struct i40e_rx_buffer *rx_buffer; |
5814 | union i40e_rx_desc *rx_desc; |
5815 | + int rx_buffer_pgcnt; |
5816 | unsigned int size; |
5817 | u64 qword; |
5818 | |
5819 | @@ -2379,7 +2397,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) |
5820 | break; |
5821 | |
5822 | i40e_trace(clean_rx_irq, rx_ring, rx_desc, skb); |
5823 | - rx_buffer = i40e_get_rx_buffer(rx_ring, size); |
5824 | + rx_buffer = i40e_get_rx_buffer(rx_ring, size, &rx_buffer_pgcnt); |
5825 | |
5826 | /* retrieve a buffer from the ring */ |
5827 | if (!skb) { |
5828 | @@ -2419,7 +2437,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) |
5829 | break; |
5830 | } |
5831 | |
5832 | - i40e_put_rx_buffer(rx_ring, rx_buffer); |
5833 | + i40e_put_rx_buffer(rx_ring, rx_buffer, rx_buffer_pgcnt); |
5834 | cleaned_count++; |
5835 | |
5836 | if (i40e_is_non_eop(rx_ring, rx_desc, skb)) |
5837 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
5838 | index 3156de786d955..c9d4534fbdf02 100644 |
5839 | --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
5840 | +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
5841 | @@ -9,6 +9,11 @@ |
5842 | #include "i40e_txrx_common.h" |
5843 | #include "i40e_xsk.h" |
5844 | |
5845 | +static struct i40e_rx_buffer *i40e_rx_bi(struct i40e_ring *rx_ring, u32 idx) |
5846 | +{ |
5847 | + return &rx_ring->rx_bi[idx]; |
5848 | +} |
5849 | + |
5850 | /** |
5851 | * i40e_xsk_umem_dma_map - DMA maps all UMEM memory for the netdev |
5852 | * @vsi: Current VSI |
5853 | @@ -321,7 +326,7 @@ __i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count, |
5854 | bool ok = true; |
5855 | |
5856 | rx_desc = I40E_RX_DESC(rx_ring, ntu); |
5857 | - bi = &rx_ring->rx_bi[ntu]; |
5858 | + bi = i40e_rx_bi(rx_ring, ntu); |
5859 | do { |
5860 | if (!alloc(rx_ring, bi)) { |
5861 | ok = false; |
5862 | @@ -340,7 +345,7 @@ __i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count, |
5863 | |
5864 | if (unlikely(ntu == rx_ring->count)) { |
5865 | rx_desc = I40E_RX_DESC(rx_ring, 0); |
5866 | - bi = rx_ring->rx_bi; |
5867 | + bi = i40e_rx_bi(rx_ring, 0); |
5868 | ntu = 0; |
5869 | } |
5870 | |
5871 | @@ -402,7 +407,7 @@ static struct i40e_rx_buffer *i40e_get_rx_buffer_zc(struct i40e_ring *rx_ring, |
5872 | { |
5873 | struct i40e_rx_buffer *bi; |
5874 | |
5875 | - bi = &rx_ring->rx_bi[rx_ring->next_to_clean]; |
5876 | + bi = i40e_rx_bi(rx_ring, rx_ring->next_to_clean); |
5877 | |
5878 | /* we are reusing so sync this buffer for CPU use */ |
5879 | dma_sync_single_range_for_cpu(rx_ring->dev, |
5880 | @@ -424,7 +429,8 @@ static struct i40e_rx_buffer *i40e_get_rx_buffer_zc(struct i40e_ring *rx_ring, |
5881 | static void i40e_reuse_rx_buffer_zc(struct i40e_ring *rx_ring, |
5882 | struct i40e_rx_buffer *old_bi) |
5883 | { |
5884 | - struct i40e_rx_buffer *new_bi = &rx_ring->rx_bi[rx_ring->next_to_alloc]; |
5885 | + struct i40e_rx_buffer *new_bi = i40e_rx_bi(rx_ring, |
5886 | + rx_ring->next_to_alloc); |
5887 | u16 nta = rx_ring->next_to_alloc; |
5888 | |
5889 | /* update, and store next to alloc */ |
5890 | @@ -456,7 +462,7 @@ void i40e_zca_free(struct zero_copy_allocator *alloc, unsigned long handle) |
5891 | mask = rx_ring->xsk_umem->chunk_mask; |
5892 | |
5893 | nta = rx_ring->next_to_alloc; |
5894 | - bi = &rx_ring->rx_bi[nta]; |
5895 | + bi = i40e_rx_bi(rx_ring, nta); |
5896 | |
5897 | nta++; |
5898 | rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; |
5899 | @@ -824,7 +830,7 @@ void i40e_xsk_clean_rx_ring(struct i40e_ring *rx_ring) |
5900 | u16 i; |
5901 | |
5902 | for (i = 0; i < rx_ring->count; i++) { |
5903 | - struct i40e_rx_buffer *rx_bi = &rx_ring->rx_bi[i]; |
5904 | + struct i40e_rx_buffer *rx_bi = i40e_rx_bi(rx_ring, i); |
5905 | |
5906 | if (!rx_bi->addr) |
5907 | continue; |
5908 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
5909 | index 5336bfcd2d701..f605540644035 100644 |
5910 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
5911 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
5912 | @@ -1947,7 +1947,8 @@ static inline bool ixgbe_page_is_reserved(struct page *page) |
5913 | return (page_to_nid(page) != numa_mem_id()) || page_is_pfmemalloc(page); |
5914 | } |
5915 | |
5916 | -static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer) |
5917 | +static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer, |
5918 | + int rx_buffer_pgcnt) |
5919 | { |
5920 | unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; |
5921 | struct page *page = rx_buffer->page; |
5922 | @@ -1958,7 +1959,7 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer) |
5923 | |
5924 | #if (PAGE_SIZE < 8192) |
5925 | /* if we are only owner of page we can reuse it */ |
5926 | - if (unlikely((page_ref_count(page) - pagecnt_bias) > 1)) |
5927 | + if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) |
5928 | return false; |
5929 | #else |
5930 | /* The last offset is a bit aggressive in that we assume the |
5931 | @@ -2023,11 +2024,18 @@ static void ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring, |
5932 | static struct ixgbe_rx_buffer *ixgbe_get_rx_buffer(struct ixgbe_ring *rx_ring, |
5933 | union ixgbe_adv_rx_desc *rx_desc, |
5934 | struct sk_buff **skb, |
5935 | - const unsigned int size) |
5936 | + const unsigned int size, |
5937 | + int *rx_buffer_pgcnt) |
5938 | { |
5939 | struct ixgbe_rx_buffer *rx_buffer; |
5940 | |
5941 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; |
5942 | + *rx_buffer_pgcnt = |
5943 | +#if (PAGE_SIZE < 8192) |
5944 | + page_count(rx_buffer->page); |
5945 | +#else |
5946 | + 0; |
5947 | +#endif |
5948 | prefetchw(rx_buffer->page); |
5949 | *skb = rx_buffer->skb; |
5950 | |
5951 | @@ -2057,9 +2065,10 @@ skip_sync: |
5952 | |
5953 | static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring, |
5954 | struct ixgbe_rx_buffer *rx_buffer, |
5955 | - struct sk_buff *skb) |
5956 | + struct sk_buff *skb, |
5957 | + int rx_buffer_pgcnt) |
5958 | { |
5959 | - if (ixgbe_can_reuse_rx_page(rx_buffer)) { |
5960 | + if (ixgbe_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { |
5961 | /* hand second half of page back to the ring */ |
5962 | ixgbe_reuse_rx_page(rx_ring, rx_buffer); |
5963 | } else { |
5964 | @@ -2295,6 +2304,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, |
5965 | union ixgbe_adv_rx_desc *rx_desc; |
5966 | struct ixgbe_rx_buffer *rx_buffer; |
5967 | struct sk_buff *skb; |
5968 | + int rx_buffer_pgcnt; |
5969 | unsigned int size; |
5970 | |
5971 | /* return some buffers to hardware, one at a time is too slow */ |
5972 | @@ -2314,7 +2324,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, |
5973 | */ |
5974 | dma_rmb(); |
5975 | |
5976 | - rx_buffer = ixgbe_get_rx_buffer(rx_ring, rx_desc, &skb, size); |
5977 | + rx_buffer = ixgbe_get_rx_buffer(rx_ring, rx_desc, &skb, size, &rx_buffer_pgcnt); |
5978 | |
5979 | /* retrieve a buffer from the ring */ |
5980 | if (!skb) { |
5981 | @@ -2356,7 +2366,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, |
5982 | break; |
5983 | } |
5984 | |
5985 | - ixgbe_put_rx_buffer(rx_ring, rx_buffer, skb); |
5986 | + ixgbe_put_rx_buffer(rx_ring, rx_buffer, skb, rx_buffer_pgcnt); |
5987 | cleaned_count++; |
5988 | |
5989 | /* place incomplete frames back on ring for completion */ |
5990 | diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c |
5991 | index 993f495e2bf7b..9f804e2aba359 100644 |
5992 | --- a/drivers/net/ethernet/korina.c |
5993 | +++ b/drivers/net/ethernet/korina.c |
5994 | @@ -219,7 +219,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) |
5995 | dev_kfree_skb_any(skb); |
5996 | spin_unlock_irqrestore(&lp->lock, flags); |
5997 | |
5998 | - return NETDEV_TX_BUSY; |
5999 | + return NETDEV_TX_OK; |
6000 | } |
6001 | } |
6002 | |
6003 | diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
6004 | index 63c0334430134..931d1a56b79ca 100644 |
6005 | --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
6006 | +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
6007 | @@ -4745,12 +4745,16 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv, |
6008 | eth_hw_addr_random(dev); |
6009 | } |
6010 | |
6011 | +static struct mvpp2_port *mvpp2_phylink_to_port(struct phylink_config *config) |
6012 | +{ |
6013 | + return container_of(config, struct mvpp2_port, phylink_config); |
6014 | +} |
6015 | + |
6016 | static void mvpp2_phylink_validate(struct phylink_config *config, |
6017 | unsigned long *supported, |
6018 | struct phylink_link_state *state) |
6019 | { |
6020 | - struct mvpp2_port *port = container_of(config, struct mvpp2_port, |
6021 | - phylink_config); |
6022 | + struct mvpp2_port *port = mvpp2_phylink_to_port(config); |
6023 | __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; |
6024 | |
6025 | /* Invalid combinations */ |
6026 | @@ -4877,8 +4881,7 @@ static void mvpp2_gmac_link_state(struct mvpp2_port *port, |
6027 | static int mvpp2_phylink_mac_link_state(struct phylink_config *config, |
6028 | struct phylink_link_state *state) |
6029 | { |
6030 | - struct mvpp2_port *port = container_of(config, struct mvpp2_port, |
6031 | - phylink_config); |
6032 | + struct mvpp2_port *port = mvpp2_phylink_to_port(config); |
6033 | |
6034 | if (port->priv->hw_version == MVPP22 && port->gop_id == 0) { |
6035 | u32 mode = readl(port->base + MVPP22_XLG_CTRL3_REG); |
6036 | @@ -4896,8 +4899,7 @@ static int mvpp2_phylink_mac_link_state(struct phylink_config *config, |
6037 | |
6038 | static void mvpp2_mac_an_restart(struct phylink_config *config) |
6039 | { |
6040 | - struct mvpp2_port *port = container_of(config, struct mvpp2_port, |
6041 | - phylink_config); |
6042 | + struct mvpp2_port *port = mvpp2_phylink_to_port(config); |
6043 | u32 val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); |
6044 | |
6045 | writel(val | MVPP2_GMAC_IN_BAND_RESTART_AN, |
6046 | @@ -5085,13 +5087,12 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, |
6047 | static void mvpp2_mac_config(struct phylink_config *config, unsigned int mode, |
6048 | const struct phylink_link_state *state) |
6049 | { |
6050 | - struct net_device *dev = to_net_dev(config->dev); |
6051 | - struct mvpp2_port *port = netdev_priv(dev); |
6052 | + struct mvpp2_port *port = mvpp2_phylink_to_port(config); |
6053 | bool change_interface = port->phy_interface != state->interface; |
6054 | |
6055 | /* Check for invalid configuration */ |
6056 | if (mvpp2_is_xlg(state->interface) && port->gop_id != 0) { |
6057 | - netdev_err(dev, "Invalid mode on %s\n", dev->name); |
6058 | + netdev_err(port->dev, "Invalid mode on %s\n", port->dev->name); |
6059 | return; |
6060 | } |
6061 | |
6062 | @@ -5128,8 +5129,7 @@ static void mvpp2_mac_config(struct phylink_config *config, unsigned int mode, |
6063 | static void mvpp2_mac_link_up(struct phylink_config *config, unsigned int mode, |
6064 | phy_interface_t interface, struct phy_device *phy) |
6065 | { |
6066 | - struct net_device *dev = to_net_dev(config->dev); |
6067 | - struct mvpp2_port *port = netdev_priv(dev); |
6068 | + struct mvpp2_port *port = mvpp2_phylink_to_port(config); |
6069 | u32 val; |
6070 | |
6071 | if (!phylink_autoneg_inband(mode)) { |
6072 | @@ -5150,14 +5150,13 @@ static void mvpp2_mac_link_up(struct phylink_config *config, unsigned int mode, |
6073 | |
6074 | mvpp2_egress_enable(port); |
6075 | mvpp2_ingress_enable(port); |
6076 | - netif_tx_wake_all_queues(dev); |
6077 | + netif_tx_wake_all_queues(port->dev); |
6078 | } |
6079 | |
6080 | static void mvpp2_mac_link_down(struct phylink_config *config, |
6081 | unsigned int mode, phy_interface_t interface) |
6082 | { |
6083 | - struct net_device *dev = to_net_dev(config->dev); |
6084 | - struct mvpp2_port *port = netdev_priv(dev); |
6085 | + struct mvpp2_port *port = mvpp2_phylink_to_port(config); |
6086 | u32 val; |
6087 | |
6088 | if (!phylink_autoneg_inband(mode)) { |
6089 | @@ -5174,7 +5173,7 @@ static void mvpp2_mac_link_down(struct phylink_config *config, |
6090 | } |
6091 | } |
6092 | |
6093 | - netif_tx_stop_all_queues(dev); |
6094 | + netif_tx_stop_all_queues(port->dev); |
6095 | mvpp2_egress_disable(port); |
6096 | mvpp2_ingress_disable(port); |
6097 | |
6098 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
6099 | index 7c0a726277b00..f2657cd3ffa4f 100644 |
6100 | --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
6101 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
6102 | @@ -50,6 +50,7 @@ |
6103 | #ifdef CONFIG_RFS_ACCEL |
6104 | #include <linux/cpu_rmap.h> |
6105 | #endif |
6106 | +#include <linux/version.h> |
6107 | #include <net/devlink.h> |
6108 | #include "mlx5_core.h" |
6109 | #include "lib/eq.h" |
6110 | @@ -227,7 +228,10 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev) |
6111 | strncat(string, ",", remaining_size); |
6112 | |
6113 | remaining_size = max_t(int, 0, driver_ver_sz - strlen(string)); |
6114 | - strncat(string, DRIVER_VERSION, remaining_size); |
6115 | + |
6116 | + snprintf(string + strlen(string), remaining_size, "%u.%u.%u", |
6117 | + (u8)((LINUX_VERSION_CODE >> 16) & 0xff), (u8)((LINUX_VERSION_CODE >> 8) & 0xff), |
6118 | + (u16)(LINUX_VERSION_CODE & 0xffff)); |
6119 | |
6120 | /*Send the command*/ |
6121 | MLX5_SET(set_driver_version_in, in, opcode, |
6122 | diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c |
6123 | index 7526af27a59da..4bbdc53eaf3f3 100644 |
6124 | --- a/drivers/net/ethernet/microchip/lan743x_main.c |
6125 | +++ b/drivers/net/ethernet/microchip/lan743x_main.c |
6126 | @@ -1899,6 +1899,14 @@ static struct sk_buff *lan743x_rx_allocate_skb(struct lan743x_rx *rx) |
6127 | length, GFP_ATOMIC | GFP_DMA); |
6128 | } |
6129 | |
6130 | +static void lan743x_rx_update_tail(struct lan743x_rx *rx, int index) |
6131 | +{ |
6132 | + /* update the tail once per 8 descriptors */ |
6133 | + if ((index & 7) == 7) |
6134 | + lan743x_csr_write(rx->adapter, RX_TAIL(rx->channel_number), |
6135 | + index); |
6136 | +} |
6137 | + |
6138 | static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index, |
6139 | struct sk_buff *skb) |
6140 | { |
6141 | @@ -1929,6 +1937,7 @@ static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index, |
6142 | descriptor->data0 = (RX_DESC_DATA0_OWN_ | |
6143 | (length & RX_DESC_DATA0_BUF_LENGTH_MASK_)); |
6144 | skb_reserve(buffer_info->skb, RX_HEAD_PADDING); |
6145 | + lan743x_rx_update_tail(rx, index); |
6146 | |
6147 | return 0; |
6148 | } |
6149 | @@ -1947,6 +1956,7 @@ static void lan743x_rx_reuse_ring_element(struct lan743x_rx *rx, int index) |
6150 | descriptor->data0 = (RX_DESC_DATA0_OWN_ | |
6151 | ((buffer_info->buffer_length) & |
6152 | RX_DESC_DATA0_BUF_LENGTH_MASK_)); |
6153 | + lan743x_rx_update_tail(rx, index); |
6154 | } |
6155 | |
6156 | static void lan743x_rx_release_ring_element(struct lan743x_rx *rx, int index) |
6157 | @@ -2158,6 +2168,7 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) |
6158 | { |
6159 | struct lan743x_rx *rx = container_of(napi, struct lan743x_rx, napi); |
6160 | struct lan743x_adapter *adapter = rx->adapter; |
6161 | + int result = RX_PROCESS_RESULT_NOTHING_TO_DO; |
6162 | u32 rx_tail_flags = 0; |
6163 | int count; |
6164 | |
6165 | @@ -2166,27 +2177,19 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) |
6166 | lan743x_csr_write(adapter, DMAC_INT_STS, |
6167 | DMAC_INT_BIT_RXFRM_(rx->channel_number)); |
6168 | } |
6169 | - count = 0; |
6170 | - while (count < weight) { |
6171 | - int rx_process_result = lan743x_rx_process_packet(rx); |
6172 | - |
6173 | - if (rx_process_result == RX_PROCESS_RESULT_PACKET_RECEIVED) { |
6174 | - count++; |
6175 | - } else if (rx_process_result == |
6176 | - RX_PROCESS_RESULT_NOTHING_TO_DO) { |
6177 | + for (count = 0; count < weight; count++) { |
6178 | + result = lan743x_rx_process_packet(rx); |
6179 | + if (result == RX_PROCESS_RESULT_NOTHING_TO_DO) |
6180 | break; |
6181 | - } else if (rx_process_result == |
6182 | - RX_PROCESS_RESULT_PACKET_DROPPED) { |
6183 | - continue; |
6184 | - } |
6185 | } |
6186 | rx->frame_count += count; |
6187 | - if (count == weight) |
6188 | - goto done; |
6189 | + if (count == weight || result == RX_PROCESS_RESULT_PACKET_RECEIVED) |
6190 | + return weight; |
6191 | |
6192 | if (!napi_complete_done(napi, count)) |
6193 | - goto done; |
6194 | + return count; |
6195 | |
6196 | + /* re-arm interrupts, must write to rx tail on some chip variants */ |
6197 | if (rx->vector_flags & LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_SET) |
6198 | rx_tail_flags |= RX_TAIL_SET_TOP_INT_VEC_EN_; |
6199 | if (rx->vector_flags & LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_SET) { |
6200 | @@ -2196,10 +2199,10 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) |
6201 | INT_BIT_DMA_RX_(rx->channel_number)); |
6202 | } |
6203 | |
6204 | - /* update RX_TAIL */ |
6205 | - lan743x_csr_write(adapter, RX_TAIL(rx->channel_number), |
6206 | - rx_tail_flags | rx->last_tail); |
6207 | -done: |
6208 | + if (rx_tail_flags) |
6209 | + lan743x_csr_write(adapter, RX_TAIL(rx->channel_number), |
6210 | + rx_tail_flags | rx->last_tail); |
6211 | + |
6212 | return count; |
6213 | } |
6214 | |
6215 | @@ -2344,7 +2347,7 @@ static int lan743x_rx_open(struct lan743x_rx *rx) |
6216 | |
6217 | netif_napi_add(adapter->netdev, |
6218 | &rx->napi, lan743x_rx_napi_poll, |
6219 | - rx->ring_size - 1); |
6220 | + NAPI_POLL_WEIGHT); |
6221 | |
6222 | lan743x_csr_write(adapter, DMAC_CMD, |
6223 | DMAC_CMD_RX_SWR_(rx->channel_number)); |
6224 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
6225 | index c07438db30ba1..f2e5f494462b3 100644 |
6226 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
6227 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
6228 | @@ -2509,6 +2509,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
6229 | qlcnic_sriov_vf_register_map(ahw); |
6230 | break; |
6231 | default: |
6232 | + err = -EINVAL; |
6233 | goto err_out_free_hw_res; |
6234 | } |
6235 | |
6236 | diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
6237 | index 99e1a7bc06886..7cc8f405be1ad 100644 |
6238 | --- a/drivers/net/virtio_net.c |
6239 | +++ b/drivers/net/virtio_net.c |
6240 | @@ -3114,6 +3114,7 @@ static int virtnet_probe(struct virtio_device *vdev) |
6241 | dev_err(&vdev->dev, |
6242 | "device MTU appears to have changed it is now %d < %d", |
6243 | mtu, dev->min_mtu); |
6244 | + err = -EINVAL; |
6245 | goto free; |
6246 | } |
6247 | |
6248 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
6249 | index 630ac00a34ede..5502e145aa17b 100644 |
6250 | --- a/drivers/net/vxlan.c |
6251 | +++ b/drivers/net/vxlan.c |
6252 | @@ -3538,6 +3538,9 @@ static void vxlan_config_apply(struct net_device *dev, |
6253 | dev->gso_max_segs = lowerdev->gso_max_segs; |
6254 | |
6255 | needed_headroom = lowerdev->hard_header_len; |
6256 | + needed_headroom += lowerdev->needed_headroom; |
6257 | + |
6258 | + dev->needed_tailroom = lowerdev->needed_tailroom; |
6259 | |
6260 | max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : |
6261 | VXLAN_HEADROOM); |
6262 | diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c |
6263 | index 1e0343081be91..05c0d5e92475e 100644 |
6264 | --- a/drivers/net/wireless/ath/ath10k/usb.c |
6265 | +++ b/drivers/net/wireless/ath/ath10k/usb.c |
6266 | @@ -1009,6 +1009,8 @@ static int ath10k_usb_probe(struct usb_interface *interface, |
6267 | |
6268 | ar_usb = ath10k_usb_priv(ar); |
6269 | ret = ath10k_usb_create(ar, interface); |
6270 | + if (ret) |
6271 | + goto err; |
6272 | ar_usb->ar = ar; |
6273 | |
6274 | ar->dev_id = product_id; |
6275 | @@ -1021,7 +1023,7 @@ static int ath10k_usb_probe(struct usb_interface *interface, |
6276 | ret = ath10k_core_register(ar, &bus_params); |
6277 | if (ret) { |
6278 | ath10k_warn(ar, "failed to register driver core: %d\n", ret); |
6279 | - goto err; |
6280 | + goto err_usb_destroy; |
6281 | } |
6282 | |
6283 | /* TODO: remove this once USB support is fully implemented */ |
6284 | @@ -1029,6 +1031,9 @@ static int ath10k_usb_probe(struct usb_interface *interface, |
6285 | |
6286 | return 0; |
6287 | |
6288 | +err_usb_destroy: |
6289 | + ath10k_usb_destroy(ar); |
6290 | + |
6291 | err: |
6292 | ath10k_core_destroy(ar); |
6293 | |
6294 | diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
6295 | index 9d5b9df29c352..3ec71f52e8fe1 100644 |
6296 | --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
6297 | +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
6298 | @@ -1260,13 +1260,15 @@ static int ath10k_wmi_tlv_svc_avail_parse(struct ath10k *ar, u16 tag, u16 len, |
6299 | |
6300 | switch (tag) { |
6301 | case WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT: |
6302 | + arg->service_map_ext_valid = true; |
6303 | arg->service_map_ext_len = *(__le32 *)ptr; |
6304 | arg->service_map_ext = ptr + sizeof(__le32); |
6305 | return 0; |
6306 | default: |
6307 | break; |
6308 | } |
6309 | - return -EPROTO; |
6310 | + |
6311 | + return 0; |
6312 | } |
6313 | |
6314 | static int ath10k_wmi_tlv_op_pull_svc_avail(struct ath10k *ar, |
6315 | diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c |
6316 | index 2675174cc4fec..91604a14a8f46 100644 |
6317 | --- a/drivers/net/wireless/ath/ath10k/wmi.c |
6318 | +++ b/drivers/net/wireless/ath/ath10k/wmi.c |
6319 | @@ -5659,8 +5659,13 @@ void ath10k_wmi_event_service_available(struct ath10k *ar, struct sk_buff *skb) |
6320 | ret); |
6321 | } |
6322 | |
6323 | - ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map, |
6324 | - __le32_to_cpu(arg.service_map_ext_len)); |
6325 | + /* |
6326 | + * Initialization of "arg.service_map_ext_valid" to ZERO is necessary |
6327 | + * for the below logic to work. |
6328 | + */ |
6329 | + if (arg.service_map_ext_valid) |
6330 | + ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map, |
6331 | + __le32_to_cpu(arg.service_map_ext_len)); |
6332 | } |
6333 | |
6334 | static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb) |
6335 | diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h |
6336 | index e80dbe7e8f4cf..761bc4a7064df 100644 |
6337 | --- a/drivers/net/wireless/ath/ath10k/wmi.h |
6338 | +++ b/drivers/net/wireless/ath/ath10k/wmi.h |
6339 | @@ -6857,6 +6857,7 @@ struct wmi_svc_rdy_ev_arg { |
6340 | }; |
6341 | |
6342 | struct wmi_svc_avail_ev_arg { |
6343 | + bool service_map_ext_valid; |
6344 | __le32 service_map_ext_len; |
6345 | const __le32 *service_map_ext; |
6346 | }; |
6347 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
6348 | index 3be60aef54650..cb68f54a9c56e 100644 |
6349 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
6350 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
6351 | @@ -1936,16 +1936,18 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
6352 | fwreq = brcmf_pcie_prepare_fw_request(devinfo); |
6353 | if (!fwreq) { |
6354 | ret = -ENOMEM; |
6355 | - goto fail_bus; |
6356 | + goto fail_brcmf; |
6357 | } |
6358 | |
6359 | ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); |
6360 | if (ret < 0) { |
6361 | kfree(fwreq); |
6362 | - goto fail_bus; |
6363 | + goto fail_brcmf; |
6364 | } |
6365 | return 0; |
6366 | |
6367 | +fail_brcmf: |
6368 | + brcmf_free(&devinfo->pdev->dev); |
6369 | fail_bus: |
6370 | kfree(bus->msgbuf); |
6371 | kfree(bus); |
6372 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
6373 | index 38e6809f16c75..ef5521b9b3577 100644 |
6374 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
6375 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
6376 | @@ -4433,6 +4433,7 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) |
6377 | brcmf_sdiod_intr_unregister(bus->sdiodev); |
6378 | |
6379 | brcmf_detach(bus->sdiodev->dev); |
6380 | + brcmf_free(bus->sdiodev->dev); |
6381 | |
6382 | cancel_work_sync(&bus->datawork); |
6383 | if (bus->brcmf_wq) |
6384 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
6385 | index 3acbd5b7ab4b2..b04cc6214bac8 100644 |
6386 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
6387 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
6388 | @@ -316,6 +316,12 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { |
6389 | iwl_mvm_mu_mimo_grp_notif, RX_HANDLER_SYNC), |
6390 | RX_HANDLER_GRP(DATA_PATH_GROUP, STA_PM_NOTIF, |
6391 | iwl_mvm_sta_pm_notif, RX_HANDLER_SYNC), |
6392 | + RX_HANDLER_GRP(MAC_CONF_GROUP, PROBE_RESPONSE_DATA_NOTIF, |
6393 | + iwl_mvm_probe_resp_data_notif, |
6394 | + RX_HANDLER_ASYNC_LOCKED), |
6395 | + RX_HANDLER_GRP(MAC_CONF_GROUP, CHANNEL_SWITCH_NOA_NOTIF, |
6396 | + iwl_mvm_channel_switch_noa_notif, |
6397 | + RX_HANDLER_SYNC), |
6398 | }; |
6399 | #undef RX_HANDLER |
6400 | #undef RX_HANDLER_GRP |
6401 | diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c |
6402 | index b0b7eca1754ed..f34297fd453c0 100644 |
6403 | --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c |
6404 | +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c |
6405 | @@ -968,6 +968,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
6406 | |
6407 | {IWL_PCI_DEVICE(0x2725, 0x0090, iwlax211_2ax_cfg_so_gf_a0)}, |
6408 | {IWL_PCI_DEVICE(0x2725, 0x0020, iwlax210_2ax_cfg_ty_gf_a0)}, |
6409 | + {IWL_PCI_DEVICE(0x2725, 0x0024, iwlax210_2ax_cfg_ty_gf_a0)}, |
6410 | {IWL_PCI_DEVICE(0x2725, 0x0310, iwlax210_2ax_cfg_ty_gf_a0)}, |
6411 | {IWL_PCI_DEVICE(0x2725, 0x0510, iwlax210_2ax_cfg_ty_gf_a0)}, |
6412 | {IWL_PCI_DEVICE(0x2725, 0x0A10, iwlax210_2ax_cfg_ty_gf_a0)}, |
6413 | diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
6414 | index e753f43e0162f..e2368bfe3e468 100644 |
6415 | --- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
6416 | +++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
6417 | @@ -1234,13 +1234,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) |
6418 | if (skb->len < ETH_HLEN) |
6419 | goto drop; |
6420 | |
6421 | - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); |
6422 | - if (!ctx) |
6423 | - goto busy; |
6424 | - |
6425 | - memset(ctx->buf, 0, BULK_BUF_SIZE); |
6426 | - buf = ctx->buf->data; |
6427 | - |
6428 | tx_control = 0; |
6429 | |
6430 | err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control, |
6431 | @@ -1248,6 +1241,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) |
6432 | if (err) |
6433 | goto drop; |
6434 | |
6435 | + ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); |
6436 | + if (!ctx) |
6437 | + goto drop; |
6438 | + |
6439 | + memset(ctx->buf, 0, BULK_BUF_SIZE); |
6440 | + buf = ctx->buf->data; |
6441 | + |
6442 | { |
6443 | __le16 *tx_cntl = (__le16 *)buf; |
6444 | *tx_cntl = cpu_to_le16(tx_control); |
6445 | diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c |
6446 | index d14e55e3c9dad..5894566ec4805 100644 |
6447 | --- a/drivers/net/wireless/marvell/mwifiex/main.c |
6448 | +++ b/drivers/net/wireless/marvell/mwifiex/main.c |
6449 | @@ -1469,6 +1469,8 @@ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) |
6450 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); |
6451 | mwifiex_deauthenticate(priv, NULL); |
6452 | |
6453 | + mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); |
6454 | + |
6455 | mwifiex_uninit_sw(adapter); |
6456 | adapter->is_up = false; |
6457 | |
6458 | diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
6459 | index 4824be0c6231e..2b8db3f73d00b 100644 |
6460 | --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
6461 | +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
6462 | @@ -299,19 +299,19 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
6463 | sysctl_bar = qtnf_map_bar(pdev, QTN_SYSCTL_BAR); |
6464 | if (IS_ERR(sysctl_bar)) { |
6465 | pr_err("failed to map BAR%u\n", QTN_SYSCTL_BAR); |
6466 | - return ret; |
6467 | + return PTR_ERR(sysctl_bar); |
6468 | } |
6469 | |
6470 | dmareg_bar = qtnf_map_bar(pdev, QTN_DMA_BAR); |
6471 | if (IS_ERR(dmareg_bar)) { |
6472 | pr_err("failed to map BAR%u\n", QTN_DMA_BAR); |
6473 | - return ret; |
6474 | + return PTR_ERR(dmareg_bar); |
6475 | } |
6476 | |
6477 | epmem_bar = qtnf_map_bar(pdev, QTN_SHMEM_BAR); |
6478 | if (IS_ERR(epmem_bar)) { |
6479 | pr_err("failed to map BAR%u\n", QTN_SHMEM_BAR); |
6480 | - return ret; |
6481 | + return PTR_ERR(epmem_bar); |
6482 | } |
6483 | |
6484 | chipid = qtnf_chip_id_get(sysctl_bar); |
6485 | diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c |
6486 | index 4b9e406b84612..a296f4e0d324a 100644 |
6487 | --- a/drivers/net/wireless/rsi/rsi_91x_usb.c |
6488 | +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c |
6489 | @@ -733,24 +733,24 @@ static int rsi_reset_card(struct rsi_hw *adapter) |
6490 | if (ret < 0) |
6491 | goto fail; |
6492 | } else { |
6493 | - if ((rsi_usb_master_reg_write(adapter, |
6494 | - NWP_WWD_INTERRUPT_TIMER, |
6495 | - NWP_WWD_INT_TIMER_CLKS, |
6496 | - RSI_9116_REG_SIZE)) < 0) { |
6497 | + ret = rsi_usb_master_reg_write(adapter, |
6498 | + NWP_WWD_INTERRUPT_TIMER, |
6499 | + NWP_WWD_INT_TIMER_CLKS, |
6500 | + RSI_9116_REG_SIZE); |
6501 | + if (ret < 0) |
6502 | goto fail; |
6503 | - } |
6504 | - if ((rsi_usb_master_reg_write(adapter, |
6505 | - NWP_WWD_SYSTEM_RESET_TIMER, |
6506 | - NWP_WWD_SYS_RESET_TIMER_CLKS, |
6507 | - RSI_9116_REG_SIZE)) < 0) { |
6508 | + ret = rsi_usb_master_reg_write(adapter, |
6509 | + NWP_WWD_SYSTEM_RESET_TIMER, |
6510 | + NWP_WWD_SYS_RESET_TIMER_CLKS, |
6511 | + RSI_9116_REG_SIZE); |
6512 | + if (ret < 0) |
6513 | goto fail; |
6514 | - } |
6515 | - if ((rsi_usb_master_reg_write(adapter, |
6516 | - NWP_WWD_MODE_AND_RSTART, |
6517 | - NWP_WWD_TIMER_DISABLE, |
6518 | - RSI_9116_REG_SIZE)) < 0) { |
6519 | + ret = rsi_usb_master_reg_write(adapter, |
6520 | + NWP_WWD_MODE_AND_RSTART, |
6521 | + NWP_WWD_TIMER_DISABLE, |
6522 | + RSI_9116_REG_SIZE); |
6523 | + if (ret < 0) |
6524 | goto fail; |
6525 | - } |
6526 | } |
6527 | |
6528 | rsi_dbg(INFO_ZONE, "Reset card done\n"); |
6529 | diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c |
6530 | index f7fe56affbcd2..326b1cc1d2bcb 100644 |
6531 | --- a/drivers/net/wireless/st/cw1200/main.c |
6532 | +++ b/drivers/net/wireless/st/cw1200/main.c |
6533 | @@ -381,6 +381,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
6534 | CW1200_LINK_ID_MAX, |
6535 | cw1200_skb_dtor, |
6536 | priv)) { |
6537 | + destroy_workqueue(priv->workqueue); |
6538 | ieee80211_free_hw(hw); |
6539 | return NULL; |
6540 | } |
6541 | @@ -392,6 +393,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
6542 | for (; i > 0; i--) |
6543 | cw1200_queue_deinit(&priv->tx_queue[i - 1]); |
6544 | cw1200_queue_stats_deinit(&priv->tx_queue_stats); |
6545 | + destroy_workqueue(priv->workqueue); |
6546 | ieee80211_free_hw(hw); |
6547 | return NULL; |
6548 | } |
6549 | diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c |
6550 | index f533b7372d598..9e61a6f294641 100644 |
6551 | --- a/drivers/net/xen-netback/xenbus.c |
6552 | +++ b/drivers/net/xen-netback/xenbus.c |
6553 | @@ -713,12 +713,14 @@ static int xen_register_credit_watch(struct xenbus_device *dev, |
6554 | return -ENOMEM; |
6555 | snprintf(node, maxlen, "%s/rate", dev->nodename); |
6556 | vif->credit_watch.node = node; |
6557 | + vif->credit_watch.will_handle = NULL; |
6558 | vif->credit_watch.callback = xen_net_rate_changed; |
6559 | err = register_xenbus_watch(&vif->credit_watch); |
6560 | if (err) { |
6561 | pr_err("Failed to set watcher %s\n", vif->credit_watch.node); |
6562 | kfree(node); |
6563 | vif->credit_watch.node = NULL; |
6564 | + vif->credit_watch.will_handle = NULL; |
6565 | vif->credit_watch.callback = NULL; |
6566 | } |
6567 | return err; |
6568 | @@ -765,6 +767,7 @@ static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev, |
6569 | snprintf(node, maxlen, "%s/request-multicast-control", |
6570 | dev->otherend); |
6571 | vif->mcast_ctrl_watch.node = node; |
6572 | + vif->mcast_ctrl_watch.will_handle = NULL; |
6573 | vif->mcast_ctrl_watch.callback = xen_mcast_ctrl_changed; |
6574 | err = register_xenbus_watch(&vif->mcast_ctrl_watch); |
6575 | if (err) { |
6576 | @@ -772,6 +775,7 @@ static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev, |
6577 | vif->mcast_ctrl_watch.node); |
6578 | kfree(node); |
6579 | vif->mcast_ctrl_watch.node = NULL; |
6580 | + vif->mcast_ctrl_watch.will_handle = NULL; |
6581 | vif->mcast_ctrl_watch.callback = NULL; |
6582 | } |
6583 | return err; |
6584 | @@ -975,7 +979,7 @@ static void connect(struct backend_info *be) |
6585 | xenvif_carrier_on(be->vif); |
6586 | |
6587 | unregister_hotplug_status_watch(be); |
6588 | - err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, |
6589 | + err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL, |
6590 | hotplug_status_changed, |
6591 | "%s/%s", dev->nodename, "hotplug-status"); |
6592 | if (!err) |
6593 | diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c |
6594 | index be110d9cef022..310773a4ca66e 100644 |
6595 | --- a/drivers/nfc/s3fwrn5/firmware.c |
6596 | +++ b/drivers/nfc/s3fwrn5/firmware.c |
6597 | @@ -293,8 +293,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info) |
6598 | if (ret < 0) |
6599 | return ret; |
6600 | |
6601 | - if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) |
6602 | + if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) { |
6603 | + release_firmware(fw->fw); |
6604 | return -EINVAL; |
6605 | + } |
6606 | |
6607 | memcpy(fw->date, fw->fw->data + 0x00, 12); |
6608 | fw->date[12] = '\0'; |
6609 | diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c |
6610 | index 47a4828b8b310..9251441fd8a35 100644 |
6611 | --- a/drivers/nvdimm/label.c |
6612 | +++ b/drivers/nvdimm/label.c |
6613 | @@ -980,6 +980,15 @@ static int __blk_label_update(struct nd_region *nd_region, |
6614 | } |
6615 | } |
6616 | |
6617 | + /* release slots associated with any invalidated UUIDs */ |
6618 | + mutex_lock(&nd_mapping->lock); |
6619 | + list_for_each_entry_safe(label_ent, e, &nd_mapping->labels, list) |
6620 | + if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags)) { |
6621 | + reap_victim(nd_mapping, label_ent); |
6622 | + list_move(&label_ent->list, &list); |
6623 | + } |
6624 | + mutex_unlock(&nd_mapping->lock); |
6625 | + |
6626 | /* |
6627 | * Find the resource associated with the first label in the set |
6628 | * per the v1.2 namespace specification. |
6629 | @@ -999,8 +1008,10 @@ static int __blk_label_update(struct nd_region *nd_region, |
6630 | if (is_old_resource(res, old_res_list, old_num_resources)) |
6631 | continue; /* carry-over */ |
6632 | slot = nd_label_alloc_slot(ndd); |
6633 | - if (slot == UINT_MAX) |
6634 | + if (slot == UINT_MAX) { |
6635 | + rc = -ENXIO; |
6636 | goto abort; |
6637 | + } |
6638 | dev_dbg(ndd->dev, "allocated: %d\n", slot); |
6639 | |
6640 | nd_label = to_label(ndd, slot); |
6641 | diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c |
6642 | index 933a4346ae5d6..c6b1c18165e5c 100644 |
6643 | --- a/drivers/pci/controller/pcie-iproc.c |
6644 | +++ b/drivers/pci/controller/pcie-iproc.c |
6645 | @@ -307,7 +307,7 @@ enum iproc_pcie_reg { |
6646 | }; |
6647 | |
6648 | /* iProc PCIe PAXB BCMA registers */ |
6649 | -static const u16 iproc_pcie_reg_paxb_bcma[] = { |
6650 | +static const u16 iproc_pcie_reg_paxb_bcma[IPROC_PCIE_MAX_NUM_REG] = { |
6651 | [IPROC_PCIE_CLK_CTRL] = 0x000, |
6652 | [IPROC_PCIE_CFG_IND_ADDR] = 0x120, |
6653 | [IPROC_PCIE_CFG_IND_DATA] = 0x124, |
6654 | @@ -318,7 +318,7 @@ static const u16 iproc_pcie_reg_paxb_bcma[] = { |
6655 | }; |
6656 | |
6657 | /* iProc PCIe PAXB registers */ |
6658 | -static const u16 iproc_pcie_reg_paxb[] = { |
6659 | +static const u16 iproc_pcie_reg_paxb[IPROC_PCIE_MAX_NUM_REG] = { |
6660 | [IPROC_PCIE_CLK_CTRL] = 0x000, |
6661 | [IPROC_PCIE_CFG_IND_ADDR] = 0x120, |
6662 | [IPROC_PCIE_CFG_IND_DATA] = 0x124, |
6663 | @@ -334,7 +334,7 @@ static const u16 iproc_pcie_reg_paxb[] = { |
6664 | }; |
6665 | |
6666 | /* iProc PCIe PAXB v2 registers */ |
6667 | -static const u16 iproc_pcie_reg_paxb_v2[] = { |
6668 | +static const u16 iproc_pcie_reg_paxb_v2[IPROC_PCIE_MAX_NUM_REG] = { |
6669 | [IPROC_PCIE_CLK_CTRL] = 0x000, |
6670 | [IPROC_PCIE_CFG_IND_ADDR] = 0x120, |
6671 | [IPROC_PCIE_CFG_IND_DATA] = 0x124, |
6672 | @@ -363,7 +363,7 @@ static const u16 iproc_pcie_reg_paxb_v2[] = { |
6673 | }; |
6674 | |
6675 | /* iProc PCIe PAXC v1 registers */ |
6676 | -static const u16 iproc_pcie_reg_paxc[] = { |
6677 | +static const u16 iproc_pcie_reg_paxc[IPROC_PCIE_MAX_NUM_REG] = { |
6678 | [IPROC_PCIE_CLK_CTRL] = 0x000, |
6679 | [IPROC_PCIE_CFG_IND_ADDR] = 0x1f0, |
6680 | [IPROC_PCIE_CFG_IND_DATA] = 0x1f4, |
6681 | @@ -372,7 +372,7 @@ static const u16 iproc_pcie_reg_paxc[] = { |
6682 | }; |
6683 | |
6684 | /* iProc PCIe PAXC v2 registers */ |
6685 | -static const u16 iproc_pcie_reg_paxc_v2[] = { |
6686 | +static const u16 iproc_pcie_reg_paxc_v2[IPROC_PCIE_MAX_NUM_REG] = { |
6687 | [IPROC_PCIE_MSI_GIC_MODE] = 0x050, |
6688 | [IPROC_PCIE_MSI_BASE_ADDR] = 0x074, |
6689 | [IPROC_PCIE_MSI_WINDOW_SIZE] = 0x078, |
6690 | diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c |
6691 | index 3f40f951a6cdc..e30c2a78a88f5 100644 |
6692 | --- a/drivers/pci/pci-acpi.c |
6693 | +++ b/drivers/pci/pci-acpi.c |
6694 | @@ -1060,7 +1060,7 @@ static int acpi_pci_propagate_wakeup(struct pci_bus *bus, bool enable) |
6695 | { |
6696 | while (bus->parent) { |
6697 | if (acpi_pm_device_can_wakeup(&bus->self->dev)) |
6698 | - return acpi_pm_set_bridge_wakeup(&bus->self->dev, enable); |
6699 | + return acpi_pm_set_device_wakeup(&bus->self->dev, enable); |
6700 | |
6701 | bus = bus->parent; |
6702 | } |
6703 | @@ -1068,7 +1068,7 @@ static int acpi_pci_propagate_wakeup(struct pci_bus *bus, bool enable) |
6704 | /* We have reached the root bus. */ |
6705 | if (bus->bridge) { |
6706 | if (acpi_pm_device_can_wakeup(bus->bridge)) |
6707 | - return acpi_pm_set_bridge_wakeup(bus->bridge, enable); |
6708 | + return acpi_pm_set_device_wakeup(bus->bridge, enable); |
6709 | } |
6710 | return 0; |
6711 | } |
6712 | diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
6713 | index b1b2c8ddbc927..89dece8a41321 100644 |
6714 | --- a/drivers/pci/pci.c |
6715 | +++ b/drivers/pci/pci.c |
6716 | @@ -6129,19 +6129,21 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev, |
6717 | while (*p) { |
6718 | count = 0; |
6719 | if (sscanf(p, "%d%n", &align_order, &count) == 1 && |
6720 | - p[count] == '@') { |
6721 | + p[count] == '@') { |
6722 | p += count + 1; |
6723 | + if (align_order > 63) { |
6724 | + pr_err("PCI: Invalid requested alignment (order %d)\n", |
6725 | + align_order); |
6726 | + align_order = PAGE_SHIFT; |
6727 | + } |
6728 | } else { |
6729 | - align_order = -1; |
6730 | + align_order = PAGE_SHIFT; |
6731 | } |
6732 | |
6733 | ret = pci_dev_str_match(dev, p, &p); |
6734 | if (ret == 1) { |
6735 | *resize = true; |
6736 | - if (align_order == -1) |
6737 | - align = PAGE_SIZE; |
6738 | - else |
6739 | - align = 1 << align_order; |
6740 | + align = 1ULL << align_order; |
6741 | break; |
6742 | } else if (ret < 0) { |
6743 | pr_err("PCI: Can't parse resource_alignment parameter: %s\n", |
6744 | diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c |
6745 | index 1f087746b7bb0..1e3ed6ec0a4af 100644 |
6746 | --- a/drivers/pci/slot.c |
6747 | +++ b/drivers/pci/slot.c |
6748 | @@ -308,6 +308,9 @@ placeholder: |
6749 | goto err; |
6750 | } |
6751 | |
6752 | + INIT_LIST_HEAD(&slot->list); |
6753 | + list_add(&slot->list, &parent->slots); |
6754 | + |
6755 | err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL, |
6756 | "%s", slot_name); |
6757 | if (err) { |
6758 | @@ -315,9 +318,6 @@ placeholder: |
6759 | goto err; |
6760 | } |
6761 | |
6762 | - INIT_LIST_HEAD(&slot->list); |
6763 | - list_add(&slot->list, &parent->slots); |
6764 | - |
6765 | down_read(&pci_bus_sem); |
6766 | list_for_each_entry(dev, &parent->devices, bus_list) |
6767 | if (PCI_SLOT(dev->devfn) == slot_nr) |
6768 | diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
6769 | index 5087b7c44d55b..cfb98bba7715b 100644 |
6770 | --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
6771 | +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
6772 | @@ -654,8 +654,10 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) |
6773 | */ |
6774 | pm_runtime_enable(dev); |
6775 | phy_usb2_ops = of_device_get_match_data(dev); |
6776 | - if (!phy_usb2_ops) |
6777 | - return -EINVAL; |
6778 | + if (!phy_usb2_ops) { |
6779 | + ret = -EINVAL; |
6780 | + goto error; |
6781 | + } |
6782 | |
6783 | mutex_init(&channel->lock); |
6784 | for (i = 0; i < NUM_OF_PHYS; i++) { |
6785 | diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c |
6786 | index 93b5654ff2828..22aca6d182c0c 100644 |
6787 | --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c |
6788 | +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c |
6789 | @@ -277,14 +277,76 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, |
6790 | static bool aspeed_expr_is_gpio(const struct aspeed_sig_expr *expr) |
6791 | { |
6792 | /* |
6793 | - * The signal type is GPIO if the signal name has "GPI" as a prefix. |
6794 | - * strncmp (rather than strcmp) is used to implement the prefix |
6795 | - * requirement. |
6796 | + * We need to differentiate between GPIO and non-GPIO signals to |
6797 | + * implement the gpio_request_enable() interface. For better or worse |
6798 | + * the ASPEED pinctrl driver uses the expression names to determine |
6799 | + * whether an expression will mux a pin for GPIO. |
6800 | * |
6801 | - * expr->signal might look like "GPIOB1" in the GPIO case. |
6802 | - * expr->signal might look like "GPIT0" in the GPI case. |
6803 | + * Generally we have the following - A GPIO such as B1 has: |
6804 | + * |
6805 | + * - expr->signal set to "GPIOB1" |
6806 | + * - expr->function set to "GPIOB1" |
6807 | + * |
6808 | + * Using this fact we can determine whether the provided expression is |
6809 | + * a GPIO expression by testing the signal name for the string prefix |
6810 | + * "GPIO". |
6811 | + * |
6812 | + * However, some GPIOs are input-only, and the ASPEED datasheets name |
6813 | + * them differently. An input-only GPIO such as T0 has: |
6814 | + * |
6815 | + * - expr->signal set to "GPIT0" |
6816 | + * - expr->function set to "GPIT0" |
6817 | + * |
6818 | + * It's tempting to generalise the prefix test from "GPIO" to "GPI" to |
6819 | + * account for both GPIOs and GPIs, but in doing so we run aground on |
6820 | + * another feature: |
6821 | + * |
6822 | + * Some pins in the ASPEED BMC SoCs have a "pass-through" GPIO |
6823 | + * function where the input state of one pin is replicated as the |
6824 | + * output state of another (as if they were shorted together - a mux |
6825 | + * configuration that is typically enabled by hardware strapping). |
6826 | + * This feature allows the BMC to pass e.g. power button state through |
6827 | + * to the host while the BMC is yet to boot, but take control of the |
6828 | + * button state once the BMC has booted by muxing each pin as a |
6829 | + * separate, pin-specific GPIO. |
6830 | + * |
6831 | + * Conceptually this pass-through mode is a form of GPIO and is named |
6832 | + * as such in the datasheets, e.g. "GPID0". This naming similarity |
6833 | + * trips us up with the simple GPI-prefixed-signal-name scheme |
6834 | + * discussed above, as the pass-through configuration is not what we |
6835 | + * want when muxing a pin as GPIO for the GPIO subsystem. |
6836 | + * |
6837 | + * On e.g. the AST2400, a pass-through function "GPID0" is grouped on |
6838 | + * balls A18 and D16, where we have: |
6839 | + * |
6840 | + * For ball A18: |
6841 | + * - expr->signal set to "GPID0IN" |
6842 | + * - expr->function set to "GPID0" |
6843 | + * |
6844 | + * For ball D16: |
6845 | + * - expr->signal set to "GPID0OUT" |
6846 | + * - expr->function set to "GPID0" |
6847 | + * |
6848 | + * By contrast, the pin-specific GPIO expressions for the same pins are |
6849 | + * as follows: |
6850 | + * |
6851 | + * For ball A18: |
6852 | + * - expr->signal looks like "GPIOD0" |
6853 | + * - expr->function looks like "GPIOD0" |
6854 | + * |
6855 | + * For ball D16: |
6856 | + * - expr->signal looks like "GPIOD1" |
6857 | + * - expr->function looks like "GPIOD1" |
6858 | + * |
6859 | + * Testing both the signal _and_ function names gives us the means |
6860 | + * differentiate the pass-through GPIO pinmux configuration from the |
6861 | + * pin-specific configuration that the GPIO subsystem is after: An |
6862 | + * expression is a pin-specific (non-pass-through) GPIO configuration |
6863 | + * if the signal prefix is "GPI" and the signal name matches the |
6864 | + * function name. |
6865 | */ |
6866 | - return strncmp(expr->signal, "GPI", 3) == 0; |
6867 | + return !strncmp(expr->signal, "GPI", 3) && |
6868 | + !strcmp(expr->signal, expr->function); |
6869 | } |
6870 | |
6871 | static bool aspeed_gpio_in_exprs(const struct aspeed_sig_expr **exprs) |
6872 | diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.h b/drivers/pinctrl/aspeed/pinmux-aspeed.h |
6873 | index 140c5ce9fbc11..0aaa20653536f 100644 |
6874 | --- a/drivers/pinctrl/aspeed/pinmux-aspeed.h |
6875 | +++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h |
6876 | @@ -452,10 +452,11 @@ struct aspeed_sig_desc { |
6877 | * evaluation of the descriptors. |
6878 | * |
6879 | * @signal: The signal name for the priority level on the pin. If the signal |
6880 | - * type is GPIO, then the signal name must begin with the string |
6881 | - * "GPIO", e.g. GPIOA0, GPIOT4 etc. |
6882 | + * type is GPIO, then the signal name must begin with the |
6883 | + * prefix "GPI", e.g. GPIOA0, GPIT0 etc. |
6884 | * @function: The name of the function the signal participates in for the |
6885 | - * associated expression |
6886 | + * associated expression. For pin-specific GPIO, the function |
6887 | + * name must match the signal name. |
6888 | * @ndescs: The number of signal descriptors in the expression |
6889 | * @descs: Pointer to an array of signal descriptors that comprise the |
6890 | * function expression |
6891 | diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c |
6892 | index 5a1174a8e2bac..d05f20ca90d7e 100644 |
6893 | --- a/drivers/pinctrl/intel/pinctrl-baytrail.c |
6894 | +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c |
6895 | @@ -1060,7 +1060,6 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
6896 | break; |
6897 | case PIN_CONFIG_INPUT_DEBOUNCE: |
6898 | debounce = readl(db_reg); |
6899 | - debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6900 | |
6901 | if (arg) |
6902 | conf |= BYT_DEBOUNCE_EN; |
6903 | @@ -1069,24 +1068,31 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
6904 | |
6905 | switch (arg) { |
6906 | case 375: |
6907 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6908 | debounce |= BYT_DEBOUNCE_PULSE_375US; |
6909 | break; |
6910 | case 750: |
6911 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6912 | debounce |= BYT_DEBOUNCE_PULSE_750US; |
6913 | break; |
6914 | case 1500: |
6915 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6916 | debounce |= BYT_DEBOUNCE_PULSE_1500US; |
6917 | break; |
6918 | case 3000: |
6919 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6920 | debounce |= BYT_DEBOUNCE_PULSE_3MS; |
6921 | break; |
6922 | case 6000: |
6923 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6924 | debounce |= BYT_DEBOUNCE_PULSE_6MS; |
6925 | break; |
6926 | case 12000: |
6927 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6928 | debounce |= BYT_DEBOUNCE_PULSE_12MS; |
6929 | break; |
6930 | case 24000: |
6931 | + debounce &= ~BYT_DEBOUNCE_PULSE_MASK; |
6932 | debounce |= BYT_DEBOUNCE_PULSE_24MS; |
6933 | break; |
6934 | default: |
6935 | diff --git a/drivers/pinctrl/intel/pinctrl-merrifield.c b/drivers/pinctrl/intel/pinctrl-merrifield.c |
6936 | index 04ca8ae95df83..9e91d83b01388 100644 |
6937 | --- a/drivers/pinctrl/intel/pinctrl-merrifield.c |
6938 | +++ b/drivers/pinctrl/intel/pinctrl-merrifield.c |
6939 | @@ -741,6 +741,10 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin, |
6940 | mask |= BUFCFG_Px_EN_MASK | BUFCFG_PUPD_VAL_MASK; |
6941 | bits |= BUFCFG_PU_EN; |
6942 | |
6943 | + /* Set default strength value in case none is given */ |
6944 | + if (arg == 1) |
6945 | + arg = 20000; |
6946 | + |
6947 | switch (arg) { |
6948 | case 50000: |
6949 | bits |= BUFCFG_PUPD_VAL_50K << BUFCFG_PUPD_VAL_SHIFT; |
6950 | @@ -761,6 +765,10 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin, |
6951 | mask |= BUFCFG_Px_EN_MASK | BUFCFG_PUPD_VAL_MASK; |
6952 | bits |= BUFCFG_PD_EN; |
6953 | |
6954 | + /* Set default strength value in case none is given */ |
6955 | + if (arg == 1) |
6956 | + arg = 20000; |
6957 | + |
6958 | switch (arg) { |
6959 | case 50000: |
6960 | bits |= BUFCFG_PUPD_VAL_50K << BUFCFG_PUPD_VAL_SHIFT; |
6961 | diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c |
6962 | index 62c02b969327f..7521a924dffb0 100644 |
6963 | --- a/drivers/pinctrl/pinctrl-falcon.c |
6964 | +++ b/drivers/pinctrl/pinctrl-falcon.c |
6965 | @@ -431,24 +431,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) |
6966 | |
6967 | /* load and remap the pad resources of the different banks */ |
6968 | for_each_compatible_node(np, NULL, "lantiq,pad-falcon") { |
6969 | - struct platform_device *ppdev = of_find_device_by_node(np); |
6970 | const __be32 *bank = of_get_property(np, "lantiq,bank", NULL); |
6971 | struct resource res; |
6972 | + struct platform_device *ppdev; |
6973 | u32 avail; |
6974 | int pins; |
6975 | |
6976 | if (!of_device_is_available(np)) |
6977 | continue; |
6978 | |
6979 | - if (!ppdev) { |
6980 | - dev_err(&pdev->dev, "failed to find pad pdev\n"); |
6981 | - continue; |
6982 | - } |
6983 | if (!bank || *bank >= PORTS) |
6984 | continue; |
6985 | if (of_address_to_resource(np, 0, &res)) |
6986 | continue; |
6987 | + |
6988 | + ppdev = of_find_device_by_node(np); |
6989 | + if (!ppdev) { |
6990 | + dev_err(&pdev->dev, "failed to find pad pdev\n"); |
6991 | + continue; |
6992 | + } |
6993 | + |
6994 | falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL); |
6995 | + put_device(&ppdev->dev); |
6996 | if (IS_ERR(falcon_info.clk[*bank])) { |
6997 | dev_err(&ppdev->dev, "failed to get clock\n"); |
6998 | of_node_put(np); |
6999 | diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
7000 | index 0cbca30b75dcf..77783582080c7 100644 |
7001 | --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
7002 | +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
7003 | @@ -1130,20 +1130,22 @@ static void sunxi_pinctrl_irq_handler(struct irq_desc *desc) |
7004 | if (bank == pctl->desc->irq_banks) |
7005 | return; |
7006 | |
7007 | + chained_irq_enter(chip, desc); |
7008 | + |
7009 | reg = sunxi_irq_status_reg_from_bank(pctl->desc, bank); |
7010 | val = readl(pctl->membase + reg); |
7011 | |
7012 | if (val) { |
7013 | int irqoffset; |
7014 | |
7015 | - chained_irq_enter(chip, desc); |
7016 | for_each_set_bit(irqoffset, &val, IRQ_PER_BANK) { |
7017 | int pin_irq = irq_find_mapping(pctl->domain, |
7018 | bank * IRQ_PER_BANK + irqoffset); |
7019 | generic_handle_irq(pin_irq); |
7020 | } |
7021 | - chained_irq_exit(chip, desc); |
7022 | } |
7023 | + |
7024 | + chained_irq_exit(chip, desc); |
7025 | } |
7026 | |
7027 | static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl, |
7028 | diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c |
7029 | index a831bd5a5b2ff..5e4521b014280 100644 |
7030 | --- a/drivers/platform/chrome/cros_ec_spi.c |
7031 | +++ b/drivers/platform/chrome/cros_ec_spi.c |
7032 | @@ -739,7 +739,6 @@ static int cros_ec_spi_probe(struct spi_device *spi) |
7033 | int err; |
7034 | |
7035 | spi->bits_per_word = 8; |
7036 | - spi->mode = SPI_MODE_0; |
7037 | spi->rt = true; |
7038 | err = spi_setup(spi); |
7039 | if (err < 0) |
7040 | diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c |
7041 | index fe59b0ebff314..ceb8e701028df 100644 |
7042 | --- a/drivers/platform/x86/dell-smbios-base.c |
7043 | +++ b/drivers/platform/x86/dell-smbios-base.c |
7044 | @@ -594,6 +594,7 @@ static int __init dell_smbios_init(void) |
7045 | if (wmi && smm) { |
7046 | pr_err("No SMBIOS backends available (wmi: %d, smm: %d)\n", |
7047 | wmi, smm); |
7048 | + ret = -ENODEV; |
7049 | goto fail_create_group; |
7050 | } |
7051 | |
7052 | diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
7053 | index 701d1ddda4b11..bc8b0098d4f32 100644 |
7054 | --- a/drivers/platform/x86/intel-vbtn.c |
7055 | +++ b/drivers/platform/x86/intel-vbtn.c |
7056 | @@ -203,6 +203,12 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { |
7057 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion 13 x360 PC"), |
7058 | }, |
7059 | }, |
7060 | + { |
7061 | + .matches = { |
7062 | + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
7063 | + DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271"), |
7064 | + }, |
7065 | + }, |
7066 | {} /* Array terminator */ |
7067 | }; |
7068 | |
7069 | diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c |
7070 | index 59b5b7eebb05a..54db334e52c13 100644 |
7071 | --- a/drivers/platform/x86/mlx-platform.c |
7072 | +++ b/drivers/platform/x86/mlx-platform.c |
7073 | @@ -234,15 +234,6 @@ static struct i2c_mux_reg_platform_data mlxplat_mux_data[] = { |
7074 | }; |
7075 | |
7076 | /* Platform hotplug devices */ |
7077 | -static struct i2c_board_info mlxplat_mlxcpld_psu[] = { |
7078 | - { |
7079 | - I2C_BOARD_INFO("24c02", 0x51), |
7080 | - }, |
7081 | - { |
7082 | - I2C_BOARD_INFO("24c02", 0x50), |
7083 | - }, |
7084 | -}; |
7085 | - |
7086 | static struct i2c_board_info mlxplat_mlxcpld_pwr[] = { |
7087 | { |
7088 | I2C_BOARD_INFO("dps460", 0x59), |
7089 | @@ -273,15 +264,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_psu_items_data[] = { |
7090 | .label = "psu1", |
7091 | .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
7092 | .mask = BIT(0), |
7093 | - .hpdev.brdinfo = &mlxplat_mlxcpld_psu[0], |
7094 | - .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, |
7095 | + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
7096 | }, |
7097 | { |
7098 | .label = "psu2", |
7099 | .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
7100 | .mask = BIT(1), |
7101 | - .hpdev.brdinfo = &mlxplat_mlxcpld_psu[1], |
7102 | - .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, |
7103 | + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
7104 | }, |
7105 | }; |
7106 | |
7107 | @@ -348,7 +337,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { |
7108 | .aggr_mask = MLXPLAT_CPLD_AGGR_PSU_MASK_DEF, |
7109 | .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
7110 | .mask = MLXPLAT_CPLD_PSU_MASK, |
7111 | - .count = ARRAY_SIZE(mlxplat_mlxcpld_psu), |
7112 | + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_psu_items_data), |
7113 | .inversed = 1, |
7114 | .health = false, |
7115 | }, |
7116 | @@ -357,7 +346,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { |
7117 | .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, |
7118 | .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, |
7119 | .mask = MLXPLAT_CPLD_PWR_MASK, |
7120 | - .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr), |
7121 | + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), |
7122 | .inversed = 0, |
7123 | .health = false, |
7124 | }, |
7125 | @@ -366,7 +355,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { |
7126 | .aggr_mask = MLXPLAT_CPLD_AGGR_FAN_MASK_DEF, |
7127 | .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, |
7128 | .mask = MLXPLAT_CPLD_FAN_MASK, |
7129 | - .count = ARRAY_SIZE(mlxplat_mlxcpld_fan), |
7130 | + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), |
7131 | .inversed = 1, |
7132 | .health = false, |
7133 | }, |
7134 | @@ -444,15 +433,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_msn274x_psu_items_data[] = { |
7135 | .label = "psu1", |
7136 | .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
7137 | .mask = BIT(0), |
7138 | - .hpdev.brdinfo = &mlxplat_mlxcpld_psu[0], |
7139 | - .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, |
7140 | + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
7141 | }, |
7142 | { |
7143 | .label = "psu2", |
7144 | .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
7145 | .mask = BIT(1), |
7146 | - .hpdev.brdinfo = &mlxplat_mlxcpld_psu[1], |
7147 | - .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, |
7148 | + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
7149 | }, |
7150 | }; |
7151 | |
7152 | diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c |
7153 | index cf4c67b2d2359..7d09e49f04d3b 100644 |
7154 | --- a/drivers/power/supply/axp288_charger.c |
7155 | +++ b/drivers/power/supply/axp288_charger.c |
7156 | @@ -548,14 +548,15 @@ out: |
7157 | |
7158 | /* |
7159 | * The HP Pavilion x2 10 series comes in a number of variants: |
7160 | - * Bay Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "815D" |
7161 | - * Cherry Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "813E" |
7162 | - * Cherry Trail SoC + TI PMIC, DMI_BOARD_NAME: "827C" or "82F4" |
7163 | + * Bay Trail SoC + AXP288 PMIC, Micro-USB, DMI_BOARD_NAME: "8021" |
7164 | + * Bay Trail SoC + AXP288 PMIC, Type-C, DMI_BOARD_NAME: "815D" |
7165 | + * Cherry Trail SoC + AXP288 PMIC, Type-C, DMI_BOARD_NAME: "813E" |
7166 | + * Cherry Trail SoC + TI PMIC, Type-C, DMI_BOARD_NAME: "827C" or "82F4" |
7167 | * |
7168 | - * The variants with the AXP288 PMIC are all kinds of special: |
7169 | + * The variants with the AXP288 + Type-C connector are all kinds of special: |
7170 | * |
7171 | - * 1. All variants use a Type-C connector which the AXP288 does not support, so |
7172 | - * when using a Type-C charger it is not recognized. Unlike most AXP288 devices, |
7173 | + * 1. They use a Type-C connector which the AXP288 does not support, so when |
7174 | + * using a Type-C charger it is not recognized. Unlike most AXP288 devices, |
7175 | * this model actually has mostly working ACPI AC / Battery code, the ACPI code |
7176 | * "solves" this by simply setting the input_current_limit to 3A. |
7177 | * There are still some issues with the ACPI code, so we use this native driver, |
7178 | @@ -578,12 +579,17 @@ out: |
7179 | */ |
7180 | static const struct dmi_system_id axp288_hp_x2_dmi_ids[] = { |
7181 | { |
7182 | - /* |
7183 | - * Bay Trail model has "Hewlett-Packard" as sys_vendor, Cherry |
7184 | - * Trail model has "HP", so we only match on product_name. |
7185 | - */ |
7186 | .matches = { |
7187 | - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), |
7188 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
7189 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), |
7190 | + DMI_EXACT_MATCH(DMI_BOARD_NAME, "815D"), |
7191 | + }, |
7192 | + }, |
7193 | + { |
7194 | + .matches = { |
7195 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "HP"), |
7196 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), |
7197 | + DMI_EXACT_MATCH(DMI_BOARD_NAME, "813E"), |
7198 | }, |
7199 | }, |
7200 | {} /* Terminating entry */ |
7201 | diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c |
7202 | index 453d6332d43a7..1ae5d6d42c9e3 100644 |
7203 | --- a/drivers/power/supply/bq24190_charger.c |
7204 | +++ b/drivers/power/supply/bq24190_charger.c |
7205 | @@ -448,8 +448,10 @@ static ssize_t bq24190_sysfs_show(struct device *dev, |
7206 | return -EINVAL; |
7207 | |
7208 | ret = pm_runtime_get_sync(bdi->dev); |
7209 | - if (ret < 0) |
7210 | + if (ret < 0) { |
7211 | + pm_runtime_put_noidle(bdi->dev); |
7212 | return ret; |
7213 | + } |
7214 | |
7215 | ret = bq24190_read_mask(bdi, info->reg, info->mask, info->shift, &v); |
7216 | if (ret) |
7217 | @@ -1075,8 +1077,10 @@ static int bq24190_charger_get_property(struct power_supply *psy, |
7218 | dev_dbg(bdi->dev, "prop: %d\n", psp); |
7219 | |
7220 | ret = pm_runtime_get_sync(bdi->dev); |
7221 | - if (ret < 0) |
7222 | + if (ret < 0) { |
7223 | + pm_runtime_put_noidle(bdi->dev); |
7224 | return ret; |
7225 | + } |
7226 | |
7227 | switch (psp) { |
7228 | case POWER_SUPPLY_PROP_CHARGE_TYPE: |
7229 | @@ -1147,8 +1151,10 @@ static int bq24190_charger_set_property(struct power_supply *psy, |
7230 | dev_dbg(bdi->dev, "prop: %d\n", psp); |
7231 | |
7232 | ret = pm_runtime_get_sync(bdi->dev); |
7233 | - if (ret < 0) |
7234 | + if (ret < 0) { |
7235 | + pm_runtime_put_noidle(bdi->dev); |
7236 | return ret; |
7237 | + } |
7238 | |
7239 | switch (psp) { |
7240 | case POWER_SUPPLY_PROP_ONLINE: |
7241 | @@ -1408,8 +1414,10 @@ static int bq24190_battery_get_property(struct power_supply *psy, |
7242 | dev_dbg(bdi->dev, "prop: %d\n", psp); |
7243 | |
7244 | ret = pm_runtime_get_sync(bdi->dev); |
7245 | - if (ret < 0) |
7246 | + if (ret < 0) { |
7247 | + pm_runtime_put_noidle(bdi->dev); |
7248 | return ret; |
7249 | + } |
7250 | |
7251 | switch (psp) { |
7252 | case POWER_SUPPLY_PROP_STATUS: |
7253 | @@ -1454,8 +1462,10 @@ static int bq24190_battery_set_property(struct power_supply *psy, |
7254 | dev_dbg(bdi->dev, "prop: %d\n", psp); |
7255 | |
7256 | ret = pm_runtime_get_sync(bdi->dev); |
7257 | - if (ret < 0) |
7258 | + if (ret < 0) { |
7259 | + pm_runtime_put_noidle(bdi->dev); |
7260 | return ret; |
7261 | + } |
7262 | |
7263 | switch (psp) { |
7264 | case POWER_SUPPLY_PROP_ONLINE: |
7265 | diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c |
7266 | index 333ba83006e48..a12a1ad9b5fe3 100644 |
7267 | --- a/drivers/ps3/ps3stor_lib.c |
7268 | +++ b/drivers/ps3/ps3stor_lib.c |
7269 | @@ -189,7 +189,7 @@ int ps3stor_setup(struct ps3_storage_device *dev, irq_handler_t handler) |
7270 | dev->bounce_lpar = ps3_mm_phys_to_lpar(__pa(dev->bounce_buf)); |
7271 | dev->bounce_dma = dma_map_single(&dev->sbd.core, dev->bounce_buf, |
7272 | dev->bounce_size, DMA_BIDIRECTIONAL); |
7273 | - if (!dev->bounce_dma) { |
7274 | + if (dma_mapping_error(&dev->sbd.core, dev->bounce_dma)) { |
7275 | dev_err(&dev->sbd.core, "%s:%u: map DMA region failed\n", |
7276 | __func__, __LINE__); |
7277 | error = -ENODEV; |
7278 | diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c |
7279 | index 7551253ada32b..bf3f14fb5f244 100644 |
7280 | --- a/drivers/pwm/pwm-lp3943.c |
7281 | +++ b/drivers/pwm/pwm-lp3943.c |
7282 | @@ -275,6 +275,7 @@ static int lp3943_pwm_probe(struct platform_device *pdev) |
7283 | lp3943_pwm->chip.dev = &pdev->dev; |
7284 | lp3943_pwm->chip.ops = &lp3943_pwm_ops; |
7285 | lp3943_pwm->chip.npwm = LP3943_NUM_PWMS; |
7286 | + lp3943_pwm->chip.base = -1; |
7287 | |
7288 | platform_set_drvdata(pdev, lp3943_pwm); |
7289 | |
7290 | diff --git a/drivers/pwm/pwm-zx.c b/drivers/pwm/pwm-zx.c |
7291 | index e2c21cc34a96a..3763ce5311ac2 100644 |
7292 | --- a/drivers/pwm/pwm-zx.c |
7293 | +++ b/drivers/pwm/pwm-zx.c |
7294 | @@ -238,6 +238,7 @@ static int zx_pwm_probe(struct platform_device *pdev) |
7295 | ret = pwmchip_add(&zpc->chip); |
7296 | if (ret < 0) { |
7297 | dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret); |
7298 | + clk_disable_unprepare(zpc->pclk); |
7299 | return ret; |
7300 | } |
7301 | |
7302 | diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c |
7303 | index 7075f42b9fcf6..aefc351bfed59 100644 |
7304 | --- a/drivers/regulator/axp20x-regulator.c |
7305 | +++ b/drivers/regulator/axp20x-regulator.c |
7306 | @@ -596,7 +596,7 @@ static const struct regulator_desc axp22x_regulators[] = { |
7307 | AXP22X_DLDO1_V_OUT, AXP22X_DLDO1_V_OUT_MASK, |
7308 | AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_DLDO1_MASK), |
7309 | AXP_DESC(AXP22X, DLDO2, "dldo2", "dldoin", 700, 3300, 100, |
7310 | - AXP22X_DLDO2_V_OUT, AXP22X_PWR_OUT_DLDO2_MASK, |
7311 | + AXP22X_DLDO2_V_OUT, AXP22X_DLDO2_V_OUT_MASK, |
7312 | AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_DLDO2_MASK), |
7313 | AXP_DESC(AXP22X, DLDO3, "dldo3", "dldoin", 700, 3300, 100, |
7314 | AXP22X_DLDO3_V_OUT, AXP22X_DLDO3_V_OUT_MASK, |
7315 | diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c |
7316 | index e953886b2eb77..24e8b7e271773 100644 |
7317 | --- a/drivers/remoteproc/qcom_q6v5_adsp.c |
7318 | +++ b/drivers/remoteproc/qcom_q6v5_adsp.c |
7319 | @@ -184,8 +184,10 @@ static int adsp_start(struct rproc *rproc) |
7320 | |
7321 | dev_pm_genpd_set_performance_state(adsp->dev, INT_MAX); |
7322 | ret = pm_runtime_get_sync(adsp->dev); |
7323 | - if (ret) |
7324 | + if (ret) { |
7325 | + pm_runtime_put_noidle(adsp->dev); |
7326 | goto disable_xo_clk; |
7327 | + } |
7328 | |
7329 | ret = clk_bulk_prepare_enable(adsp->num_clks, adsp->clks); |
7330 | if (ret) { |
7331 | @@ -345,15 +347,12 @@ static int adsp_init_mmio(struct qcom_adsp *adsp, |
7332 | struct platform_device *pdev) |
7333 | { |
7334 | struct device_node *syscon; |
7335 | - struct resource *res; |
7336 | int ret; |
7337 | |
7338 | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
7339 | - adsp->qdsp6ss_base = devm_ioremap(&pdev->dev, res->start, |
7340 | - resource_size(res)); |
7341 | - if (!adsp->qdsp6ss_base) { |
7342 | + adsp->qdsp6ss_base = devm_platform_ioremap_resource(pdev, 0); |
7343 | + if (IS_ERR(adsp->qdsp6ss_base)) { |
7344 | dev_err(adsp->dev, "failed to map QDSP6SS registers\n"); |
7345 | - return -ENOMEM; |
7346 | + return PTR_ERR(adsp->qdsp6ss_base); |
7347 | } |
7348 | |
7349 | syscon = of_parse_phandle(pdev->dev.of_node, "qcom,halt-regs", 0); |
7350 | diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c |
7351 | index a67c55785b4de..5e54e6f5edb1a 100644 |
7352 | --- a/drivers/remoteproc/qcom_q6v5_mss.c |
7353 | +++ b/drivers/remoteproc/qcom_q6v5_mss.c |
7354 | @@ -331,8 +331,11 @@ static int q6v5_pds_enable(struct q6v5 *qproc, struct device **pds, |
7355 | for (i = 0; i < pd_count; i++) { |
7356 | dev_pm_genpd_set_performance_state(pds[i], INT_MAX); |
7357 | ret = pm_runtime_get_sync(pds[i]); |
7358 | - if (ret < 0) |
7359 | + if (ret < 0) { |
7360 | + pm_runtime_put_noidle(pds[i]); |
7361 | + dev_pm_genpd_set_performance_state(pds[i], 0); |
7362 | goto unroll_pd_votes; |
7363 | + } |
7364 | } |
7365 | |
7366 | return 0; |
7367 | diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c |
7368 | index 1766496385fed..4fd6afe2228e7 100644 |
7369 | --- a/drivers/rtc/rtc-ep93xx.c |
7370 | +++ b/drivers/rtc/rtc-ep93xx.c |
7371 | @@ -33,7 +33,7 @@ struct ep93xx_rtc { |
7372 | static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, |
7373 | unsigned short *delete) |
7374 | { |
7375 | - struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); |
7376 | + struct ep93xx_rtc *ep93xx_rtc = dev_get_drvdata(dev); |
7377 | unsigned long comp; |
7378 | |
7379 | comp = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_SWCOMP); |
7380 | @@ -51,7 +51,7 @@ static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, |
7381 | |
7382 | static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
7383 | { |
7384 | - struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); |
7385 | + struct ep93xx_rtc *ep93xx_rtc = dev_get_drvdata(dev); |
7386 | unsigned long time; |
7387 | |
7388 | time = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_DATA); |
7389 | @@ -62,7 +62,7 @@ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
7390 | |
7391 | static int ep93xx_rtc_set_time(struct device *dev, struct rtc_time *tm) |
7392 | { |
7393 | - struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); |
7394 | + struct ep93xx_rtc *ep93xx_rtc = dev_get_drvdata(dev); |
7395 | unsigned long secs = rtc_tm_to_time64(tm); |
7396 | |
7397 | writel(secs + 1, ep93xx_rtc->mmio_base + EP93XX_RTC_LOAD); |
7398 | diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c |
7399 | index 02b069caffd57..d1d37a204264c 100644 |
7400 | --- a/drivers/rtc/rtc-pcf2127.c |
7401 | +++ b/drivers/rtc/rtc-pcf2127.c |
7402 | @@ -230,10 +230,8 @@ static int pcf2127_nvmem_read(void *priv, unsigned int offset, |
7403 | if (ret) |
7404 | return ret; |
7405 | |
7406 | - ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, |
7407 | - val, bytes); |
7408 | - |
7409 | - return ret ?: bytes; |
7410 | + return regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, |
7411 | + val, bytes); |
7412 | } |
7413 | |
7414 | static int pcf2127_nvmem_write(void *priv, unsigned int offset, |
7415 | @@ -248,10 +246,8 @@ static int pcf2127_nvmem_write(void *priv, unsigned int offset, |
7416 | if (ret) |
7417 | return ret; |
7418 | |
7419 | - ret = regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, |
7420 | - val, bytes); |
7421 | - |
7422 | - return ret ?: bytes; |
7423 | + return regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, |
7424 | + val, bytes); |
7425 | } |
7426 | |
7427 | /* watchdog driver */ |
7428 | diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c |
7429 | index 99f86612f7751..dc78a523a69f2 100644 |
7430 | --- a/drivers/s390/block/dasd_alias.c |
7431 | +++ b/drivers/s390/block/dasd_alias.c |
7432 | @@ -256,7 +256,6 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) |
7433 | return; |
7434 | device->discipline->get_uid(device, &uid); |
7435 | spin_lock_irqsave(&lcu->lock, flags); |
7436 | - list_del_init(&device->alias_list); |
7437 | /* make sure that the workers don't use this device */ |
7438 | if (device == lcu->suc_data.device) { |
7439 | spin_unlock_irqrestore(&lcu->lock, flags); |
7440 | @@ -283,6 +282,7 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) |
7441 | |
7442 | spin_lock_irqsave(&aliastree.lock, flags); |
7443 | spin_lock(&lcu->lock); |
7444 | + list_del_init(&device->alias_list); |
7445 | if (list_empty(&lcu->grouplist) && |
7446 | list_empty(&lcu->active_devices) && |
7447 | list_empty(&lcu->inactive_devices)) { |
7448 | @@ -462,11 +462,19 @@ static int read_unit_address_configuration(struct dasd_device *device, |
7449 | spin_unlock_irqrestore(&lcu->lock, flags); |
7450 | |
7451 | rc = dasd_sleep_on(cqr); |
7452 | - if (rc && !suborder_not_supported(cqr)) { |
7453 | + if (!rc) |
7454 | + goto out; |
7455 | + |
7456 | + if (suborder_not_supported(cqr)) { |
7457 | + /* suborder not supported or device unusable for IO */ |
7458 | + rc = -EOPNOTSUPP; |
7459 | + } else { |
7460 | + /* IO failed but should be retried */ |
7461 | spin_lock_irqsave(&lcu->lock, flags); |
7462 | lcu->flags |= NEED_UAC_UPDATE; |
7463 | spin_unlock_irqrestore(&lcu->lock, flags); |
7464 | } |
7465 | +out: |
7466 | dasd_sfree_request(cqr, cqr->memdev); |
7467 | return rc; |
7468 | } |
7469 | @@ -503,6 +511,14 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu) |
7470 | return rc; |
7471 | |
7472 | spin_lock_irqsave(&lcu->lock, flags); |
7473 | + /* |
7474 | + * there is another update needed skip the remaining handling |
7475 | + * the data might already be outdated |
7476 | + * but especially do not add the device to an LCU with pending |
7477 | + * update |
7478 | + */ |
7479 | + if (lcu->flags & NEED_UAC_UPDATE) |
7480 | + goto out; |
7481 | lcu->pav = NO_PAV; |
7482 | for (i = 0; i < MAX_DEVICES_PER_LCU; ++i) { |
7483 | switch (lcu->uac->unit[i].ua_type) { |
7484 | @@ -521,6 +537,7 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu) |
7485 | alias_list) { |
7486 | _add_device_to_lcu(lcu, device, refdev); |
7487 | } |
7488 | +out: |
7489 | spin_unlock_irqrestore(&lcu->lock, flags); |
7490 | return 0; |
7491 | } |
7492 | @@ -625,6 +642,7 @@ int dasd_alias_add_device(struct dasd_device *device) |
7493 | } |
7494 | if (lcu->flags & UPDATE_PENDING) { |
7495 | list_move(&device->alias_list, &lcu->active_devices); |
7496 | + private->pavgroup = NULL; |
7497 | _schedule_lcu_update(lcu, device); |
7498 | } |
7499 | spin_unlock_irqrestore(&lcu->lock, flags); |
7500 | diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c |
7501 | index 983f9c9e08deb..23e9227e60fd7 100644 |
7502 | --- a/drivers/s390/cio/device.c |
7503 | +++ b/drivers/s390/cio/device.c |
7504 | @@ -1664,10 +1664,10 @@ void __init ccw_device_destroy_console(struct ccw_device *cdev) |
7505 | struct io_subchannel_private *io_priv = to_io_private(sch); |
7506 | |
7507 | set_io_private(sch, NULL); |
7508 | - put_device(&sch->dev); |
7509 | - put_device(&cdev->dev); |
7510 | dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), |
7511 | io_priv->dma_area, io_priv->dma_area_dma); |
7512 | + put_device(&sch->dev); |
7513 | + put_device(&cdev->dev); |
7514 | kfree(io_priv); |
7515 | } |
7516 | |
7517 | diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig |
7518 | index 702dc82c9501d..a0c0791abee69 100644 |
7519 | --- a/drivers/scsi/bnx2i/Kconfig |
7520 | +++ b/drivers/scsi/bnx2i/Kconfig |
7521 | @@ -4,6 +4,7 @@ config SCSI_BNX2_ISCSI |
7522 | depends on NET |
7523 | depends on PCI |
7524 | depends on (IPV6 || IPV6=n) |
7525 | + depends on MMU |
7526 | select SCSI_ISCSI_ATTRS |
7527 | select NETDEVICES |
7528 | select ETHERNET |
7529 | diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c |
7530 | index 18584ab27c329..3a2618bcce67b 100644 |
7531 | --- a/drivers/scsi/fnic/fnic_main.c |
7532 | +++ b/drivers/scsi/fnic/fnic_main.c |
7533 | @@ -741,6 +741,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
7534 | for (i = 0; i < FNIC_IO_LOCKS; i++) |
7535 | spin_lock_init(&fnic->io_req_lock[i]); |
7536 | |
7537 | + err = -ENOMEM; |
7538 | fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache); |
7539 | if (!fnic->io_req_pool) |
7540 | goto err_out_free_resources; |
7541 | diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c |
7542 | index ae09bb863497d..ef75fd6c04834 100644 |
7543 | --- a/drivers/scsi/lpfc/lpfc_mem.c |
7544 | +++ b/drivers/scsi/lpfc/lpfc_mem.c |
7545 | @@ -593,8 +593,6 @@ lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab) |
7546 | * Description: Allocates a DMA-mapped receive buffer from the lpfc_hrb_pool PCI |
7547 | * pool along a non-DMA-mapped container for it. |
7548 | * |
7549 | - * Notes: Not interrupt-safe. Must be called with no locks held. |
7550 | - * |
7551 | * Returns: |
7552 | * pointer to HBQ on success |
7553 | * NULL on failure |
7554 | @@ -604,7 +602,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) |
7555 | { |
7556 | struct rqb_dmabuf *dma_buf; |
7557 | |
7558 | - dma_buf = kzalloc(sizeof(struct rqb_dmabuf), GFP_KERNEL); |
7559 | + dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL); |
7560 | if (!dma_buf) |
7561 | return NULL; |
7562 | |
7563 | @@ -727,7 +725,6 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) |
7564 | drqe.address_hi = putPaddrHigh(rqb_entry->dbuf.phys); |
7565 | rc = lpfc_sli4_rq_put(rqb_entry->hrq, rqb_entry->drq, &hrqe, &drqe); |
7566 | if (rc < 0) { |
7567 | - (rqbp->rqb_free_buffer)(phba, rqb_entry); |
7568 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7569 | "6409 Cannot post to HRQ %d: %x %x %x " |
7570 | "DRQ %x %x\n", |
7571 | @@ -737,6 +734,7 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) |
7572 | rqb_entry->hrq->entry_count, |
7573 | rqb_entry->drq->host_index, |
7574 | rqb_entry->drq->hba_index); |
7575 | + (rqbp->rqb_free_buffer)(phba, rqb_entry); |
7576 | } else { |
7577 | list_add_tail(&rqb_entry->hbuf.list, &rqbp->rqb_buffer_list); |
7578 | rqbp->buffer_count++; |
7579 | diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
7580 | index e2877d2b3cc0d..b9857d7b224fb 100644 |
7581 | --- a/drivers/scsi/lpfc/lpfc_sli.c |
7582 | +++ b/drivers/scsi/lpfc/lpfc_sli.c |
7583 | @@ -7102,12 +7102,16 @@ lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, |
7584 | struct rqb_dmabuf *rqb_buffer; |
7585 | LIST_HEAD(rqb_buf_list); |
7586 | |
7587 | - spin_lock_irqsave(&phba->hbalock, flags); |
7588 | rqbp = hrq->rqbp; |
7589 | for (i = 0; i < count; i++) { |
7590 | + spin_lock_irqsave(&phba->hbalock, flags); |
7591 | /* IF RQ is already full, don't bother */ |
7592 | - if (rqbp->buffer_count + i >= rqbp->entry_count - 1) |
7593 | + if (rqbp->buffer_count + i >= rqbp->entry_count - 1) { |
7594 | + spin_unlock_irqrestore(&phba->hbalock, flags); |
7595 | break; |
7596 | + } |
7597 | + spin_unlock_irqrestore(&phba->hbalock, flags); |
7598 | + |
7599 | rqb_buffer = rqbp->rqb_alloc_buffer(phba); |
7600 | if (!rqb_buffer) |
7601 | break; |
7602 | @@ -7116,6 +7120,8 @@ lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, |
7603 | rqb_buffer->idx = idx; |
7604 | list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list); |
7605 | } |
7606 | + |
7607 | + spin_lock_irqsave(&phba->hbalock, flags); |
7608 | while (!list_empty(&rqb_buf_list)) { |
7609 | list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf, |
7610 | hbuf.list); |
7611 | diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c |
7612 | index 2c2966a297c77..4a23dd8b7f9aa 100644 |
7613 | --- a/drivers/scsi/megaraid/megaraid_sas_base.c |
7614 | +++ b/drivers/scsi/megaraid/megaraid_sas_base.c |
7615 | @@ -8038,7 +8038,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, |
7616 | int error = 0, i; |
7617 | void *sense = NULL; |
7618 | dma_addr_t sense_handle; |
7619 | - unsigned long *sense_ptr; |
7620 | + void *sense_ptr; |
7621 | u32 opcode = 0; |
7622 | |
7623 | memset(kbuff_arr, 0, sizeof(kbuff_arr)); |
7624 | @@ -8160,6 +8160,13 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, |
7625 | } |
7626 | |
7627 | if (ioc->sense_len) { |
7628 | + /* make sure the pointer is part of the frame */ |
7629 | + if (ioc->sense_off > |
7630 | + (sizeof(union megasas_frame) - sizeof(__le64))) { |
7631 | + error = -EINVAL; |
7632 | + goto out; |
7633 | + } |
7634 | + |
7635 | sense = dma_alloc_coherent(&instance->pdev->dev, ioc->sense_len, |
7636 | &sense_handle, GFP_KERNEL); |
7637 | if (!sense) { |
7638 | @@ -8167,12 +8174,11 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, |
7639 | goto out; |
7640 | } |
7641 | |
7642 | - sense_ptr = |
7643 | - (unsigned long *) ((unsigned long)cmd->frame + ioc->sense_off); |
7644 | + sense_ptr = (void *)cmd->frame + ioc->sense_off; |
7645 | if (instance->consistent_mask_64bit) |
7646 | - *sense_ptr = cpu_to_le64(sense_handle); |
7647 | + put_unaligned_le64(sense_handle, sense_ptr); |
7648 | else |
7649 | - *sense_ptr = cpu_to_le32(sense_handle); |
7650 | + put_unaligned_le32(sense_handle, sense_ptr); |
7651 | } |
7652 | |
7653 | /* |
7654 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
7655 | index 8be8c510fdf79..7532603aafb15 100644 |
7656 | --- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
7657 | +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
7658 | @@ -6227,7 +6227,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) |
7659 | |
7660 | r = _base_handshake_req_reply_wait(ioc, |
7661 | sizeof(Mpi2IOCInitRequest_t), (u32 *)&mpi_request, |
7662 | - sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10); |
7663 | + sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 30); |
7664 | |
7665 | if (r != 0) { |
7666 | ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r); |
7667 | diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c |
7668 | index 3374f553c617a..8882ba33ca87c 100644 |
7669 | --- a/drivers/scsi/pm8001/pm8001_init.c |
7670 | +++ b/drivers/scsi/pm8001/pm8001_init.c |
7671 | @@ -1040,7 +1040,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev, |
7672 | |
7673 | pm8001_init_sas_add(pm8001_ha); |
7674 | /* phy setting support for motherboard controller */ |
7675 | - if (pm8001_configure_phy_settings(pm8001_ha)) |
7676 | + rc = pm8001_configure_phy_settings(pm8001_ha); |
7677 | + if (rc) |
7678 | goto err_out_shost; |
7679 | |
7680 | pm8001_post_sas_ha_init(shost, chip); |
7681 | diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c |
7682 | index acb930b8c6a64..35c96ea2653be 100644 |
7683 | --- a/drivers/scsi/qedi/qedi_main.c |
7684 | +++ b/drivers/scsi/qedi/qedi_main.c |
7685 | @@ -2630,7 +2630,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode) |
7686 | QEDI_ERR(&qedi->dbg_ctx, |
7687 | "Unable to start offload thread!\n"); |
7688 | rc = -ENODEV; |
7689 | - goto free_cid_que; |
7690 | + goto free_tmf_thread; |
7691 | } |
7692 | |
7693 | /* F/w needs 1st task context memory entry for performance */ |
7694 | @@ -2650,6 +2650,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode) |
7695 | |
7696 | return 0; |
7697 | |
7698 | +free_tmf_thread: |
7699 | + destroy_workqueue(qedi->tmf_thread); |
7700 | free_cid_que: |
7701 | qedi_release_cid_que(qedi); |
7702 | free_uio: |
7703 | diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c |
7704 | index 294d77c02cdf6..f169292448bd4 100644 |
7705 | --- a/drivers/scsi/qla2xxx/qla_tmpl.c |
7706 | +++ b/drivers/scsi/qla2xxx/qla_tmpl.c |
7707 | @@ -910,7 +910,8 @@ qla27xx_template_checksum(void *p, ulong size) |
7708 | static inline int |
7709 | qla27xx_verify_template_checksum(struct qla27xx_fwdt_template *tmp) |
7710 | { |
7711 | - return qla27xx_template_checksum(tmp, tmp->template_size) == 0; |
7712 | + return qla27xx_template_checksum(tmp, |
7713 | + le32_to_cpu(tmp->template_size)) == 0; |
7714 | } |
7715 | |
7716 | static inline int |
7717 | @@ -926,7 +927,7 @@ qla27xx_execute_fwdt_template(struct scsi_qla_host *vha, |
7718 | ulong len = 0; |
7719 | |
7720 | if (qla27xx_fwdt_template_valid(tmp)) { |
7721 | - len = tmp->template_size; |
7722 | + len = le32_to_cpu(tmp->template_size); |
7723 | tmp = memcpy(buf, tmp, len); |
7724 | ql27xx_edit_template(vha, tmp); |
7725 | qla27xx_walk_template(vha, tmp, buf, &len); |
7726 | @@ -942,7 +943,7 @@ qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *vha, void *p) |
7727 | ulong len = 0; |
7728 | |
7729 | if (qla27xx_fwdt_template_valid(tmp)) { |
7730 | - len = tmp->template_size; |
7731 | + len = le32_to_cpu(tmp->template_size); |
7732 | qla27xx_walk_template(vha, tmp, NULL, &len); |
7733 | } |
7734 | |
7735 | @@ -954,7 +955,7 @@ qla27xx_fwdt_template_size(void *p) |
7736 | { |
7737 | struct qla27xx_fwdt_template *tmp = p; |
7738 | |
7739 | - return tmp->template_size; |
7740 | + return le32_to_cpu(tmp->template_size); |
7741 | } |
7742 | |
7743 | int |
7744 | diff --git a/drivers/scsi/qla2xxx/qla_tmpl.h b/drivers/scsi/qla2xxx/qla_tmpl.h |
7745 | index d2a0014e8b21e..fb8ab3bc86c26 100644 |
7746 | --- a/drivers/scsi/qla2xxx/qla_tmpl.h |
7747 | +++ b/drivers/scsi/qla2xxx/qla_tmpl.h |
7748 | @@ -13,7 +13,7 @@ |
7749 | struct __packed qla27xx_fwdt_template { |
7750 | __le32 template_type; |
7751 | __le32 entry_offset; |
7752 | - uint32_t template_size; |
7753 | + __le32 template_size; |
7754 | uint32_t count; /* borrow field for running/residual count */ |
7755 | |
7756 | __le32 entry_count; |
7757 | diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
7758 | index e6944e1cba2ba..b5867e1566f42 100644 |
7759 | --- a/drivers/scsi/scsi_lib.c |
7760 | +++ b/drivers/scsi/scsi_lib.c |
7761 | @@ -2930,6 +2930,78 @@ void sdev_enable_disk_events(struct scsi_device *sdev) |
7762 | } |
7763 | EXPORT_SYMBOL(sdev_enable_disk_events); |
7764 | |
7765 | +static unsigned char designator_prio(const unsigned char *d) |
7766 | +{ |
7767 | + if (d[1] & 0x30) |
7768 | + /* not associated with LUN */ |
7769 | + return 0; |
7770 | + |
7771 | + if (d[3] == 0) |
7772 | + /* invalid length */ |
7773 | + return 0; |
7774 | + |
7775 | + /* |
7776 | + * Order of preference for lun descriptor: |
7777 | + * - SCSI name string |
7778 | + * - NAA IEEE Registered Extended |
7779 | + * - EUI-64 based 16-byte |
7780 | + * - EUI-64 based 12-byte |
7781 | + * - NAA IEEE Registered |
7782 | + * - NAA IEEE Extended |
7783 | + * - EUI-64 based 8-byte |
7784 | + * - SCSI name string (truncated) |
7785 | + * - T10 Vendor ID |
7786 | + * as longer descriptors reduce the likelyhood |
7787 | + * of identification clashes. |
7788 | + */ |
7789 | + |
7790 | + switch (d[1] & 0xf) { |
7791 | + case 8: |
7792 | + /* SCSI name string, variable-length UTF-8 */ |
7793 | + return 9; |
7794 | + case 3: |
7795 | + switch (d[4] >> 4) { |
7796 | + case 6: |
7797 | + /* NAA registered extended */ |
7798 | + return 8; |
7799 | + case 5: |
7800 | + /* NAA registered */ |
7801 | + return 5; |
7802 | + case 4: |
7803 | + /* NAA extended */ |
7804 | + return 4; |
7805 | + case 3: |
7806 | + /* NAA locally assigned */ |
7807 | + return 1; |
7808 | + default: |
7809 | + break; |
7810 | + } |
7811 | + break; |
7812 | + case 2: |
7813 | + switch (d[3]) { |
7814 | + case 16: |
7815 | + /* EUI64-based, 16 byte */ |
7816 | + return 7; |
7817 | + case 12: |
7818 | + /* EUI64-based, 12 byte */ |
7819 | + return 6; |
7820 | + case 8: |
7821 | + /* EUI64-based, 8 byte */ |
7822 | + return 3; |
7823 | + default: |
7824 | + break; |
7825 | + } |
7826 | + break; |
7827 | + case 1: |
7828 | + /* T10 vendor ID */ |
7829 | + return 1; |
7830 | + default: |
7831 | + break; |
7832 | + } |
7833 | + |
7834 | + return 0; |
7835 | +} |
7836 | + |
7837 | /** |
7838 | * scsi_vpd_lun_id - return a unique device identification |
7839 | * @sdev: SCSI device |
7840 | @@ -2946,7 +3018,7 @@ EXPORT_SYMBOL(sdev_enable_disk_events); |
7841 | */ |
7842 | int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
7843 | { |
7844 | - u8 cur_id_type = 0xff; |
7845 | + u8 cur_id_prio = 0; |
7846 | u8 cur_id_size = 0; |
7847 | const unsigned char *d, *cur_id_str; |
7848 | const struct scsi_vpd *vpd_pg83; |
7849 | @@ -2959,20 +3031,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
7850 | return -ENXIO; |
7851 | } |
7852 | |
7853 | - /* |
7854 | - * Look for the correct descriptor. |
7855 | - * Order of preference for lun descriptor: |
7856 | - * - SCSI name string |
7857 | - * - NAA IEEE Registered Extended |
7858 | - * - EUI-64 based 16-byte |
7859 | - * - EUI-64 based 12-byte |
7860 | - * - NAA IEEE Registered |
7861 | - * - NAA IEEE Extended |
7862 | - * - T10 Vendor ID |
7863 | - * as longer descriptors reduce the likelyhood |
7864 | - * of identification clashes. |
7865 | - */ |
7866 | - |
7867 | /* The id string must be at least 20 bytes + terminating NULL byte */ |
7868 | if (id_len < 21) { |
7869 | rcu_read_unlock(); |
7870 | @@ -2982,8 +3040,9 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
7871 | memset(id, 0, id_len); |
7872 | d = vpd_pg83->data + 4; |
7873 | while (d < vpd_pg83->data + vpd_pg83->len) { |
7874 | - /* Skip designators not referring to the LUN */ |
7875 | - if ((d[1] & 0x30) != 0x00) |
7876 | + u8 prio = designator_prio(d); |
7877 | + |
7878 | + if (prio == 0 || cur_id_prio > prio) |
7879 | goto next_desig; |
7880 | |
7881 | switch (d[1] & 0xf) { |
7882 | @@ -2991,28 +3050,19 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
7883 | /* T10 Vendor ID */ |
7884 | if (cur_id_size > d[3]) |
7885 | break; |
7886 | - /* Prefer anything */ |
7887 | - if (cur_id_type > 0x01 && cur_id_type != 0xff) |
7888 | - break; |
7889 | + cur_id_prio = prio; |
7890 | cur_id_size = d[3]; |
7891 | if (cur_id_size + 4 > id_len) |
7892 | cur_id_size = id_len - 4; |
7893 | cur_id_str = d + 4; |
7894 | - cur_id_type = d[1] & 0xf; |
7895 | id_size = snprintf(id, id_len, "t10.%*pE", |
7896 | cur_id_size, cur_id_str); |
7897 | break; |
7898 | case 0x2: |
7899 | /* EUI-64 */ |
7900 | - if (cur_id_size > d[3]) |
7901 | - break; |
7902 | - /* Prefer NAA IEEE Registered Extended */ |
7903 | - if (cur_id_type == 0x3 && |
7904 | - cur_id_size == d[3]) |
7905 | - break; |
7906 | + cur_id_prio = prio; |
7907 | cur_id_size = d[3]; |
7908 | cur_id_str = d + 4; |
7909 | - cur_id_type = d[1] & 0xf; |
7910 | switch (cur_id_size) { |
7911 | case 8: |
7912 | id_size = snprintf(id, id_len, |
7913 | @@ -3030,17 +3080,14 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
7914 | cur_id_str); |
7915 | break; |
7916 | default: |
7917 | - cur_id_size = 0; |
7918 | break; |
7919 | } |
7920 | break; |
7921 | case 0x3: |
7922 | /* NAA */ |
7923 | - if (cur_id_size > d[3]) |
7924 | - break; |
7925 | + cur_id_prio = prio; |
7926 | cur_id_size = d[3]; |
7927 | cur_id_str = d + 4; |
7928 | - cur_id_type = d[1] & 0xf; |
7929 | switch (cur_id_size) { |
7930 | case 8: |
7931 | id_size = snprintf(id, id_len, |
7932 | @@ -3053,26 +3100,25 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
7933 | cur_id_str); |
7934 | break; |
7935 | default: |
7936 | - cur_id_size = 0; |
7937 | break; |
7938 | } |
7939 | break; |
7940 | case 0x8: |
7941 | /* SCSI name string */ |
7942 | - if (cur_id_size + 4 > d[3]) |
7943 | + if (cur_id_size > d[3]) |
7944 | break; |
7945 | /* Prefer others for truncated descriptor */ |
7946 | - if (cur_id_size && d[3] > id_len) |
7947 | - break; |
7948 | + if (d[3] > id_len) { |
7949 | + prio = 2; |
7950 | + if (cur_id_prio > prio) |
7951 | + break; |
7952 | + } |
7953 | + cur_id_prio = prio; |
7954 | cur_id_size = id_size = d[3]; |
7955 | cur_id_str = d + 4; |
7956 | - cur_id_type = d[1] & 0xf; |
7957 | if (cur_id_size >= id_len) |
7958 | cur_id_size = id_len - 1; |
7959 | memcpy(id, cur_id_str, cur_id_size); |
7960 | - /* Decrease priority for truncated descriptor */ |
7961 | - if (cur_id_size != id_size) |
7962 | - cur_id_size = 6; |
7963 | break; |
7964 | default: |
7965 | break; |
7966 | diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
7967 | index ce265bf7de868..b60541c3f72da 100644 |
7968 | --- a/drivers/slimbus/qcom-ngd-ctrl.c |
7969 | +++ b/drivers/slimbus/qcom-ngd-ctrl.c |
7970 | @@ -1201,6 +1201,9 @@ static int qcom_slim_ngd_runtime_resume(struct device *dev) |
7971 | struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); |
7972 | int ret = 0; |
7973 | |
7974 | + if (!ctrl->qmi.handle) |
7975 | + return 0; |
7976 | + |
7977 | if (ctrl->state >= QCOM_SLIM_NGD_CTRL_ASLEEP) |
7978 | ret = qcom_slim_ngd_power_up(ctrl); |
7979 | if (ret) { |
7980 | @@ -1497,6 +1500,9 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev) |
7981 | struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); |
7982 | int ret = 0; |
7983 | |
7984 | + if (!ctrl->qmi.handle) |
7985 | + return 0; |
7986 | + |
7987 | ret = qcom_slim_qmi_power_request(ctrl, false); |
7988 | if (ret && ret != -EBUSY) |
7989 | dev_info(ctrl->dev, "slim resource not idle:%d\n", ret); |
7990 | diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c |
7991 | index c655f5f92b124..d0329ad170d13 100644 |
7992 | --- a/drivers/soc/amlogic/meson-canvas.c |
7993 | +++ b/drivers/soc/amlogic/meson-canvas.c |
7994 | @@ -72,8 +72,10 @@ struct meson_canvas *meson_canvas_get(struct device *dev) |
7995 | * current state, this driver probe cannot return -EPROBE_DEFER |
7996 | */ |
7997 | canvas = dev_get_drvdata(&canvas_pdev->dev); |
7998 | - if (!canvas) |
7999 | + if (!canvas) { |
8000 | + put_device(&canvas_pdev->dev); |
8001 | return ERR_PTR(-EINVAL); |
8002 | + } |
8003 | |
8004 | return canvas; |
8005 | } |
8006 | diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c |
8007 | index 503222d0d0da1..75f25f08245fd 100644 |
8008 | --- a/drivers/soc/mediatek/mtk-scpsys.c |
8009 | +++ b/drivers/soc/mediatek/mtk-scpsys.c |
8010 | @@ -446,6 +446,7 @@ static void mtk_register_power_domains(struct platform_device *pdev, |
8011 | for (i = 0; i < num; i++) { |
8012 | struct scp_domain *scpd = &scp->domains[i]; |
8013 | struct generic_pm_domain *genpd = &scpd->genpd; |
8014 | + bool on; |
8015 | |
8016 | /* |
8017 | * Initially turn on all domains to make the domains usable |
8018 | @@ -453,9 +454,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, |
8019 | * software. The unused domains will be switched off during |
8020 | * late_init time. |
8021 | */ |
8022 | - genpd->power_on(genpd); |
8023 | + on = !WARN_ON(genpd->power_on(genpd) < 0); |
8024 | |
8025 | - pm_genpd_init(genpd, NULL, false); |
8026 | + pm_genpd_init(genpd, NULL, !on); |
8027 | } |
8028 | |
8029 | /* |
8030 | diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c |
8031 | index 7d622ea1274eb..2e66098e82975 100644 |
8032 | --- a/drivers/soc/qcom/qcom-geni-se.c |
8033 | +++ b/drivers/soc/qcom/qcom-geni-se.c |
8034 | @@ -282,10 +282,23 @@ static void geni_se_select_fifo_mode(struct geni_se *se) |
8035 | |
8036 | static void geni_se_select_dma_mode(struct geni_se *se) |
8037 | { |
8038 | + u32 proto = geni_se_read_proto(se); |
8039 | u32 val; |
8040 | |
8041 | geni_se_irq_clear(se); |
8042 | |
8043 | + val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN); |
8044 | + if (proto != GENI_SE_UART) { |
8045 | + val &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN); |
8046 | + val &= ~(M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN); |
8047 | + } |
8048 | + writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN); |
8049 | + |
8050 | + val = readl_relaxed(se->base + SE_GENI_S_IRQ_EN); |
8051 | + if (proto != GENI_SE_UART) |
8052 | + val &= ~S_CMD_DONE_EN; |
8053 | + writel_relaxed(val, se->base + SE_GENI_S_IRQ_EN); |
8054 | + |
8055 | val = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN); |
8056 | val |= GENI_DMA_MODE_EN; |
8057 | writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN); |
8058 | @@ -644,7 +657,7 @@ int geni_se_tx_dma_prep(struct geni_se *se, void *buf, size_t len, |
8059 | writel_relaxed(lower_32_bits(*iova), se->base + SE_DMA_TX_PTR_L); |
8060 | writel_relaxed(upper_32_bits(*iova), se->base + SE_DMA_TX_PTR_H); |
8061 | writel_relaxed(GENI_SE_DMA_EOT_BUF, se->base + SE_DMA_TX_ATTR); |
8062 | - writel_relaxed(len, se->base + SE_DMA_TX_LEN); |
8063 | + writel(len, se->base + SE_DMA_TX_LEN); |
8064 | return 0; |
8065 | } |
8066 | EXPORT_SYMBOL(geni_se_tx_dma_prep); |
8067 | @@ -681,7 +694,7 @@ int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len, |
8068 | writel_relaxed(upper_32_bits(*iova), se->base + SE_DMA_RX_PTR_H); |
8069 | /* RX does not have EOT buffer type bit. So just reset RX_ATTR */ |
8070 | writel_relaxed(0, se->base + SE_DMA_RX_ATTR); |
8071 | - writel_relaxed(len, se->base + SE_DMA_RX_LEN); |
8072 | + writel(len, se->base + SE_DMA_RX_LEN); |
8073 | return 0; |
8074 | } |
8075 | EXPORT_SYMBOL(geni_se_rx_dma_prep); |
8076 | diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c |
8077 | index c7300d54e4447..42e0b8f647aef 100644 |
8078 | --- a/drivers/soc/qcom/smp2p.c |
8079 | +++ b/drivers/soc/qcom/smp2p.c |
8080 | @@ -318,15 +318,16 @@ static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p, |
8081 | static int smp2p_update_bits(void *data, u32 mask, u32 value) |
8082 | { |
8083 | struct smp2p_entry *entry = data; |
8084 | + unsigned long flags; |
8085 | u32 orig; |
8086 | u32 val; |
8087 | |
8088 | - spin_lock(&entry->lock); |
8089 | + spin_lock_irqsave(&entry->lock, flags); |
8090 | val = orig = readl(entry->value); |
8091 | val &= ~mask; |
8092 | val |= value; |
8093 | writel(val, entry->value); |
8094 | - spin_unlock(&entry->lock); |
8095 | + spin_unlock_irqrestore(&entry->lock, flags); |
8096 | |
8097 | if (val != orig) |
8098 | qcom_smp2p_kick(entry->smp2p); |
8099 | diff --git a/drivers/soc/renesas/rmobile-sysc.c b/drivers/soc/renesas/rmobile-sysc.c |
8100 | index 54b616ad4a62a..beb1c7211c3d6 100644 |
8101 | --- a/drivers/soc/renesas/rmobile-sysc.c |
8102 | +++ b/drivers/soc/renesas/rmobile-sysc.c |
8103 | @@ -327,6 +327,7 @@ static int __init rmobile_init_pm_domains(void) |
8104 | |
8105 | pmd = of_get_child_by_name(np, "pm-domains"); |
8106 | if (!pmd) { |
8107 | + iounmap(base); |
8108 | pr_warn("%pOF lacks pm-domains node\n", np); |
8109 | continue; |
8110 | } |
8111 | diff --git a/drivers/soc/tegra/fuse/speedo-tegra210.c b/drivers/soc/tegra/fuse/speedo-tegra210.c |
8112 | index 70d3f6e1aa33d..8050742237b76 100644 |
8113 | --- a/drivers/soc/tegra/fuse/speedo-tegra210.c |
8114 | +++ b/drivers/soc/tegra/fuse/speedo-tegra210.c |
8115 | @@ -94,7 +94,7 @@ static int get_process_id(int value, const u32 *speedos, unsigned int num) |
8116 | unsigned int i; |
8117 | |
8118 | for (i = 0; i < num; i++) |
8119 | - if (value < speedos[num]) |
8120 | + if (value < speedos[i]) |
8121 | return i; |
8122 | |
8123 | return -EINVAL; |
8124 | diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c |
8125 | index 6285cd8efb21b..981a9014c9c4e 100644 |
8126 | --- a/drivers/soc/ti/knav_dma.c |
8127 | +++ b/drivers/soc/ti/knav_dma.c |
8128 | @@ -759,8 +759,9 @@ static int knav_dma_probe(struct platform_device *pdev) |
8129 | pm_runtime_enable(kdev->dev); |
8130 | ret = pm_runtime_get_sync(kdev->dev); |
8131 | if (ret < 0) { |
8132 | + pm_runtime_put_noidle(kdev->dev); |
8133 | dev_err(kdev->dev, "unable to enable pktdma, err %d\n", ret); |
8134 | - return ret; |
8135 | + goto err_pm_disable; |
8136 | } |
8137 | |
8138 | /* Initialise all packet dmas */ |
8139 | @@ -774,7 +775,8 @@ static int knav_dma_probe(struct platform_device *pdev) |
8140 | |
8141 | if (list_empty(&kdev->list)) { |
8142 | dev_err(dev, "no valid dma instance\n"); |
8143 | - return -ENODEV; |
8144 | + ret = -ENODEV; |
8145 | + goto err_put_sync; |
8146 | } |
8147 | |
8148 | debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL, |
8149 | @@ -782,6 +784,13 @@ static int knav_dma_probe(struct platform_device *pdev) |
8150 | |
8151 | device_ready = true; |
8152 | return ret; |
8153 | + |
8154 | +err_put_sync: |
8155 | + pm_runtime_put_sync(kdev->dev); |
8156 | +err_pm_disable: |
8157 | + pm_runtime_disable(kdev->dev); |
8158 | + |
8159 | + return ret; |
8160 | } |
8161 | |
8162 | static int knav_dma_remove(struct platform_device *pdev) |
8163 | diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c |
8164 | index 1ccc9064e1eb5..b8210479ec997 100644 |
8165 | --- a/drivers/soc/ti/knav_qmss_queue.c |
8166 | +++ b/drivers/soc/ti/knav_qmss_queue.c |
8167 | @@ -1791,6 +1791,7 @@ static int knav_queue_probe(struct platform_device *pdev) |
8168 | pm_runtime_enable(&pdev->dev); |
8169 | ret = pm_runtime_get_sync(&pdev->dev); |
8170 | if (ret < 0) { |
8171 | + pm_runtime_put_noidle(&pdev->dev); |
8172 | dev_err(dev, "Failed to enable QMSS\n"); |
8173 | return ret; |
8174 | } |
8175 | @@ -1858,9 +1859,10 @@ static int knav_queue_probe(struct platform_device *pdev) |
8176 | if (ret) |
8177 | goto err; |
8178 | |
8179 | - regions = of_get_child_by_name(node, "descriptor-regions"); |
8180 | + regions = of_get_child_by_name(node, "descriptor-regions"); |
8181 | if (!regions) { |
8182 | dev_err(dev, "descriptor-regions not specified\n"); |
8183 | + ret = -ENODEV; |
8184 | goto err; |
8185 | } |
8186 | ret = knav_queue_setup_regions(kdev, regions); |
8187 | diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c |
8188 | index 13def7f78b9e9..5fd929e023e18 100644 |
8189 | --- a/drivers/spi/atmel-quadspi.c |
8190 | +++ b/drivers/spi/atmel-quadspi.c |
8191 | @@ -284,10 +284,14 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, |
8192 | if (dummy_cycles) |
8193 | ifr |= QSPI_IFR_NBDUM(dummy_cycles); |
8194 | |
8195 | - /* Set data enable */ |
8196 | - if (op->data.nbytes) |
8197 | + /* Set data enable and data transfer type. */ |
8198 | + if (op->data.nbytes) { |
8199 | ifr |= QSPI_IFR_DATAEN; |
8200 | |
8201 | + if (op->addr.nbytes) |
8202 | + ifr |= QSPI_IFR_TFRTYP_MEM; |
8203 | + } |
8204 | + |
8205 | /* |
8206 | * If the QSPI controller is set in regular SPI mode, set it in |
8207 | * Serial Memory Mode (SMM). |
8208 | @@ -312,7 +316,7 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, |
8209 | writel_relaxed(icr, aq->regs + QSPI_WICR); |
8210 | writel_relaxed(ifr, aq->regs + QSPI_IFR); |
8211 | } else { |
8212 | - if (op->data.dir == SPI_MEM_DATA_OUT) |
8213 | + if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) |
8214 | ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; |
8215 | |
8216 | /* Set QSPI Instruction Frame registers */ |
8217 | @@ -454,7 +458,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
8218 | struct resource *res; |
8219 | int irq, err = 0; |
8220 | |
8221 | - ctrl = spi_alloc_master(&pdev->dev, sizeof(*aq)); |
8222 | + ctrl = devm_spi_alloc_master(&pdev->dev, sizeof(*aq)); |
8223 | if (!ctrl) |
8224 | return -ENOMEM; |
8225 | |
8226 | @@ -476,8 +480,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
8227 | aq->regs = devm_ioremap_resource(&pdev->dev, res); |
8228 | if (IS_ERR(aq->regs)) { |
8229 | dev_err(&pdev->dev, "missing registers\n"); |
8230 | - err = PTR_ERR(aq->regs); |
8231 | - goto exit; |
8232 | + return PTR_ERR(aq->regs); |
8233 | } |
8234 | |
8235 | /* Map the AHB memory */ |
8236 | @@ -485,8 +488,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
8237 | aq->mem = devm_ioremap_resource(&pdev->dev, res); |
8238 | if (IS_ERR(aq->mem)) { |
8239 | dev_err(&pdev->dev, "missing AHB memory\n"); |
8240 | - err = PTR_ERR(aq->mem); |
8241 | - goto exit; |
8242 | + return PTR_ERR(aq->mem); |
8243 | } |
8244 | |
8245 | aq->mmap_size = resource_size(res); |
8246 | @@ -498,22 +500,21 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
8247 | |
8248 | if (IS_ERR(aq->pclk)) { |
8249 | dev_err(&pdev->dev, "missing peripheral clock\n"); |
8250 | - err = PTR_ERR(aq->pclk); |
8251 | - goto exit; |
8252 | + return PTR_ERR(aq->pclk); |
8253 | } |
8254 | |
8255 | /* Enable the peripheral clock */ |
8256 | err = clk_prepare_enable(aq->pclk); |
8257 | if (err) { |
8258 | dev_err(&pdev->dev, "failed to enable the peripheral clock\n"); |
8259 | - goto exit; |
8260 | + return err; |
8261 | } |
8262 | |
8263 | aq->caps = of_device_get_match_data(&pdev->dev); |
8264 | if (!aq->caps) { |
8265 | dev_err(&pdev->dev, "Could not retrieve QSPI caps\n"); |
8266 | err = -EINVAL; |
8267 | - goto exit; |
8268 | + goto disable_pclk; |
8269 | } |
8270 | |
8271 | if (aq->caps->has_qspick) { |
8272 | @@ -557,8 +558,6 @@ disable_qspick: |
8273 | clk_disable_unprepare(aq->qspick); |
8274 | disable_pclk: |
8275 | clk_disable_unprepare(aq->pclk); |
8276 | -exit: |
8277 | - spi_controller_put(ctrl); |
8278 | |
8279 | return err; |
8280 | } |
8281 | diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c |
8282 | index 36f7eb8ab2df1..509476a2d79bb 100644 |
8283 | --- a/drivers/spi/spi-bcm63xx-hsspi.c |
8284 | +++ b/drivers/spi/spi-bcm63xx-hsspi.c |
8285 | @@ -483,8 +483,10 @@ static int bcm63xx_hsspi_resume(struct device *dev) |
8286 | |
8287 | if (bs->pll_clk) { |
8288 | ret = clk_prepare_enable(bs->pll_clk); |
8289 | - if (ret) |
8290 | + if (ret) { |
8291 | + clk_disable_unprepare(bs->clk); |
8292 | return ret; |
8293 | + } |
8294 | } |
8295 | |
8296 | spi_master_resume(master); |
8297 | diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c |
8298 | index f71c497393a6f..5260183a58a87 100644 |
8299 | --- a/drivers/spi/spi-davinci.c |
8300 | +++ b/drivers/spi/spi-davinci.c |
8301 | @@ -1040,13 +1040,13 @@ static int davinci_spi_remove(struct platform_device *pdev) |
8302 | spi_bitbang_stop(&dspi->bitbang); |
8303 | |
8304 | clk_disable_unprepare(dspi->clk); |
8305 | - spi_master_put(master); |
8306 | |
8307 | if (dspi->dma_rx) { |
8308 | dma_release_channel(dspi->dma_rx); |
8309 | dma_release_channel(dspi->dma_tx); |
8310 | } |
8311 | |
8312 | + spi_master_put(master); |
8313 | return 0; |
8314 | } |
8315 | |
8316 | diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
8317 | index be7c6ba730728..18a93a2854d80 100644 |
8318 | --- a/drivers/spi/spi-fsl-spi.c |
8319 | +++ b/drivers/spi/spi-fsl-spi.c |
8320 | @@ -717,10 +717,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
8321 | type = fsl_spi_get_type(&ofdev->dev); |
8322 | if (type == TYPE_FSL) { |
8323 | struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); |
8324 | + bool spisel_boot = false; |
8325 | #if IS_ENABLED(CONFIG_FSL_SOC) |
8326 | struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); |
8327 | - bool spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); |
8328 | |
8329 | + spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); |
8330 | if (spisel_boot) { |
8331 | pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4); |
8332 | if (!pinfo->immr_spi_cs) { |
8333 | @@ -737,10 +738,14 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
8334 | * supported on the GRLIB variant. |
8335 | */ |
8336 | ret = gpiod_count(dev, "cs"); |
8337 | - if (ret <= 0) |
8338 | + if (ret < 0) |
8339 | + ret = 0; |
8340 | + if (ret == 0 && !spisel_boot) { |
8341 | pdata->max_chipselect = 1; |
8342 | - else |
8343 | + } else { |
8344 | + pdata->max_chipselect = ret + spisel_boot; |
8345 | pdata->cs_control = fsl_spi_cs_control; |
8346 | + } |
8347 | } |
8348 | |
8349 | ret = of_address_to_resource(np, 0, &mem); |
8350 | diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c |
8351 | index f9c5bbb747142..e7dc1fad4a87c 100644 |
8352 | --- a/drivers/spi/spi-gpio.c |
8353 | +++ b/drivers/spi/spi-gpio.c |
8354 | @@ -350,11 +350,6 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev, |
8355 | return 0; |
8356 | } |
8357 | |
8358 | -static void spi_gpio_put(void *data) |
8359 | -{ |
8360 | - spi_master_put(data); |
8361 | -} |
8362 | - |
8363 | static int spi_gpio_probe(struct platform_device *pdev) |
8364 | { |
8365 | int status; |
8366 | @@ -366,16 +361,10 @@ static int spi_gpio_probe(struct platform_device *pdev) |
8367 | |
8368 | of_id = of_match_device(spi_gpio_dt_ids, &pdev->dev); |
8369 | |
8370 | - master = spi_alloc_master(dev, sizeof(*spi_gpio)); |
8371 | + master = devm_spi_alloc_master(dev, sizeof(*spi_gpio)); |
8372 | if (!master) |
8373 | return -ENOMEM; |
8374 | |
8375 | - status = devm_add_action_or_reset(&pdev->dev, spi_gpio_put, master); |
8376 | - if (status) { |
8377 | - spi_master_put(master); |
8378 | - return status; |
8379 | - } |
8380 | - |
8381 | if (of_id) |
8382 | status = spi_gpio_probe_dt(pdev, master); |
8383 | else |
8384 | @@ -435,7 +424,7 @@ static int spi_gpio_probe(struct platform_device *pdev) |
8385 | if (status) |
8386 | return status; |
8387 | |
8388 | - return devm_spi_register_master(&pdev->dev, spi_master_get(master)); |
8389 | + return devm_spi_register_master(&pdev->dev, master); |
8390 | } |
8391 | |
8392 | MODULE_ALIAS("platform:" DRIVER_NAME); |
8393 | diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c |
8394 | index f4a8f470aecc2..e9ef80983b791 100644 |
8395 | --- a/drivers/spi/spi-img-spfi.c |
8396 | +++ b/drivers/spi/spi-img-spfi.c |
8397 | @@ -771,8 +771,10 @@ static int img_spfi_resume(struct device *dev) |
8398 | int ret; |
8399 | |
8400 | ret = pm_runtime_get_sync(dev); |
8401 | - if (ret) |
8402 | + if (ret) { |
8403 | + pm_runtime_put_noidle(dev); |
8404 | return ret; |
8405 | + } |
8406 | spfi_reset(spfi); |
8407 | pm_runtime_put(dev); |
8408 | |
8409 | diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c |
8410 | index de0ba3e5449fa..33115bcfc787e 100644 |
8411 | --- a/drivers/spi/spi-mem.c |
8412 | +++ b/drivers/spi/spi-mem.c |
8413 | @@ -237,6 +237,7 @@ static int spi_mem_access_start(struct spi_mem *mem) |
8414 | |
8415 | ret = pm_runtime_get_sync(ctlr->dev.parent); |
8416 | if (ret < 0) { |
8417 | + pm_runtime_put_noidle(ctlr->dev.parent); |
8418 | dev_err(&ctlr->dev, "Failed to power device: %d\n", |
8419 | ret); |
8420 | return ret; |
8421 | diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c |
8422 | index 2c3b7a2a1ec77..b4b9b7309b5e9 100644 |
8423 | --- a/drivers/spi/spi-mt7621.c |
8424 | +++ b/drivers/spi/spi-mt7621.c |
8425 | @@ -350,9 +350,10 @@ static int mt7621_spi_probe(struct platform_device *pdev) |
8426 | if (status) |
8427 | return status; |
8428 | |
8429 | - master = spi_alloc_master(&pdev->dev, sizeof(*rs)); |
8430 | + master = devm_spi_alloc_master(&pdev->dev, sizeof(*rs)); |
8431 | if (!master) { |
8432 | dev_info(&pdev->dev, "master allocation failed\n"); |
8433 | + clk_disable_unprepare(clk); |
8434 | return -ENOMEM; |
8435 | } |
8436 | |
8437 | @@ -377,10 +378,15 @@ static int mt7621_spi_probe(struct platform_device *pdev) |
8438 | ret = device_reset(&pdev->dev); |
8439 | if (ret) { |
8440 | dev_err(&pdev->dev, "SPI reset failed!\n"); |
8441 | + clk_disable_unprepare(clk); |
8442 | return ret; |
8443 | } |
8444 | |
8445 | - return devm_spi_register_controller(&pdev->dev, master); |
8446 | + ret = spi_register_controller(master); |
8447 | + if (ret) |
8448 | + clk_disable_unprepare(clk); |
8449 | + |
8450 | + return ret; |
8451 | } |
8452 | |
8453 | static int mt7621_spi_remove(struct platform_device *pdev) |
8454 | @@ -391,6 +397,7 @@ static int mt7621_spi_remove(struct platform_device *pdev) |
8455 | master = dev_get_drvdata(&pdev->dev); |
8456 | rs = spi_controller_get_devdata(master); |
8457 | |
8458 | + spi_unregister_controller(master); |
8459 | clk_disable_unprepare(rs->clk); |
8460 | |
8461 | return 0; |
8462 | diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c |
8463 | index f48563c09b97c..eba706d5671e2 100644 |
8464 | --- a/drivers/spi/spi-mxic.c |
8465 | +++ b/drivers/spi/spi-mxic.c |
8466 | @@ -528,7 +528,7 @@ static int mxic_spi_probe(struct platform_device *pdev) |
8467 | struct mxic_spi *mxic; |
8468 | int ret; |
8469 | |
8470 | - master = spi_alloc_master(&pdev->dev, sizeof(struct mxic_spi)); |
8471 | + master = devm_spi_alloc_master(&pdev->dev, sizeof(struct mxic_spi)); |
8472 | if (!master) |
8473 | return -ENOMEM; |
8474 | |
8475 | @@ -573,15 +573,9 @@ static int mxic_spi_probe(struct platform_device *pdev) |
8476 | ret = spi_register_master(master); |
8477 | if (ret) { |
8478 | dev_err(&pdev->dev, "spi_register_master failed\n"); |
8479 | - goto err_put_master; |
8480 | + pm_runtime_disable(&pdev->dev); |
8481 | } |
8482 | |
8483 | - return 0; |
8484 | - |
8485 | -err_put_master: |
8486 | - spi_master_put(master); |
8487 | - pm_runtime_disable(&pdev->dev); |
8488 | - |
8489 | return ret; |
8490 | } |
8491 | |
8492 | diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c |
8493 | index 996c1c8a9c719..34856c9ad931a 100644 |
8494 | --- a/drivers/spi/spi-mxs.c |
8495 | +++ b/drivers/spi/spi-mxs.c |
8496 | @@ -608,6 +608,7 @@ static int mxs_spi_probe(struct platform_device *pdev) |
8497 | |
8498 | ret = pm_runtime_get_sync(ssp->dev); |
8499 | if (ret < 0) { |
8500 | + pm_runtime_put_noidle(ssp->dev); |
8501 | dev_err(ssp->dev, "runtime_get_sync failed\n"); |
8502 | goto out_pm_runtime_disable; |
8503 | } |
8504 | diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c |
8505 | index 69f517ec59c68..8272bde5d706f 100644 |
8506 | --- a/drivers/spi/spi-pic32.c |
8507 | +++ b/drivers/spi/spi-pic32.c |
8508 | @@ -825,6 +825,7 @@ static int pic32_spi_probe(struct platform_device *pdev) |
8509 | return 0; |
8510 | |
8511 | err_bailout: |
8512 | + pic32_spi_dma_unprep(pic32s); |
8513 | clk_disable_unprepare(pic32s->clk); |
8514 | err_master: |
8515 | spi_master_put(master); |
8516 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
8517 | index 7f4285e2ae682..f5a10a94f156d 100644 |
8518 | --- a/drivers/spi/spi-pxa2xx.c |
8519 | +++ b/drivers/spi/spi-pxa2xx.c |
8520 | @@ -1675,9 +1675,9 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) |
8521 | } |
8522 | |
8523 | if (platform_info->is_slave) |
8524 | - controller = spi_alloc_slave(dev, sizeof(struct driver_data)); |
8525 | + controller = devm_spi_alloc_slave(dev, sizeof(*drv_data)); |
8526 | else |
8527 | - controller = spi_alloc_master(dev, sizeof(struct driver_data)); |
8528 | + controller = devm_spi_alloc_master(dev, sizeof(*drv_data)); |
8529 | |
8530 | if (!controller) { |
8531 | dev_err(&pdev->dev, "cannot alloc spi_controller\n"); |
8532 | @@ -1900,7 +1900,6 @@ out_error_dma_irq_alloc: |
8533 | free_irq(ssp->irq, drv_data); |
8534 | |
8535 | out_error_controller_alloc: |
8536 | - spi_controller_put(controller); |
8537 | pxa_ssp_free(ssp); |
8538 | return status; |
8539 | } |
8540 | diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c |
8541 | index 4c9620e0d18cc..1ad3f11a22b22 100644 |
8542 | --- a/drivers/spi/spi-rb4xx.c |
8543 | +++ b/drivers/spi/spi-rb4xx.c |
8544 | @@ -142,7 +142,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev) |
8545 | if (IS_ERR(spi_base)) |
8546 | return PTR_ERR(spi_base); |
8547 | |
8548 | - master = spi_alloc_master(&pdev->dev, sizeof(*rbspi)); |
8549 | + master = devm_spi_alloc_master(&pdev->dev, sizeof(*rbspi)); |
8550 | if (!master) |
8551 | return -ENOMEM; |
8552 | |
8553 | diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c |
8554 | index 11acddc833041..ced365efc5f07 100644 |
8555 | --- a/drivers/spi/spi-sc18is602.c |
8556 | +++ b/drivers/spi/spi-sc18is602.c |
8557 | @@ -239,13 +239,12 @@ static int sc18is602_probe(struct i2c_client *client, |
8558 | struct sc18is602_platform_data *pdata = dev_get_platdata(dev); |
8559 | struct sc18is602 *hw; |
8560 | struct spi_master *master; |
8561 | - int error; |
8562 | |
8563 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | |
8564 | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) |
8565 | return -EINVAL; |
8566 | |
8567 | - master = spi_alloc_master(dev, sizeof(struct sc18is602)); |
8568 | + master = devm_spi_alloc_master(dev, sizeof(struct sc18is602)); |
8569 | if (!master) |
8570 | return -ENOMEM; |
8571 | |
8572 | @@ -299,15 +298,7 @@ static int sc18is602_probe(struct i2c_client *client, |
8573 | master->min_speed_hz = hw->freq / 128; |
8574 | master->max_speed_hz = hw->freq / 4; |
8575 | |
8576 | - error = devm_spi_register_master(dev, master); |
8577 | - if (error) |
8578 | - goto error_reg; |
8579 | - |
8580 | - return 0; |
8581 | - |
8582 | -error_reg: |
8583 | - spi_master_put(master); |
8584 | - return error; |
8585 | + return devm_spi_register_master(dev, master); |
8586 | } |
8587 | |
8588 | static const struct i2c_device_id sc18is602_id[] = { |
8589 | diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c |
8590 | index 20bdae5fdf3b8..15123a8f41e1e 100644 |
8591 | --- a/drivers/spi/spi-sh.c |
8592 | +++ b/drivers/spi/spi-sh.c |
8593 | @@ -440,7 +440,7 @@ static int spi_sh_probe(struct platform_device *pdev) |
8594 | if (irq < 0) |
8595 | return irq; |
8596 | |
8597 | - master = spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data)); |
8598 | + master = devm_spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data)); |
8599 | if (master == NULL) { |
8600 | dev_err(&pdev->dev, "spi_alloc_master error.\n"); |
8601 | return -ENOMEM; |
8602 | @@ -458,16 +458,14 @@ static int spi_sh_probe(struct platform_device *pdev) |
8603 | break; |
8604 | default: |
8605 | dev_err(&pdev->dev, "No support width\n"); |
8606 | - ret = -ENODEV; |
8607 | - goto error1; |
8608 | + return -ENODEV; |
8609 | } |
8610 | ss->irq = irq; |
8611 | ss->master = master; |
8612 | ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
8613 | if (ss->addr == NULL) { |
8614 | dev_err(&pdev->dev, "ioremap error.\n"); |
8615 | - ret = -ENOMEM; |
8616 | - goto error1; |
8617 | + return -ENOMEM; |
8618 | } |
8619 | INIT_LIST_HEAD(&ss->queue); |
8620 | spin_lock_init(&ss->lock); |
8621 | @@ -477,7 +475,7 @@ static int spi_sh_probe(struct platform_device *pdev) |
8622 | ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss); |
8623 | if (ret < 0) { |
8624 | dev_err(&pdev->dev, "request_irq error\n"); |
8625 | - goto error1; |
8626 | + return ret; |
8627 | } |
8628 | |
8629 | master->num_chipselect = 2; |
8630 | @@ -496,9 +494,6 @@ static int spi_sh_probe(struct platform_device *pdev) |
8631 | |
8632 | error3: |
8633 | free_irq(irq, ss); |
8634 | - error1: |
8635 | - spi_master_put(master); |
8636 | - |
8637 | return ret; |
8638 | } |
8639 | |
8640 | diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c |
8641 | index e60aff9903951..c2bdf19ccdd26 100644 |
8642 | --- a/drivers/spi/spi-sprd.c |
8643 | +++ b/drivers/spi/spi-sprd.c |
8644 | @@ -1008,6 +1008,7 @@ static int sprd_spi_remove(struct platform_device *pdev) |
8645 | |
8646 | ret = pm_runtime_get_sync(ss->dev); |
8647 | if (ret < 0) { |
8648 | + pm_runtime_put_noidle(ss->dev); |
8649 | dev_err(ss->dev, "failed to resume SPI controller\n"); |
8650 | return ret; |
8651 | } |
8652 | diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c |
8653 | index 77d26d64541a5..6c44dda9ee8c5 100644 |
8654 | --- a/drivers/spi/spi-st-ssc4.c |
8655 | +++ b/drivers/spi/spi-st-ssc4.c |
8656 | @@ -375,13 +375,14 @@ static int spi_st_probe(struct platform_device *pdev) |
8657 | ret = devm_spi_register_master(&pdev->dev, master); |
8658 | if (ret) { |
8659 | dev_err(&pdev->dev, "Failed to register master\n"); |
8660 | - goto clk_disable; |
8661 | + goto rpm_disable; |
8662 | } |
8663 | |
8664 | return 0; |
8665 | |
8666 | -clk_disable: |
8667 | +rpm_disable: |
8668 | pm_runtime_disable(&pdev->dev); |
8669 | +clk_disable: |
8670 | clk_disable_unprepare(spi_st->clk); |
8671 | put_master: |
8672 | spi_master_put(master); |
8673 | diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c |
8674 | index 9d8ceb63f7db1..ed20ad2950885 100644 |
8675 | --- a/drivers/spi/spi-stm32.c |
8676 | +++ b/drivers/spi/spi-stm32.c |
8677 | @@ -2055,6 +2055,7 @@ static int stm32_spi_resume(struct device *dev) |
8678 | |
8679 | ret = pm_runtime_get_sync(dev); |
8680 | if (ret < 0) { |
8681 | + pm_runtime_put_noidle(dev); |
8682 | dev_err(dev, "Unable to power device:%d\n", ret); |
8683 | return ret; |
8684 | } |
8685 | diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c |
8686 | index ae17c99cce037..5ab5119e2f1b0 100644 |
8687 | --- a/drivers/spi/spi-synquacer.c |
8688 | +++ b/drivers/spi/spi-synquacer.c |
8689 | @@ -658,7 +658,8 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
8690 | |
8691 | if (!master->max_speed_hz) { |
8692 | dev_err(&pdev->dev, "missing clock source\n"); |
8693 | - return -EINVAL; |
8694 | + ret = -EINVAL; |
8695 | + goto disable_clk; |
8696 | } |
8697 | master->min_speed_hz = master->max_speed_hz / 254; |
8698 | |
8699 | @@ -671,7 +672,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
8700 | rx_irq = platform_get_irq(pdev, 0); |
8701 | if (rx_irq <= 0) { |
8702 | ret = rx_irq; |
8703 | - goto put_spi; |
8704 | + goto disable_clk; |
8705 | } |
8706 | snprintf(sspi->rx_irq_name, SYNQUACER_HSSPI_IRQ_NAME_MAX, "%s-rx", |
8707 | dev_name(&pdev->dev)); |
8708 | @@ -679,13 +680,13 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
8709 | 0, sspi->rx_irq_name, sspi); |
8710 | if (ret) { |
8711 | dev_err(&pdev->dev, "request rx_irq failed (%d)\n", ret); |
8712 | - goto put_spi; |
8713 | + goto disable_clk; |
8714 | } |
8715 | |
8716 | tx_irq = platform_get_irq(pdev, 1); |
8717 | if (tx_irq <= 0) { |
8718 | ret = tx_irq; |
8719 | - goto put_spi; |
8720 | + goto disable_clk; |
8721 | } |
8722 | snprintf(sspi->tx_irq_name, SYNQUACER_HSSPI_IRQ_NAME_MAX, "%s-tx", |
8723 | dev_name(&pdev->dev)); |
8724 | @@ -693,7 +694,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
8725 | 0, sspi->tx_irq_name, sspi); |
8726 | if (ret) { |
8727 | dev_err(&pdev->dev, "request tx_irq failed (%d)\n", ret); |
8728 | - goto put_spi; |
8729 | + goto disable_clk; |
8730 | } |
8731 | |
8732 | master->dev.of_node = np; |
8733 | @@ -711,7 +712,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
8734 | |
8735 | ret = synquacer_spi_enable(master); |
8736 | if (ret) |
8737 | - goto fail_enable; |
8738 | + goto disable_clk; |
8739 | |
8740 | pm_runtime_set_active(sspi->dev); |
8741 | pm_runtime_enable(sspi->dev); |
8742 | @@ -724,7 +725,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
8743 | |
8744 | disable_pm: |
8745 | pm_runtime_disable(sspi->dev); |
8746 | -fail_enable: |
8747 | +disable_clk: |
8748 | clk_disable_unprepare(sspi->clk); |
8749 | put_spi: |
8750 | spi_master_put(master); |
8751 | diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
8752 | index 39374c2edcf3b..594905bf89aa8 100644 |
8753 | --- a/drivers/spi/spi-tegra114.c |
8754 | +++ b/drivers/spi/spi-tegra114.c |
8755 | @@ -954,6 +954,7 @@ static int tegra_spi_setup(struct spi_device *spi) |
8756 | |
8757 | ret = pm_runtime_get_sync(tspi->dev); |
8758 | if (ret < 0) { |
8759 | + pm_runtime_put_noidle(tspi->dev); |
8760 | dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); |
8761 | if (cdata) |
8762 | tegra_spi_cleanup(spi); |
8763 | @@ -1472,6 +1473,7 @@ static int tegra_spi_resume(struct device *dev) |
8764 | |
8765 | ret = pm_runtime_get_sync(dev); |
8766 | if (ret < 0) { |
8767 | + pm_runtime_put_noidle(dev); |
8768 | dev_err(dev, "pm runtime failed, e = %d\n", ret); |
8769 | return ret; |
8770 | } |
8771 | diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c |
8772 | index a841a7250d14b..ecb620169753a 100644 |
8773 | --- a/drivers/spi/spi-tegra20-sflash.c |
8774 | +++ b/drivers/spi/spi-tegra20-sflash.c |
8775 | @@ -551,6 +551,7 @@ static int tegra_sflash_resume(struct device *dev) |
8776 | |
8777 | ret = pm_runtime_get_sync(dev); |
8778 | if (ret < 0) { |
8779 | + pm_runtime_put_noidle(dev); |
8780 | dev_err(dev, "pm runtime failed, e = %d\n", ret); |
8781 | return ret; |
8782 | } |
8783 | diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
8784 | index 374a2a32edcd3..2a1905c43a0b7 100644 |
8785 | --- a/drivers/spi/spi-tegra20-slink.c |
8786 | +++ b/drivers/spi/spi-tegra20-slink.c |
8787 | @@ -756,6 +756,7 @@ static int tegra_slink_setup(struct spi_device *spi) |
8788 | |
8789 | ret = pm_runtime_get_sync(tspi->dev); |
8790 | if (ret < 0) { |
8791 | + pm_runtime_put_noidle(tspi->dev); |
8792 | dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); |
8793 | return ret; |
8794 | } |
8795 | @@ -1192,6 +1193,7 @@ static int tegra_slink_resume(struct device *dev) |
8796 | |
8797 | ret = pm_runtime_get_sync(dev); |
8798 | if (ret < 0) { |
8799 | + pm_runtime_put_noidle(dev); |
8800 | dev_err(dev, "pm runtime failed, e = %d\n", ret); |
8801 | return ret; |
8802 | } |
8803 | diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c |
8804 | index 66dcb61285392..cad2abcbd9c78 100644 |
8805 | --- a/drivers/spi/spi-ti-qspi.c |
8806 | +++ b/drivers/spi/spi-ti-qspi.c |
8807 | @@ -176,6 +176,7 @@ static int ti_qspi_setup(struct spi_device *spi) |
8808 | |
8809 | ret = pm_runtime_get_sync(qspi->dev); |
8810 | if (ret < 0) { |
8811 | + pm_runtime_put_noidle(qspi->dev); |
8812 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); |
8813 | return ret; |
8814 | } |
8815 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
8816 | index 4c96c7c9e335e..e1205d72be523 100644 |
8817 | --- a/drivers/spi/spi.c |
8818 | +++ b/drivers/spi/spi.c |
8819 | @@ -405,9 +405,11 @@ static int spi_drv_probe(struct device *dev) |
8820 | if (ret) |
8821 | return ret; |
8822 | |
8823 | - ret = sdrv->probe(spi); |
8824 | - if (ret) |
8825 | - dev_pm_domain_detach(dev, true); |
8826 | + if (sdrv->probe) { |
8827 | + ret = sdrv->probe(spi); |
8828 | + if (ret) |
8829 | + dev_pm_domain_detach(dev, true); |
8830 | + } |
8831 | |
8832 | return ret; |
8833 | } |
8834 | @@ -415,9 +417,10 @@ static int spi_drv_probe(struct device *dev) |
8835 | static int spi_drv_remove(struct device *dev) |
8836 | { |
8837 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); |
8838 | - int ret; |
8839 | + int ret = 0; |
8840 | |
8841 | - ret = sdrv->remove(to_spi_device(dev)); |
8842 | + if (sdrv->remove) |
8843 | + ret = sdrv->remove(to_spi_device(dev)); |
8844 | dev_pm_domain_detach(dev, true); |
8845 | |
8846 | return ret; |
8847 | @@ -442,10 +445,8 @@ int __spi_register_driver(struct module *owner, struct spi_driver *sdrv) |
8848 | { |
8849 | sdrv->driver.owner = owner; |
8850 | sdrv->driver.bus = &spi_bus_type; |
8851 | - if (sdrv->probe) |
8852 | - sdrv->driver.probe = spi_drv_probe; |
8853 | - if (sdrv->remove) |
8854 | - sdrv->driver.remove = spi_drv_remove; |
8855 | + sdrv->driver.probe = spi_drv_probe; |
8856 | + sdrv->driver.remove = spi_drv_remove; |
8857 | if (sdrv->shutdown) |
8858 | sdrv->driver.shutdown = spi_drv_shutdown; |
8859 | return driver_register(&sdrv->driver); |
8860 | diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c |
8861 | index ea430237efa7f..9da8dd748078d 100644 |
8862 | --- a/drivers/staging/comedi/drivers/mf6x4.c |
8863 | +++ b/drivers/staging/comedi/drivers/mf6x4.c |
8864 | @@ -112,8 +112,9 @@ static int mf6x4_ai_eoc(struct comedi_device *dev, |
8865 | struct mf6x4_private *devpriv = dev->private; |
8866 | unsigned int status; |
8867 | |
8868 | + /* EOLC goes low at end of conversion. */ |
8869 | status = ioread32(devpriv->gpioc_reg); |
8870 | - if (status & MF6X4_GPIOC_EOLC) |
8871 | + if ((status & MF6X4_GPIOC_EOLC) == 0) |
8872 | return 0; |
8873 | return -EBUSY; |
8874 | } |
8875 | diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c |
8876 | index 2d6195f7300e9..864342acfd86e 100644 |
8877 | --- a/drivers/staging/gasket/gasket_interrupt.c |
8878 | +++ b/drivers/staging/gasket/gasket_interrupt.c |
8879 | @@ -487,14 +487,16 @@ int gasket_interrupt_system_status(struct gasket_dev *gasket_dev) |
8880 | int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data, |
8881 | int interrupt, int event_fd) |
8882 | { |
8883 | - struct eventfd_ctx *ctx = eventfd_ctx_fdget(event_fd); |
8884 | - |
8885 | - if (IS_ERR(ctx)) |
8886 | - return PTR_ERR(ctx); |
8887 | + struct eventfd_ctx *ctx; |
8888 | |
8889 | if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) |
8890 | return -EINVAL; |
8891 | |
8892 | + ctx = eventfd_ctx_fdget(event_fd); |
8893 | + |
8894 | + if (IS_ERR(ctx)) |
8895 | + return PTR_ERR(ctx); |
8896 | + |
8897 | interrupt_data->eventfd_ctxs[interrupt] = ctx; |
8898 | return 0; |
8899 | } |
8900 | @@ -505,6 +507,9 @@ int gasket_interrupt_clear_eventfd(struct gasket_interrupt_data *interrupt_data, |
8901 | if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) |
8902 | return -EINVAL; |
8903 | |
8904 | - interrupt_data->eventfd_ctxs[interrupt] = NULL; |
8905 | + if (interrupt_data->eventfd_ctxs[interrupt]) { |
8906 | + eventfd_ctx_put(interrupt_data->eventfd_ctxs[interrupt]); |
8907 | + interrupt_data->eventfd_ctxs[interrupt] = NULL; |
8908 | + } |
8909 | return 0; |
8910 | } |
8911 | diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c |
8912 | index 08746c85dea6d..3259bf02ba25e 100644 |
8913 | --- a/drivers/staging/greybus/audio_codec.c |
8914 | +++ b/drivers/staging/greybus/audio_codec.c |
8915 | @@ -489,6 +489,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream, |
8916 | if (ret) { |
8917 | dev_err_ratelimited(dai->dev, "%d: Error during set_config\n", |
8918 | ret); |
8919 | + gb_pm_runtime_put_noidle(bundle); |
8920 | mutex_unlock(&codec->lock); |
8921 | return ret; |
8922 | } |
8923 | @@ -565,6 +566,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream, |
8924 | break; |
8925 | } |
8926 | if (ret) { |
8927 | + gb_pm_runtime_put_noidle(bundle); |
8928 | mutex_unlock(&codec->lock); |
8929 | dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n", |
8930 | ret); |
8931 | diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c |
8932 | index dccb4ea29d379..45ac48d031805 100644 |
8933 | --- a/drivers/staging/speakup/speakup_dectlk.c |
8934 | +++ b/drivers/staging/speakup/speakup_dectlk.c |
8935 | @@ -37,7 +37,7 @@ static unsigned char get_index(struct spk_synth *synth); |
8936 | static int in_escape; |
8937 | static int is_flushing; |
8938 | |
8939 | -static spinlock_t flush_lock; |
8940 | +static DEFINE_SPINLOCK(flush_lock); |
8941 | static DECLARE_WAIT_QUEUE_HEAD(flush); |
8942 | |
8943 | static struct var_t vars[] = { |
8944 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
8945 | index 7c27827857363..ad262349703bf 100644 |
8946 | --- a/drivers/tty/serial/serial_core.c |
8947 | +++ b/drivers/tty/serial/serial_core.c |
8948 | @@ -1465,6 +1465,10 @@ static void uart_set_ldisc(struct tty_struct *tty) |
8949 | { |
8950 | struct uart_state *state = tty->driver_data; |
8951 | struct uart_port *uport; |
8952 | + struct tty_port *port = &state->port; |
8953 | + |
8954 | + if (!tty_port_initialized(port)) |
8955 | + return; |
8956 | |
8957 | mutex_lock(&state->port.mutex); |
8958 | uport = uart_port_check(state); |
8959 | diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c |
8960 | index df8812c306407..c08bcce04276e 100644 |
8961 | --- a/drivers/usb/chipidea/ci_hdrc_imx.c |
8962 | +++ b/drivers/usb/chipidea/ci_hdrc_imx.c |
8963 | @@ -57,7 +57,8 @@ static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = { |
8964 | |
8965 | static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = { |
8966 | .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | |
8967 | - CI_HDRC_TURN_VBUS_EARLY_ON, |
8968 | + CI_HDRC_TURN_VBUS_EARLY_ON | |
8969 | + CI_HDRC_DISABLE_DEVICE_STREAMING, |
8970 | }; |
8971 | |
8972 | static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = { |
8973 | diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c |
8974 | index 9fc98de836249..add0f7ead55cc 100644 |
8975 | --- a/drivers/usb/gadget/function/f_acm.c |
8976 | +++ b/drivers/usb/gadget/function/f_acm.c |
8977 | @@ -684,7 +684,7 @@ acm_bind(struct usb_configuration *c, struct usb_function *f) |
8978 | acm_ss_out_desc.bEndpointAddress = acm_fs_out_desc.bEndpointAddress; |
8979 | |
8980 | status = usb_assign_descriptors(f, acm_fs_function, acm_hs_function, |
8981 | - acm_ss_function, NULL); |
8982 | + acm_ss_function, acm_ss_function); |
8983 | if (status) |
8984 | goto fail; |
8985 | |
8986 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
8987 | index d2cfb8ff9ca8a..df003bc67da07 100644 |
8988 | --- a/drivers/usb/gadget/function/f_fs.c |
8989 | +++ b/drivers/usb/gadget/function/f_fs.c |
8990 | @@ -1332,6 +1332,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, |
8991 | |
8992 | switch (epfile->ffs->gadget->speed) { |
8993 | case USB_SPEED_SUPER: |
8994 | + case USB_SPEED_SUPER_PLUS: |
8995 | desc_idx = 2; |
8996 | break; |
8997 | case USB_SPEED_HIGH: |
8998 | @@ -3193,7 +3194,8 @@ static int _ffs_func_bind(struct usb_configuration *c, |
8999 | } |
9000 | |
9001 | if (likely(super)) { |
9002 | - func->function.ss_descriptors = vla_ptr(vlabuf, d, ss_descs); |
9003 | + func->function.ss_descriptors = func->function.ssp_descriptors = |
9004 | + vla_ptr(vlabuf, d, ss_descs); |
9005 | ss_len = ffs_do_descs(ffs->ss_descs_count, |
9006 | vla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len, |
9007 | d_raw_descs__sz - fs_len - hs_len, |
9008 | @@ -3603,6 +3605,7 @@ static void ffs_func_unbind(struct usb_configuration *c, |
9009 | func->function.fs_descriptors = NULL; |
9010 | func->function.hs_descriptors = NULL; |
9011 | func->function.ss_descriptors = NULL; |
9012 | + func->function.ssp_descriptors = NULL; |
9013 | func->interfaces_nums = NULL; |
9014 | |
9015 | ffs_event_add(ffs, FUNCTIONFS_UNBIND); |
9016 | diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c |
9017 | index b2b5b0689667b..0e083a53da534 100644 |
9018 | --- a/drivers/usb/gadget/function/f_midi.c |
9019 | +++ b/drivers/usb/gadget/function/f_midi.c |
9020 | @@ -1048,6 +1048,12 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) |
9021 | f->ss_descriptors = usb_copy_descriptors(midi_function); |
9022 | if (!f->ss_descriptors) |
9023 | goto fail_f_midi; |
9024 | + |
9025 | + if (gadget_is_superspeed_plus(c->cdev->gadget)) { |
9026 | + f->ssp_descriptors = usb_copy_descriptors(midi_function); |
9027 | + if (!f->ssp_descriptors) |
9028 | + goto fail_f_midi; |
9029 | + } |
9030 | } |
9031 | |
9032 | kfree(midi_function); |
9033 | diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c |
9034 | index 0d8e4a364ca6e..cc1ff5b7b60c4 100644 |
9035 | --- a/drivers/usb/gadget/function/f_rndis.c |
9036 | +++ b/drivers/usb/gadget/function/f_rndis.c |
9037 | @@ -87,8 +87,10 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f) |
9038 | /* peak (theoretical) bulk transfer rate in bits-per-second */ |
9039 | static unsigned int bitrate(struct usb_gadget *g) |
9040 | { |
9041 | + if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS) |
9042 | + return 4250000000U; |
9043 | if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) |
9044 | - return 13 * 1024 * 8 * 1000 * 8; |
9045 | + return 3750000000U; |
9046 | else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) |
9047 | return 13 * 512 * 8 * 1000 * 8; |
9048 | else |
9049 | diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c |
9050 | index fc125b3d06e7d..03122dc332eda 100644 |
9051 | --- a/drivers/usb/host/ehci-omap.c |
9052 | +++ b/drivers/usb/host/ehci-omap.c |
9053 | @@ -220,6 +220,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) |
9054 | |
9055 | err_pm_runtime: |
9056 | pm_runtime_put_sync(dev); |
9057 | + pm_runtime_disable(dev); |
9058 | |
9059 | err_phy: |
9060 | for (i = 0; i < omap->nports; i++) { |
9061 | diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c |
9062 | index 8819f502b6a68..903abdf30b5a0 100644 |
9063 | --- a/drivers/usb/host/max3421-hcd.c |
9064 | +++ b/drivers/usb/host/max3421-hcd.c |
9065 | @@ -1847,7 +1847,7 @@ max3421_probe(struct spi_device *spi) |
9066 | struct max3421_hcd *max3421_hcd; |
9067 | struct usb_hcd *hcd = NULL; |
9068 | struct max3421_hcd_platform_data *pdata = NULL; |
9069 | - int retval = -ENOMEM; |
9070 | + int retval; |
9071 | |
9072 | if (spi_setup(spi) < 0) { |
9073 | dev_err(&spi->dev, "Unable to setup SPI bus"); |
9074 | @@ -1889,6 +1889,7 @@ max3421_probe(struct spi_device *spi) |
9075 | goto error; |
9076 | } |
9077 | |
9078 | + retval = -ENOMEM; |
9079 | hcd = usb_create_hcd(&max3421_hcd_desc, &spi->dev, |
9080 | dev_name(&spi->dev)); |
9081 | if (!hcd) { |
9082 | diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c |
9083 | index e67242e437edc..65985247fc00f 100644 |
9084 | --- a/drivers/usb/host/oxu210hp-hcd.c |
9085 | +++ b/drivers/usb/host/oxu210hp-hcd.c |
9086 | @@ -4149,8 +4149,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev, |
9087 | oxu->is_otg = otg; |
9088 | |
9089 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
9090 | - if (ret < 0) |
9091 | + if (ret < 0) { |
9092 | + usb_put_hcd(hcd); |
9093 | return ERR_PTR(ret); |
9094 | + } |
9095 | |
9096 | device_wakeup_enable(hcd->self.controller); |
9097 | return hcd; |
9098 | diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c |
9099 | index c96e5dab0a480..25b9635b60bb7 100644 |
9100 | --- a/drivers/usb/mtu3/mtu3_debugfs.c |
9101 | +++ b/drivers/usb/mtu3/mtu3_debugfs.c |
9102 | @@ -127,7 +127,7 @@ static void mtu3_debugfs_regset(struct mtu3 *mtu, void __iomem *base, |
9103 | struct debugfs_regset32 *regset; |
9104 | struct mtu3_regset *mregs; |
9105 | |
9106 | - mregs = devm_kzalloc(mtu->dev, sizeof(*regset), GFP_KERNEL); |
9107 | + mregs = devm_kzalloc(mtu->dev, sizeof(*mregs), GFP_KERNEL); |
9108 | if (!mregs) |
9109 | return; |
9110 | |
9111 | diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c |
9112 | index 578ebdd865205..e0ef758eade50 100644 |
9113 | --- a/drivers/usb/serial/digi_acceleport.c |
9114 | +++ b/drivers/usb/serial/digi_acceleport.c |
9115 | @@ -19,7 +19,6 @@ |
9116 | #include <linux/tty_flip.h> |
9117 | #include <linux/module.h> |
9118 | #include <linux/spinlock.h> |
9119 | -#include <linux/workqueue.h> |
9120 | #include <linux/uaccess.h> |
9121 | #include <linux/usb.h> |
9122 | #include <linux/wait.h> |
9123 | @@ -198,14 +197,12 @@ struct digi_port { |
9124 | int dp_throttle_restart; |
9125 | wait_queue_head_t dp_flush_wait; |
9126 | wait_queue_head_t dp_close_wait; /* wait queue for close */ |
9127 | - struct work_struct dp_wakeup_work; |
9128 | struct usb_serial_port *dp_port; |
9129 | }; |
9130 | |
9131 | |
9132 | /* Local Function Declarations */ |
9133 | |
9134 | -static void digi_wakeup_write_lock(struct work_struct *work); |
9135 | static int digi_write_oob_command(struct usb_serial_port *port, |
9136 | unsigned char *buf, int count, int interruptible); |
9137 | static int digi_write_inb_command(struct usb_serial_port *port, |
9138 | @@ -356,26 +353,6 @@ __releases(lock) |
9139 | return timeout; |
9140 | } |
9141 | |
9142 | - |
9143 | -/* |
9144 | - * Digi Wakeup Write |
9145 | - * |
9146 | - * Wake up port, line discipline, and tty processes sleeping |
9147 | - * on writes. |
9148 | - */ |
9149 | - |
9150 | -static void digi_wakeup_write_lock(struct work_struct *work) |
9151 | -{ |
9152 | - struct digi_port *priv = |
9153 | - container_of(work, struct digi_port, dp_wakeup_work); |
9154 | - struct usb_serial_port *port = priv->dp_port; |
9155 | - unsigned long flags; |
9156 | - |
9157 | - spin_lock_irqsave(&priv->dp_port_lock, flags); |
9158 | - tty_port_tty_wakeup(&port->port); |
9159 | - spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
9160 | -} |
9161 | - |
9162 | /* |
9163 | * Digi Write OOB Command |
9164 | * |
9165 | @@ -986,6 +963,7 @@ static void digi_write_bulk_callback(struct urb *urb) |
9166 | unsigned long flags; |
9167 | int ret = 0; |
9168 | int status = urb->status; |
9169 | + bool wakeup; |
9170 | |
9171 | /* port and serial sanity check */ |
9172 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
9173 | @@ -1012,6 +990,7 @@ static void digi_write_bulk_callback(struct urb *urb) |
9174 | } |
9175 | |
9176 | /* try to send any buffered data on this port */ |
9177 | + wakeup = true; |
9178 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
9179 | priv->dp_write_urb_in_use = 0; |
9180 | if (priv->dp_out_buf_len > 0) { |
9181 | @@ -1027,19 +1006,18 @@ static void digi_write_bulk_callback(struct urb *urb) |
9182 | if (ret == 0) { |
9183 | priv->dp_write_urb_in_use = 1; |
9184 | priv->dp_out_buf_len = 0; |
9185 | + wakeup = false; |
9186 | } |
9187 | } |
9188 | - /* wake up processes sleeping on writes immediately */ |
9189 | - tty_port_tty_wakeup(&port->port); |
9190 | - /* also queue up a wakeup at scheduler time, in case we */ |
9191 | - /* lost the race in write_chan(). */ |
9192 | - schedule_work(&priv->dp_wakeup_work); |
9193 | - |
9194 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
9195 | + |
9196 | if (ret && ret != -EPERM) |
9197 | dev_err_console(port, |
9198 | "%s: usb_submit_urb failed, ret=%d, port=%d\n", |
9199 | __func__, ret, priv->dp_port_num); |
9200 | + |
9201 | + if (wakeup) |
9202 | + tty_port_tty_wakeup(&port->port); |
9203 | } |
9204 | |
9205 | static int digi_write_room(struct tty_struct *tty) |
9206 | @@ -1239,7 +1217,6 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num) |
9207 | init_waitqueue_head(&priv->dp_transmit_idle_wait); |
9208 | init_waitqueue_head(&priv->dp_flush_wait); |
9209 | init_waitqueue_head(&priv->dp_close_wait); |
9210 | - INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
9211 | priv->dp_port = port; |
9212 | |
9213 | init_waitqueue_head(&port->write_wait); |
9214 | @@ -1508,13 +1485,14 @@ static int digi_read_oob_callback(struct urb *urb) |
9215 | rts = C_CRTSCTS(tty); |
9216 | |
9217 | if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
9218 | + bool wakeup = false; |
9219 | + |
9220 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
9221 | /* convert from digi flags to termiox flags */ |
9222 | if (val & DIGI_READ_INPUT_SIGNALS_CTS) { |
9223 | priv->dp_modem_signals |= TIOCM_CTS; |
9224 | - /* port must be open to use tty struct */ |
9225 | if (rts) |
9226 | - tty_port_tty_wakeup(&port->port); |
9227 | + wakeup = true; |
9228 | } else { |
9229 | priv->dp_modem_signals &= ~TIOCM_CTS; |
9230 | /* port must be open to use tty struct */ |
9231 | @@ -1533,6 +1511,9 @@ static int digi_read_oob_callback(struct urb *urb) |
9232 | priv->dp_modem_signals &= ~TIOCM_CD; |
9233 | |
9234 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
9235 | + |
9236 | + if (wakeup) |
9237 | + tty_port_tty_wakeup(&port->port); |
9238 | } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) { |
9239 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
9240 | priv->dp_transmit_idle = 1; |
9241 | diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c |
9242 | index bf988f77d4006..fab6aa8a676aa 100644 |
9243 | --- a/drivers/usb/serial/keyspan_pda.c |
9244 | +++ b/drivers/usb/serial/keyspan_pda.c |
9245 | @@ -40,11 +40,12 @@ |
9246 | #define DRIVER_AUTHOR "Brian Warner <warner@lothar.com>" |
9247 | #define DRIVER_DESC "USB Keyspan PDA Converter driver" |
9248 | |
9249 | +#define KEYSPAN_TX_THRESHOLD 16 |
9250 | + |
9251 | struct keyspan_pda_private { |
9252 | int tx_room; |
9253 | int tx_throttled; |
9254 | - struct work_struct wakeup_work; |
9255 | - struct work_struct unthrottle_work; |
9256 | + struct work_struct unthrottle_work; |
9257 | struct usb_serial *serial; |
9258 | struct usb_serial_port *port; |
9259 | }; |
9260 | @@ -97,15 +98,6 @@ static const struct usb_device_id id_table_fake_xircom[] = { |
9261 | }; |
9262 | #endif |
9263 | |
9264 | -static void keyspan_pda_wakeup_write(struct work_struct *work) |
9265 | -{ |
9266 | - struct keyspan_pda_private *priv = |
9267 | - container_of(work, struct keyspan_pda_private, wakeup_work); |
9268 | - struct usb_serial_port *port = priv->port; |
9269 | - |
9270 | - tty_port_tty_wakeup(&port->port); |
9271 | -} |
9272 | - |
9273 | static void keyspan_pda_request_unthrottle(struct work_struct *work) |
9274 | { |
9275 | struct keyspan_pda_private *priv = |
9276 | @@ -120,7 +112,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) |
9277 | 7, /* request_unthrottle */ |
9278 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
9279 | | USB_DIR_OUT, |
9280 | - 16, /* value: threshold */ |
9281 | + KEYSPAN_TX_THRESHOLD, |
9282 | 0, /* index */ |
9283 | NULL, |
9284 | 0, |
9285 | @@ -139,6 +131,8 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) |
9286 | int retval; |
9287 | int status = urb->status; |
9288 | struct keyspan_pda_private *priv; |
9289 | + unsigned long flags; |
9290 | + |
9291 | priv = usb_get_serial_port_data(port); |
9292 | |
9293 | switch (status) { |
9294 | @@ -172,18 +166,21 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) |
9295 | break; |
9296 | case 1: |
9297 | /* status interrupt */ |
9298 | - if (len < 3) { |
9299 | + if (len < 2) { |
9300 | dev_warn(&port->dev, "short interrupt message received\n"); |
9301 | break; |
9302 | } |
9303 | - dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]); |
9304 | + dev_dbg(&port->dev, "rx int, d1=%d\n", data[1]); |
9305 | switch (data[1]) { |
9306 | case 1: /* modemline change */ |
9307 | break; |
9308 | case 2: /* tx unthrottle interrupt */ |
9309 | + spin_lock_irqsave(&port->lock, flags); |
9310 | priv->tx_throttled = 0; |
9311 | + priv->tx_room = max(priv->tx_room, KEYSPAN_TX_THRESHOLD); |
9312 | + spin_unlock_irqrestore(&port->lock, flags); |
9313 | /* queue up a wakeup at scheduler time */ |
9314 | - schedule_work(&priv->wakeup_work); |
9315 | + usb_serial_port_softint(port); |
9316 | break; |
9317 | default: |
9318 | break; |
9319 | @@ -443,6 +440,7 @@ static int keyspan_pda_write(struct tty_struct *tty, |
9320 | int request_unthrottle = 0; |
9321 | int rc = 0; |
9322 | struct keyspan_pda_private *priv; |
9323 | + unsigned long flags; |
9324 | |
9325 | priv = usb_get_serial_port_data(port); |
9326 | /* guess how much room is left in the device's ring buffer, and if we |
9327 | @@ -462,13 +460,13 @@ static int keyspan_pda_write(struct tty_struct *tty, |
9328 | the TX urb is in-flight (wait until it completes) |
9329 | the device is full (wait until it says there is room) |
9330 | */ |
9331 | - spin_lock_bh(&port->lock); |
9332 | + spin_lock_irqsave(&port->lock, flags); |
9333 | if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) { |
9334 | - spin_unlock_bh(&port->lock); |
9335 | + spin_unlock_irqrestore(&port->lock, flags); |
9336 | return 0; |
9337 | } |
9338 | clear_bit(0, &port->write_urbs_free); |
9339 | - spin_unlock_bh(&port->lock); |
9340 | + spin_unlock_irqrestore(&port->lock, flags); |
9341 | |
9342 | /* At this point the URB is in our control, nobody else can submit it |
9343 | again (the only sudden transition was the one from EINPROGRESS to |
9344 | @@ -514,7 +512,8 @@ static int keyspan_pda_write(struct tty_struct *tty, |
9345 | goto exit; |
9346 | } |
9347 | } |
9348 | - if (count > priv->tx_room) { |
9349 | + |
9350 | + if (count >= priv->tx_room) { |
9351 | /* we're about to completely fill the Tx buffer, so |
9352 | we'll be throttled afterwards. */ |
9353 | count = priv->tx_room; |
9354 | @@ -547,7 +546,7 @@ static int keyspan_pda_write(struct tty_struct *tty, |
9355 | |
9356 | rc = count; |
9357 | exit: |
9358 | - if (rc < 0) |
9359 | + if (rc <= 0) |
9360 | set_bit(0, &port->write_urbs_free); |
9361 | return rc; |
9362 | } |
9363 | @@ -562,21 +561,24 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb) |
9364 | priv = usb_get_serial_port_data(port); |
9365 | |
9366 | /* queue up a wakeup at scheduler time */ |
9367 | - schedule_work(&priv->wakeup_work); |
9368 | + usb_serial_port_softint(port); |
9369 | } |
9370 | |
9371 | |
9372 | static int keyspan_pda_write_room(struct tty_struct *tty) |
9373 | { |
9374 | struct usb_serial_port *port = tty->driver_data; |
9375 | - struct keyspan_pda_private *priv; |
9376 | - priv = usb_get_serial_port_data(port); |
9377 | - /* used by n_tty.c for processing of tabs and such. Giving it our |
9378 | - conservative guess is probably good enough, but needs testing by |
9379 | - running a console through the device. */ |
9380 | - return priv->tx_room; |
9381 | -} |
9382 | + struct keyspan_pda_private *priv = usb_get_serial_port_data(port); |
9383 | + unsigned long flags; |
9384 | + int room = 0; |
9385 | |
9386 | + spin_lock_irqsave(&port->lock, flags); |
9387 | + if (test_bit(0, &port->write_urbs_free) && !priv->tx_throttled) |
9388 | + room = priv->tx_room; |
9389 | + spin_unlock_irqrestore(&port->lock, flags); |
9390 | + |
9391 | + return room; |
9392 | +} |
9393 | |
9394 | static int keyspan_pda_chars_in_buffer(struct tty_struct *tty) |
9395 | { |
9396 | @@ -656,8 +658,12 @@ error: |
9397 | } |
9398 | static void keyspan_pda_close(struct usb_serial_port *port) |
9399 | { |
9400 | + struct keyspan_pda_private *priv = usb_get_serial_port_data(port); |
9401 | + |
9402 | usb_kill_urb(port->write_urb); |
9403 | usb_kill_urb(port->interrupt_in_urb); |
9404 | + |
9405 | + cancel_work_sync(&priv->unthrottle_work); |
9406 | } |
9407 | |
9408 | |
9409 | @@ -715,7 +721,6 @@ static int keyspan_pda_port_probe(struct usb_serial_port *port) |
9410 | if (!priv) |
9411 | return -ENOMEM; |
9412 | |
9413 | - INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write); |
9414 | INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle); |
9415 | priv->serial = port->serial; |
9416 | priv->port = port; |
9417 | diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
9418 | index 2ec4eeacebc76..55b2879f27bdc 100644 |
9419 | --- a/drivers/usb/serial/mos7720.c |
9420 | +++ b/drivers/usb/serial/mos7720.c |
9421 | @@ -638,6 +638,8 @@ static void parport_mos7715_restore_state(struct parport *pp, |
9422 | spin_unlock(&release_lock); |
9423 | return; |
9424 | } |
9425 | + mos_parport->shadowDCR = s->u.pc.ctr; |
9426 | + mos_parport->shadowECR = s->u.pc.ecr; |
9427 | write_parport_reg_nonblock(mos_parport, MOS7720_DCR, |
9428 | mos_parport->shadowDCR); |
9429 | write_parport_reg_nonblock(mos_parport, MOS7720_ECR, |
9430 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
9431 | index c2ef238653002..531744049e7f0 100644 |
9432 | --- a/drivers/usb/serial/option.c |
9433 | +++ b/drivers/usb/serial/option.c |
9434 | @@ -563,6 +563,9 @@ static void option_instat_callback(struct urb *urb); |
9435 | |
9436 | /* Device flags */ |
9437 | |
9438 | +/* Highest interface number which can be used with NCTRL() and RSVD() */ |
9439 | +#define FLAG_IFNUM_MAX 7 |
9440 | + |
9441 | /* Interface does not support modem-control requests */ |
9442 | #define NCTRL(ifnum) ((BIT(ifnum) & 0xff) << 8) |
9443 | |
9444 | @@ -2101,6 +2104,14 @@ static struct usb_serial_driver * const serial_drivers[] = { |
9445 | |
9446 | module_usb_serial_driver(serial_drivers, option_ids); |
9447 | |
9448 | +static bool iface_is_reserved(unsigned long device_flags, u8 ifnum) |
9449 | +{ |
9450 | + if (ifnum > FLAG_IFNUM_MAX) |
9451 | + return false; |
9452 | + |
9453 | + return device_flags & RSVD(ifnum); |
9454 | +} |
9455 | + |
9456 | static int option_probe(struct usb_serial *serial, |
9457 | const struct usb_device_id *id) |
9458 | { |
9459 | @@ -2117,7 +2128,7 @@ static int option_probe(struct usb_serial *serial, |
9460 | * the same class/subclass/protocol as the serial interfaces. Look at |
9461 | * the Windows driver .INF files for reserved interface numbers. |
9462 | */ |
9463 | - if (device_flags & RSVD(iface_desc->bInterfaceNumber)) |
9464 | + if (iface_is_reserved(device_flags, iface_desc->bInterfaceNumber)) |
9465 | return -ENODEV; |
9466 | |
9467 | /* |
9468 | @@ -2133,6 +2144,14 @@ static int option_probe(struct usb_serial *serial, |
9469 | return 0; |
9470 | } |
9471 | |
9472 | +static bool iface_no_modem_control(unsigned long device_flags, u8 ifnum) |
9473 | +{ |
9474 | + if (ifnum > FLAG_IFNUM_MAX) |
9475 | + return false; |
9476 | + |
9477 | + return device_flags & NCTRL(ifnum); |
9478 | +} |
9479 | + |
9480 | static int option_attach(struct usb_serial *serial) |
9481 | { |
9482 | struct usb_interface_descriptor *iface_desc; |
9483 | @@ -2148,7 +2167,7 @@ static int option_attach(struct usb_serial *serial) |
9484 | |
9485 | iface_desc = &serial->interface->cur_altsetting->desc; |
9486 | |
9487 | - if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber))) |
9488 | + if (!iface_no_modem_control(device_flags, iface_desc->bInterfaceNumber)) |
9489 | data->use_send_setup = 1; |
9490 | |
9491 | if (device_flags & ZLP) |
9492 | diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
9493 | index 443a35dde7f52..632653cd70e3b 100644 |
9494 | --- a/drivers/vfio/pci/vfio_pci.c |
9495 | +++ b/drivers/vfio/pci/vfio_pci.c |
9496 | @@ -1451,8 +1451,8 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) |
9497 | |
9498 | mutex_unlock(&vdev->vma_lock); |
9499 | |
9500 | - if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
9501 | - vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
9502 | + if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
9503 | + vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
9504 | ret = VM_FAULT_SIGBUS; |
9505 | |
9506 | up_out: |
9507 | diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c |
9508 | index 3f5f8198a6bb1..08f17839c2fe2 100644 |
9509 | --- a/drivers/vfio/pci/vfio_pci_nvlink2.c |
9510 | +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c |
9511 | @@ -231,7 +231,7 @@ int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev) |
9512 | return -EINVAL; |
9513 | |
9514 | if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) |
9515 | - return -EINVAL; |
9516 | + return -ENODEV; |
9517 | |
9518 | mem_node = of_find_node_by_phandle(mem_phandle); |
9519 | if (!mem_node) |
9520 | @@ -393,7 +393,7 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev) |
9521 | int ret; |
9522 | struct vfio_pci_npu2_data *data; |
9523 | struct device_node *nvlink_dn; |
9524 | - u32 nvlink_index = 0; |
9525 | + u32 nvlink_index = 0, mem_phandle = 0; |
9526 | struct pci_dev *npdev = vdev->pdev; |
9527 | struct device_node *npu_node = pci_device_to_OF_node(npdev); |
9528 | struct pci_controller *hose = pci_bus_to_host(npdev->bus); |
9529 | @@ -408,6 +408,9 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev) |
9530 | if (!pnv_pci_get_gpu_dev(vdev->pdev)) |
9531 | return -ENODEV; |
9532 | |
9533 | + if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) |
9534 | + return -ENODEV; |
9535 | + |
9536 | /* |
9537 | * NPU2 normally has 8 ATSD registers (for concurrency) and 6 links |
9538 | * so we can allocate one register per link, using nvlink index as |
9539 | diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c |
9540 | index 5ff8e0320d95b..cf2bfff2efbf1 100644 |
9541 | --- a/drivers/video/fbdev/atmel_lcdfb.c |
9542 | +++ b/drivers/video/fbdev/atmel_lcdfb.c |
9543 | @@ -987,8 +987,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) |
9544 | } |
9545 | |
9546 | INIT_LIST_HEAD(&pdata->pwr_gpios); |
9547 | - ret = -ENOMEM; |
9548 | for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) { |
9549 | + ret = -ENOMEM; |
9550 | gpiod = devm_gpiod_get_index(dev, "atmel,power-control", |
9551 | i, GPIOD_ASIS); |
9552 | if (IS_ERR(gpiod)) |
9553 | diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c |
9554 | index 4f7c73e6052f6..97e8a195e18f5 100644 |
9555 | --- a/drivers/virtio/virtio_ring.c |
9556 | +++ b/drivers/virtio/virtio_ring.c |
9557 | @@ -1608,7 +1608,6 @@ static struct virtqueue *vring_create_virtqueue_packed( |
9558 | vq->num_added = 0; |
9559 | vq->packed_ring = true; |
9560 | vq->use_dma_api = vring_use_dma_api(vdev); |
9561 | - list_add_tail(&vq->vq.list, &vdev->vqs); |
9562 | #ifdef DEBUG |
9563 | vq->in_use = false; |
9564 | vq->last_add_time_valid = false; |
9565 | @@ -1669,6 +1668,7 @@ static struct virtqueue *vring_create_virtqueue_packed( |
9566 | cpu_to_le16(vq->packed.event_flags_shadow); |
9567 | } |
9568 | |
9569 | + list_add_tail(&vq->vq.list, &vdev->vqs); |
9570 | return &vq->vq; |
9571 | |
9572 | err_desc_extra: |
9573 | @@ -1676,9 +1676,9 @@ err_desc_extra: |
9574 | err_desc_state: |
9575 | kfree(vq); |
9576 | err_vq: |
9577 | - vring_free_queue(vdev, event_size_in_bytes, device, ring_dma_addr); |
9578 | + vring_free_queue(vdev, event_size_in_bytes, device, device_event_dma_addr); |
9579 | err_device: |
9580 | - vring_free_queue(vdev, event_size_in_bytes, driver, ring_dma_addr); |
9581 | + vring_free_queue(vdev, event_size_in_bytes, driver, driver_event_dma_addr); |
9582 | err_driver: |
9583 | vring_free_queue(vdev, ring_size_in_bytes, ring, ring_dma_addr); |
9584 | err_ring: |
9585 | @@ -2085,7 +2085,6 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, |
9586 | vq->last_used_idx = 0; |
9587 | vq->num_added = 0; |
9588 | vq->use_dma_api = vring_use_dma_api(vdev); |
9589 | - list_add_tail(&vq->vq.list, &vdev->vqs); |
9590 | #ifdef DEBUG |
9591 | vq->in_use = false; |
9592 | vq->last_add_time_valid = false; |
9593 | @@ -2127,6 +2126,7 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, |
9594 | memset(vq->split.desc_state, 0, vring.num * |
9595 | sizeof(struct vring_desc_state_split)); |
9596 | |
9597 | + list_add_tail(&vq->vq.list, &vdev->vqs); |
9598 | return &vq->vq; |
9599 | } |
9600 | EXPORT_SYMBOL_GPL(__vring_new_virtqueue); |
9601 | diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig |
9602 | index e2745f6861960..1aa42e879e633 100644 |
9603 | --- a/drivers/watchdog/Kconfig |
9604 | +++ b/drivers/watchdog/Kconfig |
9605 | @@ -374,6 +374,7 @@ config ARM_SBSA_WATCHDOG |
9606 | config ARMADA_37XX_WATCHDOG |
9607 | tristate "Armada 37xx watchdog" |
9608 | depends on ARCH_MVEBU || COMPILE_TEST |
9609 | + depends on HAS_IOMEM |
9610 | select MFD_SYSCON |
9611 | select WATCHDOG_CORE |
9612 | help |
9613 | @@ -617,7 +618,7 @@ config SUNXI_WATCHDOG |
9614 | |
9615 | config COH901327_WATCHDOG |
9616 | bool "ST-Ericsson COH 901 327 watchdog" |
9617 | - depends on ARCH_U300 || (ARM && COMPILE_TEST) |
9618 | + depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST) |
9619 | default y if MACH_U300 |
9620 | select WATCHDOG_CORE |
9621 | help |
9622 | @@ -774,6 +775,7 @@ config MOXART_WDT |
9623 | |
9624 | config SIRFSOC_WATCHDOG |
9625 | tristate "SiRFSOC watchdog" |
9626 | + depends on HAS_IOMEM |
9627 | depends on ARCH_SIRF || COMPILE_TEST |
9628 | select WATCHDOG_CORE |
9629 | default y |
9630 | diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c |
9631 | index eb47fe5ed2805..ea8a6abd64ecb 100644 |
9632 | --- a/drivers/watchdog/qcom-wdt.c |
9633 | +++ b/drivers/watchdog/qcom-wdt.c |
9634 | @@ -143,7 +143,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action, |
9635 | */ |
9636 | wmb(); |
9637 | |
9638 | - msleep(150); |
9639 | + mdelay(150); |
9640 | return 0; |
9641 | } |
9642 | |
9643 | diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c |
9644 | index 65cb55f3916fc..b9b1daa9e2a4c 100644 |
9645 | --- a/drivers/watchdog/sprd_wdt.c |
9646 | +++ b/drivers/watchdog/sprd_wdt.c |
9647 | @@ -108,18 +108,6 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout, |
9648 | u32 tmr_step = timeout * SPRD_WDT_CNT_STEP; |
9649 | u32 prtmr_step = pretimeout * SPRD_WDT_CNT_STEP; |
9650 | |
9651 | - sprd_wdt_unlock(wdt->base); |
9652 | - writel_relaxed((tmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
9653 | - SPRD_WDT_LOW_VALUE_MASK, wdt->base + SPRD_WDT_LOAD_HIGH); |
9654 | - writel_relaxed((tmr_step & SPRD_WDT_LOW_VALUE_MASK), |
9655 | - wdt->base + SPRD_WDT_LOAD_LOW); |
9656 | - writel_relaxed((prtmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
9657 | - SPRD_WDT_LOW_VALUE_MASK, |
9658 | - wdt->base + SPRD_WDT_IRQ_LOAD_HIGH); |
9659 | - writel_relaxed(prtmr_step & SPRD_WDT_LOW_VALUE_MASK, |
9660 | - wdt->base + SPRD_WDT_IRQ_LOAD_LOW); |
9661 | - sprd_wdt_lock(wdt->base); |
9662 | - |
9663 | /* |
9664 | * Waiting the load value operation done, |
9665 | * it needs two or three RTC clock cycles. |
9666 | @@ -134,6 +122,19 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout, |
9667 | |
9668 | if (delay_cnt >= SPRD_WDT_LOAD_TIMEOUT) |
9669 | return -EBUSY; |
9670 | + |
9671 | + sprd_wdt_unlock(wdt->base); |
9672 | + writel_relaxed((tmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
9673 | + SPRD_WDT_LOW_VALUE_MASK, wdt->base + SPRD_WDT_LOAD_HIGH); |
9674 | + writel_relaxed((tmr_step & SPRD_WDT_LOW_VALUE_MASK), |
9675 | + wdt->base + SPRD_WDT_LOAD_LOW); |
9676 | + writel_relaxed((prtmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
9677 | + SPRD_WDT_LOW_VALUE_MASK, |
9678 | + wdt->base + SPRD_WDT_IRQ_LOAD_HIGH); |
9679 | + writel_relaxed(prtmr_step & SPRD_WDT_LOW_VALUE_MASK, |
9680 | + wdt->base + SPRD_WDT_IRQ_LOAD_LOW); |
9681 | + sprd_wdt_lock(wdt->base); |
9682 | + |
9683 | return 0; |
9684 | } |
9685 | |
9686 | @@ -345,15 +346,10 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev) |
9687 | if (ret) |
9688 | return ret; |
9689 | |
9690 | - if (watchdog_active(&wdt->wdd)) { |
9691 | + if (watchdog_active(&wdt->wdd)) |
9692 | ret = sprd_wdt_start(&wdt->wdd); |
9693 | - if (ret) { |
9694 | - sprd_wdt_disable(wdt); |
9695 | - return ret; |
9696 | - } |
9697 | - } |
9698 | |
9699 | - return 0; |
9700 | + return ret; |
9701 | } |
9702 | |
9703 | static const struct dev_pm_ops sprd_wdt_pm_ops = { |
9704 | diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c |
9705 | index 861daf4f37b28..faa46a666f4c5 100644 |
9706 | --- a/drivers/watchdog/watchdog_core.c |
9707 | +++ b/drivers/watchdog/watchdog_core.c |
9708 | @@ -255,15 +255,19 @@ static int __watchdog_register_device(struct watchdog_device *wdd) |
9709 | } |
9710 | |
9711 | if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) { |
9712 | - wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; |
9713 | - |
9714 | - ret = register_reboot_notifier(&wdd->reboot_nb); |
9715 | - if (ret) { |
9716 | - pr_err("watchdog%d: Cannot register reboot notifier (%d)\n", |
9717 | - wdd->id, ret); |
9718 | - watchdog_dev_unregister(wdd); |
9719 | - ida_simple_remove(&watchdog_ida, id); |
9720 | - return ret; |
9721 | + if (!wdd->ops->stop) |
9722 | + pr_warn("watchdog%d: stop_on_reboot not supported\n", wdd->id); |
9723 | + else { |
9724 | + wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; |
9725 | + |
9726 | + ret = register_reboot_notifier(&wdd->reboot_nb); |
9727 | + if (ret) { |
9728 | + pr_err("watchdog%d: Cannot register reboot notifier (%d)\n", |
9729 | + wdd->id, ret); |
9730 | + watchdog_dev_unregister(wdd); |
9731 | + ida_simple_remove(&watchdog_ida, id); |
9732 | + return ret; |
9733 | + } |
9734 | } |
9735 | } |
9736 | |
9737 | diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c |
9738 | index e7a6702359655..7fb65836230ac 100644 |
9739 | --- a/drivers/xen/xen-pciback/xenbus.c |
9740 | +++ b/drivers/xen/xen-pciback/xenbus.c |
9741 | @@ -688,7 +688,7 @@ static int xen_pcibk_xenbus_probe(struct xenbus_device *dev, |
9742 | |
9743 | /* watch the backend node for backend configuration information */ |
9744 | err = xenbus_watch_path(dev, dev->nodename, &pdev->be_watch, |
9745 | - xen_pcibk_be_watch); |
9746 | + NULL, xen_pcibk_be_watch); |
9747 | if (err) |
9748 | goto out; |
9749 | |
9750 | diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h |
9751 | index d75a2385b37c7..88516a8a9f932 100644 |
9752 | --- a/drivers/xen/xenbus/xenbus.h |
9753 | +++ b/drivers/xen/xenbus/xenbus.h |
9754 | @@ -44,6 +44,8 @@ struct xen_bus_type { |
9755 | int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); |
9756 | int (*probe)(struct xen_bus_type *bus, const char *type, |
9757 | const char *dir); |
9758 | + bool (*otherend_will_handle)(struct xenbus_watch *watch, |
9759 | + const char *path, const char *token); |
9760 | void (*otherend_changed)(struct xenbus_watch *watch, const char *path, |
9761 | const char *token); |
9762 | struct bus_type bus; |
9763 | diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c |
9764 | index f38bdaea0ef11..81eddb8529ffc 100644 |
9765 | --- a/drivers/xen/xenbus/xenbus_client.c |
9766 | +++ b/drivers/xen/xenbus/xenbus_client.c |
9767 | @@ -114,18 +114,22 @@ EXPORT_SYMBOL_GPL(xenbus_strstate); |
9768 | */ |
9769 | int xenbus_watch_path(struct xenbus_device *dev, const char *path, |
9770 | struct xenbus_watch *watch, |
9771 | + bool (*will_handle)(struct xenbus_watch *, |
9772 | + const char *, const char *), |
9773 | void (*callback)(struct xenbus_watch *, |
9774 | const char *, const char *)) |
9775 | { |
9776 | int err; |
9777 | |
9778 | watch->node = path; |
9779 | + watch->will_handle = will_handle; |
9780 | watch->callback = callback; |
9781 | |
9782 | err = register_xenbus_watch(watch); |
9783 | |
9784 | if (err) { |
9785 | watch->node = NULL; |
9786 | + watch->will_handle = NULL; |
9787 | watch->callback = NULL; |
9788 | xenbus_dev_fatal(dev, err, "adding watch on %s", path); |
9789 | } |
9790 | @@ -152,6 +156,8 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path); |
9791 | */ |
9792 | int xenbus_watch_pathfmt(struct xenbus_device *dev, |
9793 | struct xenbus_watch *watch, |
9794 | + bool (*will_handle)(struct xenbus_watch *, |
9795 | + const char *, const char *), |
9796 | void (*callback)(struct xenbus_watch *, |
9797 | const char *, const char *), |
9798 | const char *pathfmt, ...) |
9799 | @@ -168,7 +174,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev, |
9800 | xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch"); |
9801 | return -ENOMEM; |
9802 | } |
9803 | - err = xenbus_watch_path(dev, path, watch, callback); |
9804 | + err = xenbus_watch_path(dev, path, watch, will_handle, callback); |
9805 | |
9806 | if (err) |
9807 | kfree(path); |
9808 | diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c |
9809 | index 5b471889d7237..e6d0903459e11 100644 |
9810 | --- a/drivers/xen/xenbus/xenbus_probe.c |
9811 | +++ b/drivers/xen/xenbus/xenbus_probe.c |
9812 | @@ -136,6 +136,7 @@ static int watch_otherend(struct xenbus_device *dev) |
9813 | container_of(dev->dev.bus, struct xen_bus_type, bus); |
9814 | |
9815 | return xenbus_watch_pathfmt(dev, &dev->otherend_watch, |
9816 | + bus->otherend_will_handle, |
9817 | bus->otherend_changed, |
9818 | "%s/%s", dev->otherend, "state"); |
9819 | } |
9820 | diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c |
9821 | index b0bed4faf44cc..4bb603051d5b6 100644 |
9822 | --- a/drivers/xen/xenbus/xenbus_probe_backend.c |
9823 | +++ b/drivers/xen/xenbus/xenbus_probe_backend.c |
9824 | @@ -180,6 +180,12 @@ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type, |
9825 | return err; |
9826 | } |
9827 | |
9828 | +static bool frontend_will_handle(struct xenbus_watch *watch, |
9829 | + const char *path, const char *token) |
9830 | +{ |
9831 | + return watch->nr_pending == 0; |
9832 | +} |
9833 | + |
9834 | static void frontend_changed(struct xenbus_watch *watch, |
9835 | const char *path, const char *token) |
9836 | { |
9837 | @@ -191,6 +197,7 @@ static struct xen_bus_type xenbus_backend = { |
9838 | .levels = 3, /* backend/type/<frontend>/<id> */ |
9839 | .get_bus_id = backend_bus_id, |
9840 | .probe = xenbus_probe_backend, |
9841 | + .otherend_will_handle = frontend_will_handle, |
9842 | .otherend_changed = frontend_changed, |
9843 | .bus = { |
9844 | .name = "xen-backend", |
9845 | diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c |
9846 | index 3a06eb699f333..12e02eb01f599 100644 |
9847 | --- a/drivers/xen/xenbus/xenbus_xs.c |
9848 | +++ b/drivers/xen/xenbus/xenbus_xs.c |
9849 | @@ -705,9 +705,13 @@ int xs_watch_msg(struct xs_watch_event *event) |
9850 | |
9851 | spin_lock(&watches_lock); |
9852 | event->handle = find_watch(event->token); |
9853 | - if (event->handle != NULL) { |
9854 | + if (event->handle != NULL && |
9855 | + (!event->handle->will_handle || |
9856 | + event->handle->will_handle(event->handle, |
9857 | + event->path, event->token))) { |
9858 | spin_lock(&watch_events_lock); |
9859 | list_add_tail(&event->list, &watch_events); |
9860 | + event->handle->nr_pending++; |
9861 | wake_up(&watch_events_waitq); |
9862 | spin_unlock(&watch_events_lock); |
9863 | } else |
9864 | @@ -765,6 +769,8 @@ int register_xenbus_watch(struct xenbus_watch *watch) |
9865 | |
9866 | sprintf(token, "%lX", (long)watch); |
9867 | |
9868 | + watch->nr_pending = 0; |
9869 | + |
9870 | down_read(&xs_watch_rwsem); |
9871 | |
9872 | spin_lock(&watches_lock); |
9873 | @@ -814,11 +820,14 @@ void unregister_xenbus_watch(struct xenbus_watch *watch) |
9874 | |
9875 | /* Cancel pending watch events. */ |
9876 | spin_lock(&watch_events_lock); |
9877 | - list_for_each_entry_safe(event, tmp, &watch_events, list) { |
9878 | - if (event->handle != watch) |
9879 | - continue; |
9880 | - list_del(&event->list); |
9881 | - kfree(event); |
9882 | + if (watch->nr_pending) { |
9883 | + list_for_each_entry_safe(event, tmp, &watch_events, list) { |
9884 | + if (event->handle != watch) |
9885 | + continue; |
9886 | + list_del(&event->list); |
9887 | + kfree(event); |
9888 | + } |
9889 | + watch->nr_pending = 0; |
9890 | } |
9891 | spin_unlock(&watch_events_lock); |
9892 | |
9893 | @@ -865,7 +874,6 @@ void xs_suspend_cancel(void) |
9894 | |
9895 | static int xenwatch_thread(void *unused) |
9896 | { |
9897 | - struct list_head *ent; |
9898 | struct xs_watch_event *event; |
9899 | |
9900 | xenwatch_pid = current->pid; |
9901 | @@ -880,13 +888,15 @@ static int xenwatch_thread(void *unused) |
9902 | mutex_lock(&xenwatch_mutex); |
9903 | |
9904 | spin_lock(&watch_events_lock); |
9905 | - ent = watch_events.next; |
9906 | - if (ent != &watch_events) |
9907 | - list_del(ent); |
9908 | + event = list_first_entry_or_null(&watch_events, |
9909 | + struct xs_watch_event, list); |
9910 | + if (event) { |
9911 | + list_del(&event->list); |
9912 | + event->handle->nr_pending--; |
9913 | + } |
9914 | spin_unlock(&watch_events_lock); |
9915 | |
9916 | - if (ent != &watch_events) { |
9917 | - event = list_entry(ent, struct xs_watch_event, list); |
9918 | + if (event) { |
9919 | event->handle->callback(event->handle, event->path, |
9920 | event->token); |
9921 | kfree(event); |
9922 | diff --git a/fs/afs/super.c b/fs/afs/super.c |
9923 | index 7f8a9b3137bff..eb04dcc543289 100644 |
9924 | --- a/fs/afs/super.c |
9925 | +++ b/fs/afs/super.c |
9926 | @@ -236,6 +236,9 @@ static int afs_parse_source(struct fs_context *fc, struct fs_parameter *param) |
9927 | |
9928 | _enter(",%s", name); |
9929 | |
9930 | + if (fc->source) |
9931 | + return invalf(fc, "kAFS: Multiple sources not supported"); |
9932 | + |
9933 | if (!name) { |
9934 | printk(KERN_ERR "kAFS: no volume name specified\n"); |
9935 | return -EINVAL; |
9936 | diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
9937 | index c6d9e8c07c236..c0dd839e99b79 100644 |
9938 | --- a/fs/btrfs/extent-tree.c |
9939 | +++ b/fs/btrfs/extent-tree.c |
9940 | @@ -32,6 +32,7 @@ |
9941 | #include "block-rsv.h" |
9942 | #include "delalloc-space.h" |
9943 | #include "block-group.h" |
9944 | +#include "rcu-string.h" |
9945 | |
9946 | #undef SCRAMBLE_DELAYED_REFS |
9947 | |
9948 | @@ -2838,10 +2839,10 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, |
9949 | len = cache->key.objectid + cache->key.offset - start; |
9950 | len = min(len, end + 1 - start); |
9951 | |
9952 | - if (start < cache->last_byte_to_unpin) { |
9953 | - len = min(len, cache->last_byte_to_unpin - start); |
9954 | - if (return_free_space) |
9955 | - btrfs_add_free_space(cache, start, len); |
9956 | + if (start < cache->last_byte_to_unpin && return_free_space) { |
9957 | + u64 add_len = min(len, cache->last_byte_to_unpin - start); |
9958 | + |
9959 | + btrfs_add_free_space(cache, start, add_len); |
9960 | } |
9961 | |
9962 | start += len; |
9963 | @@ -5618,6 +5619,19 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, u64 *trimmed) |
9964 | &start, &end, |
9965 | CHUNK_TRIMMED | CHUNK_ALLOCATED); |
9966 | |
9967 | + /* Check if there are any CHUNK_* bits left */ |
9968 | + if (start > device->total_bytes) { |
9969 | + WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG)); |
9970 | + btrfs_warn_in_rcu(fs_info, |
9971 | +"ignoring attempt to trim beyond device size: offset %llu length %llu device %s device size %llu", |
9972 | + start, end - start + 1, |
9973 | + rcu_str_deref(device->name), |
9974 | + device->total_bytes); |
9975 | + mutex_unlock(&fs_info->chunk_mutex); |
9976 | + ret = 0; |
9977 | + break; |
9978 | + } |
9979 | + |
9980 | /* Ensure we skip the reserved area in the first 1M */ |
9981 | start = max_t(u64, start, SZ_1M); |
9982 | |
9983 | diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h |
9984 | index bc858c8cef0a6..fcf1807cc8dd7 100644 |
9985 | --- a/fs/btrfs/extent_io.h |
9986 | +++ b/fs/btrfs/extent_io.h |
9987 | @@ -35,6 +35,8 @@ |
9988 | */ |
9989 | #define CHUNK_ALLOCATED EXTENT_DIRTY |
9990 | #define CHUNK_TRIMMED EXTENT_DEFRAG |
9991 | +#define CHUNK_STATE_MASK (CHUNK_ALLOCATED | \ |
9992 | + CHUNK_TRIMMED) |
9993 | |
9994 | /* |
9995 | * flags for bio submission. The high bits indicate the compression |
9996 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
9997 | index 457f8f858a3f0..67ffbe92944c6 100644 |
9998 | --- a/fs/btrfs/volumes.c |
9999 | +++ b/fs/btrfs/volumes.c |
10000 | @@ -4908,6 +4908,10 @@ again: |
10001 | } |
10002 | |
10003 | mutex_lock(&fs_info->chunk_mutex); |
10004 | + /* Clear all state bits beyond the shrunk device size */ |
10005 | + clear_extent_bits(&device->alloc_state, new_size, (u64)-1, |
10006 | + CHUNK_STATE_MASK); |
10007 | + |
10008 | btrfs_device_set_disk_total_bytes(device, new_size); |
10009 | if (list_empty(&device->post_commit_list)) |
10010 | list_add_tail(&device->post_commit_list, |
10011 | diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
10012 | index af563d73d252c..22833fa5bb589 100644 |
10013 | --- a/fs/ceph/caps.c |
10014 | +++ b/fs/ceph/caps.c |
10015 | @@ -1052,12 +1052,19 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) |
10016 | { |
10017 | struct ceph_mds_session *session = cap->session; |
10018 | struct ceph_inode_info *ci = cap->ci; |
10019 | - struct ceph_mds_client *mdsc = |
10020 | - ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; |
10021 | + struct ceph_mds_client *mdsc; |
10022 | int removed = 0; |
10023 | |
10024 | + /* 'ci' being NULL means the remove have already occurred */ |
10025 | + if (!ci) { |
10026 | + dout("%s: cap inode is NULL\n", __func__); |
10027 | + return; |
10028 | + } |
10029 | + |
10030 | dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); |
10031 | |
10032 | + mdsc = ceph_inode_to_client(&ci->vfs_inode)->mdsc; |
10033 | + |
10034 | /* remove from inode's cap rbtree, and clear auth cap */ |
10035 | rb_erase(&cap->ci_node, &ci->i_caps); |
10036 | if (ci->i_auth_cap == cap) |
10037 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
10038 | index 6211f8b731a97..30025cc5d4ae7 100644 |
10039 | --- a/fs/cifs/smb2ops.c |
10040 | +++ b/fs/cifs/smb2ops.c |
10041 | @@ -478,7 +478,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, |
10042 | goto out; |
10043 | } |
10044 | |
10045 | - if (bytes_left || p->Next) |
10046 | + /* Azure rounds the buffer size up 8, to a 16 byte boundary */ |
10047 | + if ((bytes_left > 8) || p->Next) |
10048 | cifs_dbg(VFS, "%s: incomplete interface info\n", __func__); |
10049 | |
10050 | |
10051 | diff --git a/fs/erofs/data.c b/fs/erofs/data.c |
10052 | index fc3a8d8064f84..b22a08ac53a23 100644 |
10053 | --- a/fs/erofs/data.c |
10054 | +++ b/fs/erofs/data.c |
10055 | @@ -323,27 +323,12 @@ static int erofs_raw_access_readpages(struct file *filp, |
10056 | return 0; |
10057 | } |
10058 | |
10059 | -static int erofs_get_block(struct inode *inode, sector_t iblock, |
10060 | - struct buffer_head *bh, int create) |
10061 | -{ |
10062 | - struct erofs_map_blocks map = { |
10063 | - .m_la = iblock << 9, |
10064 | - }; |
10065 | - int err; |
10066 | - |
10067 | - err = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); |
10068 | - if (err) |
10069 | - return err; |
10070 | - |
10071 | - if (map.m_flags & EROFS_MAP_MAPPED) |
10072 | - bh->b_blocknr = erofs_blknr(map.m_pa); |
10073 | - |
10074 | - return err; |
10075 | -} |
10076 | - |
10077 | static sector_t erofs_bmap(struct address_space *mapping, sector_t block) |
10078 | { |
10079 | struct inode *inode = mapping->host; |
10080 | + struct erofs_map_blocks map = { |
10081 | + .m_la = blknr_to_addr(block), |
10082 | + }; |
10083 | |
10084 | if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) { |
10085 | erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE; |
10086 | @@ -352,7 +337,10 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) |
10087 | return 0; |
10088 | } |
10089 | |
10090 | - return generic_block_bmap(mapping, block, erofs_get_block); |
10091 | + if (!erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW)) |
10092 | + return erofs_blknr(map.m_pa); |
10093 | + |
10094 | + return 0; |
10095 | } |
10096 | |
10097 | /* for uncompressed (aligned) files and raw access for other files */ |
10098 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
10099 | index cbd028a31daff..3bac525f0439d 100644 |
10100 | --- a/fs/ext4/inode.c |
10101 | +++ b/fs/ext4/inode.c |
10102 | @@ -203,6 +203,7 @@ void ext4_evict_inode(struct inode *inode) |
10103 | */ |
10104 | int extra_credits = 6; |
10105 | struct ext4_xattr_inode_array *ea_inode_array = NULL; |
10106 | + bool freeze_protected = false; |
10107 | |
10108 | trace_ext4_evict_inode(inode); |
10109 | |
10110 | @@ -250,9 +251,14 @@ void ext4_evict_inode(struct inode *inode) |
10111 | |
10112 | /* |
10113 | * Protect us against freezing - iput() caller didn't have to have any |
10114 | - * protection against it |
10115 | + * protection against it. When we are in a running transaction though, |
10116 | + * we are already protected against freezing and we cannot grab further |
10117 | + * protection due to lock ordering constraints. |
10118 | */ |
10119 | - sb_start_intwrite(inode->i_sb); |
10120 | + if (!ext4_journal_current_handle()) { |
10121 | + sb_start_intwrite(inode->i_sb); |
10122 | + freeze_protected = true; |
10123 | + } |
10124 | |
10125 | if (!IS_NOQUOTA(inode)) |
10126 | extra_credits += EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb); |
10127 | @@ -271,7 +277,8 @@ void ext4_evict_inode(struct inode *inode) |
10128 | * cleaned up. |
10129 | */ |
10130 | ext4_orphan_del(NULL, inode); |
10131 | - sb_end_intwrite(inode->i_sb); |
10132 | + if (freeze_protected) |
10133 | + sb_end_intwrite(inode->i_sb); |
10134 | goto no_delete; |
10135 | } |
10136 | |
10137 | @@ -312,7 +319,8 @@ void ext4_evict_inode(struct inode *inode) |
10138 | stop_handle: |
10139 | ext4_journal_stop(handle); |
10140 | ext4_orphan_del(NULL, inode); |
10141 | - sb_end_intwrite(inode->i_sb); |
10142 | + if (freeze_protected) |
10143 | + sb_end_intwrite(inode->i_sb); |
10144 | ext4_xattr_inode_array_free(ea_inode_array); |
10145 | goto no_delete; |
10146 | } |
10147 | @@ -341,7 +349,8 @@ stop_handle: |
10148 | else |
10149 | ext4_free_inode(handle, inode); |
10150 | ext4_journal_stop(handle); |
10151 | - sb_end_intwrite(inode->i_sb); |
10152 | + if (freeze_protected) |
10153 | + sb_end_intwrite(inode->i_sb); |
10154 | ext4_xattr_inode_array_free(ea_inode_array); |
10155 | return; |
10156 | no_delete: |
10157 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
10158 | index e5d43d2ee474d..cd69510f29472 100644 |
10159 | --- a/fs/ext4/mballoc.c |
10160 | +++ b/fs/ext4/mballoc.c |
10161 | @@ -4691,6 +4691,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b, |
10162 | ext4_group_first_block_no(sb, group) + |
10163 | EXT4_C2B(sbi, cluster), |
10164 | "Block already on to-be-freed list"); |
10165 | + kmem_cache_free(ext4_free_data_cachep, new_entry); |
10166 | return 0; |
10167 | } |
10168 | } |
10169 | diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
10170 | index 2a4a382f28fed..3ac2a4b32375d 100644 |
10171 | --- a/fs/f2fs/node.c |
10172 | +++ b/fs/f2fs/node.c |
10173 | @@ -109,7 +109,7 @@ static void clear_node_page_dirty(struct page *page) |
10174 | |
10175 | static struct page *get_current_nat_page(struct f2fs_sb_info *sbi, nid_t nid) |
10176 | { |
10177 | - return f2fs_get_meta_page(sbi, current_nat_addr(sbi, nid)); |
10178 | + return f2fs_get_meta_page_retry(sbi, current_nat_addr(sbi, nid)); |
10179 | } |
10180 | |
10181 | static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid) |
10182 | diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c |
10183 | index bccfc40b3a74a..d19483fa1fe89 100644 |
10184 | --- a/fs/jffs2/readinode.c |
10185 | +++ b/fs/jffs2/readinode.c |
10186 | @@ -672,6 +672,22 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r |
10187 | jffs2_free_full_dirent(fd); |
10188 | return -EIO; |
10189 | } |
10190 | + |
10191 | +#ifdef CONFIG_JFFS2_SUMMARY |
10192 | + /* |
10193 | + * we use CONFIG_JFFS2_SUMMARY because without it, we |
10194 | + * have checked it while mounting |
10195 | + */ |
10196 | + crc = crc32(0, fd->name, rd->nsize); |
10197 | + if (unlikely(crc != je32_to_cpu(rd->name_crc))) { |
10198 | + JFFS2_NOTICE("name CRC failed on dirent node at" |
10199 | + "%#08x: read %#08x,calculated %#08x\n", |
10200 | + ref_offset(ref), je32_to_cpu(rd->node_crc), crc); |
10201 | + jffs2_mark_node_obsolete(c, ref); |
10202 | + jffs2_free_full_dirent(fd); |
10203 | + return 0; |
10204 | + } |
10205 | +#endif |
10206 | } |
10207 | |
10208 | fd->nhash = full_name_hash(NULL, fd->name, rd->nsize); |
10209 | diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c |
10210 | index 0e6406c4f3621..60636b2e35ea4 100644 |
10211 | --- a/fs/jffs2/super.c |
10212 | +++ b/fs/jffs2/super.c |
10213 | @@ -221,11 +221,28 @@ static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) |
10214 | return 0; |
10215 | } |
10216 | |
10217 | +static inline void jffs2_update_mount_opts(struct fs_context *fc) |
10218 | +{ |
10219 | + struct jffs2_sb_info *new_c = fc->s_fs_info; |
10220 | + struct jffs2_sb_info *c = JFFS2_SB_INFO(fc->root->d_sb); |
10221 | + |
10222 | + mutex_lock(&c->alloc_sem); |
10223 | + if (new_c->mount_opts.override_compr) { |
10224 | + c->mount_opts.override_compr = new_c->mount_opts.override_compr; |
10225 | + c->mount_opts.compr = new_c->mount_opts.compr; |
10226 | + } |
10227 | + if (new_c->mount_opts.rp_size) |
10228 | + c->mount_opts.rp_size = new_c->mount_opts.rp_size; |
10229 | + mutex_unlock(&c->alloc_sem); |
10230 | +} |
10231 | + |
10232 | static int jffs2_reconfigure(struct fs_context *fc) |
10233 | { |
10234 | struct super_block *sb = fc->root->d_sb; |
10235 | |
10236 | sync_filesystem(sb); |
10237 | + jffs2_update_mount_opts(fc); |
10238 | + |
10239 | return jffs2_do_remount_fs(sb, fc); |
10240 | } |
10241 | |
10242 | diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h |
10243 | index 29891fad3f095..aa03a904d5ab2 100644 |
10244 | --- a/fs/jfs/jfs_dmap.h |
10245 | +++ b/fs/jfs/jfs_dmap.h |
10246 | @@ -183,7 +183,7 @@ typedef union dmtree { |
10247 | #define dmt_leafidx t1.leafidx |
10248 | #define dmt_height t1.height |
10249 | #define dmt_budmin t1.budmin |
10250 | -#define dmt_stree t1.stree |
10251 | +#define dmt_stree t2.stree |
10252 | |
10253 | /* |
10254 | * on-disk aggregate disk allocation map descriptor. |
10255 | diff --git a/fs/lockd/host.c b/fs/lockd/host.c |
10256 | index 7d46fafdbbe5a..584c03e11844e 100644 |
10257 | --- a/fs/lockd/host.c |
10258 | +++ b/fs/lockd/host.c |
10259 | @@ -439,12 +439,7 @@ nlm_bind_host(struct nlm_host *host) |
10260 | * RPC rebind is required |
10261 | */ |
10262 | if ((clnt = host->h_rpcclnt) != NULL) { |
10263 | - if (time_after_eq(jiffies, host->h_nextrebind)) { |
10264 | - rpc_force_rebind(clnt); |
10265 | - host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
10266 | - dprintk("lockd: next rebind in %lu jiffies\n", |
10267 | - host->h_nextrebind - jiffies); |
10268 | - } |
10269 | + nlm_rebind_host(host); |
10270 | } else { |
10271 | unsigned long increment = nlmsvc_timeout; |
10272 | struct rpc_timeout timeparms = { |
10273 | @@ -493,13 +488,20 @@ nlm_bind_host(struct nlm_host *host) |
10274 | return clnt; |
10275 | } |
10276 | |
10277 | -/* |
10278 | - * Force a portmap lookup of the remote lockd port |
10279 | +/** |
10280 | + * nlm_rebind_host - If needed, force a portmap lookup of the peer's lockd port |
10281 | + * @host: NLM host handle for peer |
10282 | + * |
10283 | + * This is not needed when using a connection-oriented protocol, such as TCP. |
10284 | + * The existing autobind mechanism is sufficient to force a rebind when |
10285 | + * required, e.g. on connection state transitions. |
10286 | */ |
10287 | void |
10288 | nlm_rebind_host(struct nlm_host *host) |
10289 | { |
10290 | - dprintk("lockd: rebind host %s\n", host->h_name); |
10291 | + if (host->h_proto != IPPROTO_UDP) |
10292 | + return; |
10293 | + |
10294 | if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) { |
10295 | rpc_force_rebind(host->h_rpcclnt); |
10296 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
10297 | diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
10298 | index 6de41f7412808..53604cc090ca5 100644 |
10299 | --- a/fs/nfs/inode.c |
10300 | +++ b/fs/nfs/inode.c |
10301 | @@ -2151,7 +2151,7 @@ static int nfsiod_start(void) |
10302 | { |
10303 | struct workqueue_struct *wq; |
10304 | dprintk("RPC: creating workqueue nfsiod\n"); |
10305 | - wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM, 0); |
10306 | + wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0); |
10307 | if (wq == NULL) |
10308 | return -ENOMEM; |
10309 | nfsiod_workqueue = wq; |
10310 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
10311 | index ddc900df461c8..8598eba3fc234 100644 |
10312 | --- a/fs/nfs/nfs4proc.c |
10313 | +++ b/fs/nfs/nfs4proc.c |
10314 | @@ -4899,12 +4899,12 @@ static int _nfs4_proc_readdir(struct dentry *dentry, const struct cred *cred, |
10315 | u64 cookie, struct page **pages, unsigned int count, bool plus) |
10316 | { |
10317 | struct inode *dir = d_inode(dentry); |
10318 | + struct nfs_server *server = NFS_SERVER(dir); |
10319 | struct nfs4_readdir_arg args = { |
10320 | .fh = NFS_FH(dir), |
10321 | .pages = pages, |
10322 | .pgbase = 0, |
10323 | .count = count, |
10324 | - .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask, |
10325 | .plus = plus, |
10326 | }; |
10327 | struct nfs4_readdir_res res; |
10328 | @@ -4919,9 +4919,15 @@ static int _nfs4_proc_readdir(struct dentry *dentry, const struct cred *cred, |
10329 | dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__, |
10330 | dentry, |
10331 | (unsigned long long)cookie); |
10332 | + if (!(server->caps & NFS_CAP_SECURITY_LABEL)) |
10333 | + args.bitmask = server->attr_bitmask_nl; |
10334 | + else |
10335 | + args.bitmask = server->attr_bitmask; |
10336 | + |
10337 | nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args); |
10338 | res.pgbase = args.pgbase; |
10339 | - status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0); |
10340 | + status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, |
10341 | + &res.seq_res, 0); |
10342 | if (status >= 0) { |
10343 | memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE); |
10344 | status += args.pgbase; |
10345 | diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c |
10346 | index 677751bc3a334..9a022a4fb9643 100644 |
10347 | --- a/fs/nfs/nfs4xdr.c |
10348 | +++ b/fs/nfs/nfs4xdr.c |
10349 | @@ -3012,15 +3012,19 @@ static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, |
10350 | struct compound_hdr hdr = { |
10351 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
10352 | }; |
10353 | + uint32_t replen; |
10354 | |
10355 | encode_compound_hdr(xdr, req, &hdr); |
10356 | encode_sequence(xdr, &args->seq_args, &hdr); |
10357 | + |
10358 | + replen = hdr.replen + op_decode_hdr_maxsz; |
10359 | + |
10360 | encode_getdeviceinfo(xdr, args, &hdr); |
10361 | |
10362 | - /* set up reply kvec. Subtract notification bitmap max size (2) |
10363 | - * so that notification bitmap is put in xdr_buf tail */ |
10364 | + /* set up reply kvec. device_addr4 opaque data is read into the |
10365 | + * pages */ |
10366 | rpc_prepare_reply_pages(req, args->pdev->pages, args->pdev->pgbase, |
10367 | - args->pdev->pglen, hdr.replen - 2); |
10368 | + args->pdev->pglen, replen + 2 + 1); |
10369 | encode_nops(&hdr); |
10370 | } |
10371 | |
10372 | diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c |
10373 | index b73d9dd37f73c..26f2a50eceac9 100644 |
10374 | --- a/fs/nfs_common/grace.c |
10375 | +++ b/fs/nfs_common/grace.c |
10376 | @@ -69,10 +69,14 @@ __state_in_grace(struct net *net, bool open) |
10377 | if (!open) |
10378 | return !list_empty(grace_list); |
10379 | |
10380 | + spin_lock(&grace_lock); |
10381 | list_for_each_entry(lm, grace_list, list) { |
10382 | - if (lm->block_opens) |
10383 | + if (lm->block_opens) { |
10384 | + spin_unlock(&grace_lock); |
10385 | return true; |
10386 | + } |
10387 | } |
10388 | + spin_unlock(&grace_lock); |
10389 | return false; |
10390 | } |
10391 | |
10392 | diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c |
10393 | index e8bee8ff30c59..155a4e43b24ee 100644 |
10394 | --- a/fs/nfsd/nfssvc.c |
10395 | +++ b/fs/nfsd/nfssvc.c |
10396 | @@ -516,8 +516,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net) |
10397 | return; |
10398 | |
10399 | nfsd_shutdown_net(net); |
10400 | - printk(KERN_WARNING "nfsd: last server has exited, flushing export " |
10401 | - "cache\n"); |
10402 | + pr_info("nfsd: last server has exited, flushing export cache\n"); |
10403 | nfsd_export_flush(net); |
10404 | } |
10405 | |
10406 | diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c |
10407 | index 276c27fb99280..36dce17b01016 100644 |
10408 | --- a/fs/quota/quota_v2.c |
10409 | +++ b/fs/quota/quota_v2.c |
10410 | @@ -159,6 +159,25 @@ static int v2_read_file_info(struct super_block *sb, int type) |
10411 | qinfo->dqi_entry_size = sizeof(struct v2r1_disk_dqblk); |
10412 | qinfo->dqi_ops = &v2r1_qtree_ops; |
10413 | } |
10414 | + ret = -EUCLEAN; |
10415 | + /* Some sanity checks of the read headers... */ |
10416 | + if ((loff_t)qinfo->dqi_blocks << qinfo->dqi_blocksize_bits > |
10417 | + i_size_read(sb_dqopt(sb)->files[type])) { |
10418 | + quota_error(sb, "Number of blocks too big for quota file size (%llu > %llu).", |
10419 | + (loff_t)qinfo->dqi_blocks << qinfo->dqi_blocksize_bits, |
10420 | + i_size_read(sb_dqopt(sb)->files[type])); |
10421 | + goto out; |
10422 | + } |
10423 | + if (qinfo->dqi_free_blk >= qinfo->dqi_blocks) { |
10424 | + quota_error(sb, "Free block number too big (%u >= %u).", |
10425 | + qinfo->dqi_free_blk, qinfo->dqi_blocks); |
10426 | + goto out; |
10427 | + } |
10428 | + if (qinfo->dqi_free_entry >= qinfo->dqi_blocks) { |
10429 | + quota_error(sb, "Block with free entry too big (%u >= %u).", |
10430 | + qinfo->dqi_free_entry, qinfo->dqi_blocks); |
10431 | + goto out; |
10432 | + } |
10433 | ret = 0; |
10434 | out: |
10435 | up_read(&dqopt->dqio_sem); |
10436 | diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c |
10437 | index f985a3fbbb36a..b10418b5fb719 100644 |
10438 | --- a/fs/ubifs/auth.c |
10439 | +++ b/fs/ubifs/auth.c |
10440 | @@ -352,8 +352,10 @@ int ubifs_init_authentication(struct ubifs_info *c) |
10441 | c->authenticated = true; |
10442 | |
10443 | c->log_hash = ubifs_hash_get_desc(c); |
10444 | - if (IS_ERR(c->log_hash)) |
10445 | + if (IS_ERR(c->log_hash)) { |
10446 | + err = PTR_ERR(c->log_hash); |
10447 | goto out_free_hmac; |
10448 | + } |
10449 | |
10450 | err = 0; |
10451 | |
10452 | diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c |
10453 | index 7e4bfaf2871fa..eae9cf5a57b05 100644 |
10454 | --- a/fs/ubifs/io.c |
10455 | +++ b/fs/ubifs/io.c |
10456 | @@ -319,7 +319,7 @@ void ubifs_pad(const struct ubifs_info *c, void *buf, int pad) |
10457 | { |
10458 | uint32_t crc; |
10459 | |
10460 | - ubifs_assert(c, pad >= 0 && !(pad & 7)); |
10461 | + ubifs_assert(c, pad >= 0); |
10462 | |
10463 | if (pad >= UBIFS_PAD_NODE_SZ) { |
10464 | struct ubifs_ch *ch = buf; |
10465 | @@ -764,6 +764,10 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) |
10466 | * write-buffer. |
10467 | */ |
10468 | memcpy(wbuf->buf + wbuf->used, buf, len); |
10469 | + if (aligned_len > len) { |
10470 | + ubifs_assert(c, aligned_len - len < 8); |
10471 | + ubifs_pad(c, wbuf->buf + wbuf->used + len, aligned_len - len); |
10472 | + } |
10473 | |
10474 | if (aligned_len == wbuf->avail) { |
10475 | dbg_io("flush jhead %s wbuf to LEB %d:%d", |
10476 | @@ -856,13 +860,18 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) |
10477 | } |
10478 | |
10479 | spin_lock(&wbuf->lock); |
10480 | - if (aligned_len) |
10481 | + if (aligned_len) { |
10482 | /* |
10483 | * And now we have what's left and what does not take whole |
10484 | * max. write unit, so write it to the write-buffer and we are |
10485 | * done. |
10486 | */ |
10487 | memcpy(wbuf->buf, buf + written, len); |
10488 | + if (aligned_len > len) { |
10489 | + ubifs_assert(c, aligned_len - len < 8); |
10490 | + ubifs_pad(c, wbuf->buf + len, aligned_len - len); |
10491 | + } |
10492 | + } |
10493 | |
10494 | if (c->leb_size - wbuf->offs >= c->max_write_size) |
10495 | wbuf->size = c->max_write_size; |
10496 | diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h |
10497 | index 3f6fddeb75199..defed629073bf 100644 |
10498 | --- a/include/acpi/acpi_bus.h |
10499 | +++ b/include/acpi/acpi_bus.h |
10500 | @@ -614,7 +614,6 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev); |
10501 | bool acpi_pm_device_can_wakeup(struct device *dev); |
10502 | int acpi_pm_device_sleep_state(struct device *, int *, int); |
10503 | int acpi_pm_set_device_wakeup(struct device *dev, bool enable); |
10504 | -int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable); |
10505 | #else |
10506 | static inline void acpi_pm_wakeup_event(struct device *dev) |
10507 | { |
10508 | @@ -645,10 +644,6 @@ static inline int acpi_pm_set_device_wakeup(struct device *dev, bool enable) |
10509 | { |
10510 | return -ENODEV; |
10511 | } |
10512 | -static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) |
10513 | -{ |
10514 | - return -ENODEV; |
10515 | -} |
10516 | #endif |
10517 | |
10518 | #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT |
10519 | diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h |
10520 | index 1b261c51b3a3a..f5c21b7d29748 100644 |
10521 | --- a/include/linux/netfilter/x_tables.h |
10522 | +++ b/include/linux/netfilter/x_tables.h |
10523 | @@ -227,7 +227,7 @@ struct xt_table { |
10524 | unsigned int valid_hooks; |
10525 | |
10526 | /* Man behind the curtain... */ |
10527 | - struct xt_table_info *private; |
10528 | + struct xt_table_info __rcu *private; |
10529 | |
10530 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
10531 | struct module *me; |
10532 | @@ -448,6 +448,9 @@ xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu) |
10533 | |
10534 | struct nf_hook_ops *xt_hook_ops_alloc(const struct xt_table *, nf_hookfn *); |
10535 | |
10536 | +struct xt_table_info |
10537 | +*xt_table_get_private_protected(const struct xt_table *table); |
10538 | + |
10539 | #ifdef CONFIG_COMPAT |
10540 | #include <net/compat.h> |
10541 | |
10542 | diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h |
10543 | index fe61e3b9a9ca2..7145795b4b9da 100644 |
10544 | --- a/include/linux/pm_runtime.h |
10545 | +++ b/include/linux/pm_runtime.h |
10546 | @@ -224,6 +224,27 @@ static inline int pm_runtime_get_sync(struct device *dev) |
10547 | return __pm_runtime_resume(dev, RPM_GET_PUT); |
10548 | } |
10549 | |
10550 | +/** |
10551 | + * pm_runtime_resume_and_get - Bump up usage counter of a device and resume it. |
10552 | + * @dev: Target device. |
10553 | + * |
10554 | + * Resume @dev synchronously and if that is successful, increment its runtime |
10555 | + * PM usage counter. Return 0 if the runtime PM usage counter of @dev has been |
10556 | + * incremented or a negative error code otherwise. |
10557 | + */ |
10558 | +static inline int pm_runtime_resume_and_get(struct device *dev) |
10559 | +{ |
10560 | + int ret; |
10561 | + |
10562 | + ret = __pm_runtime_resume(dev, RPM_GET_PUT); |
10563 | + if (ret < 0) { |
10564 | + pm_runtime_put_noidle(dev); |
10565 | + return ret; |
10566 | + } |
10567 | + |
10568 | + return 0; |
10569 | +} |
10570 | + |
10571 | static inline int pm_runtime_put(struct device *dev) |
10572 | { |
10573 | return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC); |
10574 | diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h |
10575 | index 13eafebf3549a..b83a3f944f287 100644 |
10576 | --- a/include/linux/prefetch.h |
10577 | +++ b/include/linux/prefetch.h |
10578 | @@ -15,6 +15,7 @@ |
10579 | #include <asm/processor.h> |
10580 | #include <asm/cache.h> |
10581 | |
10582 | +struct page; |
10583 | /* |
10584 | prefetch(x) attempts to pre-emptively get the memory pointed to |
10585 | by address "x" into the CPU L1 cache. |
10586 | @@ -62,4 +63,11 @@ static inline void prefetch_range(void *addr, size_t len) |
10587 | #endif |
10588 | } |
10589 | |
10590 | +static inline void prefetch_page_address(struct page *page) |
10591 | +{ |
10592 | +#if defined(WANT_PAGE_VIRTUAL) || defined(HASHED_PAGE_VIRTUAL) |
10593 | + prefetch(page); |
10594 | +#endif |
10595 | +} |
10596 | + |
10597 | #endif |
10598 | diff --git a/include/linux/security.h b/include/linux/security.h |
10599 | index fd022768e91df..df90399a8af98 100644 |
10600 | --- a/include/linux/security.h |
10601 | +++ b/include/linux/security.h |
10602 | @@ -852,7 +852,7 @@ static inline int security_inode_killpriv(struct dentry *dentry) |
10603 | |
10604 | static inline int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc) |
10605 | { |
10606 | - return -EOPNOTSUPP; |
10607 | + return cap_inode_getsecurity(inode, name, buffer, alloc); |
10608 | } |
10609 | |
10610 | static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags) |
10611 | diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h |
10612 | index aa5deb041c25d..7cc952282e8be 100644 |
10613 | --- a/include/linux/seq_buf.h |
10614 | +++ b/include/linux/seq_buf.h |
10615 | @@ -30,7 +30,7 @@ static inline void seq_buf_clear(struct seq_buf *s) |
10616 | } |
10617 | |
10618 | static inline void |
10619 | -seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size) |
10620 | +seq_buf_init(struct seq_buf *s, char *buf, unsigned int size) |
10621 | { |
10622 | s->buffer = buf; |
10623 | s->size = size; |
10624 | diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h |
10625 | index d783e15ba898c..d7ef5b97174ce 100644 |
10626 | --- a/include/linux/sunrpc/xprt.h |
10627 | +++ b/include/linux/sunrpc/xprt.h |
10628 | @@ -330,6 +330,7 @@ struct xprt_class { |
10629 | struct rpc_xprt * (*setup)(struct xprt_create *); |
10630 | struct module *owner; |
10631 | char name[32]; |
10632 | + const char * netid[]; |
10633 | }; |
10634 | |
10635 | /* |
10636 | diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h |
10637 | index 6609b39a72326..6db257466af68 100644 |
10638 | --- a/include/linux/trace_seq.h |
10639 | +++ b/include/linux/trace_seq.h |
10640 | @@ -12,7 +12,7 @@ |
10641 | */ |
10642 | |
10643 | struct trace_seq { |
10644 | - unsigned char buffer[PAGE_SIZE]; |
10645 | + char buffer[PAGE_SIZE]; |
10646 | struct seq_buf seq; |
10647 | int full; |
10648 | }; |
10649 | @@ -51,7 +51,7 @@ static inline int trace_seq_used(struct trace_seq *s) |
10650 | * that is about to be written to and then return the result |
10651 | * of that write. |
10652 | */ |
10653 | -static inline unsigned char * |
10654 | +static inline char * |
10655 | trace_seq_buffer_ptr(struct trace_seq *s) |
10656 | { |
10657 | return s->buffer + seq_buf_used(&s->seq); |
10658 | diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h |
10659 | index 45f88f0248c4e..c072ed1418113 100644 |
10660 | --- a/include/media/v4l2-mediabus.h |
10661 | +++ b/include/media/v4l2-mediabus.h |
10662 | @@ -78,6 +78,7 @@ |
10663 | * @V4L2_MBUS_CCP2: CCP2 (Compact Camera Port 2) |
10664 | * @V4L2_MBUS_CSI2_DPHY: MIPI CSI-2 serial interface, with D-PHY |
10665 | * @V4L2_MBUS_CSI2_CPHY: MIPI CSI-2 serial interface, with C-PHY |
10666 | + * @V4L2_MBUS_INVALID: invalid bus type (keep as last) |
10667 | */ |
10668 | enum v4l2_mbus_type { |
10669 | V4L2_MBUS_UNKNOWN, |
10670 | @@ -87,6 +88,7 @@ enum v4l2_mbus_type { |
10671 | V4L2_MBUS_CCP2, |
10672 | V4L2_MBUS_CSI2_DPHY, |
10673 | V4L2_MBUS_CSI2_CPHY, |
10674 | + V4L2_MBUS_INVALID, |
10675 | }; |
10676 | |
10677 | /** |
10678 | diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h |
10679 | index a576bcbba2fcc..f694f08ad635b 100644 |
10680 | --- a/include/net/netfilter/nf_tables.h |
10681 | +++ b/include/net/netfilter/nf_tables.h |
10682 | @@ -1462,4 +1462,10 @@ void nft_chain_filter_fini(void); |
10683 | |
10684 | void __init nft_chain_route_init(void); |
10685 | void nft_chain_route_fini(void); |
10686 | + |
10687 | +void nf_tables_trans_destroy_flush_work(void); |
10688 | + |
10689 | +int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result); |
10690 | +__be64 nf_jiffies64_to_msecs(u64 input); |
10691 | + |
10692 | #endif /* _NET_NF_TABLES_H */ |
10693 | diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h |
10694 | index 2832134e53971..731780804c2fd 100644 |
10695 | --- a/include/uapi/linux/android/binder.h |
10696 | +++ b/include/uapi/linux/android/binder.h |
10697 | @@ -248,6 +248,7 @@ enum transaction_flags { |
10698 | TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ |
10699 | TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ |
10700 | TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ |
10701 | + TF_CLEAR_BUF = 0x20, /* clear buffer on txn complete */ |
10702 | }; |
10703 | |
10704 | struct binder_transaction_data { |
10705 | diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h |
10706 | index bc2bcdec377b4..7690507714231 100644 |
10707 | --- a/include/uapi/linux/if_alg.h |
10708 | +++ b/include/uapi/linux/if_alg.h |
10709 | @@ -24,6 +24,22 @@ struct sockaddr_alg { |
10710 | __u8 salg_name[64]; |
10711 | }; |
10712 | |
10713 | +/* |
10714 | + * Linux v4.12 and later removed the 64-byte limit on salg_name[]; it's now an |
10715 | + * arbitrary-length field. We had to keep the original struct above for source |
10716 | + * compatibility with existing userspace programs, though. Use the new struct |
10717 | + * below if support for very long algorithm names is needed. To do this, |
10718 | + * allocate 'sizeof(struct sockaddr_alg_new) + strlen(algname) + 1' bytes, and |
10719 | + * copy algname (including the null terminator) into salg_name. |
10720 | + */ |
10721 | +struct sockaddr_alg_new { |
10722 | + __u16 salg_family; |
10723 | + __u8 salg_type[14]; |
10724 | + __u32 salg_feat; |
10725 | + __u32 salg_mask; |
10726 | + __u8 salg_name[]; |
10727 | +}; |
10728 | + |
10729 | struct af_alg_iv { |
10730 | __u32 ivlen; |
10731 | __u8 iv[0]; |
10732 | diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h |
10733 | index 869c816d5f8c3..eba01ab5a55e0 100644 |
10734 | --- a/include/xen/xenbus.h |
10735 | +++ b/include/xen/xenbus.h |
10736 | @@ -59,6 +59,15 @@ struct xenbus_watch |
10737 | /* Path being watched. */ |
10738 | const char *node; |
10739 | |
10740 | + unsigned int nr_pending; |
10741 | + |
10742 | + /* |
10743 | + * Called just before enqueing new event while a spinlock is held. |
10744 | + * The event will be discarded if this callback returns false. |
10745 | + */ |
10746 | + bool (*will_handle)(struct xenbus_watch *, |
10747 | + const char *path, const char *token); |
10748 | + |
10749 | /* Callback (executed in a process context with no locks held). */ |
10750 | void (*callback)(struct xenbus_watch *, |
10751 | const char *path, const char *token); |
10752 | @@ -192,10 +201,14 @@ void xenbus_probe(struct work_struct *); |
10753 | |
10754 | int xenbus_watch_path(struct xenbus_device *dev, const char *path, |
10755 | struct xenbus_watch *watch, |
10756 | + bool (*will_handle)(struct xenbus_watch *, |
10757 | + const char *, const char *), |
10758 | void (*callback)(struct xenbus_watch *, |
10759 | const char *, const char *)); |
10760 | -__printf(4, 5) |
10761 | +__printf(5, 6) |
10762 | int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch, |
10763 | + bool (*will_handle)(struct xenbus_watch *, |
10764 | + const char *, const char *), |
10765 | void (*callback)(struct xenbus_watch *, |
10766 | const char *, const char *), |
10767 | const char *pathfmt, ...); |
10768 | diff --git a/init/initramfs.c b/init/initramfs.c |
10769 | index 5feee4f616d55..00a32799a38b0 100644 |
10770 | --- a/init/initramfs.c |
10771 | +++ b/init/initramfs.c |
10772 | @@ -527,7 +527,7 @@ extern unsigned long __initramfs_size; |
10773 | #include <linux/initrd.h> |
10774 | #include <linux/kexec.h> |
10775 | |
10776 | -void __weak free_initrd_mem(unsigned long start, unsigned long end) |
10777 | +void __weak __init free_initrd_mem(unsigned long start, unsigned long end) |
10778 | { |
10779 | free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, |
10780 | "initrd"); |
10781 | diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
10782 | index c87ee6412b36a..bab6a934862e3 100644 |
10783 | --- a/kernel/cgroup/cpuset.c |
10784 | +++ b/kernel/cgroup/cpuset.c |
10785 | @@ -981,25 +981,48 @@ partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[], |
10786 | */ |
10787 | static void rebuild_sched_domains_locked(void) |
10788 | { |
10789 | + struct cgroup_subsys_state *pos_css; |
10790 | struct sched_domain_attr *attr; |
10791 | cpumask_var_t *doms; |
10792 | + struct cpuset *cs; |
10793 | int ndoms; |
10794 | |
10795 | lockdep_assert_cpus_held(); |
10796 | percpu_rwsem_assert_held(&cpuset_rwsem); |
10797 | |
10798 | /* |
10799 | - * We have raced with CPU hotplug. Don't do anything to avoid |
10800 | + * If we have raced with CPU hotplug, return early to avoid |
10801 | * passing doms with offlined cpu to partition_sched_domains(). |
10802 | - * Anyways, hotplug work item will rebuild sched domains. |
10803 | + * Anyways, cpuset_hotplug_workfn() will rebuild sched domains. |
10804 | + * |
10805 | + * With no CPUs in any subpartitions, top_cpuset's effective CPUs |
10806 | + * should be the same as the active CPUs, so checking only top_cpuset |
10807 | + * is enough to detect racing CPU offlines. |
10808 | */ |
10809 | if (!top_cpuset.nr_subparts_cpus && |
10810 | !cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) |
10811 | return; |
10812 | |
10813 | - if (top_cpuset.nr_subparts_cpus && |
10814 | - !cpumask_subset(top_cpuset.effective_cpus, cpu_active_mask)) |
10815 | - return; |
10816 | + /* |
10817 | + * With subpartition CPUs, however, the effective CPUs of a partition |
10818 | + * root should be only a subset of the active CPUs. Since a CPU in any |
10819 | + * partition root could be offlined, all must be checked. |
10820 | + */ |
10821 | + if (top_cpuset.nr_subparts_cpus) { |
10822 | + rcu_read_lock(); |
10823 | + cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { |
10824 | + if (!is_partition_root(cs)) { |
10825 | + pos_css = css_rightmost_descendant(pos_css); |
10826 | + continue; |
10827 | + } |
10828 | + if (!cpumask_subset(cs->effective_cpus, |
10829 | + cpu_active_mask)) { |
10830 | + rcu_read_unlock(); |
10831 | + return; |
10832 | + } |
10833 | + } |
10834 | + rcu_read_unlock(); |
10835 | + } |
10836 | |
10837 | /* Generate domain masks and attrs */ |
10838 | ndoms = generate_sched_domains(&doms, &attr); |
10839 | diff --git a/kernel/cpu.c b/kernel/cpu.c |
10840 | index 7527825ac7daa..fa0e5727b4d9c 100644 |
10841 | --- a/kernel/cpu.c |
10842 | +++ b/kernel/cpu.c |
10843 | @@ -815,6 +815,10 @@ void __init cpuhp_threads_init(void) |
10844 | } |
10845 | |
10846 | #ifdef CONFIG_HOTPLUG_CPU |
10847 | +#ifndef arch_clear_mm_cpumask_cpu |
10848 | +#define arch_clear_mm_cpumask_cpu(cpu, mm) cpumask_clear_cpu(cpu, mm_cpumask(mm)) |
10849 | +#endif |
10850 | + |
10851 | /** |
10852 | * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU |
10853 | * @cpu: a CPU id |
10854 | @@ -850,7 +854,7 @@ void clear_tasks_mm_cpumask(int cpu) |
10855 | t = find_lock_task_mm(p); |
10856 | if (!t) |
10857 | continue; |
10858 | - cpumask_clear_cpu(cpu, mm_cpumask(t->mm)); |
10859 | + arch_clear_mm_cpumask_cpu(cpu, t->mm); |
10860 | task_unlock(t); |
10861 | } |
10862 | rcu_read_unlock(); |
10863 | diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c |
10864 | index 5a60de39457c7..5e03cbee70d67 100644 |
10865 | --- a/kernel/irq/irqdomain.c |
10866 | +++ b/kernel/irq/irqdomain.c |
10867 | @@ -1288,8 +1288,15 @@ static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain, |
10868 | unsigned int irq_base, |
10869 | unsigned int nr_irqs) |
10870 | { |
10871 | - if (domain->ops->free) |
10872 | - domain->ops->free(domain, irq_base, nr_irqs); |
10873 | + unsigned int i; |
10874 | + |
10875 | + if (!domain->ops->free) |
10876 | + return; |
10877 | + |
10878 | + for (i = 0; i < nr_irqs; i++) { |
10879 | + if (irq_domain_get_irq_data(domain, irq_base + i)) |
10880 | + domain->ops->free(domain, irq_base + i, 1); |
10881 | + } |
10882 | } |
10883 | |
10884 | int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain, |
10885 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
10886 | index 4511532b08b84..7841e738e38f0 100644 |
10887 | --- a/kernel/sched/core.c |
10888 | +++ b/kernel/sched/core.c |
10889 | @@ -5679,12 +5679,8 @@ static void do_sched_yield(void) |
10890 | schedstat_inc(rq->yld_count); |
10891 | current->sched_class->yield_task(rq); |
10892 | |
10893 | - /* |
10894 | - * Since we are going to call schedule() anyway, there's |
10895 | - * no need to preempt or enable interrupts: |
10896 | - */ |
10897 | preempt_disable(); |
10898 | - rq_unlock(rq, &rf); |
10899 | + rq_unlock_irq(rq, &rf); |
10900 | sched_preempt_enable_no_resched(); |
10901 | |
10902 | schedule(); |
10903 | diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c |
10904 | index 4cb00538a207b..4ce8c11e5e4ae 100644 |
10905 | --- a/kernel/sched/deadline.c |
10906 | +++ b/kernel/sched/deadline.c |
10907 | @@ -2469,7 +2469,7 @@ int sched_dl_global_validate(void) |
10908 | u64 period = global_rt_period(); |
10909 | u64 new_bw = to_ratio(period, runtime); |
10910 | struct dl_bw *dl_b; |
10911 | - int cpu, ret = 0; |
10912 | + int cpu, cpus, ret = 0; |
10913 | unsigned long flags; |
10914 | |
10915 | /* |
10916 | @@ -2484,9 +2484,10 @@ int sched_dl_global_validate(void) |
10917 | for_each_possible_cpu(cpu) { |
10918 | rcu_read_lock_sched(); |
10919 | dl_b = dl_bw_of(cpu); |
10920 | + cpus = dl_bw_cpus(cpu); |
10921 | |
10922 | raw_spin_lock_irqsave(&dl_b->lock, flags); |
10923 | - if (new_bw < dl_b->total_bw) |
10924 | + if (new_bw * cpus < dl_b->total_bw) |
10925 | ret = -EBUSY; |
10926 | raw_spin_unlock_irqrestore(&dl_b->lock, flags); |
10927 | |
10928 | diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
10929 | index 3e7590813844f..e10fb9bf2988c 100644 |
10930 | --- a/kernel/sched/sched.h |
10931 | +++ b/kernel/sched/sched.h |
10932 | @@ -247,30 +247,6 @@ struct rt_bandwidth { |
10933 | |
10934 | void __dl_clear_params(struct task_struct *p); |
10935 | |
10936 | -/* |
10937 | - * To keep the bandwidth of -deadline tasks and groups under control |
10938 | - * we need some place where: |
10939 | - * - store the maximum -deadline bandwidth of the system (the group); |
10940 | - * - cache the fraction of that bandwidth that is currently allocated. |
10941 | - * |
10942 | - * This is all done in the data structure below. It is similar to the |
10943 | - * one used for RT-throttling (rt_bandwidth), with the main difference |
10944 | - * that, since here we are only interested in admission control, we |
10945 | - * do not decrease any runtime while the group "executes", neither we |
10946 | - * need a timer to replenish it. |
10947 | - * |
10948 | - * With respect to SMP, the bandwidth is given on a per-CPU basis, |
10949 | - * meaning that: |
10950 | - * - dl_bw (< 100%) is the bandwidth of the system (group) on each CPU; |
10951 | - * - dl_total_bw array contains, in the i-eth element, the currently |
10952 | - * allocated bandwidth on the i-eth CPU. |
10953 | - * Moreover, groups consume bandwidth on each CPU, while tasks only |
10954 | - * consume bandwidth on the CPU they're running on. |
10955 | - * Finally, dl_total_bw_cpu is used to cache the index of dl_total_bw |
10956 | - * that will be shown the next time the proc or cgroup controls will |
10957 | - * be red. It on its turn can be changed by writing on its own |
10958 | - * control. |
10959 | - */ |
10960 | struct dl_bandwidth { |
10961 | raw_spinlock_t dl_runtime_lock; |
10962 | u64 dl_runtime; |
10963 | @@ -282,6 +258,24 @@ static inline int dl_bandwidth_enabled(void) |
10964 | return sysctl_sched_rt_runtime >= 0; |
10965 | } |
10966 | |
10967 | +/* |
10968 | + * To keep the bandwidth of -deadline tasks under control |
10969 | + * we need some place where: |
10970 | + * - store the maximum -deadline bandwidth of each cpu; |
10971 | + * - cache the fraction of bandwidth that is currently allocated in |
10972 | + * each root domain; |
10973 | + * |
10974 | + * This is all done in the data structure below. It is similar to the |
10975 | + * one used for RT-throttling (rt_bandwidth), with the main difference |
10976 | + * that, since here we are only interested in admission control, we |
10977 | + * do not decrease any runtime while the group "executes", neither we |
10978 | + * need a timer to replenish it. |
10979 | + * |
10980 | + * With respect to SMP, bandwidth is given on a per root domain basis, |
10981 | + * meaning that: |
10982 | + * - bw (< 100%) is the deadline bandwidth of each CPU; |
10983 | + * - total_bw is the currently allocated bandwidth in each root domain; |
10984 | + */ |
10985 | struct dl_bw { |
10986 | raw_spinlock_t lock; |
10987 | u64 bw; |
10988 | diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c |
10989 | index 2372b861f2cfa..74c1db7178cff 100644 |
10990 | --- a/kernel/trace/bpf_trace.c |
10991 | +++ b/kernel/trace/bpf_trace.c |
10992 | @@ -1320,10 +1320,12 @@ struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name) |
10993 | |
10994 | void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp) |
10995 | { |
10996 | - struct module *mod = __module_address((unsigned long)btp); |
10997 | + struct module *mod; |
10998 | |
10999 | - if (mod) |
11000 | - module_put(mod); |
11001 | + preempt_disable(); |
11002 | + mod = __module_address((unsigned long)btp); |
11003 | + module_put(mod); |
11004 | + preempt_enable(); |
11005 | } |
11006 | |
11007 | static __always_inline |
11008 | diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c |
11009 | index 6e5c6b023dc32..077877ed54f73 100644 |
11010 | --- a/kernel/trace/ring_buffer.c |
11011 | +++ b/kernel/trace/ring_buffer.c |
11012 | @@ -129,7 +129,16 @@ int ring_buffer_print_entry_header(struct trace_seq *s) |
11013 | #define RB_ALIGNMENT 4U |
11014 | #define RB_MAX_SMALL_DATA (RB_ALIGNMENT * RINGBUF_TYPE_DATA_TYPE_LEN_MAX) |
11015 | #define RB_EVNT_MIN_SIZE 8U /* two 32bit words */ |
11016 | -#define RB_ALIGN_DATA __aligned(RB_ALIGNMENT) |
11017 | + |
11018 | +#ifndef CONFIG_HAVE_64BIT_ALIGNED_ACCESS |
11019 | +# define RB_FORCE_8BYTE_ALIGNMENT 0 |
11020 | +# define RB_ARCH_ALIGNMENT RB_ALIGNMENT |
11021 | +#else |
11022 | +# define RB_FORCE_8BYTE_ALIGNMENT 1 |
11023 | +# define RB_ARCH_ALIGNMENT 8U |
11024 | +#endif |
11025 | + |
11026 | +#define RB_ALIGN_DATA __aligned(RB_ARCH_ALIGNMENT) |
11027 | |
11028 | /* define RINGBUF_TYPE_DATA for 'case RINGBUF_TYPE_DATA:' */ |
11029 | #define RINGBUF_TYPE_DATA 0 ... RINGBUF_TYPE_DATA_TYPE_LEN_MAX |
11030 | @@ -2367,7 +2376,7 @@ rb_update_event(struct ring_buffer_per_cpu *cpu_buffer, |
11031 | |
11032 | event->time_delta = delta; |
11033 | length -= RB_EVNT_HDR_SIZE; |
11034 | - if (length > RB_MAX_SMALL_DATA) { |
11035 | + if (length > RB_MAX_SMALL_DATA || RB_FORCE_8BYTE_ALIGNMENT) { |
11036 | event->type_len = 0; |
11037 | event->array[0] = length; |
11038 | } else |
11039 | @@ -2382,11 +2391,11 @@ static unsigned rb_calculate_event_length(unsigned length) |
11040 | if (!length) |
11041 | length++; |
11042 | |
11043 | - if (length > RB_MAX_SMALL_DATA) |
11044 | + if (length > RB_MAX_SMALL_DATA || RB_FORCE_8BYTE_ALIGNMENT) |
11045 | length += sizeof(event.array[0]); |
11046 | |
11047 | length += RB_EVNT_HDR_SIZE; |
11048 | - length = ALIGN(length, RB_ALIGNMENT); |
11049 | + length = ALIGN(length, RB_ARCH_ALIGNMENT); |
11050 | |
11051 | /* |
11052 | * In case the time delta is larger than the 27 bits for it |
11053 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
11054 | index 1c869c6b825f3..4357f5475a504 100644 |
11055 | --- a/mm/page_alloc.c |
11056 | +++ b/mm/page_alloc.c |
11057 | @@ -2346,12 +2346,12 @@ static bool can_steal_fallback(unsigned int order, int start_mt) |
11058 | return false; |
11059 | } |
11060 | |
11061 | -static inline void boost_watermark(struct zone *zone) |
11062 | +static inline bool boost_watermark(struct zone *zone) |
11063 | { |
11064 | unsigned long max_boost; |
11065 | |
11066 | if (!watermark_boost_factor) |
11067 | - return; |
11068 | + return false; |
11069 | /* |
11070 | * Don't bother in zones that are unlikely to produce results. |
11071 | * On small machines, including kdump capture kernels running |
11072 | @@ -2359,7 +2359,7 @@ static inline void boost_watermark(struct zone *zone) |
11073 | * memory situation immediately. |
11074 | */ |
11075 | if ((pageblock_nr_pages * 4) > zone_managed_pages(zone)) |
11076 | - return; |
11077 | + return false; |
11078 | |
11079 | max_boost = mult_frac(zone->_watermark[WMARK_HIGH], |
11080 | watermark_boost_factor, 10000); |
11081 | @@ -2373,12 +2373,14 @@ static inline void boost_watermark(struct zone *zone) |
11082 | * boosted watermark resulting in a hang. |
11083 | */ |
11084 | if (!max_boost) |
11085 | - return; |
11086 | + return false; |
11087 | |
11088 | max_boost = max(pageblock_nr_pages, max_boost); |
11089 | |
11090 | zone->watermark_boost = min(zone->watermark_boost + pageblock_nr_pages, |
11091 | max_boost); |
11092 | + |
11093 | + return true; |
11094 | } |
11095 | |
11096 | /* |
11097 | @@ -2417,8 +2419,7 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page, |
11098 | * likelihood of future fallbacks. Wake kswapd now as the node |
11099 | * may be balanced overall and kswapd will not wake naturally. |
11100 | */ |
11101 | - boost_watermark(zone); |
11102 | - if (alloc_flags & ALLOC_KSWAPD) |
11103 | + if (boost_watermark(zone) && (alloc_flags & ALLOC_KSWAPD)) |
11104 | set_bit(ZONE_BOOSTED_WATERMARK, &zone->flags); |
11105 | |
11106 | /* We are not allowed to try stealing from the whole block */ |
11107 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
11108 | index 9917b399ddd0d..0a88645f103f0 100644 |
11109 | --- a/net/bluetooth/hci_event.c |
11110 | +++ b/net/bluetooth/hci_event.c |
11111 | @@ -4791,6 +4791,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev, |
11112 | return; |
11113 | } |
11114 | |
11115 | + if (!hcon->amp_mgr) { |
11116 | + hci_dev_unlock(hdev); |
11117 | + return; |
11118 | + } |
11119 | + |
11120 | if (ev->status) { |
11121 | hci_conn_del(hcon); |
11122 | hci_dev_unlock(hdev); |
11123 | @@ -5711,21 +5716,19 @@ static void hci_le_direct_adv_report_evt(struct hci_dev *hdev, |
11124 | struct sk_buff *skb) |
11125 | { |
11126 | u8 num_reports = skb->data[0]; |
11127 | - void *ptr = &skb->data[1]; |
11128 | + struct hci_ev_le_direct_adv_info *ev = (void *)&skb->data[1]; |
11129 | |
11130 | - hci_dev_lock(hdev); |
11131 | + if (!num_reports || skb->len < num_reports * sizeof(*ev) + 1) |
11132 | + return; |
11133 | |
11134 | - while (num_reports--) { |
11135 | - struct hci_ev_le_direct_adv_info *ev = ptr; |
11136 | + hci_dev_lock(hdev); |
11137 | |
11138 | + for (; num_reports; num_reports--, ev++) |
11139 | process_adv_report(hdev, ev->evt_type, &ev->bdaddr, |
11140 | ev->bdaddr_type, &ev->direct_addr, |
11141 | ev->direct_addr_type, ev->rssi, NULL, 0, |
11142 | false); |
11143 | |
11144 | - ptr += sizeof(*ev); |
11145 | - } |
11146 | - |
11147 | hci_dev_unlock(hdev); |
11148 | } |
11149 | |
11150 | diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c |
11151 | index 99a6de52b21da..a5502c5aa44e7 100644 |
11152 | --- a/net/core/lwt_bpf.c |
11153 | +++ b/net/core/lwt_bpf.c |
11154 | @@ -39,12 +39,11 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt, |
11155 | { |
11156 | int ret; |
11157 | |
11158 | - /* Preempt disable is needed to protect per-cpu redirect_info between |
11159 | - * BPF prog and skb_do_redirect(). The call_rcu in bpf_prog_put() and |
11160 | - * access to maps strictly require a rcu_read_lock() for protection, |
11161 | - * mixing with BH RCU lock doesn't work. |
11162 | + /* Preempt disable and BH disable are needed to protect per-cpu |
11163 | + * redirect_info between BPF prog and skb_do_redirect(). |
11164 | */ |
11165 | preempt_disable(); |
11166 | + local_bh_disable(); |
11167 | bpf_compute_data_pointers(skb); |
11168 | ret = bpf_prog_run_save_cb(lwt->prog, skb); |
11169 | |
11170 | @@ -78,6 +77,7 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt, |
11171 | break; |
11172 | } |
11173 | |
11174 | + local_bh_enable(); |
11175 | preempt_enable(); |
11176 | |
11177 | return ret; |
11178 | diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c |
11179 | index f1f78a742b36a..8a6a4384e7916 100644 |
11180 | --- a/net/ipv4/netfilter/arp_tables.c |
11181 | +++ b/net/ipv4/netfilter/arp_tables.c |
11182 | @@ -203,7 +203,7 @@ unsigned int arpt_do_table(struct sk_buff *skb, |
11183 | |
11184 | local_bh_disable(); |
11185 | addend = xt_write_recseq_begin(); |
11186 | - private = READ_ONCE(table->private); /* Address dependency. */ |
11187 | + private = rcu_access_pointer(table->private); |
11188 | cpu = smp_processor_id(); |
11189 | table_base = private->entries; |
11190 | jumpstack = (struct arpt_entry **)private->jumpstack[cpu]; |
11191 | @@ -649,7 +649,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) |
11192 | { |
11193 | unsigned int countersize; |
11194 | struct xt_counters *counters; |
11195 | - const struct xt_table_info *private = table->private; |
11196 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11197 | |
11198 | /* We need atomic snapshot of counters: rest doesn't change |
11199 | * (other than comefrom, which userspace doesn't care |
11200 | @@ -673,7 +673,7 @@ static int copy_entries_to_user(unsigned int total_size, |
11201 | unsigned int off, num; |
11202 | const struct arpt_entry *e; |
11203 | struct xt_counters *counters; |
11204 | - struct xt_table_info *private = table->private; |
11205 | + struct xt_table_info *private = xt_table_get_private_protected(table); |
11206 | int ret = 0; |
11207 | void *loc_cpu_entry; |
11208 | |
11209 | @@ -808,7 +808,7 @@ static int get_info(struct net *net, void __user *user, |
11210 | t = xt_request_find_table_lock(net, NFPROTO_ARP, name); |
11211 | if (!IS_ERR(t)) { |
11212 | struct arpt_getinfo info; |
11213 | - const struct xt_table_info *private = t->private; |
11214 | + const struct xt_table_info *private = xt_table_get_private_protected(t); |
11215 | #ifdef CONFIG_COMPAT |
11216 | struct xt_table_info tmp; |
11217 | |
11218 | @@ -861,7 +861,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr, |
11219 | |
11220 | t = xt_find_table_lock(net, NFPROTO_ARP, get.name); |
11221 | if (!IS_ERR(t)) { |
11222 | - const struct xt_table_info *private = t->private; |
11223 | + const struct xt_table_info *private = xt_table_get_private_protected(t); |
11224 | |
11225 | if (get.size == private->size) |
11226 | ret = copy_entries_to_user(private->size, |
11227 | @@ -1020,7 +1020,7 @@ static int do_add_counters(struct net *net, const void __user *user, |
11228 | } |
11229 | |
11230 | local_bh_disable(); |
11231 | - private = t->private; |
11232 | + private = xt_table_get_private_protected(t); |
11233 | if (private->number != tmp.num_counters) { |
11234 | ret = -EINVAL; |
11235 | goto unlock_up_free; |
11236 | @@ -1357,7 +1357,7 @@ static int compat_copy_entries_to_user(unsigned int total_size, |
11237 | void __user *userptr) |
11238 | { |
11239 | struct xt_counters *counters; |
11240 | - const struct xt_table_info *private = table->private; |
11241 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11242 | void __user *pos; |
11243 | unsigned int size; |
11244 | int ret = 0; |
11245 | diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c |
11246 | index 10b91ebdf2131..4852769995440 100644 |
11247 | --- a/net/ipv4/netfilter/ip_tables.c |
11248 | +++ b/net/ipv4/netfilter/ip_tables.c |
11249 | @@ -258,7 +258,7 @@ ipt_do_table(struct sk_buff *skb, |
11250 | WARN_ON(!(table->valid_hooks & (1 << hook))); |
11251 | local_bh_disable(); |
11252 | addend = xt_write_recseq_begin(); |
11253 | - private = READ_ONCE(table->private); /* Address dependency. */ |
11254 | + private = rcu_access_pointer(table->private); |
11255 | cpu = smp_processor_id(); |
11256 | table_base = private->entries; |
11257 | jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; |
11258 | @@ -791,7 +791,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) |
11259 | { |
11260 | unsigned int countersize; |
11261 | struct xt_counters *counters; |
11262 | - const struct xt_table_info *private = table->private; |
11263 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11264 | |
11265 | /* We need atomic snapshot of counters: rest doesn't change |
11266 | (other than comefrom, which userspace doesn't care |
11267 | @@ -815,7 +815,7 @@ copy_entries_to_user(unsigned int total_size, |
11268 | unsigned int off, num; |
11269 | const struct ipt_entry *e; |
11270 | struct xt_counters *counters; |
11271 | - const struct xt_table_info *private = table->private; |
11272 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11273 | int ret = 0; |
11274 | const void *loc_cpu_entry; |
11275 | |
11276 | @@ -965,7 +965,7 @@ static int get_info(struct net *net, void __user *user, |
11277 | t = xt_request_find_table_lock(net, AF_INET, name); |
11278 | if (!IS_ERR(t)) { |
11279 | struct ipt_getinfo info; |
11280 | - const struct xt_table_info *private = t->private; |
11281 | + const struct xt_table_info *private = xt_table_get_private_protected(t); |
11282 | #ifdef CONFIG_COMPAT |
11283 | struct xt_table_info tmp; |
11284 | |
11285 | @@ -1019,7 +1019,7 @@ get_entries(struct net *net, struct ipt_get_entries __user *uptr, |
11286 | |
11287 | t = xt_find_table_lock(net, AF_INET, get.name); |
11288 | if (!IS_ERR(t)) { |
11289 | - const struct xt_table_info *private = t->private; |
11290 | + const struct xt_table_info *private = xt_table_get_private_protected(t); |
11291 | if (get.size == private->size) |
11292 | ret = copy_entries_to_user(private->size, |
11293 | t, uptr->entrytable); |
11294 | @@ -1175,7 +1175,7 @@ do_add_counters(struct net *net, const void __user *user, |
11295 | } |
11296 | |
11297 | local_bh_disable(); |
11298 | - private = t->private; |
11299 | + private = xt_table_get_private_protected(t); |
11300 | if (private->number != tmp.num_counters) { |
11301 | ret = -EINVAL; |
11302 | goto unlock_up_free; |
11303 | @@ -1570,7 +1570,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, |
11304 | void __user *userptr) |
11305 | { |
11306 | struct xt_counters *counters; |
11307 | - const struct xt_table_info *private = table->private; |
11308 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11309 | void __user *pos; |
11310 | unsigned int size; |
11311 | int ret = 0; |
11312 | diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c |
11313 | index c973ace208c51..12735ee7713a7 100644 |
11314 | --- a/net/ipv6/netfilter/ip6_tables.c |
11315 | +++ b/net/ipv6/netfilter/ip6_tables.c |
11316 | @@ -280,7 +280,7 @@ ip6t_do_table(struct sk_buff *skb, |
11317 | |
11318 | local_bh_disable(); |
11319 | addend = xt_write_recseq_begin(); |
11320 | - private = READ_ONCE(table->private); /* Address dependency. */ |
11321 | + private = rcu_access_pointer(table->private); |
11322 | cpu = smp_processor_id(); |
11323 | table_base = private->entries; |
11324 | jumpstack = (struct ip6t_entry **)private->jumpstack[cpu]; |
11325 | @@ -807,7 +807,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) |
11326 | { |
11327 | unsigned int countersize; |
11328 | struct xt_counters *counters; |
11329 | - const struct xt_table_info *private = table->private; |
11330 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11331 | |
11332 | /* We need atomic snapshot of counters: rest doesn't change |
11333 | (other than comefrom, which userspace doesn't care |
11334 | @@ -831,7 +831,7 @@ copy_entries_to_user(unsigned int total_size, |
11335 | unsigned int off, num; |
11336 | const struct ip6t_entry *e; |
11337 | struct xt_counters *counters; |
11338 | - const struct xt_table_info *private = table->private; |
11339 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11340 | int ret = 0; |
11341 | const void *loc_cpu_entry; |
11342 | |
11343 | @@ -981,7 +981,7 @@ static int get_info(struct net *net, void __user *user, |
11344 | t = xt_request_find_table_lock(net, AF_INET6, name); |
11345 | if (!IS_ERR(t)) { |
11346 | struct ip6t_getinfo info; |
11347 | - const struct xt_table_info *private = t->private; |
11348 | + const struct xt_table_info *private = xt_table_get_private_protected(t); |
11349 | #ifdef CONFIG_COMPAT |
11350 | struct xt_table_info tmp; |
11351 | |
11352 | @@ -1036,7 +1036,7 @@ get_entries(struct net *net, struct ip6t_get_entries __user *uptr, |
11353 | |
11354 | t = xt_find_table_lock(net, AF_INET6, get.name); |
11355 | if (!IS_ERR(t)) { |
11356 | - struct xt_table_info *private = t->private; |
11357 | + struct xt_table_info *private = xt_table_get_private_protected(t); |
11358 | if (get.size == private->size) |
11359 | ret = copy_entries_to_user(private->size, |
11360 | t, uptr->entrytable); |
11361 | @@ -1191,7 +1191,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len, |
11362 | } |
11363 | |
11364 | local_bh_disable(); |
11365 | - private = t->private; |
11366 | + private = xt_table_get_private_protected(t); |
11367 | if (private->number != tmp.num_counters) { |
11368 | ret = -EINVAL; |
11369 | goto unlock_up_free; |
11370 | @@ -1579,7 +1579,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, |
11371 | void __user *userptr) |
11372 | { |
11373 | struct xt_counters *counters; |
11374 | - const struct xt_table_info *private = table->private; |
11375 | + const struct xt_table_info *private = xt_table_get_private_protected(table); |
11376 | void __user *pos; |
11377 | unsigned int size; |
11378 | int ret = 0; |
11379 | diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c |
11380 | index aabc63dadf176..cea83fa5fc5b9 100644 |
11381 | --- a/net/mac80211/vht.c |
11382 | +++ b/net/mac80211/vht.c |
11383 | @@ -446,12 +446,18 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta) |
11384 | * IEEE80211-2016 specification makes higher bandwidth operation |
11385 | * possible on the TDLS link if the peers have wider bandwidth |
11386 | * capability. |
11387 | + * |
11388 | + * However, in this case, and only if the TDLS peer is authorized, |
11389 | + * limit to the tdls_chandef so that the configuration here isn't |
11390 | + * wider than what's actually requested on the channel context. |
11391 | */ |
11392 | if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && |
11393 | - test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW)) |
11394 | - return bw; |
11395 | - |
11396 | - bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width)); |
11397 | + test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW) && |
11398 | + test_sta_flag(sta, WLAN_STA_AUTHORIZED) && |
11399 | + sta->tdls_chandef.chan) |
11400 | + bw = min(bw, ieee80211_chan_width_to_rx_bw(sta->tdls_chandef.width)); |
11401 | + else |
11402 | + bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width)); |
11403 | |
11404 | return bw; |
11405 | } |
11406 | diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
11407 | index 459b7c0547115..40216c2a7dd72 100644 |
11408 | --- a/net/netfilter/nf_tables_api.c |
11409 | +++ b/net/netfilter/nf_tables_api.c |
11410 | @@ -3277,7 +3277,7 @@ cont: |
11411 | return 0; |
11412 | } |
11413 | |
11414 | -static int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result) |
11415 | +int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result) |
11416 | { |
11417 | u64 ms = be64_to_cpu(nla_get_be64(nla)); |
11418 | u64 max = (u64)(~((u64)0)); |
11419 | @@ -3291,7 +3291,7 @@ static int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result) |
11420 | return 0; |
11421 | } |
11422 | |
11423 | -static __be64 nf_jiffies64_to_msecs(u64 input) |
11424 | +__be64 nf_jiffies64_to_msecs(u64 input) |
11425 | { |
11426 | return cpu_to_be64(jiffies64_to_msecs(input)); |
11427 | } |
11428 | @@ -6605,6 +6605,12 @@ static void nf_tables_trans_destroy_work(struct work_struct *w) |
11429 | } |
11430 | } |
11431 | |
11432 | +void nf_tables_trans_destroy_flush_work(void) |
11433 | +{ |
11434 | + flush_work(&trans_destroy_work); |
11435 | +} |
11436 | +EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work); |
11437 | + |
11438 | static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *chain) |
11439 | { |
11440 | struct nft_rule *rule; |
11441 | @@ -6776,9 +6782,9 @@ static void nf_tables_commit_release(struct net *net) |
11442 | spin_unlock(&nf_tables_destroy_list_lock); |
11443 | |
11444 | nf_tables_module_autoload_cleanup(net); |
11445 | - mutex_unlock(&net->nft.commit_mutex); |
11446 | - |
11447 | schedule_work(&trans_destroy_work); |
11448 | + |
11449 | + mutex_unlock(&net->nft.commit_mutex); |
11450 | } |
11451 | |
11452 | static int nf_tables_commit(struct net *net, struct sk_buff *skb) |
11453 | diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c |
11454 | index f9adca62ccb3d..0e3e0ff805812 100644 |
11455 | --- a/net/netfilter/nft_compat.c |
11456 | +++ b/net/netfilter/nft_compat.c |
11457 | @@ -27,6 +27,8 @@ struct nft_xt_match_priv { |
11458 | void *info; |
11459 | }; |
11460 | |
11461 | +static refcount_t nft_compat_pending_destroy = REFCOUNT_INIT(1); |
11462 | + |
11463 | static int nft_compat_chain_validate_dependency(const struct nft_ctx *ctx, |
11464 | const char *tablename) |
11465 | { |
11466 | @@ -236,6 +238,15 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr, |
11467 | |
11468 | nft_target_set_tgchk_param(&par, ctx, target, info, &e, proto, inv); |
11469 | |
11470 | + /* xtables matches or targets can have side effects, e.g. |
11471 | + * creation/destruction of /proc files. |
11472 | + * The xt ->destroy functions are run asynchronously from |
11473 | + * work queue. If we have pending invocations we thus |
11474 | + * need to wait for those to finish. |
11475 | + */ |
11476 | + if (refcount_read(&nft_compat_pending_destroy) > 1) |
11477 | + nf_tables_trans_destroy_flush_work(); |
11478 | + |
11479 | ret = xt_check_target(&par, size, proto, inv); |
11480 | if (ret < 0) |
11481 | return ret; |
11482 | @@ -247,6 +258,13 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr, |
11483 | return 0; |
11484 | } |
11485 | |
11486 | +static void __nft_mt_tg_destroy(struct module *me, const struct nft_expr *expr) |
11487 | +{ |
11488 | + refcount_dec(&nft_compat_pending_destroy); |
11489 | + module_put(me); |
11490 | + kfree(expr->ops); |
11491 | +} |
11492 | + |
11493 | static void |
11494 | nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
11495 | { |
11496 | @@ -262,8 +280,7 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
11497 | if (par.target->destroy != NULL) |
11498 | par.target->destroy(&par); |
11499 | |
11500 | - module_put(me); |
11501 | - kfree(expr->ops); |
11502 | + __nft_mt_tg_destroy(me, expr); |
11503 | } |
11504 | |
11505 | static int nft_extension_dump_info(struct sk_buff *skb, int attr, |
11506 | @@ -494,8 +511,7 @@ __nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr, |
11507 | if (par.match->destroy != NULL) |
11508 | par.match->destroy(&par); |
11509 | |
11510 | - module_put(me); |
11511 | - kfree(expr->ops); |
11512 | + __nft_mt_tg_destroy(me, expr); |
11513 | } |
11514 | |
11515 | static void |
11516 | @@ -700,6 +716,14 @@ static const struct nfnetlink_subsystem nfnl_compat_subsys = { |
11517 | |
11518 | static struct nft_expr_type nft_match_type; |
11519 | |
11520 | +static void nft_mt_tg_deactivate(const struct nft_ctx *ctx, |
11521 | + const struct nft_expr *expr, |
11522 | + enum nft_trans_phase phase) |
11523 | +{ |
11524 | + if (phase == NFT_TRANS_COMMIT) |
11525 | + refcount_inc(&nft_compat_pending_destroy); |
11526 | +} |
11527 | + |
11528 | static const struct nft_expr_ops * |
11529 | nft_match_select_ops(const struct nft_ctx *ctx, |
11530 | const struct nlattr * const tb[]) |
11531 | @@ -738,6 +762,7 @@ nft_match_select_ops(const struct nft_ctx *ctx, |
11532 | ops->type = &nft_match_type; |
11533 | ops->eval = nft_match_eval; |
11534 | ops->init = nft_match_init; |
11535 | + ops->deactivate = nft_mt_tg_deactivate, |
11536 | ops->destroy = nft_match_destroy; |
11537 | ops->dump = nft_match_dump; |
11538 | ops->validate = nft_match_validate; |
11539 | @@ -828,6 +853,7 @@ nft_target_select_ops(const struct nft_ctx *ctx, |
11540 | ops->size = NFT_EXPR_SIZE(XT_ALIGN(target->targetsize)); |
11541 | ops->init = nft_target_init; |
11542 | ops->destroy = nft_target_destroy; |
11543 | + ops->deactivate = nft_mt_tg_deactivate, |
11544 | ops->dump = nft_target_dump; |
11545 | ops->validate = nft_target_validate; |
11546 | ops->data = target; |
11547 | @@ -891,6 +917,8 @@ static void __exit nft_compat_module_exit(void) |
11548 | nfnetlink_subsys_unregister(&nfnl_compat_subsys); |
11549 | nft_unregister_expr(&nft_target_type); |
11550 | nft_unregister_expr(&nft_match_type); |
11551 | + |
11552 | + WARN_ON_ONCE(refcount_read(&nft_compat_pending_destroy) != 1); |
11553 | } |
11554 | |
11555 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFT_COMPAT); |
11556 | diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c |
11557 | index 46ca8bcca1bd5..2042c6f4629cc 100644 |
11558 | --- a/net/netfilter/nft_ct.c |
11559 | +++ b/net/netfilter/nft_ct.c |
11560 | @@ -177,8 +177,6 @@ static void nft_ct_get_eval(const struct nft_expr *expr, |
11561 | } |
11562 | #endif |
11563 | case NFT_CT_ID: |
11564 | - if (!nf_ct_is_confirmed(ct)) |
11565 | - goto err; |
11566 | *dest = nf_ct_get_id(ct); |
11567 | return; |
11568 | default: |
11569 | diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c |
11570 | index 8887295414dcb..217fd1bdc55e7 100644 |
11571 | --- a/net/netfilter/nft_dynset.c |
11572 | +++ b/net/netfilter/nft_dynset.c |
11573 | @@ -180,8 +180,10 @@ static int nft_dynset_init(const struct nft_ctx *ctx, |
11574 | if (tb[NFTA_DYNSET_TIMEOUT] != NULL) { |
11575 | if (!(set->flags & NFT_SET_TIMEOUT)) |
11576 | return -EINVAL; |
11577 | - timeout = msecs_to_jiffies(be64_to_cpu(nla_get_be64( |
11578 | - tb[NFTA_DYNSET_TIMEOUT]))); |
11579 | + |
11580 | + err = nf_msecs_to_jiffies64(tb[NFTA_DYNSET_TIMEOUT], &timeout); |
11581 | + if (err) |
11582 | + return err; |
11583 | } |
11584 | |
11585 | priv->sreg_key = nft_parse_register(tb[NFTA_DYNSET_SREG_KEY]); |
11586 | @@ -296,7 +298,7 @@ static int nft_dynset_dump(struct sk_buff *skb, const struct nft_expr *expr) |
11587 | if (nla_put_string(skb, NFTA_DYNSET_SET_NAME, priv->set->name)) |
11588 | goto nla_put_failure; |
11589 | if (nla_put_be64(skb, NFTA_DYNSET_TIMEOUT, |
11590 | - cpu_to_be64(jiffies_to_msecs(priv->timeout)), |
11591 | + nf_jiffies64_to_msecs(priv->timeout), |
11592 | NFTA_DYNSET_PAD)) |
11593 | goto nla_put_failure; |
11594 | if (priv->expr && nft_expr_dump(skb, NFTA_DYNSET_EXPR, priv->expr)) |
11595 | diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c |
11596 | index 44f971f319920..d1ef2d7930739 100644 |
11597 | --- a/net/netfilter/x_tables.c |
11598 | +++ b/net/netfilter/x_tables.c |
11599 | @@ -1349,6 +1349,14 @@ struct xt_counters *xt_counters_alloc(unsigned int counters) |
11600 | } |
11601 | EXPORT_SYMBOL(xt_counters_alloc); |
11602 | |
11603 | +struct xt_table_info |
11604 | +*xt_table_get_private_protected(const struct xt_table *table) |
11605 | +{ |
11606 | + return rcu_dereference_protected(table->private, |
11607 | + mutex_is_locked(&xt[table->af].mutex)); |
11608 | +} |
11609 | +EXPORT_SYMBOL(xt_table_get_private_protected); |
11610 | + |
11611 | struct xt_table_info * |
11612 | xt_replace_table(struct xt_table *table, |
11613 | unsigned int num_counters, |
11614 | @@ -1356,7 +1364,6 @@ xt_replace_table(struct xt_table *table, |
11615 | int *error) |
11616 | { |
11617 | struct xt_table_info *private; |
11618 | - unsigned int cpu; |
11619 | int ret; |
11620 | |
11621 | ret = xt_jumpstack_alloc(newinfo); |
11622 | @@ -1366,47 +1373,20 @@ xt_replace_table(struct xt_table *table, |
11623 | } |
11624 | |
11625 | /* Do the substitution. */ |
11626 | - local_bh_disable(); |
11627 | - private = table->private; |
11628 | + private = xt_table_get_private_protected(table); |
11629 | |
11630 | /* Check inside lock: is the old number correct? */ |
11631 | if (num_counters != private->number) { |
11632 | pr_debug("num_counters != table->private->number (%u/%u)\n", |
11633 | num_counters, private->number); |
11634 | - local_bh_enable(); |
11635 | *error = -EAGAIN; |
11636 | return NULL; |
11637 | } |
11638 | |
11639 | newinfo->initial_entries = private->initial_entries; |
11640 | - /* |
11641 | - * Ensure contents of newinfo are visible before assigning to |
11642 | - * private. |
11643 | - */ |
11644 | - smp_wmb(); |
11645 | - table->private = newinfo; |
11646 | - |
11647 | - /* make sure all cpus see new ->private value */ |
11648 | - smp_wmb(); |
11649 | |
11650 | - /* |
11651 | - * Even though table entries have now been swapped, other CPU's |
11652 | - * may still be using the old entries... |
11653 | - */ |
11654 | - local_bh_enable(); |
11655 | - |
11656 | - /* ... so wait for even xt_recseq on all cpus */ |
11657 | - for_each_possible_cpu(cpu) { |
11658 | - seqcount_t *s = &per_cpu(xt_recseq, cpu); |
11659 | - u32 seq = raw_read_seqcount(s); |
11660 | - |
11661 | - if (seq & 1) { |
11662 | - do { |
11663 | - cond_resched(); |
11664 | - cpu_relax(); |
11665 | - } while (seq == raw_read_seqcount(s)); |
11666 | - } |
11667 | - } |
11668 | + rcu_assign_pointer(table->private, newinfo); |
11669 | + synchronize_rcu(); |
11670 | |
11671 | #ifdef CONFIG_AUDIT |
11672 | if (audit_enabled) { |
11673 | @@ -1447,12 +1427,12 @@ struct xt_table *xt_register_table(struct net *net, |
11674 | } |
11675 | |
11676 | /* Simplifies replace_table code. */ |
11677 | - table->private = bootstrap; |
11678 | + rcu_assign_pointer(table->private, bootstrap); |
11679 | |
11680 | if (!xt_replace_table(table, 0, newinfo, &ret)) |
11681 | goto unlock; |
11682 | |
11683 | - private = table->private; |
11684 | + private = xt_table_get_private_protected(table); |
11685 | pr_debug("table->private->number = %u\n", private->number); |
11686 | |
11687 | /* save number of initial entries */ |
11688 | @@ -1475,7 +1455,8 @@ void *xt_unregister_table(struct xt_table *table) |
11689 | struct xt_table_info *private; |
11690 | |
11691 | mutex_lock(&xt[table->af].mutex); |
11692 | - private = table->private; |
11693 | + private = xt_table_get_private_protected(table); |
11694 | + RCU_INIT_POINTER(table->private, NULL); |
11695 | list_del(&table->list); |
11696 | mutex_unlock(&xt[table->af].mutex); |
11697 | kfree(table); |
11698 | diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c |
11699 | index fd9bca2427242..56029e3af6ff0 100644 |
11700 | --- a/net/sunrpc/debugfs.c |
11701 | +++ b/net/sunrpc/debugfs.c |
11702 | @@ -128,13 +128,13 @@ static int do_xprt_debugfs(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *n |
11703 | return 0; |
11704 | len = snprintf(name, sizeof(name), "../../rpc_xprt/%s", |
11705 | xprt->debugfs->d_name.name); |
11706 | - if (len > sizeof(name)) |
11707 | + if (len >= sizeof(name)) |
11708 | return -1; |
11709 | if (*nump == 0) |
11710 | strcpy(link, "xprt"); |
11711 | else { |
11712 | len = snprintf(link, sizeof(link), "xprt%d", *nump); |
11713 | - if (len > sizeof(link)) |
11714 | + if (len >= sizeof(link)) |
11715 | return -1; |
11716 | } |
11717 | debugfs_create_symlink(link, clnt->cl_debugfs, name); |
11718 | diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
11719 | index 53d8b82eda006..7afbf15bcbd9a 100644 |
11720 | --- a/net/sunrpc/sched.c |
11721 | +++ b/net/sunrpc/sched.c |
11722 | @@ -699,6 +699,23 @@ struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *queue) |
11723 | } |
11724 | EXPORT_SYMBOL_GPL(rpc_wake_up_next); |
11725 | |
11726 | +/** |
11727 | + * rpc_wake_up_locked - wake up all rpc_tasks |
11728 | + * @queue: rpc_wait_queue on which the tasks are sleeping |
11729 | + * |
11730 | + */ |
11731 | +static void rpc_wake_up_locked(struct rpc_wait_queue *queue) |
11732 | +{ |
11733 | + struct rpc_task *task; |
11734 | + |
11735 | + for (;;) { |
11736 | + task = __rpc_find_next_queued(queue); |
11737 | + if (task == NULL) |
11738 | + break; |
11739 | + rpc_wake_up_task_queue_locked(queue, task); |
11740 | + } |
11741 | +} |
11742 | + |
11743 | /** |
11744 | * rpc_wake_up - wake up all rpc_tasks |
11745 | * @queue: rpc_wait_queue on which the tasks are sleeping |
11746 | @@ -707,25 +724,28 @@ EXPORT_SYMBOL_GPL(rpc_wake_up_next); |
11747 | */ |
11748 | void rpc_wake_up(struct rpc_wait_queue *queue) |
11749 | { |
11750 | - struct list_head *head; |
11751 | - |
11752 | spin_lock(&queue->lock); |
11753 | - head = &queue->tasks[queue->maxpriority]; |
11754 | + rpc_wake_up_locked(queue); |
11755 | + spin_unlock(&queue->lock); |
11756 | +} |
11757 | +EXPORT_SYMBOL_GPL(rpc_wake_up); |
11758 | + |
11759 | +/** |
11760 | + * rpc_wake_up_status_locked - wake up all rpc_tasks and set their status value. |
11761 | + * @queue: rpc_wait_queue on which the tasks are sleeping |
11762 | + * @status: status value to set |
11763 | + */ |
11764 | +static void rpc_wake_up_status_locked(struct rpc_wait_queue *queue, int status) |
11765 | +{ |
11766 | + struct rpc_task *task; |
11767 | + |
11768 | for (;;) { |
11769 | - while (!list_empty(head)) { |
11770 | - struct rpc_task *task; |
11771 | - task = list_first_entry(head, |
11772 | - struct rpc_task, |
11773 | - u.tk_wait.list); |
11774 | - rpc_wake_up_task_queue_locked(queue, task); |
11775 | - } |
11776 | - if (head == &queue->tasks[0]) |
11777 | + task = __rpc_find_next_queued(queue); |
11778 | + if (task == NULL) |
11779 | break; |
11780 | - head--; |
11781 | + rpc_wake_up_task_queue_set_status_locked(queue, task, status); |
11782 | } |
11783 | - spin_unlock(&queue->lock); |
11784 | } |
11785 | -EXPORT_SYMBOL_GPL(rpc_wake_up); |
11786 | |
11787 | /** |
11788 | * rpc_wake_up_status - wake up all rpc_tasks and set their status value. |
11789 | @@ -736,23 +756,8 @@ EXPORT_SYMBOL_GPL(rpc_wake_up); |
11790 | */ |
11791 | void rpc_wake_up_status(struct rpc_wait_queue *queue, int status) |
11792 | { |
11793 | - struct list_head *head; |
11794 | - |
11795 | spin_lock(&queue->lock); |
11796 | - head = &queue->tasks[queue->maxpriority]; |
11797 | - for (;;) { |
11798 | - while (!list_empty(head)) { |
11799 | - struct rpc_task *task; |
11800 | - task = list_first_entry(head, |
11801 | - struct rpc_task, |
11802 | - u.tk_wait.list); |
11803 | - task->tk_status = status; |
11804 | - rpc_wake_up_task_queue_locked(queue, task); |
11805 | - } |
11806 | - if (head == &queue->tasks[0]) |
11807 | - break; |
11808 | - head--; |
11809 | - } |
11810 | + rpc_wake_up_status_locked(queue, status); |
11811 | spin_unlock(&queue->lock); |
11812 | } |
11813 | EXPORT_SYMBOL_GPL(rpc_wake_up_status); |
11814 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c |
11815 | index a6fee86f400ec..639837b3a5d90 100644 |
11816 | --- a/net/sunrpc/xprt.c |
11817 | +++ b/net/sunrpc/xprt.c |
11818 | @@ -151,31 +151,64 @@ out: |
11819 | } |
11820 | EXPORT_SYMBOL_GPL(xprt_unregister_transport); |
11821 | |
11822 | +static void |
11823 | +xprt_class_release(const struct xprt_class *t) |
11824 | +{ |
11825 | + module_put(t->owner); |
11826 | +} |
11827 | + |
11828 | +static const struct xprt_class * |
11829 | +xprt_class_find_by_netid_locked(const char *netid) |
11830 | +{ |
11831 | + const struct xprt_class *t; |
11832 | + unsigned int i; |
11833 | + |
11834 | + list_for_each_entry(t, &xprt_list, list) { |
11835 | + for (i = 0; t->netid[i][0] != '\0'; i++) { |
11836 | + if (strcmp(t->netid[i], netid) != 0) |
11837 | + continue; |
11838 | + if (!try_module_get(t->owner)) |
11839 | + continue; |
11840 | + return t; |
11841 | + } |
11842 | + } |
11843 | + return NULL; |
11844 | +} |
11845 | + |
11846 | +static const struct xprt_class * |
11847 | +xprt_class_find_by_netid(const char *netid) |
11848 | +{ |
11849 | + const struct xprt_class *t; |
11850 | + |
11851 | + spin_lock(&xprt_list_lock); |
11852 | + t = xprt_class_find_by_netid_locked(netid); |
11853 | + if (!t) { |
11854 | + spin_unlock(&xprt_list_lock); |
11855 | + request_module("rpc%s", netid); |
11856 | + spin_lock(&xprt_list_lock); |
11857 | + t = xprt_class_find_by_netid_locked(netid); |
11858 | + } |
11859 | + spin_unlock(&xprt_list_lock); |
11860 | + return t; |
11861 | +} |
11862 | + |
11863 | /** |
11864 | * xprt_load_transport - load a transport implementation |
11865 | - * @transport_name: transport to load |
11866 | + * @netid: transport to load |
11867 | * |
11868 | * Returns: |
11869 | * 0: transport successfully loaded |
11870 | * -ENOENT: transport module not available |
11871 | */ |
11872 | -int xprt_load_transport(const char *transport_name) |
11873 | +int xprt_load_transport(const char *netid) |
11874 | { |
11875 | - struct xprt_class *t; |
11876 | - int result; |
11877 | + const struct xprt_class *t; |
11878 | |
11879 | - result = 0; |
11880 | - spin_lock(&xprt_list_lock); |
11881 | - list_for_each_entry(t, &xprt_list, list) { |
11882 | - if (strcmp(t->name, transport_name) == 0) { |
11883 | - spin_unlock(&xprt_list_lock); |
11884 | - goto out; |
11885 | - } |
11886 | - } |
11887 | - spin_unlock(&xprt_list_lock); |
11888 | - result = request_module("xprt%s", transport_name); |
11889 | -out: |
11890 | - return result; |
11891 | + t = xprt_class_find_by_netid(netid); |
11892 | + if (!t) |
11893 | + return -ENOENT; |
11894 | + xprt_class_release(t); |
11895 | + return 0; |
11896 | } |
11897 | EXPORT_SYMBOL_GPL(xprt_load_transport); |
11898 | |
11899 | diff --git a/net/sunrpc/xprtrdma/module.c b/net/sunrpc/xprtrdma/module.c |
11900 | index 620327c01302c..45c5b41ac8dc9 100644 |
11901 | --- a/net/sunrpc/xprtrdma/module.c |
11902 | +++ b/net/sunrpc/xprtrdma/module.c |
11903 | @@ -24,6 +24,7 @@ MODULE_DESCRIPTION("RPC/RDMA Transport"); |
11904 | MODULE_LICENSE("Dual BSD/GPL"); |
11905 | MODULE_ALIAS("svcrdma"); |
11906 | MODULE_ALIAS("xprtrdma"); |
11907 | +MODULE_ALIAS("rpcrdma6"); |
11908 | |
11909 | static void __exit rpc_rdma_cleanup(void) |
11910 | { |
11911 | diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c |
11912 | index 21970185485fc..c091417bd799e 100644 |
11913 | --- a/net/sunrpc/xprtrdma/rpc_rdma.c |
11914 | +++ b/net/sunrpc/xprtrdma/rpc_rdma.c |
11915 | @@ -183,6 +183,31 @@ rpcrdma_nonpayload_inline(const struct rpcrdma_xprt *r_xprt, |
11916 | r_xprt->rx_ep.rep_max_inline_recv; |
11917 | } |
11918 | |
11919 | +/* ACL likes to be lazy in allocating pages. For TCP, these |
11920 | + * pages can be allocated during receive processing. Not true |
11921 | + * for RDMA, which must always provision receive buffers |
11922 | + * up front. |
11923 | + */ |
11924 | +static noinline int |
11925 | +rpcrdma_alloc_sparse_pages(struct xdr_buf *buf) |
11926 | +{ |
11927 | + struct page **ppages; |
11928 | + int len; |
11929 | + |
11930 | + len = buf->page_len; |
11931 | + ppages = buf->pages + (buf->page_base >> PAGE_SHIFT); |
11932 | + while (len > 0) { |
11933 | + if (!*ppages) |
11934 | + *ppages = alloc_page(GFP_NOWAIT | __GFP_NOWARN); |
11935 | + if (!*ppages) |
11936 | + return -ENOBUFS; |
11937 | + ppages++; |
11938 | + len -= PAGE_SIZE; |
11939 | + } |
11940 | + |
11941 | + return 0; |
11942 | +} |
11943 | + |
11944 | /* Split @vec on page boundaries into SGEs. FMR registers pages, not |
11945 | * a byte range. Other modes coalesce these SGEs into a single MR |
11946 | * when they can. |
11947 | @@ -237,15 +262,6 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf, |
11948 | ppages = xdrbuf->pages + (xdrbuf->page_base >> PAGE_SHIFT); |
11949 | page_base = offset_in_page(xdrbuf->page_base); |
11950 | while (len) { |
11951 | - /* ACL likes to be lazy in allocating pages - ACLs |
11952 | - * are small by default but can get huge. |
11953 | - */ |
11954 | - if (unlikely(xdrbuf->flags & XDRBUF_SPARSE_PAGES)) { |
11955 | - if (!*ppages) |
11956 | - *ppages = alloc_page(GFP_NOWAIT | __GFP_NOWARN); |
11957 | - if (!*ppages) |
11958 | - return -ENOBUFS; |
11959 | - } |
11960 | seg->mr_page = *ppages; |
11961 | seg->mr_offset = (char *)page_base; |
11962 | seg->mr_len = min_t(u32, PAGE_SIZE - page_base, len); |
11963 | @@ -800,6 +816,12 @@ rpcrdma_marshal_req(struct rpcrdma_xprt *r_xprt, struct rpc_rqst *rqst) |
11964 | __be32 *p; |
11965 | int ret; |
11966 | |
11967 | + if (unlikely(rqst->rq_rcv_buf.flags & XDRBUF_SPARSE_PAGES)) { |
11968 | + ret = rpcrdma_alloc_sparse_pages(&rqst->rq_rcv_buf); |
11969 | + if (ret) |
11970 | + return ret; |
11971 | + } |
11972 | + |
11973 | rpcrdma_set_xdrlen(&req->rl_hdrbuf, 0); |
11974 | xdr_init_encode(xdr, &req->rl_hdrbuf, rdmab_data(req->rl_rdmabuf), |
11975 | rqst); |
11976 | diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c |
11977 | index c67d465dc0620..2f21e3c52bfc1 100644 |
11978 | --- a/net/sunrpc/xprtrdma/transport.c |
11979 | +++ b/net/sunrpc/xprtrdma/transport.c |
11980 | @@ -827,6 +827,7 @@ static struct xprt_class xprt_rdma = { |
11981 | .owner = THIS_MODULE, |
11982 | .ident = XPRT_TRANSPORT_RDMA, |
11983 | .setup = xprt_setup_rdma, |
11984 | + .netid = { "rdma", "rdma6", "" }, |
11985 | }; |
11986 | |
11987 | void xprt_rdma_cleanup(void) |
11988 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
11989 | index 934e30e675375..8ffc54b6661f8 100644 |
11990 | --- a/net/sunrpc/xprtsock.c |
11991 | +++ b/net/sunrpc/xprtsock.c |
11992 | @@ -432,7 +432,8 @@ xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags, |
11993 | if (ret <= 0) |
11994 | goto sock_err; |
11995 | xs_flush_bvec(buf->bvec, ret, seek + buf->page_base); |
11996 | - offset += ret - buf->page_base; |
11997 | + ret -= buf->page_base; |
11998 | + offset += ret; |
11999 | if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC)) |
12000 | goto out; |
12001 | if (ret != want) |
12002 | @@ -3204,6 +3205,7 @@ static struct xprt_class xs_local_transport = { |
12003 | .owner = THIS_MODULE, |
12004 | .ident = XPRT_TRANSPORT_LOCAL, |
12005 | .setup = xs_setup_local, |
12006 | + .netid = { "" }, |
12007 | }; |
12008 | |
12009 | static struct xprt_class xs_udp_transport = { |
12010 | @@ -3212,6 +3214,7 @@ static struct xprt_class xs_udp_transport = { |
12011 | .owner = THIS_MODULE, |
12012 | .ident = XPRT_TRANSPORT_UDP, |
12013 | .setup = xs_setup_udp, |
12014 | + .netid = { "udp", "udp6", "" }, |
12015 | }; |
12016 | |
12017 | static struct xprt_class xs_tcp_transport = { |
12018 | @@ -3220,6 +3223,7 @@ static struct xprt_class xs_tcp_transport = { |
12019 | .owner = THIS_MODULE, |
12020 | .ident = XPRT_TRANSPORT_TCP, |
12021 | .setup = xs_setup_tcp, |
12022 | + .netid = { "tcp", "tcp6", "" }, |
12023 | }; |
12024 | |
12025 | static struct xprt_class xs_bc_tcp_transport = { |
12026 | @@ -3228,6 +3232,7 @@ static struct xprt_class xs_bc_tcp_transport = { |
12027 | .owner = THIS_MODULE, |
12028 | .ident = XPRT_TRANSPORT_BC_TCP, |
12029 | .setup = xs_setup_bc_tcp, |
12030 | + .netid = { "" }, |
12031 | }; |
12032 | |
12033 | /** |
12034 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
12035 | index dbac5c0995a0f..5bb2316befb98 100644 |
12036 | --- a/net/wireless/nl80211.c |
12037 | +++ b/net/wireless/nl80211.c |
12038 | @@ -12033,7 +12033,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info) |
12039 | struct net_device *dev = info->user_ptr[1]; |
12040 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
12041 | struct nlattr *tb[NUM_NL80211_REKEY_DATA]; |
12042 | - struct cfg80211_gtk_rekey_data rekey_data; |
12043 | + struct cfg80211_gtk_rekey_data rekey_data = {}; |
12044 | int err; |
12045 | |
12046 | if (!info->attrs[NL80211_ATTR_REKEY_DATA]) |
12047 | diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
12048 | index f9eb5efb237c7..2bc0d6e3e124c 100644 |
12049 | --- a/net/xdp/xsk.c |
12050 | +++ b/net/xdp/xsk.c |
12051 | @@ -426,14 +426,16 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) |
12052 | return __xsk_sendmsg(sk); |
12053 | } |
12054 | |
12055 | -static unsigned int xsk_poll(struct file *file, struct socket *sock, |
12056 | +static __poll_t xsk_poll(struct file *file, struct socket *sock, |
12057 | struct poll_table_struct *wait) |
12058 | { |
12059 | - unsigned int mask = datagram_poll(file, sock, wait); |
12060 | + __poll_t mask = 0; |
12061 | struct sock *sk = sock->sk; |
12062 | struct xdp_sock *xs = xdp_sk(sk); |
12063 | struct xdp_umem *umem; |
12064 | |
12065 | + sock_poll_wait(file, sock, wait); |
12066 | + |
12067 | if (unlikely(!xsk_is_bound(xs))) |
12068 | return mask; |
12069 | |
12070 | @@ -448,9 +450,9 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock, |
12071 | } |
12072 | |
12073 | if (xs->rx && !xskq_empty_desc(xs->rx)) |
12074 | - mask |= POLLIN | POLLRDNORM; |
12075 | + mask |= EPOLLIN | EPOLLRDNORM; |
12076 | if (xs->tx && !xskq_full_desc(xs->tx)) |
12077 | - mask |= POLLOUT | POLLWRNORM; |
12078 | + mask |= EPOLLOUT | EPOLLWRNORM; |
12079 | |
12080 | return mask; |
12081 | } |
12082 | diff --git a/samples/bpf/lwt_len_hist.sh b/samples/bpf/lwt_len_hist.sh |
12083 | old mode 100644 |
12084 | new mode 100755 |
12085 | index 090b96eaf7f76..0eda9754f50b8 |
12086 | --- a/samples/bpf/lwt_len_hist.sh |
12087 | +++ b/samples/bpf/lwt_len_hist.sh |
12088 | @@ -8,6 +8,8 @@ VETH1=tst_lwt1b |
12089 | TRACE_ROOT=/sys/kernel/debug/tracing |
12090 | |
12091 | function cleanup { |
12092 | + # To reset saved histogram, remove pinned map |
12093 | + rm /sys/fs/bpf/tc/globals/lwt_len_hist_map |
12094 | ip route del 192.168.253.2/32 dev $VETH0 2> /dev/null |
12095 | ip link del $VETH0 2> /dev/null |
12096 | ip link del $VETH1 2> /dev/null |
12097 | diff --git a/samples/bpf/test_lwt_bpf.sh b/samples/bpf/test_lwt_bpf.sh |
12098 | old mode 100644 |
12099 | new mode 100755 |
12100 | diff --git a/scripts/Makefile.build b/scripts/Makefile.build |
12101 | index 24a33c01bbf7c..9c689d011bced 100644 |
12102 | --- a/scripts/Makefile.build |
12103 | +++ b/scripts/Makefile.build |
12104 | @@ -234,6 +234,9 @@ objtool_dep = $(objtool_obj) \ |
12105 | ifdef CONFIG_TRIM_UNUSED_KSYMS |
12106 | cmd_gen_ksymdeps = \ |
12107 | $(CONFIG_SHELL) $(srctree)/scripts/gen_ksymdeps.sh $@ >> $(dot-target).cmd |
12108 | + |
12109 | +# List module undefined symbols |
12110 | +undefined_syms = $(NM) $< | $(AWK) '$$1 == "U" { printf("%s%s", x++ ? " " : "", $$2) }'; |
12111 | endif |
12112 | |
12113 | define rule_cc_o_c |
12114 | @@ -253,13 +256,6 @@ define rule_as_o_S |
12115 | $(call cmd,modversions_S) |
12116 | endef |
12117 | |
12118 | -# List module undefined symbols (or empty line if not enabled) |
12119 | -ifdef CONFIG_TRIM_UNUSED_KSYMS |
12120 | -cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo |
12121 | -else |
12122 | -cmd_undef_syms = echo |
12123 | -endif |
12124 | - |
12125 | # Built-in and composite module parts |
12126 | $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE |
12127 | $(call cmd,force_checksrc) |
12128 | @@ -267,7 +263,7 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE |
12129 | |
12130 | cmd_mod = { \ |
12131 | echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ |
12132 | - $(cmd_undef_syms); \ |
12133 | + $(undefined_syms) echo; \ |
12134 | } > $@ |
12135 | |
12136 | $(obj)/%.mod: $(obj)/%.o FORCE |
12137 | diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl |
12138 | index 0c9b114202796..a358af93cd7fc 100755 |
12139 | --- a/scripts/checkpatch.pl |
12140 | +++ b/scripts/checkpatch.pl |
12141 | @@ -4150,7 +4150,7 @@ sub process { |
12142 | $fix) { |
12143 | fix_delete_line($fixlinenr, $rawline); |
12144 | my $fixed_line = $rawline; |
12145 | - $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/; |
12146 | + $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/; |
12147 | my $line1 = $1; |
12148 | my $line2 = $2; |
12149 | fix_insert_line($fixlinenr, ltrim($line1)); |
12150 | diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c |
12151 | index 0243086fb1685..0590f86df6e40 100644 |
12152 | --- a/scripts/kconfig/preprocess.c |
12153 | +++ b/scripts/kconfig/preprocess.c |
12154 | @@ -114,7 +114,7 @@ static char *do_error_if(int argc, char *argv[]) |
12155 | if (!strcmp(argv[0], "y")) |
12156 | pperror("%s", argv[1]); |
12157 | |
12158 | - return NULL; |
12159 | + return xstrdup(""); |
12160 | } |
12161 | |
12162 | static char *do_filename(int argc, char *argv[]) |
12163 | diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c |
12164 | index b06baf5d3cd32..e15f8d37d1f28 100644 |
12165 | --- a/security/integrity/ima/ima_crypto.c |
12166 | +++ b/security/integrity/ima/ima_crypto.c |
12167 | @@ -411,7 +411,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
12168 | loff_t i_size; |
12169 | int rc; |
12170 | struct file *f = file; |
12171 | - bool new_file_instance = false, modified_mode = false; |
12172 | + bool new_file_instance = false; |
12173 | |
12174 | /* |
12175 | * For consistency, fail file's opened with the O_DIRECT flag on |
12176 | @@ -429,18 +429,10 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
12177 | O_TRUNC | O_CREAT | O_NOCTTY | O_EXCL); |
12178 | flags |= O_RDONLY; |
12179 | f = dentry_open(&file->f_path, flags, file->f_cred); |
12180 | - if (IS_ERR(f)) { |
12181 | - /* |
12182 | - * Cannot open the file again, lets modify f_mode |
12183 | - * of original and continue |
12184 | - */ |
12185 | - pr_info_ratelimited("Unable to reopen file for reading.\n"); |
12186 | - f = file; |
12187 | - f->f_mode |= FMODE_READ; |
12188 | - modified_mode = true; |
12189 | - } else { |
12190 | - new_file_instance = true; |
12191 | - } |
12192 | + if (IS_ERR(f)) |
12193 | + return PTR_ERR(f); |
12194 | + |
12195 | + new_file_instance = true; |
12196 | } |
12197 | |
12198 | i_size = i_size_read(file_inode(f)); |
12199 | @@ -455,8 +447,6 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
12200 | out: |
12201 | if (new_file_instance) |
12202 | fput(f); |
12203 | - else if (modified_mode) |
12204 | - f->f_mode &= ~FMODE_READ; |
12205 | return rc; |
12206 | } |
12207 | |
12208 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
12209 | index 212f48025db81..717a398ef4d05 100644 |
12210 | --- a/security/selinux/hooks.c |
12211 | +++ b/security/selinux/hooks.c |
12212 | @@ -1499,7 +1499,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
12213 | * inode_doinit with a dentry, before these inodes could |
12214 | * be used again by userspace. |
12215 | */ |
12216 | - goto out; |
12217 | + goto out_invalid; |
12218 | } |
12219 | |
12220 | rc = inode_doinit_use_xattr(inode, dentry, sbsec->def_sid, |
12221 | @@ -1554,7 +1554,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
12222 | * could be used again by userspace. |
12223 | */ |
12224 | if (!dentry) |
12225 | - goto out; |
12226 | + goto out_invalid; |
12227 | rc = selinux_genfs_get_sid(dentry, sclass, |
12228 | sbsec->flags, &sid); |
12229 | if (rc) { |
12230 | @@ -1579,11 +1579,10 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
12231 | out: |
12232 | spin_lock(&isec->lock); |
12233 | if (isec->initialized == LABEL_PENDING) { |
12234 | - if (!sid || rc) { |
12235 | + if (rc) { |
12236 | isec->initialized = LABEL_INVALID; |
12237 | goto out_unlock; |
12238 | } |
12239 | - |
12240 | isec->initialized = LABEL_INITIALIZED; |
12241 | isec->sid = sid; |
12242 | } |
12243 | @@ -1591,6 +1590,15 @@ out: |
12244 | out_unlock: |
12245 | spin_unlock(&isec->lock); |
12246 | return rc; |
12247 | + |
12248 | +out_invalid: |
12249 | + spin_lock(&isec->lock); |
12250 | + if (isec->initialized == LABEL_PENDING) { |
12251 | + isec->initialized = LABEL_INVALID; |
12252 | + isec->sid = sid; |
12253 | + } |
12254 | + spin_unlock(&isec->lock); |
12255 | + return 0; |
12256 | } |
12257 | |
12258 | /* Convert a Linux signal to an access vector. */ |
12259 | diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c |
12260 | index 6850d13aa98c5..fe1ea03582cbb 100644 |
12261 | --- a/sound/core/memalloc.c |
12262 | +++ b/sound/core/memalloc.c |
12263 | @@ -76,7 +76,8 @@ static void snd_malloc_dev_iram(struct snd_dma_buffer *dmab, size_t size) |
12264 | /* Assign the pool into private_data field */ |
12265 | dmab->private_data = pool; |
12266 | |
12267 | - dmab->area = gen_pool_dma_alloc(pool, size, &dmab->addr); |
12268 | + dmab->area = gen_pool_dma_alloc_align(pool, size, &dmab->addr, |
12269 | + PAGE_SIZE); |
12270 | } |
12271 | |
12272 | /** |
12273 | diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
12274 | index 46004e329a24a..0b03777d01116 100644 |
12275 | --- a/sound/core/oss/pcm_oss.c |
12276 | +++ b/sound/core/oss/pcm_oss.c |
12277 | @@ -693,6 +693,8 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, |
12278 | |
12279 | oss_buffer_size = snd_pcm_plug_client_size(substream, |
12280 | snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size; |
12281 | + if (!oss_buffer_size) |
12282 | + return -EINVAL; |
12283 | oss_buffer_size = rounddown_pow_of_two(oss_buffer_size); |
12284 | if (atomic_read(&substream->mmap_count)) { |
12285 | if (oss_buffer_size > runtime->oss.mmap_bytes) |
12286 | @@ -728,17 +730,21 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, |
12287 | |
12288 | min_period_size = snd_pcm_plug_client_size(substream, |
12289 | snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); |
12290 | - min_period_size *= oss_frame_size; |
12291 | - min_period_size = roundup_pow_of_two(min_period_size); |
12292 | - if (oss_period_size < min_period_size) |
12293 | - oss_period_size = min_period_size; |
12294 | + if (min_period_size) { |
12295 | + min_period_size *= oss_frame_size; |
12296 | + min_period_size = roundup_pow_of_two(min_period_size); |
12297 | + if (oss_period_size < min_period_size) |
12298 | + oss_period_size = min_period_size; |
12299 | + } |
12300 | |
12301 | max_period_size = snd_pcm_plug_client_size(substream, |
12302 | snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); |
12303 | - max_period_size *= oss_frame_size; |
12304 | - max_period_size = rounddown_pow_of_two(max_period_size); |
12305 | - if (oss_period_size > max_period_size) |
12306 | - oss_period_size = max_period_size; |
12307 | + if (max_period_size) { |
12308 | + max_period_size *= oss_frame_size; |
12309 | + max_period_size = rounddown_pow_of_two(max_period_size); |
12310 | + if (oss_period_size > max_period_size) |
12311 | + oss_period_size = max_period_size; |
12312 | + } |
12313 | |
12314 | oss_periods = oss_buffer_size / oss_period_size; |
12315 | |
12316 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
12317 | index 6da296def283e..326f95ce5ceb1 100644 |
12318 | --- a/sound/pci/hda/hda_codec.c |
12319 | +++ b/sound/pci/hda/hda_codec.c |
12320 | @@ -1798,7 +1798,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) |
12321 | return -EBUSY; |
12322 | |
12323 | /* OK, let it free */ |
12324 | - snd_hdac_device_unregister(&codec->core); |
12325 | + device_release_driver(hda_codec_dev(codec)); |
12326 | |
12327 | /* allow device access again */ |
12328 | snd_hda_unlock_devices(bus); |
12329 | diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c |
12330 | index 6dbe99131bc4b..91b4a29a8c366 100644 |
12331 | --- a/sound/pci/hda/hda_sysfs.c |
12332 | +++ b/sound/pci/hda/hda_sysfs.c |
12333 | @@ -139,7 +139,7 @@ static int reconfig_codec(struct hda_codec *codec) |
12334 | "The codec is being used, can't reconfigure.\n"); |
12335 | goto error; |
12336 | } |
12337 | - err = snd_hda_codec_configure(codec); |
12338 | + err = device_reprobe(hda_codec_dev(codec)); |
12339 | if (err < 0) |
12340 | goto error; |
12341 | err = snd_card_register(codec->card); |
12342 | diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
12343 | index 459aff6c10bc5..d7b2aae6d4289 100644 |
12344 | --- a/sound/pci/hda/patch_ca0132.c |
12345 | +++ b/sound/pci/hda/patch_ca0132.c |
12346 | @@ -93,7 +93,7 @@ enum { |
12347 | }; |
12348 | |
12349 | /* Strings for Input Source Enum Control */ |
12350 | -static const char *const in_src_str[3] = {"Rear Mic", "Line", "Front Mic" }; |
12351 | +static const char *const in_src_str[3] = { "Microphone", "Line In", "Front Microphone" }; |
12352 | #define IN_SRC_NUM_OF_INPUTS 3 |
12353 | enum { |
12354 | REAR_MIC, |
12355 | @@ -1147,7 +1147,7 @@ static const struct hda_pintbl ae5_pincfgs[] = { |
12356 | { 0x0e, 0x01c510f0 }, /* SPDIF In */ |
12357 | { 0x0f, 0x01017114 }, /* Port A -- Rear L/R. */ |
12358 | { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */ |
12359 | - { 0x11, 0x01a170ff }, /* Port B -- LineMicIn2 / Rear Headphone */ |
12360 | + { 0x11, 0x012170ff }, /* Port B -- LineMicIn2 / Rear Headphone */ |
12361 | { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */ |
12362 | { 0x13, 0x908700f0 }, /* What U Hear In*/ |
12363 | { 0x18, 0x50d000f0 }, /* N/A */ |
12364 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
12365 | index c804c15debc69..ec0938923f5de 100644 |
12366 | --- a/sound/pci/hda/patch_realtek.c |
12367 | +++ b/sound/pci/hda/patch_realtek.c |
12368 | @@ -2506,6 +2506,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
12369 | SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), |
12370 | SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), |
12371 | SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), |
12372 | + SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950), |
12373 | SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950), |
12374 | SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), |
12375 | SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), |
12376 | @@ -3094,6 +3095,7 @@ static void alc_disable_headset_jack_key(struct hda_codec *codec) |
12377 | case 0x10ec0215: |
12378 | case 0x10ec0225: |
12379 | case 0x10ec0285: |
12380 | + case 0x10ec0287: |
12381 | case 0x10ec0295: |
12382 | case 0x10ec0289: |
12383 | case 0x10ec0299: |
12384 | @@ -3120,6 +3122,7 @@ static void alc_enable_headset_jack_key(struct hda_codec *codec) |
12385 | case 0x10ec0215: |
12386 | case 0x10ec0225: |
12387 | case 0x10ec0285: |
12388 | + case 0x10ec0287: |
12389 | case 0x10ec0295: |
12390 | case 0x10ec0289: |
12391 | case 0x10ec0299: |
12392 | @@ -7733,11 +7736,14 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
12393 | SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
12394 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
12395 | SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), |
12396 | + SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), |
12397 | SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), |
12398 | SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), |
12399 | SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK), |
12400 | SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), |
12401 | SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), |
12402 | + SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK), |
12403 | + SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK), |
12404 | SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), |
12405 | SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), |
12406 | SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE), |
12407 | @@ -7882,6 +7888,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
12408 | SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
12409 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
12410 | SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
12411 | + SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), |
12412 | SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), |
12413 | SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), |
12414 | SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), |
12415 | @@ -7902,6 +7909,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
12416 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
12417 | SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
12418 | SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
12419 | + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
12420 | SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), |
12421 | SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), |
12422 | SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), |
12423 | @@ -7939,6 +7947,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
12424 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), |
12425 | SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), |
12426 | SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), |
12427 | + SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK), |
12428 | SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
12429 | SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
12430 | SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
12431 | @@ -8521,11 +8530,20 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
12432 | {0x12, 0x90a60130}, |
12433 | {0x19, 0x03a11020}, |
12434 | {0x21, 0x0321101f}), |
12435 | + SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK, |
12436 | + {0x14, 0x90170110}, |
12437 | + {0x19, 0x04a11040}, |
12438 | + {0x21, 0x04211020}), |
12439 | SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, |
12440 | {0x12, 0x90a60130}, |
12441 | {0x14, 0x90170110}, |
12442 | {0x19, 0x04a11040}, |
12443 | {0x21, 0x04211020}), |
12444 | + SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK, |
12445 | + {0x14, 0x90170110}, |
12446 | + {0x17, 0x90170111}, |
12447 | + {0x19, 0x03a11030}, |
12448 | + {0x21, 0x03211020}), |
12449 | SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE, |
12450 | {0x12, 0x90a60130}, |
12451 | {0x17, 0x90170110}, |
12452 | diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c |
12453 | index f4ee6798154af..1612ec65aaf66 100644 |
12454 | --- a/sound/soc/amd/acp-da7219-max98357a.c |
12455 | +++ b/sound/soc/amd/acp-da7219-max98357a.c |
12456 | @@ -73,8 +73,13 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) |
12457 | return ret; |
12458 | } |
12459 | |
12460 | - da7219_dai_wclk = clk_get(component->dev, "da7219-dai-wclk"); |
12461 | - da7219_dai_bclk = clk_get(component->dev, "da7219-dai-bclk"); |
12462 | + da7219_dai_wclk = devm_clk_get(component->dev, "da7219-dai-wclk"); |
12463 | + if (IS_ERR(da7219_dai_wclk)) |
12464 | + return PTR_ERR(da7219_dai_wclk); |
12465 | + |
12466 | + da7219_dai_bclk = devm_clk_get(component->dev, "da7219-dai-bclk"); |
12467 | + if (IS_ERR(da7219_dai_bclk)) |
12468 | + return PTR_ERR(da7219_dai_bclk); |
12469 | |
12470 | ret = snd_soc_card_jack_new(card, "Headset Jack", |
12471 | SND_JACK_HEADSET | SND_JACK_LINEOUT | |
12472 | diff --git a/sound/soc/codecs/cx2072x.c b/sound/soc/codecs/cx2072x.c |
12473 | index 1c1ba7bea4d81..8ee4b2e1ff68f 100644 |
12474 | --- a/sound/soc/codecs/cx2072x.c |
12475 | +++ b/sound/soc/codecs/cx2072x.c |
12476 | @@ -1579,7 +1579,7 @@ static struct snd_soc_dai_driver soc_codec_cx2072x_dai[] = { |
12477 | .id = CX2072X_DAI_DSP, |
12478 | .probe = cx2072x_dsp_dai_probe, |
12479 | .playback = { |
12480 | - .stream_name = "Playback", |
12481 | + .stream_name = "DSP Playback", |
12482 | .channels_min = 2, |
12483 | .channels_max = 2, |
12484 | .rates = CX2072X_RATES_DSP, |
12485 | @@ -1591,7 +1591,7 @@ static struct snd_soc_dai_driver soc_codec_cx2072x_dai[] = { |
12486 | .name = "cx2072x-aec", |
12487 | .id = 3, |
12488 | .capture = { |
12489 | - .stream_name = "Capture", |
12490 | + .stream_name = "AEC Capture", |
12491 | .channels_min = 2, |
12492 | .channels_max = 2, |
12493 | .rates = CX2072X_RATES_DSP, |
12494 | diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c |
12495 | index 37e4bb3dbd8a9..229f2986cd96b 100644 |
12496 | --- a/sound/soc/codecs/wm8997.c |
12497 | +++ b/sound/soc/codecs/wm8997.c |
12498 | @@ -1177,6 +1177,8 @@ static int wm8997_probe(struct platform_device *pdev) |
12499 | goto err_spk_irqs; |
12500 | } |
12501 | |
12502 | + return ret; |
12503 | + |
12504 | err_spk_irqs: |
12505 | arizona_free_spk_irqs(arizona); |
12506 | |
12507 | diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c |
12508 | index 7c18992195733..817ccddd63448 100644 |
12509 | --- a/sound/soc/codecs/wm8998.c |
12510 | +++ b/sound/soc/codecs/wm8998.c |
12511 | @@ -1375,7 +1375,7 @@ static int wm8998_probe(struct platform_device *pdev) |
12512 | |
12513 | ret = arizona_init_spk_irqs(arizona); |
12514 | if (ret < 0) |
12515 | - return ret; |
12516 | + goto err_pm_disable; |
12517 | |
12518 | ret = devm_snd_soc_register_component(&pdev->dev, |
12519 | &soc_component_dev_wm8998, |
12520 | @@ -1390,6 +1390,8 @@ static int wm8998_probe(struct platform_device *pdev) |
12521 | |
12522 | err_spk_irqs: |
12523 | arizona_free_spk_irqs(arizona); |
12524 | +err_pm_disable: |
12525 | + pm_runtime_disable(&pdev->dev); |
12526 | |
12527 | return ret; |
12528 | } |
12529 | diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c |
12530 | index 4c56b782500db..13672928da997 100644 |
12531 | --- a/sound/soc/codecs/wm_adsp.c |
12532 | +++ b/sound/soc/codecs/wm_adsp.c |
12533 | @@ -1496,7 +1496,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, |
12534 | ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL); |
12535 | if (!ctl_work) { |
12536 | ret = -ENOMEM; |
12537 | - goto err_ctl_cache; |
12538 | + goto err_list_del; |
12539 | } |
12540 | |
12541 | ctl_work->dsp = dsp; |
12542 | @@ -1506,7 +1506,8 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, |
12543 | |
12544 | return 0; |
12545 | |
12546 | -err_ctl_cache: |
12547 | +err_list_del: |
12548 | + list_del(&ctl->list); |
12549 | kfree(ctl->cache); |
12550 | err_ctl_name: |
12551 | kfree(ctl->name); |
12552 | diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c |
12553 | index 0bbd86390be59..9bfd2aabbfe63 100644 |
12554 | --- a/sound/soc/jz4740/jz4740-i2s.c |
12555 | +++ b/sound/soc/jz4740/jz4740-i2s.c |
12556 | @@ -309,10 +309,14 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
12557 | switch (clk_id) { |
12558 | case JZ4740_I2S_CLKSRC_EXT: |
12559 | parent = clk_get(NULL, "ext"); |
12560 | + if (IS_ERR(parent)) |
12561 | + return PTR_ERR(parent); |
12562 | clk_set_parent(i2s->clk_i2s, parent); |
12563 | break; |
12564 | case JZ4740_I2S_CLKSRC_PLL: |
12565 | parent = clk_get(NULL, "pll half"); |
12566 | + if (IS_ERR(parent)) |
12567 | + return PTR_ERR(parent); |
12568 | clk_set_parent(i2s->clk_i2s, parent); |
12569 | ret = clk_set_rate(i2s->clk_i2s, freq); |
12570 | break; |
12571 | diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig |
12572 | index 2e3676147ceaf..e0d24592ebd70 100644 |
12573 | --- a/sound/soc/meson/Kconfig |
12574 | +++ b/sound/soc/meson/Kconfig |
12575 | @@ -1,6 +1,6 @@ |
12576 | # SPDX-License-Identifier: GPL-2.0-only |
12577 | menu "ASoC support for Amlogic platforms" |
12578 | - depends on ARCH_MESON || COMPILE_TEST |
12579 | + depends on ARCH_MESON || (COMPILE_TEST && COMMON_CLK) |
12580 | |
12581 | config SND_MESON_AXG_FIFO |
12582 | tristate |
12583 | diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
12584 | index cc4e9aa80fb0d..1196167364d48 100644 |
12585 | --- a/sound/soc/soc-pcm.c |
12586 | +++ b/sound/soc/soc-pcm.c |
12587 | @@ -2346,6 +2346,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
12588 | case SNDRV_PCM_TRIGGER_START: |
12589 | case SNDRV_PCM_TRIGGER_RESUME: |
12590 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
12591 | + case SNDRV_PCM_TRIGGER_DRAIN: |
12592 | ret = dpcm_dai_trigger_fe_be(substream, cmd, true); |
12593 | break; |
12594 | case SNDRV_PCM_TRIGGER_STOP: |
12595 | @@ -2363,6 +2364,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
12596 | case SNDRV_PCM_TRIGGER_START: |
12597 | case SNDRV_PCM_TRIGGER_RESUME: |
12598 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
12599 | + case SNDRV_PCM_TRIGGER_DRAIN: |
12600 | ret = dpcm_dai_trigger_fe_be(substream, cmd, false); |
12601 | break; |
12602 | case SNDRV_PCM_TRIGGER_STOP: |
12603 | diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c |
12604 | index d0a8d5810c0a5..9655dec4166b6 100644 |
12605 | --- a/sound/soc/sunxi/sun4i-i2s.c |
12606 | +++ b/sound/soc/sunxi/sun4i-i2s.c |
12607 | @@ -442,11 +442,11 @@ static int sun8i_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, |
12608 | switch (i2s->format & SND_SOC_DAIFMT_FORMAT_MASK) { |
12609 | case SND_SOC_DAIFMT_DSP_A: |
12610 | case SND_SOC_DAIFMT_DSP_B: |
12611 | - case SND_SOC_DAIFMT_LEFT_J: |
12612 | - case SND_SOC_DAIFMT_RIGHT_J: |
12613 | lrck_period = params_physical_width(params) * slots; |
12614 | break; |
12615 | |
12616 | + case SND_SOC_DAIFMT_LEFT_J: |
12617 | + case SND_SOC_DAIFMT_RIGHT_J: |
12618 | case SND_SOC_DAIFMT_I2S: |
12619 | lrck_period = params_physical_width(params); |
12620 | break; |
12621 | diff --git a/sound/usb/clock.c b/sound/usb/clock.c |
12622 | index b118cf97607f3..385a488c25cb0 100644 |
12623 | --- a/sound/usb/clock.c |
12624 | +++ b/sound/usb/clock.c |
12625 | @@ -531,6 +531,12 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, |
12626 | } |
12627 | |
12628 | crate = data[0] | (data[1] << 8) | (data[2] << 16); |
12629 | + if (!crate) { |
12630 | + dev_info(&dev->dev, "failed to read current rate; disabling the check\n"); |
12631 | + chip->sample_rate_read_error = 3; /* three strikes, see above */ |
12632 | + return 0; |
12633 | + } |
12634 | + |
12635 | if (crate != rate) { |
12636 | dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate); |
12637 | // runtime->rate = crate; |
12638 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
12639 | index 931964716228e..a7f31766d14df 100644 |
12640 | --- a/sound/usb/quirks.c |
12641 | +++ b/sound/usb/quirks.c |
12642 | @@ -1731,6 +1731,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
12643 | case 0x25ce: /* Mytek devices */ |
12644 | case 0x278b: /* Rotel? */ |
12645 | case 0x292b: /* Gustard/Ess based devices */ |
12646 | + case 0x2972: /* FiiO devices */ |
12647 | case 0x2ab6: /* T+A devices */ |
12648 | case 0x3353: /* Khadas devices */ |
12649 | case 0x3842: /* EVGA */ |
12650 | diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c |
12651 | index ef46c28488085..869ef7e22bd91 100644 |
12652 | --- a/tools/perf/util/parse-regs-options.c |
12653 | +++ b/tools/perf/util/parse-regs-options.c |
12654 | @@ -52,7 +52,7 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr) |
12655 | } |
12656 | fputc('\n', stderr); |
12657 | /* just printing available regs */ |
12658 | - return -1; |
12659 | + goto error; |
12660 | } |
12661 | for (r = sample_reg_masks; r->name; r++) { |
12662 | if ((r->mask & mask) && !strcasecmp(s, r->name)) |
12663 | diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c |
12664 | index bf50f464234fe..f778f8e7e65a3 100644 |
12665 | --- a/tools/perf/util/probe-file.c |
12666 | +++ b/tools/perf/util/probe-file.c |
12667 | @@ -777,7 +777,7 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, |
12668 | const char *sdtgrp) |
12669 | { |
12670 | struct strbuf buf; |
12671 | - char *ret = NULL, **args; |
12672 | + char *ret = NULL; |
12673 | int i, args_count, err; |
12674 | unsigned long long ref_ctr_offset; |
12675 | |
12676 | @@ -799,12 +799,19 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, |
12677 | goto out; |
12678 | |
12679 | if (note->args) { |
12680 | - args = argv_split(note->args, &args_count); |
12681 | + char **args = argv_split(note->args, &args_count); |
12682 | + |
12683 | + if (args == NULL) |
12684 | + goto error; |
12685 | |
12686 | for (i = 0; i < args_count; ++i) { |
12687 | - if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) |
12688 | + if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) { |
12689 | + argv_free(args); |
12690 | goto error; |
12691 | + } |
12692 | } |
12693 | + |
12694 | + argv_free(args); |
12695 | } |
12696 | |
12697 | out: |
12698 | diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile |
12699 | index 6889c19a628c2..544bd1028baee 100644 |
12700 | --- a/tools/testing/selftests/bpf/Makefile |
12701 | +++ b/tools/testing/selftests/bpf/Makefile |
12702 | @@ -144,7 +144,8 @@ endif |
12703 | # build would have failed anyways. |
12704 | define get_sys_includes |
12705 | $(shell $(1) -v -E - </dev/null 2>&1 \ |
12706 | - | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') |
12707 | + | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ |
12708 | +$(shell $(1) -dM -E - </dev/null | grep '#define __riscv_xlen ' | sed 's/#define /-D/' | sed 's/ /=/') |
12709 | endef |
12710 | CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG)) |
12711 | BPF_CFLAGS = -I. -I./include/uapi -I../../../include/uapi \ |
12712 | diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c |
12713 | index 504df69c83df4..0f98724120deb 100644 |
12714 | --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c |
12715 | +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c |
12716 | @@ -15,7 +15,6 @@ |
12717 | #include <linux/ip.h> |
12718 | #include <linux/ipv6.h> |
12719 | #include <linux/types.h> |
12720 | -#include <linux/tcp.h> |
12721 | #include <linux/socket.h> |
12722 | #include <linux/pkt_cls.h> |
12723 | #include <linux/erspan.h> |
12724 | @@ -528,12 +527,11 @@ int _ipip_set_tunnel(struct __sk_buff *skb) |
12725 | struct bpf_tunnel_key key = {}; |
12726 | void *data = (void *)(long)skb->data; |
12727 | struct iphdr *iph = data; |
12728 | - struct tcphdr *tcp = data + sizeof(*iph); |
12729 | void *data_end = (void *)(long)skb->data_end; |
12730 | int ret; |
12731 | |
12732 | /* single length check */ |
12733 | - if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { |
12734 | + if (data + sizeof(*iph) > data_end) { |
12735 | ERROR(1); |
12736 | return TC_ACT_SHOT; |
12737 | } |
12738 | @@ -541,16 +539,6 @@ int _ipip_set_tunnel(struct __sk_buff *skb) |
12739 | key.tunnel_ttl = 64; |
12740 | if (iph->protocol == IPPROTO_ICMP) { |
12741 | key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ |
12742 | - } else { |
12743 | - if (iph->protocol != IPPROTO_TCP || iph->ihl != 5) |
12744 | - return TC_ACT_SHOT; |
12745 | - |
12746 | - if (tcp->dest == bpf_htons(5200)) |
12747 | - key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ |
12748 | - else if (tcp->dest == bpf_htons(5201)) |
12749 | - key.remote_ipv4 = 0xac100165; /* 172.16.1.101 */ |
12750 | - else |
12751 | - return TC_ACT_SHOT; |
12752 | } |
12753 | |
12754 | ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); |
12755 | @@ -585,19 +573,20 @@ int _ipip6_set_tunnel(struct __sk_buff *skb) |
12756 | struct bpf_tunnel_key key = {}; |
12757 | void *data = (void *)(long)skb->data; |
12758 | struct iphdr *iph = data; |
12759 | - struct tcphdr *tcp = data + sizeof(*iph); |
12760 | void *data_end = (void *)(long)skb->data_end; |
12761 | int ret; |
12762 | |
12763 | /* single length check */ |
12764 | - if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { |
12765 | + if (data + sizeof(*iph) > data_end) { |
12766 | ERROR(1); |
12767 | return TC_ACT_SHOT; |
12768 | } |
12769 | |
12770 | __builtin_memset(&key, 0x0, sizeof(key)); |
12771 | - key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ |
12772 | key.tunnel_ttl = 64; |
12773 | + if (iph->protocol == IPPROTO_ICMP) { |
12774 | + key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ |
12775 | + } |
12776 | |
12777 | ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), |
12778 | BPF_F_TUNINFO_IPV6); |
12779 | @@ -634,35 +623,18 @@ int _ip6ip6_set_tunnel(struct __sk_buff *skb) |
12780 | struct bpf_tunnel_key key = {}; |
12781 | void *data = (void *)(long)skb->data; |
12782 | struct ipv6hdr *iph = data; |
12783 | - struct tcphdr *tcp = data + sizeof(*iph); |
12784 | void *data_end = (void *)(long)skb->data_end; |
12785 | int ret; |
12786 | |
12787 | /* single length check */ |
12788 | - if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { |
12789 | + if (data + sizeof(*iph) > data_end) { |
12790 | ERROR(1); |
12791 | return TC_ACT_SHOT; |
12792 | } |
12793 | |
12794 | - key.remote_ipv6[0] = bpf_htonl(0x2401db00); |
12795 | key.tunnel_ttl = 64; |
12796 | - |
12797 | if (iph->nexthdr == 58 /* NEXTHDR_ICMP */) { |
12798 | - key.remote_ipv6[3] = bpf_htonl(1); |
12799 | - } else { |
12800 | - if (iph->nexthdr != 6 /* NEXTHDR_TCP */) { |
12801 | - ERROR(iph->nexthdr); |
12802 | - return TC_ACT_SHOT; |
12803 | - } |
12804 | - |
12805 | - if (tcp->dest == bpf_htons(5200)) { |
12806 | - key.remote_ipv6[3] = bpf_htonl(1); |
12807 | - } else if (tcp->dest == bpf_htons(5201)) { |
12808 | - key.remote_ipv6[3] = bpf_htonl(2); |
12809 | - } else { |
12810 | - ERROR(tcp->dest); |
12811 | - return TC_ACT_SHOT; |
12812 | - } |
12813 | + key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ |
12814 | } |
12815 | |
12816 | ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), |
12817 | diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py |
12818 | index 1afa22c88e42a..8f918847ddf89 100755 |
12819 | --- a/tools/testing/selftests/bpf/test_offload.py |
12820 | +++ b/tools/testing/selftests/bpf/test_offload.py |
12821 | @@ -930,6 +930,7 @@ try: |
12822 | start_test("Test disabling TC offloads is rejected while filters installed...") |
12823 | ret, _ = sim.set_ethtool_tc_offloads(False, fail=False) |
12824 | fail(ret == 0, "Driver should refuse to disable TC offloads with filters installed...") |
12825 | + sim.set_ethtool_tc_offloads(True) |
12826 | |
12827 | start_test("Test qdisc removal frees things...") |
12828 | sim.tc_flush_filters() |
12829 | diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh |
12830 | index bd12ec97a44df..1ccbe804e8e1c 100755 |
12831 | --- a/tools/testing/selftests/bpf/test_tunnel.sh |
12832 | +++ b/tools/testing/selftests/bpf/test_tunnel.sh |
12833 | @@ -24,12 +24,12 @@ |
12834 | # Root namespace with metadata-mode tunnel + BPF |
12835 | # Device names and addresses: |
12836 | # veth1 IP: 172.16.1.200, IPv6: 00::22 (underlay) |
12837 | -# tunnel dev <type>11, ex: gre11, IPv4: 10.1.1.200 (overlay) |
12838 | +# tunnel dev <type>11, ex: gre11, IPv4: 10.1.1.200, IPv6: 1::22 (overlay) |
12839 | # |
12840 | # Namespace at_ns0 with native tunnel |
12841 | # Device names and addresses: |
12842 | # veth0 IPv4: 172.16.1.100, IPv6: 00::11 (underlay) |
12843 | -# tunnel dev <type>00, ex: gre00, IPv4: 10.1.1.100 (overlay) |
12844 | +# tunnel dev <type>00, ex: gre00, IPv4: 10.1.1.100, IPv6: 1::11 (overlay) |
12845 | # |
12846 | # |
12847 | # End-to-end ping packet flow |
12848 | @@ -250,7 +250,7 @@ add_ipip_tunnel() |
12849 | ip addr add dev $DEV 10.1.1.200/24 |
12850 | } |
12851 | |
12852 | -add_ipip6tnl_tunnel() |
12853 | +add_ip6tnl_tunnel() |
12854 | { |
12855 | ip netns exec at_ns0 ip addr add ::11/96 dev veth0 |
12856 | ip netns exec at_ns0 ip link set dev veth0 up |
12857 | @@ -262,11 +262,13 @@ add_ipip6tnl_tunnel() |
12858 | ip link add dev $DEV_NS type $TYPE \ |
12859 | local ::11 remote ::22 |
12860 | ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24 |
12861 | + ip netns exec at_ns0 ip addr add dev $DEV_NS 1::11/96 |
12862 | ip netns exec at_ns0 ip link set dev $DEV_NS up |
12863 | |
12864 | # root namespace |
12865 | ip link add dev $DEV type $TYPE external |
12866 | ip addr add dev $DEV 10.1.1.200/24 |
12867 | + ip addr add dev $DEV 1::22/96 |
12868 | ip link set dev $DEV up |
12869 | } |
12870 | |
12871 | @@ -534,7 +536,7 @@ test_ipip6() |
12872 | |
12873 | check $TYPE |
12874 | config_device |
12875 | - add_ipip6tnl_tunnel |
12876 | + add_ip6tnl_tunnel |
12877 | ip link set dev veth1 mtu 1500 |
12878 | attach_bpf $DEV ipip6_set_tunnel ipip6_get_tunnel |
12879 | # underlay |
12880 | @@ -553,6 +555,34 @@ test_ipip6() |
12881 | echo -e ${GREEN}"PASS: $TYPE"${NC} |
12882 | } |
12883 | |
12884 | +test_ip6ip6() |
12885 | +{ |
12886 | + TYPE=ip6tnl |
12887 | + DEV_NS=ip6ip6tnl00 |
12888 | + DEV=ip6ip6tnl11 |
12889 | + ret=0 |
12890 | + |
12891 | + check $TYPE |
12892 | + config_device |
12893 | + add_ip6tnl_tunnel |
12894 | + ip link set dev veth1 mtu 1500 |
12895 | + attach_bpf $DEV ip6ip6_set_tunnel ip6ip6_get_tunnel |
12896 | + # underlay |
12897 | + ping6 $PING_ARG ::11 |
12898 | + # ip6 over ip6 |
12899 | + ping6 $PING_ARG 1::11 |
12900 | + check_err $? |
12901 | + ip netns exec at_ns0 ping6 $PING_ARG 1::22 |
12902 | + check_err $? |
12903 | + cleanup |
12904 | + |
12905 | + if [ $ret -ne 0 ]; then |
12906 | + echo -e ${RED}"FAIL: ip6$TYPE"${NC} |
12907 | + return 1 |
12908 | + fi |
12909 | + echo -e ${GREEN}"PASS: ip6$TYPE"${NC} |
12910 | +} |
12911 | + |
12912 | setup_xfrm_tunnel() |
12913 | { |
12914 | auth=0x$(printf '1%.0s' {1..40}) |
12915 | @@ -646,6 +676,7 @@ cleanup() |
12916 | ip link del veth1 2> /dev/null |
12917 | ip link del ipip11 2> /dev/null |
12918 | ip link del ipip6tnl11 2> /dev/null |
12919 | + ip link del ip6ip6tnl11 2> /dev/null |
12920 | ip link del gretap11 2> /dev/null |
12921 | ip link del ip6gre11 2> /dev/null |
12922 | ip link del ip6gretap11 2> /dev/null |
12923 | @@ -742,6 +773,10 @@ bpf_tunnel_test() |
12924 | test_ipip6 |
12925 | errors=$(( $errors + $? )) |
12926 | |
12927 | + echo "Testing IP6IP6 tunnel..." |
12928 | + test_ip6ip6 |
12929 | + errors=$(( $errors + $? )) |
12930 | + |
12931 | echo "Testing IPSec tunnel..." |
12932 | test_xfrm_tunnel |
12933 | errors=$(( $errors + $? )) |
12934 | diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c |
12935 | index db3d4a8b5a4c4..76a24052f4b47 100644 |
12936 | --- a/tools/testing/selftests/net/udpgso_bench_rx.c |
12937 | +++ b/tools/testing/selftests/net/udpgso_bench_rx.c |
12938 | @@ -113,6 +113,9 @@ static void do_poll(int fd, int timeout_ms) |
12939 | interrupted = true; |
12940 | break; |
12941 | } |
12942 | + |
12943 | + /* no events and more time to wait, do poll again */ |
12944 | + continue; |
12945 | } |
12946 | if (pfd.revents != POLLIN) |
12947 | error(1, errno, "poll: 0x%x expected 0x%x\n", |
12948 | diff --git a/tools/testing/selftests/seccomp/config b/tools/testing/selftests/seccomp/config |
12949 | index db1e11b08c8a4..764af1f853f95 100644 |
12950 | --- a/tools/testing/selftests/seccomp/config |
12951 | +++ b/tools/testing/selftests/seccomp/config |
12952 | @@ -1,2 +1,3 @@ |
12953 | +CONFIG_PID_NS=y |
12954 | CONFIG_SECCOMP=y |
12955 | CONFIG_SECCOMP_FILTER=y |