Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Fri, 06 Sep 2019 17:25:07
Message-Id: 1567790681.eaf6eee7a1521f25a2bcd2b1479df9fb2357c96e.mpagano@gentoo
1 commit: eaf6eee7a1521f25a2bcd2b1479df9fb2357c96e
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 6 17:24:41 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 6 17:24:41 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=eaf6eee7
7
8 Linux patch 4.19.70 and 4.19.71
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1069_linux-4.19.70.patch | 2977 ++++++++++++++++++++++++++++++++++++++++++++++
14 1070_linux-4.19.71.patch | 92 ++
15 3 files changed, 3073 insertions(+)
16
17 diff --git a/0000_README b/0000_README
18 index c203203..807b793 100644
19 --- a/0000_README
20 +++ b/0000_README
21 @@ -319,6 +319,10 @@ Patch: 1068_linux-4.19.69.patch
22 From: https://www.kernel.org
23 Desc: Linux 4.19.69
24
25 +Patch: 1070_linux-4.19.70.patch
26 +From: https://www.kernel.org
27 +Desc: Linux 4.19.70
28 +
29 Patch: 1500_XATTR_USER_PREFIX.patch
30 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
31 Desc: Support for namespace user.pax.* on tmpfs.
32
33 diff --git a/1069_linux-4.19.70.patch b/1069_linux-4.19.70.patch
34 new file mode 100644
35 index 0000000..739863e
36 --- /dev/null
37 +++ b/1069_linux-4.19.70.patch
38 @@ -0,0 +1,2977 @@
39 +diff --git a/Makefile b/Makefile
40 +index 677341239449..ecf8806cb71f 100644
41 +--- a/Makefile
42 ++++ b/Makefile
43 +@@ -1,7 +1,7 @@
44 + # SPDX-License-Identifier: GPL-2.0
45 + VERSION = 4
46 + PATCHLEVEL = 19
47 +-SUBLEVEL = 69
48 ++SUBLEVEL = 70
49 + EXTRAVERSION =
50 + NAME = "People's Front"
51 +
52 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
53 +index bce06083685d..94babc3d0ec2 100644
54 +--- a/arch/arm64/kernel/cpufeature.c
55 ++++ b/arch/arm64/kernel/cpufeature.c
56 +@@ -165,9 +165,17 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {
57 + };
58 +
59 + static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
60 +- S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI),
61 +- S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI),
62 +- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI),
63 ++ /*
64 ++ * We already refuse to boot CPUs that don't support our configured
65 ++ * page size, so we can only detect mismatches for a page size other
66 ++ * than the one we're currently using. Unfortunately, SoCs like this
67 ++ * exist in the wild so, even though we don't like it, we'll have to go
68 ++ * along with it and treat them as non-strict.
69 ++ */
70 ++ S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI),
71 ++ S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI),
72 ++ ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI),
73 ++
74 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_BIGENDEL0_SHIFT, 4, 0),
75 + /* Linux shouldn't care about secure memory */
76 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_SNSMEM_SHIFT, 4, 0),
77 +diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
78 +index 9a3f2646ecc7..07a8004c3c23 100644
79 +--- a/arch/powerpc/kvm/book3s_64_vio.c
80 ++++ b/arch/powerpc/kvm/book3s_64_vio.c
81 +@@ -602,8 +602,10 @@ long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu,
82 +
83 + if (kvmppc_gpa_to_ua(vcpu->kvm,
84 + tce & ~(TCE_PCI_READ | TCE_PCI_WRITE),
85 +- &ua, NULL))
86 +- return H_PARAMETER;
87 ++ &ua, NULL)) {
88 ++ ret = H_PARAMETER;
89 ++ goto unlock_exit;
90 ++ }
91 +
92 + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
93 + ret = kvmppc_tce_iommu_map(vcpu->kvm, stt,
94 +diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c
95 +index 6821ead4b4eb..eb8b11515a7f 100644
96 +--- a/arch/powerpc/kvm/book3s_64_vio_hv.c
97 ++++ b/arch/powerpc/kvm/book3s_64_vio_hv.c
98 +@@ -528,8 +528,10 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
99 + ua = 0;
100 + if (kvmppc_gpa_to_ua(vcpu->kvm,
101 + tce & ~(TCE_PCI_READ | TCE_PCI_WRITE),
102 +- &ua, NULL))
103 +- return H_PARAMETER;
104 ++ &ua, NULL)) {
105 ++ ret = H_PARAMETER;
106 ++ goto unlock_exit;
107 ++ }
108 +
109 + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
110 + ret = kvmppc_rm_tce_iommu_map(vcpu->kvm, stt,
111 +diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
112 +index b316bd61a6ac..90be3a1506d3 100644
113 +--- a/arch/x86/kernel/apic/apic.c
114 ++++ b/arch/x86/kernel/apic/apic.c
115 +@@ -1140,6 +1140,10 @@ void clear_local_APIC(void)
116 + apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
117 + v = apic_read(APIC_LVT1);
118 + apic_write(APIC_LVT1, v | APIC_LVT_MASKED);
119 ++ if (!x2apic_enabled()) {
120 ++ v = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
121 ++ apic_write(APIC_LDR, v);
122 ++ }
123 + if (maxlvt >= 4) {
124 + v = apic_read(APIC_LVTPC);
125 + apic_write(APIC_LVTPC, v | APIC_LVT_MASKED);
126 +diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
127 +index afee386ff711..caedd8d60d36 100644
128 +--- a/arch/x86/kernel/apic/bigsmp_32.c
129 ++++ b/arch/x86/kernel/apic/bigsmp_32.c
130 +@@ -38,32 +38,12 @@ static int bigsmp_early_logical_apicid(int cpu)
131 + return early_per_cpu(x86_cpu_to_apicid, cpu);
132 + }
133 +
134 +-static inline unsigned long calculate_ldr(int cpu)
135 +-{
136 +- unsigned long val, id;
137 +-
138 +- val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
139 +- id = per_cpu(x86_bios_cpu_apicid, cpu);
140 +- val |= SET_APIC_LOGICAL_ID(id);
141 +-
142 +- return val;
143 +-}
144 +-
145 + /*
146 +- * Set up the logical destination ID.
147 +- *
148 +- * Intel recommends to set DFR, LDR and TPR before enabling
149 +- * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
150 +- * document number 292116). So here it goes...
151 ++ * bigsmp enables physical destination mode
152 ++ * and doesn't use LDR and DFR
153 + */
154 + static void bigsmp_init_apic_ldr(void)
155 + {
156 +- unsigned long val;
157 +- int cpu = smp_processor_id();
158 +-
159 +- apic_write(APIC_DFR, APIC_DFR_FLAT);
160 +- val = calculate_ldr(cpu);
161 +- apic_write(APIC_LDR, val);
162 + }
163 +
164 + static void bigsmp_setup_apic_routing(void)
165 +diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
166 +index aeba77881d85..516ec7586a5f 100644
167 +--- a/arch/x86/kernel/ptrace.c
168 ++++ b/arch/x86/kernel/ptrace.c
169 +@@ -652,11 +652,10 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
170 + {
171 + struct thread_struct *thread = &tsk->thread;
172 + unsigned long val = 0;
173 +- int index = n;
174 +
175 + if (n < HBP_NUM) {
176 ++ int index = array_index_nospec(n, HBP_NUM);
177 + struct perf_event *bp = thread->ptrace_bps[index];
178 +- index = array_index_nospec(index, HBP_NUM);
179 +
180 + if (bp)
181 + val = bp->hw.info.address;
182 +diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
183 +index deb576b23b7c..9119859ba787 100644
184 +--- a/arch/x86/kernel/uprobes.c
185 ++++ b/arch/x86/kernel/uprobes.c
186 +@@ -521,9 +521,12 @@ struct uprobe_xol_ops {
187 + void (*abort)(struct arch_uprobe *, struct pt_regs *);
188 + };
189 +
190 +-static inline int sizeof_long(void)
191 ++static inline int sizeof_long(struct pt_regs *regs)
192 + {
193 +- return in_ia32_syscall() ? 4 : 8;
194 ++ /*
195 ++ * Check registers for mode as in_xxx_syscall() does not apply here.
196 ++ */
197 ++ return user_64bit_mode(regs) ? 8 : 4;
198 + }
199 +
200 + static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
201 +@@ -534,9 +537,9 @@ static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
202 +
203 + static int emulate_push_stack(struct pt_regs *regs, unsigned long val)
204 + {
205 +- unsigned long new_sp = regs->sp - sizeof_long();
206 ++ unsigned long new_sp = regs->sp - sizeof_long(regs);
207 +
208 +- if (copy_to_user((void __user *)new_sp, &val, sizeof_long()))
209 ++ if (copy_to_user((void __user *)new_sp, &val, sizeof_long(regs)))
210 + return -EFAULT;
211 +
212 + regs->sp = new_sp;
213 +@@ -569,7 +572,7 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs
214 + long correction = utask->vaddr - utask->xol_vaddr;
215 + regs->ip += correction;
216 + } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) {
217 +- regs->sp += sizeof_long(); /* Pop incorrect return address */
218 ++ regs->sp += sizeof_long(regs); /* Pop incorrect return address */
219 + if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen))
220 + return -ERESTART;
221 + }
222 +@@ -688,7 +691,7 @@ static int branch_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
223 + * "call" insn was executed out-of-line. Just restore ->sp and restart.
224 + * We could also restore ->ip and try to call branch_emulate_op() again.
225 + */
226 +- regs->sp += sizeof_long();
227 ++ regs->sp += sizeof_long(regs);
228 + return -ERESTART;
229 + }
230 +
231 +@@ -1068,7 +1071,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
232 + unsigned long
233 + arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs)
234 + {
235 +- int rasize = sizeof_long(), nleft;
236 ++ int rasize = sizeof_long(regs), nleft;
237 + unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */
238 +
239 + if (copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize))
240 +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
241 +index 031bd7f91f98..5f5bc5976804 100644
242 +--- a/arch/x86/kvm/lapic.c
243 ++++ b/arch/x86/kvm/lapic.c
244 +@@ -209,6 +209,9 @@ static void recalculate_apic_map(struct kvm *kvm)
245 + if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id])
246 + new->phys_map[xapic_id] = apic;
247 +
248 ++ if (!kvm_apic_sw_enabled(apic))
249 ++ continue;
250 ++
251 + ldr = kvm_lapic_get_reg(apic, APIC_LDR);
252 +
253 + if (apic_x2apic_mode(apic)) {
254 +@@ -252,6 +255,8 @@ static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val)
255 + recalculate_apic_map(apic->vcpu->kvm);
256 + } else
257 + static_key_slow_inc(&apic_sw_disabled.key);
258 ++
259 ++ recalculate_apic_map(apic->vcpu->kvm);
260 + }
261 + }
262 +
263 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
264 +index e10a7a42449b..c27ce6059090 100644
265 +--- a/arch/x86/kvm/x86.c
266 ++++ b/arch/x86/kvm/x86.c
267 +@@ -6308,12 +6308,13 @@ restart:
268 + unsigned long rflags = kvm_x86_ops->get_rflags(vcpu);
269 + toggle_interruptibility(vcpu, ctxt->interruptibility);
270 + vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
271 +- kvm_rip_write(vcpu, ctxt->eip);
272 +- if (r == EMULATE_DONE && ctxt->tf)
273 +- kvm_vcpu_do_singlestep(vcpu, &r);
274 + if (!ctxt->have_exception ||
275 +- exception_type(ctxt->exception.vector) == EXCPT_TRAP)
276 ++ exception_type(ctxt->exception.vector) == EXCPT_TRAP) {
277 ++ kvm_rip_write(vcpu, ctxt->eip);
278 ++ if (r == EMULATE_DONE && ctxt->tf)
279 ++ kvm_vcpu_do_singlestep(vcpu, &r);
280 + __kvm_set_rflags(vcpu, ctxt->eflags);
281 ++ }
282 +
283 + /*
284 + * For STI, interrupts are shadowed; so KVM_REQ_EVENT will
285 +diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
286 +index 3b25a643058c..0b8e2a7d6e93 100644
287 +--- a/drivers/auxdisplay/panel.c
288 ++++ b/drivers/auxdisplay/panel.c
289 +@@ -1618,6 +1618,8 @@ static void panel_attach(struct parport *port)
290 + return;
291 +
292 + err_lcd_unreg:
293 ++ if (scan_timer.function)
294 ++ del_timer_sync(&scan_timer);
295 + if (lcd.enabled)
296 + charlcd_unregister(lcd.charlcd);
297 + err_unreg_device:
298 +diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
299 +index a4bc74e72c39..55869b362fdf 100644
300 +--- a/drivers/block/xen-blkback/xenbus.c
301 ++++ b/drivers/block/xen-blkback/xenbus.c
302 +@@ -974,6 +974,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
303 + }
304 + blkif->nr_ring_pages = nr_grefs;
305 +
306 ++ err = -ENOMEM;
307 + for (i = 0; i < nr_grefs * XEN_BLKIF_REQS_PER_PAGE; i++) {
308 + req = kzalloc(sizeof(*req), GFP_KERNEL);
309 + if (!req)
310 +@@ -996,7 +997,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
311 + err = xen_blkif_map(ring, ring_ref, nr_grefs, evtchn);
312 + if (err) {
313 + xenbus_dev_fatal(dev, err, "mapping ring-ref port %u", evtchn);
314 +- return err;
315 ++ goto fail;
316 + }
317 +
318 + return 0;
319 +@@ -1016,8 +1017,7 @@ fail:
320 + }
321 + kfree(req);
322 + }
323 +- return -ENOMEM;
324 +-
325 ++ return err;
326 + }
327 +
328 + static int connect_ring(struct backend_info *be)
329 +diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
330 +index d5f85455fa62..e31c02dc7770 100644
331 +--- a/drivers/bus/hisi_lpc.c
332 ++++ b/drivers/bus/hisi_lpc.c
333 +@@ -456,6 +456,17 @@ struct hisi_lpc_acpi_cell {
334 + size_t pdata_size;
335 + };
336 +
337 ++static void hisi_lpc_acpi_remove(struct device *hostdev)
338 ++{
339 ++ struct acpi_device *adev = ACPI_COMPANION(hostdev);
340 ++ struct acpi_device *child;
341 ++
342 ++ device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev);
343 ++
344 ++ list_for_each_entry(child, &adev->children, node)
345 ++ acpi_device_clear_enumerated(child);
346 ++}
347 ++
348 + /*
349 + * hisi_lpc_acpi_probe - probe children for ACPI FW
350 + * @hostdev: LPC host device pointer
351 +@@ -556,8 +567,7 @@ static int hisi_lpc_acpi_probe(struct device *hostdev)
352 + return 0;
353 +
354 + fail:
355 +- device_for_each_child(hostdev, NULL,
356 +- hisi_lpc_acpi_remove_subdev);
357 ++ hisi_lpc_acpi_remove(hostdev);
358 + return ret;
359 + }
360 +
361 +@@ -570,6 +580,10 @@ static int hisi_lpc_acpi_probe(struct device *dev)
362 + {
363 + return -ENODEV;
364 + }
365 ++
366 ++static void hisi_lpc_acpi_remove(struct device *hostdev)
367 ++{
368 ++}
369 + #endif // CONFIG_ACPI
370 +
371 + /*
372 +@@ -607,24 +621,27 @@ static int hisi_lpc_probe(struct platform_device *pdev)
373 + range->fwnode = dev->fwnode;
374 + range->flags = LOGIC_PIO_INDIRECT;
375 + range->size = PIO_INDIRECT_SIZE;
376 ++ range->hostdata = lpcdev;
377 ++ range->ops = &hisi_lpc_ops;
378 ++ lpcdev->io_host = range;
379 +
380 + ret = logic_pio_register_range(range);
381 + if (ret) {
382 + dev_err(dev, "register IO range failed (%d)!\n", ret);
383 + return ret;
384 + }
385 +- lpcdev->io_host = range;
386 +
387 + /* register the LPC host PIO resources */
388 + if (acpi_device)
389 + ret = hisi_lpc_acpi_probe(dev);
390 + else
391 + ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
392 +- if (ret)
393 ++ if (ret) {
394 ++ logic_pio_unregister_range(range);
395 + return ret;
396 ++ }
397 +
398 +- lpcdev->io_host->hostdata = lpcdev;
399 +- lpcdev->io_host->ops = &hisi_lpc_ops;
400 ++ dev_set_drvdata(dev, lpcdev);
401 +
402 + io_end = lpcdev->io_host->io_start + lpcdev->io_host->size;
403 + dev_info(dev, "registered range [%pa - %pa]\n",
404 +@@ -633,6 +650,23 @@ static int hisi_lpc_probe(struct platform_device *pdev)
405 + return ret;
406 + }
407 +
408 ++static int hisi_lpc_remove(struct platform_device *pdev)
409 ++{
410 ++ struct device *dev = &pdev->dev;
411 ++ struct acpi_device *acpi_device = ACPI_COMPANION(dev);
412 ++ struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev);
413 ++ struct logic_pio_hwaddr *range = lpcdev->io_host;
414 ++
415 ++ if (acpi_device)
416 ++ hisi_lpc_acpi_remove(dev);
417 ++ else
418 ++ of_platform_depopulate(dev);
419 ++
420 ++ logic_pio_unregister_range(range);
421 ++
422 ++ return 0;
423 ++}
424 ++
425 + static const struct of_device_id hisi_lpc_of_match[] = {
426 + { .compatible = "hisilicon,hip06-lpc", },
427 + { .compatible = "hisilicon,hip07-lpc", },
428 +@@ -646,5 +680,6 @@ static struct platform_driver hisi_lpc_driver = {
429 + .acpi_match_table = ACPI_PTR(hisi_lpc_acpi_match),
430 + },
431 + .probe = hisi_lpc_probe,
432 ++ .remove = hisi_lpc_remove,
433 + };
434 + builtin_platform_driver(hisi_lpc_driver);
435 +diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
436 +index 9b6d8972a565..b8c94a01cfc9 100644
437 +--- a/drivers/crypto/ccp/ccp-dev.c
438 ++++ b/drivers/crypto/ccp/ccp-dev.c
439 +@@ -543,6 +543,10 @@ int ccp_dev_suspend(struct sp_device *sp, pm_message_t state)
440 + unsigned long flags;
441 + unsigned int i;
442 +
443 ++ /* If there's no device there's nothing to do */
444 ++ if (!ccp)
445 ++ return 0;
446 ++
447 + spin_lock_irqsave(&ccp->cmd_lock, flags);
448 +
449 + ccp->suspending = 1;
450 +@@ -567,6 +571,10 @@ int ccp_dev_resume(struct sp_device *sp)
451 + unsigned long flags;
452 + unsigned int i;
453 +
454 ++ /* If there's no device there's nothing to do */
455 ++ if (!ccp)
456 ++ return 0;
457 ++
458 + spin_lock_irqsave(&ccp->cmd_lock, flags);
459 +
460 + ccp->suspending = 0;
461 +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
462 +index f4edfc56f34e..3d55405c49ca 100644
463 +--- a/drivers/dma/ste_dma40.c
464 ++++ b/drivers/dma/ste_dma40.c
465 +@@ -142,7 +142,7 @@ enum d40_events {
466 + * when the DMA hw is powered off.
467 + * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works.
468 + */
469 +-static u32 d40_backup_regs[] = {
470 ++static __maybe_unused u32 d40_backup_regs[] = {
471 + D40_DREG_LCPA,
472 + D40_DREG_LCLA,
473 + D40_DREG_PRMSE,
474 +@@ -211,7 +211,7 @@ static u32 d40_backup_regs_v4b[] = {
475 +
476 + #define BACKUP_REGS_SZ_V4B ARRAY_SIZE(d40_backup_regs_v4b)
477 +
478 +-static u32 d40_backup_regs_chan[] = {
479 ++static __maybe_unused u32 d40_backup_regs_chan[] = {
480 + D40_CHAN_REG_SSCFG,
481 + D40_CHAN_REG_SSELT,
482 + D40_CHAN_REG_SSPTR,
483 +diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
484 +index 06dd1725375e..8c3c3e5b812a 100644
485 +--- a/drivers/dma/stm32-mdma.c
486 ++++ b/drivers/dma/stm32-mdma.c
487 +@@ -1376,7 +1376,7 @@ static irqreturn_t stm32_mdma_irq_handler(int irq, void *devid)
488 +
489 + chan = &dmadev->chan[id];
490 + if (!chan) {
491 +- dev_err(chan2dev(chan), "MDMA channel not initialized\n");
492 ++ dev_dbg(mdma2dev(dmadev), "MDMA channel not initialized\n");
493 + goto exit;
494 + }
495 +
496 +diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
497 +index a4a931ddf6f6..aeb9c29e5255 100644
498 +--- a/drivers/dma/ti/omap-dma.c
499 ++++ b/drivers/dma/ti/omap-dma.c
500 +@@ -1237,7 +1237,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved(
501 + if (src_icg) {
502 + d->ccr |= CCR_SRC_AMODE_DBLIDX;
503 + d->ei = 1;
504 +- d->fi = src_icg;
505 ++ d->fi = src_icg + 1;
506 + } else if (xt->src_inc) {
507 + d->ccr |= CCR_SRC_AMODE_POSTINC;
508 + d->fi = 0;
509 +@@ -1252,7 +1252,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved(
510 + if (dst_icg) {
511 + d->ccr |= CCR_DST_AMODE_DBLIDX;
512 + sg->ei = 1;
513 +- sg->fi = dst_icg;
514 ++ sg->fi = dst_icg + 1;
515 + } else if (xt->dst_inc) {
516 + d->ccr |= CCR_DST_AMODE_POSTINC;
517 + sg->fi = 0;
518 +diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
519 +index df94021dd9d1..fdc0e458dbaa 100644
520 +--- a/drivers/fsi/fsi-scom.c
521 ++++ b/drivers/fsi/fsi-scom.c
522 +@@ -47,8 +47,7 @@
523 + #define SCOM_STATUS_PIB_RESP_MASK 0x00007000
524 + #define SCOM_STATUS_PIB_RESP_SHIFT 12
525 +
526 +-#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_ERR_SUMMARY | \
527 +- SCOM_STATUS_PROTECTION | \
528 ++#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \
529 + SCOM_STATUS_PARITY | \
530 + SCOM_STATUS_PIB_ABORT | \
531 + SCOM_STATUS_PIB_RESP_MASK)
532 +@@ -260,11 +259,6 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status)
533 + /* Return -EBUSY on PIB abort to force a retry */
534 + if (status & SCOM_STATUS_PIB_ABORT)
535 + return -EBUSY;
536 +- if (status & SCOM_STATUS_ERR_SUMMARY) {
537 +- fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy,
538 +- sizeof(uint32_t));
539 +- return -EIO;
540 +- }
541 + return 0;
542 + }
543 +
544 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
545 +index 92b11de19581..354c8b6106dc 100644
546 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
547 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
548 +@@ -575,6 +575,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = {
549 + { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX },
550 + { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX },
551 + { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX },
552 ++ { 0x1002, 0x699f, 0x1028, 0x0814, AMDGPU_PX_QUIRK_FORCE_ATPX },
553 + { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX },
554 + { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX },
555 + { 0, 0, 0, 0, 0 },
556 +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
557 +index 373700c05a00..224fa1ef87ff 100644
558 +--- a/drivers/gpu/drm/ast/ast_main.c
559 ++++ b/drivers/gpu/drm/ast/ast_main.c
560 +@@ -131,8 +131,8 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
561 +
562 +
563 + /* Enable extended register access */
564 +- ast_enable_mmio(dev);
565 + ast_open_key(ast);
566 ++ ast_enable_mmio(dev);
567 +
568 + /* Find out whether P2A works or whether to use device-tree */
569 + ast_detect_config_mode(dev, &scu_rev);
570 +@@ -576,6 +576,9 @@ void ast_driver_unload(struct drm_device *dev)
571 + {
572 + struct ast_private *ast = dev->dev_private;
573 +
574 ++ /* enable standard VGA decode */
575 ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
576 ++
577 + ast_release_firmware(dev);
578 + kfree(ast->dp501_fw_addr);
579 + ast_mode_fini(dev);
580 +diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
581 +index 8bb355d5d43d..9d92d2d2fcfc 100644
582 +--- a/drivers/gpu/drm/ast/ast_mode.c
583 ++++ b/drivers/gpu/drm/ast/ast_mode.c
584 +@@ -600,7 +600,7 @@ static int ast_crtc_mode_set(struct drm_crtc *crtc,
585 + return -EINVAL;
586 + ast_open_key(ast);
587 +
588 +- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
589 ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
590 +
591 + ast_set_std_reg(crtc, adjusted_mode, &vbios_mode);
592 + ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode);
593 +diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
594 +index f7d421359d56..c1d1ac51d1c2 100644
595 +--- a/drivers/gpu/drm/ast/ast_post.c
596 ++++ b/drivers/gpu/drm/ast/ast_post.c
597 +@@ -46,7 +46,7 @@ void ast_enable_mmio(struct drm_device *dev)
598 + {
599 + struct ast_private *ast = dev->dev_private;
600 +
601 +- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
602 ++ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
603 + }
604 +
605 +
606 +diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
607 +index c3e32138c6bb..9dc109df0808 100644
608 +--- a/drivers/gpu/drm/bridge/ti-tfp410.c
609 ++++ b/drivers/gpu/drm/bridge/ti-tfp410.c
610 +@@ -64,7 +64,12 @@ static int tfp410_get_modes(struct drm_connector *connector)
611 +
612 + drm_connector_update_edid_property(connector, edid);
613 +
614 +- return drm_add_edid_modes(connector, edid);
615 ++ ret = drm_add_edid_modes(connector, edid);
616 ++
617 ++ kfree(edid);
618 ++
619 ++ return ret;
620 ++
621 + fallback:
622 + /* No EDID, fallback on the XGA standard modes */
623 + ret = drm_add_modes_noedid(connector, 1920, 1200);
624 +diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
625 +index f8cfd16be534..a4b4ab7b9f8e 100644
626 +--- a/drivers/gpu/drm/i915/i915_drv.c
627 ++++ b/drivers/gpu/drm/i915/i915_drv.c
628 +@@ -1120,6 +1120,12 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
629 +
630 + pci_set_master(pdev);
631 +
632 ++ /*
633 ++ * We don't have a max segment size, so set it to the max so sg's
634 ++ * debugging layer doesn't complain
635 ++ */
636 ++ dma_set_max_seg_size(&pdev->dev, UINT_MAX);
637 ++
638 + /* overlay on gen2 is broken and can't address above 1G */
639 + if (IS_GEN2(dev_priv)) {
640 + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(30));
641 +diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
642 +index 869cf4a3b6de..a6cb3e034dd5 100644
643 +--- a/drivers/gpu/drm/i915/i915_vgpu.c
644 ++++ b/drivers/gpu/drm/i915/i915_vgpu.c
645 +@@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info;
646 + static void vgt_deballoon_space(struct i915_ggtt *ggtt,
647 + struct drm_mm_node *node)
648 + {
649 ++ if (!drm_mm_node_allocated(node))
650 ++ return;
651 ++
652 + DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n",
653 + node->start,
654 + node->start + node->size,
655 +diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
656 +index 0ef0c6448d53..01fa98299bae 100644
657 +--- a/drivers/gpu/drm/i915/intel_device_info.c
658 ++++ b/drivers/gpu/drm/i915/intel_device_info.c
659 +@@ -474,7 +474,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
660 + u8 eu_disabled_mask;
661 + u32 n_disabled;
662 +
663 +- if (!(sseu->subslice_mask[ss] & BIT(ss)))
664 ++ if (!(sseu->subslice_mask[s] & BIT(ss)))
665 + /* skip disabled subslice */
666 + continue;
667 +
668 +diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
669 +index 0fb300d41a09..e1868776da25 100644
670 +--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
671 ++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
672 +@@ -184,6 +184,12 @@ static void tilcdc_fini(struct drm_device *dev)
673 + {
674 + struct tilcdc_drm_private *priv = dev->dev_private;
675 +
676 ++#ifdef CONFIG_CPU_FREQ
677 ++ if (priv->freq_transition.notifier_call)
678 ++ cpufreq_unregister_notifier(&priv->freq_transition,
679 ++ CPUFREQ_TRANSITION_NOTIFIER);
680 ++#endif
681 ++
682 + if (priv->crtc)
683 + tilcdc_crtc_shutdown(priv->crtc);
684 +
685 +@@ -198,12 +204,6 @@ static void tilcdc_fini(struct drm_device *dev)
686 + drm_mode_config_cleanup(dev);
687 + tilcdc_remove_external_device(dev);
688 +
689 +-#ifdef CONFIG_CPU_FREQ
690 +- if (priv->freq_transition.notifier_call)
691 +- cpufreq_unregister_notifier(&priv->freq_transition,
692 +- CPUFREQ_TRANSITION_NOTIFIER);
693 +-#endif
694 +-
695 + if (priv->clk)
696 + clk_put(priv->clk);
697 +
698 +@@ -274,17 +274,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
699 + goto init_failed;
700 + }
701 +
702 +-#ifdef CONFIG_CPU_FREQ
703 +- priv->freq_transition.notifier_call = cpufreq_transition;
704 +- ret = cpufreq_register_notifier(&priv->freq_transition,
705 +- CPUFREQ_TRANSITION_NOTIFIER);
706 +- if (ret) {
707 +- dev_err(dev, "failed to register cpufreq notifier\n");
708 +- priv->freq_transition.notifier_call = NULL;
709 +- goto init_failed;
710 +- }
711 +-#endif
712 +-
713 + if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth))
714 + priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH;
715 +
716 +@@ -361,6 +350,17 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
717 + }
718 + modeset_init(ddev);
719 +
720 ++#ifdef CONFIG_CPU_FREQ
721 ++ priv->freq_transition.notifier_call = cpufreq_transition;
722 ++ ret = cpufreq_register_notifier(&priv->freq_transition,
723 ++ CPUFREQ_TRANSITION_NOTIFIER);
724 ++ if (ret) {
725 ++ dev_err(dev, "failed to register cpufreq notifier\n");
726 ++ priv->freq_transition.notifier_call = NULL;
727 ++ goto init_failed;
728 ++ }
729 ++#endif
730 ++
731 + if (priv->is_componentized) {
732 + ret = component_bind_all(dev, ddev);
733 + if (ret < 0)
734 +diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c
735 +index e759ac0d48be..968319f4e5f1 100644
736 +--- a/drivers/hwtracing/intel_th/pci.c
737 ++++ b/drivers/hwtracing/intel_th/pci.c
738 +@@ -140,6 +140,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
739 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa1a6),
740 + .driver_data = (kernel_ulong_t)0,
741 + },
742 ++ {
743 ++ /* Lewisburg PCH */
744 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa226),
745 ++ .driver_data = (kernel_ulong_t)0,
746 ++ },
747 + {
748 + /* Gemini Lake */
749 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
750 +@@ -175,6 +180,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
751 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5),
752 + .driver_data = (kernel_ulong_t)&intel_th_2x,
753 + },
754 ++ {
755 ++ /* Tiger Lake PCH */
756 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),
757 ++ .driver_data = (kernel_ulong_t)&intel_th_2x,
758 ++ },
759 + { 0 },
760 + };
761 +
762 +diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
763 +index 9ec9197edffa..eeba421dc823 100644
764 +--- a/drivers/hwtracing/stm/core.c
765 ++++ b/drivers/hwtracing/stm/core.c
766 +@@ -1098,7 +1098,6 @@ int stm_source_register_device(struct device *parent,
767 +
768 + err:
769 + put_device(&src->dev);
770 +- kfree(src);
771 +
772 + return err;
773 + }
774 +diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c
775 +index 35b302d983e0..959d4912ec0d 100644
776 +--- a/drivers/i2c/busses/i2c-emev2.c
777 ++++ b/drivers/i2c/busses/i2c-emev2.c
778 +@@ -69,6 +69,7 @@ struct em_i2c_device {
779 + struct completion msg_done;
780 + struct clk *sclk;
781 + struct i2c_client *slave;
782 ++ int irq;
783 + };
784 +
785 + static inline void em_clear_set_bit(struct em_i2c_device *priv, u8 clear, u8 set, u8 reg)
786 +@@ -339,6 +340,12 @@ static int em_i2c_unreg_slave(struct i2c_client *slave)
787 +
788 + writeb(0, priv->base + I2C_OFS_SVA0);
789 +
790 ++ /*
791 ++ * Wait for interrupt to finish. New slave irqs cannot happen because we
792 ++ * cleared the slave address and, thus, only extension codes will be
793 ++ * detected which do not use the slave ptr.
794 ++ */
795 ++ synchronize_irq(priv->irq);
796 + priv->slave = NULL;
797 +
798 + return 0;
799 +@@ -355,7 +362,7 @@ static int em_i2c_probe(struct platform_device *pdev)
800 + {
801 + struct em_i2c_device *priv;
802 + struct resource *r;
803 +- int irq, ret;
804 ++ int ret;
805 +
806 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
807 + if (!priv)
808 +@@ -390,8 +397,8 @@ static int em_i2c_probe(struct platform_device *pdev)
809 +
810 + em_i2c_reset(&priv->adap);
811 +
812 +- irq = platform_get_irq(pdev, 0);
813 +- ret = devm_request_irq(&pdev->dev, irq, em_i2c_irq_handler, 0,
814 ++ priv->irq = platform_get_irq(pdev, 0);
815 ++ ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0,
816 + "em_i2c", priv);
817 + if (ret)
818 + goto err_clk;
819 +@@ -401,7 +408,8 @@ static int em_i2c_probe(struct platform_device *pdev)
820 + if (ret)
821 + goto err_clk;
822 +
823 +- dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, irq);
824 ++ dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr,
825 ++ priv->irq);
826 +
827 + return 0;
828 +
829 +diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
830 +index 90946a8b9a75..9ff3371ec385 100644
831 +--- a/drivers/i2c/busses/i2c-piix4.c
832 ++++ b/drivers/i2c/busses/i2c-piix4.c
833 +@@ -98,7 +98,7 @@
834 + #define SB800_PIIX4_PORT_IDX_MASK 0x06
835 + #define SB800_PIIX4_PORT_IDX_SHIFT 1
836 +
837 +-/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
838 ++/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
839 + #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02
840 + #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18
841 + #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3
842 +@@ -362,18 +362,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
843 +
844 + /* Find which register is used for port selection */
845 + if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD) {
846 +- switch (PIIX4_dev->device) {
847 +- case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS:
848 ++ if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS ||
849 ++ (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
850 ++ PIIX4_dev->revision >= 0x1F)) {
851 + piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
852 + piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ;
853 + piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ;
854 +- break;
855 +- case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS:
856 +- default:
857 ++ } else {
858 + piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT;
859 + piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK;
860 + piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT;
861 +- break;
862 + }
863 + } else {
864 + if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2,
865 +diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
866 +index 254e6219e538..2c29f901d309 100644
867 +--- a/drivers/i2c/busses/i2c-rcar.c
868 ++++ b/drivers/i2c/busses/i2c-rcar.c
869 +@@ -139,6 +139,7 @@ struct rcar_i2c_priv {
870 + enum dma_data_direction dma_direction;
871 +
872 + struct reset_control *rstc;
873 ++ int irq;
874 + };
875 +
876 + #define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent)
877 +@@ -859,9 +860,11 @@ static int rcar_unreg_slave(struct i2c_client *slave)
878 +
879 + WARN_ON(!priv->slave);
880 +
881 ++ /* disable irqs and ensure none is running before clearing ptr */
882 + rcar_i2c_write(priv, ICSIER, 0);
883 + rcar_i2c_write(priv, ICSCR, 0);
884 +
885 ++ synchronize_irq(priv->irq);
886 + priv->slave = NULL;
887 +
888 + pm_runtime_put(rcar_i2c_priv_to_dev(priv));
889 +@@ -916,7 +919,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
890 + struct i2c_adapter *adap;
891 + struct device *dev = &pdev->dev;
892 + struct i2c_timings i2c_t;
893 +- int irq, ret;
894 ++ int ret;
895 +
896 + priv = devm_kzalloc(dev, sizeof(struct rcar_i2c_priv), GFP_KERNEL);
897 + if (!priv)
898 +@@ -979,10 +982,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)
899 + pm_runtime_put(dev);
900 +
901 +
902 +- irq = platform_get_irq(pdev, 0);
903 +- ret = devm_request_irq(dev, irq, rcar_i2c_irq, 0, dev_name(dev), priv);
904 ++ priv->irq = platform_get_irq(pdev, 0);
905 ++ ret = devm_request_irq(dev, priv->irq, rcar_i2c_irq, 0, dev_name(dev), priv);
906 + if (ret < 0) {
907 +- dev_err(dev, "cannot get irq %d\n", irq);
908 ++ dev_err(dev, "cannot get irq %d\n", priv->irq);
909 + goto out_pm_disable;
910 + }
911 +
912 +diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
913 +index 511ff9a1d6d9..f9dbb064f957 100644
914 +--- a/drivers/iommu/dma-iommu.c
915 ++++ b/drivers/iommu/dma-iommu.c
916 +@@ -675,7 +675,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,
917 + * - and wouldn't make the resulting output segment too long
918 + */
919 + if (cur_len && !s_iova_off && (dma_addr & seg_mask) &&
920 +- (cur_len + s_length <= max_len)) {
921 ++ (max_len - cur_len >= s_length)) {
922 + /* ...then concatenate it with the previous one */
923 + cur_len += s_length;
924 + } else {
925 +diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c
926 +index 29e3f5da59c1..11ec048929e8 100644
927 +--- a/drivers/media/platform/omap/omap_vout_vrfb.c
928 ++++ b/drivers/media/platform/omap/omap_vout_vrfb.c
929 +@@ -253,8 +253,7 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
930 + */
931 +
932 + pixsize = vout->bpp * vout->vrfb_bpp;
933 +- dst_icg = ((MAX_PIXELS_PER_LINE * pixsize) -
934 +- (vout->pix.width * vout->bpp)) + 1;
935 ++ dst_icg = MAX_PIXELS_PER_LINE * pixsize - vout->pix.width * vout->bpp;
936 +
937 + xt->src_start = vout->buf_phy_addr[vb->i];
938 + xt->dst_start = vout->vrfb_context[vb->i].paddr[0];
939 +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
940 +index 225373e4a9ef..cdd7af16d5ee 100644
941 +--- a/drivers/misc/mei/hw-me-regs.h
942 ++++ b/drivers/misc/mei/hw-me-regs.h
943 +@@ -141,6 +141,8 @@
944 +
945 + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */
946 +
947 ++#define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */
948 ++
949 + #define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */
950 + #define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */
951 +
952 +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
953 +index a66ebceea408..e41f9e0a3fdf 100644
954 +--- a/drivers/misc/mei/pci-me.c
955 ++++ b/drivers/misc/mei/pci-me.c
956 +@@ -107,6 +107,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
957 +
958 + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)},
959 +
960 ++ {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)},
961 ++
962 + {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)},
963 + {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)},
964 +
965 +diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c
966 +index b3fa738ae005..f005206d9033 100644
967 +--- a/drivers/misc/vmw_vmci/vmci_doorbell.c
968 ++++ b/drivers/misc/vmw_vmci/vmci_doorbell.c
969 +@@ -318,7 +318,8 @@ int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle)
970 +
971 + entry = container_of(resource, struct dbell_entry, resource);
972 + if (entry->run_delayed) {
973 +- schedule_work(&entry->work);
974 ++ if (!schedule_work(&entry->work))
975 ++ vmci_resource_put(resource);
976 + } else {
977 + entry->notify_cb(entry->client_data);
978 + vmci_resource_put(resource);
979 +@@ -366,7 +367,8 @@ static void dbell_fire_entries(u32 notify_idx)
980 + atomic_read(&dbell->active) == 1) {
981 + if (dbell->run_delayed) {
982 + vmci_resource_get(&dbell->resource);
983 +- schedule_work(&dbell->work);
984 ++ if (!schedule_work(&dbell->work))
985 ++ vmci_resource_put(&dbell->resource);
986 + } else {
987 + dbell->notify_cb(dbell->client_data);
988 + }
989 +diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
990 +index cfb8ee24eaba..04738359ec02 100644
991 +--- a/drivers/mmc/core/sd.c
992 ++++ b/drivers/mmc/core/sd.c
993 +@@ -1277,6 +1277,12 @@ int mmc_attach_sd(struct mmc_host *host)
994 + goto err;
995 + }
996 +
997 ++ /*
998 ++ * Some SD cards claims an out of spec VDD voltage range. Let's treat
999 ++ * these bits as being in-valid and especially also bit7.
1000 ++ */
1001 ++ ocr &= ~0x7FFF;
1002 ++
1003 + rocr = mmc_select_voltage(host, ocr);
1004 +
1005 + /*
1006 +diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
1007 +index 682c573e20a7..e284102c16e9 100644
1008 +--- a/drivers/mmc/host/sdhci-of-at91.c
1009 ++++ b/drivers/mmc/host/sdhci-of-at91.c
1010 +@@ -365,6 +365,9 @@ static int sdhci_at91_probe(struct platform_device *pdev)
1011 + pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
1012 + pm_runtime_use_autosuspend(&pdev->dev);
1013 +
1014 ++ /* HS200 is broken at this moment */
1015 ++ host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200;
1016 ++
1017 + ret = sdhci_add_host(host);
1018 + if (ret)
1019 + goto pm_runtime_disable;
1020 +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
1021 +index 0a3e046d78db..da2ba51dec35 100644
1022 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
1023 ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
1024 +@@ -369,7 +369,7 @@ static void mt76x0_stop_hardware(struct mt76x0_dev *dev)
1025 + mt76x0_chip_onoff(dev, false, false);
1026 + }
1027 +
1028 +-int mt76x0_init_hardware(struct mt76x0_dev *dev)
1029 ++int mt76x0_init_hardware(struct mt76x0_dev *dev, bool reset)
1030 + {
1031 + static const u16 beacon_offsets[16] = {
1032 + /* 512 byte per beacon */
1033 +@@ -382,7 +382,7 @@ int mt76x0_init_hardware(struct mt76x0_dev *dev)
1034 +
1035 + dev->beacon_offsets = beacon_offsets;
1036 +
1037 +- mt76x0_chip_onoff(dev, true, true);
1038 ++ mt76x0_chip_onoff(dev, true, reset);
1039 +
1040 + ret = mt76x0_wait_asic_ready(dev);
1041 + if (ret)
1042 +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
1043 +index fc9857f61771..f9dfe5097b09 100644
1044 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
1045 ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
1046 +@@ -279,7 +279,7 @@ void mt76x0_addr_wr(struct mt76x0_dev *dev, const u32 offset, const u8 *addr);
1047 +
1048 + /* Init */
1049 + struct mt76x0_dev *mt76x0_alloc_device(struct device *dev);
1050 +-int mt76x0_init_hardware(struct mt76x0_dev *dev);
1051 ++int mt76x0_init_hardware(struct mt76x0_dev *dev, bool reset);
1052 + int mt76x0_register_device(struct mt76x0_dev *dev);
1053 + void mt76x0_cleanup(struct mt76x0_dev *dev);
1054 + void mt76x0_chip_onoff(struct mt76x0_dev *dev, bool enable, bool reset);
1055 +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
1056 +index 54ae1f113be2..5aacb1f6a841 100644
1057 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
1058 ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
1059 +@@ -300,7 +300,7 @@ static int mt76x0_probe(struct usb_interface *usb_intf,
1060 + if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL))
1061 + dev_warn(dev->mt76.dev, "Warning: eFUSE not present\n");
1062 +
1063 +- ret = mt76x0_init_hardware(dev);
1064 ++ ret = mt76x0_init_hardware(dev, true);
1065 + if (ret)
1066 + goto err;
1067 +
1068 +@@ -354,7 +354,7 @@ static int mt76x0_resume(struct usb_interface *usb_intf)
1069 + struct mt76x0_dev *dev = usb_get_intfdata(usb_intf);
1070 + int ret;
1071 +
1072 +- ret = mt76x0_init_hardware(dev);
1073 ++ ret = mt76x0_init_hardware(dev, false);
1074 + if (ret)
1075 + return ret;
1076 +
1077 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
1078 +index e26d1191c5ad..ae0b01059fc6 100644
1079 +--- a/drivers/nvme/host/core.c
1080 ++++ b/drivers/nvme/host/core.c
1081 +@@ -1183,6 +1183,9 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
1082 + */
1083 + if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1084 + mutex_lock(&ctrl->scan_lock);
1085 ++ mutex_lock(&ctrl->subsys->lock);
1086 ++ nvme_mpath_start_freeze(ctrl->subsys);
1087 ++ nvme_mpath_wait_freeze(ctrl->subsys);
1088 + nvme_start_freeze(ctrl);
1089 + nvme_wait_freeze(ctrl);
1090 + }
1091 +@@ -1213,6 +1216,8 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)
1092 + nvme_update_formats(ctrl);
1093 + if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1094 + nvme_unfreeze(ctrl);
1095 ++ nvme_mpath_unfreeze(ctrl->subsys);
1096 ++ mutex_unlock(&ctrl->subsys->lock);
1097 + mutex_unlock(&ctrl->scan_lock);
1098 + }
1099 + if (effects & NVME_CMD_EFFECTS_CCC)
1100 +@@ -1557,6 +1562,7 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
1101 + if (ns->head->disk) {
1102 + nvme_update_disk_info(ns->head->disk, ns, id);
1103 + blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
1104 ++ revalidate_disk(ns->head->disk);
1105 + }
1106 + #endif
1107 + }
1108 +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
1109 +index a11e210d173e..05d6371c7f38 100644
1110 +--- a/drivers/nvme/host/multipath.c
1111 ++++ b/drivers/nvme/host/multipath.c
1112 +@@ -20,6 +20,36 @@ module_param(multipath, bool, 0444);
1113 + MODULE_PARM_DESC(multipath,
1114 + "turn on native support for multiple controllers per subsystem");
1115 +
1116 ++void nvme_mpath_unfreeze(struct nvme_subsystem *subsys)
1117 ++{
1118 ++ struct nvme_ns_head *h;
1119 ++
1120 ++ lockdep_assert_held(&subsys->lock);
1121 ++ list_for_each_entry(h, &subsys->nsheads, entry)
1122 ++ if (h->disk)
1123 ++ blk_mq_unfreeze_queue(h->disk->queue);
1124 ++}
1125 ++
1126 ++void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys)
1127 ++{
1128 ++ struct nvme_ns_head *h;
1129 ++
1130 ++ lockdep_assert_held(&subsys->lock);
1131 ++ list_for_each_entry(h, &subsys->nsheads, entry)
1132 ++ if (h->disk)
1133 ++ blk_mq_freeze_queue_wait(h->disk->queue);
1134 ++}
1135 ++
1136 ++void nvme_mpath_start_freeze(struct nvme_subsystem *subsys)
1137 ++{
1138 ++ struct nvme_ns_head *h;
1139 ++
1140 ++ lockdep_assert_held(&subsys->lock);
1141 ++ list_for_each_entry(h, &subsys->nsheads, entry)
1142 ++ if (h->disk)
1143 ++ blk_freeze_queue_start(h->disk->queue);
1144 ++}
1145 ++
1146 + /*
1147 + * If multipathing is enabled we need to always use the subsystem instance
1148 + * number for numbering our devices to avoid conflicts between subsystems that
1149 +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
1150 +index d5e29b57eb34..2653e1f4196d 100644
1151 +--- a/drivers/nvme/host/nvme.h
1152 ++++ b/drivers/nvme/host/nvme.h
1153 +@@ -469,6 +469,9 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl)
1154 + return ctrl->ana_log_buf != NULL;
1155 + }
1156 +
1157 ++void nvme_mpath_unfreeze(struct nvme_subsystem *subsys);
1158 ++void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys);
1159 ++void nvme_mpath_start_freeze(struct nvme_subsystem *subsys);
1160 + void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
1161 + struct nvme_ctrl *ctrl, int *flags);
1162 + void nvme_failover_req(struct request *req);
1163 +@@ -553,6 +556,15 @@ static inline void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
1164 + static inline void nvme_mpath_stop(struct nvme_ctrl *ctrl)
1165 + {
1166 + }
1167 ++static inline void nvme_mpath_unfreeze(struct nvme_subsystem *subsys)
1168 ++{
1169 ++}
1170 ++static inline void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys)
1171 ++{
1172 ++}
1173 ++static inline void nvme_mpath_start_freeze(struct nvme_subsystem *subsys)
1174 ++{
1175 ++}
1176 + #endif /* CONFIG_NVME_MULTIPATH */
1177 +
1178 + #ifdef CONFIG_NVM
1179 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
1180 +index 0a5d064f82ca..a64a8bca0d5b 100644
1181 +--- a/drivers/nvme/host/pci.c
1182 ++++ b/drivers/nvme/host/pci.c
1183 +@@ -2468,7 +2468,7 @@ static void nvme_async_probe(void *data, async_cookie_t cookie)
1184 + {
1185 + struct nvme_dev *dev = data;
1186 +
1187 +- nvme_reset_ctrl_sync(&dev->ctrl);
1188 ++ flush_work(&dev->ctrl.reset_work);
1189 + flush_work(&dev->ctrl.scan_work);
1190 + nvme_put_ctrl(&dev->ctrl);
1191 + }
1192 +@@ -2535,6 +2535,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1193 +
1194 + dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
1195 +
1196 ++ nvme_reset_ctrl(&dev->ctrl);
1197 + nvme_get_ctrl(&dev->ctrl);
1198 + async_schedule(nvme_async_probe, dev);
1199 +
1200 +diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
1201 +index 9908082b32c4..137a27fa369c 100644
1202 +--- a/drivers/nvme/target/loop.c
1203 ++++ b/drivers/nvme/target/loop.c
1204 +@@ -678,6 +678,14 @@ static void nvme_loop_remove_port(struct nvmet_port *port)
1205 + mutex_lock(&nvme_loop_ports_mutex);
1206 + list_del_init(&port->entry);
1207 + mutex_unlock(&nvme_loop_ports_mutex);
1208 ++
1209 ++ /*
1210 ++ * Ensure any ctrls that are in the process of being
1211 ++ * deleted are in fact deleted before we return
1212 ++ * and free the port. This is to prevent active
1213 ++ * ctrls from using a port after it's freed.
1214 ++ */
1215 ++ flush_workqueue(nvme_delete_wq);
1216 + }
1217 +
1218 + static const struct nvmet_fabrics_ops nvme_loop_ops = {
1219 +diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h
1220 +index 23129d7b2678..c77e36526447 100644
1221 +--- a/drivers/scsi/ufs/unipro.h
1222 ++++ b/drivers/scsi/ufs/unipro.h
1223 +@@ -52,7 +52,7 @@
1224 + #define RX_HS_UNTERMINATED_ENABLE 0x00A6
1225 + #define RX_ENTER_HIBERN8 0x00A7
1226 + #define RX_BYPASS_8B10B_ENABLE 0x00A8
1227 +-#define RX_TERMINATION_FORCE_ENABLE 0x0089
1228 ++#define RX_TERMINATION_FORCE_ENABLE 0x00A9
1229 + #define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F
1230 + #define RX_HIBERN8TIME_CAPABILITY 0x0092
1231 + #define RX_REFCLKFREQ 0x00EB
1232 +diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
1233 +index cb6a331f448a..70f78eda037e 100644
1234 +--- a/drivers/soundwire/cadence_master.c
1235 ++++ b/drivers/soundwire/cadence_master.c
1236 +@@ -81,8 +81,8 @@
1237 +
1238 + #define CDNS_MCP_INTSET 0x4C
1239 +
1240 +-#define CDNS_SDW_SLAVE_STAT 0x50
1241 +-#define CDNS_MCP_SLAVE_STAT_MASK BIT(1, 0)
1242 ++#define CDNS_MCP_SLAVE_STAT 0x50
1243 ++#define CDNS_MCP_SLAVE_STAT_MASK GENMASK(1, 0)
1244 +
1245 + #define CDNS_MCP_SLAVE_INTSTAT0 0x54
1246 + #define CDNS_MCP_SLAVE_INTSTAT1 0x58
1247 +@@ -96,8 +96,8 @@
1248 + #define CDNS_MCP_SLAVE_INTMASK0 0x5C
1249 + #define CDNS_MCP_SLAVE_INTMASK1 0x60
1250 +
1251 +-#define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(30, 0)
1252 +-#define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(16, 0)
1253 ++#define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(31, 0)
1254 ++#define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(15, 0)
1255 +
1256 + #define CDNS_MCP_PORT_INTSTAT 0x64
1257 + #define CDNS_MCP_PDI_STAT 0x6C
1258 +diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
1259 +index cc7c856126df..169ccfacfc75 100644
1260 +--- a/drivers/usb/chipidea/udc.c
1261 ++++ b/drivers/usb/chipidea/udc.c
1262 +@@ -708,12 +708,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget)
1263 + struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
1264 + unsigned long flags;
1265 +
1266 +- spin_lock_irqsave(&ci->lock, flags);
1267 +- ci->gadget.speed = USB_SPEED_UNKNOWN;
1268 +- ci->remote_wakeup = 0;
1269 +- ci->suspended = 0;
1270 +- spin_unlock_irqrestore(&ci->lock, flags);
1271 +-
1272 + /* flush all endpoints */
1273 + gadget_for_each_ep(ep, gadget) {
1274 + usb_ep_fifo_flush(ep);
1275 +@@ -731,6 +725,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget)
1276 + ci->status = NULL;
1277 + }
1278 +
1279 ++ spin_lock_irqsave(&ci->lock, flags);
1280 ++ ci->gadget.speed = USB_SPEED_UNKNOWN;
1281 ++ ci->remote_wakeup = 0;
1282 ++ ci->suspended = 0;
1283 ++ spin_unlock_irqrestore(&ci->lock, flags);
1284 ++
1285 + return 0;
1286 + }
1287 +
1288 +@@ -1302,6 +1302,10 @@ static int ep_disable(struct usb_ep *ep)
1289 + return -EBUSY;
1290 +
1291 + spin_lock_irqsave(hwep->lock, flags);
1292 ++ if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
1293 ++ spin_unlock_irqrestore(hwep->lock, flags);
1294 ++ return 0;
1295 ++ }
1296 +
1297 + /* only internal SW should disable ctrl endpts */
1298 +
1299 +@@ -1391,6 +1395,10 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
1300 + return -EINVAL;
1301 +
1302 + spin_lock_irqsave(hwep->lock, flags);
1303 ++ if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
1304 ++ spin_unlock_irqrestore(hwep->lock, flags);
1305 ++ return 0;
1306 ++ }
1307 + retval = _ep_queue(ep, req, gfp_flags);
1308 + spin_unlock_irqrestore(hwep->lock, flags);
1309 + return retval;
1310 +@@ -1414,8 +1422,8 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
1311 + return -EINVAL;
1312 +
1313 + spin_lock_irqsave(hwep->lock, flags);
1314 +-
1315 +- hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
1316 ++ if (hwep->ci->gadget.speed != USB_SPEED_UNKNOWN)
1317 ++ hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
1318 +
1319 + list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
1320 + dma_pool_free(hwep->td_pool, node->ptr, node->dma);
1321 +@@ -1486,6 +1494,10 @@ static void ep_fifo_flush(struct usb_ep *ep)
1322 + }
1323 +
1324 + spin_lock_irqsave(hwep->lock, flags);
1325 ++ if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
1326 ++ spin_unlock_irqrestore(hwep->lock, flags);
1327 ++ return;
1328 ++ }
1329 +
1330 + hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
1331 +
1332 +@@ -1558,6 +1570,10 @@ static int ci_udc_wakeup(struct usb_gadget *_gadget)
1333 + int ret = 0;
1334 +
1335 + spin_lock_irqsave(&ci->lock, flags);
1336 ++ if (ci->gadget.speed == USB_SPEED_UNKNOWN) {
1337 ++ spin_unlock_irqrestore(&ci->lock, flags);
1338 ++ return 0;
1339 ++ }
1340 + if (!ci->remote_wakeup) {
1341 + ret = -EOPNOTSUPP;
1342 + goto out;
1343 +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
1344 +index bec581fb7c63..b8a1fdefb515 100644
1345 +--- a/drivers/usb/class/cdc-wdm.c
1346 ++++ b/drivers/usb/class/cdc-wdm.c
1347 +@@ -587,10 +587,20 @@ static int wdm_flush(struct file *file, fl_owner_t id)
1348 + {
1349 + struct wdm_device *desc = file->private_data;
1350 +
1351 +- wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
1352 ++ wait_event(desc->wait,
1353 ++ /*
1354 ++ * needs both flags. We cannot do with one
1355 ++ * because resetting it would cause a race
1356 ++ * with write() yet we need to signal
1357 ++ * a disconnect
1358 ++ */
1359 ++ !test_bit(WDM_IN_USE, &desc->flags) ||
1360 ++ test_bit(WDM_DISCONNECTING, &desc->flags));
1361 +
1362 + /* cannot dereference desc->intf if WDM_DISCONNECTING */
1363 +- if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags))
1364 ++ if (test_bit(WDM_DISCONNECTING, &desc->flags))
1365 ++ return -ENODEV;
1366 ++ if (desc->werr < 0)
1367 + dev_err(&desc->intf->dev, "Error in flush path: %d\n",
1368 + desc->werr);
1369 +
1370 +@@ -974,8 +984,6 @@ static void wdm_disconnect(struct usb_interface *intf)
1371 + spin_lock_irqsave(&desc->iuspin, flags);
1372 + set_bit(WDM_DISCONNECTING, &desc->flags);
1373 + set_bit(WDM_READ, &desc->flags);
1374 +- /* to terminate pending flushes */
1375 +- clear_bit(WDM_IN_USE, &desc->flags);
1376 + spin_unlock_irqrestore(&desc->iuspin, flags);
1377 + wake_up_all(&desc->wait);
1378 + mutex_lock(&desc->rlock);
1379 +diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
1380 +index 03432467b05f..7537681355f6 100644
1381 +--- a/drivers/usb/core/hcd-pci.c
1382 ++++ b/drivers/usb/core/hcd-pci.c
1383 +@@ -216,17 +216,18 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1384 + /* EHCI, OHCI */
1385 + hcd->rsrc_start = pci_resource_start(dev, 0);
1386 + hcd->rsrc_len = pci_resource_len(dev, 0);
1387 +- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
1388 +- driver->description)) {
1389 ++ if (!devm_request_mem_region(&dev->dev, hcd->rsrc_start,
1390 ++ hcd->rsrc_len, driver->description)) {
1391 + dev_dbg(&dev->dev, "controller already in use\n");
1392 + retval = -EBUSY;
1393 + goto put_hcd;
1394 + }
1395 +- hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
1396 ++ hcd->regs = devm_ioremap_nocache(&dev->dev, hcd->rsrc_start,
1397 ++ hcd->rsrc_len);
1398 + if (hcd->regs == NULL) {
1399 + dev_dbg(&dev->dev, "error mapping memory\n");
1400 + retval = -EFAULT;
1401 +- goto release_mem_region;
1402 ++ goto put_hcd;
1403 + }
1404 +
1405 + } else {
1406 +@@ -240,8 +241,8 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1407 +
1408 + hcd->rsrc_start = pci_resource_start(dev, region);
1409 + hcd->rsrc_len = pci_resource_len(dev, region);
1410 +- if (request_region(hcd->rsrc_start, hcd->rsrc_len,
1411 +- driver->description))
1412 ++ if (devm_request_region(&dev->dev, hcd->rsrc_start,
1413 ++ hcd->rsrc_len, driver->description))
1414 + break;
1415 + }
1416 + if (region == PCI_ROM_RESOURCE) {
1417 +@@ -275,20 +276,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1418 + }
1419 +
1420 + if (retval != 0)
1421 +- goto unmap_registers;
1422 ++ goto put_hcd;
1423 + device_wakeup_enable(hcd->self.controller);
1424 +
1425 + if (pci_dev_run_wake(dev))
1426 + pm_runtime_put_noidle(&dev->dev);
1427 + return retval;
1428 +
1429 +-unmap_registers:
1430 +- if (driver->flags & HCD_MEMORY) {
1431 +- iounmap(hcd->regs);
1432 +-release_mem_region:
1433 +- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
1434 +- } else
1435 +- release_region(hcd->rsrc_start, hcd->rsrc_len);
1436 + put_hcd:
1437 + usb_put_hcd(hcd);
1438 + disable_pci:
1439 +@@ -347,14 +341,6 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
1440 + dev_set_drvdata(&dev->dev, NULL);
1441 + up_read(&companions_rwsem);
1442 + }
1443 +-
1444 +- if (hcd->driver->flags & HCD_MEMORY) {
1445 +- iounmap(hcd->regs);
1446 +- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
1447 +- } else {
1448 +- release_region(hcd->rsrc_start, hcd->rsrc_len);
1449 +- }
1450 +-
1451 + usb_put_hcd(hcd);
1452 + pci_disable_device(dev);
1453 + }
1454 +diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
1455 +index b8a15840b4ff..dfcabadeed01 100644
1456 +--- a/drivers/usb/gadget/composite.c
1457 ++++ b/drivers/usb/gadget/composite.c
1458 +@@ -1976,6 +1976,7 @@ void composite_disconnect(struct usb_gadget *gadget)
1459 + * disconnect callbacks?
1460 + */
1461 + spin_lock_irqsave(&cdev->lock, flags);
1462 ++ cdev->suspended = 0;
1463 + if (cdev->config)
1464 + reset_config(cdev);
1465 + if (cdev->driver->disconnect)
1466 +diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
1467 +index 1074cb82ec17..0b7b4d09785b 100644
1468 +--- a/drivers/usb/gadget/function/f_mass_storage.c
1469 ++++ b/drivers/usb/gadget/function/f_mass_storage.c
1470 +@@ -261,7 +261,7 @@ struct fsg_common;
1471 + struct fsg_common {
1472 + struct usb_gadget *gadget;
1473 + struct usb_composite_dev *cdev;
1474 +- struct fsg_dev *fsg, *new_fsg;
1475 ++ struct fsg_dev *fsg;
1476 + wait_queue_head_t io_wait;
1477 + wait_queue_head_t fsg_wait;
1478 +
1479 +@@ -290,6 +290,7 @@ struct fsg_common {
1480 + unsigned int bulk_out_maxpacket;
1481 + enum fsg_state state; /* For exception handling */
1482 + unsigned int exception_req_tag;
1483 ++ void *exception_arg;
1484 +
1485 + enum data_direction data_dir;
1486 + u32 data_size;
1487 +@@ -391,7 +392,8 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)
1488 +
1489 + /* These routines may be called in process context or in_irq */
1490 +
1491 +-static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
1492 ++static void __raise_exception(struct fsg_common *common, enum fsg_state new_state,
1493 ++ void *arg)
1494 + {
1495 + unsigned long flags;
1496 +
1497 +@@ -404,6 +406,7 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
1498 + if (common->state <= new_state) {
1499 + common->exception_req_tag = common->ep0_req_tag;
1500 + common->state = new_state;
1501 ++ common->exception_arg = arg;
1502 + if (common->thread_task)
1503 + send_sig_info(SIGUSR1, SEND_SIG_FORCED,
1504 + common->thread_task);
1505 +@@ -411,6 +414,10 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
1506 + spin_unlock_irqrestore(&common->lock, flags);
1507 + }
1508 +
1509 ++static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
1510 ++{
1511 ++ __raise_exception(common, new_state, NULL);
1512 ++}
1513 +
1514 + /*-------------------------------------------------------------------------*/
1515 +
1516 +@@ -2285,16 +2292,16 @@ reset:
1517 + static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
1518 + {
1519 + struct fsg_dev *fsg = fsg_from_func(f);
1520 +- fsg->common->new_fsg = fsg;
1521 +- raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
1522 ++
1523 ++ __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, fsg);
1524 + return USB_GADGET_DELAYED_STATUS;
1525 + }
1526 +
1527 + static void fsg_disable(struct usb_function *f)
1528 + {
1529 + struct fsg_dev *fsg = fsg_from_func(f);
1530 +- fsg->common->new_fsg = NULL;
1531 +- raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
1532 ++
1533 ++ __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
1534 + }
1535 +
1536 +
1537 +@@ -2307,6 +2314,7 @@ static void handle_exception(struct fsg_common *common)
1538 + enum fsg_state old_state;
1539 + struct fsg_lun *curlun;
1540 + unsigned int exception_req_tag;
1541 ++ struct fsg_dev *new_fsg;
1542 +
1543 + /*
1544 + * Clear the existing signals. Anything but SIGUSR1 is converted
1545 +@@ -2360,6 +2368,7 @@ static void handle_exception(struct fsg_common *common)
1546 + common->next_buffhd_to_fill = &common->buffhds[0];
1547 + common->next_buffhd_to_drain = &common->buffhds[0];
1548 + exception_req_tag = common->exception_req_tag;
1549 ++ new_fsg = common->exception_arg;
1550 + old_state = common->state;
1551 + common->state = FSG_STATE_NORMAL;
1552 +
1553 +@@ -2413,8 +2422,8 @@ static void handle_exception(struct fsg_common *common)
1554 + break;
1555 +
1556 + case FSG_STATE_CONFIG_CHANGE:
1557 +- do_set_interface(common, common->new_fsg);
1558 +- if (common->new_fsg)
1559 ++ do_set_interface(common, new_fsg);
1560 ++ if (new_fsg)
1561 + usb_composite_setup_continue(common->cdev);
1562 + break;
1563 +
1564 +@@ -2989,8 +2998,7 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f)
1565 +
1566 + DBG(fsg, "unbind\n");
1567 + if (fsg->common->fsg == fsg) {
1568 +- fsg->common->new_fsg = NULL;
1569 +- raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
1570 ++ __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
1571 + /* FIXME: make interruptible or killable somehow? */
1572 + wait_event(common->fsg_wait, common->fsg != fsg);
1573 + }
1574 +diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
1575 +index e64eb47770c8..2d5a72c15069 100644
1576 +--- a/drivers/usb/host/fotg210-hcd.c
1577 ++++ b/drivers/usb/host/fotg210-hcd.c
1578 +@@ -1627,6 +1627,10 @@ static int fotg210_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1579 + /* see what we found out */
1580 + temp = check_reset_complete(fotg210, wIndex, status_reg,
1581 + fotg210_readl(fotg210, status_reg));
1582 ++
1583 ++ /* restart schedule */
1584 ++ fotg210->command |= CMD_RUN;
1585 ++ fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command);
1586 + }
1587 +
1588 + if (!(temp & (PORT_RESUME|PORT_RESET))) {
1589 +diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
1590 +index 210181fd98d2..af11887f5f9e 100644
1591 +--- a/drivers/usb/host/ohci-hcd.c
1592 ++++ b/drivers/usb/host/ohci-hcd.c
1593 +@@ -418,8 +418,7 @@ static void ohci_usb_reset (struct ohci_hcd *ohci)
1594 + * other cases where the next software may expect clean state from the
1595 + * "firmware". this is bus-neutral, unlike shutdown() methods.
1596 + */
1597 +-static void
1598 +-ohci_shutdown (struct usb_hcd *hcd)
1599 ++static void _ohci_shutdown(struct usb_hcd *hcd)
1600 + {
1601 + struct ohci_hcd *ohci;
1602 +
1603 +@@ -435,6 +434,16 @@ ohci_shutdown (struct usb_hcd *hcd)
1604 + ohci->rh_state = OHCI_RH_HALTED;
1605 + }
1606 +
1607 ++static void ohci_shutdown(struct usb_hcd *hcd)
1608 ++{
1609 ++ struct ohci_hcd *ohci = hcd_to_ohci(hcd);
1610 ++ unsigned long flags;
1611 ++
1612 ++ spin_lock_irqsave(&ohci->lock, flags);
1613 ++ _ohci_shutdown(hcd);
1614 ++ spin_unlock_irqrestore(&ohci->lock, flags);
1615 ++}
1616 ++
1617 + /*-------------------------------------------------------------------------*
1618 + * HC functions
1619 + *-------------------------------------------------------------------------*/
1620 +@@ -752,7 +761,7 @@ static void io_watchdog_func(struct timer_list *t)
1621 + died:
1622 + usb_hc_died(ohci_to_hcd(ohci));
1623 + ohci_dump(ohci);
1624 +- ohci_shutdown(ohci_to_hcd(ohci));
1625 ++ _ohci_shutdown(ohci_to_hcd(ohci));
1626 + goto done;
1627 + } else {
1628 + /* No write back because the done queue was empty */
1629 +diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
1630 +index 8616c52849c6..2b0ccd150209 100644
1631 +--- a/drivers/usb/host/xhci-rcar.c
1632 ++++ b/drivers/usb/host/xhci-rcar.c
1633 +@@ -104,7 +104,7 @@ static int xhci_rcar_is_gen2(struct device *dev)
1634 + return of_device_is_compatible(node, "renesas,xhci-r8a7790") ||
1635 + of_device_is_compatible(node, "renesas,xhci-r8a7791") ||
1636 + of_device_is_compatible(node, "renesas,xhci-r8a7793") ||
1637 +- of_device_is_compatible(node, "renensas,rcar-gen2-xhci");
1638 ++ of_device_is_compatible(node, "renesas,rcar-gen2-xhci");
1639 + }
1640 +
1641 + static int xhci_rcar_is_gen3(struct device *dev)
1642 +diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
1643 +index cc794e25a0b6..1d9ce9cbc831 100644
1644 +--- a/drivers/usb/storage/realtek_cr.c
1645 ++++ b/drivers/usb/storage/realtek_cr.c
1646 +@@ -38,7 +38,7 @@ MODULE_LICENSE("GPL");
1647 +
1648 + static int auto_delink_en = 1;
1649 + module_param(auto_delink_en, int, S_IRUGO | S_IWUSR);
1650 +-MODULE_PARM_DESC(auto_delink_en, "enable auto delink");
1651 ++MODULE_PARM_DESC(auto_delink_en, "auto delink mode (0=firmware, 1=software [default])");
1652 +
1653 + #ifdef CONFIG_REALTEK_AUTOPM
1654 + static int ss_en = 1;
1655 +@@ -996,12 +996,15 @@ static int init_realtek_cr(struct us_data *us)
1656 + goto INIT_FAIL;
1657 + }
1658 +
1659 +- if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) ||
1660 +- CHECK_FW_VER(chip, 0x5901))
1661 +- SET_AUTO_DELINK(chip);
1662 +- if (STATUS_LEN(chip) == 16) {
1663 +- if (SUPPORT_AUTO_DELINK(chip))
1664 ++ if (CHECK_PID(chip, 0x0138) || CHECK_PID(chip, 0x0158) ||
1665 ++ CHECK_PID(chip, 0x0159)) {
1666 ++ if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) ||
1667 ++ CHECK_FW_VER(chip, 0x5901))
1668 + SET_AUTO_DELINK(chip);
1669 ++ if (STATUS_LEN(chip) == 16) {
1670 ++ if (SUPPORT_AUTO_DELINK(chip))
1671 ++ SET_AUTO_DELINK(chip);
1672 ++ }
1673 + }
1674 + #ifdef CONFIG_REALTEK_AUTOPM
1675 + if (ss_en)
1676 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1677 +index ea0d27a94afe..1cd9b6305b06 100644
1678 +--- a/drivers/usb/storage/unusual_devs.h
1679 ++++ b/drivers/usb/storage/unusual_devs.h
1680 +@@ -2100,7 +2100,7 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201,
1681 + US_FL_IGNORE_RESIDUE ),
1682 +
1683 + /* Reported by Michael Büsch <m@××××.ch> */
1684 +-UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116,
1685 ++UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0117,
1686 + "JMicron",
1687 + "USB to ATA/ATAPI Bridge",
1688 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1689 +diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
1690 +index 5f29ce8d6c3f..fb20aa974ae1 100644
1691 +--- a/drivers/usb/typec/tcpm.c
1692 ++++ b/drivers/usb/typec/tcpm.c
1693 +@@ -1445,7 +1445,7 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
1694 + else if ((pdo_min_voltage(pdo[i]) ==
1695 + pdo_min_voltage(pdo[i - 1])) &&
1696 + (pdo_max_voltage(pdo[i]) ==
1697 +- pdo_min_voltage(pdo[i - 1])))
1698 ++ pdo_max_voltage(pdo[i - 1])))
1699 + return PDO_ERR_DUPE_PDO;
1700 + break;
1701 + /*
1702 +diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
1703 +index ed05514cc2dc..e6c27b71b136 100644
1704 +--- a/drivers/watchdog/bcm2835_wdt.c
1705 ++++ b/drivers/watchdog/bcm2835_wdt.c
1706 +@@ -249,6 +249,7 @@ module_param(nowayout, bool, 0);
1707 + MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
1708 + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
1709 +
1710 ++MODULE_ALIAS("platform:bcm2835-wdt");
1711 + MODULE_AUTHOR("Lubomir Rintel <lkundrak@××.sk>");
1712 + MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer");
1713 + MODULE_LICENSE("GPL");
1714 +diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
1715 +index 9e51d6fe7e8f..40c6860d4c63 100644
1716 +--- a/fs/afs/cmservice.c
1717 ++++ b/fs/afs/cmservice.c
1718 +@@ -423,18 +423,14 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
1719 + struct afs_call *call = container_of(work, struct afs_call, work);
1720 + struct afs_uuid *r = call->request;
1721 +
1722 +- struct {
1723 +- __be32 match;
1724 +- } reply;
1725 +-
1726 + _enter("");
1727 +
1728 + if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0)
1729 +- reply.match = htonl(0);
1730 ++ afs_send_empty_reply(call);
1731 + else
1732 +- reply.match = htonl(1);
1733 ++ rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
1734 ++ 1, 1, "K-1");
1735 +
1736 +- afs_send_simple_reply(call, &reply, sizeof(reply));
1737 + afs_put_call(call);
1738 + _leave("");
1739 + }
1740 +diff --git a/fs/afs/dir.c b/fs/afs/dir.c
1741 +index 855bf2b79fed..54e7f6f1405e 100644
1742 +--- a/fs/afs/dir.c
1743 ++++ b/fs/afs/dir.c
1744 +@@ -937,7 +937,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
1745 + dir_version = (long)dir->status.data_version;
1746 + de_version = (long)dentry->d_fsdata;
1747 + if (de_version == dir_version)
1748 +- goto out_valid;
1749 ++ goto out_valid_noupdate;
1750 +
1751 + dir_version = (long)dir->invalid_before;
1752 + if (de_version - dir_version >= 0)
1753 +@@ -1001,6 +1001,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
1754 +
1755 + out_valid:
1756 + dentry->d_fsdata = (void *)dir_version;
1757 ++out_valid_noupdate:
1758 + dput(parent);
1759 + key_put(key);
1760 + _leave(" = 1 [valid]");
1761 +diff --git a/fs/afs/file.c b/fs/afs/file.c
1762 +index 7d4f26198573..843d3b970b84 100644
1763 +--- a/fs/afs/file.c
1764 ++++ b/fs/afs/file.c
1765 +@@ -193,11 +193,13 @@ void afs_put_read(struct afs_read *req)
1766 + int i;
1767 +
1768 + if (refcount_dec_and_test(&req->usage)) {
1769 +- for (i = 0; i < req->nr_pages; i++)
1770 +- if (req->pages[i])
1771 +- put_page(req->pages[i]);
1772 +- if (req->pages != req->array)
1773 +- kfree(req->pages);
1774 ++ if (req->pages) {
1775 ++ for (i = 0; i < req->nr_pages; i++)
1776 ++ if (req->pages[i])
1777 ++ put_page(req->pages[i]);
1778 ++ if (req->pages != req->array)
1779 ++ kfree(req->pages);
1780 ++ }
1781 + kfree(req);
1782 + }
1783 + }
1784 +diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c
1785 +index c3b740813fc7..c7dd47eaff29 100644
1786 +--- a/fs/afs/vlclient.c
1787 ++++ b/fs/afs/vlclient.c
1788 +@@ -60,23 +60,24 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
1789 + struct afs_uuid__xdr *xdr;
1790 + struct afs_uuid *uuid;
1791 + int j;
1792 ++ int n = entry->nr_servers;
1793 +
1794 + tmp = ntohl(uvldb->serverFlags[i]);
1795 + if (tmp & AFS_VLSF_DONTUSE ||
1796 + (new_only && !(tmp & AFS_VLSF_NEWREPSITE)))
1797 + continue;
1798 + if (tmp & AFS_VLSF_RWVOL) {
1799 +- entry->fs_mask[i] |= AFS_VOL_VTM_RW;
1800 ++ entry->fs_mask[n] |= AFS_VOL_VTM_RW;
1801 + if (vlflags & AFS_VLF_BACKEXISTS)
1802 +- entry->fs_mask[i] |= AFS_VOL_VTM_BAK;
1803 ++ entry->fs_mask[n] |= AFS_VOL_VTM_BAK;
1804 + }
1805 + if (tmp & AFS_VLSF_ROVOL)
1806 +- entry->fs_mask[i] |= AFS_VOL_VTM_RO;
1807 +- if (!entry->fs_mask[i])
1808 ++ entry->fs_mask[n] |= AFS_VOL_VTM_RO;
1809 ++ if (!entry->fs_mask[n])
1810 + continue;
1811 +
1812 + xdr = &uvldb->serverNumber[i];
1813 +- uuid = (struct afs_uuid *)&entry->fs_server[i];
1814 ++ uuid = (struct afs_uuid *)&entry->fs_server[n];
1815 + uuid->time_low = xdr->time_low;
1816 + uuid->time_mid = htons(ntohl(xdr->time_mid));
1817 + uuid->time_hi_and_version = htons(ntohl(xdr->time_hi_and_version));
1818 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
1819 +index 33824a0a57bf..f516ace8f45d 100644
1820 +--- a/fs/nfs/direct.c
1821 ++++ b/fs/nfs/direct.c
1822 +@@ -400,15 +400,21 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
1823 + unsigned long bytes = 0;
1824 + struct nfs_direct_req *dreq = hdr->dreq;
1825 +
1826 +- if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
1827 +- goto out_put;
1828 +-
1829 + spin_lock(&dreq->lock);
1830 +- if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes == 0))
1831 ++ if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
1832 + dreq->error = hdr->error;
1833 +- else
1834 ++
1835 ++ if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) {
1836 ++ spin_unlock(&dreq->lock);
1837 ++ goto out_put;
1838 ++ }
1839 ++
1840 ++ if (hdr->good_bytes != 0)
1841 + nfs_direct_good_bytes(dreq, hdr);
1842 +
1843 ++ if (test_bit(NFS_IOHDR_EOF, &hdr->flags))
1844 ++ dreq->error = 0;
1845 ++
1846 + spin_unlock(&dreq->lock);
1847 +
1848 + while (!list_empty(&hdr->pages)) {
1849 +@@ -428,7 +434,7 @@ out_put:
1850 + hdr->release(hdr);
1851 + }
1852 +
1853 +-static void nfs_read_sync_pgio_error(struct list_head *head)
1854 ++static void nfs_read_sync_pgio_error(struct list_head *head, int error)
1855 + {
1856 + struct nfs_page *req;
1857 +
1858 +@@ -664,8 +670,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
1859 +
1860 + list_for_each_entry_safe(req, tmp, &reqs, wb_list) {
1861 + if (!nfs_pageio_add_request(&desc, req)) {
1862 +- nfs_list_remove_request(req);
1863 +- nfs_list_add_request(req, &failed);
1864 ++ nfs_list_move_request(req, &failed);
1865 + spin_lock(&cinfo.inode->i_lock);
1866 + dreq->flags = 0;
1867 + if (desc.pg_error < 0)
1868 +@@ -775,16 +780,19 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
1869 + bool request_commit = false;
1870 + struct nfs_page *req = nfs_list_entry(hdr->pages.next);
1871 +
1872 +- if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
1873 +- goto out_put;
1874 +-
1875 + nfs_init_cinfo_from_dreq(&cinfo, dreq);
1876 +
1877 + spin_lock(&dreq->lock);
1878 +
1879 + if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
1880 + dreq->error = hdr->error;
1881 +- if (dreq->error == 0) {
1882 ++
1883 ++ if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) {
1884 ++ spin_unlock(&dreq->lock);
1885 ++ goto out_put;
1886 ++ }
1887 ++
1888 ++ if (hdr->good_bytes != 0) {
1889 + nfs_direct_good_bytes(dreq, hdr);
1890 + if (nfs_write_need_commit(hdr)) {
1891 + if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
1892 +@@ -821,7 +829,7 @@ out_put:
1893 + hdr->release(hdr);
1894 + }
1895 +
1896 +-static void nfs_write_sync_pgio_error(struct list_head *head)
1897 ++static void nfs_write_sync_pgio_error(struct list_head *head, int error)
1898 + {
1899 + struct nfs_page *req;
1900 +
1901 +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
1902 +index 0ec6bce3dd69..d23ea74b5d20 100644
1903 +--- a/fs/nfs/pagelist.c
1904 ++++ b/fs/nfs/pagelist.c
1905 +@@ -769,8 +769,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc,
1906 + pageused = 0;
1907 + while (!list_empty(head)) {
1908 + req = nfs_list_entry(head->next);
1909 +- nfs_list_remove_request(req);
1910 +- nfs_list_add_request(req, &hdr->pages);
1911 ++ nfs_list_move_request(req, &hdr->pages);
1912 +
1913 + if (!last_page || last_page != req->wb_page) {
1914 + pageused++;
1915 +@@ -962,8 +961,7 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,
1916 + }
1917 + if (!nfs_can_coalesce_requests(prev, req, desc))
1918 + return 0;
1919 +- nfs_list_remove_request(req);
1920 +- nfs_list_add_request(req, &mirror->pg_list);
1921 ++ nfs_list_move_request(req, &mirror->pg_list);
1922 + mirror->pg_count += req->wb_bytes;
1923 + return 1;
1924 + }
1925 +@@ -995,9 +993,8 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc,
1926 + {
1927 + LIST_HEAD(head);
1928 +
1929 +- nfs_list_remove_request(req);
1930 +- nfs_list_add_request(req, &head);
1931 +- desc->pg_completion_ops->error_cleanup(&head);
1932 ++ nfs_list_move_request(req, &head);
1933 ++ desc->pg_completion_ops->error_cleanup(&head, desc->pg_error);
1934 + }
1935 +
1936 + /**
1937 +@@ -1133,7 +1130,8 @@ static void nfs_pageio_error_cleanup(struct nfs_pageio_descriptor *desc)
1938 +
1939 + for (midx = 0; midx < desc->pg_mirror_count; midx++) {
1940 + mirror = &desc->pg_mirrors[midx];
1941 +- desc->pg_completion_ops->error_cleanup(&mirror->pg_list);
1942 ++ desc->pg_completion_ops->error_cleanup(&mirror->pg_list,
1943 ++ desc->pg_error);
1944 + }
1945 + }
1946 +
1947 +@@ -1235,21 +1233,23 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc,
1948 + int nfs_pageio_resend(struct nfs_pageio_descriptor *desc,
1949 + struct nfs_pgio_header *hdr)
1950 + {
1951 +- LIST_HEAD(failed);
1952 ++ LIST_HEAD(pages);
1953 +
1954 + desc->pg_io_completion = hdr->io_completion;
1955 + desc->pg_dreq = hdr->dreq;
1956 +- while (!list_empty(&hdr->pages)) {
1957 +- struct nfs_page *req = nfs_list_entry(hdr->pages.next);
1958 ++ list_splice_init(&hdr->pages, &pages);
1959 ++ while (!list_empty(&pages)) {
1960 ++ struct nfs_page *req = nfs_list_entry(pages.next);
1961 +
1962 +- nfs_list_remove_request(req);
1963 + if (!nfs_pageio_add_request(desc, req))
1964 +- nfs_list_add_request(req, &failed);
1965 ++ break;
1966 + }
1967 + nfs_pageio_complete(desc);
1968 +- if (!list_empty(&failed)) {
1969 +- list_move(&failed, &hdr->pages);
1970 +- return desc->pg_error < 0 ? desc->pg_error : -EIO;
1971 ++ if (!list_empty(&pages)) {
1972 ++ int err = desc->pg_error < 0 ? desc->pg_error : -EIO;
1973 ++ hdr->completion_ops->error_cleanup(&pages, err);
1974 ++ nfs_set_pgio_error(hdr, err, hdr->io_start);
1975 ++ return err;
1976 + }
1977 + return 0;
1978 + }
1979 +diff --git a/fs/nfs/read.c b/fs/nfs/read.c
1980 +index 48d7277c60a9..09d5c282f50e 100644
1981 +--- a/fs/nfs/read.c
1982 ++++ b/fs/nfs/read.c
1983 +@@ -205,7 +205,7 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr,
1984 + }
1985 +
1986 + static void
1987 +-nfs_async_read_error(struct list_head *head)
1988 ++nfs_async_read_error(struct list_head *head, int error)
1989 + {
1990 + struct nfs_page *req;
1991 +
1992 +diff --git a/fs/nfs/write.c b/fs/nfs/write.c
1993 +index 51d0b7913c04..5ab997912d8d 100644
1994 +--- a/fs/nfs/write.c
1995 ++++ b/fs/nfs/write.c
1996 +@@ -1394,20 +1394,27 @@ static void nfs_redirty_request(struct nfs_page *req)
1997 + nfs_release_request(req);
1998 + }
1999 +
2000 +-static void nfs_async_write_error(struct list_head *head)
2001 ++static void nfs_async_write_error(struct list_head *head, int error)
2002 + {
2003 + struct nfs_page *req;
2004 +
2005 + while (!list_empty(head)) {
2006 + req = nfs_list_entry(head->next);
2007 + nfs_list_remove_request(req);
2008 ++ if (nfs_error_is_fatal(error)) {
2009 ++ nfs_context_set_write_error(req->wb_context, error);
2010 ++ if (nfs_error_is_fatal_on_server(error)) {
2011 ++ nfs_write_error_remove_page(req);
2012 ++ continue;
2013 ++ }
2014 ++ }
2015 + nfs_redirty_request(req);
2016 + }
2017 + }
2018 +
2019 + static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr)
2020 + {
2021 +- nfs_async_write_error(&hdr->pages);
2022 ++ nfs_async_write_error(&hdr->pages, 0);
2023 + filemap_fdatawrite_range(hdr->inode->i_mapping, hdr->args.offset,
2024 + hdr->args.offset + hdr->args.count - 1);
2025 + }
2026 +diff --git a/include/linux/logic_pio.h b/include/linux/logic_pio.h
2027 +index cbd9d8495690..88e1e6304a71 100644
2028 +--- a/include/linux/logic_pio.h
2029 ++++ b/include/linux/logic_pio.h
2030 +@@ -117,6 +117,7 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode);
2031 + unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode,
2032 + resource_size_t hw_addr, resource_size_t size);
2033 + int logic_pio_register_range(struct logic_pio_hwaddr *newrange);
2034 ++void logic_pio_unregister_range(struct logic_pio_hwaddr *range);
2035 + resource_size_t logic_pio_to_hwaddr(unsigned long pio);
2036 + unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr);
2037 +
2038 +diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
2039 +index e27572d30d97..ad69430fd0eb 100644
2040 +--- a/include/linux/nfs_page.h
2041 ++++ b/include/linux/nfs_page.h
2042 +@@ -164,6 +164,16 @@ nfs_list_add_request(struct nfs_page *req, struct list_head *head)
2043 + list_add_tail(&req->wb_list, head);
2044 + }
2045 +
2046 ++/**
2047 ++ * nfs_list_move_request - Move a request to a new list
2048 ++ * @req: request
2049 ++ * @head: head of list into which to insert the request.
2050 ++ */
2051 ++static inline void
2052 ++nfs_list_move_request(struct nfs_page *req, struct list_head *head)
2053 ++{
2054 ++ list_move_tail(&req->wb_list, head);
2055 ++}
2056 +
2057 + /**
2058 + * nfs_list_remove_request - Remove a request from its wb_list
2059 +diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
2060 +index bd1c889a9ed9..cab24a127feb 100644
2061 +--- a/include/linux/nfs_xdr.h
2062 ++++ b/include/linux/nfs_xdr.h
2063 +@@ -1539,7 +1539,7 @@ struct nfs_commit_data {
2064 + };
2065 +
2066 + struct nfs_pgio_completion_ops {
2067 +- void (*error_cleanup)(struct list_head *head);
2068 ++ void (*error_cleanup)(struct list_head *head, int);
2069 + void (*init_hdr)(struct nfs_pgio_header *hdr);
2070 + void (*completion)(struct nfs_pgio_header *hdr);
2071 + void (*reschedule_io)(struct nfs_pgio_header *hdr);
2072 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
2073 +index d9dd709b3c12..7e215dac9693 100644
2074 +--- a/kernel/trace/ftrace.c
2075 ++++ b/kernel/trace/ftrace.c
2076 +@@ -3112,6 +3112,14 @@ t_probe_next(struct seq_file *m, loff_t *pos)
2077 + hnd = &iter->probe_entry->hlist;
2078 +
2079 + hash = iter->probe->ops.func_hash->filter_hash;
2080 ++
2081 ++ /*
2082 ++ * A probe being registered may temporarily have an empty hash
2083 ++ * and it's at the end of the func_probes list.
2084 ++ */
2085 ++ if (!hash || hash == EMPTY_HASH)
2086 ++ return NULL;
2087 ++
2088 + size = 1 << hash->size_bits;
2089 +
2090 + retry:
2091 +@@ -4307,12 +4315,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
2092 +
2093 + mutex_unlock(&ftrace_lock);
2094 +
2095 ++ /*
2096 ++ * Note, there's a small window here that the func_hash->filter_hash
2097 ++ * may be NULL or empty. Need to be carefule when reading the loop.
2098 ++ */
2099 + mutex_lock(&probe->ops.func_hash->regex_lock);
2100 +
2101 + orig_hash = &probe->ops.func_hash->filter_hash;
2102 + old_hash = *orig_hash;
2103 + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash);
2104 +
2105 ++ if (!hash) {
2106 ++ ret = -ENOMEM;
2107 ++ goto out;
2108 ++ }
2109 ++
2110 + ret = ftrace_match_records(hash, glob, strlen(glob));
2111 +
2112 + /* Nothing found? */
2113 +diff --git a/lib/logic_pio.c b/lib/logic_pio.c
2114 +index feea48fd1a0d..905027574e5d 100644
2115 +--- a/lib/logic_pio.c
2116 ++++ b/lib/logic_pio.c
2117 +@@ -35,7 +35,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)
2118 + struct logic_pio_hwaddr *range;
2119 + resource_size_t start;
2120 + resource_size_t end;
2121 +- resource_size_t mmio_sz = 0;
2122 ++ resource_size_t mmio_end = 0;
2123 + resource_size_t iio_sz = MMIO_UPPER_LIMIT;
2124 + int ret = 0;
2125 +
2126 +@@ -46,7 +46,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)
2127 + end = new_range->hw_start + new_range->size;
2128 +
2129 + mutex_lock(&io_range_mutex);
2130 +- list_for_each_entry_rcu(range, &io_range_list, list) {
2131 ++ list_for_each_entry(range, &io_range_list, list) {
2132 + if (range->fwnode == new_range->fwnode) {
2133 + /* range already there */
2134 + goto end_register;
2135 +@@ -56,7 +56,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)
2136 + /* for MMIO ranges we need to check for overlap */
2137 + if (start >= range->hw_start + range->size ||
2138 + end < range->hw_start) {
2139 +- mmio_sz += range->size;
2140 ++ mmio_end = range->io_start + range->size;
2141 + } else {
2142 + ret = -EFAULT;
2143 + goto end_register;
2144 +@@ -69,16 +69,16 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)
2145 +
2146 + /* range not registered yet, check for available space */
2147 + if (new_range->flags == LOGIC_PIO_CPU_MMIO) {
2148 +- if (mmio_sz + new_range->size - 1 > MMIO_UPPER_LIMIT) {
2149 ++ if (mmio_end + new_range->size - 1 > MMIO_UPPER_LIMIT) {
2150 + /* if it's too big check if 64K space can be reserved */
2151 +- if (mmio_sz + SZ_64K - 1 > MMIO_UPPER_LIMIT) {
2152 ++ if (mmio_end + SZ_64K - 1 > MMIO_UPPER_LIMIT) {
2153 + ret = -E2BIG;
2154 + goto end_register;
2155 + }
2156 + new_range->size = SZ_64K;
2157 + pr_warn("Requested IO range too big, new size set to 64K\n");
2158 + }
2159 +- new_range->io_start = mmio_sz;
2160 ++ new_range->io_start = mmio_end;
2161 + } else if (new_range->flags == LOGIC_PIO_INDIRECT) {
2162 + if (iio_sz + new_range->size - 1 > IO_SPACE_LIMIT) {
2163 + ret = -E2BIG;
2164 +@@ -98,6 +98,20 @@ end_register:
2165 + return ret;
2166 + }
2167 +
2168 ++/**
2169 ++ * logic_pio_unregister_range - unregister a logical PIO range for a host
2170 ++ * @range: pointer to the IO range which has been already registered.
2171 ++ *
2172 ++ * Unregister a previously-registered IO range node.
2173 ++ */
2174 ++void logic_pio_unregister_range(struct logic_pio_hwaddr *range)
2175 ++{
2176 ++ mutex_lock(&io_range_mutex);
2177 ++ list_del_rcu(&range->list);
2178 ++ mutex_unlock(&io_range_mutex);
2179 ++ synchronize_rcu();
2180 ++}
2181 ++
2182 + /**
2183 + * find_io_range_by_fwnode - find logical PIO range for given FW node
2184 + * @fwnode: FW node handle associated with logical PIO range
2185 +@@ -108,26 +122,38 @@ end_register:
2186 + */
2187 + struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode)
2188 + {
2189 +- struct logic_pio_hwaddr *range;
2190 ++ struct logic_pio_hwaddr *range, *found_range = NULL;
2191 +
2192 ++ rcu_read_lock();
2193 + list_for_each_entry_rcu(range, &io_range_list, list) {
2194 +- if (range->fwnode == fwnode)
2195 +- return range;
2196 ++ if (range->fwnode == fwnode) {
2197 ++ found_range = range;
2198 ++ break;
2199 ++ }
2200 + }
2201 +- return NULL;
2202 ++ rcu_read_unlock();
2203 ++
2204 ++ return found_range;
2205 + }
2206 +
2207 + /* Return a registered range given an input PIO token */
2208 + static struct logic_pio_hwaddr *find_io_range(unsigned long pio)
2209 + {
2210 +- struct logic_pio_hwaddr *range;
2211 ++ struct logic_pio_hwaddr *range, *found_range = NULL;
2212 +
2213 ++ rcu_read_lock();
2214 + list_for_each_entry_rcu(range, &io_range_list, list) {
2215 +- if (in_range(pio, range->io_start, range->size))
2216 +- return range;
2217 ++ if (in_range(pio, range->io_start, range->size)) {
2218 ++ found_range = range;
2219 ++ break;
2220 ++ }
2221 + }
2222 +- pr_err("PIO entry token %lx invalid\n", pio);
2223 +- return NULL;
2224 ++ rcu_read_unlock();
2225 ++
2226 ++ if (!found_range)
2227 ++ pr_err("PIO entry token 0x%lx invalid\n", pio);
2228 ++
2229 ++ return found_range;
2230 + }
2231 +
2232 + /**
2233 +@@ -180,14 +206,23 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)
2234 + {
2235 + struct logic_pio_hwaddr *range;
2236 +
2237 ++ rcu_read_lock();
2238 + list_for_each_entry_rcu(range, &io_range_list, list) {
2239 + if (range->flags != LOGIC_PIO_CPU_MMIO)
2240 + continue;
2241 +- if (in_range(addr, range->hw_start, range->size))
2242 +- return addr - range->hw_start + range->io_start;
2243 ++ if (in_range(addr, range->hw_start, range->size)) {
2244 ++ unsigned long cpuaddr;
2245 ++
2246 ++ cpuaddr = addr - range->hw_start + range->io_start;
2247 ++
2248 ++ rcu_read_unlock();
2249 ++ return cpuaddr;
2250 ++ }
2251 + }
2252 +- pr_err("addr %llx not registered in io_range_list\n",
2253 +- (unsigned long long) addr);
2254 ++ rcu_read_unlock();
2255 ++
2256 ++ pr_err("addr %pa not registered in io_range_list\n", &addr);
2257 ++
2258 + return ~0UL;
2259 + }
2260 +
2261 +diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
2262 +index c2c4f739da8f..4b9063d12b93 100644
2263 +--- a/mm/zsmalloc.c
2264 ++++ b/mm/zsmalloc.c
2265 +@@ -2432,7 +2432,9 @@ struct zs_pool *zs_create_pool(const char *name)
2266 + if (!pool->name)
2267 + goto err;
2268 +
2269 ++#ifdef CONFIG_COMPACTION
2270 + init_waitqueue_head(&pool->migration_wait);
2271 ++#endif
2272 +
2273 + if (create_cache(pool))
2274 + goto err;
2275 +diff --git a/net/core/stream.c b/net/core/stream.c
2276 +index 7d329fb1f553..7f5eaa95a675 100644
2277 +--- a/net/core/stream.c
2278 ++++ b/net/core/stream.c
2279 +@@ -120,7 +120,6 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
2280 + int err = 0;
2281 + long vm_wait = 0;
2282 + long current_timeo = *timeo_p;
2283 +- bool noblock = (*timeo_p ? false : true);
2284 + DEFINE_WAIT_FUNC(wait, woken_wake_function);
2285 +
2286 + if (sk_stream_memory_free(sk))
2287 +@@ -133,11 +132,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
2288 +
2289 + if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
2290 + goto do_error;
2291 +- if (!*timeo_p) {
2292 +- if (noblock)
2293 +- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
2294 +- goto do_nonblock;
2295 +- }
2296 ++ if (!*timeo_p)
2297 ++ goto do_eagain;
2298 + if (signal_pending(current))
2299 + goto do_interrupted;
2300 + sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
2301 +@@ -169,7 +165,13 @@ out:
2302 + do_error:
2303 + err = -EPIPE;
2304 + goto out;
2305 +-do_nonblock:
2306 ++do_eagain:
2307 ++ /* Make sure that whenever EAGAIN is returned, EPOLLOUT event can
2308 ++ * be generated later.
2309 ++ * When TCP receives ACK packets that make room, tcp_check_space()
2310 ++ * only calls tcp_new_space() if SOCK_NOSPACE is set.
2311 ++ */
2312 ++ set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
2313 + err = -EAGAIN;
2314 + goto out;
2315 + do_interrupted:
2316 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2317 +index ad75c468ecfb..0167e23d1c8f 100644
2318 +--- a/net/ipv4/icmp.c
2319 ++++ b/net/ipv4/icmp.c
2320 +@@ -587,7 +587,13 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
2321 +
2322 + if (!rt)
2323 + goto out;
2324 +- net = dev_net(rt->dst.dev);
2325 ++
2326 ++ if (rt->dst.dev)
2327 ++ net = dev_net(rt->dst.dev);
2328 ++ else if (skb_in->dev)
2329 ++ net = dev_net(skb_in->dev);
2330 ++ else
2331 ++ goto out;
2332 +
2333 + /*
2334 + * Find the original header. It is expected to be valid, of course.
2335 +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
2336 +index c57efd5c5b38..49e2f6dac646 100644
2337 +--- a/net/ipv6/addrconf.c
2338 ++++ b/net/ipv6/addrconf.c
2339 +@@ -995,7 +995,8 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
2340 + int err = 0;
2341 +
2342 + if (addr_type == IPV6_ADDR_ANY ||
2343 +- addr_type & IPV6_ADDR_MULTICAST ||
2344 ++ (addr_type & IPV6_ADDR_MULTICAST &&
2345 ++ !(cfg->ifa_flags & IFA_F_MCAUTOJOIN)) ||
2346 + (!(idev->dev->flags & IFF_LOOPBACK) &&
2347 + addr_type & IPV6_ADDR_LOOPBACK))
2348 + return ERR_PTR(-EADDRNOTAVAIL);
2349 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
2350 +index 81220077d62f..c88586380134 100644
2351 +--- a/net/ipv6/route.c
2352 ++++ b/net/ipv6/route.c
2353 +@@ -3109,7 +3109,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
2354 + rt->fib6_metric = cfg->fc_metric;
2355 + rt->fib6_nh.nh_weight = 1;
2356 +
2357 +- rt->fib6_type = cfg->fc_type;
2358 ++ rt->fib6_type = cfg->fc_type ? : RTN_UNICAST;
2359 +
2360 + /* We cannot add true routes via loopback here,
2361 + they would result in kernel looping; promote them to reject routes
2362 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
2363 +index 40c510223467..a48e83b19cfa 100644
2364 +--- a/net/mac80211/cfg.c
2365 ++++ b/net/mac80211/cfg.c
2366 +@@ -1471,6 +1471,11 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
2367 + if (is_multicast_ether_addr(mac))
2368 + return -EINVAL;
2369 +
2370 ++ if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER) &&
2371 ++ sdata->vif.type == NL80211_IFTYPE_STATION &&
2372 ++ !sdata->u.mgd.associated)
2373 ++ return -EINVAL;
2374 ++
2375 + sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
2376 + if (!sta)
2377 + return -ENOMEM;
2378 +@@ -1478,10 +1483,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
2379 + if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))
2380 + sta->sta.tdls = true;
2381 +
2382 +- if (sta->sta.tdls && sdata->vif.type == NL80211_IFTYPE_STATION &&
2383 +- !sdata->u.mgd.associated)
2384 +- return -EINVAL;
2385 +-
2386 + err = sta_apply_parameters(local, sta, params);
2387 + if (err) {
2388 + sta_info_free(local, sta);
2389 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
2390 +index 7523d995ea8a..b12f23c996f4 100644
2391 +--- a/net/mac80211/rx.c
2392 ++++ b/net/mac80211/rx.c
2393 +@@ -2372,11 +2372,13 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
2394 + skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) &&
2395 + sdata->control_port_over_nl80211)) {
2396 + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
2397 +- bool noencrypt = status->flag & RX_FLAG_DECRYPTED;
2398 ++ bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED);
2399 +
2400 + cfg80211_rx_control_port(dev, skb, noencrypt);
2401 + dev_kfree_skb(skb);
2402 + } else {
2403 ++ memset(skb->cb, 0, sizeof(skb->cb));
2404 ++
2405 + /* deliver to local stack */
2406 + if (rx->napi)
2407 + napi_gro_receive(rx->napi, skb);
2408 +@@ -2470,8 +2472,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
2409 +
2410 + if (skb) {
2411 + skb->protocol = eth_type_trans(skb, dev);
2412 +- memset(skb->cb, 0, sizeof(skb->cb));
2413 +-
2414 + ieee80211_deliver_skb_to_local_stack(skb, rx);
2415 + }
2416 +
2417 +diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
2418 +index d8366ed51757..28361aef9982 100644
2419 +--- a/net/smc/smc_tx.c
2420 ++++ b/net/smc/smc_tx.c
2421 +@@ -75,13 +75,11 @@ static int smc_tx_wait(struct smc_sock *smc, int flags)
2422 + DEFINE_WAIT_FUNC(wait, woken_wake_function);
2423 + struct smc_connection *conn = &smc->conn;
2424 + struct sock *sk = &smc->sk;
2425 +- bool noblock;
2426 + long timeo;
2427 + int rc = 0;
2428 +
2429 + /* similar to sk_stream_wait_memory */
2430 + timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
2431 +- noblock = timeo ? false : true;
2432 + add_wait_queue(sk_sleep(sk), &wait);
2433 + while (1) {
2434 + sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
2435 +@@ -96,8 +94,8 @@ static int smc_tx_wait(struct smc_sock *smc, int flags)
2436 + break;
2437 + }
2438 + if (!timeo) {
2439 +- if (noblock)
2440 +- set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
2441 ++ /* ensure EPOLLOUT is subsequently generated */
2442 ++ set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
2443 + rc = -EAGAIN;
2444 + break;
2445 + }
2446 +diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
2447 +index 4c0ac79f82d4..3288bdff9889 100644
2448 +--- a/net/tls/tls_main.c
2449 ++++ b/net/tls/tls_main.c
2450 +@@ -301,6 +301,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
2451 + #else
2452 + {
2453 + #endif
2454 ++ if (sk->sk_write_space == tls_write_space)
2455 ++ sk->sk_write_space = ctx->sk_write_space;
2456 + tls_ctx_free(ctx);
2457 + ctx = NULL;
2458 + }
2459 +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
2460 +index 6848a8196711..bbb2da70e870 100644
2461 +--- a/net/tls/tls_sw.c
2462 ++++ b/net/tls/tls_sw.c
2463 +@@ -354,7 +354,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
2464 + {
2465 + struct tls_context *tls_ctx = tls_get_ctx(sk);
2466 + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx);
2467 +- int ret = 0;
2468 ++ int ret;
2469 + int required_size;
2470 + long timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
2471 + bool eor = !(msg->msg_flags & MSG_MORE);
2472 +@@ -370,7 +370,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
2473 +
2474 + lock_sock(sk);
2475 +
2476 +- if (tls_complete_pending_work(sk, tls_ctx, msg->msg_flags, &timeo))
2477 ++ ret = tls_complete_pending_work(sk, tls_ctx, msg->msg_flags, &timeo);
2478 ++ if (ret)
2479 + goto send_end;
2480 +
2481 + if (unlikely(msg->msg_controllen)) {
2482 +@@ -505,7 +506,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page,
2483 + {
2484 + struct tls_context *tls_ctx = tls_get_ctx(sk);
2485 + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx);
2486 +- int ret = 0;
2487 ++ int ret;
2488 + long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
2489 + bool eor;
2490 + size_t orig_size = size;
2491 +@@ -525,7 +526,8 @@ int tls_sw_sendpage(struct sock *sk, struct page *page,
2492 +
2493 + sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
2494 +
2495 +- if (tls_complete_pending_work(sk, tls_ctx, flags, &timeo))
2496 ++ ret = tls_complete_pending_work(sk, tls_ctx, flags, &timeo);
2497 ++ if (ret)
2498 + goto sendpage_end;
2499 +
2500 + /* Call the sk_stream functions to manage the sndbuf mem. */
2501 +diff --git a/net/wireless/reg.c b/net/wireless/reg.c
2502 +index 8a47297ff206..d8ebf4f0ef6e 100644
2503 +--- a/net/wireless/reg.c
2504 ++++ b/net/wireless/reg.c
2505 +@@ -2777,7 +2777,7 @@ static void reg_process_pending_hints(void)
2506 +
2507 + /* When last_request->processed becomes true this will be rescheduled */
2508 + if (lr && !lr->processed) {
2509 +- reg_process_hint(lr);
2510 ++ pr_debug("Pending regulatory request, waiting for it to be processed...\n");
2511 + return;
2512 + }
2513 +
2514 +diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
2515 +index bbf91a5a938b..bd3d68e0489d 100644
2516 +--- a/sound/core/seq/seq_clientmgr.c
2517 ++++ b/sound/core/seq/seq_clientmgr.c
2518 +@@ -1818,8 +1818,7 @@ static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client,
2519 + if (cptr->type == USER_CLIENT) {
2520 + info->input_pool = cptr->data.user.fifo_pool_size;
2521 + info->input_free = info->input_pool;
2522 +- if (cptr->data.user.fifo)
2523 +- info->input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool);
2524 ++ info->input_free = snd_seq_fifo_unused_cells(cptr->data.user.fifo);
2525 + } else {
2526 + info->input_pool = 0;
2527 + info->input_free = 0;
2528 +diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
2529 +index 72c0302a55d2..6a24732704fc 100644
2530 +--- a/sound/core/seq/seq_fifo.c
2531 ++++ b/sound/core/seq/seq_fifo.c
2532 +@@ -280,3 +280,20 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
2533 +
2534 + return 0;
2535 + }
2536 ++
2537 ++/* get the number of unused cells safely */
2538 ++int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f)
2539 ++{
2540 ++ unsigned long flags;
2541 ++ int cells;
2542 ++
2543 ++ if (!f)
2544 ++ return 0;
2545 ++
2546 ++ snd_use_lock_use(&f->use_lock);
2547 ++ spin_lock_irqsave(&f->lock, flags);
2548 ++ cells = snd_seq_unused_cells(f->pool);
2549 ++ spin_unlock_irqrestore(&f->lock, flags);
2550 ++ snd_use_lock_free(&f->use_lock);
2551 ++ return cells;
2552 ++}
2553 +diff --git a/sound/core/seq/seq_fifo.h b/sound/core/seq/seq_fifo.h
2554 +index 062c446e7867..5d38a0d7f0cd 100644
2555 +--- a/sound/core/seq/seq_fifo.h
2556 ++++ b/sound/core/seq/seq_fifo.h
2557 +@@ -68,5 +68,7 @@ int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table
2558 + /* resize pool in fifo */
2559 + int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
2560 +
2561 ++/* get the number of unused cells safely */
2562 ++int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f);
2563 +
2564 + #endif
2565 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
2566 +index 6f17b256fcd0..ae8fde4c1a12 100644
2567 +--- a/sound/pci/hda/patch_conexant.c
2568 ++++ b/sound/pci/hda/patch_conexant.c
2569 +@@ -624,18 +624,20 @@ static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec,
2570 +
2571 + /* update LED status via GPIO */
2572 + static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask,
2573 +- bool enabled)
2574 ++ bool led_on)
2575 + {
2576 + struct conexant_spec *spec = codec->spec;
2577 + unsigned int oldval = spec->gpio_led;
2578 +
2579 + if (spec->mute_led_polarity)
2580 +- enabled = !enabled;
2581 ++ led_on = !led_on;
2582 +
2583 +- if (enabled)
2584 +- spec->gpio_led &= ~mask;
2585 +- else
2586 ++ if (led_on)
2587 + spec->gpio_led |= mask;
2588 ++ else
2589 ++ spec->gpio_led &= ~mask;
2590 ++ codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n",
2591 ++ mask, led_on, spec->gpio_led);
2592 + if (spec->gpio_led != oldval)
2593 + snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
2594 + spec->gpio_led);
2595 +@@ -646,8 +648,8 @@ static void cxt_fixup_gpio_mute_hook(void *private_data, int enabled)
2596 + {
2597 + struct hda_codec *codec = private_data;
2598 + struct conexant_spec *spec = codec->spec;
2599 +-
2600 +- cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
2601 ++ /* muted -> LED on */
2602 ++ cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, !enabled);
2603 + }
2604 +
2605 + /* turn on/off mic-mute LED via GPIO per capture hook */
2606 +@@ -669,7 +671,6 @@ static void cxt_fixup_mute_led_gpio(struct hda_codec *codec,
2607 + { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 },
2608 + {}
2609 + };
2610 +- codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led);
2611 +
2612 + if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2613 + spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook;
2614 +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
2615 +index dafc3b7f8d72..62aa320c2070 100644
2616 +--- a/sound/soc/soc-core.c
2617 ++++ b/sound/soc/soc-core.c
2618 +@@ -1513,11 +1513,8 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
2619 + }
2620 + }
2621 +
2622 +- if (dai_link->dai_fmt) {
2623 +- ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
2624 +- if (ret)
2625 +- return ret;
2626 +- }
2627 ++ if (dai_link->dai_fmt)
2628 ++ snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
2629 +
2630 + ret = soc_post_component_init(rtd, dai_link->name);
2631 + if (ret)
2632 +diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
2633 +index 78c2d6cab3b5..531564269444 100644
2634 +--- a/sound/usb/line6/pcm.c
2635 ++++ b/sound/usb/line6/pcm.c
2636 +@@ -554,6 +554,15 @@ int line6_init_pcm(struct usb_line6 *line6,
2637 + line6pcm->volume_monitor = 255;
2638 + line6pcm->line6 = line6;
2639 +
2640 ++ spin_lock_init(&line6pcm->out.lock);
2641 ++ spin_lock_init(&line6pcm->in.lock);
2642 ++ line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
2643 ++
2644 ++ line6->line6pcm = line6pcm;
2645 ++
2646 ++ pcm->private_data = line6pcm;
2647 ++ pcm->private_free = line6_cleanup_pcm;
2648 ++
2649 + line6pcm->max_packet_size_in =
2650 + usb_maxpacket(line6->usbdev,
2651 + usb_rcvisocpipe(line6->usbdev, ep_read), 0);
2652 +@@ -566,15 +575,6 @@ int line6_init_pcm(struct usb_line6 *line6,
2653 + return -EINVAL;
2654 + }
2655 +
2656 +- spin_lock_init(&line6pcm->out.lock);
2657 +- spin_lock_init(&line6pcm->in.lock);
2658 +- line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
2659 +-
2660 +- line6->line6pcm = line6pcm;
2661 +-
2662 +- pcm->private_data = line6pcm;
2663 +- pcm->private_free = line6_cleanup_pcm;
2664 +-
2665 + err = line6_create_audio_out_urbs(line6pcm);
2666 + if (err < 0)
2667 + return err;
2668 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
2669 +index 4b3e1c48ca2f..b0c5d4ef6137 100644
2670 +--- a/sound/usb/mixer.c
2671 ++++ b/sound/usb/mixer.c
2672 +@@ -754,7 +754,6 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,
2673 + struct uac_mixer_unit_descriptor *desc)
2674 + {
2675 + int mu_channels;
2676 +- void *c;
2677 +
2678 + if (desc->bLength < sizeof(*desc))
2679 + return -EINVAL;
2680 +@@ -777,13 +776,6 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,
2681 + break;
2682 + }
2683 +
2684 +- if (!mu_channels)
2685 +- return 0;
2686 +-
2687 +- c = uac_mixer_unit_bmControls(desc, state->mixer->protocol);
2688 +- if (c - (void *)desc + (mu_channels - 1) / 8 >= desc->bLength)
2689 +- return 0; /* no bmControls -> skip */
2690 +-
2691 + return mu_channels;
2692 + }
2693 +
2694 +@@ -2028,6 +2020,31 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid,
2695 + * Mixer Unit
2696 + */
2697 +
2698 ++/* check whether the given in/out overflows bmMixerControls matrix */
2699 ++static bool mixer_bitmap_overflow(struct uac_mixer_unit_descriptor *desc,
2700 ++ int protocol, int num_ins, int num_outs)
2701 ++{
2702 ++ u8 *hdr = (u8 *)desc;
2703 ++ u8 *c = uac_mixer_unit_bmControls(desc, protocol);
2704 ++ size_t rest; /* remaining bytes after bmMixerControls */
2705 ++
2706 ++ switch (protocol) {
2707 ++ case UAC_VERSION_1:
2708 ++ default:
2709 ++ rest = 1; /* iMixer */
2710 ++ break;
2711 ++ case UAC_VERSION_2:
2712 ++ rest = 2; /* bmControls + iMixer */
2713 ++ break;
2714 ++ case UAC_VERSION_3:
2715 ++ rest = 6; /* bmControls + wMixerDescrStr */
2716 ++ break;
2717 ++ }
2718 ++
2719 ++ /* overflow? */
2720 ++ return c + (num_ins * num_outs + 7) / 8 + rest > hdr + hdr[0];
2721 ++}
2722 ++
2723 + /*
2724 + * build a mixer unit control
2725 + *
2726 +@@ -2156,6 +2173,9 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid,
2727 + if (err < 0)
2728 + return err;
2729 + num_ins += iterm.channels;
2730 ++ if (mixer_bitmap_overflow(desc, state->mixer->protocol,
2731 ++ num_ins, num_outs))
2732 ++ break;
2733 + for (; ich < num_ins; ich++) {
2734 + int och, ich_has_controls = 0;
2735 +
2736 +diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
2737 +index 5b342fe30c75..10c6971cf477 100644
2738 +--- a/sound/usb/mixer_quirks.c
2739 ++++ b/sound/usb/mixer_quirks.c
2740 +@@ -1167,17 +1167,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
2741 + {
2742 + struct usb_mixer_interface *mixer;
2743 + struct usb_mixer_elem_info *cval;
2744 +- int unitid = 12; /* SamleRate ExtensionUnit ID */
2745 ++ int unitid = 12; /* SampleRate ExtensionUnit ID */
2746 +
2747 + list_for_each_entry(mixer, &chip->mixer_list, list) {
2748 +- cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
2749 +- if (cval) {
2750 ++ if (mixer->id_elems[unitid]) {
2751 ++ cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
2752 + snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
2753 + cval->control << 8,
2754 + samplerate_id);
2755 + snd_usb_mixer_notify_id(mixer, unitid);
2756 ++ break;
2757 + }
2758 +- break;
2759 + }
2760 + }
2761 +
2762 +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
2763 +index db114f3977e0..35c57a4204a8 100644
2764 +--- a/sound/usb/pcm.c
2765 ++++ b/sound/usb/pcm.c
2766 +@@ -350,6 +350,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
2767 + ep = 0x81;
2768 + ifnum = 2;
2769 + goto add_sync_ep_from_ifnum;
2770 ++ case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
2771 + case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
2772 + ep = 0x81;
2773 + ifnum = 1;
2774 +diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
2775 +index d7e06fe0270e..0ce50c319cfd 100644
2776 +--- a/tools/hv/hv_kvp_daemon.c
2777 ++++ b/tools/hv/hv_kvp_daemon.c
2778 +@@ -1386,6 +1386,8 @@ int main(int argc, char *argv[])
2779 + daemonize = 0;
2780 + break;
2781 + case 'h':
2782 ++ print_usage(argv);
2783 ++ exit(0);
2784 + default:
2785 + print_usage(argv);
2786 + exit(EXIT_FAILURE);
2787 +diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
2788 +index b13300172762..c2bb8a360177 100644
2789 +--- a/tools/hv/hv_vss_daemon.c
2790 ++++ b/tools/hv/hv_vss_daemon.c
2791 +@@ -229,6 +229,8 @@ int main(int argc, char *argv[])
2792 + daemonize = 0;
2793 + break;
2794 + case 'h':
2795 ++ print_usage(argv);
2796 ++ exit(0);
2797 + default:
2798 + print_usage(argv);
2799 + exit(EXIT_FAILURE);
2800 +diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
2801 +index 55e7374bade0..099f2c44dbed 100644
2802 +--- a/tools/hv/lsvmbus
2803 ++++ b/tools/hv/lsvmbus
2804 +@@ -4,10 +4,10 @@
2805 + import os
2806 + from optparse import OptionParser
2807 +
2808 ++help_msg = "print verbose messages. Try -vv, -vvv for more verbose messages"
2809 + parser = OptionParser()
2810 +-parser.add_option("-v", "--verbose", dest="verbose",
2811 +- help="print verbose messages. Try -vv, -vvv for \
2812 +- more verbose messages", action="count")
2813 ++parser.add_option(
2814 ++ "-v", "--verbose", dest="verbose", help=help_msg, action="count")
2815 +
2816 + (options, args) = parser.parse_args()
2817 +
2818 +@@ -21,27 +21,28 @@ if not os.path.isdir(vmbus_sys_path):
2819 + exit(-1)
2820 +
2821 + vmbus_dev_dict = {
2822 +- '{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system shutdown]',
2823 +- '{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]',
2824 +- '{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]',
2825 +- '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]',
2826 +- '{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume checkpoint)]',
2827 +- '{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]',
2828 +- '{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]',
2829 +- '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse',
2830 +- '{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard',
2831 +- '{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer adapter',
2832 +- '{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter',
2833 +- '{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller',
2834 +- '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller',
2835 +- '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter',
2836 +- '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter',
2837 +- '{44c4f61d-4444-4400-9d52-802e27ede19f}' : 'PCI Express pass-through',
2838 +- '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]',
2839 +- '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]',
2840 +- '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]',
2841 ++ '{0e0b6031-5213-4934-818b-38d90ced39db}': '[Operating system shutdown]',
2842 ++ '{9527e630-d0ae-497b-adce-e80ab0175caf}': '[Time Synchronization]',
2843 ++ '{57164f39-9115-4e78-ab55-382f3bd5422d}': '[Heartbeat]',
2844 ++ '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}': '[Data Exchange]',
2845 ++ '{35fa2e29-ea23-4236-96ae-3a6ebacba440}': '[Backup (volume checkpoint)]',
2846 ++ '{34d14be3-dee4-41c8-9ae7-6b174977c192}': '[Guest services]',
2847 ++ '{525074dc-8985-46e2-8057-a307dc18a502}': '[Dynamic Memory]',
2848 ++ '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}': 'Synthetic mouse',
2849 ++ '{f912ad6d-2b17-48ea-bd65-f927a61c7684}': 'Synthetic keyboard',
2850 ++ '{da0a7802-e377-4aac-8e77-0558eb1073f8}': 'Synthetic framebuffer adapter',
2851 ++ '{f8615163-df3e-46c5-913f-f2d2f965ed0e}': 'Synthetic network adapter',
2852 ++ '{32412632-86cb-44a2-9b5c-50d1417354f5}': 'Synthetic IDE Controller',
2853 ++ '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}': 'Synthetic SCSI Controller',
2854 ++ '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}': 'Synthetic fiber channel adapter',
2855 ++ '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}': 'Synthetic RDMA adapter',
2856 ++ '{44c4f61d-4444-4400-9d52-802e27ede19f}': 'PCI Express pass-through',
2857 ++ '{276aacf4-ac15-426c-98dd-7521ad3f01fe}': '[Reserved system device]',
2858 ++ '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}': '[Reserved system device]',
2859 ++ '{3375baf4-9e15-4b30-b765-67acb10d607b}': '[Reserved system device]',
2860 + }
2861 +
2862 ++
2863 + def get_vmbus_dev_attr(dev_name, attr):
2864 + try:
2865 + f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r')
2866 +@@ -52,6 +53,7 @@ def get_vmbus_dev_attr(dev_name, attr):
2867 +
2868 + return lines
2869 +
2870 ++
2871 + class VMBus_Dev:
2872 + pass
2873 +
2874 +@@ -66,12 +68,13 @@ for f in os.listdir(vmbus_sys_path):
2875 +
2876 + chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping')
2877 + chn_vp_mapping = [c.strip() for c in chn_vp_mapping]
2878 +- chn_vp_mapping = sorted(chn_vp_mapping,
2879 +- key = lambda c : int(c.split(':')[0]))
2880 ++ chn_vp_mapping = sorted(
2881 ++ chn_vp_mapping, key=lambda c: int(c.split(':')[0]))
2882 +
2883 +- chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' %
2884 +- (c.split(':')[0], c.split(':')[1])
2885 +- for c in chn_vp_mapping]
2886 ++ chn_vp_mapping = [
2887 ++ '\tRel_ID=%s, target_cpu=%s' %
2888 ++ (c.split(':')[0], c.split(':')[1]) for c in chn_vp_mapping
2889 ++ ]
2890 + d = VMBus_Dev()
2891 + d.sysfs_path = '%s/%s' % (vmbus_sys_path, f)
2892 + d.vmbus_id = vmbus_id
2893 +@@ -85,7 +88,7 @@ for f in os.listdir(vmbus_sys_path):
2894 + vmbus_dev_list.append(d)
2895 +
2896 +
2897 +-vmbus_dev_list = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id))
2898 ++vmbus_dev_list = sorted(vmbus_dev_list, key=lambda d: int(d.vmbus_id))
2899 +
2900 + format0 = '%2s: %s'
2901 + format1 = '%2s: Class_ID = %s - %s\n%s'
2902 +@@ -95,9 +98,15 @@ for d in vmbus_dev_list:
2903 + if verbose == 0:
2904 + print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
2905 + elif verbose == 1:
2906 +- print (('VMBUS ID ' + format1) % \
2907 +- (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
2908 ++ print(
2909 ++ ('VMBUS ID ' + format1) %
2910 ++ (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
2911 ++ )
2912 + else:
2913 +- print (('VMBUS ID ' + format2) % \
2914 +- (d.vmbus_id, d.class_id, d.dev_desc, \
2915 +- d.device_id, d.sysfs_path, d.chn_vp_mapping))
2916 ++ print(
2917 ++ ('VMBUS ID ' + format2) %
2918 ++ (
2919 ++ d.vmbus_id, d.class_id, d.dev_desc,
2920 ++ d.device_id, d.sysfs_path, d.chn_vp_mapping
2921 ++ )
2922 ++ )
2923 +diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
2924 +index ceeda7e04a4d..762f81900529 100644
2925 +--- a/virt/kvm/arm/vgic/vgic-mmio.c
2926 ++++ b/virt/kvm/arm/vgic/vgic-mmio.c
2927 +@@ -203,6 +203,12 @@ static void vgic_hw_irq_spending(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
2928 + vgic_irq_set_phys_active(irq, true);
2929 + }
2930 +
2931 ++static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq)
2932 ++{
2933 ++ return (vgic_irq_is_sgi(irq->intid) &&
2934 ++ vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2);
2935 ++}
2936 ++
2937 + void vgic_mmio_write_spending(struct kvm_vcpu *vcpu,
2938 + gpa_t addr, unsigned int len,
2939 + unsigned long val)
2940 +@@ -215,6 +221,12 @@ void vgic_mmio_write_spending(struct kvm_vcpu *vcpu,
2941 + for_each_set_bit(i, &val, len * 8) {
2942 + struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
2943 +
2944 ++ /* GICD_ISPENDR0 SGI bits are WI */
2945 ++ if (is_vgic_v2_sgi(vcpu, irq)) {
2946 ++ vgic_put_irq(vcpu->kvm, irq);
2947 ++ continue;
2948 ++ }
2949 ++
2950 + spin_lock_irqsave(&irq->irq_lock, flags);
2951 + if (irq->hw)
2952 + vgic_hw_irq_spending(vcpu, irq, is_uaccess);
2953 +@@ -262,6 +274,12 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu,
2954 + for_each_set_bit(i, &val, len * 8) {
2955 + struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
2956 +
2957 ++ /* GICD_ICPENDR0 SGI bits are WI */
2958 ++ if (is_vgic_v2_sgi(vcpu, irq)) {
2959 ++ vgic_put_irq(vcpu->kvm, irq);
2960 ++ continue;
2961 ++ }
2962 ++
2963 + spin_lock_irqsave(&irq->irq_lock, flags);
2964 +
2965 + if (irq->hw)
2966 +diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c
2967 +index 57281c1594d0..91b14dfacd1d 100644
2968 +--- a/virt/kvm/arm/vgic/vgic-v2.c
2969 ++++ b/virt/kvm/arm/vgic/vgic-v2.c
2970 +@@ -195,7 +195,10 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr)
2971 + if (vgic_irq_is_sgi(irq->intid)) {
2972 + u32 src = ffs(irq->source);
2973 +
2974 +- BUG_ON(!src);
2975 ++ if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n",
2976 ++ irq->intid))
2977 ++ return;
2978 ++
2979 + val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT;
2980 + irq->source &= ~(1 << (src - 1));
2981 + if (irq->source) {
2982 +diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
2983 +index 5c55995a1a16..8b958ed05306 100644
2984 +--- a/virt/kvm/arm/vgic/vgic-v3.c
2985 ++++ b/virt/kvm/arm/vgic/vgic-v3.c
2986 +@@ -179,7 +179,10 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr)
2987 + model == KVM_DEV_TYPE_ARM_VGIC_V2) {
2988 + u32 src = ffs(irq->source);
2989 +
2990 +- BUG_ON(!src);
2991 ++ if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n",
2992 ++ irq->intid))
2993 ++ return;
2994 ++
2995 + val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT;
2996 + irq->source &= ~(1 << (src - 1));
2997 + if (irq->source) {
2998 +diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
2999 +index 250cd72c95a5..4040a33cdc90 100644
3000 +--- a/virt/kvm/arm/vgic/vgic.c
3001 ++++ b/virt/kvm/arm/vgic/vgic.c
3002 +@@ -244,6 +244,13 @@ static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b)
3003 + bool penda, pendb;
3004 + int ret;
3005 +
3006 ++ /*
3007 ++ * list_sort may call this function with the same element when
3008 ++ * the list is fairly long.
3009 ++ */
3010 ++ if (unlikely(irqa == irqb))
3011 ++ return 0;
3012 ++
3013 + spin_lock(&irqa->irq_lock);
3014 + spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING);
3015 +
3016
3017 diff --git a/1070_linux-4.19.71.patch b/1070_linux-4.19.71.patch
3018 new file mode 100644
3019 index 0000000..3bb5f04
3020 --- /dev/null
3021 +++ b/1070_linux-4.19.71.patch
3022 @@ -0,0 +1,92 @@
3023 +diff --git a/Makefile b/Makefile
3024 +index ecf8806cb71f..f6c9d5757470 100644
3025 +--- a/Makefile
3026 ++++ b/Makefile
3027 +@@ -1,7 +1,7 @@
3028 + # SPDX-License-Identifier: GPL-2.0
3029 + VERSION = 4
3030 + PATCHLEVEL = 19
3031 +-SUBLEVEL = 70
3032 ++SUBLEVEL = 71
3033 + EXTRAVERSION =
3034 + NAME = "People's Front"
3035 +
3036 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
3037 +index eb9b9de47fd1..530142b5a115 100644
3038 +--- a/drivers/input/mouse/elantech.c
3039 ++++ b/drivers/input/mouse/elantech.c
3040 +@@ -1810,30 +1810,6 @@ static int elantech_create_smbus(struct psmouse *psmouse,
3041 + leave_breadcrumbs);
3042 + }
3043 +
3044 +-static bool elantech_use_host_notify(struct psmouse *psmouse,
3045 +- struct elantech_device_info *info)
3046 +-{
3047 +- if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
3048 +- return true;
3049 +-
3050 +- switch (info->bus) {
3051 +- case ETP_BUS_PS2_ONLY:
3052 +- /* expected case */
3053 +- break;
3054 +- case ETP_BUS_SMB_HST_NTFY_ONLY:
3055 +- case ETP_BUS_PS2_SMB_HST_NTFY:
3056 +- /* SMbus implementation is stable since 2018 */
3057 +- if (dmi_get_bios_year() >= 2018)
3058 +- return true;
3059 +- default:
3060 +- psmouse_dbg(psmouse,
3061 +- "Ignoring SMBus bus provider %d\n", info->bus);
3062 +- break;
3063 +- }
3064 +-
3065 +- return false;
3066 +-}
3067 +-
3068 + /**
3069 + * elantech_setup_smbus - called once the PS/2 devices are enumerated
3070 + * and decides to instantiate a SMBus InterTouch device.
3071 +@@ -1853,7 +1829,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
3072 + * i2c_blacklist_pnp_ids.
3073 + * Old ICs are up to the user to decide.
3074 + */
3075 +- if (!elantech_use_host_notify(psmouse, info) ||
3076 ++ if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) ||
3077 + psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids))
3078 + return -ENXIO;
3079 + }
3080 +@@ -1873,6 +1849,34 @@ static int elantech_setup_smbus(struct psmouse *psmouse,
3081 + return 0;
3082 + }
3083 +
3084 ++static bool elantech_use_host_notify(struct psmouse *psmouse,
3085 ++ struct elantech_device_info *info)
3086 ++{
3087 ++ if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
3088 ++ return true;
3089 ++
3090 ++ switch (info->bus) {
3091 ++ case ETP_BUS_PS2_ONLY:
3092 ++ /* expected case */
3093 ++ break;
3094 ++ case ETP_BUS_SMB_ALERT_ONLY:
3095 ++ /* fall-through */
3096 ++ case ETP_BUS_PS2_SMB_ALERT:
3097 ++ psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n");
3098 ++ break;
3099 ++ case ETP_BUS_SMB_HST_NTFY_ONLY:
3100 ++ /* fall-through */
3101 ++ case ETP_BUS_PS2_SMB_HST_NTFY:
3102 ++ return true;
3103 ++ default:
3104 ++ psmouse_dbg(psmouse,
3105 ++ "Ignoring SMBus bus provider %d.\n",
3106 ++ info->bus);
3107 ++ }
3108 ++
3109 ++ return false;
3110 ++}
3111 ++
3112 + int elantech_init_smbus(struct psmouse *psmouse)
3113 + {
3114 + struct elantech_device_info info;