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: Wed, 27 May 2020 16:25:07
Message-Id: 1590596687.1169eada98fc086c3d9e56cfa8212f7ee5f73dc7.mpagano@gentoo
1 commit: 1169eada98fc086c3d9e56cfa8212f7ee5f73dc7
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 27 16:24:47 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed May 27 16:24:47 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1169eada
7
8 Linux patch 4.19.125
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1124_linux-4.19.125.patch | 2436 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2440 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 63f9a11..a36c8a4 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -535,6 +535,10 @@ Patch: 1123_linux-4.19.124.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.124
23
24 +Patch: 1124_linux-4.19.125.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.125
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1124_linux-4.19.125.patch b/1124_linux-4.19.125.patch
33 new file mode 100644
34 index 0000000..d340902
35 --- /dev/null
36 +++ b/1124_linux-4.19.125.patch
37 @@ -0,0 +1,2436 @@
38 +diff --git a/Makefile b/Makefile
39 +index 292c92c8369d..93c63bda7115 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 124
47 ++SUBLEVEL = 125
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
52 +index ffebe7b7a5b7..91ca80035fc4 100644
53 +--- a/arch/arm/include/asm/futex.h
54 ++++ b/arch/arm/include/asm/futex.h
55 +@@ -163,8 +163,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
56 + preempt_enable();
57 + #endif
58 +
59 +- if (!ret)
60 +- *oval = oldval;
61 ++ /*
62 ++ * Store unconditionally. If ret != 0 the extra store is the least
63 ++ * of the worries but GCC cannot figure out that __futex_atomic_op()
64 ++ * is either setting ret to -EFAULT or storing the old value in
65 ++ * oldval which results in a uninitialized warning at the call site.
66 ++ */
67 ++ *oval = oldval;
68 +
69 + return ret;
70 + }
71 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
72 +index 6f475dc5829b..f38d153d2586 100644
73 +--- a/arch/powerpc/Kconfig
74 ++++ b/arch/powerpc/Kconfig
75 +@@ -139,7 +139,7 @@ config PPC
76 + select ARCH_HAS_MEMBARRIER_CALLBACKS
77 + select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE
78 + select ARCH_HAS_SG_CHAIN
79 +- select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION)
80 ++ select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION)
81 + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
82 + select ARCH_HAS_UACCESS_FLUSHCACHE if PPC64
83 + select ARCH_HAS_UBSAN_SANITIZE_ALL
84 +diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
85 +index 9713d4e8c22b..6558617bd2ce 100644
86 +--- a/arch/riscv/kernel/setup.c
87 ++++ b/arch/riscv/kernel/setup.c
88 +@@ -19,6 +19,7 @@
89 + * to the Free Software Foundation, Inc.,
90 + */
91 +
92 ++#include <linux/bootmem.h>
93 + #include <linux/init.h>
94 + #include <linux/mm.h>
95 + #include <linux/memblock.h>
96 +@@ -187,6 +188,7 @@ static void __init setup_bootmem(void)
97 +
98 + set_max_mapnr(PFN_DOWN(mem_size));
99 + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
100 ++ max_pfn = max_low_pfn;
101 +
102 + #ifdef CONFIG_BLK_DEV_INITRD
103 + setup_initrd();
104 +diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
105 +index 1ca76ca944ba..53dc8492f02f 100644
106 +--- a/arch/x86/kernel/apic/apic.c
107 ++++ b/arch/x86/kernel/apic/apic.c
108 +@@ -345,8 +345,6 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
109 + * According to Intel, MFENCE can do the serialization here.
110 + */
111 + asm volatile("mfence" : : : "memory");
112 +-
113 +- printk_once(KERN_DEBUG "TSC deadline timer enabled\n");
114 + return;
115 + }
116 +
117 +@@ -545,7 +543,7 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
118 + #define DEADLINE_MODEL_MATCH_REV(model, rev) \
119 + { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)rev }
120 +
121 +-static u32 hsx_deadline_rev(void)
122 ++static __init u32 hsx_deadline_rev(void)
123 + {
124 + switch (boot_cpu_data.x86_stepping) {
125 + case 0x02: return 0x3a; /* EP */
126 +@@ -555,7 +553,7 @@ static u32 hsx_deadline_rev(void)
127 + return ~0U;
128 + }
129 +
130 +-static u32 bdx_deadline_rev(void)
131 ++static __init u32 bdx_deadline_rev(void)
132 + {
133 + switch (boot_cpu_data.x86_stepping) {
134 + case 0x02: return 0x00000011;
135 +@@ -567,7 +565,7 @@ static u32 bdx_deadline_rev(void)
136 + return ~0U;
137 + }
138 +
139 +-static u32 skx_deadline_rev(void)
140 ++static __init u32 skx_deadline_rev(void)
141 + {
142 + switch (boot_cpu_data.x86_stepping) {
143 + case 0x03: return 0x01000136;
144 +@@ -580,7 +578,7 @@ static u32 skx_deadline_rev(void)
145 + return ~0U;
146 + }
147 +
148 +-static const struct x86_cpu_id deadline_match[] = {
149 ++static const struct x86_cpu_id deadline_match[] __initconst = {
150 + DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_HASWELL_X, hsx_deadline_rev),
151 + DEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_BROADWELL_X, 0x0b000020),
152 + DEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_BROADWELL_XEON_D, bdx_deadline_rev),
153 +@@ -602,18 +600,19 @@ static const struct x86_cpu_id deadline_match[] = {
154 + {},
155 + };
156 +
157 +-static void apic_check_deadline_errata(void)
158 ++static __init bool apic_validate_deadline_timer(void)
159 + {
160 + const struct x86_cpu_id *m;
161 + u32 rev;
162 +
163 +- if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER) ||
164 +- boot_cpu_has(X86_FEATURE_HYPERVISOR))
165 +- return;
166 ++ if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))
167 ++ return false;
168 ++ if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
169 ++ return true;
170 +
171 + m = x86_match_cpu(deadline_match);
172 + if (!m)
173 +- return;
174 ++ return true;
175 +
176 + /*
177 + * Function pointers will have the MSB set due to address layout,
178 +@@ -625,11 +624,12 @@ static void apic_check_deadline_errata(void)
179 + rev = (u32)m->driver_data;
180 +
181 + if (boot_cpu_data.microcode >= rev)
182 +- return;
183 ++ return true;
184 +
185 + setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
186 + pr_err(FW_BUG "TSC_DEADLINE disabled due to Errata; "
187 + "please update microcode to version: 0x%x (or later)\n", rev);
188 ++ return false;
189 + }
190 +
191 + /*
192 +@@ -2023,7 +2023,8 @@ void __init init_apic_mappings(void)
193 + {
194 + unsigned int new_apicid;
195 +
196 +- apic_check_deadline_errata();
197 ++ if (apic_validate_deadline_timer())
198 ++ pr_debug("TSC deadline timer available\n");
199 +
200 + if (x2apic_mode) {
201 + boot_cpu_physical_apicid = read_apic_id();
202 +diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
203 +index b48e2686440b..2701b370e58f 100644
204 +--- a/arch/x86/kernel/unwind_orc.c
205 ++++ b/arch/x86/kernel/unwind_orc.c
206 +@@ -300,12 +300,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address);
207 +
208 + unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
209 + {
210 ++ struct task_struct *task = state->task;
211 ++
212 + if (unwind_done(state))
213 + return NULL;
214 +
215 + if (state->regs)
216 + return &state->regs->ip;
217 +
218 ++ if (task != current && state->sp == task->thread.sp) {
219 ++ struct inactive_task_frame *frame = (void *)task->thread.sp;
220 ++ return &frame->ret_addr;
221 ++ }
222 ++
223 + if (state->sp)
224 + return (unsigned long *)state->sp - 1;
225 +
226 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
227 +index df2274414640..226db3dc490b 100644
228 +--- a/arch/x86/kvm/svm.c
229 ++++ b/arch/x86/kvm/svm.c
230 +@@ -998,33 +998,32 @@ static void svm_cpu_uninit(int cpu)
231 + static int svm_cpu_init(int cpu)
232 + {
233 + struct svm_cpu_data *sd;
234 +- int r;
235 +
236 + sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL);
237 + if (!sd)
238 + return -ENOMEM;
239 + sd->cpu = cpu;
240 +- r = -ENOMEM;
241 + sd->save_area = alloc_page(GFP_KERNEL);
242 + if (!sd->save_area)
243 +- goto err_1;
244 ++ goto free_cpu_data;
245 +
246 + if (svm_sev_enabled()) {
247 +- r = -ENOMEM;
248 + sd->sev_vmcbs = kmalloc_array(max_sev_asid + 1,
249 + sizeof(void *),
250 + GFP_KERNEL);
251 + if (!sd->sev_vmcbs)
252 +- goto err_1;
253 ++ goto free_save_area;
254 + }
255 +
256 + per_cpu(svm_data, cpu) = sd;
257 +
258 + return 0;
259 +
260 +-err_1:
261 ++free_save_area:
262 ++ __free_page(sd->save_area);
263 ++free_cpu_data:
264 + kfree(sd);
265 +- return r;
266 ++ return -ENOMEM;
267 +
268 + }
269 +
270 +diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
271 +index 8340c81b258b..dd4c7289610e 100644
272 +--- a/drivers/acpi/nfit/core.c
273 ++++ b/drivers/acpi/nfit/core.c
274 +@@ -1773,9 +1773,17 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
275 + dev_set_drvdata(&adev_dimm->dev, nfit_mem);
276 +
277 + /*
278 +- * Until standardization materializes we need to consider 4
279 +- * different command sets. Note, that checking for function0 (bit0)
280 +- * tells us if any commands are reachable through this GUID.
281 ++ * There are 4 "legacy" NVDIMM command sets
282 ++ * (NVDIMM_FAMILY_{INTEL,MSFT,HPE1,HPE2}) that were created before
283 ++ * an EFI working group was established to constrain this
284 ++ * proliferation. The nfit driver probes for the supported command
285 ++ * set by GUID. Note, if you're a platform developer looking to add
286 ++ * a new command set to this probe, consider using an existing set,
287 ++ * or otherwise seek approval to publish the command set at
288 ++ * http://www.uefi.org/RFIC_LIST.
289 ++ *
290 ++ * Note, that checking for function0 (bit0) tells us if any commands
291 ++ * are reachable through this GUID.
292 + */
293 + for (i = 0; i <= NVDIMM_FAMILY_MAX; i++)
294 + if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 1))
295 +@@ -1798,6 +1806,8 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
296 + dsm_mask &= ~(1 << 8);
297 + } else if (nfit_mem->family == NVDIMM_FAMILY_MSFT) {
298 + dsm_mask = 0xffffffff;
299 ++ } else if (nfit_mem->family == NVDIMM_FAMILY_HYPERV) {
300 ++ dsm_mask = 0x1f;
301 + } else {
302 + dev_dbg(dev, "unknown dimm command family\n");
303 + nfit_mem->family = -1;
304 +@@ -3622,6 +3632,7 @@ static __init int nfit_init(void)
305 + guid_parse(UUID_NFIT_DIMM_N_HPE1, &nfit_uuid[NFIT_DEV_DIMM_N_HPE1]);
306 + guid_parse(UUID_NFIT_DIMM_N_HPE2, &nfit_uuid[NFIT_DEV_DIMM_N_HPE2]);
307 + guid_parse(UUID_NFIT_DIMM_N_MSFT, &nfit_uuid[NFIT_DEV_DIMM_N_MSFT]);
308 ++ guid_parse(UUID_NFIT_DIMM_N_HYPERV, &nfit_uuid[NFIT_DEV_DIMM_N_HYPERV]);
309 +
310 + nfit_wq = create_singlethread_workqueue("nfit");
311 + if (!nfit_wq)
312 +diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
313 +index 68848fc4b7c9..cc2ec62951de 100644
314 +--- a/drivers/acpi/nfit/nfit.h
315 ++++ b/drivers/acpi/nfit/nfit.h
316 +@@ -34,11 +34,14 @@
317 + /* https://msdn.microsoft.com/library/windows/hardware/mt604741 */
318 + #define UUID_NFIT_DIMM_N_MSFT "1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"
319 +
320 ++/* http://www.uefi.org/RFIC_LIST (see "Virtual NVDIMM 0x1901") */
321 ++#define UUID_NFIT_DIMM_N_HYPERV "5746c5f2-a9a2-4264-ad0e-e4ddc9e09e80"
322 ++
323 + #define ACPI_NFIT_MEM_FAILED_MASK (ACPI_NFIT_MEM_SAVE_FAILED \
324 + | ACPI_NFIT_MEM_RESTORE_FAILED | ACPI_NFIT_MEM_FLUSH_FAILED \
325 + | ACPI_NFIT_MEM_NOT_ARMED | ACPI_NFIT_MEM_MAP_FAILED)
326 +
327 +-#define NVDIMM_FAMILY_MAX NVDIMM_FAMILY_MSFT
328 ++#define NVDIMM_FAMILY_MAX NVDIMM_FAMILY_HYPERV
329 +
330 + #define NVDIMM_STANDARD_CMDMASK \
331 + (1 << ND_CMD_SMART | 1 << ND_CMD_SMART_THRESHOLD | 1 << ND_CMD_DIMM_FLAGS \
332 +@@ -75,6 +78,7 @@ enum nfit_uuids {
333 + NFIT_DEV_DIMM_N_HPE1 = NVDIMM_FAMILY_HPE1,
334 + NFIT_DEV_DIMM_N_HPE2 = NVDIMM_FAMILY_HPE2,
335 + NFIT_DEV_DIMM_N_MSFT = NVDIMM_FAMILY_MSFT,
336 ++ NFIT_DEV_DIMM_N_HYPERV = NVDIMM_FAMILY_HYPERV,
337 + NFIT_SPA_VOLATILE,
338 + NFIT_SPA_PM,
339 + NFIT_SPA_DCR,
340 +diff --git a/drivers/base/component.c b/drivers/base/component.c
341 +index 7f7c4233cd31..ee4d3b388f44 100644
342 +--- a/drivers/base/component.c
343 ++++ b/drivers/base/component.c
344 +@@ -235,7 +235,8 @@ static int try_to_bring_up_master(struct master *master,
345 + ret = master->ops->bind(master->dev);
346 + if (ret < 0) {
347 + devres_release_group(master->dev, NULL);
348 +- dev_info(master->dev, "master bind failed: %d\n", ret);
349 ++ if (ret != -EPROBE_DEFER)
350 ++ dev_info(master->dev, "master bind failed: %d\n", ret);
351 + return ret;
352 + }
353 +
354 +@@ -506,8 +507,9 @@ static int component_bind(struct component *component, struct master *master,
355 + devres_release_group(component->dev, NULL);
356 + devres_release_group(master->dev, NULL);
357 +
358 +- dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
359 +- dev_name(component->dev), component->ops, ret);
360 ++ if (ret != -EPROBE_DEFER)
361 ++ dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
362 ++ dev_name(component->dev), component->ops, ret);
363 + }
364 +
365 + return ret;
366 +diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
367 +index 7812a6338acd..7ff04bf04b31 100644
368 +--- a/drivers/dma/owl-dma.c
369 ++++ b/drivers/dma/owl-dma.c
370 +@@ -172,13 +172,11 @@ struct owl_dma_txd {
371 + * @id: physical index to this channel
372 + * @base: virtual memory base for the dma channel
373 + * @vchan: the virtual channel currently being served by this physical channel
374 +- * @lock: a lock to use when altering an instance of this struct
375 + */
376 + struct owl_dma_pchan {
377 + u32 id;
378 + void __iomem *base;
379 + struct owl_dma_vchan *vchan;
380 +- spinlock_t lock;
381 + };
382 +
383 + /**
384 +@@ -396,14 +394,14 @@ static struct owl_dma_pchan *owl_dma_get_pchan(struct owl_dma *od,
385 + for (i = 0; i < od->nr_pchans; i++) {
386 + pchan = &od->pchans[i];
387 +
388 +- spin_lock_irqsave(&pchan->lock, flags);
389 ++ spin_lock_irqsave(&od->lock, flags);
390 + if (!pchan->vchan) {
391 + pchan->vchan = vchan;
392 +- spin_unlock_irqrestore(&pchan->lock, flags);
393 ++ spin_unlock_irqrestore(&od->lock, flags);
394 + break;
395 + }
396 +
397 +- spin_unlock_irqrestore(&pchan->lock, flags);
398 ++ spin_unlock_irqrestore(&od->lock, flags);
399 + }
400 +
401 + return pchan;
402 +diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
403 +index 4f4733d831a1..045351f3549c 100644
404 +--- a/drivers/dma/tegra210-adma.c
405 ++++ b/drivers/dma/tegra210-adma.c
406 +@@ -793,7 +793,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
407 + ret = dma_async_device_register(&tdma->dma_dev);
408 + if (ret < 0) {
409 + dev_err(&pdev->dev, "ADMA registration failed: %d\n", ret);
410 +- goto irq_dispose;
411 ++ goto rpm_put;
412 + }
413 +
414 + ret = of_dma_controller_register(pdev->dev.of_node,
415 +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
416 +index 3ce77cbad4ae..b3464d2dc2b4 100644
417 +--- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
418 ++++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
419 +@@ -453,7 +453,7 @@ static const struct etnaviv_pm_domain *pm_domain(const struct etnaviv_gpu *gpu,
420 + if (!(gpu->identity.features & meta->feature))
421 + continue;
422 +
423 +- if (meta->nr_domains < (index - offset)) {
424 ++ if (index - offset >= meta->nr_domains) {
425 + offset += meta->nr_domains;
426 + continue;
427 + }
428 +diff --git a/drivers/gpu/drm/i915/gvt/display.c b/drivers/gpu/drm/i915/gvt/display.c
429 +index 3019dbc39aef..83f30d7b6abe 100644
430 +--- a/drivers/gpu/drm/i915/gvt/display.c
431 ++++ b/drivers/gpu/drm/i915/gvt/display.c
432 +@@ -206,14 +206,41 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
433 + SKL_FUSE_PG_DIST_STATUS(SKL_PG0) |
434 + SKL_FUSE_PG_DIST_STATUS(SKL_PG1) |
435 + SKL_FUSE_PG_DIST_STATUS(SKL_PG2);
436 +- vgpu_vreg_t(vgpu, LCPLL1_CTL) |=
437 +- LCPLL_PLL_ENABLE |
438 +- LCPLL_PLL_LOCK;
439 +- vgpu_vreg_t(vgpu, LCPLL2_CTL) |= LCPLL_PLL_ENABLE;
440 +-
441 ++ /*
442 ++ * Only 1 PIPE enabled in current vGPU display and PIPE_A is
443 ++ * tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A,
444 ++ * TRANSCODER_A can be enabled. PORT_x depends on the input of
445 ++ * setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x
446 ++ * so we fixed to DPLL0 here.
447 ++ * Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode
448 ++ */
449 ++ vgpu_vreg_t(vgpu, DPLL_CTRL1) =
450 ++ DPLL_CTRL1_OVERRIDE(DPLL_ID_SKL_DPLL0);
451 ++ vgpu_vreg_t(vgpu, DPLL_CTRL1) |=
452 ++ DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, DPLL_ID_SKL_DPLL0);
453 ++ vgpu_vreg_t(vgpu, LCPLL1_CTL) =
454 ++ LCPLL_PLL_ENABLE | LCPLL_PLL_LOCK;
455 ++ vgpu_vreg_t(vgpu, DPLL_STATUS) = DPLL_LOCK(DPLL_ID_SKL_DPLL0);
456 ++ /*
457 ++ * Golden M/N are calculated based on:
458 ++ * 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID),
459 ++ * DP link clk 1620 MHz and non-constant_n.
460 ++ * TODO: calculate DP link symbol clk and stream clk m/n.
461 ++ */
462 ++ vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) = 63 << TU_SIZE_SHIFT;
463 ++ vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) |= 0x5b425e;
464 ++ vgpu_vreg_t(vgpu, PIPE_DATA_N1(TRANSCODER_A)) = 0x800000;
465 ++ vgpu_vreg_t(vgpu, PIPE_LINK_M1(TRANSCODER_A)) = 0x3cd6e;
466 ++ vgpu_vreg_t(vgpu, PIPE_LINK_N1(TRANSCODER_A)) = 0x80000;
467 + }
468 +
469 + if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) {
470 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
471 ++ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_B);
472 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
473 ++ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_B);
474 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
475 ++ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_B);
476 + vgpu_vreg_t(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED;
477 + vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
478 + ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
479 +@@ -234,6 +261,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
480 + }
481 +
482 + if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) {
483 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
484 ++ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_C);
485 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
486 ++ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_C);
487 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
488 ++ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_C);
489 + vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT;
490 + vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
491 + ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
492 +@@ -254,6 +287,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
493 + }
494 +
495 + if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) {
496 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
497 ++ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_D);
498 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
499 ++ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_D);
500 ++ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
501 ++ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_D);
502 + vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT;
503 + vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
504 + ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
505 +diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
506 +index 895f49b565ee..3489f0af7409 100644
507 +--- a/drivers/hid/hid-alps.c
508 ++++ b/drivers/hid/hid-alps.c
509 +@@ -806,6 +806,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)
510 + break;
511 + case HID_DEVICE_ID_ALPS_U1_DUAL:
512 + case HID_DEVICE_ID_ALPS_U1:
513 ++ case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY:
514 + data->dev_type = U1;
515 + break;
516 + default:
517 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
518 +index b2fff44c8109..c1fed1aaecdf 100644
519 +--- a/drivers/hid/hid-ids.h
520 ++++ b/drivers/hid/hid-ids.h
521 +@@ -81,10 +81,10 @@
522 + #define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F
523 + #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220
524 + #define HID_DEVICE_ID_ALPS_U1 0x1215
525 ++#define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E
526 + #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C
527 + #define HID_DEVICE_ID_ALPS_1222 0x1222
528 +
529 +-
530 + #define USB_VENDOR_ID_AMI 0x046b
531 + #define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
532 +
533 +@@ -378,6 +378,7 @@
534 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349
535 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
536 + #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
537 ++#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002
538 +
539 + #define USB_VENDOR_ID_ELAN 0x04f3
540 + #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
541 +@@ -1063,6 +1064,9 @@
542 + #define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300
543 + #define USB_DEVICE_ID_SYMBOL_SCANNER_3 0x1200
544 +
545 ++#define I2C_VENDOR_ID_SYNAPTICS 0x06cb
546 ++#define I2C_PRODUCT_ID_SYNAPTICS_SYNA2393 0x7a13
547 ++
548 + #define USB_VENDOR_ID_SYNAPTICS 0x06cb
549 + #define USB_DEVICE_ID_SYNAPTICS_TP 0x0001
550 + #define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002
551 +@@ -1077,6 +1081,7 @@
552 + #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
553 + #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
554 + #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
555 ++#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
556 + #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
557 + #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
558 +
559 +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
560 +index 19dfd8acd0da..8baf10beb1d5 100644
561 +--- a/drivers/hid/hid-multitouch.c
562 ++++ b/drivers/hid/hid-multitouch.c
563 +@@ -1909,6 +1909,9 @@ static const struct hid_device_id mt_devices[] = {
564 + { .driver_data = MT_CLS_EGALAX_SERIAL,
565 + MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
566 + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
567 ++ { .driver_data = MT_CLS_EGALAX,
568 ++ MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
569 ++ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) },
570 +
571 + /* Elitegroup panel */
572 + { .driver_data = MT_CLS_SERIAL,
573 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
574 +index b9529bed4d76..e5beee3e8582 100644
575 +--- a/drivers/hid/hid-quirks.c
576 ++++ b/drivers/hid/hid-quirks.c
577 +@@ -163,6 +163,7 @@ static const struct hid_device_id hid_quirks[] = {
578 + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2), HID_QUIRK_NO_INIT_REPORTS },
579 + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS },
580 + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS },
581 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS },
582 + { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD },
583 + { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT },
584 + { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET },
585 +diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
586 +index f2c8c59fc582..f17ebbe53abf 100644
587 +--- a/drivers/hid/i2c-hid/i2c-hid-core.c
588 ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c
589 +@@ -187,6 +187,8 @@ static const struct i2c_hid_quirks {
590 + I2C_HID_QUIRK_BOGUS_IRQ },
591 + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
592 + I2C_HID_QUIRK_RESET_ON_RESUME },
593 ++ { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393,
594 ++ I2C_HID_QUIRK_RESET_ON_RESUME },
595 + { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
596 + I2C_HID_QUIRK_BAD_INPUT_SIZE },
597 + { 0, 0 }
598 +diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
599 +index cb07651f4b46..cbda91a0cb5f 100644
600 +--- a/drivers/i2c/i2c-dev.c
601 ++++ b/drivers/i2c/i2c-dev.c
602 +@@ -48,7 +48,7 @@
603 + struct i2c_dev {
604 + struct list_head list;
605 + struct i2c_adapter *adap;
606 +- struct device *dev;
607 ++ struct device dev;
608 + struct cdev cdev;
609 + };
610 +
611 +@@ -92,12 +92,14 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap)
612 + return i2c_dev;
613 + }
614 +
615 +-static void put_i2c_dev(struct i2c_dev *i2c_dev)
616 ++static void put_i2c_dev(struct i2c_dev *i2c_dev, bool del_cdev)
617 + {
618 + spin_lock(&i2c_dev_list_lock);
619 + list_del(&i2c_dev->list);
620 + spin_unlock(&i2c_dev_list_lock);
621 +- kfree(i2c_dev);
622 ++ if (del_cdev)
623 ++ cdev_device_del(&i2c_dev->cdev, &i2c_dev->dev);
624 ++ put_device(&i2c_dev->dev);
625 + }
626 +
627 + static ssize_t name_show(struct device *dev,
628 +@@ -636,6 +638,14 @@ static const struct file_operations i2cdev_fops = {
629 +
630 + static struct class *i2c_dev_class;
631 +
632 ++static void i2cdev_dev_release(struct device *dev)
633 ++{
634 ++ struct i2c_dev *i2c_dev;
635 ++
636 ++ i2c_dev = container_of(dev, struct i2c_dev, dev);
637 ++ kfree(i2c_dev);
638 ++}
639 ++
640 + static int i2cdev_attach_adapter(struct device *dev, void *dummy)
641 + {
642 + struct i2c_adapter *adap;
643 +@@ -652,27 +662,23 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
644 +
645 + cdev_init(&i2c_dev->cdev, &i2cdev_fops);
646 + i2c_dev->cdev.owner = THIS_MODULE;
647 +- res = cdev_add(&i2c_dev->cdev, MKDEV(I2C_MAJOR, adap->nr), 1);
648 +- if (res)
649 +- goto error_cdev;
650 +-
651 +- /* register this i2c device with the driver core */
652 +- i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
653 +- MKDEV(I2C_MAJOR, adap->nr), NULL,
654 +- "i2c-%d", adap->nr);
655 +- if (IS_ERR(i2c_dev->dev)) {
656 +- res = PTR_ERR(i2c_dev->dev);
657 +- goto error;
658 ++
659 ++ device_initialize(&i2c_dev->dev);
660 ++ i2c_dev->dev.devt = MKDEV(I2C_MAJOR, adap->nr);
661 ++ i2c_dev->dev.class = i2c_dev_class;
662 ++ i2c_dev->dev.parent = &adap->dev;
663 ++ i2c_dev->dev.release = i2cdev_dev_release;
664 ++ dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr);
665 ++
666 ++ res = cdev_device_add(&i2c_dev->cdev, &i2c_dev->dev);
667 ++ if (res) {
668 ++ put_i2c_dev(i2c_dev, false);
669 ++ return res;
670 + }
671 +
672 + pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
673 + adap->name, adap->nr);
674 + return 0;
675 +-error:
676 +- cdev_del(&i2c_dev->cdev);
677 +-error_cdev:
678 +- put_i2c_dev(i2c_dev);
679 +- return res;
680 + }
681 +
682 + static int i2cdev_detach_adapter(struct device *dev, void *dummy)
683 +@@ -688,9 +694,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy)
684 + if (!i2c_dev) /* attach_adapter must have failed */
685 + return 0;
686 +
687 +- cdev_del(&i2c_dev->cdev);
688 +- put_i2c_dev(i2c_dev);
689 +- device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
690 ++ put_i2c_dev(i2c_dev, true);
691 +
692 + pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name);
693 + return 0;
694 +diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
695 +index 035032e20327..9ba9ce5696e1 100644
696 +--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
697 ++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
698 +@@ -273,6 +273,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
699 + err_rollback_available:
700 + device_remove_file(&pdev->dev, &dev_attr_available_masters);
701 + err_rollback:
702 ++ i2c_demux_deactivate_master(priv);
703 + for (j = 0; j < i; j++) {
704 + of_node_put(priv->chan[j].parent_np);
705 + of_changeset_destroy(&priv->chan[j].chgset);
706 +diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
707 +index 4964561595f5..7218acf1a907 100644
708 +--- a/drivers/iio/accel/sca3000.c
709 ++++ b/drivers/iio/accel/sca3000.c
710 +@@ -982,7 +982,7 @@ static int sca3000_read_data(struct sca3000_state *st,
711 + st->tx[0] = SCA3000_READ_REG(reg_address_high);
712 + ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
713 + if (ret) {
714 +- dev_err(get_device(&st->us->dev), "problem reading register");
715 ++ dev_err(&st->us->dev, "problem reading register\n");
716 + return ret;
717 + }
718 +
719 +diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
720 +index 24d5d049567a..59fd8b620c50 100644
721 +--- a/drivers/iio/adc/stm32-adc.c
722 ++++ b/drivers/iio/adc/stm32-adc.c
723 +@@ -1682,15 +1682,27 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
724 + return 0;
725 + }
726 +
727 +-static int stm32_adc_dma_request(struct iio_dev *indio_dev)
728 ++static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
729 + {
730 + struct stm32_adc *adc = iio_priv(indio_dev);
731 + struct dma_slave_config config;
732 + int ret;
733 +
734 +- adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx");
735 +- if (!adc->dma_chan)
736 ++ adc->dma_chan = dma_request_chan(dev, "rx");
737 ++ if (IS_ERR(adc->dma_chan)) {
738 ++ ret = PTR_ERR(adc->dma_chan);
739 ++ if (ret != -ENODEV) {
740 ++ if (ret != -EPROBE_DEFER)
741 ++ dev_err(dev,
742 ++ "DMA channel request failed with %d\n",
743 ++ ret);
744 ++ return ret;
745 ++ }
746 ++
747 ++ /* DMA is optional: fall back to IRQ mode */
748 ++ adc->dma_chan = NULL;
749 + return 0;
750 ++ }
751 +
752 + adc->rx_buf = dma_alloc_coherent(adc->dma_chan->device->dev,
753 + STM32_DMA_BUFFER_SIZE,
754 +@@ -1804,7 +1816,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
755 + if (ret < 0)
756 + goto err_clk_disable;
757 +
758 +- ret = stm32_adc_dma_request(indio_dev);
759 ++ ret = stm32_adc_dma_request(dev, indio_dev);
760 + if (ret < 0)
761 + goto err_clk_disable;
762 +
763 +diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
764 +index f5586dd6414d..1c492a7f4587 100644
765 +--- a/drivers/iio/adc/stm32-dfsdm-adc.c
766 ++++ b/drivers/iio/adc/stm32-dfsdm-adc.c
767 +@@ -45,7 +45,7 @@ enum sd_converter_type {
768 +
769 + struct stm32_dfsdm_dev_data {
770 + int type;
771 +- int (*init)(struct iio_dev *indio_dev);
772 ++ int (*init)(struct device *dev, struct iio_dev *indio_dev);
773 + unsigned int num_channels;
774 + const struct regmap_config *regmap_cfg;
775 + };
776 +@@ -923,7 +923,8 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev)
777 + }
778 + }
779 +
780 +-static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
781 ++static int stm32_dfsdm_dma_request(struct device *dev,
782 ++ struct iio_dev *indio_dev)
783 + {
784 + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
785 + struct dma_slave_config config = {
786 +@@ -933,9 +934,13 @@ static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
787 + };
788 + int ret;
789 +
790 +- adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx");
791 +- if (!adc->dma_chan)
792 +- return -EINVAL;
793 ++ adc->dma_chan = dma_request_chan(dev, "rx");
794 ++ if (IS_ERR(adc->dma_chan)) {
795 ++ int ret = PTR_ERR(adc->dma_chan);
796 ++
797 ++ adc->dma_chan = NULL;
798 ++ return ret;
799 ++ }
800 +
801 + adc->rx_buf = dma_alloc_coherent(adc->dma_chan->device->dev,
802 + DFSDM_DMA_BUFFER_SIZE,
803 +@@ -993,7 +998,7 @@ static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,
804 + &adc->dfsdm->ch_list[ch->channel]);
805 + }
806 +
807 +-static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
808 ++static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev)
809 + {
810 + struct iio_chan_spec *ch;
811 + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
812 +@@ -1023,10 +1028,10 @@ static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
813 + indio_dev->num_channels = 1;
814 + indio_dev->channels = ch;
815 +
816 +- return stm32_dfsdm_dma_request(indio_dev);
817 ++ return stm32_dfsdm_dma_request(dev, indio_dev);
818 + }
819 +
820 +-static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
821 ++static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
822 + {
823 + struct iio_chan_spec *ch;
824 + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
825 +@@ -1170,7 +1175,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
826 + adc->dfsdm->fl_list[adc->fl_id].sync_mode = val;
827 +
828 + adc->dev_data = dev_data;
829 +- ret = dev_data->init(iio);
830 ++ ret = dev_data->init(dev, iio);
831 + if (ret < 0)
832 + return ret;
833 +
834 +diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c
835 +index 5dccdd16cab3..9cf2e2933b66 100644
836 +--- a/drivers/iio/dac/vf610_dac.c
837 ++++ b/drivers/iio/dac/vf610_dac.c
838 +@@ -234,6 +234,7 @@ static int vf610_dac_probe(struct platform_device *pdev)
839 + return 0;
840 +
841 + error_iio_device_register:
842 ++ vf610_dac_exit(info);
843 + clk_disable_unprepare(info->clk);
844 +
845 + return ret;
846 +diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
847 +index 2557ed112bc2..c7d0bb3b4a30 100644
848 +--- a/drivers/iommu/amd_iommu_init.c
849 ++++ b/drivers/iommu/amd_iommu_init.c
850 +@@ -1334,8 +1334,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
851 + }
852 + case IVHD_DEV_ACPI_HID: {
853 + u16 devid;
854 +- u8 hid[ACPIHID_HID_LEN] = {0};
855 +- u8 uid[ACPIHID_UID_LEN] = {0};
856 ++ u8 hid[ACPIHID_HID_LEN];
857 ++ u8 uid[ACPIHID_UID_LEN];
858 + int ret;
859 +
860 + if (h->type != 0x40) {
861 +@@ -1352,6 +1352,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
862 + break;
863 + }
864 +
865 ++ uid[0] = '\0';
866 + switch (e->uidf) {
867 + case UID_NOT_PRESENT:
868 +
869 +@@ -1366,8 +1367,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
870 + break;
871 + case UID_IS_CHARACTER:
872 +
873 +- memcpy(uid, (u8 *)(&e->uid), ACPIHID_UID_LEN - 1);
874 +- uid[ACPIHID_UID_LEN - 1] = '\0';
875 ++ memcpy(uid, &e->uid, e->uidl);
876 ++ uid[e->uidl] = '\0';
877 +
878 + break;
879 + default:
880 +diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c
881 +index 8a9c169b6f99..b5eec18ad59a 100644
882 +--- a/drivers/ipack/carriers/tpci200.c
883 ++++ b/drivers/ipack/carriers/tpci200.c
884 +@@ -309,6 +309,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
885 + "(bn 0x%X, sn 0x%X) failed to map driver user space!",
886 + tpci200->info->pdev->bus->number,
887 + tpci200->info->pdev->devfn);
888 ++ res = -ENOMEM;
889 + goto out_release_mem8_space;
890 + }
891 +
892 +diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
893 +index 5a30f1d84fe1..2bd5898a6204 100644
894 +--- a/drivers/media/platform/rcar_fdp1.c
895 ++++ b/drivers/media/platform/rcar_fdp1.c
896 +@@ -2368,7 +2368,7 @@ static int fdp1_probe(struct platform_device *pdev)
897 + dprintk(fdp1, "FDP1 Version R-Car H3\n");
898 + break;
899 + case FD1_IP_M3N:
900 +- dprintk(fdp1, "FDP1 Version R-Car M3N\n");
901 ++ dprintk(fdp1, "FDP1 Version R-Car M3-N\n");
902 + break;
903 + case FD1_IP_E3:
904 + dprintk(fdp1, "FDP1 Version R-Car E3\n");
905 +diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
906 +index da445223f4cc..5c5d0241603a 100644
907 +--- a/drivers/misc/cardreader/rtsx_pcr.c
908 ++++ b/drivers/misc/cardreader/rtsx_pcr.c
909 +@@ -155,6 +155,9 @@ static void rtsx_comm_pm_full_on(struct rtsx_pcr *pcr)
910 +
911 + rtsx_disable_aspm(pcr);
912 +
913 ++ /* Fixes DMA transfer timout issue after disabling ASPM on RTS5260 */
914 ++ msleep(1);
915 ++
916 + if (option->ltr_enabled)
917 + rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
918 +
919 +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
920 +index ebdcf0b450e2..524b8c0d371b 100644
921 +--- a/drivers/misc/mei/client.c
922 ++++ b/drivers/misc/mei/client.c
923 +@@ -276,6 +276,7 @@ void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid)
924 + down_write(&dev->me_clients_rwsem);
925 + me_cl = __mei_me_cl_by_uuid(dev, uuid);
926 + __mei_me_cl_del(dev, me_cl);
927 ++ mei_me_cl_put(me_cl);
928 + up_write(&dev->me_clients_rwsem);
929 + }
930 +
931 +@@ -297,6 +298,7 @@ void mei_me_cl_rm_by_uuid_id(struct mei_device *dev, const uuid_le *uuid, u8 id)
932 + down_write(&dev->me_clients_rwsem);
933 + me_cl = __mei_me_cl_by_uuid_id(dev, uuid, id);
934 + __mei_me_cl_del(dev, me_cl);
935 ++ mei_me_cl_put(me_cl);
936 + up_write(&dev->me_clients_rwsem);
937 + }
938 +
939 +diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
940 +index a2f38b3b9776..1d61ae7aaa66 100644
941 +--- a/drivers/mtd/nand/spi/core.c
942 ++++ b/drivers/mtd/nand/spi/core.c
943 +@@ -1045,6 +1045,10 @@ static int spinand_init(struct spinand_device *spinand)
944 +
945 + mtd->oobavail = ret;
946 +
947 ++ /* Propagate ECC information to mtd_info */
948 ++ mtd->ecc_strength = nand->eccreq.strength;
949 ++ mtd->ecc_step_size = nand->eccreq.step_size;
950 ++
951 + return 0;
952 +
953 + err_cleanup_nanddev:
954 +diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
955 +index 7bc96294ae4d..b108e1f04bf6 100644
956 +--- a/drivers/mtd/ubi/debug.c
957 ++++ b/drivers/mtd/ubi/debug.c
958 +@@ -405,9 +405,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
959 + {
960 + struct ubi_device *ubi = s->private;
961 +
962 +- if (*pos == 0)
963 +- return SEQ_START_TOKEN;
964 +-
965 + if (*pos < ubi->peb_count)
966 + return pos;
967 +
968 +@@ -421,8 +418,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos)
969 + {
970 + struct ubi_device *ubi = s->private;
971 +
972 +- if (v == SEQ_START_TOKEN)
973 +- return pos;
974 + (*pos)++;
975 +
976 + if (*pos < ubi->peb_count)
977 +@@ -444,11 +439,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
978 + int err;
979 +
980 + /* If this is the start, print a header */
981 +- if (iter == SEQ_START_TOKEN) {
982 +- seq_puts(s,
983 +- "physical_block_number\terase_count\tblock_status\tread_status\n");
984 +- return 0;
985 +- }
986 ++ if (*block_number == 0)
987 ++ seq_puts(s, "physical_block_number\terase_count\n");
988 +
989 + err = ubi_io_is_bad(ubi, *block_number);
990 + if (err)
991 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
992 +index 750007513f9d..43dbfb228b0e 100644
993 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
994 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
995 +@@ -60,7 +60,7 @@ static const struct aq_board_revision_s hw_atl_boards[] = {
996 + { AQ_DEVICE_ID_D108, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc108, },
997 + { AQ_DEVICE_ID_D109, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc109, },
998 +
999 +- { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, },
1000 ++ { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc100, },
1001 + { AQ_DEVICE_ID_AQC107, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, },
1002 + { AQ_DEVICE_ID_AQC108, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc108, },
1003 + { AQ_DEVICE_ID_AQC109, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc109, },
1004 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1005 +index 89cc146d2c5c..047fc0cf0263 100644
1006 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1007 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1008 +@@ -3616,36 +3616,6 @@ static int bcmgenet_remove(struct platform_device *pdev)
1009 + }
1010 +
1011 + #ifdef CONFIG_PM_SLEEP
1012 +-static int bcmgenet_suspend(struct device *d)
1013 +-{
1014 +- struct net_device *dev = dev_get_drvdata(d);
1015 +- struct bcmgenet_priv *priv = netdev_priv(dev);
1016 +- int ret = 0;
1017 +-
1018 +- if (!netif_running(dev))
1019 +- return 0;
1020 +-
1021 +- netif_device_detach(dev);
1022 +-
1023 +- bcmgenet_netif_stop(dev);
1024 +-
1025 +- if (!device_may_wakeup(d))
1026 +- phy_suspend(dev->phydev);
1027 +-
1028 +- /* Prepare the device for Wake-on-LAN and switch to the slow clock */
1029 +- if (device_may_wakeup(d) && priv->wolopts) {
1030 +- ret = bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);
1031 +- clk_prepare_enable(priv->clk_wol);
1032 +- } else if (priv->internal_phy) {
1033 +- ret = bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
1034 +- }
1035 +-
1036 +- /* Turn off the clocks */
1037 +- clk_disable_unprepare(priv->clk);
1038 +-
1039 +- return ret;
1040 +-}
1041 +-
1042 + static int bcmgenet_resume(struct device *d)
1043 + {
1044 + struct net_device *dev = dev_get_drvdata(d);
1045 +@@ -3724,6 +3694,39 @@ out_clk_disable:
1046 + clk_disable_unprepare(priv->clk);
1047 + return ret;
1048 + }
1049 ++
1050 ++static int bcmgenet_suspend(struct device *d)
1051 ++{
1052 ++ struct net_device *dev = dev_get_drvdata(d);
1053 ++ struct bcmgenet_priv *priv = netdev_priv(dev);
1054 ++ int ret = 0;
1055 ++
1056 ++ if (!netif_running(dev))
1057 ++ return 0;
1058 ++
1059 ++ netif_device_detach(dev);
1060 ++
1061 ++ bcmgenet_netif_stop(dev);
1062 ++
1063 ++ if (!device_may_wakeup(d))
1064 ++ phy_suspend(dev->phydev);
1065 ++
1066 ++ /* Prepare the device for Wake-on-LAN and switch to the slow clock */
1067 ++ if (device_may_wakeup(d) && priv->wolopts) {
1068 ++ ret = bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);
1069 ++ clk_prepare_enable(priv->clk_wol);
1070 ++ } else if (priv->internal_phy) {
1071 ++ ret = bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
1072 ++ }
1073 ++
1074 ++ /* Turn off the clocks */
1075 ++ clk_disable_unprepare(priv->clk);
1076 ++
1077 ++ if (ret)
1078 ++ bcmgenet_resume(d);
1079 ++
1080 ++ return ret;
1081 ++}
1082 + #endif /* CONFIG_PM_SLEEP */
1083 +
1084 + static SIMPLE_DEV_PM_OPS(bcmgenet_pm_ops, bcmgenet_suspend, bcmgenet_resume);
1085 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
1086 +index 2fbd027f0148..b3596e0ee47b 100644
1087 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
1088 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
1089 +@@ -186,9 +186,15 @@ void bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv,
1090 + }
1091 +
1092 + reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL);
1093 ++ if (!(reg & MPD_EN))
1094 ++ return; /* already powered up so skip the rest */
1095 + reg &= ~MPD_EN;
1096 + bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL);
1097 +
1098 ++ reg = bcmgenet_hfb_reg_readl(priv, HFB_CTRL);
1099 ++ reg &= ~(RBUF_HFB_EN | RBUF_ACPI_EN);
1100 ++ bcmgenet_hfb_reg_writel(priv, reg, HFB_CTRL);
1101 ++
1102 + /* Disable CRC Forward */
1103 + reg = bcmgenet_umac_readl(priv, UMAC_CMD);
1104 + reg &= ~CMD_CRC_FWD;
1105 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
1106 +index c81d6c330548..9d1d77125826 100644
1107 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
1108 ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
1109 +@@ -2281,8 +2281,6 @@ static int cxgb_up(struct adapter *adap)
1110 + #if IS_ENABLED(CONFIG_IPV6)
1111 + update_clip(adap);
1112 + #endif
1113 +- /* Initialize hash mac addr list*/
1114 +- INIT_LIST_HEAD(&adap->mac_hlist);
1115 + return err;
1116 +
1117 + irq_err:
1118 +@@ -2304,6 +2302,7 @@ static void cxgb_down(struct adapter *adapter)
1119 +
1120 + t4_sge_stop(adapter);
1121 + t4_free_sge_resources(adapter);
1122 ++
1123 + adapter->flags &= ~FULL_INIT_DONE;
1124 + }
1125 +
1126 +@@ -5602,6 +5601,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1127 + (is_t5(adapter->params.chip) ? STATMODE_V(0) :
1128 + T6_STATMODE_V(0)));
1129 +
1130 ++ /* Initialize hash mac addr list */
1131 ++ INIT_LIST_HEAD(&adapter->mac_hlist);
1132 ++
1133 + for_each_port(adapter, i) {
1134 + netdev = alloc_etherdev_mq(sizeof(struct port_info),
1135 + MAX_ETH_QSETS);
1136 +@@ -5876,6 +5878,7 @@ fw_attach_fail:
1137 + static void remove_one(struct pci_dev *pdev)
1138 + {
1139 + struct adapter *adapter = pci_get_drvdata(pdev);
1140 ++ struct hash_mac_addr *entry, *tmp;
1141 +
1142 + if (!adapter) {
1143 + pci_release_regions(pdev);
1144 +@@ -5923,6 +5926,12 @@ static void remove_one(struct pci_dev *pdev)
1145 + if (adapter->num_uld || adapter->num_ofld_uld)
1146 + t4_uld_mem_free(adapter);
1147 + free_some_resources(adapter);
1148 ++ list_for_each_entry_safe(entry, tmp, &adapter->mac_hlist,
1149 ++ list) {
1150 ++ list_del(&entry->list);
1151 ++ kfree(entry);
1152 ++ }
1153 ++
1154 + #if IS_ENABLED(CONFIG_IPV6)
1155 + t4_cleanup_clip_tbl(adapter);
1156 + #endif
1157 +diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
1158 +index 972dc7bd721d..15029a5e62b9 100644
1159 +--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
1160 ++++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
1161 +@@ -723,9 +723,6 @@ static int adapter_up(struct adapter *adapter)
1162 + if (adapter->flags & USING_MSIX)
1163 + name_msix_vecs(adapter);
1164 +
1165 +- /* Initialize hash mac addr list*/
1166 +- INIT_LIST_HEAD(&adapter->mac_hlist);
1167 +-
1168 + adapter->flags |= FULL_INIT_DONE;
1169 + }
1170 +
1171 +@@ -3038,6 +3035,9 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
1172 + if (err)
1173 + goto err_unmap_bar;
1174 +
1175 ++ /* Initialize hash mac addr list */
1176 ++ INIT_LIST_HEAD(&adapter->mac_hlist);
1177 ++
1178 + /*
1179 + * Allocate our "adapter ports" and stitch everything together.
1180 + */
1181 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
1182 +index 8a1916443235..abfd990ba4d8 100644
1183 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
1184 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
1185 +@@ -2731,10 +2731,12 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter,
1186 +
1187 + if (adapter->resetting &&
1188 + adapter->reset_reason == VNIC_RESET_MOBILITY) {
1189 +- struct irq_desc *desc = irq_to_desc(scrq->irq);
1190 +- struct irq_chip *chip = irq_desc_get_chip(desc);
1191 ++ u64 val = (0xff000000) | scrq->hw_irq;
1192 +
1193 +- chip->irq_eoi(&desc->irq_data);
1194 ++ rc = plpar_hcall_norets(H_EOI, val);
1195 ++ if (rc)
1196 ++ dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n",
1197 ++ val, rc);
1198 + }
1199 +
1200 + rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
1201 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1202 +index 9c7b1d8e8220..c41879a955b5 100644
1203 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1204 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1205 +@@ -3684,7 +3684,7 @@ static int stmmac_set_features(struct net_device *netdev,
1206 + /**
1207 + * stmmac_interrupt - main ISR
1208 + * @irq: interrupt number.
1209 +- * @dev_id: to pass the net device pointer.
1210 ++ * @dev_id: to pass the net device pointer (must be valid).
1211 + * Description: this is the main driver interrupt service routine.
1212 + * It can call:
1213 + * o DMA service routine (to manage incoming frame reception and transmission
1214 +@@ -3708,11 +3708,6 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
1215 + if (priv->irq_wake)
1216 + pm_wakeup_event(priv->device, 0);
1217 +
1218 +- if (unlikely(!dev)) {
1219 +- netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
1220 +- return IRQ_NONE;
1221 +- }
1222 +-
1223 + /* Check if adapter is up */
1224 + if (test_bit(STMMAC_DOWN, &priv->state))
1225 + return IRQ_HANDLED;
1226 +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
1227 +index eab9984f73a8..d73850ebb671 100644
1228 +--- a/drivers/net/gtp.c
1229 ++++ b/drivers/net/gtp.c
1230 +@@ -1177,11 +1177,11 @@ out_unlock:
1231 + static struct genl_family gtp_genl_family;
1232 +
1233 + static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq,
1234 +- u32 type, struct pdp_ctx *pctx)
1235 ++ int flags, u32 type, struct pdp_ctx *pctx)
1236 + {
1237 + void *genlh;
1238 +
1239 +- genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, 0,
1240 ++ genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, flags,
1241 + type);
1242 + if (genlh == NULL)
1243 + goto nlmsg_failure;
1244 +@@ -1235,8 +1235,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info)
1245 + goto err_unlock;
1246 + }
1247 +
1248 +- err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid,
1249 +- info->snd_seq, info->nlhdr->nlmsg_type, pctx);
1250 ++ err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid, info->snd_seq,
1251 ++ 0, info->nlhdr->nlmsg_type, pctx);
1252 + if (err < 0)
1253 + goto err_unlock_free;
1254 +
1255 +@@ -1279,6 +1279,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,
1256 + gtp_genl_fill_info(skb,
1257 + NETLINK_CB(cb->skb).portid,
1258 + cb->nlh->nlmsg_seq,
1259 ++ NLM_F_MULTI,
1260 + cb->nlh->nlmsg_type, pctx)) {
1261 + cb->args[0] = i;
1262 + cb->args[1] = j;
1263 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
1264 +index e0211321fe9e..96870d1b3b73 100644
1265 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
1266 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
1267 +@@ -1933,6 +1933,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1268 + if (brcmf_sdio_hdparse(bus, bus->rxhdr, &rd_new,
1269 + BRCMF_SDIO_FT_NORMAL)) {
1270 + rd->len = 0;
1271 ++ brcmf_sdio_rxfail(bus, true, true);
1272 ++ sdio_release_host(bus->sdiodev->func1);
1273 + brcmu_pkt_buf_free_skb(pkt);
1274 + continue;
1275 + }
1276 +diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
1277 +index 75ae2c508a04..1064a703ccec 100644
1278 +--- a/drivers/nvdimm/btt.c
1279 ++++ b/drivers/nvdimm/btt.c
1280 +@@ -541,9 +541,9 @@ static int arena_clear_freelist_error(struct arena_info *arena, u32 lane)
1281 +
1282 + static int btt_freelist_init(struct arena_info *arena)
1283 + {
1284 +- int old, new, ret;
1285 +- u32 i, map_entry;
1286 +- struct log_entry log_new, log_old;
1287 ++ int new, ret;
1288 ++ struct log_entry log_new;
1289 ++ u32 i, map_entry, log_oldmap, log_newmap;
1290 +
1291 + arena->freelist = kcalloc(arena->nfree, sizeof(struct free_entry),
1292 + GFP_KERNEL);
1293 +@@ -551,24 +551,26 @@ static int btt_freelist_init(struct arena_info *arena)
1294 + return -ENOMEM;
1295 +
1296 + for (i = 0; i < arena->nfree; i++) {
1297 +- old = btt_log_read(arena, i, &log_old, LOG_OLD_ENT);
1298 +- if (old < 0)
1299 +- return old;
1300 +-
1301 + new = btt_log_read(arena, i, &log_new, LOG_NEW_ENT);
1302 + if (new < 0)
1303 + return new;
1304 +
1305 ++ /* old and new map entries with any flags stripped out */
1306 ++ log_oldmap = ent_lba(le32_to_cpu(log_new.old_map));
1307 ++ log_newmap = ent_lba(le32_to_cpu(log_new.new_map));
1308 ++
1309 + /* sub points to the next one to be overwritten */
1310 + arena->freelist[i].sub = 1 - new;
1311 + arena->freelist[i].seq = nd_inc_seq(le32_to_cpu(log_new.seq));
1312 +- arena->freelist[i].block = le32_to_cpu(log_new.old_map);
1313 ++ arena->freelist[i].block = log_oldmap;
1314 +
1315 + /*
1316 + * FIXME: if error clearing fails during init, we want to make
1317 + * the BTT read-only
1318 + */
1319 +- if (ent_e_flag(log_new.old_map)) {
1320 ++ if (ent_e_flag(log_new.old_map) &&
1321 ++ !ent_normal(log_new.old_map)) {
1322 ++ arena->freelist[i].has_err = 1;
1323 + ret = arena_clear_freelist_error(arena, i);
1324 + if (ret)
1325 + dev_err_ratelimited(to_dev(arena),
1326 +@@ -576,7 +578,7 @@ static int btt_freelist_init(struct arena_info *arena)
1327 + }
1328 +
1329 + /* This implies a newly created or untouched flog entry */
1330 +- if (log_new.old_map == log_new.new_map)
1331 ++ if (log_oldmap == log_newmap)
1332 + continue;
1333 +
1334 + /* Check if map recovery is needed */
1335 +@@ -584,8 +586,15 @@ static int btt_freelist_init(struct arena_info *arena)
1336 + NULL, NULL, 0);
1337 + if (ret)
1338 + return ret;
1339 +- if ((le32_to_cpu(log_new.new_map) != map_entry) &&
1340 +- (le32_to_cpu(log_new.old_map) == map_entry)) {
1341 ++
1342 ++ /*
1343 ++ * The map_entry from btt_read_map is stripped of any flag bits,
1344 ++ * so use the stripped out versions from the log as well for
1345 ++ * testing whether recovery is needed. For restoration, use the
1346 ++ * 'raw' version of the log entries as that captured what we
1347 ++ * were going to write originally.
1348 ++ */
1349 ++ if ((log_newmap != map_entry) && (log_oldmap == map_entry)) {
1350 + /*
1351 + * Last transaction wrote the flog, but wasn't able
1352 + * to complete the map write. So fix up the map.
1353 +diff --git a/drivers/nvdimm/btt.h b/drivers/nvdimm/btt.h
1354 +index db3cb6d4d0d4..ddff49c707b0 100644
1355 +--- a/drivers/nvdimm/btt.h
1356 ++++ b/drivers/nvdimm/btt.h
1357 +@@ -44,6 +44,8 @@
1358 + #define ent_e_flag(ent) (!!(ent & MAP_ERR_MASK))
1359 + #define ent_z_flag(ent) (!!(ent & MAP_TRIM_MASK))
1360 + #define set_e_flag(ent) (ent |= MAP_ERR_MASK)
1361 ++/* 'normal' is both e and z flags set */
1362 ++#define ent_normal(ent) (ent_e_flag(ent) && ent_z_flag(ent))
1363 +
1364 + enum btt_init_state {
1365 + INIT_UNCHECKED = 0,
1366 +diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
1367 +index e341498876ca..9486acc08402 100644
1368 +--- a/drivers/nvdimm/btt_devs.c
1369 ++++ b/drivers/nvdimm/btt_devs.c
1370 +@@ -159,11 +159,19 @@ static ssize_t size_show(struct device *dev,
1371 + }
1372 + static DEVICE_ATTR_RO(size);
1373 +
1374 ++static ssize_t log_zero_flags_show(struct device *dev,
1375 ++ struct device_attribute *attr, char *buf)
1376 ++{
1377 ++ return sprintf(buf, "Y\n");
1378 ++}
1379 ++static DEVICE_ATTR_RO(log_zero_flags);
1380 ++
1381 + static struct attribute *nd_btt_attributes[] = {
1382 + &dev_attr_sector_size.attr,
1383 + &dev_attr_namespace.attr,
1384 + &dev_attr_uuid.attr,
1385 + &dev_attr_size.attr,
1386 ++ &dev_attr_log_zero_flags.attr,
1387 + NULL,
1388 + };
1389 +
1390 +diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
1391 +index 59f3a37a44d7..8db2dc05b8cf 100644
1392 +--- a/drivers/platform/x86/asus-nb-wmi.c
1393 ++++ b/drivers/platform/x86/asus-nb-wmi.c
1394 +@@ -517,9 +517,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = {
1395 + .detect_quirks = asus_nb_wmi_quirks,
1396 + };
1397 +
1398 ++static const struct dmi_system_id asus_nb_wmi_blacklist[] __initconst = {
1399 ++ {
1400 ++ /*
1401 ++ * asus-nb-wm adds no functionality. The T100TA has a detachable
1402 ++ * USB kbd, so no hotkeys and it has no WMI rfkill; and loading
1403 ++ * asus-nb-wm causes the camera LED to turn and _stay_ on.
1404 ++ */
1405 ++ .matches = {
1406 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1407 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
1408 ++ },
1409 ++ },
1410 ++ {
1411 ++ /* The Asus T200TA has the same issue as the T100TA */
1412 ++ .matches = {
1413 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1414 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T200TA"),
1415 ++ },
1416 ++ },
1417 ++ {} /* Terminating entry */
1418 ++};
1419 +
1420 + static int __init asus_nb_wmi_init(void)
1421 + {
1422 ++ if (dmi_check_system(asus_nb_wmi_blacklist))
1423 ++ return -ENODEV;
1424 ++
1425 + return asus_wmi_register_driver(&asus_nb_wmi_driver);
1426 + }
1427 +
1428 +diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
1429 +index fa0bbda4b3f2..5940780648e0 100644
1430 +--- a/drivers/rapidio/devices/rio_mport_cdev.c
1431 ++++ b/drivers/rapidio/devices/rio_mport_cdev.c
1432 +@@ -879,6 +879,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
1433 + rmcd_error("pinned %ld out of %ld pages",
1434 + pinned, nr_pages);
1435 + ret = -EFAULT;
1436 ++ /*
1437 ++ * Set nr_pages up to mean "how many pages to unpin, in
1438 ++ * the error handler:
1439 ++ */
1440 ++ nr_pages = pinned;
1441 + goto err_pg;
1442 + }
1443 +
1444 +diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
1445 +index e60822f07653..b99ded6b9e0b 100644
1446 +--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
1447 ++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
1448 +@@ -2296,16 +2296,12 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
1449 + static int ibmvscsi_remove(struct vio_dev *vdev)
1450 + {
1451 + struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
1452 +- unsigned long flags;
1453 +
1454 + srp_remove_host(hostdata->host);
1455 + scsi_remove_host(hostdata->host);
1456 +
1457 + purge_requests(hostdata, DID_ERROR);
1458 +-
1459 +- spin_lock_irqsave(hostdata->host->host_lock, flags);
1460 + release_event_pool(&hostdata->pool, hostdata);
1461 +- spin_unlock_irqrestore(hostdata->host->host_lock, flags);
1462 +
1463 + ibmvscsi_release_crq_queue(&hostdata->queue, hostdata,
1464 + max_events);
1465 +diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
1466 +index b008d583dd6e..0ab9d2fd4a14 100644
1467 +--- a/drivers/scsi/qla2xxx/qla_attr.c
1468 ++++ b/drivers/scsi/qla2xxx/qla_attr.c
1469 +@@ -2162,11 +2162,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1470 + test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
1471 + msleep(1000);
1472 +
1473 +- qla_nvme_delete(vha);
1474 +
1475 + qla24xx_disable_vp(vha);
1476 + qla2x00_wait_for_sess_deletion(vha);
1477 +
1478 ++ qla_nvme_delete(vha);
1479 + vha->flags.delete_progress = 1;
1480 +
1481 + qlt_remove_target(ha, vha);
1482 +diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
1483 +index bef9faea5eee..ac5d2d34aeea 100644
1484 +--- a/drivers/scsi/qla2xxx/qla_mbx.c
1485 ++++ b/drivers/scsi/qla2xxx/qla_mbx.c
1486 +@@ -3077,7 +3077,7 @@ qla24xx_abort_command(srb_t *sp)
1487 + ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108c,
1488 + "Entered %s.\n", __func__);
1489 +
1490 +- if (vha->flags.qpairs_available && sp->qpair)
1491 ++ if (sp->qpair)
1492 + req = sp->qpair->req;
1493 +
1494 + if (ql2xasynctmfenable)
1495 +diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
1496 +index 8a006323c3c1..f36d470aed24 100644
1497 +--- a/drivers/staging/greybus/uart.c
1498 ++++ b/drivers/staging/greybus/uart.c
1499 +@@ -537,9 +537,9 @@ static void gb_tty_set_termios(struct tty_struct *tty,
1500 + }
1501 +
1502 + if (C_CRTSCTS(tty) && C_BAUD(tty) != B0)
1503 +- newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
1504 ++ newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN;
1505 + else
1506 +- newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN;
1507 ++ newline.flow_control = 0;
1508 +
1509 + if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) {
1510 + memcpy(&gb_tty->line_coding, &newline, sizeof(newline));
1511 +diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
1512 +index ac13b99bd9cb..aca983f34f5e 100644
1513 +--- a/drivers/staging/iio/resolver/ad2s1210.c
1514 ++++ b/drivers/staging/iio/resolver/ad2s1210.c
1515 +@@ -114,17 +114,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data)
1516 + static int ad2s1210_config_read(struct ad2s1210_state *st,
1517 + unsigned char address)
1518 + {
1519 +- struct spi_transfer xfer = {
1520 +- .len = 2,
1521 +- .rx_buf = st->rx,
1522 +- .tx_buf = st->tx,
1523 ++ struct spi_transfer xfers[] = {
1524 ++ {
1525 ++ .len = 1,
1526 ++ .rx_buf = &st->rx[0],
1527 ++ .tx_buf = &st->tx[0],
1528 ++ .cs_change = 1,
1529 ++ }, {
1530 ++ .len = 1,
1531 ++ .rx_buf = &st->rx[1],
1532 ++ .tx_buf = &st->tx[1],
1533 ++ },
1534 + };
1535 + int ret = 0;
1536 +
1537 + ad2s1210_set_mode(MOD_CONFIG, st);
1538 + st->tx[0] = address | AD2S1210_MSB_IS_HIGH;
1539 + st->tx[1] = AD2S1210_REG_FAULT;
1540 +- ret = spi_sync_transfer(st->sdev, &xfer, 1);
1541 ++ ret = spi_sync_transfer(st->sdev, xfers, 2);
1542 + if (ret < 0)
1543 + return ret;
1544 +
1545 +diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
1546 +index 25a077f4ea94..08f60ce6293d 100644
1547 +--- a/drivers/staging/most/core.c
1548 ++++ b/drivers/staging/most/core.c
1549 +@@ -1412,7 +1412,7 @@ int most_register_interface(struct most_interface *iface)
1550 +
1551 + INIT_LIST_HEAD(&iface->p->channel_list);
1552 + iface->p->dev_id = id;
1553 +- strcpy(iface->p->name, iface->description);
1554 ++ strscpy(iface->p->name, iface->description, sizeof(iface->p->name));
1555 + iface->dev.init_name = iface->p->name;
1556 + iface->dev.bus = &mc.bus;
1557 + iface->dev.parent = &mc.dev;
1558 +diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c
1559 +index 8490a1b6b615..2b83d8b02f81 100644
1560 +--- a/drivers/thunderbolt/icm.c
1561 ++++ b/drivers/thunderbolt/icm.c
1562 +@@ -801,9 +801,11 @@ icm_fr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr)
1563 + * connected another host to the same port, remove the switch
1564 + * first.
1565 + */
1566 +- sw = get_switch_at_route(tb->root_switch, route);
1567 +- if (sw)
1568 ++ sw = tb_switch_find_by_route(tb, route);
1569 ++ if (sw) {
1570 + remove_switch(sw);
1571 ++ tb_switch_put(sw);
1572 ++ }
1573 +
1574 + sw = tb_switch_find_by_link_depth(tb, link, depth);
1575 + if (!sw) {
1576 +@@ -1146,9 +1148,11 @@ icm_tr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr)
1577 + * connected another host to the same port, remove the switch
1578 + * first.
1579 + */
1580 +- sw = get_switch_at_route(tb->root_switch, route);
1581 +- if (sw)
1582 ++ sw = tb_switch_find_by_route(tb, route);
1583 ++ if (sw) {
1584 + remove_switch(sw);
1585 ++ tb_switch_put(sw);
1586 ++ }
1587 +
1588 + sw = tb_switch_find_by_route(tb, get_parent_route(route));
1589 + if (!sw) {
1590 +diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
1591 +index 42d90ceec279..010a50ac4881 100644
1592 +--- a/drivers/thunderbolt/switch.c
1593 ++++ b/drivers/thunderbolt/switch.c
1594 +@@ -664,24 +664,6 @@ int tb_switch_reset(struct tb *tb, u64 route)
1595 + return res.err;
1596 + }
1597 +
1598 +-struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route)
1599 +-{
1600 +- u8 next_port = route; /*
1601 +- * Routes use a stride of 8 bits,
1602 +- * eventhough a port index has 6 bits at most.
1603 +- * */
1604 +- if (route == 0)
1605 +- return sw;
1606 +- if (next_port > sw->config.max_port_number)
1607 +- return NULL;
1608 +- if (tb_is_upstream_port(&sw->ports[next_port]))
1609 +- return NULL;
1610 +- if (!sw->ports[next_port].remote)
1611 +- return NULL;
1612 +- return get_switch_at_route(sw->ports[next_port].remote->sw,
1613 +- route >> TB_ROUTE_SHIFT);
1614 +-}
1615 +-
1616 + /**
1617 + * tb_plug_events_active() - enable/disable plug events on a switch
1618 + *
1619 +diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
1620 +index 1424581fd9af..146f261bf2c3 100644
1621 +--- a/drivers/thunderbolt/tb.c
1622 ++++ b/drivers/thunderbolt/tb.c
1623 +@@ -258,7 +258,7 @@ static void tb_handle_hotplug(struct work_struct *work)
1624 + if (!tcm->hotplug_active)
1625 + goto out; /* during init, suspend or shutdown */
1626 +
1627 +- sw = get_switch_at_route(tb->root_switch, ev->route);
1628 ++ sw = tb_switch_find_by_route(tb, ev->route);
1629 + if (!sw) {
1630 + tb_warn(tb,
1631 + "hotplug event from non existent switch %llx:%x (unplug: %d)\n",
1632 +@@ -269,14 +269,14 @@ static void tb_handle_hotplug(struct work_struct *work)
1633 + tb_warn(tb,
1634 + "hotplug event from non existent port %llx:%x (unplug: %d)\n",
1635 + ev->route, ev->port, ev->unplug);
1636 +- goto out;
1637 ++ goto put_sw;
1638 + }
1639 + port = &sw->ports[ev->port];
1640 + if (tb_is_upstream_port(port)) {
1641 + tb_warn(tb,
1642 + "hotplug event for upstream port %llx:%x (unplug: %d)\n",
1643 + ev->route, ev->port, ev->unplug);
1644 +- goto out;
1645 ++ goto put_sw;
1646 + }
1647 + if (ev->unplug) {
1648 + if (port->remote) {
1649 +@@ -306,6 +306,9 @@ static void tb_handle_hotplug(struct work_struct *work)
1650 + tb_activate_pcie_devices(tb);
1651 + }
1652 + }
1653 ++
1654 ++put_sw:
1655 ++ tb_switch_put(sw);
1656 + out:
1657 + mutex_unlock(&tb->lock);
1658 + kfree(ev);
1659 +diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
1660 +index 7a0ee9836a8a..d927cf7b14d2 100644
1661 +--- a/drivers/thunderbolt/tb.h
1662 ++++ b/drivers/thunderbolt/tb.h
1663 +@@ -397,7 +397,6 @@ void tb_switch_suspend(struct tb_switch *sw);
1664 + int tb_switch_resume(struct tb_switch *sw);
1665 + int tb_switch_reset(struct tb *tb, u64 route);
1666 + void tb_sw_set_unplugged(struct tb_switch *sw);
1667 +-struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route);
1668 + struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link,
1669 + u8 depth);
1670 + struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid);
1671 +diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
1672 +index 4458419f053b..0d405cc58e72 100644
1673 +--- a/drivers/tty/serial/qcom_geni_serial.c
1674 ++++ b/drivers/tty/serial/qcom_geni_serial.c
1675 +@@ -705,7 +705,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done,
1676 + avail *= port->tx_bytes_pw;
1677 +
1678 + tail = xmit->tail;
1679 +- chunk = min3(avail, pending, (size_t)(UART_XMIT_SIZE - tail));
1680 ++ chunk = min(avail, pending);
1681 + if (!chunk)
1682 + goto out_write_wakeup;
1683 +
1684 +@@ -727,19 +727,21 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done,
1685 +
1686 + memset(buf, 0, ARRAY_SIZE(buf));
1687 + tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
1688 +- for (c = 0; c < tx_bytes ; c++)
1689 +- buf[c] = xmit->buf[tail + c];
1690 ++
1691 ++ for (c = 0; c < tx_bytes ; c++) {
1692 ++ buf[c] = xmit->buf[tail++];
1693 ++ tail &= UART_XMIT_SIZE - 1;
1694 ++ }
1695 +
1696 + iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1);
1697 +
1698 + i += tx_bytes;
1699 +- tail += tx_bytes;
1700 + uport->icount.tx += tx_bytes;
1701 + remaining -= tx_bytes;
1702 + port->tx_remaining -= tx_bytes;
1703 + }
1704 +
1705 +- xmit->tail = tail & (UART_XMIT_SIZE - 1);
1706 ++ xmit->tail = tail;
1707 +
1708 + /*
1709 + * The tx fifo watermark is level triggered and latched. Though we had
1710 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1711 +index fcf84bfc08e3..f705ea52eb97 100644
1712 +--- a/drivers/usb/core/message.c
1713 ++++ b/drivers/usb/core/message.c
1714 +@@ -1143,11 +1143,11 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr,
1715 +
1716 + if (usb_endpoint_out(epaddr)) {
1717 + ep = dev->ep_out[epnum];
1718 +- if (reset_hardware)
1719 ++ if (reset_hardware && epnum != 0)
1720 + dev->ep_out[epnum] = NULL;
1721 + } else {
1722 + ep = dev->ep_in[epnum];
1723 +- if (reset_hardware)
1724 ++ if (reset_hardware && epnum != 0)
1725 + dev->ep_in[epnum] = NULL;
1726 + }
1727 + if (ep) {
1728 +diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
1729 +index bac1365cc81b..7891bd40ebd8 100644
1730 +--- a/drivers/vhost/vsock.c
1731 ++++ b/drivers/vhost/vsock.c
1732 +@@ -182,14 +182,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
1733 + break;
1734 + }
1735 +
1736 +- vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
1737 +- added = true;
1738 +-
1739 +- /* Deliver to monitoring devices all correctly transmitted
1740 +- * packets.
1741 ++ /* Deliver to monitoring devices all packets that we
1742 ++ * will transmit.
1743 + */
1744 + virtio_transport_deliver_tap_pkt(pkt);
1745 +
1746 ++ vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
1747 ++ added = true;
1748 ++
1749 + pkt->off += payload_len;
1750 + total_len += payload_len;
1751 +
1752 +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
1753 +index 5241102b81a8..a2d4eed27f80 100644
1754 +--- a/fs/ceph/caps.c
1755 ++++ b/fs/ceph/caps.c
1756 +@@ -3632,6 +3632,7 @@ retry:
1757 + WARN_ON(1);
1758 + tsession = NULL;
1759 + target = -1;
1760 ++ mutex_lock(&session->s_mutex);
1761 + }
1762 + goto retry;
1763 +
1764 +diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
1765 +index 2cc6b1c49d34..f9628fc20fec 100644
1766 +--- a/fs/configfs/dir.c
1767 ++++ b/fs/configfs/dir.c
1768 +@@ -1537,6 +1537,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
1769 + spin_lock(&configfs_dirent_lock);
1770 + configfs_detach_rollback(dentry);
1771 + spin_unlock(&configfs_dirent_lock);
1772 ++ config_item_put(parent_item);
1773 + return -EINTR;
1774 + }
1775 + frag->frag_dead = true;
1776 +diff --git a/fs/file.c b/fs/file.c
1777 +index 780d29e58847..3762a3f136fd 100644
1778 +--- a/fs/file.c
1779 ++++ b/fs/file.c
1780 +@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
1781 + */
1782 + static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
1783 + {
1784 +- unsigned int cpy, set;
1785 ++ size_t cpy, set;
1786 +
1787 + BUG_ON(nfdt->max_fds < ofdt->max_fds);
1788 +
1789 +diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
1790 +index f8a5eef3d014..ccdd8c821abd 100644
1791 +--- a/fs/gfs2/glock.c
1792 ++++ b/fs/gfs2/glock.c
1793 +@@ -636,9 +636,6 @@ __acquires(&gl->gl_lockref.lock)
1794 + goto out_unlock;
1795 + if (nonblock)
1796 + goto out_sched;
1797 +- smp_mb();
1798 +- if (atomic_read(&gl->gl_revokes) != 0)
1799 +- goto out_sched;
1800 + set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
1801 + GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE);
1802 + gl->gl_target = gl->gl_demote_state;
1803 +diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
1804 +index 65b4f63349c7..d7d2fdda4bbd 100644
1805 +--- a/fs/ubifs/file.c
1806 ++++ b/fs/ubifs/file.c
1807 +@@ -1391,7 +1391,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
1808 + struct ubifs_info *c = inode->i_sb->s_fs_info;
1809 + struct ubifs_budget_req req = { .dirtied_ino = 1,
1810 + .dirtied_ino_d = ALIGN(ui->data_len, 8) };
1811 +- int iflags = I_DIRTY_TIME;
1812 + int err, release;
1813 +
1814 + err = ubifs_budget_space(c, &req);
1815 +@@ -1406,11 +1405,8 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
1816 + if (flags & S_MTIME)
1817 + inode->i_mtime = *time;
1818 +
1819 +- if (!(inode->i_sb->s_flags & SB_LAZYTIME))
1820 +- iflags |= I_DIRTY_SYNC;
1821 +-
1822 + release = ui->dirty;
1823 +- __mark_inode_dirty(inode, iflags);
1824 ++ __mark_inode_dirty(inode, I_DIRTY_SYNC);
1825 + mutex_unlock(&ui->ui_mutex);
1826 + if (release)
1827 + ubifs_release_budget(c, &req);
1828 +diff --git a/include/linux/padata.h b/include/linux/padata.h
1829 +index 5d13d25da2c8..d803397a28f7 100644
1830 +--- a/include/linux/padata.h
1831 ++++ b/include/linux/padata.h
1832 +@@ -24,7 +24,6 @@
1833 + #include <linux/workqueue.h>
1834 + #include <linux/spinlock.h>
1835 + #include <linux/list.h>
1836 +-#include <linux/timer.h>
1837 + #include <linux/notifier.h>
1838 + #include <linux/kobject.h>
1839 +
1840 +@@ -85,18 +84,14 @@ struct padata_serial_queue {
1841 + * @serial: List to wait for serialization after reordering.
1842 + * @pwork: work struct for parallelization.
1843 + * @swork: work struct for serialization.
1844 +- * @pd: Backpointer to the internal control structure.
1845 + * @work: work struct for parallelization.
1846 +- * @reorder_work: work struct for reordering.
1847 + * @num_obj: Number of objects that are processed by this cpu.
1848 + * @cpu_index: Index of the cpu.
1849 + */
1850 + struct padata_parallel_queue {
1851 + struct padata_list parallel;
1852 + struct padata_list reorder;
1853 +- struct parallel_data *pd;
1854 + struct work_struct work;
1855 +- struct work_struct reorder_work;
1856 + atomic_t num_obj;
1857 + int cpu_index;
1858 + };
1859 +@@ -122,10 +117,10 @@ struct padata_cpumask {
1860 + * @reorder_objects: Number of objects waiting in the reorder queues.
1861 + * @refcnt: Number of objects holding a reference on this parallel_data.
1862 + * @max_seq_nr: Maximal used sequence number.
1863 ++ * @cpu: Next CPU to be processed.
1864 + * @cpumask: The cpumasks in use for parallel and serial workers.
1865 ++ * @reorder_work: work struct for reordering.
1866 + * @lock: Reorder lock.
1867 +- * @processed: Number of already processed objects.
1868 +- * @timer: Reorder timer.
1869 + */
1870 + struct parallel_data {
1871 + struct padata_instance *pinst;
1872 +@@ -134,10 +129,10 @@ struct parallel_data {
1873 + atomic_t reorder_objects;
1874 + atomic_t refcnt;
1875 + atomic_t seq_nr;
1876 ++ int cpu;
1877 + struct padata_cpumask cpumask;
1878 ++ struct work_struct reorder_work;
1879 + spinlock_t lock ____cacheline_aligned;
1880 +- unsigned int processed;
1881 +- struct timer_list timer;
1882 + };
1883 +
1884 + /**
1885 +diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
1886 +index 0924119bcfa4..bc5b232440b6 100644
1887 +--- a/include/trace/events/rxrpc.h
1888 ++++ b/include/trace/events/rxrpc.h
1889 +@@ -1549,6 +1549,41 @@ TRACE_EVENT(rxrpc_notify_socket,
1890 + __entry->serial)
1891 + );
1892 +
1893 ++TRACE_EVENT(rxrpc_rx_discard_ack,
1894 ++ TP_PROTO(unsigned int debug_id, rxrpc_serial_t serial,
1895 ++ rxrpc_seq_t first_soft_ack, rxrpc_seq_t call_ackr_first,
1896 ++ rxrpc_seq_t prev_pkt, rxrpc_seq_t call_ackr_prev),
1897 ++
1898 ++ TP_ARGS(debug_id, serial, first_soft_ack, call_ackr_first,
1899 ++ prev_pkt, call_ackr_prev),
1900 ++
1901 ++ TP_STRUCT__entry(
1902 ++ __field(unsigned int, debug_id )
1903 ++ __field(rxrpc_serial_t, serial )
1904 ++ __field(rxrpc_seq_t, first_soft_ack)
1905 ++ __field(rxrpc_seq_t, call_ackr_first)
1906 ++ __field(rxrpc_seq_t, prev_pkt)
1907 ++ __field(rxrpc_seq_t, call_ackr_prev)
1908 ++ ),
1909 ++
1910 ++ TP_fast_assign(
1911 ++ __entry->debug_id = debug_id;
1912 ++ __entry->serial = serial;
1913 ++ __entry->first_soft_ack = first_soft_ack;
1914 ++ __entry->call_ackr_first = call_ackr_first;
1915 ++ __entry->prev_pkt = prev_pkt;
1916 ++ __entry->call_ackr_prev = call_ackr_prev;
1917 ++ ),
1918 ++
1919 ++ TP_printk("c=%08x r=%08x %08x<%08x %08x<%08x",
1920 ++ __entry->debug_id,
1921 ++ __entry->serial,
1922 ++ __entry->first_soft_ack,
1923 ++ __entry->call_ackr_first,
1924 ++ __entry->prev_pkt,
1925 ++ __entry->call_ackr_prev)
1926 ++ );
1927 ++
1928 + #endif /* _TRACE_RXRPC_H */
1929 +
1930 + /* This part must be outside protection */
1931 +diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
1932 +index 2f2c43d633c5..7b0189d6dfa9 100644
1933 +--- a/include/uapi/linux/ndctl.h
1934 ++++ b/include/uapi/linux/ndctl.h
1935 +@@ -247,6 +247,7 @@ struct nd_cmd_pkg {
1936 + #define NVDIMM_FAMILY_HPE1 1
1937 + #define NVDIMM_FAMILY_HPE2 2
1938 + #define NVDIMM_FAMILY_MSFT 3
1939 ++#define NVDIMM_FAMILY_HYPERV 4
1940 +
1941 + #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL,\
1942 + struct nd_cmd_pkg)
1943 +diff --git a/kernel/padata.c b/kernel/padata.c
1944 +index c280cb153915..93e4fb2d9f2e 100644
1945 +--- a/kernel/padata.c
1946 ++++ b/kernel/padata.c
1947 +@@ -167,23 +167,12 @@ EXPORT_SYMBOL(padata_do_parallel);
1948 + */
1949 + static struct padata_priv *padata_get_next(struct parallel_data *pd)
1950 + {
1951 +- int cpu, num_cpus;
1952 +- unsigned int next_nr, next_index;
1953 + struct padata_parallel_queue *next_queue;
1954 + struct padata_priv *padata;
1955 + struct padata_list *reorder;
1956 ++ int cpu = pd->cpu;
1957 +
1958 +- num_cpus = cpumask_weight(pd->cpumask.pcpu);
1959 +-
1960 +- /*
1961 +- * Calculate the percpu reorder queue and the sequence
1962 +- * number of the next object.
1963 +- */
1964 +- next_nr = pd->processed;
1965 +- next_index = next_nr % num_cpus;
1966 +- cpu = padata_index_to_cpu(pd, next_index);
1967 + next_queue = per_cpu_ptr(pd->pqueue, cpu);
1968 +-
1969 + reorder = &next_queue->reorder;
1970 +
1971 + spin_lock(&reorder->lock);
1972 +@@ -194,7 +183,8 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd)
1973 + list_del_init(&padata->list);
1974 + atomic_dec(&pd->reorder_objects);
1975 +
1976 +- pd->processed++;
1977 ++ pd->cpu = cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1,
1978 ++ false);
1979 +
1980 + spin_unlock(&reorder->lock);
1981 + goto out;
1982 +@@ -217,6 +207,7 @@ static void padata_reorder(struct parallel_data *pd)
1983 + struct padata_priv *padata;
1984 + struct padata_serial_queue *squeue;
1985 + struct padata_instance *pinst = pd->pinst;
1986 ++ struct padata_parallel_queue *next_queue;
1987 +
1988 + /*
1989 + * We need to ensure that only one cpu can work on dequeueing of
1990 +@@ -248,7 +239,6 @@ static void padata_reorder(struct parallel_data *pd)
1991 + * so exit immediately.
1992 + */
1993 + if (PTR_ERR(padata) == -ENODATA) {
1994 +- del_timer(&pd->timer);
1995 + spin_unlock_bh(&pd->lock);
1996 + return;
1997 + }
1998 +@@ -267,70 +257,29 @@ static void padata_reorder(struct parallel_data *pd)
1999 +
2000 + /*
2001 + * The next object that needs serialization might have arrived to
2002 +- * the reorder queues in the meantime, we will be called again
2003 +- * from the timer function if no one else cares for it.
2004 ++ * the reorder queues in the meantime.
2005 + *
2006 +- * Ensure reorder_objects is read after pd->lock is dropped so we see
2007 +- * an increment from another task in padata_do_serial. Pairs with
2008 ++ * Ensure reorder queue is read after pd->lock is dropped so we see
2009 ++ * new objects from another task in padata_do_serial. Pairs with
2010 + * smp_mb__after_atomic in padata_do_serial.
2011 + */
2012 + smp_mb();
2013 +- if (atomic_read(&pd->reorder_objects)
2014 +- && !(pinst->flags & PADATA_RESET))
2015 +- mod_timer(&pd->timer, jiffies + HZ);
2016 +- else
2017 +- del_timer(&pd->timer);
2018 +
2019 +- return;
2020 ++ next_queue = per_cpu_ptr(pd->pqueue, pd->cpu);
2021 ++ if (!list_empty(&next_queue->reorder.list))
2022 ++ queue_work(pinst->wq, &pd->reorder_work);
2023 + }
2024 +
2025 + static void invoke_padata_reorder(struct work_struct *work)
2026 + {
2027 +- struct padata_parallel_queue *pqueue;
2028 + struct parallel_data *pd;
2029 +
2030 + local_bh_disable();
2031 +- pqueue = container_of(work, struct padata_parallel_queue, reorder_work);
2032 +- pd = pqueue->pd;
2033 ++ pd = container_of(work, struct parallel_data, reorder_work);
2034 + padata_reorder(pd);
2035 + local_bh_enable();
2036 + }
2037 +
2038 +-static void padata_reorder_timer(struct timer_list *t)
2039 +-{
2040 +- struct parallel_data *pd = from_timer(pd, t, timer);
2041 +- unsigned int weight;
2042 +- int target_cpu, cpu;
2043 +-
2044 +- cpu = get_cpu();
2045 +-
2046 +- /* We don't lock pd here to not interfere with parallel processing
2047 +- * padata_reorder() calls on other CPUs. We just need any CPU out of
2048 +- * the cpumask.pcpu set. It would be nice if it's the right one but
2049 +- * it doesn't matter if we're off to the next one by using an outdated
2050 +- * pd->processed value.
2051 +- */
2052 +- weight = cpumask_weight(pd->cpumask.pcpu);
2053 +- target_cpu = padata_index_to_cpu(pd, pd->processed % weight);
2054 +-
2055 +- /* ensure to call the reorder callback on the correct CPU */
2056 +- if (cpu != target_cpu) {
2057 +- struct padata_parallel_queue *pqueue;
2058 +- struct padata_instance *pinst;
2059 +-
2060 +- /* The timer function is serialized wrt itself -- no locking
2061 +- * needed.
2062 +- */
2063 +- pinst = pd->pinst;
2064 +- pqueue = per_cpu_ptr(pd->pqueue, target_cpu);
2065 +- queue_work_on(target_cpu, pinst->wq, &pqueue->reorder_work);
2066 +- } else {
2067 +- padata_reorder(pd);
2068 +- }
2069 +-
2070 +- put_cpu();
2071 +-}
2072 +-
2073 + static void padata_serial_worker(struct work_struct *serial_work)
2074 + {
2075 + struct padata_serial_queue *squeue;
2076 +@@ -375,47 +324,23 @@ static void padata_serial_worker(struct work_struct *serial_work)
2077 + */
2078 + void padata_do_serial(struct padata_priv *padata)
2079 + {
2080 +- int cpu;
2081 +- struct padata_parallel_queue *pqueue;
2082 +- struct parallel_data *pd;
2083 +- int reorder_via_wq = 0;
2084 +-
2085 +- pd = padata->pd;
2086 +-
2087 +- cpu = get_cpu();
2088 +-
2089 +- /* We need to run on the same CPU padata_do_parallel(.., padata, ..)
2090 +- * was called on -- or, at least, enqueue the padata object into the
2091 +- * correct per-cpu queue.
2092 +- */
2093 +- if (cpu != padata->cpu) {
2094 +- reorder_via_wq = 1;
2095 +- cpu = padata->cpu;
2096 +- }
2097 +-
2098 +- pqueue = per_cpu_ptr(pd->pqueue, cpu);
2099 ++ struct parallel_data *pd = padata->pd;
2100 ++ struct padata_parallel_queue *pqueue = per_cpu_ptr(pd->pqueue,
2101 ++ padata->cpu);
2102 +
2103 + spin_lock(&pqueue->reorder.lock);
2104 +- atomic_inc(&pd->reorder_objects);
2105 + list_add_tail(&padata->list, &pqueue->reorder.list);
2106 ++ atomic_inc(&pd->reorder_objects);
2107 + spin_unlock(&pqueue->reorder.lock);
2108 +
2109 + /*
2110 +- * Ensure the atomic_inc of reorder_objects above is ordered correctly
2111 ++ * Ensure the addition to the reorder list is ordered correctly
2112 + * with the trylock of pd->lock in padata_reorder. Pairs with smp_mb
2113 + * in padata_reorder.
2114 + */
2115 + smp_mb__after_atomic();
2116 +
2117 +- put_cpu();
2118 +-
2119 +- /* If we're running on the wrong CPU, call padata_reorder() via a
2120 +- * kernel worker.
2121 +- */
2122 +- if (reorder_via_wq)
2123 +- queue_work_on(cpu, pd->pinst->wq, &pqueue->reorder_work);
2124 +- else
2125 +- padata_reorder(pd);
2126 ++ padata_reorder(pd);
2127 + }
2128 + EXPORT_SYMBOL(padata_do_serial);
2129 +
2130 +@@ -471,14 +396,12 @@ static void padata_init_pqueues(struct parallel_data *pd)
2131 + continue;
2132 + }
2133 +
2134 +- pqueue->pd = pd;
2135 + pqueue->cpu_index = cpu_index;
2136 + cpu_index++;
2137 +
2138 + __padata_list_init(&pqueue->reorder);
2139 + __padata_list_init(&pqueue->parallel);
2140 + INIT_WORK(&pqueue->work, padata_parallel_worker);
2141 +- INIT_WORK(&pqueue->reorder_work, invoke_padata_reorder);
2142 + atomic_set(&pqueue->num_obj, 0);
2143 + }
2144 + }
2145 +@@ -506,12 +429,13 @@ static struct parallel_data *padata_alloc_pd(struct padata_instance *pinst,
2146 +
2147 + padata_init_pqueues(pd);
2148 + padata_init_squeues(pd);
2149 +- timer_setup(&pd->timer, padata_reorder_timer, 0);
2150 + atomic_set(&pd->seq_nr, -1);
2151 + atomic_set(&pd->reorder_objects, 0);
2152 + atomic_set(&pd->refcnt, 1);
2153 + pd->pinst = pinst;
2154 + spin_lock_init(&pd->lock);
2155 ++ pd->cpu = cpumask_first(pd->cpumask.pcpu);
2156 ++ INIT_WORK(&pd->reorder_work, invoke_padata_reorder);
2157 +
2158 + return pd;
2159 +
2160 +diff --git a/lib/Makefile b/lib/Makefile
2161 +index 0ab808318202..1d7a705d7207 100644
2162 +--- a/lib/Makefile
2163 ++++ b/lib/Makefile
2164 +@@ -269,6 +269,8 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string.o
2165 + obj-$(CONFIG_UBSAN) += ubsan.o
2166 +
2167 + UBSAN_SANITIZE_ubsan.o := n
2168 ++KASAN_SANITIZE_ubsan.o := n
2169 ++CFLAGS_ubsan.o := $(call cc-option, -fno-stack-protector) $(DISABLE_STACKLEAK_PLUGIN)
2170 +
2171 + obj-$(CONFIG_SBITMAP) += sbitmap.o
2172 +
2173 +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
2174 +index d9beb28fc32f..e65b230fce4c 100644
2175 +--- a/net/rxrpc/input.c
2176 ++++ b/net/rxrpc/input.c
2177 +@@ -814,6 +814,30 @@ static void rxrpc_input_soft_acks(struct rxrpc_call *call, u8 *acks,
2178 + }
2179 + }
2180 +
2181 ++/*
2182 ++ * Return true if the ACK is valid - ie. it doesn't appear to have regressed
2183 ++ * with respect to the ack state conveyed by preceding ACKs.
2184 ++ */
2185 ++static bool rxrpc_is_ack_valid(struct rxrpc_call *call,
2186 ++ rxrpc_seq_t first_pkt, rxrpc_seq_t prev_pkt)
2187 ++{
2188 ++ rxrpc_seq_t base = READ_ONCE(call->ackr_first_seq);
2189 ++
2190 ++ if (after(first_pkt, base))
2191 ++ return true; /* The window advanced */
2192 ++
2193 ++ if (before(first_pkt, base))
2194 ++ return false; /* firstPacket regressed */
2195 ++
2196 ++ if (after_eq(prev_pkt, call->ackr_prev_seq))
2197 ++ return true; /* previousPacket hasn't regressed. */
2198 ++
2199 ++ /* Some rx implementations put a serial number in previousPacket. */
2200 ++ if (after_eq(prev_pkt, base + call->tx_winsize))
2201 ++ return false;
2202 ++ return true;
2203 ++}
2204 ++
2205 + /*
2206 + * Process an ACK packet.
2207 + *
2208 +@@ -878,9 +902,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
2209 + }
2210 +
2211 + /* Discard any out-of-order or duplicate ACKs (outside lock). */
2212 +- if (before(first_soft_ack, call->ackr_first_seq) ||
2213 +- before(prev_pkt, call->ackr_prev_seq))
2214 ++ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
2215 ++ trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
2216 ++ first_soft_ack, call->ackr_first_seq,
2217 ++ prev_pkt, call->ackr_prev_seq);
2218 + return;
2219 ++ }
2220 +
2221 + buf.info.rxMTU = 0;
2222 + ioffset = offset + nr_acks + 3;
2223 +@@ -891,9 +918,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
2224 + spin_lock(&call->input_lock);
2225 +
2226 + /* Discard any out-of-order or duplicate ACKs (inside lock). */
2227 +- if (before(first_soft_ack, call->ackr_first_seq) ||
2228 +- before(prev_pkt, call->ackr_prev_seq))
2229 ++ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
2230 ++ trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
2231 ++ first_soft_ack, call->ackr_first_seq,
2232 ++ prev_pkt, call->ackr_prev_seq);
2233 + goto out;
2234 ++ }
2235 + call->acks_latest_ts = skb->tstamp;
2236 + call->acks_latest = sp->hdr.serial;
2237 +
2238 +diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
2239 +index cea16838d588..dce7bdc73de4 100644
2240 +--- a/net/rxrpc/rxkad.c
2241 ++++ b/net/rxrpc/rxkad.c
2242 +@@ -1118,7 +1118,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,
2243 + ret = rxkad_decrypt_ticket(conn, skb, ticket, ticket_len, &session_key,
2244 + &expiry, _abort_code);
2245 + if (ret < 0)
2246 +- goto temporary_error_free_resp;
2247 ++ goto temporary_error_free_ticket;
2248 +
2249 + /* use the session key from inside the ticket to decrypt the
2250 + * response */
2251 +@@ -1200,7 +1200,6 @@ protocol_error:
2252 +
2253 + temporary_error_free_ticket:
2254 + kfree(ticket);
2255 +-temporary_error_free_resp:
2256 + kfree(response);
2257 + temporary_error:
2258 + /* Ignore the response packet if we got a temporary error such as
2259 +diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
2260 +index aa0d0ec6936d..9e95862f2788 100644
2261 +--- a/scripts/gcc-plugins/Makefile
2262 ++++ b/scripts/gcc-plugins/Makefile
2263 +@@ -11,6 +11,7 @@ else
2264 + HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
2265 + HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
2266 + HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
2267 ++ HOST_EXTRACXXFLAGS += -Wno-format-diag
2268 + export HOST_EXTRACXXFLAGS
2269 + endif
2270 +
2271 +diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
2272 +index 17f06079a712..9ad76b7f3f10 100644
2273 +--- a/scripts/gcc-plugins/gcc-common.h
2274 ++++ b/scripts/gcc-plugins/gcc-common.h
2275 +@@ -35,7 +35,9 @@
2276 + #include "ggc.h"
2277 + #include "timevar.h"
2278 +
2279 ++#if BUILDING_GCC_VERSION < 10000
2280 + #include "params.h"
2281 ++#endif
2282 +
2283 + #if BUILDING_GCC_VERSION <= 4009
2284 + #include "pointer-set.h"
2285 +@@ -847,6 +849,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
2286 + return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
2287 + }
2288 +
2289 ++#if BUILDING_GCC_VERSION < 10000
2290 + template <>
2291 + template <>
2292 + inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
2293 +@@ -860,6 +863,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs)
2294 + {
2295 + return gs->code == GIMPLE_RETURN;
2296 + }
2297 ++#endif
2298 +
2299 + static inline gasm *as_a_gasm(gimple stmt)
2300 + {
2301 +diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
2302 +index 0a57d105cc5b..1ec1e928cc09 100644
2303 +--- a/security/apparmor/apparmorfs.c
2304 ++++ b/security/apparmor/apparmorfs.c
2305 +@@ -424,7 +424,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size,
2306 + */
2307 + error = aa_may_manage_policy(label, ns, mask);
2308 + if (error)
2309 +- return error;
2310 ++ goto end_section;
2311 +
2312 + data = aa_simple_write_to_buffer(buf, size, size, pos);
2313 + error = PTR_ERR(data);
2314 +@@ -432,6 +432,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size,
2315 + error = aa_replace_profiles(ns, label, mask, data);
2316 + aa_put_loaddata(data);
2317 + }
2318 ++end_section:
2319 + end_current_label_crit_section(label);
2320 +
2321 + return error;
2322 +diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c
2323 +index eeaddfe0c0fb..70b9730c0be6 100644
2324 +--- a/security/apparmor/audit.c
2325 ++++ b/security/apparmor/audit.c
2326 +@@ -201,8 +201,9 @@ int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule)
2327 + rule->label = aa_label_parse(&root_ns->unconfined->label, rulestr,
2328 + GFP_KERNEL, true, false);
2329 + if (IS_ERR(rule->label)) {
2330 ++ int err = PTR_ERR(rule->label);
2331 + aa_audit_rule_free(rule);
2332 +- return PTR_ERR(rule->label);
2333 ++ return err;
2334 + }
2335 +
2336 + *vrule = rule;
2337 +diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
2338 +index bdf9e4cefe25..b9d5b3459705 100644
2339 +--- a/security/apparmor/domain.c
2340 ++++ b/security/apparmor/domain.c
2341 +@@ -1338,6 +1338,7 @@ int aa_change_profile(const char *fqname, int flags)
2342 + ctx->nnp = aa_get_label(label);
2343 +
2344 + if (!fqname || !*fqname) {
2345 ++ aa_put_label(label);
2346 + AA_DEBUG("no profile name");
2347 + return -EINVAL;
2348 + }
2349 +@@ -1356,8 +1357,6 @@ int aa_change_profile(const char *fqname, int flags)
2350 + op = OP_CHANGE_PROFILE;
2351 + }
2352 +
2353 +- label = aa_get_current_label();
2354 +-
2355 + if (*fqname == '&') {
2356 + stack = true;
2357 + /* don't have label_parse() do stacking */
2358 +diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
2359 +index 6a314fb0d480..f0878d81dcef 100644
2360 +--- a/security/integrity/evm/evm_crypto.c
2361 ++++ b/security/integrity/evm/evm_crypto.c
2362 +@@ -96,7 +96,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)
2363 + algo = hash_algo_name[hash_algo];
2364 + }
2365 +
2366 +- if (*tfm == NULL) {
2367 ++ if (IS_ERR_OR_NULL(*tfm)) {
2368 + mutex_lock(&mutex);
2369 + if (*tfm)
2370 + goto out;
2371 +diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
2372 +index f63b4bd45d60..6a6d19ada66a 100644
2373 +--- a/security/integrity/ima/ima_crypto.c
2374 ++++ b/security/integrity/ima/ima_crypto.c
2375 +@@ -415,7 +415,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
2376 + loff_t i_size;
2377 + int rc;
2378 + struct file *f = file;
2379 +- bool new_file_instance = false, modified_flags = false;
2380 ++ bool new_file_instance = false, modified_mode = false;
2381 +
2382 + /*
2383 + * For consistency, fail file's opened with the O_DIRECT flag on
2384 +@@ -435,13 +435,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
2385 + f = dentry_open(&file->f_path, flags, file->f_cred);
2386 + if (IS_ERR(f)) {
2387 + /*
2388 +- * Cannot open the file again, lets modify f_flags
2389 ++ * Cannot open the file again, lets modify f_mode
2390 + * of original and continue
2391 + */
2392 + pr_info_ratelimited("Unable to reopen file for reading.\n");
2393 + f = file;
2394 +- f->f_flags |= FMODE_READ;
2395 +- modified_flags = true;
2396 ++ f->f_mode |= FMODE_READ;
2397 ++ modified_mode = true;
2398 + } else {
2399 + new_file_instance = true;
2400 + }
2401 +@@ -459,8 +459,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
2402 + out:
2403 + if (new_file_instance)
2404 + fput(f);
2405 +- else if (modified_flags)
2406 +- f->f_flags &= ~FMODE_READ;
2407 ++ else if (modified_mode)
2408 ++ f->f_mode &= ~FMODE_READ;
2409 + return rc;
2410 + }
2411 +
2412 +diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
2413 +index cfb8cc3b975e..604cdac63d84 100644
2414 +--- a/security/integrity/ima/ima_fs.c
2415 ++++ b/security/integrity/ima/ima_fs.c
2416 +@@ -343,8 +343,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,
2417 + integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL,
2418 + "policy_update", "signed policy required",
2419 + 1, 0);
2420 +- if (ima_appraise & IMA_APPRAISE_ENFORCE)
2421 +- result = -EACCES;
2422 ++ result = -EACCES;
2423 + } else {
2424 + result = ima_parse_add_rule(data);
2425 + }
2426 +diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
2427 +index ad52126d3d22..56295936387c 100644
2428 +--- a/sound/core/pcm_lib.c
2429 ++++ b/sound/core/pcm_lib.c
2430 +@@ -438,6 +438,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
2431 +
2432 + no_delta_check:
2433 + if (runtime->status->hw_ptr == new_hw_ptr) {
2434 ++ runtime->hw_ptr_jiffies = curr_jiffies;
2435 + update_audio_tstamp(substream, &curr_tstamp, &audio_tstamp);
2436 + return 0;
2437 + }
2438 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2439 +index ffe1340890c9..09a37d4c81ec 100644
2440 +--- a/sound/pci/hda/patch_realtek.c
2441 ++++ b/sound/pci/hda/patch_realtek.c
2442 +@@ -2443,6 +2443,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2443 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2444 + SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2445 + SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
2446 ++ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
2447 + SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2448 + SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2449 + SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2450 +@@ -2458,6 +2459,9 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2451 + SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2452 + SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2453 + SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2454 ++ SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2455 ++ SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2456 ++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2457 + SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2458 + SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2459 + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2460 +diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
2461 +index f1fe497c2f9d..7702b62dc18b 100644
2462 +--- a/sound/pci/ice1712/ice1712.c
2463 ++++ b/sound/pci/ice1712/ice1712.c
2464 +@@ -2377,7 +2377,8 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice)
2465 + pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]);
2466 + pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]);
2467 + pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]);
2468 +- if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) {
2469 ++ if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24 &&
2470 ++ ice->eeprom.subvendor != ICE1712_SUBDEVICE_STAUDIO_ADCIII) {
2471 + ice->gpio.write_mask = ice->eeprom.gpiomask;
2472 + ice->gpio.direction = ice->eeprom.gpiodir;
2473 + snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,