1 |
commit: 4b20132c279ede5083d1c7edf6593f35c9d15b39 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 4 10:41:43 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 4 10:41:43 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4b20132c |
7 |
|
8 |
Linux patch 4.14.74 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1073_linux-4.14.74.patch | 4496 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4500 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 08015af..db32f2e 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -335,6 +335,10 @@ Patch: 1072_linux-4.14.73.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.14.73 |
23 |
|
24 |
+Patch: 1073_linux-4.14.74.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.14.74 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1073_linux-4.14.74.patch b/1073_linux-4.14.74.patch |
33 |
new file mode 100644 |
34 |
index 0000000..50ab2a0 |
35 |
--- /dev/null |
36 |
+++ b/1073_linux-4.14.74.patch |
37 |
@@ -0,0 +1,4496 @@ |
38 |
+diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx |
39 |
+index cfd31d94c872..f8bf14055c2f 100644 |
40 |
+--- a/Documentation/hwmon/ina2xx |
41 |
++++ b/Documentation/hwmon/ina2xx |
42 |
+@@ -32,7 +32,7 @@ Supported chips: |
43 |
+ Datasheet: Publicly available at the Texas Instruments website |
44 |
+ http://www.ti.com/ |
45 |
+ |
46 |
+-Author: Lothar Felten <l-felten@××.com> |
47 |
++Author: Lothar Felten <lothar.felten@×××××.com> |
48 |
+ |
49 |
+ Description |
50 |
+ ----------- |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index 89f30ca964b6..cc0e65a8d7bf 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 4 |
58 |
+ PATCHLEVEL = 14 |
59 |
+-SUBLEVEL = 73 |
60 |
++SUBLEVEL = 74 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = Petit Gorille |
63 |
+ |
64 |
+diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi |
65 |
+index 02a136a4661a..a5bd8f0205e8 100644 |
66 |
+--- a/arch/arm/boot/dts/dra7.dtsi |
67 |
++++ b/arch/arm/boot/dts/dra7.dtsi |
68 |
+@@ -1818,7 +1818,7 @@ |
69 |
+ }; |
70 |
+ }; |
71 |
+ |
72 |
+- dcan1: can@481cc000 { |
73 |
++ dcan1: can@4ae3c000 { |
74 |
+ compatible = "ti,dra7-d_can"; |
75 |
+ ti,hwmods = "dcan1"; |
76 |
+ reg = <0x4ae3c000 0x2000>; |
77 |
+@@ -1828,7 +1828,7 @@ |
78 |
+ status = "disabled"; |
79 |
+ }; |
80 |
+ |
81 |
+- dcan2: can@481d0000 { |
82 |
++ dcan2: can@48480000 { |
83 |
+ compatible = "ti,dra7-d_can"; |
84 |
+ ti,hwmods = "dcan2"; |
85 |
+ reg = <0x48480000 0x2000>; |
86 |
+diff --git a/arch/arm/boot/dts/imx7d.dtsi b/arch/arm/boot/dts/imx7d.dtsi |
87 |
+index 4d308d17f040..119b63ffb0fe 100644 |
88 |
+--- a/arch/arm/boot/dts/imx7d.dtsi |
89 |
++++ b/arch/arm/boot/dts/imx7d.dtsi |
90 |
+@@ -144,10 +144,14 @@ |
91 |
+ interrupt-names = "msi"; |
92 |
+ #interrupt-cells = <1>; |
93 |
+ interrupt-map-mask = <0 0 0 0x7>; |
94 |
+- interrupt-map = <0 0 0 1 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, |
95 |
+- <0 0 0 2 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, |
96 |
+- <0 0 0 3 &intc GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>, |
97 |
+- <0 0 0 4 &intc GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>; |
98 |
++ /* |
99 |
++ * Reference manual lists pci irqs incorrectly |
100 |
++ * Real hardware ordering is same as imx6: D+MSI, C, B, A |
101 |
++ */ |
102 |
++ interrupt-map = <0 0 0 1 &intc GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>, |
103 |
++ <0 0 0 2 &intc GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>, |
104 |
++ <0 0 0 3 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, |
105 |
++ <0 0 0 4 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>; |
106 |
+ clocks = <&clks IMX7D_PCIE_CTRL_ROOT_CLK>, |
107 |
+ <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>, |
108 |
+ <&clks IMX7D_PCIE_PHY_ROOT_CLK>; |
109 |
+diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi |
110 |
+index 379b4a03cfe2..2d20f60947b9 100644 |
111 |
+--- a/arch/arm/boot/dts/ls1021a.dtsi |
112 |
++++ b/arch/arm/boot/dts/ls1021a.dtsi |
113 |
+@@ -84,6 +84,7 @@ |
114 |
+ device_type = "cpu"; |
115 |
+ reg = <0xf01>; |
116 |
+ clocks = <&clockgen 1 0>; |
117 |
++ #cooling-cells = <2>; |
118 |
+ }; |
119 |
+ }; |
120 |
+ |
121 |
+diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi |
122 |
+index 185357323572..028cf4a5887f 100644 |
123 |
+--- a/arch/arm/boot/dts/mt7623.dtsi |
124 |
++++ b/arch/arm/boot/dts/mt7623.dtsi |
125 |
+@@ -98,6 +98,7 @@ |
126 |
+ compatible = "arm,cortex-a7"; |
127 |
+ reg = <0x1>; |
128 |
+ operating-points-v2 = <&cpu_opp_table>; |
129 |
++ #cooling-cells = <2>; |
130 |
+ clock-frequency = <1300000000>; |
131 |
+ }; |
132 |
+ |
133 |
+@@ -106,6 +107,7 @@ |
134 |
+ compatible = "arm,cortex-a7"; |
135 |
+ reg = <0x2>; |
136 |
+ operating-points-v2 = <&cpu_opp_table>; |
137 |
++ #cooling-cells = <2>; |
138 |
+ clock-frequency = <1300000000>; |
139 |
+ }; |
140 |
+ |
141 |
+@@ -114,6 +116,7 @@ |
142 |
+ compatible = "arm,cortex-a7"; |
143 |
+ reg = <0x3>; |
144 |
+ operating-points-v2 = <&cpu_opp_table>; |
145 |
++ #cooling-cells = <2>; |
146 |
+ clock-frequency = <1300000000>; |
147 |
+ }; |
148 |
+ }; |
149 |
+diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts |
150 |
+index 8b93d37310f2..bad690b23081 100644 |
151 |
+--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts |
152 |
++++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts |
153 |
+@@ -314,7 +314,7 @@ |
154 |
+ &mmc2 { |
155 |
+ vmmc-supply = <&vsdio>; |
156 |
+ bus-width = <8>; |
157 |
+- non-removable; |
158 |
++ ti,non-removable; |
159 |
+ }; |
160 |
+ |
161 |
+ &mmc3 { |
162 |
+diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c |
163 |
+index 27a78c80e5b1..73d5d72dfc3e 100644 |
164 |
+--- a/arch/arm/mach-mvebu/pmsu.c |
165 |
++++ b/arch/arm/mach-mvebu/pmsu.c |
166 |
+@@ -116,8 +116,8 @@ void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr) |
167 |
+ PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); |
168 |
+ } |
169 |
+ |
170 |
+-extern unsigned char mvebu_boot_wa_start; |
171 |
+-extern unsigned char mvebu_boot_wa_end; |
172 |
++extern unsigned char mvebu_boot_wa_start[]; |
173 |
++extern unsigned char mvebu_boot_wa_end[]; |
174 |
+ |
175 |
+ /* |
176 |
+ * This function sets up the boot address workaround needed for SMP |
177 |
+@@ -130,7 +130,7 @@ int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target, |
178 |
+ phys_addr_t resume_addr_reg) |
179 |
+ { |
180 |
+ void __iomem *sram_virt_base; |
181 |
+- u32 code_len = &mvebu_boot_wa_end - &mvebu_boot_wa_start; |
182 |
++ u32 code_len = mvebu_boot_wa_end - mvebu_boot_wa_start; |
183 |
+ |
184 |
+ mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE); |
185 |
+ mvebu_mbus_add_window_by_id(crypto_eng_target, crypto_eng_attribute, |
186 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod_reset.c b/arch/arm/mach-omap2/omap_hwmod_reset.c |
187 |
+index b68f9c0aff0b..d5ddba00bb73 100644 |
188 |
+--- a/arch/arm/mach-omap2/omap_hwmod_reset.c |
189 |
++++ b/arch/arm/mach-omap2/omap_hwmod_reset.c |
190 |
+@@ -92,11 +92,13 @@ static void omap_rtc_wait_not_busy(struct omap_hwmod *oh) |
191 |
+ */ |
192 |
+ void omap_hwmod_rtc_unlock(struct omap_hwmod *oh) |
193 |
+ { |
194 |
+- local_irq_disable(); |
195 |
++ unsigned long flags; |
196 |
++ |
197 |
++ local_irq_save(flags); |
198 |
+ omap_rtc_wait_not_busy(oh); |
199 |
+ omap_hwmod_write(OMAP_RTC_KICK0_VALUE, oh, OMAP_RTC_KICK0_REG); |
200 |
+ omap_hwmod_write(OMAP_RTC_KICK1_VALUE, oh, OMAP_RTC_KICK1_REG); |
201 |
+- local_irq_enable(); |
202 |
++ local_irq_restore(flags); |
203 |
+ } |
204 |
+ |
205 |
+ /** |
206 |
+@@ -110,9 +112,11 @@ void omap_hwmod_rtc_unlock(struct omap_hwmod *oh) |
207 |
+ */ |
208 |
+ void omap_hwmod_rtc_lock(struct omap_hwmod *oh) |
209 |
+ { |
210 |
+- local_irq_disable(); |
211 |
++ unsigned long flags; |
212 |
++ |
213 |
++ local_irq_save(flags); |
214 |
+ omap_rtc_wait_not_busy(oh); |
215 |
+ omap_hwmod_write(0x0, oh, OMAP_RTC_KICK0_REG); |
216 |
+ omap_hwmod_write(0x0, oh, OMAP_RTC_KICK1_REG); |
217 |
+- local_irq_enable(); |
218 |
++ local_irq_restore(flags); |
219 |
+ } |
220 |
+diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h |
221 |
+index e5df3fce0008..2b55aee7c051 100644 |
222 |
+--- a/arch/arm64/include/asm/kvm_emulate.h |
223 |
++++ b/arch/arm64/include/asm/kvm_emulate.h |
224 |
+@@ -42,6 +42,11 @@ void kvm_inject_vabt(struct kvm_vcpu *vcpu); |
225 |
+ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr); |
226 |
+ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr); |
227 |
+ |
228 |
++static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu) |
229 |
++{ |
230 |
++ return !(vcpu->arch.hcr_el2 & HCR_RW); |
231 |
++} |
232 |
++ |
233 |
+ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) |
234 |
+ { |
235 |
+ vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS; |
236 |
+diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c |
237 |
+index 811f04c5760e..76d27edf33cb 100644 |
238 |
+--- a/arch/arm64/kvm/guest.c |
239 |
++++ b/arch/arm64/kvm/guest.c |
240 |
+@@ -57,6 +57,45 @@ static u64 core_reg_offset_from_id(u64 id) |
241 |
+ return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE); |
242 |
+ } |
243 |
+ |
244 |
++static int validate_core_offset(const struct kvm_one_reg *reg) |
245 |
++{ |
246 |
++ u64 off = core_reg_offset_from_id(reg->id); |
247 |
++ int size; |
248 |
++ |
249 |
++ switch (off) { |
250 |
++ case KVM_REG_ARM_CORE_REG(regs.regs[0]) ... |
251 |
++ KVM_REG_ARM_CORE_REG(regs.regs[30]): |
252 |
++ case KVM_REG_ARM_CORE_REG(regs.sp): |
253 |
++ case KVM_REG_ARM_CORE_REG(regs.pc): |
254 |
++ case KVM_REG_ARM_CORE_REG(regs.pstate): |
255 |
++ case KVM_REG_ARM_CORE_REG(sp_el1): |
256 |
++ case KVM_REG_ARM_CORE_REG(elr_el1): |
257 |
++ case KVM_REG_ARM_CORE_REG(spsr[0]) ... |
258 |
++ KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]): |
259 |
++ size = sizeof(__u64); |
260 |
++ break; |
261 |
++ |
262 |
++ case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ... |
263 |
++ KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]): |
264 |
++ size = sizeof(__uint128_t); |
265 |
++ break; |
266 |
++ |
267 |
++ case KVM_REG_ARM_CORE_REG(fp_regs.fpsr): |
268 |
++ case KVM_REG_ARM_CORE_REG(fp_regs.fpcr): |
269 |
++ size = sizeof(__u32); |
270 |
++ break; |
271 |
++ |
272 |
++ default: |
273 |
++ return -EINVAL; |
274 |
++ } |
275 |
++ |
276 |
++ if (KVM_REG_SIZE(reg->id) == size && |
277 |
++ IS_ALIGNED(off, size / sizeof(__u32))) |
278 |
++ return 0; |
279 |
++ |
280 |
++ return -EINVAL; |
281 |
++} |
282 |
++ |
283 |
+ static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) |
284 |
+ { |
285 |
+ /* |
286 |
+@@ -76,6 +115,9 @@ static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) |
287 |
+ (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs) |
288 |
+ return -ENOENT; |
289 |
+ |
290 |
++ if (validate_core_offset(reg)) |
291 |
++ return -EINVAL; |
292 |
++ |
293 |
+ if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id))) |
294 |
+ return -EFAULT; |
295 |
+ |
296 |
+@@ -98,6 +140,9 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) |
297 |
+ (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs) |
298 |
+ return -ENOENT; |
299 |
+ |
300 |
++ if (validate_core_offset(reg)) |
301 |
++ return -EINVAL; |
302 |
++ |
303 |
+ if (KVM_REG_SIZE(reg->id) > sizeof(tmp)) |
304 |
+ return -EINVAL; |
305 |
+ |
306 |
+@@ -107,17 +152,25 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) |
307 |
+ } |
308 |
+ |
309 |
+ if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) { |
310 |
+- u32 mode = (*(u32 *)valp) & COMPAT_PSR_MODE_MASK; |
311 |
++ u64 mode = (*(u64 *)valp) & COMPAT_PSR_MODE_MASK; |
312 |
+ switch (mode) { |
313 |
+ case COMPAT_PSR_MODE_USR: |
314 |
++ if (!system_supports_32bit_el0()) |
315 |
++ return -EINVAL; |
316 |
++ break; |
317 |
+ case COMPAT_PSR_MODE_FIQ: |
318 |
+ case COMPAT_PSR_MODE_IRQ: |
319 |
+ case COMPAT_PSR_MODE_SVC: |
320 |
+ case COMPAT_PSR_MODE_ABT: |
321 |
+ case COMPAT_PSR_MODE_UND: |
322 |
++ if (!vcpu_el1_is_32bit(vcpu)) |
323 |
++ return -EINVAL; |
324 |
++ break; |
325 |
+ case PSR_MODE_EL0t: |
326 |
+ case PSR_MODE_EL1t: |
327 |
+ case PSR_MODE_EL1h: |
328 |
++ if (vcpu_el1_is_32bit(vcpu)) |
329 |
++ return -EINVAL; |
330 |
+ break; |
331 |
+ default: |
332 |
+ err = -EINVAL; |
333 |
+diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile |
334 |
+index c22da16d67b8..5c7bfa8478e7 100644 |
335 |
+--- a/arch/mips/boot/Makefile |
336 |
++++ b/arch/mips/boot/Makefile |
337 |
+@@ -118,10 +118,12 @@ ifeq ($(ADDR_BITS),64) |
338 |
+ itb_addr_cells = 2 |
339 |
+ endif |
340 |
+ |
341 |
++targets += vmlinux.its.S |
342 |
++ |
343 |
+ quiet_cmd_its_cat = CAT $@ |
344 |
+- cmd_its_cat = cat $^ >$@ |
345 |
++ cmd_its_cat = cat $(filter-out $(PHONY), $^) >$@ |
346 |
+ |
347 |
+-$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) |
348 |
++$(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE |
349 |
+ $(call if_changed,its_cat) |
350 |
+ |
351 |
+ quiet_cmd_cpp_its_S = ITS $@ |
352 |
+diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c |
353 |
+index 2694d078741d..9dafd7af39b8 100644 |
354 |
+--- a/arch/powerpc/kernel/machine_kexec.c |
355 |
++++ b/arch/powerpc/kernel/machine_kexec.c |
356 |
+@@ -186,7 +186,12 @@ void __init reserve_crashkernel(void) |
357 |
+ (unsigned long)(crashk_res.start >> 20), |
358 |
+ (unsigned long)(memblock_phys_mem_size() >> 20)); |
359 |
+ |
360 |
+- memblock_reserve(crashk_res.start, crash_size); |
361 |
++ if (!memblock_is_region_memory(crashk_res.start, crash_size) || |
362 |
++ memblock_reserve(crashk_res.start, crash_size)) { |
363 |
++ pr_err("Failed to reserve memory for crashkernel!\n"); |
364 |
++ crashk_res.start = crashk_res.end = 0; |
365 |
++ return; |
366 |
++ } |
367 |
+ } |
368 |
+ |
369 |
+ int overlaps_crashkernel(unsigned long start, unsigned long size) |
370 |
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c |
371 |
+index e919696c7137..ddef22e00ddd 100644 |
372 |
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c |
373 |
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c |
374 |
+@@ -2787,7 +2787,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, |
375 |
+ level_shift = entries_shift + 3; |
376 |
+ level_shift = max_t(unsigned, level_shift, PAGE_SHIFT); |
377 |
+ |
378 |
+- if ((level_shift - 3) * levels + page_shift >= 60) |
379 |
++ if ((level_shift - 3) * levels + page_shift >= 55) |
380 |
+ return -EINVAL; |
381 |
+ |
382 |
+ /* Allocate TCE table */ |
383 |
+diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c |
384 |
+index a441cba8d165..b0fad29c1427 100644 |
385 |
+--- a/arch/s390/kernel/sysinfo.c |
386 |
++++ b/arch/s390/kernel/sysinfo.c |
387 |
+@@ -59,6 +59,8 @@ int stsi(void *sysinfo, int fc, int sel1, int sel2) |
388 |
+ } |
389 |
+ EXPORT_SYMBOL(stsi); |
390 |
+ |
391 |
++#ifdef CONFIG_PROC_FS |
392 |
++ |
393 |
+ static bool convert_ext_name(unsigned char encoding, char *name, size_t len) |
394 |
+ { |
395 |
+ switch (encoding) { |
396 |
+@@ -311,6 +313,8 @@ static int __init sysinfo_create_proc(void) |
397 |
+ } |
398 |
+ device_initcall(sysinfo_create_proc); |
399 |
+ |
400 |
++#endif /* CONFIG_PROC_FS */ |
401 |
++ |
402 |
+ /* |
403 |
+ * Service levels interface. |
404 |
+ */ |
405 |
+diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c |
406 |
+index 920d40894535..290e71e57541 100644 |
407 |
+--- a/arch/s390/mm/extmem.c |
408 |
++++ b/arch/s390/mm/extmem.c |
409 |
+@@ -80,7 +80,7 @@ struct qin64 { |
410 |
+ struct dcss_segment { |
411 |
+ struct list_head list; |
412 |
+ char dcss_name[8]; |
413 |
+- char res_name[15]; |
414 |
++ char res_name[16]; |
415 |
+ unsigned long start_addr; |
416 |
+ unsigned long end; |
417 |
+ atomic_t ref_count; |
418 |
+@@ -433,7 +433,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long |
419 |
+ memcpy(&seg->res_name, seg->dcss_name, 8); |
420 |
+ EBCASC(seg->res_name, 8); |
421 |
+ seg->res_name[8] = '\0'; |
422 |
+- strncat(seg->res_name, " (DCSS)", 7); |
423 |
++ strlcat(seg->res_name, " (DCSS)", sizeof(seg->res_name)); |
424 |
+ seg->res->name = seg->res_name; |
425 |
+ rc = seg->vm_segtype; |
426 |
+ if (rc == SEG_TYPE_SC || |
427 |
+diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c |
428 |
+index 334b6d103cbd..29653f713162 100644 |
429 |
+--- a/arch/s390/mm/pgalloc.c |
430 |
++++ b/arch/s390/mm/pgalloc.c |
431 |
+@@ -27,7 +27,7 @@ static struct ctl_table page_table_sysctl[] = { |
432 |
+ .data = &page_table_allocate_pgste, |
433 |
+ .maxlen = sizeof(int), |
434 |
+ .mode = S_IRUGO | S_IWUSR, |
435 |
+- .proc_handler = proc_dointvec, |
436 |
++ .proc_handler = proc_dointvec_minmax, |
437 |
+ .extra1 = &page_table_allocate_pgste_min, |
438 |
+ .extra2 = &page_table_allocate_pgste_max, |
439 |
+ }, |
440 |
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S |
441 |
+index 0fae7096ae23..164cd7529f0b 100644 |
442 |
+--- a/arch/x86/entry/entry_64.S |
443 |
++++ b/arch/x86/entry/entry_64.S |
444 |
+@@ -88,7 +88,7 @@ END(native_usergs_sysret64) |
445 |
+ .endm |
446 |
+ |
447 |
+ .macro TRACE_IRQS_IRETQ_DEBUG |
448 |
+- bt $9, EFLAGS(%rsp) /* interrupts off? */ |
449 |
++ btl $9, EFLAGS(%rsp) /* interrupts off? */ |
450 |
+ jnc 1f |
451 |
+ TRACE_IRQS_ON_DEBUG |
452 |
+ 1: |
453 |
+@@ -630,7 +630,7 @@ retint_kernel: |
454 |
+ #ifdef CONFIG_PREEMPT |
455 |
+ /* Interrupts are off */ |
456 |
+ /* Check if we need preemption */ |
457 |
+- bt $9, EFLAGS(%rsp) /* were interrupts off? */ |
458 |
++ btl $9, EFLAGS(%rsp) /* were interrupts off? */ |
459 |
+ jnc 1f |
460 |
+ 0: cmpl $0, PER_CPU_VAR(__preempt_count) |
461 |
+ jnz 1f |
462 |
+diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c |
463 |
+index cf372b90557e..a4170048a30b 100644 |
464 |
+--- a/arch/x86/events/intel/lbr.c |
465 |
++++ b/arch/x86/events/intel/lbr.c |
466 |
+@@ -346,7 +346,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) |
467 |
+ |
468 |
+ mask = x86_pmu.lbr_nr - 1; |
469 |
+ tos = task_ctx->tos; |
470 |
+- for (i = 0; i < tos; i++) { |
471 |
++ for (i = 0; i < task_ctx->valid_lbrs; i++) { |
472 |
+ lbr_idx = (tos - i) & mask; |
473 |
+ wrlbr_from(lbr_idx, task_ctx->lbr_from[i]); |
474 |
+ wrlbr_to (lbr_idx, task_ctx->lbr_to[i]); |
475 |
+@@ -354,6 +354,15 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) |
476 |
+ if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
477 |
+ wrmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); |
478 |
+ } |
479 |
++ |
480 |
++ for (; i < x86_pmu.lbr_nr; i++) { |
481 |
++ lbr_idx = (tos - i) & mask; |
482 |
++ wrlbr_from(lbr_idx, 0); |
483 |
++ wrlbr_to(lbr_idx, 0); |
484 |
++ if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
485 |
++ wrmsrl(MSR_LBR_INFO_0 + lbr_idx, 0); |
486 |
++ } |
487 |
++ |
488 |
+ wrmsrl(x86_pmu.lbr_tos, tos); |
489 |
+ task_ctx->lbr_stack_state = LBR_NONE; |
490 |
+ } |
491 |
+@@ -361,7 +370,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) |
492 |
+ static void __intel_pmu_lbr_save(struct x86_perf_task_context *task_ctx) |
493 |
+ { |
494 |
+ unsigned lbr_idx, mask; |
495 |
+- u64 tos; |
496 |
++ u64 tos, from; |
497 |
+ int i; |
498 |
+ |
499 |
+ if (task_ctx->lbr_callstack_users == 0) { |
500 |
+@@ -371,13 +380,17 @@ static void __intel_pmu_lbr_save(struct x86_perf_task_context *task_ctx) |
501 |
+ |
502 |
+ mask = x86_pmu.lbr_nr - 1; |
503 |
+ tos = intel_pmu_lbr_tos(); |
504 |
+- for (i = 0; i < tos; i++) { |
505 |
++ for (i = 0; i < x86_pmu.lbr_nr; i++) { |
506 |
+ lbr_idx = (tos - i) & mask; |
507 |
+- task_ctx->lbr_from[i] = rdlbr_from(lbr_idx); |
508 |
++ from = rdlbr_from(lbr_idx); |
509 |
++ if (!from) |
510 |
++ break; |
511 |
++ task_ctx->lbr_from[i] = from; |
512 |
+ task_ctx->lbr_to[i] = rdlbr_to(lbr_idx); |
513 |
+ if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
514 |
+ rdmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); |
515 |
+ } |
516 |
++ task_ctx->valid_lbrs = i; |
517 |
+ task_ctx->tos = tos; |
518 |
+ task_ctx->lbr_stack_state = LBR_VALID; |
519 |
+ } |
520 |
+@@ -531,7 +544,7 @@ static void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc) |
521 |
+ */ |
522 |
+ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) |
523 |
+ { |
524 |
+- bool need_info = false; |
525 |
++ bool need_info = false, call_stack = false; |
526 |
+ unsigned long mask = x86_pmu.lbr_nr - 1; |
527 |
+ int lbr_format = x86_pmu.intel_cap.lbr_format; |
528 |
+ u64 tos = intel_pmu_lbr_tos(); |
529 |
+@@ -542,7 +555,7 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) |
530 |
+ if (cpuc->lbr_sel) { |
531 |
+ need_info = !(cpuc->lbr_sel->config & LBR_NO_INFO); |
532 |
+ if (cpuc->lbr_sel->config & LBR_CALL_STACK) |
533 |
+- num = tos; |
534 |
++ call_stack = true; |
535 |
+ } |
536 |
+ |
537 |
+ for (i = 0; i < num; i++) { |
538 |
+@@ -555,6 +568,13 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) |
539 |
+ from = rdlbr_from(lbr_idx); |
540 |
+ to = rdlbr_to(lbr_idx); |
541 |
+ |
542 |
++ /* |
543 |
++ * Read LBR call stack entries |
544 |
++ * until invalid entry (0s) is detected. |
545 |
++ */ |
546 |
++ if (call_stack && !from) |
547 |
++ break; |
548 |
++ |
549 |
+ if (lbr_format == LBR_FORMAT_INFO && need_info) { |
550 |
+ u64 info; |
551 |
+ |
552 |
+diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h |
553 |
+index dc4728eccfd8..c6698c63c047 100644 |
554 |
+--- a/arch/x86/events/perf_event.h |
555 |
++++ b/arch/x86/events/perf_event.h |
556 |
+@@ -646,6 +646,7 @@ struct x86_perf_task_context { |
557 |
+ u64 lbr_to[MAX_LBR_ENTRIES]; |
558 |
+ u64 lbr_info[MAX_LBR_ENTRIES]; |
559 |
+ int tos; |
560 |
++ int valid_lbrs; |
561 |
+ int lbr_callstack_users; |
562 |
+ int lbr_stack_state; |
563 |
+ }; |
564 |
+diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h |
565 |
+index e203169931c7..6390bd8c141b 100644 |
566 |
+--- a/arch/x86/include/asm/fixmap.h |
567 |
++++ b/arch/x86/include/asm/fixmap.h |
568 |
+@@ -14,6 +14,16 @@ |
569 |
+ #ifndef _ASM_X86_FIXMAP_H |
570 |
+ #define _ASM_X86_FIXMAP_H |
571 |
+ |
572 |
++/* |
573 |
++ * Exposed to assembly code for setting up initial page tables. Cannot be |
574 |
++ * calculated in assembly code (fixmap entries are an enum), but is sanity |
575 |
++ * checked in the actual fixmap C code to make sure that the fixmap is |
576 |
++ * covered fully. |
577 |
++ */ |
578 |
++#define FIXMAP_PMD_NUM 2 |
579 |
++/* fixmap starts downwards from the 507th entry in level2_fixmap_pgt */ |
580 |
++#define FIXMAP_PMD_TOP 507 |
581 |
++ |
582 |
+ #ifndef __ASSEMBLY__ |
583 |
+ #include <linux/kernel.h> |
584 |
+ #include <asm/acpi.h> |
585 |
+diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h |
586 |
+index 4ecb72831938..ef938583147e 100644 |
587 |
+--- a/arch/x86/include/asm/pgtable_64.h |
588 |
++++ b/arch/x86/include/asm/pgtable_64.h |
589 |
+@@ -14,6 +14,7 @@ |
590 |
+ #include <asm/processor.h> |
591 |
+ #include <linux/bitops.h> |
592 |
+ #include <linux/threads.h> |
593 |
++#include <asm/fixmap.h> |
594 |
+ |
595 |
+ extern p4d_t level4_kernel_pgt[512]; |
596 |
+ extern p4d_t level4_ident_pgt[512]; |
597 |
+@@ -22,7 +23,7 @@ extern pud_t level3_ident_pgt[512]; |
598 |
+ extern pmd_t level2_kernel_pgt[512]; |
599 |
+ extern pmd_t level2_fixmap_pgt[512]; |
600 |
+ extern pmd_t level2_ident_pgt[512]; |
601 |
+-extern pte_t level1_fixmap_pgt[512]; |
602 |
++extern pte_t level1_fixmap_pgt[512 * FIXMAP_PMD_NUM]; |
603 |
+ extern pgd_t init_top_pgt[]; |
604 |
+ |
605 |
+ #define swapper_pg_dir init_top_pgt |
606 |
+diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c |
607 |
+index 7ba5d819ebe3..45b5c6c4a55e 100644 |
608 |
+--- a/arch/x86/kernel/head64.c |
609 |
++++ b/arch/x86/kernel/head64.c |
610 |
+@@ -31,6 +31,7 @@ |
611 |
+ #include <asm/bootparam_utils.h> |
612 |
+ #include <asm/microcode.h> |
613 |
+ #include <asm/kasan.h> |
614 |
++#include <asm/fixmap.h> |
615 |
+ |
616 |
+ /* |
617 |
+ * Manage page tables very early on. |
618 |
+@@ -93,7 +94,8 @@ unsigned long __head __startup_64(unsigned long physaddr, |
619 |
+ pud[511] += load_delta; |
620 |
+ |
621 |
+ pmd = fixup_pointer(level2_fixmap_pgt, physaddr); |
622 |
+- pmd[506] += load_delta; |
623 |
++ for (i = FIXMAP_PMD_TOP; i > FIXMAP_PMD_TOP - FIXMAP_PMD_NUM; i--) |
624 |
++ pmd[i] += load_delta; |
625 |
+ |
626 |
+ /* |
627 |
+ * Set up the identity mapping for the switchover. These |
628 |
+diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S |
629 |
+index 0f545b3cf926..8d59dfe629a9 100644 |
630 |
+--- a/arch/x86/kernel/head_64.S |
631 |
++++ b/arch/x86/kernel/head_64.S |
632 |
+@@ -24,6 +24,7 @@ |
633 |
+ #include "../entry/calling.h" |
634 |
+ #include <asm/export.h> |
635 |
+ #include <asm/nospec-branch.h> |
636 |
++#include <asm/fixmap.h> |
637 |
+ |
638 |
+ #ifdef CONFIG_PARAVIRT |
639 |
+ #include <asm/asm-offsets.h> |
640 |
+@@ -438,13 +439,20 @@ NEXT_PAGE(level2_kernel_pgt) |
641 |
+ KERNEL_IMAGE_SIZE/PMD_SIZE) |
642 |
+ |
643 |
+ NEXT_PAGE(level2_fixmap_pgt) |
644 |
+- .fill 506,8,0 |
645 |
+- .quad level1_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC |
646 |
+- /* 8MB reserved for vsyscalls + a 2MB hole = 4 + 1 entries */ |
647 |
+- .fill 5,8,0 |
648 |
++ .fill (512 - 4 - FIXMAP_PMD_NUM),8,0 |
649 |
++ pgtno = 0 |
650 |
++ .rept (FIXMAP_PMD_NUM) |
651 |
++ .quad level1_fixmap_pgt + (pgtno << PAGE_SHIFT) - __START_KERNEL_map \ |
652 |
++ + _PAGE_TABLE_NOENC; |
653 |
++ pgtno = pgtno + 1 |
654 |
++ .endr |
655 |
++ /* 6 MB reserved space + a 2MB hole */ |
656 |
++ .fill 4,8,0 |
657 |
+ |
658 |
+ NEXT_PAGE(level1_fixmap_pgt) |
659 |
++ .rept (FIXMAP_PMD_NUM) |
660 |
+ .fill 512,8,0 |
661 |
++ .endr |
662 |
+ |
663 |
+ #undef PMDS |
664 |
+ |
665 |
+diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c |
666 |
+index 19afdbd7d0a7..5532d1be7687 100644 |
667 |
+--- a/arch/x86/kernel/tsc_msr.c |
668 |
++++ b/arch/x86/kernel/tsc_msr.c |
669 |
+@@ -12,6 +12,7 @@ |
670 |
+ #include <asm/setup.h> |
671 |
+ #include <asm/apic.h> |
672 |
+ #include <asm/param.h> |
673 |
++#include <asm/tsc.h> |
674 |
+ |
675 |
+ #define MAX_NUM_FREQS 9 |
676 |
+ |
677 |
+diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c |
678 |
+index 34a2a3bfde9c..22cbad56acab 100644 |
679 |
+--- a/arch/x86/mm/numa_emulation.c |
680 |
++++ b/arch/x86/mm/numa_emulation.c |
681 |
+@@ -61,7 +61,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei, |
682 |
+ eb->nid = nid; |
683 |
+ |
684 |
+ if (emu_nid_to_phys[nid] == NUMA_NO_NODE) |
685 |
+- emu_nid_to_phys[nid] = nid; |
686 |
++ emu_nid_to_phys[nid] = pb->nid; |
687 |
+ |
688 |
+ pb->start += size; |
689 |
+ if (pb->start >= pb->end) { |
690 |
+diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c |
691 |
+index 2bdb8e8a9d7c..aafd4edfa2ac 100644 |
692 |
+--- a/arch/x86/mm/pgtable.c |
693 |
++++ b/arch/x86/mm/pgtable.c |
694 |
+@@ -573,6 +573,15 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) |
695 |
+ { |
696 |
+ unsigned long address = __fix_to_virt(idx); |
697 |
+ |
698 |
++#ifdef CONFIG_X86_64 |
699 |
++ /* |
700 |
++ * Ensure that the static initial page tables are covering the |
701 |
++ * fixmap completely. |
702 |
++ */ |
703 |
++ BUILD_BUG_ON(__end_of_permanent_fixed_addresses > |
704 |
++ (FIXMAP_PMD_NUM * PTRS_PER_PTE)); |
705 |
++#endif |
706 |
++ |
707 |
+ if (idx >= __end_of_fixed_addresses) { |
708 |
+ BUG(); |
709 |
+ return; |
710 |
+diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c |
711 |
+index b07e3ffc5ac5..60c48f5d6b0e 100644 |
712 |
+--- a/arch/x86/mm/pti.c |
713 |
++++ b/arch/x86/mm/pti.c |
714 |
+@@ -224,7 +224,7 @@ static __init pmd_t *pti_user_pagetable_walk_pmd(unsigned long address) |
715 |
+ * |
716 |
+ * Returns a pointer to a PTE on success, or NULL on failure. |
717 |
+ */ |
718 |
+-static __init pte_t *pti_user_pagetable_walk_pte(unsigned long address) |
719 |
++static pte_t *pti_user_pagetable_walk_pte(unsigned long address) |
720 |
+ { |
721 |
+ gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO); |
722 |
+ pmd_t *pmd; |
723 |
+diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c |
724 |
+index 42cfad67b6ac..8ed11a5b1a9d 100644 |
725 |
+--- a/arch/x86/xen/mmu_pv.c |
726 |
++++ b/arch/x86/xen/mmu_pv.c |
727 |
+@@ -1879,7 +1879,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) |
728 |
+ /* L3_k[511] -> level2_fixmap_pgt */ |
729 |
+ convert_pfn_mfn(level3_kernel_pgt); |
730 |
+ |
731 |
+- /* L3_k[511][506] -> level1_fixmap_pgt */ |
732 |
++ /* L3_k[511][508-FIXMAP_PMD_NUM ... 507] -> level1_fixmap_pgt */ |
733 |
+ convert_pfn_mfn(level2_fixmap_pgt); |
734 |
+ |
735 |
+ /* We get [511][511] and have Xen's version of level2_kernel_pgt */ |
736 |
+@@ -1924,7 +1924,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) |
737 |
+ set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); |
738 |
+ set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); |
739 |
+ set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); |
740 |
+- set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); |
741 |
++ |
742 |
++ for (i = 0; i < FIXMAP_PMD_NUM; i++) { |
743 |
++ set_page_prot(level1_fixmap_pgt + i * PTRS_PER_PTE, |
744 |
++ PAGE_KERNEL_RO); |
745 |
++ } |
746 |
+ |
747 |
+ /* Pin down new L4 */ |
748 |
+ pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, |
749 |
+diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c |
750 |
+index 4ee7c041bb82..8882e90e868e 100644 |
751 |
+--- a/crypto/ablkcipher.c |
752 |
++++ b/crypto/ablkcipher.c |
753 |
+@@ -368,6 +368,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
754 |
+ strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type)); |
755 |
+ strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>", |
756 |
+ sizeof(rblkcipher.geniv)); |
757 |
++ rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0'; |
758 |
+ |
759 |
+ rblkcipher.blocksize = alg->cra_blocksize; |
760 |
+ rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; |
761 |
+@@ -442,6 +443,7 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
762 |
+ strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type)); |
763 |
+ strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>", |
764 |
+ sizeof(rblkcipher.geniv)); |
765 |
++ rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0'; |
766 |
+ |
767 |
+ rblkcipher.blocksize = alg->cra_blocksize; |
768 |
+ rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; |
769 |
+diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c |
770 |
+index d84c6920ada9..830821f234d2 100644 |
771 |
+--- a/crypto/blkcipher.c |
772 |
++++ b/crypto/blkcipher.c |
773 |
+@@ -511,6 +511,7 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) |
774 |
+ strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type)); |
775 |
+ strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>", |
776 |
+ sizeof(rblkcipher.geniv)); |
777 |
++ rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0'; |
778 |
+ |
779 |
+ rblkcipher.blocksize = alg->cra_blocksize; |
780 |
+ rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize; |
781 |
+diff --git a/drivers/ata/pata_ftide010.c b/drivers/ata/pata_ftide010.c |
782 |
+index 5d4b72e21161..569a4a662dcd 100644 |
783 |
+--- a/drivers/ata/pata_ftide010.c |
784 |
++++ b/drivers/ata/pata_ftide010.c |
785 |
+@@ -256,14 +256,12 @@ static struct ata_port_operations pata_ftide010_port_ops = { |
786 |
+ .qc_issue = ftide010_qc_issue, |
787 |
+ }; |
788 |
+ |
789 |
+-static struct ata_port_info ftide010_port_info[] = { |
790 |
+- { |
791 |
+- .flags = ATA_FLAG_SLAVE_POSS, |
792 |
+- .mwdma_mask = ATA_MWDMA2, |
793 |
+- .udma_mask = ATA_UDMA6, |
794 |
+- .pio_mask = ATA_PIO4, |
795 |
+- .port_ops = &pata_ftide010_port_ops, |
796 |
+- }, |
797 |
++static struct ata_port_info ftide010_port_info = { |
798 |
++ .flags = ATA_FLAG_SLAVE_POSS, |
799 |
++ .mwdma_mask = ATA_MWDMA2, |
800 |
++ .udma_mask = ATA_UDMA6, |
801 |
++ .pio_mask = ATA_PIO4, |
802 |
++ .port_ops = &pata_ftide010_port_ops, |
803 |
+ }; |
804 |
+ |
805 |
+ #if IS_ENABLED(CONFIG_SATA_GEMINI) |
806 |
+@@ -349,6 +347,7 @@ static int pata_ftide010_gemini_cable_detect(struct ata_port *ap) |
807 |
+ } |
808 |
+ |
809 |
+ static int pata_ftide010_gemini_init(struct ftide010 *ftide, |
810 |
++ struct ata_port_info *pi, |
811 |
+ bool is_ata1) |
812 |
+ { |
813 |
+ struct device *dev = ftide->dev; |
814 |
+@@ -373,7 +372,13 @@ static int pata_ftide010_gemini_init(struct ftide010 *ftide, |
815 |
+ |
816 |
+ /* Flag port as SATA-capable */ |
817 |
+ if (gemini_sata_bridge_enabled(sg, is_ata1)) |
818 |
+- ftide010_port_info[0].flags |= ATA_FLAG_SATA; |
819 |
++ pi->flags |= ATA_FLAG_SATA; |
820 |
++ |
821 |
++ /* This device has broken DMA, only PIO works */ |
822 |
++ if (of_machine_is_compatible("itian,sq201")) { |
823 |
++ pi->mwdma_mask = 0; |
824 |
++ pi->udma_mask = 0; |
825 |
++ } |
826 |
+ |
827 |
+ /* |
828 |
+ * We assume that a simple 40-wire cable is used in the PATA mode. |
829 |
+@@ -435,6 +440,7 @@ static int pata_ftide010_gemini_init(struct ftide010 *ftide, |
830 |
+ } |
831 |
+ #else |
832 |
+ static int pata_ftide010_gemini_init(struct ftide010 *ftide, |
833 |
++ struct ata_port_info *pi, |
834 |
+ bool is_ata1) |
835 |
+ { |
836 |
+ return -ENOTSUPP; |
837 |
+@@ -446,7 +452,7 @@ static int pata_ftide010_probe(struct platform_device *pdev) |
838 |
+ { |
839 |
+ struct device *dev = &pdev->dev; |
840 |
+ struct device_node *np = dev->of_node; |
841 |
+- const struct ata_port_info pi = ftide010_port_info[0]; |
842 |
++ struct ata_port_info pi = ftide010_port_info; |
843 |
+ const struct ata_port_info *ppi[] = { &pi, NULL }; |
844 |
+ struct ftide010 *ftide; |
845 |
+ struct resource *res; |
846 |
+@@ -490,6 +496,7 @@ static int pata_ftide010_probe(struct platform_device *pdev) |
847 |
+ * are ATA0. This will also set up the cable types. |
848 |
+ */ |
849 |
+ ret = pata_ftide010_gemini_init(ftide, |
850 |
++ &pi, |
851 |
+ (res->start == 0x63400000)); |
852 |
+ if (ret) |
853 |
+ goto err_dis_clk; |
854 |
+diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c |
855 |
+index 60c086a53609..3d0287e212fe 100644 |
856 |
+--- a/drivers/block/floppy.c |
857 |
++++ b/drivers/block/floppy.c |
858 |
+@@ -3462,6 +3462,9 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int |
859 |
+ (struct floppy_struct **)&outparam); |
860 |
+ if (ret) |
861 |
+ return ret; |
862 |
++ memcpy(&inparam.g, outparam, |
863 |
++ offsetof(struct floppy_struct, name)); |
864 |
++ outparam = &inparam.g; |
865 |
+ break; |
866 |
+ case FDMSGON: |
867 |
+ UDP->flags |= FTD_MSG; |
868 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
869 |
+index 819521d5895e..b8dffe937f4f 100644 |
870 |
+--- a/drivers/bluetooth/btusb.c |
871 |
++++ b/drivers/bluetooth/btusb.c |
872 |
+@@ -375,6 +375,7 @@ static const struct usb_device_id blacklist_table[] = { |
873 |
+ { USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK }, |
874 |
+ |
875 |
+ /* Additional Realtek 8723DE Bluetooth devices */ |
876 |
++ { USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK }, |
877 |
+ { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK }, |
878 |
+ |
879 |
+ /* Additional Realtek 8821AE Bluetooth devices */ |
880 |
+diff --git a/drivers/crypto/cavium/nitrox/nitrox_dev.h b/drivers/crypto/cavium/nitrox/nitrox_dev.h |
881 |
+index 9a476bb6d4c7..af596455b420 100644 |
882 |
+--- a/drivers/crypto/cavium/nitrox/nitrox_dev.h |
883 |
++++ b/drivers/crypto/cavium/nitrox/nitrox_dev.h |
884 |
+@@ -35,6 +35,7 @@ struct nitrox_cmdq { |
885 |
+ /* requests in backlog queues */ |
886 |
+ atomic_t backlog_count; |
887 |
+ |
888 |
++ int write_idx; |
889 |
+ /* command size 32B/64B */ |
890 |
+ u8 instr_size; |
891 |
+ u8 qno; |
892 |
+@@ -87,7 +88,7 @@ struct nitrox_bh { |
893 |
+ struct bh_data *slc; |
894 |
+ }; |
895 |
+ |
896 |
+-/* NITROX-5 driver state */ |
897 |
++/* NITROX-V driver state */ |
898 |
+ #define NITROX_UCODE_LOADED 0 |
899 |
+ #define NITROX_READY 1 |
900 |
+ |
901 |
+diff --git a/drivers/crypto/cavium/nitrox/nitrox_lib.c b/drivers/crypto/cavium/nitrox/nitrox_lib.c |
902 |
+index 4fdc921ba611..9906c0086647 100644 |
903 |
+--- a/drivers/crypto/cavium/nitrox/nitrox_lib.c |
904 |
++++ b/drivers/crypto/cavium/nitrox/nitrox_lib.c |
905 |
+@@ -36,6 +36,7 @@ static int cmdq_common_init(struct nitrox_cmdq *cmdq) |
906 |
+ cmdq->head = PTR_ALIGN(cmdq->head_unaligned, PKT_IN_ALIGN); |
907 |
+ cmdq->dma = PTR_ALIGN(cmdq->dma_unaligned, PKT_IN_ALIGN); |
908 |
+ cmdq->qsize = (qsize + PKT_IN_ALIGN); |
909 |
++ cmdq->write_idx = 0; |
910 |
+ |
911 |
+ spin_lock_init(&cmdq->response_lock); |
912 |
+ spin_lock_init(&cmdq->cmdq_lock); |
913 |
+diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c |
914 |
+index 4addc238a6ef..4adf28176a4e 100644 |
915 |
+--- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c |
916 |
++++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c |
917 |
+@@ -43,6 +43,16 @@ |
918 |
+ * Invalid flag options in AES-CCM IV. |
919 |
+ */ |
920 |
+ |
921 |
++static inline int incr_index(int index, int count, int max) |
922 |
++{ |
923 |
++ if ((index + count) >= max) |
924 |
++ index = index + count - max; |
925 |
++ else |
926 |
++ index += count; |
927 |
++ |
928 |
++ return index; |
929 |
++} |
930 |
++ |
931 |
+ /** |
932 |
+ * dma_free_sglist - unmap and free the sg lists. |
933 |
+ * @ndev: N5 device |
934 |
+@@ -427,30 +437,29 @@ static void post_se_instr(struct nitrox_softreq *sr, |
935 |
+ struct nitrox_cmdq *cmdq) |
936 |
+ { |
937 |
+ struct nitrox_device *ndev = sr->ndev; |
938 |
+- union nps_pkt_in_instr_baoff_dbell pkt_in_baoff_dbell; |
939 |
+- u64 offset; |
940 |
++ int idx; |
941 |
+ u8 *ent; |
942 |
+ |
943 |
+ spin_lock_bh(&cmdq->cmdq_lock); |
944 |
+ |
945 |
+- /* get the next write offset */ |
946 |
+- offset = NPS_PKT_IN_INSTR_BAOFF_DBELLX(cmdq->qno); |
947 |
+- pkt_in_baoff_dbell.value = nitrox_read_csr(ndev, offset); |
948 |
++ idx = cmdq->write_idx; |
949 |
+ /* copy the instruction */ |
950 |
+- ent = cmdq->head + pkt_in_baoff_dbell.s.aoff; |
951 |
++ ent = cmdq->head + (idx * cmdq->instr_size); |
952 |
+ memcpy(ent, &sr->instr, cmdq->instr_size); |
953 |
+- /* flush the command queue updates */ |
954 |
+- dma_wmb(); |
955 |
+ |
956 |
+- sr->tstamp = jiffies; |
957 |
+ atomic_set(&sr->status, REQ_POSTED); |
958 |
+ response_list_add(sr, cmdq); |
959 |
++ sr->tstamp = jiffies; |
960 |
++ /* flush the command queue updates */ |
961 |
++ dma_wmb(); |
962 |
+ |
963 |
+ /* Ring doorbell with count 1 */ |
964 |
+ writeq(1, cmdq->dbell_csr_addr); |
965 |
+ /* orders the doorbell rings */ |
966 |
+ mmiowb(); |
967 |
+ |
968 |
++ cmdq->write_idx = incr_index(idx, 1, ndev->qlen); |
969 |
++ |
970 |
+ spin_unlock_bh(&cmdq->cmdq_lock); |
971 |
+ } |
972 |
+ |
973 |
+@@ -460,6 +469,9 @@ static int post_backlog_cmds(struct nitrox_cmdq *cmdq) |
974 |
+ struct nitrox_softreq *sr, *tmp; |
975 |
+ int ret = 0; |
976 |
+ |
977 |
++ if (!atomic_read(&cmdq->backlog_count)) |
978 |
++ return 0; |
979 |
++ |
980 |
+ spin_lock_bh(&cmdq->backlog_lock); |
981 |
+ |
982 |
+ list_for_each_entry_safe(sr, tmp, &cmdq->backlog_head, backlog) { |
983 |
+@@ -467,7 +479,7 @@ static int post_backlog_cmds(struct nitrox_cmdq *cmdq) |
984 |
+ |
985 |
+ /* submit until space available */ |
986 |
+ if (unlikely(cmdq_full(cmdq, ndev->qlen))) { |
987 |
+- ret = -EBUSY; |
988 |
++ ret = -ENOSPC; |
989 |
+ break; |
990 |
+ } |
991 |
+ /* delete from backlog list */ |
992 |
+@@ -492,23 +504,20 @@ static int nitrox_enqueue_request(struct nitrox_softreq *sr) |
993 |
+ { |
994 |
+ struct nitrox_cmdq *cmdq = sr->cmdq; |
995 |
+ struct nitrox_device *ndev = sr->ndev; |
996 |
+- int ret = -EBUSY; |
997 |
++ |
998 |
++ /* try to post backlog requests */ |
999 |
++ post_backlog_cmds(cmdq); |
1000 |
+ |
1001 |
+ if (unlikely(cmdq_full(cmdq, ndev->qlen))) { |
1002 |
+ if (!(sr->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) |
1003 |
+- return -EAGAIN; |
1004 |
+- |
1005 |
++ return -ENOSPC; |
1006 |
++ /* add to backlog list */ |
1007 |
+ backlog_list_add(sr, cmdq); |
1008 |
+- } else { |
1009 |
+- ret = post_backlog_cmds(cmdq); |
1010 |
+- if (ret) { |
1011 |
+- backlog_list_add(sr, cmdq); |
1012 |
+- return ret; |
1013 |
+- } |
1014 |
+- post_se_instr(sr, cmdq); |
1015 |
+- ret = -EINPROGRESS; |
1016 |
++ return -EBUSY; |
1017 |
+ } |
1018 |
+- return ret; |
1019 |
++ post_se_instr(sr, cmdq); |
1020 |
++ |
1021 |
++ return -EINPROGRESS; |
1022 |
+ } |
1023 |
+ |
1024 |
+ /** |
1025 |
+@@ -625,11 +634,9 @@ int nitrox_process_se_request(struct nitrox_device *ndev, |
1026 |
+ */ |
1027 |
+ sr->instr.fdata[0] = *((u64 *)&req->gph); |
1028 |
+ sr->instr.fdata[1] = 0; |
1029 |
+- /* flush the soft_req changes before posting the cmd */ |
1030 |
+- wmb(); |
1031 |
+ |
1032 |
+ ret = nitrox_enqueue_request(sr); |
1033 |
+- if (ret == -EAGAIN) |
1034 |
++ if (ret == -ENOSPC) |
1035 |
+ goto send_fail; |
1036 |
+ |
1037 |
+ return ret; |
1038 |
+diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c |
1039 |
+index e4fcfa84fbd3..79c13301bf41 100644 |
1040 |
+--- a/drivers/edac/edac_mc_sysfs.c |
1041 |
++++ b/drivers/edac/edac_mc_sysfs.c |
1042 |
+@@ -1097,14 +1097,14 @@ int __init edac_mc_sysfs_init(void) |
1043 |
+ |
1044 |
+ err = device_add(mci_pdev); |
1045 |
+ if (err < 0) |
1046 |
+- goto out_dev_free; |
1047 |
++ goto out_put_device; |
1048 |
+ |
1049 |
+ edac_dbg(0, "device %s created\n", dev_name(mci_pdev)); |
1050 |
+ |
1051 |
+ return 0; |
1052 |
+ |
1053 |
+- out_dev_free: |
1054 |
+- kfree(mci_pdev); |
1055 |
++ out_put_device: |
1056 |
++ put_device(mci_pdev); |
1057 |
+ out: |
1058 |
+ return err; |
1059 |
+ } |
1060 |
+diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c |
1061 |
+index c16c3b931b3d..6c7d5f20eacb 100644 |
1062 |
+--- a/drivers/edac/i7core_edac.c |
1063 |
++++ b/drivers/edac/i7core_edac.c |
1064 |
+@@ -1177,15 +1177,14 @@ static int i7core_create_sysfs_devices(struct mem_ctl_info *mci) |
1065 |
+ |
1066 |
+ rc = device_add(pvt->addrmatch_dev); |
1067 |
+ if (rc < 0) |
1068 |
+- return rc; |
1069 |
++ goto err_put_addrmatch; |
1070 |
+ |
1071 |
+ if (!pvt->is_registered) { |
1072 |
+ pvt->chancounts_dev = kzalloc(sizeof(*pvt->chancounts_dev), |
1073 |
+ GFP_KERNEL); |
1074 |
+ if (!pvt->chancounts_dev) { |
1075 |
+- put_device(pvt->addrmatch_dev); |
1076 |
+- device_del(pvt->addrmatch_dev); |
1077 |
+- return -ENOMEM; |
1078 |
++ rc = -ENOMEM; |
1079 |
++ goto err_del_addrmatch; |
1080 |
+ } |
1081 |
+ |
1082 |
+ pvt->chancounts_dev->type = &all_channel_counts_type; |
1083 |
+@@ -1199,9 +1198,18 @@ static int i7core_create_sysfs_devices(struct mem_ctl_info *mci) |
1084 |
+ |
1085 |
+ rc = device_add(pvt->chancounts_dev); |
1086 |
+ if (rc < 0) |
1087 |
+- return rc; |
1088 |
++ goto err_put_chancounts; |
1089 |
+ } |
1090 |
+ return 0; |
1091 |
++ |
1092 |
++err_put_chancounts: |
1093 |
++ put_device(pvt->chancounts_dev); |
1094 |
++err_del_addrmatch: |
1095 |
++ device_del(pvt->addrmatch_dev); |
1096 |
++err_put_addrmatch: |
1097 |
++ put_device(pvt->addrmatch_dev); |
1098 |
++ |
1099 |
++ return rc; |
1100 |
+ } |
1101 |
+ |
1102 |
+ static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci) |
1103 |
+@@ -1211,11 +1219,11 @@ static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci) |
1104 |
+ edac_dbg(1, "\n"); |
1105 |
+ |
1106 |
+ if (!pvt->is_registered) { |
1107 |
+- put_device(pvt->chancounts_dev); |
1108 |
+ device_del(pvt->chancounts_dev); |
1109 |
++ put_device(pvt->chancounts_dev); |
1110 |
+ } |
1111 |
+- put_device(pvt->addrmatch_dev); |
1112 |
+ device_del(pvt->addrmatch_dev); |
1113 |
++ put_device(pvt->addrmatch_dev); |
1114 |
+ } |
1115 |
+ |
1116 |
+ /**************************************************************************** |
1117 |
+diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c |
1118 |
+index e1037582e34d..b2635326546e 100644 |
1119 |
+--- a/drivers/gpio/gpio-menz127.c |
1120 |
++++ b/drivers/gpio/gpio-menz127.c |
1121 |
+@@ -56,9 +56,9 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, |
1122 |
+ rnd = fls(debounce) - 1; |
1123 |
+ |
1124 |
+ if (rnd && (debounce & BIT(rnd - 1))) |
1125 |
+- debounce = round_up(debounce, MEN_Z127_DB_MIN_US); |
1126 |
++ debounce = roundup(debounce, MEN_Z127_DB_MIN_US); |
1127 |
+ else |
1128 |
+- debounce = round_down(debounce, MEN_Z127_DB_MIN_US); |
1129 |
++ debounce = rounddown(debounce, MEN_Z127_DB_MIN_US); |
1130 |
+ |
1131 |
+ if (debounce > MEN_Z127_DB_MAX_US) |
1132 |
+ debounce = MEN_Z127_DB_MAX_US; |
1133 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
1134 |
+index a7e54820a330..85bcd236890e 100644 |
1135 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
1136 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
1137 |
+@@ -5479,6 +5479,11 @@ static int gfx_v8_0_set_powergating_state(void *handle, |
1138 |
+ if (amdgpu_sriov_vf(adev)) |
1139 |
+ return 0; |
1140 |
+ |
1141 |
++ if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_SMG | |
1142 |
++ AMD_PG_SUPPORT_RLC_SMU_HS | |
1143 |
++ AMD_PG_SUPPORT_CP | |
1144 |
++ AMD_PG_SUPPORT_GFX_DMG)) |
1145 |
++ adev->gfx.rlc.funcs->enter_safe_mode(adev); |
1146 |
+ switch (adev->asic_type) { |
1147 |
+ case CHIP_CARRIZO: |
1148 |
+ case CHIP_STONEY: |
1149 |
+@@ -5527,7 +5532,11 @@ static int gfx_v8_0_set_powergating_state(void *handle, |
1150 |
+ default: |
1151 |
+ break; |
1152 |
+ } |
1153 |
+- |
1154 |
++ if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_SMG | |
1155 |
++ AMD_PG_SUPPORT_RLC_SMU_HS | |
1156 |
++ AMD_PG_SUPPORT_CP | |
1157 |
++ AMD_PG_SUPPORT_GFX_DMG)) |
1158 |
++ adev->gfx.rlc.funcs->exit_safe_mode(adev); |
1159 |
+ return 0; |
1160 |
+ } |
1161 |
+ |
1162 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c |
1163 |
+index 3bbf2ccfca89..c76073b422d6 100644 |
1164 |
+--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c |
1165 |
++++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c |
1166 |
+@@ -1352,8 +1352,6 @@ static int kv_dpm_enable(struct amdgpu_device *adev) |
1167 |
+ return ret; |
1168 |
+ } |
1169 |
+ |
1170 |
+- kv_update_current_ps(adev, adev->pm.dpm.boot_ps); |
1171 |
+- |
1172 |
+ if (adev->irq.installed && |
1173 |
+ amdgpu_is_internal_thermal_sensor(adev->pm.int_thermal_type)) { |
1174 |
+ ret = kv_set_thermal_temperature_range(adev, KV_TEMP_RANGE_MIN, KV_TEMP_RANGE_MAX); |
1175 |
+@@ -3054,7 +3052,7 @@ static int kv_dpm_hw_init(void *handle) |
1176 |
+ else |
1177 |
+ adev->pm.dpm_enabled = true; |
1178 |
+ mutex_unlock(&adev->pm.mutex); |
1179 |
+- |
1180 |
++ amdgpu_pm_compute_clocks(adev); |
1181 |
+ return ret; |
1182 |
+ } |
1183 |
+ |
1184 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c |
1185 |
+index 6f1dea157a77..55613f425931 100644 |
1186 |
+--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c |
1187 |
++++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c |
1188 |
+@@ -6884,7 +6884,6 @@ static int si_dpm_enable(struct amdgpu_device *adev) |
1189 |
+ |
1190 |
+ si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true); |
1191 |
+ si_thermal_start_thermal_controller(adev); |
1192 |
+- ni_update_current_ps(adev, boot_ps); |
1193 |
+ |
1194 |
+ return 0; |
1195 |
+ } |
1196 |
+@@ -7758,7 +7757,7 @@ static int si_dpm_hw_init(void *handle) |
1197 |
+ else |
1198 |
+ adev->pm.dpm_enabled = true; |
1199 |
+ mutex_unlock(&adev->pm.mutex); |
1200 |
+- |
1201 |
++ amdgpu_pm_compute_clocks(adev); |
1202 |
+ return ret; |
1203 |
+ } |
1204 |
+ |
1205 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
1206 |
+index 3c0ce3ee0710..f354cfe63f7b 100644 |
1207 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
1208 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
1209 |
+@@ -3608,7 +3608,8 @@ restart: |
1210 |
+ return -EBUSY; |
1211 |
+ } |
1212 |
+ |
1213 |
+- if (i915_gem_valid_gtt_space(vma, cache_level)) |
1214 |
++ if (!i915_vma_is_closed(vma) && |
1215 |
++ i915_gem_valid_gtt_space(vma, cache_level)) |
1216 |
+ continue; |
1217 |
+ |
1218 |
+ ret = i915_vma_unbind(vma); |
1219 |
+diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c |
1220 |
+index 02d1a5eacb00..76eed1fdac09 100644 |
1221 |
+--- a/drivers/gpu/drm/i915/i915_vma.c |
1222 |
++++ b/drivers/gpu/drm/i915/i915_vma.c |
1223 |
+@@ -430,6 +430,7 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) |
1224 |
+ u64 start, end; |
1225 |
+ int ret; |
1226 |
+ |
1227 |
++ GEM_BUG_ON(i915_vma_is_closed(vma)); |
1228 |
+ GEM_BUG_ON(vma->flags & (I915_VMA_GLOBAL_BIND | I915_VMA_LOCAL_BIND)); |
1229 |
+ GEM_BUG_ON(drm_mm_node_allocated(&vma->node)); |
1230 |
+ |
1231 |
+@@ -590,7 +591,9 @@ static void i915_vma_destroy(struct i915_vma *vma) |
1232 |
+ GEM_BUG_ON(i915_gem_active_isset(&vma->last_read[i])); |
1233 |
+ GEM_BUG_ON(i915_gem_active_isset(&vma->last_fence)); |
1234 |
+ |
1235 |
++ list_del(&vma->obj_link); |
1236 |
+ list_del(&vma->vm_link); |
1237 |
++ |
1238 |
+ if (!i915_vma_is_ggtt(vma)) |
1239 |
+ i915_ppgtt_put(i915_vm_to_ppgtt(vma->vm)); |
1240 |
+ |
1241 |
+@@ -602,7 +605,6 @@ void i915_vma_close(struct i915_vma *vma) |
1242 |
+ GEM_BUG_ON(i915_vma_is_closed(vma)); |
1243 |
+ vma->flags |= I915_VMA_CLOSED; |
1244 |
+ |
1245 |
+- list_del(&vma->obj_link); |
1246 |
+ rb_erase(&vma->obj_node, &vma->obj->vma_tree); |
1247 |
+ |
1248 |
+ if (!i915_vma_is_active(vma) && !i915_vma_is_pinned(vma)) |
1249 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c |
1250 |
+index ace59651892f..8d3c8070ed86 100644 |
1251 |
+--- a/drivers/gpu/drm/sun4i/sun4i_drv.c |
1252 |
++++ b/drivers/gpu/drm/sun4i/sun4i_drv.c |
1253 |
+@@ -241,7 +241,6 @@ static int sun4i_drv_add_endpoints(struct device *dev, |
1254 |
+ remote = of_graph_get_remote_port_parent(ep); |
1255 |
+ if (!remote) { |
1256 |
+ DRM_DEBUG_DRIVER("Error retrieving the output node\n"); |
1257 |
+- of_node_put(remote); |
1258 |
+ continue; |
1259 |
+ } |
1260 |
+ |
1261 |
+@@ -255,11 +254,13 @@ static int sun4i_drv_add_endpoints(struct device *dev, |
1262 |
+ |
1263 |
+ if (of_graph_parse_endpoint(ep, &endpoint)) { |
1264 |
+ DRM_DEBUG_DRIVER("Couldn't parse endpoint\n"); |
1265 |
++ of_node_put(remote); |
1266 |
+ continue; |
1267 |
+ } |
1268 |
+ |
1269 |
+ if (!endpoint.id) { |
1270 |
+ DRM_DEBUG_DRIVER("Endpoint is our panel... skipping\n"); |
1271 |
++ of_node_put(remote); |
1272 |
+ continue; |
1273 |
+ } |
1274 |
+ } |
1275 |
+diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c |
1276 |
+index 3d121d8ee980..5d2d746e35f6 100644 |
1277 |
+--- a/drivers/hid/hid-ntrig.c |
1278 |
++++ b/drivers/hid/hid-ntrig.c |
1279 |
+@@ -955,6 +955,8 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) |
1280 |
+ |
1281 |
+ ret = sysfs_create_group(&hdev->dev.kobj, |
1282 |
+ &ntrig_attribute_group); |
1283 |
++ if (ret) |
1284 |
++ hid_err(hdev, "cannot create sysfs group\n"); |
1285 |
+ |
1286 |
+ return 0; |
1287 |
+ err_free: |
1288 |
+diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c |
1289 |
+index 9ef84998c7f3..37db2eb66ed7 100644 |
1290 |
+--- a/drivers/hwmon/adt7475.c |
1291 |
++++ b/drivers/hwmon/adt7475.c |
1292 |
+@@ -303,14 +303,18 @@ static inline u16 volt2reg(int channel, long volt, u8 bypass_attn) |
1293 |
+ return clamp_val(reg, 0, 1023) & (0xff << 2); |
1294 |
+ } |
1295 |
+ |
1296 |
+-static u16 adt7475_read_word(struct i2c_client *client, int reg) |
1297 |
++static int adt7475_read_word(struct i2c_client *client, int reg) |
1298 |
+ { |
1299 |
+- u16 val; |
1300 |
++ int val1, val2; |
1301 |
+ |
1302 |
+- val = i2c_smbus_read_byte_data(client, reg); |
1303 |
+- val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8); |
1304 |
++ val1 = i2c_smbus_read_byte_data(client, reg); |
1305 |
++ if (val1 < 0) |
1306 |
++ return val1; |
1307 |
++ val2 = i2c_smbus_read_byte_data(client, reg + 1); |
1308 |
++ if (val2 < 0) |
1309 |
++ return val2; |
1310 |
+ |
1311 |
+- return val; |
1312 |
++ return val1 | (val2 << 8); |
1313 |
+ } |
1314 |
+ |
1315 |
+ static void adt7475_write_word(struct i2c_client *client, int reg, u16 val) |
1316 |
+diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c |
1317 |
+index e9e6aeabbf84..71d3445ba869 100644 |
1318 |
+--- a/drivers/hwmon/ina2xx.c |
1319 |
++++ b/drivers/hwmon/ina2xx.c |
1320 |
+@@ -17,7 +17,7 @@ |
1321 |
+ * Bi-directional Current/Power Monitor with I2C Interface |
1322 |
+ * Datasheet: http://www.ti.com/product/ina230 |
1323 |
+ * |
1324 |
+- * Copyright (C) 2012 Lothar Felten <l-felten@××.com> |
1325 |
++ * Copyright (C) 2012 Lothar Felten <lothar.felten@×××××.com> |
1326 |
+ * Thanks to Jan Volkering |
1327 |
+ * |
1328 |
+ * This program is free software; you can redistribute it and/or modify |
1329 |
+@@ -329,6 +329,15 @@ static int ina2xx_set_shunt(struct ina2xx_data *data, long val) |
1330 |
+ return 0; |
1331 |
+ } |
1332 |
+ |
1333 |
++static ssize_t ina2xx_show_shunt(struct device *dev, |
1334 |
++ struct device_attribute *da, |
1335 |
++ char *buf) |
1336 |
++{ |
1337 |
++ struct ina2xx_data *data = dev_get_drvdata(dev); |
1338 |
++ |
1339 |
++ return snprintf(buf, PAGE_SIZE, "%li\n", data->rshunt); |
1340 |
++} |
1341 |
++ |
1342 |
+ static ssize_t ina2xx_store_shunt(struct device *dev, |
1343 |
+ struct device_attribute *da, |
1344 |
+ const char *buf, size_t count) |
1345 |
+@@ -403,7 +412,7 @@ static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ina2xx_show_value, NULL, |
1346 |
+ |
1347 |
+ /* shunt resistance */ |
1348 |
+ static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR, |
1349 |
+- ina2xx_show_value, ina2xx_store_shunt, |
1350 |
++ ina2xx_show_shunt, ina2xx_store_shunt, |
1351 |
+ INA2XX_CALIBRATION); |
1352 |
+ |
1353 |
+ /* update interval (ina226 only) */ |
1354 |
+diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c |
1355 |
+index c1793313bb08..757801d27604 100644 |
1356 |
+--- a/drivers/hwtracing/intel_th/core.c |
1357 |
++++ b/drivers/hwtracing/intel_th/core.c |
1358 |
+@@ -147,7 +147,8 @@ static int intel_th_remove(struct device *dev) |
1359 |
+ th->thdev[i] = NULL; |
1360 |
+ } |
1361 |
+ |
1362 |
+- th->num_thdevs = lowest; |
1363 |
++ if (lowest >= 0) |
1364 |
++ th->num_thdevs = lowest; |
1365 |
+ } |
1366 |
+ |
1367 |
+ if (thdrv->attr_group) |
1368 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
1369 |
+index 67cbd9f61acc..06debfa903b9 100644 |
1370 |
+--- a/drivers/i2c/busses/i2c-i801.c |
1371 |
++++ b/drivers/i2c/busses/i2c-i801.c |
1372 |
+@@ -1416,6 +1416,13 @@ static void i801_add_tco(struct i801_priv *priv) |
1373 |
+ } |
1374 |
+ |
1375 |
+ #ifdef CONFIG_ACPI |
1376 |
++static bool i801_acpi_is_smbus_ioport(const struct i801_priv *priv, |
1377 |
++ acpi_physical_address address) |
1378 |
++{ |
1379 |
++ return address >= priv->smba && |
1380 |
++ address <= pci_resource_end(priv->pci_dev, SMBBAR); |
1381 |
++} |
1382 |
++ |
1383 |
+ static acpi_status |
1384 |
+ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, |
1385 |
+ u64 *value, void *handler_context, void *region_context) |
1386 |
+@@ -1431,7 +1438,7 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, |
1387 |
+ */ |
1388 |
+ mutex_lock(&priv->acpi_lock); |
1389 |
+ |
1390 |
+- if (!priv->acpi_reserved) { |
1391 |
++ if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) { |
1392 |
+ priv->acpi_reserved = true; |
1393 |
+ |
1394 |
+ dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n"); |
1395 |
+diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c |
1396 |
+index 9ccb5828db98..3dda7afe8a11 100644 |
1397 |
+--- a/drivers/iio/accel/adxl345_core.c |
1398 |
++++ b/drivers/iio/accel/adxl345_core.c |
1399 |
+@@ -21,6 +21,8 @@ |
1400 |
+ #define ADXL345_REG_DATAX0 0x32 |
1401 |
+ #define ADXL345_REG_DATAY0 0x34 |
1402 |
+ #define ADXL345_REG_DATAZ0 0x36 |
1403 |
++#define ADXL345_REG_DATA_AXIS(index) \ |
1404 |
++ (ADXL345_REG_DATAX0 + (index) * sizeof(__le16)) |
1405 |
+ |
1406 |
+ #define ADXL345_POWER_CTL_MEASURE BIT(3) |
1407 |
+ #define ADXL345_POWER_CTL_STANDBY 0x00 |
1408 |
+@@ -47,19 +49,19 @@ struct adxl345_data { |
1409 |
+ u8 data_range; |
1410 |
+ }; |
1411 |
+ |
1412 |
+-#define ADXL345_CHANNEL(reg, axis) { \ |
1413 |
++#define ADXL345_CHANNEL(index, axis) { \ |
1414 |
+ .type = IIO_ACCEL, \ |
1415 |
+ .modified = 1, \ |
1416 |
+ .channel2 = IIO_MOD_##axis, \ |
1417 |
+- .address = reg, \ |
1418 |
++ .address = index, \ |
1419 |
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ |
1420 |
+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
1421 |
+ } |
1422 |
+ |
1423 |
+ static const struct iio_chan_spec adxl345_channels[] = { |
1424 |
+- ADXL345_CHANNEL(ADXL345_REG_DATAX0, X), |
1425 |
+- ADXL345_CHANNEL(ADXL345_REG_DATAY0, Y), |
1426 |
+- ADXL345_CHANNEL(ADXL345_REG_DATAZ0, Z), |
1427 |
++ ADXL345_CHANNEL(0, X), |
1428 |
++ ADXL345_CHANNEL(1, Y), |
1429 |
++ ADXL345_CHANNEL(2, Z), |
1430 |
+ }; |
1431 |
+ |
1432 |
+ static int adxl345_read_raw(struct iio_dev *indio_dev, |
1433 |
+@@ -67,7 +69,7 @@ static int adxl345_read_raw(struct iio_dev *indio_dev, |
1434 |
+ int *val, int *val2, long mask) |
1435 |
+ { |
1436 |
+ struct adxl345_data *data = iio_priv(indio_dev); |
1437 |
+- __le16 regval; |
1438 |
++ __le16 accel; |
1439 |
+ int ret; |
1440 |
+ |
1441 |
+ switch (mask) { |
1442 |
+@@ -77,12 +79,13 @@ static int adxl345_read_raw(struct iio_dev *indio_dev, |
1443 |
+ * ADXL345_REG_DATA(X0/Y0/Z0) contain the least significant byte |
1444 |
+ * and ADXL345_REG_DATA(X0/Y0/Z0) + 1 the most significant byte |
1445 |
+ */ |
1446 |
+- ret = regmap_bulk_read(data->regmap, chan->address, ®val, |
1447 |
+- sizeof(regval)); |
1448 |
++ ret = regmap_bulk_read(data->regmap, |
1449 |
++ ADXL345_REG_DATA_AXIS(chan->address), |
1450 |
++ &accel, sizeof(accel)); |
1451 |
+ if (ret < 0) |
1452 |
+ return ret; |
1453 |
+ |
1454 |
+- *val = sign_extend32(le16_to_cpu(regval), 12); |
1455 |
++ *val = sign_extend32(le16_to_cpu(accel), 12); |
1456 |
+ return IIO_VAL_INT; |
1457 |
+ case IIO_CHAN_INFO_SCALE: |
1458 |
+ *val = 0; |
1459 |
+diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c |
1460 |
+index 59f99b3a180d..d5b9f831eba7 100644 |
1461 |
+--- a/drivers/iio/adc/ina2xx-adc.c |
1462 |
++++ b/drivers/iio/adc/ina2xx-adc.c |
1463 |
+@@ -30,6 +30,7 @@ |
1464 |
+ #include <linux/module.h> |
1465 |
+ #include <linux/of_device.h> |
1466 |
+ #include <linux/regmap.h> |
1467 |
++#include <linux/sched/task.h> |
1468 |
+ #include <linux/util_macros.h> |
1469 |
+ |
1470 |
+ #include <linux/platform_data/ina2xx.h> |
1471 |
+@@ -701,6 +702,7 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev) |
1472 |
+ { |
1473 |
+ struct ina2xx_chip_info *chip = iio_priv(indio_dev); |
1474 |
+ unsigned int sampling_us = SAMPLING_PERIOD(chip); |
1475 |
++ struct task_struct *task; |
1476 |
+ |
1477 |
+ dev_dbg(&indio_dev->dev, "Enabling buffer w/ scan_mask %02x, freq = %d, avg =%u\n", |
1478 |
+ (unsigned int)(*indio_dev->active_scan_mask), |
1479 |
+@@ -710,11 +712,17 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev) |
1480 |
+ dev_dbg(&indio_dev->dev, "Async readout mode: %d\n", |
1481 |
+ chip->allow_async_readout); |
1482 |
+ |
1483 |
+- chip->task = kthread_run(ina2xx_capture_thread, (void *)indio_dev, |
1484 |
+- "%s:%d-%uus", indio_dev->name, indio_dev->id, |
1485 |
+- sampling_us); |
1486 |
++ task = kthread_create(ina2xx_capture_thread, (void *)indio_dev, |
1487 |
++ "%s:%d-%uus", indio_dev->name, indio_dev->id, |
1488 |
++ sampling_us); |
1489 |
++ if (IS_ERR(task)) |
1490 |
++ return PTR_ERR(task); |
1491 |
++ |
1492 |
++ get_task_struct(task); |
1493 |
++ wake_up_process(task); |
1494 |
++ chip->task = task; |
1495 |
+ |
1496 |
+- return PTR_ERR_OR_ZERO(chip->task); |
1497 |
++ return 0; |
1498 |
+ } |
1499 |
+ |
1500 |
+ static int ina2xx_buffer_disable(struct iio_dev *indio_dev) |
1501 |
+@@ -723,6 +731,7 @@ static int ina2xx_buffer_disable(struct iio_dev *indio_dev) |
1502 |
+ |
1503 |
+ if (chip->task) { |
1504 |
+ kthread_stop(chip->task); |
1505 |
++ put_task_struct(chip->task); |
1506 |
+ chip->task = NULL; |
1507 |
+ } |
1508 |
+ |
1509 |
+diff --git a/drivers/iio/counter/104-quad-8.c b/drivers/iio/counter/104-quad-8.c |
1510 |
+index ba3d9030cd51..181585ae6e17 100644 |
1511 |
+--- a/drivers/iio/counter/104-quad-8.c |
1512 |
++++ b/drivers/iio/counter/104-quad-8.c |
1513 |
+@@ -138,7 +138,7 @@ static int quad8_write_raw(struct iio_dev *indio_dev, |
1514 |
+ outb(val >> (8 * i), base_offset); |
1515 |
+ |
1516 |
+ /* Reset Borrow, Carry, Compare, and Sign flags */ |
1517 |
+- outb(0x02, base_offset + 1); |
1518 |
++ outb(0x04, base_offset + 1); |
1519 |
+ /* Reset Error flag */ |
1520 |
+ outb(0x06, base_offset + 1); |
1521 |
+ |
1522 |
+diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c |
1523 |
+index 6ca607e8e293..9939dcfb1b6a 100644 |
1524 |
+--- a/drivers/infiniband/core/rw.c |
1525 |
++++ b/drivers/infiniband/core/rw.c |
1526 |
+@@ -87,7 +87,7 @@ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num, |
1527 |
+ } |
1528 |
+ |
1529 |
+ ret = ib_map_mr_sg(reg->mr, sg, nents, &offset, PAGE_SIZE); |
1530 |
+- if (ret < nents) { |
1531 |
++ if (ret < 0 || ret < nents) { |
1532 |
+ ib_mr_pool_put(qp, &qp->rdma_mrs, reg->mr); |
1533 |
+ return -EINVAL; |
1534 |
+ } |
1535 |
+diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c |
1536 |
+index 0f70ff91276e..aff6ef3ad52c 100644 |
1537 |
+--- a/drivers/infiniband/core/uverbs_main.c |
1538 |
++++ b/drivers/infiniband/core/uverbs_main.c |
1539 |
+@@ -424,6 +424,7 @@ static int ib_uverbs_comp_event_close(struct inode *inode, struct file *filp) |
1540 |
+ list_del(&entry->obj_list); |
1541 |
+ kfree(entry); |
1542 |
+ } |
1543 |
++ file->ev_queue.is_closed = 1; |
1544 |
+ spin_unlock_irq(&file->ev_queue.lock); |
1545 |
+ |
1546 |
+ uverbs_close_fd(filp); |
1547 |
+diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c |
1548 |
+index 9536de8c5fb8..124c8915b9ee 100644 |
1549 |
+--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c |
1550 |
++++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c |
1551 |
+@@ -156,7 +156,7 @@ int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res, |
1552 |
+ struct bnxt_qplib_sgid_tbl *sgid_tbl, int index, |
1553 |
+ struct bnxt_qplib_gid *gid) |
1554 |
+ { |
1555 |
+- if (index > sgid_tbl->max) { |
1556 |
++ if (index >= sgid_tbl->max) { |
1557 |
+ dev_err(&res->pdev->dev, |
1558 |
+ "QPLIB: Index %d exceeded SGID table max (%d)", |
1559 |
+ index, sgid_tbl->max); |
1560 |
+@@ -361,7 +361,7 @@ int bnxt_qplib_get_pkey(struct bnxt_qplib_res *res, |
1561 |
+ *pkey = 0xFFFF; |
1562 |
+ return 0; |
1563 |
+ } |
1564 |
+- if (index > pkey_tbl->max) { |
1565 |
++ if (index >= pkey_tbl->max) { |
1566 |
+ dev_err(&res->pdev->dev, |
1567 |
+ "QPLIB: Index %d exceeded PKEY table max (%d)", |
1568 |
+ index, pkey_tbl->max); |
1569 |
+diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c |
1570 |
+index a95ac6246559..19a8e6052820 100644 |
1571 |
+--- a/drivers/infiniband/hw/hfi1/pio.c |
1572 |
++++ b/drivers/infiniband/hw/hfi1/pio.c |
1573 |
+@@ -86,6 +86,7 @@ void pio_send_control(struct hfi1_devdata *dd, int op) |
1574 |
+ unsigned long flags; |
1575 |
+ int write = 1; /* write sendctrl back */ |
1576 |
+ int flush = 0; /* re-read sendctrl to make sure it is flushed */ |
1577 |
++ int i; |
1578 |
+ |
1579 |
+ spin_lock_irqsave(&dd->sendctrl_lock, flags); |
1580 |
+ |
1581 |
+@@ -95,9 +96,13 @@ void pio_send_control(struct hfi1_devdata *dd, int op) |
1582 |
+ reg |= SEND_CTRL_SEND_ENABLE_SMASK; |
1583 |
+ /* Fall through */ |
1584 |
+ case PSC_DATA_VL_ENABLE: |
1585 |
++ mask = 0; |
1586 |
++ for (i = 0; i < ARRAY_SIZE(dd->vld); i++) |
1587 |
++ if (!dd->vld[i].mtu) |
1588 |
++ mask |= BIT_ULL(i); |
1589 |
+ /* Disallow sending on VLs not enabled */ |
1590 |
+- mask = (((~0ull) << num_vls) & SEND_CTRL_UNSUPPORTED_VL_MASK) << |
1591 |
+- SEND_CTRL_UNSUPPORTED_VL_SHIFT; |
1592 |
++ mask = (mask & SEND_CTRL_UNSUPPORTED_VL_MASK) << |
1593 |
++ SEND_CTRL_UNSUPPORTED_VL_SHIFT; |
1594 |
+ reg = (reg & ~SEND_CTRL_UNSUPPORTED_VL_SMASK) | mask; |
1595 |
+ break; |
1596 |
+ case PSC_GLOBAL_DISABLE: |
1597 |
+diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c |
1598 |
+index c0c0e0445cbf..8c954a0ae3b6 100644 |
1599 |
+--- a/drivers/infiniband/hw/hfi1/user_sdma.c |
1600 |
++++ b/drivers/infiniband/hw/hfi1/user_sdma.c |
1601 |
+@@ -828,7 +828,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) |
1602 |
+ if (ACCESS_ONCE(iovec->offset) == iovec->iov.iov_len) { |
1603 |
+ if (++req->iov_idx == req->data_iovs) { |
1604 |
+ ret = -EFAULT; |
1605 |
+- goto free_txreq; |
1606 |
++ goto free_tx; |
1607 |
+ } |
1608 |
+ iovec = &req->iovs[req->iov_idx]; |
1609 |
+ WARN_ON(iovec->offset); |
1610 |
+diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c |
1611 |
+index e232f3c608b4..63d404a6752a 100644 |
1612 |
+--- a/drivers/infiniband/hw/hfi1/verbs.c |
1613 |
++++ b/drivers/infiniband/hw/hfi1/verbs.c |
1614 |
+@@ -1573,6 +1573,7 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr) |
1615 |
+ struct hfi1_pportdata *ppd; |
1616 |
+ struct hfi1_devdata *dd; |
1617 |
+ u8 sc5; |
1618 |
++ u8 sl; |
1619 |
+ |
1620 |
+ if (hfi1_check_mcast(rdma_ah_get_dlid(ah_attr)) && |
1621 |
+ !(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH)) |
1622 |
+@@ -1581,8 +1582,13 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr) |
1623 |
+ /* test the mapping for validity */ |
1624 |
+ ibp = to_iport(ibdev, rdma_ah_get_port_num(ah_attr)); |
1625 |
+ ppd = ppd_from_ibp(ibp); |
1626 |
+- sc5 = ibp->sl_to_sc[rdma_ah_get_sl(ah_attr)]; |
1627 |
+ dd = dd_from_ppd(ppd); |
1628 |
++ |
1629 |
++ sl = rdma_ah_get_sl(ah_attr); |
1630 |
++ if (sl >= ARRAY_SIZE(ibp->sl_to_sc)) |
1631 |
++ return -EINVAL; |
1632 |
++ |
1633 |
++ sc5 = ibp->sl_to_sc[sl]; |
1634 |
+ if (sc_to_vlt(dd, sc5) > num_vls && sc_to_vlt(dd, sc5) != 0xf) |
1635 |
+ return -EINVAL; |
1636 |
+ return 0; |
1637 |
+diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c |
1638 |
+index b7961f21b555..39398dd074d6 100644 |
1639 |
+--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c |
1640 |
++++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c |
1641 |
+@@ -1408,6 +1408,7 @@ static void i40iw_set_hugetlb_values(u64 addr, struct i40iw_mr *iwmr) |
1642 |
+ struct vm_area_struct *vma; |
1643 |
+ struct hstate *h; |
1644 |
+ |
1645 |
++ down_read(¤t->mm->mmap_sem); |
1646 |
+ vma = find_vma(current->mm, addr); |
1647 |
+ if (vma && is_vm_hugetlb_page(vma)) { |
1648 |
+ h = hstate_vma(vma); |
1649 |
+@@ -1416,6 +1417,7 @@ static void i40iw_set_hugetlb_values(u64 addr, struct i40iw_mr *iwmr) |
1650 |
+ iwmr->page_msk = huge_page_mask(h); |
1651 |
+ } |
1652 |
+ } |
1653 |
++ up_read(¤t->mm->mmap_sem); |
1654 |
+ } |
1655 |
+ |
1656 |
+ /** |
1657 |
+diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c |
1658 |
+index 9354fec8efe7..e10c3d915e38 100644 |
1659 |
+--- a/drivers/infiniband/hw/mlx4/qp.c |
1660 |
++++ b/drivers/infiniband/hw/mlx4/qp.c |
1661 |
+@@ -4014,9 +4014,9 @@ static void to_rdma_ah_attr(struct mlx4_ib_dev *ibdev, |
1662 |
+ u8 port_num = path->sched_queue & 0x40 ? 2 : 1; |
1663 |
+ |
1664 |
+ memset(ah_attr, 0, sizeof(*ah_attr)); |
1665 |
+- ah_attr->type = rdma_ah_find_type(&ibdev->ib_dev, port_num); |
1666 |
+ if (port_num == 0 || port_num > dev->caps.num_ports) |
1667 |
+ return; |
1668 |
++ ah_attr->type = rdma_ah_find_type(&ibdev->ib_dev, port_num); |
1669 |
+ |
1670 |
+ if (ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) |
1671 |
+ rdma_ah_set_sl(ah_attr, ((path->sched_queue >> 3) & 0x7) | |
1672 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c |
1673 |
+index 299a97b7e17f..ade98c234dcb 100644 |
1674 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.c |
1675 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.c |
1676 |
+@@ -2669,7 +2669,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) |
1677 |
+ { |
1678 |
+ struct srp_target_port *target = host_to_target(scmnd->device->host); |
1679 |
+ struct srp_rdma_ch *ch; |
1680 |
+- int i; |
1681 |
++ int i, j; |
1682 |
+ u8 status; |
1683 |
+ |
1684 |
+ shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); |
1685 |
+@@ -2683,8 +2683,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) |
1686 |
+ |
1687 |
+ for (i = 0; i < target->ch_count; i++) { |
1688 |
+ ch = &target->ch[i]; |
1689 |
+- for (i = 0; i < target->req_ring_size; ++i) { |
1690 |
+- struct srp_request *req = &ch->req_ring[i]; |
1691 |
++ for (j = 0; j < target->req_ring_size; ++j) { |
1692 |
++ struct srp_request *req = &ch->req_ring[j]; |
1693 |
+ |
1694 |
+ srp_finish_req(ch, req, scmnd->device, DID_RESET << 16); |
1695 |
+ } |
1696 |
+diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c |
1697 |
+index d91f3b1c5375..92d739649022 100644 |
1698 |
+--- a/drivers/input/misc/xen-kbdfront.c |
1699 |
++++ b/drivers/input/misc/xen-kbdfront.c |
1700 |
+@@ -229,7 +229,7 @@ static int xenkbd_probe(struct xenbus_device *dev, |
1701 |
+ } |
1702 |
+ } |
1703 |
+ |
1704 |
+- touch = xenbus_read_unsigned(dev->nodename, |
1705 |
++ touch = xenbus_read_unsigned(dev->otherend, |
1706 |
+ XENKBD_FIELD_FEAT_MTOUCH, 0); |
1707 |
+ if (touch) { |
1708 |
+ ret = xenbus_write(XBT_NIL, dev->nodename, |
1709 |
+@@ -304,13 +304,13 @@ static int xenkbd_probe(struct xenbus_device *dev, |
1710 |
+ if (!mtouch) |
1711 |
+ goto error_nomem; |
1712 |
+ |
1713 |
+- num_cont = xenbus_read_unsigned(info->xbdev->nodename, |
1714 |
++ num_cont = xenbus_read_unsigned(info->xbdev->otherend, |
1715 |
+ XENKBD_FIELD_MT_NUM_CONTACTS, |
1716 |
+ 1); |
1717 |
+- width = xenbus_read_unsigned(info->xbdev->nodename, |
1718 |
++ width = xenbus_read_unsigned(info->xbdev->otherend, |
1719 |
+ XENKBD_FIELD_MT_WIDTH, |
1720 |
+ XENFB_WIDTH); |
1721 |
+- height = xenbus_read_unsigned(info->xbdev->nodename, |
1722 |
++ height = xenbus_read_unsigned(info->xbdev->otherend, |
1723 |
+ XENKBD_FIELD_MT_HEIGHT, |
1724 |
+ XENFB_HEIGHT); |
1725 |
+ |
1726 |
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
1727 |
+index a250f433eb96..84c69e962230 100644 |
1728 |
+--- a/drivers/input/mouse/elantech.c |
1729 |
++++ b/drivers/input/mouse/elantech.c |
1730 |
+@@ -1180,6 +1180,8 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = { |
1731 |
+ static const char * const middle_button_pnp_ids[] = { |
1732 |
+ "LEN2131", /* ThinkPad P52 w/ NFC */ |
1733 |
+ "LEN2132", /* ThinkPad P52 */ |
1734 |
++ "LEN2133", /* ThinkPad P72 w/ NFC */ |
1735 |
++ "LEN2134", /* ThinkPad P72 */ |
1736 |
+ NULL |
1737 |
+ }; |
1738 |
+ |
1739 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
1740 |
+index 10190e361a13..01746e7b90de 100644 |
1741 |
+--- a/drivers/iommu/amd_iommu.c |
1742 |
++++ b/drivers/iommu/amd_iommu.c |
1743 |
+@@ -2400,9 +2400,9 @@ static void __unmap_single(struct dma_ops_domain *dma_dom, |
1744 |
+ } |
1745 |
+ |
1746 |
+ if (amd_iommu_unmap_flush) { |
1747 |
+- dma_ops_free_iova(dma_dom, dma_addr, pages); |
1748 |
+ domain_flush_tlb(&dma_dom->domain); |
1749 |
+ domain_flush_complete(&dma_dom->domain); |
1750 |
++ dma_ops_free_iova(dma_dom, dma_addr, pages); |
1751 |
+ } else { |
1752 |
+ pages = __roundup_pow_of_two(pages); |
1753 |
+ queue_iova(&dma_dom->iovad, dma_addr >> PAGE_SHIFT, pages, 0); |
1754 |
+diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c |
1755 |
+index 04f4d51ffacb..92c8c83ce38c 100644 |
1756 |
+--- a/drivers/iommu/msm_iommu.c |
1757 |
++++ b/drivers/iommu/msm_iommu.c |
1758 |
+@@ -395,20 +395,15 @@ static int msm_iommu_add_device(struct device *dev) |
1759 |
+ struct msm_iommu_dev *iommu; |
1760 |
+ struct iommu_group *group; |
1761 |
+ unsigned long flags; |
1762 |
+- int ret = 0; |
1763 |
+ |
1764 |
+ spin_lock_irqsave(&msm_iommu_lock, flags); |
1765 |
+- |
1766 |
+ iommu = find_iommu_for_dev(dev); |
1767 |
++ spin_unlock_irqrestore(&msm_iommu_lock, flags); |
1768 |
++ |
1769 |
+ if (iommu) |
1770 |
+ iommu_device_link(&iommu->iommu, dev); |
1771 |
+ else |
1772 |
+- ret = -ENODEV; |
1773 |
+- |
1774 |
+- spin_unlock_irqrestore(&msm_iommu_lock, flags); |
1775 |
+- |
1776 |
+- if (ret) |
1777 |
+- return ret; |
1778 |
++ return -ENODEV; |
1779 |
+ |
1780 |
+ group = iommu_group_get_for_dev(dev); |
1781 |
+ if (IS_ERR(group)) |
1782 |
+@@ -425,13 +420,12 @@ static void msm_iommu_remove_device(struct device *dev) |
1783 |
+ unsigned long flags; |
1784 |
+ |
1785 |
+ spin_lock_irqsave(&msm_iommu_lock, flags); |
1786 |
+- |
1787 |
+ iommu = find_iommu_for_dev(dev); |
1788 |
++ spin_unlock_irqrestore(&msm_iommu_lock, flags); |
1789 |
++ |
1790 |
+ if (iommu) |
1791 |
+ iommu_device_unlink(&iommu->iommu, dev); |
1792 |
+ |
1793 |
+- spin_unlock_irqrestore(&msm_iommu_lock, flags); |
1794 |
+- |
1795 |
+ iommu_group_remove_device(dev); |
1796 |
+ } |
1797 |
+ |
1798 |
+diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c |
1799 |
+index 72ce0bccc865..717aaffc227d 100644 |
1800 |
+--- a/drivers/md/md-cluster.c |
1801 |
++++ b/drivers/md/md-cluster.c |
1802 |
+@@ -304,15 +304,6 @@ static void recover_bitmaps(struct md_thread *thread) |
1803 |
+ while (cinfo->recovery_map) { |
1804 |
+ slot = fls64((u64)cinfo->recovery_map) - 1; |
1805 |
+ |
1806 |
+- /* Clear suspend_area associated with the bitmap */ |
1807 |
+- spin_lock_irq(&cinfo->suspend_lock); |
1808 |
+- list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list) |
1809 |
+- if (slot == s->slot) { |
1810 |
+- list_del(&s->list); |
1811 |
+- kfree(s); |
1812 |
+- } |
1813 |
+- spin_unlock_irq(&cinfo->suspend_lock); |
1814 |
+- |
1815 |
+ snprintf(str, 64, "bitmap%04d", slot); |
1816 |
+ bm_lockres = lockres_init(mddev, str, NULL, 1); |
1817 |
+ if (!bm_lockres) { |
1818 |
+@@ -331,6 +322,16 @@ static void recover_bitmaps(struct md_thread *thread) |
1819 |
+ pr_err("md-cluster: Could not copy data from bitmap %d\n", slot); |
1820 |
+ goto clear_bit; |
1821 |
+ } |
1822 |
++ |
1823 |
++ /* Clear suspend_area associated with the bitmap */ |
1824 |
++ spin_lock_irq(&cinfo->suspend_lock); |
1825 |
++ list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list) |
1826 |
++ if (slot == s->slot) { |
1827 |
++ list_del(&s->list); |
1828 |
++ kfree(s); |
1829 |
++ } |
1830 |
++ spin_unlock_irq(&cinfo->suspend_lock); |
1831 |
++ |
1832 |
+ if (hi > 0) { |
1833 |
+ if (lo < mddev->recovery_cp) |
1834 |
+ mddev->recovery_cp = lo; |
1835 |
+diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c |
1836 |
+index 806383500313..14377af7c888 100644 |
1837 |
+--- a/drivers/media/i2c/soc_camera/ov772x.c |
1838 |
++++ b/drivers/media/i2c/soc_camera/ov772x.c |
1839 |
+@@ -834,7 +834,7 @@ static int ov772x_set_params(struct ov772x_priv *priv, |
1840 |
+ * set COM8 |
1841 |
+ */ |
1842 |
+ if (priv->band_filter) { |
1843 |
+- ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, 1); |
1844 |
++ ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, BNDF_ON_OFF); |
1845 |
+ if (!ret) |
1846 |
+ ret = ov772x_mask_set(client, BDBASE, |
1847 |
+ 0xff, 256 - priv->band_filter); |
1848 |
+diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c |
1849 |
+index 55ba696b8cf4..a920164f53f1 100644 |
1850 |
+--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c |
1851 |
++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c |
1852 |
+@@ -384,12 +384,17 @@ static void __isp_video_try_fmt(struct fimc_isp *isp, |
1853 |
+ struct v4l2_pix_format_mplane *pixm, |
1854 |
+ const struct fimc_fmt **fmt) |
1855 |
+ { |
1856 |
+- *fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2); |
1857 |
++ const struct fimc_fmt *__fmt; |
1858 |
++ |
1859 |
++ __fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2); |
1860 |
++ |
1861 |
++ if (fmt) |
1862 |
++ *fmt = __fmt; |
1863 |
+ |
1864 |
+ pixm->colorspace = V4L2_COLORSPACE_SRGB; |
1865 |
+ pixm->field = V4L2_FIELD_NONE; |
1866 |
+- pixm->num_planes = (*fmt)->memplanes; |
1867 |
+- pixm->pixelformat = (*fmt)->fourcc; |
1868 |
++ pixm->num_planes = __fmt->memplanes; |
1869 |
++ pixm->pixelformat = __fmt->fourcc; |
1870 |
+ /* |
1871 |
+ * TODO: double check with the docmentation these width/height |
1872 |
+ * constraints are correct. |
1873 |
+diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c |
1874 |
+index fb43025df573..254d696dffd8 100644 |
1875 |
+--- a/drivers/media/platform/fsl-viu.c |
1876 |
++++ b/drivers/media/platform/fsl-viu.c |
1877 |
+@@ -1417,7 +1417,7 @@ static int viu_of_probe(struct platform_device *op) |
1878 |
+ sizeof(struct viu_reg), DRV_NAME)) { |
1879 |
+ dev_err(&op->dev, "Error while requesting mem region\n"); |
1880 |
+ ret = -EBUSY; |
1881 |
+- goto err; |
1882 |
++ goto err_irq; |
1883 |
+ } |
1884 |
+ |
1885 |
+ /* remap registers */ |
1886 |
+@@ -1425,7 +1425,7 @@ static int viu_of_probe(struct platform_device *op) |
1887 |
+ if (!viu_regs) { |
1888 |
+ dev_err(&op->dev, "Can't map register set\n"); |
1889 |
+ ret = -ENOMEM; |
1890 |
+- goto err; |
1891 |
++ goto err_irq; |
1892 |
+ } |
1893 |
+ |
1894 |
+ /* Prepare our private structure */ |
1895 |
+@@ -1433,7 +1433,7 @@ static int viu_of_probe(struct platform_device *op) |
1896 |
+ if (!viu_dev) { |
1897 |
+ dev_err(&op->dev, "Can't allocate private structure\n"); |
1898 |
+ ret = -ENOMEM; |
1899 |
+- goto err; |
1900 |
++ goto err_irq; |
1901 |
+ } |
1902 |
+ |
1903 |
+ viu_dev->vr = viu_regs; |
1904 |
+@@ -1449,16 +1449,21 @@ static int viu_of_probe(struct platform_device *op) |
1905 |
+ ret = v4l2_device_register(viu_dev->dev, &viu_dev->v4l2_dev); |
1906 |
+ if (ret < 0) { |
1907 |
+ dev_err(&op->dev, "v4l2_device_register() failed: %d\n", ret); |
1908 |
+- goto err; |
1909 |
++ goto err_irq; |
1910 |
+ } |
1911 |
+ |
1912 |
+ ad = i2c_get_adapter(0); |
1913 |
++ if (!ad) { |
1914 |
++ ret = -EFAULT; |
1915 |
++ dev_err(&op->dev, "couldn't get i2c adapter\n"); |
1916 |
++ goto err_v4l2; |
1917 |
++ } |
1918 |
+ |
1919 |
+ v4l2_ctrl_handler_init(&viu_dev->hdl, 5); |
1920 |
+ if (viu_dev->hdl.error) { |
1921 |
+ ret = viu_dev->hdl.error; |
1922 |
+ dev_err(&op->dev, "couldn't register control\n"); |
1923 |
+- goto err_vdev; |
1924 |
++ goto err_i2c; |
1925 |
+ } |
1926 |
+ /* This control handler will inherit the control(s) from the |
1927 |
+ sub-device(s). */ |
1928 |
+@@ -1475,7 +1480,7 @@ static int viu_of_probe(struct platform_device *op) |
1929 |
+ vdev = video_device_alloc(); |
1930 |
+ if (vdev == NULL) { |
1931 |
+ ret = -ENOMEM; |
1932 |
+- goto err_vdev; |
1933 |
++ goto err_hdl; |
1934 |
+ } |
1935 |
+ |
1936 |
+ *vdev = viu_template; |
1937 |
+@@ -1496,7 +1501,7 @@ static int viu_of_probe(struct platform_device *op) |
1938 |
+ ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1); |
1939 |
+ if (ret < 0) { |
1940 |
+ video_device_release(viu_dev->vdev); |
1941 |
+- goto err_vdev; |
1942 |
++ goto err_unlock; |
1943 |
+ } |
1944 |
+ |
1945 |
+ /* enable VIU clock */ |
1946 |
+@@ -1504,12 +1509,12 @@ static int viu_of_probe(struct platform_device *op) |
1947 |
+ if (IS_ERR(clk)) { |
1948 |
+ dev_err(&op->dev, "failed to lookup the clock!\n"); |
1949 |
+ ret = PTR_ERR(clk); |
1950 |
+- goto err_clk; |
1951 |
++ goto err_vdev; |
1952 |
+ } |
1953 |
+ ret = clk_prepare_enable(clk); |
1954 |
+ if (ret) { |
1955 |
+ dev_err(&op->dev, "failed to enable the clock!\n"); |
1956 |
+- goto err_clk; |
1957 |
++ goto err_vdev; |
1958 |
+ } |
1959 |
+ viu_dev->clk = clk; |
1960 |
+ |
1961 |
+@@ -1520,7 +1525,7 @@ static int viu_of_probe(struct platform_device *op) |
1962 |
+ if (request_irq(viu_dev->irq, viu_intr, 0, "viu", (void *)viu_dev)) { |
1963 |
+ dev_err(&op->dev, "Request VIU IRQ failed.\n"); |
1964 |
+ ret = -ENODEV; |
1965 |
+- goto err_irq; |
1966 |
++ goto err_clk; |
1967 |
+ } |
1968 |
+ |
1969 |
+ mutex_unlock(&viu_dev->lock); |
1970 |
+@@ -1528,16 +1533,19 @@ static int viu_of_probe(struct platform_device *op) |
1971 |
+ dev_info(&op->dev, "Freescale VIU Video Capture Board\n"); |
1972 |
+ return ret; |
1973 |
+ |
1974 |
+-err_irq: |
1975 |
+- clk_disable_unprepare(viu_dev->clk); |
1976 |
+ err_clk: |
1977 |
+- video_unregister_device(viu_dev->vdev); |
1978 |
++ clk_disable_unprepare(viu_dev->clk); |
1979 |
+ err_vdev: |
1980 |
+- v4l2_ctrl_handler_free(&viu_dev->hdl); |
1981 |
++ video_unregister_device(viu_dev->vdev); |
1982 |
++err_unlock: |
1983 |
+ mutex_unlock(&viu_dev->lock); |
1984 |
++err_hdl: |
1985 |
++ v4l2_ctrl_handler_free(&viu_dev->hdl); |
1986 |
++err_i2c: |
1987 |
+ i2c_put_adapter(ad); |
1988 |
++err_v4l2: |
1989 |
+ v4l2_device_unregister(&viu_dev->v4l2_dev); |
1990 |
+-err: |
1991 |
++err_irq: |
1992 |
+ irq_dispose_mapping(viu_irq); |
1993 |
+ return ret; |
1994 |
+ } |
1995 |
+diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c |
1996 |
+index 9f023bc6e1b7..6e6e978263b0 100644 |
1997 |
+--- a/drivers/media/platform/omap3isp/isp.c |
1998 |
++++ b/drivers/media/platform/omap3isp/isp.c |
1999 |
+@@ -305,7 +305,7 @@ static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data) |
2000 |
+ static int isp_xclk_init(struct isp_device *isp) |
2001 |
+ { |
2002 |
+ struct device_node *np = isp->dev->of_node; |
2003 |
+- struct clk_init_data init; |
2004 |
++ struct clk_init_data init = { 0 }; |
2005 |
+ unsigned int i; |
2006 |
+ |
2007 |
+ for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) |
2008 |
+diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c |
2009 |
+index 0f0324a14d51..85d26713cedb 100644 |
2010 |
+--- a/drivers/media/platform/s3c-camif/camif-capture.c |
2011 |
++++ b/drivers/media/platform/s3c-camif/camif-capture.c |
2012 |
+@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on) |
2013 |
+ |
2014 |
+ if (camif->sensor.power_count == !on) |
2015 |
+ err = v4l2_subdev_call(sensor->sd, core, s_power, on); |
2016 |
++ if (err == -ENOIOCTLCMD) |
2017 |
++ err = 0; |
2018 |
+ if (!err) |
2019 |
+ sensor->power_count += on ? 1 : -1; |
2020 |
+ |
2021 |
+diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c |
2022 |
+index 097ac321b7e1..349f578273b6 100644 |
2023 |
+--- a/drivers/media/usb/tm6000/tm6000-dvb.c |
2024 |
++++ b/drivers/media/usb/tm6000/tm6000-dvb.c |
2025 |
+@@ -267,6 +267,11 @@ static int register_dvb(struct tm6000_core *dev) |
2026 |
+ |
2027 |
+ ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T", |
2028 |
+ THIS_MODULE, &dev->udev->dev, adapter_nr); |
2029 |
++ if (ret < 0) { |
2030 |
++ pr_err("tm6000: couldn't register the adapter!\n"); |
2031 |
++ goto err; |
2032 |
++ } |
2033 |
++ |
2034 |
+ dvb->adapter.priv = dev; |
2035 |
+ |
2036 |
+ if (dvb->frontend) { |
2037 |
+diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c |
2038 |
+index fb86d6af398d..a6d800291883 100644 |
2039 |
+--- a/drivers/media/usb/uvc/uvc_video.c |
2040 |
++++ b/drivers/media/usb/uvc/uvc_video.c |
2041 |
+@@ -163,14 +163,27 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, |
2042 |
+ } |
2043 |
+ } |
2044 |
+ |
2045 |
++static size_t uvc_video_ctrl_size(struct uvc_streaming *stream) |
2046 |
++{ |
2047 |
++ /* |
2048 |
++ * Return the size of the video probe and commit controls, which depends |
2049 |
++ * on the protocol version. |
2050 |
++ */ |
2051 |
++ if (stream->dev->uvc_version < 0x0110) |
2052 |
++ return 26; |
2053 |
++ else if (stream->dev->uvc_version < 0x0150) |
2054 |
++ return 34; |
2055 |
++ else |
2056 |
++ return 48; |
2057 |
++} |
2058 |
++ |
2059 |
+ static int uvc_get_video_ctrl(struct uvc_streaming *stream, |
2060 |
+ struct uvc_streaming_control *ctrl, int probe, __u8 query) |
2061 |
+ { |
2062 |
++ __u16 size = uvc_video_ctrl_size(stream); |
2063 |
+ __u8 *data; |
2064 |
+- __u16 size; |
2065 |
+ int ret; |
2066 |
+ |
2067 |
+- size = stream->dev->uvc_version >= 0x0110 ? 34 : 26; |
2068 |
+ if ((stream->dev->quirks & UVC_QUIRK_PROBE_DEF) && |
2069 |
+ query == UVC_GET_DEF) |
2070 |
+ return -EIO; |
2071 |
+@@ -225,7 +238,7 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream, |
2072 |
+ ctrl->dwMaxVideoFrameSize = get_unaligned_le32(&data[18]); |
2073 |
+ ctrl->dwMaxPayloadTransferSize = get_unaligned_le32(&data[22]); |
2074 |
+ |
2075 |
+- if (size == 34) { |
2076 |
++ if (size >= 34) { |
2077 |
+ ctrl->dwClockFrequency = get_unaligned_le32(&data[26]); |
2078 |
+ ctrl->bmFramingInfo = data[30]; |
2079 |
+ ctrl->bPreferedVersion = data[31]; |
2080 |
+@@ -254,11 +267,10 @@ out: |
2081 |
+ static int uvc_set_video_ctrl(struct uvc_streaming *stream, |
2082 |
+ struct uvc_streaming_control *ctrl, int probe) |
2083 |
+ { |
2084 |
++ __u16 size = uvc_video_ctrl_size(stream); |
2085 |
+ __u8 *data; |
2086 |
+- __u16 size; |
2087 |
+ int ret; |
2088 |
+ |
2089 |
+- size = stream->dev->uvc_version >= 0x0110 ? 34 : 26; |
2090 |
+ data = kzalloc(size, GFP_KERNEL); |
2091 |
+ if (data == NULL) |
2092 |
+ return -ENOMEM; |
2093 |
+@@ -275,7 +287,7 @@ static int uvc_set_video_ctrl(struct uvc_streaming *stream, |
2094 |
+ put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]); |
2095 |
+ put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]); |
2096 |
+ |
2097 |
+- if (size == 34) { |
2098 |
++ if (size >= 34) { |
2099 |
+ put_unaligned_le32(ctrl->dwClockFrequency, &data[26]); |
2100 |
+ data[30] = ctrl->bmFramingInfo; |
2101 |
+ data[31] = ctrl->bPreferedVersion; |
2102 |
+diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c |
2103 |
+index 968c2eb08b5a..568dd4affb33 100644 |
2104 |
+--- a/drivers/media/v4l2-core/v4l2-event.c |
2105 |
++++ b/drivers/media/v4l2-core/v4l2-event.c |
2106 |
+@@ -115,14 +115,6 @@ static void __v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *e |
2107 |
+ if (sev == NULL) |
2108 |
+ return; |
2109 |
+ |
2110 |
+- /* |
2111 |
+- * If the event has been added to the fh->subscribed list, but its |
2112 |
+- * add op has not completed yet elems will be 0, treat this as |
2113 |
+- * not being subscribed. |
2114 |
+- */ |
2115 |
+- if (!sev->elems) |
2116 |
+- return; |
2117 |
+- |
2118 |
+ /* Increase event sequence number on fh. */ |
2119 |
+ fh->sequence++; |
2120 |
+ |
2121 |
+@@ -208,6 +200,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, |
2122 |
+ struct v4l2_subscribed_event *sev, *found_ev; |
2123 |
+ unsigned long flags; |
2124 |
+ unsigned i; |
2125 |
++ int ret = 0; |
2126 |
+ |
2127 |
+ if (sub->type == V4L2_EVENT_ALL) |
2128 |
+ return -EINVAL; |
2129 |
+@@ -226,31 +219,36 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, |
2130 |
+ sev->flags = sub->flags; |
2131 |
+ sev->fh = fh; |
2132 |
+ sev->ops = ops; |
2133 |
++ sev->elems = elems; |
2134 |
++ |
2135 |
++ mutex_lock(&fh->subscribe_lock); |
2136 |
+ |
2137 |
+ spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
2138 |
+ found_ev = v4l2_event_subscribed(fh, sub->type, sub->id); |
2139 |
+- if (!found_ev) |
2140 |
+- list_add(&sev->list, &fh->subscribed); |
2141 |
+ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |
2142 |
+ |
2143 |
+ if (found_ev) { |
2144 |
++ /* Already listening */ |
2145 |
+ kvfree(sev); |
2146 |
+- return 0; /* Already listening */ |
2147 |
++ goto out_unlock; |
2148 |
+ } |
2149 |
+ |
2150 |
+ if (sev->ops && sev->ops->add) { |
2151 |
+- int ret = sev->ops->add(sev, elems); |
2152 |
++ ret = sev->ops->add(sev, elems); |
2153 |
+ if (ret) { |
2154 |
+- sev->ops = NULL; |
2155 |
+- v4l2_event_unsubscribe(fh, sub); |
2156 |
+- return ret; |
2157 |
++ kvfree(sev); |
2158 |
++ goto out_unlock; |
2159 |
+ } |
2160 |
+ } |
2161 |
+ |
2162 |
+- /* Mark as ready for use */ |
2163 |
+- sev->elems = elems; |
2164 |
++ spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
2165 |
++ list_add(&sev->list, &fh->subscribed); |
2166 |
++ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |
2167 |
+ |
2168 |
+- return 0; |
2169 |
++out_unlock: |
2170 |
++ mutex_unlock(&fh->subscribe_lock); |
2171 |
++ |
2172 |
++ return ret; |
2173 |
+ } |
2174 |
+ EXPORT_SYMBOL_GPL(v4l2_event_subscribe); |
2175 |
+ |
2176 |
+@@ -289,6 +287,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, |
2177 |
+ return 0; |
2178 |
+ } |
2179 |
+ |
2180 |
++ mutex_lock(&fh->subscribe_lock); |
2181 |
++ |
2182 |
+ spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
2183 |
+ |
2184 |
+ sev = v4l2_event_subscribed(fh, sub->type, sub->id); |
2185 |
+@@ -306,6 +306,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, |
2186 |
+ if (sev && sev->ops && sev->ops->del) |
2187 |
+ sev->ops->del(sev); |
2188 |
+ |
2189 |
++ mutex_unlock(&fh->subscribe_lock); |
2190 |
++ |
2191 |
+ kvfree(sev); |
2192 |
+ |
2193 |
+ return 0; |
2194 |
+diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c |
2195 |
+index 3895999bf880..c91a7bd3ecfc 100644 |
2196 |
+--- a/drivers/media/v4l2-core/v4l2-fh.c |
2197 |
++++ b/drivers/media/v4l2-core/v4l2-fh.c |
2198 |
+@@ -45,6 +45,7 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) |
2199 |
+ INIT_LIST_HEAD(&fh->available); |
2200 |
+ INIT_LIST_HEAD(&fh->subscribed); |
2201 |
+ fh->sequence = -1; |
2202 |
++ mutex_init(&fh->subscribe_lock); |
2203 |
+ } |
2204 |
+ EXPORT_SYMBOL_GPL(v4l2_fh_init); |
2205 |
+ |
2206 |
+@@ -90,6 +91,7 @@ void v4l2_fh_exit(struct v4l2_fh *fh) |
2207 |
+ return; |
2208 |
+ v4l_disable_media_source(fh->vdev); |
2209 |
+ v4l2_event_unsubscribe_all(fh); |
2210 |
++ mutex_destroy(&fh->subscribe_lock); |
2211 |
+ fh->vdev = NULL; |
2212 |
+ } |
2213 |
+ EXPORT_SYMBOL_GPL(v4l2_fh_exit); |
2214 |
+diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c |
2215 |
+index 4dd0d868ff88..8daefb81ba29 100644 |
2216 |
+--- a/drivers/misc/sram.c |
2217 |
++++ b/drivers/misc/sram.c |
2218 |
+@@ -391,23 +391,23 @@ static int sram_probe(struct platform_device *pdev) |
2219 |
+ if (IS_ERR(sram->pool)) |
2220 |
+ return PTR_ERR(sram->pool); |
2221 |
+ |
2222 |
+- ret = sram_reserve_regions(sram, res); |
2223 |
+- if (ret) |
2224 |
+- return ret; |
2225 |
+- |
2226 |
+ sram->clk = devm_clk_get(sram->dev, NULL); |
2227 |
+ if (IS_ERR(sram->clk)) |
2228 |
+ sram->clk = NULL; |
2229 |
+ else |
2230 |
+ clk_prepare_enable(sram->clk); |
2231 |
+ |
2232 |
++ ret = sram_reserve_regions(sram, res); |
2233 |
++ if (ret) |
2234 |
++ goto err_disable_clk; |
2235 |
++ |
2236 |
+ platform_set_drvdata(pdev, sram); |
2237 |
+ |
2238 |
+ init_func = of_device_get_match_data(&pdev->dev); |
2239 |
+ if (init_func) { |
2240 |
+ ret = init_func(); |
2241 |
+ if (ret) |
2242 |
+- goto err_disable_clk; |
2243 |
++ goto err_free_partitions; |
2244 |
+ } |
2245 |
+ |
2246 |
+ dev_dbg(sram->dev, "SRAM pool: %zu KiB @ 0x%p\n", |
2247 |
+@@ -415,10 +415,11 @@ static int sram_probe(struct platform_device *pdev) |
2248 |
+ |
2249 |
+ return 0; |
2250 |
+ |
2251 |
++err_free_partitions: |
2252 |
++ sram_free_partitions(sram); |
2253 |
+ err_disable_clk: |
2254 |
+ if (sram->clk) |
2255 |
+ clk_disable_unprepare(sram->clk); |
2256 |
+- sram_free_partitions(sram); |
2257 |
+ |
2258 |
+ return ret; |
2259 |
+ } |
2260 |
+diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c |
2261 |
+index adf46072cb37..3fce3b6a3624 100644 |
2262 |
+--- a/drivers/misc/tsl2550.c |
2263 |
++++ b/drivers/misc/tsl2550.c |
2264 |
+@@ -177,7 +177,7 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1) |
2265 |
+ } else |
2266 |
+ lux = 0; |
2267 |
+ else |
2268 |
+- return -EAGAIN; |
2269 |
++ return 0; |
2270 |
+ |
2271 |
+ /* LUX range check */ |
2272 |
+ return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux; |
2273 |
+diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c |
2274 |
+index 8af5c2672f71..b4570d5c1fe7 100644 |
2275 |
+--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c |
2276 |
++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c |
2277 |
+@@ -755,7 +755,7 @@ static int qp_host_get_user_memory(u64 produce_uva, |
2278 |
+ retval = get_user_pages_fast((uintptr_t) produce_uva, |
2279 |
+ produce_q->kernel_if->num_pages, 1, |
2280 |
+ produce_q->kernel_if->u.h.header_page); |
2281 |
+- if (retval < produce_q->kernel_if->num_pages) { |
2282 |
++ if (retval < (int)produce_q->kernel_if->num_pages) { |
2283 |
+ pr_debug("get_user_pages_fast(produce) failed (retval=%d)", |
2284 |
+ retval); |
2285 |
+ qp_release_pages(produce_q->kernel_if->u.h.header_page, |
2286 |
+@@ -767,7 +767,7 @@ static int qp_host_get_user_memory(u64 produce_uva, |
2287 |
+ retval = get_user_pages_fast((uintptr_t) consume_uva, |
2288 |
+ consume_q->kernel_if->num_pages, 1, |
2289 |
+ consume_q->kernel_if->u.h.header_page); |
2290 |
+- if (retval < consume_q->kernel_if->num_pages) { |
2291 |
++ if (retval < (int)consume_q->kernel_if->num_pages) { |
2292 |
+ pr_debug("get_user_pages_fast(consume) failed (retval=%d)", |
2293 |
+ retval); |
2294 |
+ qp_release_pages(consume_q->kernel_if->u.h.header_page, |
2295 |
+diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c |
2296 |
+index 68c9d98a3347..148744418e82 100644 |
2297 |
+--- a/drivers/mtd/nand/atmel/nand-controller.c |
2298 |
++++ b/drivers/mtd/nand/atmel/nand-controller.c |
2299 |
+@@ -129,6 +129,11 @@ |
2300 |
+ #define DEFAULT_TIMEOUT_MS 1000 |
2301 |
+ #define MIN_DMA_LEN 128 |
2302 |
+ |
2303 |
++static bool atmel_nand_avoid_dma __read_mostly; |
2304 |
++ |
2305 |
++MODULE_PARM_DESC(avoiddma, "Avoid using DMA"); |
2306 |
++module_param_named(avoiddma, atmel_nand_avoid_dma, bool, 0400); |
2307 |
++ |
2308 |
+ enum atmel_nand_rb_type { |
2309 |
+ ATMEL_NAND_NO_RB, |
2310 |
+ ATMEL_NAND_NATIVE_RB, |
2311 |
+@@ -1975,7 +1980,7 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, |
2312 |
+ return ret; |
2313 |
+ } |
2314 |
+ |
2315 |
+- if (nc->caps->has_dma) { |
2316 |
++ if (nc->caps->has_dma && !atmel_nand_avoid_dma) { |
2317 |
+ dma_cap_mask_t mask; |
2318 |
+ |
2319 |
+ dma_cap_zero(mask); |
2320 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h |
2321 |
+index fa5b30f547f6..cad52bd331f7 100644 |
2322 |
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.h |
2323 |
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.h |
2324 |
+@@ -220,10 +220,10 @@ struct hnae_desc_cb { |
2325 |
+ |
2326 |
+ /* priv data for the desc, e.g. skb when use with ip stack*/ |
2327 |
+ void *priv; |
2328 |
+- u16 page_offset; |
2329 |
+- u16 reuse_flag; |
2330 |
++ u32 page_offset; |
2331 |
++ u32 length; /* length of the buffer */ |
2332 |
+ |
2333 |
+- u16 length; /* length of the buffer */ |
2334 |
++ u16 reuse_flag; |
2335 |
+ |
2336 |
+ /* desc type, used by the ring user to mark the type of the priv data */ |
2337 |
+ u16 type; |
2338 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2339 |
+index e77192683dba..25a9732afc84 100644 |
2340 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2341 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
2342 |
+@@ -530,7 +530,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i, |
2343 |
+ } |
2344 |
+ |
2345 |
+ skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len, |
2346 |
+- size - pull_len, truesize - pull_len); |
2347 |
++ size - pull_len, truesize); |
2348 |
+ |
2349 |
+ /* avoid re-using remote pages,flag default unreuse */ |
2350 |
+ if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id())) |
2351 |
+diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c |
2352 |
+index 3b3983a1ffbb..10df2d60c181 100644 |
2353 |
+--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c |
2354 |
++++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c |
2355 |
+@@ -644,14 +644,14 @@ static int e1000_set_ringparam(struct net_device *netdev, |
2356 |
+ adapter->tx_ring = tx_old; |
2357 |
+ e1000_free_all_rx_resources(adapter); |
2358 |
+ e1000_free_all_tx_resources(adapter); |
2359 |
+- kfree(tx_old); |
2360 |
+- kfree(rx_old); |
2361 |
+ adapter->rx_ring = rxdr; |
2362 |
+ adapter->tx_ring = txdr; |
2363 |
+ err = e1000_up(adapter); |
2364 |
+ if (err) |
2365 |
+ goto err_setup; |
2366 |
+ } |
2367 |
++ kfree(tx_old); |
2368 |
++ kfree(rx_old); |
2369 |
+ |
2370 |
+ clear_bit(__E1000_RESETTING, &adapter->flags); |
2371 |
+ return 0; |
2372 |
+@@ -664,7 +664,8 @@ err_setup_rx: |
2373 |
+ err_alloc_rx: |
2374 |
+ kfree(txdr); |
2375 |
+ err_alloc_tx: |
2376 |
+- e1000_up(adapter); |
2377 |
++ if (netif_running(adapter->netdev)) |
2378 |
++ e1000_up(adapter); |
2379 |
+ err_setup: |
2380 |
+ clear_bit(__E1000_RESETTING, &adapter->flags); |
2381 |
+ return err; |
2382 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c |
2383 |
+index 3c469355f5a4..7938abe9a301 100644 |
2384 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c |
2385 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c |
2386 |
+@@ -47,7 +47,7 @@ |
2387 |
+ #include "qed_reg_addr.h" |
2388 |
+ #include "qed_sriov.h" |
2389 |
+ |
2390 |
+-#define CHIP_MCP_RESP_ITER_US 10 |
2391 |
++#define QED_MCP_RESP_ITER_US 10 |
2392 |
+ |
2393 |
+ #define QED_DRV_MB_MAX_RETRIES (500 * 1000) /* Account for 5 sec */ |
2394 |
+ #define QED_MCP_RESET_RETRIES (50 * 1000) /* Account for 500 msec */ |
2395 |
+@@ -182,18 +182,57 @@ int qed_mcp_free(struct qed_hwfn *p_hwfn) |
2396 |
+ return 0; |
2397 |
+ } |
2398 |
+ |
2399 |
++/* Maximum of 1 sec to wait for the SHMEM ready indication */ |
2400 |
++#define QED_MCP_SHMEM_RDY_MAX_RETRIES 20 |
2401 |
++#define QED_MCP_SHMEM_RDY_ITER_MS 50 |
2402 |
++ |
2403 |
+ static int qed_load_mcp_offsets(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2404 |
+ { |
2405 |
+ struct qed_mcp_info *p_info = p_hwfn->mcp_info; |
2406 |
++ u8 cnt = QED_MCP_SHMEM_RDY_MAX_RETRIES; |
2407 |
++ u8 msec = QED_MCP_SHMEM_RDY_ITER_MS; |
2408 |
+ u32 drv_mb_offsize, mfw_mb_offsize; |
2409 |
+ u32 mcp_pf_id = MCP_PF_ID(p_hwfn); |
2410 |
+ |
2411 |
+ p_info->public_base = qed_rd(p_hwfn, p_ptt, MISC_REG_SHARED_MEM_ADDR); |
2412 |
+- if (!p_info->public_base) |
2413 |
+- return 0; |
2414 |
++ if (!p_info->public_base) { |
2415 |
++ DP_NOTICE(p_hwfn, |
2416 |
++ "The address of the MCP scratch-pad is not configured\n"); |
2417 |
++ return -EINVAL; |
2418 |
++ } |
2419 |
+ |
2420 |
+ p_info->public_base |= GRCBASE_MCP; |
2421 |
+ |
2422 |
++ /* Get the MFW MB address and number of supported messages */ |
2423 |
++ mfw_mb_offsize = qed_rd(p_hwfn, p_ptt, |
2424 |
++ SECTION_OFFSIZE_ADDR(p_info->public_base, |
2425 |
++ PUBLIC_MFW_MB)); |
2426 |
++ p_info->mfw_mb_addr = SECTION_ADDR(mfw_mb_offsize, mcp_pf_id); |
2427 |
++ p_info->mfw_mb_length = (u16)qed_rd(p_hwfn, p_ptt, |
2428 |
++ p_info->mfw_mb_addr + |
2429 |
++ offsetof(struct public_mfw_mb, |
2430 |
++ sup_msgs)); |
2431 |
++ |
2432 |
++ /* The driver can notify that there was an MCP reset, and might read the |
2433 |
++ * SHMEM values before the MFW has completed initializing them. |
2434 |
++ * To avoid this, the "sup_msgs" field in the MFW mailbox is used as a |
2435 |
++ * data ready indication. |
2436 |
++ */ |
2437 |
++ while (!p_info->mfw_mb_length && --cnt) { |
2438 |
++ msleep(msec); |
2439 |
++ p_info->mfw_mb_length = |
2440 |
++ (u16)qed_rd(p_hwfn, p_ptt, |
2441 |
++ p_info->mfw_mb_addr + |
2442 |
++ offsetof(struct public_mfw_mb, sup_msgs)); |
2443 |
++ } |
2444 |
++ |
2445 |
++ if (!cnt) { |
2446 |
++ DP_NOTICE(p_hwfn, |
2447 |
++ "Failed to get the SHMEM ready notification after %d msec\n", |
2448 |
++ QED_MCP_SHMEM_RDY_MAX_RETRIES * msec); |
2449 |
++ return -EBUSY; |
2450 |
++ } |
2451 |
++ |
2452 |
+ /* Calculate the driver and MFW mailbox address */ |
2453 |
+ drv_mb_offsize = qed_rd(p_hwfn, p_ptt, |
2454 |
+ SECTION_OFFSIZE_ADDR(p_info->public_base, |
2455 |
+@@ -203,13 +242,6 @@ static int qed_load_mcp_offsets(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2456 |
+ "drv_mb_offsiz = 0x%x, drv_mb_addr = 0x%x mcp_pf_id = 0x%x\n", |
2457 |
+ drv_mb_offsize, p_info->drv_mb_addr, mcp_pf_id); |
2458 |
+ |
2459 |
+- /* Set the MFW MB address */ |
2460 |
+- mfw_mb_offsize = qed_rd(p_hwfn, p_ptt, |
2461 |
+- SECTION_OFFSIZE_ADDR(p_info->public_base, |
2462 |
+- PUBLIC_MFW_MB)); |
2463 |
+- p_info->mfw_mb_addr = SECTION_ADDR(mfw_mb_offsize, mcp_pf_id); |
2464 |
+- p_info->mfw_mb_length = (u16)qed_rd(p_hwfn, p_ptt, p_info->mfw_mb_addr); |
2465 |
+- |
2466 |
+ /* Get the current driver mailbox sequence before sending |
2467 |
+ * the first command |
2468 |
+ */ |
2469 |
+@@ -284,9 +316,15 @@ static void qed_mcp_reread_offsets(struct qed_hwfn *p_hwfn, |
2470 |
+ |
2471 |
+ int qed_mcp_reset(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2472 |
+ { |
2473 |
+- u32 org_mcp_reset_seq, seq, delay = CHIP_MCP_RESP_ITER_US, cnt = 0; |
2474 |
++ u32 org_mcp_reset_seq, seq, delay = QED_MCP_RESP_ITER_US, cnt = 0; |
2475 |
+ int rc = 0; |
2476 |
+ |
2477 |
++ if (p_hwfn->mcp_info->b_block_cmd) { |
2478 |
++ DP_NOTICE(p_hwfn, |
2479 |
++ "The MFW is not responsive. Avoid sending MCP_RESET mailbox command.\n"); |
2480 |
++ return -EBUSY; |
2481 |
++ } |
2482 |
++ |
2483 |
+ /* Ensure that only a single thread is accessing the mailbox */ |
2484 |
+ spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); |
2485 |
+ |
2486 |
+@@ -412,14 +450,41 @@ static void __qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2487 |
+ (p_mb_params->cmd | seq_num), p_mb_params->param); |
2488 |
+ } |
2489 |
+ |
2490 |
++static void qed_mcp_cmd_set_blocking(struct qed_hwfn *p_hwfn, bool block_cmd) |
2491 |
++{ |
2492 |
++ p_hwfn->mcp_info->b_block_cmd = block_cmd; |
2493 |
++ |
2494 |
++ DP_INFO(p_hwfn, "%s sending of mailbox commands to the MFW\n", |
2495 |
++ block_cmd ? "Block" : "Unblock"); |
2496 |
++} |
2497 |
++ |
2498 |
++static void qed_mcp_print_cpu_info(struct qed_hwfn *p_hwfn, |
2499 |
++ struct qed_ptt *p_ptt) |
2500 |
++{ |
2501 |
++ u32 cpu_mode, cpu_state, cpu_pc_0, cpu_pc_1, cpu_pc_2; |
2502 |
++ u32 delay = QED_MCP_RESP_ITER_US; |
2503 |
++ |
2504 |
++ cpu_mode = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE); |
2505 |
++ cpu_state = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_STATE); |
2506 |
++ cpu_pc_0 = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_PROGRAM_COUNTER); |
2507 |
++ udelay(delay); |
2508 |
++ cpu_pc_1 = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_PROGRAM_COUNTER); |
2509 |
++ udelay(delay); |
2510 |
++ cpu_pc_2 = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_PROGRAM_COUNTER); |
2511 |
++ |
2512 |
++ DP_NOTICE(p_hwfn, |
2513 |
++ "MCP CPU info: mode 0x%08x, state 0x%08x, pc {0x%08x, 0x%08x, 0x%08x}\n", |
2514 |
++ cpu_mode, cpu_state, cpu_pc_0, cpu_pc_1, cpu_pc_2); |
2515 |
++} |
2516 |
++ |
2517 |
+ static int |
2518 |
+ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2519 |
+ struct qed_ptt *p_ptt, |
2520 |
+ struct qed_mcp_mb_params *p_mb_params, |
2521 |
+- u32 max_retries, u32 delay) |
2522 |
++ u32 max_retries, u32 usecs) |
2523 |
+ { |
2524 |
++ u32 cnt = 0, msecs = DIV_ROUND_UP(usecs, 1000); |
2525 |
+ struct qed_mcp_cmd_elem *p_cmd_elem; |
2526 |
+- u32 cnt = 0; |
2527 |
+ u16 seq_num; |
2528 |
+ int rc = 0; |
2529 |
+ |
2530 |
+@@ -442,7 +507,11 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2531 |
+ goto err; |
2532 |
+ |
2533 |
+ spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); |
2534 |
+- udelay(delay); |
2535 |
++ |
2536 |
++ if (QED_MB_FLAGS_IS_SET(p_mb_params, CAN_SLEEP)) |
2537 |
++ msleep(msecs); |
2538 |
++ else |
2539 |
++ udelay(usecs); |
2540 |
+ } while (++cnt < max_retries); |
2541 |
+ |
2542 |
+ if (cnt >= max_retries) { |
2543 |
+@@ -471,7 +540,11 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2544 |
+ * The spinlock stays locked until the list element is removed. |
2545 |
+ */ |
2546 |
+ |
2547 |
+- udelay(delay); |
2548 |
++ if (QED_MB_FLAGS_IS_SET(p_mb_params, CAN_SLEEP)) |
2549 |
++ msleep(msecs); |
2550 |
++ else |
2551 |
++ udelay(usecs); |
2552 |
++ |
2553 |
+ spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); |
2554 |
+ |
2555 |
+ if (p_cmd_elem->b_is_completed) |
2556 |
+@@ -490,11 +563,15 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2557 |
+ DP_NOTICE(p_hwfn, |
2558 |
+ "The MFW failed to respond to command 0x%08x [param 0x%08x].\n", |
2559 |
+ p_mb_params->cmd, p_mb_params->param); |
2560 |
++ qed_mcp_print_cpu_info(p_hwfn, p_ptt); |
2561 |
+ |
2562 |
+ spin_lock_bh(&p_hwfn->mcp_info->cmd_lock); |
2563 |
+ qed_mcp_cmd_del_elem(p_hwfn, p_cmd_elem); |
2564 |
+ spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock); |
2565 |
+ |
2566 |
++ if (!QED_MB_FLAGS_IS_SET(p_mb_params, AVOID_BLOCK)) |
2567 |
++ qed_mcp_cmd_set_blocking(p_hwfn, true); |
2568 |
++ |
2569 |
+ return -EAGAIN; |
2570 |
+ } |
2571 |
+ |
2572 |
+@@ -506,7 +583,7 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2573 |
+ "MFW mailbox: response 0x%08x param 0x%08x [after %d.%03d ms]\n", |
2574 |
+ p_mb_params->mcp_resp, |
2575 |
+ p_mb_params->mcp_param, |
2576 |
+- (cnt * delay) / 1000, (cnt * delay) % 1000); |
2577 |
++ (cnt * usecs) / 1000, (cnt * usecs) % 1000); |
2578 |
+ |
2579 |
+ /* Clear the sequence number from the MFW response */ |
2580 |
+ p_mb_params->mcp_resp &= FW_MSG_CODE_MASK; |
2581 |
+@@ -524,7 +601,7 @@ static int qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2582 |
+ { |
2583 |
+ size_t union_data_size = sizeof(union drv_union_data); |
2584 |
+ u32 max_retries = QED_DRV_MB_MAX_RETRIES; |
2585 |
+- u32 delay = CHIP_MCP_RESP_ITER_US; |
2586 |
++ u32 usecs = QED_MCP_RESP_ITER_US; |
2587 |
+ |
2588 |
+ /* MCP not initialized */ |
2589 |
+ if (!qed_mcp_is_init(p_hwfn)) { |
2590 |
+@@ -532,6 +609,13 @@ static int qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2591 |
+ return -EBUSY; |
2592 |
+ } |
2593 |
+ |
2594 |
++ if (p_hwfn->mcp_info->b_block_cmd) { |
2595 |
++ DP_NOTICE(p_hwfn, |
2596 |
++ "The MFW is not responsive. Avoid sending mailbox command 0x%08x [param 0x%08x].\n", |
2597 |
++ p_mb_params->cmd, p_mb_params->param); |
2598 |
++ return -EBUSY; |
2599 |
++ } |
2600 |
++ |
2601 |
+ if (p_mb_params->data_src_size > union_data_size || |
2602 |
+ p_mb_params->data_dst_size > union_data_size) { |
2603 |
+ DP_ERR(p_hwfn, |
2604 |
+@@ -541,8 +625,13 @@ static int qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn, |
2605 |
+ return -EINVAL; |
2606 |
+ } |
2607 |
+ |
2608 |
++ if (QED_MB_FLAGS_IS_SET(p_mb_params, CAN_SLEEP)) { |
2609 |
++ max_retries = DIV_ROUND_UP(max_retries, 1000); |
2610 |
++ usecs *= 1000; |
2611 |
++ } |
2612 |
++ |
2613 |
+ return _qed_mcp_cmd_and_union(p_hwfn, p_ptt, p_mb_params, max_retries, |
2614 |
+- delay); |
2615 |
++ usecs); |
2616 |
+ } |
2617 |
+ |
2618 |
+ int qed_mcp_cmd(struct qed_hwfn *p_hwfn, |
2619 |
+@@ -731,6 +820,7 @@ __qed_mcp_load_req(struct qed_hwfn *p_hwfn, |
2620 |
+ mb_params.data_src_size = sizeof(load_req); |
2621 |
+ mb_params.p_data_dst = &load_rsp; |
2622 |
+ mb_params.data_dst_size = sizeof(load_rsp); |
2623 |
++ mb_params.flags = QED_MB_FLAG_CAN_SLEEP | QED_MB_FLAG_AVOID_BLOCK; |
2624 |
+ |
2625 |
+ DP_VERBOSE(p_hwfn, QED_MSG_SP, |
2626 |
+ "Load Request: param 0x%08x [init_hw %d, drv_type %d, hsi_ver %d, pda 0x%04x]\n", |
2627 |
+@@ -952,7 +1042,8 @@ int qed_mcp_load_req(struct qed_hwfn *p_hwfn, |
2628 |
+ |
2629 |
+ int qed_mcp_unload_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2630 |
+ { |
2631 |
+- u32 wol_param, mcp_resp, mcp_param; |
2632 |
++ struct qed_mcp_mb_params mb_params; |
2633 |
++ u32 wol_param; |
2634 |
+ |
2635 |
+ switch (p_hwfn->cdev->wol_config) { |
2636 |
+ case QED_OV_WOL_DISABLED: |
2637 |
+@@ -970,8 +1061,12 @@ int qed_mcp_unload_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2638 |
+ wol_param = DRV_MB_PARAM_UNLOAD_WOL_MCP; |
2639 |
+ } |
2640 |
+ |
2641 |
+- return qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_UNLOAD_REQ, wol_param, |
2642 |
+- &mcp_resp, &mcp_param); |
2643 |
++ memset(&mb_params, 0, sizeof(mb_params)); |
2644 |
++ mb_params.cmd = DRV_MSG_CODE_UNLOAD_REQ; |
2645 |
++ mb_params.param = wol_param; |
2646 |
++ mb_params.flags = QED_MB_FLAG_CAN_SLEEP | QED_MB_FLAG_AVOID_BLOCK; |
2647 |
++ |
2648 |
++ return qed_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params); |
2649 |
+ } |
2650 |
+ |
2651 |
+ int qed_mcp_unload_done(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2652 |
+@@ -1966,31 +2061,65 @@ qed_mcp_send_drv_version(struct qed_hwfn *p_hwfn, |
2653 |
+ return rc; |
2654 |
+ } |
2655 |
+ |
2656 |
++/* A maximal 100 msec waiting time for the MCP to halt */ |
2657 |
++#define QED_MCP_HALT_SLEEP_MS 10 |
2658 |
++#define QED_MCP_HALT_MAX_RETRIES 10 |
2659 |
++ |
2660 |
+ int qed_mcp_halt(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2661 |
+ { |
2662 |
+- u32 resp = 0, param = 0; |
2663 |
++ u32 resp = 0, param = 0, cpu_state, cnt = 0; |
2664 |
+ int rc; |
2665 |
+ |
2666 |
+ rc = qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_MCP_HALT, 0, &resp, |
2667 |
+ ¶m); |
2668 |
+- if (rc) |
2669 |
++ if (rc) { |
2670 |
+ DP_ERR(p_hwfn, "MCP response failure, aborting\n"); |
2671 |
++ return rc; |
2672 |
++ } |
2673 |
+ |
2674 |
+- return rc; |
2675 |
++ do { |
2676 |
++ msleep(QED_MCP_HALT_SLEEP_MS); |
2677 |
++ cpu_state = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_STATE); |
2678 |
++ if (cpu_state & MCP_REG_CPU_STATE_SOFT_HALTED) |
2679 |
++ break; |
2680 |
++ } while (++cnt < QED_MCP_HALT_MAX_RETRIES); |
2681 |
++ |
2682 |
++ if (cnt == QED_MCP_HALT_MAX_RETRIES) { |
2683 |
++ DP_NOTICE(p_hwfn, |
2684 |
++ "Failed to halt the MCP [CPU_MODE = 0x%08x, CPU_STATE = 0x%08x]\n", |
2685 |
++ qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE), cpu_state); |
2686 |
++ return -EBUSY; |
2687 |
++ } |
2688 |
++ |
2689 |
++ qed_mcp_cmd_set_blocking(p_hwfn, true); |
2690 |
++ |
2691 |
++ return 0; |
2692 |
+ } |
2693 |
+ |
2694 |
++#define QED_MCP_RESUME_SLEEP_MS 10 |
2695 |
++ |
2696 |
+ int qed_mcp_resume(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
2697 |
+ { |
2698 |
+- u32 value, cpu_mode; |
2699 |
++ u32 cpu_mode, cpu_state; |
2700 |
+ |
2701 |
+ qed_wr(p_hwfn, p_ptt, MCP_REG_CPU_STATE, 0xffffffff); |
2702 |
+ |
2703 |
+- value = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE); |
2704 |
+- value &= ~MCP_REG_CPU_MODE_SOFT_HALT; |
2705 |
+- qed_wr(p_hwfn, p_ptt, MCP_REG_CPU_MODE, value); |
2706 |
+ cpu_mode = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_MODE); |
2707 |
++ cpu_mode &= ~MCP_REG_CPU_MODE_SOFT_HALT; |
2708 |
++ qed_wr(p_hwfn, p_ptt, MCP_REG_CPU_MODE, cpu_mode); |
2709 |
++ msleep(QED_MCP_RESUME_SLEEP_MS); |
2710 |
++ cpu_state = qed_rd(p_hwfn, p_ptt, MCP_REG_CPU_STATE); |
2711 |
+ |
2712 |
+- return (cpu_mode & MCP_REG_CPU_MODE_SOFT_HALT) ? -EAGAIN : 0; |
2713 |
++ if (cpu_state & MCP_REG_CPU_STATE_SOFT_HALTED) { |
2714 |
++ DP_NOTICE(p_hwfn, |
2715 |
++ "Failed to resume the MCP [CPU_MODE = 0x%08x, CPU_STATE = 0x%08x]\n", |
2716 |
++ cpu_mode, cpu_state); |
2717 |
++ return -EBUSY; |
2718 |
++ } |
2719 |
++ |
2720 |
++ qed_mcp_cmd_set_blocking(p_hwfn, false); |
2721 |
++ |
2722 |
++ return 0; |
2723 |
+ } |
2724 |
+ |
2725 |
+ int qed_mcp_ov_update_current_config(struct qed_hwfn *p_hwfn, |
2726 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.h b/drivers/net/ethernet/qlogic/qed/qed_mcp.h |
2727 |
+index c7ec2395d1ce..f1fe5e3427ea 100644 |
2728 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.h |
2729 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.h |
2730 |
+@@ -540,11 +540,14 @@ struct qed_mcp_info { |
2731 |
+ */ |
2732 |
+ spinlock_t cmd_lock; |
2733 |
+ |
2734 |
++ /* Flag to indicate whether sending a MFW mailbox command is blocked */ |
2735 |
++ bool b_block_cmd; |
2736 |
++ |
2737 |
+ /* Spinlock used for syncing SW link-changes and link-changes |
2738 |
+ * originating from attention context. |
2739 |
+ */ |
2740 |
+ spinlock_t link_lock; |
2741 |
+- bool block_mb_sending; |
2742 |
++ |
2743 |
+ u32 public_base; |
2744 |
+ u32 drv_mb_addr; |
2745 |
+ u32 mfw_mb_addr; |
2746 |
+@@ -565,14 +568,20 @@ struct qed_mcp_info { |
2747 |
+ }; |
2748 |
+ |
2749 |
+ struct qed_mcp_mb_params { |
2750 |
+- u32 cmd; |
2751 |
+- u32 param; |
2752 |
+- void *p_data_src; |
2753 |
+- u8 data_src_size; |
2754 |
+- void *p_data_dst; |
2755 |
+- u8 data_dst_size; |
2756 |
+- u32 mcp_resp; |
2757 |
+- u32 mcp_param; |
2758 |
++ u32 cmd; |
2759 |
++ u32 param; |
2760 |
++ void *p_data_src; |
2761 |
++ void *p_data_dst; |
2762 |
++ u8 data_src_size; |
2763 |
++ u8 data_dst_size; |
2764 |
++ u32 mcp_resp; |
2765 |
++ u32 mcp_param; |
2766 |
++ u32 flags; |
2767 |
++#define QED_MB_FLAG_CAN_SLEEP (0x1 << 0) |
2768 |
++#define QED_MB_FLAG_AVOID_BLOCK (0x1 << 1) |
2769 |
++#define QED_MB_FLAGS_IS_SET(params, flag) \ |
2770 |
++ ({ typeof(params) __params = (params); \ |
2771 |
++ (__params && (__params->flags & QED_MB_FLAG_ ## flag)); }) |
2772 |
+ }; |
2773 |
+ |
2774 |
+ /** |
2775 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h b/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h |
2776 |
+index 0cdb4337b3a0..d1201bb2d4bb 100644 |
2777 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h |
2778 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_reg_addr.h |
2779 |
+@@ -554,8 +554,10 @@ |
2780 |
+ 0 |
2781 |
+ #define MCP_REG_CPU_STATE \ |
2782 |
+ 0xe05004UL |
2783 |
++#define MCP_REG_CPU_STATE_SOFT_HALTED (0x1UL << 10) |
2784 |
+ #define MCP_REG_CPU_EVENT_MASK \ |
2785 |
+ 0xe05008UL |
2786 |
++#define MCP_REG_CPU_PROGRAM_COUNTER 0xe0501cUL |
2787 |
+ #define PGLUE_B_REG_PF_BAR0_SIZE \ |
2788 |
+ 0x2aae60UL |
2789 |
+ #define PGLUE_B_REG_PF_BAR1_SIZE \ |
2790 |
+diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c |
2791 |
+index 2e5150b0b8d5..7a14e8170e82 100644 |
2792 |
+--- a/drivers/net/phy/xilinx_gmii2rgmii.c |
2793 |
++++ b/drivers/net/phy/xilinx_gmii2rgmii.c |
2794 |
+@@ -40,8 +40,11 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev) |
2795 |
+ { |
2796 |
+ struct gmii2rgmii *priv = phydev->priv; |
2797 |
+ u16 val = 0; |
2798 |
++ int err; |
2799 |
+ |
2800 |
+- priv->phy_drv->read_status(phydev); |
2801 |
++ err = priv->phy_drv->read_status(phydev); |
2802 |
++ if (err < 0) |
2803 |
++ return err; |
2804 |
+ |
2805 |
+ val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG); |
2806 |
+ val &= ~XILINX_GMII2RGMII_SPEED_MASK; |
2807 |
+@@ -81,6 +84,11 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev) |
2808 |
+ return -EPROBE_DEFER; |
2809 |
+ } |
2810 |
+ |
2811 |
++ if (!priv->phy_dev->drv) { |
2812 |
++ dev_info(dev, "Attached phy not ready\n"); |
2813 |
++ return -EPROBE_DEFER; |
2814 |
++ } |
2815 |
++ |
2816 |
+ priv->addr = mdiodev->addr; |
2817 |
+ priv->phy_drv = priv->phy_dev->drv; |
2818 |
+ memcpy(&priv->conv_phy_drv, priv->phy_dev->drv, |
2819 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c |
2820 |
+index 0aeeb233af78..21642bab485a 100644 |
2821 |
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c |
2822 |
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c |
2823 |
+@@ -215,11 +215,12 @@ int ath10k_htt_rx_ring_refill(struct ath10k *ar) |
2824 |
+ spin_lock_bh(&htt->rx_ring.lock); |
2825 |
+ ret = ath10k_htt_rx_ring_fill_n(htt, (htt->rx_ring.fill_level - |
2826 |
+ htt->rx_ring.fill_cnt)); |
2827 |
+- spin_unlock_bh(&htt->rx_ring.lock); |
2828 |
+ |
2829 |
+ if (ret) |
2830 |
+ ath10k_htt_rx_ring_free(htt); |
2831 |
+ |
2832 |
++ spin_unlock_bh(&htt->rx_ring.lock); |
2833 |
++ |
2834 |
+ return ret; |
2835 |
+ } |
2836 |
+ |
2837 |
+@@ -231,7 +232,9 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt) |
2838 |
+ skb_queue_purge(&htt->rx_in_ord_compl_q); |
2839 |
+ skb_queue_purge(&htt->tx_fetch_ind_q); |
2840 |
+ |
2841 |
++ spin_lock_bh(&htt->rx_ring.lock); |
2842 |
+ ath10k_htt_rx_ring_free(htt); |
2843 |
++ spin_unlock_bh(&htt->rx_ring.lock); |
2844 |
+ |
2845 |
+ dma_free_coherent(htt->ar->dev, |
2846 |
+ (htt->rx_ring.size * |
2847 |
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
2848 |
+index 6fa9c223ff93..cdcfb175ad9b 100644 |
2849 |
+--- a/drivers/net/wireless/ath/ath10k/mac.c |
2850 |
++++ b/drivers/net/wireless/ath/ath10k/mac.c |
2851 |
+@@ -4015,6 +4015,7 @@ void ath10k_mac_tx_push_pending(struct ath10k *ar) |
2852 |
+ rcu_read_unlock(); |
2853 |
+ spin_unlock_bh(&ar->txqs_lock); |
2854 |
+ } |
2855 |
++EXPORT_SYMBOL(ath10k_mac_tx_push_pending); |
2856 |
+ |
2857 |
+ /************/ |
2858 |
+ /* Scanning */ |
2859 |
+diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c |
2860 |
+index 03a69e5b1116..da9dbf3ddaa5 100644 |
2861 |
+--- a/drivers/net/wireless/ath/ath10k/sdio.c |
2862 |
++++ b/drivers/net/wireless/ath/ath10k/sdio.c |
2863 |
+@@ -30,6 +30,7 @@ |
2864 |
+ #include "debug.h" |
2865 |
+ #include "hif.h" |
2866 |
+ #include "htc.h" |
2867 |
++#include "mac.h" |
2868 |
+ #include "targaddrs.h" |
2869 |
+ #include "trace.h" |
2870 |
+ #include "sdio.h" |
2871 |
+@@ -396,6 +397,7 @@ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar, |
2872 |
+ int ret; |
2873 |
+ |
2874 |
+ payload_len = le16_to_cpu(htc_hdr->len); |
2875 |
++ skb->len = payload_len + sizeof(struct ath10k_htc_hdr); |
2876 |
+ |
2877 |
+ if (trailer_present) { |
2878 |
+ trailer = skb->data + sizeof(*htc_hdr) + |
2879 |
+@@ -434,12 +436,14 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, |
2880 |
+ enum ath10k_htc_ep_id id; |
2881 |
+ int ret, i, *n_lookahead_local; |
2882 |
+ u32 *lookaheads_local; |
2883 |
++ int lookahead_idx = 0; |
2884 |
+ |
2885 |
+ for (i = 0; i < ar_sdio->n_rx_pkts; i++) { |
2886 |
+ lookaheads_local = lookaheads; |
2887 |
+ n_lookahead_local = n_lookahead; |
2888 |
+ |
2889 |
+- id = ((struct ath10k_htc_hdr *)&lookaheads[i])->eid; |
2890 |
++ id = ((struct ath10k_htc_hdr *) |
2891 |
++ &lookaheads[lookahead_idx++])->eid; |
2892 |
+ |
2893 |
+ if (id >= ATH10K_HTC_EP_COUNT) { |
2894 |
+ ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n", |
2895 |
+@@ -462,6 +466,7 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, |
2896 |
+ /* Only read lookahead's from RX trailers |
2897 |
+ * for the last packet in a bundle. |
2898 |
+ */ |
2899 |
++ lookahead_idx--; |
2900 |
+ lookaheads_local = NULL; |
2901 |
+ n_lookahead_local = NULL; |
2902 |
+ } |
2903 |
+@@ -1342,6 +1347,8 @@ static void ath10k_sdio_irq_handler(struct sdio_func *func) |
2904 |
+ break; |
2905 |
+ } while (time_before(jiffies, timeout) && !done); |
2906 |
+ |
2907 |
++ ath10k_mac_tx_push_pending(ar); |
2908 |
++ |
2909 |
+ sdio_claim_host(ar_sdio->func); |
2910 |
+ |
2911 |
+ if (ret && ret != -ECANCELED) |
2912 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c |
2913 |
+index b9672da24a9d..b24bc57ca91b 100644 |
2914 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c |
2915 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_qmath.c |
2916 |
+@@ -213,7 +213,7 @@ static const s16 log_table[] = { |
2917 |
+ 30498, |
2918 |
+ 31267, |
2919 |
+ 32024, |
2920 |
+- 32768 |
2921 |
++ 32767 |
2922 |
+ }; |
2923 |
+ |
2924 |
+ #define LOG_TABLE_SIZE 32 /* log_table size */ |
2925 |
+diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c |
2926 |
+index 9935bd09db1f..d4947e3a909e 100644 |
2927 |
+--- a/drivers/net/wireless/rndis_wlan.c |
2928 |
++++ b/drivers/net/wireless/rndis_wlan.c |
2929 |
+@@ -2928,6 +2928,8 @@ static void rndis_wlan_auth_indication(struct usbnet *usbdev, |
2930 |
+ |
2931 |
+ while (buflen >= sizeof(*auth_req)) { |
2932 |
+ auth_req = (void *)buf; |
2933 |
++ if (buflen < le32_to_cpu(auth_req->length)) |
2934 |
++ return; |
2935 |
+ type = "unknown"; |
2936 |
+ flags = le32_to_cpu(auth_req->flags); |
2937 |
+ pairwise_error = false; |
2938 |
+diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c |
2939 |
+index 761cf8573a80..f48c3f62966d 100644 |
2940 |
+--- a/drivers/net/wireless/ti/wlcore/cmd.c |
2941 |
++++ b/drivers/net/wireless/ti/wlcore/cmd.c |
2942 |
+@@ -35,6 +35,7 @@ |
2943 |
+ #include "wl12xx_80211.h" |
2944 |
+ #include "cmd.h" |
2945 |
+ #include "event.h" |
2946 |
++#include "ps.h" |
2947 |
+ #include "tx.h" |
2948 |
+ #include "hw_ops.h" |
2949 |
+ |
2950 |
+@@ -191,6 +192,10 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, |
2951 |
+ |
2952 |
+ timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); |
2953 |
+ |
2954 |
++ ret = wl1271_ps_elp_wakeup(wl); |
2955 |
++ if (ret < 0) |
2956 |
++ return ret; |
2957 |
++ |
2958 |
+ do { |
2959 |
+ if (time_after(jiffies, timeout_time)) { |
2960 |
+ wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", |
2961 |
+@@ -222,6 +227,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, |
2962 |
+ } while (!event); |
2963 |
+ |
2964 |
+ out: |
2965 |
++ wl1271_ps_elp_sleep(wl); |
2966 |
+ kfree(events_vector); |
2967 |
+ return ret; |
2968 |
+ } |
2969 |
+diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c |
2970 |
+index c0080f6ab2f5..0b0a4825b3eb 100644 |
2971 |
+--- a/drivers/nvme/target/fcloop.c |
2972 |
++++ b/drivers/nvme/target/fcloop.c |
2973 |
+@@ -300,7 +300,7 @@ fcloop_tgt_lsrqst_done_work(struct work_struct *work) |
2974 |
+ struct fcloop_tport *tport = tls_req->tport; |
2975 |
+ struct nvmefc_ls_req *lsreq = tls_req->lsreq; |
2976 |
+ |
2977 |
+- if (tport->remoteport) |
2978 |
++ if (!tport || tport->remoteport) |
2979 |
+ lsreq->done(lsreq, tls_req->status); |
2980 |
+ } |
2981 |
+ |
2982 |
+@@ -318,6 +318,7 @@ fcloop_ls_req(struct nvme_fc_local_port *localport, |
2983 |
+ |
2984 |
+ if (!rport->targetport) { |
2985 |
+ tls_req->status = -ECONNREFUSED; |
2986 |
++ tls_req->tport = NULL; |
2987 |
+ schedule_work(&tls_req->work); |
2988 |
+ return ret; |
2989 |
+ } |
2990 |
+diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c |
2991 |
+index 102f95a09460..e9e749f87517 100644 |
2992 |
+--- a/drivers/power/reset/vexpress-poweroff.c |
2993 |
++++ b/drivers/power/reset/vexpress-poweroff.c |
2994 |
+@@ -35,6 +35,7 @@ static void vexpress_reset_do(struct device *dev, const char *what) |
2995 |
+ } |
2996 |
+ |
2997 |
+ static struct device *vexpress_power_off_device; |
2998 |
++static atomic_t vexpress_restart_nb_refcnt = ATOMIC_INIT(0); |
2999 |
+ |
3000 |
+ static void vexpress_power_off(void) |
3001 |
+ { |
3002 |
+@@ -99,10 +100,13 @@ static int _vexpress_register_restart_handler(struct device *dev) |
3003 |
+ int err; |
3004 |
+ |
3005 |
+ vexpress_restart_device = dev; |
3006 |
+- err = register_restart_handler(&vexpress_restart_nb); |
3007 |
+- if (err) { |
3008 |
+- dev_err(dev, "cannot register restart handler (err=%d)\n", err); |
3009 |
+- return err; |
3010 |
++ if (atomic_inc_return(&vexpress_restart_nb_refcnt) == 1) { |
3011 |
++ err = register_restart_handler(&vexpress_restart_nb); |
3012 |
++ if (err) { |
3013 |
++ dev_err(dev, "cannot register restart handler (err=%d)\n", err); |
3014 |
++ atomic_dec(&vexpress_restart_nb_refcnt); |
3015 |
++ return err; |
3016 |
++ } |
3017 |
+ } |
3018 |
+ device_create_file(dev, &dev_attr_active); |
3019 |
+ |
3020 |
+diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c |
3021 |
+index 9dc7590e07cb..4d016fbc3527 100644 |
3022 |
+--- a/drivers/power/supply/axp288_charger.c |
3023 |
++++ b/drivers/power/supply/axp288_charger.c |
3024 |
+@@ -771,7 +771,7 @@ static int charger_init_hw_regs(struct axp288_chrg_info *info) |
3025 |
+ } |
3026 |
+ |
3027 |
+ /* Determine charge current limit */ |
3028 |
+- cc = (ret & CHRG_CCCV_CC_MASK) >> CHRG_CCCV_CC_BIT_POS; |
3029 |
++ cc = (val & CHRG_CCCV_CC_MASK) >> CHRG_CCCV_CC_BIT_POS; |
3030 |
+ cc = (cc * CHRG_CCCV_CC_LSB_RES) + CHRG_CCCV_CC_OFFSET; |
3031 |
+ info->cc = cc; |
3032 |
+ |
3033 |
+diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c |
3034 |
+index 02c6340ae36f..3226faebe0a0 100644 |
3035 |
+--- a/drivers/power/supply/power_supply_core.c |
3036 |
++++ b/drivers/power/supply/power_supply_core.c |
3037 |
+@@ -14,6 +14,7 @@ |
3038 |
+ #include <linux/types.h> |
3039 |
+ #include <linux/init.h> |
3040 |
+ #include <linux/slab.h> |
3041 |
++#include <linux/delay.h> |
3042 |
+ #include <linux/device.h> |
3043 |
+ #include <linux/notifier.h> |
3044 |
+ #include <linux/err.h> |
3045 |
+@@ -139,8 +140,13 @@ static void power_supply_deferred_register_work(struct work_struct *work) |
3046 |
+ struct power_supply *psy = container_of(work, struct power_supply, |
3047 |
+ deferred_register_work.work); |
3048 |
+ |
3049 |
+- if (psy->dev.parent) |
3050 |
+- mutex_lock(&psy->dev.parent->mutex); |
3051 |
++ if (psy->dev.parent) { |
3052 |
++ while (!mutex_trylock(&psy->dev.parent->mutex)) { |
3053 |
++ if (psy->removing) |
3054 |
++ return; |
3055 |
++ msleep(10); |
3056 |
++ } |
3057 |
++ } |
3058 |
+ |
3059 |
+ power_supply_changed(psy); |
3060 |
+ |
3061 |
+@@ -1071,6 +1077,7 @@ EXPORT_SYMBOL_GPL(devm_power_supply_register_no_ws); |
3062 |
+ void power_supply_unregister(struct power_supply *psy) |
3063 |
+ { |
3064 |
+ WARN_ON(atomic_dec_return(&psy->use_cnt)); |
3065 |
++ psy->removing = true; |
3066 |
+ cancel_work_sync(&psy->changed_work); |
3067 |
+ cancel_delayed_work_sync(&psy->deferred_register_work); |
3068 |
+ sysfs_remove_link(&psy->dev.kobj, "powers"); |
3069 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
3070 |
+index b64b7916507f..b2cb4f497ef6 100644 |
3071 |
+--- a/drivers/regulator/core.c |
3072 |
++++ b/drivers/regulator/core.c |
3073 |
+@@ -4115,13 +4115,13 @@ regulator_register(const struct regulator_desc *regulator_desc, |
3074 |
+ !rdev->desc->fixed_uV) |
3075 |
+ rdev->is_switch = true; |
3076 |
+ |
3077 |
++ dev_set_drvdata(&rdev->dev, rdev); |
3078 |
+ ret = device_register(&rdev->dev); |
3079 |
+ if (ret != 0) { |
3080 |
+ put_device(&rdev->dev); |
3081 |
+ goto unset_supplies; |
3082 |
+ } |
3083 |
+ |
3084 |
+- dev_set_drvdata(&rdev->dev, rdev); |
3085 |
+ rdev_init_debugfs(rdev); |
3086 |
+ |
3087 |
+ /* try to resolve regulators supply since a new one was registered */ |
3088 |
+diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c |
3089 |
+index d072f84a8535..92c4f5180ad0 100644 |
3090 |
+--- a/drivers/s390/block/dasd.c |
3091 |
++++ b/drivers/s390/block/dasd.c |
3092 |
+@@ -3190,6 +3190,7 @@ static int dasd_alloc_queue(struct dasd_block *block) |
3093 |
+ block->tag_set.nr_hw_queues = DASD_NR_HW_QUEUES; |
3094 |
+ block->tag_set.queue_depth = DASD_MAX_LCU_DEV * DASD_REQ_PER_DEV; |
3095 |
+ block->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
3096 |
++ block->tag_set.numa_node = NUMA_NO_NODE; |
3097 |
+ |
3098 |
+ rc = blk_mq_alloc_tag_set(&block->tag_set); |
3099 |
+ if (rc) |
3100 |
+diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c |
3101 |
+index eb51893c74a4..5c944ee76ec1 100644 |
3102 |
+--- a/drivers/s390/block/scm_blk.c |
3103 |
++++ b/drivers/s390/block/scm_blk.c |
3104 |
+@@ -454,6 +454,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev) |
3105 |
+ bdev->tag_set.nr_hw_queues = nr_requests; |
3106 |
+ bdev->tag_set.queue_depth = nr_requests_per_io * nr_requests; |
3107 |
+ bdev->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
3108 |
++ bdev->tag_set.numa_node = NUMA_NO_NODE; |
3109 |
+ |
3110 |
+ ret = blk_mq_alloc_tag_set(&bdev->tag_set); |
3111 |
+ if (ret) |
3112 |
+diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c |
3113 |
+index 42921dbba927..4ca10501647b 100644 |
3114 |
+--- a/drivers/scsi/bnx2i/bnx2i_hwi.c |
3115 |
++++ b/drivers/scsi/bnx2i/bnx2i_hwi.c |
3116 |
+@@ -2742,6 +2742,8 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) |
3117 |
+ BNX2X_DOORBELL_PCI_BAR); |
3118 |
+ reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF); |
3119 |
+ ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4); |
3120 |
++ if (!ep->qp.ctx_base) |
3121 |
++ return -ENOMEM; |
3122 |
+ goto arm_cq; |
3123 |
+ } |
3124 |
+ |
3125 |
+diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c |
3126 |
+index 7d156b161482..53eb27731373 100644 |
3127 |
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.c |
3128 |
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c |
3129 |
+@@ -93,7 +93,7 @@ static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; |
3130 |
+ static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2; |
3131 |
+ static int fast_fail = 1; |
3132 |
+ static int client_reserve = 1; |
3133 |
+-static char partition_name[97] = "UNKNOWN"; |
3134 |
++static char partition_name[96] = "UNKNOWN"; |
3135 |
+ static unsigned int partition_number = -1; |
3136 |
+ static LIST_HEAD(ibmvscsi_head); |
3137 |
+ |
3138 |
+@@ -262,7 +262,7 @@ static void gather_partition_info(void) |
3139 |
+ |
3140 |
+ ppartition_name = of_get_property(of_root, "ibm,partition-name", NULL); |
3141 |
+ if (ppartition_name) |
3142 |
+- strncpy(partition_name, ppartition_name, |
3143 |
++ strlcpy(partition_name, ppartition_name, |
3144 |
+ sizeof(partition_name)); |
3145 |
+ p_number_ptr = of_get_property(of_root, "ibm,partition-no", NULL); |
3146 |
+ if (p_number_ptr) |
3147 |
+diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c |
3148 |
+index 985378e4bb6f..d55c365be238 100644 |
3149 |
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c |
3150 |
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c |
3151 |
+@@ -6597,6 +6597,9 @@ megasas_resume(struct pci_dev *pdev) |
3152 |
+ goto fail_init_mfi; |
3153 |
+ } |
3154 |
+ |
3155 |
++ if (megasas_get_ctrl_info(instance) != DCMD_SUCCESS) |
3156 |
++ goto fail_init_mfi; |
3157 |
++ |
3158 |
+ tasklet_init(&instance->isr_tasklet, instance->instancet->tasklet, |
3159 |
+ (unsigned long)instance); |
3160 |
+ |
3161 |
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c |
3162 |
+index 2a10b3f94ff7..20981e08ee97 100644 |
3163 |
+--- a/drivers/spi/spi-rspi.c |
3164 |
++++ b/drivers/spi/spi-rspi.c |
3165 |
+@@ -598,11 +598,13 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, |
3166 |
+ |
3167 |
+ ret = wait_event_interruptible_timeout(rspi->wait, |
3168 |
+ rspi->dma_callbacked, HZ); |
3169 |
+- if (ret > 0 && rspi->dma_callbacked) |
3170 |
++ if (ret > 0 && rspi->dma_callbacked) { |
3171 |
+ ret = 0; |
3172 |
+- else if (!ret) { |
3173 |
+- dev_err(&rspi->master->dev, "DMA timeout\n"); |
3174 |
+- ret = -ETIMEDOUT; |
3175 |
++ } else { |
3176 |
++ if (!ret) { |
3177 |
++ dev_err(&rspi->master->dev, "DMA timeout\n"); |
3178 |
++ ret = -ETIMEDOUT; |
3179 |
++ } |
3180 |
+ if (tx) |
3181 |
+ dmaengine_terminate_all(rspi->master->dma_tx); |
3182 |
+ if (rx) |
3183 |
+@@ -1352,12 +1354,36 @@ static const struct platform_device_id spi_driver_ids[] = { |
3184 |
+ |
3185 |
+ MODULE_DEVICE_TABLE(platform, spi_driver_ids); |
3186 |
+ |
3187 |
++#ifdef CONFIG_PM_SLEEP |
3188 |
++static int rspi_suspend(struct device *dev) |
3189 |
++{ |
3190 |
++ struct platform_device *pdev = to_platform_device(dev); |
3191 |
++ struct rspi_data *rspi = platform_get_drvdata(pdev); |
3192 |
++ |
3193 |
++ return spi_master_suspend(rspi->master); |
3194 |
++} |
3195 |
++ |
3196 |
++static int rspi_resume(struct device *dev) |
3197 |
++{ |
3198 |
++ struct platform_device *pdev = to_platform_device(dev); |
3199 |
++ struct rspi_data *rspi = platform_get_drvdata(pdev); |
3200 |
++ |
3201 |
++ return spi_master_resume(rspi->master); |
3202 |
++} |
3203 |
++ |
3204 |
++static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume); |
3205 |
++#define DEV_PM_OPS &rspi_pm_ops |
3206 |
++#else |
3207 |
++#define DEV_PM_OPS NULL |
3208 |
++#endif /* CONFIG_PM_SLEEP */ |
3209 |
++ |
3210 |
+ static struct platform_driver rspi_driver = { |
3211 |
+ .probe = rspi_probe, |
3212 |
+ .remove = rspi_remove, |
3213 |
+ .id_table = spi_driver_ids, |
3214 |
+ .driver = { |
3215 |
+ .name = "renesas_spi", |
3216 |
++ .pm = DEV_PM_OPS, |
3217 |
+ .of_match_table = of_match_ptr(rspi_of_match), |
3218 |
+ }, |
3219 |
+ }; |
3220 |
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c |
3221 |
+index 0fea18ab970e..db2a529accae 100644 |
3222 |
+--- a/drivers/spi/spi-sh-msiof.c |
3223 |
++++ b/drivers/spi/spi-sh-msiof.c |
3224 |
+@@ -384,7 +384,8 @@ static void sh_msiof_spi_set_mode_regs(struct sh_msiof_spi_priv *p, |
3225 |
+ |
3226 |
+ static void sh_msiof_reset_str(struct sh_msiof_spi_priv *p) |
3227 |
+ { |
3228 |
+- sh_msiof_write(p, STR, sh_msiof_read(p, STR)); |
3229 |
++ sh_msiof_write(p, STR, |
3230 |
++ sh_msiof_read(p, STR) & ~(STR_TDREQ | STR_RDREQ)); |
3231 |
+ } |
3232 |
+ |
3233 |
+ static void sh_msiof_spi_write_fifo_8(struct sh_msiof_spi_priv *p, |
3234 |
+@@ -1361,12 +1362,37 @@ static const struct platform_device_id spi_driver_ids[] = { |
3235 |
+ }; |
3236 |
+ MODULE_DEVICE_TABLE(platform, spi_driver_ids); |
3237 |
+ |
3238 |
++#ifdef CONFIG_PM_SLEEP |
3239 |
++static int sh_msiof_spi_suspend(struct device *dev) |
3240 |
++{ |
3241 |
++ struct platform_device *pdev = to_platform_device(dev); |
3242 |
++ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev); |
3243 |
++ |
3244 |
++ return spi_master_suspend(p->master); |
3245 |
++} |
3246 |
++ |
3247 |
++static int sh_msiof_spi_resume(struct device *dev) |
3248 |
++{ |
3249 |
++ struct platform_device *pdev = to_platform_device(dev); |
3250 |
++ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev); |
3251 |
++ |
3252 |
++ return spi_master_resume(p->master); |
3253 |
++} |
3254 |
++ |
3255 |
++static SIMPLE_DEV_PM_OPS(sh_msiof_spi_pm_ops, sh_msiof_spi_suspend, |
3256 |
++ sh_msiof_spi_resume); |
3257 |
++#define DEV_PM_OPS &sh_msiof_spi_pm_ops |
3258 |
++#else |
3259 |
++#define DEV_PM_OPS NULL |
3260 |
++#endif /* CONFIG_PM_SLEEP */ |
3261 |
++ |
3262 |
+ static struct platform_driver sh_msiof_spi_drv = { |
3263 |
+ .probe = sh_msiof_spi_probe, |
3264 |
+ .remove = sh_msiof_spi_remove, |
3265 |
+ .id_table = spi_driver_ids, |
3266 |
+ .driver = { |
3267 |
+ .name = "spi_sh_msiof", |
3268 |
++ .pm = DEV_PM_OPS, |
3269 |
+ .of_match_table = of_match_ptr(sh_msiof_match), |
3270 |
+ }, |
3271 |
+ }; |
3272 |
+diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
3273 |
+index 3e12d5f87ee4..9831c1106945 100644 |
3274 |
+--- a/drivers/spi/spi-tegra20-slink.c |
3275 |
++++ b/drivers/spi/spi-tegra20-slink.c |
3276 |
+@@ -1063,6 +1063,24 @@ static int tegra_slink_probe(struct platform_device *pdev) |
3277 |
+ goto exit_free_master; |
3278 |
+ } |
3279 |
+ |
3280 |
++ /* disabled clock may cause interrupt storm upon request */ |
3281 |
++ tspi->clk = devm_clk_get(&pdev->dev, NULL); |
3282 |
++ if (IS_ERR(tspi->clk)) { |
3283 |
++ ret = PTR_ERR(tspi->clk); |
3284 |
++ dev_err(&pdev->dev, "Can not get clock %d\n", ret); |
3285 |
++ goto exit_free_master; |
3286 |
++ } |
3287 |
++ ret = clk_prepare(tspi->clk); |
3288 |
++ if (ret < 0) { |
3289 |
++ dev_err(&pdev->dev, "Clock prepare failed %d\n", ret); |
3290 |
++ goto exit_free_master; |
3291 |
++ } |
3292 |
++ ret = clk_enable(tspi->clk); |
3293 |
++ if (ret < 0) { |
3294 |
++ dev_err(&pdev->dev, "Clock enable failed %d\n", ret); |
3295 |
++ goto exit_free_master; |
3296 |
++ } |
3297 |
++ |
3298 |
+ spi_irq = platform_get_irq(pdev, 0); |
3299 |
+ tspi->irq = spi_irq; |
3300 |
+ ret = request_threaded_irq(tspi->irq, tegra_slink_isr, |
3301 |
+@@ -1071,14 +1089,7 @@ static int tegra_slink_probe(struct platform_device *pdev) |
3302 |
+ if (ret < 0) { |
3303 |
+ dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
3304 |
+ tspi->irq); |
3305 |
+- goto exit_free_master; |
3306 |
+- } |
3307 |
+- |
3308 |
+- tspi->clk = devm_clk_get(&pdev->dev, NULL); |
3309 |
+- if (IS_ERR(tspi->clk)) { |
3310 |
+- dev_err(&pdev->dev, "can not get clock\n"); |
3311 |
+- ret = PTR_ERR(tspi->clk); |
3312 |
+- goto exit_free_irq; |
3313 |
++ goto exit_clk_disable; |
3314 |
+ } |
3315 |
+ |
3316 |
+ tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi"); |
3317 |
+@@ -1138,6 +1149,8 @@ exit_rx_dma_free: |
3318 |
+ tegra_slink_deinit_dma_param(tspi, true); |
3319 |
+ exit_free_irq: |
3320 |
+ free_irq(spi_irq, tspi); |
3321 |
++exit_clk_disable: |
3322 |
++ clk_disable(tspi->clk); |
3323 |
+ exit_free_master: |
3324 |
+ spi_master_put(master); |
3325 |
+ return ret; |
3326 |
+@@ -1150,6 +1163,8 @@ static int tegra_slink_remove(struct platform_device *pdev) |
3327 |
+ |
3328 |
+ free_irq(tspi->irq, tspi); |
3329 |
+ |
3330 |
++ clk_disable(tspi->clk); |
3331 |
++ |
3332 |
+ if (tspi->tx_dma_chan) |
3333 |
+ tegra_slink_deinit_dma_param(tspi, false); |
3334 |
+ |
3335 |
+diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c |
3336 |
+index 893b2836089c..4151bb44a410 100644 |
3337 |
+--- a/drivers/staging/android/ashmem.c |
3338 |
++++ b/drivers/staging/android/ashmem.c |
3339 |
+@@ -374,6 +374,12 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) |
3340 |
+ goto out; |
3341 |
+ } |
3342 |
+ |
3343 |
++ /* requested mapping size larger than object size */ |
3344 |
++ if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) { |
3345 |
++ ret = -EINVAL; |
3346 |
++ goto out; |
3347 |
++ } |
3348 |
++ |
3349 |
+ /* requested protection bits must match our allowed protection mask */ |
3350 |
+ if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & |
3351 |
+ calc_vm_prot_bits(PROT_MASK, 0))) { |
3352 |
+diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c |
3353 |
+index 0790b3d9e255..111afd34aa3c 100644 |
3354 |
+--- a/drivers/staging/media/imx/imx-ic-prpencvf.c |
3355 |
++++ b/drivers/staging/media/imx/imx-ic-prpencvf.c |
3356 |
+@@ -210,6 +210,7 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct ipuv3_channel *ch) |
3357 |
+ |
3358 |
+ done = priv->active_vb2_buf[priv->ipu_buf_num]; |
3359 |
+ if (done) { |
3360 |
++ done->vbuf.field = vdev->fmt.fmt.pix.field; |
3361 |
+ vb = &done->vbuf.vb2_buf; |
3362 |
+ vb->timestamp = ktime_get_ns(); |
3363 |
+ vb2_buffer_done(vb, priv->nfb4eof ? |
3364 |
+diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c |
3365 |
+index 6d856118c223..83ecb5b2fb9e 100644 |
3366 |
+--- a/drivers/staging/media/imx/imx-media-csi.c |
3367 |
++++ b/drivers/staging/media/imx/imx-media-csi.c |
3368 |
+@@ -171,6 +171,7 @@ static void csi_vb2_buf_done(struct csi_priv *priv) |
3369 |
+ |
3370 |
+ done = priv->active_vb2_buf[priv->ipu_buf_num]; |
3371 |
+ if (done) { |
3372 |
++ done->vbuf.field = vdev->fmt.fmt.pix.field; |
3373 |
+ vb = &done->vbuf.vb2_buf; |
3374 |
+ vb->timestamp = ktime_get_ns(); |
3375 |
+ vb2_buffer_done(vb, priv->nfb4eof ? |
3376 |
+diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c |
3377 |
+index 4033a2cf7ac9..d98d5fe25a17 100644 |
3378 |
+--- a/drivers/staging/rts5208/sd.c |
3379 |
++++ b/drivers/staging/rts5208/sd.c |
3380 |
+@@ -5002,7 +5002,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip) |
3381 |
+ goto sd_execute_write_cmd_failed; |
3382 |
+ } |
3383 |
+ |
3384 |
+- rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00); |
3385 |
++ retval = rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00); |
3386 |
+ if (retval != STATUS_SUCCESS) { |
3387 |
+ rtsx_trace(chip); |
3388 |
+ goto sd_execute_write_cmd_failed; |
3389 |
+diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c |
3390 |
+index 594d07a1e995..16e7516052a4 100644 |
3391 |
+--- a/drivers/target/iscsi/iscsi_target_tpg.c |
3392 |
++++ b/drivers/target/iscsi/iscsi_target_tpg.c |
3393 |
+@@ -633,8 +633,7 @@ int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication) |
3394 |
+ none = strstr(buf1, NONE); |
3395 |
+ if (none) |
3396 |
+ goto out; |
3397 |
+- strncat(buf1, ",", strlen(",")); |
3398 |
+- strncat(buf1, NONE, strlen(NONE)); |
3399 |
++ strlcat(buf1, "," NONE, sizeof(buf1)); |
3400 |
+ if (iscsi_update_param_value(param, buf1) < 0) |
3401 |
+ return -EINVAL; |
3402 |
+ } |
3403 |
+diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c |
3404 |
+index e8dd6da164b2..84742125f773 100644 |
3405 |
+--- a/drivers/target/target_core_device.c |
3406 |
++++ b/drivers/target/target_core_device.c |
3407 |
+@@ -904,14 +904,20 @@ struct se_device *target_find_device(int id, bool do_depend) |
3408 |
+ EXPORT_SYMBOL(target_find_device); |
3409 |
+ |
3410 |
+ struct devices_idr_iter { |
3411 |
++ struct config_item *prev_item; |
3412 |
+ int (*fn)(struct se_device *dev, void *data); |
3413 |
+ void *data; |
3414 |
+ }; |
3415 |
+ |
3416 |
+ static int target_devices_idr_iter(int id, void *p, void *data) |
3417 |
++ __must_hold(&device_mutex) |
3418 |
+ { |
3419 |
+ struct devices_idr_iter *iter = data; |
3420 |
+ struct se_device *dev = p; |
3421 |
++ int ret; |
3422 |
++ |
3423 |
++ config_item_put(iter->prev_item); |
3424 |
++ iter->prev_item = NULL; |
3425 |
+ |
3426 |
+ /* |
3427 |
+ * We add the device early to the idr, so it can be used |
3428 |
+@@ -922,7 +928,15 @@ static int target_devices_idr_iter(int id, void *p, void *data) |
3429 |
+ if (!(dev->dev_flags & DF_CONFIGURED)) |
3430 |
+ return 0; |
3431 |
+ |
3432 |
+- return iter->fn(dev, iter->data); |
3433 |
++ iter->prev_item = config_item_get_unless_zero(&dev->dev_group.cg_item); |
3434 |
++ if (!iter->prev_item) |
3435 |
++ return 0; |
3436 |
++ mutex_unlock(&device_mutex); |
3437 |
++ |
3438 |
++ ret = iter->fn(dev, iter->data); |
3439 |
++ |
3440 |
++ mutex_lock(&device_mutex); |
3441 |
++ return ret; |
3442 |
+ } |
3443 |
+ |
3444 |
+ /** |
3445 |
+@@ -936,15 +950,13 @@ static int target_devices_idr_iter(int id, void *p, void *data) |
3446 |
+ int target_for_each_device(int (*fn)(struct se_device *dev, void *data), |
3447 |
+ void *data) |
3448 |
+ { |
3449 |
+- struct devices_idr_iter iter; |
3450 |
++ struct devices_idr_iter iter = { .fn = fn, .data = data }; |
3451 |
+ int ret; |
3452 |
+ |
3453 |
+- iter.fn = fn; |
3454 |
+- iter.data = data; |
3455 |
+- |
3456 |
+ mutex_lock(&device_mutex); |
3457 |
+ ret = idr_for_each(&devices_idr, target_devices_idr_iter, &iter); |
3458 |
+ mutex_unlock(&device_mutex); |
3459 |
++ config_item_put(iter.prev_item); |
3460 |
+ return ret; |
3461 |
+ } |
3462 |
+ |
3463 |
+diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c |
3464 |
+index d04ec3b9e5ff..8a70b57d129c 100644 |
3465 |
+--- a/drivers/thermal/of-thermal.c |
3466 |
++++ b/drivers/thermal/of-thermal.c |
3467 |
+@@ -278,10 +278,13 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz, |
3468 |
+ |
3469 |
+ mutex_lock(&tz->lock); |
3470 |
+ |
3471 |
+- if (mode == THERMAL_DEVICE_ENABLED) |
3472 |
++ if (mode == THERMAL_DEVICE_ENABLED) { |
3473 |
+ tz->polling_delay = data->polling_delay; |
3474 |
+- else |
3475 |
++ tz->passive_delay = data->passive_delay; |
3476 |
++ } else { |
3477 |
+ tz->polling_delay = 0; |
3478 |
++ tz->passive_delay = 0; |
3479 |
++ } |
3480 |
+ |
3481 |
+ mutex_unlock(&tz->lock); |
3482 |
+ |
3483 |
+diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c |
3484 |
+index 933c2688dd7e..8106353ce7aa 100644 |
3485 |
+--- a/drivers/tty/serial/8250/serial_cs.c |
3486 |
++++ b/drivers/tty/serial/8250/serial_cs.c |
3487 |
+@@ -637,8 +637,10 @@ static int serial_config(struct pcmcia_device *link) |
3488 |
+ (link->has_func_id) && |
3489 |
+ (link->socket->pcmcia_pfc == 0) && |
3490 |
+ ((link->func_id == CISTPL_FUNCID_MULTI) || |
3491 |
+- (link->func_id == CISTPL_FUNCID_SERIAL))) |
3492 |
+- pcmcia_loop_config(link, serial_check_for_multi, info); |
3493 |
++ (link->func_id == CISTPL_FUNCID_SERIAL))) { |
3494 |
++ if (pcmcia_loop_config(link, serial_check_for_multi, info)) |
3495 |
++ goto failed; |
3496 |
++ } |
3497 |
+ |
3498 |
+ /* |
3499 |
+ * Apply any multi-port quirk. |
3500 |
+diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c |
3501 |
+index 9ac142cfc1f1..8b2b694334ec 100644 |
3502 |
+--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c |
3503 |
++++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c |
3504 |
+@@ -1068,8 +1068,8 @@ static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo) |
3505 |
+ /* Get the address of the host memory buffer. |
3506 |
+ */ |
3507 |
+ bdp = pinfo->rx_cur; |
3508 |
+- while (bdp->cbd_sc & BD_SC_EMPTY) |
3509 |
+- ; |
3510 |
++ if (bdp->cbd_sc & BD_SC_EMPTY) |
3511 |
++ return NO_POLL_CHAR; |
3512 |
+ |
3513 |
+ /* If the buffer address is in the CPM DPRAM, don't |
3514 |
+ * convert it. |
3515 |
+@@ -1104,7 +1104,11 @@ static int cpm_get_poll_char(struct uart_port *port) |
3516 |
+ poll_chars = 0; |
3517 |
+ } |
3518 |
+ if (poll_chars <= 0) { |
3519 |
+- poll_chars = poll_wait_key(poll_buf, pinfo); |
3520 |
++ int ret = poll_wait_key(poll_buf, pinfo); |
3521 |
++ |
3522 |
++ if (ret == NO_POLL_CHAR) |
3523 |
++ return ret; |
3524 |
++ poll_chars = ret; |
3525 |
+ pollp = poll_buf; |
3526 |
+ } |
3527 |
+ poll_chars--; |
3528 |
+diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
3529 |
+index 7a3db9378fa3..fd64ac2c1a74 100644 |
3530 |
+--- a/drivers/tty/serial/fsl_lpuart.c |
3531 |
++++ b/drivers/tty/serial/fsl_lpuart.c |
3532 |
+@@ -983,7 +983,8 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) |
3533 |
+ struct circ_buf *ring = &sport->rx_ring; |
3534 |
+ int ret, nent; |
3535 |
+ int bits, baud; |
3536 |
+- struct tty_struct *tty = tty_port_tty_get(&sport->port.state->port); |
3537 |
++ struct tty_port *port = &sport->port.state->port; |
3538 |
++ struct tty_struct *tty = port->tty; |
3539 |
+ struct ktermios *termios = &tty->termios; |
3540 |
+ |
3541 |
+ baud = tty_get_baud_rate(tty); |
3542 |
+diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c |
3543 |
+index 8deaf2ad8b34..4e827e5a52a3 100644 |
3544 |
+--- a/drivers/tty/serial/imx.c |
3545 |
++++ b/drivers/tty/serial/imx.c |
3546 |
+@@ -2213,6 +2213,14 @@ static int serial_imx_probe(struct platform_device *pdev) |
3547 |
+ ret); |
3548 |
+ return ret; |
3549 |
+ } |
3550 |
++ |
3551 |
++ ret = devm_request_irq(&pdev->dev, rtsirq, imx_rtsint, 0, |
3552 |
++ dev_name(&pdev->dev), sport); |
3553 |
++ if (ret) { |
3554 |
++ dev_err(&pdev->dev, "failed to request rts irq: %d\n", |
3555 |
++ ret); |
3556 |
++ return ret; |
3557 |
++ } |
3558 |
+ } else { |
3559 |
+ ret = devm_request_irq(&pdev->dev, rxirq, imx_int, 0, |
3560 |
+ dev_name(&pdev->dev), sport); |
3561 |
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c |
3562 |
+index 8bc8fe2b75f7..37dba940d898 100644 |
3563 |
+--- a/drivers/tty/serial/sh-sci.c |
3564 |
++++ b/drivers/tty/serial/sh-sci.c |
3565 |
+@@ -2060,6 +2060,8 @@ static void sci_shutdown(struct uart_port *port) |
3566 |
+ } |
3567 |
+ #endif |
3568 |
+ |
3569 |
++ if (s->rx_trigger > 1 && s->rx_fifo_timeout > 0) |
3570 |
++ del_timer_sync(&s->rx_fifo_timer); |
3571 |
+ sci_free_irq(s); |
3572 |
+ sci_free_dma(port); |
3573 |
+ } |
3574 |
+diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c |
3575 |
+index a9509ecccedb..3e865dbf878c 100644 |
3576 |
+--- a/drivers/usb/class/cdc-wdm.c |
3577 |
++++ b/drivers/usb/class/cdc-wdm.c |
3578 |
+@@ -457,7 +457,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc) |
3579 |
+ |
3580 |
+ set_bit(WDM_RESPONDING, &desc->flags); |
3581 |
+ spin_unlock_irq(&desc->iuspin); |
3582 |
+- rv = usb_submit_urb(desc->response, GFP_ATOMIC); |
3583 |
++ rv = usb_submit_urb(desc->response, GFP_KERNEL); |
3584 |
+ spin_lock_irq(&desc->iuspin); |
3585 |
+ if (rv) { |
3586 |
+ dev_err(&desc->intf->dev, |
3587 |
+diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
3588 |
+index ab245352f102..76cb9b3649b4 100644 |
3589 |
+--- a/drivers/usb/core/devio.c |
3590 |
++++ b/drivers/usb/core/devio.c |
3591 |
+@@ -1451,10 +1451,13 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb |
3592 |
+ struct async *as = NULL; |
3593 |
+ struct usb_ctrlrequest *dr = NULL; |
3594 |
+ unsigned int u, totlen, isofrmlen; |
3595 |
+- int i, ret, is_in, num_sgs = 0, ifnum = -1; |
3596 |
++ int i, ret, num_sgs = 0, ifnum = -1; |
3597 |
+ int number_of_packets = 0; |
3598 |
+ unsigned int stream_id = 0; |
3599 |
+ void *buf; |
3600 |
++ bool is_in; |
3601 |
++ bool allow_short = false; |
3602 |
++ bool allow_zero = false; |
3603 |
+ unsigned long mask = USBDEVFS_URB_SHORT_NOT_OK | |
3604 |
+ USBDEVFS_URB_BULK_CONTINUATION | |
3605 |
+ USBDEVFS_URB_NO_FSBR | |
3606 |
+@@ -1488,6 +1491,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb |
3607 |
+ u = 0; |
3608 |
+ switch (uurb->type) { |
3609 |
+ case USBDEVFS_URB_TYPE_CONTROL: |
3610 |
++ if (is_in) |
3611 |
++ allow_short = true; |
3612 |
+ if (!usb_endpoint_xfer_control(&ep->desc)) |
3613 |
+ return -EINVAL; |
3614 |
+ /* min 8 byte setup packet */ |
3615 |
+@@ -1528,6 +1533,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb |
3616 |
+ break; |
3617 |
+ |
3618 |
+ case USBDEVFS_URB_TYPE_BULK: |
3619 |
++ if (!is_in) |
3620 |
++ allow_zero = true; |
3621 |
++ else |
3622 |
++ allow_short = true; |
3623 |
+ switch (usb_endpoint_type(&ep->desc)) { |
3624 |
+ case USB_ENDPOINT_XFER_CONTROL: |
3625 |
+ case USB_ENDPOINT_XFER_ISOC: |
3626 |
+@@ -1548,6 +1557,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb |
3627 |
+ if (!usb_endpoint_xfer_int(&ep->desc)) |
3628 |
+ return -EINVAL; |
3629 |
+ interrupt_urb: |
3630 |
++ if (!is_in) |
3631 |
++ allow_zero = true; |
3632 |
++ else |
3633 |
++ allow_short = true; |
3634 |
+ break; |
3635 |
+ |
3636 |
+ case USBDEVFS_URB_TYPE_ISO: |
3637 |
+@@ -1692,16 +1705,21 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb |
3638 |
+ u = (is_in ? URB_DIR_IN : URB_DIR_OUT); |
3639 |
+ if (uurb->flags & USBDEVFS_URB_ISO_ASAP) |
3640 |
+ u |= URB_ISO_ASAP; |
3641 |
+- if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in) |
3642 |
++ if (allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK) |
3643 |
+ u |= URB_SHORT_NOT_OK; |
3644 |
+ if (uurb->flags & USBDEVFS_URB_NO_FSBR) |
3645 |
+ u |= URB_NO_FSBR; |
3646 |
+- if (uurb->flags & USBDEVFS_URB_ZERO_PACKET) |
3647 |
++ if (allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET) |
3648 |
+ u |= URB_ZERO_PACKET; |
3649 |
+ if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT) |
3650 |
+ u |= URB_NO_INTERRUPT; |
3651 |
+ as->urb->transfer_flags = u; |
3652 |
+ |
3653 |
++ if (!allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK) |
3654 |
++ dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_SHORT_NOT_OK.\n"); |
3655 |
++ if (!allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET) |
3656 |
++ dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_ZERO_PACKET.\n"); |
3657 |
++ |
3658 |
+ as->urb->transfer_buffer_length = uurb->buffer_length; |
3659 |
+ as->urb->setup_packet = (unsigned char *)dr; |
3660 |
+ dr = NULL; |
3661 |
+diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c |
3662 |
+index eb87a259d55c..2f3dbf1c3c2d 100644 |
3663 |
+--- a/drivers/usb/core/driver.c |
3664 |
++++ b/drivers/usb/core/driver.c |
3665 |
+@@ -512,7 +512,6 @@ int usb_driver_claim_interface(struct usb_driver *driver, |
3666 |
+ struct device *dev; |
3667 |
+ struct usb_device *udev; |
3668 |
+ int retval = 0; |
3669 |
+- int lpm_disable_error = -ENODEV; |
3670 |
+ |
3671 |
+ if (!iface) |
3672 |
+ return -ENODEV; |
3673 |
+@@ -533,16 +532,6 @@ int usb_driver_claim_interface(struct usb_driver *driver, |
3674 |
+ |
3675 |
+ iface->condition = USB_INTERFACE_BOUND; |
3676 |
+ |
3677 |
+- /* See the comment about disabling LPM in usb_probe_interface(). */ |
3678 |
+- if (driver->disable_hub_initiated_lpm) { |
3679 |
+- lpm_disable_error = usb_unlocked_disable_lpm(udev); |
3680 |
+- if (lpm_disable_error) { |
3681 |
+- dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.", |
3682 |
+- __func__, driver->name); |
3683 |
+- return -ENOMEM; |
3684 |
+- } |
3685 |
+- } |
3686 |
+- |
3687 |
+ /* Claimed interfaces are initially inactive (suspended) and |
3688 |
+ * runtime-PM-enabled, but only if the driver has autosuspend |
3689 |
+ * support. Otherwise they are marked active, to prevent the |
3690 |
+@@ -561,9 +550,20 @@ int usb_driver_claim_interface(struct usb_driver *driver, |
3691 |
+ if (device_is_registered(dev)) |
3692 |
+ retval = device_bind_driver(dev); |
3693 |
+ |
3694 |
+- /* Attempt to re-enable USB3 LPM, if the disable was successful. */ |
3695 |
+- if (!lpm_disable_error) |
3696 |
+- usb_unlocked_enable_lpm(udev); |
3697 |
++ if (retval) { |
3698 |
++ dev->driver = NULL; |
3699 |
++ usb_set_intfdata(iface, NULL); |
3700 |
++ iface->needs_remote_wakeup = 0; |
3701 |
++ iface->condition = USB_INTERFACE_UNBOUND; |
3702 |
++ |
3703 |
++ /* |
3704 |
++ * Unbound interfaces are always runtime-PM-disabled |
3705 |
++ * and runtime-PM-suspended |
3706 |
++ */ |
3707 |
++ if (driver->supports_autosuspend) |
3708 |
++ pm_runtime_disable(dev); |
3709 |
++ pm_runtime_set_suspended(dev); |
3710 |
++ } |
3711 |
+ |
3712 |
+ return retval; |
3713 |
+ } |
3714 |
+diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c |
3715 |
+index 17681d5638ac..f8b50eaf6d1e 100644 |
3716 |
+--- a/drivers/usb/core/usb.c |
3717 |
++++ b/drivers/usb/core/usb.c |
3718 |
+@@ -228,6 +228,8 @@ struct usb_host_interface *usb_find_alt_setting( |
3719 |
+ struct usb_interface_cache *intf_cache = NULL; |
3720 |
+ int i; |
3721 |
+ |
3722 |
++ if (!config) |
3723 |
++ return NULL; |
3724 |
+ for (i = 0; i < config->desc.bNumInterfaces; i++) { |
3725 |
+ if (config->intf_cache[i]->altsetting[0].desc.bInterfaceNumber |
3726 |
+ == iface_num) { |
3727 |
+diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c |
3728 |
+index f6b526606ad1..dbb482b7e0ba 100644 |
3729 |
+--- a/drivers/usb/musb/musb_dsps.c |
3730 |
++++ b/drivers/usb/musb/musb_dsps.c |
3731 |
+@@ -684,16 +684,6 @@ dsps_dma_controller_create(struct musb *musb, void __iomem *base) |
3732 |
+ return controller; |
3733 |
+ } |
3734 |
+ |
3735 |
+-static void dsps_dma_controller_destroy(struct dma_controller *c) |
3736 |
+-{ |
3737 |
+- struct musb *musb = c->musb; |
3738 |
+- struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); |
3739 |
+- void __iomem *usbss_base = glue->usbss_base; |
3740 |
+- |
3741 |
+- musb_writel(usbss_base, USBSS_IRQ_CLEARR, USBSS_IRQ_PD_COMP); |
3742 |
+- cppi41_dma_controller_destroy(c); |
3743 |
+-} |
3744 |
+- |
3745 |
+ #ifdef CONFIG_PM_SLEEP |
3746 |
+ static void dsps_dma_controller_suspend(struct dsps_glue *glue) |
3747 |
+ { |
3748 |
+@@ -723,7 +713,7 @@ static struct musb_platform_ops dsps_ops = { |
3749 |
+ |
3750 |
+ #ifdef CONFIG_USB_TI_CPPI41_DMA |
3751 |
+ .dma_init = dsps_dma_controller_create, |
3752 |
+- .dma_exit = dsps_dma_controller_destroy, |
3753 |
++ .dma_exit = cppi41_dma_controller_destroy, |
3754 |
+ #endif |
3755 |
+ .enable = dsps_musb_enable, |
3756 |
+ .disable = dsps_musb_disable, |
3757 |
+diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c |
3758 |
+index 3024b9b25360..75181d3afd95 100644 |
3759 |
+--- a/drivers/usb/serial/kobil_sct.c |
3760 |
++++ b/drivers/usb/serial/kobil_sct.c |
3761 |
+@@ -397,12 +397,20 @@ static int kobil_tiocmget(struct tty_struct *tty) |
3762 |
+ transfer_buffer_length, |
3763 |
+ KOBIL_TIMEOUT); |
3764 |
+ |
3765 |
+- dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n", |
3766 |
+- __func__, result, transfer_buffer[0]); |
3767 |
++ dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n", |
3768 |
++ result); |
3769 |
++ if (result < 1) { |
3770 |
++ if (result >= 0) |
3771 |
++ result = -EIO; |
3772 |
++ goto out_free; |
3773 |
++ } |
3774 |
++ |
3775 |
++ dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]); |
3776 |
+ |
3777 |
+ result = 0; |
3778 |
+ if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) |
3779 |
+ result = TIOCM_DSR; |
3780 |
++out_free: |
3781 |
+ kfree(transfer_buffer); |
3782 |
+ return result; |
3783 |
+ } |
3784 |
+diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c |
3785 |
+index 170f2c38de9b..5274aa7339b8 100644 |
3786 |
+--- a/drivers/usb/wusbcore/security.c |
3787 |
++++ b/drivers/usb/wusbcore/security.c |
3788 |
+@@ -230,7 +230,7 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, |
3789 |
+ |
3790 |
+ result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, |
3791 |
+ 0, secd, sizeof(*secd)); |
3792 |
+- if (result < sizeof(*secd)) { |
3793 |
++ if (result < (int)sizeof(*secd)) { |
3794 |
+ dev_err(dev, "Can't read security descriptor or " |
3795 |
+ "not enough data: %d\n", result); |
3796 |
+ goto out; |
3797 |
+diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c |
3798 |
+index 9a53912bdfe9..5d3ba747ae17 100644 |
3799 |
+--- a/drivers/uwb/hwa-rc.c |
3800 |
++++ b/drivers/uwb/hwa-rc.c |
3801 |
+@@ -873,6 +873,7 @@ error_get_version: |
3802 |
+ error_rc_add: |
3803 |
+ usb_put_intf(iface); |
3804 |
+ usb_put_dev(hwarc->usb_dev); |
3805 |
++ kfree(hwarc); |
3806 |
+ error_alloc: |
3807 |
+ uwb_rc_put(uwb_rc); |
3808 |
+ error_rc_alloc: |
3809 |
+diff --git a/fs/iomap.c b/fs/iomap.c |
3810 |
+index d4801f8dd4fd..8f7673a69273 100644 |
3811 |
+--- a/fs/iomap.c |
3812 |
++++ b/fs/iomap.c |
3813 |
+@@ -693,6 +693,7 @@ struct iomap_dio { |
3814 |
+ atomic_t ref; |
3815 |
+ unsigned flags; |
3816 |
+ int error; |
3817 |
++ bool wait_for_completion; |
3818 |
+ |
3819 |
+ union { |
3820 |
+ /* used during submission and for synchronous completion: */ |
3821 |
+@@ -793,9 +794,8 @@ static void iomap_dio_bio_end_io(struct bio *bio) |
3822 |
+ iomap_dio_set_error(dio, blk_status_to_errno(bio->bi_status)); |
3823 |
+ |
3824 |
+ if (atomic_dec_and_test(&dio->ref)) { |
3825 |
+- if (is_sync_kiocb(dio->iocb)) { |
3826 |
++ if (dio->wait_for_completion) { |
3827 |
+ struct task_struct *waiter = dio->submit.waiter; |
3828 |
+- |
3829 |
+ WRITE_ONCE(dio->submit.waiter, NULL); |
3830 |
+ wake_up_process(waiter); |
3831 |
+ } else if (dio->flags & IOMAP_DIO_WRITE) { |
3832 |
+@@ -980,13 +980,12 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, |
3833 |
+ dio->end_io = end_io; |
3834 |
+ dio->error = 0; |
3835 |
+ dio->flags = 0; |
3836 |
++ dio->wait_for_completion = is_sync_kiocb(iocb); |
3837 |
+ |
3838 |
+ dio->submit.iter = iter; |
3839 |
+- if (is_sync_kiocb(iocb)) { |
3840 |
+- dio->submit.waiter = current; |
3841 |
+- dio->submit.cookie = BLK_QC_T_NONE; |
3842 |
+- dio->submit.last_queue = NULL; |
3843 |
+- } |
3844 |
++ dio->submit.waiter = current; |
3845 |
++ dio->submit.cookie = BLK_QC_T_NONE; |
3846 |
++ dio->submit.last_queue = NULL; |
3847 |
+ |
3848 |
+ if (iov_iter_rw(iter) == READ) { |
3849 |
+ if (pos >= dio->i_size) |
3850 |
+@@ -1016,7 +1015,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, |
3851 |
+ WARN_ON_ONCE(ret); |
3852 |
+ ret = 0; |
3853 |
+ |
3854 |
+- if (iov_iter_rw(iter) == WRITE && !is_sync_kiocb(iocb) && |
3855 |
++ if (iov_iter_rw(iter) == WRITE && !dio->wait_for_completion && |
3856 |
+ !inode->i_sb->s_dio_done_wq) { |
3857 |
+ ret = sb_init_dio_done_wq(inode->i_sb); |
3858 |
+ if (ret < 0) |
3859 |
+@@ -1031,8 +1030,10 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, |
3860 |
+ iomap_dio_actor); |
3861 |
+ if (ret <= 0) { |
3862 |
+ /* magic error code to fall back to buffered I/O */ |
3863 |
+- if (ret == -ENOTBLK) |
3864 |
++ if (ret == -ENOTBLK) { |
3865 |
++ dio->wait_for_completion = true; |
3866 |
+ ret = 0; |
3867 |
++ } |
3868 |
+ break; |
3869 |
+ } |
3870 |
+ pos += ret; |
3871 |
+@@ -1046,7 +1047,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, |
3872 |
+ iomap_dio_set_error(dio, ret); |
3873 |
+ |
3874 |
+ if (!atomic_dec_and_test(&dio->ref)) { |
3875 |
+- if (!is_sync_kiocb(iocb)) |
3876 |
++ if (!dio->wait_for_completion) |
3877 |
+ return -EIOCBQUEUED; |
3878 |
+ |
3879 |
+ for (;;) { |
3880 |
+diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c |
3881 |
+index ed4edcd2bc56..a4994e25e19e 100644 |
3882 |
+--- a/fs/isofs/inode.c |
3883 |
++++ b/fs/isofs/inode.c |
3884 |
+@@ -24,6 +24,7 @@ |
3885 |
+ #include <linux/mpage.h> |
3886 |
+ #include <linux/user_namespace.h> |
3887 |
+ #include <linux/seq_file.h> |
3888 |
++#include <linux/blkdev.h> |
3889 |
+ |
3890 |
+ #include "isofs.h" |
3891 |
+ #include "zisofs.h" |
3892 |
+@@ -653,6 +654,12 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) |
3893 |
+ /* |
3894 |
+ * What if bugger tells us to go beyond page size? |
3895 |
+ */ |
3896 |
++ if (bdev_logical_block_size(s->s_bdev) > 2048) { |
3897 |
++ printk(KERN_WARNING |
3898 |
++ "ISOFS: unsupported/invalid hardware sector size %d\n", |
3899 |
++ bdev_logical_block_size(s->s_bdev)); |
3900 |
++ goto out_freesbi; |
3901 |
++ } |
3902 |
+ opt.blocksize = sb_min_blocksize(s, opt.blocksize); |
3903 |
+ |
3904 |
+ sbi->s_high_sierra = 0; /* default is iso9660 */ |
3905 |
+diff --git a/fs/locks.c b/fs/locks.c |
3906 |
+index 1bd71c4d663a..665e3ce9ab47 100644 |
3907 |
+--- a/fs/locks.c |
3908 |
++++ b/fs/locks.c |
3909 |
+@@ -2074,6 +2074,13 @@ static pid_t locks_translate_pid(struct file_lock *fl, struct pid_namespace *ns) |
3910 |
+ return -1; |
3911 |
+ if (IS_REMOTELCK(fl)) |
3912 |
+ return fl->fl_pid; |
3913 |
++ /* |
3914 |
++ * If the flock owner process is dead and its pid has been already |
3915 |
++ * freed, the translation below won't work, but we still want to show |
3916 |
++ * flock owner pid number in init pidns. |
3917 |
++ */ |
3918 |
++ if (ns == &init_pid_ns) |
3919 |
++ return (pid_t)fl->fl_pid; |
3920 |
+ |
3921 |
+ rcu_read_lock(); |
3922 |
+ pid = find_pid_ns(fl->fl_pid, &init_pid_ns); |
3923 |
+diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
3924 |
+index 5b6ff168d11a..6d16399a350e 100644 |
3925 |
+--- a/fs/nfsd/nfs4proc.c |
3926 |
++++ b/fs/nfsd/nfs4proc.c |
3927 |
+@@ -1725,6 +1725,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) |
3928 |
+ if (status) { |
3929 |
+ op = &args->ops[0]; |
3930 |
+ op->status = status; |
3931 |
++ resp->opcnt = 1; |
3932 |
+ goto encode_op; |
3933 |
+ } |
3934 |
+ |
3935 |
+diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c |
3936 |
+index d60900b615f9..efed50304b49 100644 |
3937 |
+--- a/fs/overlayfs/inode.c |
3938 |
++++ b/fs/overlayfs/inode.c |
3939 |
+@@ -14,6 +14,7 @@ |
3940 |
+ #include <linux/posix_acl.h> |
3941 |
+ #include <linux/ratelimit.h> |
3942 |
+ #include "overlayfs.h" |
3943 |
++#include "ovl_entry.h" |
3944 |
+ |
3945 |
+ int ovl_setattr(struct dentry *dentry, struct iattr *attr) |
3946 |
+ { |
3947 |
+@@ -608,39 +609,63 @@ static bool ovl_verify_inode(struct inode *inode, struct dentry *lowerdentry, |
3948 |
+ return true; |
3949 |
+ } |
3950 |
+ |
3951 |
++/* |
3952 |
++ * Does overlay inode need to be hashed by lower inode? |
3953 |
++ */ |
3954 |
++static bool ovl_hash_bylower(struct super_block *sb, struct dentry *upper, |
3955 |
++ struct dentry *lower, struct dentry *index) |
3956 |
++{ |
3957 |
++ struct ovl_fs *ofs = sb->s_fs_info; |
3958 |
++ |
3959 |
++ /* No, if pure upper */ |
3960 |
++ if (!lower) |
3961 |
++ return false; |
3962 |
++ |
3963 |
++ /* Yes, if already indexed */ |
3964 |
++ if (index) |
3965 |
++ return true; |
3966 |
++ |
3967 |
++ /* Yes, if won't be copied up */ |
3968 |
++ if (!ofs->upper_mnt) |
3969 |
++ return true; |
3970 |
++ |
3971 |
++ /* No, if lower hardlink is or will be broken on copy up */ |
3972 |
++ if ((upper || !ovl_indexdir(sb)) && |
3973 |
++ !d_is_dir(lower) && d_inode(lower)->i_nlink > 1) |
3974 |
++ return false; |
3975 |
++ |
3976 |
++ /* No, if non-indexed upper with NFS export */ |
3977 |
++ if (sb->s_export_op && upper) |
3978 |
++ return false; |
3979 |
++ |
3980 |
++ /* Otherwise, hash by lower inode for fsnotify */ |
3981 |
++ return true; |
3982 |
++} |
3983 |
++ |
3984 |
+ struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry, |
3985 |
+ struct dentry *index) |
3986 |
+ { |
3987 |
++ struct super_block *sb = dentry->d_sb; |
3988 |
+ struct dentry *lowerdentry = ovl_dentry_lower(dentry); |
3989 |
+ struct inode *realinode = upperdentry ? d_inode(upperdentry) : NULL; |
3990 |
+ struct inode *inode; |
3991 |
+- /* Already indexed or could be indexed on copy up? */ |
3992 |
+- bool indexed = (index || (ovl_indexdir(dentry->d_sb) && !upperdentry)); |
3993 |
+- struct dentry *origin = indexed ? lowerdentry : NULL; |
3994 |
++ bool bylower = ovl_hash_bylower(sb, upperdentry, lowerdentry, index); |
3995 |
+ bool is_dir; |
3996 |
+ |
3997 |
+- if (WARN_ON(upperdentry && indexed && !lowerdentry)) |
3998 |
+- return ERR_PTR(-EIO); |
3999 |
+- |
4000 |
+ if (!realinode) |
4001 |
+ realinode = d_inode(lowerdentry); |
4002 |
+ |
4003 |
+ /* |
4004 |
+- * Copy up origin (lower) may exist for non-indexed non-dir upper, but |
4005 |
+- * we must not use lower as hash key in that case. |
4006 |
+- * Hash non-dir that is or could be indexed by origin inode. |
4007 |
+- * Hash dir that is or could be merged by origin inode. |
4008 |
+- * Hash pure upper and non-indexed non-dir by upper inode. |
4009 |
++ * Copy up origin (lower) may exist for non-indexed upper, but we must |
4010 |
++ * not use lower as hash key if this is a broken hardlink. |
4011 |
+ */ |
4012 |
+ is_dir = S_ISDIR(realinode->i_mode); |
4013 |
+- if (is_dir) |
4014 |
+- origin = lowerdentry; |
4015 |
+- |
4016 |
+- if (upperdentry || origin) { |
4017 |
+- struct inode *key = d_inode(origin ?: upperdentry); |
4018 |
++ if (upperdentry || bylower) { |
4019 |
++ struct inode *key = d_inode(bylower ? lowerdentry : |
4020 |
++ upperdentry); |
4021 |
+ unsigned int nlink = is_dir ? 1 : realinode->i_nlink; |
4022 |
+ |
4023 |
+- inode = iget5_locked(dentry->d_sb, (unsigned long) key, |
4024 |
++ inode = iget5_locked(sb, (unsigned long) key, |
4025 |
+ ovl_inode_test, ovl_inode_set, key); |
4026 |
+ if (!inode) |
4027 |
+ goto out_nomem; |
4028 |
+@@ -664,7 +689,8 @@ struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry, |
4029 |
+ nlink = ovl_get_nlink(lowerdentry, upperdentry, nlink); |
4030 |
+ set_nlink(inode, nlink); |
4031 |
+ } else { |
4032 |
+- inode = new_inode(dentry->d_sb); |
4033 |
++ /* Lower hardlink that will be broken on copy up */ |
4034 |
++ inode = new_inode(sb); |
4035 |
+ if (!inode) |
4036 |
+ goto out_nomem; |
4037 |
+ } |
4038 |
+diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h |
4039 |
+index ca1d2cc2cdfa..18863d56273c 100644 |
4040 |
+--- a/include/linux/arm-smccc.h |
4041 |
++++ b/include/linux/arm-smccc.h |
4042 |
+@@ -199,47 +199,57 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, |
4043 |
+ |
4044 |
+ #define __declare_arg_0(a0, res) \ |
4045 |
+ struct arm_smccc_res *___res = res; \ |
4046 |
+- register u32 r0 asm("r0") = a0; \ |
4047 |
++ register unsigned long r0 asm("r0") = (u32)a0; \ |
4048 |
+ register unsigned long r1 asm("r1"); \ |
4049 |
+ register unsigned long r2 asm("r2"); \ |
4050 |
+ register unsigned long r3 asm("r3") |
4051 |
+ |
4052 |
+ #define __declare_arg_1(a0, a1, res) \ |
4053 |
++ typeof(a1) __a1 = a1; \ |
4054 |
+ struct arm_smccc_res *___res = res; \ |
4055 |
+- register u32 r0 asm("r0") = a0; \ |
4056 |
+- register typeof(a1) r1 asm("r1") = a1; \ |
4057 |
++ register unsigned long r0 asm("r0") = (u32)a0; \ |
4058 |
++ register unsigned long r1 asm("r1") = __a1; \ |
4059 |
+ register unsigned long r2 asm("r2"); \ |
4060 |
+ register unsigned long r3 asm("r3") |
4061 |
+ |
4062 |
+ #define __declare_arg_2(a0, a1, a2, res) \ |
4063 |
++ typeof(a1) __a1 = a1; \ |
4064 |
++ typeof(a2) __a2 = a2; \ |
4065 |
+ struct arm_smccc_res *___res = res; \ |
4066 |
+- register u32 r0 asm("r0") = a0; \ |
4067 |
+- register typeof(a1) r1 asm("r1") = a1; \ |
4068 |
+- register typeof(a2) r2 asm("r2") = a2; \ |
4069 |
++ register unsigned long r0 asm("r0") = (u32)a0; \ |
4070 |
++ register unsigned long r1 asm("r1") = __a1; \ |
4071 |
++ register unsigned long r2 asm("r2") = __a2; \ |
4072 |
+ register unsigned long r3 asm("r3") |
4073 |
+ |
4074 |
+ #define __declare_arg_3(a0, a1, a2, a3, res) \ |
4075 |
++ typeof(a1) __a1 = a1; \ |
4076 |
++ typeof(a2) __a2 = a2; \ |
4077 |
++ typeof(a3) __a3 = a3; \ |
4078 |
+ struct arm_smccc_res *___res = res; \ |
4079 |
+- register u32 r0 asm("r0") = a0; \ |
4080 |
+- register typeof(a1) r1 asm("r1") = a1; \ |
4081 |
+- register typeof(a2) r2 asm("r2") = a2; \ |
4082 |
+- register typeof(a3) r3 asm("r3") = a3 |
4083 |
++ register unsigned long r0 asm("r0") = (u32)a0; \ |
4084 |
++ register unsigned long r1 asm("r1") = __a1; \ |
4085 |
++ register unsigned long r2 asm("r2") = __a2; \ |
4086 |
++ register unsigned long r3 asm("r3") = __a3 |
4087 |
+ |
4088 |
+ #define __declare_arg_4(a0, a1, a2, a3, a4, res) \ |
4089 |
++ typeof(a4) __a4 = a4; \ |
4090 |
+ __declare_arg_3(a0, a1, a2, a3, res); \ |
4091 |
+- register typeof(a4) r4 asm("r4") = a4 |
4092 |
++ register unsigned long r4 asm("r4") = __a4 |
4093 |
+ |
4094 |
+ #define __declare_arg_5(a0, a1, a2, a3, a4, a5, res) \ |
4095 |
++ typeof(a5) __a5 = a5; \ |
4096 |
+ __declare_arg_4(a0, a1, a2, a3, a4, res); \ |
4097 |
+- register typeof(a5) r5 asm("r5") = a5 |
4098 |
++ register unsigned long r5 asm("r5") = __a5 |
4099 |
+ |
4100 |
+ #define __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res) \ |
4101 |
++ typeof(a6) __a6 = a6; \ |
4102 |
+ __declare_arg_5(a0, a1, a2, a3, a4, a5, res); \ |
4103 |
+- register typeof(a6) r6 asm("r6") = a6 |
4104 |
++ register unsigned long r6 asm("r6") = __a6 |
4105 |
+ |
4106 |
+ #define __declare_arg_7(a0, a1, a2, a3, a4, a5, a6, a7, res) \ |
4107 |
++ typeof(a7) __a7 = a7; \ |
4108 |
+ __declare_arg_6(a0, a1, a2, a3, a4, a5, a6, res); \ |
4109 |
+- register typeof(a7) r7 asm("r7") = a7 |
4110 |
++ register unsigned long r7 asm("r7") = __a7 |
4111 |
+ |
4112 |
+ #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__) |
4113 |
+ #define __declare_args(count, ...) ___declare_args(count, __VA_ARGS__) |
4114 |
+diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h |
4115 |
+index 9abc0ca7259b..9f0aa1b48c78 100644 |
4116 |
+--- a/include/linux/platform_data/ina2xx.h |
4117 |
++++ b/include/linux/platform_data/ina2xx.h |
4118 |
+@@ -1,7 +1,7 @@ |
4119 |
+ /* |
4120 |
+ * Driver for Texas Instruments INA219, INA226 power monitor chips |
4121 |
+ * |
4122 |
+- * Copyright (C) 2012 Lothar Felten <l-felten@××.com> |
4123 |
++ * Copyright (C) 2012 Lothar Felten <lothar.felten@×××××.com> |
4124 |
+ * |
4125 |
+ * This program is free software; you can redistribute it and/or modify |
4126 |
+ * it under the terms of the GNU General Public License version 2 as |
4127 |
+diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h |
4128 |
+index 672c4f32311e..437a539898ae 100644 |
4129 |
+--- a/include/linux/posix-timers.h |
4130 |
++++ b/include/linux/posix-timers.h |
4131 |
+@@ -82,8 +82,8 @@ struct k_itimer { |
4132 |
+ clockid_t it_clock; |
4133 |
+ timer_t it_id; |
4134 |
+ int it_active; |
4135 |
+- int it_overrun; |
4136 |
+- int it_overrun_last; |
4137 |
++ s64 it_overrun; |
4138 |
++ s64 it_overrun_last; |
4139 |
+ int it_requeue_pending; |
4140 |
+ int it_sigev_notify; |
4141 |
+ ktime_t it_interval; |
4142 |
+diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h |
4143 |
+index 79e90b3d3288..4617cf4f6c5b 100644 |
4144 |
+--- a/include/linux/power_supply.h |
4145 |
++++ b/include/linux/power_supply.h |
4146 |
+@@ -251,6 +251,7 @@ struct power_supply { |
4147 |
+ spinlock_t changed_lock; |
4148 |
+ bool changed; |
4149 |
+ bool initialized; |
4150 |
++ bool removing; |
4151 |
+ atomic_t use_cnt; |
4152 |
+ #ifdef CONFIG_THERMAL |
4153 |
+ struct thermal_zone_device *tzd; |
4154 |
+diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h |
4155 |
+index 2038ab531616..f8ced87a2efe 100644 |
4156 |
+--- a/include/linux/slub_def.h |
4157 |
++++ b/include/linux/slub_def.h |
4158 |
+@@ -88,7 +88,8 @@ struct kmem_cache { |
4159 |
+ int object_size; /* The size of an object without meta data */ |
4160 |
+ int offset; /* Free pointer offset. */ |
4161 |
+ #ifdef CONFIG_SLUB_CPU_PARTIAL |
4162 |
+- int cpu_partial; /* Number of per cpu partial objects to keep around */ |
4163 |
++ /* Number of per cpu partial objects to keep around */ |
4164 |
++ unsigned int cpu_partial; |
4165 |
+ #endif |
4166 |
+ struct kmem_cache_order_objects oo; |
4167 |
+ |
4168 |
+diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h |
4169 |
+index 62633e7d2630..0f22a5eda4cc 100644 |
4170 |
+--- a/include/media/v4l2-fh.h |
4171 |
++++ b/include/media/v4l2-fh.h |
4172 |
+@@ -37,10 +37,13 @@ struct v4l2_ctrl_handler; |
4173 |
+ * @prio: priority of the file handler, as defined by &enum v4l2_priority |
4174 |
+ * |
4175 |
+ * @wait: event' s wait queue |
4176 |
++ * @subscribe_lock: serialise changes to the subscribed list; guarantee that |
4177 |
++ * the add and del event callbacks are orderly called |
4178 |
+ * @subscribed: list of subscribed events |
4179 |
+ * @available: list of events waiting to be dequeued |
4180 |
+ * @navailable: number of available events at @available list |
4181 |
+ * @sequence: event sequence number |
4182 |
++ * |
4183 |
+ * @m2m_ctx: pointer to &struct v4l2_m2m_ctx |
4184 |
+ */ |
4185 |
+ struct v4l2_fh { |
4186 |
+@@ -51,6 +54,7 @@ struct v4l2_fh { |
4187 |
+ |
4188 |
+ /* Events */ |
4189 |
+ wait_queue_head_t wait; |
4190 |
++ struct mutex subscribe_lock; |
4191 |
+ struct list_head subscribed; |
4192 |
+ struct list_head available; |
4193 |
+ unsigned int navailable; |
4194 |
+diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c |
4195 |
+index 53a4787c08d8..20eaddfa691c 100644 |
4196 |
+--- a/kernel/bpf/sockmap.c |
4197 |
++++ b/kernel/bpf/sockmap.c |
4198 |
+@@ -313,12 +313,15 @@ out: |
4199 |
+ static void smap_write_space(struct sock *sk) |
4200 |
+ { |
4201 |
+ struct smap_psock *psock; |
4202 |
++ void (*write_space)(struct sock *sk); |
4203 |
+ |
4204 |
+ rcu_read_lock(); |
4205 |
+ psock = smap_psock_sk(sk); |
4206 |
+ if (likely(psock && test_bit(SMAP_TX_RUNNING, &psock->state))) |
4207 |
+ schedule_work(&psock->tx_work); |
4208 |
++ write_space = psock->save_write_space; |
4209 |
+ rcu_read_unlock(); |
4210 |
++ write_space(sk); |
4211 |
+ } |
4212 |
+ |
4213 |
+ static void smap_stop_sock(struct smap_psock *psock, struct sock *sk) |
4214 |
+diff --git a/kernel/module.c b/kernel/module.c |
4215 |
+index 321b0b1f87e7..2a44c515f0d7 100644 |
4216 |
+--- a/kernel/module.c |
4217 |
++++ b/kernel/module.c |
4218 |
+@@ -4058,7 +4058,7 @@ static unsigned long mod_find_symname(struct module *mod, const char *name) |
4219 |
+ |
4220 |
+ for (i = 0; i < kallsyms->num_symtab; i++) |
4221 |
+ if (strcmp(name, symname(kallsyms, i)) == 0 && |
4222 |
+- kallsyms->symtab[i].st_info != 'U') |
4223 |
++ kallsyms->symtab[i].st_shndx != SHN_UNDEF) |
4224 |
+ return kallsyms->symtab[i].st_value; |
4225 |
+ return 0; |
4226 |
+ } |
4227 |
+@@ -4104,6 +4104,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, |
4228 |
+ if (mod->state == MODULE_STATE_UNFORMED) |
4229 |
+ continue; |
4230 |
+ for (i = 0; i < kallsyms->num_symtab; i++) { |
4231 |
++ |
4232 |
++ if (kallsyms->symtab[i].st_shndx == SHN_UNDEF) |
4233 |
++ continue; |
4234 |
++ |
4235 |
+ ret = fn(data, symname(kallsyms, i), |
4236 |
+ mod, kallsyms->symtab[i].st_value); |
4237 |
+ if (ret != 0) |
4238 |
+diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c |
4239 |
+index 639321bf2e39..fa5de5e8de61 100644 |
4240 |
+--- a/kernel/time/alarmtimer.c |
4241 |
++++ b/kernel/time/alarmtimer.c |
4242 |
+@@ -581,11 +581,11 @@ static void alarm_timer_rearm(struct k_itimer *timr) |
4243 |
+ * @timr: Pointer to the posixtimer data struct |
4244 |
+ * @now: Current time to forward the timer against |
4245 |
+ */ |
4246 |
+-static int alarm_timer_forward(struct k_itimer *timr, ktime_t now) |
4247 |
++static s64 alarm_timer_forward(struct k_itimer *timr, ktime_t now) |
4248 |
+ { |
4249 |
+ struct alarm *alarm = &timr->it.alarm.alarmtimer; |
4250 |
+ |
4251 |
+- return (int) alarm_forward(alarm, timr->it_interval, now); |
4252 |
++ return alarm_forward(alarm, timr->it_interval, now); |
4253 |
+ } |
4254 |
+ |
4255 |
+ /** |
4256 |
+@@ -808,7 +808,8 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags, |
4257 |
+ /* Convert (if necessary) to absolute time */ |
4258 |
+ if (flags != TIMER_ABSTIME) { |
4259 |
+ ktime_t now = alarm_bases[type].gettime(); |
4260 |
+- exp = ktime_add(now, exp); |
4261 |
++ |
4262 |
++ exp = ktime_add_safe(now, exp); |
4263 |
+ } |
4264 |
+ |
4265 |
+ ret = alarmtimer_do_nsleep(&alarm, exp, type); |
4266 |
+diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c |
4267 |
+index 5b117110b55b..2da660d53a4b 100644 |
4268 |
+--- a/kernel/time/posix-cpu-timers.c |
4269 |
++++ b/kernel/time/posix-cpu-timers.c |
4270 |
+@@ -84,7 +84,7 @@ static void bump_cpu_timer(struct k_itimer *timer, u64 now) |
4271 |
+ continue; |
4272 |
+ |
4273 |
+ timer->it.cpu.expires += incr; |
4274 |
+- timer->it_overrun += 1 << i; |
4275 |
++ timer->it_overrun += 1LL << i; |
4276 |
+ delta -= incr; |
4277 |
+ } |
4278 |
+ } |
4279 |
+diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c |
4280 |
+index 708992708332..55d45fe2cc17 100644 |
4281 |
+--- a/kernel/time/posix-timers.c |
4282 |
++++ b/kernel/time/posix-timers.c |
4283 |
+@@ -283,6 +283,17 @@ static __init int init_posix_timers(void) |
4284 |
+ } |
4285 |
+ __initcall(init_posix_timers); |
4286 |
+ |
4287 |
++/* |
4288 |
++ * The siginfo si_overrun field and the return value of timer_getoverrun(2) |
4289 |
++ * are of type int. Clamp the overrun value to INT_MAX |
4290 |
++ */ |
4291 |
++static inline int timer_overrun_to_int(struct k_itimer *timr, int baseval) |
4292 |
++{ |
4293 |
++ s64 sum = timr->it_overrun_last + (s64)baseval; |
4294 |
++ |
4295 |
++ return sum > (s64)INT_MAX ? INT_MAX : (int)sum; |
4296 |
++} |
4297 |
++ |
4298 |
+ static void common_hrtimer_rearm(struct k_itimer *timr) |
4299 |
+ { |
4300 |
+ struct hrtimer *timer = &timr->it.real.timer; |
4301 |
+@@ -290,9 +301,8 @@ static void common_hrtimer_rearm(struct k_itimer *timr) |
4302 |
+ if (!timr->it_interval) |
4303 |
+ return; |
4304 |
+ |
4305 |
+- timr->it_overrun += (unsigned int) hrtimer_forward(timer, |
4306 |
+- timer->base->get_time(), |
4307 |
+- timr->it_interval); |
4308 |
++ timr->it_overrun += hrtimer_forward(timer, timer->base->get_time(), |
4309 |
++ timr->it_interval); |
4310 |
+ hrtimer_restart(timer); |
4311 |
+ } |
4312 |
+ |
4313 |
+@@ -321,10 +331,10 @@ void posixtimer_rearm(struct siginfo *info) |
4314 |
+ |
4315 |
+ timr->it_active = 1; |
4316 |
+ timr->it_overrun_last = timr->it_overrun; |
4317 |
+- timr->it_overrun = -1; |
4318 |
++ timr->it_overrun = -1LL; |
4319 |
+ ++timr->it_requeue_pending; |
4320 |
+ |
4321 |
+- info->si_overrun += timr->it_overrun_last; |
4322 |
++ info->si_overrun = timer_overrun_to_int(timr, info->si_overrun); |
4323 |
+ } |
4324 |
+ |
4325 |
+ unlock_timer(timr, flags); |
4326 |
+@@ -418,9 +428,8 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer) |
4327 |
+ now = ktime_add(now, kj); |
4328 |
+ } |
4329 |
+ #endif |
4330 |
+- timr->it_overrun += (unsigned int) |
4331 |
+- hrtimer_forward(timer, now, |
4332 |
+- timr->it_interval); |
4333 |
++ timr->it_overrun += hrtimer_forward(timer, now, |
4334 |
++ timr->it_interval); |
4335 |
+ ret = HRTIMER_RESTART; |
4336 |
+ ++timr->it_requeue_pending; |
4337 |
+ timr->it_active = 1; |
4338 |
+@@ -524,7 +533,7 @@ static int do_timer_create(clockid_t which_clock, struct sigevent *event, |
4339 |
+ new_timer->it_id = (timer_t) new_timer_id; |
4340 |
+ new_timer->it_clock = which_clock; |
4341 |
+ new_timer->kclock = kc; |
4342 |
+- new_timer->it_overrun = -1; |
4343 |
++ new_timer->it_overrun = -1LL; |
4344 |
+ |
4345 |
+ if (event) { |
4346 |
+ rcu_read_lock(); |
4347 |
+@@ -645,11 +654,11 @@ static ktime_t common_hrtimer_remaining(struct k_itimer *timr, ktime_t now) |
4348 |
+ return __hrtimer_expires_remaining_adjusted(timer, now); |
4349 |
+ } |
4350 |
+ |
4351 |
+-static int common_hrtimer_forward(struct k_itimer *timr, ktime_t now) |
4352 |
++static s64 common_hrtimer_forward(struct k_itimer *timr, ktime_t now) |
4353 |
+ { |
4354 |
+ struct hrtimer *timer = &timr->it.real.timer; |
4355 |
+ |
4356 |
+- return (int)hrtimer_forward(timer, now, timr->it_interval); |
4357 |
++ return hrtimer_forward(timer, now, timr->it_interval); |
4358 |
+ } |
4359 |
+ |
4360 |
+ /* |
4361 |
+@@ -789,7 +798,7 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id) |
4362 |
+ if (!timr) |
4363 |
+ return -EINVAL; |
4364 |
+ |
4365 |
+- overrun = timr->it_overrun_last; |
4366 |
++ overrun = timer_overrun_to_int(timr, 0); |
4367 |
+ unlock_timer(timr, flags); |
4368 |
+ |
4369 |
+ return overrun; |
4370 |
+diff --git a/kernel/time/posix-timers.h b/kernel/time/posix-timers.h |
4371 |
+index 151e28f5bf30..ddb21145211a 100644 |
4372 |
+--- a/kernel/time/posix-timers.h |
4373 |
++++ b/kernel/time/posix-timers.h |
4374 |
+@@ -19,7 +19,7 @@ struct k_clock { |
4375 |
+ void (*timer_get)(struct k_itimer *timr, |
4376 |
+ struct itimerspec64 *cur_setting); |
4377 |
+ void (*timer_rearm)(struct k_itimer *timr); |
4378 |
+- int (*timer_forward)(struct k_itimer *timr, ktime_t now); |
4379 |
++ s64 (*timer_forward)(struct k_itimer *timr, ktime_t now); |
4380 |
+ ktime_t (*timer_remaining)(struct k_itimer *timr, ktime_t now); |
4381 |
+ int (*timer_try_to_cancel)(struct k_itimer *timr); |
4382 |
+ void (*timer_arm)(struct k_itimer *timr, ktime_t expires, |
4383 |
+diff --git a/lib/klist.c b/lib/klist.c |
4384 |
+index 0507fa5d84c5..f6b547812fe3 100644 |
4385 |
+--- a/lib/klist.c |
4386 |
++++ b/lib/klist.c |
4387 |
+@@ -336,8 +336,9 @@ struct klist_node *klist_prev(struct klist_iter *i) |
4388 |
+ void (*put)(struct klist_node *) = i->i_klist->put; |
4389 |
+ struct klist_node *last = i->i_cur; |
4390 |
+ struct klist_node *prev; |
4391 |
++ unsigned long flags; |
4392 |
+ |
4393 |
+- spin_lock(&i->i_klist->k_lock); |
4394 |
++ spin_lock_irqsave(&i->i_klist->k_lock, flags); |
4395 |
+ |
4396 |
+ if (last) { |
4397 |
+ prev = to_klist_node(last->n_node.prev); |
4398 |
+@@ -356,7 +357,7 @@ struct klist_node *klist_prev(struct klist_iter *i) |
4399 |
+ prev = to_klist_node(prev->n_node.prev); |
4400 |
+ } |
4401 |
+ |
4402 |
+- spin_unlock(&i->i_klist->k_lock); |
4403 |
++ spin_unlock_irqrestore(&i->i_klist->k_lock, flags); |
4404 |
+ |
4405 |
+ if (put && last) |
4406 |
+ put(last); |
4407 |
+@@ -377,8 +378,9 @@ struct klist_node *klist_next(struct klist_iter *i) |
4408 |
+ void (*put)(struct klist_node *) = i->i_klist->put; |
4409 |
+ struct klist_node *last = i->i_cur; |
4410 |
+ struct klist_node *next; |
4411 |
++ unsigned long flags; |
4412 |
+ |
4413 |
+- spin_lock(&i->i_klist->k_lock); |
4414 |
++ spin_lock_irqsave(&i->i_klist->k_lock, flags); |
4415 |
+ |
4416 |
+ if (last) { |
4417 |
+ next = to_klist_node(last->n_node.next); |
4418 |
+@@ -397,7 +399,7 @@ struct klist_node *klist_next(struct klist_iter *i) |
4419 |
+ next = to_klist_node(next->n_node.next); |
4420 |
+ } |
4421 |
+ |
4422 |
+- spin_unlock(&i->i_klist->k_lock); |
4423 |
++ spin_unlock_irqrestore(&i->i_klist->k_lock, flags); |
4424 |
+ |
4425 |
+ if (put && last) |
4426 |
+ put(last); |
4427 |
+diff --git a/mm/slub.c b/mm/slub.c |
4428 |
+index 10e54c4acd19..220d42e592ef 100644 |
4429 |
+--- a/mm/slub.c |
4430 |
++++ b/mm/slub.c |
4431 |
+@@ -1807,7 +1807,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, |
4432 |
+ { |
4433 |
+ struct page *page, *page2; |
4434 |
+ void *object = NULL; |
4435 |
+- int available = 0; |
4436 |
++ unsigned int available = 0; |
4437 |
+ int objects; |
4438 |
+ |
4439 |
+ /* |
4440 |
+@@ -4942,10 +4942,10 @@ static ssize_t cpu_partial_show(struct kmem_cache *s, char *buf) |
4441 |
+ static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf, |
4442 |
+ size_t length) |
4443 |
+ { |
4444 |
+- unsigned long objects; |
4445 |
++ unsigned int objects; |
4446 |
+ int err; |
4447 |
+ |
4448 |
+- err = kstrtoul(buf, 10, &objects); |
4449 |
++ err = kstrtouint(buf, 10, &objects); |
4450 |
+ if (err) |
4451 |
+ return err; |
4452 |
+ if (objects && !kmem_cache_has_cpu_partial(s)) |
4453 |
+diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c |
4454 |
+index 6b1042e21656..52fad5dad9f7 100644 |
4455 |
+--- a/net/6lowpan/iphc.c |
4456 |
++++ b/net/6lowpan/iphc.c |
4457 |
+@@ -770,6 +770,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev, |
4458 |
+ hdr.hop_limit, &hdr.daddr); |
4459 |
+ |
4460 |
+ skb_push(skb, sizeof(hdr)); |
4461 |
++ skb_reset_mac_header(skb); |
4462 |
+ skb_reset_network_header(skb); |
4463 |
+ skb_copy_to_linear_data(skb, &hdr, sizeof(hdr)); |
4464 |
+ |
4465 |
+diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c |
4466 |
+index efa2cdba99d3..4f2971f528db 100644 |
4467 |
+--- a/net/tls/tls_main.c |
4468 |
++++ b/net/tls/tls_main.c |
4469 |
+@@ -195,9 +195,14 @@ static void tls_write_space(struct sock *sk) |
4470 |
+ { |
4471 |
+ struct tls_context *ctx = tls_get_ctx(sk); |
4472 |
+ |
4473 |
+- /* We are already sending pages, ignore notification */ |
4474 |
+- if (ctx->in_tcp_sendpages) |
4475 |
++ /* If in_tcp_sendpages call lower protocol write space handler |
4476 |
++ * to ensure we wake up any waiting operations there. For example |
4477 |
++ * if do_tcp_sendpages where to call sk_wait_event. |
4478 |
++ */ |
4479 |
++ if (ctx->in_tcp_sendpages) { |
4480 |
++ ctx->sk_write_space(sk); |
4481 |
+ return; |
4482 |
++ } |
4483 |
+ |
4484 |
+ if (!sk->sk_write_pending && tls_is_pending_closed_record(ctx)) { |
4485 |
+ gfp_t sk_allocation = sk->sk_allocation; |
4486 |
+diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c |
4487 |
+index 71960089e207..65557421fe0b 100644 |
4488 |
+--- a/sound/aoa/core/gpio-feature.c |
4489 |
++++ b/sound/aoa/core/gpio-feature.c |
4490 |
+@@ -88,8 +88,10 @@ static struct device_node *get_gpio(char *name, |
4491 |
+ } |
4492 |
+ |
4493 |
+ reg = of_get_property(np, "reg", NULL); |
4494 |
+- if (!reg) |
4495 |
++ if (!reg) { |
4496 |
++ of_node_put(np); |
4497 |
+ return NULL; |
4498 |
++ } |
4499 |
+ |
4500 |
+ *gpioptr = *reg; |
4501 |
+ |
4502 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
4503 |
+index 22c13ad6a9ae..873d9824fbcf 100644 |
4504 |
+--- a/sound/pci/hda/hda_intel.c |
4505 |
++++ b/sound/pci/hda/hda_intel.c |
4506 |
+@@ -2510,7 +2510,8 @@ static const struct pci_device_id azx_ids[] = { |
4507 |
+ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, |
4508 |
+ /* AMD Raven */ |
4509 |
+ { PCI_DEVICE(0x1022, 0x15e3), |
4510 |
+- .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, |
4511 |
++ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | |
4512 |
++ AZX_DCAPS_PM_RUNTIME }, |
4513 |
+ /* ATI HDMI */ |
4514 |
+ { PCI_DEVICE(0x1002, 0x0002), |
4515 |
+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
4516 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
4517 |
+index 1c9f6a0d234f..53c9d7525639 100644 |
4518 |
+--- a/sound/soc/soc-dapm.c |
4519 |
++++ b/sound/soc/soc-dapm.c |
4520 |
+@@ -4005,6 +4005,13 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) |
4521 |
+ continue; |
4522 |
+ } |
4523 |
+ |
4524 |
++ /* let users know there is no DAI to link */ |
4525 |
++ if (!dai_w->priv) { |
4526 |
++ dev_dbg(card->dev, "dai widget %s has no DAI\n", |
4527 |
++ dai_w->name); |
4528 |
++ continue; |
4529 |
++ } |
4530 |
++ |
4531 |
+ dai = dai_w->priv; |
4532 |
+ |
4533 |
+ /* ...find all widgets with the same stream and link them */ |