1 |
commit: e62379d875e51b478db75a6675ecb6180f41ebbc |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 31 14:03:07 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 31 14:03:07 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e62379d8 |
7 |
|
8 |
Linux patch 5.0.20 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1019_linux-5.0.20.patch | 11613 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 11617 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 599546c..cf5191b 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -119,6 +119,10 @@ Patch: 1018_linux-5.0.19.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.0.19 |
23 |
|
24 |
+Patch: 1019_linux-5.0.20.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.0.20 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1019_linux-5.0.20.patch b/1019_linux-5.0.20.patch |
33 |
new file mode 100644 |
34 |
index 0000000..d10f5ca |
35 |
--- /dev/null |
36 |
+++ b/1019_linux-5.0.20.patch |
37 |
@@ -0,0 +1,11613 @@ |
38 |
+diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt |
39 |
+index ddb8ce5333ba..7a7e271be3f1 100644 |
40 |
+--- a/Documentation/arm64/silicon-errata.txt |
41 |
++++ b/Documentation/arm64/silicon-errata.txt |
42 |
+@@ -61,6 +61,7 @@ stable kernels. |
43 |
+ | ARM | Cortex-A76 | #1188873 | ARM64_ERRATUM_1188873 | |
44 |
+ | ARM | Cortex-A76 | #1165522 | ARM64_ERRATUM_1165522 | |
45 |
+ | ARM | Cortex-A76 | #1286807 | ARM64_ERRATUM_1286807 | |
46 |
++| ARM | Cortex-A76 | #1463225 | ARM64_ERRATUM_1463225 | |
47 |
+ | ARM | MMU-500 | #841119,#826419 | N/A | |
48 |
+ | | | | | |
49 |
+ | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | |
50 |
+diff --git a/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt b/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt |
51 |
+index 41a1074228ba..6b6ca4456dc7 100644 |
52 |
+--- a/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt |
53 |
++++ b/Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt |
54 |
+@@ -53,7 +53,8 @@ Required properties: |
55 |
+ one for each entry in reset-names. |
56 |
+ - reset-names: "phy" for reset of phy block, |
57 |
+ "common" for phy common block reset, |
58 |
+- "cfg" for phy's ahb cfg block reset. |
59 |
++ "cfg" for phy's ahb cfg block reset, |
60 |
++ "ufsphy" for the PHY reset in the UFS controller. |
61 |
+ |
62 |
+ For "qcom,ipq8074-qmp-pcie-phy" must contain: |
63 |
+ "phy", "common". |
64 |
+@@ -65,7 +66,8 @@ Required properties: |
65 |
+ "phy", "common". |
66 |
+ For "qcom,sdm845-qmp-usb3-uni-phy" must contain: |
67 |
+ "phy", "common". |
68 |
+- For "qcom,sdm845-qmp-ufs-phy": no resets are listed. |
69 |
++ For "qcom,sdm845-qmp-ufs-phy": must contain: |
70 |
++ "ufsphy". |
71 |
+ |
72 |
+ - vdda-phy-supply: Phandle to a regulator supply to PHY core block. |
73 |
+ - vdda-pll-supply: Phandle to 1.8V regulator supply to PHY refclk pll block. |
74 |
+diff --git a/Makefile b/Makefile |
75 |
+index 66efffc3fb41..25390977536b 100644 |
76 |
+--- a/Makefile |
77 |
++++ b/Makefile |
78 |
+@@ -1,7 +1,7 @@ |
79 |
+ # SPDX-License-Identifier: GPL-2.0 |
80 |
+ VERSION = 5 |
81 |
+ PATCHLEVEL = 0 |
82 |
+-SUBLEVEL = 19 |
83 |
++SUBLEVEL = 20 |
84 |
+ EXTRAVERSION = |
85 |
+ NAME = Shy Crocodile |
86 |
+ |
87 |
+diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h |
88 |
+index 07e27f212dc7..d2453e2d3f1f 100644 |
89 |
+--- a/arch/arm/include/asm/cp15.h |
90 |
++++ b/arch/arm/include/asm/cp15.h |
91 |
+@@ -68,6 +68,8 @@ |
92 |
+ #define BPIALL __ACCESS_CP15(c7, 0, c5, 6) |
93 |
+ #define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) |
94 |
+ |
95 |
++#define CNTVCT __ACCESS_CP15_64(1, c14) |
96 |
++ |
97 |
+ extern unsigned long cr_alignment; /* defined in entry-armv.S */ |
98 |
+ |
99 |
+ static inline unsigned long get_cr(void) |
100 |
+diff --git a/arch/arm/vdso/vgettimeofday.c b/arch/arm/vdso/vgettimeofday.c |
101 |
+index a9dd619c6c29..7bdbf5d5c47d 100644 |
102 |
+--- a/arch/arm/vdso/vgettimeofday.c |
103 |
++++ b/arch/arm/vdso/vgettimeofday.c |
104 |
+@@ -18,9 +18,9 @@ |
105 |
+ #include <linux/compiler.h> |
106 |
+ #include <linux/hrtimer.h> |
107 |
+ #include <linux/time.h> |
108 |
+-#include <asm/arch_timer.h> |
109 |
+ #include <asm/barrier.h> |
110 |
+ #include <asm/bug.h> |
111 |
++#include <asm/cp15.h> |
112 |
+ #include <asm/page.h> |
113 |
+ #include <asm/unistd.h> |
114 |
+ #include <asm/vdso_datapage.h> |
115 |
+@@ -123,7 +123,8 @@ static notrace u64 get_ns(struct vdso_data *vdata) |
116 |
+ u64 cycle_now; |
117 |
+ u64 nsec; |
118 |
+ |
119 |
+- cycle_now = arch_counter_get_cntvct(); |
120 |
++ isb(); |
121 |
++ cycle_now = read_sysreg(CNTVCT); |
122 |
+ |
123 |
+ cycle_delta = (cycle_now - vdata->cs_cycle_last) & vdata->cs_mask; |
124 |
+ |
125 |
+diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig |
126 |
+index a4168d366127..4535b2b48fd9 100644 |
127 |
+--- a/arch/arm64/Kconfig |
128 |
++++ b/arch/arm64/Kconfig |
129 |
+@@ -518,6 +518,24 @@ config ARM64_ERRATUM_1286807 |
130 |
+ |
131 |
+ If unsure, say Y. |
132 |
+ |
133 |
++config ARM64_ERRATUM_1463225 |
134 |
++ bool "Cortex-A76: Software Step might prevent interrupt recognition" |
135 |
++ default y |
136 |
++ help |
137 |
++ This option adds a workaround for Arm Cortex-A76 erratum 1463225. |
138 |
++ |
139 |
++ On the affected Cortex-A76 cores (r0p0 to r3p1), software stepping |
140 |
++ of a system call instruction (SVC) can prevent recognition of |
141 |
++ subsequent interrupts when software stepping is disabled in the |
142 |
++ exception handler of the system call and either kernel debugging |
143 |
++ is enabled or VHE is in use. |
144 |
++ |
145 |
++ Work around the erratum by triggering a dummy step exception |
146 |
++ when handling a system call from a task that is being stepped |
147 |
++ in a VHE configuration of the kernel. |
148 |
++ |
149 |
++ If unsure, say Y. |
150 |
++ |
151 |
+ config CAVIUM_ERRATUM_22375 |
152 |
+ bool "Cavium erratum 22375, 24313" |
153 |
+ default y |
154 |
+diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h |
155 |
+index 82e9099834ae..99db8de83734 100644 |
156 |
+--- a/arch/arm64/include/asm/cpucaps.h |
157 |
++++ b/arch/arm64/include/asm/cpucaps.h |
158 |
+@@ -60,7 +60,8 @@ |
159 |
+ #define ARM64_HAS_ADDRESS_AUTH_IMP_DEF 39 |
160 |
+ #define ARM64_HAS_GENERIC_AUTH_ARCH 40 |
161 |
+ #define ARM64_HAS_GENERIC_AUTH_IMP_DEF 41 |
162 |
++#define ARM64_WORKAROUND_1463225 42 |
163 |
+ |
164 |
+-#define ARM64_NCAPS 42 |
165 |
++#define ARM64_NCAPS 43 |
166 |
+ |
167 |
+ #endif /* __ASM_CPUCAPS_H */ |
168 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
169 |
+index de70c1eabf33..74ebe9693714 100644 |
170 |
+--- a/arch/arm64/include/asm/pgtable.h |
171 |
++++ b/arch/arm64/include/asm/pgtable.h |
172 |
+@@ -478,6 +478,8 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) |
173 |
+ return __pmd_to_phys(pmd); |
174 |
+ } |
175 |
+ |
176 |
++static inline void pte_unmap(pte_t *pte) { } |
177 |
++ |
178 |
+ /* Find an entry in the third-level page table. */ |
179 |
+ #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
180 |
+ |
181 |
+@@ -486,7 +488,6 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) |
182 |
+ |
183 |
+ #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) |
184 |
+ #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) |
185 |
+-#define pte_unmap(pte) do { } while (0) |
186 |
+ #define pte_unmap_nested(pte) do { } while (0) |
187 |
+ |
188 |
+ #define pte_set_fixmap(addr) ((pte_t *)set_fixmap_offset(FIX_PTE, addr)) |
189 |
+diff --git a/arch/arm64/include/asm/vdso_datapage.h b/arch/arm64/include/asm/vdso_datapage.h |
190 |
+index 2b9a63771eda..f89263c8e11a 100644 |
191 |
+--- a/arch/arm64/include/asm/vdso_datapage.h |
192 |
++++ b/arch/arm64/include/asm/vdso_datapage.h |
193 |
+@@ -38,6 +38,7 @@ struct vdso_data { |
194 |
+ __u32 tz_minuteswest; /* Whacky timezone stuff */ |
195 |
+ __u32 tz_dsttime; |
196 |
+ __u32 use_syscall; |
197 |
++ __u32 hrtimer_res; |
198 |
+ }; |
199 |
+ |
200 |
+ #endif /* !__ASSEMBLY__ */ |
201 |
+diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c |
202 |
+index 65b8afc84466..ddcd3ea87b81 100644 |
203 |
+--- a/arch/arm64/kernel/asm-offsets.c |
204 |
++++ b/arch/arm64/kernel/asm-offsets.c |
205 |
+@@ -102,7 +102,7 @@ int main(void) |
206 |
+ DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); |
207 |
+ DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); |
208 |
+ DEFINE(CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_RAW); |
209 |
+- DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); |
210 |
++ DEFINE(CLOCK_REALTIME_RES, offsetof(struct vdso_data, hrtimer_res)); |
211 |
+ DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE); |
212 |
+ DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE); |
213 |
+ DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC); |
214 |
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c |
215 |
+index 9950bb0cbd52..87019cd73f22 100644 |
216 |
+--- a/arch/arm64/kernel/cpu_errata.c |
217 |
++++ b/arch/arm64/kernel/cpu_errata.c |
218 |
+@@ -464,6 +464,22 @@ out_printmsg: |
219 |
+ } |
220 |
+ #endif /* CONFIG_ARM64_SSBD */ |
221 |
+ |
222 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
223 |
++DEFINE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
224 |
++ |
225 |
++static bool |
226 |
++has_cortex_a76_erratum_1463225(const struct arm64_cpu_capabilities *entry, |
227 |
++ int scope) |
228 |
++{ |
229 |
++ u32 midr = read_cpuid_id(); |
230 |
++ /* Cortex-A76 r0p0 - r3p1 */ |
231 |
++ struct midr_range range = MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1); |
232 |
++ |
233 |
++ WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); |
234 |
++ return is_midr_in_range(midr, &range) && is_kernel_in_hyp_mode(); |
235 |
++} |
236 |
++#endif |
237 |
++ |
238 |
+ static void __maybe_unused |
239 |
+ cpu_enable_cache_maint_trap(const struct arm64_cpu_capabilities *__unused) |
240 |
+ { |
241 |
+@@ -738,6 +754,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { |
242 |
+ .capability = ARM64_WORKAROUND_1165522, |
243 |
+ ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 2, 0), |
244 |
+ }, |
245 |
++#endif |
246 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
247 |
++ { |
248 |
++ .desc = "ARM erratum 1463225", |
249 |
++ .capability = ARM64_WORKAROUND_1463225, |
250 |
++ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
251 |
++ .matches = has_cortex_a76_erratum_1463225, |
252 |
++ }, |
253 |
+ #endif |
254 |
+ { |
255 |
+ } |
256 |
+diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c |
257 |
+index ea001241bdd4..00f8b8612b69 100644 |
258 |
+--- a/arch/arm64/kernel/cpu_ops.c |
259 |
++++ b/arch/arm64/kernel/cpu_ops.c |
260 |
+@@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu) |
261 |
+ pr_err("%pOF: missing enable-method property\n", |
262 |
+ dn); |
263 |
+ } |
264 |
++ of_node_put(dn); |
265 |
+ } else { |
266 |
+ enable_method = acpi_get_enable_method(cpu); |
267 |
+ if (!enable_method) { |
268 |
+diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c |
269 |
+index b09b6f75f759..06941c1fe418 100644 |
270 |
+--- a/arch/arm64/kernel/kaslr.c |
271 |
++++ b/arch/arm64/kernel/kaslr.c |
272 |
+@@ -145,15 +145,15 @@ u64 __init kaslr_early_init(u64 dt_phys) |
273 |
+ |
274 |
+ if (IS_ENABLED(CONFIG_RANDOMIZE_MODULE_REGION_FULL)) { |
275 |
+ /* |
276 |
+- * Randomize the module region over a 4 GB window covering the |
277 |
++ * Randomize the module region over a 2 GB window covering the |
278 |
+ * kernel. This reduces the risk of modules leaking information |
279 |
+ * about the address of the kernel itself, but results in |
280 |
+ * branches between modules and the core kernel that are |
281 |
+ * resolved via PLTs. (Branches between modules will be |
282 |
+ * resolved normally.) |
283 |
+ */ |
284 |
+- module_range = SZ_4G - (u64)(_end - _stext); |
285 |
+- module_alloc_base = max((u64)_end + offset - SZ_4G, |
286 |
++ module_range = SZ_2G - (u64)(_end - _stext); |
287 |
++ module_alloc_base = max((u64)_end + offset - SZ_2G, |
288 |
+ (u64)MODULES_VADDR); |
289 |
+ } else { |
290 |
+ /* |
291 |
+diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c |
292 |
+index f713e2fc4d75..1e418e69b58c 100644 |
293 |
+--- a/arch/arm64/kernel/module.c |
294 |
++++ b/arch/arm64/kernel/module.c |
295 |
+@@ -56,7 +56,7 @@ void *module_alloc(unsigned long size) |
296 |
+ * can simply omit this fallback in that case. |
297 |
+ */ |
298 |
+ p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, |
299 |
+- module_alloc_base + SZ_4G, GFP_KERNEL, |
300 |
++ module_alloc_base + SZ_2G, GFP_KERNEL, |
301 |
+ PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, |
302 |
+ __builtin_return_address(0)); |
303 |
+ |
304 |
+diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c |
305 |
+index 5610ac01c1ec..871c739f060a 100644 |
306 |
+--- a/arch/arm64/kernel/syscall.c |
307 |
++++ b/arch/arm64/kernel/syscall.c |
308 |
+@@ -8,6 +8,7 @@ |
309 |
+ #include <linux/syscalls.h> |
310 |
+ |
311 |
+ #include <asm/daifflags.h> |
312 |
++#include <asm/debug-monitors.h> |
313 |
+ #include <asm/fpsimd.h> |
314 |
+ #include <asm/syscall.h> |
315 |
+ #include <asm/thread_info.h> |
316 |
+@@ -60,6 +61,35 @@ static inline bool has_syscall_work(unsigned long flags) |
317 |
+ int syscall_trace_enter(struct pt_regs *regs); |
318 |
+ void syscall_trace_exit(struct pt_regs *regs); |
319 |
+ |
320 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
321 |
++DECLARE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
322 |
++ |
323 |
++static void cortex_a76_erratum_1463225_svc_handler(void) |
324 |
++{ |
325 |
++ u32 reg, val; |
326 |
++ |
327 |
++ if (!unlikely(test_thread_flag(TIF_SINGLESTEP))) |
328 |
++ return; |
329 |
++ |
330 |
++ if (!unlikely(this_cpu_has_cap(ARM64_WORKAROUND_1463225))) |
331 |
++ return; |
332 |
++ |
333 |
++ __this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 1); |
334 |
++ reg = read_sysreg(mdscr_el1); |
335 |
++ val = reg | DBG_MDSCR_SS | DBG_MDSCR_KDE; |
336 |
++ write_sysreg(val, mdscr_el1); |
337 |
++ asm volatile("msr daifclr, #8"); |
338 |
++ isb(); |
339 |
++ |
340 |
++ /* We will have taken a single-step exception by this point */ |
341 |
++ |
342 |
++ write_sysreg(reg, mdscr_el1); |
343 |
++ __this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 0); |
344 |
++} |
345 |
++#else |
346 |
++static void cortex_a76_erratum_1463225_svc_handler(void) { } |
347 |
++#endif /* CONFIG_ARM64_ERRATUM_1463225 */ |
348 |
++ |
349 |
+ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, |
350 |
+ const syscall_fn_t syscall_table[]) |
351 |
+ { |
352 |
+@@ -68,6 +98,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, |
353 |
+ regs->orig_x0 = regs->regs[0]; |
354 |
+ regs->syscallno = scno; |
355 |
+ |
356 |
++ cortex_a76_erratum_1463225_svc_handler(); |
357 |
+ local_daif_restore(DAIF_PROCCTX); |
358 |
+ user_exit(); |
359 |
+ |
360 |
+diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c |
361 |
+index 2d419006ad43..ec0bb588d755 100644 |
362 |
+--- a/arch/arm64/kernel/vdso.c |
363 |
++++ b/arch/arm64/kernel/vdso.c |
364 |
+@@ -232,6 +232,9 @@ void update_vsyscall(struct timekeeper *tk) |
365 |
+ vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; |
366 |
+ vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; |
367 |
+ |
368 |
++ /* Read without the seqlock held by clock_getres() */ |
369 |
++ WRITE_ONCE(vdso_data->hrtimer_res, hrtimer_resolution); |
370 |
++ |
371 |
+ if (!use_syscall) { |
372 |
+ /* tkr_mono.cycle_last == tkr_raw.cycle_last */ |
373 |
+ vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last; |
374 |
+diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S |
375 |
+index e8f60112818f..856fee6d3512 100644 |
376 |
+--- a/arch/arm64/kernel/vdso/gettimeofday.S |
377 |
++++ b/arch/arm64/kernel/vdso/gettimeofday.S |
378 |
+@@ -308,13 +308,14 @@ ENTRY(__kernel_clock_getres) |
379 |
+ ccmp w0, #CLOCK_MONOTONIC_RAW, #0x4, ne |
380 |
+ b.ne 1f |
381 |
+ |
382 |
+- ldr x2, 5f |
383 |
++ adr vdso_data, _vdso_data |
384 |
++ ldr w2, [vdso_data, #CLOCK_REALTIME_RES] |
385 |
+ b 2f |
386 |
+ 1: |
387 |
+ cmp w0, #CLOCK_REALTIME_COARSE |
388 |
+ ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne |
389 |
+ b.ne 4f |
390 |
+- ldr x2, 6f |
391 |
++ ldr x2, 5f |
392 |
+ 2: |
393 |
+ cbz x1, 3f |
394 |
+ stp xzr, x2, [x1] |
395 |
+@@ -328,8 +329,6 @@ ENTRY(__kernel_clock_getres) |
396 |
+ svc #0 |
397 |
+ ret |
398 |
+ 5: |
399 |
+- .quad CLOCK_REALTIME_RES |
400 |
+-6: |
401 |
+ .quad CLOCK_COARSE_RES |
402 |
+ .cfi_endproc |
403 |
+ ENDPROC(__kernel_clock_getres) |
404 |
+diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c |
405 |
+index 78c0a72f822c..674860e3e478 100644 |
406 |
+--- a/arch/arm64/mm/dma-mapping.c |
407 |
++++ b/arch/arm64/mm/dma-mapping.c |
408 |
+@@ -249,6 +249,11 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, |
409 |
+ if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret)) |
410 |
+ return ret; |
411 |
+ |
412 |
++ if (!is_vmalloc_addr(cpu_addr)) { |
413 |
++ unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr)); |
414 |
++ return __swiotlb_mmap_pfn(vma, pfn, size); |
415 |
++ } |
416 |
++ |
417 |
+ if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) { |
418 |
+ /* |
419 |
+ * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped, |
420 |
+@@ -272,6 +277,11 @@ static int __iommu_get_sgtable(struct device *dev, struct sg_table *sgt, |
421 |
+ unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
422 |
+ struct vm_struct *area = find_vm_area(cpu_addr); |
423 |
+ |
424 |
++ if (!is_vmalloc_addr(cpu_addr)) { |
425 |
++ struct page *page = virt_to_page(cpu_addr); |
426 |
++ return __swiotlb_get_sgtable_page(sgt, page, size); |
427 |
++ } |
428 |
++ |
429 |
+ if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) { |
430 |
+ /* |
431 |
+ * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped, |
432 |
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c |
433 |
+index ef46925096f0..d3bdef0b2f60 100644 |
434 |
+--- a/arch/arm64/mm/fault.c |
435 |
++++ b/arch/arm64/mm/fault.c |
436 |
+@@ -824,14 +824,47 @@ void __init hook_debug_fault_code(int nr, |
437 |
+ debug_fault_info[nr].name = name; |
438 |
+ } |
439 |
+ |
440 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
441 |
++DECLARE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
442 |
++ |
443 |
++static int __exception |
444 |
++cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) |
445 |
++{ |
446 |
++ if (user_mode(regs)) |
447 |
++ return 0; |
448 |
++ |
449 |
++ if (!__this_cpu_read(__in_cortex_a76_erratum_1463225_wa)) |
450 |
++ return 0; |
451 |
++ |
452 |
++ /* |
453 |
++ * We've taken a dummy step exception from the kernel to ensure |
454 |
++ * that interrupts are re-enabled on the syscall path. Return back |
455 |
++ * to cortex_a76_erratum_1463225_svc_handler() with debug exceptions |
456 |
++ * masked so that we can safely restore the mdscr and get on with |
457 |
++ * handling the syscall. |
458 |
++ */ |
459 |
++ regs->pstate |= PSR_D_BIT; |
460 |
++ return 1; |
461 |
++} |
462 |
++#else |
463 |
++static int __exception |
464 |
++cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) |
465 |
++{ |
466 |
++ return 0; |
467 |
++} |
468 |
++#endif /* CONFIG_ARM64_ERRATUM_1463225 */ |
469 |
++ |
470 |
+ asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint, |
471 |
+- unsigned int esr, |
472 |
+- struct pt_regs *regs) |
473 |
++ unsigned int esr, |
474 |
++ struct pt_regs *regs) |
475 |
+ { |
476 |
+ const struct fault_info *inf = esr_to_debug_fault_info(esr); |
477 |
+ unsigned long pc = instruction_pointer(regs); |
478 |
+ int rv; |
479 |
+ |
480 |
++ if (cortex_a76_erratum_1463225_debug_handler(regs)) |
481 |
++ return 0; |
482 |
++ |
483 |
+ /* |
484 |
+ * Tell lockdep we disabled irqs in entry.S. Do nothing if they were |
485 |
+ * already disabled to preserve the last enabled/disabled addresses. |
486 |
+diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c |
487 |
+index 9d9f6f334d3c..3da3e2b1b51b 100644 |
488 |
+--- a/arch/powerpc/boot/addnote.c |
489 |
++++ b/arch/powerpc/boot/addnote.c |
490 |
+@@ -223,7 +223,11 @@ main(int ac, char **av) |
491 |
+ PUT_16(E_PHNUM, np + 2); |
492 |
+ |
493 |
+ /* write back */ |
494 |
+- lseek(fd, (long) 0, SEEK_SET); |
495 |
++ i = lseek(fd, (long) 0, SEEK_SET); |
496 |
++ if (i < 0) { |
497 |
++ perror("lseek"); |
498 |
++ exit(1); |
499 |
++ } |
500 |
+ i = write(fd, buf, n); |
501 |
+ if (i < 0) { |
502 |
+ perror("write"); |
503 |
+diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
504 |
+index 4898e9491a1c..9168a247e24f 100644 |
505 |
+--- a/arch/powerpc/kernel/head_64.S |
506 |
++++ b/arch/powerpc/kernel/head_64.S |
507 |
+@@ -970,7 +970,9 @@ start_here_multiplatform: |
508 |
+ |
509 |
+ /* Restore parameters passed from prom_init/kexec */ |
510 |
+ mr r3,r31 |
511 |
+- bl early_setup /* also sets r13 and SPRG_PACA */ |
512 |
++ LOAD_REG_ADDR(r12, DOTSYM(early_setup)) |
513 |
++ mtctr r12 |
514 |
++ bctrl /* also sets r13 and SPRG_PACA */ |
515 |
+ |
516 |
+ LOAD_REG_ADDR(r3, start_here_common) |
517 |
+ ld r4,PACAKMSR(r13) |
518 |
+diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c |
519 |
+index 3c6ab22a0c4e..af3c15a1d41e 100644 |
520 |
+--- a/arch/powerpc/kernel/watchdog.c |
521 |
++++ b/arch/powerpc/kernel/watchdog.c |
522 |
+@@ -77,7 +77,7 @@ static u64 wd_smp_panic_timeout_tb __read_mostly; /* panic other CPUs */ |
523 |
+ |
524 |
+ static u64 wd_timer_period_ms __read_mostly; /* interval between heartbeat */ |
525 |
+ |
526 |
+-static DEFINE_PER_CPU(struct timer_list, wd_timer); |
527 |
++static DEFINE_PER_CPU(struct hrtimer, wd_hrtimer); |
528 |
+ static DEFINE_PER_CPU(u64, wd_timer_tb); |
529 |
+ |
530 |
+ /* SMP checker bits */ |
531 |
+@@ -293,21 +293,21 @@ out: |
532 |
+ nmi_exit(); |
533 |
+ } |
534 |
+ |
535 |
+-static void wd_timer_reset(unsigned int cpu, struct timer_list *t) |
536 |
+-{ |
537 |
+- t->expires = jiffies + msecs_to_jiffies(wd_timer_period_ms); |
538 |
+- if (wd_timer_period_ms > 1000) |
539 |
+- t->expires = __round_jiffies_up(t->expires, cpu); |
540 |
+- add_timer_on(t, cpu); |
541 |
+-} |
542 |
+- |
543 |
+-static void wd_timer_fn(struct timer_list *t) |
544 |
++static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) |
545 |
+ { |
546 |
+ int cpu = smp_processor_id(); |
547 |
+ |
548 |
++ if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) |
549 |
++ return HRTIMER_NORESTART; |
550 |
++ |
551 |
++ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
552 |
++ return HRTIMER_NORESTART; |
553 |
++ |
554 |
+ watchdog_timer_interrupt(cpu); |
555 |
+ |
556 |
+- wd_timer_reset(cpu, t); |
557 |
++ hrtimer_forward_now(hrtimer, ms_to_ktime(wd_timer_period_ms)); |
558 |
++ |
559 |
++ return HRTIMER_RESTART; |
560 |
+ } |
561 |
+ |
562 |
+ void arch_touch_nmi_watchdog(void) |
563 |
+@@ -323,37 +323,22 @@ void arch_touch_nmi_watchdog(void) |
564 |
+ } |
565 |
+ EXPORT_SYMBOL(arch_touch_nmi_watchdog); |
566 |
+ |
567 |
+-static void start_watchdog_timer_on(unsigned int cpu) |
568 |
+-{ |
569 |
+- struct timer_list *t = per_cpu_ptr(&wd_timer, cpu); |
570 |
+- |
571 |
+- per_cpu(wd_timer_tb, cpu) = get_tb(); |
572 |
+- |
573 |
+- timer_setup(t, wd_timer_fn, TIMER_PINNED); |
574 |
+- wd_timer_reset(cpu, t); |
575 |
+-} |
576 |
+- |
577 |
+-static void stop_watchdog_timer_on(unsigned int cpu) |
578 |
+-{ |
579 |
+- struct timer_list *t = per_cpu_ptr(&wd_timer, cpu); |
580 |
+- |
581 |
+- del_timer_sync(t); |
582 |
+-} |
583 |
+- |
584 |
+-static int start_wd_on_cpu(unsigned int cpu) |
585 |
++static void start_watchdog(void *arg) |
586 |
+ { |
587 |
++ struct hrtimer *hrtimer = this_cpu_ptr(&wd_hrtimer); |
588 |
++ int cpu = smp_processor_id(); |
589 |
+ unsigned long flags; |
590 |
+ |
591 |
+ if (cpumask_test_cpu(cpu, &wd_cpus_enabled)) { |
592 |
+ WARN_ON(1); |
593 |
+- return 0; |
594 |
++ return; |
595 |
+ } |
596 |
+ |
597 |
+ if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) |
598 |
+- return 0; |
599 |
++ return; |
600 |
+ |
601 |
+ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
602 |
+- return 0; |
603 |
++ return; |
604 |
+ |
605 |
+ wd_smp_lock(&flags); |
606 |
+ cpumask_set_cpu(cpu, &wd_cpus_enabled); |
607 |
+@@ -363,27 +348,40 @@ static int start_wd_on_cpu(unsigned int cpu) |
608 |
+ } |
609 |
+ wd_smp_unlock(&flags); |
610 |
+ |
611 |
+- start_watchdog_timer_on(cpu); |
612 |
++ *this_cpu_ptr(&wd_timer_tb) = get_tb(); |
613 |
+ |
614 |
+- return 0; |
615 |
++ hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
616 |
++ hrtimer->function = watchdog_timer_fn; |
617 |
++ hrtimer_start(hrtimer, ms_to_ktime(wd_timer_period_ms), |
618 |
++ HRTIMER_MODE_REL_PINNED); |
619 |
+ } |
620 |
+ |
621 |
+-static int stop_wd_on_cpu(unsigned int cpu) |
622 |
++static int start_watchdog_on_cpu(unsigned int cpu) |
623 |
+ { |
624 |
++ return smp_call_function_single(cpu, start_watchdog, NULL, true); |
625 |
++} |
626 |
++ |
627 |
++static void stop_watchdog(void *arg) |
628 |
++{ |
629 |
++ struct hrtimer *hrtimer = this_cpu_ptr(&wd_hrtimer); |
630 |
++ int cpu = smp_processor_id(); |
631 |
+ unsigned long flags; |
632 |
+ |
633 |
+ if (!cpumask_test_cpu(cpu, &wd_cpus_enabled)) |
634 |
+- return 0; /* Can happen in CPU unplug case */ |
635 |
++ return; /* Can happen in CPU unplug case */ |
636 |
+ |
637 |
+- stop_watchdog_timer_on(cpu); |
638 |
++ hrtimer_cancel(hrtimer); |
639 |
+ |
640 |
+ wd_smp_lock(&flags); |
641 |
+ cpumask_clear_cpu(cpu, &wd_cpus_enabled); |
642 |
+ wd_smp_unlock(&flags); |
643 |
+ |
644 |
+ wd_smp_clear_cpu_pending(cpu, get_tb()); |
645 |
++} |
646 |
+ |
647 |
+- return 0; |
648 |
++static int stop_watchdog_on_cpu(unsigned int cpu) |
649 |
++{ |
650 |
++ return smp_call_function_single(cpu, stop_watchdog, NULL, true); |
651 |
+ } |
652 |
+ |
653 |
+ static void watchdog_calc_timeouts(void) |
654 |
+@@ -402,7 +400,7 @@ void watchdog_nmi_stop(void) |
655 |
+ int cpu; |
656 |
+ |
657 |
+ for_each_cpu(cpu, &wd_cpus_enabled) |
658 |
+- stop_wd_on_cpu(cpu); |
659 |
++ stop_watchdog_on_cpu(cpu); |
660 |
+ } |
661 |
+ |
662 |
+ void watchdog_nmi_start(void) |
663 |
+@@ -411,7 +409,7 @@ void watchdog_nmi_start(void) |
664 |
+ |
665 |
+ watchdog_calc_timeouts(); |
666 |
+ for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask) |
667 |
+- start_wd_on_cpu(cpu); |
668 |
++ start_watchdog_on_cpu(cpu); |
669 |
+ } |
670 |
+ |
671 |
+ /* |
672 |
+@@ -423,7 +421,8 @@ int __init watchdog_nmi_probe(void) |
673 |
+ |
674 |
+ err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, |
675 |
+ "powerpc/watchdog:online", |
676 |
+- start_wd_on_cpu, stop_wd_on_cpu); |
677 |
++ start_watchdog_on_cpu, |
678 |
++ stop_watchdog_on_cpu); |
679 |
+ if (err < 0) { |
680 |
+ pr_warn("could not be initialized"); |
681 |
+ return err; |
682 |
+diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
683 |
+index b5d1c45c1475..2a85a4bcc277 100644 |
684 |
+--- a/arch/powerpc/mm/numa.c |
685 |
++++ b/arch/powerpc/mm/numa.c |
686 |
+@@ -1494,6 +1494,9 @@ int start_topology_update(void) |
687 |
+ { |
688 |
+ int rc = 0; |
689 |
+ |
690 |
++ if (!topology_updates_enabled) |
691 |
++ return 0; |
692 |
++ |
693 |
+ if (firmware_has_feature(FW_FEATURE_PRRN)) { |
694 |
+ if (!prrn_enabled) { |
695 |
+ prrn_enabled = 1; |
696 |
+@@ -1527,6 +1530,9 @@ int stop_topology_update(void) |
697 |
+ { |
698 |
+ int rc = 0; |
699 |
+ |
700 |
++ if (!topology_updates_enabled) |
701 |
++ return 0; |
702 |
++ |
703 |
+ if (prrn_enabled) { |
704 |
+ prrn_enabled = 0; |
705 |
+ #ifdef CONFIG_SMP |
706 |
+@@ -1584,11 +1590,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf, |
707 |
+ |
708 |
+ kbuf[read_len] = '\0'; |
709 |
+ |
710 |
+- if (!strncmp(kbuf, "on", 2)) |
711 |
++ if (!strncmp(kbuf, "on", 2)) { |
712 |
++ topology_updates_enabled = true; |
713 |
+ start_topology_update(); |
714 |
+- else if (!strncmp(kbuf, "off", 3)) |
715 |
++ } else if (!strncmp(kbuf, "off", 3)) { |
716 |
+ stop_topology_update(); |
717 |
+- else |
718 |
++ topology_updates_enabled = false; |
719 |
++ } else |
720 |
+ return -EINVAL; |
721 |
+ |
722 |
+ return count; |
723 |
+@@ -1603,9 +1611,7 @@ static const struct file_operations topology_ops = { |
724 |
+ |
725 |
+ static int topology_update_init(void) |
726 |
+ { |
727 |
+- /* Do not poll for changes if disabled at boot */ |
728 |
+- if (topology_updates_enabled) |
729 |
+- start_topology_update(); |
730 |
++ start_topology_update(); |
731 |
+ |
732 |
+ if (vphn_enabled) |
733 |
+ topology_schedule_update(); |
734 |
+diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c |
735 |
+index f292a3f284f1..d1009fe3130b 100644 |
736 |
+--- a/arch/powerpc/perf/imc-pmu.c |
737 |
++++ b/arch/powerpc/perf/imc-pmu.c |
738 |
+@@ -496,6 +496,11 @@ static int nest_imc_event_init(struct perf_event *event) |
739 |
+ * Get the base memory addresss for this cpu. |
740 |
+ */ |
741 |
+ chip_id = cpu_to_chip_id(event->cpu); |
742 |
++ |
743 |
++ /* Return, if chip_id is not valid */ |
744 |
++ if (chip_id < 0) |
745 |
++ return -ENODEV; |
746 |
++ |
747 |
+ pcni = pmu->mem_info; |
748 |
+ do { |
749 |
+ if (pcni->id == chip_id) { |
750 |
+@@ -503,7 +508,7 @@ static int nest_imc_event_init(struct perf_event *event) |
751 |
+ break; |
752 |
+ } |
753 |
+ pcni++; |
754 |
+- } while (pcni); |
755 |
++ } while (pcni->vbase != 0); |
756 |
+ |
757 |
+ if (!flag) |
758 |
+ return -ENODEV; |
759 |
+diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c |
760 |
+index 58a07948c76e..3d27f02695e4 100644 |
761 |
+--- a/arch/powerpc/platforms/powernv/opal-imc.c |
762 |
++++ b/arch/powerpc/platforms/powernv/opal-imc.c |
763 |
+@@ -127,7 +127,7 @@ static int imc_get_mem_addr_nest(struct device_node *node, |
764 |
+ nr_chips)) |
765 |
+ goto error; |
766 |
+ |
767 |
+- pmu_ptr->mem_info = kcalloc(nr_chips, sizeof(*pmu_ptr->mem_info), |
768 |
++ pmu_ptr->mem_info = kcalloc(nr_chips + 1, sizeof(*pmu_ptr->mem_info), |
769 |
+ GFP_KERNEL); |
770 |
+ if (!pmu_ptr->mem_info) |
771 |
+ goto error; |
772 |
+diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c |
773 |
+index 5a286b012043..602e7cc26d11 100644 |
774 |
+--- a/arch/s390/kernel/kexec_elf.c |
775 |
++++ b/arch/s390/kernel/kexec_elf.c |
776 |
+@@ -19,10 +19,15 @@ static int kexec_file_add_elf_kernel(struct kimage *image, |
777 |
+ struct kexec_buf buf; |
778 |
+ const Elf_Ehdr *ehdr; |
779 |
+ const Elf_Phdr *phdr; |
780 |
++ Elf_Addr entry; |
781 |
+ int i, ret; |
782 |
+ |
783 |
+ ehdr = (Elf_Ehdr *)kernel; |
784 |
+ buf.image = image; |
785 |
++ if (image->type == KEXEC_TYPE_CRASH) |
786 |
++ entry = STARTUP_KDUMP_OFFSET; |
787 |
++ else |
788 |
++ entry = ehdr->e_entry; |
789 |
+ |
790 |
+ phdr = (void *)ehdr + ehdr->e_phoff; |
791 |
+ for (i = 0; i < ehdr->e_phnum; i++, phdr++) { |
792 |
+@@ -35,7 +40,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image, |
793 |
+ buf.mem = ALIGN(phdr->p_paddr, phdr->p_align); |
794 |
+ buf.memsz = phdr->p_memsz; |
795 |
+ |
796 |
+- if (phdr->p_paddr == 0) { |
797 |
++ if (entry - phdr->p_paddr < phdr->p_memsz) { |
798 |
+ data->kernel_buf = buf.buffer; |
799 |
+ data->memsz += STARTUP_NORMAL_OFFSET; |
800 |
+ |
801 |
+diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c |
802 |
+index f2cc7da473e4..ae894ac83fd6 100644 |
803 |
+--- a/arch/s390/mm/pgtable.c |
804 |
++++ b/arch/s390/mm/pgtable.c |
805 |
+@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm, |
806 |
+ return old; |
807 |
+ } |
808 |
+ |
809 |
++#ifdef CONFIG_PGSTE |
810 |
+ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) |
811 |
+ { |
812 |
+ pgd_t *pgd; |
813 |
+@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) |
814 |
+ pmd = pmd_alloc(mm, pud, addr); |
815 |
+ return pmd; |
816 |
+ } |
817 |
++#endif |
818 |
+ |
819 |
+ pmd_t pmdp_xchg_direct(struct mm_struct *mm, unsigned long addr, |
820 |
+ pmd_t *pmdp, pmd_t new) |
821 |
+diff --git a/arch/sh/include/cpu-sh4/cpu/sh7786.h b/arch/sh/include/cpu-sh4/cpu/sh7786.h |
822 |
+index 8f9bfbf3cdb1..d6cce65b4871 100644 |
823 |
+--- a/arch/sh/include/cpu-sh4/cpu/sh7786.h |
824 |
++++ b/arch/sh/include/cpu-sh4/cpu/sh7786.h |
825 |
+@@ -132,7 +132,7 @@ enum { |
826 |
+ |
827 |
+ static inline u32 sh7786_mm_sel(void) |
828 |
+ { |
829 |
+- return __raw_readl(0xFC400020) & 0x7; |
830 |
++ return __raw_readl((const volatile void __iomem *)0xFC400020) & 0x7; |
831 |
+ } |
832 |
+ |
833 |
+ #endif /* __CPU_SH7786_H__ */ |
834 |
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
835 |
+index c0c7291d4ccf..2cf52617a1e7 100644 |
836 |
+--- a/arch/x86/Makefile |
837 |
++++ b/arch/x86/Makefile |
838 |
+@@ -47,7 +47,7 @@ export REALMODE_CFLAGS |
839 |
+ export BITS |
840 |
+ |
841 |
+ ifdef CONFIG_X86_NEED_RELOCS |
842 |
+- LDFLAGS_vmlinux := --emit-relocs |
843 |
++ LDFLAGS_vmlinux := --emit-relocs --discard-none |
844 |
+ endif |
845 |
+ |
846 |
+ # |
847 |
+diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c |
848 |
+index 56194c571299..4a650eb3d94a 100644 |
849 |
+--- a/arch/x86/events/intel/cstate.c |
850 |
++++ b/arch/x86/events/intel/cstate.c |
851 |
+@@ -584,6 +584,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { |
852 |
+ X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_X, glm_cstates), |
853 |
+ |
854 |
+ X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), |
855 |
++ |
856 |
++ X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_MOBILE, snb_cstates), |
857 |
+ { }, |
858 |
+ }; |
859 |
+ MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match); |
860 |
+diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c |
861 |
+index 91039ffed633..2413169ce362 100644 |
862 |
+--- a/arch/x86/events/intel/rapl.c |
863 |
++++ b/arch/x86/events/intel/rapl.c |
864 |
+@@ -780,6 +780,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst = { |
865 |
+ X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT_X, hsw_rapl_init), |
866 |
+ |
867 |
+ X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT_PLUS, hsw_rapl_init), |
868 |
++ |
869 |
++ X86_RAPL_MODEL_MATCH(INTEL_FAM6_ICELAKE_MOBILE, skl_rapl_init), |
870 |
+ {}, |
871 |
+ }; |
872 |
+ |
873 |
+diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c |
874 |
+index 1b9f85abf9bc..ace6c1e752fb 100644 |
875 |
+--- a/arch/x86/events/msr.c |
876 |
++++ b/arch/x86/events/msr.c |
877 |
+@@ -89,6 +89,7 @@ static bool test_intel(int idx) |
878 |
+ case INTEL_FAM6_SKYLAKE_X: |
879 |
+ case INTEL_FAM6_KABYLAKE_MOBILE: |
880 |
+ case INTEL_FAM6_KABYLAKE_DESKTOP: |
881 |
++ case INTEL_FAM6_ICELAKE_MOBILE: |
882 |
+ if (idx == PERF_MSR_SMI || idx == PERF_MSR_PPERF) |
883 |
+ return true; |
884 |
+ break; |
885 |
+diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c |
886 |
+index 321fe5f5d0e9..4d5fcd47ab75 100644 |
887 |
+--- a/arch/x86/ia32/ia32_signal.c |
888 |
++++ b/arch/x86/ia32/ia32_signal.c |
889 |
+@@ -61,9 +61,8 @@ |
890 |
+ } while (0) |
891 |
+ |
892 |
+ #define RELOAD_SEG(seg) { \ |
893 |
+- unsigned int pre = GET_SEG(seg); \ |
894 |
++ unsigned int pre = (seg) | 3; \ |
895 |
+ unsigned int cur = get_user_seg(seg); \ |
896 |
+- pre |= 3; \ |
897 |
+ if (pre != cur) \ |
898 |
+ set_user_seg(seg, pre); \ |
899 |
+ } |
900 |
+@@ -72,6 +71,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
901 |
+ struct sigcontext_32 __user *sc) |
902 |
+ { |
903 |
+ unsigned int tmpflags, err = 0; |
904 |
++ u16 gs, fs, es, ds; |
905 |
+ void __user *buf; |
906 |
+ u32 tmp; |
907 |
+ |
908 |
+@@ -79,16 +79,10 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
909 |
+ current->restart_block.fn = do_no_restart_syscall; |
910 |
+ |
911 |
+ get_user_try { |
912 |
+- /* |
913 |
+- * Reload fs and gs if they have changed in the signal |
914 |
+- * handler. This does not handle long fs/gs base changes in |
915 |
+- * the handler, but does not clobber them at least in the |
916 |
+- * normal case. |
917 |
+- */ |
918 |
+- RELOAD_SEG(gs); |
919 |
+- RELOAD_SEG(fs); |
920 |
+- RELOAD_SEG(ds); |
921 |
+- RELOAD_SEG(es); |
922 |
++ gs = GET_SEG(gs); |
923 |
++ fs = GET_SEG(fs); |
924 |
++ ds = GET_SEG(ds); |
925 |
++ es = GET_SEG(es); |
926 |
+ |
927 |
+ COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
928 |
+ COPY(dx); COPY(cx); COPY(ip); COPY(ax); |
929 |
+@@ -106,6 +100,17 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
930 |
+ buf = compat_ptr(tmp); |
931 |
+ } get_user_catch(err); |
932 |
+ |
933 |
++ /* |
934 |
++ * Reload fs and gs if they have changed in the signal |
935 |
++ * handler. This does not handle long fs/gs base changes in |
936 |
++ * the handler, but does not clobber them at least in the |
937 |
++ * normal case. |
938 |
++ */ |
939 |
++ RELOAD_SEG(gs); |
940 |
++ RELOAD_SEG(fs); |
941 |
++ RELOAD_SEG(ds); |
942 |
++ RELOAD_SEG(es); |
943 |
++ |
944 |
+ err |= fpu__restore_sig(buf, 1); |
945 |
+ |
946 |
+ force_iret(); |
947 |
+diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h |
948 |
+index 05861cc08787..0bbb07eaed6b 100644 |
949 |
+--- a/arch/x86/include/asm/text-patching.h |
950 |
++++ b/arch/x86/include/asm/text-patching.h |
951 |
+@@ -39,6 +39,7 @@ extern int poke_int3_handler(struct pt_regs *regs); |
952 |
+ extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler); |
953 |
+ extern int after_bootmem; |
954 |
+ |
955 |
++#ifndef CONFIG_UML_X86 |
956 |
+ static inline void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip) |
957 |
+ { |
958 |
+ regs->ip = ip; |
959 |
+@@ -65,6 +66,7 @@ static inline void int3_emulate_call(struct pt_regs *regs, unsigned long func) |
960 |
+ int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE); |
961 |
+ int3_emulate_jmp(regs, func); |
962 |
+ } |
963 |
+-#endif |
964 |
++#endif /* CONFIG_X86_64 */ |
965 |
++#endif /* !CONFIG_UML_X86 */ |
966 |
+ |
967 |
+ #endif /* _ASM_X86_TEXT_PATCHING_H */ |
968 |
+diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h |
969 |
+index f3aed639dccd..2b0dd1b9c208 100644 |
970 |
+--- a/arch/x86/include/asm/uaccess.h |
971 |
++++ b/arch/x86/include/asm/uaccess.h |
972 |
+@@ -431,10 +431,11 @@ do { \ |
973 |
+ ({ \ |
974 |
+ __label__ __pu_label; \ |
975 |
+ int __pu_err = -EFAULT; \ |
976 |
+- __typeof__(*(ptr)) __pu_val; \ |
977 |
+- __pu_val = x; \ |
978 |
++ __typeof__(*(ptr)) __pu_val = (x); \ |
979 |
++ __typeof__(ptr) __pu_ptr = (ptr); \ |
980 |
++ __typeof__(size) __pu_size = (size); \ |
981 |
+ __uaccess_begin(); \ |
982 |
+- __put_user_size(__pu_val, (ptr), (size), __pu_label); \ |
983 |
++ __put_user_size(__pu_val, __pu_ptr, __pu_size, __pu_label); \ |
984 |
+ __pu_err = 0; \ |
985 |
+ __pu_label: \ |
986 |
+ __uaccess_end(); \ |
987 |
+diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c |
988 |
+index ebeac487a20c..2db985513917 100644 |
989 |
+--- a/arch/x86/kernel/alternative.c |
990 |
++++ b/arch/x86/kernel/alternative.c |
991 |
+@@ -666,15 +666,29 @@ void __init alternative_instructions(void) |
992 |
+ * handlers seeing an inconsistent instruction while you patch. |
993 |
+ */ |
994 |
+ void *__init_or_module text_poke_early(void *addr, const void *opcode, |
995 |
+- size_t len) |
996 |
++ size_t len) |
997 |
+ { |
998 |
+ unsigned long flags; |
999 |
+- local_irq_save(flags); |
1000 |
+- memcpy(addr, opcode, len); |
1001 |
+- local_irq_restore(flags); |
1002 |
+- sync_core(); |
1003 |
+- /* Could also do a CLFLUSH here to speed up CPU recovery; but |
1004 |
+- that causes hangs on some VIA CPUs. */ |
1005 |
++ |
1006 |
++ if (boot_cpu_has(X86_FEATURE_NX) && |
1007 |
++ is_module_text_address((unsigned long)addr)) { |
1008 |
++ /* |
1009 |
++ * Modules text is marked initially as non-executable, so the |
1010 |
++ * code cannot be running and speculative code-fetches are |
1011 |
++ * prevented. Just change the code. |
1012 |
++ */ |
1013 |
++ memcpy(addr, opcode, len); |
1014 |
++ } else { |
1015 |
++ local_irq_save(flags); |
1016 |
++ memcpy(addr, opcode, len); |
1017 |
++ local_irq_restore(flags); |
1018 |
++ sync_core(); |
1019 |
++ |
1020 |
++ /* |
1021 |
++ * Could also do a CLFLUSH here to speed up CPU recovery; but |
1022 |
++ * that causes hangs on some VIA CPUs. |
1023 |
++ */ |
1024 |
++ } |
1025 |
+ return addr; |
1026 |
+ } |
1027 |
+ |
1028 |
+diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c |
1029 |
+index cf25405444ab..415621ddb8a2 100644 |
1030 |
+--- a/arch/x86/kernel/cpu/hygon.c |
1031 |
++++ b/arch/x86/kernel/cpu/hygon.c |
1032 |
+@@ -19,6 +19,8 @@ |
1033 |
+ |
1034 |
+ #include "cpu.h" |
1035 |
+ |
1036 |
++#define APICID_SOCKET_ID_BIT 6 |
1037 |
++ |
1038 |
+ /* |
1039 |
+ * nodes_per_socket: Stores the number of nodes per socket. |
1040 |
+ * Refer to CPUID Fn8000_001E_ECX Node Identifiers[10:8] |
1041 |
+@@ -87,6 +89,9 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) |
1042 |
+ if (!err) |
1043 |
+ c->x86_coreid_bits = get_count_order(c->x86_max_cores); |
1044 |
+ |
1045 |
++ /* Socket ID is ApicId[6] for these processors. */ |
1046 |
++ c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; |
1047 |
++ |
1048 |
+ cacheinfo_hygon_init_llc_id(c, cpu, node_id); |
1049 |
+ } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
1050 |
+ u64 value; |
1051 |
+diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c |
1052 |
+index 1a7084ba9a3b..9e6a94c208e0 100644 |
1053 |
+--- a/arch/x86/kernel/cpu/mce/core.c |
1054 |
++++ b/arch/x86/kernel/cpu/mce/core.c |
1055 |
+@@ -712,19 +712,49 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b) |
1056 |
+ |
1057 |
+ barrier(); |
1058 |
+ m.status = mce_rdmsrl(msr_ops.status(i)); |
1059 |
++ |
1060 |
++ /* If this entry is not valid, ignore it */ |
1061 |
+ if (!(m.status & MCI_STATUS_VAL)) |
1062 |
+ continue; |
1063 |
+ |
1064 |
+ /* |
1065 |
+- * Uncorrected or signalled events are handled by the exception |
1066 |
+- * handler when it is enabled, so don't process those here. |
1067 |
+- * |
1068 |
+- * TBD do the same check for MCI_STATUS_EN here? |
1069 |
++ * If we are logging everything (at CPU online) or this |
1070 |
++ * is a corrected error, then we must log it. |
1071 |
+ */ |
1072 |
+- if (!(flags & MCP_UC) && |
1073 |
+- (m.status & (mca_cfg.ser ? MCI_STATUS_S : MCI_STATUS_UC))) |
1074 |
+- continue; |
1075 |
++ if ((flags & MCP_UC) || !(m.status & MCI_STATUS_UC)) |
1076 |
++ goto log_it; |
1077 |
++ |
1078 |
++ /* |
1079 |
++ * Newer Intel systems that support software error |
1080 |
++ * recovery need to make additional checks. Other |
1081 |
++ * CPUs should skip over uncorrected errors, but log |
1082 |
++ * everything else. |
1083 |
++ */ |
1084 |
++ if (!mca_cfg.ser) { |
1085 |
++ if (m.status & MCI_STATUS_UC) |
1086 |
++ continue; |
1087 |
++ goto log_it; |
1088 |
++ } |
1089 |
++ |
1090 |
++ /* Log "not enabled" (speculative) errors */ |
1091 |
++ if (!(m.status & MCI_STATUS_EN)) |
1092 |
++ goto log_it; |
1093 |
++ |
1094 |
++ /* |
1095 |
++ * Log UCNA (SDM: 15.6.3 "UCR Error Classification") |
1096 |
++ * UC == 1 && PCC == 0 && S == 0 |
1097 |
++ */ |
1098 |
++ if (!(m.status & MCI_STATUS_PCC) && !(m.status & MCI_STATUS_S)) |
1099 |
++ goto log_it; |
1100 |
++ |
1101 |
++ /* |
1102 |
++ * Skip anything else. Presumption is that our read of this |
1103 |
++ * bank is racing with a machine check. Leave the log alone |
1104 |
++ * for do_machine_check() to deal with it. |
1105 |
++ */ |
1106 |
++ continue; |
1107 |
+ |
1108 |
++log_it: |
1109 |
+ error_seen = true; |
1110 |
+ |
1111 |
+ mce_read_aux(&m, i); |
1112 |
+@@ -1451,13 +1481,12 @@ EXPORT_SYMBOL_GPL(mce_notify_irq); |
1113 |
+ static int __mcheck_cpu_mce_banks_init(void) |
1114 |
+ { |
1115 |
+ int i; |
1116 |
+- u8 num_banks = mca_cfg.banks; |
1117 |
+ |
1118 |
+- mce_banks = kcalloc(num_banks, sizeof(struct mce_bank), GFP_KERNEL); |
1119 |
++ mce_banks = kcalloc(MAX_NR_BANKS, sizeof(struct mce_bank), GFP_KERNEL); |
1120 |
+ if (!mce_banks) |
1121 |
+ return -ENOMEM; |
1122 |
+ |
1123 |
+- for (i = 0; i < num_banks; i++) { |
1124 |
++ for (i = 0; i < MAX_NR_BANKS; i++) { |
1125 |
+ struct mce_bank *b = &mce_banks[i]; |
1126 |
+ |
1127 |
+ b->ctl = -1ULL; |
1128 |
+@@ -1471,28 +1500,19 @@ static int __mcheck_cpu_mce_banks_init(void) |
1129 |
+ */ |
1130 |
+ static int __mcheck_cpu_cap_init(void) |
1131 |
+ { |
1132 |
+- unsigned b; |
1133 |
+ u64 cap; |
1134 |
++ u8 b; |
1135 |
+ |
1136 |
+ rdmsrl(MSR_IA32_MCG_CAP, cap); |
1137 |
+ |
1138 |
+ b = cap & MCG_BANKCNT_MASK; |
1139 |
+- if (!mca_cfg.banks) |
1140 |
+- pr_info("CPU supports %d MCE banks\n", b); |
1141 |
+- |
1142 |
+- if (b > MAX_NR_BANKS) { |
1143 |
+- pr_warn("Using only %u machine check banks out of %u\n", |
1144 |
+- MAX_NR_BANKS, b); |
1145 |
++ if (WARN_ON_ONCE(b > MAX_NR_BANKS)) |
1146 |
+ b = MAX_NR_BANKS; |
1147 |
+- } |
1148 |
+ |
1149 |
+- /* Don't support asymmetric configurations today */ |
1150 |
+- WARN_ON(mca_cfg.banks != 0 && b != mca_cfg.banks); |
1151 |
+- mca_cfg.banks = b; |
1152 |
++ mca_cfg.banks = max(mca_cfg.banks, b); |
1153 |
+ |
1154 |
+ if (!mce_banks) { |
1155 |
+ int err = __mcheck_cpu_mce_banks_init(); |
1156 |
+- |
1157 |
+ if (err) |
1158 |
+ return err; |
1159 |
+ } |
1160 |
+@@ -2459,6 +2479,8 @@ EXPORT_SYMBOL_GPL(mcsafe_key); |
1161 |
+ |
1162 |
+ static int __init mcheck_late_init(void) |
1163 |
+ { |
1164 |
++ pr_info("Using %d MCE banks\n", mca_cfg.banks); |
1165 |
++ |
1166 |
+ if (mca_cfg.recovery) |
1167 |
+ static_branch_inc(&mcsafe_key); |
1168 |
+ |
1169 |
+diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c |
1170 |
+index 8492ef7d9015..3f82afd0f46f 100644 |
1171 |
+--- a/arch/x86/kernel/cpu/mce/inject.c |
1172 |
++++ b/arch/x86/kernel/cpu/mce/inject.c |
1173 |
+@@ -46,8 +46,6 @@ |
1174 |
+ static struct mce i_mce; |
1175 |
+ static struct dentry *dfs_inj; |
1176 |
+ |
1177 |
+-static u8 n_banks; |
1178 |
+- |
1179 |
+ #define MAX_FLAG_OPT_SIZE 4 |
1180 |
+ #define NBCFG 0x44 |
1181 |
+ |
1182 |
+@@ -570,9 +568,15 @@ err: |
1183 |
+ static int inj_bank_set(void *data, u64 val) |
1184 |
+ { |
1185 |
+ struct mce *m = (struct mce *)data; |
1186 |
++ u8 n_banks; |
1187 |
++ u64 cap; |
1188 |
++ |
1189 |
++ /* Get bank count on target CPU so we can handle non-uniform values. */ |
1190 |
++ rdmsrl_on_cpu(m->extcpu, MSR_IA32_MCG_CAP, &cap); |
1191 |
++ n_banks = cap & MCG_BANKCNT_MASK; |
1192 |
+ |
1193 |
+ if (val >= n_banks) { |
1194 |
+- pr_err("Non-existent MCE bank: %llu\n", val); |
1195 |
++ pr_err("MCA bank %llu non-existent on CPU%d\n", val, m->extcpu); |
1196 |
+ return -EINVAL; |
1197 |
+ } |
1198 |
+ |
1199 |
+@@ -665,10 +669,6 @@ static struct dfs_node { |
1200 |
+ static int __init debugfs_init(void) |
1201 |
+ { |
1202 |
+ unsigned int i; |
1203 |
+- u64 cap; |
1204 |
+- |
1205 |
+- rdmsrl(MSR_IA32_MCG_CAP, cap); |
1206 |
+- n_banks = cap & MCG_BANKCNT_MASK; |
1207 |
+ |
1208 |
+ dfs_inj = debugfs_create_dir("mce-inject", NULL); |
1209 |
+ if (!dfs_inj) |
1210 |
+diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c |
1211 |
+index 97f9ada9ceda..fc70d39b804f 100644 |
1212 |
+--- a/arch/x86/kernel/cpu/microcode/core.c |
1213 |
++++ b/arch/x86/kernel/cpu/microcode/core.c |
1214 |
+@@ -418,8 +418,9 @@ static int do_microcode_update(const void __user *buf, size_t size) |
1215 |
+ if (ustate == UCODE_ERROR) { |
1216 |
+ error = -1; |
1217 |
+ break; |
1218 |
+- } else if (ustate == UCODE_OK) |
1219 |
++ } else if (ustate == UCODE_NEW) { |
1220 |
+ apply_microcode_on_target(cpu); |
1221 |
++ } |
1222 |
+ } |
1223 |
+ |
1224 |
+ return error; |
1225 |
+diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c |
1226 |
+index 2ee4b12a70e8..becb075954aa 100644 |
1227 |
+--- a/arch/x86/kernel/ftrace.c |
1228 |
++++ b/arch/x86/kernel/ftrace.c |
1229 |
+@@ -748,6 +748,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) |
1230 |
+ unsigned long end_offset; |
1231 |
+ unsigned long op_offset; |
1232 |
+ unsigned long offset; |
1233 |
++ unsigned long npages; |
1234 |
+ unsigned long size; |
1235 |
+ unsigned long retq; |
1236 |
+ unsigned long *ptr; |
1237 |
+@@ -780,6 +781,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) |
1238 |
+ return 0; |
1239 |
+ |
1240 |
+ *tramp_size = size + RET_SIZE + sizeof(void *); |
1241 |
++ npages = DIV_ROUND_UP(*tramp_size, PAGE_SIZE); |
1242 |
+ |
1243 |
+ /* Copy ftrace_caller onto the trampoline memory */ |
1244 |
+ ret = probe_kernel_read(trampoline, (void *)start_offset, size); |
1245 |
+@@ -824,6 +826,12 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) |
1246 |
+ /* ALLOC_TRAMP flags lets us know we created it */ |
1247 |
+ ops->flags |= FTRACE_OPS_FL_ALLOC_TRAMP; |
1248 |
+ |
1249 |
++ /* |
1250 |
++ * Module allocation needs to be completed by making the page |
1251 |
++ * executable. The page is still writable, which is a security hazard, |
1252 |
++ * but anyhow ftrace breaks W^X completely. |
1253 |
++ */ |
1254 |
++ set_memory_x((unsigned long)trampoline, npages); |
1255 |
+ return (unsigned long)trampoline; |
1256 |
+ fail: |
1257 |
+ tramp_free(trampoline, *tramp_size); |
1258 |
+diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c |
1259 |
+index 0469cd078db1..b50ac9c7397b 100644 |
1260 |
+--- a/arch/x86/kernel/irq_64.c |
1261 |
++++ b/arch/x86/kernel/irq_64.c |
1262 |
+@@ -26,9 +26,18 @@ int sysctl_panic_on_stackoverflow; |
1263 |
+ /* |
1264 |
+ * Probabilistic stack overflow check: |
1265 |
+ * |
1266 |
+- * Only check the stack in process context, because everything else |
1267 |
+- * runs on the big interrupt stacks. Checking reliably is too expensive, |
1268 |
+- * so we just check from interrupts. |
1269 |
++ * Regular device interrupts can enter on the following stacks: |
1270 |
++ * |
1271 |
++ * - User stack |
1272 |
++ * |
1273 |
++ * - Kernel task stack |
1274 |
++ * |
1275 |
++ * - Interrupt stack if a device driver reenables interrupts |
1276 |
++ * which should only happen in really old drivers. |
1277 |
++ * |
1278 |
++ * - Debug IST stack |
1279 |
++ * |
1280 |
++ * All other contexts are invalid. |
1281 |
+ */ |
1282 |
+ static inline void stack_overflow_check(struct pt_regs *regs) |
1283 |
+ { |
1284 |
+@@ -53,8 +62,8 @@ static inline void stack_overflow_check(struct pt_regs *regs) |
1285 |
+ return; |
1286 |
+ |
1287 |
+ oist = this_cpu_ptr(&orig_ist); |
1288 |
+- estack_top = (u64)oist->ist[0] - EXCEPTION_STKSZ + STACK_TOP_MARGIN; |
1289 |
+- estack_bottom = (u64)oist->ist[N_EXCEPTION_STACKS - 1]; |
1290 |
++ estack_bottom = (u64)oist->ist[DEBUG_STACK]; |
1291 |
++ estack_top = estack_bottom - DEBUG_STKSZ + STACK_TOP_MARGIN; |
1292 |
+ if (regs->sp >= estack_top && regs->sp <= estack_bottom) |
1293 |
+ return; |
1294 |
+ |
1295 |
+diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c |
1296 |
+index b052e883dd8c..cfa3106faee4 100644 |
1297 |
+--- a/arch/x86/kernel/module.c |
1298 |
++++ b/arch/x86/kernel/module.c |
1299 |
+@@ -87,7 +87,7 @@ void *module_alloc(unsigned long size) |
1300 |
+ p = __vmalloc_node_range(size, MODULE_ALIGN, |
1301 |
+ MODULES_VADDR + get_module_load_offset(), |
1302 |
+ MODULES_END, GFP_KERNEL, |
1303 |
+- PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, |
1304 |
++ PAGE_KERNEL, 0, NUMA_NO_NODE, |
1305 |
+ __builtin_return_address(0)); |
1306 |
+ if (p && (kasan_module_alloc(p, size) < 0)) { |
1307 |
+ vfree(p); |
1308 |
+diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c |
1309 |
+index 08dfd4c1a4f9..c8aa58a2bab9 100644 |
1310 |
+--- a/arch/x86/kernel/signal.c |
1311 |
++++ b/arch/x86/kernel/signal.c |
1312 |
+@@ -132,16 +132,6 @@ static int restore_sigcontext(struct pt_regs *regs, |
1313 |
+ COPY_SEG_CPL3(cs); |
1314 |
+ COPY_SEG_CPL3(ss); |
1315 |
+ |
1316 |
+-#ifdef CONFIG_X86_64 |
1317 |
+- /* |
1318 |
+- * Fix up SS if needed for the benefit of old DOSEMU and |
1319 |
+- * CRIU. |
1320 |
+- */ |
1321 |
+- if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && |
1322 |
+- user_64bit_mode(regs))) |
1323 |
+- force_valid_ss(regs); |
1324 |
+-#endif |
1325 |
+- |
1326 |
+ get_user_ex(tmpflags, &sc->flags); |
1327 |
+ regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
1328 |
+ regs->orig_ax = -1; /* disable syscall checks */ |
1329 |
+@@ -150,6 +140,15 @@ static int restore_sigcontext(struct pt_regs *regs, |
1330 |
+ buf = (void __user *)buf_val; |
1331 |
+ } get_user_catch(err); |
1332 |
+ |
1333 |
++#ifdef CONFIG_X86_64 |
1334 |
++ /* |
1335 |
++ * Fix up SS if needed for the benefit of old DOSEMU and |
1336 |
++ * CRIU. |
1337 |
++ */ |
1338 |
++ if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && user_64bit_mode(regs))) |
1339 |
++ force_valid_ss(regs); |
1340 |
++#endif |
1341 |
++ |
1342 |
+ err |= fpu__restore_sig(buf, IS_ENABLED(CONFIG_X86_32)); |
1343 |
+ |
1344 |
+ force_iret(); |
1345 |
+@@ -461,6 +460,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, |
1346 |
+ { |
1347 |
+ struct rt_sigframe __user *frame; |
1348 |
+ void __user *fp = NULL; |
1349 |
++ unsigned long uc_flags; |
1350 |
+ int err = 0; |
1351 |
+ |
1352 |
+ frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp); |
1353 |
+@@ -473,9 +473,11 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, |
1354 |
+ return -EFAULT; |
1355 |
+ } |
1356 |
+ |
1357 |
++ uc_flags = frame_uc_flags(regs); |
1358 |
++ |
1359 |
+ put_user_try { |
1360 |
+ /* Create the ucontext. */ |
1361 |
+- put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags); |
1362 |
++ put_user_ex(uc_flags, &frame->uc.uc_flags); |
1363 |
+ put_user_ex(0, &frame->uc.uc_link); |
1364 |
+ save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
1365 |
+ |
1366 |
+@@ -541,6 +543,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig, |
1367 |
+ { |
1368 |
+ #ifdef CONFIG_X86_X32_ABI |
1369 |
+ struct rt_sigframe_x32 __user *frame; |
1370 |
++ unsigned long uc_flags; |
1371 |
+ void __user *restorer; |
1372 |
+ int err = 0; |
1373 |
+ void __user *fpstate = NULL; |
1374 |
+@@ -555,9 +558,11 @@ static int x32_setup_rt_frame(struct ksignal *ksig, |
1375 |
+ return -EFAULT; |
1376 |
+ } |
1377 |
+ |
1378 |
++ uc_flags = frame_uc_flags(regs); |
1379 |
++ |
1380 |
+ put_user_try { |
1381 |
+ /* Create the ucontext. */ |
1382 |
+- put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags); |
1383 |
++ put_user_ex(uc_flags, &frame->uc.uc_flags); |
1384 |
+ put_user_ex(0, &frame->uc.uc_link); |
1385 |
+ compat_save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
1386 |
+ put_user_ex(0, &frame->uc.uc__pad0); |
1387 |
+diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S |
1388 |
+index c45214c44e61..5cbce783d4d1 100644 |
1389 |
+--- a/arch/x86/kernel/vmlinux.lds.S |
1390 |
++++ b/arch/x86/kernel/vmlinux.lds.S |
1391 |
+@@ -141,11 +141,11 @@ SECTIONS |
1392 |
+ *(.text.__x86.indirect_thunk) |
1393 |
+ __indirect_thunk_end = .; |
1394 |
+ #endif |
1395 |
+- |
1396 |
+- /* End of text section */ |
1397 |
+- _etext = .; |
1398 |
+ } :text = 0x9090 |
1399 |
+ |
1400 |
++ /* End of text section */ |
1401 |
++ _etext = .; |
1402 |
++ |
1403 |
+ NOTES :text :note |
1404 |
+ |
1405 |
+ EXCEPTION_TABLE(16) :text = 0x9090 |
1406 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
1407 |
+index 2a07e43ee666..847db4bd1dc5 100644 |
1408 |
+--- a/arch/x86/kvm/svm.c |
1409 |
++++ b/arch/x86/kvm/svm.c |
1410 |
+@@ -2020,7 +2020,11 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
1411 |
+ if (!kvm_vcpu_apicv_active(vcpu)) |
1412 |
+ return; |
1413 |
+ |
1414 |
+- if (WARN_ON(h_physical_id >= AVIC_MAX_PHYSICAL_ID_COUNT)) |
1415 |
++ /* |
1416 |
++ * Since the host physical APIC id is 8 bits, |
1417 |
++ * we can support host APIC ID upto 255. |
1418 |
++ */ |
1419 |
++ if (WARN_ON(h_physical_id > AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK)) |
1420 |
+ return; |
1421 |
+ |
1422 |
+ entry = READ_ONCE(*(svm->avic_physical_id_cache)); |
1423 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1424 |
+index 0bbb21a49082..03b5c5803b5c 100644 |
1425 |
+--- a/arch/x86/kvm/x86.c |
1426 |
++++ b/arch/x86/kvm/x86.c |
1427 |
+@@ -1288,7 +1288,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
1428 |
+ u64 efer = msr_info->data; |
1429 |
+ |
1430 |
+ if (efer & efer_reserved_bits) |
1431 |
+- return false; |
1432 |
++ return 1; |
1433 |
+ |
1434 |
+ if (!msr_info->host_initiated) { |
1435 |
+ if (!__kvm_valid_efer(vcpu, efer)) |
1436 |
+diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S |
1437 |
+index 3b24dc05251c..9d05572370ed 100644 |
1438 |
+--- a/arch/x86/lib/memcpy_64.S |
1439 |
++++ b/arch/x86/lib/memcpy_64.S |
1440 |
+@@ -257,6 +257,7 @@ ENTRY(__memcpy_mcsafe) |
1441 |
+ /* Copy successful. Return zero */ |
1442 |
+ .L_done_memcpy_trap: |
1443 |
+ xorl %eax, %eax |
1444 |
++.L_done: |
1445 |
+ ret |
1446 |
+ ENDPROC(__memcpy_mcsafe) |
1447 |
+ EXPORT_SYMBOL_GPL(__memcpy_mcsafe) |
1448 |
+@@ -273,7 +274,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe) |
1449 |
+ addl %edx, %ecx |
1450 |
+ .E_trailing_bytes: |
1451 |
+ mov %ecx, %eax |
1452 |
+- ret |
1453 |
++ jmp .L_done |
1454 |
+ |
1455 |
+ /* |
1456 |
+ * For write fault handling, given the destination is unaligned, |
1457 |
+diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c |
1458 |
+index 9d5c75f02295..55233dec5ff4 100644 |
1459 |
+--- a/arch/x86/mm/fault.c |
1460 |
++++ b/arch/x86/mm/fault.c |
1461 |
+@@ -359,8 +359,6 @@ static noinline int vmalloc_fault(unsigned long address) |
1462 |
+ if (!(address >= VMALLOC_START && address < VMALLOC_END)) |
1463 |
+ return -1; |
1464 |
+ |
1465 |
+- WARN_ON_ONCE(in_nmi()); |
1466 |
+- |
1467 |
+ /* |
1468 |
+ * Copy kernel mappings over when needed. This can also |
1469 |
+ * happen within a race in page table update. In the later |
1470 |
+diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c |
1471 |
+index 0c98b6c1ca49..1213556a20da 100644 |
1472 |
+--- a/block/blk-mq-sched.c |
1473 |
++++ b/block/blk-mq-sched.c |
1474 |
+@@ -413,6 +413,14 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx, |
1475 |
+ struct list_head *list, bool run_queue_async) |
1476 |
+ { |
1477 |
+ struct elevator_queue *e; |
1478 |
++ struct request_queue *q = hctx->queue; |
1479 |
++ |
1480 |
++ /* |
1481 |
++ * blk_mq_sched_insert_requests() is called from flush plug |
1482 |
++ * context only, and hold one usage counter to prevent queue |
1483 |
++ * from being released. |
1484 |
++ */ |
1485 |
++ percpu_ref_get(&q->q_usage_counter); |
1486 |
+ |
1487 |
+ e = hctx->queue->elevator; |
1488 |
+ if (e && e->type->ops.insert_requests) |
1489 |
+@@ -426,12 +434,14 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx, |
1490 |
+ if (!hctx->dispatch_busy && !e && !run_queue_async) { |
1491 |
+ blk_mq_try_issue_list_directly(hctx, list); |
1492 |
+ if (list_empty(list)) |
1493 |
+- return; |
1494 |
++ goto out; |
1495 |
+ } |
1496 |
+ blk_mq_insert_requests(hctx, ctx, list); |
1497 |
+ } |
1498 |
+ |
1499 |
+ blk_mq_run_hw_queue(hctx, run_queue_async); |
1500 |
++ out: |
1501 |
++ percpu_ref_put(&q->q_usage_counter); |
1502 |
+ } |
1503 |
+ |
1504 |
+ static void blk_mq_sched_free_tags(struct blk_mq_tag_set *set, |
1505 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
1506 |
+index 9957e0fc17fc..27526095319c 100644 |
1507 |
+--- a/block/blk-mq.c |
1508 |
++++ b/block/blk-mq.c |
1509 |
+@@ -2287,15 +2287,65 @@ static void blk_mq_exit_hw_queues(struct request_queue *q, |
1510 |
+ } |
1511 |
+ } |
1512 |
+ |
1513 |
++static int blk_mq_hw_ctx_size(struct blk_mq_tag_set *tag_set) |
1514 |
++{ |
1515 |
++ int hw_ctx_size = sizeof(struct blk_mq_hw_ctx); |
1516 |
++ |
1517 |
++ BUILD_BUG_ON(ALIGN(offsetof(struct blk_mq_hw_ctx, srcu), |
1518 |
++ __alignof__(struct blk_mq_hw_ctx)) != |
1519 |
++ sizeof(struct blk_mq_hw_ctx)); |
1520 |
++ |
1521 |
++ if (tag_set->flags & BLK_MQ_F_BLOCKING) |
1522 |
++ hw_ctx_size += sizeof(struct srcu_struct); |
1523 |
++ |
1524 |
++ return hw_ctx_size; |
1525 |
++} |
1526 |
++ |
1527 |
+ static int blk_mq_init_hctx(struct request_queue *q, |
1528 |
+ struct blk_mq_tag_set *set, |
1529 |
+ struct blk_mq_hw_ctx *hctx, unsigned hctx_idx) |
1530 |
+ { |
1531 |
+- int node; |
1532 |
++ hctx->queue_num = hctx_idx; |
1533 |
++ |
1534 |
++ cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead); |
1535 |
++ |
1536 |
++ hctx->tags = set->tags[hctx_idx]; |
1537 |
++ |
1538 |
++ if (set->ops->init_hctx && |
1539 |
++ set->ops->init_hctx(hctx, set->driver_data, hctx_idx)) |
1540 |
++ goto unregister_cpu_notifier; |
1541 |
+ |
1542 |
+- node = hctx->numa_node; |
1543 |
++ if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx, |
1544 |
++ hctx->numa_node)) |
1545 |
++ goto exit_hctx; |
1546 |
++ return 0; |
1547 |
++ |
1548 |
++ exit_hctx: |
1549 |
++ if (set->ops->exit_hctx) |
1550 |
++ set->ops->exit_hctx(hctx, hctx_idx); |
1551 |
++ unregister_cpu_notifier: |
1552 |
++ blk_mq_remove_cpuhp(hctx); |
1553 |
++ return -1; |
1554 |
++} |
1555 |
++ |
1556 |
++static struct blk_mq_hw_ctx * |
1557 |
++blk_mq_alloc_hctx(struct request_queue *q, struct blk_mq_tag_set *set, |
1558 |
++ int node) |
1559 |
++{ |
1560 |
++ struct blk_mq_hw_ctx *hctx; |
1561 |
++ gfp_t gfp = GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY; |
1562 |
++ |
1563 |
++ hctx = kzalloc_node(blk_mq_hw_ctx_size(set), gfp, node); |
1564 |
++ if (!hctx) |
1565 |
++ goto fail_alloc_hctx; |
1566 |
++ |
1567 |
++ if (!zalloc_cpumask_var_node(&hctx->cpumask, gfp, node)) |
1568 |
++ goto free_hctx; |
1569 |
++ |
1570 |
++ atomic_set(&hctx->nr_active, 0); |
1571 |
+ if (node == NUMA_NO_NODE) |
1572 |
+- node = hctx->numa_node = set->numa_node; |
1573 |
++ node = set->numa_node; |
1574 |
++ hctx->numa_node = node; |
1575 |
+ |
1576 |
+ INIT_DELAYED_WORK(&hctx->run_work, blk_mq_run_work_fn); |
1577 |
+ spin_lock_init(&hctx->lock); |
1578 |
+@@ -2303,58 +2353,45 @@ static int blk_mq_init_hctx(struct request_queue *q, |
1579 |
+ hctx->queue = q; |
1580 |
+ hctx->flags = set->flags & ~BLK_MQ_F_TAG_SHARED; |
1581 |
+ |
1582 |
+- cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead); |
1583 |
+- |
1584 |
+- hctx->tags = set->tags[hctx_idx]; |
1585 |
+- |
1586 |
+ /* |
1587 |
+ * Allocate space for all possible cpus to avoid allocation at |
1588 |
+ * runtime |
1589 |
+ */ |
1590 |
+ hctx->ctxs = kmalloc_array_node(nr_cpu_ids, sizeof(void *), |
1591 |
+- GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node); |
1592 |
++ gfp, node); |
1593 |
+ if (!hctx->ctxs) |
1594 |
+- goto unregister_cpu_notifier; |
1595 |
++ goto free_cpumask; |
1596 |
+ |
1597 |
+ if (sbitmap_init_node(&hctx->ctx_map, nr_cpu_ids, ilog2(8), |
1598 |
+- GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node)) |
1599 |
++ gfp, node)) |
1600 |
+ goto free_ctxs; |
1601 |
+- |
1602 |
+ hctx->nr_ctx = 0; |
1603 |
+ |
1604 |
+ spin_lock_init(&hctx->dispatch_wait_lock); |
1605 |
+ init_waitqueue_func_entry(&hctx->dispatch_wait, blk_mq_dispatch_wake); |
1606 |
+ INIT_LIST_HEAD(&hctx->dispatch_wait.entry); |
1607 |
+ |
1608 |
+- if (set->ops->init_hctx && |
1609 |
+- set->ops->init_hctx(hctx, set->driver_data, hctx_idx)) |
1610 |
+- goto free_bitmap; |
1611 |
+- |
1612 |
+ hctx->fq = blk_alloc_flush_queue(q, hctx->numa_node, set->cmd_size, |
1613 |
+- GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY); |
1614 |
++ gfp); |
1615 |
+ if (!hctx->fq) |
1616 |
+- goto exit_hctx; |
1617 |
+- |
1618 |
+- if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx, node)) |
1619 |
+- goto free_fq; |
1620 |
++ goto free_bitmap; |
1621 |
+ |
1622 |
+ if (hctx->flags & BLK_MQ_F_BLOCKING) |
1623 |
+ init_srcu_struct(hctx->srcu); |
1624 |
++ blk_mq_hctx_kobj_init(hctx); |
1625 |
+ |
1626 |
+- return 0; |
1627 |
++ return hctx; |
1628 |
+ |
1629 |
+- free_fq: |
1630 |
+- blk_free_flush_queue(hctx->fq); |
1631 |
+- exit_hctx: |
1632 |
+- if (set->ops->exit_hctx) |
1633 |
+- set->ops->exit_hctx(hctx, hctx_idx); |
1634 |
+ free_bitmap: |
1635 |
+ sbitmap_free(&hctx->ctx_map); |
1636 |
+ free_ctxs: |
1637 |
+ kfree(hctx->ctxs); |
1638 |
+- unregister_cpu_notifier: |
1639 |
+- blk_mq_remove_cpuhp(hctx); |
1640 |
+- return -1; |
1641 |
++ free_cpumask: |
1642 |
++ free_cpumask_var(hctx->cpumask); |
1643 |
++ free_hctx: |
1644 |
++ kfree(hctx); |
1645 |
++ fail_alloc_hctx: |
1646 |
++ return NULL; |
1647 |
+ } |
1648 |
+ |
1649 |
+ static void blk_mq_init_cpu_queues(struct request_queue *q, |
1650 |
+@@ -2691,51 +2728,25 @@ struct request_queue *blk_mq_init_sq_queue(struct blk_mq_tag_set *set, |
1651 |
+ } |
1652 |
+ EXPORT_SYMBOL(blk_mq_init_sq_queue); |
1653 |
+ |
1654 |
+-static int blk_mq_hw_ctx_size(struct blk_mq_tag_set *tag_set) |
1655 |
+-{ |
1656 |
+- int hw_ctx_size = sizeof(struct blk_mq_hw_ctx); |
1657 |
+- |
1658 |
+- BUILD_BUG_ON(ALIGN(offsetof(struct blk_mq_hw_ctx, srcu), |
1659 |
+- __alignof__(struct blk_mq_hw_ctx)) != |
1660 |
+- sizeof(struct blk_mq_hw_ctx)); |
1661 |
+- |
1662 |
+- if (tag_set->flags & BLK_MQ_F_BLOCKING) |
1663 |
+- hw_ctx_size += sizeof(struct srcu_struct); |
1664 |
+- |
1665 |
+- return hw_ctx_size; |
1666 |
+-} |
1667 |
+- |
1668 |
+ static struct blk_mq_hw_ctx *blk_mq_alloc_and_init_hctx( |
1669 |
+ struct blk_mq_tag_set *set, struct request_queue *q, |
1670 |
+ int hctx_idx, int node) |
1671 |
+ { |
1672 |
+ struct blk_mq_hw_ctx *hctx; |
1673 |
+ |
1674 |
+- hctx = kzalloc_node(blk_mq_hw_ctx_size(set), |
1675 |
+- GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, |
1676 |
+- node); |
1677 |
++ hctx = blk_mq_alloc_hctx(q, set, node); |
1678 |
+ if (!hctx) |
1679 |
+- return NULL; |
1680 |
+- |
1681 |
+- if (!zalloc_cpumask_var_node(&hctx->cpumask, |
1682 |
+- GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, |
1683 |
+- node)) { |
1684 |
+- kfree(hctx); |
1685 |
+- return NULL; |
1686 |
+- } |
1687 |
+- |
1688 |
+- atomic_set(&hctx->nr_active, 0); |
1689 |
+- hctx->numa_node = node; |
1690 |
+- hctx->queue_num = hctx_idx; |
1691 |
++ goto fail; |
1692 |
+ |
1693 |
+- if (blk_mq_init_hctx(q, set, hctx, hctx_idx)) { |
1694 |
+- free_cpumask_var(hctx->cpumask); |
1695 |
+- kfree(hctx); |
1696 |
+- return NULL; |
1697 |
+- } |
1698 |
+- blk_mq_hctx_kobj_init(hctx); |
1699 |
++ if (blk_mq_init_hctx(q, set, hctx, hctx_idx)) |
1700 |
++ goto free_hctx; |
1701 |
+ |
1702 |
+ return hctx; |
1703 |
++ |
1704 |
++ free_hctx: |
1705 |
++ kobject_put(&hctx->kobj); |
1706 |
++ fail: |
1707 |
++ return NULL; |
1708 |
+ } |
1709 |
+ |
1710 |
+ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set, |
1711 |
+diff --git a/block/blk.h b/block/blk.h |
1712 |
+index 848278c52030..a57bc90e44bb 100644 |
1713 |
+--- a/block/blk.h |
1714 |
++++ b/block/blk.h |
1715 |
+@@ -75,7 +75,7 @@ static inline bool biovec_phys_mergeable(struct request_queue *q, |
1716 |
+ |
1717 |
+ if (addr1 + vec1->bv_len != addr2) |
1718 |
+ return false; |
1719 |
+- if (xen_domain() && !xen_biovec_phys_mergeable(vec1, vec2)) |
1720 |
++ if (xen_domain() && !xen_biovec_phys_mergeable(vec1, vec2->bv_page)) |
1721 |
+ return false; |
1722 |
+ if ((addr1 | mask) != ((addr2 + vec2->bv_len - 1) | mask)) |
1723 |
+ return false; |
1724 |
+diff --git a/block/genhd.c b/block/genhd.c |
1725 |
+index 1dd8fd6613b8..ef28a5126d21 100644 |
1726 |
+--- a/block/genhd.c |
1727 |
++++ b/block/genhd.c |
1728 |
+@@ -531,6 +531,18 @@ void blk_free_devt(dev_t devt) |
1729 |
+ } |
1730 |
+ } |
1731 |
+ |
1732 |
++/** |
1733 |
++ * We invalidate devt by assigning NULL pointer for devt in idr. |
1734 |
++ */ |
1735 |
++void blk_invalidate_devt(dev_t devt) |
1736 |
++{ |
1737 |
++ if (MAJOR(devt) == BLOCK_EXT_MAJOR) { |
1738 |
++ spin_lock_bh(&ext_devt_lock); |
1739 |
++ idr_replace(&ext_devt_idr, NULL, blk_mangle_minor(MINOR(devt))); |
1740 |
++ spin_unlock_bh(&ext_devt_lock); |
1741 |
++ } |
1742 |
++} |
1743 |
++ |
1744 |
+ static char *bdevt_str(dev_t devt, char *buf) |
1745 |
+ { |
1746 |
+ if (MAJOR(devt) <= 0xff && MINOR(devt) <= 0xff) { |
1747 |
+@@ -791,6 +803,13 @@ void del_gendisk(struct gendisk *disk) |
1748 |
+ |
1749 |
+ if (!(disk->flags & GENHD_FL_HIDDEN)) |
1750 |
+ blk_unregister_region(disk_devt(disk), disk->minors); |
1751 |
++ /* |
1752 |
++ * Remove gendisk pointer from idr so that it cannot be looked up |
1753 |
++ * while RCU period before freeing gendisk is running to prevent |
1754 |
++ * use-after-free issues. Note that the device number stays |
1755 |
++ * "in-use" until we really free the gendisk. |
1756 |
++ */ |
1757 |
++ blk_invalidate_devt(disk_devt(disk)); |
1758 |
+ |
1759 |
+ kobject_put(disk->part0.holder_dir); |
1760 |
+ kobject_put(disk->slave_dir); |
1761 |
+diff --git a/block/partition-generic.c b/block/partition-generic.c |
1762 |
+index 8e596a8dff32..aee643ce13d1 100644 |
1763 |
+--- a/block/partition-generic.c |
1764 |
++++ b/block/partition-generic.c |
1765 |
+@@ -285,6 +285,13 @@ void delete_partition(struct gendisk *disk, int partno) |
1766 |
+ kobject_put(part->holder_dir); |
1767 |
+ device_del(part_to_dev(part)); |
1768 |
+ |
1769 |
++ /* |
1770 |
++ * Remove gendisk pointer from idr so that it cannot be looked up |
1771 |
++ * while RCU period before freeing gendisk is running to prevent |
1772 |
++ * use-after-free issues. Note that the device number stays |
1773 |
++ * "in-use" until we really free the gendisk. |
1774 |
++ */ |
1775 |
++ blk_invalidate_devt(part_devt(part)); |
1776 |
+ hd_struct_kill(part); |
1777 |
+ } |
1778 |
+ |
1779 |
+diff --git a/block/sed-opal.c b/block/sed-opal.c |
1780 |
+index e0de4dd448b3..119640897293 100644 |
1781 |
+--- a/block/sed-opal.c |
1782 |
++++ b/block/sed-opal.c |
1783 |
+@@ -2095,13 +2095,16 @@ static int opal_erase_locking_range(struct opal_dev *dev, |
1784 |
+ static int opal_enable_disable_shadow_mbr(struct opal_dev *dev, |
1785 |
+ struct opal_mbr_data *opal_mbr) |
1786 |
+ { |
1787 |
++ u8 enable_disable = opal_mbr->enable_disable == OPAL_MBR_ENABLE ? |
1788 |
++ OPAL_TRUE : OPAL_FALSE; |
1789 |
++ |
1790 |
+ const struct opal_step mbr_steps[] = { |
1791 |
+ { opal_discovery0, }, |
1792 |
+ { start_admin1LSP_opal_session, &opal_mbr->key }, |
1793 |
+- { set_mbr_done, &opal_mbr->enable_disable }, |
1794 |
++ { set_mbr_done, &enable_disable }, |
1795 |
+ { end_opal_session, }, |
1796 |
+ { start_admin1LSP_opal_session, &opal_mbr->key }, |
1797 |
+- { set_mbr_enable_disable, &opal_mbr->enable_disable }, |
1798 |
++ { set_mbr_enable_disable, &enable_disable }, |
1799 |
+ { end_opal_session, }, |
1800 |
+ { NULL, } |
1801 |
+ }; |
1802 |
+@@ -2221,7 +2224,7 @@ static int __opal_lock_unlock(struct opal_dev *dev, |
1803 |
+ |
1804 |
+ static int __opal_set_mbr_done(struct opal_dev *dev, struct opal_key *key) |
1805 |
+ { |
1806 |
+- u8 mbr_done_tf = 1; |
1807 |
++ u8 mbr_done_tf = OPAL_TRUE; |
1808 |
+ const struct opal_step mbrdone_step [] = { |
1809 |
+ { opal_discovery0, }, |
1810 |
+ { start_admin1LSP_opal_session, key }, |
1811 |
+diff --git a/crypto/hmac.c b/crypto/hmac.c |
1812 |
+index e74730224f0a..4b8c8ee8f15c 100644 |
1813 |
+--- a/crypto/hmac.c |
1814 |
++++ b/crypto/hmac.c |
1815 |
+@@ -168,6 +168,8 @@ static int hmac_init_tfm(struct crypto_tfm *tfm) |
1816 |
+ |
1817 |
+ parent->descsize = sizeof(struct shash_desc) + |
1818 |
+ crypto_shash_descsize(hash); |
1819 |
++ if (WARN_ON(parent->descsize > HASH_MAX_DESCSIZE)) |
1820 |
++ return -EINVAL; |
1821 |
+ |
1822 |
+ ctx->hash = hash; |
1823 |
+ return 0; |
1824 |
+diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c |
1825 |
+index e48894e002ba..a46c2c162c03 100644 |
1826 |
+--- a/drivers/acpi/arm64/iort.c |
1827 |
++++ b/drivers/acpi/arm64/iort.c |
1828 |
+@@ -1232,18 +1232,24 @@ static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node) |
1829 |
+ /* |
1830 |
+ * set numa proximity domain for smmuv3 device |
1831 |
+ */ |
1832 |
+-static void __init arm_smmu_v3_set_proximity(struct device *dev, |
1833 |
++static int __init arm_smmu_v3_set_proximity(struct device *dev, |
1834 |
+ struct acpi_iort_node *node) |
1835 |
+ { |
1836 |
+ struct acpi_iort_smmu_v3 *smmu; |
1837 |
+ |
1838 |
+ smmu = (struct acpi_iort_smmu_v3 *)node->node_data; |
1839 |
+ if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) { |
1840 |
+- set_dev_node(dev, acpi_map_pxm_to_node(smmu->pxm)); |
1841 |
++ int node = acpi_map_pxm_to_node(smmu->pxm); |
1842 |
++ |
1843 |
++ if (node != NUMA_NO_NODE && !node_online(node)) |
1844 |
++ return -EINVAL; |
1845 |
++ |
1846 |
++ set_dev_node(dev, node); |
1847 |
+ pr_info("SMMU-v3[%llx] Mapped to Proximity domain %d\n", |
1848 |
+ smmu->base_address, |
1849 |
+ smmu->pxm); |
1850 |
+ } |
1851 |
++ return 0; |
1852 |
+ } |
1853 |
+ #else |
1854 |
+ #define arm_smmu_v3_set_proximity NULL |
1855 |
+@@ -1318,7 +1324,7 @@ struct iort_dev_config { |
1856 |
+ int (*dev_count_resources)(struct acpi_iort_node *node); |
1857 |
+ void (*dev_init_resources)(struct resource *res, |
1858 |
+ struct acpi_iort_node *node); |
1859 |
+- void (*dev_set_proximity)(struct device *dev, |
1860 |
++ int (*dev_set_proximity)(struct device *dev, |
1861 |
+ struct acpi_iort_node *node); |
1862 |
+ }; |
1863 |
+ |
1864 |
+@@ -1369,8 +1375,11 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node, |
1865 |
+ if (!pdev) |
1866 |
+ return -ENOMEM; |
1867 |
+ |
1868 |
+- if (ops->dev_set_proximity) |
1869 |
+- ops->dev_set_proximity(&pdev->dev, node); |
1870 |
++ if (ops->dev_set_proximity) { |
1871 |
++ ret = ops->dev_set_proximity(&pdev->dev, node); |
1872 |
++ if (ret) |
1873 |
++ goto dev_put; |
1874 |
++ } |
1875 |
+ |
1876 |
+ count = ops->dev_count_resources(node); |
1877 |
+ |
1878 |
+diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c |
1879 |
+index 77abe0ec4043..bd533f68b1de 100644 |
1880 |
+--- a/drivers/acpi/property.c |
1881 |
++++ b/drivers/acpi/property.c |
1882 |
+@@ -1031,6 +1031,14 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, |
1883 |
+ const struct acpi_data_node *data = to_acpi_data_node(fwnode); |
1884 |
+ struct acpi_data_node *dn; |
1885 |
+ |
1886 |
++ /* |
1887 |
++ * We can have a combination of device and data nodes, e.g. with |
1888 |
++ * hierarchical _DSD properties. Make sure the adev pointer is |
1889 |
++ * restored before going through data nodes, otherwise we will |
1890 |
++ * be looking for data_nodes below the last device found instead |
1891 |
++ * of the common fwnode shared by device_nodes and data_nodes. |
1892 |
++ */ |
1893 |
++ adev = to_acpi_device_node(fwnode); |
1894 |
+ if (adev) |
1895 |
+ head = &adev->data.subnodes; |
1896 |
+ else if (data) |
1897 |
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
1898 |
+index 0992e67e862b..7900debc5ce4 100644 |
1899 |
+--- a/drivers/base/power/main.c |
1900 |
++++ b/drivers/base/power/main.c |
1901 |
+@@ -1738,6 +1738,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) |
1902 |
+ if (dev->power.syscore) |
1903 |
+ goto Complete; |
1904 |
+ |
1905 |
++ /* Avoid direct_complete to let wakeup_path propagate. */ |
1906 |
++ if (device_may_wakeup(dev) || dev->power.wakeup_path) |
1907 |
++ dev->power.direct_complete = false; |
1908 |
++ |
1909 |
+ if (dev->power.direct_complete) { |
1910 |
+ if (pm_runtime_status_suspended(dev)) { |
1911 |
+ pm_runtime_disable(dev); |
1912 |
+diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c |
1913 |
+index d5d6e6e5da3b..62d3aa2b26f6 100644 |
1914 |
+--- a/drivers/bluetooth/btbcm.c |
1915 |
++++ b/drivers/bluetooth/btbcm.c |
1916 |
+@@ -37,6 +37,7 @@ |
1917 |
+ #define BDADDR_BCM43430A0 (&(bdaddr_t) {{0xac, 0x1f, 0x12, 0xa0, 0x43, 0x43}}) |
1918 |
+ #define BDADDR_BCM4324B3 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb3, 0x24, 0x43}}) |
1919 |
+ #define BDADDR_BCM4330B1 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb1, 0x30, 0x43}}) |
1920 |
++#define BDADDR_BCM43341B (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0x1b, 0x34, 0x43}}) |
1921 |
+ |
1922 |
+ int btbcm_check_bdaddr(struct hci_dev *hdev) |
1923 |
+ { |
1924 |
+@@ -82,7 +83,8 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) |
1925 |
+ !bacmp(&bda->bdaddr, BDADDR_BCM20702A1) || |
1926 |
+ !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) || |
1927 |
+ !bacmp(&bda->bdaddr, BDADDR_BCM4330B1) || |
1928 |
+- !bacmp(&bda->bdaddr, BDADDR_BCM43430A0)) { |
1929 |
++ !bacmp(&bda->bdaddr, BDADDR_BCM43430A0) || |
1930 |
++ !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) { |
1931 |
+ bt_dev_info(hdev, "BCM: Using default device address (%pMR)", |
1932 |
+ &bda->bdaddr); |
1933 |
+ set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); |
1934 |
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c |
1935 |
+index f036c8f98ea3..97bc17670b7a 100644 |
1936 |
+--- a/drivers/bluetooth/hci_qca.c |
1937 |
++++ b/drivers/bluetooth/hci_qca.c |
1938 |
+@@ -508,6 +508,8 @@ static int qca_open(struct hci_uart *hu) |
1939 |
+ qcadev = serdev_device_get_drvdata(hu->serdev); |
1940 |
+ if (qcadev->btsoc_type != QCA_WCN3990) { |
1941 |
+ gpiod_set_value_cansleep(qcadev->bt_en, 1); |
1942 |
++ /* Controller needs time to bootup. */ |
1943 |
++ msleep(150); |
1944 |
+ } else { |
1945 |
+ hu->init_speed = qcadev->init_speed; |
1946 |
+ hu->oper_speed = qcadev->oper_speed; |
1947 |
+diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c |
1948 |
+index b65ff6962899..e9b6ac61fb7f 100644 |
1949 |
+--- a/drivers/char/hw_random/omap-rng.c |
1950 |
++++ b/drivers/char/hw_random/omap-rng.c |
1951 |
+@@ -443,6 +443,7 @@ static int omap_rng_probe(struct platform_device *pdev) |
1952 |
+ priv->rng.read = omap_rng_do_read; |
1953 |
+ priv->rng.init = omap_rng_init; |
1954 |
+ priv->rng.cleanup = omap_rng_cleanup; |
1955 |
++ priv->rng.quality = 900; |
1956 |
+ |
1957 |
+ priv->rng.priv = (unsigned long)priv; |
1958 |
+ platform_set_drvdata(pdev, priv); |
1959 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
1960 |
+index 38c6d1af6d1c..af6e240f98ff 100644 |
1961 |
+--- a/drivers/char/random.c |
1962 |
++++ b/drivers/char/random.c |
1963 |
+@@ -777,6 +777,7 @@ static struct crng_state **crng_node_pool __read_mostly; |
1964 |
+ #endif |
1965 |
+ |
1966 |
+ static void invalidate_batched_entropy(void); |
1967 |
++static void numa_crng_init(void); |
1968 |
+ |
1969 |
+ static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU); |
1970 |
+ static int __init parse_trust_cpu(char *arg) |
1971 |
+@@ -805,7 +806,9 @@ static void crng_initialize(struct crng_state *crng) |
1972 |
+ } |
1973 |
+ crng->state[i] ^= rv; |
1974 |
+ } |
1975 |
+- if (trust_cpu && arch_init) { |
1976 |
++ if (trust_cpu && arch_init && crng == &primary_crng) { |
1977 |
++ invalidate_batched_entropy(); |
1978 |
++ numa_crng_init(); |
1979 |
+ crng_init = 2; |
1980 |
+ pr_notice("random: crng done (trusting CPU's manufacturer)\n"); |
1981 |
+ } |
1982 |
+@@ -2211,8 +2214,8 @@ struct batched_entropy { |
1983 |
+ u32 entropy_u32[CHACHA_BLOCK_SIZE / sizeof(u32)]; |
1984 |
+ }; |
1985 |
+ unsigned int position; |
1986 |
++ spinlock_t batch_lock; |
1987 |
+ }; |
1988 |
+-static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_reset_lock); |
1989 |
+ |
1990 |
+ /* |
1991 |
+ * Get a random word for internal kernel use only. The quality of the random |
1992 |
+@@ -2222,12 +2225,14 @@ static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_ |
1993 |
+ * wait_for_random_bytes() should be called and return 0 at least once |
1994 |
+ * at any point prior. |
1995 |
+ */ |
1996 |
+-static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); |
1997 |
++static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64) = { |
1998 |
++ .batch_lock = __SPIN_LOCK_UNLOCKED(batched_entropy_u64.lock), |
1999 |
++}; |
2000 |
++ |
2001 |
+ u64 get_random_u64(void) |
2002 |
+ { |
2003 |
+ u64 ret; |
2004 |
+- bool use_lock; |
2005 |
+- unsigned long flags = 0; |
2006 |
++ unsigned long flags; |
2007 |
+ struct batched_entropy *batch; |
2008 |
+ static void *previous; |
2009 |
+ |
2010 |
+@@ -2242,28 +2247,25 @@ u64 get_random_u64(void) |
2011 |
+ |
2012 |
+ warn_unseeded_randomness(&previous); |
2013 |
+ |
2014 |
+- use_lock = READ_ONCE(crng_init) < 2; |
2015 |
+- batch = &get_cpu_var(batched_entropy_u64); |
2016 |
+- if (use_lock) |
2017 |
+- read_lock_irqsave(&batched_entropy_reset_lock, flags); |
2018 |
++ batch = raw_cpu_ptr(&batched_entropy_u64); |
2019 |
++ spin_lock_irqsave(&batch->batch_lock, flags); |
2020 |
+ if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) { |
2021 |
+ extract_crng((u8 *)batch->entropy_u64); |
2022 |
+ batch->position = 0; |
2023 |
+ } |
2024 |
+ ret = batch->entropy_u64[batch->position++]; |
2025 |
+- if (use_lock) |
2026 |
+- read_unlock_irqrestore(&batched_entropy_reset_lock, flags); |
2027 |
+- put_cpu_var(batched_entropy_u64); |
2028 |
++ spin_unlock_irqrestore(&batch->batch_lock, flags); |
2029 |
+ return ret; |
2030 |
+ } |
2031 |
+ EXPORT_SYMBOL(get_random_u64); |
2032 |
+ |
2033 |
+-static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); |
2034 |
++static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32) = { |
2035 |
++ .batch_lock = __SPIN_LOCK_UNLOCKED(batched_entropy_u32.lock), |
2036 |
++}; |
2037 |
+ u32 get_random_u32(void) |
2038 |
+ { |
2039 |
+ u32 ret; |
2040 |
+- bool use_lock; |
2041 |
+- unsigned long flags = 0; |
2042 |
++ unsigned long flags; |
2043 |
+ struct batched_entropy *batch; |
2044 |
+ static void *previous; |
2045 |
+ |
2046 |
+@@ -2272,18 +2274,14 @@ u32 get_random_u32(void) |
2047 |
+ |
2048 |
+ warn_unseeded_randomness(&previous); |
2049 |
+ |
2050 |
+- use_lock = READ_ONCE(crng_init) < 2; |
2051 |
+- batch = &get_cpu_var(batched_entropy_u32); |
2052 |
+- if (use_lock) |
2053 |
+- read_lock_irqsave(&batched_entropy_reset_lock, flags); |
2054 |
++ batch = raw_cpu_ptr(&batched_entropy_u32); |
2055 |
++ spin_lock_irqsave(&batch->batch_lock, flags); |
2056 |
+ if (batch->position % ARRAY_SIZE(batch->entropy_u32) == 0) { |
2057 |
+ extract_crng((u8 *)batch->entropy_u32); |
2058 |
+ batch->position = 0; |
2059 |
+ } |
2060 |
+ ret = batch->entropy_u32[batch->position++]; |
2061 |
+- if (use_lock) |
2062 |
+- read_unlock_irqrestore(&batched_entropy_reset_lock, flags); |
2063 |
+- put_cpu_var(batched_entropy_u32); |
2064 |
++ spin_unlock_irqrestore(&batch->batch_lock, flags); |
2065 |
+ return ret; |
2066 |
+ } |
2067 |
+ EXPORT_SYMBOL(get_random_u32); |
2068 |
+@@ -2297,12 +2295,19 @@ static void invalidate_batched_entropy(void) |
2069 |
+ int cpu; |
2070 |
+ unsigned long flags; |
2071 |
+ |
2072 |
+- write_lock_irqsave(&batched_entropy_reset_lock, flags); |
2073 |
+ for_each_possible_cpu (cpu) { |
2074 |
+- per_cpu_ptr(&batched_entropy_u32, cpu)->position = 0; |
2075 |
+- per_cpu_ptr(&batched_entropy_u64, cpu)->position = 0; |
2076 |
++ struct batched_entropy *batched_entropy; |
2077 |
++ |
2078 |
++ batched_entropy = per_cpu_ptr(&batched_entropy_u32, cpu); |
2079 |
++ spin_lock_irqsave(&batched_entropy->batch_lock, flags); |
2080 |
++ batched_entropy->position = 0; |
2081 |
++ spin_unlock(&batched_entropy->batch_lock); |
2082 |
++ |
2083 |
++ batched_entropy = per_cpu_ptr(&batched_entropy_u64, cpu); |
2084 |
++ spin_lock(&batched_entropy->batch_lock); |
2085 |
++ batched_entropy->position = 0; |
2086 |
++ spin_unlock_irqrestore(&batched_entropy->batch_lock, flags); |
2087 |
+ } |
2088 |
+- write_unlock_irqrestore(&batched_entropy_reset_lock, flags); |
2089 |
+ } |
2090 |
+ |
2091 |
+ /** |
2092 |
+diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c |
2093 |
+index fbeb71953526..05dbfdb9f4af 100644 |
2094 |
+--- a/drivers/char/virtio_console.c |
2095 |
++++ b/drivers/char/virtio_console.c |
2096 |
+@@ -75,7 +75,7 @@ struct ports_driver_data { |
2097 |
+ /* All the console devices handled by this driver */ |
2098 |
+ struct list_head consoles; |
2099 |
+ }; |
2100 |
+-static struct ports_driver_data pdrvdata; |
2101 |
++static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; |
2102 |
+ |
2103 |
+ static DEFINE_SPINLOCK(pdrvdata_lock); |
2104 |
+ static DECLARE_COMPLETION(early_console_added); |
2105 |
+@@ -1394,6 +1394,7 @@ static int add_port(struct ports_device *portdev, u32 id) |
2106 |
+ port->async_queue = NULL; |
2107 |
+ |
2108 |
+ port->cons.ws.ws_row = port->cons.ws.ws_col = 0; |
2109 |
++ port->cons.vtermno = 0; |
2110 |
+ |
2111 |
+ port->host_connected = port->guest_connected = false; |
2112 |
+ port->stats = (struct port_stats) { 0 }; |
2113 |
+diff --git a/drivers/clk/renesas/r8a774a1-cpg-mssr.c b/drivers/clk/renesas/r8a774a1-cpg-mssr.c |
2114 |
+index 10e852518870..904d4d4ebcad 100644 |
2115 |
+--- a/drivers/clk/renesas/r8a774a1-cpg-mssr.c |
2116 |
++++ b/drivers/clk/renesas/r8a774a1-cpg-mssr.c |
2117 |
+@@ -122,8 +122,8 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = { |
2118 |
+ DEF_MOD("msiof2", 209, R8A774A1_CLK_MSO), |
2119 |
+ DEF_MOD("msiof1", 210, R8A774A1_CLK_MSO), |
2120 |
+ DEF_MOD("msiof0", 211, R8A774A1_CLK_MSO), |
2121 |
+- DEF_MOD("sys-dmac2", 217, R8A774A1_CLK_S0D3), |
2122 |
+- DEF_MOD("sys-dmac1", 218, R8A774A1_CLK_S0D3), |
2123 |
++ DEF_MOD("sys-dmac2", 217, R8A774A1_CLK_S3D1), |
2124 |
++ DEF_MOD("sys-dmac1", 218, R8A774A1_CLK_S3D1), |
2125 |
+ DEF_MOD("sys-dmac0", 219, R8A774A1_CLK_S0D3), |
2126 |
+ DEF_MOD("cmt3", 300, R8A774A1_CLK_R), |
2127 |
+ DEF_MOD("cmt2", 301, R8A774A1_CLK_R), |
2128 |
+@@ -142,8 +142,8 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = { |
2129 |
+ DEF_MOD("rwdt", 402, R8A774A1_CLK_R), |
2130 |
+ DEF_MOD("intc-ex", 407, R8A774A1_CLK_CP), |
2131 |
+ DEF_MOD("intc-ap", 408, R8A774A1_CLK_S0D3), |
2132 |
+- DEF_MOD("audmac1", 501, R8A774A1_CLK_S0D3), |
2133 |
+- DEF_MOD("audmac0", 502, R8A774A1_CLK_S0D3), |
2134 |
++ DEF_MOD("audmac1", 501, R8A774A1_CLK_S1D2), |
2135 |
++ DEF_MOD("audmac0", 502, R8A774A1_CLK_S1D2), |
2136 |
+ DEF_MOD("hscif4", 516, R8A774A1_CLK_S3D1), |
2137 |
+ DEF_MOD("hscif3", 517, R8A774A1_CLK_S3D1), |
2138 |
+ DEF_MOD("hscif2", 518, R8A774A1_CLK_S3D1), |
2139 |
+diff --git a/drivers/clk/renesas/r8a774c0-cpg-mssr.c b/drivers/clk/renesas/r8a774c0-cpg-mssr.c |
2140 |
+index 10b96895d452..4a0525425c16 100644 |
2141 |
+--- a/drivers/clk/renesas/r8a774c0-cpg-mssr.c |
2142 |
++++ b/drivers/clk/renesas/r8a774c0-cpg-mssr.c |
2143 |
+@@ -149,7 +149,7 @@ static const struct mssr_mod_clk r8a774c0_mod_clks[] __initconst = { |
2144 |
+ DEF_MOD("intc-ex", 407, R8A774C0_CLK_CP), |
2145 |
+ DEF_MOD("intc-ap", 408, R8A774C0_CLK_S0D3), |
2146 |
+ |
2147 |
+- DEF_MOD("audmac0", 502, R8A774C0_CLK_S3D4), |
2148 |
++ DEF_MOD("audmac0", 502, R8A774C0_CLK_S1D2), |
2149 |
+ DEF_MOD("hscif4", 516, R8A774C0_CLK_S3D1C), |
2150 |
+ DEF_MOD("hscif3", 517, R8A774C0_CLK_S3D1C), |
2151 |
+ DEF_MOD("hscif2", 518, R8A774C0_CLK_S3D1C), |
2152 |
+diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c |
2153 |
+index 86842c9fd314..0825cd0ff286 100644 |
2154 |
+--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c |
2155 |
++++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c |
2156 |
+@@ -129,8 +129,8 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { |
2157 |
+ DEF_MOD("msiof2", 209, R8A7795_CLK_MSO), |
2158 |
+ DEF_MOD("msiof1", 210, R8A7795_CLK_MSO), |
2159 |
+ DEF_MOD("msiof0", 211, R8A7795_CLK_MSO), |
2160 |
+- DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S0D3), |
2161 |
+- DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S0D3), |
2162 |
++ DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S3D1), |
2163 |
++ DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S3D1), |
2164 |
+ DEF_MOD("sys-dmac0", 219, R8A7795_CLK_S0D3), |
2165 |
+ DEF_MOD("sceg-pub", 229, R8A7795_CLK_CR), |
2166 |
+ DEF_MOD("cmt3", 300, R8A7795_CLK_R), |
2167 |
+@@ -153,8 +153,8 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { |
2168 |
+ DEF_MOD("rwdt", 402, R8A7795_CLK_R), |
2169 |
+ DEF_MOD("intc-ex", 407, R8A7795_CLK_CP), |
2170 |
+ DEF_MOD("intc-ap", 408, R8A7795_CLK_S0D3), |
2171 |
+- DEF_MOD("audmac1", 501, R8A7795_CLK_S0D3), |
2172 |
+- DEF_MOD("audmac0", 502, R8A7795_CLK_S0D3), |
2173 |
++ DEF_MOD("audmac1", 501, R8A7795_CLK_S1D2), |
2174 |
++ DEF_MOD("audmac0", 502, R8A7795_CLK_S1D2), |
2175 |
+ DEF_MOD("drif7", 508, R8A7795_CLK_S3D2), |
2176 |
+ DEF_MOD("drif6", 509, R8A7795_CLK_S3D2), |
2177 |
+ DEF_MOD("drif5", 510, R8A7795_CLK_S3D2), |
2178 |
+diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c |
2179 |
+index 12c455859f2c..997cd956f12b 100644 |
2180 |
+--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c |
2181 |
++++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c |
2182 |
+@@ -126,8 +126,8 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = { |
2183 |
+ DEF_MOD("msiof2", 209, R8A7796_CLK_MSO), |
2184 |
+ DEF_MOD("msiof1", 210, R8A7796_CLK_MSO), |
2185 |
+ DEF_MOD("msiof0", 211, R8A7796_CLK_MSO), |
2186 |
+- DEF_MOD("sys-dmac2", 217, R8A7796_CLK_S0D3), |
2187 |
+- DEF_MOD("sys-dmac1", 218, R8A7796_CLK_S0D3), |
2188 |
++ DEF_MOD("sys-dmac2", 217, R8A7796_CLK_S3D1), |
2189 |
++ DEF_MOD("sys-dmac1", 218, R8A7796_CLK_S3D1), |
2190 |
+ DEF_MOD("sys-dmac0", 219, R8A7796_CLK_S0D3), |
2191 |
+ DEF_MOD("cmt3", 300, R8A7796_CLK_R), |
2192 |
+ DEF_MOD("cmt2", 301, R8A7796_CLK_R), |
2193 |
+@@ -146,8 +146,8 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = { |
2194 |
+ DEF_MOD("rwdt", 402, R8A7796_CLK_R), |
2195 |
+ DEF_MOD("intc-ex", 407, R8A7796_CLK_CP), |
2196 |
+ DEF_MOD("intc-ap", 408, R8A7796_CLK_S0D3), |
2197 |
+- DEF_MOD("audmac1", 501, R8A7796_CLK_S0D3), |
2198 |
+- DEF_MOD("audmac0", 502, R8A7796_CLK_S0D3), |
2199 |
++ DEF_MOD("audmac1", 501, R8A7796_CLK_S1D2), |
2200 |
++ DEF_MOD("audmac0", 502, R8A7796_CLK_S1D2), |
2201 |
+ DEF_MOD("drif7", 508, R8A7796_CLK_S3D2), |
2202 |
+ DEF_MOD("drif6", 509, R8A7796_CLK_S3D2), |
2203 |
+ DEF_MOD("drif5", 510, R8A7796_CLK_S3D2), |
2204 |
+diff --git a/drivers/clk/renesas/r8a77965-cpg-mssr.c b/drivers/clk/renesas/r8a77965-cpg-mssr.c |
2205 |
+index eb1cca58a1e1..afc9c72fa094 100644 |
2206 |
+--- a/drivers/clk/renesas/r8a77965-cpg-mssr.c |
2207 |
++++ b/drivers/clk/renesas/r8a77965-cpg-mssr.c |
2208 |
+@@ -123,8 +123,8 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = { |
2209 |
+ DEF_MOD("msiof2", 209, R8A77965_CLK_MSO), |
2210 |
+ DEF_MOD("msiof1", 210, R8A77965_CLK_MSO), |
2211 |
+ DEF_MOD("msiof0", 211, R8A77965_CLK_MSO), |
2212 |
+- DEF_MOD("sys-dmac2", 217, R8A77965_CLK_S0D3), |
2213 |
+- DEF_MOD("sys-dmac1", 218, R8A77965_CLK_S0D3), |
2214 |
++ DEF_MOD("sys-dmac2", 217, R8A77965_CLK_S3D1), |
2215 |
++ DEF_MOD("sys-dmac1", 218, R8A77965_CLK_S3D1), |
2216 |
+ DEF_MOD("sys-dmac0", 219, R8A77965_CLK_S0D3), |
2217 |
+ |
2218 |
+ DEF_MOD("cmt3", 300, R8A77965_CLK_R), |
2219 |
+@@ -146,8 +146,8 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = { |
2220 |
+ DEF_MOD("intc-ex", 407, R8A77965_CLK_CP), |
2221 |
+ DEF_MOD("intc-ap", 408, R8A77965_CLK_S0D3), |
2222 |
+ |
2223 |
+- DEF_MOD("audmac1", 501, R8A77965_CLK_S0D3), |
2224 |
+- DEF_MOD("audmac0", 502, R8A77965_CLK_S0D3), |
2225 |
++ DEF_MOD("audmac1", 501, R8A77965_CLK_S1D2), |
2226 |
++ DEF_MOD("audmac0", 502, R8A77965_CLK_S1D2), |
2227 |
+ DEF_MOD("drif7", 508, R8A77965_CLK_S3D2), |
2228 |
+ DEF_MOD("drif6", 509, R8A77965_CLK_S3D2), |
2229 |
+ DEF_MOD("drif5", 510, R8A77965_CLK_S3D2), |
2230 |
+diff --git a/drivers/clk/renesas/r8a77990-cpg-mssr.c b/drivers/clk/renesas/r8a77990-cpg-mssr.c |
2231 |
+index 9a278c75c918..03f445d47ef6 100644 |
2232 |
+--- a/drivers/clk/renesas/r8a77990-cpg-mssr.c |
2233 |
++++ b/drivers/clk/renesas/r8a77990-cpg-mssr.c |
2234 |
+@@ -152,7 +152,7 @@ static const struct mssr_mod_clk r8a77990_mod_clks[] __initconst = { |
2235 |
+ DEF_MOD("intc-ex", 407, R8A77990_CLK_CP), |
2236 |
+ DEF_MOD("intc-ap", 408, R8A77990_CLK_S0D3), |
2237 |
+ |
2238 |
+- DEF_MOD("audmac0", 502, R8A77990_CLK_S3D4), |
2239 |
++ DEF_MOD("audmac0", 502, R8A77990_CLK_S1D2), |
2240 |
+ DEF_MOD("drif7", 508, R8A77990_CLK_S3D2), |
2241 |
+ DEF_MOD("drif6", 509, R8A77990_CLK_S3D2), |
2242 |
+ DEF_MOD("drif5", 510, R8A77990_CLK_S3D2), |
2243 |
+diff --git a/drivers/clk/renesas/r8a77995-cpg-mssr.c b/drivers/clk/renesas/r8a77995-cpg-mssr.c |
2244 |
+index eee3874865a9..68707277b17b 100644 |
2245 |
+--- a/drivers/clk/renesas/r8a77995-cpg-mssr.c |
2246 |
++++ b/drivers/clk/renesas/r8a77995-cpg-mssr.c |
2247 |
+@@ -133,7 +133,7 @@ static const struct mssr_mod_clk r8a77995_mod_clks[] __initconst = { |
2248 |
+ DEF_MOD("rwdt", 402, R8A77995_CLK_R), |
2249 |
+ DEF_MOD("intc-ex", 407, R8A77995_CLK_CP), |
2250 |
+ DEF_MOD("intc-ap", 408, R8A77995_CLK_S1D2), |
2251 |
+- DEF_MOD("audmac0", 502, R8A77995_CLK_S3D1), |
2252 |
++ DEF_MOD("audmac0", 502, R8A77995_CLK_S1D2), |
2253 |
+ DEF_MOD("hscif3", 517, R8A77995_CLK_S3D1C), |
2254 |
+ DEF_MOD("hscif0", 520, R8A77995_CLK_S3D1C), |
2255 |
+ DEF_MOD("thermal", 522, R8A77995_CLK_CP), |
2256 |
+diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c |
2257 |
+index 5a67b7869960..355d6a3611db 100644 |
2258 |
+--- a/drivers/clk/rockchip/clk-rk3288.c |
2259 |
++++ b/drivers/clk/rockchip/clk-rk3288.c |
2260 |
+@@ -219,7 +219,7 @@ PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" }; |
2261 |
+ PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; |
2262 |
+ PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" }; |
2263 |
+ |
2264 |
+-PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vepu", "aclk_vdpu" }; |
2265 |
++PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vdpu", "aclk_vepu" }; |
2266 |
+ PNAME(mux_usbphy480m_p) = { "sclk_otgphy1_480m", "sclk_otgphy2_480m", |
2267 |
+ "sclk_otgphy0_480m" }; |
2268 |
+ PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy480m_src" }; |
2269 |
+@@ -313,13 +313,13 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
2270 |
+ COMPOSITE_NOMUX(0, "aclk_core_mp", "armclk", CLK_IGNORE_UNUSED, |
2271 |
+ RK3288_CLKSEL_CON(0), 4, 4, DFLAGS | CLK_DIVIDER_READ_ONLY, |
2272 |
+ RK3288_CLKGATE_CON(12), 6, GFLAGS), |
2273 |
+- COMPOSITE_NOMUX(0, "atclk", "armclk", CLK_IGNORE_UNUSED, |
2274 |
++ COMPOSITE_NOMUX(0, "atclk", "armclk", 0, |
2275 |
+ RK3288_CLKSEL_CON(37), 4, 5, DFLAGS | CLK_DIVIDER_READ_ONLY, |
2276 |
+ RK3288_CLKGATE_CON(12), 7, GFLAGS), |
2277 |
+ COMPOSITE_NOMUX(0, "pclk_dbg_pre", "armclk", CLK_IGNORE_UNUSED, |
2278 |
+ RK3288_CLKSEL_CON(37), 9, 5, DFLAGS | CLK_DIVIDER_READ_ONLY, |
2279 |
+ RK3288_CLKGATE_CON(12), 8, GFLAGS), |
2280 |
+- GATE(0, "pclk_dbg", "pclk_dbg_pre", CLK_IGNORE_UNUSED, |
2281 |
++ GATE(0, "pclk_dbg", "pclk_dbg_pre", 0, |
2282 |
+ RK3288_CLKGATE_CON(12), 9, GFLAGS), |
2283 |
+ GATE(0, "cs_dbg", "pclk_dbg_pre", CLK_IGNORE_UNUSED, |
2284 |
+ RK3288_CLKGATE_CON(12), 10, GFLAGS), |
2285 |
+@@ -420,7 +420,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
2286 |
+ COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_usb480m_p, 0, |
2287 |
+ RK3288_CLKSEL_CON(32), 14, 2, MFLAGS, 8, 5, DFLAGS, |
2288 |
+ RK3288_CLKGATE_CON(3), 11, GFLAGS), |
2289 |
+- MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, 0, |
2290 |
++ MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, CLK_SET_RATE_PARENT, |
2291 |
+ RK3288_GRF_SOC_CON(0), 7, 1, MFLAGS), |
2292 |
+ GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 0, |
2293 |
+ RK3288_CLKGATE_CON(9), 0, GFLAGS), |
2294 |
+@@ -647,7 +647,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
2295 |
+ INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out", |
2296 |
+ RK3288_CLKSEL_CON(22), 7, IFLAGS), |
2297 |
+ |
2298 |
+- GATE(0, "jtag", "ext_jtag", CLK_IGNORE_UNUSED, |
2299 |
++ GATE(0, "jtag", "ext_jtag", 0, |
2300 |
+ RK3288_CLKGATE_CON(4), 14, GFLAGS), |
2301 |
+ |
2302 |
+ COMPOSITE_NODIV(SCLK_USBPHY480M_SRC, "usbphy480m_src", mux_usbphy480m_p, 0, |
2303 |
+@@ -656,7 +656,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
2304 |
+ COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0, |
2305 |
+ RK3288_CLKSEL_CON(29), 0, 2, MFLAGS, |
2306 |
+ RK3288_CLKGATE_CON(3), 6, GFLAGS), |
2307 |
+- GATE(0, "hsicphy12m_xin12m", "xin12m", CLK_IGNORE_UNUSED, |
2308 |
++ GATE(0, "hsicphy12m_xin12m", "xin12m", 0, |
2309 |
+ RK3288_CLKGATE_CON(13), 9, GFLAGS), |
2310 |
+ DIV(0, "hsicphy12m_usbphy", "sclk_hsicphy480m", 0, |
2311 |
+ RK3288_CLKSEL_CON(11), 8, 6, DFLAGS), |
2312 |
+@@ -697,7 +697,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
2313 |
+ GATE(PCLK_TZPC, "pclk_tzpc", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 3, GFLAGS), |
2314 |
+ GATE(PCLK_UART2, "pclk_uart2", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 9, GFLAGS), |
2315 |
+ GATE(PCLK_EFUSE256, "pclk_efuse_256", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 10, GFLAGS), |
2316 |
+- GATE(PCLK_RKPWM, "pclk_rkpwm", "pclk_cpu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(11), 11, GFLAGS), |
2317 |
++ GATE(PCLK_RKPWM, "pclk_rkpwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 11, GFLAGS), |
2318 |
+ |
2319 |
+ /* ddrctrl [DDR Controller PHY clock] gates */ |
2320 |
+ GATE(0, "nclk_ddrupctl0", "ddrphy", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(11), 4, GFLAGS), |
2321 |
+@@ -837,12 +837,9 @@ static const char *const rk3288_critical_clocks[] __initconst = { |
2322 |
+ "pclk_alive_niu", |
2323 |
+ "pclk_pd_pmu", |
2324 |
+ "pclk_pmu_niu", |
2325 |
+- "pclk_core_niu", |
2326 |
+- "pclk_ddrupctl0", |
2327 |
+- "pclk_publ0", |
2328 |
+- "pclk_ddrupctl1", |
2329 |
+- "pclk_publ1", |
2330 |
+ "pmu_hclk_otg0", |
2331 |
++ /* pwm-regulators on some boards, so handoff-critical later */ |
2332 |
++ "pclk_rkpwm", |
2333 |
+ }; |
2334 |
+ |
2335 |
+ static void __iomem *rk3288_cru_base; |
2336 |
+diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c |
2337 |
+index a371c66e72ef..bd9b5fbc443b 100644 |
2338 |
+--- a/drivers/clk/zynqmp/divider.c |
2339 |
++++ b/drivers/clk/zynqmp/divider.c |
2340 |
+@@ -31,12 +31,14 @@ |
2341 |
+ * struct zynqmp_clk_divider - adjustable divider clock |
2342 |
+ * @hw: handle between common and hardware-specific interfaces |
2343 |
+ * @flags: Hardware specific flags |
2344 |
++ * @is_frac: The divider is a fractional divider |
2345 |
+ * @clk_id: Id of clock |
2346 |
+ * @div_type: divisor type (TYPE_DIV1 or TYPE_DIV2) |
2347 |
+ */ |
2348 |
+ struct zynqmp_clk_divider { |
2349 |
+ struct clk_hw hw; |
2350 |
+ u8 flags; |
2351 |
++ bool is_frac; |
2352 |
+ u32 clk_id; |
2353 |
+ u32 div_type; |
2354 |
+ }; |
2355 |
+@@ -116,8 +118,7 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw, |
2356 |
+ |
2357 |
+ bestdiv = zynqmp_divider_get_val(*prate, rate); |
2358 |
+ |
2359 |
+- if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && |
2360 |
+- (divider->flags & CLK_FRAC)) |
2361 |
++ if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac) |
2362 |
+ bestdiv = rate % *prate ? 1 : bestdiv; |
2363 |
+ *prate = rate * bestdiv; |
2364 |
+ |
2365 |
+@@ -195,11 +196,13 @@ struct clk_hw *zynqmp_clk_register_divider(const char *name, |
2366 |
+ |
2367 |
+ init.name = name; |
2368 |
+ init.ops = &zynqmp_clk_divider_ops; |
2369 |
+- init.flags = nodes->flag; |
2370 |
++ /* CLK_FRAC is not defined in the common clk framework */ |
2371 |
++ init.flags = nodes->flag & ~CLK_FRAC; |
2372 |
+ init.parent_names = parents; |
2373 |
+ init.num_parents = 1; |
2374 |
+ |
2375 |
+ /* struct clk_divider assignments */ |
2376 |
++ div->is_frac = !!(nodes->flag & CLK_FRAC); |
2377 |
+ div->flags = nodes->type_flag; |
2378 |
+ div->hw.init = &init; |
2379 |
+ div->clk_id = clk_id; |
2380 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
2381 |
+index ef0e33e21b98..97b094963253 100644 |
2382 |
+--- a/drivers/cpufreq/cpufreq.c |
2383 |
++++ b/drivers/cpufreq/cpufreq.c |
2384 |
+@@ -1103,6 +1103,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) |
2385 |
+ cpufreq_global_kobject, "policy%u", cpu); |
2386 |
+ if (ret) { |
2387 |
+ pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret); |
2388 |
++ kobject_put(&policy->kobj); |
2389 |
+ goto err_free_real_cpus; |
2390 |
+ } |
2391 |
+ |
2392 |
+diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c |
2393 |
+index ffa9adeaba31..9d1d9bf02710 100644 |
2394 |
+--- a/drivers/cpufreq/cpufreq_governor.c |
2395 |
++++ b/drivers/cpufreq/cpufreq_governor.c |
2396 |
+@@ -459,6 +459,8 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) |
2397 |
+ /* Failure, so roll back. */ |
2398 |
+ pr_err("initialization failed (dbs_data kobject init error %d)\n", ret); |
2399 |
+ |
2400 |
++ kobject_put(&dbs_data->attr_set.kobj); |
2401 |
++ |
2402 |
+ policy->governor_data = NULL; |
2403 |
+ |
2404 |
+ if (!have_governor_per_policy()) |
2405 |
+diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c |
2406 |
+index 9fedf627e000..3ee55aee5d71 100644 |
2407 |
+--- a/drivers/cpufreq/imx6q-cpufreq.c |
2408 |
++++ b/drivers/cpufreq/imx6q-cpufreq.c |
2409 |
+@@ -407,11 +407,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) |
2410 |
+ ret = imx6ul_opp_check_speed_grading(cpu_dev); |
2411 |
+ if (ret) { |
2412 |
+ if (ret == -EPROBE_DEFER) |
2413 |
+- return ret; |
2414 |
++ goto put_node; |
2415 |
+ |
2416 |
+ dev_err(cpu_dev, "failed to read ocotp: %d\n", |
2417 |
+ ret); |
2418 |
+- return ret; |
2419 |
++ goto put_node; |
2420 |
+ } |
2421 |
+ } else { |
2422 |
+ imx6q_opp_check_speed_grading(cpu_dev); |
2423 |
+diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c |
2424 |
+index c2dd43f3f5d8..8d63a6dc8383 100644 |
2425 |
+--- a/drivers/cpufreq/kirkwood-cpufreq.c |
2426 |
++++ b/drivers/cpufreq/kirkwood-cpufreq.c |
2427 |
+@@ -124,13 +124,14 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) |
2428 |
+ priv.cpu_clk = of_clk_get_by_name(np, "cpu_clk"); |
2429 |
+ if (IS_ERR(priv.cpu_clk)) { |
2430 |
+ dev_err(priv.dev, "Unable to get cpuclk\n"); |
2431 |
+- return PTR_ERR(priv.cpu_clk); |
2432 |
++ err = PTR_ERR(priv.cpu_clk); |
2433 |
++ goto out_node; |
2434 |
+ } |
2435 |
+ |
2436 |
+ err = clk_prepare_enable(priv.cpu_clk); |
2437 |
+ if (err) { |
2438 |
+ dev_err(priv.dev, "Unable to prepare cpuclk\n"); |
2439 |
+- return err; |
2440 |
++ goto out_node; |
2441 |
+ } |
2442 |
+ |
2443 |
+ kirkwood_freq_table[0].frequency = clk_get_rate(priv.cpu_clk) / 1000; |
2444 |
+@@ -161,20 +162,22 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) |
2445 |
+ goto out_ddr; |
2446 |
+ } |
2447 |
+ |
2448 |
+- of_node_put(np); |
2449 |
+- np = NULL; |
2450 |
+- |
2451 |
+ err = cpufreq_register_driver(&kirkwood_cpufreq_driver); |
2452 |
+- if (!err) |
2453 |
+- return 0; |
2454 |
++ if (err) { |
2455 |
++ dev_err(priv.dev, "Failed to register cpufreq driver\n"); |
2456 |
++ goto out_powersave; |
2457 |
++ } |
2458 |
+ |
2459 |
+- dev_err(priv.dev, "Failed to register cpufreq driver\n"); |
2460 |
++ of_node_put(np); |
2461 |
++ return 0; |
2462 |
+ |
2463 |
++out_powersave: |
2464 |
+ clk_disable_unprepare(priv.powersave_clk); |
2465 |
+ out_ddr: |
2466 |
+ clk_disable_unprepare(priv.ddr_clk); |
2467 |
+ out_cpu: |
2468 |
+ clk_disable_unprepare(priv.cpu_clk); |
2469 |
++out_node: |
2470 |
+ of_node_put(np); |
2471 |
+ |
2472 |
+ return err; |
2473 |
+diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c |
2474 |
+index 75dfbd2a58ea..c7710c149de8 100644 |
2475 |
+--- a/drivers/cpufreq/pasemi-cpufreq.c |
2476 |
++++ b/drivers/cpufreq/pasemi-cpufreq.c |
2477 |
+@@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
2478 |
+ |
2479 |
+ cpu = of_get_cpu_node(policy->cpu, NULL); |
2480 |
+ |
2481 |
++ of_node_put(cpu); |
2482 |
+ if (!cpu) |
2483 |
+ goto out; |
2484 |
+ |
2485 |
+diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c |
2486 |
+index 52f0d91d30c1..9b4ce2eb8222 100644 |
2487 |
+--- a/drivers/cpufreq/pmac32-cpufreq.c |
2488 |
++++ b/drivers/cpufreq/pmac32-cpufreq.c |
2489 |
+@@ -552,6 +552,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) |
2490 |
+ volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); |
2491 |
+ if (volt_gpio_np) |
2492 |
+ voltage_gpio = read_gpio(volt_gpio_np); |
2493 |
++ of_node_put(volt_gpio_np); |
2494 |
+ if (!voltage_gpio){ |
2495 |
+ pr_err("missing cpu-vcore-select gpio\n"); |
2496 |
+ return 1; |
2497 |
+@@ -588,6 +589,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) |
2498 |
+ if (volt_gpio_np) |
2499 |
+ voltage_gpio = read_gpio(volt_gpio_np); |
2500 |
+ |
2501 |
++ of_node_put(volt_gpio_np); |
2502 |
+ pvr = mfspr(SPRN_PVR); |
2503 |
+ has_cpu_l2lve = !((pvr & 0xf00) == 0x100); |
2504 |
+ |
2505 |
+diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c |
2506 |
+index 41a0f0be3f9f..8414c3a4ea08 100644 |
2507 |
+--- a/drivers/cpufreq/ppc_cbe_cpufreq.c |
2508 |
++++ b/drivers/cpufreq/ppc_cbe_cpufreq.c |
2509 |
+@@ -86,6 +86,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) |
2510 |
+ if (!cbe_get_cpu_pmd_regs(policy->cpu) || |
2511 |
+ !cbe_get_cpu_mic_tm_regs(policy->cpu)) { |
2512 |
+ pr_info("invalid CBE regs pointers for cpufreq\n"); |
2513 |
++ of_node_put(cpu); |
2514 |
+ return -EINVAL; |
2515 |
+ } |
2516 |
+ |
2517 |
+diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
2518 |
+index a4b5ff2b72f8..f6936bb3b7be 100644 |
2519 |
+--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
2520 |
++++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
2521 |
+@@ -240,7 +240,10 @@ static int sun4i_hash(struct ahash_request *areq) |
2522 |
+ } |
2523 |
+ } else { |
2524 |
+ /* Since we have the flag final, we can go up to modulo 4 */ |
2525 |
+- end = ((areq->nbytes + op->len) / 4) * 4 - op->len; |
2526 |
++ if (areq->nbytes < 4) |
2527 |
++ end = 0; |
2528 |
++ else |
2529 |
++ end = ((areq->nbytes + op->len) / 4) * 4 - op->len; |
2530 |
+ } |
2531 |
+ |
2532 |
+ /* TODO if SGlen % 4 and !op->len then DMA */ |
2533 |
+diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl |
2534 |
+index de78282b8f44..9c6b5c1d6a1a 100644 |
2535 |
+--- a/drivers/crypto/vmx/aesp8-ppc.pl |
2536 |
++++ b/drivers/crypto/vmx/aesp8-ppc.pl |
2537 |
+@@ -1357,7 +1357,7 @@ Loop_ctr32_enc: |
2538 |
+ addi $idx,$idx,16 |
2539 |
+ bdnz Loop_ctr32_enc |
2540 |
+ |
2541 |
+- vadduwm $ivec,$ivec,$one |
2542 |
++ vadduqm $ivec,$ivec,$one |
2543 |
+ vmr $dat,$inptail |
2544 |
+ lvx $inptail,0,$inp |
2545 |
+ addi $inp,$inp,16 |
2546 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
2547 |
+index 0ae3de76833b..839621b044f4 100644 |
2548 |
+--- a/drivers/devfreq/devfreq.c |
2549 |
++++ b/drivers/devfreq/devfreq.c |
2550 |
+@@ -228,7 +228,7 @@ static struct devfreq_governor *find_devfreq_governor(const char *name) |
2551 |
+ * if is not found. This can happen when both drivers (the governor driver |
2552 |
+ * and the driver that call devfreq_add_device) are built as modules. |
2553 |
+ * devfreq_list_lock should be held by the caller. Returns the matched |
2554 |
+- * governor's pointer. |
2555 |
++ * governor's pointer or an error pointer. |
2556 |
+ */ |
2557 |
+ static struct devfreq_governor *try_then_request_governor(const char *name) |
2558 |
+ { |
2559 |
+@@ -254,7 +254,7 @@ static struct devfreq_governor *try_then_request_governor(const char *name) |
2560 |
+ /* Restore previous state before return */ |
2561 |
+ mutex_lock(&devfreq_list_lock); |
2562 |
+ if (err) |
2563 |
+- return NULL; |
2564 |
++ return ERR_PTR(err); |
2565 |
+ |
2566 |
+ governor = find_devfreq_governor(name); |
2567 |
+ } |
2568 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
2569 |
+index fe69dccfa0c0..37a269420435 100644 |
2570 |
+--- a/drivers/dma/at_xdmac.c |
2571 |
++++ b/drivers/dma/at_xdmac.c |
2572 |
+@@ -1606,7 +1606,11 @@ static void at_xdmac_tasklet(unsigned long data) |
2573 |
+ struct at_xdmac_desc, |
2574 |
+ xfer_node); |
2575 |
+ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc); |
2576 |
+- BUG_ON(!desc->active_xfer); |
2577 |
++ if (!desc->active_xfer) { |
2578 |
++ dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting"); |
2579 |
++ spin_unlock_bh(&atchan->lock); |
2580 |
++ return; |
2581 |
++ } |
2582 |
+ |
2583 |
+ txd = &desc->tx_dma_desc; |
2584 |
+ |
2585 |
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
2586 |
+index cff1b143fff5..9b7a49fc7697 100644 |
2587 |
+--- a/drivers/dma/pl330.c |
2588 |
++++ b/drivers/dma/pl330.c |
2589 |
+@@ -966,6 +966,7 @@ static void _stop(struct pl330_thread *thrd) |
2590 |
+ { |
2591 |
+ void __iomem *regs = thrd->dmac->base; |
2592 |
+ u8 insn[6] = {0, 0, 0, 0, 0, 0}; |
2593 |
++ u32 inten = readl(regs + INTEN); |
2594 |
+ |
2595 |
+ if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) |
2596 |
+ UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); |
2597 |
+@@ -978,10 +979,13 @@ static void _stop(struct pl330_thread *thrd) |
2598 |
+ |
2599 |
+ _emit_KILL(0, insn); |
2600 |
+ |
2601 |
+- /* Stop generating interrupts for SEV */ |
2602 |
+- writel(readl(regs + INTEN) & ~(1 << thrd->ev), regs + INTEN); |
2603 |
+- |
2604 |
+ _execute_DBGINSN(thrd, insn, is_manager(thrd)); |
2605 |
++ |
2606 |
++ /* clear the event */ |
2607 |
++ if (inten & (1 << thrd->ev)) |
2608 |
++ writel(1 << thrd->ev, regs + INTCLR); |
2609 |
++ /* Stop generating interrupts for SEV */ |
2610 |
++ writel(inten & ~(1 << thrd->ev), regs + INTEN); |
2611 |
+ } |
2612 |
+ |
2613 |
+ /* Start doing req 'idx' of thread 'thrd' */ |
2614 |
+diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c |
2615 |
+index b26256f23d67..09b6756366c3 100644 |
2616 |
+--- a/drivers/dma/tegra210-adma.c |
2617 |
++++ b/drivers/dma/tegra210-adma.c |
2618 |
+@@ -22,7 +22,6 @@ |
2619 |
+ #include <linux/of_device.h> |
2620 |
+ #include <linux/of_dma.h> |
2621 |
+ #include <linux/of_irq.h> |
2622 |
+-#include <linux/pm_clock.h> |
2623 |
+ #include <linux/pm_runtime.h> |
2624 |
+ #include <linux/slab.h> |
2625 |
+ |
2626 |
+@@ -141,6 +140,7 @@ struct tegra_adma { |
2627 |
+ struct dma_device dma_dev; |
2628 |
+ struct device *dev; |
2629 |
+ void __iomem *base_addr; |
2630 |
++ struct clk *ahub_clk; |
2631 |
+ unsigned int nr_channels; |
2632 |
+ unsigned long rx_requests_reserved; |
2633 |
+ unsigned long tx_requests_reserved; |
2634 |
+@@ -637,8 +637,9 @@ static int tegra_adma_runtime_suspend(struct device *dev) |
2635 |
+ struct tegra_adma *tdma = dev_get_drvdata(dev); |
2636 |
+ |
2637 |
+ tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD); |
2638 |
++ clk_disable_unprepare(tdma->ahub_clk); |
2639 |
+ |
2640 |
+- return pm_clk_suspend(dev); |
2641 |
++ return 0; |
2642 |
+ } |
2643 |
+ |
2644 |
+ static int tegra_adma_runtime_resume(struct device *dev) |
2645 |
+@@ -646,10 +647,11 @@ static int tegra_adma_runtime_resume(struct device *dev) |
2646 |
+ struct tegra_adma *tdma = dev_get_drvdata(dev); |
2647 |
+ int ret; |
2648 |
+ |
2649 |
+- ret = pm_clk_resume(dev); |
2650 |
+- if (ret) |
2651 |
++ ret = clk_prepare_enable(tdma->ahub_clk); |
2652 |
++ if (ret) { |
2653 |
++ dev_err(dev, "ahub clk_enable failed: %d\n", ret); |
2654 |
+ return ret; |
2655 |
+- |
2656 |
++ } |
2657 |
+ tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd); |
2658 |
+ |
2659 |
+ return 0; |
2660 |
+@@ -692,13 +694,11 @@ static int tegra_adma_probe(struct platform_device *pdev) |
2661 |
+ if (IS_ERR(tdma->base_addr)) |
2662 |
+ return PTR_ERR(tdma->base_addr); |
2663 |
+ |
2664 |
+- ret = pm_clk_create(&pdev->dev); |
2665 |
+- if (ret) |
2666 |
+- return ret; |
2667 |
+- |
2668 |
+- ret = of_pm_clk_add_clk(&pdev->dev, "d_audio"); |
2669 |
+- if (ret) |
2670 |
+- goto clk_destroy; |
2671 |
++ tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio"); |
2672 |
++ if (IS_ERR(tdma->ahub_clk)) { |
2673 |
++ dev_err(&pdev->dev, "Error: Missing ahub controller clock\n"); |
2674 |
++ return PTR_ERR(tdma->ahub_clk); |
2675 |
++ } |
2676 |
+ |
2677 |
+ pm_runtime_enable(&pdev->dev); |
2678 |
+ |
2679 |
+@@ -775,8 +775,6 @@ rpm_put: |
2680 |
+ pm_runtime_put_sync(&pdev->dev); |
2681 |
+ rpm_disable: |
2682 |
+ pm_runtime_disable(&pdev->dev); |
2683 |
+-clk_destroy: |
2684 |
+- pm_clk_destroy(&pdev->dev); |
2685 |
+ |
2686 |
+ return ret; |
2687 |
+ } |
2688 |
+@@ -786,6 +784,7 @@ static int tegra_adma_remove(struct platform_device *pdev) |
2689 |
+ struct tegra_adma *tdma = platform_get_drvdata(pdev); |
2690 |
+ int i; |
2691 |
+ |
2692 |
++ of_dma_controller_free(pdev->dev.of_node); |
2693 |
+ dma_async_device_unregister(&tdma->dma_dev); |
2694 |
+ |
2695 |
+ for (i = 0; i < tdma->nr_channels; ++i) |
2696 |
+@@ -793,7 +792,6 @@ static int tegra_adma_remove(struct platform_device *pdev) |
2697 |
+ |
2698 |
+ pm_runtime_put_sync(&pdev->dev); |
2699 |
+ pm_runtime_disable(&pdev->dev); |
2700 |
+- pm_clk_destroy(&pdev->dev); |
2701 |
+ |
2702 |
+ return 0; |
2703 |
+ } |
2704 |
+diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c |
2705 |
+index da0e9bc4262f..9327479c719c 100644 |
2706 |
+--- a/drivers/extcon/extcon-arizona.c |
2707 |
++++ b/drivers/extcon/extcon-arizona.c |
2708 |
+@@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev) |
2709 |
+ struct arizona_extcon_info *info = platform_get_drvdata(pdev); |
2710 |
+ struct arizona *arizona = info->arizona; |
2711 |
+ int jack_irq_rise, jack_irq_fall; |
2712 |
++ bool change; |
2713 |
++ |
2714 |
++ regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, |
2715 |
++ ARIZONA_MICD_ENA, 0, |
2716 |
++ &change); |
2717 |
++ |
2718 |
++ if (change) { |
2719 |
++ regulator_disable(info->micvdd); |
2720 |
++ pm_runtime_put(info->dev); |
2721 |
++ } |
2722 |
+ |
2723 |
+ gpiod_put(info->micd_pol_gpio); |
2724 |
+ |
2725 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
2726 |
+index ee47c11e92ce..4dee2326b29c 100644 |
2727 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
2728 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
2729 |
+@@ -136,8 +136,9 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, |
2730 |
+ { |
2731 |
+ struct amdgpu_device *adev = ring->adev; |
2732 |
+ struct amdgpu_fence *fence; |
2733 |
+- struct dma_fence *old, **ptr; |
2734 |
++ struct dma_fence __rcu **ptr; |
2735 |
+ uint32_t seq; |
2736 |
++ int r; |
2737 |
+ |
2738 |
+ fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); |
2739 |
+ if (fence == NULL) |
2740 |
+@@ -153,15 +154,24 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, |
2741 |
+ seq, flags | AMDGPU_FENCE_FLAG_INT); |
2742 |
+ |
2743 |
+ ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; |
2744 |
++ if (unlikely(rcu_dereference_protected(*ptr, 1))) { |
2745 |
++ struct dma_fence *old; |
2746 |
++ |
2747 |
++ rcu_read_lock(); |
2748 |
++ old = dma_fence_get_rcu_safe(ptr); |
2749 |
++ rcu_read_unlock(); |
2750 |
++ |
2751 |
++ if (old) { |
2752 |
++ r = dma_fence_wait(old, false); |
2753 |
++ dma_fence_put(old); |
2754 |
++ if (r) |
2755 |
++ return r; |
2756 |
++ } |
2757 |
++ } |
2758 |
++ |
2759 |
+ /* This function can't be called concurrently anyway, otherwise |
2760 |
+ * emitting the fence would mess up the hardware ring buffer. |
2761 |
+ */ |
2762 |
+- old = rcu_dereference_protected(*ptr, 1); |
2763 |
+- if (old && !dma_fence_is_signaled(old)) { |
2764 |
+- DRM_INFO("rcu slot is busy\n"); |
2765 |
+- dma_fence_wait(old, false); |
2766 |
+- } |
2767 |
+- |
2768 |
+ rcu_assign_pointer(*ptr, dma_fence_get(&fence->base)); |
2769 |
+ |
2770 |
+ *f = &fence->base; |
2771 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2772 |
+index 84ee77786944..864c2faf672b 100644 |
2773 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2774 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2775 |
+@@ -3519,6 +3519,8 @@ static void dm_drm_plane_reset(struct drm_plane *plane) |
2776 |
+ plane->state = &amdgpu_state->base; |
2777 |
+ plane->state->plane = plane; |
2778 |
+ plane->state->rotation = DRM_MODE_ROTATE_0; |
2779 |
++ plane->state->alpha = DRM_BLEND_ALPHA_OPAQUE; |
2780 |
++ plane->state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI; |
2781 |
+ } |
2782 |
+ } |
2783 |
+ |
2784 |
+@@ -4976,8 +4978,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, |
2785 |
+ static void amdgpu_dm_crtc_copy_transient_flags(struct drm_crtc_state *crtc_state, |
2786 |
+ struct dc_stream_state *stream_state) |
2787 |
+ { |
2788 |
+- stream_state->mode_changed = |
2789 |
+- crtc_state->mode_changed || crtc_state->active_changed; |
2790 |
++ stream_state->mode_changed = drm_atomic_crtc_needs_modeset(crtc_state); |
2791 |
+ } |
2792 |
+ |
2793 |
+ static int amdgpu_dm_atomic_commit(struct drm_device *dev, |
2794 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
2795 |
+index 5af2ea1f201d..c0db7788c464 100644 |
2796 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
2797 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
2798 |
+@@ -524,6 +524,14 @@ void dc_link_set_preferred_link_settings(struct dc *dc, |
2799 |
+ struct dc_stream_state *link_stream; |
2800 |
+ struct dc_link_settings store_settings = *link_setting; |
2801 |
+ |
2802 |
++ link->preferred_link_setting = store_settings; |
2803 |
++ |
2804 |
++ /* Retrain with preferred link settings only relevant for |
2805 |
++ * DP signal type |
2806 |
++ */ |
2807 |
++ if (!dc_is_dp_signal(link->connector_signal)) |
2808 |
++ return; |
2809 |
++ |
2810 |
+ for (i = 0; i < MAX_PIPES; i++) { |
2811 |
+ pipe = &dc->current_state->res_ctx.pipe_ctx[i]; |
2812 |
+ if (pipe->stream && pipe->stream->sink |
2813 |
+@@ -539,7 +547,10 @@ void dc_link_set_preferred_link_settings(struct dc *dc, |
2814 |
+ |
2815 |
+ link_stream = link->dc->current_state->res_ctx.pipe_ctx[i].stream; |
2816 |
+ |
2817 |
+- link->preferred_link_setting = store_settings; |
2818 |
++ /* Cannot retrain link if backend is off */ |
2819 |
++ if (link_stream->dpms_off) |
2820 |
++ return; |
2821 |
++ |
2822 |
+ if (link_stream) |
2823 |
+ decide_link_settings(link_stream, &store_settings); |
2824 |
+ |
2825 |
+@@ -1500,6 +1511,7 @@ static void commit_planes_do_stream_update(struct dc *dc, |
2826 |
+ continue; |
2827 |
+ |
2828 |
+ if (stream_update->dpms_off) { |
2829 |
++ dc->hwss.pipe_control_lock(dc, pipe_ctx, true); |
2830 |
+ if (*stream_update->dpms_off) { |
2831 |
+ core_link_disable_stream(pipe_ctx, KEEP_ACQUIRED_RESOURCE); |
2832 |
+ dc->hwss.optimize_bandwidth(dc, dc->current_state); |
2833 |
+@@ -1507,6 +1519,7 @@ static void commit_planes_do_stream_update(struct dc *dc, |
2834 |
+ dc->hwss.prepare_bandwidth(dc, dc->current_state); |
2835 |
+ core_link_enable_stream(dc->current_state, pipe_ctx); |
2836 |
+ } |
2837 |
++ dc->hwss.pipe_control_lock(dc, pipe_ctx, false); |
2838 |
+ } |
2839 |
+ |
2840 |
+ if (stream_update->abm_level && pipe_ctx->stream_res.abm) { |
2841 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2842 |
+index 76137df74a53..c6aa80d7e639 100644 |
2843 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2844 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2845 |
+@@ -1266,10 +1266,12 @@ bool dc_remove_plane_from_context( |
2846 |
+ * For head pipe detach surfaces from pipe for tail |
2847 |
+ * pipe just zero it out |
2848 |
+ */ |
2849 |
+- if (!pipe_ctx->top_pipe) { |
2850 |
++ if (!pipe_ctx->top_pipe || |
2851 |
++ (!pipe_ctx->top_pipe->top_pipe && |
2852 |
++ pipe_ctx->top_pipe->stream_res.opp != pipe_ctx->stream_res.opp)) { |
2853 |
+ pipe_ctx->plane_state = NULL; |
2854 |
+ pipe_ctx->bottom_pipe = NULL; |
2855 |
+- } else { |
2856 |
++ } else { |
2857 |
+ memset(pipe_ctx, 0, sizeof(*pipe_ctx)); |
2858 |
+ } |
2859 |
+ } |
2860 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c |
2861 |
+index 4a863a5dab41..321af9af95e8 100644 |
2862 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c |
2863 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c |
2864 |
+@@ -406,15 +406,25 @@ void dpp1_dscl_calc_lb_num_partitions( |
2865 |
+ int *num_part_y, |
2866 |
+ int *num_part_c) |
2867 |
+ { |
2868 |
++ int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a, |
2869 |
++ lb_bpc, memory_line_size_y, memory_line_size_c, memory_line_size_a; |
2870 |
++ |
2871 |
+ int line_size = scl_data->viewport.width < scl_data->recout.width ? |
2872 |
+ scl_data->viewport.width : scl_data->recout.width; |
2873 |
+ int line_size_c = scl_data->viewport_c.width < scl_data->recout.width ? |
2874 |
+ scl_data->viewport_c.width : scl_data->recout.width; |
2875 |
+- int lb_bpc = dpp1_dscl_get_lb_depth_bpc(scl_data->lb_params.depth); |
2876 |
+- int memory_line_size_y = (line_size * lb_bpc + 71) / 72; /* +71 to ceil */ |
2877 |
+- int memory_line_size_c = (line_size_c * lb_bpc + 71) / 72; /* +71 to ceil */ |
2878 |
+- int memory_line_size_a = (line_size + 5) / 6; /* +5 to ceil */ |
2879 |
+- int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a; |
2880 |
++ |
2881 |
++ if (line_size == 0) |
2882 |
++ line_size = 1; |
2883 |
++ |
2884 |
++ if (line_size_c == 0) |
2885 |
++ line_size_c = 1; |
2886 |
++ |
2887 |
++ |
2888 |
++ lb_bpc = dpp1_dscl_get_lb_depth_bpc(scl_data->lb_params.depth); |
2889 |
++ memory_line_size_y = (line_size * lb_bpc + 71) / 72; /* +71 to ceil */ |
2890 |
++ memory_line_size_c = (line_size_c * lb_bpc + 71) / 72; /* +71 to ceil */ |
2891 |
++ memory_line_size_a = (line_size + 5) / 6; /* +5 to ceil */ |
2892 |
+ |
2893 |
+ if (lb_config == LB_MEMORY_CONFIG_1) { |
2894 |
+ lb_memory_size = 816; |
2895 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c |
2896 |
+index a684b38332ac..2ab05a4e8ed4 100644 |
2897 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c |
2898 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c |
2899 |
+@@ -2658,9 +2658,15 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx) |
2900 |
+ .rotation = pipe_ctx->plane_state->rotation, |
2901 |
+ .mirror = pipe_ctx->plane_state->horizontal_mirror |
2902 |
+ }; |
2903 |
+- |
2904 |
+- pos_cpy.x_hotspot += pipe_ctx->plane_state->dst_rect.x; |
2905 |
+- pos_cpy.y_hotspot += pipe_ctx->plane_state->dst_rect.y; |
2906 |
++ uint32_t x_plane = pipe_ctx->plane_state->dst_rect.x; |
2907 |
++ uint32_t y_plane = pipe_ctx->plane_state->dst_rect.y; |
2908 |
++ uint32_t x_offset = min(x_plane, pos_cpy.x); |
2909 |
++ uint32_t y_offset = min(y_plane, pos_cpy.y); |
2910 |
++ |
2911 |
++ pos_cpy.x -= x_offset; |
2912 |
++ pos_cpy.y -= y_offset; |
2913 |
++ pos_cpy.x_hotspot += (x_plane - x_offset); |
2914 |
++ pos_cpy.y_hotspot += (y_plane - y_offset); |
2915 |
+ |
2916 |
+ if (pipe_ctx->plane_state->address.type |
2917 |
+ == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE) |
2918 |
+diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c |
2919 |
+index 4985384e51f6..59ffb6b9c745 100644 |
2920 |
+--- a/drivers/gpu/drm/drm_atomic_state_helper.c |
2921 |
++++ b/drivers/gpu/drm/drm_atomic_state_helper.c |
2922 |
+@@ -30,6 +30,7 @@ |
2923 |
+ #include <drm/drm_connector.h> |
2924 |
+ #include <drm/drm_atomic.h> |
2925 |
+ #include <drm/drm_device.h> |
2926 |
++#include <drm/drm_writeback.h> |
2927 |
+ |
2928 |
+ #include <linux/slab.h> |
2929 |
+ #include <linux/dma-fence.h> |
2930 |
+@@ -412,6 +413,9 @@ __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state) |
2931 |
+ |
2932 |
+ if (state->commit) |
2933 |
+ drm_crtc_commit_put(state->commit); |
2934 |
++ |
2935 |
++ if (state->writeback_job) |
2936 |
++ drm_writeback_cleanup_job(state->writeback_job); |
2937 |
+ } |
2938 |
+ EXPORT_SYMBOL(__drm_atomic_helper_connector_destroy_state); |
2939 |
+ |
2940 |
+diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c |
2941 |
+index 7a59b8b3ed5a..81c8936bc1d3 100644 |
2942 |
+--- a/drivers/gpu/drm/drm_drv.c |
2943 |
++++ b/drivers/gpu/drm/drm_drv.c |
2944 |
+@@ -499,7 +499,7 @@ int drm_dev_init(struct drm_device *dev, |
2945 |
+ BUG_ON(!parent); |
2946 |
+ |
2947 |
+ kref_init(&dev->ref); |
2948 |
+- dev->dev = parent; |
2949 |
++ dev->dev = get_device(parent); |
2950 |
+ dev->driver = driver; |
2951 |
+ |
2952 |
+ /* no per-device feature limits by default */ |
2953 |
+@@ -569,6 +569,7 @@ err_minors: |
2954 |
+ drm_minor_free(dev, DRM_MINOR_RENDER); |
2955 |
+ drm_fs_inode_free(dev->anon_inode); |
2956 |
+ err_free: |
2957 |
++ put_device(dev->dev); |
2958 |
+ mutex_destroy(&dev->master_mutex); |
2959 |
+ mutex_destroy(&dev->ctxlist_mutex); |
2960 |
+ mutex_destroy(&dev->clientlist_mutex); |
2961 |
+@@ -604,6 +605,8 @@ void drm_dev_fini(struct drm_device *dev) |
2962 |
+ drm_minor_free(dev, DRM_MINOR_PRIMARY); |
2963 |
+ drm_minor_free(dev, DRM_MINOR_RENDER); |
2964 |
+ |
2965 |
++ put_device(dev->dev); |
2966 |
++ |
2967 |
+ mutex_destroy(&dev->master_mutex); |
2968 |
+ mutex_destroy(&dev->ctxlist_mutex); |
2969 |
+ mutex_destroy(&dev->clientlist_mutex); |
2970 |
+diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c |
2971 |
+index 3f20f598cd7c..9c5bc0121ff9 100644 |
2972 |
+--- a/drivers/gpu/drm/drm_file.c |
2973 |
++++ b/drivers/gpu/drm/drm_file.c |
2974 |
+@@ -567,6 +567,7 @@ put_back_event: |
2975 |
+ file_priv->event_space -= length; |
2976 |
+ list_add(&e->link, &file_priv->event_list); |
2977 |
+ spin_unlock_irq(&dev->event_lock); |
2978 |
++ wake_up_interruptible(&file_priv->event_wait); |
2979 |
+ break; |
2980 |
+ } |
2981 |
+ |
2982 |
+diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c |
2983 |
+index c20e6fe00cb3..2d75032f8159 100644 |
2984 |
+--- a/drivers/gpu/drm/drm_writeback.c |
2985 |
++++ b/drivers/gpu/drm/drm_writeback.c |
2986 |
+@@ -268,6 +268,15 @@ void drm_writeback_queue_job(struct drm_writeback_connector *wb_connector, |
2987 |
+ } |
2988 |
+ EXPORT_SYMBOL(drm_writeback_queue_job); |
2989 |
+ |
2990 |
++void drm_writeback_cleanup_job(struct drm_writeback_job *job) |
2991 |
++{ |
2992 |
++ if (job->fb) |
2993 |
++ drm_framebuffer_put(job->fb); |
2994 |
++ |
2995 |
++ kfree(job); |
2996 |
++} |
2997 |
++EXPORT_SYMBOL(drm_writeback_cleanup_job); |
2998 |
++ |
2999 |
+ /* |
3000 |
+ * @cleanup_work: deferred cleanup of a writeback job |
3001 |
+ * |
3002 |
+@@ -280,10 +289,9 @@ static void cleanup_work(struct work_struct *work) |
3003 |
+ struct drm_writeback_job *job = container_of(work, |
3004 |
+ struct drm_writeback_job, |
3005 |
+ cleanup_work); |
3006 |
+- drm_framebuffer_put(job->fb); |
3007 |
+- kfree(job); |
3008 |
+-} |
3009 |
+ |
3010 |
++ drm_writeback_cleanup_job(job); |
3011 |
++} |
3012 |
+ |
3013 |
+ /** |
3014 |
+ * drm_writeback_signal_completion - Signal the completion of a writeback job |
3015 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c |
3016 |
+index 18c27f795cf6..3156450723ba 100644 |
3017 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c |
3018 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c |
3019 |
+@@ -515,6 +515,9 @@ static int etnaviv_bind(struct device *dev) |
3020 |
+ } |
3021 |
+ drm->dev_private = priv; |
3022 |
+ |
3023 |
++ dev->dma_parms = &priv->dma_parms; |
3024 |
++ dma_set_max_seg_size(dev, SZ_2G); |
3025 |
++ |
3026 |
+ mutex_init(&priv->gem_lock); |
3027 |
+ INIT_LIST_HEAD(&priv->gem_list); |
3028 |
+ priv->num_gpus = 0; |
3029 |
+@@ -552,6 +555,8 @@ static void etnaviv_unbind(struct device *dev) |
3030 |
+ |
3031 |
+ component_unbind_all(dev, drm); |
3032 |
+ |
3033 |
++ dev->dma_parms = NULL; |
3034 |
++ |
3035 |
+ drm->dev_private = NULL; |
3036 |
+ kfree(priv); |
3037 |
+ |
3038 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h b/drivers/gpu/drm/etnaviv/etnaviv_drv.h |
3039 |
+index 4bf698de5996..51b7bdf5748b 100644 |
3040 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h |
3041 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h |
3042 |
+@@ -43,6 +43,7 @@ struct etnaviv_file_private { |
3043 |
+ |
3044 |
+ struct etnaviv_drm_private { |
3045 |
+ int num_gpus; |
3046 |
++ struct device_dma_parameters dma_parms; |
3047 |
+ struct etnaviv_gpu *gpu[ETNA_MAX_PIPES]; |
3048 |
+ |
3049 |
+ /* list of GEM objects: */ |
3050 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
3051 |
+index d5f5e56422f5..270da14cba67 100644 |
3052 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
3053 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
3054 |
+@@ -34,7 +34,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) |
3055 |
+ { |
3056 |
+ struct device *dev = &gpu->pdev->dev; |
3057 |
+ const struct firmware *fw; |
3058 |
+- struct device_node *np; |
3059 |
++ struct device_node *np, *mem_np; |
3060 |
+ struct resource r; |
3061 |
+ phys_addr_t mem_phys; |
3062 |
+ ssize_t mem_size; |
3063 |
+@@ -48,11 +48,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) |
3064 |
+ if (!np) |
3065 |
+ return -ENODEV; |
3066 |
+ |
3067 |
+- np = of_parse_phandle(np, "memory-region", 0); |
3068 |
+- if (!np) |
3069 |
++ mem_np = of_parse_phandle(np, "memory-region", 0); |
3070 |
++ of_node_put(np); |
3071 |
++ if (!mem_np) |
3072 |
+ return -EINVAL; |
3073 |
+ |
3074 |
+- ret = of_address_to_resource(np, 0, &r); |
3075 |
++ ret = of_address_to_resource(mem_np, 0, &r); |
3076 |
++ of_node_put(mem_np); |
3077 |
+ if (ret) |
3078 |
+ return ret; |
3079 |
+ |
3080 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
3081 |
+index 36158b7d99cd..1aea0fc894b2 100644 |
3082 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
3083 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
3084 |
+@@ -1034,13 +1034,13 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, |
3085 |
+ if (!dpu_enc->hw_pp[i]) { |
3086 |
+ DPU_ERROR_ENC(dpu_enc, "no pp block assigned" |
3087 |
+ "at idx: %d\n", i); |
3088 |
+- return; |
3089 |
++ goto error; |
3090 |
+ } |
3091 |
+ |
3092 |
+ if (!hw_ctl[i]) { |
3093 |
+ DPU_ERROR_ENC(dpu_enc, "no ctl block assigned" |
3094 |
+ "at idx: %d\n", i); |
3095 |
+- return; |
3096 |
++ goto error; |
3097 |
+ } |
3098 |
+ |
3099 |
+ phys->hw_pp = dpu_enc->hw_pp[i]; |
3100 |
+@@ -1053,6 +1053,9 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, |
3101 |
+ } |
3102 |
+ |
3103 |
+ dpu_enc->mode_set_complete = true; |
3104 |
++ |
3105 |
++error: |
3106 |
++ dpu_rm_release(&dpu_kms->rm, drm_enc); |
3107 |
+ } |
3108 |
+ |
3109 |
+ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) |
3110 |
+@@ -1558,8 +1561,14 @@ static void _dpu_encoder_kickoff_phys(struct dpu_encoder_virt *dpu_enc, |
3111 |
+ if (!ctl) |
3112 |
+ continue; |
3113 |
+ |
3114 |
+- if (phys->split_role != ENC_ROLE_SLAVE) |
3115 |
++ /* |
3116 |
++ * This is cleared in frame_done worker, which isn't invoked |
3117 |
++ * for async commits. So don't set this for async, since it'll |
3118 |
++ * roll over to the next commit. |
3119 |
++ */ |
3120 |
++ if (!async && phys->split_role != ENC_ROLE_SLAVE) |
3121 |
+ set_bit(i, dpu_enc->frame_busy_mask); |
3122 |
++ |
3123 |
+ if (!phys->ops.needs_single_flush || |
3124 |
+ !phys->ops.needs_single_flush(phys)) |
3125 |
+ _dpu_encoder_trigger_flush(&dpu_enc->base, phys, 0x0, |
3126 |
+diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c |
3127 |
+index 49c04829cf34..fcf7a83f0e6f 100644 |
3128 |
+--- a/drivers/gpu/drm/msm/msm_gem_vma.c |
3129 |
++++ b/drivers/gpu/drm/msm/msm_gem_vma.c |
3130 |
+@@ -85,7 +85,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, |
3131 |
+ |
3132 |
+ vma->mapped = true; |
3133 |
+ |
3134 |
+- if (aspace->mmu) |
3135 |
++ if (aspace && aspace->mmu) |
3136 |
+ ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, |
3137 |
+ size, prot); |
3138 |
+ |
3139 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c |
3140 |
+index 157b076a1272..38c9c086754b 100644 |
3141 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c |
3142 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c |
3143 |
+@@ -109,7 +109,7 @@ nv50_bar_oneinit(struct nvkm_bar *base) |
3144 |
+ struct nvkm_device *device = bar->base.subdev.device; |
3145 |
+ static struct lock_class_key bar1_lock; |
3146 |
+ static struct lock_class_key bar2_lock; |
3147 |
+- u64 start, limit; |
3148 |
++ u64 start, limit, size; |
3149 |
+ int ret; |
3150 |
+ |
3151 |
+ ret = nvkm_gpuobj_new(device, 0x20000, 0, false, NULL, &bar->mem); |
3152 |
+@@ -127,7 +127,10 @@ nv50_bar_oneinit(struct nvkm_bar *base) |
3153 |
+ |
3154 |
+ /* BAR2 */ |
3155 |
+ start = 0x0100000000ULL; |
3156 |
+- limit = start + device->func->resource_size(device, 3); |
3157 |
++ size = device->func->resource_size(device, 3); |
3158 |
++ if (!size) |
3159 |
++ return -ENOMEM; |
3160 |
++ limit = start + size; |
3161 |
+ |
3162 |
+ ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0, |
3163 |
+ &bar2_lock, "bar2", &bar->bar2_vmm); |
3164 |
+@@ -164,7 +167,10 @@ nv50_bar_oneinit(struct nvkm_bar *base) |
3165 |
+ |
3166 |
+ /* BAR1 */ |
3167 |
+ start = 0x0000000000ULL; |
3168 |
+- limit = start + device->func->resource_size(device, 1); |
3169 |
++ size = device->func->resource_size(device, 1); |
3170 |
++ if (!size) |
3171 |
++ return -ENOMEM; |
3172 |
++ limit = start + size; |
3173 |
+ |
3174 |
+ ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0, |
3175 |
+ &bar1_lock, "bar1", &bar->bar1_vmm); |
3176 |
+diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c |
3177 |
+index 64fb788b6647..f0fe975ed46c 100644 |
3178 |
+--- a/drivers/gpu/drm/omapdrm/dss/dsi.c |
3179 |
++++ b/drivers/gpu/drm/omapdrm/dss/dsi.c |
3180 |
+@@ -1342,12 +1342,9 @@ static int dsi_pll_enable(struct dss_pll *pll) |
3181 |
+ */ |
3182 |
+ dsi_enable_scp_clk(dsi); |
3183 |
+ |
3184 |
+- if (!dsi->vdds_dsi_enabled) { |
3185 |
+- r = regulator_enable(dsi->vdds_dsi_reg); |
3186 |
+- if (r) |
3187 |
+- goto err0; |
3188 |
+- dsi->vdds_dsi_enabled = true; |
3189 |
+- } |
3190 |
++ r = regulator_enable(dsi->vdds_dsi_reg); |
3191 |
++ if (r) |
3192 |
++ goto err0; |
3193 |
+ |
3194 |
+ /* XXX PLL does not come out of reset without this... */ |
3195 |
+ dispc_pck_free_enable(dsi->dss->dispc, 1); |
3196 |
+@@ -1372,36 +1369,25 @@ static int dsi_pll_enable(struct dss_pll *pll) |
3197 |
+ |
3198 |
+ return 0; |
3199 |
+ err1: |
3200 |
+- if (dsi->vdds_dsi_enabled) { |
3201 |
+- regulator_disable(dsi->vdds_dsi_reg); |
3202 |
+- dsi->vdds_dsi_enabled = false; |
3203 |
+- } |
3204 |
++ regulator_disable(dsi->vdds_dsi_reg); |
3205 |
+ err0: |
3206 |
+ dsi_disable_scp_clk(dsi); |
3207 |
+ dsi_runtime_put(dsi); |
3208 |
+ return r; |
3209 |
+ } |
3210 |
+ |
3211 |
+-static void dsi_pll_uninit(struct dsi_data *dsi, bool disconnect_lanes) |
3212 |
++static void dsi_pll_disable(struct dss_pll *pll) |
3213 |
+ { |
3214 |
++ struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); |
3215 |
++ |
3216 |
+ dsi_pll_power(dsi, DSI_PLL_POWER_OFF); |
3217 |
+- if (disconnect_lanes) { |
3218 |
+- WARN_ON(!dsi->vdds_dsi_enabled); |
3219 |
+- regulator_disable(dsi->vdds_dsi_reg); |
3220 |
+- dsi->vdds_dsi_enabled = false; |
3221 |
+- } |
3222 |
++ |
3223 |
++ regulator_disable(dsi->vdds_dsi_reg); |
3224 |
+ |
3225 |
+ dsi_disable_scp_clk(dsi); |
3226 |
+ dsi_runtime_put(dsi); |
3227 |
+ |
3228 |
+- DSSDBG("PLL uninit done\n"); |
3229 |
+-} |
3230 |
+- |
3231 |
+-static void dsi_pll_disable(struct dss_pll *pll) |
3232 |
+-{ |
3233 |
+- struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); |
3234 |
+- |
3235 |
+- dsi_pll_uninit(dsi, true); |
3236 |
++ DSSDBG("PLL disable done\n"); |
3237 |
+ } |
3238 |
+ |
3239 |
+ static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) |
3240 |
+@@ -4096,11 +4082,11 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) |
3241 |
+ |
3242 |
+ r = dss_pll_enable(&dsi->pll); |
3243 |
+ if (r) |
3244 |
+- goto err0; |
3245 |
++ return r; |
3246 |
+ |
3247 |
+ r = dsi_configure_dsi_clocks(dsi); |
3248 |
+ if (r) |
3249 |
+- goto err1; |
3250 |
++ goto err0; |
3251 |
+ |
3252 |
+ dss_select_dsi_clk_source(dsi->dss, dsi->module_id, |
3253 |
+ dsi->module_id == 0 ? |
3254 |
+@@ -4108,6 +4094,14 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) |
3255 |
+ |
3256 |
+ DSSDBG("PLL OK\n"); |
3257 |
+ |
3258 |
++ if (!dsi->vdds_dsi_enabled) { |
3259 |
++ r = regulator_enable(dsi->vdds_dsi_reg); |
3260 |
++ if (r) |
3261 |
++ goto err1; |
3262 |
++ |
3263 |
++ dsi->vdds_dsi_enabled = true; |
3264 |
++ } |
3265 |
++ |
3266 |
+ r = dsi_cio_init(dsi); |
3267 |
+ if (r) |
3268 |
+ goto err2; |
3269 |
+@@ -4136,10 +4130,13 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) |
3270 |
+ err3: |
3271 |
+ dsi_cio_uninit(dsi); |
3272 |
+ err2: |
3273 |
+- dss_select_dsi_clk_source(dsi->dss, dsi->module_id, DSS_CLK_SRC_FCK); |
3274 |
++ regulator_disable(dsi->vdds_dsi_reg); |
3275 |
++ dsi->vdds_dsi_enabled = false; |
3276 |
+ err1: |
3277 |
+- dss_pll_disable(&dsi->pll); |
3278 |
++ dss_select_dsi_clk_source(dsi->dss, dsi->module_id, DSS_CLK_SRC_FCK); |
3279 |
+ err0: |
3280 |
++ dss_pll_disable(&dsi->pll); |
3281 |
++ |
3282 |
+ return r; |
3283 |
+ } |
3284 |
+ |
3285 |
+@@ -4158,7 +4155,12 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes, |
3286 |
+ |
3287 |
+ dss_select_dsi_clk_source(dsi->dss, dsi->module_id, DSS_CLK_SRC_FCK); |
3288 |
+ dsi_cio_uninit(dsi); |
3289 |
+- dsi_pll_uninit(dsi, disconnect_lanes); |
3290 |
++ dss_pll_disable(&dsi->pll); |
3291 |
++ |
3292 |
++ if (disconnect_lanes) { |
3293 |
++ regulator_disable(dsi->vdds_dsi_reg); |
3294 |
++ dsi->vdds_dsi_enabled = false; |
3295 |
++ } |
3296 |
+ } |
3297 |
+ |
3298 |
+ static int dsi_display_enable(struct omap_dss_device *dssdev) |
3299 |
+diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c |
3300 |
+index b81302c4bf9e..a45f925cb19a 100644 |
3301 |
+--- a/drivers/gpu/drm/omapdrm/omap_connector.c |
3302 |
++++ b/drivers/gpu/drm/omapdrm/omap_connector.c |
3303 |
+@@ -36,18 +36,22 @@ struct omap_connector { |
3304 |
+ }; |
3305 |
+ |
3306 |
+ static void omap_connector_hpd_notify(struct drm_connector *connector, |
3307 |
+- struct omap_dss_device *src, |
3308 |
+ enum drm_connector_status status) |
3309 |
+ { |
3310 |
+- if (status == connector_status_disconnected) { |
3311 |
+- /* |
3312 |
+- * If the source is an HDMI encoder, notify it of disconnection. |
3313 |
+- * This is required to let the HDMI encoder reset any internal |
3314 |
+- * state related to connection status, such as the CEC address. |
3315 |
+- */ |
3316 |
+- if (src && src->type == OMAP_DISPLAY_TYPE_HDMI && |
3317 |
+- src->ops->hdmi.lost_hotplug) |
3318 |
+- src->ops->hdmi.lost_hotplug(src); |
3319 |
++ struct omap_connector *omap_connector = to_omap_connector(connector); |
3320 |
++ struct omap_dss_device *dssdev; |
3321 |
++ |
3322 |
++ if (status != connector_status_disconnected) |
3323 |
++ return; |
3324 |
++ |
3325 |
++ /* |
3326 |
++ * Notify all devics in the pipeline of disconnection. This is required |
3327 |
++ * to let the HDMI encoders reset their internal state related to |
3328 |
++ * connection status, such as the CEC address. |
3329 |
++ */ |
3330 |
++ for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) { |
3331 |
++ if (dssdev->ops && dssdev->ops->hdmi.lost_hotplug) |
3332 |
++ dssdev->ops->hdmi.lost_hotplug(dssdev); |
3333 |
+ } |
3334 |
+ } |
3335 |
+ |
3336 |
+@@ -67,7 +71,7 @@ static void omap_connector_hpd_cb(void *cb_data, |
3337 |
+ if (old_status == status) |
3338 |
+ return; |
3339 |
+ |
3340 |
+- omap_connector_hpd_notify(connector, omap_connector->hpd, status); |
3341 |
++ omap_connector_hpd_notify(connector, status); |
3342 |
+ |
3343 |
+ drm_kms_helper_hotplug_event(dev); |
3344 |
+ } |
3345 |
+@@ -128,7 +132,7 @@ static enum drm_connector_status omap_connector_detect( |
3346 |
+ ? connector_status_connected |
3347 |
+ : connector_status_disconnected; |
3348 |
+ |
3349 |
+- omap_connector_hpd_notify(connector, dssdev->src, status); |
3350 |
++ omap_connector_hpd_notify(connector, status); |
3351 |
+ } else { |
3352 |
+ switch (omap_connector->display->type) { |
3353 |
+ case OMAP_DISPLAY_TYPE_DPI: |
3354 |
+diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c |
3355 |
+index 87fa316e1d7b..58ccf648b70f 100644 |
3356 |
+--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c |
3357 |
++++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c |
3358 |
+@@ -248,6 +248,9 @@ static int otm8009a_init_sequence(struct otm8009a *ctx) |
3359 |
+ /* Send Command GRAM memory write (no parameters) */ |
3360 |
+ dcs_write_seq(ctx, MIPI_DCS_WRITE_MEMORY_START); |
3361 |
+ |
3362 |
++ /* Wait a short while to let the panel be ready before the 1st frame */ |
3363 |
++ mdelay(10); |
3364 |
++ |
3365 |
+ return 0; |
3366 |
+ } |
3367 |
+ |
3368 |
+diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c |
3369 |
+index b9baefdba38a..1c318ad32a8c 100644 |
3370 |
+--- a/drivers/gpu/drm/pl111/pl111_versatile.c |
3371 |
++++ b/drivers/gpu/drm/pl111/pl111_versatile.c |
3372 |
+@@ -330,6 +330,7 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) |
3373 |
+ ret = vexpress_muxfpga_init(); |
3374 |
+ if (ret) { |
3375 |
+ dev_err(dev, "unable to initialize muxfpga driver\n"); |
3376 |
++ of_node_put(np); |
3377 |
+ return ret; |
3378 |
+ } |
3379 |
+ |
3380 |
+@@ -337,17 +338,20 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) |
3381 |
+ pdev = of_find_device_by_node(np); |
3382 |
+ if (!pdev) { |
3383 |
+ dev_err(dev, "can't find the sysreg device, deferring\n"); |
3384 |
++ of_node_put(np); |
3385 |
+ return -EPROBE_DEFER; |
3386 |
+ } |
3387 |
+ map = dev_get_drvdata(&pdev->dev); |
3388 |
+ if (!map) { |
3389 |
+ dev_err(dev, "sysreg has not yet probed\n"); |
3390 |
+ platform_device_put(pdev); |
3391 |
++ of_node_put(np); |
3392 |
+ return -EPROBE_DEFER; |
3393 |
+ } |
3394 |
+ } else { |
3395 |
+ map = syscon_node_to_regmap(np); |
3396 |
+ } |
3397 |
++ of_node_put(np); |
3398 |
+ |
3399 |
+ if (IS_ERR(map)) { |
3400 |
+ dev_err(dev, "no Versatile syscon regmap\n"); |
3401 |
+diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c |
3402 |
+index 534a128a869d..ccdfc64e122a 100644 |
3403 |
+--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c |
3404 |
++++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c |
3405 |
+@@ -427,9 +427,13 @@ static void rcar_lvds_enable(struct drm_bridge *bridge) |
3406 |
+ } |
3407 |
+ |
3408 |
+ if (lvds->info->quirks & RCAR_LVDS_QUIRK_GEN3_LVEN) { |
3409 |
+- /* Turn on the LVDS PHY. */ |
3410 |
++ /* |
3411 |
++ * Turn on the LVDS PHY. On D3, the LVEN and LVRES bit must be |
3412 |
++ * set at the same time, so don't write the register yet. |
3413 |
++ */ |
3414 |
+ lvdcr0 |= LVDCR0_LVEN; |
3415 |
+- rcar_lvds_write(lvds, LVDCR0, lvdcr0); |
3416 |
++ if (!(lvds->info->quirks & RCAR_LVDS_QUIRK_PWD)) |
3417 |
++ rcar_lvds_write(lvds, LVDCR0, lvdcr0); |
3418 |
+ } |
3419 |
+ |
3420 |
+ if (!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)) { |
3421 |
+diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
3422 |
+index e3b34a345546..97a0573cc514 100644 |
3423 |
+--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
3424 |
++++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
3425 |
+@@ -357,7 +357,13 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, |
3426 |
+ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, |
3427 |
+ struct drm_display_mode *mode) |
3428 |
+ { |
3429 |
+- return mode->vtotal - (mode->vsync_end - mode->vdisplay) + 1; |
3430 |
++ u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100); |
3431 |
++ u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; |
3432 |
++ |
3433 |
++ if (delay > mode->vtotal) |
3434 |
++ delay = delay % mode->vtotal; |
3435 |
++ |
3436 |
++ return max_t(u16, delay, 1); |
3437 |
+ } |
3438 |
+ |
3439 |
+ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, |
3440 |
+diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c |
3441 |
+index 78f7c2d1b449..5d85894607c7 100644 |
3442 |
+--- a/drivers/gpu/drm/tinydrm/ili9225.c |
3443 |
++++ b/drivers/gpu/drm/tinydrm/ili9225.c |
3444 |
+@@ -279,7 +279,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) |
3445 |
+ mipi->enabled = false; |
3446 |
+ } |
3447 |
+ |
3448 |
+-static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 cmd, u8 *par, |
3449 |
++static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par, |
3450 |
+ size_t num) |
3451 |
+ { |
3452 |
+ struct spi_device *spi = mipi->spi; |
3453 |
+@@ -289,11 +289,11 @@ static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 cmd, u8 *par, |
3454 |
+ |
3455 |
+ gpiod_set_value_cansleep(mipi->dc, 0); |
3456 |
+ speed_hz = mipi_dbi_spi_cmd_max_speed(spi, 1); |
3457 |
+- ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, &cmd, 1); |
3458 |
++ ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, cmd, 1); |
3459 |
+ if (ret || !num) |
3460 |
+ return ret; |
3461 |
+ |
3462 |
+- if (cmd == ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) |
3463 |
++ if (*cmd == ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) |
3464 |
+ bpw = 16; |
3465 |
+ |
3466 |
+ gpiod_set_value_cansleep(mipi->dc, 1); |
3467 |
+diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c |
3468 |
+index 3a05e56f9b0d..dd091c7eecf9 100644 |
3469 |
+--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c |
3470 |
++++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c |
3471 |
+@@ -148,16 +148,42 @@ EXPORT_SYMBOL(mipi_dbi_command_read); |
3472 |
+ */ |
3473 |
+ int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len) |
3474 |
+ { |
3475 |
++ u8 *cmdbuf; |
3476 |
+ int ret; |
3477 |
+ |
3478 |
++ /* SPI requires dma-safe buffers */ |
3479 |
++ cmdbuf = kmemdup(&cmd, 1, GFP_KERNEL); |
3480 |
++ if (!cmdbuf) |
3481 |
++ return -ENOMEM; |
3482 |
++ |
3483 |
+ mutex_lock(&mipi->cmdlock); |
3484 |
+- ret = mipi->command(mipi, cmd, data, len); |
3485 |
++ ret = mipi->command(mipi, cmdbuf, data, len); |
3486 |
+ mutex_unlock(&mipi->cmdlock); |
3487 |
+ |
3488 |
++ kfree(cmdbuf); |
3489 |
++ |
3490 |
+ return ret; |
3491 |
+ } |
3492 |
+ EXPORT_SYMBOL(mipi_dbi_command_buf); |
3493 |
+ |
3494 |
++/* This should only be used by mipi_dbi_command() */ |
3495 |
++int mipi_dbi_command_stackbuf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len) |
3496 |
++{ |
3497 |
++ u8 *buf; |
3498 |
++ int ret; |
3499 |
++ |
3500 |
++ buf = kmemdup(data, len, GFP_KERNEL); |
3501 |
++ if (!buf) |
3502 |
++ return -ENOMEM; |
3503 |
++ |
3504 |
++ ret = mipi_dbi_command_buf(mipi, cmd, buf, len); |
3505 |
++ |
3506 |
++ kfree(buf); |
3507 |
++ |
3508 |
++ return ret; |
3509 |
++} |
3510 |
++EXPORT_SYMBOL(mipi_dbi_command_stackbuf); |
3511 |
++ |
3512 |
+ /** |
3513 |
+ * mipi_dbi_buf_copy - Copy a framebuffer, transforming it if necessary |
3514 |
+ * @dst: The destination buffer |
3515 |
+@@ -745,18 +771,18 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *mipi, int dc, |
3516 |
+ return 0; |
3517 |
+ } |
3518 |
+ |
3519 |
+-static int mipi_dbi_typec1_command(struct mipi_dbi *mipi, u8 cmd, |
3520 |
++static int mipi_dbi_typec1_command(struct mipi_dbi *mipi, u8 *cmd, |
3521 |
+ u8 *parameters, size_t num) |
3522 |
+ { |
3523 |
+- unsigned int bpw = (cmd == MIPI_DCS_WRITE_MEMORY_START) ? 16 : 8; |
3524 |
++ unsigned int bpw = (*cmd == MIPI_DCS_WRITE_MEMORY_START) ? 16 : 8; |
3525 |
+ int ret; |
3526 |
+ |
3527 |
+- if (mipi_dbi_command_is_read(mipi, cmd)) |
3528 |
++ if (mipi_dbi_command_is_read(mipi, *cmd)) |
3529 |
+ return -ENOTSUPP; |
3530 |
+ |
3531 |
+- MIPI_DBI_DEBUG_COMMAND(cmd, parameters, num); |
3532 |
++ MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num); |
3533 |
+ |
3534 |
+- ret = mipi_dbi_spi1_transfer(mipi, 0, &cmd, 1, 8); |
3535 |
++ ret = mipi_dbi_spi1_transfer(mipi, 0, cmd, 1, 8); |
3536 |
+ if (ret || !num) |
3537 |
+ return ret; |
3538 |
+ |
3539 |
+@@ -765,7 +791,7 @@ static int mipi_dbi_typec1_command(struct mipi_dbi *mipi, u8 cmd, |
3540 |
+ |
3541 |
+ /* MIPI DBI Type C Option 3 */ |
3542 |
+ |
3543 |
+-static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
3544 |
++static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 *cmd, |
3545 |
+ u8 *data, size_t len) |
3546 |
+ { |
3547 |
+ struct spi_device *spi = mipi->spi; |
3548 |
+@@ -774,7 +800,7 @@ static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
3549 |
+ struct spi_transfer tr[2] = { |
3550 |
+ { |
3551 |
+ .speed_hz = speed_hz, |
3552 |
+- .tx_buf = &cmd, |
3553 |
++ .tx_buf = cmd, |
3554 |
+ .len = 1, |
3555 |
+ }, { |
3556 |
+ .speed_hz = speed_hz, |
3557 |
+@@ -792,8 +818,8 @@ static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
3558 |
+ * Support non-standard 24-bit and 32-bit Nokia read commands which |
3559 |
+ * start with a dummy clock, so we need to read an extra byte. |
3560 |
+ */ |
3561 |
+- if (cmd == MIPI_DCS_GET_DISPLAY_ID || |
3562 |
+- cmd == MIPI_DCS_GET_DISPLAY_STATUS) { |
3563 |
++ if (*cmd == MIPI_DCS_GET_DISPLAY_ID || |
3564 |
++ *cmd == MIPI_DCS_GET_DISPLAY_STATUS) { |
3565 |
+ if (!(len == 3 || len == 4)) |
3566 |
+ return -EINVAL; |
3567 |
+ |
3568 |
+@@ -823,7 +849,7 @@ static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
3569 |
+ data[i] = (buf[i] << 1) | !!(buf[i + 1] & BIT(7)); |
3570 |
+ } |
3571 |
+ |
3572 |
+- MIPI_DBI_DEBUG_COMMAND(cmd, data, len); |
3573 |
++ MIPI_DBI_DEBUG_COMMAND(*cmd, data, len); |
3574 |
+ |
3575 |
+ err_free: |
3576 |
+ kfree(buf); |
3577 |
+@@ -831,7 +857,7 @@ err_free: |
3578 |
+ return ret; |
3579 |
+ } |
3580 |
+ |
3581 |
+-static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 cmd, |
3582 |
++static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 *cmd, |
3583 |
+ u8 *par, size_t num) |
3584 |
+ { |
3585 |
+ struct spi_device *spi = mipi->spi; |
3586 |
+@@ -839,18 +865,18 @@ static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 cmd, |
3587 |
+ u32 speed_hz; |
3588 |
+ int ret; |
3589 |
+ |
3590 |
+- if (mipi_dbi_command_is_read(mipi, cmd)) |
3591 |
++ if (mipi_dbi_command_is_read(mipi, *cmd)) |
3592 |
+ return mipi_dbi_typec3_command_read(mipi, cmd, par, num); |
3593 |
+ |
3594 |
+- MIPI_DBI_DEBUG_COMMAND(cmd, par, num); |
3595 |
++ MIPI_DBI_DEBUG_COMMAND(*cmd, par, num); |
3596 |
+ |
3597 |
+ gpiod_set_value_cansleep(mipi->dc, 0); |
3598 |
+ speed_hz = mipi_dbi_spi_cmd_max_speed(spi, 1); |
3599 |
+- ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, &cmd, 1); |
3600 |
++ ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, cmd, 1); |
3601 |
+ if (ret || !num) |
3602 |
+ return ret; |
3603 |
+ |
3604 |
+- if (cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes) |
3605 |
++ if (*cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes) |
3606 |
+ bpw = 16; |
3607 |
+ |
3608 |
+ gpiod_set_value_cansleep(mipi->dc, 1); |
3609 |
+diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c |
3610 |
+index f0afcec72c34..30ae1c74edaa 100644 |
3611 |
+--- a/drivers/gpu/drm/v3d/v3d_drv.c |
3612 |
++++ b/drivers/gpu/drm/v3d/v3d_drv.c |
3613 |
+@@ -312,14 +312,18 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) |
3614 |
+ if (ret) |
3615 |
+ goto dev_destroy; |
3616 |
+ |
3617 |
+- v3d_irq_init(v3d); |
3618 |
++ ret = v3d_irq_init(v3d); |
3619 |
++ if (ret) |
3620 |
++ goto gem_destroy; |
3621 |
+ |
3622 |
+ ret = drm_dev_register(drm, 0); |
3623 |
+ if (ret) |
3624 |
+- goto gem_destroy; |
3625 |
++ goto irq_disable; |
3626 |
+ |
3627 |
+ return 0; |
3628 |
+ |
3629 |
++irq_disable: |
3630 |
++ v3d_irq_disable(v3d); |
3631 |
+ gem_destroy: |
3632 |
+ v3d_gem_destroy(drm); |
3633 |
+ dev_destroy: |
3634 |
+diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h |
3635 |
+index dcb772a19191..f2937a1da581 100644 |
3636 |
+--- a/drivers/gpu/drm/v3d/v3d_drv.h |
3637 |
++++ b/drivers/gpu/drm/v3d/v3d_drv.h |
3638 |
+@@ -311,7 +311,7 @@ void v3d_invalidate_caches(struct v3d_dev *v3d); |
3639 |
+ void v3d_flush_caches(struct v3d_dev *v3d); |
3640 |
+ |
3641 |
+ /* v3d_irq.c */ |
3642 |
+-void v3d_irq_init(struct v3d_dev *v3d); |
3643 |
++int v3d_irq_init(struct v3d_dev *v3d); |
3644 |
+ void v3d_irq_enable(struct v3d_dev *v3d); |
3645 |
+ void v3d_irq_disable(struct v3d_dev *v3d); |
3646 |
+ void v3d_irq_reset(struct v3d_dev *v3d); |
3647 |
+diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c |
3648 |
+index 69338da70ddc..29d746cfce57 100644 |
3649 |
+--- a/drivers/gpu/drm/v3d/v3d_irq.c |
3650 |
++++ b/drivers/gpu/drm/v3d/v3d_irq.c |
3651 |
+@@ -156,7 +156,7 @@ v3d_hub_irq(int irq, void *arg) |
3652 |
+ return status; |
3653 |
+ } |
3654 |
+ |
3655 |
+-void |
3656 |
++int |
3657 |
+ v3d_irq_init(struct v3d_dev *v3d) |
3658 |
+ { |
3659 |
+ int ret, core; |
3660 |
+@@ -173,13 +173,22 @@ v3d_irq_init(struct v3d_dev *v3d) |
3661 |
+ ret = devm_request_irq(v3d->dev, platform_get_irq(v3d->pdev, 0), |
3662 |
+ v3d_hub_irq, IRQF_SHARED, |
3663 |
+ "v3d_hub", v3d); |
3664 |
++ if (ret) |
3665 |
++ goto fail; |
3666 |
++ |
3667 |
+ ret = devm_request_irq(v3d->dev, platform_get_irq(v3d->pdev, 1), |
3668 |
+ v3d_irq, IRQF_SHARED, |
3669 |
+ "v3d_core0", v3d); |
3670 |
+ if (ret) |
3671 |
+- dev_err(v3d->dev, "IRQ setup failed: %d\n", ret); |
3672 |
++ goto fail; |
3673 |
+ |
3674 |
+ v3d_irq_enable(v3d); |
3675 |
++ return 0; |
3676 |
++ |
3677 |
++fail: |
3678 |
++ if (ret != -EPROBE_DEFER) |
3679 |
++ dev_err(v3d->dev, "IRQ setup failed: %d\n", ret); |
3680 |
++ return ret; |
3681 |
+ } |
3682 |
+ |
3683 |
+ void |
3684 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
3685 |
+index 860e21ec6a49..63a43726cce0 100644 |
3686 |
+--- a/drivers/hid/hid-core.c |
3687 |
++++ b/drivers/hid/hid-core.c |
3688 |
+@@ -218,13 +218,14 @@ static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) |
3689 |
+ * Add a usage to the temporary parser table. |
3690 |
+ */ |
3691 |
+ |
3692 |
+-static int hid_add_usage(struct hid_parser *parser, unsigned usage) |
3693 |
++static int hid_add_usage(struct hid_parser *parser, unsigned usage, u8 size) |
3694 |
+ { |
3695 |
+ if (parser->local.usage_index >= HID_MAX_USAGES) { |
3696 |
+ hid_err(parser->device, "usage index exceeded\n"); |
3697 |
+ return -1; |
3698 |
+ } |
3699 |
+ parser->local.usage[parser->local.usage_index] = usage; |
3700 |
++ parser->local.usage_size[parser->local.usage_index] = size; |
3701 |
+ parser->local.collection_index[parser->local.usage_index] = |
3702 |
+ parser->collection_stack_ptr ? |
3703 |
+ parser->collection_stack[parser->collection_stack_ptr - 1] : 0; |
3704 |
+@@ -486,10 +487,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
3705 |
+ return 0; |
3706 |
+ } |
3707 |
+ |
3708 |
+- if (item->size <= 2) |
3709 |
+- data = (parser->global.usage_page << 16) + data; |
3710 |
+- |
3711 |
+- return hid_add_usage(parser, data); |
3712 |
++ return hid_add_usage(parser, data, item->size); |
3713 |
+ |
3714 |
+ case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
3715 |
+ |
3716 |
+@@ -498,9 +496,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
3717 |
+ return 0; |
3718 |
+ } |
3719 |
+ |
3720 |
+- if (item->size <= 2) |
3721 |
+- data = (parser->global.usage_page << 16) + data; |
3722 |
+- |
3723 |
+ parser->local.usage_minimum = data; |
3724 |
+ return 0; |
3725 |
+ |
3726 |
+@@ -511,9 +506,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
3727 |
+ return 0; |
3728 |
+ } |
3729 |
+ |
3730 |
+- if (item->size <= 2) |
3731 |
+- data = (parser->global.usage_page << 16) + data; |
3732 |
+- |
3733 |
+ count = data - parser->local.usage_minimum; |
3734 |
+ if (count + parser->local.usage_index >= HID_MAX_USAGES) { |
3735 |
+ /* |
3736 |
+@@ -533,7 +525,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
3737 |
+ } |
3738 |
+ |
3739 |
+ for (n = parser->local.usage_minimum; n <= data; n++) |
3740 |
+- if (hid_add_usage(parser, n)) { |
3741 |
++ if (hid_add_usage(parser, n, item->size)) { |
3742 |
+ dbg_hid("hid_add_usage failed\n"); |
3743 |
+ return -1; |
3744 |
+ } |
3745 |
+@@ -547,6 +539,22 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
3746 |
+ return 0; |
3747 |
+ } |
3748 |
+ |
3749 |
++/* |
3750 |
++ * Concatenate Usage Pages into Usages where relevant: |
3751 |
++ * As per specification, 6.2.2.8: "When the parser encounters a main item it |
3752 |
++ * concatenates the last declared Usage Page with a Usage to form a complete |
3753 |
++ * usage value." |
3754 |
++ */ |
3755 |
++ |
3756 |
++static void hid_concatenate_usage_page(struct hid_parser *parser) |
3757 |
++{ |
3758 |
++ int i; |
3759 |
++ |
3760 |
++ for (i = 0; i < parser->local.usage_index; i++) |
3761 |
++ if (parser->local.usage_size[i] <= 2) |
3762 |
++ parser->local.usage[i] += parser->global.usage_page << 16; |
3763 |
++} |
3764 |
++ |
3765 |
+ /* |
3766 |
+ * Process a main item. |
3767 |
+ */ |
3768 |
+@@ -556,6 +564,8 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) |
3769 |
+ __u32 data; |
3770 |
+ int ret; |
3771 |
+ |
3772 |
++ hid_concatenate_usage_page(parser); |
3773 |
++ |
3774 |
+ data = item_udata(item); |
3775 |
+ |
3776 |
+ switch (item->tag) { |
3777 |
+@@ -765,6 +775,8 @@ static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) |
3778 |
+ __u32 data; |
3779 |
+ int i; |
3780 |
+ |
3781 |
++ hid_concatenate_usage_page(parser); |
3782 |
++ |
3783 |
+ data = item_udata(item); |
3784 |
+ |
3785 |
+ switch (item->tag) { |
3786 |
+diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
3787 |
+index 199cc256e9d9..e74fa990ba13 100644 |
3788 |
+--- a/drivers/hid/hid-logitech-hidpp.c |
3789 |
++++ b/drivers/hid/hid-logitech-hidpp.c |
3790 |
+@@ -836,13 +836,16 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, |
3791 |
+ |
3792 |
+ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
3793 |
+ { |
3794 |
++ const u8 ping_byte = 0x5a; |
3795 |
++ u8 ping_data[3] = { 0, 0, ping_byte }; |
3796 |
+ struct hidpp_report response; |
3797 |
+ int ret; |
3798 |
+ |
3799 |
+- ret = hidpp_send_fap_command_sync(hidpp, |
3800 |
++ ret = hidpp_send_rap_command_sync(hidpp, |
3801 |
++ REPORT_ID_HIDPP_SHORT, |
3802 |
+ HIDPP_PAGE_ROOT_IDX, |
3803 |
+ CMD_ROOT_GET_PROTOCOL_VERSION, |
3804 |
+- NULL, 0, &response); |
3805 |
++ ping_data, sizeof(ping_data), &response); |
3806 |
+ |
3807 |
+ if (ret == HIDPP_ERROR_INVALID_SUBID) { |
3808 |
+ hidpp->protocol_major = 1; |
3809 |
+@@ -862,8 +865,14 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
3810 |
+ if (ret) |
3811 |
+ return ret; |
3812 |
+ |
3813 |
+- hidpp->protocol_major = response.fap.params[0]; |
3814 |
+- hidpp->protocol_minor = response.fap.params[1]; |
3815 |
++ if (response.rap.params[2] != ping_byte) { |
3816 |
++ hid_err(hidpp->hid_dev, "%s: ping mismatch 0x%02x != 0x%02x\n", |
3817 |
++ __func__, response.rap.params[2], ping_byte); |
3818 |
++ return -EPROTO; |
3819 |
++ } |
3820 |
++ |
3821 |
++ hidpp->protocol_major = response.rap.params[0]; |
3822 |
++ hidpp->protocol_minor = response.rap.params[1]; |
3823 |
+ |
3824 |
+ return ret; |
3825 |
+ } |
3826 |
+@@ -1012,7 +1021,11 @@ static int hidpp_map_battery_level(int capacity) |
3827 |
+ { |
3828 |
+ if (capacity < 11) |
3829 |
+ return POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL; |
3830 |
+- else if (capacity < 31) |
3831 |
++ /* |
3832 |
++ * The spec says this should be < 31 but some devices report 30 |
3833 |
++ * with brand new batteries and Windows reports 30 as "Good". |
3834 |
++ */ |
3835 |
++ else if (capacity < 30) |
3836 |
+ return POWER_SUPPLY_CAPACITY_LEVEL_LOW; |
3837 |
+ else if (capacity < 81) |
3838 |
+ return POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; |
3839 |
+diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c |
3840 |
+index 73c681162653..623736d2a7c1 100644 |
3841 |
+--- a/drivers/hwmon/f71805f.c |
3842 |
++++ b/drivers/hwmon/f71805f.c |
3843 |
+@@ -96,17 +96,23 @@ superio_select(int base, int ld) |
3844 |
+ outb(ld, base + 1); |
3845 |
+ } |
3846 |
+ |
3847 |
+-static inline void |
3848 |
++static inline int |
3849 |
+ superio_enter(int base) |
3850 |
+ { |
3851 |
++ if (!request_muxed_region(base, 2, DRVNAME)) |
3852 |
++ return -EBUSY; |
3853 |
++ |
3854 |
+ outb(0x87, base); |
3855 |
+ outb(0x87, base); |
3856 |
++ |
3857 |
++ return 0; |
3858 |
+ } |
3859 |
+ |
3860 |
+ static inline void |
3861 |
+ superio_exit(int base) |
3862 |
+ { |
3863 |
+ outb(0xaa, base); |
3864 |
++ release_region(base, 2); |
3865 |
+ } |
3866 |
+ |
3867 |
+ /* |
3868 |
+@@ -1561,7 +1567,7 @@ exit: |
3869 |
+ static int __init f71805f_find(int sioaddr, unsigned short *address, |
3870 |
+ struct f71805f_sio_data *sio_data) |
3871 |
+ { |
3872 |
+- int err = -ENODEV; |
3873 |
++ int err; |
3874 |
+ u16 devid; |
3875 |
+ |
3876 |
+ static const char * const names[] = { |
3877 |
+@@ -1569,8 +1575,11 @@ static int __init f71805f_find(int sioaddr, unsigned short *address, |
3878 |
+ "F71872F/FG or F71806F/FG", |
3879 |
+ }; |
3880 |
+ |
3881 |
+- superio_enter(sioaddr); |
3882 |
++ err = superio_enter(sioaddr); |
3883 |
++ if (err) |
3884 |
++ return err; |
3885 |
+ |
3886 |
++ err = -ENODEV; |
3887 |
+ devid = superio_inw(sioaddr, SIO_REG_MANID); |
3888 |
+ if (devid != SIO_FINTEK_ID) |
3889 |
+ goto exit; |
3890 |
+diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c |
3891 |
+index dc5a9d5ada51..81a05cd1a512 100644 |
3892 |
+--- a/drivers/hwmon/pc87427.c |
3893 |
++++ b/drivers/hwmon/pc87427.c |
3894 |
+@@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRVNAME " FMC", DRVNAME " HMC" }; |
3895 |
+ #define LD_IN 1 |
3896 |
+ #define LD_TEMP 1 |
3897 |
+ |
3898 |
++static inline int superio_enter(int sioaddr) |
3899 |
++{ |
3900 |
++ if (!request_muxed_region(sioaddr, 2, DRVNAME)) |
3901 |
++ return -EBUSY; |
3902 |
++ return 0; |
3903 |
++} |
3904 |
++ |
3905 |
+ static inline void superio_outb(int sioaddr, int reg, int val) |
3906 |
+ { |
3907 |
+ outb(reg, sioaddr); |
3908 |
+@@ -122,6 +129,7 @@ static inline void superio_exit(int sioaddr) |
3909 |
+ { |
3910 |
+ outb(0x02, sioaddr); |
3911 |
+ outb(0x02, sioaddr + 1); |
3912 |
++ release_region(sioaddr, 2); |
3913 |
+ } |
3914 |
+ |
3915 |
+ /* |
3916 |
+@@ -1220,7 +1228,11 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data) |
3917 |
+ { |
3918 |
+ u16 val; |
3919 |
+ u8 cfg, cfg_b; |
3920 |
+- int i, err = 0; |
3921 |
++ int i, err; |
3922 |
++ |
3923 |
++ err = superio_enter(sioaddr); |
3924 |
++ if (err) |
3925 |
++ return err; |
3926 |
+ |
3927 |
+ /* Identify device */ |
3928 |
+ val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID); |
3929 |
+diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c |
3930 |
+index 6bd200756560..cbdb5c4991ae 100644 |
3931 |
+--- a/drivers/hwmon/smsc47b397.c |
3932 |
++++ b/drivers/hwmon/smsc47b397.c |
3933 |
+@@ -72,14 +72,19 @@ static inline void superio_select(int ld) |
3934 |
+ superio_outb(0x07, ld); |
3935 |
+ } |
3936 |
+ |
3937 |
+-static inline void superio_enter(void) |
3938 |
++static inline int superio_enter(void) |
3939 |
+ { |
3940 |
++ if (!request_muxed_region(REG, 2, DRVNAME)) |
3941 |
++ return -EBUSY; |
3942 |
++ |
3943 |
+ outb(0x55, REG); |
3944 |
++ return 0; |
3945 |
+ } |
3946 |
+ |
3947 |
+ static inline void superio_exit(void) |
3948 |
+ { |
3949 |
+ outb(0xAA, REG); |
3950 |
++ release_region(REG, 2); |
3951 |
+ } |
3952 |
+ |
3953 |
+ #define SUPERIO_REG_DEVID 0x20 |
3954 |
+@@ -300,8 +305,12 @@ static int __init smsc47b397_find(void) |
3955 |
+ u8 id, rev; |
3956 |
+ char *name; |
3957 |
+ unsigned short addr; |
3958 |
++ int err; |
3959 |
++ |
3960 |
++ err = superio_enter(); |
3961 |
++ if (err) |
3962 |
++ return err; |
3963 |
+ |
3964 |
+- superio_enter(); |
3965 |
+ id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
3966 |
+ |
3967 |
+ switch (id) { |
3968 |
+diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c |
3969 |
+index c7b6a425e2c0..5eeac9853d0a 100644 |
3970 |
+--- a/drivers/hwmon/smsc47m1.c |
3971 |
++++ b/drivers/hwmon/smsc47m1.c |
3972 |
+@@ -73,16 +73,21 @@ superio_inb(int reg) |
3973 |
+ /* logical device for fans is 0x0A */ |
3974 |
+ #define superio_select() superio_outb(0x07, 0x0A) |
3975 |
+ |
3976 |
+-static inline void |
3977 |
++static inline int |
3978 |
+ superio_enter(void) |
3979 |
+ { |
3980 |
++ if (!request_muxed_region(REG, 2, DRVNAME)) |
3981 |
++ return -EBUSY; |
3982 |
++ |
3983 |
+ outb(0x55, REG); |
3984 |
++ return 0; |
3985 |
+ } |
3986 |
+ |
3987 |
+ static inline void |
3988 |
+ superio_exit(void) |
3989 |
+ { |
3990 |
+ outb(0xAA, REG); |
3991 |
++ release_region(REG, 2); |
3992 |
+ } |
3993 |
+ |
3994 |
+ #define SUPERIO_REG_ACT 0x30 |
3995 |
+@@ -531,8 +536,12 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
3996 |
+ { |
3997 |
+ u8 val; |
3998 |
+ unsigned short addr; |
3999 |
++ int err; |
4000 |
++ |
4001 |
++ err = superio_enter(); |
4002 |
++ if (err) |
4003 |
++ return err; |
4004 |
+ |
4005 |
+- superio_enter(); |
4006 |
+ val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
4007 |
+ |
4008 |
+ /* |
4009 |
+@@ -608,13 +617,14 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
4010 |
+ static void smsc47m1_restore(const struct smsc47m1_sio_data *sio_data) |
4011 |
+ { |
4012 |
+ if ((sio_data->activate & 0x01) == 0) { |
4013 |
+- superio_enter(); |
4014 |
+- superio_select(); |
4015 |
+- |
4016 |
+- pr_info("Disabling device\n"); |
4017 |
+- superio_outb(SUPERIO_REG_ACT, sio_data->activate); |
4018 |
+- |
4019 |
+- superio_exit(); |
4020 |
++ if (!superio_enter()) { |
4021 |
++ superio_select(); |
4022 |
++ pr_info("Disabling device\n"); |
4023 |
++ superio_outb(SUPERIO_REG_ACT, sio_data->activate); |
4024 |
++ superio_exit(); |
4025 |
++ } else { |
4026 |
++ pr_warn("Failed to disable device\n"); |
4027 |
++ } |
4028 |
+ } |
4029 |
+ } |
4030 |
+ |
4031 |
+diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c |
4032 |
+index 3a6bfa51cb94..95d5e8ec8b7f 100644 |
4033 |
+--- a/drivers/hwmon/vt1211.c |
4034 |
++++ b/drivers/hwmon/vt1211.c |
4035 |
+@@ -226,15 +226,21 @@ static inline void superio_select(int sio_cip, int ldn) |
4036 |
+ outb(ldn, sio_cip + 1); |
4037 |
+ } |
4038 |
+ |
4039 |
+-static inline void superio_enter(int sio_cip) |
4040 |
++static inline int superio_enter(int sio_cip) |
4041 |
+ { |
4042 |
++ if (!request_muxed_region(sio_cip, 2, DRVNAME)) |
4043 |
++ return -EBUSY; |
4044 |
++ |
4045 |
+ outb(0x87, sio_cip); |
4046 |
+ outb(0x87, sio_cip); |
4047 |
++ |
4048 |
++ return 0; |
4049 |
+ } |
4050 |
+ |
4051 |
+ static inline void superio_exit(int sio_cip) |
4052 |
+ { |
4053 |
+ outb(0xaa, sio_cip); |
4054 |
++ release_region(sio_cip, 2); |
4055 |
+ } |
4056 |
+ |
4057 |
+ /* --------------------------------------------------------------------- |
4058 |
+@@ -1282,11 +1288,14 @@ EXIT: |
4059 |
+ |
4060 |
+ static int __init vt1211_find(int sio_cip, unsigned short *address) |
4061 |
+ { |
4062 |
+- int err = -ENODEV; |
4063 |
++ int err; |
4064 |
+ int devid; |
4065 |
+ |
4066 |
+- superio_enter(sio_cip); |
4067 |
++ err = superio_enter(sio_cip); |
4068 |
++ if (err) |
4069 |
++ return err; |
4070 |
+ |
4071 |
++ err = -ENODEV; |
4072 |
+ devid = force_id ? force_id : superio_inb(sio_cip, SIO_VT1211_DEVID); |
4073 |
+ if (devid != SIO_VT1211_ID) |
4074 |
+ goto EXIT; |
4075 |
+diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig |
4076 |
+index 7a3ca4ec0cb7..0a11f6cbc91a 100644 |
4077 |
+--- a/drivers/iio/adc/Kconfig |
4078 |
++++ b/drivers/iio/adc/Kconfig |
4079 |
+@@ -747,6 +747,7 @@ config STM32_DFSDM_ADC |
4080 |
+ depends on (ARCH_STM32 && OF) || COMPILE_TEST |
4081 |
+ select STM32_DFSDM_CORE |
4082 |
+ select REGMAP_MMIO |
4083 |
++ select IIO_BUFFER |
4084 |
+ select IIO_BUFFER_HW_CONSUMER |
4085 |
+ help |
4086 |
+ Select this option to support ADCSigma delta modulator for |
4087 |
+diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c |
4088 |
+index 54d9978b2740..a4310600a853 100644 |
4089 |
+--- a/drivers/iio/adc/ad_sigma_delta.c |
4090 |
++++ b/drivers/iio/adc/ad_sigma_delta.c |
4091 |
+@@ -62,7 +62,7 @@ int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg, |
4092 |
+ struct spi_transfer t = { |
4093 |
+ .tx_buf = data, |
4094 |
+ .len = size + 1, |
4095 |
+- .cs_change = sigma_delta->bus_locked, |
4096 |
++ .cs_change = sigma_delta->keep_cs_asserted, |
4097 |
+ }; |
4098 |
+ struct spi_message m; |
4099 |
+ int ret; |
4100 |
+@@ -218,6 +218,7 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, |
4101 |
+ |
4102 |
+ spi_bus_lock(sigma_delta->spi->master); |
4103 |
+ sigma_delta->bus_locked = true; |
4104 |
++ sigma_delta->keep_cs_asserted = true; |
4105 |
+ reinit_completion(&sigma_delta->completion); |
4106 |
+ |
4107 |
+ ret = ad_sigma_delta_set_mode(sigma_delta, mode); |
4108 |
+@@ -235,9 +236,10 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, |
4109 |
+ ret = 0; |
4110 |
+ } |
4111 |
+ out: |
4112 |
++ sigma_delta->keep_cs_asserted = false; |
4113 |
++ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
4114 |
+ sigma_delta->bus_locked = false; |
4115 |
+ spi_bus_unlock(sigma_delta->spi->master); |
4116 |
+- ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
4117 |
+ |
4118 |
+ return ret; |
4119 |
+ } |
4120 |
+@@ -290,6 +292,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
4121 |
+ |
4122 |
+ spi_bus_lock(sigma_delta->spi->master); |
4123 |
+ sigma_delta->bus_locked = true; |
4124 |
++ sigma_delta->keep_cs_asserted = true; |
4125 |
+ reinit_completion(&sigma_delta->completion); |
4126 |
+ |
4127 |
+ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_SINGLE); |
4128 |
+@@ -299,9 +302,6 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
4129 |
+ ret = wait_for_completion_interruptible_timeout( |
4130 |
+ &sigma_delta->completion, HZ); |
4131 |
+ |
4132 |
+- sigma_delta->bus_locked = false; |
4133 |
+- spi_bus_unlock(sigma_delta->spi->master); |
4134 |
+- |
4135 |
+ if (ret == 0) |
4136 |
+ ret = -EIO; |
4137 |
+ if (ret < 0) |
4138 |
+@@ -322,7 +322,10 @@ out: |
4139 |
+ sigma_delta->irq_dis = true; |
4140 |
+ } |
4141 |
+ |
4142 |
++ sigma_delta->keep_cs_asserted = false; |
4143 |
+ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
4144 |
++ sigma_delta->bus_locked = false; |
4145 |
++ spi_bus_unlock(sigma_delta->spi->master); |
4146 |
+ mutex_unlock(&indio_dev->mlock); |
4147 |
+ |
4148 |
+ if (ret) |
4149 |
+@@ -359,6 +362,8 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev) |
4150 |
+ |
4151 |
+ spi_bus_lock(sigma_delta->spi->master); |
4152 |
+ sigma_delta->bus_locked = true; |
4153 |
++ sigma_delta->keep_cs_asserted = true; |
4154 |
++ |
4155 |
+ ret = ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_CONTINUOUS); |
4156 |
+ if (ret) |
4157 |
+ goto err_unlock; |
4158 |
+@@ -387,6 +392,7 @@ static int ad_sd_buffer_postdisable(struct iio_dev *indio_dev) |
4159 |
+ sigma_delta->irq_dis = true; |
4160 |
+ } |
4161 |
+ |
4162 |
++ sigma_delta->keep_cs_asserted = false; |
4163 |
+ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
4164 |
+ |
4165 |
+ sigma_delta->bus_locked = false; |
4166 |
+diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c |
4167 |
+index 0ad63592cc3c..1e47bef72bb7 100644 |
4168 |
+--- a/drivers/iio/adc/ti-ads7950.c |
4169 |
++++ b/drivers/iio/adc/ti-ads7950.c |
4170 |
+@@ -56,6 +56,9 @@ struct ti_ads7950_state { |
4171 |
+ struct spi_message ring_msg; |
4172 |
+ struct spi_message scan_single_msg; |
4173 |
+ |
4174 |
++ /* Lock to protect the spi xfer buffers */ |
4175 |
++ struct mutex slock; |
4176 |
++ |
4177 |
+ struct regulator *reg; |
4178 |
+ unsigned int vref_mv; |
4179 |
+ |
4180 |
+@@ -268,6 +271,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p) |
4181 |
+ struct ti_ads7950_state *st = iio_priv(indio_dev); |
4182 |
+ int ret; |
4183 |
+ |
4184 |
++ mutex_lock(&st->slock); |
4185 |
+ ret = spi_sync(st->spi, &st->ring_msg); |
4186 |
+ if (ret < 0) |
4187 |
+ goto out; |
4188 |
+@@ -276,6 +280,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p) |
4189 |
+ iio_get_time_ns(indio_dev)); |
4190 |
+ |
4191 |
+ out: |
4192 |
++ mutex_unlock(&st->slock); |
4193 |
+ iio_trigger_notify_done(indio_dev->trig); |
4194 |
+ |
4195 |
+ return IRQ_HANDLED; |
4196 |
+@@ -286,7 +291,7 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch) |
4197 |
+ struct ti_ads7950_state *st = iio_priv(indio_dev); |
4198 |
+ int ret, cmd; |
4199 |
+ |
4200 |
+- mutex_lock(&indio_dev->mlock); |
4201 |
++ mutex_lock(&st->slock); |
4202 |
+ |
4203 |
+ cmd = TI_ADS7950_CR_WRITE | TI_ADS7950_CR_CHAN(ch) | st->settings; |
4204 |
+ st->single_tx = cmd; |
4205 |
+@@ -298,7 +303,7 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch) |
4206 |
+ ret = st->single_rx; |
4207 |
+ |
4208 |
+ out: |
4209 |
+- mutex_unlock(&indio_dev->mlock); |
4210 |
++ mutex_unlock(&st->slock); |
4211 |
+ |
4212 |
+ return ret; |
4213 |
+ } |
4214 |
+@@ -432,16 +437,19 @@ static int ti_ads7950_probe(struct spi_device *spi) |
4215 |
+ if (ACPI_COMPANION(&spi->dev)) |
4216 |
+ st->vref_mv = TI_ADS7950_VA_MV_ACPI_DEFAULT; |
4217 |
+ |
4218 |
++ mutex_init(&st->slock); |
4219 |
++ |
4220 |
+ st->reg = devm_regulator_get(&spi->dev, "vref"); |
4221 |
+ if (IS_ERR(st->reg)) { |
4222 |
+ dev_err(&spi->dev, "Failed get get regulator \"vref\"\n"); |
4223 |
+- return PTR_ERR(st->reg); |
4224 |
++ ret = PTR_ERR(st->reg); |
4225 |
++ goto error_destroy_mutex; |
4226 |
+ } |
4227 |
+ |
4228 |
+ ret = regulator_enable(st->reg); |
4229 |
+ if (ret) { |
4230 |
+ dev_err(&spi->dev, "Failed to enable regulator \"vref\"\n"); |
4231 |
+- return ret; |
4232 |
++ goto error_destroy_mutex; |
4233 |
+ } |
4234 |
+ |
4235 |
+ ret = iio_triggered_buffer_setup(indio_dev, NULL, |
4236 |
+@@ -463,6 +471,8 @@ error_cleanup_ring: |
4237 |
+ iio_triggered_buffer_cleanup(indio_dev); |
4238 |
+ error_disable_reg: |
4239 |
+ regulator_disable(st->reg); |
4240 |
++error_destroy_mutex: |
4241 |
++ mutex_destroy(&st->slock); |
4242 |
+ |
4243 |
+ return ret; |
4244 |
+ } |
4245 |
+@@ -475,6 +485,7 @@ static int ti_ads7950_remove(struct spi_device *spi) |
4246 |
+ iio_device_unregister(indio_dev); |
4247 |
+ iio_triggered_buffer_cleanup(indio_dev); |
4248 |
+ regulator_disable(st->reg); |
4249 |
++ mutex_destroy(&st->slock); |
4250 |
+ |
4251 |
+ return 0; |
4252 |
+ } |
4253 |
+diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c |
4254 |
+index 645f2e3975db..e38f704d88b7 100644 |
4255 |
+--- a/drivers/iio/common/ssp_sensors/ssp_iio.c |
4256 |
++++ b/drivers/iio/common/ssp_sensors/ssp_iio.c |
4257 |
+@@ -81,7 +81,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf, |
4258 |
+ unsigned int len, int64_t timestamp) |
4259 |
+ { |
4260 |
+ __le32 time; |
4261 |
+- int64_t calculated_time; |
4262 |
++ int64_t calculated_time = 0; |
4263 |
+ struct ssp_sensor_data *spd = iio_priv(indio_dev); |
4264 |
+ |
4265 |
+ if (indio_dev->scan_bytes == 0) |
4266 |
+diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio/magnetometer/hmc5843_i2c.c |
4267 |
+index 3de7f4426ac4..86abba5827a2 100644 |
4268 |
+--- a/drivers/iio/magnetometer/hmc5843_i2c.c |
4269 |
++++ b/drivers/iio/magnetometer/hmc5843_i2c.c |
4270 |
+@@ -58,8 +58,13 @@ static const struct regmap_config hmc5843_i2c_regmap_config = { |
4271 |
+ static int hmc5843_i2c_probe(struct i2c_client *cli, |
4272 |
+ const struct i2c_device_id *id) |
4273 |
+ { |
4274 |
++ struct regmap *regmap = devm_regmap_init_i2c(cli, |
4275 |
++ &hmc5843_i2c_regmap_config); |
4276 |
++ if (IS_ERR(regmap)) |
4277 |
++ return PTR_ERR(regmap); |
4278 |
++ |
4279 |
+ return hmc5843_common_probe(&cli->dev, |
4280 |
+- devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config), |
4281 |
++ regmap, |
4282 |
+ id->driver_data, id->name); |
4283 |
+ } |
4284 |
+ |
4285 |
+diff --git a/drivers/iio/magnetometer/hmc5843_spi.c b/drivers/iio/magnetometer/hmc5843_spi.c |
4286 |
+index 535f03a70d63..79b2b707f90e 100644 |
4287 |
+--- a/drivers/iio/magnetometer/hmc5843_spi.c |
4288 |
++++ b/drivers/iio/magnetometer/hmc5843_spi.c |
4289 |
+@@ -58,6 +58,7 @@ static const struct regmap_config hmc5843_spi_regmap_config = { |
4290 |
+ static int hmc5843_spi_probe(struct spi_device *spi) |
4291 |
+ { |
4292 |
+ int ret; |
4293 |
++ struct regmap *regmap; |
4294 |
+ const struct spi_device_id *id = spi_get_device_id(spi); |
4295 |
+ |
4296 |
+ spi->mode = SPI_MODE_3; |
4297 |
+@@ -67,8 +68,12 @@ static int hmc5843_spi_probe(struct spi_device *spi) |
4298 |
+ if (ret) |
4299 |
+ return ret; |
4300 |
+ |
4301 |
++ regmap = devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config); |
4302 |
++ if (IS_ERR(regmap)) |
4303 |
++ return PTR_ERR(regmap); |
4304 |
++ |
4305 |
+ return hmc5843_common_probe(&spi->dev, |
4306 |
+- devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config), |
4307 |
++ regmap, |
4308 |
+ id->driver_data, id->name); |
4309 |
+ } |
4310 |
+ |
4311 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
4312 |
+index 81bded0d37d1..cb482f338950 100644 |
4313 |
+--- a/drivers/infiniband/core/cma.c |
4314 |
++++ b/drivers/infiniband/core/cma.c |
4315 |
+@@ -1170,18 +1170,31 @@ static inline bool cma_any_addr(const struct sockaddr *addr) |
4316 |
+ return cma_zero_addr(addr) || cma_loopback_addr(addr); |
4317 |
+ } |
4318 |
+ |
4319 |
+-static int cma_addr_cmp(struct sockaddr *src, struct sockaddr *dst) |
4320 |
++static int cma_addr_cmp(const struct sockaddr *src, const struct sockaddr *dst) |
4321 |
+ { |
4322 |
+ if (src->sa_family != dst->sa_family) |
4323 |
+ return -1; |
4324 |
+ |
4325 |
+ switch (src->sa_family) { |
4326 |
+ case AF_INET: |
4327 |
+- return ((struct sockaddr_in *) src)->sin_addr.s_addr != |
4328 |
+- ((struct sockaddr_in *) dst)->sin_addr.s_addr; |
4329 |
+- case AF_INET6: |
4330 |
+- return ipv6_addr_cmp(&((struct sockaddr_in6 *) src)->sin6_addr, |
4331 |
+- &((struct sockaddr_in6 *) dst)->sin6_addr); |
4332 |
++ return ((struct sockaddr_in *)src)->sin_addr.s_addr != |
4333 |
++ ((struct sockaddr_in *)dst)->sin_addr.s_addr; |
4334 |
++ case AF_INET6: { |
4335 |
++ struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *)src; |
4336 |
++ struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *)dst; |
4337 |
++ bool link_local; |
4338 |
++ |
4339 |
++ if (ipv6_addr_cmp(&src_addr6->sin6_addr, |
4340 |
++ &dst_addr6->sin6_addr)) |
4341 |
++ return 1; |
4342 |
++ link_local = ipv6_addr_type(&dst_addr6->sin6_addr) & |
4343 |
++ IPV6_ADDR_LINKLOCAL; |
4344 |
++ /* Link local must match their scope_ids */ |
4345 |
++ return link_local ? (src_addr6->sin6_scope_id != |
4346 |
++ dst_addr6->sin6_scope_id) : |
4347 |
++ 0; |
4348 |
++ } |
4349 |
++ |
4350 |
+ default: |
4351 |
+ return ib_addr_cmp(&((struct sockaddr_ib *) src)->sib_addr, |
4352 |
+ &((struct sockaddr_ib *) dst)->sib_addr); |
4353 |
+diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c |
4354 |
+index 25a81fbb0d4d..f1819b527256 100644 |
4355 |
+--- a/drivers/infiniband/hw/cxgb4/cm.c |
4356 |
++++ b/drivers/infiniband/hw/cxgb4/cm.c |
4357 |
+@@ -457,6 +457,8 @@ static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) |
4358 |
+ skb_reset_transport_header(skb); |
4359 |
+ } else { |
4360 |
+ skb = alloc_skb(len, gfp); |
4361 |
++ if (!skb) |
4362 |
++ return NULL; |
4363 |
+ } |
4364 |
+ t4_set_arp_err_handler(skb, NULL, NULL); |
4365 |
+ return skb; |
4366 |
+diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c |
4367 |
+index c532ceb0bb9a..b66c4fe8151a 100644 |
4368 |
+--- a/drivers/infiniband/hw/hfi1/init.c |
4369 |
++++ b/drivers/infiniband/hw/hfi1/init.c |
4370 |
+@@ -797,7 +797,8 @@ static int create_workqueues(struct hfi1_devdata *dd) |
4371 |
+ ppd->hfi1_wq = |
4372 |
+ alloc_workqueue( |
4373 |
+ "hfi%d_%d", |
4374 |
+- WQ_SYSFS | WQ_HIGHPRI | WQ_CPU_INTENSIVE, |
4375 |
++ WQ_SYSFS | WQ_HIGHPRI | WQ_CPU_INTENSIVE | |
4376 |
++ WQ_MEM_RECLAIM, |
4377 |
+ HFI1_MAX_ACTIVE_WORKQUEUE_ENTRIES, |
4378 |
+ dd->unit, pidx); |
4379 |
+ if (!ppd->hfi1_wq) |
4380 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c |
4381 |
+index b3c8c45ec1e3..64e0c69b69c5 100644 |
4382 |
+--- a/drivers/infiniband/hw/hns/hns_roce_ah.c |
4383 |
++++ b/drivers/infiniband/hw/hns/hns_roce_ah.c |
4384 |
+@@ -70,7 +70,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd, |
4385 |
+ HNS_ROCE_VLAN_SL_BIT_MASK) << |
4386 |
+ HNS_ROCE_VLAN_SL_SHIFT; |
4387 |
+ |
4388 |
+- ah->av.port_pd = cpu_to_be32(to_hr_pd(ibpd)->pdn | |
4389 |
++ ah->av.port_pd = cpu_to_le32(to_hr_pd(ibpd)->pdn | |
4390 |
+ (rdma_ah_get_port_num(ah_attr) << |
4391 |
+ HNS_ROCE_PORT_NUM_SHIFT)); |
4392 |
+ ah->av.gid_index = grh->sgid_index; |
4393 |
+diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c |
4394 |
+index 5002838ea476..f8986effcb50 100644 |
4395 |
+--- a/drivers/md/bcache/alloc.c |
4396 |
++++ b/drivers/md/bcache/alloc.c |
4397 |
+@@ -327,10 +327,11 @@ static int bch_allocator_thread(void *arg) |
4398 |
+ * possibly issue discards to them, then we add the bucket to |
4399 |
+ * the free list: |
4400 |
+ */ |
4401 |
+- while (!fifo_empty(&ca->free_inc)) { |
4402 |
++ while (1) { |
4403 |
+ long bucket; |
4404 |
+ |
4405 |
+- fifo_pop(&ca->free_inc, bucket); |
4406 |
++ if (!fifo_pop(&ca->free_inc, bucket)) |
4407 |
++ break; |
4408 |
+ |
4409 |
+ if (ca->discard) { |
4410 |
+ mutex_unlock(&ca->set->bucket_lock); |
4411 |
+diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c |
4412 |
+index d3725c17ce3a..6c94fa007796 100644 |
4413 |
+--- a/drivers/md/bcache/journal.c |
4414 |
++++ b/drivers/md/bcache/journal.c |
4415 |
+@@ -317,6 +317,18 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) |
4416 |
+ } |
4417 |
+ } |
4418 |
+ |
4419 |
++bool is_discard_enabled(struct cache_set *s) |
4420 |
++{ |
4421 |
++ struct cache *ca; |
4422 |
++ unsigned int i; |
4423 |
++ |
4424 |
++ for_each_cache(ca, s, i) |
4425 |
++ if (ca->discard) |
4426 |
++ return true; |
4427 |
++ |
4428 |
++ return false; |
4429 |
++} |
4430 |
++ |
4431 |
+ int bch_journal_replay(struct cache_set *s, struct list_head *list) |
4432 |
+ { |
4433 |
+ int ret = 0, keys = 0, entries = 0; |
4434 |
+@@ -330,9 +342,17 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list) |
4435 |
+ list_for_each_entry(i, list, list) { |
4436 |
+ BUG_ON(i->pin && atomic_read(i->pin) != 1); |
4437 |
+ |
4438 |
+- cache_set_err_on(n != i->j.seq, s, |
4439 |
+-"bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)", |
4440 |
+- n, i->j.seq - 1, start, end); |
4441 |
++ if (n != i->j.seq) { |
4442 |
++ if (n == start && is_discard_enabled(s)) |
4443 |
++ pr_info("bcache: journal entries %llu-%llu may be discarded! (replaying %llu-%llu)", |
4444 |
++ n, i->j.seq - 1, start, end); |
4445 |
++ else { |
4446 |
++ pr_err("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)", |
4447 |
++ n, i->j.seq - 1, start, end); |
4448 |
++ ret = -EIO; |
4449 |
++ goto err; |
4450 |
++ } |
4451 |
++ } |
4452 |
+ |
4453 |
+ for (k = i->j.start; |
4454 |
+ k < bset_bkey_last(&i->j); |
4455 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
4456 |
+index ee36e6b3bcad..0148dd931f68 100644 |
4457 |
+--- a/drivers/md/bcache/super.c |
4458 |
++++ b/drivers/md/bcache/super.c |
4459 |
+@@ -1775,13 +1775,15 @@ err: |
4460 |
+ return NULL; |
4461 |
+ } |
4462 |
+ |
4463 |
+-static void run_cache_set(struct cache_set *c) |
4464 |
++static int run_cache_set(struct cache_set *c) |
4465 |
+ { |
4466 |
+ const char *err = "cannot allocate memory"; |
4467 |
+ struct cached_dev *dc, *t; |
4468 |
+ struct cache *ca; |
4469 |
+ struct closure cl; |
4470 |
+ unsigned int i; |
4471 |
++ LIST_HEAD(journal); |
4472 |
++ struct journal_replay *l; |
4473 |
+ |
4474 |
+ closure_init_stack(&cl); |
4475 |
+ |
4476 |
+@@ -1869,7 +1871,9 @@ static void run_cache_set(struct cache_set *c) |
4477 |
+ if (j->version < BCACHE_JSET_VERSION_UUID) |
4478 |
+ __uuid_write(c); |
4479 |
+ |
4480 |
+- bch_journal_replay(c, &journal); |
4481 |
++ err = "bcache: replay journal failed"; |
4482 |
++ if (bch_journal_replay(c, &journal)) |
4483 |
++ goto err; |
4484 |
+ } else { |
4485 |
+ pr_notice("invalidating existing data"); |
4486 |
+ |
4487 |
+@@ -1937,11 +1941,19 @@ static void run_cache_set(struct cache_set *c) |
4488 |
+ flash_devs_run(c); |
4489 |
+ |
4490 |
+ set_bit(CACHE_SET_RUNNING, &c->flags); |
4491 |
+- return; |
4492 |
++ return 0; |
4493 |
+ err: |
4494 |
++ while (!list_empty(&journal)) { |
4495 |
++ l = list_first_entry(&journal, struct journal_replay, list); |
4496 |
++ list_del(&l->list); |
4497 |
++ kfree(l); |
4498 |
++ } |
4499 |
++ |
4500 |
+ closure_sync(&cl); |
4501 |
+ /* XXX: test this, it's broken */ |
4502 |
+ bch_cache_set_error(c, "%s", err); |
4503 |
++ |
4504 |
++ return -EIO; |
4505 |
+ } |
4506 |
+ |
4507 |
+ static bool can_attach_cache(struct cache *ca, struct cache_set *c) |
4508 |
+@@ -2005,8 +2017,11 @@ found: |
4509 |
+ ca->set->cache[ca->sb.nr_this_dev] = ca; |
4510 |
+ c->cache_by_alloc[c->caches_loaded++] = ca; |
4511 |
+ |
4512 |
+- if (c->caches_loaded == c->sb.nr_in_set) |
4513 |
+- run_cache_set(c); |
4514 |
++ if (c->caches_loaded == c->sb.nr_in_set) { |
4515 |
++ err = "failed to run cache set"; |
4516 |
++ if (run_cache_set(c) < 0) |
4517 |
++ goto err; |
4518 |
++ } |
4519 |
+ |
4520 |
+ return NULL; |
4521 |
+ err: |
4522 |
+diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c |
4523 |
+index 70e8c3366f9c..b68bf44216f4 100644 |
4524 |
+--- a/drivers/media/common/videobuf2/videobuf2-core.c |
4525 |
++++ b/drivers/media/common/videobuf2/videobuf2-core.c |
4526 |
+@@ -672,6 +672,11 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, |
4527 |
+ return -EBUSY; |
4528 |
+ } |
4529 |
+ |
4530 |
++ if (q->waiting_in_dqbuf && *count) { |
4531 |
++ dprintk(1, "another dup()ped fd is waiting for a buffer\n"); |
4532 |
++ return -EBUSY; |
4533 |
++ } |
4534 |
++ |
4535 |
+ if (*count == 0 || q->num_buffers != 0 || |
4536 |
+ (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) { |
4537 |
+ /* |
4538 |
+@@ -807,6 +812,10 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, |
4539 |
+ } |
4540 |
+ |
4541 |
+ if (!q->num_buffers) { |
4542 |
++ if (q->waiting_in_dqbuf && *count) { |
4543 |
++ dprintk(1, "another dup()ped fd is waiting for a buffer\n"); |
4544 |
++ return -EBUSY; |
4545 |
++ } |
4546 |
+ memset(q->alloc_devs, 0, sizeof(q->alloc_devs)); |
4547 |
+ q->memory = memory; |
4548 |
+ q->waiting_for_buffers = !q->is_output; |
4549 |
+@@ -1638,6 +1647,11 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) |
4550 |
+ for (;;) { |
4551 |
+ int ret; |
4552 |
+ |
4553 |
++ if (q->waiting_in_dqbuf) { |
4554 |
++ dprintk(1, "another dup()ped fd is waiting for a buffer\n"); |
4555 |
++ return -EBUSY; |
4556 |
++ } |
4557 |
++ |
4558 |
+ if (!q->streaming) { |
4559 |
+ dprintk(1, "streaming off, will not wait for buffers\n"); |
4560 |
+ return -EINVAL; |
4561 |
+@@ -1665,6 +1679,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) |
4562 |
+ return -EAGAIN; |
4563 |
+ } |
4564 |
+ |
4565 |
++ q->waiting_in_dqbuf = 1; |
4566 |
+ /* |
4567 |
+ * We are streaming and blocking, wait for another buffer to |
4568 |
+ * become ready or for streamoff. Driver's lock is released to |
4569 |
+@@ -1685,6 +1700,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) |
4570 |
+ * the locks or return an error if one occurred. |
4571 |
+ */ |
4572 |
+ call_void_qop(q, wait_finish, q); |
4573 |
++ q->waiting_in_dqbuf = 0; |
4574 |
+ if (ret) { |
4575 |
+ dprintk(1, "sleep was interrupted\n"); |
4576 |
+ return ret; |
4577 |
+@@ -2572,6 +2588,12 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ |
4578 |
+ if (!data) |
4579 |
+ return -EINVAL; |
4580 |
+ |
4581 |
++ if (q->waiting_in_dqbuf) { |
4582 |
++ dprintk(3, "another dup()ped fd is %s\n", |
4583 |
++ read ? "reading" : "writing"); |
4584 |
++ return -EBUSY; |
4585 |
++ } |
4586 |
++ |
4587 |
+ /* |
4588 |
+ * Initialize emulator on first call. |
4589 |
+ */ |
4590 |
+diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c |
4591 |
+index 123f2a33738b..403f42806455 100644 |
4592 |
+--- a/drivers/media/dvb-frontends/m88ds3103.c |
4593 |
++++ b/drivers/media/dvb-frontends/m88ds3103.c |
4594 |
+@@ -309,6 +309,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) |
4595 |
+ u16 u16tmp; |
4596 |
+ u32 tuner_frequency_khz, target_mclk; |
4597 |
+ s32 s32tmp; |
4598 |
++ static const struct reg_sequence reset_buf[] = { |
4599 |
++ {0x07, 0x80}, {0x07, 0x00} |
4600 |
++ }; |
4601 |
+ |
4602 |
+ dev_dbg(&client->dev, |
4603 |
+ "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", |
4604 |
+@@ -321,11 +324,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) |
4605 |
+ } |
4606 |
+ |
4607 |
+ /* reset */ |
4608 |
+- ret = regmap_write(dev->regmap, 0x07, 0x80); |
4609 |
+- if (ret) |
4610 |
+- goto err; |
4611 |
+- |
4612 |
+- ret = regmap_write(dev->regmap, 0x07, 0x00); |
4613 |
++ ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2); |
4614 |
+ if (ret) |
4615 |
+ goto err; |
4616 |
+ |
4617 |
+diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c |
4618 |
+index feacd8da421d..d55d8f169dca 100644 |
4619 |
+--- a/drivers/media/dvb-frontends/si2165.c |
4620 |
++++ b/drivers/media/dvb-frontends/si2165.c |
4621 |
+@@ -275,18 +275,20 @@ static u32 si2165_get_fe_clk(struct si2165_state *state) |
4622 |
+ |
4623 |
+ static int si2165_wait_init_done(struct si2165_state *state) |
4624 |
+ { |
4625 |
+- int ret = -EINVAL; |
4626 |
++ int ret; |
4627 |
+ u8 val = 0; |
4628 |
+ int i; |
4629 |
+ |
4630 |
+ for (i = 0; i < 3; ++i) { |
4631 |
+- si2165_readreg8(state, REG_INIT_DONE, &val); |
4632 |
++ ret = si2165_readreg8(state, REG_INIT_DONE, &val); |
4633 |
++ if (ret < 0) |
4634 |
++ return ret; |
4635 |
+ if (val == 0x01) |
4636 |
+ return 0; |
4637 |
+ usleep_range(1000, 50000); |
4638 |
+ } |
4639 |
+ dev_err(&state->client->dev, "init_done was not set\n"); |
4640 |
+- return ret; |
4641 |
++ return -EINVAL; |
4642 |
+ } |
4643 |
+ |
4644 |
+ static int si2165_upload_firmware_block(struct si2165_state *state, |
4645 |
+diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
4646 |
+index 799acce803fe..a1e9a980a445 100644 |
4647 |
+--- a/drivers/media/i2c/ov2659.c |
4648 |
++++ b/drivers/media/i2c/ov2659.c |
4649 |
+@@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, |
4650 |
+ if (ov2659_formats[index].code == mf->code) |
4651 |
+ break; |
4652 |
+ |
4653 |
+- if (index < 0) |
4654 |
+- return -EINVAL; |
4655 |
++ if (index < 0) { |
4656 |
++ index = 0; |
4657 |
++ mf->code = ov2659_formats[index].code; |
4658 |
++ } |
4659 |
+ |
4660 |
+ mf->colorspace = V4L2_COLORSPACE_SRGB; |
4661 |
+ mf->field = V4L2_FIELD_NONE; |
4662 |
+diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c |
4663 |
+index 2d3f7e00b129..ba54ceb0b726 100644 |
4664 |
+--- a/drivers/media/i2c/ov6650.c |
4665 |
++++ b/drivers/media/i2c/ov6650.c |
4666 |
+@@ -810,9 +810,16 @@ static int ov6650_video_probe(struct i2c_client *client) |
4667 |
+ u8 pidh, pidl, midh, midl; |
4668 |
+ int ret; |
4669 |
+ |
4670 |
++ priv->clk = v4l2_clk_get(&client->dev, NULL); |
4671 |
++ if (IS_ERR(priv->clk)) { |
4672 |
++ ret = PTR_ERR(priv->clk); |
4673 |
++ dev_err(&client->dev, "v4l2_clk request err: %d\n", ret); |
4674 |
++ return ret; |
4675 |
++ } |
4676 |
++ |
4677 |
+ ret = ov6650_s_power(&priv->subdev, 1); |
4678 |
+ if (ret < 0) |
4679 |
+- return ret; |
4680 |
++ goto eclkput; |
4681 |
+ |
4682 |
+ msleep(20); |
4683 |
+ |
4684 |
+@@ -849,6 +856,11 @@ static int ov6650_video_probe(struct i2c_client *client) |
4685 |
+ |
4686 |
+ done: |
4687 |
+ ov6650_s_power(&priv->subdev, 0); |
4688 |
++ if (!ret) |
4689 |
++ return 0; |
4690 |
++eclkput: |
4691 |
++ v4l2_clk_put(priv->clk); |
4692 |
++ |
4693 |
+ return ret; |
4694 |
+ } |
4695 |
+ |
4696 |
+@@ -991,18 +1003,9 @@ static int ov6650_probe(struct i2c_client *client, |
4697 |
+ priv->code = MEDIA_BUS_FMT_YUYV8_2X8; |
4698 |
+ priv->colorspace = V4L2_COLORSPACE_JPEG; |
4699 |
+ |
4700 |
+- priv->clk = v4l2_clk_get(&client->dev, NULL); |
4701 |
+- if (IS_ERR(priv->clk)) { |
4702 |
+- ret = PTR_ERR(priv->clk); |
4703 |
+- goto eclkget; |
4704 |
+- } |
4705 |
+- |
4706 |
+ ret = ov6650_video_probe(client); |
4707 |
+- if (ret) { |
4708 |
+- v4l2_clk_put(priv->clk); |
4709 |
+-eclkget: |
4710 |
++ if (ret) |
4711 |
+ v4l2_ctrl_handler_free(&priv->hdl); |
4712 |
+- } |
4713 |
+ |
4714 |
+ return ret; |
4715 |
+ } |
4716 |
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
4717 |
+index 5817d9cde4d0..6d8e4afe9673 100644 |
4718 |
+--- a/drivers/media/pci/saa7146/hexium_gemini.c |
4719 |
++++ b/drivers/media/pci/saa7146/hexium_gemini.c |
4720 |
+@@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
4721 |
+ /* enable i2c-port pins */ |
4722 |
+ saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); |
4723 |
+ |
4724 |
+- hexium->i2c_adapter = (struct i2c_adapter) { |
4725 |
+- .name = "hexium gemini", |
4726 |
+- }; |
4727 |
++ strscpy(hexium->i2c_adapter.name, "hexium gemini", |
4728 |
++ sizeof(hexium->i2c_adapter.name)); |
4729 |
+ saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
4730 |
+ if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
4731 |
+ DEB_S("cannot register i2c-device. skipping.\n"); |
4732 |
+diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
4733 |
+index 0a05176c18ab..a794f9e5f990 100644 |
4734 |
+--- a/drivers/media/pci/saa7146/hexium_orion.c |
4735 |
++++ b/drivers/media/pci/saa7146/hexium_orion.c |
4736 |
+@@ -231,9 +231,8 @@ static int hexium_probe(struct saa7146_dev *dev) |
4737 |
+ saa7146_write(dev, DD1_STREAM_B, 0x00000000); |
4738 |
+ saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26)); |
4739 |
+ |
4740 |
+- hexium->i2c_adapter = (struct i2c_adapter) { |
4741 |
+- .name = "hexium orion", |
4742 |
+- }; |
4743 |
++ strscpy(hexium->i2c_adapter.name, "hexium orion", |
4744 |
++ sizeof(hexium->i2c_adapter.name)); |
4745 |
+ saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
4746 |
+ if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
4747 |
+ DEB_S("cannot register i2c-device. skipping.\n"); |
4748 |
+diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c |
4749 |
+index 8e0194993a52..b9fc58916110 100644 |
4750 |
+--- a/drivers/media/platform/coda/coda-bit.c |
4751 |
++++ b/drivers/media/platform/coda/coda-bit.c |
4752 |
+@@ -2006,6 +2006,9 @@ static int coda_prepare_decode(struct coda_ctx *ctx) |
4753 |
+ /* Clear decode success flag */ |
4754 |
+ coda_write(dev, 0, CODA_RET_DEC_PIC_SUCCESS); |
4755 |
+ |
4756 |
++ /* Clear error return value */ |
4757 |
++ coda_write(dev, 0, CODA_RET_DEC_PIC_ERR_MB); |
4758 |
++ |
4759 |
+ trace_coda_dec_pic_run(ctx, meta); |
4760 |
+ |
4761 |
+ coda_command_async(ctx, CODA_COMMAND_PIC_RUN); |
4762 |
+diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c |
4763 |
+index 6732874114cf..a33d497bd5b7 100644 |
4764 |
+--- a/drivers/media/platform/stm32/stm32-dcmi.c |
4765 |
++++ b/drivers/media/platform/stm32/stm32-dcmi.c |
4766 |
+@@ -811,6 +811,9 @@ static int dcmi_try_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f, |
4767 |
+ |
4768 |
+ sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat); |
4769 |
+ if (!sd_fmt) { |
4770 |
++ if (!dcmi->num_of_sd_formats) |
4771 |
++ return -ENODATA; |
4772 |
++ |
4773 |
+ sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats - 1]; |
4774 |
+ pix->pixelformat = sd_fmt->fourcc; |
4775 |
+ } |
4776 |
+@@ -989,6 +992,9 @@ static int dcmi_set_sensor_format(struct stm32_dcmi *dcmi, |
4777 |
+ |
4778 |
+ sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat); |
4779 |
+ if (!sd_fmt) { |
4780 |
++ if (!dcmi->num_of_sd_formats) |
4781 |
++ return -ENODATA; |
4782 |
++ |
4783 |
+ sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats - 1]; |
4784 |
+ pix->pixelformat = sd_fmt->fourcc; |
4785 |
+ } |
4786 |
+@@ -1645,7 +1651,7 @@ static int dcmi_probe(struct platform_device *pdev) |
4787 |
+ dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); |
4788 |
+ if (IS_ERR(dcmi->rstc)) { |
4789 |
+ dev_err(&pdev->dev, "Could not get reset control\n"); |
4790 |
+- return -ENODEV; |
4791 |
++ return PTR_ERR(dcmi->rstc); |
4792 |
+ } |
4793 |
+ |
4794 |
+ /* Get bus characteristics from devicetree */ |
4795 |
+@@ -1660,7 +1666,7 @@ static int dcmi_probe(struct platform_device *pdev) |
4796 |
+ of_node_put(np); |
4797 |
+ if (ret) { |
4798 |
+ dev_err(&pdev->dev, "Could not parse the endpoint\n"); |
4799 |
+- return -ENODEV; |
4800 |
++ return ret; |
4801 |
+ } |
4802 |
+ |
4803 |
+ if (ep.bus_type == V4L2_MBUS_CSI2_DPHY) { |
4804 |
+@@ -1673,8 +1679,9 @@ static int dcmi_probe(struct platform_device *pdev) |
4805 |
+ |
4806 |
+ irq = platform_get_irq(pdev, 0); |
4807 |
+ if (irq <= 0) { |
4808 |
+- dev_err(&pdev->dev, "Could not get irq\n"); |
4809 |
+- return -ENODEV; |
4810 |
++ if (irq != -EPROBE_DEFER) |
4811 |
++ dev_err(&pdev->dev, "Could not get irq\n"); |
4812 |
++ return irq; |
4813 |
+ } |
4814 |
+ |
4815 |
+ dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
4816 |
+@@ -1694,12 +1701,13 @@ static int dcmi_probe(struct platform_device *pdev) |
4817 |
+ dev_name(&pdev->dev), dcmi); |
4818 |
+ if (ret) { |
4819 |
+ dev_err(&pdev->dev, "Unable to request irq %d\n", irq); |
4820 |
+- return -ENODEV; |
4821 |
++ return ret; |
4822 |
+ } |
4823 |
+ |
4824 |
+ mclk = devm_clk_get(&pdev->dev, "mclk"); |
4825 |
+ if (IS_ERR(mclk)) { |
4826 |
+- dev_err(&pdev->dev, "Unable to get mclk\n"); |
4827 |
++ if (PTR_ERR(mclk) != -EPROBE_DEFER) |
4828 |
++ dev_err(&pdev->dev, "Unable to get mclk\n"); |
4829 |
+ return PTR_ERR(mclk); |
4830 |
+ } |
4831 |
+ |
4832 |
+diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c |
4833 |
+index c33900e3c23e..4135165cdabe 100644 |
4834 |
+--- a/drivers/media/platform/video-mux.c |
4835 |
++++ b/drivers/media/platform/video-mux.c |
4836 |
+@@ -399,9 +399,14 @@ static int video_mux_probe(struct platform_device *pdev) |
4837 |
+ vmux->active = -1; |
4838 |
+ vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads), |
4839 |
+ GFP_KERNEL); |
4840 |
++ if (!vmux->pads) |
4841 |
++ return -ENOMEM; |
4842 |
++ |
4843 |
+ vmux->format_mbus = devm_kcalloc(dev, num_pads, |
4844 |
+ sizeof(*vmux->format_mbus), |
4845 |
+ GFP_KERNEL); |
4846 |
++ if (!vmux->format_mbus) |
4847 |
++ return -ENOMEM; |
4848 |
+ |
4849 |
+ for (i = 0; i < num_pads; i++) { |
4850 |
+ vmux->pads[i].flags = (i < num_pads - 1) ? MEDIA_PAD_FL_SINK |
4851 |
+diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c |
4852 |
+index 89d9c4c21037..333bd34e47c4 100644 |
4853 |
+--- a/drivers/media/platform/vim2m.c |
4854 |
++++ b/drivers/media/platform/vim2m.c |
4855 |
+@@ -984,6 +984,15 @@ static int vim2m_release(struct file *file) |
4856 |
+ return 0; |
4857 |
+ } |
4858 |
+ |
4859 |
++static void vim2m_device_release(struct video_device *vdev) |
4860 |
++{ |
4861 |
++ struct vim2m_dev *dev = container_of(vdev, struct vim2m_dev, vfd); |
4862 |
++ |
4863 |
++ v4l2_device_unregister(&dev->v4l2_dev); |
4864 |
++ v4l2_m2m_release(dev->m2m_dev); |
4865 |
++ kfree(dev); |
4866 |
++} |
4867 |
++ |
4868 |
+ static const struct v4l2_file_operations vim2m_fops = { |
4869 |
+ .owner = THIS_MODULE, |
4870 |
+ .open = vim2m_open, |
4871 |
+@@ -999,7 +1008,7 @@ static const struct video_device vim2m_videodev = { |
4872 |
+ .fops = &vim2m_fops, |
4873 |
+ .ioctl_ops = &vim2m_ioctl_ops, |
4874 |
+ .minor = -1, |
4875 |
+- .release = video_device_release_empty, |
4876 |
++ .release = vim2m_device_release, |
4877 |
+ .device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING, |
4878 |
+ }; |
4879 |
+ |
4880 |
+@@ -1020,7 +1029,7 @@ static int vim2m_probe(struct platform_device *pdev) |
4881 |
+ struct video_device *vfd; |
4882 |
+ int ret; |
4883 |
+ |
4884 |
+- dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); |
4885 |
++ dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
4886 |
+ if (!dev) |
4887 |
+ return -ENOMEM; |
4888 |
+ |
4889 |
+@@ -1028,7 +1037,7 @@ static int vim2m_probe(struct platform_device *pdev) |
4890 |
+ |
4891 |
+ ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); |
4892 |
+ if (ret) |
4893 |
+- return ret; |
4894 |
++ goto error_free; |
4895 |
+ |
4896 |
+ atomic_set(&dev->num_inst, 0); |
4897 |
+ mutex_init(&dev->dev_mutex); |
4898 |
+@@ -1042,7 +1051,7 @@ static int vim2m_probe(struct platform_device *pdev) |
4899 |
+ ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); |
4900 |
+ if (ret) { |
4901 |
+ v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
4902 |
+- goto unreg_v4l2; |
4903 |
++ goto error_v4l2; |
4904 |
+ } |
4905 |
+ |
4906 |
+ video_set_drvdata(vfd, dev); |
4907 |
+@@ -1055,7 +1064,7 @@ static int vim2m_probe(struct platform_device *pdev) |
4908 |
+ if (IS_ERR(dev->m2m_dev)) { |
4909 |
+ v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); |
4910 |
+ ret = PTR_ERR(dev->m2m_dev); |
4911 |
+- goto unreg_dev; |
4912 |
++ goto error_dev; |
4913 |
+ } |
4914 |
+ |
4915 |
+ #ifdef CONFIG_MEDIA_CONTROLLER |
4916 |
+@@ -1069,27 +1078,29 @@ static int vim2m_probe(struct platform_device *pdev) |
4917 |
+ vfd, MEDIA_ENT_F_PROC_VIDEO_SCALER); |
4918 |
+ if (ret) { |
4919 |
+ v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem media controller\n"); |
4920 |
+- goto unreg_m2m; |
4921 |
++ goto error_m2m; |
4922 |
+ } |
4923 |
+ |
4924 |
+ ret = media_device_register(&dev->mdev); |
4925 |
+ if (ret) { |
4926 |
+ v4l2_err(&dev->v4l2_dev, "Failed to register mem2mem media device\n"); |
4927 |
+- goto unreg_m2m_mc; |
4928 |
++ goto error_m2m_mc; |
4929 |
+ } |
4930 |
+ #endif |
4931 |
+ return 0; |
4932 |
+ |
4933 |
+ #ifdef CONFIG_MEDIA_CONTROLLER |
4934 |
+-unreg_m2m_mc: |
4935 |
++error_m2m_mc: |
4936 |
+ v4l2_m2m_unregister_media_controller(dev->m2m_dev); |
4937 |
+-unreg_m2m: |
4938 |
++error_m2m: |
4939 |
+ v4l2_m2m_release(dev->m2m_dev); |
4940 |
+ #endif |
4941 |
+-unreg_dev: |
4942 |
++error_dev: |
4943 |
+ video_unregister_device(&dev->vfd); |
4944 |
+-unreg_v4l2: |
4945 |
++error_v4l2: |
4946 |
+ v4l2_device_unregister(&dev->v4l2_dev); |
4947 |
++error_free: |
4948 |
++ kfree(dev); |
4949 |
+ |
4950 |
+ return ret; |
4951 |
+ } |
4952 |
+@@ -1105,9 +1116,7 @@ static int vim2m_remove(struct platform_device *pdev) |
4953 |
+ v4l2_m2m_unregister_media_controller(dev->m2m_dev); |
4954 |
+ media_device_cleanup(&dev->mdev); |
4955 |
+ #endif |
4956 |
+- v4l2_m2m_release(dev->m2m_dev); |
4957 |
+ video_unregister_device(&dev->vfd); |
4958 |
+- v4l2_device_unregister(&dev->v4l2_dev); |
4959 |
+ |
4960 |
+ return 0; |
4961 |
+ } |
4962 |
+diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c |
4963 |
+index ce809d2e3d53..64eb424c15ab 100644 |
4964 |
+--- a/drivers/media/platform/vimc/vimc-core.c |
4965 |
++++ b/drivers/media/platform/vimc/vimc-core.c |
4966 |
+@@ -303,6 +303,8 @@ static int vimc_probe(struct platform_device *pdev) |
4967 |
+ |
4968 |
+ dev_dbg(&pdev->dev, "probe"); |
4969 |
+ |
4970 |
++ memset(&vimc->mdev, 0, sizeof(vimc->mdev)); |
4971 |
++ |
4972 |
+ /* Create platform_device for each entity in the topology*/ |
4973 |
+ vimc->subdevs = devm_kcalloc(&vimc->pdev.dev, vimc->pipe_cfg->num_ents, |
4974 |
+ sizeof(*vimc->subdevs), GFP_KERNEL); |
4975 |
+diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c |
4976 |
+index fcc897fb247b..392754c18046 100644 |
4977 |
+--- a/drivers/media/platform/vimc/vimc-streamer.c |
4978 |
++++ b/drivers/media/platform/vimc/vimc-streamer.c |
4979 |
+@@ -120,7 +120,6 @@ static int vimc_streamer_thread(void *data) |
4980 |
+ int i; |
4981 |
+ |
4982 |
+ set_freezable(); |
4983 |
+- set_current_state(TASK_UNINTERRUPTIBLE); |
4984 |
+ |
4985 |
+ for (;;) { |
4986 |
+ try_to_freeze(); |
4987 |
+@@ -137,6 +136,7 @@ static int vimc_streamer_thread(void *data) |
4988 |
+ break; |
4989 |
+ } |
4990 |
+ //wait for 60hz |
4991 |
++ set_current_state(TASK_UNINTERRUPTIBLE); |
4992 |
+ schedule_timeout(HZ / 60); |
4993 |
+ } |
4994 |
+ |
4995 |
+diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c |
4996 |
+index c059fc12668a..234dee12256f 100644 |
4997 |
+--- a/drivers/media/platform/vivid/vivid-vid-cap.c |
4998 |
++++ b/drivers/media/platform/vivid/vivid-vid-cap.c |
4999 |
+@@ -1003,7 +1003,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection |
5000 |
+ v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect); |
5001 |
+ if (dev->bitmap_cap && (compose->width != s->r.width || |
5002 |
+ compose->height != s->r.height)) { |
5003 |
+- kfree(dev->bitmap_cap); |
5004 |
++ vfree(dev->bitmap_cap); |
5005 |
+ dev->bitmap_cap = NULL; |
5006 |
+ } |
5007 |
+ *compose = s->r; |
5008 |
+diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c |
5009 |
+index 800d69c3f80b..1cf4019689a5 100644 |
5010 |
+--- a/drivers/media/radio/wl128x/fmdrv_common.c |
5011 |
++++ b/drivers/media/radio/wl128x/fmdrv_common.c |
5012 |
+@@ -489,7 +489,8 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, |
5013 |
+ return -EIO; |
5014 |
+ } |
5015 |
+ /* Send response data to caller */ |
5016 |
+- if (response != NULL && response_len != NULL && evt_hdr->dlen) { |
5017 |
++ if (response != NULL && response_len != NULL && evt_hdr->dlen && |
5018 |
++ evt_hdr->dlen <= payload_len) { |
5019 |
+ /* Skip header info and copy only response data */ |
5020 |
+ skb_pull(skb, sizeof(struct fm_event_msg_hdr)); |
5021 |
+ memcpy(response, skb->data, evt_hdr->dlen); |
5022 |
+@@ -583,6 +584,8 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev *fmdev) |
5023 |
+ return; |
5024 |
+ |
5025 |
+ fm_evt_hdr = (void *)skb->data; |
5026 |
++ if (fm_evt_hdr->dlen > sizeof(fmdev->irq_info.flag)) |
5027 |
++ return; |
5028 |
+ |
5029 |
+ /* Skip header info and copy only response data */ |
5030 |
+ skb_pull(skb, sizeof(struct fm_event_msg_hdr)); |
5031 |
+@@ -1308,7 +1311,7 @@ static int load_default_rx_configuration(struct fmdev *fmdev) |
5032 |
+ static int fm_power_up(struct fmdev *fmdev, u8 mode) |
5033 |
+ { |
5034 |
+ u16 payload; |
5035 |
+- __be16 asic_id, asic_ver; |
5036 |
++ __be16 asic_id = 0, asic_ver = 0; |
5037 |
+ int resp_len, ret; |
5038 |
+ u8 fw_name[50]; |
5039 |
+ |
5040 |
+diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c |
5041 |
+index ffe2c672d105..3998ba29beb6 100644 |
5042 |
+--- a/drivers/media/rc/serial_ir.c |
5043 |
++++ b/drivers/media/rc/serial_ir.c |
5044 |
+@@ -773,8 +773,6 @@ static void serial_ir_exit(void) |
5045 |
+ |
5046 |
+ static int __init serial_ir_init_module(void) |
5047 |
+ { |
5048 |
+- int result; |
5049 |
+- |
5050 |
+ switch (type) { |
5051 |
+ case IR_HOMEBREW: |
5052 |
+ case IR_IRDEO: |
5053 |
+@@ -802,12 +800,7 @@ static int __init serial_ir_init_module(void) |
5054 |
+ if (sense != -1) |
5055 |
+ sense = !!sense; |
5056 |
+ |
5057 |
+- result = serial_ir_init(); |
5058 |
+- if (!result) |
5059 |
+- return 0; |
5060 |
+- |
5061 |
+- serial_ir_exit(); |
5062 |
+- return result; |
5063 |
++ return serial_ir_init(); |
5064 |
+ } |
5065 |
+ |
5066 |
+ static void __exit serial_ir_exit_module(void) |
5067 |
+diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c |
5068 |
+index 7876c897cc1d..222723d946e4 100644 |
5069 |
+--- a/drivers/media/usb/au0828/au0828-video.c |
5070 |
++++ b/drivers/media/usb/au0828/au0828-video.c |
5071 |
+@@ -758,6 +758,9 @@ static int au0828_analog_stream_enable(struct au0828_dev *d) |
5072 |
+ |
5073 |
+ dprintk(1, "au0828_analog_stream_enable called\n"); |
5074 |
+ |
5075 |
++ if (test_bit(DEV_DISCONNECTED, &d->dev_state)) |
5076 |
++ return -ENODEV; |
5077 |
++ |
5078 |
+ iface = usb_ifnum_to_if(d->usbdev, 0); |
5079 |
+ if (iface && iface->cur_altsetting->desc.bAlternateSetting != 5) { |
5080 |
+ dprintk(1, "Changing intf#0 to alt 5\n"); |
5081 |
+@@ -839,9 +842,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count) |
5082 |
+ return rc; |
5083 |
+ } |
5084 |
+ |
5085 |
++ v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 1); |
5086 |
++ |
5087 |
+ if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
5088 |
+- v4l2_device_call_all(&dev->v4l2_dev, 0, video, |
5089 |
+- s_stream, 1); |
5090 |
+ dev->vid_timeout_running = 1; |
5091 |
+ mod_timer(&dev->vid_timeout, jiffies + (HZ / 10)); |
5092 |
+ } else if (vq->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
5093 |
+@@ -861,10 +864,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq) |
5094 |
+ |
5095 |
+ dprintk(1, "au0828_stop_streaming called %d\n", dev->streaming_users); |
5096 |
+ |
5097 |
+- if (dev->streaming_users-- == 1) |
5098 |
++ if (dev->streaming_users-- == 1) { |
5099 |
+ au0828_uninit_isoc(dev); |
5100 |
++ v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
5101 |
++ } |
5102 |
+ |
5103 |
+- v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
5104 |
+ dev->vid_timeout_running = 0; |
5105 |
+ del_timer_sync(&dev->vid_timeout); |
5106 |
+ |
5107 |
+@@ -893,8 +897,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq) |
5108 |
+ dprintk(1, "au0828_stop_vbi_streaming called %d\n", |
5109 |
+ dev->streaming_users); |
5110 |
+ |
5111 |
+- if (dev->streaming_users-- == 1) |
5112 |
++ if (dev->streaming_users-- == 1) { |
5113 |
+ au0828_uninit_isoc(dev); |
5114 |
++ v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
5115 |
++ } |
5116 |
+ |
5117 |
+ spin_lock_irqsave(&dev->slock, flags); |
5118 |
+ if (dev->isoc_ctl.vbi_buf != NULL) { |
5119 |
+diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c |
5120 |
+index 748739c2b8b2..39b20a6ae350 100644 |
5121 |
+--- a/drivers/media/usb/cpia2/cpia2_v4l.c |
5122 |
++++ b/drivers/media/usb/cpia2/cpia2_v4l.c |
5123 |
+@@ -1245,8 +1245,7 @@ static int __init cpia2_init(void) |
5124 |
+ LOG("%s v%s\n", |
5125 |
+ ABOUT, CPIA_VERSION); |
5126 |
+ check_parameters(); |
5127 |
+- cpia2_usb_init(); |
5128 |
+- return 0; |
5129 |
++ return cpia2_usb_init(); |
5130 |
+ } |
5131 |
+ |
5132 |
+ |
5133 |
+diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c |
5134 |
+index e28bd8836751..ae0814dd202a 100644 |
5135 |
+--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c |
5136 |
++++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c |
5137 |
+@@ -615,16 +615,18 @@ static int dvbsky_init(struct dvb_usb_device *d) |
5138 |
+ return 0; |
5139 |
+ } |
5140 |
+ |
5141 |
+-static void dvbsky_exit(struct dvb_usb_device *d) |
5142 |
++static int dvbsky_frontend_detach(struct dvb_usb_adapter *adap) |
5143 |
+ { |
5144 |
++ struct dvb_usb_device *d = adap_to_d(adap); |
5145 |
+ struct dvbsky_state *state = d_to_priv(d); |
5146 |
+- struct dvb_usb_adapter *adap = &d->adapter[0]; |
5147 |
++ |
5148 |
++ dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); |
5149 |
+ |
5150 |
+ dvb_module_release(state->i2c_client_tuner); |
5151 |
+ dvb_module_release(state->i2c_client_demod); |
5152 |
+ dvb_module_release(state->i2c_client_ci); |
5153 |
+ |
5154 |
+- adap->fe[0] = NULL; |
5155 |
++ return 0; |
5156 |
+ } |
5157 |
+ |
5158 |
+ /* DVB USB Driver stuff */ |
5159 |
+@@ -640,11 +642,11 @@ static struct dvb_usb_device_properties dvbsky_s960_props = { |
5160 |
+ |
5161 |
+ .i2c_algo = &dvbsky_i2c_algo, |
5162 |
+ .frontend_attach = dvbsky_s960_attach, |
5163 |
++ .frontend_detach = dvbsky_frontend_detach, |
5164 |
+ .init = dvbsky_init, |
5165 |
+ .get_rc_config = dvbsky_get_rc_config, |
5166 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
5167 |
+ .identify_state = dvbsky_identify_state, |
5168 |
+- .exit = dvbsky_exit, |
5169 |
+ .read_mac_address = dvbsky_read_mac_addr, |
5170 |
+ |
5171 |
+ .num_adapters = 1, |
5172 |
+@@ -667,11 +669,11 @@ static struct dvb_usb_device_properties dvbsky_s960c_props = { |
5173 |
+ |
5174 |
+ .i2c_algo = &dvbsky_i2c_algo, |
5175 |
+ .frontend_attach = dvbsky_s960c_attach, |
5176 |
++ .frontend_detach = dvbsky_frontend_detach, |
5177 |
+ .init = dvbsky_init, |
5178 |
+ .get_rc_config = dvbsky_get_rc_config, |
5179 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
5180 |
+ .identify_state = dvbsky_identify_state, |
5181 |
+- .exit = dvbsky_exit, |
5182 |
+ .read_mac_address = dvbsky_read_mac_addr, |
5183 |
+ |
5184 |
+ .num_adapters = 1, |
5185 |
+@@ -694,11 +696,11 @@ static struct dvb_usb_device_properties dvbsky_t680c_props = { |
5186 |
+ |
5187 |
+ .i2c_algo = &dvbsky_i2c_algo, |
5188 |
+ .frontend_attach = dvbsky_t680c_attach, |
5189 |
++ .frontend_detach = dvbsky_frontend_detach, |
5190 |
+ .init = dvbsky_init, |
5191 |
+ .get_rc_config = dvbsky_get_rc_config, |
5192 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
5193 |
+ .identify_state = dvbsky_identify_state, |
5194 |
+- .exit = dvbsky_exit, |
5195 |
+ .read_mac_address = dvbsky_read_mac_addr, |
5196 |
+ |
5197 |
+ .num_adapters = 1, |
5198 |
+@@ -721,11 +723,11 @@ static struct dvb_usb_device_properties dvbsky_t330_props = { |
5199 |
+ |
5200 |
+ .i2c_algo = &dvbsky_i2c_algo, |
5201 |
+ .frontend_attach = dvbsky_t330_attach, |
5202 |
++ .frontend_detach = dvbsky_frontend_detach, |
5203 |
+ .init = dvbsky_init, |
5204 |
+ .get_rc_config = dvbsky_get_rc_config, |
5205 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
5206 |
+ .identify_state = dvbsky_identify_state, |
5207 |
+- .exit = dvbsky_exit, |
5208 |
+ .read_mac_address = dvbsky_read_mac_addr, |
5209 |
+ |
5210 |
+ .num_adapters = 1, |
5211 |
+@@ -748,11 +750,11 @@ static struct dvb_usb_device_properties mygica_t230c_props = { |
5212 |
+ |
5213 |
+ .i2c_algo = &dvbsky_i2c_algo, |
5214 |
+ .frontend_attach = dvbsky_mygica_t230c_attach, |
5215 |
++ .frontend_detach = dvbsky_frontend_detach, |
5216 |
+ .init = dvbsky_init, |
5217 |
+ .get_rc_config = dvbsky_get_rc_config, |
5218 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
5219 |
+ .identify_state = dvbsky_identify_state, |
5220 |
+- .exit = dvbsky_exit, |
5221 |
+ |
5222 |
+ .num_adapters = 1, |
5223 |
+ .adapter = { |
5224 |
+diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c |
5225 |
+index 24f5b615dc7a..dfa9f899d0c2 100644 |
5226 |
+--- a/drivers/media/usb/go7007/go7007-fw.c |
5227 |
++++ b/drivers/media/usb/go7007/go7007-fw.c |
5228 |
+@@ -1499,8 +1499,8 @@ static int modet_to_package(struct go7007 *go, __le16 *code, int space) |
5229 |
+ return cnt; |
5230 |
+ } |
5231 |
+ |
5232 |
+-static int do_special(struct go7007 *go, u16 type, __le16 *code, int space, |
5233 |
+- int *framelen) |
5234 |
++static noinline_for_stack int do_special(struct go7007 *go, u16 type, |
5235 |
++ __le16 *code, int space, int *framelen) |
5236 |
+ { |
5237 |
+ switch (type) { |
5238 |
+ case SPECIAL_FRM_HEAD: |
5239 |
+diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c |
5240 |
+index 3137f5d89d80..bdb81e93b74d 100644 |
5241 |
+--- a/drivers/media/usb/gspca/gspca.c |
5242 |
++++ b/drivers/media/usb/gspca/gspca.c |
5243 |
+@@ -294,7 +294,7 @@ static void fill_frame(struct gspca_dev *gspca_dev, |
5244 |
+ /* check the packet status and length */ |
5245 |
+ st = urb->iso_frame_desc[i].status; |
5246 |
+ if (st) { |
5247 |
+- pr_err("ISOC data error: [%d] len=%d, status=%d\n", |
5248 |
++ gspca_dbg(gspca_dev, D_PACK, "ISOC data error: [%d] len=%d, status=%d\n", |
5249 |
+ i, len, st); |
5250 |
+ gspca_dev->last_packet_type = DISCARD_PACKET; |
5251 |
+ continue; |
5252 |
+@@ -314,6 +314,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, |
5253 |
+ } |
5254 |
+ |
5255 |
+ resubmit: |
5256 |
++ if (!gspca_dev->streaming) |
5257 |
++ return; |
5258 |
+ /* resubmit the URB */ |
5259 |
+ st = usb_submit_urb(urb, GFP_ATOMIC); |
5260 |
+ if (st < 0) |
5261 |
+@@ -330,7 +332,7 @@ static void isoc_irq(struct urb *urb) |
5262 |
+ struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; |
5263 |
+ |
5264 |
+ gspca_dbg(gspca_dev, D_PACK, "isoc irq\n"); |
5265 |
+- if (!vb2_start_streaming_called(&gspca_dev->queue)) |
5266 |
++ if (!gspca_dev->streaming) |
5267 |
+ return; |
5268 |
+ fill_frame(gspca_dev, urb); |
5269 |
+ } |
5270 |
+@@ -344,7 +346,7 @@ static void bulk_irq(struct urb *urb) |
5271 |
+ int st; |
5272 |
+ |
5273 |
+ gspca_dbg(gspca_dev, D_PACK, "bulk irq\n"); |
5274 |
+- if (!vb2_start_streaming_called(&gspca_dev->queue)) |
5275 |
++ if (!gspca_dev->streaming) |
5276 |
+ return; |
5277 |
+ switch (urb->status) { |
5278 |
+ case 0: |
5279 |
+@@ -367,6 +369,8 @@ static void bulk_irq(struct urb *urb) |
5280 |
+ urb->actual_length); |
5281 |
+ |
5282 |
+ resubmit: |
5283 |
++ if (!gspca_dev->streaming) |
5284 |
++ return; |
5285 |
+ /* resubmit the URB */ |
5286 |
+ if (gspca_dev->cam.bulk_nurbs != 0) { |
5287 |
+ st = usb_submit_urb(urb, GFP_ATOMIC); |
5288 |
+@@ -1630,6 +1634,8 @@ void gspca_disconnect(struct usb_interface *intf) |
5289 |
+ |
5290 |
+ mutex_lock(&gspca_dev->usb_lock); |
5291 |
+ gspca_dev->present = false; |
5292 |
++ destroy_urbs(gspca_dev); |
5293 |
++ gspca_input_destroy_urb(gspca_dev); |
5294 |
+ |
5295 |
+ vb2_queue_error(&gspca_dev->queue); |
5296 |
+ |
5297 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
5298 |
+index 446a999dd2ce..2bab4713bc5b 100644 |
5299 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
5300 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
5301 |
+@@ -666,6 +666,8 @@ static int ctrl_get_input(struct pvr2_ctrl *cptr,int *vp) |
5302 |
+ |
5303 |
+ static int ctrl_check_input(struct pvr2_ctrl *cptr,int v) |
5304 |
+ { |
5305 |
++ if (v < 0 || v > PVR2_CVAL_INPUT_MAX) |
5306 |
++ return 0; |
5307 |
+ return ((1 << v) & cptr->hdw->input_allowed_mask) != 0; |
5308 |
+ } |
5309 |
+ |
5310 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
5311 |
+index 25648add77e5..bd2b7a67b732 100644 |
5312 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
5313 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
5314 |
+@@ -50,6 +50,7 @@ |
5315 |
+ #define PVR2_CVAL_INPUT_COMPOSITE 2 |
5316 |
+ #define PVR2_CVAL_INPUT_SVIDEO 3 |
5317 |
+ #define PVR2_CVAL_INPUT_RADIO 4 |
5318 |
++#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO |
5319 |
+ |
5320 |
+ enum pvr2_config { |
5321 |
+ pvr2_config_empty, /* No configuration */ |
5322 |
+diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c |
5323 |
+index 9bfedd7596a1..a398b7885399 100644 |
5324 |
+--- a/drivers/media/v4l2-core/v4l2-fwnode.c |
5325 |
++++ b/drivers/media/v4l2-core/v4l2-fwnode.c |
5326 |
+@@ -225,6 +225,10 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode, |
5327 |
+ if (bus_type == V4L2_MBUS_CSI2_DPHY || |
5328 |
+ bus_type == V4L2_MBUS_CSI2_CPHY || lanes_used || |
5329 |
+ have_clk_lane || (flags & ~V4L2_MBUS_CSI2_CONTINUOUS_CLOCK)) { |
5330 |
++ /* Only D-PHY has a clock lane. */ |
5331 |
++ unsigned int dfl_data_lane_index = |
5332 |
++ bus_type == V4L2_MBUS_CSI2_DPHY; |
5333 |
++ |
5334 |
+ bus->flags = flags; |
5335 |
+ if (bus_type == V4L2_MBUS_UNKNOWN) |
5336 |
+ vep->bus_type = V4L2_MBUS_CSI2_DPHY; |
5337 |
+@@ -233,7 +237,7 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode, |
5338 |
+ if (use_default_lane_mapping) { |
5339 |
+ bus->clock_lane = 0; |
5340 |
+ for (i = 0; i < num_data_lanes; i++) |
5341 |
+- bus->data_lanes[i] = 1 + i; |
5342 |
++ bus->data_lanes[i] = dfl_data_lane_index + i; |
5343 |
+ } else { |
5344 |
+ bus->clock_lane = clock_lane; |
5345 |
+ for (i = 0; i < num_data_lanes; i++) |
5346 |
+diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c |
5347 |
+index efb8a7965dd4..154f4204d58c 100644 |
5348 |
+--- a/drivers/mmc/core/pwrseq_emmc.c |
5349 |
++++ b/drivers/mmc/core/pwrseq_emmc.c |
5350 |
+@@ -30,19 +30,14 @@ struct mmc_pwrseq_emmc { |
5351 |
+ |
5352 |
+ #define to_pwrseq_emmc(p) container_of(p, struct mmc_pwrseq_emmc, pwrseq) |
5353 |
+ |
5354 |
+-static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) |
5355 |
+-{ |
5356 |
+- gpiod_set_value(pwrseq->reset_gpio, 1); |
5357 |
+- udelay(1); |
5358 |
+- gpiod_set_value(pwrseq->reset_gpio, 0); |
5359 |
+- udelay(200); |
5360 |
+-} |
5361 |
+- |
5362 |
+ static void mmc_pwrseq_emmc_reset(struct mmc_host *host) |
5363 |
+ { |
5364 |
+ struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); |
5365 |
+ |
5366 |
+- __mmc_pwrseq_emmc_reset(pwrseq); |
5367 |
++ gpiod_set_value_cansleep(pwrseq->reset_gpio, 1); |
5368 |
++ udelay(1); |
5369 |
++ gpiod_set_value_cansleep(pwrseq->reset_gpio, 0); |
5370 |
++ udelay(200); |
5371 |
+ } |
5372 |
+ |
5373 |
+ static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, |
5374 |
+@@ -50,8 +45,11 @@ static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, |
5375 |
+ { |
5376 |
+ struct mmc_pwrseq_emmc *pwrseq = container_of(this, |
5377 |
+ struct mmc_pwrseq_emmc, reset_nb); |
5378 |
++ gpiod_set_value(pwrseq->reset_gpio, 1); |
5379 |
++ udelay(1); |
5380 |
++ gpiod_set_value(pwrseq->reset_gpio, 0); |
5381 |
++ udelay(200); |
5382 |
+ |
5383 |
+- __mmc_pwrseq_emmc_reset(pwrseq); |
5384 |
+ return NOTIFY_DONE; |
5385 |
+ } |
5386 |
+ |
5387 |
+@@ -72,14 +70,18 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev) |
5388 |
+ if (IS_ERR(pwrseq->reset_gpio)) |
5389 |
+ return PTR_ERR(pwrseq->reset_gpio); |
5390 |
+ |
5391 |
+- /* |
5392 |
+- * register reset handler to ensure emmc reset also from |
5393 |
+- * emergency_reboot(), priority 255 is the highest priority |
5394 |
+- * so it will be executed before any system reboot handler. |
5395 |
+- */ |
5396 |
+- pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb; |
5397 |
+- pwrseq->reset_nb.priority = 255; |
5398 |
+- register_restart_handler(&pwrseq->reset_nb); |
5399 |
++ if (!gpiod_cansleep(pwrseq->reset_gpio)) { |
5400 |
++ /* |
5401 |
++ * register reset handler to ensure emmc reset also from |
5402 |
++ * emergency_reboot(), priority 255 is the highest priority |
5403 |
++ * so it will be executed before any system reboot handler. |
5404 |
++ */ |
5405 |
++ pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb; |
5406 |
++ pwrseq->reset_nb.priority = 255; |
5407 |
++ register_restart_handler(&pwrseq->reset_nb); |
5408 |
++ } else { |
5409 |
++ dev_notice(dev, "EMMC reset pin tied to a sleepy GPIO driver; reset on emergency-reboot disabled\n"); |
5410 |
++ } |
5411 |
+ |
5412 |
+ pwrseq->pwrseq.ops = &mmc_pwrseq_emmc_ops; |
5413 |
+ pwrseq->pwrseq.dev = dev; |
5414 |
+diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c |
5415 |
+index d0d9f90e7cdf..cfb8ee24eaba 100644 |
5416 |
+--- a/drivers/mmc/core/sd.c |
5417 |
++++ b/drivers/mmc/core/sd.c |
5418 |
+@@ -216,6 +216,14 @@ static int mmc_decode_scr(struct mmc_card *card) |
5419 |
+ |
5420 |
+ if (scr->sda_spec3) |
5421 |
+ scr->cmds = UNSTUFF_BITS(resp, 32, 2); |
5422 |
++ |
5423 |
++ /* SD Spec says: any SD Card shall set at least bits 0 and 2 */ |
5424 |
++ if (!(scr->bus_widths & SD_SCR_BUS_WIDTH_1) || |
5425 |
++ !(scr->bus_widths & SD_SCR_BUS_WIDTH_4)) { |
5426 |
++ pr_err("%s: invalid bus width\n", mmc_hostname(card->host)); |
5427 |
++ return -EINVAL; |
5428 |
++ } |
5429 |
++ |
5430 |
+ return 0; |
5431 |
+ } |
5432 |
+ |
5433 |
+diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c |
5434 |
+index 8ade14fb2148..3410e2151579 100644 |
5435 |
+--- a/drivers/mmc/host/mmc_spi.c |
5436 |
++++ b/drivers/mmc/host/mmc_spi.c |
5437 |
+@@ -819,6 +819,10 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, |
5438 |
+ } |
5439 |
+ |
5440 |
+ status = spi_sync_locked(spi, &host->m); |
5441 |
++ if (status < 0) { |
5442 |
++ dev_dbg(&spi->dev, "read error %d\n", status); |
5443 |
++ return status; |
5444 |
++ } |
5445 |
+ |
5446 |
+ if (host->dma_dev) { |
5447 |
+ dma_sync_single_for_cpu(host->dma_dev, |
5448 |
+diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c |
5449 |
+index 9d12c06c7fd6..2feb4ef32035 100644 |
5450 |
+--- a/drivers/mmc/host/sdhci-iproc.c |
5451 |
++++ b/drivers/mmc/host/sdhci-iproc.c |
5452 |
+@@ -196,7 +196,8 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = { |
5453 |
+ }; |
5454 |
+ |
5455 |
+ static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = { |
5456 |
+- .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, |
5457 |
++ .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | |
5458 |
++ SDHCI_QUIRK_NO_HISPD_BIT, |
5459 |
+ .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN | SDHCI_QUIRK2_HOST_OFF_CARD_ON, |
5460 |
+ .ops = &sdhci_iproc_32only_ops, |
5461 |
+ }; |
5462 |
+@@ -219,7 +220,8 @@ static const struct sdhci_iproc_data iproc_cygnus_data = { |
5463 |
+ |
5464 |
+ static const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = { |
5465 |
+ .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | |
5466 |
+- SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, |
5467 |
++ SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 | |
5468 |
++ SDHCI_QUIRK_NO_HISPD_BIT, |
5469 |
+ .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN, |
5470 |
+ .ops = &sdhci_iproc_ops, |
5471 |
+ }; |
5472 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
5473 |
+index 4e669b4edfc1..7e0eae8dafae 100644 |
5474 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
5475 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
5476 |
+@@ -694,6 +694,9 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask) |
5477 |
+ sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); |
5478 |
+ sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); |
5479 |
+ |
5480 |
++ if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) |
5481 |
++ mdelay(5); |
5482 |
++ |
5483 |
+ if (mask & SDHCI_RESET_ALL) { |
5484 |
+ val = sdhci_readl(host, ESDHC_TBCTL); |
5485 |
+ val &= ~ESDHC_TB_EN; |
5486 |
+@@ -1074,6 +1077,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) |
5487 |
+ if (esdhc->vendor_ver > VENDOR_V_22) |
5488 |
+ host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; |
5489 |
+ |
5490 |
++ if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) { |
5491 |
++ host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
5492 |
++ host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
5493 |
++ } |
5494 |
++ |
5495 |
+ if (of_device_is_compatible(np, "fsl,p5040-esdhc") || |
5496 |
+ of_device_is_compatible(np, "fsl,p5020-esdhc") || |
5497 |
+ of_device_is_compatible(np, "fsl,p4080-esdhc") || |
5498 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
5499 |
+index a6eacf2099c3..9b03d7e404f8 100644 |
5500 |
+--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
5501 |
++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
5502 |
+@@ -224,28 +224,23 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) |
5503 |
+ if (!tx_ring->tx_buffer_info) { |
5504 |
+ tx_ring->tx_buffer_info = vzalloc(size); |
5505 |
+ if (!tx_ring->tx_buffer_info) |
5506 |
+- return -ENOMEM; |
5507 |
++ goto err_tx_buffer_info; |
5508 |
+ } |
5509 |
+ |
5510 |
+ size = sizeof(u16) * tx_ring->ring_size; |
5511 |
+ tx_ring->free_tx_ids = vzalloc_node(size, node); |
5512 |
+ if (!tx_ring->free_tx_ids) { |
5513 |
+ tx_ring->free_tx_ids = vzalloc(size); |
5514 |
+- if (!tx_ring->free_tx_ids) { |
5515 |
+- vfree(tx_ring->tx_buffer_info); |
5516 |
+- return -ENOMEM; |
5517 |
+- } |
5518 |
++ if (!tx_ring->free_tx_ids) |
5519 |
++ goto err_free_tx_ids; |
5520 |
+ } |
5521 |
+ |
5522 |
+ size = tx_ring->tx_max_header_size; |
5523 |
+ tx_ring->push_buf_intermediate_buf = vzalloc_node(size, node); |
5524 |
+ if (!tx_ring->push_buf_intermediate_buf) { |
5525 |
+ tx_ring->push_buf_intermediate_buf = vzalloc(size); |
5526 |
+- if (!tx_ring->push_buf_intermediate_buf) { |
5527 |
+- vfree(tx_ring->tx_buffer_info); |
5528 |
+- vfree(tx_ring->free_tx_ids); |
5529 |
+- return -ENOMEM; |
5530 |
+- } |
5531 |
++ if (!tx_ring->push_buf_intermediate_buf) |
5532 |
++ goto err_push_buf_intermediate_buf; |
5533 |
+ } |
5534 |
+ |
5535 |
+ /* Req id ring for TX out of order completions */ |
5536 |
+@@ -259,6 +254,15 @@ static int ena_setup_tx_resources(struct ena_adapter *adapter, int qid) |
5537 |
+ tx_ring->next_to_clean = 0; |
5538 |
+ tx_ring->cpu = ena_irq->cpu; |
5539 |
+ return 0; |
5540 |
++ |
5541 |
++err_push_buf_intermediate_buf: |
5542 |
++ vfree(tx_ring->free_tx_ids); |
5543 |
++ tx_ring->free_tx_ids = NULL; |
5544 |
++err_free_tx_ids: |
5545 |
++ vfree(tx_ring->tx_buffer_info); |
5546 |
++ tx_ring->tx_buffer_info = NULL; |
5547 |
++err_tx_buffer_info: |
5548 |
++ return -ENOMEM; |
5549 |
+ } |
5550 |
+ |
5551 |
+ /* ena_free_tx_resources - Free I/O Tx Resources per Queue |
5552 |
+@@ -378,6 +382,7 @@ static int ena_setup_rx_resources(struct ena_adapter *adapter, |
5553 |
+ rx_ring->free_rx_ids = vzalloc(size); |
5554 |
+ if (!rx_ring->free_rx_ids) { |
5555 |
+ vfree(rx_ring->rx_buffer_info); |
5556 |
++ rx_ring->rx_buffer_info = NULL; |
5557 |
+ return -ENOMEM; |
5558 |
+ } |
5559 |
+ } |
5560 |
+@@ -2292,7 +2297,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev, |
5561 |
+ host_info->bdf = (pdev->bus->number << 8) | pdev->devfn; |
5562 |
+ host_info->os_type = ENA_ADMIN_OS_LINUX; |
5563 |
+ host_info->kernel_ver = LINUX_VERSION_CODE; |
5564 |
+- strncpy(host_info->kernel_ver_str, utsname()->version, |
5565 |
++ strlcpy(host_info->kernel_ver_str, utsname()->version, |
5566 |
+ sizeof(host_info->kernel_ver_str) - 1); |
5567 |
+ host_info->os_dist = 0; |
5568 |
+ strncpy(host_info->os_dist_str, utsname()->release, |
5569 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
5570 |
+index c2fd323c4078..ea75f275023f 100644 |
5571 |
+--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
5572 |
++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
5573 |
+@@ -75,8 +75,8 @@ struct l2t_data { |
5574 |
+ struct l2t_entry *rover; /* starting point for next allocation */ |
5575 |
+ atomic_t nfree; /* number of free entries */ |
5576 |
+ rwlock_t lock; |
5577 |
+- struct l2t_entry l2tab[0]; |
5578 |
+ struct rcu_head rcu_head; /* to handle rcu cleanup */ |
5579 |
++ struct l2t_entry l2tab[]; |
5580 |
+ }; |
5581 |
+ |
5582 |
+ typedef void (*arp_failure_handler_func)(struct t3cdev * dev, |
5583 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
5584 |
+index 6ba9099ca7fe..8bc7a0738adb 100644 |
5585 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
5586 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
5587 |
+@@ -6044,15 +6044,24 @@ static int __init cxgb4_init_module(void) |
5588 |
+ |
5589 |
+ ret = pci_register_driver(&cxgb4_driver); |
5590 |
+ if (ret < 0) |
5591 |
+- debugfs_remove(cxgb4_debugfs_root); |
5592 |
++ goto err_pci; |
5593 |
+ |
5594 |
+ #if IS_ENABLED(CONFIG_IPV6) |
5595 |
+ if (!inet6addr_registered) { |
5596 |
+- register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
5597 |
+- inet6addr_registered = true; |
5598 |
++ ret = register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
5599 |
++ if (ret) |
5600 |
++ pci_unregister_driver(&cxgb4_driver); |
5601 |
++ else |
5602 |
++ inet6addr_registered = true; |
5603 |
+ } |
5604 |
+ #endif |
5605 |
+ |
5606 |
++ if (ret == 0) |
5607 |
++ return ret; |
5608 |
++ |
5609 |
++err_pci: |
5610 |
++ debugfs_remove(cxgb4_debugfs_root); |
5611 |
++ |
5612 |
+ return ret; |
5613 |
+ } |
5614 |
+ |
5615 |
+diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
5616 |
+index 1ca9a18139ec..0982fb4f131d 100644 |
5617 |
+--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
5618 |
++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
5619 |
+@@ -2604,6 +2604,7 @@ int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags) |
5620 |
+ static int dpaa2_eth_set_cls(struct dpaa2_eth_priv *priv) |
5621 |
+ { |
5622 |
+ struct device *dev = priv->net_dev->dev.parent; |
5623 |
++ int err; |
5624 |
+ |
5625 |
+ /* Check if we actually support Rx flow classification */ |
5626 |
+ if (dpaa2_eth_has_legacy_dist(priv)) { |
5627 |
+@@ -2622,9 +2623,13 @@ static int dpaa2_eth_set_cls(struct dpaa2_eth_priv *priv) |
5628 |
+ return -EOPNOTSUPP; |
5629 |
+ } |
5630 |
+ |
5631 |
++ err = dpaa2_eth_set_dist_key(priv->net_dev, DPAA2_ETH_RX_DIST_CLS, 0); |
5632 |
++ if (err) |
5633 |
++ return err; |
5634 |
++ |
5635 |
+ priv->rx_cls_enabled = 1; |
5636 |
+ |
5637 |
+- return dpaa2_eth_set_dist_key(priv->net_dev, DPAA2_ETH_RX_DIST_CLS, 0); |
5638 |
++ return 0; |
5639 |
+ } |
5640 |
+ |
5641 |
+ /* Bind the DPNI to its needed objects and resources: buffer pool, DPIOs, |
5642 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h |
5643 |
+index 691d12174902..3c7a26bb8322 100644 |
5644 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h |
5645 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h |
5646 |
+@@ -102,7 +102,7 @@ struct hclgevf_mbx_arq_ring { |
5647 |
+ struct hclgevf_dev *hdev; |
5648 |
+ u32 head; |
5649 |
+ u32 tail; |
5650 |
+- u32 count; |
5651 |
++ atomic_t count; |
5652 |
+ u16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE]; |
5653 |
+ }; |
5654 |
+ |
5655 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
5656 |
+index 40b69eaf2cb3..a6481bd34c3b 100644 |
5657 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
5658 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
5659 |
+@@ -2708,7 +2708,7 @@ int hns3_clean_rx_ring( |
5660 |
+ #define RCB_NOF_ALLOC_RX_BUFF_ONCE 16 |
5661 |
+ struct net_device *netdev = ring->tqp->handle->kinfo.netdev; |
5662 |
+ int recv_pkts, recv_bds, clean_count, err; |
5663 |
+- int unused_count = hns3_desc_unused(ring) - ring->pending_buf; |
5664 |
++ int unused_count = hns3_desc_unused(ring); |
5665 |
+ struct sk_buff *skb = ring->skb; |
5666 |
+ int num; |
5667 |
+ |
5668 |
+@@ -2717,6 +2717,7 @@ int hns3_clean_rx_ring( |
5669 |
+ |
5670 |
+ recv_pkts = 0, recv_bds = 0, clean_count = 0; |
5671 |
+ num -= unused_count; |
5672 |
++ unused_count -= ring->pending_buf; |
5673 |
+ |
5674 |
+ while (recv_pkts < budget && recv_bds < num) { |
5675 |
+ /* Reuse or realloc buffers */ |
5676 |
+@@ -3793,12 +3794,13 @@ static int hns3_recover_hw_addr(struct net_device *ndev) |
5677 |
+ struct netdev_hw_addr *ha, *tmp; |
5678 |
+ int ret = 0; |
5679 |
+ |
5680 |
++ netif_addr_lock_bh(ndev); |
5681 |
+ /* go through and sync uc_addr entries to the device */ |
5682 |
+ list = &ndev->uc; |
5683 |
+ list_for_each_entry_safe(ha, tmp, &list->list, list) { |
5684 |
+ ret = hns3_nic_uc_sync(ndev, ha->addr); |
5685 |
+ if (ret) |
5686 |
+- return ret; |
5687 |
++ goto out; |
5688 |
+ } |
5689 |
+ |
5690 |
+ /* go through and sync mc_addr entries to the device */ |
5691 |
+@@ -3806,9 +3808,11 @@ static int hns3_recover_hw_addr(struct net_device *ndev) |
5692 |
+ list_for_each_entry_safe(ha, tmp, &list->list, list) { |
5693 |
+ ret = hns3_nic_mc_sync(ndev, ha->addr); |
5694 |
+ if (ret) |
5695 |
+- return ret; |
5696 |
++ goto out; |
5697 |
+ } |
5698 |
+ |
5699 |
++out: |
5700 |
++ netif_addr_unlock_bh(ndev); |
5701 |
+ return ret; |
5702 |
+ } |
5703 |
+ |
5704 |
+@@ -3819,6 +3823,7 @@ static void hns3_remove_hw_addr(struct net_device *netdev) |
5705 |
+ |
5706 |
+ hns3_nic_uc_unsync(netdev, netdev->dev_addr); |
5707 |
+ |
5708 |
++ netif_addr_lock_bh(netdev); |
5709 |
+ /* go through and unsync uc_addr entries to the device */ |
5710 |
+ list = &netdev->uc; |
5711 |
+ list_for_each_entry_safe(ha, tmp, &list->list, list) |
5712 |
+@@ -3829,6 +3834,8 @@ static void hns3_remove_hw_addr(struct net_device *netdev) |
5713 |
+ list_for_each_entry_safe(ha, tmp, &list->list, list) |
5714 |
+ if (ha->refcount > 1) |
5715 |
+ hns3_nic_mc_unsync(netdev, ha->addr); |
5716 |
++ |
5717 |
++ netif_addr_unlock_bh(netdev); |
5718 |
+ } |
5719 |
+ |
5720 |
+ static void hns3_clear_tx_ring(struct hns3_enet_ring *ring) |
5721 |
+@@ -3870,6 +3877,13 @@ static int hns3_clear_rx_ring(struct hns3_enet_ring *ring) |
5722 |
+ ring_ptr_move_fw(ring, next_to_use); |
5723 |
+ } |
5724 |
+ |
5725 |
++ /* Free the pending skb in rx ring */ |
5726 |
++ if (ring->skb) { |
5727 |
++ dev_kfree_skb_any(ring->skb); |
5728 |
++ ring->skb = NULL; |
5729 |
++ ring->pending_buf = 0; |
5730 |
++ } |
5731 |
++ |
5732 |
+ return 0; |
5733 |
+ } |
5734 |
+ |
5735 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c |
5736 |
+index e678b6939da3..36b35c58304b 100644 |
5737 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c |
5738 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c |
5739 |
+@@ -482,6 +482,11 @@ static void hns3_get_stats(struct net_device *netdev, |
5740 |
+ struct hnae3_handle *h = hns3_get_handle(netdev); |
5741 |
+ u64 *p = data; |
5742 |
+ |
5743 |
++ if (hns3_nic_resetting(netdev)) { |
5744 |
++ netdev_err(netdev, "dev resetting, could not get stats\n"); |
5745 |
++ return; |
5746 |
++ } |
5747 |
++ |
5748 |
+ if (!h->ae_algo->ops->get_stats || !h->ae_algo->ops->update_stats) { |
5749 |
+ netdev_err(netdev, "could not get any statistics\n"); |
5750 |
+ return; |
5751 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c |
5752 |
+index e483a6e730e6..87fa4787bb76 100644 |
5753 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c |
5754 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c |
5755 |
+@@ -359,21 +359,26 @@ int hclge_cmd_init(struct hclge_dev *hdev) |
5756 |
+ * reset may happen when lower level reset is being processed. |
5757 |
+ */ |
5758 |
+ if ((hclge_is_reset_pending(hdev))) { |
5759 |
+- set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); |
5760 |
+- return -EBUSY; |
5761 |
++ ret = -EBUSY; |
5762 |
++ goto err_cmd_init; |
5763 |
+ } |
5764 |
+ |
5765 |
+ ret = hclge_cmd_query_firmware_version(&hdev->hw, &version); |
5766 |
+ if (ret) { |
5767 |
+ dev_err(&hdev->pdev->dev, |
5768 |
+ "firmware version query failed %d\n", ret); |
5769 |
+- return ret; |
5770 |
++ goto err_cmd_init; |
5771 |
+ } |
5772 |
+ hdev->fw_version = version; |
5773 |
+ |
5774 |
+ dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version); |
5775 |
+ |
5776 |
+ return 0; |
5777 |
++ |
5778 |
++err_cmd_init: |
5779 |
++ set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); |
5780 |
++ |
5781 |
++ return ret; |
5782 |
+ } |
5783 |
+ |
5784 |
+ static void hclge_destroy_queue(struct hclge_cmq_ring *ring) |
5785 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c |
5786 |
+index 4e78e8812a04..1e7df81c95ad 100644 |
5787 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c |
5788 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c |
5789 |
+@@ -327,7 +327,7 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev) |
5790 |
+ hdev->arq.hdev = hdev; |
5791 |
+ hdev->arq.head = 0; |
5792 |
+ hdev->arq.tail = 0; |
5793 |
+- hdev->arq.count = 0; |
5794 |
++ atomic_set(&hdev->arq.count, 0); |
5795 |
+ hdev->hw.cmq.csq.next_to_clean = 0; |
5796 |
+ hdev->hw.cmq.csq.next_to_use = 0; |
5797 |
+ hdev->hw.cmq.crq.next_to_clean = 0; |
5798 |
+@@ -344,8 +344,8 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev) |
5799 |
+ * reset may happen when lower level reset is being processed. |
5800 |
+ */ |
5801 |
+ if (hclgevf_is_reset_pending(hdev)) { |
5802 |
+- set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state); |
5803 |
+- return -EBUSY; |
5804 |
++ ret = -EBUSY; |
5805 |
++ goto err_cmd_init; |
5806 |
+ } |
5807 |
+ |
5808 |
+ /* get firmware version */ |
5809 |
+@@ -353,13 +353,18 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev) |
5810 |
+ if (ret) { |
5811 |
+ dev_err(&hdev->pdev->dev, |
5812 |
+ "failed(%d) to query firmware version\n", ret); |
5813 |
+- return ret; |
5814 |
++ goto err_cmd_init; |
5815 |
+ } |
5816 |
+ hdev->fw_version = version; |
5817 |
+ |
5818 |
+ dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version); |
5819 |
+ |
5820 |
+ return 0; |
5821 |
++ |
5822 |
++err_cmd_init: |
5823 |
++ set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state); |
5824 |
++ |
5825 |
++ return ret; |
5826 |
+ } |
5827 |
+ |
5828 |
+ void hclgevf_cmd_uninit(struct hclgevf_dev *hdev) |
5829 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
5830 |
+index 82103d5fa815..57f658379b16 100644 |
5831 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
5832 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
5833 |
+@@ -1895,9 +1895,15 @@ static int hclgevf_set_alive(struct hnae3_handle *handle, bool alive) |
5834 |
+ static int hclgevf_client_start(struct hnae3_handle *handle) |
5835 |
+ { |
5836 |
+ struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); |
5837 |
++ int ret; |
5838 |
++ |
5839 |
++ ret = hclgevf_set_alive(handle, true); |
5840 |
++ if (ret) |
5841 |
++ return ret; |
5842 |
+ |
5843 |
+ mod_timer(&hdev->keep_alive_timer, jiffies + 2 * HZ); |
5844 |
+- return hclgevf_set_alive(handle, true); |
5845 |
++ |
5846 |
++ return 0; |
5847 |
+ } |
5848 |
+ |
5849 |
+ static void hclgevf_client_stop(struct hnae3_handle *handle) |
5850 |
+@@ -1939,6 +1945,10 @@ static void hclgevf_state_uninit(struct hclgevf_dev *hdev) |
5851 |
+ { |
5852 |
+ set_bit(HCLGEVF_STATE_DOWN, &hdev->state); |
5853 |
+ |
5854 |
++ if (hdev->keep_alive_timer.function) |
5855 |
++ del_timer_sync(&hdev->keep_alive_timer); |
5856 |
++ if (hdev->keep_alive_task.func) |
5857 |
++ cancel_work_sync(&hdev->keep_alive_task); |
5858 |
+ if (hdev->service_timer.function) |
5859 |
+ del_timer_sync(&hdev->service_timer); |
5860 |
+ if (hdev->service_task.func) |
5861 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c |
5862 |
+index 84653f58b2d1..fbba8b83b36c 100644 |
5863 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c |
5864 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c |
5865 |
+@@ -207,7 +207,8 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev) |
5866 |
+ /* we will drop the async msg if we find ARQ as full |
5867 |
+ * and continue with next message |
5868 |
+ */ |
5869 |
+- if (hdev->arq.count >= HCLGE_MBX_MAX_ARQ_MSG_NUM) { |
5870 |
++ if (atomic_read(&hdev->arq.count) >= |
5871 |
++ HCLGE_MBX_MAX_ARQ_MSG_NUM) { |
5872 |
+ dev_warn(&hdev->pdev->dev, |
5873 |
+ "Async Q full, dropping msg(%d)\n", |
5874 |
+ req->msg[1]); |
5875 |
+@@ -219,7 +220,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev) |
5876 |
+ memcpy(&msg_q[0], req->msg, |
5877 |
+ HCLGE_MBX_MAX_ARQ_MSG_SIZE * sizeof(u16)); |
5878 |
+ hclge_mbx_tail_ptr_move_arq(hdev->arq); |
5879 |
+- hdev->arq.count++; |
5880 |
++ atomic_inc(&hdev->arq.count); |
5881 |
+ |
5882 |
+ hclgevf_mbx_task_schedule(hdev); |
5883 |
+ |
5884 |
+@@ -296,7 +297,7 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) |
5885 |
+ } |
5886 |
+ |
5887 |
+ hclge_mbx_head_ptr_move_arq(hdev->arq); |
5888 |
+- hdev->arq.count--; |
5889 |
++ atomic_dec(&hdev->arq.count); |
5890 |
+ msg_q = hdev->arq.msg_q[hdev->arq.head]; |
5891 |
+ } |
5892 |
+ } |
5893 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
5894 |
+index 7acc61e4f645..c10c9d7eadaa 100644 |
5895 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
5896 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
5897 |
+@@ -7350,7 +7350,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
5898 |
+ |
5899 |
+ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP); |
5900 |
+ |
5901 |
+- if (pci_dev_run_wake(pdev)) |
5902 |
++ if (pci_dev_run_wake(pdev) && hw->mac.type < e1000_pch_cnp) |
5903 |
+ pm_runtime_put_noidle(&pdev->dev); |
5904 |
+ |
5905 |
+ return 0; |
5906 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
5907 |
+index e4ff531db14a..3a3382613263 100644 |
5908 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
5909 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
5910 |
+@@ -2654,6 +2654,10 @@ void i40e_vlan_stripping_enable(struct i40e_vsi *vsi) |
5911 |
+ struct i40e_vsi_context ctxt; |
5912 |
+ i40e_status ret; |
5913 |
+ |
5914 |
++ /* Don't modify stripping options if a port VLAN is active */ |
5915 |
++ if (vsi->info.pvid) |
5916 |
++ return; |
5917 |
++ |
5918 |
+ if ((vsi->info.valid_sections & |
5919 |
+ cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && |
5920 |
+ ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_MODE_MASK) == 0)) |
5921 |
+@@ -2684,6 +2688,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi) |
5922 |
+ struct i40e_vsi_context ctxt; |
5923 |
+ i40e_status ret; |
5924 |
+ |
5925 |
++ /* Don't modify stripping options if a port VLAN is active */ |
5926 |
++ if (vsi->info.pvid) |
5927 |
++ return; |
5928 |
++ |
5929 |
+ if ((vsi->info.valid_sections & |
5930 |
+ cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && |
5931 |
+ ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK) == |
5932 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
5933 |
+index 2ac23ebfbf31..715c6a9f30f9 100644 |
5934 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
5935 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
5936 |
+@@ -2449,8 +2449,10 @@ error_param: |
5937 |
+ (u8 *)&stats, sizeof(stats)); |
5938 |
+ } |
5939 |
+ |
5940 |
+-/* If the VF is not trusted restrict the number of MAC/VLAN it can program */ |
5941 |
+-#define I40E_VC_MAX_MAC_ADDR_PER_VF 12 |
5942 |
++/* If the VF is not trusted restrict the number of MAC/VLAN it can program |
5943 |
++ * MAC filters: 16 for multicast, 1 for MAC, 1 for broadcast |
5944 |
++ */ |
5945 |
++#define I40E_VC_MAX_MAC_ADDR_PER_VF (16 + 1 + 1) |
5946 |
+ #define I40E_VC_MAX_VLAN_PER_VF 8 |
5947 |
+ |
5948 |
+ /** |
5949 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c |
5950 |
+index 8725569d11f0..f8801267502a 100644 |
5951 |
+--- a/drivers/net/ethernet/intel/ice/ice_main.c |
5952 |
++++ b/drivers/net/ethernet/intel/ice/ice_main.c |
5953 |
+@@ -342,6 +342,10 @@ ice_prepare_for_reset(struct ice_pf *pf) |
5954 |
+ { |
5955 |
+ struct ice_hw *hw = &pf->hw; |
5956 |
+ |
5957 |
++ /* already prepared for reset */ |
5958 |
++ if (test_bit(__ICE_PREPARED_FOR_RESET, pf->state)) |
5959 |
++ return; |
5960 |
++ |
5961 |
+ /* Notify VFs of impending reset */ |
5962 |
+ if (ice_check_sq_alive(hw, &hw->mailboxq)) |
5963 |
+ ice_vc_notify_reset(pf); |
5964 |
+@@ -416,10 +420,15 @@ static void ice_reset_subtask(struct ice_pf *pf) |
5965 |
+ * for the reset now), poll for reset done, rebuild and return. |
5966 |
+ */ |
5967 |
+ if (test_bit(__ICE_RESET_OICR_RECV, pf->state)) { |
5968 |
+- clear_bit(__ICE_GLOBR_RECV, pf->state); |
5969 |
+- clear_bit(__ICE_CORER_RECV, pf->state); |
5970 |
+- if (!test_bit(__ICE_PREPARED_FOR_RESET, pf->state)) |
5971 |
+- ice_prepare_for_reset(pf); |
5972 |
++ /* Perform the largest reset requested */ |
5973 |
++ if (test_and_clear_bit(__ICE_CORER_RECV, pf->state)) |
5974 |
++ reset_type = ICE_RESET_CORER; |
5975 |
++ if (test_and_clear_bit(__ICE_GLOBR_RECV, pf->state)) |
5976 |
++ reset_type = ICE_RESET_GLOBR; |
5977 |
++ /* return if no valid reset type requested */ |
5978 |
++ if (reset_type == ICE_RESET_INVAL) |
5979 |
++ return; |
5980 |
++ ice_prepare_for_reset(pf); |
5981 |
+ |
5982 |
+ /* make sure we are ready to rebuild */ |
5983 |
+ if (ice_check_reset(&pf->hw)) { |
5984 |
+@@ -2490,6 +2499,9 @@ static int ice_set_features(struct net_device *netdev, |
5985 |
+ struct ice_vsi *vsi = np->vsi; |
5986 |
+ int ret = 0; |
5987 |
+ |
5988 |
++ /* Multiple features can be changed in one call so keep features in |
5989 |
++ * separate if/else statements to guarantee each feature is checked |
5990 |
++ */ |
5991 |
+ if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH)) |
5992 |
+ ret = ice_vsi_manage_rss_lut(vsi, true); |
5993 |
+ else if (!(features & NETIF_F_RXHASH) && |
5994 |
+@@ -2502,8 +2514,9 @@ static int ice_set_features(struct net_device *netdev, |
5995 |
+ else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) && |
5996 |
+ (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) |
5997 |
+ ret = ice_vsi_manage_vlan_stripping(vsi, false); |
5998 |
+- else if ((features & NETIF_F_HW_VLAN_CTAG_TX) && |
5999 |
+- !(netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) |
6000 |
++ |
6001 |
++ if ((features & NETIF_F_HW_VLAN_CTAG_TX) && |
6002 |
++ !(netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) |
6003 |
+ ret = ice_vsi_manage_vlan_insertion(vsi); |
6004 |
+ else if (!(features & NETIF_F_HW_VLAN_CTAG_TX) && |
6005 |
+ (netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) |
6006 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
6007 |
+index 21ccadb720d1..2a000b8f341b 100644 |
6008 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
6009 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
6010 |
+@@ -3467,6 +3467,9 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
6011 |
+ break; |
6012 |
+ } |
6013 |
+ } |
6014 |
++ |
6015 |
++ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP); |
6016 |
++ |
6017 |
+ pm_runtime_put_noidle(&pdev->dev); |
6018 |
+ return 0; |
6019 |
+ |
6020 |
+diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c |
6021 |
+index a591583d120e..dd12b73a8853 100644 |
6022 |
+--- a/drivers/net/ethernet/ti/cpsw.c |
6023 |
++++ b/drivers/net/ethernet/ti/cpsw.c |
6024 |
+@@ -800,12 +800,17 @@ static int cpsw_purge_all_mc(struct net_device *ndev, const u8 *addr, int num) |
6025 |
+ |
6026 |
+ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) |
6027 |
+ { |
6028 |
+- struct cpsw_common *cpsw = ndev_to_cpsw(ndev); |
6029 |
++ struct cpsw_priv *priv = netdev_priv(ndev); |
6030 |
++ struct cpsw_common *cpsw = priv->cpsw; |
6031 |
++ int slave_port = -1; |
6032 |
++ |
6033 |
++ if (cpsw->data.dual_emac) |
6034 |
++ slave_port = priv->emac_port + 1; |
6035 |
+ |
6036 |
+ if (ndev->flags & IFF_PROMISC) { |
6037 |
+ /* Enable promiscuous mode */ |
6038 |
+ cpsw_set_promiscious(ndev, true); |
6039 |
+- cpsw_ale_set_allmulti(cpsw->ale, IFF_ALLMULTI); |
6040 |
++ cpsw_ale_set_allmulti(cpsw->ale, IFF_ALLMULTI, slave_port); |
6041 |
+ return; |
6042 |
+ } else { |
6043 |
+ /* Disable promiscuous mode */ |
6044 |
+@@ -813,7 +818,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) |
6045 |
+ } |
6046 |
+ |
6047 |
+ /* Restore allmulti on vlans if necessary */ |
6048 |
+- cpsw_ale_set_allmulti(cpsw->ale, ndev->flags & IFF_ALLMULTI); |
6049 |
++ cpsw_ale_set_allmulti(cpsw->ale, |
6050 |
++ ndev->flags & IFF_ALLMULTI, slave_port); |
6051 |
+ |
6052 |
+ /* add/remove mcast address either for real netdev or for vlan */ |
6053 |
+ __hw_addr_ref_sync_dev(&ndev->mc, ndev, cpsw_add_mc_addr, |
6054 |
+diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c |
6055 |
+index 798c989d5d93..b3d9591b4824 100644 |
6056 |
+--- a/drivers/net/ethernet/ti/cpsw_ale.c |
6057 |
++++ b/drivers/net/ethernet/ti/cpsw_ale.c |
6058 |
+@@ -482,24 +482,25 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) |
6059 |
+ } |
6060 |
+ EXPORT_SYMBOL_GPL(cpsw_ale_del_vlan); |
6061 |
+ |
6062 |
+-void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti) |
6063 |
++void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port) |
6064 |
+ { |
6065 |
+ u32 ale_entry[ALE_ENTRY_WORDS]; |
6066 |
+- int type, idx; |
6067 |
+ int unreg_mcast = 0; |
6068 |
+- |
6069 |
+- /* Only bother doing the work if the setting is actually changing */ |
6070 |
+- if (ale->allmulti == allmulti) |
6071 |
+- return; |
6072 |
+- |
6073 |
+- /* Remember the new setting to check against next time */ |
6074 |
+- ale->allmulti = allmulti; |
6075 |
++ int type, idx; |
6076 |
+ |
6077 |
+ for (idx = 0; idx < ale->params.ale_entries; idx++) { |
6078 |
++ int vlan_members; |
6079 |
++ |
6080 |
+ cpsw_ale_read(ale, idx, ale_entry); |
6081 |
+ type = cpsw_ale_get_entry_type(ale_entry); |
6082 |
+ if (type != ALE_TYPE_VLAN) |
6083 |
+ continue; |
6084 |
++ vlan_members = |
6085 |
++ cpsw_ale_get_vlan_member_list(ale_entry, |
6086 |
++ ale->vlan_field_bits); |
6087 |
++ |
6088 |
++ if (port != -1 && !(vlan_members & BIT(port))) |
6089 |
++ continue; |
6090 |
+ |
6091 |
+ unreg_mcast = |
6092 |
+ cpsw_ale_get_vlan_unreg_mcast(ale_entry, |
6093 |
+diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h |
6094 |
+index cd07a3e96d57..1fe196d8a5e4 100644 |
6095 |
+--- a/drivers/net/ethernet/ti/cpsw_ale.h |
6096 |
++++ b/drivers/net/ethernet/ti/cpsw_ale.h |
6097 |
+@@ -37,7 +37,6 @@ struct cpsw_ale { |
6098 |
+ struct cpsw_ale_params params; |
6099 |
+ struct timer_list timer; |
6100 |
+ unsigned long ageout; |
6101 |
+- int allmulti; |
6102 |
+ u32 version; |
6103 |
+ /* These bits are different on NetCP NU Switch ALE */ |
6104 |
+ u32 port_mask_bits; |
6105 |
+@@ -116,7 +115,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, |
6106 |
+ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, |
6107 |
+ int reg_mcast, int unreg_mcast); |
6108 |
+ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port); |
6109 |
+-void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti); |
6110 |
++void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port); |
6111 |
+ |
6112 |
+ int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); |
6113 |
+ int cpsw_ale_control_set(struct cpsw_ale *ale, int port, |
6114 |
+diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c |
6115 |
+index e0dce373cdd9..3d4a166a49d5 100644 |
6116 |
+--- a/drivers/net/hyperv/netvsc.c |
6117 |
++++ b/drivers/net/hyperv/netvsc.c |
6118 |
+@@ -875,12 +875,6 @@ static inline int netvsc_send_pkt( |
6119 |
+ } else if (ret == -EAGAIN) { |
6120 |
+ netif_tx_stop_queue(txq); |
6121 |
+ ndev_ctx->eth_stats.stop_queue++; |
6122 |
+- if (atomic_read(&nvchan->queue_sends) < 1 && |
6123 |
+- !net_device->tx_disable) { |
6124 |
+- netif_tx_wake_queue(txq); |
6125 |
+- ndev_ctx->eth_stats.wake_queue++; |
6126 |
+- ret = -ENOSPC; |
6127 |
+- } |
6128 |
+ } else { |
6129 |
+ netdev_err(ndev, |
6130 |
+ "Unable to send packet pages %u len %u, ret %d\n", |
6131 |
+@@ -888,6 +882,15 @@ static inline int netvsc_send_pkt( |
6132 |
+ ret); |
6133 |
+ } |
6134 |
+ |
6135 |
++ if (netif_tx_queue_stopped(txq) && |
6136 |
++ atomic_read(&nvchan->queue_sends) < 1 && |
6137 |
++ !net_device->tx_disable) { |
6138 |
++ netif_tx_wake_queue(txq); |
6139 |
++ ndev_ctx->eth_stats.wake_queue++; |
6140 |
++ if (ret == -EAGAIN) |
6141 |
++ ret = -ENOSPC; |
6142 |
++ } |
6143 |
++ |
6144 |
+ return ret; |
6145 |
+ } |
6146 |
+ |
6147 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
6148 |
+index ff2426e00682..67a06fa7566b 100644 |
6149 |
+--- a/drivers/net/phy/phy_device.c |
6150 |
++++ b/drivers/net/phy/phy_device.c |
6151 |
+@@ -1830,13 +1830,25 @@ EXPORT_SYMBOL(genphy_read_status); |
6152 |
+ */ |
6153 |
+ int genphy_soft_reset(struct phy_device *phydev) |
6154 |
+ { |
6155 |
++ u16 res = BMCR_RESET; |
6156 |
+ int ret; |
6157 |
+ |
6158 |
+- ret = phy_set_bits(phydev, MII_BMCR, BMCR_RESET); |
6159 |
++ if (phydev->autoneg == AUTONEG_ENABLE) |
6160 |
++ res |= BMCR_ANRESTART; |
6161 |
++ |
6162 |
++ ret = phy_modify(phydev, MII_BMCR, BMCR_ISOLATE, res); |
6163 |
+ if (ret < 0) |
6164 |
+ return ret; |
6165 |
+ |
6166 |
+- return phy_poll_reset(phydev); |
6167 |
++ ret = phy_poll_reset(phydev); |
6168 |
++ if (ret) |
6169 |
++ return ret; |
6170 |
++ |
6171 |
++ /* BMCR may be reset to defaults */ |
6172 |
++ if (phydev->autoneg == AUTONEG_DISABLE) |
6173 |
++ ret = genphy_setup_forced(phydev); |
6174 |
++ |
6175 |
++ return ret; |
6176 |
+ } |
6177 |
+ EXPORT_SYMBOL(genphy_soft_reset); |
6178 |
+ |
6179 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
6180 |
+index 366217263d70..d9a6699abe59 100644 |
6181 |
+--- a/drivers/net/usb/qmi_wwan.c |
6182 |
++++ b/drivers/net/usb/qmi_wwan.c |
6183 |
+@@ -63,6 +63,7 @@ enum qmi_wwan_flags { |
6184 |
+ |
6185 |
+ enum qmi_wwan_quirks { |
6186 |
+ QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */ |
6187 |
++ QMI_WWAN_QUIRK_QUECTEL_DYNCFG = 1 << 1, /* check num. endpoints */ |
6188 |
+ }; |
6189 |
+ |
6190 |
+ struct qmimux_hdr { |
6191 |
+@@ -845,6 +846,16 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = { |
6192 |
+ .data = QMI_WWAN_QUIRK_DTR, |
6193 |
+ }; |
6194 |
+ |
6195 |
++static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = { |
6196 |
++ .description = "WWAN/QMI device", |
6197 |
++ .flags = FLAG_WWAN | FLAG_SEND_ZLP, |
6198 |
++ .bind = qmi_wwan_bind, |
6199 |
++ .unbind = qmi_wwan_unbind, |
6200 |
++ .manage_power = qmi_wwan_manage_power, |
6201 |
++ .rx_fixup = qmi_wwan_rx_fixup, |
6202 |
++ .data = QMI_WWAN_QUIRK_DTR | QMI_WWAN_QUIRK_QUECTEL_DYNCFG, |
6203 |
++}; |
6204 |
++ |
6205 |
+ #define HUAWEI_VENDOR_ID 0x12D1 |
6206 |
+ |
6207 |
+ /* map QMI/wwan function by a fixed interface number */ |
6208 |
+@@ -865,6 +876,15 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = { |
6209 |
+ #define QMI_GOBI_DEVICE(vend, prod) \ |
6210 |
+ QMI_FIXED_INTF(vend, prod, 0) |
6211 |
+ |
6212 |
++/* Quectel does not use fixed interface numbers on at least some of their |
6213 |
++ * devices. We need to check the number of endpoints to ensure that we bind to |
6214 |
++ * the correct interface. |
6215 |
++ */ |
6216 |
++#define QMI_QUIRK_QUECTEL_DYNCFG(vend, prod) \ |
6217 |
++ USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VENDOR_SPEC, \ |
6218 |
++ USB_SUBCLASS_VENDOR_SPEC, 0xff), \ |
6219 |
++ .driver_info = (unsigned long)&qmi_wwan_info_quirk_quectel_dyncfg |
6220 |
++ |
6221 |
+ static const struct usb_device_id products[] = { |
6222 |
+ /* 1. CDC ECM like devices match on the control interface */ |
6223 |
+ { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
6224 |
+@@ -969,20 +989,9 @@ static const struct usb_device_id products[] = { |
6225 |
+ USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), |
6226 |
+ .driver_info = (unsigned long)&qmi_wwan_info, |
6227 |
+ }, |
6228 |
+- { /* Quectel EP06/EG06/EM06 */ |
6229 |
+- USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0306, |
6230 |
+- USB_CLASS_VENDOR_SPEC, |
6231 |
+- USB_SUBCLASS_VENDOR_SPEC, |
6232 |
+- 0xff), |
6233 |
+- .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, |
6234 |
+- }, |
6235 |
+- { /* Quectel EG12/EM12 */ |
6236 |
+- USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0512, |
6237 |
+- USB_CLASS_VENDOR_SPEC, |
6238 |
+- USB_SUBCLASS_VENDOR_SPEC, |
6239 |
+- 0xff), |
6240 |
+- .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, |
6241 |
+- }, |
6242 |
++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ |
6243 |
++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ |
6244 |
++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ |
6245 |
+ |
6246 |
+ /* 3. Combined interface devices matching on interface number */ |
6247 |
+ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ |
6248 |
+@@ -1283,7 +1292,6 @@ static const struct usb_device_id products[] = { |
6249 |
+ {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ |
6250 |
+ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ |
6251 |
+ {QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */ |
6252 |
+- {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ |
6253 |
+ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */ |
6254 |
+ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */ |
6255 |
+ {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */ |
6256 |
+@@ -1363,27 +1371,12 @@ static bool quectel_ec20_detected(struct usb_interface *intf) |
6257 |
+ return false; |
6258 |
+ } |
6259 |
+ |
6260 |
+-static bool quectel_diag_detected(struct usb_interface *intf) |
6261 |
+-{ |
6262 |
+- struct usb_device *dev = interface_to_usbdev(intf); |
6263 |
+- struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc; |
6264 |
+- u16 id_vendor = le16_to_cpu(dev->descriptor.idVendor); |
6265 |
+- u16 id_product = le16_to_cpu(dev->descriptor.idProduct); |
6266 |
+- |
6267 |
+- if (id_vendor != 0x2c7c || intf_desc.bNumEndpoints != 2) |
6268 |
+- return false; |
6269 |
+- |
6270 |
+- if (id_product == 0x0306 || id_product == 0x0512) |
6271 |
+- return true; |
6272 |
+- else |
6273 |
+- return false; |
6274 |
+-} |
6275 |
+- |
6276 |
+ static int qmi_wwan_probe(struct usb_interface *intf, |
6277 |
+ const struct usb_device_id *prod) |
6278 |
+ { |
6279 |
+ struct usb_device_id *id = (struct usb_device_id *)prod; |
6280 |
+ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; |
6281 |
++ const struct driver_info *info; |
6282 |
+ |
6283 |
+ /* Workaround to enable dynamic IDs. This disables usbnet |
6284 |
+ * blacklisting functionality. Which, if required, can be |
6285 |
+@@ -1417,10 +1410,14 @@ static int qmi_wwan_probe(struct usb_interface *intf, |
6286 |
+ * we need to match on class/subclass/protocol. These values are |
6287 |
+ * identical for the diagnostic- and QMI-interface, but bNumEndpoints is |
6288 |
+ * different. Ignore the current interface if the number of endpoints |
6289 |
+- * the number for the diag interface (two). |
6290 |
++ * equals the number for the diag interface (two). |
6291 |
+ */ |
6292 |
+- if (quectel_diag_detected(intf)) |
6293 |
+- return -ENODEV; |
6294 |
++ info = (void *)&id->driver_info; |
6295 |
++ |
6296 |
++ if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) { |
6297 |
++ if (desc->bNumEndpoints == 2) |
6298 |
++ return -ENODEV; |
6299 |
++ } |
6300 |
+ |
6301 |
+ return usbnet_probe(intf, id); |
6302 |
+ } |
6303 |
+diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c |
6304 |
+index 5a44f9d0ff02..c7b5a7786e38 100644 |
6305 |
+--- a/drivers/net/wireless/ath/wil6210/cfg80211.c |
6306 |
++++ b/drivers/net/wireless/ath/wil6210/cfg80211.c |
6307 |
+@@ -1274,7 +1274,12 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
6308 |
+ params->wait); |
6309 |
+ |
6310 |
+ out: |
6311 |
++ /* when the sent packet was not acked by receiver(ACK=0), rc will |
6312 |
++ * be -EAGAIN. In this case this function needs to return success, |
6313 |
++ * the ACK=0 will be reflected in tx_status. |
6314 |
++ */ |
6315 |
+ tx_status = (rc == 0); |
6316 |
++ rc = (rc == -EAGAIN) ? 0 : rc; |
6317 |
+ cfg80211_mgmt_tx_status(wdev, cookie ? *cookie : 0, buf, len, |
6318 |
+ tx_status, GFP_KERNEL); |
6319 |
+ |
6320 |
+diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c |
6321 |
+index 345f05969190..fc1b4b897cb8 100644 |
6322 |
+--- a/drivers/net/wireless/ath/wil6210/wmi.c |
6323 |
++++ b/drivers/net/wireless/ath/wil6210/wmi.c |
6324 |
+@@ -3455,8 +3455,9 @@ int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len) |
6325 |
+ rc = wmi_call(wil, WMI_SW_TX_REQ_CMDID, vif->mid, cmd, total, |
6326 |
+ WMI_SW_TX_COMPLETE_EVENTID, &evt, sizeof(evt), 2000); |
6327 |
+ if (!rc && evt.evt.status != WMI_FW_STATUS_SUCCESS) { |
6328 |
+- wil_err(wil, "mgmt_tx failed with status %d\n", evt.evt.status); |
6329 |
+- rc = -EINVAL; |
6330 |
++ wil_dbg_wmi(wil, "mgmt_tx failed with status %d\n", |
6331 |
++ evt.evt.status); |
6332 |
++ rc = -EAGAIN; |
6333 |
+ } |
6334 |
+ |
6335 |
+ kfree(cmd); |
6336 |
+@@ -3508,9 +3509,9 @@ int wmi_mgmt_tx_ext(struct wil6210_vif *vif, const u8 *buf, size_t len, |
6337 |
+ rc = wmi_call(wil, WMI_SW_TX_REQ_EXT_CMDID, vif->mid, cmd, total, |
6338 |
+ WMI_SW_TX_COMPLETE_EVENTID, &evt, sizeof(evt), 2000); |
6339 |
+ if (!rc && evt.evt.status != WMI_FW_STATUS_SUCCESS) { |
6340 |
+- wil_err(wil, "mgmt_tx_ext failed with status %d\n", |
6341 |
+- evt.evt.status); |
6342 |
+- rc = -EINVAL; |
6343 |
++ wil_dbg_wmi(wil, "mgmt_tx_ext failed with status %d\n", |
6344 |
++ evt.evt.status); |
6345 |
++ rc = -EAGAIN; |
6346 |
+ } |
6347 |
+ |
6348 |
+ kfree(cmd); |
6349 |
+diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c |
6350 |
+index e99e766a3028..1cabae424839 100644 |
6351 |
+--- a/drivers/net/wireless/atmel/at76c50x-usb.c |
6352 |
++++ b/drivers/net/wireless/atmel/at76c50x-usb.c |
6353 |
+@@ -2585,8 +2585,8 @@ static int __init at76_mod_init(void) |
6354 |
+ if (result < 0) |
6355 |
+ printk(KERN_ERR DRIVER_NAME |
6356 |
+ ": usb_register failed (status %d)\n", result); |
6357 |
+- |
6358 |
+- led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); |
6359 |
++ else |
6360 |
++ led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); |
6361 |
+ return result; |
6362 |
+ } |
6363 |
+ |
6364 |
+diff --git a/drivers/net/wireless/broadcom/b43/phy_lp.c b/drivers/net/wireless/broadcom/b43/phy_lp.c |
6365 |
+index 46408a560814..aedee026c5e2 100644 |
6366 |
+--- a/drivers/net/wireless/broadcom/b43/phy_lp.c |
6367 |
++++ b/drivers/net/wireless/broadcom/b43/phy_lp.c |
6368 |
+@@ -1835,7 +1835,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, |
6369 |
+ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
6370 |
+ { |
6371 |
+ struct b43_phy_lp *lpphy = dev->phy.lp; |
6372 |
+- struct lpphy_tx_gains gains, oldgains; |
6373 |
++ struct lpphy_tx_gains oldgains; |
6374 |
+ int old_txpctl, old_afe_ovr, old_rf, old_bbmult; |
6375 |
+ |
6376 |
+ lpphy_read_tx_pctl_mode_from_hardware(dev); |
6377 |
+@@ -1849,9 +1849,9 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
6378 |
+ lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); |
6379 |
+ |
6380 |
+ if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) |
6381 |
+- lpphy_papd_cal(dev, gains, 0, 1, 30); |
6382 |
++ lpphy_papd_cal(dev, oldgains, 0, 1, 30); |
6383 |
+ else |
6384 |
+- lpphy_papd_cal(dev, gains, 0, 1, 65); |
6385 |
++ lpphy_papd_cal(dev, oldgains, 0, 1, 65); |
6386 |
+ |
6387 |
+ if (old_afe_ovr) |
6388 |
+ lpphy_set_tx_gains(dev, oldgains); |
6389 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
6390 |
+index 35301237d435..ded629460fc0 100644 |
6391 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
6392 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
6393 |
+@@ -3474,6 +3474,8 @@ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e, |
6394 |
+ } |
6395 |
+ |
6396 |
+ netinfo = brcmf_get_netinfo_array(pfn_result); |
6397 |
++ if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN) |
6398 |
++ netinfo->SSID_len = IEEE80211_MAX_SSID_LEN; |
6399 |
+ memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len); |
6400 |
+ cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len; |
6401 |
+ cfg->wowl.nd->n_channels = 1; |
6402 |
+@@ -5374,6 +5376,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, |
6403 |
+ conn_info->req_ie = |
6404 |
+ kmemdup(cfg->extra_buf, conn_info->req_ie_len, |
6405 |
+ GFP_KERNEL); |
6406 |
++ if (!conn_info->req_ie) |
6407 |
++ conn_info->req_ie_len = 0; |
6408 |
+ } else { |
6409 |
+ conn_info->req_ie_len = 0; |
6410 |
+ conn_info->req_ie = NULL; |
6411 |
+@@ -5390,6 +5394,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, |
6412 |
+ conn_info->resp_ie = |
6413 |
+ kmemdup(cfg->extra_buf, conn_info->resp_ie_len, |
6414 |
+ GFP_KERNEL); |
6415 |
++ if (!conn_info->resp_ie) |
6416 |
++ conn_info->resp_ie_len = 0; |
6417 |
+ } else { |
6418 |
+ conn_info->resp_ie_len = 0; |
6419 |
+ conn_info->resp_ie = NULL; |
6420 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
6421 |
+index 860a4372cb56..36a04c1144e5 100644 |
6422 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
6423 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
6424 |
+@@ -464,7 +464,8 @@ void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event) |
6425 |
+ } else { |
6426 |
+ /* Process special event packets */ |
6427 |
+ if (handle_event) |
6428 |
+- brcmf_fweh_process_skb(ifp->drvr, skb); |
6429 |
++ brcmf_fweh_process_skb(ifp->drvr, skb, |
6430 |
++ BCMILCP_SUBTYPE_VENDOR_LONG); |
6431 |
+ |
6432 |
+ brcmf_netif_rx(ifp, skb); |
6433 |
+ } |
6434 |
+@@ -481,7 +482,7 @@ void brcmf_rx_event(struct device *dev, struct sk_buff *skb) |
6435 |
+ if (brcmf_rx_hdrpull(drvr, skb, &ifp)) |
6436 |
+ return; |
6437 |
+ |
6438 |
+- brcmf_fweh_process_skb(ifp->drvr, skb); |
6439 |
++ brcmf_fweh_process_skb(ifp->drvr, skb, 0); |
6440 |
+ brcmu_pkt_buf_free_skb(skb); |
6441 |
+ } |
6442 |
+ |
6443 |
+@@ -783,17 +784,17 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
6444 |
+ bool rtnl_locked) |
6445 |
+ { |
6446 |
+ struct brcmf_if *ifp; |
6447 |
++ int ifidx; |
6448 |
+ |
6449 |
+ ifp = drvr->iflist[bsscfgidx]; |
6450 |
+- drvr->iflist[bsscfgidx] = NULL; |
6451 |
+ if (!ifp) { |
6452 |
+ brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx); |
6453 |
+ return; |
6454 |
+ } |
6455 |
+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, |
6456 |
+ ifp->ifidx); |
6457 |
+- if (drvr->if2bss[ifp->ifidx] == bsscfgidx) |
6458 |
+- drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID; |
6459 |
++ ifidx = ifp->ifidx; |
6460 |
++ |
6461 |
+ if (ifp->ndev) { |
6462 |
+ if (bsscfgidx == 0) { |
6463 |
+ if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { |
6464 |
+@@ -821,6 +822,10 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
6465 |
+ brcmf_p2p_ifp_removed(ifp, rtnl_locked); |
6466 |
+ kfree(ifp); |
6467 |
+ } |
6468 |
++ |
6469 |
++ drvr->iflist[bsscfgidx] = NULL; |
6470 |
++ if (drvr->if2bss[ifidx] == bsscfgidx) |
6471 |
++ drvr->if2bss[ifidx] = BRCMF_BSSIDX_INVALID; |
6472 |
+ } |
6473 |
+ |
6474 |
+ void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked) |
6475 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h |
6476 |
+index 816f80ea925b..ebd66fe0d949 100644 |
6477 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h |
6478 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h |
6479 |
+@@ -211,7 +211,7 @@ enum brcmf_fweh_event_code { |
6480 |
+ */ |
6481 |
+ #define BRCM_OUI "\x00\x10\x18" |
6482 |
+ #define BCMILCP_BCM_SUBTYPE_EVENT 1 |
6483 |
+- |
6484 |
++#define BCMILCP_SUBTYPE_VENDOR_LONG 32769 |
6485 |
+ |
6486 |
+ /** |
6487 |
+ * struct brcm_ethhdr - broadcom specific ether header. |
6488 |
+@@ -334,10 +334,10 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr, |
6489 |
+ void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing); |
6490 |
+ |
6491 |
+ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, |
6492 |
+- struct sk_buff *skb) |
6493 |
++ struct sk_buff *skb, u16 stype) |
6494 |
+ { |
6495 |
+ struct brcmf_event *event_packet; |
6496 |
+- u16 usr_stype; |
6497 |
++ u16 subtype, usr_stype; |
6498 |
+ |
6499 |
+ /* only process events when protocol matches */ |
6500 |
+ if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL)) |
6501 |
+@@ -346,8 +346,16 @@ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, |
6502 |
+ if ((skb->len + ETH_HLEN) < sizeof(*event_packet)) |
6503 |
+ return; |
6504 |
+ |
6505 |
+- /* check for BRCM oui match */ |
6506 |
+ event_packet = (struct brcmf_event *)skb_mac_header(skb); |
6507 |
++ |
6508 |
++ /* check subtype if needed */ |
6509 |
++ if (unlikely(stype)) { |
6510 |
++ subtype = get_unaligned_be16(&event_packet->hdr.subtype); |
6511 |
++ if (subtype != stype) |
6512 |
++ return; |
6513 |
++ } |
6514 |
++ |
6515 |
++ /* check for BRCM oui match */ |
6516 |
+ if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0], |
6517 |
+ sizeof(event_packet->hdr.oui))) |
6518 |
+ return; |
6519 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
6520 |
+index 02759ebd207c..d439079193f8 100644 |
6521 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
6522 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
6523 |
+@@ -580,24 +580,6 @@ static bool brcmf_fws_ifidx_match(struct sk_buff *skb, void *arg) |
6524 |
+ return ifidx == *(int *)arg; |
6525 |
+ } |
6526 |
+ |
6527 |
+-static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
6528 |
+- int ifidx) |
6529 |
+-{ |
6530 |
+- bool (*matchfn)(struct sk_buff *, void *) = NULL; |
6531 |
+- struct sk_buff *skb; |
6532 |
+- int prec; |
6533 |
+- |
6534 |
+- if (ifidx != -1) |
6535 |
+- matchfn = brcmf_fws_ifidx_match; |
6536 |
+- for (prec = 0; prec < q->num_prec; prec++) { |
6537 |
+- skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
6538 |
+- while (skb) { |
6539 |
+- brcmu_pkt_buf_free_skb(skb); |
6540 |
+- skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
6541 |
+- } |
6542 |
+- } |
6543 |
+-} |
6544 |
+- |
6545 |
+ static void brcmf_fws_hanger_init(struct brcmf_fws_hanger *hanger) |
6546 |
+ { |
6547 |
+ int i; |
6548 |
+@@ -669,6 +651,28 @@ static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h, |
6549 |
+ return 0; |
6550 |
+ } |
6551 |
+ |
6552 |
++static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
6553 |
++ int ifidx) |
6554 |
++{ |
6555 |
++ bool (*matchfn)(struct sk_buff *, void *) = NULL; |
6556 |
++ struct sk_buff *skb; |
6557 |
++ int prec; |
6558 |
++ u32 hslot; |
6559 |
++ |
6560 |
++ if (ifidx != -1) |
6561 |
++ matchfn = brcmf_fws_ifidx_match; |
6562 |
++ for (prec = 0; prec < q->num_prec; prec++) { |
6563 |
++ skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
6564 |
++ while (skb) { |
6565 |
++ hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
6566 |
++ brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, |
6567 |
++ true); |
6568 |
++ brcmu_pkt_buf_free_skb(skb); |
6569 |
++ skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
6570 |
++ } |
6571 |
++ } |
6572 |
++} |
6573 |
++ |
6574 |
+ static int brcmf_fws_hanger_mark_suppressed(struct brcmf_fws_hanger *h, |
6575 |
+ u32 slot_id) |
6576 |
+ { |
6577 |
+@@ -2194,6 +2198,8 @@ void brcmf_fws_del_interface(struct brcmf_if *ifp) |
6578 |
+ brcmf_fws_lock(fws); |
6579 |
+ ifp->fws_desc = NULL; |
6580 |
+ brcmf_dbg(TRACE, "deleting %s\n", entry->name); |
6581 |
++ brcmf_fws_macdesc_cleanup(fws, &fws->desc.iface[ifp->ifidx], |
6582 |
++ ifp->ifidx); |
6583 |
+ brcmf_fws_macdesc_deinit(entry); |
6584 |
+ brcmf_fws_cleanup(fws, ifp->ifidx); |
6585 |
+ brcmf_fws_unlock(fws); |
6586 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
6587 |
+index 4e8397a0cbc8..ee922b052561 100644 |
6588 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
6589 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
6590 |
+@@ -1116,7 +1116,7 @@ static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf) |
6591 |
+ |
6592 |
+ skb->protocol = eth_type_trans(skb, ifp->ndev); |
6593 |
+ |
6594 |
+- brcmf_fweh_process_skb(ifp->drvr, skb); |
6595 |
++ brcmf_fweh_process_skb(ifp->drvr, skb, 0); |
6596 |
+ |
6597 |
+ exit: |
6598 |
+ brcmu_pkt_buf_free_skb(skb); |
6599 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
6600 |
+index a4308c6e72d7..44ead0fea7c6 100644 |
6601 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
6602 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
6603 |
+@@ -160,7 +160,7 @@ struct brcmf_usbdev_info { |
6604 |
+ |
6605 |
+ struct usb_device *usbdev; |
6606 |
+ struct device *dev; |
6607 |
+- struct mutex dev_init_lock; |
6608 |
++ struct completion dev_init_done; |
6609 |
+ |
6610 |
+ int ctl_in_pipe, ctl_out_pipe; |
6611 |
+ struct urb *ctl_urb; /* URB for control endpoint */ |
6612 |
+@@ -684,12 +684,18 @@ static int brcmf_usb_up(struct device *dev) |
6613 |
+ |
6614 |
+ static void brcmf_cancel_all_urbs(struct brcmf_usbdev_info *devinfo) |
6615 |
+ { |
6616 |
++ int i; |
6617 |
++ |
6618 |
+ if (devinfo->ctl_urb) |
6619 |
+ usb_kill_urb(devinfo->ctl_urb); |
6620 |
+ if (devinfo->bulk_urb) |
6621 |
+ usb_kill_urb(devinfo->bulk_urb); |
6622 |
+- brcmf_usb_free_q(&devinfo->tx_postq, true); |
6623 |
+- brcmf_usb_free_q(&devinfo->rx_postq, true); |
6624 |
++ if (devinfo->tx_reqs) |
6625 |
++ for (i = 0; i < devinfo->bus_pub.ntxq; i++) |
6626 |
++ usb_kill_urb(devinfo->tx_reqs[i].urb); |
6627 |
++ if (devinfo->rx_reqs) |
6628 |
++ for (i = 0; i < devinfo->bus_pub.nrxq; i++) |
6629 |
++ usb_kill_urb(devinfo->rx_reqs[i].urb); |
6630 |
+ } |
6631 |
+ |
6632 |
+ static void brcmf_usb_down(struct device *dev) |
6633 |
+@@ -1195,11 +1201,11 @@ static void brcmf_usb_probe_phase2(struct device *dev, int ret, |
6634 |
+ if (ret) |
6635 |
+ goto error; |
6636 |
+ |
6637 |
+- mutex_unlock(&devinfo->dev_init_lock); |
6638 |
++ complete(&devinfo->dev_init_done); |
6639 |
+ return; |
6640 |
+ error: |
6641 |
+ brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret); |
6642 |
+- mutex_unlock(&devinfo->dev_init_lock); |
6643 |
++ complete(&devinfo->dev_init_done); |
6644 |
+ device_release_driver(dev); |
6645 |
+ } |
6646 |
+ |
6647 |
+@@ -1267,7 +1273,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) |
6648 |
+ if (ret) |
6649 |
+ goto fail; |
6650 |
+ /* we are done */ |
6651 |
+- mutex_unlock(&devinfo->dev_init_lock); |
6652 |
++ complete(&devinfo->dev_init_done); |
6653 |
+ return 0; |
6654 |
+ } |
6655 |
+ bus->chip = bus_pub->devid; |
6656 |
+@@ -1327,11 +1333,10 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
6657 |
+ |
6658 |
+ devinfo->usbdev = usb; |
6659 |
+ devinfo->dev = &usb->dev; |
6660 |
+- /* Take an init lock, to protect for disconnect while still loading. |
6661 |
++ /* Init completion, to protect for disconnect while still loading. |
6662 |
+ * Necessary because of the asynchronous firmware load construction |
6663 |
+ */ |
6664 |
+- mutex_init(&devinfo->dev_init_lock); |
6665 |
+- mutex_lock(&devinfo->dev_init_lock); |
6666 |
++ init_completion(&devinfo->dev_init_done); |
6667 |
+ |
6668 |
+ usb_set_intfdata(intf, devinfo); |
6669 |
+ |
6670 |
+@@ -1409,7 +1414,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
6671 |
+ return 0; |
6672 |
+ |
6673 |
+ fail: |
6674 |
+- mutex_unlock(&devinfo->dev_init_lock); |
6675 |
++ complete(&devinfo->dev_init_done); |
6676 |
+ kfree(devinfo); |
6677 |
+ usb_set_intfdata(intf, NULL); |
6678 |
+ return ret; |
6679 |
+@@ -1424,7 +1429,7 @@ brcmf_usb_disconnect(struct usb_interface *intf) |
6680 |
+ devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf); |
6681 |
+ |
6682 |
+ if (devinfo) { |
6683 |
+- mutex_lock(&devinfo->dev_init_lock); |
6684 |
++ wait_for_completion(&devinfo->dev_init_done); |
6685 |
+ /* Make sure that devinfo still exists. Firmware probe routines |
6686 |
+ * may have released the device and cleared the intfdata. |
6687 |
+ */ |
6688 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
6689 |
+index 8eff2753abad..d493021f6031 100644 |
6690 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
6691 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
6692 |
+@@ -35,9 +35,10 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, |
6693 |
+ struct brcmf_if *ifp; |
6694 |
+ const struct brcmf_vndr_dcmd_hdr *cmdhdr = data; |
6695 |
+ struct sk_buff *reply; |
6696 |
+- int ret, payload, ret_len; |
6697 |
++ unsigned int payload, ret_len; |
6698 |
+ void *dcmd_buf = NULL, *wr_pointer; |
6699 |
+ u16 msglen, maxmsglen = PAGE_SIZE - 0x100; |
6700 |
++ int ret; |
6701 |
+ |
6702 |
+ if (len < sizeof(*cmdhdr)) { |
6703 |
+ brcmf_err("vendor command too short: %d\n", len); |
6704 |
+@@ -65,7 +66,7 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, |
6705 |
+ brcmf_err("oversize return buffer %d\n", ret_len); |
6706 |
+ ret_len = BRCMF_DCMD_MAXLEN; |
6707 |
+ } |
6708 |
+- payload = max(ret_len, len) + 1; |
6709 |
++ payload = max_t(unsigned int, ret_len, len) + 1; |
6710 |
+ dcmd_buf = vzalloc(payload); |
6711 |
+ if (NULL == dcmd_buf) |
6712 |
+ return -ENOMEM; |
6713 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
6714 |
+index c596c7b13504..4354c0fedda7 100644 |
6715 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
6716 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
6717 |
+@@ -1384,10 +1384,15 @@ out_err: |
6718 |
+ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue) |
6719 |
+ { |
6720 |
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
6721 |
+- struct iwl_rxq *rxq = &trans_pcie->rxq[queue]; |
6722 |
++ struct iwl_rxq *rxq; |
6723 |
+ u32 r, i, count = 0; |
6724 |
+ bool emergency = false; |
6725 |
+ |
6726 |
++ if (WARN_ON_ONCE(!trans_pcie->rxq || !trans_pcie->rxq[queue].bd)) |
6727 |
++ return; |
6728 |
++ |
6729 |
++ rxq = &trans_pcie->rxq[queue]; |
6730 |
++ |
6731 |
+ restart: |
6732 |
+ spin_lock(&rxq->lock); |
6733 |
+ /* uCode's read index (stored in shared DRAM) indicates the last Rx |
6734 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
6735 |
+index 883752f640b4..4bc25dc5dc1d 100644 |
6736 |
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
6737 |
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
6738 |
+@@ -4073,16 +4073,20 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, |
6739 |
+ |
6740 |
+ if (mwifiex_send_cmd(priv, 0, 0, 0, hostcmd, true)) { |
6741 |
+ dev_err(priv->adapter->dev, "Failed to process hostcmd\n"); |
6742 |
++ kfree(hostcmd); |
6743 |
+ return -EFAULT; |
6744 |
+ } |
6745 |
+ |
6746 |
+ /* process hostcmd response*/ |
6747 |
+ skb = cfg80211_testmode_alloc_reply_skb(wiphy, hostcmd->len); |
6748 |
+- if (!skb) |
6749 |
++ if (!skb) { |
6750 |
++ kfree(hostcmd); |
6751 |
+ return -ENOMEM; |
6752 |
++ } |
6753 |
+ err = nla_put(skb, MWIFIEX_TM_ATTR_DATA, |
6754 |
+ hostcmd->len, hostcmd->cmd); |
6755 |
+ if (err) { |
6756 |
++ kfree(hostcmd); |
6757 |
+ kfree_skb(skb); |
6758 |
+ return -EMSGSIZE; |
6759 |
+ } |
6760 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wireless/marvell/mwifiex/cfp.c |
6761 |
+index bfe84e55df77..f1522fb1c1e8 100644 |
6762 |
+--- a/drivers/net/wireless/marvell/mwifiex/cfp.c |
6763 |
++++ b/drivers/net/wireless/marvell/mwifiex/cfp.c |
6764 |
+@@ -531,5 +531,8 @@ u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv, |
6765 |
+ rate_index = (rx_rate > MWIFIEX_RATE_INDEX_OFDM0) ? |
6766 |
+ rx_rate - 1 : rx_rate; |
6767 |
+ |
6768 |
++ if (rate_index >= MWIFIEX_MAX_AC_RX_RATES) |
6769 |
++ rate_index = MWIFIEX_MAX_AC_RX_RATES - 1; |
6770 |
++ |
6771 |
+ return rate_index; |
6772 |
+ } |
6773 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c |
6774 |
+index ef9b502ce576..a3189294ecb8 100644 |
6775 |
+--- a/drivers/net/wireless/realtek/rtlwifi/base.c |
6776 |
++++ b/drivers/net/wireless/realtek/rtlwifi/base.c |
6777 |
+@@ -469,6 +469,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) |
6778 |
+ /* <2> work queue */ |
6779 |
+ rtlpriv->works.hw = hw; |
6780 |
+ rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
6781 |
++ if (unlikely(!rtlpriv->works.rtl_wq)) { |
6782 |
++ pr_err("Failed to allocate work queue\n"); |
6783 |
++ return; |
6784 |
++ } |
6785 |
++ |
6786 |
+ INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
6787 |
+ (void *)rtl_watchdog_wq_callback); |
6788 |
+ INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, |
6789 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c |
6790 |
+index 63874512598b..b5f91c994c79 100644 |
6791 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c |
6792 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c |
6793 |
+@@ -622,6 +622,8 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
6794 |
+ u1rsvdpageloc, 3); |
6795 |
+ |
6796 |
+ skb = dev_alloc_skb(totalpacketlen); |
6797 |
++ if (!skb) |
6798 |
++ return; |
6799 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
6800 |
+ |
6801 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
6802 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |
6803 |
+index f3bff66e85d0..81ec0e6e07c1 100644 |
6804 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |
6805 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |
6806 |
+@@ -646,6 +646,8 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, |
6807 |
+ |
6808 |
+ |
6809 |
+ skb = dev_alloc_skb(totalpacketlen); |
6810 |
++ if (!skb) |
6811 |
++ return; |
6812 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
6813 |
+ |
6814 |
+ if (cmd_send_packet) |
6815 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c |
6816 |
+index 84a0d0eb72e1..a933490928ba 100644 |
6817 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c |
6818 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c |
6819 |
+@@ -766,6 +766,8 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
6820 |
+ u1rsvdpageloc, 3); |
6821 |
+ |
6822 |
+ skb = dev_alloc_skb(totalpacketlen); |
6823 |
++ if (!skb) |
6824 |
++ return; |
6825 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
6826 |
+ |
6827 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
6828 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c |
6829 |
+index bf9859f74b6f..52f108744e96 100644 |
6830 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c |
6831 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c |
6832 |
+@@ -470,6 +470,8 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
6833 |
+ u1rsvdpageloc, 3); |
6834 |
+ |
6835 |
+ skb = dev_alloc_skb(totalpacketlen); |
6836 |
++ if (!skb) |
6837 |
++ return; |
6838 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
6839 |
+ |
6840 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
6841 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c |
6842 |
+index f2441fbb92f1..307c2bd77f06 100644 |
6843 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c |
6844 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c |
6845 |
+@@ -584,6 +584,8 @@ void rtl8723be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, |
6846 |
+ u1rsvdpageloc, sizeof(u1rsvdpageloc)); |
6847 |
+ |
6848 |
+ skb = dev_alloc_skb(totalpacketlen); |
6849 |
++ if (!skb) |
6850 |
++ return; |
6851 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
6852 |
+ |
6853 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
6854 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c |
6855 |
+index d868a034659f..d7235f6165fd 100644 |
6856 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c |
6857 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c |
6858 |
+@@ -1645,6 +1645,8 @@ out: |
6859 |
+ &reserved_page_packet_8812[0], totalpacketlen); |
6860 |
+ |
6861 |
+ skb = dev_alloc_skb(totalpacketlen); |
6862 |
++ if (!skb) |
6863 |
++ return; |
6864 |
+ skb_put_data(skb, &reserved_page_packet_8812, totalpacketlen); |
6865 |
+ |
6866 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
6867 |
+@@ -1781,6 +1783,8 @@ out: |
6868 |
+ &reserved_page_packet_8821[0], totalpacketlen); |
6869 |
+ |
6870 |
+ skb = dev_alloc_skb(totalpacketlen); |
6871 |
++ if (!skb) |
6872 |
++ return; |
6873 |
+ skb_put_data(skb, &reserved_page_packet_8821, totalpacketlen); |
6874 |
+ |
6875 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
6876 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
6877 |
+index e56fc83faf0e..2f604e8bc991 100644 |
6878 |
+--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
6879 |
++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
6880 |
+@@ -188,27 +188,27 @@ bool rsi_is_cipher_wep(struct rsi_common *common) |
6881 |
+ * @adapter: Pointer to the adapter structure. |
6882 |
+ * @band: Operating band to be set. |
6883 |
+ * |
6884 |
+- * Return: None. |
6885 |
++ * Return: int - 0 on success, negative error on failure. |
6886 |
+ */ |
6887 |
+-static void rsi_register_rates_channels(struct rsi_hw *adapter, int band) |
6888 |
++static int rsi_register_rates_channels(struct rsi_hw *adapter, int band) |
6889 |
+ { |
6890 |
+ struct ieee80211_supported_band *sbands = &adapter->sbands[band]; |
6891 |
+ void *channels = NULL; |
6892 |
+ |
6893 |
+ if (band == NL80211_BAND_2GHZ) { |
6894 |
+- channels = kmalloc(sizeof(rsi_2ghz_channels), GFP_KERNEL); |
6895 |
+- memcpy(channels, |
6896 |
+- rsi_2ghz_channels, |
6897 |
+- sizeof(rsi_2ghz_channels)); |
6898 |
++ channels = kmemdup(rsi_2ghz_channels, sizeof(rsi_2ghz_channels), |
6899 |
++ GFP_KERNEL); |
6900 |
++ if (!channels) |
6901 |
++ return -ENOMEM; |
6902 |
+ sbands->band = NL80211_BAND_2GHZ; |
6903 |
+ sbands->n_channels = ARRAY_SIZE(rsi_2ghz_channels); |
6904 |
+ sbands->bitrates = rsi_rates; |
6905 |
+ sbands->n_bitrates = ARRAY_SIZE(rsi_rates); |
6906 |
+ } else { |
6907 |
+- channels = kmalloc(sizeof(rsi_5ghz_channels), GFP_KERNEL); |
6908 |
+- memcpy(channels, |
6909 |
+- rsi_5ghz_channels, |
6910 |
+- sizeof(rsi_5ghz_channels)); |
6911 |
++ channels = kmemdup(rsi_5ghz_channels, sizeof(rsi_5ghz_channels), |
6912 |
++ GFP_KERNEL); |
6913 |
++ if (!channels) |
6914 |
++ return -ENOMEM; |
6915 |
+ sbands->band = NL80211_BAND_5GHZ; |
6916 |
+ sbands->n_channels = ARRAY_SIZE(rsi_5ghz_channels); |
6917 |
+ sbands->bitrates = &rsi_rates[4]; |
6918 |
+@@ -227,6 +227,7 @@ static void rsi_register_rates_channels(struct rsi_hw *adapter, int band) |
6919 |
+ sbands->ht_cap.mcs.rx_mask[0] = 0xff; |
6920 |
+ sbands->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; |
6921 |
+ /* sbands->ht_cap.mcs.rx_highest = 0x82; */ |
6922 |
++ return 0; |
6923 |
+ } |
6924 |
+ |
6925 |
+ /** |
6926 |
+@@ -1985,11 +1986,16 @@ int rsi_mac80211_attach(struct rsi_common *common) |
6927 |
+ wiphy->available_antennas_rx = 1; |
6928 |
+ wiphy->available_antennas_tx = 1; |
6929 |
+ |
6930 |
+- rsi_register_rates_channels(adapter, NL80211_BAND_2GHZ); |
6931 |
++ status = rsi_register_rates_channels(adapter, NL80211_BAND_2GHZ); |
6932 |
++ if (status) |
6933 |
++ return status; |
6934 |
+ wiphy->bands[NL80211_BAND_2GHZ] = |
6935 |
+ &adapter->sbands[NL80211_BAND_2GHZ]; |
6936 |
+ if (common->num_supp_bands > 1) { |
6937 |
+- rsi_register_rates_channels(adapter, NL80211_BAND_5GHZ); |
6938 |
++ status = rsi_register_rates_channels(adapter, |
6939 |
++ NL80211_BAND_5GHZ); |
6940 |
++ if (status) |
6941 |
++ return status; |
6942 |
+ wiphy->bands[NL80211_BAND_5GHZ] = |
6943 |
+ &adapter->sbands[NL80211_BAND_5GHZ]; |
6944 |
+ } |
6945 |
+diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c |
6946 |
+index 90dc979f260b..c1608f0bf6d0 100644 |
6947 |
+--- a/drivers/net/wireless/st/cw1200/main.c |
6948 |
++++ b/drivers/net/wireless/st/cw1200/main.c |
6949 |
+@@ -345,6 +345,11 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
6950 |
+ mutex_init(&priv->wsm_cmd_mux); |
6951 |
+ mutex_init(&priv->conf_mutex); |
6952 |
+ priv->workqueue = create_singlethread_workqueue("cw1200_wq"); |
6953 |
++ if (!priv->workqueue) { |
6954 |
++ ieee80211_free_hw(hw); |
6955 |
++ return NULL; |
6956 |
++ } |
6957 |
++ |
6958 |
+ sema_init(&priv->scan.lock, 1); |
6959 |
+ INIT_WORK(&priv->scan.work, cw1200_scan_work); |
6960 |
+ INIT_DELAYED_WORK(&priv->scan.probe_work, cw1200_probe_work); |
6961 |
+diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c |
6962 |
+index 0279eb1da3ef..7733eb240564 100644 |
6963 |
+--- a/drivers/nvdimm/pmem.c |
6964 |
++++ b/drivers/nvdimm/pmem.c |
6965 |
+@@ -281,16 +281,22 @@ static long pmem_dax_direct_access(struct dax_device *dax_dev, |
6966 |
+ return __pmem_direct_access(pmem, pgoff, nr_pages, kaddr, pfn); |
6967 |
+ } |
6968 |
+ |
6969 |
++/* |
6970 |
++ * Use the 'no check' versions of copy_from_iter_flushcache() and |
6971 |
++ * copy_to_iter_mcsafe() to bypass HARDENED_USERCOPY overhead. Bounds |
6972 |
++ * checking, both file offset and device offset, is handled by |
6973 |
++ * dax_iomap_actor() |
6974 |
++ */ |
6975 |
+ static size_t pmem_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, |
6976 |
+ void *addr, size_t bytes, struct iov_iter *i) |
6977 |
+ { |
6978 |
+- return copy_from_iter_flushcache(addr, bytes, i); |
6979 |
++ return _copy_from_iter_flushcache(addr, bytes, i); |
6980 |
+ } |
6981 |
+ |
6982 |
+ static size_t pmem_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, |
6983 |
+ void *addr, size_t bytes, struct iov_iter *i) |
6984 |
+ { |
6985 |
+- return copy_to_iter_mcsafe(addr, bytes, i); |
6986 |
++ return _copy_to_iter_mcsafe(addr, bytes, i); |
6987 |
+ } |
6988 |
+ |
6989 |
+ static const struct dax_operations pmem_dax_ops = { |
6990 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
6991 |
+index 4c4413ad3ceb..5b389fed6d54 100644 |
6992 |
+--- a/drivers/nvme/host/core.c |
6993 |
++++ b/drivers/nvme/host/core.c |
6994 |
+@@ -1551,6 +1551,10 @@ static void nvme_update_disk_info(struct gendisk *disk, |
6995 |
+ sector_t capacity = le64_to_cpup(&id->nsze) << (ns->lba_shift - 9); |
6996 |
+ unsigned short bs = 1 << ns->lba_shift; |
6997 |
+ |
6998 |
++ if (ns->lba_shift > PAGE_SHIFT) { |
6999 |
++ /* unsupported block size, set capacity to 0 later */ |
7000 |
++ bs = (1 << 9); |
7001 |
++ } |
7002 |
+ blk_mq_freeze_queue(disk->queue); |
7003 |
+ blk_integrity_unregister(disk); |
7004 |
+ |
7005 |
+@@ -1561,7 +1565,8 @@ static void nvme_update_disk_info(struct gendisk *disk, |
7006 |
+ if (ns->ms && !ns->ext && |
7007 |
+ (ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) |
7008 |
+ nvme_init_integrity(disk, ns->ms, ns->pi_type); |
7009 |
+- if (ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk)) |
7010 |
++ if ((ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk)) || |
7011 |
++ ns->lba_shift > PAGE_SHIFT) |
7012 |
+ capacity = 0; |
7013 |
+ |
7014 |
+ set_capacity(disk, capacity); |
7015 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
7016 |
+index 52abc3a6de12..1b1645a77daf 100644 |
7017 |
+--- a/drivers/nvme/host/rdma.c |
7018 |
++++ b/drivers/nvme/host/rdma.c |
7019 |
+@@ -922,8 +922,9 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, |
7020 |
+ { |
7021 |
+ blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
7022 |
+ nvme_rdma_stop_queue(&ctrl->queues[0]); |
7023 |
+- blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, nvme_cancel_request, |
7024 |
+- &ctrl->ctrl); |
7025 |
++ if (ctrl->ctrl.admin_tagset) |
7026 |
++ blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset, |
7027 |
++ nvme_cancel_request, &ctrl->ctrl); |
7028 |
+ blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
7029 |
+ nvme_rdma_destroy_admin_queue(ctrl, remove); |
7030 |
+ } |
7031 |
+@@ -934,8 +935,9 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
7032 |
+ if (ctrl->ctrl.queue_count > 1) { |
7033 |
+ nvme_stop_queues(&ctrl->ctrl); |
7034 |
+ nvme_rdma_stop_io_queues(ctrl); |
7035 |
+- blk_mq_tagset_busy_iter(&ctrl->tag_set, nvme_cancel_request, |
7036 |
+- &ctrl->ctrl); |
7037 |
++ if (ctrl->ctrl.tagset) |
7038 |
++ blk_mq_tagset_busy_iter(ctrl->ctrl.tagset, |
7039 |
++ nvme_cancel_request, &ctrl->ctrl); |
7040 |
+ if (remove) |
7041 |
+ nvme_start_queues(&ctrl->ctrl); |
7042 |
+ nvme_rdma_destroy_io_queues(ctrl, remove); |
7043 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
7044 |
+index 5f0a00425242..e71b0058c57b 100644 |
7045 |
+--- a/drivers/nvme/host/tcp.c |
7046 |
++++ b/drivers/nvme/host/tcp.c |
7047 |
+@@ -1686,7 +1686,9 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, |
7048 |
+ { |
7049 |
+ blk_mq_quiesce_queue(ctrl->admin_q); |
7050 |
+ nvme_tcp_stop_queue(ctrl, 0); |
7051 |
+- blk_mq_tagset_busy_iter(ctrl->admin_tagset, nvme_cancel_request, ctrl); |
7052 |
++ if (ctrl->admin_tagset) |
7053 |
++ blk_mq_tagset_busy_iter(ctrl->admin_tagset, |
7054 |
++ nvme_cancel_request, ctrl); |
7055 |
+ blk_mq_unquiesce_queue(ctrl->admin_q); |
7056 |
+ nvme_tcp_destroy_admin_queue(ctrl, remove); |
7057 |
+ } |
7058 |
+@@ -1698,7 +1700,9 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
7059 |
+ return; |
7060 |
+ nvme_stop_queues(ctrl); |
7061 |
+ nvme_tcp_stop_io_queues(ctrl); |
7062 |
+- blk_mq_tagset_busy_iter(ctrl->tagset, nvme_cancel_request, ctrl); |
7063 |
++ if (ctrl->tagset) |
7064 |
++ blk_mq_tagset_busy_iter(ctrl->tagset, |
7065 |
++ nvme_cancel_request, ctrl); |
7066 |
+ if (remove) |
7067 |
+ nvme_start_queues(ctrl); |
7068 |
+ nvme_tcp_destroy_io_queues(ctrl, remove); |
7069 |
+diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c |
7070 |
+index 1bfeb160c5b1..14a541c453e5 100644 |
7071 |
+--- a/drivers/perf/arm-cci.c |
7072 |
++++ b/drivers/perf/arm-cci.c |
7073 |
+@@ -1692,21 +1692,24 @@ static int cci_pmu_probe(struct platform_device *pdev) |
7074 |
+ raw_spin_lock_init(&cci_pmu->hw_events.pmu_lock); |
7075 |
+ mutex_init(&cci_pmu->reserve_mutex); |
7076 |
+ atomic_set(&cci_pmu->active_events, 0); |
7077 |
+- cci_pmu->cpu = get_cpu(); |
7078 |
+- |
7079 |
+- ret = cci_pmu_init(cci_pmu, pdev); |
7080 |
+- if (ret) { |
7081 |
+- put_cpu(); |
7082 |
+- return ret; |
7083 |
+- } |
7084 |
+ |
7085 |
++ cci_pmu->cpu = raw_smp_processor_id(); |
7086 |
++ g_cci_pmu = cci_pmu; |
7087 |
+ cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, |
7088 |
+ "perf/arm/cci:online", NULL, |
7089 |
+ cci_pmu_offline_cpu); |
7090 |
+- put_cpu(); |
7091 |
+- g_cci_pmu = cci_pmu; |
7092 |
++ |
7093 |
++ ret = cci_pmu_init(cci_pmu, pdev); |
7094 |
++ if (ret) |
7095 |
++ goto error_pmu_init; |
7096 |
++ |
7097 |
+ pr_info("ARM %s PMU driver probed", cci_pmu->model->name); |
7098 |
+ return 0; |
7099 |
++ |
7100 |
++error_pmu_init: |
7101 |
++ cpuhp_remove_state(CPUHP_AP_PERF_ARM_CCI_ONLINE); |
7102 |
++ g_cci_pmu = NULL; |
7103 |
++ return ret; |
7104 |
+ } |
7105 |
+ |
7106 |
+ static int cci_pmu_remove(struct platform_device *pdev) |
7107 |
+diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c |
7108 |
+index 4bbd9ede38c8..cc5af961778d 100644 |
7109 |
+--- a/drivers/phy/allwinner/phy-sun4i-usb.c |
7110 |
++++ b/drivers/phy/allwinner/phy-sun4i-usb.c |
7111 |
+@@ -554,6 +554,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) |
7112 |
+ struct sun4i_usb_phy_data *data = |
7113 |
+ container_of(work, struct sun4i_usb_phy_data, detect.work); |
7114 |
+ struct phy *phy0 = data->phys[0].phy; |
7115 |
++ struct sun4i_usb_phy *phy = phy_get_drvdata(phy0); |
7116 |
+ bool force_session_end, id_notify = false, vbus_notify = false; |
7117 |
+ int id_det, vbus_det; |
7118 |
+ |
7119 |
+@@ -610,6 +611,9 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) |
7120 |
+ mutex_unlock(&phy0->mutex); |
7121 |
+ } |
7122 |
+ |
7123 |
++ /* Enable PHY0 passby for host mode only. */ |
7124 |
++ sun4i_usb_phy_passby(phy, !id_det); |
7125 |
++ |
7126 |
+ /* Re-route PHY0 if necessary */ |
7127 |
+ if (data->cfg->phy0_dual_route) |
7128 |
+ sun4i_usb_phy0_reroute(data, id_det); |
7129 |
+diff --git a/drivers/phy/motorola/Kconfig b/drivers/phy/motorola/Kconfig |
7130 |
+index 82651524ffb9..718f8729701d 100644 |
7131 |
+--- a/drivers/phy/motorola/Kconfig |
7132 |
++++ b/drivers/phy/motorola/Kconfig |
7133 |
+@@ -13,7 +13,7 @@ config PHY_CPCAP_USB |
7134 |
+ |
7135 |
+ config PHY_MAPPHONE_MDM6600 |
7136 |
+ tristate "Motorola Mapphone MDM6600 modem USB PHY driver" |
7137 |
+- depends on OF && USB_SUPPORT |
7138 |
++ depends on OF && USB_SUPPORT && GPIOLIB |
7139 |
+ select GENERIC_PHY |
7140 |
+ help |
7141 |
+ Enable this for MDM6600 USB modem to work on Motorola phones |
7142 |
+diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c |
7143 |
+index aa5f949ef219..5b0678f310e5 100644 |
7144 |
+--- a/drivers/pinctrl/pinctrl-pistachio.c |
7145 |
++++ b/drivers/pinctrl/pinctrl-pistachio.c |
7146 |
+@@ -1367,6 +1367,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
7147 |
+ if (!of_find_property(child, "gpio-controller", NULL)) { |
7148 |
+ dev_err(pctl->dev, |
7149 |
+ "No gpio-controller property for bank %u\n", i); |
7150 |
++ of_node_put(child); |
7151 |
+ ret = -ENODEV; |
7152 |
+ goto err; |
7153 |
+ } |
7154 |
+@@ -1374,6 +1375,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
7155 |
+ irq = irq_of_parse_and_map(child, 0); |
7156 |
+ if (irq < 0) { |
7157 |
+ dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq); |
7158 |
++ of_node_put(child); |
7159 |
+ ret = irq; |
7160 |
+ goto err; |
7161 |
+ } |
7162 |
+diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c |
7163 |
+index e66af93f2cbf..195b442a2343 100644 |
7164 |
+--- a/drivers/pinctrl/pinctrl-st.c |
7165 |
++++ b/drivers/pinctrl/pinctrl-st.c |
7166 |
+@@ -1170,7 +1170,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np, |
7167 |
+ struct property *pp; |
7168 |
+ struct st_pinconf *conf; |
7169 |
+ struct device_node *pins; |
7170 |
+- int i = 0, npins = 0, nr_props; |
7171 |
++ int i = 0, npins = 0, nr_props, ret = 0; |
7172 |
+ |
7173 |
+ pins = of_get_child_by_name(np, "st,pins"); |
7174 |
+ if (!pins) |
7175 |
+@@ -1185,7 +1185,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np, |
7176 |
+ npins++; |
7177 |
+ } else { |
7178 |
+ pr_warn("Invalid st,pins in %pOFn node\n", np); |
7179 |
+- return -EINVAL; |
7180 |
++ ret = -EINVAL; |
7181 |
++ goto out_put_node; |
7182 |
+ } |
7183 |
+ } |
7184 |
+ |
7185 |
+@@ -1195,8 +1196,10 @@ static int st_pctl_dt_parse_groups(struct device_node *np, |
7186 |
+ grp->pin_conf = devm_kcalloc(info->dev, |
7187 |
+ npins, sizeof(*conf), GFP_KERNEL); |
7188 |
+ |
7189 |
+- if (!grp->pins || !grp->pin_conf) |
7190 |
+- return -ENOMEM; |
7191 |
++ if (!grp->pins || !grp->pin_conf) { |
7192 |
++ ret = -ENOMEM; |
7193 |
++ goto out_put_node; |
7194 |
++ } |
7195 |
+ |
7196 |
+ /* <bank offset mux direction rt_type rt_delay rt_clk> */ |
7197 |
+ for_each_property_of_node(pins, pp) { |
7198 |
+@@ -1229,9 +1232,11 @@ static int st_pctl_dt_parse_groups(struct device_node *np, |
7199 |
+ } |
7200 |
+ i++; |
7201 |
+ } |
7202 |
++ |
7203 |
++out_put_node: |
7204 |
+ of_node_put(pins); |
7205 |
+ |
7206 |
+- return 0; |
7207 |
++ return ret; |
7208 |
+ } |
7209 |
+ |
7210 |
+ static int st_pctl_parse_functions(struct device_node *np, |
7211 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
7212 |
+index 44c6b753f692..85ddf49a5188 100644 |
7213 |
+--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
7214 |
++++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
7215 |
+@@ -71,6 +71,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, |
7216 |
+ } |
7217 |
+ |
7218 |
+ clk_base = of_iomap(np, 0); |
7219 |
++ of_node_put(np); |
7220 |
+ if (!clk_base) { |
7221 |
+ pr_err("%s: failed to map clock registers\n", __func__); |
7222 |
+ return ERR_PTR(-EINVAL); |
7223 |
+diff --git a/drivers/pinctrl/zte/pinctrl-zx.c b/drivers/pinctrl/zte/pinctrl-zx.c |
7224 |
+index caa44dd2880a..3cb69309912b 100644 |
7225 |
+--- a/drivers/pinctrl/zte/pinctrl-zx.c |
7226 |
++++ b/drivers/pinctrl/zte/pinctrl-zx.c |
7227 |
+@@ -411,6 +411,7 @@ int zx_pinctrl_init(struct platform_device *pdev, |
7228 |
+ } |
7229 |
+ |
7230 |
+ zpctl->aux_base = of_iomap(np, 0); |
7231 |
++ of_node_put(np); |
7232 |
+ if (!zpctl->aux_base) |
7233 |
+ return -ENOMEM; |
7234 |
+ |
7235 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
7236 |
+index fb9fe26fd0fa..218b9331475b 100644 |
7237 |
+--- a/drivers/regulator/core.c |
7238 |
++++ b/drivers/regulator/core.c |
7239 |
+@@ -5101,10 +5101,11 @@ void regulator_unregister(struct regulator_dev *rdev) |
7240 |
+ regulator_put(rdev->supply); |
7241 |
+ } |
7242 |
+ |
7243 |
++ flush_work(&rdev->disable_work.work); |
7244 |
++ |
7245 |
+ mutex_lock(®ulator_list_mutex); |
7246 |
+ |
7247 |
+ debugfs_remove_recursive(rdev->debugfs); |
7248 |
+- flush_work(&rdev->disable_work.work); |
7249 |
+ WARN_ON(rdev->open_count); |
7250 |
+ regulator_remove_coupling(rdev); |
7251 |
+ unset_regulator_supplies(rdev); |
7252 |
+diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c |
7253 |
+index 588c3d2445cf..acba42d5b57d 100644 |
7254 |
+--- a/drivers/regulator/da9055-regulator.c |
7255 |
++++ b/drivers/regulator/da9055-regulator.c |
7256 |
+@@ -515,8 +515,10 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data) |
7257 |
+ { |
7258 |
+ struct da9055_regulator *regulator = data; |
7259 |
+ |
7260 |
++ regulator_lock(regulator->rdev); |
7261 |
+ regulator_notifier_call_chain(regulator->rdev, |
7262 |
+ REGULATOR_EVENT_OVER_CURRENT, NULL); |
7263 |
++ regulator_unlock(regulator->rdev); |
7264 |
+ |
7265 |
+ return IRQ_HANDLED; |
7266 |
+ } |
7267 |
+diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c |
7268 |
+index 34a70d9dc450..5224304c10b3 100644 |
7269 |
+--- a/drivers/regulator/da9062-regulator.c |
7270 |
++++ b/drivers/regulator/da9062-regulator.c |
7271 |
+@@ -974,8 +974,10 @@ static irqreturn_t da9062_ldo_lim_event(int irq, void *data) |
7272 |
+ continue; |
7273 |
+ |
7274 |
+ if (BIT(regl->info->oc_event.lsb) & bits) { |
7275 |
++ regulator_lock(regl->rdev); |
7276 |
+ regulator_notifier_call_chain(regl->rdev, |
7277 |
+ REGULATOR_EVENT_OVER_CURRENT, NULL); |
7278 |
++ regulator_unlock(regl->rdev); |
7279 |
+ handled = IRQ_HANDLED; |
7280 |
+ } |
7281 |
+ } |
7282 |
+diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c |
7283 |
+index 8cbcd2a3eb20..d3ea73ab5920 100644 |
7284 |
+--- a/drivers/regulator/da9063-regulator.c |
7285 |
++++ b/drivers/regulator/da9063-regulator.c |
7286 |
+@@ -615,9 +615,12 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data) |
7287 |
+ if (regl->info->oc_event.reg != DA9063_REG_STATUS_D) |
7288 |
+ continue; |
7289 |
+ |
7290 |
+- if (BIT(regl->info->oc_event.lsb) & bits) |
7291 |
++ if (BIT(regl->info->oc_event.lsb) & bits) { |
7292 |
++ regulator_lock(regl->rdev); |
7293 |
+ regulator_notifier_call_chain(regl->rdev, |
7294 |
+ REGULATOR_EVENT_OVER_CURRENT, NULL); |
7295 |
++ regulator_unlock(regl->rdev); |
7296 |
++ } |
7297 |
+ } |
7298 |
+ |
7299 |
+ return IRQ_HANDLED; |
7300 |
+diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c |
7301 |
+index 109ee12d4362..4d7fe4819c1c 100644 |
7302 |
+--- a/drivers/regulator/da9211-regulator.c |
7303 |
++++ b/drivers/regulator/da9211-regulator.c |
7304 |
+@@ -322,8 +322,10 @@ static irqreturn_t da9211_irq_handler(int irq, void *data) |
7305 |
+ goto error_i2c; |
7306 |
+ |
7307 |
+ if (reg_val & DA9211_E_OV_CURR_A) { |
7308 |
++ regulator_lock(chip->rdev[0]); |
7309 |
+ regulator_notifier_call_chain(chip->rdev[0], |
7310 |
+ REGULATOR_EVENT_OVER_CURRENT, NULL); |
7311 |
++ regulator_unlock(chip->rdev[0]); |
7312 |
+ |
7313 |
+ err = regmap_write(chip->regmap, DA9211_REG_EVENT_B, |
7314 |
+ DA9211_E_OV_CURR_A); |
7315 |
+@@ -334,8 +336,10 @@ static irqreturn_t da9211_irq_handler(int irq, void *data) |
7316 |
+ } |
7317 |
+ |
7318 |
+ if (reg_val & DA9211_E_OV_CURR_B) { |
7319 |
++ regulator_lock(chip->rdev[1]); |
7320 |
+ regulator_notifier_call_chain(chip->rdev[1], |
7321 |
+ REGULATOR_EVENT_OVER_CURRENT, NULL); |
7322 |
++ regulator_unlock(chip->rdev[1]); |
7323 |
+ |
7324 |
+ err = regmap_write(chip->regmap, DA9211_REG_EVENT_B, |
7325 |
+ DA9211_E_OV_CURR_B); |
7326 |
+diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c |
7327 |
+index 244822bb63cd..d82d3077f3b8 100644 |
7328 |
+--- a/drivers/regulator/lp8755.c |
7329 |
++++ b/drivers/regulator/lp8755.c |
7330 |
+@@ -372,10 +372,13 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data) |
7331 |
+ for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) |
7332 |
+ if ((flag0 & (0x4 << icnt)) |
7333 |
+ && (pchip->irqmask & (0x04 << icnt)) |
7334 |
+- && (pchip->rdev[icnt] != NULL)) |
7335 |
++ && (pchip->rdev[icnt] != NULL)) { |
7336 |
++ regulator_lock(pchip->rdev[icnt]); |
7337 |
+ regulator_notifier_call_chain(pchip->rdev[icnt], |
7338 |
+ LP8755_EVENT_PWR_FAULT, |
7339 |
+ NULL); |
7340 |
++ regulator_unlock(pchip->rdev[icnt]); |
7341 |
++ } |
7342 |
+ |
7343 |
+ /* read flag1 register */ |
7344 |
+ ret = lp8755_read(pchip, 0x0E, &flag1); |
7345 |
+@@ -389,18 +392,24 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data) |
7346 |
+ /* send OCP event to all regualtor devices */ |
7347 |
+ if ((flag1 & 0x01) && (pchip->irqmask & 0x01)) |
7348 |
+ for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) |
7349 |
+- if (pchip->rdev[icnt] != NULL) |
7350 |
++ if (pchip->rdev[icnt] != NULL) { |
7351 |
++ regulator_lock(pchip->rdev[icnt]); |
7352 |
+ regulator_notifier_call_chain(pchip->rdev[icnt], |
7353 |
+ LP8755_EVENT_OCP, |
7354 |
+ NULL); |
7355 |
++ regulator_unlock(pchip->rdev[icnt]); |
7356 |
++ } |
7357 |
+ |
7358 |
+ /* send OVP event to all regualtor devices */ |
7359 |
+ if ((flag1 & 0x02) && (pchip->irqmask & 0x02)) |
7360 |
+ for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) |
7361 |
+- if (pchip->rdev[icnt] != NULL) |
7362 |
++ if (pchip->rdev[icnt] != NULL) { |
7363 |
++ regulator_lock(pchip->rdev[icnt]); |
7364 |
+ regulator_notifier_call_chain(pchip->rdev[icnt], |
7365 |
+ LP8755_EVENT_OVP, |
7366 |
+ NULL); |
7367 |
++ regulator_unlock(pchip->rdev[icnt]); |
7368 |
++ } |
7369 |
+ return IRQ_HANDLED; |
7370 |
+ |
7371 |
+ err_i2c: |
7372 |
+diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c |
7373 |
+index 63f724f260ef..75089b037b72 100644 |
7374 |
+--- a/drivers/regulator/ltc3589.c |
7375 |
++++ b/drivers/regulator/ltc3589.c |
7376 |
+@@ -419,16 +419,22 @@ static irqreturn_t ltc3589_isr(int irq, void *dev_id) |
7377 |
+ |
7378 |
+ if (irqstat & LTC3589_IRQSTAT_THERMAL_WARN) { |
7379 |
+ event = REGULATOR_EVENT_OVER_TEMP; |
7380 |
+- for (i = 0; i < LTC3589_NUM_REGULATORS; i++) |
7381 |
++ for (i = 0; i < LTC3589_NUM_REGULATORS; i++) { |
7382 |
++ regulator_lock(ltc3589->regulators[i]); |
7383 |
+ regulator_notifier_call_chain(ltc3589->regulators[i], |
7384 |
+ event, NULL); |
7385 |
++ regulator_unlock(ltc3589->regulators[i]); |
7386 |
++ } |
7387 |
+ } |
7388 |
+ |
7389 |
+ if (irqstat & LTC3589_IRQSTAT_UNDERVOLT_WARN) { |
7390 |
+ event = REGULATOR_EVENT_UNDER_VOLTAGE; |
7391 |
+- for (i = 0; i < LTC3589_NUM_REGULATORS; i++) |
7392 |
++ for (i = 0; i < LTC3589_NUM_REGULATORS; i++) { |
7393 |
++ regulator_lock(ltc3589->regulators[i]); |
7394 |
+ regulator_notifier_call_chain(ltc3589->regulators[i], |
7395 |
+ event, NULL); |
7396 |
++ regulator_unlock(ltc3589->regulators[i]); |
7397 |
++ } |
7398 |
+ } |
7399 |
+ |
7400 |
+ /* Clear warning condition */ |
7401 |
+diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c |
7402 |
+index 71fd0f2a4b76..cd0f11254c77 100644 |
7403 |
+--- a/drivers/regulator/ltc3676.c |
7404 |
++++ b/drivers/regulator/ltc3676.c |
7405 |
+@@ -338,17 +338,23 @@ static irqreturn_t ltc3676_isr(int irq, void *dev_id) |
7406 |
+ if (irqstat & LTC3676_IRQSTAT_THERMAL_WARN) { |
7407 |
+ dev_warn(dev, "Over-temperature Warning\n"); |
7408 |
+ event = REGULATOR_EVENT_OVER_TEMP; |
7409 |
+- for (i = 0; i < LTC3676_NUM_REGULATORS; i++) |
7410 |
++ for (i = 0; i < LTC3676_NUM_REGULATORS; i++) { |
7411 |
++ regulator_lock(ltc3676->regulators[i]); |
7412 |
+ regulator_notifier_call_chain(ltc3676->regulators[i], |
7413 |
+ event, NULL); |
7414 |
++ regulator_unlock(ltc3676->regulators[i]); |
7415 |
++ } |
7416 |
+ } |
7417 |
+ |
7418 |
+ if (irqstat & LTC3676_IRQSTAT_UNDERVOLT_WARN) { |
7419 |
+ dev_info(dev, "Undervoltage Warning\n"); |
7420 |
+ event = REGULATOR_EVENT_UNDER_VOLTAGE; |
7421 |
+- for (i = 0; i < LTC3676_NUM_REGULATORS; i++) |
7422 |
++ for (i = 0; i < LTC3676_NUM_REGULATORS; i++) { |
7423 |
++ regulator_lock(ltc3676->regulators[i]); |
7424 |
+ regulator_notifier_call_chain(ltc3676->regulators[i], |
7425 |
+ event, NULL); |
7426 |
++ regulator_unlock(ltc3676->regulators[i]); |
7427 |
++ } |
7428 |
+ } |
7429 |
+ |
7430 |
+ /* Clear warning condition */ |
7431 |
+diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c |
7432 |
+index a9446056435f..000c34914fe3 100644 |
7433 |
+--- a/drivers/regulator/pv88060-regulator.c |
7434 |
++++ b/drivers/regulator/pv88060-regulator.c |
7435 |
+@@ -276,9 +276,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data) |
7436 |
+ if (reg_val & PV88060_E_VDD_FLT) { |
7437 |
+ for (i = 0; i < PV88060_MAX_REGULATORS; i++) { |
7438 |
+ if (chip->rdev[i] != NULL) { |
7439 |
++ regulator_lock(chip->rdev[i]); |
7440 |
+ regulator_notifier_call_chain(chip->rdev[i], |
7441 |
+ REGULATOR_EVENT_UNDER_VOLTAGE, |
7442 |
+ NULL); |
7443 |
++ regulator_unlock(chip->rdev[i]); |
7444 |
+ } |
7445 |
+ } |
7446 |
+ |
7447 |
+@@ -293,9 +295,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data) |
7448 |
+ if (reg_val & PV88060_E_OVER_TEMP) { |
7449 |
+ for (i = 0; i < PV88060_MAX_REGULATORS; i++) { |
7450 |
+ if (chip->rdev[i] != NULL) { |
7451 |
++ regulator_lock(chip->rdev[i]); |
7452 |
+ regulator_notifier_call_chain(chip->rdev[i], |
7453 |
+ REGULATOR_EVENT_OVER_TEMP, |
7454 |
+ NULL); |
7455 |
++ regulator_unlock(chip->rdev[i]); |
7456 |
+ } |
7457 |
+ } |
7458 |
+ |
7459 |
+diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c |
7460 |
+index 9a08cb2de501..d99f1b9fa075 100644 |
7461 |
+--- a/drivers/regulator/pv88080-regulator.c |
7462 |
++++ b/drivers/regulator/pv88080-regulator.c |
7463 |
+@@ -384,9 +384,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data) |
7464 |
+ if (reg_val & PV88080_E_VDD_FLT) { |
7465 |
+ for (i = 0; i < PV88080_MAX_REGULATORS; i++) { |
7466 |
+ if (chip->rdev[i] != NULL) { |
7467 |
++ regulator_lock(chip->rdev[i]); |
7468 |
+ regulator_notifier_call_chain(chip->rdev[i], |
7469 |
+ REGULATOR_EVENT_UNDER_VOLTAGE, |
7470 |
+ NULL); |
7471 |
++ regulator_unlock(chip->rdev[i]); |
7472 |
+ } |
7473 |
+ } |
7474 |
+ |
7475 |
+@@ -401,9 +403,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data) |
7476 |
+ if (reg_val & PV88080_E_OVER_TEMP) { |
7477 |
+ for (i = 0; i < PV88080_MAX_REGULATORS; i++) { |
7478 |
+ if (chip->rdev[i] != NULL) { |
7479 |
++ regulator_lock(chip->rdev[i]); |
7480 |
+ regulator_notifier_call_chain(chip->rdev[i], |
7481 |
+ REGULATOR_EVENT_OVER_TEMP, |
7482 |
+ NULL); |
7483 |
++ regulator_unlock(chip->rdev[i]); |
7484 |
+ } |
7485 |
+ } |
7486 |
+ |
7487 |
+diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c |
7488 |
+index 7a0c15957bd0..b4ff646608f5 100644 |
7489 |
+--- a/drivers/regulator/pv88090-regulator.c |
7490 |
++++ b/drivers/regulator/pv88090-regulator.c |
7491 |
+@@ -274,9 +274,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) |
7492 |
+ if (reg_val & PV88090_E_VDD_FLT) { |
7493 |
+ for (i = 0; i < PV88090_MAX_REGULATORS; i++) { |
7494 |
+ if (chip->rdev[i] != NULL) { |
7495 |
++ regulator_lock(chip->rdev[i]); |
7496 |
+ regulator_notifier_call_chain(chip->rdev[i], |
7497 |
+ REGULATOR_EVENT_UNDER_VOLTAGE, |
7498 |
+ NULL); |
7499 |
++ regulator_unlock(chip->rdev[i]); |
7500 |
+ } |
7501 |
+ } |
7502 |
+ |
7503 |
+@@ -291,9 +293,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) |
7504 |
+ if (reg_val & PV88090_E_OVER_TEMP) { |
7505 |
+ for (i = 0; i < PV88090_MAX_REGULATORS; i++) { |
7506 |
+ if (chip->rdev[i] != NULL) { |
7507 |
++ regulator_lock(chip->rdev[i]); |
7508 |
+ regulator_notifier_call_chain(chip->rdev[i], |
7509 |
+ REGULATOR_EVENT_OVER_TEMP, |
7510 |
+ NULL); |
7511 |
++ regulator_unlock(chip->rdev[i]); |
7512 |
+ } |
7513 |
+ } |
7514 |
+ |
7515 |
+diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c |
7516 |
+index 5a5bc4bb08d2..4f5461ad7b62 100644 |
7517 |
+--- a/drivers/regulator/wm831x-dcdc.c |
7518 |
++++ b/drivers/regulator/wm831x-dcdc.c |
7519 |
+@@ -183,9 +183,11 @@ static irqreturn_t wm831x_dcdc_uv_irq(int irq, void *data) |
7520 |
+ { |
7521 |
+ struct wm831x_dcdc *dcdc = data; |
7522 |
+ |
7523 |
++ regulator_lock(dcdc->regulator); |
7524 |
+ regulator_notifier_call_chain(dcdc->regulator, |
7525 |
+ REGULATOR_EVENT_UNDER_VOLTAGE, |
7526 |
+ NULL); |
7527 |
++ regulator_unlock(dcdc->regulator); |
7528 |
+ |
7529 |
+ return IRQ_HANDLED; |
7530 |
+ } |
7531 |
+@@ -194,9 +196,11 @@ static irqreturn_t wm831x_dcdc_oc_irq(int irq, void *data) |
7532 |
+ { |
7533 |
+ struct wm831x_dcdc *dcdc = data; |
7534 |
+ |
7535 |
++ regulator_lock(dcdc->regulator); |
7536 |
+ regulator_notifier_call_chain(dcdc->regulator, |
7537 |
+ REGULATOR_EVENT_OVER_CURRENT, |
7538 |
+ NULL); |
7539 |
++ regulator_unlock(dcdc->regulator); |
7540 |
+ |
7541 |
+ return IRQ_HANDLED; |
7542 |
+ } |
7543 |
+diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c |
7544 |
+index 6dd891d7eee3..11f351191dba 100644 |
7545 |
+--- a/drivers/regulator/wm831x-isink.c |
7546 |
++++ b/drivers/regulator/wm831x-isink.c |
7547 |
+@@ -140,9 +140,11 @@ static irqreturn_t wm831x_isink_irq(int irq, void *data) |
7548 |
+ { |
7549 |
+ struct wm831x_isink *isink = data; |
7550 |
+ |
7551 |
++ regulator_lock(isink->regulator); |
7552 |
+ regulator_notifier_call_chain(isink->regulator, |
7553 |
+ REGULATOR_EVENT_OVER_CURRENT, |
7554 |
+ NULL); |
7555 |
++ regulator_unlock(isink->regulator); |
7556 |
+ |
7557 |
+ return IRQ_HANDLED; |
7558 |
+ } |
7559 |
+diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c |
7560 |
+index e4a6f888484e..fcd038e7cd80 100644 |
7561 |
+--- a/drivers/regulator/wm831x-ldo.c |
7562 |
++++ b/drivers/regulator/wm831x-ldo.c |
7563 |
+@@ -51,9 +51,11 @@ static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data) |
7564 |
+ { |
7565 |
+ struct wm831x_ldo *ldo = data; |
7566 |
+ |
7567 |
++ regulator_lock(ldo->regulator); |
7568 |
+ regulator_notifier_call_chain(ldo->regulator, |
7569 |
+ REGULATOR_EVENT_UNDER_VOLTAGE, |
7570 |
+ NULL); |
7571 |
++ regulator_unlock(ldo->regulator); |
7572 |
+ |
7573 |
+ return IRQ_HANDLED; |
7574 |
+ } |
7575 |
+diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c |
7576 |
+index 01ffc0ef8033..fbcf13bbbd8d 100644 |
7577 |
+--- a/drivers/rtc/rtc-88pm860x.c |
7578 |
++++ b/drivers/rtc/rtc-88pm860x.c |
7579 |
+@@ -414,7 +414,7 @@ static int pm860x_rtc_remove(struct platform_device *pdev) |
7580 |
+ struct pm860x_rtc_info *info = platform_get_drvdata(pdev); |
7581 |
+ |
7582 |
+ #ifdef VRTC_CALIBRATION |
7583 |
+- flush_scheduled_work(); |
7584 |
++ cancel_delayed_work_sync(&info->calib_work); |
7585 |
+ /* disable measurement */ |
7586 |
+ pm860x_set_bits(info->i2c, PM8607_MEAS_EN2, MEAS2_VRTC, 0); |
7587 |
+ #endif /* VRTC_CALIBRATION */ |
7588 |
+diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c |
7589 |
+index c5908cfea234..8e6c9b3bcc29 100644 |
7590 |
+--- a/drivers/rtc/rtc-stm32.c |
7591 |
++++ b/drivers/rtc/rtc-stm32.c |
7592 |
+@@ -788,11 +788,14 @@ static int stm32_rtc_probe(struct platform_device *pdev) |
7593 |
+ ret = device_init_wakeup(&pdev->dev, true); |
7594 |
+ if (rtc->data->has_wakeirq) { |
7595 |
+ rtc->wakeirq_alarm = platform_get_irq(pdev, 1); |
7596 |
+- if (rtc->wakeirq_alarm <= 0) |
7597 |
+- ret = rtc->wakeirq_alarm; |
7598 |
+- else |
7599 |
++ if (rtc->wakeirq_alarm > 0) { |
7600 |
+ ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, |
7601 |
+ rtc->wakeirq_alarm); |
7602 |
++ } else { |
7603 |
++ ret = rtc->wakeirq_alarm; |
7604 |
++ if (rtc->wakeirq_alarm == -EPROBE_DEFER) |
7605 |
++ goto err; |
7606 |
++ } |
7607 |
+ } |
7608 |
+ if (ret) |
7609 |
+ dev_warn(&pdev->dev, "alarm can't wake up the system: %d", ret); |
7610 |
+diff --git a/drivers/rtc/rtc-xgene.c b/drivers/rtc/rtc-xgene.c |
7611 |
+index 153820876a82..2f741f455c30 100644 |
7612 |
+--- a/drivers/rtc/rtc-xgene.c |
7613 |
++++ b/drivers/rtc/rtc-xgene.c |
7614 |
+@@ -168,6 +168,10 @@ static int xgene_rtc_probe(struct platform_device *pdev) |
7615 |
+ if (IS_ERR(pdata->csr_base)) |
7616 |
+ return PTR_ERR(pdata->csr_base); |
7617 |
+ |
7618 |
++ pdata->rtc = devm_rtc_allocate_device(&pdev->dev); |
7619 |
++ if (IS_ERR(pdata->rtc)) |
7620 |
++ return PTR_ERR(pdata->rtc); |
7621 |
++ |
7622 |
+ irq = platform_get_irq(pdev, 0); |
7623 |
+ if (irq < 0) { |
7624 |
+ dev_err(&pdev->dev, "No IRQ resource\n"); |
7625 |
+@@ -198,15 +202,15 @@ static int xgene_rtc_probe(struct platform_device *pdev) |
7626 |
+ return ret; |
7627 |
+ } |
7628 |
+ |
7629 |
+- pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
7630 |
+- &xgene_rtc_ops, THIS_MODULE); |
7631 |
+- if (IS_ERR(pdata->rtc)) { |
7632 |
+- clk_disable_unprepare(pdata->clk); |
7633 |
+- return PTR_ERR(pdata->rtc); |
7634 |
+- } |
7635 |
+- |
7636 |
+ /* HW does not support update faster than 1 seconds */ |
7637 |
+ pdata->rtc->uie_unsupported = 1; |
7638 |
++ pdata->rtc->ops = &xgene_rtc_ops; |
7639 |
++ |
7640 |
++ ret = rtc_register_device(pdata->rtc); |
7641 |
++ if (ret) { |
7642 |
++ clk_disable_unprepare(pdata->clk); |
7643 |
++ return ret; |
7644 |
++ } |
7645 |
+ |
7646 |
+ return 0; |
7647 |
+ } |
7648 |
+diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h |
7649 |
+index 9811fd8a0c73..92eabbb5f18d 100644 |
7650 |
+--- a/drivers/s390/cio/cio.h |
7651 |
++++ b/drivers/s390/cio/cio.h |
7652 |
+@@ -115,7 +115,7 @@ struct subchannel { |
7653 |
+ struct schib_config config; |
7654 |
+ } __attribute__ ((aligned(8))); |
7655 |
+ |
7656 |
+-DECLARE_PER_CPU(struct irb, cio_irb); |
7657 |
++DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb); |
7658 |
+ |
7659 |
+ #define to_subchannel(n) container_of(n, struct subchannel, dev) |
7660 |
+ |
7661 |
+diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c |
7662 |
+index 0b3b9de45c60..9e84d8a971ad 100644 |
7663 |
+--- a/drivers/s390/cio/vfio_ccw_drv.c |
7664 |
++++ b/drivers/s390/cio/vfio_ccw_drv.c |
7665 |
+@@ -40,26 +40,30 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch) |
7666 |
+ if (ret != -EBUSY) |
7667 |
+ goto out_unlock; |
7668 |
+ |
7669 |
++ iretry = 255; |
7670 |
+ do { |
7671 |
+- iretry = 255; |
7672 |
+ |
7673 |
+ ret = cio_cancel_halt_clear(sch, &iretry); |
7674 |
+- while (ret == -EBUSY) { |
7675 |
+- /* |
7676 |
+- * Flush all I/O and wait for |
7677 |
+- * cancel/halt/clear completion. |
7678 |
+- */ |
7679 |
+- private->completion = &completion; |
7680 |
+- spin_unlock_irq(sch->lock); |
7681 |
+ |
7682 |
+- wait_for_completion_timeout(&completion, 3*HZ); |
7683 |
++ if (ret == -EIO) { |
7684 |
++ pr_err("vfio_ccw: could not quiesce subchannel 0.%x.%04x!\n", |
7685 |
++ sch->schid.ssid, sch->schid.sch_no); |
7686 |
++ break; |
7687 |
++ } |
7688 |
++ |
7689 |
++ /* |
7690 |
++ * Flush all I/O and wait for |
7691 |
++ * cancel/halt/clear completion. |
7692 |
++ */ |
7693 |
++ private->completion = &completion; |
7694 |
++ spin_unlock_irq(sch->lock); |
7695 |
+ |
7696 |
+- spin_lock_irq(sch->lock); |
7697 |
+- private->completion = NULL; |
7698 |
+- flush_workqueue(vfio_ccw_work_q); |
7699 |
+- ret = cio_cancel_halt_clear(sch, &iretry); |
7700 |
+- }; |
7701 |
++ if (ret == -EBUSY) |
7702 |
++ wait_for_completion_timeout(&completion, 3*HZ); |
7703 |
+ |
7704 |
++ private->completion = NULL; |
7705 |
++ flush_workqueue(vfio_ccw_work_q); |
7706 |
++ spin_lock_irq(sch->lock); |
7707 |
+ ret = cio_disable_subchannel(sch); |
7708 |
+ } while (ret == -EBUSY); |
7709 |
+ out_unlock: |
7710 |
+diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c |
7711 |
+index f673e106c041..dc5ff47de3fe 100644 |
7712 |
+--- a/drivers/s390/cio/vfio_ccw_ops.c |
7713 |
++++ b/drivers/s390/cio/vfio_ccw_ops.c |
7714 |
+@@ -130,11 +130,12 @@ static int vfio_ccw_mdev_remove(struct mdev_device *mdev) |
7715 |
+ |
7716 |
+ if ((private->state != VFIO_CCW_STATE_NOT_OPER) && |
7717 |
+ (private->state != VFIO_CCW_STATE_STANDBY)) { |
7718 |
+- if (!vfio_ccw_mdev_reset(mdev)) |
7719 |
++ if (!vfio_ccw_sch_quiesce(private->sch)) |
7720 |
+ private->state = VFIO_CCW_STATE_STANDBY; |
7721 |
+ /* The state will be NOT_OPER on error. */ |
7722 |
+ } |
7723 |
+ |
7724 |
++ cp_free(&private->cp); |
7725 |
+ private->mdev = NULL; |
7726 |
+ atomic_inc(&private->avail); |
7727 |
+ |
7728 |
+@@ -158,6 +159,14 @@ static void vfio_ccw_mdev_release(struct mdev_device *mdev) |
7729 |
+ struct vfio_ccw_private *private = |
7730 |
+ dev_get_drvdata(mdev_parent_dev(mdev)); |
7731 |
+ |
7732 |
++ if ((private->state != VFIO_CCW_STATE_NOT_OPER) && |
7733 |
++ (private->state != VFIO_CCW_STATE_STANDBY)) { |
7734 |
++ if (!vfio_ccw_mdev_reset(mdev)) |
7735 |
++ private->state = VFIO_CCW_STATE_STANDBY; |
7736 |
++ /* The state will be NOT_OPER on error. */ |
7737 |
++ } |
7738 |
++ |
7739 |
++ cp_free(&private->cp); |
7740 |
+ vfio_unregister_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, |
7741 |
+ &private->nb); |
7742 |
+ } |
7743 |
+diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c |
7744 |
+index eb93c2d27d0a..df1e847dd36e 100644 |
7745 |
+--- a/drivers/s390/crypto/zcrypt_api.c |
7746 |
++++ b/drivers/s390/crypto/zcrypt_api.c |
7747 |
+@@ -657,6 +657,7 @@ static long zcrypt_rsa_modexpo(struct ap_perms *perms, |
7748 |
+ trace_s390_zcrypt_req(mex, TP_ICARSAMODEXPO); |
7749 |
+ |
7750 |
+ if (mex->outputdatalength < mex->inputdatalength) { |
7751 |
++ func_code = 0; |
7752 |
+ rc = -EINVAL; |
7753 |
+ goto out; |
7754 |
+ } |
7755 |
+@@ -739,6 +740,7 @@ static long zcrypt_rsa_crt(struct ap_perms *perms, |
7756 |
+ trace_s390_zcrypt_req(crt, TP_ICARSACRT); |
7757 |
+ |
7758 |
+ if (crt->outputdatalength < crt->inputdatalength) { |
7759 |
++ func_code = 0; |
7760 |
+ rc = -EINVAL; |
7761 |
+ goto out; |
7762 |
+ } |
7763 |
+@@ -946,6 +948,7 @@ static long zcrypt_send_ep11_cprb(struct ap_perms *perms, |
7764 |
+ |
7765 |
+ targets = kcalloc(target_num, sizeof(*targets), GFP_KERNEL); |
7766 |
+ if (!targets) { |
7767 |
++ func_code = 0; |
7768 |
+ rc = -ENOMEM; |
7769 |
+ goto out; |
7770 |
+ } |
7771 |
+@@ -953,6 +956,7 @@ static long zcrypt_send_ep11_cprb(struct ap_perms *perms, |
7772 |
+ uptr = (struct ep11_target_dev __force __user *) xcrb->targets; |
7773 |
+ if (copy_from_user(targets, uptr, |
7774 |
+ target_num * sizeof(*targets))) { |
7775 |
++ func_code = 0; |
7776 |
+ rc = -EFAULT; |
7777 |
+ goto out_free; |
7778 |
+ } |
7779 |
+diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h |
7780 |
+index 122059ecad84..614bb0f34e8e 100644 |
7781 |
+--- a/drivers/s390/net/qeth_core.h |
7782 |
++++ b/drivers/s390/net/qeth_core.h |
7783 |
+@@ -215,6 +215,12 @@ struct qeth_vnicc_info { |
7784 |
+ bool rx_bcast_enabled; |
7785 |
+ }; |
7786 |
+ |
7787 |
++static inline int qeth_is_adp_supported(struct qeth_ipa_info *ipa, |
7788 |
++ enum qeth_ipa_setadp_cmd func) |
7789 |
++{ |
7790 |
++ return (ipa->supported_funcs & func); |
7791 |
++} |
7792 |
++ |
7793 |
+ static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa, |
7794 |
+ enum qeth_ipa_funcs func) |
7795 |
+ { |
7796 |
+@@ -228,9 +234,7 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, |
7797 |
+ } |
7798 |
+ |
7799 |
+ #define qeth_adp_supported(c, f) \ |
7800 |
+- qeth_is_ipa_supported(&c->options.adp, f) |
7801 |
+-#define qeth_adp_enabled(c, f) \ |
7802 |
+- qeth_is_ipa_enabled(&c->options.adp, f) |
7803 |
++ qeth_is_adp_supported(&c->options.adp, f) |
7804 |
+ #define qeth_is_supported(c, f) \ |
7805 |
+ qeth_is_ipa_supported(&c->options.ipa4, f) |
7806 |
+ #define qeth_is_enabled(c, f) \ |
7807 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
7808 |
+index 89f912213e62..8786805b9d1c 100644 |
7809 |
+--- a/drivers/s390/net/qeth_core_main.c |
7810 |
++++ b/drivers/s390/net/qeth_core_main.c |
7811 |
+@@ -1325,7 +1325,7 @@ static void qeth_set_multiple_write_queues(struct qeth_card *card) |
7812 |
+ card->qdio.no_out_queues = 4; |
7813 |
+ } |
7814 |
+ |
7815 |
+-static void qeth_update_from_chp_desc(struct qeth_card *card) |
7816 |
++static int qeth_update_from_chp_desc(struct qeth_card *card) |
7817 |
+ { |
7818 |
+ struct ccw_device *ccwdev; |
7819 |
+ struct channel_path_desc_fmt0 *chp_dsc; |
7820 |
+@@ -1335,7 +1335,7 @@ static void qeth_update_from_chp_desc(struct qeth_card *card) |
7821 |
+ ccwdev = card->data.ccwdev; |
7822 |
+ chp_dsc = ccw_device_get_chp_desc(ccwdev, 0); |
7823 |
+ if (!chp_dsc) |
7824 |
+- goto out; |
7825 |
++ return -ENOMEM; |
7826 |
+ |
7827 |
+ card->info.func_level = 0x4100 + chp_dsc->desc; |
7828 |
+ if (card->info.type == QETH_CARD_TYPE_IQD) |
7829 |
+@@ -1350,6 +1350,7 @@ out: |
7830 |
+ kfree(chp_dsc); |
7831 |
+ QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues); |
7832 |
+ QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level); |
7833 |
++ return 0; |
7834 |
+ } |
7835 |
+ |
7836 |
+ static void qeth_init_qdio_info(struct qeth_card *card) |
7837 |
+@@ -5086,7 +5087,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok) |
7838 |
+ |
7839 |
+ QETH_DBF_TEXT(SETUP, 2, "hrdsetup"); |
7840 |
+ atomic_set(&card->force_alloc_skb, 0); |
7841 |
+- qeth_update_from_chp_desc(card); |
7842 |
++ rc = qeth_update_from_chp_desc(card); |
7843 |
++ if (rc) |
7844 |
++ return rc; |
7845 |
+ retry: |
7846 |
+ if (retries < 3) |
7847 |
+ QETH_DBF_MESSAGE(2, "Retrying to do IDX activates on device %x.\n", |
7848 |
+@@ -5755,7 +5758,9 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) |
7849 |
+ } |
7850 |
+ |
7851 |
+ qeth_setup_card(card); |
7852 |
+- qeth_update_from_chp_desc(card); |
7853 |
++ rc = qeth_update_from_chp_desc(card); |
7854 |
++ if (rc) |
7855 |
++ goto err_chp_desc; |
7856 |
+ |
7857 |
+ card->dev = qeth_alloc_netdev(card); |
7858 |
+ if (!card->dev) { |
7859 |
+@@ -5790,6 +5795,7 @@ err_disc: |
7860 |
+ qeth_core_free_discipline(card); |
7861 |
+ err_load: |
7862 |
+ free_netdev(card->dev); |
7863 |
++err_chp_desc: |
7864 |
+ err_card: |
7865 |
+ qeth_core_free_card(card); |
7866 |
+ err_dev: |
7867 |
+diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c |
7868 |
+index f21c93bbb35c..a761f5019b07 100644 |
7869 |
+--- a/drivers/scsi/libsas/sas_expander.c |
7870 |
++++ b/drivers/scsi/libsas/sas_expander.c |
7871 |
+@@ -2024,6 +2024,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) |
7872 |
+ if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { |
7873 |
+ phy->phy_state = PHY_EMPTY; |
7874 |
+ sas_unregister_devs_sas_addr(dev, phy_id, last); |
7875 |
++ /* |
7876 |
++ * Even though the PHY is empty, for convenience we discover |
7877 |
++ * the PHY to update the PHY info, like negotiated linkrate. |
7878 |
++ */ |
7879 |
++ sas_ex_phy_discover(dev, phy_id); |
7880 |
+ return res; |
7881 |
+ } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && |
7882 |
+ dev_type_flutter(type, phy->attached_dev_type)) { |
7883 |
+diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c |
7884 |
+index 221f8fd87d24..b385b8ece343 100644 |
7885 |
+--- a/drivers/scsi/lpfc/lpfc_ct.c |
7886 |
++++ b/drivers/scsi/lpfc/lpfc_ct.c |
7887 |
+@@ -2005,8 +2005,11 @@ lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport, |
7888 |
+ ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
7889 |
+ memset(ae, 0, 256); |
7890 |
+ |
7891 |
++ /* This string MUST be consistent with other FC platforms |
7892 |
++ * supported by Broadcom. |
7893 |
++ */ |
7894 |
+ strncpy(ae->un.AttrString, |
7895 |
+- "Broadcom Inc.", |
7896 |
++ "Emulex Corporation", |
7897 |
+ sizeof(ae->un.AttrString)); |
7898 |
+ len = strnlen(ae->un.AttrString, |
7899 |
+ sizeof(ae->un.AttrString)); |
7900 |
+@@ -2360,10 +2363,11 @@ lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport, |
7901 |
+ ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
7902 |
+ memset(ae, 0, 32); |
7903 |
+ |
7904 |
+- ae->un.AttrTypes[3] = 0x02; /* Type 1 - ELS */ |
7905 |
+- ae->un.AttrTypes[2] = 0x01; /* Type 8 - FCP */ |
7906 |
+- ae->un.AttrTypes[6] = 0x01; /* Type 40 - NVME */ |
7907 |
+- ae->un.AttrTypes[7] = 0x01; /* Type 32 - CT */ |
7908 |
++ ae->un.AttrTypes[3] = 0x02; /* Type 0x1 - ELS */ |
7909 |
++ ae->un.AttrTypes[2] = 0x01; /* Type 0x8 - FCP */ |
7910 |
++ if (vport->nvmei_support || vport->phba->nvmet_support) |
7911 |
++ ae->un.AttrTypes[6] = 0x01; /* Type 0x28 - NVME */ |
7912 |
++ ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
7913 |
+ size = FOURBYTES + 32; |
7914 |
+ ad->AttrLen = cpu_to_be16(size); |
7915 |
+ ad->AttrType = cpu_to_be16(RPRT_SUPPORTED_FC4_TYPES); |
7916 |
+@@ -2673,9 +2677,11 @@ lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, |
7917 |
+ ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
7918 |
+ memset(ae, 0, 32); |
7919 |
+ |
7920 |
+- ae->un.AttrTypes[3] = 0x02; /* Type 1 - ELS */ |
7921 |
+- ae->un.AttrTypes[2] = 0x01; /* Type 8 - FCP */ |
7922 |
+- ae->un.AttrTypes[7] = 0x01; /* Type 32 - CT */ |
7923 |
++ ae->un.AttrTypes[3] = 0x02; /* Type 0x1 - ELS */ |
7924 |
++ ae->un.AttrTypes[2] = 0x01; /* Type 0x8 - FCP */ |
7925 |
++ if (vport->phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) |
7926 |
++ ae->un.AttrTypes[6] = 0x1; /* Type 0x28 - NVME */ |
7927 |
++ ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
7928 |
+ size = FOURBYTES + 32; |
7929 |
+ ad->AttrLen = cpu_to_be16(size); |
7930 |
+ ad->AttrType = cpu_to_be16(RPRT_ACTIVE_FC4_TYPES); |
7931 |
+diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c |
7932 |
+index b183b882d506..8d553cfb85aa 100644 |
7933 |
+--- a/drivers/scsi/lpfc/lpfc_hbadisc.c |
7934 |
++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c |
7935 |
+@@ -935,7 +935,11 @@ lpfc_linkdown(struct lpfc_hba *phba) |
7936 |
+ } |
7937 |
+ } |
7938 |
+ lpfc_destroy_vport_work_array(phba, vports); |
7939 |
+- /* Clean up any firmware default rpi's */ |
7940 |
++ |
7941 |
++ /* Clean up any SLI3 firmware default rpi's */ |
7942 |
++ if (phba->sli_rev > LPFC_SLI_REV3) |
7943 |
++ goto skip_unreg_did; |
7944 |
++ |
7945 |
+ mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
7946 |
+ if (mb) { |
7947 |
+ lpfc_unreg_did(phba, 0xffff, LPFC_UNREG_ALL_DFLT_RPIS, mb); |
7948 |
+@@ -947,6 +951,7 @@ lpfc_linkdown(struct lpfc_hba *phba) |
7949 |
+ } |
7950 |
+ } |
7951 |
+ |
7952 |
++ skip_unreg_did: |
7953 |
+ /* Setup myDID for link up if we are in pt2pt mode */ |
7954 |
+ if (phba->pport->fc_flag & FC_PT2PT) { |
7955 |
+ mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
7956 |
+@@ -4874,6 +4879,10 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
7957 |
+ * accept PLOGIs after unreg_rpi_cmpl |
7958 |
+ */ |
7959 |
+ acc_plogi = 0; |
7960 |
++ } else if (vport->load_flag & FC_UNLOADING) { |
7961 |
++ mbox->ctx_ndlp = NULL; |
7962 |
++ mbox->mbox_cmpl = |
7963 |
++ lpfc_sli_def_mbox_cmpl; |
7964 |
+ } else { |
7965 |
+ mbox->ctx_ndlp = ndlp; |
7966 |
+ mbox->mbox_cmpl = |
7967 |
+@@ -4985,6 +4994,10 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport) |
7968 |
+ LPFC_MBOXQ_t *mbox; |
7969 |
+ int rc; |
7970 |
+ |
7971 |
++ /* Unreg DID is an SLI3 operation. */ |
7972 |
++ if (phba->sli_rev > LPFC_SLI_REV3) |
7973 |
++ return; |
7974 |
++ |
7975 |
+ mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
7976 |
+ if (mbox) { |
7977 |
+ lpfc_unreg_did(phba, vport->vpi, LPFC_UNREG_ALL_DFLT_RPIS, |
7978 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
7979 |
+index 8c9f79042228..56df8b510186 100644 |
7980 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
7981 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
7982 |
+@@ -2471,15 +2471,15 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) |
7983 |
+ if (!cstat) |
7984 |
+ return -ENOMEM; |
7985 |
+ |
7986 |
++ if (!IS_ENABLED(CONFIG_NVME_FC)) |
7987 |
++ return ret; |
7988 |
++ |
7989 |
+ /* localport is allocated from the stack, but the registration |
7990 |
+ * call allocates heap memory as well as the private area. |
7991 |
+ */ |
7992 |
+-#if (IS_ENABLED(CONFIG_NVME_FC)) |
7993 |
++ |
7994 |
+ ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template, |
7995 |
+ &vport->phba->pcidev->dev, &localport); |
7996 |
+-#else |
7997 |
+- ret = -ENOMEM; |
7998 |
+-#endif |
7999 |
+ if (!ret) { |
8000 |
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_NVME_DISC, |
8001 |
+ "6005 Successfully registered local " |
8002 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
8003 |
+index 2242e9b3ca12..d3a942971d81 100644 |
8004 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
8005 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
8006 |
+@@ -2518,8 +2518,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
8007 |
+ } else { |
8008 |
+ ndlp->nlp_flag &= ~NLP_UNREG_INP; |
8009 |
+ } |
8010 |
++ pmb->ctx_ndlp = NULL; |
8011 |
+ } |
8012 |
+- pmb->ctx_ndlp = NULL; |
8013 |
+ } |
8014 |
+ |
8015 |
+ /* Check security permission status on INIT_LINK mailbox command */ |
8016 |
+diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c |
8017 |
+index 6bbc38b1b465..a17c13846d1e 100644 |
8018 |
+--- a/drivers/scsi/qedf/qedf_io.c |
8019 |
++++ b/drivers/scsi/qedf/qedf_io.c |
8020 |
+@@ -902,6 +902,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) |
8021 |
+ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { |
8022 |
+ QEDF_ERR(&(qedf->dbg_ctx), "Session not offloaded yet.\n"); |
8023 |
+ kref_put(&io_req->refcount, qedf_release_cmd); |
8024 |
++ return -EINVAL; |
8025 |
+ } |
8026 |
+ |
8027 |
+ /* Obtain free SQE */ |
8028 |
+diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c |
8029 |
+index 6d6d6013e35b..bf371e7b957d 100644 |
8030 |
+--- a/drivers/scsi/qedi/qedi_iscsi.c |
8031 |
++++ b/drivers/scsi/qedi/qedi_iscsi.c |
8032 |
+@@ -1000,6 +1000,9 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) |
8033 |
+ qedi_ep = ep->dd_data; |
8034 |
+ qedi = qedi_ep->qedi; |
8035 |
+ |
8036 |
++ if (qedi_ep->state == EP_STATE_OFLDCONN_START) |
8037 |
++ goto ep_exit_recover; |
8038 |
++ |
8039 |
+ flush_work(&qedi_ep->offload_work); |
8040 |
+ |
8041 |
+ if (qedi_ep->conn) { |
8042 |
+diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
8043 |
+index 1a20e5d8f057..51df171b32ed 100644 |
8044 |
+--- a/drivers/scsi/qla2xxx/qla_isr.c |
8045 |
++++ b/drivers/scsi/qla2xxx/qla_isr.c |
8046 |
+@@ -3454,7 +3454,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) |
8047 |
+ ql_log(ql_log_fatal, vha, 0x00c8, |
8048 |
+ "Failed to allocate memory for ha->msix_entries.\n"); |
8049 |
+ ret = -ENOMEM; |
8050 |
+- goto msix_out; |
8051 |
++ goto free_irqs; |
8052 |
+ } |
8053 |
+ ha->flags.msix_enabled = 1; |
8054 |
+ |
8055 |
+@@ -3537,6 +3537,10 @@ msix_register_fail: |
8056 |
+ |
8057 |
+ msix_out: |
8058 |
+ return ret; |
8059 |
++ |
8060 |
++free_irqs: |
8061 |
++ pci_free_irq_vectors(ha->pdev); |
8062 |
++ goto msix_out; |
8063 |
+ } |
8064 |
+ |
8065 |
+ int |
8066 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
8067 |
+index d4ac18573d81..4758cd687718 100644 |
8068 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
8069 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
8070 |
+@@ -680,7 +680,6 @@ done: |
8071 |
+ void qla24xx_do_nack_work(struct scsi_qla_host *vha, struct qla_work_evt *e) |
8072 |
+ { |
8073 |
+ fc_port_t *t; |
8074 |
+- unsigned long flags; |
8075 |
+ |
8076 |
+ switch (e->u.nack.type) { |
8077 |
+ case SRB_NACK_PRLI: |
8078 |
+@@ -690,10 +689,8 @@ void qla24xx_do_nack_work(struct scsi_qla_host *vha, struct qla_work_evt *e) |
8079 |
+ if (t) { |
8080 |
+ ql_log(ql_log_info, vha, 0xd034, |
8081 |
+ "%s create sess success %p", __func__, t); |
8082 |
+- spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); |
8083 |
+ /* create sess has an extra kref */ |
8084 |
+ vha->hw->tgt.tgt_ops->put_sess(e->u.nack.fcport); |
8085 |
+- spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); |
8086 |
+ } |
8087 |
+ break; |
8088 |
+ } |
8089 |
+@@ -705,9 +702,6 @@ void qla24xx_delete_sess_fn(struct work_struct *work) |
8090 |
+ { |
8091 |
+ fc_port_t *fcport = container_of(work, struct fc_port, del_work); |
8092 |
+ struct qla_hw_data *ha = fcport->vha->hw; |
8093 |
+- unsigned long flags; |
8094 |
+- |
8095 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
8096 |
+ |
8097 |
+ if (fcport->se_sess) { |
8098 |
+ ha->tgt.tgt_ops->shutdown_sess(fcport); |
8099 |
+@@ -715,7 +709,6 @@ void qla24xx_delete_sess_fn(struct work_struct *work) |
8100 |
+ } else { |
8101 |
+ qlt_unreg_sess(fcport); |
8102 |
+ } |
8103 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
8104 |
+ } |
8105 |
+ |
8106 |
+ /* |
8107 |
+@@ -784,8 +777,9 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport) |
8108 |
+ fcport->port_name, sess->loop_id); |
8109 |
+ sess->local = 0; |
8110 |
+ } |
8111 |
+- ha->tgt.tgt_ops->put_sess(sess); |
8112 |
+ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
8113 |
++ |
8114 |
++ ha->tgt.tgt_ops->put_sess(sess); |
8115 |
+ } |
8116 |
+ |
8117 |
+ /* |
8118 |
+@@ -4242,9 +4236,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) |
8119 |
+ /* |
8120 |
+ * Drop extra session reference from qla_tgt_handle_cmd_for_atio*( |
8121 |
+ */ |
8122 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
8123 |
+ ha->tgt.tgt_ops->put_sess(sess); |
8124 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
8125 |
+ return; |
8126 |
+ |
8127 |
+ out_term: |
8128 |
+@@ -4261,9 +4253,7 @@ out_term: |
8129 |
+ target_free_tag(sess->se_sess, &cmd->se_cmd); |
8130 |
+ spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); |
8131 |
+ |
8132 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
8133 |
+ ha->tgt.tgt_ops->put_sess(sess); |
8134 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
8135 |
+ } |
8136 |
+ |
8137 |
+ static void qlt_do_work(struct work_struct *work) |
8138 |
+@@ -4472,9 +4462,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, |
8139 |
+ if (!cmd) { |
8140 |
+ ql_dbg(ql_dbg_io, vha, 0x3062, |
8141 |
+ "qla_target(%d): Allocation of cmd failed\n", vha->vp_idx); |
8142 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
8143 |
+ ha->tgt.tgt_ops->put_sess(sess); |
8144 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
8145 |
+ return -EBUSY; |
8146 |
+ } |
8147 |
+ |
8148 |
+@@ -6318,17 +6306,19 @@ static void qlt_abort_work(struct qla_tgt *tgt, |
8149 |
+ } |
8150 |
+ |
8151 |
+ rc = __qlt_24xx_handle_abts(vha, &prm->abts, sess); |
8152 |
+- ha->tgt.tgt_ops->put_sess(sess); |
8153 |
+ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
8154 |
+ |
8155 |
++ ha->tgt.tgt_ops->put_sess(sess); |
8156 |
++ |
8157 |
+ if (rc != 0) |
8158 |
+ goto out_term; |
8159 |
+ return; |
8160 |
+ |
8161 |
+ out_term2: |
8162 |
++ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
8163 |
++ |
8164 |
+ if (sess) |
8165 |
+ ha->tgt.tgt_ops->put_sess(sess); |
8166 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
8167 |
+ |
8168 |
+ out_term: |
8169 |
+ spin_lock_irqsave(&ha->hardware_lock, flags); |
8170 |
+@@ -6388,9 +6378,10 @@ static void qlt_tmr_work(struct qla_tgt *tgt, |
8171 |
+ scsilun_to_int((struct scsi_lun *)&a->u.isp24.fcp_cmnd.lun); |
8172 |
+ |
8173 |
+ rc = qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0); |
8174 |
+- ha->tgt.tgt_ops->put_sess(sess); |
8175 |
+ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
8176 |
+ |
8177 |
++ ha->tgt.tgt_ops->put_sess(sess); |
8178 |
++ |
8179 |
+ if (rc != 0) |
8180 |
+ goto out_term; |
8181 |
+ return; |
8182 |
+diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
8183 |
+index 283e6b80abb5..5e3bb49687df 100644 |
8184 |
+--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
8185 |
++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
8186 |
+@@ -359,7 +359,6 @@ static void tcm_qla2xxx_put_sess(struct fc_port *sess) |
8187 |
+ if (!sess) |
8188 |
+ return; |
8189 |
+ |
8190 |
+- assert_spin_locked(&sess->vha->hw->tgt.sess_lock); |
8191 |
+ kref_put(&sess->sess_kref, tcm_qla2xxx_release_session); |
8192 |
+ } |
8193 |
+ |
8194 |
+@@ -374,8 +373,9 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess) |
8195 |
+ |
8196 |
+ spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); |
8197 |
+ target_sess_cmd_list_set_waiting(se_sess); |
8198 |
+- tcm_qla2xxx_put_sess(sess); |
8199 |
+ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); |
8200 |
++ |
8201 |
++ tcm_qla2xxx_put_sess(sess); |
8202 |
+ } |
8203 |
+ |
8204 |
+ static u32 tcm_qla2xxx_sess_get_index(struct se_session *se_sess) |
8205 |
+@@ -399,6 +399,8 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) |
8206 |
+ cmd->se_cmd.transport_state, |
8207 |
+ cmd->se_cmd.t_state, |
8208 |
+ cmd->se_cmd.se_cmd_flags); |
8209 |
++ transport_generic_request_failure(&cmd->se_cmd, |
8210 |
++ TCM_CHECK_CONDITION_ABORT_CMD); |
8211 |
+ return 0; |
8212 |
+ } |
8213 |
+ cmd->trc_flags |= TRC_XFR_RDY; |
8214 |
+@@ -858,7 +860,6 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct fc_port *sess) |
8215 |
+ |
8216 |
+ static void tcm_qla2xxx_shutdown_sess(struct fc_port *sess) |
8217 |
+ { |
8218 |
+- assert_spin_locked(&sess->vha->hw->tgt.sess_lock); |
8219 |
+ target_sess_cmd_list_set_waiting(sess->se_sess); |
8220 |
+ } |
8221 |
+ |
8222 |
+diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
8223 |
+index 80289c885c07..9edec8e27b7c 100644 |
8224 |
+--- a/drivers/scsi/qla4xxx/ql4_os.c |
8225 |
++++ b/drivers/scsi/qla4xxx/ql4_os.c |
8226 |
+@@ -5930,7 +5930,7 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) |
8227 |
+ val = rd_nvram_byte(ha, sec_addr); |
8228 |
+ if (val & BIT_7) |
8229 |
+ ddb_index[1] = (val & 0x7f); |
8230 |
+- |
8231 |
++ goto exit_boot_info; |
8232 |
+ } else if (is_qla80XX(ha)) { |
8233 |
+ buf = dma_alloc_coherent(&ha->pdev->dev, size, |
8234 |
+ &buf_dma, GFP_KERNEL); |
8235 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
8236 |
+index d64553c0a051..ef43f06bc7a7 100644 |
8237 |
+--- a/drivers/scsi/sd.c |
8238 |
++++ b/drivers/scsi/sd.c |
8239 |
+@@ -2586,7 +2586,6 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) |
8240 |
+ int res; |
8241 |
+ struct scsi_device *sdp = sdkp->device; |
8242 |
+ struct scsi_mode_data data; |
8243 |
+- int disk_ro = get_disk_ro(sdkp->disk); |
8244 |
+ int old_wp = sdkp->write_prot; |
8245 |
+ |
8246 |
+ set_disk_ro(sdkp->disk, 0); |
8247 |
+@@ -2627,7 +2626,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) |
8248 |
+ "Test WP failed, assume Write Enabled\n"); |
8249 |
+ } else { |
8250 |
+ sdkp->write_prot = ((data.device_specific & 0x80) != 0); |
8251 |
+- set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); |
8252 |
++ set_disk_ro(sdkp->disk, sdkp->write_prot); |
8253 |
+ if (sdkp->first_scan || old_wp != sdkp->write_prot) { |
8254 |
+ sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", |
8255 |
+ sdkp->write_prot ? "on" : "off"); |
8256 |
+diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c |
8257 |
+index 452e19f8fb47..c2cee73a8560 100644 |
8258 |
+--- a/drivers/scsi/ufs/ufs-hisi.c |
8259 |
++++ b/drivers/scsi/ufs/ufs-hisi.c |
8260 |
+@@ -544,6 +544,10 @@ static int ufs_hisi_init_common(struct ufs_hba *hba) |
8261 |
+ ufshcd_set_variant(hba, host); |
8262 |
+ |
8263 |
+ host->rst = devm_reset_control_get(dev, "rst"); |
8264 |
++ if (IS_ERR(host->rst)) { |
8265 |
++ dev_err(dev, "%s: failed to get reset control\n", __func__); |
8266 |
++ return PTR_ERR(host->rst); |
8267 |
++ } |
8268 |
+ |
8269 |
+ ufs_hisi_set_pm_lvl(hba); |
8270 |
+ |
8271 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
8272 |
+index 2ddf24466a62..c02e70428711 100644 |
8273 |
+--- a/drivers/scsi/ufs/ufshcd.c |
8274 |
++++ b/drivers/scsi/ufs/ufshcd.c |
8275 |
+@@ -6286,19 +6286,19 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, |
8276 |
+ goto out; |
8277 |
+ } |
8278 |
+ |
8279 |
+- if (hba->vreg_info.vcc) |
8280 |
++ if (hba->vreg_info.vcc && hba->vreg_info.vcc->max_uA) |
8281 |
+ icc_level = ufshcd_get_max_icc_level( |
8282 |
+ hba->vreg_info.vcc->max_uA, |
8283 |
+ POWER_DESC_MAX_ACTV_ICC_LVLS - 1, |
8284 |
+ &desc_buf[PWR_DESC_ACTIVE_LVLS_VCC_0]); |
8285 |
+ |
8286 |
+- if (hba->vreg_info.vccq) |
8287 |
++ if (hba->vreg_info.vccq && hba->vreg_info.vccq->max_uA) |
8288 |
+ icc_level = ufshcd_get_max_icc_level( |
8289 |
+ hba->vreg_info.vccq->max_uA, |
8290 |
+ icc_level, |
8291 |
+ &desc_buf[PWR_DESC_ACTIVE_LVLS_VCCQ_0]); |
8292 |
+ |
8293 |
+- if (hba->vreg_info.vccq2) |
8294 |
++ if (hba->vreg_info.vccq2 && hba->vreg_info.vccq2->max_uA) |
8295 |
+ icc_level = ufshcd_get_max_icc_level( |
8296 |
+ hba->vreg_info.vccq2->max_uA, |
8297 |
+ icc_level, |
8298 |
+@@ -7001,6 +7001,15 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, |
8299 |
+ if (!vreg) |
8300 |
+ return 0; |
8301 |
+ |
8302 |
++ /* |
8303 |
++ * "set_load" operation shall be required on those regulators |
8304 |
++ * which specifically configured current limitation. Otherwise |
8305 |
++ * zero max_uA may cause unexpected behavior when regulator is |
8306 |
++ * enabled or set as high power mode. |
8307 |
++ */ |
8308 |
++ if (!vreg->max_uA) |
8309 |
++ return 0; |
8310 |
++ |
8311 |
+ ret = regulator_set_load(vreg->reg, ua); |
8312 |
+ if (ret < 0) { |
8313 |
+ dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n", |
8314 |
+@@ -7047,12 +7056,15 @@ static int ufshcd_config_vreg(struct device *dev, |
8315 |
+ name = vreg->name; |
8316 |
+ |
8317 |
+ if (regulator_count_voltages(reg) > 0) { |
8318 |
+- min_uV = on ? vreg->min_uV : 0; |
8319 |
+- ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); |
8320 |
+- if (ret) { |
8321 |
+- dev_err(dev, "%s: %s set voltage failed, err=%d\n", |
8322 |
++ if (vreg->min_uV && vreg->max_uV) { |
8323 |
++ min_uV = on ? vreg->min_uV : 0; |
8324 |
++ ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); |
8325 |
++ if (ret) { |
8326 |
++ dev_err(dev, |
8327 |
++ "%s: %s set voltage failed, err=%d\n", |
8328 |
+ __func__, name, ret); |
8329 |
+- goto out; |
8330 |
++ goto out; |
8331 |
++ } |
8332 |
+ } |
8333 |
+ |
8334 |
+ uA_load = on ? vreg->max_uA : 0; |
8335 |
+diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
8336 |
+index 71f094c9ec68..f3585777324c 100644 |
8337 |
+--- a/drivers/slimbus/qcom-ngd-ctrl.c |
8338 |
++++ b/drivers/slimbus/qcom-ngd-ctrl.c |
8339 |
+@@ -1342,6 +1342,10 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
8340 |
+ return -ENOMEM; |
8341 |
+ |
8342 |
+ ngd->pdev = platform_device_alloc(QCOM_SLIM_NGD_DRV_NAME, id); |
8343 |
++ if (!ngd->pdev) { |
8344 |
++ kfree(ngd); |
8345 |
++ return -ENOMEM; |
8346 |
++ } |
8347 |
+ ngd->id = id; |
8348 |
+ ngd->pdev->dev.parent = parent; |
8349 |
+ ngd->pdev->driver_override = QCOM_SLIM_NGD_DRV_NAME; |
8350 |
+diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c |
8351 |
+index ddc712410812..ec6e9970d775 100644 |
8352 |
+--- a/drivers/spi/atmel-quadspi.c |
8353 |
++++ b/drivers/spi/atmel-quadspi.c |
8354 |
+@@ -506,7 +506,8 @@ static int atmel_qspi_remove(struct platform_device *pdev) |
8355 |
+ |
8356 |
+ static int __maybe_unused atmel_qspi_suspend(struct device *dev) |
8357 |
+ { |
8358 |
+- struct atmel_qspi *aq = dev_get_drvdata(dev); |
8359 |
++ struct spi_controller *ctrl = dev_get_drvdata(dev); |
8360 |
++ struct atmel_qspi *aq = spi_controller_get_devdata(ctrl); |
8361 |
+ |
8362 |
+ clk_disable_unprepare(aq->clk); |
8363 |
+ |
8364 |
+@@ -515,7 +516,8 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev) |
8365 |
+ |
8366 |
+ static int __maybe_unused atmel_qspi_resume(struct device *dev) |
8367 |
+ { |
8368 |
+- struct atmel_qspi *aq = dev_get_drvdata(dev); |
8369 |
++ struct spi_controller *ctrl = dev_get_drvdata(dev); |
8370 |
++ struct atmel_qspi *aq = spi_controller_get_devdata(ctrl); |
8371 |
+ |
8372 |
+ clk_prepare_enable(aq->clk); |
8373 |
+ |
8374 |
+diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c |
8375 |
+index 6ec647bbba77..a81ae29aa68a 100644 |
8376 |
+--- a/drivers/spi/spi-imx.c |
8377 |
++++ b/drivers/spi/spi-imx.c |
8378 |
+@@ -1494,7 +1494,7 @@ static int spi_imx_transfer(struct spi_device *spi, |
8379 |
+ |
8380 |
+ /* flush rxfifo before transfer */ |
8381 |
+ while (spi_imx->devtype_data->rx_available(spi_imx)) |
8382 |
+- spi_imx->rx(spi_imx); |
8383 |
++ readl(spi_imx->base + MXC_CSPIRXDATA); |
8384 |
+ |
8385 |
+ if (spi_imx->slave_mode) |
8386 |
+ return spi_imx_pio_transfer_slave(spi, transfer); |
8387 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
8388 |
+index 3e82eaad0f2d..41aadb41a20b 100644 |
8389 |
+--- a/drivers/spi/spi-pxa2xx.c |
8390 |
++++ b/drivers/spi/spi-pxa2xx.c |
8391 |
+@@ -884,10 +884,14 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) |
8392 |
+ |
8393 |
+ rate = min_t(int, ssp_clk, rate); |
8394 |
+ |
8395 |
++ /* |
8396 |
++ * Calculate the divisor for the SCR (Serial Clock Rate), avoiding |
8397 |
++ * that the SSP transmission rate can be greater than the device rate |
8398 |
++ */ |
8399 |
+ if (ssp->type == PXA25x_SSP || ssp->type == CE4100_SSP) |
8400 |
+- return (ssp_clk / (2 * rate) - 1) & 0xff; |
8401 |
++ return (DIV_ROUND_UP(ssp_clk, 2 * rate) - 1) & 0xff; |
8402 |
+ else |
8403 |
+- return (ssp_clk / rate - 1) & 0xfff; |
8404 |
++ return (DIV_ROUND_UP(ssp_clk, rate) - 1) & 0xfff; |
8405 |
+ } |
8406 |
+ |
8407 |
+ static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, |
8408 |
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c |
8409 |
+index a4ef641b5227..b0824df3e04b 100644 |
8410 |
+--- a/drivers/spi/spi-rspi.c |
8411 |
++++ b/drivers/spi/spi-rspi.c |
8412 |
+@@ -271,7 +271,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size) |
8413 |
+ /* Sets parity, interrupt mask */ |
8414 |
+ rspi_write8(rspi, 0x00, RSPI_SPCR2); |
8415 |
+ |
8416 |
+- /* Sets SPCMD */ |
8417 |
++ /* Resets sequencer */ |
8418 |
++ rspi_write8(rspi, 0, RSPI_SPSCR); |
8419 |
+ rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
8420 |
+ rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
8421 |
+ |
8422 |
+@@ -315,7 +316,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size) |
8423 |
+ rspi_write8(rspi, 0x00, RSPI_SSLND); |
8424 |
+ rspi_write8(rspi, 0x00, RSPI_SPND); |
8425 |
+ |
8426 |
+- /* Sets SPCMD */ |
8427 |
++ /* Resets sequencer */ |
8428 |
++ rspi_write8(rspi, 0, RSPI_SPSCR); |
8429 |
+ rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
8430 |
+ rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
8431 |
+ |
8432 |
+@@ -366,7 +368,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size) |
8433 |
+ /* Sets buffer to allow normal operation */ |
8434 |
+ rspi_write8(rspi, 0x00, QSPI_SPBFCR); |
8435 |
+ |
8436 |
+- /* Sets SPCMD */ |
8437 |
++ /* Resets sequencer */ |
8438 |
++ rspi_write8(rspi, 0, RSPI_SPSCR); |
8439 |
+ rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
8440 |
+ |
8441 |
+ /* Sets RSPI mode */ |
8442 |
+diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c |
8443 |
+index 3b2a9a6b990d..0b9a8bddb939 100644 |
8444 |
+--- a/drivers/spi/spi-stm32-qspi.c |
8445 |
++++ b/drivers/spi/spi-stm32-qspi.c |
8446 |
+@@ -93,6 +93,7 @@ struct stm32_qspi_flash { |
8447 |
+ |
8448 |
+ struct stm32_qspi { |
8449 |
+ struct device *dev; |
8450 |
++ struct spi_controller *ctrl; |
8451 |
+ void __iomem *io_base; |
8452 |
+ void __iomem *mm_base; |
8453 |
+ resource_size_t mm_size; |
8454 |
+@@ -397,6 +398,7 @@ static void stm32_qspi_release(struct stm32_qspi *qspi) |
8455 |
+ writel_relaxed(0, qspi->io_base + QSPI_CR); |
8456 |
+ mutex_destroy(&qspi->lock); |
8457 |
+ clk_disable_unprepare(qspi->clk); |
8458 |
++ spi_master_put(qspi->ctrl); |
8459 |
+ } |
8460 |
+ |
8461 |
+ static int stm32_qspi_probe(struct platform_device *pdev) |
8462 |
+@@ -413,43 +415,54 @@ static int stm32_qspi_probe(struct platform_device *pdev) |
8463 |
+ return -ENOMEM; |
8464 |
+ |
8465 |
+ qspi = spi_controller_get_devdata(ctrl); |
8466 |
++ qspi->ctrl = ctrl; |
8467 |
+ |
8468 |
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi"); |
8469 |
+ qspi->io_base = devm_ioremap_resource(dev, res); |
8470 |
+- if (IS_ERR(qspi->io_base)) |
8471 |
+- return PTR_ERR(qspi->io_base); |
8472 |
++ if (IS_ERR(qspi->io_base)) { |
8473 |
++ ret = PTR_ERR(qspi->io_base); |
8474 |
++ goto err; |
8475 |
++ } |
8476 |
+ |
8477 |
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm"); |
8478 |
+ qspi->mm_base = devm_ioremap_resource(dev, res); |
8479 |
+- if (IS_ERR(qspi->mm_base)) |
8480 |
+- return PTR_ERR(qspi->mm_base); |
8481 |
++ if (IS_ERR(qspi->mm_base)) { |
8482 |
++ ret = PTR_ERR(qspi->mm_base); |
8483 |
++ goto err; |
8484 |
++ } |
8485 |
+ |
8486 |
+ qspi->mm_size = resource_size(res); |
8487 |
+- if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) |
8488 |
+- return -EINVAL; |
8489 |
++ if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) { |
8490 |
++ ret = -EINVAL; |
8491 |
++ goto err; |
8492 |
++ } |
8493 |
+ |
8494 |
+ irq = platform_get_irq(pdev, 0); |
8495 |
+ ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0, |
8496 |
+ dev_name(dev), qspi); |
8497 |
+ if (ret) { |
8498 |
+ dev_err(dev, "failed to request irq\n"); |
8499 |
+- return ret; |
8500 |
++ goto err; |
8501 |
+ } |
8502 |
+ |
8503 |
+ init_completion(&qspi->data_completion); |
8504 |
+ |
8505 |
+ qspi->clk = devm_clk_get(dev, NULL); |
8506 |
+- if (IS_ERR(qspi->clk)) |
8507 |
+- return PTR_ERR(qspi->clk); |
8508 |
++ if (IS_ERR(qspi->clk)) { |
8509 |
++ ret = PTR_ERR(qspi->clk); |
8510 |
++ goto err; |
8511 |
++ } |
8512 |
+ |
8513 |
+ qspi->clk_rate = clk_get_rate(qspi->clk); |
8514 |
+- if (!qspi->clk_rate) |
8515 |
+- return -EINVAL; |
8516 |
++ if (!qspi->clk_rate) { |
8517 |
++ ret = -EINVAL; |
8518 |
++ goto err; |
8519 |
++ } |
8520 |
+ |
8521 |
+ ret = clk_prepare_enable(qspi->clk); |
8522 |
+ if (ret) { |
8523 |
+ dev_err(dev, "can not enable the clock\n"); |
8524 |
+- return ret; |
8525 |
++ goto err; |
8526 |
+ } |
8527 |
+ |
8528 |
+ rstc = devm_reset_control_get_exclusive(dev, NULL); |
8529 |
+@@ -472,14 +485,11 @@ static int stm32_qspi_probe(struct platform_device *pdev) |
8530 |
+ ctrl->dev.of_node = dev->of_node; |
8531 |
+ |
8532 |
+ ret = devm_spi_register_master(dev, ctrl); |
8533 |
+- if (ret) |
8534 |
+- goto err_spi_register; |
8535 |
+- |
8536 |
+- return 0; |
8537 |
++ if (!ret) |
8538 |
++ return 0; |
8539 |
+ |
8540 |
+-err_spi_register: |
8541 |
++err: |
8542 |
+ stm32_qspi_release(qspi); |
8543 |
+- |
8544 |
+ return ret; |
8545 |
+ } |
8546 |
+ |
8547 |
+diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
8548 |
+index a76acedd7e2f..a1888dc6a938 100644 |
8549 |
+--- a/drivers/spi/spi-tegra114.c |
8550 |
++++ b/drivers/spi/spi-tegra114.c |
8551 |
+@@ -1067,27 +1067,19 @@ static int tegra_spi_probe(struct platform_device *pdev) |
8552 |
+ |
8553 |
+ spi_irq = platform_get_irq(pdev, 0); |
8554 |
+ tspi->irq = spi_irq; |
8555 |
+- ret = request_threaded_irq(tspi->irq, tegra_spi_isr, |
8556 |
+- tegra_spi_isr_thread, IRQF_ONESHOT, |
8557 |
+- dev_name(&pdev->dev), tspi); |
8558 |
+- if (ret < 0) { |
8559 |
+- dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
8560 |
+- tspi->irq); |
8561 |
+- goto exit_free_master; |
8562 |
+- } |
8563 |
+ |
8564 |
+ tspi->clk = devm_clk_get(&pdev->dev, "spi"); |
8565 |
+ if (IS_ERR(tspi->clk)) { |
8566 |
+ dev_err(&pdev->dev, "can not get clock\n"); |
8567 |
+ ret = PTR_ERR(tspi->clk); |
8568 |
+- goto exit_free_irq; |
8569 |
++ goto exit_free_master; |
8570 |
+ } |
8571 |
+ |
8572 |
+ tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi"); |
8573 |
+ if (IS_ERR(tspi->rst)) { |
8574 |
+ dev_err(&pdev->dev, "can not get reset\n"); |
8575 |
+ ret = PTR_ERR(tspi->rst); |
8576 |
+- goto exit_free_irq; |
8577 |
++ goto exit_free_master; |
8578 |
+ } |
8579 |
+ |
8580 |
+ tspi->max_buf_size = SPI_FIFO_DEPTH << 2; |
8581 |
+@@ -1095,7 +1087,7 @@ static int tegra_spi_probe(struct platform_device *pdev) |
8582 |
+ |
8583 |
+ ret = tegra_spi_init_dma_param(tspi, true); |
8584 |
+ if (ret < 0) |
8585 |
+- goto exit_free_irq; |
8586 |
++ goto exit_free_master; |
8587 |
+ ret = tegra_spi_init_dma_param(tspi, false); |
8588 |
+ if (ret < 0) |
8589 |
+ goto exit_rx_dma_free; |
8590 |
+@@ -1117,18 +1109,32 @@ static int tegra_spi_probe(struct platform_device *pdev) |
8591 |
+ dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret); |
8592 |
+ goto exit_pm_disable; |
8593 |
+ } |
8594 |
++ |
8595 |
++ reset_control_assert(tspi->rst); |
8596 |
++ udelay(2); |
8597 |
++ reset_control_deassert(tspi->rst); |
8598 |
+ tspi->def_command1_reg = SPI_M_S; |
8599 |
+ tegra_spi_writel(tspi, tspi->def_command1_reg, SPI_COMMAND1); |
8600 |
+ pm_runtime_put(&pdev->dev); |
8601 |
++ ret = request_threaded_irq(tspi->irq, tegra_spi_isr, |
8602 |
++ tegra_spi_isr_thread, IRQF_ONESHOT, |
8603 |
++ dev_name(&pdev->dev), tspi); |
8604 |
++ if (ret < 0) { |
8605 |
++ dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
8606 |
++ tspi->irq); |
8607 |
++ goto exit_pm_disable; |
8608 |
++ } |
8609 |
+ |
8610 |
+ master->dev.of_node = pdev->dev.of_node; |
8611 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
8612 |
+ if (ret < 0) { |
8613 |
+ dev_err(&pdev->dev, "can not register to master err %d\n", ret); |
8614 |
+- goto exit_pm_disable; |
8615 |
++ goto exit_free_irq; |
8616 |
+ } |
8617 |
+ return ret; |
8618 |
+ |
8619 |
++exit_free_irq: |
8620 |
++ free_irq(spi_irq, tspi); |
8621 |
+ exit_pm_disable: |
8622 |
+ pm_runtime_disable(&pdev->dev); |
8623 |
+ if (!pm_runtime_status_suspended(&pdev->dev)) |
8624 |
+@@ -1136,8 +1142,6 @@ exit_pm_disable: |
8625 |
+ tegra_spi_deinit_dma_param(tspi, false); |
8626 |
+ exit_rx_dma_free: |
8627 |
+ tegra_spi_deinit_dma_param(tspi, true); |
8628 |
+-exit_free_irq: |
8629 |
+- free_irq(spi_irq, tspi); |
8630 |
+ exit_free_master: |
8631 |
+ spi_master_put(master); |
8632 |
+ return ret; |
8633 |
+diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c |
8634 |
+index 97d137591b18..4389ab80c23e 100644 |
8635 |
+--- a/drivers/spi/spi-topcliff-pch.c |
8636 |
++++ b/drivers/spi/spi-topcliff-pch.c |
8637 |
+@@ -1294,18 +1294,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, |
8638 |
+ dma->rx_buf_virt, dma->rx_buf_dma); |
8639 |
+ } |
8640 |
+ |
8641 |
+-static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, |
8642 |
++static int pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, |
8643 |
+ struct pch_spi_data *data) |
8644 |
+ { |
8645 |
+ struct pch_spi_dma_ctrl *dma; |
8646 |
++ int ret; |
8647 |
+ |
8648 |
+ dma = &data->dma; |
8649 |
++ ret = 0; |
8650 |
+ /* Get Consistent memory for Tx DMA */ |
8651 |
+ dma->tx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, |
8652 |
+ PCH_BUF_SIZE, &dma->tx_buf_dma, GFP_KERNEL); |
8653 |
++ if (!dma->tx_buf_virt) |
8654 |
++ ret = -ENOMEM; |
8655 |
++ |
8656 |
+ /* Get Consistent memory for Rx DMA */ |
8657 |
+ dma->rx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, |
8658 |
+ PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL); |
8659 |
++ if (!dma->rx_buf_virt) |
8660 |
++ ret = -ENOMEM; |
8661 |
++ |
8662 |
++ return ret; |
8663 |
+ } |
8664 |
+ |
8665 |
+ static int pch_spi_pd_probe(struct platform_device *plat_dev) |
8666 |
+@@ -1382,7 +1391,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) |
8667 |
+ |
8668 |
+ if (use_dma) { |
8669 |
+ dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); |
8670 |
+- pch_alloc_dma_buf(board_dat, data); |
8671 |
++ ret = pch_alloc_dma_buf(board_dat, data); |
8672 |
++ if (ret) |
8673 |
++ goto err_spi_register_master; |
8674 |
+ } |
8675 |
+ |
8676 |
+ ret = spi_register_master(master); |
8677 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
8678 |
+index 9a7def7c3237..0632a32c1105 100644 |
8679 |
+--- a/drivers/spi/spi.c |
8680 |
++++ b/drivers/spi/spi.c |
8681 |
+@@ -1024,6 +1024,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) |
8682 |
+ if (max_tx || max_rx) { |
8683 |
+ list_for_each_entry(xfer, &msg->transfers, |
8684 |
+ transfer_list) { |
8685 |
++ if (!xfer->len) |
8686 |
++ continue; |
8687 |
+ if (!xfer->tx_buf) |
8688 |
+ xfer->tx_buf = ctlr->dummy_tx; |
8689 |
+ if (!xfer->rx_buf) |
8690 |
+diff --git a/drivers/ssb/bridge_pcmcia_80211.c b/drivers/ssb/bridge_pcmcia_80211.c |
8691 |
+index f51f150307df..ffa379efff83 100644 |
8692 |
+--- a/drivers/ssb/bridge_pcmcia_80211.c |
8693 |
++++ b/drivers/ssb/bridge_pcmcia_80211.c |
8694 |
+@@ -113,16 +113,21 @@ static struct pcmcia_driver ssb_host_pcmcia_driver = { |
8695 |
+ .resume = ssb_host_pcmcia_resume, |
8696 |
+ }; |
8697 |
+ |
8698 |
++static int pcmcia_init_failed; |
8699 |
++ |
8700 |
+ /* |
8701 |
+ * These are not module init/exit functions! |
8702 |
+ * The module_pcmcia_driver() helper cannot be used here. |
8703 |
+ */ |
8704 |
+ int ssb_host_pcmcia_init(void) |
8705 |
+ { |
8706 |
+- return pcmcia_register_driver(&ssb_host_pcmcia_driver); |
8707 |
++ pcmcia_init_failed = pcmcia_register_driver(&ssb_host_pcmcia_driver); |
8708 |
++ |
8709 |
++ return pcmcia_init_failed; |
8710 |
+ } |
8711 |
+ |
8712 |
+ void ssb_host_pcmcia_exit(void) |
8713 |
+ { |
8714 |
+- pcmcia_unregister_driver(&ssb_host_pcmcia_driver); |
8715 |
++ if (!pcmcia_init_failed) |
8716 |
++ pcmcia_unregister_driver(&ssb_host_pcmcia_driver); |
8717 |
+ } |
8718 |
+diff --git a/drivers/staging/media/davinci_vpfe/Kconfig b/drivers/staging/media/davinci_vpfe/Kconfig |
8719 |
+index aea449a8dbf8..76818cc48ddc 100644 |
8720 |
+--- a/drivers/staging/media/davinci_vpfe/Kconfig |
8721 |
++++ b/drivers/staging/media/davinci_vpfe/Kconfig |
8722 |
+@@ -1,7 +1,7 @@ |
8723 |
+ config VIDEO_DM365_VPFE |
8724 |
+ tristate "DM365 VPFE Media Controller Capture Driver" |
8725 |
+ depends on VIDEO_V4L2 |
8726 |
+- depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || COMPILE_TEST |
8727 |
++ depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || (COMPILE_TEST && !ARCH_OMAP1) |
8728 |
+ depends on VIDEO_V4L2_SUBDEV_API |
8729 |
+ depends on VIDEO_DAVINCI_VPBE_DISPLAY |
8730 |
+ select VIDEOBUF2_DMA_CONTIG |
8731 |
+diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c |
8732 |
+index d521b3afb8b1..0b161888ec28 100644 |
8733 |
+--- a/drivers/staging/media/ipu3/ipu3.c |
8734 |
++++ b/drivers/staging/media/ipu3/ipu3.c |
8735 |
+@@ -792,7 +792,7 @@ out: |
8736 |
+ * PCI rpm framework checks the existence of driver rpm callbacks. |
8737 |
+ * Place a dummy callback here to avoid rpm going into error state. |
8738 |
+ */ |
8739 |
+-static int imgu_rpm_dummy_cb(struct device *dev) |
8740 |
++static __maybe_unused int imgu_rpm_dummy_cb(struct device *dev) |
8741 |
+ { |
8742 |
+ return 0; |
8743 |
+ } |
8744 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h |
8745 |
+index 3acfdcf83691..726bef649ba6 100644 |
8746 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus.h |
8747 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus.h |
8748 |
+@@ -28,6 +28,8 @@ |
8749 |
+ |
8750 |
+ #define CEDRUS_CAPABILITY_UNTILED BIT(0) |
8751 |
+ |
8752 |
++#define CEDRUS_QUIRK_NO_DMA_OFFSET BIT(0) |
8753 |
++ |
8754 |
+ enum cedrus_codec { |
8755 |
+ CEDRUS_CODEC_MPEG2, |
8756 |
+ |
8757 |
+@@ -91,6 +93,7 @@ struct cedrus_dec_ops { |
8758 |
+ |
8759 |
+ struct cedrus_variant { |
8760 |
+ unsigned int capabilities; |
8761 |
++ unsigned int quirks; |
8762 |
+ }; |
8763 |
+ |
8764 |
+ struct cedrus_dev { |
8765 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c |
8766 |
+index 300339fee1bc..24a06a1260f0 100644 |
8767 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c |
8768 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c |
8769 |
+@@ -177,7 +177,8 @@ int cedrus_hw_probe(struct cedrus_dev *dev) |
8770 |
+ */ |
8771 |
+ |
8772 |
+ #ifdef PHYS_PFN_OFFSET |
8773 |
+- dev->dev->dma_pfn_offset = PHYS_PFN_OFFSET; |
8774 |
++ if (!(variant->quirks & CEDRUS_QUIRK_NO_DMA_OFFSET)) |
8775 |
++ dev->dev->dma_pfn_offset = PHYS_PFN_OFFSET; |
8776 |
+ #endif |
8777 |
+ |
8778 |
+ ret = of_reserved_mem_device_init(dev->dev); |
8779 |
+diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c |
8780 |
+index 4b26ec896a96..38f9ea02ee3a 100644 |
8781 |
+--- a/drivers/staging/mt7621-mmc/sd.c |
8782 |
++++ b/drivers/staging/mt7621-mmc/sd.c |
8783 |
+@@ -468,7 +468,11 @@ static unsigned int msdc_command_start(struct msdc_host *host, |
8784 |
+ host->cmd = cmd; |
8785 |
+ host->cmd_rsp = resp; |
8786 |
+ |
8787 |
+- init_completion(&host->cmd_done); |
8788 |
++ // The completion should have been consumed by the previous command |
8789 |
++ // response handler, because the mmc requests should be serialized |
8790 |
++ if (completion_done(&host->cmd_done)) |
8791 |
++ dev_err(mmc_dev(host->mmc), |
8792 |
++ "previous command was not handled\n"); |
8793 |
+ |
8794 |
+ sdr_set_bits(host->base + MSDC_INTEN, wints); |
8795 |
+ sdc_send_cmd(rawcmd, cmd->arg); |
8796 |
+@@ -490,7 +494,6 @@ static unsigned int msdc_command_resp(struct msdc_host *host, |
8797 |
+ MSDC_INT_ACMD19_DONE; |
8798 |
+ |
8799 |
+ BUG_ON(in_interrupt()); |
8800 |
+- //init_completion(&host->cmd_done); |
8801 |
+ //sdr_set_bits(host->base + MSDC_INTEN, wints); |
8802 |
+ |
8803 |
+ spin_unlock(&host->lock); |
8804 |
+@@ -593,8 +596,6 @@ static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, |
8805 |
+ struct bd *bd; |
8806 |
+ u32 j; |
8807 |
+ |
8808 |
+- BUG_ON(sglen > MAX_BD_NUM); /* not support currently */ |
8809 |
+- |
8810 |
+ gpd = dma->gpd; |
8811 |
+ bd = dma->bd; |
8812 |
+ |
8813 |
+@@ -674,7 +675,13 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) |
8814 |
+ //msdc_clr_fifo(host); /* no need */ |
8815 |
+ |
8816 |
+ msdc_dma_on(); /* enable DMA mode first!! */ |
8817 |
+- init_completion(&host->xfer_done); |
8818 |
++ |
8819 |
++ // The completion should have been consumed by the previous |
8820 |
++ // xfer response handler, because the mmc requests should be |
8821 |
++ // serialized |
8822 |
++ if (completion_done(&host->cmd_done)) |
8823 |
++ dev_err(mmc_dev(host->mmc), |
8824 |
++ "previous transfer was not handled\n"); |
8825 |
+ |
8826 |
+ /* start the command first*/ |
8827 |
+ if (msdc_command_start(host, cmd, CMD_TIMEOUT) != 0) |
8828 |
+@@ -683,6 +690,13 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) |
8829 |
+ data->sg_count = dma_map_sg(mmc_dev(mmc), data->sg, |
8830 |
+ data->sg_len, |
8831 |
+ mmc_get_dma_dir(data)); |
8832 |
++ |
8833 |
++ if (data->sg_count == 0) { |
8834 |
++ dev_err(mmc_dev(host->mmc), "failed to map DMA for transfer\n"); |
8835 |
++ data->error = -ENOMEM; |
8836 |
++ goto done; |
8837 |
++ } |
8838 |
++ |
8839 |
+ msdc_dma_setup(host, &host->dma, data->sg, |
8840 |
+ data->sg_count); |
8841 |
+ |
8842 |
+@@ -693,7 +707,6 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) |
8843 |
+ /* for read, the data coming too fast, then CRC error |
8844 |
+ * start DMA no business with CRC. |
8845 |
+ */ |
8846 |
+- //init_completion(&host->xfer_done); |
8847 |
+ msdc_dma_start(host); |
8848 |
+ |
8849 |
+ spin_unlock(&host->lock); |
8850 |
+@@ -1688,6 +1701,8 @@ static int msdc_drv_probe(struct platform_device *pdev) |
8851 |
+ } |
8852 |
+ msdc_init_gpd_bd(host, &host->dma); |
8853 |
+ |
8854 |
++ init_completion(&host->cmd_done); |
8855 |
++ init_completion(&host->xfer_done); |
8856 |
+ INIT_DELAYED_WORK(&host->card_delaywork, msdc_tasklet_card); |
8857 |
+ spin_lock_init(&host->lock); |
8858 |
+ msdc_init_hw(host); |
8859 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |
8860 |
+index dd4898861b83..eb1e5dcb0d52 100644 |
8861 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |
8862 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |
8863 |
+@@ -209,6 +209,9 @@ vchiq_platform_init_state(struct vchiq_state *state) |
8864 |
+ struct vchiq_2835_state *platform_state; |
8865 |
+ |
8866 |
+ state->platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL); |
8867 |
++ if (!state->platform_state) |
8868 |
++ return VCHIQ_ERROR; |
8869 |
++ |
8870 |
+ platform_state = (struct vchiq_2835_state *)state->platform_state; |
8871 |
+ |
8872 |
+ platform_state->inited = 1; |
8873 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
8874 |
+index 53f5a1cb4636..819813e742d8 100644 |
8875 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
8876 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
8877 |
+@@ -2239,6 +2239,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) |
8878 |
+ local->debug[DEBUG_ENTRIES] = DEBUG_MAX; |
8879 |
+ |
8880 |
+ status = vchiq_platform_init_state(state); |
8881 |
++ if (status != VCHIQ_SUCCESS) |
8882 |
++ return VCHIQ_ERROR; |
8883 |
+ |
8884 |
+ /* |
8885 |
+ bring up slot handler thread |
8886 |
+diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c |
8887 |
+index e3fc920af682..8b7f9131e9d1 100644 |
8888 |
+--- a/drivers/thunderbolt/icm.c |
8889 |
++++ b/drivers/thunderbolt/icm.c |
8890 |
+@@ -473,6 +473,11 @@ static void add_switch(struct tb_switch *parent_sw, u64 route, |
8891 |
+ goto out; |
8892 |
+ |
8893 |
+ sw->uuid = kmemdup(uuid, sizeof(*uuid), GFP_KERNEL); |
8894 |
++ if (!sw->uuid) { |
8895 |
++ tb_sw_warn(sw, "cannot allocate memory for switch\n"); |
8896 |
++ tb_switch_put(sw); |
8897 |
++ goto out; |
8898 |
++ } |
8899 |
+ sw->connection_id = connection_id; |
8900 |
+ sw->connection_key = connection_key; |
8901 |
+ sw->link = link; |
8902 |
+diff --git a/drivers/thunderbolt/property.c b/drivers/thunderbolt/property.c |
8903 |
+index b2f0d6386cee..8c077c4f3b5b 100644 |
8904 |
+--- a/drivers/thunderbolt/property.c |
8905 |
++++ b/drivers/thunderbolt/property.c |
8906 |
+@@ -548,6 +548,11 @@ int tb_property_add_data(struct tb_property_dir *parent, const char *key, |
8907 |
+ |
8908 |
+ property->length = size / 4; |
8909 |
+ property->value.data = kzalloc(size, GFP_KERNEL); |
8910 |
++ if (!property->value.data) { |
8911 |
++ kfree(property); |
8912 |
++ return -ENOMEM; |
8913 |
++ } |
8914 |
++ |
8915 |
+ memcpy(property->value.data, buf, buflen); |
8916 |
+ |
8917 |
+ list_add_tail(&property->list, &parent->properties); |
8918 |
+@@ -578,7 +583,12 @@ int tb_property_add_text(struct tb_property_dir *parent, const char *key, |
8919 |
+ return -ENOMEM; |
8920 |
+ |
8921 |
+ property->length = size / 4; |
8922 |
+- property->value.data = kzalloc(size, GFP_KERNEL); |
8923 |
++ property->value.text = kzalloc(size, GFP_KERNEL); |
8924 |
++ if (!property->value.text) { |
8925 |
++ kfree(property); |
8926 |
++ return -ENOMEM; |
8927 |
++ } |
8928 |
++ |
8929 |
+ strcpy(property->value.text, text); |
8930 |
+ |
8931 |
+ list_add_tail(&property->list, &parent->properties); |
8932 |
+diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c |
8933 |
+index cd96994dc094..f569a2673742 100644 |
8934 |
+--- a/drivers/thunderbolt/switch.c |
8935 |
++++ b/drivers/thunderbolt/switch.c |
8936 |
+@@ -10,15 +10,13 @@ |
8937 |
+ #include <linux/idr.h> |
8938 |
+ #include <linux/nvmem-provider.h> |
8939 |
+ #include <linux/pm_runtime.h> |
8940 |
++#include <linux/sched/signal.h> |
8941 |
+ #include <linux/sizes.h> |
8942 |
+ #include <linux/slab.h> |
8943 |
+ #include <linux/vmalloc.h> |
8944 |
+ |
8945 |
+ #include "tb.h" |
8946 |
+ |
8947 |
+-/* Switch authorization from userspace is serialized by this lock */ |
8948 |
+-static DEFINE_MUTEX(switch_lock); |
8949 |
+- |
8950 |
+ /* Switch NVM support */ |
8951 |
+ |
8952 |
+ #define NVM_DEVID 0x05 |
8953 |
+@@ -254,8 +252,8 @@ static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val, |
8954 |
+ struct tb_switch *sw = priv; |
8955 |
+ int ret = 0; |
8956 |
+ |
8957 |
+- if (mutex_lock_interruptible(&switch_lock)) |
8958 |
+- return -ERESTARTSYS; |
8959 |
++ if (!mutex_trylock(&sw->tb->lock)) |
8960 |
++ return restart_syscall(); |
8961 |
+ |
8962 |
+ /* |
8963 |
+ * Since writing the NVM image might require some special steps, |
8964 |
+@@ -275,7 +273,7 @@ static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val, |
8965 |
+ memcpy(sw->nvm->buf + offset, val, bytes); |
8966 |
+ |
8967 |
+ unlock: |
8968 |
+- mutex_unlock(&switch_lock); |
8969 |
++ mutex_unlock(&sw->tb->lock); |
8970 |
+ |
8971 |
+ return ret; |
8972 |
+ } |
8973 |
+@@ -364,10 +362,7 @@ static int tb_switch_nvm_add(struct tb_switch *sw) |
8974 |
+ } |
8975 |
+ nvm->non_active = nvm_dev; |
8976 |
+ |
8977 |
+- mutex_lock(&switch_lock); |
8978 |
+ sw->nvm = nvm; |
8979 |
+- mutex_unlock(&switch_lock); |
8980 |
+- |
8981 |
+ return 0; |
8982 |
+ |
8983 |
+ err_nvm_active: |
8984 |
+@@ -384,10 +379,8 @@ static void tb_switch_nvm_remove(struct tb_switch *sw) |
8985 |
+ { |
8986 |
+ struct tb_switch_nvm *nvm; |
8987 |
+ |
8988 |
+- mutex_lock(&switch_lock); |
8989 |
+ nvm = sw->nvm; |
8990 |
+ sw->nvm = NULL; |
8991 |
+- mutex_unlock(&switch_lock); |
8992 |
+ |
8993 |
+ if (!nvm) |
8994 |
+ return; |
8995 |
+@@ -716,8 +709,8 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) |
8996 |
+ { |
8997 |
+ int ret = -EINVAL; |
8998 |
+ |
8999 |
+- if (mutex_lock_interruptible(&switch_lock)) |
9000 |
+- return -ERESTARTSYS; |
9001 |
++ if (!mutex_trylock(&sw->tb->lock)) |
9002 |
++ return restart_syscall(); |
9003 |
+ |
9004 |
+ if (sw->authorized) |
9005 |
+ goto unlock; |
9006 |
+@@ -760,7 +753,7 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) |
9007 |
+ } |
9008 |
+ |
9009 |
+ unlock: |
9010 |
+- mutex_unlock(&switch_lock); |
9011 |
++ mutex_unlock(&sw->tb->lock); |
9012 |
+ return ret; |
9013 |
+ } |
9014 |
+ |
9015 |
+@@ -817,15 +810,15 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr, |
9016 |
+ struct tb_switch *sw = tb_to_switch(dev); |
9017 |
+ ssize_t ret; |
9018 |
+ |
9019 |
+- if (mutex_lock_interruptible(&switch_lock)) |
9020 |
+- return -ERESTARTSYS; |
9021 |
++ if (!mutex_trylock(&sw->tb->lock)) |
9022 |
++ return restart_syscall(); |
9023 |
+ |
9024 |
+ if (sw->key) |
9025 |
+ ret = sprintf(buf, "%*phN\n", TB_SWITCH_KEY_SIZE, sw->key); |
9026 |
+ else |
9027 |
+ ret = sprintf(buf, "\n"); |
9028 |
+ |
9029 |
+- mutex_unlock(&switch_lock); |
9030 |
++ mutex_unlock(&sw->tb->lock); |
9031 |
+ return ret; |
9032 |
+ } |
9033 |
+ |
9034 |
+@@ -842,8 +835,8 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr, |
9035 |
+ else if (hex2bin(key, buf, sizeof(key))) |
9036 |
+ return -EINVAL; |
9037 |
+ |
9038 |
+- if (mutex_lock_interruptible(&switch_lock)) |
9039 |
+- return -ERESTARTSYS; |
9040 |
++ if (!mutex_trylock(&sw->tb->lock)) |
9041 |
++ return restart_syscall(); |
9042 |
+ |
9043 |
+ if (sw->authorized) { |
9044 |
+ ret = -EBUSY; |
9045 |
+@@ -858,7 +851,7 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr, |
9046 |
+ } |
9047 |
+ } |
9048 |
+ |
9049 |
+- mutex_unlock(&switch_lock); |
9050 |
++ mutex_unlock(&sw->tb->lock); |
9051 |
+ return ret; |
9052 |
+ } |
9053 |
+ static DEVICE_ATTR(key, 0600, key_show, key_store); |
9054 |
+@@ -904,8 +897,8 @@ static ssize_t nvm_authenticate_store(struct device *dev, |
9055 |
+ bool val; |
9056 |
+ int ret; |
9057 |
+ |
9058 |
+- if (mutex_lock_interruptible(&switch_lock)) |
9059 |
+- return -ERESTARTSYS; |
9060 |
++ if (!mutex_trylock(&sw->tb->lock)) |
9061 |
++ return restart_syscall(); |
9062 |
+ |
9063 |
+ /* If NVMem devices are not yet added */ |
9064 |
+ if (!sw->nvm) { |
9065 |
+@@ -953,7 +946,7 @@ static ssize_t nvm_authenticate_store(struct device *dev, |
9066 |
+ } |
9067 |
+ |
9068 |
+ exit_unlock: |
9069 |
+- mutex_unlock(&switch_lock); |
9070 |
++ mutex_unlock(&sw->tb->lock); |
9071 |
+ |
9072 |
+ if (ret) |
9073 |
+ return ret; |
9074 |
+@@ -967,8 +960,8 @@ static ssize_t nvm_version_show(struct device *dev, |
9075 |
+ struct tb_switch *sw = tb_to_switch(dev); |
9076 |
+ int ret; |
9077 |
+ |
9078 |
+- if (mutex_lock_interruptible(&switch_lock)) |
9079 |
+- return -ERESTARTSYS; |
9080 |
++ if (!mutex_trylock(&sw->tb->lock)) |
9081 |
++ return restart_syscall(); |
9082 |
+ |
9083 |
+ if (sw->safe_mode) |
9084 |
+ ret = -ENODATA; |
9085 |
+@@ -977,7 +970,7 @@ static ssize_t nvm_version_show(struct device *dev, |
9086 |
+ else |
9087 |
+ ret = sprintf(buf, "%x.%x\n", sw->nvm->major, sw->nvm->minor); |
9088 |
+ |
9089 |
+- mutex_unlock(&switch_lock); |
9090 |
++ mutex_unlock(&sw->tb->lock); |
9091 |
+ |
9092 |
+ return ret; |
9093 |
+ } |
9094 |
+@@ -1294,13 +1287,14 @@ int tb_switch_configure(struct tb_switch *sw) |
9095 |
+ return tb_plug_events_active(sw, true); |
9096 |
+ } |
9097 |
+ |
9098 |
+-static void tb_switch_set_uuid(struct tb_switch *sw) |
9099 |
++static int tb_switch_set_uuid(struct tb_switch *sw) |
9100 |
+ { |
9101 |
+ u32 uuid[4]; |
9102 |
+- int cap; |
9103 |
++ int cap, ret; |
9104 |
+ |
9105 |
++ ret = 0; |
9106 |
+ if (sw->uuid) |
9107 |
+- return; |
9108 |
++ return ret; |
9109 |
+ |
9110 |
+ /* |
9111 |
+ * The newer controllers include fused UUID as part of link |
9112 |
+@@ -1308,7 +1302,9 @@ static void tb_switch_set_uuid(struct tb_switch *sw) |
9113 |
+ */ |
9114 |
+ cap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER); |
9115 |
+ if (cap > 0) { |
9116 |
+- tb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4); |
9117 |
++ ret = tb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4); |
9118 |
++ if (ret) |
9119 |
++ return ret; |
9120 |
+ } else { |
9121 |
+ /* |
9122 |
+ * ICM generates UUID based on UID and fills the upper |
9123 |
+@@ -1323,6 +1319,9 @@ static void tb_switch_set_uuid(struct tb_switch *sw) |
9124 |
+ } |
9125 |
+ |
9126 |
+ sw->uuid = kmemdup(uuid, sizeof(uuid), GFP_KERNEL); |
9127 |
++ if (!sw->uuid) |
9128 |
++ ret = -ENOMEM; |
9129 |
++ return ret; |
9130 |
+ } |
9131 |
+ |
9132 |
+ static int tb_switch_add_dma_port(struct tb_switch *sw) |
9133 |
+@@ -1372,7 +1371,9 @@ static int tb_switch_add_dma_port(struct tb_switch *sw) |
9134 |
+ |
9135 |
+ if (status) { |
9136 |
+ tb_sw_info(sw, "switch flash authentication failed\n"); |
9137 |
+- tb_switch_set_uuid(sw); |
9138 |
++ ret = tb_switch_set_uuid(sw); |
9139 |
++ if (ret) |
9140 |
++ return ret; |
9141 |
+ nvm_set_auth_status(sw, status); |
9142 |
+ } |
9143 |
+ |
9144 |
+@@ -1422,7 +1423,9 @@ int tb_switch_add(struct tb_switch *sw) |
9145 |
+ } |
9146 |
+ tb_sw_dbg(sw, "uid: %#llx\n", sw->uid); |
9147 |
+ |
9148 |
+- tb_switch_set_uuid(sw); |
9149 |
++ ret = tb_switch_set_uuid(sw); |
9150 |
++ if (ret) |
9151 |
++ return ret; |
9152 |
+ |
9153 |
+ for (i = 0; i <= sw->config.max_port_number; i++) { |
9154 |
+ if (sw->ports[i].disabled) { |
9155 |
+diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h |
9156 |
+index 52584c4003e3..f5e0282225d1 100644 |
9157 |
+--- a/drivers/thunderbolt/tb.h |
9158 |
++++ b/drivers/thunderbolt/tb.h |
9159 |
+@@ -80,8 +80,7 @@ struct tb_switch_nvm { |
9160 |
+ * @depth: Depth in the chain this switch is connected (ICM only) |
9161 |
+ * |
9162 |
+ * When the switch is being added or removed to the domain (other |
9163 |
+- * switches) you need to have domain lock held. For switch authorization |
9164 |
+- * internal switch_lock is enough. |
9165 |
++ * switches) you need to have domain lock held. |
9166 |
+ */ |
9167 |
+ struct tb_switch { |
9168 |
+ struct device dev; |
9169 |
+diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c |
9170 |
+index e27dd8beb94b..e0642dcb8b9b 100644 |
9171 |
+--- a/drivers/thunderbolt/xdomain.c |
9172 |
++++ b/drivers/thunderbolt/xdomain.c |
9173 |
+@@ -740,6 +740,7 @@ static void enumerate_services(struct tb_xdomain *xd) |
9174 |
+ struct tb_service *svc; |
9175 |
+ struct tb_property *p; |
9176 |
+ struct device *dev; |
9177 |
++ int id; |
9178 |
+ |
9179 |
+ /* |
9180 |
+ * First remove all services that are not available anymore in |
9181 |
+@@ -768,7 +769,12 @@ static void enumerate_services(struct tb_xdomain *xd) |
9182 |
+ break; |
9183 |
+ } |
9184 |
+ |
9185 |
+- svc->id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); |
9186 |
++ id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); |
9187 |
++ if (id < 0) { |
9188 |
++ kfree(svc); |
9189 |
++ break; |
9190 |
++ } |
9191 |
++ svc->id = id; |
9192 |
+ svc->dev.bus = &tb_bus_type; |
9193 |
+ svc->dev.type = &tb_service_type; |
9194 |
+ svc->dev.parent = &xd->dev; |
9195 |
+diff --git a/drivers/tty/ipwireless/main.c b/drivers/tty/ipwireless/main.c |
9196 |
+index 3475e841ef5c..4c18bbfe1a92 100644 |
9197 |
+--- a/drivers/tty/ipwireless/main.c |
9198 |
++++ b/drivers/tty/ipwireless/main.c |
9199 |
+@@ -114,6 +114,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
9200 |
+ |
9201 |
+ ipw->common_memory = ioremap(p_dev->resource[2]->start, |
9202 |
+ resource_size(p_dev->resource[2])); |
9203 |
++ if (!ipw->common_memory) { |
9204 |
++ ret = -ENOMEM; |
9205 |
++ goto exit1; |
9206 |
++ } |
9207 |
+ if (!request_mem_region(p_dev->resource[2]->start, |
9208 |
+ resource_size(p_dev->resource[2]), |
9209 |
+ IPWIRELESS_PCCARD_NAME)) { |
9210 |
+@@ -134,6 +138,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
9211 |
+ |
9212 |
+ ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
9213 |
+ resource_size(p_dev->resource[3])); |
9214 |
++ if (!ipw->attr_memory) { |
9215 |
++ ret = -ENOMEM; |
9216 |
++ goto exit3; |
9217 |
++ } |
9218 |
+ if (!request_mem_region(p_dev->resource[3]->start, |
9219 |
+ resource_size(p_dev->resource[3]), |
9220 |
+ IPWIRELESS_PCCARD_NAME)) { |
9221 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
9222 |
+index 015b126ce455..a5c8bcb7723b 100644 |
9223 |
+--- a/drivers/usb/core/hcd.c |
9224 |
++++ b/drivers/usb/core/hcd.c |
9225 |
+@@ -3001,6 +3001,9 @@ usb_hcd_platform_shutdown(struct platform_device *dev) |
9226 |
+ { |
9227 |
+ struct usb_hcd *hcd = platform_get_drvdata(dev); |
9228 |
+ |
9229 |
++ /* No need for pm_runtime_put(), we're shutting down */ |
9230 |
++ pm_runtime_get_sync(&dev->dev); |
9231 |
++ |
9232 |
+ if (hcd->driver->shutdown) |
9233 |
+ hcd->driver->shutdown(hcd); |
9234 |
+ } |
9235 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
9236 |
+index 55c87be5764c..d325dd66f10e 100644 |
9237 |
+--- a/drivers/usb/core/hub.c |
9238 |
++++ b/drivers/usb/core/hub.c |
9239 |
+@@ -5864,7 +5864,10 @@ int usb_reset_device(struct usb_device *udev) |
9240 |
+ cintf->needs_binding = 1; |
9241 |
+ } |
9242 |
+ } |
9243 |
+- usb_unbind_and_rebind_marked_interfaces(udev); |
9244 |
++ |
9245 |
++ /* If the reset failed, hub_wq will unbind drivers later */ |
9246 |
++ if (ret == 0) |
9247 |
++ usb_unbind_and_rebind_marked_interfaces(udev); |
9248 |
+ } |
9249 |
+ |
9250 |
+ usb_autosuspend_device(udev); |
9251 |
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
9252 |
+index 55ef3cc2701b..f54127473239 100644 |
9253 |
+--- a/drivers/usb/dwc2/gadget.c |
9254 |
++++ b/drivers/usb/dwc2/gadget.c |
9255 |
+@@ -714,13 +714,11 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep) |
9256 |
+ unsigned int maxsize; |
9257 |
+ |
9258 |
+ if (is_isoc) |
9259 |
+- maxsize = hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT : |
9260 |
+- DEV_DMA_ISOC_RX_NBYTES_LIMIT; |
9261 |
++ maxsize = (hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT : |
9262 |
++ DEV_DMA_ISOC_RX_NBYTES_LIMIT) * |
9263 |
++ MAX_DMA_DESC_NUM_HS_ISOC; |
9264 |
+ else |
9265 |
+- maxsize = DEV_DMA_NBYTES_LIMIT; |
9266 |
+- |
9267 |
+- /* Above size of one descriptor was chosen, multiple it */ |
9268 |
+- maxsize *= MAX_DMA_DESC_NUM_GENERIC; |
9269 |
++ maxsize = DEV_DMA_NBYTES_LIMIT * MAX_DMA_DESC_NUM_GENERIC; |
9270 |
+ |
9271 |
+ return maxsize; |
9272 |
+ } |
9273 |
+@@ -903,7 +901,7 @@ static int dwc2_gadget_fill_isoc_desc(struct dwc2_hsotg_ep *hs_ep, |
9274 |
+ |
9275 |
+ /* Update index of last configured entry in the chain */ |
9276 |
+ hs_ep->next_desc++; |
9277 |
+- if (hs_ep->next_desc >= MAX_DMA_DESC_NUM_GENERIC) |
9278 |
++ if (hs_ep->next_desc >= MAX_DMA_DESC_NUM_HS_ISOC) |
9279 |
+ hs_ep->next_desc = 0; |
9280 |
+ |
9281 |
+ return 0; |
9282 |
+@@ -935,7 +933,7 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) |
9283 |
+ } |
9284 |
+ |
9285 |
+ /* Initialize descriptor chain by Host Busy status */ |
9286 |
+- for (i = 0; i < MAX_DMA_DESC_NUM_GENERIC; i++) { |
9287 |
++ for (i = 0; i < MAX_DMA_DESC_NUM_HS_ISOC; i++) { |
9288 |
+ desc = &hs_ep->desc_list[i]; |
9289 |
+ desc->status = 0; |
9290 |
+ desc->status |= (DEV_DMA_BUFF_STS_HBUSY |
9291 |
+@@ -2122,7 +2120,7 @@ static void dwc2_gadget_complete_isoc_request_ddma(struct dwc2_hsotg_ep *hs_ep) |
9292 |
+ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0); |
9293 |
+ |
9294 |
+ hs_ep->compl_desc++; |
9295 |
+- if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_GENERIC - 1)) |
9296 |
++ if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_HS_ISOC - 1)) |
9297 |
+ hs_ep->compl_desc = 0; |
9298 |
+ desc_sts = hs_ep->desc_list[hs_ep->compl_desc].status; |
9299 |
+ } |
9300 |
+@@ -3859,6 +3857,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, |
9301 |
+ unsigned int i, val, size; |
9302 |
+ int ret = 0; |
9303 |
+ unsigned char ep_type; |
9304 |
++ int desc_num; |
9305 |
+ |
9306 |
+ dev_dbg(hsotg->dev, |
9307 |
+ "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n", |
9308 |
+@@ -3905,11 +3904,15 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, |
9309 |
+ dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x from 0x%08x\n", |
9310 |
+ __func__, epctrl, epctrl_reg); |
9311 |
+ |
9312 |
++ if (using_desc_dma(hsotg) && ep_type == USB_ENDPOINT_XFER_ISOC) |
9313 |
++ desc_num = MAX_DMA_DESC_NUM_HS_ISOC; |
9314 |
++ else |
9315 |
++ desc_num = MAX_DMA_DESC_NUM_GENERIC; |
9316 |
++ |
9317 |
+ /* Allocate DMA descriptor chain for non-ctrl endpoints */ |
9318 |
+ if (using_desc_dma(hsotg) && !hs_ep->desc_list) { |
9319 |
+ hs_ep->desc_list = dmam_alloc_coherent(hsotg->dev, |
9320 |
+- MAX_DMA_DESC_NUM_GENERIC * |
9321 |
+- sizeof(struct dwc2_dma_desc), |
9322 |
++ desc_num * sizeof(struct dwc2_dma_desc), |
9323 |
+ &hs_ep->desc_list_dma, GFP_ATOMIC); |
9324 |
+ if (!hs_ep->desc_list) { |
9325 |
+ ret = -ENOMEM; |
9326 |
+@@ -4051,7 +4054,7 @@ error1: |
9327 |
+ |
9328 |
+ error2: |
9329 |
+ if (ret && using_desc_dma(hsotg) && hs_ep->desc_list) { |
9330 |
+- dmam_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC * |
9331 |
++ dmam_free_coherent(hsotg->dev, desc_num * |
9332 |
+ sizeof(struct dwc2_dma_desc), |
9333 |
+ hs_ep->desc_list, hs_ep->desc_list_dma); |
9334 |
+ hs_ep->desc_list = NULL; |
9335 |
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
9336 |
+index f944cea4056b..72110a8c49d6 100644 |
9337 |
+--- a/drivers/usb/dwc3/core.c |
9338 |
++++ b/drivers/usb/dwc3/core.c |
9339 |
+@@ -1600,6 +1600,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) |
9340 |
+ spin_lock_irqsave(&dwc->lock, flags); |
9341 |
+ dwc3_gadget_suspend(dwc); |
9342 |
+ spin_unlock_irqrestore(&dwc->lock, flags); |
9343 |
++ synchronize_irq(dwc->irq_gadget); |
9344 |
+ dwc3_core_exit(dwc); |
9345 |
+ break; |
9346 |
+ case DWC3_GCTL_PRTCAP_HOST: |
9347 |
+@@ -1632,6 +1633,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) |
9348 |
+ spin_lock_irqsave(&dwc->lock, flags); |
9349 |
+ dwc3_gadget_suspend(dwc); |
9350 |
+ spin_unlock_irqrestore(&dwc->lock, flags); |
9351 |
++ synchronize_irq(dwc->irq_gadget); |
9352 |
+ } |
9353 |
+ |
9354 |
+ dwc3_otg_exit(dwc); |
9355 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
9356 |
+index 9f941cdb0691..1227e8f5a5c8 100644 |
9357 |
+--- a/drivers/usb/dwc3/gadget.c |
9358 |
++++ b/drivers/usb/dwc3/gadget.c |
9359 |
+@@ -3385,8 +3385,6 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) |
9360 |
+ dwc3_disconnect_gadget(dwc); |
9361 |
+ __dwc3_gadget_stop(dwc); |
9362 |
+ |
9363 |
+- synchronize_irq(dwc->irq_gadget); |
9364 |
+- |
9365 |
+ return 0; |
9366 |
+ } |
9367 |
+ |
9368 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
9369 |
+index 0f8d16de7a37..768230795bb2 100644 |
9370 |
+--- a/drivers/usb/gadget/function/f_fs.c |
9371 |
++++ b/drivers/usb/gadget/function/f_fs.c |
9372 |
+@@ -1133,7 +1133,8 @@ error_lock: |
9373 |
+ error_mutex: |
9374 |
+ mutex_unlock(&epfile->mutex); |
9375 |
+ error: |
9376 |
+- ffs_free_buffer(io_data); |
9377 |
++ if (ret != -EIOCBQUEUED) /* don't free if there is iocb queued */ |
9378 |
++ ffs_free_buffer(io_data); |
9379 |
+ return ret; |
9380 |
+ } |
9381 |
+ |
9382 |
+diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c |
9383 |
+index 68a113594808..2811c4afde01 100644 |
9384 |
+--- a/drivers/video/fbdev/core/fbcmap.c |
9385 |
++++ b/drivers/video/fbdev/core/fbcmap.c |
9386 |
+@@ -94,6 +94,8 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags) |
9387 |
+ int size = len * sizeof(u16); |
9388 |
+ int ret = -ENOMEM; |
9389 |
+ |
9390 |
++ flags |= __GFP_NOWARN; |
9391 |
++ |
9392 |
+ if (cmap->len != len) { |
9393 |
+ fb_dealloc_cmap(cmap); |
9394 |
+ if (!len) |
9395 |
+diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c |
9396 |
+index 283d9307df21..ac049871704d 100644 |
9397 |
+--- a/drivers/video/fbdev/core/modedb.c |
9398 |
++++ b/drivers/video/fbdev/core/modedb.c |
9399 |
+@@ -935,6 +935,9 @@ void fb_var_to_videomode(struct fb_videomode *mode, |
9400 |
+ if (var->vmode & FB_VMODE_DOUBLE) |
9401 |
+ vtotal *= 2; |
9402 |
+ |
9403 |
++ if (!htotal || !vtotal) |
9404 |
++ return; |
9405 |
++ |
9406 |
+ hfreq = pixclock/htotal; |
9407 |
+ mode->refresh = hfreq/vtotal; |
9408 |
+ } |
9409 |
+diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c |
9410 |
+index fd02e8a4841d..9f39f0c360e0 100644 |
9411 |
+--- a/drivers/video/fbdev/efifb.c |
9412 |
++++ b/drivers/video/fbdev/efifb.c |
9413 |
+@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev) |
9414 |
+ info->apertures->ranges[0].base = efifb_fix.smem_start; |
9415 |
+ info->apertures->ranges[0].size = size_remap; |
9416 |
+ |
9417 |
+- if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) { |
9418 |
++ if (efi_enabled(EFI_BOOT) && |
9419 |
++ !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) { |
9420 |
+ if ((efifb_fix.smem_start + efifb_fix.smem_len) > |
9421 |
+ (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) { |
9422 |
+ pr_err("efifb: video memory @ 0x%lx spans multiple EFI memory regions\n", |
9423 |
+diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c |
9424 |
+index 0364d3329c52..3516ce6718d9 100644 |
9425 |
+--- a/drivers/w1/w1_io.c |
9426 |
++++ b/drivers/w1/w1_io.c |
9427 |
+@@ -432,8 +432,7 @@ int w1_reset_resume_command(struct w1_master *dev) |
9428 |
+ if (w1_reset_bus(dev)) |
9429 |
+ return -1; |
9430 |
+ |
9431 |
+- /* This will make only the last matched slave perform a skip ROM. */ |
9432 |
+- w1_write_8(dev, W1_RESUME_CMD); |
9433 |
++ w1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM); |
9434 |
+ return 0; |
9435 |
+ } |
9436 |
+ EXPORT_SYMBOL_GPL(w1_reset_resume_command); |
9437 |
+diff --git a/drivers/xen/biomerge.c b/drivers/xen/biomerge.c |
9438 |
+index f3fbb700f569..05a286d24f14 100644 |
9439 |
+--- a/drivers/xen/biomerge.c |
9440 |
++++ b/drivers/xen/biomerge.c |
9441 |
+@@ -4,12 +4,13 @@ |
9442 |
+ #include <xen/xen.h> |
9443 |
+ #include <xen/page.h> |
9444 |
+ |
9445 |
++/* check if @page can be merged with 'vec1' */ |
9446 |
+ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, |
9447 |
+- const struct bio_vec *vec2) |
9448 |
++ const struct page *page) |
9449 |
+ { |
9450 |
+ #if XEN_PAGE_SIZE == PAGE_SIZE |
9451 |
+ unsigned long bfn1 = pfn_to_bfn(page_to_pfn(vec1->bv_page)); |
9452 |
+- unsigned long bfn2 = pfn_to_bfn(page_to_pfn(vec2->bv_page)); |
9453 |
++ unsigned long bfn2 = pfn_to_bfn(page_to_pfn(page)); |
9454 |
+ |
9455 |
+ return bfn1 + PFN_DOWN(vec1->bv_offset + vec1->bv_len) == bfn2; |
9456 |
+ #else |
9457 |
+diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c |
9458 |
+index a2cdf25573e2..706801c6c4c4 100644 |
9459 |
+--- a/fs/afs/xattr.c |
9460 |
++++ b/fs/afs/xattr.c |
9461 |
+@@ -69,11 +69,20 @@ static int afs_xattr_get_fid(const struct xattr_handler *handler, |
9462 |
+ void *buffer, size_t size) |
9463 |
+ { |
9464 |
+ struct afs_vnode *vnode = AFS_FS_I(inode); |
9465 |
+- char text[8 + 1 + 8 + 1 + 8 + 1]; |
9466 |
++ char text[16 + 1 + 24 + 1 + 8 + 1]; |
9467 |
+ size_t len; |
9468 |
+ |
9469 |
+- len = sprintf(text, "%llx:%llx:%x", |
9470 |
+- vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); |
9471 |
++ /* The volume ID is 64-bit, the vnode ID is 96-bit and the |
9472 |
++ * uniquifier is 32-bit. |
9473 |
++ */ |
9474 |
++ len = sprintf(text, "%llx:", vnode->fid.vid); |
9475 |
++ if (vnode->fid.vnode_hi) |
9476 |
++ len += sprintf(text + len, "%x%016llx", |
9477 |
++ vnode->fid.vnode_hi, vnode->fid.vnode); |
9478 |
++ else |
9479 |
++ len += sprintf(text + len, "%llx", vnode->fid.vnode); |
9480 |
++ len += sprintf(text + len, ":%x", vnode->fid.unique); |
9481 |
++ |
9482 |
+ if (size == 0) |
9483 |
+ return len; |
9484 |
+ if (len > size) |
9485 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
9486 |
+index ef66db38cedb..efe4d4080a21 100644 |
9487 |
+--- a/fs/btrfs/backref.c |
9488 |
++++ b/fs/btrfs/backref.c |
9489 |
+@@ -712,7 +712,7 @@ out: |
9490 |
+ * read tree blocks and add keys where required. |
9491 |
+ */ |
9492 |
+ static int add_missing_keys(struct btrfs_fs_info *fs_info, |
9493 |
+- struct preftrees *preftrees) |
9494 |
++ struct preftrees *preftrees, bool lock) |
9495 |
+ { |
9496 |
+ struct prelim_ref *ref; |
9497 |
+ struct extent_buffer *eb; |
9498 |
+@@ -737,12 +737,14 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info, |
9499 |
+ free_extent_buffer(eb); |
9500 |
+ return -EIO; |
9501 |
+ } |
9502 |
+- btrfs_tree_read_lock(eb); |
9503 |
++ if (lock) |
9504 |
++ btrfs_tree_read_lock(eb); |
9505 |
+ if (btrfs_header_level(eb) == 0) |
9506 |
+ btrfs_item_key_to_cpu(eb, &ref->key_for_search, 0); |
9507 |
+ else |
9508 |
+ btrfs_node_key_to_cpu(eb, &ref->key_for_search, 0); |
9509 |
+- btrfs_tree_read_unlock(eb); |
9510 |
++ if (lock) |
9511 |
++ btrfs_tree_read_unlock(eb); |
9512 |
+ free_extent_buffer(eb); |
9513 |
+ prelim_ref_insert(fs_info, &preftrees->indirect, ref, NULL); |
9514 |
+ cond_resched(); |
9515 |
+@@ -1227,7 +1229,7 @@ again: |
9516 |
+ |
9517 |
+ btrfs_release_path(path); |
9518 |
+ |
9519 |
+- ret = add_missing_keys(fs_info, &preftrees); |
9520 |
++ ret = add_missing_keys(fs_info, &preftrees, path->skip_locking == 0); |
9521 |
+ if (ret) |
9522 |
+ goto out; |
9523 |
+ |
9524 |
+@@ -1288,11 +1290,14 @@ again: |
9525 |
+ ret = -EIO; |
9526 |
+ goto out; |
9527 |
+ } |
9528 |
+- btrfs_tree_read_lock(eb); |
9529 |
+- btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); |
9530 |
++ if (!path->skip_locking) { |
9531 |
++ btrfs_tree_read_lock(eb); |
9532 |
++ btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); |
9533 |
++ } |
9534 |
+ ret = find_extent_in_eb(eb, bytenr, |
9535 |
+ *extent_item_pos, &eie, ignore_offset); |
9536 |
+- btrfs_tree_read_unlock_blocking(eb); |
9537 |
++ if (!path->skip_locking) |
9538 |
++ btrfs_tree_read_unlock_blocking(eb); |
9539 |
+ free_extent_buffer(eb); |
9540 |
+ if (ret < 0) |
9541 |
+ goto out; |
9542 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
9543 |
+index a19bbfce449e..e4772b90dad0 100644 |
9544 |
+--- a/fs/btrfs/extent-tree.c |
9545 |
++++ b/fs/btrfs/extent-tree.c |
9546 |
+@@ -3985,8 +3985,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags) |
9547 |
+ info->space_info_kobj, "%s", |
9548 |
+ alloc_name(space_info->flags)); |
9549 |
+ if (ret) { |
9550 |
+- percpu_counter_destroy(&space_info->total_bytes_pinned); |
9551 |
+- kfree(space_info); |
9552 |
++ kobject_put(&space_info->kobj); |
9553 |
+ return ret; |
9554 |
+ } |
9555 |
+ |
9556 |
+@@ -11192,9 +11191,9 @@ int btrfs_error_unpin_extent_range(struct btrfs_fs_info *fs_info, |
9557 |
+ * held back allocations. |
9558 |
+ */ |
9559 |
+ static int btrfs_trim_free_extents(struct btrfs_device *device, |
9560 |
+- struct fstrim_range *range, u64 *trimmed) |
9561 |
++ u64 minlen, u64 *trimmed) |
9562 |
+ { |
9563 |
+- u64 start = range->start, len = 0; |
9564 |
++ u64 start = 0, len = 0; |
9565 |
+ int ret; |
9566 |
+ |
9567 |
+ *trimmed = 0; |
9568 |
+@@ -11237,8 +11236,8 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
9569 |
+ if (!trans) |
9570 |
+ up_read(&fs_info->commit_root_sem); |
9571 |
+ |
9572 |
+- ret = find_free_dev_extent_start(trans, device, range->minlen, |
9573 |
+- start, &start, &len); |
9574 |
++ ret = find_free_dev_extent_start(trans, device, minlen, start, |
9575 |
++ &start, &len); |
9576 |
+ if (trans) { |
9577 |
+ up_read(&fs_info->commit_root_sem); |
9578 |
+ btrfs_put_transaction(trans); |
9579 |
+@@ -11251,16 +11250,6 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
9580 |
+ break; |
9581 |
+ } |
9582 |
+ |
9583 |
+- /* If we are out of the passed range break */ |
9584 |
+- if (start > range->start + range->len - 1) { |
9585 |
+- mutex_unlock(&fs_info->chunk_mutex); |
9586 |
+- ret = 0; |
9587 |
+- break; |
9588 |
+- } |
9589 |
+- |
9590 |
+- start = max(range->start, start); |
9591 |
+- len = min(range->len, len); |
9592 |
+- |
9593 |
+ ret = btrfs_issue_discard(device->bdev, start, len, &bytes); |
9594 |
+ mutex_unlock(&fs_info->chunk_mutex); |
9595 |
+ |
9596 |
+@@ -11270,10 +11259,6 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
9597 |
+ start += len; |
9598 |
+ *trimmed += bytes; |
9599 |
+ |
9600 |
+- /* We've trimmed enough */ |
9601 |
+- if (*trimmed >= range->len) |
9602 |
+- break; |
9603 |
+- |
9604 |
+ if (fatal_signal_pending(current)) { |
9605 |
+ ret = -ERESTARTSYS; |
9606 |
+ break; |
9607 |
+@@ -11357,7 +11342,8 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) |
9608 |
+ mutex_lock(&fs_info->fs_devices->device_list_mutex); |
9609 |
+ devices = &fs_info->fs_devices->devices; |
9610 |
+ list_for_each_entry(device, devices, dev_list) { |
9611 |
+- ret = btrfs_trim_free_extents(device, range, &group_trimmed); |
9612 |
++ ret = btrfs_trim_free_extents(device, range->minlen, |
9613 |
++ &group_trimmed); |
9614 |
+ if (ret) { |
9615 |
+ dev_failed++; |
9616 |
+ dev_ret = ret; |
9617 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
9618 |
+index d38dc8c31533..7f082b019766 100644 |
9619 |
+--- a/fs/btrfs/file.c |
9620 |
++++ b/fs/btrfs/file.c |
9621 |
+@@ -2058,6 +2058,18 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
9622 |
+ int ret = 0, err; |
9623 |
+ u64 len; |
9624 |
+ |
9625 |
++ /* |
9626 |
++ * If the inode needs a full sync, make sure we use a full range to |
9627 |
++ * avoid log tree corruption, due to hole detection racing with ordered |
9628 |
++ * extent completion for adjacent ranges, and assertion failures during |
9629 |
++ * hole detection. |
9630 |
++ */ |
9631 |
++ if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |
9632 |
++ &BTRFS_I(inode)->runtime_flags)) { |
9633 |
++ start = 0; |
9634 |
++ end = LLONG_MAX; |
9635 |
++ } |
9636 |
++ |
9637 |
+ /* |
9638 |
+ * The range length can be represented by u64, we have to do the typecasts |
9639 |
+ * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() |
9640 |
+@@ -2546,10 +2558,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) |
9641 |
+ |
9642 |
+ ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend, |
9643 |
+ &cached_state); |
9644 |
+- if (ret) { |
9645 |
+- inode_unlock(inode); |
9646 |
++ if (ret) |
9647 |
+ goto out_only_mutex; |
9648 |
+- } |
9649 |
+ |
9650 |
+ path = btrfs_alloc_path(); |
9651 |
+ if (!path) { |
9652 |
+@@ -3132,6 +3142,7 @@ static long btrfs_fallocate(struct file *file, int mode, |
9653 |
+ ret = btrfs_qgroup_reserve_data(inode, &data_reserved, |
9654 |
+ cur_offset, last_byte - cur_offset); |
9655 |
+ if (ret < 0) { |
9656 |
++ cur_offset = last_byte; |
9657 |
+ free_extent_map(em); |
9658 |
+ break; |
9659 |
+ } |
9660 |
+@@ -3181,7 +3192,7 @@ out: |
9661 |
+ /* Let go of our reservation. */ |
9662 |
+ if (ret != 0 && !(mode & FALLOC_FL_ZERO_RANGE)) |
9663 |
+ btrfs_free_reserved_data_space(inode, data_reserved, |
9664 |
+- alloc_start, alloc_end - cur_offset); |
9665 |
++ cur_offset, alloc_end - cur_offset); |
9666 |
+ extent_changeset_free(data_reserved); |
9667 |
+ return ret; |
9668 |
+ } |
9669 |
+diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c |
9670 |
+index 272b287f8cf0..0395b8233c90 100644 |
9671 |
+--- a/fs/btrfs/relocation.c |
9672 |
++++ b/fs/btrfs/relocation.c |
9673 |
+@@ -4271,27 +4271,36 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) |
9674 |
+ mutex_lock(&fs_info->cleaner_mutex); |
9675 |
+ ret = relocate_block_group(rc); |
9676 |
+ mutex_unlock(&fs_info->cleaner_mutex); |
9677 |
+- if (ret < 0) { |
9678 |
++ if (ret < 0) |
9679 |
+ err = ret; |
9680 |
+- goto out; |
9681 |
+- } |
9682 |
+- |
9683 |
+- if (rc->extents_found == 0) |
9684 |
+- break; |
9685 |
+- |
9686 |
+- btrfs_info(fs_info, "found %llu extents", rc->extents_found); |
9687 |
+ |
9688 |
++ /* |
9689 |
++ * We may have gotten ENOSPC after we already dirtied some |
9690 |
++ * extents. If writeout happens while we're relocating a |
9691 |
++ * different block group we could end up hitting the |
9692 |
++ * BUG_ON(rc->stage == UPDATE_DATA_PTRS) in |
9693 |
++ * btrfs_reloc_cow_block. Make sure we write everything out |
9694 |
++ * properly so we don't trip over this problem, and then break |
9695 |
++ * out of the loop if we hit an error. |
9696 |
++ */ |
9697 |
+ if (rc->stage == MOVE_DATA_EXTENTS && rc->found_file_extent) { |
9698 |
+ ret = btrfs_wait_ordered_range(rc->data_inode, 0, |
9699 |
+ (u64)-1); |
9700 |
+- if (ret) { |
9701 |
++ if (ret) |
9702 |
+ err = ret; |
9703 |
+- goto out; |
9704 |
+- } |
9705 |
+ invalidate_mapping_pages(rc->data_inode->i_mapping, |
9706 |
+ 0, -1); |
9707 |
+ rc->stage = UPDATE_DATA_PTRS; |
9708 |
+ } |
9709 |
++ |
9710 |
++ if (err < 0) |
9711 |
++ goto out; |
9712 |
++ |
9713 |
++ if (rc->extents_found == 0) |
9714 |
++ break; |
9715 |
++ |
9716 |
++ btrfs_info(fs_info, "found %llu extents", rc->extents_found); |
9717 |
++ |
9718 |
+ } |
9719 |
+ |
9720 |
+ WARN_ON(rc->block_group->pinned > 0); |
9721 |
+diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c |
9722 |
+index 65bda0682928..3228d3b3084a 100644 |
9723 |
+--- a/fs/btrfs/root-tree.c |
9724 |
++++ b/fs/btrfs/root-tree.c |
9725 |
+@@ -132,16 +132,17 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root |
9726 |
+ return -ENOMEM; |
9727 |
+ |
9728 |
+ ret = btrfs_search_slot(trans, root, key, path, 0, 1); |
9729 |
+- if (ret < 0) { |
9730 |
+- btrfs_abort_transaction(trans, ret); |
9731 |
++ if (ret < 0) |
9732 |
+ goto out; |
9733 |
+- } |
9734 |
+ |
9735 |
+- if (ret != 0) { |
9736 |
+- btrfs_print_leaf(path->nodes[0]); |
9737 |
+- btrfs_crit(fs_info, "unable to update root key %llu %u %llu", |
9738 |
+- key->objectid, key->type, key->offset); |
9739 |
+- BUG_ON(1); |
9740 |
++ if (ret > 0) { |
9741 |
++ btrfs_crit(fs_info, |
9742 |
++ "unable to find root key (%llu %u %llu) in tree %llu", |
9743 |
++ key->objectid, key->type, key->offset, |
9744 |
++ root->root_key.objectid); |
9745 |
++ ret = -EUCLEAN; |
9746 |
++ btrfs_abort_transaction(trans, ret); |
9747 |
++ goto out; |
9748 |
+ } |
9749 |
+ |
9750 |
+ l = path->nodes[0]; |
9751 |
+diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c |
9752 |
+index 5a5930e3d32b..2f078b77fe14 100644 |
9753 |
+--- a/fs/btrfs/sysfs.c |
9754 |
++++ b/fs/btrfs/sysfs.c |
9755 |
+@@ -825,7 +825,12 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs, |
9756 |
+ fs_devs->fsid_kobj.kset = btrfs_kset; |
9757 |
+ error = kobject_init_and_add(&fs_devs->fsid_kobj, |
9758 |
+ &btrfs_ktype, parent, "%pU", fs_devs->fsid); |
9759 |
+- return error; |
9760 |
++ if (error) { |
9761 |
++ kobject_put(&fs_devs->fsid_kobj); |
9762 |
++ return error; |
9763 |
++ } |
9764 |
++ |
9765 |
++ return 0; |
9766 |
+ } |
9767 |
+ |
9768 |
+ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info) |
9769 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
9770 |
+index 7f3b74a55073..1a1b4fa503f8 100644 |
9771 |
+--- a/fs/btrfs/tree-log.c |
9772 |
++++ b/fs/btrfs/tree-log.c |
9773 |
+@@ -4106,6 +4106,7 @@ fill_holes: |
9774 |
+ *last_extent, 0, |
9775 |
+ 0, len, 0, len, |
9776 |
+ 0, 0, 0); |
9777 |
++ *last_extent += len; |
9778 |
+ } |
9779 |
+ } |
9780 |
+ } |
9781 |
+diff --git a/fs/char_dev.c b/fs/char_dev.c |
9782 |
+index a279c58fe360..8a63cfa29005 100644 |
9783 |
+--- a/fs/char_dev.c |
9784 |
++++ b/fs/char_dev.c |
9785 |
+@@ -159,6 +159,12 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, |
9786 |
+ ret = -EBUSY; |
9787 |
+ goto out; |
9788 |
+ } |
9789 |
++ |
9790 |
++ if (new_min < old_min && new_max > old_max) { |
9791 |
++ ret = -EBUSY; |
9792 |
++ goto out; |
9793 |
++ } |
9794 |
++ |
9795 |
+ } |
9796 |
+ |
9797 |
+ cd->next = *cp; |
9798 |
+diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h |
9799 |
+index 10ead04346ee..8c295e37ac23 100644 |
9800 |
+--- a/fs/cifs/cifsglob.h |
9801 |
++++ b/fs/cifs/cifsglob.h |
9802 |
+@@ -1657,6 +1657,7 @@ static inline bool is_retryable_error(int error) |
9803 |
+ |
9804 |
+ #define CIFS_HAS_CREDITS 0x0400 /* already has credits */ |
9805 |
+ #define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */ |
9806 |
++#define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */ |
9807 |
+ |
9808 |
+ /* Security Flags: indicate type of session setup needed */ |
9809 |
+ #define CIFSSEC_MAY_SIGN 0x00001 |
9810 |
+diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c |
9811 |
+index 551924beb86f..f91e714928d4 100644 |
9812 |
+--- a/fs/cifs/cifssmb.c |
9813 |
++++ b/fs/cifs/cifssmb.c |
9814 |
+@@ -2533,7 +2533,7 @@ CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon, |
9815 |
+ |
9816 |
+ if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { |
9817 |
+ /* no response expected */ |
9818 |
+- flags = CIFS_ASYNC_OP | CIFS_OBREAK_OP; |
9819 |
++ flags = CIFS_NO_SRV_RSP | CIFS_ASYNC_OP | CIFS_OBREAK_OP; |
9820 |
+ pSMB->Timeout = 0; |
9821 |
+ } else if (waitFlag) { |
9822 |
+ flags = CIFS_BLOCKING_OP; /* blocking operation, no timeout */ |
9823 |
+diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c |
9824 |
+index 9544eb99b5a2..95f3be904eed 100644 |
9825 |
+--- a/fs/cifs/transport.c |
9826 |
++++ b/fs/cifs/transport.c |
9827 |
+@@ -906,8 +906,11 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
9828 |
+ |
9829 |
+ mutex_unlock(&ses->server->srv_mutex); |
9830 |
+ |
9831 |
+- if (rc < 0) { |
9832 |
+- /* Sending failed for some reason - return credits back */ |
9833 |
++ /* |
9834 |
++ * If sending failed for some reason or it is an oplock break that we |
9835 |
++ * will not receive a response to - return credits back |
9836 |
++ */ |
9837 |
++ if (rc < 0 || (flags & CIFS_NO_SRV_RSP)) { |
9838 |
+ for (i = 0; i < num_rqst; i++) |
9839 |
+ add_credits(ses->server, credits[i], optype); |
9840 |
+ goto out; |
9841 |
+@@ -928,9 +931,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
9842 |
+ smb311_update_preauth_hash(ses, rqst[0].rq_iov, |
9843 |
+ rqst[0].rq_nvec); |
9844 |
+ |
9845 |
+- if (timeout == CIFS_ASYNC_OP) |
9846 |
+- goto out; |
9847 |
+- |
9848 |
+ for (i = 0; i < num_rqst; i++) { |
9849 |
+ rc = wait_for_response(ses->server, midQ[i]); |
9850 |
+ if (rc != 0) |
9851 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
9852 |
+index 878f8b5dd39f..d3ca3b221e21 100644 |
9853 |
+--- a/fs/ext4/inode.c |
9854 |
++++ b/fs/ext4/inode.c |
9855 |
+@@ -5627,25 +5627,22 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) |
9856 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
9857 |
+ ext4_journal_stop(handle); |
9858 |
+ if (error) { |
9859 |
+- if (orphan) |
9860 |
++ if (orphan && inode->i_nlink) |
9861 |
+ ext4_orphan_del(NULL, inode); |
9862 |
+ goto err_out; |
9863 |
+ } |
9864 |
+ } |
9865 |
+- if (!shrink) |
9866 |
++ if (!shrink) { |
9867 |
+ pagecache_isize_extended(inode, oldsize, inode->i_size); |
9868 |
+- |
9869 |
+- /* |
9870 |
+- * Blocks are going to be removed from the inode. Wait |
9871 |
+- * for dio in flight. Temporarily disable |
9872 |
+- * dioread_nolock to prevent livelock. |
9873 |
+- */ |
9874 |
+- if (orphan) { |
9875 |
+- if (!ext4_should_journal_data(inode)) { |
9876 |
+- inode_dio_wait(inode); |
9877 |
+- } else |
9878 |
+- ext4_wait_for_tail_page_commit(inode); |
9879 |
++ } else { |
9880 |
++ /* |
9881 |
++ * Blocks are going to be removed from the inode. Wait |
9882 |
++ * for dio in flight. |
9883 |
++ */ |
9884 |
++ inode_dio_wait(inode); |
9885 |
+ } |
9886 |
++ if (orphan && ext4_should_journal_data(inode)) |
9887 |
++ ext4_wait_for_tail_page_commit(inode); |
9888 |
+ down_write(&EXT4_I(inode)->i_mmap_sem); |
9889 |
+ |
9890 |
+ rc = ext4_break_layouts(inode); |
9891 |
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
9892 |
+index 4b038f25f256..c925e9ec68f4 100644 |
9893 |
+--- a/fs/gfs2/glock.c |
9894 |
++++ b/fs/gfs2/glock.c |
9895 |
+@@ -140,6 +140,7 @@ void gfs2_glock_free(struct gfs2_glock *gl) |
9896 |
+ { |
9897 |
+ struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
9898 |
+ |
9899 |
++ BUG_ON(atomic_read(&gl->gl_revokes)); |
9900 |
+ rhashtable_remove_fast(&gl_hash_table, &gl->gl_node, ht_parms); |
9901 |
+ smp_mb(); |
9902 |
+ wake_up_glock(gl); |
9903 |
+@@ -183,15 +184,19 @@ static int demote_ok(const struct gfs2_glock *gl) |
9904 |
+ |
9905 |
+ void gfs2_glock_add_to_lru(struct gfs2_glock *gl) |
9906 |
+ { |
9907 |
++ if (!(gl->gl_ops->go_flags & GLOF_LRU)) |
9908 |
++ return; |
9909 |
++ |
9910 |
+ spin_lock(&lru_lock); |
9911 |
+ |
9912 |
+- if (!list_empty(&gl->gl_lru)) |
9913 |
+- list_del_init(&gl->gl_lru); |
9914 |
+- else |
9915 |
++ list_del(&gl->gl_lru); |
9916 |
++ list_add_tail(&gl->gl_lru, &lru_list); |
9917 |
++ |
9918 |
++ if (!test_bit(GLF_LRU, &gl->gl_flags)) { |
9919 |
++ set_bit(GLF_LRU, &gl->gl_flags); |
9920 |
+ atomic_inc(&lru_count); |
9921 |
++ } |
9922 |
+ |
9923 |
+- list_add_tail(&gl->gl_lru, &lru_list); |
9924 |
+- set_bit(GLF_LRU, &gl->gl_flags); |
9925 |
+ spin_unlock(&lru_lock); |
9926 |
+ } |
9927 |
+ |
9928 |
+@@ -201,7 +206,7 @@ static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) |
9929 |
+ return; |
9930 |
+ |
9931 |
+ spin_lock(&lru_lock); |
9932 |
+- if (!list_empty(&gl->gl_lru)) { |
9933 |
++ if (test_bit(GLF_LRU, &gl->gl_flags)) { |
9934 |
+ list_del_init(&gl->gl_lru); |
9935 |
+ atomic_dec(&lru_count); |
9936 |
+ clear_bit(GLF_LRU, &gl->gl_flags); |
9937 |
+@@ -1159,8 +1164,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh) |
9938 |
+ !test_bit(GLF_DEMOTE, &gl->gl_flags)) |
9939 |
+ fast_path = 1; |
9940 |
+ } |
9941 |
+- if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl) && |
9942 |
+- (glops->go_flags & GLOF_LRU)) |
9943 |
++ if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl)) |
9944 |
+ gfs2_glock_add_to_lru(gl); |
9945 |
+ |
9946 |
+ trace_gfs2_glock_queue(gh, 0); |
9947 |
+@@ -1456,6 +1460,7 @@ __acquires(&lru_lock) |
9948 |
+ if (!spin_trylock(&gl->gl_lockref.lock)) { |
9949 |
+ add_back_to_lru: |
9950 |
+ list_add(&gl->gl_lru, &lru_list); |
9951 |
++ set_bit(GLF_LRU, &gl->gl_flags); |
9952 |
+ atomic_inc(&lru_count); |
9953 |
+ continue; |
9954 |
+ } |
9955 |
+@@ -1463,7 +1468,6 @@ add_back_to_lru: |
9956 |
+ spin_unlock(&gl->gl_lockref.lock); |
9957 |
+ goto add_back_to_lru; |
9958 |
+ } |
9959 |
+- clear_bit(GLF_LRU, &gl->gl_flags); |
9960 |
+ gl->gl_lockref.count++; |
9961 |
+ if (demote_ok(gl)) |
9962 |
+ handle_callback(gl, LM_ST_UNLOCKED, 0, false); |
9963 |
+@@ -1498,6 +1502,7 @@ static long gfs2_scan_glock_lru(int nr) |
9964 |
+ if (!test_bit(GLF_LOCK, &gl->gl_flags)) { |
9965 |
+ list_move(&gl->gl_lru, &dispose); |
9966 |
+ atomic_dec(&lru_count); |
9967 |
++ clear_bit(GLF_LRU, &gl->gl_flags); |
9968 |
+ freed++; |
9969 |
+ continue; |
9970 |
+ } |
9971 |
+diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h |
9972 |
+index e10e0b0a7cd5..e1a33d288121 100644 |
9973 |
+--- a/fs/gfs2/incore.h |
9974 |
++++ b/fs/gfs2/incore.h |
9975 |
+@@ -621,6 +621,7 @@ enum { |
9976 |
+ SDF_SKIP_DLM_UNLOCK = 8, |
9977 |
+ SDF_FORCE_AIL_FLUSH = 9, |
9978 |
+ SDF_AIL1_IO_ERROR = 10, |
9979 |
++ SDF_FS_FROZEN = 11, |
9980 |
+ }; |
9981 |
+ |
9982 |
+ enum gfs2_freeze_state { |
9983 |
+diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c |
9984 |
+index 31df26ed7854..69bd1597bacf 100644 |
9985 |
+--- a/fs/gfs2/lock_dlm.c |
9986 |
++++ b/fs/gfs2/lock_dlm.c |
9987 |
+@@ -31,9 +31,10 @@ |
9988 |
+ * @delta is the difference between the current rtt sample and the |
9989 |
+ * running average srtt. We add 1/8 of that to the srtt in order to |
9990 |
+ * update the current srtt estimate. The variance estimate is a bit |
9991 |
+- * more complicated. We subtract the abs value of the @delta from |
9992 |
+- * the current variance estimate and add 1/4 of that to the running |
9993 |
+- * total. |
9994 |
++ * more complicated. We subtract the current variance estimate from |
9995 |
++ * the abs value of the @delta and add 1/4 of that to the running |
9996 |
++ * total. That's equivalent to 3/4 of the current variance |
9997 |
++ * estimate plus 1/4 of the abs of @delta. |
9998 |
+ * |
9999 |
+ * Note that the index points at the array entry containing the smoothed |
10000 |
+ * mean value, and the variance is always in the following entry |
10001 |
+@@ -49,7 +50,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index, |
10002 |
+ s64 delta = sample - s->stats[index]; |
10003 |
+ s->stats[index] += (delta >> 3); |
10004 |
+ index++; |
10005 |
+- s->stats[index] += ((abs(delta) - s->stats[index]) >> 2); |
10006 |
++ s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2; |
10007 |
+ } |
10008 |
+ |
10009 |
+ /** |
10010 |
+diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
10011 |
+index b8830fda51e8..0e04f87a7ddd 100644 |
10012 |
+--- a/fs/gfs2/log.c |
10013 |
++++ b/fs/gfs2/log.c |
10014 |
+@@ -606,7 +606,8 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) |
10015 |
+ gfs2_remove_from_ail(bd); /* drops ref on bh */ |
10016 |
+ bd->bd_bh = NULL; |
10017 |
+ sdp->sd_log_num_revoke++; |
10018 |
+- atomic_inc(&gl->gl_revokes); |
10019 |
++ if (atomic_inc_return(&gl->gl_revokes) == 1) |
10020 |
++ gfs2_glock_hold(gl); |
10021 |
+ set_bit(GLF_LFLUSH, &gl->gl_flags); |
10022 |
+ list_add(&bd->bd_list, &sdp->sd_log_le_revoke); |
10023 |
+ } |
10024 |
+diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c |
10025 |
+index 2295042bc625..f09cd5d8ac63 100644 |
10026 |
+--- a/fs/gfs2/lops.c |
10027 |
++++ b/fs/gfs2/lops.c |
10028 |
+@@ -667,8 +667,10 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
10029 |
+ bd = list_entry(head->next, struct gfs2_bufdata, bd_list); |
10030 |
+ list_del_init(&bd->bd_list); |
10031 |
+ gl = bd->bd_gl; |
10032 |
+- atomic_dec(&gl->gl_revokes); |
10033 |
+- clear_bit(GLF_LFLUSH, &gl->gl_flags); |
10034 |
++ if (atomic_dec_return(&gl->gl_revokes) == 0) { |
10035 |
++ clear_bit(GLF_LFLUSH, &gl->gl_flags); |
10036 |
++ gfs2_glock_queue_put(gl); |
10037 |
++ } |
10038 |
+ kmem_cache_free(gfs2_bufdata_cachep, bd); |
10039 |
+ } |
10040 |
+ } |
10041 |
+diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c |
10042 |
+index ca71163ff7cf..360206704a14 100644 |
10043 |
+--- a/fs/gfs2/super.c |
10044 |
++++ b/fs/gfs2/super.c |
10045 |
+@@ -973,8 +973,7 @@ void gfs2_freeze_func(struct work_struct *work) |
10046 |
+ if (error) { |
10047 |
+ printk(KERN_INFO "GFS2: couldn't get freeze lock : %d\n", error); |
10048 |
+ gfs2_assert_withdraw(sdp, 0); |
10049 |
+- } |
10050 |
+- else { |
10051 |
++ } else { |
10052 |
+ atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN); |
10053 |
+ error = thaw_super(sb); |
10054 |
+ if (error) { |
10055 |
+@@ -987,6 +986,8 @@ void gfs2_freeze_func(struct work_struct *work) |
10056 |
+ gfs2_glock_dq_uninit(&freeze_gh); |
10057 |
+ } |
10058 |
+ deactivate_super(sb); |
10059 |
++ clear_bit_unlock(SDF_FS_FROZEN, &sdp->sd_flags); |
10060 |
++ wake_up_bit(&sdp->sd_flags, SDF_FS_FROZEN); |
10061 |
+ return; |
10062 |
+ } |
10063 |
+ |
10064 |
+@@ -1029,6 +1030,7 @@ static int gfs2_freeze(struct super_block *sb) |
10065 |
+ msleep(1000); |
10066 |
+ } |
10067 |
+ error = 0; |
10068 |
++ set_bit(SDF_FS_FROZEN, &sdp->sd_flags); |
10069 |
+ out: |
10070 |
+ mutex_unlock(&sdp->sd_freeze_mutex); |
10071 |
+ return error; |
10072 |
+@@ -1053,7 +1055,7 @@ static int gfs2_unfreeze(struct super_block *sb) |
10073 |
+ |
10074 |
+ gfs2_glock_dq_uninit(&sdp->sd_freeze_gh); |
10075 |
+ mutex_unlock(&sdp->sd_freeze_mutex); |
10076 |
+- return 0; |
10077 |
++ return wait_on_bit(&sdp->sd_flags, SDF_FS_FROZEN, TASK_INTERRUPTIBLE); |
10078 |
+ } |
10079 |
+ |
10080 |
+ /** |
10081 |
+diff --git a/fs/internal.h b/fs/internal.h |
10082 |
+index d410186bc369..d109665b9e50 100644 |
10083 |
+--- a/fs/internal.h |
10084 |
++++ b/fs/internal.h |
10085 |
+@@ -80,9 +80,7 @@ extern int sb_prepare_remount_readonly(struct super_block *); |
10086 |
+ |
10087 |
+ extern void __init mnt_init(void); |
10088 |
+ |
10089 |
+-extern int __mnt_want_write(struct vfsmount *); |
10090 |
+ extern int __mnt_want_write_file(struct file *); |
10091 |
+-extern void __mnt_drop_write(struct vfsmount *); |
10092 |
+ extern void __mnt_drop_write_file(struct file *); |
10093 |
+ |
10094 |
+ /* |
10095 |
+diff --git a/fs/nfs/client.c b/fs/nfs/client.c |
10096 |
+index 90d71fda65ce..dfb796eab912 100644 |
10097 |
+--- a/fs/nfs/client.c |
10098 |
++++ b/fs/nfs/client.c |
10099 |
+@@ -284,6 +284,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat |
10100 |
+ struct nfs_client *clp; |
10101 |
+ const struct sockaddr *sap = data->addr; |
10102 |
+ struct nfs_net *nn = net_generic(data->net, nfs_net_id); |
10103 |
++ int error; |
10104 |
+ |
10105 |
+ again: |
10106 |
+ list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) { |
10107 |
+@@ -296,9 +297,11 @@ again: |
10108 |
+ if (clp->cl_cons_state > NFS_CS_READY) { |
10109 |
+ refcount_inc(&clp->cl_count); |
10110 |
+ spin_unlock(&nn->nfs_client_lock); |
10111 |
+- nfs_wait_client_init_complete(clp); |
10112 |
++ error = nfs_wait_client_init_complete(clp); |
10113 |
+ nfs_put_client(clp); |
10114 |
+ spin_lock(&nn->nfs_client_lock); |
10115 |
++ if (error < 0) |
10116 |
++ return ERR_PTR(error); |
10117 |
+ goto again; |
10118 |
+ } |
10119 |
+ |
10120 |
+@@ -407,6 +410,8 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) |
10121 |
+ clp = nfs_match_client(cl_init); |
10122 |
+ if (clp) { |
10123 |
+ spin_unlock(&nn->nfs_client_lock); |
10124 |
++ if (IS_ERR(clp)) |
10125 |
++ return clp; |
10126 |
+ if (new) |
10127 |
+ new->rpc_ops->free_client(new); |
10128 |
+ return nfs_found_client(cl_init, clp); |
10129 |
+diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c |
10130 |
+index 00d17198ee12..f10b660805fc 100644 |
10131 |
+--- a/fs/nfs/nfs4file.c |
10132 |
++++ b/fs/nfs/nfs4file.c |
10133 |
+@@ -187,7 +187,7 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off, |
10134 |
+ bool same_inode = false; |
10135 |
+ int ret; |
10136 |
+ |
10137 |
+- if (remap_flags & ~REMAP_FILE_ADVISORY) |
10138 |
++ if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY)) |
10139 |
+ return -EINVAL; |
10140 |
+ |
10141 |
+ /* check alignment w.r.t. clone_blksize */ |
10142 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
10143 |
+index 82c129bfe58d..93872bb50230 100644 |
10144 |
+--- a/fs/overlayfs/dir.c |
10145 |
++++ b/fs/overlayfs/dir.c |
10146 |
+@@ -260,7 +260,7 @@ static int ovl_instantiate(struct dentry *dentry, struct inode *inode, |
10147 |
+ * hashed directory inode aliases. |
10148 |
+ */ |
10149 |
+ inode = ovl_get_inode(dentry->d_sb, &oip); |
10150 |
+- if (WARN_ON(IS_ERR(inode))) |
10151 |
++ if (IS_ERR(inode)) |
10152 |
+ return PTR_ERR(inode); |
10153 |
+ } else { |
10154 |
+ WARN_ON(ovl_inode_real(inode) != d_inode(newdentry)); |
10155 |
+diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c |
10156 |
+index 3b7ed5d2279c..b48273e846ad 100644 |
10157 |
+--- a/fs/overlayfs/inode.c |
10158 |
++++ b/fs/overlayfs/inode.c |
10159 |
+@@ -832,7 +832,7 @@ struct inode *ovl_get_inode(struct super_block *sb, |
10160 |
+ int fsid = bylower ? oip->lowerpath->layer->fsid : 0; |
10161 |
+ bool is_dir, metacopy = false; |
10162 |
+ unsigned long ino = 0; |
10163 |
+- int err = -ENOMEM; |
10164 |
++ int err = oip->newinode ? -EEXIST : -ENOMEM; |
10165 |
+ |
10166 |
+ if (!realinode) |
10167 |
+ realinode = d_inode(lowerdentry); |
10168 |
+@@ -917,6 +917,7 @@ out: |
10169 |
+ return inode; |
10170 |
+ |
10171 |
+ out_err: |
10172 |
++ pr_warn_ratelimited("overlayfs: failed to get inode (%i)\n", err); |
10173 |
+ inode = ERR_PTR(err); |
10174 |
+ goto out; |
10175 |
+ } |
10176 |
+diff --git a/include/crypto/hash.h b/include/crypto/hash.h |
10177 |
+index 3b31c1b349ae..bc143b410359 100644 |
10178 |
+--- a/include/crypto/hash.h |
10179 |
++++ b/include/crypto/hash.h |
10180 |
+@@ -152,7 +152,13 @@ struct shash_desc { |
10181 |
+ }; |
10182 |
+ |
10183 |
+ #define HASH_MAX_DIGESTSIZE 64 |
10184 |
+-#define HASH_MAX_DESCSIZE 360 |
10185 |
++ |
10186 |
++/* |
10187 |
++ * Worst case is hmac(sha3-224-generic). Its context is a nested 'shash_desc' |
10188 |
++ * containing a 'struct sha3_state'. |
10189 |
++ */ |
10190 |
++#define HASH_MAX_DESCSIZE (sizeof(struct shash_desc) + 360) |
10191 |
++ |
10192 |
+ #define HASH_MAX_STATESIZE 512 |
10193 |
+ |
10194 |
+ #define SHASH_DESC_ON_STACK(shash, ctx) \ |
10195 |
+diff --git a/include/drm/tinydrm/mipi-dbi.h b/include/drm/tinydrm/mipi-dbi.h |
10196 |
+index b8ba58861986..bcc98bd447f7 100644 |
10197 |
+--- a/include/drm/tinydrm/mipi-dbi.h |
10198 |
++++ b/include/drm/tinydrm/mipi-dbi.h |
10199 |
+@@ -42,7 +42,7 @@ struct mipi_dbi { |
10200 |
+ struct spi_device *spi; |
10201 |
+ bool enabled; |
10202 |
+ struct mutex cmdlock; |
10203 |
+- int (*command)(struct mipi_dbi *mipi, u8 cmd, u8 *param, size_t num); |
10204 |
++ int (*command)(struct mipi_dbi *mipi, u8 *cmd, u8 *param, size_t num); |
10205 |
+ const u8 *read_commands; |
10206 |
+ struct gpio_desc *dc; |
10207 |
+ u16 *tx_buf; |
10208 |
+@@ -79,6 +79,7 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len); |
10209 |
+ |
10210 |
+ int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val); |
10211 |
+ int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len); |
10212 |
++int mipi_dbi_command_stackbuf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len); |
10213 |
+ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, |
10214 |
+ struct drm_clip_rect *clip, bool swap); |
10215 |
+ /** |
10216 |
+@@ -96,7 +97,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, |
10217 |
+ #define mipi_dbi_command(mipi, cmd, seq...) \ |
10218 |
+ ({ \ |
10219 |
+ u8 d[] = { seq }; \ |
10220 |
+- mipi_dbi_command_buf(mipi, cmd, d, ARRAY_SIZE(d)); \ |
10221 |
++ mipi_dbi_command_stackbuf(mipi, cmd, d, ARRAY_SIZE(d)); \ |
10222 |
+ }) |
10223 |
+ |
10224 |
+ #ifdef CONFIG_DEBUG_FS |
10225 |
+diff --git a/include/linux/bio.h b/include/linux/bio.h |
10226 |
+index 7380b094dcca..4f7618cf9f38 100644 |
10227 |
+--- a/include/linux/bio.h |
10228 |
++++ b/include/linux/bio.h |
10229 |
+@@ -211,7 +211,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) |
10230 |
+ { |
10231 |
+ if (count != 1) { |
10232 |
+ bio->bi_flags |= (1 << BIO_REFFED); |
10233 |
+- smp_mb__before_atomic(); |
10234 |
++ smp_mb(); |
10235 |
+ } |
10236 |
+ atomic_set(&bio->__bi_cnt, count); |
10237 |
+ } |
10238 |
+diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h |
10239 |
+index 120d1d40704b..319c07305500 100644 |
10240 |
+--- a/include/linux/cgroup-defs.h |
10241 |
++++ b/include/linux/cgroup-defs.h |
10242 |
+@@ -348,6 +348,11 @@ struct cgroup { |
10243 |
+ * Dying cgroups are cgroups which were deleted by a user, |
10244 |
+ * but are still existing because someone else is holding a reference. |
10245 |
+ * max_descendants is a maximum allowed number of descent cgroups. |
10246 |
++ * |
10247 |
++ * nr_descendants and nr_dying_descendants are protected |
10248 |
++ * by cgroup_mutex and css_set_lock. It's fine to read them holding |
10249 |
++ * any of cgroup_mutex and css_set_lock; for writing both locks |
10250 |
++ * should be held. |
10251 |
+ */ |
10252 |
+ int nr_descendants; |
10253 |
+ int nr_dying_descendants; |
10254 |
+diff --git a/include/linux/filter.h b/include/linux/filter.h |
10255 |
+index 3358646a8e7a..42513fa6846c 100644 |
10256 |
+--- a/include/linux/filter.h |
10257 |
++++ b/include/linux/filter.h |
10258 |
+@@ -709,6 +709,7 @@ static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) |
10259 |
+ static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) |
10260 |
+ { |
10261 |
+ set_memory_ro((unsigned long)hdr, hdr->pages); |
10262 |
++ set_memory_x((unsigned long)hdr, hdr->pages); |
10263 |
+ } |
10264 |
+ |
10265 |
+ static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr) |
10266 |
+diff --git a/include/linux/genhd.h b/include/linux/genhd.h |
10267 |
+index 06c0fd594097..69db1affedb0 100644 |
10268 |
+--- a/include/linux/genhd.h |
10269 |
++++ b/include/linux/genhd.h |
10270 |
+@@ -610,6 +610,7 @@ struct unixware_disklabel { |
10271 |
+ |
10272 |
+ extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); |
10273 |
+ extern void blk_free_devt(dev_t devt); |
10274 |
++extern void blk_invalidate_devt(dev_t devt); |
10275 |
+ extern dev_t blk_lookup_devt(const char *name, int partno); |
10276 |
+ extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
10277 |
+ |
10278 |
+diff --git a/include/linux/hid.h b/include/linux/hid.h |
10279 |
+index f9707d1dcb58..ac0c70b4ce10 100644 |
10280 |
+--- a/include/linux/hid.h |
10281 |
++++ b/include/linux/hid.h |
10282 |
+@@ -417,6 +417,7 @@ struct hid_global { |
10283 |
+ |
10284 |
+ struct hid_local { |
10285 |
+ unsigned usage[HID_MAX_USAGES]; /* usage array */ |
10286 |
++ u8 usage_size[HID_MAX_USAGES]; /* usage size array */ |
10287 |
+ unsigned collection_index[HID_MAX_USAGES]; /* collection index array */ |
10288 |
+ unsigned usage_index; |
10289 |
+ unsigned usage_minimum; |
10290 |
+diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h |
10291 |
+index 7e84351fa2c0..6e9fb1932dde 100644 |
10292 |
+--- a/include/linux/iio/adc/ad_sigma_delta.h |
10293 |
++++ b/include/linux/iio/adc/ad_sigma_delta.h |
10294 |
+@@ -69,6 +69,7 @@ struct ad_sigma_delta { |
10295 |
+ bool irq_dis; |
10296 |
+ |
10297 |
+ bool bus_locked; |
10298 |
++ bool keep_cs_asserted; |
10299 |
+ |
10300 |
+ uint8_t comm; |
10301 |
+ |
10302 |
+diff --git a/include/linux/mount.h b/include/linux/mount.h |
10303 |
+index 037eed52164b..03138a0f46f9 100644 |
10304 |
+--- a/include/linux/mount.h |
10305 |
++++ b/include/linux/mount.h |
10306 |
+@@ -86,6 +86,8 @@ extern bool mnt_may_suid(struct vfsmount *mnt); |
10307 |
+ |
10308 |
+ struct path; |
10309 |
+ extern struct vfsmount *clone_private_mount(const struct path *path); |
10310 |
++extern int __mnt_want_write(struct vfsmount *); |
10311 |
++extern void __mnt_drop_write(struct vfsmount *); |
10312 |
+ |
10313 |
+ struct file_system_type; |
10314 |
+ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, |
10315 |
+diff --git a/include/linux/overflow.h b/include/linux/overflow.h |
10316 |
+index 40b48e2133cb..15eb85de9226 100644 |
10317 |
+--- a/include/linux/overflow.h |
10318 |
++++ b/include/linux/overflow.h |
10319 |
+@@ -36,6 +36,12 @@ |
10320 |
+ #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) |
10321 |
+ #define type_min(T) ((T)((T)-type_max(T)-(T)1)) |
10322 |
+ |
10323 |
++/* |
10324 |
++ * Avoids triggering -Wtype-limits compilation warning, |
10325 |
++ * while using unsigned data types to check a < 0. |
10326 |
++ */ |
10327 |
++#define is_non_negative(a) ((a) > 0 || (a) == 0) |
10328 |
++#define is_negative(a) (!(is_non_negative(a))) |
10329 |
+ |
10330 |
+ #ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW |
10331 |
+ /* |
10332 |
+@@ -227,10 +233,10 @@ |
10333 |
+ typeof(d) _d = d; \ |
10334 |
+ u64 _a_full = _a; \ |
10335 |
+ unsigned int _to_shift = \ |
10336 |
+- _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \ |
10337 |
++ is_non_negative(_s) && _s < 8 * sizeof(*d) ? _s : 0; \ |
10338 |
+ *_d = (_a_full << _to_shift); \ |
10339 |
+- (_to_shift != _s || *_d < 0 || _a < 0 || \ |
10340 |
+- (*_d >> _to_shift) != _a); \ |
10341 |
++ (_to_shift != _s || is_negative(*_d) || is_negative(_a) || \ |
10342 |
++ (*_d >> _to_shift) != _a); \ |
10343 |
+ }) |
10344 |
+ |
10345 |
+ /** |
10346 |
+diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h |
10347 |
+index 4db8bcacc51a..991d97cf395a 100644 |
10348 |
+--- a/include/linux/rcupdate.h |
10349 |
++++ b/include/linux/rcupdate.h |
10350 |
+@@ -890,9 +890,11 @@ static inline void rcu_head_init(struct rcu_head *rhp) |
10351 |
+ static inline bool |
10352 |
+ rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f) |
10353 |
+ { |
10354 |
+- if (READ_ONCE(rhp->func) == f) |
10355 |
++ rcu_callback_t func = READ_ONCE(rhp->func); |
10356 |
++ |
10357 |
++ if (func == f) |
10358 |
+ return true; |
10359 |
+- WARN_ON_ONCE(READ_ONCE(rhp->func) != (rcu_callback_t)~0L); |
10360 |
++ WARN_ON_ONCE(func != (rcu_callback_t)~0L); |
10361 |
+ return false; |
10362 |
+ } |
10363 |
+ |
10364 |
+diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h |
10365 |
+index d0884b525001..9d1bc65d226c 100644 |
10366 |
+--- a/include/linux/smpboot.h |
10367 |
++++ b/include/linux/smpboot.h |
10368 |
+@@ -29,7 +29,7 @@ struct smpboot_thread_data; |
10369 |
+ * @thread_comm: The base name of the thread |
10370 |
+ */ |
10371 |
+ struct smp_hotplug_thread { |
10372 |
+- struct task_struct __percpu **store; |
10373 |
++ struct task_struct * __percpu *store; |
10374 |
+ struct list_head list; |
10375 |
+ int (*thread_should_run)(unsigned int cpu); |
10376 |
+ void (*thread_fn)(unsigned int cpu); |
10377 |
+diff --git a/include/linux/time64.h b/include/linux/time64.h |
10378 |
+index 05634afba0db..4a45aea0f96e 100644 |
10379 |
+--- a/include/linux/time64.h |
10380 |
++++ b/include/linux/time64.h |
10381 |
+@@ -41,6 +41,17 @@ struct itimerspec64 { |
10382 |
+ #define KTIME_MAX ((s64)~((u64)1 << 63)) |
10383 |
+ #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
10384 |
+ |
10385 |
++/* |
10386 |
++ * Limits for settimeofday(): |
10387 |
++ * |
10388 |
++ * To prevent setting the time close to the wraparound point time setting |
10389 |
++ * is limited so a reasonable uptime can be accomodated. Uptime of 30 years |
10390 |
++ * should be really sufficient, which means the cutoff is 2232. At that |
10391 |
++ * point the cutoff is just a small part of the larger problem. |
10392 |
++ */ |
10393 |
++#define TIME_UPTIME_SEC_MAX (30LL * 365 * 24 *3600) |
10394 |
++#define TIME_SETTOD_SEC_MAX (KTIME_SEC_MAX - TIME_UPTIME_SEC_MAX) |
10395 |
++ |
10396 |
+ static inline int timespec64_equal(const struct timespec64 *a, |
10397 |
+ const struct timespec64 *b) |
10398 |
+ { |
10399 |
+@@ -108,6 +119,16 @@ static inline bool timespec64_valid_strict(const struct timespec64 *ts) |
10400 |
+ return true; |
10401 |
+ } |
10402 |
+ |
10403 |
++static inline bool timespec64_valid_settod(const struct timespec64 *ts) |
10404 |
++{ |
10405 |
++ if (!timespec64_valid(ts)) |
10406 |
++ return false; |
10407 |
++ /* Disallow values which cause overflow issues vs. CLOCK_REALTIME */ |
10408 |
++ if ((unsigned long long)ts->tv_sec >= TIME_SETTOD_SEC_MAX) |
10409 |
++ return false; |
10410 |
++ return true; |
10411 |
++} |
10412 |
++ |
10413 |
+ /** |
10414 |
+ * timespec64_to_ns - Convert timespec64 to nanoseconds |
10415 |
+ * @ts: pointer to the timespec64 variable to be converted |
10416 |
+diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h |
10417 |
+index 4a737b2c610b..bc3bc82778da 100644 |
10418 |
+--- a/include/media/videobuf2-core.h |
10419 |
++++ b/include/media/videobuf2-core.h |
10420 |
+@@ -586,6 +586,7 @@ struct vb2_queue { |
10421 |
+ unsigned int start_streaming_called:1; |
10422 |
+ unsigned int error:1; |
10423 |
+ unsigned int waiting_for_buffers:1; |
10424 |
++ unsigned int waiting_in_dqbuf:1; |
10425 |
+ unsigned int is_multiplanar:1; |
10426 |
+ unsigned int is_output:1; |
10427 |
+ unsigned int copy_timestamp:1; |
10428 |
+diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
10429 |
+index c36dc1e20556..60b7cbc0a6cb 100644 |
10430 |
+--- a/include/net/bluetooth/hci.h |
10431 |
++++ b/include/net/bluetooth/hci.h |
10432 |
+@@ -270,6 +270,7 @@ enum { |
10433 |
+ HCI_FORCE_BREDR_SMP, |
10434 |
+ HCI_FORCE_STATIC_ADDR, |
10435 |
+ HCI_LL_RPA_RESOLUTION, |
10436 |
++ HCI_CMD_PENDING, |
10437 |
+ |
10438 |
+ __HCI_NUM_FLAGS, |
10439 |
+ }; |
10440 |
+diff --git a/include/xen/xen.h b/include/xen/xen.h |
10441 |
+index 0e2156786ad2..e1ba6921bc8e 100644 |
10442 |
+--- a/include/xen/xen.h |
10443 |
++++ b/include/xen/xen.h |
10444 |
+@@ -43,7 +43,9 @@ extern struct hvm_start_info pvh_start_info; |
10445 |
+ #endif /* CONFIG_XEN_DOM0 */ |
10446 |
+ |
10447 |
+ struct bio_vec; |
10448 |
++struct page; |
10449 |
++ |
10450 |
+ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, |
10451 |
+- const struct bio_vec *vec2); |
10452 |
++ const struct page *page); |
10453 |
+ |
10454 |
+ #endif /* _XEN_XEN_H */ |
10455 |
+diff --git a/kernel/acct.c b/kernel/acct.c |
10456 |
+index addf7732fb56..81f9831a7859 100644 |
10457 |
+--- a/kernel/acct.c |
10458 |
++++ b/kernel/acct.c |
10459 |
+@@ -227,7 +227,7 @@ static int acct_on(struct filename *pathname) |
10460 |
+ filp_close(file, NULL); |
10461 |
+ return PTR_ERR(internal); |
10462 |
+ } |
10463 |
+- err = mnt_want_write(internal); |
10464 |
++ err = __mnt_want_write(internal); |
10465 |
+ if (err) { |
10466 |
+ mntput(internal); |
10467 |
+ kfree(acct); |
10468 |
+@@ -252,7 +252,7 @@ static int acct_on(struct filename *pathname) |
10469 |
+ old = xchg(&ns->bacct, &acct->pin); |
10470 |
+ mutex_unlock(&acct->lock); |
10471 |
+ pin_kill(old); |
10472 |
+- mnt_drop_write(mnt); |
10473 |
++ __mnt_drop_write(mnt); |
10474 |
+ mntput(mnt); |
10475 |
+ return 0; |
10476 |
+ } |
10477 |
+diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c |
10478 |
+index bf309f2592c4..425c67e4f568 100644 |
10479 |
+--- a/kernel/auditfilter.c |
10480 |
++++ b/kernel/auditfilter.c |
10481 |
+@@ -1114,22 +1114,24 @@ int audit_rule_change(int type, int seq, void *data, size_t datasz) |
10482 |
+ int err = 0; |
10483 |
+ struct audit_entry *entry; |
10484 |
+ |
10485 |
+- entry = audit_data_to_entry(data, datasz); |
10486 |
+- if (IS_ERR(entry)) |
10487 |
+- return PTR_ERR(entry); |
10488 |
+- |
10489 |
+ switch (type) { |
10490 |
+ case AUDIT_ADD_RULE: |
10491 |
++ entry = audit_data_to_entry(data, datasz); |
10492 |
++ if (IS_ERR(entry)) |
10493 |
++ return PTR_ERR(entry); |
10494 |
+ err = audit_add_rule(entry); |
10495 |
+ audit_log_rule_change("add_rule", &entry->rule, !err); |
10496 |
+ break; |
10497 |
+ case AUDIT_DEL_RULE: |
10498 |
++ entry = audit_data_to_entry(data, datasz); |
10499 |
++ if (IS_ERR(entry)) |
10500 |
++ return PTR_ERR(entry); |
10501 |
+ err = audit_del_rule(entry); |
10502 |
+ audit_log_rule_change("remove_rule", &entry->rule, !err); |
10503 |
+ break; |
10504 |
+ default: |
10505 |
+- err = -EINVAL; |
10506 |
+ WARN_ON(1); |
10507 |
++ return -EINVAL; |
10508 |
+ } |
10509 |
+ |
10510 |
+ if (err || type == AUDIT_DEL_RULE) { |
10511 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
10512 |
+index b585ceb2f7a2..71e737774611 100644 |
10513 |
+--- a/kernel/auditsc.c |
10514 |
++++ b/kernel/auditsc.c |
10515 |
+@@ -837,6 +837,13 @@ static inline void audit_proctitle_free(struct audit_context *context) |
10516 |
+ context->proctitle.len = 0; |
10517 |
+ } |
10518 |
+ |
10519 |
++static inline void audit_free_module(struct audit_context *context) |
10520 |
++{ |
10521 |
++ if (context->type == AUDIT_KERN_MODULE) { |
10522 |
++ kfree(context->module.name); |
10523 |
++ context->module.name = NULL; |
10524 |
++ } |
10525 |
++} |
10526 |
+ static inline void audit_free_names(struct audit_context *context) |
10527 |
+ { |
10528 |
+ struct audit_names *n, *next; |
10529 |
+@@ -920,6 +927,7 @@ int audit_alloc(struct task_struct *tsk) |
10530 |
+ |
10531 |
+ static inline void audit_free_context(struct audit_context *context) |
10532 |
+ { |
10533 |
++ audit_free_module(context); |
10534 |
+ audit_free_names(context); |
10535 |
+ unroll_tree_refs(context, NULL, 0); |
10536 |
+ free_tree_refs(context); |
10537 |
+@@ -1237,7 +1245,6 @@ static void show_special(struct audit_context *context, int *call_panic) |
10538 |
+ audit_log_format(ab, "name="); |
10539 |
+ if (context->module.name) { |
10540 |
+ audit_log_untrustedstring(ab, context->module.name); |
10541 |
+- kfree(context->module.name); |
10542 |
+ } else |
10543 |
+ audit_log_format(ab, "(null)"); |
10544 |
+ |
10545 |
+@@ -1574,6 +1581,7 @@ void __audit_syscall_exit(int success, long return_code) |
10546 |
+ context->in_syscall = 0; |
10547 |
+ context->prio = context->state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; |
10548 |
+ |
10549 |
++ audit_free_module(context); |
10550 |
+ audit_free_names(context); |
10551 |
+ unroll_tree_refs(context, NULL, 0); |
10552 |
+ audit_free_aux(context); |
10553 |
+diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c |
10554 |
+index 191b79948424..1e525d70f833 100644 |
10555 |
+--- a/kernel/bpf/devmap.c |
10556 |
++++ b/kernel/bpf/devmap.c |
10557 |
+@@ -164,6 +164,9 @@ static void dev_map_free(struct bpf_map *map) |
10558 |
+ bpf_clear_redirect_map(map); |
10559 |
+ synchronize_rcu(); |
10560 |
+ |
10561 |
++ /* Make sure prior __dev_map_entry_free() have completed. */ |
10562 |
++ rcu_barrier(); |
10563 |
++ |
10564 |
+ /* To ensure all pending flush operations have completed wait for flush |
10565 |
+ * bitmap to indicate all flush_needed bits to be zero on _all_ cpus. |
10566 |
+ * Because the above synchronize_rcu() ensures the map is disconnected |
10567 |
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
10568 |
+index f84bf28f36ba..ee77b0f00edd 100644 |
10569 |
+--- a/kernel/cgroup/cgroup.c |
10570 |
++++ b/kernel/cgroup/cgroup.c |
10571 |
+@@ -4728,9 +4728,11 @@ static void css_release_work_fn(struct work_struct *work) |
10572 |
+ if (cgroup_on_dfl(cgrp)) |
10573 |
+ cgroup_rstat_flush(cgrp); |
10574 |
+ |
10575 |
++ spin_lock_irq(&css_set_lock); |
10576 |
+ for (tcgrp = cgroup_parent(cgrp); tcgrp; |
10577 |
+ tcgrp = cgroup_parent(tcgrp)) |
10578 |
+ tcgrp->nr_dying_descendants--; |
10579 |
++ spin_unlock_irq(&css_set_lock); |
10580 |
+ |
10581 |
+ cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id); |
10582 |
+ cgrp->id = -1; |
10583 |
+@@ -4948,12 +4950,14 @@ static struct cgroup *cgroup_create(struct cgroup *parent) |
10584 |
+ if (ret) |
10585 |
+ goto out_psi_free; |
10586 |
+ |
10587 |
++ spin_lock_irq(&css_set_lock); |
10588 |
+ for (tcgrp = cgrp; tcgrp; tcgrp = cgroup_parent(tcgrp)) { |
10589 |
+ cgrp->ancestor_ids[tcgrp->level] = tcgrp->id; |
10590 |
+ |
10591 |
+ if (tcgrp != cgrp) |
10592 |
+ tcgrp->nr_descendants++; |
10593 |
+ } |
10594 |
++ spin_unlock_irq(&css_set_lock); |
10595 |
+ |
10596 |
+ if (notify_on_release(parent)) |
10597 |
+ set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); |
10598 |
+@@ -5238,10 +5242,12 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) |
10599 |
+ if (parent && cgroup_is_threaded(cgrp)) |
10600 |
+ parent->nr_threaded_children--; |
10601 |
+ |
10602 |
++ spin_lock_irq(&css_set_lock); |
10603 |
+ for (tcgrp = cgroup_parent(cgrp); tcgrp; tcgrp = cgroup_parent(tcgrp)) { |
10604 |
+ tcgrp->nr_descendants--; |
10605 |
+ tcgrp->nr_dying_descendants++; |
10606 |
+ } |
10607 |
++ spin_unlock_irq(&css_set_lock); |
10608 |
+ |
10609 |
+ cgroup1_check_for_release(parent); |
10610 |
+ |
10611 |
+diff --git a/kernel/irq_work.c b/kernel/irq_work.c |
10612 |
+index 6b7cdf17ccf8..73288914ed5e 100644 |
10613 |
+--- a/kernel/irq_work.c |
10614 |
++++ b/kernel/irq_work.c |
10615 |
+@@ -56,61 +56,70 @@ void __weak arch_irq_work_raise(void) |
10616 |
+ */ |
10617 |
+ } |
10618 |
+ |
10619 |
+-/* |
10620 |
+- * Enqueue the irq_work @work on @cpu unless it's already pending |
10621 |
+- * somewhere. |
10622 |
+- * |
10623 |
+- * Can be re-enqueued while the callback is still in progress. |
10624 |
+- */ |
10625 |
+-bool irq_work_queue_on(struct irq_work *work, int cpu) |
10626 |
++/* Enqueue on current CPU, work must already be claimed and preempt disabled */ |
10627 |
++static void __irq_work_queue_local(struct irq_work *work) |
10628 |
+ { |
10629 |
+- /* All work should have been flushed before going offline */ |
10630 |
+- WARN_ON_ONCE(cpu_is_offline(cpu)); |
10631 |
+- |
10632 |
+-#ifdef CONFIG_SMP |
10633 |
+- |
10634 |
+- /* Arch remote IPI send/receive backend aren't NMI safe */ |
10635 |
+- WARN_ON_ONCE(in_nmi()); |
10636 |
++ /* If the work is "lazy", handle it from next tick if any */ |
10637 |
++ if (work->flags & IRQ_WORK_LAZY) { |
10638 |
++ if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && |
10639 |
++ tick_nohz_tick_stopped()) |
10640 |
++ arch_irq_work_raise(); |
10641 |
++ } else { |
10642 |
++ if (llist_add(&work->llnode, this_cpu_ptr(&raised_list))) |
10643 |
++ arch_irq_work_raise(); |
10644 |
++ } |
10645 |
++} |
10646 |
+ |
10647 |
++/* Enqueue the irq work @work on the current CPU */ |
10648 |
++bool irq_work_queue(struct irq_work *work) |
10649 |
++{ |
10650 |
+ /* Only queue if not already pending */ |
10651 |
+ if (!irq_work_claim(work)) |
10652 |
+ return false; |
10653 |
+ |
10654 |
+- if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) |
10655 |
+- arch_send_call_function_single_ipi(cpu); |
10656 |
+- |
10657 |
+-#else /* #ifdef CONFIG_SMP */ |
10658 |
+- irq_work_queue(work); |
10659 |
+-#endif /* #else #ifdef CONFIG_SMP */ |
10660 |
++ /* Queue the entry and raise the IPI if needed. */ |
10661 |
++ preempt_disable(); |
10662 |
++ __irq_work_queue_local(work); |
10663 |
++ preempt_enable(); |
10664 |
+ |
10665 |
+ return true; |
10666 |
+ } |
10667 |
++EXPORT_SYMBOL_GPL(irq_work_queue); |
10668 |
+ |
10669 |
+-/* Enqueue the irq work @work on the current CPU */ |
10670 |
+-bool irq_work_queue(struct irq_work *work) |
10671 |
++/* |
10672 |
++ * Enqueue the irq_work @work on @cpu unless it's already pending |
10673 |
++ * somewhere. |
10674 |
++ * |
10675 |
++ * Can be re-enqueued while the callback is still in progress. |
10676 |
++ */ |
10677 |
++bool irq_work_queue_on(struct irq_work *work, int cpu) |
10678 |
+ { |
10679 |
++#ifndef CONFIG_SMP |
10680 |
++ return irq_work_queue(work); |
10681 |
++ |
10682 |
++#else /* CONFIG_SMP: */ |
10683 |
++ /* All work should have been flushed before going offline */ |
10684 |
++ WARN_ON_ONCE(cpu_is_offline(cpu)); |
10685 |
++ |
10686 |
+ /* Only queue if not already pending */ |
10687 |
+ if (!irq_work_claim(work)) |
10688 |
+ return false; |
10689 |
+ |
10690 |
+- /* Queue the entry and raise the IPI if needed. */ |
10691 |
+ preempt_disable(); |
10692 |
+- |
10693 |
+- /* If the work is "lazy", handle it from next tick if any */ |
10694 |
+- if (work->flags & IRQ_WORK_LAZY) { |
10695 |
+- if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && |
10696 |
+- tick_nohz_tick_stopped()) |
10697 |
+- arch_irq_work_raise(); |
10698 |
++ if (cpu != smp_processor_id()) { |
10699 |
++ /* Arch remote IPI send/receive backend aren't NMI safe */ |
10700 |
++ WARN_ON_ONCE(in_nmi()); |
10701 |
++ if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) |
10702 |
++ arch_send_call_function_single_ipi(cpu); |
10703 |
+ } else { |
10704 |
+- if (llist_add(&work->llnode, this_cpu_ptr(&raised_list))) |
10705 |
+- arch_irq_work_raise(); |
10706 |
++ __irq_work_queue_local(work); |
10707 |
+ } |
10708 |
+- |
10709 |
+ preempt_enable(); |
10710 |
+ |
10711 |
+ return true; |
10712 |
++#endif /* CONFIG_SMP */ |
10713 |
+ } |
10714 |
+-EXPORT_SYMBOL_GPL(irq_work_queue); |
10715 |
++ |
10716 |
+ |
10717 |
+ bool irq_work_needs_cpu(void) |
10718 |
+ { |
10719 |
+diff --git a/kernel/jump_label.c b/kernel/jump_label.c |
10720 |
+index bad96b476eb6..a799b1ac6b2f 100644 |
10721 |
+--- a/kernel/jump_label.c |
10722 |
++++ b/kernel/jump_label.c |
10723 |
+@@ -206,6 +206,8 @@ static void __static_key_slow_dec_cpuslocked(struct static_key *key, |
10724 |
+ unsigned long rate_limit, |
10725 |
+ struct delayed_work *work) |
10726 |
+ { |
10727 |
++ int val; |
10728 |
++ |
10729 |
+ lockdep_assert_cpus_held(); |
10730 |
+ |
10731 |
+ /* |
10732 |
+@@ -215,17 +217,20 @@ static void __static_key_slow_dec_cpuslocked(struct static_key *key, |
10733 |
+ * returns is unbalanced, because all other static_key_slow_inc() |
10734 |
+ * instances block while the update is in progress. |
10735 |
+ */ |
10736 |
+- if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex)) { |
10737 |
+- WARN(atomic_read(&key->enabled) < 0, |
10738 |
+- "jump label: negative count!\n"); |
10739 |
++ val = atomic_fetch_add_unless(&key->enabled, -1, 1); |
10740 |
++ if (val != 1) { |
10741 |
++ WARN(val < 0, "jump label: negative count!\n"); |
10742 |
+ return; |
10743 |
+ } |
10744 |
+ |
10745 |
+- if (rate_limit) { |
10746 |
+- atomic_inc(&key->enabled); |
10747 |
+- schedule_delayed_work(work, rate_limit); |
10748 |
+- } else { |
10749 |
+- jump_label_update(key); |
10750 |
++ jump_label_lock(); |
10751 |
++ if (atomic_dec_and_test(&key->enabled)) { |
10752 |
++ if (rate_limit) { |
10753 |
++ atomic_inc(&key->enabled); |
10754 |
++ schedule_delayed_work(work, rate_limit); |
10755 |
++ } else { |
10756 |
++ jump_label_update(key); |
10757 |
++ } |
10758 |
+ } |
10759 |
+ jump_label_unlock(); |
10760 |
+ } |
10761 |
+diff --git a/kernel/module.c b/kernel/module.c |
10762 |
+index 2ad1b5239910..ae1b77da6a20 100644 |
10763 |
+--- a/kernel/module.c |
10764 |
++++ b/kernel/module.c |
10765 |
+@@ -1950,8 +1950,13 @@ void module_enable_ro(const struct module *mod, bool after_init) |
10766 |
+ return; |
10767 |
+ |
10768 |
+ frob_text(&mod->core_layout, set_memory_ro); |
10769 |
++ frob_text(&mod->core_layout, set_memory_x); |
10770 |
++ |
10771 |
+ frob_rodata(&mod->core_layout, set_memory_ro); |
10772 |
++ |
10773 |
+ frob_text(&mod->init_layout, set_memory_ro); |
10774 |
++ frob_text(&mod->init_layout, set_memory_x); |
10775 |
++ |
10776 |
+ frob_rodata(&mod->init_layout, set_memory_ro); |
10777 |
+ |
10778 |
+ if (after_init) |
10779 |
+diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c |
10780 |
+index b459da70b4fc..5444a7831451 100644 |
10781 |
+--- a/kernel/rcu/rcuperf.c |
10782 |
++++ b/kernel/rcu/rcuperf.c |
10783 |
+@@ -501,6 +501,10 @@ rcu_perf_cleanup(void) |
10784 |
+ |
10785 |
+ if (torture_cleanup_begin()) |
10786 |
+ return; |
10787 |
++ if (!cur_ops) { |
10788 |
++ torture_cleanup_end(); |
10789 |
++ return; |
10790 |
++ } |
10791 |
+ |
10792 |
+ if (reader_tasks) { |
10793 |
+ for (i = 0; i < nrealreaders; i++) |
10794 |
+@@ -621,6 +625,7 @@ rcu_perf_init(void) |
10795 |
+ pr_cont("\n"); |
10796 |
+ WARN_ON(!IS_MODULE(CONFIG_RCU_PERF_TEST)); |
10797 |
+ firsterr = -EINVAL; |
10798 |
++ cur_ops = NULL; |
10799 |
+ goto unwind; |
10800 |
+ } |
10801 |
+ if (cur_ops->init) |
10802 |
+diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c |
10803 |
+index f6e85faa4ff4..584b0d1da0a3 100644 |
10804 |
+--- a/kernel/rcu/rcutorture.c |
10805 |
++++ b/kernel/rcu/rcutorture.c |
10806 |
+@@ -2092,6 +2092,10 @@ rcu_torture_cleanup(void) |
10807 |
+ cur_ops->cb_barrier(); |
10808 |
+ return; |
10809 |
+ } |
10810 |
++ if (!cur_ops) { |
10811 |
++ torture_cleanup_end(); |
10812 |
++ return; |
10813 |
++ } |
10814 |
+ |
10815 |
+ rcu_torture_barrier_cleanup(); |
10816 |
+ torture_stop_kthread(rcu_torture_fwd_prog, fwd_prog_task); |
10817 |
+@@ -2257,6 +2261,7 @@ rcu_torture_init(void) |
10818 |
+ pr_cont("\n"); |
10819 |
+ WARN_ON(!IS_MODULE(CONFIG_RCU_TORTURE_TEST)); |
10820 |
+ firsterr = -EINVAL; |
10821 |
++ cur_ops = NULL; |
10822 |
+ goto unwind; |
10823 |
+ } |
10824 |
+ if (cur_ops->fqs == NULL && fqs_duration != 0) { |
10825 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
10826 |
+index 62cc29364fba..9346e2ce0ac0 100644 |
10827 |
+--- a/kernel/sched/core.c |
10828 |
++++ b/kernel/sched/core.c |
10829 |
+@@ -6503,6 +6503,8 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset) |
10830 |
+ static int cpu_shares_write_u64(struct cgroup_subsys_state *css, |
10831 |
+ struct cftype *cftype, u64 shareval) |
10832 |
+ { |
10833 |
++ if (shareval > scale_load_down(ULONG_MAX)) |
10834 |
++ shareval = MAX_SHARES; |
10835 |
+ return sched_group_set_shares(css_tg(css), scale_load(shareval)); |
10836 |
+ } |
10837 |
+ |
10838 |
+@@ -6605,8 +6607,10 @@ int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) |
10839 |
+ period = ktime_to_ns(tg->cfs_bandwidth.period); |
10840 |
+ if (cfs_quota_us < 0) |
10841 |
+ quota = RUNTIME_INF; |
10842 |
+- else |
10843 |
++ else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC) |
10844 |
+ quota = (u64)cfs_quota_us * NSEC_PER_USEC; |
10845 |
++ else |
10846 |
++ return -EINVAL; |
10847 |
+ |
10848 |
+ return tg_set_cfs_bandwidth(tg, period, quota); |
10849 |
+ } |
10850 |
+@@ -6628,6 +6632,9 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) |
10851 |
+ { |
10852 |
+ u64 quota, period; |
10853 |
+ |
10854 |
++ if ((u64)cfs_period_us > U64_MAX / NSEC_PER_USEC) |
10855 |
++ return -EINVAL; |
10856 |
++ |
10857 |
+ period = (u64)cfs_period_us * NSEC_PER_USEC; |
10858 |
+ quota = tg->cfs_bandwidth.quota; |
10859 |
+ |
10860 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
10861 |
+index be55a64748ba..d905c443e10e 100644 |
10862 |
+--- a/kernel/sched/fair.c |
10863 |
++++ b/kernel/sched/fair.c |
10864 |
+@@ -9456,22 +9456,26 @@ static inline int on_null_domain(struct rq *rq) |
10865 |
+ * - When one of the busy CPUs notice that there may be an idle rebalancing |
10866 |
+ * needed, they will kick the idle load balancer, which then does idle |
10867 |
+ * load balancing for all the idle CPUs. |
10868 |
++ * - HK_FLAG_MISC CPUs are used for this task, because HK_FLAG_SCHED not set |
10869 |
++ * anywhere yet. |
10870 |
+ */ |
10871 |
+ |
10872 |
+ static inline int find_new_ilb(void) |
10873 |
+ { |
10874 |
+- int ilb = cpumask_first(nohz.idle_cpus_mask); |
10875 |
++ int ilb; |
10876 |
+ |
10877 |
+- if (ilb < nr_cpu_ids && idle_cpu(ilb)) |
10878 |
+- return ilb; |
10879 |
++ for_each_cpu_and(ilb, nohz.idle_cpus_mask, |
10880 |
++ housekeeping_cpumask(HK_FLAG_MISC)) { |
10881 |
++ if (idle_cpu(ilb)) |
10882 |
++ return ilb; |
10883 |
++ } |
10884 |
+ |
10885 |
+ return nr_cpu_ids; |
10886 |
+ } |
10887 |
+ |
10888 |
+ /* |
10889 |
+- * Kick a CPU to do the nohz balancing, if it is time for it. We pick the |
10890 |
+- * nohz_load_balancer CPU (if there is one) otherwise fallback to any idle |
10891 |
+- * CPU (if there is one). |
10892 |
++ * Kick a CPU to do the nohz balancing, if it is time for it. We pick any |
10893 |
++ * idle CPU in the HK_FLAG_MISC housekeeping set (if there is one). |
10894 |
+ */ |
10895 |
+ static void kick_ilb(unsigned int flags) |
10896 |
+ { |
10897 |
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
10898 |
+index e4f398ad9e73..aa7ee3a0bf90 100644 |
10899 |
+--- a/kernel/sched/rt.c |
10900 |
++++ b/kernel/sched/rt.c |
10901 |
+@@ -2555,6 +2555,8 @@ int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us) |
10902 |
+ rt_runtime = (u64)rt_runtime_us * NSEC_PER_USEC; |
10903 |
+ if (rt_runtime_us < 0) |
10904 |
+ rt_runtime = RUNTIME_INF; |
10905 |
++ else if ((u64)rt_runtime_us > U64_MAX / NSEC_PER_USEC) |
10906 |
++ return -EINVAL; |
10907 |
+ |
10908 |
+ return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); |
10909 |
+ } |
10910 |
+@@ -2575,6 +2577,9 @@ int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us) |
10911 |
+ { |
10912 |
+ u64 rt_runtime, rt_period; |
10913 |
+ |
10914 |
++ if (rt_period_us > U64_MAX / NSEC_PER_USEC) |
10915 |
++ return -EINVAL; |
10916 |
++ |
10917 |
+ rt_period = rt_period_us * NSEC_PER_USEC; |
10918 |
+ rt_runtime = tg->rt_bandwidth.rt_runtime; |
10919 |
+ |
10920 |
+diff --git a/kernel/time/time.c b/kernel/time/time.c |
10921 |
+index 2edb5088a70b..e7a3b9236f0b 100644 |
10922 |
+--- a/kernel/time/time.c |
10923 |
++++ b/kernel/time/time.c |
10924 |
+@@ -171,7 +171,7 @@ int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz |
10925 |
+ static int firsttime = 1; |
10926 |
+ int error = 0; |
10927 |
+ |
10928 |
+- if (tv && !timespec64_valid(tv)) |
10929 |
++ if (tv && !timespec64_valid_settod(tv)) |
10930 |
+ return -EINVAL; |
10931 |
+ |
10932 |
+ error = security_settime64(tv, tz); |
10933 |
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
10934 |
+index ac5dbf2cd4a2..161b2728ac09 100644 |
10935 |
+--- a/kernel/time/timekeeping.c |
10936 |
++++ b/kernel/time/timekeeping.c |
10937 |
+@@ -1221,7 +1221,7 @@ int do_settimeofday64(const struct timespec64 *ts) |
10938 |
+ unsigned long flags; |
10939 |
+ int ret = 0; |
10940 |
+ |
10941 |
+- if (!timespec64_valid_strict(ts)) |
10942 |
++ if (!timespec64_valid_settod(ts)) |
10943 |
+ return -EINVAL; |
10944 |
+ |
10945 |
+ raw_spin_lock_irqsave(&timekeeper_lock, flags); |
10946 |
+@@ -1278,7 +1278,7 @@ static int timekeeping_inject_offset(const struct timespec64 *ts) |
10947 |
+ /* Make sure the proposed value is valid */ |
10948 |
+ tmp = timespec64_add(tk_xtime(tk), *ts); |
10949 |
+ if (timespec64_compare(&tk->wall_to_monotonic, ts) > 0 || |
10950 |
+- !timespec64_valid_strict(&tmp)) { |
10951 |
++ !timespec64_valid_settod(&tmp)) { |
10952 |
+ ret = -EINVAL; |
10953 |
+ goto error; |
10954 |
+ } |
10955 |
+@@ -1527,7 +1527,7 @@ void __init timekeeping_init(void) |
10956 |
+ unsigned long flags; |
10957 |
+ |
10958 |
+ read_persistent_wall_and_boot_offset(&wall_time, &boot_offset); |
10959 |
+- if (timespec64_valid_strict(&wall_time) && |
10960 |
++ if (timespec64_valid_settod(&wall_time) && |
10961 |
+ timespec64_to_ns(&wall_time) > 0) { |
10962 |
+ persistent_clock_exists = true; |
10963 |
+ } else if (timespec64_to_ns(&wall_time) != 0) { |
10964 |
+diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c |
10965 |
+index 4ad967453b6f..3ea65cdff30d 100644 |
10966 |
+--- a/kernel/trace/trace_branch.c |
10967 |
++++ b/kernel/trace/trace_branch.c |
10968 |
+@@ -205,6 +205,8 @@ void trace_likely_condition(struct ftrace_likely_data *f, int val, int expect) |
10969 |
+ void ftrace_likely_update(struct ftrace_likely_data *f, int val, |
10970 |
+ int expect, int is_constant) |
10971 |
+ { |
10972 |
++ unsigned long flags = user_access_save(); |
10973 |
++ |
10974 |
+ /* A constant is always correct */ |
10975 |
+ if (is_constant) { |
10976 |
+ f->constant++; |
10977 |
+@@ -223,6 +225,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, |
10978 |
+ f->data.correct++; |
10979 |
+ else |
10980 |
+ f->data.incorrect++; |
10981 |
++ |
10982 |
++ user_access_restore(flags); |
10983 |
+ } |
10984 |
+ EXPORT_SYMBOL(ftrace_likely_update); |
10985 |
+ |
10986 |
+diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c |
10987 |
+index 27c6118afd1c..bd26df36757f 100644 |
10988 |
+--- a/lib/kobject_uevent.c |
10989 |
++++ b/lib/kobject_uevent.c |
10990 |
+@@ -466,6 +466,13 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
10991 |
+ int i = 0; |
10992 |
+ int retval = 0; |
10993 |
+ |
10994 |
++ /* |
10995 |
++ * Mark "remove" event done regardless of result, for some subsystems |
10996 |
++ * do not want to re-trigger "remove" event via automatic cleanup. |
10997 |
++ */ |
10998 |
++ if (action == KOBJ_REMOVE) |
10999 |
++ kobj->state_remove_uevent_sent = 1; |
11000 |
++ |
11001 |
+ pr_debug("kobject: '%s' (%p): %s\n", |
11002 |
+ kobject_name(kobj), kobj, __func__); |
11003 |
+ |
11004 |
+@@ -567,10 +574,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
11005 |
+ kobj->state_add_uevent_sent = 1; |
11006 |
+ break; |
11007 |
+ |
11008 |
+- case KOBJ_REMOVE: |
11009 |
+- kobj->state_remove_uevent_sent = 1; |
11010 |
+- break; |
11011 |
+- |
11012 |
+ case KOBJ_UNBIND: |
11013 |
+ zap_modalias_env(env); |
11014 |
+ break; |
11015 |
+diff --git a/lib/sbitmap.c b/lib/sbitmap.c |
11016 |
+index 155fe38756ec..4a7fc4915dfc 100644 |
11017 |
+--- a/lib/sbitmap.c |
11018 |
++++ b/lib/sbitmap.c |
11019 |
+@@ -435,7 +435,7 @@ static void sbitmap_queue_update_wake_batch(struct sbitmap_queue *sbq, |
11020 |
+ * to ensure that the batch size is updated before the wait |
11021 |
+ * counts. |
11022 |
+ */ |
11023 |
+- smp_mb__before_atomic(); |
11024 |
++ smp_mb(); |
11025 |
+ for (i = 0; i < SBQ_WAIT_QUEUES; i++) |
11026 |
+ atomic_set(&sbq->ws[i].wait_cnt, 1); |
11027 |
+ } |
11028 |
+diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c |
11029 |
+index 58eacd41526c..023ba9f3b99f 100644 |
11030 |
+--- a/lib/strncpy_from_user.c |
11031 |
++++ b/lib/strncpy_from_user.c |
11032 |
+@@ -23,10 +23,11 @@ |
11033 |
+ * hit it), 'max' is the address space maximum (and we return |
11034 |
+ * -EFAULT if we hit it). |
11035 |
+ */ |
11036 |
+-static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max) |
11037 |
++static inline long do_strncpy_from_user(char *dst, const char __user *src, |
11038 |
++ unsigned long count, unsigned long max) |
11039 |
+ { |
11040 |
+ const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
11041 |
+- long res = 0; |
11042 |
++ unsigned long res = 0; |
11043 |
+ |
11044 |
+ /* |
11045 |
+ * Truncate 'max' to the user-specified limit, so that |
11046 |
+diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c |
11047 |
+index 1c1a1b0e38a5..7f2db3fe311f 100644 |
11048 |
+--- a/lib/strnlen_user.c |
11049 |
++++ b/lib/strnlen_user.c |
11050 |
+@@ -28,7 +28,7 @@ |
11051 |
+ static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) |
11052 |
+ { |
11053 |
+ const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
11054 |
+- long align, res = 0; |
11055 |
++ unsigned long align, res = 0; |
11056 |
+ unsigned long c; |
11057 |
+ |
11058 |
+ /* |
11059 |
+@@ -42,7 +42,7 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, |
11060 |
+ * Do everything aligned. But that means that we |
11061 |
+ * need to also expand the maximum.. |
11062 |
+ */ |
11063 |
+- align = (sizeof(long) - 1) & (unsigned long)src; |
11064 |
++ align = (sizeof(unsigned long) - 1) & (unsigned long)src; |
11065 |
+ src -= align; |
11066 |
+ max += align; |
11067 |
+ |
11068 |
+diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c |
11069 |
+index b9ffe1826527..0b8d84ece7db 100644 |
11070 |
+--- a/net/batman-adv/distributed-arp-table.c |
11071 |
++++ b/net/batman-adv/distributed-arp-table.c |
11072 |
+@@ -1398,7 +1398,6 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, |
11073 |
+ hw_src, &ip_src, hw_dst, &ip_dst, |
11074 |
+ dat_entry->mac_addr, &dat_entry->ip); |
11075 |
+ dropped = true; |
11076 |
+- goto out; |
11077 |
+ } |
11078 |
+ |
11079 |
+ /* Update our internal cache with both the IP addresses the node got |
11080 |
+@@ -1407,6 +1406,9 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, |
11081 |
+ batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid); |
11082 |
+ batadv_dat_entry_add(bat_priv, ip_dst, hw_dst, vid); |
11083 |
+ |
11084 |
++ if (dropped) |
11085 |
++ goto out; |
11086 |
++ |
11087 |
+ /* If BLA is enabled, only forward ARP replies if we have claimed the |
11088 |
+ * source of the ARP reply or if no one else of the same backbone has |
11089 |
+ * already claimed that client. This prevents that different gateways |
11090 |
+diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c |
11091 |
+index d1ed839fd32b..64558df6a119 100644 |
11092 |
+--- a/net/batman-adv/main.c |
11093 |
++++ b/net/batman-adv/main.c |
11094 |
+@@ -161,6 +161,7 @@ int batadv_mesh_init(struct net_device *soft_iface) |
11095 |
+ spin_lock_init(&bat_priv->tt.commit_lock); |
11096 |
+ spin_lock_init(&bat_priv->gw.list_lock); |
11097 |
+ #ifdef CONFIG_BATMAN_ADV_MCAST |
11098 |
++ spin_lock_init(&bat_priv->mcast.mla_lock); |
11099 |
+ spin_lock_init(&bat_priv->mcast.want_lists_lock); |
11100 |
+ #endif |
11101 |
+ spin_lock_init(&bat_priv->tvlv.container_list_lock); |
11102 |
+diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c |
11103 |
+index 69244e4598f5..454b9067fbbd 100644 |
11104 |
+--- a/net/batman-adv/multicast.c |
11105 |
++++ b/net/batman-adv/multicast.c |
11106 |
+@@ -325,8 +325,6 @@ static void batadv_mcast_mla_list_free(struct hlist_head *mcast_list) |
11107 |
+ * translation table except the ones listed in the given mcast_list. |
11108 |
+ * |
11109 |
+ * If mcast_list is NULL then all are retracted. |
11110 |
+- * |
11111 |
+- * Do not call outside of the mcast worker! (or cancel mcast worker first) |
11112 |
+ */ |
11113 |
+ static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, |
11114 |
+ struct hlist_head *mcast_list) |
11115 |
+@@ -334,8 +332,6 @@ static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, |
11116 |
+ struct batadv_hw_addr *mcast_entry; |
11117 |
+ struct hlist_node *tmp; |
11118 |
+ |
11119 |
+- WARN_ON(delayed_work_pending(&bat_priv->mcast.work)); |
11120 |
+- |
11121 |
+ hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, |
11122 |
+ list) { |
11123 |
+ if (mcast_list && |
11124 |
+@@ -359,8 +355,6 @@ static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, |
11125 |
+ * |
11126 |
+ * Adds multicast listener announcements from the given mcast_list to the |
11127 |
+ * translation table if they have not been added yet. |
11128 |
+- * |
11129 |
+- * Do not call outside of the mcast worker! (or cancel mcast worker first) |
11130 |
+ */ |
11131 |
+ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, |
11132 |
+ struct hlist_head *mcast_list) |
11133 |
+@@ -368,8 +362,6 @@ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, |
11134 |
+ struct batadv_hw_addr *mcast_entry; |
11135 |
+ struct hlist_node *tmp; |
11136 |
+ |
11137 |
+- WARN_ON(delayed_work_pending(&bat_priv->mcast.work)); |
11138 |
+- |
11139 |
+ if (!mcast_list) |
11140 |
+ return; |
11141 |
+ |
11142 |
+@@ -658,7 +650,10 @@ static void batadv_mcast_mla_update(struct work_struct *work) |
11143 |
+ priv_mcast = container_of(delayed_work, struct batadv_priv_mcast, work); |
11144 |
+ bat_priv = container_of(priv_mcast, struct batadv_priv, mcast); |
11145 |
+ |
11146 |
++ spin_lock(&bat_priv->mcast.mla_lock); |
11147 |
+ __batadv_mcast_mla_update(bat_priv); |
11148 |
++ spin_unlock(&bat_priv->mcast.mla_lock); |
11149 |
++ |
11150 |
+ batadv_mcast_start_timer(bat_priv); |
11151 |
+ } |
11152 |
+ |
11153 |
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h |
11154 |
+index cbe17da36fcb..2b0ea1cbbc2f 100644 |
11155 |
+--- a/net/batman-adv/types.h |
11156 |
++++ b/net/batman-adv/types.h |
11157 |
+@@ -1223,6 +1223,11 @@ struct batadv_priv_mcast { |
11158 |
+ /** @bridged: whether the soft interface has a bridge on top */ |
11159 |
+ unsigned char bridged:1; |
11160 |
+ |
11161 |
++ /** |
11162 |
++ * @mla_lock: a lock protecting mla_list and mla_flags |
11163 |
++ */ |
11164 |
++ spinlock_t mla_lock; |
11165 |
++ |
11166 |
+ /** |
11167 |
+ * @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP |
11168 |
+ * traffic |
11169 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
11170 |
+index 7352fe85674b..c25c664a2504 100644 |
11171 |
+--- a/net/bluetooth/hci_core.c |
11172 |
++++ b/net/bluetooth/hci_core.c |
11173 |
+@@ -4337,6 +4337,9 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status, |
11174 |
+ return; |
11175 |
+ } |
11176 |
+ |
11177 |
++ /* If we reach this point this event matches the last command sent */ |
11178 |
++ hci_dev_clear_flag(hdev, HCI_CMD_PENDING); |
11179 |
++ |
11180 |
+ /* If the command succeeded and there's still more commands in |
11181 |
+ * this request the request is not yet complete. |
11182 |
+ */ |
11183 |
+@@ -4447,6 +4450,8 @@ static void hci_cmd_work(struct work_struct *work) |
11184 |
+ |
11185 |
+ hdev->sent_cmd = skb_clone(skb, GFP_KERNEL); |
11186 |
+ if (hdev->sent_cmd) { |
11187 |
++ if (hci_req_status_pend(hdev)) |
11188 |
++ hci_dev_set_flag(hdev, HCI_CMD_PENDING); |
11189 |
+ atomic_dec(&hdev->cmd_cnt); |
11190 |
+ hci_send_frame(hdev, skb); |
11191 |
+ if (test_bit(HCI_RESET, &hdev->flags)) |
11192 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
11193 |
+index ac2826ce162b..ef5ae4c7e286 100644 |
11194 |
+--- a/net/bluetooth/hci_event.c |
11195 |
++++ b/net/bluetooth/hci_event.c |
11196 |
+@@ -3404,6 +3404,12 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, |
11197 |
+ hci_req_cmd_complete(hdev, *opcode, *status, req_complete, |
11198 |
+ req_complete_skb); |
11199 |
+ |
11200 |
++ if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) { |
11201 |
++ bt_dev_err(hdev, |
11202 |
++ "unexpected event for opcode 0x%4.4x", *opcode); |
11203 |
++ return; |
11204 |
++ } |
11205 |
++ |
11206 |
+ if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) |
11207 |
+ queue_work(hdev->workqueue, &hdev->cmd_work); |
11208 |
+ } |
11209 |
+@@ -3511,6 +3517,12 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb, |
11210 |
+ hci_req_cmd_complete(hdev, *opcode, ev->status, req_complete, |
11211 |
+ req_complete_skb); |
11212 |
+ |
11213 |
++ if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) { |
11214 |
++ bt_dev_err(hdev, |
11215 |
++ "unexpected event for opcode 0x%4.4x", *opcode); |
11216 |
++ return; |
11217 |
++ } |
11218 |
++ |
11219 |
+ if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) |
11220 |
+ queue_work(hdev->workqueue, &hdev->cmd_work); |
11221 |
+ } |
11222 |
+diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c |
11223 |
+index ca73d36cc149..e9a95ed65491 100644 |
11224 |
+--- a/net/bluetooth/hci_request.c |
11225 |
++++ b/net/bluetooth/hci_request.c |
11226 |
+@@ -46,6 +46,11 @@ void hci_req_purge(struct hci_request *req) |
11227 |
+ skb_queue_purge(&req->cmd_q); |
11228 |
+ } |
11229 |
+ |
11230 |
++bool hci_req_status_pend(struct hci_dev *hdev) |
11231 |
++{ |
11232 |
++ return hdev->req_status == HCI_REQ_PEND; |
11233 |
++} |
11234 |
++ |
11235 |
+ static int req_run(struct hci_request *req, hci_req_complete_t complete, |
11236 |
+ hci_req_complete_skb_t complete_skb) |
11237 |
+ { |
11238 |
+diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h |
11239 |
+index 692cc8b13368..55b2050cc9ff 100644 |
11240 |
+--- a/net/bluetooth/hci_request.h |
11241 |
++++ b/net/bluetooth/hci_request.h |
11242 |
+@@ -37,6 +37,7 @@ struct hci_request { |
11243 |
+ |
11244 |
+ void hci_req_init(struct hci_request *req, struct hci_dev *hdev); |
11245 |
+ void hci_req_purge(struct hci_request *req); |
11246 |
++bool hci_req_status_pend(struct hci_dev *hdev); |
11247 |
+ int hci_req_run(struct hci_request *req, hci_req_complete_t complete); |
11248 |
+ int hci_req_run_skb(struct hci_request *req, hci_req_complete_skb_t complete); |
11249 |
+ void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, |
11250 |
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
11251 |
+index 687821567287..715ab0e6579c 100644 |
11252 |
+--- a/net/mac80211/mlme.c |
11253 |
++++ b/net/mac80211/mlme.c |
11254 |
+@@ -1167,9 +1167,6 @@ static void ieee80211_chswitch_work(struct work_struct *work) |
11255 |
+ goto out; |
11256 |
+ } |
11257 |
+ |
11258 |
+- /* XXX: shouldn't really modify cfg80211-owned data! */ |
11259 |
+- ifmgd->associated->channel = sdata->csa_chandef.chan; |
11260 |
+- |
11261 |
+ ifmgd->csa_waiting_bcn = true; |
11262 |
+ |
11263 |
+ ieee80211_sta_reset_beacon_monitor(sdata); |
11264 |
+diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c |
11265 |
+index 36619ad8ab8c..8233dfafb339 100644 |
11266 |
+--- a/net/netfilter/nf_conntrack_netlink.c |
11267 |
++++ b/net/netfilter/nf_conntrack_netlink.c |
11268 |
+@@ -1254,7 +1254,7 @@ static int ctnetlink_del_conntrack(struct net *net, struct sock *ctnl, |
11269 |
+ struct nf_conntrack_tuple tuple; |
11270 |
+ struct nf_conn *ct; |
11271 |
+ struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
11272 |
+- u_int8_t u3 = nfmsg->nfgen_family; |
11273 |
++ u_int8_t u3 = nfmsg->version ? nfmsg->nfgen_family : AF_UNSPEC; |
11274 |
+ struct nf_conntrack_zone zone; |
11275 |
+ int err; |
11276 |
+ |
11277 |
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
11278 |
+index 156ce708b533..0044bfb526ab 100644 |
11279 |
+--- a/net/wireless/nl80211.c |
11280 |
++++ b/net/wireless/nl80211.c |
11281 |
+@@ -15667,6 +15667,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
11282 |
+ |
11283 |
+ wdev->chandef = *chandef; |
11284 |
+ wdev->preset_chandef = *chandef; |
11285 |
++ |
11286 |
++ if (wdev->iftype == NL80211_IFTYPE_STATION && |
11287 |
++ !WARN_ON(!wdev->current_bss)) |
11288 |
++ wdev->current_bss->pub.channel = chandef->chan; |
11289 |
++ |
11290 |
+ nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, |
11291 |
+ NL80211_CMD_CH_SWITCH_NOTIFY, 0); |
11292 |
+ } |
11293 |
+diff --git a/samples/bpf/asm_goto_workaround.h b/samples/bpf/asm_goto_workaround.h |
11294 |
+index 5cd7c1d1a5d5..7409722727ca 100644 |
11295 |
+--- a/samples/bpf/asm_goto_workaround.h |
11296 |
++++ b/samples/bpf/asm_goto_workaround.h |
11297 |
+@@ -13,4 +13,5 @@ |
11298 |
+ #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") |
11299 |
+ #endif |
11300 |
+ |
11301 |
++#define volatile(x...) volatile("") |
11302 |
+ #endif |
11303 |
+diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c |
11304 |
+index 186e727b737b..6fd9954e1c08 100644 |
11305 |
+--- a/security/selinux/netlabel.c |
11306 |
++++ b/security/selinux/netlabel.c |
11307 |
+@@ -288,11 +288,8 @@ int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep, |
11308 |
+ int rc; |
11309 |
+ struct netlbl_lsm_secattr secattr; |
11310 |
+ struct sk_security_struct *sksec = ep->base.sk->sk_security; |
11311 |
+- struct sockaddr *addr; |
11312 |
+ struct sockaddr_in addr4; |
11313 |
+-#if IS_ENABLED(CONFIG_IPV6) |
11314 |
+ struct sockaddr_in6 addr6; |
11315 |
+-#endif |
11316 |
+ |
11317 |
+ if (ep->base.sk->sk_family != PF_INET && |
11318 |
+ ep->base.sk->sk_family != PF_INET6) |
11319 |
+@@ -310,16 +307,15 @@ int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep, |
11320 |
+ if (ip_hdr(skb)->version == 4) { |
11321 |
+ addr4.sin_family = AF_INET; |
11322 |
+ addr4.sin_addr.s_addr = ip_hdr(skb)->saddr; |
11323 |
+- addr = (struct sockaddr *)&addr4; |
11324 |
+-#if IS_ENABLED(CONFIG_IPV6) |
11325 |
+- } else { |
11326 |
++ rc = netlbl_conn_setattr(ep->base.sk, (void *)&addr4, &secattr); |
11327 |
++ } else if (IS_ENABLED(CONFIG_IPV6) && ip_hdr(skb)->version == 6) { |
11328 |
+ addr6.sin6_family = AF_INET6; |
11329 |
+ addr6.sin6_addr = ipv6_hdr(skb)->saddr; |
11330 |
+- addr = (struct sockaddr *)&addr6; |
11331 |
+-#endif |
11332 |
++ rc = netlbl_conn_setattr(ep->base.sk, (void *)&addr6, &secattr); |
11333 |
++ } else { |
11334 |
++ rc = -EAFNOSUPPORT; |
11335 |
+ } |
11336 |
+ |
11337 |
+- rc = netlbl_conn_setattr(ep->base.sk, addr, &secattr); |
11338 |
+ if (rc == 0) |
11339 |
+ sksec->nlbl_state = NLBL_LABELED; |
11340 |
+ |
11341 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
11342 |
+index b238e903b9d7..a00bd7986646 100644 |
11343 |
+--- a/sound/pci/hda/hda_codec.c |
11344 |
++++ b/sound/pci/hda/hda_codec.c |
11345 |
+@@ -841,7 +841,13 @@ static int snd_hda_codec_dev_free(struct snd_device *device) |
11346 |
+ struct hda_codec *codec = device->device_data; |
11347 |
+ |
11348 |
+ codec->in_freeing = 1; |
11349 |
+- snd_hdac_device_unregister(&codec->core); |
11350 |
++ /* |
11351 |
++ * snd_hda_codec_device_new() is used by legacy HDA and ASoC driver. |
11352 |
++ * We can't unregister ASoC device since it will be unregistered in |
11353 |
++ * snd_hdac_ext_bus_device_remove(). |
11354 |
++ */ |
11355 |
++ if (codec->core.type == HDA_DEV_LEGACY) |
11356 |
++ snd_hdac_device_unregister(&codec->core); |
11357 |
+ codec_display_power(codec, false); |
11358 |
+ put_device(hda_codec_dev(codec)); |
11359 |
+ return 0; |
11360 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
11361 |
+index d5f73c837281..7994e8ddc7d2 100644 |
11362 |
+--- a/sound/soc/codecs/hdmi-codec.c |
11363 |
++++ b/sound/soc/codecs/hdmi-codec.c |
11364 |
+@@ -439,8 +439,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, |
11365 |
+ if (!ret) { |
11366 |
+ ret = snd_pcm_hw_constraint_eld(substream->runtime, |
11367 |
+ hcp->eld); |
11368 |
+- if (ret) |
11369 |
++ if (ret) { |
11370 |
++ mutex_lock(&hcp->current_stream_lock); |
11371 |
++ hcp->current_stream = NULL; |
11372 |
++ mutex_unlock(&hcp->current_stream_lock); |
11373 |
+ return ret; |
11374 |
++ } |
11375 |
+ } |
11376 |
+ /* Select chmap supported */ |
11377 |
+ hdmi_codec_eld_chmap(hcp); |
11378 |
+diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig |
11379 |
+index 2e75b5bc5f1d..f721cd4e3f97 100644 |
11380 |
+--- a/sound/soc/fsl/Kconfig |
11381 |
++++ b/sound/soc/fsl/Kconfig |
11382 |
+@@ -173,16 +173,17 @@ config SND_MPC52xx_SOC_EFIKA |
11383 |
+ |
11384 |
+ endif # SND_POWERPC_SOC |
11385 |
+ |
11386 |
++config SND_SOC_IMX_PCM_FIQ |
11387 |
++ tristate |
11388 |
++ default y if SND_SOC_IMX_SSI=y && (SND_SOC_FSL_SSI=m || SND_SOC_FSL_SPDIF=m) && (MXC_TZIC || MXC_AVIC) |
11389 |
++ select FIQ |
11390 |
++ |
11391 |
+ if SND_IMX_SOC |
11392 |
+ |
11393 |
+ config SND_SOC_IMX_SSI |
11394 |
+ tristate |
11395 |
+ select SND_SOC_FSL_UTILS |
11396 |
+ |
11397 |
+-config SND_SOC_IMX_PCM_FIQ |
11398 |
+- tristate |
11399 |
+- select FIQ |
11400 |
+- |
11401 |
+ comment "SoC Audio support for Freescale i.MX boards:" |
11402 |
+ |
11403 |
+ config SND_MXC_SOC_WM1133_EV1 |
11404 |
+diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c |
11405 |
+index 191426a6d9ad..30a3d68b5c03 100644 |
11406 |
+--- a/sound/soc/fsl/eukrea-tlv320.c |
11407 |
++++ b/sound/soc/fsl/eukrea-tlv320.c |
11408 |
+@@ -118,13 +118,13 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) |
11409 |
+ if (ret) { |
11410 |
+ dev_err(&pdev->dev, |
11411 |
+ "fsl,mux-int-port node missing or invalid.\n"); |
11412 |
+- return ret; |
11413 |
++ goto err; |
11414 |
+ } |
11415 |
+ ret = of_property_read_u32(np, "fsl,mux-ext-port", &ext_port); |
11416 |
+ if (ret) { |
11417 |
+ dev_err(&pdev->dev, |
11418 |
+ "fsl,mux-ext-port node missing or invalid.\n"); |
11419 |
+- return ret; |
11420 |
++ goto err; |
11421 |
+ } |
11422 |
+ |
11423 |
+ /* |
11424 |
+diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c |
11425 |
+index 4163f2cfc06f..bfc5b21d0c3f 100644 |
11426 |
+--- a/sound/soc/fsl/fsl_sai.c |
11427 |
++++ b/sound/soc/fsl/fsl_sai.c |
11428 |
+@@ -268,12 +268,14 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, |
11429 |
+ case SND_SOC_DAIFMT_CBS_CFS: |
11430 |
+ val_cr2 |= FSL_SAI_CR2_BCD_MSTR; |
11431 |
+ val_cr4 |= FSL_SAI_CR4_FSD_MSTR; |
11432 |
++ sai->is_slave_mode = false; |
11433 |
+ break; |
11434 |
+ case SND_SOC_DAIFMT_CBM_CFM: |
11435 |
+ sai->is_slave_mode = true; |
11436 |
+ break; |
11437 |
+ case SND_SOC_DAIFMT_CBS_CFM: |
11438 |
+ val_cr2 |= FSL_SAI_CR2_BCD_MSTR; |
11439 |
++ sai->is_slave_mode = false; |
11440 |
+ break; |
11441 |
+ case SND_SOC_DAIFMT_CBM_CFS: |
11442 |
+ val_cr4 |= FSL_SAI_CR4_FSD_MSTR; |
11443 |
+diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c |
11444 |
+index 9981668ab590..040d06b89f00 100644 |
11445 |
+--- a/sound/soc/fsl/fsl_utils.c |
11446 |
++++ b/sound/soc/fsl/fsl_utils.c |
11447 |
+@@ -71,6 +71,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, |
11448 |
+ iprop = of_get_property(dma_np, "cell-index", NULL); |
11449 |
+ if (!iprop) { |
11450 |
+ of_node_put(dma_np); |
11451 |
++ of_node_put(dma_channel_np); |
11452 |
+ return -EINVAL; |
11453 |
+ } |
11454 |
+ *dma_id = be32_to_cpup(iprop); |
11455 |
+diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c |
11456 |
+index 38f6ab74709d..07491a0f8fb8 100644 |
11457 |
+--- a/sound/soc/intel/boards/kbl_da7219_max98357a.c |
11458 |
++++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c |
11459 |
+@@ -188,7 +188,7 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) |
11460 |
+ |
11461 |
+ jack = &ctx->kabylake_headset; |
11462 |
+ |
11463 |
+- snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); |
11464 |
++ snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); |
11465 |
+ snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP); |
11466 |
+ snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); |
11467 |
+ snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); |
11468 |
+diff --git a/sound/soc/ti/Kconfig b/sound/soc/ti/Kconfig |
11469 |
+index 4bf3c15d4e51..ee7c202c69b7 100644 |
11470 |
+--- a/sound/soc/ti/Kconfig |
11471 |
++++ b/sound/soc/ti/Kconfig |
11472 |
+@@ -21,8 +21,8 @@ config SND_SOC_DAVINCI_ASP |
11473 |
+ |
11474 |
+ config SND_SOC_DAVINCI_MCASP |
11475 |
+ tristate "Multichannel Audio Serial Port (McASP) support" |
11476 |
+- select SND_SOC_TI_EDMA_PCM if TI_EDMA |
11477 |
+- select SND_SOC_TI_SDMA_PCM if DMA_OMAP |
11478 |
++ select SND_SOC_TI_EDMA_PCM |
11479 |
++ select SND_SOC_TI_SDMA_PCM |
11480 |
+ help |
11481 |
+ Say Y or M here if you want to have support for McASP IP found in |
11482 |
+ various Texas Instruments SoCs like: |
11483 |
+diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c |
11484 |
+index a10fcb5963c6..570d435e3e8b 100644 |
11485 |
+--- a/sound/soc/ti/davinci-mcasp.c |
11486 |
++++ b/sound/soc/ti/davinci-mcasp.c |
11487 |
+@@ -44,6 +44,7 @@ |
11488 |
+ |
11489 |
+ #define MCASP_MAX_AFIFO_DEPTH 64 |
11490 |
+ |
11491 |
++#ifdef CONFIG_PM |
11492 |
+ static u32 context_regs[] = { |
11493 |
+ DAVINCI_MCASP_TXFMCTL_REG, |
11494 |
+ DAVINCI_MCASP_RXFMCTL_REG, |
11495 |
+@@ -66,6 +67,7 @@ struct davinci_mcasp_context { |
11496 |
+ u32 *xrsr_regs; /* for serializer configuration */ |
11497 |
+ bool pm_state; |
11498 |
+ }; |
11499 |
++#endif |
11500 |
+ |
11501 |
+ struct davinci_mcasp_ruledata { |
11502 |
+ struct davinci_mcasp *mcasp; |
11503 |
+diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore |
11504 |
+index 67167e44b726..8248b8dd89d4 100644 |
11505 |
+--- a/tools/bpf/bpftool/.gitignore |
11506 |
++++ b/tools/bpf/bpftool/.gitignore |
11507 |
+@@ -1,5 +1,5 @@ |
11508 |
+ *.d |
11509 |
+-bpftool |
11510 |
++/bpftool |
11511 |
+ bpftool*.8 |
11512 |
+ bpf-helpers.* |
11513 |
+ FEATURE-DUMP.bpftool |
11514 |
+diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c |
11515 |
+index 88cbd110ae58..ddeb46c9eef2 100644 |
11516 |
+--- a/tools/lib/bpf/bpf.c |
11517 |
++++ b/tools/lib/bpf/bpf.c |
11518 |
+@@ -45,6 +45,8 @@ |
11519 |
+ # define __NR_bpf 349 |
11520 |
+ # elif defined(__s390__) |
11521 |
+ # define __NR_bpf 351 |
11522 |
++# elif defined(__arc__) |
11523 |
++# define __NR_bpf 280 |
11524 |
+ # else |
11525 |
+ # error __NR_bpf not defined. libbpf does not support your arch. |
11526 |
+ # endif |
11527 |
+diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h |
11528 |
+index 8f09de482839..64762a62c008 100644 |
11529 |
+--- a/tools/lib/bpf/bpf.h |
11530 |
++++ b/tools/lib/bpf/bpf.h |
11531 |
+@@ -26,6 +26,7 @@ |
11532 |
+ #include <linux/bpf.h> |
11533 |
+ #include <stdbool.h> |
11534 |
+ #include <stddef.h> |
11535 |
++#include <stdint.h> |
11536 |
+ |
11537 |
+ #ifdef __cplusplus |
11538 |
+ extern "C" { |
11539 |
+diff --git a/tools/testing/selftests/bpf/test_libbpf_open.c b/tools/testing/selftests/bpf/test_libbpf_open.c |
11540 |
+index 8fcd1c076add..cbd55f5f8d59 100644 |
11541 |
+--- a/tools/testing/selftests/bpf/test_libbpf_open.c |
11542 |
++++ b/tools/testing/selftests/bpf/test_libbpf_open.c |
11543 |
+@@ -11,6 +11,8 @@ static const char *__doc__ = |
11544 |
+ #include <bpf/libbpf.h> |
11545 |
+ #include <getopt.h> |
11546 |
+ |
11547 |
++#include "bpf_rlimit.h" |
11548 |
++ |
11549 |
+ static const struct option long_options[] = { |
11550 |
+ {"help", no_argument, NULL, 'h' }, |
11551 |
+ {"debug", no_argument, NULL, 'D' }, |
11552 |
+diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c |
11553 |
+index 4cdb63bf0521..9a9fc6c9b70b 100644 |
11554 |
+--- a/tools/testing/selftests/bpf/trace_helpers.c |
11555 |
++++ b/tools/testing/selftests/bpf/trace_helpers.c |
11556 |
+@@ -52,6 +52,10 @@ struct ksym *ksym_search(long key) |
11557 |
+ int start = 0, end = sym_cnt; |
11558 |
+ int result; |
11559 |
+ |
11560 |
++ /* kallsyms not loaded. return NULL */ |
11561 |
++ if (sym_cnt <= 0) |
11562 |
++ return NULL; |
11563 |
++ |
11564 |
+ while (start < end) { |
11565 |
+ size_t mid = start + (end - start) / 2; |
11566 |
+ |
11567 |
+diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c |
11568 |
+index 28d321ba311b..6f339882a6ca 100644 |
11569 |
+--- a/tools/testing/selftests/cgroup/test_memcontrol.c |
11570 |
++++ b/tools/testing/selftests/cgroup/test_memcontrol.c |
11571 |
+@@ -26,7 +26,7 @@ |
11572 |
+ */ |
11573 |
+ static int test_memcg_subtree_control(const char *root) |
11574 |
+ { |
11575 |
+- char *parent, *child, *parent2, *child2; |
11576 |
++ char *parent, *child, *parent2 = NULL, *child2 = NULL; |
11577 |
+ int ret = KSFT_FAIL; |
11578 |
+ char buf[PAGE_SIZE]; |
11579 |
+ |
11580 |
+@@ -34,50 +34,54 @@ static int test_memcg_subtree_control(const char *root) |
11581 |
+ parent = cg_name(root, "memcg_test_0"); |
11582 |
+ child = cg_name(root, "memcg_test_0/memcg_test_1"); |
11583 |
+ if (!parent || !child) |
11584 |
+- goto cleanup; |
11585 |
++ goto cleanup_free; |
11586 |
+ |
11587 |
+ if (cg_create(parent)) |
11588 |
+- goto cleanup; |
11589 |
++ goto cleanup_free; |
11590 |
+ |
11591 |
+ if (cg_write(parent, "cgroup.subtree_control", "+memory")) |
11592 |
+- goto cleanup; |
11593 |
++ goto cleanup_parent; |
11594 |
+ |
11595 |
+ if (cg_create(child)) |
11596 |
+- goto cleanup; |
11597 |
++ goto cleanup_parent; |
11598 |
+ |
11599 |
+ if (cg_read_strstr(child, "cgroup.controllers", "memory")) |
11600 |
+- goto cleanup; |
11601 |
++ goto cleanup_child; |
11602 |
+ |
11603 |
+ /* Create two nested cgroups without enabling memory controller */ |
11604 |
+ parent2 = cg_name(root, "memcg_test_1"); |
11605 |
+ child2 = cg_name(root, "memcg_test_1/memcg_test_1"); |
11606 |
+ if (!parent2 || !child2) |
11607 |
+- goto cleanup; |
11608 |
++ goto cleanup_free2; |
11609 |
+ |
11610 |
+ if (cg_create(parent2)) |
11611 |
+- goto cleanup; |
11612 |
++ goto cleanup_free2; |
11613 |
+ |
11614 |
+ if (cg_create(child2)) |
11615 |
+- goto cleanup; |
11616 |
++ goto cleanup_parent2; |
11617 |
+ |
11618 |
+ if (cg_read(child2, "cgroup.controllers", buf, sizeof(buf))) |
11619 |
+- goto cleanup; |
11620 |
++ goto cleanup_all; |
11621 |
+ |
11622 |
+ if (!cg_read_strstr(child2, "cgroup.controllers", "memory")) |
11623 |
+- goto cleanup; |
11624 |
++ goto cleanup_all; |
11625 |
+ |
11626 |
+ ret = KSFT_PASS; |
11627 |
+ |
11628 |
+-cleanup: |
11629 |
+- cg_destroy(child); |
11630 |
+- cg_destroy(parent); |
11631 |
+- free(parent); |
11632 |
+- free(child); |
11633 |
+- |
11634 |
++cleanup_all: |
11635 |
+ cg_destroy(child2); |
11636 |
++cleanup_parent2: |
11637 |
+ cg_destroy(parent2); |
11638 |
++cleanup_free2: |
11639 |
+ free(parent2); |
11640 |
+ free(child2); |
11641 |
++cleanup_child: |
11642 |
++ cg_destroy(child); |
11643 |
++cleanup_parent: |
11644 |
++ cg_destroy(parent); |
11645 |
++cleanup_free: |
11646 |
++ free(parent); |
11647 |
++ free(child); |
11648 |
+ |
11649 |
+ return ret; |
11650 |
+ } |