Annotation of /trunk/kernel-alx/patches-5.4/0153-5.4.54-all-fixes.patch
Parent Directory | Revision Log
Revision 3551 -
(hide annotations)
(download)
Thu Jul 30 10:54:59 2020 UTC (4 years, 1 month ago) by niro
File size: 154325 byte(s)
Thu Jul 30 10:54:59 2020 UTC (4 years, 1 month ago) by niro
File size: 154325 byte(s)
-linux-5.4.54
1 | niro | 3551 | diff --git a/Makefile b/Makefile |
2 | index d33b312a14e3..ea711f30de29 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,7 +1,7 @@ | ||
6 | # SPDX-License-Identifier: GPL-2.0 | ||
7 | VERSION = 5 | ||
8 | PATCHLEVEL = 4 | ||
9 | -SUBLEVEL = 53 | ||
10 | +SUBLEVEL = 54 | ||
11 | EXTRAVERSION = | ||
12 | NAME = Kleptomaniac Octopus | ||
13 | |||
14 | @@ -528,7 +528,7 @@ ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) | ||
15 | ifneq ($(CROSS_COMPILE),) | ||
16 | CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) | ||
17 | GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) | ||
18 | -CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) | ||
19 | +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) | ||
20 | GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) | ||
21 | endif | ||
22 | ifneq ($(GCC_TOOLCHAIN),) | ||
23 | diff --git a/arch/arm/boot/dts/imx6qdl-gw551x.dtsi b/arch/arm/boot/dts/imx6qdl-gw551x.dtsi | ||
24 | index c23ba229fd05..8c33510c9519 100644 | ||
25 | --- a/arch/arm/boot/dts/imx6qdl-gw551x.dtsi | ||
26 | +++ b/arch/arm/boot/dts/imx6qdl-gw551x.dtsi | ||
27 | @@ -105,19 +105,16 @@ | ||
28 | sound-digital { | ||
29 | compatible = "simple-audio-card"; | ||
30 | simple-audio-card,name = "tda1997x-audio"; | ||
31 | + simple-audio-card,format = "i2s"; | ||
32 | + simple-audio-card,bitclock-master = <&sound_codec>; | ||
33 | + simple-audio-card,frame-master = <&sound_codec>; | ||
34 | |||
35 | - simple-audio-card,dai-link@0 { | ||
36 | - format = "i2s"; | ||
37 | - | ||
38 | - cpu { | ||
39 | - sound-dai = <&ssi2>; | ||
40 | - }; | ||
41 | + sound_cpu: simple-audio-card,cpu { | ||
42 | + sound-dai = <&ssi1>; | ||
43 | + }; | ||
44 | |||
45 | - codec { | ||
46 | - bitclock-master; | ||
47 | - frame-master; | ||
48 | - sound-dai = <&hdmi_receiver>; | ||
49 | - }; | ||
50 | + sound_codec: simple-audio-card,codec { | ||
51 | + sound-dai = <&hdmi_receiver>; | ||
52 | }; | ||
53 | }; | ||
54 | }; | ||
55 | diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts | ||
56 | index 7f2ddb78da5f..4227da71cc62 100644 | ||
57 | --- a/arch/arm/boot/dts/omap3-n900.dts | ||
58 | +++ b/arch/arm/boot/dts/omap3-n900.dts | ||
59 | @@ -105,6 +105,14 @@ | ||
60 | linux,code = <SW_FRONT_PROXIMITY>; | ||
61 | linux,can-disable; | ||
62 | }; | ||
63 | + | ||
64 | + machine_cover { | ||
65 | + label = "Machine Cover"; | ||
66 | + gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* 160 */ | ||
67 | + linux,input-type = <EV_SW>; | ||
68 | + linux,code = <SW_MACHINE_COVER>; | ||
69 | + linux,can-disable; | ||
70 | + }; | ||
71 | }; | ||
72 | |||
73 | isp1707: isp1707 { | ||
74 | @@ -814,10 +822,6 @@ | ||
75 | pinctrl-0 = <&mmc1_pins>; | ||
76 | vmmc-supply = <&vmmc1>; | ||
77 | bus-width = <4>; | ||
78 | - /* For debugging, it is often good idea to remove this GPIO. | ||
79 | - It means you can remove back cover (to reboot by removing | ||
80 | - battery) and still use the MMC card. */ | ||
81 | - cd-gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* 160 */ | ||
82 | }; | ||
83 | |||
84 | /* most boards use vaux3, only some old versions use vmmc2 instead */ | ||
85 | diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c | ||
86 | index 7569deb1eac1..d64a3c1e1b6b 100644 | ||
87 | --- a/arch/arm64/kernel/debug-monitors.c | ||
88 | +++ b/arch/arm64/kernel/debug-monitors.c | ||
89 | @@ -396,14 +396,14 @@ void user_rewind_single_step(struct task_struct *task) | ||
90 | * If single step is active for this thread, then set SPSR.SS | ||
91 | * to 1 to avoid returning to the active-pending state. | ||
92 | */ | ||
93 | - if (test_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP)) | ||
94 | + if (test_tsk_thread_flag(task, TIF_SINGLESTEP)) | ||
95 | set_regs_spsr_ss(task_pt_regs(task)); | ||
96 | } | ||
97 | NOKPROBE_SYMBOL(user_rewind_single_step); | ||
98 | |||
99 | void user_fastforward_single_step(struct task_struct *task) | ||
100 | { | ||
101 | - if (test_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP)) | ||
102 | + if (test_tsk_thread_flag(task, TIF_SINGLESTEP)) | ||
103 | clear_regs_spsr_ss(task_pt_regs(task)); | ||
104 | } | ||
105 | |||
106 | diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c | ||
107 | index 30017d5945bc..6ce76b18186e 100644 | ||
108 | --- a/arch/mips/pci/pci-xtalk-bridge.c | ||
109 | +++ b/arch/mips/pci/pci-xtalk-bridge.c | ||
110 | @@ -444,9 +444,10 @@ static int bridge_probe(struct platform_device *pdev) | ||
111 | return -ENOMEM; | ||
112 | domain = irq_domain_create_hierarchy(parent, 0, 8, fn, | ||
113 | &bridge_domain_ops, NULL); | ||
114 | - irq_domain_free_fwnode(fn); | ||
115 | - if (!domain) | ||
116 | + if (!domain) { | ||
117 | + irq_domain_free_fwnode(fn); | ||
118 | return -ENOMEM; | ||
119 | + } | ||
120 | |||
121 | pci_set_flags(PCI_PROBE_ONLY); | ||
122 | |||
123 | diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h | ||
124 | index 118953d41763..6dd4171c9530 100644 | ||
125 | --- a/arch/parisc/include/asm/atomic.h | ||
126 | +++ b/arch/parisc/include/asm/atomic.h | ||
127 | @@ -212,6 +212,8 @@ atomic64_set(atomic64_t *v, s64 i) | ||
128 | _atomic_spin_unlock_irqrestore(v, flags); | ||
129 | } | ||
130 | |||
131 | +#define atomic64_set_release(v, i) atomic64_set((v), (i)) | ||
132 | + | ||
133 | static __inline__ s64 | ||
134 | atomic64_read(const atomic64_t *v) | ||
135 | { | ||
136 | diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h | ||
137 | index 3f1737f301cc..d0e24aaa2aa0 100644 | ||
138 | --- a/arch/riscv/include/asm/barrier.h | ||
139 | +++ b/arch/riscv/include/asm/barrier.h | ||
140 | @@ -58,8 +58,16 @@ do { \ | ||
141 | * The AQ/RL pair provides a RCpc critical section, but there's not really any | ||
142 | * way we can take advantage of that here because the ordering is only enforced | ||
143 | * on that one lock. Thus, we're just doing a full fence. | ||
144 | + * | ||
145 | + * Since we allow writeX to be called from preemptive regions we need at least | ||
146 | + * an "o" in the predecessor set to ensure device writes are visible before the | ||
147 | + * task is marked as available for scheduling on a new hart. While I don't see | ||
148 | + * any concrete reason we need a full IO fence, it seems safer to just upgrade | ||
149 | + * this in order to avoid any IO crossing a scheduling boundary. In both | ||
150 | + * instances the scheduler pairs this with an mb(), so nothing is necessary on | ||
151 | + * the new hart. | ||
152 | */ | ||
153 | -#define smp_mb__after_spinlock() RISCV_FENCE(rw,rw) | ||
154 | +#define smp_mb__after_spinlock() RISCV_FENCE(iorw,iorw) | ||
155 | |||
156 | #include <asm-generic/barrier.h> | ||
157 | |||
158 | diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c | ||
159 | index f0262cb5657a..16699101fd2f 100644 | ||
160 | --- a/arch/x86/kernel/apic/io_apic.c | ||
161 | +++ b/arch/x86/kernel/apic/io_apic.c | ||
162 | @@ -2329,12 +2329,12 @@ static int mp_irqdomain_create(int ioapic) | ||
163 | ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops, | ||
164 | (void *)(long)ioapic); | ||
165 | |||
166 | - /* Release fw handle if it was allocated above */ | ||
167 | - if (!cfg->dev) | ||
168 | - irq_domain_free_fwnode(fn); | ||
169 | - | ||
170 | - if (!ip->irqdomain) | ||
171 | + if (!ip->irqdomain) { | ||
172 | + /* Release fw handle if it was allocated above */ | ||
173 | + if (!cfg->dev) | ||
174 | + irq_domain_free_fwnode(fn); | ||
175 | return -ENOMEM; | ||
176 | + } | ||
177 | |||
178 | ip->irqdomain->parent = parent; | ||
179 | |||
180 | diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c | ||
181 | index 159bd0cb8548..a20873bbbed6 100644 | ||
182 | --- a/arch/x86/kernel/apic/msi.c | ||
183 | +++ b/arch/x86/kernel/apic/msi.c | ||
184 | @@ -262,12 +262,13 @@ void __init arch_init_msi_domain(struct irq_domain *parent) | ||
185 | msi_default_domain = | ||
186 | pci_msi_create_irq_domain(fn, &pci_msi_domain_info, | ||
187 | parent); | ||
188 | - irq_domain_free_fwnode(fn); | ||
189 | } | ||
190 | - if (!msi_default_domain) | ||
191 | + if (!msi_default_domain) { | ||
192 | + irq_domain_free_fwnode(fn); | ||
193 | pr_warn("failed to initialize irqdomain for MSI/MSI-x.\n"); | ||
194 | - else | ||
195 | + } else { | ||
196 | msi_default_domain->flags |= IRQ_DOMAIN_MSI_NOMASK_QUIRK; | ||
197 | + } | ||
198 | } | ||
199 | |||
200 | #ifdef CONFIG_IRQ_REMAP | ||
201 | @@ -300,7 +301,8 @@ struct irq_domain *arch_create_remap_msi_irq_domain(struct irq_domain *parent, | ||
202 | if (!fn) | ||
203 | return NULL; | ||
204 | d = pci_msi_create_irq_domain(fn, &pci_msi_ir_domain_info, parent); | ||
205 | - irq_domain_free_fwnode(fn); | ||
206 | + if (!d) | ||
207 | + irq_domain_free_fwnode(fn); | ||
208 | return d; | ||
209 | } | ||
210 | #endif | ||
211 | @@ -363,7 +365,8 @@ static struct irq_domain *dmar_get_irq_domain(void) | ||
212 | if (fn) { | ||
213 | dmar_domain = msi_create_irq_domain(fn, &dmar_msi_domain_info, | ||
214 | x86_vector_domain); | ||
215 | - irq_domain_free_fwnode(fn); | ||
216 | + if (!dmar_domain) | ||
217 | + irq_domain_free_fwnode(fn); | ||
218 | } | ||
219 | out: | ||
220 | mutex_unlock(&dmar_lock); | ||
221 | @@ -488,7 +491,10 @@ struct irq_domain *hpet_create_irq_domain(int hpet_id) | ||
222 | } | ||
223 | |||
224 | d = msi_create_irq_domain(fn, domain_info, parent); | ||
225 | - irq_domain_free_fwnode(fn); | ||
226 | + if (!d) { | ||
227 | + irq_domain_free_fwnode(fn); | ||
228 | + kfree(domain_info); | ||
229 | + } | ||
230 | return d; | ||
231 | } | ||
232 | |||
233 | diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c | ||
234 | index 18c0dca08163..df4d5385e6dd 100644 | ||
235 | --- a/arch/x86/kernel/apic/vector.c | ||
236 | +++ b/arch/x86/kernel/apic/vector.c | ||
237 | @@ -701,7 +701,6 @@ int __init arch_early_irq_init(void) | ||
238 | x86_vector_domain = irq_domain_create_tree(fn, &x86_vector_domain_ops, | ||
239 | NULL); | ||
240 | BUG_ON(x86_vector_domain == NULL); | ||
241 | - irq_domain_free_fwnode(fn); | ||
242 | irq_set_default_host(x86_vector_domain); | ||
243 | |||
244 | arch_init_msi_domain(x86_vector_domain); | ||
245 | diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S | ||
246 | index bac1a65a9d39..1afe211d7a7c 100644 | ||
247 | --- a/arch/x86/kernel/vmlinux.lds.S | ||
248 | +++ b/arch/x86/kernel/vmlinux.lds.S | ||
249 | @@ -362,6 +362,7 @@ SECTIONS | ||
250 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | ||
251 | __bss_start = .; | ||
252 | *(.bss..page_aligned) | ||
253 | + . = ALIGN(PAGE_SIZE); | ||
254 | *(BSS_MAIN) | ||
255 | BSS_DECRYPTED | ||
256 | . = ALIGN(PAGE_SIZE); | ||
257 | diff --git a/arch/x86/math-emu/wm_sqrt.S b/arch/x86/math-emu/wm_sqrt.S | ||
258 | index f031c0e19356..515cdee90df7 100644 | ||
259 | --- a/arch/x86/math-emu/wm_sqrt.S | ||
260 | +++ b/arch/x86/math-emu/wm_sqrt.S | ||
261 | @@ -209,7 +209,7 @@ sqrt_stage_2_finish: | ||
262 | |||
263 | #ifdef PARANOID | ||
264 | /* It should be possible to get here only if the arg is ffff....ffff */ | ||
265 | - cmp $0xffffffff,FPU_fsqrt_arg_1 | ||
266 | + cmpl $0xffffffff,FPU_fsqrt_arg_1 | ||
267 | jnz sqrt_stage_2_error | ||
268 | #endif /* PARANOID */ | ||
269 | |||
270 | diff --git a/arch/x86/platform/uv/uv_irq.c b/arch/x86/platform/uv/uv_irq.c | ||
271 | index fc13cbbb2dce..abb6075397f0 100644 | ||
272 | --- a/arch/x86/platform/uv/uv_irq.c | ||
273 | +++ b/arch/x86/platform/uv/uv_irq.c | ||
274 | @@ -167,9 +167,10 @@ static struct irq_domain *uv_get_irq_domain(void) | ||
275 | goto out; | ||
276 | |||
277 | uv_domain = irq_domain_create_tree(fn, &uv_domain_ops, NULL); | ||
278 | - irq_domain_free_fwnode(fn); | ||
279 | if (uv_domain) | ||
280 | uv_domain->parent = x86_vector_domain; | ||
281 | + else | ||
282 | + irq_domain_free_fwnode(fn); | ||
283 | out: | ||
284 | mutex_unlock(&uv_lock); | ||
285 | |||
286 | diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c | ||
287 | index e0e1e1892b86..d08172138369 100644 | ||
288 | --- a/arch/xtensa/kernel/setup.c | ||
289 | +++ b/arch/xtensa/kernel/setup.c | ||
290 | @@ -716,7 +716,8 @@ c_start(struct seq_file *f, loff_t *pos) | ||
291 | static void * | ||
292 | c_next(struct seq_file *f, void *v, loff_t *pos) | ||
293 | { | ||
294 | - return NULL; | ||
295 | + ++*pos; | ||
296 | + return c_start(f, pos); | ||
297 | } | ||
298 | |||
299 | static void | ||
300 | diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c | ||
301 | index 4092555828b1..24cf6972eace 100644 | ||
302 | --- a/arch/xtensa/kernel/xtensa_ksyms.c | ||
303 | +++ b/arch/xtensa/kernel/xtensa_ksyms.c | ||
304 | @@ -87,13 +87,13 @@ void __xtensa_libgcc_window_spill(void) | ||
305 | } | ||
306 | EXPORT_SYMBOL(__xtensa_libgcc_window_spill); | ||
307 | |||
308 | -unsigned long __sync_fetch_and_and_4(unsigned long *p, unsigned long v) | ||
309 | +unsigned int __sync_fetch_and_and_4(volatile void *p, unsigned int v) | ||
310 | { | ||
311 | BUG(); | ||
312 | } | ||
313 | EXPORT_SYMBOL(__sync_fetch_and_and_4); | ||
314 | |||
315 | -unsigned long __sync_fetch_and_or_4(unsigned long *p, unsigned long v) | ||
316 | +unsigned int __sync_fetch_and_or_4(volatile void *p, unsigned int v) | ||
317 | { | ||
318 | BUG(); | ||
319 | } | ||
320 | diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c | ||
321 | index 7067d5542a82..2048ba6c8b08 100644 | ||
322 | --- a/drivers/android/binder_alloc.c | ||
323 | +++ b/drivers/android/binder_alloc.c | ||
324 | @@ -948,7 +948,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item, | ||
325 | trace_binder_unmap_user_end(alloc, index); | ||
326 | } | ||
327 | up_read(&mm->mmap_sem); | ||
328 | - mmput(mm); | ||
329 | + mmput_async(mm); | ||
330 | |||
331 | trace_binder_unmap_kernel_start(alloc, index); | ||
332 | |||
333 | diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c | ||
334 | index 320d23de02c2..927ebde1607b 100644 | ||
335 | --- a/drivers/base/regmap/regmap.c | ||
336 | +++ b/drivers/base/regmap/regmap.c | ||
337 | @@ -1363,7 +1363,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data) | ||
338 | |||
339 | /* If the user didn't specify a name match any */ | ||
340 | if (data) | ||
341 | - return (*r)->name == data; | ||
342 | + return !strcmp((*r)->name, data); | ||
343 | else | ||
344 | return 1; | ||
345 | } | ||
346 | diff --git a/drivers/char/mem.c b/drivers/char/mem.c | ||
347 | index 31cae88a730b..6b56bff9b68c 100644 | ||
348 | --- a/drivers/char/mem.c | ||
349 | +++ b/drivers/char/mem.c | ||
350 | @@ -814,7 +814,8 @@ static struct inode *devmem_inode; | ||
351 | #ifdef CONFIG_IO_STRICT_DEVMEM | ||
352 | void revoke_devmem(struct resource *res) | ||
353 | { | ||
354 | - struct inode *inode = READ_ONCE(devmem_inode); | ||
355 | + /* pairs with smp_store_release() in devmem_init_inode() */ | ||
356 | + struct inode *inode = smp_load_acquire(&devmem_inode); | ||
357 | |||
358 | /* | ||
359 | * Check that the initialization has completed. Losing the race | ||
360 | @@ -1028,8 +1029,11 @@ static int devmem_init_inode(void) | ||
361 | return rc; | ||
362 | } | ||
363 | |||
364 | - /* publish /dev/mem initialized */ | ||
365 | - WRITE_ONCE(devmem_inode, inode); | ||
366 | + /* | ||
367 | + * Publish /dev/mem initialized. | ||
368 | + * Pairs with smp_load_acquire() in revoke_devmem(). | ||
369 | + */ | ||
370 | + smp_store_release(&devmem_inode, inode); | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c | ||
375 | index cf65a47310c3..eba7e3fe769c 100644 | ||
376 | --- a/drivers/dma-buf/dma-buf.c | ||
377 | +++ b/drivers/dma-buf/dma-buf.c | ||
378 | @@ -45,10 +45,10 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) | ||
379 | size_t ret = 0; | ||
380 | |||
381 | dmabuf = dentry->d_fsdata; | ||
382 | - mutex_lock(&dmabuf->lock); | ||
383 | + spin_lock(&dmabuf->name_lock); | ||
384 | if (dmabuf->name) | ||
385 | ret = strlcpy(name, dmabuf->name, DMA_BUF_NAME_LEN); | ||
386 | - mutex_unlock(&dmabuf->lock); | ||
387 | + spin_unlock(&dmabuf->name_lock); | ||
388 | |||
389 | return dynamic_dname(dentry, buffer, buflen, "/%s:%s", | ||
390 | dentry->d_name.name, ret > 0 ? name : ""); | ||
391 | @@ -338,8 +338,10 @@ static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf) | ||
392 | kfree(name); | ||
393 | goto out_unlock; | ||
394 | } | ||
395 | + spin_lock(&dmabuf->name_lock); | ||
396 | kfree(dmabuf->name); | ||
397 | dmabuf->name = name; | ||
398 | + spin_unlock(&dmabuf->name_lock); | ||
399 | |||
400 | out_unlock: | ||
401 | mutex_unlock(&dmabuf->lock); | ||
402 | @@ -402,10 +404,10 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file) | ||
403 | /* Don't count the temporary reference taken inside procfs seq_show */ | ||
404 | seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1); | ||
405 | seq_printf(m, "exp_name:\t%s\n", dmabuf->exp_name); | ||
406 | - mutex_lock(&dmabuf->lock); | ||
407 | + spin_lock(&dmabuf->name_lock); | ||
408 | if (dmabuf->name) | ||
409 | seq_printf(m, "name:\t%s\n", dmabuf->name); | ||
410 | - mutex_unlock(&dmabuf->lock); | ||
411 | + spin_unlock(&dmabuf->name_lock); | ||
412 | } | ||
413 | |||
414 | static const struct file_operations dma_buf_fops = { | ||
415 | @@ -537,6 +539,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) | ||
416 | dmabuf->size = exp_info->size; | ||
417 | dmabuf->exp_name = exp_info->exp_name; | ||
418 | dmabuf->owner = exp_info->owner; | ||
419 | + spin_lock_init(&dmabuf->name_lock); | ||
420 | init_waitqueue_head(&dmabuf->poll); | ||
421 | dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll; | ||
422 | dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0; | ||
423 | diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c | ||
424 | index b1a7ca91701a..d6010486ee50 100644 | ||
425 | --- a/drivers/dma/fsl-edma-common.c | ||
426 | +++ b/drivers/dma/fsl-edma-common.c | ||
427 | @@ -347,26 +347,28 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, | ||
428 | /* | ||
429 | * TCD parameters are stored in struct fsl_edma_hw_tcd in little | ||
430 | * endian format. However, we need to load the TCD registers in | ||
431 | - * big- or little-endian obeying the eDMA engine model endian. | ||
432 | + * big- or little-endian obeying the eDMA engine model endian, | ||
433 | + * and this is performed from specific edma_write functions | ||
434 | */ | ||
435 | edma_writew(edma, 0, ®s->tcd[ch].csr); | ||
436 | - edma_writel(edma, le32_to_cpu(tcd->saddr), ®s->tcd[ch].saddr); | ||
437 | - edma_writel(edma, le32_to_cpu(tcd->daddr), ®s->tcd[ch].daddr); | ||
438 | |||
439 | - edma_writew(edma, le16_to_cpu(tcd->attr), ®s->tcd[ch].attr); | ||
440 | - edma_writew(edma, le16_to_cpu(tcd->soff), ®s->tcd[ch].soff); | ||
441 | + edma_writel(edma, (s32)tcd->saddr, ®s->tcd[ch].saddr); | ||
442 | + edma_writel(edma, (s32)tcd->daddr, ®s->tcd[ch].daddr); | ||
443 | |||
444 | - edma_writel(edma, le32_to_cpu(tcd->nbytes), ®s->tcd[ch].nbytes); | ||
445 | - edma_writel(edma, le32_to_cpu(tcd->slast), ®s->tcd[ch].slast); | ||
446 | + edma_writew(edma, (s16)tcd->attr, ®s->tcd[ch].attr); | ||
447 | + edma_writew(edma, tcd->soff, ®s->tcd[ch].soff); | ||
448 | |||
449 | - edma_writew(edma, le16_to_cpu(tcd->citer), ®s->tcd[ch].citer); | ||
450 | - edma_writew(edma, le16_to_cpu(tcd->biter), ®s->tcd[ch].biter); | ||
451 | - edma_writew(edma, le16_to_cpu(tcd->doff), ®s->tcd[ch].doff); | ||
452 | + edma_writel(edma, (s32)tcd->nbytes, ®s->tcd[ch].nbytes); | ||
453 | + edma_writel(edma, (s32)tcd->slast, ®s->tcd[ch].slast); | ||
454 | |||
455 | - edma_writel(edma, le32_to_cpu(tcd->dlast_sga), | ||
456 | + edma_writew(edma, (s16)tcd->citer, ®s->tcd[ch].citer); | ||
457 | + edma_writew(edma, (s16)tcd->biter, ®s->tcd[ch].biter); | ||
458 | + edma_writew(edma, (s16)tcd->doff, ®s->tcd[ch].doff); | ||
459 | + | ||
460 | + edma_writel(edma, (s32)tcd->dlast_sga, | ||
461 | ®s->tcd[ch].dlast_sga); | ||
462 | |||
463 | - edma_writew(edma, le16_to_cpu(tcd->csr), ®s->tcd[ch].csr); | ||
464 | + edma_writew(edma, (s16)tcd->csr, ®s->tcd[ch].csr); | ||
465 | } | ||
466 | |||
467 | static inline | ||
468 | diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c | ||
469 | index 18c011e57592..8e2a4d1f0be5 100644 | ||
470 | --- a/drivers/dma/ioat/dma.c | ||
471 | +++ b/drivers/dma/ioat/dma.c | ||
472 | @@ -26,6 +26,18 @@ | ||
473 | |||
474 | #include "../dmaengine.h" | ||
475 | |||
476 | +int completion_timeout = 200; | ||
477 | +module_param(completion_timeout, int, 0644); | ||
478 | +MODULE_PARM_DESC(completion_timeout, | ||
479 | + "set ioat completion timeout [msec] (default 200 [msec])"); | ||
480 | +int idle_timeout = 2000; | ||
481 | +module_param(idle_timeout, int, 0644); | ||
482 | +MODULE_PARM_DESC(idle_timeout, | ||
483 | + "set ioat idel timeout [msec] (default 2000 [msec])"); | ||
484 | + | ||
485 | +#define IDLE_TIMEOUT msecs_to_jiffies(idle_timeout) | ||
486 | +#define COMPLETION_TIMEOUT msecs_to_jiffies(completion_timeout) | ||
487 | + | ||
488 | static char *chanerr_str[] = { | ||
489 | "DMA Transfer Source Address Error", | ||
490 | "DMA Transfer Destination Address Error", | ||
491 | diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h | ||
492 | index b8e8e0b9693c..4ac9134962f3 100644 | ||
493 | --- a/drivers/dma/ioat/dma.h | ||
494 | +++ b/drivers/dma/ioat/dma.h | ||
495 | @@ -99,8 +99,6 @@ struct ioatdma_chan { | ||
496 | #define IOAT_RUN 5 | ||
497 | #define IOAT_CHAN_ACTIVE 6 | ||
498 | struct timer_list timer; | ||
499 | - #define COMPLETION_TIMEOUT msecs_to_jiffies(100) | ||
500 | - #define IDLE_TIMEOUT msecs_to_jiffies(2000) | ||
501 | #define RESET_DELAY msecs_to_jiffies(100) | ||
502 | struct ioatdma_device *ioat_dma; | ||
503 | dma_addr_t completion_dma; | ||
504 | diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c | ||
505 | index 914901a680c8..9068591bd684 100644 | ||
506 | --- a/drivers/dma/tegra210-adma.c | ||
507 | +++ b/drivers/dma/tegra210-adma.c | ||
508 | @@ -658,6 +658,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc) | ||
509 | |||
510 | ret = pm_runtime_get_sync(tdc2dev(tdc)); | ||
511 | if (ret < 0) { | ||
512 | + pm_runtime_put_noidle(tdc2dev(tdc)); | ||
513 | free_irq(tdc->irq, tdc); | ||
514 | return ret; | ||
515 | } | ||
516 | @@ -869,8 +870,10 @@ static int tegra_adma_probe(struct platform_device *pdev) | ||
517 | pm_runtime_enable(&pdev->dev); | ||
518 | |||
519 | ret = pm_runtime_get_sync(&pdev->dev); | ||
520 | - if (ret < 0) | ||
521 | + if (ret < 0) { | ||
522 | + pm_runtime_put_noidle(&pdev->dev); | ||
523 | goto rpm_disable; | ||
524 | + } | ||
525 | |||
526 | ret = tegra_adma_init(tdma); | ||
527 | if (ret) | ||
528 | diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c | ||
529 | index 6a445397771c..03eb798ad3ed 100644 | ||
530 | --- a/drivers/firmware/psci/psci_checker.c | ||
531 | +++ b/drivers/firmware/psci/psci_checker.c | ||
532 | @@ -157,8 +157,10 @@ static int alloc_init_cpu_groups(cpumask_var_t **pcpu_groups) | ||
533 | |||
534 | cpu_groups = kcalloc(nb_available_cpus, sizeof(cpu_groups), | ||
535 | GFP_KERNEL); | ||
536 | - if (!cpu_groups) | ||
537 | + if (!cpu_groups) { | ||
538 | + free_cpumask_var(tmp); | ||
539 | return -ENOMEM; | ||
540 | + } | ||
541 | |||
542 | cpumask_copy(tmp, cpu_online_mask); | ||
543 | |||
544 | @@ -167,6 +169,7 @@ static int alloc_init_cpu_groups(cpumask_var_t **pcpu_groups) | ||
545 | topology_core_cpumask(cpumask_any(tmp)); | ||
546 | |||
547 | if (!alloc_cpumask_var(&cpu_groups[num_groups], GFP_KERNEL)) { | ||
548 | + free_cpumask_var(tmp); | ||
549 | free_cpu_groups(num_groups, &cpu_groups); | ||
550 | return -ENOMEM; | ||
551 | } | ||
552 | diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c | ||
553 | index e4a34dc7947f..041d23469238 100644 | ||
554 | --- a/drivers/fpga/dfl-afu-main.c | ||
555 | +++ b/drivers/fpga/dfl-afu-main.c | ||
556 | @@ -83,7 +83,8 @@ int __afu_port_disable(struct platform_device *pdev) | ||
557 | * on this port and minimum soft reset pulse width has elapsed. | ||
558 | * Driver polls port_soft_reset_ack to determine if reset done by HW. | ||
559 | */ | ||
560 | - if (readq_poll_timeout(base + PORT_HDR_CTRL, v, v & PORT_CTRL_SFTRST, | ||
561 | + if (readq_poll_timeout(base + PORT_HDR_CTRL, v, | ||
562 | + v & PORT_CTRL_SFTRST_ACK, | ||
563 | RST_POLL_INVL, RST_POLL_TIMEOUT)) { | ||
564 | dev_err(&pdev->dev, "timeout, fail to reset device\n"); | ||
565 | return -ETIMEDOUT; | ||
566 | diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c | ||
567 | index 538755062ab7..a78c409bf2c4 100644 | ||
568 | --- a/drivers/fpga/dfl-pci.c | ||
569 | +++ b/drivers/fpga/dfl-pci.c | ||
570 | @@ -227,7 +227,6 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs) | ||
571 | { | ||
572 | struct cci_drvdata *drvdata = pci_get_drvdata(pcidev); | ||
573 | struct dfl_fpga_cdev *cdev = drvdata->cdev; | ||
574 | - int ret = 0; | ||
575 | |||
576 | if (!num_vfs) { | ||
577 | /* | ||
578 | @@ -239,6 +238,8 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs) | ||
579 | dfl_fpga_cdev_config_ports_pf(cdev); | ||
580 | |||
581 | } else { | ||
582 | + int ret; | ||
583 | + | ||
584 | /* | ||
585 | * before enable SRIOV, put released ports into VF access mode | ||
586 | * first of all. | ||
587 | diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c | ||
588 | index 5640efe5e750..5bda38e0780f 100644 | ||
589 | --- a/drivers/gpio/gpio-arizona.c | ||
590 | +++ b/drivers/gpio/gpio-arizona.c | ||
591 | @@ -64,6 +64,7 @@ static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
592 | ret = pm_runtime_get_sync(chip->parent); | ||
593 | if (ret < 0) { | ||
594 | dev_err(chip->parent, "Failed to resume: %d\n", ret); | ||
595 | + pm_runtime_put_autosuspend(chip->parent); | ||
596 | return ret; | ||
597 | } | ||
598 | |||
599 | @@ -72,12 +73,15 @@ static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
600 | if (ret < 0) { | ||
601 | dev_err(chip->parent, "Failed to drop cache: %d\n", | ||
602 | ret); | ||
603 | + pm_runtime_put_autosuspend(chip->parent); | ||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | ret = regmap_read(arizona->regmap, reg, &val); | ||
608 | - if (ret < 0) | ||
609 | + if (ret < 0) { | ||
610 | + pm_runtime_put_autosuspend(chip->parent); | ||
611 | return ret; | ||
612 | + } | ||
613 | |||
614 | pm_runtime_mark_last_busy(chip->parent); | ||
615 | pm_runtime_put_autosuspend(chip->parent); | ||
616 | @@ -106,6 +110,7 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip, | ||
617 | ret = pm_runtime_get_sync(chip->parent); | ||
618 | if (ret < 0) { | ||
619 | dev_err(chip->parent, "Failed to resume: %d\n", ret); | ||
620 | + pm_runtime_put(chip->parent); | ||
621 | return ret; | ||
622 | } | ||
623 | } | ||
624 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | ||
625 | index 1e25ca34d876..700e26b69abc 100644 | ||
626 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | ||
627 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | ||
628 | @@ -990,27 +990,37 @@ static void amdgpu_ib_preempt_job_recovery(struct drm_gpu_scheduler *sched) | ||
629 | static void amdgpu_ib_preempt_mark_partial_job(struct amdgpu_ring *ring) | ||
630 | { | ||
631 | struct amdgpu_job *job; | ||
632 | - struct drm_sched_job *s_job; | ||
633 | + struct drm_sched_job *s_job, *tmp; | ||
634 | uint32_t preempt_seq; | ||
635 | struct dma_fence *fence, **ptr; | ||
636 | struct amdgpu_fence_driver *drv = &ring->fence_drv; | ||
637 | struct drm_gpu_scheduler *sched = &ring->sched; | ||
638 | + bool preempted = true; | ||
639 | |||
640 | if (ring->funcs->type != AMDGPU_RING_TYPE_GFX) | ||
641 | return; | ||
642 | |||
643 | preempt_seq = le32_to_cpu(*(drv->cpu_addr + 2)); | ||
644 | - if (preempt_seq <= atomic_read(&drv->last_seq)) | ||
645 | - return; | ||
646 | + if (preempt_seq <= atomic_read(&drv->last_seq)) { | ||
647 | + preempted = false; | ||
648 | + goto no_preempt; | ||
649 | + } | ||
650 | |||
651 | preempt_seq &= drv->num_fences_mask; | ||
652 | ptr = &drv->fences[preempt_seq]; | ||
653 | fence = rcu_dereference_protected(*ptr, 1); | ||
654 | |||
655 | +no_preempt: | ||
656 | spin_lock(&sched->job_list_lock); | ||
657 | - list_for_each_entry(s_job, &sched->ring_mirror_list, node) { | ||
658 | + list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) { | ||
659 | + if (dma_fence_is_signaled(&s_job->s_fence->finished)) { | ||
660 | + /* remove job from ring_mirror_list */ | ||
661 | + list_del_init(&s_job->node); | ||
662 | + sched->ops->free_job(s_job); | ||
663 | + continue; | ||
664 | + } | ||
665 | job = to_amdgpu_job(s_job); | ||
666 | - if (job->fence == fence) | ||
667 | + if (preempted && job->fence == fence) | ||
668 | /* mark the job as preempted */ | ||
669 | job->preemption_status |= AMDGPU_IB_PREEMPTED; | ||
670 | } | ||
671 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | ||
672 | index 3f744e72912f..b66554b40db4 100644 | ||
673 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | ||
674 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | ||
675 | @@ -691,8 +691,7 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, | ||
676 | tmp_str++; | ||
677 | while (isspace(*++tmp_str)); | ||
678 | |||
679 | - while (tmp_str[0]) { | ||
680 | - sub_str = strsep(&tmp_str, delimiter); | ||
681 | + while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) { | ||
682 | ret = kstrtol(sub_str, 0, ¶meter[parameter_size]); | ||
683 | if (ret) | ||
684 | return -EINVAL; | ||
685 | @@ -883,8 +882,7 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask) | ||
686 | memcpy(buf_cpy, buf, bytes); | ||
687 | buf_cpy[bytes] = '\0'; | ||
688 | tmp = buf_cpy; | ||
689 | - while (tmp[0]) { | ||
690 | - sub_str = strsep(&tmp, delimiter); | ||
691 | + while ((sub_str = strsep(&tmp, delimiter)) != NULL) { | ||
692 | if (strlen(sub_str)) { | ||
693 | ret = kstrtol(sub_str, 0, &level); | ||
694 | if (ret) | ||
695 | @@ -1300,8 +1298,7 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, | ||
696 | i++; | ||
697 | memcpy(buf_cpy, buf, count-i); | ||
698 | tmp_str = buf_cpy; | ||
699 | - while (tmp_str[0]) { | ||
700 | - sub_str = strsep(&tmp_str, delimiter); | ||
701 | + while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) { | ||
702 | ret = kstrtol(sub_str, 0, ¶meter[parameter_size]); | ||
703 | if (ret) { | ||
704 | count = -EINVAL; | ||
705 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | ||
706 | index 6f118292e40f..64d96eb0a233 100644 | ||
707 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | ||
708 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | ||
709 | @@ -4683,12 +4683,17 @@ static int gfx_v10_0_ring_preempt_ib(struct amdgpu_ring *ring) | ||
710 | struct amdgpu_device *adev = ring->adev; | ||
711 | struct amdgpu_kiq *kiq = &adev->gfx.kiq; | ||
712 | struct amdgpu_ring *kiq_ring = &kiq->ring; | ||
713 | + unsigned long flags; | ||
714 | |||
715 | if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) | ||
716 | return -EINVAL; | ||
717 | |||
718 | - if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size)) | ||
719 | + spin_lock_irqsave(&kiq->ring_lock, flags); | ||
720 | + | ||
721 | + if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size)) { | ||
722 | + spin_unlock_irqrestore(&kiq->ring_lock, flags); | ||
723 | return -ENOMEM; | ||
724 | + } | ||
725 | |||
726 | /* assert preemption condition */ | ||
727 | amdgpu_ring_set_preempt_cond_exec(ring, false); | ||
728 | @@ -4699,6 +4704,8 @@ static int gfx_v10_0_ring_preempt_ib(struct amdgpu_ring *ring) | ||
729 | ++ring->trail_seq); | ||
730 | amdgpu_ring_commit(kiq_ring); | ||
731 | |||
732 | + spin_unlock_irqrestore(&kiq->ring_lock, flags); | ||
733 | + | ||
734 | /* poll the trailing fence */ | ||
735 | for (i = 0; i < adev->usec_timeout; i++) { | ||
736 | if (ring->trail_seq == | ||
737 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | ||
738 | index 4fad0b603b3a..c7d8edf450d3 100644 | ||
739 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | ||
740 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | ||
741 | @@ -928,9 +928,14 @@ static int dm_late_init(void *handle) | ||
742 | struct dmcu_iram_parameters params; | ||
743 | unsigned int linear_lut[16]; | ||
744 | int i; | ||
745 | - struct dmcu *dmcu = adev->dm.dc->res_pool->dmcu; | ||
746 | + struct dmcu *dmcu = NULL; | ||
747 | bool ret; | ||
748 | |||
749 | + if (!adev->dm.fw_dmcu) | ||
750 | + return detect_mst_link_for_all_connectors(adev->ddev); | ||
751 | + | ||
752 | + dmcu = adev->dm.dc->res_pool->dmcu; | ||
753 | + | ||
754 | for (i = 0; i < 16; i++) | ||
755 | linear_lut[i] = 0xFFFF * i / 15; | ||
756 | |||
757 | diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | ||
758 | index ae18fbcb26fb..86bdb0194493 100644 | ||
759 | --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | ||
760 | +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | ||
761 | @@ -642,9 +642,6 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, | ||
762 | |||
763 | /* sclk is bigger than max sclk in the dependence table */ | ||
764 | *voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT; | ||
765 | - vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), | ||
766 | - (dep_table->entries[i - 1].vddc - | ||
767 | - (uint16_t)VDDC_VDDCI_DELTA)); | ||
768 | |||
769 | if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control) | ||
770 | *voltage |= (data->vbios_boot_state.vddci_bootup_value * | ||
771 | @@ -652,8 +649,13 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, | ||
772 | else if (dep_table->entries[i - 1].vddci) | ||
773 | *voltage |= (dep_table->entries[i - 1].vddci * | ||
774 | VOLTAGE_SCALE) << VDDC_SHIFT; | ||
775 | - else | ||
776 | + else { | ||
777 | + vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), | ||
778 | + (dep_table->entries[i - 1].vddc - | ||
779 | + (uint16_t)VDDC_VDDCI_DELTA)); | ||
780 | + | ||
781 | *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
782 | + } | ||
783 | |||
784 | if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control) | ||
785 | *mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE; | ||
786 | diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c | ||
787 | index c8ab1b5741a3..db7769cb33eb 100644 | ||
788 | --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c | ||
789 | +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c | ||
790 | @@ -118,10 +118,10 @@ g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry, | ||
791 | if (retries) | ||
792 | udelay(400); | ||
793 | |||
794 | - /* transaction request, wait up to 1ms for it to complete */ | ||
795 | + /* transaction request, wait up to 2ms for it to complete */ | ||
796 | nvkm_wr32(device, 0x00e4e4 + base, 0x00010000 | ctrl); | ||
797 | |||
798 | - timeout = 1000; | ||
799 | + timeout = 2000; | ||
800 | do { | ||
801 | ctrl = nvkm_rd32(device, 0x00e4e4 + base); | ||
802 | udelay(1); | ||
803 | diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | ||
804 | index 7ef60895f43a..edb6148cbca0 100644 | ||
805 | --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | ||
806 | +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | ||
807 | @@ -118,10 +118,10 @@ gm200_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry, | ||
808 | if (retries) | ||
809 | udelay(400); | ||
810 | |||
811 | - /* transaction request, wait up to 1ms for it to complete */ | ||
812 | + /* transaction request, wait up to 2ms for it to complete */ | ||
813 | nvkm_wr32(device, 0x00d954 + base, 0x00010000 | ctrl); | ||
814 | |||
815 | - timeout = 1000; | ||
816 | + timeout = 2000; | ||
817 | do { | ||
818 | ctrl = nvkm_rd32(device, 0x00d954 + base); | ||
819 | udelay(1); | ||
820 | diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | ||
821 | index 63b4de81686a..4acdfa608775 100644 | ||
822 | --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | ||
823 | +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | ||
824 | @@ -263,7 +263,7 @@ sun4i_hdmi_connector_detect(struct drm_connector *connector, bool force) | ||
825 | unsigned long reg; | ||
826 | |||
827 | reg = readl(hdmi->base + SUN4I_HDMI_HPD_REG); | ||
828 | - if (reg & SUN4I_HDMI_HPD_HIGH) { | ||
829 | + if (!(reg & SUN4I_HDMI_HPD_HIGH)) { | ||
830 | cec_phys_addr_invalidate(hdmi->cec_adap); | ||
831 | return connector_status_disconnected; | ||
832 | } | ||
833 | diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c | ||
834 | index b2ad319a74b9..d33f5abc8f64 100644 | ||
835 | --- a/drivers/hid/hid-alps.c | ||
836 | +++ b/drivers/hid/hid-alps.c | ||
837 | @@ -25,6 +25,7 @@ | ||
838 | |||
839 | #define U1_MOUSE_REPORT_ID 0x01 /* Mouse data ReportID */ | ||
840 | #define U1_ABSOLUTE_REPORT_ID 0x03 /* Absolute data ReportID */ | ||
841 | +#define U1_ABSOLUTE_REPORT_ID_SECD 0x02 /* FW-PTP Absolute data ReportID */ | ||
842 | #define U1_FEATURE_REPORT_ID 0x05 /* Feature ReportID */ | ||
843 | #define U1_SP_ABSOLUTE_REPORT_ID 0x06 /* Feature ReportID */ | ||
844 | |||
845 | @@ -368,6 +369,7 @@ static int u1_raw_event(struct alps_dev *hdata, u8 *data, int size) | ||
846 | case U1_FEATURE_REPORT_ID: | ||
847 | break; | ||
848 | case U1_ABSOLUTE_REPORT_ID: | ||
849 | + case U1_ABSOLUTE_REPORT_ID_SECD: | ||
850 | for (i = 0; i < hdata->max_fingers; i++) { | ||
851 | u8 *contact = &data[i * 5]; | ||
852 | |||
853 | diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c | ||
854 | index d732d1d10caf..6909c045fece 100644 | ||
855 | --- a/drivers/hid/hid-apple.c | ||
856 | +++ b/drivers/hid/hid-apple.c | ||
857 | @@ -54,6 +54,7 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") | ||
858 | struct apple_sc { | ||
859 | unsigned long quirks; | ||
860 | unsigned int fn_on; | ||
861 | + unsigned int fn_found; | ||
862 | DECLARE_BITMAP(pressed_numlock, KEY_CNT); | ||
863 | }; | ||
864 | |||
865 | @@ -339,12 +340,15 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
866 | struct hid_field *field, struct hid_usage *usage, | ||
867 | unsigned long **bit, int *max) | ||
868 | { | ||
869 | + struct apple_sc *asc = hid_get_drvdata(hdev); | ||
870 | + | ||
871 | if (usage->hid == (HID_UP_CUSTOM | 0x0003) || | ||
872 | usage->hid == (HID_UP_MSVENDOR | 0x0003) || | ||
873 | usage->hid == (HID_UP_HPVENDOR2 | 0x0003)) { | ||
874 | /* The fn key on Apple USB keyboards */ | ||
875 | set_bit(EV_REP, hi->input->evbit); | ||
876 | hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN); | ||
877 | + asc->fn_found = true; | ||
878 | apple_setup_input(hi->input); | ||
879 | return 1; | ||
880 | } | ||
881 | @@ -371,6 +375,19 @@ static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
882 | return 0; | ||
883 | } | ||
884 | |||
885 | +static int apple_input_configured(struct hid_device *hdev, | ||
886 | + struct hid_input *hidinput) | ||
887 | +{ | ||
888 | + struct apple_sc *asc = hid_get_drvdata(hdev); | ||
889 | + | ||
890 | + if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { | ||
891 | + hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); | ||
892 | + asc->quirks = 0; | ||
893 | + } | ||
894 | + | ||
895 | + return 0; | ||
896 | +} | ||
897 | + | ||
898 | static int apple_probe(struct hid_device *hdev, | ||
899 | const struct hid_device_id *id) | ||
900 | { | ||
901 | @@ -585,6 +602,7 @@ static struct hid_driver apple_driver = { | ||
902 | .event = apple_event, | ||
903 | .input_mapping = apple_input_mapping, | ||
904 | .input_mapped = apple_input_mapped, | ||
905 | + .input_configured = apple_input_configured, | ||
906 | }; | ||
907 | module_hid_driver(apple_driver); | ||
908 | |||
909 | diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c | ||
910 | index 6286204d4c56..a3b151b29bd7 100644 | ||
911 | --- a/drivers/hid/hid-steam.c | ||
912 | +++ b/drivers/hid/hid-steam.c | ||
913 | @@ -526,7 +526,8 @@ static int steam_register(struct steam_device *steam) | ||
914 | steam_battery_register(steam); | ||
915 | |||
916 | mutex_lock(&steam_devices_lock); | ||
917 | - list_add(&steam->list, &steam_devices); | ||
918 | + if (list_empty(&steam->list)) | ||
919 | + list_add(&steam->list, &steam_devices); | ||
920 | mutex_unlock(&steam_devices_lock); | ||
921 | } | ||
922 | |||
923 | @@ -552,7 +553,7 @@ static void steam_unregister(struct steam_device *steam) | ||
924 | hid_info(steam->hdev, "Steam Controller '%s' disconnected", | ||
925 | steam->serial_no); | ||
926 | mutex_lock(&steam_devices_lock); | ||
927 | - list_del(&steam->list); | ||
928 | + list_del_init(&steam->list); | ||
929 | mutex_unlock(&steam_devices_lock); | ||
930 | steam->serial_no[0] = 0; | ||
931 | } | ||
932 | @@ -738,6 +739,7 @@ static int steam_probe(struct hid_device *hdev, | ||
933 | mutex_init(&steam->mutex); | ||
934 | steam->quirks = id->driver_data; | ||
935 | INIT_WORK(&steam->work_connect, steam_work_connect_cb); | ||
936 | + INIT_LIST_HEAD(&steam->list); | ||
937 | |||
938 | steam->client_hdev = steam_create_client_hid(hdev); | ||
939 | if (IS_ERR(steam->client_hdev)) { | ||
940 | diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | ||
941 | index ec142bc8c1da..35f3bfc3e6f5 100644 | ||
942 | --- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | ||
943 | +++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | ||
944 | @@ -373,6 +373,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { | ||
945 | }, | ||
946 | .driver_data = (void *)&sipodev_desc | ||
947 | }, | ||
948 | + { | ||
949 | + .ident = "Mediacom FlexBook edge 13", | ||
950 | + .matches = { | ||
951 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"), | ||
952 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook_edge13-M-FBE13"), | ||
953 | + }, | ||
954 | + .driver_data = (void *)&sipodev_desc | ||
955 | + }, | ||
956 | { | ||
957 | .ident = "Odys Winbook 13", | ||
958 | .matches = { | ||
959 | diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c | ||
960 | index 40c489be62ea..40f3139f1e02 100644 | ||
961 | --- a/drivers/hwmon/aspeed-pwm-tacho.c | ||
962 | +++ b/drivers/hwmon/aspeed-pwm-tacho.c | ||
963 | @@ -851,6 +851,8 @@ static int aspeed_create_fan(struct device *dev, | ||
964 | ret = of_property_read_u32(child, "reg", &pwm_port); | ||
965 | if (ret) | ||
966 | return ret; | ||
967 | + if (pwm_port >= ARRAY_SIZE(pwm_port_params)) | ||
968 | + return -EINVAL; | ||
969 | aspeed_create_pwm_port(priv, (u8)pwm_port); | ||
970 | |||
971 | ret = of_property_count_u8_elems(child, "cooling-levels"); | ||
972 | diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c | ||
973 | index 7efa6bfef060..ba9b96973e80 100644 | ||
974 | --- a/drivers/hwmon/nct6775.c | ||
975 | +++ b/drivers/hwmon/nct6775.c | ||
976 | @@ -786,13 +786,13 @@ static const char *const nct6798_temp_label[] = { | ||
977 | "Agent1 Dimm1", | ||
978 | "BYTE_TEMP0", | ||
979 | "BYTE_TEMP1", | ||
980 | - "", | ||
981 | - "", | ||
982 | + "PECI Agent 0 Calibration", /* undocumented */ | ||
983 | + "PECI Agent 1 Calibration", /* undocumented */ | ||
984 | "", | ||
985 | "Virtual_TEMP" | ||
986 | }; | ||
987 | |||
988 | -#define NCT6798_TEMP_MASK 0x8fff0ffe | ||
989 | +#define NCT6798_TEMP_MASK 0xbfff0ffe | ||
990 | #define NCT6798_VIRT_TEMP_MASK 0x80000c00 | ||
991 | |||
992 | /* NCT6102D/NCT6106D specific data */ | ||
993 | diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c | ||
994 | index 5caa37fbfc18..66b12e5ccbc6 100644 | ||
995 | --- a/drivers/hwmon/pmbus/adm1275.c | ||
996 | +++ b/drivers/hwmon/pmbus/adm1275.c | ||
997 | @@ -454,6 +454,7 @@ MODULE_DEVICE_TABLE(i2c, adm1275_id); | ||
998 | static int adm1275_probe(struct i2c_client *client, | ||
999 | const struct i2c_device_id *id) | ||
1000 | { | ||
1001 | + s32 (*config_read_fn)(const struct i2c_client *client, u8 reg); | ||
1002 | u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; | ||
1003 | int config, device_config; | ||
1004 | int ret; | ||
1005 | @@ -499,11 +500,16 @@ static int adm1275_probe(struct i2c_client *client, | ||
1006 | "Device mismatch: Configured %s, detected %s\n", | ||
1007 | id->name, mid->name); | ||
1008 | |||
1009 | - config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG); | ||
1010 | + if (mid->driver_data == adm1272 || mid->driver_data == adm1278 || | ||
1011 | + mid->driver_data == adm1293 || mid->driver_data == adm1294) | ||
1012 | + config_read_fn = i2c_smbus_read_word_data; | ||
1013 | + else | ||
1014 | + config_read_fn = i2c_smbus_read_byte_data; | ||
1015 | + config = config_read_fn(client, ADM1275_PMON_CONFIG); | ||
1016 | if (config < 0) | ||
1017 | return config; | ||
1018 | |||
1019 | - device_config = i2c_smbus_read_byte_data(client, ADM1275_DEVICE_CONFIG); | ||
1020 | + device_config = config_read_fn(client, ADM1275_DEVICE_CONFIG); | ||
1021 | if (device_config < 0) | ||
1022 | return device_config; | ||
1023 | |||
1024 | diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c | ||
1025 | index 8a7732c0bef3..7cd13a217c61 100644 | ||
1026 | --- a/drivers/hwmon/scmi-hwmon.c | ||
1027 | +++ b/drivers/hwmon/scmi-hwmon.c | ||
1028 | @@ -147,7 +147,7 @@ static enum hwmon_sensor_types scmi_types[] = { | ||
1029 | [ENERGY] = hwmon_energy, | ||
1030 | }; | ||
1031 | |||
1032 | -static u32 hwmon_attributes[] = { | ||
1033 | +static u32 hwmon_attributes[hwmon_max] = { | ||
1034 | [hwmon_chip] = HWMON_C_REGISTER_TZ, | ||
1035 | [hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL, | ||
1036 | [hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL, | ||
1037 | diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c | ||
1038 | index 17abf60c94ae..aafc76ee93e0 100644 | ||
1039 | --- a/drivers/i2c/busses/i2c-qcom-geni.c | ||
1040 | +++ b/drivers/i2c/busses/i2c-qcom-geni.c | ||
1041 | @@ -368,7 +368,6 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, | ||
1042 | geni_se_select_mode(se, GENI_SE_FIFO); | ||
1043 | |||
1044 | writel_relaxed(len, se->base + SE_I2C_RX_TRANS_LEN); | ||
1045 | - geni_se_setup_m_cmd(se, I2C_READ, m_param); | ||
1046 | |||
1047 | if (dma_buf && geni_se_rx_dma_prep(se, dma_buf, len, &rx_dma)) { | ||
1048 | geni_se_select_mode(se, GENI_SE_FIFO); | ||
1049 | @@ -376,6 +375,8 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, | ||
1050 | dma_buf = NULL; | ||
1051 | } | ||
1052 | |||
1053 | + geni_se_setup_m_cmd(se, I2C_READ, m_param); | ||
1054 | + | ||
1055 | time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); | ||
1056 | if (!time_left) | ||
1057 | geni_i2c_abort_xfer(gi2c); | ||
1058 | @@ -409,7 +410,6 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, | ||
1059 | geni_se_select_mode(se, GENI_SE_FIFO); | ||
1060 | |||
1061 | writel_relaxed(len, se->base + SE_I2C_TX_TRANS_LEN); | ||
1062 | - geni_se_setup_m_cmd(se, I2C_WRITE, m_param); | ||
1063 | |||
1064 | if (dma_buf && geni_se_tx_dma_prep(se, dma_buf, len, &tx_dma)) { | ||
1065 | geni_se_select_mode(se, GENI_SE_FIFO); | ||
1066 | @@ -417,6 +417,8 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, | ||
1067 | dma_buf = NULL; | ||
1068 | } | ||
1069 | |||
1070 | + geni_se_setup_m_cmd(se, I2C_WRITE, m_param); | ||
1071 | + | ||
1072 | if (!dma_buf) /* Get FIFO IRQ */ | ||
1073 | writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG); | ||
1074 | |||
1075 | diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c | ||
1076 | index 531c01100b56..36af8fdb6658 100644 | ||
1077 | --- a/drivers/i2c/busses/i2c-rcar.c | ||
1078 | +++ b/drivers/i2c/busses/i2c-rcar.c | ||
1079 | @@ -865,6 +865,7 @@ static int rcar_unreg_slave(struct i2c_client *slave) | ||
1080 | /* disable irqs and ensure none is running before clearing ptr */ | ||
1081 | rcar_i2c_write(priv, ICSIER, 0); | ||
1082 | rcar_i2c_write(priv, ICSCR, 0); | ||
1083 | + rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ | ||
1084 | |||
1085 | synchronize_irq(priv->irq); | ||
1086 | priv->slave = NULL; | ||
1087 | @@ -971,6 +972,8 @@ static int rcar_i2c_probe(struct platform_device *pdev) | ||
1088 | if (ret < 0) | ||
1089 | goto out_pm_put; | ||
1090 | |||
1091 | + rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ | ||
1092 | + | ||
1093 | if (priv->devtype == I2C_RCAR_GEN3) { | ||
1094 | priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); | ||
1095 | if (!IS_ERR(priv->rstc)) { | ||
1096 | diff --git a/drivers/infiniband/hw/mlx5/srq_cmd.c b/drivers/infiniband/hw/mlx5/srq_cmd.c | ||
1097 | index 8fc3630a9d4c..0224231a2e6f 100644 | ||
1098 | --- a/drivers/infiniband/hw/mlx5/srq_cmd.c | ||
1099 | +++ b/drivers/infiniband/hw/mlx5/srq_cmd.c | ||
1100 | @@ -83,11 +83,11 @@ struct mlx5_core_srq *mlx5_cmd_get_srq(struct mlx5_ib_dev *dev, u32 srqn) | ||
1101 | struct mlx5_srq_table *table = &dev->srq_table; | ||
1102 | struct mlx5_core_srq *srq; | ||
1103 | |||
1104 | - xa_lock(&table->array); | ||
1105 | + xa_lock_irq(&table->array); | ||
1106 | srq = xa_load(&table->array, srqn); | ||
1107 | if (srq) | ||
1108 | refcount_inc(&srq->common.refcount); | ||
1109 | - xa_unlock(&table->array); | ||
1110 | + xa_unlock_irq(&table->array); | ||
1111 | |||
1112 | return srq; | ||
1113 | } | ||
1114 | diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c | ||
1115 | index 8719da540383..196e8505dd8d 100644 | ||
1116 | --- a/drivers/input/mouse/elan_i2c_core.c | ||
1117 | +++ b/drivers/input/mouse/elan_i2c_core.c | ||
1118 | @@ -951,6 +951,8 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) | ||
1119 | u8 hover_info = packet[ETP_HOVER_INFO_OFFSET]; | ||
1120 | bool contact_valid, hover_event; | ||
1121 | |||
1122 | + pm_wakeup_event(&data->client->dev, 0); | ||
1123 | + | ||
1124 | hover_event = hover_info & 0x40; | ||
1125 | for (i = 0; i < ETP_MAX_FINGERS; i++) { | ||
1126 | contact_valid = tp_info & (1U << (3 + i)); | ||
1127 | @@ -974,6 +976,8 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report) | ||
1128 | u8 *packet = &report[ETP_REPORT_ID_OFFSET + 1]; | ||
1129 | int x, y; | ||
1130 | |||
1131 | + pm_wakeup_event(&data->client->dev, 0); | ||
1132 | + | ||
1133 | if (!data->tp_input) { | ||
1134 | dev_warn_once(&data->client->dev, | ||
1135 | "received a trackpoint report while no trackpoint device has been created. Please report upstream.\n"); | ||
1136 | @@ -998,7 +1002,6 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report) | ||
1137 | static irqreturn_t elan_isr(int irq, void *dev_id) | ||
1138 | { | ||
1139 | struct elan_tp_data *data = dev_id; | ||
1140 | - struct device *dev = &data->client->dev; | ||
1141 | int error; | ||
1142 | u8 report[ETP_MAX_REPORT_LEN]; | ||
1143 | |||
1144 | @@ -1016,8 +1019,6 @@ static irqreturn_t elan_isr(int irq, void *dev_id) | ||
1145 | if (error) | ||
1146 | goto out; | ||
1147 | |||
1148 | - pm_wakeup_event(dev, 0); | ||
1149 | - | ||
1150 | switch (report[ETP_REPORT_ID_OFFSET]) { | ||
1151 | case ETP_REPORT_ID: | ||
1152 | elan_report_absolute(data, report); | ||
1153 | @@ -1026,7 +1027,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id) | ||
1154 | elan_report_trackpoint(data, report); | ||
1155 | break; | ||
1156 | default: | ||
1157 | - dev_err(dev, "invalid report id data (%x)\n", | ||
1158 | + dev_err(&data->client->dev, "invalid report id data (%x)\n", | ||
1159 | report[ETP_REPORT_ID_OFFSET]); | ||
1160 | } | ||
1161 | |||
1162 | diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c | ||
1163 | index 758dae8d6500..4b81b2d0fe06 100644 | ||
1164 | --- a/drivers/input/mouse/synaptics.c | ||
1165 | +++ b/drivers/input/mouse/synaptics.c | ||
1166 | @@ -179,6 +179,7 @@ static const char * const smbus_pnp_ids[] = { | ||
1167 | "LEN0093", /* T480 */ | ||
1168 | "LEN0096", /* X280 */ | ||
1169 | "LEN0097", /* X280 -> ALPS trackpoint */ | ||
1170 | + "LEN0099", /* X1 Extreme 1st */ | ||
1171 | "LEN009b", /* T580 */ | ||
1172 | "LEN200f", /* T450s */ | ||
1173 | "LEN2044", /* L470 */ | ||
1174 | diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c | ||
1175 | index 32de8e7bb8b4..3a7094f4813f 100644 | ||
1176 | --- a/drivers/iommu/amd_iommu.c | ||
1177 | +++ b/drivers/iommu/amd_iommu.c | ||
1178 | @@ -4575,9 +4575,10 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu) | ||
1179 | if (!fn) | ||
1180 | return -ENOMEM; | ||
1181 | iommu->ir_domain = irq_domain_create_tree(fn, &amd_ir_domain_ops, iommu); | ||
1182 | - irq_domain_free_fwnode(fn); | ||
1183 | - if (!iommu->ir_domain) | ||
1184 | + if (!iommu->ir_domain) { | ||
1185 | + irq_domain_free_fwnode(fn); | ||
1186 | return -ENOMEM; | ||
1187 | + } | ||
1188 | |||
1189 | iommu->ir_domain->parent = arch_get_ir_parent_domain(); | ||
1190 | iommu->msi_domain = arch_create_remap_msi_irq_domain(iommu->ir_domain, | ||
1191 | diff --git a/drivers/iommu/hyperv-iommu.c b/drivers/iommu/hyperv-iommu.c | ||
1192 | index a386b83e0e34..f0fe5030acd3 100644 | ||
1193 | --- a/drivers/iommu/hyperv-iommu.c | ||
1194 | +++ b/drivers/iommu/hyperv-iommu.c | ||
1195 | @@ -155,7 +155,10 @@ static int __init hyperv_prepare_irq_remapping(void) | ||
1196 | 0, IOAPIC_REMAPPING_ENTRY, fn, | ||
1197 | &hyperv_ir_domain_ops, NULL); | ||
1198 | |||
1199 | - irq_domain_free_fwnode(fn); | ||
1200 | + if (!ioapic_ir_domain) { | ||
1201 | + irq_domain_free_fwnode(fn); | ||
1202 | + return -ENOMEM; | ||
1203 | + } | ||
1204 | |||
1205 | /* | ||
1206 | * Hyper-V doesn't provide irq remapping function for | ||
1207 | diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c | ||
1208 | index 81e43c1df7ec..982d796b686b 100644 | ||
1209 | --- a/drivers/iommu/intel_irq_remapping.c | ||
1210 | +++ b/drivers/iommu/intel_irq_remapping.c | ||
1211 | @@ -563,8 +563,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) | ||
1212 | 0, INTR_REMAP_TABLE_ENTRIES, | ||
1213 | fn, &intel_ir_domain_ops, | ||
1214 | iommu); | ||
1215 | - irq_domain_free_fwnode(fn); | ||
1216 | if (!iommu->ir_domain) { | ||
1217 | + irq_domain_free_fwnode(fn); | ||
1218 | pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id); | ||
1219 | goto out_free_bitmap; | ||
1220 | } | ||
1221 | diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c | ||
1222 | index 56248773a9e0..1f63084ef329 100644 | ||
1223 | --- a/drivers/md/dm-integrity.c | ||
1224 | +++ b/drivers/md/dm-integrity.c | ||
1225 | @@ -2298,7 +2298,7 @@ static void integrity_writer(struct work_struct *w) | ||
1226 | unsigned prev_free_sectors; | ||
1227 | |||
1228 | /* the following test is not needed, but it tests the replay code */ | ||
1229 | - if (unlikely(dm_suspended(ic->ti)) && !ic->meta_dev) | ||
1230 | + if (unlikely(dm_post_suspending(ic->ti)) && !ic->meta_dev) | ||
1231 | return; | ||
1232 | |||
1233 | spin_lock_irq(&ic->endio_wait.lock); | ||
1234 | @@ -2359,7 +2359,7 @@ static void integrity_recalc(struct work_struct *w) | ||
1235 | |||
1236 | next_chunk: | ||
1237 | |||
1238 | - if (unlikely(dm_suspended(ic->ti))) | ||
1239 | + if (unlikely(dm_post_suspending(ic->ti))) | ||
1240 | goto unlock_ret; | ||
1241 | |||
1242 | range.logical_sector = le64_to_cpu(ic->sb->recalc_sector); | ||
1243 | diff --git a/drivers/md/dm.c b/drivers/md/dm.c | ||
1244 | index 915019ec0e25..67da442cbab1 100644 | ||
1245 | --- a/drivers/md/dm.c | ||
1246 | +++ b/drivers/md/dm.c | ||
1247 | @@ -141,6 +141,7 @@ EXPORT_SYMBOL_GPL(dm_bio_get_target_bio_nr); | ||
1248 | #define DMF_NOFLUSH_SUSPENDING 5 | ||
1249 | #define DMF_DEFERRED_REMOVE 6 | ||
1250 | #define DMF_SUSPENDED_INTERNALLY 7 | ||
1251 | +#define DMF_POST_SUSPENDING 8 | ||
1252 | |||
1253 | #define DM_NUMA_NODE NUMA_NO_NODE | ||
1254 | static int dm_numa_node = DM_NUMA_NODE; | ||
1255 | @@ -1437,9 +1438,6 @@ static int __send_empty_flush(struct clone_info *ci) | ||
1256 | BUG_ON(bio_has_data(ci->bio)); | ||
1257 | while ((ti = dm_table_get_target(ci->map, target_nr++))) | ||
1258 | __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); | ||
1259 | - | ||
1260 | - bio_disassociate_blkg(ci->bio); | ||
1261 | - | ||
1262 | return 0; | ||
1263 | } | ||
1264 | |||
1265 | @@ -1627,6 +1625,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, | ||
1266 | ci.bio = &flush_bio; | ||
1267 | ci.sector_count = 0; | ||
1268 | error = __send_empty_flush(&ci); | ||
1269 | + bio_uninit(ci.bio); | ||
1270 | /* dec_pending submits any data associated with flush */ | ||
1271 | } else if (bio_op(bio) == REQ_OP_ZONE_RESET) { | ||
1272 | ci.bio = bio; | ||
1273 | @@ -1701,6 +1700,7 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map, | ||
1274 | ci.bio = &flush_bio; | ||
1275 | ci.sector_count = 0; | ||
1276 | error = __send_empty_flush(&ci); | ||
1277 | + bio_uninit(ci.bio); | ||
1278 | /* dec_pending submits any data associated with flush */ | ||
1279 | } else { | ||
1280 | struct dm_target_io *tio; | ||
1281 | @@ -2391,6 +2391,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait) | ||
1282 | if (!dm_suspended_md(md)) { | ||
1283 | dm_table_presuspend_targets(map); | ||
1284 | set_bit(DMF_SUSPENDED, &md->flags); | ||
1285 | + set_bit(DMF_POST_SUSPENDING, &md->flags); | ||
1286 | dm_table_postsuspend_targets(map); | ||
1287 | } | ||
1288 | /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ | ||
1289 | @@ -2713,7 +2714,9 @@ retry: | ||
1290 | if (r) | ||
1291 | goto out_unlock; | ||
1292 | |||
1293 | + set_bit(DMF_POST_SUSPENDING, &md->flags); | ||
1294 | dm_table_postsuspend_targets(map); | ||
1295 | + clear_bit(DMF_POST_SUSPENDING, &md->flags); | ||
1296 | |||
1297 | out_unlock: | ||
1298 | mutex_unlock(&md->suspend_lock); | ||
1299 | @@ -2810,7 +2813,9 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned suspend_fla | ||
1300 | (void) __dm_suspend(md, map, suspend_flags, TASK_UNINTERRUPTIBLE, | ||
1301 | DMF_SUSPENDED_INTERNALLY); | ||
1302 | |||
1303 | + set_bit(DMF_POST_SUSPENDING, &md->flags); | ||
1304 | dm_table_postsuspend_targets(map); | ||
1305 | + clear_bit(DMF_POST_SUSPENDING, &md->flags); | ||
1306 | } | ||
1307 | |||
1308 | static void __dm_internal_resume(struct mapped_device *md) | ||
1309 | @@ -2971,6 +2976,11 @@ int dm_suspended_md(struct mapped_device *md) | ||
1310 | return test_bit(DMF_SUSPENDED, &md->flags); | ||
1311 | } | ||
1312 | |||
1313 | +static int dm_post_suspending_md(struct mapped_device *md) | ||
1314 | +{ | ||
1315 | + return test_bit(DMF_POST_SUSPENDING, &md->flags); | ||
1316 | +} | ||
1317 | + | ||
1318 | int dm_suspended_internally_md(struct mapped_device *md) | ||
1319 | { | ||
1320 | return test_bit(DMF_SUSPENDED_INTERNALLY, &md->flags); | ||
1321 | @@ -2987,6 +2997,12 @@ int dm_suspended(struct dm_target *ti) | ||
1322 | } | ||
1323 | EXPORT_SYMBOL_GPL(dm_suspended); | ||
1324 | |||
1325 | +int dm_post_suspending(struct dm_target *ti) | ||
1326 | +{ | ||
1327 | + return dm_post_suspending_md(dm_table_get_md(ti->table)); | ||
1328 | +} | ||
1329 | +EXPORT_SYMBOL_GPL(dm_post_suspending); | ||
1330 | + | ||
1331 | int dm_noflush_suspending(struct dm_target *ti) | ||
1332 | { | ||
1333 | return __noflush_suspending(dm_table_get_md(ti->table)); | ||
1334 | diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c | ||
1335 | index 8962f6664381..47ddded57000 100644 | ||
1336 | --- a/drivers/mmc/host/sdhci-of-aspeed.c | ||
1337 | +++ b/drivers/mmc/host/sdhci-of-aspeed.c | ||
1338 | @@ -68,7 +68,7 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) | ||
1339 | if (WARN_ON(clock > host->max_clk)) | ||
1340 | clock = host->max_clk; | ||
1341 | |||
1342 | - for (div = 1; div < 256; div *= 2) { | ||
1343 | + for (div = 2; div < 256; div *= 2) { | ||
1344 | if ((parent / div) <= clock) | ||
1345 | break; | ||
1346 | } | ||
1347 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c | ||
1348 | index 703c5c2c80e5..499845c32b1b 100644 | ||
1349 | --- a/drivers/net/bonding/bond_main.c | ||
1350 | +++ b/drivers/net/bonding/bond_main.c | ||
1351 | @@ -4864,15 +4864,19 @@ int bond_create(struct net *net, const char *name) | ||
1352 | bond_dev->rtnl_link_ops = &bond_link_ops; | ||
1353 | |||
1354 | res = register_netdevice(bond_dev); | ||
1355 | + if (res < 0) { | ||
1356 | + free_netdev(bond_dev); | ||
1357 | + rtnl_unlock(); | ||
1358 | + | ||
1359 | + return res; | ||
1360 | + } | ||
1361 | |||
1362 | netif_carrier_off(bond_dev); | ||
1363 | |||
1364 | bond_work_init_all(bond); | ||
1365 | |||
1366 | rtnl_unlock(); | ||
1367 | - if (res < 0) | ||
1368 | - free_netdev(bond_dev); | ||
1369 | - return res; | ||
1370 | + return 0; | ||
1371 | } | ||
1372 | |||
1373 | static int __net_init bond_net_init(struct net *net) | ||
1374 | diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c | ||
1375 | index b43b51646b11..f0f9138e967f 100644 | ||
1376 | --- a/drivers/net/bonding/bond_netlink.c | ||
1377 | +++ b/drivers/net/bonding/bond_netlink.c | ||
1378 | @@ -456,11 +456,10 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev, | ||
1379 | return err; | ||
1380 | |||
1381 | err = register_netdevice(bond_dev); | ||
1382 | - | ||
1383 | - netif_carrier_off(bond_dev); | ||
1384 | if (!err) { | ||
1385 | struct bonding *bond = netdev_priv(bond_dev); | ||
1386 | |||
1387 | + netif_carrier_off(bond_dev); | ||
1388 | bond_work_init_all(bond); | ||
1389 | } | ||
1390 | |||
1391 | diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c | ||
1392 | index f600874e2476..b15da9a8e3bb 100644 | ||
1393 | --- a/drivers/net/dsa/microchip/ksz9477.c | ||
1394 | +++ b/drivers/net/dsa/microchip/ksz9477.c | ||
1395 | @@ -976,23 +976,6 @@ static void ksz9477_port_mirror_del(struct dsa_switch *ds, int port, | ||
1396 | PORT_MIRROR_SNIFFER, false); | ||
1397 | } | ||
1398 | |||
1399 | -static void ksz9477_phy_setup(struct ksz_device *dev, int port, | ||
1400 | - struct phy_device *phy) | ||
1401 | -{ | ||
1402 | - /* Only apply to port with PHY. */ | ||
1403 | - if (port >= dev->phy_port_cnt) | ||
1404 | - return; | ||
1405 | - | ||
1406 | - /* The MAC actually cannot run in 1000 half-duplex mode. */ | ||
1407 | - phy_remove_link_mode(phy, | ||
1408 | - ETHTOOL_LINK_MODE_1000baseT_Half_BIT); | ||
1409 | - | ||
1410 | - /* PHY does not support gigabit. */ | ||
1411 | - if (!(dev->features & GBIT_SUPPORT)) | ||
1412 | - phy_remove_link_mode(phy, | ||
1413 | - ETHTOOL_LINK_MODE_1000baseT_Full_BIT); | ||
1414 | -} | ||
1415 | - | ||
1416 | static bool ksz9477_get_gbit(struct ksz_device *dev, u8 data) | ||
1417 | { | ||
1418 | bool gbit; | ||
1419 | @@ -1605,7 +1588,6 @@ static const struct ksz_dev_ops ksz9477_dev_ops = { | ||
1420 | .get_port_addr = ksz9477_get_port_addr, | ||
1421 | .cfg_port_member = ksz9477_cfg_port_member, | ||
1422 | .flush_dyn_mac_table = ksz9477_flush_dyn_mac_table, | ||
1423 | - .phy_setup = ksz9477_phy_setup, | ||
1424 | .port_setup = ksz9477_port_setup, | ||
1425 | .r_mib_cnt = ksz9477_r_mib_cnt, | ||
1426 | .r_mib_pkt = ksz9477_r_mib_pkt, | ||
1427 | @@ -1619,7 +1601,29 @@ static const struct ksz_dev_ops ksz9477_dev_ops = { | ||
1428 | |||
1429 | int ksz9477_switch_register(struct ksz_device *dev) | ||
1430 | { | ||
1431 | - return ksz_switch_register(dev, &ksz9477_dev_ops); | ||
1432 | + int ret, i; | ||
1433 | + struct phy_device *phydev; | ||
1434 | + | ||
1435 | + ret = ksz_switch_register(dev, &ksz9477_dev_ops); | ||
1436 | + if (ret) | ||
1437 | + return ret; | ||
1438 | + | ||
1439 | + for (i = 0; i < dev->phy_port_cnt; ++i) { | ||
1440 | + if (!dsa_is_user_port(dev->ds, i)) | ||
1441 | + continue; | ||
1442 | + | ||
1443 | + phydev = dsa_to_port(dev->ds, i)->slave->phydev; | ||
1444 | + | ||
1445 | + /* The MAC actually cannot run in 1000 half-duplex mode. */ | ||
1446 | + phy_remove_link_mode(phydev, | ||
1447 | + ETHTOOL_LINK_MODE_1000baseT_Half_BIT); | ||
1448 | + | ||
1449 | + /* PHY does not support gigabit. */ | ||
1450 | + if (!(dev->features & GBIT_SUPPORT)) | ||
1451 | + phy_remove_link_mode(phydev, | ||
1452 | + ETHTOOL_LINK_MODE_1000baseT_Full_BIT); | ||
1453 | + } | ||
1454 | + return ret; | ||
1455 | } | ||
1456 | EXPORT_SYMBOL(ksz9477_switch_register); | ||
1457 | |||
1458 | diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c | ||
1459 | index fe47180c908b..7fabc0e3d807 100644 | ||
1460 | --- a/drivers/net/dsa/microchip/ksz_common.c | ||
1461 | +++ b/drivers/net/dsa/microchip/ksz_common.c | ||
1462 | @@ -366,8 +366,6 @@ int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) | ||
1463 | |||
1464 | /* setup slave port */ | ||
1465 | dev->dev_ops->port_setup(dev, port, false); | ||
1466 | - if (dev->dev_ops->phy_setup) | ||
1467 | - dev->dev_ops->phy_setup(dev, port, phy); | ||
1468 | |||
1469 | /* port_stp_state_set() will be called after to enable the port so | ||
1470 | * there is no need to do anything. | ||
1471 | diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h | ||
1472 | index a20ebb749377..061142b183cb 100644 | ||
1473 | --- a/drivers/net/dsa/microchip/ksz_common.h | ||
1474 | +++ b/drivers/net/dsa/microchip/ksz_common.h | ||
1475 | @@ -120,8 +120,6 @@ struct ksz_dev_ops { | ||
1476 | u32 (*get_port_addr)(int port, int offset); | ||
1477 | void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member); | ||
1478 | void (*flush_dyn_mac_table)(struct ksz_device *dev, int port); | ||
1479 | - void (*phy_setup)(struct ksz_device *dev, int port, | ||
1480 | - struct phy_device *phy); | ||
1481 | void (*port_cleanup)(struct ksz_device *dev, int port); | ||
1482 | void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port); | ||
1483 | void (*r_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 *val); | ||
1484 | diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c | ||
1485 | index 1b1a09095c0d..78e20f53677d 100644 | ||
1486 | --- a/drivers/net/ethernet/atheros/ag71xx.c | ||
1487 | +++ b/drivers/net/ethernet/atheros/ag71xx.c | ||
1488 | @@ -553,7 +553,8 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) | ||
1489 | ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); | ||
1490 | if (IS_ERR(ag->mdio_reset)) { | ||
1491 | netif_err(ag, probe, ndev, "Failed to get reset mdio.\n"); | ||
1492 | - return PTR_ERR(ag->mdio_reset); | ||
1493 | + err = PTR_ERR(ag->mdio_reset); | ||
1494 | + goto mdio_err_put_clk; | ||
1495 | } | ||
1496 | |||
1497 | mii_bus->name = "ag71xx_mdio"; | ||
1498 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | ||
1499 | index b5147bd6cba6..2cbfe0cd7eef 100644 | ||
1500 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c | ||
1501 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | ||
1502 | @@ -3423,7 +3423,7 @@ void bnxt_set_tpa_flags(struct bnxt *bp) | ||
1503 | */ | ||
1504 | void bnxt_set_ring_params(struct bnxt *bp) | ||
1505 | { | ||
1506 | - u32 ring_size, rx_size, rx_space; | ||
1507 | + u32 ring_size, rx_size, rx_space, max_rx_cmpl; | ||
1508 | u32 agg_factor = 0, agg_ring_size = 0; | ||
1509 | |||
1510 | /* 8 for CRC and VLAN */ | ||
1511 | @@ -3479,7 +3479,15 @@ void bnxt_set_ring_params(struct bnxt *bp) | ||
1512 | bp->tx_nr_pages = bnxt_calc_nr_ring_pages(ring_size, TX_DESC_CNT); | ||
1513 | bp->tx_ring_mask = (bp->tx_nr_pages * TX_DESC_CNT) - 1; | ||
1514 | |||
1515 | - ring_size = bp->rx_ring_size * (2 + agg_factor) + bp->tx_ring_size; | ||
1516 | + max_rx_cmpl = bp->rx_ring_size; | ||
1517 | + /* MAX TPA needs to be added because TPA_START completions are | ||
1518 | + * immediately recycled, so the TPA completions are not bound by | ||
1519 | + * the RX ring size. | ||
1520 | + */ | ||
1521 | + if (bp->flags & BNXT_FLAG_TPA) | ||
1522 | + max_rx_cmpl += bp->max_tpa; | ||
1523 | + /* RX and TPA completions are 32-byte, all others are 16-byte */ | ||
1524 | + ring_size = max_rx_cmpl * 2 + agg_ring_size + bp->tx_ring_size; | ||
1525 | bp->cp_ring_size = ring_size; | ||
1526 | |||
1527 | bp->cp_nr_pages = bnxt_calc_nr_ring_pages(ring_size, CP_DESC_CNT); | ||
1528 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | ||
1529 | index fb1ab58da9fa..1f512e7c3d43 100644 | ||
1530 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | ||
1531 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | ||
1532 | @@ -1688,8 +1688,11 @@ static int bnxt_set_pauseparam(struct net_device *dev, | ||
1533 | if (epause->tx_pause) | ||
1534 | link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX; | ||
1535 | |||
1536 | - if (netif_running(dev)) | ||
1537 | + if (netif_running(dev)) { | ||
1538 | + mutex_lock(&bp->link_lock); | ||
1539 | rc = bnxt_hwrm_set_pause(bp); | ||
1540 | + mutex_unlock(&bp->link_lock); | ||
1541 | + } | ||
1542 | return rc; | ||
1543 | } | ||
1544 | |||
1545 | diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c | ||
1546 | index b73421c3e25b..74847aa644f1 100644 | ||
1547 | --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c | ||
1548 | +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c | ||
1549 | @@ -885,6 +885,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, | ||
1550 | return 0; | ||
1551 | |||
1552 | err_reg_netdev: | ||
1553 | + enetc_mdio_remove(pf); | ||
1554 | enetc_of_put_phy(priv); | ||
1555 | enetc_free_msix(priv); | ||
1556 | err_alloc_msix: | ||
1557 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h | ||
1558 | index a0998937727d..0db835d87d09 100644 | ||
1559 | --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h | ||
1560 | +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h | ||
1561 | @@ -77,6 +77,7 @@ | ||
1562 | ((ring)->p = ((ring)->p - 1 + (ring)->desc_num) % (ring)->desc_num) | ||
1563 | |||
1564 | enum hns_desc_type { | ||
1565 | + DESC_TYPE_UNKNOWN, | ||
1566 | DESC_TYPE_SKB, | ||
1567 | DESC_TYPE_PAGE, | ||
1568 | }; | ||
1569 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | ||
1570 | index 37537c302080..506381224559 100644 | ||
1571 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | ||
1572 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | ||
1573 | @@ -1292,6 +1292,10 @@ static void hns3_clear_desc(struct hns3_enet_ring *ring, int next_to_use_orig) | ||
1574 | unsigned int i; | ||
1575 | |||
1576 | for (i = 0; i < ring->desc_num; i++) { | ||
1577 | + struct hns3_desc *desc = &ring->desc[ring->next_to_use]; | ||
1578 | + | ||
1579 | + memset(desc, 0, sizeof(*desc)); | ||
1580 | + | ||
1581 | /* check if this is where we started */ | ||
1582 | if (ring->next_to_use == next_to_use_orig) | ||
1583 | break; | ||
1584 | @@ -1299,6 +1303,9 @@ static void hns3_clear_desc(struct hns3_enet_ring *ring, int next_to_use_orig) | ||
1585 | /* rollback one */ | ||
1586 | ring_ptr_move_bw(ring, next_to_use); | ||
1587 | |||
1588 | + if (!ring->desc_cb[ring->next_to_use].dma) | ||
1589 | + continue; | ||
1590 | + | ||
1591 | /* unmap the descriptor dma address */ | ||
1592 | if (ring->desc_cb[ring->next_to_use].type == DESC_TYPE_SKB) | ||
1593 | dma_unmap_single(dev, | ||
1594 | @@ -1313,6 +1320,7 @@ static void hns3_clear_desc(struct hns3_enet_ring *ring, int next_to_use_orig) | ||
1595 | |||
1596 | ring->desc_cb[ring->next_to_use].length = 0; | ||
1597 | ring->desc_cb[ring->next_to_use].dma = 0; | ||
1598 | + ring->desc_cb[ring->next_to_use].type = DESC_TYPE_UNKNOWN; | ||
1599 | } | ||
1600 | } | ||
1601 | |||
1602 | diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c | ||
1603 | index 5f56ee83e3b1..df7c23cd3360 100644 | ||
1604 | --- a/drivers/net/ethernet/marvell/sky2.c | ||
1605 | +++ b/drivers/net/ethernet/marvell/sky2.c | ||
1606 | @@ -203,7 +203,7 @@ io_error: | ||
1607 | |||
1608 | static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) | ||
1609 | { | ||
1610 | - u16 v; | ||
1611 | + u16 v = 0; | ||
1612 | __gm_phy_read(hw, port, reg, &v); | ||
1613 | return v; | ||
1614 | } | ||
1615 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c | ||
1616 | index 0a0884d86d44..1b204ce30ee4 100644 | ||
1617 | --- a/drivers/net/ethernet/mellanox/mlxsw/core.c | ||
1618 | +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c | ||
1619 | @@ -592,7 +592,7 @@ static int mlxsw_emad_init(struct mlxsw_core *mlxsw_core) | ||
1620 | err = mlxsw_core_trap_register(mlxsw_core, &mlxsw_emad_rx_listener, | ||
1621 | mlxsw_core); | ||
1622 | if (err) | ||
1623 | - return err; | ||
1624 | + goto err_trap_register; | ||
1625 | |||
1626 | err = mlxsw_core->driver->basic_trap_groups_set(mlxsw_core); | ||
1627 | if (err) | ||
1628 | @@ -604,6 +604,7 @@ static int mlxsw_emad_init(struct mlxsw_core *mlxsw_core) | ||
1629 | err_emad_trap_set: | ||
1630 | mlxsw_core_trap_unregister(mlxsw_core, &mlxsw_emad_rx_listener, | ||
1631 | mlxsw_core); | ||
1632 | +err_trap_register: | ||
1633 | destroy_workqueue(mlxsw_core->emad_wq); | ||
1634 | return err; | ||
1635 | } | ||
1636 | diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | ||
1637 | index 7d10265f782a..5aacc00962df 100644 | ||
1638 | --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | ||
1639 | +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | ||
1640 | @@ -102,15 +102,18 @@ static void ionic_get_regs(struct net_device *netdev, struct ethtool_regs *regs, | ||
1641 | void *p) | ||
1642 | { | ||
1643 | struct ionic_lif *lif = netdev_priv(netdev); | ||
1644 | + unsigned int offset; | ||
1645 | unsigned int size; | ||
1646 | |||
1647 | regs->version = IONIC_DEV_CMD_REG_VERSION; | ||
1648 | |||
1649 | + offset = 0; | ||
1650 | size = IONIC_DEV_INFO_REG_COUNT * sizeof(u32); | ||
1651 | - memcpy_fromio(p, lif->ionic->idev.dev_info_regs->words, size); | ||
1652 | + memcpy_fromio(p + offset, lif->ionic->idev.dev_info_regs->words, size); | ||
1653 | |||
1654 | + offset += size; | ||
1655 | size = IONIC_DEV_CMD_REG_COUNT * sizeof(u32); | ||
1656 | - memcpy_fromio(p, lif->ionic->idev.dev_cmd_regs->words, size); | ||
1657 | + memcpy_fromio(p + offset, lif->ionic->idev.dev_cmd_regs->words, size); | ||
1658 | } | ||
1659 | |||
1660 | static int ionic_get_link_ksettings(struct net_device *netdev, | ||
1661 | diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c | ||
1662 | index d5b0bf54f961..c00ec9a02097 100644 | ||
1663 | --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c | ||
1664 | +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c | ||
1665 | @@ -809,8 +809,7 @@ static int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) | ||
1666 | if (f) | ||
1667 | return 0; | ||
1668 | |||
1669 | - netdev_dbg(lif->netdev, "rx_filter add ADDR %pM (id %d)\n", addr, | ||
1670 | - ctx.comp.rx_filter_add.filter_id); | ||
1671 | + netdev_dbg(lif->netdev, "rx_filter add ADDR %pM\n", addr); | ||
1672 | |||
1673 | memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN); | ||
1674 | err = ionic_adminq_post_wait(lif, &ctx); | ||
1675 | @@ -839,6 +838,9 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) | ||
1676 | return -ENOENT; | ||
1677 | } | ||
1678 | |||
1679 | + netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", | ||
1680 | + addr, f->filter_id); | ||
1681 | + | ||
1682 | ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); | ||
1683 | ionic_rx_filter_free(lif, f); | ||
1684 | spin_unlock_bh(&lif->rx_filters.lock); | ||
1685 | @@ -847,9 +849,6 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) | ||
1686 | if (err) | ||
1687 | return err; | ||
1688 | |||
1689 | - netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", addr, | ||
1690 | - ctx.cmd.rx_filter_del.filter_id); | ||
1691 | - | ||
1692 | return 0; | ||
1693 | } | ||
1694 | |||
1695 | @@ -1291,13 +1290,11 @@ static int ionic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, | ||
1696 | }; | ||
1697 | int err; | ||
1698 | |||
1699 | + netdev_dbg(netdev, "rx_filter add VLAN %d\n", vid); | ||
1700 | err = ionic_adminq_post_wait(lif, &ctx); | ||
1701 | if (err) | ||
1702 | return err; | ||
1703 | |||
1704 | - netdev_dbg(netdev, "rx_filter add VLAN %d (id %d)\n", vid, | ||
1705 | - ctx.comp.rx_filter_add.filter_id); | ||
1706 | - | ||
1707 | return ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx); | ||
1708 | } | ||
1709 | |||
1710 | @@ -1322,8 +1319,8 @@ static int ionic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, | ||
1711 | return -ENOENT; | ||
1712 | } | ||
1713 | |||
1714 | - netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n", vid, | ||
1715 | - le32_to_cpu(ctx.cmd.rx_filter_del.filter_id)); | ||
1716 | + netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n", | ||
1717 | + vid, f->filter_id); | ||
1718 | |||
1719 | ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); | ||
1720 | ionic_rx_filter_free(lif, f); | ||
1721 | diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c | ||
1722 | index 7a093f148ee5..60cb77e2bab4 100644 | ||
1723 | --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c | ||
1724 | +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c | ||
1725 | @@ -36,10 +36,12 @@ int ionic_rx_filters_init(struct ionic_lif *lif) | ||
1726 | |||
1727 | spin_lock_init(&lif->rx_filters.lock); | ||
1728 | |||
1729 | + spin_lock_bh(&lif->rx_filters.lock); | ||
1730 | for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { | ||
1731 | INIT_HLIST_HEAD(&lif->rx_filters.by_hash[i]); | ||
1732 | INIT_HLIST_HEAD(&lif->rx_filters.by_id[i]); | ||
1733 | } | ||
1734 | + spin_unlock_bh(&lif->rx_filters.lock); | ||
1735 | |||
1736 | return 0; | ||
1737 | } | ||
1738 | @@ -51,11 +53,13 @@ void ionic_rx_filters_deinit(struct ionic_lif *lif) | ||
1739 | struct hlist_node *tmp; | ||
1740 | unsigned int i; | ||
1741 | |||
1742 | + spin_lock_bh(&lif->rx_filters.lock); | ||
1743 | for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { | ||
1744 | head = &lif->rx_filters.by_id[i]; | ||
1745 | hlist_for_each_entry_safe(f, tmp, head, by_id) | ||
1746 | ionic_rx_filter_free(lif, f); | ||
1747 | } | ||
1748 | + spin_unlock_bh(&lif->rx_filters.lock); | ||
1749 | } | ||
1750 | |||
1751 | int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index, | ||
1752 | @@ -91,6 +95,7 @@ int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index, | ||
1753 | f->filter_id = le32_to_cpu(ctx->comp.rx_filter_add.filter_id); | ||
1754 | f->rxq_index = rxq_index; | ||
1755 | memcpy(&f->cmd, ac, sizeof(f->cmd)); | ||
1756 | + netdev_dbg(lif->netdev, "rx_filter add filter_id %d\n", f->filter_id); | ||
1757 | |||
1758 | INIT_HLIST_NODE(&f->by_hash); | ||
1759 | INIT_HLIST_NODE(&f->by_id); | ||
1760 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c | ||
1761 | index 1d6dfba0c034..8ea46b81b739 100644 | ||
1762 | --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c | ||
1763 | +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c | ||
1764 | @@ -2073,8 +2073,8 @@ static void qed_rdma_set_pf_params(struct qed_hwfn *p_hwfn, | ||
1765 | num_srqs = min_t(u32, QED_RDMA_MAX_SRQS, p_params->num_srqs); | ||
1766 | |||
1767 | if (p_hwfn->mcp_info->func_info.protocol == QED_PCI_ETH_RDMA) { | ||
1768 | - DP_NOTICE(p_hwfn, | ||
1769 | - "Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n"); | ||
1770 | + DP_VERBOSE(p_hwfn, QED_MSG_SP, | ||
1771 | + "Current day drivers don't support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only\n"); | ||
1772 | p_hwfn->hw_info.personality = QED_PCI_ETH_ROCE; | ||
1773 | } | ||
1774 | |||
1775 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c | ||
1776 | index 638047b937c6..4456ce5325a7 100644 | ||
1777 | --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c | ||
1778 | +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c | ||
1779 | @@ -3092,7 +3092,7 @@ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params) | ||
1780 | } | ||
1781 | |||
1782 | /* Log and clear previous pglue_b errors if such exist */ | ||
1783 | - qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_main_ptt); | ||
1784 | + qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_main_ptt, true); | ||
1785 | |||
1786 | /* Enable the PF's internal FID_enable in the PXP */ | ||
1787 | rc = qed_pglueb_set_pfid_enable(p_hwfn, p_hwfn->p_main_ptt, | ||
1788 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c | ||
1789 | index 9f5113639eaf..8d106063e927 100644 | ||
1790 | --- a/drivers/net/ethernet/qlogic/qed/qed_int.c | ||
1791 | +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c | ||
1792 | @@ -256,9 +256,10 @@ out: | ||
1793 | #define PGLUE_ATTENTION_ZLR_VALID (1 << 25) | ||
1794 | #define PGLUE_ATTENTION_ILT_VALID (1 << 23) | ||
1795 | |||
1796 | -int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, | ||
1797 | - struct qed_ptt *p_ptt) | ||
1798 | +int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, | ||
1799 | + bool hw_init) | ||
1800 | { | ||
1801 | + char msg[256]; | ||
1802 | u32 tmp; | ||
1803 | |||
1804 | tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_WR_DETAILS2); | ||
1805 | @@ -272,22 +273,23 @@ int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, | ||
1806 | details = qed_rd(p_hwfn, p_ptt, | ||
1807 | PGLUE_B_REG_TX_ERR_WR_DETAILS); | ||
1808 | |||
1809 | - DP_NOTICE(p_hwfn, | ||
1810 | - "Illegal write by chip to [%08x:%08x] blocked.\n" | ||
1811 | - "Details: %08x [PFID %02x, VFID %02x, VF_VALID %02x]\n" | ||
1812 | - "Details2 %08x [Was_error %02x BME deassert %02x FID_enable deassert %02x]\n", | ||
1813 | - addr_hi, addr_lo, details, | ||
1814 | - (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_PFID), | ||
1815 | - (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VFID), | ||
1816 | - GET_FIELD(details, | ||
1817 | - PGLUE_ATTENTION_DETAILS_VF_VALID) ? 1 : 0, | ||
1818 | - tmp, | ||
1819 | - GET_FIELD(tmp, | ||
1820 | - PGLUE_ATTENTION_DETAILS2_WAS_ERR) ? 1 : 0, | ||
1821 | - GET_FIELD(tmp, | ||
1822 | - PGLUE_ATTENTION_DETAILS2_BME) ? 1 : 0, | ||
1823 | - GET_FIELD(tmp, | ||
1824 | - PGLUE_ATTENTION_DETAILS2_FID_EN) ? 1 : 0); | ||
1825 | + snprintf(msg, sizeof(msg), | ||
1826 | + "Illegal write by chip to [%08x:%08x] blocked.\n" | ||
1827 | + "Details: %08x [PFID %02x, VFID %02x, VF_VALID %02x]\n" | ||
1828 | + "Details2 %08x [Was_error %02x BME deassert %02x FID_enable deassert %02x]", | ||
1829 | + addr_hi, addr_lo, details, | ||
1830 | + (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_PFID), | ||
1831 | + (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VFID), | ||
1832 | + !!GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VF_VALID), | ||
1833 | + tmp, | ||
1834 | + !!GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_WAS_ERR), | ||
1835 | + !!GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_BME), | ||
1836 | + !!GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_FID_EN)); | ||
1837 | + | ||
1838 | + if (hw_init) | ||
1839 | + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "%s\n", msg); | ||
1840 | + else | ||
1841 | + DP_NOTICE(p_hwfn, "%s\n", msg); | ||
1842 | } | ||
1843 | |||
1844 | tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_RD_DETAILS2); | ||
1845 | @@ -320,8 +322,14 @@ int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, | ||
1846 | } | ||
1847 | |||
1848 | tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_WR_DETAILS_ICPL); | ||
1849 | - if (tmp & PGLUE_ATTENTION_ICPL_VALID) | ||
1850 | - DP_NOTICE(p_hwfn, "ICPL error - %08x\n", tmp); | ||
1851 | + if (tmp & PGLUE_ATTENTION_ICPL_VALID) { | ||
1852 | + snprintf(msg, sizeof(msg), "ICPL error - %08x", tmp); | ||
1853 | + | ||
1854 | + if (hw_init) | ||
1855 | + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "%s\n", msg); | ||
1856 | + else | ||
1857 | + DP_NOTICE(p_hwfn, "%s\n", msg); | ||
1858 | + } | ||
1859 | |||
1860 | tmp = qed_rd(p_hwfn, p_ptt, PGLUE_B_REG_MASTER_ZLR_ERR_DETAILS); | ||
1861 | if (tmp & PGLUE_ATTENTION_ZLR_VALID) { | ||
1862 | @@ -360,7 +368,7 @@ int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, | ||
1863 | |||
1864 | static int qed_pglueb_rbc_attn_cb(struct qed_hwfn *p_hwfn) | ||
1865 | { | ||
1866 | - return qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_dpc_ptt); | ||
1867 | + return qed_pglueb_rbc_attn_handler(p_hwfn, p_hwfn->p_dpc_ptt, false); | ||
1868 | } | ||
1869 | |||
1870 | #define QED_DORQ_ATTENTION_REASON_MASK (0xfffff) | ||
1871 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.h b/drivers/net/ethernet/qlogic/qed/qed_int.h | ||
1872 | index d473b522afc5..ba5cfebf2d0d 100644 | ||
1873 | --- a/drivers/net/ethernet/qlogic/qed/qed_int.h | ||
1874 | +++ b/drivers/net/ethernet/qlogic/qed/qed_int.h | ||
1875 | @@ -431,7 +431,7 @@ int qed_int_set_timer_res(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, | ||
1876 | |||
1877 | #define QED_MAPPING_MEMORY_SIZE(dev) (NUM_OF_SBS(dev)) | ||
1878 | |||
1879 | -int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, | ||
1880 | - struct qed_ptt *p_ptt); | ||
1881 | +int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, | ||
1882 | + bool hw_init); | ||
1883 | |||
1884 | #endif | ||
1885 | diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c | ||
1886 | index 3a6761131f4c..2248d2674612 100644 | ||
1887 | --- a/drivers/net/ethernet/smsc/smc91x.c | ||
1888 | +++ b/drivers/net/ethernet/smsc/smc91x.c | ||
1889 | @@ -2274,7 +2274,7 @@ static int smc_drv_probe(struct platform_device *pdev) | ||
1890 | ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, | ||
1891 | "power", 0, 0, 100); | ||
1892 | if (ret) | ||
1893 | - return ret; | ||
1894 | + goto out_free_netdev; | ||
1895 | |||
1896 | /* | ||
1897 | * Optional reset GPIO configured? Minimum 100 ns reset needed | ||
1898 | @@ -2283,7 +2283,7 @@ static int smc_drv_probe(struct platform_device *pdev) | ||
1899 | ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, | ||
1900 | "reset", 0, 0, 100); | ||
1901 | if (ret) | ||
1902 | - return ret; | ||
1903 | + goto out_free_netdev; | ||
1904 | |||
1905 | /* | ||
1906 | * Need to wait for optional EEPROM to load, max 750 us according | ||
1907 | diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c | ||
1908 | index 38d39c4b5ac8..603d54f83399 100644 | ||
1909 | --- a/drivers/net/ethernet/socionext/sni_ave.c | ||
1910 | +++ b/drivers/net/ethernet/socionext/sni_ave.c | ||
1911 | @@ -1191,7 +1191,7 @@ static int ave_init(struct net_device *ndev) | ||
1912 | ret = regmap_update_bits(priv->regmap, SG_ETPINMODE, | ||
1913 | priv->pinmode_mask, priv->pinmode_val); | ||
1914 | if (ret) | ||
1915 | - return ret; | ||
1916 | + goto out_reset_assert; | ||
1917 | |||
1918 | ave_global_reset(ndev); | ||
1919 | |||
1920 | diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c | ||
1921 | index 19d9d78a6df2..adfdf6260b26 100644 | ||
1922 | --- a/drivers/net/geneve.c | ||
1923 | +++ b/drivers/net/geneve.c | ||
1924 | @@ -1615,11 +1615,11 @@ static int geneve_changelink(struct net_device *dev, struct nlattr *tb[], | ||
1925 | struct netlink_ext_ack *extack) | ||
1926 | { | ||
1927 | struct geneve_dev *geneve = netdev_priv(dev); | ||
1928 | + enum ifla_geneve_df df = geneve->df; | ||
1929 | struct geneve_sock *gs4, *gs6; | ||
1930 | struct ip_tunnel_info info; | ||
1931 | bool metadata; | ||
1932 | bool use_udp6_rx_checksums; | ||
1933 | - enum ifla_geneve_df df; | ||
1934 | bool ttl_inherit; | ||
1935 | int err; | ||
1936 | |||
1937 | diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c | ||
1938 | index 2a6ec5394966..a4b3fce69ecd 100644 | ||
1939 | --- a/drivers/net/hippi/rrunner.c | ||
1940 | +++ b/drivers/net/hippi/rrunner.c | ||
1941 | @@ -1242,7 +1242,7 @@ static int rr_open(struct net_device *dev) | ||
1942 | rrpriv->info = NULL; | ||
1943 | } | ||
1944 | if (rrpriv->rx_ctrl) { | ||
1945 | - pci_free_consistent(pdev, sizeof(struct ring_ctrl), | ||
1946 | + pci_free_consistent(pdev, 256 * sizeof(struct ring_ctrl), | ||
1947 | rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma); | ||
1948 | rrpriv->rx_ctrl = NULL; | ||
1949 | } | ||
1950 | diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c | ||
1951 | index 5a37514e4234..8dbccec6ac86 100644 | ||
1952 | --- a/drivers/net/ieee802154/adf7242.c | ||
1953 | +++ b/drivers/net/ieee802154/adf7242.c | ||
1954 | @@ -1262,7 +1262,7 @@ static int adf7242_probe(struct spi_device *spi) | ||
1955 | WQ_MEM_RECLAIM); | ||
1956 | if (unlikely(!lp->wqueue)) { | ||
1957 | ret = -ENOMEM; | ||
1958 | - goto err_hw_init; | ||
1959 | + goto err_alloc_wq; | ||
1960 | } | ||
1961 | |||
1962 | ret = adf7242_hw_init(lp); | ||
1963 | @@ -1294,6 +1294,8 @@ static int adf7242_probe(struct spi_device *spi) | ||
1964 | return ret; | ||
1965 | |||
1966 | err_hw_init: | ||
1967 | + destroy_workqueue(lp->wqueue); | ||
1968 | +err_alloc_wq: | ||
1969 | mutex_destroy(&lp->bmux); | ||
1970 | ieee802154_free_hw(lp->hw); | ||
1971 | |||
1972 | diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c | ||
1973 | index 55f57f76d01b..a6bbe93f29ef 100644 | ||
1974 | --- a/drivers/net/netdevsim/netdev.c | ||
1975 | +++ b/drivers/net/netdevsim/netdev.c | ||
1976 | @@ -301,7 +301,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) | ||
1977 | rtnl_lock(); | ||
1978 | err = nsim_bpf_init(ns); | ||
1979 | if (err) | ||
1980 | - goto err_free_netdev; | ||
1981 | + goto err_rtnl_unlock; | ||
1982 | |||
1983 | nsim_ipsec_init(ns); | ||
1984 | |||
1985 | @@ -315,8 +315,8 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) | ||
1986 | err_ipsec_teardown: | ||
1987 | nsim_ipsec_teardown(ns); | ||
1988 | nsim_bpf_uninit(ns); | ||
1989 | +err_rtnl_unlock: | ||
1990 | rtnl_unlock(); | ||
1991 | -err_free_netdev: | ||
1992 | free_netdev(dev); | ||
1993 | return ERR_PTR(err); | ||
1994 | } | ||
1995 | diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c | ||
1996 | index 1c75b2627ca8..7d845117abb0 100644 | ||
1997 | --- a/drivers/net/phy/dp83640.c | ||
1998 | +++ b/drivers/net/phy/dp83640.c | ||
1999 | @@ -1348,6 +1348,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) | ||
2000 | dp83640->hwts_rx_en = 1; | ||
2001 | dp83640->layer = PTP_CLASS_L4; | ||
2002 | dp83640->version = PTP_CLASS_V1; | ||
2003 | + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; | ||
2004 | break; | ||
2005 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: | ||
2006 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: | ||
2007 | @@ -1355,6 +1356,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) | ||
2008 | dp83640->hwts_rx_en = 1; | ||
2009 | dp83640->layer = PTP_CLASS_L4; | ||
2010 | dp83640->version = PTP_CLASS_V2; | ||
2011 | + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; | ||
2012 | break; | ||
2013 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: | ||
2014 | case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: | ||
2015 | @@ -1362,6 +1364,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) | ||
2016 | dp83640->hwts_rx_en = 1; | ||
2017 | dp83640->layer = PTP_CLASS_L2; | ||
2018 | dp83640->version = PTP_CLASS_V2; | ||
2019 | + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; | ||
2020 | break; | ||
2021 | case HWTSTAMP_FILTER_PTP_V2_EVENT: | ||
2022 | case HWTSTAMP_FILTER_PTP_V2_SYNC: | ||
2023 | @@ -1369,6 +1372,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) | ||
2024 | dp83640->hwts_rx_en = 1; | ||
2025 | dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2; | ||
2026 | dp83640->version = PTP_CLASS_V2; | ||
2027 | + cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; | ||
2028 | break; | ||
2029 | default: | ||
2030 | return -ERANGE; | ||
2031 | diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c | ||
2032 | index af3994e0853b..6101d82102e7 100644 | ||
2033 | --- a/drivers/net/usb/ax88172a.c | ||
2034 | +++ b/drivers/net/usb/ax88172a.c | ||
2035 | @@ -198,6 +198,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) | ||
2036 | ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); | ||
2037 | if (ret < ETH_ALEN) { | ||
2038 | netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); | ||
2039 | + ret = -EIO; | ||
2040 | goto free; | ||
2041 | } | ||
2042 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | ||
2043 | diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c | ||
2044 | index 0f1217b506ad..5a6f27298b90 100644 | ||
2045 | --- a/drivers/net/wan/lapbether.c | ||
2046 | +++ b/drivers/net/wan/lapbether.c | ||
2047 | @@ -303,7 +303,6 @@ static void lapbeth_setup(struct net_device *dev) | ||
2048 | dev->netdev_ops = &lapbeth_netdev_ops; | ||
2049 | dev->needs_free_netdev = true; | ||
2050 | dev->type = ARPHRD_X25; | ||
2051 | - dev->hard_header_len = 3; | ||
2052 | dev->mtu = 1000; | ||
2053 | dev->addr_len = 0; | ||
2054 | } | ||
2055 | @@ -324,6 +323,14 @@ static int lapbeth_new_device(struct net_device *dev) | ||
2056 | if (!ndev) | ||
2057 | goto out; | ||
2058 | |||
2059 | + /* When transmitting data: | ||
2060 | + * first this driver removes a pseudo header of 1 byte, | ||
2061 | + * then the lapb module prepends an LAPB header of at most 3 bytes, | ||
2062 | + * then this driver prepends a length field of 2 bytes, | ||
2063 | + * then the underlying Ethernet device prepends its own header. | ||
2064 | + */ | ||
2065 | + ndev->hard_header_len = -1 + 3 + 2 + dev->hard_header_len; | ||
2066 | + | ||
2067 | lapbeth = netdev_priv(ndev); | ||
2068 | lapbeth->axdev = ndev; | ||
2069 | |||
2070 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
2071 | index 6049d3766c64..3f563e02d17d 100644 | ||
2072 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
2073 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
2074 | @@ -643,9 +643,9 @@ err: | ||
2075 | |||
2076 | static void ath9k_hif_usb_rx_cb(struct urb *urb) | ||
2077 | { | ||
2078 | - struct sk_buff *skb = (struct sk_buff *) urb->context; | ||
2079 | - struct hif_device_usb *hif_dev = | ||
2080 | - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); | ||
2081 | + struct rx_buf *rx_buf = (struct rx_buf *)urb->context; | ||
2082 | + struct hif_device_usb *hif_dev = rx_buf->hif_dev; | ||
2083 | + struct sk_buff *skb = rx_buf->skb; | ||
2084 | int ret; | ||
2085 | |||
2086 | if (!skb) | ||
2087 | @@ -685,14 +685,15 @@ resubmit: | ||
2088 | return; | ||
2089 | free: | ||
2090 | kfree_skb(skb); | ||
2091 | + kfree(rx_buf); | ||
2092 | } | ||
2093 | |||
2094 | static void ath9k_hif_usb_reg_in_cb(struct urb *urb) | ||
2095 | { | ||
2096 | - struct sk_buff *skb = (struct sk_buff *) urb->context; | ||
2097 | + struct rx_buf *rx_buf = (struct rx_buf *)urb->context; | ||
2098 | + struct hif_device_usb *hif_dev = rx_buf->hif_dev; | ||
2099 | + struct sk_buff *skb = rx_buf->skb; | ||
2100 | struct sk_buff *nskb; | ||
2101 | - struct hif_device_usb *hif_dev = | ||
2102 | - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); | ||
2103 | int ret; | ||
2104 | |||
2105 | if (!skb) | ||
2106 | @@ -732,11 +733,13 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) | ||
2107 | return; | ||
2108 | } | ||
2109 | |||
2110 | + rx_buf->skb = nskb; | ||
2111 | + | ||
2112 | usb_fill_int_urb(urb, hif_dev->udev, | ||
2113 | usb_rcvintpipe(hif_dev->udev, | ||
2114 | USB_REG_IN_PIPE), | ||
2115 | nskb->data, MAX_REG_IN_BUF_SIZE, | ||
2116 | - ath9k_hif_usb_reg_in_cb, nskb, 1); | ||
2117 | + ath9k_hif_usb_reg_in_cb, rx_buf, 1); | ||
2118 | } | ||
2119 | |||
2120 | resubmit: | ||
2121 | @@ -750,6 +753,7 @@ resubmit: | ||
2122 | return; | ||
2123 | free: | ||
2124 | kfree_skb(skb); | ||
2125 | + kfree(rx_buf); | ||
2126 | urb->context = NULL; | ||
2127 | } | ||
2128 | |||
2129 | @@ -795,7 +799,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) | ||
2130 | init_usb_anchor(&hif_dev->mgmt_submitted); | ||
2131 | |||
2132 | for (i = 0; i < MAX_TX_URB_NUM; i++) { | ||
2133 | - tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL); | ||
2134 | + tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL); | ||
2135 | if (!tx_buf) | ||
2136 | goto err; | ||
2137 | |||
2138 | @@ -832,8 +836,9 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2139 | |||
2140 | static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2141 | { | ||
2142 | - struct urb *urb = NULL; | ||
2143 | + struct rx_buf *rx_buf = NULL; | ||
2144 | struct sk_buff *skb = NULL; | ||
2145 | + struct urb *urb = NULL; | ||
2146 | int i, ret; | ||
2147 | |||
2148 | init_usb_anchor(&hif_dev->rx_submitted); | ||
2149 | @@ -841,6 +846,12 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2150 | |||
2151 | for (i = 0; i < MAX_RX_URB_NUM; i++) { | ||
2152 | |||
2153 | + rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); | ||
2154 | + if (!rx_buf) { | ||
2155 | + ret = -ENOMEM; | ||
2156 | + goto err_rxb; | ||
2157 | + } | ||
2158 | + | ||
2159 | /* Allocate URB */ | ||
2160 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
2161 | if (urb == NULL) { | ||
2162 | @@ -855,11 +866,14 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2163 | goto err_skb; | ||
2164 | } | ||
2165 | |||
2166 | + rx_buf->hif_dev = hif_dev; | ||
2167 | + rx_buf->skb = skb; | ||
2168 | + | ||
2169 | usb_fill_bulk_urb(urb, hif_dev->udev, | ||
2170 | usb_rcvbulkpipe(hif_dev->udev, | ||
2171 | USB_WLAN_RX_PIPE), | ||
2172 | skb->data, MAX_RX_BUF_SIZE, | ||
2173 | - ath9k_hif_usb_rx_cb, skb); | ||
2174 | + ath9k_hif_usb_rx_cb, rx_buf); | ||
2175 | |||
2176 | /* Anchor URB */ | ||
2177 | usb_anchor_urb(urb, &hif_dev->rx_submitted); | ||
2178 | @@ -885,6 +899,8 @@ err_submit: | ||
2179 | err_skb: | ||
2180 | usb_free_urb(urb); | ||
2181 | err_urb: | ||
2182 | + kfree(rx_buf); | ||
2183 | +err_rxb: | ||
2184 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); | ||
2185 | return ret; | ||
2186 | } | ||
2187 | @@ -896,14 +912,21 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev) | ||
2188 | |||
2189 | static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) | ||
2190 | { | ||
2191 | - struct urb *urb = NULL; | ||
2192 | + struct rx_buf *rx_buf = NULL; | ||
2193 | struct sk_buff *skb = NULL; | ||
2194 | + struct urb *urb = NULL; | ||
2195 | int i, ret; | ||
2196 | |||
2197 | init_usb_anchor(&hif_dev->reg_in_submitted); | ||
2198 | |||
2199 | for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { | ||
2200 | |||
2201 | + rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); | ||
2202 | + if (!rx_buf) { | ||
2203 | + ret = -ENOMEM; | ||
2204 | + goto err_rxb; | ||
2205 | + } | ||
2206 | + | ||
2207 | /* Allocate URB */ | ||
2208 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
2209 | if (urb == NULL) { | ||
2210 | @@ -918,11 +941,14 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) | ||
2211 | goto err_skb; | ||
2212 | } | ||
2213 | |||
2214 | + rx_buf->hif_dev = hif_dev; | ||
2215 | + rx_buf->skb = skb; | ||
2216 | + | ||
2217 | usb_fill_int_urb(urb, hif_dev->udev, | ||
2218 | usb_rcvintpipe(hif_dev->udev, | ||
2219 | USB_REG_IN_PIPE), | ||
2220 | skb->data, MAX_REG_IN_BUF_SIZE, | ||
2221 | - ath9k_hif_usb_reg_in_cb, skb, 1); | ||
2222 | + ath9k_hif_usb_reg_in_cb, rx_buf, 1); | ||
2223 | |||
2224 | /* Anchor URB */ | ||
2225 | usb_anchor_urb(urb, &hif_dev->reg_in_submitted); | ||
2226 | @@ -948,6 +974,8 @@ err_submit: | ||
2227 | err_skb: | ||
2228 | usb_free_urb(urb); | ||
2229 | err_urb: | ||
2230 | + kfree(rx_buf); | ||
2231 | +err_rxb: | ||
2232 | ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); | ||
2233 | return ret; | ||
2234 | } | ||
2235 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h | ||
2236 | index a94e7e1c86e9..5985aa15ca93 100644 | ||
2237 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.h | ||
2238 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h | ||
2239 | @@ -86,6 +86,11 @@ struct tx_buf { | ||
2240 | struct list_head list; | ||
2241 | }; | ||
2242 | |||
2243 | +struct rx_buf { | ||
2244 | + struct sk_buff *skb; | ||
2245 | + struct hif_device_usb *hif_dev; | ||
2246 | +}; | ||
2247 | + | ||
2248 | #define HIF_USB_TX_STOP BIT(0) | ||
2249 | #define HIF_USB_TX_FLUSH BIT(1) | ||
2250 | |||
2251 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | ||
2252 | index 41f62793a57c..a36aa9e85e0b 100644 | ||
2253 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | ||
2254 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | ||
2255 | @@ -1184,17 +1184,15 @@ static int iwl_mvm_inactivity_check(struct iwl_mvm *mvm, u8 alloc_for_sta) | ||
2256 | for_each_set_bit(i, &changetid_queues, IWL_MAX_HW_QUEUES) | ||
2257 | iwl_mvm_change_queue_tid(mvm, i); | ||
2258 | |||
2259 | + rcu_read_unlock(); | ||
2260 | + | ||
2261 | if (free_queue >= 0 && alloc_for_sta != IWL_MVM_INVALID_STA) { | ||
2262 | ret = iwl_mvm_free_inactive_queue(mvm, free_queue, queue_owner, | ||
2263 | alloc_for_sta); | ||
2264 | - if (ret) { | ||
2265 | - rcu_read_unlock(); | ||
2266 | + if (ret) | ||
2267 | return ret; | ||
2268 | - } | ||
2269 | } | ||
2270 | |||
2271 | - rcu_read_unlock(); | ||
2272 | - | ||
2273 | return free_queue; | ||
2274 | } | ||
2275 | |||
2276 | diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c | ||
2277 | index 87348ecfe3fc..7c24c0aedad4 100644 | ||
2278 | --- a/drivers/pci/controller/vmd.c | ||
2279 | +++ b/drivers/pci/controller/vmd.c | ||
2280 | @@ -680,9 +680,10 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) | ||
2281 | |||
2282 | vmd->irq_domain = pci_msi_create_irq_domain(fn, &vmd_msi_domain_info, | ||
2283 | x86_vector_domain); | ||
2284 | - irq_domain_free_fwnode(fn); | ||
2285 | - if (!vmd->irq_domain) | ||
2286 | + if (!vmd->irq_domain) { | ||
2287 | + irq_domain_free_fwnode(fn); | ||
2288 | return -ENODEV; | ||
2289 | + } | ||
2290 | |||
2291 | pci_add_resource(&resources, &vmd->resources[0]); | ||
2292 | pci_add_resource_offset(&resources, &vmd->resources[1], offset[0]); | ||
2293 | diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c | ||
2294 | index 08f7b1ed8c62..b1b2c8ddbc92 100644 | ||
2295 | --- a/drivers/pci/pci.c | ||
2296 | +++ b/drivers/pci/pci.c | ||
2297 | @@ -4610,8 +4610,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) | ||
2298 | * pcie_wait_for_link_delay - Wait until link is active or inactive | ||
2299 | * @pdev: Bridge device | ||
2300 | * @active: waiting for active or inactive? | ||
2301 | - * @delay: Delay to wait after link has become active (in ms). Specify %0 | ||
2302 | - * for no delay. | ||
2303 | + * @delay: Delay to wait after link has become active (in ms) | ||
2304 | * | ||
2305 | * Use this to wait till link becomes active or inactive. | ||
2306 | */ | ||
2307 | @@ -4652,7 +4651,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, | ||
2308 | msleep(10); | ||
2309 | timeout -= 10; | ||
2310 | } | ||
2311 | - if (active && ret && delay) | ||
2312 | + if (active && ret) | ||
2313 | msleep(delay); | ||
2314 | else if (ret != active) | ||
2315 | pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", | ||
2316 | @@ -4773,28 +4772,17 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) | ||
2317 | if (!pcie_downstream_port(dev)) | ||
2318 | return; | ||
2319 | |||
2320 | - /* | ||
2321 | - * Per PCIe r5.0, sec 6.6.1, for downstream ports that support | ||
2322 | - * speeds > 5 GT/s, we must wait for link training to complete | ||
2323 | - * before the mandatory delay. | ||
2324 | - * | ||
2325 | - * We can only tell when link training completes via DLL Link | ||
2326 | - * Active, which is required for downstream ports that support | ||
2327 | - * speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common | ||
2328 | - * devices do not implement Link Active reporting even when it's | ||
2329 | - * required, so we'll check for that directly instead of checking | ||
2330 | - * the supported link speed. We assume devices without Link Active | ||
2331 | - * reporting can train in 100 ms regardless of speed. | ||
2332 | - */ | ||
2333 | - if (dev->link_active_reporting) { | ||
2334 | - pci_dbg(dev, "waiting for link to train\n"); | ||
2335 | - if (!pcie_wait_for_link_delay(dev, true, 0)) { | ||
2336 | + if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { | ||
2337 | + pci_dbg(dev, "waiting %d ms for downstream link\n", delay); | ||
2338 | + msleep(delay); | ||
2339 | + } else { | ||
2340 | + pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", | ||
2341 | + delay); | ||
2342 | + if (!pcie_wait_for_link_delay(dev, true, delay)) { | ||
2343 | /* Did not train, no need to wait any further */ | ||
2344 | return; | ||
2345 | } | ||
2346 | } | ||
2347 | - pci_dbg(child, "waiting %d ms to become accessible\n", delay); | ||
2348 | - msleep(delay); | ||
2349 | |||
2350 | if (!pci_device_is_present(child)) { | ||
2351 | pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); | ||
2352 | diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c | ||
2353 | index 8f8606b9bc9e..aca4570f78a8 100644 | ||
2354 | --- a/drivers/perf/arm-cci.c | ||
2355 | +++ b/drivers/perf/arm-cci.c | ||
2356 | @@ -1720,6 +1720,7 @@ static struct platform_driver cci_pmu_driver = { | ||
2357 | .driver = { | ||
2358 | .name = DRIVER_NAME, | ||
2359 | .of_match_table = arm_cci_pmu_matches, | ||
2360 | + .suppress_bind_attrs = true, | ||
2361 | }, | ||
2362 | .probe = cci_pmu_probe, | ||
2363 | .remove = cci_pmu_remove, | ||
2364 | diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c | ||
2365 | index 6fc0273b6129..336948b41bd1 100644 | ||
2366 | --- a/drivers/perf/arm-ccn.c | ||
2367 | +++ b/drivers/perf/arm-ccn.c | ||
2368 | @@ -1545,6 +1545,7 @@ static struct platform_driver arm_ccn_driver = { | ||
2369 | .driver = { | ||
2370 | .name = "arm-ccn", | ||
2371 | .of_match_table = arm_ccn_match, | ||
2372 | + .suppress_bind_attrs = true, | ||
2373 | }, | ||
2374 | .probe = arm_ccn_probe, | ||
2375 | .remove = arm_ccn_remove, | ||
2376 | diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c | ||
2377 | index 70968c8c09d7..4594e2ed13d5 100644 | ||
2378 | --- a/drivers/perf/arm_dsu_pmu.c | ||
2379 | +++ b/drivers/perf/arm_dsu_pmu.c | ||
2380 | @@ -759,6 +759,7 @@ static struct platform_driver dsu_pmu_driver = { | ||
2381 | .driver = { | ||
2382 | .name = DRVNAME, | ||
2383 | .of_match_table = of_match_ptr(dsu_pmu_of_match), | ||
2384 | + .suppress_bind_attrs = true, | ||
2385 | }, | ||
2386 | .probe = dsu_pmu_device_probe, | ||
2387 | .remove = dsu_pmu_device_remove, | ||
2388 | diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c | ||
2389 | index 3269232ff570..9cdd89b29334 100644 | ||
2390 | --- a/drivers/perf/arm_smmuv3_pmu.c | ||
2391 | +++ b/drivers/perf/arm_smmuv3_pmu.c | ||
2392 | @@ -742,6 +742,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) | ||
2393 | platform_set_drvdata(pdev, smmu_pmu); | ||
2394 | |||
2395 | smmu_pmu->pmu = (struct pmu) { | ||
2396 | + .module = THIS_MODULE, | ||
2397 | .task_ctx_nr = perf_invalid_context, | ||
2398 | .pmu_enable = smmu_pmu_enable, | ||
2399 | .pmu_disable = smmu_pmu_disable, | ||
2400 | @@ -860,6 +861,7 @@ static void smmu_pmu_shutdown(struct platform_device *pdev) | ||
2401 | static struct platform_driver smmu_pmu_driver = { | ||
2402 | .driver = { | ||
2403 | .name = "arm-smmu-v3-pmcg", | ||
2404 | + .suppress_bind_attrs = true, | ||
2405 | }, | ||
2406 | .probe = smmu_pmu_probe, | ||
2407 | .remove = smmu_pmu_remove, | ||
2408 | diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c | ||
2409 | index 4e4984a55cd1..079701e8de18 100644 | ||
2410 | --- a/drivers/perf/arm_spe_pmu.c | ||
2411 | +++ b/drivers/perf/arm_spe_pmu.c | ||
2412 | @@ -1228,6 +1228,7 @@ static struct platform_driver arm_spe_pmu_driver = { | ||
2413 | .driver = { | ||
2414 | .name = DRVNAME, | ||
2415 | .of_match_table = of_match_ptr(arm_spe_pmu_of_match), | ||
2416 | + .suppress_bind_attrs = true, | ||
2417 | }, | ||
2418 | .probe = arm_spe_pmu_device_probe, | ||
2419 | .remove = arm_spe_pmu_device_remove, | ||
2420 | diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c | ||
2421 | index 6eef47de8fcc..09f44c6e2eaf 100644 | ||
2422 | --- a/drivers/perf/fsl_imx8_ddr_perf.c | ||
2423 | +++ b/drivers/perf/fsl_imx8_ddr_perf.c | ||
2424 | @@ -451,6 +451,7 @@ static int ddr_perf_init(struct ddr_pmu *pmu, void __iomem *base, | ||
2425 | { | ||
2426 | *pmu = (struct ddr_pmu) { | ||
2427 | .pmu = (struct pmu) { | ||
2428 | + .module = THIS_MODULE, | ||
2429 | .capabilities = PERF_PMU_CAP_NO_EXCLUDE, | ||
2430 | .task_ctx_nr = perf_invalid_context, | ||
2431 | .attr_groups = attr_groups, | ||
2432 | @@ -645,6 +646,7 @@ static struct platform_driver imx_ddr_pmu_driver = { | ||
2433 | .driver = { | ||
2434 | .name = "imx-ddr-pmu", | ||
2435 | .of_match_table = imx_ddr_pmu_dt_ids, | ||
2436 | + .suppress_bind_attrs = true, | ||
2437 | }, | ||
2438 | .probe = ddr_perf_probe, | ||
2439 | .remove = ddr_perf_remove, | ||
2440 | diff --git a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | ||
2441 | index e42d4464c2cf..b79c96b14328 100644 | ||
2442 | --- a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | ||
2443 | +++ b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | ||
2444 | @@ -381,6 +381,7 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev) | ||
2445 | ddrc_pmu->sccl_id, ddrc_pmu->index_id); | ||
2446 | ddrc_pmu->pmu = (struct pmu) { | ||
2447 | .name = name, | ||
2448 | + .module = THIS_MODULE, | ||
2449 | .task_ctx_nr = perf_invalid_context, | ||
2450 | .event_init = hisi_uncore_pmu_event_init, | ||
2451 | .pmu_enable = hisi_uncore_pmu_enable, | ||
2452 | @@ -419,6 +420,7 @@ static struct platform_driver hisi_ddrc_pmu_driver = { | ||
2453 | .driver = { | ||
2454 | .name = "hisi_ddrc_pmu", | ||
2455 | .acpi_match_table = ACPI_PTR(hisi_ddrc_pmu_acpi_match), | ||
2456 | + .suppress_bind_attrs = true, | ||
2457 | }, | ||
2458 | .probe = hisi_ddrc_pmu_probe, | ||
2459 | .remove = hisi_ddrc_pmu_remove, | ||
2460 | diff --git a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | ||
2461 | index 0d6325d6a4ec..78865b4ac4a6 100644 | ||
2462 | --- a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | ||
2463 | +++ b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | ||
2464 | @@ -392,6 +392,7 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev) | ||
2465 | hha_pmu->sccl_id, hha_pmu->index_id); | ||
2466 | hha_pmu->pmu = (struct pmu) { | ||
2467 | .name = name, | ||
2468 | + .module = THIS_MODULE, | ||
2469 | .task_ctx_nr = perf_invalid_context, | ||
2470 | .event_init = hisi_uncore_pmu_event_init, | ||
2471 | .pmu_enable = hisi_uncore_pmu_enable, | ||
2472 | @@ -430,6 +431,7 @@ static struct platform_driver hisi_hha_pmu_driver = { | ||
2473 | .driver = { | ||
2474 | .name = "hisi_hha_pmu", | ||
2475 | .acpi_match_table = ACPI_PTR(hisi_hha_pmu_acpi_match), | ||
2476 | + .suppress_bind_attrs = true, | ||
2477 | }, | ||
2478 | .probe = hisi_hha_pmu_probe, | ||
2479 | .remove = hisi_hha_pmu_remove, | ||
2480 | diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | ||
2481 | index c5b0950c2a7a..9dd50c3bc74e 100644 | ||
2482 | --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | ||
2483 | +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | ||
2484 | @@ -382,6 +382,7 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev) | ||
2485 | l3c_pmu->sccl_id, l3c_pmu->index_id); | ||
2486 | l3c_pmu->pmu = (struct pmu) { | ||
2487 | .name = name, | ||
2488 | + .module = THIS_MODULE, | ||
2489 | .task_ctx_nr = perf_invalid_context, | ||
2490 | .event_init = hisi_uncore_pmu_event_init, | ||
2491 | .pmu_enable = hisi_uncore_pmu_enable, | ||
2492 | @@ -420,6 +421,7 @@ static struct platform_driver hisi_l3c_pmu_driver = { | ||
2493 | .driver = { | ||
2494 | .name = "hisi_l3c_pmu", | ||
2495 | .acpi_match_table = ACPI_PTR(hisi_l3c_pmu_acpi_match), | ||
2496 | + .suppress_bind_attrs = true, | ||
2497 | }, | ||
2498 | .probe = hisi_l3c_pmu_probe, | ||
2499 | .remove = hisi_l3c_pmu_remove, | ||
2500 | diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c | ||
2501 | index 21d6991dbe0b..4da37f650f98 100644 | ||
2502 | --- a/drivers/perf/qcom_l2_pmu.c | ||
2503 | +++ b/drivers/perf/qcom_l2_pmu.c | ||
2504 | @@ -1028,6 +1028,7 @@ static struct platform_driver l2_cache_pmu_driver = { | ||
2505 | .driver = { | ||
2506 | .name = "qcom-l2cache-pmu", | ||
2507 | .acpi_match_table = ACPI_PTR(l2_cache_pmu_acpi_match), | ||
2508 | + .suppress_bind_attrs = true, | ||
2509 | }, | ||
2510 | .probe = l2_cache_pmu_probe, | ||
2511 | .remove = l2_cache_pmu_remove, | ||
2512 | diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c | ||
2513 | index 656e830798d9..9ddb577c542b 100644 | ||
2514 | --- a/drivers/perf/qcom_l3_pmu.c | ||
2515 | +++ b/drivers/perf/qcom_l3_pmu.c | ||
2516 | @@ -814,6 +814,7 @@ static struct platform_driver qcom_l3_cache_pmu_driver = { | ||
2517 | .driver = { | ||
2518 | .name = "qcom-l3cache-pmu", | ||
2519 | .acpi_match_table = ACPI_PTR(qcom_l3_cache_pmu_acpi_match), | ||
2520 | + .suppress_bind_attrs = true, | ||
2521 | }, | ||
2522 | .probe = qcom_l3_cache_pmu_probe, | ||
2523 | }; | ||
2524 | diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c | ||
2525 | index 43d76c85da56..9e1c3c7eeba9 100644 | ||
2526 | --- a/drivers/perf/thunderx2_pmu.c | ||
2527 | +++ b/drivers/perf/thunderx2_pmu.c | ||
2528 | @@ -816,6 +816,7 @@ static struct platform_driver tx2_uncore_driver = { | ||
2529 | .driver = { | ||
2530 | .name = "tx2-uncore-pmu", | ||
2531 | .acpi_match_table = ACPI_PTR(tx2_uncore_acpi_match), | ||
2532 | + .suppress_bind_attrs = true, | ||
2533 | }, | ||
2534 | .probe = tx2_uncore_probe, | ||
2535 | .remove = tx2_uncore_remove, | ||
2536 | diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c | ||
2537 | index 7e328d6385c3..328aea9f6be3 100644 | ||
2538 | --- a/drivers/perf/xgene_pmu.c | ||
2539 | +++ b/drivers/perf/xgene_pmu.c | ||
2540 | @@ -1981,6 +1981,7 @@ static struct platform_driver xgene_pmu_driver = { | ||
2541 | .name = "xgene-pmu", | ||
2542 | .of_match_table = xgene_pmu_of_match, | ||
2543 | .acpi_match_table = ACPI_PTR(xgene_pmu_acpi_match), | ||
2544 | + .suppress_bind_attrs = true, | ||
2545 | }, | ||
2546 | }; | ||
2547 | |||
2548 | diff --git a/drivers/pinctrl/pinctrl-amd.h b/drivers/pinctrl/pinctrl-amd.h | ||
2549 | index 3e5760f1a715..d4a192df5fab 100644 | ||
2550 | --- a/drivers/pinctrl/pinctrl-amd.h | ||
2551 | +++ b/drivers/pinctrl/pinctrl-amd.h | ||
2552 | @@ -252,7 +252,7 @@ static const struct amd_pingroup kerncz_groups[] = { | ||
2553 | { | ||
2554 | .name = "uart0", | ||
2555 | .pins = uart0_pins, | ||
2556 | - .npins = 9, | ||
2557 | + .npins = 5, | ||
2558 | }, | ||
2559 | { | ||
2560 | .name = "uart1", | ||
2561 | diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c | ||
2562 | index b1f4a31ba1ee..ed83fb135bab 100644 | ||
2563 | --- a/drivers/platform/x86/asus-wmi.c | ||
2564 | +++ b/drivers/platform/x86/asus-wmi.c | ||
2565 | @@ -424,6 +424,7 @@ static int asus_wmi_battery_add(struct power_supply *battery) | ||
2566 | * battery is named BATT. | ||
2567 | */ | ||
2568 | if (strcmp(battery->desc->name, "BAT0") != 0 && | ||
2569 | + strcmp(battery->desc->name, "BAT1") != 0 && | ||
2570 | strcmp(battery->desc->name, "BATT") != 0) | ||
2571 | return -ENODEV; | ||
2572 | |||
2573 | diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_common.h b/drivers/platform/x86/intel_speed_select_if/isst_if_common.h | ||
2574 | index 1409a5bb5582..4f6f7f0761fc 100644 | ||
2575 | --- a/drivers/platform/x86/intel_speed_select_if/isst_if_common.h | ||
2576 | +++ b/drivers/platform/x86/intel_speed_select_if/isst_if_common.h | ||
2577 | @@ -13,6 +13,9 @@ | ||
2578 | #define INTEL_RAPL_PRIO_DEVID_0 0x3451 | ||
2579 | #define INTEL_CFG_MBOX_DEVID_0 0x3459 | ||
2580 | |||
2581 | +#define INTEL_RAPL_PRIO_DEVID_1 0x3251 | ||
2582 | +#define INTEL_CFG_MBOX_DEVID_1 0x3259 | ||
2583 | + | ||
2584 | /* | ||
2585 | * Validate maximum commands in a single request. | ||
2586 | * This is enough to handle command to every core in one ioctl, or all | ||
2587 | diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_mbox_pci.c b/drivers/platform/x86/intel_speed_select_if/isst_if_mbox_pci.c | ||
2588 | index de4169d0796b..9a055fd54053 100644 | ||
2589 | --- a/drivers/platform/x86/intel_speed_select_if/isst_if_mbox_pci.c | ||
2590 | +++ b/drivers/platform/x86/intel_speed_select_if/isst_if_mbox_pci.c | ||
2591 | @@ -148,6 +148,7 @@ static long isst_if_mbox_proc_cmd(u8 *cmd_ptr, int *write_only, int resume) | ||
2592 | |||
2593 | static const struct pci_device_id isst_if_mbox_ids[] = { | ||
2594 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_CFG_MBOX_DEVID_0)}, | ||
2595 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_CFG_MBOX_DEVID_1)}, | ||
2596 | { 0 }, | ||
2597 | }; | ||
2598 | MODULE_DEVICE_TABLE(pci, isst_if_mbox_ids); | ||
2599 | diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | ||
2600 | index ad8c7c0df4d9..e3778204b7a6 100644 | ||
2601 | --- a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | ||
2602 | +++ b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | ||
2603 | @@ -72,6 +72,7 @@ static long isst_if_mmio_rd_wr(u8 *cmd_ptr, int *write_only, int resume) | ||
2604 | |||
2605 | static const struct pci_device_id isst_if_ids[] = { | ||
2606 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_RAPL_PRIO_DEVID_0)}, | ||
2607 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, INTEL_RAPL_PRIO_DEVID_1)}, | ||
2608 | { 0 }, | ||
2609 | }; | ||
2610 | MODULE_DEVICE_TABLE(pci, isst_if_ids); | ||
2611 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c | ||
2612 | index b95f7d062ea4..d5a62fea8fe3 100644 | ||
2613 | --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c | ||
2614 | +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c | ||
2615 | @@ -2921,19 +2921,18 @@ BRM_status_show(struct device *cdev, struct device_attribute *attr, | ||
2616 | if (!ioc->is_warpdrive) { | ||
2617 | ioc_err(ioc, "%s: BRM attribute is only for warpdrive\n", | ||
2618 | __func__); | ||
2619 | - goto out; | ||
2620 | + return 0; | ||
2621 | } | ||
2622 | /* pci_access_mutex lock acquired by sysfs show path */ | ||
2623 | mutex_lock(&ioc->pci_access_mutex); | ||
2624 | - if (ioc->pci_error_recovery || ioc->remove_host) { | ||
2625 | - mutex_unlock(&ioc->pci_access_mutex); | ||
2626 | - return 0; | ||
2627 | - } | ||
2628 | + if (ioc->pci_error_recovery || ioc->remove_host) | ||
2629 | + goto out; | ||
2630 | |||
2631 | /* allocate upto GPIOVal 36 entries */ | ||
2632 | sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36); | ||
2633 | io_unit_pg3 = kzalloc(sz, GFP_KERNEL); | ||
2634 | if (!io_unit_pg3) { | ||
2635 | + rc = -ENOMEM; | ||
2636 | ioc_err(ioc, "%s: failed allocating memory for iounit_pg3: (%d) bytes\n", | ||
2637 | __func__, sz); | ||
2638 | goto out; | ||
2639 | @@ -2943,6 +2942,7 @@ BRM_status_show(struct device *cdev, struct device_attribute *attr, | ||
2640 | 0) { | ||
2641 | ioc_err(ioc, "%s: failed reading iounit_pg3\n", | ||
2642 | __func__); | ||
2643 | + rc = -EINVAL; | ||
2644 | goto out; | ||
2645 | } | ||
2646 | |||
2647 | @@ -2950,12 +2950,14 @@ BRM_status_show(struct device *cdev, struct device_attribute *attr, | ||
2648 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
2649 | ioc_err(ioc, "%s: iounit_pg3 failed with ioc_status(0x%04x)\n", | ||
2650 | __func__, ioc_status); | ||
2651 | + rc = -EINVAL; | ||
2652 | goto out; | ||
2653 | } | ||
2654 | |||
2655 | if (io_unit_pg3->GPIOCount < 25) { | ||
2656 | ioc_err(ioc, "%s: iounit_pg3->GPIOCount less than 25 entries, detected (%d) entries\n", | ||
2657 | __func__, io_unit_pg3->GPIOCount); | ||
2658 | + rc = -EINVAL; | ||
2659 | goto out; | ||
2660 | } | ||
2661 | |||
2662 | diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c | ||
2663 | index df14597752ec..fb5a7832353c 100644 | ||
2664 | --- a/drivers/scsi/scsi_devinfo.c | ||
2665 | +++ b/drivers/scsi/scsi_devinfo.c | ||
2666 | @@ -239,6 +239,7 @@ static struct { | ||
2667 | {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2668 | {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2669 | {"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2670 | + {"FUJITSU", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
2671 | {"SanDisk", "Cruzer Blade", NULL, BLIST_TRY_VPD_PAGES | | ||
2672 | BLIST_INQUIRY_36}, | ||
2673 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, | ||
2674 | diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c | ||
2675 | index 42f0550d6b11..6f41e4b5a2b8 100644 | ||
2676 | --- a/drivers/scsi/scsi_dh.c | ||
2677 | +++ b/drivers/scsi/scsi_dh.c | ||
2678 | @@ -63,6 +63,7 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { | ||
2679 | {"LSI", "INF-01-00", "rdac", }, | ||
2680 | {"ENGENIO", "INF-01-00", "rdac", }, | ||
2681 | {"LENOVO", "DE_Series", "rdac", }, | ||
2682 | + {"FUJITSU", "ETERNUS_AHB", "rdac", }, | ||
2683 | {NULL, NULL, NULL }, | ||
2684 | }; | ||
2685 | |||
2686 | diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c | ||
2687 | index f8661062ef95..f3d5b1bbd5aa 100644 | ||
2688 | --- a/drivers/scsi/scsi_transport_spi.c | ||
2689 | +++ b/drivers/scsi/scsi_transport_spi.c | ||
2690 | @@ -339,7 +339,7 @@ store_spi_transport_##field(struct device *dev, \ | ||
2691 | struct spi_transport_attrs *tp \ | ||
2692 | = (struct spi_transport_attrs *)&starget->starget_data; \ | ||
2693 | \ | ||
2694 | - if (i->f->set_##field) \ | ||
2695 | + if (!i->f->set_##field) \ | ||
2696 | return -EINVAL; \ | ||
2697 | val = simple_strtoul(buf, NULL, 0); \ | ||
2698 | if (val > tp->max_##field) \ | ||
2699 | diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c | ||
2700 | index ae2d1590a611..13e1b450f296 100644 | ||
2701 | --- a/drivers/soc/qcom/rpmh.c | ||
2702 | +++ b/drivers/soc/qcom/rpmh.c | ||
2703 | @@ -150,10 +150,10 @@ existing: | ||
2704 | break; | ||
2705 | } | ||
2706 | |||
2707 | - ctrlr->dirty = (req->sleep_val != old_sleep_val || | ||
2708 | - req->wake_val != old_wake_val) && | ||
2709 | - req->sleep_val != UINT_MAX && | ||
2710 | - req->wake_val != UINT_MAX; | ||
2711 | + ctrlr->dirty |= (req->sleep_val != old_sleep_val || | ||
2712 | + req->wake_val != old_wake_val) && | ||
2713 | + req->sleep_val != UINT_MAX && | ||
2714 | + req->wake_val != UINT_MAX; | ||
2715 | |||
2716 | unlock: | ||
2717 | spin_unlock_irqrestore(&ctrlr->cache_lock, flags); | ||
2718 | diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c | ||
2719 | index 6888a4dcff6d..8acf24f7c5d4 100644 | ||
2720 | --- a/drivers/spi/spi-mt65xx.c | ||
2721 | +++ b/drivers/spi/spi-mt65xx.c | ||
2722 | @@ -36,7 +36,6 @@ | ||
2723 | #define SPI_CFG0_SCK_LOW_OFFSET 8 | ||
2724 | #define SPI_CFG0_CS_HOLD_OFFSET 16 | ||
2725 | #define SPI_CFG0_CS_SETUP_OFFSET 24 | ||
2726 | -#define SPI_ADJUST_CFG0_SCK_LOW_OFFSET 16 | ||
2727 | #define SPI_ADJUST_CFG0_CS_HOLD_OFFSET 0 | ||
2728 | #define SPI_ADJUST_CFG0_CS_SETUP_OFFSET 16 | ||
2729 | |||
2730 | @@ -48,6 +47,8 @@ | ||
2731 | #define SPI_CFG1_CS_IDLE_MASK 0xff | ||
2732 | #define SPI_CFG1_PACKET_LOOP_MASK 0xff00 | ||
2733 | #define SPI_CFG1_PACKET_LENGTH_MASK 0x3ff0000 | ||
2734 | +#define SPI_CFG2_SCK_HIGH_OFFSET 0 | ||
2735 | +#define SPI_CFG2_SCK_LOW_OFFSET 16 | ||
2736 | |||
2737 | #define SPI_CMD_ACT BIT(0) | ||
2738 | #define SPI_CMD_RESUME BIT(1) | ||
2739 | @@ -279,7 +280,7 @@ static void mtk_spi_set_cs(struct spi_device *spi, bool enable) | ||
2740 | static void mtk_spi_prepare_transfer(struct spi_master *master, | ||
2741 | struct spi_transfer *xfer) | ||
2742 | { | ||
2743 | - u32 spi_clk_hz, div, sck_time, cs_time, reg_val = 0; | ||
2744 | + u32 spi_clk_hz, div, sck_time, cs_time, reg_val; | ||
2745 | struct mtk_spi *mdata = spi_master_get_devdata(master); | ||
2746 | |||
2747 | spi_clk_hz = clk_get_rate(mdata->spi_clk); | ||
2748 | @@ -292,18 +293,18 @@ static void mtk_spi_prepare_transfer(struct spi_master *master, | ||
2749 | cs_time = sck_time * 2; | ||
2750 | |||
2751 | if (mdata->dev_comp->enhance_timing) { | ||
2752 | + reg_val = (((sck_time - 1) & 0xffff) | ||
2753 | + << SPI_CFG2_SCK_HIGH_OFFSET); | ||
2754 | reg_val |= (((sck_time - 1) & 0xffff) | ||
2755 | - << SPI_CFG0_SCK_HIGH_OFFSET); | ||
2756 | - reg_val |= (((sck_time - 1) & 0xffff) | ||
2757 | - << SPI_ADJUST_CFG0_SCK_LOW_OFFSET); | ||
2758 | + << SPI_CFG2_SCK_LOW_OFFSET); | ||
2759 | writel(reg_val, mdata->base + SPI_CFG2_REG); | ||
2760 | - reg_val |= (((cs_time - 1) & 0xffff) | ||
2761 | + reg_val = (((cs_time - 1) & 0xffff) | ||
2762 | << SPI_ADJUST_CFG0_CS_HOLD_OFFSET); | ||
2763 | reg_val |= (((cs_time - 1) & 0xffff) | ||
2764 | << SPI_ADJUST_CFG0_CS_SETUP_OFFSET); | ||
2765 | writel(reg_val, mdata->base + SPI_CFG0_REG); | ||
2766 | } else { | ||
2767 | - reg_val |= (((sck_time - 1) & 0xff) | ||
2768 | + reg_val = (((sck_time - 1) & 0xff) | ||
2769 | << SPI_CFG0_SCK_HIGH_OFFSET); | ||
2770 | reg_val |= (((sck_time - 1) & 0xff) << SPI_CFG0_SCK_LOW_OFFSET); | ||
2771 | reg_val |= (((cs_time - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET); | ||
2772 | diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c | ||
2773 | index 560649be9d13..e035c9f757a1 100644 | ||
2774 | --- a/drivers/staging/comedi/drivers/addi_apci_1032.c | ||
2775 | +++ b/drivers/staging/comedi/drivers/addi_apci_1032.c | ||
2776 | @@ -106,14 +106,22 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, | ||
2777 | unsigned int *data) | ||
2778 | { | ||
2779 | struct apci1032_private *devpriv = dev->private; | ||
2780 | - unsigned int shift, oldmask; | ||
2781 | + unsigned int shift, oldmask, himask, lomask; | ||
2782 | |||
2783 | switch (data[0]) { | ||
2784 | case INSN_CONFIG_DIGITAL_TRIG: | ||
2785 | if (data[1] != 0) | ||
2786 | return -EINVAL; | ||
2787 | shift = data[3]; | ||
2788 | - oldmask = (1U << shift) - 1; | ||
2789 | + if (shift < 32) { | ||
2790 | + oldmask = (1U << shift) - 1; | ||
2791 | + himask = data[4] << shift; | ||
2792 | + lomask = data[5] << shift; | ||
2793 | + } else { | ||
2794 | + oldmask = 0xffffffffu; | ||
2795 | + himask = 0; | ||
2796 | + lomask = 0; | ||
2797 | + } | ||
2798 | switch (data[2]) { | ||
2799 | case COMEDI_DIGITAL_TRIG_DISABLE: | ||
2800 | devpriv->ctrl = 0; | ||
2801 | @@ -136,8 +144,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, | ||
2802 | devpriv->mode2 &= oldmask; | ||
2803 | } | ||
2804 | /* configure specified channels */ | ||
2805 | - devpriv->mode1 |= data[4] << shift; | ||
2806 | - devpriv->mode2 |= data[5] << shift; | ||
2807 | + devpriv->mode1 |= himask; | ||
2808 | + devpriv->mode2 |= lomask; | ||
2809 | break; | ||
2810 | case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: | ||
2811 | if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA | | ||
2812 | @@ -154,8 +162,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, | ||
2813 | devpriv->mode2 &= oldmask; | ||
2814 | } | ||
2815 | /* configure specified channels */ | ||
2816 | - devpriv->mode1 |= data[4] << shift; | ||
2817 | - devpriv->mode2 |= data[5] << shift; | ||
2818 | + devpriv->mode1 |= himask; | ||
2819 | + devpriv->mode2 |= lomask; | ||
2820 | break; | ||
2821 | default: | ||
2822 | return -EINVAL; | ||
2823 | diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c | ||
2824 | index 689acd69a1b9..816dd25b9d0e 100644 | ||
2825 | --- a/drivers/staging/comedi/drivers/addi_apci_1500.c | ||
2826 | +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c | ||
2827 | @@ -452,13 +452,14 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, | ||
2828 | struct apci1500_private *devpriv = dev->private; | ||
2829 | unsigned int trig = data[1]; | ||
2830 | unsigned int shift = data[3]; | ||
2831 | - unsigned int hi_mask = data[4] << shift; | ||
2832 | - unsigned int lo_mask = data[5] << shift; | ||
2833 | - unsigned int chan_mask = hi_mask | lo_mask; | ||
2834 | - unsigned int old_mask = (1 << shift) - 1; | ||
2835 | + unsigned int hi_mask; | ||
2836 | + unsigned int lo_mask; | ||
2837 | + unsigned int chan_mask; | ||
2838 | + unsigned int old_mask; | ||
2839 | unsigned int pm; | ||
2840 | unsigned int pt; | ||
2841 | unsigned int pp; | ||
2842 | + unsigned int invalid_chan; | ||
2843 | |||
2844 | if (trig > 1) { | ||
2845 | dev_dbg(dev->class_dev, | ||
2846 | @@ -466,7 +467,20 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, | ||
2847 | return -EINVAL; | ||
2848 | } | ||
2849 | |||
2850 | - if (chan_mask > 0xffff) { | ||
2851 | + if (shift <= 16) { | ||
2852 | + hi_mask = data[4] << shift; | ||
2853 | + lo_mask = data[5] << shift; | ||
2854 | + old_mask = (1U << shift) - 1; | ||
2855 | + invalid_chan = (data[4] | data[5]) >> (16 - shift); | ||
2856 | + } else { | ||
2857 | + hi_mask = 0; | ||
2858 | + lo_mask = 0; | ||
2859 | + old_mask = 0xffff; | ||
2860 | + invalid_chan = data[4] | data[5]; | ||
2861 | + } | ||
2862 | + chan_mask = hi_mask | lo_mask; | ||
2863 | + | ||
2864 | + if (invalid_chan) { | ||
2865 | dev_dbg(dev->class_dev, "invalid digital trigger channel\n"); | ||
2866 | return -EINVAL; | ||
2867 | } | ||
2868 | diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c | ||
2869 | index 10501fe6bb25..1268ba34be5f 100644 | ||
2870 | --- a/drivers/staging/comedi/drivers/addi_apci_1564.c | ||
2871 | +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c | ||
2872 | @@ -331,14 +331,22 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, | ||
2873 | unsigned int *data) | ||
2874 | { | ||
2875 | struct apci1564_private *devpriv = dev->private; | ||
2876 | - unsigned int shift, oldmask; | ||
2877 | + unsigned int shift, oldmask, himask, lomask; | ||
2878 | |||
2879 | switch (data[0]) { | ||
2880 | case INSN_CONFIG_DIGITAL_TRIG: | ||
2881 | if (data[1] != 0) | ||
2882 | return -EINVAL; | ||
2883 | shift = data[3]; | ||
2884 | - oldmask = (1U << shift) - 1; | ||
2885 | + if (shift < 32) { | ||
2886 | + oldmask = (1U << shift) - 1; | ||
2887 | + himask = data[4] << shift; | ||
2888 | + lomask = data[5] << shift; | ||
2889 | + } else { | ||
2890 | + oldmask = 0xffffffffu; | ||
2891 | + himask = 0; | ||
2892 | + lomask = 0; | ||
2893 | + } | ||
2894 | switch (data[2]) { | ||
2895 | case COMEDI_DIGITAL_TRIG_DISABLE: | ||
2896 | devpriv->ctrl = 0; | ||
2897 | @@ -362,8 +370,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, | ||
2898 | devpriv->mode2 &= oldmask; | ||
2899 | } | ||
2900 | /* configure specified channels */ | ||
2901 | - devpriv->mode1 |= data[4] << shift; | ||
2902 | - devpriv->mode2 |= data[5] << shift; | ||
2903 | + devpriv->mode1 |= himask; | ||
2904 | + devpriv->mode2 |= lomask; | ||
2905 | break; | ||
2906 | case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: | ||
2907 | if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA | | ||
2908 | @@ -380,8 +388,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, | ||
2909 | devpriv->mode2 &= oldmask; | ||
2910 | } | ||
2911 | /* configure specified channels */ | ||
2912 | - devpriv->mode1 |= data[4] << shift; | ||
2913 | - devpriv->mode2 |= data[5] << shift; | ||
2914 | + devpriv->mode1 |= himask; | ||
2915 | + devpriv->mode2 |= lomask; | ||
2916 | break; | ||
2917 | default: | ||
2918 | return -EINVAL; | ||
2919 | diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c | ||
2920 | index 4d1eccb5041d..4518c2680b7c 100644 | ||
2921 | --- a/drivers/staging/comedi/drivers/ni_6527.c | ||
2922 | +++ b/drivers/staging/comedi/drivers/ni_6527.c | ||
2923 | @@ -332,7 +332,7 @@ static int ni6527_intr_insn_config(struct comedi_device *dev, | ||
2924 | case COMEDI_DIGITAL_TRIG_ENABLE_EDGES: | ||
2925 | /* check shift amount */ | ||
2926 | shift = data[3]; | ||
2927 | - if (shift >= s->n_chan) { | ||
2928 | + if (shift >= 32) { | ||
2929 | mask = 0; | ||
2930 | rising = 0; | ||
2931 | falling = 0; | ||
2932 | diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c | ||
2933 | index d8d86761b790..8d32b1603d10 100644 | ||
2934 | --- a/drivers/staging/wlan-ng/prism2usb.c | ||
2935 | +++ b/drivers/staging/wlan-ng/prism2usb.c | ||
2936 | @@ -61,11 +61,25 @@ static int prism2sta_probe_usb(struct usb_interface *interface, | ||
2937 | const struct usb_device_id *id) | ||
2938 | { | ||
2939 | struct usb_device *dev; | ||
2940 | - | ||
2941 | + const struct usb_endpoint_descriptor *epd; | ||
2942 | + const struct usb_host_interface *iface_desc = interface->cur_altsetting; | ||
2943 | struct wlandevice *wlandev = NULL; | ||
2944 | struct hfa384x *hw = NULL; | ||
2945 | int result = 0; | ||
2946 | |||
2947 | + if (iface_desc->desc.bNumEndpoints != 2) { | ||
2948 | + result = -ENODEV; | ||
2949 | + goto failed; | ||
2950 | + } | ||
2951 | + | ||
2952 | + result = -EINVAL; | ||
2953 | + epd = &iface_desc->endpoint[1].desc; | ||
2954 | + if (!usb_endpoint_is_bulk_in(epd)) | ||
2955 | + goto failed; | ||
2956 | + epd = &iface_desc->endpoint[2].desc; | ||
2957 | + if (!usb_endpoint_is_bulk_out(epd)) | ||
2958 | + goto failed; | ||
2959 | + | ||
2960 | dev = interface_to_usbdev(interface); | ||
2961 | wlandev = create_wlan(); | ||
2962 | if (!wlandev) { | ||
2963 | diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c | ||
2964 | index f1d230c5a8ef..2675771a03a0 100644 | ||
2965 | --- a/drivers/tty/serial/8250/8250_core.c | ||
2966 | +++ b/drivers/tty/serial/8250/8250_core.c | ||
2967 | @@ -524,6 +524,7 @@ static void __init serial8250_isa_init_ports(void) | ||
2968 | */ | ||
2969 | up->mcr_mask = ~ALPHA_KLUDGE_MCR; | ||
2970 | up->mcr_force = ALPHA_KLUDGE_MCR; | ||
2971 | + serial8250_set_defaults(up); | ||
2972 | } | ||
2973 | |||
2974 | /* chain base port ops to support Remote Supervisor Adapter */ | ||
2975 | @@ -547,7 +548,6 @@ static void __init serial8250_isa_init_ports(void) | ||
2976 | port->membase = old_serial_port[i].iomem_base; | ||
2977 | port->iotype = old_serial_port[i].io_type; | ||
2978 | port->regshift = old_serial_port[i].iomem_reg_shift; | ||
2979 | - serial8250_set_defaults(up); | ||
2980 | |||
2981 | port->irqflags |= irqflag; | ||
2982 | if (serial8250_isa_config != NULL) | ||
2983 | diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c | ||
2984 | index e1268646ee56..9e2dbe43667a 100644 | ||
2985 | --- a/drivers/tty/serial/8250/8250_exar.c | ||
2986 | +++ b/drivers/tty/serial/8250/8250_exar.c | ||
2987 | @@ -307,7 +307,17 @@ static void setup_gpio(struct pci_dev *pcidev, u8 __iomem *p) | ||
2988 | * devices will export them as GPIOs, so we pre-configure them safely | ||
2989 | * as inputs. | ||
2990 | */ | ||
2991 | - u8 dir = pcidev->vendor == PCI_VENDOR_ID_EXAR ? 0xff : 0x00; | ||
2992 | + | ||
2993 | + u8 dir = 0x00; | ||
2994 | + | ||
2995 | + if ((pcidev->vendor == PCI_VENDOR_ID_EXAR) && | ||
2996 | + (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) { | ||
2997 | + // Configure GPIO as inputs for Commtech adapters | ||
2998 | + dir = 0xff; | ||
2999 | + } else { | ||
3000 | + // Configure GPIO as outputs for SeaLevel adapters | ||
3001 | + dir = 0x00; | ||
3002 | + } | ||
3003 | |||
3004 | writeb(0x00, p + UART_EXAR_MPIOINT_7_0); | ||
3005 | writeb(0x00, p + UART_EXAR_MPIOLVL_7_0); | ||
3006 | diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c | ||
3007 | index 4d067f515f74..2b59a4305077 100644 | ||
3008 | --- a/drivers/tty/serial/8250/8250_mtk.c | ||
3009 | +++ b/drivers/tty/serial/8250/8250_mtk.c | ||
3010 | @@ -305,8 +305,21 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, | ||
3011 | } | ||
3012 | #endif | ||
3013 | |||
3014 | + /* | ||
3015 | + * Store the requested baud rate before calling the generic 8250 | ||
3016 | + * set_termios method. Standard 8250 port expects bauds to be | ||
3017 | + * no higher than (uartclk / 16) so the baud will be clamped if it | ||
3018 | + * gets out of that bound. Mediatek 8250 port supports speed | ||
3019 | + * higher than that, therefore we'll get original baud rate back | ||
3020 | + * after calling the generic set_termios method and recalculate | ||
3021 | + * the speed later in this method. | ||
3022 | + */ | ||
3023 | + baud = tty_termios_baud_rate(termios); | ||
3024 | + | ||
3025 | serial8250_do_set_termios(port, termios, old); | ||
3026 | |||
3027 | + tty_termios_encode_baud_rate(termios, baud, baud); | ||
3028 | + | ||
3029 | /* | ||
3030 | * Mediatek UARTs use an extra highspeed register (MTK_UART_HIGHS) | ||
3031 | * | ||
3032 | @@ -338,6 +351,11 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, | ||
3033 | */ | ||
3034 | spin_lock_irqsave(&port->lock, flags); | ||
3035 | |||
3036 | + /* | ||
3037 | + * Update the per-port timeout. | ||
3038 | + */ | ||
3039 | + uart_update_timeout(port, termios->c_cflag, baud); | ||
3040 | + | ||
3041 | /* set DLAB we have cval saved in up->lcr from the call to the core */ | ||
3042 | serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB); | ||
3043 | serial_dl_write(up, quot); | ||
3044 | diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c | ||
3045 | index 2f599515c133..51c3f579ccd0 100644 | ||
3046 | --- a/drivers/tty/serial/serial-tegra.c | ||
3047 | +++ b/drivers/tty/serial/serial-tegra.c | ||
3048 | @@ -651,11 +651,14 @@ static void tegra_uart_handle_rx_pio(struct tegra_uart_port *tup, | ||
3049 | ch = (unsigned char) tegra_uart_read(tup, UART_RX); | ||
3050 | tup->uport.icount.rx++; | ||
3051 | |||
3052 | - if (!uart_handle_sysrq_char(&tup->uport, ch) && tty) | ||
3053 | - tty_insert_flip_char(tty, ch, flag); | ||
3054 | + if (uart_handle_sysrq_char(&tup->uport, ch)) | ||
3055 | + continue; | ||
3056 | |||
3057 | if (tup->uport.ignore_status_mask & UART_LSR_DR) | ||
3058 | continue; | ||
3059 | + | ||
3060 | + if (tty) | ||
3061 | + tty_insert_flip_char(tty, ch, flag); | ||
3062 | } while (1); | ||
3063 | } | ||
3064 | |||
3065 | diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c | ||
3066 | index fe098cf14e6a..8948970f795e 100644 | ||
3067 | --- a/drivers/tty/serial/xilinx_uartps.c | ||
3068 | +++ b/drivers/tty/serial/xilinx_uartps.c | ||
3069 | @@ -1559,8 +1559,10 @@ static int cdns_uart_probe(struct platform_device *pdev) | ||
3070 | * If register_console() don't assign value, then console_port pointer | ||
3071 | * is cleanup. | ||
3072 | */ | ||
3073 | - if (!console_port) | ||
3074 | + if (!console_port) { | ||
3075 | + cdns_uart_console.index = id; | ||
3076 | console_port = port; | ||
3077 | + } | ||
3078 | #endif | ||
3079 | |||
3080 | rc = uart_add_one_port(&cdns_uart_uart_driver, port); | ||
3081 | @@ -1573,8 +1575,10 @@ static int cdns_uart_probe(struct platform_device *pdev) | ||
3082 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | ||
3083 | /* This is not port which is used for console that's why clean it up */ | ||
3084 | if (console_port == port && | ||
3085 | - !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) | ||
3086 | + !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) { | ||
3087 | console_port = NULL; | ||
3088 | + cdns_uart_console.index = -1; | ||
3089 | + } | ||
3090 | #endif | ||
3091 | |||
3092 | cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, | ||
3093 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c | ||
3094 | index fd0361d72738..8051c7032627 100644 | ||
3095 | --- a/drivers/tty/vt/vt.c | ||
3096 | +++ b/drivers/tty/vt/vt.c | ||
3097 | @@ -1092,10 +1092,19 @@ static const struct tty_port_operations vc_port_ops = { | ||
3098 | .destruct = vc_port_destruct, | ||
3099 | }; | ||
3100 | |||
3101 | +/* | ||
3102 | + * Change # of rows and columns (0 means unchanged/the size of fg_console) | ||
3103 | + * [this is to be used together with some user program | ||
3104 | + * like resize that changes the hardware videomode] | ||
3105 | + */ | ||
3106 | +#define VC_MAXCOL (32767) | ||
3107 | +#define VC_MAXROW (32767) | ||
3108 | + | ||
3109 | int vc_allocate(unsigned int currcons) /* return 0 on success */ | ||
3110 | { | ||
3111 | struct vt_notifier_param param; | ||
3112 | struct vc_data *vc; | ||
3113 | + int err; | ||
3114 | |||
3115 | WARN_CONSOLE_UNLOCKED(); | ||
3116 | |||
3117 | @@ -1125,6 +1134,11 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | ||
3118 | if (!*vc->vc_uni_pagedir_loc) | ||
3119 | con_set_default_unimap(vc); | ||
3120 | |||
3121 | + err = -EINVAL; | ||
3122 | + if (vc->vc_cols > VC_MAXCOL || vc->vc_rows > VC_MAXROW || | ||
3123 | + vc->vc_screenbuf_size > KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size) | ||
3124 | + goto err_free; | ||
3125 | + err = -ENOMEM; | ||
3126 | vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); | ||
3127 | if (!vc->vc_screenbuf) | ||
3128 | goto err_free; | ||
3129 | @@ -1143,7 +1157,7 @@ err_free: | ||
3130 | visual_deinit(vc); | ||
3131 | kfree(vc); | ||
3132 | vc_cons[currcons].d = NULL; | ||
3133 | - return -ENOMEM; | ||
3134 | + return err; | ||
3135 | } | ||
3136 | |||
3137 | static inline int resize_screen(struct vc_data *vc, int width, int height, | ||
3138 | @@ -1158,14 +1172,6 @@ static inline int resize_screen(struct vc_data *vc, int width, int height, | ||
3139 | return err; | ||
3140 | } | ||
3141 | |||
3142 | -/* | ||
3143 | - * Change # of rows and columns (0 means unchanged/the size of fg_console) | ||
3144 | - * [this is to be used together with some user program | ||
3145 | - * like resize that changes the hardware videomode] | ||
3146 | - */ | ||
3147 | -#define VC_RESIZE_MAXCOL (32767) | ||
3148 | -#define VC_RESIZE_MAXROW (32767) | ||
3149 | - | ||
3150 | /** | ||
3151 | * vc_do_resize - resizing method for the tty | ||
3152 | * @tty: tty being resized | ||
3153 | @@ -1201,7 +1207,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | ||
3154 | user = vc->vc_resize_user; | ||
3155 | vc->vc_resize_user = 0; | ||
3156 | |||
3157 | - if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW) | ||
3158 | + if (cols > VC_MAXCOL || lines > VC_MAXROW) | ||
3159 | return -EINVAL; | ||
3160 | |||
3161 | new_cols = (cols ? cols : vc->vc_cols); | ||
3162 | @@ -1212,7 +1218,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | ||
3163 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) | ||
3164 | return 0; | ||
3165 | |||
3166 | - if (new_screen_size > KMALLOC_MAX_SIZE) | ||
3167 | + if (new_screen_size > KMALLOC_MAX_SIZE || !new_screen_size) | ||
3168 | return -EINVAL; | ||
3169 | newscreen = kzalloc(new_screen_size, GFP_USER); | ||
3170 | if (!newscreen) | ||
3171 | @@ -3396,6 +3402,7 @@ static int __init con_init(void) | ||
3172 | INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); | ||
3173 | tty_port_init(&vc->port); | ||
3174 | visual_init(vc, currcons, 1); | ||
3175 | + /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */ | ||
3176 | vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); | ||
3177 | vc_init(vc, vc->vc_rows, vc->vc_cols, | ||
3178 | currcons || !vc->vc_sw->con_save_screen); | ||
3179 | diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c | ||
3180 | index da4c5eb03d7e..666cebd9c5f2 100644 | ||
3181 | --- a/drivers/usb/cdns3/ep0.c | ||
3182 | +++ b/drivers/usb/cdns3/ep0.c | ||
3183 | @@ -37,18 +37,18 @@ static void cdns3_ep0_run_transfer(struct cdns3_device *priv_dev, | ||
3184 | struct cdns3_usb_regs __iomem *regs = priv_dev->regs; | ||
3185 | struct cdns3_endpoint *priv_ep = priv_dev->eps[0]; | ||
3186 | |||
3187 | - priv_ep->trb_pool[0].buffer = TRB_BUFFER(dma_addr); | ||
3188 | - priv_ep->trb_pool[0].length = TRB_LEN(length); | ||
3189 | + priv_ep->trb_pool[0].buffer = cpu_to_le32(TRB_BUFFER(dma_addr)); | ||
3190 | + priv_ep->trb_pool[0].length = cpu_to_le32(TRB_LEN(length)); | ||
3191 | |||
3192 | if (zlp) { | ||
3193 | - priv_ep->trb_pool[0].control = TRB_CYCLE | TRB_TYPE(TRB_NORMAL); | ||
3194 | - priv_ep->trb_pool[1].buffer = TRB_BUFFER(dma_addr); | ||
3195 | - priv_ep->trb_pool[1].length = TRB_LEN(0); | ||
3196 | - priv_ep->trb_pool[1].control = TRB_CYCLE | TRB_IOC | | ||
3197 | - TRB_TYPE(TRB_NORMAL); | ||
3198 | + priv_ep->trb_pool[0].control = cpu_to_le32(TRB_CYCLE | TRB_TYPE(TRB_NORMAL)); | ||
3199 | + priv_ep->trb_pool[1].buffer = cpu_to_le32(TRB_BUFFER(dma_addr)); | ||
3200 | + priv_ep->trb_pool[1].length = cpu_to_le32(TRB_LEN(0)); | ||
3201 | + priv_ep->trb_pool[1].control = cpu_to_le32(TRB_CYCLE | TRB_IOC | | ||
3202 | + TRB_TYPE(TRB_NORMAL)); | ||
3203 | } else { | ||
3204 | - priv_ep->trb_pool[0].control = TRB_CYCLE | TRB_IOC | | ||
3205 | - TRB_TYPE(TRB_NORMAL); | ||
3206 | + priv_ep->trb_pool[0].control = cpu_to_le32(TRB_CYCLE | TRB_IOC | | ||
3207 | + TRB_TYPE(TRB_NORMAL)); | ||
3208 | priv_ep->trb_pool[1].control = 0; | ||
3209 | } | ||
3210 | |||
3211 | @@ -264,11 +264,11 @@ static int cdns3_req_ep0_get_status(struct cdns3_device *priv_dev, | ||
3212 | case USB_RECIP_INTERFACE: | ||
3213 | return cdns3_ep0_delegate_req(priv_dev, ctrl); | ||
3214 | case USB_RECIP_ENDPOINT: | ||
3215 | - index = cdns3_ep_addr_to_index(ctrl->wIndex); | ||
3216 | + index = cdns3_ep_addr_to_index(le16_to_cpu(ctrl->wIndex)); | ||
3217 | priv_ep = priv_dev->eps[index]; | ||
3218 | |||
3219 | /* check if endpoint is stalled or stall is pending */ | ||
3220 | - cdns3_select_ep(priv_dev, ctrl->wIndex); | ||
3221 | + cdns3_select_ep(priv_dev, le16_to_cpu(ctrl->wIndex)); | ||
3222 | if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts)) || | ||
3223 | (priv_ep->flags & EP_STALL_PENDING)) | ||
3224 | usb_status = BIT(USB_ENDPOINT_HALT); | ||
3225 | @@ -388,10 +388,10 @@ static int cdns3_ep0_feature_handle_endpoint(struct cdns3_device *priv_dev, | ||
3226 | if (!(ctrl->wIndex & ~USB_DIR_IN)) | ||
3227 | return 0; | ||
3228 | |||
3229 | - index = cdns3_ep_addr_to_index(ctrl->wIndex); | ||
3230 | + index = cdns3_ep_addr_to_index(le16_to_cpu(ctrl->wIndex)); | ||
3231 | priv_ep = priv_dev->eps[index]; | ||
3232 | |||
3233 | - cdns3_select_ep(priv_dev, ctrl->wIndex); | ||
3234 | + cdns3_select_ep(priv_dev, le16_to_cpu(ctrl->wIndex)); | ||
3235 | |||
3236 | if (set) | ||
3237 | __cdns3_gadget_ep_set_halt(priv_ep); | ||
3238 | @@ -452,7 +452,7 @@ static int cdns3_req_ep0_set_sel(struct cdns3_device *priv_dev, | ||
3239 | if (priv_dev->gadget.state < USB_STATE_ADDRESS) | ||
3240 | return -EINVAL; | ||
3241 | |||
3242 | - if (ctrl_req->wLength != 6) { | ||
3243 | + if (le16_to_cpu(ctrl_req->wLength) != 6) { | ||
3244 | dev_err(priv_dev->dev, "Set SEL should be 6 bytes, got %d\n", | ||
3245 | ctrl_req->wLength); | ||
3246 | return -EINVAL; | ||
3247 | @@ -476,7 +476,7 @@ static int cdns3_req_ep0_set_isoch_delay(struct cdns3_device *priv_dev, | ||
3248 | if (ctrl_req->wIndex || ctrl_req->wLength) | ||
3249 | return -EINVAL; | ||
3250 | |||
3251 | - priv_dev->isoch_delay = ctrl_req->wValue; | ||
3252 | + priv_dev->isoch_delay = le16_to_cpu(ctrl_req->wValue); | ||
3253 | |||
3254 | return 0; | ||
3255 | } | ||
3256 | diff --git a/drivers/usb/cdns3/trace.h b/drivers/usb/cdns3/trace.h | ||
3257 | index 7cc8bebaa07d..f8482456116e 100644 | ||
3258 | --- a/drivers/usb/cdns3/trace.h | ||
3259 | +++ b/drivers/usb/cdns3/trace.h | ||
3260 | @@ -333,9 +333,9 @@ DECLARE_EVENT_CLASS(cdns3_log_trb, | ||
3261 | TP_fast_assign( | ||
3262 | __assign_str(name, priv_ep->name); | ||
3263 | __entry->trb = trb; | ||
3264 | - __entry->buffer = trb->buffer; | ||
3265 | - __entry->length = trb->length; | ||
3266 | - __entry->control = trb->control; | ||
3267 | + __entry->buffer = le32_to_cpu(trb->buffer); | ||
3268 | + __entry->length = le32_to_cpu(trb->length); | ||
3269 | + __entry->control = le32_to_cpu(trb->control); | ||
3270 | __entry->type = usb_endpoint_type(priv_ep->endpoint.desc); | ||
3271 | ), | ||
3272 | TP_printk("%s: trb %p, dma buf: 0x%08x, size: %ld, burst: %d ctrl: 0x%08x (%s%s%s%s%s%s%s)", | ||
3273 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c | ||
3274 | index 96c05b121fac..139474c3e77b 100644 | ||
3275 | --- a/drivers/usb/dwc3/dwc3-pci.c | ||
3276 | +++ b/drivers/usb/dwc3/dwc3-pci.c | ||
3277 | @@ -38,6 +38,8 @@ | ||
3278 | #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee | ||
3279 | #define PCI_DEVICE_ID_INTEL_EHLLP 0x4b7e | ||
3280 | #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee | ||
3281 | +#define PCI_DEVICE_ID_INTEL_TGPH 0x43ee | ||
3282 | +#define PCI_DEVICE_ID_INTEL_JSP 0x4dee | ||
3283 | |||
3284 | #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" | ||
3285 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 | ||
3286 | @@ -358,6 +360,12 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | ||
3287 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPLP), | ||
3288 | (kernel_ulong_t) &dwc3_pci_intel_properties, }, | ||
3289 | |||
3290 | + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPH), | ||
3291 | + (kernel_ulong_t) &dwc3_pci_intel_properties, }, | ||
3292 | + | ||
3293 | + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP), | ||
3294 | + (kernel_ulong_t) &dwc3_pci_intel_properties, }, | ||
3295 | + | ||
3296 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB), | ||
3297 | (kernel_ulong_t) &dwc3_pci_amd_properties, }, | ||
3298 | { } /* Terminating Entry */ | ||
3299 | diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c | ||
3300 | index 116d386472ef..da73a06c20a3 100644 | ||
3301 | --- a/drivers/usb/gadget/udc/gr_udc.c | ||
3302 | +++ b/drivers/usb/gadget/udc/gr_udc.c | ||
3303 | @@ -1980,9 +1980,12 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit) | ||
3304 | |||
3305 | if (num == 0) { | ||
3306 | _req = gr_alloc_request(&ep->ep, GFP_ATOMIC); | ||
3307 | + if (!_req) | ||
3308 | + return -ENOMEM; | ||
3309 | + | ||
3310 | buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_ATOMIC); | ||
3311 | - if (!_req || !buf) { | ||
3312 | - /* possible _req freed by gr_probe via gr_remove */ | ||
3313 | + if (!buf) { | ||
3314 | + gr_free_request(&ep->ep, _req); | ||
3315 | return -ENOMEM; | ||
3316 | } | ||
3317 | |||
3318 | diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c | ||
3319 | index fea555570ad4..45c54d56ecbd 100644 | ||
3320 | --- a/drivers/usb/host/xhci-mtk-sch.c | ||
3321 | +++ b/drivers/usb/host/xhci-mtk-sch.c | ||
3322 | @@ -557,6 +557,10 @@ static bool need_bw_sch(struct usb_host_endpoint *ep, | ||
3323 | if (is_fs_or_ls(speed) && !has_tt) | ||
3324 | return false; | ||
3325 | |||
3326 | + /* skip endpoint with zero maxpkt */ | ||
3327 | + if (usb_endpoint_maxp(&ep->desc) == 0) | ||
3328 | + return false; | ||
3329 | + | ||
3330 | return true; | ||
3331 | } | ||
3332 | |||
3333 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c | ||
3334 | index 1fddc41fa1f3..07741ab9a46a 100644 | ||
3335 | --- a/drivers/usb/host/xhci-pci.c | ||
3336 | +++ b/drivers/usb/host/xhci-pci.c | ||
3337 | @@ -250,6 +250,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | ||
3338 | if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | ||
3339 | pdev->device == 0x1142) | ||
3340 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; | ||
3341 | + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | ||
3342 | + pdev->device == 0x2142) | ||
3343 | + xhci->quirks |= XHCI_NO_64BIT_SUPPORT; | ||
3344 | |||
3345 | if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | ||
3346 | pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) | ||
3347 | diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c | ||
3348 | index ca935c09a261..35ebeeccde4d 100644 | ||
3349 | --- a/drivers/video/fbdev/core/bitblit.c | ||
3350 | +++ b/drivers/video/fbdev/core/bitblit.c | ||
3351 | @@ -216,7 +216,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3352 | region.color = color; | ||
3353 | region.rop = ROP_COPY; | ||
3354 | |||
3355 | - if (rw && !bottom_only) { | ||
3356 | + if ((int) rw > 0 && !bottom_only) { | ||
3357 | region.dx = info->var.xoffset + rs; | ||
3358 | region.dy = 0; | ||
3359 | region.width = rw; | ||
3360 | @@ -224,7 +224,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3361 | info->fbops->fb_fillrect(info, ®ion); | ||
3362 | } | ||
3363 | |||
3364 | - if (bh) { | ||
3365 | + if ((int) bh > 0) { | ||
3366 | region.dx = info->var.xoffset; | ||
3367 | region.dy = info->var.yoffset + bs; | ||
3368 | region.width = rs; | ||
3369 | diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c | ||
3370 | index dfa9a8aa4509..78f3a5621478 100644 | ||
3371 | --- a/drivers/video/fbdev/core/fbcon_ccw.c | ||
3372 | +++ b/drivers/video/fbdev/core/fbcon_ccw.c | ||
3373 | @@ -201,7 +201,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3374 | region.color = color; | ||
3375 | region.rop = ROP_COPY; | ||
3376 | |||
3377 | - if (rw && !bottom_only) { | ||
3378 | + if ((int) rw > 0 && !bottom_only) { | ||
3379 | region.dx = 0; | ||
3380 | region.dy = info->var.yoffset; | ||
3381 | region.height = rw; | ||
3382 | @@ -209,7 +209,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3383 | info->fbops->fb_fillrect(info, ®ion); | ||
3384 | } | ||
3385 | |||
3386 | - if (bh) { | ||
3387 | + if ((int) bh > 0) { | ||
3388 | region.dx = info->var.xoffset + bs; | ||
3389 | region.dy = 0; | ||
3390 | region.height = info->var.yres_virtual; | ||
3391 | diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c | ||
3392 | index ce08251bfd38..fd098ff17574 100644 | ||
3393 | --- a/drivers/video/fbdev/core/fbcon_cw.c | ||
3394 | +++ b/drivers/video/fbdev/core/fbcon_cw.c | ||
3395 | @@ -184,7 +184,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3396 | region.color = color; | ||
3397 | region.rop = ROP_COPY; | ||
3398 | |||
3399 | - if (rw && !bottom_only) { | ||
3400 | + if ((int) rw > 0 && !bottom_only) { | ||
3401 | region.dx = 0; | ||
3402 | region.dy = info->var.yoffset + rs; | ||
3403 | region.height = rw; | ||
3404 | @@ -192,7 +192,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3405 | info->fbops->fb_fillrect(info, ®ion); | ||
3406 | } | ||
3407 | |||
3408 | - if (bh) { | ||
3409 | + if ((int) bh > 0) { | ||
3410 | region.dx = info->var.xoffset; | ||
3411 | region.dy = info->var.yoffset; | ||
3412 | region.height = info->var.yres; | ||
3413 | diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c | ||
3414 | index 1936afc78fec..e165a3fad29a 100644 | ||
3415 | --- a/drivers/video/fbdev/core/fbcon_ud.c | ||
3416 | +++ b/drivers/video/fbdev/core/fbcon_ud.c | ||
3417 | @@ -231,7 +231,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3418 | region.color = color; | ||
3419 | region.rop = ROP_COPY; | ||
3420 | |||
3421 | - if (rw && !bottom_only) { | ||
3422 | + if ((int) rw > 0 && !bottom_only) { | ||
3423 | region.dy = 0; | ||
3424 | region.dx = info->var.xoffset; | ||
3425 | region.width = rw; | ||
3426 | @@ -239,7 +239,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
3427 | info->fbops->fb_fillrect(info, ®ion); | ||
3428 | } | ||
3429 | |||
3430 | - if (bh) { | ||
3431 | + if ((int) bh > 0) { | ||
3432 | region.dy = info->var.yoffset; | ||
3433 | region.dx = info->var.xoffset; | ||
3434 | region.height = bh; | ||
3435 | diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c | ||
3436 | index e5d85311d5d5..86e280edf804 100644 | ||
3437 | --- a/fs/btrfs/backref.c | ||
3438 | +++ b/fs/btrfs/backref.c | ||
3439 | @@ -1422,6 +1422,7 @@ static int btrfs_find_all_roots_safe(struct btrfs_trans_handle *trans, | ||
3440 | if (ret < 0 && ret != -ENOENT) { | ||
3441 | ulist_free(tmp); | ||
3442 | ulist_free(*roots); | ||
3443 | + *roots = NULL; | ||
3444 | return ret; | ||
3445 | } | ||
3446 | node = ulist_next(tmp, &uiter); | ||
3447 | diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c | ||
3448 | index 9b214b14a3aa..1a089a642422 100644 | ||
3449 | --- a/fs/btrfs/extent_io.c | ||
3450 | +++ b/fs/btrfs/extent_io.c | ||
3451 | @@ -1923,7 +1923,8 @@ static int __process_pages_contig(struct address_space *mapping, | ||
3452 | if (!PageDirty(pages[i]) || | ||
3453 | pages[i]->mapping != mapping) { | ||
3454 | unlock_page(pages[i]); | ||
3455 | - put_page(pages[i]); | ||
3456 | + for (; i < ret; i++) | ||
3457 | + put_page(pages[i]); | ||
3458 | err = -EAGAIN; | ||
3459 | goto out; | ||
3460 | } | ||
3461 | diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c | ||
3462 | index e890f09e2073..1b087ee338cc 100644 | ||
3463 | --- a/fs/btrfs/relocation.c | ||
3464 | +++ b/fs/btrfs/relocation.c | ||
3465 | @@ -2525,12 +2525,10 @@ again: | ||
3466 | reloc_root = list_entry(reloc_roots.next, | ||
3467 | struct btrfs_root, root_list); | ||
3468 | |||
3469 | + root = read_fs_root(fs_info, reloc_root->root_key.offset); | ||
3470 | if (btrfs_root_refs(&reloc_root->root_item) > 0) { | ||
3471 | - root = read_fs_root(fs_info, | ||
3472 | - reloc_root->root_key.offset); | ||
3473 | BUG_ON(IS_ERR(root)); | ||
3474 | BUG_ON(root->reloc_root != reloc_root); | ||
3475 | - | ||
3476 | ret = merge_reloc_root(rc, root); | ||
3477 | if (ret) { | ||
3478 | if (list_empty(&reloc_root->root_list)) | ||
3479 | @@ -2539,6 +2537,13 @@ again: | ||
3480 | goto out; | ||
3481 | } | ||
3482 | } else { | ||
3483 | + if (!IS_ERR(root)) { | ||
3484 | + if (root->reloc_root == reloc_root) | ||
3485 | + root->reloc_root = NULL; | ||
3486 | + clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, | ||
3487 | + &root->state); | ||
3488 | + } | ||
3489 | + | ||
3490 | list_del_init(&reloc_root->root_list); | ||
3491 | /* Don't forget to queue this reloc root for cleanup */ | ||
3492 | list_add_tail(&reloc_root->reloc_dirty_list, | ||
3493 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c | ||
3494 | index c8b0e5005f02..1e6e3c1d97df 100644 | ||
3495 | --- a/fs/btrfs/volumes.c | ||
3496 | +++ b/fs/btrfs/volumes.c | ||
3497 | @@ -7269,6 +7269,14 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info) | ||
3498 | mutex_lock(&uuid_mutex); | ||
3499 | mutex_lock(&fs_info->chunk_mutex); | ||
3500 | |||
3501 | + /* | ||
3502 | + * It is possible for mount and umount to race in such a way that | ||
3503 | + * we execute this code path, but open_fs_devices failed to clear | ||
3504 | + * total_rw_bytes. We certainly want it cleared before reading the | ||
3505 | + * device items, so clear it here. | ||
3506 | + */ | ||
3507 | + fs_info->fs_devices->total_rw_bytes = 0; | ||
3508 | + | ||
3509 | /* | ||
3510 | * Read all device items, and then all the chunk items. All | ||
3511 | * device items are found before any chunk item (their object id | ||
3512 | diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c | ||
3513 | index 5ae458505f63..eb2e3db3916f 100644 | ||
3514 | --- a/fs/cifs/inode.c | ||
3515 | +++ b/fs/cifs/inode.c | ||
3516 | @@ -1791,7 +1791,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, | ||
3517 | FILE_UNIX_BASIC_INFO *info_buf_target; | ||
3518 | unsigned int xid; | ||
3519 | int rc, tmprc; | ||
3520 | - bool new_target = d_really_is_negative(target_dentry); | ||
3521 | |||
3522 | if (flags & ~RENAME_NOREPLACE) | ||
3523 | return -EINVAL; | ||
3524 | @@ -1868,13 +1867,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, | ||
3525 | */ | ||
3526 | |||
3527 | unlink_target: | ||
3528 | - /* | ||
3529 | - * If the target dentry was created during the rename, try | ||
3530 | - * unlinking it if it's not negative | ||
3531 | - */ | ||
3532 | - if (new_target && | ||
3533 | - d_really_is_positive(target_dentry) && | ||
3534 | - (rc == -EACCES || rc == -EEXIST)) { | ||
3535 | + /* Try unlinking the target dentry if it's not negative */ | ||
3536 | + if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) { | ||
3537 | if (d_is_dir(target_dentry)) | ||
3538 | tmprc = cifs_rmdir(target_dir, target_dentry); | ||
3539 | else | ||
3540 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c | ||
3541 | index 4f2e4f38feb8..06dd38e76c62 100644 | ||
3542 | --- a/fs/fuse/dev.c | ||
3543 | +++ b/fs/fuse/dev.c | ||
3544 | @@ -771,7 +771,8 @@ static int fuse_check_page(struct page *page) | ||
3545 | 1 << PG_uptodate | | ||
3546 | 1 << PG_lru | | ||
3547 | 1 << PG_active | | ||
3548 | - 1 << PG_reclaim))) { | ||
3549 | + 1 << PG_reclaim | | ||
3550 | + 1 << PG_waiters))) { | ||
3551 | pr_warn("trying to steal weird page\n"); | ||
3552 | pr_warn(" page=%p index=%li flags=%08lx, count=%i, mapcount=%i, mapping=%p\n", page, page->index, page->flags, page_count(page), page_mapcount(page), page->mapping); | ||
3553 | return 1; | ||
3554 | diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c | ||
3555 | index 70cf8c5760c7..6b0bf4ebd812 100644 | ||
3556 | --- a/fs/nfs/direct.c | ||
3557 | +++ b/fs/nfs/direct.c | ||
3558 | @@ -367,6 +367,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) | ||
3559 | { | ||
3560 | struct inode *inode = dreq->inode; | ||
3561 | |||
3562 | + inode_dio_end(inode); | ||
3563 | + | ||
3564 | if (dreq->iocb) { | ||
3565 | long res = (long) dreq->error; | ||
3566 | if (dreq->count != 0) { | ||
3567 | @@ -378,10 +380,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) | ||
3568 | |||
3569 | complete(&dreq->completion); | ||
3570 | |||
3571 | - igrab(inode); | ||
3572 | nfs_direct_req_release(dreq); | ||
3573 | - inode_dio_end(inode); | ||
3574 | - iput(inode); | ||
3575 | } | ||
3576 | |||
3577 | static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) | ||
3578 | @@ -511,10 +510,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | ||
3579 | * generic layer handle the completion. | ||
3580 | */ | ||
3581 | if (requested_bytes == 0) { | ||
3582 | - igrab(inode); | ||
3583 | - nfs_direct_req_release(dreq); | ||
3584 | inode_dio_end(inode); | ||
3585 | - iput(inode); | ||
3586 | + nfs_direct_req_release(dreq); | ||
3587 | return result < 0 ? result : -EIO; | ||
3588 | } | ||
3589 | |||
3590 | @@ -926,10 +923,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | ||
3591 | * generic layer handle the completion. | ||
3592 | */ | ||
3593 | if (requested_bytes == 0) { | ||
3594 | - igrab(inode); | ||
3595 | - nfs_direct_req_release(dreq); | ||
3596 | inode_dio_end(inode); | ||
3597 | - iput(inode); | ||
3598 | + nfs_direct_req_release(dreq); | ||
3599 | return result < 0 ? result : -EIO; | ||
3600 | } | ||
3601 | |||
3602 | diff --git a/fs/nfs/file.c b/fs/nfs/file.c | ||
3603 | index 7b3136753205..95dc90570786 100644 | ||
3604 | --- a/fs/nfs/file.c | ||
3605 | +++ b/fs/nfs/file.c | ||
3606 | @@ -83,7 +83,6 @@ nfs_file_release(struct inode *inode, struct file *filp) | ||
3607 | dprintk("NFS: release(%pD2)\n", filp); | ||
3608 | |||
3609 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); | ||
3610 | - inode_dio_wait(inode); | ||
3611 | nfs_file_clear_open_context(filp); | ||
3612 | return 0; | ||
3613 | } | ||
3614 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c | ||
3615 | index 9af9b673f292..68cf11660764 100644 | ||
3616 | --- a/fs/nfsd/nfs4state.c | ||
3617 | +++ b/fs/nfsd/nfs4state.c | ||
3618 | @@ -506,6 +506,17 @@ find_any_file(struct nfs4_file *f) | ||
3619 | return ret; | ||
3620 | } | ||
3621 | |||
3622 | +static struct nfsd_file *find_deleg_file(struct nfs4_file *f) | ||
3623 | +{ | ||
3624 | + struct nfsd_file *ret = NULL; | ||
3625 | + | ||
3626 | + spin_lock(&f->fi_lock); | ||
3627 | + if (f->fi_deleg_file) | ||
3628 | + ret = nfsd_file_get(f->fi_deleg_file); | ||
3629 | + spin_unlock(&f->fi_lock); | ||
3630 | + return ret; | ||
3631 | +} | ||
3632 | + | ||
3633 | static atomic_long_t num_delegations; | ||
3634 | unsigned long max_delegations; | ||
3635 | |||
3636 | @@ -2378,6 +2389,8 @@ static int nfs4_show_open(struct seq_file *s, struct nfs4_stid *st) | ||
3637 | oo = ols->st_stateowner; | ||
3638 | nf = st->sc_file; | ||
3639 | file = find_any_file(nf); | ||
3640 | + if (!file) | ||
3641 | + return 0; | ||
3642 | |||
3643 | seq_printf(s, "- 0x%16phN: { type: open, ", &st->sc_stateid); | ||
3644 | |||
3645 | @@ -2411,6 +2424,8 @@ static int nfs4_show_lock(struct seq_file *s, struct nfs4_stid *st) | ||
3646 | oo = ols->st_stateowner; | ||
3647 | nf = st->sc_file; | ||
3648 | file = find_any_file(nf); | ||
3649 | + if (!file) | ||
3650 | + return 0; | ||
3651 | |||
3652 | seq_printf(s, "- 0x%16phN: { type: lock, ", &st->sc_stateid); | ||
3653 | |||
3654 | @@ -2439,7 +2454,9 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st) | ||
3655 | |||
3656 | ds = delegstateid(st); | ||
3657 | nf = st->sc_file; | ||
3658 | - file = nf->fi_deleg_file; | ||
3659 | + file = find_deleg_file(nf); | ||
3660 | + if (!file) | ||
3661 | + return 0; | ||
3662 | |||
3663 | seq_printf(s, "- 0x%16phN: { type: deleg, ", &st->sc_stateid); | ||
3664 | |||
3665 | @@ -2451,6 +2468,7 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st) | ||
3666 | |||
3667 | nfs4_show_superblock(s, file); | ||
3668 | seq_printf(s, " }\n"); | ||
3669 | + nfsd_file_put(file); | ||
3670 | |||
3671 | return 0; | ||
3672 | } | ||
3673 | diff --git a/include/asm-generic/mmiowb.h b/include/asm-generic/mmiowb.h | ||
3674 | index 9439ff037b2d..5698fca3bf56 100644 | ||
3675 | --- a/include/asm-generic/mmiowb.h | ||
3676 | +++ b/include/asm-generic/mmiowb.h | ||
3677 | @@ -27,7 +27,7 @@ | ||
3678 | #include <asm/smp.h> | ||
3679 | |||
3680 | DECLARE_PER_CPU(struct mmiowb_state, __mmiowb_state); | ||
3681 | -#define __mmiowb_state() this_cpu_ptr(&__mmiowb_state) | ||
3682 | +#define __mmiowb_state() raw_cpu_ptr(&__mmiowb_state) | ||
3683 | #else | ||
3684 | #define __mmiowb_state() arch_mmiowb_state() | ||
3685 | #endif /* arch_mmiowb_state */ | ||
3686 | @@ -35,7 +35,9 @@ DECLARE_PER_CPU(struct mmiowb_state, __mmiowb_state); | ||
3687 | static inline void mmiowb_set_pending(void) | ||
3688 | { | ||
3689 | struct mmiowb_state *ms = __mmiowb_state(); | ||
3690 | - ms->mmiowb_pending = ms->nesting_count; | ||
3691 | + | ||
3692 | + if (likely(ms->nesting_count)) | ||
3693 | + ms->mmiowb_pending = ms->nesting_count; | ||
3694 | } | ||
3695 | |||
3696 | static inline void mmiowb_spin_lock(void) | ||
3697 | diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h | ||
3698 | index b6d7347ccda7..d7616d08e863 100644 | ||
3699 | --- a/include/asm-generic/vmlinux.lds.h | ||
3700 | +++ b/include/asm-generic/vmlinux.lds.h | ||
3701 | @@ -306,7 +306,8 @@ | ||
3702 | |||
3703 | #define PAGE_ALIGNED_DATA(page_align) \ | ||
3704 | . = ALIGN(page_align); \ | ||
3705 | - *(.data..page_aligned) | ||
3706 | + *(.data..page_aligned) \ | ||
3707 | + . = ALIGN(page_align); | ||
3708 | |||
3709 | #define READ_MOSTLY_DATA(align) \ | ||
3710 | . = ALIGN(align); \ | ||
3711 | @@ -695,7 +696,9 @@ | ||
3712 | . = ALIGN(bss_align); \ | ||
3713 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ | ||
3714 | BSS_FIRST_SECTIONS \ | ||
3715 | + . = ALIGN(PAGE_SIZE); \ | ||
3716 | *(.bss..page_aligned) \ | ||
3717 | + . = ALIGN(PAGE_SIZE); \ | ||
3718 | *(.dynbss) \ | ||
3719 | *(BSS_MAIN) \ | ||
3720 | *(COMMON) \ | ||
3721 | diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h | ||
3722 | index 399ad8632356..e4e1f5c1f492 100644 | ||
3723 | --- a/include/linux/device-mapper.h | ||
3724 | +++ b/include/linux/device-mapper.h | ||
3725 | @@ -420,6 +420,7 @@ const char *dm_device_name(struct mapped_device *md); | ||
3726 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | ||
3727 | struct gendisk *dm_disk(struct mapped_device *md); | ||
3728 | int dm_suspended(struct dm_target *ti); | ||
3729 | +int dm_post_suspending(struct dm_target *ti); | ||
3730 | int dm_noflush_suspending(struct dm_target *ti); | ||
3731 | void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors); | ||
3732 | void dm_remap_zone_report(struct dm_target *ti, sector_t start, | ||
3733 | diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h | ||
3734 | index ec212cb27fdc..12eac4293af6 100644 | ||
3735 | --- a/include/linux/dma-buf.h | ||
3736 | +++ b/include/linux/dma-buf.h | ||
3737 | @@ -303,6 +303,7 @@ struct dma_buf { | ||
3738 | void *vmap_ptr; | ||
3739 | const char *exp_name; | ||
3740 | const char *name; | ||
3741 | + spinlock_t name_lock; /* spinlock to protect name access */ | ||
3742 | struct module *owner; | ||
3743 | struct list_head list_node; | ||
3744 | void *priv; | ||
3745 | diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h | ||
3746 | index 6e125e9b4187..b9c91d321240 100644 | ||
3747 | --- a/include/linux/io-mapping.h | ||
3748 | +++ b/include/linux/io-mapping.h | ||
3749 | @@ -108,9 +108,12 @@ io_mapping_init_wc(struct io_mapping *iomap, | ||
3750 | resource_size_t base, | ||
3751 | unsigned long size) | ||
3752 | { | ||
3753 | + iomap->iomem = ioremap_wc(base, size); | ||
3754 | + if (!iomap->iomem) | ||
3755 | + return NULL; | ||
3756 | + | ||
3757 | iomap->base = base; | ||
3758 | iomap->size = size; | ||
3759 | - iomap->iomem = ioremap_wc(base, size); | ||
3760 | #if defined(pgprot_noncached_wc) /* archs can't agree on a name ... */ | ||
3761 | iomap->prot = pgprot_noncached_wc(PAGE_KERNEL); | ||
3762 | #elif defined(pgprot_writecombine) | ||
3763 | diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h | ||
3764 | index 953d7ca01eb6..4c56404e53a7 100644 | ||
3765 | --- a/include/linux/mod_devicetable.h | ||
3766 | +++ b/include/linux/mod_devicetable.h | ||
3767 | @@ -318,7 +318,7 @@ struct pcmcia_device_id { | ||
3768 | #define INPUT_DEVICE_ID_LED_MAX 0x0f | ||
3769 | #define INPUT_DEVICE_ID_SND_MAX 0x07 | ||
3770 | #define INPUT_DEVICE_ID_FF_MAX 0x7f | ||
3771 | -#define INPUT_DEVICE_ID_SW_MAX 0x0f | ||
3772 | +#define INPUT_DEVICE_ID_SW_MAX 0x10 | ||
3773 | #define INPUT_DEVICE_ID_PROP_MAX 0x1f | ||
3774 | |||
3775 | #define INPUT_DEVICE_ID_MATCH_BUS 1 | ||
3776 | diff --git a/include/sound/rt5670.h b/include/sound/rt5670.h | ||
3777 | index f9024c7a1600..02e1d7778354 100644 | ||
3778 | --- a/include/sound/rt5670.h | ||
3779 | +++ b/include/sound/rt5670.h | ||
3780 | @@ -12,6 +12,7 @@ struct rt5670_platform_data { | ||
3781 | int jd_mode; | ||
3782 | bool in2_diff; | ||
3783 | bool dev_gpio; | ||
3784 | + bool gpio1_is_ext_spk_en; | ||
3785 | |||
3786 | bool dmic_en; | ||
3787 | unsigned int dmic1_data_pin; | ||
3788 | diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h | ||
3789 | index 85387c76c24f..472cd5bc5567 100644 | ||
3790 | --- a/include/uapi/linux/input-event-codes.h | ||
3791 | +++ b/include/uapi/linux/input-event-codes.h | ||
3792 | @@ -808,7 +808,8 @@ | ||
3793 | #define SW_LINEIN_INSERT 0x0d /* set = inserted */ | ||
3794 | #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ | ||
3795 | #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ | ||
3796 | -#define SW_MAX 0x0f | ||
3797 | +#define SW_MACHINE_COVER 0x10 /* set = cover closed */ | ||
3798 | +#define SW_MAX 0x10 | ||
3799 | #define SW_CNT (SW_MAX+1) | ||
3800 | |||
3801 | /* | ||
3802 | diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c | ||
3803 | index 291680ba8504..aa83538efc23 100644 | ||
3804 | --- a/kernel/events/uprobes.c | ||
3805 | +++ b/kernel/events/uprobes.c | ||
3806 | @@ -2205,7 +2205,7 @@ static void handle_swbp(struct pt_regs *regs) | ||
3807 | if (!uprobe) { | ||
3808 | if (is_swbp > 0) { | ||
3809 | /* No matching uprobe; signal SIGTRAP. */ | ||
3810 | - send_sig(SIGTRAP, current, 0); | ||
3811 | + force_sig(SIGTRAP); | ||
3812 | } else { | ||
3813 | /* | ||
3814 | * Either we raced with uprobe_unregister() or we can't | ||
3815 | diff --git a/mm/khugepaged.c b/mm/khugepaged.c | ||
3816 | index f765475be359..5977f7824a9a 100644 | ||
3817 | --- a/mm/khugepaged.c | ||
3818 | +++ b/mm/khugepaged.c | ||
3819 | @@ -876,6 +876,9 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address, | ||
3820 | return SCAN_ADDRESS_RANGE; | ||
3821 | if (!hugepage_vma_check(vma, vma->vm_flags)) | ||
3822 | return SCAN_VMA_CHECK; | ||
3823 | + /* Anon VMA expected */ | ||
3824 | + if (!vma->anon_vma || vma->vm_ops) | ||
3825 | + return SCAN_VMA_CHECK; | ||
3826 | return 0; | ||
3827 | } | ||
3828 | |||
3829 | diff --git a/mm/memcontrol.c b/mm/memcontrol.c | ||
3830 | index a3f4c35bb5fa..402c8bc65e08 100644 | ||
3831 | --- a/mm/memcontrol.c | ||
3832 | +++ b/mm/memcontrol.c | ||
3833 | @@ -5770,7 +5770,6 @@ static void __mem_cgroup_clear_mc(void) | ||
3834 | if (!mem_cgroup_is_root(mc.to)) | ||
3835 | page_counter_uncharge(&mc.to->memory, mc.moved_swap); | ||
3836 | |||
3837 | - mem_cgroup_id_get_many(mc.to, mc.moved_swap); | ||
3838 | css_put_many(&mc.to->css, mc.moved_swap); | ||
3839 | |||
3840 | mc.moved_swap = 0; | ||
3841 | @@ -5961,7 +5960,8 @@ put: /* get_mctgt_type() gets the page */ | ||
3842 | ent = target.ent; | ||
3843 | if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) { | ||
3844 | mc.precharge--; | ||
3845 | - /* we fixup refcnts and charges later. */ | ||
3846 | + mem_cgroup_id_get_many(mc.to, 1); | ||
3847 | + /* we fixup other refcnts and charges later. */ | ||
3848 | mc.moved_swap++; | ||
3849 | } | ||
3850 | break; | ||
3851 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
3852 | index 514cc19c5916..ea1ba2db4f4f 100644 | ||
3853 | --- a/mm/mmap.c | ||
3854 | +++ b/mm/mmap.c | ||
3855 | @@ -2622,7 +2622,7 @@ static void unmap_region(struct mm_struct *mm, | ||
3856 | * Create a list of vma's touched by the unmap, removing them from the mm's | ||
3857 | * vma list as we go.. | ||
3858 | */ | ||
3859 | -static void | ||
3860 | +static bool | ||
3861 | detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, | ||
3862 | struct vm_area_struct *prev, unsigned long end) | ||
3863 | { | ||
3864 | @@ -2647,6 +2647,17 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, | ||
3865 | |||
3866 | /* Kill the cache */ | ||
3867 | vmacache_invalidate(mm); | ||
3868 | + | ||
3869 | + /* | ||
3870 | + * Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or | ||
3871 | + * VM_GROWSUP VMA. Such VMAs can change their size under | ||
3872 | + * down_read(mmap_lock) and collide with the VMA we are about to unmap. | ||
3873 | + */ | ||
3874 | + if (vma && (vma->vm_flags & VM_GROWSDOWN)) | ||
3875 | + return false; | ||
3876 | + if (prev && (prev->vm_flags & VM_GROWSUP)) | ||
3877 | + return false; | ||
3878 | + return true; | ||
3879 | } | ||
3880 | |||
3881 | /* | ||
3882 | @@ -2827,7 +2838,8 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len, | ||
3883 | } | ||
3884 | |||
3885 | /* Detach vmas from rbtree */ | ||
3886 | - detach_vmas_to_be_unmapped(mm, vma, prev, end); | ||
3887 | + if (!detach_vmas_to_be_unmapped(mm, vma, prev, end)) | ||
3888 | + downgrade = false; | ||
3889 | |||
3890 | if (downgrade) | ||
3891 | downgrade_write(&mm->mmap_sem); | ||
3892 | diff --git a/mm/slab_common.c b/mm/slab_common.c | ||
3893 | index 8c1ffbf7de45..e36dd36c7076 100644 | ||
3894 | --- a/mm/slab_common.c | ||
3895 | +++ b/mm/slab_common.c | ||
3896 | @@ -326,6 +326,14 @@ int slab_unmergeable(struct kmem_cache *s) | ||
3897 | if (s->refcount < 0) | ||
3898 | return 1; | ||
3899 | |||
3900 | +#ifdef CONFIG_MEMCG_KMEM | ||
3901 | + /* | ||
3902 | + * Skip the dying kmem_cache. | ||
3903 | + */ | ||
3904 | + if (s->memcg_params.dying) | ||
3905 | + return 1; | ||
3906 | +#endif | ||
3907 | + | ||
3908 | return 0; | ||
3909 | } | ||
3910 | |||
3911 | @@ -886,12 +894,15 @@ static int shutdown_memcg_caches(struct kmem_cache *s) | ||
3912 | return 0; | ||
3913 | } | ||
3914 | |||
3915 | -static void flush_memcg_workqueue(struct kmem_cache *s) | ||
3916 | +static void memcg_set_kmem_cache_dying(struct kmem_cache *s) | ||
3917 | { | ||
3918 | spin_lock_irq(&memcg_kmem_wq_lock); | ||
3919 | s->memcg_params.dying = true; | ||
3920 | spin_unlock_irq(&memcg_kmem_wq_lock); | ||
3921 | +} | ||
3922 | |||
3923 | +static void flush_memcg_workqueue(struct kmem_cache *s) | ||
3924 | +{ | ||
3925 | /* | ||
3926 | * SLAB and SLUB deactivate the kmem_caches through call_rcu. Make | ||
3927 | * sure all registered rcu callbacks have been invoked. | ||
3928 | @@ -923,10 +934,6 @@ static inline int shutdown_memcg_caches(struct kmem_cache *s) | ||
3929 | { | ||
3930 | return 0; | ||
3931 | } | ||
3932 | - | ||
3933 | -static inline void flush_memcg_workqueue(struct kmem_cache *s) | ||
3934 | -{ | ||
3935 | -} | ||
3936 | #endif /* CONFIG_MEMCG_KMEM */ | ||
3937 | |||
3938 | void slab_kmem_cache_release(struct kmem_cache *s) | ||
3939 | @@ -944,8 +951,6 @@ void kmem_cache_destroy(struct kmem_cache *s) | ||
3940 | if (unlikely(!s)) | ||
3941 | return; | ||
3942 | |||
3943 | - flush_memcg_workqueue(s); | ||
3944 | - | ||
3945 | get_online_cpus(); | ||
3946 | get_online_mems(); | ||
3947 | |||
3948 | @@ -955,6 +960,22 @@ void kmem_cache_destroy(struct kmem_cache *s) | ||
3949 | if (s->refcount) | ||
3950 | goto out_unlock; | ||
3951 | |||
3952 | +#ifdef CONFIG_MEMCG_KMEM | ||
3953 | + memcg_set_kmem_cache_dying(s); | ||
3954 | + | ||
3955 | + mutex_unlock(&slab_mutex); | ||
3956 | + | ||
3957 | + put_online_mems(); | ||
3958 | + put_online_cpus(); | ||
3959 | + | ||
3960 | + flush_memcg_workqueue(s); | ||
3961 | + | ||
3962 | + get_online_cpus(); | ||
3963 | + get_online_mems(); | ||
3964 | + | ||
3965 | + mutex_lock(&slab_mutex); | ||
3966 | +#endif | ||
3967 | + | ||
3968 | err = shutdown_memcg_caches(s); | ||
3969 | if (!err) | ||
3970 | err = shutdown_cache(s); | ||
3971 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c | ||
3972 | index 69429c8df7b3..e5fb9002d314 100644 | ||
3973 | --- a/net/mac80211/rx.c | ||
3974 | +++ b/net/mac80211/rx.c | ||
3975 | @@ -2305,6 +2305,7 @@ static int ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) | ||
3976 | |||
3977 | static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) | ||
3978 | { | ||
3979 | + struct ieee80211_hdr *hdr = (void *)rx->skb->data; | ||
3980 | struct sk_buff *skb = rx->skb; | ||
3981 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
3982 | |||
3983 | @@ -2315,6 +2316,31 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) | ||
3984 | if (status->flag & RX_FLAG_DECRYPTED) | ||
3985 | return 0; | ||
3986 | |||
3987 | + /* check mesh EAPOL frames first */ | ||
3988 | + if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) && | ||
3989 | + ieee80211_is_data(fc))) { | ||
3990 | + struct ieee80211s_hdr *mesh_hdr; | ||
3991 | + u16 hdr_len = ieee80211_hdrlen(fc); | ||
3992 | + u16 ethertype_offset; | ||
3993 | + __be16 ethertype; | ||
3994 | + | ||
3995 | + if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr)) | ||
3996 | + goto drop_check; | ||
3997 | + | ||
3998 | + /* make sure fixed part of mesh header is there, also checks skb len */ | ||
3999 | + if (!pskb_may_pull(rx->skb, hdr_len + 6)) | ||
4000 | + goto drop_check; | ||
4001 | + | ||
4002 | + mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len); | ||
4003 | + ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) + | ||
4004 | + sizeof(rfc1042_header); | ||
4005 | + | ||
4006 | + if (skb_copy_bits(rx->skb, ethertype_offset, ðertype, 2) == 0 && | ||
4007 | + ethertype == rx->sdata->control_port_protocol) | ||
4008 | + return 0; | ||
4009 | + } | ||
4010 | + | ||
4011 | +drop_check: | ||
4012 | /* Drop unencrypted frames if key is set. */ | ||
4013 | if (unlikely(!ieee80211_has_protected(fc) && | ||
4014 | !ieee80211_is_any_nullfunc(fc) && | ||
4015 | diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c | ||
4016 | index 8dc892a9dc91..0c1bc654245c 100644 | ||
4017 | --- a/net/netfilter/ipvs/ip_vs_sync.c | ||
4018 | +++ b/net/netfilter/ipvs/ip_vs_sync.c | ||
4019 | @@ -1717,6 +1717,8 @@ static int sync_thread_backup(void *data) | ||
4020 | { | ||
4021 | struct ip_vs_sync_thread_data *tinfo = data; | ||
4022 | struct netns_ipvs *ipvs = tinfo->ipvs; | ||
4023 | + struct sock *sk = tinfo->sock->sk; | ||
4024 | + struct udp_sock *up = udp_sk(sk); | ||
4025 | int len; | ||
4026 | |||
4027 | pr_info("sync thread started: state = BACKUP, mcast_ifn = %s, " | ||
4028 | @@ -1724,12 +1726,14 @@ static int sync_thread_backup(void *data) | ||
4029 | ipvs->bcfg.mcast_ifn, ipvs->bcfg.syncid, tinfo->id); | ||
4030 | |||
4031 | while (!kthread_should_stop()) { | ||
4032 | - wait_event_interruptible(*sk_sleep(tinfo->sock->sk), | ||
4033 | - !skb_queue_empty(&tinfo->sock->sk->sk_receive_queue) | ||
4034 | - || kthread_should_stop()); | ||
4035 | + wait_event_interruptible(*sk_sleep(sk), | ||
4036 | + !skb_queue_empty_lockless(&sk->sk_receive_queue) || | ||
4037 | + !skb_queue_empty_lockless(&up->reader_queue) || | ||
4038 | + kthread_should_stop()); | ||
4039 | |||
4040 | /* do we have data now? */ | ||
4041 | - while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) { | ||
4042 | + while (!skb_queue_empty_lockless(&sk->sk_receive_queue) || | ||
4043 | + !skb_queue_empty_lockless(&up->reader_queue)) { | ||
4044 | len = ip_vs_receive(tinfo->sock, tinfo->buf, | ||
4045 | ipvs->bcfg.sync_maxlen); | ||
4046 | if (len <= 0) { | ||
4047 | diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c | ||
4048 | index 082a30936690..861ec9a671f9 100644 | ||
4049 | --- a/net/vmw_vsock/virtio_transport.c | ||
4050 | +++ b/net/vmw_vsock/virtio_transport.c | ||
4051 | @@ -22,7 +22,7 @@ | ||
4052 | #include <net/af_vsock.h> | ||
4053 | |||
4054 | static struct workqueue_struct *virtio_vsock_workqueue; | ||
4055 | -static struct virtio_vsock *the_virtio_vsock; | ||
4056 | +static struct virtio_vsock __rcu *the_virtio_vsock; | ||
4057 | static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */ | ||
4058 | |||
4059 | struct virtio_vsock { | ||
4060 | diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh | ||
4061 | index 13e5fbafdf2f..fe7076fdac8a 100755 | ||
4062 | --- a/scripts/decode_stacktrace.sh | ||
4063 | +++ b/scripts/decode_stacktrace.sh | ||
4064 | @@ -84,8 +84,8 @@ parse_symbol() { | ||
4065 | return | ||
4066 | fi | ||
4067 | |||
4068 | - # Strip out the base of the path | ||
4069 | - code=${code#$basepath/} | ||
4070 | + # Strip out the base of the path on each line | ||
4071 | + code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code") | ||
4072 | |||
4073 | # In the case of inlines, move everything to same line | ||
4074 | code=${code//$'\n'/' '} | ||
4075 | diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py | ||
4076 | index be984aa29b75..1be9763cf8bb 100644 | ||
4077 | --- a/scripts/gdb/linux/symbols.py | ||
4078 | +++ b/scripts/gdb/linux/symbols.py | ||
4079 | @@ -96,7 +96,7 @@ lx-symbols command.""" | ||
4080 | return "" | ||
4081 | attrs = sect_attrs['attrs'] | ||
4082 | section_name_to_address = { | ||
4083 | - attrs[n]['name'].string(): attrs[n]['address'] | ||
4084 | + attrs[n]['battr']['attr']['name'].string(): attrs[n]['address'] | ||
4085 | for n in range(int(sect_attrs['nsections']))} | ||
4086 | args = [] | ||
4087 | for section_name in [".data", ".data..read_mostly", ".rodata", ".bss", | ||
4088 | diff --git a/sound/core/info.c b/sound/core/info.c | ||
4089 | index e051a029ccfb..f18f4ef6661e 100644 | ||
4090 | --- a/sound/core/info.c | ||
4091 | +++ b/sound/core/info.c | ||
4092 | @@ -608,7 +608,9 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len) | ||
4093 | { | ||
4094 | int c = -1; | ||
4095 | |||
4096 | - if (snd_BUG_ON(!buffer || !buffer->buffer)) | ||
4097 | + if (snd_BUG_ON(!buffer)) | ||
4098 | + return 1; | ||
4099 | + if (!buffer->buffer) | ||
4100 | return 1; | ||
4101 | if (len <= 0 || buffer->stop || buffer->error) | ||
4102 | return 1; | ||
4103 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c | ||
4104 | index e78c4367b6c8..820f534a67b1 100644 | ||
4105 | --- a/sound/pci/hda/patch_hdmi.c | ||
4106 | +++ b/sound/pci/hda/patch_hdmi.c | ||
4107 | @@ -1817,33 +1817,43 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) | ||
4108 | |||
4109 | static int hdmi_parse_codec(struct hda_codec *codec) | ||
4110 | { | ||
4111 | - hda_nid_t nid; | ||
4112 | + hda_nid_t start_nid; | ||
4113 | + unsigned int caps; | ||
4114 | int i, nodes; | ||
4115 | |||
4116 | - nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &nid); | ||
4117 | - if (!nid || nodes < 0) { | ||
4118 | + nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid); | ||
4119 | + if (!start_nid || nodes < 0) { | ||
4120 | codec_warn(codec, "HDMI: failed to get afg sub nodes\n"); | ||
4121 | return -EINVAL; | ||
4122 | } | ||
4123 | |||
4124 | - for (i = 0; i < nodes; i++, nid++) { | ||
4125 | - unsigned int caps; | ||
4126 | - unsigned int type; | ||
4127 | + /* | ||
4128 | + * hdmi_add_pin() assumes total amount of converters to | ||
4129 | + * be known, so first discover all converters | ||
4130 | + */ | ||
4131 | + for (i = 0; i < nodes; i++) { | ||
4132 | + hda_nid_t nid = start_nid + i; | ||
4133 | |||
4134 | caps = get_wcaps(codec, nid); | ||
4135 | - type = get_wcaps_type(caps); | ||
4136 | |||
4137 | if (!(caps & AC_WCAP_DIGITAL)) | ||
4138 | continue; | ||
4139 | |||
4140 | - switch (type) { | ||
4141 | - case AC_WID_AUD_OUT: | ||
4142 | + if (get_wcaps_type(caps) == AC_WID_AUD_OUT) | ||
4143 | hdmi_add_cvt(codec, nid); | ||
4144 | - break; | ||
4145 | - case AC_WID_PIN: | ||
4146 | + } | ||
4147 | + | ||
4148 | + /* discover audio pins */ | ||
4149 | + for (i = 0; i < nodes; i++) { | ||
4150 | + hda_nid_t nid = start_nid + i; | ||
4151 | + | ||
4152 | + caps = get_wcaps(codec, nid); | ||
4153 | + | ||
4154 | + if (!(caps & AC_WCAP_DIGITAL)) | ||
4155 | + continue; | ||
4156 | + | ||
4157 | + if (get_wcaps_type(caps) == AC_WID_PIN) | ||
4158 | hdmi_add_pin(codec, nid); | ||
4159 | - break; | ||
4160 | - } | ||
4161 | } | ||
4162 | |||
4163 | return 0; | ||
4164 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
4165 | index 6ffdf3d2d526..bf205621d7ac 100644 | ||
4166 | --- a/sound/pci/hda/patch_realtek.c | ||
4167 | +++ b/sound/pci/hda/patch_realtek.c | ||
4168 | @@ -7546,11 +7546,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
4169 | SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC), | ||
4170 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), | ||
4171 | SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), | ||
4172 | + SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC225_FIXUP_HEADSET_JACK), | ||
4173 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), | ||
4174 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), | ||
4175 | SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | ||
4176 | SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | ||
4177 | SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), | ||
4178 | + SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | ||
4179 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), | ||
4180 | SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), | ||
4181 | SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), | ||
4182 | diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c | ||
4183 | index 70fee6849ab0..f21181734170 100644 | ||
4184 | --- a/sound/soc/codecs/rt5670.c | ||
4185 | +++ b/sound/soc/codecs/rt5670.c | ||
4186 | @@ -31,18 +31,19 @@ | ||
4187 | #include "rt5670.h" | ||
4188 | #include "rt5670-dsp.h" | ||
4189 | |||
4190 | -#define RT5670_DEV_GPIO BIT(0) | ||
4191 | -#define RT5670_IN2_DIFF BIT(1) | ||
4192 | -#define RT5670_DMIC_EN BIT(2) | ||
4193 | -#define RT5670_DMIC1_IN2P BIT(3) | ||
4194 | -#define RT5670_DMIC1_GPIO6 BIT(4) | ||
4195 | -#define RT5670_DMIC1_GPIO7 BIT(5) | ||
4196 | -#define RT5670_DMIC2_INR BIT(6) | ||
4197 | -#define RT5670_DMIC2_GPIO8 BIT(7) | ||
4198 | -#define RT5670_DMIC3_GPIO5 BIT(8) | ||
4199 | -#define RT5670_JD_MODE1 BIT(9) | ||
4200 | -#define RT5670_JD_MODE2 BIT(10) | ||
4201 | -#define RT5670_JD_MODE3 BIT(11) | ||
4202 | +#define RT5670_DEV_GPIO BIT(0) | ||
4203 | +#define RT5670_IN2_DIFF BIT(1) | ||
4204 | +#define RT5670_DMIC_EN BIT(2) | ||
4205 | +#define RT5670_DMIC1_IN2P BIT(3) | ||
4206 | +#define RT5670_DMIC1_GPIO6 BIT(4) | ||
4207 | +#define RT5670_DMIC1_GPIO7 BIT(5) | ||
4208 | +#define RT5670_DMIC2_INR BIT(6) | ||
4209 | +#define RT5670_DMIC2_GPIO8 BIT(7) | ||
4210 | +#define RT5670_DMIC3_GPIO5 BIT(8) | ||
4211 | +#define RT5670_JD_MODE1 BIT(9) | ||
4212 | +#define RT5670_JD_MODE2 BIT(10) | ||
4213 | +#define RT5670_JD_MODE3 BIT(11) | ||
4214 | +#define RT5670_GPIO1_IS_EXT_SPK_EN BIT(12) | ||
4215 | |||
4216 | static unsigned long rt5670_quirk; | ||
4217 | static unsigned int quirk_override; | ||
4218 | @@ -1447,6 +1448,33 @@ static int rt5670_hp_event(struct snd_soc_dapm_widget *w, | ||
4219 | return 0; | ||
4220 | } | ||
4221 | |||
4222 | +static int rt5670_spk_event(struct snd_soc_dapm_widget *w, | ||
4223 | + struct snd_kcontrol *kcontrol, int event) | ||
4224 | +{ | ||
4225 | + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | ||
4226 | + struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | ||
4227 | + | ||
4228 | + if (!rt5670->pdata.gpio1_is_ext_spk_en) | ||
4229 | + return 0; | ||
4230 | + | ||
4231 | + switch (event) { | ||
4232 | + case SND_SOC_DAPM_POST_PMU: | ||
4233 | + regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, | ||
4234 | + RT5670_GP1_OUT_MASK, RT5670_GP1_OUT_HI); | ||
4235 | + break; | ||
4236 | + | ||
4237 | + case SND_SOC_DAPM_PRE_PMD: | ||
4238 | + regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, | ||
4239 | + RT5670_GP1_OUT_MASK, RT5670_GP1_OUT_LO); | ||
4240 | + break; | ||
4241 | + | ||
4242 | + default: | ||
4243 | + return 0; | ||
4244 | + } | ||
4245 | + | ||
4246 | + return 0; | ||
4247 | +} | ||
4248 | + | ||
4249 | static int rt5670_bst1_event(struct snd_soc_dapm_widget *w, | ||
4250 | struct snd_kcontrol *kcontrol, int event) | ||
4251 | { | ||
4252 | @@ -1860,7 +1888,9 @@ static const struct snd_soc_dapm_widget rt5670_specific_dapm_widgets[] = { | ||
4253 | }; | ||
4254 | |||
4255 | static const struct snd_soc_dapm_widget rt5672_specific_dapm_widgets[] = { | ||
4256 | - SND_SOC_DAPM_PGA("SPO Amp", SND_SOC_NOPM, 0, 0, NULL, 0), | ||
4257 | + SND_SOC_DAPM_PGA_E("SPO Amp", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
4258 | + rt5670_spk_event, SND_SOC_DAPM_PRE_PMD | | ||
4259 | + SND_SOC_DAPM_POST_PMU), | ||
4260 | SND_SOC_DAPM_OUTPUT("SPOLP"), | ||
4261 | SND_SOC_DAPM_OUTPUT("SPOLN"), | ||
4262 | SND_SOC_DAPM_OUTPUT("SPORP"), | ||
4263 | @@ -2857,14 +2887,14 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = { | ||
4264 | }, | ||
4265 | { | ||
4266 | .callback = rt5670_quirk_cb, | ||
4267 | - .ident = "Lenovo Thinkpad Tablet 10", | ||
4268 | + .ident = "Lenovo Miix 2 10", | ||
4269 | .matches = { | ||
4270 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
4271 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"), | ||
4272 | }, | ||
4273 | .driver_data = (unsigned long *)(RT5670_DMIC_EN | | ||
4274 | RT5670_DMIC1_IN2P | | ||
4275 | - RT5670_DEV_GPIO | | ||
4276 | + RT5670_GPIO1_IS_EXT_SPK_EN | | ||
4277 | RT5670_JD_MODE2), | ||
4278 | }, | ||
4279 | { | ||
4280 | @@ -2924,6 +2954,10 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | ||
4281 | rt5670->pdata.dev_gpio = true; | ||
4282 | dev_info(&i2c->dev, "quirk dev_gpio\n"); | ||
4283 | } | ||
4284 | + if (rt5670_quirk & RT5670_GPIO1_IS_EXT_SPK_EN) { | ||
4285 | + rt5670->pdata.gpio1_is_ext_spk_en = true; | ||
4286 | + dev_info(&i2c->dev, "quirk GPIO1 is external speaker enable\n"); | ||
4287 | + } | ||
4288 | if (rt5670_quirk & RT5670_IN2_DIFF) { | ||
4289 | rt5670->pdata.in2_diff = true; | ||
4290 | dev_info(&i2c->dev, "quirk IN2_DIFF\n"); | ||
4291 | @@ -3023,6 +3057,13 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | ||
4292 | RT5670_GP1_PF_MASK, RT5670_GP1_PF_OUT); | ||
4293 | } | ||
4294 | |||
4295 | + if (rt5670->pdata.gpio1_is_ext_spk_en) { | ||
4296 | + regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1, | ||
4297 | + RT5670_GP1_PIN_MASK, RT5670_GP1_PIN_GPIO1); | ||
4298 | + regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2, | ||
4299 | + RT5670_GP1_PF_MASK, RT5670_GP1_PF_OUT); | ||
4300 | + } | ||
4301 | + | ||
4302 | if (rt5670->pdata.jd_mode) { | ||
4303 | regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK, | ||
4304 | RT5670_SCLK_SRC_MASK, RT5670_SCLK_SRC_RCCLK); | ||
4305 | diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h | ||
4306 | index a8c3e44770b8..de0203369b7c 100644 | ||
4307 | --- a/sound/soc/codecs/rt5670.h | ||
4308 | +++ b/sound/soc/codecs/rt5670.h | ||
4309 | @@ -757,7 +757,7 @@ | ||
4310 | #define RT5670_PWR_VREF2_BIT 4 | ||
4311 | #define RT5670_PWR_FV2 (0x1 << 3) | ||
4312 | #define RT5670_PWR_FV2_BIT 3 | ||
4313 | -#define RT5670_LDO_SEL_MASK (0x3) | ||
4314 | +#define RT5670_LDO_SEL_MASK (0x7) | ||
4315 | #define RT5670_LDO_SEL_SFT 0 | ||
4316 | |||
4317 | /* Power Management for Analog 2 (0x64) */ | ||
4318 | diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c | ||
4319 | index 54e97455d7f6..ed332177b0f9 100644 | ||
4320 | --- a/sound/soc/intel/boards/bytcht_es8316.c | ||
4321 | +++ b/sound/soc/intel/boards/bytcht_es8316.c | ||
4322 | @@ -548,8 +548,10 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) | ||
4323 | |||
4324 | if (cnt) { | ||
4325 | ret = device_add_properties(codec_dev, props); | ||
4326 | - if (ret) | ||
4327 | + if (ret) { | ||
4328 | + put_device(codec_dev); | ||
4329 | return ret; | ||
4330 | + } | ||
4331 | } | ||
4332 | |||
4333 | devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios); | ||
4334 | diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig | ||
4335 | index 60086858e920..b9d8fe9f996a 100644 | ||
4336 | --- a/sound/soc/qcom/Kconfig | ||
4337 | +++ b/sound/soc/qcom/Kconfig | ||
4338 | @@ -72,7 +72,7 @@ config SND_SOC_QDSP6_ASM_DAI | ||
4339 | |||
4340 | config SND_SOC_QDSP6 | ||
4341 | tristate "SoC ALSA audio driver for QDSP6" | ||
4342 | - depends on QCOM_APR && HAS_DMA | ||
4343 | + depends on QCOM_APR | ||
4344 | select SND_SOC_QDSP6_COMMON | ||
4345 | select SND_SOC_QDSP6_CORE | ||
4346 | select SND_SOC_QDSP6_AFE | ||
4347 | diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c | ||
4348 | index 65c91abb9462..0100f123484e 100644 | ||
4349 | --- a/sound/soc/soc-topology.c | ||
4350 | +++ b/sound/soc/soc-topology.c | ||
4351 | @@ -1284,17 +1284,29 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, | ||
4352 | list_add(&routes[i]->dobj.list, &tplg->comp->dobj_list); | ||
4353 | |||
4354 | ret = soc_tplg_add_route(tplg, routes[i]); | ||
4355 | - if (ret < 0) | ||
4356 | + if (ret < 0) { | ||
4357 | + /* | ||
4358 | + * this route was added to the list, it will | ||
4359 | + * be freed in remove_route() so increment the | ||
4360 | + * counter to skip it in the error handling | ||
4361 | + * below. | ||
4362 | + */ | ||
4363 | + i++; | ||
4364 | break; | ||
4365 | + } | ||
4366 | |||
4367 | /* add route, but keep going if some fail */ | ||
4368 | snd_soc_dapm_add_routes(dapm, routes[i], 1); | ||
4369 | } | ||
4370 | |||
4371 | - /* free memory allocated for all dapm routes in case of error */ | ||
4372 | - if (ret < 0) | ||
4373 | - for (i = 0; i < count ; i++) | ||
4374 | - kfree(routes[i]); | ||
4375 | + /* | ||
4376 | + * free memory allocated for all dapm routes not added to the | ||
4377 | + * list in case of error | ||
4378 | + */ | ||
4379 | + if (ret < 0) { | ||
4380 | + while (i < count) | ||
4381 | + kfree(routes[i++]); | ||
4382 | + } | ||
4383 | |||
4384 | /* | ||
4385 | * free pointer to array of dapm routes as this is no longer needed. | ||
4386 | @@ -1382,7 +1394,6 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create( | ||
4387 | if (err < 0) { | ||
4388 | dev_err(tplg->dev, "ASoC: failed to init %s\n", | ||
4389 | mc->hdr.name); | ||
4390 | - soc_tplg_free_tlv(tplg, &kc[i]); | ||
4391 | goto err_sm; | ||
4392 | } | ||
4393 | } | ||
4394 | @@ -1390,6 +1401,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create( | ||
4395 | |||
4396 | err_sm: | ||
4397 | for (; i >= 0; i--) { | ||
4398 | + soc_tplg_free_tlv(tplg, &kc[i]); | ||
4399 | sm = (struct soc_mixer_control *)kc[i].private_value; | ||
4400 | kfree(sm); | ||
4401 | kfree(kc[i].name); |