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