Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Wed, 15 Nov 2017 15:44:25
Message-Id: 1510760653.c545d22f91460ae91839616f83d67f81ce45642a.mpagano@gentoo
1 commit: c545d22f91460ae91839616f83d67f81ce45642a
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 15 15:44:13 2017 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 15 15:44:13 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=c545d22f
7
8 Linux patch 4.9.62
9
10 0000_README | 4 +
11 1061_linux-4.9.62.patch | 2934 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 2938 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 664ecce..d127ff4 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -287,6 +287,10 @@ Patch: 1060_linux-4.9.61.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.61
21
22 +Patch: 1061_linux-4.9.62.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.62
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1061_linux-4.9.62.patch b/1061_linux-4.9.62.patch
31 new file mode 100644
32 index 0000000..2283bf9
33 --- /dev/null
34 +++ b/1061_linux-4.9.62.patch
35 @@ -0,0 +1,2934 @@
36 +diff --git a/Documentation/devicetree/bindings/arm/davinci.txt b/Documentation/devicetree/bindings/arm/davinci.txt
37 +index f0841ce725b5..715622c36260 100644
38 +--- a/Documentation/devicetree/bindings/arm/davinci.txt
39 ++++ b/Documentation/devicetree/bindings/arm/davinci.txt
40 +@@ -13,6 +13,10 @@ EnBW AM1808 based CMC board
41 + Required root node properties:
42 + - compatible = "enbw,cmc", "ti,da850;
43 +
44 ++LEGO MINDSTORMS EV3 (AM1808 based)
45 ++Required root node properties:
46 ++ - compatible = "lego,ev3", "ti,da850";
47 ++
48 + Generic DaVinci Boards
49 + ----------------------
50 +
51 +diff --git a/Documentation/devicetree/bindings/clock/qoriq-clock.txt b/Documentation/devicetree/bindings/clock/qoriq-clock.txt
52 +index 16a3ec433119..1bd2c76396f4 100644
53 +--- a/Documentation/devicetree/bindings/clock/qoriq-clock.txt
54 ++++ b/Documentation/devicetree/bindings/clock/qoriq-clock.txt
55 +@@ -31,6 +31,7 @@ Required properties:
56 + * "fsl,t4240-clockgen"
57 + * "fsl,b4420-clockgen"
58 + * "fsl,b4860-clockgen"
59 ++ * "fsl,ls1012a-clockgen"
60 + * "fsl,ls1021a-clockgen"
61 + Chassis-version clock strings include:
62 + * "fsl,qoriq-clockgen-1.0": for chassis 1.0 clocks
63 +diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
64 +index bceffffb7502..f949a22bcd74 100644
65 +--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
66 ++++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
67 +@@ -154,6 +154,7 @@ kosagi Sutajio Ko-Usagi PTE Ltd.
68 + kyo Kyocera Corporation
69 + lacie LaCie
70 + lantiq Lantiq Semiconductor
71 ++lego LEGO Systems A/S
72 + lenovo Lenovo Group Ltd.
73 + lg LG Corporation
74 + linux Linux-specific binding
75 +diff --git a/Makefile b/Makefile
76 +index b56b99e20b30..8ab48891d088 100644
77 +--- a/Makefile
78 ++++ b/Makefile
79 +@@ -1,6 +1,6 @@
80 + VERSION = 4
81 + PATCHLEVEL = 9
82 +-SUBLEVEL = 61
83 ++SUBLEVEL = 62
84 + EXTRAVERSION =
85 + NAME = Roaring Lionus
86 +
87 +diff --git a/arch/arm/boot/dts/imx53-qsb-common.dtsi b/arch/arm/boot/dts/imx53-qsb-common.dtsi
88 +index c05e7cfd0cbc..40b3e31935d0 100644
89 +--- a/arch/arm/boot/dts/imx53-qsb-common.dtsi
90 ++++ b/arch/arm/boot/dts/imx53-qsb-common.dtsi
91 +@@ -215,16 +215,16 @@
92 +
93 + pinctrl_fec: fecgrp {
94 + fsl,pins = <
95 +- MX53_PAD_FEC_MDC__FEC_MDC 0x80000000
96 +- MX53_PAD_FEC_MDIO__FEC_MDIO 0x80000000
97 +- MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x80000000
98 +- MX53_PAD_FEC_RX_ER__FEC_RX_ER 0x80000000
99 +- MX53_PAD_FEC_CRS_DV__FEC_RX_DV 0x80000000
100 +- MX53_PAD_FEC_RXD1__FEC_RDATA_1 0x80000000
101 +- MX53_PAD_FEC_RXD0__FEC_RDATA_0 0x80000000
102 +- MX53_PAD_FEC_TX_EN__FEC_TX_EN 0x80000000
103 +- MX53_PAD_FEC_TXD1__FEC_TDATA_1 0x80000000
104 +- MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x80000000
105 ++ MX53_PAD_FEC_MDC__FEC_MDC 0x4
106 ++ MX53_PAD_FEC_MDIO__FEC_MDIO 0x1fc
107 ++ MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x180
108 ++ MX53_PAD_FEC_RX_ER__FEC_RX_ER 0x180
109 ++ MX53_PAD_FEC_CRS_DV__FEC_RX_DV 0x180
110 ++ MX53_PAD_FEC_RXD1__FEC_RDATA_1 0x180
111 ++ MX53_PAD_FEC_RXD0__FEC_RDATA_0 0x180
112 ++ MX53_PAD_FEC_TX_EN__FEC_TX_EN 0x4
113 ++ MX53_PAD_FEC_TXD1__FEC_TDATA_1 0x4
114 ++ MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x4
115 + >;
116 + };
117 +
118 +diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi
119 +index a3ef7341c051..4d329b2908be 100644
120 +--- a/arch/arm/boot/dts/stih410.dtsi
121 ++++ b/arch/arm/boot/dts/stih410.dtsi
122 +@@ -131,7 +131,7 @@
123 + <&clk_s_d2_quadfs 0>;
124 +
125 + assigned-clock-rates = <297000000>,
126 +- <108000000>,
127 ++ <297000000>,
128 + <0>,
129 + <400000000>,
130 + <400000000>;
131 +diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
132 +index 53e1a884a1ea..66d71963761d 100644
133 +--- a/arch/arm/configs/omap2plus_defconfig
134 ++++ b/arch/arm/configs/omap2plus_defconfig
135 +@@ -216,6 +216,7 @@ CONFIG_SERIO=m
136 + CONFIG_SERIAL_8250=y
137 + CONFIG_SERIAL_8250_CONSOLE=y
138 + CONFIG_SERIAL_8250_NR_UARTS=32
139 ++CONFIG_SERIAL_8250_RUNTIME_UARTS=6
140 + CONFIG_SERIAL_8250_EXTENDED=y
141 + CONFIG_SERIAL_8250_MANY_PORTS=y
142 + CONFIG_SERIAL_8250_SHARE_IRQ=y
143 +diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
144 +index 9688ec0c6ef4..1b304897aa12 100644
145 +--- a/arch/arm/kernel/traps.c
146 ++++ b/arch/arm/kernel/traps.c
147 +@@ -152,30 +152,26 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
148 + set_fs(fs);
149 + }
150 +
151 +-static void dump_instr(const char *lvl, struct pt_regs *regs)
152 ++static void __dump_instr(const char *lvl, struct pt_regs *regs)
153 + {
154 + unsigned long addr = instruction_pointer(regs);
155 + const int thumb = thumb_mode(regs);
156 + const int width = thumb ? 4 : 8;
157 +- mm_segment_t fs;
158 + char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
159 + int i;
160 +
161 + /*
162 +- * We need to switch to kernel mode so that we can use __get_user
163 +- * to safely read from kernel space. Note that we now dump the
164 +- * code first, just in case the backtrace kills us.
165 ++ * Note that we now dump the code first, just in case the backtrace
166 ++ * kills us.
167 + */
168 +- fs = get_fs();
169 +- set_fs(KERNEL_DS);
170 +
171 + for (i = -4; i < 1 + !!thumb; i++) {
172 + unsigned int val, bad;
173 +
174 + if (thumb)
175 +- bad = __get_user(val, &((u16 *)addr)[i]);
176 ++ bad = get_user(val, &((u16 *)addr)[i]);
177 + else
178 +- bad = __get_user(val, &((u32 *)addr)[i]);
179 ++ bad = get_user(val, &((u32 *)addr)[i]);
180 +
181 + if (!bad)
182 + p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
183 +@@ -186,8 +182,20 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
184 + }
185 + }
186 + printk("%sCode: %s\n", lvl, str);
187 ++}
188 +
189 +- set_fs(fs);
190 ++static void dump_instr(const char *lvl, struct pt_regs *regs)
191 ++{
192 ++ mm_segment_t fs;
193 ++
194 ++ if (!user_mode(regs)) {
195 ++ fs = get_fs();
196 ++ set_fs(KERNEL_DS);
197 ++ __dump_instr(lvl, regs);
198 ++ set_fs(fs);
199 ++ } else {
200 ++ __dump_instr(lvl, regs);
201 ++ }
202 + }
203 +
204 + #ifdef CONFIG_ARM_UNWIND
205 +diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
206 +index b5bf46ce873b..cab3574ab7d9 100644
207 +--- a/arch/arm64/mm/dma-mapping.c
208 ++++ b/arch/arm64/mm/dma-mapping.c
209 +@@ -836,14 +836,21 @@ static bool do_iommu_attach(struct device *dev, const struct iommu_ops *ops,
210 + * then the IOMMU core will have already configured a group for this
211 + * device, and allocated the default domain for that group.
212 + */
213 +- if (!domain || iommu_dma_init_domain(domain, dma_base, size, dev)) {
214 +- pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
215 +- dev_name(dev));
216 +- return false;
217 ++ if (!domain)
218 ++ goto out_err;
219 ++
220 ++ if (domain->type == IOMMU_DOMAIN_DMA) {
221 ++ if (iommu_dma_init_domain(domain, dma_base, size, dev))
222 ++ goto out_err;
223 ++
224 ++ dev->archdata.dma_ops = &iommu_dma_ops;
225 + }
226 +
227 +- dev->archdata.dma_ops = &iommu_dma_ops;
228 + return true;
229 ++out_err:
230 ++ pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
231 ++ dev_name(dev));
232 ++ return false;
233 + }
234 +
235 + static void queue_iommu_attach(struct device *dev, const struct iommu_ops *ops,
236 +diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
237 +index 58fca9ad5fcc..3446b6fb3acb 100644
238 +--- a/arch/mips/ar7/platform.c
239 ++++ b/arch/mips/ar7/platform.c
240 +@@ -576,6 +576,7 @@ static int __init ar7_register_uarts(void)
241 + uart_port.type = PORT_AR7;
242 + uart_port.uartclk = clk_get_rate(bus_clk) / 2;
243 + uart_port.iotype = UPIO_MEM32;
244 ++ uart_port.flags = UPF_FIXED_TYPE;
245 + uart_port.regshift = 2;
246 +
247 + uart_port.line = 0;
248 +@@ -654,6 +655,10 @@ static int __init ar7_register_devices(void)
249 + u32 val;
250 + int res;
251 +
252 ++ res = ar7_gpio_init();
253 ++ if (res)
254 ++ pr_warn("unable to register gpios: %d\n", res);
255 ++
256 + res = ar7_register_uarts();
257 + if (res)
258 + pr_err("unable to setup uart(s): %d\n", res);
259 +diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
260 +index a23adc49d50f..36aabee9cba4 100644
261 +--- a/arch/mips/ar7/prom.c
262 ++++ b/arch/mips/ar7/prom.c
263 +@@ -246,8 +246,6 @@ void __init prom_init(void)
264 + ar7_init_cmdline(fw_arg0, (char **)fw_arg1);
265 + ar7_init_env((struct env_var *)fw_arg2);
266 + console_config();
267 +-
268 +- ar7_gpio_init();
269 + }
270 +
271 + #define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))
272 +diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
273 +index 2e4180797b21..b6845db453a3 100644
274 +--- a/arch/mips/include/asm/mips-cm.h
275 ++++ b/arch/mips/include/asm/mips-cm.h
276 +@@ -239,8 +239,8 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80)
277 + #define CM_GCR_BASE_GCRBASE_MSK (_ULCAST_(0x1ffff) << 15)
278 + #define CM_GCR_BASE_CMDEFTGT_SHF 0
279 + #define CM_GCR_BASE_CMDEFTGT_MSK (_ULCAST_(0x3) << 0)
280 +-#define CM_GCR_BASE_CMDEFTGT_DISABLED 0
281 +-#define CM_GCR_BASE_CMDEFTGT_MEM 1
282 ++#define CM_GCR_BASE_CMDEFTGT_MEM 0
283 ++#define CM_GCR_BASE_CMDEFTGT_RESERVED 1
284 + #define CM_GCR_BASE_CMDEFTGT_IOCU0 2
285 + #define CM_GCR_BASE_CMDEFTGT_IOCU1 3
286 +
287 +diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
288 +index 1b50958a1373..c558bce989cd 100644
289 +--- a/arch/mips/kernel/process.c
290 ++++ b/arch/mips/kernel/process.c
291 +@@ -50,9 +50,7 @@
292 + #ifdef CONFIG_HOTPLUG_CPU
293 + void arch_cpu_idle_dead(void)
294 + {
295 +- /* What the heck is this check doing ? */
296 +- if (!cpumask_test_cpu(smp_processor_id(), &cpu_callin_map))
297 +- play_dead();
298 ++ play_dead();
299 + }
300 + #endif
301 +
302 +diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
303 +index 6d0f1321e084..47c9646f93b3 100644
304 +--- a/arch/mips/kernel/smp-bmips.c
305 ++++ b/arch/mips/kernel/smp-bmips.c
306 +@@ -587,11 +587,11 @@ void __init bmips_cpu_setup(void)
307 +
308 + /* Flush and enable RAC */
309 + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
310 +- __raw_writel(cfg | 0x100, BMIPS_RAC_CONFIG);
311 ++ __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
312 + __raw_readl(cbr + BMIPS_RAC_CONFIG);
313 +
314 + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
315 +- __raw_writel(cfg | 0xf, BMIPS_RAC_CONFIG);
316 ++ __raw_writel(cfg | 0xf, cbr + BMIPS_RAC_CONFIG);
317 + __raw_readl(cbr + BMIPS_RAC_CONFIG);
318 +
319 + cfg = __raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE);
320 +diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
321 +index 7ebb1918e2ac..95ba4271af6a 100644
322 +--- a/arch/mips/kernel/smp.c
323 ++++ b/arch/mips/kernel/smp.c
324 +@@ -68,6 +68,9 @@ EXPORT_SYMBOL(cpu_sibling_map);
325 + cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
326 + EXPORT_SYMBOL(cpu_core_map);
327 +
328 ++static DECLARE_COMPLETION(cpu_starting);
329 ++static DECLARE_COMPLETION(cpu_running);
330 ++
331 + /*
332 + * A logcal cpu mask containing only one VPE per core to
333 + * reduce the number of IPIs on large MT systems.
334 +@@ -369,9 +372,12 @@ asmlinkage void start_secondary(void)
335 + cpumask_set_cpu(cpu, &cpu_coherent_mask);
336 + notify_cpu_starting(cpu);
337 +
338 +- cpumask_set_cpu(cpu, &cpu_callin_map);
339 ++ /* Notify boot CPU that we're starting & ready to sync counters */
340 ++ complete(&cpu_starting);
341 ++
342 + synchronise_count_slave(cpu);
343 +
344 ++ /* The CPU is running and counters synchronised, now mark it online */
345 + set_cpu_online(cpu, true);
346 +
347 + set_cpu_sibling_map(cpu);
348 +@@ -379,6 +385,12 @@ asmlinkage void start_secondary(void)
349 +
350 + calculate_cpu_foreign_map();
351 +
352 ++ /*
353 ++ * Notify boot CPU that we're up & online and it can safely return
354 ++ * from __cpu_up
355 ++ */
356 ++ complete(&cpu_running);
357 ++
358 + /*
359 + * irq will be enabled in ->smp_finish(), enabling it too early
360 + * is dangerous.
361 +@@ -430,22 +442,23 @@ void smp_prepare_boot_cpu(void)
362 + {
363 + set_cpu_possible(0, true);
364 + set_cpu_online(0, true);
365 +- cpumask_set_cpu(0, &cpu_callin_map);
366 + }
367 +
368 + int __cpu_up(unsigned int cpu, struct task_struct *tidle)
369 + {
370 + mp_ops->boot_secondary(cpu, tidle);
371 +
372 +- /*
373 +- * Trust is futile. We should really have timeouts ...
374 +- */
375 +- while (!cpumask_test_cpu(cpu, &cpu_callin_map)) {
376 +- udelay(100);
377 +- schedule();
378 ++ /* Wait for CPU to start and be ready to sync counters */
379 ++ if (!wait_for_completion_timeout(&cpu_starting,
380 ++ msecs_to_jiffies(1000))) {
381 ++ pr_crit("CPU%u: failed to start\n", cpu);
382 ++ return -EIO;
383 + }
384 +
385 + synchronise_count_master(cpu);
386 ++
387 ++ /* Wait for CPU to finish startup & mark itself online before return */
388 ++ wait_for_completion(&cpu_running);
389 + return 0;
390 + }
391 +
392 +diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
393 +index 277cf52d80e1..6c17cba7f383 100644
394 +--- a/arch/mips/mm/uasm-micromips.c
395 ++++ b/arch/mips/mm/uasm-micromips.c
396 +@@ -80,7 +80,7 @@ static struct insn insn_table_MM[] = {
397 + { insn_jr, M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS },
398 + { insn_lb, M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM },
399 + { insn_ld, 0, 0 },
400 +- { insn_lh, M(mm_lh32_op, 0, 0, 0, 0, 0), RS | RS | SIMM },
401 ++ { insn_lh, M(mm_lh32_op, 0, 0, 0, 0, 0), RT | RS | SIMM },
402 + { insn_ll, M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM },
403 + { insn_lld, 0, 0 },
404 + { insn_lui, M(mm_pool32i_op, mm_lui_op, 0, 0, 0, 0), RS | SIMM },
405 +diff --git a/arch/powerpc/boot/dts/fsl/kmcoge4.dts b/arch/powerpc/boot/dts/fsl/kmcoge4.dts
406 +index ae70a24094b0..e103c0f3f650 100644
407 +--- a/arch/powerpc/boot/dts/fsl/kmcoge4.dts
408 ++++ b/arch/powerpc/boot/dts/fsl/kmcoge4.dts
409 +@@ -83,6 +83,10 @@
410 + };
411 + };
412 +
413 ++ sdhc@114000 {
414 ++ status = "disabled";
415 ++ };
416 ++
417 + i2c@119000 {
418 + status = "disabled";
419 + };
420 +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
421 +index bc3f7d0d7b79..f1d7e996e673 100644
422 +--- a/arch/powerpc/kernel/time.c
423 ++++ b/arch/powerpc/kernel/time.c
424 +@@ -407,6 +407,7 @@ void arch_vtime_task_switch(struct task_struct *prev)
425 + struct cpu_accounting_data *acct = get_accounting(current);
426 +
427 + acct->starttime = get_accounting(prev)->starttime;
428 ++ acct->startspurr = get_accounting(prev)->startspurr;
429 + acct->system_time = 0;
430 + acct->user_time = 0;
431 + }
432 +diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
433 +index a0ea63ac2b52..a8e3498a853f 100644
434 +--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
435 ++++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
436 +@@ -376,6 +376,7 @@ static void icp_rm_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
437 + */
438 + if (reject && reject != XICS_IPI) {
439 + arch_spin_unlock(&ics->lock);
440 ++ icp->n_reject++;
441 + new_irq = reject;
442 + goto again;
443 + }
444 +@@ -707,10 +708,8 @@ int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
445 + state = &ics->irq_state[src];
446 +
447 + /* Still asserted, resend it */
448 +- if (state->asserted) {
449 +- icp->n_reject++;
450 ++ if (state->asserted)
451 + icp_rm_deliver_irq(xics, icp, irq);
452 +- }
453 +
454 + if (!hlist_empty(&vcpu->kvm->irq_ack_notifier_list)) {
455 + icp->rm_action |= XICS_RM_NOTIFY_EOI;
456 +diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
457 +index 2374c5b46bbc..0c196861bc38 100644
458 +--- a/arch/s390/kernel/early.c
459 ++++ b/arch/s390/kernel/early.c
460 +@@ -363,6 +363,18 @@ static inline void save_vector_registers(void)
461 + #endif
462 + }
463 +
464 ++static int __init topology_setup(char *str)
465 ++{
466 ++ bool enabled;
467 ++ int rc;
468 ++
469 ++ rc = kstrtobool(str, &enabled);
470 ++ if (!rc && !enabled)
471 ++ S390_lowcore.machine_flags &= ~MACHINE_HAS_TOPOLOGY;
472 ++ return rc;
473 ++}
474 ++early_param("topology", topology_setup);
475 ++
476 + static int __init disable_vector_extension(char *str)
477 + {
478 + S390_lowcore.machine_flags &= ~MACHINE_FLAG_VX;
479 +diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
480 +index 8705ee66c087..239f29508f0b 100644
481 +--- a/arch/s390/kernel/topology.c
482 ++++ b/arch/s390/kernel/topology.c
483 +@@ -37,7 +37,6 @@ static void set_topology_timer(void);
484 + static void topology_work_fn(struct work_struct *work);
485 + static struct sysinfo_15_1_x *tl_info;
486 +
487 +-static bool topology_enabled = true;
488 + static DECLARE_WORK(topology_work, topology_work_fn);
489 +
490 + /*
491 +@@ -56,7 +55,7 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
492 + cpumask_t mask;
493 +
494 + cpumask_copy(&mask, cpumask_of(cpu));
495 +- if (!topology_enabled || !MACHINE_HAS_TOPOLOGY)
496 ++ if (!MACHINE_HAS_TOPOLOGY)
497 + return mask;
498 + for (; info; info = info->next) {
499 + if (cpumask_test_cpu(cpu, &info->mask))
500 +@@ -71,7 +70,7 @@ static cpumask_t cpu_thread_map(unsigned int cpu)
501 + int i;
502 +
503 + cpumask_copy(&mask, cpumask_of(cpu));
504 +- if (!topology_enabled || !MACHINE_HAS_TOPOLOGY)
505 ++ if (!MACHINE_HAS_TOPOLOGY)
506 + return mask;
507 + cpu -= cpu % (smp_cpu_mtid + 1);
508 + for (i = 0; i <= smp_cpu_mtid; i++)
509 +@@ -413,12 +412,6 @@ static const struct cpumask *cpu_drawer_mask(int cpu)
510 + return &per_cpu(cpu_topology, cpu).drawer_mask;
511 + }
512 +
513 +-static int __init early_parse_topology(char *p)
514 +-{
515 +- return kstrtobool(p, &topology_enabled);
516 +-}
517 +-early_param("topology", early_parse_topology);
518 +-
519 + static struct sched_domain_topology_level s390_topology[] = {
520 + { cpu_thread_mask, cpu_smt_flags, SD_INIT_NAME(SMT) },
521 + { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) },
522 +diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
523 +index 538c10db3537..8dc315b212c2 100644
524 +--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
525 ++++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
526 +@@ -165,7 +165,6 @@ static struct plat_sci_port scif2_platform_data = {
527 + .scscr = SCSCR_TE | SCSCR_RE,
528 + .type = PORT_IRDA,
529 + .ops = &sh770x_sci_port_ops,
530 +- .regshift = 1,
531 + };
532 +
533 + static struct resource scif2_resources[] = {
534 +diff --git a/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S
535 +index 96df6a39d7e2..a2ae6891e1fc 100644
536 +--- a/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S
537 ++++ b/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S
538 +@@ -157,8 +157,8 @@ LABEL skip_ %I
539 + .endr
540 +
541 + # Find min length
542 +- vmovdqa _lens+0*16(state), %xmm0
543 +- vmovdqa _lens+1*16(state), %xmm1
544 ++ vmovdqu _lens+0*16(state), %xmm0
545 ++ vmovdqu _lens+1*16(state), %xmm1
546 +
547 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
548 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
549 +@@ -178,8 +178,8 @@ LABEL skip_ %I
550 + vpsubd %xmm2, %xmm0, %xmm0
551 + vpsubd %xmm2, %xmm1, %xmm1
552 +
553 +- vmovdqa %xmm0, _lens+0*16(state)
554 +- vmovdqa %xmm1, _lens+1*16(state)
555 ++ vmovdqu %xmm0, _lens+0*16(state)
556 ++ vmovdqu %xmm1, _lens+1*16(state)
557 +
558 + # "state" and "args" are the same address, arg1
559 + # len is arg2
560 +@@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2)
561 + jc .return_null
562 +
563 + # Find min length
564 +- vmovdqa _lens(state), %xmm0
565 +- vmovdqa _lens+1*16(state), %xmm1
566 ++ vmovdqu _lens(state), %xmm0
567 ++ vmovdqu _lens+1*16(state), %xmm1
568 +
569 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
570 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
571 +diff --git a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
572 +index a78a0694ddef..ec9bee661d50 100644
573 +--- a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
574 ++++ b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
575 +@@ -155,8 +155,8 @@ LABEL skip_ %I
576 + .endr
577 +
578 + # Find min length
579 +- vmovdqa _lens+0*16(state), %xmm0
580 +- vmovdqa _lens+1*16(state), %xmm1
581 ++ vmovdqu _lens+0*16(state), %xmm0
582 ++ vmovdqu _lens+1*16(state), %xmm1
583 +
584 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
585 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
586 +@@ -176,8 +176,8 @@ LABEL skip_ %I
587 + vpsubd %xmm2, %xmm0, %xmm0
588 + vpsubd %xmm2, %xmm1, %xmm1
589 +
590 +- vmovdqa %xmm0, _lens+0*16(state)
591 +- vmovdqa %xmm1, _lens+1*16(state)
592 ++ vmovdqu %xmm0, _lens+0*16(state)
593 ++ vmovdqu %xmm1, _lens+1*16(state)
594 +
595 + # "state" and "args" are the same address, arg1
596 + # len is arg2
597 +@@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2)
598 + jc .return_null
599 +
600 + # Find min length
601 +- vmovdqa _lens(state), %xmm0
602 +- vmovdqa _lens+1*16(state), %xmm1
603 ++ vmovdqu _lens(state), %xmm0
604 ++ vmovdqu _lens+1*16(state), %xmm1
605 +
606 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
607 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
608 +diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
609 +index a300aa10ebc5..dead0f3921f3 100644
610 +--- a/arch/x86/include/asm/uaccess.h
611 ++++ b/arch/x86/include/asm/uaccess.h
612 +@@ -68,6 +68,12 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
613 + __chk_range_not_ok((unsigned long __force)(addr), size, limit); \
614 + })
615 +
616 ++#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
617 ++# define WARN_ON_IN_IRQ() WARN_ON_ONCE(!in_task())
618 ++#else
619 ++# define WARN_ON_IN_IRQ()
620 ++#endif
621 ++
622 + /**
623 + * access_ok: - Checks if a user space pointer is valid
624 + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
625 +@@ -88,8 +94,11 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
626 + * checks that the pointer is in the user space range - after calling
627 + * this function, memory access functions may still return -EFAULT.
628 + */
629 +-#define access_ok(type, addr, size) \
630 +- likely(!__range_not_ok(addr, size, user_addr_max()))
631 ++#define access_ok(type, addr, size) \
632 ++({ \
633 ++ WARN_ON_IN_IRQ(); \
634 ++ likely(!__range_not_ok(addr, size, user_addr_max())); \
635 ++})
636 +
637 + /*
638 + * These are the main single-value transfer routines. They automatically
639 +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
640 +index 36171bcd91f8..9fe7b9e1ae30 100644
641 +--- a/arch/x86/kernel/smpboot.c
642 ++++ b/arch/x86/kernel/smpboot.c
643 +@@ -180,6 +180,12 @@ static void smp_callin(void)
644 + */
645 + smp_store_cpu_info(cpuid);
646 +
647 ++ /*
648 ++ * The topology information must be up to date before
649 ++ * calibrate_delay() and notify_cpu_starting().
650 ++ */
651 ++ set_cpu_sibling_map(raw_smp_processor_id());
652 ++
653 + /*
654 + * Get our bogomips.
655 + * Update loops_per_jiffy in cpu_data. Previous call to
656 +@@ -190,11 +196,6 @@ static void smp_callin(void)
657 + cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy;
658 + pr_debug("Stack at about %p\n", &cpuid);
659 +
660 +- /*
661 +- * This must be done before setting cpu_online_mask
662 +- * or calling notify_cpu_starting.
663 +- */
664 +- set_cpu_sibling_map(raw_smp_processor_id());
665 + wmb();
666 +
667 + notify_cpu_starting(cpuid);
668 +diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
669 +index 6e57edf33d75..44bf5cf417d3 100644
670 +--- a/arch/x86/kernel/tsc.c
671 ++++ b/arch/x86/kernel/tsc.c
672 +@@ -1382,12 +1382,10 @@ void __init tsc_init(void)
673 + unsigned long calibrate_delay_is_known(void)
674 + {
675 + int sibling, cpu = smp_processor_id();
676 +- struct cpumask *mask = topology_core_cpumask(cpu);
677 ++ int constant_tsc = cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC);
678 ++ const struct cpumask *mask = topology_core_cpumask(cpu);
679 +
680 +- if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC))
681 +- return 0;
682 +-
683 +- if (!mask)
684 ++ if (tsc_disabled || !constant_tsc || !mask)
685 + return 0;
686 +
687 + sibling = cpumask_any_but(mask, cpu);
688 +diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
689 +index 350f7096baac..7913b6921959 100644
690 +--- a/arch/x86/oprofile/op_model_ppro.c
691 ++++ b/arch/x86/oprofile/op_model_ppro.c
692 +@@ -212,8 +212,8 @@ static void arch_perfmon_setup_counters(void)
693 + eax.full = cpuid_eax(0xa);
694 +
695 + /* Workaround for BIOS bugs in 6/15. Taken from perfmon2 */
696 +- if (eax.split.version_id == 0 && __this_cpu_read(cpu_info.x86) == 6 &&
697 +- __this_cpu_read(cpu_info.x86_model) == 15) {
698 ++ if (eax.split.version_id == 0 && boot_cpu_data.x86 == 6 &&
699 ++ boot_cpu_data.x86_model == 15) {
700 + eax.split.version_id = 2;
701 + eax.split.num_counters = 2;
702 + eax.split.bit_width = 40;
703 +diff --git a/crypto/ccm.c b/crypto/ccm.c
704 +index 006d8575ef5c..b3ace633fae9 100644
705 +--- a/crypto/ccm.c
706 ++++ b/crypto/ccm.c
707 +@@ -413,7 +413,7 @@ static int crypto_ccm_decrypt(struct aead_request *req)
708 + unsigned int cryptlen = req->cryptlen;
709 + u8 *authtag = pctx->auth_tag;
710 + u8 *odata = pctx->odata;
711 +- u8 *iv = req->iv;
712 ++ u8 *iv = pctx->idata;
713 + int err;
714 +
715 + cryptlen -= authsize;
716 +@@ -429,6 +429,8 @@ static int crypto_ccm_decrypt(struct aead_request *req)
717 + if (req->src != req->dst)
718 + dst = pctx->dst;
719 +
720 ++ memcpy(iv, req->iv, 16);
721 ++
722 + skcipher_request_set_tfm(skreq, ctx->ctr);
723 + skcipher_request_set_callback(skreq, pctx->flags,
724 + crypto_ccm_decrypt_done, req);
725 +diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c
726 +index 5552211e6fcd..b52c617947ad 100644
727 +--- a/drivers/base/power/opp/of.c
728 ++++ b/drivers/base/power/opp/of.c
729 +@@ -386,7 +386,7 @@ static int _of_add_opp_table_v1(struct device *dev)
730 + {
731 + const struct property *prop;
732 + const __be32 *val;
733 +- int nr;
734 ++ int nr, ret;
735 +
736 + prop = of_find_property(dev->of_node, "operating-points", NULL);
737 + if (!prop)
738 +@@ -409,9 +409,13 @@ static int _of_add_opp_table_v1(struct device *dev)
739 + unsigned long freq = be32_to_cpup(val++) * 1000;
740 + unsigned long volt = be32_to_cpup(val++);
741 +
742 +- if (_opp_add_v1(dev, freq, volt, false))
743 +- dev_warn(dev, "%s: Failed to add OPP %ld\n",
744 +- __func__, freq);
745 ++ ret = _opp_add_v1(dev, freq, volt, false);
746 ++ if (ret) {
747 ++ dev_err(dev, "%s: Failed to add OPP %ld (%d)\n",
748 ++ __func__, freq, ret);
749 ++ dev_pm_opp_of_remove_table(dev);
750 ++ return ret;
751 ++ }
752 + nr -= 2;
753 + }
754 +
755 +diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
756 +index 7b274ff4632c..24f4b544d270 100644
757 +--- a/drivers/block/rbd.c
758 ++++ b/drivers/block/rbd.c
759 +@@ -2788,7 +2788,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
760 + * from the parent.
761 + */
762 + page_count = (u32)calc_pages_for(0, length);
763 +- pages = ceph_alloc_page_vector(page_count, GFP_KERNEL);
764 ++ pages = ceph_alloc_page_vector(page_count, GFP_NOIO);
765 + if (IS_ERR(pages)) {
766 + result = PTR_ERR(pages);
767 + pages = NULL;
768 +@@ -2922,7 +2922,7 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
769 + */
770 + size = sizeof (__le64) + sizeof (__le32) + sizeof (__le32);
771 + page_count = (u32)calc_pages_for(0, size);
772 +- pages = ceph_alloc_page_vector(page_count, GFP_KERNEL);
773 ++ pages = ceph_alloc_page_vector(page_count, GFP_NOIO);
774 + if (IS_ERR(pages)) {
775 + ret = PTR_ERR(pages);
776 + goto fail_stat_request;
777 +diff --git a/drivers/clk/mvebu/ap806-system-controller.c b/drivers/clk/mvebu/ap806-system-controller.c
778 +index 02023baf86c9..962e0c5f6f4d 100644
779 +--- a/drivers/clk/mvebu/ap806-system-controller.c
780 ++++ b/drivers/clk/mvebu/ap806-system-controller.c
781 +@@ -55,21 +55,39 @@ static int ap806_syscon_clk_probe(struct platform_device *pdev)
782 +
783 + freq_mode = reg & AP806_SAR_CLKFREQ_MODE_MASK;
784 + switch (freq_mode) {
785 +- case 0x0 ... 0x5:
786 ++ case 0x0:
787 ++ case 0x1:
788 + cpuclk_freq = 2000;
789 + break;
790 +- case 0x6 ... 0xB:
791 ++ case 0x6:
792 ++ case 0x7:
793 + cpuclk_freq = 1800;
794 + break;
795 +- case 0xC ... 0x11:
796 ++ case 0x4:
797 ++ case 0xB:
798 ++ case 0xD:
799 + cpuclk_freq = 1600;
800 + break;
801 +- case 0x12 ... 0x16:
802 ++ case 0x1a:
803 + cpuclk_freq = 1400;
804 + break;
805 +- case 0x17 ... 0x19:
806 ++ case 0x14:
807 ++ case 0x17:
808 + cpuclk_freq = 1300;
809 + break;
810 ++ case 0x19:
811 ++ cpuclk_freq = 1200;
812 ++ break;
813 ++ case 0x13:
814 ++ case 0x1d:
815 ++ cpuclk_freq = 1000;
816 ++ break;
817 ++ case 0x1c:
818 ++ cpuclk_freq = 800;
819 ++ break;
820 ++ case 0x1b:
821 ++ cpuclk_freq = 600;
822 ++ break;
823 + default:
824 + dev_err(&pdev->dev, "invalid SAR value\n");
825 + return -EINVAL;
826 +diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
827 +index ea1608682d7f..2fe057326552 100644
828 +--- a/drivers/clk/samsung/clk-exynos5433.c
829 ++++ b/drivers/clk/samsung/clk-exynos5433.c
830 +@@ -2559,8 +2559,10 @@ static const struct samsung_fixed_rate_clock disp_fixed_clks[] __initconst = {
831 + FRATE(0, "phyclk_mipidphy1_bitclkdiv8_phy", NULL, 0, 188000000),
832 + FRATE(0, "phyclk_mipidphy1_rxclkesc0_phy", NULL, 0, 100000000),
833 + /* PHY clocks from MIPI_DPHY0 */
834 +- FRATE(0, "phyclk_mipidphy0_bitclkdiv8_phy", NULL, 0, 188000000),
835 +- FRATE(0, "phyclk_mipidphy0_rxclkesc0_phy", NULL, 0, 100000000),
836 ++ FRATE(CLK_PHYCLK_MIPIDPHY0_BITCLKDIV8_PHY, "phyclk_mipidphy0_bitclkdiv8_phy",
837 ++ NULL, 0, 188000000),
838 ++ FRATE(CLK_PHYCLK_MIPIDPHY0_RXCLKESC0_PHY, "phyclk_mipidphy0_rxclkesc0_phy",
839 ++ NULL, 0, 100000000),
840 + /* PHY clocks from HDMI_PHY */
841 + FRATE(CLK_PHYCLK_HDMIPHY_TMDS_CLKO_PHY, "phyclk_hdmiphy_tmds_clko_phy",
842 + NULL, 0, 300000000),
843 +diff --git a/drivers/crypto/vmx/aes_ctr.c b/drivers/crypto/vmx/aes_ctr.c
844 +index 38ed10d761d0..7cf6d31c1123 100644
845 +--- a/drivers/crypto/vmx/aes_ctr.c
846 ++++ b/drivers/crypto/vmx/aes_ctr.c
847 +@@ -80,11 +80,13 @@ static int p8_aes_ctr_setkey(struct crypto_tfm *tfm, const u8 *key,
848 + int ret;
849 + struct p8_aes_ctr_ctx *ctx = crypto_tfm_ctx(tfm);
850 +
851 ++ preempt_disable();
852 + pagefault_disable();
853 + enable_kernel_vsx();
854 + ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
855 + disable_kernel_vsx();
856 + pagefault_enable();
857 ++ preempt_enable();
858 +
859 + ret += crypto_blkcipher_setkey(ctx->fallback, key, keylen);
860 + return ret;
861 +@@ -99,11 +101,13 @@ static void p8_aes_ctr_final(struct p8_aes_ctr_ctx *ctx,
862 + u8 *dst = walk->dst.virt.addr;
863 + unsigned int nbytes = walk->nbytes;
864 +
865 ++ preempt_disable();
866 + pagefault_disable();
867 + enable_kernel_vsx();
868 + aes_p8_encrypt(ctrblk, keystream, &ctx->enc_key);
869 + disable_kernel_vsx();
870 + pagefault_enable();
871 ++ preempt_enable();
872 +
873 + crypto_xor(keystream, src, nbytes);
874 + memcpy(dst, keystream, nbytes);
875 +@@ -132,6 +136,7 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc *desc,
876 + blkcipher_walk_init(&walk, dst, src, nbytes);
877 + ret = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE);
878 + while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) {
879 ++ preempt_disable();
880 + pagefault_disable();
881 + enable_kernel_vsx();
882 + aes_p8_ctr32_encrypt_blocks(walk.src.virt.addr,
883 +@@ -143,6 +148,7 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc *desc,
884 + walk.iv);
885 + disable_kernel_vsx();
886 + pagefault_enable();
887 ++ preempt_enable();
888 +
889 + /* We need to update IV mostly for last bytes/round */
890 + inc = (nbytes & AES_BLOCK_MASK) / AES_BLOCK_SIZE;
891 +diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
892 +index ee181c53626f..6e197c1c213d 100644
893 +--- a/drivers/edac/amd64_edac.c
894 ++++ b/drivers/edac/amd64_edac.c
895 +@@ -2984,8 +2984,11 @@ static int __init amd64_edac_init(void)
896 + int err = -ENODEV;
897 + int i;
898 +
899 ++ if (!x86_match_cpu(amd64_cpuids))
900 ++ return -ENODEV;
901 ++
902 + if (amd_cache_northbridges() < 0)
903 +- goto err_ret;
904 ++ return -ENODEV;
905 +
906 + opstate_init();
907 +
908 +@@ -2998,14 +3001,16 @@ static int __init amd64_edac_init(void)
909 + if (!msrs)
910 + goto err_free;
911 +
912 +- for (i = 0; i < amd_nb_num(); i++)
913 +- if (probe_one_instance(i)) {
914 ++ for (i = 0; i < amd_nb_num(); i++) {
915 ++ err = probe_one_instance(i);
916 ++ if (err) {
917 + /* unwind properly */
918 + while (--i >= 0)
919 + remove_one_instance(i);
920 +
921 + goto err_pci;
922 + }
923 ++ }
924 +
925 + setup_pci_device();
926 +
927 +@@ -3025,7 +3030,6 @@ static int __init amd64_edac_init(void)
928 + kfree(ecc_stngs);
929 + ecc_stngs = NULL;
930 +
931 +-err_ret:
932 + return err;
933 + }
934 +
935 +diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
936 +index c08870479054..dcb5f9481735 100644
937 +--- a/drivers/edac/amd64_edac.h
938 ++++ b/drivers/edac/amd64_edac.h
939 +@@ -16,6 +16,7 @@
940 + #include <linux/slab.h>
941 + #include <linux/mmzone.h>
942 + #include <linux/edac.h>
943 ++#include <asm/cpu_device_id.h>
944 + #include <asm/msr.h>
945 + #include "edac_core.h"
946 + #include "mce_amd.h"
947 +diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
948 +index afe0480d95c9..8b009b549e45 100644
949 +--- a/drivers/gpu/drm/arm/malidp_planes.c
950 ++++ b/drivers/gpu/drm/arm/malidp_planes.c
951 +@@ -182,7 +182,8 @@ static void malidp_de_plane_update(struct drm_plane *plane,
952 +
953 + /* setup the rotation and axis flip bits */
954 + if (plane->state->rotation & DRM_ROTATE_MASK)
955 +- val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
956 ++ val |= ilog2(plane->state->rotation & DRM_ROTATE_MASK) <<
957 ++ LAYER_ROT_OFFSET;
958 + if (plane->state->rotation & DRM_REFLECT_X)
959 + val |= LAYER_H_FLIP;
960 + if (plane->state->rotation & DRM_REFLECT_Y)
961 +diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
962 +index 213d892b6fa3..a68f94daf9b6 100644
963 +--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
964 ++++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
965 +@@ -325,7 +325,7 @@ static void adv7511_set_link_config(struct adv7511 *adv7511,
966 + adv7511->rgb = config->input_colorspace == HDMI_COLORSPACE_RGB;
967 + }
968 +
969 +-static void adv7511_power_on(struct adv7511 *adv7511)
970 ++static void __adv7511_power_on(struct adv7511 *adv7511)
971 + {
972 + adv7511->current_edid_segment = -1;
973 +
974 +@@ -354,6 +354,11 @@ static void adv7511_power_on(struct adv7511 *adv7511)
975 + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
976 + ADV7511_REG_POWER2_HPD_SRC_MASK,
977 + ADV7511_REG_POWER2_HPD_SRC_NONE);
978 ++}
979 ++
980 ++static void adv7511_power_on(struct adv7511 *adv7511)
981 ++{
982 ++ __adv7511_power_on(adv7511);
983 +
984 + /*
985 + * Most of the registers are reset during power down or when HPD is low.
986 +@@ -362,21 +367,23 @@ static void adv7511_power_on(struct adv7511 *adv7511)
987 +
988 + if (adv7511->type == ADV7533)
989 + adv7533_dsi_power_on(adv7511);
990 +-
991 + adv7511->powered = true;
992 + }
993 +
994 +-static void adv7511_power_off(struct adv7511 *adv7511)
995 ++static void __adv7511_power_off(struct adv7511 *adv7511)
996 + {
997 + /* TODO: setup additional power down modes */
998 + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
999 + ADV7511_POWER_POWER_DOWN,
1000 + ADV7511_POWER_POWER_DOWN);
1001 + regcache_mark_dirty(adv7511->regmap);
1002 ++}
1003 +
1004 ++static void adv7511_power_off(struct adv7511 *adv7511)
1005 ++{
1006 ++ __adv7511_power_off(adv7511);
1007 + if (adv7511->type == ADV7533)
1008 + adv7533_dsi_power_off(adv7511);
1009 +-
1010 + adv7511->powered = false;
1011 + }
1012 +
1013 +@@ -567,23 +574,20 @@ static int adv7511_get_modes(struct adv7511 *adv7511,
1014 +
1015 + /* Reading the EDID only works if the device is powered */
1016 + if (!adv7511->powered) {
1017 +- regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
1018 +- ADV7511_POWER_POWER_DOWN, 0);
1019 +- if (adv7511->i2c_main->irq) {
1020 +- regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(0),
1021 +- ADV7511_INT0_EDID_READY);
1022 +- regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(1),
1023 +- ADV7511_INT1_DDC_ERROR);
1024 +- }
1025 +- adv7511->current_edid_segment = -1;
1026 ++ unsigned int edid_i2c_addr =
1027 ++ (adv7511->i2c_main->addr << 1) + 4;
1028 ++
1029 ++ __adv7511_power_on(adv7511);
1030 ++
1031 ++ /* Reset the EDID_I2C_ADDR register as it might be cleared */
1032 ++ regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR,
1033 ++ edid_i2c_addr);
1034 + }
1035 +
1036 + edid = drm_do_get_edid(connector, adv7511_get_edid_block, adv7511);
1037 +
1038 + if (!adv7511->powered)
1039 +- regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
1040 +- ADV7511_POWER_POWER_DOWN,
1041 +- ADV7511_POWER_POWER_DOWN);
1042 ++ __adv7511_power_off(adv7511);
1043 +
1044 + kfree(adv7511->edid);
1045 + adv7511->edid = edid;
1046 +diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
1047 +index 362b8cd68a24..80a903bd317d 100644
1048 +--- a/drivers/gpu/drm/drm_drv.c
1049 ++++ b/drivers/gpu/drm/drm_drv.c
1050 +@@ -218,7 +218,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
1051 + ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
1052 + if (ret) {
1053 + DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
1054 +- return ret;
1055 ++ goto err_debugfs;
1056 + }
1057 +
1058 + ret = device_add(minor->kdev);
1059 +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
1060 +index a19ec06f9e42..3ce9ba30d827 100644
1061 +--- a/drivers/gpu/drm/i915/intel_drv.h
1062 ++++ b/drivers/gpu/drm/i915/intel_drv.h
1063 +@@ -457,7 +457,6 @@ struct intel_crtc_scaler_state {
1064 +
1065 + struct intel_pipe_wm {
1066 + struct intel_wm_level wm[5];
1067 +- struct intel_wm_level raw_wm[5];
1068 + uint32_t linetime;
1069 + bool fbc_wm_enabled;
1070 + bool pipe_enabled;
1071 +diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
1072 +index 49de4760cc16..277a8026460b 100644
1073 +--- a/drivers/gpu/drm/i915/intel_pm.c
1074 ++++ b/drivers/gpu/drm/i915/intel_pm.c
1075 +@@ -27,6 +27,7 @@
1076 +
1077 + #include <linux/cpufreq.h>
1078 + #include <drm/drm_plane_helper.h>
1079 ++#include <drm/drm_atomic_helper.h>
1080 + #include "i915_drv.h"
1081 + #include "intel_drv.h"
1082 + #include "../../../platform/x86/intel_ips.h"
1083 +@@ -2017,9 +2018,9 @@ static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,
1084 + const struct intel_crtc *intel_crtc,
1085 + int level,
1086 + struct intel_crtc_state *cstate,
1087 +- struct intel_plane_state *pristate,
1088 +- struct intel_plane_state *sprstate,
1089 +- struct intel_plane_state *curstate,
1090 ++ const struct intel_plane_state *pristate,
1091 ++ const struct intel_plane_state *sprstate,
1092 ++ const struct intel_plane_state *curstate,
1093 + struct intel_wm_level *result)
1094 + {
1095 + uint16_t pri_latency = dev_priv->wm.pri_latency[level];
1096 +@@ -2341,28 +2342,24 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
1097 + struct intel_pipe_wm *pipe_wm;
1098 + struct drm_device *dev = state->dev;
1099 + const struct drm_i915_private *dev_priv = to_i915(dev);
1100 +- struct intel_plane *intel_plane;
1101 +- struct intel_plane_state *pristate = NULL;
1102 +- struct intel_plane_state *sprstate = NULL;
1103 +- struct intel_plane_state *curstate = NULL;
1104 ++ struct drm_plane *plane;
1105 ++ const struct drm_plane_state *plane_state;
1106 ++ const struct intel_plane_state *pristate = NULL;
1107 ++ const struct intel_plane_state *sprstate = NULL;
1108 ++ const struct intel_plane_state *curstate = NULL;
1109 + int level, max_level = ilk_wm_max_level(dev), usable_level;
1110 + struct ilk_wm_maximums max;
1111 +
1112 + pipe_wm = &cstate->wm.ilk.optimal;
1113 +
1114 +- for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
1115 +- struct intel_plane_state *ps;
1116 ++ drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, &cstate->base) {
1117 ++ const struct intel_plane_state *ps = to_intel_plane_state(plane_state);
1118 +
1119 +- ps = intel_atomic_get_existing_plane_state(state,
1120 +- intel_plane);
1121 +- if (!ps)
1122 +- continue;
1123 +-
1124 +- if (intel_plane->base.type == DRM_PLANE_TYPE_PRIMARY)
1125 ++ if (plane->type == DRM_PLANE_TYPE_PRIMARY)
1126 + pristate = ps;
1127 +- else if (intel_plane->base.type == DRM_PLANE_TYPE_OVERLAY)
1128 ++ else if (plane->type == DRM_PLANE_TYPE_OVERLAY)
1129 + sprstate = ps;
1130 +- else if (intel_plane->base.type == DRM_PLANE_TYPE_CURSOR)
1131 ++ else if (plane->type == DRM_PLANE_TYPE_CURSOR)
1132 + curstate = ps;
1133 + }
1134 +
1135 +@@ -2384,11 +2381,9 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
1136 + if (pipe_wm->sprites_scaled)
1137 + usable_level = 0;
1138 +
1139 +- ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate,
1140 +- pristate, sprstate, curstate, &pipe_wm->raw_wm[0]);
1141 +-
1142 + memset(&pipe_wm->wm, 0, sizeof(pipe_wm->wm));
1143 +- pipe_wm->wm[0] = pipe_wm->raw_wm[0];
1144 ++ ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate,
1145 ++ pristate, sprstate, curstate, &pipe_wm->wm[0]);
1146 +
1147 + if (IS_HASWELL(dev) || IS_BROADWELL(dev))
1148 + pipe_wm->linetime = hsw_compute_linetime_wm(cstate);
1149 +@@ -2398,8 +2393,8 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
1150 +
1151 + ilk_compute_wm_reg_maximums(dev, 1, &max);
1152 +
1153 +- for (level = 1; level <= max_level; level++) {
1154 +- struct intel_wm_level *wm = &pipe_wm->raw_wm[level];
1155 ++ for (level = 1; level <= usable_level; level++) {
1156 ++ struct intel_wm_level *wm = &pipe_wm->wm[level];
1157 +
1158 + ilk_compute_wm_level(dev_priv, intel_crtc, level, cstate,
1159 + pristate, sprstate, curstate, wm);
1160 +@@ -2409,13 +2404,10 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
1161 + * register maximums since such watermarks are
1162 + * always invalid.
1163 + */
1164 +- if (level > usable_level)
1165 +- continue;
1166 +-
1167 +- if (ilk_validate_wm_level(level, &max, wm))
1168 +- pipe_wm->wm[level] = *wm;
1169 +- else
1170 +- usable_level = level;
1171 ++ if (!ilk_validate_wm_level(level, &max, wm)) {
1172 ++ memset(wm, 0, sizeof(*wm));
1173 ++ break;
1174 ++ }
1175 + }
1176 +
1177 + return 0;
1178 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
1179 +index 36005bdf3749..29abd28c19b3 100644
1180 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
1181 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
1182 +@@ -721,7 +721,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
1183 + * allocation taken by fbdev
1184 + */
1185 + if (!(dev_priv->capabilities & SVGA_CAP_3D))
1186 +- mem_size *= 2;
1187 ++ mem_size *= 3;
1188 +
1189 + dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE;
1190 + dev_priv->prim_bb_mem =
1191 +diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
1192 +index f2b3bd7bf862..b4f643fb3b1e 100644
1193 +--- a/drivers/iio/magnetometer/mag3110.c
1194 ++++ b/drivers/iio/magnetometer/mag3110.c
1195 +@@ -222,29 +222,39 @@ static int mag3110_write_raw(struct iio_dev *indio_dev,
1196 + int val, int val2, long mask)
1197 + {
1198 + struct mag3110_data *data = iio_priv(indio_dev);
1199 +- int rate;
1200 ++ int rate, ret;
1201 +
1202 +- if (iio_buffer_enabled(indio_dev))
1203 +- return -EBUSY;
1204 ++ ret = iio_device_claim_direct_mode(indio_dev);
1205 ++ if (ret)
1206 ++ return ret;
1207 +
1208 + switch (mask) {
1209 + case IIO_CHAN_INFO_SAMP_FREQ:
1210 + rate = mag3110_get_samp_freq_index(data, val, val2);
1211 +- if (rate < 0)
1212 +- return -EINVAL;
1213 ++ if (rate < 0) {
1214 ++ ret = -EINVAL;
1215 ++ break;
1216 ++ }
1217 +
1218 + data->ctrl_reg1 &= ~MAG3110_CTRL_DR_MASK;
1219 + data->ctrl_reg1 |= rate << MAG3110_CTRL_DR_SHIFT;
1220 +- return i2c_smbus_write_byte_data(data->client,
1221 ++ ret = i2c_smbus_write_byte_data(data->client,
1222 + MAG3110_CTRL_REG1, data->ctrl_reg1);
1223 ++ break;
1224 + case IIO_CHAN_INFO_CALIBBIAS:
1225 +- if (val < -10000 || val > 10000)
1226 +- return -EINVAL;
1227 +- return i2c_smbus_write_word_swapped(data->client,
1228 ++ if (val < -10000 || val > 10000) {
1229 ++ ret = -EINVAL;
1230 ++ break;
1231 ++ }
1232 ++ ret = i2c_smbus_write_word_swapped(data->client,
1233 + MAG3110_OFF_X + 2 * chan->scan_index, val << 1);
1234 ++ break;
1235 + default:
1236 +- return -EINVAL;
1237 ++ ret = -EINVAL;
1238 ++ break;
1239 + }
1240 ++ iio_device_release_direct_mode(indio_dev);
1241 ++ return ret;
1242 + }
1243 +
1244 + static irqreturn_t mag3110_trigger_handler(int irq, void *p)
1245 +diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c
1246 +index a74ed1f0c880..8cc7156b5ace 100644
1247 +--- a/drivers/iio/pressure/ms5611_core.c
1248 ++++ b/drivers/iio/pressure/ms5611_core.c
1249 +@@ -308,6 +308,7 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
1250 + {
1251 + struct ms5611_state *st = iio_priv(indio_dev);
1252 + const struct ms5611_osr *osr = NULL;
1253 ++ int ret;
1254 +
1255 + if (mask != IIO_CHAN_INFO_OVERSAMPLING_RATIO)
1256 + return -EINVAL;
1257 +@@ -321,12 +322,11 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
1258 + if (!osr)
1259 + return -EINVAL;
1260 +
1261 +- mutex_lock(&st->lock);
1262 ++ ret = iio_device_claim_direct_mode(indio_dev);
1263 ++ if (ret)
1264 ++ return ret;
1265 +
1266 +- if (iio_buffer_enabled(indio_dev)) {
1267 +- mutex_unlock(&st->lock);
1268 +- return -EBUSY;
1269 +- }
1270 ++ mutex_lock(&st->lock);
1271 +
1272 + if (chan->type == IIO_TEMP)
1273 + st->temp_osr = osr;
1274 +@@ -334,6 +334,8 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
1275 + st->pressure_osr = osr;
1276 +
1277 + mutex_unlock(&st->lock);
1278 ++ iio_device_release_direct_mode(indio_dev);
1279 ++
1280 + return 0;
1281 + }
1282 +
1283 +diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
1284 +index 1f06282ec793..9ea147f1a50d 100644
1285 +--- a/drivers/iio/proximity/sx9500.c
1286 ++++ b/drivers/iio/proximity/sx9500.c
1287 +@@ -387,14 +387,18 @@ static int sx9500_read_raw(struct iio_dev *indio_dev,
1288 + int *val, int *val2, long mask)
1289 + {
1290 + struct sx9500_data *data = iio_priv(indio_dev);
1291 ++ int ret;
1292 +
1293 + switch (chan->type) {
1294 + case IIO_PROXIMITY:
1295 + switch (mask) {
1296 + case IIO_CHAN_INFO_RAW:
1297 +- if (iio_buffer_enabled(indio_dev))
1298 +- return -EBUSY;
1299 +- return sx9500_read_proximity(data, chan, val);
1300 ++ ret = iio_device_claim_direct_mode(indio_dev);
1301 ++ if (ret)
1302 ++ return ret;
1303 ++ ret = sx9500_read_proximity(data, chan, val);
1304 ++ iio_device_release_direct_mode(indio_dev);
1305 ++ return ret;
1306 + case IIO_CHAN_INFO_SAMP_FREQ:
1307 + return sx9500_read_samp_freq(data, val, val2);
1308 + default:
1309 +diff --git a/drivers/iio/trigger/iio-trig-interrupt.c b/drivers/iio/trigger/iio-trig-interrupt.c
1310 +index 572bc6f02ca8..e18f12b74610 100644
1311 +--- a/drivers/iio/trigger/iio-trig-interrupt.c
1312 ++++ b/drivers/iio/trigger/iio-trig-interrupt.c
1313 +@@ -58,7 +58,7 @@ static int iio_interrupt_trigger_probe(struct platform_device *pdev)
1314 + trig_info = kzalloc(sizeof(*trig_info), GFP_KERNEL);
1315 + if (!trig_info) {
1316 + ret = -ENOMEM;
1317 +- goto error_put_trigger;
1318 ++ goto error_free_trigger;
1319 + }
1320 + iio_trigger_set_drvdata(trig, trig_info);
1321 + trig_info->irq = irq;
1322 +@@ -83,8 +83,8 @@ static int iio_interrupt_trigger_probe(struct platform_device *pdev)
1323 + free_irq(irq, trig);
1324 + error_free_trig_info:
1325 + kfree(trig_info);
1326 +-error_put_trigger:
1327 +- iio_trigger_put(trig);
1328 ++error_free_trigger:
1329 ++ iio_trigger_free(trig);
1330 + error_ret:
1331 + return ret;
1332 + }
1333 +@@ -99,7 +99,7 @@ static int iio_interrupt_trigger_remove(struct platform_device *pdev)
1334 + iio_trigger_unregister(trig);
1335 + free_irq(trig_info->irq, trig);
1336 + kfree(trig_info);
1337 +- iio_trigger_put(trig);
1338 ++ iio_trigger_free(trig);
1339 +
1340 + return 0;
1341 + }
1342 +diff --git a/drivers/iio/trigger/iio-trig-sysfs.c b/drivers/iio/trigger/iio-trig-sysfs.c
1343 +index 3dfab2bc6d69..202e8b89caf2 100644
1344 +--- a/drivers/iio/trigger/iio-trig-sysfs.c
1345 ++++ b/drivers/iio/trigger/iio-trig-sysfs.c
1346 +@@ -174,7 +174,7 @@ static int iio_sysfs_trigger_probe(int id)
1347 + return 0;
1348 +
1349 + out2:
1350 +- iio_trigger_put(t->trig);
1351 ++ iio_trigger_free(t->trig);
1352 + free_t:
1353 + kfree(t);
1354 + out1:
1355 +diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
1356 +index 9f46be52335e..9d084780ac91 100644
1357 +--- a/drivers/infiniband/sw/rxe/rxe_req.c
1358 ++++ b/drivers/infiniband/sw/rxe/rxe_req.c
1359 +@@ -633,6 +633,7 @@ int rxe_requester(void *arg)
1360 + goto exit;
1361 + }
1362 + rmr->state = RXE_MEM_STATE_FREE;
1363 ++ rxe_drop_ref(rmr);
1364 + wqe->state = wqe_state_done;
1365 + wqe->status = IB_WC_SUCCESS;
1366 + } else if (wqe->wr.opcode == IB_WR_REG_MR) {
1367 +diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
1368 +index 69ed4e0d7a0d..7705820cdac6 100644
1369 +--- a/drivers/infiniband/sw/rxe/rxe_resp.c
1370 ++++ b/drivers/infiniband/sw/rxe/rxe_resp.c
1371 +@@ -893,6 +893,7 @@ static enum resp_states do_complete(struct rxe_qp *qp,
1372 + return RESPST_ERROR;
1373 + }
1374 + rmr->state = RXE_MEM_STATE_FREE;
1375 ++ rxe_drop_ref(rmr);
1376 + }
1377 +
1378 + wc->qp = &qp->ibqp;
1379 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1380 +index 0616a65f0d78..75761667be59 100644
1381 +--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1382 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1383 +@@ -1392,7 +1392,7 @@ static void ipoib_cm_tx_reap(struct work_struct *work)
1384 +
1385 + while (!list_empty(&priv->cm.reap_list)) {
1386 + p = list_entry(priv->cm.reap_list.next, typeof(*p), list);
1387 +- list_del(&p->list);
1388 ++ list_del_init(&p->list);
1389 + spin_unlock_irqrestore(&priv->lock, flags);
1390 + netif_tx_unlock_bh(dev);
1391 + ipoib_cm_tx_destroy(p);
1392 +diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
1393 +index 0fd612dd76ed..aaf43befffaa 100644
1394 +--- a/drivers/input/keyboard/mpr121_touchkey.c
1395 ++++ b/drivers/input/keyboard/mpr121_touchkey.c
1396 +@@ -87,7 +87,8 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id)
1397 + struct mpr121_touchkey *mpr121 = dev_id;
1398 + struct i2c_client *client = mpr121->client;
1399 + struct input_dev *input = mpr121->input_dev;
1400 +- unsigned int key_num, key_val, pressed;
1401 ++ unsigned long bit_changed;
1402 ++ unsigned int key_num;
1403 + int reg;
1404 +
1405 + reg = i2c_smbus_read_byte_data(client, ELE_TOUCH_STATUS_1_ADDR);
1406 +@@ -105,18 +106,22 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id)
1407 +
1408 + reg &= TOUCH_STATUS_MASK;
1409 + /* use old press bit to figure out which bit changed */
1410 +- key_num = ffs(reg ^ mpr121->statusbits) - 1;
1411 +- pressed = reg & (1 << key_num);
1412 ++ bit_changed = reg ^ mpr121->statusbits;
1413 + mpr121->statusbits = reg;
1414 ++ for_each_set_bit(key_num, &bit_changed, mpr121->keycount) {
1415 ++ unsigned int key_val, pressed;
1416 +
1417 +- key_val = mpr121->keycodes[key_num];
1418 ++ pressed = reg & BIT(key_num);
1419 ++ key_val = mpr121->keycodes[key_num];
1420 +
1421 +- input_event(input, EV_MSC, MSC_SCAN, key_num);
1422 +- input_report_key(input, key_val, pressed);
1423 +- input_sync(input);
1424 ++ input_event(input, EV_MSC, MSC_SCAN, key_num);
1425 ++ input_report_key(input, key_val, pressed);
1426 ++
1427 ++ dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val,
1428 ++ pressed ? "pressed" : "released");
1429 +
1430 +- dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val,
1431 +- pressed ? "pressed" : "released");
1432 ++ }
1433 ++ input_sync(input);
1434 +
1435 + out:
1436 + return IRQ_HANDLED;
1437 +@@ -231,6 +236,7 @@ static int mpr_touchkey_probe(struct i2c_client *client,
1438 + input_dev->id.bustype = BUS_I2C;
1439 + input_dev->dev.parent = &client->dev;
1440 + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
1441 ++ input_set_capability(input_dev, EV_MSC, MSC_SCAN);
1442 +
1443 + input_dev->keycode = mpr121->keycodes;
1444 + input_dev->keycodesize = sizeof(mpr121->keycodes[0]);
1445 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
1446 +index b8c50d883b2c..c9d491bc85e0 100644
1447 +--- a/drivers/input/mouse/elan_i2c_core.c
1448 ++++ b/drivers/input/mouse/elan_i2c_core.c
1449 +@@ -1240,6 +1240,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
1450 + { "ELAN0605", 0 },
1451 + { "ELAN0609", 0 },
1452 + { "ELAN060B", 0 },
1453 ++ { "ELAN060C", 0 },
1454 + { "ELAN0611", 0 },
1455 + { "ELAN1000", 0 },
1456 + { }
1457 +diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
1458 +index e6f9b2d745ca..d3d975ae24b7 100644
1459 +--- a/drivers/iommu/arm-smmu-v3.c
1460 ++++ b/drivers/iommu/arm-smmu-v3.c
1461 +@@ -1040,13 +1040,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
1462 + }
1463 + }
1464 +
1465 +- /* Nuke the existing Config, as we're going to rewrite it */
1466 +- val &= ~(STRTAB_STE_0_CFG_MASK << STRTAB_STE_0_CFG_SHIFT);
1467 +-
1468 +- if (ste->valid)
1469 +- val |= STRTAB_STE_0_V;
1470 +- else
1471 +- val &= ~STRTAB_STE_0_V;
1472 ++ /* Nuke the existing STE_0 value, as we're going to rewrite it */
1473 ++ val = ste->valid ? STRTAB_STE_0_V : 0;
1474 +
1475 + if (ste->bypass) {
1476 + val |= disable_bypass ? STRTAB_STE_0_CFG_ABORT
1477 +@@ -1081,7 +1076,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
1478 + val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK
1479 + << STRTAB_STE_0_S1CTXPTR_SHIFT) |
1480 + STRTAB_STE_0_CFG_S1_TRANS;
1481 +-
1482 + }
1483 +
1484 + if (ste->s2_cfg) {
1485 +diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
1486 +index 4003831de712..7b1935ab03c8 100644
1487 +--- a/drivers/media/i2c/adv7604.c
1488 ++++ b/drivers/media/i2c/adv7604.c
1489 +@@ -3118,6 +3118,9 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
1490 + state->pdata.blank_data = 1;
1491 + state->pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
1492 + state->pdata.bus_order = ADV7604_BUS_ORDER_RGB;
1493 ++ state->pdata.dr_str_data = ADV76XX_DR_STR_MEDIUM_HIGH;
1494 ++ state->pdata.dr_str_clk = ADV76XX_DR_STR_MEDIUM_HIGH;
1495 ++ state->pdata.dr_str_sync = ADV76XX_DR_STR_MEDIUM_HIGH;
1496 +
1497 + return 0;
1498 + }
1499 +diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
1500 +index fa4fe02cfef4..eef202d4399b 100644
1501 +--- a/drivers/misc/cxl/pci.c
1502 ++++ b/drivers/misc/cxl/pci.c
1503 +@@ -1620,6 +1620,9 @@ static void cxl_pci_remove_adapter(struct cxl *adapter)
1504 + cxl_sysfs_adapter_remove(adapter);
1505 + cxl_debugfs_adapter_remove(adapter);
1506 +
1507 ++ /* Flush adapter datacache as its about to be removed */
1508 ++ cxl_data_cache_flush(adapter);
1509 ++
1510 + cxl_deconfigure_adapter(adapter);
1511 +
1512 + device_unregister(&adapter->dev);
1513 +diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
1514 +index cf7c18947189..d065c0e2d18e 100644
1515 +--- a/drivers/net/can/c_can/c_can_pci.c
1516 ++++ b/drivers/net/can/c_can/c_can_pci.c
1517 +@@ -178,7 +178,6 @@ static int c_can_pci_probe(struct pci_dev *pdev,
1518 + break;
1519 + case BOSCH_D_CAN:
1520 + priv->regs = reg_map_d_can;
1521 +- priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
1522 + break;
1523 + default:
1524 + ret = -EINVAL;
1525 +diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
1526 +index e36d10520e24..717530eac70c 100644
1527 +--- a/drivers/net/can/c_can/c_can_platform.c
1528 ++++ b/drivers/net/can/c_can/c_can_platform.c
1529 +@@ -320,7 +320,6 @@ static int c_can_plat_probe(struct platform_device *pdev)
1530 + break;
1531 + case BOSCH_D_CAN:
1532 + priv->regs = reg_map_d_can;
1533 +- priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
1534 + priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
1535 + priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
1536 + priv->read_reg32 = d_can_plat_read_reg32;
1537 +diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c
1538 +index 481895b2f9f4..c06ef438f23f 100644
1539 +--- a/drivers/net/can/ifi_canfd/ifi_canfd.c
1540 ++++ b/drivers/net/can/ifi_canfd/ifi_canfd.c
1541 +@@ -670,9 +670,9 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev)
1542 + priv->base + IFI_CANFD_FTIME);
1543 +
1544 + /* Configure transmitter delay */
1545 +- tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK;
1546 +- writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc,
1547 +- priv->base + IFI_CANFD_TDELAY);
1548 ++ tdc = dbt->brp * (dbt->prop_seg + dbt->phase_seg1);
1549 ++ tdc &= IFI_CANFD_TDELAY_MASK;
1550 ++ writel(IFI_CANFD_TDELAY_EN | tdc, priv->base + IFI_CANFD_TDELAY);
1551 + }
1552 +
1553 + static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id,
1554 +diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c
1555 +index b0c80859f746..1ac2090a1721 100644
1556 +--- a/drivers/net/can/sun4i_can.c
1557 ++++ b/drivers/net/can/sun4i_can.c
1558 +@@ -539,6 +539,13 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
1559 + }
1560 + stats->rx_over_errors++;
1561 + stats->rx_errors++;
1562 ++
1563 ++ /* reset the CAN IP by entering reset mode
1564 ++ * ignoring timeout error
1565 ++ */
1566 ++ set_reset_mode(dev);
1567 ++ set_normal_mode(dev);
1568 ++
1569 + /* clear bit */
1570 + sun4i_can_write_cmdreg(priv, SUN4I_CMD_CLEAR_OR_FLAG);
1571 + }
1572 +@@ -653,8 +660,9 @@ static irqreturn_t sun4i_can_interrupt(int irq, void *dev_id)
1573 + netif_wake_queue(dev);
1574 + can_led_event(dev, CAN_LED_EVENT_TX);
1575 + }
1576 +- if (isrc & SUN4I_INT_RBUF_VLD) {
1577 +- /* receive interrupt */
1578 ++ if ((isrc & SUN4I_INT_RBUF_VLD) &&
1579 ++ !(isrc & SUN4I_INT_DATA_OR)) {
1580 ++ /* receive interrupt - don't read if overrun occurred */
1581 + while (status & SUN4I_STA_RBUF_RDY) {
1582 + /* RX buffer is not empty */
1583 + sun4i_can_rx(dev);
1584 +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
1585 +index afbfc0f656f3..dc6d3b0a0be8 100644
1586 +--- a/drivers/net/usb/cdc_ncm.c
1587 ++++ b/drivers/net/usb/cdc_ncm.c
1588 +@@ -769,8 +769,10 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
1589 + u8 *buf;
1590 + int len;
1591 + int temp;
1592 ++ int err;
1593 + u8 iface_no;
1594 + struct usb_cdc_parsed_header hdr;
1595 ++ u16 curr_ntb_format;
1596 +
1597 + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
1598 + if (!ctx)
1599 +@@ -875,6 +877,32 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
1600 + goto error2;
1601 + }
1602 +
1603 ++ /*
1604 ++ * Some Huawei devices have been observed to come out of reset in NDP32 mode.
1605 ++ * Let's check if this is the case, and set the device to NDP16 mode again if
1606 ++ * needed.
1607 ++ */
1608 ++ if (ctx->drvflags & CDC_NCM_FLAG_RESET_NTB16) {
1609 ++ err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_FORMAT,
1610 ++ USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
1611 ++ 0, iface_no, &curr_ntb_format, 2);
1612 ++ if (err < 0) {
1613 ++ goto error2;
1614 ++ }
1615 ++
1616 ++ if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
1617 ++ dev_info(&intf->dev, "resetting NTB format to 16-bit");
1618 ++ err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_FORMAT,
1619 ++ USB_TYPE_CLASS | USB_DIR_OUT
1620 ++ | USB_RECIP_INTERFACE,
1621 ++ USB_CDC_NCM_NTB16_FORMAT,
1622 ++ iface_no, NULL, 0);
1623 ++
1624 ++ if (err < 0)
1625 ++ goto error2;
1626 ++ }
1627 ++ }
1628 ++
1629 + cdc_ncm_find_endpoints(dev, ctx->data);
1630 + cdc_ncm_find_endpoints(dev, ctx->control);
1631 + if (!dev->in || !dev->out || !dev->status) {
1632 +diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
1633 +index 2680a65cd5e4..63f28908afda 100644
1634 +--- a/drivers/net/usb/huawei_cdc_ncm.c
1635 ++++ b/drivers/net/usb/huawei_cdc_ncm.c
1636 +@@ -80,6 +80,12 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
1637 + * be at the end of the frame.
1638 + */
1639 + drvflags |= CDC_NCM_FLAG_NDP_TO_END;
1640 ++
1641 ++ /* Additionally, it has been reported that some Huawei E3372H devices, with
1642 ++ * firmware version 21.318.01.00.541, come out of reset in NTB32 format mode, hence
1643 ++ * needing to be set to the NTB16 one again.
1644 ++ */
1645 ++ drvflags |= CDC_NCM_FLAG_RESET_NTB16;
1646 + ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags);
1647 + if (ret)
1648 + goto err;
1649 +diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
1650 +index e1d59da2ad20..ca8797c65312 100644
1651 +--- a/drivers/net/wireless/ath/wcn36xx/main.c
1652 ++++ b/drivers/net/wireless/ath/wcn36xx/main.c
1653 +@@ -1165,11 +1165,12 @@ static int wcn36xx_remove(struct platform_device *pdev)
1654 + wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n");
1655 +
1656 + release_firmware(wcn->nv);
1657 +- mutex_destroy(&wcn->hal_mutex);
1658 +
1659 + ieee80211_unregister_hw(hw);
1660 + iounmap(wcn->dxe_base);
1661 + iounmap(wcn->ccu_base);
1662 ++
1663 ++ mutex_destroy(&wcn->hal_mutex);
1664 + ieee80211_free_hw(hw);
1665 +
1666 + return 0;
1667 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
1668 +index 27960b0bfbcd..425a89c635d0 100644
1669 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
1670 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
1671 +@@ -6572,8 +6572,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
1672 + wiphy->bands[NL80211_BAND_5GHZ] = band;
1673 + }
1674 + }
1675 +- err = brcmf_setup_wiphybands(wiphy);
1676 +- return err;
1677 ++ return 0;
1678 + }
1679 +
1680 + static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
1681 +@@ -6938,6 +6937,12 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
1682 + goto priv_out;
1683 + }
1684 +
1685 ++ err = brcmf_setup_wiphybands(wiphy);
1686 ++ if (err) {
1687 ++ brcmf_err("Setting wiphy bands failed (%d)\n", err);
1688 ++ goto wiphy_unreg_out;
1689 ++ }
1690 ++
1691 + /* If cfg80211 didn't disable 40MHz HT CAP in wiphy_register(),
1692 + * setup 40MHz in 2GHz band and enable OBSS scanning.
1693 + */
1694 +diff --git a/drivers/net/wireless/marvell/libertas/cmd.c b/drivers/net/wireless/marvell/libertas/cmd.c
1695 +index 301170cccfff..033ff881c751 100644
1696 +--- a/drivers/net/wireless/marvell/libertas/cmd.c
1697 ++++ b/drivers/net/wireless/marvell/libertas/cmd.c
1698 +@@ -305,7 +305,7 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action,
1699 + }
1700 +
1701 + lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1702 +- return 0;
1703 ++ return ret;
1704 + }
1705 +
1706 + static int lbs_wait_for_ds_awake(struct lbs_private *priv)
1707 +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
1708 +index 4b0bb6b4f6f1..c636e6065548 100644
1709 +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
1710 ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
1711 +@@ -646,10 +646,9 @@ static void rt2800usb_txdone_nostatus(struct rt2x00_dev *rt2x00dev)
1712 + !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
1713 + break;
1714 +
1715 +- if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags))
1716 ++ if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) ||
1717 ++ rt2800usb_entry_txstatus_timeout(entry))
1718 + rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
1719 +- else if (rt2800usb_entry_txstatus_timeout(entry))
1720 +- rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN);
1721 + else
1722 + break;
1723 + }
1724 +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
1725 +index d9b5b73c35a0..a7bdb1ffac2e 100644
1726 +--- a/drivers/net/xen-netback/netback.c
1727 ++++ b/drivers/net/xen-netback/netback.c
1728 +@@ -67,6 +67,7 @@ module_param(rx_drain_timeout_msecs, uint, 0444);
1729 + unsigned int rx_stall_timeout_msecs = 60000;
1730 + module_param(rx_stall_timeout_msecs, uint, 0444);
1731 +
1732 ++#define MAX_QUEUES_DEFAULT 8
1733 + unsigned int xenvif_max_queues;
1734 + module_param_named(max_queues, xenvif_max_queues, uint, 0644);
1735 + MODULE_PARM_DESC(max_queues,
1736 +@@ -1626,11 +1627,12 @@ static int __init netback_init(void)
1737 + if (!xen_domain())
1738 + return -ENODEV;
1739 +
1740 +- /* Allow as many queues as there are CPUs if user has not
1741 ++ /* Allow as many queues as there are CPUs but max. 8 if user has not
1742 + * specified a value.
1743 + */
1744 + if (xenvif_max_queues == 0)
1745 +- xenvif_max_queues = num_online_cpus();
1746 ++ xenvif_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
1747 ++ num_online_cpus());
1748 +
1749 + if (fatal_skb_slots < XEN_NETBK_LEGACY_SLOTS_MAX) {
1750 + pr_info("fatal_skb_slots too small (%d), bump it to XEN_NETBK_LEGACY_SLOTS_MAX (%d)\n",
1751 +diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
1752 +index 45a89d969700..90e0b6f134ad 100644
1753 +--- a/drivers/pci/host/pci-mvebu.c
1754 ++++ b/drivers/pci/host/pci-mvebu.c
1755 +@@ -133,6 +133,12 @@ struct mvebu_pcie {
1756 + int nports;
1757 + };
1758 +
1759 ++struct mvebu_pcie_window {
1760 ++ phys_addr_t base;
1761 ++ phys_addr_t remap;
1762 ++ size_t size;
1763 ++};
1764 ++
1765 + /* Structure representing one PCIe interface */
1766 + struct mvebu_pcie_port {
1767 + char *name;
1768 +@@ -150,10 +156,8 @@ struct mvebu_pcie_port {
1769 + struct mvebu_sw_pci_bridge bridge;
1770 + struct device_node *dn;
1771 + struct mvebu_pcie *pcie;
1772 +- phys_addr_t memwin_base;
1773 +- size_t memwin_size;
1774 +- phys_addr_t iowin_base;
1775 +- size_t iowin_size;
1776 ++ struct mvebu_pcie_window memwin;
1777 ++ struct mvebu_pcie_window iowin;
1778 + u32 saved_pcie_stat;
1779 + };
1780 +
1781 +@@ -379,23 +383,45 @@ static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port,
1782 + }
1783 + }
1784 +
1785 ++static void mvebu_pcie_set_window(struct mvebu_pcie_port *port,
1786 ++ unsigned int target, unsigned int attribute,
1787 ++ const struct mvebu_pcie_window *desired,
1788 ++ struct mvebu_pcie_window *cur)
1789 ++{
1790 ++ if (desired->base == cur->base && desired->remap == cur->remap &&
1791 ++ desired->size == cur->size)
1792 ++ return;
1793 ++
1794 ++ if (cur->size != 0) {
1795 ++ mvebu_pcie_del_windows(port, cur->base, cur->size);
1796 ++ cur->size = 0;
1797 ++ cur->base = 0;
1798 ++
1799 ++ /*
1800 ++ * If something tries to change the window while it is enabled
1801 ++ * the change will not be done atomically. That would be
1802 ++ * difficult to do in the general case.
1803 ++ */
1804 ++ }
1805 ++
1806 ++ if (desired->size == 0)
1807 ++ return;
1808 ++
1809 ++ mvebu_pcie_add_windows(port, target, attribute, desired->base,
1810 ++ desired->size, desired->remap);
1811 ++ *cur = *desired;
1812 ++}
1813 ++
1814 + static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port)
1815 + {
1816 +- phys_addr_t iobase;
1817 ++ struct mvebu_pcie_window desired = {};
1818 +
1819 + /* Are the new iobase/iolimit values invalid? */
1820 + if (port->bridge.iolimit < port->bridge.iobase ||
1821 + port->bridge.iolimitupper < port->bridge.iobaseupper ||
1822 + !(port->bridge.command & PCI_COMMAND_IO)) {
1823 +-
1824 +- /* If a window was configured, remove it */
1825 +- if (port->iowin_base) {
1826 +- mvebu_pcie_del_windows(port, port->iowin_base,
1827 +- port->iowin_size);
1828 +- port->iowin_base = 0;
1829 +- port->iowin_size = 0;
1830 +- }
1831 +-
1832 ++ mvebu_pcie_set_window(port, port->io_target, port->io_attr,
1833 ++ &desired, &port->iowin);
1834 + return;
1835 + }
1836 +
1837 +@@ -412,32 +438,27 @@ static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port)
1838 + * specifications. iobase is the bus address, port->iowin_base
1839 + * is the CPU address.
1840 + */
1841 +- iobase = ((port->bridge.iobase & 0xF0) << 8) |
1842 +- (port->bridge.iobaseupper << 16);
1843 +- port->iowin_base = port->pcie->io.start + iobase;
1844 +- port->iowin_size = ((0xFFF | ((port->bridge.iolimit & 0xF0) << 8) |
1845 +- (port->bridge.iolimitupper << 16)) -
1846 +- iobase) + 1;
1847 +-
1848 +- mvebu_pcie_add_windows(port, port->io_target, port->io_attr,
1849 +- port->iowin_base, port->iowin_size,
1850 +- iobase);
1851 ++ desired.remap = ((port->bridge.iobase & 0xF0) << 8) |
1852 ++ (port->bridge.iobaseupper << 16);
1853 ++ desired.base = port->pcie->io.start + desired.remap;
1854 ++ desired.size = ((0xFFF | ((port->bridge.iolimit & 0xF0) << 8) |
1855 ++ (port->bridge.iolimitupper << 16)) -
1856 ++ desired.remap) +
1857 ++ 1;
1858 ++
1859 ++ mvebu_pcie_set_window(port, port->io_target, port->io_attr, &desired,
1860 ++ &port->iowin);
1861 + }
1862 +
1863 + static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port)
1864 + {
1865 ++ struct mvebu_pcie_window desired = {.remap = MVEBU_MBUS_NO_REMAP};
1866 ++
1867 + /* Are the new membase/memlimit values invalid? */
1868 + if (port->bridge.memlimit < port->bridge.membase ||
1869 + !(port->bridge.command & PCI_COMMAND_MEMORY)) {
1870 +-
1871 +- /* If a window was configured, remove it */
1872 +- if (port->memwin_base) {
1873 +- mvebu_pcie_del_windows(port, port->memwin_base,
1874 +- port->memwin_size);
1875 +- port->memwin_base = 0;
1876 +- port->memwin_size = 0;
1877 +- }
1878 +-
1879 ++ mvebu_pcie_set_window(port, port->mem_target, port->mem_attr,
1880 ++ &desired, &port->memwin);
1881 + return;
1882 + }
1883 +
1884 +@@ -447,14 +468,12 @@ static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port)
1885 + * window to setup, according to the PCI-to-PCI bridge
1886 + * specifications.
1887 + */
1888 +- port->memwin_base = ((port->bridge.membase & 0xFFF0) << 16);
1889 +- port->memwin_size =
1890 +- (((port->bridge.memlimit & 0xFFF0) << 16) | 0xFFFFF) -
1891 +- port->memwin_base + 1;
1892 +-
1893 +- mvebu_pcie_add_windows(port, port->mem_target, port->mem_attr,
1894 +- port->memwin_base, port->memwin_size,
1895 +- MVEBU_MBUS_NO_REMAP);
1896 ++ desired.base = ((port->bridge.membase & 0xFFF0) << 16);
1897 ++ desired.size = (((port->bridge.memlimit & 0xFFF0) << 16) | 0xFFFFF) -
1898 ++ desired.base + 1;
1899 ++
1900 ++ mvebu_pcie_set_window(port, port->mem_target, port->mem_attr, &desired,
1901 ++ &port->memwin);
1902 + }
1903 +
1904 + /*
1905 +diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
1906 +index 5419de8e20b1..0a965026b134 100644
1907 +--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
1908 ++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
1909 +@@ -1466,7 +1466,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
1910 + val & BYT_INPUT_EN ? " " : "in",
1911 + val & BYT_OUTPUT_EN ? " " : "out",
1912 + val & BYT_LEVEL ? "hi" : "lo",
1913 +- comm->pad_map[i], comm->pad_map[i] * 32,
1914 ++ comm->pad_map[i], comm->pad_map[i] * 16,
1915 + conf0 & 0x7,
1916 + conf0 & BYT_TRIG_NEG ? " fall" : " ",
1917 + conf0 & BYT_TRIG_POS ? " rise" : " ",
1918 +diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
1919 +index 96ffda493266..454cb2ee3cee 100644
1920 +--- a/drivers/platform/x86/hp-wmi.c
1921 ++++ b/drivers/platform/x86/hp-wmi.c
1922 +@@ -248,7 +248,7 @@ static int hp_wmi_display_state(void)
1923 + int ret = hp_wmi_perform_query(HPWMI_DISPLAY_QUERY, 0, &state,
1924 + sizeof(state), sizeof(state));
1925 + if (ret)
1926 +- return -EINVAL;
1927 ++ return ret < 0 ? ret : -EINVAL;
1928 + return state;
1929 + }
1930 +
1931 +@@ -258,7 +258,7 @@ static int hp_wmi_hddtemp_state(void)
1932 + int ret = hp_wmi_perform_query(HPWMI_HDDTEMP_QUERY, 0, &state,
1933 + sizeof(state), sizeof(state));
1934 + if (ret)
1935 +- return -EINVAL;
1936 ++ return ret < 0 ? ret : -EINVAL;
1937 + return state;
1938 + }
1939 +
1940 +@@ -268,7 +268,7 @@ static int hp_wmi_als_state(void)
1941 + int ret = hp_wmi_perform_query(HPWMI_ALS_QUERY, 0, &state,
1942 + sizeof(state), sizeof(state));
1943 + if (ret)
1944 +- return -EINVAL;
1945 ++ return ret < 0 ? ret : -EINVAL;
1946 + return state;
1947 + }
1948 +
1949 +@@ -279,7 +279,7 @@ static int hp_wmi_dock_state(void)
1950 + sizeof(state), sizeof(state));
1951 +
1952 + if (ret)
1953 +- return -EINVAL;
1954 ++ return ret < 0 ? ret : -EINVAL;
1955 +
1956 + return state & 0x1;
1957 + }
1958 +@@ -290,7 +290,7 @@ static int hp_wmi_tablet_state(void)
1959 + int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, &state,
1960 + sizeof(state), sizeof(state));
1961 + if (ret)
1962 +- return ret;
1963 ++ return ret < 0 ? ret : -EINVAL;
1964 +
1965 + return (state & 0x4) ? 1 : 0;
1966 + }
1967 +@@ -323,7 +323,7 @@ static int __init hp_wmi_enable_hotkeys(void)
1968 + int ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &value,
1969 + sizeof(value), 0);
1970 + if (ret)
1971 +- return -EINVAL;
1972 ++ return ret < 0 ? ret : -EINVAL;
1973 + return 0;
1974 + }
1975 +
1976 +@@ -336,7 +336,7 @@ static int hp_wmi_set_block(void *data, bool blocked)
1977 + ret = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1,
1978 + &query, sizeof(query), 0);
1979 + if (ret)
1980 +- return -EINVAL;
1981 ++ return ret < 0 ? ret : -EINVAL;
1982 + return 0;
1983 + }
1984 +
1985 +@@ -428,7 +428,7 @@ static int hp_wmi_post_code_state(void)
1986 + int ret = hp_wmi_perform_query(HPWMI_POSTCODEERROR_QUERY, 0, &state,
1987 + sizeof(state), sizeof(state));
1988 + if (ret)
1989 +- return -EINVAL;
1990 ++ return ret < 0 ? ret : -EINVAL;
1991 + return state;
1992 + }
1993 +
1994 +@@ -494,7 +494,7 @@ static ssize_t set_als(struct device *dev, struct device_attribute *attr,
1995 + int ret = hp_wmi_perform_query(HPWMI_ALS_QUERY, 1, &tmp,
1996 + sizeof(tmp), sizeof(tmp));
1997 + if (ret)
1998 +- return -EINVAL;
1999 ++ return ret < 0 ? ret : -EINVAL;
2000 +
2001 + return count;
2002 + }
2003 +@@ -515,7 +515,7 @@ static ssize_t set_postcode(struct device *dev, struct device_attribute *attr,
2004 + ret = hp_wmi_perform_query(HPWMI_POSTCODEERROR_QUERY, 1, &tmp,
2005 + sizeof(tmp), sizeof(tmp));
2006 + if (ret)
2007 +- return -EINVAL;
2008 ++ return ret < 0 ? ret : -EINVAL;
2009 +
2010 + return count;
2011 + }
2012 +@@ -572,10 +572,12 @@ static void hp_wmi_notify(u32 value, void *context)
2013 +
2014 + switch (event_id) {
2015 + case HPWMI_DOCK_EVENT:
2016 +- input_report_switch(hp_wmi_input_dev, SW_DOCK,
2017 +- hp_wmi_dock_state());
2018 +- input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
2019 +- hp_wmi_tablet_state());
2020 ++ if (test_bit(SW_DOCK, hp_wmi_input_dev->swbit))
2021 ++ input_report_switch(hp_wmi_input_dev, SW_DOCK,
2022 ++ hp_wmi_dock_state());
2023 ++ if (test_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit))
2024 ++ input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
2025 ++ hp_wmi_tablet_state());
2026 + input_sync(hp_wmi_input_dev);
2027 + break;
2028 + case HPWMI_PARK_HDD:
2029 +@@ -644,6 +646,7 @@ static int __init hp_wmi_input_setup(void)
2030 + {
2031 + acpi_status status;
2032 + int err;
2033 ++ int val;
2034 +
2035 + hp_wmi_input_dev = input_allocate_device();
2036 + if (!hp_wmi_input_dev)
2037 +@@ -654,17 +657,26 @@ static int __init hp_wmi_input_setup(void)
2038 + hp_wmi_input_dev->id.bustype = BUS_HOST;
2039 +
2040 + __set_bit(EV_SW, hp_wmi_input_dev->evbit);
2041 +- __set_bit(SW_DOCK, hp_wmi_input_dev->swbit);
2042 +- __set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
2043 ++
2044 ++ /* Dock */
2045 ++ val = hp_wmi_dock_state();
2046 ++ if (!(val < 0)) {
2047 ++ __set_bit(SW_DOCK, hp_wmi_input_dev->swbit);
2048 ++ input_report_switch(hp_wmi_input_dev, SW_DOCK, val);
2049 ++ }
2050 ++
2051 ++ /* Tablet mode */
2052 ++ val = hp_wmi_tablet_state();
2053 ++ if (!(val < 0)) {
2054 ++ __set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
2055 ++ input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
2056 ++ }
2057 +
2058 + err = sparse_keymap_setup(hp_wmi_input_dev, hp_wmi_keymap, NULL);
2059 + if (err)
2060 + goto err_free_dev;
2061 +
2062 + /* Set initial hardware state */
2063 +- input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state());
2064 +- input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
2065 +- hp_wmi_tablet_state());
2066 + input_sync(hp_wmi_input_dev);
2067 +
2068 + if (!hp_wmi_bios_2009_later() && hp_wmi_bios_2008_later())
2069 +@@ -950,10 +962,12 @@ static int hp_wmi_resume_handler(struct device *device)
2070 + * changed.
2071 + */
2072 + if (hp_wmi_input_dev) {
2073 +- input_report_switch(hp_wmi_input_dev, SW_DOCK,
2074 +- hp_wmi_dock_state());
2075 +- input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
2076 +- hp_wmi_tablet_state());
2077 ++ if (test_bit(SW_DOCK, hp_wmi_input_dev->swbit))
2078 ++ input_report_switch(hp_wmi_input_dev, SW_DOCK,
2079 ++ hp_wmi_dock_state());
2080 ++ if (test_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit))
2081 ++ input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
2082 ++ hp_wmi_tablet_state());
2083 + input_sync(hp_wmi_input_dev);
2084 + }
2085 +
2086 +diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
2087 +index f3756ca6f349..d55e6438bb5e 100644
2088 +--- a/drivers/s390/net/qeth_core.h
2089 ++++ b/drivers/s390/net/qeth_core.h
2090 +@@ -921,7 +921,6 @@ void qeth_clear_thread_running_bit(struct qeth_card *, unsigned long);
2091 + int qeth_core_hardsetup_card(struct qeth_card *);
2092 + void qeth_print_status_message(struct qeth_card *);
2093 + int qeth_init_qdio_queues(struct qeth_card *);
2094 +-int qeth_send_startlan(struct qeth_card *);
2095 + int qeth_send_ipa_cmd(struct qeth_card *, struct qeth_cmd_buffer *,
2096 + int (*reply_cb)
2097 + (struct qeth_card *, struct qeth_reply *, unsigned long),
2098 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
2099 +index e8c48309ebe9..21ef8023430f 100644
2100 +--- a/drivers/s390/net/qeth_core_main.c
2101 ++++ b/drivers/s390/net/qeth_core_main.c
2102 +@@ -2944,7 +2944,7 @@ int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
2103 + }
2104 + EXPORT_SYMBOL_GPL(qeth_send_ipa_cmd);
2105 +
2106 +-int qeth_send_startlan(struct qeth_card *card)
2107 ++static int qeth_send_startlan(struct qeth_card *card)
2108 + {
2109 + int rc;
2110 + struct qeth_cmd_buffer *iob;
2111 +@@ -2957,7 +2957,6 @@ int qeth_send_startlan(struct qeth_card *card)
2112 + rc = qeth_send_ipa_cmd(card, iob, NULL, NULL);
2113 + return rc;
2114 + }
2115 +-EXPORT_SYMBOL_GPL(qeth_send_startlan);
2116 +
2117 + static int qeth_default_setadapterparms_cb(struct qeth_card *card,
2118 + struct qeth_reply *reply, unsigned long data)
2119 +@@ -5091,6 +5090,20 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
2120 + goto out;
2121 + }
2122 +
2123 ++ rc = qeth_send_startlan(card);
2124 ++ if (rc) {
2125 ++ QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
2126 ++ if (rc == IPA_RC_LAN_OFFLINE) {
2127 ++ dev_warn(&card->gdev->dev,
2128 ++ "The LAN is offline\n");
2129 ++ card->lan_online = 0;
2130 ++ } else {
2131 ++ rc = -ENODEV;
2132 ++ goto out;
2133 ++ }
2134 ++ } else
2135 ++ card->lan_online = 1;
2136 ++
2137 + card->options.ipa4.supported_funcs = 0;
2138 + card->options.ipa6.supported_funcs = 0;
2139 + card->options.adp.supported_funcs = 0;
2140 +@@ -5102,14 +5115,14 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
2141 + if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
2142 + rc = qeth_query_setadapterparms(card);
2143 + if (rc < 0) {
2144 +- QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
2145 ++ QETH_DBF_TEXT_(SETUP, 2, "7err%d", rc);
2146 + goto out;
2147 + }
2148 + }
2149 + if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) {
2150 + rc = qeth_query_setdiagass(card);
2151 + if (rc < 0) {
2152 +- QETH_DBF_TEXT_(SETUP, 2, "7err%d", rc);
2153 ++ QETH_DBF_TEXT_(SETUP, 2, "8err%d", rc);
2154 + goto out;
2155 + }
2156 + }
2157 +diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
2158 +index 5d010aa89852..8530477caab8 100644
2159 +--- a/drivers/s390/net/qeth_l2_main.c
2160 ++++ b/drivers/s390/net/qeth_l2_main.c
2161 +@@ -1204,21 +1204,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
2162 + /* softsetup */
2163 + QETH_DBF_TEXT(SETUP, 2, "softsetp");
2164 +
2165 +- rc = qeth_send_startlan(card);
2166 +- if (rc) {
2167 +- QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
2168 +- if (rc == 0xe080) {
2169 +- dev_warn(&card->gdev->dev,
2170 +- "The LAN is offline\n");
2171 +- card->lan_online = 0;
2172 +- goto contin;
2173 +- }
2174 +- rc = -ENODEV;
2175 +- goto out_remove;
2176 +- } else
2177 +- card->lan_online = 1;
2178 +-
2179 +-contin:
2180 + if ((card->info.type == QETH_CARD_TYPE_OSD) ||
2181 + (card->info.type == QETH_CARD_TYPE_OSX)) {
2182 + rc = qeth_l2_start_ipassists(card);
2183 +diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
2184 +index 171be5ec2ece..03a2619166ca 100644
2185 +--- a/drivers/s390/net/qeth_l3_main.c
2186 ++++ b/drivers/s390/net/qeth_l3_main.c
2187 +@@ -3230,21 +3230,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
2188 + /* softsetup */
2189 + QETH_DBF_TEXT(SETUP, 2, "softsetp");
2190 +
2191 +- rc = qeth_send_startlan(card);
2192 +- if (rc) {
2193 +- QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
2194 +- if (rc == 0xe080) {
2195 +- dev_warn(&card->gdev->dev,
2196 +- "The LAN is offline\n");
2197 +- card->lan_online = 0;
2198 +- goto contin;
2199 +- }
2200 +- rc = -ENODEV;
2201 +- goto out_remove;
2202 +- } else
2203 +- card->lan_online = 1;
2204 +-
2205 +-contin:
2206 + rc = qeth_l3_setadapter_parms(card);
2207 + if (rc)
2208 + QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc);
2209 +diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
2210 +index 0e00a5ce0f00..cffe42f5775d 100644
2211 +--- a/drivers/s390/net/qeth_l3_sys.c
2212 ++++ b/drivers/s390/net/qeth_l3_sys.c
2213 +@@ -692,15 +692,15 @@ static ssize_t qeth_l3_dev_vipa_add_show(char *buf, struct qeth_card *card,
2214 + enum qeth_prot_versions proto)
2215 + {
2216 + struct qeth_ipaddr *ipaddr;
2217 +- struct hlist_node *tmp;
2218 + char addr_str[40];
2219 ++ int str_len = 0;
2220 + int entry_len; /* length of 1 entry string, differs between v4 and v6 */
2221 +- int i = 0;
2222 ++ int i;
2223 +
2224 + entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
2225 + entry_len += 2; /* \n + terminator */
2226 + spin_lock_bh(&card->ip_lock);
2227 +- hash_for_each_safe(card->ip_htable, i, tmp, ipaddr, hnode) {
2228 ++ hash_for_each(card->ip_htable, i, ipaddr, hnode) {
2229 + if (ipaddr->proto != proto)
2230 + continue;
2231 + if (ipaddr->type != QETH_IP_TYPE_VIPA)
2232 +@@ -708,16 +708,17 @@ static ssize_t qeth_l3_dev_vipa_add_show(char *buf, struct qeth_card *card,
2233 + /* String must not be longer than PAGE_SIZE. So we check if
2234 + * string length gets near PAGE_SIZE. Then we can savely display
2235 + * the next IPv6 address (worst case, compared to IPv4) */
2236 +- if ((PAGE_SIZE - i) <= entry_len)
2237 ++ if ((PAGE_SIZE - str_len) <= entry_len)
2238 + break;
2239 + qeth_l3_ipaddr_to_string(proto, (const u8 *)&ipaddr->u,
2240 + addr_str);
2241 +- i += snprintf(buf + i, PAGE_SIZE - i, "%s\n", addr_str);
2242 ++ str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "%s\n",
2243 ++ addr_str);
2244 + }
2245 + spin_unlock_bh(&card->ip_lock);
2246 +- i += snprintf(buf + i, PAGE_SIZE - i, "\n");
2247 ++ str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "\n");
2248 +
2249 +- return i;
2250 ++ return str_len;
2251 + }
2252 +
2253 + static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,
2254 +@@ -854,15 +855,15 @@ static ssize_t qeth_l3_dev_rxip_add_show(char *buf, struct qeth_card *card,
2255 + enum qeth_prot_versions proto)
2256 + {
2257 + struct qeth_ipaddr *ipaddr;
2258 +- struct hlist_node *tmp;
2259 + char addr_str[40];
2260 ++ int str_len = 0;
2261 + int entry_len; /* length of 1 entry string, differs between v4 and v6 */
2262 +- int i = 0;
2263 ++ int i;
2264 +
2265 + entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
2266 + entry_len += 2; /* \n + terminator */
2267 + spin_lock_bh(&card->ip_lock);
2268 +- hash_for_each_safe(card->ip_htable, i, tmp, ipaddr, hnode) {
2269 ++ hash_for_each(card->ip_htable, i, ipaddr, hnode) {
2270 + if (ipaddr->proto != proto)
2271 + continue;
2272 + if (ipaddr->type != QETH_IP_TYPE_RXIP)
2273 +@@ -870,16 +871,17 @@ static ssize_t qeth_l3_dev_rxip_add_show(char *buf, struct qeth_card *card,
2274 + /* String must not be longer than PAGE_SIZE. So we check if
2275 + * string length gets near PAGE_SIZE. Then we can savely display
2276 + * the next IPv6 address (worst case, compared to IPv4) */
2277 +- if ((PAGE_SIZE - i) <= entry_len)
2278 ++ if ((PAGE_SIZE - str_len) <= entry_len)
2279 + break;
2280 + qeth_l3_ipaddr_to_string(proto, (const u8 *)&ipaddr->u,
2281 + addr_str);
2282 +- i += snprintf(buf + i, PAGE_SIZE - i, "%s\n", addr_str);
2283 ++ str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "%s\n",
2284 ++ addr_str);
2285 + }
2286 + spin_unlock_bh(&card->ip_lock);
2287 +- i += snprintf(buf + i, PAGE_SIZE - i, "\n");
2288 ++ str_len += snprintf(buf + str_len, PAGE_SIZE - str_len, "\n");
2289 +
2290 +- return i;
2291 ++ return str_len;
2292 + }
2293 +
2294 + static ssize_t qeth_l3_dev_rxip_add4_show(struct device *dev,
2295 +diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
2296 +index 38dca69a06eb..ce500a509aa2 100644
2297 +--- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
2298 ++++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
2299 +@@ -260,7 +260,7 @@ static int iio_bfin_tmr_trigger_probe(struct platform_device *pdev)
2300 + out1:
2301 + iio_trigger_unregister(st->trig);
2302 + out:
2303 +- iio_trigger_put(st->trig);
2304 ++ iio_trigger_free(st->trig);
2305 + return ret;
2306 + }
2307 +
2308 +@@ -273,7 +273,7 @@ static int iio_bfin_tmr_trigger_remove(struct platform_device *pdev)
2309 + peripheral_free(st->t->pin);
2310 + free_irq(st->irq, st);
2311 + iio_trigger_unregister(st->trig);
2312 +- iio_trigger_put(st->trig);
2313 ++ iio_trigger_free(st->trig);
2314 +
2315 + return 0;
2316 + }
2317 +diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
2318 +index 7e97a1ccab23..15eaea53b3df 100644
2319 +--- a/drivers/tty/serial/sh-sci.c
2320 ++++ b/drivers/tty/serial/sh-sci.c
2321 +@@ -193,18 +193,17 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
2322 + },
2323 +
2324 + /*
2325 +- * Common definitions for legacy IrDA ports, dependent on
2326 +- * regshift value.
2327 ++ * Common definitions for legacy IrDA ports.
2328 + */
2329 + [SCIx_IRDA_REGTYPE] = {
2330 + [SCSMR] = { 0x00, 8 },
2331 +- [SCBRR] = { 0x01, 8 },
2332 +- [SCSCR] = { 0x02, 8 },
2333 +- [SCxTDR] = { 0x03, 8 },
2334 +- [SCxSR] = { 0x04, 8 },
2335 +- [SCxRDR] = { 0x05, 8 },
2336 +- [SCFCR] = { 0x06, 8 },
2337 +- [SCFDR] = { 0x07, 16 },
2338 ++ [SCBRR] = { 0x02, 8 },
2339 ++ [SCSCR] = { 0x04, 8 },
2340 ++ [SCxTDR] = { 0x06, 8 },
2341 ++ [SCxSR] = { 0x08, 16 },
2342 ++ [SCxRDR] = { 0x0a, 8 },
2343 ++ [SCFCR] = { 0x0c, 8 },
2344 ++ [SCFDR] = { 0x0e, 16 },
2345 + [SCTFDR] = sci_reg_invalid,
2346 + [SCRFDR] = sci_reg_invalid,
2347 + [SCSPTR] = sci_reg_invalid,
2348 +diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
2349 +index 882fc4e08284..fcc7aa248ce7 100644
2350 +--- a/drivers/usb/core/hcd.c
2351 ++++ b/drivers/usb/core/hcd.c
2352 +@@ -3023,6 +3023,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
2353 + }
2354 +
2355 + usb_put_invalidate_rhdev(hcd);
2356 ++ hcd->flags = 0;
2357 + }
2358 + EXPORT_SYMBOL_GPL(usb_remove_hcd);
2359 +
2360 +diff --git a/drivers/video/fbdev/pmag-ba-fb.c b/drivers/video/fbdev/pmag-ba-fb.c
2361 +index 5872bc4af3ce..df02fb4b7fd1 100644
2362 +--- a/drivers/video/fbdev/pmag-ba-fb.c
2363 ++++ b/drivers/video/fbdev/pmag-ba-fb.c
2364 +@@ -129,7 +129,7 @@ static struct fb_ops pmagbafb_ops = {
2365 + /*
2366 + * Turn the hardware cursor off.
2367 + */
2368 +-static void __init pmagbafb_erase_cursor(struct fb_info *info)
2369 ++static void pmagbafb_erase_cursor(struct fb_info *info)
2370 + {
2371 + struct pmagbafb_par *par = info->par;
2372 +
2373 +diff --git a/include/dt-bindings/clock/exynos5433.h b/include/dt-bindings/clock/exynos5433.h
2374 +index 4fa6bb2136e3..be39d23e6a32 100644
2375 +--- a/include/dt-bindings/clock/exynos5433.h
2376 ++++ b/include/dt-bindings/clock/exynos5433.h
2377 +@@ -771,7 +771,10 @@
2378 +
2379 + #define CLK_PCLK_DECON 113
2380 +
2381 +-#define DISP_NR_CLK 114
2382 ++#define CLK_PHYCLK_MIPIDPHY0_BITCLKDIV8_PHY 114
2383 ++#define CLK_PHYCLK_MIPIDPHY0_RXCLKESC0_PHY 115
2384 ++
2385 ++#define DISP_NR_CLK 116
2386 +
2387 + /* CMU_AUD */
2388 + #define CLK_MOUT_AUD_PLL_USER 1
2389 +diff --git a/include/linux/phy.h b/include/linux/phy.h
2390 +index 8431c8c0c320..a04d69ab7c34 100644
2391 +--- a/include/linux/phy.h
2392 ++++ b/include/linux/phy.h
2393 +@@ -142,11 +142,7 @@ static inline const char *phy_modes(phy_interface_t interface)
2394 + /* Used when trying to connect to a specific phy (mii bus id:phy device id) */
2395 + #define PHY_ID_FMT "%s:%02x"
2396 +
2397 +-/*
2398 +- * Need to be a little smaller than phydev->dev.bus_id to leave room
2399 +- * for the ":%02x"
2400 +- */
2401 +-#define MII_BUS_ID_SIZE (20 - 3)
2402 ++#define MII_BUS_ID_SIZE 61
2403 +
2404 + /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit
2405 + IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
2406 +@@ -602,7 +598,7 @@ struct phy_driver {
2407 + /* A Structure for boards to register fixups with the PHY Lib */
2408 + struct phy_fixup {
2409 + struct list_head list;
2410 +- char bus_id[20];
2411 ++ char bus_id[MII_BUS_ID_SIZE + 3];
2412 + u32 phy_uid;
2413 + u32 phy_uid_mask;
2414 + int (*run)(struct phy_device *phydev);
2415 +diff --git a/include/linux/preempt.h b/include/linux/preempt.h
2416 +index 75e4e30677f1..7eeceac52dea 100644
2417 +--- a/include/linux/preempt.h
2418 ++++ b/include/linux/preempt.h
2419 +@@ -65,19 +65,24 @@
2420 +
2421 + /*
2422 + * Are we doing bottom half or hardware interrupt processing?
2423 +- * Are we in a softirq context? Interrupt context?
2424 +- * in_softirq - Are we currently processing softirq or have bh disabled?
2425 +- * in_serving_softirq - Are we currently processing softirq?
2426 ++ *
2427 ++ * in_irq() - We're in (hard) IRQ context
2428 ++ * in_softirq() - We have BH disabled, or are processing softirqs
2429 ++ * in_interrupt() - We're in NMI,IRQ,SoftIRQ context or have BH disabled
2430 ++ * in_serving_softirq() - We're in softirq context
2431 ++ * in_nmi() - We're in NMI context
2432 ++ * in_task() - We're in task context
2433 ++ *
2434 ++ * Note: due to the BH disabled confusion: in_softirq(),in_interrupt() really
2435 ++ * should not be used in new code.
2436 + */
2437 + #define in_irq() (hardirq_count())
2438 + #define in_softirq() (softirq_count())
2439 + #define in_interrupt() (irq_count())
2440 + #define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
2441 +-
2442 +-/*
2443 +- * Are we in NMI context?
2444 +- */
2445 +-#define in_nmi() (preempt_count() & NMI_MASK)
2446 ++#define in_nmi() (preempt_count() & NMI_MASK)
2447 ++#define in_task() (!(preempt_count() & \
2448 ++ (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)))
2449 +
2450 + /*
2451 + * The preempt_count offset after preempt_disable();
2452 +diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
2453 +index 00d232406f18..b0fad110817b 100644
2454 +--- a/include/linux/usb/cdc_ncm.h
2455 ++++ b/include/linux/usb/cdc_ncm.h
2456 +@@ -83,6 +83,7 @@
2457 + /* Driver flags */
2458 + #define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
2459 + #define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */
2460 ++#define CDC_NCM_FLAG_RESET_NTB16 0x08 /* set NDP16 one more time after altsetting switch */
2461 +
2462 + #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
2463 + (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
2464 +diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
2465 +index feb58d455560..4b9ee3009aa0 100644
2466 +--- a/include/sound/seq_kernel.h
2467 ++++ b/include/sound/seq_kernel.h
2468 +@@ -49,7 +49,8 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t;
2469 + #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
2470 +
2471 + /* max delivery path length */
2472 +-#define SNDRV_SEQ_MAX_HOPS 10
2473 ++/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
2474 ++#define SNDRV_SEQ_MAX_HOPS 8
2475 +
2476 + /* max size of event size */
2477 + #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
2478 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
2479 +index 02e7ad860b52..78181c03d9c7 100644
2480 +--- a/kernel/sched/core.c
2481 ++++ b/kernel/sched/core.c
2482 +@@ -7961,6 +7961,7 @@ void sched_move_task(struct task_struct *tsk)
2483 + struct rq *rq;
2484 +
2485 + rq = task_rq_lock(tsk, &rf);
2486 ++ update_rq_clock(rq);
2487 +
2488 + running = task_current(rq, tsk);
2489 + queued = task_on_rq_queued(tsk);
2490 +diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
2491 +index 8635417c587b..29fa81f0f51a 100644
2492 +--- a/kernel/workqueue_internal.h
2493 ++++ b/kernel/workqueue_internal.h
2494 +@@ -9,6 +9,7 @@
2495 +
2496 + #include <linux/workqueue.h>
2497 + #include <linux/kthread.h>
2498 ++#include <linux/preempt.h>
2499 +
2500 + struct worker_pool;
2501 +
2502 +@@ -59,7 +60,7 @@ struct worker {
2503 + */
2504 + static inline struct worker *current_wq_worker(void)
2505 + {
2506 +- if (current->flags & PF_WQ_WORKER)
2507 ++ if (in_task() && (current->flags & PF_WQ_WORKER))
2508 + return kthread_data(current);
2509 + return NULL;
2510 + }
2511 +diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
2512 +index fef5d2e114be..1ef0cec38d78 100644
2513 +--- a/lib/asn1_decoder.c
2514 ++++ b/lib/asn1_decoder.c
2515 +@@ -228,7 +228,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
2516 + hdr = 2;
2517 +
2518 + /* Extract a tag from the data */
2519 +- if (unlikely(dp >= datalen - 1))
2520 ++ if (unlikely(datalen - dp < 2))
2521 + goto data_overrun_error;
2522 + tag = data[dp++];
2523 + if (unlikely((tag & 0x1f) == ASN1_LONG_TAG))
2524 +@@ -274,7 +274,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
2525 + int n = len - 0x80;
2526 + if (unlikely(n > 2))
2527 + goto length_too_long;
2528 +- if (unlikely(dp >= datalen - n))
2529 ++ if (unlikely(n > datalen - dp))
2530 + goto data_overrun_error;
2531 + hdr += n;
2532 + for (len = 0; n > 0; n--) {
2533 +diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
2534 +index 96e47c539bee..39bb5b3a82f2 100644
2535 +--- a/net/dsa/Kconfig
2536 ++++ b/net/dsa/Kconfig
2537 +@@ -1,12 +1,13 @@
2538 + config HAVE_NET_DSA
2539 + def_bool y
2540 +- depends on NETDEVICES && !S390
2541 ++ depends on INET && NETDEVICES && !S390
2542 +
2543 + # Drivers must select NET_DSA and the appropriate tagging format
2544 +
2545 + config NET_DSA
2546 + tristate "Distributed Switch Architecture"
2547 +- depends on HAVE_NET_DSA && NET_SWITCHDEV
2548 ++ depends on HAVE_NET_DSA
2549 ++ select NET_SWITCHDEV
2550 + select PHYLIB
2551 + ---help---
2552 + Say Y if you want to enable support for the hardware switches supported
2553 +diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
2554 +index f2a71025a770..22377c8ff14b 100644
2555 +--- a/net/ipv4/ah4.c
2556 ++++ b/net/ipv4/ah4.c
2557 +@@ -270,6 +270,9 @@ static void ah_input_done(struct crypto_async_request *base, int err)
2558 + int ihl = ip_hdrlen(skb);
2559 + int ah_hlen = (ah->hdrlen + 2) << 2;
2560 +
2561 ++ if (err)
2562 ++ goto out;
2563 ++
2564 + work_iph = AH_SKB_CB(skb)->tmp;
2565 + auth_data = ah_tmp_auth(work_iph, ihl);
2566 + icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
2567 +diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c
2568 +index 6c1e0246706e..7c3395513ff0 100644
2569 +--- a/net/netfilter/nft_meta.c
2570 ++++ b/net/netfilter/nft_meta.c
2571 +@@ -159,8 +159,34 @@ void nft_meta_get_eval(const struct nft_expr *expr,
2572 + else
2573 + *dest = PACKET_BROADCAST;
2574 + break;
2575 ++ case NFPROTO_NETDEV:
2576 ++ switch (skb->protocol) {
2577 ++ case htons(ETH_P_IP): {
2578 ++ int noff = skb_network_offset(skb);
2579 ++ struct iphdr *iph, _iph;
2580 ++
2581 ++ iph = skb_header_pointer(skb, noff,
2582 ++ sizeof(_iph), &_iph);
2583 ++ if (!iph)
2584 ++ goto err;
2585 ++
2586 ++ if (ipv4_is_multicast(iph->daddr))
2587 ++ *dest = PACKET_MULTICAST;
2588 ++ else
2589 ++ *dest = PACKET_BROADCAST;
2590 ++
2591 ++ break;
2592 ++ }
2593 ++ case htons(ETH_P_IPV6):
2594 ++ *dest = PACKET_MULTICAST;
2595 ++ break;
2596 ++ default:
2597 ++ WARN_ON_ONCE(1);
2598 ++ goto err;
2599 ++ }
2600 ++ break;
2601 + default:
2602 +- WARN_ON(1);
2603 ++ WARN_ON_ONCE(1);
2604 + goto err;
2605 + }
2606 + break;
2607 +diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
2608 +index 41b8cb115801..7d3a98b2d55a 100644
2609 +--- a/security/apparmor/lsm.c
2610 ++++ b/security/apparmor/lsm.c
2611 +@@ -671,9 +671,9 @@ enum profile_mode aa_g_profile_mode = APPARMOR_ENFORCE;
2612 + module_param_call(mode, param_set_mode, param_get_mode,
2613 + &aa_g_profile_mode, S_IRUSR | S_IWUSR);
2614 +
2615 +-#ifdef CONFIG_SECURITY_APPARMOR_HASH
2616 + /* whether policy verification hashing is enabled */
2617 + bool aa_g_hash_policy = IS_ENABLED(CONFIG_SECURITY_APPARMOR_HASH_DEFAULT);
2618 ++#ifdef CONFIG_SECURITY_APPARMOR_HASH
2619 + module_param_named(hash_policy, aa_g_hash_policy, aabool, S_IRUSR | S_IWUSR);
2620 + #endif
2621 +
2622 +diff --git a/security/keys/trusted.c b/security/keys/trusted.c
2623 +index f4db42e669e9..4ba2f6b91242 100644
2624 +--- a/security/keys/trusted.c
2625 ++++ b/security/keys/trusted.c
2626 +@@ -70,7 +70,7 @@ static int TSS_sha1(const unsigned char *data, unsigned int datalen,
2627 + }
2628 +
2629 + ret = crypto_shash_digest(&sdesc->shash, data, datalen, digest);
2630 +- kfree(sdesc);
2631 ++ kzfree(sdesc);
2632 + return ret;
2633 + }
2634 +
2635 +@@ -114,7 +114,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
2636 + if (!ret)
2637 + ret = crypto_shash_final(&sdesc->shash, digest);
2638 + out:
2639 +- kfree(sdesc);
2640 ++ kzfree(sdesc);
2641 + return ret;
2642 + }
2643 +
2644 +@@ -165,7 +165,7 @@ static int TSS_authhmac(unsigned char *digest, const unsigned char *key,
2645 + paramdigest, TPM_NONCE_SIZE, h1,
2646 + TPM_NONCE_SIZE, h2, 1, &c, 0, 0);
2647 + out:
2648 +- kfree(sdesc);
2649 ++ kzfree(sdesc);
2650 + return ret;
2651 + }
2652 +
2653 +@@ -246,7 +246,7 @@ static int TSS_checkhmac1(unsigned char *buffer,
2654 + if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE))
2655 + ret = -EINVAL;
2656 + out:
2657 +- kfree(sdesc);
2658 ++ kzfree(sdesc);
2659 + return ret;
2660 + }
2661 +
2662 +@@ -347,7 +347,7 @@ static int TSS_checkhmac2(unsigned char *buffer,
2663 + if (memcmp(testhmac2, authdata2, SHA1_DIGEST_SIZE))
2664 + ret = -EINVAL;
2665 + out:
2666 +- kfree(sdesc);
2667 ++ kzfree(sdesc);
2668 + return ret;
2669 + }
2670 +
2671 +@@ -564,7 +564,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
2672 + *bloblen = storedsize;
2673 + }
2674 + out:
2675 +- kfree(td);
2676 ++ kzfree(td);
2677 + return ret;
2678 + }
2679 +
2680 +@@ -678,7 +678,7 @@ static int key_seal(struct trusted_key_payload *p,
2681 + if (ret < 0)
2682 + pr_info("trusted_key: srkseal failed (%d)\n", ret);
2683 +
2684 +- kfree(tb);
2685 ++ kzfree(tb);
2686 + return ret;
2687 + }
2688 +
2689 +@@ -703,7 +703,7 @@ static int key_unseal(struct trusted_key_payload *p,
2690 + /* pull migratable flag out of sealed key */
2691 + p->migratable = p->key[--p->key_len];
2692 +
2693 +- kfree(tb);
2694 ++ kzfree(tb);
2695 + return ret;
2696 + }
2697 +
2698 +@@ -1037,12 +1037,12 @@ static int trusted_instantiate(struct key *key,
2699 + if (!ret && options->pcrlock)
2700 + ret = pcrlock(options->pcrlock);
2701 + out:
2702 +- kfree(datablob);
2703 +- kfree(options);
2704 ++ kzfree(datablob);
2705 ++ kzfree(options);
2706 + if (!ret)
2707 + rcu_assign_keypointer(key, payload);
2708 + else
2709 +- kfree(payload);
2710 ++ kzfree(payload);
2711 + return ret;
2712 + }
2713 +
2714 +@@ -1051,8 +1051,7 @@ static void trusted_rcu_free(struct rcu_head *rcu)
2715 + struct trusted_key_payload *p;
2716 +
2717 + p = container_of(rcu, struct trusted_key_payload, rcu);
2718 +- memset(p->key, 0, p->key_len);
2719 +- kfree(p);
2720 ++ kzfree(p);
2721 + }
2722 +
2723 + /*
2724 +@@ -1094,13 +1093,13 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep)
2725 + ret = datablob_parse(datablob, new_p, new_o);
2726 + if (ret != Opt_update) {
2727 + ret = -EINVAL;
2728 +- kfree(new_p);
2729 ++ kzfree(new_p);
2730 + goto out;
2731 + }
2732 +
2733 + if (!new_o->keyhandle) {
2734 + ret = -EINVAL;
2735 +- kfree(new_p);
2736 ++ kzfree(new_p);
2737 + goto out;
2738 + }
2739 +
2740 +@@ -1114,22 +1113,22 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep)
2741 + ret = key_seal(new_p, new_o);
2742 + if (ret < 0) {
2743 + pr_info("trusted_key: key_seal failed (%d)\n", ret);
2744 +- kfree(new_p);
2745 ++ kzfree(new_p);
2746 + goto out;
2747 + }
2748 + if (new_o->pcrlock) {
2749 + ret = pcrlock(new_o->pcrlock);
2750 + if (ret < 0) {
2751 + pr_info("trusted_key: pcrlock failed (%d)\n", ret);
2752 +- kfree(new_p);
2753 ++ kzfree(new_p);
2754 + goto out;
2755 + }
2756 + }
2757 + rcu_assign_keypointer(key, new_p);
2758 + call_rcu(&p->rcu, trusted_rcu_free);
2759 + out:
2760 +- kfree(datablob);
2761 +- kfree(new_o);
2762 ++ kzfree(datablob);
2763 ++ kzfree(new_o);
2764 + return ret;
2765 + }
2766 +
2767 +@@ -1148,34 +1147,30 @@ static long trusted_read(const struct key *key, char __user *buffer,
2768 + p = rcu_dereference_key(key);
2769 + if (!p)
2770 + return -EINVAL;
2771 +- if (!buffer || buflen <= 0)
2772 +- return 2 * p->blob_len;
2773 +- ascii_buf = kmalloc(2 * p->blob_len, GFP_KERNEL);
2774 +- if (!ascii_buf)
2775 +- return -ENOMEM;
2776 +
2777 +- bufp = ascii_buf;
2778 +- for (i = 0; i < p->blob_len; i++)
2779 +- bufp = hex_byte_pack(bufp, p->blob[i]);
2780 +- if ((copy_to_user(buffer, ascii_buf, 2 * p->blob_len)) != 0) {
2781 +- kfree(ascii_buf);
2782 +- return -EFAULT;
2783 ++ if (buffer && buflen >= 2 * p->blob_len) {
2784 ++ ascii_buf = kmalloc(2 * p->blob_len, GFP_KERNEL);
2785 ++ if (!ascii_buf)
2786 ++ return -ENOMEM;
2787 ++
2788 ++ bufp = ascii_buf;
2789 ++ for (i = 0; i < p->blob_len; i++)
2790 ++ bufp = hex_byte_pack(bufp, p->blob[i]);
2791 ++ if (copy_to_user(buffer, ascii_buf, 2 * p->blob_len) != 0) {
2792 ++ kzfree(ascii_buf);
2793 ++ return -EFAULT;
2794 ++ }
2795 ++ kzfree(ascii_buf);
2796 + }
2797 +- kfree(ascii_buf);
2798 + return 2 * p->blob_len;
2799 + }
2800 +
2801 + /*
2802 +- * trusted_destroy - before freeing the key, clear the decrypted data
2803 ++ * trusted_destroy - clear and free the key's payload
2804 + */
2805 + static void trusted_destroy(struct key *key)
2806 + {
2807 +- struct trusted_key_payload *p = key->payload.data[0];
2808 +-
2809 +- if (!p)
2810 +- return;
2811 +- memset(p->key, 0, p->key_len);
2812 +- kfree(key->payload.data[0]);
2813 ++ kzfree(key->payload.data[0]);
2814 + }
2815 +
2816 + struct key_type key_type_trusted = {
2817 +diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
2818 +index aaff9ee32695..b30b2139e3f0 100644
2819 +--- a/sound/core/seq/oss/seq_oss_midi.c
2820 ++++ b/sound/core/seq/oss/seq_oss_midi.c
2821 +@@ -612,9 +612,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq
2822 + if (!dp->timer->running)
2823 + len = snd_seq_oss_timer_start(dp->timer);
2824 + if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
2825 +- if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
2826 +- snd_seq_oss_readq_puts(dp->readq, mdev->seq_device,
2827 +- ev->data.ext.ptr, ev->data.ext.len);
2828 ++ snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev);
2829 + } else {
2830 + len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
2831 + if (len > 0)
2832 +diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c
2833 +index 046cb586fb2f..06b21226b4e7 100644
2834 +--- a/sound/core/seq/oss/seq_oss_readq.c
2835 ++++ b/sound/core/seq/oss/seq_oss_readq.c
2836 +@@ -117,6 +117,35 @@ snd_seq_oss_readq_puts(struct seq_oss_readq *q, int dev, unsigned char *data, in
2837 + return 0;
2838 + }
2839 +
2840 ++/*
2841 ++ * put MIDI sysex bytes; the event buffer may be chained, thus it has
2842 ++ * to be expanded via snd_seq_dump_var_event().
2843 ++ */
2844 ++struct readq_sysex_ctx {
2845 ++ struct seq_oss_readq *readq;
2846 ++ int dev;
2847 ++};
2848 ++
2849 ++static int readq_dump_sysex(void *ptr, void *buf, int count)
2850 ++{
2851 ++ struct readq_sysex_ctx *ctx = ptr;
2852 ++
2853 ++ return snd_seq_oss_readq_puts(ctx->readq, ctx->dev, buf, count);
2854 ++}
2855 ++
2856 ++int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
2857 ++ struct snd_seq_event *ev)
2858 ++{
2859 ++ struct readq_sysex_ctx ctx = {
2860 ++ .readq = q,
2861 ++ .dev = dev
2862 ++ };
2863 ++
2864 ++ if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
2865 ++ return 0;
2866 ++ return snd_seq_dump_var_event(ev, readq_dump_sysex, &ctx);
2867 ++}
2868 ++
2869 + /*
2870 + * copy an event to input queue:
2871 + * return zero if enqueued
2872 +diff --git a/sound/core/seq/oss/seq_oss_readq.h b/sound/core/seq/oss/seq_oss_readq.h
2873 +index f1463f1f449e..8d033ca2d23f 100644
2874 +--- a/sound/core/seq/oss/seq_oss_readq.h
2875 ++++ b/sound/core/seq/oss/seq_oss_readq.h
2876 +@@ -44,6 +44,8 @@ void snd_seq_oss_readq_delete(struct seq_oss_readq *q);
2877 + void snd_seq_oss_readq_clear(struct seq_oss_readq *readq);
2878 + unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait);
2879 + int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len);
2880 ++int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
2881 ++ struct snd_seq_event *ev);
2882 + int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev);
2883 + int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode);
2884 + int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec);
2885 +diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
2886 +index 88fbb3a1e660..048de15d6937 100644
2887 +--- a/sound/soc/sunxi/sun4i-spdif.c
2888 ++++ b/sound/soc/sunxi/sun4i-spdif.c
2889 +@@ -403,14 +403,6 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = {
2890 + .name = "spdif",
2891 + };
2892 +
2893 +-static const struct snd_soc_dapm_widget dit_widgets[] = {
2894 +- SND_SOC_DAPM_OUTPUT("spdif-out"),
2895 +-};
2896 +-
2897 +-static const struct snd_soc_dapm_route dit_routes[] = {
2898 +- { "spdif-out", NULL, "Playback" },
2899 +-};
2900 +-
2901 + static const struct of_device_id sun4i_spdif_of_match[] = {
2902 + { .compatible = "allwinner,sun4i-a10-spdif", },
2903 + { .compatible = "allwinner,sun6i-a31-spdif", },
2904 +diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
2905 +index 5c495ad7958a..d8ac9ba67688 100755
2906 +--- a/tools/testing/selftests/firmware/fw_filesystem.sh
2907 ++++ b/tools/testing/selftests/firmware/fw_filesystem.sh
2908 +@@ -48,18 +48,18 @@ echo "ABCD0123" >"$FW"
2909 +
2910 + NAME=$(basename "$FW")
2911 +
2912 +-if printf '\000' >"$DIR"/trigger_request; then
2913 ++if printf '\000' >"$DIR"/trigger_request 2> /dev/null; then
2914 + echo "$0: empty filename should not succeed" >&2
2915 + exit 1
2916 + fi
2917 +
2918 +-if printf '\000' >"$DIR"/trigger_async_request; then
2919 ++if printf '\000' >"$DIR"/trigger_async_request 2> /dev/null; then
2920 + echo "$0: empty filename should not succeed (async)" >&2
2921 + exit 1
2922 + fi
2923 +
2924 + # Request a firmware that doesn't exist, it should fail.
2925 +-if echo -n "nope-$NAME" >"$DIR"/trigger_request; then
2926 ++if echo -n "nope-$NAME" >"$DIR"/trigger_request 2> /dev/null; then
2927 + echo "$0: firmware shouldn't have loaded" >&2
2928 + exit 1
2929 + fi
2930 +diff --git a/tools/testing/selftests/firmware/fw_userhelper.sh b/tools/testing/selftests/firmware/fw_userhelper.sh
2931 +index b9983f8e09f6..01c626a1f226 100755
2932 +--- a/tools/testing/selftests/firmware/fw_userhelper.sh
2933 ++++ b/tools/testing/selftests/firmware/fw_userhelper.sh
2934 +@@ -64,9 +64,33 @@ trap "test_finish" EXIT
2935 + echo "ABCD0123" >"$FW"
2936 + NAME=$(basename "$FW")
2937 +
2938 ++DEVPATH="$DIR"/"nope-$NAME"/loading
2939 ++
2940 + # Test failure when doing nothing (timeout works).
2941 +-echo 1 >/sys/class/firmware/timeout
2942 +-echo -n "$NAME" >"$DIR"/trigger_request
2943 ++echo -n 2 >/sys/class/firmware/timeout
2944 ++echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null &
2945 ++
2946 ++# Give the kernel some time to load the loading file, must be less
2947 ++# than the timeout above.
2948 ++sleep 1
2949 ++if [ ! -f $DEVPATH ]; then
2950 ++ echo "$0: fallback mechanism immediately cancelled"
2951 ++ echo ""
2952 ++ echo "The file never appeared: $DEVPATH"
2953 ++ echo ""
2954 ++ echo "This might be a distribution udev rule setup by your distribution"
2955 ++ echo "to immediately cancel all fallback requests, this must be"
2956 ++ echo "removed before running these tests. To confirm look for"
2957 ++ echo "a firmware rule like /lib/udev/rules.d/50-firmware.rules"
2958 ++ echo "and see if you have something like this:"
2959 ++ echo ""
2960 ++ echo "SUBSYSTEM==\"firmware\", ACTION==\"add\", ATTR{loading}=\"-1\""
2961 ++ echo ""
2962 ++ echo "If you do remove this file or comment out this line before"
2963 ++ echo "proceeding with these tests."
2964 ++ exit 1
2965 ++fi
2966 ++
2967 + if diff -q "$FW" /dev/test_firmware >/dev/null ; then
2968 + echo "$0: firmware was not expected to match" >&2
2969 + exit 1