Contents of /trunk/kernel-alx/patches-5.4/0231-5.4.132-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(show annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (23 months ago) by niro
File size: 368602 byte(s)
Mon Oct 24 12:40:44 2022 UTC (23 months ago) by niro
File size: 368602 byte(s)
-add missing
1 | diff --git a/Documentation/ABI/testing/evm b/Documentation/ABI/testing/evm |
2 | index 201d10319fa18..1df1177df68ad 100644 |
3 | --- a/Documentation/ABI/testing/evm |
4 | +++ b/Documentation/ABI/testing/evm |
5 | @@ -42,8 +42,30 @@ Description: |
6 | modification of EVM-protected metadata and |
7 | disable all further modification of policy |
8 | |
9 | - Note that once a key has been loaded, it will no longer be |
10 | - possible to enable metadata modification. |
11 | + Echoing a value is additive, the new value is added to the |
12 | + existing initialization flags. |
13 | + |
14 | + For example, after:: |
15 | + |
16 | + echo 2 ><securityfs>/evm |
17 | + |
18 | + another echo can be performed:: |
19 | + |
20 | + echo 1 ><securityfs>/evm |
21 | + |
22 | + and the resulting value will be 3. |
23 | + |
24 | + Note that once an HMAC key has been loaded, it will no longer |
25 | + be possible to enable metadata modification. Signaling that an |
26 | + HMAC key has been loaded will clear the corresponding flag. |
27 | + For example, if the current value is 6 (2 and 4 set):: |
28 | + |
29 | + echo 1 ><securityfs>/evm |
30 | + |
31 | + will set the new value to 3 (4 cleared). |
32 | + |
33 | + Loading an HMAC key is the only way to disable metadata |
34 | + modification. |
35 | |
36 | Until key loading has been signaled EVM can not create |
37 | or validate the 'security.evm' xattr, but returns |
38 | diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 | index a19ae163c0589..dbb68067ba4ea 100644 |
40 | --- a/Documentation/admin-guide/kernel-parameters.txt |
41 | +++ b/Documentation/admin-guide/kernel-parameters.txt |
42 | @@ -567,6 +567,12 @@ |
43 | loops can be debugged more effectively on production |
44 | systems. |
45 | |
46 | + clocksource.max_cswd_read_retries= [KNL] |
47 | + Number of clocksource_watchdog() retries due to |
48 | + external delays before the clock will be marked |
49 | + unstable. Defaults to three retries, that is, |
50 | + four attempts to read the clock under test. |
51 | + |
52 | clearcpuid=BITNUM[,BITNUM...] [X86] |
53 | Disable CPUID feature X for the kernel. See |
54 | arch/x86/include/asm/cpufeatures.h for the valid bit |
55 | diff --git a/Documentation/hwmon/max31790.rst b/Documentation/hwmon/max31790.rst |
56 | index 84c62a12ef3a8..f4749c44cfb8b 100644 |
57 | --- a/Documentation/hwmon/max31790.rst |
58 | +++ b/Documentation/hwmon/max31790.rst |
59 | @@ -38,6 +38,7 @@ Sysfs entries |
60 | fan[1-12]_input RO fan tachometer speed in RPM |
61 | fan[1-12]_fault RO fan experienced fault |
62 | fan[1-6]_target RW desired fan speed in RPM |
63 | -pwm[1-6]_enable RW regulator mode, 0=disabled, 1=manual mode, 2=rpm mode |
64 | -pwm[1-6] RW fan target duty cycle (0-255) |
65 | +pwm[1-6]_enable RW regulator mode, 0=disabled (duty cycle=0%), 1=manual mode, 2=rpm mode |
66 | +pwm[1-6] RW read: current pwm duty cycle, |
67 | + write: target pwm duty cycle (0-255) |
68 | ================== === ======================================================= |
69 | diff --git a/Makefile b/Makefile |
70 | index 5e8716dbbadca..58ea876fa1834 100644 |
71 | --- a/Makefile |
72 | +++ b/Makefile |
73 | @@ -1,7 +1,7 @@ |
74 | # SPDX-License-Identifier: GPL-2.0 |
75 | VERSION = 5 |
76 | PATCHLEVEL = 4 |
77 | -SUBLEVEL = 131 |
78 | +SUBLEVEL = 132 |
79 | EXTRAVERSION = |
80 | NAME = Kleptomaniac Octopus |
81 | |
82 | @@ -937,7 +937,7 @@ LDFLAGS_vmlinux += $(call ld-option, -X,) |
83 | endif |
84 | |
85 | ifeq ($(CONFIG_RELR),y) |
86 | -LDFLAGS_vmlinux += --pack-dyn-relocs=relr |
87 | +LDFLAGS_vmlinux += --pack-dyn-relocs=relr --use-android-relr-tags |
88 | endif |
89 | |
90 | # make the checker run with the right architecture |
91 | diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi |
92 | index 6ab27a7b388d4..a4cef07c38cbd 100644 |
93 | --- a/arch/arm/boot/dts/sama5d4.dtsi |
94 | +++ b/arch/arm/boot/dts/sama5d4.dtsi |
95 | @@ -914,7 +914,7 @@ |
96 | 0xffffffff 0x3ffcfe7c 0x1c010101 /* pioA */ |
97 | 0x7fffffff 0xfffccc3a 0x3f00cc3a /* pioB */ |
98 | 0xffffffff 0x3ff83fff 0xff00ffff /* pioC */ |
99 | - 0x0003ff00 0x8002a800 0x00000000 /* pioD */ |
100 | + 0xb003ff00 0x8002a800 0x00000000 /* pioD */ |
101 | 0xffffffff 0x7fffffff 0x76fff1bf /* pioE */ |
102 | >; |
103 | |
104 | diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c |
105 | index 2924d7910b106..eb2190477da10 100644 |
106 | --- a/arch/arm/kernel/perf_event_v7.c |
107 | +++ b/arch/arm/kernel/perf_event_v7.c |
108 | @@ -773,10 +773,10 @@ static inline void armv7pmu_write_counter(struct perf_event *event, u64 value) |
109 | pr_err("CPU%u writing wrong counter %d\n", |
110 | smp_processor_id(), idx); |
111 | } else if (idx == ARMV7_IDX_CYCLE_COUNTER) { |
112 | - asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (value)); |
113 | + asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" ((u32)value)); |
114 | } else { |
115 | armv7_pmnc_select_counter(idx); |
116 | - asm volatile("mcr p15, 0, %0, c9, c13, 2" : : "r" (value)); |
117 | + asm volatile("mcr p15, 0, %0, c9, c13, 2" : : "r" ((u32)value)); |
118 | } |
119 | } |
120 | |
121 | diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
122 | index 28ad59ee6c34b..6cb1278613c5e 100644 |
123 | --- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
124 | +++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
125 | @@ -134,7 +134,7 @@ |
126 | |
127 | uart0: serial@12000 { |
128 | compatible = "marvell,armada-3700-uart"; |
129 | - reg = <0x12000 0x200>; |
130 | + reg = <0x12000 0x18>; |
131 | clocks = <&xtalclk>; |
132 | interrupts = |
133 | <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
134 | diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h |
135 | index c764cc8fb3b6a..9bf56e30f4a8d 100644 |
136 | --- a/arch/arm64/include/asm/asm-uaccess.h |
137 | +++ b/arch/arm64/include/asm/asm-uaccess.h |
138 | @@ -15,10 +15,10 @@ |
139 | .macro __uaccess_ttbr0_disable, tmp1 |
140 | mrs \tmp1, ttbr1_el1 // swapper_pg_dir |
141 | bic \tmp1, \tmp1, #TTBR_ASID_MASK |
142 | - sub \tmp1, \tmp1, #RESERVED_TTBR0_SIZE // reserved_ttbr0 just before swapper_pg_dir |
143 | + sub \tmp1, \tmp1, #PAGE_SIZE // reserved_pg_dir just before swapper_pg_dir |
144 | msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 |
145 | isb |
146 | - add \tmp1, \tmp1, #RESERVED_TTBR0_SIZE |
147 | + add \tmp1, \tmp1, #PAGE_SIZE |
148 | msr ttbr1_el1, \tmp1 // set reserved ASID |
149 | isb |
150 | .endm |
151 | diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h |
152 | index a6e5da7553597..817efd95d539f 100644 |
153 | --- a/arch/arm64/include/asm/kernel-pgtable.h |
154 | +++ b/arch/arm64/include/asm/kernel-pgtable.h |
155 | @@ -89,12 +89,6 @@ |
156 | #define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR + TEXT_OFFSET, _end)) |
157 | #define IDMAP_DIR_SIZE (IDMAP_PGTABLE_LEVELS * PAGE_SIZE) |
158 | |
159 | -#ifdef CONFIG_ARM64_SW_TTBR0_PAN |
160 | -#define RESERVED_TTBR0_SIZE (PAGE_SIZE) |
161 | -#else |
162 | -#define RESERVED_TTBR0_SIZE (0) |
163 | -#endif |
164 | - |
165 | /* Initial memory map size */ |
166 | #if ARM64_SWAPPER_USES_SECTION_MAPS |
167 | #define SWAPPER_BLOCK_SHIFT SECTION_SHIFT |
168 | diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h |
169 | index 3a5d9f1c91b6d..fb564de90aa7e 100644 |
170 | --- a/arch/arm64/include/asm/mmu_context.h |
171 | +++ b/arch/arm64/include/asm/mmu_context.h |
172 | @@ -36,11 +36,11 @@ static inline void contextidr_thread_switch(struct task_struct *next) |
173 | } |
174 | |
175 | /* |
176 | - * Set TTBR0 to empty_zero_page. No translations will be possible via TTBR0. |
177 | + * Set TTBR0 to reserved_pg_dir. No translations will be possible via TTBR0. |
178 | */ |
179 | static inline void cpu_set_reserved_ttbr0(void) |
180 | { |
181 | - unsigned long ttbr = phys_to_ttbr(__pa_symbol(empty_zero_page)); |
182 | + unsigned long ttbr = phys_to_ttbr(__pa_symbol(reserved_pg_dir)); |
183 | |
184 | write_sysreg(ttbr, ttbr0_el1); |
185 | isb(); |
186 | @@ -184,9 +184,9 @@ static inline void update_saved_ttbr0(struct task_struct *tsk, |
187 | return; |
188 | |
189 | if (mm == &init_mm) |
190 | - ttbr = __pa_symbol(empty_zero_page); |
191 | + ttbr = phys_to_ttbr(__pa_symbol(reserved_pg_dir)); |
192 | else |
193 | - ttbr = virt_to_phys(mm->pgd) | ASID(mm) << 48; |
194 | + ttbr = phys_to_ttbr(virt_to_phys(mm->pgd)) | ASID(mm) << 48; |
195 | |
196 | WRITE_ONCE(task_thread_info(tsk)->ttbr0, ttbr); |
197 | } |
198 | diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
199 | index 8c420f916fe2e..a92a187ec8919 100644 |
200 | --- a/arch/arm64/include/asm/pgtable.h |
201 | +++ b/arch/arm64/include/asm/pgtable.h |
202 | @@ -466,6 +466,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
203 | extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; |
204 | extern pgd_t idmap_pg_end[]; |
205 | extern pgd_t tramp_pg_dir[PTRS_PER_PGD]; |
206 | +extern pgd_t reserved_pg_dir[PTRS_PER_PGD]; |
207 | |
208 | extern void set_swapper_pgd(pgd_t *pgdp, pgd_t pgd); |
209 | |
210 | diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h |
211 | index 32fc8061aa76f..b9a37a415bf9c 100644 |
212 | --- a/arch/arm64/include/asm/uaccess.h |
213 | +++ b/arch/arm64/include/asm/uaccess.h |
214 | @@ -112,8 +112,8 @@ static inline void __uaccess_ttbr0_disable(void) |
215 | local_irq_save(flags); |
216 | ttbr = read_sysreg(ttbr1_el1); |
217 | ttbr &= ~TTBR_ASID_MASK; |
218 | - /* reserved_ttbr0 placed before swapper_pg_dir */ |
219 | - write_sysreg(ttbr - RESERVED_TTBR0_SIZE, ttbr0_el1); |
220 | + /* reserved_pg_dir placed before swapper_pg_dir */ |
221 | + write_sysreg(ttbr - PAGE_SIZE, ttbr0_el1); |
222 | isb(); |
223 | /* Set reserved ASID */ |
224 | write_sysreg(ttbr, ttbr1_el1); |
225 | diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S |
226 | index cf3bd2976e574..db137746c6fa3 100644 |
227 | --- a/arch/arm64/kernel/entry.S |
228 | +++ b/arch/arm64/kernel/entry.S |
229 | @@ -1018,9 +1018,10 @@ ENDPROC(el0_svc) |
230 | */ |
231 | .pushsection ".entry.tramp.text", "ax" |
232 | |
233 | + // Move from tramp_pg_dir to swapper_pg_dir |
234 | .macro tramp_map_kernel, tmp |
235 | mrs \tmp, ttbr1_el1 |
236 | - add \tmp, \tmp, #(PAGE_SIZE + RESERVED_TTBR0_SIZE) |
237 | + add \tmp, \tmp, #(2 * PAGE_SIZE) |
238 | bic \tmp, \tmp, #USER_ASID_FLAG |
239 | msr ttbr1_el1, \tmp |
240 | #ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003 |
241 | @@ -1037,9 +1038,10 @@ alternative_else_nop_endif |
242 | #endif /* CONFIG_QCOM_FALKOR_ERRATUM_1003 */ |
243 | .endm |
244 | |
245 | + // Move from swapper_pg_dir to tramp_pg_dir |
246 | .macro tramp_unmap_kernel, tmp |
247 | mrs \tmp, ttbr1_el1 |
248 | - sub \tmp, \tmp, #(PAGE_SIZE + RESERVED_TTBR0_SIZE) |
249 | + sub \tmp, \tmp, #(2 * PAGE_SIZE) |
250 | orr \tmp, \tmp, #USER_ASID_FLAG |
251 | msr ttbr1_el1, \tmp |
252 | /* |
253 | diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c |
254 | index d98987b82874f..f55f4a15a905e 100644 |
255 | --- a/arch/arm64/kernel/setup.c |
256 | +++ b/arch/arm64/kernel/setup.c |
257 | @@ -356,7 +356,7 @@ void __init setup_arch(char **cmdline_p) |
258 | * faults in case uaccess_enable() is inadvertently called by the init |
259 | * thread. |
260 | */ |
261 | - init_task.thread_info.ttbr0 = __pa_symbol(empty_zero_page); |
262 | + init_task.thread_info.ttbr0 = phys_to_ttbr(__pa_symbol(reserved_pg_dir)); |
263 | #endif |
264 | |
265 | #ifdef CONFIG_VT |
266 | diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S |
267 | index 0bab37b1acbe9..1f82cf631c3c4 100644 |
268 | --- a/arch/arm64/kernel/vmlinux.lds.S |
269 | +++ b/arch/arm64/kernel/vmlinux.lds.S |
270 | @@ -157,13 +157,11 @@ SECTIONS |
271 | . += PAGE_SIZE; |
272 | #endif |
273 | |
274 | -#ifdef CONFIG_ARM64_SW_TTBR0_PAN |
275 | - reserved_ttbr0 = .; |
276 | - . += RESERVED_TTBR0_SIZE; |
277 | -#endif |
278 | + reserved_pg_dir = .; |
279 | + . += PAGE_SIZE; |
280 | + |
281 | swapper_pg_dir = .; |
282 | . += PAGE_SIZE; |
283 | - swapper_pg_end = .; |
284 | |
285 | . = ALIGN(SEGMENT_ALIGN); |
286 | __init_begin = .; |
287 | diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S |
288 | index a1e0592d1fbcd..13e78a5d86905 100644 |
289 | --- a/arch/arm64/mm/proc.S |
290 | +++ b/arch/arm64/mm/proc.S |
291 | @@ -166,7 +166,7 @@ ENDPROC(cpu_do_switch_mm) |
292 | .pushsection ".idmap.text", "awx" |
293 | |
294 | .macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2 |
295 | - adrp \tmp1, empty_zero_page |
296 | + adrp \tmp1, reserved_pg_dir |
297 | phys_to_ttbr \tmp2, \tmp1 |
298 | offset_ttbr1 \tmp2, \tmp1 |
299 | msr ttbr1_el1, \tmp2 |
300 | diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c |
301 | index 4d0ab323dee8c..2a40268c3d494 100644 |
302 | --- a/arch/ia64/kernel/mca_drv.c |
303 | +++ b/arch/ia64/kernel/mca_drv.c |
304 | @@ -343,7 +343,7 @@ init_record_index_pools(void) |
305 | |
306 | /* - 2 - */ |
307 | sect_min_size = sal_log_sect_min_sizes[0]; |
308 | - for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++) |
309 | + for (i = 1; i < ARRAY_SIZE(sal_log_sect_min_sizes); i++) |
310 | if (sect_min_size > sal_log_sect_min_sizes[i]) |
311 | sect_min_size = sal_log_sect_min_sizes[i]; |
312 | |
313 | diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine |
314 | index c01e103492fdc..1bbe0dd0c4fe5 100644 |
315 | --- a/arch/m68k/Kconfig.machine |
316 | +++ b/arch/m68k/Kconfig.machine |
317 | @@ -23,6 +23,9 @@ config ATARI |
318 | this kernel on an Atari, say Y here and browse the material |
319 | available in <file:Documentation/m68k>; otherwise say N. |
320 | |
321 | +config ATARI_KBD_CORE |
322 | + bool |
323 | + |
324 | config MAC |
325 | bool "Macintosh support" |
326 | depends on MMU |
327 | diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h |
328 | index 9d84aafc33d05..9a6bf4f011b5f 100644 |
329 | --- a/arch/mips/include/asm/highmem.h |
330 | +++ b/arch/mips/include/asm/highmem.h |
331 | @@ -36,7 +36,7 @@ extern pte_t *pkmap_page_table; |
332 | * easily, subsequent pte tables have to be allocated in one physical |
333 | * chunk of RAM. |
334 | */ |
335 | -#ifdef CONFIG_PHYS_ADDR_T_64BIT |
336 | +#if defined(CONFIG_PHYS_ADDR_T_64BIT) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) |
337 | #define LAST_PKMAP 512 |
338 | #else |
339 | #define LAST_PKMAP 1024 |
340 | diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h |
341 | index deb99fd6e060f..51f533b6ece02 100644 |
342 | --- a/arch/powerpc/include/asm/cputhreads.h |
343 | +++ b/arch/powerpc/include/asm/cputhreads.h |
344 | @@ -99,6 +99,36 @@ static inline int cpu_last_thread_sibling(int cpu) |
345 | return cpu | (threads_per_core - 1); |
346 | } |
347 | |
348 | +/* |
349 | + * tlb_thread_siblings are siblings which share a TLB. This is not |
350 | + * architected, is not something a hypervisor could emulate and a future |
351 | + * CPU may change behaviour even in compat mode, so this should only be |
352 | + * used on PowerNV, and only with care. |
353 | + */ |
354 | +static inline int cpu_first_tlb_thread_sibling(int cpu) |
355 | +{ |
356 | + if (cpu_has_feature(CPU_FTR_ARCH_300) && (threads_per_core == 8)) |
357 | + return cpu & ~0x6; /* Big Core */ |
358 | + else |
359 | + return cpu_first_thread_sibling(cpu); |
360 | +} |
361 | + |
362 | +static inline int cpu_last_tlb_thread_sibling(int cpu) |
363 | +{ |
364 | + if (cpu_has_feature(CPU_FTR_ARCH_300) && (threads_per_core == 8)) |
365 | + return cpu | 0x6; /* Big Core */ |
366 | + else |
367 | + return cpu_last_thread_sibling(cpu); |
368 | +} |
369 | + |
370 | +static inline int cpu_tlb_thread_sibling_step(void) |
371 | +{ |
372 | + if (cpu_has_feature(CPU_FTR_ARCH_300) && (threads_per_core == 8)) |
373 | + return 2; /* Big Core */ |
374 | + else |
375 | + return 1; |
376 | +} |
377 | + |
378 | static inline u32 get_tensr(void) |
379 | { |
380 | #ifdef CONFIG_BOOKE |
381 | diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c |
382 | index b24d860bbab9b..c06cac543f188 100644 |
383 | --- a/arch/powerpc/kernel/smp.c |
384 | +++ b/arch/powerpc/kernel/smp.c |
385 | @@ -588,6 +588,8 @@ static void nmi_stop_this_cpu(struct pt_regs *regs) |
386 | /* |
387 | * IRQs are already hard disabled by the smp_handle_nmi_ipi. |
388 | */ |
389 | + set_cpu_online(smp_processor_id(), false); |
390 | + |
391 | spin_begin(); |
392 | while (1) |
393 | spin_cpu_relax(); |
394 | @@ -603,6 +605,15 @@ void smp_send_stop(void) |
395 | static void stop_this_cpu(void *dummy) |
396 | { |
397 | hard_irq_disable(); |
398 | + |
399 | + /* |
400 | + * Offlining CPUs in stop_this_cpu can result in scheduler warnings, |
401 | + * (see commit de6e5d38417e), but printk_safe_flush_on_panic() wants |
402 | + * to know other CPUs are offline before it breaks locks to flush |
403 | + * printk buffers, in case we panic()ed while holding the lock. |
404 | + */ |
405 | + set_cpu_online(smp_processor_id(), false); |
406 | + |
407 | spin_begin(); |
408 | while (1) |
409 | spin_cpu_relax(); |
410 | diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c |
411 | index e2a46cfed5fd1..b13c6213b0d9b 100644 |
412 | --- a/arch/powerpc/kernel/stacktrace.c |
413 | +++ b/arch/powerpc/kernel/stacktrace.c |
414 | @@ -19,6 +19,7 @@ |
415 | #include <asm/ptrace.h> |
416 | #include <asm/processor.h> |
417 | #include <linux/ftrace.h> |
418 | +#include <linux/delay.h> |
419 | #include <asm/kprobes.h> |
420 | |
421 | #include <asm/paca.h> |
422 | @@ -230,17 +231,31 @@ static void handle_backtrace_ipi(struct pt_regs *regs) |
423 | |
424 | static void raise_backtrace_ipi(cpumask_t *mask) |
425 | { |
426 | + struct paca_struct *p; |
427 | unsigned int cpu; |
428 | + u64 delay_us; |
429 | |
430 | for_each_cpu(cpu, mask) { |
431 | - if (cpu == smp_processor_id()) |
432 | + if (cpu == smp_processor_id()) { |
433 | handle_backtrace_ipi(NULL); |
434 | - else |
435 | - smp_send_safe_nmi_ipi(cpu, handle_backtrace_ipi, 5 * USEC_PER_SEC); |
436 | - } |
437 | + continue; |
438 | + } |
439 | |
440 | - for_each_cpu(cpu, mask) { |
441 | - struct paca_struct *p = paca_ptrs[cpu]; |
442 | + delay_us = 5 * USEC_PER_SEC; |
443 | + |
444 | + if (smp_send_safe_nmi_ipi(cpu, handle_backtrace_ipi, delay_us)) { |
445 | + // Now wait up to 5s for the other CPU to do its backtrace |
446 | + while (cpumask_test_cpu(cpu, mask) && delay_us) { |
447 | + udelay(1); |
448 | + delay_us--; |
449 | + } |
450 | + |
451 | + // Other CPU cleared itself from the mask |
452 | + if (delay_us) |
453 | + continue; |
454 | + } |
455 | + |
456 | + p = paca_ptrs[cpu]; |
457 | |
458 | cpumask_clear_cpu(cpu, mask); |
459 | |
460 | diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
461 | index 6938b793a0150..9011857c0434d 100644 |
462 | --- a/arch/powerpc/kvm/book3s_hv.c |
463 | +++ b/arch/powerpc/kvm/book3s_hv.c |
464 | @@ -2536,7 +2536,7 @@ static void radix_flush_cpu(struct kvm *kvm, int cpu, struct kvm_vcpu *vcpu) |
465 | cpumask_t *cpu_in_guest; |
466 | int i; |
467 | |
468 | - cpu = cpu_first_thread_sibling(cpu); |
469 | + cpu = cpu_first_tlb_thread_sibling(cpu); |
470 | if (nested) { |
471 | cpumask_set_cpu(cpu, &nested->need_tlb_flush); |
472 | cpu_in_guest = &nested->cpu_in_guest; |
473 | @@ -2550,9 +2550,10 @@ static void radix_flush_cpu(struct kvm *kvm, int cpu, struct kvm_vcpu *vcpu) |
474 | * the other side is the first smp_mb() in kvmppc_run_core(). |
475 | */ |
476 | smp_mb(); |
477 | - for (i = 0; i < threads_per_core; ++i) |
478 | - if (cpumask_test_cpu(cpu + i, cpu_in_guest)) |
479 | - smp_call_function_single(cpu + i, do_nothing, NULL, 1); |
480 | + for (i = cpu; i <= cpu_last_tlb_thread_sibling(cpu); |
481 | + i += cpu_tlb_thread_sibling_step()) |
482 | + if (cpumask_test_cpu(i, cpu_in_guest)) |
483 | + smp_call_function_single(i, do_nothing, NULL, 1); |
484 | } |
485 | |
486 | static void kvmppc_prepare_radix_vcpu(struct kvm_vcpu *vcpu, int pcpu) |
487 | @@ -2583,8 +2584,8 @@ static void kvmppc_prepare_radix_vcpu(struct kvm_vcpu *vcpu, int pcpu) |
488 | */ |
489 | if (prev_cpu != pcpu) { |
490 | if (prev_cpu >= 0 && |
491 | - cpu_first_thread_sibling(prev_cpu) != |
492 | - cpu_first_thread_sibling(pcpu)) |
493 | + cpu_first_tlb_thread_sibling(prev_cpu) != |
494 | + cpu_first_tlb_thread_sibling(pcpu)) |
495 | radix_flush_cpu(kvm, prev_cpu, vcpu); |
496 | if (nested) |
497 | nested->prev_cpu[vcpu->arch.nested_vcpu_id] = pcpu; |
498 | diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c |
499 | index 7c1909657b556..4a91b543a8540 100644 |
500 | --- a/arch/powerpc/kvm/book3s_hv_builtin.c |
501 | +++ b/arch/powerpc/kvm/book3s_hv_builtin.c |
502 | @@ -847,7 +847,7 @@ void kvmppc_check_need_tlb_flush(struct kvm *kvm, int pcpu, |
503 | * Thus we make all 4 threads use the same bit. |
504 | */ |
505 | if (cpu_has_feature(CPU_FTR_ARCH_300)) |
506 | - pcpu = cpu_first_thread_sibling(pcpu); |
507 | + pcpu = cpu_first_tlb_thread_sibling(pcpu); |
508 | |
509 | if (nested) |
510 | need_tlb_flush = &nested->need_tlb_flush; |
511 | diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c |
512 | index cdf30c6eaf542..66fa2c7590aa0 100644 |
513 | --- a/arch/powerpc/kvm/book3s_hv_nested.c |
514 | +++ b/arch/powerpc/kvm/book3s_hv_nested.c |
515 | @@ -51,7 +51,8 @@ void kvmhv_save_hv_regs(struct kvm_vcpu *vcpu, struct hv_guest_state *hr) |
516 | hr->ppr = vcpu->arch.ppr; |
517 | } |
518 | |
519 | -static void byteswap_pt_regs(struct pt_regs *regs) |
520 | +/* Use noinline_for_stack due to https://bugs.llvm.org/show_bug.cgi?id=49610 */ |
521 | +static noinline_for_stack void byteswap_pt_regs(struct pt_regs *regs) |
522 | { |
523 | unsigned long *addr = (unsigned long *) regs; |
524 | |
525 | diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c |
526 | index 220305454c23c..9bf3be438ac58 100644 |
527 | --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c |
528 | +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c |
529 | @@ -67,7 +67,7 @@ static int global_invalidates(struct kvm *kvm) |
530 | * so use the bit for the first thread to represent the core. |
531 | */ |
532 | if (cpu_has_feature(CPU_FTR_ARCH_300)) |
533 | - cpu = cpu_first_thread_sibling(cpu); |
534 | + cpu = cpu_first_tlb_thread_sibling(cpu); |
535 | cpumask_clear_cpu(cpu, &kvm->arch.need_tlb_flush); |
536 | } |
537 | |
538 | diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig |
539 | index 43a81d0ad5074..0023b78391f14 100644 |
540 | --- a/arch/s390/Kconfig |
541 | +++ b/arch/s390/Kconfig |
542 | @@ -920,7 +920,7 @@ config CMM_IUCV |
543 | config APPLDATA_BASE |
544 | def_bool n |
545 | prompt "Linux - VM Monitor Stream, base infrastructure" |
546 | - depends on PROC_FS |
547 | + depends on PROC_SYSCTL |
548 | help |
549 | This provides a kernel interface for creating and updating z/VM APPLDATA |
550 | monitor records. The monitor records are updated at certain time |
551 | diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
552 | index d08e13c6dc982..20ba8537dbcc2 100644 |
553 | --- a/arch/s390/kvm/kvm-s390.c |
554 | +++ b/arch/s390/kvm/kvm-s390.c |
555 | @@ -318,31 +318,31 @@ static void allow_cpu_feat(unsigned long nr) |
556 | |
557 | static inline int plo_test_bit(unsigned char nr) |
558 | { |
559 | - register unsigned long r0 asm("0") = (unsigned long) nr | 0x100; |
560 | + unsigned long function = (unsigned long)nr | 0x100; |
561 | int cc; |
562 | |
563 | asm volatile( |
564 | + " lgr 0,%[function]\n" |
565 | /* Parameter registers are ignored for "test bit" */ |
566 | " plo 0,0,0,0(0)\n" |
567 | " ipm %0\n" |
568 | " srl %0,28\n" |
569 | : "=d" (cc) |
570 | - : "d" (r0) |
571 | - : "cc"); |
572 | + : [function] "d" (function) |
573 | + : "cc", "0"); |
574 | return cc == 0; |
575 | } |
576 | |
577 | static __always_inline void __insn32_query(unsigned int opcode, u8 *query) |
578 | { |
579 | - register unsigned long r0 asm("0") = 0; /* query function */ |
580 | - register unsigned long r1 asm("1") = (unsigned long) query; |
581 | - |
582 | asm volatile( |
583 | - /* Parameter regs are ignored */ |
584 | + " lghi 0,0\n" |
585 | + " lgr 1,%[query]\n" |
586 | + /* Parameter registers are ignored */ |
587 | " .insn rrf,%[opc] << 16,2,4,6,0\n" |
588 | : |
589 | - : "d" (r0), "a" (r1), [opc] "i" (opcode) |
590 | - : "cc", "memory"); |
591 | + : [query] "d" ((unsigned long)query), [opc] "i" (opcode) |
592 | + : "cc", "memory", "0", "1"); |
593 | } |
594 | |
595 | #define INSN_SORTL 0xb938 |
596 | diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c |
597 | index 3f63bd7421aca..023bd3e1aa0d2 100644 |
598 | --- a/arch/x86/kvm/vmx/nested.c |
599 | +++ b/arch/x86/kvm/vmx/nested.c |
600 | @@ -5099,7 +5099,7 @@ static int handle_vmfunc(struct kvm_vcpu *vcpu) |
601 | } |
602 | |
603 | vmcs12 = get_vmcs12(vcpu); |
604 | - if ((vmcs12->vm_function_control & (1 << function)) == 0) |
605 | + if (!(vmcs12->vm_function_control & BIT_ULL(function))) |
606 | goto fail; |
607 | |
608 | switch (function) { |
609 | diff --git a/block/blk-merge.c b/block/blk-merge.c |
610 | index 03959bfe961cf..4b022f0c49d20 100644 |
611 | --- a/block/blk-merge.c |
612 | +++ b/block/blk-merge.c |
613 | @@ -571,10 +571,14 @@ static inline unsigned int blk_rq_get_max_segments(struct request *rq) |
614 | static inline int ll_new_hw_segment(struct request *req, struct bio *bio, |
615 | unsigned int nr_phys_segs) |
616 | { |
617 | - if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req)) |
618 | + if (blk_integrity_merge_bio(req->q, req, bio) == false) |
619 | goto no_merge; |
620 | |
621 | - if (blk_integrity_merge_bio(req->q, req, bio) == false) |
622 | + /* discard request merge won't add new segment */ |
623 | + if (req_op(req) == REQ_OP_DISCARD) |
624 | + return 1; |
625 | + |
626 | + if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req)) |
627 | goto no_merge; |
628 | |
629 | /* |
630 | diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h |
631 | index 2bc43e94f4c40..2bcb3495e376b 100644 |
632 | --- a/block/blk-rq-qos.h |
633 | +++ b/block/blk-rq-qos.h |
634 | @@ -7,6 +7,7 @@ |
635 | #include <linux/blk_types.h> |
636 | #include <linux/atomic.h> |
637 | #include <linux/wait.h> |
638 | +#include <linux/blk-mq.h> |
639 | |
640 | #include "blk-mq-debugfs.h" |
641 | |
642 | @@ -99,8 +100,21 @@ static inline void rq_wait_init(struct rq_wait *rq_wait) |
643 | |
644 | static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) |
645 | { |
646 | + /* |
647 | + * No IO can be in-flight when adding rqos, so freeze queue, which |
648 | + * is fine since we only support rq_qos for blk-mq queue. |
649 | + * |
650 | + * Reuse ->queue_lock for protecting against other concurrent |
651 | + * rq_qos adding/deleting |
652 | + */ |
653 | + blk_mq_freeze_queue(q); |
654 | + |
655 | + spin_lock_irq(&q->queue_lock); |
656 | rqos->next = q->rq_qos; |
657 | q->rq_qos = rqos; |
658 | + spin_unlock_irq(&q->queue_lock); |
659 | + |
660 | + blk_mq_unfreeze_queue(q); |
661 | |
662 | if (rqos->ops->debugfs_attrs) |
663 | blk_mq_debugfs_register_rqos(rqos); |
664 | @@ -110,12 +124,22 @@ static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) |
665 | { |
666 | struct rq_qos **cur; |
667 | |
668 | + /* |
669 | + * See comment in rq_qos_add() about freezing queue & using |
670 | + * ->queue_lock. |
671 | + */ |
672 | + blk_mq_freeze_queue(q); |
673 | + |
674 | + spin_lock_irq(&q->queue_lock); |
675 | for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) { |
676 | if (*cur == rqos) { |
677 | *cur = rqos->next; |
678 | break; |
679 | } |
680 | } |
681 | + spin_unlock_irq(&q->queue_lock); |
682 | + |
683 | + blk_mq_unfreeze_queue(q); |
684 | |
685 | blk_mq_debugfs_unregister_rqos(rqos); |
686 | } |
687 | diff --git a/block/blk-wbt.c b/block/blk-wbt.c |
688 | index 8641ba9793c5f..ee708c1bc3523 100644 |
689 | --- a/block/blk-wbt.c |
690 | +++ b/block/blk-wbt.c |
691 | @@ -77,7 +77,8 @@ enum { |
692 | |
693 | static inline bool rwb_enabled(struct rq_wb *rwb) |
694 | { |
695 | - return rwb && rwb->wb_normal != 0; |
696 | + return rwb && rwb->enable_state != WBT_STATE_OFF_DEFAULT && |
697 | + rwb->wb_normal != 0; |
698 | } |
699 | |
700 | static void wb_timestamp(struct rq_wb *rwb, unsigned long *var) |
701 | @@ -644,9 +645,13 @@ void wbt_set_write_cache(struct request_queue *q, bool write_cache_on) |
702 | void wbt_enable_default(struct request_queue *q) |
703 | { |
704 | struct rq_qos *rqos = wbt_rq_qos(q); |
705 | + |
706 | /* Throttling already enabled? */ |
707 | - if (rqos) |
708 | + if (rqos) { |
709 | + if (RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT) |
710 | + RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT; |
711 | return; |
712 | + } |
713 | |
714 | /* Queue not registered? Maybe shutting down... */ |
715 | if (!blk_queue_registered(q)) |
716 | @@ -710,7 +715,7 @@ void wbt_disable_default(struct request_queue *q) |
717 | rwb = RQWB(rqos); |
718 | if (rwb->enable_state == WBT_STATE_ON_DEFAULT) { |
719 | blk_stat_deactivate(rwb->cb); |
720 | - rwb->wb_normal = 0; |
721 | + rwb->enable_state = WBT_STATE_OFF_DEFAULT; |
722 | } |
723 | } |
724 | EXPORT_SYMBOL_GPL(wbt_disable_default); |
725 | diff --git a/block/blk-wbt.h b/block/blk-wbt.h |
726 | index 8e4e376609710..d8d9f41b42f9a 100644 |
727 | --- a/block/blk-wbt.h |
728 | +++ b/block/blk-wbt.h |
729 | @@ -34,6 +34,7 @@ enum { |
730 | enum { |
731 | WBT_STATE_ON_DEFAULT = 1, |
732 | WBT_STATE_ON_MANUAL = 2, |
733 | + WBT_STATE_OFF_DEFAULT |
734 | }; |
735 | |
736 | struct rq_wb { |
737 | diff --git a/crypto/shash.c b/crypto/shash.c |
738 | index e83c5124f6eb1..9c4cdfd8550ef 100644 |
739 | --- a/crypto/shash.c |
740 | +++ b/crypto/shash.c |
741 | @@ -20,12 +20,24 @@ |
742 | |
743 | static const struct crypto_type crypto_shash_type; |
744 | |
745 | -int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, |
746 | - unsigned int keylen) |
747 | +static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, |
748 | + unsigned int keylen) |
749 | { |
750 | return -ENOSYS; |
751 | } |
752 | -EXPORT_SYMBOL_GPL(shash_no_setkey); |
753 | + |
754 | +/* |
755 | + * Check whether an shash algorithm has a setkey function. |
756 | + * |
757 | + * For CFI compatibility, this must not be an inline function. This is because |
758 | + * when CFI is enabled, modules won't get the same address for shash_no_setkey |
759 | + * (if it were exported, which inlining would require) as the core kernel will. |
760 | + */ |
761 | +bool crypto_shash_alg_has_setkey(struct shash_alg *alg) |
762 | +{ |
763 | + return alg->setkey != shash_no_setkey; |
764 | +} |
765 | +EXPORT_SYMBOL_GPL(crypto_shash_alg_has_setkey); |
766 | |
767 | static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, |
768 | unsigned int keylen) |
769 | diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile |
770 | index ef1ac4d127dab..1c81504046d4d 100644 |
771 | --- a/drivers/acpi/Makefile |
772 | +++ b/drivers/acpi/Makefile |
773 | @@ -8,6 +8,11 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT |
774 | # |
775 | # ACPI Boot-Time Table Parsing |
776 | # |
777 | +ifeq ($(CONFIG_ACPI_CUSTOM_DSDT),y) |
778 | +tables.o: $(src)/../../include/$(subst $\",,$(CONFIG_ACPI_CUSTOM_DSDT_FILE)) ; |
779 | + |
780 | +endif |
781 | + |
782 | obj-$(CONFIG_ACPI) += tables.o |
783 | obj-$(CONFIG_X86) += blacklist.o |
784 | |
785 | diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c |
786 | index e7dc0133f8173..c11d736a8db7e 100644 |
787 | --- a/drivers/acpi/acpi_pad.c |
788 | +++ b/drivers/acpi/acpi_pad.c |
789 | @@ -262,7 +262,7 @@ static uint32_t acpi_pad_idle_cpus_num(void) |
790 | return ps_tsk_num; |
791 | } |
792 | |
793 | -static ssize_t acpi_pad_rrtime_store(struct device *dev, |
794 | +static ssize_t rrtime_store(struct device *dev, |
795 | struct device_attribute *attr, const char *buf, size_t count) |
796 | { |
797 | unsigned long num; |
798 | @@ -276,16 +276,14 @@ static ssize_t acpi_pad_rrtime_store(struct device *dev, |
799 | return count; |
800 | } |
801 | |
802 | -static ssize_t acpi_pad_rrtime_show(struct device *dev, |
803 | +static ssize_t rrtime_show(struct device *dev, |
804 | struct device_attribute *attr, char *buf) |
805 | { |
806 | return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time); |
807 | } |
808 | -static DEVICE_ATTR(rrtime, S_IRUGO|S_IWUSR, |
809 | - acpi_pad_rrtime_show, |
810 | - acpi_pad_rrtime_store); |
811 | +static DEVICE_ATTR_RW(rrtime); |
812 | |
813 | -static ssize_t acpi_pad_idlepct_store(struct device *dev, |
814 | +static ssize_t idlepct_store(struct device *dev, |
815 | struct device_attribute *attr, const char *buf, size_t count) |
816 | { |
817 | unsigned long num; |
818 | @@ -299,16 +297,14 @@ static ssize_t acpi_pad_idlepct_store(struct device *dev, |
819 | return count; |
820 | } |
821 | |
822 | -static ssize_t acpi_pad_idlepct_show(struct device *dev, |
823 | +static ssize_t idlepct_show(struct device *dev, |
824 | struct device_attribute *attr, char *buf) |
825 | { |
826 | return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct); |
827 | } |
828 | -static DEVICE_ATTR(idlepct, S_IRUGO|S_IWUSR, |
829 | - acpi_pad_idlepct_show, |
830 | - acpi_pad_idlepct_store); |
831 | +static DEVICE_ATTR_RW(idlepct); |
832 | |
833 | -static ssize_t acpi_pad_idlecpus_store(struct device *dev, |
834 | +static ssize_t idlecpus_store(struct device *dev, |
835 | struct device_attribute *attr, const char *buf, size_t count) |
836 | { |
837 | unsigned long num; |
838 | @@ -320,16 +316,14 @@ static ssize_t acpi_pad_idlecpus_store(struct device *dev, |
839 | return count; |
840 | } |
841 | |
842 | -static ssize_t acpi_pad_idlecpus_show(struct device *dev, |
843 | +static ssize_t idlecpus_show(struct device *dev, |
844 | struct device_attribute *attr, char *buf) |
845 | { |
846 | return cpumap_print_to_pagebuf(false, buf, |
847 | to_cpumask(pad_busy_cpus_bits)); |
848 | } |
849 | |
850 | -static DEVICE_ATTR(idlecpus, S_IRUGO|S_IWUSR, |
851 | - acpi_pad_idlecpus_show, |
852 | - acpi_pad_idlecpus_store); |
853 | +static DEVICE_ATTR_RW(idlecpus); |
854 | |
855 | static int acpi_pad_add_sysfs(struct acpi_device *device) |
856 | { |
857 | diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c |
858 | index 33a4bcdaa4d79..bab8583443a61 100644 |
859 | --- a/drivers/acpi/acpi_tad.c |
860 | +++ b/drivers/acpi/acpi_tad.c |
861 | @@ -237,7 +237,7 @@ static ssize_t time_show(struct device *dev, struct device_attribute *attr, |
862 | rt.tz, rt.daylight); |
863 | } |
864 | |
865 | -static DEVICE_ATTR(time, S_IRUSR | S_IWUSR, time_show, time_store); |
866 | +static DEVICE_ATTR_RW(time); |
867 | |
868 | static struct attribute *acpi_tad_time_attrs[] = { |
869 | &dev_attr_time.attr, |
870 | @@ -446,7 +446,7 @@ static ssize_t ac_alarm_show(struct device *dev, struct device_attribute *attr, |
871 | return acpi_tad_alarm_read(dev, buf, ACPI_TAD_AC_TIMER); |
872 | } |
873 | |
874 | -static DEVICE_ATTR(ac_alarm, S_IRUSR | S_IWUSR, ac_alarm_show, ac_alarm_store); |
875 | +static DEVICE_ATTR_RW(ac_alarm); |
876 | |
877 | static ssize_t ac_policy_store(struct device *dev, struct device_attribute *attr, |
878 | const char *buf, size_t count) |
879 | @@ -462,7 +462,7 @@ static ssize_t ac_policy_show(struct device *dev, struct device_attribute *attr, |
880 | return acpi_tad_policy_read(dev, buf, ACPI_TAD_AC_TIMER); |
881 | } |
882 | |
883 | -static DEVICE_ATTR(ac_policy, S_IRUSR | S_IWUSR, ac_policy_show, ac_policy_store); |
884 | +static DEVICE_ATTR_RW(ac_policy); |
885 | |
886 | static ssize_t ac_status_store(struct device *dev, struct device_attribute *attr, |
887 | const char *buf, size_t count) |
888 | @@ -478,7 +478,7 @@ static ssize_t ac_status_show(struct device *dev, struct device_attribute *attr, |
889 | return acpi_tad_status_read(dev, buf, ACPI_TAD_AC_TIMER); |
890 | } |
891 | |
892 | -static DEVICE_ATTR(ac_status, S_IRUSR | S_IWUSR, ac_status_show, ac_status_store); |
893 | +static DEVICE_ATTR_RW(ac_status); |
894 | |
895 | static struct attribute *acpi_tad_attrs[] = { |
896 | &dev_attr_caps.attr, |
897 | @@ -505,7 +505,7 @@ static ssize_t dc_alarm_show(struct device *dev, struct device_attribute *attr, |
898 | return acpi_tad_alarm_read(dev, buf, ACPI_TAD_DC_TIMER); |
899 | } |
900 | |
901 | -static DEVICE_ATTR(dc_alarm, S_IRUSR | S_IWUSR, dc_alarm_show, dc_alarm_store); |
902 | +static DEVICE_ATTR_RW(dc_alarm); |
903 | |
904 | static ssize_t dc_policy_store(struct device *dev, struct device_attribute *attr, |
905 | const char *buf, size_t count) |
906 | @@ -521,7 +521,7 @@ static ssize_t dc_policy_show(struct device *dev, struct device_attribute *attr, |
907 | return acpi_tad_policy_read(dev, buf, ACPI_TAD_DC_TIMER); |
908 | } |
909 | |
910 | -static DEVICE_ATTR(dc_policy, S_IRUSR | S_IWUSR, dc_policy_show, dc_policy_store); |
911 | +static DEVICE_ATTR_RW(dc_policy); |
912 | |
913 | static ssize_t dc_status_store(struct device *dev, struct device_attribute *attr, |
914 | const char *buf, size_t count) |
915 | @@ -537,7 +537,7 @@ static ssize_t dc_status_show(struct device *dev, struct device_attribute *attr, |
916 | return acpi_tad_status_read(dev, buf, ACPI_TAD_DC_TIMER); |
917 | } |
918 | |
919 | -static DEVICE_ATTR(dc_status, S_IRUSR | S_IWUSR, dc_status_show, dc_status_store); |
920 | +static DEVICE_ATTR_RW(dc_status); |
921 | |
922 | static struct attribute *acpi_tad_dc_attrs[] = { |
923 | &dev_attr_dc_alarm.attr, |
924 | diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c |
925 | index 663d85e0adba9..b7c408ce340c9 100644 |
926 | --- a/drivers/acpi/acpica/nsrepair2.c |
927 | +++ b/drivers/acpi/acpica/nsrepair2.c |
928 | @@ -375,6 +375,13 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, |
929 | |
930 | (*element_ptr)->common.reference_count = |
931 | original_ref_count; |
932 | + |
933 | + /* |
934 | + * The original_element holds a reference from the package object |
935 | + * that represents _HID. Since a new element was created by _HID, |
936 | + * remove the reference from the _CID package. |
937 | + */ |
938 | + acpi_ut_remove_reference(original_element); |
939 | } |
940 | |
941 | element_ptr++; |
942 | diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c |
943 | index 251f961c28cc4..e0d14017706ea 100644 |
944 | --- a/drivers/acpi/bgrt.c |
945 | +++ b/drivers/acpi/bgrt.c |
946 | @@ -15,40 +15,19 @@ |
947 | static void *bgrt_image; |
948 | static struct kobject *bgrt_kobj; |
949 | |
950 | -static ssize_t show_version(struct device *dev, |
951 | - struct device_attribute *attr, char *buf) |
952 | -{ |
953 | - return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version); |
954 | -} |
955 | -static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
956 | - |
957 | -static ssize_t show_status(struct device *dev, |
958 | - struct device_attribute *attr, char *buf) |
959 | -{ |
960 | - return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status); |
961 | -} |
962 | -static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); |
963 | - |
964 | -static ssize_t show_type(struct device *dev, |
965 | - struct device_attribute *attr, char *buf) |
966 | -{ |
967 | - return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type); |
968 | -} |
969 | -static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); |
970 | - |
971 | -static ssize_t show_xoffset(struct device *dev, |
972 | - struct device_attribute *attr, char *buf) |
973 | -{ |
974 | - return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x); |
975 | -} |
976 | -static DEVICE_ATTR(xoffset, S_IRUGO, show_xoffset, NULL); |
977 | - |
978 | -static ssize_t show_yoffset(struct device *dev, |
979 | - struct device_attribute *attr, char *buf) |
980 | -{ |
981 | - return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y); |
982 | -} |
983 | -static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL); |
984 | +#define BGRT_SHOW(_name, _member) \ |
985 | + static ssize_t _name##_show(struct kobject *kobj, \ |
986 | + struct kobj_attribute *attr, char *buf) \ |
987 | + { \ |
988 | + return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab._member); \ |
989 | + } \ |
990 | + struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name) |
991 | + |
992 | +BGRT_SHOW(version, version); |
993 | +BGRT_SHOW(status, status); |
994 | +BGRT_SHOW(type, image_type); |
995 | +BGRT_SHOW(xoffset, image_offset_x); |
996 | +BGRT_SHOW(yoffset, image_offset_y); |
997 | |
998 | static ssize_t image_read(struct file *file, struct kobject *kobj, |
999 | struct bin_attribute *attr, char *buf, loff_t off, size_t count) |
1000 | @@ -60,11 +39,11 @@ static ssize_t image_read(struct file *file, struct kobject *kobj, |
1001 | static BIN_ATTR_RO(image, 0); /* size gets filled in later */ |
1002 | |
1003 | static struct attribute *bgrt_attributes[] = { |
1004 | - &dev_attr_version.attr, |
1005 | - &dev_attr_status.attr, |
1006 | - &dev_attr_type.attr, |
1007 | - &dev_attr_xoffset.attr, |
1008 | - &dev_attr_yoffset.attr, |
1009 | + &bgrt_attr_version.attr, |
1010 | + &bgrt_attr_status.attr, |
1011 | + &bgrt_attr_type.attr, |
1012 | + &bgrt_attr_xoffset.attr, |
1013 | + &bgrt_attr_yoffset.attr, |
1014 | NULL, |
1015 | }; |
1016 | |
1017 | diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
1018 | index 54002670cb7a1..bbd9c93fc4c26 100644 |
1019 | --- a/drivers/acpi/bus.c |
1020 | +++ b/drivers/acpi/bus.c |
1021 | @@ -1240,6 +1240,7 @@ static int __init acpi_init(void) |
1022 | |
1023 | result = acpi_bus_init(); |
1024 | if (result) { |
1025 | + kobject_put(acpi_kobj); |
1026 | disable_acpi(); |
1027 | return result; |
1028 | } |
1029 | diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c |
1030 | index bfca116482b8b..fe8c7e79f4726 100644 |
1031 | --- a/drivers/acpi/device_sysfs.c |
1032 | +++ b/drivers/acpi/device_sysfs.c |
1033 | @@ -325,11 +325,11 @@ int acpi_device_modalias(struct device *dev, char *buf, int size) |
1034 | EXPORT_SYMBOL_GPL(acpi_device_modalias); |
1035 | |
1036 | static ssize_t |
1037 | -acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf) |
1038 | +modalias_show(struct device *dev, struct device_attribute *attr, char *buf) |
1039 | { |
1040 | return __acpi_device_modalias(to_acpi_device(dev), buf, 1024); |
1041 | } |
1042 | -static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); |
1043 | +static DEVICE_ATTR_RO(modalias); |
1044 | |
1045 | static ssize_t real_power_state_show(struct device *dev, |
1046 | struct device_attribute *attr, char *buf) |
1047 | @@ -358,8 +358,8 @@ static ssize_t power_state_show(struct device *dev, |
1048 | static DEVICE_ATTR_RO(power_state); |
1049 | |
1050 | static ssize_t |
1051 | -acpi_eject_store(struct device *d, struct device_attribute *attr, |
1052 | - const char *buf, size_t count) |
1053 | +eject_store(struct device *d, struct device_attribute *attr, |
1054 | + const char *buf, size_t count) |
1055 | { |
1056 | struct acpi_device *acpi_device = to_acpi_device(d); |
1057 | acpi_object_type not_used; |
1058 | @@ -387,28 +387,28 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, |
1059 | return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; |
1060 | } |
1061 | |
1062 | -static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); |
1063 | +static DEVICE_ATTR_WO(eject); |
1064 | |
1065 | static ssize_t |
1066 | -acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf) |
1067 | +hid_show(struct device *dev, struct device_attribute *attr, char *buf) |
1068 | { |
1069 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
1070 | |
1071 | return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev)); |
1072 | } |
1073 | -static DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL); |
1074 | +static DEVICE_ATTR_RO(hid); |
1075 | |
1076 | -static ssize_t acpi_device_uid_show(struct device *dev, |
1077 | - struct device_attribute *attr, char *buf) |
1078 | +static ssize_t uid_show(struct device *dev, |
1079 | + struct device_attribute *attr, char *buf) |
1080 | { |
1081 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
1082 | |
1083 | return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id); |
1084 | } |
1085 | -static DEVICE_ATTR(uid, 0444, acpi_device_uid_show, NULL); |
1086 | +static DEVICE_ATTR_RO(uid); |
1087 | |
1088 | -static ssize_t acpi_device_adr_show(struct device *dev, |
1089 | - struct device_attribute *attr, char *buf) |
1090 | +static ssize_t adr_show(struct device *dev, |
1091 | + struct device_attribute *attr, char *buf) |
1092 | { |
1093 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
1094 | |
1095 | @@ -417,16 +417,16 @@ static ssize_t acpi_device_adr_show(struct device *dev, |
1096 | else |
1097 | return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address); |
1098 | } |
1099 | -static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL); |
1100 | +static DEVICE_ATTR_RO(adr); |
1101 | |
1102 | -static ssize_t acpi_device_path_show(struct device *dev, |
1103 | - struct device_attribute *attr, char *buf) |
1104 | +static ssize_t path_show(struct device *dev, |
1105 | + struct device_attribute *attr, char *buf) |
1106 | { |
1107 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
1108 | |
1109 | return acpi_object_path(acpi_dev->handle, buf); |
1110 | } |
1111 | -static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); |
1112 | +static DEVICE_ATTR_RO(path); |
1113 | |
1114 | /* sysfs file that shows description text from the ACPI _STR method */ |
1115 | static ssize_t description_show(struct device *dev, |
1116 | @@ -446,7 +446,7 @@ static ssize_t description_show(struct device *dev, |
1117 | (wchar_t *)acpi_dev->pnp.str_obj->buffer.pointer, |
1118 | acpi_dev->pnp.str_obj->buffer.length, |
1119 | UTF16_LITTLE_ENDIAN, buf, |
1120 | - PAGE_SIZE); |
1121 | + PAGE_SIZE - 1); |
1122 | |
1123 | buf[result++] = '\n'; |
1124 | |
1125 | @@ -455,8 +455,8 @@ static ssize_t description_show(struct device *dev, |
1126 | static DEVICE_ATTR_RO(description); |
1127 | |
1128 | static ssize_t |
1129 | -acpi_device_sun_show(struct device *dev, struct device_attribute *attr, |
1130 | - char *buf) { |
1131 | +sun_show(struct device *dev, struct device_attribute *attr, |
1132 | + char *buf) { |
1133 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
1134 | acpi_status status; |
1135 | unsigned long long sun; |
1136 | @@ -467,11 +467,11 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr, |
1137 | |
1138 | return sprintf(buf, "%llu\n", sun); |
1139 | } |
1140 | -static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); |
1141 | +static DEVICE_ATTR_RO(sun); |
1142 | |
1143 | static ssize_t |
1144 | -acpi_device_hrv_show(struct device *dev, struct device_attribute *attr, |
1145 | - char *buf) { |
1146 | +hrv_show(struct device *dev, struct device_attribute *attr, |
1147 | + char *buf) { |
1148 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
1149 | acpi_status status; |
1150 | unsigned long long hrv; |
1151 | @@ -482,7 +482,7 @@ acpi_device_hrv_show(struct device *dev, struct device_attribute *attr, |
1152 | |
1153 | return sprintf(buf, "%llu\n", hrv); |
1154 | } |
1155 | -static DEVICE_ATTR(hrv, 0444, acpi_device_hrv_show, NULL); |
1156 | +static DEVICE_ATTR_RO(hrv); |
1157 | |
1158 | static ssize_t status_show(struct device *dev, struct device_attribute *attr, |
1159 | char *buf) { |
1160 | diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c |
1161 | index e3414131bfcab..9bb42a772bee3 100644 |
1162 | --- a/drivers/acpi/dock.c |
1163 | +++ b/drivers/acpi/dock.c |
1164 | @@ -485,7 +485,7 @@ int dock_notify(struct acpi_device *adev, u32 event) |
1165 | /* |
1166 | * show_docked - read method for "docked" file in sysfs |
1167 | */ |
1168 | -static ssize_t show_docked(struct device *dev, |
1169 | +static ssize_t docked_show(struct device *dev, |
1170 | struct device_attribute *attr, char *buf) |
1171 | { |
1172 | struct dock_station *dock_station = dev->platform_data; |
1173 | @@ -494,25 +494,25 @@ static ssize_t show_docked(struct device *dev, |
1174 | acpi_bus_get_device(dock_station->handle, &adev); |
1175 | return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); |
1176 | } |
1177 | -static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); |
1178 | +static DEVICE_ATTR_RO(docked); |
1179 | |
1180 | /* |
1181 | * show_flags - read method for flags file in sysfs |
1182 | */ |
1183 | -static ssize_t show_flags(struct device *dev, |
1184 | +static ssize_t flags_show(struct device *dev, |
1185 | struct device_attribute *attr, char *buf) |
1186 | { |
1187 | struct dock_station *dock_station = dev->platform_data; |
1188 | return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags); |
1189 | |
1190 | } |
1191 | -static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL); |
1192 | +static DEVICE_ATTR_RO(flags); |
1193 | |
1194 | /* |
1195 | * write_undock - write method for "undock" file in sysfs |
1196 | */ |
1197 | -static ssize_t write_undock(struct device *dev, struct device_attribute *attr, |
1198 | - const char *buf, size_t count) |
1199 | +static ssize_t undock_store(struct device *dev, struct device_attribute *attr, |
1200 | + const char *buf, size_t count) |
1201 | { |
1202 | int ret; |
1203 | struct dock_station *dock_station = dev->platform_data; |
1204 | @@ -526,13 +526,13 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr, |
1205 | acpi_scan_lock_release(); |
1206 | return ret ? ret: count; |
1207 | } |
1208 | -static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); |
1209 | +static DEVICE_ATTR_WO(undock); |
1210 | |
1211 | /* |
1212 | * show_dock_uid - read method for "uid" file in sysfs |
1213 | */ |
1214 | -static ssize_t show_dock_uid(struct device *dev, |
1215 | - struct device_attribute *attr, char *buf) |
1216 | +static ssize_t uid_show(struct device *dev, |
1217 | + struct device_attribute *attr, char *buf) |
1218 | { |
1219 | unsigned long long lbuf; |
1220 | struct dock_station *dock_station = dev->platform_data; |
1221 | @@ -543,10 +543,10 @@ static ssize_t show_dock_uid(struct device *dev, |
1222 | |
1223 | return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf); |
1224 | } |
1225 | -static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL); |
1226 | +static DEVICE_ATTR_RO(uid); |
1227 | |
1228 | -static ssize_t show_dock_type(struct device *dev, |
1229 | - struct device_attribute *attr, char *buf) |
1230 | +static ssize_t type_show(struct device *dev, |
1231 | + struct device_attribute *attr, char *buf) |
1232 | { |
1233 | struct dock_station *dock_station = dev->platform_data; |
1234 | char *type; |
1235 | @@ -562,7 +562,7 @@ static ssize_t show_dock_type(struct device *dev, |
1236 | |
1237 | return snprintf(buf, PAGE_SIZE, "%s\n", type); |
1238 | } |
1239 | -static DEVICE_ATTR(type, S_IRUGO, show_dock_type, NULL); |
1240 | +static DEVICE_ATTR_RO(type); |
1241 | |
1242 | static struct attribute *dock_attributes[] = { |
1243 | &dev_attr_docked.attr, |
1244 | diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
1245 | index c64001e789ed7..258a8df235cfb 100644 |
1246 | --- a/drivers/acpi/ec.c |
1247 | +++ b/drivers/acpi/ec.c |
1248 | @@ -1826,6 +1826,22 @@ static const struct dmi_system_id ec_dmi_table[] __initconst = { |
1249 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
1250 | DMI_MATCH(DMI_PRODUCT_NAME, "GL702VMK"),}, NULL}, |
1251 | { |
1252 | + ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BA", { |
1253 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
1254 | + DMI_MATCH(DMI_PRODUCT_NAME, "X505BA"),}, NULL}, |
1255 | + { |
1256 | + ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BP", { |
1257 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
1258 | + DMI_MATCH(DMI_PRODUCT_NAME, "X505BP"),}, NULL}, |
1259 | + { |
1260 | + ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BA", { |
1261 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
1262 | + DMI_MATCH(DMI_PRODUCT_NAME, "X542BA"),}, NULL}, |
1263 | + { |
1264 | + ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BP", { |
1265 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
1266 | + DMI_MATCH(DMI_PRODUCT_NAME, "X542BP"),}, NULL}, |
1267 | + { |
1268 | ec_honor_ecdt_gpe, "ASUS X550VXK", { |
1269 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
1270 | DMI_MATCH(DMI_PRODUCT_NAME, "X550VXK"),}, NULL}, |
1271 | diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c |
1272 | index fe1e7bc91a5ea..3261cffdd5e05 100644 |
1273 | --- a/drivers/acpi/power.c |
1274 | +++ b/drivers/acpi/power.c |
1275 | @@ -888,15 +888,16 @@ static void acpi_release_power_resource(struct device *dev) |
1276 | kfree(resource); |
1277 | } |
1278 | |
1279 | -static ssize_t acpi_power_in_use_show(struct device *dev, |
1280 | - struct device_attribute *attr, |
1281 | - char *buf) { |
1282 | +static ssize_t resource_in_use_show(struct device *dev, |
1283 | + struct device_attribute *attr, |
1284 | + char *buf) |
1285 | +{ |
1286 | struct acpi_power_resource *resource; |
1287 | |
1288 | resource = to_power_resource(to_acpi_device(dev)); |
1289 | return sprintf(buf, "%u\n", !!resource->ref_count); |
1290 | } |
1291 | -static DEVICE_ATTR(resource_in_use, 0444, acpi_power_in_use_show, NULL); |
1292 | +static DEVICE_ATTR_RO(resource_in_use); |
1293 | |
1294 | static void acpi_power_sysfs_remove(struct acpi_device *device) |
1295 | { |
1296 | diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c |
1297 | index ed56c6d20b084..53ae679c00f01 100644 |
1298 | --- a/drivers/acpi/processor_idle.c |
1299 | +++ b/drivers/acpi/processor_idle.c |
1300 | @@ -16,6 +16,7 @@ |
1301 | #include <linux/acpi.h> |
1302 | #include <linux/dmi.h> |
1303 | #include <linux/sched.h> /* need_resched() */ |
1304 | +#include <linux/sort.h> |
1305 | #include <linux/tick.h> |
1306 | #include <linux/cpuidle.h> |
1307 | #include <linux/cpu.h> |
1308 | @@ -540,10 +541,37 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, |
1309 | return; |
1310 | } |
1311 | |
1312 | +static int acpi_cst_latency_cmp(const void *a, const void *b) |
1313 | +{ |
1314 | + const struct acpi_processor_cx *x = a, *y = b; |
1315 | + |
1316 | + if (!(x->valid && y->valid)) |
1317 | + return 0; |
1318 | + if (x->latency > y->latency) |
1319 | + return 1; |
1320 | + if (x->latency < y->latency) |
1321 | + return -1; |
1322 | + return 0; |
1323 | +} |
1324 | +static void acpi_cst_latency_swap(void *a, void *b, int n) |
1325 | +{ |
1326 | + struct acpi_processor_cx *x = a, *y = b; |
1327 | + u32 tmp; |
1328 | + |
1329 | + if (!(x->valid && y->valid)) |
1330 | + return; |
1331 | + tmp = x->latency; |
1332 | + x->latency = y->latency; |
1333 | + y->latency = tmp; |
1334 | +} |
1335 | + |
1336 | static int acpi_processor_power_verify(struct acpi_processor *pr) |
1337 | { |
1338 | unsigned int i; |
1339 | unsigned int working = 0; |
1340 | + unsigned int last_latency = 0; |
1341 | + unsigned int last_type = 0; |
1342 | + bool buggy_latency = false; |
1343 | |
1344 | pr->power.timer_broadcast_on_state = INT_MAX; |
1345 | |
1346 | @@ -567,12 +595,24 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) |
1347 | } |
1348 | if (!cx->valid) |
1349 | continue; |
1350 | + if (cx->type >= last_type && cx->latency < last_latency) |
1351 | + buggy_latency = true; |
1352 | + last_latency = cx->latency; |
1353 | + last_type = cx->type; |
1354 | |
1355 | lapic_timer_check_state(i, pr, cx); |
1356 | tsc_check_state(cx->type); |
1357 | working++; |
1358 | } |
1359 | |
1360 | + if (buggy_latency) { |
1361 | + pr_notice("FW issue: working around C-state latencies out of order\n"); |
1362 | + sort(&pr->power.states[1], max_cstate, |
1363 | + sizeof(struct acpi_processor_cx), |
1364 | + acpi_cst_latency_cmp, |
1365 | + acpi_cst_latency_swap); |
1366 | + } |
1367 | + |
1368 | lapic_timer_propagate_broadcast(pr); |
1369 | |
1370 | return (working); |
1371 | diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c |
1372 | index 48ca9a844f06b..55c57b703ea3c 100644 |
1373 | --- a/drivers/acpi/resource.c |
1374 | +++ b/drivers/acpi/resource.c |
1375 | @@ -430,6 +430,13 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, |
1376 | } |
1377 | } |
1378 | |
1379 | +static bool irq_is_legacy(struct acpi_resource_irq *irq) |
1380 | +{ |
1381 | + return irq->triggering == ACPI_EDGE_SENSITIVE && |
1382 | + irq->polarity == ACPI_ACTIVE_HIGH && |
1383 | + irq->shareable == ACPI_EXCLUSIVE; |
1384 | +} |
1385 | + |
1386 | /** |
1387 | * acpi_dev_resource_interrupt - Extract ACPI interrupt resource information. |
1388 | * @ares: Input ACPI resource object. |
1389 | @@ -468,7 +475,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, |
1390 | } |
1391 | acpi_dev_get_irqresource(res, irq->interrupts[index], |
1392 | irq->triggering, irq->polarity, |
1393 | - irq->shareable, true); |
1394 | + irq->shareable, irq_is_legacy(irq)); |
1395 | break; |
1396 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
1397 | ext_irq = &ares->data.extended_irq; |
1398 | diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c |
1399 | index badab67088935..46208ececbb6a 100644 |
1400 | --- a/drivers/ata/pata_ep93xx.c |
1401 | +++ b/drivers/ata/pata_ep93xx.c |
1402 | @@ -928,7 +928,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev) |
1403 | /* INT[3] (IRQ_EP93XX_EXT3) line connected as pull down */ |
1404 | irq = platform_get_irq(pdev, 0); |
1405 | if (irq < 0) { |
1406 | - err = -ENXIO; |
1407 | + err = irq; |
1408 | goto err_rel_gpio; |
1409 | } |
1410 | |
1411 | diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c |
1412 | index d3d851b014a37..ac3b1fda820ff 100644 |
1413 | --- a/drivers/ata/pata_octeon_cf.c |
1414 | +++ b/drivers/ata/pata_octeon_cf.c |
1415 | @@ -898,10 +898,11 @@ static int octeon_cf_probe(struct platform_device *pdev) |
1416 | return -EINVAL; |
1417 | } |
1418 | |
1419 | - irq_handler = octeon_cf_interrupt; |
1420 | i = platform_get_irq(dma_dev, 0); |
1421 | - if (i > 0) |
1422 | + if (i > 0) { |
1423 | irq = i; |
1424 | + irq_handler = octeon_cf_interrupt; |
1425 | + } |
1426 | } |
1427 | of_node_put(dma_node); |
1428 | } |
1429 | diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c |
1430 | index deae466395de1..1e6d61dc966ad 100644 |
1431 | --- a/drivers/ata/pata_rb532_cf.c |
1432 | +++ b/drivers/ata/pata_rb532_cf.c |
1433 | @@ -115,10 +115,12 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) |
1434 | } |
1435 | |
1436 | irq = platform_get_irq(pdev, 0); |
1437 | - if (irq <= 0) { |
1438 | + if (irq < 0) { |
1439 | dev_err(&pdev->dev, "no IRQ resource found\n"); |
1440 | - return -ENOENT; |
1441 | + return irq; |
1442 | } |
1443 | + if (!irq) |
1444 | + return -EINVAL; |
1445 | |
1446 | gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_IN); |
1447 | if (IS_ERR(gpiod)) { |
1448 | diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c |
1449 | index ad3893c62572d..bcf705f512f0f 100644 |
1450 | --- a/drivers/ata/sata_highbank.c |
1451 | +++ b/drivers/ata/sata_highbank.c |
1452 | @@ -469,10 +469,12 @@ static int ahci_highbank_probe(struct platform_device *pdev) |
1453 | } |
1454 | |
1455 | irq = platform_get_irq(pdev, 0); |
1456 | - if (irq <= 0) { |
1457 | + if (irq < 0) { |
1458 | dev_err(dev, "no irq\n"); |
1459 | - return -EINVAL; |
1460 | + return irq; |
1461 | } |
1462 | + if (!irq) |
1463 | + return -EINVAL; |
1464 | |
1465 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); |
1466 | if (!hpriv) { |
1467 | diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c |
1468 | index b4b52ab23b6b1..b4e931dbff664 100644 |
1469 | --- a/drivers/char/hw_random/exynos-trng.c |
1470 | +++ b/drivers/char/hw_random/exynos-trng.c |
1471 | @@ -134,7 +134,7 @@ static int exynos_trng_probe(struct platform_device *pdev) |
1472 | return PTR_ERR(trng->mem); |
1473 | |
1474 | pm_runtime_enable(&pdev->dev); |
1475 | - ret = pm_runtime_get_sync(&pdev->dev); |
1476 | + ret = pm_runtime_resume_and_get(&pdev->dev); |
1477 | if (ret < 0) { |
1478 | dev_err(&pdev->dev, "Could not get runtime PM.\n"); |
1479 | goto err_pm_get; |
1480 | @@ -167,7 +167,7 @@ err_register: |
1481 | clk_disable_unprepare(trng->clk); |
1482 | |
1483 | err_clock: |
1484 | - pm_runtime_put_sync(&pdev->dev); |
1485 | + pm_runtime_put_noidle(&pdev->dev); |
1486 | |
1487 | err_pm_get: |
1488 | pm_runtime_disable(&pdev->dev); |
1489 | diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c |
1490 | index 15bf585af5d38..44117169db919 100644 |
1491 | --- a/drivers/char/pcmcia/cm4000_cs.c |
1492 | +++ b/drivers/char/pcmcia/cm4000_cs.c |
1493 | @@ -544,6 +544,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) |
1494 | io_read_num_rec_bytes(iobase, &num_bytes_read); |
1495 | if (num_bytes_read >= 4) { |
1496 | DEBUGP(2, dev, "NumRecBytes = %i\n", num_bytes_read); |
1497 | + if (num_bytes_read > 4) { |
1498 | + rc = -EIO; |
1499 | + goto exit_setprotocol; |
1500 | + } |
1501 | break; |
1502 | } |
1503 | usleep_range(10000, 11000); |
1504 | diff --git a/drivers/clk/actions/owl-s500.c b/drivers/clk/actions/owl-s500.c |
1505 | index 0eb83a0b70bcc..0528536ed9eb7 100644 |
1506 | --- a/drivers/clk/actions/owl-s500.c |
1507 | +++ b/drivers/clk/actions/owl-s500.c |
1508 | @@ -125,8 +125,7 @@ static struct clk_factor_table sd_factor_table[] = { |
1509 | { 12, 1, 13 }, { 13, 1, 14 }, { 14, 1, 15 }, { 15, 1, 16 }, |
1510 | { 16, 1, 17 }, { 17, 1, 18 }, { 18, 1, 19 }, { 19, 1, 20 }, |
1511 | { 20, 1, 21 }, { 21, 1, 22 }, { 22, 1, 23 }, { 23, 1, 24 }, |
1512 | - { 24, 1, 25 }, { 25, 1, 26 }, { 26, 1, 27 }, { 27, 1, 28 }, |
1513 | - { 28, 1, 29 }, { 29, 1, 30 }, { 30, 1, 31 }, { 31, 1, 32 }, |
1514 | + { 24, 1, 25 }, |
1515 | |
1516 | /* bit8: /128 */ |
1517 | { 256, 1, 1 * 128 }, { 257, 1, 2 * 128 }, { 258, 1, 3 * 128 }, { 259, 1, 4 * 128 }, |
1518 | @@ -135,14 +134,20 @@ static struct clk_factor_table sd_factor_table[] = { |
1519 | { 268, 1, 13 * 128 }, { 269, 1, 14 * 128 }, { 270, 1, 15 * 128 }, { 271, 1, 16 * 128 }, |
1520 | { 272, 1, 17 * 128 }, { 273, 1, 18 * 128 }, { 274, 1, 19 * 128 }, { 275, 1, 20 * 128 }, |
1521 | { 276, 1, 21 * 128 }, { 277, 1, 22 * 128 }, { 278, 1, 23 * 128 }, { 279, 1, 24 * 128 }, |
1522 | - { 280, 1, 25 * 128 }, { 281, 1, 26 * 128 }, { 282, 1, 27 * 128 }, { 283, 1, 28 * 128 }, |
1523 | - { 284, 1, 29 * 128 }, { 285, 1, 30 * 128 }, { 286, 1, 31 * 128 }, { 287, 1, 32 * 128 }, |
1524 | + { 280, 1, 25 * 128 }, |
1525 | { 0, 0, 0 }, |
1526 | }; |
1527 | |
1528 | -static struct clk_factor_table bisp_factor_table[] = { |
1529 | - { 0, 1, 1 }, { 1, 1, 2 }, { 2, 1, 3 }, { 3, 1, 4 }, |
1530 | - { 4, 1, 5 }, { 5, 1, 6 }, { 6, 1, 7 }, { 7, 1, 8 }, |
1531 | +static struct clk_factor_table de_factor_table[] = { |
1532 | + { 0, 1, 1 }, { 1, 2, 3 }, { 2, 1, 2 }, { 3, 2, 5 }, |
1533 | + { 4, 1, 3 }, { 5, 1, 4 }, { 6, 1, 6 }, { 7, 1, 8 }, |
1534 | + { 8, 1, 12 }, |
1535 | + { 0, 0, 0 }, |
1536 | +}; |
1537 | + |
1538 | +static struct clk_factor_table hde_factor_table[] = { |
1539 | + { 0, 1, 1 }, { 1, 2, 3 }, { 2, 1, 2 }, { 3, 2, 5 }, |
1540 | + { 4, 1, 3 }, { 5, 1, 4 }, { 6, 1, 6 }, { 7, 1, 8 }, |
1541 | { 0, 0, 0 }, |
1542 | }; |
1543 | |
1544 | @@ -156,6 +161,13 @@ static struct clk_div_table rmii_ref_div_table[] = { |
1545 | { 0, 0 }, |
1546 | }; |
1547 | |
1548 | +static struct clk_div_table std12rate_div_table[] = { |
1549 | + { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 4 }, |
1550 | + { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 8 }, |
1551 | + { 8, 9 }, { 9, 10 }, { 10, 11 }, { 11, 12 }, |
1552 | + { 0, 0 }, |
1553 | +}; |
1554 | + |
1555 | static struct clk_div_table i2s_div_table[] = { |
1556 | { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 4 }, |
1557 | { 4, 6 }, { 5, 8 }, { 6, 12 }, { 7, 16 }, |
1558 | @@ -188,39 +200,39 @@ static OWL_DIVIDER(rmii_ref_clk, "rmii_ref_clk", "ethernet_pll_clk", CMU_ETHERNE |
1559 | |
1560 | /* factor clocks */ |
1561 | static OWL_FACTOR(ahb_clk, "ahb_clk", "h_clk", CMU_BUSCLK1, 2, 2, ahb_factor_table, 0, 0); |
1562 | -static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 3, bisp_factor_table, 0, 0); |
1563 | -static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 3, bisp_factor_table, 0, 0); |
1564 | +static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 4, de_factor_table, 0, 0); |
1565 | +static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 4, de_factor_table, 0, 0); |
1566 | |
1567 | /* composite clocks */ |
1568 | static OWL_COMP_FACTOR(vce_clk, "vce_clk", hde_clk_mux_p, |
1569 | OWL_MUX_HW(CMU_VCECLK, 4, 2), |
1570 | OWL_GATE_HW(CMU_DEVCLKEN0, 26, 0), |
1571 | - OWL_FACTOR_HW(CMU_VCECLK, 0, 3, 0, bisp_factor_table), |
1572 | + OWL_FACTOR_HW(CMU_VCECLK, 0, 3, 0, hde_factor_table), |
1573 | 0); |
1574 | |
1575 | static OWL_COMP_FACTOR(vde_clk, "vde_clk", hde_clk_mux_p, |
1576 | OWL_MUX_HW(CMU_VDECLK, 4, 2), |
1577 | OWL_GATE_HW(CMU_DEVCLKEN0, 25, 0), |
1578 | - OWL_FACTOR_HW(CMU_VDECLK, 0, 3, 0, bisp_factor_table), |
1579 | + OWL_FACTOR_HW(CMU_VDECLK, 0, 3, 0, hde_factor_table), |
1580 | 0); |
1581 | |
1582 | -static OWL_COMP_FACTOR(bisp_clk, "bisp_clk", bisp_clk_mux_p, |
1583 | +static OWL_COMP_DIV(bisp_clk, "bisp_clk", bisp_clk_mux_p, |
1584 | OWL_MUX_HW(CMU_BISPCLK, 4, 1), |
1585 | OWL_GATE_HW(CMU_DEVCLKEN0, 14, 0), |
1586 | - OWL_FACTOR_HW(CMU_BISPCLK, 0, 3, 0, bisp_factor_table), |
1587 | + OWL_DIVIDER_HW(CMU_BISPCLK, 0, 4, 0, std12rate_div_table), |
1588 | 0); |
1589 | |
1590 | -static OWL_COMP_FACTOR(sensor0_clk, "sensor0_clk", sensor_clk_mux_p, |
1591 | +static OWL_COMP_DIV(sensor0_clk, "sensor0_clk", sensor_clk_mux_p, |
1592 | OWL_MUX_HW(CMU_SENSORCLK, 4, 1), |
1593 | OWL_GATE_HW(CMU_DEVCLKEN0, 14, 0), |
1594 | - OWL_FACTOR_HW(CMU_SENSORCLK, 0, 3, 0, bisp_factor_table), |
1595 | - CLK_IGNORE_UNUSED); |
1596 | + OWL_DIVIDER_HW(CMU_SENSORCLK, 0, 4, 0, std12rate_div_table), |
1597 | + 0); |
1598 | |
1599 | -static OWL_COMP_FACTOR(sensor1_clk, "sensor1_clk", sensor_clk_mux_p, |
1600 | +static OWL_COMP_DIV(sensor1_clk, "sensor1_clk", sensor_clk_mux_p, |
1601 | OWL_MUX_HW(CMU_SENSORCLK, 4, 1), |
1602 | OWL_GATE_HW(CMU_DEVCLKEN0, 14, 0), |
1603 | - OWL_FACTOR_HW(CMU_SENSORCLK, 8, 3, 0, bisp_factor_table), |
1604 | - CLK_IGNORE_UNUSED); |
1605 | + OWL_DIVIDER_HW(CMU_SENSORCLK, 8, 4, 0, std12rate_div_table), |
1606 | + 0); |
1607 | |
1608 | static OWL_COMP_FACTOR(sd0_clk, "sd0_clk", sd_clk_mux_p, |
1609 | OWL_MUX_HW(CMU_SD0CLK, 9, 1), |
1610 | @@ -300,7 +312,7 @@ static OWL_COMP_FIXED_FACTOR(i2c3_clk, "i2c3_clk", "ethernet_pll_clk", |
1611 | static OWL_COMP_DIV(uart0_clk, "uart0_clk", uart_clk_mux_p, |
1612 | OWL_MUX_HW(CMU_UART0CLK, 16, 1), |
1613 | OWL_GATE_HW(CMU_DEVCLKEN1, 6, 0), |
1614 | - OWL_DIVIDER_HW(CMU_UART1CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1615 | + OWL_DIVIDER_HW(CMU_UART0CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1616 | CLK_IGNORE_UNUSED); |
1617 | |
1618 | static OWL_COMP_DIV(uart1_clk, "uart1_clk", uart_clk_mux_p, |
1619 | @@ -312,31 +324,31 @@ static OWL_COMP_DIV(uart1_clk, "uart1_clk", uart_clk_mux_p, |
1620 | static OWL_COMP_DIV(uart2_clk, "uart2_clk", uart_clk_mux_p, |
1621 | OWL_MUX_HW(CMU_UART2CLK, 16, 1), |
1622 | OWL_GATE_HW(CMU_DEVCLKEN1, 8, 0), |
1623 | - OWL_DIVIDER_HW(CMU_UART1CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1624 | + OWL_DIVIDER_HW(CMU_UART2CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1625 | CLK_IGNORE_UNUSED); |
1626 | |
1627 | static OWL_COMP_DIV(uart3_clk, "uart3_clk", uart_clk_mux_p, |
1628 | OWL_MUX_HW(CMU_UART3CLK, 16, 1), |
1629 | OWL_GATE_HW(CMU_DEVCLKEN1, 19, 0), |
1630 | - OWL_DIVIDER_HW(CMU_UART1CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1631 | + OWL_DIVIDER_HW(CMU_UART3CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1632 | CLK_IGNORE_UNUSED); |
1633 | |
1634 | static OWL_COMP_DIV(uart4_clk, "uart4_clk", uart_clk_mux_p, |
1635 | OWL_MUX_HW(CMU_UART4CLK, 16, 1), |
1636 | OWL_GATE_HW(CMU_DEVCLKEN1, 20, 0), |
1637 | - OWL_DIVIDER_HW(CMU_UART1CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1638 | + OWL_DIVIDER_HW(CMU_UART4CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1639 | CLK_IGNORE_UNUSED); |
1640 | |
1641 | static OWL_COMP_DIV(uart5_clk, "uart5_clk", uart_clk_mux_p, |
1642 | OWL_MUX_HW(CMU_UART5CLK, 16, 1), |
1643 | OWL_GATE_HW(CMU_DEVCLKEN1, 21, 0), |
1644 | - OWL_DIVIDER_HW(CMU_UART1CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1645 | + OWL_DIVIDER_HW(CMU_UART5CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1646 | CLK_IGNORE_UNUSED); |
1647 | |
1648 | static OWL_COMP_DIV(uart6_clk, "uart6_clk", uart_clk_mux_p, |
1649 | OWL_MUX_HW(CMU_UART6CLK, 16, 1), |
1650 | OWL_GATE_HW(CMU_DEVCLKEN1, 18, 0), |
1651 | - OWL_DIVIDER_HW(CMU_UART1CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1652 | + OWL_DIVIDER_HW(CMU_UART6CLK, 0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL), |
1653 | CLK_IGNORE_UNUSED); |
1654 | |
1655 | static OWL_COMP_DIV(i2srx_clk, "i2srx_clk", i2s_clk_mux_p, |
1656 | diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c |
1657 | index 6e780c2a9e6ba..8f9f3d4a54fd2 100644 |
1658 | --- a/drivers/clk/clk-si5341.c |
1659 | +++ b/drivers/clk/clk-si5341.c |
1660 | @@ -304,6 +304,8 @@ static const struct si5341_reg_default si5341_reg_defaults[] = { |
1661 | { 0x094A, 0x00 }, /* INx_TO_PFD_EN (disabled) */ |
1662 | { 0x0A02, 0x00 }, /* Not in datasheet */ |
1663 | { 0x0B44, 0x0F }, /* PDIV_ENB (datasheet does not mention what it is) */ |
1664 | + { 0x0B57, 0x10 }, /* VCO_RESET_CALCODE (not described in datasheet) */ |
1665 | + { 0x0B58, 0x05 }, /* VCO_RESET_CALCODE (not described in datasheet) */ |
1666 | }; |
1667 | |
1668 | /* Read and interpret a 44-bit followed by a 32-bit value in the regmap */ |
1669 | @@ -482,6 +484,9 @@ static unsigned long si5341_synth_clk_recalc_rate(struct clk_hw *hw, |
1670 | SI5341_SYNTH_N_NUM(synth->index), &n_num, &n_den); |
1671 | if (err < 0) |
1672 | return err; |
1673 | + /* Check for bogus/uninitialized settings */ |
1674 | + if (!n_num || !n_den) |
1675 | + return 0; |
1676 | |
1677 | /* |
1678 | * n_num and n_den are shifted left as much as possible, so to prevent |
1679 | @@ -665,6 +670,9 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, |
1680 | { |
1681 | unsigned long r; |
1682 | |
1683 | + if (!rate) |
1684 | + return 0; |
1685 | + |
1686 | r = *parent_rate >> 1; |
1687 | |
1688 | /* If rate is an even divisor, no changes to parent required */ |
1689 | @@ -693,11 +701,16 @@ static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
1690 | unsigned long parent_rate) |
1691 | { |
1692 | struct clk_si5341_output *output = to_clk_si5341_output(hw); |
1693 | - /* Frequency divider is (r_div + 1) * 2 */ |
1694 | - u32 r_div = (parent_rate / rate) >> 1; |
1695 | + u32 r_div; |
1696 | int err; |
1697 | u8 r[3]; |
1698 | |
1699 | + if (!rate) |
1700 | + return -EINVAL; |
1701 | + |
1702 | + /* Frequency divider is (r_div + 1) * 2 */ |
1703 | + r_div = (parent_rate / rate) >> 1; |
1704 | + |
1705 | if (r_div <= 1) |
1706 | r_div = 0; |
1707 | else if (r_div >= BIT(24)) |
1708 | @@ -924,7 +937,7 @@ static const struct si5341_reg_default si5341_preamble[] = { |
1709 | { 0x0B25, 0x00 }, |
1710 | { 0x0502, 0x01 }, |
1711 | { 0x0505, 0x03 }, |
1712 | - { 0x0957, 0x1F }, |
1713 | + { 0x0957, 0x17 }, |
1714 | { 0x0B4E, 0x1A }, |
1715 | }; |
1716 | |
1717 | diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c |
1718 | index 3143e16065de6..a55b22ebf103c 100644 |
1719 | --- a/drivers/clk/meson/g12a.c |
1720 | +++ b/drivers/clk/meson/g12a.c |
1721 | @@ -1602,7 +1602,7 @@ static struct clk_regmap g12b_cpub_clk_trace = { |
1722 | }; |
1723 | |
1724 | static const struct pll_mult_range g12a_gp0_pll_mult_range = { |
1725 | - .min = 55, |
1726 | + .min = 125, |
1727 | .max = 255, |
1728 | }; |
1729 | |
1730 | diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
1731 | index 194a6587a1de1..c4e928375c40d 100644 |
1732 | --- a/drivers/cpufreq/cpufreq.c |
1733 | +++ b/drivers/cpufreq/cpufreq.c |
1734 | @@ -1361,9 +1361,14 @@ static int cpufreq_online(unsigned int cpu) |
1735 | goto out_free_policy; |
1736 | } |
1737 | |
1738 | + /* |
1739 | + * The initialization has succeeded and the policy is online. |
1740 | + * If there is a problem with its frequency table, take it |
1741 | + * offline and drop it. |
1742 | + */ |
1743 | ret = cpufreq_table_validate_and_sort(policy); |
1744 | if (ret) |
1745 | - goto out_exit_policy; |
1746 | + goto out_offline_policy; |
1747 | |
1748 | /* related_cpus should at least include policy->cpus. */ |
1749 | cpumask_copy(policy->related_cpus, policy->cpus); |
1750 | @@ -1507,6 +1512,10 @@ out_destroy_policy: |
1751 | |
1752 | up_write(&policy->rwsem); |
1753 | |
1754 | +out_offline_policy: |
1755 | + if (cpufreq_driver->offline) |
1756 | + cpufreq_driver->offline(policy); |
1757 | + |
1758 | out_exit_policy: |
1759 | if (cpufreq_driver->exit) |
1760 | cpufreq_driver->exit(policy); |
1761 | diff --git a/drivers/crypto/cavium/nitrox/nitrox_isr.c b/drivers/crypto/cavium/nitrox/nitrox_isr.c |
1762 | index 3dec570a190ad..10e3408bf704c 100644 |
1763 | --- a/drivers/crypto/cavium/nitrox/nitrox_isr.c |
1764 | +++ b/drivers/crypto/cavium/nitrox/nitrox_isr.c |
1765 | @@ -306,6 +306,10 @@ int nitrox_register_interrupts(struct nitrox_device *ndev) |
1766 | * Entry 192: NPS_CORE_INT_ACTIVE |
1767 | */ |
1768 | nr_vecs = pci_msix_vec_count(pdev); |
1769 | + if (nr_vecs < 0) { |
1770 | + dev_err(DEV(ndev), "Error in getting vec count %d\n", nr_vecs); |
1771 | + return nr_vecs; |
1772 | + } |
1773 | |
1774 | /* Enable MSI-X */ |
1775 | ret = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX); |
1776 | diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c |
1777 | index b29d2e663e104..f607b19ff4d23 100644 |
1778 | --- a/drivers/crypto/ccp/sp-pci.c |
1779 | +++ b/drivers/crypto/ccp/sp-pci.c |
1780 | @@ -213,7 +213,7 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
1781 | if (ret) { |
1782 | dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", |
1783 | ret); |
1784 | - goto e_err; |
1785 | + goto free_irqs; |
1786 | } |
1787 | } |
1788 | |
1789 | @@ -221,10 +221,12 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
1790 | |
1791 | ret = sp_init(sp); |
1792 | if (ret) |
1793 | - goto e_err; |
1794 | + goto free_irqs; |
1795 | |
1796 | return 0; |
1797 | |
1798 | +free_irqs: |
1799 | + sp_free_irqs(sp); |
1800 | e_err: |
1801 | dev_notice(dev, "initialization failed\n"); |
1802 | return ret; |
1803 | diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c |
1804 | index acaa504d5a798..e02ff2b205d01 100644 |
1805 | --- a/drivers/crypto/ixp4xx_crypto.c |
1806 | +++ b/drivers/crypto/ixp4xx_crypto.c |
1807 | @@ -329,7 +329,7 @@ static void free_buf_chain(struct device *dev, struct buffer_desc *buf, |
1808 | |
1809 | buf1 = buf->next; |
1810 | phys1 = buf->phys_next; |
1811 | - dma_unmap_single(dev, buf->phys_next, buf->buf_len, buf->dir); |
1812 | + dma_unmap_single(dev, buf->phys_addr, buf->buf_len, buf->dir); |
1813 | dma_pool_free(buffer_pool, buf, phys); |
1814 | buf = buf1; |
1815 | phys = phys1; |
1816 | diff --git a/drivers/crypto/nx/nx-842-pseries.c b/drivers/crypto/nx/nx-842-pseries.c |
1817 | index 2de5e3672e423..c5ec50a28f30d 100644 |
1818 | --- a/drivers/crypto/nx/nx-842-pseries.c |
1819 | +++ b/drivers/crypto/nx/nx-842-pseries.c |
1820 | @@ -538,13 +538,15 @@ static int nx842_OF_set_defaults(struct nx842_devdata *devdata) |
1821 | * The status field indicates if the device is enabled when the status |
1822 | * is 'okay'. Otherwise the device driver will be disabled. |
1823 | * |
1824 | - * @prop - struct property point containing the maxsyncop for the update |
1825 | + * @devdata: struct nx842_devdata to use for dev_info |
1826 | + * @prop: struct property point containing the maxsyncop for the update |
1827 | * |
1828 | * Returns: |
1829 | * 0 - Device is available |
1830 | * -ENODEV - Device is not available |
1831 | */ |
1832 | -static int nx842_OF_upd_status(struct property *prop) |
1833 | +static int nx842_OF_upd_status(struct nx842_devdata *devdata, |
1834 | + struct property *prop) |
1835 | { |
1836 | const char *status = (const char *)prop->value; |
1837 | |
1838 | @@ -758,7 +760,7 @@ static int nx842_OF_upd(struct property *new_prop) |
1839 | goto out; |
1840 | |
1841 | /* Perform property updates */ |
1842 | - ret = nx842_OF_upd_status(status); |
1843 | + ret = nx842_OF_upd_status(new_devdata, status); |
1844 | if (ret) |
1845 | goto error_out; |
1846 | |
1847 | @@ -1071,6 +1073,7 @@ static const struct vio_device_id nx842_vio_driver_ids[] = { |
1848 | {"ibm,compression-v1", "ibm,compression"}, |
1849 | {"", ""}, |
1850 | }; |
1851 | +MODULE_DEVICE_TABLE(vio, nx842_vio_driver_ids); |
1852 | |
1853 | static struct vio_driver nx842_vio_driver = { |
1854 | .name = KBUILD_MODNAME, |
1855 | diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
1856 | index d7c0c982ba433..f80db1eb29945 100644 |
1857 | --- a/drivers/crypto/omap-sham.c |
1858 | +++ b/drivers/crypto/omap-sham.c |
1859 | @@ -364,7 +364,7 @@ static int omap_sham_hw_init(struct omap_sham_dev *dd) |
1860 | { |
1861 | int err; |
1862 | |
1863 | - err = pm_runtime_get_sync(dd->dev); |
1864 | + err = pm_runtime_resume_and_get(dd->dev); |
1865 | if (err < 0) { |
1866 | dev_err(dd->dev, "failed to get sync: %d\n", err); |
1867 | return err; |
1868 | @@ -2236,7 +2236,7 @@ static int omap_sham_suspend(struct device *dev) |
1869 | |
1870 | static int omap_sham_resume(struct device *dev) |
1871 | { |
1872 | - int err = pm_runtime_get_sync(dev); |
1873 | + int err = pm_runtime_resume_and_get(dev); |
1874 | if (err < 0) { |
1875 | dev_err(dev, "failed to get sync: %d\n", err); |
1876 | return err; |
1877 | diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c |
1878 | index dac130bb807ae..eda692271f0c7 100644 |
1879 | --- a/drivers/crypto/qat/qat_common/qat_hal.c |
1880 | +++ b/drivers/crypto/qat/qat_common/qat_hal.c |
1881 | @@ -1256,7 +1256,11 @@ static int qat_hal_put_rel_wr_xfer(struct icp_qat_fw_loader_handle *handle, |
1882 | pr_err("QAT: bad xfrAddr=0x%x\n", xfr_addr); |
1883 | return -EINVAL; |
1884 | } |
1885 | - qat_hal_rd_rel_reg(handle, ae, ctx, ICP_GPB_REL, gprnum, &gprval); |
1886 | + status = qat_hal_rd_rel_reg(handle, ae, ctx, ICP_GPB_REL, gprnum, &gprval); |
1887 | + if (status) { |
1888 | + pr_err("QAT: failed to read register"); |
1889 | + return status; |
1890 | + } |
1891 | gpr_addr = qat_hal_get_reg_addr(ICP_GPB_REL, gprnum); |
1892 | data16low = 0xffff & data; |
1893 | data16hi = 0xffff & (data >> 0x10); |
1894 | diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c |
1895 | index aeb03081415cb..9542423bb7ca5 100644 |
1896 | --- a/drivers/crypto/qat/qat_common/qat_uclo.c |
1897 | +++ b/drivers/crypto/qat/qat_common/qat_uclo.c |
1898 | @@ -385,7 +385,6 @@ static int qat_uclo_init_umem_seg(struct icp_qat_fw_loader_handle *handle, |
1899 | return 0; |
1900 | } |
1901 | |
1902 | -#define ICP_DH895XCC_PESRAM_BAR_SIZE 0x80000 |
1903 | static int qat_uclo_init_ae_memory(struct icp_qat_fw_loader_handle *handle, |
1904 | struct icp_qat_uof_initmem *init_mem) |
1905 | { |
1906 | diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c |
1907 | index c172a69534777..38a66aceca2a7 100644 |
1908 | --- a/drivers/crypto/ux500/hash/hash_core.c |
1909 | +++ b/drivers/crypto/ux500/hash/hash_core.c |
1910 | @@ -1009,6 +1009,7 @@ static int hash_hw_final(struct ahash_request *req) |
1911 | goto out; |
1912 | } |
1913 | } else if (req->nbytes == 0 && ctx->keylen > 0) { |
1914 | + ret = -EPERM; |
1915 | dev_err(device_data->dev, "%s: Empty message with keylength > 0, NOT supported\n", |
1916 | __func__); |
1917 | goto out; |
1918 | diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c |
1919 | index dfcde7ed95006..f72be5f94e6fa 100644 |
1920 | --- a/drivers/edac/i10nm_base.c |
1921 | +++ b/drivers/edac/i10nm_base.c |
1922 | @@ -249,6 +249,9 @@ static int __init i10nm_init(void) |
1923 | if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) |
1924 | return -EBUSY; |
1925 | |
1926 | + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) |
1927 | + return -ENODEV; |
1928 | + |
1929 | id = x86_match_cpu(i10nm_cpuids); |
1930 | if (!id) |
1931 | return -ENODEV; |
1932 | diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c |
1933 | index dac45e2071b3f..e054eb0389037 100644 |
1934 | --- a/drivers/edac/pnd2_edac.c |
1935 | +++ b/drivers/edac/pnd2_edac.c |
1936 | @@ -1555,6 +1555,9 @@ static int __init pnd2_init(void) |
1937 | if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) |
1938 | return -EBUSY; |
1939 | |
1940 | + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) |
1941 | + return -ENODEV; |
1942 | + |
1943 | id = x86_match_cpu(pnd2_cpuids); |
1944 | if (!id) |
1945 | return -ENODEV; |
1946 | diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c |
1947 | index b557a53c75c46..d39f5bfb8bd92 100644 |
1948 | --- a/drivers/edac/sb_edac.c |
1949 | +++ b/drivers/edac/sb_edac.c |
1950 | @@ -3512,6 +3512,9 @@ static int __init sbridge_init(void) |
1951 | if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) |
1952 | return -EBUSY; |
1953 | |
1954 | + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) |
1955 | + return -ENODEV; |
1956 | + |
1957 | id = x86_match_cpu(sbridge_cpuids); |
1958 | if (!id) |
1959 | return -ENODEV; |
1960 | diff --git a/drivers/edac/skx_base.c b/drivers/edac/skx_base.c |
1961 | index 77cd370bd62fe..b1d717cb8df9f 100644 |
1962 | --- a/drivers/edac/skx_base.c |
1963 | +++ b/drivers/edac/skx_base.c |
1964 | @@ -605,6 +605,9 @@ static int __init skx_init(void) |
1965 | if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) |
1966 | return -EBUSY; |
1967 | |
1968 | + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) |
1969 | + return -ENODEV; |
1970 | + |
1971 | id = x86_match_cpu(skx_cpuids); |
1972 | if (!id) |
1973 | return -ENODEV; |
1974 | diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c |
1975 | index 3247689467435..9ab9fa0a911bd 100644 |
1976 | --- a/drivers/edac/ti_edac.c |
1977 | +++ b/drivers/edac/ti_edac.c |
1978 | @@ -197,6 +197,7 @@ static const struct of_device_id ti_edac_of_match[] = { |
1979 | { .compatible = "ti,emif-dra7xx", .data = (void *)EMIF_TYPE_DRA7 }, |
1980 | {}, |
1981 | }; |
1982 | +MODULE_DEVICE_TABLE(of, ti_edac_of_match); |
1983 | |
1984 | static int _emif_get_id(struct device_node *node) |
1985 | { |
1986 | diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c |
1987 | index 172e116ac1ced..cac36ef59e452 100644 |
1988 | --- a/drivers/extcon/extcon-max8997.c |
1989 | +++ b/drivers/extcon/extcon-max8997.c |
1990 | @@ -729,7 +729,7 @@ static int max8997_muic_probe(struct platform_device *pdev) |
1991 | 2, info->status); |
1992 | if (ret) { |
1993 | dev_err(info->dev, "failed to read MUIC register\n"); |
1994 | - return ret; |
1995 | + goto err_irq; |
1996 | } |
1997 | cable_type = max8997_muic_get_cable_type(info, |
1998 | MAX8997_CABLE_GROUP_ADC, &attached); |
1999 | @@ -784,3 +784,4 @@ module_platform_driver(max8997_muic_driver); |
2000 | MODULE_DESCRIPTION("Maxim MAX8997 Extcon driver"); |
2001 | MODULE_AUTHOR("Donggeun Kim <dg77.kim@samsung.com>"); |
2002 | MODULE_LICENSE("GPL"); |
2003 | +MODULE_ALIAS("platform:max8997-muic"); |
2004 | diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c |
2005 | index b3d93baf4fc58..f883992800b35 100644 |
2006 | --- a/drivers/extcon/extcon-sm5502.c |
2007 | +++ b/drivers/extcon/extcon-sm5502.c |
2008 | @@ -88,7 +88,6 @@ static struct reg_data sm5502_reg_data[] = { |
2009 | | SM5502_REG_INTM2_MHL_MASK, |
2010 | .invert = true, |
2011 | }, |
2012 | - { } |
2013 | }; |
2014 | |
2015 | /* List of detectable cables */ |
2016 | diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c |
2017 | index b485321189e11..b2b4ba240fb11 100644 |
2018 | --- a/drivers/firmware/stratix10-svc.c |
2019 | +++ b/drivers/firmware/stratix10-svc.c |
2020 | @@ -1026,24 +1026,32 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) |
2021 | |
2022 | /* add svc client device(s) */ |
2023 | svc = devm_kzalloc(dev, sizeof(*svc), GFP_KERNEL); |
2024 | - if (!svc) |
2025 | - return -ENOMEM; |
2026 | + if (!svc) { |
2027 | + ret = -ENOMEM; |
2028 | + goto err_free_kfifo; |
2029 | + } |
2030 | |
2031 | svc->stratix10_svc_rsu = platform_device_alloc(STRATIX10_RSU, 0); |
2032 | if (!svc->stratix10_svc_rsu) { |
2033 | dev_err(dev, "failed to allocate %s device\n", STRATIX10_RSU); |
2034 | - return -ENOMEM; |
2035 | + ret = -ENOMEM; |
2036 | + goto err_free_kfifo; |
2037 | } |
2038 | |
2039 | ret = platform_device_add(svc->stratix10_svc_rsu); |
2040 | - if (ret) { |
2041 | - platform_device_put(svc->stratix10_svc_rsu); |
2042 | - return ret; |
2043 | - } |
2044 | + if (ret) |
2045 | + goto err_put_device; |
2046 | + |
2047 | dev_set_drvdata(dev, svc); |
2048 | |
2049 | pr_info("Intel Service Layer Driver Initialized\n"); |
2050 | |
2051 | + return 0; |
2052 | + |
2053 | +err_put_device: |
2054 | + platform_device_put(svc->stratix10_svc_rsu); |
2055 | +err_free_kfifo: |
2056 | + kfifo_free(&controller->svc_fifo); |
2057 | return ret; |
2058 | } |
2059 | |
2060 | diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c |
2061 | index 9282239b4d959..cb980a60af0e8 100644 |
2062 | --- a/drivers/fsi/fsi-core.c |
2063 | +++ b/drivers/fsi/fsi-core.c |
2064 | @@ -718,7 +718,7 @@ static ssize_t cfam_read(struct file *filep, char __user *buf, size_t count, |
2065 | rc = count; |
2066 | fail: |
2067 | *offset = off; |
2068 | - return count; |
2069 | + return rc; |
2070 | } |
2071 | |
2072 | static ssize_t cfam_write(struct file *filep, const char __user *buf, |
2073 | @@ -755,7 +755,7 @@ static ssize_t cfam_write(struct file *filep, const char __user *buf, |
2074 | rc = count; |
2075 | fail: |
2076 | *offset = off; |
2077 | - return count; |
2078 | + return rc; |
2079 | } |
2080 | |
2081 | static loff_t cfam_llseek(struct file *file, loff_t offset, int whence) |
2082 | diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c |
2083 | index 7da9c81759ac0..8f16448045705 100644 |
2084 | --- a/drivers/fsi/fsi-occ.c |
2085 | +++ b/drivers/fsi/fsi-occ.c |
2086 | @@ -445,6 +445,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len, |
2087 | goto done; |
2088 | |
2089 | if (resp->return_status == OCC_RESP_CMD_IN_PRG || |
2090 | + resp->return_status == OCC_RESP_CRIT_INIT || |
2091 | resp->seq_no != seq_no) { |
2092 | rc = -ETIMEDOUT; |
2093 | |
2094 | diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c |
2095 | index f54df9ebc8b30..c8ccc99e214fa 100644 |
2096 | --- a/drivers/fsi/fsi-sbefifo.c |
2097 | +++ b/drivers/fsi/fsi-sbefifo.c |
2098 | @@ -325,7 +325,8 @@ static int sbefifo_up_write(struct sbefifo *sbefifo, __be32 word) |
2099 | static int sbefifo_request_reset(struct sbefifo *sbefifo) |
2100 | { |
2101 | struct device *dev = &sbefifo->fsi_dev->dev; |
2102 | - u32 status, timeout; |
2103 | + unsigned long end_time; |
2104 | + u32 status; |
2105 | int rc; |
2106 | |
2107 | dev_dbg(dev, "Requesting FIFO reset\n"); |
2108 | @@ -341,7 +342,8 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo) |
2109 | } |
2110 | |
2111 | /* Wait for it to complete */ |
2112 | - for (timeout = 0; timeout < SBEFIFO_RESET_TIMEOUT; timeout++) { |
2113 | + end_time = jiffies + msecs_to_jiffies(SBEFIFO_RESET_TIMEOUT); |
2114 | + while (!time_after(jiffies, end_time)) { |
2115 | rc = sbefifo_regr(sbefifo, SBEFIFO_UP | SBEFIFO_STS, &status); |
2116 | if (rc) { |
2117 | dev_err(dev, "Failed to read UP fifo status during reset" |
2118 | @@ -355,7 +357,7 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo) |
2119 | return 0; |
2120 | } |
2121 | |
2122 | - msleep(1); |
2123 | + cond_resched(); |
2124 | } |
2125 | dev_err(dev, "FIFO reset timed out\n"); |
2126 | |
2127 | @@ -400,7 +402,7 @@ static int sbefifo_cleanup_hw(struct sbefifo *sbefifo) |
2128 | /* The FIFO already contains a reset request from the SBE ? */ |
2129 | if (down_status & SBEFIFO_STS_RESET_REQ) { |
2130 | dev_info(dev, "Cleanup: FIFO reset request set, resetting\n"); |
2131 | - rc = sbefifo_regw(sbefifo, SBEFIFO_UP, SBEFIFO_PERFORM_RESET); |
2132 | + rc = sbefifo_regw(sbefifo, SBEFIFO_DOWN, SBEFIFO_PERFORM_RESET); |
2133 | if (rc) { |
2134 | sbefifo->broken = true; |
2135 | dev_err(dev, "Cleanup: Reset reg write failed, rc=%d\n", rc); |
2136 | diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c |
2137 | index 004dc03ccf09c..918367621086c 100644 |
2138 | --- a/drivers/fsi/fsi-scom.c |
2139 | +++ b/drivers/fsi/fsi-scom.c |
2140 | @@ -38,9 +38,10 @@ |
2141 | #define SCOM_STATUS_PIB_RESP_MASK 0x00007000 |
2142 | #define SCOM_STATUS_PIB_RESP_SHIFT 12 |
2143 | |
2144 | -#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ |
2145 | - SCOM_STATUS_PARITY | \ |
2146 | - SCOM_STATUS_PIB_ABORT | \ |
2147 | +#define SCOM_STATUS_FSI2PIB_ERROR (SCOM_STATUS_PROTECTION | \ |
2148 | + SCOM_STATUS_PARITY | \ |
2149 | + SCOM_STATUS_PIB_ABORT) |
2150 | +#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_FSI2PIB_ERROR | \ |
2151 | SCOM_STATUS_PIB_RESP_MASK) |
2152 | /* SCOM address encodings */ |
2153 | #define XSCOM_ADDR_IND_FLAG BIT_ULL(63) |
2154 | @@ -240,13 +241,14 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) |
2155 | { |
2156 | uint32_t dummy = -1; |
2157 | |
2158 | - if (status & SCOM_STATUS_PROTECTION) |
2159 | - return -EPERM; |
2160 | - if (status & SCOM_STATUS_PARITY) { |
2161 | + if (status & SCOM_STATUS_FSI2PIB_ERROR) |
2162 | fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy, |
2163 | sizeof(uint32_t)); |
2164 | + |
2165 | + if (status & SCOM_STATUS_PROTECTION) |
2166 | + return -EPERM; |
2167 | + if (status & SCOM_STATUS_PARITY) |
2168 | return -EIO; |
2169 | - } |
2170 | /* Return -EBUSY on PIB abort to force a retry */ |
2171 | if (status & SCOM_STATUS_PIB_ABORT) |
2172 | return -EBUSY; |
2173 | diff --git a/drivers/gpu/drm/qxl/qxl_dumb.c b/drivers/gpu/drm/qxl/qxl_dumb.c |
2174 | index 272d19b677d8f..4a0dc13480973 100644 |
2175 | --- a/drivers/gpu/drm/qxl/qxl_dumb.c |
2176 | +++ b/drivers/gpu/drm/qxl/qxl_dumb.c |
2177 | @@ -58,6 +58,8 @@ int qxl_mode_dumb_create(struct drm_file *file_priv, |
2178 | surf.height = args->height; |
2179 | surf.stride = pitch; |
2180 | surf.format = format; |
2181 | + surf.data = 0; |
2182 | + |
2183 | r = qxl_gem_object_create_with_handle(qdev, file_priv, |
2184 | QXL_GEM_DOMAIN_SURFACE, |
2185 | args->size, &surf, &qobj, |
2186 | diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c |
2187 | index d505ea7d5384f..8f299d76b69b8 100644 |
2188 | --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c |
2189 | +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c |
2190 | @@ -72,6 +72,7 @@ static int cdn_dp_grf_write(struct cdn_dp_device *dp, |
2191 | ret = regmap_write(dp->grf, reg, val); |
2192 | if (ret) { |
2193 | DRM_DEV_ERROR(dp->dev, "Could not write to GRF: %d\n", ret); |
2194 | + clk_disable_unprepare(dp->grf_clk); |
2195 | return ret; |
2196 | } |
2197 | |
2198 | diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |
2199 | index bc073ec5c1839..ecb59dc6c8b8b 100644 |
2200 | --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |
2201 | +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |
2202 | @@ -564,13 +564,8 @@ static const struct dw_mipi_dsi_phy_ops dw_mipi_dsi_rockchip_phy_ops = { |
2203 | .get_lane_mbps = dw_mipi_dsi_get_lane_mbps, |
2204 | }; |
2205 | |
2206 | -static void dw_mipi_dsi_rockchip_config(struct dw_mipi_dsi_rockchip *dsi, |
2207 | - int mux) |
2208 | +static void dw_mipi_dsi_rockchip_config(struct dw_mipi_dsi_rockchip *dsi) |
2209 | { |
2210 | - if (dsi->cdata->lcdsel_grf_reg) |
2211 | - regmap_write(dsi->grf_regmap, dsi->cdata->lcdsel_grf_reg, |
2212 | - mux ? dsi->cdata->lcdsel_lit : dsi->cdata->lcdsel_big); |
2213 | - |
2214 | if (dsi->cdata->lanecfg1_grf_reg) |
2215 | regmap_write(dsi->grf_regmap, dsi->cdata->lanecfg1_grf_reg, |
2216 | dsi->cdata->lanecfg1); |
2217 | @@ -584,6 +579,13 @@ static void dw_mipi_dsi_rockchip_config(struct dw_mipi_dsi_rockchip *dsi, |
2218 | dsi->cdata->enable); |
2219 | } |
2220 | |
2221 | +static void dw_mipi_dsi_rockchip_set_lcdsel(struct dw_mipi_dsi_rockchip *dsi, |
2222 | + int mux) |
2223 | +{ |
2224 | + regmap_write(dsi->grf_regmap, dsi->cdata->lcdsel_grf_reg, |
2225 | + mux ? dsi->cdata->lcdsel_lit : dsi->cdata->lcdsel_big); |
2226 | +} |
2227 | + |
2228 | static int |
2229 | dw_mipi_dsi_encoder_atomic_check(struct drm_encoder *encoder, |
2230 | struct drm_crtc_state *crtc_state, |
2231 | @@ -639,9 +641,9 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) |
2232 | return; |
2233 | } |
2234 | |
2235 | - dw_mipi_dsi_rockchip_config(dsi, mux); |
2236 | + dw_mipi_dsi_rockchip_set_lcdsel(dsi, mux); |
2237 | if (dsi->slave) |
2238 | - dw_mipi_dsi_rockchip_config(dsi->slave, mux); |
2239 | + dw_mipi_dsi_rockchip_set_lcdsel(dsi->slave, mux); |
2240 | |
2241 | clk_disable_unprepare(dsi->grf_clk); |
2242 | } |
2243 | @@ -800,6 +802,24 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, |
2244 | return ret; |
2245 | } |
2246 | |
2247 | + /* |
2248 | + * With the GRF clock running, write lane and dual-mode configurations |
2249 | + * that won't change immediately. If we waited until enable() to do |
2250 | + * this, things like panel preparation would not be able to send |
2251 | + * commands over DSI. |
2252 | + */ |
2253 | + ret = clk_prepare_enable(dsi->grf_clk); |
2254 | + if (ret) { |
2255 | + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); |
2256 | + return ret; |
2257 | + } |
2258 | + |
2259 | + dw_mipi_dsi_rockchip_config(dsi); |
2260 | + if (dsi->slave) |
2261 | + dw_mipi_dsi_rockchip_config(dsi->slave); |
2262 | + |
2263 | + clk_disable_unprepare(dsi->grf_clk); |
2264 | + |
2265 | ret = rockchip_dsi_drm_create_encoder(dsi, drm_dev); |
2266 | if (ret) { |
2267 | DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); |
2268 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
2269 | index 550fff6e41eca..b6740ad773ee7 100644 |
2270 | --- a/drivers/hid/hid-core.c |
2271 | +++ b/drivers/hid/hid-core.c |
2272 | @@ -2299,12 +2299,8 @@ static int hid_device_remove(struct device *dev) |
2273 | { |
2274 | struct hid_device *hdev = to_hid_device(dev); |
2275 | struct hid_driver *hdrv; |
2276 | - int ret = 0; |
2277 | |
2278 | - if (down_interruptible(&hdev->driver_input_lock)) { |
2279 | - ret = -EINTR; |
2280 | - goto end; |
2281 | - } |
2282 | + down(&hdev->driver_input_lock); |
2283 | hdev->io_started = false; |
2284 | |
2285 | hdrv = hdev->driver; |
2286 | @@ -2319,8 +2315,8 @@ static int hid_device_remove(struct device *dev) |
2287 | |
2288 | if (!hdev->io_started) |
2289 | up(&hdev->driver_input_lock); |
2290 | -end: |
2291 | - return ret; |
2292 | + |
2293 | + return 0; |
2294 | } |
2295 | |
2296 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, |
2297 | diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h |
2298 | index 195910dd2154e..e3835407e8d23 100644 |
2299 | --- a/drivers/hid/wacom_wac.h |
2300 | +++ b/drivers/hid/wacom_wac.h |
2301 | @@ -122,7 +122,7 @@ |
2302 | #define WACOM_HID_WD_TOUCHONOFF (WACOM_HID_UP_WACOMDIGITIZER | 0x0454) |
2303 | #define WACOM_HID_WD_BATTERY_LEVEL (WACOM_HID_UP_WACOMDIGITIZER | 0x043b) |
2304 | #define WACOM_HID_WD_EXPRESSKEY00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0910) |
2305 | -#define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0950) |
2306 | +#define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0940) |
2307 | #define WACOM_HID_WD_MODE_CHANGE (WACOM_HID_UP_WACOMDIGITIZER | 0x0980) |
2308 | #define WACOM_HID_WD_MUTE_DEVICE (WACOM_HID_UP_WACOMDIGITIZER | 0x0981) |
2309 | #define WACOM_HID_WD_CONTROLPANEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0982) |
2310 | diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c |
2311 | index e32681ee7b9f6..1671f6f9ea80c 100644 |
2312 | --- a/drivers/hv/hv_util.c |
2313 | +++ b/drivers/hv/hv_util.c |
2314 | @@ -537,8 +537,8 @@ static int hv_timesync_init(struct hv_util_service *srv) |
2315 | */ |
2316 | hv_ptp_clock = ptp_clock_register(&ptp_hyperv_info, NULL); |
2317 | if (IS_ERR_OR_NULL(hv_ptp_clock)) { |
2318 | - pr_err("cannot register PTP clock: %ld\n", |
2319 | - PTR_ERR(hv_ptp_clock)); |
2320 | + pr_err("cannot register PTP clock: %d\n", |
2321 | + PTR_ERR_OR_ZERO(hv_ptp_clock)); |
2322 | hv_ptp_clock = NULL; |
2323 | } |
2324 | |
2325 | diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c |
2326 | index 062eceb7be0db..613338cbcb170 100644 |
2327 | --- a/drivers/hwmon/max31722.c |
2328 | +++ b/drivers/hwmon/max31722.c |
2329 | @@ -6,7 +6,6 @@ |
2330 | * Copyright (c) 2016, Intel Corporation. |
2331 | */ |
2332 | |
2333 | -#include <linux/acpi.h> |
2334 | #include <linux/hwmon.h> |
2335 | #include <linux/hwmon-sysfs.h> |
2336 | #include <linux/kernel.h> |
2337 | @@ -133,20 +132,12 @@ static const struct spi_device_id max31722_spi_id[] = { |
2338 | {"max31723", 0}, |
2339 | {} |
2340 | }; |
2341 | - |
2342 | -static const struct acpi_device_id __maybe_unused max31722_acpi_id[] = { |
2343 | - {"MAX31722", 0}, |
2344 | - {"MAX31723", 0}, |
2345 | - {} |
2346 | -}; |
2347 | - |
2348 | MODULE_DEVICE_TABLE(spi, max31722_spi_id); |
2349 | |
2350 | static struct spi_driver max31722_driver = { |
2351 | .driver = { |
2352 | .name = "max31722", |
2353 | .pm = &max31722_pm_ops, |
2354 | - .acpi_match_table = ACPI_PTR(max31722_acpi_id), |
2355 | }, |
2356 | .probe = max31722_probe, |
2357 | .remove = max31722_remove, |
2358 | diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c |
2359 | index 117fb79ef294c..2baf88ead0aa8 100644 |
2360 | --- a/drivers/hwmon/max31790.c |
2361 | +++ b/drivers/hwmon/max31790.c |
2362 | @@ -27,6 +27,7 @@ |
2363 | |
2364 | /* Fan Config register bits */ |
2365 | #define MAX31790_FAN_CFG_RPM_MODE 0x80 |
2366 | +#define MAX31790_FAN_CFG_CTRL_MON 0x10 |
2367 | #define MAX31790_FAN_CFG_TACH_INPUT_EN 0x08 |
2368 | #define MAX31790_FAN_CFG_TACH_INPUT 0x01 |
2369 | |
2370 | @@ -104,7 +105,7 @@ static struct max31790_data *max31790_update_device(struct device *dev) |
2371 | data->tach[NR_CHANNEL + i] = rv; |
2372 | } else { |
2373 | rv = i2c_smbus_read_word_swapped(client, |
2374 | - MAX31790_REG_PWMOUT(i)); |
2375 | + MAX31790_REG_PWM_DUTY_CYCLE(i)); |
2376 | if (rv < 0) |
2377 | goto abort; |
2378 | data->pwm[i] = rv; |
2379 | @@ -170,7 +171,7 @@ static int max31790_read_fan(struct device *dev, u32 attr, int channel, |
2380 | |
2381 | switch (attr) { |
2382 | case hwmon_fan_input: |
2383 | - sr = get_tach_period(data->fan_dynamics[channel]); |
2384 | + sr = get_tach_period(data->fan_dynamics[channel % NR_CHANNEL]); |
2385 | rpm = RPM_FROM_REG(data->tach[channel], sr); |
2386 | *val = rpm; |
2387 | return 0; |
2388 | @@ -271,12 +272,12 @@ static int max31790_read_pwm(struct device *dev, u32 attr, int channel, |
2389 | *val = data->pwm[channel] >> 8; |
2390 | return 0; |
2391 | case hwmon_pwm_enable: |
2392 | - if (fan_config & MAX31790_FAN_CFG_RPM_MODE) |
2393 | + if (fan_config & MAX31790_FAN_CFG_CTRL_MON) |
2394 | + *val = 0; |
2395 | + else if (fan_config & MAX31790_FAN_CFG_RPM_MODE) |
2396 | *val = 2; |
2397 | - else if (fan_config & MAX31790_FAN_CFG_TACH_INPUT_EN) |
2398 | - *val = 1; |
2399 | else |
2400 | - *val = 0; |
2401 | + *val = 1; |
2402 | return 0; |
2403 | default: |
2404 | return -EOPNOTSUPP; |
2405 | @@ -299,31 +300,41 @@ static int max31790_write_pwm(struct device *dev, u32 attr, int channel, |
2406 | err = -EINVAL; |
2407 | break; |
2408 | } |
2409 | - data->pwm[channel] = val << 8; |
2410 | + data->valid = false; |
2411 | err = i2c_smbus_write_word_swapped(client, |
2412 | MAX31790_REG_PWMOUT(channel), |
2413 | - data->pwm[channel]); |
2414 | + val << 8); |
2415 | break; |
2416 | case hwmon_pwm_enable: |
2417 | fan_config = data->fan_config[channel]; |
2418 | if (val == 0) { |
2419 | - fan_config &= ~(MAX31790_FAN_CFG_TACH_INPUT_EN | |
2420 | - MAX31790_FAN_CFG_RPM_MODE); |
2421 | + fan_config |= MAX31790_FAN_CFG_CTRL_MON; |
2422 | + /* |
2423 | + * Disable RPM mode; otherwise disabling fan speed |
2424 | + * monitoring is not possible. |
2425 | + */ |
2426 | + fan_config &= ~MAX31790_FAN_CFG_RPM_MODE; |
2427 | } else if (val == 1) { |
2428 | - fan_config = (fan_config | |
2429 | - MAX31790_FAN_CFG_TACH_INPUT_EN) & |
2430 | - ~MAX31790_FAN_CFG_RPM_MODE; |
2431 | + fan_config &= ~(MAX31790_FAN_CFG_CTRL_MON | MAX31790_FAN_CFG_RPM_MODE); |
2432 | } else if (val == 2) { |
2433 | - fan_config |= MAX31790_FAN_CFG_TACH_INPUT_EN | |
2434 | - MAX31790_FAN_CFG_RPM_MODE; |
2435 | + fan_config &= ~MAX31790_FAN_CFG_CTRL_MON; |
2436 | + /* |
2437 | + * The chip sets MAX31790_FAN_CFG_TACH_INPUT_EN on its |
2438 | + * own if MAX31790_FAN_CFG_RPM_MODE is set. |
2439 | + * Do it here as well to reflect the actual register |
2440 | + * value in the cache. |
2441 | + */ |
2442 | + fan_config |= (MAX31790_FAN_CFG_RPM_MODE | MAX31790_FAN_CFG_TACH_INPUT_EN); |
2443 | } else { |
2444 | err = -EINVAL; |
2445 | break; |
2446 | } |
2447 | - data->fan_config[channel] = fan_config; |
2448 | - err = i2c_smbus_write_byte_data(client, |
2449 | - MAX31790_REG_FAN_CONFIG(channel), |
2450 | - fan_config); |
2451 | + if (fan_config != data->fan_config[channel]) { |
2452 | + err = i2c_smbus_write_byte_data(client, MAX31790_REG_FAN_CONFIG(channel), |
2453 | + fan_config); |
2454 | + if (!err) |
2455 | + data->fan_config[channel] = fan_config; |
2456 | + } |
2457 | break; |
2458 | default: |
2459 | err = -EOPNOTSUPP; |
2460 | diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c |
2461 | index 1574e4604a4fa..aa301c6063467 100644 |
2462 | --- a/drivers/iio/accel/bma180.c |
2463 | +++ b/drivers/iio/accel/bma180.c |
2464 | @@ -119,7 +119,11 @@ struct bma180_data { |
2465 | int scale; |
2466 | int bw; |
2467 | bool pmode; |
2468 | - u8 buff[16]; /* 3x 16-bit + 8-bit + padding + timestamp */ |
2469 | + /* Ensure timestamp is naturally aligned */ |
2470 | + struct { |
2471 | + s16 chan[4]; |
2472 | + s64 timestamp __aligned(8); |
2473 | + } scan; |
2474 | }; |
2475 | |
2476 | enum bma180_chan { |
2477 | @@ -675,12 +679,12 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p) |
2478 | mutex_unlock(&data->mutex); |
2479 | goto err; |
2480 | } |
2481 | - ((s16 *)data->buff)[i++] = ret; |
2482 | + data->scan.chan[i++] = ret; |
2483 | } |
2484 | |
2485 | mutex_unlock(&data->mutex); |
2486 | |
2487 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buff, time_ns); |
2488 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, time_ns); |
2489 | err: |
2490 | iio_trigger_notify_done(indio_dev->trig); |
2491 | |
2492 | diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c |
2493 | index cae905039cb62..71ee42b0266de 100644 |
2494 | --- a/drivers/iio/accel/bma220_spi.c |
2495 | +++ b/drivers/iio/accel/bma220_spi.c |
2496 | @@ -73,7 +73,11 @@ static const int bma220_scale_table[][4] = { |
2497 | struct bma220_data { |
2498 | struct spi_device *spi_device; |
2499 | struct mutex lock; |
2500 | - s8 buffer[16]; /* 3x8-bit channels + 5x8 padding + 8x8 timestamp */ |
2501 | + struct { |
2502 | + s8 chans[3]; |
2503 | + /* Ensure timestamp is naturally aligned. */ |
2504 | + s64 timestamp __aligned(8); |
2505 | + } scan; |
2506 | u8 tx_buf[2] ____cacheline_aligned; |
2507 | }; |
2508 | |
2509 | @@ -104,12 +108,12 @@ static irqreturn_t bma220_trigger_handler(int irq, void *p) |
2510 | |
2511 | mutex_lock(&data->lock); |
2512 | data->tx_buf[0] = BMA220_REG_ACCEL_X | BMA220_READ_MASK; |
2513 | - ret = spi_write_then_read(spi, data->tx_buf, 1, data->buffer, |
2514 | + ret = spi_write_then_read(spi, data->tx_buf, 1, &data->scan.chans, |
2515 | ARRAY_SIZE(bma220_channels) - 1); |
2516 | if (ret < 0) |
2517 | goto err; |
2518 | |
2519 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
2520 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2521 | pf->timestamp); |
2522 | err: |
2523 | mutex_unlock(&data->lock); |
2524 | diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c |
2525 | index 0d9e2def2b257..f908476fa095d 100644 |
2526 | --- a/drivers/iio/accel/hid-sensor-accel-3d.c |
2527 | +++ b/drivers/iio/accel/hid-sensor-accel-3d.c |
2528 | @@ -29,8 +29,11 @@ struct accel_3d_state { |
2529 | struct hid_sensor_hub_callbacks callbacks; |
2530 | struct hid_sensor_common common_attributes; |
2531 | struct hid_sensor_hub_attribute_info accel[ACCEL_3D_CHANNEL_MAX]; |
2532 | - /* Reserve for 3 channels + padding + timestamp */ |
2533 | - u32 accel_val[ACCEL_3D_CHANNEL_MAX + 3]; |
2534 | + /* Ensure timestamp is naturally aligned */ |
2535 | + struct { |
2536 | + u32 accel_val[3]; |
2537 | + s64 timestamp __aligned(8); |
2538 | + } scan; |
2539 | int scale_pre_decml; |
2540 | int scale_post_decml; |
2541 | int scale_precision; |
2542 | @@ -241,8 +244,8 @@ static int accel_3d_proc_event(struct hid_sensor_hub_device *hsdev, |
2543 | accel_state->timestamp = iio_get_time_ns(indio_dev); |
2544 | |
2545 | hid_sensor_push_data(indio_dev, |
2546 | - accel_state->accel_val, |
2547 | - sizeof(accel_state->accel_val), |
2548 | + &accel_state->scan, |
2549 | + sizeof(accel_state->scan), |
2550 | accel_state->timestamp); |
2551 | |
2552 | accel_state->timestamp = 0; |
2553 | @@ -267,7 +270,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev, |
2554 | case HID_USAGE_SENSOR_ACCEL_Y_AXIS: |
2555 | case HID_USAGE_SENSOR_ACCEL_Z_AXIS: |
2556 | offset = usage_id - HID_USAGE_SENSOR_ACCEL_X_AXIS; |
2557 | - accel_state->accel_val[CHANNEL_SCAN_INDEX_X + offset] = |
2558 | + accel_state->scan.accel_val[CHANNEL_SCAN_INDEX_X + offset] = |
2559 | *(u32 *)raw_data; |
2560 | ret = 0; |
2561 | break; |
2562 | diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c |
2563 | index da9452e811056..57db60bf2d4ca 100644 |
2564 | --- a/drivers/iio/accel/kxcjk-1013.c |
2565 | +++ b/drivers/iio/accel/kxcjk-1013.c |
2566 | @@ -132,12 +132,23 @@ enum kx_acpi_type { |
2567 | ACPI_KIOX010A, |
2568 | }; |
2569 | |
2570 | +enum kxcjk1013_axis { |
2571 | + AXIS_X, |
2572 | + AXIS_Y, |
2573 | + AXIS_Z, |
2574 | + AXIS_MAX |
2575 | +}; |
2576 | + |
2577 | struct kxcjk1013_data { |
2578 | struct i2c_client *client; |
2579 | struct iio_trigger *dready_trig; |
2580 | struct iio_trigger *motion_trig; |
2581 | struct mutex mutex; |
2582 | - s16 buffer[8]; |
2583 | + /* Ensure timestamp naturally aligned */ |
2584 | + struct { |
2585 | + s16 chans[AXIS_MAX]; |
2586 | + s64 timestamp __aligned(8); |
2587 | + } scan; |
2588 | u8 odr_bits; |
2589 | u8 range; |
2590 | int wake_thres; |
2591 | @@ -151,13 +162,6 @@ struct kxcjk1013_data { |
2592 | enum kx_acpi_type acpi_type; |
2593 | }; |
2594 | |
2595 | -enum kxcjk1013_axis { |
2596 | - AXIS_X, |
2597 | - AXIS_Y, |
2598 | - AXIS_Z, |
2599 | - AXIS_MAX, |
2600 | -}; |
2601 | - |
2602 | enum kxcjk1013_mode { |
2603 | STANDBY, |
2604 | OPERATION, |
2605 | @@ -1078,12 +1082,12 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) |
2606 | ret = i2c_smbus_read_i2c_block_data_or_emulated(data->client, |
2607 | KXCJK1013_REG_XOUT_L, |
2608 | AXIS_MAX * 2, |
2609 | - (u8 *)data->buffer); |
2610 | + (u8 *)data->scan.chans); |
2611 | mutex_unlock(&data->mutex); |
2612 | if (ret < 0) |
2613 | goto err; |
2614 | |
2615 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
2616 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2617 | data->timestamp); |
2618 | err: |
2619 | iio_trigger_notify_done(indio_dev->trig); |
2620 | diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c |
2621 | index 3d5bea651923e..d81b02642a0b3 100644 |
2622 | --- a/drivers/iio/accel/mxc4005.c |
2623 | +++ b/drivers/iio/accel/mxc4005.c |
2624 | @@ -56,7 +56,11 @@ struct mxc4005_data { |
2625 | struct mutex mutex; |
2626 | struct regmap *regmap; |
2627 | struct iio_trigger *dready_trig; |
2628 | - __be16 buffer[8]; |
2629 | + /* Ensure timestamp is naturally aligned */ |
2630 | + struct { |
2631 | + __be16 chans[3]; |
2632 | + s64 timestamp __aligned(8); |
2633 | + } scan; |
2634 | bool trigger_enabled; |
2635 | }; |
2636 | |
2637 | @@ -135,7 +139,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data) |
2638 | int ret; |
2639 | |
2640 | ret = regmap_bulk_read(data->regmap, MXC4005_REG_XOUT_UPPER, |
2641 | - (u8 *) data->buffer, sizeof(data->buffer)); |
2642 | + data->scan.chans, sizeof(data->scan.chans)); |
2643 | if (ret < 0) { |
2644 | dev_err(data->dev, "failed to read axes\n"); |
2645 | return ret; |
2646 | @@ -150,7 +154,7 @@ static int mxc4005_read_axis(struct mxc4005_data *data, |
2647 | __be16 reg; |
2648 | int ret; |
2649 | |
2650 | - ret = regmap_bulk_read(data->regmap, addr, (u8 *) ®, sizeof(reg)); |
2651 | + ret = regmap_bulk_read(data->regmap, addr, ®, sizeof(reg)); |
2652 | if (ret < 0) { |
2653 | dev_err(data->dev, "failed to read reg %02x\n", addr); |
2654 | return ret; |
2655 | @@ -301,7 +305,7 @@ static irqreturn_t mxc4005_trigger_handler(int irq, void *private) |
2656 | if (ret < 0) |
2657 | goto err; |
2658 | |
2659 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
2660 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2661 | pf->timestamp); |
2662 | |
2663 | err: |
2664 | diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c |
2665 | index 58c160ccdee71..be66b85239778 100644 |
2666 | --- a/drivers/iio/accel/stk8312.c |
2667 | +++ b/drivers/iio/accel/stk8312.c |
2668 | @@ -103,7 +103,11 @@ struct stk8312_data { |
2669 | u8 mode; |
2670 | struct iio_trigger *dready_trig; |
2671 | bool dready_trigger_on; |
2672 | - s8 buffer[16]; /* 3x8-bit channels + 5x8 padding + 64-bit timestamp */ |
2673 | + /* Ensure timestamp is naturally aligned */ |
2674 | + struct { |
2675 | + s8 chans[3]; |
2676 | + s64 timestamp __aligned(8); |
2677 | + } scan; |
2678 | }; |
2679 | |
2680 | static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL); |
2681 | @@ -438,7 +442,7 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) |
2682 | ret = i2c_smbus_read_i2c_block_data(data->client, |
2683 | STK8312_REG_XOUT, |
2684 | STK8312_ALL_CHANNEL_SIZE, |
2685 | - data->buffer); |
2686 | + data->scan.chans); |
2687 | if (ret < STK8312_ALL_CHANNEL_SIZE) { |
2688 | dev_err(&data->client->dev, "register read failed\n"); |
2689 | mutex_unlock(&data->lock); |
2690 | @@ -452,12 +456,12 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) |
2691 | mutex_unlock(&data->lock); |
2692 | goto err; |
2693 | } |
2694 | - data->buffer[i++] = ret; |
2695 | + data->scan.chans[i++] = ret; |
2696 | } |
2697 | } |
2698 | mutex_unlock(&data->lock); |
2699 | |
2700 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
2701 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2702 | pf->timestamp); |
2703 | err: |
2704 | iio_trigger_notify_done(indio_dev->trig); |
2705 | diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c |
2706 | index c70ddec29eb49..edba3c13a979f 100644 |
2707 | --- a/drivers/iio/accel/stk8ba50.c |
2708 | +++ b/drivers/iio/accel/stk8ba50.c |
2709 | @@ -91,12 +91,11 @@ struct stk8ba50_data { |
2710 | u8 sample_rate_idx; |
2711 | struct iio_trigger *dready_trig; |
2712 | bool dready_trigger_on; |
2713 | - /* |
2714 | - * 3 x 16-bit channels (10-bit data, 6-bit padding) + |
2715 | - * 1 x 16 padding + |
2716 | - * 4 x 16 64-bit timestamp |
2717 | - */ |
2718 | - s16 buffer[8]; |
2719 | + /* Ensure timestamp is naturally aligned */ |
2720 | + struct { |
2721 | + s16 chans[3]; |
2722 | + s64 timetamp __aligned(8); |
2723 | + } scan; |
2724 | }; |
2725 | |
2726 | #define STK8BA50_ACCEL_CHANNEL(index, reg, axis) { \ |
2727 | @@ -324,7 +323,7 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p) |
2728 | ret = i2c_smbus_read_i2c_block_data(data->client, |
2729 | STK8BA50_REG_XOUT, |
2730 | STK8BA50_ALL_CHANNEL_SIZE, |
2731 | - (u8 *)data->buffer); |
2732 | + (u8 *)data->scan.chans); |
2733 | if (ret < STK8BA50_ALL_CHANNEL_SIZE) { |
2734 | dev_err(&data->client->dev, "register read failed\n"); |
2735 | goto err; |
2736 | @@ -337,10 +336,10 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p) |
2737 | if (ret < 0) |
2738 | goto err; |
2739 | |
2740 | - data->buffer[i++] = ret; |
2741 | + data->scan.chans[i++] = ret; |
2742 | } |
2743 | } |
2744 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
2745 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
2746 | pf->timestamp); |
2747 | err: |
2748 | mutex_unlock(&data->lock); |
2749 | diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c |
2750 | index 2c01963a6a5cf..def4abeb47cae 100644 |
2751 | --- a/drivers/iio/adc/at91-sama5d2_adc.c |
2752 | +++ b/drivers/iio/adc/at91-sama5d2_adc.c |
2753 | @@ -399,7 +399,9 @@ struct at91_adc_state { |
2754 | wait_queue_head_t wq_data_available; |
2755 | struct at91_adc_dma dma_st; |
2756 | struct at91_adc_touch touch_st; |
2757 | - u16 buffer[AT91_BUFFER_MAX_HWORDS]; |
2758 | + struct iio_dev *indio_dev; |
2759 | + /* Ensure naturally aligned timestamp */ |
2760 | + u16 buffer[AT91_BUFFER_MAX_HWORDS] __aligned(8); |
2761 | /* |
2762 | * lock to prevent concurrent 'single conversion' requests through |
2763 | * sysfs. |
2764 | @@ -624,13 +626,13 @@ static u16 at91_adc_touch_pos(struct at91_adc_state *st, int reg) |
2765 | /* first half of register is the x or y, second half is the scale */ |
2766 | val = at91_adc_readl(st, reg); |
2767 | if (!val) |
2768 | - dev_dbg(&iio_priv_to_dev(st)->dev, "pos is 0\n"); |
2769 | + dev_dbg(&st->indio_dev->dev, "pos is 0\n"); |
2770 | |
2771 | pos = val & AT91_SAMA5D2_XYZ_MASK; |
2772 | result = (pos << AT91_SAMA5D2_MAX_POS_BITS) - pos; |
2773 | scale = (val >> 16) & AT91_SAMA5D2_XYZ_MASK; |
2774 | if (scale == 0) { |
2775 | - dev_err(&iio_priv_to_dev(st)->dev, "scale is 0\n"); |
2776 | + dev_err(&st->indio_dev->dev, "scale is 0\n"); |
2777 | return 0; |
2778 | } |
2779 | result /= scale; |
2780 | @@ -1154,9 +1156,9 @@ static unsigned at91_adc_startup_time(unsigned startup_time_min, |
2781 | return i; |
2782 | } |
2783 | |
2784 | -static void at91_adc_setup_samp_freq(struct at91_adc_state *st, unsigned freq) |
2785 | +static void at91_adc_setup_samp_freq(struct iio_dev *indio_dev, unsigned freq) |
2786 | { |
2787 | - struct iio_dev *indio_dev = iio_priv_to_dev(st); |
2788 | + struct at91_adc_state *st = iio_priv(indio_dev); |
2789 | unsigned f_per, prescal, startup, mr; |
2790 | |
2791 | f_per = clk_get_rate(st->per_clk); |
2792 | @@ -1225,9 +1227,9 @@ static void at91_adc_pen_detect_interrupt(struct at91_adc_state *st) |
2793 | st->touch_st.touching = true; |
2794 | } |
2795 | |
2796 | -static void at91_adc_no_pen_detect_interrupt(struct at91_adc_state *st) |
2797 | +static void at91_adc_no_pen_detect_interrupt(struct iio_dev *indio_dev) |
2798 | { |
2799 | - struct iio_dev *indio_dev = iio_priv_to_dev(st); |
2800 | + struct at91_adc_state *st = iio_priv(indio_dev); |
2801 | |
2802 | at91_adc_writel(st, AT91_SAMA5D2_TRGR, |
2803 | AT91_SAMA5D2_TRGR_TRGMOD_NO_TRIGGER); |
2804 | @@ -1247,7 +1249,7 @@ static void at91_adc_workq_handler(struct work_struct *workq) |
2805 | struct at91_adc_touch, workq); |
2806 | struct at91_adc_state *st = container_of(touch_st, |
2807 | struct at91_adc_state, touch_st); |
2808 | - struct iio_dev *indio_dev = iio_priv_to_dev(st); |
2809 | + struct iio_dev *indio_dev = st->indio_dev; |
2810 | |
2811 | iio_push_to_buffers(indio_dev, st->buffer); |
2812 | } |
2813 | @@ -1268,7 +1270,7 @@ static irqreturn_t at91_adc_interrupt(int irq, void *private) |
2814 | at91_adc_pen_detect_interrupt(st); |
2815 | } else if ((status & AT91_SAMA5D2_IER_NOPEN)) { |
2816 | /* nopen detected IRQ */ |
2817 | - at91_adc_no_pen_detect_interrupt(st); |
2818 | + at91_adc_no_pen_detect_interrupt(indio); |
2819 | } else if ((status & AT91_SAMA5D2_ISR_PENS) && |
2820 | ((status & rdy_mask) == rdy_mask)) { |
2821 | /* periodic trigger IRQ - during pen sense */ |
2822 | @@ -1435,7 +1437,7 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev, |
2823 | val > st->soc_info.max_sample_rate) |
2824 | return -EINVAL; |
2825 | |
2826 | - at91_adc_setup_samp_freq(st, val); |
2827 | + at91_adc_setup_samp_freq(indio_dev, val); |
2828 | return 0; |
2829 | default: |
2830 | return -EINVAL; |
2831 | @@ -1573,8 +1575,10 @@ static int at91_adc_update_scan_mode(struct iio_dev *indio_dev, |
2832 | return 0; |
2833 | } |
2834 | |
2835 | -static void at91_adc_hw_init(struct at91_adc_state *st) |
2836 | +static void at91_adc_hw_init(struct iio_dev *indio_dev) |
2837 | { |
2838 | + struct at91_adc_state *st = iio_priv(indio_dev); |
2839 | + |
2840 | at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_SWRST); |
2841 | at91_adc_writel(st, AT91_SAMA5D2_IDR, 0xffffffff); |
2842 | /* |
2843 | @@ -1584,7 +1588,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st) |
2844 | at91_adc_writel(st, AT91_SAMA5D2_MR, |
2845 | AT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH); |
2846 | |
2847 | - at91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate); |
2848 | + at91_adc_setup_samp_freq(indio_dev, st->soc_info.min_sample_rate); |
2849 | |
2850 | /* configure extended mode register */ |
2851 | at91_adc_config_emr(st); |
2852 | @@ -1667,6 +1671,7 @@ static int at91_adc_probe(struct platform_device *pdev) |
2853 | indio_dev->num_channels = ARRAY_SIZE(at91_adc_channels); |
2854 | |
2855 | st = iio_priv(indio_dev); |
2856 | + st->indio_dev = indio_dev; |
2857 | |
2858 | bitmap_set(&st->touch_st.channels_bitmask, |
2859 | AT91_SAMA5D2_TOUCH_X_CHAN_IDX, 1); |
2860 | @@ -1778,7 +1783,7 @@ static int at91_adc_probe(struct platform_device *pdev) |
2861 | goto vref_disable; |
2862 | } |
2863 | |
2864 | - at91_adc_hw_init(st); |
2865 | + at91_adc_hw_init(indio_dev); |
2866 | |
2867 | ret = clk_prepare_enable(st->per_clk); |
2868 | if (ret) |
2869 | @@ -1894,7 +1899,7 @@ static __maybe_unused int at91_adc_resume(struct device *dev) |
2870 | if (ret) |
2871 | goto vref_disable_resume; |
2872 | |
2873 | - at91_adc_hw_init(st); |
2874 | + at91_adc_hw_init(indio_dev); |
2875 | |
2876 | /* reconfiguring trigger hardware state */ |
2877 | if (!iio_buffer_enabled(indio_dev)) |
2878 | diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c |
2879 | index 62e6c8badd22a..a3265166fd835 100644 |
2880 | --- a/drivers/iio/adc/hx711.c |
2881 | +++ b/drivers/iio/adc/hx711.c |
2882 | @@ -85,9 +85,9 @@ struct hx711_data { |
2883 | struct mutex lock; |
2884 | /* |
2885 | * triggered buffer |
2886 | - * 2x32-bit channel + 64-bit timestamp |
2887 | + * 2x32-bit channel + 64-bit naturally aligned timestamp |
2888 | */ |
2889 | - u32 buffer[4]; |
2890 | + u32 buffer[4] __aligned(8); |
2891 | /* |
2892 | * delay after a rising edge on SCK until the data is ready DOUT |
2893 | * this is dependent on the hx711 where the datasheet tells a |
2894 | diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c |
2895 | index 9d2f74c2489a8..01f85bbe6a2e5 100644 |
2896 | --- a/drivers/iio/adc/mxs-lradc-adc.c |
2897 | +++ b/drivers/iio/adc/mxs-lradc-adc.c |
2898 | @@ -115,7 +115,8 @@ struct mxs_lradc_adc { |
2899 | struct device *dev; |
2900 | |
2901 | void __iomem *base; |
2902 | - u32 buffer[10]; |
2903 | + /* Maximum of 8 channels + 8 byte ts */ |
2904 | + u32 buffer[10] __aligned(8); |
2905 | struct iio_trigger *trig; |
2906 | struct completion completion; |
2907 | spinlock_t lock; |
2908 | diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c |
2909 | index 871690a476610..7929891f568eb 100644 |
2910 | --- a/drivers/iio/adc/ti-ads1015.c |
2911 | +++ b/drivers/iio/adc/ti-ads1015.c |
2912 | @@ -388,10 +388,14 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p) |
2913 | struct iio_poll_func *pf = p; |
2914 | struct iio_dev *indio_dev = pf->indio_dev; |
2915 | struct ads1015_data *data = iio_priv(indio_dev); |
2916 | - s16 buf[8]; /* 1x s16 ADC val + 3x s16 padding + 4x s16 timestamp */ |
2917 | + /* Ensure natural alignment of timestamp */ |
2918 | + struct { |
2919 | + s16 chan; |
2920 | + s64 timestamp __aligned(8); |
2921 | + } scan; |
2922 | int chan, ret, res; |
2923 | |
2924 | - memset(buf, 0, sizeof(buf)); |
2925 | + memset(&scan, 0, sizeof(scan)); |
2926 | |
2927 | mutex_lock(&data->lock); |
2928 | chan = find_first_bit(indio_dev->active_scan_mask, |
2929 | @@ -402,10 +406,10 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p) |
2930 | goto err; |
2931 | } |
2932 | |
2933 | - buf[0] = res; |
2934 | + scan.chan = res; |
2935 | mutex_unlock(&data->lock); |
2936 | |
2937 | - iio_push_to_buffers_with_timestamp(indio_dev, buf, |
2938 | + iio_push_to_buffers_with_timestamp(indio_dev, &scan, |
2939 | iio_get_time_ns(indio_dev)); |
2940 | |
2941 | err: |
2942 | diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c |
2943 | index 14fe7c320b522..55a2d619d6dda 100644 |
2944 | --- a/drivers/iio/adc/ti-ads8688.c |
2945 | +++ b/drivers/iio/adc/ti-ads8688.c |
2946 | @@ -383,7 +383,8 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) |
2947 | { |
2948 | struct iio_poll_func *pf = p; |
2949 | struct iio_dev *indio_dev = pf->indio_dev; |
2950 | - u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; |
2951 | + /* Ensure naturally aligned timestamp */ |
2952 | + u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)] __aligned(8); |
2953 | int i, j = 0; |
2954 | |
2955 | for (i = 0; i < indio_dev->masklength; i++) { |
2956 | diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c |
2957 | index 98b30475bbc6a..0d29fe974d70e 100644 |
2958 | --- a/drivers/iio/adc/vf610_adc.c |
2959 | +++ b/drivers/iio/adc/vf610_adc.c |
2960 | @@ -167,7 +167,11 @@ struct vf610_adc { |
2961 | u32 sample_freq_avail[5]; |
2962 | |
2963 | struct completion completion; |
2964 | - u16 buffer[8]; |
2965 | + /* Ensure the timestamp is naturally aligned */ |
2966 | + struct { |
2967 | + u16 chan; |
2968 | + s64 timestamp __aligned(8); |
2969 | + } scan; |
2970 | }; |
2971 | |
2972 | static const u32 vf610_hw_avgs[] = { 1, 4, 8, 16, 32 }; |
2973 | @@ -579,9 +583,9 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id) |
2974 | if (coco & VF610_ADC_HS_COCO0) { |
2975 | info->value = vf610_adc_read_data(info); |
2976 | if (iio_buffer_enabled(indio_dev)) { |
2977 | - info->buffer[0] = info->value; |
2978 | + info->scan.chan = info->value; |
2979 | iio_push_to_buffers_with_timestamp(indio_dev, |
2980 | - info->buffer, |
2981 | + &info->scan, |
2982 | iio_get_time_ns(indio_dev)); |
2983 | iio_trigger_notify_done(indio_dev->trig); |
2984 | } else |
2985 | diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c |
2986 | index 428ddfc13acb9..276bed47e8d66 100644 |
2987 | --- a/drivers/iio/gyro/bmg160_core.c |
2988 | +++ b/drivers/iio/gyro/bmg160_core.c |
2989 | @@ -96,7 +96,11 @@ struct bmg160_data { |
2990 | struct iio_trigger *motion_trig; |
2991 | struct iio_mount_matrix orientation; |
2992 | struct mutex mutex; |
2993 | - s16 buffer[8]; |
2994 | + /* Ensure naturally aligned timestamp */ |
2995 | + struct { |
2996 | + s16 chans[3]; |
2997 | + s64 timestamp __aligned(8); |
2998 | + } scan; |
2999 | u32 dps_range; |
3000 | int ev_enable_state; |
3001 | int slope_thres; |
3002 | @@ -880,12 +884,12 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p) |
3003 | |
3004 | mutex_lock(&data->mutex); |
3005 | ret = regmap_bulk_read(data->regmap, BMG160_REG_XOUT_L, |
3006 | - data->buffer, AXIS_MAX * 2); |
3007 | + data->scan.chans, AXIS_MAX * 2); |
3008 | mutex_unlock(&data->mutex); |
3009 | if (ret < 0) |
3010 | goto err; |
3011 | |
3012 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3013 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3014 | pf->timestamp); |
3015 | err: |
3016 | iio_trigger_notify_done(indio_dev->trig); |
3017 | diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c |
3018 | index 3bac98e731d9c..894922a315fe6 100644 |
3019 | --- a/drivers/iio/humidity/am2315.c |
3020 | +++ b/drivers/iio/humidity/am2315.c |
3021 | @@ -33,7 +33,11 @@ |
3022 | struct am2315_data { |
3023 | struct i2c_client *client; |
3024 | struct mutex lock; |
3025 | - s16 buffer[8]; /* 2x16-bit channels + 2x16 padding + 4x16 timestamp */ |
3026 | + /* Ensure timestamp is naturally aligned */ |
3027 | + struct { |
3028 | + s16 chans[2]; |
3029 | + s64 timestamp __aligned(8); |
3030 | + } scan; |
3031 | }; |
3032 | |
3033 | struct am2315_sensor_data { |
3034 | @@ -167,20 +171,20 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p) |
3035 | |
3036 | mutex_lock(&data->lock); |
3037 | if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) { |
3038 | - data->buffer[0] = sensor_data.hum_data; |
3039 | - data->buffer[1] = sensor_data.temp_data; |
3040 | + data->scan.chans[0] = sensor_data.hum_data; |
3041 | + data->scan.chans[1] = sensor_data.temp_data; |
3042 | } else { |
3043 | i = 0; |
3044 | for_each_set_bit(bit, indio_dev->active_scan_mask, |
3045 | indio_dev->masklength) { |
3046 | - data->buffer[i] = (bit ? sensor_data.temp_data : |
3047 | - sensor_data.hum_data); |
3048 | + data->scan.chans[i] = (bit ? sensor_data.temp_data : |
3049 | + sensor_data.hum_data); |
3050 | i++; |
3051 | } |
3052 | } |
3053 | mutex_unlock(&data->lock); |
3054 | |
3055 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3056 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3057 | pf->timestamp); |
3058 | err: |
3059 | iio_trigger_notify_done(indio_dev->trig); |
3060 | diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c |
3061 | index 59e33302042c5..afa9d26362da2 100644 |
3062 | --- a/drivers/iio/imu/adis16400.c |
3063 | +++ b/drivers/iio/imu/adis16400.c |
3064 | @@ -651,9 +651,6 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p) |
3065 | void *buffer; |
3066 | int ret; |
3067 | |
3068 | - if (!adis->buffer) |
3069 | - return -ENOMEM; |
3070 | - |
3071 | if (!(st->variant->flags & ADIS16400_NO_BURST) && |
3072 | st->adis.spi->max_speed_hz > ADIS16400_SPI_BURST) { |
3073 | st->adis.spi->max_speed_hz = ADIS16400_SPI_BURST; |
3074 | diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c |
3075 | index 4998a89d083d5..8f8c1a87567b2 100644 |
3076 | --- a/drivers/iio/imu/adis_buffer.c |
3077 | +++ b/drivers/iio/imu/adis_buffer.c |
3078 | @@ -125,9 +125,6 @@ static irqreturn_t adis_trigger_handler(int irq, void *p) |
3079 | struct adis *adis = iio_device_get_drvdata(indio_dev); |
3080 | int ret; |
3081 | |
3082 | - if (!adis->buffer) |
3083 | - return -ENOMEM; |
3084 | - |
3085 | if (adis->data->has_paging) { |
3086 | mutex_lock(&adis->txrx_lock); |
3087 | if (adis->current_page != 0) { |
3088 | diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c |
3089 | index e37894f0ae0b6..15906925e588b 100644 |
3090 | --- a/drivers/iio/light/isl29125.c |
3091 | +++ b/drivers/iio/light/isl29125.c |
3092 | @@ -51,7 +51,11 @@ |
3093 | struct isl29125_data { |
3094 | struct i2c_client *client; |
3095 | u8 conf1; |
3096 | - u16 buffer[8]; /* 3x 16-bit, padding, 8 bytes timestamp */ |
3097 | + /* Ensure timestamp is naturally aligned */ |
3098 | + struct { |
3099 | + u16 chans[3]; |
3100 | + s64 timestamp __aligned(8); |
3101 | + } scan; |
3102 | }; |
3103 | |
3104 | #define ISL29125_CHANNEL(_color, _si) { \ |
3105 | @@ -184,10 +188,10 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p) |
3106 | if (ret < 0) |
3107 | goto done; |
3108 | |
3109 | - data->buffer[j++] = ret; |
3110 | + data->scan.chans[j++] = ret; |
3111 | } |
3112 | |
3113 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3114 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3115 | iio_get_time_ns(indio_dev)); |
3116 | |
3117 | done: |
3118 | diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c |
3119 | index ceddb6a3b61bb..8bc01e8a424b0 100644 |
3120 | --- a/drivers/iio/light/ltr501.c |
3121 | +++ b/drivers/iio/light/ltr501.c |
3122 | @@ -32,9 +32,12 @@ |
3123 | #define LTR501_PART_ID 0x86 |
3124 | #define LTR501_MANUFAC_ID 0x87 |
3125 | #define LTR501_ALS_DATA1 0x88 /* 16-bit, little endian */ |
3126 | +#define LTR501_ALS_DATA1_UPPER 0x89 /* upper 8 bits of LTR501_ALS_DATA1 */ |
3127 | #define LTR501_ALS_DATA0 0x8a /* 16-bit, little endian */ |
3128 | +#define LTR501_ALS_DATA0_UPPER 0x8b /* upper 8 bits of LTR501_ALS_DATA0 */ |
3129 | #define LTR501_ALS_PS_STATUS 0x8c |
3130 | #define LTR501_PS_DATA 0x8d /* 16-bit, little endian */ |
3131 | +#define LTR501_PS_DATA_UPPER 0x8e /* upper 8 bits of LTR501_PS_DATA */ |
3132 | #define LTR501_INTR 0x8f /* output mode, polarity, mode */ |
3133 | #define LTR501_PS_THRESH_UP 0x90 /* 11 bit, ps upper threshold */ |
3134 | #define LTR501_PS_THRESH_LOW 0x92 /* 11 bit, ps lower threshold */ |
3135 | @@ -405,18 +408,19 @@ static int ltr501_read_als(struct ltr501_data *data, __le16 buf[2]) |
3136 | |
3137 | static int ltr501_read_ps(struct ltr501_data *data) |
3138 | { |
3139 | - int ret, status; |
3140 | + __le16 status; |
3141 | + int ret; |
3142 | |
3143 | ret = ltr501_drdy(data, LTR501_STATUS_PS_RDY); |
3144 | if (ret < 0) |
3145 | return ret; |
3146 | |
3147 | ret = regmap_bulk_read(data->regmap, LTR501_PS_DATA, |
3148 | - &status, 2); |
3149 | + &status, sizeof(status)); |
3150 | if (ret < 0) |
3151 | return ret; |
3152 | |
3153 | - return status; |
3154 | + return le16_to_cpu(status); |
3155 | } |
3156 | |
3157 | static int ltr501_read_intr_prst(struct ltr501_data *data, |
3158 | @@ -1204,7 +1208,7 @@ static struct ltr501_chip_info ltr501_chip_info_tbl[] = { |
3159 | .als_gain_tbl_size = ARRAY_SIZE(ltr559_als_gain_tbl), |
3160 | .ps_gain = ltr559_ps_gain_tbl, |
3161 | .ps_gain_tbl_size = ARRAY_SIZE(ltr559_ps_gain_tbl), |
3162 | - .als_mode_active = BIT(1), |
3163 | + .als_mode_active = BIT(0), |
3164 | .als_gain_mask = BIT(2) | BIT(3) | BIT(4), |
3165 | .als_gain_shift = 2, |
3166 | .info = <r501_info, |
3167 | @@ -1353,9 +1357,12 @@ static bool ltr501_is_volatile_reg(struct device *dev, unsigned int reg) |
3168 | { |
3169 | switch (reg) { |
3170 | case LTR501_ALS_DATA1: |
3171 | + case LTR501_ALS_DATA1_UPPER: |
3172 | case LTR501_ALS_DATA0: |
3173 | + case LTR501_ALS_DATA0_UPPER: |
3174 | case LTR501_ALS_PS_STATUS: |
3175 | case LTR501_PS_DATA: |
3176 | + case LTR501_PS_DATA_UPPER: |
3177 | return true; |
3178 | default: |
3179 | return false; |
3180 | diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c |
3181 | index 7c0291c5fe76e..85bfe3b63f4fe 100644 |
3182 | --- a/drivers/iio/light/tcs3414.c |
3183 | +++ b/drivers/iio/light/tcs3414.c |
3184 | @@ -53,7 +53,11 @@ struct tcs3414_data { |
3185 | u8 control; |
3186 | u8 gain; |
3187 | u8 timing; |
3188 | - u16 buffer[8]; /* 4x 16-bit + 8 bytes timestamp */ |
3189 | + /* Ensure timestamp is naturally aligned */ |
3190 | + struct { |
3191 | + u16 chans[4]; |
3192 | + s64 timestamp __aligned(8); |
3193 | + } scan; |
3194 | }; |
3195 | |
3196 | #define TCS3414_CHANNEL(_color, _si, _addr) { \ |
3197 | @@ -209,10 +213,10 @@ static irqreturn_t tcs3414_trigger_handler(int irq, void *p) |
3198 | if (ret < 0) |
3199 | goto done; |
3200 | |
3201 | - data->buffer[j++] = ret; |
3202 | + data->scan.chans[j++] = ret; |
3203 | } |
3204 | |
3205 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3206 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3207 | iio_get_time_ns(indio_dev)); |
3208 | |
3209 | done: |
3210 | diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c |
3211 | index 12ad344410103..9ea543c5cf5e6 100644 |
3212 | --- a/drivers/iio/light/tcs3472.c |
3213 | +++ b/drivers/iio/light/tcs3472.c |
3214 | @@ -64,7 +64,11 @@ struct tcs3472_data { |
3215 | u8 control; |
3216 | u8 atime; |
3217 | u8 apers; |
3218 | - u16 buffer[8]; /* 4 16-bit channels + 64-bit timestamp */ |
3219 | + /* Ensure timestamp is naturally aligned */ |
3220 | + struct { |
3221 | + u16 chans[4]; |
3222 | + s64 timestamp __aligned(8); |
3223 | + } scan; |
3224 | }; |
3225 | |
3226 | static const struct iio_event_spec tcs3472_events[] = { |
3227 | @@ -386,10 +390,10 @@ static irqreturn_t tcs3472_trigger_handler(int irq, void *p) |
3228 | if (ret < 0) |
3229 | goto done; |
3230 | |
3231 | - data->buffer[j++] = ret; |
3232 | + data->scan.chans[j++] = ret; |
3233 | } |
3234 | |
3235 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3236 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3237 | iio_get_time_ns(indio_dev)); |
3238 | |
3239 | done: |
3240 | @@ -532,7 +536,8 @@ static int tcs3472_probe(struct i2c_client *client, |
3241 | return 0; |
3242 | |
3243 | free_irq: |
3244 | - free_irq(client->irq, indio_dev); |
3245 | + if (client->irq) |
3246 | + free_irq(client->irq, indio_dev); |
3247 | buffer_cleanup: |
3248 | iio_triggered_buffer_cleanup(indio_dev); |
3249 | return ret; |
3250 | @@ -560,7 +565,8 @@ static int tcs3472_remove(struct i2c_client *client) |
3251 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
3252 | |
3253 | iio_device_unregister(indio_dev); |
3254 | - free_irq(client->irq, indio_dev); |
3255 | + if (client->irq) |
3256 | + free_irq(client->irq, indio_dev); |
3257 | iio_triggered_buffer_cleanup(indio_dev); |
3258 | tcs3472_powerdown(iio_priv(indio_dev)); |
3259 | |
3260 | diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c |
3261 | index cca4db312bd3f..234623ab38177 100644 |
3262 | --- a/drivers/iio/light/vcnl4035.c |
3263 | +++ b/drivers/iio/light/vcnl4035.c |
3264 | @@ -102,7 +102,8 @@ static irqreturn_t vcnl4035_trigger_consumer_handler(int irq, void *p) |
3265 | struct iio_poll_func *pf = p; |
3266 | struct iio_dev *indio_dev = pf->indio_dev; |
3267 | struct vcnl4035_data *data = iio_priv(indio_dev); |
3268 | - u8 buffer[ALIGN(sizeof(u16), sizeof(s64)) + sizeof(s64)]; |
3269 | + /* Ensure naturally aligned timestamp */ |
3270 | + u8 buffer[ALIGN(sizeof(u16), sizeof(s64)) + sizeof(s64)] __aligned(8); |
3271 | int ret; |
3272 | |
3273 | ret = regmap_read(data->regmap, VCNL4035_ALS_DATA, (int *)buffer); |
3274 | diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c |
3275 | index d4de16750b107..48685d785c1b6 100644 |
3276 | --- a/drivers/iio/magnetometer/bmc150_magn.c |
3277 | +++ b/drivers/iio/magnetometer/bmc150_magn.c |
3278 | @@ -136,8 +136,11 @@ struct bmc150_magn_data { |
3279 | struct mutex mutex; |
3280 | struct regmap *regmap; |
3281 | struct iio_mount_matrix orientation; |
3282 | - /* 4 x 32 bits for x, y z, 4 bytes align, 64 bits timestamp */ |
3283 | - s32 buffer[6]; |
3284 | + /* Ensure timestamp is naturally aligned */ |
3285 | + struct { |
3286 | + s32 chans[3]; |
3287 | + s64 timestamp __aligned(8); |
3288 | + } scan; |
3289 | struct iio_trigger *dready_trig; |
3290 | bool dready_trigger_on; |
3291 | int max_odr; |
3292 | @@ -673,11 +676,11 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p) |
3293 | int ret; |
3294 | |
3295 | mutex_lock(&data->mutex); |
3296 | - ret = bmc150_magn_read_xyz(data, data->buffer); |
3297 | + ret = bmc150_magn_read_xyz(data, data->scan.chans); |
3298 | if (ret < 0) |
3299 | goto err; |
3300 | |
3301 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3302 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3303 | pf->timestamp); |
3304 | |
3305 | err: |
3306 | diff --git a/drivers/iio/magnetometer/hmc5843.h b/drivers/iio/magnetometer/hmc5843.h |
3307 | index b0dee87a8b20e..b68bb55909e13 100644 |
3308 | --- a/drivers/iio/magnetometer/hmc5843.h |
3309 | +++ b/drivers/iio/magnetometer/hmc5843.h |
3310 | @@ -33,7 +33,8 @@ enum hmc5843_ids { |
3311 | * @lock: update and read regmap data |
3312 | * @regmap: hardware access register maps |
3313 | * @variant: describe chip variants |
3314 | - * @buffer: 3x 16-bit channels + padding + 64-bit timestamp |
3315 | + * @scan: buffer to pack data for passing to |
3316 | + * iio_push_to_buffers_with_timestamp() |
3317 | */ |
3318 | struct hmc5843_data { |
3319 | struct device *dev; |
3320 | @@ -41,7 +42,10 @@ struct hmc5843_data { |
3321 | struct regmap *regmap; |
3322 | const struct hmc5843_chip_info *variant; |
3323 | struct iio_mount_matrix orientation; |
3324 | - __be16 buffer[8]; |
3325 | + struct { |
3326 | + __be16 chans[3]; |
3327 | + s64 timestamp __aligned(8); |
3328 | + } scan; |
3329 | }; |
3330 | |
3331 | int hmc5843_common_probe(struct device *dev, struct regmap *regmap, |
3332 | diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c |
3333 | index c44a4292da924..aef78275260f7 100644 |
3334 | --- a/drivers/iio/magnetometer/hmc5843_core.c |
3335 | +++ b/drivers/iio/magnetometer/hmc5843_core.c |
3336 | @@ -446,13 +446,13 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p) |
3337 | } |
3338 | |
3339 | ret = regmap_bulk_read(data->regmap, HMC5843_DATA_OUT_MSB_REGS, |
3340 | - data->buffer, 3 * sizeof(__be16)); |
3341 | + data->scan.chans, sizeof(data->scan.chans)); |
3342 | |
3343 | mutex_unlock(&data->lock); |
3344 | if (ret < 0) |
3345 | goto done; |
3346 | |
3347 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3348 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3349 | iio_get_time_ns(indio_dev)); |
3350 | |
3351 | done: |
3352 | diff --git a/drivers/iio/magnetometer/rm3100-core.c b/drivers/iio/magnetometer/rm3100-core.c |
3353 | index 7c20918d81086..f31ff225fe616 100644 |
3354 | --- a/drivers/iio/magnetometer/rm3100-core.c |
3355 | +++ b/drivers/iio/magnetometer/rm3100-core.c |
3356 | @@ -76,7 +76,8 @@ struct rm3100_data { |
3357 | bool use_interrupt; |
3358 | int conversion_time; |
3359 | int scale; |
3360 | - u8 buffer[RM3100_SCAN_BYTES]; |
3361 | + /* Ensure naturally aligned timestamp */ |
3362 | + u8 buffer[RM3100_SCAN_BYTES] __aligned(8); |
3363 | struct iio_trigger *drdy_trig; |
3364 | |
3365 | /* |
3366 | diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c |
3367 | index a0e5f530faa9b..d6db07264a7b3 100644 |
3368 | --- a/drivers/iio/potentiostat/lmp91000.c |
3369 | +++ b/drivers/iio/potentiostat/lmp91000.c |
3370 | @@ -71,8 +71,8 @@ struct lmp91000_data { |
3371 | |
3372 | struct completion completion; |
3373 | u8 chan_select; |
3374 | - |
3375 | - u32 buffer[4]; /* 64-bit data + 64-bit timestamp */ |
3376 | + /* 64-bit data + 64-bit naturally aligned timestamp */ |
3377 | + u32 buffer[4] __aligned(8); |
3378 | }; |
3379 | |
3380 | static const struct iio_chan_spec lmp91000_channels[] = { |
3381 | diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c |
3382 | index b591c63bd6c49..718150a931337 100644 |
3383 | --- a/drivers/iio/proximity/as3935.c |
3384 | +++ b/drivers/iio/proximity/as3935.c |
3385 | @@ -61,7 +61,11 @@ struct as3935_state { |
3386 | unsigned long noise_tripped; |
3387 | u32 tune_cap; |
3388 | u32 nflwdth_reg; |
3389 | - u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */ |
3390 | + /* Ensure timestamp is naturally aligned */ |
3391 | + struct { |
3392 | + u8 chan; |
3393 | + s64 timestamp __aligned(8); |
3394 | + } scan; |
3395 | u8 buf[2] ____cacheline_aligned; |
3396 | }; |
3397 | |
3398 | @@ -227,8 +231,8 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) |
3399 | if (ret) |
3400 | goto err_read; |
3401 | |
3402 | - st->buffer[0] = val & AS3935_DATA_MASK; |
3403 | - iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, |
3404 | + st->scan.chan = val & AS3935_DATA_MASK; |
3405 | + iio_push_to_buffers_with_timestamp(indio_dev, &st->scan, |
3406 | iio_get_time_ns(indio_dev)); |
3407 | err_read: |
3408 | iio_trigger_notify_done(indio_dev->trig); |
3409 | diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c |
3410 | index 5ae549075b27c..56d6e9f927f40 100644 |
3411 | --- a/drivers/iio/proximity/isl29501.c |
3412 | +++ b/drivers/iio/proximity/isl29501.c |
3413 | @@ -938,7 +938,7 @@ static irqreturn_t isl29501_trigger_handler(int irq, void *p) |
3414 | struct iio_dev *indio_dev = pf->indio_dev; |
3415 | struct isl29501_private *isl29501 = iio_priv(indio_dev); |
3416 | const unsigned long *active_mask = indio_dev->active_scan_mask; |
3417 | - u32 buffer[4] = {}; /* 1x16-bit + ts */ |
3418 | + u32 buffer[4] __aligned(8) = {}; /* 1x16-bit + naturally aligned ts */ |
3419 | |
3420 | if (test_bit(ISL29501_DISTANCE_SCAN_INDEX, active_mask)) |
3421 | isl29501_register_read(isl29501, REG_DISTANCE, buffer); |
3422 | diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c |
3423 | index 67f85268b63db..0c76170224071 100644 |
3424 | --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c |
3425 | +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c |
3426 | @@ -43,7 +43,11 @@ struct lidar_data { |
3427 | int (*xfer)(struct lidar_data *data, u8 reg, u8 *val, int len); |
3428 | int i2c_enabled; |
3429 | |
3430 | - u16 buffer[8]; /* 2 byte distance + 8 byte timestamp */ |
3431 | + /* Ensure timestamp is naturally aligned */ |
3432 | + struct { |
3433 | + u16 chan; |
3434 | + s64 timestamp __aligned(8); |
3435 | + } scan; |
3436 | }; |
3437 | |
3438 | static const struct iio_chan_spec lidar_channels[] = { |
3439 | @@ -228,9 +232,9 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private) |
3440 | struct lidar_data *data = iio_priv(indio_dev); |
3441 | int ret; |
3442 | |
3443 | - ret = lidar_get_measurement(data, data->buffer); |
3444 | + ret = lidar_get_measurement(data, &data->scan.chan); |
3445 | if (!ret) { |
3446 | - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
3447 | + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
3448 | iio_get_time_ns(indio_dev)); |
3449 | } else if (ret != -EINVAL) { |
3450 | dev_err(&data->client->dev, "cannot read LIDAR measurement"); |
3451 | diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c |
3452 | index b23ce446b7be6..c99bc514c5e1e 100644 |
3453 | --- a/drivers/iio/proximity/srf08.c |
3454 | +++ b/drivers/iio/proximity/srf08.c |
3455 | @@ -63,11 +63,11 @@ struct srf08_data { |
3456 | int range_mm; |
3457 | struct mutex lock; |
3458 | |
3459 | - /* |
3460 | - * triggered buffer |
3461 | - * 1x16-bit channel + 3x16 padding + 4x16 timestamp |
3462 | - */ |
3463 | - s16 buffer[8]; |
3464 | + /* Ensure timestamp is naturally aligned */ |
3465 | + struct { |
3466 | + s16 chan; |
3467 | + s64 timestamp __aligned(8); |
3468 | + } scan; |
3469 | |
3470 | /* Sensor-Type */ |
3471 | enum srf08_sensor_type sensor_type; |
3472 | @@ -190,9 +190,9 @@ static irqreturn_t srf08_trigger_handler(int irq, void *p) |
3473 | |
3474 | mutex_lock(&data->lock); |
3475 | |
3476 | - data->buffer[0] = sensor_data; |
3477 | + data->scan.chan = sensor_data; |
3478 | iio_push_to_buffers_with_timestamp(indio_dev, |
3479 | - data->buffer, pf->timestamp); |
3480 | + &data->scan, pf->timestamp); |
3481 | |
3482 | mutex_unlock(&data->lock); |
3483 | err: |
3484 | diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
3485 | index c398d1a64614c..d413dafb9211d 100644 |
3486 | --- a/drivers/infiniband/core/uverbs_cmd.c |
3487 | +++ b/drivers/infiniband/core/uverbs_cmd.c |
3488 | @@ -3031,12 +3031,29 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs) |
3489 | if (!wq) |
3490 | return -EINVAL; |
3491 | |
3492 | - wq_attr.curr_wq_state = cmd.curr_wq_state; |
3493 | - wq_attr.wq_state = cmd.wq_state; |
3494 | if (cmd.attr_mask & IB_WQ_FLAGS) { |
3495 | wq_attr.flags = cmd.flags; |
3496 | wq_attr.flags_mask = cmd.flags_mask; |
3497 | } |
3498 | + |
3499 | + if (cmd.attr_mask & IB_WQ_CUR_STATE) { |
3500 | + if (cmd.curr_wq_state > IB_WQS_ERR) |
3501 | + return -EINVAL; |
3502 | + |
3503 | + wq_attr.curr_wq_state = cmd.curr_wq_state; |
3504 | + } else { |
3505 | + wq_attr.curr_wq_state = wq->state; |
3506 | + } |
3507 | + |
3508 | + if (cmd.attr_mask & IB_WQ_STATE) { |
3509 | + if (cmd.wq_state > IB_WQS_ERR) |
3510 | + return -EINVAL; |
3511 | + |
3512 | + wq_attr.wq_state = cmd.wq_state; |
3513 | + } else { |
3514 | + wq_attr.wq_state = wq_attr.curr_wq_state; |
3515 | + } |
3516 | + |
3517 | ret = wq->device->ops.modify_wq(wq, &wq_attr, cmd.attr_mask, |
3518 | &attrs->driver_udata); |
3519 | uobj_put_obj_read(wq); |
3520 | diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c |
3521 | index 6e2b3e2f83f16..17ce928e41bde 100644 |
3522 | --- a/drivers/infiniband/hw/mlx4/qp.c |
3523 | +++ b/drivers/infiniband/hw/mlx4/qp.c |
3524 | @@ -4294,13 +4294,8 @@ int mlx4_ib_modify_wq(struct ib_wq *ibwq, struct ib_wq_attr *wq_attr, |
3525 | if (wq_attr_mask & IB_WQ_FLAGS) |
3526 | return -EOPNOTSUPP; |
3527 | |
3528 | - cur_state = wq_attr_mask & IB_WQ_CUR_STATE ? wq_attr->curr_wq_state : |
3529 | - ibwq->state; |
3530 | - new_state = wq_attr_mask & IB_WQ_STATE ? wq_attr->wq_state : cur_state; |
3531 | - |
3532 | - if (cur_state < IB_WQS_RESET || cur_state > IB_WQS_ERR || |
3533 | - new_state < IB_WQS_RESET || new_state > IB_WQS_ERR) |
3534 | - return -EINVAL; |
3535 | + cur_state = wq_attr->curr_wq_state; |
3536 | + new_state = wq_attr->wq_state; |
3537 | |
3538 | if ((new_state == IB_WQS_RDY) && (cur_state == IB_WQS_ERR)) |
3539 | return -EINVAL; |
3540 | diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
3541 | index a173737cb0222..9025086a8932d 100644 |
3542 | --- a/drivers/infiniband/hw/mlx5/main.c |
3543 | +++ b/drivers/infiniband/hw/mlx5/main.c |
3544 | @@ -5871,8 +5871,6 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev, |
3545 | |
3546 | port->mp.mpi = NULL; |
3547 | |
3548 | - list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list); |
3549 | - |
3550 | spin_unlock(&port->mp.mpi_lock); |
3551 | |
3552 | err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev); |
3553 | @@ -6025,6 +6023,8 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev) |
3554 | dev->port[i].mp.mpi = NULL; |
3555 | } else { |
3556 | mlx5_ib_dbg(dev, "unbinding port_num: %d\n", i + 1); |
3557 | + list_add_tail(&dev->port[i].mp.mpi->list, |
3558 | + &mlx5_ib_unaffiliated_port_list); |
3559 | mlx5_ib_unbind_slave_port(dev, dev->port[i].mp.mpi); |
3560 | } |
3561 | } |
3562 | diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c |
3563 | index 09e29c6cb66dc..4540835e05bda 100644 |
3564 | --- a/drivers/infiniband/hw/mlx5/qp.c |
3565 | +++ b/drivers/infiniband/hw/mlx5/qp.c |
3566 | @@ -6317,10 +6317,8 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr, |
3567 | |
3568 | rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx); |
3569 | |
3570 | - curr_wq_state = (wq_attr_mask & IB_WQ_CUR_STATE) ? |
3571 | - wq_attr->curr_wq_state : wq->state; |
3572 | - wq_state = (wq_attr_mask & IB_WQ_STATE) ? |
3573 | - wq_attr->wq_state : curr_wq_state; |
3574 | + curr_wq_state = wq_attr->curr_wq_state; |
3575 | + wq_state = wq_attr->wq_state; |
3576 | if (curr_wq_state == IB_WQS_ERR) |
3577 | curr_wq_state = MLX5_RQC_STATE_ERR; |
3578 | if (wq_state == IB_WQS_ERR) |
3579 | diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c |
3580 | index d411356828911..7d1df737c6558 100644 |
3581 | --- a/drivers/infiniband/sw/rxe/rxe_net.c |
3582 | +++ b/drivers/infiniband/sw/rxe/rxe_net.c |
3583 | @@ -251,10 +251,8 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port, |
3584 | |
3585 | /* Create UDP socket */ |
3586 | err = udp_sock_create(net, &udp_cfg, &sock); |
3587 | - if (err < 0) { |
3588 | - pr_err("failed to create udp socket. err = %d\n", err); |
3589 | + if (err < 0) |
3590 | return ERR_PTR(err); |
3591 | - } |
3592 | |
3593 | tnl_cfg.encap_type = 1; |
3594 | tnl_cfg.encap_rcv = rxe_udp_encap_recv; |
3595 | @@ -660,6 +658,12 @@ static int rxe_net_ipv6_init(void) |
3596 | |
3597 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, |
3598 | htons(ROCE_V2_UDP_DPORT), true); |
3599 | + if (PTR_ERR(recv_sockets.sk6) == -EAFNOSUPPORT) { |
3600 | + recv_sockets.sk6 = NULL; |
3601 | + pr_warn("IPv6 is not supported, can not create a UDPv6 socket\n"); |
3602 | + return 0; |
3603 | + } |
3604 | + |
3605 | if (IS_ERR(recv_sockets.sk6)) { |
3606 | recv_sockets.sk6 = NULL; |
3607 | pr_err("Failed to create IPv6 UDP tunnel\n"); |
3608 | diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c |
3609 | index d427a343c09f6..53166b9ae67e5 100644 |
3610 | --- a/drivers/infiniband/sw/rxe/rxe_qp.c |
3611 | +++ b/drivers/infiniband/sw/rxe/rxe_qp.c |
3612 | @@ -152,7 +152,6 @@ static void free_rd_atomic_resources(struct rxe_qp *qp) |
3613 | void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res) |
3614 | { |
3615 | if (res->type == RXE_ATOMIC_MASK) { |
3616 | - rxe_drop_ref(qp); |
3617 | kfree_skb(res->atomic.skb); |
3618 | } else if (res->type == RXE_READ_MASK) { |
3619 | if (res->read.mr) |
3620 | diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c |
3621 | index c4a8195bf6709..186152bf79514 100644 |
3622 | --- a/drivers/infiniband/sw/rxe/rxe_resp.c |
3623 | +++ b/drivers/infiniband/sw/rxe/rxe_resp.c |
3624 | @@ -993,8 +993,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, |
3625 | goto out; |
3626 | } |
3627 | |
3628 | - rxe_add_ref(qp); |
3629 | - |
3630 | res = &qp->resp.resources[qp->resp.res_head]; |
3631 | free_rd_atomic_resource(qp, res); |
3632 | rxe_advance_resp_resource(qp); |
3633 | diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c |
3634 | index 430dc69750048..675fcd0952a2d 100644 |
3635 | --- a/drivers/input/joydev.c |
3636 | +++ b/drivers/input/joydev.c |
3637 | @@ -500,7 +500,7 @@ static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev, |
3638 | memcpy(joydev->keypam, keypam, len); |
3639 | |
3640 | for (i = 0; i < joydev->nkey; i++) |
3641 | - joydev->keymap[keypam[i] - BTN_MISC] = i; |
3642 | + joydev->keymap[joydev->keypam[i] - BTN_MISC] = i; |
3643 | |
3644 | out: |
3645 | kfree(keypam); |
3646 | diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig |
3647 | index 8911bc2ec42a8..ae0bdc4391059 100644 |
3648 | --- a/drivers/input/keyboard/Kconfig |
3649 | +++ b/drivers/input/keyboard/Kconfig |
3650 | @@ -68,9 +68,6 @@ config KEYBOARD_AMIGA |
3651 | To compile this driver as a module, choose M here: the |
3652 | module will be called amikbd. |
3653 | |
3654 | -config ATARI_KBD_CORE |
3655 | - bool |
3656 | - |
3657 | config KEYBOARD_APPLESPI |
3658 | tristate "Apple SPI keyboard and trackpad" |
3659 | depends on ACPI && EFI |
3660 | diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c |
3661 | index bb29a7c9a1c0c..54afb38601b9f 100644 |
3662 | --- a/drivers/input/keyboard/hil_kbd.c |
3663 | +++ b/drivers/input/keyboard/hil_kbd.c |
3664 | @@ -512,6 +512,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv) |
3665 | HIL_IDD_NUM_AXES_PER_SET(*idd)) { |
3666 | printk(KERN_INFO PREFIX |
3667 | "combo devices are not supported.\n"); |
3668 | + error = -EINVAL; |
3669 | goto bail1; |
3670 | } |
3671 | |
3672 | diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c |
3673 | index 397cb1d3f481b..544a8f40b81f1 100644 |
3674 | --- a/drivers/input/touchscreen/usbtouchscreen.c |
3675 | +++ b/drivers/input/touchscreen/usbtouchscreen.c |
3676 | @@ -251,7 +251,7 @@ static int e2i_init(struct usbtouch_usb *usbtouch) |
3677 | int ret; |
3678 | struct usb_device *udev = interface_to_usbdev(usbtouch->interface); |
3679 | |
3680 | - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
3681 | + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
3682 | 0x01, 0x02, 0x0000, 0x0081, |
3683 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
3684 | |
3685 | @@ -531,7 +531,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) |
3686 | if (ret) |
3687 | return ret; |
3688 | |
3689 | - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
3690 | + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
3691 | MTOUCHUSB_RESET, |
3692 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3693 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
3694 | @@ -543,7 +543,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) |
3695 | msleep(150); |
3696 | |
3697 | for (i = 0; i < 3; i++) { |
3698 | - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
3699 | + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
3700 | MTOUCHUSB_ASYNC_REPORT, |
3701 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3702 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); |
3703 | @@ -722,7 +722,7 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) |
3704 | } |
3705 | |
3706 | /* start sending data */ |
3707 | - ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), |
3708 | + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
3709 | TSC10_CMD_DATA1, |
3710 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
3711 | 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
3712 | diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c |
3713 | index 76bd2309e0234..9c3e630c6c4c8 100644 |
3714 | --- a/drivers/iommu/dma-iommu.c |
3715 | +++ b/drivers/iommu/dma-iommu.c |
3716 | @@ -216,9 +216,11 @@ resv_iova: |
3717 | lo = iova_pfn(iovad, start); |
3718 | hi = iova_pfn(iovad, end); |
3719 | reserve_iova(iovad, lo, hi); |
3720 | - } else { |
3721 | + } else if (end < start) { |
3722 | /* dma_ranges list should be sorted */ |
3723 | - dev_err(&dev->dev, "Failed to reserve IOVA\n"); |
3724 | + dev_err(&dev->dev, |
3725 | + "Failed to reserve IOVA [%pa-%pa]\n", |
3726 | + &start, &end); |
3727 | return -EINVAL; |
3728 | } |
3729 | |
3730 | diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig |
3731 | index 1988de1d64c05..2cbf66d1c3000 100644 |
3732 | --- a/drivers/leds/Kconfig |
3733 | +++ b/drivers/leds/Kconfig |
3734 | @@ -144,6 +144,7 @@ config LEDS_LM3530 |
3735 | |
3736 | config LEDS_LM3532 |
3737 | tristate "LCD Backlight driver for LM3532" |
3738 | + select REGMAP_I2C |
3739 | depends on LEDS_CLASS |
3740 | depends on I2C |
3741 | help |
3742 | diff --git a/drivers/leds/leds-as3645a.c b/drivers/leds/leds-as3645a.c |
3743 | index b7e0ae1af8fa5..1dc6f1b24ddb5 100644 |
3744 | --- a/drivers/leds/leds-as3645a.c |
3745 | +++ b/drivers/leds/leds-as3645a.c |
3746 | @@ -544,6 +544,7 @@ static int as3645a_parse_node(struct as3645a *flash, |
3747 | if (!flash->indicator_node) { |
3748 | dev_warn(&flash->client->dev, |
3749 | "can't find indicator node\n"); |
3750 | + rval = -ENODEV; |
3751 | goto out_err; |
3752 | } |
3753 | |
3754 | diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c |
3755 | index 670efee9b1317..cd30b3b46e76c 100644 |
3756 | --- a/drivers/leds/leds-ktd2692.c |
3757 | +++ b/drivers/leds/leds-ktd2692.c |
3758 | @@ -256,6 +256,17 @@ static void ktd2692_setup(struct ktd2692_context *led) |
3759 | | KTD2692_REG_FLASH_CURRENT_BASE); |
3760 | } |
3761 | |
3762 | +static void regulator_disable_action(void *_data) |
3763 | +{ |
3764 | + struct device *dev = _data; |
3765 | + struct ktd2692_context *led = dev_get_drvdata(dev); |
3766 | + int ret; |
3767 | + |
3768 | + ret = regulator_disable(led->regulator); |
3769 | + if (ret) |
3770 | + dev_err(dev, "Failed to disable supply: %d\n", ret); |
3771 | +} |
3772 | + |
3773 | static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev, |
3774 | struct ktd2692_led_config_data *cfg) |
3775 | { |
3776 | @@ -286,8 +297,14 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev, |
3777 | |
3778 | if (led->regulator) { |
3779 | ret = regulator_enable(led->regulator); |
3780 | - if (ret) |
3781 | + if (ret) { |
3782 | dev_err(dev, "Failed to enable supply: %d\n", ret); |
3783 | + } else { |
3784 | + ret = devm_add_action_or_reset(dev, |
3785 | + regulator_disable_action, dev); |
3786 | + if (ret) |
3787 | + return ret; |
3788 | + } |
3789 | } |
3790 | |
3791 | child_node = of_get_next_available_child(np, NULL); |
3792 | @@ -377,17 +394,9 @@ static int ktd2692_probe(struct platform_device *pdev) |
3793 | static int ktd2692_remove(struct platform_device *pdev) |
3794 | { |
3795 | struct ktd2692_context *led = platform_get_drvdata(pdev); |
3796 | - int ret; |
3797 | |
3798 | led_classdev_flash_unregister(&led->fled_cdev); |
3799 | |
3800 | - if (led->regulator) { |
3801 | - ret = regulator_disable(led->regulator); |
3802 | - if (ret) |
3803 | - dev_err(&pdev->dev, |
3804 | - "Failed to disable supply: %d\n", ret); |
3805 | - } |
3806 | - |
3807 | mutex_destroy(&led->lock); |
3808 | |
3809 | return 0; |
3810 | diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c |
3811 | index db842eeb7ca20..6c143551f10a6 100644 |
3812 | --- a/drivers/leds/leds-lm36274.c |
3813 | +++ b/drivers/leds/leds-lm36274.c |
3814 | @@ -41,37 +41,36 @@ struct lm36274 { |
3815 | }; |
3816 | |
3817 | static int lm36274_brightness_set(struct led_classdev *led_cdev, |
3818 | - enum led_brightness brt_val) |
3819 | + enum led_brightness brt_val) |
3820 | { |
3821 | - struct lm36274 *led = container_of(led_cdev, struct lm36274, led_dev); |
3822 | + struct lm36274 *chip = container_of(led_cdev, struct lm36274, led_dev); |
3823 | |
3824 | - return ti_lmu_common_set_brightness(&led->lmu_data, brt_val); |
3825 | + return ti_lmu_common_set_brightness(&chip->lmu_data, brt_val); |
3826 | } |
3827 | |
3828 | -static int lm36274_init(struct lm36274 *lm36274_data) |
3829 | +static int lm36274_init(struct lm36274 *chip) |
3830 | { |
3831 | int enable_val = 0; |
3832 | int i; |
3833 | |
3834 | - for (i = 0; i < lm36274_data->num_leds; i++) |
3835 | - enable_val |= (1 << lm36274_data->led_sources[i]); |
3836 | + for (i = 0; i < chip->num_leds; i++) |
3837 | + enable_val |= (1 << chip->led_sources[i]); |
3838 | |
3839 | if (!enable_val) { |
3840 | - dev_err(lm36274_data->dev, "No LEDs were enabled\n"); |
3841 | + dev_err(chip->dev, "No LEDs were enabled\n"); |
3842 | return -EINVAL; |
3843 | } |
3844 | |
3845 | enable_val |= LM36274_BL_EN; |
3846 | |
3847 | - return regmap_write(lm36274_data->regmap, LM36274_REG_BL_EN, |
3848 | - enable_val); |
3849 | + return regmap_write(chip->regmap, LM36274_REG_BL_EN, enable_val); |
3850 | } |
3851 | |
3852 | -static int lm36274_parse_dt(struct lm36274 *lm36274_data) |
3853 | +static int lm36274_parse_dt(struct lm36274 *chip) |
3854 | { |
3855 | struct fwnode_handle *child = NULL; |
3856 | char label[LED_MAX_NAME_SIZE]; |
3857 | - struct device *dev = &lm36274_data->pdev->dev; |
3858 | + struct device *dev = &chip->pdev->dev; |
3859 | const char *name; |
3860 | int child_cnt; |
3861 | int ret = -EINVAL; |
3862 | @@ -84,37 +83,37 @@ static int lm36274_parse_dt(struct lm36274 *lm36274_data) |
3863 | device_for_each_child_node(dev, child) { |
3864 | ret = fwnode_property_read_string(child, "label", &name); |
3865 | if (ret) |
3866 | - snprintf(label, sizeof(label), |
3867 | - "%s::", lm36274_data->pdev->name); |
3868 | + snprintf(label, sizeof(label), "%s::", |
3869 | + chip->pdev->name); |
3870 | else |
3871 | - snprintf(label, sizeof(label), |
3872 | - "%s:%s", lm36274_data->pdev->name, name); |
3873 | + snprintf(label, sizeof(label), "%s:%s", |
3874 | + chip->pdev->name, name); |
3875 | |
3876 | - lm36274_data->num_leds = fwnode_property_count_u32(child, "led-sources"); |
3877 | - if (lm36274_data->num_leds <= 0) |
3878 | + chip->num_leds = fwnode_property_count_u32(child, "led-sources"); |
3879 | + if (chip->num_leds <= 0) |
3880 | return -ENODEV; |
3881 | |
3882 | ret = fwnode_property_read_u32_array(child, "led-sources", |
3883 | - lm36274_data->led_sources, |
3884 | - lm36274_data->num_leds); |
3885 | + chip->led_sources, |
3886 | + chip->num_leds); |
3887 | if (ret) { |
3888 | dev_err(dev, "led-sources property missing\n"); |
3889 | return ret; |
3890 | } |
3891 | |
3892 | fwnode_property_read_string(child, "linux,default-trigger", |
3893 | - &lm36274_data->led_dev.default_trigger); |
3894 | + &chip->led_dev.default_trigger); |
3895 | |
3896 | } |
3897 | |
3898 | - lm36274_data->lmu_data.regmap = lm36274_data->regmap; |
3899 | - lm36274_data->lmu_data.max_brightness = MAX_BRIGHTNESS_11BIT; |
3900 | - lm36274_data->lmu_data.msb_brightness_reg = LM36274_REG_BRT_MSB; |
3901 | - lm36274_data->lmu_data.lsb_brightness_reg = LM36274_REG_BRT_LSB; |
3902 | + chip->lmu_data.regmap = chip->regmap; |
3903 | + chip->lmu_data.max_brightness = MAX_BRIGHTNESS_11BIT; |
3904 | + chip->lmu_data.msb_brightness_reg = LM36274_REG_BRT_MSB; |
3905 | + chip->lmu_data.lsb_brightness_reg = LM36274_REG_BRT_LSB; |
3906 | |
3907 | - lm36274_data->led_dev.name = label; |
3908 | - lm36274_data->led_dev.max_brightness = MAX_BRIGHTNESS_11BIT; |
3909 | - lm36274_data->led_dev.brightness_set_blocking = lm36274_brightness_set; |
3910 | + chip->led_dev.name = label; |
3911 | + chip->led_dev.max_brightness = MAX_BRIGHTNESS_11BIT; |
3912 | + chip->led_dev.brightness_set_blocking = lm36274_brightness_set; |
3913 | |
3914 | return 0; |
3915 | } |
3916 | @@ -122,39 +121,38 @@ static int lm36274_parse_dt(struct lm36274 *lm36274_data) |
3917 | static int lm36274_probe(struct platform_device *pdev) |
3918 | { |
3919 | struct ti_lmu *lmu = dev_get_drvdata(pdev->dev.parent); |
3920 | - struct lm36274 *lm36274_data; |
3921 | + struct lm36274 *chip; |
3922 | int ret; |
3923 | |
3924 | - lm36274_data = devm_kzalloc(&pdev->dev, sizeof(*lm36274_data), |
3925 | - GFP_KERNEL); |
3926 | - if (!lm36274_data) |
3927 | + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); |
3928 | + if (!chip) |
3929 | return -ENOMEM; |
3930 | |
3931 | - lm36274_data->pdev = pdev; |
3932 | - lm36274_data->dev = lmu->dev; |
3933 | - lm36274_data->regmap = lmu->regmap; |
3934 | - platform_set_drvdata(pdev, lm36274_data); |
3935 | + chip->pdev = pdev; |
3936 | + chip->dev = lmu->dev; |
3937 | + chip->regmap = lmu->regmap; |
3938 | + platform_set_drvdata(pdev, chip); |
3939 | |
3940 | - ret = lm36274_parse_dt(lm36274_data); |
3941 | + ret = lm36274_parse_dt(chip); |
3942 | if (ret) { |
3943 | - dev_err(lm36274_data->dev, "Failed to parse DT node\n"); |
3944 | + dev_err(chip->dev, "Failed to parse DT node\n"); |
3945 | return ret; |
3946 | } |
3947 | |
3948 | - ret = lm36274_init(lm36274_data); |
3949 | + ret = lm36274_init(chip); |
3950 | if (ret) { |
3951 | - dev_err(lm36274_data->dev, "Failed to init the device\n"); |
3952 | + dev_err(chip->dev, "Failed to init the device\n"); |
3953 | return ret; |
3954 | } |
3955 | |
3956 | - return led_classdev_register(lm36274_data->dev, &lm36274_data->led_dev); |
3957 | + return led_classdev_register(chip->dev, &chip->led_dev); |
3958 | } |
3959 | |
3960 | static int lm36274_remove(struct platform_device *pdev) |
3961 | { |
3962 | - struct lm36274 *lm36274_data = platform_get_drvdata(pdev); |
3963 | + struct lm36274 *chip = platform_get_drvdata(pdev); |
3964 | |
3965 | - led_classdev_unregister(&lm36274_data->led_dev); |
3966 | + led_classdev_unregister(&chip->led_dev); |
3967 | |
3968 | return 0; |
3969 | } |
3970 | diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c |
3971 | index 1ac9a44570eed..cc77ea048d9be 100644 |
3972 | --- a/drivers/leds/leds-lm3692x.c |
3973 | +++ b/drivers/leds/leds-lm3692x.c |
3974 | @@ -358,6 +358,7 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) |
3975 | |
3976 | ret = fwnode_property_read_u32(child, "reg", &led->led_enable); |
3977 | if (ret) { |
3978 | + fwnode_handle_put(child); |
3979 | dev_err(&led->client->dev, "reg DT property missing\n"); |
3980 | return ret; |
3981 | } |
3982 | @@ -368,12 +369,11 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) |
3983 | |
3984 | ret = devm_led_classdev_register_ext(&led->client->dev, &led->led_dev, |
3985 | &init_data); |
3986 | - if (ret) { |
3987 | + if (ret) |
3988 | dev_err(&led->client->dev, "led register err: %d\n", ret); |
3989 | - return ret; |
3990 | - } |
3991 | |
3992 | - return 0; |
3993 | + fwnode_handle_put(init_data.fwnode); |
3994 | + return ret; |
3995 | } |
3996 | |
3997 | static int lm3692x_probe(struct i2c_client *client, |
3998 | diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c |
3999 | index 0ba51dacc5808..ce94b5205fd6e 100644 |
4000 | --- a/drivers/media/common/siano/smscoreapi.c |
4001 | +++ b/drivers/media/common/siano/smscoreapi.c |
4002 | @@ -908,7 +908,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, |
4003 | void *buffer, size_t size) |
4004 | { |
4005 | struct sms_firmware *firmware = (struct sms_firmware *) buffer; |
4006 | - struct sms_msg_data4 *msg; |
4007 | + struct sms_msg_data5 *msg; |
4008 | u32 mem_address, calc_checksum = 0; |
4009 | u32 i, *ptr; |
4010 | u8 *payload = firmware->payload; |
4011 | @@ -989,24 +989,20 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, |
4012 | goto exit_fw_download; |
4013 | |
4014 | if (coredev->mode == DEVICE_MODE_NONE) { |
4015 | - struct sms_msg_data *trigger_msg = |
4016 | - (struct sms_msg_data *) msg; |
4017 | - |
4018 | pr_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ\n"); |
4019 | SMS_INIT_MSG(&msg->x_msg_header, |
4020 | MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, |
4021 | - sizeof(struct sms_msg_hdr) + |
4022 | - sizeof(u32) * 5); |
4023 | + sizeof(*msg)); |
4024 | |
4025 | - trigger_msg->msg_data[0] = firmware->start_address; |
4026 | + msg->msg_data[0] = firmware->start_address; |
4027 | /* Entry point */ |
4028 | - trigger_msg->msg_data[1] = 6; /* Priority */ |
4029 | - trigger_msg->msg_data[2] = 0x200; /* Stack size */ |
4030 | - trigger_msg->msg_data[3] = 0; /* Parameter */ |
4031 | - trigger_msg->msg_data[4] = 4; /* Task ID */ |
4032 | + msg->msg_data[1] = 6; /* Priority */ |
4033 | + msg->msg_data[2] = 0x200; /* Stack size */ |
4034 | + msg->msg_data[3] = 0; /* Parameter */ |
4035 | + msg->msg_data[4] = 4; /* Task ID */ |
4036 | |
4037 | - rc = smscore_sendrequest_and_wait(coredev, trigger_msg, |
4038 | - trigger_msg->x_msg_header.msg_length, |
4039 | + rc = smscore_sendrequest_and_wait(coredev, msg, |
4040 | + msg->x_msg_header.msg_length, |
4041 | &coredev->trigger_done); |
4042 | } else { |
4043 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SW_RELOAD_EXEC_REQ, |
4044 | diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h |
4045 | index a2f95f4899c22..cd6c981eb1f96 100644 |
4046 | --- a/drivers/media/common/siano/smscoreapi.h |
4047 | +++ b/drivers/media/common/siano/smscoreapi.h |
4048 | @@ -629,9 +629,9 @@ struct sms_msg_data2 { |
4049 | u32 msg_data[2]; |
4050 | }; |
4051 | |
4052 | -struct sms_msg_data4 { |
4053 | +struct sms_msg_data5 { |
4054 | struct sms_msg_hdr x_msg_header; |
4055 | - u32 msg_data[4]; |
4056 | + u32 msg_data[5]; |
4057 | }; |
4058 | |
4059 | struct sms_data_download { |
4060 | diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c |
4061 | index ae17407e477a4..7cc654bc52d37 100644 |
4062 | --- a/drivers/media/common/siano/smsdvb-main.c |
4063 | +++ b/drivers/media/common/siano/smsdvb-main.c |
4064 | @@ -1176,6 +1176,10 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, |
4065 | return 0; |
4066 | |
4067 | media_graph_error: |
4068 | + mutex_lock(&g_smsdvb_clientslock); |
4069 | + list_del(&client->entry); |
4070 | + mutex_unlock(&g_smsdvb_clientslock); |
4071 | + |
4072 | smsdvb_debugfs_release(client); |
4073 | |
4074 | client_error: |
4075 | diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c |
4076 | index 630509ecee205..9fed06ba88efb 100644 |
4077 | --- a/drivers/media/dvb-core/dvb_net.c |
4078 | +++ b/drivers/media/dvb-core/dvb_net.c |
4079 | @@ -45,6 +45,7 @@ |
4080 | #include <linux/module.h> |
4081 | #include <linux/kernel.h> |
4082 | #include <linux/netdevice.h> |
4083 | +#include <linux/nospec.h> |
4084 | #include <linux/etherdevice.h> |
4085 | #include <linux/dvb/net.h> |
4086 | #include <linux/uio.h> |
4087 | @@ -1462,14 +1463,20 @@ static int dvb_net_do_ioctl(struct file *file, |
4088 | struct net_device *netdev; |
4089 | struct dvb_net_priv *priv_data; |
4090 | struct dvb_net_if *dvbnetif = parg; |
4091 | + int if_num = dvbnetif->if_num; |
4092 | |
4093 | - if (dvbnetif->if_num >= DVB_NET_DEVICES_MAX || |
4094 | - !dvbnet->state[dvbnetif->if_num]) { |
4095 | + if (if_num >= DVB_NET_DEVICES_MAX) { |
4096 | ret = -EINVAL; |
4097 | goto ioctl_error; |
4098 | } |
4099 | + if_num = array_index_nospec(if_num, DVB_NET_DEVICES_MAX); |
4100 | |
4101 | - netdev = dvbnet->device[dvbnetif->if_num]; |
4102 | + if (!dvbnet->state[if_num]) { |
4103 | + ret = -EINVAL; |
4104 | + goto ioctl_error; |
4105 | + } |
4106 | + |
4107 | + netdev = dvbnet->device[if_num]; |
4108 | |
4109 | priv_data = netdev_priv(netdev); |
4110 | dvbnetif->pid=priv_data->pid; |
4111 | @@ -1522,14 +1529,20 @@ static int dvb_net_do_ioctl(struct file *file, |
4112 | struct net_device *netdev; |
4113 | struct dvb_net_priv *priv_data; |
4114 | struct __dvb_net_if_old *dvbnetif = parg; |
4115 | + int if_num = dvbnetif->if_num; |
4116 | + |
4117 | + if (if_num >= DVB_NET_DEVICES_MAX) { |
4118 | + ret = -EINVAL; |
4119 | + goto ioctl_error; |
4120 | + } |
4121 | + if_num = array_index_nospec(if_num, DVB_NET_DEVICES_MAX); |
4122 | |
4123 | - if (dvbnetif->if_num >= DVB_NET_DEVICES_MAX || |
4124 | - !dvbnet->state[dvbnetif->if_num]) { |
4125 | + if (!dvbnet->state[if_num]) { |
4126 | ret = -EINVAL; |
4127 | goto ioctl_error; |
4128 | } |
4129 | |
4130 | - netdev = dvbnet->device[dvbnetif->if_num]; |
4131 | + netdev = dvbnet->device[if_num]; |
4132 | |
4133 | priv_data = netdev_priv(netdev); |
4134 | dvbnetif->pid=priv_data->pid; |
4135 | diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c |
4136 | index e8119ad0bc71d..92376592455ee 100644 |
4137 | --- a/drivers/media/i2c/ir-kbd-i2c.c |
4138 | +++ b/drivers/media/i2c/ir-kbd-i2c.c |
4139 | @@ -678,8 +678,8 @@ static int zilog_tx(struct rc_dev *rcdev, unsigned int *txbuf, |
4140 | goto out_unlock; |
4141 | } |
4142 | |
4143 | - i = i2c_master_recv(ir->tx_c, buf, 1); |
4144 | - if (i != 1) { |
4145 | + ret = i2c_master_recv(ir->tx_c, buf, 1); |
4146 | + if (ret != 1) { |
4147 | dev_err(&ir->rc->dev, "i2c_master_recv failed with %d\n", ret); |
4148 | ret = -EIO; |
4149 | goto out_unlock; |
4150 | diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c |
4151 | index 5b4c4a3547c93..71804a70bc6d7 100644 |
4152 | --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c |
4153 | +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c |
4154 | @@ -1386,7 +1386,7 @@ static int __s5c73m3_power_on(struct s5c73m3 *state) |
4155 | s5c73m3_gpio_deassert(state, STBY); |
4156 | usleep_range(100, 200); |
4157 | |
4158 | - s5c73m3_gpio_deassert(state, RST); |
4159 | + s5c73m3_gpio_deassert(state, RSET); |
4160 | usleep_range(50, 100); |
4161 | |
4162 | return 0; |
4163 | @@ -1401,7 +1401,7 @@ static int __s5c73m3_power_off(struct s5c73m3 *state) |
4164 | { |
4165 | int i, ret; |
4166 | |
4167 | - if (s5c73m3_gpio_assert(state, RST)) |
4168 | + if (s5c73m3_gpio_assert(state, RSET)) |
4169 | usleep_range(10, 50); |
4170 | |
4171 | if (s5c73m3_gpio_assert(state, STBY)) |
4172 | @@ -1606,7 +1606,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state) |
4173 | |
4174 | state->mclk_frequency = pdata->mclk_frequency; |
4175 | state->gpio[STBY] = pdata->gpio_stby; |
4176 | - state->gpio[RST] = pdata->gpio_reset; |
4177 | + state->gpio[RSET] = pdata->gpio_reset; |
4178 | return 0; |
4179 | } |
4180 | |
4181 | diff --git a/drivers/media/i2c/s5c73m3/s5c73m3.h b/drivers/media/i2c/s5c73m3/s5c73m3.h |
4182 | index ef7e85b34263b..c3fcfdd3ea66d 100644 |
4183 | --- a/drivers/media/i2c/s5c73m3/s5c73m3.h |
4184 | +++ b/drivers/media/i2c/s5c73m3/s5c73m3.h |
4185 | @@ -353,7 +353,7 @@ struct s5c73m3_ctrls { |
4186 | |
4187 | enum s5c73m3_gpio_id { |
4188 | STBY, |
4189 | - RST, |
4190 | + RSET, |
4191 | GPIO_NUM, |
4192 | }; |
4193 | |
4194 | diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c |
4195 | index b2d53417badf6..4e97309a67f41 100644 |
4196 | --- a/drivers/media/i2c/s5k4ecgx.c |
4197 | +++ b/drivers/media/i2c/s5k4ecgx.c |
4198 | @@ -173,7 +173,7 @@ static const char * const s5k4ecgx_supply_names[] = { |
4199 | |
4200 | enum s5k4ecgx_gpio_id { |
4201 | STBY, |
4202 | - RST, |
4203 | + RSET, |
4204 | GPIO_NUM, |
4205 | }; |
4206 | |
4207 | @@ -476,7 +476,7 @@ static int __s5k4ecgx_power_on(struct s5k4ecgx *priv) |
4208 | if (s5k4ecgx_gpio_set_value(priv, STBY, priv->gpio[STBY].level)) |
4209 | usleep_range(30, 50); |
4210 | |
4211 | - if (s5k4ecgx_gpio_set_value(priv, RST, priv->gpio[RST].level)) |
4212 | + if (s5k4ecgx_gpio_set_value(priv, RSET, priv->gpio[RSET].level)) |
4213 | usleep_range(30, 50); |
4214 | |
4215 | return 0; |
4216 | @@ -484,7 +484,7 @@ static int __s5k4ecgx_power_on(struct s5k4ecgx *priv) |
4217 | |
4218 | static int __s5k4ecgx_power_off(struct s5k4ecgx *priv) |
4219 | { |
4220 | - if (s5k4ecgx_gpio_set_value(priv, RST, !priv->gpio[RST].level)) |
4221 | + if (s5k4ecgx_gpio_set_value(priv, RSET, !priv->gpio[RSET].level)) |
4222 | usleep_range(30, 50); |
4223 | |
4224 | if (s5k4ecgx_gpio_set_value(priv, STBY, !priv->gpio[STBY].level)) |
4225 | @@ -872,7 +872,7 @@ static int s5k4ecgx_config_gpios(struct s5k4ecgx *priv, |
4226 | int ret; |
4227 | |
4228 | priv->gpio[STBY].gpio = -EINVAL; |
4229 | - priv->gpio[RST].gpio = -EINVAL; |
4230 | + priv->gpio[RSET].gpio = -EINVAL; |
4231 | |
4232 | ret = s5k4ecgx_config_gpio(gpio->gpio, gpio->level, "S5K4ECGX_STBY"); |
4233 | |
4234 | @@ -891,7 +891,7 @@ static int s5k4ecgx_config_gpios(struct s5k4ecgx *priv, |
4235 | s5k4ecgx_free_gpios(priv); |
4236 | return ret; |
4237 | } |
4238 | - priv->gpio[RST] = *gpio; |
4239 | + priv->gpio[RSET] = *gpio; |
4240 | if (gpio_is_valid(gpio->gpio)) |
4241 | gpio_set_value(gpio->gpio, 0); |
4242 | |
4243 | diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c |
4244 | index cdfe008ba39f8..ac5ab3392073a 100644 |
4245 | --- a/drivers/media/i2c/s5k5baf.c |
4246 | +++ b/drivers/media/i2c/s5k5baf.c |
4247 | @@ -235,7 +235,7 @@ struct s5k5baf_gpio { |
4248 | |
4249 | enum s5k5baf_gpio_id { |
4250 | STBY, |
4251 | - RST, |
4252 | + RSET, |
4253 | NUM_GPIOS, |
4254 | }; |
4255 | |
4256 | @@ -970,7 +970,7 @@ static int s5k5baf_power_on(struct s5k5baf *state) |
4257 | |
4258 | s5k5baf_gpio_deassert(state, STBY); |
4259 | usleep_range(50, 100); |
4260 | - s5k5baf_gpio_deassert(state, RST); |
4261 | + s5k5baf_gpio_deassert(state, RSET); |
4262 | return 0; |
4263 | |
4264 | err_reg_dis: |
4265 | @@ -988,7 +988,7 @@ static int s5k5baf_power_off(struct s5k5baf *state) |
4266 | state->apply_cfg = 0; |
4267 | state->apply_crop = 0; |
4268 | |
4269 | - s5k5baf_gpio_assert(state, RST); |
4270 | + s5k5baf_gpio_assert(state, RSET); |
4271 | s5k5baf_gpio_assert(state, STBY); |
4272 | |
4273 | if (!IS_ERR(state->clock)) |
4274 | diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c |
4275 | index 72439fae7968b..6516e205e9a3d 100644 |
4276 | --- a/drivers/media/i2c/s5k6aa.c |
4277 | +++ b/drivers/media/i2c/s5k6aa.c |
4278 | @@ -177,7 +177,7 @@ static const char * const s5k6aa_supply_names[] = { |
4279 | |
4280 | enum s5k6aa_gpio_id { |
4281 | STBY, |
4282 | - RST, |
4283 | + RSET, |
4284 | GPIO_NUM, |
4285 | }; |
4286 | |
4287 | @@ -841,7 +841,7 @@ static int __s5k6aa_power_on(struct s5k6aa *s5k6aa) |
4288 | ret = s5k6aa->s_power(1); |
4289 | usleep_range(4000, 5000); |
4290 | |
4291 | - if (s5k6aa_gpio_deassert(s5k6aa, RST)) |
4292 | + if (s5k6aa_gpio_deassert(s5k6aa, RSET)) |
4293 | msleep(20); |
4294 | |
4295 | return ret; |
4296 | @@ -851,7 +851,7 @@ static int __s5k6aa_power_off(struct s5k6aa *s5k6aa) |
4297 | { |
4298 | int ret; |
4299 | |
4300 | - if (s5k6aa_gpio_assert(s5k6aa, RST)) |
4301 | + if (s5k6aa_gpio_assert(s5k6aa, RSET)) |
4302 | usleep_range(100, 150); |
4303 | |
4304 | if (s5k6aa->s_power) { |
4305 | @@ -1510,7 +1510,7 @@ static int s5k6aa_configure_gpios(struct s5k6aa *s5k6aa, |
4306 | int ret; |
4307 | |
4308 | s5k6aa->gpio[STBY].gpio = -EINVAL; |
4309 | - s5k6aa->gpio[RST].gpio = -EINVAL; |
4310 | + s5k6aa->gpio[RSET].gpio = -EINVAL; |
4311 | |
4312 | gpio = &pdata->gpio_stby; |
4313 | if (gpio_is_valid(gpio->gpio)) { |
4314 | @@ -1533,7 +1533,7 @@ static int s5k6aa_configure_gpios(struct s5k6aa *s5k6aa, |
4315 | if (ret < 0) |
4316 | return ret; |
4317 | |
4318 | - s5k6aa->gpio[RST] = *gpio; |
4319 | + s5k6aa->gpio[RSET] = *gpio; |
4320 | } |
4321 | |
4322 | return 0; |
4323 | diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c |
4324 | index 114c084c4aec1..76c443067ec2d 100644 |
4325 | --- a/drivers/media/i2c/tc358743.c |
4326 | +++ b/drivers/media/i2c/tc358743.c |
4327 | @@ -1973,6 +1973,7 @@ static int tc358743_probe_of(struct tc358743_state *state) |
4328 | bps_pr_lane = 2 * endpoint.link_frequencies[0]; |
4329 | if (bps_pr_lane < 62500000U || bps_pr_lane > 1000000000U) { |
4330 | dev_err(dev, "unsupported bps per lane: %u bps\n", bps_pr_lane); |
4331 | + ret = -EINVAL; |
4332 | goto disable_clk; |
4333 | } |
4334 | |
4335 | diff --git a/drivers/media/mc/Makefile b/drivers/media/mc/Makefile |
4336 | index 119037f0e686d..2b7af42ba59c1 100644 |
4337 | --- a/drivers/media/mc/Makefile |
4338 | +++ b/drivers/media/mc/Makefile |
4339 | @@ -3,7 +3,7 @@ |
4340 | mc-objs := mc-device.o mc-devnode.o mc-entity.o \ |
4341 | mc-request.o |
4342 | |
4343 | -ifeq ($(CONFIG_USB),y) |
4344 | +ifneq ($(CONFIG_USB),) |
4345 | mc-objs += mc-dev-allocator.o |
4346 | endif |
4347 | |
4348 | diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c |
4349 | index 53af26ad1dfb5..1a741b47eaa19 100644 |
4350 | --- a/drivers/media/pci/bt8xx/bt878.c |
4351 | +++ b/drivers/media/pci/bt8xx/bt878.c |
4352 | @@ -477,6 +477,9 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) |
4353 | btwrite(0, BT878_AINT_MASK); |
4354 | bt878_num++; |
4355 | |
4356 | + if (!bt->tasklet.func) |
4357 | + tasklet_disable(&bt->tasklet); |
4358 | + |
4359 | return 0; |
4360 | |
4361 | fail2: |
4362 | diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c |
4363 | index 0695078ef8125..1bd8bbe57a30e 100644 |
4364 | --- a/drivers/media/pci/cobalt/cobalt-driver.c |
4365 | +++ b/drivers/media/pci/cobalt/cobalt-driver.c |
4366 | @@ -667,6 +667,7 @@ static int cobalt_probe(struct pci_dev *pci_dev, |
4367 | return -ENOMEM; |
4368 | cobalt->pci_dev = pci_dev; |
4369 | cobalt->instance = i; |
4370 | + mutex_init(&cobalt->pci_lock); |
4371 | |
4372 | retval = v4l2_device_register(&pci_dev->dev, &cobalt->v4l2_dev); |
4373 | if (retval) { |
4374 | diff --git a/drivers/media/pci/cobalt/cobalt-driver.h b/drivers/media/pci/cobalt/cobalt-driver.h |
4375 | index bca68572b3242..12c33e035904c 100644 |
4376 | --- a/drivers/media/pci/cobalt/cobalt-driver.h |
4377 | +++ b/drivers/media/pci/cobalt/cobalt-driver.h |
4378 | @@ -251,6 +251,8 @@ struct cobalt { |
4379 | int instance; |
4380 | struct pci_dev *pci_dev; |
4381 | struct v4l2_device v4l2_dev; |
4382 | + /* serialize PCI access in cobalt_s_bit_sysctrl() */ |
4383 | + struct mutex pci_lock; |
4384 | |
4385 | void __iomem *bar0, *bar1; |
4386 | |
4387 | @@ -320,10 +322,13 @@ static inline u32 cobalt_g_sysctrl(struct cobalt *cobalt) |
4388 | static inline void cobalt_s_bit_sysctrl(struct cobalt *cobalt, |
4389 | int bit, int val) |
4390 | { |
4391 | - u32 ctrl = cobalt_read_bar1(cobalt, COBALT_SYS_CTRL_BASE); |
4392 | + u32 ctrl; |
4393 | |
4394 | + mutex_lock(&cobalt->pci_lock); |
4395 | + ctrl = cobalt_read_bar1(cobalt, COBALT_SYS_CTRL_BASE); |
4396 | cobalt_write_bar1(cobalt, COBALT_SYS_CTRL_BASE, |
4397 | (ctrl & ~(1UL << bit)) | (val << bit)); |
4398 | + mutex_unlock(&cobalt->pci_lock); |
4399 | } |
4400 | |
4401 | static inline u32 cobalt_g_sysstat(struct cobalt *cobalt) |
4402 | diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c |
4403 | index 35a1d0d6dd660..42d1e4496efa1 100644 |
4404 | --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c |
4405 | +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c |
4406 | @@ -56,10 +56,8 @@ static void __gsc_m2m_job_abort(struct gsc_ctx *ctx) |
4407 | static int gsc_m2m_start_streaming(struct vb2_queue *q, unsigned int count) |
4408 | { |
4409 | struct gsc_ctx *ctx = q->drv_priv; |
4410 | - int ret; |
4411 | |
4412 | - ret = pm_runtime_get_sync(&ctx->gsc_dev->pdev->dev); |
4413 | - return ret > 0 ? 0 : ret; |
4414 | + return pm_runtime_resume_and_get(&ctx->gsc_dev->pdev->dev); |
4415 | } |
4416 | |
4417 | static void __gsc_m2m_cleanup_queue(struct gsc_ctx *ctx) |
4418 | diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c |
4419 | index d2cbcdca0463d..370cdf0070128 100644 |
4420 | --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c |
4421 | +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c |
4422 | @@ -305,17 +305,20 @@ static int isp_video_release(struct file *file) |
4423 | struct fimc_is_video *ivc = &isp->video_capture; |
4424 | struct media_entity *entity = &ivc->ve.vdev.entity; |
4425 | struct media_device *mdev = entity->graph_obj.mdev; |
4426 | + bool is_singular_file; |
4427 | |
4428 | mutex_lock(&isp->video_lock); |
4429 | |
4430 | - if (v4l2_fh_is_singular_file(file) && ivc->streaming) { |
4431 | + is_singular_file = v4l2_fh_is_singular_file(file); |
4432 | + |
4433 | + if (is_singular_file && ivc->streaming) { |
4434 | media_pipeline_stop(entity); |
4435 | ivc->streaming = 0; |
4436 | } |
4437 | |
4438 | _vb2_fop_release(file, NULL); |
4439 | |
4440 | - if (v4l2_fh_is_singular_file(file)) { |
4441 | + if (is_singular_file) { |
4442 | fimc_pipeline_call(&ivc->ve, close); |
4443 | |
4444 | mutex_lock(&mdev->graph_mutex); |
4445 | diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c |
4446 | index 7c9e2d69e21a0..34bc2949e1d67 100644 |
4447 | --- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c |
4448 | +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c |
4449 | @@ -402,12 +402,12 @@ static int mtk_mdp_m2m_start_streaming(struct vb2_queue *q, unsigned int count) |
4450 | struct mtk_mdp_ctx *ctx = q->drv_priv; |
4451 | int ret; |
4452 | |
4453 | - ret = pm_runtime_get_sync(&ctx->mdp_dev->pdev->dev); |
4454 | + ret = pm_runtime_resume_and_get(&ctx->mdp_dev->pdev->dev); |
4455 | if (ret < 0) |
4456 | - mtk_mdp_dbg(1, "[%d] pm_runtime_get_sync failed:%d", |
4457 | + mtk_mdp_dbg(1, "[%d] pm_runtime_resume_and_get failed:%d", |
4458 | ctx->id, ret); |
4459 | |
4460 | - return 0; |
4461 | + return ret; |
4462 | } |
4463 | |
4464 | static void *mtk_mdp_m2m_buf_remove(struct mtk_mdp_ctx *ctx, |
4465 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c |
4466 | index 00d090df11bbe..4cde1a54e7252 100644 |
4467 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c |
4468 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c |
4469 | @@ -142,7 +142,9 @@ static int fops_vcodec_open(struct file *file) |
4470 | mtk_vcodec_dec_set_default_params(ctx); |
4471 | |
4472 | if (v4l2_fh_is_singular(&ctx->fh)) { |
4473 | - mtk_vcodec_dec_pw_on(&dev->pm); |
4474 | + ret = mtk_vcodec_dec_pw_on(&dev->pm); |
4475 | + if (ret < 0) |
4476 | + goto err_load_fw; |
4477 | /* |
4478 | * vpu_load_firmware checks if it was loaded already and |
4479 | * does nothing in that case |
4480 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
4481 | index f9bbd0000bf3e..34e9e067de206 100644 |
4482 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
4483 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
4484 | @@ -89,13 +89,15 @@ void mtk_vcodec_release_dec_pm(struct mtk_vcodec_dev *dev) |
4485 | put_device(dev->pm.larbvdec); |
4486 | } |
4487 | |
4488 | -void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) |
4489 | +int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) |
4490 | { |
4491 | int ret; |
4492 | |
4493 | - ret = pm_runtime_get_sync(pm->dev); |
4494 | + ret = pm_runtime_resume_and_get(pm->dev); |
4495 | if (ret) |
4496 | - mtk_v4l2_err("pm_runtime_get_sync fail %d", ret); |
4497 | + mtk_v4l2_err("pm_runtime_resume_and_get fail %d", ret); |
4498 | + |
4499 | + return ret; |
4500 | } |
4501 | |
4502 | void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm) |
4503 | diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h |
4504 | index 872d8bf8cfaf3..280aeaefdb651 100644 |
4505 | --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h |
4506 | +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h |
4507 | @@ -12,7 +12,7 @@ |
4508 | int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *dev); |
4509 | void mtk_vcodec_release_dec_pm(struct mtk_vcodec_dev *dev); |
4510 | |
4511 | -void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm); |
4512 | +int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm); |
4513 | void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm); |
4514 | void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm); |
4515 | void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm); |
4516 | diff --git a/drivers/media/platform/s5p-cec/s5p_cec.c b/drivers/media/platform/s5p-cec/s5p_cec.c |
4517 | index 6ddcc35b0bbda..828792b854f5c 100644 |
4518 | --- a/drivers/media/platform/s5p-cec/s5p_cec.c |
4519 | +++ b/drivers/media/platform/s5p-cec/s5p_cec.c |
4520 | @@ -35,10 +35,13 @@ MODULE_PARM_DESC(debug, "debug level (0-2)"); |
4521 | |
4522 | static int s5p_cec_adap_enable(struct cec_adapter *adap, bool enable) |
4523 | { |
4524 | + int ret; |
4525 | struct s5p_cec_dev *cec = cec_get_drvdata(adap); |
4526 | |
4527 | if (enable) { |
4528 | - pm_runtime_get_sync(cec->dev); |
4529 | + ret = pm_runtime_resume_and_get(cec->dev); |
4530 | + if (ret < 0) |
4531 | + return ret; |
4532 | |
4533 | s5p_cec_reset(cec); |
4534 | |
4535 | @@ -51,7 +54,7 @@ static int s5p_cec_adap_enable(struct cec_adapter *adap, bool enable) |
4536 | } else { |
4537 | s5p_cec_mask_tx_interrupts(cec); |
4538 | s5p_cec_mask_rx_interrupts(cec); |
4539 | - pm_runtime_disable(cec->dev); |
4540 | + pm_runtime_put(cec->dev); |
4541 | } |
4542 | |
4543 | return 0; |
4544 | diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c |
4545 | index f5f05ea9f5213..6cfc2debfd9a0 100644 |
4546 | --- a/drivers/media/platform/s5p-g2d/g2d.c |
4547 | +++ b/drivers/media/platform/s5p-g2d/g2d.c |
4548 | @@ -276,6 +276,9 @@ static int g2d_release(struct file *file) |
4549 | struct g2d_dev *dev = video_drvdata(file); |
4550 | struct g2d_ctx *ctx = fh2ctx(file->private_data); |
4551 | |
4552 | + mutex_lock(&dev->mutex); |
4553 | + v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); |
4554 | + mutex_unlock(&dev->mutex); |
4555 | v4l2_ctrl_handler_free(&ctx->ctrl_handler); |
4556 | v4l2_fh_del(&ctx->fh); |
4557 | v4l2_fh_exit(&ctx->fh); |
4558 | diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c |
4559 | index 8dbbd5f2a40a0..06e17946bbb64 100644 |
4560 | --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c |
4561 | +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c |
4562 | @@ -2579,11 +2579,8 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb) |
4563 | static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count) |
4564 | { |
4565 | struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(q); |
4566 | - int ret; |
4567 | - |
4568 | - ret = pm_runtime_get_sync(ctx->jpeg->dev); |
4569 | |
4570 | - return ret > 0 ? 0 : ret; |
4571 | + return pm_runtime_resume_and_get(ctx->jpeg->dev); |
4572 | } |
4573 | |
4574 | static void s5p_jpeg_stop_streaming(struct vb2_queue *q) |
4575 | diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c |
4576 | index 2236702c21b43..84c4b19fb107f 100644 |
4577 | --- a/drivers/media/platform/sh_vou.c |
4578 | +++ b/drivers/media/platform/sh_vou.c |
4579 | @@ -1133,7 +1133,11 @@ static int sh_vou_open(struct file *file) |
4580 | if (v4l2_fh_is_singular_file(file) && |
4581 | vou_dev->status == SH_VOU_INITIALISING) { |
4582 | /* First open */ |
4583 | - pm_runtime_get_sync(vou_dev->v4l2_dev.dev); |
4584 | + err = pm_runtime_resume_and_get(vou_dev->v4l2_dev.dev); |
4585 | + if (err < 0) { |
4586 | + v4l2_fh_release(file); |
4587 | + goto done_open; |
4588 | + } |
4589 | err = sh_vou_hw_init(vou_dev); |
4590 | if (err < 0) { |
4591 | pm_runtime_put(vou_dev->v4l2_dev.dev); |
4592 | diff --git a/drivers/media/platform/sti/bdisp/Makefile b/drivers/media/platform/sti/bdisp/Makefile |
4593 | index caf7ccd193eaa..39ade0a347236 100644 |
4594 | --- a/drivers/media/platform/sti/bdisp/Makefile |
4595 | +++ b/drivers/media/platform/sti/bdisp/Makefile |
4596 | @@ -1,4 +1,4 @@ |
4597 | # SPDX-License-Identifier: GPL-2.0-only |
4598 | -obj-$(CONFIG_VIDEO_STI_BDISP) := bdisp.o |
4599 | +obj-$(CONFIG_VIDEO_STI_BDISP) += bdisp.o |
4600 | |
4601 | bdisp-objs := bdisp-v4l2.o bdisp-hw.o bdisp-debug.o |
4602 | diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
4603 | index a55ddf8d185d5..16a097f93b423 100644 |
4604 | --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
4605 | +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
4606 | @@ -499,7 +499,7 @@ static int bdisp_start_streaming(struct vb2_queue *q, unsigned int count) |
4607 | { |
4608 | struct bdisp_ctx *ctx = q->drv_priv; |
4609 | struct vb2_v4l2_buffer *buf; |
4610 | - int ret = pm_runtime_get_sync(ctx->bdisp_dev->dev); |
4611 | + int ret = pm_runtime_resume_and_get(ctx->bdisp_dev->dev); |
4612 | |
4613 | if (ret < 0) { |
4614 | dev_err(ctx->bdisp_dev->dev, "failed to set runtime PM\n"); |
4615 | @@ -1364,10 +1364,10 @@ static int bdisp_probe(struct platform_device *pdev) |
4616 | |
4617 | /* Power management */ |
4618 | pm_runtime_enable(dev); |
4619 | - ret = pm_runtime_get_sync(dev); |
4620 | + ret = pm_runtime_resume_and_get(dev); |
4621 | if (ret < 0) { |
4622 | dev_err(dev, "failed to set PM\n"); |
4623 | - goto err_pm; |
4624 | + goto err_remove; |
4625 | } |
4626 | |
4627 | /* Filters */ |
4628 | @@ -1395,6 +1395,7 @@ err_filter: |
4629 | bdisp_hw_free_filters(bdisp->dev); |
4630 | err_pm: |
4631 | pm_runtime_put(dev); |
4632 | +err_remove: |
4633 | bdisp_debugfs_remove(bdisp); |
4634 | err_v4l2: |
4635 | v4l2_device_unregister(&bdisp->v4l2_dev); |
4636 | diff --git a/drivers/media/platform/sti/delta/Makefile b/drivers/media/platform/sti/delta/Makefile |
4637 | index 92b37e216f004..32412fa4c6328 100644 |
4638 | --- a/drivers/media/platform/sti/delta/Makefile |
4639 | +++ b/drivers/media/platform/sti/delta/Makefile |
4640 | @@ -1,5 +1,5 @@ |
4641 | # SPDX-License-Identifier: GPL-2.0-only |
4642 | -obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o |
4643 | +obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) += st-delta.o |
4644 | st-delta-y := delta-v4l2.o delta-mem.o delta-ipc.o delta-debug.o |
4645 | |
4646 | # MJPEG support |
4647 | diff --git a/drivers/media/platform/sti/hva/Makefile b/drivers/media/platform/sti/hva/Makefile |
4648 | index 74b41ec52f976..b5a5478bdd016 100644 |
4649 | --- a/drivers/media/platform/sti/hva/Makefile |
4650 | +++ b/drivers/media/platform/sti/hva/Makefile |
4651 | @@ -1,4 +1,4 @@ |
4652 | # SPDX-License-Identifier: GPL-2.0-only |
4653 | -obj-$(CONFIG_VIDEO_STI_HVA) := st-hva.o |
4654 | +obj-$(CONFIG_VIDEO_STI_HVA) += st-hva.o |
4655 | st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o hva-h264.o |
4656 | st-hva-$(CONFIG_VIDEO_STI_HVA_DEBUGFS) += hva-debugfs.o |
4657 | diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c |
4658 | index 43f279e2a6a38..cf4c891bf619a 100644 |
4659 | --- a/drivers/media/platform/sti/hva/hva-hw.c |
4660 | +++ b/drivers/media/platform/sti/hva/hva-hw.c |
4661 | @@ -130,8 +130,7 @@ static irqreturn_t hva_hw_its_irq_thread(int irq, void *arg) |
4662 | ctx_id = (hva->sts_reg & 0xFF00) >> 8; |
4663 | if (ctx_id >= HVA_MAX_INSTANCES) { |
4664 | dev_err(dev, "%s %s: bad context identifier: %d\n", |
4665 | - ctx->name, __func__, ctx_id); |
4666 | - ctx->hw_err = true; |
4667 | + HVA_PREFIX, __func__, ctx_id); |
4668 | goto out; |
4669 | } |
4670 | |
4671 | diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c |
4672 | index a8a72d5fbd129..caefac07af927 100644 |
4673 | --- a/drivers/media/usb/au0828/au0828-core.c |
4674 | +++ b/drivers/media/usb/au0828/au0828-core.c |
4675 | @@ -199,8 +199,8 @@ static int au0828_media_device_init(struct au0828_dev *dev, |
4676 | struct media_device *mdev; |
4677 | |
4678 | mdev = media_device_usb_allocate(udev, KBUILD_MODNAME, THIS_MODULE); |
4679 | - if (!mdev) |
4680 | - return -ENOMEM; |
4681 | + if (IS_ERR(mdev)) |
4682 | + return PTR_ERR(mdev); |
4683 | |
4684 | dev->media_dev = mdev; |
4685 | #endif |
4686 | diff --git a/drivers/media/usb/cpia2/cpia2.h b/drivers/media/usb/cpia2/cpia2.h |
4687 | index 50835f5f7512c..57b7f1ea68da5 100644 |
4688 | --- a/drivers/media/usb/cpia2/cpia2.h |
4689 | +++ b/drivers/media/usb/cpia2/cpia2.h |
4690 | @@ -429,6 +429,7 @@ int cpia2_send_command(struct camera_data *cam, struct cpia2_command *cmd); |
4691 | int cpia2_do_command(struct camera_data *cam, |
4692 | unsigned int command, |
4693 | unsigned char direction, unsigned char param); |
4694 | +void cpia2_deinit_camera_struct(struct camera_data *cam, struct usb_interface *intf); |
4695 | struct camera_data *cpia2_init_camera_struct(struct usb_interface *intf); |
4696 | int cpia2_init_camera(struct camera_data *cam); |
4697 | int cpia2_allocate_buffers(struct camera_data *cam); |
4698 | diff --git a/drivers/media/usb/cpia2/cpia2_core.c b/drivers/media/usb/cpia2/cpia2_core.c |
4699 | index 20c50c2d042e6..f8c6e0b211a51 100644 |
4700 | --- a/drivers/media/usb/cpia2/cpia2_core.c |
4701 | +++ b/drivers/media/usb/cpia2/cpia2_core.c |
4702 | @@ -2163,6 +2163,18 @@ static void reset_camera_struct(struct camera_data *cam) |
4703 | cam->height = cam->params.roi.height; |
4704 | } |
4705 | |
4706 | +/****************************************************************************** |
4707 | + * |
4708 | + * cpia2_init_camera_struct |
4709 | + * |
4710 | + * Deinitialize camera struct |
4711 | + *****************************************************************************/ |
4712 | +void cpia2_deinit_camera_struct(struct camera_data *cam, struct usb_interface *intf) |
4713 | +{ |
4714 | + v4l2_device_unregister(&cam->v4l2_dev); |
4715 | + kfree(cam); |
4716 | +} |
4717 | + |
4718 | /****************************************************************************** |
4719 | * |
4720 | * cpia2_init_camera_struct |
4721 | diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c |
4722 | index 3ab80a7b44985..76aac06f9fb8e 100644 |
4723 | --- a/drivers/media/usb/cpia2/cpia2_usb.c |
4724 | +++ b/drivers/media/usb/cpia2/cpia2_usb.c |
4725 | @@ -844,15 +844,13 @@ static int cpia2_usb_probe(struct usb_interface *intf, |
4726 | ret = set_alternate(cam, USBIF_CMDONLY); |
4727 | if (ret < 0) { |
4728 | ERR("%s: usb_set_interface error (ret = %d)\n", __func__, ret); |
4729 | - kfree(cam); |
4730 | - return ret; |
4731 | + goto alt_err; |
4732 | } |
4733 | |
4734 | |
4735 | if((ret = cpia2_init_camera(cam)) < 0) { |
4736 | ERR("%s: failed to initialize cpia2 camera (ret = %d)\n", __func__, ret); |
4737 | - kfree(cam); |
4738 | - return ret; |
4739 | + goto alt_err; |
4740 | } |
4741 | LOG(" CPiA Version: %d.%02d (%d.%d)\n", |
4742 | cam->params.version.firmware_revision_hi, |
4743 | @@ -872,11 +870,14 @@ static int cpia2_usb_probe(struct usb_interface *intf, |
4744 | ret = cpia2_register_camera(cam); |
4745 | if (ret < 0) { |
4746 | ERR("%s: Failed to register cpia2 camera (ret = %d)\n", __func__, ret); |
4747 | - kfree(cam); |
4748 | - return ret; |
4749 | + goto alt_err; |
4750 | } |
4751 | |
4752 | return 0; |
4753 | + |
4754 | +alt_err: |
4755 | + cpia2_deinit_camera_struct(cam, intf); |
4756 | + return ret; |
4757 | } |
4758 | |
4759 | /****************************************************************************** |
4760 | diff --git a/drivers/media/usb/dvb-usb/cinergyT2-core.c b/drivers/media/usb/dvb-usb/cinergyT2-core.c |
4761 | index 969a7ec71dff7..4116ba5c45fcb 100644 |
4762 | --- a/drivers/media/usb/dvb-usb/cinergyT2-core.c |
4763 | +++ b/drivers/media/usb/dvb-usb/cinergyT2-core.c |
4764 | @@ -78,6 +78,8 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) |
4765 | |
4766 | ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 3, 0); |
4767 | if (ret < 0) { |
4768 | + if (adap->fe_adap[0].fe) |
4769 | + adap->fe_adap[0].fe->ops.release(adap->fe_adap[0].fe); |
4770 | deb_rc("cinergyt2_power_ctrl() Failed to retrieve sleep state info\n"); |
4771 | } |
4772 | mutex_unlock(&d->data_mutex); |
4773 | diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c |
4774 | index fac19ec460895..06bd827ef4619 100644 |
4775 | --- a/drivers/media/usb/dvb-usb/cxusb.c |
4776 | +++ b/drivers/media/usb/dvb-usb/cxusb.c |
4777 | @@ -1950,7 +1950,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { |
4778 | |
4779 | .size_of_priv = sizeof(struct cxusb_state), |
4780 | |
4781 | - .num_adapters = 2, |
4782 | + .num_adapters = 1, |
4783 | .adapter = { |
4784 | { |
4785 | .num_frontends = 1, |
4786 | diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c |
4787 | index 5aa15a7a49def..59529cbf9cd0b 100644 |
4788 | --- a/drivers/media/usb/em28xx/em28xx-input.c |
4789 | +++ b/drivers/media/usb/em28xx/em28xx-input.c |
4790 | @@ -720,7 +720,8 @@ static int em28xx_ir_init(struct em28xx *dev) |
4791 | dev->board.has_ir_i2c = 0; |
4792 | dev_warn(&dev->intf->dev, |
4793 | "No i2c IR remote control device found.\n"); |
4794 | - return -ENODEV; |
4795 | + err = -ENODEV; |
4796 | + goto ref_put; |
4797 | } |
4798 | } |
4799 | |
4800 | @@ -735,7 +736,7 @@ static int em28xx_ir_init(struct em28xx *dev) |
4801 | |
4802 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
4803 | if (!ir) |
4804 | - return -ENOMEM; |
4805 | + goto ref_put; |
4806 | rc = rc_allocate_device(RC_DRIVER_SCANCODE); |
4807 | if (!rc) |
4808 | goto error; |
4809 | @@ -839,6 +840,9 @@ error: |
4810 | dev->ir = NULL; |
4811 | rc_free_device(rc); |
4812 | kfree(ir); |
4813 | +ref_put: |
4814 | + em28xx_shutdown_buttons(dev); |
4815 | + kref_put(&dev->ref, em28xx_free_device); |
4816 | return err; |
4817 | } |
4818 | |
4819 | diff --git a/drivers/media/usb/gspca/gl860/gl860.c b/drivers/media/usb/gspca/gl860/gl860.c |
4820 | index 2c05ea2598e76..ce4ee8bc75c85 100644 |
4821 | --- a/drivers/media/usb/gspca/gl860/gl860.c |
4822 | +++ b/drivers/media/usb/gspca/gl860/gl860.c |
4823 | @@ -561,8 +561,8 @@ int gl860_RTx(struct gspca_dev *gspca_dev, |
4824 | len, 400 + 200 * (len > 1)); |
4825 | memcpy(pdata, gspca_dev->usb_buf, len); |
4826 | } else { |
4827 | - r = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
4828 | - req, pref, val, index, NULL, len, 400); |
4829 | + gspca_err(gspca_dev, "zero-length read request\n"); |
4830 | + r = -EINVAL; |
4831 | } |
4832 | } |
4833 | |
4834 | diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4835 | index 1cfb7cf64131a..4c991eae53cdf 100644 |
4836 | --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4837 | +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4838 | @@ -2677,9 +2677,8 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) |
4839 | pvr2_stream_destroy(hdw->vid_stream); |
4840 | hdw->vid_stream = NULL; |
4841 | } |
4842 | - pvr2_i2c_core_done(hdw); |
4843 | v4l2_device_unregister(&hdw->v4l2_dev); |
4844 | - pvr2_hdw_remove_usb_stuff(hdw); |
4845 | + pvr2_hdw_disconnect(hdw); |
4846 | mutex_lock(&pvr2_unit_mtx); |
4847 | do { |
4848 | if ((hdw->unit_number >= 0) && |
4849 | @@ -2706,6 +2705,7 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw) |
4850 | { |
4851 | pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_disconnect(hdw=%p)",hdw); |
4852 | LOCK_TAKE(hdw->big_lock); |
4853 | + pvr2_i2c_core_done(hdw); |
4854 | LOCK_TAKE(hdw->ctl_lock); |
4855 | pvr2_hdw_remove_usb_stuff(hdw); |
4856 | LOCK_GIVE(hdw->ctl_lock); |
4857 | diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c |
4858 | index 684574f58e82d..90eec79ee995a 100644 |
4859 | --- a/drivers/media/v4l2-core/v4l2-fh.c |
4860 | +++ b/drivers/media/v4l2-core/v4l2-fh.c |
4861 | @@ -96,6 +96,7 @@ int v4l2_fh_release(struct file *filp) |
4862 | v4l2_fh_del(fh); |
4863 | v4l2_fh_exit(fh); |
4864 | kfree(fh); |
4865 | + filp->private_data = NULL; |
4866 | } |
4867 | return 0; |
4868 | } |
4869 | diff --git a/drivers/memstick/host/rtsx_usb_ms.c b/drivers/memstick/host/rtsx_usb_ms.c |
4870 | index 102dbb8080da5..29271ad4728a2 100644 |
4871 | --- a/drivers/memstick/host/rtsx_usb_ms.c |
4872 | +++ b/drivers/memstick/host/rtsx_usb_ms.c |
4873 | @@ -799,9 +799,9 @@ static int rtsx_usb_ms_drv_probe(struct platform_device *pdev) |
4874 | |
4875 | return 0; |
4876 | err_out: |
4877 | - memstick_free_host(msh); |
4878 | pm_runtime_disable(ms_dev(host)); |
4879 | pm_runtime_put_noidle(ms_dev(host)); |
4880 | + memstick_free_host(msh); |
4881 | return err; |
4882 | } |
4883 | |
4884 | @@ -828,9 +828,6 @@ static int rtsx_usb_ms_drv_remove(struct platform_device *pdev) |
4885 | } |
4886 | mutex_unlock(&host->host_mutex); |
4887 | |
4888 | - memstick_remove_host(msh); |
4889 | - memstick_free_host(msh); |
4890 | - |
4891 | /* Balance possible unbalanced usage count |
4892 | * e.g. unconditional module removal |
4893 | */ |
4894 | @@ -838,10 +835,11 @@ static int rtsx_usb_ms_drv_remove(struct platform_device *pdev) |
4895 | pm_runtime_put(ms_dev(host)); |
4896 | |
4897 | pm_runtime_disable(ms_dev(host)); |
4898 | - platform_set_drvdata(pdev, NULL); |
4899 | - |
4900 | + memstick_remove_host(msh); |
4901 | dev_dbg(ms_dev(host), |
4902 | ": Realtek USB Memstick controller has been removed\n"); |
4903 | + memstick_free_host(msh); |
4904 | + platform_set_drvdata(pdev, NULL); |
4905 | |
4906 | return 0; |
4907 | } |
4908 | diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89hpesx.c |
4909 | index 81c70e5bc168f..3e4a594c110b3 100644 |
4910 | --- a/drivers/misc/eeprom/idt_89hpesx.c |
4911 | +++ b/drivers/misc/eeprom/idt_89hpesx.c |
4912 | @@ -1126,11 +1126,10 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev) |
4913 | |
4914 | device_for_each_child_node(dev, fwnode) { |
4915 | ee_id = idt_ee_match_id(fwnode); |
4916 | - if (!ee_id) { |
4917 | - dev_warn(dev, "Skip unsupported EEPROM device"); |
4918 | - continue; |
4919 | - } else |
4920 | + if (ee_id) |
4921 | break; |
4922 | + |
4923 | + dev_warn(dev, "Skip unsupported EEPROM device %pfw\n", fwnode); |
4924 | } |
4925 | |
4926 | /* If there is no fwnode EEPROM device, then set zero size */ |
4927 | @@ -1161,6 +1160,7 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev) |
4928 | else /* if (!fwnode_property_read_bool(node, "read-only")) */ |
4929 | pdev->eero = false; |
4930 | |
4931 | + fwnode_handle_put(fwnode); |
4932 | dev_info(dev, "EEPROM of %d bytes found by 0x%x", |
4933 | pdev->eesize, pdev->eeaddr); |
4934 | } |
4935 | diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c |
4936 | index 39f2864455a60..8322d22a59c45 100644 |
4937 | --- a/drivers/mmc/core/block.c |
4938 | +++ b/drivers/mmc/core/block.c |
4939 | @@ -1053,6 +1053,12 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) |
4940 | |
4941 | switch (mq_rq->drv_op) { |
4942 | case MMC_DRV_OP_IOCTL: |
4943 | + if (card->ext_csd.cmdq_en) { |
4944 | + ret = mmc_cmdq_disable(card); |
4945 | + if (ret) |
4946 | + break; |
4947 | + } |
4948 | + fallthrough; |
4949 | case MMC_DRV_OP_IOCTL_RPMB: |
4950 | idata = mq_rq->drv_op_data; |
4951 | for (i = 0, ret = 0; i < mq_rq->ioc_count; i++) { |
4952 | @@ -1063,6 +1069,8 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) |
4953 | /* Always switch back to main area after RPMB access */ |
4954 | if (rpmb_ioctl) |
4955 | mmc_blk_part_switch(card, 0); |
4956 | + else if (card->reenable_cmdq && !card->ext_csd.cmdq_en) |
4957 | + mmc_cmdq_enable(card); |
4958 | break; |
4959 | case MMC_DRV_OP_BOOT_WP: |
4960 | ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_WP, |
4961 | diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c |
4962 | index 10705e5fa90ee..a999d2089d3de 100644 |
4963 | --- a/drivers/mmc/host/sdhci-sprd.c |
4964 | +++ b/drivers/mmc/host/sdhci-sprd.c |
4965 | @@ -382,6 +382,7 @@ static unsigned int sdhci_sprd_get_ro(struct sdhci_host *host) |
4966 | static struct sdhci_ops sdhci_sprd_ops = { |
4967 | .read_l = sdhci_sprd_readl, |
4968 | .write_l = sdhci_sprd_writel, |
4969 | + .write_w = sdhci_sprd_writew, |
4970 | .write_b = sdhci_sprd_writeb, |
4971 | .set_clock = sdhci_sprd_set_clock, |
4972 | .get_max_clock = sdhci_sprd_get_max_clock, |
4973 | diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c |
4974 | index 6eba2441c7efd..96b0f81a20322 100644 |
4975 | --- a/drivers/mmc/host/usdhi6rol0.c |
4976 | +++ b/drivers/mmc/host/usdhi6rol0.c |
4977 | @@ -1803,6 +1803,7 @@ static int usdhi6_probe(struct platform_device *pdev) |
4978 | |
4979 | version = usdhi6_read(host, USDHI6_VERSION); |
4980 | if ((version & 0xfff) != 0xa0d) { |
4981 | + ret = -EPERM; |
4982 | dev_err(dev, "Version not recognized %x\n", version); |
4983 | goto e_clk_off; |
4984 | } |
4985 | diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c |
4986 | index d12a068b0f9ed..721e5dd1eb7de 100644 |
4987 | --- a/drivers/mmc/host/via-sdmmc.c |
4988 | +++ b/drivers/mmc/host/via-sdmmc.c |
4989 | @@ -857,6 +857,9 @@ static void via_sdc_data_isr(struct via_crdr_mmc_host *host, u16 intmask) |
4990 | { |
4991 | BUG_ON(intmask == 0); |
4992 | |
4993 | + if (!host->data) |
4994 | + return; |
4995 | + |
4996 | if (intmask & VIA_CRDR_SDSTS_DT) |
4997 | host->data->error = -ETIMEDOUT; |
4998 | else if (intmask & (VIA_CRDR_SDSTS_RC | VIA_CRDR_SDSTS_WC)) |
4999 | diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c |
5000 | index a3680c9006892..156046e56a584 100644 |
5001 | --- a/drivers/mmc/host/vub300.c |
5002 | +++ b/drivers/mmc/host/vub300.c |
5003 | @@ -2286,7 +2286,7 @@ static int vub300_probe(struct usb_interface *interface, |
5004 | if (retval < 0) |
5005 | goto error5; |
5006 | retval = |
5007 | - usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0), |
5008 | + usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), |
5009 | SET_ROM_WAIT_STATES, |
5010 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
5011 | firmware_rom_wait_states, 0x0000, NULL, 0, HZ); |
5012 | diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c |
5013 | index ee4afa17d8a3a..ef163ff1edf76 100644 |
5014 | --- a/drivers/mtd/nand/raw/marvell_nand.c |
5015 | +++ b/drivers/mtd/nand/raw/marvell_nand.c |
5016 | @@ -2980,8 +2980,10 @@ static int __maybe_unused marvell_nfc_resume(struct device *dev) |
5017 | return ret; |
5018 | |
5019 | ret = clk_prepare_enable(nfc->reg_clk); |
5020 | - if (ret < 0) |
5021 | + if (ret < 0) { |
5022 | + clk_disable_unprepare(nfc->core_clk); |
5023 | return ret; |
5024 | + } |
5025 | |
5026 | /* |
5027 | * Reset nfc->selected_chip so the next command will cause the timing |
5028 | diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c |
5029 | index 91146bdc47132..3ccd6363ee8cb 100644 |
5030 | --- a/drivers/mtd/parsers/redboot.c |
5031 | +++ b/drivers/mtd/parsers/redboot.c |
5032 | @@ -45,6 +45,7 @@ static inline int redboot_checksum(struct fis_image_desc *img) |
5033 | static void parse_redboot_of(struct mtd_info *master) |
5034 | { |
5035 | struct device_node *np; |
5036 | + struct device_node *npart; |
5037 | u32 dirblock; |
5038 | int ret; |
5039 | |
5040 | @@ -52,7 +53,11 @@ static void parse_redboot_of(struct mtd_info *master) |
5041 | if (!np) |
5042 | return; |
5043 | |
5044 | - ret = of_property_read_u32(np, "fis-index-block", &dirblock); |
5045 | + npart = of_get_child_by_name(np, "partitions"); |
5046 | + if (!npart) |
5047 | + return; |
5048 | + |
5049 | + ret = of_property_read_u32(npart, "fis-index-block", &dirblock); |
5050 | if (ret) |
5051 | return; |
5052 | |
5053 | diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c |
5054 | index 91b156b2123a3..d0bdcc43b8eeb 100644 |
5055 | --- a/drivers/net/can/peak_canfd/peak_canfd.c |
5056 | +++ b/drivers/net/can/peak_canfd/peak_canfd.c |
5057 | @@ -338,8 +338,8 @@ static int pucan_handle_status(struct peak_canfd_priv *priv, |
5058 | return err; |
5059 | } |
5060 | |
5061 | - /* start network queue (echo_skb array is empty) */ |
5062 | - netif_start_queue(ndev); |
5063 | + /* wake network queue up (echo_skb array is empty) */ |
5064 | + netif_wake_queue(ndev); |
5065 | |
5066 | return 0; |
5067 | } |
5068 | diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c |
5069 | index 4f52810bebf89..db9f15f17610b 100644 |
5070 | --- a/drivers/net/can/usb/ems_usb.c |
5071 | +++ b/drivers/net/can/usb/ems_usb.c |
5072 | @@ -1053,7 +1053,6 @@ static void ems_usb_disconnect(struct usb_interface *intf) |
5073 | |
5074 | if (dev) { |
5075 | unregister_netdev(dev->netdev); |
5076 | - free_candev(dev->netdev); |
5077 | |
5078 | unlink_all_urbs(dev); |
5079 | |
5080 | @@ -1061,6 +1060,8 @@ static void ems_usb_disconnect(struct usb_interface *intf) |
5081 | |
5082 | kfree(dev->intr_in_buffer); |
5083 | kfree(dev->tx_msg_buffer); |
5084 | + |
5085 | + free_candev(dev->netdev); |
5086 | } |
5087 | } |
5088 | |
5089 | diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c |
5090 | index 2a9f8643629c0..907904c0a2888 100644 |
5091 | --- a/drivers/net/ethernet/aeroflex/greth.c |
5092 | +++ b/drivers/net/ethernet/aeroflex/greth.c |
5093 | @@ -1541,10 +1541,11 @@ static int greth_of_remove(struct platform_device *of_dev) |
5094 | mdiobus_unregister(greth->mdio); |
5095 | |
5096 | unregister_netdev(ndev); |
5097 | - free_netdev(ndev); |
5098 | |
5099 | of_iounmap(&of_dev->resource[0], greth->regs, resource_size(&of_dev->resource[0])); |
5100 | |
5101 | + free_netdev(ndev); |
5102 | + |
5103 | return 0; |
5104 | } |
5105 | |
5106 | diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5107 | index b27da024aa9d9..21669a42718c8 100644 |
5108 | --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5109 | +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
5110 | @@ -3741,3 +3741,4 @@ MODULE_AUTHOR("Broadcom Corporation"); |
5111 | MODULE_DESCRIPTION("Broadcom GENET Ethernet controller driver"); |
5112 | MODULE_ALIAS("platform:bcmgenet"); |
5113 | MODULE_LICENSE("GPL"); |
5114 | +MODULE_SOFTDEP("pre: mdio-bcm-unimac"); |
5115 | diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c |
5116 | index 701c12c9e0337..649c5c429bd7c 100644 |
5117 | --- a/drivers/net/ethernet/emulex/benet/be_cmds.c |
5118 | +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c |
5119 | @@ -550,7 +550,7 @@ int be_process_mcc(struct be_adapter *adapter) |
5120 | int num = 0, status = 0; |
5121 | struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; |
5122 | |
5123 | - spin_lock_bh(&adapter->mcc_cq_lock); |
5124 | + spin_lock(&adapter->mcc_cq_lock); |
5125 | |
5126 | while ((compl = be_mcc_compl_get(adapter))) { |
5127 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { |
5128 | @@ -566,7 +566,7 @@ int be_process_mcc(struct be_adapter *adapter) |
5129 | if (num) |
5130 | be_cq_notify(adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); |
5131 | |
5132 | - spin_unlock_bh(&adapter->mcc_cq_lock); |
5133 | + spin_unlock(&adapter->mcc_cq_lock); |
5134 | return status; |
5135 | } |
5136 | |
5137 | @@ -581,7 +581,9 @@ static int be_mcc_wait_compl(struct be_adapter *adapter) |
5138 | if (be_check_error(adapter, BE_ERROR_ANY)) |
5139 | return -EIO; |
5140 | |
5141 | + local_bh_disable(); |
5142 | status = be_process_mcc(adapter); |
5143 | + local_bh_enable(); |
5144 | |
5145 | if (atomic_read(&mcc_obj->q.used) == 0) |
5146 | break; |
5147 | diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c |
5148 | index 9aebb121365f5..552877590a8ab 100644 |
5149 | --- a/drivers/net/ethernet/emulex/benet/be_main.c |
5150 | +++ b/drivers/net/ethernet/emulex/benet/be_main.c |
5151 | @@ -5631,7 +5631,9 @@ static void be_worker(struct work_struct *work) |
5152 | * mcc completions |
5153 | */ |
5154 | if (!netif_running(adapter->netdev)) { |
5155 | + local_bh_disable(); |
5156 | be_process_mcc(adapter); |
5157 | + local_bh_enable(); |
5158 | goto reschedule; |
5159 | } |
5160 | |
5161 | diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c |
5162 | index 815fb62c4b02e..3d74401b4f102 100644 |
5163 | --- a/drivers/net/ethernet/ezchip/nps_enet.c |
5164 | +++ b/drivers/net/ethernet/ezchip/nps_enet.c |
5165 | @@ -610,7 +610,7 @@ static s32 nps_enet_probe(struct platform_device *pdev) |
5166 | |
5167 | /* Get IRQ number */ |
5168 | priv->irq = platform_get_irq(pdev, 0); |
5169 | - if (!priv->irq) { |
5170 | + if (priv->irq < 0) { |
5171 | dev_err(dev, "failed to retrieve <irq Rx-Tx> value from device tree\n"); |
5172 | err = -ENODEV; |
5173 | goto out_netdev; |
5174 | @@ -645,8 +645,8 @@ static s32 nps_enet_remove(struct platform_device *pdev) |
5175 | struct nps_enet_priv *priv = netdev_priv(ndev); |
5176 | |
5177 | unregister_netdev(ndev); |
5178 | - free_netdev(ndev); |
5179 | netif_napi_del(&priv->napi); |
5180 | + free_netdev(ndev); |
5181 | |
5182 | return 0; |
5183 | } |
5184 | diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c |
5185 | index 4050f81f788c3..2c06cdcd3e751 100644 |
5186 | --- a/drivers/net/ethernet/faraday/ftgmac100.c |
5187 | +++ b/drivers/net/ethernet/faraday/ftgmac100.c |
5188 | @@ -1821,14 +1821,17 @@ static int ftgmac100_probe(struct platform_device *pdev) |
5189 | if (np && of_get_property(np, "use-ncsi", NULL)) { |
5190 | if (!IS_ENABLED(CONFIG_NET_NCSI)) { |
5191 | dev_err(&pdev->dev, "NCSI stack not enabled\n"); |
5192 | + err = -EINVAL; |
5193 | goto err_ncsi_dev; |
5194 | } |
5195 | |
5196 | dev_info(&pdev->dev, "Using NCSI interface\n"); |
5197 | priv->use_ncsi = true; |
5198 | priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler); |
5199 | - if (!priv->ndev) |
5200 | + if (!priv->ndev) { |
5201 | + err = -EINVAL; |
5202 | goto err_ncsi_dev; |
5203 | + } |
5204 | } else if (np && of_get_property(np, "phy-handle", NULL)) { |
5205 | struct phy_device *phy; |
5206 | |
5207 | @@ -1836,6 +1839,7 @@ static int ftgmac100_probe(struct platform_device *pdev) |
5208 | &ftgmac100_adjust_link); |
5209 | if (!phy) { |
5210 | dev_err(&pdev->dev, "Failed to connect to phy\n"); |
5211 | + err = -EINVAL; |
5212 | goto err_setup_mdio; |
5213 | } |
5214 | |
5215 | diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c |
5216 | index 6ea0975d74a1f..1c4b35b1b3590 100644 |
5217 | --- a/drivers/net/ethernet/google/gve/gve_main.c |
5218 | +++ b/drivers/net/ethernet/google/gve/gve_main.c |
5219 | @@ -1118,8 +1118,8 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
5220 | |
5221 | gve_write_version(®_bar->driver_version); |
5222 | /* Get max queues to alloc etherdev */ |
5223 | - max_rx_queues = ioread32be(®_bar->max_tx_queues); |
5224 | - max_tx_queues = ioread32be(®_bar->max_rx_queues); |
5225 | + max_tx_queues = ioread32be(®_bar->max_tx_queues); |
5226 | + max_rx_queues = ioread32be(®_bar->max_rx_queues); |
5227 | /* Alloc and setup the netdev and priv */ |
5228 | dev = alloc_etherdev_mqs(sizeof(*priv), max_tx_queues, max_rx_queues); |
5229 | if (!dev) { |
5230 | diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
5231 | index 13e30eba5349e..1fd2b84e2e912 100644 |
5232 | --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c |
5233 | +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
5234 | @@ -2617,10 +2617,8 @@ static int ehea_restart_qps(struct net_device *dev) |
5235 | u16 dummy16 = 0; |
5236 | |
5237 | cb0 = (void *)get_zeroed_page(GFP_KERNEL); |
5238 | - if (!cb0) { |
5239 | - ret = -ENOMEM; |
5240 | - goto out; |
5241 | - } |
5242 | + if (!cb0) |
5243 | + return -ENOMEM; |
5244 | |
5245 | for (i = 0; i < (port->num_def_qps); i++) { |
5246 | struct ehea_port_res *pr = &port->port_res[i]; |
5247 | @@ -2640,6 +2638,7 @@ static int ehea_restart_qps(struct net_device *dev) |
5248 | cb0); |
5249 | if (hret != H_SUCCESS) { |
5250 | netdev_err(dev, "query_ehea_qp failed (1)\n"); |
5251 | + ret = -EFAULT; |
5252 | goto out; |
5253 | } |
5254 | |
5255 | @@ -2652,6 +2651,7 @@ static int ehea_restart_qps(struct net_device *dev) |
5256 | &dummy64, &dummy16, &dummy16); |
5257 | if (hret != H_SUCCESS) { |
5258 | netdev_err(dev, "modify_ehea_qp failed (1)\n"); |
5259 | + ret = -EFAULT; |
5260 | goto out; |
5261 | } |
5262 | |
5263 | @@ -2660,6 +2660,7 @@ static int ehea_restart_qps(struct net_device *dev) |
5264 | cb0); |
5265 | if (hret != H_SUCCESS) { |
5266 | netdev_err(dev, "query_ehea_qp failed (2)\n"); |
5267 | + ret = -EFAULT; |
5268 | goto out; |
5269 | } |
5270 | |
5271 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
5272 | index a2b7b982ee290..ecfe588f330ef 100644 |
5273 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
5274 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
5275 | @@ -694,8 +694,11 @@ static int init_tx_pools(struct net_device *netdev) |
5276 | |
5277 | adapter->tso_pool = kcalloc(tx_subcrqs, |
5278 | sizeof(struct ibmvnic_tx_pool), GFP_KERNEL); |
5279 | - if (!adapter->tso_pool) |
5280 | + if (!adapter->tso_pool) { |
5281 | + kfree(adapter->tx_pool); |
5282 | + adapter->tx_pool = NULL; |
5283 | return -1; |
5284 | + } |
5285 | |
5286 | adapter->num_active_tx_pools = tx_subcrqs; |
5287 | |
5288 | @@ -1088,6 +1091,11 @@ static int __ibmvnic_open(struct net_device *netdev) |
5289 | |
5290 | netif_tx_start_all_queues(netdev); |
5291 | |
5292 | + if (prev_state == VNIC_CLOSED) { |
5293 | + for (i = 0; i < adapter->req_rx_queues; i++) |
5294 | + napi_schedule(&adapter->napi[i]); |
5295 | + } |
5296 | + |
5297 | adapter->state = VNIC_OPEN; |
5298 | return rc; |
5299 | } |
5300 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
5301 | index c2feedfd321dc..a06d514215ede 100644 |
5302 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c |
5303 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
5304 | @@ -5199,18 +5199,20 @@ static void e1000_watchdog_task(struct work_struct *work) |
5305 | pm_runtime_resume(netdev->dev.parent); |
5306 | |
5307 | /* Checking if MAC is in DMoff state*/ |
5308 | - pcim_state = er32(STATUS); |
5309 | - while (pcim_state & E1000_STATUS_PCIM_STATE) { |
5310 | - if (tries++ == dmoff_exit_timeout) { |
5311 | - e_dbg("Error in exiting dmoff\n"); |
5312 | - break; |
5313 | - } |
5314 | - usleep_range(10000, 20000); |
5315 | + if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) { |
5316 | pcim_state = er32(STATUS); |
5317 | - |
5318 | - /* Checking if MAC exited DMoff state */ |
5319 | - if (!(pcim_state & E1000_STATUS_PCIM_STATE)) |
5320 | - e1000_phy_hw_reset(&adapter->hw); |
5321 | + while (pcim_state & E1000_STATUS_PCIM_STATE) { |
5322 | + if (tries++ == dmoff_exit_timeout) { |
5323 | + e_dbg("Error in exiting dmoff\n"); |
5324 | + break; |
5325 | + } |
5326 | + usleep_range(10000, 20000); |
5327 | + pcim_state = er32(STATUS); |
5328 | + |
5329 | + /* Checking if MAC exited DMoff state */ |
5330 | + if (!(pcim_state & E1000_STATUS_PCIM_STATE)) |
5331 | + e1000_phy_hw_reset(&adapter->hw); |
5332 | + } |
5333 | } |
5334 | |
5335 | /* update snapshot of PHY registers on LSC */ |
5336 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
5337 | index e4d0b7747e84d..2288a3855e522 100644 |
5338 | --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
5339 | +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
5340 | @@ -1259,8 +1259,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev, |
5341 | if (ethtool_link_ksettings_test_link_mode(&safe_ks, |
5342 | supported, |
5343 | Autoneg) && |
5344 | - hw->phy.link_info.phy_type != |
5345 | - I40E_PHY_TYPE_10GBASE_T) { |
5346 | + hw->phy.media_type != I40E_MEDIA_TYPE_BASET) { |
5347 | netdev_info(netdev, "Autoneg cannot be disabled on this phy\n"); |
5348 | err = -EINVAL; |
5349 | goto done; |
5350 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
5351 | index a1b4e995f2b7e..4f4ec1f166ef4 100644 |
5352 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
5353 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
5354 | @@ -8292,6 +8292,8 @@ int i40e_vsi_open(struct i40e_vsi *vsi) |
5355 | dev_driver_string(&pf->pdev->dev), |
5356 | dev_name(&pf->pdev->dev)); |
5357 | err = i40e_vsi_request_irq(vsi, int_name); |
5358 | + if (err) |
5359 | + goto err_setup_rx; |
5360 | |
5361 | } else { |
5362 | err = -EINVAL; |
5363 | diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
5364 | index 491bcfd36ac25..7857ebff92e82 100644 |
5365 | --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
5366 | +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
5367 | @@ -5910,6 +5910,8 @@ static int mvpp2_probe(struct platform_device *pdev) |
5368 | return 0; |
5369 | |
5370 | err_port_probe: |
5371 | + fwnode_handle_put(port_fwnode); |
5372 | + |
5373 | i = 0; |
5374 | fwnode_for_each_available_child_node(fwnode, port_fwnode) { |
5375 | if (priv->port_list[i]) |
5376 | diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |
5377 | index 18e6d87c607bd..f1269fe4ac721 100644 |
5378 | --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |
5379 | +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |
5380 | @@ -2535,9 +2535,13 @@ static int pch_gbe_probe(struct pci_dev *pdev, |
5381 | adapter->pdev = pdev; |
5382 | adapter->hw.back = adapter; |
5383 | adapter->hw.reg = pcim_iomap_table(pdev)[PCH_GBE_PCI_BAR]; |
5384 | + |
5385 | adapter->pdata = (struct pch_gbe_privdata *)pci_id->driver_data; |
5386 | - if (adapter->pdata && adapter->pdata->platform_init) |
5387 | - adapter->pdata->platform_init(pdev); |
5388 | + if (adapter->pdata && adapter->pdata->platform_init) { |
5389 | + ret = adapter->pdata->platform_init(pdev); |
5390 | + if (ret) |
5391 | + goto err_free_netdev; |
5392 | + } |
5393 | |
5394 | adapter->ptp_pdev = |
5395 | pci_get_domain_bus_and_slot(pci_domain_nr(adapter->pdev->bus), |
5396 | @@ -2632,7 +2636,7 @@ err_free_netdev: |
5397 | */ |
5398 | static int pch_gbe_minnow_platform_init(struct pci_dev *pdev) |
5399 | { |
5400 | - unsigned long flags = GPIOF_DIR_OUT | GPIOF_INIT_HIGH | GPIOF_EXPORT; |
5401 | + unsigned long flags = GPIOF_OUT_INIT_HIGH; |
5402 | unsigned gpio = MINNOW_PHY_RESET_GPIO; |
5403 | int ret; |
5404 | |
5405 | diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c |
5406 | index c20e7ef18bc95..79d74763cf24a 100644 |
5407 | --- a/drivers/net/ieee802154/mac802154_hwsim.c |
5408 | +++ b/drivers/net/ieee802154/mac802154_hwsim.c |
5409 | @@ -480,7 +480,7 @@ static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info) |
5410 | struct hwsim_edge *e; |
5411 | u32 v0, v1; |
5412 | |
5413 | - if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] && |
5414 | + if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] || |
5415 | !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE]) |
5416 | return -EINVAL; |
5417 | |
5418 | @@ -715,6 +715,8 @@ static int hwsim_subscribe_all_others(struct hwsim_phy *phy) |
5419 | |
5420 | return 0; |
5421 | |
5422 | +sub_fail: |
5423 | + hwsim_edge_unsubscribe_me(phy); |
5424 | me_fail: |
5425 | rcu_read_lock(); |
5426 | list_for_each_entry_rcu(e, &phy->edges, list) { |
5427 | @@ -722,8 +724,6 @@ me_fail: |
5428 | hwsim_free_edge(e); |
5429 | } |
5430 | rcu_read_unlock(); |
5431 | -sub_fail: |
5432 | - hwsim_edge_unsubscribe_me(phy); |
5433 | return -ENOMEM; |
5434 | } |
5435 | |
5436 | @@ -824,12 +824,17 @@ err_pib: |
5437 | static void hwsim_del(struct hwsim_phy *phy) |
5438 | { |
5439 | struct hwsim_pib *pib; |
5440 | + struct hwsim_edge *e; |
5441 | |
5442 | hwsim_edge_unsubscribe_me(phy); |
5443 | |
5444 | list_del(&phy->list); |
5445 | |
5446 | rcu_read_lock(); |
5447 | + list_for_each_entry_rcu(e, &phy->edges, list) { |
5448 | + list_del_rcu(&e->list); |
5449 | + hwsim_free_edge(e); |
5450 | + } |
5451 | pib = rcu_dereference(phy->pib); |
5452 | rcu_read_unlock(); |
5453 | |
5454 | diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c |
5455 | index 1267786d2931b..f08ed52d51f3f 100644 |
5456 | --- a/drivers/net/vrf.c |
5457 | +++ b/drivers/net/vrf.c |
5458 | @@ -1035,22 +1035,22 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev, |
5459 | int orig_iif = skb->skb_iif; |
5460 | bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); |
5461 | bool is_ndisc = ipv6_ndisc_frame(skb); |
5462 | - bool is_ll_src; |
5463 | |
5464 | /* loopback, multicast & non-ND link-local traffic; do not push through |
5465 | * packet taps again. Reset pkt_type for upper layers to process skb. |
5466 | - * for packets with lladdr src, however, skip so that the dst can be |
5467 | - * determine at input using original ifindex in the case that daddr |
5468 | - * needs strict |
5469 | + * For strict packets with a source LLA, determine the dst using the |
5470 | + * original ifindex. |
5471 | */ |
5472 | - is_ll_src = ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL; |
5473 | - if (skb->pkt_type == PACKET_LOOPBACK || |
5474 | - (need_strict && !is_ndisc && !is_ll_src)) { |
5475 | + if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) { |
5476 | skb->dev = vrf_dev; |
5477 | skb->skb_iif = vrf_dev->ifindex; |
5478 | IP6CB(skb)->flags |= IP6SKB_L3SLAVE; |
5479 | + |
5480 | if (skb->pkt_type == PACKET_LOOPBACK) |
5481 | skb->pkt_type = PACKET_HOST; |
5482 | + else if (ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL) |
5483 | + vrf_ip6_input_dst(skb, vrf_dev, orig_iif); |
5484 | + |
5485 | goto out; |
5486 | } |
5487 | |
5488 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
5489 | index 8443df79fabc7..c5991e31c557e 100644 |
5490 | --- a/drivers/net/vxlan.c |
5491 | +++ b/drivers/net/vxlan.c |
5492 | @@ -1995,6 +1995,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni) |
5493 | struct neighbour *n; |
5494 | struct nd_msg *msg; |
5495 | |
5496 | + rcu_read_lock(); |
5497 | in6_dev = __in6_dev_get(dev); |
5498 | if (!in6_dev) |
5499 | goto out; |
5500 | @@ -2046,6 +2047,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni) |
5501 | } |
5502 | |
5503 | out: |
5504 | + rcu_read_unlock(); |
5505 | consume_skb(skb); |
5506 | return NETDEV_TX_OK; |
5507 | } |
5508 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
5509 | index 47b733fdf4fcb..20e248fd43642 100644 |
5510 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
5511 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
5512 | @@ -5267,6 +5267,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, |
5513 | |
5514 | if (arvif->nohwcrypt && |
5515 | !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { |
5516 | + ret = -EINVAL; |
5517 | ath10k_warn(ar, "cryptmode module param needed for sw crypto\n"); |
5518 | goto err; |
5519 | } |
5520 | diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c |
5521 | index fd49d3419e791..0f055e5777490 100644 |
5522 | --- a/drivers/net/wireless/ath/ath10k/pci.c |
5523 | +++ b/drivers/net/wireless/ath/ath10k/pci.c |
5524 | @@ -3647,8 +3647,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev, |
5525 | ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); |
5526 | if (bus_params.chip_id != 0xffffffff) { |
5527 | if (!ath10k_pci_chip_is_supported(pdev->device, |
5528 | - bus_params.chip_id)) |
5529 | + bus_params.chip_id)) { |
5530 | + ret = -ENODEV; |
5531 | goto err_unsupported; |
5532 | + } |
5533 | } |
5534 | } |
5535 | |
5536 | @@ -3659,11 +3661,15 @@ static int ath10k_pci_probe(struct pci_dev *pdev, |
5537 | } |
5538 | |
5539 | bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); |
5540 | - if (bus_params.chip_id == 0xffffffff) |
5541 | + if (bus_params.chip_id == 0xffffffff) { |
5542 | + ret = -ENODEV; |
5543 | goto err_unsupported; |
5544 | + } |
5545 | |
5546 | - if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) |
5547 | - goto err_free_irq; |
5548 | + if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) { |
5549 | + ret = -ENODEV; |
5550 | + goto err_unsupported; |
5551 | + } |
5552 | |
5553 | ret = ath10k_core_register(ar, &bus_params); |
5554 | if (ret) { |
5555 | diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
5556 | index bd7e757a0f92d..d14e01da3c312 100644 |
5557 | --- a/drivers/net/wireless/ath/ath9k/main.c |
5558 | +++ b/drivers/net/wireless/ath/ath9k/main.c |
5559 | @@ -304,6 +304,11 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) |
5560 | hchan = ah->curchan; |
5561 | } |
5562 | |
5563 | + if (!hchan) { |
5564 | + fastcc = false; |
5565 | + hchan = ath9k_cmn_get_channel(sc->hw, ah, &sc->cur_chan->chandef); |
5566 | + } |
5567 | + |
5568 | if (!ath_prepare_reset(sc)) |
5569 | fastcc = false; |
5570 | |
5571 | diff --git a/drivers/net/wireless/ath/carl9170/Kconfig b/drivers/net/wireless/ath/carl9170/Kconfig |
5572 | index b1bce7aad3999..c2641edab0bcb 100644 |
5573 | --- a/drivers/net/wireless/ath/carl9170/Kconfig |
5574 | +++ b/drivers/net/wireless/ath/carl9170/Kconfig |
5575 | @@ -16,13 +16,11 @@ config CARL9170 |
5576 | |
5577 | config CARL9170_LEDS |
5578 | bool "SoftLED Support" |
5579 | - depends on CARL9170 |
5580 | - select MAC80211_LEDS |
5581 | - select LEDS_CLASS |
5582 | - select NEW_LEDS |
5583 | default y |
5584 | + depends on CARL9170 |
5585 | + depends on MAC80211_LEDS |
5586 | help |
5587 | - This option is necessary, if you want your device' LEDs to blink |
5588 | + This option is necessary, if you want your device's LEDs to blink. |
5589 | |
5590 | Say Y, unless you need the LEDs for firmware debugging. |
5591 | |
5592 | diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c |
5593 | index 46ae4ec4ad47d..556ba3c6c5d8e 100644 |
5594 | --- a/drivers/net/wireless/ath/wcn36xx/main.c |
5595 | +++ b/drivers/net/wireless/ath/wcn36xx/main.c |
5596 | @@ -293,23 +293,16 @@ static int wcn36xx_start(struct ieee80211_hw *hw) |
5597 | goto out_free_dxe_pool; |
5598 | } |
5599 | |
5600 | - wcn->hal_buf = kmalloc(WCN36XX_HAL_BUF_SIZE, GFP_KERNEL); |
5601 | - if (!wcn->hal_buf) { |
5602 | - wcn36xx_err("Failed to allocate smd buf\n"); |
5603 | - ret = -ENOMEM; |
5604 | - goto out_free_dxe_ctl; |
5605 | - } |
5606 | - |
5607 | ret = wcn36xx_smd_load_nv(wcn); |
5608 | if (ret) { |
5609 | wcn36xx_err("Failed to push NV to chip\n"); |
5610 | - goto out_free_smd_buf; |
5611 | + goto out_free_dxe_ctl; |
5612 | } |
5613 | |
5614 | ret = wcn36xx_smd_start(wcn); |
5615 | if (ret) { |
5616 | wcn36xx_err("Failed to start chip\n"); |
5617 | - goto out_free_smd_buf; |
5618 | + goto out_free_dxe_ctl; |
5619 | } |
5620 | |
5621 | if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) { |
5622 | @@ -336,8 +329,6 @@ static int wcn36xx_start(struct ieee80211_hw *hw) |
5623 | |
5624 | out_smd_stop: |
5625 | wcn36xx_smd_stop(wcn); |
5626 | -out_free_smd_buf: |
5627 | - kfree(wcn->hal_buf); |
5628 | out_free_dxe_ctl: |
5629 | wcn36xx_dxe_free_ctl_blks(wcn); |
5630 | out_free_dxe_pool: |
5631 | @@ -374,8 +365,6 @@ static void wcn36xx_stop(struct ieee80211_hw *hw) |
5632 | |
5633 | wcn36xx_dxe_free_mem_pools(wcn); |
5634 | wcn36xx_dxe_free_ctl_blks(wcn); |
5635 | - |
5636 | - kfree(wcn->hal_buf); |
5637 | } |
5638 | |
5639 | static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) |
5640 | @@ -1322,6 +1311,12 @@ static int wcn36xx_probe(struct platform_device *pdev) |
5641 | mutex_init(&wcn->hal_mutex); |
5642 | mutex_init(&wcn->scan_lock); |
5643 | |
5644 | + wcn->hal_buf = devm_kmalloc(wcn->dev, WCN36XX_HAL_BUF_SIZE, GFP_KERNEL); |
5645 | + if (!wcn->hal_buf) { |
5646 | + ret = -ENOMEM; |
5647 | + goto out_wq; |
5648 | + } |
5649 | + |
5650 | ret = dma_set_mask_and_coherent(wcn->dev, DMA_BIT_MASK(32)); |
5651 | if (ret < 0) { |
5652 | wcn36xx_err("failed to set DMA mask: %d\n", ret); |
5653 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
5654 | index cd813c69a1781..6439adcd2f995 100644 |
5655 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
5656 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
5657 | @@ -2612,8 +2612,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, |
5658 | struct brcmf_sta_info_le sta_info_le; |
5659 | u32 sta_flags; |
5660 | u32 is_tdls_peer; |
5661 | - s32 total_rssi; |
5662 | - s32 count_rssi; |
5663 | + s32 total_rssi_avg = 0; |
5664 | + s32 total_rssi = 0; |
5665 | + s32 count_rssi = 0; |
5666 | int rssi; |
5667 | u32 i; |
5668 | |
5669 | @@ -2679,25 +2680,27 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, |
5670 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); |
5671 | sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); |
5672 | } |
5673 | - total_rssi = 0; |
5674 | - count_rssi = 0; |
5675 | for (i = 0; i < BRCMF_ANT_MAX; i++) { |
5676 | - if (sta_info_le.rssi[i]) { |
5677 | - sinfo->chain_signal_avg[count_rssi] = |
5678 | - sta_info_le.rssi[i]; |
5679 | - sinfo->chain_signal[count_rssi] = |
5680 | - sta_info_le.rssi[i]; |
5681 | - total_rssi += sta_info_le.rssi[i]; |
5682 | - count_rssi++; |
5683 | - } |
5684 | + if (sta_info_le.rssi[i] == 0 || |
5685 | + sta_info_le.rx_lastpkt_rssi[i] == 0) |
5686 | + continue; |
5687 | + sinfo->chains |= BIT(count_rssi); |
5688 | + sinfo->chain_signal[count_rssi] = |
5689 | + sta_info_le.rx_lastpkt_rssi[i]; |
5690 | + sinfo->chain_signal_avg[count_rssi] = |
5691 | + sta_info_le.rssi[i]; |
5692 | + total_rssi += sta_info_le.rx_lastpkt_rssi[i]; |
5693 | + total_rssi_avg += sta_info_le.rssi[i]; |
5694 | + count_rssi++; |
5695 | } |
5696 | if (count_rssi) { |
5697 | - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); |
5698 | - sinfo->chains = count_rssi; |
5699 | - |
5700 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); |
5701 | - total_rssi /= count_rssi; |
5702 | - sinfo->signal = total_rssi; |
5703 | + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); |
5704 | + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); |
5705 | + sinfo->filled |= |
5706 | + BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); |
5707 | + sinfo->signal = total_rssi / count_rssi; |
5708 | + sinfo->signal_avg = total_rssi_avg / count_rssi; |
5709 | } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED, |
5710 | &ifp->vif->sme_state)) { |
5711 | memset(&scb_val, 0, sizeof(scb_val)); |
5712 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c |
5713 | index 6188275b17e5a..288d4d4d44548 100644 |
5714 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c |
5715 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c |
5716 | @@ -1223,6 +1223,7 @@ static int brcms_bcma_probe(struct bcma_device *pdev) |
5717 | { |
5718 | struct brcms_info *wl; |
5719 | struct ieee80211_hw *hw; |
5720 | + int ret; |
5721 | |
5722 | dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n", |
5723 | pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class, |
5724 | @@ -1247,11 +1248,16 @@ static int brcms_bcma_probe(struct bcma_device *pdev) |
5725 | wl = brcms_attach(pdev); |
5726 | if (!wl) { |
5727 | pr_err("%s: brcms_attach failed!\n", __func__); |
5728 | - return -ENODEV; |
5729 | + ret = -ENODEV; |
5730 | + goto err_free_ieee80211; |
5731 | } |
5732 | brcms_led_register(wl); |
5733 | |
5734 | return 0; |
5735 | + |
5736 | +err_free_ieee80211: |
5737 | + ieee80211_free_hw(hw); |
5738 | + return ret; |
5739 | } |
5740 | |
5741 | static int brcms_suspend(struct bcma_device *pdev) |
5742 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
5743 | index 2b92980a49e68..d46e606b7b025 100644 |
5744 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
5745 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
5746 | @@ -1091,6 +1091,9 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, |
5747 | if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_INVALID_STA)) |
5748 | return -1; |
5749 | |
5750 | + if (unlikely(ieee80211_is_any_nullfunc(fc)) && sta->he_cap.has_he) |
5751 | + return -1; |
5752 | + |
5753 | if (unlikely(ieee80211_is_probe_resp(fc))) |
5754 | iwl_mvm_probe_resp_set_noa(mvm, skb); |
5755 | |
5756 | diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c |
5757 | index 58c9623c3a916..bc46a0aa06eb7 100644 |
5758 | --- a/drivers/net/wireless/marvell/mwifiex/pcie.c |
5759 | +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c |
5760 | @@ -1080,7 +1080,7 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter) |
5761 | static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) |
5762 | { |
5763 | struct pcie_service_card *card = adapter->card; |
5764 | - u32 tmp; |
5765 | + u32 *cookie; |
5766 | |
5767 | card->sleep_cookie_vbase = pci_alloc_consistent(card->dev, sizeof(u32), |
5768 | &card->sleep_cookie_pbase); |
5769 | @@ -1089,13 +1089,11 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) |
5770 | "pci_alloc_consistent failed!\n"); |
5771 | return -ENOMEM; |
5772 | } |
5773 | + cookie = (u32 *)card->sleep_cookie_vbase; |
5774 | /* Init val of Sleep Cookie */ |
5775 | - tmp = FW_AWAKE_COOKIE; |
5776 | - put_unaligned(tmp, card->sleep_cookie_vbase); |
5777 | + *cookie = FW_AWAKE_COOKIE; |
5778 | |
5779 | - mwifiex_dbg(adapter, INFO, |
5780 | - "alloc_scook: sleep cookie=0x%x\n", |
5781 | - get_unaligned(card->sleep_cookie_vbase)); |
5782 | + mwifiex_dbg(adapter, INFO, "alloc_scook: sleep cookie=0x%x\n", *cookie); |
5783 | |
5784 | return 0; |
5785 | } |
5786 | diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c |
5787 | index a07304405b2cc..03791f3fe480c 100644 |
5788 | --- a/drivers/net/wireless/rsi/rsi_91x_hal.c |
5789 | +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c |
5790 | @@ -203,7 +203,7 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb) |
5791 | wh->frame_control |= cpu_to_le16(RSI_SET_PS_ENABLE); |
5792 | |
5793 | if ((!(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) && |
5794 | - (common->secinfo.security_enable)) { |
5795 | + info->control.hw_key) { |
5796 | if (rsi_is_cipher_wep(common)) |
5797 | ieee80211_size += 4; |
5798 | else |
5799 | @@ -470,9 +470,9 @@ int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb) |
5800 | } |
5801 | |
5802 | if (common->band == NL80211_BAND_2GHZ) |
5803 | - bcn_frm->bbp_info |= cpu_to_le16(RSI_RATE_1); |
5804 | + bcn_frm->rate_info |= cpu_to_le16(RSI_RATE_1); |
5805 | else |
5806 | - bcn_frm->bbp_info |= cpu_to_le16(RSI_RATE_6); |
5807 | + bcn_frm->rate_info |= cpu_to_le16(RSI_RATE_6); |
5808 | |
5809 | if (mac_bcn->data[tim_offset + 2] == 0) |
5810 | bcn_frm->frame_info |= cpu_to_le16(RSI_DATA_DESC_DTIM_BEACON); |
5811 | diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5812 | index ce5e92d82efc8..ca1e609f637e4 100644 |
5813 | --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5814 | +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5815 | @@ -1027,7 +1027,6 @@ static int rsi_mac80211_set_key(struct ieee80211_hw *hw, |
5816 | mutex_lock(&common->mutex); |
5817 | switch (cmd) { |
5818 | case SET_KEY: |
5819 | - secinfo->security_enable = true; |
5820 | status = rsi_hal_key_config(hw, vif, key, sta); |
5821 | if (status) { |
5822 | mutex_unlock(&common->mutex); |
5823 | @@ -1046,8 +1045,6 @@ static int rsi_mac80211_set_key(struct ieee80211_hw *hw, |
5824 | break; |
5825 | |
5826 | case DISABLE_KEY: |
5827 | - if (vif->type == NL80211_IFTYPE_STATION) |
5828 | - secinfo->security_enable = false; |
5829 | rsi_dbg(ERR_ZONE, "%s: RSI del key\n", __func__); |
5830 | memset(key, 0, sizeof(struct ieee80211_key_conf)); |
5831 | status = rsi_hal_key_config(hw, vif, key, sta); |
5832 | diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c |
5833 | index 9cc8a335d519d..ed67f65986775 100644 |
5834 | --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c |
5835 | +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c |
5836 | @@ -1788,8 +1788,7 @@ int rsi_send_wowlan_request(struct rsi_common *common, u16 flags, |
5837 | RSI_WIFI_MGMT_Q); |
5838 | cmd_frame->desc.desc_dword0.frame_type = WOWLAN_CONFIG_PARAMS; |
5839 | cmd_frame->host_sleep_status = sleep_status; |
5840 | - if (common->secinfo.security_enable && |
5841 | - common->secinfo.gtk_cipher) |
5842 | + if (common->secinfo.gtk_cipher) |
5843 | flags |= RSI_WOW_GTK_REKEY; |
5844 | if (sleep_status) |
5845 | cmd_frame->wow_flags = flags; |
5846 | diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h |
5847 | index 73a19e43106b1..b3e25bc28682c 100644 |
5848 | --- a/drivers/net/wireless/rsi/rsi_main.h |
5849 | +++ b/drivers/net/wireless/rsi/rsi_main.h |
5850 | @@ -151,7 +151,6 @@ enum edca_queue { |
5851 | }; |
5852 | |
5853 | struct security_info { |
5854 | - bool security_enable; |
5855 | u32 ptk_cipher; |
5856 | u32 gtk_cipher; |
5857 | }; |
5858 | diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c |
5859 | index fc35f7ae67b0a..9b07e8c7689ab 100644 |
5860 | --- a/drivers/nvme/target/fc.c |
5861 | +++ b/drivers/nvme/target/fc.c |
5862 | @@ -2151,13 +2151,6 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, |
5863 | u32 xfrlen = be32_to_cpu(cmdiu->data_len); |
5864 | int ret; |
5865 | |
5866 | - /* |
5867 | - * if there is no nvmet mapping to the targetport there |
5868 | - * shouldn't be requests. just terminate them. |
5869 | - */ |
5870 | - if (!tgtport->pe) |
5871 | - goto transport_error; |
5872 | - |
5873 | /* |
5874 | * Fused commands are currently not supported in the linux |
5875 | * implementation. |
5876 | @@ -2185,7 +2178,8 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, |
5877 | |
5878 | fod->req.cmd = &fod->cmdiubuf.sqe; |
5879 | fod->req.cqe = &fod->rspiubuf.cqe; |
5880 | - fod->req.port = tgtport->pe->port; |
5881 | + if (tgtport->pe) |
5882 | + fod->req.port = tgtport->pe->port; |
5883 | |
5884 | /* clear any response payload */ |
5885 | memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf)); |
5886 | diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c |
5887 | index 223d617ecfe17..943d2a60bfdf9 100644 |
5888 | --- a/drivers/of/fdt.c |
5889 | +++ b/drivers/of/fdt.c |
5890 | @@ -501,11 +501,11 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, |
5891 | |
5892 | if (size && |
5893 | early_init_dt_reserve_memory_arch(base, size, nomap) == 0) |
5894 | - pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n", |
5895 | - uname, &base, (unsigned long)size / SZ_1M); |
5896 | + pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n", |
5897 | + uname, &base, (unsigned long)(size / SZ_1M)); |
5898 | else |
5899 | - pr_info("Reserved memory: failed to reserve memory for node '%s': base %pa, size %ld MiB\n", |
5900 | - uname, &base, (unsigned long)size / SZ_1M); |
5901 | + pr_info("Reserved memory: failed to reserve memory for node '%s': base %pa, size %lu MiB\n", |
5902 | + uname, &base, (unsigned long)(size / SZ_1M)); |
5903 | |
5904 | len -= t_len; |
5905 | if (first) { |
5906 | diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c |
5907 | index 3fb5d8caffd53..6ed3ffd0a6295 100644 |
5908 | --- a/drivers/of/of_reserved_mem.c |
5909 | +++ b/drivers/of/of_reserved_mem.c |
5910 | @@ -134,9 +134,9 @@ static int __init __reserved_mem_alloc_size(unsigned long node, |
5911 | ret = early_init_dt_alloc_reserved_memory_arch(size, |
5912 | align, start, end, nomap, &base); |
5913 | if (ret == 0) { |
5914 | - pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n", |
5915 | + pr_debug("allocated memory for '%s' node: base %pa, size %lu MiB\n", |
5916 | uname, &base, |
5917 | - (unsigned long)size / SZ_1M); |
5918 | + (unsigned long)(size / SZ_1M)); |
5919 | break; |
5920 | } |
5921 | len -= t_len; |
5922 | @@ -146,8 +146,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node, |
5923 | ret = early_init_dt_alloc_reserved_memory_arch(size, align, |
5924 | 0, 0, nomap, &base); |
5925 | if (ret == 0) |
5926 | - pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n", |
5927 | - uname, &base, (unsigned long)size / SZ_1M); |
5928 | + pr_debug("allocated memory for '%s' node: base %pa, size %lu MiB\n", |
5929 | + uname, &base, (unsigned long)(size / SZ_1M)); |
5930 | } |
5931 | |
5932 | if (base == 0) { |
5933 | diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c |
5934 | index f1f300218fab8..8c45d6c32c30e 100644 |
5935 | --- a/drivers/pci/controller/pci-hyperv.c |
5936 | +++ b/drivers/pci/controller/pci-hyperv.c |
5937 | @@ -3121,6 +3121,9 @@ static void __exit exit_hv_pci_drv(void) |
5938 | |
5939 | static int __init init_hv_pci_drv(void) |
5940 | { |
5941 | + if (!hv_is_hyperv_initialized()) |
5942 | + return -ENODEV; |
5943 | + |
5944 | /* Set the invalid domain number's bit, so it will not be used */ |
5945 | set_bit(HVPCI_DOM_INVALID, hvpci_dom_map); |
5946 | |
5947 | diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c |
5948 | index 9cdd89b29334e..6a3fa1f69e68a 100644 |
5949 | --- a/drivers/perf/arm_smmuv3_pmu.c |
5950 | +++ b/drivers/perf/arm_smmuv3_pmu.c |
5951 | @@ -275,7 +275,7 @@ static int smmu_pmu_apply_event_filter(struct smmu_pmu *smmu_pmu, |
5952 | struct perf_event *event, int idx) |
5953 | { |
5954 | u32 span, sid; |
5955 | - unsigned int num_ctrs = smmu_pmu->num_counters; |
5956 | + unsigned int cur_idx, num_ctrs = smmu_pmu->num_counters; |
5957 | bool filter_en = !!get_filter_enable(event); |
5958 | |
5959 | span = filter_en ? get_filter_span(event) : |
5960 | @@ -283,17 +283,19 @@ static int smmu_pmu_apply_event_filter(struct smmu_pmu *smmu_pmu, |
5961 | sid = filter_en ? get_filter_stream_id(event) : |
5962 | SMMU_PMCG_DEFAULT_FILTER_SID; |
5963 | |
5964 | - /* Support individual filter settings */ |
5965 | - if (!smmu_pmu->global_filter) { |
5966 | + cur_idx = find_first_bit(smmu_pmu->used_counters, num_ctrs); |
5967 | + /* |
5968 | + * Per-counter filtering, or scheduling the first globally-filtered |
5969 | + * event into an empty PMU so idx == 0 and it works out equivalent. |
5970 | + */ |
5971 | + if (!smmu_pmu->global_filter || cur_idx == num_ctrs) { |
5972 | smmu_pmu_set_event_filter(event, idx, span, sid); |
5973 | return 0; |
5974 | } |
5975 | |
5976 | - /* Requested settings same as current global settings*/ |
5977 | - idx = find_first_bit(smmu_pmu->used_counters, num_ctrs); |
5978 | - if (idx == num_ctrs || |
5979 | - smmu_pmu_check_global_filter(smmu_pmu->events[idx], event)) { |
5980 | - smmu_pmu_set_event_filter(event, 0, span, sid); |
5981 | + /* Otherwise, must match whatever's currently scheduled */ |
5982 | + if (smmu_pmu_check_global_filter(smmu_pmu->events[cur_idx], event)) { |
5983 | + smmu_pmu_set_evtyper(smmu_pmu, idx, get_event(event)); |
5984 | return 0; |
5985 | } |
5986 | |
5987 | diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c |
5988 | index 09f44c6e2eaf6..726ed8f59868c 100644 |
5989 | --- a/drivers/perf/fsl_imx8_ddr_perf.c |
5990 | +++ b/drivers/perf/fsl_imx8_ddr_perf.c |
5991 | @@ -562,8 +562,10 @@ static int ddr_perf_probe(struct platform_device *pdev) |
5992 | |
5993 | name = devm_kasprintf(&pdev->dev, GFP_KERNEL, DDR_PERF_DEV_NAME "%d", |
5994 | num); |
5995 | - if (!name) |
5996 | - return -ENOMEM; |
5997 | + if (!name) { |
5998 | + ret = -ENOMEM; |
5999 | + goto cpuhp_state_err; |
6000 | + } |
6001 | |
6002 | pmu->devtype_data = of_device_get_match_data(&pdev->dev); |
6003 | |
6004 | diff --git a/drivers/phy/socionext/phy-uniphier-pcie.c b/drivers/phy/socionext/phy-uniphier-pcie.c |
6005 | index 93ffbd2940fa4..0bad0e01279a1 100644 |
6006 | --- a/drivers/phy/socionext/phy-uniphier-pcie.c |
6007 | +++ b/drivers/phy/socionext/phy-uniphier-pcie.c |
6008 | @@ -20,11 +20,13 @@ |
6009 | |
6010 | /* PHY */ |
6011 | #define PCL_PHY_TEST_I 0x2000 |
6012 | -#define PCL_PHY_TEST_O 0x2004 |
6013 | #define TESTI_DAT_MASK GENMASK(13, 6) |
6014 | #define TESTI_ADR_MASK GENMASK(5, 1) |
6015 | #define TESTI_WR_EN BIT(0) |
6016 | |
6017 | +#define PCL_PHY_TEST_O 0x2004 |
6018 | +#define TESTO_DAT_MASK GENMASK(7, 0) |
6019 | + |
6020 | #define PCL_PHY_RESET 0x200c |
6021 | #define PCL_PHY_RESET_N_MNMODE BIT(8) /* =1:manual */ |
6022 | #define PCL_PHY_RESET_N BIT(0) /* =1:deasssert */ |
6023 | @@ -72,11 +74,12 @@ static void uniphier_pciephy_set_param(struct uniphier_pciephy_priv *priv, |
6024 | val = FIELD_PREP(TESTI_DAT_MASK, 1); |
6025 | val |= FIELD_PREP(TESTI_ADR_MASK, reg); |
6026 | uniphier_pciephy_testio_write(priv, val); |
6027 | - val = readl(priv->base + PCL_PHY_TEST_O); |
6028 | + val = readl(priv->base + PCL_PHY_TEST_O) & TESTO_DAT_MASK; |
6029 | |
6030 | /* update value */ |
6031 | - val &= ~FIELD_PREP(TESTI_DAT_MASK, mask); |
6032 | - val = FIELD_PREP(TESTI_DAT_MASK, mask & param); |
6033 | + val &= ~mask; |
6034 | + val |= mask & param; |
6035 | + val = FIELD_PREP(TESTI_DAT_MASK, val); |
6036 | val |= FIELD_PREP(TESTI_ADR_MASK, reg); |
6037 | uniphier_pciephy_testio_write(priv, val); |
6038 | uniphier_pciephy_testio_write(priv, val | TESTI_WR_EN); |
6039 | diff --git a/drivers/phy/ti/phy-dm816x-usb.c b/drivers/phy/ti/phy-dm816x-usb.c |
6040 | index cbcce7cf0028e..2ed5fe20d7792 100644 |
6041 | --- a/drivers/phy/ti/phy-dm816x-usb.c |
6042 | +++ b/drivers/phy/ti/phy-dm816x-usb.c |
6043 | @@ -246,19 +246,28 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev) |
6044 | |
6045 | pm_runtime_enable(phy->dev); |
6046 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); |
6047 | - if (IS_ERR(generic_phy)) |
6048 | - return PTR_ERR(generic_phy); |
6049 | + if (IS_ERR(generic_phy)) { |
6050 | + error = PTR_ERR(generic_phy); |
6051 | + goto clk_unprepare; |
6052 | + } |
6053 | |
6054 | phy_set_drvdata(generic_phy, phy); |
6055 | |
6056 | phy_provider = devm_of_phy_provider_register(phy->dev, |
6057 | of_phy_simple_xlate); |
6058 | - if (IS_ERR(phy_provider)) |
6059 | - return PTR_ERR(phy_provider); |
6060 | + if (IS_ERR(phy_provider)) { |
6061 | + error = PTR_ERR(phy_provider); |
6062 | + goto clk_unprepare; |
6063 | + } |
6064 | |
6065 | usb_add_phy_dev(&phy->phy); |
6066 | |
6067 | return 0; |
6068 | + |
6069 | +clk_unprepare: |
6070 | + pm_runtime_disable(phy->dev); |
6071 | + clk_unprepare(phy->refclk); |
6072 | + return error; |
6073 | } |
6074 | |
6075 | static int dm816x_usb_phy_remove(struct platform_device *pdev) |
6076 | diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c |
6077 | index 61db7c7a35ec9..60d35a2c14ba5 100644 |
6078 | --- a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c |
6079 | +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c |
6080 | @@ -68,6 +68,7 @@ |
6081 | PIN_NOGP_CFG(QSPI1_MOSI_IO0, "QSPI1_MOSI_IO0", fn, CFG_FLAGS), \ |
6082 | PIN_NOGP_CFG(QSPI1_SPCLK, "QSPI1_SPCLK", fn, CFG_FLAGS), \ |
6083 | PIN_NOGP_CFG(QSPI1_SSL, "QSPI1_SSL", fn, CFG_FLAGS), \ |
6084 | + PIN_NOGP_CFG(PRESET_N, "PRESET#", fn, SH_PFC_PIN_CFG_PULL_DOWN),\ |
6085 | PIN_NOGP_CFG(RPC_INT_N, "RPC_INT#", fn, CFG_FLAGS), \ |
6086 | PIN_NOGP_CFG(RPC_RESET_N, "RPC_RESET#", fn, CFG_FLAGS), \ |
6087 | PIN_NOGP_CFG(RPC_WP_N, "RPC_WP#", fn, CFG_FLAGS), \ |
6088 | @@ -6109,7 +6110,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = { |
6089 | [ 4] = RCAR_GP_PIN(6, 29), /* USB30_OVC */ |
6090 | [ 5] = RCAR_GP_PIN(6, 30), /* GP6_30 */ |
6091 | [ 6] = RCAR_GP_PIN(6, 31), /* GP6_31 */ |
6092 | - [ 7] = SH_PFC_PIN_NONE, |
6093 | + [ 7] = PIN_PRESET_N, /* PRESET# */ |
6094 | [ 8] = SH_PFC_PIN_NONE, |
6095 | [ 9] = SH_PFC_PIN_NONE, |
6096 | [10] = SH_PFC_PIN_NONE, |
6097 | diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c |
6098 | index 5200dadd6b3ef..f4b51e5e7e020 100644 |
6099 | --- a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c |
6100 | +++ b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c |
6101 | @@ -54,10 +54,10 @@ |
6102 | PIN_NOGP_CFG(FSCLKST_N, "FSCLKST_N", fn, CFG_FLAGS), \ |
6103 | PIN_NOGP_CFG(MLB_REF, "MLB_REF", fn, CFG_FLAGS), \ |
6104 | PIN_NOGP_CFG(PRESETOUT_N, "PRESETOUT_N", fn, CFG_FLAGS), \ |
6105 | - PIN_NOGP_CFG(TCK, "TCK", fn, CFG_FLAGS), \ |
6106 | - PIN_NOGP_CFG(TDI, "TDI", fn, CFG_FLAGS), \ |
6107 | - PIN_NOGP_CFG(TMS, "TMS", fn, CFG_FLAGS), \ |
6108 | - PIN_NOGP_CFG(TRST_N, "TRST_N", fn, CFG_FLAGS) |
6109 | + PIN_NOGP_CFG(TCK, "TCK", fn, SH_PFC_PIN_CFG_PULL_UP), \ |
6110 | + PIN_NOGP_CFG(TDI, "TDI", fn, SH_PFC_PIN_CFG_PULL_UP), \ |
6111 | + PIN_NOGP_CFG(TMS, "TMS", fn, SH_PFC_PIN_CFG_PULL_UP), \ |
6112 | + PIN_NOGP_CFG(TRST_N, "TRST_N", fn, SH_PFC_PIN_CFG_PULL_UP) |
6113 | |
6114 | /* |
6115 | * F_() : just information |
6116 | diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c |
6117 | index 71a969fc3b206..f202fc0dd1ff2 100644 |
6118 | --- a/drivers/platform/x86/toshiba_acpi.c |
6119 | +++ b/drivers/platform/x86/toshiba_acpi.c |
6120 | @@ -2841,6 +2841,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) |
6121 | |
6122 | if (!dev->info_supported && !dev->system_event_supported) { |
6123 | pr_warn("No hotkey query interface found\n"); |
6124 | + error = -EINVAL; |
6125 | goto err_remove_filter; |
6126 | } |
6127 | |
6128 | diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c |
6129 | index e18d291c7f21c..23fa429ebe760 100644 |
6130 | --- a/drivers/regulator/da9052-regulator.c |
6131 | +++ b/drivers/regulator/da9052-regulator.c |
6132 | @@ -250,7 +250,8 @@ static int da9052_regulator_set_voltage_time_sel(struct regulator_dev *rdev, |
6133 | case DA9052_ID_BUCK3: |
6134 | case DA9052_ID_LDO2: |
6135 | case DA9052_ID_LDO3: |
6136 | - ret = (new_sel - old_sel) * info->step_uV / 6250; |
6137 | + ret = DIV_ROUND_UP(abs(new_sel - old_sel) * info->step_uV, |
6138 | + 6250); |
6139 | break; |
6140 | } |
6141 | |
6142 | diff --git a/drivers/regulator/hi655x-regulator.c b/drivers/regulator/hi655x-regulator.c |
6143 | index ac2ee2030211a..b44f492a2b832 100644 |
6144 | --- a/drivers/regulator/hi655x-regulator.c |
6145 | +++ b/drivers/regulator/hi655x-regulator.c |
6146 | @@ -72,7 +72,7 @@ enum hi655x_regulator_id { |
6147 | static int hi655x_is_enabled(struct regulator_dev *rdev) |
6148 | { |
6149 | unsigned int value = 0; |
6150 | - struct hi655x_regulator *regulator = rdev_get_drvdata(rdev); |
6151 | + const struct hi655x_regulator *regulator = rdev_get_drvdata(rdev); |
6152 | |
6153 | regmap_read(rdev->regmap, regulator->status_reg, &value); |
6154 | return (value & rdev->desc->enable_mask); |
6155 | @@ -80,7 +80,7 @@ static int hi655x_is_enabled(struct regulator_dev *rdev) |
6156 | |
6157 | static int hi655x_disable(struct regulator_dev *rdev) |
6158 | { |
6159 | - struct hi655x_regulator *regulator = rdev_get_drvdata(rdev); |
6160 | + const struct hi655x_regulator *regulator = rdev_get_drvdata(rdev); |
6161 | |
6162 | return regmap_write(rdev->regmap, regulator->disable_reg, |
6163 | rdev->desc->enable_mask); |
6164 | @@ -169,7 +169,6 @@ static const struct hi655x_regulator regulators[] = { |
6165 | static int hi655x_regulator_probe(struct platform_device *pdev) |
6166 | { |
6167 | unsigned int i; |
6168 | - struct hi655x_regulator *regulator; |
6169 | struct hi655x_pmic *pmic; |
6170 | struct regulator_config config = { }; |
6171 | struct regulator_dev *rdev; |
6172 | @@ -180,22 +179,17 @@ static int hi655x_regulator_probe(struct platform_device *pdev) |
6173 | return -ENODEV; |
6174 | } |
6175 | |
6176 | - regulator = devm_kzalloc(&pdev->dev, sizeof(*regulator), GFP_KERNEL); |
6177 | - if (!regulator) |
6178 | - return -ENOMEM; |
6179 | - |
6180 | - platform_set_drvdata(pdev, regulator); |
6181 | - |
6182 | config.dev = pdev->dev.parent; |
6183 | config.regmap = pmic->regmap; |
6184 | - config.driver_data = regulator; |
6185 | for (i = 0; i < ARRAY_SIZE(regulators); i++) { |
6186 | + config.driver_data = (void *) ®ulators[i]; |
6187 | + |
6188 | rdev = devm_regulator_register(&pdev->dev, |
6189 | ®ulators[i].rdesc, |
6190 | &config); |
6191 | if (IS_ERR(rdev)) { |
6192 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
6193 | - regulator->rdesc.name); |
6194 | + regulators[i].rdesc.name); |
6195 | return PTR_ERR(rdev); |
6196 | } |
6197 | } |
6198 | diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c |
6199 | index ba42682e06f36..40e09b1d323dd 100644 |
6200 | --- a/drivers/regulator/mt6358-regulator.c |
6201 | +++ b/drivers/regulator/mt6358-regulator.c |
6202 | @@ -457,7 +457,7 @@ static struct mt6358_regulator_info mt6358_regulators[] = { |
6203 | MT6358_REG_FIXED("ldo_vaud28", VAUD28, |
6204 | MT6358_LDO_VAUD28_CON0, 0, 2800000), |
6205 | MT6358_LDO("ldo_vdram2", VDRAM2, vdram2_voltages, vdram2_idx, |
6206 | - MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0x10, 0), |
6207 | + MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0xf, 0), |
6208 | MT6358_LDO("ldo_vsim1", VSIM1, vsim_voltages, vsim_idx, |
6209 | MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00, 8), |
6210 | MT6358_LDO("ldo_vibr", VIBR, vibr_voltages, vibr_idx, |
6211 | diff --git a/drivers/regulator/uniphier-regulator.c b/drivers/regulator/uniphier-regulator.c |
6212 | index 2311924c31039..2904c7bb4767c 100644 |
6213 | --- a/drivers/regulator/uniphier-regulator.c |
6214 | +++ b/drivers/regulator/uniphier-regulator.c |
6215 | @@ -203,6 +203,7 @@ static const struct of_device_id uniphier_regulator_match[] = { |
6216 | }, |
6217 | { /* Sentinel */ }, |
6218 | }; |
6219 | +MODULE_DEVICE_TABLE(of, uniphier_regulator_match); |
6220 | |
6221 | static struct platform_driver uniphier_regulator_driver = { |
6222 | .probe = uniphier_regulator_probe, |
6223 | diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c |
6224 | index 2999e33a7e376..d28e7597dc050 100644 |
6225 | --- a/drivers/rtc/rtc-stm32.c |
6226 | +++ b/drivers/rtc/rtc-stm32.c |
6227 | @@ -756,7 +756,7 @@ static int stm32_rtc_probe(struct platform_device *pdev) |
6228 | |
6229 | ret = clk_prepare_enable(rtc->rtc_ck); |
6230 | if (ret) |
6231 | - goto err; |
6232 | + goto err_no_rtc_ck; |
6233 | |
6234 | if (rtc->data->need_dbp) |
6235 | regmap_update_bits(rtc->dbp, rtc->dbp_reg, |
6236 | @@ -832,10 +832,12 @@ static int stm32_rtc_probe(struct platform_device *pdev) |
6237 | } |
6238 | |
6239 | return 0; |
6240 | + |
6241 | err: |
6242 | + clk_disable_unprepare(rtc->rtc_ck); |
6243 | +err_no_rtc_ck: |
6244 | if (rtc->data->has_pclk) |
6245 | clk_disable_unprepare(rtc->pclk); |
6246 | - clk_disable_unprepare(rtc->rtc_ck); |
6247 | |
6248 | if (rtc->data->need_dbp) |
6249 | regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); |
6250 | diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c |
6251 | index 51038ec309c12..1fd982b4d64bd 100644 |
6252 | --- a/drivers/s390/cio/chp.c |
6253 | +++ b/drivers/s390/cio/chp.c |
6254 | @@ -255,6 +255,9 @@ static ssize_t chp_status_write(struct device *dev, |
6255 | if (!num_args) |
6256 | return count; |
6257 | |
6258 | + /* Wait until previous actions have settled. */ |
6259 | + css_wait_for_slow_path(); |
6260 | + |
6261 | if (!strncasecmp(cmd, "on", 2) || !strcmp(cmd, "1")) { |
6262 | mutex_lock(&cp->lock); |
6263 | error = s390_vary_chpid(cp->chpid, 1); |
6264 | diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c |
6265 | index 6392a1b95b028..980a78d3d81b6 100644 |
6266 | --- a/drivers/s390/cio/chsc.c |
6267 | +++ b/drivers/s390/cio/chsc.c |
6268 | @@ -753,8 +753,6 @@ int chsc_chp_vary(struct chp_id chpid, int on) |
6269 | { |
6270 | struct channel_path *chp = chpid_to_chp(chpid); |
6271 | |
6272 | - /* Wait until previous actions have settled. */ |
6273 | - css_wait_for_slow_path(); |
6274 | /* |
6275 | * Redo PathVerification on the devices the chpid connects to |
6276 | */ |
6277 | diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c |
6278 | index 0f17bd51088ac..3b15fb25b5e69 100644 |
6279 | --- a/drivers/scsi/FlashPoint.c |
6280 | +++ b/drivers/scsi/FlashPoint.c |
6281 | @@ -40,7 +40,7 @@ struct sccb_mgr_info { |
6282 | u16 si_per_targ_ultra_nego; |
6283 | u16 si_per_targ_no_disc; |
6284 | u16 si_per_targ_wide_nego; |
6285 | - u16 si_flags; |
6286 | + u16 si_mflags; |
6287 | unsigned char si_card_family; |
6288 | unsigned char si_bustype; |
6289 | unsigned char si_card_model[3]; |
6290 | @@ -1070,22 +1070,22 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) |
6291 | ScamFlg = |
6292 | (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2); |
6293 | |
6294 | - pCardInfo->si_flags = 0x0000; |
6295 | + pCardInfo->si_mflags = 0x0000; |
6296 | |
6297 | if (i & 0x01) |
6298 | - pCardInfo->si_flags |= SCSI_PARITY_ENA; |
6299 | + pCardInfo->si_mflags |= SCSI_PARITY_ENA; |
6300 | |
6301 | if (!(i & 0x02)) |
6302 | - pCardInfo->si_flags |= SOFT_RESET; |
6303 | + pCardInfo->si_mflags |= SOFT_RESET; |
6304 | |
6305 | if (i & 0x10) |
6306 | - pCardInfo->si_flags |= EXTENDED_TRANSLATION; |
6307 | + pCardInfo->si_mflags |= EXTENDED_TRANSLATION; |
6308 | |
6309 | if (ScamFlg & SCAM_ENABLED) |
6310 | - pCardInfo->si_flags |= FLAG_SCAM_ENABLED; |
6311 | + pCardInfo->si_mflags |= FLAG_SCAM_ENABLED; |
6312 | |
6313 | if (ScamFlg & SCAM_LEVEL2) |
6314 | - pCardInfo->si_flags |= FLAG_SCAM_LEVEL2; |
6315 | + pCardInfo->si_mflags |= FLAG_SCAM_LEVEL2; |
6316 | |
6317 | j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L); |
6318 | if (i & 0x04) { |
6319 | @@ -1101,7 +1101,7 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) |
6320 | |
6321 | if (!(RD_HARPOON(ioport + hp_page_ctrl) & NARROW_SCSI_CARD)) |
6322 | |
6323 | - pCardInfo->si_flags |= SUPPORT_16TAR_32LUN; |
6324 | + pCardInfo->si_mflags |= SUPPORT_16TAR_32LUN; |
6325 | |
6326 | pCardInfo->si_card_family = HARPOON_FAMILY; |
6327 | pCardInfo->si_bustype = BUSTYPE_PCI; |
6328 | @@ -1137,15 +1137,15 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) |
6329 | |
6330 | if (pCardInfo->si_card_model[1] == '3') { |
6331 | if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)) |
6332 | - pCardInfo->si_flags |= LOW_BYTE_TERM; |
6333 | + pCardInfo->si_mflags |= LOW_BYTE_TERM; |
6334 | } else if (pCardInfo->si_card_model[2] == '0') { |
6335 | temp = RD_HARPOON(ioport + hp_xfer_pad); |
6336 | WR_HARPOON(ioport + hp_xfer_pad, (temp & ~BIT(4))); |
6337 | if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)) |
6338 | - pCardInfo->si_flags |= LOW_BYTE_TERM; |
6339 | + pCardInfo->si_mflags |= LOW_BYTE_TERM; |
6340 | WR_HARPOON(ioport + hp_xfer_pad, (temp | BIT(4))); |
6341 | if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)) |
6342 | - pCardInfo->si_flags |= HIGH_BYTE_TERM; |
6343 | + pCardInfo->si_mflags |= HIGH_BYTE_TERM; |
6344 | WR_HARPOON(ioport + hp_xfer_pad, temp); |
6345 | } else { |
6346 | temp = RD_HARPOON(ioport + hp_ee_ctrl); |
6347 | @@ -1163,9 +1163,9 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) |
6348 | WR_HARPOON(ioport + hp_ee_ctrl, temp); |
6349 | WR_HARPOON(ioport + hp_xfer_pad, temp2); |
6350 | if (!(temp3 & BIT(7))) |
6351 | - pCardInfo->si_flags |= LOW_BYTE_TERM; |
6352 | + pCardInfo->si_mflags |= LOW_BYTE_TERM; |
6353 | if (!(temp3 & BIT(6))) |
6354 | - pCardInfo->si_flags |= HIGH_BYTE_TERM; |
6355 | + pCardInfo->si_mflags |= HIGH_BYTE_TERM; |
6356 | } |
6357 | |
6358 | ARAM_ACCESS(ioport); |
6359 | @@ -1272,7 +1272,7 @@ static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info |
6360 | WR_HARPOON(ioport + hp_arb_id, pCardInfo->si_id); |
6361 | CurrCard->ourId = pCardInfo->si_id; |
6362 | |
6363 | - i = (unsigned char)pCardInfo->si_flags; |
6364 | + i = (unsigned char)pCardInfo->si_mflags; |
6365 | if (i & SCSI_PARITY_ENA) |
6366 | WR_HARPOON(ioport + hp_portctrl_1, (HOST_MODE8 | CHK_SCSI_P)); |
6367 | |
6368 | @@ -1286,14 +1286,14 @@ static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info |
6369 | j |= SCSI_TERM_ENA_H; |
6370 | WR_HARPOON(ioport + hp_ee_ctrl, j); |
6371 | |
6372 | - if (!(pCardInfo->si_flags & SOFT_RESET)) { |
6373 | + if (!(pCardInfo->si_mflags & SOFT_RESET)) { |
6374 | |
6375 | FPT_sresb(ioport, thisCard); |
6376 | |
6377 | FPT_scini(thisCard, pCardInfo->si_id, 0); |
6378 | } |
6379 | |
6380 | - if (pCardInfo->si_flags & POST_ALL_UNDERRRUNS) |
6381 | + if (pCardInfo->si_mflags & POST_ALL_UNDERRRUNS) |
6382 | CurrCard->globalFlags |= F_NO_FILTER; |
6383 | |
6384 | if (pCurrNvRam) { |
6385 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
6386 | index aff630fccb07e..3654cfc4376fa 100644 |
6387 | --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
6388 | +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
6389 | @@ -5728,8 +5728,10 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) |
6390 | handle, parent_handle, |
6391 | (u64)sas_expander->sas_address, sas_expander->num_phys); |
6392 | |
6393 | - if (!sas_expander->num_phys) |
6394 | + if (!sas_expander->num_phys) { |
6395 | + rc = -1; |
6396 | goto out_fail; |
6397 | + } |
6398 | sas_expander->phy = kcalloc(sas_expander->num_phys, |
6399 | sizeof(struct _sas_phy), GFP_KERNEL); |
6400 | if (!sas_expander->phy) { |
6401 | diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
6402 | index b5867e1566f42..8e6d7ba95df14 100644 |
6403 | --- a/drivers/scsi/scsi_lib.c |
6404 | +++ b/drivers/scsi/scsi_lib.c |
6405 | @@ -762,6 +762,7 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) |
6406 | case 0x07: /* operation in progress */ |
6407 | case 0x08: /* Long write in progress */ |
6408 | case 0x09: /* self test in progress */ |
6409 | + case 0x11: /* notify (enable spinup) required */ |
6410 | case 0x14: /* space allocation in progress */ |
6411 | case 0x1a: /* start stop unit in progress */ |
6412 | case 0x1b: /* sanitize in progress */ |
6413 | diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c |
6414 | index 23accfedbf4d1..f7ca1f7a68f00 100644 |
6415 | --- a/drivers/soundwire/stream.c |
6416 | +++ b/drivers/soundwire/stream.c |
6417 | @@ -420,7 +420,6 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, |
6418 | struct completion *port_ready; |
6419 | struct sdw_dpn_prop *dpn_prop; |
6420 | struct sdw_prepare_ch prep_ch; |
6421 | - unsigned int time_left; |
6422 | bool intr = false; |
6423 | int ret = 0, val; |
6424 | u32 addr; |
6425 | @@ -477,15 +476,15 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, |
6426 | |
6427 | /* Wait for completion on port ready */ |
6428 | port_ready = &s_rt->slave->port_ready[prep_ch.num]; |
6429 | - time_left = wait_for_completion_timeout(port_ready, |
6430 | - msecs_to_jiffies(dpn_prop->ch_prep_timeout)); |
6431 | + wait_for_completion_timeout(port_ready, |
6432 | + msecs_to_jiffies(dpn_prop->ch_prep_timeout)); |
6433 | |
6434 | val = sdw_read(s_rt->slave, SDW_DPN_PREPARESTATUS(p_rt->num)); |
6435 | - val &= p_rt->ch_mask; |
6436 | - if (!time_left || val) { |
6437 | + if ((val < 0) || (val & p_rt->ch_mask)) { |
6438 | + ret = (val < 0) ? val : -ETIMEDOUT; |
6439 | dev_err(&s_rt->slave->dev, |
6440 | - "Chn prep failed for port:%d\n", prep_ch.num); |
6441 | - return -ETIMEDOUT; |
6442 | + "Chn prep failed for port %d: %d\n", prep_ch.num, ret); |
6443 | + return ret; |
6444 | } |
6445 | } |
6446 | |
6447 | diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c |
6448 | index 51633b2b64371..69a9df2cbbcf2 100644 |
6449 | --- a/drivers/spi/spi-loopback-test.c |
6450 | +++ b/drivers/spi/spi-loopback-test.c |
6451 | @@ -868,7 +868,7 @@ static int spi_test_run_iter(struct spi_device *spi, |
6452 | test.transfers[i].len = len; |
6453 | if (test.transfers[i].tx_buf) |
6454 | test.transfers[i].tx_buf += tx_off; |
6455 | - if (test.transfers[i].tx_buf) |
6456 | + if (test.transfers[i].rx_buf) |
6457 | test.transfers[i].rx_buf += rx_off; |
6458 | } |
6459 | |
6460 | diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c |
6461 | index b8e201c094843..f64d030c760ae 100644 |
6462 | --- a/drivers/spi/spi-omap-100k.c |
6463 | +++ b/drivers/spi/spi-omap-100k.c |
6464 | @@ -242,7 +242,7 @@ static int omap1_spi100k_setup_transfer(struct spi_device *spi, |
6465 | else |
6466 | word_len = spi->bits_per_word; |
6467 | |
6468 | - if (spi->bits_per_word > 32) |
6469 | + if (word_len > 32) |
6470 | return -EINVAL; |
6471 | cs->word_len = word_len; |
6472 | |
6473 | diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c |
6474 | index 956df79035d56..3a8acd78308f6 100644 |
6475 | --- a/drivers/spi/spi-sun6i.c |
6476 | +++ b/drivers/spi/spi-sun6i.c |
6477 | @@ -297,6 +297,10 @@ static int sun6i_spi_transfer_one(struct spi_master *master, |
6478 | } |
6479 | |
6480 | sun6i_spi_write(sspi, SUN6I_CLK_CTL_REG, reg); |
6481 | + /* Finally enable the bus - doing so before might raise SCK to HIGH */ |
6482 | + reg = sun6i_spi_read(sspi, SUN6I_GBL_CTL_REG); |
6483 | + reg |= SUN6I_GBL_CTL_BUS_ENABLE; |
6484 | + sun6i_spi_write(sspi, SUN6I_GBL_CTL_REG, reg); |
6485 | |
6486 | /* Setup the transfer now... */ |
6487 | if (sspi->tx_buf) |
6488 | @@ -405,7 +409,7 @@ static int sun6i_spi_runtime_resume(struct device *dev) |
6489 | } |
6490 | |
6491 | sun6i_spi_write(sspi, SUN6I_GBL_CTL_REG, |
6492 | - SUN6I_GBL_CTL_BUS_ENABLE | SUN6I_GBL_CTL_MASTER | SUN6I_GBL_CTL_TP); |
6493 | + SUN6I_GBL_CTL_MASTER | SUN6I_GBL_CTL_TP); |
6494 | |
6495 | return 0; |
6496 | |
6497 | diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c |
6498 | index f88cbb94ce122..181ea30c416a2 100644 |
6499 | --- a/drivers/spi/spi-topcliff-pch.c |
6500 | +++ b/drivers/spi/spi-topcliff-pch.c |
6501 | @@ -576,8 +576,10 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) |
6502 | data->pkt_tx_buff = kzalloc(size, GFP_KERNEL); |
6503 | if (data->pkt_tx_buff != NULL) { |
6504 | data->pkt_rx_buff = kzalloc(size, GFP_KERNEL); |
6505 | - if (!data->pkt_rx_buff) |
6506 | + if (!data->pkt_rx_buff) { |
6507 | kfree(data->pkt_tx_buff); |
6508 | + data->pkt_tx_buff = NULL; |
6509 | + } |
6510 | } |
6511 | |
6512 | if (!data->pkt_rx_buff) { |
6513 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
6514 | index f8f3434d5ab1e..ac05c9c864884 100644 |
6515 | --- a/drivers/spi/spi.c |
6516 | +++ b/drivers/spi/spi.c |
6517 | @@ -1849,6 +1849,7 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc) |
6518 | /* Store a pointer to the node in the device structure */ |
6519 | of_node_get(nc); |
6520 | spi->dev.of_node = nc; |
6521 | + spi->dev.fwnode = of_fwnode_handle(nc); |
6522 | |
6523 | /* Register the new device */ |
6524 | rc = spi_add_device(spi); |
6525 | diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c |
6526 | index 6ceee98ed6ff2..5c7e61cafd195 100644 |
6527 | --- a/drivers/ssb/scan.c |
6528 | +++ b/drivers/ssb/scan.c |
6529 | @@ -325,6 +325,7 @@ int ssb_bus_scan(struct ssb_bus *bus, |
6530 | if (bus->nr_devices > ARRAY_SIZE(bus->devices)) { |
6531 | pr_err("More than %d ssb cores found (%d)\n", |
6532 | SSB_MAX_NR_CORES, bus->nr_devices); |
6533 | + err = -EINVAL; |
6534 | goto err_unmap; |
6535 | } |
6536 | if (bus->bustype == SSB_BUSTYPE_SSB) { |
6537 | diff --git a/drivers/ssb/sdio.c b/drivers/ssb/sdio.c |
6538 | index 7fe0afb42234f..66c5c2169704b 100644 |
6539 | --- a/drivers/ssb/sdio.c |
6540 | +++ b/drivers/ssb/sdio.c |
6541 | @@ -411,7 +411,6 @@ static void ssb_sdio_block_write(struct ssb_device *dev, const void *buffer, |
6542 | sdio_claim_host(bus->host_sdio); |
6543 | if (unlikely(ssb_sdio_switch_core(bus, dev))) { |
6544 | error = -EIO; |
6545 | - memset((void *)buffer, 0xff, count); |
6546 | goto err_out; |
6547 | } |
6548 | offset |= bus->sdio_sbaddr & 0xffff; |
6549 | diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c |
6550 | index eeeeec97ad278..b545c2ca80a41 100644 |
6551 | --- a/drivers/staging/fbtft/fb_agm1264k-fl.c |
6552 | +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c |
6553 | @@ -84,9 +84,9 @@ static void reset(struct fbtft_par *par) |
6554 | |
6555 | dev_dbg(par->info->device, "%s()\n", __func__); |
6556 | |
6557 | - gpiod_set_value(par->gpio.reset, 0); |
6558 | - udelay(20); |
6559 | gpiod_set_value(par->gpio.reset, 1); |
6560 | + udelay(20); |
6561 | + gpiod_set_value(par->gpio.reset, 0); |
6562 | mdelay(120); |
6563 | } |
6564 | |
6565 | @@ -194,12 +194,12 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) |
6566 | /* select chip */ |
6567 | if (*buf) { |
6568 | /* cs1 */ |
6569 | - gpiod_set_value(par->CS0, 1); |
6570 | - gpiod_set_value(par->CS1, 0); |
6571 | - } else { |
6572 | - /* cs0 */ |
6573 | gpiod_set_value(par->CS0, 0); |
6574 | gpiod_set_value(par->CS1, 1); |
6575 | + } else { |
6576 | + /* cs0 */ |
6577 | + gpiod_set_value(par->CS0, 1); |
6578 | + gpiod_set_value(par->CS1, 0); |
6579 | } |
6580 | |
6581 | gpiod_set_value(par->RS, 0); /* RS->0 (command mode) */ |
6582 | @@ -397,8 +397,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) |
6583 | } |
6584 | kfree(convert_buf); |
6585 | |
6586 | - gpiod_set_value(par->CS0, 1); |
6587 | - gpiod_set_value(par->CS1, 1); |
6588 | + gpiod_set_value(par->CS0, 0); |
6589 | + gpiod_set_value(par->CS1, 0); |
6590 | |
6591 | return ret; |
6592 | } |
6593 | @@ -419,10 +419,10 @@ static int write(struct fbtft_par *par, void *buf, size_t len) |
6594 | for (i = 0; i < 8; ++i) |
6595 | gpiod_set_value(par->gpio.db[i], data & (1 << i)); |
6596 | /* set E */ |
6597 | - gpiod_set_value(par->EPIN, 1); |
6598 | + gpiod_set_value(par->EPIN, 0); |
6599 | udelay(5); |
6600 | /* unset E - write */ |
6601 | - gpiod_set_value(par->EPIN, 0); |
6602 | + gpiod_set_value(par->EPIN, 1); |
6603 | udelay(1); |
6604 | } |
6605 | |
6606 | diff --git a/drivers/staging/fbtft/fb_bd663474.c b/drivers/staging/fbtft/fb_bd663474.c |
6607 | index e2c7646588f8c..1629c2c440a97 100644 |
6608 | --- a/drivers/staging/fbtft/fb_bd663474.c |
6609 | +++ b/drivers/staging/fbtft/fb_bd663474.c |
6610 | @@ -12,7 +12,6 @@ |
6611 | #include <linux/module.h> |
6612 | #include <linux/kernel.h> |
6613 | #include <linux/init.h> |
6614 | -#include <linux/gpio/consumer.h> |
6615 | #include <linux/delay.h> |
6616 | |
6617 | #include "fbtft.h" |
6618 | @@ -24,9 +23,6 @@ |
6619 | |
6620 | static int init_display(struct fbtft_par *par) |
6621 | { |
6622 | - if (par->gpio.cs) |
6623 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6624 | - |
6625 | par->fbtftops.reset(par); |
6626 | |
6627 | /* Initialization sequence from Lib_UTFT */ |
6628 | diff --git a/drivers/staging/fbtft/fb_ili9163.c b/drivers/staging/fbtft/fb_ili9163.c |
6629 | index 05648c3ffe474..6582a2c90aafc 100644 |
6630 | --- a/drivers/staging/fbtft/fb_ili9163.c |
6631 | +++ b/drivers/staging/fbtft/fb_ili9163.c |
6632 | @@ -11,7 +11,6 @@ |
6633 | #include <linux/module.h> |
6634 | #include <linux/kernel.h> |
6635 | #include <linux/init.h> |
6636 | -#include <linux/gpio/consumer.h> |
6637 | #include <linux/delay.h> |
6638 | #include <video/mipi_display.h> |
6639 | |
6640 | @@ -77,9 +76,6 @@ static int init_display(struct fbtft_par *par) |
6641 | { |
6642 | par->fbtftops.reset(par); |
6643 | |
6644 | - if (par->gpio.cs) |
6645 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6646 | - |
6647 | write_reg(par, MIPI_DCS_SOFT_RESET); /* software reset */ |
6648 | mdelay(500); |
6649 | write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE); /* exit sleep */ |
6650 | diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c |
6651 | index f2e72d14431db..a8f4c618b754c 100644 |
6652 | --- a/drivers/staging/fbtft/fb_ili9320.c |
6653 | +++ b/drivers/staging/fbtft/fb_ili9320.c |
6654 | @@ -8,7 +8,6 @@ |
6655 | #include <linux/module.h> |
6656 | #include <linux/kernel.h> |
6657 | #include <linux/init.h> |
6658 | -#include <linux/gpio/consumer.h> |
6659 | #include <linux/spi/spi.h> |
6660 | #include <linux/delay.h> |
6661 | |
6662 | diff --git a/drivers/staging/fbtft/fb_ili9325.c b/drivers/staging/fbtft/fb_ili9325.c |
6663 | index c9aa4cb431236..16d3b17ca2798 100644 |
6664 | --- a/drivers/staging/fbtft/fb_ili9325.c |
6665 | +++ b/drivers/staging/fbtft/fb_ili9325.c |
6666 | @@ -10,7 +10,6 @@ |
6667 | #include <linux/module.h> |
6668 | #include <linux/kernel.h> |
6669 | #include <linux/init.h> |
6670 | -#include <linux/gpio/consumer.h> |
6671 | #include <linux/delay.h> |
6672 | |
6673 | #include "fbtft.h" |
6674 | @@ -85,9 +84,6 @@ static int init_display(struct fbtft_par *par) |
6675 | { |
6676 | par->fbtftops.reset(par); |
6677 | |
6678 | - if (par->gpio.cs) |
6679 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6680 | - |
6681 | bt &= 0x07; |
6682 | vc &= 0x07; |
6683 | vrh &= 0x0f; |
6684 | diff --git a/drivers/staging/fbtft/fb_ili9340.c b/drivers/staging/fbtft/fb_ili9340.c |
6685 | index 415183c7054a8..704236bcaf3ff 100644 |
6686 | --- a/drivers/staging/fbtft/fb_ili9340.c |
6687 | +++ b/drivers/staging/fbtft/fb_ili9340.c |
6688 | @@ -8,7 +8,6 @@ |
6689 | #include <linux/module.h> |
6690 | #include <linux/kernel.h> |
6691 | #include <linux/init.h> |
6692 | -#include <linux/gpio/consumer.h> |
6693 | #include <linux/delay.h> |
6694 | #include <video/mipi_display.h> |
6695 | |
6696 | diff --git a/drivers/staging/fbtft/fb_s6d1121.c b/drivers/staging/fbtft/fb_s6d1121.c |
6697 | index 8c7de32903434..62f27172f8449 100644 |
6698 | --- a/drivers/staging/fbtft/fb_s6d1121.c |
6699 | +++ b/drivers/staging/fbtft/fb_s6d1121.c |
6700 | @@ -12,7 +12,6 @@ |
6701 | #include <linux/module.h> |
6702 | #include <linux/kernel.h> |
6703 | #include <linux/init.h> |
6704 | -#include <linux/gpio/consumer.h> |
6705 | #include <linux/delay.h> |
6706 | |
6707 | #include "fbtft.h" |
6708 | @@ -29,9 +28,6 @@ static int init_display(struct fbtft_par *par) |
6709 | { |
6710 | par->fbtftops.reset(par); |
6711 | |
6712 | - if (par->gpio.cs) |
6713 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6714 | - |
6715 | /* Initialization sequence from Lib_UTFT */ |
6716 | |
6717 | write_reg(par, 0x0011, 0x2004); |
6718 | diff --git a/drivers/staging/fbtft/fb_sh1106.c b/drivers/staging/fbtft/fb_sh1106.c |
6719 | index 6f7249493ea3b..7b9ab39e1c1a8 100644 |
6720 | --- a/drivers/staging/fbtft/fb_sh1106.c |
6721 | +++ b/drivers/staging/fbtft/fb_sh1106.c |
6722 | @@ -9,7 +9,6 @@ |
6723 | #include <linux/module.h> |
6724 | #include <linux/kernel.h> |
6725 | #include <linux/init.h> |
6726 | -#include <linux/gpio/consumer.h> |
6727 | #include <linux/delay.h> |
6728 | |
6729 | #include "fbtft.h" |
6730 | diff --git a/drivers/staging/fbtft/fb_ssd1289.c b/drivers/staging/fbtft/fb_ssd1289.c |
6731 | index 7a3fe022cc69d..f27bab38b3ec4 100644 |
6732 | --- a/drivers/staging/fbtft/fb_ssd1289.c |
6733 | +++ b/drivers/staging/fbtft/fb_ssd1289.c |
6734 | @@ -10,7 +10,6 @@ |
6735 | #include <linux/module.h> |
6736 | #include <linux/kernel.h> |
6737 | #include <linux/init.h> |
6738 | -#include <linux/gpio/consumer.h> |
6739 | |
6740 | #include "fbtft.h" |
6741 | |
6742 | @@ -28,9 +27,6 @@ static int init_display(struct fbtft_par *par) |
6743 | { |
6744 | par->fbtftops.reset(par); |
6745 | |
6746 | - if (par->gpio.cs) |
6747 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6748 | - |
6749 | write_reg(par, 0x00, 0x0001); |
6750 | write_reg(par, 0x03, 0xA8A4); |
6751 | write_reg(par, 0x0C, 0x0000); |
6752 | diff --git a/drivers/staging/fbtft/fb_ssd1325.c b/drivers/staging/fbtft/fb_ssd1325.c |
6753 | index 8a3140d41d8bb..796a2ac3e1948 100644 |
6754 | --- a/drivers/staging/fbtft/fb_ssd1325.c |
6755 | +++ b/drivers/staging/fbtft/fb_ssd1325.c |
6756 | @@ -35,8 +35,6 @@ static int init_display(struct fbtft_par *par) |
6757 | { |
6758 | par->fbtftops.reset(par); |
6759 | |
6760 | - gpiod_set_value(par->gpio.cs, 0); |
6761 | - |
6762 | write_reg(par, 0xb3); |
6763 | write_reg(par, 0xf0); |
6764 | write_reg(par, 0xae); |
6765 | diff --git a/drivers/staging/fbtft/fb_ssd1331.c b/drivers/staging/fbtft/fb_ssd1331.c |
6766 | index 37622c9462aa7..ec5eced7f8cbd 100644 |
6767 | --- a/drivers/staging/fbtft/fb_ssd1331.c |
6768 | +++ b/drivers/staging/fbtft/fb_ssd1331.c |
6769 | @@ -81,8 +81,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) |
6770 | va_start(args, len); |
6771 | |
6772 | *buf = (u8)va_arg(args, unsigned int); |
6773 | - if (par->gpio.dc) |
6774 | - gpiod_set_value(par->gpio.dc, 0); |
6775 | + gpiod_set_value(par->gpio.dc, 0); |
6776 | ret = par->fbtftops.write(par, par->buf, sizeof(u8)); |
6777 | if (ret < 0) { |
6778 | va_end(args); |
6779 | @@ -104,8 +103,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) |
6780 | return; |
6781 | } |
6782 | } |
6783 | - if (par->gpio.dc) |
6784 | - gpiod_set_value(par->gpio.dc, 1); |
6785 | + gpiod_set_value(par->gpio.dc, 1); |
6786 | va_end(args); |
6787 | } |
6788 | |
6789 | diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c |
6790 | index 900b28d826b28..cf263a58a1489 100644 |
6791 | --- a/drivers/staging/fbtft/fb_ssd1351.c |
6792 | +++ b/drivers/staging/fbtft/fb_ssd1351.c |
6793 | @@ -2,7 +2,6 @@ |
6794 | #include <linux/module.h> |
6795 | #include <linux/kernel.h> |
6796 | #include <linux/init.h> |
6797 | -#include <linux/gpio/consumer.h> |
6798 | #include <linux/spi/spi.h> |
6799 | #include <linux/delay.h> |
6800 | |
6801 | diff --git a/drivers/staging/fbtft/fb_upd161704.c b/drivers/staging/fbtft/fb_upd161704.c |
6802 | index c77832ae5e5ba..c680160d63807 100644 |
6803 | --- a/drivers/staging/fbtft/fb_upd161704.c |
6804 | +++ b/drivers/staging/fbtft/fb_upd161704.c |
6805 | @@ -12,7 +12,6 @@ |
6806 | #include <linux/module.h> |
6807 | #include <linux/kernel.h> |
6808 | #include <linux/init.h> |
6809 | -#include <linux/gpio/consumer.h> |
6810 | #include <linux/delay.h> |
6811 | |
6812 | #include "fbtft.h" |
6813 | @@ -26,9 +25,6 @@ static int init_display(struct fbtft_par *par) |
6814 | { |
6815 | par->fbtftops.reset(par); |
6816 | |
6817 | - if (par->gpio.cs) |
6818 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6819 | - |
6820 | /* Initialization sequence from Lib_UTFT */ |
6821 | |
6822 | /* register reset */ |
6823 | diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c |
6824 | index 27cc8eabcbe9d..fc65ce8761558 100644 |
6825 | --- a/drivers/staging/fbtft/fb_watterott.c |
6826 | +++ b/drivers/staging/fbtft/fb_watterott.c |
6827 | @@ -8,7 +8,6 @@ |
6828 | #include <linux/module.h> |
6829 | #include <linux/kernel.h> |
6830 | #include <linux/init.h> |
6831 | -#include <linux/gpio/consumer.h> |
6832 | #include <linux/delay.h> |
6833 | |
6834 | #include "fbtft.h" |
6835 | diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c |
6836 | index 63c65dd67b175..3d422bc116411 100644 |
6837 | --- a/drivers/staging/fbtft/fbtft-bus.c |
6838 | +++ b/drivers/staging/fbtft/fbtft-bus.c |
6839 | @@ -135,8 +135,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) |
6840 | remain = len / 2; |
6841 | vmem16 = (u16 *)(par->info->screen_buffer + offset); |
6842 | |
6843 | - if (par->gpio.dc) |
6844 | - gpiod_set_value(par->gpio.dc, 1); |
6845 | + gpiod_set_value(par->gpio.dc, 1); |
6846 | |
6847 | /* non buffered write */ |
6848 | if (!par->txbuf.buf) |
6849 | diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c |
6850 | index 61f0286fb157e..bc53d68bfcaa3 100644 |
6851 | --- a/drivers/staging/fbtft/fbtft-core.c |
6852 | +++ b/drivers/staging/fbtft/fbtft-core.c |
6853 | @@ -37,8 +37,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) |
6854 | { |
6855 | int ret; |
6856 | |
6857 | - if (par->gpio.dc) |
6858 | - gpiod_set_value(par->gpio.dc, dc); |
6859 | + gpiod_set_value(par->gpio.dc, dc); |
6860 | |
6861 | ret = par->fbtftops.write(par, buf, len); |
6862 | if (ret < 0) |
6863 | @@ -79,7 +78,7 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, |
6864 | int ret = 0; |
6865 | |
6866 | *gpiop = devm_gpiod_get_index_optional(dev, name, index, |
6867 | - GPIOD_OUT_HIGH); |
6868 | + GPIOD_OUT_LOW); |
6869 | if (IS_ERR(*gpiop)) { |
6870 | ret = PTR_ERR(*gpiop); |
6871 | dev_err(dev, |
6872 | @@ -230,11 +229,15 @@ static void fbtft_reset(struct fbtft_par *par) |
6873 | { |
6874 | if (!par->gpio.reset) |
6875 | return; |
6876 | + |
6877 | fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__); |
6878 | + |
6879 | gpiod_set_value_cansleep(par->gpio.reset, 1); |
6880 | usleep_range(20, 40); |
6881 | gpiod_set_value_cansleep(par->gpio.reset, 0); |
6882 | msleep(120); |
6883 | + |
6884 | + gpiod_set_value_cansleep(par->gpio.cs, 1); /* Activate chip */ |
6885 | } |
6886 | |
6887 | static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line, |
6888 | @@ -921,8 +924,6 @@ static int fbtft_init_display_dt(struct fbtft_par *par) |
6889 | return -EINVAL; |
6890 | |
6891 | par->fbtftops.reset(par); |
6892 | - if (par->gpio.cs) |
6893 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6894 | |
6895 | while (p) { |
6896 | if (val & FBTFT_OF_INIT_CMD) { |
6897 | @@ -1012,8 +1013,6 @@ int fbtft_init_display(struct fbtft_par *par) |
6898 | } |
6899 | |
6900 | par->fbtftops.reset(par); |
6901 | - if (par->gpio.cs) |
6902 | - gpiod_set_value(par->gpio.cs, 0); /* Activate chip */ |
6903 | |
6904 | i = 0; |
6905 | while (i < FBTFT_MAX_INIT_SEQUENCE) { |
6906 | diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c |
6907 | index 0863d257d7620..de1904a443c27 100644 |
6908 | --- a/drivers/staging/fbtft/fbtft-io.c |
6909 | +++ b/drivers/staging/fbtft/fbtft-io.c |
6910 | @@ -142,12 +142,12 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) |
6911 | data = *(u8 *)buf; |
6912 | |
6913 | /* Start writing by pulling down /WR */ |
6914 | - gpiod_set_value(par->gpio.wr, 0); |
6915 | + gpiod_set_value(par->gpio.wr, 1); |
6916 | |
6917 | /* Set data */ |
6918 | #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO |
6919 | if (data == prev_data) { |
6920 | - gpiod_set_value(par->gpio.wr, 0); /* used as delay */ |
6921 | + gpiod_set_value(par->gpio.wr, 1); /* used as delay */ |
6922 | } else { |
6923 | for (i = 0; i < 8; i++) { |
6924 | if ((data & 1) != (prev_data & 1)) |
6925 | @@ -165,7 +165,7 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) |
6926 | #endif |
6927 | |
6928 | /* Pullup /WR */ |
6929 | - gpiod_set_value(par->gpio.wr, 1); |
6930 | + gpiod_set_value(par->gpio.wr, 0); |
6931 | |
6932 | #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO |
6933 | prev_data = *(u8 *)buf; |
6934 | @@ -192,12 +192,12 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) |
6935 | data = *(u16 *)buf; |
6936 | |
6937 | /* Start writing by pulling down /WR */ |
6938 | - gpiod_set_value(par->gpio.wr, 0); |
6939 | + gpiod_set_value(par->gpio.wr, 1); |
6940 | |
6941 | /* Set data */ |
6942 | #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO |
6943 | if (data == prev_data) { |
6944 | - gpiod_set_value(par->gpio.wr, 0); /* used as delay */ |
6945 | + gpiod_set_value(par->gpio.wr, 1); /* used as delay */ |
6946 | } else { |
6947 | for (i = 0; i < 16; i++) { |
6948 | if ((data & 1) != (prev_data & 1)) |
6949 | @@ -215,7 +215,7 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) |
6950 | #endif |
6951 | |
6952 | /* Pullup /WR */ |
6953 | - gpiod_set_value(par->gpio.wr, 1); |
6954 | + gpiod_set_value(par->gpio.wr, 0); |
6955 | |
6956 | #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO |
6957 | prev_data = *(u16 *)buf; |
6958 | diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c |
6959 | index db11498f6fc7d..8093d06086388 100644 |
6960 | --- a/drivers/staging/gdm724x/gdm_lte.c |
6961 | +++ b/drivers/staging/gdm724x/gdm_lte.c |
6962 | @@ -611,10 +611,12 @@ static void gdm_lte_netif_rx(struct net_device *dev, char *buf, |
6963 | * bytes (99,130,83,99 dec) |
6964 | */ |
6965 | } __packed; |
6966 | - void *addr = buf + sizeof(struct iphdr) + |
6967 | - sizeof(struct udphdr) + |
6968 | - offsetof(struct dhcp_packet, chaddr); |
6969 | - ether_addr_copy(nic->dest_mac_addr, addr); |
6970 | + int offset = sizeof(struct iphdr) + |
6971 | + sizeof(struct udphdr) + |
6972 | + offsetof(struct dhcp_packet, chaddr); |
6973 | + if (offset + ETH_ALEN > len) |
6974 | + return; |
6975 | + ether_addr_copy(nic->dest_mac_addr, buf + offset); |
6976 | } |
6977 | } |
6978 | |
6979 | @@ -677,6 +679,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len) |
6980 | struct sdu *sdu = NULL; |
6981 | u8 endian = phy_dev->get_endian(phy_dev->priv_dev); |
6982 | u8 *data = (u8 *)multi_sdu->data; |
6983 | + int copied; |
6984 | u16 i = 0; |
6985 | u16 num_packet; |
6986 | u16 hci_len; |
6987 | @@ -688,6 +691,12 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len) |
6988 | num_packet = gdm_dev16_to_cpu(endian, multi_sdu->num_packet); |
6989 | |
6990 | for (i = 0; i < num_packet; i++) { |
6991 | + copied = data - multi_sdu->data; |
6992 | + if (len < copied + sizeof(*sdu)) { |
6993 | + pr_err("rx prevent buffer overflow"); |
6994 | + return; |
6995 | + } |
6996 | + |
6997 | sdu = (struct sdu *)data; |
6998 | |
6999 | cmd_evt = gdm_dev16_to_cpu(endian, sdu->cmd_evt); |
7000 | @@ -698,7 +707,8 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len) |
7001 | pr_err("rx sdu wrong hci %04x\n", cmd_evt); |
7002 | return; |
7003 | } |
7004 | - if (hci_len < 12) { |
7005 | + if (hci_len < 12 || |
7006 | + len < copied + sizeof(*sdu) + (hci_len - 12)) { |
7007 | pr_err("rx sdu invalid len %d\n", hci_len); |
7008 | return; |
7009 | } |
7010 | diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c |
7011 | index 367e39f5b382b..40b7e60f4a472 100644 |
7012 | --- a/drivers/staging/media/imx/imx-media-csi.c |
7013 | +++ b/drivers/staging/media/imx/imx-media-csi.c |
7014 | @@ -753,9 +753,10 @@ static int csi_setup(struct csi_priv *priv) |
7015 | |
7016 | static int csi_start(struct csi_priv *priv) |
7017 | { |
7018 | - struct v4l2_fract *output_fi; |
7019 | + struct v4l2_fract *input_fi, *output_fi; |
7020 | int ret; |
7021 | |
7022 | + input_fi = &priv->frame_interval[CSI_SINK_PAD]; |
7023 | output_fi = &priv->frame_interval[priv->active_output_pad]; |
7024 | |
7025 | /* start upstream */ |
7026 | @@ -764,6 +765,17 @@ static int csi_start(struct csi_priv *priv) |
7027 | if (ret) |
7028 | return ret; |
7029 | |
7030 | + /* Skip first few frames from a BT.656 source */ |
7031 | + if (priv->upstream_ep.bus_type == V4L2_MBUS_BT656) { |
7032 | + u32 delay_usec, bad_frames = 20; |
7033 | + |
7034 | + delay_usec = DIV_ROUND_UP_ULL((u64)USEC_PER_SEC * |
7035 | + input_fi->numerator * bad_frames, |
7036 | + input_fi->denominator); |
7037 | + |
7038 | + usleep_range(delay_usec, delay_usec + 1000); |
7039 | + } |
7040 | + |
7041 | if (priv->dest == IPU_CSI_DEST_IDMAC) { |
7042 | ret = csi_idmac_start(priv); |
7043 | if (ret) |
7044 | diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c |
7045 | index 021bbd4203907..63bc78e4cac8f 100644 |
7046 | --- a/drivers/staging/media/imx/imx7-mipi-csis.c |
7047 | +++ b/drivers/staging/media/imx/imx7-mipi-csis.c |
7048 | @@ -528,13 +528,15 @@ static void mipi_csis_clear_counters(struct csi_state *state) |
7049 | |
7050 | static void mipi_csis_log_counters(struct csi_state *state, bool non_errors) |
7051 | { |
7052 | - int i = non_errors ? MIPI_CSIS_NUM_EVENTS : MIPI_CSIS_NUM_EVENTS - 4; |
7053 | + unsigned int num_events = non_errors ? MIPI_CSIS_NUM_EVENTS |
7054 | + : MIPI_CSIS_NUM_EVENTS - 6; |
7055 | struct device *dev = &state->pdev->dev; |
7056 | unsigned long flags; |
7057 | + unsigned int i; |
7058 | |
7059 | spin_lock_irqsave(&state->slock, flags); |
7060 | |
7061 | - for (i--; i >= 0; i--) { |
7062 | + for (i = 0; i < num_events; ++i) { |
7063 | if (state->events[i].counter > 0 || state->debug) |
7064 | dev_info(dev, "%s events: %d\n", state->events[i].name, |
7065 | state->events[i].counter); |
7066 | diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi |
7067 | index a4c08110094b3..5ca8607c5dbbe 100644 |
7068 | --- a/drivers/staging/mt7621-dts/mt7621.dtsi |
7069 | +++ b/drivers/staging/mt7621-dts/mt7621.dtsi |
7070 | @@ -520,7 +520,7 @@ |
7071 | |
7072 | bus-range = <0 255>; |
7073 | ranges = < |
7074 | - 0x02000000 0 0x00000000 0x60000000 0 0x10000000 /* pci memory */ |
7075 | + 0x02000000 0 0x60000000 0x60000000 0 0x10000000 /* pci memory */ |
7076 | 0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */ |
7077 | >; |
7078 | |
7079 | diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c |
7080 | index 42c0a3c947f19..301b99060bc27 100644 |
7081 | --- a/drivers/staging/rtl8712/hal_init.c |
7082 | +++ b/drivers/staging/rtl8712/hal_init.c |
7083 | @@ -40,7 +40,10 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context) |
7084 | dev_err(&udev->dev, "r8712u: Firmware request failed\n"); |
7085 | usb_put_dev(udev); |
7086 | usb_set_intfdata(usb_intf, NULL); |
7087 | + r8712_free_drv_sw(adapter); |
7088 | + adapter->dvobj_deinit(adapter); |
7089 | complete(&adapter->rtl8712_fw_ready); |
7090 | + free_netdev(adapter->pnetdev); |
7091 | return; |
7092 | } |
7093 | adapter->fw = firmware; |
7094 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
7095 | index 2fcd65260f4c1..bc421925e84c2 100644 |
7096 | --- a/drivers/staging/rtl8712/usb_intf.c |
7097 | +++ b/drivers/staging/rtl8712/usb_intf.c |
7098 | @@ -380,13 +380,11 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, |
7099 | /* step 3. |
7100 | * initialize the dvobj_priv |
7101 | */ |
7102 | - if (!padapter->dvobj_init) { |
7103 | + |
7104 | + status = padapter->dvobj_init(padapter); |
7105 | + if (status != _SUCCESS) |
7106 | goto error; |
7107 | - } else { |
7108 | - status = padapter->dvobj_init(padapter); |
7109 | - if (status != _SUCCESS) |
7110 | - goto error; |
7111 | - } |
7112 | + |
7113 | /* step 4. */ |
7114 | status = r8712_init_drv_sw(padapter); |
7115 | if (status) |
7116 | diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c |
7117 | index 54bb1ebd8eb5c..1814c19f5bf62 100644 |
7118 | --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c |
7119 | +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c |
7120 | @@ -265,12 +265,13 @@ void cxgbit_unmap_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
7121 | struct cxgbit_cmd *ccmd = iscsit_priv_cmd(cmd); |
7122 | |
7123 | if (ccmd->release) { |
7124 | - struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo; |
7125 | - |
7126 | - if (ttinfo->sgl) { |
7127 | + if (cmd->se_cmd.se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) { |
7128 | + put_page(sg_page(&ccmd->sg)); |
7129 | + } else { |
7130 | struct cxgbit_sock *csk = conn->context; |
7131 | struct cxgbit_device *cdev = csk->com.cdev; |
7132 | struct cxgbi_ppm *ppm = cdev2ppm(cdev); |
7133 | + struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo; |
7134 | |
7135 | /* Abort the TCP conn if DDP is not complete to |
7136 | * avoid any possibility of DDP after freeing |
7137 | @@ -280,14 +281,14 @@ void cxgbit_unmap_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
7138 | cmd->se_cmd.data_length)) |
7139 | cxgbit_abort_conn(csk); |
7140 | |
7141 | + if (unlikely(ttinfo->sgl)) { |
7142 | + dma_unmap_sg(&ppm->pdev->dev, ttinfo->sgl, |
7143 | + ttinfo->nents, DMA_FROM_DEVICE); |
7144 | + ttinfo->nents = 0; |
7145 | + ttinfo->sgl = NULL; |
7146 | + } |
7147 | cxgbi_ppm_ppod_release(ppm, ttinfo->idx); |
7148 | - |
7149 | - dma_unmap_sg(&ppm->pdev->dev, ttinfo->sgl, |
7150 | - ttinfo->nents, DMA_FROM_DEVICE); |
7151 | - } else { |
7152 | - put_page(sg_page(&ccmd->sg)); |
7153 | } |
7154 | - |
7155 | ccmd->release = false; |
7156 | } |
7157 | } |
7158 | diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c |
7159 | index 45a1bfa2f7351..c083a69105be6 100644 |
7160 | --- a/drivers/target/iscsi/cxgbit/cxgbit_target.c |
7161 | +++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c |
7162 | @@ -1013,17 +1013,18 @@ static int cxgbit_handle_iscsi_dataout(struct cxgbit_sock *csk) |
7163 | struct scatterlist *sg_start; |
7164 | struct iscsi_conn *conn = csk->conn; |
7165 | struct iscsi_cmd *cmd = NULL; |
7166 | + struct cxgbit_cmd *ccmd; |
7167 | + struct cxgbi_task_tag_info *ttinfo; |
7168 | struct cxgbit_lro_pdu_cb *pdu_cb = cxgbit_rx_pdu_cb(csk->skb); |
7169 | struct iscsi_data *hdr = (struct iscsi_data *)pdu_cb->hdr; |
7170 | u32 data_offset = be32_to_cpu(hdr->offset); |
7171 | - u32 data_len = pdu_cb->dlen; |
7172 | + u32 data_len = ntoh24(hdr->dlength); |
7173 | int rc, sg_nents, sg_off; |
7174 | bool dcrc_err = false; |
7175 | |
7176 | if (pdu_cb->flags & PDUCBF_RX_DDP_CMP) { |
7177 | u32 offset = be32_to_cpu(hdr->offset); |
7178 | u32 ddp_data_len; |
7179 | - u32 payload_length = ntoh24(hdr->dlength); |
7180 | bool success = false; |
7181 | |
7182 | cmd = iscsit_find_cmd_from_itt_or_dump(conn, hdr->itt, 0); |
7183 | @@ -1038,7 +1039,7 @@ static int cxgbit_handle_iscsi_dataout(struct cxgbit_sock *csk) |
7184 | cmd->data_sn = be32_to_cpu(hdr->datasn); |
7185 | |
7186 | rc = __iscsit_check_dataout_hdr(conn, (unsigned char *)hdr, |
7187 | - cmd, payload_length, &success); |
7188 | + cmd, data_len, &success); |
7189 | if (rc < 0) |
7190 | return rc; |
7191 | else if (!success) |
7192 | @@ -1076,6 +1077,20 @@ static int cxgbit_handle_iscsi_dataout(struct cxgbit_sock *csk) |
7193 | cxgbit_skb_copy_to_sg(csk->skb, sg_start, sg_nents, skip); |
7194 | } |
7195 | |
7196 | + ccmd = iscsit_priv_cmd(cmd); |
7197 | + ttinfo = &ccmd->ttinfo; |
7198 | + |
7199 | + if (ccmd->release && ttinfo->sgl && |
7200 | + (cmd->se_cmd.data_length == (cmd->write_data_done + data_len))) { |
7201 | + struct cxgbit_device *cdev = csk->com.cdev; |
7202 | + struct cxgbi_ppm *ppm = cdev2ppm(cdev); |
7203 | + |
7204 | + dma_unmap_sg(&ppm->pdev->dev, ttinfo->sgl, ttinfo->nents, |
7205 | + DMA_FROM_DEVICE); |
7206 | + ttinfo->nents = 0; |
7207 | + ttinfo->sgl = NULL; |
7208 | + } |
7209 | + |
7210 | check_payload: |
7211 | |
7212 | rc = iscsit_check_dataout_payload(cmd, hdr, dcrc_err); |
7213 | diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c |
7214 | index ed99948f3b7f7..af9b00918e4eb 100644 |
7215 | --- a/drivers/tty/nozomi.c |
7216 | +++ b/drivers/tty/nozomi.c |
7217 | @@ -1395,7 +1395,7 @@ static int nozomi_card_init(struct pci_dev *pdev, |
7218 | NOZOMI_NAME, dc); |
7219 | if (unlikely(ret)) { |
7220 | dev_err(&pdev->dev, "can't request irq %d\n", pdev->irq); |
7221 | - goto err_free_kfifo; |
7222 | + goto err_free_all_kfifo; |
7223 | } |
7224 | |
7225 | DBG1("base_addr: %p", dc->base_addr); |
7226 | @@ -1433,12 +1433,15 @@ static int nozomi_card_init(struct pci_dev *pdev, |
7227 | return 0; |
7228 | |
7229 | err_free_tty: |
7230 | - for (i = 0; i < MAX_PORT; ++i) { |
7231 | + for (i--; i >= 0; i--) { |
7232 | tty_unregister_device(ntty_driver, dc->index_start + i); |
7233 | tty_port_destroy(&dc->port[i].port); |
7234 | } |
7235 | + free_irq(pdev->irq, dc); |
7236 | +err_free_all_kfifo: |
7237 | + i = MAX_PORT; |
7238 | err_free_kfifo: |
7239 | - for (i = 0; i < MAX_PORT; i++) |
7240 | + for (i--; i >= PORT_MDM; i--) |
7241 | kfifo_free(&dc->port[i].fifo_ul); |
7242 | err_free_sbuf: |
7243 | kfree(dc->send_buf); |
7244 | diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
7245 | index 5b673077639ba..6e93aa3623d9b 100644 |
7246 | --- a/drivers/tty/serial/8250/8250_port.c |
7247 | +++ b/drivers/tty/serial/8250/8250_port.c |
7248 | @@ -2557,6 +2557,21 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
7249 | struct ktermios *old) |
7250 | { |
7251 | unsigned int tolerance = port->uartclk / 100; |
7252 | + unsigned int min; |
7253 | + unsigned int max; |
7254 | + |
7255 | + /* |
7256 | + * Handle magic divisors for baud rates above baud_base on SMSC |
7257 | + * Super I/O chips. Enable custom rates of clk/4 and clk/8, but |
7258 | + * disable divisor values beyond 32767, which are unavailable. |
7259 | + */ |
7260 | + if (port->flags & UPF_MAGIC_MULTIPLIER) { |
7261 | + min = port->uartclk / 16 / UART_DIV_MAX >> 1; |
7262 | + max = (port->uartclk + tolerance) / 4; |
7263 | + } else { |
7264 | + min = port->uartclk / 16 / UART_DIV_MAX; |
7265 | + max = (port->uartclk + tolerance) / 16; |
7266 | + } |
7267 | |
7268 | /* |
7269 | * Ask the core to calculate the divisor for us. |
7270 | @@ -2564,9 +2579,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
7271 | * slower than nominal still match standard baud rates without |
7272 | * causing transmission errors. |
7273 | */ |
7274 | - return uart_get_baud_rate(port, termios, old, |
7275 | - port->uartclk / 16 / UART_DIV_MAX, |
7276 | - (port->uartclk + tolerance) / 16); |
7277 | + return uart_get_baud_rate(port, termios, old, min, max); |
7278 | } |
7279 | |
7280 | void |
7281 | diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c |
7282 | index c8186a05a453c..ccd1a615305b5 100644 |
7283 | --- a/drivers/tty/serial/8250/serial_cs.c |
7284 | +++ b/drivers/tty/serial/8250/serial_cs.c |
7285 | @@ -780,6 +780,7 @@ static const struct pcmcia_device_id serial_ids[] = { |
7286 | PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT2834LT", 0x5f73be51, 0x4cd7c09e), |
7287 | PCMCIA_DEVICE_PROD_ID12("OEM ", "C288MX ", 0xb572d360, 0xd2385b7a), |
7288 | PCMCIA_DEVICE_PROD_ID12("Option International", "V34bis GSM/PSTN Data/Fax Modem", 0x9d7cd6f5, 0x5cb8bf41), |
7289 | + PCMCIA_DEVICE_PROD_ID12("Option International", "GSM-Ready 56K/ISDN", 0x9d7cd6f5, 0xb23844aa), |
7290 | PCMCIA_DEVICE_PROD_ID12("PCMCIA ", "C336MX ", 0x99bcafe9, 0xaa25bcab), |
7291 | PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "PCMCIA Dual RS-232 Serial Port Card", 0xc4420b35, 0x92abc92f), |
7292 | PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "Dual RS-232 Serial Port PC Card", 0xc4420b35, 0x031a380d), |
7293 | @@ -807,7 +808,6 @@ static const struct pcmcia_device_id serial_ids[] = { |
7294 | PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"), |
7295 | PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "cis/COMpad2.cis"), |
7296 | PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"), |
7297 | - PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "cis/GLOBETROTTER.cis"), |
7298 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL100 1.00.", 0x19ca78af, 0xf964f42b), |
7299 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL100", 0x19ca78af, 0x71d98e83), |
7300 | PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL232 1.00.", 0x19ca78af, 0x69fb7490), |
7301 | diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c |
7302 | index 5e6f661943eb1..51b4d8d1dcaca 100644 |
7303 | --- a/drivers/tty/serial/mvebu-uart.c |
7304 | +++ b/drivers/tty/serial/mvebu-uart.c |
7305 | @@ -445,12 +445,11 @@ static void mvebu_uart_shutdown(struct uart_port *port) |
7306 | |
7307 | static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) |
7308 | { |
7309 | - struct mvebu_uart *mvuart = to_mvuart(port); |
7310 | unsigned int d_divisor, m_divisor; |
7311 | u32 brdv, osamp; |
7312 | |
7313 | - if (IS_ERR(mvuart->clk)) |
7314 | - return -PTR_ERR(mvuart->clk); |
7315 | + if (!port->uartclk) |
7316 | + return -EOPNOTSUPP; |
7317 | |
7318 | /* |
7319 | * The baudrate is derived from the UART clock thanks to two divisors: |
7320 | @@ -463,7 +462,7 @@ static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) |
7321 | * makes use of D to configure the desired baudrate. |
7322 | */ |
7323 | m_divisor = OSAMP_DEFAULT_DIVISOR; |
7324 | - d_divisor = DIV_ROUND_UP(port->uartclk, baud * m_divisor); |
7325 | + d_divisor = DIV_ROUND_CLOSEST(port->uartclk, baud * m_divisor); |
7326 | |
7327 | brdv = readl(port->membase + UART_BRDV); |
7328 | brdv &= ~BRDV_BAUD_MASK; |
7329 | @@ -482,7 +481,7 @@ static void mvebu_uart_set_termios(struct uart_port *port, |
7330 | struct ktermios *old) |
7331 | { |
7332 | unsigned long flags; |
7333 | - unsigned int baud; |
7334 | + unsigned int baud, min_baud, max_baud; |
7335 | |
7336 | spin_lock_irqsave(&port->lock, flags); |
7337 | |
7338 | @@ -501,16 +500,21 @@ static void mvebu_uart_set_termios(struct uart_port *port, |
7339 | port->ignore_status_mask |= STAT_RX_RDY(port) | STAT_BRK_ERR; |
7340 | |
7341 | /* |
7342 | + * Maximal divisor is 1023 * 16 when using default (x16) scheme. |
7343 | * Maximum achievable frequency with simple baudrate divisor is 230400. |
7344 | * Since the error per bit frame would be of more than 15%, achieving |
7345 | * higher frequencies would require to implement the fractional divisor |
7346 | * feature. |
7347 | */ |
7348 | - baud = uart_get_baud_rate(port, termios, old, 0, 230400); |
7349 | + min_baud = DIV_ROUND_UP(port->uartclk, 1023 * 16); |
7350 | + max_baud = 230400; |
7351 | + |
7352 | + baud = uart_get_baud_rate(port, termios, old, min_baud, max_baud); |
7353 | if (mvebu_uart_baud_rate_set(port, baud)) { |
7354 | /* No clock available, baudrate cannot be changed */ |
7355 | if (old) |
7356 | - baud = uart_get_baud_rate(port, old, NULL, 0, 230400); |
7357 | + baud = uart_get_baud_rate(port, old, NULL, |
7358 | + min_baud, max_baud); |
7359 | } else { |
7360 | tty_termios_encode_baud_rate(termios, baud, baud); |
7361 | uart_update_timeout(port, termios->c_cflag, baud); |
7362 | diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c |
7363 | index de86e9021a8ff..97ee1fc1cd247 100644 |
7364 | --- a/drivers/tty/serial/sh-sci.c |
7365 | +++ b/drivers/tty/serial/sh-sci.c |
7366 | @@ -613,6 +613,14 @@ static void sci_stop_tx(struct uart_port *port) |
7367 | ctrl &= ~SCSCR_TIE; |
7368 | |
7369 | serial_port_out(port, SCSCR, ctrl); |
7370 | + |
7371 | +#ifdef CONFIG_SERIAL_SH_SCI_DMA |
7372 | + if (to_sci_port(port)->chan_tx && |
7373 | + !dma_submit_error(to_sci_port(port)->cookie_tx)) { |
7374 | + dmaengine_terminate_async(to_sci_port(port)->chan_tx); |
7375 | + to_sci_port(port)->cookie_tx = -EINVAL; |
7376 | + } |
7377 | +#endif |
7378 | } |
7379 | |
7380 | static void sci_start_rx(struct uart_port *port) |
7381 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
7382 | index 1e9aab6118f51..c0604c60ebd01 100644 |
7383 | --- a/drivers/usb/class/cdc-acm.c |
7384 | +++ b/drivers/usb/class/cdc-acm.c |
7385 | @@ -1960,6 +1960,11 @@ static const struct usb_device_id acm_ids[] = { |
7386 | .driver_info = IGNORE_DEVICE, |
7387 | }, |
7388 | |
7389 | + /* Exclude Heimann Sensor GmbH USB appset demo */ |
7390 | + { USB_DEVICE(0x32a7, 0x0000), |
7391 | + .driver_info = IGNORE_DEVICE, |
7392 | + }, |
7393 | + |
7394 | /* control interfaces without any protocol set */ |
7395 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
7396 | USB_CDC_PROTO_NONE) }, |
7397 | diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c |
7398 | index 78a4925aa1185..093980481c4d6 100644 |
7399 | --- a/drivers/usb/dwc2/core.c |
7400 | +++ b/drivers/usb/dwc2/core.c |
7401 | @@ -1152,15 +1152,6 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) |
7402 | usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16); |
7403 | if (hsotg->params.phy_utmi_width == 16) |
7404 | usbcfg |= GUSBCFG_PHYIF16; |
7405 | - |
7406 | - /* Set turnaround time */ |
7407 | - if (dwc2_is_device_mode(hsotg)) { |
7408 | - usbcfg &= ~GUSBCFG_USBTRDTIM_MASK; |
7409 | - if (hsotg->params.phy_utmi_width == 16) |
7410 | - usbcfg |= 5 << GUSBCFG_USBTRDTIM_SHIFT; |
7411 | - else |
7412 | - usbcfg |= 9 << GUSBCFG_USBTRDTIM_SHIFT; |
7413 | - } |
7414 | break; |
7415 | default: |
7416 | dev_err(hsotg->dev, "FS PHY selected at HS!\n"); |
7417 | @@ -1182,6 +1173,24 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) |
7418 | return retval; |
7419 | } |
7420 | |
7421 | +static void dwc2_set_turnaround_time(struct dwc2_hsotg *hsotg) |
7422 | +{ |
7423 | + u32 usbcfg; |
7424 | + |
7425 | + if (hsotg->params.phy_type != DWC2_PHY_TYPE_PARAM_UTMI) |
7426 | + return; |
7427 | + |
7428 | + usbcfg = dwc2_readl(hsotg, GUSBCFG); |
7429 | + |
7430 | + usbcfg &= ~GUSBCFG_USBTRDTIM_MASK; |
7431 | + if (hsotg->params.phy_utmi_width == 16) |
7432 | + usbcfg |= 5 << GUSBCFG_USBTRDTIM_SHIFT; |
7433 | + else |
7434 | + usbcfg |= 9 << GUSBCFG_USBTRDTIM_SHIFT; |
7435 | + |
7436 | + dwc2_writel(hsotg, usbcfg, GUSBCFG); |
7437 | +} |
7438 | + |
7439 | int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) |
7440 | { |
7441 | u32 usbcfg; |
7442 | @@ -1199,6 +1208,9 @@ int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) |
7443 | retval = dwc2_hs_phy_init(hsotg, select_phy); |
7444 | if (retval) |
7445 | return retval; |
7446 | + |
7447 | + if (dwc2_is_device_mode(hsotg)) |
7448 | + dwc2_set_turnaround_time(hsotg); |
7449 | } |
7450 | |
7451 | if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && |
7452 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
7453 | index b9d4fc636b329..2c68ec60d39a3 100644 |
7454 | --- a/drivers/usb/dwc3/core.c |
7455 | +++ b/drivers/usb/dwc3/core.c |
7456 | @@ -1523,17 +1523,18 @@ static int dwc3_probe(struct platform_device *pdev) |
7457 | } |
7458 | |
7459 | dwc3_check_params(dwc); |
7460 | + dwc3_debugfs_init(dwc); |
7461 | |
7462 | ret = dwc3_core_init_mode(dwc); |
7463 | if (ret) |
7464 | goto err5; |
7465 | |
7466 | - dwc3_debugfs_init(dwc); |
7467 | pm_runtime_put(dev); |
7468 | |
7469 | return 0; |
7470 | |
7471 | err5: |
7472 | + dwc3_debugfs_exit(dwc); |
7473 | dwc3_event_buffers_cleanup(dwc); |
7474 | |
7475 | usb_phy_shutdown(dwc->usb2_phy); |
7476 | diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c |
7477 | index 801090de1f7b3..95ef8bc726868 100644 |
7478 | --- a/drivers/usb/gadget/function/f_eem.c |
7479 | +++ b/drivers/usb/gadget/function/f_eem.c |
7480 | @@ -30,6 +30,11 @@ struct f_eem { |
7481 | u8 ctrl_id; |
7482 | }; |
7483 | |
7484 | +struct in_context { |
7485 | + struct sk_buff *skb; |
7486 | + struct usb_ep *ep; |
7487 | +}; |
7488 | + |
7489 | static inline struct f_eem *func_to_eem(struct usb_function *f) |
7490 | { |
7491 | return container_of(f, struct f_eem, port.func); |
7492 | @@ -322,9 +327,12 @@ fail: |
7493 | |
7494 | static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) |
7495 | { |
7496 | - struct sk_buff *skb = (struct sk_buff *)req->context; |
7497 | + struct in_context *ctx = req->context; |
7498 | |
7499 | - dev_kfree_skb_any(skb); |
7500 | + dev_kfree_skb_any(ctx->skb); |
7501 | + kfree(req->buf); |
7502 | + usb_ep_free_request(ctx->ep, req); |
7503 | + kfree(ctx); |
7504 | } |
7505 | |
7506 | /* |
7507 | @@ -412,7 +420,9 @@ static int eem_unwrap(struct gether *port, |
7508 | * b15: bmType (0 == data, 1 == command) |
7509 | */ |
7510 | if (header & BIT(15)) { |
7511 | - struct usb_request *req = cdev->req; |
7512 | + struct usb_request *req; |
7513 | + struct in_context *ctx; |
7514 | + struct usb_ep *ep; |
7515 | u16 bmEEMCmd; |
7516 | |
7517 | /* EEM command packet format: |
7518 | @@ -441,11 +451,36 @@ static int eem_unwrap(struct gether *port, |
7519 | skb_trim(skb2, len); |
7520 | put_unaligned_le16(BIT(15) | BIT(11) | len, |
7521 | skb_push(skb2, 2)); |
7522 | + |
7523 | + ep = port->in_ep; |
7524 | + req = usb_ep_alloc_request(ep, GFP_ATOMIC); |
7525 | + if (!req) { |
7526 | + dev_kfree_skb_any(skb2); |
7527 | + goto next; |
7528 | + } |
7529 | + |
7530 | + req->buf = kmalloc(skb2->len, GFP_KERNEL); |
7531 | + if (!req->buf) { |
7532 | + usb_ep_free_request(ep, req); |
7533 | + dev_kfree_skb_any(skb2); |
7534 | + goto next; |
7535 | + } |
7536 | + |
7537 | + ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); |
7538 | + if (!ctx) { |
7539 | + kfree(req->buf); |
7540 | + usb_ep_free_request(ep, req); |
7541 | + dev_kfree_skb_any(skb2); |
7542 | + goto next; |
7543 | + } |
7544 | + ctx->skb = skb2; |
7545 | + ctx->ep = ep; |
7546 | + |
7547 | skb_copy_bits(skb2, 0, req->buf, skb2->len); |
7548 | req->length = skb2->len; |
7549 | req->complete = eem_cmd_complete; |
7550 | req->zero = 1; |
7551 | - req->context = skb2; |
7552 | + req->context = ctx; |
7553 | if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) |
7554 | DBG(cdev, "echo response queue fail\n"); |
7555 | break; |
7556 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
7557 | index 3126f5b08bd4f..94ccf43368dfc 100644 |
7558 | --- a/drivers/usb/gadget/function/f_fs.c |
7559 | +++ b/drivers/usb/gadget/function/f_fs.c |
7560 | @@ -250,8 +250,8 @@ EXPORT_SYMBOL_GPL(ffs_lock); |
7561 | static struct ffs_dev *_ffs_find_dev(const char *name); |
7562 | static struct ffs_dev *_ffs_alloc_dev(void); |
7563 | static void _ffs_free_dev(struct ffs_dev *dev); |
7564 | -static void *ffs_acquire_dev(const char *dev_name); |
7565 | -static void ffs_release_dev(struct ffs_data *ffs_data); |
7566 | +static int ffs_acquire_dev(const char *dev_name, struct ffs_data *ffs_data); |
7567 | +static void ffs_release_dev(struct ffs_dev *ffs_dev); |
7568 | static int ffs_ready(struct ffs_data *ffs); |
7569 | static void ffs_closed(struct ffs_data *ffs); |
7570 | |
7571 | @@ -1572,8 +1572,8 @@ unmapped_value: |
7572 | static int ffs_fs_get_tree(struct fs_context *fc) |
7573 | { |
7574 | struct ffs_sb_fill_data *ctx = fc->fs_private; |
7575 | - void *ffs_dev; |
7576 | struct ffs_data *ffs; |
7577 | + int ret; |
7578 | |
7579 | ENTER(); |
7580 | |
7581 | @@ -1592,13 +1592,12 @@ static int ffs_fs_get_tree(struct fs_context *fc) |
7582 | return -ENOMEM; |
7583 | } |
7584 | |
7585 | - ffs_dev = ffs_acquire_dev(ffs->dev_name); |
7586 | - if (IS_ERR(ffs_dev)) { |
7587 | + ret = ffs_acquire_dev(ffs->dev_name, ffs); |
7588 | + if (ret) { |
7589 | ffs_data_put(ffs); |
7590 | - return PTR_ERR(ffs_dev); |
7591 | + return ret; |
7592 | } |
7593 | |
7594 | - ffs->private_data = ffs_dev; |
7595 | ctx->ffs_data = ffs; |
7596 | return get_tree_nodev(fc, ffs_sb_fill); |
7597 | } |
7598 | @@ -1609,7 +1608,6 @@ static void ffs_fs_free_fc(struct fs_context *fc) |
7599 | |
7600 | if (ctx) { |
7601 | if (ctx->ffs_data) { |
7602 | - ffs_release_dev(ctx->ffs_data); |
7603 | ffs_data_put(ctx->ffs_data); |
7604 | } |
7605 | |
7606 | @@ -1648,10 +1646,8 @@ ffs_fs_kill_sb(struct super_block *sb) |
7607 | ENTER(); |
7608 | |
7609 | kill_litter_super(sb); |
7610 | - if (sb->s_fs_info) { |
7611 | - ffs_release_dev(sb->s_fs_info); |
7612 | + if (sb->s_fs_info) |
7613 | ffs_data_closed(sb->s_fs_info); |
7614 | - } |
7615 | } |
7616 | |
7617 | static struct file_system_type ffs_fs_type = { |
7618 | @@ -1721,6 +1717,7 @@ static void ffs_data_put(struct ffs_data *ffs) |
7619 | if (unlikely(refcount_dec_and_test(&ffs->ref))) { |
7620 | pr_info("%s(): freeing\n", __func__); |
7621 | ffs_data_clear(ffs); |
7622 | + ffs_release_dev(ffs->private_data); |
7623 | BUG_ON(waitqueue_active(&ffs->ev.waitq) || |
7624 | waitqueue_active(&ffs->ep0req_completion.wait) || |
7625 | waitqueue_active(&ffs->wait)); |
7626 | @@ -3050,6 +3047,7 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, |
7627 | struct ffs_function *func = ffs_func_from_usb(f); |
7628 | struct f_fs_opts *ffs_opts = |
7629 | container_of(f->fi, struct f_fs_opts, func_inst); |
7630 | + struct ffs_data *ffs_data; |
7631 | int ret; |
7632 | |
7633 | ENTER(); |
7634 | @@ -3064,12 +3062,13 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, |
7635 | if (!ffs_opts->no_configfs) |
7636 | ffs_dev_lock(); |
7637 | ret = ffs_opts->dev->desc_ready ? 0 : -ENODEV; |
7638 | - func->ffs = ffs_opts->dev->ffs_data; |
7639 | + ffs_data = ffs_opts->dev->ffs_data; |
7640 | if (!ffs_opts->no_configfs) |
7641 | ffs_dev_unlock(); |
7642 | if (ret) |
7643 | return ERR_PTR(ret); |
7644 | |
7645 | + func->ffs = ffs_data; |
7646 | func->conf = c; |
7647 | func->gadget = c->cdev->gadget; |
7648 | |
7649 | @@ -3524,6 +3523,7 @@ static void ffs_free_inst(struct usb_function_instance *f) |
7650 | struct f_fs_opts *opts; |
7651 | |
7652 | opts = to_f_fs_opts(f); |
7653 | + ffs_release_dev(opts->dev); |
7654 | ffs_dev_lock(); |
7655 | _ffs_free_dev(opts->dev); |
7656 | ffs_dev_unlock(); |
7657 | @@ -3711,47 +3711,48 @@ static void _ffs_free_dev(struct ffs_dev *dev) |
7658 | { |
7659 | list_del(&dev->entry); |
7660 | |
7661 | - /* Clear the private_data pointer to stop incorrect dev access */ |
7662 | - if (dev->ffs_data) |
7663 | - dev->ffs_data->private_data = NULL; |
7664 | - |
7665 | kfree(dev); |
7666 | if (list_empty(&ffs_devices)) |
7667 | functionfs_cleanup(); |
7668 | } |
7669 | |
7670 | -static void *ffs_acquire_dev(const char *dev_name) |
7671 | +static int ffs_acquire_dev(const char *dev_name, struct ffs_data *ffs_data) |
7672 | { |
7673 | + int ret = 0; |
7674 | struct ffs_dev *ffs_dev; |
7675 | |
7676 | ENTER(); |
7677 | ffs_dev_lock(); |
7678 | |
7679 | ffs_dev = _ffs_find_dev(dev_name); |
7680 | - if (!ffs_dev) |
7681 | - ffs_dev = ERR_PTR(-ENOENT); |
7682 | - else if (ffs_dev->mounted) |
7683 | - ffs_dev = ERR_PTR(-EBUSY); |
7684 | - else if (ffs_dev->ffs_acquire_dev_callback && |
7685 | - ffs_dev->ffs_acquire_dev_callback(ffs_dev)) |
7686 | - ffs_dev = ERR_PTR(-ENOENT); |
7687 | - else |
7688 | + if (!ffs_dev) { |
7689 | + ret = -ENOENT; |
7690 | + } else if (ffs_dev->mounted) { |
7691 | + ret = -EBUSY; |
7692 | + } else if (ffs_dev->ffs_acquire_dev_callback && |
7693 | + ffs_dev->ffs_acquire_dev_callback(ffs_dev)) { |
7694 | + ret = -ENOENT; |
7695 | + } else { |
7696 | ffs_dev->mounted = true; |
7697 | + ffs_dev->ffs_data = ffs_data; |
7698 | + ffs_data->private_data = ffs_dev; |
7699 | + } |
7700 | |
7701 | ffs_dev_unlock(); |
7702 | - return ffs_dev; |
7703 | + return ret; |
7704 | } |
7705 | |
7706 | -static void ffs_release_dev(struct ffs_data *ffs_data) |
7707 | +static void ffs_release_dev(struct ffs_dev *ffs_dev) |
7708 | { |
7709 | - struct ffs_dev *ffs_dev; |
7710 | - |
7711 | ENTER(); |
7712 | ffs_dev_lock(); |
7713 | |
7714 | - ffs_dev = ffs_data->private_data; |
7715 | - if (ffs_dev) { |
7716 | + if (ffs_dev && ffs_dev->mounted) { |
7717 | ffs_dev->mounted = false; |
7718 | + if (ffs_dev->ffs_data) { |
7719 | + ffs_dev->ffs_data->private_data = NULL; |
7720 | + ffs_dev->ffs_data = NULL; |
7721 | + } |
7722 | |
7723 | if (ffs_dev->ffs_release_dev_callback) |
7724 | ffs_dev->ffs_release_dev_callback(ffs_dev); |
7725 | @@ -3779,7 +3780,6 @@ static int ffs_ready(struct ffs_data *ffs) |
7726 | } |
7727 | |
7728 | ffs_obj->desc_ready = true; |
7729 | - ffs_obj->ffs_data = ffs; |
7730 | |
7731 | if (ffs_obj->ffs_ready_callback) { |
7732 | ret = ffs_obj->ffs_ready_callback(ffs); |
7733 | @@ -3807,7 +3807,6 @@ static void ffs_closed(struct ffs_data *ffs) |
7734 | goto done; |
7735 | |
7736 | ffs_obj->desc_ready = false; |
7737 | - ffs_obj->ffs_data = NULL; |
7738 | |
7739 | if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) && |
7740 | ffs_obj->ffs_closed_callback) |
7741 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
7742 | index 7f9f302a73cdf..160caef09c5ea 100644 |
7743 | --- a/drivers/usb/host/xhci-mem.c |
7744 | +++ b/drivers/usb/host/xhci-mem.c |
7745 | @@ -1929,6 +1929,7 @@ no_bw: |
7746 | xhci->hw_ports = NULL; |
7747 | xhci->rh_bw = NULL; |
7748 | xhci->ext_caps = NULL; |
7749 | + xhci->port_caps = NULL; |
7750 | |
7751 | xhci->page_size = 0; |
7752 | xhci->page_shift = 0; |
7753 | diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c |
7754 | index a400b65cf17bb..526509ed92e5c 100644 |
7755 | --- a/drivers/usb/typec/class.c |
7756 | +++ b/drivers/usb/typec/class.c |
7757 | @@ -487,8 +487,10 @@ typec_register_altmode(struct device *parent, |
7758 | int ret; |
7759 | |
7760 | alt = kzalloc(sizeof(*alt), GFP_KERNEL); |
7761 | - if (!alt) |
7762 | + if (!alt) { |
7763 | + altmode_id_remove(parent, id); |
7764 | return ERR_PTR(-ENOMEM); |
7765 | + } |
7766 | |
7767 | alt->adev.svid = desc->svid; |
7768 | alt->adev.mode = desc->mode; |
7769 | diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
7770 | index a603f363835c4..b06d76216599e 100644 |
7771 | --- a/drivers/vfio/pci/vfio_pci.c |
7772 | +++ b/drivers/vfio/pci/vfio_pci.c |
7773 | @@ -1430,6 +1430,7 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) |
7774 | { |
7775 | struct vm_area_struct *vma = vmf->vma; |
7776 | struct vfio_pci_device *vdev = vma->vm_private_data; |
7777 | + struct vfio_pci_mmap_vma *mmap_vma; |
7778 | vm_fault_t ret = VM_FAULT_NOPAGE; |
7779 | |
7780 | mutex_lock(&vdev->vma_lock); |
7781 | @@ -1437,24 +1438,36 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) |
7782 | |
7783 | if (!__vfio_pci_memory_enabled(vdev)) { |
7784 | ret = VM_FAULT_SIGBUS; |
7785 | - mutex_unlock(&vdev->vma_lock); |
7786 | goto up_out; |
7787 | } |
7788 | |
7789 | - if (__vfio_pci_add_vma(vdev, vma)) { |
7790 | - ret = VM_FAULT_OOM; |
7791 | - mutex_unlock(&vdev->vma_lock); |
7792 | - goto up_out; |
7793 | + /* |
7794 | + * We populate the whole vma on fault, so we need to test whether |
7795 | + * the vma has already been mapped, such as for concurrent faults |
7796 | + * to the same vma. io_remap_pfn_range() will trigger a BUG_ON if |
7797 | + * we ask it to fill the same range again. |
7798 | + */ |
7799 | + list_for_each_entry(mmap_vma, &vdev->vma_list, vma_next) { |
7800 | + if (mmap_vma->vma == vma) |
7801 | + goto up_out; |
7802 | } |
7803 | |
7804 | - mutex_unlock(&vdev->vma_lock); |
7805 | - |
7806 | if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
7807 | - vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
7808 | + vma->vm_end - vma->vm_start, |
7809 | + vma->vm_page_prot)) { |
7810 | ret = VM_FAULT_SIGBUS; |
7811 | + zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start); |
7812 | + goto up_out; |
7813 | + } |
7814 | + |
7815 | + if (__vfio_pci_add_vma(vdev, vma)) { |
7816 | + ret = VM_FAULT_OOM; |
7817 | + zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start); |
7818 | + } |
7819 | |
7820 | up_out: |
7821 | up_read(&vdev->memory_lock); |
7822 | + mutex_unlock(&vdev->vma_lock); |
7823 | return ret; |
7824 | } |
7825 | |
7826 | diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c |
7827 | index 2d8e8192e4e29..f03ffe2bb2376 100644 |
7828 | --- a/drivers/video/backlight/lm3630a_bl.c |
7829 | +++ b/drivers/video/backlight/lm3630a_bl.c |
7830 | @@ -480,8 +480,10 @@ static int lm3630a_parse_node(struct lm3630a_chip *pchip, |
7831 | |
7832 | device_for_each_child_node(pchip->dev, node) { |
7833 | ret = lm3630a_parse_bank(pdata, node, &seen_led_sources); |
7834 | - if (ret) |
7835 | + if (ret) { |
7836 | + fwnode_handle_put(node); |
7837 | return ret; |
7838 | + } |
7839 | } |
7840 | |
7841 | return ret; |
7842 | diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c |
7843 | index b3286d1fa5439..ffde3107104bc 100644 |
7844 | --- a/drivers/video/fbdev/imxfb.c |
7845 | +++ b/drivers/video/fbdev/imxfb.c |
7846 | @@ -977,7 +977,7 @@ static int imxfb_probe(struct platform_device *pdev) |
7847 | info->screen_buffer = dma_alloc_wc(&pdev->dev, fbi->map_size, |
7848 | &fbi->map_dma, GFP_KERNEL); |
7849 | if (!info->screen_buffer) { |
7850 | - dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret); |
7851 | + dev_err(&pdev->dev, "Failed to allocate video RAM\n"); |
7852 | ret = -ENOMEM; |
7853 | goto failed_map; |
7854 | } |
7855 | diff --git a/drivers/visorbus/visorchipset.c b/drivers/visorbus/visorchipset.c |
7856 | index cb1eb7e05f871..5668cad86e374 100644 |
7857 | --- a/drivers/visorbus/visorchipset.c |
7858 | +++ b/drivers/visorbus/visorchipset.c |
7859 | @@ -1561,7 +1561,7 @@ schedule_out: |
7860 | |
7861 | static int visorchipset_init(struct acpi_device *acpi_device) |
7862 | { |
7863 | - int err = -ENODEV; |
7864 | + int err = -ENOMEM; |
7865 | struct visorchannel *controlvm_channel; |
7866 | |
7867 | chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL); |
7868 | @@ -1584,8 +1584,10 @@ static int visorchipset_init(struct acpi_device *acpi_device) |
7869 | "controlvm", |
7870 | sizeof(struct visor_controlvm_channel), |
7871 | VISOR_CONTROLVM_CHANNEL_VERSIONID, |
7872 | - VISOR_CHANNEL_SIGNATURE)) |
7873 | + VISOR_CHANNEL_SIGNATURE)) { |
7874 | + err = -ENODEV; |
7875 | goto error_delete_groups; |
7876 | + } |
7877 | /* if booting in a crash kernel */ |
7878 | if (is_kdump_kernel()) |
7879 | INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work, |
7880 | diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig |
7881 | index 38651fae7f21a..0aa1bee24d807 100644 |
7882 | --- a/fs/btrfs/Kconfig |
7883 | +++ b/fs/btrfs/Kconfig |
7884 | @@ -14,6 +14,8 @@ config BTRFS_FS |
7885 | select RAID6_PQ |
7886 | select XOR_BLOCKS |
7887 | select SRCU |
7888 | + depends on !PPC_256K_PAGES # powerpc |
7889 | + depends on !PAGE_SIZE_256KB # hexagon |
7890 | |
7891 | help |
7892 | Btrfs is a general purpose copy-on-write filesystem with extents, |
7893 | diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c |
7894 | index 7dad8794ee388..3dccbbe4a6585 100644 |
7895 | --- a/fs/btrfs/delayed-inode.c |
7896 | +++ b/fs/btrfs/delayed-inode.c |
7897 | @@ -1033,12 +1033,10 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans, |
7898 | nofs_flag = memalloc_nofs_save(); |
7899 | ret = btrfs_lookup_inode(trans, root, path, &key, mod); |
7900 | memalloc_nofs_restore(nofs_flag); |
7901 | - if (ret > 0) { |
7902 | - btrfs_release_path(path); |
7903 | - return -ENOENT; |
7904 | - } else if (ret < 0) { |
7905 | - return ret; |
7906 | - } |
7907 | + if (ret > 0) |
7908 | + ret = -ENOENT; |
7909 | + if (ret < 0) |
7910 | + goto out; |
7911 | |
7912 | leaf = path->nodes[0]; |
7913 | inode_item = btrfs_item_ptr(leaf, path->slots[0], |
7914 | @@ -1076,6 +1074,14 @@ err_out: |
7915 | btrfs_delayed_inode_release_metadata(fs_info, node, (ret < 0)); |
7916 | btrfs_release_delayed_inode(node); |
7917 | |
7918 | + /* |
7919 | + * If we fail to update the delayed inode we need to abort the |
7920 | + * transaction, because we could leave the inode with the improper |
7921 | + * counts behind. |
7922 | + */ |
7923 | + if (ret && ret != -ENOENT) |
7924 | + btrfs_abort_transaction(trans, ret); |
7925 | + |
7926 | return ret; |
7927 | |
7928 | search: |
7929 | diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c |
7930 | index ecdefa7262d2b..fc688af57c231 100644 |
7931 | --- a/fs/btrfs/send.c |
7932 | +++ b/fs/btrfs/send.c |
7933 | @@ -4087,6 +4087,17 @@ static int process_recorded_refs(struct send_ctx *sctx, int *pending_move) |
7934 | if (ret < 0) |
7935 | goto out; |
7936 | } else { |
7937 | + /* |
7938 | + * If we previously orphanized a directory that |
7939 | + * collided with a new reference that we already |
7940 | + * processed, recompute the current path because |
7941 | + * that directory may be part of the path. |
7942 | + */ |
7943 | + if (orphanized_dir) { |
7944 | + ret = refresh_ref_path(sctx, cur); |
7945 | + if (ret < 0) |
7946 | + goto out; |
7947 | + } |
7948 | ret = send_unlink(sctx, cur->full_path); |
7949 | if (ret < 0) |
7950 | goto out; |
7951 | diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
7952 | index aca6c467d7761..d8e4e0bf3fc2d 100644 |
7953 | --- a/fs/btrfs/transaction.c |
7954 | +++ b/fs/btrfs/transaction.c |
7955 | @@ -1274,8 +1274,10 @@ int btrfs_defrag_root(struct btrfs_root *root) |
7956 | |
7957 | while (1) { |
7958 | trans = btrfs_start_transaction(root, 0); |
7959 | - if (IS_ERR(trans)) |
7960 | - return PTR_ERR(trans); |
7961 | + if (IS_ERR(trans)) { |
7962 | + ret = PTR_ERR(trans); |
7963 | + break; |
7964 | + } |
7965 | |
7966 | ret = btrfs_defrag_leaves(trans, root); |
7967 | |
7968 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
7969 | index 4ff381c23cefc..afc6731bb692c 100644 |
7970 | --- a/fs/btrfs/tree-log.c |
7971 | +++ b/fs/btrfs/tree-log.c |
7972 | @@ -6327,6 +6327,7 @@ next: |
7973 | error: |
7974 | if (wc.trans) |
7975 | btrfs_end_transaction(wc.trans); |
7976 | + clear_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags); |
7977 | btrfs_free_path(path); |
7978 | return ret; |
7979 | } |
7980 | diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h |
7981 | index b16c994414ab0..9c0e348cb00f7 100644 |
7982 | --- a/fs/cifs/cifsglob.h |
7983 | +++ b/fs/cifs/cifsglob.h |
7984 | @@ -964,7 +964,7 @@ struct cifs_ses { |
7985 | struct mutex session_mutex; |
7986 | struct TCP_Server_Info *server; /* pointer to server info */ |
7987 | int ses_count; /* reference counter */ |
7988 | - enum statusEnum status; |
7989 | + enum statusEnum status; /* updates protected by GlobalMid_Lock */ |
7990 | unsigned overrideSecFlg; /* if non-zero override global sec flags */ |
7991 | char *serverOS; /* name of operating system underlying server */ |
7992 | char *serverNOS; /* name of network operating system of server */ |
7993 | @@ -1814,6 +1814,7 @@ require use of the stronger protocol */ |
7994 | * list operations on pending_mid_q and oplockQ |
7995 | * updates to XID counters, multiplex id and SMB sequence numbers |
7996 | * list operations on global DnotifyReqList |
7997 | + * updates to ses->status |
7998 | * tcp_ses_lock protects: |
7999 | * list operations on tcp and SMB session lists |
8000 | * tcon->open_file_lock protects the list of open files hanging off the tcon |
8001 | diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
8002 | index ab9eeb5ff8e57..da0720f41ebcb 100644 |
8003 | --- a/fs/cifs/connect.c |
8004 | +++ b/fs/cifs/connect.c |
8005 | @@ -3049,9 +3049,12 @@ void cifs_put_smb_ses(struct cifs_ses *ses) |
8006 | spin_unlock(&cifs_tcp_ses_lock); |
8007 | return; |
8008 | } |
8009 | + spin_unlock(&cifs_tcp_ses_lock); |
8010 | + |
8011 | + spin_lock(&GlobalMid_Lock); |
8012 | if (ses->status == CifsGood) |
8013 | ses->status = CifsExiting; |
8014 | - spin_unlock(&cifs_tcp_ses_lock); |
8015 | + spin_unlock(&GlobalMid_Lock); |
8016 | |
8017 | cifs_free_ipc(ses); |
8018 | |
8019 | diff --git a/fs/configfs/file.c b/fs/configfs/file.c |
8020 | index 84b4d58fc65f7..66fae1853d998 100644 |
8021 | --- a/fs/configfs/file.c |
8022 | +++ b/fs/configfs/file.c |
8023 | @@ -482,13 +482,13 @@ static int configfs_release_bin_file(struct inode *inode, struct file *file) |
8024 | buffer->bin_buffer_size); |
8025 | } |
8026 | up_read(&frag->frag_sem); |
8027 | - /* vfree on NULL is safe */ |
8028 | - vfree(buffer->bin_buffer); |
8029 | - buffer->bin_buffer = NULL; |
8030 | - buffer->bin_buffer_size = 0; |
8031 | - buffer->needs_read_fill = 1; |
8032 | } |
8033 | |
8034 | + vfree(buffer->bin_buffer); |
8035 | + buffer->bin_buffer = NULL; |
8036 | + buffer->bin_buffer_size = 0; |
8037 | + buffer->needs_read_fill = 1; |
8038 | + |
8039 | configfs_release(inode, file); |
8040 | return 0; |
8041 | } |
8042 | diff --git a/fs/dax.c b/fs/dax.c |
8043 | index 3b0e5da96d541..12953e892bb25 100644 |
8044 | --- a/fs/dax.c |
8045 | +++ b/fs/dax.c |
8046 | @@ -477,10 +477,11 @@ static void *grab_mapping_entry(struct xa_state *xas, |
8047 | struct address_space *mapping, unsigned int order) |
8048 | { |
8049 | unsigned long index = xas->xa_index; |
8050 | - bool pmd_downgrade = false; /* splitting PMD entry into PTE entries? */ |
8051 | + bool pmd_downgrade; /* splitting PMD entry into PTE entries? */ |
8052 | void *entry; |
8053 | |
8054 | retry: |
8055 | + pmd_downgrade = false; |
8056 | xas_lock_irq(xas); |
8057 | entry = get_unlocked_entry(xas, order); |
8058 | |
8059 | diff --git a/fs/dlm/config.c b/fs/dlm/config.c |
8060 | index 3b1012a3c4396..b7e288cf3f5f3 100644 |
8061 | --- a/fs/dlm/config.c |
8062 | +++ b/fs/dlm/config.c |
8063 | @@ -78,6 +78,9 @@ struct dlm_cluster { |
8064 | unsigned int cl_new_rsb_count; |
8065 | unsigned int cl_recover_callbacks; |
8066 | char cl_cluster_name[DLM_LOCKSPACE_LEN]; |
8067 | + |
8068 | + struct dlm_spaces *sps; |
8069 | + struct dlm_comms *cms; |
8070 | }; |
8071 | |
8072 | static struct dlm_cluster *config_item_to_cluster(struct config_item *i) |
8073 | @@ -354,6 +357,9 @@ static struct config_group *make_cluster(struct config_group *g, |
8074 | if (!cl || !sps || !cms) |
8075 | goto fail; |
8076 | |
8077 | + cl->sps = sps; |
8078 | + cl->cms = cms; |
8079 | + |
8080 | config_group_init_type_name(&cl->group, name, &cluster_type); |
8081 | config_group_init_type_name(&sps->ss_group, "spaces", &spaces_type); |
8082 | config_group_init_type_name(&cms->cs_group, "comms", &comms_type); |
8083 | @@ -403,6 +409,9 @@ static void drop_cluster(struct config_group *g, struct config_item *i) |
8084 | static void release_cluster(struct config_item *i) |
8085 | { |
8086 | struct dlm_cluster *cl = config_item_to_cluster(i); |
8087 | + |
8088 | + kfree(cl->sps); |
8089 | + kfree(cl->cms); |
8090 | kfree(cl); |
8091 | } |
8092 | |
8093 | diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c |
8094 | index 3951d39b9b759..d9202ba665cef 100644 |
8095 | --- a/fs/dlm/lowcomms.c |
8096 | +++ b/fs/dlm/lowcomms.c |
8097 | @@ -607,7 +607,7 @@ static void close_connection(struct connection *con, bool and_other, |
8098 | } |
8099 | if (con->othercon && and_other) { |
8100 | /* Will only re-enter once. */ |
8101 | - close_connection(con->othercon, false, true, true); |
8102 | + close_connection(con->othercon, false, tx, rx); |
8103 | } |
8104 | if (con->rx_page) { |
8105 | __free_page(con->rx_page); |
8106 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
8107 | index dbd0d7a101541..ae73e67936832 100644 |
8108 | --- a/fs/ext4/extents.c |
8109 | +++ b/fs/ext4/extents.c |
8110 | @@ -862,6 +862,7 @@ int ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
8111 | eh->eh_entries = 0; |
8112 | eh->eh_magic = EXT4_EXT_MAGIC; |
8113 | eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); |
8114 | + eh->eh_generation = 0; |
8115 | ext4_mark_inode_dirty(handle, inode); |
8116 | return 0; |
8117 | } |
8118 | @@ -1118,6 +1119,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, |
8119 | neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); |
8120 | neh->eh_magic = EXT4_EXT_MAGIC; |
8121 | neh->eh_depth = 0; |
8122 | + neh->eh_generation = 0; |
8123 | |
8124 | /* move remainder of path[depth] to the new leaf */ |
8125 | if (unlikely(path[depth].p_hdr->eh_entries != |
8126 | @@ -1195,6 +1197,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, |
8127 | neh->eh_magic = EXT4_EXT_MAGIC; |
8128 | neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); |
8129 | neh->eh_depth = cpu_to_le16(depth - i); |
8130 | + neh->eh_generation = 0; |
8131 | fidx = EXT_FIRST_INDEX(neh); |
8132 | fidx->ei_block = border; |
8133 | ext4_idx_store_pblock(fidx, oldblock); |
8134 | diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c |
8135 | index d996b44d2265b..43fba01da6c3d 100644 |
8136 | --- a/fs/ext4/extents_status.c |
8137 | +++ b/fs/ext4/extents_status.c |
8138 | @@ -1553,11 +1553,9 @@ static unsigned long ext4_es_scan(struct shrinker *shrink, |
8139 | ret = percpu_counter_read_positive(&sbi->s_es_stats.es_stats_shk_cnt); |
8140 | trace_ext4_es_shrink_scan_enter(sbi->s_sb, nr_to_scan, ret); |
8141 | |
8142 | - if (!nr_to_scan) |
8143 | - return ret; |
8144 | - |
8145 | nr_shrunk = __es_shrink(sbi, nr_to_scan, NULL); |
8146 | |
8147 | + ret = percpu_counter_read_positive(&sbi->s_es_stats.es_stats_shk_cnt); |
8148 | trace_ext4_es_shrink_scan_exit(sbi->s_sb, nr_shrunk, ret); |
8149 | return nr_shrunk; |
8150 | } |
8151 | diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
8152 | index dd2c23d1483cc..83846cc814850 100644 |
8153 | --- a/fs/ext4/ialloc.c |
8154 | +++ b/fs/ext4/ialloc.c |
8155 | @@ -394,7 +394,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, |
8156 | * |
8157 | * We always try to spread first-level directories. |
8158 | * |
8159 | - * If there are blockgroups with both free inodes and free blocks counts |
8160 | + * If there are blockgroups with both free inodes and free clusters counts |
8161 | * not worse than average we return one with smallest directory count. |
8162 | * Otherwise we simply return a random group. |
8163 | * |
8164 | @@ -403,7 +403,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, |
8165 | * It's OK to put directory into a group unless |
8166 | * it has too many directories already (max_dirs) or |
8167 | * it has too few free inodes left (min_inodes) or |
8168 | - * it has too few free blocks left (min_blocks) or |
8169 | + * it has too few free clusters left (min_clusters) or |
8170 | * Parent's group is preferred, if it doesn't satisfy these |
8171 | * conditions we search cyclically through the rest. If none |
8172 | * of the groups look good we just look for a group with more |
8173 | @@ -419,7 +419,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, |
8174 | ext4_group_t real_ngroups = ext4_get_groups_count(sb); |
8175 | int inodes_per_group = EXT4_INODES_PER_GROUP(sb); |
8176 | unsigned int freei, avefreei, grp_free; |
8177 | - ext4_fsblk_t freeb, avefreec; |
8178 | + ext4_fsblk_t freec, avefreec; |
8179 | unsigned int ndirs; |
8180 | int max_dirs, min_inodes; |
8181 | ext4_grpblk_t min_clusters; |
8182 | @@ -438,9 +438,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, |
8183 | |
8184 | freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); |
8185 | avefreei = freei / ngroups; |
8186 | - freeb = EXT4_C2B(sbi, |
8187 | - percpu_counter_read_positive(&sbi->s_freeclusters_counter)); |
8188 | - avefreec = freeb; |
8189 | + freec = percpu_counter_read_positive(&sbi->s_freeclusters_counter); |
8190 | + avefreec = freec; |
8191 | do_div(avefreec, ngroups); |
8192 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); |
8193 | |
8194 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
8195 | index cd69510f29472..b67ea979f0cf7 100644 |
8196 | --- a/fs/ext4/mballoc.c |
8197 | +++ b/fs/ext4/mballoc.c |
8198 | @@ -1542,10 +1542,11 @@ static int mb_find_extent(struct ext4_buddy *e4b, int block, |
8199 | if (ex->fe_start + ex->fe_len > EXT4_CLUSTERS_PER_GROUP(e4b->bd_sb)) { |
8200 | /* Should never happen! (but apparently sometimes does?!?) */ |
8201 | WARN_ON(1); |
8202 | - ext4_error(e4b->bd_sb, "corruption or bug in mb_find_extent " |
8203 | - "block=%d, order=%d needed=%d ex=%u/%d/%d@%u", |
8204 | - block, order, needed, ex->fe_group, ex->fe_start, |
8205 | - ex->fe_len, ex->fe_logical); |
8206 | + ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0, |
8207 | + "corruption or bug in mb_find_extent " |
8208 | + "block=%d, order=%d needed=%d ex=%u/%d/%d@%u", |
8209 | + block, order, needed, ex->fe_group, ex->fe_start, |
8210 | + ex->fe_len, ex->fe_logical); |
8211 | ex->fe_len = 0; |
8212 | ex->fe_start = 0; |
8213 | ex->fe_group = 0; |
8214 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
8215 | index 0b364f5e6fdf9..ce8372ceaa43e 100644 |
8216 | --- a/fs/ext4/super.c |
8217 | +++ b/fs/ext4/super.c |
8218 | @@ -2735,8 +2735,15 @@ static void ext4_orphan_cleanup(struct super_block *sb, |
8219 | inode_lock(inode); |
8220 | truncate_inode_pages(inode->i_mapping, inode->i_size); |
8221 | ret = ext4_truncate(inode); |
8222 | - if (ret) |
8223 | + if (ret) { |
8224 | + /* |
8225 | + * We need to clean up the in-core orphan list |
8226 | + * manually if ext4_truncate() failed to get a |
8227 | + * transaction handle. |
8228 | + */ |
8229 | + ext4_orphan_del(NULL, inode); |
8230 | ext4_std_error(inode->i_sb, ret); |
8231 | + } |
8232 | inode_unlock(inode); |
8233 | nr_truncates++; |
8234 | } else { |
8235 | @@ -4611,6 +4618,7 @@ no_journal: |
8236 | ext4_msg(sb, KERN_ERR, |
8237 | "unable to initialize " |
8238 | "flex_bg meta info!"); |
8239 | + ret = -ENOMEM; |
8240 | goto failed_mount6; |
8241 | } |
8242 | |
8243 | diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c |
8244 | index a2cf2db0d3def..22e9c88f3960a 100644 |
8245 | --- a/fs/fs-writeback.c |
8246 | +++ b/fs/fs-writeback.c |
8247 | @@ -505,12 +505,19 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id) |
8248 | if (!isw) |
8249 | return; |
8250 | |
8251 | + atomic_inc(&isw_nr_in_flight); |
8252 | + |
8253 | /* find and pin the new wb */ |
8254 | rcu_read_lock(); |
8255 | memcg_css = css_from_id(new_wb_id, &memory_cgrp_subsys); |
8256 | - if (memcg_css) |
8257 | - isw->new_wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC); |
8258 | + if (memcg_css && !css_tryget(memcg_css)) |
8259 | + memcg_css = NULL; |
8260 | rcu_read_unlock(); |
8261 | + if (!memcg_css) |
8262 | + goto out_free; |
8263 | + |
8264 | + isw->new_wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC); |
8265 | + css_put(memcg_css); |
8266 | if (!isw->new_wb) |
8267 | goto out_free; |
8268 | |
8269 | @@ -535,11 +542,10 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id) |
8270 | * Let's continue after I_WB_SWITCH is guaranteed to be visible. |
8271 | */ |
8272 | call_rcu(&isw->rcu_head, inode_switch_wbs_rcu_fn); |
8273 | - |
8274 | - atomic_inc(&isw_nr_in_flight); |
8275 | return; |
8276 | |
8277 | out_free: |
8278 | + atomic_dec(&isw_nr_in_flight); |
8279 | if (isw->new_wb) |
8280 | wb_put(isw->new_wb); |
8281 | kfree(isw); |
8282 | @@ -2196,28 +2202,6 @@ int dirtytime_interval_handler(struct ctl_table *table, int write, |
8283 | return ret; |
8284 | } |
8285 | |
8286 | -static noinline void block_dump___mark_inode_dirty(struct inode *inode) |
8287 | -{ |
8288 | - if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) { |
8289 | - struct dentry *dentry; |
8290 | - const char *name = "?"; |
8291 | - |
8292 | - dentry = d_find_alias(inode); |
8293 | - if (dentry) { |
8294 | - spin_lock(&dentry->d_lock); |
8295 | - name = (const char *) dentry->d_name.name; |
8296 | - } |
8297 | - printk(KERN_DEBUG |
8298 | - "%s(%d): dirtied inode %lu (%s) on %s\n", |
8299 | - current->comm, task_pid_nr(current), inode->i_ino, |
8300 | - name, inode->i_sb->s_id); |
8301 | - if (dentry) { |
8302 | - spin_unlock(&dentry->d_lock); |
8303 | - dput(dentry); |
8304 | - } |
8305 | - } |
8306 | -} |
8307 | - |
8308 | /** |
8309 | * __mark_inode_dirty - internal function |
8310 | * |
8311 | @@ -2277,9 +2261,6 @@ void __mark_inode_dirty(struct inode *inode, int flags) |
8312 | (dirtytime && (inode->i_state & I_DIRTY_INODE))) |
8313 | return; |
8314 | |
8315 | - if (unlikely(block_dump)) |
8316 | - block_dump___mark_inode_dirty(inode); |
8317 | - |
8318 | spin_lock(&inode->i_lock); |
8319 | if (dirtytime && (inode->i_state & I_DIRTY_INODE)) |
8320 | goto out_unlock_inode; |
8321 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
8322 | index 40c262b3f9ff5..16aa55b73ccf5 100644 |
8323 | --- a/fs/fuse/dev.c |
8324 | +++ b/fs/fuse/dev.c |
8325 | @@ -770,6 +770,7 @@ static int fuse_check_page(struct page *page) |
8326 | 1 << PG_uptodate | |
8327 | 1 << PG_lru | |
8328 | 1 << PG_active | |
8329 | + 1 << PG_workingset | |
8330 | 1 << PG_reclaim | |
8331 | 1 << PG_waiters))) { |
8332 | pr_warn("trying to steal weird page\n"); |
8333 | @@ -1263,6 +1264,15 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, |
8334 | goto restart; |
8335 | } |
8336 | spin_lock(&fpq->lock); |
8337 | + /* |
8338 | + * Must not put request on fpq->io queue after having been shut down by |
8339 | + * fuse_abort_conn() |
8340 | + */ |
8341 | + if (!fpq->connected) { |
8342 | + req->out.h.error = err = -ECONNABORTED; |
8343 | + goto out_end; |
8344 | + |
8345 | + } |
8346 | list_add(&req->list, &fpq->io); |
8347 | spin_unlock(&fpq->lock); |
8348 | cs->req = req; |
8349 | @@ -1859,7 +1869,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, |
8350 | } |
8351 | |
8352 | err = -EINVAL; |
8353 | - if (oh.error <= -1000 || oh.error > 0) |
8354 | + if (oh.error <= -512 || oh.error > 0) |
8355 | goto copy_finish; |
8356 | |
8357 | spin_lock(&fpq->lock); |
8358 | diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c |
8359 | index 672feb96e250e..46dc16e01fe20 100644 |
8360 | --- a/fs/ntfs/inode.c |
8361 | +++ b/fs/ntfs/inode.c |
8362 | @@ -476,7 +476,7 @@ err_corrupt_attr: |
8363 | } |
8364 | file_name_attr = (FILE_NAME_ATTR*)((u8*)attr + |
8365 | le16_to_cpu(attr->data.resident.value_offset)); |
8366 | - p2 = (u8*)attr + le32_to_cpu(attr->data.resident.value_length); |
8367 | + p2 = (u8 *)file_name_attr + le32_to_cpu(attr->data.resident.value_length); |
8368 | if (p2 < (u8*)attr || p2 > p) |
8369 | goto err_corrupt_attr; |
8370 | /* This attribute is ok, but is it in the $Extend directory? */ |
8371 | diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c |
8372 | index 50f11bfdc8c2d..82a3edc4aea4b 100644 |
8373 | --- a/fs/ocfs2/filecheck.c |
8374 | +++ b/fs/ocfs2/filecheck.c |
8375 | @@ -328,11 +328,7 @@ static ssize_t ocfs2_filecheck_attr_show(struct kobject *kobj, |
8376 | ret = snprintf(buf + total, remain, "%lu\t\t%u\t%s\n", |
8377 | p->fe_ino, p->fe_done, |
8378 | ocfs2_filecheck_error(p->fe_status)); |
8379 | - if (ret < 0) { |
8380 | - total = ret; |
8381 | - break; |
8382 | - } |
8383 | - if (ret == remain) { |
8384 | + if (ret >= remain) { |
8385 | /* snprintf() didn't fit */ |
8386 | total = -E2BIG; |
8387 | break; |
8388 | diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c |
8389 | index 8aa6a667860c9..1880387601361 100644 |
8390 | --- a/fs/ocfs2/stackglue.c |
8391 | +++ b/fs/ocfs2/stackglue.c |
8392 | @@ -502,11 +502,7 @@ static ssize_t ocfs2_loaded_cluster_plugins_show(struct kobject *kobj, |
8393 | list_for_each_entry(p, &ocfs2_stack_list, sp_list) { |
8394 | ret = snprintf(buf, remain, "%s\n", |
8395 | p->sp_name); |
8396 | - if (ret < 0) { |
8397 | - total = ret; |
8398 | - break; |
8399 | - } |
8400 | - if (ret == remain) { |
8401 | + if (ret >= remain) { |
8402 | /* snprintf() didn't fit */ |
8403 | total = -E2BIG; |
8404 | break; |
8405 | @@ -533,7 +529,7 @@ static ssize_t ocfs2_active_cluster_plugin_show(struct kobject *kobj, |
8406 | if (active_stack) { |
8407 | ret = snprintf(buf, PAGE_SIZE, "%s\n", |
8408 | active_stack->sp_name); |
8409 | - if (ret == PAGE_SIZE) |
8410 | + if (ret >= PAGE_SIZE) |
8411 | ret = -E2BIG; |
8412 | } |
8413 | spin_unlock(&ocfs2_stack_lock); |
8414 | diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h |
8415 | index bfc9db7b100d6..9cc7f1c02d270 100644 |
8416 | --- a/include/crypto/internal/hash.h |
8417 | +++ b/include/crypto/internal/hash.h |
8418 | @@ -77,13 +77,7 @@ int ahash_register_instance(struct crypto_template *tmpl, |
8419 | struct ahash_instance *inst); |
8420 | void ahash_free_instance(struct crypto_instance *inst); |
8421 | |
8422 | -int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, |
8423 | - unsigned int keylen); |
8424 | - |
8425 | -static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg) |
8426 | -{ |
8427 | - return alg->setkey != shash_no_setkey; |
8428 | -} |
8429 | +bool crypto_shash_alg_has_setkey(struct shash_alg *alg); |
8430 | |
8431 | bool crypto_hash_alg_has_setkey(struct hash_alg_common *halg); |
8432 | |
8433 | diff --git a/include/linux/bio.h b/include/linux/bio.h |
8434 | index 853d92ceee64e..b0927b27a8a88 100644 |
8435 | --- a/include/linux/bio.h |
8436 | +++ b/include/linux/bio.h |
8437 | @@ -40,9 +40,6 @@ |
8438 | #define bio_offset(bio) bio_iter_offset((bio), (bio)->bi_iter) |
8439 | #define bio_iovec(bio) bio_iter_iovec((bio), (bio)->bi_iter) |
8440 | |
8441 | -#define bio_multiple_segments(bio) \ |
8442 | - ((bio)->bi_iter.bi_size != bio_iovec(bio).bv_len) |
8443 | - |
8444 | #define bvec_iter_sectors(iter) ((iter).bi_size >> 9) |
8445 | #define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((iter))) |
8446 | |
8447 | @@ -246,7 +243,7 @@ static inline void bio_clear_flag(struct bio *bio, unsigned int bit) |
8448 | |
8449 | static inline void bio_get_first_bvec(struct bio *bio, struct bio_vec *bv) |
8450 | { |
8451 | - *bv = bio_iovec(bio); |
8452 | + *bv = mp_bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter); |
8453 | } |
8454 | |
8455 | static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv) |
8456 | @@ -254,10 +251,9 @@ static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv) |
8457 | struct bvec_iter iter = bio->bi_iter; |
8458 | int idx; |
8459 | |
8460 | - if (unlikely(!bio_multiple_segments(bio))) { |
8461 | - *bv = bio_iovec(bio); |
8462 | - return; |
8463 | - } |
8464 | + bio_get_first_bvec(bio, bv); |
8465 | + if (bv->bv_len == bio->bi_iter.bi_size) |
8466 | + return; /* this bio only has a single bvec */ |
8467 | |
8468 | bio_advance_iter(bio, &iter, iter.bi_size); |
8469 | |
8470 | diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linux/iio/common/cros_ec_sensors_core.h |
8471 | index bb331e6356a9c..a321531539dd1 100644 |
8472 | --- a/include/linux/iio/common/cros_ec_sensors_core.h |
8473 | +++ b/include/linux/iio/common/cros_ec_sensors_core.h |
8474 | @@ -68,7 +68,7 @@ struct cros_ec_sensors_core_state { |
8475 | u16 scale; |
8476 | } calib[CROS_EC_SENSOR_MAX_AXIS]; |
8477 | s8 sign[CROS_EC_SENSOR_MAX_AXIS]; |
8478 | - u8 samples[CROS_EC_SAMPLE_SIZE]; |
8479 | + u8 samples[CROS_EC_SAMPLE_SIZE] __aligned(8); |
8480 | |
8481 | int (*read_ec_sensors_data)(struct iio_dev *indio_dev, |
8482 | unsigned long scan_mask, s16 *data); |
8483 | diff --git a/include/linux/prandom.h b/include/linux/prandom.h |
8484 | index cc1e71334e53c..e20339c78a84c 100644 |
8485 | --- a/include/linux/prandom.h |
8486 | +++ b/include/linux/prandom.h |
8487 | @@ -93,7 +93,7 @@ static inline u32 __seed(u32 x, u32 m) |
8488 | */ |
8489 | static inline void prandom_seed_state(struct rnd_state *state, u64 seed) |
8490 | { |
8491 | - u32 i = (seed >> 32) ^ (seed << 10) ^ seed; |
8492 | + u32 i = ((seed >> 32) ^ (seed << 10) ^ seed) & 0xffffffffUL; |
8493 | |
8494 | state->s1 = __seed(i, 2U); |
8495 | state->s2 = __seed(i, 8U); |
8496 | diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h |
8497 | index 57ce5af258a3b..eede1a7c81955 100644 |
8498 | --- a/include/linux/tracepoint.h |
8499 | +++ b/include/linux/tracepoint.h |
8500 | @@ -40,7 +40,17 @@ extern int |
8501 | tracepoint_probe_register_prio(struct tracepoint *tp, void *probe, void *data, |
8502 | int prio); |
8503 | extern int |
8504 | +tracepoint_probe_register_prio_may_exist(struct tracepoint *tp, void *probe, void *data, |
8505 | + int prio); |
8506 | +extern int |
8507 | tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data); |
8508 | +static inline int |
8509 | +tracepoint_probe_register_may_exist(struct tracepoint *tp, void *probe, |
8510 | + void *data) |
8511 | +{ |
8512 | + return tracepoint_probe_register_prio_may_exist(tp, probe, data, |
8513 | + TRACEPOINT_DEFAULT_PRIO); |
8514 | +} |
8515 | extern void |
8516 | for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), |
8517 | void *priv); |
8518 | diff --git a/include/media/media-dev-allocator.h b/include/media/media-dev-allocator.h |
8519 | index b35ea6062596b..2ab54d426c644 100644 |
8520 | --- a/include/media/media-dev-allocator.h |
8521 | +++ b/include/media/media-dev-allocator.h |
8522 | @@ -19,7 +19,7 @@ |
8523 | |
8524 | struct usb_device; |
8525 | |
8526 | -#if defined(CONFIG_MEDIA_CONTROLLER) && defined(CONFIG_USB) |
8527 | +#if defined(CONFIG_MEDIA_CONTROLLER) && IS_ENABLED(CONFIG_USB) |
8528 | /** |
8529 | * media_device_usb_allocate() - Allocate and return struct &media device |
8530 | * |
8531 | diff --git a/include/net/ip.h b/include/net/ip.h |
8532 | index 0278d63c15274..52abfc00b5e3d 100644 |
8533 | --- a/include/net/ip.h |
8534 | +++ b/include/net/ip.h |
8535 | @@ -30,6 +30,7 @@ |
8536 | #include <net/flow.h> |
8537 | #include <net/flow_dissector.h> |
8538 | #include <net/netns/hash.h> |
8539 | +#include <net/lwtunnel.h> |
8540 | |
8541 | #define IPV4_MAX_PMTU 65535U /* RFC 2675, Section 5.1 */ |
8542 | #define IPV4_MIN_MTU 68 /* RFC 791 */ |
8543 | @@ -448,22 +449,25 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, |
8544 | |
8545 | /* 'forwarding = true' case should always honour route mtu */ |
8546 | mtu = dst_metric_raw(dst, RTAX_MTU); |
8547 | - if (mtu) |
8548 | - return mtu; |
8549 | + if (!mtu) |
8550 | + mtu = min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU); |
8551 | |
8552 | - return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU); |
8553 | + return mtu - lwtunnel_headroom(dst->lwtstate, mtu); |
8554 | } |
8555 | |
8556 | static inline unsigned int ip_skb_dst_mtu(struct sock *sk, |
8557 | const struct sk_buff *skb) |
8558 | { |
8559 | + unsigned int mtu; |
8560 | + |
8561 | if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) { |
8562 | bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED; |
8563 | |
8564 | return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding); |
8565 | } |
8566 | |
8567 | - return min(READ_ONCE(skb_dst(skb)->dev->mtu), IP_MAX_MTU); |
8568 | + mtu = min(READ_ONCE(skb_dst(skb)->dev->mtu), IP_MAX_MTU); |
8569 | + return mtu - lwtunnel_headroom(skb_dst(skb)->lwtstate, mtu); |
8570 | } |
8571 | |
8572 | struct dst_metrics *ip_fib_metrics_init(struct net *net, struct nlattr *fc_mx, |
8573 | diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h |
8574 | index 2d0d91070268c..40602def3fe76 100644 |
8575 | --- a/include/net/ip6_route.h |
8576 | +++ b/include/net/ip6_route.h |
8577 | @@ -263,11 +263,18 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
8578 | |
8579 | static inline int ip6_skb_dst_mtu(struct sk_buff *skb) |
8580 | { |
8581 | + int mtu; |
8582 | + |
8583 | struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ? |
8584 | inet6_sk(skb->sk) : NULL; |
8585 | |
8586 | - return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ? |
8587 | - skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); |
8588 | + if (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) { |
8589 | + mtu = READ_ONCE(skb_dst(skb)->dev->mtu); |
8590 | + mtu -= lwtunnel_headroom(skb_dst(skb)->lwtstate, mtu); |
8591 | + } else |
8592 | + mtu = dst_mtu(skb_dst(skb)); |
8593 | + |
8594 | + return mtu; |
8595 | } |
8596 | |
8597 | static inline bool ip6_sk_accept_pmtu(const struct sock *sk) |
8598 | @@ -315,7 +322,7 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) |
8599 | if (dst_metric_locked(dst, RTAX_MTU)) { |
8600 | mtu = dst_metric_raw(dst, RTAX_MTU); |
8601 | if (mtu) |
8602 | - return mtu; |
8603 | + goto out; |
8604 | } |
8605 | |
8606 | mtu = IPV6_MIN_MTU; |
8607 | @@ -325,7 +332,8 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) |
8608 | mtu = idev->cnf.mtu6; |
8609 | rcu_read_unlock(); |
8610 | |
8611 | - return mtu; |
8612 | +out: |
8613 | + return mtu - lwtunnel_headroom(dst->lwtstate, mtu); |
8614 | } |
8615 | |
8616 | u32 ip6_mtu_from_fib6(const struct fib6_result *res, |
8617 | diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
8618 | index 0852f3e51360a..0cb0a4bcb5447 100644 |
8619 | --- a/include/net/sch_generic.h |
8620 | +++ b/include/net/sch_generic.h |
8621 | @@ -160,6 +160,12 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) |
8622 | if (spin_trylock(&qdisc->seqlock)) |
8623 | goto nolock_empty; |
8624 | |
8625 | + /* Paired with smp_mb__after_atomic() to make sure |
8626 | + * STATE_MISSED checking is synchronized with clearing |
8627 | + * in pfifo_fast_dequeue(). |
8628 | + */ |
8629 | + smp_mb__before_atomic(); |
8630 | + |
8631 | /* If the MISSED flag is set, it means other thread has |
8632 | * set the MISSED flag before second spin_trylock(), so |
8633 | * we can return false here to avoid multi cpus doing |
8634 | @@ -177,6 +183,12 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) |
8635 | */ |
8636 | set_bit(__QDISC_STATE_MISSED, &qdisc->state); |
8637 | |
8638 | + /* spin_trylock() only has load-acquire semantic, so use |
8639 | + * smp_mb__after_atomic() to ensure STATE_MISSED is set |
8640 | + * before doing the second spin_trylock(). |
8641 | + */ |
8642 | + smp_mb__after_atomic(); |
8643 | + |
8644 | /* Retry again in case other CPU may not see the new flag |
8645 | * after it releases the lock at the end of qdisc_run_end(). |
8646 | */ |
8647 | diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h |
8648 | index 4e2502408c316..add6fb50dd330 100644 |
8649 | --- a/include/net/tc_act/tc_vlan.h |
8650 | +++ b/include/net/tc_act/tc_vlan.h |
8651 | @@ -14,6 +14,7 @@ struct tcf_vlan_params { |
8652 | u16 tcfv_push_vid; |
8653 | __be16 tcfv_push_proto; |
8654 | u8 tcfv_push_prio; |
8655 | + bool tcfv_push_prio_exists; |
8656 | struct rcu_head rcu; |
8657 | }; |
8658 | |
8659 | diff --git a/include/net/xfrm.h b/include/net/xfrm.h |
8660 | index 614f19bbad74f..8ce63850d6d01 100644 |
8661 | --- a/include/net/xfrm.h |
8662 | +++ b/include/net/xfrm.h |
8663 | @@ -1543,6 +1543,7 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); |
8664 | void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
8665 | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); |
8666 | int xfrm_init_replay(struct xfrm_state *x); |
8667 | +u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu); |
8668 | u32 xfrm_state_mtu(struct xfrm_state *x, int mtu); |
8669 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload); |
8670 | int xfrm_init_state(struct xfrm_state *x); |
8671 | diff --git a/kernel/kthread.c b/kernel/kthread.c |
8672 | index 2eb8d7550324b..b2bac5d929d2b 100644 |
8673 | --- a/kernel/kthread.c |
8674 | +++ b/kernel/kthread.c |
8675 | @@ -1083,14 +1083,14 @@ static bool __kthread_cancel_work(struct kthread_work *work) |
8676 | * modify @dwork's timer so that it expires after @delay. If @delay is zero, |
8677 | * @work is guaranteed to be queued immediately. |
8678 | * |
8679 | - * Return: %true if @dwork was pending and its timer was modified, |
8680 | - * %false otherwise. |
8681 | + * Return: %false if @dwork was idle and queued, %true otherwise. |
8682 | * |
8683 | * A special case is when the work is being canceled in parallel. |
8684 | * It might be caused either by the real kthread_cancel_delayed_work_sync() |
8685 | * or yet another kthread_mod_delayed_work() call. We let the other command |
8686 | - * win and return %false here. The caller is supposed to synchronize these |
8687 | - * operations a reasonable way. |
8688 | + * win and return %true here. The return value can be used for reference |
8689 | + * counting and the number of queued works stays the same. Anyway, the caller |
8690 | + * is supposed to synchronize these operations a reasonable way. |
8691 | * |
8692 | * This function is safe to call from any context including IRQ handler. |
8693 | * See __kthread_cancel_work() and kthread_delayed_work_timer_fn() |
8694 | @@ -1102,13 +1102,15 @@ bool kthread_mod_delayed_work(struct kthread_worker *worker, |
8695 | { |
8696 | struct kthread_work *work = &dwork->work; |
8697 | unsigned long flags; |
8698 | - int ret = false; |
8699 | + int ret; |
8700 | |
8701 | raw_spin_lock_irqsave(&worker->lock, flags); |
8702 | |
8703 | /* Do not bother with canceling when never queued. */ |
8704 | - if (!work->worker) |
8705 | + if (!work->worker) { |
8706 | + ret = false; |
8707 | goto fast_queue; |
8708 | + } |
8709 | |
8710 | /* Work must not be used with >1 worker, see kthread_queue_work() */ |
8711 | WARN_ON_ONCE(work->worker != worker); |
8712 | @@ -1126,8 +1128,11 @@ bool kthread_mod_delayed_work(struct kthread_worker *worker, |
8713 | * be used for reference counting. |
8714 | */ |
8715 | kthread_cancel_delayed_work_timer(work, &flags); |
8716 | - if (work->canceling) |
8717 | + if (work->canceling) { |
8718 | + /* The number of works in the queue does not change. */ |
8719 | + ret = true; |
8720 | goto out; |
8721 | + } |
8722 | ret = __kthread_cancel_work(work); |
8723 | |
8724 | fast_queue: |
8725 | diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c |
8726 | index 7429f15717559..3ec8fd2e80e53 100644 |
8727 | --- a/kernel/locking/lockdep.c |
8728 | +++ b/kernel/locking/lockdep.c |
8729 | @@ -1941,7 +1941,56 @@ static void print_lock_class_header(struct lock_class *class, int depth) |
8730 | } |
8731 | |
8732 | /* |
8733 | - * printk the shortest lock dependencies from @start to @end in reverse order: |
8734 | + * Dependency path printing: |
8735 | + * |
8736 | + * After BFS we get a lock dependency path (linked via ->parent of lock_list), |
8737 | + * printing out each lock in the dependency path will help on understanding how |
8738 | + * the deadlock could happen. Here are some details about dependency path |
8739 | + * printing: |
8740 | + * |
8741 | + * 1) A lock_list can be either forwards or backwards for a lock dependency, |
8742 | + * for a lock dependency A -> B, there are two lock_lists: |
8743 | + * |
8744 | + * a) lock_list in the ->locks_after list of A, whose ->class is B and |
8745 | + * ->links_to is A. In this case, we can say the lock_list is |
8746 | + * "A -> B" (forwards case). |
8747 | + * |
8748 | + * b) lock_list in the ->locks_before list of B, whose ->class is A |
8749 | + * and ->links_to is B. In this case, we can say the lock_list is |
8750 | + * "B <- A" (bacwards case). |
8751 | + * |
8752 | + * The ->trace of both a) and b) point to the call trace where B was |
8753 | + * acquired with A held. |
8754 | + * |
8755 | + * 2) A "helper" lock_list is introduced during BFS, this lock_list doesn't |
8756 | + * represent a certain lock dependency, it only provides an initial entry |
8757 | + * for BFS. For example, BFS may introduce a "helper" lock_list whose |
8758 | + * ->class is A, as a result BFS will search all dependencies starting with |
8759 | + * A, e.g. A -> B or A -> C. |
8760 | + * |
8761 | + * The notation of a forwards helper lock_list is like "-> A", which means |
8762 | + * we should search the forwards dependencies starting with "A", e.g A -> B |
8763 | + * or A -> C. |
8764 | + * |
8765 | + * The notation of a bacwards helper lock_list is like "<- B", which means |
8766 | + * we should search the backwards dependencies ending with "B", e.g. |
8767 | + * B <- A or B <- C. |
8768 | + */ |
8769 | + |
8770 | +/* |
8771 | + * printk the shortest lock dependencies from @root to @leaf in reverse order. |
8772 | + * |
8773 | + * We have a lock dependency path as follow: |
8774 | + * |
8775 | + * @root @leaf |
8776 | + * | | |
8777 | + * V V |
8778 | + * ->parent ->parent |
8779 | + * | lock_list | <--------- | lock_list | ... | lock_list | <--------- | lock_list | |
8780 | + * | -> L1 | | L1 -> L2 | ... |Ln-2 -> Ln-1| | Ln-1 -> Ln| |
8781 | + * |
8782 | + * , so it's natural that we start from @leaf and print every ->class and |
8783 | + * ->trace until we reach the @root. |
8784 | */ |
8785 | static void __used |
8786 | print_shortest_lock_dependencies(struct lock_list *leaf, |
8787 | @@ -1969,6 +2018,61 @@ print_shortest_lock_dependencies(struct lock_list *leaf, |
8788 | } while (entry && (depth >= 0)); |
8789 | } |
8790 | |
8791 | +/* |
8792 | + * printk the shortest lock dependencies from @leaf to @root. |
8793 | + * |
8794 | + * We have a lock dependency path (from a backwards search) as follow: |
8795 | + * |
8796 | + * @leaf @root |
8797 | + * | | |
8798 | + * V V |
8799 | + * ->parent ->parent |
8800 | + * | lock_list | ---------> | lock_list | ... | lock_list | ---------> | lock_list | |
8801 | + * | L2 <- L1 | | L3 <- L2 | ... | Ln <- Ln-1 | | <- Ln | |
8802 | + * |
8803 | + * , so when we iterate from @leaf to @root, we actually print the lock |
8804 | + * dependency path L1 -> L2 -> .. -> Ln in the non-reverse order. |
8805 | + * |
8806 | + * Another thing to notice here is that ->class of L2 <- L1 is L1, while the |
8807 | + * ->trace of L2 <- L1 is the call trace of L2, in fact we don't have the call |
8808 | + * trace of L1 in the dependency path, which is alright, because most of the |
8809 | + * time we can figure out where L1 is held from the call trace of L2. |
8810 | + */ |
8811 | +static void __used |
8812 | +print_shortest_lock_dependencies_backwards(struct lock_list *leaf, |
8813 | + struct lock_list *root) |
8814 | +{ |
8815 | + struct lock_list *entry = leaf; |
8816 | + const struct lock_trace *trace = NULL; |
8817 | + int depth; |
8818 | + |
8819 | + /*compute depth from generated tree by BFS*/ |
8820 | + depth = get_lock_depth(leaf); |
8821 | + |
8822 | + do { |
8823 | + print_lock_class_header(entry->class, depth); |
8824 | + if (trace) { |
8825 | + printk("%*s ... acquired at:\n", depth, ""); |
8826 | + print_lock_trace(trace, 2); |
8827 | + printk("\n"); |
8828 | + } |
8829 | + |
8830 | + /* |
8831 | + * Record the pointer to the trace for the next lock_list |
8832 | + * entry, see the comments for the function. |
8833 | + */ |
8834 | + trace = entry->trace; |
8835 | + |
8836 | + if (depth == 0 && (entry != root)) { |
8837 | + printk("lockdep:%s bad path found in chain graph\n", __func__); |
8838 | + break; |
8839 | + } |
8840 | + |
8841 | + entry = get_lock_parent(entry); |
8842 | + depth--; |
8843 | + } while (entry && (depth >= 0)); |
8844 | +} |
8845 | + |
8846 | static void |
8847 | print_irq_lock_scenario(struct lock_list *safe_entry, |
8848 | struct lock_list *unsafe_entry, |
8849 | @@ -2086,7 +2190,7 @@ print_bad_irq_dependency(struct task_struct *curr, |
8850 | prev_root->trace = save_trace(); |
8851 | if (!prev_root->trace) |
8852 | return; |
8853 | - print_shortest_lock_dependencies(backwards_entry, prev_root); |
8854 | + print_shortest_lock_dependencies_backwards(backwards_entry, prev_root); |
8855 | |
8856 | pr_warn("\nthe dependencies between the lock to be acquired"); |
8857 | pr_warn(" and %s-irq-unsafe lock:\n", irqclass); |
8858 | @@ -2273,8 +2377,18 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev, |
8859 | * Step 3: we found a bad match! Now retrieve a lock from the backward |
8860 | * list whose usage mask matches the exclusive usage mask from the |
8861 | * lock found on the forward list. |
8862 | + * |
8863 | + * Note, we should only keep the LOCKF_ENABLED_IRQ_ALL bits, considering |
8864 | + * the follow case: |
8865 | + * |
8866 | + * When trying to add A -> B to the graph, we find that there is a |
8867 | + * hardirq-safe L, that L -> ... -> A, and another hardirq-unsafe M, |
8868 | + * that B -> ... -> M. However M is **softirq-safe**, if we use exact |
8869 | + * invert bits of M's usage_mask, we will find another lock N that is |
8870 | + * **softirq-unsafe** and N -> ... -> A, however N -> .. -> M will not |
8871 | + * cause a inversion deadlock. |
8872 | */ |
8873 | - backward_mask = original_mask(target_entry1->class->usage_mask); |
8874 | + backward_mask = original_mask(target_entry1->class->usage_mask & LOCKF_ENABLED_IRQ_ALL); |
8875 | |
8876 | ret = find_usage_backwards(&this, backward_mask, &target_entry); |
8877 | if (ret < 0) { |
8878 | diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c |
8879 | index 4dfa9dd47223a..fd37827eca5b0 100644 |
8880 | --- a/kernel/rcu/tree.c |
8881 | +++ b/kernel/rcu/tree.c |
8882 | @@ -2498,7 +2498,6 @@ static int __init rcu_spawn_core_kthreads(void) |
8883 | "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__); |
8884 | return 0; |
8885 | } |
8886 | -early_initcall(rcu_spawn_core_kthreads); |
8887 | |
8888 | /* |
8889 | * Handle any core-RCU processing required by a call_rcu() invocation. |
8890 | @@ -3315,6 +3314,7 @@ static int __init rcu_spawn_gp_kthread(void) |
8891 | wake_up_process(t); |
8892 | rcu_spawn_nocb_kthreads(); |
8893 | rcu_spawn_boost_kthreads(); |
8894 | + rcu_spawn_core_kthreads(); |
8895 | return 0; |
8896 | } |
8897 | early_initcall(rcu_spawn_gp_kthread); |
8898 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
8899 | index a3e95d7779e15..8294debf68c4d 100644 |
8900 | --- a/kernel/sched/core.c |
8901 | +++ b/kernel/sched/core.c |
8902 | @@ -894,9 +894,10 @@ unsigned int uclamp_rq_max_value(struct rq *rq, enum uclamp_id clamp_id, |
8903 | static inline struct uclamp_se |
8904 | uclamp_tg_restrict(struct task_struct *p, enum uclamp_id clamp_id) |
8905 | { |
8906 | + /* Copy by value as we could modify it */ |
8907 | struct uclamp_se uc_req = p->uclamp_req[clamp_id]; |
8908 | #ifdef CONFIG_UCLAMP_TASK_GROUP |
8909 | - struct uclamp_se uc_max; |
8910 | + unsigned int tg_min, tg_max, value; |
8911 | |
8912 | /* |
8913 | * Tasks in autogroups or root task group will be |
8914 | @@ -907,9 +908,11 @@ uclamp_tg_restrict(struct task_struct *p, enum uclamp_id clamp_id) |
8915 | if (task_group(p) == &root_task_group) |
8916 | return uc_req; |
8917 | |
8918 | - uc_max = task_group(p)->uclamp[clamp_id]; |
8919 | - if (uc_req.value > uc_max.value || !uc_req.user_defined) |
8920 | - return uc_max; |
8921 | + tg_min = task_group(p)->uclamp[UCLAMP_MIN].value; |
8922 | + tg_max = task_group(p)->uclamp[UCLAMP_MAX].value; |
8923 | + value = uc_req.value; |
8924 | + value = clamp(value, tg_min, tg_max); |
8925 | + uclamp_se_set(&uc_req, value, false); |
8926 | #endif |
8927 | |
8928 | return uc_req; |
8929 | @@ -1108,8 +1111,9 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) |
8930 | } |
8931 | |
8932 | static inline void |
8933 | -uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id) |
8934 | +uclamp_update_active(struct task_struct *p) |
8935 | { |
8936 | + enum uclamp_id clamp_id; |
8937 | struct rq_flags rf; |
8938 | struct rq *rq; |
8939 | |
8940 | @@ -1129,9 +1133,11 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id) |
8941 | * affecting a valid clamp bucket, the next time it's enqueued, |
8942 | * it will already see the updated clamp bucket value. |
8943 | */ |
8944 | - if (p->uclamp[clamp_id].active) { |
8945 | - uclamp_rq_dec_id(rq, p, clamp_id); |
8946 | - uclamp_rq_inc_id(rq, p, clamp_id); |
8947 | + for_each_clamp_id(clamp_id) { |
8948 | + if (p->uclamp[clamp_id].active) { |
8949 | + uclamp_rq_dec_id(rq, p, clamp_id); |
8950 | + uclamp_rq_inc_id(rq, p, clamp_id); |
8951 | + } |
8952 | } |
8953 | |
8954 | task_rq_unlock(rq, p, &rf); |
8955 | @@ -1139,20 +1145,14 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id) |
8956 | |
8957 | #ifdef CONFIG_UCLAMP_TASK_GROUP |
8958 | static inline void |
8959 | -uclamp_update_active_tasks(struct cgroup_subsys_state *css, |
8960 | - unsigned int clamps) |
8961 | +uclamp_update_active_tasks(struct cgroup_subsys_state *css) |
8962 | { |
8963 | - enum uclamp_id clamp_id; |
8964 | struct css_task_iter it; |
8965 | struct task_struct *p; |
8966 | |
8967 | css_task_iter_start(css, 0, &it); |
8968 | - while ((p = css_task_iter_next(&it))) { |
8969 | - for_each_clamp_id(clamp_id) { |
8970 | - if ((0x1 << clamp_id) & clamps) |
8971 | - uclamp_update_active(p, clamp_id); |
8972 | - } |
8973 | - } |
8974 | + while ((p = css_task_iter_next(&it))) |
8975 | + uclamp_update_active(p); |
8976 | css_task_iter_end(&it); |
8977 | } |
8978 | |
8979 | @@ -7186,7 +7186,11 @@ static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) |
8980 | |
8981 | #ifdef CONFIG_UCLAMP_TASK_GROUP |
8982 | /* Propagate the effective uclamp value for the new group */ |
8983 | + mutex_lock(&uclamp_mutex); |
8984 | + rcu_read_lock(); |
8985 | cpu_util_update_eff(css); |
8986 | + rcu_read_unlock(); |
8987 | + mutex_unlock(&uclamp_mutex); |
8988 | #endif |
8989 | |
8990 | return 0; |
8991 | @@ -7276,6 +7280,9 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css) |
8992 | enum uclamp_id clamp_id; |
8993 | unsigned int clamps; |
8994 | |
8995 | + lockdep_assert_held(&uclamp_mutex); |
8996 | + SCHED_WARN_ON(!rcu_read_lock_held()); |
8997 | + |
8998 | css_for_each_descendant_pre(css, top_css) { |
8999 | uc_parent = css_tg(css)->parent |
9000 | ? css_tg(css)->parent->uclamp : NULL; |
9001 | @@ -7308,7 +7315,7 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css) |
9002 | } |
9003 | |
9004 | /* Immediately update descendants RUNNABLE tasks */ |
9005 | - uclamp_update_active_tasks(css, clamps); |
9006 | + uclamp_update_active_tasks(css); |
9007 | } |
9008 | } |
9009 | |
9010 | diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c |
9011 | index 4ce8c11e5e4ae..3cf776d5bce8f 100644 |
9012 | --- a/kernel/sched/deadline.c |
9013 | +++ b/kernel/sched/deadline.c |
9014 | @@ -2392,6 +2392,8 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) |
9015 | check_preempt_curr_dl(rq, p, 0); |
9016 | else |
9017 | resched_curr(rq); |
9018 | + } else { |
9019 | + update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 0); |
9020 | } |
9021 | } |
9022 | |
9023 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
9024 | index d3f4113e87ded..d2ba080ea7425 100644 |
9025 | --- a/kernel/sched/fair.c |
9026 | +++ b/kernel/sched/fair.c |
9027 | @@ -2927,7 +2927,7 @@ void reweight_task(struct task_struct *p, int prio) |
9028 | * |
9029 | * tg->weight * grq->load.weight |
9030 | * ge->load.weight = ----------------------------- (1) |
9031 | - * \Sum grq->load.weight |
9032 | + * \Sum grq->load.weight |
9033 | * |
9034 | * Now, because computing that sum is prohibitively expensive to compute (been |
9035 | * there, done that) we approximate it with this average stuff. The average |
9036 | @@ -2941,7 +2941,7 @@ void reweight_task(struct task_struct *p, int prio) |
9037 | * |
9038 | * tg->weight * grq->avg.load_avg |
9039 | * ge->load.weight = ------------------------------ (3) |
9040 | - * tg->load_avg |
9041 | + * tg->load_avg |
9042 | * |
9043 | * Where: tg->load_avg ~= \Sum grq->avg.load_avg |
9044 | * |
9045 | @@ -2957,7 +2957,7 @@ void reweight_task(struct task_struct *p, int prio) |
9046 | * |
9047 | * tg->weight * grq->load.weight |
9048 | * ge->load.weight = ----------------------------- = tg->weight (4) |
9049 | - * grp->load.weight |
9050 | + * grp->load.weight |
9051 | * |
9052 | * That is, the sum collapses because all other CPUs are idle; the UP scenario. |
9053 | * |
9054 | @@ -2976,7 +2976,7 @@ void reweight_task(struct task_struct *p, int prio) |
9055 | * |
9056 | * tg->weight * grq->load.weight |
9057 | * ge->load.weight = ----------------------------- (6) |
9058 | - * tg_load_avg' |
9059 | + * tg_load_avg' |
9060 | * |
9061 | * Where: |
9062 | * |
9063 | diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
9064 | index 5b04bba4500db..2dffb8762e16b 100644 |
9065 | --- a/kernel/sched/rt.c |
9066 | +++ b/kernel/sched/rt.c |
9067 | @@ -2221,13 +2221,20 @@ void __init init_sched_rt_class(void) |
9068 | static void switched_to_rt(struct rq *rq, struct task_struct *p) |
9069 | { |
9070 | /* |
9071 | - * If we are already running, then there's nothing |
9072 | - * that needs to be done. But if we are not running |
9073 | - * we may need to preempt the current running task. |
9074 | - * If that current running task is also an RT task |
9075 | + * If we are running, update the avg_rt tracking, as the running time |
9076 | + * will now on be accounted into the latter. |
9077 | + */ |
9078 | + if (task_current(rq, p)) { |
9079 | + update_rt_rq_load_avg(rq_clock_pelt(rq), rq, 0); |
9080 | + return; |
9081 | + } |
9082 | + |
9083 | + /* |
9084 | + * If we are not running we may need to preempt the current |
9085 | + * running task. If that current running task is also an RT task |
9086 | * then see if we can move to another run queue. |
9087 | */ |
9088 | - if (task_on_rq_queued(p) && rq->curr != p) { |
9089 | + if (task_on_rq_queued(p)) { |
9090 | #ifdef CONFIG_SMP |
9091 | if (p->nr_cpus_allowed > 1 && rq->rt.overloaded) |
9092 | rt_queue_push_tasks(rq); |
9093 | diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c |
9094 | index 428beb69426a8..6863a054c9701 100644 |
9095 | --- a/kernel/time/clocksource.c |
9096 | +++ b/kernel/time/clocksource.c |
9097 | @@ -124,6 +124,13 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating); |
9098 | #define WATCHDOG_INTERVAL (HZ >> 1) |
9099 | #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) |
9100 | |
9101 | +/* |
9102 | + * Maximum permissible delay between two readouts of the watchdog |
9103 | + * clocksource surrounding a read of the clocksource being validated. |
9104 | + * This delay could be due to SMIs, NMIs, or to VCPU preemptions. |
9105 | + */ |
9106 | +#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC) |
9107 | + |
9108 | static void clocksource_watchdog_work(struct work_struct *work) |
9109 | { |
9110 | /* |
9111 | @@ -184,12 +191,45 @@ void clocksource_mark_unstable(struct clocksource *cs) |
9112 | spin_unlock_irqrestore(&watchdog_lock, flags); |
9113 | } |
9114 | |
9115 | +static ulong max_cswd_read_retries = 3; |
9116 | +module_param(max_cswd_read_retries, ulong, 0644); |
9117 | + |
9118 | +static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) |
9119 | +{ |
9120 | + unsigned int nretries; |
9121 | + u64 wd_end, wd_delta; |
9122 | + int64_t wd_delay; |
9123 | + |
9124 | + for (nretries = 0; nretries <= max_cswd_read_retries; nretries++) { |
9125 | + local_irq_disable(); |
9126 | + *wdnow = watchdog->read(watchdog); |
9127 | + *csnow = cs->read(cs); |
9128 | + wd_end = watchdog->read(watchdog); |
9129 | + local_irq_enable(); |
9130 | + |
9131 | + wd_delta = clocksource_delta(wd_end, *wdnow, watchdog->mask); |
9132 | + wd_delay = clocksource_cyc2ns(wd_delta, watchdog->mult, |
9133 | + watchdog->shift); |
9134 | + if (wd_delay <= WATCHDOG_MAX_SKEW) { |
9135 | + if (nretries > 1 || nretries >= max_cswd_read_retries) { |
9136 | + pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n", |
9137 | + smp_processor_id(), watchdog->name, nretries); |
9138 | + } |
9139 | + return true; |
9140 | + } |
9141 | + } |
9142 | + |
9143 | + pr_warn("timekeeping watchdog on CPU%d: %s read-back delay of %lldns, attempt %d, marking unstable\n", |
9144 | + smp_processor_id(), watchdog->name, wd_delay, nretries); |
9145 | + return false; |
9146 | +} |
9147 | + |
9148 | static void clocksource_watchdog(struct timer_list *unused) |
9149 | { |
9150 | - struct clocksource *cs; |
9151 | u64 csnow, wdnow, cslast, wdlast, delta; |
9152 | - int64_t wd_nsec, cs_nsec; |
9153 | int next_cpu, reset_pending; |
9154 | + int64_t wd_nsec, cs_nsec; |
9155 | + struct clocksource *cs; |
9156 | |
9157 | spin_lock(&watchdog_lock); |
9158 | if (!watchdog_running) |
9159 | @@ -206,10 +246,11 @@ static void clocksource_watchdog(struct timer_list *unused) |
9160 | continue; |
9161 | } |
9162 | |
9163 | - local_irq_disable(); |
9164 | - csnow = cs->read(cs); |
9165 | - wdnow = watchdog->read(watchdog); |
9166 | - local_irq_enable(); |
9167 | + if (!cs_watchdog_read(cs, &csnow, &wdnow)) { |
9168 | + /* Clock readout unreliable, so give it up. */ |
9169 | + __clocksource_unstable(cs); |
9170 | + continue; |
9171 | + } |
9172 | |
9173 | /* Clocksource initialized ? */ |
9174 | if (!(cs->flags & CLOCK_SOURCE_WATCHDOG) || |
9175 | diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c |
9176 | index 74c1db7178cff..4d9f818029112 100644 |
9177 | --- a/kernel/trace/bpf_trace.c |
9178 | +++ b/kernel/trace/bpf_trace.c |
9179 | @@ -1397,7 +1397,8 @@ static int __bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog * |
9180 | if (prog->aux->max_tp_access > btp->writable_size) |
9181 | return -EINVAL; |
9182 | |
9183 | - return tracepoint_probe_register(tp, (void *)btp->bpf_func, prog); |
9184 | + return tracepoint_probe_register_may_exist(tp, (void *)btp->bpf_func, |
9185 | + prog); |
9186 | } |
9187 | |
9188 | int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *prog) |
9189 | diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
9190 | index a616b314fb7ab..b05376a01091d 100644 |
9191 | --- a/kernel/trace/trace_events_hist.c |
9192 | +++ b/kernel/trace/trace_events_hist.c |
9193 | @@ -2437,6 +2437,13 @@ static int contains_operator(char *str) |
9194 | |
9195 | switch (*op) { |
9196 | case '-': |
9197 | + /* |
9198 | + * Unfortunately, the modifier ".sym-offset" |
9199 | + * can confuse things. |
9200 | + */ |
9201 | + if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11)) |
9202 | + return FIELD_OP_NONE; |
9203 | + |
9204 | if (*str == '-') |
9205 | field_op = FIELD_OP_UNARY_MINUS; |
9206 | else |
9207 | diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c |
9208 | index be51df4508cbe..5d87b21ba1301 100644 |
9209 | --- a/kernel/tracepoint.c |
9210 | +++ b/kernel/tracepoint.c |
9211 | @@ -271,7 +271,8 @@ static void *func_remove(struct tracepoint_func **funcs, |
9212 | * Add the probe function to a tracepoint. |
9213 | */ |
9214 | static int tracepoint_add_func(struct tracepoint *tp, |
9215 | - struct tracepoint_func *func, int prio) |
9216 | + struct tracepoint_func *func, int prio, |
9217 | + bool warn) |
9218 | { |
9219 | struct tracepoint_func *old, *tp_funcs; |
9220 | int ret; |
9221 | @@ -286,7 +287,7 @@ static int tracepoint_add_func(struct tracepoint *tp, |
9222 | lockdep_is_held(&tracepoints_mutex)); |
9223 | old = func_add(&tp_funcs, func, prio); |
9224 | if (IS_ERR(old)) { |
9225 | - WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM); |
9226 | + WARN_ON_ONCE(warn && PTR_ERR(old) != -ENOMEM); |
9227 | return PTR_ERR(old); |
9228 | } |
9229 | |
9230 | @@ -337,6 +338,32 @@ static int tracepoint_remove_func(struct tracepoint *tp, |
9231 | return 0; |
9232 | } |
9233 | |
9234 | +/** |
9235 | + * tracepoint_probe_register_prio_may_exist - Connect a probe to a tracepoint with priority |
9236 | + * @tp: tracepoint |
9237 | + * @probe: probe handler |
9238 | + * @data: tracepoint data |
9239 | + * @prio: priority of this function over other registered functions |
9240 | + * |
9241 | + * Same as tracepoint_probe_register_prio() except that it will not warn |
9242 | + * if the tracepoint is already registered. |
9243 | + */ |
9244 | +int tracepoint_probe_register_prio_may_exist(struct tracepoint *tp, void *probe, |
9245 | + void *data, int prio) |
9246 | +{ |
9247 | + struct tracepoint_func tp_func; |
9248 | + int ret; |
9249 | + |
9250 | + mutex_lock(&tracepoints_mutex); |
9251 | + tp_func.func = probe; |
9252 | + tp_func.data = data; |
9253 | + tp_func.prio = prio; |
9254 | + ret = tracepoint_add_func(tp, &tp_func, prio, false); |
9255 | + mutex_unlock(&tracepoints_mutex); |
9256 | + return ret; |
9257 | +} |
9258 | +EXPORT_SYMBOL_GPL(tracepoint_probe_register_prio_may_exist); |
9259 | + |
9260 | /** |
9261 | * tracepoint_probe_register_prio - Connect a probe to a tracepoint with priority |
9262 | * @tp: tracepoint |
9263 | @@ -360,7 +387,7 @@ int tracepoint_probe_register_prio(struct tracepoint *tp, void *probe, |
9264 | tp_func.func = probe; |
9265 | tp_func.data = data; |
9266 | tp_func.prio = prio; |
9267 | - ret = tracepoint_add_func(tp, &tp_func, prio); |
9268 | + ret = tracepoint_add_func(tp, &tp_func, prio, true); |
9269 | mutex_unlock(&tracepoints_mutex); |
9270 | return ret; |
9271 | } |
9272 | diff --git a/lib/iov_iter.c b/lib/iov_iter.c |
9273 | index 9ea6f7bb83095..41b06af195368 100644 |
9274 | --- a/lib/iov_iter.c |
9275 | +++ b/lib/iov_iter.c |
9276 | @@ -422,7 +422,7 @@ int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
9277 | int err; |
9278 | struct iovec v; |
9279 | |
9280 | - if (!(i->type & (ITER_BVEC|ITER_KVEC))) { |
9281 | + if (iter_is_iovec(i)) { |
9282 | iterate_iovec(i, bytes, v, iov, skip, ({ |
9283 | err = fault_in_pages_readable(v.iov_base, v.iov_len); |
9284 | if (unlikely(err)) |
9285 | @@ -896,9 +896,12 @@ size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, |
9286 | size_t wanted = copy_to_iter(kaddr + offset, bytes, i); |
9287 | kunmap_atomic(kaddr); |
9288 | return wanted; |
9289 | - } else if (unlikely(iov_iter_is_discard(i))) |
9290 | + } else if (unlikely(iov_iter_is_discard(i))) { |
9291 | + if (unlikely(i->count < bytes)) |
9292 | + bytes = i->count; |
9293 | + i->count -= bytes; |
9294 | return bytes; |
9295 | - else if (likely(!iov_iter_is_pipe(i))) |
9296 | + } else if (likely(!iov_iter_is_pipe(i))) |
9297 | return copy_page_to_iter_iovec(page, offset, bytes, i); |
9298 | else |
9299 | return copy_page_to_iter_pipe(page, offset, bytes, i); |
9300 | diff --git a/lib/kstrtox.c b/lib/kstrtox.c |
9301 | index 1006bf70bf74c..95c7234ad4677 100644 |
9302 | --- a/lib/kstrtox.c |
9303 | +++ b/lib/kstrtox.c |
9304 | @@ -39,20 +39,22 @@ const char *_parse_integer_fixup_radix(const char *s, unsigned int *base) |
9305 | |
9306 | /* |
9307 | * Convert non-negative integer string representation in explicitly given radix |
9308 | - * to an integer. |
9309 | + * to an integer. A maximum of max_chars characters will be converted. |
9310 | + * |
9311 | * Return number of characters consumed maybe or-ed with overflow bit. |
9312 | * If overflow occurs, result integer (incorrect) is still returned. |
9313 | * |
9314 | * Don't you dare use this function. |
9315 | */ |
9316 | -unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p) |
9317 | +unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *p, |
9318 | + size_t max_chars) |
9319 | { |
9320 | unsigned long long res; |
9321 | unsigned int rv; |
9322 | |
9323 | res = 0; |
9324 | rv = 0; |
9325 | - while (1) { |
9326 | + while (max_chars--) { |
9327 | unsigned int c = *s; |
9328 | unsigned int lc = c | 0x20; /* don't tolower() this line */ |
9329 | unsigned int val; |
9330 | @@ -82,6 +84,11 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long |
9331 | return rv; |
9332 | } |
9333 | |
9334 | +unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p) |
9335 | +{ |
9336 | + return _parse_integer_limit(s, base, p, INT_MAX); |
9337 | +} |
9338 | + |
9339 | static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) |
9340 | { |
9341 | unsigned long long _res; |
9342 | diff --git a/lib/kstrtox.h b/lib/kstrtox.h |
9343 | index 3b4637bcd2540..158c400ca8658 100644 |
9344 | --- a/lib/kstrtox.h |
9345 | +++ b/lib/kstrtox.h |
9346 | @@ -4,6 +4,8 @@ |
9347 | |
9348 | #define KSTRTOX_OVERFLOW (1U << 31) |
9349 | const char *_parse_integer_fixup_radix(const char *s, unsigned int *base); |
9350 | +unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *res, |
9351 | + size_t max_chars); |
9352 | unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *res); |
9353 | |
9354 | #endif |
9355 | diff --git a/lib/seq_buf.c b/lib/seq_buf.c |
9356 | index bd807f545a9d7..b15dbb6f061a5 100644 |
9357 | --- a/lib/seq_buf.c |
9358 | +++ b/lib/seq_buf.c |
9359 | @@ -242,12 +242,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, |
9360 | break; |
9361 | |
9362 | /* j increments twice per loop */ |
9363 | - len -= j / 2; |
9364 | hex[j++] = ' '; |
9365 | |
9366 | seq_buf_putmem(s, hex, j); |
9367 | if (seq_buf_has_overflowed(s)) |
9368 | return -1; |
9369 | + |
9370 | + len -= start_len; |
9371 | + data += start_len; |
9372 | } |
9373 | return 0; |
9374 | } |
9375 | diff --git a/lib/vsprintf.c b/lib/vsprintf.c |
9376 | index fb4af73142b42..2766d1b2c301d 100644 |
9377 | --- a/lib/vsprintf.c |
9378 | +++ b/lib/vsprintf.c |
9379 | @@ -50,6 +50,31 @@ |
9380 | #include <linux/string_helpers.h> |
9381 | #include "kstrtox.h" |
9382 | |
9383 | +static unsigned long long simple_strntoull(const char *startp, size_t max_chars, |
9384 | + char **endp, unsigned int base) |
9385 | +{ |
9386 | + const char *cp; |
9387 | + unsigned long long result = 0ULL; |
9388 | + size_t prefix_chars; |
9389 | + unsigned int rv; |
9390 | + |
9391 | + cp = _parse_integer_fixup_radix(startp, &base); |
9392 | + prefix_chars = cp - startp; |
9393 | + if (prefix_chars < max_chars) { |
9394 | + rv = _parse_integer_limit(cp, base, &result, max_chars - prefix_chars); |
9395 | + /* FIXME */ |
9396 | + cp += (rv & ~KSTRTOX_OVERFLOW); |
9397 | + } else { |
9398 | + /* Field too short for prefix + digit, skip over without converting */ |
9399 | + cp = startp + max_chars; |
9400 | + } |
9401 | + |
9402 | + if (endp) |
9403 | + *endp = (char *)cp; |
9404 | + |
9405 | + return result; |
9406 | +} |
9407 | + |
9408 | /** |
9409 | * simple_strtoull - convert a string to an unsigned long long |
9410 | * @cp: The start of the string |
9411 | @@ -60,18 +85,7 @@ |
9412 | */ |
9413 | unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base) |
9414 | { |
9415 | - unsigned long long result; |
9416 | - unsigned int rv; |
9417 | - |
9418 | - cp = _parse_integer_fixup_radix(cp, &base); |
9419 | - rv = _parse_integer(cp, base, &result); |
9420 | - /* FIXME */ |
9421 | - cp += (rv & ~KSTRTOX_OVERFLOW); |
9422 | - |
9423 | - if (endp) |
9424 | - *endp = (char *)cp; |
9425 | - |
9426 | - return result; |
9427 | + return simple_strntoull(cp, INT_MAX, endp, base); |
9428 | } |
9429 | EXPORT_SYMBOL(simple_strtoull); |
9430 | |
9431 | @@ -106,6 +120,21 @@ long simple_strtol(const char *cp, char **endp, unsigned int base) |
9432 | } |
9433 | EXPORT_SYMBOL(simple_strtol); |
9434 | |
9435 | +static long long simple_strntoll(const char *cp, size_t max_chars, char **endp, |
9436 | + unsigned int base) |
9437 | +{ |
9438 | + /* |
9439 | + * simple_strntoull() safely handles receiving max_chars==0 in the |
9440 | + * case cp[0] == '-' && max_chars == 1. |
9441 | + * If max_chars == 0 we can drop through and pass it to simple_strntoull() |
9442 | + * and the content of *cp is irrelevant. |
9443 | + */ |
9444 | + if (*cp == '-' && max_chars > 0) |
9445 | + return -simple_strntoull(cp + 1, max_chars - 1, endp, base); |
9446 | + |
9447 | + return simple_strntoull(cp, max_chars, endp, base); |
9448 | +} |
9449 | + |
9450 | /** |
9451 | * simple_strtoll - convert a string to a signed long long |
9452 | * @cp: The start of the string |
9453 | @@ -116,10 +145,7 @@ EXPORT_SYMBOL(simple_strtol); |
9454 | */ |
9455 | long long simple_strtoll(const char *cp, char **endp, unsigned int base) |
9456 | { |
9457 | - if (*cp == '-') |
9458 | - return -simple_strtoull(cp + 1, endp, base); |
9459 | - |
9460 | - return simple_strtoull(cp, endp, base); |
9461 | + return simple_strntoll(cp, INT_MAX, endp, base); |
9462 | } |
9463 | EXPORT_SYMBOL(simple_strtoll); |
9464 | |
9465 | @@ -3343,25 +3369,13 @@ int vsscanf(const char *buf, const char *fmt, va_list args) |
9466 | break; |
9467 | |
9468 | if (is_sign) |
9469 | - val.s = qualifier != 'L' ? |
9470 | - simple_strtol(str, &next, base) : |
9471 | - simple_strtoll(str, &next, base); |
9472 | + val.s = simple_strntoll(str, |
9473 | + field_width >= 0 ? field_width : INT_MAX, |
9474 | + &next, base); |
9475 | else |
9476 | - val.u = qualifier != 'L' ? |
9477 | - simple_strtoul(str, &next, base) : |
9478 | - simple_strtoull(str, &next, base); |
9479 | - |
9480 | - if (field_width > 0 && next - str > field_width) { |
9481 | - if (base == 0) |
9482 | - _parse_integer_fixup_radix(str, &base); |
9483 | - while (next - str > field_width) { |
9484 | - if (is_sign) |
9485 | - val.s = div_s64(val.s, base); |
9486 | - else |
9487 | - val.u = div_u64(val.u, base); |
9488 | - --next; |
9489 | - } |
9490 | - } |
9491 | + val.u = simple_strntoull(str, |
9492 | + field_width >= 0 ? field_width : INT_MAX, |
9493 | + &next, base); |
9494 | |
9495 | switch (qualifier) { |
9496 | case 'H': /* that's 'hh' in format */ |
9497 | diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
9498 | index 87a07aa61be0d..e50799d7002e5 100644 |
9499 | --- a/mm/huge_memory.c |
9500 | +++ b/mm/huge_memory.c |
9501 | @@ -1723,7 +1723,7 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, |
9502 | * If other processes are mapping this page, we couldn't discard |
9503 | * the page unless they all do MADV_FREE so let's skip the page. |
9504 | */ |
9505 | - if (page_mapcount(page) != 1) |
9506 | + if (total_mapcount(page) != 1) |
9507 | goto out; |
9508 | |
9509 | if (!trylock_page(page)) |
9510 | diff --git a/mm/z3fold.c b/mm/z3fold.c |
9511 | index 6d3d3f698ebb9..e97143713021e 100644 |
9512 | --- a/mm/z3fold.c |
9513 | +++ b/mm/z3fold.c |
9514 | @@ -839,6 +839,7 @@ static void z3fold_destroy_pool(struct z3fold_pool *pool) |
9515 | destroy_workqueue(pool->compact_wq); |
9516 | destroy_workqueue(pool->release_wq); |
9517 | z3fold_unregister_migration(pool); |
9518 | + free_percpu(pool->unbuddied); |
9519 | kfree(pool); |
9520 | } |
9521 | |
9522 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
9523 | index bd678ffdaef73..e8e7f108b0161 100644 |
9524 | --- a/net/bluetooth/hci_event.c |
9525 | +++ b/net/bluetooth/hci_event.c |
9526 | @@ -5101,8 +5101,19 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb) |
9527 | |
9528 | BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); |
9529 | |
9530 | - if (ev->status) |
9531 | + if (ev->status) { |
9532 | + struct adv_info *adv; |
9533 | + |
9534 | + adv = hci_find_adv_instance(hdev, ev->handle); |
9535 | + if (!adv) |
9536 | + return; |
9537 | + |
9538 | + /* Remove advertising as it has been terminated */ |
9539 | + hci_remove_adv_instance(hdev, ev->handle); |
9540 | + mgmt_advertising_removed(NULL, hdev, ev->handle); |
9541 | + |
9542 | return; |
9543 | + } |
9544 | |
9545 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle)); |
9546 | if (conn) { |
9547 | diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c |
9548 | index 5fce559a61bf5..db525321da1f8 100644 |
9549 | --- a/net/bluetooth/mgmt.c |
9550 | +++ b/net/bluetooth/mgmt.c |
9551 | @@ -6461,6 +6461,9 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data, |
9552 | for (i = 0, cur_len = 0; i < len; i += (cur_len + 1)) { |
9553 | cur_len = data[i]; |
9554 | |
9555 | + if (!cur_len) |
9556 | + continue; |
9557 | + |
9558 | if (data[i + 1] == EIR_FLAGS && |
9559 | (!is_adv_data || flags_managed(adv_flags))) |
9560 | return false; |
9561 | diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c |
9562 | index 05e1cfc1e5cd1..291a925462463 100644 |
9563 | --- a/net/bpfilter/main.c |
9564 | +++ b/net/bpfilter/main.c |
9565 | @@ -57,7 +57,7 @@ int main(void) |
9566 | { |
9567 | debug_f = fopen("/dev/kmsg", "w"); |
9568 | setvbuf(debug_f, 0, _IOLBF, 0); |
9569 | - fprintf(debug_f, "Started bpfilter\n"); |
9570 | + fprintf(debug_f, "<5>Started bpfilter\n"); |
9571 | loop(); |
9572 | fclose(debug_f); |
9573 | return 0; |
9574 | diff --git a/net/can/bcm.c b/net/can/bcm.c |
9575 | index a7abced793765..1e17778d5ceeb 100644 |
9576 | --- a/net/can/bcm.c |
9577 | +++ b/net/can/bcm.c |
9578 | @@ -787,6 +787,7 @@ static int bcm_delete_rx_op(struct list_head *ops, struct bcm_msg_head *mh, |
9579 | bcm_rx_handler, op); |
9580 | |
9581 | list_del(&op->list); |
9582 | + synchronize_rcu(); |
9583 | bcm_remove_op(op); |
9584 | return 1; /* done */ |
9585 | } |
9586 | @@ -1535,9 +1536,13 @@ static int bcm_release(struct socket *sock) |
9587 | REGMASK(op->can_id), |
9588 | bcm_rx_handler, op); |
9589 | |
9590 | - bcm_remove_op(op); |
9591 | } |
9592 | |
9593 | + synchronize_rcu(); |
9594 | + |
9595 | + list_for_each_entry_safe(op, next, &bo->rx_ops, list) |
9596 | + bcm_remove_op(op); |
9597 | + |
9598 | #if IS_ENABLED(CONFIG_PROC_FS) |
9599 | /* remove procfs entry */ |
9600 | if (net->can.bcmproc_dir && bo->bcm_proc_read) |
9601 | diff --git a/net/can/gw.c b/net/can/gw.c |
9602 | index 65d60c93af294..ac2a5f11a7668 100644 |
9603 | --- a/net/can/gw.c |
9604 | +++ b/net/can/gw.c |
9605 | @@ -535,6 +535,7 @@ static int cgw_notifier(struct notifier_block *nb, |
9606 | if (gwj->src.dev == dev || gwj->dst.dev == dev) { |
9607 | hlist_del(&gwj->list); |
9608 | cgw_unregister_filter(net, gwj); |
9609 | + synchronize_rcu(); |
9610 | kmem_cache_free(cgw_cache, gwj); |
9611 | } |
9612 | } |
9613 | @@ -1093,6 +1094,7 @@ static void cgw_remove_all_jobs(struct net *net) |
9614 | hlist_for_each_entry_safe(gwj, nx, &net->can.cgw_list, list) { |
9615 | hlist_del(&gwj->list); |
9616 | cgw_unregister_filter(net, gwj); |
9617 | + synchronize_rcu(); |
9618 | kmem_cache_free(cgw_cache, gwj); |
9619 | } |
9620 | } |
9621 | @@ -1161,6 +1163,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, |
9622 | |
9623 | hlist_del(&gwj->list); |
9624 | cgw_unregister_filter(net, gwj); |
9625 | + synchronize_rcu(); |
9626 | kmem_cache_free(cgw_cache, gwj); |
9627 | err = 0; |
9628 | break; |
9629 | diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c |
9630 | index e52330f628c9f..6884d18f919c7 100644 |
9631 | --- a/net/can/j1939/main.c |
9632 | +++ b/net/can/j1939/main.c |
9633 | @@ -193,6 +193,10 @@ static void j1939_can_rx_unregister(struct j1939_priv *priv) |
9634 | can_rx_unregister(dev_net(ndev), ndev, J1939_CAN_ID, J1939_CAN_MASK, |
9635 | j1939_can_recv, priv); |
9636 | |
9637 | + /* The last reference of priv is dropped by the RCU deferred |
9638 | + * j1939_sk_sock_destruct() of the last socket, so we can |
9639 | + * safely drop this reference here. |
9640 | + */ |
9641 | j1939_priv_put(priv); |
9642 | } |
9643 | |
9644 | diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c |
9645 | index d57475c8ba07f..51bfb220fad85 100644 |
9646 | --- a/net/can/j1939/socket.c |
9647 | +++ b/net/can/j1939/socket.c |
9648 | @@ -398,6 +398,9 @@ static int j1939_sk_init(struct sock *sk) |
9649 | atomic_set(&jsk->skb_pending, 0); |
9650 | spin_lock_init(&jsk->sk_session_queue_lock); |
9651 | INIT_LIST_HEAD(&jsk->sk_session_queue); |
9652 | + |
9653 | + /* j1939_sk_sock_destruct() depends on SOCK_RCU_FREE flag */ |
9654 | + sock_set_flag(sk, SOCK_RCU_FREE); |
9655 | sk->sk_destruct = j1939_sk_sock_destruct; |
9656 | sk->sk_protocol = CAN_J1939; |
9657 | |
9658 | diff --git a/net/core/filter.c b/net/core/filter.c |
9659 | index 108bcf6000529..0e161a6dff7e5 100644 |
9660 | --- a/net/core/filter.c |
9661 | +++ b/net/core/filter.c |
9662 | @@ -2861,8 +2861,6 @@ static int bpf_skb_proto_4_to_6(struct sk_buff *skb) |
9663 | shinfo->gso_type |= SKB_GSO_TCPV6; |
9664 | } |
9665 | |
9666 | - /* Due to IPv6 header, MSS needs to be downgraded. */ |
9667 | - skb_decrease_gso_size(shinfo, len_diff); |
9668 | /* Header must be checked, and gso_segs recomputed. */ |
9669 | shinfo->gso_type |= SKB_GSO_DODGY; |
9670 | shinfo->gso_segs = 0; |
9671 | @@ -2902,8 +2900,6 @@ static int bpf_skb_proto_6_to_4(struct sk_buff *skb) |
9672 | shinfo->gso_type |= SKB_GSO_TCPV4; |
9673 | } |
9674 | |
9675 | - /* Due to IPv4 header, MSS can be upgraded. */ |
9676 | - skb_increase_gso_size(shinfo, len_diff); |
9677 | /* Header must be checked, and gso_segs recomputed. */ |
9678 | shinfo->gso_type |= SKB_GSO_DODGY; |
9679 | shinfo->gso_segs = 0; |
9680 | diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c |
9681 | index 00210e55b4cd1..86c836fa21459 100644 |
9682 | --- a/net/ipv4/esp4.c |
9683 | +++ b/net/ipv4/esp4.c |
9684 | @@ -499,7 +499,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
9685 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); |
9686 | u32 padto; |
9687 | |
9688 | - padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); |
9689 | + padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached)); |
9690 | if (skb->len < padto) |
9691 | esp.tfclen = padto - skb->len; |
9692 | } |
9693 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
9694 | index 2ce191019526e..b875b98820ede 100644 |
9695 | --- a/net/ipv4/fib_frontend.c |
9696 | +++ b/net/ipv4/fib_frontend.c |
9697 | @@ -381,6 +381,8 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, |
9698 | fl4.flowi4_proto = 0; |
9699 | fl4.fl4_sport = 0; |
9700 | fl4.fl4_dport = 0; |
9701 | + } else { |
9702 | + swap(fl4.fl4_sport, fl4.fl4_dport); |
9703 | } |
9704 | |
9705 | if (fib_lookup(net, &fl4, &res, 0)) |
9706 | diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
9707 | index 3ff702380b629..0e976848d4bb9 100644 |
9708 | --- a/net/ipv4/route.c |
9709 | +++ b/net/ipv4/route.c |
9710 | @@ -1321,7 +1321,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) |
9711 | mtu = dst_metric_raw(dst, RTAX_MTU); |
9712 | |
9713 | if (mtu) |
9714 | - return mtu; |
9715 | + goto out; |
9716 | |
9717 | mtu = READ_ONCE(dst->dev->mtu); |
9718 | |
9719 | @@ -1330,6 +1330,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) |
9720 | mtu = 576; |
9721 | } |
9722 | |
9723 | +out: |
9724 | mtu = min_t(unsigned int, mtu, IP_MAX_MTU); |
9725 | |
9726 | return mtu - lwtunnel_headroom(dst->lwtstate, mtu); |
9727 | diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c |
9728 | index 7a739f16d82b2..12570a73def80 100644 |
9729 | --- a/net/ipv6/esp6.c |
9730 | +++ b/net/ipv6/esp6.c |
9731 | @@ -440,7 +440,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) |
9732 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); |
9733 | u32 padto; |
9734 | |
9735 | - padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); |
9736 | + padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached)); |
9737 | if (skb->len < padto) |
9738 | esp.tfclen = padto - skb->len; |
9739 | } |
9740 | diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c |
9741 | index ab5add0fe6b49..69128000bc31b 100644 |
9742 | --- a/net/ipv6/exthdrs.c |
9743 | +++ b/net/ipv6/exthdrs.c |
9744 | @@ -134,18 +134,23 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, |
9745 | len -= 2; |
9746 | |
9747 | while (len > 0) { |
9748 | - int optlen = nh[off + 1] + 2; |
9749 | - int i; |
9750 | + int optlen, i; |
9751 | |
9752 | - switch (nh[off]) { |
9753 | - case IPV6_TLV_PAD1: |
9754 | - optlen = 1; |
9755 | + if (nh[off] == IPV6_TLV_PAD1) { |
9756 | padlen++; |
9757 | if (padlen > 7) |
9758 | goto bad; |
9759 | - break; |
9760 | + off++; |
9761 | + len--; |
9762 | + continue; |
9763 | + } |
9764 | + if (len < 2) |
9765 | + goto bad; |
9766 | + optlen = nh[off + 1] + 2; |
9767 | + if (optlen > len) |
9768 | + goto bad; |
9769 | |
9770 | - case IPV6_TLV_PADN: |
9771 | + if (nh[off] == IPV6_TLV_PADN) { |
9772 | /* RFC 2460 states that the purpose of PadN is |
9773 | * to align the containing header to multiples |
9774 | * of 8. 7 is therefore the highest valid value. |
9775 | @@ -162,12 +167,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, |
9776 | if (nh[off + i] != 0) |
9777 | goto bad; |
9778 | } |
9779 | - break; |
9780 | - |
9781 | - default: /* Other TLV code so scan list */ |
9782 | - if (optlen > len) |
9783 | - goto bad; |
9784 | - |
9785 | + } else { |
9786 | tlv_count++; |
9787 | if (tlv_count > max_count) |
9788 | goto bad; |
9789 | @@ -187,7 +187,6 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, |
9790 | return false; |
9791 | |
9792 | padlen = 0; |
9793 | - break; |
9794 | } |
9795 | off += optlen; |
9796 | len -= optlen; |
9797 | @@ -305,7 +304,7 @@ fail_and_free: |
9798 | #endif |
9799 | |
9800 | if (ip6_parse_tlv(tlvprocdestopt_lst, skb, |
9801 | - init_net.ipv6.sysctl.max_dst_opts_cnt)) { |
9802 | + net->ipv6.sysctl.max_dst_opts_cnt)) { |
9803 | skb->transport_header += extlen; |
9804 | opt = IP6CB(skb); |
9805 | #if IS_ENABLED(CONFIG_IPV6_MIP6) |
9806 | @@ -844,7 +843,7 @@ fail_and_free: |
9807 | |
9808 | opt->flags |= IP6SKB_HOPBYHOP; |
9809 | if (ip6_parse_tlv(tlvprochopopt_lst, skb, |
9810 | - init_net.ipv6.sysctl.max_hbh_opts_cnt)) { |
9811 | + net->ipv6.sysctl.max_hbh_opts_cnt)) { |
9812 | skb->transport_header += extlen; |
9813 | opt = IP6CB(skb); |
9814 | opt->nhoff = sizeof(struct ipv6hdr); |
9815 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
9816 | index 44fd922cc32af..ccaf2389ccc1d 100644 |
9817 | --- a/net/mac80211/mlme.c |
9818 | +++ b/net/mac80211/mlme.c |
9819 | @@ -1014,11 +1014,6 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local, |
9820 | struct ieee80211_hdr_3addr *nullfunc; |
9821 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
9822 | |
9823 | - /* Don't send NDPs when STA is connected HE */ |
9824 | - if (sdata->vif.type == NL80211_IFTYPE_STATION && |
9825 | - !(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) |
9826 | - return; |
9827 | - |
9828 | skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif, |
9829 | !ieee80211_hw_check(&local->hw, DOESNT_SUPPORT_QOS_NDP)); |
9830 | if (!skb) |
9831 | @@ -1050,10 +1045,6 @@ static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, |
9832 | if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) |
9833 | return; |
9834 | |
9835 | - /* Don't send NDPs when connected HE */ |
9836 | - if (!(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE)) |
9837 | - return; |
9838 | - |
9839 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); |
9840 | if (!skb) |
9841 | return; |
9842 | diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
9843 | index 82a1dd7b7d689..7b2e8c890381a 100644 |
9844 | --- a/net/mac80211/sta_info.c |
9845 | +++ b/net/mac80211/sta_info.c |
9846 | @@ -1395,11 +1395,6 @@ static void ieee80211_send_null_response(struct sta_info *sta, int tid, |
9847 | struct ieee80211_tx_info *info; |
9848 | struct ieee80211_chanctx_conf *chanctx_conf; |
9849 | |
9850 | - /* Don't send NDPs when STA is connected HE */ |
9851 | - if (sdata->vif.type == NL80211_IFTYPE_STATION && |
9852 | - !(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE)) |
9853 | - return; |
9854 | - |
9855 | if (qos) { |
9856 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | |
9857 | IEEE80211_STYPE_QOS_NULLFUNC | |
9858 | diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c |
9859 | index 427d77b111b17..00f4323cfeb87 100644 |
9860 | --- a/net/netfilter/nft_exthdr.c |
9861 | +++ b/net/netfilter/nft_exthdr.c |
9862 | @@ -42,6 +42,9 @@ static void nft_exthdr_ipv6_eval(const struct nft_expr *expr, |
9863 | unsigned int offset = 0; |
9864 | int err; |
9865 | |
9866 | + if (pkt->skb->protocol != htons(ETH_P_IPV6)) |
9867 | + goto err; |
9868 | + |
9869 | err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL); |
9870 | if (priv->flags & NFT_EXTHDR_F_PRESENT) { |
9871 | nft_reg_store8(dest, err >= 0); |
9872 | diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c |
9873 | index b42247aa48a9e..4911f8eb394ff 100644 |
9874 | --- a/net/netfilter/nft_osf.c |
9875 | +++ b/net/netfilter/nft_osf.c |
9876 | @@ -28,6 +28,11 @@ static void nft_osf_eval(const struct nft_expr *expr, struct nft_regs *regs, |
9877 | struct nf_osf_data data; |
9878 | struct tcphdr _tcph; |
9879 | |
9880 | + if (pkt->tprot != IPPROTO_TCP) { |
9881 | + regs->verdict.code = NFT_BREAK; |
9882 | + return; |
9883 | + } |
9884 | + |
9885 | tcp = skb_header_pointer(skb, ip_hdrlen(skb), |
9886 | sizeof(struct tcphdr), &_tcph); |
9887 | if (!tcp) { |
9888 | diff --git a/net/netfilter/nft_tproxy.c b/net/netfilter/nft_tproxy.c |
9889 | index 95980154ef02c..b97ab1198b03f 100644 |
9890 | --- a/net/netfilter/nft_tproxy.c |
9891 | +++ b/net/netfilter/nft_tproxy.c |
9892 | @@ -30,6 +30,12 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr, |
9893 | __be16 tport = 0; |
9894 | struct sock *sk; |
9895 | |
9896 | + if (pkt->tprot != IPPROTO_TCP && |
9897 | + pkt->tprot != IPPROTO_UDP) { |
9898 | + regs->verdict.code = NFT_BREAK; |
9899 | + return; |
9900 | + } |
9901 | + |
9902 | hp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_hdr), &_hdr); |
9903 | if (!hp) { |
9904 | regs->verdict.code = NFT_BREAK; |
9905 | @@ -91,7 +97,8 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr, |
9906 | |
9907 | memset(&taddr, 0, sizeof(taddr)); |
9908 | |
9909 | - if (!pkt->tprot_set) { |
9910 | + if (pkt->tprot != IPPROTO_TCP && |
9911 | + pkt->tprot != IPPROTO_UDP) { |
9912 | regs->verdict.code = NFT_BREAK; |
9913 | return; |
9914 | } |
9915 | diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c |
9916 | index e7a25fbfaf8b4..a92ed37d09226 100644 |
9917 | --- a/net/netlabel/netlabel_mgmt.c |
9918 | +++ b/net/netlabel/netlabel_mgmt.c |
9919 | @@ -76,6 +76,7 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = { |
9920 | static int netlbl_mgmt_add_common(struct genl_info *info, |
9921 | struct netlbl_audit *audit_info) |
9922 | { |
9923 | + void *pmap = NULL; |
9924 | int ret_val = -EINVAL; |
9925 | struct netlbl_domaddr_map *addrmap = NULL; |
9926 | struct cipso_v4_doi *cipsov4 = NULL; |
9927 | @@ -175,6 +176,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, |
9928 | ret_val = -ENOMEM; |
9929 | goto add_free_addrmap; |
9930 | } |
9931 | + pmap = map; |
9932 | map->list.addr = addr->s_addr & mask->s_addr; |
9933 | map->list.mask = mask->s_addr; |
9934 | map->list.valid = 1; |
9935 | @@ -183,10 +185,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, |
9936 | map->def.cipso = cipsov4; |
9937 | |
9938 | ret_val = netlbl_af4list_add(&map->list, &addrmap->list4); |
9939 | - if (ret_val != 0) { |
9940 | - kfree(map); |
9941 | - goto add_free_addrmap; |
9942 | - } |
9943 | + if (ret_val != 0) |
9944 | + goto add_free_map; |
9945 | |
9946 | entry->family = AF_INET; |
9947 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
9948 | @@ -223,6 +223,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, |
9949 | ret_val = -ENOMEM; |
9950 | goto add_free_addrmap; |
9951 | } |
9952 | + pmap = map; |
9953 | map->list.addr = *addr; |
9954 | map->list.addr.s6_addr32[0] &= mask->s6_addr32[0]; |
9955 | map->list.addr.s6_addr32[1] &= mask->s6_addr32[1]; |
9956 | @@ -235,10 +236,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, |
9957 | map->def.calipso = calipso; |
9958 | |
9959 | ret_val = netlbl_af6list_add(&map->list, &addrmap->list6); |
9960 | - if (ret_val != 0) { |
9961 | - kfree(map); |
9962 | - goto add_free_addrmap; |
9963 | - } |
9964 | + if (ret_val != 0) |
9965 | + goto add_free_map; |
9966 | |
9967 | entry->family = AF_INET6; |
9968 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
9969 | @@ -248,10 +247,12 @@ static int netlbl_mgmt_add_common(struct genl_info *info, |
9970 | |
9971 | ret_val = netlbl_domhsh_add(entry, audit_info); |
9972 | if (ret_val != 0) |
9973 | - goto add_free_addrmap; |
9974 | + goto add_free_map; |
9975 | |
9976 | return 0; |
9977 | |
9978 | +add_free_map: |
9979 | + kfree(pmap); |
9980 | add_free_addrmap: |
9981 | kfree(addrmap); |
9982 | add_doi_put_def: |
9983 | diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c |
9984 | index 3c26042f4ea6d..7dc76c68ec52d 100644 |
9985 | --- a/net/sched/act_vlan.c |
9986 | +++ b/net/sched/act_vlan.c |
9987 | @@ -70,7 +70,7 @@ static int tcf_vlan_act(struct sk_buff *skb, const struct tc_action *a, |
9988 | /* replace the vid */ |
9989 | tci = (tci & ~VLAN_VID_MASK) | p->tcfv_push_vid; |
9990 | /* replace prio bits, if tcfv_push_prio specified */ |
9991 | - if (p->tcfv_push_prio) { |
9992 | + if (p->tcfv_push_prio_exists) { |
9993 | tci &= ~VLAN_PRIO_MASK; |
9994 | tci |= p->tcfv_push_prio << VLAN_PRIO_SHIFT; |
9995 | } |
9996 | @@ -107,6 +107,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, |
9997 | struct tc_action_net *tn = net_generic(net, vlan_net_id); |
9998 | struct nlattr *tb[TCA_VLAN_MAX + 1]; |
9999 | struct tcf_chain *goto_ch = NULL; |
10000 | + bool push_prio_exists = false; |
10001 | struct tcf_vlan_params *p; |
10002 | struct tc_vlan *parm; |
10003 | struct tcf_vlan *v; |
10004 | @@ -175,7 +176,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, |
10005 | push_proto = htons(ETH_P_8021Q); |
10006 | } |
10007 | |
10008 | - if (tb[TCA_VLAN_PUSH_VLAN_PRIORITY]) |
10009 | + push_prio_exists = !!tb[TCA_VLAN_PUSH_VLAN_PRIORITY]; |
10010 | + if (push_prio_exists) |
10011 | push_prio = nla_get_u8(tb[TCA_VLAN_PUSH_VLAN_PRIORITY]); |
10012 | break; |
10013 | default: |
10014 | @@ -216,6 +218,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, |
10015 | p->tcfv_action = action; |
10016 | p->tcfv_push_vid = push_vid; |
10017 | p->tcfv_push_prio = push_prio; |
10018 | + p->tcfv_push_prio_exists = push_prio_exists || action == TCA_VLAN_ACT_PUSH; |
10019 | p->tcfv_push_proto = push_proto; |
10020 | |
10021 | spin_lock_bh(&v->tcf_lock); |
10022 | diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c |
10023 | index c9399e81c5059..3e81f87d0c89f 100644 |
10024 | --- a/net/sched/cls_tcindex.c |
10025 | +++ b/net/sched/cls_tcindex.c |
10026 | @@ -304,7 +304,7 @@ static int tcindex_alloc_perfect_hash(struct net *net, struct tcindex_data *cp) |
10027 | int i, err = 0; |
10028 | |
10029 | cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result), |
10030 | - GFP_KERNEL); |
10031 | + GFP_KERNEL | __GFP_NOWARN); |
10032 | if (!cp->perfect) |
10033 | return -ENOMEM; |
10034 | |
10035 | diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c |
10036 | index 0b05ac7c848eb..b046fd3cac2cf 100644 |
10037 | --- a/net/sched/sch_qfq.c |
10038 | +++ b/net/sched/sch_qfq.c |
10039 | @@ -485,11 +485,6 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, |
10040 | |
10041 | if (cl->qdisc != &noop_qdisc) |
10042 | qdisc_hash_add(cl->qdisc, true); |
10043 | - sch_tree_lock(sch); |
10044 | - qdisc_class_hash_insert(&q->clhash, &cl->common); |
10045 | - sch_tree_unlock(sch); |
10046 | - |
10047 | - qdisc_class_hash_grow(sch, &q->clhash); |
10048 | |
10049 | set_change_agg: |
10050 | sch_tree_lock(sch); |
10051 | @@ -507,8 +502,11 @@ set_change_agg: |
10052 | } |
10053 | if (existing) |
10054 | qfq_deact_rm_from_agg(q, cl); |
10055 | + else |
10056 | + qdisc_class_hash_insert(&q->clhash, &cl->common); |
10057 | qfq_add_to_agg(q, new_agg, cl); |
10058 | sch_tree_unlock(sch); |
10059 | + qdisc_class_hash_grow(sch, &q->clhash); |
10060 | |
10061 | *arg = (unsigned long)cl; |
10062 | return 0; |
10063 | diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
10064 | index 4beb6d2957c33..8fc4a6b3422f4 100644 |
10065 | --- a/net/sunrpc/sched.c |
10066 | +++ b/net/sunrpc/sched.c |
10067 | @@ -613,11 +613,21 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q |
10068 | struct list_head *q; |
10069 | struct rpc_task *task; |
10070 | |
10071 | + /* |
10072 | + * Service the privileged queue. |
10073 | + */ |
10074 | + q = &queue->tasks[RPC_NR_PRIORITY - 1]; |
10075 | + if (queue->maxpriority > RPC_PRIORITY_PRIVILEGED && !list_empty(q)) { |
10076 | + task = list_first_entry(q, struct rpc_task, u.tk_wait.list); |
10077 | + goto out; |
10078 | + } |
10079 | + |
10080 | /* |
10081 | * Service a batch of tasks from a single owner. |
10082 | */ |
10083 | q = &queue->tasks[queue->priority]; |
10084 | - if (!list_empty(q) && --queue->nr) { |
10085 | + if (!list_empty(q) && queue->nr) { |
10086 | + queue->nr--; |
10087 | task = list_first_entry(q, struct rpc_task, u.tk_wait.list); |
10088 | goto out; |
10089 | } |
10090 | diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c |
10091 | index cdb65aa54be70..7fb5c067f4293 100644 |
10092 | --- a/net/tls/tls_sw.c |
10093 | +++ b/net/tls/tls_sw.c |
10094 | @@ -1150,7 +1150,7 @@ static int tls_sw_do_sendpage(struct sock *sk, struct page *page, |
10095 | int ret = 0; |
10096 | bool eor; |
10097 | |
10098 | - eor = !(flags & (MSG_MORE | MSG_SENDPAGE_NOTLAST)); |
10099 | + eor = !(flags & MSG_SENDPAGE_NOTLAST); |
10100 | sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); |
10101 | |
10102 | /* Call the sk_stream functions to manage the sndbuf mem. */ |
10103 | diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
10104 | index 1423e2b7cb42a..c6b2c99b501b9 100644 |
10105 | --- a/net/xfrm/xfrm_state.c |
10106 | +++ b/net/xfrm/xfrm_state.c |
10107 | @@ -2440,7 +2440,7 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x) |
10108 | } |
10109 | EXPORT_SYMBOL(xfrm_state_delete_tunnel); |
10110 | |
10111 | -u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) |
10112 | +u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu) |
10113 | { |
10114 | const struct xfrm_type *type = READ_ONCE(x->type); |
10115 | struct crypto_aead *aead; |
10116 | @@ -2471,7 +2471,17 @@ u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) |
10117 | return ((mtu - x->props.header_len - crypto_aead_authsize(aead) - |
10118 | net_adj) & ~(blksize - 1)) + net_adj - 2; |
10119 | } |
10120 | -EXPORT_SYMBOL_GPL(xfrm_state_mtu); |
10121 | +EXPORT_SYMBOL_GPL(__xfrm_state_mtu); |
10122 | + |
10123 | +u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) |
10124 | +{ |
10125 | + mtu = __xfrm_state_mtu(x, mtu); |
10126 | + |
10127 | + if (x->props.family == AF_INET6 && mtu < IPV6_MIN_MTU) |
10128 | + return IPV6_MIN_MTU; |
10129 | + |
10130 | + return mtu; |
10131 | +} |
10132 | |
10133 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload) |
10134 | { |
10135 | diff --git a/samples/bpf/xdp_redirect_user.c b/samples/bpf/xdp_redirect_user.c |
10136 | index 5440cd620607f..b7bc2a339d77c 100644 |
10137 | --- a/samples/bpf/xdp_redirect_user.c |
10138 | +++ b/samples/bpf/xdp_redirect_user.c |
10139 | @@ -216,5 +216,5 @@ int main(int argc, char **argv) |
10140 | poll_stats(2, ifindex_out); |
10141 | |
10142 | out: |
10143 | - return 0; |
10144 | + return ret; |
10145 | } |
10146 | diff --git a/scripts/Makefile.build b/scripts/Makefile.build |
10147 | index 9c689d011bced..1261f75cb4e77 100644 |
10148 | --- a/scripts/Makefile.build |
10149 | +++ b/scripts/Makefile.build |
10150 | @@ -240,9 +240,9 @@ undefined_syms = $(NM) $< | $(AWK) '$$1 == "U" { printf("%s%s", x++ ? " " : "", |
10151 | endif |
10152 | |
10153 | define rule_cc_o_c |
10154 | - $(call cmd,checksrc) |
10155 | $(call cmd_and_fixdep,cc_o_c) |
10156 | $(call cmd,gen_ksymdeps) |
10157 | + $(call cmd,checksrc) |
10158 | $(call cmd,checkdoc) |
10159 | $(call cmd,objtool) |
10160 | $(call cmd,modversions_c) |
10161 | @@ -257,9 +257,10 @@ define rule_as_o_S |
10162 | endef |
10163 | |
10164 | # Built-in and composite module parts |
10165 | -$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE |
10166 | - $(call cmd,force_checksrc) |
10167 | +.SECONDEXPANSION: |
10168 | +$(obj)/%.o: $(src)/%.c $(recordmcount_source) $$(objtool_dep) FORCE |
10169 | $(call if_changed_rule,cc_o_c) |
10170 | + $(call cmd,force_checksrc) |
10171 | |
10172 | cmd_mod = { \ |
10173 | echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ |
10174 | @@ -340,7 +341,7 @@ cmd_modversions_S = \ |
10175 | fi |
10176 | endif |
10177 | |
10178 | -$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE |
10179 | +$(obj)/%.o: $(src)/%.S $$(objtool_dep) FORCE |
10180 | $(call if_changed_rule,as_o_S) |
10181 | |
10182 | targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) |
10183 | diff --git a/scripts/tools-support-relr.sh b/scripts/tools-support-relr.sh |
10184 | index 45e8aa360b457..cb55878bd5b81 100755 |
10185 | --- a/scripts/tools-support-relr.sh |
10186 | +++ b/scripts/tools-support-relr.sh |
10187 | @@ -7,7 +7,8 @@ trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT |
10188 | cat << "END" | $CC -c -x c - -o $tmp_file.o >/dev/null 2>&1 |
10189 | void *p = &p; |
10190 | END |
10191 | -$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr -o $tmp_file |
10192 | +$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr \ |
10193 | + --use-android-relr-tags -o $tmp_file |
10194 | |
10195 | # Despite printing an error message, GNU nm still exits with exit code 0 if it |
10196 | # sees a relr section. So we need to check that nothing is printed to stderr. |
10197 | diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c |
10198 | index 615094eda36d6..81e3245aec86c 100644 |
10199 | --- a/security/integrity/evm/evm_main.c |
10200 | +++ b/security/integrity/evm/evm_main.c |
10201 | @@ -520,7 +520,7 @@ void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) |
10202 | } |
10203 | |
10204 | /* |
10205 | - * evm_inode_init_security - initializes security.evm |
10206 | + * evm_inode_init_security - initializes security.evm HMAC value |
10207 | */ |
10208 | int evm_inode_init_security(struct inode *inode, |
10209 | const struct xattr *lsm_xattr, |
10210 | @@ -529,7 +529,8 @@ int evm_inode_init_security(struct inode *inode, |
10211 | struct evm_xattr *xattr_data; |
10212 | int rc; |
10213 | |
10214 | - if (!evm_key_loaded() || !evm_protected_xattr(lsm_xattr->name)) |
10215 | + if (!(evm_initialized & EVM_INIT_HMAC) || |
10216 | + !evm_protected_xattr(lsm_xattr->name)) |
10217 | return 0; |
10218 | |
10219 | xattr_data = kzalloc(sizeof(*xattr_data), GFP_NOFS); |
10220 | diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c |
10221 | index 0f37ef27268de..d7f12ed191837 100644 |
10222 | --- a/security/integrity/evm/evm_secfs.c |
10223 | +++ b/security/integrity/evm/evm_secfs.c |
10224 | @@ -68,12 +68,13 @@ static ssize_t evm_read_key(struct file *filp, char __user *buf, |
10225 | static ssize_t evm_write_key(struct file *file, const char __user *buf, |
10226 | size_t count, loff_t *ppos) |
10227 | { |
10228 | - int i, ret; |
10229 | + unsigned int i; |
10230 | + int ret; |
10231 | |
10232 | if (!capable(CAP_SYS_ADMIN) || (evm_initialized & EVM_SETUP_COMPLETE)) |
10233 | return -EPERM; |
10234 | |
10235 | - ret = kstrtoint_from_user(buf, count, 0, &i); |
10236 | + ret = kstrtouint_from_user(buf, count, 0, &i); |
10237 | |
10238 | if (ret) |
10239 | return ret; |
10240 | @@ -82,12 +83,12 @@ static ssize_t evm_write_key(struct file *file, const char __user *buf, |
10241 | if (!i || (i & ~EVM_INIT_MASK) != 0) |
10242 | return -EINVAL; |
10243 | |
10244 | - /* Don't allow a request to freshly enable metadata writes if |
10245 | - * keys are loaded. |
10246 | + /* |
10247 | + * Don't allow a request to enable metadata writes if |
10248 | + * an HMAC key is loaded. |
10249 | */ |
10250 | if ((i & EVM_ALLOW_METADATA_WRITES) && |
10251 | - ((evm_initialized & EVM_KEY_MASK) != 0) && |
10252 | - !(evm_initialized & EVM_ALLOW_METADATA_WRITES)) |
10253 | + (evm_initialized & EVM_INIT_HMAC) != 0) |
10254 | return -EPERM; |
10255 | |
10256 | if (i & EVM_INIT_HMAC) { |
10257 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
10258 | index de40bb99b6793..f5606036b6a29 100644 |
10259 | --- a/sound/pci/hda/patch_realtek.c |
10260 | +++ b/sound/pci/hda/patch_realtek.c |
10261 | @@ -375,6 +375,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
10262 | alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); |
10263 | /* fallthrough */ |
10264 | case 0x10ec0215: |
10265 | + case 0x10ec0230: |
10266 | case 0x10ec0233: |
10267 | case 0x10ec0235: |
10268 | case 0x10ec0236: |
10269 | @@ -3143,6 +3144,7 @@ static void alc_disable_headset_jack_key(struct hda_codec *codec) |
10270 | alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); |
10271 | alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); |
10272 | break; |
10273 | + case 0x10ec0230: |
10274 | case 0x10ec0236: |
10275 | case 0x10ec0256: |
10276 | alc_write_coef_idx(codec, 0x48, 0x0); |
10277 | @@ -3170,6 +3172,7 @@ static void alc_enable_headset_jack_key(struct hda_codec *codec) |
10278 | alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); |
10279 | alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); |
10280 | break; |
10281 | + case 0x10ec0230: |
10282 | case 0x10ec0236: |
10283 | case 0x10ec0256: |
10284 | alc_write_coef_idx(codec, 0x48, 0xd011); |
10285 | @@ -4630,6 +4633,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) |
10286 | case 0x10ec0255: |
10287 | alc_process_coef_fw(codec, coef0255); |
10288 | break; |
10289 | + case 0x10ec0230: |
10290 | case 0x10ec0236: |
10291 | case 0x10ec0256: |
10292 | alc_process_coef_fw(codec, coef0256); |
10293 | @@ -4744,6 +4748,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, |
10294 | alc_process_coef_fw(codec, coef0255); |
10295 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
10296 | break; |
10297 | + case 0x10ec0230: |
10298 | case 0x10ec0236: |
10299 | case 0x10ec0256: |
10300 | alc_write_coef_idx(codec, 0x45, 0xc489); |
10301 | @@ -4893,6 +4898,7 @@ static void alc_headset_mode_default(struct hda_codec *codec) |
10302 | case 0x10ec0255: |
10303 | alc_process_coef_fw(codec, coef0255); |
10304 | break; |
10305 | + case 0x10ec0230: |
10306 | case 0x10ec0236: |
10307 | case 0x10ec0256: |
10308 | alc_write_coef_idx(codec, 0x1b, 0x0e4b); |
10309 | @@ -4991,6 +4997,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) |
10310 | case 0x10ec0255: |
10311 | alc_process_coef_fw(codec, coef0255); |
10312 | break; |
10313 | + case 0x10ec0230: |
10314 | case 0x10ec0236: |
10315 | case 0x10ec0256: |
10316 | alc_process_coef_fw(codec, coef0256); |
10317 | @@ -5104,6 +5111,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) |
10318 | case 0x10ec0255: |
10319 | alc_process_coef_fw(codec, coef0255); |
10320 | break; |
10321 | + case 0x10ec0230: |
10322 | case 0x10ec0236: |
10323 | case 0x10ec0256: |
10324 | alc_process_coef_fw(codec, coef0256); |
10325 | @@ -5199,6 +5207,7 @@ static void alc_determine_headset_type(struct hda_codec *codec) |
10326 | val = alc_read_coef_idx(codec, 0x46); |
10327 | is_ctia = (val & 0x0070) == 0x0070; |
10328 | break; |
10329 | + case 0x10ec0230: |
10330 | case 0x10ec0236: |
10331 | case 0x10ec0256: |
10332 | alc_write_coef_idx(codec, 0x1b, 0x0e4b); |
10333 | @@ -5492,6 +5501,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec) |
10334 | case 0x10ec0255: |
10335 | alc_process_coef_fw(codec, alc255fw); |
10336 | break; |
10337 | + case 0x10ec0230: |
10338 | case 0x10ec0236: |
10339 | case 0x10ec0256: |
10340 | alc_process_coef_fw(codec, alc256fw); |
10341 | @@ -6092,6 +6102,7 @@ static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) |
10342 | alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ |
10343 | alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); |
10344 | break; |
10345 | + case 0x10ec0230: |
10346 | case 0x10ec0235: |
10347 | case 0x10ec0236: |
10348 | case 0x10ec0255: |
10349 | @@ -6207,6 +6218,24 @@ static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, |
10350 | } |
10351 | } |
10352 | |
10353 | +static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, |
10354 | + const struct hda_fixup *fix, int action) |
10355 | +{ |
10356 | + static const hda_nid_t conn[] = { 0x02 }; |
10357 | + static const struct hda_pintbl pincfgs[] = { |
10358 | + { 0x14, 0x90170110 }, /* rear speaker */ |
10359 | + { } |
10360 | + }; |
10361 | + |
10362 | + switch (action) { |
10363 | + case HDA_FIXUP_ACT_PRE_PROBE: |
10364 | + snd_hda_apply_pincfgs(codec, pincfgs); |
10365 | + /* force front speaker to DAC1 */ |
10366 | + snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); |
10367 | + break; |
10368 | + } |
10369 | +} |
10370 | + |
10371 | /* for hda_fixup_thinkpad_acpi() */ |
10372 | #include "thinkpad_helper.c" |
10373 | |
10374 | @@ -7652,6 +7681,8 @@ static const struct hda_fixup alc269_fixups[] = { |
10375 | { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b }, |
10376 | { } |
10377 | }, |
10378 | + .chained = true, |
10379 | + .chain_id = ALC289_FIXUP_ASUS_GA401, |
10380 | }, |
10381 | [ALC285_FIXUP_HP_GPIO_LED] = { |
10382 | .type = HDA_FIXUP_FUNC, |
10383 | @@ -7905,13 +7936,8 @@ static const struct hda_fixup alc269_fixups[] = { |
10384 | .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED, |
10385 | }, |
10386 | [ALC285_FIXUP_HP_SPECTRE_X360] = { |
10387 | - .type = HDA_FIXUP_PINS, |
10388 | - .v.pins = (const struct hda_pintbl[]) { |
10389 | - { 0x14, 0x90170110 }, /* enable top speaker */ |
10390 | - {} |
10391 | - }, |
10392 | - .chained = true, |
10393 | - .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1, |
10394 | + .type = HDA_FIXUP_FUNC, |
10395 | + .v.func = alc285_fixup_hp_spectre_x360, |
10396 | }, |
10397 | }; |
10398 | |
10399 | @@ -8067,6 +8093,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
10400 | SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN), |
10401 | SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), |
10402 | SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), |
10403 | + SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), |
10404 | SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), |
10405 | SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED), |
10406 | SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), |
10407 | @@ -9063,6 +9090,7 @@ static int patch_alc269(struct hda_codec *codec) |
10408 | spec->shutup = alc256_shutup; |
10409 | spec->init_hook = alc256_init; |
10410 | break; |
10411 | + case 0x10ec0230: |
10412 | case 0x10ec0236: |
10413 | case 0x10ec0256: |
10414 | spec->codec_variant = ALC269_TYPE_ALC256; |
10415 | @@ -10354,6 +10382,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { |
10416 | HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269), |
10417 | HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269), |
10418 | HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269), |
10419 | + HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269), |
10420 | HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269), |
10421 | HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269), |
10422 | HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269), |
10423 | diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c |
10424 | index 2a73fc4fd019f..5150e8d38975e 100644 |
10425 | --- a/sound/pci/intel8x0.c |
10426 | +++ b/sound/pci/intel8x0.c |
10427 | @@ -715,7 +715,7 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich |
10428 | int status, civ, i, step; |
10429 | int ack = 0; |
10430 | |
10431 | - if (!ichdev->prepared || ichdev->suspended) |
10432 | + if (!(ichdev->prepared || chip->in_measurement) || ichdev->suspended) |
10433 | return; |
10434 | |
10435 | spin_lock_irqsave(&chip->reg_lock, flags); |
10436 | diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c |
10437 | index bbe2b638abb58..d870f56c44cfc 100644 |
10438 | --- a/sound/soc/atmel/atmel-i2s.c |
10439 | +++ b/sound/soc/atmel/atmel-i2s.c |
10440 | @@ -200,6 +200,7 @@ struct atmel_i2s_dev { |
10441 | unsigned int fmt; |
10442 | const struct atmel_i2s_gck_param *gck_param; |
10443 | const struct atmel_i2s_caps *caps; |
10444 | + int clk_use_no; |
10445 | }; |
10446 | |
10447 | static irqreturn_t atmel_i2s_interrupt(int irq, void *dev_id) |
10448 | @@ -321,9 +322,16 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream, |
10449 | { |
10450 | struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); |
10451 | bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
10452 | - unsigned int mr = 0; |
10453 | + unsigned int mr = 0, mr_mask; |
10454 | int ret; |
10455 | |
10456 | + mr_mask = ATMEL_I2SC_MR_FORMAT_MASK | ATMEL_I2SC_MR_MODE_MASK | |
10457 | + ATMEL_I2SC_MR_DATALENGTH_MASK; |
10458 | + if (is_playback) |
10459 | + mr_mask |= ATMEL_I2SC_MR_TXMONO; |
10460 | + else |
10461 | + mr_mask |= ATMEL_I2SC_MR_RXMONO; |
10462 | + |
10463 | switch (dev->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
10464 | case SND_SOC_DAIFMT_I2S: |
10465 | mr |= ATMEL_I2SC_MR_FORMAT_I2S; |
10466 | @@ -402,7 +410,7 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream, |
10467 | return -EINVAL; |
10468 | } |
10469 | |
10470 | - return regmap_write(dev->regmap, ATMEL_I2SC_MR, mr); |
10471 | + return regmap_update_bits(dev->regmap, ATMEL_I2SC_MR, mr_mask, mr); |
10472 | } |
10473 | |
10474 | static int atmel_i2s_switch_mck_generator(struct atmel_i2s_dev *dev, |
10475 | @@ -495,18 +503,28 @@ static int atmel_i2s_trigger(struct snd_pcm_substream *substream, int cmd, |
10476 | is_master = (mr & ATMEL_I2SC_MR_MODE_MASK) == ATMEL_I2SC_MR_MODE_MASTER; |
10477 | |
10478 | /* If master starts, enable the audio clock. */ |
10479 | - if (is_master && mck_enabled) |
10480 | - err = atmel_i2s_switch_mck_generator(dev, true); |
10481 | - if (err) |
10482 | - return err; |
10483 | + if (is_master && mck_enabled) { |
10484 | + if (!dev->clk_use_no) { |
10485 | + err = atmel_i2s_switch_mck_generator(dev, true); |
10486 | + if (err) |
10487 | + return err; |
10488 | + } |
10489 | + dev->clk_use_no++; |
10490 | + } |
10491 | |
10492 | err = regmap_write(dev->regmap, ATMEL_I2SC_CR, cr); |
10493 | if (err) |
10494 | return err; |
10495 | |
10496 | /* If master stops, disable the audio clock. */ |
10497 | - if (is_master && !mck_enabled) |
10498 | - err = atmel_i2s_switch_mck_generator(dev, false); |
10499 | + if (is_master && !mck_enabled) { |
10500 | + if (dev->clk_use_no == 1) { |
10501 | + err = atmel_i2s_switch_mck_generator(dev, false); |
10502 | + if (err) |
10503 | + return err; |
10504 | + } |
10505 | + dev->clk_use_no--; |
10506 | + } |
10507 | |
10508 | return err; |
10509 | } |
10510 | diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h |
10511 | index 866d7c873e3c9..ca2019732013e 100644 |
10512 | --- a/sound/soc/codecs/cs42l42.h |
10513 | +++ b/sound/soc/codecs/cs42l42.h |
10514 | @@ -77,7 +77,7 @@ |
10515 | #define CS42L42_HP_PDN_SHIFT 3 |
10516 | #define CS42L42_HP_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) |
10517 | #define CS42L42_ADC_PDN_SHIFT 2 |
10518 | -#define CS42L42_ADC_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) |
10519 | +#define CS42L42_ADC_PDN_MASK (1 << CS42L42_ADC_PDN_SHIFT) |
10520 | #define CS42L42_PDN_ALL_SHIFT 0 |
10521 | #define CS42L42_PDN_ALL_MASK (1 << CS42L42_PDN_ALL_SHIFT) |
10522 | |
10523 | diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c |
10524 | index 287c962ba00d7..514ebe16bbfad 100644 |
10525 | --- a/sound/soc/codecs/rk3328_codec.c |
10526 | +++ b/sound/soc/codecs/rk3328_codec.c |
10527 | @@ -472,7 +472,8 @@ static int rk3328_platform_probe(struct platform_device *pdev) |
10528 | rk3328->pclk = devm_clk_get(&pdev->dev, "pclk"); |
10529 | if (IS_ERR(rk3328->pclk)) { |
10530 | dev_err(&pdev->dev, "can't get acodec pclk\n"); |
10531 | - return PTR_ERR(rk3328->pclk); |
10532 | + ret = PTR_ERR(rk3328->pclk); |
10533 | + goto err_unprepare_mclk; |
10534 | } |
10535 | |
10536 | ret = clk_prepare_enable(rk3328->pclk); |
10537 | @@ -482,19 +483,34 @@ static int rk3328_platform_probe(struct platform_device *pdev) |
10538 | } |
10539 | |
10540 | base = devm_platform_ioremap_resource(pdev, 0); |
10541 | - if (IS_ERR(base)) |
10542 | - return PTR_ERR(base); |
10543 | + if (IS_ERR(base)) { |
10544 | + ret = PTR_ERR(base); |
10545 | + goto err_unprepare_pclk; |
10546 | + } |
10547 | |
10548 | rk3328->regmap = devm_regmap_init_mmio(&pdev->dev, base, |
10549 | &rk3328_codec_regmap_config); |
10550 | - if (IS_ERR(rk3328->regmap)) |
10551 | - return PTR_ERR(rk3328->regmap); |
10552 | + if (IS_ERR(rk3328->regmap)) { |
10553 | + ret = PTR_ERR(rk3328->regmap); |
10554 | + goto err_unprepare_pclk; |
10555 | + } |
10556 | |
10557 | platform_set_drvdata(pdev, rk3328); |
10558 | |
10559 | - return devm_snd_soc_register_component(&pdev->dev, &soc_codec_rk3328, |
10560 | + ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_rk3328, |
10561 | rk3328_dai, |
10562 | ARRAY_SIZE(rk3328_dai)); |
10563 | + if (ret) |
10564 | + goto err_unprepare_pclk; |
10565 | + |
10566 | + return 0; |
10567 | + |
10568 | +err_unprepare_pclk: |
10569 | + clk_disable_unprepare(rk3328->pclk); |
10570 | + |
10571 | +err_unprepare_mclk: |
10572 | + clk_disable_unprepare(rk3328->mclk); |
10573 | + return ret; |
10574 | } |
10575 | |
10576 | static const struct of_device_id rk3328_codec_of_match[] = { |
10577 | diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c |
10578 | index ab3b76d298b34..03470e8f30083 100644 |
10579 | --- a/sound/soc/hisilicon/hi6210-i2s.c |
10580 | +++ b/sound/soc/hisilicon/hi6210-i2s.c |
10581 | @@ -102,18 +102,15 @@ static int hi6210_i2s_startup(struct snd_pcm_substream *substream, |
10582 | |
10583 | for (n = 0; n < i2s->clocks; n++) { |
10584 | ret = clk_prepare_enable(i2s->clk[n]); |
10585 | - if (ret) { |
10586 | - while (n--) |
10587 | - clk_disable_unprepare(i2s->clk[n]); |
10588 | - return ret; |
10589 | - } |
10590 | + if (ret) |
10591 | + goto err_unprepare_clk; |
10592 | } |
10593 | |
10594 | ret = clk_set_rate(i2s->clk[CLK_I2S_BASE], 49152000); |
10595 | if (ret) { |
10596 | dev_err(i2s->dev, "%s: setting 49.152MHz base rate failed %d\n", |
10597 | __func__, ret); |
10598 | - return ret; |
10599 | + goto err_unprepare_clk; |
10600 | } |
10601 | |
10602 | /* enable clock before frequency division */ |
10603 | @@ -165,6 +162,11 @@ static int hi6210_i2s_startup(struct snd_pcm_substream *substream, |
10604 | hi6210_write_reg(i2s, HII2S_SW_RST_N, val); |
10605 | |
10606 | return 0; |
10607 | + |
10608 | +err_unprepare_clk: |
10609 | + while (n--) |
10610 | + clk_disable_unprepare(i2s->clk[n]); |
10611 | + return ret; |
10612 | } |
10613 | |
10614 | static void hi6210_i2s_shutdown(struct snd_pcm_substream *substream, |
10615 | diff --git a/sound/soc/mediatek/common/mtk-btcvsd.c b/sound/soc/mediatek/common/mtk-btcvsd.c |
10616 | index d00608c73c6ec..b66f7dee1e149 100644 |
10617 | --- a/sound/soc/mediatek/common/mtk-btcvsd.c |
10618 | +++ b/sound/soc/mediatek/common/mtk-btcvsd.c |
10619 | @@ -1302,7 +1302,7 @@ static const struct snd_soc_component_driver mtk_btcvsd_snd_platform = { |
10620 | |
10621 | static int mtk_btcvsd_snd_probe(struct platform_device *pdev) |
10622 | { |
10623 | - int ret = 0; |
10624 | + int ret; |
10625 | int irq_id; |
10626 | u32 offset[5] = {0, 0, 0, 0, 0}; |
10627 | struct mtk_btcvsd_snd *btcvsd; |
10628 | @@ -1358,7 +1358,8 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) |
10629 | btcvsd->bt_sram_bank2_base = of_iomap(dev->of_node, 1); |
10630 | if (!btcvsd->bt_sram_bank2_base) { |
10631 | dev_err(dev, "iomap bt_sram_bank2_base fail\n"); |
10632 | - return -EIO; |
10633 | + ret = -EIO; |
10634 | + goto unmap_pkv_err; |
10635 | } |
10636 | |
10637 | btcvsd->infra = syscon_regmap_lookup_by_phandle(dev->of_node, |
10638 | @@ -1366,7 +1367,8 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) |
10639 | if (IS_ERR(btcvsd->infra)) { |
10640 | dev_err(dev, "cannot find infra controller: %ld\n", |
10641 | PTR_ERR(btcvsd->infra)); |
10642 | - return PTR_ERR(btcvsd->infra); |
10643 | + ret = PTR_ERR(btcvsd->infra); |
10644 | + goto unmap_bank2_err; |
10645 | } |
10646 | |
10647 | /* get offset */ |
10648 | @@ -1375,7 +1377,7 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) |
10649 | ARRAY_SIZE(offset)); |
10650 | if (ret) { |
10651 | dev_warn(dev, "%s(), get offset fail, ret %d\n", __func__, ret); |
10652 | - return ret; |
10653 | + goto unmap_bank2_err; |
10654 | } |
10655 | btcvsd->infra_misc_offset = offset[0]; |
10656 | btcvsd->conn_bt_cvsd_mask = offset[1]; |
10657 | @@ -1394,8 +1396,18 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) |
10658 | mtk_btcvsd_snd_set_state(btcvsd, btcvsd->tx, BT_SCO_STATE_IDLE); |
10659 | mtk_btcvsd_snd_set_state(btcvsd, btcvsd->rx, BT_SCO_STATE_IDLE); |
10660 | |
10661 | - return devm_snd_soc_register_component(dev, &mtk_btcvsd_snd_platform, |
10662 | - NULL, 0); |
10663 | + ret = devm_snd_soc_register_component(dev, &mtk_btcvsd_snd_platform, |
10664 | + NULL, 0); |
10665 | + if (ret) |
10666 | + goto unmap_bank2_err; |
10667 | + |
10668 | + return 0; |
10669 | + |
10670 | +unmap_bank2_err: |
10671 | + iounmap(btcvsd->bt_sram_bank2_base); |
10672 | +unmap_pkv_err: |
10673 | + iounmap(btcvsd->bt_pkv_base); |
10674 | + return ret; |
10675 | } |
10676 | |
10677 | static int mtk_btcvsd_snd_remove(struct platform_device *pdev) |
10678 | diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c |
10679 | index b9aacf3d3b29c..7532ab27a48df 100644 |
10680 | --- a/sound/soc/sh/rcar/adg.c |
10681 | +++ b/sound/soc/sh/rcar/adg.c |
10682 | @@ -289,7 +289,6 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val) |
10683 | int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate) |
10684 | { |
10685 | struct rsnd_adg *adg = rsnd_priv_to_adg(priv); |
10686 | - struct clk *clk; |
10687 | int i; |
10688 | int sel_table[] = { |
10689 | [CLKA] = 0x1, |
10690 | @@ -302,10 +301,9 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate) |
10691 | * find suitable clock from |
10692 | * AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI. |
10693 | */ |
10694 | - for_each_rsnd_clk(clk, adg, i) { |
10695 | + for (i = 0; i < CLKMAX; i++) |
10696 | if (rate == adg->clk_rate[i]) |
10697 | return sel_table[i]; |
10698 | - } |
10699 | |
10700 | /* |
10701 | * find divided clock from BRGA/BRGB |
10702 | diff --git a/sound/usb/format.c b/sound/usb/format.c |
10703 | index 9e9d4c10dfac6..84b66f7c627c4 100644 |
10704 | --- a/sound/usb/format.c |
10705 | +++ b/sound/usb/format.c |
10706 | @@ -195,9 +195,11 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof |
10707 | continue; |
10708 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ |
10709 | /* Terratec Aureon 7.1 USB C-Media 6206, too */ |
10710 | + /* Ozone Z90 USB C-Media, too */ |
10711 | if (rate == 48000 && nr_rates == 1 && |
10712 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || |
10713 | chip->usb_id == USB_ID(0x0d8c, 0x0102) || |
10714 | + chip->usb_id == USB_ID(0x0d8c, 0x0078) || |
10715 | chip->usb_id == USB_ID(0x0ccd, 0x00b1)) && |
10716 | fp->altsetting == 5 && fp->maxpacksize == 392) |
10717 | rate = 96000; |
10718 | diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
10719 | index f4f8778e907a9..22841ed2411e2 100644 |
10720 | --- a/sound/usb/mixer.c |
10721 | +++ b/sound/usb/mixer.c |
10722 | @@ -3241,8 +3241,9 @@ static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, |
10723 | struct usb_mixer_elem_list *list) |
10724 | { |
10725 | struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); |
10726 | - static const char * const val_types[] = {"BOOLEAN", "INV_BOOLEAN", |
10727 | - "S8", "U8", "S16", "U16"}; |
10728 | + static const char * const val_types[] = { |
10729 | + "BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16", "S32", "U32", |
10730 | + }; |
10731 | snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " |
10732 | "channels=%i, type=\"%s\"\n", cval->head.id, |
10733 | cval->control, cval->cmask, cval->channels, |
10734 | @@ -3598,6 +3599,9 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list) |
10735 | struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); |
10736 | int c, err, idx; |
10737 | |
10738 | + if (cval->val_type == USB_MIXER_BESPOKEN) |
10739 | + return 0; |
10740 | + |
10741 | if (cval->cmask) { |
10742 | idx = 0; |
10743 | for (c = 0; c < MAX_CHANNELS; c++) { |
10744 | diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h |
10745 | index 01b5e5cc22210..0e813cd85bee7 100644 |
10746 | --- a/sound/usb/mixer.h |
10747 | +++ b/sound/usb/mixer.h |
10748 | @@ -55,6 +55,7 @@ enum { |
10749 | USB_MIXER_U16, |
10750 | USB_MIXER_S32, |
10751 | USB_MIXER_U32, |
10752 | + USB_MIXER_BESPOKEN, /* non-standard type */ |
10753 | }; |
10754 | |
10755 | typedef void (*usb_mixer_elem_dump_func_t)(struct snd_info_buffer *buffer, |
10756 | diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c |
10757 | index 7a10c9e22c46c..54bcf1c14bc24 100644 |
10758 | --- a/sound/usb/mixer_scarlett_gen2.c |
10759 | +++ b/sound/usb/mixer_scarlett_gen2.c |
10760 | @@ -949,10 +949,15 @@ static int scarlett2_add_new_ctl(struct usb_mixer_interface *mixer, |
10761 | if (!elem) |
10762 | return -ENOMEM; |
10763 | |
10764 | + /* We set USB_MIXER_BESPOKEN type, so that the core USB mixer code |
10765 | + * ignores them for resume and other operations. |
10766 | + * Also, the head.id field is set to 0, as we don't use this field. |
10767 | + */ |
10768 | elem->head.mixer = mixer; |
10769 | elem->control = index; |
10770 | - elem->head.id = index; |
10771 | + elem->head.id = 0; |
10772 | elem->channels = channels; |
10773 | + elem->val_type = USB_MIXER_BESPOKEN; |
10774 | |
10775 | kctl = snd_ctl_new1(ncontrol, elem); |
10776 | if (!kctl) { |
10777 | diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c |
10778 | index 93d008687020c..7d3cfb0ccbe61 100644 |
10779 | --- a/tools/bpf/bpftool/main.c |
10780 | +++ b/tools/bpf/bpftool/main.c |
10781 | @@ -303,8 +303,10 @@ static int do_batch(int argc, char **argv) |
10782 | n_argc = make_args(buf, n_argv, BATCH_ARG_NB_MAX, lines); |
10783 | if (!n_argc) |
10784 | continue; |
10785 | - if (n_argc < 0) |
10786 | + if (n_argc < 0) { |
10787 | + err = n_argc; |
10788 | goto err_close; |
10789 | + } |
10790 | |
10791 | if (json_output) { |
10792 | jsonw_start_object(json_wtr); |
10793 | diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c |
10794 | index 8b14e4a7f1dc7..e7c7e3232fc5a 100644 |
10795 | --- a/tools/perf/util/llvm-utils.c |
10796 | +++ b/tools/perf/util/llvm-utils.c |
10797 | @@ -502,6 +502,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, |
10798 | goto errout; |
10799 | } |
10800 | |
10801 | + err = -ENOMEM; |
10802 | if (asprintf(&pipe_template, "%s -emit-llvm | %s -march=bpf %s -filetype=obj -o -", |
10803 | template, llc_path, opts) < 0) { |
10804 | pr_err("ERROR:\tnot enough memory to setup command line\n"); |
10805 | @@ -522,6 +523,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, |
10806 | |
10807 | pr_debug("llvm compiling command template: %s\n", template); |
10808 | |
10809 | + err = -ENOMEM; |
10810 | if (asprintf(&command_echo, "echo -n \"%s\"", template) < 0) |
10811 | goto errout; |
10812 | |
10813 | diff --git a/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py |
10814 | index 229ee185b27e1..a7b21658af9b4 100644 |
10815 | --- a/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py |
10816 | +++ b/tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py |
10817 | @@ -36,7 +36,7 @@ class SubPlugin(TdcPlugin): |
10818 | for k in scapy_keys: |
10819 | if k not in scapyinfo: |
10820 | keyfail = True |
10821 | - missing_keys.add(k) |
10822 | + missing_keys.append(k) |
10823 | if keyfail: |
10824 | print('{}: Scapy block present in the test, but is missing info:' |
10825 | .format(self.sub_class)) |
10826 | diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c |
10827 | index 47191af466174..a3602148e2ea9 100644 |
10828 | --- a/tools/testing/selftests/x86/protection_keys.c |
10829 | +++ b/tools/testing/selftests/x86/protection_keys.c |
10830 | @@ -613,7 +613,6 @@ int alloc_random_pkey(void) |
10831 | int nr_alloced = 0; |
10832 | int random_index; |
10833 | memset(alloced_pkeys, 0, sizeof(alloced_pkeys)); |
10834 | - srand((unsigned int)time(NULL)); |
10835 | |
10836 | /* allocate every possible key and make a note of which ones we got */ |
10837 | max_nr_pkey_allocs = NR_PKEYS; |
10838 | @@ -1479,6 +1478,8 @@ int main(void) |
10839 | { |
10840 | int nr_iterations = 22; |
10841 | |
10842 | + srand((unsigned int)time(NULL)); |
10843 | + |
10844 | setup_handlers(); |
10845 | |
10846 | printf("has pku: %d\n", cpu_has_pku()); |