Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.10 commit in: /
Date: Wed, 15 Sep 2021 12:00:16
Message-Id: 1631707198.d91b8a390d38f10017cd604bd38bb38ae7753793.mpagano@gentoo
1 commit: d91b8a390d38f10017cd604bd38bb38ae7753793
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 15 11:59:58 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 15 11:59:58 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d91b8a39
7
8 Linux patch 5.10.65
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1064_linux-5.10.65.patch | 9178 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 9182 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 8ddd447..da11f46 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -299,6 +299,10 @@ Patch: 1063_linux-5.10.64.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.10.64
23
24 +Patch: 1064_linux-5.10.65.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.10.65
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1064_linux-5.10.65.patch b/1064_linux-5.10.65.patch
33 new file mode 100644
34 index 0000000..756e792
35 --- /dev/null
36 +++ b/1064_linux-5.10.65.patch
37 @@ -0,0 +1,9178 @@
38 +diff --git a/Documentation/fault-injection/provoke-crashes.rst b/Documentation/fault-injection/provoke-crashes.rst
39 +index a20ba5d939320..18de17354206a 100644
40 +--- a/Documentation/fault-injection/provoke-crashes.rst
41 ++++ b/Documentation/fault-injection/provoke-crashes.rst
42 +@@ -29,7 +29,7 @@ recur_count
43 + cpoint_name
44 + Where in the kernel to trigger the action. It can be
45 + one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
46 +- FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
47 ++ FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_QUEUE_RQ,
48 + IDE_CORE_CP, or DIRECT
49 +
50 + cpoint_type
51 +diff --git a/Makefile b/Makefile
52 +index 982aa1876aa04..91eb017f5296d 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,7 +1,7 @@
56 + # SPDX-License-Identifier: GPL-2.0
57 + VERSION = 5
58 + PATCHLEVEL = 10
59 +-SUBLEVEL = 64
60 ++SUBLEVEL = 65
61 + EXTRAVERSION =
62 + NAME = Dare mighty things
63 +
64 +diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
65 +index 7028e21bdd980..910eacc8ad3bd 100644
66 +--- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
67 ++++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
68 +@@ -208,12 +208,12 @@
69 + };
70 +
71 + pinctrl_hvi3c3_default: hvi3c3_default {
72 +- function = "HVI3C3";
73 ++ function = "I3C3";
74 + groups = "HVI3C3";
75 + };
76 +
77 + pinctrl_hvi3c4_default: hvi3c4_default {
78 +- function = "HVI3C4";
79 ++ function = "I3C4";
80 + groups = "HVI3C4";
81 + };
82 +
83 +diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts
84 +index edca66c232c15..ebbc9b23aef1c 100644
85 +--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
86 ++++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
87 +@@ -92,6 +92,8 @@
88 +
89 + leds {
90 + compatible = "gpio-leds";
91 ++ pinctrl-names = "default";
92 ++ pinctrl-0 = <&pinctrl_gpio_leds>;
93 + status = "okay"; /* Conflict with pwm0. */
94 +
95 + red {
96 +@@ -537,6 +539,10 @@
97 + AT91_PIOA 19 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI) /* PA19 DAT2 periph A with pullup */
98 + AT91_PIOA 20 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)>; /* PA20 DAT3 periph A with pullup */
99 + };
100 ++ pinctrl_sdmmc0_cd: sdmmc0_cd {
101 ++ atmel,pins =
102 ++ <AT91_PIOA 23 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
103 ++ };
104 + };
105 +
106 + sdmmc1 {
107 +@@ -569,6 +575,14 @@
108 + AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
109 + };
110 + };
111 ++
112 ++ leds {
113 ++ pinctrl_gpio_leds: gpio_leds {
114 ++ atmel,pins = <AT91_PIOB 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
115 ++ AT91_PIOB 12 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
116 ++ AT91_PIOB 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
117 ++ };
118 ++ };
119 + }; /* pinctrl */
120 +
121 + &pwm0 {
122 +@@ -580,7 +594,7 @@
123 + &sdmmc0 {
124 + bus-width = <4>;
125 + pinctrl-names = "default";
126 +- pinctrl-0 = <&pinctrl_sdmmc0_default>;
127 ++ pinctrl-0 = <&pinctrl_sdmmc0_default &pinctrl_sdmmc0_cd>;
128 + status = "okay";
129 + cd-gpios = <&pioA 23 GPIO_ACTIVE_LOW>;
130 + disable-wp;
131 +diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
132 +index 9c55a921263bd..cc55d1684322b 100644
133 +--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
134 ++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
135 +@@ -57,6 +57,8 @@
136 + };
137 +
138 + spi0: spi@f0004000 {
139 ++ pinctrl-names = "default";
140 ++ pinctrl-0 = <&pinctrl_spi0_cs>;
141 + cs-gpios = <&pioD 13 0>, <0>, <0>, <&pioD 16 0>;
142 + status = "okay";
143 + };
144 +@@ -169,6 +171,8 @@
145 + };
146 +
147 + spi1: spi@f8008000 {
148 ++ pinctrl-names = "default";
149 ++ pinctrl-0 = <&pinctrl_spi1_cs>;
150 + cs-gpios = <&pioC 25 0>;
151 + status = "okay";
152 + };
153 +@@ -248,6 +252,26 @@
154 + <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
155 + AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
156 + };
157 ++
158 ++ pinctrl_gpio_leds: gpio_leds_default {
159 ++ atmel,pins =
160 ++ <AT91_PIOE 23 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
161 ++ AT91_PIOE 24 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
162 ++ };
163 ++
164 ++ pinctrl_spi0_cs: spi0_cs_default {
165 ++ atmel,pins =
166 ++ <AT91_PIOD 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
167 ++ AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
168 ++ };
169 ++
170 ++ pinctrl_spi1_cs: spi1_cs_default {
171 ++ atmel,pins = <AT91_PIOC 25 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
172 ++ };
173 ++
174 ++ pinctrl_vcc_mmc0_reg_gpio: vcc_mmc0_reg_gpio_default {
175 ++ atmel,pins = <AT91_PIOE 2 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
176 ++ };
177 + };
178 + };
179 + };
180 +@@ -339,6 +363,8 @@
181 +
182 + vcc_mmc0_reg: fixedregulator_mmc0 {
183 + compatible = "regulator-fixed";
184 ++ pinctrl-names = "default";
185 ++ pinctrl-0 = <&pinctrl_vcc_mmc0_reg_gpio>;
186 + gpio = <&pioE 2 GPIO_ACTIVE_LOW>;
187 + regulator-name = "mmc0-card-supply";
188 + regulator-min-microvolt = <3300000>;
189 +@@ -362,6 +388,9 @@
190 +
191 + leds {
192 + compatible = "gpio-leds";
193 ++ pinctrl-names = "default";
194 ++ pinctrl-0 = <&pinctrl_gpio_leds>;
195 ++ status = "okay";
196 +
197 + d2 {
198 + label = "d2";
199 +diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
200 +index 0b3ad1b580b83..e42dae06b5826 100644
201 +--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
202 ++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
203 +@@ -90,6 +90,8 @@
204 + };
205 +
206 + spi1: spi@fc018000 {
207 ++ pinctrl-names = "default";
208 ++ pinctrl-0 = <&pinctrl_spi0_cs>;
209 + cs-gpios = <&pioB 21 0>;
210 + status = "okay";
211 + };
212 +@@ -147,6 +149,19 @@
213 + atmel,pins =
214 + <AT91_PIOE 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
215 + };
216 ++ pinctrl_spi0_cs: spi0_cs_default {
217 ++ atmel,pins =
218 ++ <AT91_PIOB 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
219 ++ };
220 ++ pinctrl_gpio_leds: gpio_leds_default {
221 ++ atmel,pins =
222 ++ <AT91_PIOD 30 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
223 ++ AT91_PIOE 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
224 ++ };
225 ++ pinctrl_vcc_mmc1_reg: vcc_mmc1_reg {
226 ++ atmel,pins =
227 ++ <AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
228 ++ };
229 + };
230 + };
231 + };
232 +@@ -252,6 +267,8 @@
233 +
234 + leds {
235 + compatible = "gpio-leds";
236 ++ pinctrl-names = "default";
237 ++ pinctrl-0 = <&pinctrl_gpio_leds>;
238 + status = "okay";
239 +
240 + d8 {
241 +@@ -278,6 +295,8 @@
242 +
243 + vcc_mmc1_reg: fixedregulator_mmc1 {
244 + compatible = "regulator-fixed";
245 ++ pinctrl-names = "default";
246 ++ pinctrl-0 = <&pinctrl_vcc_mmc1_reg>;
247 + gpio = <&pioE 4 GPIO_ACTIVE_LOW>;
248 + regulator-name = "VDD MCI1";
249 + regulator-min-microvolt = <3300000>;
250 +diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi
251 +index 04688e8abce2c..740a6c816266c 100644
252 +--- a/arch/arm/boot/dts/meson8.dtsi
253 ++++ b/arch/arm/boot/dts/meson8.dtsi
254 +@@ -251,8 +251,13 @@
255 + "pp2", "ppmmu2", "pp4", "ppmmu4",
256 + "pp5", "ppmmu5", "pp6", "ppmmu6";
257 + resets = <&reset RESET_MALI>;
258 ++
259 + clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
260 + clock-names = "bus", "core";
261 ++
262 ++ assigned-clocks = <&clkc CLKID_MALI>;
263 ++ assigned-clock-rates = <318750000>;
264 ++
265 + operating-points-v2 = <&gpu_opp_table>;
266 + };
267 + };
268 +diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts
269 +index ed06102a40140..c6824d26dbbf6 100644
270 +--- a/arch/arm/boot/dts/meson8b-ec100.dts
271 ++++ b/arch/arm/boot/dts/meson8b-ec100.dts
272 +@@ -153,7 +153,7 @@
273 + regulator-min-microvolt = <860000>;
274 + regulator-max-microvolt = <1140000>;
275 +
276 +- vin-supply = <&vcc_5v>;
277 ++ pwm-supply = <&vcc_5v>;
278 +
279 + pwms = <&pwm_cd 0 1148 0>;
280 + pwm-dutycycle-range = <100 0>;
281 +@@ -237,7 +237,7 @@
282 + regulator-min-microvolt = <860000>;
283 + regulator-max-microvolt = <1140000>;
284 +
285 +- vin-supply = <&vcc_5v>;
286 ++ pwm-supply = <&vcc_5v>;
287 +
288 + pwms = <&pwm_cd 1 1148 0>;
289 + pwm-dutycycle-range = <100 0>;
290 +diff --git a/arch/arm/boot/dts/meson8b-mxq.dts b/arch/arm/boot/dts/meson8b-mxq.dts
291 +index 33037ef62d0ad..b2edac1fce6dc 100644
292 +--- a/arch/arm/boot/dts/meson8b-mxq.dts
293 ++++ b/arch/arm/boot/dts/meson8b-mxq.dts
294 +@@ -39,6 +39,8 @@
295 + regulator-min-microvolt = <860000>;
296 + regulator-max-microvolt = <1140000>;
297 +
298 ++ pwm-supply = <&vcc_5v>;
299 ++
300 + pwms = <&pwm_cd 0 1148 0>;
301 + pwm-dutycycle-range = <100 0>;
302 +
303 +@@ -84,7 +86,7 @@
304 + regulator-min-microvolt = <860000>;
305 + regulator-max-microvolt = <1140000>;
306 +
307 +- vin-supply = <&vcc_5v>;
308 ++ pwm-supply = <&vcc_5v>;
309 +
310 + pwms = <&pwm_cd 1 1148 0>;
311 + pwm-dutycycle-range = <100 0>;
312 +diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
313 +index 5963566dbcc9d..73ce1c13da24c 100644
314 +--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
315 ++++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
316 +@@ -136,7 +136,7 @@
317 + regulator-min-microvolt = <860000>;
318 + regulator-max-microvolt = <1140000>;
319 +
320 +- vin-supply = <&p5v0>;
321 ++ pwm-supply = <&p5v0>;
322 +
323 + pwms = <&pwm_cd 0 12218 0>;
324 + pwm-dutycycle-range = <91 0>;
325 +@@ -168,7 +168,7 @@
326 + regulator-min-microvolt = <860000>;
327 + regulator-max-microvolt = <1140000>;
328 +
329 +- vin-supply = <&p5v0>;
330 ++ pwm-supply = <&p5v0>;
331 +
332 + pwms = <&pwm_cd 1 12218 0>;
333 + pwm-dutycycle-range = <91 0>;
334 +diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi
335 +index 7599e1a00ff51..48952a556648a 100644
336 +--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
337 ++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
338 +@@ -102,7 +102,7 @@
339 + #address-cells = <0>;
340 + interrupt-controller;
341 + reg = <0x11001000 0x1000>,
342 +- <0x11002000 0x1000>,
343 ++ <0x11002000 0x2000>,
344 + <0x11004000 0x2000>,
345 + <0x11006000 0x2000>;
346 + };
347 +diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
348 +index bbd34ae12a53b..2e437f20da39b 100644
349 +--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
350 ++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
351 +@@ -134,6 +134,23 @@
352 + pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>;
353 + status = "okay";
354 + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>;
355 ++ /*
356 ++ * U-Boot port for Turris Mox has a bug which always expects that "ranges" DT property
357 ++ * contains exactly 2 ranges with 3 (child) address cells, 2 (parent) address cells and
358 ++ * 2 size cells and also expects that the second range starts at 16 MB offset. If these
359 ++ * conditions are not met then U-Boot crashes during loading kernel DTB file. PCIe address
360 ++ * space is 128 MB long, so the best split between MEM and IO is to use fixed 16 MB window
361 ++ * for IO and the rest 112 MB (64+32+16) for MEM, despite that maximal IO size is just 64 kB.
362 ++ * This bug is not present in U-Boot ports for other Armada 3700 devices and is fixed in
363 ++ * U-Boot version 2021.07. See relevant U-Boot commits (the last one contains fix):
364 ++ * https://source.denx.de/u-boot/u-boot/-/commit/cb2ddb291ee6fcbddd6d8f4ff49089dfe580f5d7
365 ++ * https://source.denx.de/u-boot/u-boot/-/commit/c64ac3b3185aeb3846297ad7391fc6df8ecd73bf
366 ++ * https://source.denx.de/u-boot/u-boot/-/commit/4a82fca8e330157081fc132a591ebd99ba02ee33
367 ++ */
368 ++ #address-cells = <3>;
369 ++ #size-cells = <2>;
370 ++ ranges = <0x81000000 0 0xe8000000 0 0xe8000000 0 0x01000000 /* Port 0 IO */
371 ++ 0x82000000 0 0xe9000000 0 0xe9000000 0 0x07000000>; /* Port 0 MEM */
372 +
373 + /* enabled by U-Boot if PCIe module is present */
374 + status = "disabled";
375 +diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
376 +index 83d2d83f7692b..2a2015a153627 100644
377 +--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
378 ++++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
379 +@@ -487,8 +487,15 @@
380 + #interrupt-cells = <1>;
381 + msi-parent = <&pcie0>;
382 + msi-controller;
383 +- ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x1000000 /* Port 0 MEM */
384 +- 0x81000000 0 0xe9000000 0 0xe9000000 0 0x10000>; /* Port 0 IO*/
385 ++ /*
386 ++ * The 128 MiB address range [0xe8000000-0xf0000000] is
387 ++ * dedicated for PCIe and can be assigned to 8 windows
388 ++ * with size a power of two. Use one 64 KiB window for
389 ++ * IO at the end and the remaining seven windows
390 ++ * (totaling 127 MiB) for MEM.
391 ++ */
392 ++ ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x07f00000 /* Port 0 MEM */
393 ++ 0x81000000 0 0xefff0000 0 0xefff0000 0 0x00010000>; /* Port 0 IO */
394 + interrupt-map-mask = <0 0 0 7>;
395 + interrupt-map = <0 0 0 1 &pcie_intc 0>,
396 + <0 0 0 2 &pcie_intc 1>,
397 +diff --git a/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi b/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi
398 +index e3773b05c403b..3c73dfc430afc 100644
399 +--- a/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi
400 ++++ b/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi
401 +@@ -55,7 +55,8 @@
402 + pinctrl-0 = <&avb_pins>;
403 + pinctrl-names = "default";
404 + phy-handle = <&phy0>;
405 +- phy-mode = "rgmii-id";
406 ++ rx-internal-delay-ps = <1800>;
407 ++ tx-internal-delay-ps = <2000>;
408 + status = "okay";
409 +
410 + phy0: ethernet-phy@0 {
411 +diff --git a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi
412 +index b9e46aed53362..dde3a07bc417c 100644
413 +--- a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi
414 ++++ b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi
415 +@@ -19,7 +19,8 @@
416 + pinctrl-0 = <&avb_pins>;
417 + pinctrl-names = "default";
418 + phy-handle = <&phy0>;
419 +- phy-mode = "rgmii-txid";
420 ++ tx-internal-delay-ps = <2000>;
421 ++ rx-internal-delay-ps = <1800>;
422 + status = "okay";
423 +
424 + phy0: ethernet-phy@0 {
425 +diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
426 +index c58a0846db502..a5ebe574fbace 100644
427 +--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
428 ++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
429 +@@ -1131,6 +1131,8 @@
430 + power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>;
431 + resets = <&cpg 812>;
432 + phy-mode = "rgmii";
433 ++ rx-internal-delay-ps = <0>;
434 ++ tx-internal-delay-ps = <0>;
435 + iommus = <&ipmmu_ds0 16>;
436 + #address-cells = <1>;
437 + #size-cells = <0>;
438 +diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi
439 +index 9ebf6e58ba31c..20003a41a706b 100644
440 +--- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi
441 ++++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi
442 +@@ -1004,6 +1004,8 @@
443 + power-domains = <&sysc R8A774B1_PD_ALWAYS_ON>;
444 + resets = <&cpg 812>;
445 + phy-mode = "rgmii";
446 ++ rx-internal-delay-ps = <0>;
447 ++ tx-internal-delay-ps = <0>;
448 + iommus = <&ipmmu_ds0 16>;
449 + #address-cells = <1>;
450 + #size-cells = <0>;
451 +diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
452 +index f27d9b2eb996b..e0e54342cd4c7 100644
453 +--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
454 ++++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi
455 +@@ -960,6 +960,7 @@
456 + power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
457 + resets = <&cpg 812>;
458 + phy-mode = "rgmii";
459 ++ rx-internal-delay-ps = <0>;
460 + iommus = <&ipmmu_ds0 16>;
461 + #address-cells = <1>;
462 + #size-cells = <0>;
463 +diff --git a/arch/arm64/boot/dts/renesas/r8a774e1.dtsi b/arch/arm64/boot/dts/renesas/r8a774e1.dtsi
464 +index 708258696b4f4..2e6c12a46daf5 100644
465 +--- a/arch/arm64/boot/dts/renesas/r8a774e1.dtsi
466 ++++ b/arch/arm64/boot/dts/renesas/r8a774e1.dtsi
467 +@@ -1233,6 +1233,8 @@
468 + power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
469 + resets = <&cpg 812>;
470 + phy-mode = "rgmii";
471 ++ rx-internal-delay-ps = <0>;
472 ++ tx-internal-delay-ps = <0>;
473 + iommus = <&ipmmu_ds0 16>;
474 + #address-cells = <1>;
475 + #size-cells = <0>;
476 +diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
477 +index 8f471881b7a36..2e4bb7ecd5bde 100644
478 +--- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
479 ++++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
480 +@@ -277,10 +277,6 @@
481 + interrupt-parent = <&gpio1>;
482 + interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
483 +
484 +- /* Depends on LVDS */
485 +- max-clock = <135000000>;
486 +- min-vrefresh = <50>;
487 +-
488 + adi,input-depth = <8>;
489 + adi,input-colorspace = "rgb";
490 + adi,input-clock = "1x";
491 +diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
492 +index 694c4fca9f5dc..c17205da47fe3 100644
493 +--- a/arch/m68k/Kconfig.cpu
494 ++++ b/arch/m68k/Kconfig.cpu
495 +@@ -25,6 +25,7 @@ config COLDFIRE
496 + bool "Coldfire CPU family support"
497 + select ARCH_HAVE_CUSTOM_GPIO_H
498 + select CPU_HAS_NO_BITFIELDS
499 ++ select CPU_HAS_NO_CAS
500 + select CPU_HAS_NO_MULDIV64
501 + select GENERIC_CSUM
502 + select GPIOLIB
503 +@@ -38,6 +39,7 @@ config M68000
504 + bool "MC68000"
505 + depends on !MMU
506 + select CPU_HAS_NO_BITFIELDS
507 ++ select CPU_HAS_NO_CAS
508 + select CPU_HAS_NO_MULDIV64
509 + select CPU_HAS_NO_UNALIGNED
510 + select GENERIC_CSUM
511 +@@ -53,6 +55,7 @@ config M68000
512 + config MCPU32
513 + bool
514 + select CPU_HAS_NO_BITFIELDS
515 ++ select CPU_HAS_NO_CAS
516 + select CPU_HAS_NO_UNALIGNED
517 + select CPU_NO_EFFICIENT_FFS
518 + help
519 +@@ -357,7 +360,7 @@ config ADVANCED
520 +
521 + config RMW_INSNS
522 + bool "Use read-modify-write instructions"
523 +- depends on ADVANCED
524 ++ depends on ADVANCED && !CPU_HAS_NO_CAS
525 + help
526 + This allows to use certain instructions that work with indivisible
527 + read-modify-write bus cycles. While this is faster than the
528 +@@ -411,6 +414,9 @@ config NODES_SHIFT
529 + config CPU_HAS_NO_BITFIELDS
530 + bool
531 +
532 ++config CPU_HAS_NO_CAS
533 ++ bool
534 ++
535 + config CPU_HAS_NO_MULDIV64
536 + bool
537 +
538 +diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
539 +index d2875e32abfca..79e55421cfb18 100644
540 +--- a/arch/m68k/emu/nfeth.c
541 ++++ b/arch/m68k/emu/nfeth.c
542 +@@ -254,8 +254,8 @@ static void __exit nfeth_cleanup(void)
543 +
544 + for (i = 0; i < MAX_UNIT; i++) {
545 + if (nfeth_dev[i]) {
546 +- unregister_netdev(nfeth_dev[0]);
547 +- free_netdev(nfeth_dev[0]);
548 ++ unregister_netdev(nfeth_dev[i]);
549 ++ free_netdev(nfeth_dev[i]);
550 + }
551 + }
552 + free_irq(nfEtherIRQ, nfeth_interrupt);
553 +diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
554 +index 463c24e26000f..171913b9a9250 100644
555 +--- a/arch/s390/include/asm/kvm_host.h
556 ++++ b/arch/s390/include/asm/kvm_host.h
557 +@@ -957,6 +957,7 @@ struct kvm_arch{
558 + atomic64_t cmma_dirty_pages;
559 + /* subset of available cpu features enabled by user space */
560 + DECLARE_BITMAP(cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
561 ++ /* indexed by vcpu_idx */
562 + DECLARE_BITMAP(idle_mask, KVM_MAX_VCPUS);
563 + struct kvm_s390_gisa_interrupt gisa_int;
564 + struct kvm_s390_pv pv;
565 +diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
566 +index b6619ae9a3e0c..89fbfb3b1e01d 100644
567 +--- a/arch/s390/kernel/debug.c
568 ++++ b/arch/s390/kernel/debug.c
569 +@@ -24,6 +24,7 @@
570 + #include <linux/export.h>
571 + #include <linux/init.h>
572 + #include <linux/fs.h>
573 ++#include <linux/minmax.h>
574 + #include <linux/debugfs.h>
575 +
576 + #include <asm/debug.h>
577 +@@ -92,6 +93,8 @@ static int debug_hex_ascii_format_fn(debug_info_t *id, struct debug_view *view,
578 + char *out_buf, const char *in_buf);
579 + static int debug_sprintf_format_fn(debug_info_t *id, struct debug_view *view,
580 + char *out_buf, debug_sprintf_entry_t *curr_event);
581 ++static void debug_areas_swap(debug_info_t *a, debug_info_t *b);
582 ++static void debug_events_append(debug_info_t *dest, debug_info_t *src);
583 +
584 + /* globals */
585 +
586 +@@ -311,24 +314,6 @@ static debug_info_t *debug_info_create(const char *name, int pages_per_area,
587 + goto out;
588 +
589 + rc->mode = mode & ~S_IFMT;
590 +-
591 +- /* create root directory */
592 +- rc->debugfs_root_entry = debugfs_create_dir(rc->name,
593 +- debug_debugfs_root_entry);
594 +-
595 +- /* append new element to linked list */
596 +- if (!debug_area_first) {
597 +- /* first element in list */
598 +- debug_area_first = rc;
599 +- rc->prev = NULL;
600 +- } else {
601 +- /* append element to end of list */
602 +- debug_area_last->next = rc;
603 +- rc->prev = debug_area_last;
604 +- }
605 +- debug_area_last = rc;
606 +- rc->next = NULL;
607 +-
608 + refcount_set(&rc->ref_count, 1);
609 + out:
610 + return rc;
611 +@@ -388,27 +373,10 @@ static void debug_info_get(debug_info_t *db_info)
612 + */
613 + static void debug_info_put(debug_info_t *db_info)
614 + {
615 +- int i;
616 +-
617 + if (!db_info)
618 + return;
619 +- if (refcount_dec_and_test(&db_info->ref_count)) {
620 +- for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
621 +- if (!db_info->views[i])
622 +- continue;
623 +- debugfs_remove(db_info->debugfs_entries[i]);
624 +- }
625 +- debugfs_remove(db_info->debugfs_root_entry);
626 +- if (db_info == debug_area_first)
627 +- debug_area_first = db_info->next;
628 +- if (db_info == debug_area_last)
629 +- debug_area_last = db_info->prev;
630 +- if (db_info->prev)
631 +- db_info->prev->next = db_info->next;
632 +- if (db_info->next)
633 +- db_info->next->prev = db_info->prev;
634 ++ if (refcount_dec_and_test(&db_info->ref_count))
635 + debug_info_free(db_info);
636 +- }
637 + }
638 +
639 + /*
640 +@@ -632,6 +600,31 @@ static int debug_close(struct inode *inode, struct file *file)
641 + return 0; /* success */
642 + }
643 +
644 ++/* Create debugfs entries and add to internal list. */
645 ++static void _debug_register(debug_info_t *id)
646 ++{
647 ++ /* create root directory */
648 ++ id->debugfs_root_entry = debugfs_create_dir(id->name,
649 ++ debug_debugfs_root_entry);
650 ++
651 ++ /* append new element to linked list */
652 ++ if (!debug_area_first) {
653 ++ /* first element in list */
654 ++ debug_area_first = id;
655 ++ id->prev = NULL;
656 ++ } else {
657 ++ /* append element to end of list */
658 ++ debug_area_last->next = id;
659 ++ id->prev = debug_area_last;
660 ++ }
661 ++ debug_area_last = id;
662 ++ id->next = NULL;
663 ++
664 ++ debug_register_view(id, &debug_level_view);
665 ++ debug_register_view(id, &debug_flush_view);
666 ++ debug_register_view(id, &debug_pages_view);
667 ++}
668 ++
669 + /**
670 + * debug_register_mode() - creates and initializes debug area.
671 + *
672 +@@ -661,19 +654,16 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area,
673 + if ((uid != 0) || (gid != 0))
674 + pr_warn("Root becomes the owner of all s390dbf files in sysfs\n");
675 + BUG_ON(!initialized);
676 +- mutex_lock(&debug_mutex);
677 +
678 + /* create new debug_info */
679 + rc = debug_info_create(name, pages_per_area, nr_areas, buf_size, mode);
680 +- if (!rc)
681 +- goto out;
682 +- debug_register_view(rc, &debug_level_view);
683 +- debug_register_view(rc, &debug_flush_view);
684 +- debug_register_view(rc, &debug_pages_view);
685 +-out:
686 +- if (!rc)
687 ++ if (rc) {
688 ++ mutex_lock(&debug_mutex);
689 ++ _debug_register(rc);
690 ++ mutex_unlock(&debug_mutex);
691 ++ } else {
692 + pr_err("Registering debug feature %s failed\n", name);
693 +- mutex_unlock(&debug_mutex);
694 ++ }
695 + return rc;
696 + }
697 + EXPORT_SYMBOL(debug_register_mode);
698 +@@ -702,6 +692,27 @@ debug_info_t *debug_register(const char *name, int pages_per_area,
699 + }
700 + EXPORT_SYMBOL(debug_register);
701 +
702 ++/* Remove debugfs entries and remove from internal list. */
703 ++static void _debug_unregister(debug_info_t *id)
704 ++{
705 ++ int i;
706 ++
707 ++ for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
708 ++ if (!id->views[i])
709 ++ continue;
710 ++ debugfs_remove(id->debugfs_entries[i]);
711 ++ }
712 ++ debugfs_remove(id->debugfs_root_entry);
713 ++ if (id == debug_area_first)
714 ++ debug_area_first = id->next;
715 ++ if (id == debug_area_last)
716 ++ debug_area_last = id->prev;
717 ++ if (id->prev)
718 ++ id->prev->next = id->next;
719 ++ if (id->next)
720 ++ id->next->prev = id->prev;
721 ++}
722 ++
723 + /**
724 + * debug_unregister() - give back debug area.
725 + *
726 +@@ -715,8 +726,10 @@ void debug_unregister(debug_info_t *id)
727 + if (!id)
728 + return;
729 + mutex_lock(&debug_mutex);
730 +- debug_info_put(id);
731 ++ _debug_unregister(id);
732 + mutex_unlock(&debug_mutex);
733 ++
734 ++ debug_info_put(id);
735 + }
736 + EXPORT_SYMBOL(debug_unregister);
737 +
738 +@@ -726,35 +739,28 @@ EXPORT_SYMBOL(debug_unregister);
739 + */
740 + static int debug_set_size(debug_info_t *id, int nr_areas, int pages_per_area)
741 + {
742 +- debug_entry_t ***new_areas;
743 ++ debug_info_t *new_id;
744 + unsigned long flags;
745 +- int rc = 0;
746 +
747 + if (!id || (nr_areas <= 0) || (pages_per_area < 0))
748 + return -EINVAL;
749 +- if (pages_per_area > 0) {
750 +- new_areas = debug_areas_alloc(pages_per_area, nr_areas);
751 +- if (!new_areas) {
752 +- pr_info("Allocating memory for %i pages failed\n",
753 +- pages_per_area);
754 +- rc = -ENOMEM;
755 +- goto out;
756 +- }
757 +- } else {
758 +- new_areas = NULL;
759 ++
760 ++ new_id = debug_info_alloc("", pages_per_area, nr_areas, id->buf_size,
761 ++ id->level, ALL_AREAS);
762 ++ if (!new_id) {
763 ++ pr_info("Allocating memory for %i pages failed\n",
764 ++ pages_per_area);
765 ++ return -ENOMEM;
766 + }
767 ++
768 + spin_lock_irqsave(&id->lock, flags);
769 +- debug_areas_free(id);
770 +- id->areas = new_areas;
771 +- id->nr_areas = nr_areas;
772 +- id->pages_per_area = pages_per_area;
773 +- id->active_area = 0;
774 +- memset(id->active_entries, 0, sizeof(int)*id->nr_areas);
775 +- memset(id->active_pages, 0, sizeof(int)*id->nr_areas);
776 ++ debug_events_append(new_id, id);
777 ++ debug_areas_swap(new_id, id);
778 ++ debug_info_free(new_id);
779 + spin_unlock_irqrestore(&id->lock, flags);
780 + pr_info("%s: set new size (%i pages)\n", id->name, pages_per_area);
781 +-out:
782 +- return rc;
783 ++
784 ++ return 0;
785 + }
786 +
787 + /**
788 +@@ -821,6 +827,42 @@ static inline debug_entry_t *get_active_entry(debug_info_t *id)
789 + id->active_entries[id->active_area]);
790 + }
791 +
792 ++/* Swap debug areas of a and b. */
793 ++static void debug_areas_swap(debug_info_t *a, debug_info_t *b)
794 ++{
795 ++ swap(a->nr_areas, b->nr_areas);
796 ++ swap(a->pages_per_area, b->pages_per_area);
797 ++ swap(a->areas, b->areas);
798 ++ swap(a->active_area, b->active_area);
799 ++ swap(a->active_pages, b->active_pages);
800 ++ swap(a->active_entries, b->active_entries);
801 ++}
802 ++
803 ++/* Append all debug events in active area from source to destination log. */
804 ++static void debug_events_append(debug_info_t *dest, debug_info_t *src)
805 ++{
806 ++ debug_entry_t *from, *to, *last;
807 ++
808 ++ if (!src->areas || !dest->areas)
809 ++ return;
810 ++
811 ++ /* Loop over all entries in src, starting with oldest. */
812 ++ from = get_active_entry(src);
813 ++ last = from;
814 ++ do {
815 ++ if (from->clock != 0LL) {
816 ++ to = get_active_entry(dest);
817 ++ memset(to, 0, dest->entry_size);
818 ++ memcpy(to, from, min(src->entry_size,
819 ++ dest->entry_size));
820 ++ proceed_active_entry(dest);
821 ++ }
822 ++
823 ++ proceed_active_entry(src);
824 ++ from = get_active_entry(src);
825 ++ } while (from != last);
826 ++}
827 ++
828 + /*
829 + * debug_finish_entry:
830 + * - set timestamp, caller address, cpu number etc.
831 +diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
832 +index 2f177298c663b..2bb9996ff09b4 100644
833 +--- a/arch/s390/kvm/interrupt.c
834 ++++ b/arch/s390/kvm/interrupt.c
835 +@@ -419,13 +419,13 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu)
836 + static void __set_cpu_idle(struct kvm_vcpu *vcpu)
837 + {
838 + kvm_s390_set_cpuflags(vcpu, CPUSTAT_WAIT);
839 +- set_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask);
840 ++ set_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
841 + }
842 +
843 + static void __unset_cpu_idle(struct kvm_vcpu *vcpu)
844 + {
845 + kvm_s390_clear_cpuflags(vcpu, CPUSTAT_WAIT);
846 +- clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask);
847 ++ clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
848 + }
849 +
850 + static void __reset_intercept_indicators(struct kvm_vcpu *vcpu)
851 +@@ -3050,18 +3050,18 @@ int kvm_s390_get_irq_state(struct kvm_vcpu *vcpu, __u8 __user *buf, int len)
852 +
853 + static void __airqs_kick_single_vcpu(struct kvm *kvm, u8 deliverable_mask)
854 + {
855 +- int vcpu_id, online_vcpus = atomic_read(&kvm->online_vcpus);
856 ++ int vcpu_idx, online_vcpus = atomic_read(&kvm->online_vcpus);
857 + struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int;
858 + struct kvm_vcpu *vcpu;
859 +
860 +- for_each_set_bit(vcpu_id, kvm->arch.idle_mask, online_vcpus) {
861 +- vcpu = kvm_get_vcpu(kvm, vcpu_id);
862 ++ for_each_set_bit(vcpu_idx, kvm->arch.idle_mask, online_vcpus) {
863 ++ vcpu = kvm_get_vcpu(kvm, vcpu_idx);
864 + if (psw_ioint_disabled(vcpu))
865 + continue;
866 + deliverable_mask &= (u8)(vcpu->arch.sie_block->gcr[6] >> 24);
867 + if (deliverable_mask) {
868 + /* lately kicked but not yet running */
869 +- if (test_and_set_bit(vcpu_id, gi->kicked_mask))
870 ++ if (test_and_set_bit(vcpu_idx, gi->kicked_mask))
871 + return;
872 + kvm_s390_vcpu_wakeup(vcpu);
873 + return;
874 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
875 +index f94b4f78d4dab..7f719b468b440 100644
876 +--- a/arch/s390/kvm/kvm-s390.c
877 ++++ b/arch/s390/kvm/kvm-s390.c
878 +@@ -4015,7 +4015,7 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu)
879 + kvm_s390_patch_guest_per_regs(vcpu);
880 + }
881 +
882 +- clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.gisa_int.kicked_mask);
883 ++ clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.gisa_int.kicked_mask);
884 +
885 + vcpu->arch.sie_block->icptcode = 0;
886 + cpuflags = atomic_read(&vcpu->arch.sie_block->cpuflags);
887 +diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
888 +index 79dcd647b378d..2d134833bca69 100644
889 +--- a/arch/s390/kvm/kvm-s390.h
890 ++++ b/arch/s390/kvm/kvm-s390.h
891 +@@ -79,7 +79,7 @@ static inline int is_vcpu_stopped(struct kvm_vcpu *vcpu)
892 +
893 + static inline int is_vcpu_idle(struct kvm_vcpu *vcpu)
894 + {
895 +- return test_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask);
896 ++ return test_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
897 + }
898 +
899 + static inline int kvm_is_ucontrol(struct kvm *kvm)
900 +diff --git a/arch/s390/mm/kasan_init.c b/arch/s390/mm/kasan_init.c
901 +index 5646b39c728a9..e9a9b7b616bc1 100644
902 +--- a/arch/s390/mm/kasan_init.c
903 ++++ b/arch/s390/mm/kasan_init.c
904 +@@ -108,6 +108,9 @@ static void __init kasan_early_vmemmap_populate(unsigned long address,
905 + sgt_prot &= ~_SEGMENT_ENTRY_NOEXEC;
906 + }
907 +
908 ++ /*
909 ++ * The first 1MB of 1:1 mapping is mapped with 4KB pages
910 ++ */
911 + while (address < end) {
912 + pg_dir = pgd_offset_k(address);
913 + if (pgd_none(*pg_dir)) {
914 +@@ -165,30 +168,26 @@ static void __init kasan_early_vmemmap_populate(unsigned long address,
915 +
916 + pm_dir = pmd_offset(pu_dir, address);
917 + if (pmd_none(*pm_dir)) {
918 +- if (mode == POPULATE_ZERO_SHADOW &&
919 +- IS_ALIGNED(address, PMD_SIZE) &&
920 ++ if (IS_ALIGNED(address, PMD_SIZE) &&
921 + end - address >= PMD_SIZE) {
922 +- pmd_populate(&init_mm, pm_dir,
923 +- kasan_early_shadow_pte);
924 +- address = (address + PMD_SIZE) & PMD_MASK;
925 +- continue;
926 +- }
927 +- /* the first megabyte of 1:1 is mapped with 4k pages */
928 +- if (has_edat && address && end - address >= PMD_SIZE &&
929 +- mode != POPULATE_ZERO_SHADOW) {
930 +- void *page;
931 +-
932 +- if (mode == POPULATE_ONE2ONE) {
933 +- page = (void *)address;
934 +- } else {
935 +- page = kasan_early_alloc_segment();
936 +- memset(page, 0, _SEGMENT_SIZE);
937 ++ if (mode == POPULATE_ZERO_SHADOW) {
938 ++ pmd_populate(&init_mm, pm_dir, kasan_early_shadow_pte);
939 ++ address = (address + PMD_SIZE) & PMD_MASK;
940 ++ continue;
941 ++ } else if (has_edat && address) {
942 ++ void *page;
943 ++
944 ++ if (mode == POPULATE_ONE2ONE) {
945 ++ page = (void *)address;
946 ++ } else {
947 ++ page = kasan_early_alloc_segment();
948 ++ memset(page, 0, _SEGMENT_SIZE);
949 ++ }
950 ++ pmd_val(*pm_dir) = __pa(page) | sgt_prot;
951 ++ address = (address + PMD_SIZE) & PMD_MASK;
952 ++ continue;
953 + }
954 +- pmd_val(*pm_dir) = __pa(page) | sgt_prot;
955 +- address = (address + PMD_SIZE) & PMD_MASK;
956 +- continue;
957 + }
958 +-
959 + pt_dir = kasan_early_pte_alloc();
960 + pmd_populate(&init_mm, pm_dir, pt_dir);
961 + } else if (pmd_large(*pm_dir)) {
962 +diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
963 +index ca1a105e3b5d4..0ddb1fe353dc8 100644
964 +--- a/arch/s390/pci/pci.c
965 ++++ b/arch/s390/pci/pci.c
966 +@@ -659,9 +659,10 @@ int zpci_enable_device(struct zpci_dev *zdev)
967 + {
968 + int rc;
969 +
970 +- rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
971 +- if (rc)
972 ++ if (clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES)) {
973 ++ rc = -EIO;
974 + goto out;
975 ++ }
976 +
977 + rc = zpci_dma_init_device(zdev);
978 + if (rc)
979 +@@ -684,7 +685,7 @@ int zpci_disable_device(struct zpci_dev *zdev)
980 + * The zPCI function may already be disabled by the platform, this is
981 + * detected in clp_disable_fh() which becomes a no-op.
982 + */
983 +- return clp_disable_fh(zdev);
984 ++ return clp_disable_fh(zdev) ? -EIO : 0;
985 + }
986 + EXPORT_SYMBOL_GPL(zpci_disable_device);
987 +
988 +diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
989 +index d3331596ddbe1..0a0e8b8293bef 100644
990 +--- a/arch/s390/pci/pci_clp.c
991 ++++ b/arch/s390/pci/pci_clp.c
992 +@@ -213,15 +213,19 @@ out:
993 + }
994 +
995 + static int clp_refresh_fh(u32 fid);
996 +-/*
997 +- * Enable/Disable a given PCI function and update its function handle if
998 +- * necessary
999 ++/**
1000 ++ * clp_set_pci_fn() - Execute a command on a PCI function
1001 ++ * @zdev: Function that will be affected
1002 ++ * @nr_dma_as: DMA address space number
1003 ++ * @command: The command code to execute
1004 ++ *
1005 ++ * Returns: 0 on success, < 0 for Linux errors (e.g. -ENOMEM), and
1006 ++ * > 0 for non-success platform responses
1007 + */
1008 + static int clp_set_pci_fn(struct zpci_dev *zdev, u8 nr_dma_as, u8 command)
1009 + {
1010 + struct clp_req_rsp_set_pci *rrb;
1011 + int rc, retries = 100;
1012 +- u32 fid = zdev->fid;
1013 +
1014 + rrb = clp_alloc_block(GFP_KERNEL);
1015 + if (!rrb)
1016 +@@ -245,17 +249,16 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u8 nr_dma_as, u8 command)
1017 + }
1018 + } while (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY);
1019 +
1020 +- if (rc || rrb->response.hdr.rsp != CLP_RC_OK) {
1021 +- zpci_err("Set PCI FN:\n");
1022 +- zpci_err_clp(rrb->response.hdr.rsp, rc);
1023 +- }
1024 +-
1025 + if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) {
1026 + zdev->fh = rrb->response.fh;
1027 +- } else if (!rc && rrb->response.hdr.rsp == CLP_RC_SETPCIFN_ALRDY &&
1028 +- rrb->response.fh == 0) {
1029 ++ } else if (!rc && rrb->response.hdr.rsp == CLP_RC_SETPCIFN_ALRDY) {
1030 + /* Function is already in desired state - update handle */
1031 +- rc = clp_refresh_fh(fid);
1032 ++ rc = clp_refresh_fh(zdev->fid);
1033 ++ } else {
1034 ++ zpci_err("Set PCI FN:\n");
1035 ++ zpci_err_clp(rrb->response.hdr.rsp, rc);
1036 ++ if (!rc)
1037 ++ rc = rrb->response.hdr.rsp;
1038 + }
1039 + clp_free_block(rrb);
1040 + return rc;
1041 +@@ -301,17 +304,13 @@ int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as)
1042 +
1043 + rc = clp_set_pci_fn(zdev, nr_dma_as, CLP_SET_ENABLE_PCI_FN);
1044 + zpci_dbg(3, "ena fid:%x, fh:%x, rc:%d\n", zdev->fid, zdev->fh, rc);
1045 +- if (rc)
1046 +- goto out;
1047 +-
1048 +- if (zpci_use_mio(zdev)) {
1049 ++ if (!rc && zpci_use_mio(zdev)) {
1050 + rc = clp_set_pci_fn(zdev, nr_dma_as, CLP_SET_ENABLE_MIO);
1051 + zpci_dbg(3, "ena mio fid:%x, fh:%x, rc:%d\n",
1052 + zdev->fid, zdev->fh, rc);
1053 + if (rc)
1054 + clp_disable_fh(zdev);
1055 + }
1056 +-out:
1057 + return rc;
1058 + }
1059 +
1060 +diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
1061 +index 921f47b9bb247..ccc9ee1971e89 100644
1062 +--- a/arch/x86/events/amd/ibs.c
1063 ++++ b/arch/x86/events/amd/ibs.c
1064 +@@ -571,6 +571,7 @@ static struct perf_ibs perf_ibs_op = {
1065 + .start = perf_ibs_start,
1066 + .stop = perf_ibs_stop,
1067 + .read = perf_ibs_read,
1068 ++ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
1069 + },
1070 + .msr = MSR_AMD64_IBSOPCTL,
1071 + .config_mask = IBS_OP_CONFIG_MASK,
1072 +diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
1073 +index fc25c88c7ff29..9b5ff423e9398 100644
1074 +--- a/arch/x86/include/asm/mce.h
1075 ++++ b/arch/x86/include/asm/mce.h
1076 +@@ -259,6 +259,7 @@ enum mcp_flags {
1077 + MCP_TIMESTAMP = BIT(0), /* log time stamp */
1078 + MCP_UC = BIT(1), /* log uncorrected errors */
1079 + MCP_DONTLOG = BIT(2), /* only clear, don't log */
1080 ++ MCP_QUEUE_LOG = BIT(3), /* only queue to genpool */
1081 + };
1082 + bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
1083 +
1084 +diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
1085 +index b7a27589dfa0b..056d0367864e9 100644
1086 +--- a/arch/x86/kernel/cpu/mce/core.c
1087 ++++ b/arch/x86/kernel/cpu/mce/core.c
1088 +@@ -817,7 +817,10 @@ log_it:
1089 + if (mca_cfg.dont_log_ce && !mce_usable_address(&m))
1090 + goto clear_it;
1091 +
1092 +- mce_log(&m);
1093 ++ if (flags & MCP_QUEUE_LOG)
1094 ++ mce_gen_pool_add(&m);
1095 ++ else
1096 ++ mce_log(&m);
1097 +
1098 + clear_it:
1099 + /*
1100 +@@ -1628,10 +1631,12 @@ static void __mcheck_cpu_init_generic(void)
1101 + m_fl = MCP_DONTLOG;
1102 +
1103 + /*
1104 +- * Log the machine checks left over from the previous reset.
1105 ++ * Log the machine checks left over from the previous reset. Log them
1106 ++ * only, do not start processing them. That will happen in mcheck_late_init()
1107 ++ * when all consumers have been registered on the notifier chain.
1108 + */
1109 + bitmap_fill(all_banks, MAX_NR_BANKS);
1110 +- machine_check_poll(MCP_UC | m_fl, &all_banks);
1111 ++ machine_check_poll(MCP_UC | MCP_QUEUE_LOG | m_fl, &all_banks);
1112 +
1113 + cr4_set_bits(X86_CR4_MCE);
1114 +
1115 +diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
1116 +index 3075624723b27..576f16a505e37 100644
1117 +--- a/arch/x86/kernel/cpu/resctrl/monitor.c
1118 ++++ b/arch/x86/kernel/cpu/resctrl/monitor.c
1119 +@@ -241,6 +241,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read *rr)
1120 + case QOS_L3_MBM_LOCAL_EVENT_ID:
1121 + m = &rr->d->mbm_local[rmid];
1122 + break;
1123 ++ default:
1124 ++ /*
1125 ++ * Code would never reach here because an invalid
1126 ++ * event id would fail the __rmid_read.
1127 ++ */
1128 ++ return RMID_VAL_ERROR;
1129 + }
1130 +
1131 + if (rr->first) {
1132 +diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
1133 +index 5e25d93ec7d08..060d9a906535c 100644
1134 +--- a/arch/x86/kvm/mmu/mmu.c
1135 ++++ b/arch/x86/kvm/mmu/mmu.c
1136 +@@ -267,12 +267,6 @@ static bool check_mmio_spte(struct kvm_vcpu *vcpu, u64 spte)
1137 + static gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
1138 + struct x86_exception *exception)
1139 + {
1140 +- /* Check if guest physical address doesn't exceed guest maximum */
1141 +- if (kvm_vcpu_is_illegal_gpa(vcpu, gpa)) {
1142 +- exception->error_code |= PFERR_RSVD_MASK;
1143 +- return UNMAPPED_GVA;
1144 +- }
1145 +-
1146 + return gpa;
1147 + }
1148 +
1149 +diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
1150 +index e0c7910207c0f..d5f24a2f3e916 100644
1151 +--- a/arch/x86/kvm/vmx/nested.c
1152 ++++ b/arch/x86/kvm/vmx/nested.c
1153 +@@ -2243,12 +2243,11 @@ static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
1154 + ~PIN_BASED_VMX_PREEMPTION_TIMER);
1155 +
1156 + /* Posted interrupts setting is only taken from vmcs12. */
1157 +- if (nested_cpu_has_posted_intr(vmcs12)) {
1158 ++ vmx->nested.pi_pending = false;
1159 ++ if (nested_cpu_has_posted_intr(vmcs12))
1160 + vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv;
1161 +- vmx->nested.pi_pending = false;
1162 +- } else {
1163 ++ else
1164 + exec_control &= ~PIN_BASED_POSTED_INTR;
1165 +- }
1166 + pin_controls_set(vmx, exec_control);
1167 +
1168 + /*
1169 +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
1170 +index de24d3826788a..fcd8bcb7e0ea9 100644
1171 +--- a/arch/x86/kvm/vmx/vmx.c
1172 ++++ b/arch/x86/kvm/vmx/vmx.c
1173 +@@ -6396,6 +6396,9 @@ static void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu)
1174 + {
1175 + struct vcpu_vmx *vmx = to_vmx(vcpu);
1176 +
1177 ++ if (vmx->emulation_required)
1178 ++ return;
1179 ++
1180 + if (vmx->exit_reason.basic == EXIT_REASON_EXTERNAL_INTERRUPT)
1181 + handle_external_interrupt_irqoff(vcpu);
1182 + else if (vmx->exit_reason.basic == EXIT_REASON_EXCEPTION_NMI)
1183 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
1184 +index 812585986bb82..75c59ad27e9fd 100644
1185 +--- a/arch/x86/kvm/x86.c
1186 ++++ b/arch/x86/kvm/x86.c
1187 +@@ -3116,6 +3116,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
1188 + if (!msr_info->host_initiated) {
1189 + s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr;
1190 + adjust_tsc_offset_guest(vcpu, adj);
1191 ++ /* Before back to guest, tsc_timestamp must be adjusted
1192 ++ * as well, otherwise guest's percpu pvclock time could jump.
1193 ++ */
1194 ++ kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
1195 + }
1196 + vcpu->arch.ia32_tsc_adjust_msr = data;
1197 + }
1198 +diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
1199 +index c91dca641eb46..8ea37328ca84e 100644
1200 +--- a/block/bfq-iosched.c
1201 ++++ b/block/bfq-iosched.c
1202 +@@ -2251,6 +2251,9 @@ static int bfq_request_merge(struct request_queue *q, struct request **req,
1203 + __rq = bfq_find_rq_fmerge(bfqd, bio, q);
1204 + if (__rq && elv_bio_merge_ok(__rq, bio)) {
1205 + *req = __rq;
1206 ++
1207 ++ if (blk_discard_mergable(__rq))
1208 ++ return ELEVATOR_DISCARD_MERGE;
1209 + return ELEVATOR_FRONT_MERGE;
1210 + }
1211 +
1212 +diff --git a/block/bio.c b/block/bio.c
1213 +index 9c931df2d9864..0703a208ca248 100644
1214 +--- a/block/bio.c
1215 ++++ b/block/bio.c
1216 +@@ -978,6 +978,14 @@ static int __bio_iov_bvec_add_pages(struct bio *bio, struct iov_iter *iter)
1217 + return 0;
1218 + }
1219 +
1220 ++static void bio_put_pages(struct page **pages, size_t size, size_t off)
1221 ++{
1222 ++ size_t i, nr = DIV_ROUND_UP(size + (off & ~PAGE_MASK), PAGE_SIZE);
1223 ++
1224 ++ for (i = 0; i < nr; i++)
1225 ++ put_page(pages[i]);
1226 ++}
1227 ++
1228 + #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *))
1229 +
1230 + /**
1231 +@@ -1022,8 +1030,10 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
1232 + if (same_page)
1233 + put_page(page);
1234 + } else {
1235 +- if (WARN_ON_ONCE(bio_full(bio, len)))
1236 +- return -EINVAL;
1237 ++ if (WARN_ON_ONCE(bio_full(bio, len))) {
1238 ++ bio_put_pages(pages + i, left, offset);
1239 ++ return -EINVAL;
1240 ++ }
1241 + __bio_add_page(bio, page, len, offset);
1242 + }
1243 + offset = 0;
1244 +@@ -1068,6 +1078,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
1245 + len = min_t(size_t, PAGE_SIZE - offset, left);
1246 + if (bio_add_hw_page(q, bio, page, len, offset,
1247 + max_append_sectors, &same_page) != len) {
1248 ++ bio_put_pages(pages + i, left, offset);
1249 + ret = -EINVAL;
1250 + break;
1251 + }
1252 +diff --git a/block/blk-crypto.c b/block/blk-crypto.c
1253 +index 5da43f0973b46..5ffa9aab49de0 100644
1254 +--- a/block/blk-crypto.c
1255 ++++ b/block/blk-crypto.c
1256 +@@ -332,7 +332,7 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key, const u8 *raw_key,
1257 + if (mode->keysize == 0)
1258 + return -EINVAL;
1259 +
1260 +- if (dun_bytes == 0 || dun_bytes > BLK_CRYPTO_MAX_IV_SIZE)
1261 ++ if (dun_bytes == 0 || dun_bytes > mode->ivsize)
1262 + return -EINVAL;
1263 +
1264 + if (!is_power_of_2(data_unit_size))
1265 +diff --git a/block/blk-merge.c b/block/blk-merge.c
1266 +index 349cd7d3af815..26f4bcc10de9d 100644
1267 +--- a/block/blk-merge.c
1268 ++++ b/block/blk-merge.c
1269 +@@ -341,6 +341,8 @@ void __blk_queue_split(struct bio **bio, unsigned int *nr_segs)
1270 + trace_block_split(q, split, (*bio)->bi_iter.bi_sector);
1271 + submit_bio_noacct(*bio);
1272 + *bio = split;
1273 ++
1274 ++ blk_throtl_charge_bio_split(*bio);
1275 + }
1276 + }
1277 +
1278 +@@ -700,22 +702,6 @@ static void blk_account_io_merge_request(struct request *req)
1279 + }
1280 + }
1281 +
1282 +-/*
1283 +- * Two cases of handling DISCARD merge:
1284 +- * If max_discard_segments > 1, the driver takes every bio
1285 +- * as a range and send them to controller together. The ranges
1286 +- * needn't to be contiguous.
1287 +- * Otherwise, the bios/requests will be handled as same as
1288 +- * others which should be contiguous.
1289 +- */
1290 +-static inline bool blk_discard_mergable(struct request *req)
1291 +-{
1292 +- if (req_op(req) == REQ_OP_DISCARD &&
1293 +- queue_max_discard_segments(req->q) > 1)
1294 +- return true;
1295 +- return false;
1296 +-}
1297 +-
1298 + static enum elv_merge blk_try_req_merge(struct request *req,
1299 + struct request *next)
1300 + {
1301 +diff --git a/block/blk-throttle.c b/block/blk-throttle.c
1302 +index b771c42999827..63e9d00a08321 100644
1303 +--- a/block/blk-throttle.c
1304 ++++ b/block/blk-throttle.c
1305 +@@ -178,6 +178,9 @@ struct throtl_grp {
1306 + unsigned int bad_bio_cnt; /* bios exceeding latency threshold */
1307 + unsigned long bio_cnt_reset_time;
1308 +
1309 ++ atomic_t io_split_cnt[2];
1310 ++ atomic_t last_io_split_cnt[2];
1311 ++
1312 + struct blkg_rwstat stat_bytes;
1313 + struct blkg_rwstat stat_ios;
1314 + };
1315 +@@ -771,6 +774,8 @@ static inline void throtl_start_new_slice_with_credit(struct throtl_grp *tg,
1316 + tg->bytes_disp[rw] = 0;
1317 + tg->io_disp[rw] = 0;
1318 +
1319 ++ atomic_set(&tg->io_split_cnt[rw], 0);
1320 ++
1321 + /*
1322 + * Previous slice has expired. We must have trimmed it after last
1323 + * bio dispatch. That means since start of last slice, we never used
1324 +@@ -793,6 +798,9 @@ static inline void throtl_start_new_slice(struct throtl_grp *tg, bool rw)
1325 + tg->io_disp[rw] = 0;
1326 + tg->slice_start[rw] = jiffies;
1327 + tg->slice_end[rw] = jiffies + tg->td->throtl_slice;
1328 ++
1329 ++ atomic_set(&tg->io_split_cnt[rw], 0);
1330 ++
1331 + throtl_log(&tg->service_queue,
1332 + "[%c] new slice start=%lu end=%lu jiffies=%lu",
1333 + rw == READ ? 'R' : 'W', tg->slice_start[rw],
1334 +@@ -1025,6 +1033,9 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio,
1335 + jiffies + tg->td->throtl_slice);
1336 + }
1337 +
1338 ++ if (iops_limit != UINT_MAX)
1339 ++ tg->io_disp[rw] += atomic_xchg(&tg->io_split_cnt[rw], 0);
1340 ++
1341 + if (tg_with_in_bps_limit(tg, bio, bps_limit, &bps_wait) &&
1342 + tg_with_in_iops_limit(tg, bio, iops_limit, &iops_wait)) {
1343 + if (wait)
1344 +@@ -2046,12 +2057,14 @@ static void throtl_downgrade_check(struct throtl_grp *tg)
1345 + }
1346 +
1347 + if (tg->iops[READ][LIMIT_LOW]) {
1348 ++ tg->last_io_disp[READ] += atomic_xchg(&tg->last_io_split_cnt[READ], 0);
1349 + iops = tg->last_io_disp[READ] * HZ / elapsed_time;
1350 + if (iops >= tg->iops[READ][LIMIT_LOW])
1351 + tg->last_low_overflow_time[READ] = now;
1352 + }
1353 +
1354 + if (tg->iops[WRITE][LIMIT_LOW]) {
1355 ++ tg->last_io_disp[WRITE] += atomic_xchg(&tg->last_io_split_cnt[WRITE], 0);
1356 + iops = tg->last_io_disp[WRITE] * HZ / elapsed_time;
1357 + if (iops >= tg->iops[WRITE][LIMIT_LOW])
1358 + tg->last_low_overflow_time[WRITE] = now;
1359 +@@ -2170,6 +2183,25 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td)
1360 + }
1361 + #endif
1362 +
1363 ++void blk_throtl_charge_bio_split(struct bio *bio)
1364 ++{
1365 ++ struct blkcg_gq *blkg = bio->bi_blkg;
1366 ++ struct throtl_grp *parent = blkg_to_tg(blkg);
1367 ++ struct throtl_service_queue *parent_sq;
1368 ++ bool rw = bio_data_dir(bio);
1369 ++
1370 ++ do {
1371 ++ if (!parent->has_rules[rw])
1372 ++ break;
1373 ++
1374 ++ atomic_inc(&parent->io_split_cnt[rw]);
1375 ++ atomic_inc(&parent->last_io_split_cnt[rw]);
1376 ++
1377 ++ parent_sq = parent->service_queue.parent_sq;
1378 ++ parent = sq_to_tg(parent_sq);
1379 ++ } while (parent);
1380 ++}
1381 ++
1382 + bool blk_throtl_bio(struct bio *bio)
1383 + {
1384 + struct request_queue *q = bio->bi_disk->queue;
1385 +diff --git a/block/blk.h b/block/blk.h
1386 +index ecfd523c68d00..f84c83300f6fa 100644
1387 +--- a/block/blk.h
1388 ++++ b/block/blk.h
1389 +@@ -299,11 +299,13 @@ int create_task_io_context(struct task_struct *task, gfp_t gfp_mask, int node);
1390 + extern int blk_throtl_init(struct request_queue *q);
1391 + extern void blk_throtl_exit(struct request_queue *q);
1392 + extern void blk_throtl_register_queue(struct request_queue *q);
1393 ++extern void blk_throtl_charge_bio_split(struct bio *bio);
1394 + bool blk_throtl_bio(struct bio *bio);
1395 + #else /* CONFIG_BLK_DEV_THROTTLING */
1396 + static inline int blk_throtl_init(struct request_queue *q) { return 0; }
1397 + static inline void blk_throtl_exit(struct request_queue *q) { }
1398 + static inline void blk_throtl_register_queue(struct request_queue *q) { }
1399 ++static inline void blk_throtl_charge_bio_split(struct bio *bio) { }
1400 + static inline bool blk_throtl_bio(struct bio *bio) { return false; }
1401 + #endif /* CONFIG_BLK_DEV_THROTTLING */
1402 + #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
1403 +diff --git a/block/elevator.c b/block/elevator.c
1404 +index 293c5c81397a1..2a525863d4e92 100644
1405 +--- a/block/elevator.c
1406 ++++ b/block/elevator.c
1407 +@@ -336,6 +336,9 @@ enum elv_merge elv_merge(struct request_queue *q, struct request **req,
1408 + __rq = elv_rqhash_find(q, bio->bi_iter.bi_sector);
1409 + if (__rq && elv_bio_merge_ok(__rq, bio)) {
1410 + *req = __rq;
1411 ++
1412 ++ if (blk_discard_mergable(__rq))
1413 ++ return ELEVATOR_DISCARD_MERGE;
1414 + return ELEVATOR_BACK_MERGE;
1415 + }
1416 +
1417 +diff --git a/block/mq-deadline.c b/block/mq-deadline.c
1418 +index 2b9635d0dcba8..e4e90761eab35 100644
1419 +--- a/block/mq-deadline.c
1420 ++++ b/block/mq-deadline.c
1421 +@@ -454,6 +454,8 @@ static int dd_request_merge(struct request_queue *q, struct request **rq,
1422 +
1423 + if (elv_bio_merge_ok(__rq, bio)) {
1424 + *rq = __rq;
1425 ++ if (blk_discard_mergable(__rq))
1426 ++ return ELEVATOR_DISCARD_MERGE;
1427 + return ELEVATOR_FRONT_MERGE;
1428 + }
1429 + }
1430 +diff --git a/certs/Makefile b/certs/Makefile
1431 +index b6db52ebf0beb..b338799c0b242 100644
1432 +--- a/certs/Makefile
1433 ++++ b/certs/Makefile
1434 +@@ -47,11 +47,19 @@ endif
1435 + redirect_openssl = 2>&1
1436 + quiet_redirect_openssl = 2>&1
1437 + silent_redirect_openssl = 2>/dev/null
1438 ++openssl_available = $(shell openssl help 2>/dev/null && echo yes)
1439 +
1440 + # We do it this way rather than having a boolean option for enabling an
1441 + # external private key, because 'make randconfig' might enable such a
1442 + # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
1443 + ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
1444 ++
1445 ++ifeq ($(openssl_available),yes)
1446 ++X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null)
1447 ++
1448 ++$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem"))
1449 ++endif
1450 ++
1451 + $(obj)/signing_key.pem: $(obj)/x509.genkey
1452 + @$(kecho) "###"
1453 + @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
1454 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
1455 +index 61c762961ca8e..44f434acfce08 100644
1456 +--- a/drivers/ata/libata-core.c
1457 ++++ b/drivers/ata/libata-core.c
1458 +@@ -5573,7 +5573,7 @@ int ata_host_start(struct ata_host *host)
1459 + have_stop = 1;
1460 + }
1461 +
1462 +- if (host->ops->host_stop)
1463 ++ if (host->ops && host->ops->host_stop)
1464 + have_stop = 1;
1465 +
1466 + if (have_stop) {
1467 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
1468 +index 85bb8742f0906..81ad4f867f02d 100644
1469 +--- a/drivers/base/dd.c
1470 ++++ b/drivers/base/dd.c
1471 +@@ -543,7 +543,8 @@ re_probe:
1472 + goto probe_failed;
1473 + }
1474 +
1475 +- if (driver_sysfs_add(dev)) {
1476 ++ ret = driver_sysfs_add(dev);
1477 ++ if (ret) {
1478 + pr_err("%s: driver_sysfs_add(%s) failed\n",
1479 + __func__, dev_name(dev));
1480 + goto probe_failed;
1481 +@@ -565,15 +566,18 @@ re_probe:
1482 + goto probe_failed;
1483 + }
1484 +
1485 +- if (device_add_groups(dev, drv->dev_groups)) {
1486 ++ ret = device_add_groups(dev, drv->dev_groups);
1487 ++ if (ret) {
1488 + dev_err(dev, "device_add_groups() failed\n");
1489 + goto dev_groups_failed;
1490 + }
1491 +
1492 +- if (dev_has_sync_state(dev) &&
1493 +- device_create_file(dev, &dev_attr_state_synced)) {
1494 +- dev_err(dev, "state_synced sysfs add failed\n");
1495 +- goto dev_sysfs_state_synced_failed;
1496 ++ if (dev_has_sync_state(dev)) {
1497 ++ ret = device_create_file(dev, &dev_attr_state_synced);
1498 ++ if (ret) {
1499 ++ dev_err(dev, "state_synced sysfs add failed\n");
1500 ++ goto dev_sysfs_state_synced_failed;
1501 ++ }
1502 + }
1503 +
1504 + if (test_remove) {
1505 +diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
1506 +index a529235e6bfe9..f41e4e4993d37 100644
1507 +--- a/drivers/base/firmware_loader/main.c
1508 ++++ b/drivers/base/firmware_loader/main.c
1509 +@@ -164,7 +164,7 @@ static inline int fw_state_wait(struct fw_priv *fw_priv)
1510 + return __fw_state_wait_common(fw_priv, MAX_SCHEDULE_TIMEOUT);
1511 + }
1512 +
1513 +-static int fw_cache_piggyback_on_request(const char *name);
1514 ++static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv);
1515 +
1516 + static struct fw_priv *__allocate_fw_priv(const char *fw_name,
1517 + struct firmware_cache *fwc,
1518 +@@ -705,10 +705,8 @@ int assign_fw(struct firmware *fw, struct device *device)
1519 + * on request firmware.
1520 + */
1521 + if (!(fw_priv->opt_flags & FW_OPT_NOCACHE) &&
1522 +- fw_priv->fwc->state == FW_LOADER_START_CACHE) {
1523 +- if (fw_cache_piggyback_on_request(fw_priv->fw_name))
1524 +- kref_get(&fw_priv->ref);
1525 +- }
1526 ++ fw_priv->fwc->state == FW_LOADER_START_CACHE)
1527 ++ fw_cache_piggyback_on_request(fw_priv);
1528 +
1529 + /* pass the pages buffer to driver at the last minute */
1530 + fw_set_page_data(fw_priv, fw);
1531 +@@ -1257,11 +1255,11 @@ static int __fw_entry_found(const char *name)
1532 + return 0;
1533 + }
1534 +
1535 +-static int fw_cache_piggyback_on_request(const char *name)
1536 ++static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv)
1537 + {
1538 +- struct firmware_cache *fwc = &fw_cache;
1539 ++ const char *name = fw_priv->fw_name;
1540 ++ struct firmware_cache *fwc = fw_priv->fwc;
1541 + struct fw_cache_entry *fce;
1542 +- int ret = 0;
1543 +
1544 + spin_lock(&fwc->name_lock);
1545 + if (__fw_entry_found(name))
1546 +@@ -1269,13 +1267,12 @@ static int fw_cache_piggyback_on_request(const char *name)
1547 +
1548 + fce = alloc_fw_cache_entry(name);
1549 + if (fce) {
1550 +- ret = 1;
1551 + list_add(&fce->list, &fwc->fw_names);
1552 ++ kref_get(&fw_priv->ref);
1553 + pr_debug("%s: fw: %s\n", __func__, name);
1554 + }
1555 + found:
1556 + spin_unlock(&fwc->name_lock);
1557 +- return ret;
1558 + }
1559 +
1560 + static void free_fw_cache_entry(struct fw_cache_entry *fce)
1561 +@@ -1506,9 +1503,8 @@ static inline void unregister_fw_pm_ops(void)
1562 + unregister_pm_notifier(&fw_cache.pm_notify);
1563 + }
1564 + #else
1565 +-static int fw_cache_piggyback_on_request(const char *name)
1566 ++static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv)
1567 + {
1568 +- return 0;
1569 + }
1570 + static inline int register_fw_pm_ops(void)
1571 + {
1572 +diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
1573 +index 5db536ccfcd6b..456a1787e18d0 100644
1574 +--- a/drivers/base/regmap/regmap.c
1575 ++++ b/drivers/base/regmap/regmap.c
1576 +@@ -1652,7 +1652,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
1577 + if (ret) {
1578 + dev_err(map->dev,
1579 + "Error in caching of register: %x ret: %d\n",
1580 +- reg + i, ret);
1581 ++ reg + regmap_get_offset(map, i), ret);
1582 + return ret;
1583 + }
1584 + }
1585 +diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
1586 +index 6535614a7dc13..1df2b5801c3bc 100644
1587 +--- a/drivers/bcma/main.c
1588 ++++ b/drivers/bcma/main.c
1589 +@@ -236,6 +236,7 @@ EXPORT_SYMBOL(bcma_core_irq);
1590 +
1591 + void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
1592 + {
1593 ++ device_initialize(&core->dev);
1594 + core->dev.release = bcma_release_core_dev;
1595 + core->dev.bus = &bcma_bus_type;
1596 + dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
1597 +@@ -277,11 +278,10 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
1598 + {
1599 + int err;
1600 +
1601 +- err = device_register(&core->dev);
1602 ++ err = device_add(&core->dev);
1603 + if (err) {
1604 + bcma_err(bus, "Could not register dev for core 0x%03X\n",
1605 + core->id.id);
1606 +- put_device(&core->dev);
1607 + return;
1608 + }
1609 + core->dev_registered = true;
1610 +@@ -372,7 +372,7 @@ void bcma_unregister_cores(struct bcma_bus *bus)
1611 + /* Now noone uses internally-handled cores, we can free them */
1612 + list_for_each_entry_safe(core, tmp, &bus->cores, list) {
1613 + list_del(&core->list);
1614 +- kfree(core);
1615 ++ put_device(&core->dev);
1616 + }
1617 + }
1618 +
1619 +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
1620 +index 59c452fff8352..98274ba0701d6 100644
1621 +--- a/drivers/block/nbd.c
1622 ++++ b/drivers/block/nbd.c
1623 +@@ -1759,7 +1759,17 @@ static int nbd_dev_add(int index)
1624 + refcount_set(&nbd->refs, 1);
1625 + INIT_LIST_HEAD(&nbd->list);
1626 + disk->major = NBD_MAJOR;
1627 ++
1628 ++ /* Too big first_minor can cause duplicate creation of
1629 ++ * sysfs files/links, since first_minor will be truncated to
1630 ++ * byte in __device_add_disk().
1631 ++ */
1632 + disk->first_minor = index << part_shift;
1633 ++ if (disk->first_minor > 0xff) {
1634 ++ err = -EINVAL;
1635 ++ goto out_free_idr;
1636 ++ }
1637 ++
1638 + disk->fops = &nbd_fops;
1639 + disk->private_data = nbd;
1640 + sprintf(disk->disk_name, "nbd%d", index);
1641 +diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
1642 +index 994385bf37c0c..3ca7528322f53 100644
1643 +--- a/drivers/char/tpm/tpm_ibmvtpm.c
1644 ++++ b/drivers/char/tpm/tpm_ibmvtpm.c
1645 +@@ -106,17 +106,12 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
1646 + {
1647 + struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
1648 + u16 len;
1649 +- int sig;
1650 +
1651 + if (!ibmvtpm->rtce_buf) {
1652 + dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n");
1653 + return 0;
1654 + }
1655 +
1656 +- sig = wait_event_interruptible(ibmvtpm->wq, !ibmvtpm->tpm_processing_cmd);
1657 +- if (sig)
1658 +- return -EINTR;
1659 +-
1660 + len = ibmvtpm->res_len;
1661 +
1662 + if (count < len) {
1663 +@@ -237,7 +232,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
1664 + * set the processing flag before the Hcall, since we may get the
1665 + * result (interrupt) before even being able to check rc.
1666 + */
1667 +- ibmvtpm->tpm_processing_cmd = true;
1668 ++ ibmvtpm->tpm_processing_cmd = 1;
1669 +
1670 + again:
1671 + rc = ibmvtpm_send_crq(ibmvtpm->vdev,
1672 +@@ -255,7 +250,7 @@ again:
1673 + goto again;
1674 + }
1675 + dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
1676 +- ibmvtpm->tpm_processing_cmd = false;
1677 ++ ibmvtpm->tpm_processing_cmd = 0;
1678 + }
1679 +
1680 + spin_unlock(&ibmvtpm->rtce_lock);
1681 +@@ -269,7 +264,9 @@ static void tpm_ibmvtpm_cancel(struct tpm_chip *chip)
1682 +
1683 + static u8 tpm_ibmvtpm_status(struct tpm_chip *chip)
1684 + {
1685 +- return 0;
1686 ++ struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
1687 ++
1688 ++ return ibmvtpm->tpm_processing_cmd;
1689 + }
1690 +
1691 + /**
1692 +@@ -459,7 +456,7 @@ static const struct tpm_class_ops tpm_ibmvtpm = {
1693 + .send = tpm_ibmvtpm_send,
1694 + .cancel = tpm_ibmvtpm_cancel,
1695 + .status = tpm_ibmvtpm_status,
1696 +- .req_complete_mask = 0,
1697 ++ .req_complete_mask = 1,
1698 + .req_complete_val = 0,
1699 + .req_canceled = tpm_ibmvtpm_req_canceled,
1700 + };
1701 +@@ -552,7 +549,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
1702 + case VTPM_TPM_COMMAND_RES:
1703 + /* len of the data in rtce buffer */
1704 + ibmvtpm->res_len = be16_to_cpu(crq->len);
1705 +- ibmvtpm->tpm_processing_cmd = false;
1706 ++ ibmvtpm->tpm_processing_cmd = 0;
1707 + wake_up_interruptible(&ibmvtpm->wq);
1708 + return;
1709 + default:
1710 +@@ -690,8 +687,15 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
1711 + goto init_irq_cleanup;
1712 + }
1713 +
1714 +- if (!strcmp(id->compat, "IBM,vtpm20")) {
1715 ++
1716 ++ if (!strcmp(id->compat, "IBM,vtpm20"))
1717 + chip->flags |= TPM_CHIP_FLAG_TPM2;
1718 ++
1719 ++ rc = tpm_get_timeouts(chip);
1720 ++ if (rc)
1721 ++ goto init_irq_cleanup;
1722 ++
1723 ++ if (chip->flags & TPM_CHIP_FLAG_TPM2) {
1724 + rc = tpm2_get_cc_attrs_tbl(chip);
1725 + if (rc)
1726 + goto init_irq_cleanup;
1727 +diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h
1728 +index b92aa7d3e93e7..51198b137461e 100644
1729 +--- a/drivers/char/tpm/tpm_ibmvtpm.h
1730 ++++ b/drivers/char/tpm/tpm_ibmvtpm.h
1731 +@@ -41,7 +41,7 @@ struct ibmvtpm_dev {
1732 + wait_queue_head_t wq;
1733 + u16 res_len;
1734 + u32 vtpm_version;
1735 +- bool tpm_processing_cmd;
1736 ++ u8 tpm_processing_cmd;
1737 + };
1738 +
1739 + #define CRQ_RES_BUF_SIZE PAGE_SIZE
1740 +diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c
1741 +index 47680237d0beb..8bc893df47364 100644
1742 +--- a/drivers/clk/mvebu/kirkwood.c
1743 ++++ b/drivers/clk/mvebu/kirkwood.c
1744 +@@ -265,6 +265,7 @@ static const char *powersave_parents[] = {
1745 + static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = {
1746 + { "powersave", powersave_parents, ARRAY_SIZE(powersave_parents),
1747 + 11, 1, 0 },
1748 ++ { }
1749 + };
1750 +
1751 + static struct clk *clk_muxing_get_src(
1752 +diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
1753 +index 760777458a909..2acfcc966bb54 100644
1754 +--- a/drivers/clocksource/sh_cmt.c
1755 ++++ b/drivers/clocksource/sh_cmt.c
1756 +@@ -572,7 +572,8 @@ static int sh_cmt_start(struct sh_cmt_channel *ch, unsigned long flag)
1757 + ch->flags |= flag;
1758 +
1759 + /* setup timeout if no clockevent */
1760 +- if ((flag == FLAG_CLOCKSOURCE) && (!(ch->flags & FLAG_CLOCKEVENT)))
1761 ++ if (ch->cmt->num_channels == 1 &&
1762 ++ flag == FLAG_CLOCKSOURCE && (!(ch->flags & FLAG_CLOCKEVENT)))
1763 + __sh_cmt_set_next(ch, ch->max_match_value);
1764 + out:
1765 + raw_spin_unlock_irqrestore(&ch->lock, flags);
1766 +@@ -608,20 +609,25 @@ static struct sh_cmt_channel *cs_to_sh_cmt(struct clocksource *cs)
1767 + static u64 sh_cmt_clocksource_read(struct clocksource *cs)
1768 + {
1769 + struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
1770 +- unsigned long flags;
1771 + u32 has_wrapped;
1772 +- u64 value;
1773 +- u32 raw;
1774 +
1775 +- raw_spin_lock_irqsave(&ch->lock, flags);
1776 +- value = ch->total_cycles;
1777 +- raw = sh_cmt_get_counter(ch, &has_wrapped);
1778 ++ if (ch->cmt->num_channels == 1) {
1779 ++ unsigned long flags;
1780 ++ u64 value;
1781 ++ u32 raw;
1782 +
1783 +- if (unlikely(has_wrapped))
1784 +- raw += ch->match_value + 1;
1785 +- raw_spin_unlock_irqrestore(&ch->lock, flags);
1786 ++ raw_spin_lock_irqsave(&ch->lock, flags);
1787 ++ value = ch->total_cycles;
1788 ++ raw = sh_cmt_get_counter(ch, &has_wrapped);
1789 ++
1790 ++ if (unlikely(has_wrapped))
1791 ++ raw += ch->match_value + 1;
1792 ++ raw_spin_unlock_irqrestore(&ch->lock, flags);
1793 ++
1794 ++ return value + raw;
1795 ++ }
1796 +
1797 +- return value + raw;
1798 ++ return sh_cmt_get_counter(ch, &has_wrapped);
1799 + }
1800 +
1801 + static int sh_cmt_clocksource_enable(struct clocksource *cs)
1802 +@@ -684,7 +690,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_channel *ch,
1803 + cs->disable = sh_cmt_clocksource_disable;
1804 + cs->suspend = sh_cmt_clocksource_suspend;
1805 + cs->resume = sh_cmt_clocksource_resume;
1806 +- cs->mask = CLOCKSOURCE_MASK(sizeof(u64) * 8);
1807 ++ cs->mask = CLOCKSOURCE_MASK(ch->cmt->info->width);
1808 + cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
1809 +
1810 + dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n",
1811 +diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
1812 +index 78766b6ec271a..21bb2bb767a1e 100644
1813 +--- a/drivers/counter/104-quad-8.c
1814 ++++ b/drivers/counter/104-quad-8.c
1815 +@@ -1224,12 +1224,13 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter,
1816 + case 1:
1817 + case 3:
1818 + quad8_preset_register_set(priv, count->id, ceiling);
1819 +- break;
1820 ++ mutex_unlock(&priv->lock);
1821 ++ return len;
1822 + }
1823 +
1824 + mutex_unlock(&priv->lock);
1825 +
1826 +- return len;
1827 ++ return -EINVAL;
1828 + }
1829 +
1830 + static ssize_t quad8_count_preset_enable_read(struct counter_device *counter,
1831 +diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
1832 +index 909a7eb748e35..7daed8b78ac83 100644
1833 +--- a/drivers/crypto/mxs-dcp.c
1834 ++++ b/drivers/crypto/mxs-dcp.c
1835 +@@ -169,15 +169,19 @@ static struct dcp *global_sdcp;
1836 +
1837 + static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
1838 + {
1839 ++ int dma_err;
1840 + struct dcp *sdcp = global_sdcp;
1841 + const int chan = actx->chan;
1842 + uint32_t stat;
1843 + unsigned long ret;
1844 + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
1845 +-
1846 + dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc),
1847 + DMA_TO_DEVICE);
1848 +
1849 ++ dma_err = dma_mapping_error(sdcp->dev, desc_phys);
1850 ++ if (dma_err)
1851 ++ return dma_err;
1852 ++
1853 + reinit_completion(&sdcp->completion[chan]);
1854 +
1855 + /* Clear status register. */
1856 +@@ -215,18 +219,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
1857 + static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
1858 + struct skcipher_request *req, int init)
1859 + {
1860 ++ dma_addr_t key_phys, src_phys, dst_phys;
1861 + struct dcp *sdcp = global_sdcp;
1862 + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
1863 + struct dcp_aes_req_ctx *rctx = skcipher_request_ctx(req);
1864 + int ret;
1865 +
1866 +- dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
1867 +- 2 * AES_KEYSIZE_128,
1868 +- DMA_TO_DEVICE);
1869 +- dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
1870 +- DCP_BUF_SZ, DMA_TO_DEVICE);
1871 +- dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
1872 +- DCP_BUF_SZ, DMA_FROM_DEVICE);
1873 ++ key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
1874 ++ 2 * AES_KEYSIZE_128, DMA_TO_DEVICE);
1875 ++ ret = dma_mapping_error(sdcp->dev, key_phys);
1876 ++ if (ret)
1877 ++ return ret;
1878 ++
1879 ++ src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
1880 ++ DCP_BUF_SZ, DMA_TO_DEVICE);
1881 ++ ret = dma_mapping_error(sdcp->dev, src_phys);
1882 ++ if (ret)
1883 ++ goto err_src;
1884 ++
1885 ++ dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
1886 ++ DCP_BUF_SZ, DMA_FROM_DEVICE);
1887 ++ ret = dma_mapping_error(sdcp->dev, dst_phys);
1888 ++ if (ret)
1889 ++ goto err_dst;
1890 +
1891 + if (actx->fill % AES_BLOCK_SIZE) {
1892 + dev_err(sdcp->dev, "Invalid block size!\n");
1893 +@@ -264,10 +279,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
1894 + ret = mxs_dcp_start_dma(actx);
1895 +
1896 + aes_done_run:
1897 ++ dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
1898 ++err_dst:
1899 ++ dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
1900 ++err_src:
1901 + dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128,
1902 + DMA_TO_DEVICE);
1903 +- dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
1904 +- dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
1905 +
1906 + return ret;
1907 + }
1908 +@@ -556,6 +573,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
1909 + dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
1910 + DCP_BUF_SZ, DMA_TO_DEVICE);
1911 +
1912 ++ ret = dma_mapping_error(sdcp->dev, buf_phys);
1913 ++ if (ret)
1914 ++ return ret;
1915 ++
1916 + /* Fill in the DMA descriptor. */
1917 + desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
1918 + MXS_DCP_CONTROL0_INTERRUPT |
1919 +@@ -588,6 +609,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
1920 + if (rctx->fini) {
1921 + digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf,
1922 + DCP_SHA_PAY_SZ, DMA_FROM_DEVICE);
1923 ++ ret = dma_mapping_error(sdcp->dev, digest_phys);
1924 ++ if (ret)
1925 ++ goto done_run;
1926 ++
1927 + desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
1928 + desc->payload = digest_phys;
1929 + }
1930 +diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
1931 +index 0dd4c6b157de9..9b968ac4ee7b6 100644
1932 +--- a/drivers/crypto/omap-aes.c
1933 ++++ b/drivers/crypto/omap-aes.c
1934 +@@ -1175,9 +1175,9 @@ static int omap_aes_probe(struct platform_device *pdev)
1935 + spin_lock_init(&dd->lock);
1936 +
1937 + INIT_LIST_HEAD(&dd->list);
1938 +- spin_lock(&list_lock);
1939 ++ spin_lock_bh(&list_lock);
1940 + list_add_tail(&dd->list, &dev_list);
1941 +- spin_unlock(&list_lock);
1942 ++ spin_unlock_bh(&list_lock);
1943 +
1944 + /* Initialize crypto engine */
1945 + dd->engine = crypto_engine_alloc_init(dev, 1);
1946 +@@ -1264,9 +1264,9 @@ static int omap_aes_remove(struct platform_device *pdev)
1947 + if (!dd)
1948 + return -ENODEV;
1949 +
1950 +- spin_lock(&list_lock);
1951 ++ spin_lock_bh(&list_lock);
1952 + list_del(&dd->list);
1953 +- spin_unlock(&list_lock);
1954 ++ spin_unlock_bh(&list_lock);
1955 +
1956 + for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
1957 + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) {
1958 +diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
1959 +index c9d38bcfd1c77..7fdf38e07adf8 100644
1960 +--- a/drivers/crypto/omap-des.c
1961 ++++ b/drivers/crypto/omap-des.c
1962 +@@ -1035,9 +1035,9 @@ static int omap_des_probe(struct platform_device *pdev)
1963 +
1964 +
1965 + INIT_LIST_HEAD(&dd->list);
1966 +- spin_lock(&list_lock);
1967 ++ spin_lock_bh(&list_lock);
1968 + list_add_tail(&dd->list, &dev_list);
1969 +- spin_unlock(&list_lock);
1970 ++ spin_unlock_bh(&list_lock);
1971 +
1972 + /* Initialize des crypto engine */
1973 + dd->engine = crypto_engine_alloc_init(dev, 1);
1974 +@@ -1096,9 +1096,9 @@ static int omap_des_remove(struct platform_device *pdev)
1975 + if (!dd)
1976 + return -ENODEV;
1977 +
1978 +- spin_lock(&list_lock);
1979 ++ spin_lock_bh(&list_lock);
1980 + list_del(&dd->list);
1981 +- spin_unlock(&list_lock);
1982 ++ spin_unlock_bh(&list_lock);
1983 +
1984 + for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
1985 + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--)
1986 +diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
1987 +index 39d17ed1db2f2..48f78e34cf8dd 100644
1988 +--- a/drivers/crypto/omap-sham.c
1989 ++++ b/drivers/crypto/omap-sham.c
1990 +@@ -1735,7 +1735,7 @@ static void omap_sham_done_task(unsigned long data)
1991 + if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags))
1992 + goto finish;
1993 + } else if (test_bit(FLAGS_DMA_READY, &dd->flags)) {
1994 +- if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
1995 ++ if (test_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
1996 + omap_sham_update_dma_stop(dd);
1997 + if (dd->err) {
1998 + err = dd->err;
1999 +@@ -2143,9 +2143,9 @@ static int omap_sham_probe(struct platform_device *pdev)
2000 + (rev & dd->pdata->major_mask) >> dd->pdata->major_shift,
2001 + (rev & dd->pdata->minor_mask) >> dd->pdata->minor_shift);
2002 +
2003 +- spin_lock(&sham.lock);
2004 ++ spin_lock_bh(&sham.lock);
2005 + list_add_tail(&dd->list, &sham.dev_list);
2006 +- spin_unlock(&sham.lock);
2007 ++ spin_unlock_bh(&sham.lock);
2008 +
2009 + dd->engine = crypto_engine_alloc_init(dev, 1);
2010 + if (!dd->engine) {
2011 +@@ -2193,9 +2193,9 @@ err_algs:
2012 + err_engine_start:
2013 + crypto_engine_exit(dd->engine);
2014 + err_engine:
2015 +- spin_lock(&sham.lock);
2016 ++ spin_lock_bh(&sham.lock);
2017 + list_del(&dd->list);
2018 +- spin_unlock(&sham.lock);
2019 ++ spin_unlock_bh(&sham.lock);
2020 + err_pm:
2021 + pm_runtime_disable(dev);
2022 + if (!dd->polling_mode)
2023 +@@ -2214,9 +2214,9 @@ static int omap_sham_remove(struct platform_device *pdev)
2024 + dd = platform_get_drvdata(pdev);
2025 + if (!dd)
2026 + return -ENODEV;
2027 +- spin_lock(&sham.lock);
2028 ++ spin_lock_bh(&sham.lock);
2029 + list_del(&dd->list);
2030 +- spin_unlock(&sham.lock);
2031 ++ spin_unlock_bh(&sham.lock);
2032 + for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
2033 + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) {
2034 + crypto_unregister_ahash(
2035 +diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
2036 +index d2fedbd7113cb..9709f29b64540 100644
2037 +--- a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
2038 ++++ b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
2039 +@@ -79,10 +79,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)
2040 + hw_data->enable_error_correction = adf_vf_void_noop;
2041 + hw_data->init_admin_comms = adf_vf_int_noop;
2042 + hw_data->exit_admin_comms = adf_vf_void_noop;
2043 +- hw_data->send_admin_init = adf_vf2pf_init;
2044 ++ hw_data->send_admin_init = adf_vf2pf_notify_init;
2045 + hw_data->init_arb = adf_vf_int_noop;
2046 + hw_data->exit_arb = adf_vf_void_noop;
2047 +- hw_data->disable_iov = adf_vf2pf_shutdown;
2048 ++ hw_data->disable_iov = adf_vf2pf_notify_shutdown;
2049 + hw_data->get_accel_mask = get_accel_mask;
2050 + hw_data->get_ae_mask = get_ae_mask;
2051 + hw_data->get_num_accels = get_num_accels;
2052 +diff --git a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
2053 +index 29fd3f1091abc..5e6909d6cfc65 100644
2054 +--- a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
2055 ++++ b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
2056 +@@ -79,10 +79,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data)
2057 + hw_data->enable_error_correction = adf_vf_void_noop;
2058 + hw_data->init_admin_comms = adf_vf_int_noop;
2059 + hw_data->exit_admin_comms = adf_vf_void_noop;
2060 +- hw_data->send_admin_init = adf_vf2pf_init;
2061 ++ hw_data->send_admin_init = adf_vf2pf_notify_init;
2062 + hw_data->init_arb = adf_vf_int_noop;
2063 + hw_data->exit_arb = adf_vf_void_noop;
2064 +- hw_data->disable_iov = adf_vf2pf_shutdown;
2065 ++ hw_data->disable_iov = adf_vf2pf_notify_shutdown;
2066 + hw_data->get_accel_mask = get_accel_mask;
2067 + hw_data->get_ae_mask = get_ae_mask;
2068 + hw_data->get_num_accels = get_num_accels;
2069 +diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h
2070 +index f22342f612c1d..469e06c93fafe 100644
2071 +--- a/drivers/crypto/qat/qat_common/adf_common_drv.h
2072 ++++ b/drivers/crypto/qat/qat_common/adf_common_drv.h
2073 +@@ -195,8 +195,8 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,
2074 + void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
2075 + void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
2076 +
2077 +-int adf_vf2pf_init(struct adf_accel_dev *accel_dev);
2078 +-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev);
2079 ++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev);
2080 ++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev);
2081 + int adf_init_pf_wq(void);
2082 + void adf_exit_pf_wq(void);
2083 + int adf_init_vf_wq(void);
2084 +@@ -219,12 +219,12 @@ static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)
2085 + {
2086 + }
2087 +
2088 +-static inline int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
2089 ++static inline int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev)
2090 + {
2091 + return 0;
2092 + }
2093 +
2094 +-static inline void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
2095 ++static inline void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev)
2096 + {
2097 + }
2098 +
2099 +diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c
2100 +index 42029153408ee..5c78433d19d42 100644
2101 +--- a/drivers/crypto/qat/qat_common/adf_init.c
2102 ++++ b/drivers/crypto/qat/qat_common/adf_init.c
2103 +@@ -61,6 +61,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
2104 + struct service_hndl *service;
2105 + struct list_head *list_itr;
2106 + struct adf_hw_device_data *hw_data = accel_dev->hw_device;
2107 ++ int ret;
2108 +
2109 + if (!hw_data) {
2110 + dev_err(&GET_DEV(accel_dev),
2111 +@@ -127,9 +128,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
2112 + }
2113 +
2114 + hw_data->enable_error_correction(accel_dev);
2115 +- hw_data->enable_vf2pf_comms(accel_dev);
2116 ++ ret = hw_data->enable_vf2pf_comms(accel_dev);
2117 +
2118 +- return 0;
2119 ++ return ret;
2120 + }
2121 + EXPORT_SYMBOL_GPL(adf_dev_init);
2122 +
2123 +diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c
2124 +index da6ef007a6aef..de2f137e44ef8 100644
2125 +--- a/drivers/crypto/qat/qat_common/adf_isr.c
2126 ++++ b/drivers/crypto/qat/qat_common/adf_isr.c
2127 +@@ -15,6 +15,8 @@
2128 + #include "adf_transport_access_macros.h"
2129 + #include "adf_transport_internal.h"
2130 +
2131 ++#define ADF_MAX_NUM_VFS 32
2132 ++
2133 + static int adf_enable_msix(struct adf_accel_dev *accel_dev)
2134 + {
2135 + struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
2136 +@@ -67,7 +69,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
2137 + struct adf_bar *pmisc =
2138 + &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
2139 + void __iomem *pmisc_bar_addr = pmisc->virt_addr;
2140 +- u32 vf_mask;
2141 ++ unsigned long vf_mask;
2142 +
2143 + /* Get the interrupt sources triggered by VFs */
2144 + vf_mask = ((ADF_CSR_RD(pmisc_bar_addr, ADF_ERRSOU5) &
2145 +@@ -88,8 +90,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
2146 + * unless the VF is malicious and is attempting to
2147 + * flood the host OS with VF2PF interrupts.
2148 + */
2149 +- for_each_set_bit(i, (const unsigned long *)&vf_mask,
2150 +- (sizeof(vf_mask) * BITS_PER_BYTE)) {
2151 ++ for_each_set_bit(i, &vf_mask, ADF_MAX_NUM_VFS) {
2152 + vf_info = accel_dev->pf.vf_info + i;
2153 +
2154 + if (!__ratelimit(&vf_info->vf2pf_ratelimit)) {
2155 +diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
2156 +index 8b090b7ae8c6b..e829c6aaf16fd 100644
2157 +--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
2158 ++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
2159 +@@ -186,7 +186,6 @@ int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)
2160 +
2161 + return ret;
2162 + }
2163 +-EXPORT_SYMBOL_GPL(adf_iov_putmsg);
2164 +
2165 + void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
2166 + {
2167 +@@ -316,6 +315,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
2168 + msg |= ADF_PFVF_COMPATIBILITY_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
2169 + BUILD_BUG_ON(ADF_PFVF_COMPATIBILITY_VERSION > 255);
2170 +
2171 ++ reinit_completion(&accel_dev->vf.iov_msg_completion);
2172 ++
2173 + /* Send request from VF to PF */
2174 + ret = adf_iov_putmsg(accel_dev, msg, 0);
2175 + if (ret) {
2176 +diff --git a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
2177 +index 2c98fb63f7b72..54b738da829d8 100644
2178 +--- a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
2179 ++++ b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
2180 +@@ -5,14 +5,14 @@
2181 + #include "adf_pf2vf_msg.h"
2182 +
2183 + /**
2184 +- * adf_vf2pf_init() - send init msg to PF
2185 ++ * adf_vf2pf_notify_init() - send init msg to PF
2186 + * @accel_dev: Pointer to acceleration VF device.
2187 + *
2188 + * Function sends an init messge from the VF to a PF
2189 + *
2190 + * Return: 0 on success, error code otherwise.
2191 + */
2192 +-int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
2193 ++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev)
2194 + {
2195 + u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
2196 + (ADF_VF2PF_MSGTYPE_INIT << ADF_VF2PF_MSGTYPE_SHIFT));
2197 +@@ -25,17 +25,17 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
2198 + set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
2199 + return 0;
2200 + }
2201 +-EXPORT_SYMBOL_GPL(adf_vf2pf_init);
2202 ++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init);
2203 +
2204 + /**
2205 +- * adf_vf2pf_shutdown() - send shutdown msg to PF
2206 ++ * adf_vf2pf_notify_shutdown() - send shutdown msg to PF
2207 + * @accel_dev: Pointer to acceleration VF device.
2208 + *
2209 + * Function sends a shutdown messge from the VF to a PF
2210 + *
2211 + * Return: void
2212 + */
2213 +-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
2214 ++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev)
2215 + {
2216 + u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
2217 + (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT));
2218 +@@ -45,4 +45,4 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
2219 + dev_err(&GET_DEV(accel_dev),
2220 + "Failed to send Shutdown event to PF\n");
2221 + }
2222 +-EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown);
2223 ++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_shutdown);
2224 +diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
2225 +index 31a36288623a2..024401ec9d1ae 100644
2226 +--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
2227 ++++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
2228 +@@ -159,6 +159,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)
2229 + struct adf_bar *pmisc =
2230 + &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
2231 + void __iomem *pmisc_bar_addr = pmisc->virt_addr;
2232 ++ bool handled = false;
2233 + u32 v_int;
2234 +
2235 + /* Read VF INT source CSR to determine the source of VF interrupt */
2236 +@@ -171,7 +172,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)
2237 +
2238 + /* Schedule tasklet to handle interrupt BH */
2239 + tasklet_hi_schedule(&accel_dev->vf.pf2vf_bh_tasklet);
2240 +- return IRQ_HANDLED;
2241 ++ handled = true;
2242 + }
2243 +
2244 + /* Check bundle interrupt */
2245 +@@ -183,10 +184,10 @@ static irqreturn_t adf_isr(int irq, void *privdata)
2246 + WRITE_CSR_INT_FLAG_AND_COL(bank->csr_addr, bank->bank_number,
2247 + 0);
2248 + tasklet_hi_schedule(&bank->resp_handler);
2249 +- return IRQ_HANDLED;
2250 ++ handled = true;
2251 + }
2252 +
2253 +- return IRQ_NONE;
2254 ++ return handled ? IRQ_HANDLED : IRQ_NONE;
2255 + }
2256 +
2257 + static int adf_request_msi_irq(struct adf_accel_dev *accel_dev)
2258 +diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c
2259 +index 5246f0524ca34..fc4cf141b1dea 100644
2260 +--- a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c
2261 ++++ b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c
2262 +@@ -79,10 +79,10 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data)
2263 + hw_data->enable_error_correction = adf_vf_void_noop;
2264 + hw_data->init_admin_comms = adf_vf_int_noop;
2265 + hw_data->exit_admin_comms = adf_vf_void_noop;
2266 +- hw_data->send_admin_init = adf_vf2pf_init;
2267 ++ hw_data->send_admin_init = adf_vf2pf_notify_init;
2268 + hw_data->init_arb = adf_vf_int_noop;
2269 + hw_data->exit_arb = adf_vf_void_noop;
2270 +- hw_data->disable_iov = adf_vf2pf_shutdown;
2271 ++ hw_data->disable_iov = adf_vf2pf_notify_shutdown;
2272 + hw_data->get_accel_mask = get_accel_mask;
2273 + hw_data->get_ae_mask = get_ae_mask;
2274 + hw_data->get_num_accels = get_num_accels;
2275 +diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c
2276 +index 4912a7b883801..3a7362f968c9f 100644
2277 +--- a/drivers/edac/i10nm_base.c
2278 ++++ b/drivers/edac/i10nm_base.c
2279 +@@ -26,8 +26,8 @@
2280 + pci_read_config_dword((d)->uracu, 0xd8 + (i) * 4, &(reg))
2281 + #define I10NM_GET_DIMMMTR(m, i, j) \
2282 + readl((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4)
2283 +-#define I10NM_GET_MCDDRTCFG(m, i, j) \
2284 +- readl((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4)
2285 ++#define I10NM_GET_MCDDRTCFG(m, i) \
2286 ++ readl((m)->mbase + 0x20970 + (i) * 0x4000)
2287 + #define I10NM_GET_MCMTR(m, i) \
2288 + readl((m)->mbase + 0x20ef8 + (i) * 0x4000)
2289 +
2290 +@@ -170,10 +170,10 @@ static int i10nm_get_dimm_config(struct mem_ctl_info *mci)
2291 + continue;
2292 +
2293 + ndimms = 0;
2294 ++ mcddrtcfg = I10NM_GET_MCDDRTCFG(imc, i);
2295 + for (j = 0; j < I10NM_NUM_DIMMS; j++) {
2296 + dimm = edac_get_dimm(mci, i, j, 0);
2297 + mtr = I10NM_GET_DIMMMTR(imc, i, j);
2298 +- mcddrtcfg = I10NM_GET_MCDDRTCFG(imc, i, j);
2299 + edac_dbg(1, "dimmmtr 0x%x mcddrtcfg 0x%x (mc%d ch%d dimm%d)\n",
2300 + mtr, mcddrtcfg, imc->mc, i, j);
2301 +
2302 +diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
2303 +index 6c474fbef32af..b6d4ae84a9a5b 100644
2304 +--- a/drivers/edac/mce_amd.c
2305 ++++ b/drivers/edac/mce_amd.c
2306 +@@ -1176,6 +1176,9 @@ static int __init mce_amd_init(void)
2307 + c->x86_vendor != X86_VENDOR_HYGON)
2308 + return -ENODEV;
2309 +
2310 ++ if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
2311 ++ return -ENODEV;
2312 ++
2313 + if (boot_cpu_has(X86_FEATURE_SMCA)) {
2314 + xec_mask = 0x3f;
2315 + goto out;
2316 +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
2317 +index 2371d08bdd17a..1d965c1252cac 100644
2318 +--- a/drivers/firmware/raspberrypi.c
2319 ++++ b/drivers/firmware/raspberrypi.c
2320 +@@ -7,6 +7,7 @@
2321 + */
2322 +
2323 + #include <linux/dma-mapping.h>
2324 ++#include <linux/kref.h>
2325 + #include <linux/mailbox_client.h>
2326 + #include <linux/module.h>
2327 + #include <linux/of_platform.h>
2328 +@@ -27,6 +28,8 @@ struct rpi_firmware {
2329 + struct mbox_chan *chan; /* The property channel. */
2330 + struct completion c;
2331 + u32 enabled;
2332 ++
2333 ++ struct kref consumers;
2334 + };
2335 +
2336 + static DEFINE_MUTEX(transaction_lock);
2337 +@@ -225,12 +228,31 @@ static void rpi_register_clk_driver(struct device *dev)
2338 + -1, NULL, 0);
2339 + }
2340 +
2341 ++static void rpi_firmware_delete(struct kref *kref)
2342 ++{
2343 ++ struct rpi_firmware *fw = container_of(kref, struct rpi_firmware,
2344 ++ consumers);
2345 ++
2346 ++ mbox_free_channel(fw->chan);
2347 ++ kfree(fw);
2348 ++}
2349 ++
2350 ++void rpi_firmware_put(struct rpi_firmware *fw)
2351 ++{
2352 ++ kref_put(&fw->consumers, rpi_firmware_delete);
2353 ++}
2354 ++EXPORT_SYMBOL_GPL(rpi_firmware_put);
2355 ++
2356 + static int rpi_firmware_probe(struct platform_device *pdev)
2357 + {
2358 + struct device *dev = &pdev->dev;
2359 + struct rpi_firmware *fw;
2360 +
2361 +- fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL);
2362 ++ /*
2363 ++ * Memory will be freed by rpi_firmware_delete() once all users have
2364 ++ * released their firmware handles. Don't use devm_kzalloc() here.
2365 ++ */
2366 ++ fw = kzalloc(sizeof(*fw), GFP_KERNEL);
2367 + if (!fw)
2368 + return -ENOMEM;
2369 +
2370 +@@ -247,6 +269,7 @@ static int rpi_firmware_probe(struct platform_device *pdev)
2371 + }
2372 +
2373 + init_completion(&fw->c);
2374 ++ kref_init(&fw->consumers);
2375 +
2376 + platform_set_drvdata(pdev, fw);
2377 +
2378 +@@ -275,7 +298,8 @@ static int rpi_firmware_remove(struct platform_device *pdev)
2379 + rpi_hwmon = NULL;
2380 + platform_device_unregister(rpi_clk);
2381 + rpi_clk = NULL;
2382 +- mbox_free_channel(fw->chan);
2383 ++
2384 ++ rpi_firmware_put(fw);
2385 +
2386 + return 0;
2387 + }
2388 +@@ -284,16 +308,32 @@ static int rpi_firmware_remove(struct platform_device *pdev)
2389 + * rpi_firmware_get - Get pointer to rpi_firmware structure.
2390 + * @firmware_node: Pointer to the firmware Device Tree node.
2391 + *
2392 ++ * The reference to rpi_firmware has to be released with rpi_firmware_put().
2393 ++ *
2394 + * Returns NULL is the firmware device is not ready.
2395 + */
2396 + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node)
2397 + {
2398 + struct platform_device *pdev = of_find_device_by_node(firmware_node);
2399 ++ struct rpi_firmware *fw;
2400 +
2401 + if (!pdev)
2402 + return NULL;
2403 +
2404 +- return platform_get_drvdata(pdev);
2405 ++ fw = platform_get_drvdata(pdev);
2406 ++ if (!fw)
2407 ++ goto err_put_device;
2408 ++
2409 ++ if (!kref_get_unless_zero(&fw->consumers))
2410 ++ goto err_put_device;
2411 ++
2412 ++ put_device(&pdev->dev);
2413 ++
2414 ++ return fw;
2415 ++
2416 ++err_put_device:
2417 ++ put_device(&pdev->dev);
2418 ++ return NULL;
2419 + }
2420 + EXPORT_SYMBOL_GPL(rpi_firmware_get);
2421 +
2422 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
2423 +index d3e51d361179e..eb68b0f1da825 100644
2424 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
2425 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
2426 +@@ -160,17 +160,28 @@ static int acp_poweron(struct generic_pm_domain *genpd)
2427 + return 0;
2428 + }
2429 +
2430 +-static struct device *get_mfd_cell_dev(const char *device_name, int r)
2431 ++static int acp_genpd_add_device(struct device *dev, void *data)
2432 + {
2433 +- char auto_dev_name[25];
2434 +- struct device *dev;
2435 ++ struct generic_pm_domain *gpd = data;
2436 ++ int ret;
2437 +
2438 +- snprintf(auto_dev_name, sizeof(auto_dev_name),
2439 +- "%s.%d.auto", device_name, r);
2440 +- dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name);
2441 +- dev_info(dev, "device %s added to pm domain\n", auto_dev_name);
2442 ++ ret = pm_genpd_add_device(gpd, dev);
2443 ++ if (ret)
2444 ++ dev_err(dev, "Failed to add dev to genpd %d\n", ret);
2445 +
2446 +- return dev;
2447 ++ return ret;
2448 ++}
2449 ++
2450 ++static int acp_genpd_remove_device(struct device *dev, void *data)
2451 ++{
2452 ++ int ret;
2453 ++
2454 ++ ret = pm_genpd_remove_device(dev);
2455 ++ if (ret)
2456 ++ dev_err(dev, "Failed to remove dev from genpd %d\n", ret);
2457 ++
2458 ++ /* Continue to remove */
2459 ++ return 0;
2460 + }
2461 +
2462 + /**
2463 +@@ -181,11 +192,10 @@ static struct device *get_mfd_cell_dev(const char *device_name, int r)
2464 + */
2465 + static int acp_hw_init(void *handle)
2466 + {
2467 +- int r, i;
2468 ++ int r;
2469 + uint64_t acp_base;
2470 + u32 val = 0;
2471 + u32 count = 0;
2472 +- struct device *dev;
2473 + struct i2s_platform_data *i2s_pdata = NULL;
2474 +
2475 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
2476 +@@ -341,15 +351,10 @@ static int acp_hw_init(void *handle)
2477 + if (r)
2478 + goto failure;
2479 +
2480 +- for (i = 0; i < ACP_DEVS ; i++) {
2481 +- dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
2482 +- r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev);
2483 +- if (r) {
2484 +- dev_err(dev, "Failed to add dev to genpd\n");
2485 +- goto failure;
2486 +- }
2487 +- }
2488 +-
2489 ++ r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd,
2490 ++ acp_genpd_add_device);
2491 ++ if (r)
2492 ++ goto failure;
2493 +
2494 + /* Assert Soft reset of ACP */
2495 + val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
2496 +@@ -410,10 +415,8 @@ failure:
2497 + */
2498 + static int acp_hw_fini(void *handle)
2499 + {
2500 +- int i, ret;
2501 + u32 val = 0;
2502 + u32 count = 0;
2503 +- struct device *dev;
2504 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
2505 +
2506 + /* return early if no ACP */
2507 +@@ -458,13 +461,8 @@ static int acp_hw_fini(void *handle)
2508 + udelay(100);
2509 + }
2510 +
2511 +- for (i = 0; i < ACP_DEVS ; i++) {
2512 +- dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
2513 +- ret = pm_genpd_remove_device(dev);
2514 +- /* If removal fails, dont giveup and try rest */
2515 +- if (ret)
2516 +- dev_err(dev, "remove dev from genpd failed\n");
2517 +- }
2518 ++ device_for_each_child(adev->acp.parent, NULL,
2519 ++ acp_genpd_remove_device);
2520 +
2521 + mfd_remove_devices(adev->acp.parent);
2522 + kfree(adev->acp.acp_res);
2523 +diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
2524 +index ca04c34e82518..997b8827fed27 100644
2525 +--- a/drivers/gpu/drm/drm_of.c
2526 ++++ b/drivers/gpu/drm/drm_of.c
2527 +@@ -315,7 +315,7 @@ static int drm_of_lvds_get_remote_pixels_type(
2528 +
2529 + remote_port = of_graph_get_remote_port(endpoint);
2530 + if (!remote_port) {
2531 +- of_node_put(remote_port);
2532 ++ of_node_put(endpoint);
2533 + return -EPIPE;
2534 + }
2535 +
2536 +@@ -331,8 +331,10 @@ static int drm_of_lvds_get_remote_pixels_type(
2537 + * configurations by passing the endpoints explicitly to
2538 + * drm_of_lvds_get_dual_link_pixel_order().
2539 + */
2540 +- if (!current_pt || pixels_type != current_pt)
2541 ++ if (!current_pt || pixels_type != current_pt) {
2542 ++ of_node_put(endpoint);
2543 + return -EINVAL;
2544 ++ }
2545 + }
2546 +
2547 + return pixels_type;
2548 +diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
2549 +index 2828360153d16..30b949d6856c0 100644
2550 +--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
2551 ++++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
2552 +@@ -117,7 +117,7 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder,
2553 + continue;
2554 + }
2555 +
2556 +- if (!connector) {
2557 ++ if (list_entry_is_head(connector, &mode_config->connector_list, head)) {
2558 + DRM_ERROR("Couldn't find connector when setting mode");
2559 + gma_power_end(dev);
2560 + return;
2561 +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
2562 +index 758c355b4fd80..f8c7100a8acb6 100644
2563 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
2564 ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
2565 +@@ -340,10 +340,12 @@ static void dpu_hw_ctl_clear_all_blendstages(struct dpu_hw_ctl *ctx)
2566 + int i;
2567 +
2568 + for (i = 0; i < ctx->mixer_count; i++) {
2569 +- DPU_REG_WRITE(c, CTL_LAYER(LM_0 + i), 0);
2570 +- DPU_REG_WRITE(c, CTL_LAYER_EXT(LM_0 + i), 0);
2571 +- DPU_REG_WRITE(c, CTL_LAYER_EXT2(LM_0 + i), 0);
2572 +- DPU_REG_WRITE(c, CTL_LAYER_EXT3(LM_0 + i), 0);
2573 ++ enum dpu_lm mixer_id = ctx->mixer_hw_caps[i].id;
2574 ++
2575 ++ DPU_REG_WRITE(c, CTL_LAYER(mixer_id), 0);
2576 ++ DPU_REG_WRITE(c, CTL_LAYER_EXT(mixer_id), 0);
2577 ++ DPU_REG_WRITE(c, CTL_LAYER_EXT2(mixer_id), 0);
2578 ++ DPU_REG_WRITE(c, CTL_LAYER_EXT3(mixer_id), 0);
2579 + }
2580 + }
2581 +
2582 +diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
2583 +index 2f75e39052022..c1c152e39918b 100644
2584 +--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
2585 ++++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
2586 +@@ -19,30 +19,12 @@ static int mdp4_hw_init(struct msm_kms *kms)
2587 + {
2588 + struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
2589 + struct drm_device *dev = mdp4_kms->dev;
2590 +- uint32_t version, major, minor, dmap_cfg, vg_cfg;
2591 ++ u32 dmap_cfg, vg_cfg;
2592 + unsigned long clk;
2593 + int ret = 0;
2594 +
2595 + pm_runtime_get_sync(dev->dev);
2596 +
2597 +- mdp4_enable(mdp4_kms);
2598 +- version = mdp4_read(mdp4_kms, REG_MDP4_VERSION);
2599 +- mdp4_disable(mdp4_kms);
2600 +-
2601 +- major = FIELD(version, MDP4_VERSION_MAJOR);
2602 +- minor = FIELD(version, MDP4_VERSION_MINOR);
2603 +-
2604 +- DBG("found MDP4 version v%d.%d", major, minor);
2605 +-
2606 +- if (major != 4) {
2607 +- DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n",
2608 +- major, minor);
2609 +- ret = -ENXIO;
2610 +- goto out;
2611 +- }
2612 +-
2613 +- mdp4_kms->rev = minor;
2614 +-
2615 + if (mdp4_kms->rev > 1) {
2616 + mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER0, 0x0707ffff);
2617 + mdp4_write(mdp4_kms, REG_MDP4_CS_CONTROLLER1, 0x03073f3f);
2618 +@@ -88,7 +70,6 @@ static int mdp4_hw_init(struct msm_kms *kms)
2619 + if (mdp4_kms->rev > 1)
2620 + mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1);
2621 +
2622 +-out:
2623 + pm_runtime_put_sync(dev->dev);
2624 +
2625 + return ret;
2626 +@@ -409,6 +390,22 @@ fail:
2627 + return ret;
2628 + }
2629 +
2630 ++static void read_mdp_hw_revision(struct mdp4_kms *mdp4_kms,
2631 ++ u32 *major, u32 *minor)
2632 ++{
2633 ++ struct drm_device *dev = mdp4_kms->dev;
2634 ++ u32 version;
2635 ++
2636 ++ mdp4_enable(mdp4_kms);
2637 ++ version = mdp4_read(mdp4_kms, REG_MDP4_VERSION);
2638 ++ mdp4_disable(mdp4_kms);
2639 ++
2640 ++ *major = FIELD(version, MDP4_VERSION_MAJOR);
2641 ++ *minor = FIELD(version, MDP4_VERSION_MINOR);
2642 ++
2643 ++ DRM_DEV_INFO(dev->dev, "MDP4 version v%d.%d", *major, *minor);
2644 ++}
2645 ++
2646 + struct msm_kms *mdp4_kms_init(struct drm_device *dev)
2647 + {
2648 + struct platform_device *pdev = to_platform_device(dev->dev);
2649 +@@ -417,6 +414,7 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev)
2650 + struct msm_kms *kms = NULL;
2651 + struct msm_gem_address_space *aspace;
2652 + int irq, ret;
2653 ++ u32 major, minor;
2654 +
2655 + mdp4_kms = kzalloc(sizeof(*mdp4_kms), GFP_KERNEL);
2656 + if (!mdp4_kms) {
2657 +@@ -473,15 +471,6 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev)
2658 + if (IS_ERR(mdp4_kms->pclk))
2659 + mdp4_kms->pclk = NULL;
2660 +
2661 +- if (mdp4_kms->rev >= 2) {
2662 +- mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk");
2663 +- if (IS_ERR(mdp4_kms->lut_clk)) {
2664 +- DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n");
2665 +- ret = PTR_ERR(mdp4_kms->lut_clk);
2666 +- goto fail;
2667 +- }
2668 +- }
2669 +-
2670 + mdp4_kms->axi_clk = devm_clk_get(&pdev->dev, "bus_clk");
2671 + if (IS_ERR(mdp4_kms->axi_clk)) {
2672 + DRM_DEV_ERROR(dev->dev, "failed to get axi_clk\n");
2673 +@@ -490,8 +479,27 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev)
2674 + }
2675 +
2676 + clk_set_rate(mdp4_kms->clk, config->max_clk);
2677 +- if (mdp4_kms->lut_clk)
2678 ++
2679 ++ read_mdp_hw_revision(mdp4_kms, &major, &minor);
2680 ++
2681 ++ if (major != 4) {
2682 ++ DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n",
2683 ++ major, minor);
2684 ++ ret = -ENXIO;
2685 ++ goto fail;
2686 ++ }
2687 ++
2688 ++ mdp4_kms->rev = minor;
2689 ++
2690 ++ if (mdp4_kms->rev >= 2) {
2691 ++ mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk");
2692 ++ if (IS_ERR(mdp4_kms->lut_clk)) {
2693 ++ DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n");
2694 ++ ret = PTR_ERR(mdp4_kms->lut_clk);
2695 ++ goto fail;
2696 ++ }
2697 + clk_set_rate(mdp4_kms->lut_clk, config->max_clk);
2698 ++ }
2699 +
2700 + pm_runtime_enable(dev->dev);
2701 + mdp4_kms->rpm_enabled = true;
2702 +diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
2703 +index 627048851d99c..7e364b9c9f9e1 100644
2704 +--- a/drivers/gpu/drm/msm/dsi/dsi.c
2705 ++++ b/drivers/gpu/drm/msm/dsi/dsi.c
2706 +@@ -26,8 +26,10 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
2707 + }
2708 +
2709 + phy_pdev = of_find_device_by_node(phy_node);
2710 +- if (phy_pdev)
2711 ++ if (phy_pdev) {
2712 + msm_dsi->phy = platform_get_drvdata(phy_pdev);
2713 ++ msm_dsi->phy_dev = &phy_pdev->dev;
2714 ++ }
2715 +
2716 + of_node_put(phy_node);
2717 +
2718 +@@ -36,8 +38,6 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
2719 + return -EPROBE_DEFER;
2720 + }
2721 +
2722 +- msm_dsi->phy_dev = get_device(&phy_pdev->dev);
2723 +-
2724 + return 0;
2725 + }
2726 +
2727 +diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
2728 +index 17f26052e8450..f31e8ef3c258c 100644
2729 +--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
2730 ++++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
2731 +@@ -51,6 +51,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
2732 + .hs_wdth_mask = 0xff,
2733 + .hs_wdth_shift = 24,
2734 + .has_overlay = false,
2735 ++ .has_ctrl2 = false,
2736 + },
2737 + [MXSFB_V4] = {
2738 + .transfer_count = LCDC_V4_TRANSFER_COUNT,
2739 +@@ -59,6 +60,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
2740 + .hs_wdth_mask = 0x3fff,
2741 + .hs_wdth_shift = 18,
2742 + .has_overlay = false,
2743 ++ .has_ctrl2 = true,
2744 + },
2745 + [MXSFB_V6] = {
2746 + .transfer_count = LCDC_V4_TRANSFER_COUNT,
2747 +@@ -67,6 +69,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
2748 + .hs_wdth_mask = 0x3fff,
2749 + .hs_wdth_shift = 18,
2750 + .has_overlay = true,
2751 ++ .has_ctrl2 = true,
2752 + },
2753 + };
2754 +
2755 +diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
2756 +index 399d23e91ed10..7c720e226fdfd 100644
2757 +--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
2758 ++++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
2759 +@@ -22,6 +22,7 @@ struct mxsfb_devdata {
2760 + unsigned int hs_wdth_mask;
2761 + unsigned int hs_wdth_shift;
2762 + bool has_overlay;
2763 ++ bool has_ctrl2;
2764 + };
2765 +
2766 + struct mxsfb_drm_private {
2767 +diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
2768 +index 9e1224d54729f..b535621f4f78d 100644
2769 +--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
2770 ++++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
2771 +@@ -107,6 +107,14 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
2772 + clk_prepare_enable(mxsfb->clk_disp_axi);
2773 + clk_prepare_enable(mxsfb->clk);
2774 +
2775 ++ /* Increase number of outstanding requests on all supported IPs */
2776 ++ if (mxsfb->devdata->has_ctrl2) {
2777 ++ reg = readl(mxsfb->base + LCDC_V4_CTRL2);
2778 ++ reg &= ~CTRL2_SET_OUTSTANDING_REQS_MASK;
2779 ++ reg |= CTRL2_SET_OUTSTANDING_REQS_16;
2780 ++ writel(reg, mxsfb->base + LCDC_V4_CTRL2);
2781 ++ }
2782 ++
2783 + /* If it was disabled, re-enable the mode again */
2784 + writel(CTRL_DOTCLK_MODE, mxsfb->base + LCDC_CTRL + REG_SET);
2785 +
2786 +@@ -115,6 +123,35 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
2787 + reg |= VDCTRL4_SYNC_SIGNALS_ON;
2788 + writel(reg, mxsfb->base + LCDC_VDCTRL4);
2789 +
2790 ++ /*
2791 ++ * Enable recovery on underflow.
2792 ++ *
2793 ++ * There is some sort of corner case behavior of the controller,
2794 ++ * which could rarely be triggered at least on i.MX6SX connected
2795 ++ * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS
2796 ++ * bridged 1920x1080 panel (and likely on other setups too), where
2797 ++ * the image on the panel shifts to the right and wraps around.
2798 ++ * This happens either when the controller is enabled on boot or
2799 ++ * even later during run time. The condition does not correct
2800 ++ * itself automatically, i.e. the display image remains shifted.
2801 ++ *
2802 ++ * It seems this problem is known and is due to sporadic underflows
2803 ++ * of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow
2804 ++ * IRQs, neither of the IRQs trigger and neither IRQ status bit is
2805 ++ * asserted when this condition occurs.
2806 ++ *
2807 ++ * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW
2808 ++ * bit, which is described in the reference manual since i.MX23 as
2809 ++ * "
2810 ++ * Set this bit to enable the LCDIF block to recover in the next
2811 ++ * field/frame if there was an underflow in the current field/frame.
2812 ++ * "
2813 ++ * Enable this bit to mitigate the sporadic underflows.
2814 ++ */
2815 ++ reg = readl(mxsfb->base + LCDC_CTRL1);
2816 ++ reg |= CTRL1_RECOVER_ON_UNDERFLOW;
2817 ++ writel(reg, mxsfb->base + LCDC_CTRL1);
2818 ++
2819 + writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET);
2820 + }
2821 +
2822 +@@ -206,6 +243,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
2823 +
2824 + /* Clear the FIFOs */
2825 + writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
2826 ++ readl(mxsfb->base + LCDC_CTRL1);
2827 ++ writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_CLR);
2828 ++ readl(mxsfb->base + LCDC_CTRL1);
2829 +
2830 + if (mxsfb->devdata->has_overlay)
2831 + writel(0, mxsfb->base + LCDC_AS_CTRL);
2832 +diff --git a/drivers/gpu/drm/mxsfb/mxsfb_regs.h b/drivers/gpu/drm/mxsfb/mxsfb_regs.h
2833 +index 55d28a27f9124..694fea13e893e 100644
2834 +--- a/drivers/gpu/drm/mxsfb/mxsfb_regs.h
2835 ++++ b/drivers/gpu/drm/mxsfb/mxsfb_regs.h
2836 +@@ -15,6 +15,7 @@
2837 + #define LCDC_CTRL 0x00
2838 + #define LCDC_CTRL1 0x10
2839 + #define LCDC_V3_TRANSFER_COUNT 0x20
2840 ++#define LCDC_V4_CTRL2 0x20
2841 + #define LCDC_V4_TRANSFER_COUNT 0x30
2842 + #define LCDC_V4_CUR_BUF 0x40
2843 + #define LCDC_V4_NEXT_BUF 0x50
2844 +@@ -54,12 +55,20 @@
2845 + #define CTRL_DF24 BIT(1)
2846 + #define CTRL_RUN BIT(0)
2847 +
2848 ++#define CTRL1_RECOVER_ON_UNDERFLOW BIT(24)
2849 + #define CTRL1_FIFO_CLEAR BIT(21)
2850 + #define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16)
2851 + #define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf)
2852 + #define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13)
2853 + #define CTRL1_CUR_FRAME_DONE_IRQ BIT(9)
2854 +
2855 ++#define CTRL2_SET_OUTSTANDING_REQS_1 0
2856 ++#define CTRL2_SET_OUTSTANDING_REQS_2 (0x1 << 21)
2857 ++#define CTRL2_SET_OUTSTANDING_REQS_4 (0x2 << 21)
2858 ++#define CTRL2_SET_OUTSTANDING_REQS_8 (0x3 << 21)
2859 ++#define CTRL2_SET_OUTSTANDING_REQS_16 (0x4 << 21)
2860 ++#define CTRL2_SET_OUTSTANDING_REQS_MASK (0x7 << 21)
2861 ++
2862 + #define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16)
2863 + #define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff)
2864 + #define TRANSFER_COUNT_SET_HCOUNT(x) ((x) & 0xffff)
2865 +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
2866 +index bf7c34cfb84c0..c256929e859b3 100644
2867 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c
2868 ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c
2869 +@@ -60,7 +60,8 @@ static int panfrost_clk_init(struct panfrost_device *pfdev)
2870 + if (IS_ERR(pfdev->bus_clock)) {
2871 + dev_err(pfdev->dev, "get bus_clock failed %ld\n",
2872 + PTR_ERR(pfdev->bus_clock));
2873 +- return PTR_ERR(pfdev->bus_clock);
2874 ++ err = PTR_ERR(pfdev->bus_clock);
2875 ++ goto disable_clock;
2876 + }
2877 +
2878 + if (pfdev->bus_clock) {
2879 +diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
2880 +index 803dad70e2a71..a2add128d0843 100644
2881 +--- a/drivers/i2c/busses/i2c-highlander.c
2882 ++++ b/drivers/i2c/busses/i2c-highlander.c
2883 +@@ -379,7 +379,7 @@ static int highlander_i2c_probe(struct platform_device *pdev)
2884 + platform_set_drvdata(pdev, dev);
2885 +
2886 + dev->irq = platform_get_irq(pdev, 0);
2887 +- if (iic_force_poll)
2888 ++ if (dev->irq < 0 || iic_force_poll)
2889 + dev->irq = 0;
2890 +
2891 + if (dev->irq) {
2892 +diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
2893 +index ab15b1ec2ab3c..8993534bc510d 100644
2894 +--- a/drivers/i2c/busses/i2c-hix5hd2.c
2895 ++++ b/drivers/i2c/busses/i2c-hix5hd2.c
2896 +@@ -413,10 +413,8 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
2897 + return PTR_ERR(priv->regs);
2898 +
2899 + irq = platform_get_irq(pdev, 0);
2900 +- if (irq <= 0) {
2901 +- dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n");
2902 ++ if (irq < 0)
2903 + return irq;
2904 +- }
2905 +
2906 + priv->clk = devm_clk_get(&pdev->dev, NULL);
2907 + if (IS_ERR(priv->clk)) {
2908 +diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
2909 +index 2f8b8050a2233..899624721c1ea 100644
2910 +--- a/drivers/i2c/busses/i2c-iop3xx.c
2911 ++++ b/drivers/i2c/busses/i2c-iop3xx.c
2912 +@@ -467,16 +467,14 @@ iop3xx_i2c_probe(struct platform_device *pdev)
2913 +
2914 + irq = platform_get_irq(pdev, 0);
2915 + if (irq < 0) {
2916 +- ret = -ENXIO;
2917 ++ ret = irq;
2918 + goto unmap;
2919 + }
2920 + ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
2921 + pdev->name, adapter_data);
2922 +
2923 +- if (ret) {
2924 +- ret = -EIO;
2925 ++ if (ret)
2926 + goto unmap;
2927 +- }
2928 +
2929 + memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
2930 + new_adapter->owner = THIS_MODULE;
2931 +diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
2932 +index dcde71ae63419..1a5f1ccd1d2f7 100644
2933 +--- a/drivers/i2c/busses/i2c-mt65xx.c
2934 ++++ b/drivers/i2c/busses/i2c-mt65xx.c
2935 +@@ -1207,7 +1207,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
2936 + return PTR_ERR(i2c->pdmabase);
2937 +
2938 + irq = platform_get_irq(pdev, 0);
2939 +- if (irq <= 0)
2940 ++ if (irq < 0)
2941 + return irq;
2942 +
2943 + init_completion(&i2c->msg_complete);
2944 +diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
2945 +index 40fa9e4af5d1c..05831848b7bf6 100644
2946 +--- a/drivers/i2c/busses/i2c-s3c2410.c
2947 ++++ b/drivers/i2c/busses/i2c-s3c2410.c
2948 +@@ -1140,7 +1140,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
2949 + */
2950 + if (!(i2c->quirks & QUIRK_POLL)) {
2951 + i2c->irq = ret = platform_get_irq(pdev, 0);
2952 +- if (ret <= 0) {
2953 ++ if (ret < 0) {
2954 + dev_err(&pdev->dev, "cannot find IRQ\n");
2955 + clk_unprepare(i2c->clk);
2956 + return ret;
2957 +diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
2958 +index 31be1811d5e66..e4026c5416b15 100644
2959 +--- a/drivers/i2c/busses/i2c-synquacer.c
2960 ++++ b/drivers/i2c/busses/i2c-synquacer.c
2961 +@@ -578,7 +578,7 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
2962 +
2963 + i2c->irq = platform_get_irq(pdev, 0);
2964 + if (i2c->irq < 0)
2965 +- return -ENODEV;
2966 ++ return i2c->irq;
2967 +
2968 + ret = devm_request_irq(&pdev->dev, i2c->irq, synquacer_i2c_isr,
2969 + 0, dev_name(&pdev->dev), i2c);
2970 +diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c
2971 +index f2241cedf5d3f..6d24dc3855229 100644
2972 +--- a/drivers/i2c/busses/i2c-xlp9xx.c
2973 ++++ b/drivers/i2c/busses/i2c-xlp9xx.c
2974 +@@ -517,7 +517,7 @@ static int xlp9xx_i2c_probe(struct platform_device *pdev)
2975 + return PTR_ERR(priv->base);
2976 +
2977 + priv->irq = platform_get_irq(pdev, 0);
2978 +- if (priv->irq <= 0)
2979 ++ if (priv->irq < 0)
2980 + return priv->irq;
2981 + /* SMBAlert irq */
2982 + priv->alert_data.irq = platform_get_irq(pdev, 1);
2983 +diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
2984 +index 1005b182bab47..1bdb7acf445f4 100644
2985 +--- a/drivers/irqchip/irq-gic-v3.c
2986 ++++ b/drivers/irqchip/irq-gic-v3.c
2987 +@@ -100,6 +100,27 @@ EXPORT_SYMBOL(gic_pmr_sync);
2988 + DEFINE_STATIC_KEY_FALSE(gic_nonsecure_priorities);
2989 + EXPORT_SYMBOL(gic_nonsecure_priorities);
2990 +
2991 ++/*
2992 ++ * When the Non-secure world has access to group 0 interrupts (as a
2993 ++ * consequence of SCR_EL3.FIQ == 0), reading the ICC_RPR_EL1 register will
2994 ++ * return the Distributor's view of the interrupt priority.
2995 ++ *
2996 ++ * When GIC security is enabled (GICD_CTLR.DS == 0), the interrupt priority
2997 ++ * written by software is moved to the Non-secure range by the Distributor.
2998 ++ *
2999 ++ * If both are true (which is when gic_nonsecure_priorities gets enabled),
3000 ++ * we need to shift down the priority programmed by software to match it
3001 ++ * against the value returned by ICC_RPR_EL1.
3002 ++ */
3003 ++#define GICD_INT_RPR_PRI(priority) \
3004 ++ ({ \
3005 ++ u32 __priority = (priority); \
3006 ++ if (static_branch_unlikely(&gic_nonsecure_priorities)) \
3007 ++ __priority = 0x80 | (__priority >> 1); \
3008 ++ \
3009 ++ __priority; \
3010 ++ })
3011 ++
3012 + /* ppi_nmi_refs[n] == number of cpus having ppi[n + 16] set as NMI */
3013 + static refcount_t *ppi_nmi_refs;
3014 +
3015 +@@ -687,7 +708,7 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs
3016 + return;
3017 +
3018 + if (gic_supports_nmi() &&
3019 +- unlikely(gic_read_rpr() == GICD_INT_NMI_PRI)) {
3020 ++ unlikely(gic_read_rpr() == GICD_INT_RPR_PRI(GICD_INT_NMI_PRI))) {
3021 + gic_handle_nmi(irqnr, regs);
3022 + return;
3023 + }
3024 +diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
3025 +index 9bf6b9a5f7348..90e1ad6e36120 100644
3026 +--- a/drivers/irqchip/irq-loongson-pch-pic.c
3027 ++++ b/drivers/irqchip/irq-loongson-pch-pic.c
3028 +@@ -92,18 +92,22 @@ static int pch_pic_set_type(struct irq_data *d, unsigned int type)
3029 + case IRQ_TYPE_EDGE_RISING:
3030 + pch_pic_bitset(priv, PCH_PIC_EDGE, d->hwirq);
3031 + pch_pic_bitclr(priv, PCH_PIC_POL, d->hwirq);
3032 ++ irq_set_handler_locked(d, handle_edge_irq);
3033 + break;
3034 + case IRQ_TYPE_EDGE_FALLING:
3035 + pch_pic_bitset(priv, PCH_PIC_EDGE, d->hwirq);
3036 + pch_pic_bitset(priv, PCH_PIC_POL, d->hwirq);
3037 ++ irq_set_handler_locked(d, handle_edge_irq);
3038 + break;
3039 + case IRQ_TYPE_LEVEL_HIGH:
3040 + pch_pic_bitclr(priv, PCH_PIC_EDGE, d->hwirq);
3041 + pch_pic_bitclr(priv, PCH_PIC_POL, d->hwirq);
3042 ++ irq_set_handler_locked(d, handle_level_irq);
3043 + break;
3044 + case IRQ_TYPE_LEVEL_LOW:
3045 + pch_pic_bitclr(priv, PCH_PIC_EDGE, d->hwirq);
3046 + pch_pic_bitset(priv, PCH_PIC_POL, d->hwirq);
3047 ++ irq_set_handler_locked(d, handle_level_irq);
3048 + break;
3049 + default:
3050 + ret = -EINVAL;
3051 +@@ -113,11 +117,24 @@ static int pch_pic_set_type(struct irq_data *d, unsigned int type)
3052 + return ret;
3053 + }
3054 +
3055 ++static void pch_pic_ack_irq(struct irq_data *d)
3056 ++{
3057 ++ unsigned int reg;
3058 ++ struct pch_pic *priv = irq_data_get_irq_chip_data(d);
3059 ++
3060 ++ reg = readl(priv->base + PCH_PIC_EDGE + PIC_REG_IDX(d->hwirq) * 4);
3061 ++ if (reg & BIT(PIC_REG_BIT(d->hwirq))) {
3062 ++ writel(BIT(PIC_REG_BIT(d->hwirq)),
3063 ++ priv->base + PCH_PIC_CLR + PIC_REG_IDX(d->hwirq) * 4);
3064 ++ }
3065 ++ irq_chip_ack_parent(d);
3066 ++}
3067 ++
3068 + static struct irq_chip pch_pic_irq_chip = {
3069 + .name = "PCH PIC",
3070 + .irq_mask = pch_pic_mask_irq,
3071 + .irq_unmask = pch_pic_unmask_irq,
3072 +- .irq_ack = irq_chip_ack_parent,
3073 ++ .irq_ack = pch_pic_ack_irq,
3074 + .irq_set_affinity = irq_chip_set_affinity_parent,
3075 + .irq_set_type = pch_pic_set_type,
3076 + };
3077 +diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c
3078 +index 2180255ad3393..899ed94b66876 100644
3079 +--- a/drivers/leds/leds-is31fl32xx.c
3080 ++++ b/drivers/leds/leds-is31fl32xx.c
3081 +@@ -385,6 +385,7 @@ static int is31fl32xx_parse_dt(struct device *dev,
3082 + dev_err(dev,
3083 + "Node %pOF 'reg' conflicts with another LED\n",
3084 + child);
3085 ++ ret = -EINVAL;
3086 + goto err;
3087 + }
3088 +
3089 +diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
3090 +index 68e06434ac087..7dab08773a347 100644
3091 +--- a/drivers/leds/leds-lt3593.c
3092 ++++ b/drivers/leds/leds-lt3593.c
3093 +@@ -99,10 +99,9 @@ static int lt3593_led_probe(struct platform_device *pdev)
3094 + init_data.default_label = ":";
3095 +
3096 + ret = devm_led_classdev_register_ext(dev, &led_data->cdev, &init_data);
3097 +- if (ret < 0) {
3098 +- fwnode_handle_put(child);
3099 ++ fwnode_handle_put(child);
3100 ++ if (ret < 0)
3101 + return ret;
3102 +- }
3103 +
3104 + platform_set_drvdata(pdev, led_data);
3105 +
3106 +diff --git a/drivers/leds/trigger/ledtrig-audio.c b/drivers/leds/trigger/ledtrig-audio.c
3107 +index f76621e88482d..c6b437e6369b8 100644
3108 +--- a/drivers/leds/trigger/ledtrig-audio.c
3109 ++++ b/drivers/leds/trigger/ledtrig-audio.c
3110 +@@ -6,10 +6,33 @@
3111 + #include <linux/kernel.h>
3112 + #include <linux/leds.h>
3113 + #include <linux/module.h>
3114 ++#include "../leds.h"
3115 +
3116 +-static struct led_trigger *ledtrig_audio[NUM_AUDIO_LEDS];
3117 + static enum led_brightness audio_state[NUM_AUDIO_LEDS];
3118 +
3119 ++static int ledtrig_audio_mute_activate(struct led_classdev *led_cdev)
3120 ++{
3121 ++ led_set_brightness_nosleep(led_cdev, audio_state[LED_AUDIO_MUTE]);
3122 ++ return 0;
3123 ++}
3124 ++
3125 ++static int ledtrig_audio_micmute_activate(struct led_classdev *led_cdev)
3126 ++{
3127 ++ led_set_brightness_nosleep(led_cdev, audio_state[LED_AUDIO_MICMUTE]);
3128 ++ return 0;
3129 ++}
3130 ++
3131 ++static struct led_trigger ledtrig_audio[NUM_AUDIO_LEDS] = {
3132 ++ [LED_AUDIO_MUTE] = {
3133 ++ .name = "audio-mute",
3134 ++ .activate = ledtrig_audio_mute_activate,
3135 ++ },
3136 ++ [LED_AUDIO_MICMUTE] = {
3137 ++ .name = "audio-micmute",
3138 ++ .activate = ledtrig_audio_micmute_activate,
3139 ++ },
3140 ++};
3141 ++
3142 + enum led_brightness ledtrig_audio_get(enum led_audio type)
3143 + {
3144 + return audio_state[type];
3145 +@@ -19,24 +42,22 @@ EXPORT_SYMBOL_GPL(ledtrig_audio_get);
3146 + void ledtrig_audio_set(enum led_audio type, enum led_brightness state)
3147 + {
3148 + audio_state[type] = state;
3149 +- led_trigger_event(ledtrig_audio[type], state);
3150 ++ led_trigger_event(&ledtrig_audio[type], state);
3151 + }
3152 + EXPORT_SYMBOL_GPL(ledtrig_audio_set);
3153 +
3154 + static int __init ledtrig_audio_init(void)
3155 + {
3156 +- led_trigger_register_simple("audio-mute",
3157 +- &ledtrig_audio[LED_AUDIO_MUTE]);
3158 +- led_trigger_register_simple("audio-micmute",
3159 +- &ledtrig_audio[LED_AUDIO_MICMUTE]);
3160 ++ led_trigger_register(&ledtrig_audio[LED_AUDIO_MUTE]);
3161 ++ led_trigger_register(&ledtrig_audio[LED_AUDIO_MICMUTE]);
3162 + return 0;
3163 + }
3164 + module_init(ledtrig_audio_init);
3165 +
3166 + static void __exit ledtrig_audio_exit(void)
3167 + {
3168 +- led_trigger_unregister_simple(ledtrig_audio[LED_AUDIO_MUTE]);
3169 +- led_trigger_unregister_simple(ledtrig_audio[LED_AUDIO_MICMUTE]);
3170 ++ led_trigger_unregister(&ledtrig_audio[LED_AUDIO_MUTE]);
3171 ++ led_trigger_unregister(&ledtrig_audio[LED_AUDIO_MICMUTE]);
3172 + }
3173 + module_exit(ledtrig_audio_exit);
3174 +
3175 +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
3176 +index 248bda63f0852..81f1cc5b34999 100644
3177 +--- a/drivers/md/bcache/super.c
3178 ++++ b/drivers/md/bcache/super.c
3179 +@@ -934,20 +934,20 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
3180 + n = BITS_TO_LONGS(d->nr_stripes) * sizeof(unsigned long);
3181 + d->full_dirty_stripes = kvzalloc(n, GFP_KERNEL);
3182 + if (!d->full_dirty_stripes)
3183 +- return -ENOMEM;
3184 ++ goto out_free_stripe_sectors_dirty;
3185 +
3186 + idx = ida_simple_get(&bcache_device_idx, 0,
3187 + BCACHE_DEVICE_IDX_MAX, GFP_KERNEL);
3188 + if (idx < 0)
3189 +- return idx;
3190 ++ goto out_free_full_dirty_stripes;
3191 +
3192 + if (bioset_init(&d->bio_split, 4, offsetof(struct bbio, bio),
3193 + BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER))
3194 +- goto err;
3195 ++ goto out_ida_remove;
3196 +
3197 + d->disk = alloc_disk(BCACHE_MINORS);
3198 + if (!d->disk)
3199 +- goto err;
3200 ++ goto out_bioset_exit;
3201 +
3202 + set_capacity(d->disk, sectors);
3203 + snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", idx);
3204 +@@ -993,8 +993,14 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
3205 +
3206 + return 0;
3207 +
3208 +-err:
3209 ++out_bioset_exit:
3210 ++ bioset_exit(&d->bio_split);
3211 ++out_ida_remove:
3212 + ida_simple_remove(&bcache_device_idx, idx);
3213 ++out_free_full_dirty_stripes:
3214 ++ kvfree(d->full_dirty_stripes);
3215 ++out_free_stripe_sectors_dirty:
3216 ++ kvfree(d->stripe_sectors_dirty);
3217 + return -ENOMEM;
3218 +
3219 + }
3220 +diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
3221 +index 89bb7e6dc7a42..9554c8348c020 100644
3222 +--- a/drivers/media/i2c/tda1997x.c
3223 ++++ b/drivers/media/i2c/tda1997x.c
3224 +@@ -2233,6 +2233,7 @@ static int tda1997x_core_init(struct v4l2_subdev *sd)
3225 + /* get initial HDMI status */
3226 + state->hdmi_status = io_read(sd, REG_HDMI_FLAGS);
3227 +
3228 ++ io_write(sd, REG_EDID_ENABLE, EDID_ENABLE_A_EN | EDID_ENABLE_B_EN);
3229 + return 0;
3230 + }
3231 +
3232 +diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
3233 +index bf75927bac4e7..159c9de857885 100644
3234 +--- a/drivers/media/platform/coda/coda-bit.c
3235 ++++ b/drivers/media/platform/coda/coda-bit.c
3236 +@@ -2031,17 +2031,25 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
3237 + u32 src_fourcc, dst_fourcc;
3238 + int ret;
3239 +
3240 ++ q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
3241 ++ q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
3242 ++ src_fourcc = q_data_src->fourcc;
3243 ++ dst_fourcc = q_data_dst->fourcc;
3244 ++
3245 + if (!ctx->initialized) {
3246 + ret = __coda_decoder_seq_init(ctx);
3247 + if (ret < 0)
3248 + return ret;
3249 ++ } else {
3250 ++ ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) |
3251 ++ CODA9_FRAME_TILED2LINEAR);
3252 ++ if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV)
3253 ++ ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
3254 ++ if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
3255 ++ ctx->frame_mem_ctrl |= (0x3 << 9) |
3256 ++ ((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR);
3257 + }
3258 +
3259 +- q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
3260 +- q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
3261 +- src_fourcc = q_data_src->fourcc;
3262 +- dst_fourcc = q_data_dst->fourcc;
3263 +-
3264 + coda_write(dev, ctx->parabuf.paddr, CODA_REG_BIT_PARA_BUF_ADDR);
3265 +
3266 + ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc);
3267 +diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
3268 +index 47246528ac7ef..e2d0fd5eaf29a 100644
3269 +--- a/drivers/media/platform/qcom/venus/venc.c
3270 ++++ b/drivers/media/platform/qcom/venus/venc.c
3271 +@@ -183,6 +183,8 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f)
3272 + else
3273 + return NULL;
3274 + fmt = find_format(inst, pixmp->pixelformat, f->type);
3275 ++ if (!fmt)
3276 ++ return NULL;
3277 + }
3278 +
3279 + pixmp->width = clamp(pixmp->width, frame_width_min(inst),
3280 +diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c
3281 +index bf9a75b75083b..81508ed5abf34 100644
3282 +--- a/drivers/media/platform/rockchip/rga/rga-buf.c
3283 ++++ b/drivers/media/platform/rockchip/rga/rga-buf.c
3284 +@@ -79,9 +79,8 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count)
3285 + struct rockchip_rga *rga = ctx->rga;
3286 + int ret;
3287 +
3288 +- ret = pm_runtime_get_sync(rga->dev);
3289 ++ ret = pm_runtime_resume_and_get(rga->dev);
3290 + if (ret < 0) {
3291 +- pm_runtime_put_noidle(rga->dev);
3292 + rga_buf_return_buffers(q, VB2_BUF_STATE_QUEUED);
3293 + return ret;
3294 + }
3295 +diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
3296 +index 9d122429706e9..6759091b15e09 100644
3297 +--- a/drivers/media/platform/rockchip/rga/rga.c
3298 ++++ b/drivers/media/platform/rockchip/rga/rga.c
3299 +@@ -863,10 +863,12 @@ static int rga_probe(struct platform_device *pdev)
3300 + if (IS_ERR(rga->m2m_dev)) {
3301 + v4l2_err(&rga->v4l2_dev, "Failed to init mem2mem device\n");
3302 + ret = PTR_ERR(rga->m2m_dev);
3303 +- goto unreg_video_dev;
3304 ++ goto rel_vdev;
3305 + }
3306 +
3307 +- pm_runtime_get_sync(rga->dev);
3308 ++ ret = pm_runtime_resume_and_get(rga->dev);
3309 ++ if (ret < 0)
3310 ++ goto rel_vdev;
3311 +
3312 + rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF;
3313 + rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F;
3314 +@@ -880,11 +882,23 @@ static int rga_probe(struct platform_device *pdev)
3315 + rga->cmdbuf_virt = dma_alloc_attrs(rga->dev, RGA_CMDBUF_SIZE,
3316 + &rga->cmdbuf_phy, GFP_KERNEL,
3317 + DMA_ATTR_WRITE_COMBINE);
3318 ++ if (!rga->cmdbuf_virt) {
3319 ++ ret = -ENOMEM;
3320 ++ goto rel_vdev;
3321 ++ }
3322 +
3323 + rga->src_mmu_pages =
3324 + (unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
3325 ++ if (!rga->src_mmu_pages) {
3326 ++ ret = -ENOMEM;
3327 ++ goto free_dma;
3328 ++ }
3329 + rga->dst_mmu_pages =
3330 + (unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
3331 ++ if (rga->dst_mmu_pages) {
3332 ++ ret = -ENOMEM;
3333 ++ goto free_src_pages;
3334 ++ }
3335 +
3336 + def_frame.stride = (def_frame.width * def_frame.fmt->depth) >> 3;
3337 + def_frame.size = def_frame.stride * def_frame.height;
3338 +@@ -892,7 +906,7 @@ static int rga_probe(struct platform_device *pdev)
3339 + ret = video_register_device(vfd, VFL_TYPE_VIDEO, -1);
3340 + if (ret) {
3341 + v4l2_err(&rga->v4l2_dev, "Failed to register video device\n");
3342 +- goto rel_vdev;
3343 ++ goto free_dst_pages;
3344 + }
3345 +
3346 + v4l2_info(&rga->v4l2_dev, "Registered %s as /dev/%s\n",
3347 +@@ -900,10 +914,15 @@ static int rga_probe(struct platform_device *pdev)
3348 +
3349 + return 0;
3350 +
3351 ++free_dst_pages:
3352 ++ free_pages((unsigned long)rga->dst_mmu_pages, 3);
3353 ++free_src_pages:
3354 ++ free_pages((unsigned long)rga->src_mmu_pages, 3);
3355 ++free_dma:
3356 ++ dma_free_attrs(rga->dev, RGA_CMDBUF_SIZE, rga->cmdbuf_virt,
3357 ++ rga->cmdbuf_phy, DMA_ATTR_WRITE_COMBINE);
3358 + rel_vdev:
3359 + video_device_release(vfd);
3360 +-unreg_video_dev:
3361 +- video_unregister_device(rga->vfd);
3362 + unreg_v4l2_dev:
3363 + v4l2_device_unregister(&rga->v4l2_dev);
3364 + err_put_clk:
3365 +diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c
3366 +index 4077217777f92..93194f03764d2 100644
3367 +--- a/drivers/media/spi/cxd2880-spi.c
3368 ++++ b/drivers/media/spi/cxd2880-spi.c
3369 +@@ -524,13 +524,13 @@ cxd2880_spi_probe(struct spi_device *spi)
3370 + if (IS_ERR(dvb_spi->vcc_supply)) {
3371 + if (PTR_ERR(dvb_spi->vcc_supply) == -EPROBE_DEFER) {
3372 + ret = -EPROBE_DEFER;
3373 +- goto fail_adapter;
3374 ++ goto fail_regulator;
3375 + }
3376 + dvb_spi->vcc_supply = NULL;
3377 + } else {
3378 + ret = regulator_enable(dvb_spi->vcc_supply);
3379 + if (ret)
3380 +- goto fail_adapter;
3381 ++ goto fail_regulator;
3382 + }
3383 +
3384 + dvb_spi->spi = spi;
3385 +@@ -618,6 +618,9 @@ fail_frontend:
3386 + fail_attach:
3387 + dvb_unregister_adapter(&dvb_spi->adapter);
3388 + fail_adapter:
3389 ++ if (!dvb_spi->vcc_supply)
3390 ++ regulator_disable(dvb_spi->vcc_supply);
3391 ++fail_regulator:
3392 + kfree(dvb_spi);
3393 + return ret;
3394 + }
3395 +diff --git a/drivers/media/usb/dvb-usb/dvb-usb-i2c.c b/drivers/media/usb/dvb-usb/dvb-usb-i2c.c
3396 +index 2e07106f46803..bc4b2abdde1a4 100644
3397 +--- a/drivers/media/usb/dvb-usb/dvb-usb-i2c.c
3398 ++++ b/drivers/media/usb/dvb-usb/dvb-usb-i2c.c
3399 +@@ -17,7 +17,8 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
3400 +
3401 + if (d->props.i2c_algo == NULL) {
3402 + err("no i2c algorithm specified");
3403 +- return -EINVAL;
3404 ++ ret = -EINVAL;
3405 ++ goto err;
3406 + }
3407 +
3408 + strscpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name));
3409 +@@ -27,11 +28,15 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
3410 +
3411 + i2c_set_adapdata(&d->i2c_adap, d);
3412 +
3413 +- if ((ret = i2c_add_adapter(&d->i2c_adap)) < 0)
3414 ++ ret = i2c_add_adapter(&d->i2c_adap);
3415 ++ if (ret < 0) {
3416 + err("could not add i2c adapter");
3417 ++ goto err;
3418 ++ }
3419 +
3420 + d->state |= DVB_USB_STATE_I2C;
3421 +
3422 ++err:
3423 + return ret;
3424 + }
3425 +
3426 +diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c
3427 +index 28e1fd64dd3c2..61439c8f33cab 100644
3428 +--- a/drivers/media/usb/dvb-usb/dvb-usb-init.c
3429 ++++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c
3430 +@@ -194,8 +194,8 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums)
3431 +
3432 + err_adapter_init:
3433 + dvb_usb_adapter_exit(d);
3434 +-err_i2c_init:
3435 + dvb_usb_i2c_exit(d);
3436 ++err_i2c_init:
3437 + if (d->priv && d->props.priv_destroy)
3438 + d->props.priv_destroy(d);
3439 + err_priv_init:
3440 +diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c
3441 +index e7b290552b663..9c0eb0d40822e 100644
3442 +--- a/drivers/media/usb/dvb-usb/nova-t-usb2.c
3443 ++++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c
3444 +@@ -130,7 +130,7 @@ ret:
3445 +
3446 + static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
3447 + {
3448 +- int i;
3449 ++ int i, ret;
3450 + u8 b;
3451 +
3452 + mac[0] = 0x00;
3453 +@@ -139,7 +139,9 @@ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
3454 +
3455 + /* this is a complete guess, but works for my box */
3456 + for (i = 136; i < 139; i++) {
3457 +- dibusb_read_eeprom_byte(d,i, &b);
3458 ++ ret = dibusb_read_eeprom_byte(d, i, &b);
3459 ++ if (ret)
3460 ++ return ret;
3461 +
3462 + mac[5 - (i - 136)] = b;
3463 + }
3464 +diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c
3465 +index bf54747e2e01a..a1d9e4801a2ba 100644
3466 +--- a/drivers/media/usb/dvb-usb/vp702x.c
3467 ++++ b/drivers/media/usb/dvb-usb/vp702x.c
3468 +@@ -291,16 +291,22 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
3469 + static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
3470 + {
3471 + u8 i, *buf;
3472 ++ int ret;
3473 + struct vp702x_device_state *st = d->priv;
3474 +
3475 + mutex_lock(&st->buf_mutex);
3476 + buf = st->buf;
3477 +- for (i = 6; i < 12; i++)
3478 +- vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1);
3479 ++ for (i = 6; i < 12; i++) {
3480 ++ ret = vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1,
3481 ++ &buf[i - 6], 1);
3482 ++ if (ret < 0)
3483 ++ goto err;
3484 ++ }
3485 +
3486 + memcpy(mac, buf, 6);
3487 ++err:
3488 + mutex_unlock(&st->buf_mutex);
3489 +- return 0;
3490 ++ return ret;
3491 + }
3492 +
3493 + static int vp702x_frontend_attach(struct dvb_usb_adapter *adap)
3494 +diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
3495 +index 59529cbf9cd0b..0b6d77c3bec86 100644
3496 +--- a/drivers/media/usb/em28xx/em28xx-input.c
3497 ++++ b/drivers/media/usb/em28xx/em28xx-input.c
3498 +@@ -842,7 +842,6 @@ error:
3499 + kfree(ir);
3500 + ref_put:
3501 + em28xx_shutdown_buttons(dev);
3502 +- kref_put(&dev->ref, em28xx_free_device);
3503 + return err;
3504 + }
3505 +
3506 +diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c
3507 +index f1767be9d8685..6650eab913d81 100644
3508 +--- a/drivers/media/usb/go7007/go7007-driver.c
3509 ++++ b/drivers/media/usb/go7007/go7007-driver.c
3510 +@@ -691,49 +691,23 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board,
3511 + struct device *dev)
3512 + {
3513 + struct go7007 *go;
3514 +- int i;
3515 +
3516 + go = kzalloc(sizeof(struct go7007), GFP_KERNEL);
3517 + if (go == NULL)
3518 + return NULL;
3519 + go->dev = dev;
3520 + go->board_info = board;
3521 +- go->board_id = 0;
3522 + go->tuner_type = -1;
3523 +- go->channel_number = 0;
3524 +- go->name[0] = 0;
3525 + mutex_init(&go->hw_lock);
3526 + init_waitqueue_head(&go->frame_waitq);
3527 + spin_lock_init(&go->spinlock);
3528 + go->status = STATUS_INIT;
3529 +- memset(&go->i2c_adapter, 0, sizeof(go->i2c_adapter));
3530 +- go->i2c_adapter_online = 0;
3531 +- go->interrupt_available = 0;
3532 + init_waitqueue_head(&go->interrupt_waitq);
3533 +- go->input = 0;
3534 + go7007_update_board(go);
3535 +- go->encoder_h_halve = 0;
3536 +- go->encoder_v_halve = 0;
3537 +- go->encoder_subsample = 0;
3538 + go->format = V4L2_PIX_FMT_MJPEG;
3539 + go->bitrate = 1500000;
3540 + go->fps_scale = 1;
3541 +- go->pali = 0;
3542 + go->aspect_ratio = GO7007_RATIO_1_1;
3543 +- go->gop_size = 0;
3544 +- go->ipb = 0;
3545 +- go->closed_gop = 0;
3546 +- go->repeat_seqhead = 0;
3547 +- go->seq_header_enable = 0;
3548 +- go->gop_header_enable = 0;
3549 +- go->dvd_mode = 0;
3550 +- go->interlace_coding = 0;
3551 +- for (i = 0; i < 4; ++i)
3552 +- go->modet[i].enable = 0;
3553 +- for (i = 0; i < 1624; ++i)
3554 +- go->modet_map[i] = 0;
3555 +- go->audio_deliver = NULL;
3556 +- go->audio_enabled = 0;
3557 +
3558 + return go;
3559 + }
3560 +diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c
3561 +index dbf0455d5d50d..eeb85981e02b6 100644
3562 +--- a/drivers/media/usb/go7007/go7007-usb.c
3563 ++++ b/drivers/media/usb/go7007/go7007-usb.c
3564 +@@ -1134,7 +1134,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
3565 +
3566 + ep = usb->usbdev->ep_in[4];
3567 + if (!ep)
3568 +- return -ENODEV;
3569 ++ goto allocfail;
3570 +
3571 + /* Allocate the URB and buffer for receiving incoming interrupts */
3572 + usb->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
3573 +diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c
3574 +index c802db9aaeb04..32b3d77368e37 100644
3575 +--- a/drivers/misc/lkdtm/core.c
3576 ++++ b/drivers/misc/lkdtm/core.c
3577 +@@ -81,7 +81,7 @@ static struct crashpoint crashpoints[] = {
3578 + CRASHPOINT("FS_DEVRW", "ll_rw_block"),
3579 + CRASHPOINT("MEM_SWAPOUT", "shrink_inactive_list"),
3580 + CRASHPOINT("TIMERADD", "hrtimer_start"),
3581 +- CRASHPOINT("SCSI_DISPATCH_CMD", "scsi_dispatch_cmd"),
3582 ++ CRASHPOINT("SCSI_QUEUE_RQ", "scsi_queue_rq"),
3583 + CRASHPOINT("IDE_CORE_CP", "generic_ide_ioctl"),
3584 + #endif
3585 + };
3586 +diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
3587 +index 8b5d542e20f30..7f90326b1be50 100644
3588 +--- a/drivers/mmc/host/dw_mmc.c
3589 ++++ b/drivers/mmc/host/dw_mmc.c
3590 +@@ -782,6 +782,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host,
3591 + int ret = 0;
3592 +
3593 + /* Set external dma config: burst size, burst width */
3594 ++ memset(&cfg, 0, sizeof(cfg));
3595 + cfg.dst_addr = host->phy_regs + fifo_offset;
3596 + cfg.src_addr = cfg.dst_addr;
3597 + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
3598 +diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
3599 +index f25079ba3bca2..2e4a7c6971dc9 100644
3600 +--- a/drivers/mmc/host/moxart-mmc.c
3601 ++++ b/drivers/mmc/host/moxart-mmc.c
3602 +@@ -631,6 +631,7 @@ static int moxart_probe(struct platform_device *pdev)
3603 + host->dma_chan_tx, host->dma_chan_rx);
3604 + host->have_dma = true;
3605 +
3606 ++ memset(&cfg, 0, sizeof(cfg));
3607 + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
3608 + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
3609 +
3610 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
3611 +index 6cdadbb3accd5..b1e1d327cb8eb 100644
3612 +--- a/drivers/mmc/host/sdhci.c
3613 ++++ b/drivers/mmc/host/sdhci.c
3614 +@@ -1223,6 +1223,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
3615 + if (!host->mapbase)
3616 + return -EINVAL;
3617 +
3618 ++ memset(&cfg, 0, sizeof(cfg));
3619 + cfg.src_addr = host->mapbase + SDHCI_BUFFER;
3620 + cfg.dst_addr = host->mapbase + SDHCI_BUFFER;
3621 + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
3622 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
3623 +index 59253846e8858..f26d037356191 100644
3624 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
3625 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
3626 +@@ -417,6 +417,9 @@ static int atl_resume_common(struct device *dev, bool deep)
3627 + pci_restore_state(pdev);
3628 +
3629 + if (deep) {
3630 ++ /* Reinitialize Nic/Vecs objects */
3631 ++ aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol);
3632 ++
3633 + ret = aq_nic_init(nic);
3634 + if (ret)
3635 + goto err_exit;
3636 +diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
3637 +index 24ae6a28a806d..6009d76e41fc4 100644
3638 +--- a/drivers/net/ethernet/google/gve/gve_adminq.c
3639 ++++ b/drivers/net/ethernet/google/gve/gve_adminq.c
3640 +@@ -182,7 +182,8 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,
3641 + tail = ioread32be(&priv->reg_bar0->adminq_event_counter);
3642 +
3643 + // Check if next command will overflow the buffer.
3644 +- if (((priv->adminq_prod_cnt + 1) & priv->adminq_mask) == tail) {
3645 ++ if (((priv->adminq_prod_cnt + 1) & priv->adminq_mask) ==
3646 ++ (tail & priv->adminq_mask)) {
3647 + int err;
3648 +
3649 + // Flush existing commands to make room.
3650 +@@ -192,7 +193,8 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,
3651 +
3652 + // Retry.
3653 + tail = ioread32be(&priv->reg_bar0->adminq_event_counter);
3654 +- if (((priv->adminq_prod_cnt + 1) & priv->adminq_mask) == tail) {
3655 ++ if (((priv->adminq_prod_cnt + 1) & priv->adminq_mask) ==
3656 ++ (tail & priv->adminq_mask)) {
3657 + // This should never happen. We just flushed the
3658 + // command queue so there should be enough space.
3659 + return -ENOMEM;
3660 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
3661 +index e4f13a49c3df8..a02167cce81e1 100644
3662 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
3663 ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
3664 +@@ -1107,12 +1107,12 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf)
3665 + }
3666 +
3667 + /**
3668 +- * i40e_getnum_vf_vsi_vlan_filters
3669 ++ * __i40e_getnum_vf_vsi_vlan_filters
3670 + * @vsi: pointer to the vsi
3671 + *
3672 + * called to get the number of VLANs offloaded on this VF
3673 + **/
3674 +-static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
3675 ++static int __i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
3676 + {
3677 + struct i40e_mac_filter *f;
3678 + u16 num_vlans = 0, bkt;
3679 +@@ -1125,6 +1125,23 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
3680 + return num_vlans;
3681 + }
3682 +
3683 ++/**
3684 ++ * i40e_getnum_vf_vsi_vlan_filters
3685 ++ * @vsi: pointer to the vsi
3686 ++ *
3687 ++ * wrapper for __i40e_getnum_vf_vsi_vlan_filters() with spinlock held
3688 ++ **/
3689 ++static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
3690 ++{
3691 ++ int num_vlans;
3692 ++
3693 ++ spin_lock_bh(&vsi->mac_filter_hash_lock);
3694 ++ num_vlans = __i40e_getnum_vf_vsi_vlan_filters(vsi);
3695 ++ spin_unlock_bh(&vsi->mac_filter_hash_lock);
3696 ++
3697 ++ return num_vlans;
3698 ++}
3699 ++
3700 + /**
3701 + * i40e_get_vlan_list_sync
3702 + * @vsi: pointer to the VSI
3703 +@@ -1142,7 +1159,7 @@ static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans,
3704 + int bkt;
3705 +
3706 + spin_lock_bh(&vsi->mac_filter_hash_lock);
3707 +- *num_vlans = i40e_getnum_vf_vsi_vlan_filters(vsi);
3708 ++ *num_vlans = __i40e_getnum_vf_vsi_vlan_filters(vsi);
3709 + *vlan_list = kcalloc(*num_vlans, sizeof(**vlan_list), GFP_ATOMIC);
3710 + if (!(*vlan_list))
3711 + goto err;
3712 +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
3713 +index a46780570cd95..5d0dc1f811e0f 100644
3714 +--- a/drivers/net/ethernet/intel/ice/ice_main.c
3715 ++++ b/drivers/net/ethernet/intel/ice/ice_main.c
3716 +@@ -4879,6 +4879,7 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
3717 + struct ice_hw *hw = &pf->hw;
3718 + struct sockaddr *addr = pi;
3719 + enum ice_status status;
3720 ++ u8 old_mac[ETH_ALEN];
3721 + u8 flags = 0;
3722 + int err = 0;
3723 + u8 *mac;
3724 +@@ -4901,8 +4902,13 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
3725 + }
3726 +
3727 + netif_addr_lock_bh(netdev);
3728 ++ ether_addr_copy(old_mac, netdev->dev_addr);
3729 ++ /* change the netdev's MAC address */
3730 ++ memcpy(netdev->dev_addr, mac, netdev->addr_len);
3731 ++ netif_addr_unlock_bh(netdev);
3732 ++
3733 + /* Clean up old MAC filter. Not an error if old filter doesn't exist */
3734 +- status = ice_fltr_remove_mac(vsi, netdev->dev_addr, ICE_FWD_TO_VSI);
3735 ++ status = ice_fltr_remove_mac(vsi, old_mac, ICE_FWD_TO_VSI);
3736 + if (status && status != ICE_ERR_DOES_NOT_EXIST) {
3737 + err = -EADDRNOTAVAIL;
3738 + goto err_update_filters;
3739 +@@ -4925,13 +4931,12 @@ err_update_filters:
3740 + if (err) {
3741 + netdev_err(netdev, "can't set MAC %pM. filter update failed\n",
3742 + mac);
3743 ++ netif_addr_lock_bh(netdev);
3744 ++ ether_addr_copy(netdev->dev_addr, old_mac);
3745 + netif_addr_unlock_bh(netdev);
3746 + return err;
3747 + }
3748 +
3749 +- /* change the netdev's MAC address */
3750 +- memcpy(netdev->dev_addr, mac, netdev->addr_len);
3751 +- netif_addr_unlock_bh(netdev);
3752 + netdev_dbg(vsi->netdev, "updated MAC address to %pM\n",
3753 + netdev->dev_addr);
3754 +
3755 +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
3756 +index 169ae491f9786..6fa9358e6db4f 100644
3757 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
3758 ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
3759 +@@ -27,7 +27,7 @@
3760 + #define NIXLF_PROMISC_ENTRY 2
3761 +
3762 + #define NPC_PARSE_RESULT_DMAC_OFFSET 8
3763 +-#define NPC_HW_TSTAMP_OFFSET 8
3764 ++#define NPC_HW_TSTAMP_OFFSET 8ULL
3765 +
3766 + static const char def_pfl_name[] = "default";
3767 +
3768 +@@ -1171,14 +1171,15 @@ int rvu_npc_init(struct rvu *rvu)
3769 +
3770 + /* Enable below for Rx pkts.
3771 + * - Outer IPv4 header checksum validation.
3772 +- * - Detect outer L2 broadcast address and set NPC_RESULT_S[L2M].
3773 ++ * - Detect outer L2 broadcast address and set NPC_RESULT_S[L2B].
3774 ++ * - Detect outer L2 multicast address and set NPC_RESULT_S[L2M].
3775 + * - Inner IPv4 header checksum validation.
3776 + * - Set non zero checksum error code value
3777 + */
3778 + rvu_write64(rvu, blkaddr, NPC_AF_PCK_CFG,
3779 + rvu_read64(rvu, blkaddr, NPC_AF_PCK_CFG) |
3780 +- BIT_ULL(32) | BIT_ULL(24) | BIT_ULL(6) |
3781 +- BIT_ULL(2) | BIT_ULL(1));
3782 ++ ((u64)NPC_EC_OIP4_CSUM << 32) | (NPC_EC_IIP4_CSUM << 24) |
3783 ++ BIT_ULL(7) | BIT_ULL(6) | BIT_ULL(2) | BIT_ULL(1));
3784 +
3785 + /* Set RX and TX side MCAM search key size.
3786 + * LA..LD (ltype only) + Channel
3787 +@@ -1318,7 +1319,7 @@ static void npc_unmap_mcam_entry_and_cntr(struct rvu *rvu,
3788 + int blkaddr, u16 entry, u16 cntr)
3789 + {
3790 + u16 index = entry & (mcam->banksize - 1);
3791 +- u16 bank = npc_get_bank(mcam, entry);
3792 ++ u32 bank = npc_get_bank(mcam, entry);
3793 +
3794 + /* Remove mapping and reduce counter's refcnt */
3795 + mcam->entry2cntr_map[entry] = NPC_MCAM_INVALID_MAP;
3796 +@@ -1879,8 +1880,8 @@ int rvu_mbox_handler_npc_mcam_shift_entry(struct rvu *rvu,
3797 + struct npc_mcam *mcam = &rvu->hw->mcam;
3798 + u16 pcifunc = req->hdr.pcifunc;
3799 + u16 old_entry, new_entry;
3800 ++ int blkaddr, rc = 0;
3801 + u16 index, cntr;
3802 +- int blkaddr, rc;
3803 +
3804 + blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
3805 + if (blkaddr < 0)
3806 +@@ -2081,10 +2082,11 @@ int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu,
3807 + index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry);
3808 + if (index >= mcam->bmap_entries)
3809 + break;
3810 ++ entry = index + 1;
3811 ++
3812 + if (mcam->entry2cntr_map[index] != req->cntr)
3813 + continue;
3814 +
3815 +- entry = index + 1;
3816 + npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr,
3817 + index, req->cntr);
3818 + }
3819 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
3820 +index bf5cf022e279d..4cba110f6ef8c 100644
3821 +--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
3822 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
3823 +@@ -376,6 +376,48 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)
3824 + #endif
3825 + }
3826 +
3827 ++#define MLX5_TRAP_DROP(_id, _group_id) \
3828 ++ DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \
3829 ++ DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
3830 ++ DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT)
3831 ++
3832 ++static const struct devlink_trap mlx5_traps_arr[] = {
3833 ++ MLX5_TRAP_DROP(INGRESS_VLAN_FILTER, L2_DROPS),
3834 ++};
3835 ++
3836 ++static const struct devlink_trap_group mlx5_trap_groups_arr[] = {
3837 ++ DEVLINK_TRAP_GROUP_GENERIC(L2_DROPS, 0),
3838 ++};
3839 ++
3840 ++static int mlx5_devlink_traps_register(struct devlink *devlink)
3841 ++{
3842 ++ struct mlx5_core_dev *core_dev = devlink_priv(devlink);
3843 ++ int err;
3844 ++
3845 ++ err = devlink_trap_groups_register(devlink, mlx5_trap_groups_arr,
3846 ++ ARRAY_SIZE(mlx5_trap_groups_arr));
3847 ++ if (err)
3848 ++ return err;
3849 ++
3850 ++ err = devlink_traps_register(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr),
3851 ++ &core_dev->priv);
3852 ++ if (err)
3853 ++ goto err_trap_group;
3854 ++ return 0;
3855 ++
3856 ++err_trap_group:
3857 ++ devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr,
3858 ++ ARRAY_SIZE(mlx5_trap_groups_arr));
3859 ++ return err;
3860 ++}
3861 ++
3862 ++static void mlx5_devlink_traps_unregister(struct devlink *devlink)
3863 ++{
3864 ++ devlink_traps_unregister(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr));
3865 ++ devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr,
3866 ++ ARRAY_SIZE(mlx5_trap_groups_arr));
3867 ++}
3868 ++
3869 + int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
3870 + {
3871 + int err;
3872 +@@ -390,8 +432,16 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
3873 + goto params_reg_err;
3874 + mlx5_devlink_set_params_init_values(devlink);
3875 + devlink_params_publish(devlink);
3876 ++
3877 ++ err = mlx5_devlink_traps_register(devlink);
3878 ++ if (err)
3879 ++ goto traps_reg_err;
3880 ++
3881 + return 0;
3882 +
3883 ++traps_reg_err:
3884 ++ devlink_params_unregister(devlink, mlx5_devlink_params,
3885 ++ ARRAY_SIZE(mlx5_devlink_params));
3886 + params_reg_err:
3887 + devlink_unregister(devlink);
3888 + return err;
3889 +@@ -399,6 +449,8 @@ params_reg_err:
3890 +
3891 + void mlx5_devlink_unregister(struct devlink *devlink)
3892 + {
3893 ++ mlx5_devlink_traps_unregister(devlink);
3894 ++ devlink_params_unpublish(devlink);
3895 + devlink_params_unregister(devlink, mlx5_devlink_params,
3896 + ARRAY_SIZE(mlx5_devlink_params));
3897 + devlink_unregister(devlink);
3898 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
3899 +index dc744702aee4a..000ca294b0a0a 100644
3900 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
3901 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
3902 +@@ -262,18 +262,12 @@ struct ttc_params {
3903 +
3904 + void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, struct ttc_params *ttc_params);
3905 + void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params);
3906 +-void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params);
3907 +
3908 + int mlx5e_create_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
3909 + struct mlx5e_ttc_table *ttc);
3910 + void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv,
3911 + struct mlx5e_ttc_table *ttc);
3912 +
3913 +-int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
3914 +- struct mlx5e_ttc_table *ttc);
3915 +-void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv,
3916 +- struct mlx5e_ttc_table *ttc);
3917 +-
3918 + void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
3919 + int mlx5e_ttc_fwd_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type,
3920 + struct mlx5_flow_destination *new_dest);
3921 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
3922 +index 93877becfae26..f405c256b3cd0 100644
3923 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
3924 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
3925 +@@ -1138,7 +1138,7 @@ void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv,
3926 + ttc_params->inner_ttc = &priv->fs.inner_ttc;
3927 + }
3928 +
3929 +-void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params)
3930 ++static void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params)
3931 + {
3932 + struct mlx5_flow_table_attr *ft_attr = &ttc_params->ft_attr;
3933 +
3934 +@@ -1157,8 +1157,8 @@ void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params)
3935 + ft_attr->prio = MLX5E_NIC_PRIO;
3936 + }
3937 +
3938 +-int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
3939 +- struct mlx5e_ttc_table *ttc)
3940 ++static int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
3941 ++ struct mlx5e_ttc_table *ttc)
3942 + {
3943 + struct mlx5e_flow_table *ft = &ttc->ft;
3944 + int err;
3945 +@@ -1188,8 +1188,8 @@ err:
3946 + return err;
3947 + }
3948 +
3949 +-void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv,
3950 +- struct mlx5e_ttc_table *ttc)
3951 ++static void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv,
3952 ++ struct mlx5e_ttc_table *ttc)
3953 + {
3954 + if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
3955 + return;
3956 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
3957 +index 6b4a3d90c9f7f..6974090a7efac 100644
3958 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
3959 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
3960 +@@ -2803,6 +2803,14 @@ static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
3961 + err = mlx5_core_modify_tir(mdev, priv->indir_tir[tt].tirn, in);
3962 + if (err)
3963 + goto free_in;
3964 ++
3965 ++ /* Verify inner tirs resources allocated */
3966 ++ if (!priv->inner_indir_tir[0].tirn)
3967 ++ continue;
3968 ++
3969 ++ err = mlx5_core_modify_tir(mdev, priv->inner_indir_tir[tt].tirn, in);
3970 ++ if (err)
3971 ++ goto free_in;
3972 + }
3973 +
3974 + for (ix = 0; ix < priv->max_nch; ix++) {
3975 +@@ -4928,7 +4936,14 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
3976 + netdev->hw_enc_features |= NETIF_F_HW_VLAN_CTAG_TX;
3977 + netdev->hw_enc_features |= NETIF_F_HW_VLAN_CTAG_RX;
3978 +
3979 ++ /* Tunneled LRO is not supported in the driver, and the same RQs are
3980 ++ * shared between inner and outer TIRs, so the driver can't disable LRO
3981 ++ * for inner TIRs while having it enabled for outer TIRs. Due to this,
3982 ++ * block LRO altogether if the firmware declares tunneled LRO support.
3983 ++ */
3984 + if (!!MLX5_CAP_ETH(mdev, lro_cap) &&
3985 ++ !MLX5_CAP_ETH(mdev, tunnel_lro_vxlan) &&
3986 ++ !MLX5_CAP_ETH(mdev, tunnel_lro_gre) &&
3987 + mlx5e_check_fragmented_striding_rq_cap(mdev))
3988 + netdev->vlan_features |= NETIF_F_LRO;
3989 +
3990 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
3991 +index c9c2962ad49fb..5801f55ff0771 100644
3992 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
3993 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
3994 +@@ -2564,8 +2564,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
3995 +
3996 + switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {
3997 + case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
3998 +- if (mode == DEVLINK_ESWITCH_INLINE_MODE_NONE)
3999 ++ if (mode == DEVLINK_ESWITCH_INLINE_MODE_NONE) {
4000 ++ err = 0;
4001 + goto out;
4002 ++ }
4003 ++
4004 + fallthrough;
4005 + case MLX5_CAP_INLINE_MODE_L2:
4006 + NL_SET_ERR_MSG_MOD(extack, "Inline mode can't be set");
4007 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
4008 +index 97b5fcb1f4064..5c6a376aa62ec 100644
4009 +--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
4010 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
4011 +@@ -337,17 +337,6 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
4012 + }
4013 +
4014 + mlx5e_set_ttc_basic_params(priv, &ttc_params);
4015 +- mlx5e_set_inner_ttc_ft_params(&ttc_params);
4016 +- for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
4017 +- ttc_params.indir_tirn[tt] = priv->inner_indir_tir[tt].tirn;
4018 +-
4019 +- err = mlx5e_create_inner_ttc_table(priv, &ttc_params, &priv->fs.inner_ttc);
4020 +- if (err) {
4021 +- netdev_err(priv->netdev, "Failed to create inner ttc table, err=%d\n",
4022 +- err);
4023 +- goto err_destroy_arfs_tables;
4024 +- }
4025 +-
4026 + mlx5e_set_ttc_ft_params(&ttc_params);
4027 + for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
4028 + ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn;
4029 +@@ -356,13 +345,11 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
4030 + if (err) {
4031 + netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n",
4032 + err);
4033 +- goto err_destroy_inner_ttc_table;
4034 ++ goto err_destroy_arfs_tables;
4035 + }
4036 +
4037 + return 0;
4038 +
4039 +-err_destroy_inner_ttc_table:
4040 +- mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
4041 + err_destroy_arfs_tables:
4042 + mlx5e_arfs_destroy_tables(priv);
4043 +
4044 +@@ -372,7 +359,6 @@ err_destroy_arfs_tables:
4045 + static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv)
4046 + {
4047 + mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
4048 +- mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
4049 + mlx5e_arfs_destroy_tables(priv);
4050 + }
4051 +
4052 +@@ -397,7 +383,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
4053 + if (err)
4054 + goto err_destroy_indirect_rqts;
4055 +
4056 +- err = mlx5e_create_indirect_tirs(priv, true);
4057 ++ err = mlx5e_create_indirect_tirs(priv, false);
4058 + if (err)
4059 + goto err_destroy_direct_rqts;
4060 +
4061 +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
4062 +index 51d64718ed9f0..3d94064c685db 100644
4063 +--- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
4064 ++++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
4065 +@@ -91,20 +91,20 @@ int ionic_devlink_register(struct ionic *ionic)
4066 + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
4067 + devlink_port_attrs_set(&ionic->dl_port, &attrs);
4068 + err = devlink_port_register(dl, &ionic->dl_port, 0);
4069 +- if (err)
4070 ++ if (err) {
4071 + dev_err(ionic->dev, "devlink_port_register failed: %d\n", err);
4072 +- else
4073 +- devlink_port_type_eth_set(&ionic->dl_port,
4074 +- ionic->lif->netdev);
4075 ++ devlink_unregister(dl);
4076 ++ return err;
4077 ++ }
4078 +
4079 +- return err;
4080 ++ devlink_port_type_eth_set(&ionic->dl_port, ionic->lif->netdev);
4081 ++ return 0;
4082 + }
4083 +
4084 + void ionic_devlink_unregister(struct ionic *ionic)
4085 + {
4086 + struct devlink *dl = priv_to_devlink(ionic);
4087 +
4088 +- if (ionic->dl_port.registered)
4089 +- devlink_port_unregister(&ionic->dl_port);
4090 ++ devlink_port_unregister(&ionic->dl_port);
4091 + devlink_unregister(dl);
4092 + }
4093 +diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
4094 +index 5a3b65a6eb4f2..36bcb5db3be97 100644
4095 +--- a/drivers/net/ethernet/qualcomm/qca_spi.c
4096 ++++ b/drivers/net/ethernet/qualcomm/qca_spi.c
4097 +@@ -434,7 +434,7 @@ qcaspi_receive(struct qcaspi *qca)
4098 + skb_put(qca->rx_skb, retcode);
4099 + qca->rx_skb->protocol = eth_type_trans(
4100 + qca->rx_skb, qca->rx_skb->dev);
4101 +- qca->rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
4102 ++ skb_checksum_none_assert(qca->rx_skb);
4103 + netif_rx_ni(qca->rx_skb);
4104 + qca->rx_skb = netdev_alloc_skb_ip_align(net_dev,
4105 + net_dev->mtu + VLAN_ETH_HLEN);
4106 +diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c
4107 +index 362b4f5c162c0..0b7301db20ed4 100644
4108 +--- a/drivers/net/ethernet/qualcomm/qca_uart.c
4109 ++++ b/drivers/net/ethernet/qualcomm/qca_uart.c
4110 +@@ -107,7 +107,7 @@ qca_tty_receive(struct serdev_device *serdev, const unsigned char *data,
4111 + skb_put(qca->rx_skb, retcode);
4112 + qca->rx_skb->protocol = eth_type_trans(
4113 + qca->rx_skb, qca->rx_skb->dev);
4114 +- qca->rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
4115 ++ skb_checksum_none_assert(qca->rx_skb);
4116 + netif_rx_ni(qca->rx_skb);
4117 + qca->rx_skb = netdev_alloc_skb_ip_align(netdev,
4118 + netdev->mtu +
4119 +diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
4120 +index dbc47702a268d..5bacddee83449 100644
4121 +--- a/drivers/net/wireless/ath/ath6kl/wmi.c
4122 ++++ b/drivers/net/wireless/ath/ath6kl/wmi.c
4123 +@@ -2504,8 +2504,10 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx)
4124 + goto free_data_skb;
4125 +
4126 + for (index = 0; index < num_pri_streams; index++) {
4127 +- if (WARN_ON(!data_sync_bufs[index].skb))
4128 ++ if (WARN_ON(!data_sync_bufs[index].skb)) {
4129 ++ ret = -ENOMEM;
4130 + goto free_data_skb;
4131 ++ }
4132 +
4133 + ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev,
4134 + data_sync_bufs[index].
4135 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
4136 +index 603aff421e38e..1f12dfb33938a 100644
4137 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
4138 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
4139 +@@ -2073,7 +2073,7 @@ cleanup:
4140 +
4141 + err = brcmf_pcie_probe(pdev, NULL);
4142 + if (err)
4143 +- brcmf_err(bus, "probe after resume failed, err=%d\n", err);
4144 ++ __brcmf_err(NULL, __func__, "probe after resume failed, err=%d\n", err);
4145 +
4146 + return err;
4147 + }
4148 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
4149 +index 3e5a35e26ad34..5e4faf9ce4bbe 100644
4150 +--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
4151 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
4152 +@@ -229,8 +229,8 @@ found:
4153 + IWL_EXPORT_SYMBOL(iwl_acpi_get_wifi_pkg);
4154 +
4155 + int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
4156 +- __le32 *black_list_array,
4157 +- int *black_list_size)
4158 ++ __le32 *block_list_array,
4159 ++ int *block_list_size)
4160 + {
4161 + union acpi_object *wifi_pkg, *data;
4162 + int ret, tbl_rev, i;
4163 +@@ -254,47 +254,47 @@ int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
4164 + goto out_free;
4165 + }
4166 +
4167 +- enabled = !!wifi_pkg->package.elements[0].integer.value;
4168 ++ enabled = !!wifi_pkg->package.elements[1].integer.value;
4169 +
4170 + if (!enabled) {
4171 +- *black_list_size = -1;
4172 ++ *block_list_size = -1;
4173 + IWL_DEBUG_RADIO(fwrt, "TAS not enabled\n");
4174 + ret = 0;
4175 + goto out_free;
4176 + }
4177 +
4178 +- if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
4179 +- wifi_pkg->package.elements[1].integer.value >
4180 ++ if (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER ||
4181 ++ wifi_pkg->package.elements[2].integer.value >
4182 + APCI_WTAS_BLACK_LIST_MAX) {
4183 + IWL_DEBUG_RADIO(fwrt, "TAS invalid array size %llu\n",
4184 + wifi_pkg->package.elements[1].integer.value);
4185 + ret = -EINVAL;
4186 + goto out_free;
4187 + }
4188 +- *black_list_size = wifi_pkg->package.elements[1].integer.value;
4189 ++ *block_list_size = wifi_pkg->package.elements[2].integer.value;
4190 +
4191 +- IWL_DEBUG_RADIO(fwrt, "TAS array size %d\n", *black_list_size);
4192 +- if (*black_list_size > APCI_WTAS_BLACK_LIST_MAX) {
4193 ++ IWL_DEBUG_RADIO(fwrt, "TAS array size %d\n", *block_list_size);
4194 ++ if (*block_list_size > APCI_WTAS_BLACK_LIST_MAX) {
4195 + IWL_DEBUG_RADIO(fwrt, "TAS invalid array size value %u\n",
4196 +- *black_list_size);
4197 ++ *block_list_size);
4198 + ret = -EINVAL;
4199 + goto out_free;
4200 + }
4201 +
4202 +- for (i = 0; i < *black_list_size; i++) {
4203 ++ for (i = 0; i < *block_list_size; i++) {
4204 + u32 country;
4205 +
4206 +- if (wifi_pkg->package.elements[2 + i].type !=
4207 ++ if (wifi_pkg->package.elements[3 + i].type !=
4208 + ACPI_TYPE_INTEGER) {
4209 + IWL_DEBUG_RADIO(fwrt,
4210 +- "TAS invalid array elem %d\n", 2 + i);
4211 ++ "TAS invalid array elem %d\n", 3 + i);
4212 + ret = -EINVAL;
4213 + goto out_free;
4214 + }
4215 +
4216 +- country = wifi_pkg->package.elements[2 + i].integer.value;
4217 +- black_list_array[i] = cpu_to_le32(country);
4218 +- IWL_DEBUG_RADIO(fwrt, "TAS black list country %d\n", country);
4219 ++ country = wifi_pkg->package.elements[3 + i].integer.value;
4220 ++ block_list_array[i] = cpu_to_le32(country);
4221 ++ IWL_DEBUG_RADIO(fwrt, "TAS block list country %d\n", country);
4222 + }
4223 +
4224 + ret = 0;
4225 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
4226 +index bddf8a44e163f..dfd341421adcf 100644
4227 +--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
4228 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
4229 +@@ -100,7 +100,7 @@
4230 + #define ACPI_ECKV_WIFI_DATA_SIZE 2
4231 +
4232 + /*
4233 +- * 1 type, 1 enabled, 1 black list size, 16 black list array
4234 ++ * 1 type, 1 enabled, 1 block list size, 16 block list array
4235 + */
4236 + #define APCI_WTAS_BLACK_LIST_MAX 16
4237 + #define ACPI_WTAS_WIFI_DATA_SIZE (3 + APCI_WTAS_BLACK_LIST_MAX)
4238 +@@ -197,8 +197,8 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);
4239 + int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
4240 + struct iwl_per_chain_offset *table, u32 n_bands);
4241 +
4242 +-int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *black_list_array,
4243 +- int *black_list_size);
4244 ++int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *block_list_array,
4245 ++ int *block_list_size);
4246 +
4247 + #else /* CONFIG_ACPI */
4248 +
4249 +@@ -269,8 +269,8 @@ static inline bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
4250 + }
4251 +
4252 + static inline int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
4253 +- __le32 *black_list_array,
4254 +- int *black_list_size)
4255 ++ __le32 *block_list_array,
4256 ++ int *block_list_size)
4257 + {
4258 + return -ENOENT;
4259 + }
4260 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
4261 +index 8cc36dbb23117..21543bc21c16f 100644
4262 +--- a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
4263 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
4264 +@@ -323,7 +323,7 @@ enum iwl_legacy_cmds {
4265 +
4266 + /**
4267 + * @SCAN_OFFLOAD_UPDATE_PROFILES_CMD:
4268 +- * update scan offload (scheduled scan) profiles/blacklist/etc.
4269 ++ * update scan offload (scheduled scan) profiles/blocklist/etc.
4270 + */
4271 + SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
4272 +
4273 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
4274 +index 55573168444e8..dd79bac98657b 100644
4275 +--- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
4276 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
4277 +@@ -449,12 +449,12 @@ enum iwl_mcc_source {
4278 + #define IWL_TAS_BLACK_LIST_MAX 16
4279 + /**
4280 + * struct iwl_tas_config_cmd - configures the TAS
4281 +- * @black_list_size: size of relevant field in black_list_array
4282 +- * @black_list_array: black list countries (without TAS)
4283 ++ * @block_list_size: size of relevant field in block_list_array
4284 ++ * @block_list_array: block list countries (without TAS)
4285 + */
4286 + struct iwl_tas_config_cmd {
4287 +- __le32 black_list_size;
4288 +- __le32 black_list_array[IWL_TAS_BLACK_LIST_MAX];
4289 ++ __le32 block_list_size;
4290 ++ __le32 block_list_array[IWL_TAS_BLACK_LIST_MAX];
4291 + } __packed; /* TAS_CONFIG_CMD_API_S_VER_2 */
4292 +
4293 + /**
4294 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
4295 +index 5cc33a1b71723..65d6608199664 100644
4296 +--- a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
4297 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
4298 +@@ -8,7 +8,7 @@
4299 + * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
4300 + * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
4301 + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
4302 +- * Copyright(c) 2018 - 2019 Intel Corporation
4303 ++ * Copyright(c) 2018 - 2020 Intel Corporation
4304 + *
4305 + * This program is free software; you can redistribute it and/or modify
4306 + * it under the terms of version 2 of the GNU General Public License as
4307 +@@ -31,7 +31,7 @@
4308 + * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
4309 + * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
4310 + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
4311 +- * Copyright(c) 2018 - 2019 Intel Corporation
4312 ++ * Copyright(c) 2018 - 2020 Intel Corporation
4313 + * All rights reserved.
4314 + *
4315 + * Redistribution and use in source and binary forms, with or without
4316 +@@ -117,12 +117,12 @@ enum scan_framework_client {
4317 + };
4318 +
4319 + /**
4320 +- * struct iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
4321 ++ * struct iwl_scan_offload_blocklist - SCAN_OFFLOAD_BLACKLIST_S
4322 + * @ssid: MAC address to filter out
4323 + * @reported_rssi: AP rssi reported to the host
4324 + * @client_bitmap: clients ignore this entry - enum scan_framework_client
4325 + */
4326 +-struct iwl_scan_offload_blacklist {
4327 ++struct iwl_scan_offload_blocklist {
4328 + u8 ssid[ETH_ALEN];
4329 + u8 reported_rssi;
4330 + u8 client_bitmap;
4331 +@@ -162,7 +162,7 @@ struct iwl_scan_offload_profile {
4332 +
4333 + /**
4334 + * struct iwl_scan_offload_profile_cfg_data
4335 +- * @blacklist_len: length of blacklist
4336 ++ * @blocklist_len: length of blocklist
4337 + * @num_profiles: num of profiles in the list
4338 + * @match_notify: clients waiting for match found notification
4339 + * @pass_match: clients waiting for the results
4340 +@@ -171,7 +171,7 @@ struct iwl_scan_offload_profile {
4341 + * @reserved: reserved
4342 + */
4343 + struct iwl_scan_offload_profile_cfg_data {
4344 +- u8 blacklist_len;
4345 ++ u8 blocklist_len;
4346 + u8 num_profiles;
4347 + u8 match_notify;
4348 + u8 pass_match;
4349 +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
4350 +index 02c64b988a138..1be9ab186bbd5 100644
4351 +--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
4352 ++++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
4353 +@@ -220,7 +220,7 @@ struct iwl_ucode_capa {
4354 + * treats good CRC threshold as a boolean
4355 + * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
4356 + * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: This uCode image supports uAPSD
4357 +- * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan
4358 ++ * @IWL_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of block list instead of 64 in scan
4359 + * offload profile config command.
4360 + * @IWL_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six
4361 + * (rather than two) IPv6 addresses
4362 +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
4363 +index bd04e4fbbb8ab..1a844c10c442b 100644
4364 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
4365 ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
4366 +@@ -376,7 +376,7 @@ struct iwl_fw_mon_regs {
4367 + * mode set
4368 + * @nvm_hw_section_num: the ID of the HW NVM section
4369 + * @mac_addr_from_csr: read HW address from CSR registers
4370 +- * @features: hw features, any combination of feature_whitelist
4371 ++ * @features: hw features, any combination of feature_passlist
4372 + * @pwr_tx_backoffs: translation table between power limits and backoffs
4373 + * @max_tx_agg_size: max TX aggregation size of the ADDBA request/response
4374 + * @max_ht_ampdu_factor: the exponent of the max length of A-MPDU that the
4375 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
4376 +index ad374b25e2550..6348dfa61724a 100644
4377 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
4378 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
4379 +@@ -1109,7 +1109,7 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
4380 + struct iwl_tas_config_cmd cmd = {};
4381 + int list_size;
4382 +
4383 +- BUILD_BUG_ON(ARRAY_SIZE(cmd.black_list_array) <
4384 ++ BUILD_BUG_ON(ARRAY_SIZE(cmd.block_list_array) <
4385 + APCI_WTAS_BLACK_LIST_MAX);
4386 +
4387 + if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TAS_CFG)) {
4388 +@@ -1117,7 +1117,7 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
4389 + return;
4390 + }
4391 +
4392 +- ret = iwl_acpi_get_tas(&mvm->fwrt, cmd.black_list_array, &list_size);
4393 ++ ret = iwl_acpi_get_tas(&mvm->fwrt, cmd.block_list_array, &list_size);
4394 + if (ret < 0) {
4395 + IWL_DEBUG_RADIO(mvm,
4396 + "TAS table invalid or unavailable. (%d)\n",
4397 +@@ -1129,7 +1129,7 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
4398 + return;
4399 +
4400 + /* list size if TAS enabled can only be non-negative */
4401 +- cmd.black_list_size = cpu_to_le32((u32)list_size);
4402 ++ cmd.block_list_size = cpu_to_le32((u32)list_size);
4403 +
4404 + ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(REGULATORY_AND_NVM_GROUP,
4405 + TAS_CONFIG),
4406 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
4407 +index cbdebefb854ac..5243b84e653cf 100644
4408 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
4409 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
4410 +@@ -115,12 +115,12 @@ static void iwl_mvm_mac_tsf_id_iter(void *_data, u8 *mac,
4411 + * client in the system.
4412 + *
4413 + * The firmware will decide according to the MAC type which
4414 +- * will be the master and slave. Clients that need to sync
4415 +- * with a remote station will be the master, and an AP or GO
4416 +- * will be the slave.
4417 ++ * will be the leader and follower. Clients that need to sync
4418 ++ * with a remote station will be the leader, and an AP or GO
4419 ++ * will be the follower.
4420 + *
4421 +- * Depending on the new interface type it can be slaved to
4422 +- * or become the master of an existing interface.
4423 ++ * Depending on the new interface type it can be following
4424 ++ * or become the leader of an existing interface.
4425 + */
4426 + switch (data->vif->type) {
4427 + case NL80211_IFTYPE_STATION:
4428 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
4429 +index 8cba923b1ec6c..9caff70cbd276 100644
4430 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
4431 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
4432 +@@ -2279,9 +2279,9 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
4433 + int ret;
4434 +
4435 + /*
4436 +- * Re-calculate the tsf id, as the master-slave relations depend on the
4437 +- * beacon interval, which was not known when the station interface was
4438 +- * added.
4439 ++ * Re-calculate the tsf id, as the leader-follower relations depend
4440 ++ * on the beacon interval, which was not known when the station
4441 ++ * interface was added.
4442 + */
4443 + if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) {
4444 + if (vif->bss_conf.he_support &&
4445 +@@ -2499,8 +2499,9 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
4446 + goto out_unlock;
4447 +
4448 + /*
4449 +- * Re-calculate the tsf id, as the master-slave relations depend on the
4450 +- * beacon interval, which was not known when the AP interface was added.
4451 ++ * Re-calculate the tsf id, as the leader-follower relations depend on
4452 ++ * the beacon interval, which was not known when the AP interface
4453 ++ * was added.
4454 + */
4455 + if (vif->type == NL80211_IFTYPE_AP)
4456 + iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif);
4457 +@@ -3116,7 +3117,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
4458 + * than 16. We can't avoid connecting at all, so refuse the
4459 + * station state change, this will cause mac80211 to abandon
4460 + * attempts to connect to this AP, and eventually wpa_s will
4461 +- * blacklist the AP...
4462 ++ * blocklist the AP...
4463 + */
4464 + if (vif->type == NL80211_IFTYPE_STATION &&
4465 + vif->bss_conf.beacon_int < 16) {
4466 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
4467 +index 875281cf7fc09..aebaad45043fa 100644
4468 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
4469 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
4470 +@@ -568,7 +568,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
4471 + {
4472 + struct iwl_scan_offload_profile *profile;
4473 + struct iwl_scan_offload_profile_cfg_v1 *profile_cfg_v1;
4474 +- struct iwl_scan_offload_blacklist *blacklist;
4475 ++ struct iwl_scan_offload_blocklist *blocklist;
4476 + struct iwl_scan_offload_profile_cfg_data *data;
4477 + int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw);
4478 + int profile_cfg_size = sizeof(*data) +
4479 +@@ -579,7 +579,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
4480 + .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
4481 + .dataflags[1] = IWL_HCMD_DFL_NOCOPY,
4482 + };
4483 +- int blacklist_len;
4484 ++ int blocklist_len;
4485 + int i;
4486 + int ret;
4487 +
4488 +@@ -587,22 +587,22 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
4489 + return -EIO;
4490 +
4491 + if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SHORT_BL)
4492 +- blacklist_len = IWL_SCAN_SHORT_BLACKLIST_LEN;
4493 ++ blocklist_len = IWL_SCAN_SHORT_BLACKLIST_LEN;
4494 + else
4495 +- blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN;
4496 ++ blocklist_len = IWL_SCAN_MAX_BLACKLIST_LEN;
4497 +
4498 +- blacklist = kcalloc(blacklist_len, sizeof(*blacklist), GFP_KERNEL);
4499 +- if (!blacklist)
4500 ++ blocklist = kcalloc(blocklist_len, sizeof(*blocklist), GFP_KERNEL);
4501 ++ if (!blocklist)
4502 + return -ENOMEM;
4503 +
4504 + profile_cfg_v1 = kzalloc(profile_cfg_size, GFP_KERNEL);
4505 + if (!profile_cfg_v1) {
4506 + ret = -ENOMEM;
4507 +- goto free_blacklist;
4508 ++ goto free_blocklist;
4509 + }
4510 +
4511 +- cmd.data[0] = blacklist;
4512 +- cmd.len[0] = sizeof(*blacklist) * blacklist_len;
4513 ++ cmd.data[0] = blocklist;
4514 ++ cmd.len[0] = sizeof(*blocklist) * blocklist_len;
4515 + cmd.data[1] = profile_cfg_v1;
4516 +
4517 + /* if max_profile is MAX_PROFILES_V2, we have the new API */
4518 +@@ -615,7 +615,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
4519 + data = &profile_cfg_v1->data;
4520 + }
4521 +
4522 +- /* No blacklist configuration */
4523 ++ /* No blocklist configuration */
4524 + data->num_profiles = req->n_match_sets;
4525 + data->active_clients = SCAN_CLIENT_SCHED_SCAN;
4526 + data->pass_match = SCAN_CLIENT_SCHED_SCAN;
4527 +@@ -639,8 +639,8 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
4528 +
4529 + ret = iwl_mvm_send_cmd(mvm, &cmd);
4530 + kfree(profile_cfg_v1);
4531 +-free_blacklist:
4532 +- kfree(blacklist);
4533 ++free_blocklist:
4534 ++ kfree(blocklist);
4535 +
4536 + return ret;
4537 + }
4538 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
4539 +index eeb70560b746e..90b12e201795c 100644
4540 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
4541 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
4542 +@@ -646,6 +646,7 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {
4543 + IWL_DEV_INFO(0xA0F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0, NULL),
4544 + IWL_DEV_INFO(0xA0F0, 0x2074, iwl_ax201_cfg_qu_hr, NULL),
4545 + IWL_DEV_INFO(0xA0F0, 0x4070, iwl_ax201_cfg_qu_hr, NULL),
4546 ++ IWL_DEV_INFO(0xA0F0, 0x6074, iwl_ax201_cfg_qu_hr, NULL),
4547 + IWL_DEV_INFO(0x02F0, 0x0070, iwl_ax201_cfg_quz_hr, NULL),
4548 + IWL_DEV_INFO(0x02F0, 0x0074, iwl_ax201_cfg_quz_hr, NULL),
4549 + IWL_DEV_INFO(0x02F0, 0x6074, iwl_ax201_cfg_quz_hr, NULL),
4550 +diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c
4551 +index 99b21a2c83861..f4a26f16f00f4 100644
4552 +--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
4553 ++++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
4554 +@@ -1038,8 +1038,10 @@ static int rsi_load_9116_firmware(struct rsi_hw *adapter)
4555 + }
4556 +
4557 + ta_firmware = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
4558 +- if (!ta_firmware)
4559 ++ if (!ta_firmware) {
4560 ++ status = -ENOMEM;
4561 + goto fail_release_fw;
4562 ++ }
4563 + fw_p = ta_firmware;
4564 + instructions_sz = fw_entry->size;
4565 + rsi_dbg(INFO_ZONE, "FW Length = %d bytes\n", instructions_sz);
4566 +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
4567 +index 00b5589847985..3b13de59605e1 100644
4568 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
4569 ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
4570 +@@ -814,6 +814,7 @@ static int rsi_probe(struct usb_interface *pfunction,
4571 + } else {
4572 + rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n",
4573 + __func__, id->idProduct);
4574 ++ status = -ENODEV;
4575 + goto err1;
4576 + }
4577 +
4578 +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
4579 +index e6d58402b829d..c6c2e2361b2fe 100644
4580 +--- a/drivers/nvme/host/rdma.c
4581 ++++ b/drivers/nvme/host/rdma.c
4582 +@@ -735,13 +735,13 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl)
4583 + if (ret)
4584 + return ret;
4585 +
4586 +- ctrl->ctrl.queue_count = nr_io_queues + 1;
4587 +- if (ctrl->ctrl.queue_count < 2) {
4588 ++ if (nr_io_queues == 0) {
4589 + dev_err(ctrl->ctrl.device,
4590 + "unable to set any I/O queues\n");
4591 + return -ENOMEM;
4592 + }
4593 +
4594 ++ ctrl->ctrl.queue_count = nr_io_queues + 1;
4595 + dev_info(ctrl->ctrl.device,
4596 + "creating %d I/O queues.\n", nr_io_queues);
4597 +
4598 +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
4599 +index 82b2611d39a2f..5b11d8a23813f 100644
4600 +--- a/drivers/nvme/host/tcp.c
4601 ++++ b/drivers/nvme/host/tcp.c
4602 +@@ -1755,13 +1755,13 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl)
4603 + if (ret)
4604 + return ret;
4605 +
4606 +- ctrl->queue_count = nr_io_queues + 1;
4607 +- if (ctrl->queue_count < 2) {
4608 ++ if (nr_io_queues == 0) {
4609 + dev_err(ctrl->device,
4610 + "unable to set any I/O queues\n");
4611 + return -ENOMEM;
4612 + }
4613 +
4614 ++ ctrl->queue_count = nr_io_queues + 1;
4615 + dev_info(ctrl->device,
4616 + "creating %d I/O queues.\n", nr_io_queues);
4617 +
4618 +diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
4619 +index 42bd12b8bf00c..e62d3d0fa6c85 100644
4620 +--- a/drivers/nvme/target/fabrics-cmd.c
4621 ++++ b/drivers/nvme/target/fabrics-cmd.c
4622 +@@ -120,6 +120,7 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req)
4623 + if (!sqsize) {
4624 + pr_warn("queue size zero!\n");
4625 + req->error_loc = offsetof(struct nvmf_connect_command, sqsize);
4626 ++ req->cqe->result.u32 = IPO_IATTR_CONNECT_SQE(sqsize);
4627 + ret = NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR;
4628 + goto err;
4629 + }
4630 +@@ -263,11 +264,11 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
4631 + }
4632 +
4633 + status = nvmet_install_queue(ctrl, req);
4634 +- if (status) {
4635 +- /* pass back cntlid that had the issue of installing queue */
4636 +- req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
4637 ++ if (status)
4638 + goto out_ctrl_put;
4639 +- }
4640 ++
4641 ++ /* pass back cntlid for successful completion */
4642 ++ req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
4643 +
4644 + pr_debug("adding queue %d to ctrl %d.\n", qid, ctrl->cntlid);
4645 +
4646 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
4647 +index 9e971fffeb6a3..29f5d699fa06d 100644
4648 +--- a/drivers/pci/pci.c
4649 ++++ b/drivers/pci/pci.c
4650 +@@ -2469,7 +2469,14 @@ static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable
4651 + if (enable) {
4652 + int error;
4653 +
4654 +- if (pci_pme_capable(dev, state))
4655 ++ /*
4656 ++ * Enable PME signaling if the device can signal PME from
4657 ++ * D3cold regardless of whether or not it can signal PME from
4658 ++ * the current target state, because that will allow it to
4659 ++ * signal PME when the hierarchy above it goes into D3cold and
4660 ++ * the device itself ends up in D3cold as a result of that.
4661 ++ */
4662 ++ if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold))
4663 + pci_pme_active(dev, true);
4664 + else
4665 + ret = 1;
4666 +@@ -2573,16 +2580,20 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup)
4667 + if (dev->current_state == PCI_D3cold)
4668 + target_state = PCI_D3cold;
4669 +
4670 +- if (wakeup) {
4671 ++ if (wakeup && dev->pme_support) {
4672 ++ pci_power_t state = target_state;
4673 ++
4674 + /*
4675 + * Find the deepest state from which the device can generate
4676 + * PME#.
4677 + */
4678 +- if (dev->pme_support) {
4679 +- while (target_state
4680 +- && !(dev->pme_support & (1 << target_state)))
4681 +- target_state--;
4682 +- }
4683 ++ while (state && !(dev->pme_support & (1 << state)))
4684 ++ state--;
4685 ++
4686 ++ if (state)
4687 ++ return state;
4688 ++ else if (dev->pme_support & 1)
4689 ++ return PCI_D0;
4690 + }
4691 +
4692 + return target_state;
4693 +diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
4694 +index 148eb8105803a..be24529157be2 100644
4695 +--- a/drivers/power/supply/axp288_fuel_gauge.c
4696 ++++ b/drivers/power/supply/axp288_fuel_gauge.c
4697 +@@ -149,7 +149,7 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg)
4698 + }
4699 +
4700 + if (ret < 0) {
4701 +- dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret);
4702 ++ dev_err(&info->pdev->dev, "Error reading reg 0x%02x err: %d\n", reg, ret);
4703 + return ret;
4704 + }
4705 +
4706 +@@ -163,7 +163,7 @@ static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val)
4707 + ret = regmap_write(info->regmap, reg, (unsigned int)val);
4708 +
4709 + if (ret < 0)
4710 +- dev_err(&info->pdev->dev, "axp288 reg write err:%d\n", ret);
4711 ++ dev_err(&info->pdev->dev, "Error writing reg 0x%02x err: %d\n", reg, ret);
4712 +
4713 + return ret;
4714 + }
4715 +diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c
4716 +index 0146f1bfc29bb..de1fa71be1e83 100644
4717 +--- a/drivers/power/supply/cw2015_battery.c
4718 ++++ b/drivers/power/supply/cw2015_battery.c
4719 +@@ -673,7 +673,9 @@ static int cw_bat_probe(struct i2c_client *client)
4720 + &cw2015_bat_desc,
4721 + &psy_cfg);
4722 + if (IS_ERR(cw_bat->rk_bat)) {
4723 +- dev_err(cw_bat->dev, "Failed to register power supply\n");
4724 ++ /* try again if this happens */
4725 ++ dev_err_probe(&client->dev, PTR_ERR(cw_bat->rk_bat),
4726 ++ "Failed to register power supply\n");
4727 + return PTR_ERR(cw_bat->rk_bat);
4728 + }
4729 +
4730 +diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
4731 +index 794caf03658d7..48d3985eaa8ad 100644
4732 +--- a/drivers/power/supply/max17042_battery.c
4733 ++++ b/drivers/power/supply/max17042_battery.c
4734 +@@ -738,7 +738,7 @@ static inline void max17042_override_por_values(struct max17042_chip *chip)
4735 + struct max17042_config_data *config = chip->pdata->config_data;
4736 +
4737 + max17042_override_por(map, MAX17042_TGAIN, config->tgain);
4738 +- max17042_override_por(map, MAx17042_TOFF, config->toff);
4739 ++ max17042_override_por(map, MAX17042_TOFF, config->toff);
4740 + max17042_override_por(map, MAX17042_CGAIN, config->cgain);
4741 + max17042_override_por(map, MAX17042_COFF, config->coff);
4742 +
4743 +diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c
4744 +index 8cfbd8d6b4786..912e2184f918c 100644
4745 +--- a/drivers/power/supply/smb347-charger.c
4746 ++++ b/drivers/power/supply/smb347-charger.c
4747 +@@ -56,6 +56,7 @@
4748 + #define CFG_PIN_EN_CTRL_ACTIVE_LOW 0x60
4749 + #define CFG_PIN_EN_APSD_IRQ BIT(1)
4750 + #define CFG_PIN_EN_CHARGER_ERROR BIT(2)
4751 ++#define CFG_PIN_EN_CTRL BIT(4)
4752 + #define CFG_THERM 0x07
4753 + #define CFG_THERM_SOFT_HOT_COMPENSATION_MASK 0x03
4754 + #define CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT 0
4755 +@@ -725,6 +726,15 @@ static int smb347_hw_init(struct smb347_charger *smb)
4756 + if (ret < 0)
4757 + goto fail;
4758 +
4759 ++ /* Activate pin control, making it writable. */
4760 ++ switch (smb->enable_control) {
4761 ++ case SMB3XX_CHG_ENABLE_PIN_ACTIVE_LOW:
4762 ++ case SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH:
4763 ++ ret = regmap_set_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_CTRL);
4764 ++ if (ret < 0)
4765 ++ goto fail;
4766 ++ }
4767 ++
4768 + /*
4769 + * Make the charging functionality controllable by a write to the
4770 + * command register unless pin control is specified in the platform
4771 +diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
4772 +index 1d5b0a1b86f78..06cbe60c990f9 100644
4773 +--- a/drivers/regulator/tps65910-regulator.c
4774 ++++ b/drivers/regulator/tps65910-regulator.c
4775 +@@ -1211,12 +1211,10 @@ static int tps65910_probe(struct platform_device *pdev)
4776 +
4777 + rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i],
4778 + &config);
4779 +- if (IS_ERR(rdev)) {
4780 +- dev_err(tps65910->dev,
4781 +- "failed to register %s regulator\n",
4782 +- pdev->name);
4783 +- return PTR_ERR(rdev);
4784 +- }
4785 ++ if (IS_ERR(rdev))
4786 ++ return dev_err_probe(tps65910->dev, PTR_ERR(rdev),
4787 ++ "failed to register %s regulator\n",
4788 ++ pdev->name);
4789 +
4790 + /* Save regulator for cleanup */
4791 + pmic->rdev[i] = rdev;
4792 +diff --git a/drivers/regulator/vctrl-regulator.c b/drivers/regulator/vctrl-regulator.c
4793 +index cbadb1c996790..d2a37978fc3a8 100644
4794 +--- a/drivers/regulator/vctrl-regulator.c
4795 ++++ b/drivers/regulator/vctrl-regulator.c
4796 +@@ -37,7 +37,6 @@ struct vctrl_voltage_table {
4797 + struct vctrl_data {
4798 + struct regulator_dev *rdev;
4799 + struct regulator_desc desc;
4800 +- struct regulator *ctrl_reg;
4801 + bool enabled;
4802 + unsigned int min_slew_down_rate;
4803 + unsigned int ovp_threshold;
4804 +@@ -82,7 +81,12 @@ static int vctrl_calc_output_voltage(struct vctrl_data *vctrl, int ctrl_uV)
4805 + static int vctrl_get_voltage(struct regulator_dev *rdev)
4806 + {
4807 + struct vctrl_data *vctrl = rdev_get_drvdata(rdev);
4808 +- int ctrl_uV = regulator_get_voltage_rdev(vctrl->ctrl_reg->rdev);
4809 ++ int ctrl_uV;
4810 ++
4811 ++ if (!rdev->supply)
4812 ++ return -EPROBE_DEFER;
4813 ++
4814 ++ ctrl_uV = regulator_get_voltage_rdev(rdev->supply->rdev);
4815 +
4816 + return vctrl_calc_output_voltage(vctrl, ctrl_uV);
4817 + }
4818 +@@ -92,14 +96,19 @@ static int vctrl_set_voltage(struct regulator_dev *rdev,
4819 + unsigned int *selector)
4820 + {
4821 + struct vctrl_data *vctrl = rdev_get_drvdata(rdev);
4822 +- struct regulator *ctrl_reg = vctrl->ctrl_reg;
4823 +- int orig_ctrl_uV = regulator_get_voltage_rdev(ctrl_reg->rdev);
4824 +- int uV = vctrl_calc_output_voltage(vctrl, orig_ctrl_uV);
4825 ++ int orig_ctrl_uV;
4826 ++ int uV;
4827 + int ret;
4828 +
4829 ++ if (!rdev->supply)
4830 ++ return -EPROBE_DEFER;
4831 ++
4832 ++ orig_ctrl_uV = regulator_get_voltage_rdev(rdev->supply->rdev);
4833 ++ uV = vctrl_calc_output_voltage(vctrl, orig_ctrl_uV);
4834 ++
4835 + if (req_min_uV >= uV || !vctrl->ovp_threshold)
4836 + /* voltage rising or no OVP */
4837 +- return regulator_set_voltage_rdev(ctrl_reg->rdev,
4838 ++ return regulator_set_voltage_rdev(rdev->supply->rdev,
4839 + vctrl_calc_ctrl_voltage(vctrl, req_min_uV),
4840 + vctrl_calc_ctrl_voltage(vctrl, req_max_uV),
4841 + PM_SUSPEND_ON);
4842 +@@ -117,7 +126,7 @@ static int vctrl_set_voltage(struct regulator_dev *rdev,
4843 + next_uV = max_t(int, req_min_uV, uV - max_drop_uV);
4844 + next_ctrl_uV = vctrl_calc_ctrl_voltage(vctrl, next_uV);
4845 +
4846 +- ret = regulator_set_voltage_rdev(ctrl_reg->rdev,
4847 ++ ret = regulator_set_voltage_rdev(rdev->supply->rdev,
4848 + next_ctrl_uV,
4849 + next_ctrl_uV,
4850 + PM_SUSPEND_ON);
4851 +@@ -134,7 +143,7 @@ static int vctrl_set_voltage(struct regulator_dev *rdev,
4852 +
4853 + err:
4854 + /* Try to go back to original voltage */
4855 +- regulator_set_voltage_rdev(ctrl_reg->rdev, orig_ctrl_uV, orig_ctrl_uV,
4856 ++ regulator_set_voltage_rdev(rdev->supply->rdev, orig_ctrl_uV, orig_ctrl_uV,
4857 + PM_SUSPEND_ON);
4858 +
4859 + return ret;
4860 +@@ -151,16 +160,18 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev,
4861 + unsigned int selector)
4862 + {
4863 + struct vctrl_data *vctrl = rdev_get_drvdata(rdev);
4864 +- struct regulator *ctrl_reg = vctrl->ctrl_reg;
4865 + unsigned int orig_sel = vctrl->sel;
4866 + int ret;
4867 +
4868 ++ if (!rdev->supply)
4869 ++ return -EPROBE_DEFER;
4870 ++
4871 + if (selector >= rdev->desc->n_voltages)
4872 + return -EINVAL;
4873 +
4874 + if (selector >= vctrl->sel || !vctrl->ovp_threshold) {
4875 + /* voltage rising or no OVP */
4876 +- ret = regulator_set_voltage_rdev(ctrl_reg->rdev,
4877 ++ ret = regulator_set_voltage_rdev(rdev->supply->rdev,
4878 + vctrl->vtable[selector].ctrl,
4879 + vctrl->vtable[selector].ctrl,
4880 + PM_SUSPEND_ON);
4881 +@@ -179,7 +190,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev,
4882 + else
4883 + next_sel = vctrl->vtable[vctrl->sel].ovp_min_sel;
4884 +
4885 +- ret = regulator_set_voltage_rdev(ctrl_reg->rdev,
4886 ++ ret = regulator_set_voltage_rdev(rdev->supply->rdev,
4887 + vctrl->vtable[next_sel].ctrl,
4888 + vctrl->vtable[next_sel].ctrl,
4889 + PM_SUSPEND_ON);
4890 +@@ -202,7 +213,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev,
4891 + err:
4892 + if (vctrl->sel != orig_sel) {
4893 + /* Try to go back to original voltage */
4894 +- if (!regulator_set_voltage_rdev(ctrl_reg->rdev,
4895 ++ if (!regulator_set_voltage_rdev(rdev->supply->rdev,
4896 + vctrl->vtable[orig_sel].ctrl,
4897 + vctrl->vtable[orig_sel].ctrl,
4898 + PM_SUSPEND_ON))
4899 +@@ -234,10 +245,6 @@ static int vctrl_parse_dt(struct platform_device *pdev,
4900 + u32 pval;
4901 + u32 vrange_ctrl[2];
4902 +
4903 +- vctrl->ctrl_reg = devm_regulator_get(&pdev->dev, "ctrl");
4904 +- if (IS_ERR(vctrl->ctrl_reg))
4905 +- return PTR_ERR(vctrl->ctrl_reg);
4906 +-
4907 + ret = of_property_read_u32(np, "ovp-threshold-percent", &pval);
4908 + if (!ret) {
4909 + vctrl->ovp_threshold = pval;
4910 +@@ -315,11 +322,11 @@ static int vctrl_cmp_ctrl_uV(const void *a, const void *b)
4911 + return at->ctrl - bt->ctrl;
4912 + }
4913 +
4914 +-static int vctrl_init_vtable(struct platform_device *pdev)
4915 ++static int vctrl_init_vtable(struct platform_device *pdev,
4916 ++ struct regulator *ctrl_reg)
4917 + {
4918 + struct vctrl_data *vctrl = platform_get_drvdata(pdev);
4919 + struct regulator_desc *rdesc = &vctrl->desc;
4920 +- struct regulator *ctrl_reg = vctrl->ctrl_reg;
4921 + struct vctrl_voltage_range *vrange_ctrl = &vctrl->vrange.ctrl;
4922 + int n_voltages;
4923 + int ctrl_uV;
4924 +@@ -395,23 +402,19 @@ static int vctrl_init_vtable(struct platform_device *pdev)
4925 + static int vctrl_enable(struct regulator_dev *rdev)
4926 + {
4927 + struct vctrl_data *vctrl = rdev_get_drvdata(rdev);
4928 +- int ret = regulator_enable(vctrl->ctrl_reg);
4929 +
4930 +- if (!ret)
4931 +- vctrl->enabled = true;
4932 ++ vctrl->enabled = true;
4933 +
4934 +- return ret;
4935 ++ return 0;
4936 + }
4937 +
4938 + static int vctrl_disable(struct regulator_dev *rdev)
4939 + {
4940 + struct vctrl_data *vctrl = rdev_get_drvdata(rdev);
4941 +- int ret = regulator_disable(vctrl->ctrl_reg);
4942 +
4943 +- if (!ret)
4944 +- vctrl->enabled = false;
4945 ++ vctrl->enabled = false;
4946 +
4947 +- return ret;
4948 ++ return 0;
4949 + }
4950 +
4951 + static int vctrl_is_enabled(struct regulator_dev *rdev)
4952 +@@ -447,6 +450,7 @@ static int vctrl_probe(struct platform_device *pdev)
4953 + struct regulator_desc *rdesc;
4954 + struct regulator_config cfg = { };
4955 + struct vctrl_voltage_range *vrange_ctrl;
4956 ++ struct regulator *ctrl_reg;
4957 + int ctrl_uV;
4958 + int ret;
4959 +
4960 +@@ -461,15 +465,20 @@ static int vctrl_probe(struct platform_device *pdev)
4961 + if (ret)
4962 + return ret;
4963 +
4964 ++ ctrl_reg = devm_regulator_get(&pdev->dev, "ctrl");
4965 ++ if (IS_ERR(ctrl_reg))
4966 ++ return PTR_ERR(ctrl_reg);
4967 ++
4968 + vrange_ctrl = &vctrl->vrange.ctrl;
4969 +
4970 + rdesc = &vctrl->desc;
4971 + rdesc->name = "vctrl";
4972 + rdesc->type = REGULATOR_VOLTAGE;
4973 + rdesc->owner = THIS_MODULE;
4974 ++ rdesc->supply_name = "ctrl";
4975 +
4976 +- if ((regulator_get_linear_step(vctrl->ctrl_reg) == 1) ||
4977 +- (regulator_count_voltages(vctrl->ctrl_reg) == -EINVAL)) {
4978 ++ if ((regulator_get_linear_step(ctrl_reg) == 1) ||
4979 ++ (regulator_count_voltages(ctrl_reg) == -EINVAL)) {
4980 + rdesc->continuous_voltage_range = true;
4981 + rdesc->ops = &vctrl_ops_cont;
4982 + } else {
4983 +@@ -486,11 +495,12 @@ static int vctrl_probe(struct platform_device *pdev)
4984 + cfg.init_data = init_data;
4985 +
4986 + if (!rdesc->continuous_voltage_range) {
4987 +- ret = vctrl_init_vtable(pdev);
4988 ++ ret = vctrl_init_vtable(pdev, ctrl_reg);
4989 + if (ret)
4990 + return ret;
4991 +
4992 +- ctrl_uV = regulator_get_voltage_rdev(vctrl->ctrl_reg->rdev);
4993 ++ /* Use locked consumer API when not in regulator framework */
4994 ++ ctrl_uV = regulator_get_voltage(ctrl_reg);
4995 + if (ctrl_uV < 0) {
4996 + dev_err(&pdev->dev, "failed to get control voltage\n");
4997 + return ctrl_uV;
4998 +@@ -513,6 +523,9 @@ static int vctrl_probe(struct platform_device *pdev)
4999 + }
5000 + }
5001 +
5002 ++ /* Drop ctrl-supply here in favor of regulator core managed supply */
5003 ++ devm_regulator_put(ctrl_reg);
5004 ++
5005 + vctrl->rdev = devm_regulator_register(&pdev->dev, rdesc, &cfg);
5006 + if (IS_ERR(vctrl->rdev)) {
5007 + ret = PTR_ERR(vctrl->rdev);
5008 +diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
5009 +index cca1a7c4bb336..305db4173dcf3 100644
5010 +--- a/drivers/s390/cio/css.c
5011 ++++ b/drivers/s390/cio/css.c
5012 +@@ -426,9 +426,26 @@ static ssize_t pimpampom_show(struct device *dev,
5013 + }
5014 + static DEVICE_ATTR_RO(pimpampom);
5015 +
5016 ++static ssize_t dev_busid_show(struct device *dev,
5017 ++ struct device_attribute *attr,
5018 ++ char *buf)
5019 ++{
5020 ++ struct subchannel *sch = to_subchannel(dev);
5021 ++ struct pmcw *pmcw = &sch->schib.pmcw;
5022 ++
5023 ++ if ((pmcw->st == SUBCHANNEL_TYPE_IO ||
5024 ++ pmcw->st == SUBCHANNEL_TYPE_MSG) && pmcw->dnv)
5025 ++ return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid,
5026 ++ pmcw->dev);
5027 ++ else
5028 ++ return sysfs_emit(buf, "none\n");
5029 ++}
5030 ++static DEVICE_ATTR_RO(dev_busid);
5031 ++
5032 + static struct attribute *io_subchannel_type_attrs[] = {
5033 + &dev_attr_chpids.attr,
5034 + &dev_attr_pimpampom.attr,
5035 ++ &dev_attr_dev_busid.attr,
5036 + NULL,
5037 + };
5038 + ATTRIBUTE_GROUPS(io_subchannel_type);
5039 +diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
5040 +index ef738b42a0926..c00a288a4eca2 100644
5041 +--- a/drivers/s390/crypto/ap_bus.c
5042 ++++ b/drivers/s390/crypto/ap_bus.c
5043 +@@ -114,22 +114,13 @@ static struct bus_type ap_bus_type;
5044 + /* Adapter interrupt definitions */
5045 + static void ap_interrupt_handler(struct airq_struct *airq, bool floating);
5046 +
5047 +-static int ap_airq_flag;
5048 ++static bool ap_irq_flag;
5049 +
5050 + static struct airq_struct ap_airq = {
5051 + .handler = ap_interrupt_handler,
5052 + .isc = AP_ISC,
5053 + };
5054 +
5055 +-/**
5056 +- * ap_using_interrupts() - Returns non-zero if interrupt support is
5057 +- * available.
5058 +- */
5059 +-static inline int ap_using_interrupts(void)
5060 +-{
5061 +- return ap_airq_flag;
5062 +-}
5063 +-
5064 + /**
5065 + * ap_airq_ptr() - Get the address of the adapter interrupt indicator
5066 + *
5067 +@@ -139,7 +130,7 @@ static inline int ap_using_interrupts(void)
5068 + */
5069 + void *ap_airq_ptr(void)
5070 + {
5071 +- if (ap_using_interrupts())
5072 ++ if (ap_irq_flag)
5073 + return ap_airq.lsi_ptr;
5074 + return NULL;
5075 + }
5076 +@@ -369,7 +360,7 @@ void ap_wait(enum ap_sm_wait wait)
5077 + switch (wait) {
5078 + case AP_SM_WAIT_AGAIN:
5079 + case AP_SM_WAIT_INTERRUPT:
5080 +- if (ap_using_interrupts())
5081 ++ if (ap_irq_flag)
5082 + break;
5083 + if (ap_poll_kthread) {
5084 + wake_up(&ap_poll_wait);
5085 +@@ -444,7 +435,7 @@ static void ap_tasklet_fn(unsigned long dummy)
5086 + * be received. Doing it in the beginning of the tasklet is therefor
5087 + * important that no requests on any AP get lost.
5088 + */
5089 +- if (ap_using_interrupts())
5090 ++ if (ap_irq_flag)
5091 + xchg(ap_airq.lsi_ptr, 0);
5092 +
5093 + spin_lock_bh(&ap_queues_lock);
5094 +@@ -514,7 +505,7 @@ static int ap_poll_thread_start(void)
5095 + {
5096 + int rc;
5097 +
5098 +- if (ap_using_interrupts() || ap_poll_kthread)
5099 ++ if (ap_irq_flag || ap_poll_kthread)
5100 + return 0;
5101 + mutex_lock(&ap_poll_thread_mutex);
5102 + ap_poll_kthread = kthread_run(ap_poll_thread, NULL, "appoll");
5103 +@@ -1014,7 +1005,7 @@ static BUS_ATTR_RO(ap_adapter_mask);
5104 + static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf)
5105 + {
5106 + return scnprintf(buf, PAGE_SIZE, "%d\n",
5107 +- ap_using_interrupts() ? 1 : 0);
5108 ++ ap_irq_flag ? 1 : 0);
5109 + }
5110 +
5111 + static BUS_ATTR_RO(ap_interrupts);
5112 +@@ -1687,7 +1678,7 @@ static int __init ap_module_init(void)
5113 + /* enable interrupts if available */
5114 + if (ap_interrupts_available()) {
5115 + rc = register_adapter_interrupt(&ap_airq);
5116 +- ap_airq_flag = (rc == 0);
5117 ++ ap_irq_flag = (rc == 0);
5118 + }
5119 +
5120 + /* Create /sys/bus/ap. */
5121 +@@ -1737,7 +1728,7 @@ out_bus:
5122 + bus_remove_file(&ap_bus_type, ap_bus_attrs[i]);
5123 + bus_unregister(&ap_bus_type);
5124 + out:
5125 +- if (ap_using_interrupts())
5126 ++ if (ap_irq_flag)
5127 + unregister_adapter_interrupt(&ap_airq);
5128 + kfree(ap_qci_info);
5129 + return rc;
5130 +diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
5131 +index 5029b80132aae..ccdbd95cab706 100644
5132 +--- a/drivers/s390/crypto/ap_bus.h
5133 ++++ b/drivers/s390/crypto/ap_bus.h
5134 +@@ -77,12 +77,6 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
5135 + #define AP_FUNC_EP11 5
5136 + #define AP_FUNC_APXA 6
5137 +
5138 +-/*
5139 +- * AP interrupt states
5140 +- */
5141 +-#define AP_INTR_DISABLED 0 /* AP interrupt disabled */
5142 +-#define AP_INTR_ENABLED 1 /* AP interrupt enabled */
5143 +-
5144 + /*
5145 + * AP queue state machine states
5146 + */
5147 +@@ -109,7 +103,7 @@ enum ap_sm_event {
5148 + * AP queue state wait behaviour
5149 + */
5150 + enum ap_sm_wait {
5151 +- AP_SM_WAIT_AGAIN, /* retry immediately */
5152 ++ AP_SM_WAIT_AGAIN = 0, /* retry immediately */
5153 + AP_SM_WAIT_TIMEOUT, /* wait for timeout */
5154 + AP_SM_WAIT_INTERRUPT, /* wait for thin interrupt (if available) */
5155 + AP_SM_WAIT_NONE, /* no wait */
5156 +@@ -182,7 +176,7 @@ struct ap_queue {
5157 + enum ap_dev_state dev_state; /* queue device state */
5158 + bool config; /* configured state */
5159 + ap_qid_t qid; /* AP queue id. */
5160 +- int interrupt; /* indicate if interrupts are enabled */
5161 ++ bool interrupt; /* indicate if interrupts are enabled */
5162 + int queue_count; /* # messages currently on AP queue. */
5163 + int pendingq_count; /* # requests on pendingq list. */
5164 + int requestq_count; /* # requests on requestq list. */
5165 +diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c
5166 +index 337353c9655ed..639f8d25679c3 100644
5167 +--- a/drivers/s390/crypto/ap_queue.c
5168 ++++ b/drivers/s390/crypto/ap_queue.c
5169 +@@ -19,7 +19,7 @@
5170 + static void __ap_flush_queue(struct ap_queue *aq);
5171 +
5172 + /**
5173 +- * ap_queue_enable_interruption(): Enable interruption on an AP queue.
5174 ++ * ap_queue_enable_irq(): Enable interrupt support on this AP queue.
5175 + * @qid: The AP queue number
5176 + * @ind: the notification indicator byte
5177 + *
5178 +@@ -27,7 +27,7 @@ static void __ap_flush_queue(struct ap_queue *aq);
5179 + * value it waits a while and tests the AP queue if interrupts
5180 + * have been switched on using ap_test_queue().
5181 + */
5182 +-static int ap_queue_enable_interruption(struct ap_queue *aq, void *ind)
5183 ++static int ap_queue_enable_irq(struct ap_queue *aq, void *ind)
5184 + {
5185 + struct ap_queue_status status;
5186 + struct ap_qirq_ctrl qirqctrl = { 0 };
5187 +@@ -198,7 +198,8 @@ static enum ap_sm_wait ap_sm_read(struct ap_queue *aq)
5188 + return AP_SM_WAIT_NONE;
5189 + case AP_RESPONSE_NO_PENDING_REPLY:
5190 + if (aq->queue_count > 0)
5191 +- return AP_SM_WAIT_INTERRUPT;
5192 ++ return aq->interrupt ?
5193 ++ AP_SM_WAIT_INTERRUPT : AP_SM_WAIT_TIMEOUT;
5194 + aq->sm_state = AP_SM_STATE_IDLE;
5195 + return AP_SM_WAIT_NONE;
5196 + default:
5197 +@@ -252,7 +253,8 @@ static enum ap_sm_wait ap_sm_write(struct ap_queue *aq)
5198 + fallthrough;
5199 + case AP_RESPONSE_Q_FULL:
5200 + aq->sm_state = AP_SM_STATE_QUEUE_FULL;
5201 +- return AP_SM_WAIT_INTERRUPT;
5202 ++ return aq->interrupt ?
5203 ++ AP_SM_WAIT_INTERRUPT : AP_SM_WAIT_TIMEOUT;
5204 + case AP_RESPONSE_RESET_IN_PROGRESS:
5205 + aq->sm_state = AP_SM_STATE_RESET_WAIT;
5206 + return AP_SM_WAIT_TIMEOUT;
5207 +@@ -302,7 +304,7 @@ static enum ap_sm_wait ap_sm_reset(struct ap_queue *aq)
5208 + case AP_RESPONSE_NORMAL:
5209 + case AP_RESPONSE_RESET_IN_PROGRESS:
5210 + aq->sm_state = AP_SM_STATE_RESET_WAIT;
5211 +- aq->interrupt = AP_INTR_DISABLED;
5212 ++ aq->interrupt = false;
5213 + return AP_SM_WAIT_TIMEOUT;
5214 + default:
5215 + aq->dev_state = AP_DEV_STATE_ERROR;
5216 +@@ -335,7 +337,7 @@ static enum ap_sm_wait ap_sm_reset_wait(struct ap_queue *aq)
5217 + switch (status.response_code) {
5218 + case AP_RESPONSE_NORMAL:
5219 + lsi_ptr = ap_airq_ptr();
5220 +- if (lsi_ptr && ap_queue_enable_interruption(aq, lsi_ptr) == 0)
5221 ++ if (lsi_ptr && ap_queue_enable_irq(aq, lsi_ptr) == 0)
5222 + aq->sm_state = AP_SM_STATE_SETIRQ_WAIT;
5223 + else
5224 + aq->sm_state = (aq->queue_count > 0) ?
5225 +@@ -376,7 +378,7 @@ static enum ap_sm_wait ap_sm_setirq_wait(struct ap_queue *aq)
5226 +
5227 + if (status.irq_enabled == 1) {
5228 + /* Irqs are now enabled */
5229 +- aq->interrupt = AP_INTR_ENABLED;
5230 ++ aq->interrupt = true;
5231 + aq->sm_state = (aq->queue_count > 0) ?
5232 + AP_SM_STATE_WORKING : AP_SM_STATE_IDLE;
5233 + }
5234 +@@ -566,7 +568,7 @@ static ssize_t interrupt_show(struct device *dev,
5235 + spin_lock_bh(&aq->lock);
5236 + if (aq->sm_state == AP_SM_STATE_SETIRQ_WAIT)
5237 + rc = scnprintf(buf, PAGE_SIZE, "Enable Interrupt pending.\n");
5238 +- else if (aq->interrupt == AP_INTR_ENABLED)
5239 ++ else if (aq->interrupt)
5240 + rc = scnprintf(buf, PAGE_SIZE, "Interrupts enabled.\n");
5241 + else
5242 + rc = scnprintf(buf, PAGE_SIZE, "Interrupts disabled.\n");
5243 +@@ -747,7 +749,7 @@ struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type)
5244 + aq->ap_dev.device.type = &ap_queue_type;
5245 + aq->ap_dev.device_type = device_type;
5246 + aq->qid = qid;
5247 +- aq->interrupt = AP_INTR_DISABLED;
5248 ++ aq->interrupt = false;
5249 + spin_lock_init(&aq->lock);
5250 + INIT_LIST_HEAD(&aq->pendingq);
5251 + INIT_LIST_HEAD(&aq->requestq);
5252 +diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
5253 +index b1046811450fb..ffab935ddd95b 100644
5254 +--- a/drivers/s390/crypto/zcrypt_ccamisc.c
5255 ++++ b/drivers/s390/crypto/zcrypt_ccamisc.c
5256 +@@ -1715,10 +1715,10 @@ static int fetch_cca_info(u16 cardnr, u16 domain, struct cca_info *ci)
5257 + rlen = vlen = PAGE_SIZE/2;
5258 + rc = cca_query_crypto_facility(cardnr, domain, "STATICSB",
5259 + rarray, &rlen, varray, &vlen);
5260 +- if (rc == 0 && rlen >= 10*8 && vlen >= 240) {
5261 +- ci->new_apka_mk_state = (char) rarray[7*8];
5262 +- ci->cur_apka_mk_state = (char) rarray[8*8];
5263 +- ci->old_apka_mk_state = (char) rarray[9*8];
5264 ++ if (rc == 0 && rlen >= 13*8 && vlen >= 240) {
5265 ++ ci->new_apka_mk_state = (char) rarray[10*8];
5266 ++ ci->cur_apka_mk_state = (char) rarray[11*8];
5267 ++ ci->old_apka_mk_state = (char) rarray[12*8];
5268 + if (ci->old_apka_mk_state == '2')
5269 + memcpy(&ci->old_apka_mkvp, varray + 208, 8);
5270 + if (ci->cur_apka_mk_state == '2')
5271 +diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c
5272 +index e72426221a69c..c8b584d0c8fb4 100644
5273 +--- a/drivers/soc/qcom/rpmhpd.c
5274 ++++ b/drivers/soc/qcom/rpmhpd.c
5275 +@@ -310,12 +310,11 @@ static int rpmhpd_power_on(struct generic_pm_domain *domain)
5276 + static int rpmhpd_power_off(struct generic_pm_domain *domain)
5277 + {
5278 + struct rpmhpd *pd = domain_to_rpmhpd(domain);
5279 +- int ret = 0;
5280 ++ int ret;
5281 +
5282 + mutex_lock(&rpmhpd_lock);
5283 +
5284 +- ret = rpmhpd_aggregate_corner(pd, pd->level[0]);
5285 +-
5286 ++ ret = rpmhpd_aggregate_corner(pd, 0);
5287 + if (!ret)
5288 + pd->enabled = false;
5289 +
5290 +diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
5291 +index 70c3c90b997c9..c428d0f78816e 100644
5292 +--- a/drivers/soc/qcom/smsm.c
5293 ++++ b/drivers/soc/qcom/smsm.c
5294 +@@ -109,7 +109,7 @@ struct smsm_entry {
5295 + DECLARE_BITMAP(irq_enabled, 32);
5296 + DECLARE_BITMAP(irq_rising, 32);
5297 + DECLARE_BITMAP(irq_falling, 32);
5298 +- u32 last_value;
5299 ++ unsigned long last_value;
5300 +
5301 + u32 *remote_state;
5302 + u32 *subscription;
5303 +@@ -204,8 +204,7 @@ static irqreturn_t smsm_intr(int irq, void *data)
5304 + u32 val;
5305 +
5306 + val = readl(entry->remote_state);
5307 +- changed = val ^ entry->last_value;
5308 +- entry->last_value = val;
5309 ++ changed = val ^ xchg(&entry->last_value, val);
5310 +
5311 + for_each_set_bit(i, entry->irq_enabled, 32) {
5312 + if (!(changed & BIT(i)))
5313 +@@ -266,6 +265,12 @@ static void smsm_unmask_irq(struct irq_data *irqd)
5314 + struct qcom_smsm *smsm = entry->smsm;
5315 + u32 val;
5316 +
5317 ++ /* Make sure our last cached state is up-to-date */
5318 ++ if (readl(entry->remote_state) & BIT(irq))
5319 ++ set_bit(irq, &entry->last_value);
5320 ++ else
5321 ++ clear_bit(irq, &entry->last_value);
5322 ++
5323 + set_bit(irq, entry->irq_enabled);
5324 +
5325 + if (entry->subscription) {
5326 +diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig
5327 +index 2c13bf4dd5dbe..25eb2c1e31bb2 100644
5328 +--- a/drivers/soc/rockchip/Kconfig
5329 ++++ b/drivers/soc/rockchip/Kconfig
5330 +@@ -6,8 +6,8 @@ if ARCH_ROCKCHIP || COMPILE_TEST
5331 + #
5332 +
5333 + config ROCKCHIP_GRF
5334 +- bool
5335 +- default y
5336 ++ bool "Rockchip General Register Files support" if COMPILE_TEST
5337 ++ default y if ARCH_ROCKCHIP
5338 + help
5339 + The General Register Files are a central component providing
5340 + special additional settings registers for a lot of soc-components.
5341 +diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
5342 +index 8996115ce736a..263ce90473277 100644
5343 +--- a/drivers/spi/spi-coldfire-qspi.c
5344 ++++ b/drivers/spi/spi-coldfire-qspi.c
5345 +@@ -444,7 +444,7 @@ static int mcfqspi_remove(struct platform_device *pdev)
5346 + mcfqspi_wr_qmr(mcfqspi, MCFQSPI_QMR_MSTR);
5347 +
5348 + mcfqspi_cs_teardown(mcfqspi);
5349 +- clk_disable(mcfqspi->clk);
5350 ++ clk_disable_unprepare(mcfqspi->clk);
5351 +
5352 + return 0;
5353 + }
5354 +diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
5355 +index 7453a1dbbc061..fda73221f3b78 100644
5356 +--- a/drivers/spi/spi-davinci.c
5357 ++++ b/drivers/spi/spi-davinci.c
5358 +@@ -213,12 +213,6 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value)
5359 + * line for the controller
5360 + */
5361 + if (spi->cs_gpiod) {
5362 +- /*
5363 +- * FIXME: is this code ever executed? This host does not
5364 +- * set SPI_MASTER_GPIO_SS so this chipselect callback should
5365 +- * not get called from the SPI core when we are using
5366 +- * GPIOs for chip select.
5367 +- */
5368 + if (value == BITBANG_CS_ACTIVE)
5369 + gpiod_set_value(spi->cs_gpiod, 1);
5370 + else
5371 +@@ -950,7 +944,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
5372 + master->bus_num = pdev->id;
5373 + master->num_chipselect = pdata->num_chipselect;
5374 + master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
5375 +- master->flags = SPI_MASTER_MUST_RX;
5376 ++ master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_GPIO_SS;
5377 + master->setup = davinci_spi_setup;
5378 + master->cleanup = davinci_spi_cleanup;
5379 + master->can_dma = davinci_spi_can_dma;
5380 +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
5381 +index fb45e6af66381..fd004c9db9dc0 100644
5382 +--- a/drivers/spi/spi-fsl-dspi.c
5383 ++++ b/drivers/spi/spi-fsl-dspi.c
5384 +@@ -530,6 +530,7 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
5385 + goto err_rx_dma_buf;
5386 + }
5387 +
5388 ++ memset(&cfg, 0, sizeof(cfg));
5389 + cfg.src_addr = phy_addr + SPI_POPR;
5390 + cfg.dst_addr = phy_addr + SPI_PUSHR;
5391 + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
5392 +diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
5393 +index 104bde153efd2..5eb7b61bbb4d8 100644
5394 +--- a/drivers/spi/spi-pic32.c
5395 ++++ b/drivers/spi/spi-pic32.c
5396 +@@ -361,6 +361,7 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width)
5397 + struct dma_slave_config cfg;
5398 + int ret;
5399 +
5400 ++ memset(&cfg, 0, sizeof(cfg));
5401 + cfg.device_fc = true;
5402 + cfg.src_addr = pic32s->dma_base + buf_offset;
5403 + cfg.dst_addr = pic32s->dma_base + buf_offset;
5404 +diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c
5405 +index 392ec5cfa3d61..307c079b938dc 100644
5406 +--- a/drivers/spi/spi-sprd-adi.c
5407 ++++ b/drivers/spi/spi-sprd-adi.c
5408 +@@ -103,7 +103,7 @@
5409 + #define HWRST_STATUS_WATCHDOG 0xf0
5410 +
5411 + /* Use default timeout 50 ms that converts to watchdog values */
5412 +-#define WDG_LOAD_VAL ((50 * 1000) / 32768)
5413 ++#define WDG_LOAD_VAL ((50 * 32768) / 1000)
5414 + #define WDG_LOAD_MASK GENMASK(15, 0)
5415 + #define WDG_UNLOCK_KEY 0xe551
5416 +
5417 +diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c
5418 +index 68193db8b2e3c..b635835729d66 100644
5419 +--- a/drivers/spi/spi-zynq-qspi.c
5420 ++++ b/drivers/spi/spi-zynq-qspi.c
5421 +@@ -545,7 +545,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
5422 + zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true);
5423 + zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET,
5424 + ZYNQ_QSPI_IXR_RXTX_MASK);
5425 +- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion,
5426 ++ if (!wait_for_completion_timeout(&xqspi->data_completion,
5427 + msecs_to_jiffies(1000)))
5428 + err = -ETIMEDOUT;
5429 + }
5430 +@@ -563,7 +563,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
5431 + zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true);
5432 + zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET,
5433 + ZYNQ_QSPI_IXR_RXTX_MASK);
5434 +- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion,
5435 ++ if (!wait_for_completion_timeout(&xqspi->data_completion,
5436 + msecs_to_jiffies(1000)))
5437 + err = -ETIMEDOUT;
5438 + }
5439 +@@ -579,7 +579,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
5440 + zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true);
5441 + zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET,
5442 + ZYNQ_QSPI_IXR_RXTX_MASK);
5443 +- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion,
5444 ++ if (!wait_for_completion_timeout(&xqspi->data_completion,
5445 + msecs_to_jiffies(1000)))
5446 + err = -ETIMEDOUT;
5447 +
5448 +@@ -603,7 +603,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
5449 + zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true);
5450 + zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET,
5451 + ZYNQ_QSPI_IXR_RXTX_MASK);
5452 +- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion,
5453 ++ if (!wait_for_completion_timeout(&xqspi->data_completion,
5454 + msecs_to_jiffies(1000)))
5455 + err = -ETIMEDOUT;
5456 + }
5457 +diff --git a/drivers/staging/clocking-wizard/Kconfig b/drivers/staging/clocking-wizard/Kconfig
5458 +index 69cf51445f082..2324b5d737886 100644
5459 +--- a/drivers/staging/clocking-wizard/Kconfig
5460 ++++ b/drivers/staging/clocking-wizard/Kconfig
5461 +@@ -5,6 +5,6 @@
5462 +
5463 + config COMMON_CLK_XLNX_CLKWZRD
5464 + tristate "Xilinx Clocking Wizard"
5465 +- depends on COMMON_CLK && OF && IOMEM
5466 ++ depends on COMMON_CLK && OF && HAS_IOMEM
5467 + help
5468 + Support for the Xilinx Clocking Wizard IP core clock generator.
5469 +diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
5470 +index f5de81132177d..77293579a1348 100644
5471 +--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
5472 ++++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
5473 +@@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
5474 + static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
5475 + {
5476 + struct i2c_adapter *adapter = client->adapter;
5477 +- u32 retvalue;
5478 ++ u32 model;
5479 ++ int ret;
5480 +
5481 + if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
5482 + dev_err(&client->dev, "%s: i2c error", __func__);
5483 + return -ENODEV;
5484 + }
5485 +- mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
5486 +- dev->real_model_id = retvalue;
5487 ++ ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
5488 ++ if (ret)
5489 ++ return ret;
5490 ++ dev->real_model_id = model;
5491 +
5492 +- if (retvalue != MT9M114_MOD_ID) {
5493 ++ if (model != MT9M114_MOD_ID) {
5494 + dev_err(&client->dev, "%s: failed: client->addr = %x\n",
5495 + __func__, client->addr);
5496 + return -ENODEV;
5497 +diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
5498 +index 2e74c88808db6..a70911a227a84 100644
5499 +--- a/drivers/tty/serial/fsl_lpuart.c
5500 ++++ b/drivers/tty/serial/fsl_lpuart.c
5501 +@@ -2597,7 +2597,7 @@ static int lpuart_probe(struct platform_device *pdev)
5502 + return PTR_ERR(sport->port.membase);
5503 +
5504 + sport->port.membase += sdata->reg_off;
5505 +- sport->port.mapbase = res->start;
5506 ++ sport->port.mapbase = res->start + sdata->reg_off;
5507 + sport->port.dev = &pdev->dev;
5508 + sport->port.type = PORT_LPUART;
5509 + sport->devtype = sdata->devtype;
5510 +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
5511 +index bc5314092aa4e..669aef77a0bd0 100644
5512 +--- a/drivers/tty/tty_io.c
5513 ++++ b/drivers/tty/tty_io.c
5514 +@@ -2257,8 +2257,6 @@ static int tty_fasync(int fd, struct file *filp, int on)
5515 + * Locking:
5516 + * Called functions take tty_ldiscs_lock
5517 + * current->signal->tty check is safe without locks
5518 +- *
5519 +- * FIXME: may race normal receive processing
5520 + */
5521 +
5522 + static int tiocsti(struct tty_struct *tty, char __user *p)
5523 +@@ -2274,8 +2272,10 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
5524 + ld = tty_ldisc_ref_wait(tty);
5525 + if (!ld)
5526 + return -EIO;
5527 ++ tty_buffer_lock_exclusive(tty->port);
5528 + if (ld->ops->receive_buf)
5529 + ld->ops->receive_buf(tty, &ch, &mbz, 1);
5530 ++ tty_buffer_unlock_exclusive(tty->port);
5531 + tty_ldisc_deref(ld);
5532 + return 0;
5533 + }
5534 +diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
5535 +index ffe301d6ea359..d0f9b7c296b0d 100644
5536 +--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
5537 ++++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
5538 +@@ -598,6 +598,8 @@ static int dwc3_meson_g12a_otg_init(struct platform_device *pdev,
5539 + USB_R5_ID_DIG_IRQ, 0);
5540 +
5541 + irq = platform_get_irq(pdev, 0);
5542 ++ if (irq < 0)
5543 ++ return irq;
5544 + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
5545 + dwc3_meson_g12a_irq_thread,
5546 + IRQF_ONESHOT, pdev->name, priv);
5547 +diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
5548 +index 8bd077fb1190f..2a29e2f681fe6 100644
5549 +--- a/drivers/usb/dwc3/dwc3-qcom.c
5550 ++++ b/drivers/usb/dwc3/dwc3-qcom.c
5551 +@@ -610,6 +610,10 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
5552 + qcom->acpi_pdata->dwc3_core_base_size;
5553 +
5554 + irq = platform_get_irq(pdev_irq, 0);
5555 ++ if (irq < 0) {
5556 ++ ret = irq;
5557 ++ goto out;
5558 ++ }
5559 + child_res[1].flags = IORESOURCE_IRQ;
5560 + child_res[1].start = child_res[1].end = irq;
5561 +
5562 +diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
5563 +index eede5cedacb4a..d9ad9adf7348f 100644
5564 +--- a/drivers/usb/gadget/udc/at91_udc.c
5565 ++++ b/drivers/usb/gadget/udc/at91_udc.c
5566 +@@ -1876,7 +1876,9 @@ static int at91udc_probe(struct platform_device *pdev)
5567 + clk_disable(udc->iclk);
5568 +
5569 + /* request UDC and maybe VBUS irqs */
5570 +- udc->udp_irq = platform_get_irq(pdev, 0);
5571 ++ udc->udp_irq = retval = platform_get_irq(pdev, 0);
5572 ++ if (retval < 0)
5573 ++ goto err_unprepare_iclk;
5574 + retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0,
5575 + driver_name, udc);
5576 + if (retval) {
5577 +diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
5578 +index 0bef6b3f049b9..fa1a3908ec3bb 100644
5579 +--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
5580 ++++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
5581 +@@ -488,27 +488,14 @@ static int bdc_probe(struct platform_device *pdev)
5582 + int irq;
5583 + u32 temp;
5584 + struct device *dev = &pdev->dev;
5585 +- struct clk *clk;
5586 + int phy_num;
5587 +
5588 + dev_dbg(dev, "%s()\n", __func__);
5589 +
5590 +- clk = devm_clk_get_optional(dev, "sw_usbd");
5591 +- if (IS_ERR(clk))
5592 +- return PTR_ERR(clk);
5593 +-
5594 +- ret = clk_prepare_enable(clk);
5595 +- if (ret) {
5596 +- dev_err(dev, "could not enable clock\n");
5597 +- return ret;
5598 +- }
5599 +-
5600 + bdc = devm_kzalloc(dev, sizeof(*bdc), GFP_KERNEL);
5601 + if (!bdc)
5602 + return -ENOMEM;
5603 +
5604 +- bdc->clk = clk;
5605 +-
5606 + bdc->regs = devm_platform_ioremap_resource(pdev, 0);
5607 + if (IS_ERR(bdc->regs))
5608 + return PTR_ERR(bdc->regs);
5609 +@@ -545,10 +532,20 @@ static int bdc_probe(struct platform_device *pdev)
5610 + }
5611 + }
5612 +
5613 ++ bdc->clk = devm_clk_get_optional(dev, "sw_usbd");
5614 ++ if (IS_ERR(bdc->clk))
5615 ++ return PTR_ERR(bdc->clk);
5616 ++
5617 ++ ret = clk_prepare_enable(bdc->clk);
5618 ++ if (ret) {
5619 ++ dev_err(dev, "could not enable clock\n");
5620 ++ return ret;
5621 ++ }
5622 ++
5623 + ret = bdc_phy_init(bdc);
5624 + if (ret) {
5625 + dev_err(bdc->dev, "BDC phy init failure:%d\n", ret);
5626 +- return ret;
5627 ++ goto disable_clk;
5628 + }
5629 +
5630 + temp = bdc_readl(bdc->regs, BDC_BDCCAP1);
5631 +@@ -560,7 +557,8 @@ static int bdc_probe(struct platform_device *pdev)
5632 + if (ret) {
5633 + dev_err(dev,
5634 + "No suitable DMA config available, abort\n");
5635 +- return -ENOTSUPP;
5636 ++ ret = -ENOTSUPP;
5637 ++ goto phycleanup;
5638 + }
5639 + dev_dbg(dev, "Using 32-bit address\n");
5640 + }
5641 +@@ -580,6 +578,8 @@ cleanup:
5642 + bdc_hw_exit(bdc);
5643 + phycleanup:
5644 + bdc_phy_exit(bdc);
5645 ++disable_clk:
5646 ++ clk_disable_unprepare(bdc->clk);
5647 + return ret;
5648 + }
5649 +
5650 +diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c
5651 +index 5486f5a708681..0db97fecf99e8 100644
5652 +--- a/drivers/usb/gadget/udc/mv_u3d_core.c
5653 ++++ b/drivers/usb/gadget/udc/mv_u3d_core.c
5654 +@@ -1921,14 +1921,6 @@ static int mv_u3d_probe(struct platform_device *dev)
5655 + goto err_get_irq;
5656 + }
5657 + u3d->irq = r->start;
5658 +- if (request_irq(u3d->irq, mv_u3d_irq,
5659 +- IRQF_SHARED, driver_name, u3d)) {
5660 +- u3d->irq = 0;
5661 +- dev_err(&dev->dev, "Request irq %d for u3d failed\n",
5662 +- u3d->irq);
5663 +- retval = -ENODEV;
5664 +- goto err_request_irq;
5665 +- }
5666 +
5667 + /* initialize gadget structure */
5668 + u3d->gadget.ops = &mv_u3d_ops; /* usb_gadget_ops */
5669 +@@ -1941,6 +1933,15 @@ static int mv_u3d_probe(struct platform_device *dev)
5670 +
5671 + mv_u3d_eps_init(u3d);
5672 +
5673 ++ if (request_irq(u3d->irq, mv_u3d_irq,
5674 ++ IRQF_SHARED, driver_name, u3d)) {
5675 ++ u3d->irq = 0;
5676 ++ dev_err(&dev->dev, "Request irq %d for u3d failed\n",
5677 ++ u3d->irq);
5678 ++ retval = -ENODEV;
5679 ++ goto err_request_irq;
5680 ++ }
5681 ++
5682 + /* external vbus detection */
5683 + if (u3d->vbus) {
5684 + u3d->clock_gating = 1;
5685 +@@ -1964,8 +1965,8 @@ static int mv_u3d_probe(struct platform_device *dev)
5686 +
5687 + err_unregister:
5688 + free_irq(u3d->irq, u3d);
5689 +-err_request_irq:
5690 + err_get_irq:
5691 ++err_request_irq:
5692 + kfree(u3d->status_req);
5693 + err_alloc_status_req:
5694 + kfree(u3d->eps);
5695 +diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
5696 +index f1b35a39d1ba8..57d417a7c3e0a 100644
5697 +--- a/drivers/usb/gadget/udc/renesas_usb3.c
5698 ++++ b/drivers/usb/gadget/udc/renesas_usb3.c
5699 +@@ -2707,10 +2707,15 @@ static const struct renesas_usb3_priv renesas_usb3_priv_r8a77990 = {
5700 +
5701 + static const struct of_device_id usb3_of_match[] = {
5702 + {
5703 ++ .compatible = "renesas,r8a774c0-usb3-peri",
5704 ++ .data = &renesas_usb3_priv_r8a77990,
5705 ++ }, {
5706 + .compatible = "renesas,r8a7795-usb3-peri",
5707 + .data = &renesas_usb3_priv_gen3,
5708 +- },
5709 +- {
5710 ++ }, {
5711 ++ .compatible = "renesas,r8a77990-usb3-peri",
5712 ++ .data = &renesas_usb3_priv_r8a77990,
5713 ++ }, {
5714 + .compatible = "renesas,rcar-gen3-usb3-peri",
5715 + .data = &renesas_usb3_priv_gen3,
5716 + },
5717 +@@ -2719,18 +2724,10 @@ static const struct of_device_id usb3_of_match[] = {
5718 + MODULE_DEVICE_TABLE(of, usb3_of_match);
5719 +
5720 + static const struct soc_device_attribute renesas_usb3_quirks_match[] = {
5721 +- {
5722 +- .soc_id = "r8a774c0",
5723 +- .data = &renesas_usb3_priv_r8a77990,
5724 +- },
5725 + {
5726 + .soc_id = "r8a7795", .revision = "ES1.*",
5727 + .data = &renesas_usb3_priv_r8a7795_es1,
5728 + },
5729 +- {
5730 +- .soc_id = "r8a77990",
5731 +- .data = &renesas_usb3_priv_r8a77990,
5732 +- },
5733 + { /* sentinel */ },
5734 + };
5735 +
5736 +diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c
5737 +index b154b62abefa1..82c4f3fb2daec 100644
5738 +--- a/drivers/usb/gadget/udc/s3c2410_udc.c
5739 ++++ b/drivers/usb/gadget/udc/s3c2410_udc.c
5740 +@@ -1784,6 +1784,10 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
5741 + s3c2410_udc_reinit(udc);
5742 +
5743 + irq_usbd = platform_get_irq(pdev, 0);
5744 ++ if (irq_usbd < 0) {
5745 ++ retval = irq_usbd;
5746 ++ goto err_udc_clk;
5747 ++ }
5748 +
5749 + /* irq setup after old hardware state is cleaned up */
5750 + retval = request_irq(irq_usbd, s3c2410_udc_irq,
5751 +diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
5752 +index a319b1df3011c..3626758b3e2aa 100644
5753 +--- a/drivers/usb/host/ehci-orion.c
5754 ++++ b/drivers/usb/host/ehci-orion.c
5755 +@@ -264,8 +264,11 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
5756 + * the clock does not exists.
5757 + */
5758 + priv->clk = devm_clk_get(&pdev->dev, NULL);
5759 +- if (!IS_ERR(priv->clk))
5760 +- clk_prepare_enable(priv->clk);
5761 ++ if (!IS_ERR(priv->clk)) {
5762 ++ err = clk_prepare_enable(priv->clk);
5763 ++ if (err)
5764 ++ goto err_put_hcd;
5765 ++ }
5766 +
5767 + priv->phy = devm_phy_optional_get(&pdev->dev, "usb");
5768 + if (IS_ERR(priv->phy)) {
5769 +@@ -311,6 +314,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
5770 + err_dis_clk:
5771 + if (!IS_ERR(priv->clk))
5772 + clk_disable_unprepare(priv->clk);
5773 ++err_put_hcd:
5774 + usb_put_hcd(hcd);
5775 + err:
5776 + dev_err(&pdev->dev, "init %s fail, %d\n",
5777 +diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
5778 +index 7f857bad9e95b..08ec2ab0d95a5 100644
5779 +--- a/drivers/usb/host/ohci-tmio.c
5780 ++++ b/drivers/usb/host/ohci-tmio.c
5781 +@@ -202,6 +202,9 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
5782 + if (!cell)
5783 + return -EINVAL;
5784 +
5785 ++ if (irq < 0)
5786 ++ return irq;
5787 ++
5788 + hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev));
5789 + if (!hcd) {
5790 + ret = -ENOMEM;
5791 +diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
5792 +index f34c9437a182c..972704262b02b 100644
5793 +--- a/drivers/usb/phy/phy-fsl-usb.c
5794 ++++ b/drivers/usb/phy/phy-fsl-usb.c
5795 +@@ -873,6 +873,8 @@ int usb_otg_start(struct platform_device *pdev)
5796 +
5797 + /* request irq */
5798 + p_otg->irq = platform_get_irq(pdev, 0);
5799 ++ if (p_otg->irq < 0)
5800 ++ return p_otg->irq;
5801 + status = request_irq(p_otg->irq, fsl_otg_isr,
5802 + IRQF_SHARED, driver_name, p_otg);
5803 + if (status) {
5804 +diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
5805 +index baebb1f5a9737..a3e043e3e4aae 100644
5806 +--- a/drivers/usb/phy/phy-tahvo.c
5807 ++++ b/drivers/usb/phy/phy-tahvo.c
5808 +@@ -393,7 +393,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
5809 +
5810 + dev_set_drvdata(&pdev->dev, tu);
5811 +
5812 +- tu->irq = platform_get_irq(pdev, 0);
5813 ++ tu->irq = ret = platform_get_irq(pdev, 0);
5814 ++ if (ret < 0)
5815 ++ return ret;
5816 + ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
5817 + IRQF_ONESHOT,
5818 + "tahvo-vbus", tu);
5819 +diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
5820 +index 8ba6c5a915570..ab3c38a7d8ac0 100644
5821 +--- a/drivers/usb/phy/phy-twl6030-usb.c
5822 ++++ b/drivers/usb/phy/phy-twl6030-usb.c
5823 +@@ -348,6 +348,11 @@ static int twl6030_usb_probe(struct platform_device *pdev)
5824 + twl->irq2 = platform_get_irq(pdev, 1);
5825 + twl->linkstat = MUSB_UNKNOWN;
5826 +
5827 ++ if (twl->irq1 < 0)
5828 ++ return twl->irq1;
5829 ++ if (twl->irq2 < 0)
5830 ++ return twl->irq2;
5831 ++
5832 + twl->comparator.set_vbus = twl6030_set_vbus;
5833 + twl->comparator.start_srp = twl6030_start_srp;
5834 +
5835 +diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
5836 +index dfc760830eb90..1cf924f3aeccd 100644
5837 +--- a/drivers/video/backlight/pwm_bl.c
5838 ++++ b/drivers/video/backlight/pwm_bl.c
5839 +@@ -417,6 +417,33 @@ static bool pwm_backlight_is_linear(struct platform_pwm_backlight_data *data)
5840 + static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)
5841 + {
5842 + struct device_node *node = pb->dev->of_node;
5843 ++ bool active = true;
5844 ++
5845 ++ /*
5846 ++ * If the enable GPIO is present, observable (either as input
5847 ++ * or output) and off then the backlight is not currently active.
5848 ++ * */
5849 ++ if (pb->enable_gpio && gpiod_get_value_cansleep(pb->enable_gpio) == 0)
5850 ++ active = false;
5851 ++
5852 ++ if (!regulator_is_enabled(pb->power_supply))
5853 ++ active = false;
5854 ++
5855 ++ if (!pwm_is_enabled(pb->pwm))
5856 ++ active = false;
5857 ++
5858 ++ /*
5859 ++ * Synchronize the enable_gpio with the observed state of the
5860 ++ * hardware.
5861 ++ */
5862 ++ if (pb->enable_gpio)
5863 ++ gpiod_direction_output(pb->enable_gpio, active);
5864 ++
5865 ++ /*
5866 ++ * Do not change pb->enabled here! pb->enabled essentially
5867 ++ * tells us if we own one of the regulator's use counts and
5868 ++ * right now we do not.
5869 ++ */
5870 +
5871 + /* Not booted with device tree or no phandle link to the node */
5872 + if (!node || !node->phandle)
5873 +@@ -428,20 +455,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)
5874 + * assume that another driver will enable the backlight at the
5875 + * appropriate time. Therefore, if it is disabled, keep it so.
5876 + */
5877 +-
5878 +- /* if the enable GPIO is disabled, do not enable the backlight */
5879 +- if (pb->enable_gpio && gpiod_get_value_cansleep(pb->enable_gpio) == 0)
5880 +- return FB_BLANK_POWERDOWN;
5881 +-
5882 +- /* The regulator is disabled, do not enable the backlight */
5883 +- if (!regulator_is_enabled(pb->power_supply))
5884 +- return FB_BLANK_POWERDOWN;
5885 +-
5886 +- /* The PWM is disabled, keep it like this */
5887 +- if (!pwm_is_enabled(pb->pwm))
5888 +- return FB_BLANK_POWERDOWN;
5889 +-
5890 +- return FB_BLANK_UNBLANK;
5891 ++ return active ? FB_BLANK_UNBLANK: FB_BLANK_POWERDOWN;
5892 + }
5893 +
5894 + static int pwm_backlight_probe(struct platform_device *pdev)
5895 +@@ -494,18 +508,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
5896 + goto err_alloc;
5897 + }
5898 +
5899 +- /*
5900 +- * If the GPIO is not known to be already configured as output, that
5901 +- * is, if gpiod_get_direction returns either 1 or -EINVAL, change the
5902 +- * direction to output and set the GPIO as active.
5903 +- * Do not force the GPIO to active when it was already output as it
5904 +- * could cause backlight flickering or we would enable the backlight too
5905 +- * early. Leave the decision of the initial backlight state for later.
5906 +- */
5907 +- if (pb->enable_gpio &&
5908 +- gpiod_get_direction(pb->enable_gpio) != 0)
5909 +- gpiod_direction_output(pb->enable_gpio, 1);
5910 +-
5911 + pb->power_supply = devm_regulator_get(&pdev->dev, "power");
5912 + if (IS_ERR(pb->power_supply)) {
5913 + ret = PTR_ERR(pb->power_supply);
5914 +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
5915 +index 98030d75833b8..00939ca2065a9 100644
5916 +--- a/drivers/video/fbdev/core/fbmem.c
5917 ++++ b/drivers/video/fbdev/core/fbmem.c
5918 +@@ -962,6 +962,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
5919 + struct fb_var_screeninfo old_var;
5920 + struct fb_videomode mode;
5921 + struct fb_event event;
5922 ++ u32 unused;
5923 +
5924 + if (var->activate & FB_ACTIVATE_INV_MODE) {
5925 + struct fb_videomode mode1, mode2;
5926 +@@ -1008,6 +1009,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
5927 + if (var->xres < 8 || var->yres < 8)
5928 + return -EINVAL;
5929 +
5930 ++ /* Too huge resolution causes multiplication overflow. */
5931 ++ if (check_mul_overflow(var->xres, var->yres, &unused) ||
5932 ++ check_mul_overflow(var->xres_virtual, var->yres_virtual, &unused))
5933 ++ return -EINVAL;
5934 ++
5935 + ret = info->fbops->fb_check_var(var, info);
5936 +
5937 + if (ret)
5938 +diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
5939 +index 9bd03a2310328..171ad8b42107e 100644
5940 +--- a/fs/cifs/cifs_unicode.c
5941 ++++ b/fs/cifs/cifs_unicode.c
5942 +@@ -358,14 +358,9 @@ cifs_strndup_from_utf16(const char *src, const int maxlen,
5943 + if (!dst)
5944 + return NULL;
5945 + cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage,
5946 +- NO_MAP_UNI_RSVD);
5947 ++ NO_MAP_UNI_RSVD);
5948 + } else {
5949 +- len = strnlen(src, maxlen);
5950 +- len++;
5951 +- dst = kmalloc(len, GFP_KERNEL);
5952 +- if (!dst)
5953 +- return NULL;
5954 +- strlcpy(dst, src, len);
5955 ++ dst = kstrndup(src, maxlen, GFP_KERNEL);
5956 + }
5957 +
5958 + return dst;
5959 +diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
5960 +index 686e0ad287880..3aa5eb9ce498e 100644
5961 +--- a/fs/debugfs/file.c
5962 ++++ b/fs/debugfs/file.c
5963 +@@ -179,8 +179,10 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
5964 + if (!fops_get(real_fops)) {
5965 + #ifdef CONFIG_MODULES
5966 + if (real_fops->owner &&
5967 +- real_fops->owner->state == MODULE_STATE_GOING)
5968 ++ real_fops->owner->state == MODULE_STATE_GOING) {
5969 ++ r = -ENXIO;
5970 + goto out;
5971 ++ }
5972 + #endif
5973 +
5974 + /* Huh? Module did not clean up after itself at exit? */
5975 +@@ -314,8 +316,10 @@ static int full_proxy_open(struct inode *inode, struct file *filp)
5976 + if (!fops_get(real_fops)) {
5977 + #ifdef CONFIG_MODULES
5978 + if (real_fops->owner &&
5979 +- real_fops->owner->state == MODULE_STATE_GOING)
5980 ++ real_fops->owner->state == MODULE_STATE_GOING) {
5981 ++ r = -ENXIO;
5982 + goto out;
5983 ++ }
5984 + #endif
5985 +
5986 + /* Huh? Module did not cleanup after itself at exit? */
5987 +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
5988 +index 5c74b29971976..6ee8b1e0e1741 100644
5989 +--- a/fs/f2fs/file.c
5990 ++++ b/fs/f2fs/file.c
5991 +@@ -259,8 +259,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
5992 + };
5993 + unsigned int seq_id = 0;
5994 +
5995 +- if (unlikely(f2fs_readonly(inode->i_sb) ||
5996 +- is_sbi_flag_set(sbi, SBI_CP_DISABLED)))
5997 ++ if (unlikely(f2fs_readonly(inode->i_sb)))
5998 + return 0;
5999 +
6000 + trace_f2fs_sync_file_enter(inode);
6001 +@@ -274,7 +273,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
6002 + ret = file_write_and_wait_range(file, start, end);
6003 + clear_inode_flag(inode, FI_NEED_IPU);
6004 +
6005 +- if (ret) {
6006 ++ if (ret || is_sbi_flag_set(sbi, SBI_CP_DISABLED)) {
6007 + trace_f2fs_sync_file_exit(inode, cp_reason, datasync, ret);
6008 + return ret;
6009 + }
6010 +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
6011 +index c529880678878..476b2c497d282 100644
6012 +--- a/fs/f2fs/super.c
6013 ++++ b/fs/f2fs/super.c
6014 +@@ -1764,8 +1764,17 @@ restore_flag:
6015 +
6016 + static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
6017 + {
6018 ++ int retry = DEFAULT_RETRY_IO_COUNT;
6019 ++
6020 + /* we should flush all the data to keep data consistency */
6021 +- sync_inodes_sb(sbi->sb);
6022 ++ do {
6023 ++ sync_inodes_sb(sbi->sb);
6024 ++ cond_resched();
6025 ++ congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT);
6026 ++ } while (get_pages(sbi, F2FS_DIRTY_DATA) && retry--);
6027 ++
6028 ++ if (unlikely(retry < 0))
6029 ++ f2fs_warn(sbi, "checkpoint=enable has some unwritten data.");
6030 +
6031 + down_write(&sbi->gc_lock);
6032 + f2fs_dirty_to_prefree(sbi);
6033 +diff --git a/fs/fcntl.c b/fs/fcntl.c
6034 +index 05b36b28f2e87..71b43538fa44c 100644
6035 +--- a/fs/fcntl.c
6036 ++++ b/fs/fcntl.c
6037 +@@ -995,13 +995,14 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
6038 + {
6039 + while (fa) {
6040 + struct fown_struct *fown;
6041 ++ unsigned long flags;
6042 +
6043 + if (fa->magic != FASYNC_MAGIC) {
6044 + printk(KERN_ERR "kill_fasync: bad magic number in "
6045 + "fasync_struct!\n");
6046 + return;
6047 + }
6048 +- read_lock(&fa->fa_lock);
6049 ++ read_lock_irqsave(&fa->fa_lock, flags);
6050 + if (fa->fa_file) {
6051 + fown = &fa->fa_file->f_owner;
6052 + /* Don't send SIGURG to processes which have not set a
6053 +@@ -1010,7 +1011,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
6054 + if (!(sig == SIGURG && fown->signum == 0))
6055 + send_sigio(fown, fa->fa_fd, band);
6056 + }
6057 +- read_unlock(&fa->fa_lock);
6058 ++ read_unlock_irqrestore(&fa->fa_lock, flags);
6059 + fa = rcu_dereference(fa->fa_next);
6060 + }
6061 + }
6062 +diff --git a/fs/fuse/file.c b/fs/fuse/file.c
6063 +index 8de9c24ac4ac6..c9606f2d2864d 100644
6064 +--- a/fs/fuse/file.c
6065 ++++ b/fs/fuse/file.c
6066 +@@ -194,12 +194,11 @@ void fuse_finish_open(struct inode *inode, struct file *file)
6067 + struct fuse_file *ff = file->private_data;
6068 + struct fuse_conn *fc = get_fuse_conn(inode);
6069 +
6070 +- if (!(ff->open_flags & FOPEN_KEEP_CACHE))
6071 +- invalidate_inode_pages2(inode->i_mapping);
6072 + if (ff->open_flags & FOPEN_STREAM)
6073 + stream_open(inode, file);
6074 + else if (ff->open_flags & FOPEN_NONSEEKABLE)
6075 + nonseekable_open(inode, file);
6076 ++
6077 + if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) {
6078 + struct fuse_inode *fi = get_fuse_inode(inode);
6079 +
6080 +@@ -207,10 +206,14 @@ void fuse_finish_open(struct inode *inode, struct file *file)
6081 + fi->attr_version = atomic64_inc_return(&fc->attr_version);
6082 + i_size_write(inode, 0);
6083 + spin_unlock(&fi->lock);
6084 ++ truncate_pagecache(inode, 0);
6085 + fuse_invalidate_attr(inode);
6086 + if (fc->writeback_cache)
6087 + file_update_time(file);
6088 ++ } else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) {
6089 ++ invalidate_inode_pages2(inode->i_mapping);
6090 + }
6091 ++
6092 + if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache)
6093 + fuse_link_write_file(file);
6094 + }
6095 +@@ -3237,7 +3240,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
6096 +
6097 + static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end)
6098 + {
6099 +- int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
6100 ++ int err = filemap_write_and_wait_range(inode->i_mapping, start, -1);
6101 +
6102 + if (!err)
6103 + fuse_sync_writes(inode);
6104 +diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
6105 +index ae9c5c1bdc508..b9ed6a6dbcf51 100644
6106 +--- a/fs/gfs2/ops_fstype.c
6107 ++++ b/fs/gfs2/ops_fstype.c
6108 +@@ -660,6 +660,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
6109 + error = PTR_ERR(lsi->si_sc_inode);
6110 + fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
6111 + jd->jd_jid, error);
6112 ++ kfree(lsi);
6113 + goto free_local;
6114 + }
6115 + lsi->si_jid = jd->jd_jid;
6116 +@@ -1071,6 +1072,34 @@ void gfs2_online_uevent(struct gfs2_sbd *sdp)
6117 + kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp);
6118 + }
6119 +
6120 ++static int init_threads(struct gfs2_sbd *sdp)
6121 ++{
6122 ++ struct task_struct *p;
6123 ++ int error = 0;
6124 ++
6125 ++ p = kthread_run(gfs2_logd, sdp, "gfs2_logd");
6126 ++ if (IS_ERR(p)) {
6127 ++ error = PTR_ERR(p);
6128 ++ fs_err(sdp, "can't start logd thread: %d\n", error);
6129 ++ return error;
6130 ++ }
6131 ++ sdp->sd_logd_process = p;
6132 ++
6133 ++ p = kthread_run(gfs2_quotad, sdp, "gfs2_quotad");
6134 ++ if (IS_ERR(p)) {
6135 ++ error = PTR_ERR(p);
6136 ++ fs_err(sdp, "can't start quotad thread: %d\n", error);
6137 ++ goto fail;
6138 ++ }
6139 ++ sdp->sd_quotad_process = p;
6140 ++ return 0;
6141 ++
6142 ++fail:
6143 ++ kthread_stop(sdp->sd_logd_process);
6144 ++ sdp->sd_logd_process = NULL;
6145 ++ return error;
6146 ++}
6147 ++
6148 + /**
6149 + * gfs2_fill_super - Read in superblock
6150 + * @sb: The VFS superblock
6151 +@@ -1197,6 +1226,14 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
6152 + goto fail_per_node;
6153 + }
6154 +
6155 ++ if (!sb_rdonly(sb)) {
6156 ++ error = init_threads(sdp);
6157 ++ if (error) {
6158 ++ gfs2_withdraw_delayed(sdp);
6159 ++ goto fail_per_node;
6160 ++ }
6161 ++ }
6162 ++
6163 + error = gfs2_freeze_lock(sdp, &freeze_gh, 0);
6164 + if (error)
6165 + goto fail_per_node;
6166 +@@ -1206,6 +1243,12 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
6167 +
6168 + gfs2_freeze_unlock(&freeze_gh);
6169 + if (error) {
6170 ++ if (sdp->sd_quotad_process)
6171 ++ kthread_stop(sdp->sd_quotad_process);
6172 ++ sdp->sd_quotad_process = NULL;
6173 ++ if (sdp->sd_logd_process)
6174 ++ kthread_stop(sdp->sd_logd_process);
6175 ++ sdp->sd_logd_process = NULL;
6176 + fs_err(sdp, "can't make FS RW: %d\n", error);
6177 + goto fail_per_node;
6178 + }
6179 +diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
6180 +index 077dc8c035a8b..6a355e1347d7f 100644
6181 +--- a/fs/gfs2/super.c
6182 ++++ b/fs/gfs2/super.c
6183 +@@ -126,34 +126,6 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
6184 + return 0;
6185 + }
6186 +
6187 +-static int init_threads(struct gfs2_sbd *sdp)
6188 +-{
6189 +- struct task_struct *p;
6190 +- int error = 0;
6191 +-
6192 +- p = kthread_run(gfs2_logd, sdp, "gfs2_logd");
6193 +- if (IS_ERR(p)) {
6194 +- error = PTR_ERR(p);
6195 +- fs_err(sdp, "can't start logd thread: %d\n", error);
6196 +- return error;
6197 +- }
6198 +- sdp->sd_logd_process = p;
6199 +-
6200 +- p = kthread_run(gfs2_quotad, sdp, "gfs2_quotad");
6201 +- if (IS_ERR(p)) {
6202 +- error = PTR_ERR(p);
6203 +- fs_err(sdp, "can't start quotad thread: %d\n", error);
6204 +- goto fail;
6205 +- }
6206 +- sdp->sd_quotad_process = p;
6207 +- return 0;
6208 +-
6209 +-fail:
6210 +- kthread_stop(sdp->sd_logd_process);
6211 +- sdp->sd_logd_process = NULL;
6212 +- return error;
6213 +-}
6214 +-
6215 + /**
6216 + * gfs2_make_fs_rw - Turn a Read-Only FS into a Read-Write one
6217 + * @sdp: the filesystem
6218 +@@ -168,26 +140,17 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
6219 + struct gfs2_log_header_host head;
6220 + int error;
6221 +
6222 +- error = init_threads(sdp);
6223 +- if (error) {
6224 +- gfs2_withdraw_delayed(sdp);
6225 +- return error;
6226 +- }
6227 +-
6228 + j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
6229 +- if (gfs2_withdrawn(sdp)) {
6230 +- error = -EIO;
6231 +- goto fail;
6232 +- }
6233 ++ if (gfs2_withdrawn(sdp))
6234 ++ return -EIO;
6235 +
6236 + error = gfs2_find_jhead(sdp->sd_jdesc, &head, false);
6237 + if (error || gfs2_withdrawn(sdp))
6238 +- goto fail;
6239 ++ return error;
6240 +
6241 + if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
6242 + gfs2_consist(sdp);
6243 +- error = -EIO;
6244 +- goto fail;
6245 ++ return -EIO;
6246 + }
6247 +
6248 + /* Initialize some head of the log stuff */
6249 +@@ -195,20 +158,8 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
6250 + gfs2_log_pointers_init(sdp, head.lh_blkno);
6251 +
6252 + error = gfs2_quota_init(sdp);
6253 +- if (error || gfs2_withdrawn(sdp))
6254 +- goto fail;
6255 +-
6256 +- set_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
6257 +-
6258 +- return 0;
6259 +-
6260 +-fail:
6261 +- if (sdp->sd_quotad_process)
6262 +- kthread_stop(sdp->sd_quotad_process);
6263 +- sdp->sd_quotad_process = NULL;
6264 +- if (sdp->sd_logd_process)
6265 +- kthread_stop(sdp->sd_logd_process);
6266 +- sdp->sd_logd_process = NULL;
6267 ++ if (!error && !gfs2_withdrawn(sdp))
6268 ++ set_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
6269 + return error;
6270 + }
6271 +
6272 +diff --git a/fs/io_uring.c b/fs/io_uring.c
6273 +index 108b0ed31c11a..2009d1cda606c 100644
6274 +--- a/fs/io_uring.c
6275 ++++ b/fs/io_uring.c
6276 +@@ -889,6 +889,7 @@ static const struct io_op_def io_op_defs[] = {
6277 + },
6278 + [IORING_OP_WRITE] = {
6279 + .needs_file = 1,
6280 ++ .hash_reg_file = 1,
6281 + .unbound_nonreg_file = 1,
6282 + .pollout = 1,
6283 + .async_size = sizeof(struct io_async_rw),
6284 +diff --git a/fs/iomap/swapfile.c b/fs/iomap/swapfile.c
6285 +index a5e478de14174..2ceea45aefd8c 100644
6286 +--- a/fs/iomap/swapfile.c
6287 ++++ b/fs/iomap/swapfile.c
6288 +@@ -30,11 +30,16 @@ static int iomap_swapfile_add_extent(struct iomap_swapfile_info *isi)
6289 + {
6290 + struct iomap *iomap = &isi->iomap;
6291 + unsigned long nr_pages;
6292 ++ unsigned long max_pages;
6293 + uint64_t first_ppage;
6294 + uint64_t first_ppage_reported;
6295 + uint64_t next_ppage;
6296 + int error;
6297 +
6298 ++ if (unlikely(isi->nr_pages >= isi->sis->max))
6299 ++ return 0;
6300 ++ max_pages = isi->sis->max - isi->nr_pages;
6301 ++
6302 + /*
6303 + * Round the start up and the end down so that the physical
6304 + * extent aligns to a page boundary.
6305 +@@ -47,6 +52,7 @@ static int iomap_swapfile_add_extent(struct iomap_swapfile_info *isi)
6306 + if (first_ppage >= next_ppage)
6307 + return 0;
6308 + nr_pages = next_ppage - first_ppage;
6309 ++ nr_pages = min(nr_pages, max_pages);
6310 +
6311 + /*
6312 + * Calculate how much swap space we're adding; the first page contains
6313 +diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
6314 +index ec90773527eea..35675a1065be8 100644
6315 +--- a/fs/isofs/inode.c
6316 ++++ b/fs/isofs/inode.c
6317 +@@ -155,7 +155,6 @@ struct iso9660_options{
6318 + unsigned int overriderockperm:1;
6319 + unsigned int uid_set:1;
6320 + unsigned int gid_set:1;
6321 +- unsigned int utf8:1;
6322 + unsigned char map;
6323 + unsigned char check;
6324 + unsigned int blocksize;
6325 +@@ -355,7 +354,6 @@ static int parse_options(char *options, struct iso9660_options *popt)
6326 + popt->gid = GLOBAL_ROOT_GID;
6327 + popt->uid = GLOBAL_ROOT_UID;
6328 + popt->iocharset = NULL;
6329 +- popt->utf8 = 0;
6330 + popt->overriderockperm = 0;
6331 + popt->session=-1;
6332 + popt->sbsector=-1;
6333 +@@ -388,10 +386,13 @@ static int parse_options(char *options, struct iso9660_options *popt)
6334 + case Opt_cruft:
6335 + popt->cruft = 1;
6336 + break;
6337 ++#ifdef CONFIG_JOLIET
6338 + case Opt_utf8:
6339 +- popt->utf8 = 1;
6340 ++ kfree(popt->iocharset);
6341 ++ popt->iocharset = kstrdup("utf8", GFP_KERNEL);
6342 ++ if (!popt->iocharset)
6343 ++ return 0;
6344 + break;
6345 +-#ifdef CONFIG_JOLIET
6346 + case Opt_iocharset:
6347 + kfree(popt->iocharset);
6348 + popt->iocharset = match_strdup(&args[0]);
6349 +@@ -494,7 +495,6 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)
6350 + if (sbi->s_nocompress) seq_puts(m, ",nocompress");
6351 + if (sbi->s_overriderockperm) seq_puts(m, ",overriderockperm");
6352 + if (sbi->s_showassoc) seq_puts(m, ",showassoc");
6353 +- if (sbi->s_utf8) seq_puts(m, ",utf8");
6354 +
6355 + if (sbi->s_check) seq_printf(m, ",check=%c", sbi->s_check);
6356 + if (sbi->s_mapping) seq_printf(m, ",map=%c", sbi->s_mapping);
6357 +@@ -517,9 +517,10 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)
6358 + seq_printf(m, ",fmode=%o", sbi->s_fmode);
6359 +
6360 + #ifdef CONFIG_JOLIET
6361 +- if (sbi->s_nls_iocharset &&
6362 +- strcmp(sbi->s_nls_iocharset->charset, CONFIG_NLS_DEFAULT) != 0)
6363 ++ if (sbi->s_nls_iocharset)
6364 + seq_printf(m, ",iocharset=%s", sbi->s_nls_iocharset->charset);
6365 ++ else
6366 ++ seq_puts(m, ",iocharset=utf8");
6367 + #endif
6368 + return 0;
6369 + }
6370 +@@ -862,14 +863,13 @@ root_found:
6371 + sbi->s_nls_iocharset = NULL;
6372 +
6373 + #ifdef CONFIG_JOLIET
6374 +- if (joliet_level && opt.utf8 == 0) {
6375 ++ if (joliet_level) {
6376 + char *p = opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT;
6377 +- sbi->s_nls_iocharset = load_nls(p);
6378 +- if (! sbi->s_nls_iocharset) {
6379 +- /* Fail only if explicit charset specified */
6380 +- if (opt.iocharset)
6381 ++ if (strcmp(p, "utf8") != 0) {
6382 ++ sbi->s_nls_iocharset = opt.iocharset ?
6383 ++ load_nls(opt.iocharset) : load_nls_default();
6384 ++ if (!sbi->s_nls_iocharset)
6385 + goto out_freesbi;
6386 +- sbi->s_nls_iocharset = load_nls_default();
6387 + }
6388 + }
6389 + #endif
6390 +@@ -885,7 +885,6 @@ root_found:
6391 + sbi->s_gid = opt.gid;
6392 + sbi->s_uid_set = opt.uid_set;
6393 + sbi->s_gid_set = opt.gid_set;
6394 +- sbi->s_utf8 = opt.utf8;
6395 + sbi->s_nocompress = opt.nocompress;
6396 + sbi->s_overriderockperm = opt.overriderockperm;
6397 + /*
6398 +diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
6399 +index 055ec6c586f7f..dcdc191ed1834 100644
6400 +--- a/fs/isofs/isofs.h
6401 ++++ b/fs/isofs/isofs.h
6402 +@@ -44,7 +44,6 @@ struct isofs_sb_info {
6403 + unsigned char s_session;
6404 + unsigned int s_high_sierra:1;
6405 + unsigned int s_rock:2;
6406 +- unsigned int s_utf8:1;
6407 + unsigned int s_cruft:1; /* Broken disks with high byte of length
6408 + * containing junk */
6409 + unsigned int s_nocompress:1;
6410 +diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c
6411 +index be8b6a9d0b926..c0f04a1e7f695 100644
6412 +--- a/fs/isofs/joliet.c
6413 ++++ b/fs/isofs/joliet.c
6414 +@@ -41,14 +41,12 @@ uni16_to_x8(unsigned char *ascii, __be16 *uni, int len, struct nls_table *nls)
6415 + int
6416 + get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, struct inode * inode)
6417 + {
6418 +- unsigned char utf8;
6419 + struct nls_table *nls;
6420 + unsigned char len = 0;
6421 +
6422 +- utf8 = ISOFS_SB(inode->i_sb)->s_utf8;
6423 + nls = ISOFS_SB(inode->i_sb)->s_nls_iocharset;
6424 +
6425 +- if (utf8) {
6426 ++ if (!nls) {
6427 + len = utf16s_to_utf8s((const wchar_t *) de->name,
6428 + de->name_len[0] >> 1, UTF16_BIG_ENDIAN,
6429 + outname, PAGE_SIZE);
6430 +diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
6431 +index 61d3cc2283dc8..498cb70c2c0d0 100644
6432 +--- a/fs/lockd/svclock.c
6433 ++++ b/fs/lockd/svclock.c
6434 +@@ -634,7 +634,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
6435 + conflock->caller = "somehost"; /* FIXME */
6436 + conflock->len = strlen(conflock->caller);
6437 + conflock->oh.len = 0; /* don't return OH info */
6438 +- conflock->svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid;
6439 ++ conflock->svid = lock->fl.fl_pid;
6440 + conflock->fl.fl_type = lock->fl.fl_type;
6441 + conflock->fl.fl_start = lock->fl.fl_start;
6442 + conflock->fl.fl_end = lock->fl.fl_end;
6443 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
6444 +index 80e394a2e3fd7..142aac9b63a89 100644
6445 +--- a/fs/nfsd/nfs4state.c
6446 ++++ b/fs/nfsd/nfs4state.c
6447 +@@ -2646,9 +2646,9 @@ static void force_expire_client(struct nfs4_client *clp)
6448 + struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
6449 + bool already_expired;
6450 +
6451 +- spin_lock(&clp->cl_lock);
6452 ++ spin_lock(&nn->client_lock);
6453 + clp->cl_time = 0;
6454 +- spin_unlock(&clp->cl_lock);
6455 ++ spin_unlock(&nn->client_lock);
6456 +
6457 + wait_event(expiry_wq, atomic_read(&clp->cl_rpc_users) == 0);
6458 + spin_lock(&nn->client_lock);
6459 +diff --git a/fs/udf/misc.c b/fs/udf/misc.c
6460 +index eab94527340dc..1614d308d0f06 100644
6461 +--- a/fs/udf/misc.c
6462 ++++ b/fs/udf/misc.c
6463 +@@ -173,13 +173,22 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,
6464 + else
6465 + offset = le32_to_cpu(eahd->appAttrLocation);
6466 +
6467 +- while (offset < iinfo->i_lenEAttr) {
6468 ++ while (offset + sizeof(*gaf) < iinfo->i_lenEAttr) {
6469 ++ uint32_t attrLength;
6470 ++
6471 + gaf = (struct genericFormat *)&ea[offset];
6472 ++ attrLength = le32_to_cpu(gaf->attrLength);
6473 ++
6474 ++ /* Detect undersized elements and buffer overflows */
6475 ++ if ((attrLength < sizeof(*gaf)) ||
6476 ++ (attrLength > (iinfo->i_lenEAttr - offset)))
6477 ++ break;
6478 ++
6479 + if (le32_to_cpu(gaf->attrType) == type &&
6480 + gaf->attrSubtype == subtype)
6481 + return gaf;
6482 + else
6483 +- offset += le32_to_cpu(gaf->attrLength);
6484 ++ offset += attrLength;
6485 + }
6486 + }
6487 +
6488 +diff --git a/fs/udf/super.c b/fs/udf/super.c
6489 +index d0df217f4712a..5d2b820ef303a 100644
6490 +--- a/fs/udf/super.c
6491 ++++ b/fs/udf/super.c
6492 +@@ -108,16 +108,10 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb)
6493 + return NULL;
6494 + lvid = (struct logicalVolIntegrityDesc *)UDF_SB(sb)->s_lvid_bh->b_data;
6495 + partnum = le32_to_cpu(lvid->numOfPartitions);
6496 +- if ((sb->s_blocksize - sizeof(struct logicalVolIntegrityDescImpUse) -
6497 +- offsetof(struct logicalVolIntegrityDesc, impUse)) /
6498 +- (2 * sizeof(uint32_t)) < partnum) {
6499 +- udf_err(sb, "Logical volume integrity descriptor corrupted "
6500 +- "(numOfPartitions = %u)!\n", partnum);
6501 +- return NULL;
6502 +- }
6503 + /* The offset is to skip freeSpaceTable and sizeTable arrays */
6504 + offset = partnum * 2 * sizeof(uint32_t);
6505 +- return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]);
6506 ++ return (struct logicalVolIntegrityDescImpUse *)
6507 ++ (((uint8_t *)(lvid + 1)) + offset);
6508 + }
6509 +
6510 + /* UDF filesystem type */
6511 +@@ -349,10 +343,10 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
6512 + seq_printf(seq, ",lastblock=%u", sbi->s_last_block);
6513 + if (sbi->s_anchor != 0)
6514 + seq_printf(seq, ",anchor=%u", sbi->s_anchor);
6515 +- if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8))
6516 +- seq_puts(seq, ",utf8");
6517 +- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP) && sbi->s_nls_map)
6518 ++ if (sbi->s_nls_map)
6519 + seq_printf(seq, ",iocharset=%s", sbi->s_nls_map->charset);
6520 ++ else
6521 ++ seq_puts(seq, ",iocharset=utf8");
6522 +
6523 + return 0;
6524 + }
6525 +@@ -557,19 +551,24 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
6526 + /* Ignored (never implemented properly) */
6527 + break;
6528 + case Opt_utf8:
6529 +- uopt->flags |= (1 << UDF_FLAG_UTF8);
6530 ++ if (!remount) {
6531 ++ unload_nls(uopt->nls_map);
6532 ++ uopt->nls_map = NULL;
6533 ++ }
6534 + break;
6535 + case Opt_iocharset:
6536 + if (!remount) {
6537 +- if (uopt->nls_map)
6538 +- unload_nls(uopt->nls_map);
6539 +- /*
6540 +- * load_nls() failure is handled later in
6541 +- * udf_fill_super() after all options are
6542 +- * parsed.
6543 +- */
6544 ++ unload_nls(uopt->nls_map);
6545 ++ uopt->nls_map = NULL;
6546 ++ }
6547 ++ /* When nls_map is not loaded then UTF-8 is used */
6548 ++ if (!remount && strcmp(args[0].from, "utf8") != 0) {
6549 + uopt->nls_map = load_nls(args[0].from);
6550 +- uopt->flags |= (1 << UDF_FLAG_NLS_MAP);
6551 ++ if (!uopt->nls_map) {
6552 ++ pr_err("iocharset %s not found\n",
6553 ++ args[0].from);
6554 ++ return 0;
6555 ++ }
6556 + }
6557 + break;
6558 + case Opt_uforget:
6559 +@@ -1541,6 +1540,7 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_
6560 + struct udf_sb_info *sbi = UDF_SB(sb);
6561 + struct logicalVolIntegrityDesc *lvid;
6562 + int indirections = 0;
6563 ++ u32 parts, impuselen;
6564 +
6565 + while (++indirections <= UDF_MAX_LVID_NESTING) {
6566 + final_bh = NULL;
6567 +@@ -1567,15 +1567,27 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_
6568 +
6569 + lvid = (struct logicalVolIntegrityDesc *)final_bh->b_data;
6570 + if (lvid->nextIntegrityExt.extLength == 0)
6571 +- return;
6572 ++ goto check;
6573 +
6574 + loc = leea_to_cpu(lvid->nextIntegrityExt);
6575 + }
6576 +
6577 + udf_warn(sb, "Too many LVID indirections (max %u), ignoring.\n",
6578 + UDF_MAX_LVID_NESTING);
6579 ++out_err:
6580 + brelse(sbi->s_lvid_bh);
6581 + sbi->s_lvid_bh = NULL;
6582 ++ return;
6583 ++check:
6584 ++ parts = le32_to_cpu(lvid->numOfPartitions);
6585 ++ impuselen = le32_to_cpu(lvid->lengthOfImpUse);
6586 ++ if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize ||
6587 ++ sizeof(struct logicalVolIntegrityDesc) + impuselen +
6588 ++ 2 * parts * sizeof(u32) > sb->s_blocksize) {
6589 ++ udf_warn(sb, "Corrupted LVID (parts=%u, impuselen=%u), "
6590 ++ "ignoring.\n", parts, impuselen);
6591 ++ goto out_err;
6592 ++ }
6593 + }
6594 +
6595 + /*
6596 +@@ -2138,21 +2150,6 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
6597 + if (!udf_parse_options((char *)options, &uopt, false))
6598 + goto parse_options_failure;
6599 +
6600 +- if (uopt.flags & (1 << UDF_FLAG_UTF8) &&
6601 +- uopt.flags & (1 << UDF_FLAG_NLS_MAP)) {
6602 +- udf_err(sb, "utf8 cannot be combined with iocharset\n");
6603 +- goto parse_options_failure;
6604 +- }
6605 +- if ((uopt.flags & (1 << UDF_FLAG_NLS_MAP)) && !uopt.nls_map) {
6606 +- uopt.nls_map = load_nls_default();
6607 +- if (!uopt.nls_map)
6608 +- uopt.flags &= ~(1 << UDF_FLAG_NLS_MAP);
6609 +- else
6610 +- udf_debug("Using default NLS map\n");
6611 +- }
6612 +- if (!(uopt.flags & (1 << UDF_FLAG_NLS_MAP)))
6613 +- uopt.flags |= (1 << UDF_FLAG_UTF8);
6614 +-
6615 + fileset.logicalBlockNum = 0xFFFFFFFF;
6616 + fileset.partitionReferenceNum = 0xFFFF;
6617 +
6618 +@@ -2307,8 +2304,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
6619 + error_out:
6620 + iput(sbi->s_vat_inode);
6621 + parse_options_failure:
6622 +- if (uopt.nls_map)
6623 +- unload_nls(uopt.nls_map);
6624 ++ unload_nls(uopt.nls_map);
6625 + if (lvid_open)
6626 + udf_close_lvid(sb);
6627 + brelse(sbi->s_lvid_bh);
6628 +@@ -2358,8 +2354,7 @@ static void udf_put_super(struct super_block *sb)
6629 + sbi = UDF_SB(sb);
6630 +
6631 + iput(sbi->s_vat_inode);
6632 +- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
6633 +- unload_nls(sbi->s_nls_map);
6634 ++ unload_nls(sbi->s_nls_map);
6635 + if (!sb_rdonly(sb))
6636 + udf_close_lvid(sb);
6637 + brelse(sbi->s_lvid_bh);
6638 +diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
6639 +index 758efe557a199..4fa620543d302 100644
6640 +--- a/fs/udf/udf_sb.h
6641 ++++ b/fs/udf/udf_sb.h
6642 +@@ -20,8 +20,6 @@
6643 + #define UDF_FLAG_UNDELETE 6
6644 + #define UDF_FLAG_UNHIDE 7
6645 + #define UDF_FLAG_VARCONV 8
6646 +-#define UDF_FLAG_NLS_MAP 9
6647 +-#define UDF_FLAG_UTF8 10
6648 + #define UDF_FLAG_UID_FORGET 11 /* save -1 for uid to disk */
6649 + #define UDF_FLAG_GID_FORGET 12
6650 + #define UDF_FLAG_UID_SET 13
6651 +diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
6652 +index 5fcfa96463ebb..622569007b530 100644
6653 +--- a/fs/udf/unicode.c
6654 ++++ b/fs/udf/unicode.c
6655 +@@ -177,7 +177,7 @@ static int udf_name_from_CS0(struct super_block *sb,
6656 + return 0;
6657 + }
6658 +
6659 +- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
6660 ++ if (UDF_SB(sb)->s_nls_map)
6661 + conv_f = UDF_SB(sb)->s_nls_map->uni2char;
6662 + else
6663 + conv_f = NULL;
6664 +@@ -285,7 +285,7 @@ static int udf_name_to_CS0(struct super_block *sb,
6665 + if (ocu_max_len <= 0)
6666 + return 0;
6667 +
6668 +- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
6669 ++ if (UDF_SB(sb)->s_nls_map)
6670 + conv_f = UDF_SB(sb)->s_nls_map->char2uni;
6671 + else
6672 + conv_f = NULL;
6673 +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
6674 +index 542471b76f410..8aae375864b6b 100644
6675 +--- a/include/linux/blkdev.h
6676 ++++ b/include/linux/blkdev.h
6677 +@@ -1534,6 +1534,22 @@ static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector
6678 + return offset << SECTOR_SHIFT;
6679 + }
6680 +
6681 ++/*
6682 ++ * Two cases of handling DISCARD merge:
6683 ++ * If max_discard_segments > 1, the driver takes every bio
6684 ++ * as a range and send them to controller together. The ranges
6685 ++ * needn't to be contiguous.
6686 ++ * Otherwise, the bios/requests will be handled as same as
6687 ++ * others which should be contiguous.
6688 ++ */
6689 ++static inline bool blk_discard_mergable(struct request *req)
6690 ++{
6691 ++ if (req_op(req) == REQ_OP_DISCARD &&
6692 ++ queue_max_discard_segments(req->q) > 1)
6693 ++ return true;
6694 ++ return false;
6695 ++}
6696 ++
6697 + static inline int bdev_discard_alignment(struct block_device *bdev)
6698 + {
6699 + struct request_queue *q = bdev_get_queue(bdev);
6700 +diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
6701 +index b67a51c574b97..5f04a2b35e80b 100644
6702 +--- a/include/linux/energy_model.h
6703 ++++ b/include/linux/energy_model.h
6704 +@@ -51,6 +51,22 @@ struct em_perf_domain {
6705 + #ifdef CONFIG_ENERGY_MODEL
6706 + #define EM_MAX_POWER 0xFFFF
6707 +
6708 ++/*
6709 ++ * Increase resolution of energy estimation calculations for 64-bit
6710 ++ * architectures. The extra resolution improves decision made by EAS for the
6711 ++ * task placement when two Performance Domains might provide similar energy
6712 ++ * estimation values (w/o better resolution the values could be equal).
6713 ++ *
6714 ++ * We increase resolution only if we have enough bits to allow this increased
6715 ++ * resolution (i.e. 64-bit). The costs for increasing resolution when 32-bit
6716 ++ * are pretty high and the returns do not justify the increased costs.
6717 ++ */
6718 ++#ifdef CONFIG_64BIT
6719 ++#define em_scale_power(p) ((p) * 1000)
6720 ++#else
6721 ++#define em_scale_power(p) (p)
6722 ++#endif
6723 ++
6724 + struct em_data_callback {
6725 + /**
6726 + * active_power() - Provide power at the next performance state of
6727 +diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
6728 +index 107cedd7019a4..7f1b8549ebcee 100644
6729 +--- a/include/linux/hrtimer.h
6730 ++++ b/include/linux/hrtimer.h
6731 +@@ -318,16 +318,12 @@ struct clock_event_device;
6732 +
6733 + extern void hrtimer_interrupt(struct clock_event_device *dev);
6734 +
6735 +-extern void clock_was_set_delayed(void);
6736 +-
6737 + extern unsigned int hrtimer_resolution;
6738 +
6739 + #else
6740 +
6741 + #define hrtimer_resolution (unsigned int)LOW_RES_NSEC
6742 +
6743 +-static inline void clock_was_set_delayed(void) { }
6744 +-
6745 + #endif
6746 +
6747 + static inline ktime_t
6748 +@@ -351,7 +347,6 @@ hrtimer_expires_remaining_adjusted(const struct hrtimer *timer)
6749 + timer->base->get_time());
6750 + }
6751 +
6752 +-extern void clock_was_set(void);
6753 + #ifdef CONFIG_TIMERFD
6754 + extern void timerfd_clock_was_set(void);
6755 + #else
6756 +diff --git a/include/linux/local_lock_internal.h b/include/linux/local_lock_internal.h
6757 +index 4a8795b21d774..3f02b818625ef 100644
6758 +--- a/include/linux/local_lock_internal.h
6759 ++++ b/include/linux/local_lock_internal.h
6760 +@@ -14,26 +14,14 @@ typedef struct {
6761 + } local_lock_t;
6762 +
6763 + #ifdef CONFIG_DEBUG_LOCK_ALLOC
6764 +-# define LL_DEP_MAP_INIT(lockname) \
6765 ++# define LOCAL_LOCK_DEBUG_INIT(lockname) \
6766 + .dep_map = { \
6767 + .name = #lockname, \
6768 + .wait_type_inner = LD_WAIT_CONFIG, \
6769 +- }
6770 +-#else
6771 +-# define LL_DEP_MAP_INIT(lockname)
6772 +-#endif
6773 +-
6774 +-#define INIT_LOCAL_LOCK(lockname) { LL_DEP_MAP_INIT(lockname) }
6775 ++ .lock_type = LD_LOCK_PERCPU, \
6776 ++ }, \
6777 ++ .owner = NULL,
6778 +
6779 +-#define __local_lock_init(lock) \
6780 +-do { \
6781 +- static struct lock_class_key __key; \
6782 +- \
6783 +- debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
6784 +- lockdep_init_map_wait(&(lock)->dep_map, #lock, &__key, 0, LD_WAIT_CONFIG);\
6785 +-} while (0)
6786 +-
6787 +-#ifdef CONFIG_DEBUG_LOCK_ALLOC
6788 + static inline void local_lock_acquire(local_lock_t *l)
6789 + {
6790 + lock_map_acquire(&l->dep_map);
6791 +@@ -48,11 +36,30 @@ static inline void local_lock_release(local_lock_t *l)
6792 + lock_map_release(&l->dep_map);
6793 + }
6794 +
6795 ++static inline void local_lock_debug_init(local_lock_t *l)
6796 ++{
6797 ++ l->owner = NULL;
6798 ++}
6799 + #else /* CONFIG_DEBUG_LOCK_ALLOC */
6800 ++# define LOCAL_LOCK_DEBUG_INIT(lockname)
6801 + static inline void local_lock_acquire(local_lock_t *l) { }
6802 + static inline void local_lock_release(local_lock_t *l) { }
6803 ++static inline void local_lock_debug_init(local_lock_t *l) { }
6804 + #endif /* !CONFIG_DEBUG_LOCK_ALLOC */
6805 +
6806 ++#define INIT_LOCAL_LOCK(lockname) { LOCAL_LOCK_DEBUG_INIT(lockname) }
6807 ++
6808 ++#define __local_lock_init(lock) \
6809 ++do { \
6810 ++ static struct lock_class_key __key; \
6811 ++ \
6812 ++ debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
6813 ++ lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
6814 ++ 0, LD_WAIT_CONFIG, LD_WAIT_INV, \
6815 ++ LD_LOCK_PERCPU); \
6816 ++ local_lock_debug_init(lock); \
6817 ++} while (0)
6818 ++
6819 + #define __local_lock(lock) \
6820 + do { \
6821 + preempt_disable(); \
6822 +diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
6823 +index f5594879175a6..20b6797babe2c 100644
6824 +--- a/include/linux/lockdep.h
6825 ++++ b/include/linux/lockdep.h
6826 +@@ -185,12 +185,19 @@ extern void lockdep_unregister_key(struct lock_class_key *key);
6827 + * to lockdep:
6828 + */
6829 +
6830 +-extern void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
6831 +- struct lock_class_key *key, int subclass, short inner, short outer);
6832 ++extern void lockdep_init_map_type(struct lockdep_map *lock, const char *name,
6833 ++ struct lock_class_key *key, int subclass, u8 inner, u8 outer, u8 lock_type);
6834 ++
6835 ++static inline void
6836 ++lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
6837 ++ struct lock_class_key *key, int subclass, u8 inner, u8 outer)
6838 ++{
6839 ++ lockdep_init_map_type(lock, name, key, subclass, inner, LD_WAIT_INV, LD_LOCK_NORMAL);
6840 ++}
6841 +
6842 + static inline void
6843 + lockdep_init_map_wait(struct lockdep_map *lock, const char *name,
6844 +- struct lock_class_key *key, int subclass, short inner)
6845 ++ struct lock_class_key *key, int subclass, u8 inner)
6846 + {
6847 + lockdep_init_map_waits(lock, name, key, subclass, inner, LD_WAIT_INV);
6848 + }
6849 +@@ -340,6 +347,8 @@ static inline void lockdep_set_selftest_task(struct task_struct *task)
6850 + # define lock_set_class(l, n, k, s, i) do { } while (0)
6851 + # define lock_set_subclass(l, s, i) do { } while (0)
6852 + # define lockdep_init() do { } while (0)
6853 ++# define lockdep_init_map_type(lock, name, key, sub, inner, outer, type) \
6854 ++ do { (void)(name); (void)(key); } while (0)
6855 + # define lockdep_init_map_waits(lock, name, key, sub, inner, outer) \
6856 + do { (void)(name); (void)(key); } while (0)
6857 + # define lockdep_init_map_wait(lock, name, key, sub, inner) \
6858 +diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h
6859 +index 9a1fd49df17f6..2ec9ff5a7fff0 100644
6860 +--- a/include/linux/lockdep_types.h
6861 ++++ b/include/linux/lockdep_types.h
6862 +@@ -30,6 +30,12 @@ enum lockdep_wait_type {
6863 + LD_WAIT_MAX, /* must be last */
6864 + };
6865 +
6866 ++enum lockdep_lock_type {
6867 ++ LD_LOCK_NORMAL = 0, /* normal, catch all */
6868 ++ LD_LOCK_PERCPU, /* percpu */
6869 ++ LD_LOCK_MAX,
6870 ++};
6871 ++
6872 + #ifdef CONFIG_LOCKDEP
6873 +
6874 + /*
6875 +@@ -119,8 +125,10 @@ struct lock_class {
6876 + int name_version;
6877 + const char *name;
6878 +
6879 +- short wait_type_inner;
6880 +- short wait_type_outer;
6881 ++ u8 wait_type_inner;
6882 ++ u8 wait_type_outer;
6883 ++ u8 lock_type;
6884 ++ /* u8 hole; */
6885 +
6886 + #ifdef CONFIG_LOCK_STAT
6887 + unsigned long contention_point[LOCKSTAT_POINTS];
6888 +@@ -169,8 +177,10 @@ struct lockdep_map {
6889 + struct lock_class_key *key;
6890 + struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES];
6891 + const char *name;
6892 +- short wait_type_outer; /* can be taken in this context */
6893 +- short wait_type_inner; /* presents this context */
6894 ++ u8 wait_type_outer; /* can be taken in this context */
6895 ++ u8 wait_type_inner; /* presents this context */
6896 ++ u8 lock_type;
6897 ++ /* u8 hole; */
6898 + #ifdef CONFIG_LOCK_STAT
6899 + int cpu;
6900 + unsigned long ip;
6901 +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
6902 +index af8f4e2cf21d1..70a3664785f80 100644
6903 +--- a/include/linux/mlx5/mlx5_ifc.h
6904 ++++ b/include/linux/mlx5/mlx5_ifc.h
6905 +@@ -876,7 +876,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
6906 + u8 scatter_fcs[0x1];
6907 + u8 enhanced_multi_pkt_send_wqe[0x1];
6908 + u8 tunnel_lso_const_out_ip_id[0x1];
6909 +- u8 reserved_at_1c[0x2];
6910 ++ u8 tunnel_lro_gre[0x1];
6911 ++ u8 tunnel_lro_vxlan[0x1];
6912 + u8 tunnel_stateless_gre[0x1];
6913 + u8 tunnel_stateless_vxlan[0x1];
6914 +
6915 +diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
6916 +index d55c746ac56e2..e00ad1cfb1f1d 100644
6917 +--- a/include/linux/power/max17042_battery.h
6918 ++++ b/include/linux/power/max17042_battery.h
6919 +@@ -69,7 +69,7 @@ enum max17042_register {
6920 + MAX17042_RelaxCFG = 0x2A,
6921 + MAX17042_MiscCFG = 0x2B,
6922 + MAX17042_TGAIN = 0x2C,
6923 +- MAx17042_TOFF = 0x2D,
6924 ++ MAX17042_TOFF = 0x2D,
6925 + MAX17042_CGAIN = 0x2E,
6926 + MAX17042_COFF = 0x2F,
6927 +
6928 +diff --git a/include/linux/time64.h b/include/linux/time64.h
6929 +index 5117cb5b56561..81b9686a20799 100644
6930 +--- a/include/linux/time64.h
6931 ++++ b/include/linux/time64.h
6932 +@@ -25,7 +25,9 @@ struct itimerspec64 {
6933 + #define TIME64_MIN (-TIME64_MAX - 1)
6934 +
6935 + #define KTIME_MAX ((s64)~((u64)1 << 63))
6936 ++#define KTIME_MIN (-KTIME_MAX - 1)
6937 + #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
6938 ++#define KTIME_SEC_MIN (KTIME_MIN / NSEC_PER_SEC)
6939 +
6940 + /*
6941 + * Limits for settimeofday():
6942 +@@ -124,10 +126,13 @@ static inline bool timespec64_valid_settod(const struct timespec64 *ts)
6943 + */
6944 + static inline s64 timespec64_to_ns(const struct timespec64 *ts)
6945 + {
6946 +- /* Prevent multiplication overflow */
6947 +- if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
6948 ++ /* Prevent multiplication overflow / underflow */
6949 ++ if (ts->tv_sec >= KTIME_SEC_MAX)
6950 + return KTIME_MAX;
6951 +
6952 ++ if (ts->tv_sec <= KTIME_SEC_MIN)
6953 ++ return KTIME_MIN;
6954 ++
6955 + return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
6956 + }
6957 +
6958 +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h
6959 +index cc9cdbc66403f..fdfef7fe40df9 100644
6960 +--- a/include/soc/bcm2835/raspberrypi-firmware.h
6961 ++++ b/include/soc/bcm2835/raspberrypi-firmware.h
6962 +@@ -140,6 +140,7 @@ int rpi_firmware_property(struct rpi_firmware *fw,
6963 + u32 tag, void *data, size_t len);
6964 + int rpi_firmware_property_list(struct rpi_firmware *fw,
6965 + void *data, size_t tag_size);
6966 ++void rpi_firmware_put(struct rpi_firmware *fw);
6967 + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node);
6968 + #else
6969 + static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag,
6970 +@@ -154,6 +155,7 @@ static inline int rpi_firmware_property_list(struct rpi_firmware *fw,
6971 + return -ENOSYS;
6972 + }
6973 +
6974 ++static inline void rpi_firmware_put(struct rpi_firmware *fw) { }
6975 + static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node)
6976 + {
6977 + return NULL;
6978 +diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
6979 +index 556216dc97030..762bf87c26a3e 100644
6980 +--- a/include/uapi/linux/bpf.h
6981 ++++ b/include/uapi/linux/bpf.h
6982 +@@ -2450,7 +2450,7 @@ union bpf_attr {
6983 + * long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
6984 + * Description
6985 + * Select a **SO_REUSEPORT** socket from a
6986 +- * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
6987 ++ * **BPF_MAP_TYPE_REUSEPORT_SOCKARRAY** *map*.
6988 + * It checks the selected socket is matching the incoming
6989 + * request in the socket buffer.
6990 + * Return
6991 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
6992 +index 29d4f4e375954..cba1f86e75cdb 100644
6993 +--- a/kernel/bpf/verifier.c
6994 ++++ b/kernel/bpf/verifier.c
6995 +@@ -10456,10 +10456,11 @@ static void convert_pseudo_ld_imm64(struct bpf_verifier_env *env)
6996 + * insni[off, off + cnt). Adjust corresponding insn_aux_data by copying
6997 + * [0, off) and [off, end) to new locations, so the patched range stays zero
6998 + */
6999 +-static int adjust_insn_aux_data(struct bpf_verifier_env *env,
7000 +- struct bpf_prog *new_prog, u32 off, u32 cnt)
7001 ++static void adjust_insn_aux_data(struct bpf_verifier_env *env,
7002 ++ struct bpf_insn_aux_data *new_data,
7003 ++ struct bpf_prog *new_prog, u32 off, u32 cnt)
7004 + {
7005 +- struct bpf_insn_aux_data *new_data, *old_data = env->insn_aux_data;
7006 ++ struct bpf_insn_aux_data *old_data = env->insn_aux_data;
7007 + struct bpf_insn *insn = new_prog->insnsi;
7008 + u32 old_seen = old_data[off].seen;
7009 + u32 prog_len;
7010 +@@ -10472,12 +10473,9 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env,
7011 + old_data[off].zext_dst = insn_has_def32(env, insn + off + cnt - 1);
7012 +
7013 + if (cnt == 1)
7014 +- return 0;
7015 ++ return;
7016 + prog_len = new_prog->len;
7017 +- new_data = vzalloc(array_size(prog_len,
7018 +- sizeof(struct bpf_insn_aux_data)));
7019 +- if (!new_data)
7020 +- return -ENOMEM;
7021 ++
7022 + memcpy(new_data, old_data, sizeof(struct bpf_insn_aux_data) * off);
7023 + memcpy(new_data + off + cnt - 1, old_data + off,
7024 + sizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1));
7025 +@@ -10488,7 +10486,6 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env,
7026 + }
7027 + env->insn_aux_data = new_data;
7028 + vfree(old_data);
7029 +- return 0;
7030 + }
7031 +
7032 + static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len)
7033 +@@ -10523,6 +10520,14 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of
7034 + const struct bpf_insn *patch, u32 len)
7035 + {
7036 + struct bpf_prog *new_prog;
7037 ++ struct bpf_insn_aux_data *new_data = NULL;
7038 ++
7039 ++ if (len > 1) {
7040 ++ new_data = vzalloc(array_size(env->prog->len + len - 1,
7041 ++ sizeof(struct bpf_insn_aux_data)));
7042 ++ if (!new_data)
7043 ++ return NULL;
7044 ++ }
7045 +
7046 + new_prog = bpf_patch_insn_single(env->prog, off, patch, len);
7047 + if (IS_ERR(new_prog)) {
7048 +@@ -10530,10 +10535,10 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of
7049 + verbose(env,
7050 + "insn %d cannot be patched due to 16-bit range\n",
7051 + env->insn_aux_data[off].orig_idx);
7052 ++ vfree(new_data);
7053 + return NULL;
7054 + }
7055 +- if (adjust_insn_aux_data(env, new_prog, off, len))
7056 +- return NULL;
7057 ++ adjust_insn_aux_data(env, new_data, new_prog, off, len);
7058 + adjust_subprog_starts(env, off, len);
7059 + adjust_poke_descs(new_prog, off, len);
7060 + return new_prog;
7061 +@@ -11033,6 +11038,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
7062 + if (is_narrower_load && size < target_size) {
7063 + u8 shift = bpf_ctx_narrow_access_offset(
7064 + off, size, size_default) * 8;
7065 ++ if (shift && cnt + 1 >= ARRAY_SIZE(insn_buf)) {
7066 ++ verbose(env, "bpf verifier narrow ctx load misconfigured\n");
7067 ++ return -EINVAL;
7068 ++ }
7069 + if (ctx_field_size <= 4) {
7070 + if (shift)
7071 + insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH,
7072 +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
7073 +index 53c70c470a38d..1999fcec45c71 100644
7074 +--- a/kernel/cgroup/cpuset.c
7075 ++++ b/kernel/cgroup/cpuset.c
7076 +@@ -1114,7 +1114,7 @@ enum subparts_cmd {
7077 + * cpus_allowed can be granted or an error code will be returned.
7078 + *
7079 + * For partcmd_disable, the cpuset is being transofrmed from a partition
7080 +- * root back to a non-partition root. any CPUs in cpus_allowed that are in
7081 ++ * root back to a non-partition root. Any CPUs in cpus_allowed that are in
7082 + * parent's subparts_cpus will be taken away from that cpumask and put back
7083 + * into parent's effective_cpus. 0 should always be returned.
7084 + *
7085 +@@ -1148,6 +1148,7 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7086 + struct cpuset *parent = parent_cs(cpuset);
7087 + int adding; /* Moving cpus from effective_cpus to subparts_cpus */
7088 + int deleting; /* Moving cpus from subparts_cpus to effective_cpus */
7089 ++ int new_prs;
7090 + bool part_error = false; /* Partition error? */
7091 +
7092 + percpu_rwsem_assert_held(&cpuset_rwsem);
7093 +@@ -1183,6 +1184,7 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7094 + * A cpumask update cannot make parent's effective_cpus become empty.
7095 + */
7096 + adding = deleting = false;
7097 ++ new_prs = cpuset->partition_root_state;
7098 + if (cmd == partcmd_enable) {
7099 + cpumask_copy(tmp->addmask, cpuset->cpus_allowed);
7100 + adding = true;
7101 +@@ -1225,7 +1227,7 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7102 + /*
7103 + * partcmd_update w/o newmask:
7104 + *
7105 +- * addmask = cpus_allowed & parent->effectiveb_cpus
7106 ++ * addmask = cpus_allowed & parent->effective_cpus
7107 + *
7108 + * Note that parent's subparts_cpus may have been
7109 + * pre-shrunk in case there is a change in the cpu list.
7110 +@@ -1247,11 +1249,11 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7111 + switch (cpuset->partition_root_state) {
7112 + case PRS_ENABLED:
7113 + if (part_error)
7114 +- cpuset->partition_root_state = PRS_ERROR;
7115 ++ new_prs = PRS_ERROR;
7116 + break;
7117 + case PRS_ERROR:
7118 + if (!part_error)
7119 +- cpuset->partition_root_state = PRS_ENABLED;
7120 ++ new_prs = PRS_ENABLED;
7121 + break;
7122 + }
7123 + /*
7124 +@@ -1260,10 +1262,10 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7125 + part_error = (prev_prs == PRS_ERROR);
7126 + }
7127 +
7128 +- if (!part_error && (cpuset->partition_root_state == PRS_ERROR))
7129 ++ if (!part_error && (new_prs == PRS_ERROR))
7130 + return 0; /* Nothing need to be done */
7131 +
7132 +- if (cpuset->partition_root_state == PRS_ERROR) {
7133 ++ if (new_prs == PRS_ERROR) {
7134 + /*
7135 + * Remove all its cpus from parent's subparts_cpus.
7136 + */
7137 +@@ -1272,7 +1274,7 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7138 + parent->subparts_cpus);
7139 + }
7140 +
7141 +- if (!adding && !deleting)
7142 ++ if (!adding && !deleting && (new_prs == cpuset->partition_root_state))
7143 + return 0;
7144 +
7145 + /*
7146 +@@ -1299,6 +1301,9 @@ static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
7147 + }
7148 +
7149 + parent->nr_subparts_cpus = cpumask_weight(parent->subparts_cpus);
7150 ++
7151 ++ if (cpuset->partition_root_state != new_prs)
7152 ++ cpuset->partition_root_state = new_prs;
7153 + spin_unlock_irq(&callback_lock);
7154 +
7155 + return cmd == partcmd_update;
7156 +@@ -1321,6 +1326,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp)
7157 + struct cpuset *cp;
7158 + struct cgroup_subsys_state *pos_css;
7159 + bool need_rebuild_sched_domains = false;
7160 ++ int new_prs;
7161 +
7162 + rcu_read_lock();
7163 + cpuset_for_each_descendant_pre(cp, pos_css, cs) {
7164 +@@ -1360,17 +1366,18 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp)
7165 + * update_tasks_cpumask() again for tasks in the parent
7166 + * cpuset if the parent's subparts_cpus changes.
7167 + */
7168 +- if ((cp != cs) && cp->partition_root_state) {
7169 ++ new_prs = cp->partition_root_state;
7170 ++ if ((cp != cs) && new_prs) {
7171 + switch (parent->partition_root_state) {
7172 + case PRS_DISABLED:
7173 + /*
7174 + * If parent is not a partition root or an
7175 +- * invalid partition root, clear the state
7176 +- * state and the CS_CPU_EXCLUSIVE flag.
7177 ++ * invalid partition root, clear its state
7178 ++ * and its CS_CPU_EXCLUSIVE flag.
7179 + */
7180 + WARN_ON_ONCE(cp->partition_root_state
7181 + != PRS_ERROR);
7182 +- cp->partition_root_state = 0;
7183 ++ new_prs = PRS_DISABLED;
7184 +
7185 + /*
7186 + * clear_bit() is an atomic operation and
7187 +@@ -1391,11 +1398,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp)
7188 + /*
7189 + * When parent is invalid, it has to be too.
7190 + */
7191 +- cp->partition_root_state = PRS_ERROR;
7192 +- if (cp->nr_subparts_cpus) {
7193 +- cp->nr_subparts_cpus = 0;
7194 +- cpumask_clear(cp->subparts_cpus);
7195 +- }
7196 ++ new_prs = PRS_ERROR;
7197 + break;
7198 + }
7199 + }
7200 +@@ -1407,8 +1410,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp)
7201 + spin_lock_irq(&callback_lock);
7202 +
7203 + cpumask_copy(cp->effective_cpus, tmp->new_cpus);
7204 +- if (cp->nr_subparts_cpus &&
7205 +- (cp->partition_root_state != PRS_ENABLED)) {
7206 ++ if (cp->nr_subparts_cpus && (new_prs != PRS_ENABLED)) {
7207 + cp->nr_subparts_cpus = 0;
7208 + cpumask_clear(cp->subparts_cpus);
7209 + } else if (cp->nr_subparts_cpus) {
7210 +@@ -1435,6 +1437,10 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp)
7211 + = cpumask_weight(cp->subparts_cpus);
7212 + }
7213 + }
7214 ++
7215 ++ if (new_prs != cp->partition_root_state)
7216 ++ cp->partition_root_state = new_prs;
7217 ++
7218 + spin_unlock_irq(&callback_lock);
7219 +
7220 + WARN_ON(!is_in_v2_mode() &&
7221 +@@ -1937,34 +1943,32 @@ out:
7222 +
7223 + /*
7224 + * update_prstate - update partititon_root_state
7225 +- * cs: the cpuset to update
7226 +- * val: 0 - disabled, 1 - enabled
7227 ++ * cs: the cpuset to update
7228 ++ * new_prs: new partition root state
7229 + *
7230 + * Call with cpuset_mutex held.
7231 + */
7232 +-static int update_prstate(struct cpuset *cs, int val)
7233 ++static int update_prstate(struct cpuset *cs, int new_prs)
7234 + {
7235 +- int err;
7236 ++ int err, old_prs = cs->partition_root_state;
7237 + struct cpuset *parent = parent_cs(cs);
7238 +- struct tmpmasks tmp;
7239 ++ struct tmpmasks tmpmask;
7240 +
7241 +- if ((val != 0) && (val != 1))
7242 +- return -EINVAL;
7243 +- if (val == cs->partition_root_state)
7244 ++ if (old_prs == new_prs)
7245 + return 0;
7246 +
7247 + /*
7248 + * Cannot force a partial or invalid partition root to a full
7249 + * partition root.
7250 + */
7251 +- if (val && cs->partition_root_state)
7252 ++ if (new_prs && (old_prs == PRS_ERROR))
7253 + return -EINVAL;
7254 +
7255 +- if (alloc_cpumasks(NULL, &tmp))
7256 ++ if (alloc_cpumasks(NULL, &tmpmask))
7257 + return -ENOMEM;
7258 +
7259 + err = -EINVAL;
7260 +- if (!cs->partition_root_state) {
7261 ++ if (!old_prs) {
7262 + /*
7263 + * Turning on partition root requires setting the
7264 + * CS_CPU_EXCLUSIVE bit implicitly as well and cpus_allowed
7265 +@@ -1978,31 +1982,27 @@ static int update_prstate(struct cpuset *cs, int val)
7266 + goto out;
7267 +
7268 + err = update_parent_subparts_cpumask(cs, partcmd_enable,
7269 +- NULL, &tmp);
7270 ++ NULL, &tmpmask);
7271 + if (err) {
7272 + update_flag(CS_CPU_EXCLUSIVE, cs, 0);
7273 + goto out;
7274 + }
7275 +- cs->partition_root_state = PRS_ENABLED;
7276 + } else {
7277 + /*
7278 + * Turning off partition root will clear the
7279 + * CS_CPU_EXCLUSIVE bit.
7280 + */
7281 +- if (cs->partition_root_state == PRS_ERROR) {
7282 +- cs->partition_root_state = 0;
7283 ++ if (old_prs == PRS_ERROR) {
7284 + update_flag(CS_CPU_EXCLUSIVE, cs, 0);
7285 + err = 0;
7286 + goto out;
7287 + }
7288 +
7289 + err = update_parent_subparts_cpumask(cs, partcmd_disable,
7290 +- NULL, &tmp);
7291 ++ NULL, &tmpmask);
7292 + if (err)
7293 + goto out;
7294 +
7295 +- cs->partition_root_state = 0;
7296 +-
7297 + /* Turning off CS_CPU_EXCLUSIVE will not return error */
7298 + update_flag(CS_CPU_EXCLUSIVE, cs, 0);
7299 + }
7300 +@@ -2015,11 +2015,17 @@ static int update_prstate(struct cpuset *cs, int val)
7301 + update_tasks_cpumask(parent);
7302 +
7303 + if (parent->child_ecpus_count)
7304 +- update_sibling_cpumasks(parent, cs, &tmp);
7305 ++ update_sibling_cpumasks(parent, cs, &tmpmask);
7306 +
7307 + rebuild_sched_domains_locked();
7308 + out:
7309 +- free_cpumasks(NULL, &tmp);
7310 ++ if (!err) {
7311 ++ spin_lock_irq(&callback_lock);
7312 ++ cs->partition_root_state = new_prs;
7313 ++ spin_unlock_irq(&callback_lock);
7314 ++ }
7315 ++
7316 ++ free_cpumasks(NULL, &tmpmask);
7317 + return err;
7318 + }
7319 +
7320 +@@ -3060,7 +3066,7 @@ retry:
7321 + goto retry;
7322 + }
7323 +
7324 +- parent = parent_cs(cs);
7325 ++ parent = parent_cs(cs);
7326 + compute_effective_cpumask(&new_cpus, cs, parent);
7327 + nodes_and(new_mems, cs->mems_allowed, parent->effective_mems);
7328 +
7329 +@@ -3082,8 +3088,10 @@ retry:
7330 + if (is_partition_root(cs) && (cpumask_empty(&new_cpus) ||
7331 + (parent->partition_root_state == PRS_ERROR))) {
7332 + if (cs->nr_subparts_cpus) {
7333 ++ spin_lock_irq(&callback_lock);
7334 + cs->nr_subparts_cpus = 0;
7335 + cpumask_clear(cs->subparts_cpus);
7336 ++ spin_unlock_irq(&callback_lock);
7337 + compute_effective_cpumask(&new_cpus, cs, parent);
7338 + }
7339 +
7340 +@@ -3097,7 +3105,9 @@ retry:
7341 + cpumask_empty(&new_cpus)) {
7342 + update_parent_subparts_cpumask(cs, partcmd_disable,
7343 + NULL, tmp);
7344 ++ spin_lock_irq(&callback_lock);
7345 + cs->partition_root_state = PRS_ERROR;
7346 ++ spin_unlock_irq(&callback_lock);
7347 + }
7348 + cpuset_force_rebuild();
7349 + }
7350 +@@ -3168,6 +3178,13 @@ static void cpuset_hotplug_workfn(struct work_struct *work)
7351 + cpus_updated = !cpumask_equal(top_cpuset.effective_cpus, &new_cpus);
7352 + mems_updated = !nodes_equal(top_cpuset.effective_mems, new_mems);
7353 +
7354 ++ /*
7355 ++ * In the rare case that hotplug removes all the cpus in subparts_cpus,
7356 ++ * we assumed that cpus are updated.
7357 ++ */
7358 ++ if (!cpus_updated && top_cpuset.nr_subparts_cpus)
7359 ++ cpus_updated = true;
7360 ++
7361 + /* synchronize cpus_allowed to cpu_active_mask */
7362 + if (cpus_updated) {
7363 + spin_lock_irq(&callback_lock);
7364 +diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c
7365 +index f7e1d0eccdbc6..246efc74e3f34 100644
7366 +--- a/kernel/cpu_pm.c
7367 ++++ b/kernel/cpu_pm.c
7368 +@@ -13,19 +13,32 @@
7369 + #include <linux/spinlock.h>
7370 + #include <linux/syscore_ops.h>
7371 +
7372 +-static ATOMIC_NOTIFIER_HEAD(cpu_pm_notifier_chain);
7373 ++/*
7374 ++ * atomic_notifiers use a spinlock_t, which can block under PREEMPT_RT.
7375 ++ * Notifications for cpu_pm will be issued by the idle task itself, which can
7376 ++ * never block, IOW it requires using a raw_spinlock_t.
7377 ++ */
7378 ++static struct {
7379 ++ struct raw_notifier_head chain;
7380 ++ raw_spinlock_t lock;
7381 ++} cpu_pm_notifier = {
7382 ++ .chain = RAW_NOTIFIER_INIT(cpu_pm_notifier.chain),
7383 ++ .lock = __RAW_SPIN_LOCK_UNLOCKED(cpu_pm_notifier.lock),
7384 ++};
7385 +
7386 + static int cpu_pm_notify(enum cpu_pm_event event)
7387 + {
7388 + int ret;
7389 +
7390 + /*
7391 +- * atomic_notifier_call_chain has a RCU read critical section, which
7392 +- * could be disfunctional in cpu idle. Copy RCU_NONIDLE code to let
7393 +- * RCU know this.
7394 ++ * This introduces a RCU read critical section, which could be
7395 ++ * disfunctional in cpu idle. Copy RCU_NONIDLE code to let RCU know
7396 ++ * this.
7397 + */
7398 + rcu_irq_enter_irqson();
7399 +- ret = atomic_notifier_call_chain(&cpu_pm_notifier_chain, event, NULL);
7400 ++ rcu_read_lock();
7401 ++ ret = raw_notifier_call_chain(&cpu_pm_notifier.chain, event, NULL);
7402 ++ rcu_read_unlock();
7403 + rcu_irq_exit_irqson();
7404 +
7405 + return notifier_to_errno(ret);
7406 +@@ -33,10 +46,13 @@ static int cpu_pm_notify(enum cpu_pm_event event)
7407 +
7408 + static int cpu_pm_notify_robust(enum cpu_pm_event event_up, enum cpu_pm_event event_down)
7409 + {
7410 ++ unsigned long flags;
7411 + int ret;
7412 +
7413 + rcu_irq_enter_irqson();
7414 +- ret = atomic_notifier_call_chain_robust(&cpu_pm_notifier_chain, event_up, event_down, NULL);
7415 ++ raw_spin_lock_irqsave(&cpu_pm_notifier.lock, flags);
7416 ++ ret = raw_notifier_call_chain_robust(&cpu_pm_notifier.chain, event_up, event_down, NULL);
7417 ++ raw_spin_unlock_irqrestore(&cpu_pm_notifier.lock, flags);
7418 + rcu_irq_exit_irqson();
7419 +
7420 + return notifier_to_errno(ret);
7421 +@@ -49,12 +65,17 @@ static int cpu_pm_notify_robust(enum cpu_pm_event event_up, enum cpu_pm_event ev
7422 + * Add a driver to a list of drivers that are notified about
7423 + * CPU and CPU cluster low power entry and exit.
7424 + *
7425 +- * This function may sleep, and has the same return conditions as
7426 +- * raw_notifier_chain_register.
7427 ++ * This function has the same return conditions as raw_notifier_chain_register.
7428 + */
7429 + int cpu_pm_register_notifier(struct notifier_block *nb)
7430 + {
7431 +- return atomic_notifier_chain_register(&cpu_pm_notifier_chain, nb);
7432 ++ unsigned long flags;
7433 ++ int ret;
7434 ++
7435 ++ raw_spin_lock_irqsave(&cpu_pm_notifier.lock, flags);
7436 ++ ret = raw_notifier_chain_register(&cpu_pm_notifier.chain, nb);
7437 ++ raw_spin_unlock_irqrestore(&cpu_pm_notifier.lock, flags);
7438 ++ return ret;
7439 + }
7440 + EXPORT_SYMBOL_GPL(cpu_pm_register_notifier);
7441 +
7442 +@@ -64,12 +85,17 @@ EXPORT_SYMBOL_GPL(cpu_pm_register_notifier);
7443 + *
7444 + * Remove a driver from the CPU PM notifier list.
7445 + *
7446 +- * This function may sleep, and has the same return conditions as
7447 +- * raw_notifier_chain_unregister.
7448 ++ * This function has the same return conditions as raw_notifier_chain_unregister.
7449 + */
7450 + int cpu_pm_unregister_notifier(struct notifier_block *nb)
7451 + {
7452 +- return atomic_notifier_chain_unregister(&cpu_pm_notifier_chain, nb);
7453 ++ unsigned long flags;
7454 ++ int ret;
7455 ++
7456 ++ raw_spin_lock_irqsave(&cpu_pm_notifier.lock, flags);
7457 ++ ret = raw_notifier_chain_unregister(&cpu_pm_notifier.chain, nb);
7458 ++ raw_spin_unlock_irqrestore(&cpu_pm_notifier.lock, flags);
7459 ++ return ret;
7460 + }
7461 + EXPORT_SYMBOL_GPL(cpu_pm_unregister_notifier);
7462 +
7463 +diff --git a/kernel/irq/timings.c b/kernel/irq/timings.c
7464 +index 6990490fa67be..1f981162648a3 100644
7465 +--- a/kernel/irq/timings.c
7466 ++++ b/kernel/irq/timings.c
7467 +@@ -799,12 +799,14 @@ static int __init irq_timings_test_irqs(struct timings_intervals *ti)
7468 +
7469 + __irq_timings_store(irq, irqs, ti->intervals[i]);
7470 + if (irqs->circ_timings[i & IRQ_TIMINGS_MASK] != index) {
7471 ++ ret = -EBADSLT;
7472 + pr_err("Failed to store in the circular buffer\n");
7473 + goto out;
7474 + }
7475 + }
7476 +
7477 + if (irqs->count != ti->count) {
7478 ++ ret = -ERANGE;
7479 + pr_err("Count differs\n");
7480 + goto out;
7481 + }
7482 +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
7483 +index 8ae9d7abebc08..5184f68968158 100644
7484 +--- a/kernel/locking/lockdep.c
7485 ++++ b/kernel/locking/lockdep.c
7486 +@@ -1293,6 +1293,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
7487 + class->name_version = count_matching_names(class);
7488 + class->wait_type_inner = lock->wait_type_inner;
7489 + class->wait_type_outer = lock->wait_type_outer;
7490 ++ class->lock_type = lock->lock_type;
7491 + /*
7492 + * We use RCU's safe list-add method to make
7493 + * parallel walking of the hash-list safe:
7494 +@@ -4621,9 +4622,9 @@ print_lock_invalid_wait_context(struct task_struct *curr,
7495 + */
7496 + static int check_wait_context(struct task_struct *curr, struct held_lock *next)
7497 + {
7498 +- short next_inner = hlock_class(next)->wait_type_inner;
7499 +- short next_outer = hlock_class(next)->wait_type_outer;
7500 +- short curr_inner;
7501 ++ u8 next_inner = hlock_class(next)->wait_type_inner;
7502 ++ u8 next_outer = hlock_class(next)->wait_type_outer;
7503 ++ u8 curr_inner;
7504 + int depth;
7505 +
7506 + if (!next_inner || next->trylock)
7507 +@@ -4646,7 +4647,7 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)
7508 +
7509 + for (; depth < curr->lockdep_depth; depth++) {
7510 + struct held_lock *prev = curr->held_locks + depth;
7511 +- short prev_inner = hlock_class(prev)->wait_type_inner;
7512 ++ u8 prev_inner = hlock_class(prev)->wait_type_inner;
7513 +
7514 + if (prev_inner) {
7515 + /*
7516 +@@ -4695,9 +4696,9 @@ static inline int check_wait_context(struct task_struct *curr,
7517 + /*
7518 + * Initialize a lock instance's lock-class mapping info:
7519 + */
7520 +-void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
7521 ++void lockdep_init_map_type(struct lockdep_map *lock, const char *name,
7522 + struct lock_class_key *key, int subclass,
7523 +- short inner, short outer)
7524 ++ u8 inner, u8 outer, u8 lock_type)
7525 + {
7526 + int i;
7527 +
7528 +@@ -4720,6 +4721,7 @@ void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
7529 +
7530 + lock->wait_type_outer = outer;
7531 + lock->wait_type_inner = inner;
7532 ++ lock->lock_type = lock_type;
7533 +
7534 + /*
7535 + * No key, no joy, we need to hash something.
7536 +@@ -4754,7 +4756,7 @@ void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
7537 + raw_local_irq_restore(flags);
7538 + }
7539 + }
7540 +-EXPORT_SYMBOL_GPL(lockdep_init_map_waits);
7541 ++EXPORT_SYMBOL_GPL(lockdep_init_map_type);
7542 +
7543 + struct lock_class_key __lockdep_no_validate__;
7544 + EXPORT_SYMBOL_GPL(__lockdep_no_validate__);
7545 +diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
7546 +index 15ac7c4bb1117..86061901636cc 100644
7547 +--- a/kernel/locking/mutex.c
7548 ++++ b/kernel/locking/mutex.c
7549 +@@ -938,7 +938,6 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
7550 + struct ww_acquire_ctx *ww_ctx, const bool use_ww_ctx)
7551 + {
7552 + struct mutex_waiter waiter;
7553 +- bool first = false;
7554 + struct ww_mutex *ww;
7555 + int ret;
7556 +
7557 +@@ -1017,6 +1016,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
7558 +
7559 + set_current_state(state);
7560 + for (;;) {
7561 ++ bool first;
7562 ++
7563 + /*
7564 + * Once we hold wait_lock, we're serialized against
7565 + * mutex_unlock() handing the lock off to us, do a trylock
7566 +@@ -1045,15 +1046,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
7567 + spin_unlock(&lock->wait_lock);
7568 + schedule_preempt_disabled();
7569 +
7570 +- /*
7571 +- * ww_mutex needs to always recheck its position since its waiter
7572 +- * list is not FIFO ordered.
7573 +- */
7574 +- if (ww_ctx || !first) {
7575 +- first = __mutex_waiter_is_first(lock, &waiter);
7576 +- if (first)
7577 +- __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF);
7578 +- }
7579 ++ first = __mutex_waiter_is_first(lock, &waiter);
7580 ++ if (first)
7581 ++ __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF);
7582 +
7583 + set_current_state(state);
7584 + /*
7585 +diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
7586 +index 994ca8353543a..be381eb6116a1 100644
7587 +--- a/kernel/power/energy_model.c
7588 ++++ b/kernel/power/energy_model.c
7589 +@@ -157,7 +157,9 @@ static int em_create_perf_table(struct device *dev, struct em_perf_domain *pd,
7590 + /* Compute the cost of each performance state. */
7591 + fmax = (u64) table[nr_states - 1].frequency;
7592 + for (i = 0; i < nr_states; i++) {
7593 +- table[i].cost = div64_u64(fmax * table[i].power,
7594 ++ unsigned long power_res = em_scale_power(table[i].power);
7595 ++
7596 ++ table[i].cost = div64_u64(fmax * power_res,
7597 + table[i].frequency);
7598 + }
7599 +
7600 +diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
7601 +index 8c3ba0185082d..8c81c05c4236a 100644
7602 +--- a/kernel/rcu/tree.c
7603 ++++ b/kernel/rcu/tree.c
7604 +@@ -2561,6 +2561,7 @@ static void rcu_do_batch(struct rcu_data *rdp)
7605 + void rcu_sched_clock_irq(int user)
7606 + {
7607 + trace_rcu_utilization(TPS("Start scheduler-tick"));
7608 ++ lockdep_assert_irqs_disabled();
7609 + raw_cpu_inc(rcu_data.ticks_this_gp);
7610 + /* The load-acquire pairs with the store-release setting to true. */
7611 + if (smp_load_acquire(this_cpu_ptr(&rcu_data.rcu_urgent_qs))) {
7612 +@@ -2574,6 +2575,7 @@ void rcu_sched_clock_irq(int user)
7613 + rcu_flavor_sched_clock_irq(user);
7614 + if (rcu_pending(user))
7615 + invoke_rcu_core();
7616 ++ lockdep_assert_irqs_disabled();
7617 +
7618 + trace_rcu_utilization(TPS("End scheduler-tick"));
7619 + }
7620 +@@ -3730,6 +3732,8 @@ static int rcu_pending(int user)
7621 + struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
7622 + struct rcu_node *rnp = rdp->mynode;
7623 +
7624 ++ lockdep_assert_irqs_disabled();
7625 ++
7626 + /* Check for CPU stalls, if enabled. */
7627 + check_cpu_stall(rdp);
7628 +
7629 +diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
7630 +index 7d4f78bf40577..574aeaac9272d 100644
7631 +--- a/kernel/rcu/tree_plugin.h
7632 ++++ b/kernel/rcu/tree_plugin.h
7633 +@@ -682,6 +682,7 @@ static void rcu_flavor_sched_clock_irq(int user)
7634 + {
7635 + struct task_struct *t = current;
7636 +
7637 ++ lockdep_assert_irqs_disabled();
7638 + if (user || rcu_is_cpu_rrupt_from_idle()) {
7639 + rcu_note_voluntary_context_switch(current);
7640 + }
7641 +diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
7642 +index ca21d28a0f98f..251a9af3709af 100644
7643 +--- a/kernel/rcu/tree_stall.h
7644 ++++ b/kernel/rcu/tree_stall.h
7645 +@@ -7,6 +7,8 @@
7646 + * Author: Paul E. McKenney <paulmck@×××××××××.com>
7647 + */
7648 +
7649 ++#include <linux/kvm_para.h>
7650 ++
7651 + //////////////////////////////////////////////////////////////////////////////
7652 + //
7653 + // Controlling CPU stall warnings, including delay calculation.
7654 +@@ -260,8 +262,11 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
7655 + struct task_struct *t;
7656 + struct task_struct *ts[8];
7657 +
7658 +- if (!rcu_preempt_blocked_readers_cgp(rnp))
7659 ++ lockdep_assert_irqs_disabled();
7660 ++ if (!rcu_preempt_blocked_readers_cgp(rnp)) {
7661 ++ raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
7662 + return 0;
7663 ++ }
7664 + pr_err("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):",
7665 + rnp->level, rnp->grplo, rnp->grphi);
7666 + t = list_entry(rnp->gp_tasks->prev,
7667 +@@ -273,8 +278,8 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
7668 + break;
7669 + }
7670 + raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
7671 +- for (i--; i; i--) {
7672 +- t = ts[i];
7673 ++ while (i) {
7674 ++ t = ts[--i];
7675 + if (!try_invoke_on_locked_down_task(t, check_slow_task, &rscr))
7676 + pr_cont(" P%d", t->pid);
7677 + else
7678 +@@ -284,6 +289,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
7679 + ".q"[rscr.rs.b.need_qs],
7680 + ".e"[rscr.rs.b.exp_hint],
7681 + ".l"[rscr.on_blkd_list]);
7682 ++ lockdep_assert_irqs_disabled();
7683 + put_task_struct(t);
7684 + ndetected++;
7685 + }
7686 +@@ -472,6 +478,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
7687 + struct rcu_node *rnp;
7688 + long totqlen = 0;
7689 +
7690 ++ lockdep_assert_irqs_disabled();
7691 ++
7692 + /* Kick and suppress, if so configured. */
7693 + rcu_stall_kick_kthreads();
7694 + if (rcu_stall_is_suppressed())
7695 +@@ -493,6 +501,7 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
7696 + }
7697 + }
7698 + ndetected += rcu_print_task_stall(rnp, flags); // Releases rnp->lock.
7699 ++ lockdep_assert_irqs_disabled();
7700 + }
7701 +
7702 + for_each_possible_cpu(cpu)
7703 +@@ -538,6 +547,8 @@ static void print_cpu_stall(unsigned long gps)
7704 + struct rcu_node *rnp = rcu_get_root();
7705 + long totqlen = 0;
7706 +
7707 ++ lockdep_assert_irqs_disabled();
7708 ++
7709 + /* Kick and suppress, if so configured. */
7710 + rcu_stall_kick_kthreads();
7711 + if (rcu_stall_is_suppressed())
7712 +@@ -592,6 +603,7 @@ static void check_cpu_stall(struct rcu_data *rdp)
7713 + unsigned long js;
7714 + struct rcu_node *rnp;
7715 +
7716 ++ lockdep_assert_irqs_disabled();
7717 + if ((rcu_stall_is_suppressed() && !READ_ONCE(rcu_kick_kthreads)) ||
7718 + !rcu_gp_in_progress())
7719 + return;
7720 +@@ -633,6 +645,14 @@ static void check_cpu_stall(struct rcu_data *rdp)
7721 + (READ_ONCE(rnp->qsmask) & rdp->grpmask) &&
7722 + cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) {
7723 +
7724 ++ /*
7725 ++ * If a virtual machine is stopped by the host it can look to
7726 ++ * the watchdog like an RCU stall. Check to see if the host
7727 ++ * stopped the vm.
7728 ++ */
7729 ++ if (kvm_check_and_clear_guest_paused())
7730 ++ return;
7731 ++
7732 + /* We haven't checked in, so go dump stack. */
7733 + print_cpu_stall(gps);
7734 + if (READ_ONCE(rcu_cpu_stall_ftrace_dump))
7735 +@@ -642,6 +662,14 @@ static void check_cpu_stall(struct rcu_data *rdp)
7736 + ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY) &&
7737 + cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) {
7738 +
7739 ++ /*
7740 ++ * If a virtual machine is stopped by the host it can look to
7741 ++ * the watchdog like an RCU stall. Check to see if the host
7742 ++ * stopped the vm.
7743 ++ */
7744 ++ if (kvm_check_and_clear_guest_paused())
7745 ++ return;
7746 ++
7747 + /* They had a few time units to dump stack, so complain. */
7748 + print_other_cpu_stall(gs2, gps);
7749 + if (READ_ONCE(rcu_cpu_stall_ftrace_dump))
7750 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
7751 +index 84c105902027c..6db20a66e8e68 100644
7752 +--- a/kernel/sched/core.c
7753 ++++ b/kernel/sched/core.c
7754 +@@ -1279,6 +1279,23 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p)
7755 + uclamp_rq_dec_id(rq, p, clamp_id);
7756 + }
7757 +
7758 ++static inline void uclamp_rq_reinc_id(struct rq *rq, struct task_struct *p,
7759 ++ enum uclamp_id clamp_id)
7760 ++{
7761 ++ if (!p->uclamp[clamp_id].active)
7762 ++ return;
7763 ++
7764 ++ uclamp_rq_dec_id(rq, p, clamp_id);
7765 ++ uclamp_rq_inc_id(rq, p, clamp_id);
7766 ++
7767 ++ /*
7768 ++ * Make sure to clear the idle flag if we've transiently reached 0
7769 ++ * active tasks on rq.
7770 ++ */
7771 ++ if (clamp_id == UCLAMP_MAX && (rq->uclamp_flags & UCLAMP_FLAG_IDLE))
7772 ++ rq->uclamp_flags &= ~UCLAMP_FLAG_IDLE;
7773 ++}
7774 ++
7775 + static inline void
7776 + uclamp_update_active(struct task_struct *p)
7777 + {
7778 +@@ -1302,12 +1319,8 @@ uclamp_update_active(struct task_struct *p)
7779 + * affecting a valid clamp bucket, the next time it's enqueued,
7780 + * it will already see the updated clamp bucket value.
7781 + */
7782 +- for_each_clamp_id(clamp_id) {
7783 +- if (p->uclamp[clamp_id].active) {
7784 +- uclamp_rq_dec_id(rq, p, clamp_id);
7785 +- uclamp_rq_inc_id(rq, p, clamp_id);
7786 +- }
7787 +- }
7788 ++ for_each_clamp_id(clamp_id)
7789 ++ uclamp_rq_reinc_id(rq, p, clamp_id);
7790 +
7791 + task_rq_unlock(rq, p, &rf);
7792 + }
7793 +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
7794 +index 6b98c1fe6e7f8..a3ae00c348a8b 100644
7795 +--- a/kernel/sched/deadline.c
7796 ++++ b/kernel/sched/deadline.c
7797 +@@ -1735,6 +1735,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused
7798 + */
7799 + raw_spin_lock(&rq->lock);
7800 + if (p->dl.dl_non_contending) {
7801 ++ update_rq_clock(rq);
7802 + sub_running_bw(&p->dl, &rq->dl);
7803 + p->dl.dl_non_contending = 0;
7804 + /*
7805 +@@ -2703,7 +2704,7 @@ void __setparam_dl(struct task_struct *p, const struct sched_attr *attr)
7806 + dl_se->dl_runtime = attr->sched_runtime;
7807 + dl_se->dl_deadline = attr->sched_deadline;
7808 + dl_se->dl_period = attr->sched_period ?: dl_se->dl_deadline;
7809 +- dl_se->flags = attr->sched_flags;
7810 ++ dl_se->flags = attr->sched_flags & SCHED_DL_FLAGS;
7811 + dl_se->dl_bw = to_ratio(dl_se->dl_period, dl_se->dl_runtime);
7812 + dl_se->dl_density = to_ratio(dl_se->dl_deadline, dl_se->dl_runtime);
7813 + }
7814 +@@ -2716,7 +2717,8 @@ void __getparam_dl(struct task_struct *p, struct sched_attr *attr)
7815 + attr->sched_runtime = dl_se->dl_runtime;
7816 + attr->sched_deadline = dl_se->dl_deadline;
7817 + attr->sched_period = dl_se->dl_period;
7818 +- attr->sched_flags = dl_se->flags;
7819 ++ attr->sched_flags &= ~SCHED_DL_FLAGS;
7820 ++ attr->sched_flags |= dl_se->flags;
7821 + }
7822 +
7823 + /*
7824 +@@ -2813,7 +2815,7 @@ bool dl_param_changed(struct task_struct *p, const struct sched_attr *attr)
7825 + if (dl_se->dl_runtime != attr->sched_runtime ||
7826 + dl_se->dl_deadline != attr->sched_deadline ||
7827 + dl_se->dl_period != attr->sched_period ||
7828 +- dl_se->flags != attr->sched_flags)
7829 ++ dl_se->flags != (attr->sched_flags & SCHED_DL_FLAGS))
7830 + return true;
7831 +
7832 + return false;
7833 +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
7834 +index bad97d35684d2..c004e3b89c324 100644
7835 +--- a/kernel/sched/fair.c
7836 ++++ b/kernel/sched/fair.c
7837 +@@ -1533,7 +1533,7 @@ static inline bool is_core_idle(int cpu)
7838 + if (cpu == sibling)
7839 + continue;
7840 +
7841 +- if (!idle_cpu(cpu))
7842 ++ if (!idle_cpu(sibling))
7843 + return false;
7844 + }
7845 + #endif
7846 +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
7847 +index 39112ac7ab347..08db8e095e48f 100644
7848 +--- a/kernel/sched/sched.h
7849 ++++ b/kernel/sched/sched.h
7850 +@@ -226,6 +226,8 @@ static inline void update_avg(u64 *avg, u64 sample)
7851 + */
7852 + #define SCHED_FLAG_SUGOV 0x10000000
7853 +
7854 ++#define SCHED_DL_FLAGS (SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN | SCHED_FLAG_SUGOV)
7855 ++
7856 + static inline bool dl_entity_is_special(struct sched_dl_entity *dl_se)
7857 + {
7858 + #ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL
7859 +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
7860 +index 9505b1f21cdf8..4ef90718c1146 100644
7861 +--- a/kernel/time/hrtimer.c
7862 ++++ b/kernel/time/hrtimer.c
7863 +@@ -758,22 +758,6 @@ static void hrtimer_switch_to_hres(void)
7864 + retrigger_next_event(NULL);
7865 + }
7866 +
7867 +-static void clock_was_set_work(struct work_struct *work)
7868 +-{
7869 +- clock_was_set();
7870 +-}
7871 +-
7872 +-static DECLARE_WORK(hrtimer_work, clock_was_set_work);
7873 +-
7874 +-/*
7875 +- * Called from timekeeping and resume code to reprogram the hrtimer
7876 +- * interrupt device on all cpus.
7877 +- */
7878 +-void clock_was_set_delayed(void)
7879 +-{
7880 +- schedule_work(&hrtimer_work);
7881 +-}
7882 +-
7883 + #else
7884 +
7885 + static inline int hrtimer_is_hres_enabled(void) { return 0; }
7886 +@@ -891,6 +875,22 @@ void clock_was_set(void)
7887 + timerfd_clock_was_set();
7888 + }
7889 +
7890 ++static void clock_was_set_work(struct work_struct *work)
7891 ++{
7892 ++ clock_was_set();
7893 ++}
7894 ++
7895 ++static DECLARE_WORK(hrtimer_work, clock_was_set_work);
7896 ++
7897 ++/*
7898 ++ * Called from timekeeping and resume code to reprogram the hrtimer
7899 ++ * interrupt device on all cpus and to notify timerfd.
7900 ++ */
7901 ++void clock_was_set_delayed(void)
7902 ++{
7903 ++ schedule_work(&hrtimer_work);
7904 ++}
7905 ++
7906 + /*
7907 + * During resume we might have to reprogram the high resolution timer
7908 + * interrupt on all online CPUs. However, all other CPUs will be
7909 +@@ -1030,12 +1030,13 @@ static void __remove_hrtimer(struct hrtimer *timer,
7910 + * remove hrtimer, called with base lock held
7911 + */
7912 + static inline int
7913 +-remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart)
7914 ++remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base,
7915 ++ bool restart, bool keep_local)
7916 + {
7917 + u8 state = timer->state;
7918 +
7919 + if (state & HRTIMER_STATE_ENQUEUED) {
7920 +- int reprogram;
7921 ++ bool reprogram;
7922 +
7923 + /*
7924 + * Remove the timer and force reprogramming when high
7925 +@@ -1048,8 +1049,16 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool rest
7926 + debug_deactivate(timer);
7927 + reprogram = base->cpu_base == this_cpu_ptr(&hrtimer_bases);
7928 +
7929 ++ /*
7930 ++ * If the timer is not restarted then reprogramming is
7931 ++ * required if the timer is local. If it is local and about
7932 ++ * to be restarted, avoid programming it twice (on removal
7933 ++ * and a moment later when it's requeued).
7934 ++ */
7935 + if (!restart)
7936 + state = HRTIMER_STATE_INACTIVE;
7937 ++ else
7938 ++ reprogram &= !keep_local;
7939 +
7940 + __remove_hrtimer(timer, base, state, reprogram);
7941 + return 1;
7942 +@@ -1103,9 +1112,31 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
7943 + struct hrtimer_clock_base *base)
7944 + {
7945 + struct hrtimer_clock_base *new_base;
7946 ++ bool force_local, first;
7947 ++
7948 ++ /*
7949 ++ * If the timer is on the local cpu base and is the first expiring
7950 ++ * timer then this might end up reprogramming the hardware twice
7951 ++ * (on removal and on enqueue). To avoid that by prevent the
7952 ++ * reprogram on removal, keep the timer local to the current CPU
7953 ++ * and enforce reprogramming after it is queued no matter whether
7954 ++ * it is the new first expiring timer again or not.
7955 ++ */
7956 ++ force_local = base->cpu_base == this_cpu_ptr(&hrtimer_bases);
7957 ++ force_local &= base->cpu_base->next_timer == timer;
7958 +
7959 +- /* Remove an active timer from the queue: */
7960 +- remove_hrtimer(timer, base, true);
7961 ++ /*
7962 ++ * Remove an active timer from the queue. In case it is not queued
7963 ++ * on the current CPU, make sure that remove_hrtimer() updates the
7964 ++ * remote data correctly.
7965 ++ *
7966 ++ * If it's on the current CPU and the first expiring timer, then
7967 ++ * skip reprogramming, keep the timer local and enforce
7968 ++ * reprogramming later if it was the first expiring timer. This
7969 ++ * avoids programming the underlying clock event twice (once at
7970 ++ * removal and once after enqueue).
7971 ++ */
7972 ++ remove_hrtimer(timer, base, true, force_local);
7973 +
7974 + if (mode & HRTIMER_MODE_REL)
7975 + tim = ktime_add_safe(tim, base->get_time());
7976 +@@ -1115,9 +1146,24 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
7977 + hrtimer_set_expires_range_ns(timer, tim, delta_ns);
7978 +
7979 + /* Switch the timer base, if necessary: */
7980 +- new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
7981 ++ if (!force_local) {
7982 ++ new_base = switch_hrtimer_base(timer, base,
7983 ++ mode & HRTIMER_MODE_PINNED);
7984 ++ } else {
7985 ++ new_base = base;
7986 ++ }
7987 ++
7988 ++ first = enqueue_hrtimer(timer, new_base, mode);
7989 ++ if (!force_local)
7990 ++ return first;
7991 +
7992 +- return enqueue_hrtimer(timer, new_base, mode);
7993 ++ /*
7994 ++ * Timer was forced to stay on the current CPU to avoid
7995 ++ * reprogramming on removal and enqueue. Force reprogram the
7996 ++ * hardware by evaluating the new first expiring timer.
7997 ++ */
7998 ++ hrtimer_force_reprogram(new_base->cpu_base, 1);
7999 ++ return 0;
8000 + }
8001 +
8002 + /**
8003 +@@ -1183,7 +1229,7 @@ int hrtimer_try_to_cancel(struct hrtimer *timer)
8004 + base = lock_hrtimer_base(timer, &flags);
8005 +
8006 + if (!hrtimer_callback_running(timer))
8007 +- ret = remove_hrtimer(timer, base, false);
8008 ++ ret = remove_hrtimer(timer, base, false, false);
8009 +
8010 + unlock_hrtimer_base(timer, &flags);
8011 +
8012 +diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
8013 +index 08c033b802569..d3d42b7637a19 100644
8014 +--- a/kernel/time/posix-cpu-timers.c
8015 ++++ b/kernel/time/posix-cpu-timers.c
8016 +@@ -1346,8 +1346,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
8017 + }
8018 + }
8019 +
8020 +- if (!*newval)
8021 +- return;
8022 + *newval += now;
8023 + }
8024 +
8025 +diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
8026 +index 7b24961367292..5294f5b1f9550 100644
8027 +--- a/kernel/time/tick-internal.h
8028 ++++ b/kernel/time/tick-internal.h
8029 +@@ -165,3 +165,6 @@ DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);
8030 +
8031 + extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem);
8032 + void timer_clear_idle(void);
8033 ++
8034 ++void clock_was_set(void);
8035 ++void clock_was_set_delayed(void);
8036 +diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c
8037 +index 3c63710c20c69..e6c4b3180ab1d 100644
8038 +--- a/lib/mpi/mpiutil.c
8039 ++++ b/lib/mpi/mpiutil.c
8040 +@@ -148,7 +148,7 @@ int mpi_resize(MPI a, unsigned nlimbs)
8041 + return 0; /* no need to do it */
8042 +
8043 + if (a->d) {
8044 +- p = kmalloc_array(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL);
8045 ++ p = kcalloc(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL);
8046 + if (!p)
8047 + return -ENOMEM;
8048 + memcpy(p, a->d, a->alloced * sizeof(mpi_limb_t));
8049 +diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
8050 +index 1c140af06d527..600b9563bfc53 100644
8051 +--- a/net/6lowpan/debugfs.c
8052 ++++ b/net/6lowpan/debugfs.c
8053 +@@ -170,7 +170,8 @@ static void lowpan_dev_debugfs_ctx_init(struct net_device *dev,
8054 + struct dentry *root;
8055 + char buf[32];
8056 +
8057 +- WARN_ON_ONCE(id > LOWPAN_IPHC_CTX_TABLE_SIZE);
8058 ++ if (WARN_ON_ONCE(id >= LOWPAN_IPHC_CTX_TABLE_SIZE))
8059 ++ return;
8060 +
8061 + sprintf(buf, "%d", id);
8062 +
8063 +diff --git a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h
8064 +index c32638dddbf94..f6b9dc4e408f2 100644
8065 +--- a/net/bluetooth/cmtp/cmtp.h
8066 ++++ b/net/bluetooth/cmtp/cmtp.h
8067 +@@ -26,7 +26,7 @@
8068 + #include <linux/types.h>
8069 + #include <net/bluetooth/bluetooth.h>
8070 +
8071 +-#define BTNAMSIZ 18
8072 ++#define BTNAMSIZ 21
8073 +
8074 + /* CMTP ioctl defines */
8075 + #define CMTPCONNADD _IOW('C', 200, int)
8076 +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
8077 +index 65d3f54099637..a9097fb7eb825 100644
8078 +--- a/net/bluetooth/hci_core.c
8079 ++++ b/net/bluetooth/hci_core.c
8080 +@@ -1336,6 +1336,12 @@ int hci_inquiry(void __user *arg)
8081 + goto done;
8082 + }
8083 +
8084 ++ /* Restrict maximum inquiry length to 60 seconds */
8085 ++ if (ir.length > 60) {
8086 ++ err = -EINVAL;
8087 ++ goto done;
8088 ++ }
8089 ++
8090 + hci_dev_lock(hdev);
8091 + if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX ||
8092 + inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) {
8093 +@@ -1726,6 +1732,14 @@ int hci_dev_do_close(struct hci_dev *hdev)
8094 + hci_request_cancel_all(hdev);
8095 + hci_req_sync_lock(hdev);
8096 +
8097 ++ if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
8098 ++ !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
8099 ++ test_bit(HCI_UP, &hdev->flags)) {
8100 ++ /* Execute vendor specific shutdown routine */
8101 ++ if (hdev->shutdown)
8102 ++ hdev->shutdown(hdev);
8103 ++ }
8104 ++
8105 + if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
8106 + cancel_delayed_work_sync(&hdev->cmd_timer);
8107 + hci_req_sync_unlock(hdev);
8108 +diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
8109 +index 31a585fe0c7c6..08f67f91d427f 100644
8110 +--- a/net/bluetooth/mgmt.c
8111 ++++ b/net/bluetooth/mgmt.c
8112 +@@ -7464,7 +7464,7 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,
8113 + * advertising.
8114 + */
8115 + if (hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY))
8116 +- return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING,
8117 ++ return mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING,
8118 + MGMT_STATUS_NOT_SUPPORTED);
8119 +
8120 + if (cp->instance < 1 || cp->instance > hdev->le_num_of_adv_sets)
8121 +diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
8122 +index 22a110f37abc6..600b1832e1dd6 100644
8123 +--- a/net/bluetooth/sco.c
8124 ++++ b/net/bluetooth/sco.c
8125 +@@ -85,7 +85,6 @@ static void sco_sock_timeout(struct timer_list *t)
8126 + sk->sk_state_change(sk);
8127 + bh_unlock_sock(sk);
8128 +
8129 +- sco_sock_kill(sk);
8130 + sock_put(sk);
8131 + }
8132 +
8133 +@@ -177,7 +176,6 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
8134 + sco_sock_clear_timer(sk);
8135 + sco_chan_del(sk, err);
8136 + bh_unlock_sock(sk);
8137 +- sco_sock_kill(sk);
8138 + sock_put(sk);
8139 + }
8140 +
8141 +@@ -394,8 +392,7 @@ static void sco_sock_cleanup_listen(struct sock *parent)
8142 + */
8143 + static void sco_sock_kill(struct sock *sk)
8144 + {
8145 +- if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket ||
8146 +- sock_flag(sk, SOCK_DEAD))
8147 ++ if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
8148 + return;
8149 +
8150 + BT_DBG("sk %p state %d", sk, sk->sk_state);
8151 +@@ -447,7 +444,6 @@ static void sco_sock_close(struct sock *sk)
8152 + lock_sock(sk);
8153 + __sco_sock_close(sk);
8154 + release_sock(sk);
8155 +- sco_sock_kill(sk);
8156 + }
8157 +
8158 + static void sco_skb_put_cmsg(struct sk_buff *skb, struct msghdr *msg,
8159 +@@ -773,6 +769,11 @@ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting)
8160 + cp.max_latency = cpu_to_le16(0xffff);
8161 + cp.retrans_effort = 0xff;
8162 + break;
8163 ++ default:
8164 ++ /* use CVSD settings as fallback */
8165 ++ cp.max_latency = cpu_to_le16(0xffff);
8166 ++ cp.retrans_effort = 0xff;
8167 ++ break;
8168 + }
8169 +
8170 + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
8171 +diff --git a/net/core/devlink.c b/net/core/devlink.c
8172 +index 90badb6f72271..96cf4bc1f9585 100644
8173 +--- a/net/core/devlink.c
8174 ++++ b/net/core/devlink.c
8175 +@@ -3079,10 +3079,12 @@ static void devlink_param_notify(struct devlink *devlink,
8176 + struct devlink_param_item *param_item,
8177 + enum devlink_command cmd);
8178 +
8179 +-static void devlink_reload_netns_change(struct devlink *devlink,
8180 +- struct net *dest_net)
8181 ++static void devlink_ns_change_notify(struct devlink *devlink,
8182 ++ struct net *dest_net, struct net *curr_net,
8183 ++ bool new)
8184 + {
8185 + struct devlink_param_item *param_item;
8186 ++ enum devlink_command cmd;
8187 +
8188 + /* Userspace needs to be notified about devlink objects
8189 + * removed from original and entering new network namespace.
8190 +@@ -3090,17 +3092,18 @@ static void devlink_reload_netns_change(struct devlink *devlink,
8191 + * reload process so the notifications are generated separatelly.
8192 + */
8193 +
8194 +- list_for_each_entry(param_item, &devlink->param_list, list)
8195 +- devlink_param_notify(devlink, 0, param_item,
8196 +- DEVLINK_CMD_PARAM_DEL);
8197 +- devlink_notify(devlink, DEVLINK_CMD_DEL);
8198 ++ if (!dest_net || net_eq(dest_net, curr_net))
8199 ++ return;
8200 +
8201 +- __devlink_net_set(devlink, dest_net);
8202 ++ if (new)
8203 ++ devlink_notify(devlink, DEVLINK_CMD_NEW);
8204 +
8205 +- devlink_notify(devlink, DEVLINK_CMD_NEW);
8206 ++ cmd = new ? DEVLINK_CMD_PARAM_NEW : DEVLINK_CMD_PARAM_DEL;
8207 + list_for_each_entry(param_item, &devlink->param_list, list)
8208 +- devlink_param_notify(devlink, 0, param_item,
8209 +- DEVLINK_CMD_PARAM_NEW);
8210 ++ devlink_param_notify(devlink, 0, param_item, cmd);
8211 ++
8212 ++ if (!new)
8213 ++ devlink_notify(devlink, DEVLINK_CMD_DEL);
8214 + }
8215 +
8216 + static bool devlink_reload_supported(const struct devlink_ops *ops)
8217 +@@ -3180,6 +3183,7 @@ static int devlink_reload(struct devlink *devlink, struct net *dest_net,
8218 + u32 *actions_performed, struct netlink_ext_ack *extack)
8219 + {
8220 + u32 remote_reload_stats[DEVLINK_RELOAD_STATS_ARRAY_SIZE];
8221 ++ struct net *curr_net;
8222 + int err;
8223 +
8224 + if (!devlink->reload_enabled)
8225 +@@ -3187,18 +3191,22 @@ static int devlink_reload(struct devlink *devlink, struct net *dest_net,
8226 +
8227 + memcpy(remote_reload_stats, devlink->stats.remote_reload_stats,
8228 + sizeof(remote_reload_stats));
8229 ++
8230 ++ curr_net = devlink_net(devlink);
8231 ++ devlink_ns_change_notify(devlink, dest_net, curr_net, false);
8232 + err = devlink->ops->reload_down(devlink, !!dest_net, action, limit, extack);
8233 + if (err)
8234 + return err;
8235 +
8236 +- if (dest_net && !net_eq(dest_net, devlink_net(devlink)))
8237 +- devlink_reload_netns_change(devlink, dest_net);
8238 ++ if (dest_net && !net_eq(dest_net, curr_net))
8239 ++ __devlink_net_set(devlink, dest_net);
8240 +
8241 + err = devlink->ops->reload_up(devlink, action, limit, actions_performed, extack);
8242 + devlink_reload_failed_set(devlink, !!err);
8243 + if (err)
8244 + return err;
8245 +
8246 ++ devlink_ns_change_notify(devlink, dest_net, curr_net, true);
8247 + WARN_ON(!(*actions_performed & BIT(action)));
8248 + /* Catch driver on updating the remote action within devlink reload */
8249 + WARN_ON(memcmp(remote_reload_stats, devlink->stats.remote_reload_stats,
8250 +@@ -3395,7 +3403,7 @@ out_free_msg:
8251 +
8252 + void devlink_flash_update_begin_notify(struct devlink *devlink)
8253 + {
8254 +- struct devlink_flash_notify params = { 0 };
8255 ++ struct devlink_flash_notify params = {};
8256 +
8257 + __devlink_flash_update_notify(devlink,
8258 + DEVLINK_CMD_FLASH_UPDATE,
8259 +@@ -3405,7 +3413,7 @@ EXPORT_SYMBOL_GPL(devlink_flash_update_begin_notify);
8260 +
8261 + void devlink_flash_update_end_notify(struct devlink *devlink)
8262 + {
8263 +- struct devlink_flash_notify params = { 0 };
8264 ++ struct devlink_flash_notify params = {};
8265 +
8266 + __devlink_flash_update_notify(devlink,
8267 + DEVLINK_CMD_FLASH_UPDATE_END,
8268 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
8269 +index 3d9946fd41f38..ce787c3867938 100644
8270 +--- a/net/ipv4/route.c
8271 ++++ b/net/ipv4/route.c
8272 +@@ -610,18 +610,25 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
8273 + }
8274 + }
8275 +
8276 +-static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
8277 ++static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
8278 + {
8279 +- struct fib_nh_exception *fnhe, *oldest;
8280 ++ struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
8281 ++ struct fib_nh_exception *fnhe, *oldest = NULL;
8282 +
8283 +- oldest = rcu_dereference(hash->chain);
8284 +- for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe;
8285 +- fnhe = rcu_dereference(fnhe->fnhe_next)) {
8286 +- if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp))
8287 ++ for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
8288 ++ fnhe = rcu_dereference_protected(*fnhe_p,
8289 ++ lockdep_is_held(&fnhe_lock));
8290 ++ if (!fnhe)
8291 ++ break;
8292 ++ if (!oldest ||
8293 ++ time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
8294 + oldest = fnhe;
8295 ++ oldest_p = fnhe_p;
8296 ++ }
8297 + }
8298 + fnhe_flush_routes(oldest);
8299 +- return oldest;
8300 ++ *oldest_p = oldest->fnhe_next;
8301 ++ kfree_rcu(oldest, rcu);
8302 + }
8303 +
8304 + static u32 fnhe_hashfun(__be32 daddr)
8305 +@@ -700,16 +707,21 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr,
8306 + if (rt)
8307 + fill_route_from_fnhe(rt, fnhe);
8308 + } else {
8309 +- if (depth > FNHE_RECLAIM_DEPTH)
8310 +- fnhe = fnhe_oldest(hash);
8311 +- else {
8312 +- fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
8313 +- if (!fnhe)
8314 +- goto out_unlock;
8315 +-
8316 +- fnhe->fnhe_next = hash->chain;
8317 +- rcu_assign_pointer(hash->chain, fnhe);
8318 ++ /* Randomize max depth to avoid some side channels attacks. */
8319 ++ int max_depth = FNHE_RECLAIM_DEPTH +
8320 ++ prandom_u32_max(FNHE_RECLAIM_DEPTH);
8321 ++
8322 ++ while (depth > max_depth) {
8323 ++ fnhe_remove_oldest(hash);
8324 ++ depth--;
8325 + }
8326 ++
8327 ++ fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
8328 ++ if (!fnhe)
8329 ++ goto out_unlock;
8330 ++
8331 ++ fnhe->fnhe_next = hash->chain;
8332 ++
8333 + fnhe->fnhe_genid = genid;
8334 + fnhe->fnhe_daddr = daddr;
8335 + fnhe->fnhe_gw = gw;
8336 +@@ -717,6 +729,8 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr,
8337 + fnhe->fnhe_mtu_locked = lock;
8338 + fnhe->fnhe_expires = max(1UL, expires);
8339 +
8340 ++ rcu_assign_pointer(hash->chain, fnhe);
8341 ++
8342 + /* Exception created; mark the cached routes for the nexthop
8343 + * stale, so anyone caching it rechecks if this exception
8344 + * applies to them.
8345 +@@ -3064,7 +3078,7 @@ static struct sk_buff *inet_rtm_getroute_build_skb(__be32 src, __be32 dst,
8346 + udph = skb_put_zero(skb, sizeof(struct udphdr));
8347 + udph->source = sport;
8348 + udph->dest = dport;
8349 +- udph->len = sizeof(struct udphdr);
8350 ++ udph->len = htons(sizeof(struct udphdr));
8351 + udph->check = 0;
8352 + break;
8353 + }
8354 +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
8355 +index 04e259a04443c..71395e745bc5e 100644
8356 +--- a/net/ipv4/tcp_ipv4.c
8357 ++++ b/net/ipv4/tcp_ipv4.c
8358 +@@ -2417,6 +2417,7 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos)
8359 + static void *tcp_seek_last_pos(struct seq_file *seq)
8360 + {
8361 + struct tcp_iter_state *st = seq->private;
8362 ++ int bucket = st->bucket;
8363 + int offset = st->offset;
8364 + int orig_num = st->num;
8365 + void *rc = NULL;
8366 +@@ -2427,7 +2428,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
8367 + break;
8368 + st->state = TCP_SEQ_STATE_LISTENING;
8369 + rc = listening_get_next(seq, NULL);
8370 +- while (offset-- && rc)
8371 ++ while (offset-- && rc && bucket == st->bucket)
8372 + rc = listening_get_next(seq, rc);
8373 + if (rc)
8374 + break;
8375 +@@ -2438,7 +2439,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
8376 + if (st->bucket > tcp_hashinfo.ehash_mask)
8377 + break;
8378 + rc = established_get_first(seq);
8379 +- while (offset-- && rc)
8380 ++ while (offset-- && rc && bucket == st->bucket)
8381 + rc = established_get_next(seq, rc);
8382 + }
8383 +
8384 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
8385 +index bcf4fae83a9bd..168a7b4d957ae 100644
8386 +--- a/net/ipv6/route.c
8387 ++++ b/net/ipv6/route.c
8388 +@@ -1655,6 +1655,7 @@ static int rt6_insert_exception(struct rt6_info *nrt,
8389 + struct in6_addr *src_key = NULL;
8390 + struct rt6_exception *rt6_ex;
8391 + struct fib6_nh *nh = res->nh;
8392 ++ int max_depth;
8393 + int err = 0;
8394 +
8395 + spin_lock_bh(&rt6_exception_lock);
8396 +@@ -1709,7 +1710,9 @@ static int rt6_insert_exception(struct rt6_info *nrt,
8397 + bucket->depth++;
8398 + net->ipv6.rt6_stats->fib_rt_cache++;
8399 +
8400 +- if (bucket->depth > FIB6_MAX_DEPTH)
8401 ++ /* Randomize max depth to avoid some side channels attacks. */
8402 ++ max_depth = FIB6_MAX_DEPTH + prandom_u32_max(FIB6_MAX_DEPTH);
8403 ++ while (bucket->depth > max_depth)
8404 + rt6_exception_remove_oldest(bucket);
8405 +
8406 + out:
8407 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
8408 +index 20b3581a1c43f..673ad3cf2c3ab 100644
8409 +--- a/net/mac80211/tx.c
8410 ++++ b/net/mac80211/tx.c
8411 +@@ -3229,7 +3229,9 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
8412 + if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
8413 + return true;
8414 +
8415 +- if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr)))
8416 ++ if (!ieee80211_amsdu_realloc_pad(local, skb,
8417 ++ sizeof(*amsdu_hdr) +
8418 ++ local->hw.extra_tx_headroom))
8419 + return false;
8420 +
8421 + data = skb_push(skb, sizeof(*amsdu_hdr));
8422 +diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
8423 +index 4f50a64315cf0..50f40943c8153 100644
8424 +--- a/net/netlabel/netlabel_cipso_v4.c
8425 ++++ b/net/netlabel/netlabel_cipso_v4.c
8426 +@@ -187,14 +187,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
8427 + }
8428 + doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size,
8429 + sizeof(u32),
8430 +- GFP_KERNEL);
8431 ++ GFP_KERNEL | __GFP_NOWARN);
8432 + if (doi_def->map.std->lvl.local == NULL) {
8433 + ret_val = -ENOMEM;
8434 + goto add_std_failure;
8435 + }
8436 + doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size,
8437 + sizeof(u32),
8438 +- GFP_KERNEL);
8439 ++ GFP_KERNEL | __GFP_NOWARN);
8440 + if (doi_def->map.std->lvl.cipso == NULL) {
8441 + ret_val = -ENOMEM;
8442 + goto add_std_failure;
8443 +@@ -263,7 +263,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
8444 + doi_def->map.std->cat.local = kcalloc(
8445 + doi_def->map.std->cat.local_size,
8446 + sizeof(u32),
8447 +- GFP_KERNEL);
8448 ++ GFP_KERNEL | __GFP_NOWARN);
8449 + if (doi_def->map.std->cat.local == NULL) {
8450 + ret_val = -ENOMEM;
8451 + goto add_std_failure;
8452 +@@ -271,7 +271,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
8453 + doi_def->map.std->cat.cipso = kcalloc(
8454 + doi_def->map.std->cat.cipso_size,
8455 + sizeof(u32),
8456 +- GFP_KERNEL);
8457 ++ GFP_KERNEL | __GFP_NOWARN);
8458 + if (doi_def->map.std->cat.cipso == NULL) {
8459 + ret_val = -ENOMEM;
8460 + goto add_std_failure;
8461 +diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
8462 +index 53d45e029c36d..4a78fcf5d4f98 100644
8463 +--- a/net/sched/sch_cbq.c
8464 ++++ b/net/sched/sch_cbq.c
8465 +@@ -1614,7 +1614,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
8466 + err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack);
8467 + if (err) {
8468 + kfree(cl);
8469 +- return err;
8470 ++ goto failure;
8471 + }
8472 +
8473 + if (tca[TCA_RATE]) {
8474 +diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c
8475 +index f78cb18319aaf..16eb839e71f03 100644
8476 +--- a/samples/bpf/xdp_redirect_cpu_user.c
8477 ++++ b/samples/bpf/xdp_redirect_cpu_user.c
8478 +@@ -837,7 +837,7 @@ int main(int argc, char **argv)
8479 + memset(cpu, 0, n_cpus * sizeof(int));
8480 +
8481 + /* Parse commands line args */
8482 +- while ((opt = getopt_long(argc, argv, "hSd:s:p:q:c:xzFf:e:r:m:",
8483 ++ while ((opt = getopt_long(argc, argv, "hSd:s:p:q:c:xzFf:e:r:m:n",
8484 + long_options, &longindex)) != -1) {
8485 + switch (opt) {
8486 + case 'd':
8487 +diff --git a/samples/pktgen/pktgen_sample04_many_flows.sh b/samples/pktgen/pktgen_sample04_many_flows.sh
8488 +index 2cd6b701400de..9db1ecf8de8bc 100755
8489 +--- a/samples/pktgen/pktgen_sample04_many_flows.sh
8490 ++++ b/samples/pktgen/pktgen_sample04_many_flows.sh
8491 +@@ -13,13 +13,15 @@ root_check_run_with_sudo "$@"
8492 + # Parameter parsing via include
8493 + source ${basedir}/parameters.sh
8494 + # Set some default params, if they didn't get set
8495 +-[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
8496 ++if [ -z "$DEST_IP" ]; then
8497 ++ [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
8498 ++fi
8499 + [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
8500 + [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
8501 + [ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
8502 + if [ -n "$DEST_IP" ]; then
8503 +- validate_addr $DEST_IP
8504 +- read -r DST_MIN DST_MAX <<< $(parse_addr $DEST_IP)
8505 ++ validate_addr${IP6} $DEST_IP
8506 ++ read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP)
8507 + fi
8508 + if [ -n "$DST_PORT" ]; then
8509 + read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT)
8510 +@@ -65,8 +67,8 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
8511 +
8512 + # Single destination
8513 + pg_set $dev "dst_mac $DST_MAC"
8514 +- pg_set $dev "dst_min $DST_MIN"
8515 +- pg_set $dev "dst_max $DST_MAX"
8516 ++ pg_set $dev "dst${IP6}_min $DST_MIN"
8517 ++ pg_set $dev "dst${IP6}_max $DST_MAX"
8518 +
8519 + if [ -n "$DST_PORT" ]; then
8520 + # Single destination port or random port range
8521 +diff --git a/samples/pktgen/pktgen_sample05_flow_per_thread.sh b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
8522 +index 4cb6252ade399..9fc6c6da028ac 100755
8523 +--- a/samples/pktgen/pktgen_sample05_flow_per_thread.sh
8524 ++++ b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
8525 +@@ -17,14 +17,16 @@ root_check_run_with_sudo "$@"
8526 + # Parameter parsing via include
8527 + source ${basedir}/parameters.sh
8528 + # Set some default params, if they didn't get set
8529 +-[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
8530 ++if [ -z "$DEST_IP" ]; then
8531 ++ [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
8532 ++fi
8533 + [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
8534 + [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
8535 + [ -z "$BURST" ] && BURST=32
8536 + [ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
8537 + if [ -n "$DEST_IP" ]; then
8538 +- validate_addr $DEST_IP
8539 +- read -r DST_MIN DST_MAX <<< $(parse_addr $DEST_IP)
8540 ++ validate_addr${IP6} $DEST_IP
8541 ++ read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP)
8542 + fi
8543 + if [ -n "$DST_PORT" ]; then
8544 + read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT)
8545 +@@ -55,8 +57,8 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
8546 +
8547 + # Single destination
8548 + pg_set $dev "dst_mac $DST_MAC"
8549 +- pg_set $dev "dst_min $DST_MIN"
8550 +- pg_set $dev "dst_max $DST_MAX"
8551 ++ pg_set $dev "dst${IP6}_min $DST_MIN"
8552 ++ pg_set $dev "dst${IP6}_max $DST_MAX"
8553 +
8554 + if [ -n "$DST_PORT" ]; then
8555 + # Single destination port or random port range
8556 +diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig
8557 +index 12e9250c1bec6..9e72edb8d31af 100644
8558 +--- a/security/integrity/ima/Kconfig
8559 ++++ b/security/integrity/ima/Kconfig
8560 +@@ -6,7 +6,6 @@ config IMA
8561 + select SECURITYFS
8562 + select CRYPTO
8563 + select CRYPTO_HMAC
8564 +- select CRYPTO_MD5
8565 + select CRYPTO_SHA1
8566 + select CRYPTO_HASH_INFO
8567 + select TCG_TPM if HAS_IOMEM && !UML
8568 +diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c
8569 +index 1e5c019161738..95cc31525c573 100644
8570 +--- a/security/integrity/ima/ima_mok.c
8571 ++++ b/security/integrity/ima/ima_mok.c
8572 +@@ -21,7 +21,7 @@ struct key *ima_blacklist_keyring;
8573 + /*
8574 + * Allocate the IMA blacklist keyring
8575 + */
8576 +-__init int ima_mok_init(void)
8577 ++static __init int ima_mok_init(void)
8578 + {
8579 + struct key_restriction *restriction;
8580 +
8581 +diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
8582 +index 547445d1e3c69..89e545eb9a8a0 100644
8583 +--- a/sound/soc/codecs/rt5682-i2c.c
8584 ++++ b/sound/soc/codecs/rt5682-i2c.c
8585 +@@ -117,6 +117,13 @@ static struct snd_soc_dai_driver rt5682_dai[] = {
8586 + },
8587 + };
8588 +
8589 ++static void rt5682_i2c_disable_regulators(void *data)
8590 ++{
8591 ++ struct rt5682_priv *rt5682 = data;
8592 ++
8593 ++ regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies);
8594 ++}
8595 ++
8596 + static int rt5682_i2c_probe(struct i2c_client *i2c,
8597 + const struct i2c_device_id *id)
8598 + {
8599 +@@ -157,6 +164,11 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
8600 + return ret;
8601 + }
8602 +
8603 ++ ret = devm_add_action_or_reset(&i2c->dev, rt5682_i2c_disable_regulators,
8604 ++ rt5682);
8605 ++ if (ret)
8606 ++ return ret;
8607 ++
8608 + ret = regulator_bulk_enable(ARRAY_SIZE(rt5682->supplies),
8609 + rt5682->supplies);
8610 + if (ret) {
8611 +@@ -275,6 +287,13 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
8612 + rt5682_reset(rt5682);
8613 + }
8614 +
8615 ++static int rt5682_i2c_remove(struct i2c_client *client)
8616 ++{
8617 ++ rt5682_i2c_shutdown(client);
8618 ++
8619 ++ return 0;
8620 ++}
8621 ++
8622 + static const struct of_device_id rt5682_of_match[] = {
8623 + {.compatible = "realtek,rt5682i"},
8624 + {},
8625 +@@ -301,6 +320,7 @@ static struct i2c_driver rt5682_i2c_driver = {
8626 + .probe_type = PROBE_PREFER_ASYNCHRONOUS,
8627 + },
8628 + .probe = rt5682_i2c_probe,
8629 ++ .remove = rt5682_i2c_remove,
8630 + .shutdown = rt5682_i2c_shutdown,
8631 + .id_table = rt5682_i2c_id,
8632 + };
8633 +diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
8634 +index 4d2b1ec7c03bb..2677d0c3b19ba 100644
8635 +--- a/sound/soc/codecs/wcd9335.c
8636 ++++ b/sound/soc/codecs/wcd9335.c
8637 +@@ -4076,6 +4076,16 @@ static int wcd9335_setup_irqs(struct wcd9335_codec *wcd)
8638 + return ret;
8639 + }
8640 +
8641 ++static void wcd9335_teardown_irqs(struct wcd9335_codec *wcd)
8642 ++{
8643 ++ int i;
8644 ++
8645 ++ /* disable interrupts on all slave ports */
8646 ++ for (i = 0; i < WCD9335_SLIM_NUM_PORT_REG; i++)
8647 ++ regmap_write(wcd->if_regmap, WCD9335_SLIM_PGD_PORT_INT_EN0 + i,
8648 ++ 0x00);
8649 ++}
8650 ++
8651 + static void wcd9335_cdc_sido_ccl_enable(struct wcd9335_codec *wcd,
8652 + bool ccl_flag)
8653 + {
8654 +@@ -4844,6 +4854,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component)
8655 + static int wcd9335_codec_probe(struct snd_soc_component *component)
8656 + {
8657 + struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
8658 ++ int ret;
8659 + int i;
8660 +
8661 + snd_soc_component_init_regmap(component, wcd->regmap);
8662 +@@ -4861,7 +4872,15 @@ static int wcd9335_codec_probe(struct snd_soc_component *component)
8663 + for (i = 0; i < NUM_CODEC_DAIS; i++)
8664 + INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list);
8665 +
8666 +- return wcd9335_setup_irqs(wcd);
8667 ++ ret = wcd9335_setup_irqs(wcd);
8668 ++ if (ret)
8669 ++ goto free_clsh_ctrl;
8670 ++
8671 ++ return 0;
8672 ++
8673 ++free_clsh_ctrl:
8674 ++ wcd_clsh_ctrl_free(wcd->clsh_ctrl);
8675 ++ return ret;
8676 + }
8677 +
8678 + static void wcd9335_codec_remove(struct snd_soc_component *comp)
8679 +@@ -4869,7 +4888,7 @@ static void wcd9335_codec_remove(struct snd_soc_component *comp)
8680 + struct wcd9335_codec *wcd = dev_get_drvdata(comp->dev);
8681 +
8682 + wcd_clsh_ctrl_free(wcd->clsh_ctrl);
8683 +- free_irq(regmap_irq_get_virq(wcd->irq_data, WCD9335_IRQ_SLIMBUS), wcd);
8684 ++ wcd9335_teardown_irqs(wcd);
8685 + }
8686 +
8687 + static int wcd9335_codec_set_sysclk(struct snd_soc_component *comp,
8688 +diff --git a/sound/soc/intel/boards/kbl_da7219_max98927.c b/sound/soc/intel/boards/kbl_da7219_max98927.c
8689 +index e0149cf6127d0..884741aa48335 100644
8690 +--- a/sound/soc/intel/boards/kbl_da7219_max98927.c
8691 ++++ b/sound/soc/intel/boards/kbl_da7219_max98927.c
8692 +@@ -197,7 +197,7 @@ static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
8693 + }
8694 + if (!strcmp(codec_dai->component->name, MAX98373_DEV0_NAME)) {
8695 + ret = snd_soc_dai_set_tdm_slot(codec_dai,
8696 +- 0x03, 3, 8, 24);
8697 ++ 0x30, 3, 8, 16);
8698 + if (ret < 0) {
8699 + dev_err(runtime->dev,
8700 + "DEV0 TDM slot err:%d\n", ret);
8701 +@@ -206,10 +206,10 @@ static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
8702 + }
8703 + if (!strcmp(codec_dai->component->name, MAX98373_DEV1_NAME)) {
8704 + ret = snd_soc_dai_set_tdm_slot(codec_dai,
8705 +- 0x0C, 3, 8, 24);
8706 ++ 0xC0, 3, 8, 16);
8707 + if (ret < 0) {
8708 + dev_err(runtime->dev,
8709 +- "DEV0 TDM slot err:%d\n", ret);
8710 ++ "DEV1 TDM slot err:%d\n", ret);
8711 + return ret;
8712 + }
8713 + }
8714 +@@ -309,24 +309,6 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
8715 + * The above 2 loops are mutually exclusive based on the stream direction,
8716 + * thus rtd_dpcm variable will never be overwritten
8717 + */
8718 +- /*
8719 +- * Topology for kblda7219m98373 & kblmax98373 supports only S24_LE,
8720 +- * where as kblda7219m98927 & kblmax98927 supports S16_LE by default.
8721 +- * Skipping the port wise FE and BE configuration for kblda7219m98373 &
8722 +- * kblmax98373 as the topology (FE & BE) supports S24_LE only.
8723 +- */
8724 +-
8725 +- if (!strcmp(rtd->card->name, "kblda7219m98373") ||
8726 +- !strcmp(rtd->card->name, "kblmax98373")) {
8727 +- /* The ADSP will convert the FE rate to 48k, stereo */
8728 +- rate->min = rate->max = 48000;
8729 +- chan->min = chan->max = DUAL_CHANNEL;
8730 +-
8731 +- /* set SSP to 24 bit */
8732 +- snd_mask_none(fmt);
8733 +- snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
8734 +- return 0;
8735 +- }
8736 +
8737 + /*
8738 + * The ADSP will convert the FE rate to 48k, stereo, 24 bit
8739 +@@ -477,31 +459,20 @@ static struct snd_pcm_hw_constraint_list constraints_channels_quad = {
8740 + static int kbl_fe_startup(struct snd_pcm_substream *substream)
8741 + {
8742 + struct snd_pcm_runtime *runtime = substream->runtime;
8743 +- struct snd_soc_pcm_runtime *soc_rt = asoc_substream_to_rtd(substream);
8744 +
8745 + /*
8746 + * On this platform for PCM device we support,
8747 + * 48Khz
8748 + * stereo
8749 ++ * 16 bit audio
8750 + */
8751 +
8752 + runtime->hw.channels_max = DUAL_CHANNEL;
8753 + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
8754 + &constraints_channels);
8755 +- /*
8756 +- * Setup S24_LE (32 bit container and 24 bit valid data) for
8757 +- * kblda7219m98373 & kblmax98373. For kblda7219m98927 &
8758 +- * kblmax98927 keeping it as 16/16 due to topology FW dependency.
8759 +- */
8760 +- if (!strcmp(soc_rt->card->name, "kblda7219m98373") ||
8761 +- !strcmp(soc_rt->card->name, "kblmax98373")) {
8762 +- runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_LE;
8763 +- snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
8764 +-
8765 +- } else {
8766 +- runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
8767 +- snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
8768 +- }
8769 ++
8770 ++ runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
8771 ++ snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
8772 +
8773 + snd_pcm_hw_constraint_list(runtime, 0,
8774 + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
8775 +@@ -534,23 +505,11 @@ static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
8776 + static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
8777 + {
8778 + struct snd_pcm_runtime *runtime = substream->runtime;
8779 +- struct snd_soc_pcm_runtime *soc_rt = asoc_substream_to_rtd(substream);
8780 +
8781 + runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
8782 + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
8783 + &constraints_channels_quad);
8784 +
8785 +- /*
8786 +- * Topology for kblda7219m98373 & kblmax98373 supports only S24_LE.
8787 +- * The DMIC also configured for S24_LE. Forcing the DMIC format to
8788 +- * S24_LE due to the topology FW dependency.
8789 +- */
8790 +- if (!strcmp(soc_rt->card->name, "kblda7219m98373") ||
8791 +- !strcmp(soc_rt->card->name, "kblmax98373")) {
8792 +- runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_LE;
8793 +- snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
8794 +- }
8795 +-
8796 + return snd_pcm_hw_constraint_list(substream->runtime, 0,
8797 + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
8798 + }
8799 +diff --git a/sound/soc/intel/common/soc-acpi-intel-cml-match.c b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
8800 +index 26dde88bb2279..9b85811ffd515 100644
8801 +--- a/sound/soc/intel/common/soc-acpi-intel-cml-match.c
8802 ++++ b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
8803 +@@ -62,7 +62,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
8804 + },
8805 + {
8806 + .id = "DLGS7219",
8807 +- .drv_name = "cml_da7219_max98357a",
8808 ++ .drv_name = "cml_da7219_mx98357a",
8809 + .machine_quirk = snd_soc_acpi_codec_list,
8810 + .quirk_data = &max98390_spk_codecs,
8811 + .sof_fw_filename = "sof-cml.ri",
8812 +diff --git a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
8813 +index 4ed1349affc4d..20f2132a9cd66 100644
8814 +--- a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
8815 ++++ b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
8816 +@@ -87,7 +87,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
8817 + },
8818 + {
8819 + .id = "DLGS7219",
8820 +- .drv_name = "kbl_da7219_max98357a",
8821 ++ .drv_name = "kbl_da7219_mx98357a",
8822 + .fw_filename = "intel/dsp_fw_kbl.bin",
8823 + .machine_quirk = snd_soc_acpi_codec_list,
8824 + .quirk_data = &kbl_7219_98357_codecs,
8825 +diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
8826 +index 0955cbb4e9187..73976c6dfbdc0 100644
8827 +--- a/sound/soc/intel/skylake/skl-topology.c
8828 ++++ b/sound/soc/intel/skylake/skl-topology.c
8829 +@@ -113,7 +113,7 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w,
8830 +
8831 + static void skl_dump_mconfig(struct skl_dev *skl, struct skl_module_cfg *mcfg)
8832 + {
8833 +- struct skl_module_iface *iface = &mcfg->module->formats[0];
8834 ++ struct skl_module_iface *iface = &mcfg->module->formats[mcfg->fmt_idx];
8835 +
8836 + dev_dbg(skl->dev, "Dumping config\n");
8837 + dev_dbg(skl->dev, "Input Format:\n");
8838 +@@ -195,8 +195,8 @@ static void skl_tplg_update_params_fixup(struct skl_module_cfg *m_cfg,
8839 + struct skl_module_fmt *in_fmt, *out_fmt;
8840 +
8841 + /* Fixups will be applied to pin 0 only */
8842 +- in_fmt = &m_cfg->module->formats[0].inputs[0].fmt;
8843 +- out_fmt = &m_cfg->module->formats[0].outputs[0].fmt;
8844 ++ in_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].inputs[0].fmt;
8845 ++ out_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].outputs[0].fmt;
8846 +
8847 + if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
8848 + if (is_fe) {
8849 +@@ -239,9 +239,9 @@ static void skl_tplg_update_buffer_size(struct skl_dev *skl,
8850 + /* Since fixups is applied to pin 0 only, ibs, obs needs
8851 + * change for pin 0 only
8852 + */
8853 +- res = &mcfg->module->resources[0];
8854 +- in_fmt = &mcfg->module->formats[0].inputs[0].fmt;
8855 +- out_fmt = &mcfg->module->formats[0].outputs[0].fmt;
8856 ++ res = &mcfg->module->resources[mcfg->res_idx];
8857 ++ in_fmt = &mcfg->module->formats[mcfg->fmt_idx].inputs[0].fmt;
8858 ++ out_fmt = &mcfg->module->formats[mcfg->fmt_idx].outputs[0].fmt;
8859 +
8860 + if (mcfg->m_type == SKL_MODULE_TYPE_SRCINT)
8861 + multiplier = 5;
8862 +@@ -1463,12 +1463,6 @@ static int skl_tplg_tlv_control_set(struct snd_kcontrol *kcontrol,
8863 + struct skl_dev *skl = get_skl_ctx(w->dapm->dev);
8864 +
8865 + if (ac->params) {
8866 +- /*
8867 +- * Widget data is expected to be stripped of T and L
8868 +- */
8869 +- size -= 2 * sizeof(unsigned int);
8870 +- data += 2;
8871 +-
8872 + if (size > ac->max)
8873 + return -EINVAL;
8874 + ac->size = size;
8875 +@@ -1637,11 +1631,12 @@ int skl_tplg_update_pipe_params(struct device *dev,
8876 + struct skl_module_cfg *mconfig,
8877 + struct skl_pipe_params *params)
8878 + {
8879 +- struct skl_module_res *res = &mconfig->module->resources[0];
8880 ++ struct skl_module_res *res;
8881 + struct skl_dev *skl = get_skl_ctx(dev);
8882 + struct skl_module_fmt *format = NULL;
8883 + u8 cfg_idx = mconfig->pipe->cur_config_idx;
8884 +
8885 ++ res = &mconfig->module->resources[mconfig->res_idx];
8886 + skl_tplg_fill_dma_id(mconfig, params);
8887 + mconfig->fmt_idx = mconfig->mod_cfg[cfg_idx].fmt_idx;
8888 + mconfig->res_idx = mconfig->mod_cfg[cfg_idx].res_idx;
8889 +@@ -1650,9 +1645,9 @@ int skl_tplg_update_pipe_params(struct device *dev,
8890 + return 0;
8891 +
8892 + if (params->stream == SNDRV_PCM_STREAM_PLAYBACK)
8893 +- format = &mconfig->module->formats[0].inputs[0].fmt;
8894 ++ format = &mconfig->module->formats[mconfig->fmt_idx].inputs[0].fmt;
8895 + else
8896 +- format = &mconfig->module->formats[0].outputs[0].fmt;
8897 ++ format = &mconfig->module->formats[mconfig->fmt_idx].outputs[0].fmt;
8898 +
8899 + /* set the hw_params */
8900 + format->s_freq = params->s_freq;
8901 +diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
8902 +index c4a598cbbdaa1..14e77df06b011 100644
8903 +--- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
8904 ++++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
8905 +@@ -1119,25 +1119,26 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
8906 + afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
8907 + if (IS_ERR(afe->regmap)) {
8908 + dev_err(dev, "could not get regmap from parent\n");
8909 +- return PTR_ERR(afe->regmap);
8910 ++ ret = PTR_ERR(afe->regmap);
8911 ++ goto err_pm_disable;
8912 + }
8913 + ret = regmap_attach_dev(dev, afe->regmap, &mt8183_afe_regmap_config);
8914 + if (ret) {
8915 + dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret);
8916 +- return ret;
8917 ++ goto err_pm_disable;
8918 + }
8919 +
8920 + rstc = devm_reset_control_get(dev, "audiosys");
8921 + if (IS_ERR(rstc)) {
8922 + ret = PTR_ERR(rstc);
8923 + dev_err(dev, "could not get audiosys reset:%d\n", ret);
8924 +- return ret;
8925 ++ goto err_pm_disable;
8926 + }
8927 +
8928 + ret = reset_control_reset(rstc);
8929 + if (ret) {
8930 + dev_err(dev, "failed to trigger audio reset:%d\n", ret);
8931 +- return ret;
8932 ++ goto err_pm_disable;
8933 + }
8934 +
8935 + /* enable clock for regcache get default value from hw */
8936 +@@ -1147,7 +1148,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
8937 + ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config);
8938 + if (ret) {
8939 + dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret);
8940 +- return ret;
8941 ++ goto err_pm_disable;
8942 + }
8943 +
8944 + pm_runtime_put_sync(&pdev->dev);
8945 +@@ -1160,8 +1161,10 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
8946 + afe->memif_size = MT8183_MEMIF_NUM;
8947 + afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif),
8948 + GFP_KERNEL);
8949 +- if (!afe->memif)
8950 +- return -ENOMEM;
8951 ++ if (!afe->memif) {
8952 ++ ret = -ENOMEM;
8953 ++ goto err_pm_disable;
8954 ++ }
8955 +
8956 + for (i = 0; i < afe->memif_size; i++) {
8957 + afe->memif[i].data = &memif_data[i];
8958 +@@ -1178,22 +1181,26 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
8959 + afe->irqs_size = MT8183_IRQ_NUM;
8960 + afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs),
8961 + GFP_KERNEL);
8962 +- if (!afe->irqs)
8963 +- return -ENOMEM;
8964 ++ if (!afe->irqs) {
8965 ++ ret = -ENOMEM;
8966 ++ goto err_pm_disable;
8967 ++ }
8968 +
8969 + for (i = 0; i < afe->irqs_size; i++)
8970 + afe->irqs[i].irq_data = &irq_data[i];
8971 +
8972 + /* request irq */
8973 + irq_id = platform_get_irq(pdev, 0);
8974 +- if (irq_id < 0)
8975 +- return irq_id;
8976 ++ if (irq_id < 0) {
8977 ++ ret = irq_id;
8978 ++ goto err_pm_disable;
8979 ++ }
8980 +
8981 + ret = devm_request_irq(dev, irq_id, mt8183_afe_irq_handler,
8982 + IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
8983 + if (ret) {
8984 + dev_err(dev, "could not request_irq for asys-isr\n");
8985 +- return ret;
8986 ++ goto err_pm_disable;
8987 + }
8988 +
8989 + /* init sub_dais */
8990 +@@ -1204,7 +1211,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
8991 + if (ret) {
8992 + dev_warn(afe->dev, "dai register i %d fail, ret %d\n",
8993 + i, ret);
8994 +- return ret;
8995 ++ goto err_pm_disable;
8996 + }
8997 + }
8998 +
8999 +@@ -1213,7 +1220,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
9000 + if (ret) {
9001 + dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n",
9002 + ret);
9003 +- return ret;
9004 ++ goto err_pm_disable;
9005 + }
9006 +
9007 + afe->mtk_afe_hardware = &mt8183_afe_hardware;
9008 +@@ -1229,7 +1236,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
9009 + NULL, 0);
9010 + if (ret) {
9011 + dev_warn(dev, "err_platform\n");
9012 +- return ret;
9013 ++ goto err_pm_disable;
9014 + }
9015 +
9016 + ret = devm_snd_soc_register_component(afe->dev,
9017 +@@ -1238,10 +1245,14 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
9018 + afe->num_dai_drivers);
9019 + if (ret) {
9020 + dev_warn(dev, "err_dai_component\n");
9021 +- return ret;
9022 ++ goto err_pm_disable;
9023 + }
9024 +
9025 + return ret;
9026 ++
9027 ++err_pm_disable:
9028 ++ pm_runtime_disable(&pdev->dev);
9029 ++ return ret;
9030 + }
9031 +
9032 + static int mt8183_afe_pcm_dev_remove(struct platform_device *pdev)
9033 +diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
9034 +index 556216dc97030..762bf87c26a3e 100644
9035 +--- a/tools/include/uapi/linux/bpf.h
9036 ++++ b/tools/include/uapi/linux/bpf.h
9037 +@@ -2450,7 +2450,7 @@ union bpf_attr {
9038 + * long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
9039 + * Description
9040 + * Select a **SO_REUSEPORT** socket from a
9041 +- * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
9042 ++ * **BPF_MAP_TYPE_REUSEPORT_SOCKARRAY** *map*.
9043 + * It checks the selected socket is matching the incoming
9044 + * request in the socket buffer.
9045 + * Return
9046 +diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
9047 +index 310f647c2d5b6..154b75fc1373e 100644
9048 +--- a/tools/lib/bpf/Makefile
9049 ++++ b/tools/lib/bpf/Makefile
9050 +@@ -4,8 +4,9 @@
9051 + RM ?= rm
9052 + srctree = $(abs_srctree)
9053 +
9054 ++VERSION_SCRIPT := libbpf.map
9055 + LIBBPF_VERSION := $(shell \
9056 +- grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \
9057 ++ grep -oE '^LIBBPF_([0-9.]+)' $(VERSION_SCRIPT) | \
9058 + sort -rV | head -n1 | cut -d'_' -f2)
9059 + LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
9060 +
9061 +@@ -131,7 +132,6 @@ SHARED_OBJDIR := $(OUTPUT)sharedobjs/
9062 + STATIC_OBJDIR := $(OUTPUT)staticobjs/
9063 + BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o
9064 + BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o
9065 +-VERSION_SCRIPT := libbpf.map
9066 + BPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h
9067 +
9068 + LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
9069 +@@ -184,10 +184,10 @@ $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
9070 +
9071 + $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
9072 +
9073 +-$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED)
9074 ++$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) $(VERSION_SCRIPT)
9075 + $(QUIET_LINK)$(CC) $(LDFLAGS) \
9076 + --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
9077 +- -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -lz -o $@
9078 ++ -Wl,--version-script=$(VERSION_SCRIPT) $< -lelf -lz -o $@
9079 + @ln -sf $(@F) $(OUTPUT)libbpf.so
9080 + @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
9081 +
9082 +@@ -202,7 +202,7 @@ $(OUTPUT)libbpf.pc:
9083 +
9084 + check: check_abi
9085 +
9086 +-check_abi: $(OUTPUT)libbpf.so
9087 ++check_abi: $(OUTPUT)libbpf.so $(VERSION_SCRIPT)
9088 + @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \
9089 + echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \
9090 + "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \
9091 +diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
9092 +index 95eef7ebdac5c..28923b776cdc8 100644
9093 +--- a/tools/lib/bpf/libbpf.c
9094 ++++ b/tools/lib/bpf/libbpf.c
9095 +@@ -4123,6 +4123,7 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map)
9096 + {
9097 + struct bpf_create_map_attr create_attr;
9098 + struct bpf_map_def *def = &map->def;
9099 ++ int err = 0;
9100 +
9101 + memset(&create_attr, 0, sizeof(create_attr));
9102 +
9103 +@@ -4165,8 +4166,6 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map)
9104 +
9105 + if (bpf_map_type__is_map_in_map(def->type)) {
9106 + if (map->inner_map) {
9107 +- int err;
9108 +-
9109 + err = bpf_object__create_map(obj, map->inner_map);
9110 + if (err) {
9111 + pr_warn("map '%s': failed to create inner map: %d\n",
9112 +@@ -4183,8 +4182,8 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map)
9113 + if (map->fd < 0 && (create_attr.btf_key_type_id ||
9114 + create_attr.btf_value_type_id)) {
9115 + char *cp, errmsg[STRERR_BUFSIZE];
9116 +- int err = -errno;
9117 +
9118 ++ err = -errno;
9119 + cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg));
9120 + pr_warn("Error in bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n",
9121 + map->name, cp, err);
9122 +@@ -4196,15 +4195,14 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map)
9123 + map->fd = bpf_create_map_xattr(&create_attr);
9124 + }
9125 +
9126 +- if (map->fd < 0)
9127 +- return -errno;
9128 ++ err = map->fd < 0 ? -errno : 0;
9129 +
9130 + if (bpf_map_type__is_map_in_map(def->type) && map->inner_map) {
9131 + bpf_map__destroy(map->inner_map);
9132 + zfree(&map->inner_map);
9133 + }
9134 +
9135 +- return 0;
9136 ++ return err;
9137 + }
9138 +
9139 + static int init_map_slots(struct bpf_map *map)
9140 +@@ -6907,8 +6905,10 @@ __bpf_object__open(const char *path, const void *obj_buf, size_t obj_buf_sz,
9141 + kconfig = OPTS_GET(opts, kconfig, NULL);
9142 + if (kconfig) {
9143 + obj->kconfig = strdup(kconfig);
9144 +- if (!obj->kconfig)
9145 +- return ERR_PTR(-ENOMEM);
9146 ++ if (!obj->kconfig) {
9147 ++ err = -ENOMEM;
9148 ++ goto out;
9149 ++ }
9150 + }
9151 +
9152 + err = bpf_object__elf_init(obj);
9153 +diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c b/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c
9154 +index 54380c5e10692..aa96b604b2b31 100644
9155 +--- a/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c
9156 ++++ b/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c
9157 +@@ -122,7 +122,7 @@ static int dump_tcp_sock(struct seq_file *seq, struct tcp_sock *tp,
9158 + }
9159 +
9160 + BPF_SEQ_PRINTF(seq, "%4d: %08X:%04X %08X:%04X ",
9161 +- seq_num, src, srcp, destp, destp);
9162 ++ seq_num, src, srcp, dest, destp);
9163 + BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d ",
9164 + state,
9165 + tp->write_seq - tp->snd_una, rx_queue,
9166 +diff --git a/tools/testing/selftests/bpf/progs/test_core_autosize.c b/tools/testing/selftests/bpf/progs/test_core_autosize.c
9167 +index 44f5aa2e8956f..9a7829c5e4a72 100644
9168 +--- a/tools/testing/selftests/bpf/progs/test_core_autosize.c
9169 ++++ b/tools/testing/selftests/bpf/progs/test_core_autosize.c
9170 +@@ -125,6 +125,16 @@ int handle_downsize(void *ctx)
9171 + return 0;
9172 + }
9173 +
9174 ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
9175 ++#define bpf_core_read_int bpf_core_read
9176 ++#else
9177 ++#define bpf_core_read_int(dst, sz, src) ({ \
9178 ++ /* Prevent "subtraction from stack pointer prohibited" */ \
9179 ++ volatile long __off = sizeof(*dst) - (sz); \
9180 ++ bpf_core_read((char *)(dst) + __off, sz, src); \
9181 ++})
9182 ++#endif
9183 ++
9184 + SEC("raw_tp/sys_enter")
9185 + int handle_probed(void *ctx)
9186 + {
9187 +@@ -132,23 +142,23 @@ int handle_probed(void *ctx)
9188 + __u64 tmp;
9189 +
9190 + tmp = 0;
9191 +- bpf_core_read(&tmp, bpf_core_field_size(in->ptr), &in->ptr);
9192 ++ bpf_core_read_int(&tmp, bpf_core_field_size(in->ptr), &in->ptr);
9193 + ptr_probed = tmp;
9194 +
9195 + tmp = 0;
9196 +- bpf_core_read(&tmp, bpf_core_field_size(in->val1), &in->val1);
9197 ++ bpf_core_read_int(&tmp, bpf_core_field_size(in->val1), &in->val1);
9198 + val1_probed = tmp;
9199 +
9200 + tmp = 0;
9201 +- bpf_core_read(&tmp, bpf_core_field_size(in->val2), &in->val2);
9202 ++ bpf_core_read_int(&tmp, bpf_core_field_size(in->val2), &in->val2);
9203 + val2_probed = tmp;
9204 +
9205 + tmp = 0;
9206 +- bpf_core_read(&tmp, bpf_core_field_size(in->val3), &in->val3);
9207 ++ bpf_core_read_int(&tmp, bpf_core_field_size(in->val3), &in->val3);
9208 + val3_probed = tmp;
9209 +
9210 + tmp = 0;
9211 +- bpf_core_read(&tmp, bpf_core_field_size(in->val4), &in->val4);
9212 ++ bpf_core_read_int(&tmp, bpf_core_field_size(in->val4), &in->val4);
9213 + val4_probed = tmp;
9214 +
9215 + return 0;