Annotation of /trunk/kernel-alx/patches-4.19/0140-4.19.41-all-fixes.patch
Parent Directory | Revision Log
Revision 3419 -
(hide annotations)
(download)
Fri Aug 2 11:47:49 2019 UTC (4 years, 10 months ago) by niro
File size: 119836 byte(s)
Fri Aug 2 11:47:49 2019 UTC (4 years, 10 months ago) by niro
File size: 119836 byte(s)
-linux-4.19.41
1 | niro | 3419 | diff --git a/Documentation/driver-api/usb/power-management.rst b/Documentation/driver-api/usb/power-management.rst |
2 | index 79beb807996b..4a74cf6f2797 100644 | ||
3 | --- a/Documentation/driver-api/usb/power-management.rst | ||
4 | +++ b/Documentation/driver-api/usb/power-management.rst | ||
5 | @@ -370,11 +370,15 @@ autosuspend the interface's device. When the usage counter is = 0 | ||
6 | then the interface is considered to be idle, and the kernel may | ||
7 | autosuspend the device. | ||
8 | |||
9 | -Drivers need not be concerned about balancing changes to the usage | ||
10 | -counter; the USB core will undo any remaining "get"s when a driver | ||
11 | -is unbound from its interface. As a corollary, drivers must not call | ||
12 | -any of the ``usb_autopm_*`` functions after their ``disconnect`` | ||
13 | -routine has returned. | ||
14 | +Drivers must be careful to balance their overall changes to the usage | ||
15 | +counter. Unbalanced "get"s will remain in effect when a driver is | ||
16 | +unbound from its interface, preventing the device from going into | ||
17 | +runtime suspend should the interface be bound to a driver again. On | ||
18 | +the other hand, drivers are allowed to achieve this balance by calling | ||
19 | +the ``usb_autopm_*`` functions even after their ``disconnect`` routine | ||
20 | +has returned -- say from within a work-queue routine -- provided they | ||
21 | +retain an active reference to the interface (via ``usb_get_intf`` and | ||
22 | +``usb_put_intf``). | ||
23 | |||
24 | Drivers using the async routines are responsible for their own | ||
25 | synchronization and mutual exclusion. | ||
26 | diff --git a/Makefile b/Makefile | ||
27 | index 3822720a8a1c..ba3b8504b689 100644 | ||
28 | --- a/Makefile | ||
29 | +++ b/Makefile | ||
30 | @@ -1,7 +1,7 @@ | ||
31 | # SPDX-License-Identifier: GPL-2.0 | ||
32 | VERSION = 4 | ||
33 | PATCHLEVEL = 19 | ||
34 | -SUBLEVEL = 40 | ||
35 | +SUBLEVEL = 41 | ||
36 | EXTRAVERSION = | ||
37 | NAME = "People's Front" | ||
38 | |||
39 | diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi | ||
40 | index e6a36a792bae..c706adf4aed2 100644 | ||
41 | --- a/arch/arm/boot/dts/rk3288.dtsi | ||
42 | +++ b/arch/arm/boot/dts/rk3288.dtsi | ||
43 | @@ -1261,27 +1261,27 @@ | ||
44 | gpu_opp_table: gpu-opp-table { | ||
45 | compatible = "operating-points-v2"; | ||
46 | |||
47 | - opp@100000000 { | ||
48 | + opp-100000000 { | ||
49 | opp-hz = /bits/ 64 <100000000>; | ||
50 | opp-microvolt = <950000>; | ||
51 | }; | ||
52 | - opp@200000000 { | ||
53 | + opp-200000000 { | ||
54 | opp-hz = /bits/ 64 <200000000>; | ||
55 | opp-microvolt = <950000>; | ||
56 | }; | ||
57 | - opp@300000000 { | ||
58 | + opp-300000000 { | ||
59 | opp-hz = /bits/ 64 <300000000>; | ||
60 | opp-microvolt = <1000000>; | ||
61 | }; | ||
62 | - opp@400000000 { | ||
63 | + opp-400000000 { | ||
64 | opp-hz = /bits/ 64 <400000000>; | ||
65 | opp-microvolt = <1100000>; | ||
66 | }; | ||
67 | - opp@500000000 { | ||
68 | + opp-500000000 { | ||
69 | opp-hz = /bits/ 64 <500000000>; | ||
70 | opp-microvolt = <1200000>; | ||
71 | }; | ||
72 | - opp@600000000 { | ||
73 | + opp-600000000 { | ||
74 | opp-hz = /bits/ 64 <600000000>; | ||
75 | opp-microvolt = <1250000>; | ||
76 | }; | ||
77 | diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c | ||
78 | index 32fae4dbd63b..0921e2c10edf 100644 | ||
79 | --- a/arch/arm/mach-at91/pm.c | ||
80 | +++ b/arch/arm/mach-at91/pm.c | ||
81 | @@ -594,13 +594,13 @@ static int __init at91_pm_backup_init(void) | ||
82 | |||
83 | np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam"); | ||
84 | if (!np) | ||
85 | - goto securam_fail; | ||
86 | + goto securam_fail_no_ref_dev; | ||
87 | |||
88 | pdev = of_find_device_by_node(np); | ||
89 | of_node_put(np); | ||
90 | if (!pdev) { | ||
91 | pr_warn("%s: failed to find securam device!\n", __func__); | ||
92 | - goto securam_fail; | ||
93 | + goto securam_fail_no_ref_dev; | ||
94 | } | ||
95 | |||
96 | sram_pool = gen_pool_get(&pdev->dev, NULL); | ||
97 | @@ -623,6 +623,8 @@ static int __init at91_pm_backup_init(void) | ||
98 | return 0; | ||
99 | |||
100 | securam_fail: | ||
101 | + put_device(&pdev->dev); | ||
102 | +securam_fail_no_ref_dev: | ||
103 | iounmap(pm_data.sfrbu); | ||
104 | pm_data.sfrbu = NULL; | ||
105 | return ret; | ||
106 | diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c | ||
107 | index 53c316f7301e..fe4932fda01d 100644 | ||
108 | --- a/arch/arm/mach-iop13xx/setup.c | ||
109 | +++ b/arch/arm/mach-iop13xx/setup.c | ||
110 | @@ -300,7 +300,7 @@ static struct resource iop13xx_adma_2_resources[] = { | ||
111 | } | ||
112 | }; | ||
113 | |||
114 | -static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(64); | ||
115 | +static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(32); | ||
116 | static struct iop_adma_platform_data iop13xx_adma_0_data = { | ||
117 | .hw_id = 0, | ||
118 | .pool_size = PAGE_SIZE, | ||
119 | @@ -324,7 +324,7 @@ static struct platform_device iop13xx_adma_0_channel = { | ||
120 | .resource = iop13xx_adma_0_resources, | ||
121 | .dev = { | ||
122 | .dma_mask = &iop13xx_adma_dmamask, | ||
123 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
124 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
125 | .platform_data = (void *) &iop13xx_adma_0_data, | ||
126 | }, | ||
127 | }; | ||
128 | @@ -336,7 +336,7 @@ static struct platform_device iop13xx_adma_1_channel = { | ||
129 | .resource = iop13xx_adma_1_resources, | ||
130 | .dev = { | ||
131 | .dma_mask = &iop13xx_adma_dmamask, | ||
132 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
133 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
134 | .platform_data = (void *) &iop13xx_adma_1_data, | ||
135 | }, | ||
136 | }; | ||
137 | @@ -348,7 +348,7 @@ static struct platform_device iop13xx_adma_2_channel = { | ||
138 | .resource = iop13xx_adma_2_resources, | ||
139 | .dev = { | ||
140 | .dma_mask = &iop13xx_adma_dmamask, | ||
141 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
142 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
143 | .platform_data = (void *) &iop13xx_adma_2_data, | ||
144 | }, | ||
145 | }; | ||
146 | diff --git a/arch/arm/mach-iop13xx/tpmi.c b/arch/arm/mach-iop13xx/tpmi.c | ||
147 | index db511ec2b1df..116feb6b261e 100644 | ||
148 | --- a/arch/arm/mach-iop13xx/tpmi.c | ||
149 | +++ b/arch/arm/mach-iop13xx/tpmi.c | ||
150 | @@ -152,7 +152,7 @@ static struct resource iop13xx_tpmi_3_resources[] = { | ||
151 | } | ||
152 | }; | ||
153 | |||
154 | -u64 iop13xx_tpmi_mask = DMA_BIT_MASK(64); | ||
155 | +u64 iop13xx_tpmi_mask = DMA_BIT_MASK(32); | ||
156 | static struct platform_device iop13xx_tpmi_0_device = { | ||
157 | .name = "iop-tpmi", | ||
158 | .id = 0, | ||
159 | @@ -160,7 +160,7 @@ static struct platform_device iop13xx_tpmi_0_device = { | ||
160 | .resource = iop13xx_tpmi_0_resources, | ||
161 | .dev = { | ||
162 | .dma_mask = &iop13xx_tpmi_mask, | ||
163 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
164 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
165 | }, | ||
166 | }; | ||
167 | |||
168 | @@ -171,7 +171,7 @@ static struct platform_device iop13xx_tpmi_1_device = { | ||
169 | .resource = iop13xx_tpmi_1_resources, | ||
170 | .dev = { | ||
171 | .dma_mask = &iop13xx_tpmi_mask, | ||
172 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
173 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
174 | }, | ||
175 | }; | ||
176 | |||
177 | @@ -182,7 +182,7 @@ static struct platform_device iop13xx_tpmi_2_device = { | ||
178 | .resource = iop13xx_tpmi_2_resources, | ||
179 | .dev = { | ||
180 | .dma_mask = &iop13xx_tpmi_mask, | ||
181 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
182 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | @@ -193,7 +193,7 @@ static struct platform_device iop13xx_tpmi_3_device = { | ||
187 | .resource = iop13xx_tpmi_3_resources, | ||
188 | .dev = { | ||
189 | .dma_mask = &iop13xx_tpmi_mask, | ||
190 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
191 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
192 | }, | ||
193 | }; | ||
194 | |||
195 | diff --git a/arch/arm/plat-iop/adma.c b/arch/arm/plat-iop/adma.c | ||
196 | index a4d1f8de3b5b..d9612221e484 100644 | ||
197 | --- a/arch/arm/plat-iop/adma.c | ||
198 | +++ b/arch/arm/plat-iop/adma.c | ||
199 | @@ -143,7 +143,7 @@ struct platform_device iop3xx_dma_0_channel = { | ||
200 | .resource = iop3xx_dma_0_resources, | ||
201 | .dev = { | ||
202 | .dma_mask = &iop3xx_adma_dmamask, | ||
203 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
204 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
205 | .platform_data = (void *) &iop3xx_dma_0_data, | ||
206 | }, | ||
207 | }; | ||
208 | @@ -155,7 +155,7 @@ struct platform_device iop3xx_dma_1_channel = { | ||
209 | .resource = iop3xx_dma_1_resources, | ||
210 | .dev = { | ||
211 | .dma_mask = &iop3xx_adma_dmamask, | ||
212 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
213 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
214 | .platform_data = (void *) &iop3xx_dma_1_data, | ||
215 | }, | ||
216 | }; | ||
217 | @@ -167,7 +167,7 @@ struct platform_device iop3xx_aau_channel = { | ||
218 | .resource = iop3xx_aau_resources, | ||
219 | .dev = { | ||
220 | .dma_mask = &iop3xx_adma_dmamask, | ||
221 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
222 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
223 | .platform_data = (void *) &iop3xx_aau_data, | ||
224 | }, | ||
225 | }; | ||
226 | diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c | ||
227 | index a2399fd66e97..1e970873439c 100644 | ||
228 | --- a/arch/arm/plat-orion/common.c | ||
229 | +++ b/arch/arm/plat-orion/common.c | ||
230 | @@ -622,7 +622,7 @@ static struct platform_device orion_xor0_shared = { | ||
231 | .resource = orion_xor0_shared_resources, | ||
232 | .dev = { | ||
233 | .dma_mask = &orion_xor_dmamask, | ||
234 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
235 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
236 | .platform_data = &orion_xor0_pdata, | ||
237 | }, | ||
238 | }; | ||
239 | @@ -683,7 +683,7 @@ static struct platform_device orion_xor1_shared = { | ||
240 | .resource = orion_xor1_shared_resources, | ||
241 | .dev = { | ||
242 | .dma_mask = &orion_xor_dmamask, | ||
243 | - .coherent_dma_mask = DMA_BIT_MASK(64), | ||
244 | + .coherent_dma_mask = DMA_BIT_MASK(32), | ||
245 | .platform_data = &orion_xor1_pdata, | ||
246 | }, | ||
247 | }; | ||
248 | diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | ||
249 | index 246c317f6a68..91061d9cf78b 100644 | ||
250 | --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | ||
251 | +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | ||
252 | @@ -94,8 +94,8 @@ | ||
253 | snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; | ||
254 | snps,reset-active-low; | ||
255 | snps,reset-delays-us = <0 10000 50000>; | ||
256 | - tx_delay = <0x25>; | ||
257 | - rx_delay = <0x11>; | ||
258 | + tx_delay = <0x24>; | ||
259 | + rx_delay = <0x18>; | ||
260 | status = "okay"; | ||
261 | }; | ||
262 | |||
263 | diff --git a/arch/arm64/kernel/sdei.c b/arch/arm64/kernel/sdei.c | ||
264 | index 5ba4465e44f0..ea94cf8f9dc6 100644 | ||
265 | --- a/arch/arm64/kernel/sdei.c | ||
266 | +++ b/arch/arm64/kernel/sdei.c | ||
267 | @@ -94,6 +94,9 @@ static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info) | ||
268 | unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr); | ||
269 | unsigned long high = low + SDEI_STACK_SIZE; | ||
270 | |||
271 | + if (!low) | ||
272 | + return false; | ||
273 | + | ||
274 | if (sp < low || sp >= high) | ||
275 | return false; | ||
276 | |||
277 | @@ -111,6 +114,9 @@ static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info) | ||
278 | unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr); | ||
279 | unsigned long high = low + SDEI_STACK_SIZE; | ||
280 | |||
281 | + if (!low) | ||
282 | + return false; | ||
283 | + | ||
284 | if (sp < low || sp >= high) | ||
285 | return false; | ||
286 | |||
287 | diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c | ||
288 | index 683b5b3805bd..cd381e2291df 100644 | ||
289 | --- a/arch/powerpc/kernel/kvm.c | ||
290 | +++ b/arch/powerpc/kernel/kvm.c | ||
291 | @@ -22,6 +22,7 @@ | ||
292 | #include <linux/kvm_host.h> | ||
293 | #include <linux/init.h> | ||
294 | #include <linux/export.h> | ||
295 | +#include <linux/kmemleak.h> | ||
296 | #include <linux/kvm_para.h> | ||
297 | #include <linux/slab.h> | ||
298 | #include <linux/of.h> | ||
299 | @@ -712,6 +713,12 @@ static void kvm_use_magic_page(void) | ||
300 | |||
301 | static __init void kvm_free_tmp(void) | ||
302 | { | ||
303 | + /* | ||
304 | + * Inform kmemleak about the hole in the .bss section since the | ||
305 | + * corresponding pages will be unmapped with DEBUG_PAGEALLOC=y. | ||
306 | + */ | ||
307 | + kmemleak_free_part(&kvm_tmp[kvm_tmp_index], | ||
308 | + ARRAY_SIZE(kvm_tmp) - kvm_tmp_index); | ||
309 | free_reserved_area(&kvm_tmp[kvm_tmp_index], | ||
310 | &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL); | ||
311 | } | ||
312 | diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c | ||
313 | index 4f213ba33491..53e9b58e83c2 100644 | ||
314 | --- a/arch/powerpc/mm/slice.c | ||
315 | +++ b/arch/powerpc/mm/slice.c | ||
316 | @@ -31,6 +31,7 @@ | ||
317 | #include <linux/spinlock.h> | ||
318 | #include <linux/export.h> | ||
319 | #include <linux/hugetlb.h> | ||
320 | +#include <linux/security.h> | ||
321 | #include <asm/mman.h> | ||
322 | #include <asm/mmu.h> | ||
323 | #include <asm/copro.h> | ||
324 | @@ -376,6 +377,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, | ||
325 | int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); | ||
326 | unsigned long addr, found, prev; | ||
327 | struct vm_unmapped_area_info info; | ||
328 | + unsigned long min_addr = max(PAGE_SIZE, mmap_min_addr); | ||
329 | |||
330 | info.flags = VM_UNMAPPED_AREA_TOPDOWN; | ||
331 | info.length = len; | ||
332 | @@ -392,7 +394,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, | ||
333 | if (high_limit > DEFAULT_MAP_WINDOW) | ||
334 | addr += mm->context.slb_addr_limit - DEFAULT_MAP_WINDOW; | ||
335 | |||
336 | - while (addr > PAGE_SIZE) { | ||
337 | + while (addr > min_addr) { | ||
338 | info.high_limit = addr; | ||
339 | if (!slice_scan_available(addr - 1, available, 0, &addr)) | ||
340 | continue; | ||
341 | @@ -404,8 +406,8 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm, | ||
342 | * Check if we need to reduce the range, or if we can | ||
343 | * extend it to cover the previous available slice. | ||
344 | */ | ||
345 | - if (addr < PAGE_SIZE) | ||
346 | - addr = PAGE_SIZE; | ||
347 | + if (addr < min_addr) | ||
348 | + addr = min_addr; | ||
349 | else if (slice_scan_available(addr - 1, available, 0, &prev)) { | ||
350 | addr = prev; | ||
351 | goto prev_slice; | ||
352 | @@ -527,7 +529,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, | ||
353 | addr = _ALIGN_UP(addr, page_size); | ||
354 | slice_dbg(" aligned addr=%lx\n", addr); | ||
355 | /* Ignore hint if it's too large or overlaps a VMA */ | ||
356 | - if (addr > high_limit - len || | ||
357 | + if (addr > high_limit - len || addr < mmap_min_addr || | ||
358 | !slice_area_is_free(mm, addr, len)) | ||
359 | addr = 0; | ||
360 | } | ||
361 | diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h | ||
362 | index 8c3e3e3c8be1..f0ea3156192d 100644 | ||
363 | --- a/arch/riscv/include/asm/uaccess.h | ||
364 | +++ b/arch/riscv/include/asm/uaccess.h | ||
365 | @@ -307,7 +307,7 @@ do { \ | ||
366 | " .balign 4\n" \ | ||
367 | "4:\n" \ | ||
368 | " li %0, %6\n" \ | ||
369 | - " jump 2b, %1\n" \ | ||
370 | + " jump 3b, %1\n" \ | ||
371 | " .previous\n" \ | ||
372 | " .section __ex_table,\"a\"\n" \ | ||
373 | " .balign " RISCV_SZPTR "\n" \ | ||
374 | diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c | ||
375 | index 26789ad28193..cb99df514a1c 100644 | ||
376 | --- a/arch/sh/boards/of-generic.c | ||
377 | +++ b/arch/sh/boards/of-generic.c | ||
378 | @@ -175,10 +175,10 @@ static struct sh_machine_vector __initmv sh_of_generic_mv = { | ||
379 | |||
380 | struct sh_clk_ops; | ||
381 | |||
382 | -void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) | ||
383 | +void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx) | ||
384 | { | ||
385 | } | ||
386 | |||
387 | -void __init plat_irq_setup(void) | ||
388 | +void __init __weak plat_irq_setup(void) | ||
389 | { | ||
390 | } | ||
391 | diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c | ||
392 | index 263af6312329..27ade3cb6482 100644 | ||
393 | --- a/arch/x86/events/amd/core.c | ||
394 | +++ b/arch/x86/events/amd/core.c | ||
395 | @@ -116,6 +116,110 @@ static __initconst const u64 amd_hw_cache_event_ids | ||
396 | }, | ||
397 | }; | ||
398 | |||
399 | +static __initconst const u64 amd_hw_cache_event_ids_f17h | ||
400 | + [PERF_COUNT_HW_CACHE_MAX] | ||
401 | + [PERF_COUNT_HW_CACHE_OP_MAX] | ||
402 | + [PERF_COUNT_HW_CACHE_RESULT_MAX] = { | ||
403 | +[C(L1D)] = { | ||
404 | + [C(OP_READ)] = { | ||
405 | + [C(RESULT_ACCESS)] = 0x0040, /* Data Cache Accesses */ | ||
406 | + [C(RESULT_MISS)] = 0xc860, /* L2$ access from DC Miss */ | ||
407 | + }, | ||
408 | + [C(OP_WRITE)] = { | ||
409 | + [C(RESULT_ACCESS)] = 0, | ||
410 | + [C(RESULT_MISS)] = 0, | ||
411 | + }, | ||
412 | + [C(OP_PREFETCH)] = { | ||
413 | + [C(RESULT_ACCESS)] = 0xff5a, /* h/w prefetch DC Fills */ | ||
414 | + [C(RESULT_MISS)] = 0, | ||
415 | + }, | ||
416 | +}, | ||
417 | +[C(L1I)] = { | ||
418 | + [C(OP_READ)] = { | ||
419 | + [C(RESULT_ACCESS)] = 0x0080, /* Instruction cache fetches */ | ||
420 | + [C(RESULT_MISS)] = 0x0081, /* Instruction cache misses */ | ||
421 | + }, | ||
422 | + [C(OP_WRITE)] = { | ||
423 | + [C(RESULT_ACCESS)] = -1, | ||
424 | + [C(RESULT_MISS)] = -1, | ||
425 | + }, | ||
426 | + [C(OP_PREFETCH)] = { | ||
427 | + [C(RESULT_ACCESS)] = 0, | ||
428 | + [C(RESULT_MISS)] = 0, | ||
429 | + }, | ||
430 | +}, | ||
431 | +[C(LL)] = { | ||
432 | + [C(OP_READ)] = { | ||
433 | + [C(RESULT_ACCESS)] = 0, | ||
434 | + [C(RESULT_MISS)] = 0, | ||
435 | + }, | ||
436 | + [C(OP_WRITE)] = { | ||
437 | + [C(RESULT_ACCESS)] = 0, | ||
438 | + [C(RESULT_MISS)] = 0, | ||
439 | + }, | ||
440 | + [C(OP_PREFETCH)] = { | ||
441 | + [C(RESULT_ACCESS)] = 0, | ||
442 | + [C(RESULT_MISS)] = 0, | ||
443 | + }, | ||
444 | +}, | ||
445 | +[C(DTLB)] = { | ||
446 | + [C(OP_READ)] = { | ||
447 | + [C(RESULT_ACCESS)] = 0xff45, /* All L2 DTLB accesses */ | ||
448 | + [C(RESULT_MISS)] = 0xf045, /* L2 DTLB misses (PT walks) */ | ||
449 | + }, | ||
450 | + [C(OP_WRITE)] = { | ||
451 | + [C(RESULT_ACCESS)] = 0, | ||
452 | + [C(RESULT_MISS)] = 0, | ||
453 | + }, | ||
454 | + [C(OP_PREFETCH)] = { | ||
455 | + [C(RESULT_ACCESS)] = 0, | ||
456 | + [C(RESULT_MISS)] = 0, | ||
457 | + }, | ||
458 | +}, | ||
459 | +[C(ITLB)] = { | ||
460 | + [C(OP_READ)] = { | ||
461 | + [C(RESULT_ACCESS)] = 0x0084, /* L1 ITLB misses, L2 ITLB hits */ | ||
462 | + [C(RESULT_MISS)] = 0xff85, /* L1 ITLB misses, L2 misses */ | ||
463 | + }, | ||
464 | + [C(OP_WRITE)] = { | ||
465 | + [C(RESULT_ACCESS)] = -1, | ||
466 | + [C(RESULT_MISS)] = -1, | ||
467 | + }, | ||
468 | + [C(OP_PREFETCH)] = { | ||
469 | + [C(RESULT_ACCESS)] = -1, | ||
470 | + [C(RESULT_MISS)] = -1, | ||
471 | + }, | ||
472 | +}, | ||
473 | +[C(BPU)] = { | ||
474 | + [C(OP_READ)] = { | ||
475 | + [C(RESULT_ACCESS)] = 0x00c2, /* Retired Branch Instr. */ | ||
476 | + [C(RESULT_MISS)] = 0x00c3, /* Retired Mispredicted BI */ | ||
477 | + }, | ||
478 | + [C(OP_WRITE)] = { | ||
479 | + [C(RESULT_ACCESS)] = -1, | ||
480 | + [C(RESULT_MISS)] = -1, | ||
481 | + }, | ||
482 | + [C(OP_PREFETCH)] = { | ||
483 | + [C(RESULT_ACCESS)] = -1, | ||
484 | + [C(RESULT_MISS)] = -1, | ||
485 | + }, | ||
486 | +}, | ||
487 | +[C(NODE)] = { | ||
488 | + [C(OP_READ)] = { | ||
489 | + [C(RESULT_ACCESS)] = 0, | ||
490 | + [C(RESULT_MISS)] = 0, | ||
491 | + }, | ||
492 | + [C(OP_WRITE)] = { | ||
493 | + [C(RESULT_ACCESS)] = -1, | ||
494 | + [C(RESULT_MISS)] = -1, | ||
495 | + }, | ||
496 | + [C(OP_PREFETCH)] = { | ||
497 | + [C(RESULT_ACCESS)] = -1, | ||
498 | + [C(RESULT_MISS)] = -1, | ||
499 | + }, | ||
500 | +}, | ||
501 | +}; | ||
502 | + | ||
503 | /* | ||
504 | * AMD Performance Monitor K7 and later, up to and including Family 16h: | ||
505 | */ | ||
506 | @@ -861,9 +965,10 @@ __init int amd_pmu_init(void) | ||
507 | x86_pmu.amd_nb_constraints = 0; | ||
508 | } | ||
509 | |||
510 | - /* Events are common for all AMDs */ | ||
511 | - memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, | ||
512 | - sizeof(hw_cache_event_ids)); | ||
513 | + if (boot_cpu_data.x86 >= 0x17) | ||
514 | + memcpy(hw_cache_event_ids, amd_hw_cache_event_ids_f17h, sizeof(hw_cache_event_ids)); | ||
515 | + else | ||
516 | + memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | ||
517 | |||
518 | return 0; | ||
519 | } | ||
520 | diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c | ||
521 | index f34d89c01edc..06f7c04a44e2 100644 | ||
522 | --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c | ||
523 | +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c | ||
524 | @@ -165,6 +165,11 @@ static struct severity { | ||
525 | SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA), | ||
526 | KERNEL | ||
527 | ), | ||
528 | + MCESEV( | ||
529 | + PANIC, "Instruction fetch error in kernel", | ||
530 | + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR), | ||
531 | + KERNEL | ||
532 | + ), | ||
533 | #endif | ||
534 | MCESEV( | ||
535 | PANIC, "Action required: unknown MCACOD", | ||
536 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c | ||
537 | index 813cb60eb401..8dd9208ae4de 100644 | ||
538 | --- a/arch/x86/kvm/svm.c | ||
539 | +++ b/arch/x86/kvm/svm.c | ||
540 | @@ -6789,7 +6789,8 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) | ||
541 | struct page **src_p, **dst_p; | ||
542 | struct kvm_sev_dbg debug; | ||
543 | unsigned long n; | ||
544 | - int ret, size; | ||
545 | + unsigned int size; | ||
546 | + int ret; | ||
547 | |||
548 | if (!sev_guest(kvm)) | ||
549 | return -ENOTTY; | ||
550 | @@ -6797,6 +6798,11 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) | ||
551 | if (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug))) | ||
552 | return -EFAULT; | ||
553 | |||
554 | + if (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr) | ||
555 | + return -EINVAL; | ||
556 | + if (!debug.dst_uaddr) | ||
557 | + return -EINVAL; | ||
558 | + | ||
559 | vaddr = debug.src_uaddr; | ||
560 | size = debug.len; | ||
561 | vaddr_end = vaddr + size; | ||
562 | @@ -6847,8 +6853,8 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) | ||
563 | dst_vaddr, | ||
564 | len, &argp->error); | ||
565 | |||
566 | - sev_unpin_memory(kvm, src_p, 1); | ||
567 | - sev_unpin_memory(kvm, dst_p, 1); | ||
568 | + sev_unpin_memory(kvm, src_p, n); | ||
569 | + sev_unpin_memory(kvm, dst_p, n); | ||
570 | |||
571 | if (ret) | ||
572 | goto err; | ||
573 | diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c | ||
574 | index d883869437b5..fb5f29c60019 100644 | ||
575 | --- a/arch/x86/mm/init.c | ||
576 | +++ b/arch/x86/mm/init.c | ||
577 | @@ -6,6 +6,7 @@ | ||
578 | #include <linux/bootmem.h> /* for max_low_pfn */ | ||
579 | #include <linux/swapfile.h> | ||
580 | #include <linux/swapops.h> | ||
581 | +#include <linux/kmemleak.h> | ||
582 | |||
583 | #include <asm/set_memory.h> | ||
584 | #include <asm/e820/api.h> | ||
585 | @@ -767,6 +768,11 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | ||
586 | if (debug_pagealloc_enabled()) { | ||
587 | pr_info("debug: unmapping init [mem %#010lx-%#010lx]\n", | ||
588 | begin, end - 1); | ||
589 | + /* | ||
590 | + * Inform kmemleak about the hole in the memory since the | ||
591 | + * corresponding pages will be unmapped. | ||
592 | + */ | ||
593 | + kmemleak_free_part((void *)begin, end - begin); | ||
594 | set_memory_np(begin, (end - begin) >> PAGE_SHIFT); | ||
595 | } else { | ||
596 | /* | ||
597 | diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c | ||
598 | index 61db77b0eda9..0988971069c9 100644 | ||
599 | --- a/arch/x86/mm/kaslr.c | ||
600 | +++ b/arch/x86/mm/kaslr.c | ||
601 | @@ -93,7 +93,7 @@ void __init kernel_randomize_memory(void) | ||
602 | if (!kaslr_memory_enabled()) | ||
603 | return; | ||
604 | |||
605 | - kaslr_regions[0].size_tb = 1 << (__PHYSICAL_MASK_SHIFT - TB_SHIFT); | ||
606 | + kaslr_regions[0].size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT); | ||
607 | kaslr_regions[1].size_tb = VMALLOC_SIZE_TB; | ||
608 | |||
609 | /* | ||
610 | diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c | ||
611 | index a6d1b0241aea..a6836ab0fcc7 100644 | ||
612 | --- a/arch/x86/mm/tlb.c | ||
613 | +++ b/arch/x86/mm/tlb.c | ||
614 | @@ -694,7 +694,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | ||
615 | { | ||
616 | int cpu; | ||
617 | |||
618 | - struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = { | ||
619 | + struct flush_tlb_info info = { | ||
620 | .mm = mm, | ||
621 | }; | ||
622 | |||
623 | diff --git a/block/blk-core.c b/block/blk-core.c | ||
624 | index eb8b52241453..33488b1426b7 100644 | ||
625 | --- a/block/blk-core.c | ||
626 | +++ b/block/blk-core.c | ||
627 | @@ -980,6 +980,10 @@ static void blk_rq_timed_out_timer(struct timer_list *t) | ||
628 | kblockd_schedule_work(&q->timeout_work); | ||
629 | } | ||
630 | |||
631 | +static void blk_timeout_work_dummy(struct work_struct *work) | ||
632 | +{ | ||
633 | +} | ||
634 | + | ||
635 | /** | ||
636 | * blk_alloc_queue_node - allocate a request queue | ||
637 | * @gfp_mask: memory allocation flags | ||
638 | @@ -1034,7 +1038,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, | ||
639 | timer_setup(&q->backing_dev_info->laptop_mode_wb_timer, | ||
640 | laptop_mode_timer_fn, 0); | ||
641 | timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); | ||
642 | - INIT_WORK(&q->timeout_work, NULL); | ||
643 | + INIT_WORK(&q->timeout_work, blk_timeout_work_dummy); | ||
644 | INIT_LIST_HEAD(&q->timeout_list); | ||
645 | INIT_LIST_HEAD(&q->icq_list); | ||
646 | #ifdef CONFIG_BLK_CGROUP | ||
647 | diff --git a/block/blk-mq.c b/block/blk-mq.c | ||
648 | index 7d53f2314d7c..414656796ecf 100644 | ||
649 | --- a/block/blk-mq.c | ||
650 | +++ b/block/blk-mq.c | ||
651 | @@ -2236,7 +2236,7 @@ static int blk_mq_init_hctx(struct request_queue *q, | ||
652 | return 0; | ||
653 | |||
654 | free_fq: | ||
655 | - kfree(hctx->fq); | ||
656 | + blk_free_flush_queue(hctx->fq); | ||
657 | exit_hctx: | ||
658 | if (set->ops->exit_hctx) | ||
659 | set->ops->exit_hctx(hctx, hctx_idx); | ||
660 | diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c | ||
661 | index c24589414c75..0f36db0cf74a 100644 | ||
662 | --- a/drivers/block/xsysace.c | ||
663 | +++ b/drivers/block/xsysace.c | ||
664 | @@ -1063,6 +1063,8 @@ static int ace_setup(struct ace_device *ace) | ||
665 | return 0; | ||
666 | |||
667 | err_read: | ||
668 | + /* prevent double queue cleanup */ | ||
669 | + ace->gd->queue = NULL; | ||
670 | put_disk(ace->gd); | ||
671 | err_alloc_disk: | ||
672 | blk_cleanup_queue(ace->queue); | ||
673 | diff --git a/drivers/bluetooth/btmtkuart.c b/drivers/bluetooth/btmtkuart.c | ||
674 | index 4593baff2bc9..19eecf198321 100644 | ||
675 | --- a/drivers/bluetooth/btmtkuart.c | ||
676 | +++ b/drivers/bluetooth/btmtkuart.c | ||
677 | @@ -115,11 +115,13 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, u8 op, u8 flag, u16 plen, | ||
678 | TASK_INTERRUPTIBLE, HCI_INIT_TIMEOUT); | ||
679 | if (err == -EINTR) { | ||
680 | bt_dev_err(hdev, "Execution of wmt command interrupted"); | ||
681 | + clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state); | ||
682 | return err; | ||
683 | } | ||
684 | |||
685 | if (err) { | ||
686 | bt_dev_err(hdev, "Execution of wmt command timed out"); | ||
687 | + clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state); | ||
688 | return -ETIMEDOUT; | ||
689 | } | ||
690 | |||
691 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c | ||
692 | index 77b67a5f21ee..40a4f95f6178 100644 | ||
693 | --- a/drivers/bluetooth/btusb.c | ||
694 | +++ b/drivers/bluetooth/btusb.c | ||
695 | @@ -2888,6 +2888,7 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) | ||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | + irq_set_status_flags(irq, IRQ_NOAUTOEN); | ||
700 | ret = devm_request_irq(&hdev->dev, irq, btusb_oob_wake_handler, | ||
701 | 0, "OOB Wake-on-BT", data); | ||
702 | if (ret) { | ||
703 | @@ -2902,7 +2903,6 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) | ||
704 | } | ||
705 | |||
706 | data->oob_wake_irq = irq; | ||
707 | - disable_irq(irq); | ||
708 | bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq); | ||
709 | return 0; | ||
710 | } | ||
711 | diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c | ||
712 | index 9f0ae403d5f5..cd937ce6aaaf 100644 | ||
713 | --- a/drivers/clk/qcom/gcc-msm8998.c | ||
714 | +++ b/drivers/clk/qcom/gcc-msm8998.c | ||
715 | @@ -1101,6 +1101,7 @@ static struct clk_rcg2 ufs_axi_clk_src = { | ||
716 | |||
717 | static const struct freq_tbl ftbl_usb30_master_clk_src[] = { | ||
718 | F(19200000, P_XO, 1, 0, 0), | ||
719 | + F(60000000, P_GPLL0_OUT_MAIN, 10, 0, 0), | ||
720 | F(120000000, P_GPLL0_OUT_MAIN, 5, 0, 0), | ||
721 | F(150000000, P_GPLL0_OUT_MAIN, 4, 0, 0), | ||
722 | { } | ||
723 | diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c | ||
724 | index d977193842df..19174835693b 100644 | ||
725 | --- a/drivers/clk/x86/clk-pmc-atom.c | ||
726 | +++ b/drivers/clk/x86/clk-pmc-atom.c | ||
727 | @@ -165,7 +165,7 @@ static const struct clk_ops plt_clk_ops = { | ||
728 | }; | ||
729 | |||
730 | static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, | ||
731 | - void __iomem *base, | ||
732 | + const struct pmc_clk_data *pmc_data, | ||
733 | const char **parent_names, | ||
734 | int num_parents) | ||
735 | { | ||
736 | @@ -184,9 +184,17 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, | ||
737 | init.num_parents = num_parents; | ||
738 | |||
739 | pclk->hw.init = &init; | ||
740 | - pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; | ||
741 | + pclk->reg = pmc_data->base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; | ||
742 | spin_lock_init(&pclk->lock); | ||
743 | |||
744 | + /* | ||
745 | + * On some systems, the pmc_plt_clocks already enabled by the | ||
746 | + * firmware are being marked as critical to avoid them being | ||
747 | + * gated by the clock framework. | ||
748 | + */ | ||
749 | + if (pmc_data->critical && plt_clk_is_enabled(&pclk->hw)) | ||
750 | + init.flags |= CLK_IS_CRITICAL; | ||
751 | + | ||
752 | ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); | ||
753 | if (ret) { | ||
754 | pclk = ERR_PTR(ret); | ||
755 | @@ -332,7 +340,7 @@ static int plt_clk_probe(struct platform_device *pdev) | ||
756 | return PTR_ERR(parent_names); | ||
757 | |||
758 | for (i = 0; i < PMC_CLK_NUM; i++) { | ||
759 | - data->clks[i] = plt_clk_register(pdev, i, pmc_data->base, | ||
760 | + data->clks[i] = plt_clk_register(pdev, i, pmc_data, | ||
761 | parent_names, data->nparents); | ||
762 | if (IS_ERR(data->clks[i])) { | ||
763 | err = PTR_ERR(data->clks[i]); | ||
764 | diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c | ||
765 | index b0aeffd4e269..1606abead22c 100644 | ||
766 | --- a/drivers/firmware/efi/runtime-wrappers.c | ||
767 | +++ b/drivers/firmware/efi/runtime-wrappers.c | ||
768 | @@ -95,7 +95,7 @@ struct efi_runtime_work { | ||
769 | efi_rts_work.status = EFI_ABORTED; \ | ||
770 | \ | ||
771 | init_completion(&efi_rts_work.efi_rts_comp); \ | ||
772 | - INIT_WORK_ONSTACK(&efi_rts_work.work, efi_call_rts); \ | ||
773 | + INIT_WORK(&efi_rts_work.work, efi_call_rts); \ | ||
774 | efi_rts_work.arg1 = _arg1; \ | ||
775 | efi_rts_work.arg2 = _arg2; \ | ||
776 | efi_rts_work.arg3 = _arg3; \ | ||
777 | diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c | ||
778 | index 2d1dfa1e0745..e86e61dda4b7 100644 | ||
779 | --- a/drivers/gpio/gpio-mxc.c | ||
780 | +++ b/drivers/gpio/gpio-mxc.c | ||
781 | @@ -438,8 +438,11 @@ static int mxc_gpio_probe(struct platform_device *pdev) | ||
782 | |||
783 | /* the controller clock is optional */ | ||
784 | port->clk = devm_clk_get(&pdev->dev, NULL); | ||
785 | - if (IS_ERR(port->clk)) | ||
786 | + if (IS_ERR(port->clk)) { | ||
787 | + if (PTR_ERR(port->clk) == -EPROBE_DEFER) | ||
788 | + return -EPROBE_DEFER; | ||
789 | port->clk = NULL; | ||
790 | + } | ||
791 | |||
792 | err = clk_prepare_enable(port->clk); | ||
793 | if (err) { | ||
794 | diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c | ||
795 | index ebc9ffde41e9..a353a011fbdf 100644 | ||
796 | --- a/drivers/hid/hid-debug.c | ||
797 | +++ b/drivers/hid/hid-debug.c | ||
798 | @@ -1060,10 +1060,15 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p) | ||
799 | seq_printf(f, "\n\n"); | ||
800 | |||
801 | /* dump parsed data and input mappings */ | ||
802 | + if (down_interruptible(&hdev->driver_input_lock)) | ||
803 | + return 0; | ||
804 | + | ||
805 | hid_dump_device(hdev, f); | ||
806 | seq_printf(f, "\n"); | ||
807 | hid_dump_input_mapping(hdev, f); | ||
808 | |||
809 | + up(&hdev->driver_input_lock); | ||
810 | + | ||
811 | return 0; | ||
812 | } | ||
813 | |||
814 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c | ||
815 | index a3916e58dbf5..e649940e065d 100644 | ||
816 | --- a/drivers/hid/hid-input.c | ||
817 | +++ b/drivers/hid/hid-input.c | ||
818 | @@ -982,6 +982,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | ||
819 | case 0x1b8: map_key_clear(KEY_VIDEO); break; | ||
820 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; | ||
821 | case 0x1bd: map_key_clear(KEY_INFO); break; | ||
822 | + case 0x1cb: map_key_clear(KEY_ASSISTANT); break; | ||
823 | case 0x201: map_key_clear(KEY_NEW); break; | ||
824 | case 0x202: map_key_clear(KEY_OPEN); break; | ||
825 | case 0x203: map_key_clear(KEY_CLOSE); break; | ||
826 | diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c | ||
827 | index 19cc980eebce..8425d3548a41 100644 | ||
828 | --- a/drivers/hid/hid-logitech-hidpp.c | ||
829 | +++ b/drivers/hid/hid-logitech-hidpp.c | ||
830 | @@ -1907,6 +1907,13 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) | ||
831 | kfree(data); | ||
832 | return -ENOMEM; | ||
833 | } | ||
834 | + data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); | ||
835 | + if (!data->wq) { | ||
836 | + kfree(data->effect_ids); | ||
837 | + kfree(data); | ||
838 | + return -ENOMEM; | ||
839 | + } | ||
840 | + | ||
841 | data->hidpp = hidpp; | ||
842 | data->feature_index = feature_index; | ||
843 | data->version = version; | ||
844 | @@ -1951,7 +1958,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) | ||
845 | /* ignore boost value at response.fap.params[2] */ | ||
846 | |||
847 | /* init the hardware command queue */ | ||
848 | - data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); | ||
849 | atomic_set(&data->workqueue_size, 0); | ||
850 | |||
851 | /* initialize with zero autocenter to get wheel in usable state */ | ||
852 | diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c | ||
853 | index 94088c0ed68a..e24790c988c0 100644 | ||
854 | --- a/drivers/hid/hid-quirks.c | ||
855 | +++ b/drivers/hid/hid-quirks.c | ||
856 | @@ -744,7 +744,6 @@ static const struct hid_device_id hid_ignore_list[] = { | ||
857 | { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, | ||
858 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, | ||
859 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, | ||
860 | - { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0400) }, | ||
861 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, | ||
862 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, | ||
863 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, | ||
864 | @@ -1025,6 +1024,10 @@ bool hid_ignore(struct hid_device *hdev) | ||
865 | if (hdev->product == 0x0401 && | ||
866 | strncmp(hdev->name, "ELAN0800", 8) != 0) | ||
867 | return true; | ||
868 | + /* Same with product id 0x0400 */ | ||
869 | + if (hdev->product == 0x0400 && | ||
870 | + strncmp(hdev->name, "QTEC0001", 8) != 0) | ||
871 | + return true; | ||
872 | break; | ||
873 | } | ||
874 | |||
875 | diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c | ||
876 | index c406700789e1..7bd409eaf0ac 100644 | ||
877 | --- a/drivers/i2c/busses/i2c-imx.c | ||
878 | +++ b/drivers/i2c/busses/i2c-imx.c | ||
879 | @@ -510,9 +510,9 @@ static int i2c_imx_clk_notifier_call(struct notifier_block *nb, | ||
880 | unsigned long action, void *data) | ||
881 | { | ||
882 | struct clk_notifier_data *ndata = data; | ||
883 | - struct imx_i2c_struct *i2c_imx = container_of(&ndata->clk, | ||
884 | + struct imx_i2c_struct *i2c_imx = container_of(nb, | ||
885 | struct imx_i2c_struct, | ||
886 | - clk); | ||
887 | + clk_change_nb); | ||
888 | |||
889 | if (action & POST_RATE_CHANGE) | ||
890 | i2c_imx_set_clk(i2c_imx, ndata->new_rate); | ||
891 | diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c | ||
892 | index 62d023e737d9..a492da9fd0d3 100644 | ||
893 | --- a/drivers/i2c/busses/i2c-stm32f7.c | ||
894 | +++ b/drivers/i2c/busses/i2c-stm32f7.c | ||
895 | @@ -424,7 +424,7 @@ static int stm32f7_i2c_compute_timing(struct stm32f7_i2c_dev *i2c_dev, | ||
896 | STM32F7_I2C_ANALOG_FILTER_DELAY_MAX : 0); | ||
897 | dnf_delay = setup->dnf * i2cclk; | ||
898 | |||
899 | - sdadel_min = setup->fall_time - i2c_specs[setup->speed].hddat_min - | ||
900 | + sdadel_min = i2c_specs[setup->speed].hddat_min + setup->fall_time - | ||
901 | af_delay_min - (setup->dnf + 3) * i2cclk; | ||
902 | |||
903 | sdadel_max = i2c_specs[setup->speed].vddat_max - setup->rise_time - | ||
904 | diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c | ||
905 | index 915f5edbab33..e6c554e6ba58 100644 | ||
906 | --- a/drivers/i2c/busses/i2c-synquacer.c | ||
907 | +++ b/drivers/i2c/busses/i2c-synquacer.c | ||
908 | @@ -602,6 +602,8 @@ static int synquacer_i2c_probe(struct platform_device *pdev) | ||
909 | i2c->adapter = synquacer_i2c_ops; | ||
910 | i2c_set_adapdata(&i2c->adapter, i2c); | ||
911 | i2c->adapter.dev.parent = &pdev->dev; | ||
912 | + i2c->adapter.dev.of_node = pdev->dev.of_node; | ||
913 | + ACPI_COMPANION_SET(&i2c->adapter.dev, ACPI_COMPANION(&pdev->dev)); | ||
914 | i2c->adapter.nr = pdev->id; | ||
915 | init_completion(&i2c->completion); | ||
916 | |||
917 | diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c | ||
918 | index 9200e349f29e..5b0e1d9e5adc 100644 | ||
919 | --- a/drivers/i2c/i2c-core-base.c | ||
920 | +++ b/drivers/i2c/i2c-core-base.c | ||
921 | @@ -306,10 +306,7 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client) | ||
922 | if (client->flags & I2C_CLIENT_TEN) | ||
923 | return -EINVAL; | ||
924 | |||
925 | - irq = irq_find_mapping(adap->host_notify_domain, client->addr); | ||
926 | - if (!irq) | ||
927 | - irq = irq_create_mapping(adap->host_notify_domain, | ||
928 | - client->addr); | ||
929 | + irq = irq_create_mapping(adap->host_notify_domain, client->addr); | ||
930 | |||
931 | return irq > 0 ? irq : -ENXIO; | ||
932 | } | ||
933 | @@ -330,6 +327,8 @@ static int i2c_device_probe(struct device *dev) | ||
934 | |||
935 | if (client->flags & I2C_CLIENT_HOST_NOTIFY) { | ||
936 | dev_dbg(dev, "Using Host Notify IRQ\n"); | ||
937 | + /* Keep adapter active when Host Notify is required */ | ||
938 | + pm_runtime_get_sync(&client->adapter->dev); | ||
939 | irq = i2c_smbus_host_notify_to_irq(client); | ||
940 | } else if (dev->of_node) { | ||
941 | irq = of_irq_get_byname(dev->of_node, "irq"); | ||
942 | @@ -433,6 +432,10 @@ static int i2c_device_remove(struct device *dev) | ||
943 | dev_pm_clear_wake_irq(&client->dev); | ||
944 | device_init_wakeup(&client->dev, false); | ||
945 | |||
946 | + client->irq = client->init_irq; | ||
947 | + if (client->flags & I2C_CLIENT_HOST_NOTIFY) | ||
948 | + pm_runtime_put(&client->adapter->dev); | ||
949 | + | ||
950 | return status; | ||
951 | } | ||
952 | |||
953 | @@ -742,10 +745,11 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | ||
954 | client->flags = info->flags; | ||
955 | client->addr = info->addr; | ||
956 | |||
957 | - client->irq = info->irq; | ||
958 | - if (!client->irq) | ||
959 | - client->irq = i2c_dev_irq_from_resources(info->resources, | ||
960 | + client->init_irq = info->irq; | ||
961 | + if (!client->init_irq) | ||
962 | + client->init_irq = i2c_dev_irq_from_resources(info->resources, | ||
963 | info->num_resources); | ||
964 | + client->irq = client->init_irq; | ||
965 | |||
966 | strlcpy(client->name, info->type, sizeof(client->name)); | ||
967 | |||
968 | diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c | ||
969 | index 9b0bea8303e0..b79b61bd6ee4 100644 | ||
970 | --- a/drivers/infiniband/core/security.c | ||
971 | +++ b/drivers/infiniband/core/security.c | ||
972 | @@ -711,16 +711,20 @@ int ib_mad_agent_security_setup(struct ib_mad_agent *agent, | ||
973 | agent->device->name, | ||
974 | agent->port_num); | ||
975 | if (ret) | ||
976 | - return ret; | ||
977 | + goto free_security; | ||
978 | |||
979 | agent->lsm_nb.notifier_call = ib_mad_agent_security_change; | ||
980 | ret = register_lsm_notifier(&agent->lsm_nb); | ||
981 | if (ret) | ||
982 | - return ret; | ||
983 | + goto free_security; | ||
984 | |||
985 | agent->smp_allowed = true; | ||
986 | agent->lsm_nb_reg = true; | ||
987 | return 0; | ||
988 | + | ||
989 | +free_security: | ||
990 | + security_ib_free_security(agent->security); | ||
991 | + return ret; | ||
992 | } | ||
993 | |||
994 | void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent) | ||
995 | @@ -728,9 +732,10 @@ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent) | ||
996 | if (!rdma_protocol_ib(agent->device, agent->port_num)) | ||
997 | return; | ||
998 | |||
999 | - security_ib_free_security(agent->security); | ||
1000 | if (agent->lsm_nb_reg) | ||
1001 | unregister_lsm_notifier(&agent->lsm_nb); | ||
1002 | + | ||
1003 | + security_ib_free_security(agent->security); | ||
1004 | } | ||
1005 | |||
1006 | int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index) | ||
1007 | diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c | ||
1008 | index 6ee03d6089eb..82f309fb3ce5 100644 | ||
1009 | --- a/drivers/infiniband/core/verbs.c | ||
1010 | +++ b/drivers/infiniband/core/verbs.c | ||
1011 | @@ -1087,8 +1087,8 @@ struct ib_qp *ib_open_qp(struct ib_xrcd *xrcd, | ||
1012 | } | ||
1013 | EXPORT_SYMBOL(ib_open_qp); | ||
1014 | |||
1015 | -static struct ib_qp *ib_create_xrc_qp(struct ib_qp *qp, | ||
1016 | - struct ib_qp_init_attr *qp_init_attr) | ||
1017 | +static struct ib_qp *create_xrc_qp(struct ib_qp *qp, | ||
1018 | + struct ib_qp_init_attr *qp_init_attr) | ||
1019 | { | ||
1020 | struct ib_qp *real_qp = qp; | ||
1021 | |||
1022 | @@ -1103,10 +1103,10 @@ static struct ib_qp *ib_create_xrc_qp(struct ib_qp *qp, | ||
1023 | |||
1024 | qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, | ||
1025 | qp_init_attr->qp_context); | ||
1026 | - if (!IS_ERR(qp)) | ||
1027 | - __ib_insert_xrcd_qp(qp_init_attr->xrcd, real_qp); | ||
1028 | - else | ||
1029 | - real_qp->device->destroy_qp(real_qp); | ||
1030 | + if (IS_ERR(qp)) | ||
1031 | + return qp; | ||
1032 | + | ||
1033 | + __ib_insert_xrcd_qp(qp_init_attr->xrcd, real_qp); | ||
1034 | return qp; | ||
1035 | } | ||
1036 | |||
1037 | @@ -1137,10 +1137,8 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | ||
1038 | return qp; | ||
1039 | |||
1040 | ret = ib_create_qp_security(qp, device); | ||
1041 | - if (ret) { | ||
1042 | - ib_destroy_qp(qp); | ||
1043 | - return ERR_PTR(ret); | ||
1044 | - } | ||
1045 | + if (ret) | ||
1046 | + goto err; | ||
1047 | |||
1048 | qp->real_qp = qp; | ||
1049 | qp->qp_type = qp_init_attr->qp_type; | ||
1050 | @@ -1153,8 +1151,15 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | ||
1051 | INIT_LIST_HEAD(&qp->sig_mrs); | ||
1052 | qp->port = 0; | ||
1053 | |||
1054 | - if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) | ||
1055 | - return ib_create_xrc_qp(qp, qp_init_attr); | ||
1056 | + if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) { | ||
1057 | + struct ib_qp *xrc_qp = create_xrc_qp(qp, qp_init_attr); | ||
1058 | + | ||
1059 | + if (IS_ERR(xrc_qp)) { | ||
1060 | + ret = PTR_ERR(xrc_qp); | ||
1061 | + goto err; | ||
1062 | + } | ||
1063 | + return xrc_qp; | ||
1064 | + } | ||
1065 | |||
1066 | qp->event_handler = qp_init_attr->event_handler; | ||
1067 | qp->qp_context = qp_init_attr->qp_context; | ||
1068 | @@ -1181,11 +1186,8 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | ||
1069 | |||
1070 | if (qp_init_attr->cap.max_rdma_ctxs) { | ||
1071 | ret = rdma_rw_init_mrs(qp, qp_init_attr); | ||
1072 | - if (ret) { | ||
1073 | - pr_err("failed to init MR pool ret= %d\n", ret); | ||
1074 | - ib_destroy_qp(qp); | ||
1075 | - return ERR_PTR(ret); | ||
1076 | - } | ||
1077 | + if (ret) | ||
1078 | + goto err; | ||
1079 | } | ||
1080 | |||
1081 | /* | ||
1082 | @@ -1198,6 +1200,11 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | ||
1083 | device->attrs.max_sge_rd); | ||
1084 | |||
1085 | return qp; | ||
1086 | + | ||
1087 | +err: | ||
1088 | + ib_destroy_qp(qp); | ||
1089 | + return ERR_PTR(ret); | ||
1090 | + | ||
1091 | } | ||
1092 | EXPORT_SYMBOL(ib_create_qp); | ||
1093 | |||
1094 | diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c | ||
1095 | index f4bce5aa0ff8..ea4afdeb06a4 100644 | ||
1096 | --- a/drivers/infiniband/ulp/srpt/ib_srpt.c | ||
1097 | +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | ||
1098 | @@ -2793,8 +2793,19 @@ static void srpt_queue_tm_rsp(struct se_cmd *cmd) | ||
1099 | srpt_queue_response(cmd); | ||
1100 | } | ||
1101 | |||
1102 | +/* | ||
1103 | + * This function is called for aborted commands if no response is sent to the | ||
1104 | + * initiator. Make sure that the credits freed by aborting a command are | ||
1105 | + * returned to the initiator the next time a response is sent by incrementing | ||
1106 | + * ch->req_lim_delta. | ||
1107 | + */ | ||
1108 | static void srpt_aborted_task(struct se_cmd *cmd) | ||
1109 | { | ||
1110 | + struct srpt_send_ioctx *ioctx = container_of(cmd, | ||
1111 | + struct srpt_send_ioctx, cmd); | ||
1112 | + struct srpt_rdma_ch *ch = ioctx->ch; | ||
1113 | + | ||
1114 | + atomic_inc(&ch->req_lim_delta); | ||
1115 | } | ||
1116 | |||
1117 | static int srpt_queue_status(struct se_cmd *cmd) | ||
1118 | diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c | ||
1119 | index effb63205d3d..4c67cf30a5d9 100644 | ||
1120 | --- a/drivers/input/keyboard/snvs_pwrkey.c | ||
1121 | +++ b/drivers/input/keyboard/snvs_pwrkey.c | ||
1122 | @@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) | ||
1123 | return error; | ||
1124 | } | ||
1125 | |||
1126 | + pdata->input = input; | ||
1127 | + platform_set_drvdata(pdev, pdata); | ||
1128 | + | ||
1129 | error = devm_request_irq(&pdev->dev, pdata->irq, | ||
1130 | imx_snvs_pwrkey_interrupt, | ||
1131 | 0, pdev->name, pdev); | ||
1132 | @@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) | ||
1133 | return error; | ||
1134 | } | ||
1135 | |||
1136 | - pdata->input = input; | ||
1137 | - platform_set_drvdata(pdev, pdata); | ||
1138 | - | ||
1139 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
1140 | |||
1141 | return 0; | ||
1142 | diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c | ||
1143 | index 704e99046916..b6f95f20f924 100644 | ||
1144 | --- a/drivers/input/touchscreen/stmfts.c | ||
1145 | +++ b/drivers/input/touchscreen/stmfts.c | ||
1146 | @@ -106,27 +106,29 @@ struct stmfts_data { | ||
1147 | bool running; | ||
1148 | }; | ||
1149 | |||
1150 | -static void stmfts_brightness_set(struct led_classdev *led_cdev, | ||
1151 | +static int stmfts_brightness_set(struct led_classdev *led_cdev, | ||
1152 | enum led_brightness value) | ||
1153 | { | ||
1154 | struct stmfts_data *sdata = container_of(led_cdev, | ||
1155 | struct stmfts_data, led_cdev); | ||
1156 | int err; | ||
1157 | |||
1158 | - if (value == sdata->led_status || !sdata->ledvdd) | ||
1159 | - return; | ||
1160 | - | ||
1161 | - if (!value) { | ||
1162 | - regulator_disable(sdata->ledvdd); | ||
1163 | - } else { | ||
1164 | - err = regulator_enable(sdata->ledvdd); | ||
1165 | - if (err) | ||
1166 | - dev_warn(&sdata->client->dev, | ||
1167 | - "failed to disable ledvdd regulator: %d\n", | ||
1168 | - err); | ||
1169 | + if (value != sdata->led_status && sdata->ledvdd) { | ||
1170 | + if (!value) { | ||
1171 | + regulator_disable(sdata->ledvdd); | ||
1172 | + } else { | ||
1173 | + err = regulator_enable(sdata->ledvdd); | ||
1174 | + if (err) { | ||
1175 | + dev_warn(&sdata->client->dev, | ||
1176 | + "failed to disable ledvdd regulator: %d\n", | ||
1177 | + err); | ||
1178 | + return err; | ||
1179 | + } | ||
1180 | + } | ||
1181 | + sdata->led_status = value; | ||
1182 | } | ||
1183 | |||
1184 | - sdata->led_status = value; | ||
1185 | + return 0; | ||
1186 | } | ||
1187 | |||
1188 | static enum led_brightness stmfts_brightness_get(struct led_classdev *led_cdev) | ||
1189 | @@ -608,7 +610,7 @@ static int stmfts_enable_led(struct stmfts_data *sdata) | ||
1190 | sdata->led_cdev.name = STMFTS_DEV_NAME; | ||
1191 | sdata->led_cdev.max_brightness = LED_ON; | ||
1192 | sdata->led_cdev.brightness = LED_OFF; | ||
1193 | - sdata->led_cdev.brightness_set = stmfts_brightness_set; | ||
1194 | + sdata->led_cdev.brightness_set_blocking = stmfts_brightness_set; | ||
1195 | sdata->led_cdev.brightness_get = stmfts_brightness_get; | ||
1196 | |||
1197 | err = devm_led_classdev_register(&sdata->client->dev, &sdata->led_cdev); | ||
1198 | diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c | ||
1199 | index 64d1402882c8..1f71c14c8aab 100644 | ||
1200 | --- a/drivers/media/i2c/ov7670.c | ||
1201 | +++ b/drivers/media/i2c/ov7670.c | ||
1202 | @@ -159,10 +159,10 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | ||
1203 | #define REG_GFIX 0x69 /* Fix gain control */ | ||
1204 | |||
1205 | #define REG_DBLV 0x6b /* PLL control an debugging */ | ||
1206 | -#define DBLV_BYPASS 0x00 /* Bypass PLL */ | ||
1207 | -#define DBLV_X4 0x01 /* clock x4 */ | ||
1208 | -#define DBLV_X6 0x10 /* clock x6 */ | ||
1209 | -#define DBLV_X8 0x11 /* clock x8 */ | ||
1210 | +#define DBLV_BYPASS 0x0a /* Bypass PLL */ | ||
1211 | +#define DBLV_X4 0x4a /* clock x4 */ | ||
1212 | +#define DBLV_X6 0x8a /* clock x6 */ | ||
1213 | +#define DBLV_X8 0xca /* clock x8 */ | ||
1214 | |||
1215 | #define REG_SCALING_XSC 0x70 /* Test pattern and horizontal scale factor */ | ||
1216 | #define TEST_PATTTERN_0 0x80 | ||
1217 | @@ -862,7 +862,7 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd, | ||
1218 | if (ret < 0) | ||
1219 | return ret; | ||
1220 | |||
1221 | - return ov7670_write(sd, REG_DBLV, DBLV_X4); | ||
1222 | + return 0; | ||
1223 | } | ||
1224 | |||
1225 | static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd, | ||
1226 | @@ -1797,11 +1797,7 @@ static int ov7670_probe(struct i2c_client *client, | ||
1227 | if (config->clock_speed) | ||
1228 | info->clock_speed = config->clock_speed; | ||
1229 | |||
1230 | - /* | ||
1231 | - * It should be allowed for ov7670 too when it is migrated to | ||
1232 | - * the new frame rate formula. | ||
1233 | - */ | ||
1234 | - if (config->pll_bypass && id->driver_data != MODEL_OV7670) | ||
1235 | + if (config->pll_bypass) | ||
1236 | info->pll_bypass = true; | ||
1237 | |||
1238 | if (config->pclk_hb_disable) | ||
1239 | diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c | ||
1240 | index 299016bc46d9..104477b512a2 100644 | ||
1241 | --- a/drivers/mfd/twl-core.c | ||
1242 | +++ b/drivers/mfd/twl-core.c | ||
1243 | @@ -1245,6 +1245,28 @@ free: | ||
1244 | return status; | ||
1245 | } | ||
1246 | |||
1247 | +static int __maybe_unused twl_suspend(struct device *dev) | ||
1248 | +{ | ||
1249 | + struct i2c_client *client = to_i2c_client(dev); | ||
1250 | + | ||
1251 | + if (client->irq) | ||
1252 | + disable_irq(client->irq); | ||
1253 | + | ||
1254 | + return 0; | ||
1255 | +} | ||
1256 | + | ||
1257 | +static int __maybe_unused twl_resume(struct device *dev) | ||
1258 | +{ | ||
1259 | + struct i2c_client *client = to_i2c_client(dev); | ||
1260 | + | ||
1261 | + if (client->irq) | ||
1262 | + enable_irq(client->irq); | ||
1263 | + | ||
1264 | + return 0; | ||
1265 | +} | ||
1266 | + | ||
1267 | +static SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume); | ||
1268 | + | ||
1269 | static const struct i2c_device_id twl_ids[] = { | ||
1270 | { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ | ||
1271 | { "twl5030", 0 }, /* T2 updated */ | ||
1272 | @@ -1262,6 +1284,7 @@ static const struct i2c_device_id twl_ids[] = { | ||
1273 | /* One Client Driver , 4 Clients */ | ||
1274 | static struct i2c_driver twl_driver = { | ||
1275 | .driver.name = DRIVER_NAME, | ||
1276 | + .driver.pm = &twl_dev_pm_ops, | ||
1277 | .id_table = twl_ids, | ||
1278 | .probe = twl_probe, | ||
1279 | .remove = twl_remove, | ||
1280 | diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c | ||
1281 | index 2f120b2ffef0..4985268e2273 100644 | ||
1282 | --- a/drivers/net/bonding/bond_sysfs_slave.c | ||
1283 | +++ b/drivers/net/bonding/bond_sysfs_slave.c | ||
1284 | @@ -55,7 +55,9 @@ static SLAVE_ATTR_RO(link_failure_count); | ||
1285 | |||
1286 | static ssize_t perm_hwaddr_show(struct slave *slave, char *buf) | ||
1287 | { | ||
1288 | - return sprintf(buf, "%pM\n", slave->perm_hwaddr); | ||
1289 | + return sprintf(buf, "%*phC\n", | ||
1290 | + slave->dev->addr_len, | ||
1291 | + slave->perm_hwaddr); | ||
1292 | } | ||
1293 | static SLAVE_ATTR_RO(perm_hwaddr); | ||
1294 | |||
1295 | diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | ||
1296 | index 74849be5f004..e2919005ead3 100644 | ||
1297 | --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | ||
1298 | +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | ||
1299 | @@ -354,7 +354,10 @@ static struct cxgbi_ppm_pool *ppm_alloc_cpu_pool(unsigned int *total, | ||
1300 | ppmax = max; | ||
1301 | |||
1302 | /* pool size must be multiple of unsigned long */ | ||
1303 | - bmap = BITS_TO_LONGS(ppmax); | ||
1304 | + bmap = ppmax / BITS_PER_TYPE(unsigned long); | ||
1305 | + if (!bmap) | ||
1306 | + return NULL; | ||
1307 | + | ||
1308 | ppmax = (bmap * sizeof(unsigned long)) << 3; | ||
1309 | |||
1310 | alloc_sz = sizeof(*pools) + sizeof(unsigned long) * bmap; | ||
1311 | @@ -402,6 +405,10 @@ int cxgbi_ppm_init(void **ppm_pp, struct net_device *ndev, | ||
1312 | if (reserve_factor) { | ||
1313 | ppmax_pool = ppmax / reserve_factor; | ||
1314 | pool = ppm_alloc_cpu_pool(&ppmax_pool, &pool_index_max); | ||
1315 | + if (!pool) { | ||
1316 | + ppmax_pool = 0; | ||
1317 | + reserve_factor = 0; | ||
1318 | + } | ||
1319 | |||
1320 | pr_debug("%s: ppmax %u, cpu total %u, per cpu %u.\n", | ||
1321 | ndev->name, ppmax, ppmax_pool, pool_index_max); | ||
1322 | diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c | ||
1323 | index 79d03f8ee7b1..c7fa97a7e1f4 100644 | ||
1324 | --- a/drivers/net/ethernet/hisilicon/hns/hnae.c | ||
1325 | +++ b/drivers/net/ethernet/hisilicon/hns/hnae.c | ||
1326 | @@ -150,7 +150,6 @@ out_buffer_fail: | ||
1327 | /* free desc along with its attached buffer */ | ||
1328 | static void hnae_free_desc(struct hnae_ring *ring) | ||
1329 | { | ||
1330 | - hnae_free_buffers(ring); | ||
1331 | dma_unmap_single(ring_to_dev(ring), ring->desc_dma_addr, | ||
1332 | ring->desc_num * sizeof(ring->desc[0]), | ||
1333 | ring_to_dma_dir(ring)); | ||
1334 | @@ -183,6 +182,9 @@ static int hnae_alloc_desc(struct hnae_ring *ring) | ||
1335 | /* fini ring, also free the buffer for the ring */ | ||
1336 | static void hnae_fini_ring(struct hnae_ring *ring) | ||
1337 | { | ||
1338 | + if (is_rx_ring(ring)) | ||
1339 | + hnae_free_buffers(ring); | ||
1340 | + | ||
1341 | hnae_free_desc(ring); | ||
1342 | kfree(ring->desc_cb); | ||
1343 | ring->desc_cb = NULL; | ||
1344 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | ||
1345 | index b8155f5e71b4..fdff5526d2e8 100644 | ||
1346 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | ||
1347 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | ||
1348 | @@ -2750,6 +2750,17 @@ int hns_dsaf_get_regs_count(void) | ||
1349 | return DSAF_DUMP_REGS_NUM; | ||
1350 | } | ||
1351 | |||
1352 | +static int hns_dsaf_get_port_id(u8 port) | ||
1353 | +{ | ||
1354 | + if (port < DSAF_SERVICE_NW_NUM) | ||
1355 | + return port; | ||
1356 | + | ||
1357 | + if (port >= DSAF_BASE_INNER_PORT_NUM) | ||
1358 | + return port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM; | ||
1359 | + | ||
1360 | + return -EINVAL; | ||
1361 | +} | ||
1362 | + | ||
1363 | static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) | ||
1364 | { | ||
1365 | struct dsaf_tbl_tcam_ucast_cfg tbl_tcam_ucast = {0, 1, 0, 0, 0x80}; | ||
1366 | @@ -2815,23 +2826,33 @@ static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) | ||
1367 | memset(&temp_key, 0x0, sizeof(temp_key)); | ||
1368 | mask_entry.addr[0] = 0x01; | ||
1369 | hns_dsaf_set_mac_key(dsaf_dev, &mask_key, mask_entry.in_vlan_id, | ||
1370 | - port, mask_entry.addr); | ||
1371 | + 0xf, mask_entry.addr); | ||
1372 | tbl_tcam_mcast.tbl_mcast_item_vld = 1; | ||
1373 | tbl_tcam_mcast.tbl_mcast_old_en = 0; | ||
1374 | |||
1375 | - if (port < DSAF_SERVICE_NW_NUM) { | ||
1376 | - mskid = port; | ||
1377 | - } else if (port >= DSAF_BASE_INNER_PORT_NUM) { | ||
1378 | - mskid = port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM; | ||
1379 | - } else { | ||
1380 | + /* set MAC port to handle multicast */ | ||
1381 | + mskid = hns_dsaf_get_port_id(port); | ||
1382 | + if (mskid == -EINVAL) { | ||
1383 | dev_err(dsaf_dev->dev, "%s,pnum(%d)error,key(%#x:%#x)\n", | ||
1384 | dsaf_dev->ae_dev.name, port, | ||
1385 | mask_key.high.val, mask_key.low.val); | ||
1386 | return; | ||
1387 | } | ||
1388 | + dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], | ||
1389 | + mskid % 32, 1); | ||
1390 | |||
1391 | + /* set pool bit map to handle multicast */ | ||
1392 | + mskid = hns_dsaf_get_port_id(port_num); | ||
1393 | + if (mskid == -EINVAL) { | ||
1394 | + dev_err(dsaf_dev->dev, | ||
1395 | + "%s, pool bit map pnum(%d)error,key(%#x:%#x)\n", | ||
1396 | + dsaf_dev->ae_dev.name, port_num, | ||
1397 | + mask_key.high.val, mask_key.low.val); | ||
1398 | + return; | ||
1399 | + } | ||
1400 | dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], | ||
1401 | mskid % 32, 1); | ||
1402 | + | ||
1403 | memcpy(&temp_key, &mask_key, sizeof(mask_key)); | ||
1404 | hns_dsaf_tcam_mc_cfg_vague(dsaf_dev, entry_index, &tbl_tcam_data_mc, | ||
1405 | (struct dsaf_tbl_tcam_data *)(&mask_key), | ||
1406 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | ||
1407 | index ba4316910dea..a60f207768fc 100644 | ||
1408 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | ||
1409 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | ||
1410 | @@ -129,7 +129,7 @@ static void hns_xgmac_lf_rf_control_init(struct mac_driver *mac_drv) | ||
1411 | dsaf_set_bit(val, XGMAC_UNIDIR_EN_B, 0); | ||
1412 | dsaf_set_bit(val, XGMAC_RF_TX_EN_B, 1); | ||
1413 | dsaf_set_field(val, XGMAC_LF_RF_INSERT_M, XGMAC_LF_RF_INSERT_S, 0); | ||
1414 | - dsaf_write_reg(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val); | ||
1415 | + dsaf_write_dev(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val); | ||
1416 | } | ||
1417 | |||
1418 | /** | ||
1419 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | ||
1420 | index cc84133c184d..1c70f9aa0aa7 100644 | ||
1421 | --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c | ||
1422 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | ||
1423 | @@ -29,9 +29,6 @@ | ||
1424 | |||
1425 | #define SERVICE_TIMER_HZ (1 * HZ) | ||
1426 | |||
1427 | -#define NIC_TX_CLEAN_MAX_NUM 256 | ||
1428 | -#define NIC_RX_CLEAN_MAX_NUM 64 | ||
1429 | - | ||
1430 | #define RCB_IRQ_NOT_INITED 0 | ||
1431 | #define RCB_IRQ_INITED 1 | ||
1432 | #define HNS_BUFFER_SIZE_2048 2048 | ||
1433 | @@ -376,8 +373,6 @@ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, | ||
1434 | wmb(); /* commit all data before submit */ | ||
1435 | assert(skb->queue_mapping < priv->ae_handle->q_num); | ||
1436 | hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num); | ||
1437 | - ring->stats.tx_pkts++; | ||
1438 | - ring->stats.tx_bytes += skb->len; | ||
1439 | |||
1440 | return NETDEV_TX_OK; | ||
1441 | |||
1442 | @@ -999,6 +994,9 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, | ||
1443 | /* issue prefetch for next Tx descriptor */ | ||
1444 | prefetch(&ring->desc_cb[ring->next_to_clean]); | ||
1445 | } | ||
1446 | + /* update tx ring statistics. */ | ||
1447 | + ring->stats.tx_pkts += pkts; | ||
1448 | + ring->stats.tx_bytes += bytes; | ||
1449 | |||
1450 | NETIF_TX_UNLOCK(ring); | ||
1451 | |||
1452 | @@ -2150,7 +2148,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) | ||
1453 | hns_nic_tx_fini_pro_v2; | ||
1454 | |||
1455 | netif_napi_add(priv->netdev, &rd->napi, | ||
1456 | - hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM); | ||
1457 | + hns_nic_common_poll, NAPI_POLL_WEIGHT); | ||
1458 | rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; | ||
1459 | } | ||
1460 | for (i = h->q_num; i < h->q_num * 2; i++) { | ||
1461 | @@ -2163,7 +2161,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) | ||
1462 | hns_nic_rx_fini_pro_v2; | ||
1463 | |||
1464 | netif_napi_add(priv->netdev, &rd->napi, | ||
1465 | - hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM); | ||
1466 | + hns_nic_common_poll, NAPI_POLL_WEIGHT); | ||
1467 | rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; | ||
1468 | } | ||
1469 | |||
1470 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile b/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile | ||
1471 | index cb8ddd043476..d278fc7ea3ed 100644 | ||
1472 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile | ||
1473 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile | ||
1474 | @@ -3,7 +3,7 @@ | ||
1475 | # Makefile for the HISILICON network device drivers. | ||
1476 | # | ||
1477 | |||
1478 | -ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3 | ||
1479 | +ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 | ||
1480 | |||
1481 | obj-$(CONFIG_HNS3_HCLGE) += hclge.o | ||
1482 | hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o | ||
1483 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile b/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile | ||
1484 | index fb93bbd35845..6193f8fa7cf3 100644 | ||
1485 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile | ||
1486 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile | ||
1487 | @@ -3,7 +3,7 @@ | ||
1488 | # Makefile for the HISILICON network device drivers. | ||
1489 | # | ||
1490 | |||
1491 | -ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3 | ||
1492 | +ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 | ||
1493 | |||
1494 | obj-$(CONFIG_HNS3_HCLGEVF) += hclgevf.o | ||
1495 | hclgevf-objs = hclgevf_main.o hclgevf_cmd.o hclgevf_mbx.o | ||
1496 | \ No newline at end of file | ||
1497 | diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h | ||
1498 | index 8a28f3388f69..dca671591ef6 100644 | ||
1499 | --- a/drivers/net/ethernet/intel/igb/e1000_defines.h | ||
1500 | +++ b/drivers/net/ethernet/intel/igb/e1000_defines.h | ||
1501 | @@ -194,6 +194,8 @@ | ||
1502 | /* enable link status from external LINK_0 and LINK_1 pins */ | ||
1503 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ | ||
1504 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ | ||
1505 | +#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ | ||
1506 | +#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ | ||
1507 | #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ | ||
1508 | #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ | ||
1509 | #define E1000_CTRL_RST 0x04000000 /* Global reset */ | ||
1510 | diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c | ||
1511 | index ffaa6e031632..aa39a068858e 100644 | ||
1512 | --- a/drivers/net/ethernet/intel/igb/igb_main.c | ||
1513 | +++ b/drivers/net/ethernet/intel/igb/igb_main.c | ||
1514 | @@ -8754,9 +8754,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | ||
1515 | struct e1000_hw *hw = &adapter->hw; | ||
1516 | u32 ctrl, rctl, status; | ||
1517 | u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; | ||
1518 | -#ifdef CONFIG_PM | ||
1519 | - int retval = 0; | ||
1520 | -#endif | ||
1521 | + bool wake; | ||
1522 | |||
1523 | rtnl_lock(); | ||
1524 | netif_device_detach(netdev); | ||
1525 | @@ -8769,14 +8767,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | ||
1526 | igb_clear_interrupt_scheme(adapter); | ||
1527 | rtnl_unlock(); | ||
1528 | |||
1529 | -#ifdef CONFIG_PM | ||
1530 | - if (!runtime) { | ||
1531 | - retval = pci_save_state(pdev); | ||
1532 | - if (retval) | ||
1533 | - return retval; | ||
1534 | - } | ||
1535 | -#endif | ||
1536 | - | ||
1537 | status = rd32(E1000_STATUS); | ||
1538 | if (status & E1000_STATUS_LU) | ||
1539 | wufc &= ~E1000_WUFC_LNKC; | ||
1540 | @@ -8793,10 +8783,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | ||
1541 | } | ||
1542 | |||
1543 | ctrl = rd32(E1000_CTRL); | ||
1544 | - /* advertise wake from D3Cold */ | ||
1545 | - #define E1000_CTRL_ADVD3WUC 0x00100000 | ||
1546 | - /* phy power management enable */ | ||
1547 | - #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 | ||
1548 | ctrl |= E1000_CTRL_ADVD3WUC; | ||
1549 | wr32(E1000_CTRL, ctrl); | ||
1550 | |||
1551 | @@ -8810,12 +8796,15 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | ||
1552 | wr32(E1000_WUFC, 0); | ||
1553 | } | ||
1554 | |||
1555 | - *enable_wake = wufc || adapter->en_mng_pt; | ||
1556 | - if (!*enable_wake) | ||
1557 | + wake = wufc || adapter->en_mng_pt; | ||
1558 | + if (!wake) | ||
1559 | igb_power_down_link(adapter); | ||
1560 | else | ||
1561 | igb_power_up_link(adapter); | ||
1562 | |||
1563 | + if (enable_wake) | ||
1564 | + *enable_wake = wake; | ||
1565 | + | ||
1566 | /* Release control of h/w to f/w. If f/w is AMT enabled, this | ||
1567 | * would have already happened in close and is redundant. | ||
1568 | */ | ||
1569 | @@ -8858,22 +8847,7 @@ static void igb_deliver_wake_packet(struct net_device *netdev) | ||
1570 | |||
1571 | static int __maybe_unused igb_suspend(struct device *dev) | ||
1572 | { | ||
1573 | - int retval; | ||
1574 | - bool wake; | ||
1575 | - struct pci_dev *pdev = to_pci_dev(dev); | ||
1576 | - | ||
1577 | - retval = __igb_shutdown(pdev, &wake, 0); | ||
1578 | - if (retval) | ||
1579 | - return retval; | ||
1580 | - | ||
1581 | - if (wake) { | ||
1582 | - pci_prepare_to_sleep(pdev); | ||
1583 | - } else { | ||
1584 | - pci_wake_from_d3(pdev, false); | ||
1585 | - pci_set_power_state(pdev, PCI_D3hot); | ||
1586 | - } | ||
1587 | - | ||
1588 | - return 0; | ||
1589 | + return __igb_shutdown(to_pci_dev(dev), NULL, 0); | ||
1590 | } | ||
1591 | |||
1592 | static int __maybe_unused igb_resume(struct device *dev) | ||
1593 | @@ -8944,22 +8918,7 @@ static int __maybe_unused igb_runtime_idle(struct device *dev) | ||
1594 | |||
1595 | static int __maybe_unused igb_runtime_suspend(struct device *dev) | ||
1596 | { | ||
1597 | - struct pci_dev *pdev = to_pci_dev(dev); | ||
1598 | - int retval; | ||
1599 | - bool wake; | ||
1600 | - | ||
1601 | - retval = __igb_shutdown(pdev, &wake, 1); | ||
1602 | - if (retval) | ||
1603 | - return retval; | ||
1604 | - | ||
1605 | - if (wake) { | ||
1606 | - pci_prepare_to_sleep(pdev); | ||
1607 | - } else { | ||
1608 | - pci_wake_from_d3(pdev, false); | ||
1609 | - pci_set_power_state(pdev, PCI_D3hot); | ||
1610 | - } | ||
1611 | - | ||
1612 | - return 0; | ||
1613 | + return __igb_shutdown(to_pci_dev(dev), NULL, 1); | ||
1614 | } | ||
1615 | |||
1616 | static int __maybe_unused igb_runtime_resume(struct device *dev) | ||
1617 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | ||
1618 | index 26c9f9421901..55ccd90beeb0 100644 | ||
1619 | --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | ||
1620 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | ||
1621 | @@ -80,8 +80,7 @@ static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport, | ||
1622 | opcode, MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT); | ||
1623 | MLX5_SET(modify_nic_vport_context_in, in, field_select.change_event, 1); | ||
1624 | MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); | ||
1625 | - if (vport) | ||
1626 | - MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); | ||
1627 | + MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); | ||
1628 | nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, | ||
1629 | in, nic_vport_context); | ||
1630 | |||
1631 | @@ -109,8 +108,7 @@ static int modify_esw_vport_context_cmd(struct mlx5_core_dev *dev, u16 vport, | ||
1632 | MLX5_SET(modify_esw_vport_context_in, in, opcode, | ||
1633 | MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT); | ||
1634 | MLX5_SET(modify_esw_vport_context_in, in, vport_number, vport); | ||
1635 | - if (vport) | ||
1636 | - MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); | ||
1637 | + MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); | ||
1638 | return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); | ||
1639 | } | ||
1640 | |||
1641 | diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h | ||
1642 | index 40d6356a7e73..3dfb07a78952 100644 | ||
1643 | --- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h | ||
1644 | +++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h | ||
1645 | @@ -29,11 +29,13 @@ | ||
1646 | /* Specific functions used for Ring mode */ | ||
1647 | |||
1648 | /* Enhanced descriptors */ | ||
1649 | -static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) | ||
1650 | +static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end, | ||
1651 | + int bfsize) | ||
1652 | { | ||
1653 | - p->des1 |= cpu_to_le32((BUF_SIZE_8KiB | ||
1654 | - << ERDES1_BUFFER2_SIZE_SHIFT) | ||
1655 | - & ERDES1_BUFFER2_SIZE_MASK); | ||
1656 | + if (bfsize == BUF_SIZE_16KiB) | ||
1657 | + p->des1 |= cpu_to_le32((BUF_SIZE_8KiB | ||
1658 | + << ERDES1_BUFFER2_SIZE_SHIFT) | ||
1659 | + & ERDES1_BUFFER2_SIZE_MASK); | ||
1660 | |||
1661 | if (end) | ||
1662 | p->des1 |= cpu_to_le32(ERDES1_END_RING); | ||
1663 | @@ -59,11 +61,15 @@ static inline void enh_set_tx_desc_len_on_ring(struct dma_desc *p, int len) | ||
1664 | } | ||
1665 | |||
1666 | /* Normal descriptors */ | ||
1667 | -static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end) | ||
1668 | +static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end, int bfsize) | ||
1669 | { | ||
1670 | - p->des1 |= cpu_to_le32(((BUF_SIZE_2KiB - 1) | ||
1671 | - << RDES1_BUFFER2_SIZE_SHIFT) | ||
1672 | - & RDES1_BUFFER2_SIZE_MASK); | ||
1673 | + if (bfsize >= BUF_SIZE_2KiB) { | ||
1674 | + int bfsize2; | ||
1675 | + | ||
1676 | + bfsize2 = min(bfsize - BUF_SIZE_2KiB + 1, BUF_SIZE_2KiB - 1); | ||
1677 | + p->des1 |= cpu_to_le32((bfsize2 << RDES1_BUFFER2_SIZE_SHIFT) | ||
1678 | + & RDES1_BUFFER2_SIZE_MASK); | ||
1679 | + } | ||
1680 | |||
1681 | if (end) | ||
1682 | p->des1 |= cpu_to_le32(RDES1_END_RING); | ||
1683 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | ||
1684 | index 736e29635b77..313a58b68fee 100644 | ||
1685 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | ||
1686 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | ||
1687 | @@ -296,7 +296,7 @@ exit: | ||
1688 | } | ||
1689 | |||
1690 | static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, | ||
1691 | - int mode, int end) | ||
1692 | + int mode, int end, int bfsize) | ||
1693 | { | ||
1694 | dwmac4_set_rx_owner(p, disable_rx_ic); | ||
1695 | } | ||
1696 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | ||
1697 | index 1d858fdec997..98fa471da7c0 100644 | ||
1698 | --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | ||
1699 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | ||
1700 | @@ -123,7 +123,7 @@ static int dwxgmac2_get_rx_timestamp_status(void *desc, void *next_desc, | ||
1701 | } | ||
1702 | |||
1703 | static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic, | ||
1704 | - int mode, int end) | ||
1705 | + int mode, int end, int bfsize) | ||
1706 | { | ||
1707 | dwxgmac2_set_rx_owner(p, disable_rx_ic); | ||
1708 | } | ||
1709 | diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | ||
1710 | index 5ef91a790f9d..5202d6ad7919 100644 | ||
1711 | --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | ||
1712 | +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | ||
1713 | @@ -201,6 +201,11 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | ||
1714 | if (unlikely(rdes0 & RDES0_OWN)) | ||
1715 | return dma_own; | ||
1716 | |||
1717 | + if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { | ||
1718 | + stats->rx_length_errors++; | ||
1719 | + return discard_frame; | ||
1720 | + } | ||
1721 | + | ||
1722 | if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { | ||
1723 | if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) { | ||
1724 | x->rx_desc++; | ||
1725 | @@ -231,9 +236,10 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | ||
1726 | * It doesn't match with the information reported into the databook. | ||
1727 | * At any rate, we need to understand if the CSUM hw computation is ok | ||
1728 | * and report this info to the upper layers. */ | ||
1729 | - ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), | ||
1730 | - !!(rdes0 & RDES0_FRAME_TYPE), | ||
1731 | - !!(rdes0 & ERDES0_RX_MAC_ADDR)); | ||
1732 | + if (likely(ret == good_frame)) | ||
1733 | + ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), | ||
1734 | + !!(rdes0 & RDES0_FRAME_TYPE), | ||
1735 | + !!(rdes0 & ERDES0_RX_MAC_ADDR)); | ||
1736 | |||
1737 | if (unlikely(rdes0 & RDES0_DRIBBLING)) | ||
1738 | x->dribbling_bit++; | ||
1739 | @@ -259,15 +265,19 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | ||
1740 | } | ||
1741 | |||
1742 | static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, | ||
1743 | - int mode, int end) | ||
1744 | + int mode, int end, int bfsize) | ||
1745 | { | ||
1746 | + int bfsize1; | ||
1747 | + | ||
1748 | p->des0 |= cpu_to_le32(RDES0_OWN); | ||
1749 | - p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK); | ||
1750 | + | ||
1751 | + bfsize1 = min(bfsize, BUF_SIZE_8KiB); | ||
1752 | + p->des1 |= cpu_to_le32(bfsize1 & ERDES1_BUFFER1_SIZE_MASK); | ||
1753 | |||
1754 | if (mode == STMMAC_CHAIN_MODE) | ||
1755 | ehn_desc_rx_set_on_chain(p); | ||
1756 | else | ||
1757 | - ehn_desc_rx_set_on_ring(p, end); | ||
1758 | + ehn_desc_rx_set_on_ring(p, end, bfsize); | ||
1759 | |||
1760 | if (disable_rx_ic) | ||
1761 | p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC); | ||
1762 | diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h | ||
1763 | index 92b8944f26e3..5bb00234d961 100644 | ||
1764 | --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h | ||
1765 | +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h | ||
1766 | @@ -33,7 +33,7 @@ struct dma_extended_desc; | ||
1767 | struct stmmac_desc_ops { | ||
1768 | /* DMA RX descriptor ring initialization */ | ||
1769 | void (*init_rx_desc)(struct dma_desc *p, int disable_rx_ic, int mode, | ||
1770 | - int end); | ||
1771 | + int end, int bfsize); | ||
1772 | /* DMA TX descriptor ring initialization */ | ||
1773 | void (*init_tx_desc)(struct dma_desc *p, int mode, int end); | ||
1774 | /* Invoked by the xmit function to prepare the tx descriptor */ | ||
1775 | diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c | ||
1776 | index de65bb29feba..b7dd4e3c760d 100644 | ||
1777 | --- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c | ||
1778 | +++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c | ||
1779 | @@ -91,8 +91,6 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, | ||
1780 | return dma_own; | ||
1781 | |||
1782 | if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { | ||
1783 | - pr_warn("%s: Oversized frame spanned multiple buffers\n", | ||
1784 | - __func__); | ||
1785 | stats->rx_length_errors++; | ||
1786 | return discard_frame; | ||
1787 | } | ||
1788 | @@ -135,15 +133,19 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, | ||
1789 | } | ||
1790 | |||
1791 | static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, | ||
1792 | - int end) | ||
1793 | + int end, int bfsize) | ||
1794 | { | ||
1795 | + int bfsize1; | ||
1796 | + | ||
1797 | p->des0 |= cpu_to_le32(RDES0_OWN); | ||
1798 | - p->des1 |= cpu_to_le32((BUF_SIZE_2KiB - 1) & RDES1_BUFFER1_SIZE_MASK); | ||
1799 | + | ||
1800 | + bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); | ||
1801 | + p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK); | ||
1802 | |||
1803 | if (mode == STMMAC_CHAIN_MODE) | ||
1804 | ndesc_rx_set_on_chain(p, end); | ||
1805 | else | ||
1806 | - ndesc_rx_set_on_ring(p, end); | ||
1807 | + ndesc_rx_set_on_ring(p, end, bfsize); | ||
1808 | |||
1809 | if (disable_rx_ic) | ||
1810 | p->des1 |= cpu_to_le32(RDES1_DISABLE_IC); | ||
1811 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
1812 | index 39c105092214..5debe93ea4eb 100644 | ||
1813 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
1814 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
1815 | @@ -1111,11 +1111,13 @@ static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv, u32 queue) | ||
1816 | if (priv->extend_desc) | ||
1817 | stmmac_init_rx_desc(priv, &rx_q->dma_erx[i].basic, | ||
1818 | priv->use_riwt, priv->mode, | ||
1819 | - (i == DMA_RX_SIZE - 1)); | ||
1820 | + (i == DMA_RX_SIZE - 1), | ||
1821 | + priv->dma_buf_sz); | ||
1822 | else | ||
1823 | stmmac_init_rx_desc(priv, &rx_q->dma_rx[i], | ||
1824 | priv->use_riwt, priv->mode, | ||
1825 | - (i == DMA_RX_SIZE - 1)); | ||
1826 | + (i == DMA_RX_SIZE - 1), | ||
1827 | + priv->dma_buf_sz); | ||
1828 | } | ||
1829 | |||
1830 | /** | ||
1831 | @@ -3331,9 +3333,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | ||
1832 | { | ||
1833 | struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; | ||
1834 | struct stmmac_channel *ch = &priv->channel[queue]; | ||
1835 | - unsigned int entry = rx_q->cur_rx; | ||
1836 | + unsigned int next_entry = rx_q->cur_rx; | ||
1837 | int coe = priv->hw->rx_csum; | ||
1838 | - unsigned int next_entry; | ||
1839 | unsigned int count = 0; | ||
1840 | bool xmac; | ||
1841 | |||
1842 | @@ -3351,10 +3352,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | ||
1843 | stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true); | ||
1844 | } | ||
1845 | while (count < limit) { | ||
1846 | - int status; | ||
1847 | + int entry, status; | ||
1848 | struct dma_desc *p; | ||
1849 | struct dma_desc *np; | ||
1850 | |||
1851 | + entry = next_entry; | ||
1852 | + | ||
1853 | if (priv->extend_desc) | ||
1854 | p = (struct dma_desc *)(rx_q->dma_erx + entry); | ||
1855 | else | ||
1856 | @@ -3410,11 +3413,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | ||
1857 | * ignored | ||
1858 | */ | ||
1859 | if (frame_len > priv->dma_buf_sz) { | ||
1860 | - netdev_err(priv->dev, | ||
1861 | - "len %d larger than size (%d)\n", | ||
1862 | - frame_len, priv->dma_buf_sz); | ||
1863 | + if (net_ratelimit()) | ||
1864 | + netdev_err(priv->dev, | ||
1865 | + "len %d larger than size (%d)\n", | ||
1866 | + frame_len, priv->dma_buf_sz); | ||
1867 | priv->dev->stats.rx_length_errors++; | ||
1868 | - break; | ||
1869 | + continue; | ||
1870 | } | ||
1871 | |||
1872 | /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3 | ||
1873 | @@ -3449,7 +3453,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | ||
1874 | dev_warn(priv->device, | ||
1875 | "packet dropped\n"); | ||
1876 | priv->dev->stats.rx_dropped++; | ||
1877 | - break; | ||
1878 | + continue; | ||
1879 | } | ||
1880 | |||
1881 | dma_sync_single_for_cpu(priv->device, | ||
1882 | @@ -3469,11 +3473,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | ||
1883 | } else { | ||
1884 | skb = rx_q->rx_skbuff[entry]; | ||
1885 | if (unlikely(!skb)) { | ||
1886 | - netdev_err(priv->dev, | ||
1887 | - "%s: Inconsistent Rx chain\n", | ||
1888 | - priv->dev->name); | ||
1889 | + if (net_ratelimit()) | ||
1890 | + netdev_err(priv->dev, | ||
1891 | + "%s: Inconsistent Rx chain\n", | ||
1892 | + priv->dev->name); | ||
1893 | priv->dev->stats.rx_dropped++; | ||
1894 | - break; | ||
1895 | + continue; | ||
1896 | } | ||
1897 | prefetch(skb->data - NET_IP_ALIGN); | ||
1898 | rx_q->rx_skbuff[entry] = NULL; | ||
1899 | @@ -3508,7 +3513,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | ||
1900 | priv->dev->stats.rx_packets++; | ||
1901 | priv->dev->stats.rx_bytes += frame_len; | ||
1902 | } | ||
1903 | - entry = next_entry; | ||
1904 | } | ||
1905 | |||
1906 | stmmac_rx_refill(priv, queue); | ||
1907 | diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/5000.c b/drivers/net/wireless/intel/iwlwifi/cfg/5000.c | ||
1908 | index 36151e61a26f..c04d934b23b4 100644 | ||
1909 | --- a/drivers/net/wireless/intel/iwlwifi/cfg/5000.c | ||
1910 | +++ b/drivers/net/wireless/intel/iwlwifi/cfg/5000.c | ||
1911 | @@ -1,7 +1,7 @@ | ||
1912 | /****************************************************************************** | ||
1913 | * | ||
1914 | * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. | ||
1915 | - * Copyright(c) 2018 Intel Corporation | ||
1916 | + * Copyright(c) 2018 - 2019 Intel Corporation | ||
1917 | * | ||
1918 | * This program is free software; you can redistribute it and/or modify it | ||
1919 | * under the terms of version 2 of the GNU General Public License as | ||
1920 | @@ -140,6 +140,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | ||
1921 | .ht_params = &iwl5000_ht_params, | ||
1922 | .led_mode = IWL_LED_BLINK, | ||
1923 | .internal_wimax_coex = true, | ||
1924 | + .csr = &iwl_csr_v1, | ||
1925 | }; | ||
1926 | |||
1927 | #define IWL_DEVICE_5150 \ | ||
1928 | diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c | ||
1929 | index d49fbd58afa7..bfbe3aa058d9 100644 | ||
1930 | --- a/drivers/net/wireless/marvell/mwifiex/sdio.c | ||
1931 | +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c | ||
1932 | @@ -181,7 +181,7 @@ static int mwifiex_sdio_resume(struct device *dev) | ||
1933 | |||
1934 | adapter = card->adapter; | ||
1935 | |||
1936 | - if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { | ||
1937 | + if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { | ||
1938 | mwifiex_dbg(adapter, WARN, | ||
1939 | "device already resumed\n"); | ||
1940 | return 0; | ||
1941 | diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c | ||
1942 | index b5ec96abd048..776b7e9e23b9 100644 | ||
1943 | --- a/drivers/nvme/target/core.c | ||
1944 | +++ b/drivers/nvme/target/core.c | ||
1945 | @@ -921,6 +921,15 @@ bool nvmet_host_allowed(struct nvmet_req *req, struct nvmet_subsys *subsys, | ||
1946 | return __nvmet_host_allowed(subsys, hostnqn); | ||
1947 | } | ||
1948 | |||
1949 | +static void nvmet_fatal_error_handler(struct work_struct *work) | ||
1950 | +{ | ||
1951 | + struct nvmet_ctrl *ctrl = | ||
1952 | + container_of(work, struct nvmet_ctrl, fatal_err_work); | ||
1953 | + | ||
1954 | + pr_err("ctrl %d fatal error occurred!\n", ctrl->cntlid); | ||
1955 | + ctrl->ops->delete_ctrl(ctrl); | ||
1956 | +} | ||
1957 | + | ||
1958 | u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, | ||
1959 | struct nvmet_req *req, u32 kato, struct nvmet_ctrl **ctrlp) | ||
1960 | { | ||
1961 | @@ -962,6 +971,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, | ||
1962 | |||
1963 | INIT_WORK(&ctrl->async_event_work, nvmet_async_event_work); | ||
1964 | INIT_LIST_HEAD(&ctrl->async_events); | ||
1965 | + INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler); | ||
1966 | |||
1967 | memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE); | ||
1968 | memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE); | ||
1969 | @@ -1076,21 +1086,11 @@ void nvmet_ctrl_put(struct nvmet_ctrl *ctrl) | ||
1970 | kref_put(&ctrl->ref, nvmet_ctrl_free); | ||
1971 | } | ||
1972 | |||
1973 | -static void nvmet_fatal_error_handler(struct work_struct *work) | ||
1974 | -{ | ||
1975 | - struct nvmet_ctrl *ctrl = | ||
1976 | - container_of(work, struct nvmet_ctrl, fatal_err_work); | ||
1977 | - | ||
1978 | - pr_err("ctrl %d fatal error occurred!\n", ctrl->cntlid); | ||
1979 | - ctrl->ops->delete_ctrl(ctrl); | ||
1980 | -} | ||
1981 | - | ||
1982 | void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl) | ||
1983 | { | ||
1984 | mutex_lock(&ctrl->lock); | ||
1985 | if (!(ctrl->csts & NVME_CSTS_CFS)) { | ||
1986 | ctrl->csts |= NVME_CSTS_CFS; | ||
1987 | - INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler); | ||
1988 | schedule_work(&ctrl->fatal_err_work); | ||
1989 | } | ||
1990 | mutex_unlock(&ctrl->lock); | ||
1991 | diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c | ||
1992 | index e0dcdb3cc070..088d1c2047e6 100644 | ||
1993 | --- a/drivers/platform/x86/intel_pmc_core.c | ||
1994 | +++ b/drivers/platform/x86/intel_pmc_core.c | ||
1995 | @@ -185,7 +185,7 @@ static const struct pmc_bit_map cnp_pfear_map[] = { | ||
1996 | {"CNVI", BIT(3)}, | ||
1997 | {"UFS0", BIT(4)}, | ||
1998 | {"EMMC", BIT(5)}, | ||
1999 | - {"Res_6", BIT(6)}, | ||
2000 | + {"SPF", BIT(6)}, | ||
2001 | {"SBR6", BIT(7)}, | ||
2002 | |||
2003 | {"SBR7", BIT(0)}, | ||
2004 | @@ -682,7 +682,7 @@ static int __init pmc_core_probe(void) | ||
2005 | * Sunrisepoint PCH regmap can't be used. Use Cannonlake PCH regmap | ||
2006 | * in this case. | ||
2007 | */ | ||
2008 | - if (!pci_dev_present(pmc_pci_ids)) | ||
2009 | + if (pmcdev->map == &spt_reg_map && !pci_dev_present(pmc_pci_ids)) | ||
2010 | pmcdev->map = &cnp_reg_map; | ||
2011 | |||
2012 | if (lpit_read_residency_count_address(&slp_s0_addr)) | ||
2013 | diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c | ||
2014 | index 8f018b3f3cd4..eaec2d306481 100644 | ||
2015 | --- a/drivers/platform/x86/pmc_atom.c | ||
2016 | +++ b/drivers/platform/x86/pmc_atom.c | ||
2017 | @@ -17,6 +17,7 @@ | ||
2018 | |||
2019 | #include <linux/debugfs.h> | ||
2020 | #include <linux/device.h> | ||
2021 | +#include <linux/dmi.h> | ||
2022 | #include <linux/init.h> | ||
2023 | #include <linux/io.h> | ||
2024 | #include <linux/platform_data/x86/clk-pmc-atom.h> | ||
2025 | @@ -391,11 +392,27 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc) | ||
2026 | } | ||
2027 | #endif /* CONFIG_DEBUG_FS */ | ||
2028 | |||
2029 | +/* | ||
2030 | + * Some systems need one or more of their pmc_plt_clks to be | ||
2031 | + * marked as critical. | ||
2032 | + */ | ||
2033 | +static const struct dmi_system_id critclk_systems[] __initconst = { | ||
2034 | + { | ||
2035 | + .ident = "MPL CEC1x", | ||
2036 | + .matches = { | ||
2037 | + DMI_MATCH(DMI_SYS_VENDOR, "MPL AG"), | ||
2038 | + DMI_MATCH(DMI_PRODUCT_NAME, "CEC10 Family"), | ||
2039 | + }, | ||
2040 | + }, | ||
2041 | + { /*sentinel*/ } | ||
2042 | +}; | ||
2043 | + | ||
2044 | static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, | ||
2045 | const struct pmc_data *pmc_data) | ||
2046 | { | ||
2047 | struct platform_device *clkdev; | ||
2048 | struct pmc_clk_data *clk_data; | ||
2049 | + const struct dmi_system_id *d = dmi_first_match(critclk_systems); | ||
2050 | |||
2051 | clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); | ||
2052 | if (!clk_data) | ||
2053 | @@ -403,6 +420,10 @@ static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, | ||
2054 | |||
2055 | clk_data->base = pmc_regmap; /* offset is added by client */ | ||
2056 | clk_data->clks = pmc_data->clks; | ||
2057 | + if (d) { | ||
2058 | + clk_data->critical = true; | ||
2059 | + pr_info("%s critclks quirk enabled\n", d->ident); | ||
2060 | + } | ||
2061 | |||
2062 | clkdev = platform_device_register_data(&pdev->dev, "clk-pmc-atom", | ||
2063 | PLATFORM_DEVID_NONE, | ||
2064 | diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/reset-meson-audio-arb.c | ||
2065 | index 91751617b37a..c53a2185a039 100644 | ||
2066 | --- a/drivers/reset/reset-meson-audio-arb.c | ||
2067 | +++ b/drivers/reset/reset-meson-audio-arb.c | ||
2068 | @@ -130,6 +130,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev) | ||
2069 | arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits); | ||
2070 | arb->rstc.ops = &meson_audio_arb_rstc_ops; | ||
2071 | arb->rstc.of_node = dev->of_node; | ||
2072 | + arb->rstc.owner = THIS_MODULE; | ||
2073 | |||
2074 | /* | ||
2075 | * Enable general : | ||
2076 | diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c | ||
2077 | index e5444296075e..4d6bf9304ceb 100644 | ||
2078 | --- a/drivers/rtc/rtc-cros-ec.c | ||
2079 | +++ b/drivers/rtc/rtc-cros-ec.c | ||
2080 | @@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev) | ||
2081 | struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); | ||
2082 | |||
2083 | if (device_may_wakeup(dev)) | ||
2084 | - enable_irq_wake(cros_ec_rtc->cros_ec->irq); | ||
2085 | + return enable_irq_wake(cros_ec_rtc->cros_ec->irq); | ||
2086 | |||
2087 | return 0; | ||
2088 | } | ||
2089 | @@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev) | ||
2090 | struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); | ||
2091 | |||
2092 | if (device_may_wakeup(dev)) | ||
2093 | - disable_irq_wake(cros_ec_rtc->cros_ec->irq); | ||
2094 | + return disable_irq_wake(cros_ec_rtc->cros_ec->irq); | ||
2095 | |||
2096 | return 0; | ||
2097 | } | ||
2098 | diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c | ||
2099 | index b4e054c64bad..69b54e5556c0 100644 | ||
2100 | --- a/drivers/rtc/rtc-da9063.c | ||
2101 | +++ b/drivers/rtc/rtc-da9063.c | ||
2102 | @@ -480,6 +480,13 @@ static int da9063_rtc_probe(struct platform_device *pdev) | ||
2103 | da9063_data_to_tm(data, &rtc->alarm_time, rtc); | ||
2104 | rtc->rtc_sync = false; | ||
2105 | |||
2106 | + /* | ||
2107 | + * TODO: some models have alarms on a minute boundary but still support | ||
2108 | + * real hardware interrupts. Add this once the core supports it. | ||
2109 | + */ | ||
2110 | + if (config->rtc_data_start != RTC_SEC) | ||
2111 | + rtc->rtc_dev->uie_unsupported = 1; | ||
2112 | + | ||
2113 | irq_alarm = platform_get_irq_byname(pdev, "ALARM"); | ||
2114 | ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, | ||
2115 | da9063_alarm_event, | ||
2116 | diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c | ||
2117 | index 51ba414798a8..3d7414e5ed35 100644 | ||
2118 | --- a/drivers/rtc/rtc-sh.c | ||
2119 | +++ b/drivers/rtc/rtc-sh.c | ||
2120 | @@ -377,7 +377,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
2121 | static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) | ||
2122 | { | ||
2123 | unsigned int byte; | ||
2124 | - int value = 0xff; /* return 0xff for ignored values */ | ||
2125 | + int value = -1; /* return -1 for ignored values */ | ||
2126 | |||
2127 | byte = readb(rtc->regbase + reg_off); | ||
2128 | if (byte & AR_ENB) { | ||
2129 | diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c | ||
2130 | index c4cbfd07b916..a08ff3bd6310 100644 | ||
2131 | --- a/drivers/scsi/scsi_devinfo.c | ||
2132 | +++ b/drivers/scsi/scsi_devinfo.c | ||
2133 | @@ -238,6 +238,7 @@ static struct { | ||
2134 | {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2135 | {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2136 | {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2137 | + {"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2138 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, | ||
2139 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, | ||
2140 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ | ||
2141 | diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c | ||
2142 | index 5a58cbf3a75d..c14006ac98f9 100644 | ||
2143 | --- a/drivers/scsi/scsi_dh.c | ||
2144 | +++ b/drivers/scsi/scsi_dh.c | ||
2145 | @@ -75,6 +75,7 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { | ||
2146 | {"NETAPP", "INF-01-00", "rdac", }, | ||
2147 | {"LSI", "INF-01-00", "rdac", }, | ||
2148 | {"ENGENIO", "INF-01-00", "rdac", }, | ||
2149 | + {"LENOVO", "DE_Series", "rdac", }, | ||
2150 | {NULL, NULL, NULL }, | ||
2151 | }; | ||
2152 | |||
2153 | diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c | ||
2154 | index f03dc03a42c3..0c2ba075bc71 100644 | ||
2155 | --- a/drivers/scsi/storvsc_drv.c | ||
2156 | +++ b/drivers/scsi/storvsc_drv.c | ||
2157 | @@ -664,13 +664,22 @@ static void handle_sc_creation(struct vmbus_channel *new_sc) | ||
2158 | static void handle_multichannel_storage(struct hv_device *device, int max_chns) | ||
2159 | { | ||
2160 | struct storvsc_device *stor_device; | ||
2161 | - int num_cpus = num_online_cpus(); | ||
2162 | int num_sc; | ||
2163 | struct storvsc_cmd_request *request; | ||
2164 | struct vstor_packet *vstor_packet; | ||
2165 | int ret, t; | ||
2166 | |||
2167 | - num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns); | ||
2168 | + /* | ||
2169 | + * If the number of CPUs is artificially restricted, such as | ||
2170 | + * with maxcpus=1 on the kernel boot line, Hyper-V could offer | ||
2171 | + * sub-channels >= the number of CPUs. These sub-channels | ||
2172 | + * should not be created. The primary channel is already created | ||
2173 | + * and assigned to one CPU, so check against # CPUs - 1. | ||
2174 | + */ | ||
2175 | + num_sc = min((int)(num_online_cpus() - 1), max_chns); | ||
2176 | + if (!num_sc) | ||
2177 | + return; | ||
2178 | + | ||
2179 | stor_device = get_out_stor_device(device); | ||
2180 | if (!stor_device) | ||
2181 | return; | ||
2182 | diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c | ||
2183 | index 3f22d1088713..68866f552290 100644 | ||
2184 | --- a/drivers/staging/iio/addac/adt7316.c | ||
2185 | +++ b/drivers/staging/iio/addac/adt7316.c | ||
2186 | @@ -47,6 +47,8 @@ | ||
2187 | #define ADT7516_MSB_AIN3 0xA | ||
2188 | #define ADT7516_MSB_AIN4 0xB | ||
2189 | #define ADT7316_DA_DATA_BASE 0x10 | ||
2190 | +#define ADT7316_DA_10_BIT_LSB_SHIFT 6 | ||
2191 | +#define ADT7316_DA_12_BIT_LSB_SHIFT 4 | ||
2192 | #define ADT7316_DA_MSB_DATA_REGS 4 | ||
2193 | #define ADT7316_LSB_DAC_A 0x10 | ||
2194 | #define ADT7316_MSB_DAC_A 0x11 | ||
2195 | @@ -1086,7 +1088,7 @@ static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev, | ||
2196 | ldac_config = chip->ldac_config & (~ADT7516_DAC_IN_VREF_MASK); | ||
2197 | if (data & 0x1) | ||
2198 | ldac_config |= ADT7516_DAC_AB_IN_VREF; | ||
2199 | - else if (data & 0x2) | ||
2200 | + if (data & 0x2) | ||
2201 | ldac_config |= ADT7516_DAC_CD_IN_VREF; | ||
2202 | } else { | ||
2203 | ret = kstrtou8(buf, 16, &data); | ||
2204 | @@ -1408,7 +1410,7 @@ static IIO_DEVICE_ATTR(ex_analog_temp_offset, 0644, | ||
2205 | static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, | ||
2206 | int channel, char *buf) | ||
2207 | { | ||
2208 | - u16 data; | ||
2209 | + u16 data = 0; | ||
2210 | u8 msb, lsb, offset; | ||
2211 | int ret; | ||
2212 | |||
2213 | @@ -1433,7 +1435,11 @@ static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, | ||
2214 | if (ret) | ||
2215 | return -EIO; | ||
2216 | |||
2217 | - data = (msb << offset) + (lsb & ((1 << offset) - 1)); | ||
2218 | + if (chip->dac_bits == 12) | ||
2219 | + data = lsb >> ADT7316_DA_12_BIT_LSB_SHIFT; | ||
2220 | + else if (chip->dac_bits == 10) | ||
2221 | + data = lsb >> ADT7316_DA_10_BIT_LSB_SHIFT; | ||
2222 | + data |= msb << offset; | ||
2223 | |||
2224 | return sprintf(buf, "%d\n", data); | ||
2225 | } | ||
2226 | @@ -1441,7 +1447,7 @@ static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, | ||
2227 | static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip, | ||
2228 | int channel, const char *buf, size_t len) | ||
2229 | { | ||
2230 | - u8 msb, lsb, offset; | ||
2231 | + u8 msb, lsb, lsb_reg, offset; | ||
2232 | u16 data; | ||
2233 | int ret; | ||
2234 | |||
2235 | @@ -1459,9 +1465,13 @@ static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip, | ||
2236 | return -EINVAL; | ||
2237 | |||
2238 | if (chip->dac_bits > 8) { | ||
2239 | - lsb = data & (1 << offset); | ||
2240 | + lsb = data & ((1 << offset) - 1); | ||
2241 | + if (chip->dac_bits == 12) | ||
2242 | + lsb_reg = lsb << ADT7316_DA_12_BIT_LSB_SHIFT; | ||
2243 | + else | ||
2244 | + lsb_reg = lsb << ADT7316_DA_10_BIT_LSB_SHIFT; | ||
2245 | ret = chip->bus.write(chip->bus.client, | ||
2246 | - ADT7316_DA_DATA_BASE + channel * 2, lsb); | ||
2247 | + ADT7316_DA_DATA_BASE + channel * 2, lsb_reg); | ||
2248 | if (ret) | ||
2249 | return -EIO; | ||
2250 | } | ||
2251 | diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c | ||
2252 | index ef47c226e1d2..3255b2bb0fd5 100644 | ||
2253 | --- a/drivers/usb/core/driver.c | ||
2254 | +++ b/drivers/usb/core/driver.c | ||
2255 | @@ -473,11 +473,6 @@ static int usb_unbind_interface(struct device *dev) | ||
2256 | pm_runtime_disable(dev); | ||
2257 | pm_runtime_set_suspended(dev); | ||
2258 | |||
2259 | - /* Undo any residual pm_autopm_get_interface_* calls */ | ||
2260 | - for (r = atomic_read(&intf->pm_usage_cnt); r > 0; --r) | ||
2261 | - usb_autopm_put_interface_no_suspend(intf); | ||
2262 | - atomic_set(&intf->pm_usage_cnt, 0); | ||
2263 | - | ||
2264 | if (!error) | ||
2265 | usb_autosuspend_device(udev); | ||
2266 | |||
2267 | @@ -1636,7 +1631,6 @@ void usb_autopm_put_interface(struct usb_interface *intf) | ||
2268 | int status; | ||
2269 | |||
2270 | usb_mark_last_busy(udev); | ||
2271 | - atomic_dec(&intf->pm_usage_cnt); | ||
2272 | status = pm_runtime_put_sync(&intf->dev); | ||
2273 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | ||
2274 | __func__, atomic_read(&intf->dev.power.usage_count), | ||
2275 | @@ -1665,7 +1659,6 @@ void usb_autopm_put_interface_async(struct usb_interface *intf) | ||
2276 | int status; | ||
2277 | |||
2278 | usb_mark_last_busy(udev); | ||
2279 | - atomic_dec(&intf->pm_usage_cnt); | ||
2280 | status = pm_runtime_put(&intf->dev); | ||
2281 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | ||
2282 | __func__, atomic_read(&intf->dev.power.usage_count), | ||
2283 | @@ -1687,7 +1680,6 @@ void usb_autopm_put_interface_no_suspend(struct usb_interface *intf) | ||
2284 | struct usb_device *udev = interface_to_usbdev(intf); | ||
2285 | |||
2286 | usb_mark_last_busy(udev); | ||
2287 | - atomic_dec(&intf->pm_usage_cnt); | ||
2288 | pm_runtime_put_noidle(&intf->dev); | ||
2289 | } | ||
2290 | EXPORT_SYMBOL_GPL(usb_autopm_put_interface_no_suspend); | ||
2291 | @@ -1718,8 +1710,6 @@ int usb_autopm_get_interface(struct usb_interface *intf) | ||
2292 | status = pm_runtime_get_sync(&intf->dev); | ||
2293 | if (status < 0) | ||
2294 | pm_runtime_put_sync(&intf->dev); | ||
2295 | - else | ||
2296 | - atomic_inc(&intf->pm_usage_cnt); | ||
2297 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | ||
2298 | __func__, atomic_read(&intf->dev.power.usage_count), | ||
2299 | status); | ||
2300 | @@ -1753,8 +1743,6 @@ int usb_autopm_get_interface_async(struct usb_interface *intf) | ||
2301 | status = pm_runtime_get(&intf->dev); | ||
2302 | if (status < 0 && status != -EINPROGRESS) | ||
2303 | pm_runtime_put_noidle(&intf->dev); | ||
2304 | - else | ||
2305 | - atomic_inc(&intf->pm_usage_cnt); | ||
2306 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | ||
2307 | __func__, atomic_read(&intf->dev.power.usage_count), | ||
2308 | status); | ||
2309 | @@ -1778,7 +1766,6 @@ void usb_autopm_get_interface_no_resume(struct usb_interface *intf) | ||
2310 | struct usb_device *udev = interface_to_usbdev(intf); | ||
2311 | |||
2312 | usb_mark_last_busy(udev); | ||
2313 | - atomic_inc(&intf->pm_usage_cnt); | ||
2314 | pm_runtime_get_noresume(&intf->dev); | ||
2315 | } | ||
2316 | EXPORT_SYMBOL_GPL(usb_autopm_get_interface_no_resume); | ||
2317 | diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c | ||
2318 | index 4f33eb632a88..4020ce8db6ce 100644 | ||
2319 | --- a/drivers/usb/core/message.c | ||
2320 | +++ b/drivers/usb/core/message.c | ||
2321 | @@ -820,9 +820,11 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) | ||
2322 | |||
2323 | if (dev->state == USB_STATE_SUSPENDED) | ||
2324 | return -EHOSTUNREACH; | ||
2325 | - if (size <= 0 || !buf || !index) | ||
2326 | + if (size <= 0 || !buf) | ||
2327 | return -EINVAL; | ||
2328 | buf[0] = 0; | ||
2329 | + if (index <= 0 || index >= 256) | ||
2330 | + return -EINVAL; | ||
2331 | tbuf = kmalloc(256, GFP_NOIO); | ||
2332 | if (!tbuf) | ||
2333 | return -ENOMEM; | ||
2334 | diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c | ||
2335 | index baf72f95f0f1..213b52508621 100644 | ||
2336 | --- a/drivers/usb/gadget/udc/dummy_hcd.c | ||
2337 | +++ b/drivers/usb/gadget/udc/dummy_hcd.c | ||
2338 | @@ -979,8 +979,18 @@ static int dummy_udc_start(struct usb_gadget *g, | ||
2339 | struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g); | ||
2340 | struct dummy *dum = dum_hcd->dum; | ||
2341 | |||
2342 | - if (driver->max_speed == USB_SPEED_UNKNOWN) | ||
2343 | + switch (g->speed) { | ||
2344 | + /* All the speeds we support */ | ||
2345 | + case USB_SPEED_LOW: | ||
2346 | + case USB_SPEED_FULL: | ||
2347 | + case USB_SPEED_HIGH: | ||
2348 | + case USB_SPEED_SUPER: | ||
2349 | + break; | ||
2350 | + default: | ||
2351 | + dev_err(dummy_dev(dum_hcd), "Unsupported driver max speed %d\n", | ||
2352 | + driver->max_speed); | ||
2353 | return -EINVAL; | ||
2354 | + } | ||
2355 | |||
2356 | /* | ||
2357 | * SLAVE side init ... the layer above hardware, which | ||
2358 | @@ -1784,9 +1794,10 @@ static void dummy_timer(struct timer_list *t) | ||
2359 | /* Bus speed is 500000 bytes/ms, so use a little less */ | ||
2360 | total = 490000; | ||
2361 | break; | ||
2362 | - default: | ||
2363 | + default: /* Can't happen */ | ||
2364 | dev_err(dummy_dev(dum_hcd), "bogus device speed\n"); | ||
2365 | - return; | ||
2366 | + total = 0; | ||
2367 | + break; | ||
2368 | } | ||
2369 | |||
2370 | /* FIXME if HZ != 1000 this will probably misbehave ... */ | ||
2371 | @@ -1828,7 +1839,7 @@ restart: | ||
2372 | |||
2373 | /* Used up this frame's bandwidth? */ | ||
2374 | if (total <= 0) | ||
2375 | - break; | ||
2376 | + continue; | ||
2377 | |||
2378 | /* find the gadget's ep for this request (if configured) */ | ||
2379 | address = usb_pipeendpoint (urb->pipe); | ||
2380 | diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c | ||
2381 | index 6d9fd5f64903..7b306aa22d25 100644 | ||
2382 | --- a/drivers/usb/misc/yurex.c | ||
2383 | +++ b/drivers/usb/misc/yurex.c | ||
2384 | @@ -314,6 +314,7 @@ static void yurex_disconnect(struct usb_interface *interface) | ||
2385 | usb_deregister_dev(interface, &yurex_class); | ||
2386 | |||
2387 | /* prevent more I/O from starting */ | ||
2388 | + usb_poison_urb(dev->urb); | ||
2389 | mutex_lock(&dev->io_mutex); | ||
2390 | dev->interface = NULL; | ||
2391 | mutex_unlock(&dev->io_mutex); | ||
2392 | diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c | ||
2393 | index 31b024441938..cc794e25a0b6 100644 | ||
2394 | --- a/drivers/usb/storage/realtek_cr.c | ||
2395 | +++ b/drivers/usb/storage/realtek_cr.c | ||
2396 | @@ -763,18 +763,16 @@ static void rts51x_suspend_timer_fn(struct timer_list *t) | ||
2397 | break; | ||
2398 | case RTS51X_STAT_IDLE: | ||
2399 | case RTS51X_STAT_SS: | ||
2400 | - usb_stor_dbg(us, "RTS51X_STAT_SS, intf->pm_usage_cnt:%d, power.usage:%d\n", | ||
2401 | - atomic_read(&us->pusb_intf->pm_usage_cnt), | ||
2402 | + usb_stor_dbg(us, "RTS51X_STAT_SS, power.usage:%d\n", | ||
2403 | atomic_read(&us->pusb_intf->dev.power.usage_count)); | ||
2404 | |||
2405 | - if (atomic_read(&us->pusb_intf->pm_usage_cnt) > 0) { | ||
2406 | + if (atomic_read(&us->pusb_intf->dev.power.usage_count) > 0) { | ||
2407 | usb_stor_dbg(us, "Ready to enter SS state\n"); | ||
2408 | rts51x_set_stat(chip, RTS51X_STAT_SS); | ||
2409 | /* ignore mass storage interface's children */ | ||
2410 | pm_suspend_ignore_children(&us->pusb_intf->dev, true); | ||
2411 | usb_autopm_put_interface_async(us->pusb_intf); | ||
2412 | - usb_stor_dbg(us, "RTS51X_STAT_SS 01, intf->pm_usage_cnt:%d, power.usage:%d\n", | ||
2413 | - atomic_read(&us->pusb_intf->pm_usage_cnt), | ||
2414 | + usb_stor_dbg(us, "RTS51X_STAT_SS 01, power.usage:%d\n", | ||
2415 | atomic_read(&us->pusb_intf->dev.power.usage_count)); | ||
2416 | } | ||
2417 | break; | ||
2418 | @@ -807,11 +805,10 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | ||
2419 | int ret; | ||
2420 | |||
2421 | if (working_scsi(srb)) { | ||
2422 | - usb_stor_dbg(us, "working scsi, intf->pm_usage_cnt:%d, power.usage:%d\n", | ||
2423 | - atomic_read(&us->pusb_intf->pm_usage_cnt), | ||
2424 | + usb_stor_dbg(us, "working scsi, power.usage:%d\n", | ||
2425 | atomic_read(&us->pusb_intf->dev.power.usage_count)); | ||
2426 | |||
2427 | - if (atomic_read(&us->pusb_intf->pm_usage_cnt) <= 0) { | ||
2428 | + if (atomic_read(&us->pusb_intf->dev.power.usage_count) <= 0) { | ||
2429 | ret = usb_autopm_get_interface(us->pusb_intf); | ||
2430 | usb_stor_dbg(us, "working scsi, ret=%d\n", ret); | ||
2431 | } | ||
2432 | diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c | ||
2433 | index 97b09a42a10c..dbfb2f24d71e 100644 | ||
2434 | --- a/drivers/usb/usbip/stub_rx.c | ||
2435 | +++ b/drivers/usb/usbip/stub_rx.c | ||
2436 | @@ -361,16 +361,10 @@ static int get_pipe(struct stub_device *sdev, struct usbip_header *pdu) | ||
2437 | } | ||
2438 | |||
2439 | if (usb_endpoint_xfer_isoc(epd)) { | ||
2440 | - /* validate packet size and number of packets */ | ||
2441 | - unsigned int maxp, packets, bytes; | ||
2442 | - | ||
2443 | - maxp = usb_endpoint_maxp(epd); | ||
2444 | - maxp *= usb_endpoint_maxp_mult(epd); | ||
2445 | - bytes = pdu->u.cmd_submit.transfer_buffer_length; | ||
2446 | - packets = DIV_ROUND_UP(bytes, maxp); | ||
2447 | - | ||
2448 | + /* validate number of packets */ | ||
2449 | if (pdu->u.cmd_submit.number_of_packets < 0 || | ||
2450 | - pdu->u.cmd_submit.number_of_packets > packets) { | ||
2451 | + pdu->u.cmd_submit.number_of_packets > | ||
2452 | + USBIP_MAX_ISO_PACKETS) { | ||
2453 | dev_err(&sdev->udev->dev, | ||
2454 | "CMD_SUBMIT: isoc invalid num packets %d\n", | ||
2455 | pdu->u.cmd_submit.number_of_packets); | ||
2456 | diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h | ||
2457 | index bf8afe9b5883..8be857a4fa13 100644 | ||
2458 | --- a/drivers/usb/usbip/usbip_common.h | ||
2459 | +++ b/drivers/usb/usbip/usbip_common.h | ||
2460 | @@ -121,6 +121,13 @@ extern struct device_attribute dev_attr_usbip_debug; | ||
2461 | #define USBIP_DIR_OUT 0x00 | ||
2462 | #define USBIP_DIR_IN 0x01 | ||
2463 | |||
2464 | +/* | ||
2465 | + * Arbitrary limit for the maximum number of isochronous packets in an URB, | ||
2466 | + * compare for example the uhci_submit_isochronous function in | ||
2467 | + * drivers/usb/host/uhci-q.c | ||
2468 | + */ | ||
2469 | +#define USBIP_MAX_ISO_PACKETS 1024 | ||
2470 | + | ||
2471 | /** | ||
2472 | * struct usbip_header_basic - data pertinent to every request | ||
2473 | * @command: the usbip request type | ||
2474 | diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c | ||
2475 | index cddb453a1ba5..6cf00d9f512b 100644 | ||
2476 | --- a/drivers/vfio/pci/vfio_pci.c | ||
2477 | +++ b/drivers/vfio/pci/vfio_pci.c | ||
2478 | @@ -1443,11 +1443,11 @@ static void __init vfio_pci_fill_ids(void) | ||
2479 | rc = pci_add_dynid(&vfio_pci_driver, vendor, device, | ||
2480 | subvendor, subdevice, class, class_mask, 0); | ||
2481 | if (rc) | ||
2482 | - pr_warn("failed to add dynamic id [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x (%d)\n", | ||
2483 | + pr_warn("failed to add dynamic id [%04x:%04x[%04x:%04x]] class %#08x/%08x (%d)\n", | ||
2484 | vendor, device, subvendor, subdevice, | ||
2485 | class, class_mask, rc); | ||
2486 | else | ||
2487 | - pr_info("add [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x\n", | ||
2488 | + pr_info("add [%04x:%04x[%04x:%04x]] class %#08x/%08x\n", | ||
2489 | vendor, device, subvendor, subdevice, | ||
2490 | class, class_mask); | ||
2491 | } | ||
2492 | diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c | ||
2493 | index 0f4ecfcdb549..a9fb77585272 100644 | ||
2494 | --- a/drivers/w1/masters/ds2490.c | ||
2495 | +++ b/drivers/w1/masters/ds2490.c | ||
2496 | @@ -1016,15 +1016,15 @@ static int ds_probe(struct usb_interface *intf, | ||
2497 | /* alternative 3, 1ms interrupt (greatly speeds search), 64 byte bulk */ | ||
2498 | alt = 3; | ||
2499 | err = usb_set_interface(dev->udev, | ||
2500 | - intf->altsetting[alt].desc.bInterfaceNumber, alt); | ||
2501 | + intf->cur_altsetting->desc.bInterfaceNumber, alt); | ||
2502 | if (err) { | ||
2503 | dev_err(&dev->udev->dev, "Failed to set alternative setting %d " | ||
2504 | "for %d interface: err=%d.\n", alt, | ||
2505 | - intf->altsetting[alt].desc.bInterfaceNumber, err); | ||
2506 | + intf->cur_altsetting->desc.bInterfaceNumber, err); | ||
2507 | goto err_out_clear; | ||
2508 | } | ||
2509 | |||
2510 | - iface_desc = &intf->altsetting[alt]; | ||
2511 | + iface_desc = intf->cur_altsetting; | ||
2512 | if (iface_desc->desc.bNumEndpoints != NUM_EP-1) { | ||
2513 | pr_info("Num endpoints=%d. It is not DS9490R.\n", | ||
2514 | iface_desc->desc.bNumEndpoints); | ||
2515 | diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c | ||
2516 | index c3e201025ef0..0782ff3c2273 100644 | ||
2517 | --- a/drivers/xen/xenbus/xenbus_dev_frontend.c | ||
2518 | +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | ||
2519 | @@ -622,9 +622,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) | ||
2520 | if (xen_store_evtchn == 0) | ||
2521 | return -ENOENT; | ||
2522 | |||
2523 | - nonseekable_open(inode, filp); | ||
2524 | - | ||
2525 | - filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */ | ||
2526 | + stream_open(inode, filp); | ||
2527 | |||
2528 | u = kzalloc(sizeof(*u), GFP_KERNEL); | ||
2529 | if (u == NULL) | ||
2530 | diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c | ||
2531 | index 41ef452c1fcf..e5126fad57c5 100644 | ||
2532 | --- a/fs/debugfs/inode.c | ||
2533 | +++ b/fs/debugfs/inode.c | ||
2534 | @@ -163,19 +163,24 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) | ||
2535 | return 0; | ||
2536 | } | ||
2537 | |||
2538 | -static void debugfs_evict_inode(struct inode *inode) | ||
2539 | +static void debugfs_i_callback(struct rcu_head *head) | ||
2540 | { | ||
2541 | - truncate_inode_pages_final(&inode->i_data); | ||
2542 | - clear_inode(inode); | ||
2543 | + struct inode *inode = container_of(head, struct inode, i_rcu); | ||
2544 | if (S_ISLNK(inode->i_mode)) | ||
2545 | kfree(inode->i_link); | ||
2546 | + free_inode_nonrcu(inode); | ||
2547 | +} | ||
2548 | + | ||
2549 | +static void debugfs_destroy_inode(struct inode *inode) | ||
2550 | +{ | ||
2551 | + call_rcu(&inode->i_rcu, debugfs_i_callback); | ||
2552 | } | ||
2553 | |||
2554 | static const struct super_operations debugfs_super_operations = { | ||
2555 | .statfs = simple_statfs, | ||
2556 | .remount_fs = debugfs_remount, | ||
2557 | .show_options = debugfs_show_options, | ||
2558 | - .evict_inode = debugfs_evict_inode, | ||
2559 | + .destroy_inode = debugfs_destroy_inode, | ||
2560 | }; | ||
2561 | |||
2562 | static void debugfs_release_dentry(struct dentry *dentry) | ||
2563 | diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c | ||
2564 | index a7fa037b876b..a3a3d256fb0e 100644 | ||
2565 | --- a/fs/hugetlbfs/inode.c | ||
2566 | +++ b/fs/hugetlbfs/inode.c | ||
2567 | @@ -741,11 +741,17 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, | ||
2568 | umode_t mode, dev_t dev) | ||
2569 | { | ||
2570 | struct inode *inode; | ||
2571 | - struct resv_map *resv_map; | ||
2572 | + struct resv_map *resv_map = NULL; | ||
2573 | |||
2574 | - resv_map = resv_map_alloc(); | ||
2575 | - if (!resv_map) | ||
2576 | - return NULL; | ||
2577 | + /* | ||
2578 | + * Reserve maps are only needed for inodes that can have associated | ||
2579 | + * page allocations. | ||
2580 | + */ | ||
2581 | + if (S_ISREG(mode) || S_ISLNK(mode)) { | ||
2582 | + resv_map = resv_map_alloc(); | ||
2583 | + if (!resv_map) | ||
2584 | + return NULL; | ||
2585 | + } | ||
2586 | |||
2587 | inode = new_inode(sb); | ||
2588 | if (inode) { | ||
2589 | @@ -780,8 +786,10 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, | ||
2590 | break; | ||
2591 | } | ||
2592 | lockdep_annotate_inode_mutex_key(inode); | ||
2593 | - } else | ||
2594 | - kref_put(&resv_map->refs, resv_map_release); | ||
2595 | + } else { | ||
2596 | + if (resv_map) | ||
2597 | + kref_put(&resv_map->refs, resv_map_release); | ||
2598 | + } | ||
2599 | |||
2600 | return inode; | ||
2601 | } | ||
2602 | diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c | ||
2603 | index 389ea53ea487..bccfc40b3a74 100644 | ||
2604 | --- a/fs/jffs2/readinode.c | ||
2605 | +++ b/fs/jffs2/readinode.c | ||
2606 | @@ -1414,11 +1414,6 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) | ||
2607 | |||
2608 | jffs2_kill_fragtree(&f->fragtree, deleted?c:NULL); | ||
2609 | |||
2610 | - if (f->target) { | ||
2611 | - kfree(f->target); | ||
2612 | - f->target = NULL; | ||
2613 | - } | ||
2614 | - | ||
2615 | fds = f->dents; | ||
2616 | while(fds) { | ||
2617 | fd = fds; | ||
2618 | diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c | ||
2619 | index bb6ae387469f..05d892c79339 100644 | ||
2620 | --- a/fs/jffs2/super.c | ||
2621 | +++ b/fs/jffs2/super.c | ||
2622 | @@ -47,7 +47,10 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb) | ||
2623 | static void jffs2_i_callback(struct rcu_head *head) | ||
2624 | { | ||
2625 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
2626 | - kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); | ||
2627 | + struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | ||
2628 | + | ||
2629 | + kfree(f->target); | ||
2630 | + kmem_cache_free(jffs2_inode_cachep, f); | ||
2631 | } | ||
2632 | |||
2633 | static void jffs2_destroy_inode(struct inode *inode) | ||
2634 | diff --git a/fs/open.c b/fs/open.c | ||
2635 | index f1c2f855fd43..a00350018a47 100644 | ||
2636 | --- a/fs/open.c | ||
2637 | +++ b/fs/open.c | ||
2638 | @@ -1215,3 +1215,21 @@ int nonseekable_open(struct inode *inode, struct file *filp) | ||
2639 | } | ||
2640 | |||
2641 | EXPORT_SYMBOL(nonseekable_open); | ||
2642 | + | ||
2643 | +/* | ||
2644 | + * stream_open is used by subsystems that want stream-like file descriptors. | ||
2645 | + * Such file descriptors are not seekable and don't have notion of position | ||
2646 | + * (file.f_pos is always 0). Contrary to file descriptors of other regular | ||
2647 | + * files, .read() and .write() can run simultaneously. | ||
2648 | + * | ||
2649 | + * stream_open never fails and is marked to return int so that it could be | ||
2650 | + * directly used as file_operations.open . | ||
2651 | + */ | ||
2652 | +int stream_open(struct inode *inode, struct file *filp) | ||
2653 | +{ | ||
2654 | + filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE | FMODE_ATOMIC_POS); | ||
2655 | + filp->f_mode |= FMODE_STREAM; | ||
2656 | + return 0; | ||
2657 | +} | ||
2658 | + | ||
2659 | +EXPORT_SYMBOL(stream_open); | ||
2660 | diff --git a/fs/read_write.c b/fs/read_write.c | ||
2661 | index 562974a0616c..85fd7a8ee29e 100644 | ||
2662 | --- a/fs/read_write.c | ||
2663 | +++ b/fs/read_write.c | ||
2664 | @@ -560,12 +560,13 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | ||
2665 | |||
2666 | static inline loff_t file_pos_read(struct file *file) | ||
2667 | { | ||
2668 | - return file->f_pos; | ||
2669 | + return file->f_mode & FMODE_STREAM ? 0 : file->f_pos; | ||
2670 | } | ||
2671 | |||
2672 | static inline void file_pos_write(struct file *file, loff_t pos) | ||
2673 | { | ||
2674 | - file->f_pos = pos; | ||
2675 | + if ((file->f_mode & FMODE_STREAM) == 0) | ||
2676 | + file->f_pos = pos; | ||
2677 | } | ||
2678 | |||
2679 | ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count) | ||
2680 | diff --git a/include/linux/fs.h b/include/linux/fs.h | ||
2681 | index 111c94c4baa1..d4e1b43a53c3 100644 | ||
2682 | --- a/include/linux/fs.h | ||
2683 | +++ b/include/linux/fs.h | ||
2684 | @@ -153,6 +153,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | ||
2685 | #define FMODE_OPENED ((__force fmode_t)0x80000) | ||
2686 | #define FMODE_CREATED ((__force fmode_t)0x100000) | ||
2687 | |||
2688 | +/* File is stream-like */ | ||
2689 | +#define FMODE_STREAM ((__force fmode_t)0x200000) | ||
2690 | + | ||
2691 | /* File was opened by fanotify and shouldn't generate fanotify events */ | ||
2692 | #define FMODE_NONOTIFY ((__force fmode_t)0x4000000) | ||
2693 | |||
2694 | @@ -3019,6 +3022,7 @@ extern loff_t no_seek_end_llseek_size(struct file *, loff_t, int, loff_t); | ||
2695 | extern loff_t no_seek_end_llseek(struct file *, loff_t, int); | ||
2696 | extern int generic_file_open(struct inode * inode, struct file * filp); | ||
2697 | extern int nonseekable_open(struct inode * inode, struct file * filp); | ||
2698 | +extern int stream_open(struct inode * inode, struct file * filp); | ||
2699 | |||
2700 | #ifdef CONFIG_BLOCK | ||
2701 | typedef void (dio_submit_t)(struct bio *bio, struct inode *inode, | ||
2702 | diff --git a/include/linux/i2c.h b/include/linux/i2c.h | ||
2703 | index 65b4eaed1d96..7e748648c7d3 100644 | ||
2704 | --- a/include/linux/i2c.h | ||
2705 | +++ b/include/linux/i2c.h | ||
2706 | @@ -333,6 +333,7 @@ struct i2c_client { | ||
2707 | char name[I2C_NAME_SIZE]; | ||
2708 | struct i2c_adapter *adapter; /* the adapter we sit on */ | ||
2709 | struct device dev; /* the device structure */ | ||
2710 | + int init_irq; /* irq set at initialization */ | ||
2711 | int irq; /* irq issued by device */ | ||
2712 | struct list_head detected; | ||
2713 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | ||
2714 | diff --git a/include/linux/platform_data/x86/clk-pmc-atom.h b/include/linux/platform_data/x86/clk-pmc-atom.h | ||
2715 | index 3ab892208343..7a37ac27d0fb 100644 | ||
2716 | --- a/include/linux/platform_data/x86/clk-pmc-atom.h | ||
2717 | +++ b/include/linux/platform_data/x86/clk-pmc-atom.h | ||
2718 | @@ -35,10 +35,13 @@ struct pmc_clk { | ||
2719 | * | ||
2720 | * @base: PMC clock register base offset | ||
2721 | * @clks: pointer to set of registered clocks, typically 0..5 | ||
2722 | + * @critical: flag to indicate if firmware enabled pmc_plt_clks | ||
2723 | + * should be marked as critial or not | ||
2724 | */ | ||
2725 | struct pmc_clk_data { | ||
2726 | void __iomem *base; | ||
2727 | const struct pmc_clk *clks; | ||
2728 | + bool critical; | ||
2729 | }; | ||
2730 | |||
2731 | #endif /* __PLATFORM_DATA_X86_CLK_PMC_ATOM_H */ | ||
2732 | diff --git a/include/linux/usb.h b/include/linux/usb.h | ||
2733 | index 5e49e82c4368..ff010d1fd1c7 100644 | ||
2734 | --- a/include/linux/usb.h | ||
2735 | +++ b/include/linux/usb.h | ||
2736 | @@ -200,7 +200,6 @@ usb_find_last_int_out_endpoint(struct usb_host_interface *alt, | ||
2737 | * @dev: driver model's view of this device | ||
2738 | * @usb_dev: if an interface is bound to the USB major, this will point | ||
2739 | * to the sysfs representation for that device. | ||
2740 | - * @pm_usage_cnt: PM usage counter for this interface | ||
2741 | * @reset_ws: Used for scheduling resets from atomic context. | ||
2742 | * @resetting_device: USB core reset the device, so use alt setting 0 as | ||
2743 | * current; needs bandwidth alloc after reset. | ||
2744 | @@ -257,7 +256,6 @@ struct usb_interface { | ||
2745 | |||
2746 | struct device dev; /* interface specific device info */ | ||
2747 | struct device *usb_dev; | ||
2748 | - atomic_t pm_usage_cnt; /* usage counter for autosuspend */ | ||
2749 | struct work_struct reset_ws; /* for resets in atomic context */ | ||
2750 | }; | ||
2751 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | ||
2752 | diff --git a/mm/kmemleak.c b/mm/kmemleak.c | ||
2753 | index 17dd883198ae..72e3fb3bb037 100644 | ||
2754 | --- a/mm/kmemleak.c | ||
2755 | +++ b/mm/kmemleak.c | ||
2756 | @@ -1373,6 +1373,7 @@ static void scan_block(void *_start, void *_end, | ||
2757 | /* | ||
2758 | * Scan a large memory block in MAX_SCAN_SIZE chunks to reduce the latency. | ||
2759 | */ | ||
2760 | +#ifdef CONFIG_SMP | ||
2761 | static void scan_large_block(void *start, void *end) | ||
2762 | { | ||
2763 | void *next; | ||
2764 | @@ -1384,6 +1385,7 @@ static void scan_large_block(void *start, void *end) | ||
2765 | cond_resched(); | ||
2766 | } | ||
2767 | } | ||
2768 | +#endif | ||
2769 | |||
2770 | /* | ||
2771 | * Scan a memory block corresponding to a kmemleak_object. A condition is | ||
2772 | @@ -1501,11 +1503,6 @@ static void kmemleak_scan(void) | ||
2773 | } | ||
2774 | rcu_read_unlock(); | ||
2775 | |||
2776 | - /* data/bss scanning */ | ||
2777 | - scan_large_block(_sdata, _edata); | ||
2778 | - scan_large_block(__bss_start, __bss_stop); | ||
2779 | - scan_large_block(__start_ro_after_init, __end_ro_after_init); | ||
2780 | - | ||
2781 | #ifdef CONFIG_SMP | ||
2782 | /* per-cpu sections scanning */ | ||
2783 | for_each_possible_cpu(i) | ||
2784 | @@ -2036,6 +2033,17 @@ void __init kmemleak_init(void) | ||
2785 | } | ||
2786 | local_irq_restore(flags); | ||
2787 | |||
2788 | + /* register the data/bss sections */ | ||
2789 | + create_object((unsigned long)_sdata, _edata - _sdata, | ||
2790 | + KMEMLEAK_GREY, GFP_ATOMIC); | ||
2791 | + create_object((unsigned long)__bss_start, __bss_stop - __bss_start, | ||
2792 | + KMEMLEAK_GREY, GFP_ATOMIC); | ||
2793 | + /* only register .data..ro_after_init if not within .data */ | ||
2794 | + if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata) | ||
2795 | + create_object((unsigned long)__start_ro_after_init, | ||
2796 | + __end_ro_after_init - __start_ro_after_init, | ||
2797 | + KMEMLEAK_GREY, GFP_ATOMIC); | ||
2798 | + | ||
2799 | /* | ||
2800 | * This is the point where tracking allocations is safe. Automatic | ||
2801 | * scanning is started during the late initcall. Add the early logged | ||
2802 | diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c | ||
2803 | index ef0dec20c7d8..5da183b2f4c9 100644 | ||
2804 | --- a/net/batman-adv/bat_v_elp.c | ||
2805 | +++ b/net/batman-adv/bat_v_elp.c | ||
2806 | @@ -104,8 +104,10 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) | ||
2807 | |||
2808 | ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo); | ||
2809 | |||
2810 | - /* free the TID stats immediately */ | ||
2811 | - cfg80211_sinfo_release_content(&sinfo); | ||
2812 | + if (!ret) { | ||
2813 | + /* free the TID stats immediately */ | ||
2814 | + cfg80211_sinfo_release_content(&sinfo); | ||
2815 | + } | ||
2816 | |||
2817 | dev_put(real_netdev); | ||
2818 | if (ret == -ENOENT) { | ||
2819 | diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c | ||
2820 | index 5f1aeeded0e3..85faf25c2912 100644 | ||
2821 | --- a/net/batman-adv/bridge_loop_avoidance.c | ||
2822 | +++ b/net/batman-adv/bridge_loop_avoidance.c | ||
2823 | @@ -803,6 +803,8 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, | ||
2824 | const u8 *mac, const unsigned short vid) | ||
2825 | { | ||
2826 | struct batadv_bla_claim search_claim, *claim; | ||
2827 | + struct batadv_bla_claim *claim_removed_entry; | ||
2828 | + struct hlist_node *claim_removed_node; | ||
2829 | |||
2830 | ether_addr_copy(search_claim.addr, mac); | ||
2831 | search_claim.vid = vid; | ||
2832 | @@ -813,10 +815,18 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, | ||
2833 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "%s(): %pM, vid %d\n", __func__, | ||
2834 | mac, batadv_print_vid(vid)); | ||
2835 | |||
2836 | - batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim, | ||
2837 | - batadv_choose_claim, claim); | ||
2838 | - batadv_claim_put(claim); /* reference from the hash is gone */ | ||
2839 | + claim_removed_node = batadv_hash_remove(bat_priv->bla.claim_hash, | ||
2840 | + batadv_compare_claim, | ||
2841 | + batadv_choose_claim, claim); | ||
2842 | + if (!claim_removed_node) | ||
2843 | + goto free_claim; | ||
2844 | |||
2845 | + /* reference from the hash is gone */ | ||
2846 | + claim_removed_entry = hlist_entry(claim_removed_node, | ||
2847 | + struct batadv_bla_claim, hash_entry); | ||
2848 | + batadv_claim_put(claim_removed_entry); | ||
2849 | + | ||
2850 | +free_claim: | ||
2851 | /* don't need the reference from hash_find() anymore */ | ||
2852 | batadv_claim_put(claim); | ||
2853 | } | ||
2854 | diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c | ||
2855 | index d21624c44665..359ec1a6e822 100644 | ||
2856 | --- a/net/batman-adv/translation-table.c | ||
2857 | +++ b/net/batman-adv/translation-table.c | ||
2858 | @@ -616,14 +616,26 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv, | ||
2859 | struct batadv_tt_global_entry *tt_global, | ||
2860 | const char *message) | ||
2861 | { | ||
2862 | + struct batadv_tt_global_entry *tt_removed_entry; | ||
2863 | + struct hlist_node *tt_removed_node; | ||
2864 | + | ||
2865 | batadv_dbg(BATADV_DBG_TT, bat_priv, | ||
2866 | "Deleting global tt entry %pM (vid: %d): %s\n", | ||
2867 | tt_global->common.addr, | ||
2868 | batadv_print_vid(tt_global->common.vid), message); | ||
2869 | |||
2870 | - batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, | ||
2871 | - batadv_choose_tt, &tt_global->common); | ||
2872 | - batadv_tt_global_entry_put(tt_global); | ||
2873 | + tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash, | ||
2874 | + batadv_compare_tt, | ||
2875 | + batadv_choose_tt, | ||
2876 | + &tt_global->common); | ||
2877 | + if (!tt_removed_node) | ||
2878 | + return; | ||
2879 | + | ||
2880 | + /* drop reference of remove hash entry */ | ||
2881 | + tt_removed_entry = hlist_entry(tt_removed_node, | ||
2882 | + struct batadv_tt_global_entry, | ||
2883 | + common.hash_entry); | ||
2884 | + batadv_tt_global_entry_put(tt_removed_entry); | ||
2885 | } | ||
2886 | |||
2887 | /** | ||
2888 | @@ -1332,9 +1344,10 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, | ||
2889 | unsigned short vid, const char *message, | ||
2890 | bool roaming) | ||
2891 | { | ||
2892 | + struct batadv_tt_local_entry *tt_removed_entry; | ||
2893 | struct batadv_tt_local_entry *tt_local_entry; | ||
2894 | u16 flags, curr_flags = BATADV_NO_FLAGS; | ||
2895 | - void *tt_entry_exists; | ||
2896 | + struct hlist_node *tt_removed_node; | ||
2897 | |||
2898 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); | ||
2899 | if (!tt_local_entry) | ||
2900 | @@ -1363,15 +1376,18 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, | ||
2901 | */ | ||
2902 | batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); | ||
2903 | |||
2904 | - tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, | ||
2905 | + tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash, | ||
2906 | batadv_compare_tt, | ||
2907 | batadv_choose_tt, | ||
2908 | &tt_local_entry->common); | ||
2909 | - if (!tt_entry_exists) | ||
2910 | + if (!tt_removed_node) | ||
2911 | goto out; | ||
2912 | |||
2913 | - /* extra call to free the local tt entry */ | ||
2914 | - batadv_tt_local_entry_put(tt_local_entry); | ||
2915 | + /* drop reference of remove hash entry */ | ||
2916 | + tt_removed_entry = hlist_entry(tt_removed_node, | ||
2917 | + struct batadv_tt_local_entry, | ||
2918 | + common.hash_entry); | ||
2919 | + batadv_tt_local_entry_put(tt_removed_entry); | ||
2920 | |||
2921 | out: | ||
2922 | if (tt_local_entry) | ||
2923 | diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c | ||
2924 | index c813207bb123..d37d4acafebf 100644 | ||
2925 | --- a/net/mac80211/debugfs_netdev.c | ||
2926 | +++ b/net/mac80211/debugfs_netdev.c | ||
2927 | @@ -838,7 +838,7 @@ void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) | ||
2928 | |||
2929 | dir = sdata->vif.debugfs_dir; | ||
2930 | |||
2931 | - if (!dir) | ||
2932 | + if (IS_ERR_OR_NULL(dir)) | ||
2933 | return; | ||
2934 | |||
2935 | sprintf(buf, "netdev:%s", sdata->name); | ||
2936 | diff --git a/net/mac80211/key.c b/net/mac80211/key.c | ||
2937 | index c054ac85793c..f20bb39f492d 100644 | ||
2938 | --- a/net/mac80211/key.c | ||
2939 | +++ b/net/mac80211/key.c | ||
2940 | @@ -167,8 +167,10 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | ||
2941 | * The driver doesn't know anything about VLAN interfaces. | ||
2942 | * Hence, don't send GTKs for VLAN interfaces to the driver. | ||
2943 | */ | ||
2944 | - if (!(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) | ||
2945 | + if (!(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) { | ||
2946 | + ret = 1; | ||
2947 | goto out_unsupported; | ||
2948 | + } | ||
2949 | } | ||
2950 | |||
2951 | ret = drv_set_key(key->local, SET_KEY, sdata, | ||
2952 | @@ -213,11 +215,8 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | ||
2953 | /* all of these we can do in software - if driver can */ | ||
2954 | if (ret == 1) | ||
2955 | return 0; | ||
2956 | - if (ieee80211_hw_check(&key->local->hw, SW_CRYPTO_CONTROL)) { | ||
2957 | - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | ||
2958 | - return 0; | ||
2959 | + if (ieee80211_hw_check(&key->local->hw, SW_CRYPTO_CONTROL)) | ||
2960 | return -EINVAL; | ||
2961 | - } | ||
2962 | return 0; | ||
2963 | default: | ||
2964 | return -EINVAL; | ||
2965 | diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci | ||
2966 | new file mode 100644 | ||
2967 | index 000000000000..350145da7669 | ||
2968 | --- /dev/null | ||
2969 | +++ b/scripts/coccinelle/api/stream_open.cocci | ||
2970 | @@ -0,0 +1,363 @@ | ||
2971 | +// SPDX-License-Identifier: GPL-2.0 | ||
2972 | +// Author: Kirill Smelkov (kirr@nexedi.com) | ||
2973 | +// | ||
2974 | +// Search for stream-like files that are using nonseekable_open and convert | ||
2975 | +// them to stream_open. A stream-like file is a file that does not use ppos in | ||
2976 | +// its read and write. Rationale for the conversion is to avoid deadlock in | ||
2977 | +// between read and write. | ||
2978 | + | ||
2979 | +virtual report | ||
2980 | +virtual patch | ||
2981 | +virtual explain // explain decisions in the patch (SPFLAGS="-D explain") | ||
2982 | + | ||
2983 | +// stream-like reader & writer - ones that do not depend on f_pos. | ||
2984 | +@ stream_reader @ | ||
2985 | +identifier readstream, ppos; | ||
2986 | +identifier f, buf, len; | ||
2987 | +type loff_t; | ||
2988 | +@@ | ||
2989 | + ssize_t readstream(struct file *f, char *buf, size_t len, loff_t *ppos) | ||
2990 | + { | ||
2991 | + ... when != ppos | ||
2992 | + } | ||
2993 | + | ||
2994 | +@ stream_writer @ | ||
2995 | +identifier writestream, ppos; | ||
2996 | +identifier f, buf, len; | ||
2997 | +type loff_t; | ||
2998 | +@@ | ||
2999 | + ssize_t writestream(struct file *f, const char *buf, size_t len, loff_t *ppos) | ||
3000 | + { | ||
3001 | + ... when != ppos | ||
3002 | + } | ||
3003 | + | ||
3004 | + | ||
3005 | +// a function that blocks | ||
3006 | +@ blocks @ | ||
3007 | +identifier block_f; | ||
3008 | +identifier wait_event =~ "^wait_event_.*"; | ||
3009 | +@@ | ||
3010 | + block_f(...) { | ||
3011 | + ... when exists | ||
3012 | + wait_event(...) | ||
3013 | + ... when exists | ||
3014 | + } | ||
3015 | + | ||
3016 | +// stream_reader that can block inside. | ||
3017 | +// | ||
3018 | +// XXX wait_* can be called not directly from current function (e.g. func -> f -> g -> wait()) | ||
3019 | +// XXX currently reader_blocks supports only direct and 1-level indirect cases. | ||
3020 | +@ reader_blocks_direct @ | ||
3021 | +identifier stream_reader.readstream; | ||
3022 | +identifier wait_event =~ "^wait_event_.*"; | ||
3023 | +@@ | ||
3024 | + readstream(...) | ||
3025 | + { | ||
3026 | + ... when exists | ||
3027 | + wait_event(...) | ||
3028 | + ... when exists | ||
3029 | + } | ||
3030 | + | ||
3031 | +@ reader_blocks_1 @ | ||
3032 | +identifier stream_reader.readstream; | ||
3033 | +identifier blocks.block_f; | ||
3034 | +@@ | ||
3035 | + readstream(...) | ||
3036 | + { | ||
3037 | + ... when exists | ||
3038 | + block_f(...) | ||
3039 | + ... when exists | ||
3040 | + } | ||
3041 | + | ||
3042 | +@ reader_blocks depends on reader_blocks_direct || reader_blocks_1 @ | ||
3043 | +identifier stream_reader.readstream; | ||
3044 | +@@ | ||
3045 | + readstream(...) { | ||
3046 | + ... | ||
3047 | + } | ||
3048 | + | ||
3049 | + | ||
3050 | +// file_operations + whether they have _any_ .read, .write, .llseek ... at all. | ||
3051 | +// | ||
3052 | +// XXX add support for file_operations xxx[N] = ... (sound/core/pcm_native.c) | ||
3053 | +@ fops0 @ | ||
3054 | +identifier fops; | ||
3055 | +@@ | ||
3056 | + struct file_operations fops = { | ||
3057 | + ... | ||
3058 | + }; | ||
3059 | + | ||
3060 | +@ has_read @ | ||
3061 | +identifier fops0.fops; | ||
3062 | +identifier read_f; | ||
3063 | +@@ | ||
3064 | + struct file_operations fops = { | ||
3065 | + .read = read_f, | ||
3066 | + }; | ||
3067 | + | ||
3068 | +@ has_read_iter @ | ||
3069 | +identifier fops0.fops; | ||
3070 | +identifier read_iter_f; | ||
3071 | +@@ | ||
3072 | + struct file_operations fops = { | ||
3073 | + .read_iter = read_iter_f, | ||
3074 | + }; | ||
3075 | + | ||
3076 | +@ has_write @ | ||
3077 | +identifier fops0.fops; | ||
3078 | +identifier write_f; | ||
3079 | +@@ | ||
3080 | + struct file_operations fops = { | ||
3081 | + .write = write_f, | ||
3082 | + }; | ||
3083 | + | ||
3084 | +@ has_write_iter @ | ||
3085 | +identifier fops0.fops; | ||
3086 | +identifier write_iter_f; | ||
3087 | +@@ | ||
3088 | + struct file_operations fops = { | ||
3089 | + .write_iter = write_iter_f, | ||
3090 | + }; | ||
3091 | + | ||
3092 | +@ has_llseek @ | ||
3093 | +identifier fops0.fops; | ||
3094 | +identifier llseek_f; | ||
3095 | +@@ | ||
3096 | + struct file_operations fops = { | ||
3097 | + .llseek = llseek_f, | ||
3098 | + }; | ||
3099 | + | ||
3100 | +@ has_no_llseek @ | ||
3101 | +identifier fops0.fops; | ||
3102 | +@@ | ||
3103 | + struct file_operations fops = { | ||
3104 | + .llseek = no_llseek, | ||
3105 | + }; | ||
3106 | + | ||
3107 | +@ has_mmap @ | ||
3108 | +identifier fops0.fops; | ||
3109 | +identifier mmap_f; | ||
3110 | +@@ | ||
3111 | + struct file_operations fops = { | ||
3112 | + .mmap = mmap_f, | ||
3113 | + }; | ||
3114 | + | ||
3115 | +@ has_copy_file_range @ | ||
3116 | +identifier fops0.fops; | ||
3117 | +identifier copy_file_range_f; | ||
3118 | +@@ | ||
3119 | + struct file_operations fops = { | ||
3120 | + .copy_file_range = copy_file_range_f, | ||
3121 | + }; | ||
3122 | + | ||
3123 | +@ has_remap_file_range @ | ||
3124 | +identifier fops0.fops; | ||
3125 | +identifier remap_file_range_f; | ||
3126 | +@@ | ||
3127 | + struct file_operations fops = { | ||
3128 | + .remap_file_range = remap_file_range_f, | ||
3129 | + }; | ||
3130 | + | ||
3131 | +@ has_splice_read @ | ||
3132 | +identifier fops0.fops; | ||
3133 | +identifier splice_read_f; | ||
3134 | +@@ | ||
3135 | + struct file_operations fops = { | ||
3136 | + .splice_read = splice_read_f, | ||
3137 | + }; | ||
3138 | + | ||
3139 | +@ has_splice_write @ | ||
3140 | +identifier fops0.fops; | ||
3141 | +identifier splice_write_f; | ||
3142 | +@@ | ||
3143 | + struct file_operations fops = { | ||
3144 | + .splice_write = splice_write_f, | ||
3145 | + }; | ||
3146 | + | ||
3147 | + | ||
3148 | +// file_operations that is candidate for stream_open conversion - it does not | ||
3149 | +// use mmap and other methods that assume @offset access to file. | ||
3150 | +// | ||
3151 | +// XXX for simplicity require no .{read/write}_iter and no .splice_{read/write} for now. | ||
3152 | +// XXX maybe_steam.fops cannot be used in other rules - it gives "bad rule maybe_stream or bad variable fops". | ||
3153 | +@ maybe_stream depends on (!has_llseek || has_no_llseek) && !has_mmap && !has_copy_file_range && !has_remap_file_range && !has_read_iter && !has_write_iter && !has_splice_read && !has_splice_write @ | ||
3154 | +identifier fops0.fops; | ||
3155 | +@@ | ||
3156 | + struct file_operations fops = { | ||
3157 | + }; | ||
3158 | + | ||
3159 | + | ||
3160 | +// ---- conversions ---- | ||
3161 | + | ||
3162 | +// XXX .open = nonseekable_open -> .open = stream_open | ||
3163 | +// XXX .open = func -> openfunc -> nonseekable_open | ||
3164 | + | ||
3165 | +// read & write | ||
3166 | +// | ||
3167 | +// if both are used in the same file_operations together with an opener - | ||
3168 | +// under that conditions we can use stream_open instead of nonseekable_open. | ||
3169 | +@ fops_rw depends on maybe_stream @ | ||
3170 | +identifier fops0.fops, openfunc; | ||
3171 | +identifier stream_reader.readstream; | ||
3172 | +identifier stream_writer.writestream; | ||
3173 | +@@ | ||
3174 | + struct file_operations fops = { | ||
3175 | + .open = openfunc, | ||
3176 | + .read = readstream, | ||
3177 | + .write = writestream, | ||
3178 | + }; | ||
3179 | + | ||
3180 | +@ report_rw depends on report @ | ||
3181 | +identifier fops_rw.openfunc; | ||
3182 | +position p1; | ||
3183 | +@@ | ||
3184 | + openfunc(...) { | ||
3185 | + <... | ||
3186 | + nonseekable_open@p1 | ||
3187 | + ...> | ||
3188 | + } | ||
3189 | + | ||
3190 | +@ script:python depends on report && reader_blocks @ | ||
3191 | +fops << fops0.fops; | ||
3192 | +p << report_rw.p1; | ||
3193 | +@@ | ||
3194 | +coccilib.report.print_report(p[0], | ||
3195 | + "ERROR: %s: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix." % (fops,)) | ||
3196 | + | ||
3197 | +@ script:python depends on report && !reader_blocks @ | ||
3198 | +fops << fops0.fops; | ||
3199 | +p << report_rw.p1; | ||
3200 | +@@ | ||
3201 | +coccilib.report.print_report(p[0], | ||
3202 | + "WARNING: %s: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open." % (fops,)) | ||
3203 | + | ||
3204 | + | ||
3205 | +@ explain_rw_deadlocked depends on explain && reader_blocks @ | ||
3206 | +identifier fops_rw.openfunc; | ||
3207 | +@@ | ||
3208 | + openfunc(...) { | ||
3209 | + <... | ||
3210 | +- nonseekable_open | ||
3211 | ++ nonseekable_open /* read & write (was deadlock) */ | ||
3212 | + ...> | ||
3213 | + } | ||
3214 | + | ||
3215 | + | ||
3216 | +@ explain_rw_nodeadlock depends on explain && !reader_blocks @ | ||
3217 | +identifier fops_rw.openfunc; | ||
3218 | +@@ | ||
3219 | + openfunc(...) { | ||
3220 | + <... | ||
3221 | +- nonseekable_open | ||
3222 | ++ nonseekable_open /* read & write (no direct deadlock) */ | ||
3223 | + ...> | ||
3224 | + } | ||
3225 | + | ||
3226 | +@ patch_rw depends on patch @ | ||
3227 | +identifier fops_rw.openfunc; | ||
3228 | +@@ | ||
3229 | + openfunc(...) { | ||
3230 | + <... | ||
3231 | +- nonseekable_open | ||
3232 | ++ stream_open | ||
3233 | + ...> | ||
3234 | + } | ||
3235 | + | ||
3236 | + | ||
3237 | +// read, but not write | ||
3238 | +@ fops_r depends on maybe_stream && !has_write @ | ||
3239 | +identifier fops0.fops, openfunc; | ||
3240 | +identifier stream_reader.readstream; | ||
3241 | +@@ | ||
3242 | + struct file_operations fops = { | ||
3243 | + .open = openfunc, | ||
3244 | + .read = readstream, | ||
3245 | + }; | ||
3246 | + | ||
3247 | +@ report_r depends on report @ | ||
3248 | +identifier fops_r.openfunc; | ||
3249 | +position p1; | ||
3250 | +@@ | ||
3251 | + openfunc(...) { | ||
3252 | + <... | ||
3253 | + nonseekable_open@p1 | ||
3254 | + ...> | ||
3255 | + } | ||
3256 | + | ||
3257 | +@ script:python depends on report @ | ||
3258 | +fops << fops0.fops; | ||
3259 | +p << report_r.p1; | ||
3260 | +@@ | ||
3261 | +coccilib.report.print_report(p[0], | ||
3262 | + "WARNING: %s: .read() has stream semantic; safe to change nonseekable_open -> stream_open." % (fops,)) | ||
3263 | + | ||
3264 | +@ explain_r depends on explain @ | ||
3265 | +identifier fops_r.openfunc; | ||
3266 | +@@ | ||
3267 | + openfunc(...) { | ||
3268 | + <... | ||
3269 | +- nonseekable_open | ||
3270 | ++ nonseekable_open /* read only */ | ||
3271 | + ...> | ||
3272 | + } | ||
3273 | + | ||
3274 | +@ patch_r depends on patch @ | ||
3275 | +identifier fops_r.openfunc; | ||
3276 | +@@ | ||
3277 | + openfunc(...) { | ||
3278 | + <... | ||
3279 | +- nonseekable_open | ||
3280 | ++ stream_open | ||
3281 | + ...> | ||
3282 | + } | ||
3283 | + | ||
3284 | + | ||
3285 | +// write, but not read | ||
3286 | +@ fops_w depends on maybe_stream && !has_read @ | ||
3287 | +identifier fops0.fops, openfunc; | ||
3288 | +identifier stream_writer.writestream; | ||
3289 | +@@ | ||
3290 | + struct file_operations fops = { | ||
3291 | + .open = openfunc, | ||
3292 | + .write = writestream, | ||
3293 | + }; | ||
3294 | + | ||
3295 | +@ report_w depends on report @ | ||
3296 | +identifier fops_w.openfunc; | ||
3297 | +position p1; | ||
3298 | +@@ | ||
3299 | + openfunc(...) { | ||
3300 | + <... | ||
3301 | + nonseekable_open@p1 | ||
3302 | + ...> | ||
3303 | + } | ||
3304 | + | ||
3305 | +@ script:python depends on report @ | ||
3306 | +fops << fops0.fops; | ||
3307 | +p << report_w.p1; | ||
3308 | +@@ | ||
3309 | +coccilib.report.print_report(p[0], | ||
3310 | + "WARNING: %s: .write() has stream semantic; safe to change nonseekable_open -> stream_open." % (fops,)) | ||
3311 | + | ||
3312 | +@ explain_w depends on explain @ | ||
3313 | +identifier fops_w.openfunc; | ||
3314 | +@@ | ||
3315 | + openfunc(...) { | ||
3316 | + <... | ||
3317 | +- nonseekable_open | ||
3318 | ++ nonseekable_open /* write only */ | ||
3319 | + ...> | ||
3320 | + } | ||
3321 | + | ||
3322 | +@ patch_w depends on patch @ | ||
3323 | +identifier fops_w.openfunc; | ||
3324 | +@@ | ||
3325 | + openfunc(...) { | ||
3326 | + <... | ||
3327 | +- nonseekable_open | ||
3328 | ++ stream_open | ||
3329 | + ...> | ||
3330 | + } | ||
3331 | + | ||
3332 | + | ||
3333 | +// no read, no write - don't change anything | ||
3334 | diff --git a/security/selinux/avc.c b/security/selinux/avc.c | ||
3335 | index 635e5c1e3e48..5de18a6d5c3f 100644 | ||
3336 | --- a/security/selinux/avc.c | ||
3337 | +++ b/security/selinux/avc.c | ||
3338 | @@ -838,6 +838,7 @@ out: | ||
3339 | * @ssid,@tsid,@tclass : identifier of an AVC entry | ||
3340 | * @seqno : sequence number when decision was made | ||
3341 | * @xpd: extended_perms_decision to be added to the node | ||
3342 | + * @flags: the AVC_* flags, e.g. AVC_NONBLOCKING, AVC_EXTENDED_PERMS, or 0. | ||
3343 | * | ||
3344 | * if a valid AVC entry doesn't exist,this function returns -ENOENT. | ||
3345 | * if kmalloc() called internal returns NULL, this function returns -ENOMEM. | ||
3346 | @@ -856,6 +857,23 @@ static int avc_update_node(struct selinux_avc *avc, | ||
3347 | struct hlist_head *head; | ||
3348 | spinlock_t *lock; | ||
3349 | |||
3350 | + /* | ||
3351 | + * If we are in a non-blocking code path, e.g. VFS RCU walk, | ||
3352 | + * then we must not add permissions to a cache entry | ||
3353 | + * because we cannot safely audit the denial. Otherwise, | ||
3354 | + * during the subsequent blocking retry (e.g. VFS ref walk), we | ||
3355 | + * will find the permissions already granted in the cache entry | ||
3356 | + * and won't audit anything at all, leading to silent denials in | ||
3357 | + * permissive mode that only appear when in enforcing mode. | ||
3358 | + * | ||
3359 | + * See the corresponding handling in slow_avc_audit(), and the | ||
3360 | + * logic in selinux_inode_follow_link and selinux_inode_permission | ||
3361 | + * for the VFS MAY_NOT_BLOCK flag, which is transliterated into | ||
3362 | + * AVC_NONBLOCKING for avc_has_perm_noaudit(). | ||
3363 | + */ | ||
3364 | + if (flags & AVC_NONBLOCKING) | ||
3365 | + return 0; | ||
3366 | + | ||
3367 | node = avc_alloc_node(avc); | ||
3368 | if (!node) { | ||
3369 | rc = -ENOMEM; | ||
3370 | @@ -1115,7 +1133,7 @@ decision: | ||
3371 | * @tsid: target security identifier | ||
3372 | * @tclass: target security class | ||
3373 | * @requested: requested permissions, interpreted based on @tclass | ||
3374 | - * @flags: AVC_STRICT or 0 | ||
3375 | + * @flags: AVC_STRICT, AVC_NONBLOCKING, or 0 | ||
3376 | * @avd: access vector decisions | ||
3377 | * | ||
3378 | * Check the AVC to determine whether the @requested permissions are granted | ||
3379 | @@ -1199,7 +1217,8 @@ int avc_has_perm_flags(struct selinux_state *state, | ||
3380 | struct av_decision avd; | ||
3381 | int rc, rc2; | ||
3382 | |||
3383 | - rc = avc_has_perm_noaudit(state, ssid, tsid, tclass, requested, 0, | ||
3384 | + rc = avc_has_perm_noaudit(state, ssid, tsid, tclass, requested, | ||
3385 | + (flags & MAY_NOT_BLOCK) ? AVC_NONBLOCKING : 0, | ||
3386 | &avd); | ||
3387 | |||
3388 | rc2 = avc_audit(state, ssid, tsid, tclass, requested, &avd, rc, | ||
3389 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c | ||
3390 | index 4337b6d9369e..cba19b8c3e51 100644 | ||
3391 | --- a/security/selinux/hooks.c | ||
3392 | +++ b/security/selinux/hooks.c | ||
3393 | @@ -497,16 +497,10 @@ static int may_context_mount_inode_relabel(u32 sid, | ||
3394 | return rc; | ||
3395 | } | ||
3396 | |||
3397 | -static int selinux_is_sblabel_mnt(struct super_block *sb) | ||
3398 | +static int selinux_is_genfs_special_handling(struct super_block *sb) | ||
3399 | { | ||
3400 | - struct superblock_security_struct *sbsec = sb->s_security; | ||
3401 | - | ||
3402 | - return sbsec->behavior == SECURITY_FS_USE_XATTR || | ||
3403 | - sbsec->behavior == SECURITY_FS_USE_TRANS || | ||
3404 | - sbsec->behavior == SECURITY_FS_USE_TASK || | ||
3405 | - sbsec->behavior == SECURITY_FS_USE_NATIVE || | ||
3406 | - /* Special handling. Genfs but also in-core setxattr handler */ | ||
3407 | - !strcmp(sb->s_type->name, "sysfs") || | ||
3408 | + /* Special handling. Genfs but also in-core setxattr handler */ | ||
3409 | + return !strcmp(sb->s_type->name, "sysfs") || | ||
3410 | !strcmp(sb->s_type->name, "pstore") || | ||
3411 | !strcmp(sb->s_type->name, "debugfs") || | ||
3412 | !strcmp(sb->s_type->name, "tracefs") || | ||
3413 | @@ -516,6 +510,34 @@ static int selinux_is_sblabel_mnt(struct super_block *sb) | ||
3414 | !strcmp(sb->s_type->name, "cgroup2"))); | ||
3415 | } | ||
3416 | |||
3417 | +static int selinux_is_sblabel_mnt(struct super_block *sb) | ||
3418 | +{ | ||
3419 | + struct superblock_security_struct *sbsec = sb->s_security; | ||
3420 | + | ||
3421 | + /* | ||
3422 | + * IMPORTANT: Double-check logic in this function when adding a new | ||
3423 | + * SECURITY_FS_USE_* definition! | ||
3424 | + */ | ||
3425 | + BUILD_BUG_ON(SECURITY_FS_USE_MAX != 7); | ||
3426 | + | ||
3427 | + switch (sbsec->behavior) { | ||
3428 | + case SECURITY_FS_USE_XATTR: | ||
3429 | + case SECURITY_FS_USE_TRANS: | ||
3430 | + case SECURITY_FS_USE_TASK: | ||
3431 | + case SECURITY_FS_USE_NATIVE: | ||
3432 | + return 1; | ||
3433 | + | ||
3434 | + case SECURITY_FS_USE_GENFS: | ||
3435 | + return selinux_is_genfs_special_handling(sb); | ||
3436 | + | ||
3437 | + /* Never allow relabeling on context mounts */ | ||
3438 | + case SECURITY_FS_USE_MNTPOINT: | ||
3439 | + case SECURITY_FS_USE_NONE: | ||
3440 | + default: | ||
3441 | + return 0; | ||
3442 | + } | ||
3443 | +} | ||
3444 | + | ||
3445 | static int sb_finish_set_opts(struct super_block *sb) | ||
3446 | { | ||
3447 | struct superblock_security_struct *sbsec = sb->s_security; | ||
3448 | @@ -3199,7 +3221,9 @@ static int selinux_inode_permission(struct inode *inode, int mask) | ||
3449 | return PTR_ERR(isec); | ||
3450 | |||
3451 | rc = avc_has_perm_noaudit(&selinux_state, | ||
3452 | - sid, isec->sid, isec->sclass, perms, 0, &avd); | ||
3453 | + sid, isec->sid, isec->sclass, perms, | ||
3454 | + (flags & MAY_NOT_BLOCK) ? AVC_NONBLOCKING : 0, | ||
3455 | + &avd); | ||
3456 | audited = avc_audit_required(perms, &avd, rc, | ||
3457 | from_access ? FILE__AUDIT_ACCESS : 0, | ||
3458 | &denied); | ||
3459 | diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h | ||
3460 | index ef899bcfd2cb..74ea50977c20 100644 | ||
3461 | --- a/security/selinux/include/avc.h | ||
3462 | +++ b/security/selinux/include/avc.h | ||
3463 | @@ -142,6 +142,7 @@ static inline int avc_audit(struct selinux_state *state, | ||
3464 | |||
3465 | #define AVC_STRICT 1 /* Ignore permissive mode. */ | ||
3466 | #define AVC_EXTENDED_PERMS 2 /* update extended permissions */ | ||
3467 | +#define AVC_NONBLOCKING 4 /* non blocking */ | ||
3468 | int avc_has_perm_noaudit(struct selinux_state *state, | ||
3469 | u32 ssid, u32 tsid, | ||
3470 | u16 tclass, u32 requested, | ||
3471 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
3472 | index 0a745d677b1c..75a0be2aa9c2 100644 | ||
3473 | --- a/sound/pci/hda/patch_realtek.c | ||
3474 | +++ b/sound/pci/hda/patch_realtek.c | ||
3475 | @@ -5448,6 +5448,8 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec, | ||
3476 | return; | ||
3477 | |||
3478 | spec->gen.preferred_dacs = preferred_pairs; | ||
3479 | + spec->gen.auto_mute_via_amp = 1; | ||
3480 | + codec->power_save_node = 0; | ||
3481 | } | ||
3482 | |||
3483 | /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */ | ||
3484 | @@ -7172,6 +7174,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | ||
3485 | {0x21, 0x02211020}), | ||
3486 | SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
3487 | {0x21, 0x02211020}), | ||
3488 | + SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
3489 | + {0x12, 0x40000000}, | ||
3490 | + {0x14, 0x90170110}, | ||
3491 | + {0x21, 0x02211020}), | ||
3492 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, | ||
3493 | {0x14, 0x90170110}, | ||
3494 | {0x21, 0x02211020}), | ||
3495 | @@ -7445,6 +7451,13 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | ||
3496 | {0x12, 0x90a60130}, | ||
3497 | {0x17, 0x90170110}, | ||
3498 | {0x21, 0x04211020}), | ||
3499 | + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK, | ||
3500 | + {0x12, 0x90a60130}, | ||
3501 | + {0x17, 0x90170110}, | ||
3502 | + {0x21, 0x03211020}), | ||
3503 | + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
3504 | + {0x14, 0x90170110}, | ||
3505 | + {0x21, 0x04211020}), | ||
3506 | SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
3507 | ALC295_STANDARD_PINS, | ||
3508 | {0x17, 0x21014020}, | ||
3509 | diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c | ||
3510 | index 4d3ec295679d..a651fed62a27 100644 | ||
3511 | --- a/sound/soc/codecs/wm_adsp.c | ||
3512 | +++ b/sound/soc/codecs/wm_adsp.c | ||
3513 | @@ -3441,8 +3441,6 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) | ||
3514 | } | ||
3515 | } | ||
3516 | |||
3517 | - wm_adsp_buffer_clear(compr->buf); | ||
3518 | - | ||
3519 | /* Trigger the IRQ at one fragment of data */ | ||
3520 | ret = wm_adsp_buffer_write(compr->buf, | ||
3521 | HOST_BUFFER_FIELD(high_water_mark), | ||
3522 | @@ -3454,6 +3452,8 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) | ||
3523 | } | ||
3524 | break; | ||
3525 | case SNDRV_PCM_TRIGGER_STOP: | ||
3526 | + if (wm_adsp_compr_attached(compr)) | ||
3527 | + wm_adsp_buffer_clear(compr->buf); | ||
3528 | break; | ||
3529 | default: | ||
3530 | ret = -EINVAL; | ||
3531 | diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c | ||
3532 | index f8a68bdb3885..b74bbee111c6 100644 | ||
3533 | --- a/sound/soc/intel/boards/bytcr_rt5651.c | ||
3534 | +++ b/sound/soc/intel/boards/bytcr_rt5651.c | ||
3535 | @@ -267,7 +267,7 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = { | ||
3536 | static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = { | ||
3537 | {"DMIC L1", NULL, "Internal Mic"}, | ||
3538 | {"DMIC R1", NULL, "Internal Mic"}, | ||
3539 | - {"IN3P", NULL, "Headset Mic"}, | ||
3540 | + {"IN2P", NULL, "Headset Mic"}, | ||
3541 | }; | ||
3542 | |||
3543 | static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = { | ||
3544 | diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c | ||
3545 | index 06fba9650ac4..85c4b6d8e89d 100644 | ||
3546 | --- a/sound/soc/stm/stm32_sai_sub.c | ||
3547 | +++ b/sound/soc/stm/stm32_sai_sub.c | ||
3548 | @@ -1194,7 +1194,6 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev, | ||
3549 | if (!sai->cpu_dai_drv) | ||
3550 | return -ENOMEM; | ||
3551 | |||
3552 | - sai->cpu_dai_drv->name = dev_name(&pdev->dev); | ||
3553 | if (STM_SAI_IS_PLAYBACK(sai)) { | ||
3554 | memcpy(sai->cpu_dai_drv, &stm32_sai_playback_dai, | ||
3555 | sizeof(stm32_sai_playback_dai)); | ||
3556 | @@ -1204,6 +1203,7 @@ static int stm32_sai_sub_dais_init(struct platform_device *pdev, | ||
3557 | sizeof(stm32_sai_capture_dai)); | ||
3558 | sai->cpu_dai_drv->capture.stream_name = sai->cpu_dai_drv->name; | ||
3559 | } | ||
3560 | + sai->cpu_dai_drv->name = dev_name(&pdev->dev); | ||
3561 | |||
3562 | return 0; | ||
3563 | } |