Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0218-5.4.119-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3635 - (show annotations) (download)
Mon Oct 24 12:34:12 2022 UTC (18 months ago) by niro
File size: 281598 byte(s)
-sync kernel patches
1 diff --git a/Makefile b/Makefile
2 index 05a19383b3964..9b7780de5f6bb 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 118
10 +SUBLEVEL = 119
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/arch/arm/boot/dts/exynos4412-midas.dtsi b/arch/arm/boot/dts/exynos4412-midas.dtsi
15 index 83be3a797411e..fedb21377c66c 100644
16 --- a/arch/arm/boot/dts/exynos4412-midas.dtsi
17 +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi
18 @@ -139,7 +139,7 @@
19 max77693@66 {
20 compatible = "maxim,max77693";
21 interrupt-parent = <&gpx1>;
22 - interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
23 + interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
24 pinctrl-names = "default";
25 pinctrl-0 = <&max77693_irq>;
26 reg = <0x66>;
27 @@ -187,7 +187,7 @@
28 max77693-fuel-gauge@36 {
29 compatible = "maxim,max17047";
30 interrupt-parent = <&gpx2>;
31 - interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
32 + interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
33 pinctrl-names = "default";
34 pinctrl-0 = <&max77693_fuel_irq>;
35 reg = <0x36>;
36 @@ -588,7 +588,7 @@
37 max77686: max77686_pmic@9 {
38 compatible = "maxim,max77686";
39 interrupt-parent = <&gpx0>;
40 - interrupts = <7 IRQ_TYPE_NONE>;
41 + interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
42 pinctrl-0 = <&max77686_irq>;
43 pinctrl-names = "default";
44 reg = <0x09>;
45 diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
46 index ea55f377d17c0..424d12ecc9018 100644
47 --- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
48 +++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
49 @@ -274,7 +274,7 @@
50 max77686: pmic@9 {
51 compatible = "maxim,max77686";
52 interrupt-parent = <&gpx3>;
53 - interrupts = <2 IRQ_TYPE_NONE>;
54 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
55 pinctrl-names = "default";
56 pinctrl-0 = <&max77686_irq>;
57 reg = <0x09>;
58 diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
59 index 6dc96948a9ccc..70a2b6e2ad3fa 100644
60 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
61 +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
62 @@ -133,7 +133,7 @@
63 compatible = "maxim,max77686";
64 reg = <0x09>;
65 interrupt-parent = <&gpx3>;
66 - interrupts = <2 IRQ_TYPE_NONE>;
67 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
68 pinctrl-names = "default";
69 pinctrl-0 = <&max77686_irq>;
70 wakeup-source;
71 diff --git a/arch/arm/boot/dts/exynos5250-snow-common.dtsi b/arch/arm/boot/dts/exynos5250-snow-common.dtsi
72 index c952a615148e5..737f0e20a4525 100644
73 --- a/arch/arm/boot/dts/exynos5250-snow-common.dtsi
74 +++ b/arch/arm/boot/dts/exynos5250-snow-common.dtsi
75 @@ -292,7 +292,7 @@
76 max77686: max77686@9 {
77 compatible = "maxim,max77686";
78 interrupt-parent = <&gpx3>;
79 - interrupts = <2 IRQ_TYPE_NONE>;
80 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
81 pinctrl-names = "default";
82 pinctrl-0 = <&max77686_irq>;
83 wakeup-source;
84 diff --git a/arch/arm/boot/dts/uniphier-pxs2.dtsi b/arch/arm/boot/dts/uniphier-pxs2.dtsi
85 index 4eddbb8d7fcac..60a588ce45e10 100644
86 --- a/arch/arm/boot/dts/uniphier-pxs2.dtsi
87 +++ b/arch/arm/boot/dts/uniphier-pxs2.dtsi
88 @@ -571,7 +571,7 @@
89 clocks = <&sys_clk 6>;
90 reset-names = "ether";
91 resets = <&sys_rst 6>;
92 - phy-mode = "rgmii";
93 + phy-mode = "rgmii-id";
94 local-mac-address = [00 00 00 00 00 00];
95 socionext,syscon-phy-mode = <&soc_glue 0>;
96
97 diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi
98 index 8f23fcadecb89..9573da378826b 100644
99 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi
100 +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi
101 @@ -336,7 +336,7 @@
102 <0x0 0x03D00000 0x0 0x300000>;
103 reg-names = "west", "east", "north", "south";
104 interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
105 - gpio-ranges = <&tlmm 0 0 175>;
106 + gpio-ranges = <&tlmm 0 0 176>;
107 gpio-controller;
108 #gpio-cells = <2>;
109 interrupt-controller;
110 diff --git a/arch/arm64/boot/dts/renesas/r8a77980.dtsi b/arch/arm64/boot/dts/renesas/r8a77980.dtsi
111 index e81cd83b138b1..4b9d4f1bbe010 100644
112 --- a/arch/arm64/boot/dts/renesas/r8a77980.dtsi
113 +++ b/arch/arm64/boot/dts/renesas/r8a77980.dtsi
114 @@ -990,8 +990,8 @@
115
116 reg = <1>;
117
118 - vin4csi41: endpoint@2 {
119 - reg = <2>;
120 + vin4csi41: endpoint@3 {
121 + reg = <3>;
122 remote-endpoint = <&csi41vin4>;
123 };
124 };
125 @@ -1018,8 +1018,8 @@
126
127 reg = <1>;
128
129 - vin5csi41: endpoint@2 {
130 - reg = <2>;
131 + vin5csi41: endpoint@3 {
132 + reg = <3>;
133 remote-endpoint = <&csi41vin5>;
134 };
135 };
136 @@ -1046,8 +1046,8 @@
137
138 reg = <1>;
139
140 - vin6csi41: endpoint@2 {
141 - reg = <2>;
142 + vin6csi41: endpoint@3 {
143 + reg = <3>;
144 remote-endpoint = <&csi41vin6>;
145 };
146 };
147 @@ -1074,8 +1074,8 @@
148
149 reg = <1>;
150
151 - vin7csi41: endpoint@2 {
152 - reg = <2>;
153 + vin7csi41: endpoint@3 {
154 + reg = <3>;
155 remote-endpoint = <&csi41vin7>;
156 };
157 };
158 diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
159 index b658f2b641e29..3348a32f7d0b8 100644
160 --- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
161 +++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
162 @@ -718,7 +718,7 @@
163 clocks = <&sys_clk 6>;
164 reset-names = "ether";
165 resets = <&sys_rst 6>;
166 - phy-mode = "rgmii";
167 + phy-mode = "rgmii-id";
168 local-mac-address = [00 00 00 00 00 00];
169 socionext,syscon-phy-mode = <&soc_glue 0>;
170
171 diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
172 index d6f6cee4d5491..6537c69de3dd3 100644
173 --- a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
174 +++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
175 @@ -509,7 +509,7 @@
176 clocks = <&sys_clk 6>;
177 reset-names = "ether";
178 resets = <&sys_rst 6>;
179 - phy-mode = "rgmii";
180 + phy-mode = "rgmii-id";
181 local-mac-address = [00 00 00 00 00 00];
182 socionext,syscon-phy-mode = <&soc_glue 0>;
183
184 @@ -530,7 +530,7 @@
185 clocks = <&sys_clk 7>;
186 reset-names = "ether";
187 resets = <&sys_rst 7>;
188 - phy-mode = "rgmii";
189 + phy-mode = "rgmii-id";
190 local-mac-address = [00 00 00 00 00 00];
191 socionext,syscon-phy-mode = <&soc_glue 1>;
192
193 diff --git a/arch/m68k/include/asm/mvme147hw.h b/arch/m68k/include/asm/mvme147hw.h
194 index 257b29184af91..e28eb1c0e0bfb 100644
195 --- a/arch/m68k/include/asm/mvme147hw.h
196 +++ b/arch/m68k/include/asm/mvme147hw.h
197 @@ -66,6 +66,9 @@ struct pcc_regs {
198 #define PCC_INT_ENAB 0x08
199
200 #define PCC_TIMER_INT_CLR 0x80
201 +
202 +#define PCC_TIMER_TIC_EN 0x01
203 +#define PCC_TIMER_COC_EN 0x02
204 #define PCC_TIMER_CLR_OVF 0x04
205
206 #define PCC_LEVEL_ABORT 0x07
207 diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
208 index 545a1fe0e1194..245376630c3de 100644
209 --- a/arch/m68k/mvme147/config.c
210 +++ b/arch/m68k/mvme147/config.c
211 @@ -117,8 +117,10 @@ static irqreturn_t mvme147_timer_int (int irq, void *dev_id)
212 unsigned long flags;
213
214 local_irq_save(flags);
215 - m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR;
216 - m147_pcc->t1_cntrl = PCC_TIMER_CLR_OVF;
217 + m147_pcc->t1_cntrl = PCC_TIMER_CLR_OVF | PCC_TIMER_COC_EN |
218 + PCC_TIMER_TIC_EN;
219 + m147_pcc->t1_int_cntrl = PCC_INT_ENAB | PCC_TIMER_INT_CLR |
220 + PCC_LEVEL_TIMER1;
221 clk_total += PCC_TIMER_CYCLES;
222 timer_routine(0, NULL);
223 local_irq_restore(flags);
224 @@ -136,10 +138,10 @@ void mvme147_sched_init (irq_handler_t timer_routine)
225 /* Init the clock with a value */
226 /* The clock counter increments until 0xFFFF then reloads */
227 m147_pcc->t1_preload = PCC_TIMER_PRELOAD;
228 - m147_pcc->t1_cntrl = 0x0; /* clear timer */
229 - m147_pcc->t1_cntrl = 0x3; /* start timer */
230 - m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR; /* clear pending ints */
231 - m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;
232 + m147_pcc->t1_cntrl = PCC_TIMER_CLR_OVF | PCC_TIMER_COC_EN |
233 + PCC_TIMER_TIC_EN;
234 + m147_pcc->t1_int_cntrl = PCC_INT_ENAB | PCC_TIMER_INT_CLR |
235 + PCC_LEVEL_TIMER1;
236
237 clocksource_register_hz(&mvme147_clk, PCC_TIMER_CLOCK_FREQ);
238 }
239 diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
240 index 9bc2da69f80cb..2f2c2d172b24e 100644
241 --- a/arch/m68k/mvme16x/config.c
242 +++ b/arch/m68k/mvme16x/config.c
243 @@ -368,6 +368,7 @@ static u32 clk_total;
244 #define PCCTOVR1_COC_EN 0x02
245 #define PCCTOVR1_OVR_CLR 0x04
246
247 +#define PCCTIC1_INT_LEVEL 6
248 #define PCCTIC1_INT_CLR 0x08
249 #define PCCTIC1_INT_EN 0x10
250
251 @@ -377,8 +378,8 @@ static irqreturn_t mvme16x_timer_int (int irq, void *dev_id)
252 unsigned long flags;
253
254 local_irq_save(flags);
255 - out_8(PCCTIC1, in_8(PCCTIC1) | PCCTIC1_INT_CLR);
256 - out_8(PCCTOVR1, PCCTOVR1_OVR_CLR);
257 + out_8(PCCTOVR1, PCCTOVR1_OVR_CLR | PCCTOVR1_TIC_EN | PCCTOVR1_COC_EN);
258 + out_8(PCCTIC1, PCCTIC1_INT_EN | PCCTIC1_INT_CLR | PCCTIC1_INT_LEVEL);
259 clk_total += PCC_TIMER_CYCLES;
260 timer_routine(0, NULL);
261 local_irq_restore(flags);
262 @@ -392,14 +393,15 @@ void mvme16x_sched_init (irq_handler_t timer_routine)
263 int irq;
264
265 /* Using PCCchip2 or MC2 chip tick timer 1 */
266 - out_be32(PCCTCNT1, 0);
267 - out_be32(PCCTCMP1, PCC_TIMER_CYCLES);
268 - out_8(PCCTOVR1, in_8(PCCTOVR1) | PCCTOVR1_TIC_EN | PCCTOVR1_COC_EN);
269 - out_8(PCCTIC1, PCCTIC1_INT_EN | 6);
270 if (request_irq(MVME16x_IRQ_TIMER, mvme16x_timer_int, IRQF_TIMER, "timer",
271 timer_routine))
272 panic ("Couldn't register timer int");
273
274 + out_be32(PCCTCNT1, 0);
275 + out_be32(PCCTCMP1, PCC_TIMER_CYCLES);
276 + out_8(PCCTOVR1, PCCTOVR1_OVR_CLR | PCCTOVR1_TIC_EN | PCCTOVR1_COC_EN);
277 + out_8(PCCTIC1, PCCTIC1_INT_EN | PCCTIC1_INT_CLR | PCCTIC1_INT_LEVEL);
278 +
279 clocksource_register_hz(&mvme16x_clk, PCC_TIMER_CLOCK_FREQ);
280
281 if (brdno == 0x0162 || brdno == 0x172)
282 diff --git a/arch/mips/boot/dts/brcm/bcm3368.dtsi b/arch/mips/boot/dts/brcm/bcm3368.dtsi
283 index 69cbef4723775..d4b2b430dad01 100644
284 --- a/arch/mips/boot/dts/brcm/bcm3368.dtsi
285 +++ b/arch/mips/boot/dts/brcm/bcm3368.dtsi
286 @@ -59,7 +59,7 @@
287
288 periph_cntl: syscon@fff8c008 {
289 compatible = "syscon";
290 - reg = <0xfff8c000 0x4>;
291 + reg = <0xfff8c008 0x4>;
292 native-endian;
293 };
294
295 diff --git a/arch/mips/boot/dts/brcm/bcm63268.dtsi b/arch/mips/boot/dts/brcm/bcm63268.dtsi
296 index beec24145af7e..30fdd38aef6da 100644
297 --- a/arch/mips/boot/dts/brcm/bcm63268.dtsi
298 +++ b/arch/mips/boot/dts/brcm/bcm63268.dtsi
299 @@ -59,7 +59,7 @@
300
301 periph_cntl: syscon@10000008 {
302 compatible = "syscon";
303 - reg = <0x10000000 0xc>;
304 + reg = <0x10000008 0x4>;
305 native-endian;
306 };
307
308 diff --git a/arch/mips/boot/dts/brcm/bcm6358.dtsi b/arch/mips/boot/dts/brcm/bcm6358.dtsi
309 index f21176cac0381..89a3107cad28e 100644
310 --- a/arch/mips/boot/dts/brcm/bcm6358.dtsi
311 +++ b/arch/mips/boot/dts/brcm/bcm6358.dtsi
312 @@ -59,7 +59,7 @@
313
314 periph_cntl: syscon@fffe0008 {
315 compatible = "syscon";
316 - reg = <0xfffe0000 0x4>;
317 + reg = <0xfffe0008 0x4>;
318 native-endian;
319 };
320
321 diff --git a/arch/mips/boot/dts/brcm/bcm6362.dtsi b/arch/mips/boot/dts/brcm/bcm6362.dtsi
322 index 8ae6981735b82..e48946a51242b 100644
323 --- a/arch/mips/boot/dts/brcm/bcm6362.dtsi
324 +++ b/arch/mips/boot/dts/brcm/bcm6362.dtsi
325 @@ -59,7 +59,7 @@
326
327 periph_cntl: syscon@10000008 {
328 compatible = "syscon";
329 - reg = <0x10000000 0xc>;
330 + reg = <0x10000008 0x4>;
331 native-endian;
332 };
333
334 diff --git a/arch/mips/boot/dts/brcm/bcm6368.dtsi b/arch/mips/boot/dts/brcm/bcm6368.dtsi
335 index 449c167dd8921..b84a3bfe8c51e 100644
336 --- a/arch/mips/boot/dts/brcm/bcm6368.dtsi
337 +++ b/arch/mips/boot/dts/brcm/bcm6368.dtsi
338 @@ -59,7 +59,7 @@
339
340 periph_cntl: syscon@100000008 {
341 compatible = "syscon";
342 - reg = <0x10000000 0xc>;
343 + reg = <0x10000008 0x4>;
344 native-endian;
345 };
346
347 diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c
348 index 39052de915f34..3a909194284a6 100644
349 --- a/arch/mips/pci/pci-legacy.c
350 +++ b/arch/mips/pci/pci-legacy.c
351 @@ -166,8 +166,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
352 res = hose->mem_resource;
353 break;
354 }
355 - if (res != NULL)
356 - of_pci_range_to_resource(&range, node, res);
357 + if (res != NULL) {
358 + res->name = node->full_name;
359 + res->flags = range.flags;
360 + res->start = range.cpu_addr;
361 + res->end = range.cpu_addr + range.size - 1;
362 + res->parent = res->child = res->sibling = NULL;
363 + }
364 }
365 }
366
367 diff --git a/arch/mips/pci/pci-mt7620.c b/arch/mips/pci/pci-mt7620.c
368 index d360616037525..e032932348d6f 100644
369 --- a/arch/mips/pci/pci-mt7620.c
370 +++ b/arch/mips/pci/pci-mt7620.c
371 @@ -30,6 +30,7 @@
372 #define RALINK_GPIOMODE 0x60
373
374 #define PPLL_CFG1 0x9c
375 +#define PPLL_LD BIT(23)
376
377 #define PPLL_DRV 0xa0
378 #define PDRV_SW_SET BIT(31)
379 @@ -239,8 +240,8 @@ static int mt7620_pci_hw_init(struct platform_device *pdev)
380 rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1);
381 mdelay(100);
382
383 - if (!(rt_sysc_r32(PPLL_CFG1) & PDRV_SW_SET)) {
384 - dev_err(&pdev->dev, "MT7620 PPLL unlock\n");
385 + if (!(rt_sysc_r32(PPLL_CFG1) & PPLL_LD)) {
386 + dev_err(&pdev->dev, "pcie PLL not locked, aborting init\n");
387 reset_control_assert(rstpcie0);
388 rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
389 return -1;
390 diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c
391 index c9f4d4ba058aa..2ceda2a040edc 100644
392 --- a/arch/mips/pci/pci-rt2880.c
393 +++ b/arch/mips/pci/pci-rt2880.c
394 @@ -180,7 +180,6 @@ static inline void rt2880_pci_write_u32(unsigned long reg, u32 val)
395
396 int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
397 {
398 - u16 cmd;
399 int irq = -1;
400
401 if (dev->bus->number != 0)
402 @@ -188,8 +187,6 @@ int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
403
404 switch (PCI_SLOT(dev->devfn)) {
405 case 0x00:
406 - rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000);
407 - (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0);
408 break;
409 case 0x11:
410 irq = RT288X_CPU_IRQ_PCI;
411 @@ -201,16 +198,6 @@ int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
412 break;
413 }
414
415 - pci_write_config_byte((struct pci_dev *) dev,
416 - PCI_CACHE_LINE_SIZE, 0x14);
417 - pci_write_config_byte((struct pci_dev *) dev, PCI_LATENCY_TIMER, 0xFF);
418 - pci_read_config_word((struct pci_dev *) dev, PCI_COMMAND, &cmd);
419 - cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
420 - PCI_COMMAND_INVALIDATE | PCI_COMMAND_FAST_BACK |
421 - PCI_COMMAND_SERR | PCI_COMMAND_WAIT | PCI_COMMAND_PARITY;
422 - pci_write_config_word((struct pci_dev *) dev, PCI_COMMAND, cmd);
423 - pci_write_config_byte((struct pci_dev *) dev, PCI_INTERRUPT_LINE,
424 - dev->irq);
425 return irq;
426 }
427
428 @@ -251,6 +238,30 @@ static int rt288x_pci_probe(struct platform_device *pdev)
429
430 int pcibios_plat_dev_init(struct pci_dev *dev)
431 {
432 + static bool slot0_init;
433 +
434 + /*
435 + * Nobody seems to initialize slot 0, but this platform requires it, so
436 + * do it once when some other slot is being enabled. The PCI subsystem
437 + * should configure other slots properly, so no need to do anything
438 + * special for those.
439 + */
440 + if (!slot0_init && dev->bus->number == 0) {
441 + u16 cmd;
442 + u32 bar0;
443 +
444 + slot0_init = true;
445 +
446 + pci_bus_write_config_dword(dev->bus, 0, PCI_BASE_ADDRESS_0,
447 + 0x08000000);
448 + pci_bus_read_config_dword(dev->bus, 0, PCI_BASE_ADDRESS_0,
449 + &bar0);
450 +
451 + pci_bus_read_config_word(dev->bus, 0, PCI_COMMAND, &cmd);
452 + cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
453 + pci_bus_write_config_word(dev->bus, 0, PCI_COMMAND, cmd);
454 + }
455 +
456 return 0;
457 }
458
459 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
460 index c4cbb65e742f4..757175ccf53c0 100644
461 --- a/arch/powerpc/Kconfig
462 +++ b/arch/powerpc/Kconfig
463 @@ -214,7 +214,7 @@ config PPC
464 select HAVE_MEMBLOCK_NODE_MAP
465 select HAVE_MOD_ARCH_SPECIFIC
466 select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
467 - select HAVE_HARDLOCKUP_DETECTOR_ARCH if (PPC64 && PPC_BOOK3S)
468 + select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC64 && PPC_BOOK3S && SMP
469 select HAVE_OPROFILE
470 select HAVE_OPTPROBES if PPC64
471 select HAVE_PERF_EVENTS
472 diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
473 index b915fe6589792..2ca9114fcf002 100644
474 --- a/arch/powerpc/Kconfig.debug
475 +++ b/arch/powerpc/Kconfig.debug
476 @@ -352,6 +352,7 @@ config PPC_EARLY_DEBUG_CPM_ADDR
477 config FAIL_IOMMU
478 bool "Fault-injection capability for IOMMU"
479 depends on FAULT_INJECTION
480 + depends on PCI || IBMVIO
481 help
482 Provide fault-injection capability for IOMMU. Each device can
483 be selectively enabled via the fail_iommu property.
484 diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h
485 index a1c60d5b50af7..5131ed787409f 100644
486 --- a/arch/powerpc/include/asm/book3s/64/radix.h
487 +++ b/arch/powerpc/include/asm/book3s/64/radix.h
488 @@ -206,8 +206,10 @@ static inline void radix__set_pte_at(struct mm_struct *mm, unsigned long addr,
489 * from ptesync, it should probably go into update_mmu_cache, rather
490 * than set_pte_at (which is used to set ptes unrelated to faults).
491 *
492 - * Spurious faults to vmalloc region are not tolerated, so there is
493 - * a ptesync in flush_cache_vmap.
494 + * Spurious faults from the kernel memory are not tolerated, so there
495 + * is a ptesync in flush_cache_vmap, and __map_kernel_page() follows
496 + * the pte update sequence from ISA Book III 6.10 Translation Table
497 + * Update Synchronization Requirements.
498 */
499 }
500
501 diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
502 index 9b522152d8f05..0455dc1b27977 100644
503 --- a/arch/powerpc/kernel/fadump.c
504 +++ b/arch/powerpc/kernel/fadump.c
505 @@ -279,7 +279,7 @@ static void fadump_show_config(void)
506 * that is required for a kernel to boot successfully.
507 *
508 */
509 -static inline u64 fadump_calculate_reserve_size(void)
510 +static __init u64 fadump_calculate_reserve_size(void)
511 {
512 u64 base, size, bootmem_min;
513 int ret;
514 diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
515 index e13e96e665e0b..537142b877b88 100644
516 --- a/arch/powerpc/kernel/prom.c
517 +++ b/arch/powerpc/kernel/prom.c
518 @@ -266,7 +266,7 @@ static struct feature_property {
519 };
520
521 #if defined(CONFIG_44x) && defined(CONFIG_PPC_FPU)
522 -static inline void identical_pvr_fixup(unsigned long node)
523 +static __init void identical_pvr_fixup(unsigned long node)
524 {
525 unsigned int pvr;
526 const char *model = of_get_flat_dt_prop(node, "model", NULL);
527 diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
528 index dd9b19b1f459a..6938b793a0150 100644
529 --- a/arch/powerpc/kvm/book3s_hv.c
530 +++ b/arch/powerpc/kvm/book3s_hv.c
531 @@ -3638,7 +3638,10 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
532 vcpu->arch.dec_expires = dec + tb;
533 vcpu->cpu = -1;
534 vcpu->arch.thread_cpu = -1;
535 + /* Save guest CTRL register, set runlatch to 1 */
536 vcpu->arch.ctrl = mfspr(SPRN_CTRLF);
537 + if (!(vcpu->arch.ctrl & 1))
538 + mtspr(SPRN_CTRLT, vcpu->arch.ctrl | 1);
539
540 vcpu->arch.iamr = mfspr(SPRN_IAMR);
541 vcpu->arch.pspb = mfspr(SPRN_PSPB);
542 diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
543 index 770542ccdb468..bdcb07a98cd37 100644
544 --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
545 +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
546 @@ -97,7 +97,7 @@ static int early_map_kernel_page(unsigned long ea, unsigned long pa,
547
548 set_the_pte:
549 set_pte_at(&init_mm, ea, ptep, pfn_pte(pfn, flags));
550 - smp_wmb();
551 + asm volatile("ptesync": : :"memory");
552 return 0;
553 }
554
555 @@ -155,7 +155,7 @@ static int __map_kernel_page(unsigned long ea, unsigned long pa,
556
557 set_the_pte:
558 set_pte_at(&init_mm, ea, ptep, pfn_pte(pfn, flags));
559 - smp_wmb();
560 + asm volatile("ptesync": : :"memory");
561 return 0;
562 }
563
564 diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
565 index 0b5c8f4fbdbfd..944180f55a3c6 100644
566 --- a/arch/powerpc/perf/isa207-common.c
567 +++ b/arch/powerpc/perf/isa207-common.c
568 @@ -363,8 +363,8 @@ ebb_bhrb:
569 * EBB events are pinned & exclusive, so this should never actually
570 * hit, but we leave it as a fallback in case.
571 */
572 - mask |= CNST_EBB_VAL(ebb);
573 - value |= CNST_EBB_MASK;
574 + mask |= CNST_EBB_MASK;
575 + value |= CNST_EBB_VAL(ebb);
576
577 *maskp = mask;
578 *valp = value;
579 diff --git a/arch/powerpc/platforms/52xx/lite5200_sleep.S b/arch/powerpc/platforms/52xx/lite5200_sleep.S
580 index 3a9969c429b39..054f927bfef93 100644
581 --- a/arch/powerpc/platforms/52xx/lite5200_sleep.S
582 +++ b/arch/powerpc/platforms/52xx/lite5200_sleep.S
583 @@ -181,7 +181,7 @@ sram_code:
584 udelay: /* r11 - tb_ticks_per_usec, r12 - usecs, overwrites r13 */
585 mullw r12, r12, r11
586 mftb r13 /* start */
587 - addi r12, r13, r12 /* end */
588 + add r12, r13, r12 /* end */
589 1:
590 mftb r13 /* current */
591 cmp cr0, r13, r12
592 diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
593 index 561917fa54a8a..afca4b737e80f 100644
594 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c
595 +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
596 @@ -66,6 +66,7 @@ EXPORT_SYMBOL_GPL(init_phb_dynamic);
597 int remove_phb_dynamic(struct pci_controller *phb)
598 {
599 struct pci_bus *b = phb->bus;
600 + struct pci_host_bridge *host_bridge = to_pci_host_bridge(b->bridge);
601 struct resource *res;
602 int rc, i;
603
604 @@ -92,7 +93,8 @@ int remove_phb_dynamic(struct pci_controller *phb)
605 /* Remove the PCI bus and unregister the bridge device from sysfs */
606 phb->bus = NULL;
607 pci_remove_bus(b);
608 - device_unregister(b->bridge);
609 + host_bridge->bus = NULL;
610 + device_unregister(&host_bridge->dev);
611
612 /* Now release the IO resource */
613 if (res->flags & IORESOURCE_IO)
614 diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
615 index 16df9cc8f3609..2d4c09a77910f 100644
616 --- a/arch/powerpc/sysdev/xive/common.c
617 +++ b/arch/powerpc/sysdev/xive/common.c
618 @@ -257,17 +257,20 @@ notrace void xmon_xive_do_dump(int cpu)
619 xmon_printf("\n");
620 }
621
622 +static struct irq_data *xive_get_irq_data(u32 hw_irq)
623 +{
624 + unsigned int irq = irq_find_mapping(xive_irq_domain, hw_irq);
625 +
626 + return irq ? irq_get_irq_data(irq) : NULL;
627 +}
628 +
629 int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
630 {
631 - struct irq_chip *chip = irq_data_get_irq_chip(d);
632 int rc;
633 u32 target;
634 u8 prio;
635 u32 lirq;
636
637 - if (!is_xive_irq(chip))
638 - return -EINVAL;
639 -
640 rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
641 if (rc) {
642 xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc);
643 @@ -277,6 +280,9 @@ int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
644 xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ",
645 hw_irq, target, prio, lirq);
646
647 + if (!d)
648 + d = xive_get_irq_data(hw_irq);
649 +
650 if (d) {
651 struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
652 u64 val = xive_esb_read(xd, XIVE_ESB_GET);
653 diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
654 index 61c02a162d378..3588f4c65a4d4 100644
655 --- a/arch/s390/kernel/setup.c
656 +++ b/arch/s390/kernel/setup.c
657 @@ -922,9 +922,9 @@ static int __init setup_hwcaps(void)
658 if (MACHINE_HAS_VX) {
659 elf_hwcap |= HWCAP_S390_VXRS;
660 if (test_facility(134))
661 - elf_hwcap |= HWCAP_S390_VXRS_EXT;
662 - if (test_facility(135))
663 elf_hwcap |= HWCAP_S390_VXRS_BCD;
664 + if (test_facility(135))
665 + elf_hwcap |= HWCAP_S390_VXRS_EXT;
666 if (test_facility(148))
667 elf_hwcap |= HWCAP_S390_VXRS_EXT2;
668 if (test_facility(152))
669 diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
670 index f4c51756c4623..4c56de5429608 100644
671 --- a/arch/s390/kvm/gaccess.h
672 +++ b/arch/s390/kvm/gaccess.h
673 @@ -18,17 +18,14 @@
674
675 /**
676 * kvm_s390_real_to_abs - convert guest real address to guest absolute address
677 - * @vcpu - guest virtual cpu
678 + * @prefix - guest prefix
679 * @gra - guest real address
680 *
681 * Returns the guest absolute address that corresponds to the passed guest real
682 - * address @gra of a virtual guest cpu by applying its prefix.
683 + * address @gra of by applying the given prefix.
684 */
685 -static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
686 - unsigned long gra)
687 +static inline unsigned long _kvm_s390_real_to_abs(u32 prefix, unsigned long gra)
688 {
689 - unsigned long prefix = kvm_s390_get_prefix(vcpu);
690 -
691 if (gra < 2 * PAGE_SIZE)
692 gra += prefix;
693 else if (gra >= prefix && gra < prefix + 2 * PAGE_SIZE)
694 @@ -36,6 +33,43 @@ static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
695 return gra;
696 }
697
698 +/**
699 + * kvm_s390_real_to_abs - convert guest real address to guest absolute address
700 + * @vcpu - guest virtual cpu
701 + * @gra - guest real address
702 + *
703 + * Returns the guest absolute address that corresponds to the passed guest real
704 + * address @gra of a virtual guest cpu by applying its prefix.
705 + */
706 +static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
707 + unsigned long gra)
708 +{
709 + return _kvm_s390_real_to_abs(kvm_s390_get_prefix(vcpu), gra);
710 +}
711 +
712 +/**
713 + * _kvm_s390_logical_to_effective - convert guest logical to effective address
714 + * @psw: psw of the guest
715 + * @ga: guest logical address
716 + *
717 + * Convert a guest logical address to an effective address by applying the
718 + * rules of the addressing mode defined by bits 31 and 32 of the given PSW
719 + * (extendended/basic addressing mode).
720 + *
721 + * Depending on the addressing mode, the upper 40 bits (24 bit addressing
722 + * mode), 33 bits (31 bit addressing mode) or no bits (64 bit addressing
723 + * mode) of @ga will be zeroed and the remaining bits will be returned.
724 + */
725 +static inline unsigned long _kvm_s390_logical_to_effective(psw_t *psw,
726 + unsigned long ga)
727 +{
728 + if (psw_bits(*psw).eaba == PSW_BITS_AMODE_64BIT)
729 + return ga;
730 + if (psw_bits(*psw).eaba == PSW_BITS_AMODE_31BIT)
731 + return ga & ((1UL << 31) - 1);
732 + return ga & ((1UL << 24) - 1);
733 +}
734 +
735 /**
736 * kvm_s390_logical_to_effective - convert guest logical to effective address
737 * @vcpu: guest virtual cpu
738 @@ -52,13 +86,7 @@ static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
739 static inline unsigned long kvm_s390_logical_to_effective(struct kvm_vcpu *vcpu,
740 unsigned long ga)
741 {
742 - psw_t *psw = &vcpu->arch.sie_block->gpsw;
743 -
744 - if (psw_bits(*psw).eaba == PSW_BITS_AMODE_64BIT)
745 - return ga;
746 - if (psw_bits(*psw).eaba == PSW_BITS_AMODE_31BIT)
747 - return ga & ((1UL << 31) - 1);
748 - return ga & ((1UL << 24) - 1);
749 + return _kvm_s390_logical_to_effective(&vcpu->arch.sie_block->gpsw, ga);
750 }
751
752 /*
753 diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
754 index 6fb17b550a80f..d08e13c6dc982 100644
755 --- a/arch/s390/kvm/kvm-s390.c
756 +++ b/arch/s390/kvm/kvm-s390.c
757 @@ -3980,16 +3980,16 @@ static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
758 current->thread.fpu.fpc = vcpu->arch.host_fpregs.fpc;
759 current->thread.fpu.regs = vcpu->arch.host_fpregs.regs;
760 if (MACHINE_HAS_GS) {
761 + preempt_disable();
762 __ctl_set_bit(2, 4);
763 if (vcpu->arch.gs_enabled)
764 save_gs_cb(current->thread.gs_cb);
765 - preempt_disable();
766 current->thread.gs_cb = vcpu->arch.host_gscb;
767 restore_gs_cb(vcpu->arch.host_gscb);
768 - preempt_enable();
769 if (!vcpu->arch.host_gscb)
770 __ctl_clear_bit(2, 4);
771 vcpu->arch.host_gscb = NULL;
772 + preempt_enable();
773 }
774 /* SIE will save etoken directly into SDNX and therefore kvm_run */
775 }
776 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
777 index 8ef85139553f5..36a28b9e46cbd 100644
778 --- a/arch/x86/Kconfig
779 +++ b/arch/x86/Kconfig
780 @@ -550,6 +550,7 @@ config X86_UV
781 depends on X86_EXTENDED_PLATFORM
782 depends on NUMA
783 depends on EFI
784 + depends on KEXEC_CORE
785 depends on X86_X2APIC
786 depends on PCI
787 ---help---
788 diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
789 index be50ef8572cce..6a98a76516214 100644
790 --- a/arch/x86/events/amd/iommu.c
791 +++ b/arch/x86/events/amd/iommu.c
792 @@ -81,12 +81,12 @@ static struct attribute_group amd_iommu_events_group = {
793 };
794
795 struct amd_iommu_event_desc {
796 - struct kobj_attribute attr;
797 + struct device_attribute attr;
798 const char *event;
799 };
800
801 -static ssize_t _iommu_event_show(struct kobject *kobj,
802 - struct kobj_attribute *attr, char *buf)
803 +static ssize_t _iommu_event_show(struct device *dev,
804 + struct device_attribute *attr, char *buf)
805 {
806 struct amd_iommu_event_desc *event =
807 container_of(attr, struct amd_iommu_event_desc, attr);
808 diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
809 index cb0fdcaf14157..4a4198b806b4e 100644
810 --- a/arch/x86/kernel/cpu/microcode/core.c
811 +++ b/arch/x86/kernel/cpu/microcode/core.c
812 @@ -626,16 +626,16 @@ static ssize_t reload_store(struct device *dev,
813 if (val != 1)
814 return size;
815
816 - tmp_ret = microcode_ops->request_microcode_fw(bsp, &microcode_pdev->dev, true);
817 - if (tmp_ret != UCODE_NEW)
818 - return size;
819 -
820 get_online_cpus();
821
822 ret = check_online_cpus();
823 if (ret)
824 goto put;
825
826 + tmp_ret = microcode_ops->request_microcode_fw(bsp, &microcode_pdev->dev, true);
827 + if (tmp_ret != UCODE_NEW)
828 + goto put;
829 +
830 mutex_lock(&microcode_mutex);
831 ret = microcode_reload_late();
832 mutex_unlock(&microcode_mutex);
833 diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
834 index 5294018535d0c..c205d77d57da3 100644
835 --- a/arch/x86/kernel/kprobes/core.c
836 +++ b/arch/x86/kernel/kprobes/core.c
837 @@ -157,6 +157,8 @@ NOKPROBE_SYMBOL(skip_prefixes);
838 int can_boost(struct insn *insn, void *addr)
839 {
840 kprobe_opcode_t opcode;
841 + insn_byte_t prefix;
842 + int i;
843
844 if (search_exception_tables((unsigned long)addr))
845 return 0; /* Page fault may occur on this address. */
846 @@ -169,9 +171,14 @@ int can_boost(struct insn *insn, void *addr)
847 if (insn->opcode.nbytes != 1)
848 return 0;
849
850 - /* Can't boost Address-size override prefix */
851 - if (unlikely(inat_is_address_size_prefix(insn->attr)))
852 - return 0;
853 + for_each_insn_prefix(insn, i, prefix) {
854 + insn_attr_t attr;
855 +
856 + attr = inat_get_opcode_attribute(prefix);
857 + /* Can't boost Address-size override prefix and CS override prefix */
858 + if (prefix == 0x2e || inat_is_address_size_prefix(attr))
859 + return 0;
860 + }
861
862 opcode = insn->opcode.bytes[0];
863
864 @@ -196,8 +203,8 @@ int can_boost(struct insn *insn, void *addr)
865 /* clear and set flags are boostable */
866 return (opcode == 0xf5 || (0xf7 < opcode && opcode < 0xfe));
867 default:
868 - /* CS override prefix and call are not boostable */
869 - return (opcode != 0x2e && opcode != 0x9a);
870 + /* call is not boostable */
871 + return opcode != 0x9a;
872 }
873 }
874
875 diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
876 index e32e8bcf94553..3f63bd7421aca 100644
877 --- a/arch/x86/kvm/vmx/nested.c
878 +++ b/arch/x86/kvm/vmx/nested.c
879 @@ -5308,7 +5308,7 @@ static bool nested_vmx_exit_handled_vmcs_access(struct kvm_vcpu *vcpu,
880
881 /* Decode instruction info and find the field to access */
882 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
883 - field = kvm_register_read(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
884 + field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
885
886 /* Out-of-range fields always cause a VM exit from L2 to L1 */
887 if (field >> 15)
888 diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
889 index f9b1a2abdbe2f..2826bd45c61a1 100644
890 --- a/drivers/acpi/cppc_acpi.c
891 +++ b/drivers/acpi/cppc_acpi.c
892 @@ -118,23 +118,15 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
893 */
894 #define NUM_RETRIES 500ULL
895
896 -struct cppc_attr {
897 - struct attribute attr;
898 - ssize_t (*show)(struct kobject *kobj,
899 - struct attribute *attr, char *buf);
900 - ssize_t (*store)(struct kobject *kobj,
901 - struct attribute *attr, const char *c, ssize_t count);
902 -};
903 -
904 #define define_one_cppc_ro(_name) \
905 -static struct cppc_attr _name = \
906 +static struct kobj_attribute _name = \
907 __ATTR(_name, 0444, show_##_name, NULL)
908
909 #define to_cpc_desc(a) container_of(a, struct cpc_desc, kobj)
910
911 #define show_cppc_data(access_fn, struct_name, member_name) \
912 static ssize_t show_##member_name(struct kobject *kobj, \
913 - struct attribute *attr, char *buf) \
914 + struct kobj_attribute *attr, char *buf) \
915 { \
916 struct cpc_desc *cpc_ptr = to_cpc_desc(kobj); \
917 struct struct_name st_name = {0}; \
918 @@ -160,7 +152,7 @@ show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, reference_perf);
919 show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time);
920
921 static ssize_t show_feedback_ctrs(struct kobject *kobj,
922 - struct attribute *attr, char *buf)
923 + struct kobj_attribute *attr, char *buf)
924 {
925 struct cpc_desc *cpc_ptr = to_cpc_desc(kobj);
926 struct cppc_perf_fb_ctrs fb_ctrs = {0};
927 diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
928 index a1cbb894e5f0a..416cfbf2f1c29 100644
929 --- a/drivers/ata/libahci_platform.c
930 +++ b/drivers/ata/libahci_platform.c
931 @@ -582,11 +582,13 @@ int ahci_platform_init_host(struct platform_device *pdev,
932 int i, irq, n_ports, rc;
933
934 irq = platform_get_irq(pdev, 0);
935 - if (irq <= 0) {
936 + if (irq < 0) {
937 if (irq != -EPROBE_DEFER)
938 dev_err(dev, "no irq\n");
939 return irq;
940 }
941 + if (!irq)
942 + return -EINVAL;
943
944 hpriv->irq = irq;
945
946 diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
947 index ebecab8c3f36c..7c1c399450f32 100644
948 --- a/drivers/ata/pata_arasan_cf.c
949 +++ b/drivers/ata/pata_arasan_cf.c
950 @@ -817,12 +817,19 @@ static int arasan_cf_probe(struct platform_device *pdev)
951 else
952 quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */
953
954 - /* if irq is 0, support only PIO */
955 - acdev->irq = platform_get_irq(pdev, 0);
956 - if (acdev->irq)
957 + /*
958 + * If there's an error getting IRQ (or we do get IRQ0),
959 + * support only PIO
960 + */
961 + ret = platform_get_irq(pdev, 0);
962 + if (ret > 0) {
963 + acdev->irq = ret;
964 irq_handler = arasan_cf_interrupt;
965 - else
966 + } else if (ret == -EPROBE_DEFER) {
967 + return ret;
968 + } else {
969 quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA;
970 + }
971
972 acdev->pbase = res->start;
973 acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start,
974 diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
975 index d1644a8ef9fa6..abc0e87ca1a8b 100644
976 --- a/drivers/ata/pata_ixp4xx_cf.c
977 +++ b/drivers/ata/pata_ixp4xx_cf.c
978 @@ -165,8 +165,12 @@ static int ixp4xx_pata_probe(struct platform_device *pdev)
979 return -ENOMEM;
980
981 irq = platform_get_irq(pdev, 0);
982 - if (irq)
983 + if (irq > 0)
984 irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
985 + else if (irq < 0)
986 + return irq;
987 + else
988 + return -EINVAL;
989
990 /* Setup expansion bus chip selects */
991 *data->cs0_cfg = data->cs0_bits;
992 diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
993 index d7228f8e9297c..d1ed9679c7177 100644
994 --- a/drivers/ata/sata_mv.c
995 +++ b/drivers/ata/sata_mv.c
996 @@ -4097,6 +4097,10 @@ static int mv_platform_probe(struct platform_device *pdev)
997 n_ports = mv_platform_data->n_ports;
998 irq = platform_get_irq(pdev, 0);
999 }
1000 + if (irq < 0)
1001 + return irq;
1002 + if (!irq)
1003 + return -EINVAL;
1004
1005 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
1006 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
1007 diff --git a/drivers/base/node.c b/drivers/base/node.c
1008 index 9c6e6a7b93545..c9976dc4aa65f 100644
1009 --- a/drivers/base/node.c
1010 +++ b/drivers/base/node.c
1011 @@ -262,21 +262,20 @@ static void node_init_cache_dev(struct node *node)
1012 if (!dev)
1013 return;
1014
1015 + device_initialize(dev);
1016 dev->parent = &node->dev;
1017 dev->release = node_cache_release;
1018 if (dev_set_name(dev, "memory_side_cache"))
1019 - goto free_dev;
1020 + goto put_device;
1021
1022 - if (device_register(dev))
1023 - goto free_name;
1024 + if (device_add(dev))
1025 + goto put_device;
1026
1027 pm_runtime_no_callbacks(dev);
1028 node->cache_dev = dev;
1029 return;
1030 -free_name:
1031 - kfree_const(dev->kobj.name);
1032 -free_dev:
1033 - kfree(dev);
1034 +put_device:
1035 + put_device(dev);
1036 }
1037
1038 /**
1039 @@ -313,25 +312,24 @@ void node_add_cache(unsigned int nid, struct node_cache_attrs *cache_attrs)
1040 return;
1041
1042 dev = &info->dev;
1043 + device_initialize(dev);
1044 dev->parent = node->cache_dev;
1045 dev->release = node_cacheinfo_release;
1046 dev->groups = cache_groups;
1047 if (dev_set_name(dev, "index%d", cache_attrs->level))
1048 - goto free_cache;
1049 + goto put_device;
1050
1051 info->cache_attrs = *cache_attrs;
1052 - if (device_register(dev)) {
1053 + if (device_add(dev)) {
1054 dev_warn(&node->dev, "failed to add cache level:%d\n",
1055 cache_attrs->level);
1056 - goto free_name;
1057 + goto put_device;
1058 }
1059 pm_runtime_no_callbacks(dev);
1060 list_add_tail(&info->node, &node->cache_attrs);
1061 return;
1062 -free_name:
1063 - kfree_const(dev->kobj.name);
1064 -free_cache:
1065 - kfree(info);
1066 +put_device:
1067 + put_device(dev);
1068 }
1069
1070 static void node_remove_caches(struct node *node)
1071 diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
1072 index 398991381e9af..4f2ff1b2b4502 100644
1073 --- a/drivers/base/regmap/regmap-debugfs.c
1074 +++ b/drivers/base/regmap/regmap-debugfs.c
1075 @@ -661,6 +661,7 @@ void regmap_debugfs_exit(struct regmap *map)
1076 regmap_debugfs_free_dump_cache(map);
1077 mutex_unlock(&map->cache_lock);
1078 kfree(map->debugfs_name);
1079 + map->debugfs_name = NULL;
1080 } else {
1081 struct regmap_debugfs_node *node, *tmp;
1082
1083 diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
1084 index 5f1376578ea32..90dcf4a915f42 100644
1085 --- a/drivers/block/null_blk_zoned.c
1086 +++ b/drivers/block/null_blk_zoned.c
1087 @@ -73,6 +73,7 @@ int null_zone_init(struct nullb_device *dev)
1088 void null_zone_exit(struct nullb_device *dev)
1089 {
1090 kvfree(dev->zones);
1091 + dev->zones = NULL;
1092 }
1093
1094 int null_zone_report(struct gendisk *disk, sector_t sector,
1095 diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
1096 index 1d3002d773f7a..20cb0c23a22c2 100644
1097 --- a/drivers/block/xen-blkback/common.h
1098 +++ b/drivers/block/xen-blkback/common.h
1099 @@ -316,6 +316,7 @@ struct xen_blkif {
1100
1101 struct work_struct free_work;
1102 unsigned int nr_ring_pages;
1103 + bool multi_ref;
1104 /* All rings for this device. */
1105 struct xen_blkif_ring *rings;
1106 unsigned int nr_rings;
1107 diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
1108 index 040d7bb213978..dca91d641f1da 100644
1109 --- a/drivers/block/xen-blkback/xenbus.c
1110 +++ b/drivers/block/xen-blkback/xenbus.c
1111 @@ -949,14 +949,17 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
1112 for (i = 0; i < nr_grefs; i++) {
1113 char ring_ref_name[RINGREF_NAME_LEN];
1114
1115 - snprintf(ring_ref_name, RINGREF_NAME_LEN, "ring-ref%u", i);
1116 + if (blkif->multi_ref)
1117 + snprintf(ring_ref_name, RINGREF_NAME_LEN, "ring-ref%u", i);
1118 + else {
1119 + WARN_ON(i != 0);
1120 + snprintf(ring_ref_name, RINGREF_NAME_LEN, "ring-ref");
1121 + }
1122 +
1123 err = xenbus_scanf(XBT_NIL, dir, ring_ref_name,
1124 "%u", &ring_ref[i]);
1125
1126 if (err != 1) {
1127 - if (nr_grefs == 1)
1128 - break;
1129 -
1130 err = -EINVAL;
1131 xenbus_dev_fatal(dev, err, "reading %s/%s",
1132 dir, ring_ref_name);
1133 @@ -964,18 +967,6 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
1134 }
1135 }
1136
1137 - if (err != 1) {
1138 - WARN_ON(nr_grefs != 1);
1139 -
1140 - err = xenbus_scanf(XBT_NIL, dir, "ring-ref", "%u",
1141 - &ring_ref[0]);
1142 - if (err != 1) {
1143 - err = -EINVAL;
1144 - xenbus_dev_fatal(dev, err, "reading %s/ring-ref", dir);
1145 - return err;
1146 - }
1147 - }
1148 -
1149 err = -ENOMEM;
1150 for (i = 0; i < nr_grefs * XEN_BLKIF_REQS_PER_PAGE; i++) {
1151 req = kzalloc(sizeof(*req), GFP_KERNEL);
1152 @@ -1079,10 +1070,15 @@ static int connect_ring(struct backend_info *be)
1153 blkif->nr_rings, blkif->blk_protocol, protocol,
1154 pers_grants ? "persistent grants" : "");
1155
1156 - ring_page_order = xenbus_read_unsigned(dev->otherend,
1157 - "ring-page-order", 0);
1158 -
1159 - if (ring_page_order > xen_blkif_max_ring_order) {
1160 + err = xenbus_scanf(XBT_NIL, dev->otherend, "ring-page-order", "%u",
1161 + &ring_page_order);
1162 + if (err != 1) {
1163 + blkif->nr_ring_pages = 1;
1164 + blkif->multi_ref = false;
1165 + } else if (ring_page_order <= xen_blkif_max_ring_order) {
1166 + blkif->nr_ring_pages = 1 << ring_page_order;
1167 + blkif->multi_ref = true;
1168 + } else {
1169 err = -EINVAL;
1170 xenbus_dev_fatal(dev, err,
1171 "requested ring page order %d exceed max:%d",
1172 @@ -1091,8 +1087,6 @@ static int connect_ring(struct backend_info *be)
1173 return err;
1174 }
1175
1176 - blkif->nr_ring_pages = 1 << ring_page_order;
1177 -
1178 if (blkif->nr_rings == 1)
1179 return read_per_ring_refs(&blkif->rings[0], dev->otherend);
1180 else {
1181 diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c
1182 index 03ddcf426887b..0b8f53a688b8a 100644
1183 --- a/drivers/bus/qcom-ebi2.c
1184 +++ b/drivers/bus/qcom-ebi2.c
1185 @@ -353,8 +353,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
1186
1187 /* Figure out the chipselect */
1188 ret = of_property_read_u32(child, "reg", &csindex);
1189 - if (ret)
1190 + if (ret) {
1191 + of_node_put(child);
1192 return ret;
1193 + }
1194
1195 if (csindex > 5) {
1196 dev_err(dev,
1197 diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
1198 index 56db949a7b707..e6258b4485dc7 100644
1199 --- a/drivers/char/ttyprintk.c
1200 +++ b/drivers/char/ttyprintk.c
1201 @@ -158,12 +158,23 @@ static int tpk_ioctl(struct tty_struct *tty,
1202 return 0;
1203 }
1204
1205 +/*
1206 + * TTY operations hangup function.
1207 + */
1208 +static void tpk_hangup(struct tty_struct *tty)
1209 +{
1210 + struct ttyprintk_port *tpkp = tty->driver_data;
1211 +
1212 + tty_port_hangup(&tpkp->port);
1213 +}
1214 +
1215 static const struct tty_operations ttyprintk_ops = {
1216 .open = tpk_open,
1217 .close = tpk_close,
1218 .write = tpk_write,
1219 .write_room = tpk_write_room,
1220 .ioctl = tpk_ioctl,
1221 + .hangup = tpk_hangup,
1222 };
1223
1224 static const struct tty_port_operations null_ops = { };
1225 diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
1226 index 84ca38450d021..af957179b135e 100644
1227 --- a/drivers/clk/clk-ast2600.c
1228 +++ b/drivers/clk/clk-ast2600.c
1229 @@ -58,10 +58,10 @@ static void __iomem *scu_g6_base;
1230 static const struct aspeed_gate_data aspeed_g6_gates[] = {
1231 /* clk rst name parent flags */
1232 [ASPEED_CLK_GATE_MCLK] = { 0, -1, "mclk-gate", "mpll", CLK_IS_CRITICAL }, /* SDRAM */
1233 - [ASPEED_CLK_GATE_ECLK] = { 1, -1, "eclk-gate", "eclk", 0 }, /* Video Engine */
1234 + [ASPEED_CLK_GATE_ECLK] = { 1, 6, "eclk-gate", "eclk", 0 }, /* Video Engine */
1235 [ASPEED_CLK_GATE_GCLK] = { 2, 7, "gclk-gate", NULL, 0 }, /* 2D engine */
1236 /* vclk parent - dclk/d1clk/hclk/mclk */
1237 - [ASPEED_CLK_GATE_VCLK] = { 3, 6, "vclk-gate", NULL, 0 }, /* Video Capture */
1238 + [ASPEED_CLK_GATE_VCLK] = { 3, -1, "vclk-gate", NULL, 0 }, /* Video Capture */
1239 [ASPEED_CLK_GATE_BCLK] = { 4, 8, "bclk-gate", "bclk", 0 }, /* PCIe/PCI */
1240 /* From dpll */
1241 [ASPEED_CLK_GATE_DCLK] = { 5, -1, "dclk-gate", NULL, CLK_IS_CRITICAL }, /* DAC */
1242 diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c
1243 index 5fc6d486a3812..07e47c34e073a 100644
1244 --- a/drivers/clk/mvebu/armada-37xx-periph.c
1245 +++ b/drivers/clk/mvebu/armada-37xx-periph.c
1246 @@ -84,6 +84,7 @@ struct clk_pm_cpu {
1247 void __iomem *reg_div;
1248 u8 shift_div;
1249 struct regmap *nb_pm_base;
1250 + unsigned long l1_expiration;
1251 };
1252
1253 #define to_clk_double_div(_hw) container_of(_hw, struct clk_double_div, hw)
1254 @@ -438,33 +439,6 @@ static u8 clk_pm_cpu_get_parent(struct clk_hw *hw)
1255 return val;
1256 }
1257
1258 -static int clk_pm_cpu_set_parent(struct clk_hw *hw, u8 index)
1259 -{
1260 - struct clk_pm_cpu *pm_cpu = to_clk_pm_cpu(hw);
1261 - struct regmap *base = pm_cpu->nb_pm_base;
1262 - int load_level;
1263 -
1264 - /*
1265 - * We set the clock parent only if the DVFS is available but
1266 - * not enabled.
1267 - */
1268 - if (IS_ERR(base) || armada_3700_pm_dvfs_is_enabled(base))
1269 - return -EINVAL;
1270 -
1271 - /* Set the parent clock for all the load level */
1272 - for (load_level = 0; load_level < LOAD_LEVEL_NR; load_level++) {
1273 - unsigned int reg, mask, val,
1274 - offset = ARMADA_37XX_NB_TBG_SEL_OFF;
1275 -
1276 - armada_3700_pm_dvfs_update_regs(load_level, &reg, &offset);
1277 -
1278 - val = index << offset;
1279 - mask = ARMADA_37XX_NB_TBG_SEL_MASK << offset;
1280 - regmap_update_bits(base, reg, mask, val);
1281 - }
1282 - return 0;
1283 -}
1284 -
1285 static unsigned long clk_pm_cpu_recalc_rate(struct clk_hw *hw,
1286 unsigned long parent_rate)
1287 {
1288 @@ -512,8 +486,10 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
1289 }
1290
1291 /*
1292 - * Switching the CPU from the L2 or L3 frequencies (300 and 200 Mhz
1293 - * respectively) to L0 frequency (1.2 Ghz) requires a significant
1294 + * Workaround when base CPU frequnecy is 1000 or 1200 MHz
1295 + *
1296 + * Switching the CPU from the L2 or L3 frequencies (250/300 or 200 MHz
1297 + * respectively) to L0 frequency (1/1.2 GHz) requires a significant
1298 * amount of time to let VDD stabilize to the appropriate
1299 * voltage. This amount of time is large enough that it cannot be
1300 * covered by the hardware countdown register. Due to this, the CPU
1301 @@ -523,26 +499,56 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
1302 * To work around this problem, we prevent switching directly from the
1303 * L2/L3 frequencies to the L0 frequency, and instead switch to the L1
1304 * frequency in-between. The sequence therefore becomes:
1305 - * 1. First switch from L2/L3(200/300MHz) to L1(600MHZ)
1306 + * 1. First switch from L2/L3 (200/250/300 MHz) to L1 (500/600 MHz)
1307 * 2. Sleep 20ms for stabling VDD voltage
1308 - * 3. Then switch from L1(600MHZ) to L0(1200Mhz).
1309 + * 3. Then switch from L1 (500/600 MHz) to L0 (1000/1200 MHz).
1310 */
1311 -static void clk_pm_cpu_set_rate_wa(unsigned long rate, struct regmap *base)
1312 +static void clk_pm_cpu_set_rate_wa(struct clk_pm_cpu *pm_cpu,
1313 + unsigned int new_level, unsigned long rate,
1314 + struct regmap *base)
1315 {
1316 unsigned int cur_level;
1317
1318 - if (rate != 1200 * 1000 * 1000)
1319 - return;
1320 -
1321 regmap_read(base, ARMADA_37XX_NB_CPU_LOAD, &cur_level);
1322 cur_level &= ARMADA_37XX_NB_CPU_LOAD_MASK;
1323 - if (cur_level <= ARMADA_37XX_DVFS_LOAD_1)
1324 +
1325 + if (cur_level == new_level)
1326 + return;
1327 +
1328 + /*
1329 + * System wants to go to L1 on its own. If we are going from L2/L3,
1330 + * remember when 20ms will expire. If from L0, set the value so that
1331 + * next switch to L0 won't have to wait.
1332 + */
1333 + if (new_level == ARMADA_37XX_DVFS_LOAD_1) {
1334 + if (cur_level == ARMADA_37XX_DVFS_LOAD_0)
1335 + pm_cpu->l1_expiration = jiffies;
1336 + else
1337 + pm_cpu->l1_expiration = jiffies + msecs_to_jiffies(20);
1338 return;
1339 + }
1340 +
1341 + /*
1342 + * If we are setting to L2/L3, just invalidate L1 expiration time,
1343 + * sleeping is not needed.
1344 + */
1345 + if (rate < 1000*1000*1000)
1346 + goto invalidate_l1_exp;
1347 +
1348 + /*
1349 + * We are going to L0 with rate >= 1GHz. Check whether we have been at
1350 + * L1 for long enough time. If not, go to L1 for 20ms.
1351 + */
1352 + if (pm_cpu->l1_expiration && jiffies >= pm_cpu->l1_expiration)
1353 + goto invalidate_l1_exp;
1354
1355 regmap_update_bits(base, ARMADA_37XX_NB_CPU_LOAD,
1356 ARMADA_37XX_NB_CPU_LOAD_MASK,
1357 ARMADA_37XX_DVFS_LOAD_1);
1358 msleep(20);
1359 +
1360 +invalidate_l1_exp:
1361 + pm_cpu->l1_expiration = 0;
1362 }
1363
1364 static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
1365 @@ -576,7 +582,9 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
1366 reg = ARMADA_37XX_NB_CPU_LOAD;
1367 mask = ARMADA_37XX_NB_CPU_LOAD_MASK;
1368
1369 - clk_pm_cpu_set_rate_wa(rate, base);
1370 + /* Apply workaround when base CPU frequency is 1000 or 1200 MHz */
1371 + if (parent_rate >= 1000*1000*1000)
1372 + clk_pm_cpu_set_rate_wa(pm_cpu, load_level, rate, base);
1373
1374 regmap_update_bits(base, reg, mask, load_level);
1375
1376 @@ -590,7 +598,6 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
1377
1378 static const struct clk_ops clk_pm_cpu_ops = {
1379 .get_parent = clk_pm_cpu_get_parent,
1380 - .set_parent = clk_pm_cpu_set_parent,
1381 .round_rate = clk_pm_cpu_round_rate,
1382 .set_rate = clk_pm_cpu_set_rate,
1383 .recalc_rate = clk_pm_cpu_recalc_rate,
1384 diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c
1385 index 45cfc57bff924..af6ac17c7daeb 100644
1386 --- a/drivers/clk/qcom/a53-pll.c
1387 +++ b/drivers/clk/qcom/a53-pll.c
1388 @@ -93,6 +93,7 @@ static const struct of_device_id qcom_a53pll_match_table[] = {
1389 { .compatible = "qcom,msm8916-a53pll" },
1390 { }
1391 };
1392 +MODULE_DEVICE_TABLE(of, qcom_a53pll_match_table);
1393
1394 static struct platform_driver qcom_a53pll_driver = {
1395 .probe = qcom_a53pll_probe,
1396 diff --git a/drivers/clk/uniphier/clk-uniphier-mux.c b/drivers/clk/uniphier/clk-uniphier-mux.c
1397 index c0f4631601e23..babca032352a9 100644
1398 --- a/drivers/clk/uniphier/clk-uniphier-mux.c
1399 +++ b/drivers/clk/uniphier/clk-uniphier-mux.c
1400 @@ -31,10 +31,10 @@ static int uniphier_clk_mux_set_parent(struct clk_hw *hw, u8 index)
1401 static u8 uniphier_clk_mux_get_parent(struct clk_hw *hw)
1402 {
1403 struct uniphier_clk_mux *mux = to_uniphier_clk_mux(hw);
1404 - int num_parents = clk_hw_get_num_parents(hw);
1405 + unsigned int num_parents = clk_hw_get_num_parents(hw);
1406 int ret;
1407 unsigned int val;
1408 - u8 i;
1409 + unsigned int i;
1410
1411 ret = regmap_read(mux->regmap, mux->reg, &val);
1412 if (ret)
1413 diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c
1414 index a541397a172c8..18fee827602ab 100644
1415 --- a/drivers/clk/zynqmp/pll.c
1416 +++ b/drivers/clk/zynqmp/pll.c
1417 @@ -103,9 +103,7 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate,
1418 /* Enable the fractional mode if needed */
1419 rate_div = (rate * FRAC_DIV) / *prate;
1420 f = rate_div % FRAC_DIV;
1421 - zynqmp_pll_set_mode(hw, !!f);
1422 -
1423 - if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) {
1424 + if (f) {
1425 if (rate > PS_PLL_VCO_MAX) {
1426 fbdiv = rate / PS_PLL_VCO_MAX;
1427 rate = rate / (fbdiv + 1);
1428 @@ -179,10 +177,12 @@ static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
1429 int ret;
1430 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
1431
1432 - if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) {
1433 - rate_div = (rate * FRAC_DIV) / parent_rate;
1434 + rate_div = (rate * FRAC_DIV) / parent_rate;
1435 + f = rate_div % FRAC_DIV;
1436 + zynqmp_pll_set_mode(hw, !!f);
1437 +
1438 + if (f) {
1439 m = rate_div / FRAC_DIV;
1440 - f = rate_div % FRAC_DIV;
1441 m = clamp_t(u32, m, (PLL_FBDIV_MIN), (PLL_FBDIV_MAX));
1442 rate = parent_rate * m;
1443 frac = (parent_rate * f) / FRAC_DIV;
1444 diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c
1445 index b4af4094309b0..e4782f562e7a9 100644
1446 --- a/drivers/cpufreq/armada-37xx-cpufreq.c
1447 +++ b/drivers/cpufreq/armada-37xx-cpufreq.c
1448 @@ -25,6 +25,10 @@
1449
1450 #include "cpufreq-dt.h"
1451
1452 +/* Clk register set */
1453 +#define ARMADA_37XX_CLK_TBG_SEL 0
1454 +#define ARMADA_37XX_CLK_TBG_SEL_CPU_OFF 22
1455 +
1456 /* Power management in North Bridge register set */
1457 #define ARMADA_37XX_NB_L0L1 0x18
1458 #define ARMADA_37XX_NB_L2L3 0x1C
1459 @@ -69,6 +73,8 @@
1460 #define LOAD_LEVEL_NR 4
1461
1462 #define MIN_VOLT_MV 1000
1463 +#define MIN_VOLT_MV_FOR_L1_1000MHZ 1108
1464 +#define MIN_VOLT_MV_FOR_L1_1200MHZ 1155
1465
1466 /* AVS value for the corresponding voltage (in mV) */
1467 static int avs_map[] = {
1468 @@ -120,10 +126,15 @@ static struct armada_37xx_dvfs *armada_37xx_cpu_freq_info_get(u32 freq)
1469 * will be configured then the DVFS will be enabled.
1470 */
1471 static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base,
1472 - struct clk *clk, u8 *divider)
1473 + struct regmap *clk_base, u8 *divider)
1474 {
1475 + u32 cpu_tbg_sel;
1476 int load_lvl;
1477 - struct clk *parent;
1478 +
1479 + /* Determine to which TBG clock is CPU connected */
1480 + regmap_read(clk_base, ARMADA_37XX_CLK_TBG_SEL, &cpu_tbg_sel);
1481 + cpu_tbg_sel >>= ARMADA_37XX_CLK_TBG_SEL_CPU_OFF;
1482 + cpu_tbg_sel &= ARMADA_37XX_NB_TBG_SEL_MASK;
1483
1484 for (load_lvl = 0; load_lvl < LOAD_LEVEL_NR; load_lvl++) {
1485 unsigned int reg, mask, val, offset = 0;
1486 @@ -142,6 +153,11 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base,
1487 mask = (ARMADA_37XX_NB_CLK_SEL_MASK
1488 << ARMADA_37XX_NB_CLK_SEL_OFF);
1489
1490 + /* Set TBG index, for all levels we use the same TBG */
1491 + val = cpu_tbg_sel << ARMADA_37XX_NB_TBG_SEL_OFF;
1492 + mask = (ARMADA_37XX_NB_TBG_SEL_MASK
1493 + << ARMADA_37XX_NB_TBG_SEL_OFF);
1494 +
1495 /*
1496 * Set cpu divider based on the pre-computed array in
1497 * order to have balanced step.
1498 @@ -160,14 +176,6 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base,
1499
1500 regmap_update_bits(base, reg, mask, val);
1501 }
1502 -
1503 - /*
1504 - * Set cpu clock source, for all the level we keep the same
1505 - * clock source that the one already configured. For this one
1506 - * we need to use the clock framework
1507 - */
1508 - parent = clk_get_parent(clk);
1509 - clk_set_parent(clk, parent);
1510 }
1511
1512 /*
1513 @@ -202,6 +210,8 @@ static u32 armada_37xx_avs_val_match(int target_vm)
1514 * - L2 & L3 voltage should be about 150mv smaller than L0 voltage.
1515 * This function calculates L1 & L2 & L3 AVS values dynamically based
1516 * on L0 voltage and fill all AVS values to the AVS value table.
1517 + * When base CPU frequency is 1000 or 1200 MHz then there is additional
1518 + * minimal avs value for load L1.
1519 */
1520 static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,
1521 struct armada_37xx_dvfs *dvfs)
1522 @@ -233,6 +243,19 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,
1523 for (load_level = 1; load_level < LOAD_LEVEL_NR; load_level++)
1524 dvfs->avs[load_level] = avs_min;
1525
1526 + /*
1527 + * Set the avs values for load L0 and L1 when base CPU frequency
1528 + * is 1000/1200 MHz to its typical initial values according to
1529 + * the Armada 3700 Hardware Specifications.
1530 + */
1531 + if (dvfs->cpu_freq_max >= 1000*1000*1000) {
1532 + if (dvfs->cpu_freq_max >= 1200*1000*1000)
1533 + avs_min = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1200MHZ);
1534 + else
1535 + avs_min = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1000MHZ);
1536 + dvfs->avs[0] = dvfs->avs[1] = avs_min;
1537 + }
1538 +
1539 return;
1540 }
1541
1542 @@ -252,6 +275,26 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,
1543 target_vm = avs_map[l0_vdd_min] - 150;
1544 target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV;
1545 dvfs->avs[2] = dvfs->avs[3] = armada_37xx_avs_val_match(target_vm);
1546 +
1547 + /*
1548 + * Fix the avs value for load L1 when base CPU frequency is 1000/1200 MHz,
1549 + * otherwise the CPU gets stuck when switching from load L1 to load L0.
1550 + * Also ensure that avs value for load L1 is not higher than for L0.
1551 + */
1552 + if (dvfs->cpu_freq_max >= 1000*1000*1000) {
1553 + u32 avs_min_l1;
1554 +
1555 + if (dvfs->cpu_freq_max >= 1200*1000*1000)
1556 + avs_min_l1 = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1200MHZ);
1557 + else
1558 + avs_min_l1 = armada_37xx_avs_val_match(MIN_VOLT_MV_FOR_L1_1000MHZ);
1559 +
1560 + if (avs_min_l1 > dvfs->avs[0])
1561 + avs_min_l1 = dvfs->avs[0];
1562 +
1563 + if (dvfs->avs[1] < avs_min_l1)
1564 + dvfs->avs[1] = avs_min_l1;
1565 + }
1566 }
1567
1568 static void __init armada37xx_cpufreq_avs_setup(struct regmap *base,
1569 @@ -358,11 +401,16 @@ static int __init armada37xx_cpufreq_driver_init(void)
1570 struct platform_device *pdev;
1571 unsigned long freq;
1572 unsigned int cur_frequency, base_frequency;
1573 - struct regmap *nb_pm_base, *avs_base;
1574 + struct regmap *nb_clk_base, *nb_pm_base, *avs_base;
1575 struct device *cpu_dev;
1576 int load_lvl, ret;
1577 struct clk *clk, *parent;
1578
1579 + nb_clk_base =
1580 + syscon_regmap_lookup_by_compatible("marvell,armada-3700-periph-clock-nb");
1581 + if (IS_ERR(nb_clk_base))
1582 + return -ENODEV;
1583 +
1584 nb_pm_base =
1585 syscon_regmap_lookup_by_compatible("marvell,armada-3700-nb-pm");
1586
1587 @@ -421,7 +469,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
1588 return -EINVAL;
1589 }
1590
1591 - dvfs = armada_37xx_cpu_freq_info_get(cur_frequency);
1592 + dvfs = armada_37xx_cpu_freq_info_get(base_frequency);
1593 if (!dvfs) {
1594 clk_put(clk);
1595 return -EINVAL;
1596 @@ -439,7 +487,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
1597 armada37xx_cpufreq_avs_configure(avs_base, dvfs);
1598 armada37xx_cpufreq_avs_setup(avs_base, dvfs);
1599
1600 - armada37xx_cpufreq_dvfs_setup(nb_pm_base, clk, dvfs->divider);
1601 + armada37xx_cpufreq_dvfs_setup(nb_pm_base, nb_clk_base, dvfs->divider);
1602 clk_put(clk);
1603
1604 for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR;
1605 @@ -473,7 +521,7 @@ disable_dvfs:
1606 remove_opp:
1607 /* clean-up the already added opp before leaving */
1608 while (load_lvl-- > ARMADA_37XX_DVFS_LOAD_0) {
1609 - freq = cur_frequency / dvfs->divider[load_lvl];
1610 + freq = base_frequency / dvfs->divider[load_lvl];
1611 dev_pm_opp_remove(cpu_dev, freq);
1612 }
1613
1614 diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
1615 index 1dc5ac859f7b4..bdd4e36763f17 100644
1616 --- a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
1617 +++ b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
1618 @@ -233,12 +233,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1619 if (ret)
1620 goto out_err_free_reg;
1621
1622 - set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
1623 -
1624 ret = adf_dev_init(accel_dev);
1625 if (ret)
1626 goto out_err_dev_shutdown;
1627
1628 + set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
1629 +
1630 ret = adf_dev_start(accel_dev);
1631 if (ret)
1632 goto out_err_dev_stop;
1633 diff --git a/drivers/crypto/qat/qat_c62xvf/adf_drv.c b/drivers/crypto/qat/qat_c62xvf/adf_drv.c
1634 index a68358b31292d..538d9592c951d 100644
1635 --- a/drivers/crypto/qat/qat_c62xvf/adf_drv.c
1636 +++ b/drivers/crypto/qat/qat_c62xvf/adf_drv.c
1637 @@ -233,12 +233,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1638 if (ret)
1639 goto out_err_free_reg;
1640
1641 - set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
1642 -
1643 ret = adf_dev_init(accel_dev);
1644 if (ret)
1645 goto out_err_dev_shutdown;
1646
1647 + set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
1648 +
1649 ret = adf_dev_start(accel_dev);
1650 if (ret)
1651 goto out_err_dev_stop;
1652 diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c
1653 index cd1cdf5305bc9..4898ef41fd9fd 100644
1654 --- a/drivers/crypto/qat/qat_common/adf_isr.c
1655 +++ b/drivers/crypto/qat/qat_common/adf_isr.c
1656 @@ -330,19 +330,32 @@ int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev)
1657
1658 ret = adf_isr_alloc_msix_entry_table(accel_dev);
1659 if (ret)
1660 - return ret;
1661 - if (adf_enable_msix(accel_dev))
1662 goto err_out;
1663
1664 - if (adf_setup_bh(accel_dev))
1665 - goto err_out;
1666 + ret = adf_enable_msix(accel_dev);
1667 + if (ret)
1668 + goto err_free_msix_table;
1669
1670 - if (adf_request_irqs(accel_dev))
1671 - goto err_out;
1672 + ret = adf_setup_bh(accel_dev);
1673 + if (ret)
1674 + goto err_disable_msix;
1675 +
1676 + ret = adf_request_irqs(accel_dev);
1677 + if (ret)
1678 + goto err_cleanup_bh;
1679
1680 return 0;
1681 +
1682 +err_cleanup_bh:
1683 + adf_cleanup_bh(accel_dev);
1684 +
1685 +err_disable_msix:
1686 + adf_disable_msix(&accel_dev->accel_pci_dev);
1687 +
1688 +err_free_msix_table:
1689 + adf_isr_free_msix_entry_table(accel_dev);
1690 +
1691 err_out:
1692 - adf_isr_resource_free(accel_dev);
1693 - return -EFAULT;
1694 + return ret;
1695 }
1696 EXPORT_SYMBOL_GPL(adf_isr_resource_alloc);
1697 diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
1698 index 2136cbe4bf6c2..f65ebc4117d13 100644
1699 --- a/drivers/crypto/qat/qat_common/adf_transport.c
1700 +++ b/drivers/crypto/qat/qat_common/adf_transport.c
1701 @@ -197,6 +197,7 @@ static int adf_init_ring(struct adf_etr_ring_data *ring)
1702 dev_err(&GET_DEV(accel_dev), "Ring address not aligned\n");
1703 dma_free_coherent(&GET_DEV(accel_dev), ring_size_bytes,
1704 ring->base_addr, ring->dma_addr);
1705 + ring->base_addr = NULL;
1706 return -EFAULT;
1707 }
1708
1709 diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
1710 index 4a73fc70f7a97..df9a1f35b8320 100644
1711 --- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
1712 +++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
1713 @@ -304,17 +304,26 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev)
1714 goto err_out;
1715
1716 if (adf_setup_pf2vf_bh(accel_dev))
1717 - goto err_out;
1718 + goto err_disable_msi;
1719
1720 if (adf_setup_bh(accel_dev))
1721 - goto err_out;
1722 + goto err_cleanup_pf2vf_bh;
1723
1724 if (adf_request_msi_irq(accel_dev))
1725 - goto err_out;
1726 + goto err_cleanup_bh;
1727
1728 return 0;
1729 +
1730 +err_cleanup_bh:
1731 + adf_cleanup_bh(accel_dev);
1732 +
1733 +err_cleanup_pf2vf_bh:
1734 + adf_cleanup_pf2vf_bh(accel_dev);
1735 +
1736 +err_disable_msi:
1737 + adf_disable_msi(accel_dev);
1738 +
1739 err_out:
1740 - adf_vf_isr_resource_free(accel_dev);
1741 return -EFAULT;
1742 }
1743 EXPORT_SYMBOL_GPL(adf_vf_isr_resource_alloc);
1744 diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c b/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
1745 index 1b762eefc6c1a..5e0568c0113e1 100644
1746 --- a/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
1747 +++ b/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
1748 @@ -233,12 +233,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1749 if (ret)
1750 goto out_err_free_reg;
1751
1752 - set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
1753 -
1754 ret = adf_dev_init(accel_dev);
1755 if (ret)
1756 goto out_err_dev_shutdown;
1757
1758 + set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
1759 +
1760 ret = adf_dev_start(accel_dev);
1761 if (ret)
1762 goto out_err_dev_stop;
1763 diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
1764 index dce45f7a497de..c79652ee94be6 100644
1765 --- a/drivers/devfreq/devfreq.c
1766 +++ b/drivers/devfreq/devfreq.c
1767 @@ -319,7 +319,7 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
1768 devfreq->previous_freq = new_freq;
1769
1770 if (devfreq->suspend_freq)
1771 - devfreq->resume_freq = cur_freq;
1772 + devfreq->resume_freq = new_freq;
1773
1774 return err;
1775 }
1776 diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
1777 index e40a77bfe8210..7dfbd0f6b76b9 100644
1778 --- a/drivers/firmware/Kconfig
1779 +++ b/drivers/firmware/Kconfig
1780 @@ -237,6 +237,7 @@ config INTEL_STRATIX10_RSU
1781 config QCOM_SCM
1782 bool
1783 depends on ARM || ARM64
1784 + depends on HAVE_ARM_SMCCC
1785 select RESET_CONTROLLER
1786
1787 config QCOM_SCM_32
1788 diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
1789 index 5f35df23fb18e..9266c8e76be72 100644
1790 --- a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
1791 +++ b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
1792 @@ -20,6 +20,10 @@
1793 * OTHER DEALINGS IN THE SOFTWARE.
1794 */
1795
1796 +#include <linux/kconfig.h>
1797 +
1798 +#if IS_REACHABLE(CONFIG_AMD_IOMMU_V2)
1799 +
1800 #include <linux/printk.h>
1801 #include <linux/device.h>
1802 #include <linux/slab.h>
1803 @@ -358,3 +362,5 @@ int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev)
1804
1805 return 0;
1806 }
1807 +
1808 +#endif
1809 diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h
1810 index dd23d9fdf6a82..afd420b01a0c2 100644
1811 --- a/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h
1812 +++ b/drivers/gpu/drm/amd/amdkfd/kfd_iommu.h
1813 @@ -23,7 +23,9 @@
1814 #ifndef __KFD_IOMMU_H__
1815 #define __KFD_IOMMU_H__
1816
1817 -#if defined(CONFIG_AMD_IOMMU_V2_MODULE) || defined(CONFIG_AMD_IOMMU_V2)
1818 +#include <linux/kconfig.h>
1819 +
1820 +#if IS_REACHABLE(CONFIG_AMD_IOMMU_V2)
1821
1822 #define KFD_SUPPORT_IOMMU_V2
1823
1824 @@ -46,6 +48,9 @@ static inline int kfd_iommu_check_device(struct kfd_dev *kfd)
1825 }
1826 static inline int kfd_iommu_device_init(struct kfd_dev *kfd)
1827 {
1828 +#if IS_MODULE(CONFIG_AMD_IOMMU_V2)
1829 + WARN_ONCE(1, "iommu_v2 module is not usable by built-in KFD");
1830 +#endif
1831 return 0;
1832 }
1833
1834 @@ -73,6 +78,6 @@ static inline int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev)
1835 return 0;
1836 }
1837
1838 -#endif /* defined(CONFIG_AMD_IOMMU_V2) */
1839 +#endif /* IS_REACHABLE(CONFIG_AMD_IOMMU_V2) */
1840
1841 #endif /* __KFD_IOMMU_H__ */
1842 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1843 index 1aec841fda359..82f1d5434b82d 100644
1844 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1845 +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1846 @@ -2632,6 +2632,23 @@ static int fill_dc_scaling_info(const struct drm_plane_state *state,
1847 scaling_info->src_rect.x = state->src_x >> 16;
1848 scaling_info->src_rect.y = state->src_y >> 16;
1849
1850 + /*
1851 + * For reasons we don't (yet) fully understand a non-zero
1852 + * src_y coordinate into an NV12 buffer can cause a
1853 + * system hang. To avoid hangs (and maybe be overly cautious)
1854 + * let's reject both non-zero src_x and src_y.
1855 + *
1856 + * We currently know of only one use-case to reproduce a
1857 + * scenario with non-zero src_x and src_y for NV12, which
1858 + * is to gesture the YouTube Android app into full screen
1859 + * on ChromeOS.
1860 + */
1861 + if (state->fb &&
1862 + state->fb->format->format == DRM_FORMAT_NV12 &&
1863 + (scaling_info->src_rect.x != 0 ||
1864 + scaling_info->src_rect.y != 0))
1865 + return -EINVAL;
1866 +
1867 scaling_info->src_rect.width = state->src_w >> 16;
1868 if (scaling_info->src_rect.width == 0)
1869 return -EINVAL;
1870 diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
1871 index 8f37eefa0a028..a738c7e456ddc 100644
1872 --- a/drivers/gpu/drm/i915/gvt/gvt.c
1873 +++ b/drivers/gpu/drm/i915/gvt/gvt.c
1874 @@ -128,7 +128,7 @@ static bool intel_get_gvt_attrs(struct attribute ***type_attrs,
1875 return true;
1876 }
1877
1878 -static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
1879 +static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
1880 {
1881 int i, j;
1882 struct intel_vgpu_type *type;
1883 @@ -146,7 +146,7 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
1884 gvt_vgpu_type_groups[i] = group;
1885 }
1886
1887 - return true;
1888 + return 0;
1889
1890 unwind:
1891 for (j = 0; j < i; j++) {
1892 @@ -154,7 +154,7 @@ unwind:
1893 kfree(group);
1894 }
1895
1896 - return false;
1897 + return -ENOMEM;
1898 }
1899
1900 static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt)
1901 @@ -362,7 +362,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
1902 goto out_clean_thread;
1903
1904 ret = intel_gvt_init_vgpu_type_groups(gvt);
1905 - if (ret == false) {
1906 + if (ret) {
1907 gvt_err("failed to init vgpu type groups: %d\n", ret);
1908 goto out_clean_types;
1909 }
1910 diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
1911 index 3dc9b30a64b01..bfd503d220881 100644
1912 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
1913 +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
1914 @@ -494,8 +494,14 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
1915 }
1916 bo->base.pages = pages;
1917 bo->base.pages_use_count = 1;
1918 - } else
1919 + } else {
1920 pages = bo->base.pages;
1921 + if (pages[page_offset]) {
1922 + /* Pages are already mapped, bail out. */
1923 + mutex_unlock(&bo->base.pages_lock);
1924 + goto out;
1925 + }
1926 + }
1927
1928 mapping = bo->base.base.filp->f_mapping;
1929 mapping_set_unevictable(mapping);
1930 @@ -529,6 +535,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
1931
1932 dev_dbg(pfdev->dev, "mapped page fault @ AS%d %llx", as, addr);
1933
1934 +out:
1935 panfrost_gem_mapping_put(bomapping);
1936
1937 return 0;
1938 @@ -600,6 +607,8 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
1939 access_type = (fault_status >> 8) & 0x3;
1940 source_id = (fault_status >> 16);
1941
1942 + mmu_write(pfdev, MMU_INT_CLEAR, mask);
1943 +
1944 /* Page fault only */
1945 ret = -1;
1946 if ((status & mask) == BIT(i) && (exception_type & 0xF8) == 0xC0)
1947 @@ -623,8 +632,6 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
1948 access_type, access_type_name(pfdev, fault_status),
1949 source_id);
1950
1951 - mmu_write(pfdev, MMU_INT_CLEAR, mask);
1952 -
1953 status &= ~mask;
1954 }
1955
1956 diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
1957 index 709c4ef5e7d59..03d3550ecc7cb 100644
1958 --- a/drivers/gpu/drm/radeon/radeon_kms.c
1959 +++ b/drivers/gpu/drm/radeon/radeon_kms.c
1960 @@ -512,6 +512,7 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
1961 *value = rdev->config.si.backend_enable_mask;
1962 } else {
1963 DRM_DEBUG_KMS("BACKEND_ENABLED_MASK is si+ only!\n");
1964 + return -EINVAL;
1965 }
1966 break;
1967 case RADEON_INFO_MAX_SCLK:
1968 diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
1969 index d9e8105045a6d..1bfa690143d79 100644
1970 --- a/drivers/hid/hid-ids.h
1971 +++ b/drivers/hid/hid-ids.h
1972 @@ -932,6 +932,7 @@
1973 #define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
1974
1975 #define USB_VENDOR_ID_PLANTRONICS 0x047f
1976 +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056
1977
1978 #define USB_VENDOR_ID_PANASONIC 0x04da
1979 #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
1980 diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
1981 index 85b685efc12f3..e81b7cec2d124 100644
1982 --- a/drivers/hid/hid-plantronics.c
1983 +++ b/drivers/hid/hid-plantronics.c
1984 @@ -13,6 +13,7 @@
1985
1986 #include <linux/hid.h>
1987 #include <linux/module.h>
1988 +#include <linux/jiffies.h>
1989
1990 #define PLT_HID_1_0_PAGE 0xffa00000
1991 #define PLT_HID_2_0_PAGE 0xffa20000
1992 @@ -36,6 +37,16 @@
1993 #define PLT_ALLOW_CONSUMER (field->application == HID_CP_CONSUMERCONTROL && \
1994 (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
1995
1996 +#define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
1997 +
1998 +#define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
1999 +
2000 +struct plt_drv_data {
2001 + unsigned long device_type;
2002 + unsigned long last_volume_key_ts;
2003 + u32 quirks;
2004 +};
2005 +
2006 static int plantronics_input_mapping(struct hid_device *hdev,
2007 struct hid_input *hi,
2008 struct hid_field *field,
2009 @@ -43,7 +54,8 @@ static int plantronics_input_mapping(struct hid_device *hdev,
2010 unsigned long **bit, int *max)
2011 {
2012 unsigned short mapped_key;
2013 - unsigned long plt_type = (unsigned long)hid_get_drvdata(hdev);
2014 + struct plt_drv_data *drv_data = hid_get_drvdata(hdev);
2015 + unsigned long plt_type = drv_data->device_type;
2016
2017 /* special case for PTT products */
2018 if (field->application == HID_GD_JOYSTICK)
2019 @@ -105,6 +117,30 @@ mapped:
2020 return 1;
2021 }
2022
2023 +static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
2024 + struct hid_usage *usage, __s32 value)
2025 +{
2026 + struct plt_drv_data *drv_data = hid_get_drvdata(hdev);
2027 +
2028 + if (drv_data->quirks & PLT_QUIRK_DOUBLE_VOLUME_KEYS) {
2029 + unsigned long prev_ts, cur_ts;
2030 +
2031 + /* Usages are filtered in plantronics_usages. */
2032 +
2033 + if (!value) /* Handle key presses only. */
2034 + return 0;
2035 +
2036 + prev_ts = drv_data->last_volume_key_ts;
2037 + cur_ts = jiffies;
2038 + if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT)
2039 + return 1; /* Ignore the repeated key. */
2040 +
2041 + drv_data->last_volume_key_ts = cur_ts;
2042 + }
2043 +
2044 + return 0;
2045 +}
2046 +
2047 static unsigned long plantronics_device_type(struct hid_device *hdev)
2048 {
2049 unsigned i, col_page;
2050 @@ -133,15 +169,24 @@ exit:
2051 static int plantronics_probe(struct hid_device *hdev,
2052 const struct hid_device_id *id)
2053 {
2054 + struct plt_drv_data *drv_data;
2055 int ret;
2056
2057 + drv_data = devm_kzalloc(&hdev->dev, sizeof(*drv_data), GFP_KERNEL);
2058 + if (!drv_data)
2059 + return -ENOMEM;
2060 +
2061 ret = hid_parse(hdev);
2062 if (ret) {
2063 hid_err(hdev, "parse failed\n");
2064 goto err;
2065 }
2066
2067 - hid_set_drvdata(hdev, (void *)plantronics_device_type(hdev));
2068 + drv_data->device_type = plantronics_device_type(hdev);
2069 + drv_data->quirks = id->driver_data;
2070 + drv_data->last_volume_key_ts = jiffies - msecs_to_jiffies(PLT_DOUBLE_KEY_TIMEOUT);
2071 +
2072 + hid_set_drvdata(hdev, drv_data);
2073
2074 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
2075 HID_CONNECT_HIDINPUT_FORCE | HID_CONNECT_HIDDEV_FORCE);
2076 @@ -153,15 +198,26 @@ err:
2077 }
2078
2079 static const struct hid_device_id plantronics_devices[] = {
2080 + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
2081 + USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES),
2082 + .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
2083 { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
2084 { }
2085 };
2086 MODULE_DEVICE_TABLE(hid, plantronics_devices);
2087
2088 +static const struct hid_usage_id plantronics_usages[] = {
2089 + { HID_CP_VOLUMEUP, EV_KEY, HID_ANY_ID },
2090 + { HID_CP_VOLUMEDOWN, EV_KEY, HID_ANY_ID },
2091 + { HID_TERMINATOR, HID_TERMINATOR, HID_TERMINATOR }
2092 +};
2093 +
2094 static struct hid_driver plantronics_driver = {
2095 .name = "plantronics",
2096 .id_table = plantronics_devices,
2097 + .usage_table = plantronics_usages,
2098 .input_mapping = plantronics_input_mapping,
2099 + .event = plantronics_event,
2100 .probe = plantronics_probe,
2101 };
2102 module_hid_driver(plantronics_driver);
2103 diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c
2104 index 47f0208aa7c37..a5f92e2889cb8 100644
2105 --- a/drivers/hsi/hsi_core.c
2106 +++ b/drivers/hsi/hsi_core.c
2107 @@ -210,8 +210,6 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
2108 if (err)
2109 goto err;
2110
2111 - dev_set_name(&cl->device, "%s", name);
2112 -
2113 err = hsi_of_property_parse_mode(client, "hsi-mode", &mode);
2114 if (err) {
2115 err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
2116 @@ -293,6 +291,7 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
2117 cl->device.release = hsi_client_release;
2118 cl->device.of_node = client;
2119
2120 + dev_set_name(&cl->device, "%s", name);
2121 if (device_register(&cl->device) < 0) {
2122 pr_err("hsi: failed to register client: %s\n", name);
2123 put_device(&cl->device);
2124 diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
2125 index 0b55bc146b292..9260ad47350f8 100644
2126 --- a/drivers/hv/channel_mgmt.c
2127 +++ b/drivers/hv/channel_mgmt.c
2128 @@ -763,6 +763,12 @@ static void init_vp_index(struct vmbus_channel *channel, u16 dev_type)
2129 free_cpumask_var(available_mask);
2130 }
2131
2132 +#define UNLOAD_DELAY_UNIT_MS 10 /* 10 milliseconds */
2133 +#define UNLOAD_WAIT_MS (100*1000) /* 100 seconds */
2134 +#define UNLOAD_WAIT_LOOPS (UNLOAD_WAIT_MS/UNLOAD_DELAY_UNIT_MS)
2135 +#define UNLOAD_MSG_MS (5*1000) /* Every 5 seconds */
2136 +#define UNLOAD_MSG_LOOPS (UNLOAD_MSG_MS/UNLOAD_DELAY_UNIT_MS)
2137 +
2138 static void vmbus_wait_for_unload(void)
2139 {
2140 int cpu;
2141 @@ -780,12 +786,17 @@ static void vmbus_wait_for_unload(void)
2142 * vmbus_connection.unload_event. If not, the last thing we can do is
2143 * read message pages for all CPUs directly.
2144 *
2145 - * Wait no more than 10 seconds so that the panic path can't get
2146 - * hung forever in case the response message isn't seen.
2147 + * Wait up to 100 seconds since an Azure host must writeback any dirty
2148 + * data in its disk cache before the VMbus UNLOAD request will
2149 + * complete. This flushing has been empirically observed to take up
2150 + * to 50 seconds in cases with a lot of dirty data, so allow additional
2151 + * leeway and for inaccuracies in mdelay(). But eventually time out so
2152 + * that the panic path can't get hung forever in case the response
2153 + * message isn't seen.
2154 */
2155 - for (i = 0; i < 1000; i++) {
2156 + for (i = 1; i <= UNLOAD_WAIT_LOOPS; i++) {
2157 if (completion_done(&vmbus_connection.unload_event))
2158 - break;
2159 + goto completed;
2160
2161 for_each_online_cpu(cpu) {
2162 struct hv_per_cpu_context *hv_cpu
2163 @@ -808,9 +819,18 @@ static void vmbus_wait_for_unload(void)
2164 vmbus_signal_eom(msg, message_type);
2165 }
2166
2167 - mdelay(10);
2168 + /*
2169 + * Give a notice periodically so someone watching the
2170 + * serial output won't think it is completely hung.
2171 + */
2172 + if (!(i % UNLOAD_MSG_LOOPS))
2173 + pr_notice("Waiting for VMBus UNLOAD to complete\n");
2174 +
2175 + mdelay(UNLOAD_DELAY_UNIT_MS);
2176 }
2177 + pr_err("Continuing even though VMBus UNLOAD did not complete\n");
2178
2179 +completed:
2180 /*
2181 * We're crashing and already got the UNLOAD_RESPONSE, cleanup all
2182 * maybe-pending messages on all CPUs to be able to receive new
2183 diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
2184 index a51d3b7957701..17f0dd1f891e2 100644
2185 --- a/drivers/i2c/busses/i2c-cadence.c
2186 +++ b/drivers/i2c/busses/i2c-cadence.c
2187 @@ -901,7 +901,10 @@ static int cdns_i2c_probe(struct platform_device *pdev)
2188 if (IS_ERR(id->membase))
2189 return PTR_ERR(id->membase);
2190
2191 - id->irq = platform_get_irq(pdev, 0);
2192 + ret = platform_get_irq(pdev, 0);
2193 + if (ret < 0)
2194 + return ret;
2195 + id->irq = ret;
2196
2197 id->adap.owner = THIS_MODULE;
2198 id->adap.dev.of_node = pdev->dev.of_node;
2199 diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c
2200 index 959d4912ec0d5..0230a13a6ab72 100644
2201 --- a/drivers/i2c/busses/i2c-emev2.c
2202 +++ b/drivers/i2c/busses/i2c-emev2.c
2203 @@ -397,7 +397,10 @@ static int em_i2c_probe(struct platform_device *pdev)
2204
2205 em_i2c_reset(&priv->adap);
2206
2207 - priv->irq = platform_get_irq(pdev, 0);
2208 + ret = platform_get_irq(pdev, 0);
2209 + if (ret < 0)
2210 + goto err_clk;
2211 + priv->irq = ret;
2212 ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0,
2213 "em_i2c", priv);
2214 if (ret)
2215 diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
2216 index 20a4fbc53007b..a1f8a9a91213a 100644
2217 --- a/drivers/i2c/busses/i2c-img-scb.c
2218 +++ b/drivers/i2c/busses/i2c-img-scb.c
2219 @@ -1057,7 +1057,7 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
2220 atomic = true;
2221 }
2222
2223 - ret = pm_runtime_get_sync(adap->dev.parent);
2224 + ret = pm_runtime_resume_and_get(adap->dev.parent);
2225 if (ret < 0)
2226 return ret;
2227
2228 @@ -1158,7 +1158,7 @@ static int img_i2c_init(struct img_i2c *i2c)
2229 u32 rev;
2230 int ret;
2231
2232 - ret = pm_runtime_get_sync(i2c->adap.dev.parent);
2233 + ret = pm_runtime_resume_and_get(i2c->adap.dev.parent);
2234 if (ret < 0)
2235 return ret;
2236
2237 diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
2238 index c92b56485fa61..a0d045c1bc9e6 100644
2239 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
2240 +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
2241 @@ -265,7 +265,7 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx)
2242 unsigned int temp;
2243 int ret;
2244
2245 - ret = pm_runtime_get_sync(lpi2c_imx->adapter.dev.parent);
2246 + ret = pm_runtime_resume_and_get(lpi2c_imx->adapter.dev.parent);
2247 if (ret < 0)
2248 return ret;
2249
2250 diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
2251 index 8f0e1f802f2d1..a5e960cd82453 100644
2252 --- a/drivers/i2c/busses/i2c-jz4780.c
2253 +++ b/drivers/i2c/busses/i2c-jz4780.c
2254 @@ -751,7 +751,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
2255
2256 jz4780_i2c_writew(i2c, JZ4780_I2C_INTM, 0x0);
2257
2258 - i2c->irq = platform_get_irq(pdev, 0);
2259 + ret = platform_get_irq(pdev, 0);
2260 + if (ret < 0)
2261 + goto err;
2262 + i2c->irq = ret;
2263 ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0,
2264 dev_name(&pdev->dev), i2c);
2265 if (ret)
2266 diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
2267 index 2dfea357b1313..c36522849325b 100644
2268 --- a/drivers/i2c/busses/i2c-omap.c
2269 +++ b/drivers/i2c/busses/i2c-omap.c
2270 @@ -1408,9 +1408,9 @@ omap_i2c_probe(struct platform_device *pdev)
2271 pm_runtime_set_autosuspend_delay(omap->dev, OMAP_I2C_PM_TIMEOUT);
2272 pm_runtime_use_autosuspend(omap->dev);
2273
2274 - r = pm_runtime_get_sync(omap->dev);
2275 + r = pm_runtime_resume_and_get(omap->dev);
2276 if (r < 0)
2277 - goto err_free_mem;
2278 + goto err_disable_pm;
2279
2280 /*
2281 * Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2.
2282 @@ -1518,8 +1518,8 @@ err_unuse_clocks:
2283 omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
2284 pm_runtime_dont_use_autosuspend(omap->dev);
2285 pm_runtime_put_sync(omap->dev);
2286 +err_disable_pm:
2287 pm_runtime_disable(&pdev->dev);
2288 -err_free_mem:
2289
2290 return r;
2291 }
2292 @@ -1530,7 +1530,7 @@ static int omap_i2c_remove(struct platform_device *pdev)
2293 int ret;
2294
2295 i2c_del_adapter(&omap->adapter);
2296 - ret = pm_runtime_get_sync(&pdev->dev);
2297 + ret = pm_runtime_resume_and_get(&pdev->dev);
2298 if (ret < 0)
2299 return ret;
2300
2301 diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
2302 index c2005c789d2b0..319d1fa617c88 100644
2303 --- a/drivers/i2c/busses/i2c-sh7760.c
2304 +++ b/drivers/i2c/busses/i2c-sh7760.c
2305 @@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev)
2306 goto out2;
2307 }
2308
2309 - id->irq = platform_get_irq(pdev, 0);
2310 + ret = platform_get_irq(pdev, 0);
2311 + if (ret < 0)
2312 + goto out3;
2313 + id->irq = ret;
2314
2315 id->adap.nr = pdev->id;
2316 id->adap.algo = &sh7760_i2c_algo;
2317 diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c
2318 index b2dc802864641..92ba0183fd8a0 100644
2319 --- a/drivers/i2c/busses/i2c-sprd.c
2320 +++ b/drivers/i2c/busses/i2c-sprd.c
2321 @@ -290,7 +290,7 @@ static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap,
2322 struct sprd_i2c *i2c_dev = i2c_adap->algo_data;
2323 int im, ret;
2324
2325 - ret = pm_runtime_get_sync(i2c_dev->dev);
2326 + ret = pm_runtime_resume_and_get(i2c_dev->dev);
2327 if (ret < 0)
2328 return ret;
2329
2330 @@ -577,7 +577,7 @@ static int sprd_i2c_remove(struct platform_device *pdev)
2331 struct sprd_i2c *i2c_dev = platform_get_drvdata(pdev);
2332 int ret;
2333
2334 - ret = pm_runtime_get_sync(i2c_dev->dev);
2335 + ret = pm_runtime_resume_and_get(i2c_dev->dev);
2336 if (ret < 0)
2337 return ret;
2338
2339 diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
2340 index 19337aed9f235..6cc71c90f85ea 100644
2341 --- a/drivers/i3c/master.c
2342 +++ b/drivers/i3c/master.c
2343 @@ -2492,7 +2492,7 @@ int i3c_master_register(struct i3c_master_controller *master,
2344
2345 ret = i3c_master_bus_init(master);
2346 if (ret)
2347 - goto err_destroy_wq;
2348 + goto err_put_dev;
2349
2350 ret = device_add(&master->dev);
2351 if (ret)
2352 @@ -2523,9 +2523,6 @@ err_del_dev:
2353 err_cleanup_bus:
2354 i3c_master_bus_cleanup(master);
2355
2356 -err_destroy_wq:
2357 - destroy_workqueue(master->wq);
2358 -
2359 err_put_dev:
2360 put_device(&master->dev);
2361
2362 diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c
2363 index c4810c73b2a22..2de45587569a6 100644
2364 --- a/drivers/iio/accel/adis16201.c
2365 +++ b/drivers/iio/accel/adis16201.c
2366 @@ -215,7 +215,7 @@ static const struct iio_chan_spec adis16201_channels[] = {
2367 ADIS_AUX_ADC_CHAN(ADIS16201_AUX_ADC_REG, ADIS16201_SCAN_AUX_ADC, 0, 12),
2368 ADIS_INCLI_CHAN(X, ADIS16201_XINCL_OUT_REG, ADIS16201_SCAN_INCLI_X,
2369 BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
2370 - ADIS_INCLI_CHAN(X, ADIS16201_YINCL_OUT_REG, ADIS16201_SCAN_INCLI_Y,
2371 + ADIS_INCLI_CHAN(Y, ADIS16201_YINCL_OUT_REG, ADIS16201_SCAN_INCLI_Y,
2372 BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14),
2373 IIO_CHAN_SOFT_TIMESTAMP(7)
2374 };
2375 diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
2376 index bdbde8e22420d..4041b35ea3da3 100644
2377 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
2378 +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
2379 @@ -736,6 +736,7 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,
2380
2381 unmap_io:
2382 pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
2383 + dpit->dbr_bar_reg_iomem = NULL;
2384 return -ENOMEM;
2385 }
2386
2387 diff --git a/drivers/infiniband/hw/cxgb4/resource.c b/drivers/infiniband/hw/cxgb4/resource.c
2388 index 5c95c789f302d..e800e8e8bed5a 100644
2389 --- a/drivers/infiniband/hw/cxgb4/resource.c
2390 +++ b/drivers/infiniband/hw/cxgb4/resource.c
2391 @@ -216,7 +216,7 @@ u32 c4iw_get_qpid(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx)
2392 goto out;
2393 entry->qid = qid;
2394 list_add_tail(&entry->entry, &uctx->cqids);
2395 - for (i = qid; i & rdev->qpmask; i++) {
2396 + for (i = qid + 1; i & rdev->qpmask; i++) {
2397 entry = kmalloc(sizeof(*entry), GFP_KERNEL);
2398 if (!entry)
2399 goto out;
2400 diff --git a/drivers/infiniband/hw/hfi1/firmware.c b/drivers/infiniband/hw/hfi1/firmware.c
2401 index 2b57ba70ddd6a..c090807124858 100644
2402 --- a/drivers/infiniband/hw/hfi1/firmware.c
2403 +++ b/drivers/infiniband/hw/hfi1/firmware.c
2404 @@ -1924,6 +1924,7 @@ int parse_platform_config(struct hfi1_devdata *dd)
2405 dd_dev_err(dd, "%s: Failed CRC check at offset %ld\n",
2406 __func__, (ptr -
2407 (u32 *)dd->platform_config.data));
2408 + ret = -EINVAL;
2409 goto bail;
2410 }
2411 /* Jump the CRC DWORD */
2412 diff --git a/drivers/infiniband/hw/i40iw/i40iw_pble.c b/drivers/infiniband/hw/i40iw/i40iw_pble.c
2413 index 540aab5e502dd..3fafc5424e76d 100644
2414 --- a/drivers/infiniband/hw/i40iw/i40iw_pble.c
2415 +++ b/drivers/infiniband/hw/i40iw/i40iw_pble.c
2416 @@ -392,12 +392,9 @@ static enum i40iw_status_code add_pble_pool(struct i40iw_sc_dev *dev,
2417 i40iw_debug(dev, I40IW_DEBUG_PBLE, "next_fpm_addr = %llx chunk_size[%u] = 0x%x\n",
2418 pble_rsrc->next_fpm_addr, chunk->size, chunk->size);
2419 pble_rsrc->unallocated_pble -= (chunk->size >> 3);
2420 - list_add(&chunk->list, &pble_rsrc->pinfo.clist);
2421 sd_reg_val = (sd_entry_type == I40IW_SD_TYPE_PAGED) ?
2422 sd_entry->u.pd_table.pd_page_addr.pa : sd_entry->u.bp.addr.pa;
2423 - if (sd_entry->valid)
2424 - return 0;
2425 - if (dev->is_pf) {
2426 + if (dev->is_pf && !sd_entry->valid) {
2427 ret_code = i40iw_hmc_sd_one(dev, hmc_info->hmc_fn_id,
2428 sd_reg_val, idx->sd_idx,
2429 sd_entry->entry_type, true);
2430 @@ -408,6 +405,7 @@ static enum i40iw_status_code add_pble_pool(struct i40iw_sc_dev *dev,
2431 }
2432
2433 sd_entry->valid = true;
2434 + list_add(&chunk->list, &pble_rsrc->pinfo.clist);
2435 return 0;
2436 error:
2437 kfree(chunk);
2438 diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
2439 index 653ddf30973ec..b9b46a0c4803b 100644
2440 --- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
2441 +++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
2442 @@ -636,8 +636,10 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2443 memcpy(in_params.local_mac_addr, dev->ndev->dev_addr, ETH_ALEN);
2444
2445 if (test_and_set_bit(QEDR_IWARP_CM_WAIT_FOR_CONNECT,
2446 - &qp->iwarp_cm_flags))
2447 + &qp->iwarp_cm_flags)) {
2448 + rc = -ENODEV;
2449 goto err; /* QP already being destroyed */
2450 + }
2451
2452 rc = dev->ops->iwarp_connect(dev->rdma_ctx, &in_params, &out_params);
2453 if (rc) {
2454 diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c
2455 index e99983f076631..8bffa6e013fc2 100644
2456 --- a/drivers/infiniband/sw/siw/siw_mem.c
2457 +++ b/drivers/infiniband/sw/siw/siw_mem.c
2458 @@ -106,8 +106,6 @@ int siw_mr_add_mem(struct siw_mr *mr, struct ib_pd *pd, void *mem_obj,
2459 mem->perms = rights & IWARP_ACCESS_MASK;
2460 kref_init(&mem->ref);
2461
2462 - mr->mem = mem;
2463 -
2464 get_random_bytes(&next, 4);
2465 next &= 0x00ffffff;
2466
2467 @@ -116,6 +114,8 @@ int siw_mr_add_mem(struct siw_mr *mr, struct ib_pd *pd, void *mem_obj,
2468 kfree(mem);
2469 return -ENOMEM;
2470 }
2471 +
2472 + mr->mem = mem;
2473 /* Set the STag index part */
2474 mem->stag = id << 8;
2475 mr->base_mr.lkey = mr->base_mr.rkey = mem->stag;
2476 diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
2477 index 02b92e3cd9a88..2822ca5e82779 100644
2478 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
2479 +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
2480 @@ -2373,6 +2373,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
2481 pr_info("rejected SRP_LOGIN_REQ because target %s_%d is not enabled\n",
2482 dev_name(&sdev->device->dev), port_num);
2483 mutex_unlock(&sport->mutex);
2484 + ret = -EINVAL;
2485 goto reject;
2486 }
2487
2488 diff --git a/drivers/irqchip/irq-gic-v3-mbi.c b/drivers/irqchip/irq-gic-v3-mbi.c
2489 index 563a9b3662941..e81e89a81cb5b 100644
2490 --- a/drivers/irqchip/irq-gic-v3-mbi.c
2491 +++ b/drivers/irqchip/irq-gic-v3-mbi.c
2492 @@ -303,7 +303,7 @@ int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent)
2493 reg = of_get_property(np, "mbi-alias", NULL);
2494 if (reg) {
2495 mbi_phys_base = of_translate_address(np, reg);
2496 - if (mbi_phys_base == OF_BAD_ADDR) {
2497 + if (mbi_phys_base == (phys_addr_t)OF_BAD_ADDR) {
2498 ret = -ENXIO;
2499 goto err_free_mbi;
2500 }
2501 diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
2502 index 0a6c200e3dcb2..d7eef5292ae2f 100644
2503 --- a/drivers/md/md-bitmap.c
2504 +++ b/drivers/md/md-bitmap.c
2505 @@ -1726,6 +1726,8 @@ void md_bitmap_flush(struct mddev *mddev)
2506 md_bitmap_daemon_work(mddev);
2507 bitmap->daemon_lastrun -= sleep;
2508 md_bitmap_daemon_work(mddev);
2509 + if (mddev->bitmap_info.external)
2510 + md_super_wait(mddev);
2511 md_bitmap_update_sb(bitmap);
2512 }
2513
2514 diff --git a/drivers/md/md.c b/drivers/md/md.c
2515 index cc38530804c90..761d43829b2b7 100644
2516 --- a/drivers/md/md.c
2517 +++ b/drivers/md/md.c
2518 @@ -647,7 +647,34 @@ void mddev_init(struct mddev *mddev)
2519 }
2520 EXPORT_SYMBOL_GPL(mddev_init);
2521
2522 +static struct mddev *mddev_find_locked(dev_t unit)
2523 +{
2524 + struct mddev *mddev;
2525 +
2526 + list_for_each_entry(mddev, &all_mddevs, all_mddevs)
2527 + if (mddev->unit == unit)
2528 + return mddev;
2529 +
2530 + return NULL;
2531 +}
2532 +
2533 static struct mddev *mddev_find(dev_t unit)
2534 +{
2535 + struct mddev *mddev;
2536 +
2537 + if (MAJOR(unit) != MD_MAJOR)
2538 + unit &= ~((1 << MdpMinorShift) - 1);
2539 +
2540 + spin_lock(&all_mddevs_lock);
2541 + mddev = mddev_find_locked(unit);
2542 + if (mddev)
2543 + mddev_get(mddev);
2544 + spin_unlock(&all_mddevs_lock);
2545 +
2546 + return mddev;
2547 +}
2548 +
2549 +static struct mddev *mddev_find_or_alloc(dev_t unit)
2550 {
2551 struct mddev *mddev, *new = NULL;
2552
2553 @@ -658,13 +685,13 @@ static struct mddev *mddev_find(dev_t unit)
2554 spin_lock(&all_mddevs_lock);
2555
2556 if (unit) {
2557 - list_for_each_entry(mddev, &all_mddevs, all_mddevs)
2558 - if (mddev->unit == unit) {
2559 - mddev_get(mddev);
2560 - spin_unlock(&all_mddevs_lock);
2561 - kfree(new);
2562 - return mddev;
2563 - }
2564 + mddev = mddev_find_locked(unit);
2565 + if (mddev) {
2566 + mddev_get(mddev);
2567 + spin_unlock(&all_mddevs_lock);
2568 + kfree(new);
2569 + return mddev;
2570 + }
2571
2572 if (new) {
2573 list_add(&new->all_mddevs, &all_mddevs);
2574 @@ -690,12 +717,7 @@ static struct mddev *mddev_find(dev_t unit)
2575 return NULL;
2576 }
2577
2578 - is_free = 1;
2579 - list_for_each_entry(mddev, &all_mddevs, all_mddevs)
2580 - if (mddev->unit == dev) {
2581 - is_free = 0;
2582 - break;
2583 - }
2584 + is_free = !mddev_find_locked(dev);
2585 }
2586 new->unit = dev;
2587 new->md_minor = MINOR(dev);
2588 @@ -5436,7 +5458,7 @@ static int md_alloc(dev_t dev, char *name)
2589 * writing to /sys/module/md_mod/parameters/new_array.
2590 */
2591 static DEFINE_MUTEX(disks_mutex);
2592 - struct mddev *mddev = mddev_find(dev);
2593 + struct mddev *mddev = mddev_find_or_alloc(dev);
2594 struct gendisk *disk;
2595 int partitioned;
2596 int shift;
2597 @@ -6312,11 +6334,9 @@ static void autorun_devices(int part)
2598
2599 md_probe(dev, NULL, NULL);
2600 mddev = mddev_find(dev);
2601 - if (!mddev || !mddev->gendisk) {
2602 - if (mddev)
2603 - mddev_put(mddev);
2604 + if (!mddev)
2605 break;
2606 - }
2607 +
2608 if (mddev_lock(mddev))
2609 pr_warn("md: %s locked, cannot run\n", mdname(mddev));
2610 else if (mddev->raid_disks || mddev->major_version
2611 @@ -7618,8 +7638,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
2612 /* Wait until bdev->bd_disk is definitely gone */
2613 if (work_pending(&mddev->del_work))
2614 flush_workqueue(md_misc_wq);
2615 - /* Then retry the open from the top */
2616 - return -ERESTARTSYS;
2617 + return -EBUSY;
2618 }
2619 BUG_ON(mddev != bdev->bd_disk->private_data);
2620
2621 @@ -7952,7 +7971,11 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos)
2622 loff_t l = *pos;
2623 struct mddev *mddev;
2624
2625 - if (l >= 0x10000)
2626 + if (l == 0x10000) {
2627 + ++*pos;
2628 + return (void *)2;
2629 + }
2630 + if (l > 0x10000)
2631 return NULL;
2632 if (!l--)
2633 /* header */
2634 @@ -9049,11 +9072,11 @@ void md_check_recovery(struct mddev *mddev)
2635 }
2636
2637 if (mddev_is_clustered(mddev)) {
2638 - struct md_rdev *rdev;
2639 + struct md_rdev *rdev, *tmp;
2640 /* kick the device if another node issued a
2641 * remove disk.
2642 */
2643 - rdev_for_each(rdev, mddev) {
2644 + rdev_for_each_safe(rdev, tmp, mddev) {
2645 if (test_and_clear_bit(ClusterRemove, &rdev->flags) &&
2646 rdev->raid_disk < 0)
2647 md_kick_rdev_from_array(rdev);
2648 @@ -9366,7 +9389,7 @@ err_wq:
2649 static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev)
2650 {
2651 struct mdp_superblock_1 *sb = page_address(rdev->sb_page);
2652 - struct md_rdev *rdev2;
2653 + struct md_rdev *rdev2, *tmp;
2654 int role, ret;
2655 char b[BDEVNAME_SIZE];
2656
2657 @@ -9383,7 +9406,7 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev)
2658 }
2659
2660 /* Check for change of roles in the active devices */
2661 - rdev_for_each(rdev2, mddev) {
2662 + rdev_for_each_safe(rdev2, tmp, mddev) {
2663 if (test_bit(Faulty, &rdev2->flags))
2664 continue;
2665
2666 diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
2667 index e0299a7899231..6dde49d9aa4c2 100644
2668 --- a/drivers/media/platform/aspeed-video.c
2669 +++ b/drivers/media/platform/aspeed-video.c
2670 @@ -491,8 +491,8 @@ static void aspeed_video_off(struct aspeed_video *video)
2671 aspeed_video_write(video, VE_INTERRUPT_STATUS, 0xffffffff);
2672
2673 /* Turn off the relevant clocks */
2674 - clk_disable(video->vclk);
2675 clk_disable(video->eclk);
2676 + clk_disable(video->vclk);
2677
2678 clear_bit(VIDEO_CLOCKS_ON, &video->flags);
2679 }
2680 @@ -503,8 +503,8 @@ static void aspeed_video_on(struct aspeed_video *video)
2681 return;
2682
2683 /* Turn on the relevant clocks */
2684 - clk_enable(video->eclk);
2685 clk_enable(video->vclk);
2686 + clk_enable(video->eclk);
2687
2688 set_bit(VIDEO_CLOCKS_ON, &video->flags);
2689 }
2690 @@ -1684,8 +1684,11 @@ static int aspeed_video_probe(struct platform_device *pdev)
2691 return rc;
2692
2693 rc = aspeed_video_setup_video(video);
2694 - if (rc)
2695 + if (rc) {
2696 + clk_unprepare(video->vclk);
2697 + clk_unprepare(video->eclk);
2698 return rc;
2699 + }
2700
2701 return 0;
2702 }
2703 diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
2704 index f0dfe68486d16..c43a35df25de4 100644
2705 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
2706 +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
2707 @@ -151,8 +151,10 @@ static int sun6i_video_start_streaming(struct vb2_queue *vq, unsigned int count)
2708 }
2709
2710 subdev = sun6i_video_remote_subdev(video, NULL);
2711 - if (!subdev)
2712 + if (!subdev) {
2713 + ret = -EINVAL;
2714 goto stop_media_pipeline;
2715 + }
2716
2717 config.pixelformat = video->fmt.fmt.pix.pixelformat;
2718 config.code = video->mbus_code;
2719 diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
2720 index a0364ac497f92..54bb3a59bf170 100644
2721 --- a/drivers/media/platform/vivid/vivid-vid-out.c
2722 +++ b/drivers/media/platform/vivid/vivid-vid-out.c
2723 @@ -1025,7 +1025,7 @@ int vivid_vid_out_s_fbuf(struct file *file, void *fh,
2724 return -EINVAL;
2725 }
2726 dev->fbuf_out_flags &= ~(chroma_flags | alpha_flags);
2727 - dev->fbuf_out_flags = a->flags & (chroma_flags | alpha_flags);
2728 + dev->fbuf_out_flags |= a->flags & (chroma_flags | alpha_flags);
2729 return 0;
2730 }
2731
2732 diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c
2733 index b3505f4024764..8647c50b66e50 100644
2734 --- a/drivers/media/tuners/m88rs6000t.c
2735 +++ b/drivers/media/tuners/m88rs6000t.c
2736 @@ -525,7 +525,7 @@ static int m88rs6000t_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
2737 PGA2_cri = PGA2_GC >> 2;
2738 PGA2_crf = PGA2_GC & 0x03;
2739
2740 - for (i = 0; i <= RF_GC; i++)
2741 + for (i = 0; i <= RF_GC && i < ARRAY_SIZE(RFGS); i++)
2742 RFG += RFGS[i];
2743
2744 if (RF_GC == 0)
2745 @@ -537,12 +537,12 @@ static int m88rs6000t_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
2746 if (RF_GC == 3)
2747 RFG += 100;
2748
2749 - for (i = 0; i <= IF_GC; i++)
2750 + for (i = 0; i <= IF_GC && i < ARRAY_SIZE(IFGS); i++)
2751 IFG += IFGS[i];
2752
2753 TIAG = TIA_GC * TIA_GS;
2754
2755 - for (i = 0; i <= BB_GC; i++)
2756 + for (i = 0; i <= BB_GC && i < ARRAY_SIZE(BBGS); i++)
2757 BBG += BBGS[i];
2758
2759 PGA2G = PGA2_cri * PGA2_cri_GS + PGA2_crf * PGA2_crf_GS;
2760 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
2761 index 3fe99519fedfb..7ac7a5063fb2f 100644
2762 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
2763 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
2764 @@ -2155,7 +2155,15 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl)
2765 if (hdl == NULL || hdl->buckets == NULL)
2766 return;
2767
2768 - if (!hdl->req_obj.req && !list_empty(&hdl->requests)) {
2769 + /*
2770 + * If the main handler is freed and it is used by handler objects in
2771 + * outstanding requests, then unbind and put those objects before
2772 + * freeing the main handler.
2773 + *
2774 + * The main handler can be identified by having a NULL ops pointer in
2775 + * the request object.
2776 + */
2777 + if (!hdl->req_obj.ops && !list_empty(&hdl->requests)) {
2778 struct v4l2_ctrl_handler *req, *next_req;
2779
2780 list_for_each_entry_safe(req, next_req, &hdl->requests, requests) {
2781 @@ -3186,8 +3194,8 @@ static void v4l2_ctrl_request_unbind(struct media_request_object *obj)
2782 container_of(obj, struct v4l2_ctrl_handler, req_obj);
2783 struct v4l2_ctrl_handler *main_hdl = obj->priv;
2784
2785 - list_del_init(&hdl->requests);
2786 mutex_lock(main_hdl->lock);
2787 + list_del_init(&hdl->requests);
2788 if (hdl->request_is_queued) {
2789 list_del_init(&hdl->requests_queued);
2790 hdl->request_is_queued = false;
2791 @@ -3246,8 +3254,11 @@ static int v4l2_ctrl_request_bind(struct media_request *req,
2792 if (!ret) {
2793 ret = media_request_object_bind(req, &req_ops,
2794 from, false, &hdl->req_obj);
2795 - if (!ret)
2796 + if (!ret) {
2797 + mutex_lock(from->lock);
2798 list_add_tail(&hdl->requests, &from->requests);
2799 + mutex_unlock(from->lock);
2800 + }
2801 }
2802 return ret;
2803 }
2804 diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
2805 index 27bc417029e11..332ffd7cf8b0b 100644
2806 --- a/drivers/memory/omap-gpmc.c
2807 +++ b/drivers/memory/omap-gpmc.c
2808 @@ -1026,8 +1026,8 @@ EXPORT_SYMBOL(gpmc_cs_request);
2809
2810 void gpmc_cs_free(int cs)
2811 {
2812 - struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
2813 - struct resource *res = &gpmc->mem;
2814 + struct gpmc_cs_data *gpmc;
2815 + struct resource *res;
2816
2817 spin_lock(&gpmc_mem_lock);
2818 if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
2819 @@ -1036,6 +1036,9 @@ void gpmc_cs_free(int cs)
2820 spin_unlock(&gpmc_mem_lock);
2821 return;
2822 }
2823 + gpmc = &gpmc_cs[cs];
2824 + res = &gpmc->mem;
2825 +
2826 gpmc_cs_disable_mem(cs);
2827 if (res->flags)
2828 release_resource(res);
2829 diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c
2830 index 73bd3023202f0..b42804b1801e6 100644
2831 --- a/drivers/memory/pl353-smc.c
2832 +++ b/drivers/memory/pl353-smc.c
2833 @@ -63,7 +63,7 @@
2834 /* ECC memory config register specific constants */
2835 #define PL353_SMC_ECC_MEMCFG_MODE_MASK 0xC
2836 #define PL353_SMC_ECC_MEMCFG_MODE_SHIFT 2
2837 -#define PL353_SMC_ECC_MEMCFG_PGSIZE_MASK 0xC
2838 +#define PL353_SMC_ECC_MEMCFG_PGSIZE_MASK 0x3
2839
2840 #define PL353_SMC_DC_UPT_NAND_REGS ((4 << 23) | /* CS: NAND chip */ \
2841 (2 << 21)) /* UpdateRegs operation */
2842 diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
2843 index efcd4b980c94c..1adba6a46dcb1 100644
2844 --- a/drivers/mfd/stm32-timers.c
2845 +++ b/drivers/mfd/stm32-timers.c
2846 @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
2847
2848 static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
2849 {
2850 + u32 arr;
2851 +
2852 + /* Backup ARR to restore it after getting the maximum value */
2853 + regmap_read(ddata->regmap, TIM_ARR, &arr);
2854 +
2855 /*
2856 * Only the available bits will be written so when readback
2857 * we get the maximum value of auto reload register
2858 */
2859 regmap_write(ddata->regmap, TIM_ARR, ~0L);
2860 regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
2861 - regmap_write(ddata->regmap, TIM_ARR, 0x0);
2862 + regmap_write(ddata->regmap, TIM_ARR, arr);
2863 }
2864
2865 static void stm32_timers_dma_probe(struct device *dev,
2866 diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
2867 index 057d7bbde4029..d98174eced5a3 100644
2868 --- a/drivers/misc/lis3lv02d/lis3lv02d.c
2869 +++ b/drivers/misc/lis3lv02d/lis3lv02d.c
2870 @@ -208,7 +208,7 @@ static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000};
2871 static int lis3_3dlh_rates[4] = {50, 100, 400, 1000};
2872
2873 /* ODR is Output Data Rate */
2874 -static int lis3lv02d_get_odr(struct lis3lv02d *lis3)
2875 +static int lis3lv02d_get_odr_index(struct lis3lv02d *lis3)
2876 {
2877 u8 ctrl;
2878 int shift;
2879 @@ -216,15 +216,23 @@ static int lis3lv02d_get_odr(struct lis3lv02d *lis3)
2880 lis3->read(lis3, CTRL_REG1, &ctrl);
2881 ctrl &= lis3->odr_mask;
2882 shift = ffs(lis3->odr_mask) - 1;
2883 - return lis3->odrs[(ctrl >> shift)];
2884 + return (ctrl >> shift);
2885 }
2886
2887 static int lis3lv02d_get_pwron_wait(struct lis3lv02d *lis3)
2888 {
2889 - int div = lis3lv02d_get_odr(lis3);
2890 + int odr_idx = lis3lv02d_get_odr_index(lis3);
2891 + int div = lis3->odrs[odr_idx];
2892
2893 - if (WARN_ONCE(div == 0, "device returned spurious data"))
2894 + if (div == 0) {
2895 + if (odr_idx == 0) {
2896 + /* Power-down mode, not sampling no need to sleep */
2897 + return 0;
2898 + }
2899 +
2900 + dev_err(&lis3->pdev->dev, "Error unknown odrs-index: %d\n", odr_idx);
2901 return -ENXIO;
2902 + }
2903
2904 /* LIS3 power on delay is quite long */
2905 msleep(lis3->pwron_delay / div);
2906 @@ -807,9 +815,12 @@ static ssize_t lis3lv02d_rate_show(struct device *dev,
2907 struct device_attribute *attr, char *buf)
2908 {
2909 struct lis3lv02d *lis3 = dev_get_drvdata(dev);
2910 + int odr_idx;
2911
2912 lis3lv02d_sysfs_poweron(lis3);
2913 - return sprintf(buf, "%d\n", lis3lv02d_get_odr(lis3));
2914 +
2915 + odr_idx = lis3lv02d_get_odr_index(lis3);
2916 + return sprintf(buf, "%d\n", lis3->odrs[odr_idx]);
2917 }
2918
2919 static ssize_t lis3lv02d_rate_set(struct device *dev,
2920 diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c
2921 index 345addd9306de..fa8a7fce4481b 100644
2922 --- a/drivers/misc/vmw_vmci/vmci_doorbell.c
2923 +++ b/drivers/misc/vmw_vmci/vmci_doorbell.c
2924 @@ -326,7 +326,7 @@ int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle)
2925 bool vmci_dbell_register_notification_bitmap(u64 bitmap_ppn)
2926 {
2927 int result;
2928 - struct vmci_notify_bm_set_msg bitmap_set_msg;
2929 + struct vmci_notify_bm_set_msg bitmap_set_msg = { };
2930
2931 bitmap_set_msg.hdr.dst = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
2932 VMCI_SET_NOTIFY_BITMAP);
2933 diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
2934 index 7a84a48c75da3..5437685518661 100644
2935 --- a/drivers/misc/vmw_vmci/vmci_guest.c
2936 +++ b/drivers/misc/vmw_vmci/vmci_guest.c
2937 @@ -168,7 +168,7 @@ static int vmci_check_host_caps(struct pci_dev *pdev)
2938 VMCI_UTIL_NUM_RESOURCES * sizeof(u32);
2939 struct vmci_datagram *check_msg;
2940
2941 - check_msg = kmalloc(msg_size, GFP_KERNEL);
2942 + check_msg = kzalloc(msg_size, GFP_KERNEL);
2943 if (!check_msg) {
2944 dev_err(&pdev->dev, "%s: Insufficient memory\n", __func__);
2945 return -ENOMEM;
2946 diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
2947 index 48832f9b215c0..ee437af41f11e 100644
2948 --- a/drivers/mtd/mtdchar.c
2949 +++ b/drivers/mtd/mtdchar.c
2950 @@ -649,16 +649,12 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
2951 case MEMGETINFO:
2952 case MEMREADOOB:
2953 case MEMREADOOB64:
2954 - case MEMLOCK:
2955 - case MEMUNLOCK:
2956 case MEMISLOCKED:
2957 case MEMGETOOBSEL:
2958 case MEMGETBADBLOCK:
2959 - case MEMSETBADBLOCK:
2960 case OTPSELECT:
2961 case OTPGETREGIONCOUNT:
2962 case OTPGETREGIONINFO:
2963 - case OTPLOCK:
2964 case ECCGETLAYOUT:
2965 case ECCGETSTATS:
2966 case MTDFILEMODE:
2967 @@ -669,9 +665,13 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
2968 /* "dangerous" commands */
2969 case MEMERASE:
2970 case MEMERASE64:
2971 + case MEMLOCK:
2972 + case MEMUNLOCK:
2973 + case MEMSETBADBLOCK:
2974 case MEMWRITEOOB:
2975 case MEMWRITEOOB64:
2976 case MEMWRITE:
2977 + case OTPLOCK:
2978 if (!(file->f_mode & FMODE_WRITE))
2979 return -EPERM;
2980 break;
2981 diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
2982 index 036b9452b19f7..32a76b8feaa5d 100644
2983 --- a/drivers/mtd/mtdcore.c
2984 +++ b/drivers/mtd/mtdcore.c
2985 @@ -825,6 +825,9 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
2986
2987 /* Prefer parsed partitions over driver-provided fallback */
2988 ret = parse_mtd_partitions(mtd, types, parser_data);
2989 + if (ret == -EPROBE_DEFER)
2990 + goto out;
2991 +
2992 if (ret > 0)
2993 ret = 0;
2994 else if (nr_parts)
2995 diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
2996 index e9ad8bb82f443..0f3c09fb9c34f 100644
2997 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
2998 +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
2999 @@ -2364,6 +2364,12 @@ static int brcmnand_attach_chip(struct nand_chip *chip)
3000
3001 ret = brcmstb_choose_ecc_layout(host);
3002
3003 + /* If OOB is written with ECC enabled it will cause ECC errors */
3004 + if (is_hamming_ecc(host->ctrl, &host->hwcfg)) {
3005 + chip->ecc.write_oob = brcmnand_write_oob_raw;
3006 + chip->ecc.read_oob = brcmnand_read_oob_raw;
3007 + }
3008 +
3009 return ret;
3010 }
3011
3012 diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
3013 index a6964feeec77d..81e4b0f466623 100644
3014 --- a/drivers/mtd/nand/raw/fsmc_nand.c
3015 +++ b/drivers/mtd/nand/raw/fsmc_nand.c
3016 @@ -1066,11 +1066,13 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
3017 host->read_dma_chan = dma_request_channel(mask, filter, NULL);
3018 if (!host->read_dma_chan) {
3019 dev_err(&pdev->dev, "Unable to get read dma channel\n");
3020 + ret = -ENODEV;
3021 goto disable_clk;
3022 }
3023 host->write_dma_chan = dma_request_channel(mask, filter, NULL);
3024 if (!host->write_dma_chan) {
3025 dev_err(&pdev->dev, "Unable to get write dma channel\n");
3026 + ret = -ENODEV;
3027 goto release_dma_read_chan;
3028 }
3029 }
3030 diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
3031 index 2390ed077a2fc..60f146920b9f4 100644
3032 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
3033 +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
3034 @@ -2598,7 +2598,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
3035 this->bch_geometry.auxiliary_size = 128;
3036 ret = gpmi_alloc_dma_buffer(this);
3037 if (ret)
3038 - goto err_out;
3039 + return ret;
3040
3041 nand_controller_init(&this->base);
3042 this->base.ops = &gpmi_nand_controller_ops;
3043 diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
3044 index 963ebcdfcbce3..c10995ca624a6 100644
3045 --- a/drivers/mtd/nand/raw/qcom_nandc.c
3046 +++ b/drivers/mtd/nand/raw/qcom_nandc.c
3047 @@ -2850,7 +2850,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
3048 struct device *dev = nandc->dev;
3049 struct device_node *dn = dev->of_node, *child;
3050 struct qcom_nand_host *host;
3051 - int ret;
3052 + int ret = -ENODEV;
3053
3054 for_each_available_child_of_node(dn, child) {
3055 host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
3056 @@ -2868,10 +2868,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
3057 list_add_tail(&host->node, &nandc->host_list);
3058 }
3059
3060 - if (list_empty(&nandc->host_list))
3061 - return -ENODEV;
3062 -
3063 - return 0;
3064 + return ret;
3065 }
3066
3067 /* parse custom DT properties here */
3068 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
3069 index 5a7831a97a132..588389697cf91 100644
3070 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
3071 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
3072 @@ -1728,12 +1728,14 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
3073
3074 cons = rxcmp->rx_cmp_opaque;
3075 if (unlikely(cons != rxr->rx_next_cons)) {
3076 - int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp);
3077 + int rc1 = bnxt_discard_rx(bp, cpr, &tmp_raw_cons, rxcmp);
3078
3079 netdev_warn(bp->dev, "RX cons %x != expected cons %x\n",
3080 cons, rxr->rx_next_cons);
3081 bnxt_sched_reset(bp, rxr);
3082 - return rc1;
3083 + if (rc1)
3084 + return rc1;
3085 + goto next_rx_no_prod_no_len;
3086 }
3087 rx_buf = &rxr->rx_buf_ring[cons];
3088 data = rx_buf->data;
3089 @@ -8954,7 +8956,9 @@ static ssize_t bnxt_show_temp(struct device *dev,
3090 if (!rc)
3091 len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */
3092 mutex_unlock(&bp->hwrm_cmd_lock);
3093 - return rc ?: len;
3094 + if (rc)
3095 + return rc;
3096 + return len;
3097 }
3098 static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
3099
3100 diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h
3101 index e6d4ad99cc387..3f1c189646f4e 100644
3102 --- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h
3103 +++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h
3104 @@ -521,7 +521,7 @@
3105 #define CN23XX_BAR1_INDEX_OFFSET 3
3106
3107 #define CN23XX_PEM_BAR1_INDEX_REG(port, idx) \
3108 - (CN23XX_PEM_BAR1_INDEX_START + ((port) << CN23XX_PEM_OFFSET) + \
3109 + (CN23XX_PEM_BAR1_INDEX_START + (((u64)port) << CN23XX_PEM_OFFSET) + \
3110 ((idx) << CN23XX_BAR1_INDEX_OFFSET))
3111
3112 /*############################ DPI #########################*/
3113 diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
3114 index 4ab57d33a87e4..6bd6fb5a3613e 100644
3115 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
3116 +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
3117 @@ -776,7 +776,7 @@ static void nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs,
3118 mbx.rq.msg = NIC_MBOX_MSG_RQ_CFG;
3119 mbx.rq.qs_num = qs->vnic_id;
3120 mbx.rq.rq_num = qidx;
3121 - mbx.rq.cfg = (rq->caching << 26) | (rq->cq_qs << 19) |
3122 + mbx.rq.cfg = ((u64)rq->caching << 26) | (rq->cq_qs << 19) |
3123 (rq->cq_idx << 16) | (rq->cont_rbdr_qs << 9) |
3124 (rq->cont_qs_rbdr_idx << 8) |
3125 (rq->start_rbdr_qs << 1) | (rq->start_qs_rbdr_idx);
3126 diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
3127 index cb50b41cd3df2..64a2453e06ba1 100644
3128 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
3129 +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
3130 @@ -174,31 +174,31 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f,
3131 WORD_MASK, f->fs.nat_lip[15] |
3132 f->fs.nat_lip[14] << 8 |
3133 f->fs.nat_lip[13] << 16 |
3134 - f->fs.nat_lip[12] << 24, 1);
3135 + (u64)f->fs.nat_lip[12] << 24, 1);
3136
3137 set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W + 1,
3138 WORD_MASK, f->fs.nat_lip[11] |
3139 f->fs.nat_lip[10] << 8 |
3140 f->fs.nat_lip[9] << 16 |
3141 - f->fs.nat_lip[8] << 24, 1);
3142 + (u64)f->fs.nat_lip[8] << 24, 1);
3143
3144 set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W + 2,
3145 WORD_MASK, f->fs.nat_lip[7] |
3146 f->fs.nat_lip[6] << 8 |
3147 f->fs.nat_lip[5] << 16 |
3148 - f->fs.nat_lip[4] << 24, 1);
3149 + (u64)f->fs.nat_lip[4] << 24, 1);
3150
3151 set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W + 3,
3152 WORD_MASK, f->fs.nat_lip[3] |
3153 f->fs.nat_lip[2] << 8 |
3154 f->fs.nat_lip[1] << 16 |
3155 - f->fs.nat_lip[0] << 24, 1);
3156 + (u64)f->fs.nat_lip[0] << 24, 1);
3157 } else {
3158 set_tcb_field(adap, f, tid, TCB_RX_FRAG3_LEN_RAW_W,
3159 WORD_MASK, f->fs.nat_lip[3] |
3160 f->fs.nat_lip[2] << 8 |
3161 f->fs.nat_lip[1] << 16 |
3162 - f->fs.nat_lip[0] << 24, 1);
3163 + (u64)f->fs.nat_lip[0] << 25, 1);
3164 }
3165 }
3166
3167 @@ -208,25 +208,25 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f,
3168 WORD_MASK, f->fs.nat_fip[15] |
3169 f->fs.nat_fip[14] << 8 |
3170 f->fs.nat_fip[13] << 16 |
3171 - f->fs.nat_fip[12] << 24, 1);
3172 + (u64)f->fs.nat_fip[12] << 24, 1);
3173
3174 set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W + 1,
3175 WORD_MASK, f->fs.nat_fip[11] |
3176 f->fs.nat_fip[10] << 8 |
3177 f->fs.nat_fip[9] << 16 |
3178 - f->fs.nat_fip[8] << 24, 1);
3179 + (u64)f->fs.nat_fip[8] << 24, 1);
3180
3181 set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W + 2,
3182 WORD_MASK, f->fs.nat_fip[7] |
3183 f->fs.nat_fip[6] << 8 |
3184 f->fs.nat_fip[5] << 16 |
3185 - f->fs.nat_fip[4] << 24, 1);
3186 + (u64)f->fs.nat_fip[4] << 24, 1);
3187
3188 set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W + 3,
3189 WORD_MASK, f->fs.nat_fip[3] |
3190 f->fs.nat_fip[2] << 8 |
3191 f->fs.nat_fip[1] << 16 |
3192 - f->fs.nat_fip[0] << 24, 1);
3193 + (u64)f->fs.nat_fip[0] << 24, 1);
3194
3195 } else {
3196 set_tcb_field(adap, f, tid,
3197 @@ -234,13 +234,13 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f,
3198 WORD_MASK, f->fs.nat_fip[3] |
3199 f->fs.nat_fip[2] << 8 |
3200 f->fs.nat_fip[1] << 16 |
3201 - f->fs.nat_fip[0] << 24, 1);
3202 + (u64)f->fs.nat_fip[0] << 24, 1);
3203 }
3204 }
3205
3206 set_tcb_field(adap, f, tid, TCB_PDU_HDR_LEN_W, WORD_MASK,
3207 (dp ? (nat_lp[1] | nat_lp[0] << 8) : 0) |
3208 - (sp ? (nat_fp[1] << 16 | nat_fp[0] << 24) : 0),
3209 + (sp ? (nat_fp[1] << 16 | (u64)nat_fp[0] << 24) : 0),
3210 1);
3211 }
3212
3213 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
3214 index 92af7204711c8..696f21543aa76 100644
3215 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
3216 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
3217 @@ -3322,7 +3322,6 @@ static void hns3_nic_set_cpumask(struct hns3_nic_priv *priv)
3218
3219 static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv)
3220 {
3221 - struct hnae3_ring_chain_node vector_ring_chain;
3222 struct hnae3_handle *h = priv->ae_handle;
3223 struct hns3_enet_tqp_vector *tqp_vector;
3224 int ret = 0;
3225 @@ -3354,6 +3353,8 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv)
3226 }
3227
3228 for (i = 0; i < priv->vector_num; i++) {
3229 + struct hnae3_ring_chain_node vector_ring_chain;
3230 +
3231 tqp_vector = &priv->tqp_vector[i];
3232
3233 tqp_vector->rx_group.total_bytes = 0;
3234 diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
3235 index bebe38d74d668..ab1b4da5d5be9 100644
3236 --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
3237 +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
3238 @@ -1439,6 +1439,7 @@ int emac_mac_tx_buf_send(struct emac_adapter *adpt, struct emac_tx_queue *tx_q,
3239 {
3240 struct emac_tpd tpd;
3241 u32 prod_idx;
3242 + int len;
3243
3244 memset(&tpd, 0, sizeof(tpd));
3245
3246 @@ -1458,9 +1459,10 @@ int emac_mac_tx_buf_send(struct emac_adapter *adpt, struct emac_tx_queue *tx_q,
3247 if (skb_network_offset(skb) != ETH_HLEN)
3248 TPD_TYP_SET(&tpd, 1);
3249
3250 + len = skb->len;
3251 emac_tx_fill_tpd(adpt, tx_q, skb, &tpd);
3252
3253 - netdev_sent_queue(adpt->netdev, skb->len);
3254 + netdev_sent_queue(adpt->netdev, len);
3255
3256 /* Make sure the are enough free descriptors to hold one
3257 * maximum-sized SKB. We need one desc for each fragment,
3258 diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
3259 index 551799fb3842d..9208a72fe17e5 100644
3260 --- a/drivers/net/ethernet/renesas/ravb_main.c
3261 +++ b/drivers/net/ethernet/renesas/ravb_main.c
3262 @@ -911,31 +911,20 @@ static int ravb_poll(struct napi_struct *napi, int budget)
3263 int q = napi - priv->napi;
3264 int mask = BIT(q);
3265 int quota = budget;
3266 - u32 ris0, tis;
3267
3268 - for (;;) {
3269 - tis = ravb_read(ndev, TIS);
3270 - ris0 = ravb_read(ndev, RIS0);
3271 - if (!((ris0 & mask) || (tis & mask)))
3272 - break;
3273 + /* Processing RX Descriptor Ring */
3274 + /* Clear RX interrupt */
3275 + ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
3276 + if (ravb_rx(ndev, &quota, q))
3277 + goto out;
3278
3279 - /* Processing RX Descriptor Ring */
3280 - if (ris0 & mask) {
3281 - /* Clear RX interrupt */
3282 - ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
3283 - if (ravb_rx(ndev, &quota, q))
3284 - goto out;
3285 - }
3286 - /* Processing TX Descriptor Ring */
3287 - if (tis & mask) {
3288 - spin_lock_irqsave(&priv->lock, flags);
3289 - /* Clear TX interrupt */
3290 - ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
3291 - ravb_tx_free(ndev, q, true);
3292 - netif_wake_subqueue(ndev, q);
3293 - spin_unlock_irqrestore(&priv->lock, flags);
3294 - }
3295 - }
3296 + /* Processing RX Descriptor Ring */
3297 + spin_lock_irqsave(&priv->lock, flags);
3298 + /* Clear TX interrupt */
3299 + ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
3300 + ravb_tx_free(ndev, q, true);
3301 + netif_wake_subqueue(ndev, q);
3302 + spin_unlock_irqrestore(&priv->lock, flags);
3303
3304 napi_complete(napi);
3305
3306 diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
3307 index ae27be85e3635..7cc09a6f9f9ae 100644
3308 --- a/drivers/net/ethernet/ti/davinci_emac.c
3309 +++ b/drivers/net/ethernet/ti/davinci_emac.c
3310 @@ -169,11 +169,11 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";
3311 /* EMAC mac_status register */
3312 #define EMAC_MACSTATUS_TXERRCODE_MASK (0xF00000)
3313 #define EMAC_MACSTATUS_TXERRCODE_SHIFT (20)
3314 -#define EMAC_MACSTATUS_TXERRCH_MASK (0x7)
3315 +#define EMAC_MACSTATUS_TXERRCH_MASK (0x70000)
3316 #define EMAC_MACSTATUS_TXERRCH_SHIFT (16)
3317 #define EMAC_MACSTATUS_RXERRCODE_MASK (0xF000)
3318 #define EMAC_MACSTATUS_RXERRCODE_SHIFT (12)
3319 -#define EMAC_MACSTATUS_RXERRCH_MASK (0x7)
3320 +#define EMAC_MACSTATUS_RXERRCH_MASK (0x700)
3321 #define EMAC_MACSTATUS_RXERRCH_SHIFT (8)
3322
3323 /* EMAC RX register masks */
3324 diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
3325 index 56b7791911bfc..c866f58dab709 100644
3326 --- a/drivers/net/fddi/defxx.c
3327 +++ b/drivers/net/fddi/defxx.c
3328 @@ -495,6 +495,25 @@ static const struct net_device_ops dfx_netdev_ops = {
3329 .ndo_set_mac_address = dfx_ctl_set_mac_address,
3330 };
3331
3332 +static void dfx_register_res_alloc_err(const char *print_name, bool mmio,
3333 + bool eisa)
3334 +{
3335 + pr_err("%s: Cannot use %s, no address set, aborting\n",
3336 + print_name, mmio ? "MMIO" : "I/O");
3337 + pr_err("%s: Recompile driver with \"CONFIG_DEFXX_MMIO=%c\"\n",
3338 + print_name, mmio ? 'n' : 'y');
3339 + if (eisa && mmio)
3340 + pr_err("%s: Or run ECU and set adapter's MMIO location\n",
3341 + print_name);
3342 +}
3343 +
3344 +static void dfx_register_res_err(const char *print_name, bool mmio,
3345 + unsigned long start, unsigned long len)
3346 +{
3347 + pr_err("%s: Cannot reserve %s resource 0x%lx @ 0x%lx, aborting\n",
3348 + print_name, mmio ? "MMIO" : "I/O", len, start);
3349 +}
3350 +
3351 /*
3352 * ================
3353 * = dfx_register =
3354 @@ -568,15 +587,12 @@ static int dfx_register(struct device *bdev)
3355 dev_set_drvdata(bdev, dev);
3356
3357 dfx_get_bars(bdev, bar_start, bar_len);
3358 - if (dfx_bus_eisa && dfx_use_mmio && bar_start[0] == 0) {
3359 - pr_err("%s: Cannot use MMIO, no address set, aborting\n",
3360 - print_name);
3361 - pr_err("%s: Run ECU and set adapter's MMIO location\n",
3362 - print_name);
3363 - pr_err("%s: Or recompile driver with \"CONFIG_DEFXX_MMIO=n\""
3364 - "\n", print_name);
3365 + if (bar_len[0] == 0 ||
3366 + (dfx_bus_eisa && dfx_use_mmio && bar_start[0] == 0)) {
3367 + dfx_register_res_alloc_err(print_name, dfx_use_mmio,
3368 + dfx_bus_eisa);
3369 err = -ENXIO;
3370 - goto err_out;
3371 + goto err_out_disable;
3372 }
3373
3374 if (dfx_use_mmio)
3375 @@ -585,18 +601,16 @@ static int dfx_register(struct device *bdev)
3376 else
3377 region = request_region(bar_start[0], bar_len[0], print_name);
3378 if (!region) {
3379 - pr_err("%s: Cannot reserve %s resource 0x%lx @ 0x%lx, "
3380 - "aborting\n", dfx_use_mmio ? "MMIO" : "I/O", print_name,
3381 - (long)bar_len[0], (long)bar_start[0]);
3382 + dfx_register_res_err(print_name, dfx_use_mmio,
3383 + bar_start[0], bar_len[0]);
3384 err = -EBUSY;
3385 goto err_out_disable;
3386 }
3387 if (bar_start[1] != 0) {
3388 region = request_region(bar_start[1], bar_len[1], print_name);
3389 if (!region) {
3390 - pr_err("%s: Cannot reserve I/O resource "
3391 - "0x%lx @ 0x%lx, aborting\n", print_name,
3392 - (long)bar_len[1], (long)bar_start[1]);
3393 + dfx_register_res_err(print_name, 0,
3394 + bar_start[1], bar_len[1]);
3395 err = -EBUSY;
3396 goto err_out_csr_region;
3397 }
3398 @@ -604,9 +618,8 @@ static int dfx_register(struct device *bdev)
3399 if (bar_start[2] != 0) {
3400 region = request_region(bar_start[2], bar_len[2], print_name);
3401 if (!region) {
3402 - pr_err("%s: Cannot reserve I/O resource "
3403 - "0x%lx @ 0x%lx, aborting\n", print_name,
3404 - (long)bar_len[2], (long)bar_start[2]);
3405 + dfx_register_res_err(print_name, 0,
3406 + bar_start[2], bar_len[2]);
3407 err = -EBUSY;
3408 goto err_out_bh_region;
3409 }
3410 diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
3411 index c33a08d65208c..84f5717c01e2a 100644
3412 --- a/drivers/net/geneve.c
3413 +++ b/drivers/net/geneve.c
3414 @@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
3415 __be16 sport;
3416 int err;
3417
3418 - if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
3419 + if (!pskb_inet_may_pull(skb))
3420 return -EINVAL;
3421
3422 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
3423 @@ -957,7 +957,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
3424 __be16 sport;
3425 int err;
3426
3427 - if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
3428 + if (!pskb_inet_may_pull(skb))
3429 return -EINVAL;
3430
3431 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
3432 diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c
3433 index b7875b36097fe..574a8bca1ec46 100644
3434 --- a/drivers/net/phy/intel-xway.c
3435 +++ b/drivers/net/phy/intel-xway.c
3436 @@ -11,6 +11,18 @@
3437
3438 #define XWAY_MDIO_IMASK 0x19 /* interrupt mask */
3439 #define XWAY_MDIO_ISTAT 0x1A /* interrupt status */
3440 +#define XWAY_MDIO_LED 0x1B /* led control */
3441 +
3442 +/* bit 15:12 are reserved */
3443 +#define XWAY_MDIO_LED_LED3_EN BIT(11) /* Enable the integrated function of LED3 */
3444 +#define XWAY_MDIO_LED_LED2_EN BIT(10) /* Enable the integrated function of LED2 */
3445 +#define XWAY_MDIO_LED_LED1_EN BIT(9) /* Enable the integrated function of LED1 */
3446 +#define XWAY_MDIO_LED_LED0_EN BIT(8) /* Enable the integrated function of LED0 */
3447 +/* bit 7:4 are reserved */
3448 +#define XWAY_MDIO_LED_LED3_DA BIT(3) /* Direct Access to LED3 */
3449 +#define XWAY_MDIO_LED_LED2_DA BIT(2) /* Direct Access to LED2 */
3450 +#define XWAY_MDIO_LED_LED1_DA BIT(1) /* Direct Access to LED1 */
3451 +#define XWAY_MDIO_LED_LED0_DA BIT(0) /* Direct Access to LED0 */
3452
3453 #define XWAY_MDIO_INIT_WOL BIT(15) /* Wake-On-LAN */
3454 #define XWAY_MDIO_INIT_MSRE BIT(14)
3455 @@ -159,6 +171,15 @@ static int xway_gphy_config_init(struct phy_device *phydev)
3456 /* Clear all pending interrupts */
3457 phy_read(phydev, XWAY_MDIO_ISTAT);
3458
3459 + /* Ensure that integrated led function is enabled for all leds */
3460 + err = phy_write(phydev, XWAY_MDIO_LED,
3461 + XWAY_MDIO_LED_LED0_EN |
3462 + XWAY_MDIO_LED_LED1_EN |
3463 + XWAY_MDIO_LED_LED2_EN |
3464 + XWAY_MDIO_LED_LED3_EN);
3465 + if (err)
3466 + return err;
3467 +
3468 phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDCH,
3469 XWAY_MMD_LEDCH_NACS_NONE |
3470 XWAY_MMD_LEDCH_SBF_F02HZ |
3471 diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
3472 index 60f357d2f79fa..4e42954d8cbf0 100644
3473 --- a/drivers/net/wan/lapbether.c
3474 +++ b/drivers/net/wan/lapbether.c
3475 @@ -51,6 +51,8 @@ struct lapbethdev {
3476 struct list_head node;
3477 struct net_device *ethdev; /* link to ethernet device */
3478 struct net_device *axdev; /* lapbeth device (lapb#) */
3479 + bool up;
3480 + spinlock_t up_lock; /* Protects "up" */
3481 };
3482
3483 static LIST_HEAD(lapbeth_devices);
3484 @@ -98,8 +100,9 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
3485 rcu_read_lock();
3486 lapbeth = lapbeth_get_x25_dev(dev);
3487 if (!lapbeth)
3488 - goto drop_unlock;
3489 - if (!netif_running(lapbeth->axdev))
3490 + goto drop_unlock_rcu;
3491 + spin_lock_bh(&lapbeth->up_lock);
3492 + if (!lapbeth->up)
3493 goto drop_unlock;
3494
3495 len = skb->data[0] + skb->data[1] * 256;
3496 @@ -114,11 +117,14 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
3497 goto drop_unlock;
3498 }
3499 out:
3500 + spin_unlock_bh(&lapbeth->up_lock);
3501 rcu_read_unlock();
3502 return 0;
3503 drop_unlock:
3504 kfree_skb(skb);
3505 goto out;
3506 +drop_unlock_rcu:
3507 + rcu_read_unlock();
3508 drop:
3509 kfree_skb(skb);
3510 return 0;
3511 @@ -148,13 +154,11 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
3512 static netdev_tx_t lapbeth_xmit(struct sk_buff *skb,
3513 struct net_device *dev)
3514 {
3515 + struct lapbethdev *lapbeth = netdev_priv(dev);
3516 int err;
3517
3518 - /*
3519 - * Just to be *really* sure not to send anything if the interface
3520 - * is down, the ethernet device may have gone.
3521 - */
3522 - if (!netif_running(dev))
3523 + spin_lock_bh(&lapbeth->up_lock);
3524 + if (!lapbeth->up)
3525 goto drop;
3526
3527 /* There should be a pseudo header of 1 byte added by upper layers.
3528 @@ -185,6 +189,7 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb,
3529 goto drop;
3530 }
3531 out:
3532 + spin_unlock_bh(&lapbeth->up_lock);
3533 return NETDEV_TX_OK;
3534 drop:
3535 kfree_skb(skb);
3536 @@ -276,6 +281,7 @@ static const struct lapb_register_struct lapbeth_callbacks = {
3537 */
3538 static int lapbeth_open(struct net_device *dev)
3539 {
3540 + struct lapbethdev *lapbeth = netdev_priv(dev);
3541 int err;
3542
3543 if ((err = lapb_register(dev, &lapbeth_callbacks)) != LAPB_OK) {
3544 @@ -283,13 +289,22 @@ static int lapbeth_open(struct net_device *dev)
3545 return -ENODEV;
3546 }
3547
3548 + spin_lock_bh(&lapbeth->up_lock);
3549 + lapbeth->up = true;
3550 + spin_unlock_bh(&lapbeth->up_lock);
3551 +
3552 return 0;
3553 }
3554
3555 static int lapbeth_close(struct net_device *dev)
3556 {
3557 + struct lapbethdev *lapbeth = netdev_priv(dev);
3558 int err;
3559
3560 + spin_lock_bh(&lapbeth->up_lock);
3561 + lapbeth->up = false;
3562 + spin_unlock_bh(&lapbeth->up_lock);
3563 +
3564 if ((err = lapb_unregister(dev)) != LAPB_OK)
3565 pr_err("lapb_unregister error: %d\n", err);
3566
3567 @@ -347,6 +362,9 @@ static int lapbeth_new_device(struct net_device *dev)
3568 dev_hold(dev);
3569 lapbeth->ethdev = dev;
3570
3571 + lapbeth->up = false;
3572 + spin_lock_init(&lapbeth->up_lock);
3573 +
3574 rc = -EIO;
3575 if (register_netdevice(ndev))
3576 goto fail;
3577 diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
3578 index d38276ac375e9..315d20f5c8eb1 100644
3579 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
3580 +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
3581 @@ -461,6 +461,9 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb)
3582 GFP_ATOMIC
3583 );
3584 break;
3585 + default:
3586 + kfree(tb);
3587 + return;
3588 }
3589
3590 exit:
3591 diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
3592 index 40a065028ebec..11054c17a9b54 100644
3593 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
3594 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
3595 @@ -246,7 +246,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)
3596 if (unlikely(r)) {
3597 ath_dbg(common, WMI, "REGISTER READ FAILED: (0x%04x, %d)\n",
3598 reg_offset, r);
3599 - return -EIO;
3600 + return -1;
3601 }
3602
3603 return be32_to_cpu(val);
3604 diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
3605 index 052deffb4c9d4..9fd8e64288ffa 100644
3606 --- a/drivers/net/wireless/ath/ath9k/hw.c
3607 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3608 @@ -287,7 +287,7 @@ static bool ath9k_hw_read_revisions(struct ath_hw *ah)
3609
3610 srev = REG_READ(ah, AR_SREV);
3611
3612 - if (srev == -EIO) {
3613 + if (srev == -1) {
3614 ath_err(ath9k_hw_common(ah),
3615 "Failed to read SREV register");
3616 return false;
3617 diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_wx.c b/drivers/net/wireless/intel/ipw2x00/libipw_wx.c
3618 index 3d558b47168b4..456330296b737 100644
3619 --- a/drivers/net/wireless/intel/ipw2x00/libipw_wx.c
3620 +++ b/drivers/net/wireless/intel/ipw2x00/libipw_wx.c
3621 @@ -633,8 +633,10 @@ int libipw_wx_set_encodeext(struct libipw_device *ieee,
3622 }
3623
3624 if (ext->alg != IW_ENCODE_ALG_NONE) {
3625 - memcpy(sec.keys[idx], ext->key, ext->key_len);
3626 - sec.key_sizes[idx] = ext->key_len;
3627 + int key_len = clamp_val(ext->key_len, 0, SCM_KEY_LEN);
3628 +
3629 + memcpy(sec.keys[idx], ext->key, key_len);
3630 + sec.key_sizes[idx] = key_len;
3631 sec.flags |= (1 << idx);
3632 if (ext->alg == IW_ENCODE_ALG_WEP) {
3633 sec.encode_alg[idx] = SEC_ALG_WEP;
3634 diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c
3635 index c4db6417748f3..1b76b24191866 100644
3636 --- a/drivers/net/wireless/marvell/mwl8k.c
3637 +++ b/drivers/net/wireless/marvell/mwl8k.c
3638 @@ -1469,6 +1469,7 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index)
3639 txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL);
3640 if (txq->skb == NULL) {
3641 pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma);
3642 + txq->txd = NULL;
3643 return -ENOMEM;
3644 }
3645
3646 diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
3647 index c868582c5d225..aa3b64902cf9b 100644
3648 --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
3649 +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
3650 @@ -99,7 +99,7 @@ mt7601u_has_tssi(struct mt7601u_dev *dev, u8 *eeprom)
3651 {
3652 u16 nic_conf1 = get_unaligned_le16(eeprom + MT_EE_NIC_CONF_1);
3653
3654 - return ~nic_conf1 && (nic_conf1 & MT_EE_NIC_CONF_1_TX_ALC_EN);
3655 + return (u16)~nic_conf1 && (nic_conf1 & MT_EE_NIC_CONF_1_TX_ALC_EN);
3656 }
3657
3658 static void
3659 diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c
3660 index 85093b3e53733..ed72a2aeb6c8e 100644
3661 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c
3662 +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c
3663 @@ -249,7 +249,7 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = {
3664 0x824, 0x00030FE0,
3665 0x828, 0x00000000,
3666 0x82C, 0x002081DD,
3667 - 0x830, 0x2AAA8E24,
3668 + 0x830, 0x2AAAEEC8,
3669 0x834, 0x0037A706,
3670 0x838, 0x06489B44,
3671 0x83C, 0x0000095B,
3672 @@ -324,10 +324,10 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = {
3673 0x9D8, 0x00000000,
3674 0x9DC, 0x00000000,
3675 0x9E0, 0x00005D00,
3676 - 0x9E4, 0x00000002,
3677 + 0x9E4, 0x00000003,
3678 0x9E8, 0x00000001,
3679 0xA00, 0x00D047C8,
3680 - 0xA04, 0x01FF000C,
3681 + 0xA04, 0x01FF800C,
3682 0xA08, 0x8C8A8300,
3683 0xA0C, 0x2E68000F,
3684 0xA10, 0x9500BB78,
3685 @@ -1320,7 +1320,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3686 0x083, 0x00021800,
3687 0x084, 0x00028000,
3688 0x085, 0x00048000,
3689 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3690 + 0x086, 0x0009483A,
3691 + 0xA0000000, 0x00000000,
3692 0x086, 0x00094838,
3693 + 0xB0000000, 0x00000000,
3694 0x087, 0x00044980,
3695 0x088, 0x00048000,
3696 0x089, 0x0000D480,
3697 @@ -1409,36 +1413,32 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3698 0x03C, 0x000CA000,
3699 0x0EF, 0x00000000,
3700 0x0EF, 0x00001100,
3701 - 0xFF0F0104, 0xABCD,
3702 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3703 0x034, 0x0004ADF3,
3704 0x034, 0x00049DF0,
3705 - 0xFF0F0204, 0xCDEF,
3706 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
3707 0x034, 0x0004ADF3,
3708 0x034, 0x00049DF0,
3709 - 0xFF0F0404, 0xCDEF,
3710 - 0x034, 0x0004ADF3,
3711 - 0x034, 0x00049DF0,
3712 - 0xFF0F0200, 0xCDEF,
3713 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
3714 0x034, 0x0004ADF5,
3715 0x034, 0x00049DF2,
3716 - 0xFF0F02C0, 0xCDEF,
3717 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
3718 + 0x034, 0x0004A0F3,
3719 + 0x034, 0x000490B1,
3720 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3721 0x034, 0x0004A0F3,
3722 0x034, 0x000490B1,
3723 - 0xCDCDCDCD, 0xCDCD,
3724 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
3725 + 0x034, 0x0004ADF5,
3726 + 0x034, 0x00049DF2,
3727 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
3728 + 0x034, 0x0004ADF3,
3729 + 0x034, 0x00049DF0,
3730 + 0xA0000000, 0x00000000,
3731 0x034, 0x0004ADF7,
3732 0x034, 0x00049DF3,
3733 - 0xFF0F0104, 0xDEAD,
3734 - 0xFF0F0104, 0xABCD,
3735 - 0x034, 0x00048DED,
3736 - 0x034, 0x00047DEA,
3737 - 0x034, 0x00046DE7,
3738 - 0x034, 0x00045CE9,
3739 - 0x034, 0x00044CE6,
3740 - 0x034, 0x000438C6,
3741 - 0x034, 0x00042886,
3742 - 0x034, 0x00041486,
3743 - 0x034, 0x00040447,
3744 - 0xFF0F0204, 0xCDEF,
3745 + 0xB0000000, 0x00000000,
3746 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3747 0x034, 0x00048DED,
3748 0x034, 0x00047DEA,
3749 0x034, 0x00046DE7,
3750 @@ -1448,7 +1448,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3751 0x034, 0x00042886,
3752 0x034, 0x00041486,
3753 0x034, 0x00040447,
3754 - 0xFF0F0404, 0xCDEF,
3755 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
3756 0x034, 0x00048DED,
3757 0x034, 0x00047DEA,
3758 0x034, 0x00046DE7,
3759 @@ -1458,7 +1458,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3760 0x034, 0x00042886,
3761 0x034, 0x00041486,
3762 0x034, 0x00040447,
3763 - 0xFF0F02C0, 0xCDEF,
3764 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
3765 + 0x034, 0x000480AE,
3766 + 0x034, 0x000470AB,
3767 + 0x034, 0x0004608B,
3768 + 0x034, 0x00045069,
3769 + 0x034, 0x00044048,
3770 + 0x034, 0x00043045,
3771 + 0x034, 0x00042026,
3772 + 0x034, 0x00041023,
3773 + 0x034, 0x00040002,
3774 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3775 0x034, 0x000480AE,
3776 0x034, 0x000470AB,
3777 0x034, 0x0004608B,
3778 @@ -1468,7 +1478,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3779 0x034, 0x00042026,
3780 0x034, 0x00041023,
3781 0x034, 0x00040002,
3782 - 0xCDCDCDCD, 0xCDCD,
3783 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
3784 + 0x034, 0x00048DED,
3785 + 0x034, 0x00047DEA,
3786 + 0x034, 0x00046DE7,
3787 + 0x034, 0x00045CE9,
3788 + 0x034, 0x00044CE6,
3789 + 0x034, 0x000438C6,
3790 + 0x034, 0x00042886,
3791 + 0x034, 0x00041486,
3792 + 0x034, 0x00040447,
3793 + 0xA0000000, 0x00000000,
3794 0x034, 0x00048DEF,
3795 0x034, 0x00047DEC,
3796 0x034, 0x00046DE9,
3797 @@ -1478,38 +1498,36 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3798 0x034, 0x0004248A,
3799 0x034, 0x0004108D,
3800 0x034, 0x0004008A,
3801 - 0xFF0F0104, 0xDEAD,
3802 - 0xFF0F0200, 0xABCD,
3803 + 0xB0000000, 0x00000000,
3804 + 0x80000210, 0x00000000, 0x40000000, 0x00000000,
3805 0x034, 0x0002ADF4,
3806 - 0xFF0F02C0, 0xCDEF,
3807 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
3808 + 0x034, 0x0002A0F3,
3809 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3810 0x034, 0x0002A0F3,
3811 - 0xCDCDCDCD, 0xCDCD,
3812 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
3813 + 0x034, 0x0002ADF4,
3814 + 0xA0000000, 0x00000000,
3815 0x034, 0x0002ADF7,
3816 - 0xFF0F0200, 0xDEAD,
3817 - 0xFF0F0104, 0xABCD,
3818 - 0x034, 0x00029DF4,
3819 - 0xFF0F0204, 0xCDEF,
3820 + 0xB0000000, 0x00000000,
3821 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3822 0x034, 0x00029DF4,
3823 - 0xFF0F0404, 0xCDEF,
3824 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
3825 0x034, 0x00029DF4,
3826 - 0xFF0F0200, 0xCDEF,
3827 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
3828 0x034, 0x00029DF1,
3829 - 0xFF0F02C0, 0xCDEF,
3830 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
3831 + 0x034, 0x000290F0,
3832 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3833 0x034, 0x000290F0,
3834 - 0xCDCDCDCD, 0xCDCD,
3835 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
3836 + 0x034, 0x00029DF1,
3837 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
3838 + 0x034, 0x00029DF4,
3839 + 0xA0000000, 0x00000000,
3840 0x034, 0x00029DF2,
3841 - 0xFF0F0104, 0xDEAD,
3842 - 0xFF0F0104, 0xABCD,
3843 - 0x034, 0x00028DF1,
3844 - 0x034, 0x00027DEE,
3845 - 0x034, 0x00026DEB,
3846 - 0x034, 0x00025CEC,
3847 - 0x034, 0x00024CE9,
3848 - 0x034, 0x000238CA,
3849 - 0x034, 0x00022889,
3850 - 0x034, 0x00021489,
3851 - 0x034, 0x0002044A,
3852 - 0xFF0F0204, 0xCDEF,
3853 + 0xB0000000, 0x00000000,
3854 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3855 0x034, 0x00028DF1,
3856 0x034, 0x00027DEE,
3857 0x034, 0x00026DEB,
3858 @@ -1519,7 +1537,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3859 0x034, 0x00022889,
3860 0x034, 0x00021489,
3861 0x034, 0x0002044A,
3862 - 0xFF0F0404, 0xCDEF,
3863 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
3864 0x034, 0x00028DF1,
3865 0x034, 0x00027DEE,
3866 0x034, 0x00026DEB,
3867 @@ -1529,7 +1547,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3868 0x034, 0x00022889,
3869 0x034, 0x00021489,
3870 0x034, 0x0002044A,
3871 - 0xFF0F02C0, 0xCDEF,
3872 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
3873 0x034, 0x000280AF,
3874 0x034, 0x000270AC,
3875 0x034, 0x0002608B,
3876 @@ -1539,7 +1557,27 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3877 0x034, 0x00022026,
3878 0x034, 0x00021023,
3879 0x034, 0x00020002,
3880 - 0xCDCDCDCD, 0xCDCD,
3881 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3882 + 0x034, 0x000280AF,
3883 + 0x034, 0x000270AC,
3884 + 0x034, 0x0002608B,
3885 + 0x034, 0x00025069,
3886 + 0x034, 0x00024048,
3887 + 0x034, 0x00023045,
3888 + 0x034, 0x00022026,
3889 + 0x034, 0x00021023,
3890 + 0x034, 0x00020002,
3891 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
3892 + 0x034, 0x00028DF1,
3893 + 0x034, 0x00027DEE,
3894 + 0x034, 0x00026DEB,
3895 + 0x034, 0x00025CEC,
3896 + 0x034, 0x00024CE9,
3897 + 0x034, 0x000238CA,
3898 + 0x034, 0x00022889,
3899 + 0x034, 0x00021489,
3900 + 0x034, 0x0002044A,
3901 + 0xA0000000, 0x00000000,
3902 0x034, 0x00028DEE,
3903 0x034, 0x00027DEB,
3904 0x034, 0x00026CCD,
3905 @@ -1549,27 +1587,24 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3906 0x034, 0x00022849,
3907 0x034, 0x00021449,
3908 0x034, 0x0002004D,
3909 - 0xFF0F0104, 0xDEAD,
3910 - 0xFF0F02C0, 0xABCD,
3911 + 0xB0000000, 0x00000000,
3912 + 0x8000020c, 0x00000000, 0x40000000, 0x00000000,
3913 + 0x034, 0x0000A0D7,
3914 + 0x034, 0x000090D3,
3915 + 0x034, 0x000080B1,
3916 + 0x034, 0x000070AE,
3917 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3918 0x034, 0x0000A0D7,
3919 0x034, 0x000090D3,
3920 0x034, 0x000080B1,
3921 0x034, 0x000070AE,
3922 - 0xCDCDCDCD, 0xCDCD,
3923 + 0xA0000000, 0x00000000,
3924 0x034, 0x0000ADF7,
3925 0x034, 0x00009DF4,
3926 0x034, 0x00008DF1,
3927 0x034, 0x00007DEE,
3928 - 0xFF0F02C0, 0xDEAD,
3929 - 0xFF0F0104, 0xABCD,
3930 - 0x034, 0x00006DEB,
3931 - 0x034, 0x00005CEC,
3932 - 0x034, 0x00004CE9,
3933 - 0x034, 0x000038CA,
3934 - 0x034, 0x00002889,
3935 - 0x034, 0x00001489,
3936 - 0x034, 0x0000044A,
3937 - 0xFF0F0204, 0xCDEF,
3938 + 0xB0000000, 0x00000000,
3939 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3940 0x034, 0x00006DEB,
3941 0x034, 0x00005CEC,
3942 0x034, 0x00004CE9,
3943 @@ -1577,7 +1612,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3944 0x034, 0x00002889,
3945 0x034, 0x00001489,
3946 0x034, 0x0000044A,
3947 - 0xFF0F0404, 0xCDEF,
3948 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
3949 0x034, 0x00006DEB,
3950 0x034, 0x00005CEC,
3951 0x034, 0x00004CE9,
3952 @@ -1585,7 +1620,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3953 0x034, 0x00002889,
3954 0x034, 0x00001489,
3955 0x034, 0x0000044A,
3956 - 0xFF0F02C0, 0xCDEF,
3957 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
3958 0x034, 0x0000608D,
3959 0x034, 0x0000506B,
3960 0x034, 0x0000404A,
3961 @@ -1593,7 +1628,23 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3962 0x034, 0x00002044,
3963 0x034, 0x00001025,
3964 0x034, 0x00000004,
3965 - 0xCDCDCDCD, 0xCDCD,
3966 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
3967 + 0x034, 0x0000608D,
3968 + 0x034, 0x0000506B,
3969 + 0x034, 0x0000404A,
3970 + 0x034, 0x00003047,
3971 + 0x034, 0x00002044,
3972 + 0x034, 0x00001025,
3973 + 0x034, 0x00000004,
3974 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
3975 + 0x034, 0x00006DEB,
3976 + 0x034, 0x00005CEC,
3977 + 0x034, 0x00004CE9,
3978 + 0x034, 0x000038CA,
3979 + 0x034, 0x00002889,
3980 + 0x034, 0x00001489,
3981 + 0x034, 0x0000044A,
3982 + 0xA0000000, 0x00000000,
3983 0x034, 0x00006DCD,
3984 0x034, 0x00005CCD,
3985 0x034, 0x00004CCA,
3986 @@ -1601,11 +1652,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
3987 0x034, 0x00002888,
3988 0x034, 0x00001488,
3989 0x034, 0x00000486,
3990 - 0xFF0F0104, 0xDEAD,
3991 + 0xB0000000, 0x00000000,
3992 0x0EF, 0x00000000,
3993 0x018, 0x0001712A,
3994 0x0EF, 0x00000040,
3995 - 0xFF0F0104, 0xABCD,
3996 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
3997 0x035, 0x00000187,
3998 0x035, 0x00008187,
3999 0x035, 0x00010187,
4000 @@ -1615,7 +1666,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4001 0x035, 0x00040188,
4002 0x035, 0x00048188,
4003 0x035, 0x00050188,
4004 - 0xFF0F0204, 0xCDEF,
4005 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4006 0x035, 0x00000187,
4007 0x035, 0x00008187,
4008 0x035, 0x00010187,
4009 @@ -1625,7 +1676,37 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4010 0x035, 0x00040188,
4011 0x035, 0x00048188,
4012 0x035, 0x00050188,
4013 - 0xFF0F0404, 0xCDEF,
4014 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4015 + 0x035, 0x00000128,
4016 + 0x035, 0x00008128,
4017 + 0x035, 0x00010128,
4018 + 0x035, 0x000201C8,
4019 + 0x035, 0x000281C8,
4020 + 0x035, 0x000301C8,
4021 + 0x035, 0x000401C8,
4022 + 0x035, 0x000481C8,
4023 + 0x035, 0x000501C8,
4024 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4025 + 0x035, 0x00000145,
4026 + 0x035, 0x00008145,
4027 + 0x035, 0x00010145,
4028 + 0x035, 0x00020196,
4029 + 0x035, 0x00028196,
4030 + 0x035, 0x00030196,
4031 + 0x035, 0x000401C7,
4032 + 0x035, 0x000481C7,
4033 + 0x035, 0x000501C7,
4034 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4035 + 0x035, 0x00000128,
4036 + 0x035, 0x00008128,
4037 + 0x035, 0x00010128,
4038 + 0x035, 0x000201C8,
4039 + 0x035, 0x000281C8,
4040 + 0x035, 0x000301C8,
4041 + 0x035, 0x000401C8,
4042 + 0x035, 0x000481C8,
4043 + 0x035, 0x000501C8,
4044 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4045 0x035, 0x00000187,
4046 0x035, 0x00008187,
4047 0x035, 0x00010187,
4048 @@ -1635,7 +1716,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4049 0x035, 0x00040188,
4050 0x035, 0x00048188,
4051 0x035, 0x00050188,
4052 - 0xCDCDCDCD, 0xCDCD,
4053 + 0xA0000000, 0x00000000,
4054 0x035, 0x00000145,
4055 0x035, 0x00008145,
4056 0x035, 0x00010145,
4057 @@ -1645,11 +1726,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4058 0x035, 0x000401C7,
4059 0x035, 0x000481C7,
4060 0x035, 0x000501C7,
4061 - 0xFF0F0104, 0xDEAD,
4062 + 0xB0000000, 0x00000000,
4063 0x0EF, 0x00000000,
4064 0x018, 0x0001712A,
4065 0x0EF, 0x00000010,
4066 - 0xFF0F0104, 0xABCD,
4067 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4068 0x036, 0x00085733,
4069 0x036, 0x0008D733,
4070 0x036, 0x00095733,
4071 @@ -1662,7 +1743,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4072 0x036, 0x000CE4B4,
4073 0x036, 0x000D64B4,
4074 0x036, 0x000DE4B4,
4075 - 0xFF0F0204, 0xCDEF,
4076 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4077 0x036, 0x00085733,
4078 0x036, 0x0008D733,
4079 0x036, 0x00095733,
4080 @@ -1675,7 +1756,46 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4081 0x036, 0x000CE4B4,
4082 0x036, 0x000D64B4,
4083 0x036, 0x000DE4B4,
4084 - 0xFF0F0404, 0xCDEF,
4085 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4086 + 0x036, 0x000063B5,
4087 + 0x036, 0x0000E3B5,
4088 + 0x036, 0x000163B5,
4089 + 0x036, 0x0001E3B5,
4090 + 0x036, 0x000263B5,
4091 + 0x036, 0x0002E3B5,
4092 + 0x036, 0x000363B5,
4093 + 0x036, 0x0003E3B5,
4094 + 0x036, 0x000463B5,
4095 + 0x036, 0x0004E3B5,
4096 + 0x036, 0x000563B5,
4097 + 0x036, 0x0005E3B5,
4098 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4099 + 0x036, 0x000056B3,
4100 + 0x036, 0x0000D6B3,
4101 + 0x036, 0x000156B3,
4102 + 0x036, 0x0001D6B3,
4103 + 0x036, 0x00026634,
4104 + 0x036, 0x0002E634,
4105 + 0x036, 0x00036634,
4106 + 0x036, 0x0003E634,
4107 + 0x036, 0x000467B4,
4108 + 0x036, 0x0004E7B4,
4109 + 0x036, 0x000567B4,
4110 + 0x036, 0x0005E7B4,
4111 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4112 + 0x036, 0x000063B5,
4113 + 0x036, 0x0000E3B5,
4114 + 0x036, 0x000163B5,
4115 + 0x036, 0x0001E3B5,
4116 + 0x036, 0x000263B5,
4117 + 0x036, 0x0002E3B5,
4118 + 0x036, 0x000363B5,
4119 + 0x036, 0x0003E3B5,
4120 + 0x036, 0x000463B5,
4121 + 0x036, 0x0004E3B5,
4122 + 0x036, 0x000563B5,
4123 + 0x036, 0x0005E3B5,
4124 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4125 0x036, 0x00085733,
4126 0x036, 0x0008D733,
4127 0x036, 0x00095733,
4128 @@ -1688,7 +1808,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4129 0x036, 0x000CE4B4,
4130 0x036, 0x000D64B4,
4131 0x036, 0x000DE4B4,
4132 - 0xCDCDCDCD, 0xCDCD,
4133 + 0xA0000000, 0x00000000,
4134 0x036, 0x000056B3,
4135 0x036, 0x0000D6B3,
4136 0x036, 0x000156B3,
4137 @@ -1701,103 +1821,162 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4138 0x036, 0x0004E7B4,
4139 0x036, 0x000567B4,
4140 0x036, 0x0005E7B4,
4141 - 0xFF0F0104, 0xDEAD,
4142 + 0xB0000000, 0x00000000,
4143 0x0EF, 0x00000000,
4144 0x0EF, 0x00000008,
4145 - 0xFF0F0104, 0xABCD,
4146 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4147 0x03C, 0x000001C8,
4148 0x03C, 0x00000492,
4149 - 0xFF0F0204, 0xCDEF,
4150 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4151 0x03C, 0x000001C8,
4152 0x03C, 0x00000492,
4153 - 0xFF0F0404, 0xCDEF,
4154 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4155 + 0x03C, 0x000001B6,
4156 + 0x03C, 0x00000492,
4157 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4158 + 0x03C, 0x0000022A,
4159 + 0x03C, 0x00000594,
4160 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4161 + 0x03C, 0x000001B6,
4162 + 0x03C, 0x00000492,
4163 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4164 0x03C, 0x000001C8,
4165 0x03C, 0x00000492,
4166 - 0xCDCDCDCD, 0xCDCD,
4167 + 0xA0000000, 0x00000000,
4168 0x03C, 0x0000022A,
4169 0x03C, 0x00000594,
4170 - 0xFF0F0104, 0xDEAD,
4171 - 0xFF0F0104, 0xABCD,
4172 + 0xB0000000, 0x00000000,
4173 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4174 0x03C, 0x00000800,
4175 - 0xFF0F0204, 0xCDEF,
4176 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4177 0x03C, 0x00000800,
4178 - 0xFF0F0404, 0xCDEF,
4179 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4180 0x03C, 0x00000800,
4181 - 0xFF0F02C0, 0xCDEF,
4182 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
4183 0x03C, 0x00000820,
4184 - 0xCDCDCDCD, 0xCDCD,
4185 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4186 + 0x03C, 0x00000820,
4187 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4188 + 0x03C, 0x00000800,
4189 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4190 + 0x03C, 0x00000800,
4191 + 0xA0000000, 0x00000000,
4192 0x03C, 0x00000900,
4193 - 0xFF0F0104, 0xDEAD,
4194 + 0xB0000000, 0x00000000,
4195 0x0EF, 0x00000000,
4196 0x018, 0x0001712A,
4197 0x0EF, 0x00000002,
4198 - 0xFF0F0104, 0xABCD,
4199 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4200 0x008, 0x0004E400,
4201 - 0xFF0F0204, 0xCDEF,
4202 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4203 0x008, 0x0004E400,
4204 - 0xFF0F0404, 0xCDEF,
4205 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4206 + 0x008, 0x00002000,
4207 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
4208 + 0x008, 0x00002000,
4209 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4210 + 0x008, 0x00002000,
4211 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4212 + 0x008, 0x00002000,
4213 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4214 0x008, 0x0004E400,
4215 - 0xCDCDCDCD, 0xCDCD,
4216 + 0xA0000000, 0x00000000,
4217 0x008, 0x00002000,
4218 - 0xFF0F0104, 0xDEAD,
4219 + 0xB0000000, 0x00000000,
4220 0x0EF, 0x00000000,
4221 0x0DF, 0x000000C0,
4222 - 0x01F, 0x00040064,
4223 - 0xFF0F0104, 0xABCD,
4224 + 0x01F, 0x00000064,
4225 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4226 0x058, 0x000A7284,
4227 0x059, 0x000600EC,
4228 - 0xFF0F0204, 0xCDEF,
4229 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4230 0x058, 0x000A7284,
4231 0x059, 0x000600EC,
4232 - 0xFF0F0404, 0xCDEF,
4233 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
4234 + 0x058, 0x00081184,
4235 + 0x059, 0x0006016C,
4236 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4237 + 0x058, 0x00081184,
4238 + 0x059, 0x0006016C,
4239 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4240 + 0x058, 0x00081184,
4241 + 0x059, 0x0006016C,
4242 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4243 0x058, 0x000A7284,
4244 0x059, 0x000600EC,
4245 - 0xCDCDCDCD, 0xCDCD,
4246 + 0xA0000000, 0x00000000,
4247 0x058, 0x00081184,
4248 0x059, 0x0006016C,
4249 - 0xFF0F0104, 0xDEAD,
4250 - 0xFF0F0104, 0xABCD,
4251 + 0xB0000000, 0x00000000,
4252 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4253 0x061, 0x000E8D73,
4254 0x062, 0x00093FC5,
4255 - 0xFF0F0204, 0xCDEF,
4256 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4257 0x061, 0x000E8D73,
4258 0x062, 0x00093FC5,
4259 - 0xFF0F0404, 0xCDEF,
4260 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4261 + 0x061, 0x000EFD83,
4262 + 0x062, 0x00093FCC,
4263 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4264 + 0x061, 0x000EAD53,
4265 + 0x062, 0x00093BC4,
4266 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4267 + 0x061, 0x000EFD83,
4268 + 0x062, 0x00093FCC,
4269 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4270 0x061, 0x000E8D73,
4271 0x062, 0x00093FC5,
4272 - 0xCDCDCDCD, 0xCDCD,
4273 + 0xA0000000, 0x00000000,
4274 0x061, 0x000EAD53,
4275 0x062, 0x00093BC4,
4276 - 0xFF0F0104, 0xDEAD,
4277 - 0xFF0F0104, 0xABCD,
4278 + 0xB0000000, 0x00000000,
4279 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4280 0x063, 0x000110E9,
4281 - 0xFF0F0204, 0xCDEF,
4282 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4283 0x063, 0x000110E9,
4284 - 0xFF0F0404, 0xCDEF,
4285 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4286 + 0x063, 0x000110EB,
4287 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
4288 0x063, 0x000110E9,
4289 - 0xFF0F0200, 0xCDEF,
4290 - 0x063, 0x000710E9,
4291 - 0xFF0F02C0, 0xCDEF,
4292 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4293 0x063, 0x000110E9,
4294 - 0xCDCDCDCD, 0xCDCD,
4295 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4296 + 0x063, 0x000110EB,
4297 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4298 + 0x063, 0x000110E9,
4299 + 0xA0000000, 0x00000000,
4300 0x063, 0x000714E9,
4301 - 0xFF0F0104, 0xDEAD,
4302 - 0xFF0F0104, 0xABCD,
4303 + 0xB0000000, 0x00000000,
4304 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4305 + 0x064, 0x0001C27C,
4306 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4307 + 0x064, 0x0001C27C,
4308 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4309 0x064, 0x0001C27C,
4310 - 0xFF0F0204, 0xCDEF,
4311 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4312 + 0x064, 0x0001C67C,
4313 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4314 0x064, 0x0001C27C,
4315 - 0xFF0F0404, 0xCDEF,
4316 + 0x90000410, 0x00000000, 0x40000000, 0x00000000,
4317 0x064, 0x0001C27C,
4318 - 0xCDCDCDCD, 0xCDCD,
4319 + 0xA0000000, 0x00000000,
4320 0x064, 0x0001C67C,
4321 - 0xFF0F0104, 0xDEAD,
4322 - 0xFF0F0200, 0xABCD,
4323 + 0xB0000000, 0x00000000,
4324 + 0x80000111, 0x00000000, 0x40000000, 0x00000000,
4325 + 0x065, 0x00091016,
4326 + 0x90000110, 0x00000000, 0x40000000, 0x00000000,
4327 + 0x065, 0x00091016,
4328 + 0x90000210, 0x00000000, 0x40000000, 0x00000000,
4329 0x065, 0x00093016,
4330 - 0xFF0F02C0, 0xCDEF,
4331 + 0x9000020c, 0x00000000, 0x40000000, 0x00000000,
4332 0x065, 0x00093015,
4333 - 0xCDCDCDCD, 0xCDCD,
4334 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4335 + 0x065, 0x00093015,
4336 + 0x90000200, 0x00000000, 0x40000000, 0x00000000,
4337 + 0x065, 0x00093016,
4338 + 0xA0000000, 0x00000000,
4339 0x065, 0x00091016,
4340 - 0xFF0F0200, 0xDEAD,
4341 + 0xB0000000, 0x00000000,
4342 0x018, 0x00000006,
4343 0x0EF, 0x00002000,
4344 0x03B, 0x0003824B,
4345 @@ -1895,9 +2074,10 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {
4346 0x0B4, 0x0001214C,
4347 0x0B7, 0x0003000C,
4348 0x01C, 0x000539D2,
4349 + 0x0C4, 0x000AFE00,
4350 0x018, 0x0001F12A,
4351 - 0x0FE, 0x00000000,
4352 - 0x0FE, 0x00000000,
4353 + 0xFFE, 0x00000000,
4354 + 0xFFE, 0x00000000,
4355 0x018, 0x0001712A,
4356
4357 };
4358 @@ -2017,6 +2197,7 @@ u32 RTL8812AE_MAC_REG_ARRAY[] = {
4359 u32 RTL8812AE_MAC_1T_ARRAYLEN = ARRAY_SIZE(RTL8812AE_MAC_REG_ARRAY);
4360
4361 u32 RTL8821AE_MAC_REG_ARRAY[] = {
4362 + 0x421, 0x0000000F,
4363 0x428, 0x0000000A,
4364 0x429, 0x00000010,
4365 0x430, 0x00000000,
4366 @@ -2485,7 +2666,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {
4367 0x81C, 0xA6360001,
4368 0x81C, 0xA5380001,
4369 0x81C, 0xA43A0001,
4370 - 0x81C, 0xA33C0001,
4371 + 0x81C, 0x683C0001,
4372 0x81C, 0x673E0001,
4373 0x81C, 0x66400001,
4374 0x81C, 0x65420001,
4375 @@ -2519,7 +2700,66 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {
4376 0x81C, 0x017A0001,
4377 0x81C, 0x017C0001,
4378 0x81C, 0x017E0001,
4379 - 0xFF0F02C0, 0xABCD,
4380 + 0x8000020c, 0x00000000, 0x40000000, 0x00000000,
4381 + 0x81C, 0xFB000101,
4382 + 0x81C, 0xFA020101,
4383 + 0x81C, 0xF9040101,
4384 + 0x81C, 0xF8060101,
4385 + 0x81C, 0xF7080101,
4386 + 0x81C, 0xF60A0101,
4387 + 0x81C, 0xF50C0101,
4388 + 0x81C, 0xF40E0101,
4389 + 0x81C, 0xF3100101,
4390 + 0x81C, 0xF2120101,
4391 + 0x81C, 0xF1140101,
4392 + 0x81C, 0xF0160101,
4393 + 0x81C, 0xEF180101,
4394 + 0x81C, 0xEE1A0101,
4395 + 0x81C, 0xED1C0101,
4396 + 0x81C, 0xEC1E0101,
4397 + 0x81C, 0xEB200101,
4398 + 0x81C, 0xEA220101,
4399 + 0x81C, 0xE9240101,
4400 + 0x81C, 0xE8260101,
4401 + 0x81C, 0xE7280101,
4402 + 0x81C, 0xE62A0101,
4403 + 0x81C, 0xE52C0101,
4404 + 0x81C, 0xE42E0101,
4405 + 0x81C, 0xE3300101,
4406 + 0x81C, 0xA5320101,
4407 + 0x81C, 0xA4340101,
4408 + 0x81C, 0xA3360101,
4409 + 0x81C, 0x87380101,
4410 + 0x81C, 0x863A0101,
4411 + 0x81C, 0x853C0101,
4412 + 0x81C, 0x843E0101,
4413 + 0x81C, 0x69400101,
4414 + 0x81C, 0x68420101,
4415 + 0x81C, 0x67440101,
4416 + 0x81C, 0x66460101,
4417 + 0x81C, 0x49480101,
4418 + 0x81C, 0x484A0101,
4419 + 0x81C, 0x474C0101,
4420 + 0x81C, 0x2A4E0101,
4421 + 0x81C, 0x29500101,
4422 + 0x81C, 0x28520101,
4423 + 0x81C, 0x27540101,
4424 + 0x81C, 0x26560101,
4425 + 0x81C, 0x25580101,
4426 + 0x81C, 0x245A0101,
4427 + 0x81C, 0x235C0101,
4428 + 0x81C, 0x055E0101,
4429 + 0x81C, 0x04600101,
4430 + 0x81C, 0x03620101,
4431 + 0x81C, 0x02640101,
4432 + 0x81C, 0x01660101,
4433 + 0x81C, 0x01680101,
4434 + 0x81C, 0x016A0101,
4435 + 0x81C, 0x016C0101,
4436 + 0x81C, 0x016E0101,
4437 + 0x81C, 0x01700101,
4438 + 0x81C, 0x01720101,
4439 + 0x9000040c, 0x00000000, 0x40000000, 0x00000000,
4440 0x81C, 0xFB000101,
4441 0x81C, 0xFA020101,
4442 0x81C, 0xF9040101,
4443 @@ -2578,7 +2818,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {
4444 0x81C, 0x016E0101,
4445 0x81C, 0x01700101,
4446 0x81C, 0x01720101,
4447 - 0xCDCDCDCD, 0xCDCD,
4448 + 0xA0000000, 0x00000000,
4449 0x81C, 0xFF000101,
4450 0x81C, 0xFF020101,
4451 0x81C, 0xFE040101,
4452 @@ -2637,7 +2877,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {
4453 0x81C, 0x046E0101,
4454 0x81C, 0x03700101,
4455 0x81C, 0x02720101,
4456 - 0xFF0F02C0, 0xDEAD,
4457 + 0xB0000000, 0x00000000,
4458 0x81C, 0x01740101,
4459 0x81C, 0x01760101,
4460 0x81C, 0x01780101,
4461 diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
4462 index 47d199d2e7dc3..02da69e9dfe77 100644
4463 --- a/drivers/net/wireless/realtek/rtw88/phy.c
4464 +++ b/drivers/net/wireless/realtek/rtw88/phy.c
4465 @@ -1451,7 +1451,7 @@ void rtw_phy_load_tables(struct rtw_dev *rtwdev)
4466 }
4467 }
4468
4469 -static u8 rtw_get_channel_group(u8 channel)
4470 +static u8 rtw_get_channel_group(u8 channel, u8 rate)
4471 {
4472 switch (channel) {
4473 default:
4474 @@ -1495,6 +1495,7 @@ static u8 rtw_get_channel_group(u8 channel)
4475 case 106:
4476 return 4;
4477 case 14:
4478 + return rate <= DESC_RATE11M ? 5 : 4;
4479 case 108:
4480 case 110:
4481 case 112:
4482 @@ -1744,7 +1745,7 @@ void rtw_get_tx_power_params(struct rtw_dev *rtwdev, u8 path, u8 rate, u8 bw,
4483 s8 *limit = &pwr_param->pwr_limit;
4484
4485 pwr_idx = &rtwdev->efuse.txpwr_idx_table[path];
4486 - group = rtw_get_channel_group(ch);
4487 + group = rtw_get_channel_group(ch, rate);
4488
4489 /* base power index for 2.4G/5G */
4490 if (ch <= 14) {
4491 diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
4492 index a172a32aa9d93..3ea38ce86cc9f 100644
4493 --- a/drivers/nfc/pn533/pn533.c
4494 +++ b/drivers/nfc/pn533/pn533.c
4495 @@ -680,6 +680,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a,
4496 if (PN533_TYPE_A_SEL_CASCADE(type_a->sel_res) != 0)
4497 return false;
4498
4499 + if (type_a->nfcid_len > NFC_NFCID1_MAXSIZE)
4500 + return false;
4501 +
4502 return true;
4503 }
4504
4505 diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
4506 index 207a88ea10f38..855edc4e12440 100644
4507 --- a/drivers/nvme/host/multipath.c
4508 +++ b/drivers/nvme/host/multipath.c
4509 @@ -677,6 +677,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
4510 if (desc.state) {
4511 /* found the group desc: update */
4512 nvme_update_ns_ana_state(&desc, ns);
4513 + } else {
4514 + /* group desc not found: trigger a re-read */
4515 + set_bit(NVME_NS_ANA_PENDING, &ns->flags);
4516 + queue_work(nvme_wq, &ns->ctrl->ana_work);
4517 }
4518 } else {
4519 ns->ana_state = NVME_ANA_OPTIMIZED;
4520 diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
4521 index 3bee3724e9fa7..2cb2ead7615b2 100644
4522 --- a/drivers/nvme/host/pci.c
4523 +++ b/drivers/nvme/host/pci.c
4524 @@ -838,7 +838,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
4525 return nvme_setup_prp_simple(dev, req,
4526 &cmnd->rw, &bv);
4527
4528 - if (iod->nvmeq->qid &&
4529 + if (iod->nvmeq->qid && sgl_threshold &&
4530 dev->ctrl.sgls & ((1 << 0) | (1 << 1)))
4531 return nvme_setup_sgl_simple(dev, req,
4532 &cmnd->rw, &bv);
4533 diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
4534 index ac3503ea54c46..718152adc6254 100644
4535 --- a/drivers/nvme/host/tcp.c
4536 +++ b/drivers/nvme/host/tcp.c
4537 @@ -816,7 +816,7 @@ static void nvme_tcp_state_change(struct sock *sk)
4538 {
4539 struct nvme_tcp_queue *queue;
4540
4541 - read_lock(&sk->sk_callback_lock);
4542 + read_lock_bh(&sk->sk_callback_lock);
4543 queue = sk->sk_user_data;
4544 if (!queue)
4545 goto done;
4546 @@ -838,7 +838,7 @@ static void nvme_tcp_state_change(struct sock *sk)
4547
4548 queue->state_change(sk);
4549 done:
4550 - read_unlock(&sk->sk_callback_lock);
4551 + read_unlock_bh(&sk->sk_callback_lock);
4552 }
4553
4554 static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
4555 diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
4556 index 9242224156f5b..9bfd92b6677b0 100644
4557 --- a/drivers/nvme/target/tcp.c
4558 +++ b/drivers/nvme/target/tcp.c
4559 @@ -1402,7 +1402,7 @@ static void nvmet_tcp_state_change(struct sock *sk)
4560 {
4561 struct nvmet_tcp_queue *queue;
4562
4563 - write_lock_bh(&sk->sk_callback_lock);
4564 + read_lock_bh(&sk->sk_callback_lock);
4565 queue = sk->sk_user_data;
4566 if (!queue)
4567 goto done;
4568 @@ -1420,7 +1420,7 @@ static void nvmet_tcp_state_change(struct sock *sk)
4569 queue->idx, sk->sk_state);
4570 }
4571 done:
4572 - write_unlock_bh(&sk->sk_callback_lock);
4573 + read_unlock_bh(&sk->sk_callback_lock);
4574 }
4575
4576 static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue)
4577 diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
4578 index fc24102e25ce7..223d617ecfe17 100644
4579 --- a/drivers/of/fdt.c
4580 +++ b/drivers/of/fdt.c
4581 @@ -1153,16 +1153,8 @@ int __init __weak early_init_dt_mark_hotplug_memory_arch(u64 base, u64 size)
4582 int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
4583 phys_addr_t size, bool nomap)
4584 {
4585 - if (nomap) {
4586 - /*
4587 - * If the memory is already reserved (by another region), we
4588 - * should not allow it to be marked nomap.
4589 - */
4590 - if (memblock_is_region_reserved(base, size))
4591 - return -EBUSY;
4592 -
4593 - return memblock_mark_nomap(base, size);
4594 - }
4595 + if (nomap)
4596 + return memblock_remove(base, size);
4597 return memblock_reserve(base, size);
4598 }
4599
4600 diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
4601 index 7915d10f9aa10..bd549070c0112 100644
4602 --- a/drivers/pci/vpd.c
4603 +++ b/drivers/pci/vpd.c
4604 @@ -570,7 +570,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd);
4605 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd);
4606 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID,
4607 quirk_blacklist_vpd);
4608 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd);
4609 /*
4610 * The Amazon Annapurna Labs 0x0031 device id is reused for other non Root Port
4611 * device types, so the quirk is registered for the PCI_CLASS_BRIDGE_PCI class.
4612 diff --git a/drivers/phy/marvell/Kconfig b/drivers/phy/marvell/Kconfig
4613 index 4053ba6cd0fbf..6e3e5d67e8160 100644
4614 --- a/drivers/phy/marvell/Kconfig
4615 +++ b/drivers/phy/marvell/Kconfig
4616 @@ -3,8 +3,8 @@
4617 # Phy drivers for Marvell platforms
4618 #
4619 config ARMADA375_USBCLUSTER_PHY
4620 - def_bool y
4621 - depends on MACH_ARMADA_375 || COMPILE_TEST
4622 + bool "Armada 375 USB cluster PHY support" if COMPILE_TEST
4623 + default y if MACH_ARMADA_375
4624 depends on OF && HAS_IOMEM
4625 select GENERIC_PHY
4626
4627 diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
4628 index 2b1a3a6ee8dbf..597cfabc0967c 100644
4629 --- a/drivers/platform/x86/pmc_atom.c
4630 +++ b/drivers/platform/x86/pmc_atom.c
4631 @@ -393,34 +393,10 @@ static const struct dmi_system_id critclk_systems[] = {
4632 },
4633 {
4634 /* pmc_plt_clk* - are used for ethernet controllers */
4635 - .ident = "Beckhoff CB3163",
4636 + .ident = "Beckhoff Baytrail",
4637 .matches = {
4638 DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"),
4639 - DMI_MATCH(DMI_BOARD_NAME, "CB3163"),
4640 - },
4641 - },
4642 - {
4643 - /* pmc_plt_clk* - are used for ethernet controllers */
4644 - .ident = "Beckhoff CB4063",
4645 - .matches = {
4646 - DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"),
4647 - DMI_MATCH(DMI_BOARD_NAME, "CB4063"),
4648 - },
4649 - },
4650 - {
4651 - /* pmc_plt_clk* - are used for ethernet controllers */
4652 - .ident = "Beckhoff CB6263",
4653 - .matches = {
4654 - DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"),
4655 - DMI_MATCH(DMI_BOARD_NAME, "CB6263"),
4656 - },
4657 - },
4658 - {
4659 - /* pmc_plt_clk* - are used for ethernet controllers */
4660 - .ident = "Beckhoff CB6363",
4661 - .matches = {
4662 - DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"),
4663 - DMI_MATCH(DMI_BOARD_NAME, "CB6363"),
4664 + DMI_MATCH(DMI_PRODUCT_FAMILY, "CBxx63"),
4665 },
4666 },
4667 {
4668 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
4669 index b861a0f14c9d8..3364ae0b9bfe6 100644
4670 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
4671 +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
4672 @@ -1645,7 +1645,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
4673 idx = i * HISI_SAS_PHY_INT_NR;
4674 for (j = 0; j < HISI_SAS_PHY_INT_NR; j++, idx++) {
4675 irq = platform_get_irq(pdev, idx);
4676 - if (!irq) {
4677 + if (irq < 0) {
4678 dev_err(dev, "irq init: fail map phy interrupt %d\n",
4679 idx);
4680 return -ENOENT;
4681 @@ -1664,7 +1664,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
4682 idx = hisi_hba->n_phy * HISI_SAS_PHY_INT_NR;
4683 for (i = 0; i < hisi_hba->queue_count; i++, idx++) {
4684 irq = platform_get_irq(pdev, idx);
4685 - if (!irq) {
4686 + if (irq < 0) {
4687 dev_err(dev, "irq init: could not map cq interrupt %d\n",
4688 idx);
4689 return -ENOENT;
4690 @@ -1682,7 +1682,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
4691 idx = (hisi_hba->n_phy * HISI_SAS_PHY_INT_NR) + hisi_hba->queue_count;
4692 for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++, idx++) {
4693 irq = platform_get_irq(pdev, idx);
4694 - if (!irq) {
4695 + if (irq < 0) {
4696 dev_err(dev, "irq init: could not map fatal interrupt %d\n",
4697 idx);
4698 return -ENOENT;
4699 diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
4700 index 523809a8a2323..5f8bdc5bde4bb 100644
4701 --- a/drivers/scsi/ibmvscsi/ibmvfc.c
4702 +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
4703 @@ -493,8 +493,17 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
4704 if (vhost->action == IBMVFC_HOST_ACTION_ALLOC_TGTS)
4705 vhost->action = action;
4706 break;
4707 + case IBMVFC_HOST_ACTION_REENABLE:
4708 + case IBMVFC_HOST_ACTION_RESET:
4709 + vhost->action = action;
4710 + break;
4711 case IBMVFC_HOST_ACTION_INIT:
4712 case IBMVFC_HOST_ACTION_TGT_DEL:
4713 + case IBMVFC_HOST_ACTION_LOGO:
4714 + case IBMVFC_HOST_ACTION_QUERY_TGTS:
4715 + case IBMVFC_HOST_ACTION_TGT_DEL_FAILED:
4716 + case IBMVFC_HOST_ACTION_NONE:
4717 + default:
4718 switch (vhost->action) {
4719 case IBMVFC_HOST_ACTION_RESET:
4720 case IBMVFC_HOST_ACTION_REENABLE:
4721 @@ -504,15 +513,6 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
4722 break;
4723 }
4724 break;
4725 - case IBMVFC_HOST_ACTION_LOGO:
4726 - case IBMVFC_HOST_ACTION_QUERY_TGTS:
4727 - case IBMVFC_HOST_ACTION_TGT_DEL_FAILED:
4728 - case IBMVFC_HOST_ACTION_NONE:
4729 - case IBMVFC_HOST_ACTION_RESET:
4730 - case IBMVFC_HOST_ACTION_REENABLE:
4731 - default:
4732 - vhost->action = action;
4733 - break;
4734 }
4735 }
4736
4737 @@ -4339,26 +4339,45 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
4738 case IBMVFC_HOST_ACTION_INIT_WAIT:
4739 break;
4740 case IBMVFC_HOST_ACTION_RESET:
4741 - vhost->action = IBMVFC_HOST_ACTION_TGT_DEL;
4742 spin_unlock_irqrestore(vhost->host->host_lock, flags);
4743 rc = ibmvfc_reset_crq(vhost);
4744 +
4745 spin_lock_irqsave(vhost->host->host_lock, flags);
4746 - if (rc == H_CLOSED)
4747 + if (!rc || rc == H_CLOSED)
4748 vio_enable_interrupts(to_vio_dev(vhost->dev));
4749 - if (rc || (rc = ibmvfc_send_crq_init(vhost)) ||
4750 - (rc = vio_enable_interrupts(to_vio_dev(vhost->dev)))) {
4751 - ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
4752 - dev_err(vhost->dev, "Error after reset (rc=%d)\n", rc);
4753 + if (vhost->action == IBMVFC_HOST_ACTION_RESET) {
4754 + /*
4755 + * The only action we could have changed to would have
4756 + * been reenable, in which case, we skip the rest of
4757 + * this path and wait until we've done the re-enable
4758 + * before sending the crq init.
4759 + */
4760 + vhost->action = IBMVFC_HOST_ACTION_TGT_DEL;
4761 +
4762 + if (rc || (rc = ibmvfc_send_crq_init(vhost)) ||
4763 + (rc = vio_enable_interrupts(to_vio_dev(vhost->dev)))) {
4764 + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
4765 + dev_err(vhost->dev, "Error after reset (rc=%d)\n", rc);
4766 + }
4767 }
4768 break;
4769 case IBMVFC_HOST_ACTION_REENABLE:
4770 - vhost->action = IBMVFC_HOST_ACTION_TGT_DEL;
4771 spin_unlock_irqrestore(vhost->host->host_lock, flags);
4772 rc = ibmvfc_reenable_crq_queue(vhost);
4773 +
4774 spin_lock_irqsave(vhost->host->host_lock, flags);
4775 - if (rc || (rc = ibmvfc_send_crq_init(vhost))) {
4776 - ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
4777 - dev_err(vhost->dev, "Error after enable (rc=%d)\n", rc);
4778 + if (vhost->action == IBMVFC_HOST_ACTION_REENABLE) {
4779 + /*
4780 + * The only action we could have changed to would have
4781 + * been reset, in which case, we skip the rest of this
4782 + * path and wait until we've done the reset before
4783 + * sending the crq init.
4784 + */
4785 + vhost->action = IBMVFC_HOST_ACTION_TGT_DEL;
4786 + if (rc || (rc = ibmvfc_send_crq_init(vhost))) {
4787 + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
4788 + dev_err(vhost->dev, "Error after enable (rc=%d)\n", rc);
4789 + }
4790 }
4791 break;
4792 case IBMVFC_HOST_ACTION_LOGO:
4793 diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
4794 index 7f683e42c7987..f55b07aa1ccae 100644
4795 --- a/drivers/scsi/jazz_esp.c
4796 +++ b/drivers/scsi/jazz_esp.c
4797 @@ -143,7 +143,9 @@ static int esp_jazz_probe(struct platform_device *dev)
4798 if (!esp->command_block)
4799 goto fail_unmap_regs;
4800
4801 - host->irq = platform_get_irq(dev, 0);
4802 + host->irq = err = platform_get_irq(dev, 0);
4803 + if (err < 0)
4804 + goto fail_unmap_command_block;
4805 err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp);
4806 if (err < 0)
4807 goto fail_unmap_command_block;
4808 diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
4809 index a85d52b5dc320..0521575c67737 100644
4810 --- a/drivers/scsi/sni_53c710.c
4811 +++ b/drivers/scsi/sni_53c710.c
4812 @@ -59,6 +59,7 @@ static int snirm710_probe(struct platform_device *dev)
4813 struct NCR_700_Host_Parameters *hostdata;
4814 struct Scsi_Host *host;
4815 struct resource *res;
4816 + int rc;
4817
4818 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
4819 if (!res)
4820 @@ -84,7 +85,9 @@ static int snirm710_probe(struct platform_device *dev)
4821 goto out_kfree;
4822 host->this_id = 7;
4823 host->base = base;
4824 - host->irq = platform_get_irq(dev, 0);
4825 + host->irq = rc = platform_get_irq(dev, 0);
4826 + if (rc < 0)
4827 + goto out_put_host;
4828 if(request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "snirm710", host)) {
4829 printk(KERN_ERR "snirm710: request_irq failed!\n");
4830 goto out_put_host;
4831 diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
4832 index 440a73eae6476..f8b1e5748440f 100644
4833 --- a/drivers/scsi/sun3x_esp.c
4834 +++ b/drivers/scsi/sun3x_esp.c
4835 @@ -206,7 +206,9 @@ static int esp_sun3x_probe(struct platform_device *dev)
4836 if (!esp->command_block)
4837 goto fail_unmap_regs_dma;
4838
4839 - host->irq = platform_get_irq(dev, 0);
4840 + host->irq = err = platform_get_irq(dev, 0);
4841 + if (err < 0)
4842 + goto fail_unmap_command_block;
4843 err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED,
4844 "SUN3X ESP", esp);
4845 if (err < 0)
4846 diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
4847 index dbe5325a324d5..538d7aab8db5c 100644
4848 --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
4849 +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
4850 @@ -95,8 +95,10 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer,
4851 return -EINTR;
4852 }
4853 ret = kfifo_to_user(&chan->fifo, buffer, count, &copied);
4854 + if (ret)
4855 + return ret;
4856
4857 - return ret ? ret : copied;
4858 + return copied;
4859 }
4860
4861 static __poll_t snoop_file_poll(struct file *file,
4862 diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c
4863 index 24cd193dec550..eba7f76f9d61a 100644
4864 --- a/drivers/soc/qcom/mdt_loader.c
4865 +++ b/drivers/soc/qcom/mdt_loader.c
4866 @@ -230,6 +230,14 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
4867 break;
4868 }
4869
4870 + if (phdr->p_filesz > phdr->p_memsz) {
4871 + dev_err(dev,
4872 + "refusing to load segment %d with p_filesz > p_memsz\n",
4873 + i);
4874 + ret = -EINVAL;
4875 + break;
4876 + }
4877 +
4878 ptr = mem_region + offset;
4879
4880 if (phdr->p_filesz && phdr->p_offset < fw->size) {
4881 @@ -253,6 +261,15 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
4882 break;
4883 }
4884
4885 + if (seg_fw->size != phdr->p_filesz) {
4886 + dev_err(dev,
4887 + "failed to load segment %d from truncated file %s\n",
4888 + i, fw_name);
4889 + release_firmware(seg_fw);
4890 + ret = -EINVAL;
4891 + break;
4892 + }
4893 +
4894 release_firmware(seg_fw);
4895 }
4896
4897 diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
4898 index a90963812357c..d90f00d09257a 100644
4899 --- a/drivers/soundwire/bus.c
4900 +++ b/drivers/soundwire/bus.c
4901 @@ -525,7 +525,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
4902 struct sdw_slave *slave, *_s;
4903 struct sdw_slave_id id;
4904 struct sdw_msg msg;
4905 - bool found = false;
4906 + bool found;
4907 int count = 0, ret;
4908 u64 addr;
4909
4910 @@ -557,6 +557,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
4911
4912 sdw_extract_slave_id(bus, addr, &id);
4913
4914 + found = false;
4915 /* Now compare with entries */
4916 list_for_each_entry_safe(slave, _s, &bus->slaves, node) {
4917 if (sdw_compare_devid(slave, id) == 0) {
4918 diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
4919 index de7c57e17710a..23accfedbf4d1 100644
4920 --- a/drivers/soundwire/stream.c
4921 +++ b/drivers/soundwire/stream.c
4922 @@ -1357,8 +1357,16 @@ int sdw_stream_add_slave(struct sdw_slave *slave,
4923 }
4924
4925 ret = sdw_config_stream(&slave->dev, stream, stream_config, true);
4926 - if (ret)
4927 + if (ret) {
4928 + /*
4929 + * sdw_release_master_stream will release s_rt in slave_rt_list in
4930 + * stream_error case, but s_rt is only added to slave_rt_list
4931 + * when sdw_config_stream is successful, so free s_rt explicitly
4932 + * when sdw_config_stream is failed.
4933 + */
4934 + kfree(s_rt);
4935 goto stream_error;
4936 + }
4937
4938 list_add_tail(&s_rt->m_rt_node, &m_rt->slave_rt_list);
4939
4940 diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
4941 index ecb4396707cfc..58b2da91be1c0 100644
4942 --- a/drivers/spi/spi-fsl-lpspi.c
4943 +++ b/drivers/spi/spi-fsl-lpspi.c
4944 @@ -207,7 +207,7 @@ static int lpspi_prepare_xfer_hardware(struct spi_controller *controller)
4945 spi_controller_get_devdata(controller);
4946 int ret;
4947
4948 - ret = pm_runtime_get_sync(fsl_lpspi->dev);
4949 + ret = pm_runtime_resume_and_get(fsl_lpspi->dev);
4950 if (ret < 0) {
4951 dev_err(fsl_lpspi->dev, "failed to enable clock\n");
4952 return ret;
4953 diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
4954 index 9e7a6de3c43d1..3af6a5a3a4b29 100644
4955 --- a/drivers/spi/spi-stm32.c
4956 +++ b/drivers/spi/spi-stm32.c
4957 @@ -1926,7 +1926,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
4958 pm_runtime_set_active(&pdev->dev);
4959 pm_runtime_enable(&pdev->dev);
4960
4961 - ret = devm_spi_register_master(&pdev->dev, master);
4962 + ret = spi_register_master(master);
4963 if (ret) {
4964 dev_err(&pdev->dev, "spi master registration failed: %d\n",
4965 ret);
4966 @@ -1980,6 +1980,7 @@ static int stm32_spi_remove(struct platform_device *pdev)
4967 struct spi_master *master = platform_get_drvdata(pdev);
4968 struct stm32_spi *spi = spi_master_get_devdata(master);
4969
4970 + spi_unregister_master(master);
4971 spi->cfg->disable(spi);
4972
4973 if (master->dma_tx)
4974 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
4975 index e1205d72be523..7592d4de20c9e 100644
4976 --- a/drivers/spi/spi.c
4977 +++ b/drivers/spi/spi.c
4978 @@ -2291,6 +2291,7 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
4979
4980 ctlr = __spi_alloc_controller(dev, size, slave);
4981 if (ctlr) {
4982 + ctlr->devm_allocated = true;
4983 *ptr = ctlr;
4984 devres_add(dev, ptr);
4985 } else {
4986 @@ -2620,11 +2621,6 @@ int devm_spi_register_controller(struct device *dev,
4987 }
4988 EXPORT_SYMBOL_GPL(devm_spi_register_controller);
4989
4990 -static int devm_spi_match_controller(struct device *dev, void *res, void *ctlr)
4991 -{
4992 - return *(struct spi_controller **)res == ctlr;
4993 -}
4994 -
4995 static int __unregister(struct device *dev, void *null)
4996 {
4997 spi_unregister_device(to_spi_device(dev));
4998 @@ -2671,8 +2667,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
4999 /* Release the last reference on the controller if its driver
5000 * has not yet been converted to devm_spi_alloc_master/slave().
5001 */
5002 - if (!devres_find(ctlr->dev.parent, devm_spi_release_controller,
5003 - devm_spi_match_controller, ctlr))
5004 + if (!ctlr->devm_allocated)
5005 put_device(&ctlr->dev);
5006
5007 /* free bus id */
5008 diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
5009 index 4df6e3c1ea96c..35833753c735b 100644
5010 --- a/drivers/staging/fwserial/fwserial.c
5011 +++ b/drivers/staging/fwserial/fwserial.c
5012 @@ -1223,7 +1223,7 @@ static int get_serial_info(struct tty_struct *tty,
5013 ss->flags = port->port.flags;
5014 ss->xmit_fifo_size = FWTTY_PORT_TXFIFO_LEN;
5015 ss->baud_base = 400000000;
5016 - ss->close_delay = port->port.close_delay;
5017 + ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10;
5018 mutex_unlock(&port->port.mutex);
5019 return 0;
5020 }
5021 @@ -1232,20 +1232,24 @@ static int set_serial_info(struct tty_struct *tty,
5022 struct serial_struct *ss)
5023 {
5024 struct fwtty_port *port = tty->driver_data;
5025 + unsigned int cdelay;
5026
5027 if (ss->irq != 0 || ss->port != 0 || ss->custom_divisor != 0 ||
5028 ss->baud_base != 400000000)
5029 return -EPERM;
5030
5031 + cdelay = msecs_to_jiffies(ss->close_delay * 10);
5032 +
5033 mutex_lock(&port->port.mutex);
5034 if (!capable(CAP_SYS_ADMIN)) {
5035 - if (((ss->flags & ~ASYNC_USR_MASK) !=
5036 + if (cdelay != port->port.close_delay ||
5037 + ((ss->flags & ~ASYNC_USR_MASK) !=
5038 (port->port.flags & ~ASYNC_USR_MASK))) {
5039 mutex_unlock(&port->port.mutex);
5040 return -EPERM;
5041 }
5042 }
5043 - port->port.close_delay = ss->close_delay * HZ / 100;
5044 + port->port.close_delay = cdelay;
5045 mutex_unlock(&port->port.mutex);
5046
5047 return 0;
5048 diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
5049 index 4ffb334cd5cde..fc1bd68889c91 100644
5050 --- a/drivers/staging/greybus/uart.c
5051 +++ b/drivers/staging/greybus/uart.c
5052 @@ -625,10 +625,12 @@ static int get_serial_info(struct tty_struct *tty,
5053 ss->line = gb_tty->minor;
5054 ss->xmit_fifo_size = 16;
5055 ss->baud_base = 9600;
5056 - ss->close_delay = gb_tty->port.close_delay / 10;
5057 + ss->close_delay = jiffies_to_msecs(gb_tty->port.close_delay) / 10;
5058 ss->closing_wait =
5059 gb_tty->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
5060 - ASYNC_CLOSING_WAIT_NONE : gb_tty->port.closing_wait / 10;
5061 + ASYNC_CLOSING_WAIT_NONE :
5062 + jiffies_to_msecs(gb_tty->port.closing_wait) / 10;
5063 +
5064 return 0;
5065 }
5066
5067 @@ -640,17 +642,16 @@ static int set_serial_info(struct tty_struct *tty,
5068 unsigned int close_delay;
5069 int retval = 0;
5070
5071 - close_delay = ss->close_delay * 10;
5072 + close_delay = msecs_to_jiffies(ss->close_delay * 10);
5073 closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ?
5074 - ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10;
5075 + ASYNC_CLOSING_WAIT_NONE :
5076 + msecs_to_jiffies(ss->closing_wait * 10);
5077
5078 mutex_lock(&gb_tty->port.mutex);
5079 if (!capable(CAP_SYS_ADMIN)) {
5080 if ((close_delay != gb_tty->port.close_delay) ||
5081 (closing_wait != gb_tty->port.closing_wait))
5082 retval = -EPERM;
5083 - else
5084 - retval = -EOPNOTSUPP;
5085 } else {
5086 gb_tty->port.close_delay = close_delay;
5087 gb_tty->port.closing_wait = closing_wait;
5088 diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
5089 index 1a966cb2f3a6b..eed495f7665d3 100644
5090 --- a/drivers/staging/media/omap4iss/iss.c
5091 +++ b/drivers/staging/media/omap4iss/iss.c
5092 @@ -1240,8 +1240,10 @@ static int iss_probe(struct platform_device *pdev)
5093 if (ret < 0)
5094 goto error;
5095
5096 - if (!omap4iss_get(iss))
5097 + if (!omap4iss_get(iss)) {
5098 + ret = -EINVAL;
5099 goto error;
5100 + }
5101
5102 ret = iss_reset(iss);
5103 if (ret < 0)
5104 diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
5105 index ddc09616248a5..66cd43f963c9a 100644
5106 --- a/drivers/staging/rtl8192u/r8192U_core.c
5107 +++ b/drivers/staging/rtl8192u/r8192U_core.c
5108 @@ -3248,7 +3248,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum,
5109 u32 *TotalRxDataNum)
5110 {
5111 u16 SlotIndex;
5112 - u8 i;
5113 + u16 i;
5114
5115 *TotalRxBcnNum = 0;
5116 *TotalRxDataNum = 0;
5117 diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
5118 index 8330fd809a05f..34d6ef75c95c3 100644
5119 --- a/drivers/tty/amiserial.c
5120 +++ b/drivers/tty/amiserial.c
5121 @@ -1032,6 +1032,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
5122 if (!serial_isroot()) {
5123 if ((ss->baud_base != state->baud_base) ||
5124 (ss->close_delay != port->close_delay) ||
5125 + (ss->closing_wait != port->closing_wait) ||
5126 (ss->xmit_fifo_size != state->xmit_fifo_size) ||
5127 ((ss->flags & ~ASYNC_USR_MASK) !=
5128 (port->flags & ~ASYNC_USR_MASK))) {
5129 diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
5130 index 3a1a5e0ee93f1..1254b39074edb 100644
5131 --- a/drivers/tty/moxa.c
5132 +++ b/drivers/tty/moxa.c
5133 @@ -2040,7 +2040,7 @@ static int moxa_get_serial_info(struct tty_struct *tty,
5134 ss->line = info->port.tty->index,
5135 ss->flags = info->port.flags,
5136 ss->baud_base = 921600,
5137 - ss->close_delay = info->port.close_delay;
5138 + ss->close_delay = jiffies_to_msecs(info->port.close_delay) / 10;
5139 mutex_unlock(&info->port.mutex);
5140 return 0;
5141 }
5142 @@ -2050,6 +2050,7 @@ static int moxa_set_serial_info(struct tty_struct *tty,
5143 struct serial_struct *ss)
5144 {
5145 struct moxa_port *info = tty->driver_data;
5146 + unsigned int close_delay;
5147
5148 if (tty->index == MAX_PORTS)
5149 return -EINVAL;
5150 @@ -2061,19 +2062,24 @@ static int moxa_set_serial_info(struct tty_struct *tty,
5151 ss->baud_base != 921600)
5152 return -EPERM;
5153
5154 + close_delay = msecs_to_jiffies(ss->close_delay * 10);
5155 +
5156 mutex_lock(&info->port.mutex);
5157 if (!capable(CAP_SYS_ADMIN)) {
5158 - if (((ss->flags & ~ASYNC_USR_MASK) !=
5159 + if (close_delay != info->port.close_delay ||
5160 + ss->type != info->type ||
5161 + ((ss->flags & ~ASYNC_USR_MASK) !=
5162 (info->port.flags & ~ASYNC_USR_MASK))) {
5163 mutex_unlock(&info->port.mutex);
5164 return -EPERM;
5165 }
5166 - }
5167 - info->port.close_delay = ss->close_delay * HZ / 100;
5168 + } else {
5169 + info->port.close_delay = close_delay;
5170
5171 - MoxaSetFifo(info, ss->type == PORT_16550A);
5172 + MoxaSetFifo(info, ss->type == PORT_16550A);
5173
5174 - info->type = ss->type;
5175 + info->type = ss->type;
5176 + }
5177 mutex_unlock(&info->port.mutex);
5178 return 0;
5179 }
5180 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
5181 index ad262349703bf..e2ab6524119a5 100644
5182 --- a/drivers/tty/serial/serial_core.c
5183 +++ b/drivers/tty/serial/serial_core.c
5184 @@ -1304,7 +1304,7 @@ static int uart_set_rs485_config(struct uart_port *port,
5185 unsigned long flags;
5186
5187 if (!port->rs485_config)
5188 - return -ENOIOCTLCMD;
5189 + return -ENOTTY;
5190
5191 if (copy_from_user(&rs485, rs485_user, sizeof(*rs485_user)))
5192 return -EFAULT;
5193 @@ -1328,7 +1328,7 @@ static int uart_get_iso7816_config(struct uart_port *port,
5194 struct serial_iso7816 aux;
5195
5196 if (!port->iso7816_config)
5197 - return -ENOIOCTLCMD;
5198 + return -ENOTTY;
5199
5200 spin_lock_irqsave(&port->lock, flags);
5201 aux = port->iso7816;
5202 @@ -1348,7 +1348,7 @@ static int uart_set_iso7816_config(struct uart_port *port,
5203 unsigned long flags;
5204
5205 if (!port->iso7816_config)
5206 - return -ENOIOCTLCMD;
5207 + return -ENOTTY;
5208
5209 if (copy_from_user(&iso7816, iso7816_user, sizeof(*iso7816_user)))
5210 return -EFAULT;
5211 diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
5212 index bf83e6c212f59..23b7bdae173c8 100644
5213 --- a/drivers/tty/serial/stm32-usart.c
5214 +++ b/drivers/tty/serial/stm32-usart.c
5215 @@ -502,7 +502,10 @@ static unsigned int stm32_tx_empty(struct uart_port *port)
5216 struct stm32_port *stm32_port = to_stm32_port(port);
5217 struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
5218
5219 - return readl_relaxed(port->membase + ofs->isr) & USART_SR_TXE;
5220 + if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC)
5221 + return TIOCSER_TEMT;
5222 +
5223 + return 0;
5224 }
5225
5226 static void stm32_set_mctrl(struct uart_port *port, unsigned int mctrl)
5227 @@ -688,8 +691,9 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
5228 unsigned int baud, bits;
5229 u32 usartdiv, mantissa, fraction, oversampling;
5230 tcflag_t cflag = termios->c_cflag;
5231 - u32 cr1, cr2, cr3;
5232 + u32 cr1, cr2, cr3, isr;
5233 unsigned long flags;
5234 + int ret;
5235
5236 if (!stm32_port->hw_flow_control)
5237 cflag &= ~CRTSCTS;
5238 @@ -698,6 +702,15 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
5239
5240 spin_lock_irqsave(&port->lock, flags);
5241
5242 + ret = readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr,
5243 + isr,
5244 + (isr & USART_SR_TC),
5245 + 10, 100000);
5246 +
5247 + /* Send the TC error message only when ISR_TC is not set. */
5248 + if (ret)
5249 + dev_err(port->dev, "Transmission is not complete\n");
5250 +
5251 /* Stop serial port and reset value */
5252 writel_relaxed(0, port->membase + ofs->cr1);
5253
5254 diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
5255 index a175c1094dc8d..a0b816e0e89b7 100644
5256 --- a/drivers/tty/serial/stm32-usart.h
5257 +++ b/drivers/tty/serial/stm32-usart.h
5258 @@ -127,9 +127,6 @@ struct stm32_usart_info stm32h7_info = {
5259 /* Dummy bits */
5260 #define USART_SR_DUMMY_RX BIT(16)
5261
5262 -/* USART_ICR (F7) */
5263 -#define USART_CR_TC BIT(6)
5264 -
5265 /* USART_DR */
5266 #define USART_DR_MASK GENMASK(8, 0)
5267
5268 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
5269 index 642765bf10230..cee7514c3aaf2 100644
5270 --- a/drivers/tty/tty_io.c
5271 +++ b/drivers/tty/tty_io.c
5272 @@ -2407,14 +2407,14 @@ out:
5273 * @p: pointer to result
5274 *
5275 * Obtain the modem status bits from the tty driver if the feature
5276 - * is supported. Return -EINVAL if it is not available.
5277 + * is supported. Return -ENOTTY if it is not available.
5278 *
5279 * Locking: none (up to the driver)
5280 */
5281
5282 static int tty_tiocmget(struct tty_struct *tty, int __user *p)
5283 {
5284 - int retval = -EINVAL;
5285 + int retval = -ENOTTY;
5286
5287 if (tty->ops->tiocmget) {
5288 retval = tty->ops->tiocmget(tty);
5289 @@ -2432,7 +2432,7 @@ static int tty_tiocmget(struct tty_struct *tty, int __user *p)
5290 * @p: pointer to desired bits
5291 *
5292 * Set the modem status bits from the tty driver if the feature
5293 - * is supported. Return -EINVAL if it is not available.
5294 + * is supported. Return -ENOTTY if it is not available.
5295 *
5296 * Locking: none (up to the driver)
5297 */
5298 @@ -2444,7 +2444,7 @@ static int tty_tiocmset(struct tty_struct *tty, unsigned int cmd,
5299 unsigned int set, clear, val;
5300
5301 if (tty->ops->tiocmset == NULL)
5302 - return -EINVAL;
5303 + return -ENOTTY;
5304
5305 retval = get_user(val, p);
5306 if (retval)
5307 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
5308 index 68d57b45273aa..1e9aab6118f51 100644
5309 --- a/drivers/usb/class/cdc-acm.c
5310 +++ b/drivers/usb/class/cdc-acm.c
5311 @@ -928,8 +928,7 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
5312 {
5313 struct acm *acm = tty->driver_data;
5314
5315 - ss->xmit_fifo_size = acm->writesize;
5316 - ss->baud_base = le32_to_cpu(acm->line.dwDTERate);
5317 + ss->line = acm->minor;
5318 ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
5319 ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
5320 ASYNC_CLOSING_WAIT_NONE :
5321 @@ -941,7 +940,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
5322 {
5323 struct acm *acm = tty->driver_data;
5324 unsigned int closing_wait, close_delay;
5325 - unsigned int old_closing_wait, old_close_delay;
5326 int retval = 0;
5327
5328 close_delay = msecs_to_jiffies(ss->close_delay * 10);
5329 @@ -949,20 +947,12 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
5330 ASYNC_CLOSING_WAIT_NONE :
5331 msecs_to_jiffies(ss->closing_wait * 10);
5332
5333 - /* we must redo the rounding here, so that the values match */
5334 - old_close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
5335 - old_closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
5336 - ASYNC_CLOSING_WAIT_NONE :
5337 - jiffies_to_msecs(acm->port.closing_wait) / 10;
5338 -
5339 mutex_lock(&acm->port.mutex);
5340
5341 if (!capable(CAP_SYS_ADMIN)) {
5342 - if ((ss->close_delay != old_close_delay) ||
5343 - (ss->closing_wait != old_closing_wait))
5344 + if ((close_delay != acm->port.close_delay) ||
5345 + (closing_wait != acm->port.closing_wait))
5346 retval = -EPERM;
5347 - else
5348 - retval = -EOPNOTSUPP;
5349 } else {
5350 acm->port.close_delay = close_delay;
5351 acm->port.closing_wait = closing_wait;
5352 diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
5353 index f73e78143ad14..9da27ec22d588 100644
5354 --- a/drivers/usb/dwc2/core_intr.c
5355 +++ b/drivers/usb/dwc2/core_intr.c
5356 @@ -665,6 +665,71 @@ static u32 dwc2_read_common_intr(struct dwc2_hsotg *hsotg)
5357 return 0;
5358 }
5359
5360 +/**
5361 + * dwc_handle_gpwrdn_disc_det() - Handles the gpwrdn disconnect detect.
5362 + * Exits hibernation without restoring registers.
5363 + *
5364 + * @hsotg: Programming view of DWC_otg controller
5365 + * @gpwrdn: GPWRDN register
5366 + */
5367 +static inline void dwc_handle_gpwrdn_disc_det(struct dwc2_hsotg *hsotg,
5368 + u32 gpwrdn)
5369 +{
5370 + u32 gpwrdn_tmp;
5371 +
5372 + /* Switch-on voltage to the core */
5373 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5374 + gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH;
5375 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5376 + udelay(5);
5377 +
5378 + /* Reset core */
5379 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5380 + gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN;
5381 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5382 + udelay(5);
5383 +
5384 + /* Disable Power Down Clamp */
5385 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5386 + gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP;
5387 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5388 + udelay(5);
5389 +
5390 + /* Deassert reset core */
5391 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5392 + gpwrdn_tmp |= GPWRDN_PWRDNRSTN;
5393 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5394 + udelay(5);
5395 +
5396 + /* Disable PMU interrupt */
5397 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5398 + gpwrdn_tmp &= ~GPWRDN_PMUINTSEL;
5399 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5400 +
5401 + /* De-assert Wakeup Logic */
5402 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5403 + gpwrdn_tmp &= ~GPWRDN_PMUACTV;
5404 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5405 +
5406 + hsotg->hibernated = 0;
5407 + hsotg->bus_suspended = 0;
5408 +
5409 + if (gpwrdn & GPWRDN_IDSTS) {
5410 + hsotg->op_state = OTG_STATE_B_PERIPHERAL;
5411 + dwc2_core_init(hsotg, false);
5412 + dwc2_enable_global_interrupts(hsotg);
5413 + dwc2_hsotg_core_init_disconnected(hsotg, false);
5414 + dwc2_hsotg_core_connect(hsotg);
5415 + } else {
5416 + hsotg->op_state = OTG_STATE_A_HOST;
5417 +
5418 + /* Initialize the Core for Host mode */
5419 + dwc2_core_init(hsotg, false);
5420 + dwc2_enable_global_interrupts(hsotg);
5421 + dwc2_hcd_start(hsotg);
5422 + }
5423 +}
5424 +
5425 /*
5426 * GPWRDN interrupt handler.
5427 *
5428 @@ -686,64 +751,14 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg)
5429
5430 if ((gpwrdn & GPWRDN_DISCONN_DET) &&
5431 (gpwrdn & GPWRDN_DISCONN_DET_MSK) && !linestate) {
5432 - u32 gpwrdn_tmp;
5433 -
5434 dev_dbg(hsotg->dev, "%s: GPWRDN_DISCONN_DET\n", __func__);
5435 -
5436 - /* Switch-on voltage to the core */
5437 - gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5438 - gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH;
5439 - dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5440 - udelay(10);
5441 -
5442 - /* Reset core */
5443 - gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5444 - gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN;
5445 - dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5446 - udelay(10);
5447 -
5448 - /* Disable Power Down Clamp */
5449 - gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5450 - gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP;
5451 - dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5452 - udelay(10);
5453 -
5454 - /* Deassert reset core */
5455 - gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5456 - gpwrdn_tmp |= GPWRDN_PWRDNRSTN;
5457 - dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5458 - udelay(10);
5459 -
5460 - /* Disable PMU interrupt */
5461 - gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5462 - gpwrdn_tmp &= ~GPWRDN_PMUINTSEL;
5463 - dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5464 -
5465 - /* De-assert Wakeup Logic */
5466 - gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN);
5467 - gpwrdn_tmp &= ~GPWRDN_PMUACTV;
5468 - dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN);
5469 -
5470 - hsotg->hibernated = 0;
5471 -
5472 - if (gpwrdn & GPWRDN_IDSTS) {
5473 - hsotg->op_state = OTG_STATE_B_PERIPHERAL;
5474 - dwc2_core_init(hsotg, false);
5475 - dwc2_enable_global_interrupts(hsotg);
5476 - dwc2_hsotg_core_init_disconnected(hsotg, false);
5477 - dwc2_hsotg_core_connect(hsotg);
5478 - } else {
5479 - hsotg->op_state = OTG_STATE_A_HOST;
5480 -
5481 - /* Initialize the Core for Host mode */
5482 - dwc2_core_init(hsotg, false);
5483 - dwc2_enable_global_interrupts(hsotg);
5484 - dwc2_hcd_start(hsotg);
5485 - }
5486 - }
5487 -
5488 - if ((gpwrdn & GPWRDN_LNSTSCHG) &&
5489 - (gpwrdn & GPWRDN_LNSTSCHG_MSK) && linestate) {
5490 + /*
5491 + * Call disconnect detect function to exit from
5492 + * hibernation
5493 + */
5494 + dwc_handle_gpwrdn_disc_det(hsotg, gpwrdn);
5495 + } else if ((gpwrdn & GPWRDN_LNSTSCHG) &&
5496 + (gpwrdn & GPWRDN_LNSTSCHG_MSK) && linestate) {
5497 dev_dbg(hsotg->dev, "%s: GPWRDN_LNSTSCHG\n", __func__);
5498 if (hsotg->hw_params.hibernation &&
5499 hsotg->hibernated) {
5500 @@ -754,24 +769,21 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg)
5501 dwc2_exit_hibernation(hsotg, 1, 0, 1);
5502 }
5503 }
5504 - }
5505 - if ((gpwrdn & GPWRDN_RST_DET) && (gpwrdn & GPWRDN_RST_DET_MSK)) {
5506 + } else if ((gpwrdn & GPWRDN_RST_DET) &&
5507 + (gpwrdn & GPWRDN_RST_DET_MSK)) {
5508 dev_dbg(hsotg->dev, "%s: GPWRDN_RST_DET\n", __func__);
5509 if (!linestate && (gpwrdn & GPWRDN_BSESSVLD))
5510 dwc2_exit_hibernation(hsotg, 0, 1, 0);
5511 - }
5512 - if ((gpwrdn & GPWRDN_STS_CHGINT) &&
5513 - (gpwrdn & GPWRDN_STS_CHGINT_MSK) && linestate) {
5514 + } else if ((gpwrdn & GPWRDN_STS_CHGINT) &&
5515 + (gpwrdn & GPWRDN_STS_CHGINT_MSK)) {
5516 dev_dbg(hsotg->dev, "%s: GPWRDN_STS_CHGINT\n", __func__);
5517 - if (hsotg->hw_params.hibernation &&
5518 - hsotg->hibernated) {
5519 - if (gpwrdn & GPWRDN_IDSTS) {
5520 - dwc2_exit_hibernation(hsotg, 0, 0, 0);
5521 - call_gadget(hsotg, resume);
5522 - } else {
5523 - dwc2_exit_hibernation(hsotg, 1, 0, 1);
5524 - }
5525 - }
5526 + /*
5527 + * As GPWRDN_STS_CHGINT exit from hibernation flow is
5528 + * the same as in GPWRDN_DISCONN_DET flow. Call
5529 + * disconnect detect helper function to exit from
5530 + * hibernation.
5531 + */
5532 + dwc_handle_gpwrdn_disc_det(hsotg, gpwrdn);
5533 }
5534 }
5535
5536 diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
5537 index 258056c822069..f29fbadb05487 100644
5538 --- a/drivers/usb/dwc2/hcd.c
5539 +++ b/drivers/usb/dwc2/hcd.c
5540 @@ -5580,7 +5580,15 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup,
5541 return ret;
5542 }
5543
5544 - dwc2_hcd_rem_wakeup(hsotg);
5545 + if (rem_wakeup) {
5546 + dwc2_hcd_rem_wakeup(hsotg);
5547 + /*
5548 + * Change "port_connect_status_change" flag to re-enumerate,
5549 + * because after exit from hibernation port connection status
5550 + * is not detected.
5551 + */
5552 + hsotg->flags.b.port_connect_status_change = 1;
5553 + }
5554
5555 hsotg->hibernated = 0;
5556 hsotg->bus_suspended = 0;
5557 diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
5558 index 90b134d5dca95..c1bfbfd9491dc 100644
5559 --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
5560 +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
5561 @@ -36,6 +36,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
5562 int status)
5563 {
5564 bool internal = req->internal;
5565 + struct ast_vhub *vhub = ep->vhub;
5566
5567 EPVDBG(ep, "completing request @%p, status %d\n", req, status);
5568
5569 @@ -46,7 +47,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
5570
5571 if (req->req.dma) {
5572 if (!WARN_ON(!ep->dev))
5573 - usb_gadget_unmap_request(&ep->dev->gadget,
5574 + usb_gadget_unmap_request_by_dev(&vhub->pdev->dev,
5575 &req->req, ep->epn.is_in);
5576 req->req.dma = 0;
5577 }
5578 diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
5579 index 66d8884615f0e..2cd406e8dd993 100644
5580 --- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c
5581 +++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
5582 @@ -376,7 +376,7 @@ static int ast_vhub_epn_queue(struct usb_ep* u_ep, struct usb_request *u_req,
5583 if (ep->epn.desc_mode ||
5584 ((((unsigned long)u_req->buf & 7) == 0) &&
5585 (ep->epn.is_in || !(u_req->length & (u_ep->maxpacket - 1))))) {
5586 - rc = usb_gadget_map_request(&ep->dev->gadget, u_req,
5587 + rc = usb_gadget_map_request_by_dev(&vhub->pdev->dev, u_req,
5588 ep->epn.is_in);
5589 if (rc) {
5590 dev_warn(&vhub->pdev->dev,
5591 diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
5592 index 21f3e6c4e4d64..c313d07ec16fd 100644
5593 --- a/drivers/usb/gadget/udc/fotg210-udc.c
5594 +++ b/drivers/usb/gadget/udc/fotg210-udc.c
5595 @@ -338,15 +338,16 @@ static void fotg210_start_dma(struct fotg210_ep *ep,
5596 } else {
5597 buffer = req->req.buf + req->req.actual;
5598 length = ioread32(ep->fotg210->reg +
5599 - FOTG210_FIBCR(ep->epnum - 1));
5600 - length &= FIBCR_BCFX;
5601 + FOTG210_FIBCR(ep->epnum - 1)) & FIBCR_BCFX;
5602 + if (length > req->req.length - req->req.actual)
5603 + length = req->req.length - req->req.actual;
5604 }
5605 } else {
5606 buffer = req->req.buf + req->req.actual;
5607 if (req->req.length - req->req.actual > ep->ep.maxpacket)
5608 length = ep->ep.maxpacket;
5609 else
5610 - length = req->req.length;
5611 + length = req->req.length - req->req.actual;
5612 }
5613
5614 d = dma_map_single(dev, buffer, length,
5615 @@ -379,8 +380,7 @@ static void fotg210_ep0_queue(struct fotg210_ep *ep,
5616 }
5617 if (ep->dir_in) { /* if IN */
5618 fotg210_start_dma(ep, req);
5619 - if ((req->req.length == req->req.actual) ||
5620 - (req->req.actual < ep->ep.maxpacket))
5621 + if (req->req.length == req->req.actual)
5622 fotg210_done(ep, req, 0);
5623 } else { /* OUT */
5624 u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR0);
5625 @@ -820,7 +820,7 @@ static void fotg210_ep0in(struct fotg210_udc *fotg210)
5626 if (req->req.length)
5627 fotg210_start_dma(ep, req);
5628
5629 - if ((req->req.length - req->req.actual) < ep->ep.maxpacket)
5630 + if (req->req.actual == req->req.length)
5631 fotg210_done(ep, req, 0);
5632 } else {
5633 fotg210_set_cxdone(fotg210);
5634 @@ -849,12 +849,16 @@ static void fotg210_out_fifo_handler(struct fotg210_ep *ep)
5635 {
5636 struct fotg210_request *req = list_entry(ep->queue.next,
5637 struct fotg210_request, queue);
5638 + int disgr1 = ioread32(ep->fotg210->reg + FOTG210_DISGR1);
5639
5640 fotg210_start_dma(ep, req);
5641
5642 - /* finish out transfer */
5643 + /* Complete the request when it's full or a short packet arrived.
5644 + * Like other drivers, short_not_ok isn't handled.
5645 + */
5646 +
5647 if (req->req.length == req->req.actual ||
5648 - req->req.actual < ep->ep.maxpacket)
5649 + (disgr1 & DISGR1_SPK_INT(ep->epnum - 1)))
5650 fotg210_done(ep, req, 0);
5651 }
5652
5653 @@ -1027,6 +1031,12 @@ static void fotg210_init(struct fotg210_udc *fotg210)
5654 value &= ~DMCR_GLINT_EN;
5655 iowrite32(value, fotg210->reg + FOTG210_DMCR);
5656
5657 + /* enable only grp2 irqs we handle */
5658 + iowrite32(~(DISGR2_DMA_ERROR | DISGR2_RX0BYTE_INT | DISGR2_TX0BYTE_INT
5659 + | DISGR2_ISO_SEQ_ABORT_INT | DISGR2_ISO_SEQ_ERR_INT
5660 + | DISGR2_RESM_INT | DISGR2_SUSP_INT | DISGR2_USBRST_INT),
5661 + fotg210->reg + FOTG210_DMISGR2);
5662 +
5663 /* disable all fifo interrupt */
5664 iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1);
5665
5666 diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
5667 index 3344fb8c41811..da8aeecc59b2c 100644
5668 --- a/drivers/usb/gadget/udc/pch_udc.c
5669 +++ b/drivers/usb/gadget/udc/pch_udc.c
5670 @@ -600,18 +600,22 @@ static void pch_udc_reconnect(struct pch_udc_dev *dev)
5671 static inline void pch_udc_vbus_session(struct pch_udc_dev *dev,
5672 int is_active)
5673 {
5674 + unsigned long iflags;
5675 +
5676 + spin_lock_irqsave(&dev->lock, iflags);
5677 if (is_active) {
5678 pch_udc_reconnect(dev);
5679 dev->vbus_session = 1;
5680 } else {
5681 if (dev->driver && dev->driver->disconnect) {
5682 - spin_lock(&dev->lock);
5683 + spin_unlock_irqrestore(&dev->lock, iflags);
5684 dev->driver->disconnect(&dev->gadget);
5685 - spin_unlock(&dev->lock);
5686 + spin_lock_irqsave(&dev->lock, iflags);
5687 }
5688 pch_udc_set_disconnect(dev);
5689 dev->vbus_session = 0;
5690 }
5691 + spin_unlock_irqrestore(&dev->lock, iflags);
5692 }
5693
5694 /**
5695 @@ -1168,20 +1172,25 @@ static int pch_udc_pcd_selfpowered(struct usb_gadget *gadget, int value)
5696 static int pch_udc_pcd_pullup(struct usb_gadget *gadget, int is_on)
5697 {
5698 struct pch_udc_dev *dev;
5699 + unsigned long iflags;
5700
5701 if (!gadget)
5702 return -EINVAL;
5703 +
5704 dev = container_of(gadget, struct pch_udc_dev, gadget);
5705 +
5706 + spin_lock_irqsave(&dev->lock, iflags);
5707 if (is_on) {
5708 pch_udc_reconnect(dev);
5709 } else {
5710 if (dev->driver && dev->driver->disconnect) {
5711 - spin_lock(&dev->lock);
5712 + spin_unlock_irqrestore(&dev->lock, iflags);
5713 dev->driver->disconnect(&dev->gadget);
5714 - spin_unlock(&dev->lock);
5715 + spin_lock_irqsave(&dev->lock, iflags);
5716 }
5717 pch_udc_set_disconnect(dev);
5718 }
5719 + spin_unlock_irqrestore(&dev->lock, iflags);
5720
5721 return 0;
5722 }
5723 @@ -1773,7 +1782,7 @@ static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep,
5724 }
5725 /* prevent from using desc. - set HOST BUSY */
5726 dma_desc->status |= PCH_UDC_BS_HST_BSY;
5727 - dma_desc->dataptr = cpu_to_le32(DMA_ADDR_INVALID);
5728 + dma_desc->dataptr = lower_32_bits(DMA_ADDR_INVALID);
5729 req->td_data = dma_desc;
5730 req->td_data_last = dma_desc;
5731 req->chain_len = 1;
5732 @@ -2316,6 +2325,21 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num)
5733 pch_udc_set_dma(dev, DMA_DIR_RX);
5734 }
5735
5736 +static int pch_udc_gadget_setup(struct pch_udc_dev *dev)
5737 + __must_hold(&dev->lock)
5738 +{
5739 + int rc;
5740 +
5741 + /* In some cases we can get an interrupt before driver gets setup */
5742 + if (!dev->driver)
5743 + return -ESHUTDOWN;
5744 +
5745 + spin_unlock(&dev->lock);
5746 + rc = dev->driver->setup(&dev->gadget, &dev->setup_data);
5747 + spin_lock(&dev->lock);
5748 + return rc;
5749 +}
5750 +
5751 /**
5752 * pch_udc_svc_control_in() - Handle Control IN endpoint interrupts
5753 * @dev: Reference to the device structure
5754 @@ -2387,15 +2411,12 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev)
5755 dev->gadget.ep0 = &dev->ep[UDC_EP0IN_IDX].ep;
5756 else /* OUT */
5757 dev->gadget.ep0 = &ep->ep;
5758 - spin_lock(&dev->lock);
5759 /* If Mass storage Reset */
5760 if ((dev->setup_data.bRequestType == 0x21) &&
5761 (dev->setup_data.bRequest == 0xFF))
5762 dev->prot_stall = 0;
5763 /* call gadget with setup data received */
5764 - setup_supported = dev->driver->setup(&dev->gadget,
5765 - &dev->setup_data);
5766 - spin_unlock(&dev->lock);
5767 + setup_supported = pch_udc_gadget_setup(dev);
5768
5769 if (dev->setup_data.bRequestType & USB_DIR_IN) {
5770 ep->td_data->status = (ep->td_data->status &
5771 @@ -2643,9 +2664,7 @@ static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev)
5772 dev->ep[i].halted = 0;
5773 }
5774 dev->stall = 0;
5775 - spin_unlock(&dev->lock);
5776 - dev->driver->setup(&dev->gadget, &dev->setup_data);
5777 - spin_lock(&dev->lock);
5778 + pch_udc_gadget_setup(dev);
5779 }
5780
5781 /**
5782 @@ -2680,9 +2699,7 @@ static void pch_udc_svc_cfg_interrupt(struct pch_udc_dev *dev)
5783 dev->stall = 0;
5784
5785 /* call gadget zero with setup data received */
5786 - spin_unlock(&dev->lock);
5787 - dev->driver->setup(&dev->gadget, &dev->setup_data);
5788 - spin_lock(&dev->lock);
5789 + pch_udc_gadget_setup(dev);
5790 }
5791
5792 /**
5793 @@ -2956,7 +2973,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
5794 dev->dma_addr = dma_map_single(&dev->pdev->dev, ep0out_buf,
5795 UDC_EP0OUT_BUFF_SIZE * 4,
5796 DMA_FROM_DEVICE);
5797 - return 0;
5798 + return dma_mapping_error(&dev->pdev->dev, dev->dma_addr);
5799 }
5800
5801 static int pch_udc_start(struct usb_gadget *g,
5802 diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
5803 index 11e25a3f4f1fa..a766476fd742e 100644
5804 --- a/drivers/usb/gadget/udc/r8a66597-udc.c
5805 +++ b/drivers/usb/gadget/udc/r8a66597-udc.c
5806 @@ -1852,6 +1852,8 @@ static int r8a66597_probe(struct platform_device *pdev)
5807 return PTR_ERR(reg);
5808
5809 ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
5810 + if (!ires)
5811 + return -EINVAL;
5812 irq = ires->start;
5813 irq_trigger = ires->flags & IRQF_TRIGGER_MASK;
5814
5815 diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c
5816 index 32f1d3e90c264..99805d60a7ab3 100644
5817 --- a/drivers/usb/gadget/udc/snps_udc_plat.c
5818 +++ b/drivers/usb/gadget/udc/snps_udc_plat.c
5819 @@ -114,8 +114,8 @@ static int udc_plat_probe(struct platform_device *pdev)
5820
5821 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5822 udc->virt_addr = devm_ioremap_resource(dev, res);
5823 - if (IS_ERR(udc->regs))
5824 - return PTR_ERR(udc->regs);
5825 + if (IS_ERR(udc->virt_addr))
5826 + return PTR_ERR(udc->virt_addr);
5827
5828 /* udc csr registers base */
5829 udc->csr = udc->virt_addr + UDC_CSR_ADDR;
5830 diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
5831 index b45e5bf089979..8950d1f10a7fb 100644
5832 --- a/drivers/usb/host/xhci-mtk-sch.c
5833 +++ b/drivers/usb/host/xhci-mtk-sch.c
5834 @@ -378,6 +378,31 @@ static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw,
5835 sch_ep->allocated = used;
5836 }
5837
5838 +static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
5839 +{
5840 + struct mu3h_sch_tt *tt = sch_ep->sch_tt;
5841 + u32 num_esit, tmp;
5842 + int base;
5843 + int i, j;
5844 +
5845 + num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
5846 + for (i = 0; i < num_esit; i++) {
5847 + base = offset + i * sch_ep->esit;
5848 +
5849 + /*
5850 + * Compared with hs bus, no matter what ep type,
5851 + * the hub will always delay one uframe to send data
5852 + */
5853 + for (j = 0; j < sch_ep->cs_count; j++) {
5854 + tmp = tt->fs_bus_bw[base + j] + sch_ep->bw_cost_per_microframe;
5855 + if (tmp > FS_PAYLOAD_MAX)
5856 + return -ERANGE;
5857 + }
5858 + }
5859 +
5860 + return 0;
5861 +}
5862 +
5863 static int check_sch_tt(struct usb_device *udev,
5864 struct mu3h_sch_ep_info *sch_ep, u32 offset)
5865 {
5866 @@ -402,7 +427,7 @@ static int check_sch_tt(struct usb_device *udev,
5867 return -ERANGE;
5868
5869 for (i = 0; i < sch_ep->cs_count; i++)
5870 - if (test_bit(offset + i, tt->split_bit_map))
5871 + if (test_bit(offset + i, tt->ss_bit_map))
5872 return -ERANGE;
5873
5874 } else {
5875 @@ -432,7 +457,7 @@ static int check_sch_tt(struct usb_device *udev,
5876 cs_count = 7; /* HW limit */
5877
5878 for (i = 0; i < cs_count + 2; i++) {
5879 - if (test_bit(offset + i, tt->split_bit_map))
5880 + if (test_bit(offset + i, tt->ss_bit_map))
5881 return -ERANGE;
5882 }
5883
5884 @@ -448,24 +473,44 @@ static int check_sch_tt(struct usb_device *udev,
5885 sch_ep->num_budget_microframes = sch_ep->esit;
5886 }
5887
5888 - return 0;
5889 + return check_fs_bus_bw(sch_ep, offset);
5890 }
5891
5892 static void update_sch_tt(struct usb_device *udev,
5893 - struct mu3h_sch_ep_info *sch_ep)
5894 + struct mu3h_sch_ep_info *sch_ep, bool used)
5895 {
5896 struct mu3h_sch_tt *tt = sch_ep->sch_tt;
5897 u32 base, num_esit;
5898 + int bw_updated;
5899 + int bits;
5900 int i, j;
5901
5902 num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
5903 + bits = (sch_ep->ep_type == ISOC_OUT_EP) ? sch_ep->cs_count : 1;
5904 +
5905 + if (used)
5906 + bw_updated = sch_ep->bw_cost_per_microframe;
5907 + else
5908 + bw_updated = -sch_ep->bw_cost_per_microframe;
5909 +
5910 for (i = 0; i < num_esit; i++) {
5911 base = sch_ep->offset + i * sch_ep->esit;
5912 - for (j = 0; j < sch_ep->num_budget_microframes; j++)
5913 - set_bit(base + j, tt->split_bit_map);
5914 +
5915 + for (j = 0; j < bits; j++) {
5916 + if (used)
5917 + set_bit(base + j, tt->ss_bit_map);
5918 + else
5919 + clear_bit(base + j, tt->ss_bit_map);
5920 + }
5921 +
5922 + for (j = 0; j < sch_ep->cs_count; j++)
5923 + tt->fs_bus_bw[base + j] += bw_updated;
5924 }
5925
5926 - list_add_tail(&sch_ep->tt_endpoint, &tt->ep_list);
5927 + if (used)
5928 + list_add_tail(&sch_ep->tt_endpoint, &tt->ep_list);
5929 + else
5930 + list_del(&sch_ep->tt_endpoint);
5931 }
5932
5933 static int check_sch_bw(struct usb_device *udev,
5934 @@ -535,7 +580,7 @@ static int check_sch_bw(struct usb_device *udev,
5935 if (!tt_offset_ok)
5936 return -ERANGE;
5937
5938 - update_sch_tt(udev, sch_ep);
5939 + update_sch_tt(udev, sch_ep, 1);
5940 }
5941
5942 /* update bus bandwidth info */
5943 @@ -548,15 +593,16 @@ static void destroy_sch_ep(struct usb_device *udev,
5944 struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep)
5945 {
5946 /* only release ep bw check passed by check_sch_bw() */
5947 - if (sch_ep->allocated)
5948 + if (sch_ep->allocated) {
5949 update_bus_bw(sch_bw, sch_ep, 0);
5950 + if (sch_ep->sch_tt)
5951 + update_sch_tt(udev, sch_ep, 0);
5952 + }
5953
5954 - list_del(&sch_ep->endpoint);
5955 -
5956 - if (sch_ep->sch_tt) {
5957 - list_del(&sch_ep->tt_endpoint);
5958 + if (sch_ep->sch_tt)
5959 drop_tt(udev);
5960 - }
5961 +
5962 + list_del(&sch_ep->endpoint);
5963 kfree(sch_ep);
5964 }
5965
5966 @@ -643,7 +689,7 @@ int xhci_mtk_add_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev,
5967 */
5968 if (usb_endpoint_xfer_int(&ep->desc)
5969 || usb_endpoint_xfer_isoc(&ep->desc))
5970 - ep_ctx->reserved[0] |= cpu_to_le32(EP_BPKTS(1));
5971 + ep_ctx->reserved[0] = cpu_to_le32(EP_BPKTS(1));
5972
5973 return 0;
5974 }
5975 @@ -730,10 +776,10 @@ int xhci_mtk_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
5976 list_move_tail(&sch_ep->endpoint, &sch_bw->bw_ep_list);
5977
5978 ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
5979 - ep_ctx->reserved[0] |= cpu_to_le32(EP_BPKTS(sch_ep->pkts)
5980 + ep_ctx->reserved[0] = cpu_to_le32(EP_BPKTS(sch_ep->pkts)
5981 | EP_BCSCOUNT(sch_ep->cs_count)
5982 | EP_BBM(sch_ep->burst_mode));
5983 - ep_ctx->reserved[1] |= cpu_to_le32(EP_BOFFSET(sch_ep->offset)
5984 + ep_ctx->reserved[1] = cpu_to_le32(EP_BOFFSET(sch_ep->offset)
5985 | EP_BREPEAT(sch_ep->repeat));
5986
5987 xhci_dbg(xhci, " PKTS:%x, CSCOUNT:%x, BM:%x, OFFSET:%x, REPEAT:%x\n",
5988 diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
5989 index d9f438d078daf..985e7a19f6f6c 100644
5990 --- a/drivers/usb/host/xhci-mtk.h
5991 +++ b/drivers/usb/host/xhci-mtk.h
5992 @@ -20,13 +20,15 @@
5993 #define XHCI_MTK_MAX_ESIT 64
5994
5995 /**
5996 - * @split_bit_map: used to avoid split microframes overlay
5997 + * @ss_bit_map: used to avoid start split microframes overlay
5998 + * @fs_bus_bw: array to keep track of bandwidth already used for FS
5999 * @ep_list: Endpoints using this TT
6000 * @usb_tt: usb TT related
6001 * @tt_port: TT port number
6002 */
6003 struct mu3h_sch_tt {
6004 - DECLARE_BITMAP(split_bit_map, XHCI_MTK_MAX_ESIT);
6005 + DECLARE_BITMAP(ss_bit_map, XHCI_MTK_MAX_ESIT);
6006 + u32 fs_bus_bw[XHCI_MTK_MAX_ESIT];
6007 struct list_head ep_list;
6008 struct usb_tt *usb_tt;
6009 int tt_port;
6010 diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
6011 index ef23acc9b9ce4..b1449d4914cca 100644
6012 --- a/drivers/usb/serial/ti_usb_3410_5052.c
6013 +++ b/drivers/usb/serial/ti_usb_3410_5052.c
6014 @@ -1420,14 +1420,19 @@ static int ti_set_serial_info(struct tty_struct *tty,
6015 struct serial_struct *ss)
6016 {
6017 struct usb_serial_port *port = tty->driver_data;
6018 - struct ti_port *tport = usb_get_serial_port_data(port);
6019 + struct tty_port *tport = &port->port;
6020 unsigned cwait;
6021
6022 cwait = ss->closing_wait;
6023 if (cwait != ASYNC_CLOSING_WAIT_NONE)
6024 cwait = msecs_to_jiffies(10 * ss->closing_wait);
6025
6026 - tport->tp_port->port.closing_wait = cwait;
6027 + if (!capable(CAP_SYS_ADMIN)) {
6028 + if (cwait != tport->closing_wait)
6029 + return -EPERM;
6030 + }
6031 +
6032 + tport->closing_wait = cwait;
6033
6034 return 0;
6035 }
6036 diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
6037 index 4b9845807bee1..b2285d5a869de 100644
6038 --- a/drivers/usb/serial/usb_wwan.c
6039 +++ b/drivers/usb/serial/usb_wwan.c
6040 @@ -140,10 +140,10 @@ int usb_wwan_get_serial_info(struct tty_struct *tty,
6041 ss->line = port->minor;
6042 ss->port = port->port_number;
6043 ss->baud_base = tty_get_baud_rate(port->port.tty);
6044 - ss->close_delay = port->port.close_delay / 10;
6045 + ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10;
6046 ss->closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
6047 ASYNC_CLOSING_WAIT_NONE :
6048 - port->port.closing_wait / 10;
6049 + jiffies_to_msecs(port->port.closing_wait) / 10;
6050 return 0;
6051 }
6052 EXPORT_SYMBOL(usb_wwan_get_serial_info);
6053 @@ -155,9 +155,10 @@ int usb_wwan_set_serial_info(struct tty_struct *tty,
6054 unsigned int closing_wait, close_delay;
6055 int retval = 0;
6056
6057 - close_delay = ss->close_delay * 10;
6058 + close_delay = msecs_to_jiffies(ss->close_delay * 10);
6059 closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ?
6060 - ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10;
6061 + ASYNC_CLOSING_WAIT_NONE :
6062 + msecs_to_jiffies(ss->closing_wait * 10);
6063
6064 mutex_lock(&port->port.mutex);
6065
6066 diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
6067 index 753645bb25273..59e304a341f8a 100644
6068 --- a/drivers/usb/typec/tcpm/tcpci.c
6069 +++ b/drivers/usb/typec/tcpm/tcpci.c
6070 @@ -20,6 +20,15 @@
6071
6072 #define PD_RETRY_COUNT 3
6073
6074 +#define tcpc_presenting_cc1_rd(reg) \
6075 + (!(TCPC_ROLE_CTRL_DRP & (reg)) && \
6076 + (((reg) & (TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT)) == \
6077 + (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC1_SHIFT)))
6078 +#define tcpc_presenting_cc2_rd(reg) \
6079 + (!(TCPC_ROLE_CTRL_DRP & (reg)) && \
6080 + (((reg) & (TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT)) == \
6081 + (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC2_SHIFT)))
6082 +
6083 struct tcpci {
6084 struct device *dev;
6085
6086 @@ -168,19 +177,25 @@ static int tcpci_get_cc(struct tcpc_dev *tcpc,
6087 enum typec_cc_status *cc1, enum typec_cc_status *cc2)
6088 {
6089 struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
6090 - unsigned int reg;
6091 + unsigned int reg, role_control;
6092 int ret;
6093
6094 + ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, &role_control);
6095 + if (ret < 0)
6096 + return ret;
6097 +
6098 ret = regmap_read(tcpci->regmap, TCPC_CC_STATUS, &reg);
6099 if (ret < 0)
6100 return ret;
6101
6102 *cc1 = tcpci_to_typec_cc((reg >> TCPC_CC_STATUS_CC1_SHIFT) &
6103 TCPC_CC_STATUS_CC1_MASK,
6104 - reg & TCPC_CC_STATUS_TERM);
6105 + reg & TCPC_CC_STATUS_TERM ||
6106 + tcpc_presenting_cc1_rd(role_control));
6107 *cc2 = tcpci_to_typec_cc((reg >> TCPC_CC_STATUS_CC2_SHIFT) &
6108 TCPC_CC_STATUS_CC2_MASK,
6109 - reg & TCPC_CC_STATUS_TERM);
6110 + reg & TCPC_CC_STATUS_TERM ||
6111 + tcpc_presenting_cc2_rd(role_control));
6112
6113 return 0;
6114 }
6115 diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
6116 index c595da1761247..b7852a54efb3b 100644
6117 --- a/drivers/usb/typec/tcpm/tcpm.c
6118 +++ b/drivers/usb/typec/tcpm/tcpm.c
6119 @@ -181,12 +181,27 @@ struct pd_mode_data {
6120 struct typec_altmode_desc altmode_desc[ALTMODE_DISCOVERY_MAX];
6121 };
6122
6123 +/*
6124 + * @min_volt: Actual min voltage at the local port
6125 + * @req_min_volt: Requested min voltage to the port partner
6126 + * @max_volt: Actual max voltage at the local port
6127 + * @req_max_volt: Requested max voltage to the port partner
6128 + * @max_curr: Actual max current at the local port
6129 + * @req_max_curr: Requested max current of the port partner
6130 + * @req_out_volt: Requested output voltage to the port partner
6131 + * @req_op_curr: Requested operating current to the port partner
6132 + * @supported: Parter has atleast one APDO hence supports PPS
6133 + * @active: PPS mode is active
6134 + */
6135 struct pd_pps_data {
6136 u32 min_volt;
6137 + u32 req_min_volt;
6138 u32 max_volt;
6139 + u32 req_max_volt;
6140 u32 max_curr;
6141 - u32 out_volt;
6142 - u32 op_curr;
6143 + u32 req_max_curr;
6144 + u32 req_out_volt;
6145 + u32 req_op_curr;
6146 bool supported;
6147 bool active;
6148 };
6149 @@ -285,7 +300,10 @@ struct tcpm_port {
6150 unsigned int operating_snk_mw;
6151 bool update_sink_caps;
6152
6153 - /* Requested current / voltage */
6154 + /* Requested current / voltage to the port partner */
6155 + u32 req_current_limit;
6156 + u32 req_supply_voltage;
6157 + /* Actual current / voltage limit of the local port */
6158 u32 current_limit;
6159 u32 supply_voltage;
6160
6161 @@ -1724,8 +1742,8 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
6162 case SNK_TRANSITION_SINK:
6163 if (port->vbus_present) {
6164 tcpm_set_current_limit(port,
6165 - port->current_limit,
6166 - port->supply_voltage);
6167 + port->req_current_limit,
6168 + port->req_supply_voltage);
6169 port->explicit_contract = true;
6170 tcpm_set_state(port, SNK_READY, 0);
6171 } else {
6172 @@ -1764,8 +1782,8 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
6173 break;
6174 case SNK_NEGOTIATE_PPS_CAPABILITIES:
6175 /* Revert data back from any requested PPS updates */
6176 - port->pps_data.out_volt = port->supply_voltage;
6177 - port->pps_data.op_curr = port->current_limit;
6178 + port->pps_data.req_out_volt = port->supply_voltage;
6179 + port->pps_data.req_op_curr = port->current_limit;
6180 port->pps_status = (type == PD_CTRL_WAIT ?
6181 -EAGAIN : -EOPNOTSUPP);
6182 tcpm_set_state(port, SNK_READY, 0);
6183 @@ -1797,8 +1815,12 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
6184 break;
6185 case SNK_NEGOTIATE_PPS_CAPABILITIES:
6186 port->pps_data.active = true;
6187 - port->supply_voltage = port->pps_data.out_volt;
6188 - port->current_limit = port->pps_data.op_curr;
6189 + port->pps_data.min_volt = port->pps_data.req_min_volt;
6190 + port->pps_data.max_volt = port->pps_data.req_max_volt;
6191 + port->pps_data.max_curr = port->pps_data.req_max_curr;
6192 + port->req_supply_voltage = port->pps_data.req_out_volt;
6193 + port->req_current_limit = port->pps_data.req_op_curr;
6194 + power_supply_changed(port->psy);
6195 tcpm_set_state(port, SNK_TRANSITION_SINK, 0);
6196 break;
6197 case SOFT_RESET_SEND:
6198 @@ -2312,17 +2334,16 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
6199 src = port->source_caps[src_pdo];
6200 snk = port->snk_pdo[snk_pdo];
6201
6202 - port->pps_data.min_volt = max(pdo_pps_apdo_min_voltage(src),
6203 - pdo_pps_apdo_min_voltage(snk));
6204 - port->pps_data.max_volt = min(pdo_pps_apdo_max_voltage(src),
6205 - pdo_pps_apdo_max_voltage(snk));
6206 - port->pps_data.max_curr = min_pps_apdo_current(src, snk);
6207 - port->pps_data.out_volt = min(port->pps_data.max_volt,
6208 - max(port->pps_data.min_volt,
6209 - port->pps_data.out_volt));
6210 - port->pps_data.op_curr = min(port->pps_data.max_curr,
6211 - port->pps_data.op_curr);
6212 - power_supply_changed(port->psy);
6213 + port->pps_data.req_min_volt = max(pdo_pps_apdo_min_voltage(src),
6214 + pdo_pps_apdo_min_voltage(snk));
6215 + port->pps_data.req_max_volt = min(pdo_pps_apdo_max_voltage(src),
6216 + pdo_pps_apdo_max_voltage(snk));
6217 + port->pps_data.req_max_curr = min_pps_apdo_current(src, snk);
6218 + port->pps_data.req_out_volt = min(port->pps_data.max_volt,
6219 + max(port->pps_data.min_volt,
6220 + port->pps_data.req_out_volt));
6221 + port->pps_data.req_op_curr = min(port->pps_data.max_curr,
6222 + port->pps_data.req_op_curr);
6223 }
6224
6225 return src_pdo;
6226 @@ -2402,8 +2423,8 @@ static int tcpm_pd_build_request(struct tcpm_port *port, u32 *rdo)
6227 flags & RDO_CAP_MISMATCH ? " [mismatch]" : "");
6228 }
6229
6230 - port->current_limit = ma;
6231 - port->supply_voltage = mv;
6232 + port->req_current_limit = ma;
6233 + port->req_supply_voltage = mv;
6234
6235 return 0;
6236 }
6237 @@ -2449,10 +2470,10 @@ static int tcpm_pd_build_pps_request(struct tcpm_port *port, u32 *rdo)
6238 tcpm_log(port, "Invalid APDO selected!");
6239 return -EINVAL;
6240 }
6241 - max_mv = port->pps_data.max_volt;
6242 - max_ma = port->pps_data.max_curr;
6243 - out_mv = port->pps_data.out_volt;
6244 - op_ma = port->pps_data.op_curr;
6245 + max_mv = port->pps_data.req_max_volt;
6246 + max_ma = port->pps_data.req_max_curr;
6247 + out_mv = port->pps_data.req_out_volt;
6248 + op_ma = port->pps_data.req_op_curr;
6249 break;
6250 default:
6251 tcpm_log(port, "Invalid PDO selected!");
6252 @@ -2499,8 +2520,8 @@ static int tcpm_pd_build_pps_request(struct tcpm_port *port, u32 *rdo)
6253 tcpm_log(port, "Requesting APDO %d: %u mV, %u mA",
6254 src_pdo_index, out_mv, op_ma);
6255
6256 - port->pps_data.op_curr = op_ma;
6257 - port->pps_data.out_volt = out_mv;
6258 + port->pps_data.req_op_curr = op_ma;
6259 + port->pps_data.req_out_volt = out_mv;
6260
6261 return 0;
6262 }
6263 @@ -2722,8 +2743,6 @@ static void tcpm_reset_port(struct tcpm_port *port)
6264 port->try_src_count = 0;
6265 port->try_snk_count = 0;
6266 port->usb_type = POWER_SUPPLY_USB_TYPE_C;
6267 -
6268 - power_supply_changed(port->psy);
6269 }
6270
6271 static void tcpm_detach(struct tcpm_port *port)
6272 @@ -4171,7 +4190,7 @@ static int tcpm_try_role(const struct typec_capability *cap, int role)
6273 return ret;
6274 }
6275
6276 -static int tcpm_pps_set_op_curr(struct tcpm_port *port, u16 op_curr)
6277 +static int tcpm_pps_set_op_curr(struct tcpm_port *port, u16 req_op_curr)
6278 {
6279 unsigned int target_mw;
6280 int ret;
6281 @@ -4189,22 +4208,22 @@ static int tcpm_pps_set_op_curr(struct tcpm_port *port, u16 op_curr)
6282 goto port_unlock;
6283 }
6284
6285 - if (op_curr > port->pps_data.max_curr) {
6286 + if (req_op_curr > port->pps_data.max_curr) {
6287 ret = -EINVAL;
6288 goto port_unlock;
6289 }
6290
6291 - target_mw = (op_curr * port->pps_data.out_volt) / 1000;
6292 + target_mw = (req_op_curr * port->supply_voltage) / 1000;
6293 if (target_mw < port->operating_snk_mw) {
6294 ret = -EINVAL;
6295 goto port_unlock;
6296 }
6297
6298 /* Round down operating current to align with PPS valid steps */
6299 - op_curr = op_curr - (op_curr % RDO_PROG_CURR_MA_STEP);
6300 + req_op_curr = req_op_curr - (req_op_curr % RDO_PROG_CURR_MA_STEP);
6301
6302 reinit_completion(&port->pps_complete);
6303 - port->pps_data.op_curr = op_curr;
6304 + port->pps_data.req_op_curr = req_op_curr;
6305 port->pps_status = 0;
6306 port->pps_pending = true;
6307 tcpm_set_state(port, SNK_NEGOTIATE_PPS_CAPABILITIES, 0);
6308 @@ -4226,7 +4245,7 @@ swap_unlock:
6309 return ret;
6310 }
6311
6312 -static int tcpm_pps_set_out_volt(struct tcpm_port *port, u16 out_volt)
6313 +static int tcpm_pps_set_out_volt(struct tcpm_port *port, u16 req_out_volt)
6314 {
6315 unsigned int target_mw;
6316 int ret;
6317 @@ -4244,23 +4263,23 @@ static int tcpm_pps_set_out_volt(struct tcpm_port *port, u16 out_volt)
6318 goto port_unlock;
6319 }
6320
6321 - if (out_volt < port->pps_data.min_volt ||
6322 - out_volt > port->pps_data.max_volt) {
6323 + if (req_out_volt < port->pps_data.min_volt ||
6324 + req_out_volt > port->pps_data.max_volt) {
6325 ret = -EINVAL;
6326 goto port_unlock;
6327 }
6328
6329 - target_mw = (port->pps_data.op_curr * out_volt) / 1000;
6330 + target_mw = (port->current_limit * req_out_volt) / 1000;
6331 if (target_mw < port->operating_snk_mw) {
6332 ret = -EINVAL;
6333 goto port_unlock;
6334 }
6335
6336 /* Round down output voltage to align with PPS valid steps */
6337 - out_volt = out_volt - (out_volt % RDO_PROG_VOLT_MV_STEP);
6338 + req_out_volt = req_out_volt - (req_out_volt % RDO_PROG_VOLT_MV_STEP);
6339
6340 reinit_completion(&port->pps_complete);
6341 - port->pps_data.out_volt = out_volt;
6342 + port->pps_data.req_out_volt = req_out_volt;
6343 port->pps_status = 0;
6344 port->pps_pending = true;
6345 tcpm_set_state(port, SNK_NEGOTIATE_PPS_CAPABILITIES, 0);
6346 @@ -4309,8 +4328,8 @@ static int tcpm_pps_activate(struct tcpm_port *port, bool activate)
6347
6348 /* Trigger PPS request or move back to standard PDO contract */
6349 if (activate) {
6350 - port->pps_data.out_volt = port->supply_voltage;
6351 - port->pps_data.op_curr = port->current_limit;
6352 + port->pps_data.req_out_volt = port->supply_voltage;
6353 + port->pps_data.req_op_curr = port->current_limit;
6354 tcpm_set_state(port, SNK_NEGOTIATE_PPS_CAPABILITIES, 0);
6355 } else {
6356 tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
6357 diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
6358 index f7633ee655a17..d1cf6b51bf85d 100644
6359 --- a/drivers/usb/usbip/vudc_sysfs.c
6360 +++ b/drivers/usb/usbip/vudc_sysfs.c
6361 @@ -156,12 +156,14 @@ static ssize_t usbip_sockfd_store(struct device *dev,
6362 tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
6363 if (IS_ERR(tcp_rx)) {
6364 sockfd_put(socket);
6365 + mutex_unlock(&udc->ud.sysfs_lock);
6366 return -EINVAL;
6367 }
6368 tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
6369 if (IS_ERR(tcp_tx)) {
6370 kthread_stop(tcp_rx);
6371 sockfd_put(socket);
6372 + mutex_unlock(&udc->ud.sysfs_lock);
6373 return -EINVAL;
6374 }
6375
6376 diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
6377 index f32c582611eb6..ca9476883f150 100644
6378 --- a/drivers/vfio/mdev/mdev_sysfs.c
6379 +++ b/drivers/vfio/mdev/mdev_sysfs.c
6380 @@ -105,6 +105,7 @@ static struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,
6381 return ERR_PTR(-ENOMEM);
6382
6383 type->kobj.kset = parent->mdev_types_kset;
6384 + type->parent = parent;
6385
6386 ret = kobject_init_and_add(&type->kobj, &mdev_type_ktype, NULL,
6387 "%s-%s", dev_driver_string(parent->dev),
6388 @@ -132,7 +133,6 @@ static struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,
6389 }
6390
6391 type->group = group;
6392 - type->parent = parent;
6393 return type;
6394
6395 attrs_failed:
6396 diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
6397 index 7b758d623b5bd..143c52de97ecc 100644
6398 --- a/fs/overlayfs/copy_up.c
6399 +++ b/fs/overlayfs/copy_up.c
6400 @@ -852,7 +852,7 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
6401 int ovl_copy_up_flags(struct dentry *dentry, int flags)
6402 {
6403 int err = 0;
6404 - const struct cred *old_cred = ovl_override_creds(dentry->d_sb);
6405 + const struct cred *old_cred;
6406 bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED);
6407
6408 /*
6409 @@ -863,6 +863,7 @@ int ovl_copy_up_flags(struct dentry *dentry, int flags)
6410 if (WARN_ON(disconnected && d_is_dir(dentry)))
6411 return -EIO;
6412
6413 + old_cred = ovl_override_creds(dentry->d_sb);
6414 while (!err) {
6415 struct dentry *next;
6416 struct dentry *parent = NULL;
6417 diff --git a/include/linux/hid.h b/include/linux/hid.h
6418 index c7044a14200ea..ae906deb42e87 100644
6419 --- a/include/linux/hid.h
6420 +++ b/include/linux/hid.h
6421 @@ -261,6 +261,8 @@ struct hid_item {
6422 #define HID_CP_SELECTION 0x000c0080
6423 #define HID_CP_MEDIASELECTION 0x000c0087
6424 #define HID_CP_SELECTDISC 0x000c00ba
6425 +#define HID_CP_VOLUMEUP 0x000c00e9
6426 +#define HID_CP_VOLUMEDOWN 0x000c00ea
6427 #define HID_CP_PLAYBACKSPEED 0x000c00f1
6428 #define HID_CP_PROXIMITY 0x000c0109
6429 #define HID_CP_SPEAKERSYSTEM 0x000c0160
6430 diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
6431 index 21aa6d736e999..0ec4ec428b9ba 100644
6432 --- a/include/linux/kvm_host.h
6433 +++ b/include/linux/kvm_host.h
6434 @@ -192,8 +192,8 @@ int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
6435 int len, void *val);
6436 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
6437 int len, struct kvm_io_device *dev);
6438 -void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
6439 - struct kvm_io_device *dev);
6440 +int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
6441 + struct kvm_io_device *dev);
6442 struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx,
6443 gpa_t addr);
6444
6445 diff --git a/include/linux/smp.h b/include/linux/smp.h
6446 index 6fc856c9eda58..36a9da719110d 100644
6447 --- a/include/linux/smp.h
6448 +++ b/include/linux/smp.h
6449 @@ -57,7 +57,7 @@ void on_each_cpu_cond_mask(bool (*cond_func)(int cpu, void *info),
6450 smp_call_func_t func, void *info, bool wait,
6451 gfp_t gfp_flags, const struct cpumask *mask);
6452
6453 -int smp_call_function_single_async(int cpu, call_single_data_t *csd);
6454 +int smp_call_function_single_async(int cpu, struct __call_single_data *csd);
6455
6456 #ifdef CONFIG_SMP
6457
6458 diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
6459 index acd91300a4ab1..7067f85cef0bf 100644
6460 --- a/include/linux/spi/spi.h
6461 +++ b/include/linux/spi/spi.h
6462 @@ -466,6 +466,9 @@ struct spi_controller {
6463
6464 #define SPI_MASTER_GPIO_SS BIT(5) /* GPIO CS must select slave */
6465
6466 + /* flag indicating this is a non-devres managed controller */
6467 + bool devm_allocated;
6468 +
6469 /* flag indicating this is an SPI slave controller */
6470 bool slave;
6471
6472 diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
6473 index 358446247ccdc..7186d77f431e6 100644
6474 --- a/include/linux/tty_driver.h
6475 +++ b/include/linux/tty_driver.h
6476 @@ -236,7 +236,7 @@
6477 *
6478 * Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel
6479 * structure to complete. This method is optional and will only be called
6480 - * if provided (otherwise EINVAL will be returned).
6481 + * if provided (otherwise ENOTTY will be returned).
6482 */
6483
6484 #include <linux/export.h>
6485 diff --git a/include/net/addrconf.h b/include/net/addrconf.h
6486 index ab8b3eb53d4b1..8d90fb9184e8a 100644
6487 --- a/include/net/addrconf.h
6488 +++ b/include/net/addrconf.h
6489 @@ -229,7 +229,6 @@ void ipv6_mc_unmap(struct inet6_dev *idev);
6490 void ipv6_mc_remap(struct inet6_dev *idev);
6491 void ipv6_mc_init_dev(struct inet6_dev *idev);
6492 void ipv6_mc_destroy_dev(struct inet6_dev *idev);
6493 -int ipv6_mc_check_icmpv6(struct sk_buff *skb);
6494 int ipv6_mc_check_mld(struct sk_buff *skb);
6495 void addrconf_dad_failure(struct sk_buff *skb, struct inet6_ifaddr *ifp);
6496
6497 diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
6498 index 3cd232cf29c66..325e8efb5b368 100644
6499 --- a/include/net/bluetooth/hci_core.h
6500 +++ b/include/net/bluetooth/hci_core.h
6501 @@ -540,6 +540,7 @@ struct hci_chan {
6502 struct sk_buff_head data_q;
6503 unsigned int sent;
6504 __u8 state;
6505 + bool amp;
6506 };
6507
6508 struct hci_conn_params {
6509 diff --git a/include/uapi/linux/tty_flags.h b/include/uapi/linux/tty_flags.h
6510 index 900a32e634247..6a3ac496a56c1 100644
6511 --- a/include/uapi/linux/tty_flags.h
6512 +++ b/include/uapi/linux/tty_flags.h
6513 @@ -39,7 +39,7 @@
6514 * WARNING: These flags are no longer used and have been superceded by the
6515 * TTY_PORT_ flags in the iflags field (and not userspace-visible)
6516 */
6517 -#ifndef _KERNEL_
6518 +#ifndef __KERNEL__
6519 #define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
6520 #define ASYNCB_SUSPENDED 30 /* Serial port is suspended */
6521 #define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
6522 @@ -81,7 +81,7 @@
6523 #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
6524 #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
6525
6526 -#ifndef _KERNEL_
6527 +#ifndef __KERNEL__
6528 /* These flags are no longer used (and were always masked from userspace) */
6529 #define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)
6530 #define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
6531 diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
6532 index c4b702fe1d738..faada713cfae8 100644
6533 --- a/kernel/sched/debug.c
6534 +++ b/kernel/sched/debug.c
6535 @@ -8,8 +8,6 @@
6536 */
6537 #include "sched.h"
6538
6539 -static DEFINE_SPINLOCK(sched_debug_lock);
6540 -
6541 /*
6542 * This allows printing both to /proc/sched_debug and
6543 * to the console
6544 @@ -417,16 +415,37 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
6545 #endif
6546
6547 #ifdef CONFIG_CGROUP_SCHED
6548 +static DEFINE_SPINLOCK(sched_debug_lock);
6549 static char group_path[PATH_MAX];
6550
6551 -static char *task_group_path(struct task_group *tg)
6552 +static void task_group_path(struct task_group *tg, char *path, int plen)
6553 {
6554 - if (autogroup_path(tg, group_path, PATH_MAX))
6555 - return group_path;
6556 + if (autogroup_path(tg, path, plen))
6557 + return;
6558
6559 - cgroup_path(tg->css.cgroup, group_path, PATH_MAX);
6560 + cgroup_path(tg->css.cgroup, path, plen);
6561 +}
6562
6563 - return group_path;
6564 +/*
6565 + * Only 1 SEQ_printf_task_group_path() caller can use the full length
6566 + * group_path[] for cgroup path. Other simultaneous callers will have
6567 + * to use a shorter stack buffer. A "..." suffix is appended at the end
6568 + * of the stack buffer so that it will show up in case the output length
6569 + * matches the given buffer size to indicate possible path name truncation.
6570 + */
6571 +#define SEQ_printf_task_group_path(m, tg, fmt...) \
6572 +{ \
6573 + if (spin_trylock(&sched_debug_lock)) { \
6574 + task_group_path(tg, group_path, sizeof(group_path)); \
6575 + SEQ_printf(m, fmt, group_path); \
6576 + spin_unlock(&sched_debug_lock); \
6577 + } else { \
6578 + char buf[128]; \
6579 + char *bufend = buf + sizeof(buf) - 3; \
6580 + task_group_path(tg, buf, bufend - buf); \
6581 + strcpy(bufend - 1, "..."); \
6582 + SEQ_printf(m, fmt, buf); \
6583 + } \
6584 }
6585 #endif
6586
6587 @@ -453,7 +472,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
6588 SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
6589 #endif
6590 #ifdef CONFIG_CGROUP_SCHED
6591 - SEQ_printf(m, " %s", task_group_path(task_group(p)));
6592 + SEQ_printf_task_group_path(m, task_group(p), " %s")
6593 #endif
6594
6595 SEQ_printf(m, "\n");
6596 @@ -490,7 +509,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
6597
6598 #ifdef CONFIG_FAIR_GROUP_SCHED
6599 SEQ_printf(m, "\n");
6600 - SEQ_printf(m, "cfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg));
6601 + SEQ_printf_task_group_path(m, cfs_rq->tg, "cfs_rq[%d]:%s\n", cpu);
6602 #else
6603 SEQ_printf(m, "\n");
6604 SEQ_printf(m, "cfs_rq[%d]:\n", cpu);
6605 @@ -562,7 +581,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
6606 {
6607 #ifdef CONFIG_RT_GROUP_SCHED
6608 SEQ_printf(m, "\n");
6609 - SEQ_printf(m, "rt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg));
6610 + SEQ_printf_task_group_path(m, rt_rq->tg, "rt_rq[%d]:%s\n", cpu);
6611 #else
6612 SEQ_printf(m, "\n");
6613 SEQ_printf(m, "rt_rq[%d]:\n", cpu);
6614 @@ -614,7 +633,6 @@ void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
6615 static void print_cpu(struct seq_file *m, int cpu)
6616 {
6617 struct rq *rq = cpu_rq(cpu);
6618 - unsigned long flags;
6619
6620 #ifdef CONFIG_X86
6621 {
6622 @@ -666,13 +684,11 @@ do { \
6623 }
6624 #undef P
6625
6626 - spin_lock_irqsave(&sched_debug_lock, flags);
6627 print_cfs_stats(m, cpu);
6628 print_rt_stats(m, cpu);
6629 print_dl_stats(m, cpu);
6630
6631 print_rq(m, rq, cpu);
6632 - spin_unlock_irqrestore(&sched_debug_lock, flags);
6633 SEQ_printf(m, "\n");
6634 }
6635
6636 diff --git a/kernel/smp.c b/kernel/smp.c
6637 index 7dbcb402c2fc0..3a390932f8b25 100644
6638 --- a/kernel/smp.c
6639 +++ b/kernel/smp.c
6640 @@ -104,12 +104,12 @@ void __init call_function_init(void)
6641 * previous function call. For multi-cpu calls its even more interesting
6642 * as we'll have to ensure no other cpu is observing our csd.
6643 */
6644 -static __always_inline void csd_lock_wait(call_single_data_t *csd)
6645 +static __always_inline void csd_lock_wait(struct __call_single_data *csd)
6646 {
6647 smp_cond_load_acquire(&csd->flags, !(VAL & CSD_FLAG_LOCK));
6648 }
6649
6650 -static __always_inline void csd_lock(call_single_data_t *csd)
6651 +static __always_inline void csd_lock(struct __call_single_data *csd)
6652 {
6653 csd_lock_wait(csd);
6654 csd->flags |= CSD_FLAG_LOCK;
6655 @@ -122,7 +122,7 @@ static __always_inline void csd_lock(call_single_data_t *csd)
6656 smp_wmb();
6657 }
6658
6659 -static __always_inline void csd_unlock(call_single_data_t *csd)
6660 +static __always_inline void csd_unlock(struct __call_single_data *csd)
6661 {
6662 WARN_ON(!(csd->flags & CSD_FLAG_LOCK));
6663
6664 @@ -139,7 +139,7 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(call_single_data_t, csd_data);
6665 * for execution on the given CPU. data must already have
6666 * ->func, ->info, and ->flags set.
6667 */
6668 -static int generic_exec_single(int cpu, call_single_data_t *csd,
6669 +static int generic_exec_single(int cpu, struct __call_single_data *csd,
6670 smp_call_func_t func, void *info)
6671 {
6672 if (cpu == smp_processor_id()) {
6673 @@ -332,7 +332,7 @@ EXPORT_SYMBOL(smp_call_function_single);
6674 * NOTE: Be careful, there is unfortunately no current debugging facility to
6675 * validate the correctness of this serialization.
6676 */
6677 -int smp_call_function_single_async(int cpu, call_single_data_t *csd)
6678 +int smp_call_function_single_async(int cpu, struct __call_single_data *csd)
6679 {
6680 int err = 0;
6681
6682 diff --git a/kernel/up.c b/kernel/up.c
6683 index 862b460ab97a8..8e8551c8b2851 100644
6684 --- a/kernel/up.c
6685 +++ b/kernel/up.c
6686 @@ -24,7 +24,7 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
6687 }
6688 EXPORT_SYMBOL(smp_call_function_single);
6689
6690 -int smp_call_function_single_async(int cpu, call_single_data_t *csd)
6691 +int smp_call_function_single_async(int cpu, struct __call_single_data *csd)
6692 {
6693 unsigned long flags;
6694
6695 diff --git a/lib/bug.c b/lib/bug.c
6696 index 8c98af0bf5857..c3aa22cbc8761 100644
6697 --- a/lib/bug.c
6698 +++ b/lib/bug.c
6699 @@ -155,30 +155,27 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
6700
6701 file = NULL;
6702 line = 0;
6703 - warning = 0;
6704
6705 - if (bug) {
6706 #ifdef CONFIG_DEBUG_BUGVERBOSE
6707 #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
6708 - file = bug->file;
6709 + file = bug->file;
6710 #else
6711 - file = (const char *)bug + bug->file_disp;
6712 + file = (const char *)bug + bug->file_disp;
6713 #endif
6714 - line = bug->line;
6715 + line = bug->line;
6716 #endif
6717 - warning = (bug->flags & BUGFLAG_WARNING) != 0;
6718 - once = (bug->flags & BUGFLAG_ONCE) != 0;
6719 - done = (bug->flags & BUGFLAG_DONE) != 0;
6720 -
6721 - if (warning && once) {
6722 - if (done)
6723 - return BUG_TRAP_TYPE_WARN;
6724 -
6725 - /*
6726 - * Since this is the only store, concurrency is not an issue.
6727 - */
6728 - bug->flags |= BUGFLAG_DONE;
6729 - }
6730 + warning = (bug->flags & BUGFLAG_WARNING) != 0;
6731 + once = (bug->flags & BUGFLAG_ONCE) != 0;
6732 + done = (bug->flags & BUGFLAG_DONE) != 0;
6733 +
6734 + if (warning && once) {
6735 + if (done)
6736 + return BUG_TRAP_TYPE_WARN;
6737 +
6738 + /*
6739 + * Since this is the only store, concurrency is not an issue.
6740 + */
6741 + bug->flags |= BUGFLAG_DONE;
6742 }
6743
6744 /*
6745 diff --git a/mm/memory-failure.c b/mm/memory-failure.c
6746 index 3151c87dff73e..d823ec74f3fc7 100644
6747 --- a/mm/memory-failure.c
6748 +++ b/mm/memory-failure.c
6749 @@ -1215,7 +1215,7 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags,
6750 * communicated in siginfo, see kill_proc()
6751 */
6752 start = (page->index << PAGE_SHIFT) & ~(size - 1);
6753 - unmap_mapping_range(page->mapping, start, start + size, 0);
6754 + unmap_mapping_range(page->mapping, start, size, 0);
6755 }
6756 kill_procs(&tokill, flags & MF_MUST_KILL, !unmap_success, pfn, flags);
6757 rc = 0;
6758 diff --git a/mm/sparse.c b/mm/sparse.c
6759 index 78bbecd904c38..191e29cca3fb9 100644
6760 --- a/mm/sparse.c
6761 +++ b/mm/sparse.c
6762 @@ -551,6 +551,7 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,
6763 pr_err("%s: node[%d] memory map backing failed. Some memory will not be available.",
6764 __func__, nid);
6765 pnum_begin = pnum;
6766 + sparse_buffer_fini();
6767 goto failed;
6768 }
6769 check_usemap_section_nr(nid, usage);
6770 diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
6771 index 0a88645f103f0..bd678ffdaef73 100644
6772 --- a/net/bluetooth/hci_event.c
6773 +++ b/net/bluetooth/hci_event.c
6774 @@ -4840,6 +4840,7 @@ static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
6775 return;
6776
6777 hchan->handle = le16_to_cpu(ev->handle);
6778 + hchan->amp = true;
6779
6780 BT_DBG("hcon %p mgr %p hchan %p", hcon, hcon->amp_mgr, hchan);
6781
6782 @@ -4872,7 +4873,7 @@ static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev,
6783 hci_dev_lock(hdev);
6784
6785 hchan = hci_chan_lookup_handle(hdev, le16_to_cpu(ev->handle));
6786 - if (!hchan)
6787 + if (!hchan || !hchan->amp)
6788 goto unlock;
6789
6790 amp_destroy_logical_link(hchan, ev->reason);
6791 diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
6792 index 3d25dbf10b26f..7f3f4ea56d440 100644
6793 --- a/net/bluetooth/hci_request.c
6794 +++ b/net/bluetooth/hci_request.c
6795 @@ -271,12 +271,16 @@ int hci_req_sync(struct hci_dev *hdev, int (*req)(struct hci_request *req,
6796 {
6797 int ret;
6798
6799 - if (!test_bit(HCI_UP, &hdev->flags))
6800 - return -ENETDOWN;
6801 -
6802 /* Serialize all requests */
6803 hci_req_sync_lock(hdev);
6804 - ret = __hci_req_sync(hdev, req, opt, timeout, hci_status);
6805 + /* check the state after obtaing the lock to protect the HCI_UP
6806 + * against any races from hci_dev_do_close when the controller
6807 + * gets removed.
6808 + */
6809 + if (test_bit(HCI_UP, &hdev->flags))
6810 + ret = __hci_req_sync(hdev, req, opt, timeout, hci_status);
6811 + else
6812 + ret = -ENETDOWN;
6813 hci_req_sync_unlock(hdev);
6814
6815 return ret;
6816 diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
6817 index 066cd3c59cfdb..6276030f5854b 100644
6818 --- a/net/bridge/br_multicast.c
6819 +++ b/net/bridge/br_multicast.c
6820 @@ -1647,25 +1647,14 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
6821 }
6822
6823 #if IS_ENABLED(CONFIG_IPV6)
6824 -static int br_ip6_multicast_mrd_rcv(struct net_bridge *br,
6825 - struct net_bridge_port *port,
6826 - struct sk_buff *skb)
6827 +static void br_ip6_multicast_mrd_rcv(struct net_bridge *br,
6828 + struct net_bridge_port *port,
6829 + struct sk_buff *skb)
6830 {
6831 - int ret;
6832 -
6833 - if (ipv6_hdr(skb)->nexthdr != IPPROTO_ICMPV6)
6834 - return -ENOMSG;
6835 -
6836 - ret = ipv6_mc_check_icmpv6(skb);
6837 - if (ret < 0)
6838 - return ret;
6839 -
6840 if (icmp6_hdr(skb)->icmp6_type != ICMPV6_MRDISC_ADV)
6841 - return -ENOMSG;
6842 + return;
6843
6844 br_multicast_mark_router(br, port);
6845 -
6846 - return 0;
6847 }
6848
6849 static int br_multicast_ipv6_rcv(struct net_bridge *br,
6850 @@ -1679,18 +1668,12 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
6851
6852 err = ipv6_mc_check_mld(skb);
6853
6854 - if (err == -ENOMSG) {
6855 + if (err == -ENOMSG || err == -ENODATA) {
6856 if (!ipv6_addr_is_ll_all_nodes(&ipv6_hdr(skb)->daddr))
6857 BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
6858 -
6859 - if (ipv6_addr_is_all_snoopers(&ipv6_hdr(skb)->daddr)) {
6860 - err = br_ip6_multicast_mrd_rcv(br, port, skb);
6861 -
6862 - if (err < 0 && err != -ENOMSG) {
6863 - br_multicast_err_count(br, port, skb->protocol);
6864 - return err;
6865 - }
6866 - }
6867 + if (err == -ENODATA &&
6868 + ipv6_addr_is_all_snoopers(&ipv6_hdr(skb)->daddr))
6869 + br_ip6_multicast_mrd_rcv(br, port, skb);
6870
6871 return 0;
6872 } else if (err < 0) {
6873 diff --git a/net/core/dev.c b/net/core/dev.c
6874 index 91909e5d6807e..a30878346f54b 100644
6875 --- a/net/core/dev.c
6876 +++ b/net/core/dev.c
6877 @@ -5395,7 +5395,7 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
6878 return head;
6879 }
6880
6881 -static void skb_gro_reset_offset(struct sk_buff *skb)
6882 +static inline void skb_gro_reset_offset(struct sk_buff *skb, u32 nhoff)
6883 {
6884 const struct skb_shared_info *pinfo = skb_shinfo(skb);
6885 const skb_frag_t *frag0 = &pinfo->frags[0];
6886 @@ -5407,7 +5407,7 @@ static void skb_gro_reset_offset(struct sk_buff *skb)
6887 if (skb_mac_header(skb) == skb_tail_pointer(skb) &&
6888 pinfo->nr_frags &&
6889 !PageHighMem(skb_frag_page(frag0)) &&
6890 - (!NET_IP_ALIGN || !(skb_frag_off(frag0) & 3))) {
6891 + (!NET_IP_ALIGN || !((skb_frag_off(frag0) + nhoff) & 3))) {
6892 NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0);
6893 NAPI_GRO_CB(skb)->frag0_len = min_t(unsigned int,
6894 skb_frag_size(frag0),
6895 @@ -5640,7 +5640,7 @@ gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
6896 skb_mark_napi_id(skb, napi);
6897 trace_napi_gro_receive_entry(skb);
6898
6899 - skb_gro_reset_offset(skb);
6900 + skb_gro_reset_offset(skb, 0);
6901
6902 ret = napi_skb_finish(napi, skb, dev_gro_receive(napi, skb));
6903 trace_napi_gro_receive_exit(ret);
6904 @@ -5733,7 +5733,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
6905 napi->skb = NULL;
6906
6907 skb_reset_mac_header(skb);
6908 - skb_gro_reset_offset(skb);
6909 + skb_gro_reset_offset(skb, hlen);
6910
6911 if (unlikely(skb_gro_header_hard(skb, hlen))) {
6912 eth = skb_gro_header_slow(skb, hlen, 0);
6913 diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
6914 index 002f341f35648..4a9200729a326 100644
6915 --- a/net/hsr/hsr_framereg.c
6916 +++ b/net/hsr/hsr_framereg.c
6917 @@ -318,7 +318,8 @@ void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
6918 node_dst = find_node_by_addr_A(&port->hsr->node_db,
6919 eth_hdr(skb)->h_dest);
6920 if (!node_dst) {
6921 - WARN_ONCE(1, "%s: Unknown node\n", __func__);
6922 + if (net_ratelimit())
6923 + netdev_err(skb->dev, "%s: Unknown node\n", __func__);
6924 return;
6925 }
6926 if (port->type != node_dst->addr_B_port)
6927 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
6928 index 53c5cf5723aa1..3ff702380b629 100644
6929 --- a/net/ipv4/route.c
6930 +++ b/net/ipv4/route.c
6931 @@ -66,6 +66,7 @@
6932 #include <linux/types.h>
6933 #include <linux/kernel.h>
6934 #include <linux/mm.h>
6935 +#include <linux/memblock.h>
6936 #include <linux/string.h>
6937 #include <linux/socket.h>
6938 #include <linux/sockios.h>
6939 @@ -476,8 +477,10 @@ static void ipv4_confirm_neigh(const struct dst_entry *dst, const void *daddr)
6940 __ipv4_confirm_neigh(dev, *(__force u32 *)pkey);
6941 }
6942
6943 -#define IP_IDENTS_SZ 2048u
6944 -
6945 +/* Hash tables of size 2048..262144 depending on RAM size.
6946 + * Each bucket uses 8 bytes.
6947 + */
6948 +static u32 ip_idents_mask __read_mostly;
6949 static atomic_t *ip_idents __read_mostly;
6950 static u32 *ip_tstamps __read_mostly;
6951
6952 @@ -487,12 +490,16 @@ static u32 *ip_tstamps __read_mostly;
6953 */
6954 u32 ip_idents_reserve(u32 hash, int segs)
6955 {
6956 - u32 *p_tstamp = ip_tstamps + hash % IP_IDENTS_SZ;
6957 - atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ;
6958 - u32 old = READ_ONCE(*p_tstamp);
6959 - u32 now = (u32)jiffies;
6960 + u32 bucket, old, now = (u32)jiffies;
6961 + atomic_t *p_id;
6962 + u32 *p_tstamp;
6963 u32 delta = 0;
6964
6965 + bucket = hash & ip_idents_mask;
6966 + p_tstamp = ip_tstamps + bucket;
6967 + p_id = ip_idents + bucket;
6968 + old = READ_ONCE(*p_tstamp);
6969 +
6970 if (old != now && cmpxchg(p_tstamp, old, now) == old)
6971 delta = prandom_u32_max(now - old);
6972
6973 @@ -3459,18 +3466,25 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
6974
6975 int __init ip_rt_init(void)
6976 {
6977 + void *idents_hash;
6978 int cpu;
6979
6980 - ip_idents = kmalloc_array(IP_IDENTS_SZ, sizeof(*ip_idents),
6981 - GFP_KERNEL);
6982 - if (!ip_idents)
6983 - panic("IP: failed to allocate ip_idents\n");
6984 + /* For modern hosts, this will use 2 MB of memory */
6985 + idents_hash = alloc_large_system_hash("IP idents",
6986 + sizeof(*ip_idents) + sizeof(*ip_tstamps),
6987 + 0,
6988 + 16, /* one bucket per 64 KB */
6989 + HASH_ZERO,
6990 + NULL,
6991 + &ip_idents_mask,
6992 + 2048,
6993 + 256*1024);
6994 +
6995 + ip_idents = idents_hash;
6996
6997 - prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents));
6998 + prandom_bytes(ip_idents, (ip_idents_mask + 1) * sizeof(*ip_idents));
6999
7000 - ip_tstamps = kcalloc(IP_IDENTS_SZ, sizeof(*ip_tstamps), GFP_KERNEL);
7001 - if (!ip_tstamps)
7002 - panic("IP: failed to allocate ip_tstamps\n");
7003 + ip_tstamps = idents_hash + (ip_idents_mask + 1) * sizeof(*ip_idents);
7004
7005 for_each_possible_cpu(cpu) {
7006 struct uncached_list *ul = &per_cpu(rt_uncached_list, cpu);
7007 diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
7008 index 62292eef151c4..6d5600889dcfa 100644
7009 --- a/net/ipv4/tcp_cong.c
7010 +++ b/net/ipv4/tcp_cong.c
7011 @@ -229,6 +229,10 @@ int tcp_set_default_congestion_control(struct net *net, const char *name)
7012 ret = -ENOENT;
7013 } else if (!try_module_get(ca->owner)) {
7014 ret = -EBUSY;
7015 + } else if (!net_eq(net, &init_net) &&
7016 + !(ca->flags & TCP_CONG_NON_RESTRICTED)) {
7017 + /* Only init netns can set default to a restricted algorithm */
7018 + ret = -EPERM;
7019 } else {
7020 prev = xchg(&net->ipv4.tcp_congestion_control, ca);
7021 if (prev)
7022 diff --git a/net/ipv6/mcast_snoop.c b/net/ipv6/mcast_snoop.c
7023 index d3d6b6a66e5fa..04d5fcdfa6e00 100644
7024 --- a/net/ipv6/mcast_snoop.c
7025 +++ b/net/ipv6/mcast_snoop.c
7026 @@ -109,7 +109,7 @@ static int ipv6_mc_check_mld_msg(struct sk_buff *skb)
7027 struct mld_msg *mld;
7028
7029 if (!ipv6_mc_may_pull(skb, len))
7030 - return -EINVAL;
7031 + return -ENODATA;
7032
7033 mld = (struct mld_msg *)skb_transport_header(skb);
7034
7035 @@ -122,7 +122,7 @@ static int ipv6_mc_check_mld_msg(struct sk_buff *skb)
7036 case ICMPV6_MGM_QUERY:
7037 return ipv6_mc_check_mld_query(skb);
7038 default:
7039 - return -ENOMSG;
7040 + return -ENODATA;
7041 }
7042 }
7043
7044 @@ -131,7 +131,7 @@ static inline __sum16 ipv6_mc_validate_checksum(struct sk_buff *skb)
7045 return skb_checksum_validate(skb, IPPROTO_ICMPV6, ip6_compute_pseudo);
7046 }
7047
7048 -int ipv6_mc_check_icmpv6(struct sk_buff *skb)
7049 +static int ipv6_mc_check_icmpv6(struct sk_buff *skb)
7050 {
7051 unsigned int len = skb_transport_offset(skb) + sizeof(struct icmp6hdr);
7052 unsigned int transport_len = ipv6_transport_len(skb);
7053 @@ -150,7 +150,6 @@ int ipv6_mc_check_icmpv6(struct sk_buff *skb)
7054
7055 return 0;
7056 }
7057 -EXPORT_SYMBOL(ipv6_mc_check_icmpv6);
7058
7059 /**
7060 * ipv6_mc_check_mld - checks whether this is a sane MLD packet
7061 @@ -161,7 +160,10 @@ EXPORT_SYMBOL(ipv6_mc_check_icmpv6);
7062 *
7063 * -EINVAL: A broken packet was detected, i.e. it violates some internet
7064 * standard
7065 - * -ENOMSG: IP header validation succeeded but it is not an MLD packet.
7066 + * -ENOMSG: IP header validation succeeded but it is not an ICMPv6 packet
7067 + * with a hop-by-hop option.
7068 + * -ENODATA: IP+ICMPv6 header with hop-by-hop option validation succeeded
7069 + * but it is not an MLD packet.
7070 * -ENOMEM: A memory allocation failure happened.
7071 *
7072 * Caller needs to set the skb network header and free any returned skb if it
7073 diff --git a/net/mac80211/main.c b/net/mac80211/main.c
7074 index 5b3189a376802..f215218a88c95 100644
7075 --- a/net/mac80211/main.c
7076 +++ b/net/mac80211/main.c
7077 @@ -1113,8 +1113,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
7078 if (local->hw.wiphy->max_scan_ie_len)
7079 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
7080
7081 - WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
7082 - local->hw.n_cipher_schemes));
7083 + if (WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
7084 + local->hw.n_cipher_schemes))) {
7085 + result = -EINVAL;
7086 + goto fail_workqueue;
7087 + }
7088
7089 result = ieee80211_init_cipher_suites(local);
7090 if (result < 0)
7091 diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c
7092 index 65aaa9d7c8133..bcd4d74e8a825 100644
7093 --- a/net/nfc/digital_dep.c
7094 +++ b/net/nfc/digital_dep.c
7095 @@ -1276,6 +1276,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
7096 }
7097
7098 rc = nfc_tm_data_received(ddev->nfc_dev, resp);
7099 + if (rc)
7100 + resp = NULL;
7101
7102 exit:
7103 kfree_skb(ddev->chaining_skb);
7104 diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
7105 index 170c342b11dae..0d4246af6c02b 100644
7106 --- a/net/nfc/llcp_sock.c
7107 +++ b/net/nfc/llcp_sock.c
7108 @@ -109,12 +109,14 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
7109 GFP_KERNEL);
7110 if (!llcp_sock->service_name) {
7111 nfc_llcp_local_put(llcp_sock->local);
7112 + llcp_sock->local = NULL;
7113 ret = -ENOMEM;
7114 goto put_dev;
7115 }
7116 llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
7117 if (llcp_sock->ssap == LLCP_SAP_MAX) {
7118 nfc_llcp_local_put(llcp_sock->local);
7119 + llcp_sock->local = NULL;
7120 kfree(llcp_sock->service_name);
7121 llcp_sock->service_name = NULL;
7122 ret = -EADDRINUSE;
7123 @@ -709,6 +711,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
7124 llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
7125 if (llcp_sock->ssap == LLCP_SAP_MAX) {
7126 nfc_llcp_local_put(llcp_sock->local);
7127 + llcp_sock->local = NULL;
7128 ret = -ENOMEM;
7129 goto put_dev;
7130 }
7131 @@ -756,6 +759,7 @@ sock_unlink:
7132 sock_llcp_release:
7133 nfc_llcp_put_ssap(local, llcp_sock->ssap);
7134 nfc_llcp_local_put(llcp_sock->local);
7135 + llcp_sock->local = NULL;
7136
7137 put_dev:
7138 nfc_put_device(dev);
7139 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
7140 index 783fd65b1f98d..2146372adff43 100644
7141 --- a/net/sctp/socket.c
7142 +++ b/net/sctp/socket.c
7143 @@ -357,6 +357,18 @@ static struct sctp_af *sctp_sockaddr_af(struct sctp_sock *opt,
7144 return af;
7145 }
7146
7147 +static void sctp_auto_asconf_init(struct sctp_sock *sp)
7148 +{
7149 + struct net *net = sock_net(&sp->inet.sk);
7150 +
7151 + if (net->sctp.default_auto_asconf) {
7152 + spin_lock(&net->sctp.addr_wq_lock);
7153 + list_add_tail(&sp->auto_asconf_list, &net->sctp.auto_asconf_splist);
7154 + spin_unlock(&net->sctp.addr_wq_lock);
7155 + sp->do_auto_asconf = 1;
7156 + }
7157 +}
7158 +
7159 /* Bind a local address either to an endpoint or to an association. */
7160 static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
7161 {
7162 @@ -418,8 +430,10 @@ static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
7163 return -EADDRINUSE;
7164
7165 /* Refresh ephemeral port. */
7166 - if (!bp->port)
7167 + if (!bp->port) {
7168 bp->port = inet_sk(sk)->inet_num;
7169 + sctp_auto_asconf_init(sp);
7170 + }
7171
7172 /* Add the address to the bind address list.
7173 * Use GFP_ATOMIC since BHs will be disabled.
7174 @@ -1539,9 +1553,11 @@ static void sctp_close(struct sock *sk, long timeout)
7175
7176 /* Supposedly, no process has access to the socket, but
7177 * the net layers still may.
7178 + * Also, sctp_destroy_sock() needs to be called with addr_wq_lock
7179 + * held and that should be grabbed before socket lock.
7180 */
7181 - local_bh_disable();
7182 - bh_lock_sock(sk);
7183 + spin_lock_bh(&net->sctp.addr_wq_lock);
7184 + bh_lock_sock_nested(sk);
7185
7186 /* Hold the sock, since sk_common_release() will put sock_put()
7187 * and we have just a little more cleanup.
7188 @@ -1550,7 +1566,7 @@ static void sctp_close(struct sock *sk, long timeout)
7189 sk_common_release(sk);
7190
7191 bh_unlock_sock(sk);
7192 - local_bh_enable();
7193 + spin_unlock_bh(&net->sctp.addr_wq_lock);
7194
7195 sock_put(sk);
7196
7197 @@ -5113,16 +5129,6 @@ static int sctp_init_sock(struct sock *sk)
7198 sk_sockets_allocated_inc(sk);
7199 sock_prot_inuse_add(net, sk->sk_prot, 1);
7200
7201 - if (net->sctp.default_auto_asconf) {
7202 - spin_lock(&sock_net(sk)->sctp.addr_wq_lock);
7203 - list_add_tail(&sp->auto_asconf_list,
7204 - &net->sctp.auto_asconf_splist);
7205 - sp->do_auto_asconf = 1;
7206 - spin_unlock(&sock_net(sk)->sctp.addr_wq_lock);
7207 - } else {
7208 - sp->do_auto_asconf = 0;
7209 - }
7210 -
7211 local_bh_enable();
7212
7213 return 0;
7214 @@ -5147,9 +5153,7 @@ static void sctp_destroy_sock(struct sock *sk)
7215
7216 if (sp->do_auto_asconf) {
7217 sp->do_auto_asconf = 0;
7218 - spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock);
7219 list_del(&sp->auto_asconf_list);
7220 - spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock);
7221 }
7222 sctp_endpoint_free(sp->ep);
7223 local_bh_disable();
7224 @@ -9399,6 +9403,8 @@ static int sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
7225 return err;
7226 }
7227
7228 + sctp_auto_asconf_init(newsp);
7229 +
7230 /* Move any messages in the old socket's receive queue that are for the
7231 * peeled off association to the new socket's receive queue.
7232 */
7233 diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
7234 index 8c9c4ed90fa70..aaabcd84268a9 100644
7235 --- a/net/vmw_vsock/vmci_transport.c
7236 +++ b/net/vmw_vsock/vmci_transport.c
7237 @@ -576,8 +576,7 @@ vmci_transport_queue_pair_alloc(struct vmci_qp **qpair,
7238 peer, flags, VMCI_NO_PRIVILEGE_FLAGS);
7239 out:
7240 if (err < 0) {
7241 - pr_err("Could not attach to queue pair with %d\n",
7242 - err);
7243 + pr_err_once("Could not attach to queue pair with %d\n", err);
7244 err = vmci_transport_error_to_vsock_error(err);
7245 }
7246
7247 diff --git a/net/wireless/scan.c b/net/wireless/scan.c
7248 index 328402ab64a3f..83297832744ac 100644
7249 --- a/net/wireless/scan.c
7250 +++ b/net/wireless/scan.c
7251 @@ -1257,6 +1257,8 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
7252
7253 if (rdev->bss_entries >= bss_entries_limit &&
7254 !cfg80211_bss_expire_oldest(rdev)) {
7255 + if (!list_empty(&new->hidden_list))
7256 + list_del(&new->hidden_list);
7257 kfree(new);
7258 goto drop;
7259 }
7260 diff --git a/samples/kfifo/bytestream-example.c b/samples/kfifo/bytestream-example.c
7261 index 9ca3e4400c98f..ecae2139274f8 100644
7262 --- a/samples/kfifo/bytestream-example.c
7263 +++ b/samples/kfifo/bytestream-example.c
7264 @@ -122,8 +122,10 @@ static ssize_t fifo_write(struct file *file, const char __user *buf,
7265 ret = kfifo_from_user(&test, buf, count, &copied);
7266
7267 mutex_unlock(&write_lock);
7268 + if (ret)
7269 + return ret;
7270
7271 - return ret ? ret : copied;
7272 + return copied;
7273 }
7274
7275 static ssize_t fifo_read(struct file *file, char __user *buf,
7276 @@ -138,8 +140,10 @@ static ssize_t fifo_read(struct file *file, char __user *buf,
7277 ret = kfifo_to_user(&test, buf, count, &copied);
7278
7279 mutex_unlock(&read_lock);
7280 + if (ret)
7281 + return ret;
7282
7283 - return ret ? ret : copied;
7284 + return copied;
7285 }
7286
7287 static const struct file_operations fifo_fops = {
7288 diff --git a/samples/kfifo/inttype-example.c b/samples/kfifo/inttype-example.c
7289 index 6cdeb72f83f17..7b4489e7a9a54 100644
7290 --- a/samples/kfifo/inttype-example.c
7291 +++ b/samples/kfifo/inttype-example.c
7292 @@ -115,8 +115,10 @@ static ssize_t fifo_write(struct file *file, const char __user *buf,
7293 ret = kfifo_from_user(&test, buf, count, &copied);
7294
7295 mutex_unlock(&write_lock);
7296 + if (ret)
7297 + return ret;
7298
7299 - return ret ? ret : copied;
7300 + return copied;
7301 }
7302
7303 static ssize_t fifo_read(struct file *file, char __user *buf,
7304 @@ -131,8 +133,10 @@ static ssize_t fifo_read(struct file *file, char __user *buf,
7305 ret = kfifo_to_user(&test, buf, count, &copied);
7306
7307 mutex_unlock(&read_lock);
7308 + if (ret)
7309 + return ret;
7310
7311 - return ret ? ret : copied;
7312 + return copied;
7313 }
7314
7315 static const struct file_operations fifo_fops = {
7316 diff --git a/samples/kfifo/record-example.c b/samples/kfifo/record-example.c
7317 index 79ae8bb04120d..eafe0838997d4 100644
7318 --- a/samples/kfifo/record-example.c
7319 +++ b/samples/kfifo/record-example.c
7320 @@ -129,8 +129,10 @@ static ssize_t fifo_write(struct file *file, const char __user *buf,
7321 ret = kfifo_from_user(&test, buf, count, &copied);
7322
7323 mutex_unlock(&write_lock);
7324 + if (ret)
7325 + return ret;
7326
7327 - return ret ? ret : copied;
7328 + return copied;
7329 }
7330
7331 static ssize_t fifo_read(struct file *file, char __user *buf,
7332 @@ -145,8 +147,10 @@ static ssize_t fifo_read(struct file *file, char __user *buf,
7333 ret = kfifo_to_user(&test, buf, count, &copied);
7334
7335 mutex_unlock(&read_lock);
7336 + if (ret)
7337 + return ret;
7338
7339 - return ret ? ret : copied;
7340 + return copied;
7341 }
7342
7343 static const struct file_operations fifo_fops = {
7344 diff --git a/sound/core/init.c b/sound/core/init.c
7345 index db99b7fad6ad8..45bbc4884ef0f 100644
7346 --- a/sound/core/init.c
7347 +++ b/sound/core/init.c
7348 @@ -384,10 +384,8 @@ int snd_card_disconnect(struct snd_card *card)
7349 return 0;
7350 }
7351 card->shutdown = 1;
7352 - spin_unlock(&card->files_lock);
7353
7354 /* replace file->f_op with special dummy operations */
7355 - spin_lock(&card->files_lock);
7356 list_for_each_entry(mfile, &card->files_list, list) {
7357 /* it's critical part, use endless loop */
7358 /* we have no room to fail */
7359 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
7360 index 3b47ca4f7cac7..b7297a22438af 100644
7361 --- a/sound/pci/hda/patch_realtek.c
7362 +++ b/sound/pci/hda/patch_realtek.c
7363 @@ -2460,13 +2460,13 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
7364 ALC882_FIXUP_ACER_ASPIRE_8930G),
7365 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
7366 ALC882_FIXUP_ACER_ASPIRE_8930G),
7367 + SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
7368 + ALC882_FIXUP_ACER_ASPIRE_4930G),
7369 + SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
7370 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
7371 ALC882_FIXUP_ACER_ASPIRE_4930G),
7372 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
7373 ALC882_FIXUP_ACER_ASPIRE_4930G),
7374 - SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
7375 - ALC882_FIXUP_ACER_ASPIRE_4930G),
7376 - SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
7377 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
7378 ALC882_FIXUP_ACER_ASPIRE_4930G),
7379 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
7380 @@ -2479,11 +2479,11 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
7381 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
7382 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
7383 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
7384 + SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
7385 + SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
7386 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
7387 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
7388 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
7389 - SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
7390 - SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
7391
7392 /* All Apple entries are in codec SSIDs */
7393 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
7394 @@ -2526,9 +2526,19 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
7395 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
7396 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
7397 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
7398 + SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7399 + SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7400 + SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7401 + SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7402 + SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7403 + SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7404 + SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7405 + SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7406 + SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7407 + SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7408 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
7409 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
7410 - SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
7411 + SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
7412 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
7413 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
7414 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
7415 @@ -2538,16 +2548,6 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
7416 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
7417 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
7418 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7419 - SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7420 - SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7421 - SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7422 - SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7423 - SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7424 - SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7425 - SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7426 - SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7427 - SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7428 - SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7429 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
7430 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
7431 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
7432 @@ -7786,12 +7786,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7433 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
7434 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7435 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7436 - SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7437 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7438 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
7439 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
7440 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
7441 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
7442 + SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7443 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
7444 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
7445 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
7446 @@ -7844,8 +7844,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7447 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
7448 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
7449 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
7450 - SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
7451 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
7452 + SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
7453 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
7454 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7455 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7456 @@ -7855,8 +7855,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7457 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
7458 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
7459 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7460 - SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7461 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7462 + SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7463 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7464 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7465 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7466 @@ -7864,35 +7864,18 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7467 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
7468 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
7469 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7470 - SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
7471 - /* ALC282 */
7472 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7473 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7474 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7475 + SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7476 + SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
7477 + SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7478 + SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7479 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7480 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7481 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7482 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7483 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7484 - SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7485 - SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7486 - SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7487 - SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7488 - SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
7489 - SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
7490 - SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
7491 - SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7492 - SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7493 - SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7494 - SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7495 - SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7496 - SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
7497 - SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7498 - SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7499 - /* ALC290 */
7500 - SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7501 - SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7502 - SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7503 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7504 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7505 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7506 @@ -7900,26 +7883,41 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7507 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7508 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7509 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
7510 + SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
7511 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7512 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7513 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7514 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7515 + SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7516 + SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7517 + SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7518 + SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7519 + SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
7520 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7521 + SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
7522 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7523 + SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
7524 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7525 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7526 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7527 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7528 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7529 + SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7530 + SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7531 + SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7532 + SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7533 + SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7534 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7535 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7536 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7537 - SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7538 + SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7539 + SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
7540 + SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7541 + SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7542 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7543 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7544 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7545 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7546 - SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
7547 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7548 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7549 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
7550 @@ -7946,16 +7944,18 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7551 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7552 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7553 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7554 + SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7555 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
7556 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7557 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7558 - SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7559 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7560 + SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7561 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
7562 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
7563 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
7564 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
7565 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
7566 + SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
7567 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
7568 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
7569 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
7570 @@ -7968,32 +7968,31 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7571 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
7572 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7573 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7574 - SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7575 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
7576 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
7577 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
7578 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
7579 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
7580 - SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
7581 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
7582 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7583 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7584 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7585 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7586 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
7587 - SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7588 - SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7589 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7590 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7591 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7592 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
7593 + SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7594 + SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7595 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
7596 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
7597 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7598 - SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7599 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
7600 + SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7601 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
7602 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
7603 + SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
7604 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
7605 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
7606 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
7607 @@ -8003,9 +8002,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7608 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7609 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7610 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7611 - SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7612 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
7613 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7614 + SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7615 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7616 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
7617 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
7618 @@ -8061,9 +8060,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7619 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
7620 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
7621 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
7622 + SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
7623 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
7624 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
7625 - SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
7626 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
7627 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
7628 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
7629 @@ -8107,6 +8106,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7630 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7631 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
7632 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7633 + SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
7634 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7635 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
7636 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
7637 @@ -8125,20 +8125,18 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7638 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7639 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7640 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7641 - SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
7642 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
7643 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
7644 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
7645 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
7646 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
7647 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
7648 + SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
7649 + SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
7650 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
7651 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
7652 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
7653 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
7654 - SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
7655 - SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
7656 - SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
7657 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
7658 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
7659 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
7660 @@ -8600,6 +8598,16 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7661 {0x19, 0x03a11020},
7662 {0x21, 0x0321101f}),
7663 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7664 + {0x12, 0x90a60130},
7665 + {0x14, 0x90170110},
7666 + {0x19, 0x04a11040},
7667 + {0x21, 0x04211020}),
7668 + SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7669 + {0x14, 0x90170110},
7670 + {0x19, 0x04a11040},
7671 + {0x1d, 0x40600001},
7672 + {0x21, 0x04211020}),
7673 + SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7674 {0x14, 0x90170110},
7675 {0x19, 0x04a11040},
7676 {0x21, 0x04211020}),
7677 @@ -8767,10 +8775,6 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
7678 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7679 {0x19, 0x40000000},
7680 {0x1a, 0x40000000}),
7681 - SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7682 - {0x14, 0x90170110},
7683 - {0x19, 0x04a11040},
7684 - {0x21, 0x04211020}),
7685 {}
7686 };
7687
7688 @@ -9086,8 +9090,7 @@ static const struct snd_pci_quirk alc861_fixup_tbl[] = {
7689 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7690 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7691 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7692 - SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7693 - SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7694 + SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
7695 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
7696 {}
7697 };
7698 @@ -9882,6 +9885,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
7699 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
7700 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
7701 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
7702 + SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
7703 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
7704 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
7705 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7706 @@ -9898,9 +9902,9 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
7707 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
7708 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
7709 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
7710 - SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
7711 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
7712 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
7713 + SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
7714 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7715 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
7716 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
7717 @@ -9920,7 +9924,6 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
7718 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
7719 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
7720 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
7721 - SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
7722
7723 #if 0
7724 /* Below is a quirk table taken from the old code.
7725 diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c
7726 index 5eb4168bb9d93..e98312a6b8401 100644
7727 --- a/sound/soc/codecs/ak5558.c
7728 +++ b/sound/soc/codecs/ak5558.c
7729 @@ -264,7 +264,7 @@ static void ak5558_power_off(struct ak5558_priv *ak5558)
7730 if (!ak5558->reset_gpiod)
7731 return;
7732
7733 - gpiod_set_value_cansleep(ak5558->reset_gpiod, 0);
7734 + gpiod_set_value_cansleep(ak5558->reset_gpiod, 1);
7735 usleep_range(1000, 2000);
7736 }
7737
7738 @@ -273,7 +273,7 @@ static void ak5558_power_on(struct ak5558_priv *ak5558)
7739 if (!ak5558->reset_gpiod)
7740 return;
7741
7742 - gpiod_set_value_cansleep(ak5558->reset_gpiod, 1);
7743 + gpiod_set_value_cansleep(ak5558->reset_gpiod, 0);
7744 usleep_range(1000, 2000);
7745 }
7746
7747 diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
7748 index 6007e63057354..1bc4981246899 100644
7749 --- a/sound/soc/generic/audio-graph-card.c
7750 +++ b/sound/soc/generic/audio-graph-card.c
7751 @@ -340,7 +340,7 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
7752 struct device_node *top = dev->of_node;
7753 struct asoc_simple_dai *cpu_dai;
7754 struct asoc_simple_dai *codec_dai;
7755 - int ret, single_cpu;
7756 + int ret, single_cpu = 0;
7757
7758 /* Do it only CPU turn */
7759 if (!li->cpu)
7760 diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
7761 index fc9c753db8dd3..4484c40c7a39c 100644
7762 --- a/sound/soc/generic/simple-card.c
7763 +++ b/sound/soc/generic/simple-card.c
7764 @@ -258,7 +258,7 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
7765 struct device_node *plat = NULL;
7766 char prop[128];
7767 char *prefix = "";
7768 - int ret, single_cpu;
7769 + int ret, single_cpu = 0;
7770
7771 /*
7772 * |CPU |Codec : turn
7773 diff --git a/sound/soc/intel/boards/kbl_da7219_max98927.c b/sound/soc/intel/boards/kbl_da7219_max98927.c
7774 index 829f95fc41797..16996f6aa2dcf 100644
7775 --- a/sound/soc/intel/boards/kbl_da7219_max98927.c
7776 +++ b/sound/soc/intel/boards/kbl_da7219_max98927.c
7777 @@ -282,11 +282,33 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
7778 struct snd_interval *channels = hw_param_interval(params,
7779 SNDRV_PCM_HW_PARAM_CHANNELS);
7780 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
7781 - struct snd_soc_dpcm *dpcm = container_of(
7782 - params, struct snd_soc_dpcm, hw_params);
7783 - struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
7784 - struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
7785 + struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL;
7786
7787 + /*
7788 + * The following loop will be called only for playback stream
7789 + * In this platform, there is only one playback device on every SSP
7790 + */
7791 + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
7792 + rtd_dpcm = dpcm;
7793 + break;
7794 + }
7795 +
7796 + /*
7797 + * This following loop will be called only for capture stream
7798 + * In this platform, there is only one capture device on every SSP
7799 + */
7800 + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) {
7801 + rtd_dpcm = dpcm;
7802 + break;
7803 + }
7804 +
7805 + if (!rtd_dpcm)
7806 + return -EINVAL;
7807 +
7808 + /*
7809 + * The above 2 loops are mutually exclusive based on the stream direction,
7810 + * thus rtd_dpcm variable will never be overwritten
7811 + */
7812 /*
7813 * Topology for kblda7219m98373 & kblmax98373 supports only S24_LE,
7814 * where as kblda7219m98927 & kblmax98927 supports S16_LE by default.
7815 @@ -309,9 +331,9 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
7816 /*
7817 * The ADSP will convert the FE rate to 48k, stereo, 24 bit
7818 */
7819 - if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
7820 - !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
7821 - !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
7822 + if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") ||
7823 + !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") ||
7824 + !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) {
7825 rate->min = rate->max = 48000;
7826 channels->min = channels->max = 2;
7827 snd_mask_none(fmt);
7828 @@ -322,7 +344,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
7829 * The speaker on the SSP0 supports S16_LE and not S24_LE.
7830 * thus changing the mask here
7831 */
7832 - if (!strcmp(be_dai_link->name, "SSP0-Codec"))
7833 + if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec"))
7834 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
7835
7836 return 0;
7837 diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c
7838 index bb9910d4cbe24..0588470715844 100644
7839 --- a/sound/soc/samsung/tm2_wm5110.c
7840 +++ b/sound/soc/samsung/tm2_wm5110.c
7841 @@ -553,7 +553,7 @@ static int tm2_probe(struct platform_device *pdev)
7842
7843 ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller",
7844 cells_name, i, &args);
7845 - if (!args.np) {
7846 + if (ret) {
7847 dev_err(dev, "i2s-controller property parse error: %d\n", i);
7848 ret = -EINVAL;
7849 goto dai_node_put;
7850 diff --git a/sound/usb/card.c b/sound/usb/card.c
7851 index 230d862cfa3a8..c2dd18c5cadbb 100644
7852 --- a/sound/usb/card.c
7853 +++ b/sound/usb/card.c
7854 @@ -176,9 +176,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
7855 ctrlif, interface);
7856 return -EINVAL;
7857 }
7858 - usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
7859 -
7860 - return 0;
7861 + return usb_driver_claim_interface(&usb_audio_driver, iface,
7862 + USB_AUDIO_IFACE_UNUSED);
7863 }
7864
7865 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO &&
7866 @@ -198,7 +197,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
7867
7868 if (! snd_usb_parse_audio_interface(chip, interface)) {
7869 usb_set_interface(dev, interface, 0); /* reset the current interface */
7870 - usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
7871 + return usb_driver_claim_interface(&usb_audio_driver, iface,
7872 + USB_AUDIO_IFACE_UNUSED);
7873 }
7874
7875 return 0;
7876 @@ -703,7 +703,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
7877 struct snd_card *card;
7878 struct list_head *p;
7879
7880 - if (chip == (void *)-1L)
7881 + if (chip == USB_AUDIO_IFACE_UNUSED)
7882 return;
7883
7884 card = chip->card;
7885 @@ -811,7 +811,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
7886 struct usb_mixer_interface *mixer;
7887 struct list_head *p;
7888
7889 - if (chip == (void *)-1L)
7890 + if (chip == USB_AUDIO_IFACE_UNUSED)
7891 return 0;
7892
7893 if (!chip->num_suspended_intf++) {
7894 @@ -842,7 +842,7 @@ static int __usb_audio_resume(struct usb_interface *intf, bool reset_resume)
7895 struct list_head *p;
7896 int err = 0;
7897
7898 - if (chip == (void *)-1L)
7899 + if (chip == USB_AUDIO_IFACE_UNUSED)
7900 return 0;
7901
7902 atomic_inc(&chip->active); /* avoid autopm */
7903 diff --git a/sound/usb/midi.c b/sound/usb/midi.c
7904 index 1cc17c449407c..c205a26ef5092 100644
7905 --- a/sound/usb/midi.c
7906 +++ b/sound/usb/midi.c
7907 @@ -1332,7 +1332,7 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi,
7908
7909 error:
7910 snd_usbmidi_in_endpoint_delete(ep);
7911 - return -ENOMEM;
7912 + return err;
7913 }
7914
7915 /*
7916 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
7917 index 3d1585c12b074..186e90e3636c7 100644
7918 --- a/sound/usb/quirks.c
7919 +++ b/sound/usb/quirks.c
7920 @@ -55,8 +55,12 @@ static int create_composite_quirk(struct snd_usb_audio *chip,
7921 if (!iface)
7922 continue;
7923 if (quirk->ifnum != probed_ifnum &&
7924 - !usb_interface_claimed(iface))
7925 - usb_driver_claim_interface(driver, iface, (void *)-1L);
7926 + !usb_interface_claimed(iface)) {
7927 + err = usb_driver_claim_interface(driver, iface,
7928 + USB_AUDIO_IFACE_UNUSED);
7929 + if (err < 0)
7930 + return err;
7931 + }
7932 }
7933
7934 return 0;
7935 @@ -390,8 +394,12 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,
7936 continue;
7937
7938 err = create_autodetect_quirk(chip, iface, driver);
7939 - if (err >= 0)
7940 - usb_driver_claim_interface(driver, iface, (void *)-1L);
7941 + if (err >= 0) {
7942 + err = usb_driver_claim_interface(driver, iface,
7943 + USB_AUDIO_IFACE_UNUSED);
7944 + if (err < 0)
7945 + return err;
7946 + }
7947 }
7948
7949 return 0;
7950 diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
7951 index 55a2119c2411d..ff97fdcf63bd5 100644
7952 --- a/sound/usb/usbaudio.h
7953 +++ b/sound/usb/usbaudio.h
7954 @@ -59,6 +59,8 @@ struct snd_usb_audio {
7955 struct media_intf_devnode *ctl_intf_media_devnode;
7956 };
7957
7958 +#define USB_AUDIO_IFACE_UNUSED ((void *)-1L)
7959 +
7960 #define usb_audio_err(chip, fmt, args...) \
7961 dev_err(&(chip)->dev->dev, fmt, ##args)
7962 #define usb_audio_warn(chip, fmt, args...) \
7963 diff --git a/tools/perf/trace/beauty/fsconfig.sh b/tools/perf/trace/beauty/fsconfig.sh
7964 index 83fb24df05c9f..bc6ef7bb7a5f9 100755
7965 --- a/tools/perf/trace/beauty/fsconfig.sh
7966 +++ b/tools/perf/trace/beauty/fsconfig.sh
7967 @@ -10,8 +10,7 @@ fi
7968 linux_mount=${linux_header_dir}/mount.h
7969
7970 printf "static const char *fsconfig_cmds[] = {\n"
7971 -regex='^[[:space:]]*+FSCONFIG_([[:alnum:]_]+)[[:space:]]*=[[:space:]]*([[:digit:]]+)[[:space:]]*,[[:space:]]*.*'
7972 -egrep $regex ${linux_mount} | \
7973 - sed -r "s/$regex/\2 \1/g" | \
7974 - xargs printf "\t[%s] = \"%s\",\n"
7975 +ms='[[:space:]]*'
7976 +sed -nr "s/^${ms}FSCONFIG_([[:alnum:]_]+)${ms}=${ms}([[:digit:]]+)${ms},.*/\t[\2] = \"\1\",/p" \
7977 + ${linux_mount}
7978 printf "};\n"
7979 diff --git a/tools/perf/util/symbol_fprintf.c b/tools/perf/util/symbol_fprintf.c
7980 index 35c936ce33efa..2664fb65e47ad 100644
7981 --- a/tools/perf/util/symbol_fprintf.c
7982 +++ b/tools/perf/util/symbol_fprintf.c
7983 @@ -68,7 +68,7 @@ size_t dso__fprintf_symbols_by_name(struct dso *dso,
7984
7985 for (nd = rb_first_cached(&dso->symbol_names); nd; nd = rb_next(nd)) {
7986 pos = rb_entry(nd, struct symbol_name_rb_node, rb_node);
7987 - fprintf(fp, "%s\n", pos->sym.name);
7988 + ret += fprintf(fp, "%s\n", pos->sym.name);
7989 }
7990
7991 return ret;
7992 diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh b/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
7993 index c02291e9841e3..880e3ab9d088d 100755
7994 --- a/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
7995 +++ b/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
7996 @@ -271,7 +271,7 @@ test_span_gre_fdb_roaming()
7997
7998 while ((RET == 0)); do
7999 bridge fdb del dev $swp3 $h3mac vlan 555 master 2>/dev/null
8000 - bridge fdb add dev $swp2 $h3mac vlan 555 master
8001 + bridge fdb add dev $swp2 $h3mac vlan 555 master static
8002 sleep 1
8003 fail_test_span_gre_dir $tundev ingress
8004
8005 diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
8006 index 8ffd07e2a1602..6b870e4b9b972 100644
8007 --- a/virt/kvm/coalesced_mmio.c
8008 +++ b/virt/kvm/coalesced_mmio.c
8009 @@ -178,21 +178,36 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
8010 struct kvm_coalesced_mmio_zone *zone)
8011 {
8012 struct kvm_coalesced_mmio_dev *dev, *tmp;
8013 + int r;
8014
8015 if (zone->pio != 1 && zone->pio != 0)
8016 return -EINVAL;
8017
8018 mutex_lock(&kvm->slots_lock);
8019
8020 - list_for_each_entry_safe(dev, tmp, &kvm->coalesced_zones, list)
8021 + list_for_each_entry_safe(dev, tmp, &kvm->coalesced_zones, list) {
8022 if (zone->pio == dev->zone.pio &&
8023 coalesced_mmio_in_range(dev, zone->addr, zone->size)) {
8024 - kvm_io_bus_unregister_dev(kvm,
8025 + r = kvm_io_bus_unregister_dev(kvm,
8026 zone->pio ? KVM_PIO_BUS : KVM_MMIO_BUS, &dev->dev);
8027 kvm_iodevice_destructor(&dev->dev);
8028 +
8029 + /*
8030 + * On failure, unregister destroys all devices on the
8031 + * bus _except_ the target device, i.e. coalesced_zones
8032 + * has been modified. No need to restart the walk as
8033 + * there aren't any zones left.
8034 + */
8035 + if (r)
8036 + break;
8037 }
8038 + }
8039
8040 mutex_unlock(&kvm->slots_lock);
8041
8042 + /*
8043 + * Ignore the result of kvm_io_bus_unregister_dev(), from userspace's
8044 + * perspective, the coalesced MMIO is most definitely unregistered.
8045 + */
8046 return 0;
8047 }
8048 diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
8049 index 048b555c5acc9..f83fa0aeeb451 100644
8050 --- a/virt/kvm/kvm_main.c
8051 +++ b/virt/kvm/kvm_main.c
8052 @@ -4017,15 +4017,15 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
8053 }
8054
8055 /* Caller must hold slots_lock. */
8056 -void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
8057 - struct kvm_io_device *dev)
8058 +int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
8059 + struct kvm_io_device *dev)
8060 {
8061 int i, j;
8062 struct kvm_io_bus *new_bus, *bus;
8063
8064 bus = kvm_get_bus(kvm, bus_idx);
8065 if (!bus)
8066 - return;
8067 + return 0;
8068
8069 for (i = 0; i < bus->dev_count; i++)
8070 if (bus->range[i].dev == dev) {
8071 @@ -4033,7 +4033,7 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
8072 }
8073
8074 if (i == bus->dev_count)
8075 - return;
8076 + return 0;
8077
8078 new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1),
8079 GFP_KERNEL_ACCOUNT);
8080 @@ -4054,7 +4054,7 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
8081 rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
8082 synchronize_srcu_expedited(&kvm->srcu);
8083 kfree(bus);
8084 - return;
8085 + return new_bus ? 0 : -ENOMEM;
8086 }
8087
8088 struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx,