Contents of /trunk/kernel-alx/patches-5.4/0127-5.4.28-all-fixes.patch
Parent Directory | Revision Log
Revision 3508 -
(show annotations)
(download)
Mon May 11 14:36:31 2020 UTC (4 years, 4 months ago) by niro
File size: 112727 byte(s)
Mon May 11 14:36:31 2020 UTC (4 years, 4 months ago) by niro
File size: 112727 byte(s)
-linux-5.4.28
1 | diff --git a/Documentation/kbuild/modules.rst b/Documentation/kbuild/modules.rst |
2 | index 774a998dcf37..199ce72bf922 100644 |
3 | --- a/Documentation/kbuild/modules.rst |
4 | +++ b/Documentation/kbuild/modules.rst |
5 | @@ -470,9 +470,9 @@ build. |
6 | |
7 | The syntax of the Module.symvers file is:: |
8 | |
9 | - <CRC> <Symbol> <Namespace> <Module> <Export Type> |
10 | + <CRC> <Symbol> <Module> <Export Type> <Namespace> |
11 | |
12 | - 0xe1cc2a05 usb_stor_suspend USB_STORAGE drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL |
13 | + 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGE |
14 | |
15 | The fields are separated by tabs and values may be empty (e.g. |
16 | if no namespace is defined for an exported symbol). |
17 | diff --git a/Makefile b/Makefile |
18 | index 36a0847534dd..b015cc894123 100644 |
19 | --- a/Makefile |
20 | +++ b/Makefile |
21 | @@ -1,7 +1,7 @@ |
22 | # SPDX-License-Identifier: GPL-2.0 |
23 | VERSION = 5 |
24 | PATCHLEVEL = 4 |
25 | -SUBLEVEL = 27 |
26 | +SUBLEVEL = 28 |
27 | EXTRAVERSION = |
28 | NAME = Kleptomaniac Octopus |
29 | |
30 | diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi |
31 | index c3954e34835b..3ae4f6358da4 100644 |
32 | --- a/arch/arm/boot/dts/dra7-l4.dtsi |
33 | +++ b/arch/arm/boot/dts/dra7-l4.dtsi |
34 | @@ -3413,6 +3413,7 @@ |
35 | clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER13_CLKCTRL 24>; |
36 | clock-names = "fck"; |
37 | interrupts = <GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH>; |
38 | + ti,timer-pwm; |
39 | }; |
40 | }; |
41 | |
42 | @@ -3441,6 +3442,7 @@ |
43 | clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER14_CLKCTRL 24>; |
44 | clock-names = "fck"; |
45 | interrupts = <GIC_SPI 340 IRQ_TYPE_LEVEL_HIGH>; |
46 | + ti,timer-pwm; |
47 | }; |
48 | }; |
49 | |
50 | @@ -3469,6 +3471,7 @@ |
51 | clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER15_CLKCTRL 24>; |
52 | clock-names = "fck"; |
53 | interrupts = <GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH>; |
54 | + ti,timer-pwm; |
55 | }; |
56 | }; |
57 | |
58 | @@ -3497,6 +3500,7 @@ |
59 | clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER16_CLKCTRL 24>; |
60 | clock-names = "fck"; |
61 | interrupts = <GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH>; |
62 | + ti,timer-pwm; |
63 | }; |
64 | }; |
65 | |
66 | diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi |
67 | index 953f0ffce2a9..6481d2b7d6b6 100644 |
68 | --- a/arch/arm/boot/dts/dra7.dtsi |
69 | +++ b/arch/arm/boot/dts/dra7.dtsi |
70 | @@ -184,6 +184,7 @@ |
71 | device_type = "pci"; |
72 | ranges = <0x81000000 0 0 0x03000 0 0x00010000 |
73 | 0x82000000 0 0x20013000 0x13000 0 0xffed000>; |
74 | + dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>; |
75 | bus-range = <0x00 0xff>; |
76 | #interrupt-cells = <1>; |
77 | num-lanes = <1>; |
78 | @@ -238,6 +239,7 @@ |
79 | device_type = "pci"; |
80 | ranges = <0x81000000 0 0 0x03000 0 0x00010000 |
81 | 0x82000000 0 0x30013000 0x13000 0 0xffed000>; |
82 | + dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>; |
83 | bus-range = <0x00 0xff>; |
84 | #interrupt-cells = <1>; |
85 | num-lanes = <1>; |
86 | diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h |
87 | index 5af82587909e..8c1b73dc8f55 100644 |
88 | --- a/arch/arm64/include/asm/unistd.h |
89 | +++ b/arch/arm64/include/asm/unistd.h |
90 | @@ -25,8 +25,8 @@ |
91 | #define __NR_compat_gettimeofday 78 |
92 | #define __NR_compat_sigreturn 119 |
93 | #define __NR_compat_rt_sigreturn 173 |
94 | -#define __NR_compat_clock_getres 247 |
95 | #define __NR_compat_clock_gettime 263 |
96 | +#define __NR_compat_clock_getres 264 |
97 | #define __NR_compat_clock_gettime64 403 |
98 | #define __NR_compat_clock_getres_time64 406 |
99 | |
100 | diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c |
101 | index dc9fe879c279..993a4aedfd37 100644 |
102 | --- a/arch/arm64/kernel/smp.c |
103 | +++ b/arch/arm64/kernel/smp.c |
104 | @@ -955,11 +955,22 @@ void tick_broadcast(const struct cpumask *mask) |
105 | } |
106 | #endif |
107 | |
108 | +/* |
109 | + * The number of CPUs online, not counting this CPU (which may not be |
110 | + * fully online and so not counted in num_online_cpus()). |
111 | + */ |
112 | +static inline unsigned int num_other_online_cpus(void) |
113 | +{ |
114 | + unsigned int this_cpu_online = cpu_online(smp_processor_id()); |
115 | + |
116 | + return num_online_cpus() - this_cpu_online; |
117 | +} |
118 | + |
119 | void smp_send_stop(void) |
120 | { |
121 | unsigned long timeout; |
122 | |
123 | - if (num_online_cpus() > 1) { |
124 | + if (num_other_online_cpus()) { |
125 | cpumask_t mask; |
126 | |
127 | cpumask_copy(&mask, cpu_online_mask); |
128 | @@ -972,10 +983,10 @@ void smp_send_stop(void) |
129 | |
130 | /* Wait up to one second for other CPUs to stop */ |
131 | timeout = USEC_PER_SEC; |
132 | - while (num_online_cpus() > 1 && timeout--) |
133 | + while (num_other_online_cpus() && timeout--) |
134 | udelay(1); |
135 | |
136 | - if (num_online_cpus() > 1) |
137 | + if (num_other_online_cpus()) |
138 | pr_warning("SMP: failed to stop secondary CPUs %*pbl\n", |
139 | cpumask_pr_args(cpu_online_mask)); |
140 | |
141 | @@ -998,7 +1009,11 @@ void crash_smp_send_stop(void) |
142 | |
143 | cpus_stopped = 1; |
144 | |
145 | - if (num_online_cpus() == 1) { |
146 | + /* |
147 | + * If this cpu is the only one alive at this point in time, online or |
148 | + * not, there are no stop messages to be sent around, so just back out. |
149 | + */ |
150 | + if (num_other_online_cpus() == 0) { |
151 | sdei_mask_local_cpu(); |
152 | return; |
153 | } |
154 | @@ -1006,7 +1021,7 @@ void crash_smp_send_stop(void) |
155 | cpumask_copy(&mask, cpu_online_mask); |
156 | cpumask_clear_cpu(smp_processor_id(), &mask); |
157 | |
158 | - atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); |
159 | + atomic_set(&waiting_for_crash_ipi, num_other_online_cpus()); |
160 | |
161 | pr_crit("SMP: stopping secondary CPUs\n"); |
162 | smp_cross_call(&mask, IPI_CPU_CRASH_STOP); |
163 | diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S |
164 | index 060a1acd7c6d..4638d2863388 100644 |
165 | --- a/arch/powerpc/kernel/vmlinux.lds.S |
166 | +++ b/arch/powerpc/kernel/vmlinux.lds.S |
167 | @@ -326,6 +326,12 @@ SECTIONS |
168 | *(.branch_lt) |
169 | } |
170 | |
171 | +#ifdef CONFIG_DEBUG_INFO_BTF |
172 | + .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { |
173 | + *(.BTF) |
174 | + } |
175 | +#endif |
176 | + |
177 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
178 | __start_opd = .; |
179 | KEEP(*(.opd)) |
180 | diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig |
181 | index ade9699aa0dd..a0fa4be94a68 100644 |
182 | --- a/arch/riscv/Kconfig |
183 | +++ b/arch/riscv/Kconfig |
184 | @@ -101,6 +101,7 @@ config ARCH_FLATMEM_ENABLE |
185 | |
186 | config ARCH_SPARSEMEM_ENABLE |
187 | def_bool y |
188 | + depends on MMU |
189 | select SPARSEMEM_VMEMMAP_ENABLE |
190 | |
191 | config ARCH_SELECT_MEMORY_MODEL |
192 | diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c |
193 | index 70bb94ae61c5..6bf5b1674384 100644 |
194 | --- a/arch/riscv/kernel/module.c |
195 | +++ b/arch/riscv/kernel/module.c |
196 | @@ -8,6 +8,10 @@ |
197 | #include <linux/err.h> |
198 | #include <linux/errno.h> |
199 | #include <linux/moduleloader.h> |
200 | +#include <linux/vmalloc.h> |
201 | +#include <linux/sizes.h> |
202 | +#include <asm/pgtable.h> |
203 | +#include <asm/sections.h> |
204 | |
205 | static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v) |
206 | { |
207 | @@ -386,3 +390,15 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, |
208 | |
209 | return 0; |
210 | } |
211 | + |
212 | +#if defined(CONFIG_MMU) && defined(CONFIG_64BIT) |
213 | +#define VMALLOC_MODULE_START \ |
214 | + max(PFN_ALIGN((unsigned long)&_end - SZ_2G), VMALLOC_START) |
215 | +void *module_alloc(unsigned long size) |
216 | +{ |
217 | + return __vmalloc_node_range(size, 1, VMALLOC_MODULE_START, |
218 | + VMALLOC_END, GFP_KERNEL, |
219 | + PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, |
220 | + __builtin_return_address(0)); |
221 | +} |
222 | +#endif |
223 | diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c |
224 | index 573463d1c799..f5d813c1304d 100644 |
225 | --- a/arch/riscv/mm/init.c |
226 | +++ b/arch/riscv/mm/init.c |
227 | @@ -98,7 +98,7 @@ void __init setup_bootmem(void) |
228 | for_each_memblock(memory, reg) { |
229 | phys_addr_t end = reg->base + reg->size; |
230 | |
231 | - if (reg->base <= vmlinux_end && vmlinux_end <= end) { |
232 | + if (reg->base <= vmlinux_start && vmlinux_end <= end) { |
233 | mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET); |
234 | |
235 | /* |
236 | diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c |
237 | index 304d31d8cbbc..c494c8c05824 100644 |
238 | --- a/arch/x86/mm/fault.c |
239 | +++ b/arch/x86/mm/fault.c |
240 | @@ -189,7 +189,7 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) |
241 | return pmd_k; |
242 | } |
243 | |
244 | -void vmalloc_sync_all(void) |
245 | +static void vmalloc_sync(void) |
246 | { |
247 | unsigned long address; |
248 | |
249 | @@ -216,6 +216,16 @@ void vmalloc_sync_all(void) |
250 | } |
251 | } |
252 | |
253 | +void vmalloc_sync_mappings(void) |
254 | +{ |
255 | + vmalloc_sync(); |
256 | +} |
257 | + |
258 | +void vmalloc_sync_unmappings(void) |
259 | +{ |
260 | + vmalloc_sync(); |
261 | +} |
262 | + |
263 | /* |
264 | * 32-bit: |
265 | * |
266 | @@ -318,11 +328,23 @@ out: |
267 | |
268 | #else /* CONFIG_X86_64: */ |
269 | |
270 | -void vmalloc_sync_all(void) |
271 | +void vmalloc_sync_mappings(void) |
272 | { |
273 | + /* |
274 | + * 64-bit mappings might allocate new p4d/pud pages |
275 | + * that need to be propagated to all tasks' PGDs. |
276 | + */ |
277 | sync_global_pgds(VMALLOC_START & PGDIR_MASK, VMALLOC_END); |
278 | } |
279 | |
280 | +void vmalloc_sync_unmappings(void) |
281 | +{ |
282 | + /* |
283 | + * Unmappings never allocate or free p4d/pud pages. |
284 | + * No work is required here. |
285 | + */ |
286 | +} |
287 | + |
288 | /* |
289 | * 64-bit: |
290 | * |
291 | diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c |
292 | index d0e36d652264..86cd718e0380 100644 |
293 | --- a/block/bfq-cgroup.c |
294 | +++ b/block/bfq-cgroup.c |
295 | @@ -593,12 +593,13 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, |
296 | */ |
297 | entity = &bfqg->entity; |
298 | for_each_entity(entity) { |
299 | - bfqg = container_of(entity, struct bfq_group, entity); |
300 | - if (bfqg != bfqd->root_group) { |
301 | - parent = bfqg_parent(bfqg); |
302 | + struct bfq_group *curr_bfqg = container_of(entity, |
303 | + struct bfq_group, entity); |
304 | + if (curr_bfqg != bfqd->root_group) { |
305 | + parent = bfqg_parent(curr_bfqg); |
306 | if (!parent) |
307 | parent = bfqd->root_group; |
308 | - bfq_group_set_parent(bfqg, parent); |
309 | + bfq_group_set_parent(curr_bfqg, parent); |
310 | } |
311 | } |
312 | |
313 | diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c |
314 | index 777f6f7122b4..e0d82fab1f44 100644 |
315 | --- a/drivers/acpi/apei/ghes.c |
316 | +++ b/drivers/acpi/apei/ghes.c |
317 | @@ -171,7 +171,7 @@ int ghes_estatus_pool_init(int num_ghes) |
318 | * New allocation must be visible in all pgd before it can be found by |
319 | * an NMI allocating from the pool. |
320 | */ |
321 | - vmalloc_sync_all(); |
322 | + vmalloc_sync_mappings(); |
323 | |
324 | rc = gen_pool_add(ghes_estatus_pool, addr, PAGE_ALIGN(len), -1); |
325 | if (rc) |
326 | diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c |
327 | index 110e41f920c2..f303106b3362 100644 |
328 | --- a/drivers/android/binderfs.c |
329 | +++ b/drivers/android/binderfs.c |
330 | @@ -448,6 +448,7 @@ static int binderfs_binder_ctl_create(struct super_block *sb) |
331 | inode->i_uid = info->root_uid; |
332 | inode->i_gid = info->root_gid; |
333 | |
334 | + refcount_set(&device->ref, 1); |
335 | device->binderfs_inode = inode; |
336 | device->miscdev.minor = minor; |
337 | |
338 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
339 | index 81842ba8cd75..1e25ca34d876 100644 |
340 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
341 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
342 | @@ -694,11 +694,11 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, |
343 | ssize_t result = 0; |
344 | uint32_t offset, se, sh, cu, wave, simd, thread, bank, *data; |
345 | |
346 | - if (size & 3 || *pos & 3) |
347 | + if (size > 4096 || size & 3 || *pos & 3) |
348 | return -EINVAL; |
349 | |
350 | /* decode offset */ |
351 | - offset = *pos & GENMASK_ULL(11, 0); |
352 | + offset = (*pos & GENMASK_ULL(11, 0)) >> 2; |
353 | se = (*pos & GENMASK_ULL(19, 12)) >> 12; |
354 | sh = (*pos & GENMASK_ULL(27, 20)) >> 20; |
355 | cu = (*pos & GENMASK_ULL(35, 28)) >> 28; |
356 | @@ -729,7 +729,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, |
357 | while (size) { |
358 | uint32_t value; |
359 | |
360 | - value = data[offset++]; |
361 | + value = data[result >> 2]; |
362 | r = put_user(value, (uint32_t *)buf); |
363 | if (r) { |
364 | result = r; |
365 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
366 | index 2816d0329738..14417cebe38b 100644 |
367 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
368 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
369 | @@ -3555,6 +3555,7 @@ static int gfx_v10_0_kcq_init_queue(struct amdgpu_ring *ring) |
370 | |
371 | /* reset ring buffer */ |
372 | ring->wptr = 0; |
373 | + atomic64_set((atomic64_t *)&adev->wb.wb[ring->wptr_offs], 0); |
374 | amdgpu_ring_clear_ring(ring); |
375 | } else { |
376 | amdgpu_ring_clear_ring(ring); |
377 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
378 | index d85e1e559c82..40034efa64bb 100644 |
379 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
380 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
381 | @@ -3756,6 +3756,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) |
382 | |
383 | /* reset ring buffer */ |
384 | ring->wptr = 0; |
385 | + atomic64_set((atomic64_t *)&adev->wb.wb[ring->wptr_offs], 0); |
386 | amdgpu_ring_clear_ring(ring); |
387 | } else { |
388 | amdgpu_ring_clear_ring(ring); |
389 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
390 | index 16218a202b59..28a6c7b2ef4b 100644 |
391 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
392 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
393 | @@ -379,6 +379,7 @@ static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
394 | aconnector->dc_sink); |
395 | dc_sink_release(aconnector->dc_sink); |
396 | aconnector->dc_sink = NULL; |
397 | + aconnector->dc_link->cur_link_settings.lane_count = 0; |
398 | } |
399 | |
400 | drm_connector_unregister(connector); |
401 | diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c |
402 | index a02c10e23e0d..d163388c99a0 100644 |
403 | --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c |
404 | +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c |
405 | @@ -840,8 +840,8 @@ static void hubbub1_det_request_size( |
406 | |
407 | hubbub1_get_blk256_size(&blk256_width, &blk256_height, bpe); |
408 | |
409 | - swath_bytes_horz_wc = height * blk256_height * bpe; |
410 | - swath_bytes_vert_wc = width * blk256_width * bpe; |
411 | + swath_bytes_horz_wc = width * blk256_height * bpe; |
412 | + swath_bytes_vert_wc = height * blk256_width * bpe; |
413 | |
414 | *req128_horz_wc = (2 * swath_bytes_horz_wc <= detile_buf_size) ? |
415 | false : /* full 256B request */ |
416 | diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
417 | index 1326f2c734bf..41bf4aaff21c 100644 |
418 | --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
419 | +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
420 | @@ -1576,28 +1576,34 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) |
421 | frame.colorspace = HDMI_COLORSPACE_RGB; |
422 | |
423 | /* Set up colorimetry */ |
424 | - switch (hdmi->hdmi_data.enc_out_encoding) { |
425 | - case V4L2_YCBCR_ENC_601: |
426 | - if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) |
427 | - frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; |
428 | - else |
429 | + if (!hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { |
430 | + switch (hdmi->hdmi_data.enc_out_encoding) { |
431 | + case V4L2_YCBCR_ENC_601: |
432 | + if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) |
433 | + frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; |
434 | + else |
435 | + frame.colorimetry = HDMI_COLORIMETRY_ITU_601; |
436 | + frame.extended_colorimetry = |
437 | + HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; |
438 | + break; |
439 | + case V4L2_YCBCR_ENC_709: |
440 | + if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) |
441 | + frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; |
442 | + else |
443 | + frame.colorimetry = HDMI_COLORIMETRY_ITU_709; |
444 | + frame.extended_colorimetry = |
445 | + HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; |
446 | + break; |
447 | + default: /* Carries no data */ |
448 | frame.colorimetry = HDMI_COLORIMETRY_ITU_601; |
449 | + frame.extended_colorimetry = |
450 | + HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; |
451 | + break; |
452 | + } |
453 | + } else { |
454 | + frame.colorimetry = HDMI_COLORIMETRY_NONE; |
455 | frame.extended_colorimetry = |
456 | - HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; |
457 | - break; |
458 | - case V4L2_YCBCR_ENC_709: |
459 | - if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) |
460 | - frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; |
461 | - else |
462 | - frame.colorimetry = HDMI_COLORIMETRY_ITU_709; |
463 | - frame.extended_colorimetry = |
464 | - HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; |
465 | - break; |
466 | - default: /* Carries no data */ |
467 | - frame.colorimetry = HDMI_COLORIMETRY_ITU_601; |
468 | - frame.extended_colorimetry = |
469 | - HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; |
470 | - break; |
471 | + HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; |
472 | } |
473 | |
474 | frame.scan_mode = HDMI_SCAN_MODE_NONE; |
475 | diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c |
476 | index 18cb88b9105e..bf1bdb0aac19 100644 |
477 | --- a/drivers/gpu/drm/drm_client_modeset.c |
478 | +++ b/drivers/gpu/drm/drm_client_modeset.c |
479 | @@ -114,33 +114,6 @@ drm_client_find_modeset(struct drm_client_dev *client, struct drm_crtc *crtc) |
480 | return NULL; |
481 | } |
482 | |
483 | -static struct drm_display_mode * |
484 | -drm_connector_get_tiled_mode(struct drm_connector *connector) |
485 | -{ |
486 | - struct drm_display_mode *mode; |
487 | - |
488 | - list_for_each_entry(mode, &connector->modes, head) { |
489 | - if (mode->hdisplay == connector->tile_h_size && |
490 | - mode->vdisplay == connector->tile_v_size) |
491 | - return mode; |
492 | - } |
493 | - return NULL; |
494 | -} |
495 | - |
496 | -static struct drm_display_mode * |
497 | -drm_connector_fallback_non_tiled_mode(struct drm_connector *connector) |
498 | -{ |
499 | - struct drm_display_mode *mode; |
500 | - |
501 | - list_for_each_entry(mode, &connector->modes, head) { |
502 | - if (mode->hdisplay == connector->tile_h_size && |
503 | - mode->vdisplay == connector->tile_v_size) |
504 | - continue; |
505 | - return mode; |
506 | - } |
507 | - return NULL; |
508 | -} |
509 | - |
510 | static struct drm_display_mode * |
511 | drm_connector_has_preferred_mode(struct drm_connector *connector, int width, int height) |
512 | { |
513 | @@ -375,15 +348,8 @@ static bool drm_client_target_preferred(struct drm_connector **connectors, |
514 | struct drm_connector *connector; |
515 | u64 conn_configured = 0; |
516 | int tile_pass = 0; |
517 | - int num_tiled_conns = 0; |
518 | int i; |
519 | |
520 | - for (i = 0; i < connector_count; i++) { |
521 | - if (connectors[i]->has_tile && |
522 | - connectors[i]->status == connector_status_connected) |
523 | - num_tiled_conns++; |
524 | - } |
525 | - |
526 | retry: |
527 | for (i = 0; i < connector_count; i++) { |
528 | connector = connectors[i]; |
529 | @@ -433,28 +399,6 @@ retry: |
530 | list_for_each_entry(modes[i], &connector->modes, head) |
531 | break; |
532 | } |
533 | - /* |
534 | - * In case of tiled mode if all tiles not present fallback to |
535 | - * first available non tiled mode. |
536 | - * After all tiles are present, try to find the tiled mode |
537 | - * for all and if tiled mode not present due to fbcon size |
538 | - * limitations, use first non tiled mode only for |
539 | - * tile 0,0 and set to no mode for all other tiles. |
540 | - */ |
541 | - if (connector->has_tile) { |
542 | - if (num_tiled_conns < |
543 | - connector->num_h_tile * connector->num_v_tile || |
544 | - (connector->tile_h_loc == 0 && |
545 | - connector->tile_v_loc == 0 && |
546 | - !drm_connector_get_tiled_mode(connector))) { |
547 | - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n", |
548 | - connector->base.id); |
549 | - modes[i] = drm_connector_fallback_non_tiled_mode(connector); |
550 | - } else { |
551 | - modes[i] = drm_connector_get_tiled_mode(connector); |
552 | - } |
553 | - } |
554 | - |
555 | DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name : |
556 | "none"); |
557 | conn_configured |= BIT_ULL(i); |
558 | @@ -572,7 +516,6 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, |
559 | bool fallback = true, ret = true; |
560 | int num_connectors_enabled = 0; |
561 | int num_connectors_detected = 0; |
562 | - int num_tiled_conns = 0; |
563 | struct drm_modeset_acquire_ctx ctx; |
564 | |
565 | if (!drm_drv_uses_atomic_modeset(dev)) |
566 | @@ -590,11 +533,6 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, |
567 | memcpy(save_enabled, enabled, count); |
568 | mask = GENMASK(count - 1, 0); |
569 | conn_configured = 0; |
570 | - for (i = 0; i < count; i++) { |
571 | - if (connectors[i]->has_tile && |
572 | - connectors[i]->status == connector_status_connected) |
573 | - num_tiled_conns++; |
574 | - } |
575 | retry: |
576 | conn_seq = conn_configured; |
577 | for (i = 0; i < count; i++) { |
578 | @@ -694,16 +632,6 @@ retry: |
579 | connector->name); |
580 | modes[i] = &connector->state->crtc->mode; |
581 | } |
582 | - /* |
583 | - * In case of tiled modes, if all tiles are not present |
584 | - * then fallback to a non tiled mode. |
585 | - */ |
586 | - if (connector->has_tile && |
587 | - num_tiled_conns < connector->num_h_tile * connector->num_v_tile) { |
588 | - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n", |
589 | - connector->base.id); |
590 | - modes[i] = drm_connector_fallback_non_tiled_mode(connector); |
591 | - } |
592 | crtcs[i] = new_crtc; |
593 | |
594 | DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n", |
595 | diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c |
596 | index b481cafdde28..825abe38201a 100644 |
597 | --- a/drivers/gpu/drm/drm_lease.c |
598 | +++ b/drivers/gpu/drm/drm_lease.c |
599 | @@ -542,10 +542,12 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, |
600 | } |
601 | |
602 | DRM_DEBUG_LEASE("Creating lease\n"); |
603 | + /* lessee will take the ownership of leases */ |
604 | lessee = drm_lease_create(lessor, &leases); |
605 | |
606 | if (IS_ERR(lessee)) { |
607 | ret = PTR_ERR(lessee); |
608 | + idr_destroy(&leases); |
609 | goto out_leases; |
610 | } |
611 | |
612 | @@ -580,7 +582,6 @@ out_lessee: |
613 | |
614 | out_leases: |
615 | put_unused_fd(fd); |
616 | - idr_destroy(&leases); |
617 | |
618 | DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret); |
619 | return ret; |
620 | diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c |
621 | index 6926cee91b36..8ed94c994800 100644 |
622 | --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c |
623 | +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c |
624 | @@ -1750,8 +1750,9 @@ static int exynos_dsi_probe(struct platform_device *pdev) |
625 | ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies), |
626 | dsi->supplies); |
627 | if (ret) { |
628 | - dev_info(dev, "failed to get regulators: %d\n", ret); |
629 | - return -EPROBE_DEFER; |
630 | + if (ret != -EPROBE_DEFER) |
631 | + dev_info(dev, "failed to get regulators: %d\n", ret); |
632 | + return ret; |
633 | } |
634 | |
635 | dsi->clks = devm_kcalloc(dev, |
636 | @@ -1764,9 +1765,10 @@ static int exynos_dsi_probe(struct platform_device *pdev) |
637 | dsi->clks[i] = devm_clk_get(dev, clk_names[i]); |
638 | if (IS_ERR(dsi->clks[i])) { |
639 | if (strcmp(clk_names[i], "sclk_mipi") == 0) { |
640 | - strcpy(clk_names[i], OLD_SCLK_MIPI_CLK_NAME); |
641 | - i--; |
642 | - continue; |
643 | + dsi->clks[i] = devm_clk_get(dev, |
644 | + OLD_SCLK_MIPI_CLK_NAME); |
645 | + if (!IS_ERR(dsi->clks[i])) |
646 | + continue; |
647 | } |
648 | |
649 | dev_info(dev, "failed to get the clock: %s\n", |
650 | diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c |
651 | index 09aa73c0f2ad..0073a2b3b80a 100644 |
652 | --- a/drivers/gpu/drm/exynos/exynos_hdmi.c |
653 | +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c |
654 | @@ -1802,18 +1802,10 @@ static int hdmi_resources_init(struct hdmi_context *hdata) |
655 | |
656 | hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en"); |
657 | |
658 | - if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) { |
659 | + if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) |
660 | if (IS_ERR(hdata->reg_hdmi_en)) |
661 | return PTR_ERR(hdata->reg_hdmi_en); |
662 | |
663 | - ret = regulator_enable(hdata->reg_hdmi_en); |
664 | - if (ret) { |
665 | - DRM_DEV_ERROR(dev, |
666 | - "failed to enable hdmi-en regulator\n"); |
667 | - return ret; |
668 | - } |
669 | - } |
670 | - |
671 | return hdmi_bridge_init(hdata); |
672 | } |
673 | |
674 | @@ -2020,6 +2012,15 @@ static int hdmi_probe(struct platform_device *pdev) |
675 | } |
676 | } |
677 | |
678 | + if (!IS_ERR(hdata->reg_hdmi_en)) { |
679 | + ret = regulator_enable(hdata->reg_hdmi_en); |
680 | + if (ret) { |
681 | + DRM_DEV_ERROR(dev, |
682 | + "failed to enable hdmi-en regulator\n"); |
683 | + goto err_hdmiphy; |
684 | + } |
685 | + } |
686 | + |
687 | pm_runtime_enable(dev); |
688 | |
689 | audio_infoframe = &hdata->audio.infoframe; |
690 | @@ -2044,7 +2045,8 @@ err_unregister_audio: |
691 | |
692 | err_rpm_disable: |
693 | pm_runtime_disable(dev); |
694 | - |
695 | + if (!IS_ERR(hdata->reg_hdmi_en)) |
696 | + regulator_disable(hdata->reg_hdmi_en); |
697 | err_hdmiphy: |
698 | if (hdata->hdmiphy_port) |
699 | put_device(&hdata->hdmiphy_port->dev); |
700 | diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c |
701 | index e6c049f4f08b..f9455f2724d2 100644 |
702 | --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c |
703 | +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c |
704 | @@ -496,10 +496,18 @@ static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = { |
705 | |
706 | static int mtk_drm_crtc_init(struct drm_device *drm, |
707 | struct mtk_drm_crtc *mtk_crtc, |
708 | - struct drm_plane *primary, |
709 | - struct drm_plane *cursor, unsigned int pipe) |
710 | + unsigned int pipe) |
711 | { |
712 | - int ret; |
713 | + struct drm_plane *primary = NULL; |
714 | + struct drm_plane *cursor = NULL; |
715 | + int i, ret; |
716 | + |
717 | + for (i = 0; i < mtk_crtc->layer_nr; i++) { |
718 | + if (mtk_crtc->planes[i].type == DRM_PLANE_TYPE_PRIMARY) |
719 | + primary = &mtk_crtc->planes[i]; |
720 | + else if (mtk_crtc->planes[i].type == DRM_PLANE_TYPE_CURSOR) |
721 | + cursor = &mtk_crtc->planes[i]; |
722 | + } |
723 | |
724 | ret = drm_crtc_init_with_planes(drm, &mtk_crtc->base, primary, cursor, |
725 | &mtk_crtc_funcs, NULL); |
726 | @@ -608,9 +616,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, |
727 | return ret; |
728 | } |
729 | |
730 | - ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0], |
731 | - mtk_crtc->layer_nr > 1 ? &mtk_crtc->planes[1] : |
732 | - NULL, pipe); |
733 | + ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, pipe); |
734 | if (ret < 0) |
735 | return ret; |
736 | |
737 | diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c |
738 | index 8e48c7458aa3..255f8f41c8ff 100644 |
739 | --- a/drivers/hwtracing/intel_th/msu.c |
740 | +++ b/drivers/hwtracing/intel_th/msu.c |
741 | @@ -718,9 +718,6 @@ static int msc_win_set_lockout(struct msc_window *win, |
742 | |
743 | if (old != expect) { |
744 | ret = -EINVAL; |
745 | - dev_warn_ratelimited(msc_dev(win->msc), |
746 | - "expected lockout state %d, got %d\n", |
747 | - expect, old); |
748 | goto unlock; |
749 | } |
750 | |
751 | @@ -741,6 +738,10 @@ unlock: |
752 | /* from intel_th_msc_window_unlock(), don't warn if not locked */ |
753 | if (expect == WIN_LOCKED && old == new) |
754 | return 0; |
755 | + |
756 | + dev_warn_ratelimited(msc_dev(win->msc), |
757 | + "expected lockout state %d, got %d\n", |
758 | + expect, old); |
759 | } |
760 | |
761 | return ret; |
762 | @@ -760,7 +761,7 @@ static int msc_configure(struct msc *msc) |
763 | lockdep_assert_held(&msc->buf_mutex); |
764 | |
765 | if (msc->mode > MSC_MODE_MULTI) |
766 | - return -ENOTSUPP; |
767 | + return -EINVAL; |
768 | |
769 | if (msc->mode == MSC_MODE_MULTI) { |
770 | if (msc_win_set_lockout(msc->cur_win, WIN_READY, WIN_INUSE)) |
771 | @@ -1294,7 +1295,7 @@ static int msc_buffer_alloc(struct msc *msc, unsigned long *nr_pages, |
772 | } else if (msc->mode == MSC_MODE_MULTI) { |
773 | ret = msc_buffer_multi_alloc(msc, nr_pages, nr_wins); |
774 | } else { |
775 | - ret = -ENOTSUPP; |
776 | + ret = -EINVAL; |
777 | } |
778 | |
779 | if (!ret) { |
780 | @@ -1530,7 +1531,7 @@ static ssize_t intel_th_msc_read(struct file *file, char __user *buf, |
781 | if (ret >= 0) |
782 | *ppos = iter->offset; |
783 | } else { |
784 | - ret = -ENOTSUPP; |
785 | + ret = -EINVAL; |
786 | } |
787 | |
788 | put_count: |
789 | diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c |
790 | index e9d90b53bbc4..86aa6a46bcba 100644 |
791 | --- a/drivers/hwtracing/intel_th/pci.c |
792 | +++ b/drivers/hwtracing/intel_th/pci.c |
793 | @@ -234,6 +234,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { |
794 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), |
795 | .driver_data = (kernel_ulong_t)&intel_th_2x, |
796 | }, |
797 | + { |
798 | + /* Elkhart Lake CPU */ |
799 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4529), |
800 | + .driver_data = (kernel_ulong_t)&intel_th_2x, |
801 | + }, |
802 | { |
803 | /* Elkhart Lake */ |
804 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), |
805 | diff --git a/drivers/hwtracing/stm/p_sys-t.c b/drivers/hwtracing/stm/p_sys-t.c |
806 | index b178a5495b67..360b5c03df95 100644 |
807 | --- a/drivers/hwtracing/stm/p_sys-t.c |
808 | +++ b/drivers/hwtracing/stm/p_sys-t.c |
809 | @@ -238,7 +238,7 @@ static struct configfs_attribute *sys_t_policy_attrs[] = { |
810 | static inline bool sys_t_need_ts(struct sys_t_output *op) |
811 | { |
812 | if (op->node.ts_interval && |
813 | - time_after(op->ts_jiffies + op->node.ts_interval, jiffies)) { |
814 | + time_after(jiffies, op->ts_jiffies + op->node.ts_interval)) { |
815 | op->ts_jiffies = jiffies; |
816 | |
817 | return true; |
818 | @@ -250,8 +250,8 @@ static inline bool sys_t_need_ts(struct sys_t_output *op) |
819 | static bool sys_t_need_clock_sync(struct sys_t_output *op) |
820 | { |
821 | if (op->node.clocksync_interval && |
822 | - time_after(op->clocksync_jiffies + op->node.clocksync_interval, |
823 | - jiffies)) { |
824 | + time_after(jiffies, |
825 | + op->clocksync_jiffies + op->node.clocksync_interval)) { |
826 | op->clocksync_jiffies = jiffies; |
827 | |
828 | return true; |
829 | diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c |
830 | index 67b8817995c0..60daf04ce188 100644 |
831 | --- a/drivers/iio/accel/adxl372.c |
832 | +++ b/drivers/iio/accel/adxl372.c |
833 | @@ -237,6 +237,7 @@ static const struct adxl372_axis_lookup adxl372_axis_lookup_table[] = { |
834 | .realbits = 12, \ |
835 | .storagebits = 16, \ |
836 | .shift = 4, \ |
837 | + .endianness = IIO_BE, \ |
838 | }, \ |
839 | } |
840 | |
841 | diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c |
842 | index 50fa0fc32baa..0a0bffe04217 100644 |
843 | --- a/drivers/iio/accel/st_accel_i2c.c |
844 | +++ b/drivers/iio/accel/st_accel_i2c.c |
845 | @@ -114,7 +114,7 @@ MODULE_DEVICE_TABLE(of, st_accel_of_match); |
846 | |
847 | #ifdef CONFIG_ACPI |
848 | static const struct acpi_device_id st_accel_acpi_match[] = { |
849 | - {"SMO8840", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME}, |
850 | + {"SMO8840", (kernel_ulong_t)LIS2DH12_ACCEL_DEV_NAME}, |
851 | {"SMO8A90", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME}, |
852 | { }, |
853 | }; |
854 | diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c |
855 | index a2837a0e7cba..2c01963a6a5c 100644 |
856 | --- a/drivers/iio/adc/at91-sama5d2_adc.c |
857 | +++ b/drivers/iio/adc/at91-sama5d2_adc.c |
858 | @@ -723,6 +723,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) |
859 | |
860 | for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { |
861 | struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit); |
862 | + u32 cor; |
863 | |
864 | if (!chan) |
865 | continue; |
866 | @@ -731,6 +732,20 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) |
867 | chan->type == IIO_PRESSURE) |
868 | continue; |
869 | |
870 | + if (state) { |
871 | + cor = at91_adc_readl(st, AT91_SAMA5D2_COR); |
872 | + |
873 | + if (chan->differential) |
874 | + cor |= (BIT(chan->channel) | |
875 | + BIT(chan->channel2)) << |
876 | + AT91_SAMA5D2_COR_DIFF_OFFSET; |
877 | + else |
878 | + cor &= ~(BIT(chan->channel) << |
879 | + AT91_SAMA5D2_COR_DIFF_OFFSET); |
880 | + |
881 | + at91_adc_writel(st, AT91_SAMA5D2_COR, cor); |
882 | + } |
883 | + |
884 | if (state) { |
885 | at91_adc_writel(st, AT91_SAMA5D2_CHER, |
886 | BIT(chan->channel)); |
887 | diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c |
888 | index 0339ecdd06bd..3ae0366a7b58 100644 |
889 | --- a/drivers/iio/adc/stm32-dfsdm-adc.c |
890 | +++ b/drivers/iio/adc/stm32-dfsdm-adc.c |
891 | @@ -842,31 +842,6 @@ static inline void stm32_dfsdm_process_data(struct stm32_dfsdm_adc *adc, |
892 | } |
893 | } |
894 | |
895 | -static irqreturn_t stm32_dfsdm_adc_trigger_handler(int irq, void *p) |
896 | -{ |
897 | - struct iio_poll_func *pf = p; |
898 | - struct iio_dev *indio_dev = pf->indio_dev; |
899 | - struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); |
900 | - int available = stm32_dfsdm_adc_dma_residue(adc); |
901 | - |
902 | - while (available >= indio_dev->scan_bytes) { |
903 | - s32 *buffer = (s32 *)&adc->rx_buf[adc->bufi]; |
904 | - |
905 | - stm32_dfsdm_process_data(adc, buffer); |
906 | - |
907 | - iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
908 | - pf->timestamp); |
909 | - available -= indio_dev->scan_bytes; |
910 | - adc->bufi += indio_dev->scan_bytes; |
911 | - if (adc->bufi >= adc->buf_sz) |
912 | - adc->bufi = 0; |
913 | - } |
914 | - |
915 | - iio_trigger_notify_done(indio_dev->trig); |
916 | - |
917 | - return IRQ_HANDLED; |
918 | -} |
919 | - |
920 | static void stm32_dfsdm_dma_buffer_done(void *data) |
921 | { |
922 | struct iio_dev *indio_dev = data; |
923 | @@ -874,11 +849,6 @@ static void stm32_dfsdm_dma_buffer_done(void *data) |
924 | int available = stm32_dfsdm_adc_dma_residue(adc); |
925 | size_t old_pos; |
926 | |
927 | - if (indio_dev->currentmode & INDIO_BUFFER_TRIGGERED) { |
928 | - iio_trigger_poll_chained(indio_dev->trig); |
929 | - return; |
930 | - } |
931 | - |
932 | /* |
933 | * FIXME: In Kernel interface does not support cyclic DMA buffer,and |
934 | * offers only an interface to push data samples per samples. |
935 | @@ -906,7 +876,15 @@ static void stm32_dfsdm_dma_buffer_done(void *data) |
936 | adc->bufi = 0; |
937 | old_pos = 0; |
938 | } |
939 | - /* regular iio buffer without trigger */ |
940 | + /* |
941 | + * In DMA mode the trigger services of IIO are not used |
942 | + * (e.g. no call to iio_trigger_poll). |
943 | + * Calling irq handler associated to the hardware trigger is not |
944 | + * relevant as the conversions have already been done. Data |
945 | + * transfers are performed directly in DMA callback instead. |
946 | + * This implementation avoids to call trigger irq handler that |
947 | + * may sleep, in an atomic context (DMA irq handler context). |
948 | + */ |
949 | if (adc->dev_data->type == DFSDM_IIO) |
950 | iio_push_to_buffers(indio_dev, buffer); |
951 | } |
952 | @@ -1517,8 +1495,7 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev) |
953 | } |
954 | |
955 | ret = iio_triggered_buffer_setup(indio_dev, |
956 | - &iio_pollfunc_store_time, |
957 | - &stm32_dfsdm_adc_trigger_handler, |
958 | + &iio_pollfunc_store_time, NULL, |
959 | &stm32_dfsdm_buffer_setup_ops); |
960 | if (ret) { |
961 | stm32_dfsdm_dma_release(indio_dev); |
962 | diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig |
963 | index 0b91de4df8f4..a7e65a59bf42 100644 |
964 | --- a/drivers/iio/chemical/Kconfig |
965 | +++ b/drivers/iio/chemical/Kconfig |
966 | @@ -91,6 +91,8 @@ config SPS30 |
967 | tristate "SPS30 particulate matter sensor" |
968 | depends on I2C |
969 | select CRC8 |
970 | + select IIO_BUFFER |
971 | + select IIO_TRIGGERED_BUFFER |
972 | help |
973 | Say Y here to build support for the Sensirion SPS30 particulate |
974 | matter sensor. |
975 | diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c |
976 | index b0e241aaefb4..e5b00a6611ac 100644 |
977 | --- a/drivers/iio/light/vcnl4000.c |
978 | +++ b/drivers/iio/light/vcnl4000.c |
979 | @@ -167,16 +167,17 @@ static int vcnl4200_init(struct vcnl4000_data *data) |
980 | data->vcnl4200_ps.reg = VCNL4200_PS_DATA; |
981 | switch (id) { |
982 | case VCNL4200_PROD_ID: |
983 | - /* Integration time is 50ms, but the experiments */ |
984 | - /* show 54ms in total. */ |
985 | - data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000); |
986 | - data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000); |
987 | + /* Default wait time is 50ms, add 20% tolerance. */ |
988 | + data->vcnl4200_al.sampling_rate = ktime_set(0, 60000 * 1000); |
989 | + /* Default wait time is 4.8ms, add 20% tolerance. */ |
990 | + data->vcnl4200_ps.sampling_rate = ktime_set(0, 5760 * 1000); |
991 | data->al_scale = 24000; |
992 | break; |
993 | case VCNL4040_PROD_ID: |
994 | - /* Integration time is 80ms, add 10ms. */ |
995 | - data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000); |
996 | - data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000); |
997 | + /* Default wait time is 80ms, add 20% tolerance. */ |
998 | + data->vcnl4200_al.sampling_rate = ktime_set(0, 96000 * 1000); |
999 | + /* Default wait time is 5ms, add 20% tolerance. */ |
1000 | + data->vcnl4200_ps.sampling_rate = ktime_set(0, 6000 * 1000); |
1001 | data->al_scale = 120000; |
1002 | break; |
1003 | } |
1004 | diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c |
1005 | index fc7e910f8e8b..d32996702110 100644 |
1006 | --- a/drivers/iio/magnetometer/ak8974.c |
1007 | +++ b/drivers/iio/magnetometer/ak8974.c |
1008 | @@ -564,7 +564,7 @@ static int ak8974_read_raw(struct iio_dev *indio_dev, |
1009 | * We read all axes and discard all but one, for optimized |
1010 | * reading, use the triggered buffer. |
1011 | */ |
1012 | - *val = le16_to_cpu(hw_values[chan->address]); |
1013 | + *val = (s16)le16_to_cpu(hw_values[chan->address]); |
1014 | |
1015 | ret = IIO_VAL_INT; |
1016 | } |
1017 | diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c |
1018 | index a5dfe65cd9b9..f98510c714b5 100644 |
1019 | --- a/drivers/iio/trigger/stm32-timer-trigger.c |
1020 | +++ b/drivers/iio/trigger/stm32-timer-trigger.c |
1021 | @@ -161,7 +161,8 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv, |
1022 | return 0; |
1023 | } |
1024 | |
1025 | -static void stm32_timer_stop(struct stm32_timer_trigger *priv) |
1026 | +static void stm32_timer_stop(struct stm32_timer_trigger *priv, |
1027 | + struct iio_trigger *trig) |
1028 | { |
1029 | u32 ccer, cr1; |
1030 | |
1031 | @@ -179,6 +180,12 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv) |
1032 | regmap_write(priv->regmap, TIM_PSC, 0); |
1033 | regmap_write(priv->regmap, TIM_ARR, 0); |
1034 | |
1035 | + /* Force disable master mode */ |
1036 | + if (stm32_timer_is_trgo2_name(trig->name)) |
1037 | + regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0); |
1038 | + else |
1039 | + regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS, 0); |
1040 | + |
1041 | /* Make sure that registers are updated */ |
1042 | regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG); |
1043 | } |
1044 | @@ -197,7 +204,7 @@ static ssize_t stm32_tt_store_frequency(struct device *dev, |
1045 | return ret; |
1046 | |
1047 | if (freq == 0) { |
1048 | - stm32_timer_stop(priv); |
1049 | + stm32_timer_stop(priv, trig); |
1050 | } else { |
1051 | ret = stm32_timer_start(priv, trig, freq); |
1052 | if (ret) |
1053 | diff --git a/drivers/md/dm-bio-record.h b/drivers/md/dm-bio-record.h |
1054 | index c82578af56a5..2ea0360108e1 100644 |
1055 | --- a/drivers/md/dm-bio-record.h |
1056 | +++ b/drivers/md/dm-bio-record.h |
1057 | @@ -20,8 +20,13 @@ |
1058 | struct dm_bio_details { |
1059 | struct gendisk *bi_disk; |
1060 | u8 bi_partno; |
1061 | + int __bi_remaining; |
1062 | unsigned long bi_flags; |
1063 | struct bvec_iter bi_iter; |
1064 | + bio_end_io_t *bi_end_io; |
1065 | +#if defined(CONFIG_BLK_DEV_INTEGRITY) |
1066 | + struct bio_integrity_payload *bi_integrity; |
1067 | +#endif |
1068 | }; |
1069 | |
1070 | static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio) |
1071 | @@ -30,6 +35,11 @@ static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio) |
1072 | bd->bi_partno = bio->bi_partno; |
1073 | bd->bi_flags = bio->bi_flags; |
1074 | bd->bi_iter = bio->bi_iter; |
1075 | + bd->__bi_remaining = atomic_read(&bio->__bi_remaining); |
1076 | + bd->bi_end_io = bio->bi_end_io; |
1077 | +#if defined(CONFIG_BLK_DEV_INTEGRITY) |
1078 | + bd->bi_integrity = bio_integrity(bio); |
1079 | +#endif |
1080 | } |
1081 | |
1082 | static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio) |
1083 | @@ -38,6 +48,11 @@ static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio) |
1084 | bio->bi_partno = bd->bi_partno; |
1085 | bio->bi_flags = bd->bi_flags; |
1086 | bio->bi_iter = bd->bi_iter; |
1087 | + atomic_set(&bio->__bi_remaining, bd->__bi_remaining); |
1088 | + bio->bi_end_io = bd->bi_end_io; |
1089 | +#if defined(CONFIG_BLK_DEV_INTEGRITY) |
1090 | + bio->bi_integrity = bd->bi_integrity; |
1091 | +#endif |
1092 | } |
1093 | |
1094 | #endif |
1095 | diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c |
1096 | index 57ac603f3741..145bc2e7eaf0 100644 |
1097 | --- a/drivers/md/dm-integrity.c |
1098 | +++ b/drivers/md/dm-integrity.c |
1099 | @@ -6,6 +6,8 @@ |
1100 | * This file is released under the GPL. |
1101 | */ |
1102 | |
1103 | +#include "dm-bio-record.h" |
1104 | + |
1105 | #include <linux/compiler.h> |
1106 | #include <linux/module.h> |
1107 | #include <linux/device-mapper.h> |
1108 | @@ -292,11 +294,7 @@ struct dm_integrity_io { |
1109 | |
1110 | struct completion *completion; |
1111 | |
1112 | - struct gendisk *orig_bi_disk; |
1113 | - u8 orig_bi_partno; |
1114 | - bio_end_io_t *orig_bi_end_io; |
1115 | - struct bio_integrity_payload *orig_bi_integrity; |
1116 | - struct bvec_iter orig_bi_iter; |
1117 | + struct dm_bio_details bio_details; |
1118 | }; |
1119 | |
1120 | struct journal_completion { |
1121 | @@ -1447,14 +1445,9 @@ static void integrity_end_io(struct bio *bio) |
1122 | { |
1123 | struct dm_integrity_io *dio = dm_per_bio_data(bio, sizeof(struct dm_integrity_io)); |
1124 | |
1125 | - bio->bi_iter = dio->orig_bi_iter; |
1126 | - bio->bi_disk = dio->orig_bi_disk; |
1127 | - bio->bi_partno = dio->orig_bi_partno; |
1128 | - if (dio->orig_bi_integrity) { |
1129 | - bio->bi_integrity = dio->orig_bi_integrity; |
1130 | + dm_bio_restore(&dio->bio_details, bio); |
1131 | + if (bio->bi_integrity) |
1132 | bio->bi_opf |= REQ_INTEGRITY; |
1133 | - } |
1134 | - bio->bi_end_io = dio->orig_bi_end_io; |
1135 | |
1136 | if (dio->completion) |
1137 | complete(dio->completion); |
1138 | @@ -1539,7 +1532,7 @@ static void integrity_metadata(struct work_struct *w) |
1139 | } |
1140 | } |
1141 | |
1142 | - __bio_for_each_segment(bv, bio, iter, dio->orig_bi_iter) { |
1143 | + __bio_for_each_segment(bv, bio, iter, dio->bio_details.bi_iter) { |
1144 | unsigned pos; |
1145 | char *mem, *checksums_ptr; |
1146 | |
1147 | @@ -1583,7 +1576,7 @@ again: |
1148 | if (likely(checksums != checksums_onstack)) |
1149 | kfree(checksums); |
1150 | } else { |
1151 | - struct bio_integrity_payload *bip = dio->orig_bi_integrity; |
1152 | + struct bio_integrity_payload *bip = dio->bio_details.bi_integrity; |
1153 | |
1154 | if (bip) { |
1155 | struct bio_vec biv; |
1156 | @@ -2002,20 +1995,13 @@ offload_to_thread: |
1157 | } else |
1158 | dio->completion = NULL; |
1159 | |
1160 | - dio->orig_bi_iter = bio->bi_iter; |
1161 | - |
1162 | - dio->orig_bi_disk = bio->bi_disk; |
1163 | - dio->orig_bi_partno = bio->bi_partno; |
1164 | + dm_bio_record(&dio->bio_details, bio); |
1165 | bio_set_dev(bio, ic->dev->bdev); |
1166 | - |
1167 | - dio->orig_bi_integrity = bio_integrity(bio); |
1168 | bio->bi_integrity = NULL; |
1169 | bio->bi_opf &= ~REQ_INTEGRITY; |
1170 | - |
1171 | - dio->orig_bi_end_io = bio->bi_end_io; |
1172 | bio->bi_end_io = integrity_end_io; |
1173 | - |
1174 | bio->bi_iter.bi_size = dio->range.n_sectors << SECTOR_SHIFT; |
1175 | + |
1176 | generic_make_request(bio); |
1177 | |
1178 | if (need_sync_io) { |
1179 | diff --git a/drivers/misc/altera-stapl/altera.c b/drivers/misc/altera-stapl/altera.c |
1180 | index 25e5f24b3fec..5bdf57472314 100644 |
1181 | --- a/drivers/misc/altera-stapl/altera.c |
1182 | +++ b/drivers/misc/altera-stapl/altera.c |
1183 | @@ -2112,8 +2112,8 @@ exit_done: |
1184 | return status; |
1185 | } |
1186 | |
1187 | -static int altera_get_note(u8 *p, s32 program_size, |
1188 | - s32 *offset, char *key, char *value, int length) |
1189 | +static int altera_get_note(u8 *p, s32 program_size, s32 *offset, |
1190 | + char *key, char *value, int keylen, int vallen) |
1191 | /* |
1192 | * Gets key and value of NOTE fields in the JBC file. |
1193 | * Can be called in two modes: if offset pointer is NULL, |
1194 | @@ -2170,7 +2170,7 @@ static int altera_get_note(u8 *p, s32 program_size, |
1195 | &p[note_table + (8 * i) + 4])]; |
1196 | |
1197 | if (value != NULL) |
1198 | - strlcpy(value, value_ptr, length); |
1199 | + strlcpy(value, value_ptr, vallen); |
1200 | |
1201 | } |
1202 | } |
1203 | @@ -2189,13 +2189,13 @@ static int altera_get_note(u8 *p, s32 program_size, |
1204 | strlcpy(key, &p[note_strings + |
1205 | get_unaligned_be32( |
1206 | &p[note_table + (8 * i)])], |
1207 | - length); |
1208 | + keylen); |
1209 | |
1210 | if (value != NULL) |
1211 | strlcpy(value, &p[note_strings + |
1212 | get_unaligned_be32( |
1213 | &p[note_table + (8 * i) + 4])], |
1214 | - length); |
1215 | + vallen); |
1216 | |
1217 | *offset = i + 1; |
1218 | } |
1219 | @@ -2449,7 +2449,7 @@ int altera_init(struct altera_config *config, const struct firmware *fw) |
1220 | __func__, (format_version == 2) ? "Jam STAPL" : |
1221 | "pre-standardized Jam 1.1"); |
1222 | while (altera_get_note((u8 *)fw->data, fw->size, |
1223 | - &offset, key, value, 256) == 0) |
1224 | + &offset, key, value, 32, 256) == 0) |
1225 | printk(KERN_INFO "%s: NOTE \"%s\" = \"%s\"\n", |
1226 | __func__, key, value); |
1227 | } |
1228 | diff --git a/drivers/misc/cardreader/rts5227.c b/drivers/misc/cardreader/rts5227.c |
1229 | index 4feed296a327..423fecc19fc4 100644 |
1230 | --- a/drivers/misc/cardreader/rts5227.c |
1231 | +++ b/drivers/misc/cardreader/rts5227.c |
1232 | @@ -394,7 +394,7 @@ static const struct pcr_ops rts522a_pcr_ops = { |
1233 | void rts522a_init_params(struct rtsx_pcr *pcr) |
1234 | { |
1235 | rts5227_init_params(pcr); |
1236 | - |
1237 | + pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11); |
1238 | pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3; |
1239 | |
1240 | pcr->option.ocp_en = 1; |
1241 | diff --git a/drivers/misc/cardreader/rts5249.c b/drivers/misc/cardreader/rts5249.c |
1242 | index db936e4d6e56..1a81cda948c1 100644 |
1243 | --- a/drivers/misc/cardreader/rts5249.c |
1244 | +++ b/drivers/misc/cardreader/rts5249.c |
1245 | @@ -618,6 +618,7 @@ static const struct pcr_ops rts524a_pcr_ops = { |
1246 | void rts524a_init_params(struct rtsx_pcr *pcr) |
1247 | { |
1248 | rts5249_init_params(pcr); |
1249 | + pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11); |
1250 | pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF; |
1251 | pcr->option.ltr_l1off_snooze_sspwrgate = |
1252 | LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF; |
1253 | @@ -733,6 +734,7 @@ static const struct pcr_ops rts525a_pcr_ops = { |
1254 | void rts525a_init_params(struct rtsx_pcr *pcr) |
1255 | { |
1256 | rts5249_init_params(pcr); |
1257 | + pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11); |
1258 | pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF; |
1259 | pcr->option.ltr_l1off_snooze_sspwrgate = |
1260 | LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF; |
1261 | diff --git a/drivers/misc/cardreader/rts5260.c b/drivers/misc/cardreader/rts5260.c |
1262 | index 40a6d199f2ea..c9327bf92d16 100644 |
1263 | --- a/drivers/misc/cardreader/rts5260.c |
1264 | +++ b/drivers/misc/cardreader/rts5260.c |
1265 | @@ -663,7 +663,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr) |
1266 | pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B; |
1267 | pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; |
1268 | pcr->aspm_en = ASPM_L1_EN; |
1269 | - pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16); |
1270 | + pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11); |
1271 | pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5); |
1272 | |
1273 | pcr->ic_version = rts5260_get_ic_version(pcr); |
1274 | diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c |
1275 | index bd50935dc37d..11087976ab19 100644 |
1276 | --- a/drivers/mmc/host/rtsx_pci_sdmmc.c |
1277 | +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c |
1278 | @@ -606,19 +606,22 @@ static int sd_change_phase(struct realtek_pci_sdmmc *host, |
1279 | u8 sample_point, bool rx) |
1280 | { |
1281 | struct rtsx_pcr *pcr = host->pcr; |
1282 | - |
1283 | + u16 SD_VP_CTL = 0; |
1284 | dev_dbg(sdmmc_dev(host), "%s(%s): sample_point = %d\n", |
1285 | __func__, rx ? "RX" : "TX", sample_point); |
1286 | |
1287 | rtsx_pci_write_register(pcr, CLK_CTL, CHANGE_CLK, CHANGE_CLK); |
1288 | - if (rx) |
1289 | + if (rx) { |
1290 | + SD_VP_CTL = SD_VPRX_CTL; |
1291 | rtsx_pci_write_register(pcr, SD_VPRX_CTL, |
1292 | PHASE_SELECT_MASK, sample_point); |
1293 | - else |
1294 | + } else { |
1295 | + SD_VP_CTL = SD_VPTX_CTL; |
1296 | rtsx_pci_write_register(pcr, SD_VPTX_CTL, |
1297 | PHASE_SELECT_MASK, sample_point); |
1298 | - rtsx_pci_write_register(pcr, SD_VPCLK0_CTL, PHASE_NOT_RESET, 0); |
1299 | - rtsx_pci_write_register(pcr, SD_VPCLK0_CTL, PHASE_NOT_RESET, |
1300 | + } |
1301 | + rtsx_pci_write_register(pcr, SD_VP_CTL, PHASE_NOT_RESET, 0); |
1302 | + rtsx_pci_write_register(pcr, SD_VP_CTL, PHASE_NOT_RESET, |
1303 | PHASE_NOT_RESET); |
1304 | rtsx_pci_write_register(pcr, CLK_CTL, CHANGE_CLK, 0); |
1305 | rtsx_pci_write_register(pcr, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); |
1306 | diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c |
1307 | index ae0ec27dd7cc..5f2e9696ee4d 100644 |
1308 | --- a/drivers/mmc/host/sdhci-cadence.c |
1309 | +++ b/drivers/mmc/host/sdhci-cadence.c |
1310 | @@ -11,6 +11,7 @@ |
1311 | #include <linux/mmc/host.h> |
1312 | #include <linux/mmc/mmc.h> |
1313 | #include <linux/of.h> |
1314 | +#include <linux/of_device.h> |
1315 | |
1316 | #include "sdhci-pltfm.h" |
1317 | |
1318 | @@ -235,6 +236,11 @@ static const struct sdhci_ops sdhci_cdns_ops = { |
1319 | .set_uhs_signaling = sdhci_cdns_set_uhs_signaling, |
1320 | }; |
1321 | |
1322 | +static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = { |
1323 | + .ops = &sdhci_cdns_ops, |
1324 | + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, |
1325 | +}; |
1326 | + |
1327 | static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { |
1328 | .ops = &sdhci_cdns_ops, |
1329 | }; |
1330 | @@ -334,6 +340,7 @@ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc, |
1331 | static int sdhci_cdns_probe(struct platform_device *pdev) |
1332 | { |
1333 | struct sdhci_host *host; |
1334 | + const struct sdhci_pltfm_data *data; |
1335 | struct sdhci_pltfm_host *pltfm_host; |
1336 | struct sdhci_cdns_priv *priv; |
1337 | struct clk *clk; |
1338 | @@ -350,8 +357,12 @@ static int sdhci_cdns_probe(struct platform_device *pdev) |
1339 | if (ret) |
1340 | return ret; |
1341 | |
1342 | + data = of_device_get_match_data(dev); |
1343 | + if (!data) |
1344 | + data = &sdhci_cdns_pltfm_data; |
1345 | + |
1346 | nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node); |
1347 | - host = sdhci_pltfm_init(pdev, &sdhci_cdns_pltfm_data, |
1348 | + host = sdhci_pltfm_init(pdev, data, |
1349 | struct_size(priv, phy_params, nr_phy_params)); |
1350 | if (IS_ERR(host)) { |
1351 | ret = PTR_ERR(host); |
1352 | @@ -431,7 +442,10 @@ static const struct dev_pm_ops sdhci_cdns_pm_ops = { |
1353 | }; |
1354 | |
1355 | static const struct of_device_id sdhci_cdns_match[] = { |
1356 | - { .compatible = "socionext,uniphier-sd4hc" }, |
1357 | + { |
1358 | + .compatible = "socionext,uniphier-sd4hc", |
1359 | + .data = &sdhci_cdns_uniphier_pltfm_data, |
1360 | + }, |
1361 | { .compatible = "cdns,sd4hc" }, |
1362 | { /* sentinel */ } |
1363 | }; |
1364 | diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c |
1365 | index 9378d5dc86c8..881f8138e7de 100644 |
1366 | --- a/drivers/mmc/host/sdhci-of-at91.c |
1367 | +++ b/drivers/mmc/host/sdhci-of-at91.c |
1368 | @@ -118,7 +118,8 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask) |
1369 | { |
1370 | sdhci_reset(host, mask); |
1371 | |
1372 | - if (host->mmc->caps & MMC_CAP_NONREMOVABLE) |
1373 | + if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) |
1374 | + || mmc_gpio_get_cd(host->mmc) >= 0) |
1375 | sdhci_at91_set_force_card_detect(host); |
1376 | } |
1377 | |
1378 | @@ -397,8 +398,11 @@ static int sdhci_at91_probe(struct platform_device *pdev) |
1379 | * detection procedure using the SDMCC_CD signal is bypassed. |
1380 | * This bit is reset when a software reset for all command is performed |
1381 | * so we need to implement our own reset function to set back this bit. |
1382 | + * |
1383 | + * WA: SAMA5D2 doesn't drive CMD if using CD GPIO line. |
1384 | */ |
1385 | - if (host->mmc->caps & MMC_CAP_NONREMOVABLE) |
1386 | + if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) |
1387 | + || mmc_gpio_get_cd(host->mmc) >= 0) |
1388 | sdhci_at91_set_force_card_detect(host); |
1389 | |
1390 | pm_runtime_put_autosuspend(&pdev->dev); |
1391 | diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c |
1392 | index d535080b781f..2fe34fd4c3f3 100644 |
1393 | --- a/drivers/nvme/target/tcp.c |
1394 | +++ b/drivers/nvme/target/tcp.c |
1395 | @@ -515,7 +515,7 @@ static int nvmet_try_send_data_pdu(struct nvmet_tcp_cmd *cmd) |
1396 | return 1; |
1397 | } |
1398 | |
1399 | -static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd) |
1400 | +static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd, bool last_in_batch) |
1401 | { |
1402 | struct nvmet_tcp_queue *queue = cmd->queue; |
1403 | int ret; |
1404 | @@ -523,9 +523,15 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd) |
1405 | while (cmd->cur_sg) { |
1406 | struct page *page = sg_page(cmd->cur_sg); |
1407 | u32 left = cmd->cur_sg->length - cmd->offset; |
1408 | + int flags = MSG_DONTWAIT; |
1409 | + |
1410 | + if ((!last_in_batch && cmd->queue->send_list_len) || |
1411 | + cmd->wbytes_done + left < cmd->req.transfer_len || |
1412 | + queue->data_digest || !queue->nvme_sq.sqhd_disabled) |
1413 | + flags |= MSG_MORE; |
1414 | |
1415 | ret = kernel_sendpage(cmd->queue->sock, page, cmd->offset, |
1416 | - left, MSG_DONTWAIT | MSG_MORE); |
1417 | + left, flags); |
1418 | if (ret <= 0) |
1419 | return ret; |
1420 | |
1421 | @@ -660,7 +666,7 @@ static int nvmet_tcp_try_send_one(struct nvmet_tcp_queue *queue, |
1422 | } |
1423 | |
1424 | if (cmd->state == NVMET_TCP_SEND_DATA) { |
1425 | - ret = nvmet_try_send_data(cmd); |
1426 | + ret = nvmet_try_send_data(cmd, last_in_batch); |
1427 | if (ret <= 0) |
1428 | goto done_send; |
1429 | } |
1430 | diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c |
1431 | index acce8781c456..f5c7a845cd7b 100644 |
1432 | --- a/drivers/perf/arm_pmu_acpi.c |
1433 | +++ b/drivers/perf/arm_pmu_acpi.c |
1434 | @@ -24,8 +24,6 @@ static int arm_pmu_acpi_register_irq(int cpu) |
1435 | int gsi, trigger; |
1436 | |
1437 | gicc = acpi_cpu_get_madt_gicc(cpu); |
1438 | - if (WARN_ON(!gicc)) |
1439 | - return -EINVAL; |
1440 | |
1441 | gsi = gicc->performance_interrupt; |
1442 | |
1443 | @@ -64,11 +62,10 @@ static void arm_pmu_acpi_unregister_irq(int cpu) |
1444 | int gsi; |
1445 | |
1446 | gicc = acpi_cpu_get_madt_gicc(cpu); |
1447 | - if (!gicc) |
1448 | - return; |
1449 | |
1450 | gsi = gicc->performance_interrupt; |
1451 | - acpi_unregister_gsi(gsi); |
1452 | + if (gsi) |
1453 | + acpi_unregister_gsi(gsi); |
1454 | } |
1455 | |
1456 | #if IS_ENABLED(CONFIG_ARM_SPE_PMU) |
1457 | diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c |
1458 | index 0e51baa48b14..6eef47de8fcc 100644 |
1459 | --- a/drivers/perf/fsl_imx8_ddr_perf.c |
1460 | +++ b/drivers/perf/fsl_imx8_ddr_perf.c |
1461 | @@ -327,9 +327,10 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config, |
1462 | |
1463 | if (enable) { |
1464 | /* |
1465 | - * must disable first, then enable again |
1466 | - * otherwise, cycle counter will not work |
1467 | - * if previous state is enabled. |
1468 | + * cycle counter is special which should firstly write 0 then |
1469 | + * write 1 into CLEAR bit to clear it. Other counters only |
1470 | + * need write 0 into CLEAR bit and it turns out to be 1 by |
1471 | + * hardware. Below enable flow is harmless for all counters. |
1472 | */ |
1473 | writel(0, pmu->base + reg); |
1474 | val = CNTL_EN | CNTL_CLEAR; |
1475 | @@ -337,7 +338,8 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config, |
1476 | writel(val, pmu->base + reg); |
1477 | } else { |
1478 | /* Disable counter */ |
1479 | - writel(0, pmu->base + reg); |
1480 | + val = readl_relaxed(pmu->base + reg) & CNTL_EN_MASK; |
1481 | + writel(val, pmu->base + reg); |
1482 | } |
1483 | } |
1484 | |
1485 | diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c |
1486 | index a28bd15297f5..1c536fc03c83 100644 |
1487 | --- a/drivers/phy/ti/phy-gmii-sel.c |
1488 | +++ b/drivers/phy/ti/phy-gmii-sel.c |
1489 | @@ -80,20 +80,20 @@ static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode) |
1490 | break; |
1491 | |
1492 | case PHY_INTERFACE_MODE_MII: |
1493 | - mode = AM33XX_GMII_SEL_MODE_MII; |
1494 | + case PHY_INTERFACE_MODE_GMII: |
1495 | + gmii_sel_mode = AM33XX_GMII_SEL_MODE_MII; |
1496 | break; |
1497 | |
1498 | default: |
1499 | - dev_warn(dev, |
1500 | - "port%u: unsupported mode: \"%s\". Defaulting to MII.\n", |
1501 | - if_phy->id, phy_modes(rgmii_id)); |
1502 | + dev_warn(dev, "port%u: unsupported mode: \"%s\"\n", |
1503 | + if_phy->id, phy_modes(submode)); |
1504 | return -EINVAL; |
1505 | } |
1506 | |
1507 | if_phy->phy_if_mode = submode; |
1508 | |
1509 | dev_dbg(dev, "%s id:%u mode:%u rgmii_id:%d rmii_clk_ext:%d\n", |
1510 | - __func__, if_phy->id, mode, rgmii_id, |
1511 | + __func__, if_phy->id, submode, rgmii_id, |
1512 | if_phy->rmii_clock_external); |
1513 | |
1514 | regfield = if_phy->fields[PHY_GMII_SEL_PORT_MODE]; |
1515 | diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig |
1516 | index 5d502fbd5803..c5b980414086 100644 |
1517 | --- a/drivers/rtc/Kconfig |
1518 | +++ b/drivers/rtc/Kconfig |
1519 | @@ -327,6 +327,7 @@ config RTC_DRV_MAX6900 |
1520 | config RTC_DRV_MAX8907 |
1521 | tristate "Maxim MAX8907" |
1522 | depends on MFD_MAX8907 || COMPILE_TEST |
1523 | + select REGMAP_IRQ |
1524 | help |
1525 | If you say yes here you will get support for the |
1526 | RTC of Maxim MAX8907 PMIC. |
1527 | diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c |
1528 | index 848e03e5f42d..4433cb4de564 100644 |
1529 | --- a/drivers/spi/spi-omap2-mcspi.c |
1530 | +++ b/drivers/spi/spi-omap2-mcspi.c |
1531 | @@ -985,20 +985,12 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, |
1532 | * Note that we currently allow DMA only if we get a channel |
1533 | * for both rx and tx. Otherwise we'll do PIO for both rx and tx. |
1534 | */ |
1535 | -static int omap2_mcspi_request_dma(struct spi_device *spi) |
1536 | +static int omap2_mcspi_request_dma(struct omap2_mcspi *mcspi, |
1537 | + struct omap2_mcspi_dma *mcspi_dma) |
1538 | { |
1539 | - struct spi_master *master = spi->master; |
1540 | - struct omap2_mcspi *mcspi; |
1541 | - struct omap2_mcspi_dma *mcspi_dma; |
1542 | int ret = 0; |
1543 | |
1544 | - mcspi = spi_master_get_devdata(master); |
1545 | - mcspi_dma = mcspi->dma_channels + spi->chip_select; |
1546 | - |
1547 | - init_completion(&mcspi_dma->dma_rx_completion); |
1548 | - init_completion(&mcspi_dma->dma_tx_completion); |
1549 | - |
1550 | - mcspi_dma->dma_rx = dma_request_chan(&master->dev, |
1551 | + mcspi_dma->dma_rx = dma_request_chan(mcspi->dev, |
1552 | mcspi_dma->dma_rx_ch_name); |
1553 | if (IS_ERR(mcspi_dma->dma_rx)) { |
1554 | ret = PTR_ERR(mcspi_dma->dma_rx); |
1555 | @@ -1006,7 +998,7 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) |
1556 | goto no_dma; |
1557 | } |
1558 | |
1559 | - mcspi_dma->dma_tx = dma_request_chan(&master->dev, |
1560 | + mcspi_dma->dma_tx = dma_request_chan(mcspi->dev, |
1561 | mcspi_dma->dma_tx_ch_name); |
1562 | if (IS_ERR(mcspi_dma->dma_tx)) { |
1563 | ret = PTR_ERR(mcspi_dma->dma_tx); |
1564 | @@ -1015,20 +1007,40 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) |
1565 | mcspi_dma->dma_rx = NULL; |
1566 | } |
1567 | |
1568 | + init_completion(&mcspi_dma->dma_rx_completion); |
1569 | + init_completion(&mcspi_dma->dma_tx_completion); |
1570 | + |
1571 | no_dma: |
1572 | return ret; |
1573 | } |
1574 | |
1575 | +static void omap2_mcspi_release_dma(struct spi_master *master) |
1576 | +{ |
1577 | + struct omap2_mcspi *mcspi = spi_master_get_devdata(master); |
1578 | + struct omap2_mcspi_dma *mcspi_dma; |
1579 | + int i; |
1580 | + |
1581 | + for (i = 0; i < master->num_chipselect; i++) { |
1582 | + mcspi_dma = &mcspi->dma_channels[i]; |
1583 | + |
1584 | + if (mcspi_dma->dma_rx) { |
1585 | + dma_release_channel(mcspi_dma->dma_rx); |
1586 | + mcspi_dma->dma_rx = NULL; |
1587 | + } |
1588 | + if (mcspi_dma->dma_tx) { |
1589 | + dma_release_channel(mcspi_dma->dma_tx); |
1590 | + mcspi_dma->dma_tx = NULL; |
1591 | + } |
1592 | + } |
1593 | +} |
1594 | + |
1595 | static int omap2_mcspi_setup(struct spi_device *spi) |
1596 | { |
1597 | int ret; |
1598 | struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); |
1599 | struct omap2_mcspi_regs *ctx = &mcspi->ctx; |
1600 | - struct omap2_mcspi_dma *mcspi_dma; |
1601 | struct omap2_mcspi_cs *cs = spi->controller_state; |
1602 | |
1603 | - mcspi_dma = &mcspi->dma_channels[spi->chip_select]; |
1604 | - |
1605 | if (!cs) { |
1606 | cs = kzalloc(sizeof *cs, GFP_KERNEL); |
1607 | if (!cs) |
1608 | @@ -1053,13 +1065,6 @@ static int omap2_mcspi_setup(struct spi_device *spi) |
1609 | } |
1610 | } |
1611 | |
1612 | - if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) { |
1613 | - ret = omap2_mcspi_request_dma(spi); |
1614 | - if (ret) |
1615 | - dev_warn(&spi->dev, "not using DMA for McSPI (%d)\n", |
1616 | - ret); |
1617 | - } |
1618 | - |
1619 | ret = pm_runtime_get_sync(mcspi->dev); |
1620 | if (ret < 0) { |
1621 | pm_runtime_put_noidle(mcspi->dev); |
1622 | @@ -1076,12 +1081,8 @@ static int omap2_mcspi_setup(struct spi_device *spi) |
1623 | |
1624 | static void omap2_mcspi_cleanup(struct spi_device *spi) |
1625 | { |
1626 | - struct omap2_mcspi *mcspi; |
1627 | - struct omap2_mcspi_dma *mcspi_dma; |
1628 | struct omap2_mcspi_cs *cs; |
1629 | |
1630 | - mcspi = spi_master_get_devdata(spi->master); |
1631 | - |
1632 | if (spi->controller_state) { |
1633 | /* Unlink controller state from context save list */ |
1634 | cs = spi->controller_state; |
1635 | @@ -1090,19 +1091,6 @@ static void omap2_mcspi_cleanup(struct spi_device *spi) |
1636 | kfree(cs); |
1637 | } |
1638 | |
1639 | - if (spi->chip_select < spi->master->num_chipselect) { |
1640 | - mcspi_dma = &mcspi->dma_channels[spi->chip_select]; |
1641 | - |
1642 | - if (mcspi_dma->dma_rx) { |
1643 | - dma_release_channel(mcspi_dma->dma_rx); |
1644 | - mcspi_dma->dma_rx = NULL; |
1645 | - } |
1646 | - if (mcspi_dma->dma_tx) { |
1647 | - dma_release_channel(mcspi_dma->dma_tx); |
1648 | - mcspi_dma->dma_tx = NULL; |
1649 | - } |
1650 | - } |
1651 | - |
1652 | if (gpio_is_valid(spi->cs_gpio)) |
1653 | gpio_free(spi->cs_gpio); |
1654 | } |
1655 | @@ -1313,6 +1301,9 @@ static bool omap2_mcspi_can_dma(struct spi_master *master, |
1656 | if (spi_controller_is_slave(master)) |
1657 | return true; |
1658 | |
1659 | + master->dma_rx = mcspi_dma->dma_rx; |
1660 | + master->dma_tx = mcspi_dma->dma_tx; |
1661 | + |
1662 | return (xfer->len >= DMA_MIN_BYTES); |
1663 | } |
1664 | |
1665 | @@ -1475,6 +1466,11 @@ static int omap2_mcspi_probe(struct platform_device *pdev) |
1666 | for (i = 0; i < master->num_chipselect; i++) { |
1667 | sprintf(mcspi->dma_channels[i].dma_rx_ch_name, "rx%d", i); |
1668 | sprintf(mcspi->dma_channels[i].dma_tx_ch_name, "tx%d", i); |
1669 | + |
1670 | + status = omap2_mcspi_request_dma(mcspi, |
1671 | + &mcspi->dma_channels[i]); |
1672 | + if (status == -EPROBE_DEFER) |
1673 | + goto free_master; |
1674 | } |
1675 | |
1676 | status = platform_get_irq(pdev, 0); |
1677 | @@ -1512,6 +1508,7 @@ disable_pm: |
1678 | pm_runtime_put_sync(&pdev->dev); |
1679 | pm_runtime_disable(&pdev->dev); |
1680 | free_master: |
1681 | + omap2_mcspi_release_dma(master); |
1682 | spi_master_put(master); |
1683 | return status; |
1684 | } |
1685 | @@ -1521,6 +1518,8 @@ static int omap2_mcspi_remove(struct platform_device *pdev) |
1686 | struct spi_master *master = platform_get_drvdata(pdev); |
1687 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); |
1688 | |
1689 | + omap2_mcspi_release_dma(master); |
1690 | + |
1691 | pm_runtime_dont_use_autosuspend(mcspi->dev); |
1692 | pm_runtime_put_sync(mcspi->dev); |
1693 | pm_runtime_disable(&pdev->dev); |
1694 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
1695 | index 2fd843b18297..723145673206 100644 |
1696 | --- a/drivers/spi/spi-pxa2xx.c |
1697 | +++ b/drivers/spi/spi-pxa2xx.c |
1698 | @@ -68,6 +68,10 @@ MODULE_ALIAS("platform:pxa2xx-spi"); |
1699 | #define LPSS_CAPS_CS_EN_SHIFT 9 |
1700 | #define LPSS_CAPS_CS_EN_MASK (0xf << LPSS_CAPS_CS_EN_SHIFT) |
1701 | |
1702 | +#define LPSS_PRIV_CLOCK_GATE 0x38 |
1703 | +#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK 0x3 |
1704 | +#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON 0x3 |
1705 | + |
1706 | struct lpss_config { |
1707 | /* LPSS offset from drv_data->ioaddr */ |
1708 | unsigned offset; |
1709 | @@ -84,6 +88,8 @@ struct lpss_config { |
1710 | unsigned cs_sel_shift; |
1711 | unsigned cs_sel_mask; |
1712 | unsigned cs_num; |
1713 | + /* Quirks */ |
1714 | + unsigned cs_clk_stays_gated : 1; |
1715 | }; |
1716 | |
1717 | /* Keep these sorted with enum pxa_ssp_type */ |
1718 | @@ -154,6 +160,7 @@ static const struct lpss_config lpss_platforms[] = { |
1719 | .tx_threshold_hi = 56, |
1720 | .cs_sel_shift = 8, |
1721 | .cs_sel_mask = 3 << 8, |
1722 | + .cs_clk_stays_gated = true, |
1723 | }, |
1724 | }; |
1725 | |
1726 | @@ -381,6 +388,22 @@ static void lpss_ssp_cs_control(struct spi_device *spi, bool enable) |
1727 | else |
1728 | value |= LPSS_CS_CONTROL_CS_HIGH; |
1729 | __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value); |
1730 | + if (config->cs_clk_stays_gated) { |
1731 | + u32 clkgate; |
1732 | + |
1733 | + /* |
1734 | + * Changing CS alone when dynamic clock gating is on won't |
1735 | + * actually flip CS at that time. This ruins SPI transfers |
1736 | + * that specify delays, or have no data. Toggle the clock mode |
1737 | + * to force on briefly to poke the CS pin to move. |
1738 | + */ |
1739 | + clkgate = __lpss_ssp_read_priv(drv_data, LPSS_PRIV_CLOCK_GATE); |
1740 | + value = (clkgate & ~LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK) | |
1741 | + LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON; |
1742 | + |
1743 | + __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, value); |
1744 | + __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, clkgate); |
1745 | + } |
1746 | } |
1747 | |
1748 | static void cs_assert(struct spi_device *spi) |
1749 | diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c |
1750 | index 2f559e531100..fa8079fbea77 100644 |
1751 | --- a/drivers/spi/spi-qup.c |
1752 | +++ b/drivers/spi/spi-qup.c |
1753 | @@ -1217,6 +1217,11 @@ static int spi_qup_suspend(struct device *device) |
1754 | struct spi_qup *controller = spi_master_get_devdata(master); |
1755 | int ret; |
1756 | |
1757 | + if (pm_runtime_suspended(device)) { |
1758 | + ret = spi_qup_pm_resume_runtime(device); |
1759 | + if (ret) |
1760 | + return ret; |
1761 | + } |
1762 | ret = spi_master_suspend(master); |
1763 | if (ret) |
1764 | return ret; |
1765 | @@ -1225,10 +1230,8 @@ static int spi_qup_suspend(struct device *device) |
1766 | if (ret) |
1767 | return ret; |
1768 | |
1769 | - if (!pm_runtime_suspended(device)) { |
1770 | - clk_disable_unprepare(controller->cclk); |
1771 | - clk_disable_unprepare(controller->iclk); |
1772 | - } |
1773 | + clk_disable_unprepare(controller->cclk); |
1774 | + clk_disable_unprepare(controller->iclk); |
1775 | return 0; |
1776 | } |
1777 | |
1778 | diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c |
1779 | index 60c4de4e4485..7412a3042a8d 100644 |
1780 | --- a/drivers/spi/spi-zynqmp-gqspi.c |
1781 | +++ b/drivers/spi/spi-zynqmp-gqspi.c |
1782 | @@ -401,9 +401,6 @@ static void zynqmp_qspi_chipselect(struct spi_device *qspi, bool is_high) |
1783 | |
1784 | zynqmp_gqspi_write(xqspi, GQSPI_GEN_FIFO_OFST, genfifoentry); |
1785 | |
1786 | - /* Dummy generic FIFO entry */ |
1787 | - zynqmp_gqspi_write(xqspi, GQSPI_GEN_FIFO_OFST, 0x0); |
1788 | - |
1789 | /* Manually start the generic FIFO command */ |
1790 | zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, |
1791 | zynqmp_gqspi_read(xqspi, GQSPI_CONFIG_OFST) | |
1792 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
1793 | index 26b91ee0855d..c186d3a944cd 100644 |
1794 | --- a/drivers/spi/spi.c |
1795 | +++ b/drivers/spi/spi.c |
1796 | @@ -2452,7 +2452,7 @@ int spi_register_controller(struct spi_controller *ctlr) |
1797 | if (ctlr->use_gpio_descriptors) { |
1798 | status = spi_get_gpio_descs(ctlr); |
1799 | if (status) |
1800 | - return status; |
1801 | + goto free_bus_id; |
1802 | /* |
1803 | * A controller using GPIO descriptors always |
1804 | * supports SPI_CS_HIGH if need be. |
1805 | @@ -2462,7 +2462,7 @@ int spi_register_controller(struct spi_controller *ctlr) |
1806 | /* Legacy code path for GPIOs from DT */ |
1807 | status = of_spi_get_gpio_numbers(ctlr); |
1808 | if (status) |
1809 | - return status; |
1810 | + goto free_bus_id; |
1811 | } |
1812 | } |
1813 | |
1814 | @@ -2470,17 +2470,14 @@ int spi_register_controller(struct spi_controller *ctlr) |
1815 | * Even if it's just one always-selected device, there must |
1816 | * be at least one chipselect. |
1817 | */ |
1818 | - if (!ctlr->num_chipselect) |
1819 | - return -EINVAL; |
1820 | + if (!ctlr->num_chipselect) { |
1821 | + status = -EINVAL; |
1822 | + goto free_bus_id; |
1823 | + } |
1824 | |
1825 | status = device_add(&ctlr->dev); |
1826 | - if (status < 0) { |
1827 | - /* free bus id */ |
1828 | - mutex_lock(&board_lock); |
1829 | - idr_remove(&spi_master_idr, ctlr->bus_num); |
1830 | - mutex_unlock(&board_lock); |
1831 | - goto done; |
1832 | - } |
1833 | + if (status < 0) |
1834 | + goto free_bus_id; |
1835 | dev_dbg(dev, "registered %s %s\n", |
1836 | spi_controller_is_slave(ctlr) ? "slave" : "master", |
1837 | dev_name(&ctlr->dev)); |
1838 | @@ -2496,11 +2493,7 @@ int spi_register_controller(struct spi_controller *ctlr) |
1839 | status = spi_controller_initialize_queue(ctlr); |
1840 | if (status) { |
1841 | device_del(&ctlr->dev); |
1842 | - /* free bus id */ |
1843 | - mutex_lock(&board_lock); |
1844 | - idr_remove(&spi_master_idr, ctlr->bus_num); |
1845 | - mutex_unlock(&board_lock); |
1846 | - goto done; |
1847 | + goto free_bus_id; |
1848 | } |
1849 | } |
1850 | /* add statistics */ |
1851 | @@ -2515,7 +2508,12 @@ int spi_register_controller(struct spi_controller *ctlr) |
1852 | /* Register devices from the device tree and ACPI */ |
1853 | of_register_spi_devices(ctlr); |
1854 | acpi_register_spi_devices(ctlr); |
1855 | -done: |
1856 | + return status; |
1857 | + |
1858 | +free_bus_id: |
1859 | + mutex_lock(&board_lock); |
1860 | + idr_remove(&spi_master_idr, ctlr->bus_num); |
1861 | + mutex_unlock(&board_lock); |
1862 | return status; |
1863 | } |
1864 | EXPORT_SYMBOL_GPL(spi_register_controller); |
1865 | diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c |
1866 | index ba6f905f26fa..69c6dce9be31 100644 |
1867 | --- a/drivers/staging/greybus/tools/loopback_test.c |
1868 | +++ b/drivers/staging/greybus/tools/loopback_test.c |
1869 | @@ -19,6 +19,7 @@ |
1870 | #include <signal.h> |
1871 | |
1872 | #define MAX_NUM_DEVICES 10 |
1873 | +#define MAX_SYSFS_PREFIX 0x80 |
1874 | #define MAX_SYSFS_PATH 0x200 |
1875 | #define CSV_MAX_LINE 0x1000 |
1876 | #define SYSFS_MAX_INT 0x20 |
1877 | @@ -67,7 +68,7 @@ struct loopback_results { |
1878 | }; |
1879 | |
1880 | struct loopback_device { |
1881 | - char name[MAX_SYSFS_PATH]; |
1882 | + char name[MAX_STR_LEN]; |
1883 | char sysfs_entry[MAX_SYSFS_PATH]; |
1884 | char debugfs_entry[MAX_SYSFS_PATH]; |
1885 | struct loopback_results results; |
1886 | @@ -93,8 +94,8 @@ struct loopback_test { |
1887 | int stop_all; |
1888 | int poll_count; |
1889 | char test_name[MAX_STR_LEN]; |
1890 | - char sysfs_prefix[MAX_SYSFS_PATH]; |
1891 | - char debugfs_prefix[MAX_SYSFS_PATH]; |
1892 | + char sysfs_prefix[MAX_SYSFS_PREFIX]; |
1893 | + char debugfs_prefix[MAX_SYSFS_PREFIX]; |
1894 | struct timespec poll_timeout; |
1895 | struct loopback_device devices[MAX_NUM_DEVICES]; |
1896 | struct loopback_results aggregate_results; |
1897 | @@ -637,7 +638,7 @@ baddir: |
1898 | static int open_poll_files(struct loopback_test *t) |
1899 | { |
1900 | struct loopback_device *dev; |
1901 | - char buf[MAX_STR_LEN]; |
1902 | + char buf[MAX_SYSFS_PATH + MAX_STR_LEN]; |
1903 | char dummy; |
1904 | int fds_idx = 0; |
1905 | int i; |
1906 | @@ -655,7 +656,7 @@ static int open_poll_files(struct loopback_test *t) |
1907 | goto err; |
1908 | } |
1909 | read(t->fds[fds_idx].fd, &dummy, 1); |
1910 | - t->fds[fds_idx].events = EPOLLERR|EPOLLPRI; |
1911 | + t->fds[fds_idx].events = POLLERR | POLLPRI; |
1912 | t->fds[fds_idx].revents = 0; |
1913 | fds_idx++; |
1914 | } |
1915 | @@ -748,7 +749,7 @@ static int wait_for_complete(struct loopback_test *t) |
1916 | } |
1917 | |
1918 | for (i = 0; i < t->poll_count; i++) { |
1919 | - if (t->fds[i].revents & EPOLLPRI) { |
1920 | + if (t->fds[i].revents & POLLPRI) { |
1921 | /* Dummy read to clear the event */ |
1922 | read(t->fds[i].fd, &dummy, 1); |
1923 | number_of_events++; |
1924 | @@ -907,10 +908,10 @@ int main(int argc, char *argv[]) |
1925 | t.iteration_max = atoi(optarg); |
1926 | break; |
1927 | case 'S': |
1928 | - snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg); |
1929 | + snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg); |
1930 | break; |
1931 | case 'D': |
1932 | - snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg); |
1933 | + snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg); |
1934 | break; |
1935 | case 'm': |
1936 | t.mask = atol(optarg); |
1937 | @@ -961,10 +962,10 @@ int main(int argc, char *argv[]) |
1938 | } |
1939 | |
1940 | if (!strcmp(t.sysfs_prefix, "")) |
1941 | - snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix); |
1942 | + snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix); |
1943 | |
1944 | if (!strcmp(t.debugfs_prefix, "")) |
1945 | - snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix); |
1946 | + snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", debugfs_prefix); |
1947 | |
1948 | ret = find_loopback_devices(&t); |
1949 | if (ret) |
1950 | diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
1951 | index b5d42f411dd8..845c8817281c 100644 |
1952 | --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
1953 | +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
1954 | @@ -38,6 +38,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { |
1955 | {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ |
1956 | {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ |
1957 | {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ |
1958 | + {USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */ |
1959 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
1960 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ |
1961 | {} /* Terminating entry */ |
1962 | diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c |
1963 | index 488f2539aa9a..81ecfd1a200d 100644 |
1964 | --- a/drivers/staging/speakup/main.c |
1965 | +++ b/drivers/staging/speakup/main.c |
1966 | @@ -561,7 +561,7 @@ static u_long get_word(struct vc_data *vc) |
1967 | return 0; |
1968 | } else if (tmpx < vc->vc_cols - 2 && |
1969 | (ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) && |
1970 | - get_char(vc, (u_short *)&tmp_pos + 1, &temp) > SPACE) { |
1971 | + get_char(vc, (u_short *)tmp_pos + 1, &temp) > SPACE) { |
1972 | tmp_pos += 2; |
1973 | tmpx++; |
1974 | } else { |
1975 | diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
1976 | index 802c1210558f..36c1c59cc72a 100644 |
1977 | --- a/drivers/tty/tty_io.c |
1978 | +++ b/drivers/tty/tty_io.c |
1979 | @@ -2731,9 +2731,11 @@ static int compat_tty_tiocgserial(struct tty_struct *tty, |
1980 | struct serial_struct32 v32; |
1981 | struct serial_struct v; |
1982 | int err; |
1983 | - memset(&v, 0, sizeof(struct serial_struct)); |
1984 | |
1985 | - if (!tty->ops->set_serial) |
1986 | + memset(&v, 0, sizeof(v)); |
1987 | + memset(&v32, 0, sizeof(v32)); |
1988 | + |
1989 | + if (!tty->ops->get_serial) |
1990 | return -ENOTTY; |
1991 | err = tty->ops->get_serial(tty, &v); |
1992 | if (!err) { |
1993 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
1994 | index 62f4fb9b362f..47f09a6ce7bd 100644 |
1995 | --- a/drivers/usb/class/cdc-acm.c |
1996 | +++ b/drivers/usb/class/cdc-acm.c |
1997 | @@ -896,10 +896,10 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss) |
1998 | |
1999 | ss->xmit_fifo_size = acm->writesize; |
2000 | ss->baud_base = le32_to_cpu(acm->line.dwDTERate); |
2001 | - ss->close_delay = acm->port.close_delay / 10; |
2002 | + ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; |
2003 | ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? |
2004 | ASYNC_CLOSING_WAIT_NONE : |
2005 | - acm->port.closing_wait / 10; |
2006 | + jiffies_to_msecs(acm->port.closing_wait) / 10; |
2007 | return 0; |
2008 | } |
2009 | |
2010 | @@ -907,24 +907,32 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) |
2011 | { |
2012 | struct acm *acm = tty->driver_data; |
2013 | unsigned int closing_wait, close_delay; |
2014 | + unsigned int old_closing_wait, old_close_delay; |
2015 | int retval = 0; |
2016 | |
2017 | - close_delay = ss->close_delay * 10; |
2018 | + close_delay = msecs_to_jiffies(ss->close_delay * 10); |
2019 | closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ? |
2020 | - ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10; |
2021 | + ASYNC_CLOSING_WAIT_NONE : |
2022 | + msecs_to_jiffies(ss->closing_wait * 10); |
2023 | + |
2024 | + /* we must redo the rounding here, so that the values match */ |
2025 | + old_close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; |
2026 | + old_closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? |
2027 | + ASYNC_CLOSING_WAIT_NONE : |
2028 | + jiffies_to_msecs(acm->port.closing_wait) / 10; |
2029 | |
2030 | mutex_lock(&acm->port.mutex); |
2031 | |
2032 | - if (!capable(CAP_SYS_ADMIN)) { |
2033 | - if ((close_delay != acm->port.close_delay) || |
2034 | - (closing_wait != acm->port.closing_wait)) |
2035 | + if ((ss->close_delay != old_close_delay) || |
2036 | + (ss->closing_wait != old_closing_wait)) { |
2037 | + if (!capable(CAP_SYS_ADMIN)) |
2038 | retval = -EPERM; |
2039 | - else |
2040 | - retval = -EOPNOTSUPP; |
2041 | - } else { |
2042 | - acm->port.close_delay = close_delay; |
2043 | - acm->port.closing_wait = closing_wait; |
2044 | - } |
2045 | + else { |
2046 | + acm->port.close_delay = close_delay; |
2047 | + acm->port.closing_wait = closing_wait; |
2048 | + } |
2049 | + } else |
2050 | + retval = -EOPNOTSUPP; |
2051 | |
2052 | mutex_unlock(&acm->port.mutex); |
2053 | return retval; |
2054 | diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
2055 | index 2dac3e7cdd97..da30b5664ff3 100644 |
2056 | --- a/drivers/usb/core/quirks.c |
2057 | +++ b/drivers/usb/core/quirks.c |
2058 | @@ -378,6 +378,12 @@ static const struct usb_device_id usb_quirk_list[] = { |
2059 | { USB_DEVICE(0x0b05, 0x17e0), .driver_info = |
2060 | USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
2061 | |
2062 | + /* Realtek hub in Dell WD19 (Type-C) */ |
2063 | + { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM }, |
2064 | + |
2065 | + /* Generic RTL8153 based ethernet adapters */ |
2066 | + { USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM }, |
2067 | + |
2068 | /* Action Semiconductor flash disk */ |
2069 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
2070 | USB_QUIRK_STRING_FETCH_255 }, |
2071 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
2072 | index 5e9b537df631..1fddc41fa1f3 100644 |
2073 | --- a/drivers/usb/host/xhci-pci.c |
2074 | +++ b/drivers/usb/host/xhci-pci.c |
2075 | @@ -136,7 +136,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
2076 | xhci->quirks |= XHCI_AMD_PLL_FIX; |
2077 | |
2078 | if (pdev->vendor == PCI_VENDOR_ID_AMD && |
2079 | - (pdev->device == 0x15e0 || |
2080 | + (pdev->device == 0x145c || |
2081 | + pdev->device == 0x15e0 || |
2082 | pdev->device == 0x15e1 || |
2083 | pdev->device == 0x43bb)) |
2084 | xhci->quirks |= XHCI_SUSPEND_DELAY; |
2085 | diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c |
2086 | index d90cd5ec09cf..315b4552693c 100644 |
2087 | --- a/drivers/usb/host/xhci-plat.c |
2088 | +++ b/drivers/usb/host/xhci-plat.c |
2089 | @@ -445,6 +445,7 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); |
2090 | static struct platform_driver usb_xhci_driver = { |
2091 | .probe = xhci_plat_probe, |
2092 | .remove = xhci_plat_remove, |
2093 | + .shutdown = usb_hcd_platform_shutdown, |
2094 | .driver = { |
2095 | .name = "xhci-hcd", |
2096 | .pm = &xhci_plat_pm_ops, |
2097 | diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h |
2098 | index 052a269d86f2..87da9098fb34 100644 |
2099 | --- a/drivers/usb/host/xhci-trace.h |
2100 | +++ b/drivers/usb/host/xhci-trace.h |
2101 | @@ -289,23 +289,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb, |
2102 | ), |
2103 | TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x", |
2104 | __entry->epnum, __entry->dir_in ? "in" : "out", |
2105 | - ({ char *s; |
2106 | - switch (__entry->type) { |
2107 | - case USB_ENDPOINT_XFER_INT: |
2108 | - s = "intr"; |
2109 | - break; |
2110 | - case USB_ENDPOINT_XFER_CONTROL: |
2111 | - s = "control"; |
2112 | - break; |
2113 | - case USB_ENDPOINT_XFER_BULK: |
2114 | - s = "bulk"; |
2115 | - break; |
2116 | - case USB_ENDPOINT_XFER_ISOC: |
2117 | - s = "isoc"; |
2118 | - break; |
2119 | - default: |
2120 | - s = "UNKNOWN"; |
2121 | - } s; }), __entry->urb, __entry->pipe, __entry->slot_id, |
2122 | + __print_symbolic(__entry->type, |
2123 | + { USB_ENDPOINT_XFER_INT, "intr" }, |
2124 | + { USB_ENDPOINT_XFER_CONTROL, "control" }, |
2125 | + { USB_ENDPOINT_XFER_BULK, "bulk" }, |
2126 | + { USB_ENDPOINT_XFER_ISOC, "isoc" }), |
2127 | + __entry->urb, __entry->pipe, __entry->slot_id, |
2128 | __entry->actual, __entry->length, __entry->num_mapped_sgs, |
2129 | __entry->num_sgs, __entry->stream, __entry->flags |
2130 | ) |
2131 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2132 | index 084cc2fff3ae..0b5dcf973d94 100644 |
2133 | --- a/drivers/usb/serial/option.c |
2134 | +++ b/drivers/usb/serial/option.c |
2135 | @@ -1183,6 +1183,8 @@ static const struct usb_device_id option_ids[] = { |
2136 | .driver_info = NCTRL(0) }, |
2137 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */ |
2138 | .driver_info = NCTRL(0) | RSVD(3) }, |
2139 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110b, 0xff), /* Telit ME910G1 (ECM) */ |
2140 | + .driver_info = NCTRL(0) }, |
2141 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
2142 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
2143 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
2144 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
2145 | index 9d27b76c5c6e..e6d9b79d3521 100644 |
2146 | --- a/drivers/usb/serial/pl2303.c |
2147 | +++ b/drivers/usb/serial/pl2303.c |
2148 | @@ -93,6 +93,7 @@ static const struct usb_device_id id_table[] = { |
2149 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, |
2150 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, |
2151 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220TA_PRODUCT_ID) }, |
2152 | + { USB_DEVICE(HP_VENDOR_ID, HP_LD381_PRODUCT_ID) }, |
2153 | { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, |
2154 | { USB_DEVICE(HP_VENDOR_ID, HP_LD960TA_PRODUCT_ID) }, |
2155 | { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, |
2156 | diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h |
2157 | index b0175f17d1a2..c98db6b650a5 100644 |
2158 | --- a/drivers/usb/serial/pl2303.h |
2159 | +++ b/drivers/usb/serial/pl2303.h |
2160 | @@ -124,6 +124,7 @@ |
2161 | #define HP_LM920_PRODUCT_ID 0x026b |
2162 | #define HP_TD620_PRODUCT_ID 0x0956 |
2163 | #define HP_LD960_PRODUCT_ID 0x0b39 |
2164 | +#define HP_LD381_PRODUCT_ID 0x0f7f |
2165 | #define HP_LCM220_PRODUCT_ID 0x3139 |
2166 | #define HP_LCM960_PRODUCT_ID 0x3239 |
2167 | #define HP_LD220_PRODUCT_ID 0x3524 |
2168 | diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c |
2169 | index d99700cb4dca..166c2aabb512 100644 |
2170 | --- a/drivers/usb/typec/ucsi/displayport.c |
2171 | +++ b/drivers/usb/typec/ucsi/displayport.c |
2172 | @@ -273,6 +273,9 @@ void ucsi_displayport_remove_partner(struct typec_altmode *alt) |
2173 | return; |
2174 | |
2175 | dp = typec_altmode_get_drvdata(alt); |
2176 | + if (!dp) |
2177 | + return; |
2178 | + |
2179 | dp->data.conf = 0; |
2180 | dp->data.status = 0; |
2181 | dp->initialized = false; |
2182 | @@ -287,6 +290,8 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, |
2183 | struct typec_altmode *alt; |
2184 | struct ucsi_dp *dp; |
2185 | |
2186 | + mutex_lock(&con->lock); |
2187 | + |
2188 | /* We can't rely on the firmware with the capabilities. */ |
2189 | desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE; |
2190 | |
2191 | @@ -295,12 +300,15 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, |
2192 | desc->vdo |= all_assignments << 16; |
2193 | |
2194 | alt = typec_port_register_altmode(con->port, desc); |
2195 | - if (IS_ERR(alt)) |
2196 | + if (IS_ERR(alt)) { |
2197 | + mutex_unlock(&con->lock); |
2198 | return alt; |
2199 | + } |
2200 | |
2201 | dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); |
2202 | if (!dp) { |
2203 | typec_unregister_altmode(alt); |
2204 | + mutex_unlock(&con->lock); |
2205 | return ERR_PTR(-ENOMEM); |
2206 | } |
2207 | |
2208 | @@ -313,5 +321,7 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, |
2209 | alt->ops = &ucsi_displayport_ops; |
2210 | typec_altmode_set_drvdata(alt, dp); |
2211 | |
2212 | + mutex_unlock(&con->lock); |
2213 | + |
2214 | return alt; |
2215 | } |
2216 | diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c |
2217 | index d239fc3c5e3d..eb5151fc8efa 100644 |
2218 | --- a/drivers/xen/xenbus/xenbus_comms.c |
2219 | +++ b/drivers/xen/xenbus/xenbus_comms.c |
2220 | @@ -313,6 +313,8 @@ static int process_msg(void) |
2221 | req->msg.type = state.msg.type; |
2222 | req->msg.len = state.msg.len; |
2223 | req->body = state.body; |
2224 | + /* write body, then update state */ |
2225 | + virt_wmb(); |
2226 | req->state = xb_req_state_got_reply; |
2227 | req->cb(req); |
2228 | } else |
2229 | @@ -395,6 +397,8 @@ static int process_writes(void) |
2230 | if (state.req->state == xb_req_state_aborted) |
2231 | kfree(state.req); |
2232 | else { |
2233 | + /* write err, then update state */ |
2234 | + virt_wmb(); |
2235 | state.req->state = xb_req_state_got_reply; |
2236 | wake_up(&state.req->wq); |
2237 | } |
2238 | diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c |
2239 | index ddc18da61834..3a06eb699f33 100644 |
2240 | --- a/drivers/xen/xenbus/xenbus_xs.c |
2241 | +++ b/drivers/xen/xenbus/xenbus_xs.c |
2242 | @@ -191,8 +191,11 @@ static bool xenbus_ok(void) |
2243 | |
2244 | static bool test_reply(struct xb_req_data *req) |
2245 | { |
2246 | - if (req->state == xb_req_state_got_reply || !xenbus_ok()) |
2247 | + if (req->state == xb_req_state_got_reply || !xenbus_ok()) { |
2248 | + /* read req->state before all other fields */ |
2249 | + virt_rmb(); |
2250 | return true; |
2251 | + } |
2252 | |
2253 | /* Make sure to reread req->state each time. */ |
2254 | barrier(); |
2255 | @@ -202,7 +205,7 @@ static bool test_reply(struct xb_req_data *req) |
2256 | |
2257 | static void *read_reply(struct xb_req_data *req) |
2258 | { |
2259 | - while (req->state != xb_req_state_got_reply) { |
2260 | + do { |
2261 | wait_event(req->wq, test_reply(req)); |
2262 | |
2263 | if (!xenbus_ok()) |
2264 | @@ -216,7 +219,7 @@ static void *read_reply(struct xb_req_data *req) |
2265 | if (req->err) |
2266 | return ERR_PTR(req->err); |
2267 | |
2268 | - } |
2269 | + } while (req->state != xb_req_state_got_reply); |
2270 | |
2271 | return req->body; |
2272 | } |
2273 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
2274 | index c056d12cbb3c..94b0df3fb3c8 100644 |
2275 | --- a/fs/btrfs/inode.c |
2276 | +++ b/fs/btrfs/inode.c |
2277 | @@ -10142,6 +10142,10 @@ out_fail: |
2278 | ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, &ctx); |
2279 | if (ret) |
2280 | commit_transaction = true; |
2281 | + } else if (sync_log) { |
2282 | + mutex_lock(&root->log_mutex); |
2283 | + list_del(&ctx.list); |
2284 | + mutex_unlock(&root->log_mutex); |
2285 | } |
2286 | if (commit_transaction) { |
2287 | ret = btrfs_commit_transaction(trans); |
2288 | diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c |
2289 | index 606f26d862dc..cc3ada12848d 100644 |
2290 | --- a/fs/cifs/cifs_dfs_ref.c |
2291 | +++ b/fs/cifs/cifs_dfs_ref.c |
2292 | @@ -324,6 +324,8 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) |
2293 | if (full_path == NULL) |
2294 | goto cdda_exit; |
2295 | |
2296 | + convert_delimiter(full_path, '\\'); |
2297 | + |
2298 | cifs_dbg(FYI, "%s: full_path: %s\n", __func__, full_path); |
2299 | |
2300 | if (!cifs_sb_master_tlink(cifs_sb)) { |
2301 | diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c |
2302 | index 637624ab6e46..115f063497ff 100644 |
2303 | --- a/fs/cifs/cifsfs.c |
2304 | +++ b/fs/cifs/cifsfs.c |
2305 | @@ -530,6 +530,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) |
2306 | |
2307 | if (tcon->seal) |
2308 | seq_puts(s, ",seal"); |
2309 | + else if (tcon->ses->server->ignore_signature) |
2310 | + seq_puts(s, ",signloosely"); |
2311 | if (tcon->nocase) |
2312 | seq_puts(s, ",nocase"); |
2313 | if (tcon->local_lease) |
2314 | diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
2315 | index 0dbe47e89720..35c55cf38a35 100644 |
2316 | --- a/fs/cifs/file.c |
2317 | +++ b/fs/cifs/file.c |
2318 | @@ -1173,7 +1173,8 @@ try_again: |
2319 | rc = posix_lock_file(file, flock, NULL); |
2320 | up_write(&cinode->lock_sem); |
2321 | if (rc == FILE_LOCK_DEFERRED) { |
2322 | - rc = wait_event_interruptible(flock->fl_wait, !flock->fl_blocker); |
2323 | + rc = wait_event_interruptible(flock->fl_wait, |
2324 | + list_empty(&flock->fl_blocked_member)); |
2325 | if (!rc) |
2326 | goto try_again; |
2327 | locks_delete_block(flock); |
2328 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
2329 | index 99420608d2ec..76eacffb24d8 100644 |
2330 | --- a/fs/cifs/smb2ops.c |
2331 | +++ b/fs/cifs/smb2ops.c |
2332 | @@ -3252,7 +3252,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon, |
2333 | if (rc) |
2334 | goto out; |
2335 | |
2336 | - if (out_data_len < sizeof(struct file_allocated_range_buffer)) { |
2337 | + if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) { |
2338 | rc = -EINVAL; |
2339 | goto out; |
2340 | } |
2341 | diff --git a/fs/eventpoll.c b/fs/eventpoll.c |
2342 | index c4159bcc05d9..33cff49769cc 100644 |
2343 | --- a/fs/eventpoll.c |
2344 | +++ b/fs/eventpoll.c |
2345 | @@ -1881,9 +1881,9 @@ fetch_events: |
2346 | waiter = true; |
2347 | init_waitqueue_entry(&wait, current); |
2348 | |
2349 | - spin_lock_irq(&ep->wq.lock); |
2350 | + write_lock_irq(&ep->lock); |
2351 | __add_wait_queue_exclusive(&ep->wq, &wait); |
2352 | - spin_unlock_irq(&ep->wq.lock); |
2353 | + write_unlock_irq(&ep->lock); |
2354 | } |
2355 | |
2356 | for (;;) { |
2357 | @@ -1931,9 +1931,9 @@ send_events: |
2358 | goto fetch_events; |
2359 | |
2360 | if (waiter) { |
2361 | - spin_lock_irq(&ep->wq.lock); |
2362 | + write_lock_irq(&ep->lock); |
2363 | __remove_wait_queue(&ep->wq, &wait); |
2364 | - spin_unlock_irq(&ep->wq.lock); |
2365 | + write_unlock_irq(&ep->lock); |
2366 | } |
2367 | |
2368 | return res; |
2369 | diff --git a/fs/inode.c b/fs/inode.c |
2370 | index 96d62d97694e..c5267a4db0f5 100644 |
2371 | --- a/fs/inode.c |
2372 | +++ b/fs/inode.c |
2373 | @@ -137,6 +137,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) |
2374 | inode->i_sb = sb; |
2375 | inode->i_blkbits = sb->s_blocksize_bits; |
2376 | inode->i_flags = 0; |
2377 | + atomic64_set(&inode->i_sequence, 0); |
2378 | atomic_set(&inode->i_count, 1); |
2379 | inode->i_op = &empty_iops; |
2380 | inode->i_fop = &no_open_fops; |
2381 | diff --git a/fs/locks.c b/fs/locks.c |
2382 | index 44b6da032842..b8a31c1c4fff 100644 |
2383 | --- a/fs/locks.c |
2384 | +++ b/fs/locks.c |
2385 | @@ -725,7 +725,6 @@ static void __locks_delete_block(struct file_lock *waiter) |
2386 | { |
2387 | locks_delete_global_blocked(waiter); |
2388 | list_del_init(&waiter->fl_blocked_member); |
2389 | - waiter->fl_blocker = NULL; |
2390 | } |
2391 | |
2392 | static void __locks_wake_up_blocks(struct file_lock *blocker) |
2393 | @@ -740,6 +739,13 @@ static void __locks_wake_up_blocks(struct file_lock *blocker) |
2394 | waiter->fl_lmops->lm_notify(waiter); |
2395 | else |
2396 | wake_up(&waiter->fl_wait); |
2397 | + |
2398 | + /* |
2399 | + * The setting of fl_blocker to NULL marks the "done" |
2400 | + * point in deleting a block. Paired with acquire at the top |
2401 | + * of locks_delete_block(). |
2402 | + */ |
2403 | + smp_store_release(&waiter->fl_blocker, NULL); |
2404 | } |
2405 | } |
2406 | |
2407 | @@ -754,24 +760,41 @@ int locks_delete_block(struct file_lock *waiter) |
2408 | int status = -ENOENT; |
2409 | |
2410 | /* |
2411 | - * If fl_blocker is NULL, it won't be set again as this thread |
2412 | - * "owns" the lock and is the only one that might try to claim |
2413 | - * the lock. So it is safe to test fl_blocker locklessly. |
2414 | - * Also if fl_blocker is NULL, this waiter is not listed on |
2415 | - * fl_blocked_requests for some lock, so no other request can |
2416 | - * be added to the list of fl_blocked_requests for this |
2417 | - * request. So if fl_blocker is NULL, it is safe to |
2418 | - * locklessly check if fl_blocked_requests is empty. If both |
2419 | - * of these checks succeed, there is no need to take the lock. |
2420 | + * If fl_blocker is NULL, it won't be set again as this thread "owns" |
2421 | + * the lock and is the only one that might try to claim the lock. |
2422 | + * |
2423 | + * We use acquire/release to manage fl_blocker so that we can |
2424 | + * optimize away taking the blocked_lock_lock in many cases. |
2425 | + * |
2426 | + * The smp_load_acquire guarantees two things: |
2427 | + * |
2428 | + * 1/ that fl_blocked_requests can be tested locklessly. If something |
2429 | + * was recently added to that list it must have been in a locked region |
2430 | + * *before* the locked region when fl_blocker was set to NULL. |
2431 | + * |
2432 | + * 2/ that no other thread is accessing 'waiter', so it is safe to free |
2433 | + * it. __locks_wake_up_blocks is careful not to touch waiter after |
2434 | + * fl_blocker is released. |
2435 | + * |
2436 | + * If a lockless check of fl_blocker shows it to be NULL, we know that |
2437 | + * no new locks can be inserted into its fl_blocked_requests list, and |
2438 | + * can avoid doing anything further if the list is empty. |
2439 | */ |
2440 | - if (waiter->fl_blocker == NULL && |
2441 | + if (!smp_load_acquire(&waiter->fl_blocker) && |
2442 | list_empty(&waiter->fl_blocked_requests)) |
2443 | return status; |
2444 | + |
2445 | spin_lock(&blocked_lock_lock); |
2446 | if (waiter->fl_blocker) |
2447 | status = 0; |
2448 | __locks_wake_up_blocks(waiter); |
2449 | __locks_delete_block(waiter); |
2450 | + |
2451 | + /* |
2452 | + * The setting of fl_blocker to NULL marks the "done" point in deleting |
2453 | + * a block. Paired with acquire at the top of this function. |
2454 | + */ |
2455 | + smp_store_release(&waiter->fl_blocker, NULL); |
2456 | spin_unlock(&blocked_lock_lock); |
2457 | return status; |
2458 | } |
2459 | @@ -1364,7 +1387,8 @@ static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) |
2460 | error = posix_lock_inode(inode, fl, NULL); |
2461 | if (error != FILE_LOCK_DEFERRED) |
2462 | break; |
2463 | - error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker); |
2464 | + error = wait_event_interruptible(fl->fl_wait, |
2465 | + list_empty(&fl->fl_blocked_member)); |
2466 | if (error) |
2467 | break; |
2468 | } |
2469 | @@ -1449,7 +1473,8 @@ int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start, |
2470 | error = posix_lock_inode(inode, &fl, NULL); |
2471 | if (error != FILE_LOCK_DEFERRED) |
2472 | break; |
2473 | - error = wait_event_interruptible(fl.fl_wait, !fl.fl_blocker); |
2474 | + error = wait_event_interruptible(fl.fl_wait, |
2475 | + list_empty(&fl.fl_blocked_member)); |
2476 | if (!error) { |
2477 | /* |
2478 | * If we've been sleeping someone might have |
2479 | @@ -1652,7 +1677,8 @@ restart: |
2480 | |
2481 | locks_dispose_list(&dispose); |
2482 | error = wait_event_interruptible_timeout(new_fl->fl_wait, |
2483 | - !new_fl->fl_blocker, break_time); |
2484 | + list_empty(&new_fl->fl_blocked_member), |
2485 | + break_time); |
2486 | |
2487 | percpu_down_read(&file_rwsem); |
2488 | spin_lock(&ctx->flc_lock); |
2489 | @@ -2136,7 +2162,8 @@ static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) |
2490 | error = flock_lock_inode(inode, fl); |
2491 | if (error != FILE_LOCK_DEFERRED) |
2492 | break; |
2493 | - error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker); |
2494 | + error = wait_event_interruptible(fl->fl_wait, |
2495 | + list_empty(&fl->fl_blocked_member)); |
2496 | if (error) |
2497 | break; |
2498 | } |
2499 | @@ -2413,7 +2440,8 @@ static int do_lock_file_wait(struct file *filp, unsigned int cmd, |
2500 | error = vfs_lock_file(filp, cmd, fl, NULL); |
2501 | if (error != FILE_LOCK_DEFERRED) |
2502 | break; |
2503 | - error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker); |
2504 | + error = wait_event_interruptible(fl->fl_wait, |
2505 | + list_empty(&fl->fl_blocked_member)); |
2506 | if (error) |
2507 | break; |
2508 | } |
2509 | diff --git a/include/linux/fs.h b/include/linux/fs.h |
2510 | index 0b4d8fc79e0f..06668379109e 100644 |
2511 | --- a/include/linux/fs.h |
2512 | +++ b/include/linux/fs.h |
2513 | @@ -698,6 +698,7 @@ struct inode { |
2514 | struct rcu_head i_rcu; |
2515 | }; |
2516 | atomic64_t i_version; |
2517 | + atomic64_t i_sequence; /* see futex */ |
2518 | atomic_t i_count; |
2519 | atomic_t i_dio_count; |
2520 | atomic_t i_writecount; |
2521 | diff --git a/include/linux/futex.h b/include/linux/futex.h |
2522 | index 5cc3fed27d4c..b70df27d7e85 100644 |
2523 | --- a/include/linux/futex.h |
2524 | +++ b/include/linux/futex.h |
2525 | @@ -31,23 +31,26 @@ struct task_struct; |
2526 | |
2527 | union futex_key { |
2528 | struct { |
2529 | + u64 i_seq; |
2530 | unsigned long pgoff; |
2531 | - struct inode *inode; |
2532 | - int offset; |
2533 | + unsigned int offset; |
2534 | } shared; |
2535 | struct { |
2536 | + union { |
2537 | + struct mm_struct *mm; |
2538 | + u64 __tmp; |
2539 | + }; |
2540 | unsigned long address; |
2541 | - struct mm_struct *mm; |
2542 | - int offset; |
2543 | + unsigned int offset; |
2544 | } private; |
2545 | struct { |
2546 | + u64 ptr; |
2547 | unsigned long word; |
2548 | - void *ptr; |
2549 | - int offset; |
2550 | + unsigned int offset; |
2551 | } both; |
2552 | }; |
2553 | |
2554 | -#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } |
2555 | +#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } } |
2556 | |
2557 | #ifdef CONFIG_FUTEX |
2558 | enum { |
2559 | diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h |
2560 | index 1bf83c8fcaa7..77de28bfefb0 100644 |
2561 | --- a/include/linux/page-flags.h |
2562 | +++ b/include/linux/page-flags.h |
2563 | @@ -311,7 +311,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } |
2564 | |
2565 | __PAGEFLAG(Locked, locked, PF_NO_TAIL) |
2566 | PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) |
2567 | -PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND) |
2568 | +PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) |
2569 | PAGEFLAG(Referenced, referenced, PF_HEAD) |
2570 | TESTCLEARFLAG(Referenced, referenced, PF_HEAD) |
2571 | __SETPAGEFLAG(Referenced, referenced, PF_HEAD) |
2572 | diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h |
2573 | index 4e7809408073..decac0790fc1 100644 |
2574 | --- a/include/linux/vmalloc.h |
2575 | +++ b/include/linux/vmalloc.h |
2576 | @@ -126,8 +126,9 @@ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, |
2577 | |
2578 | extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
2579 | unsigned long pgoff); |
2580 | -void vmalloc_sync_all(void); |
2581 | - |
2582 | +void vmalloc_sync_mappings(void); |
2583 | +void vmalloc_sync_unmappings(void); |
2584 | + |
2585 | /* |
2586 | * Lowlevel-APIs (not for driver use!) |
2587 | */ |
2588 | diff --git a/kernel/futex.c b/kernel/futex.c |
2589 | index afbf928d6a6b..5660c02b01b0 100644 |
2590 | --- a/kernel/futex.c |
2591 | +++ b/kernel/futex.c |
2592 | @@ -385,9 +385,9 @@ static inline int hb_waiters_pending(struct futex_hash_bucket *hb) |
2593 | */ |
2594 | static struct futex_hash_bucket *hash_futex(union futex_key *key) |
2595 | { |
2596 | - u32 hash = jhash2((u32*)&key->both.word, |
2597 | - (sizeof(key->both.word)+sizeof(key->both.ptr))/4, |
2598 | + u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4, |
2599 | key->both.offset); |
2600 | + |
2601 | return &futex_queues[hash & (futex_hashsize - 1)]; |
2602 | } |
2603 | |
2604 | @@ -429,7 +429,7 @@ static void get_futex_key_refs(union futex_key *key) |
2605 | |
2606 | switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { |
2607 | case FUT_OFF_INODE: |
2608 | - ihold(key->shared.inode); /* implies smp_mb(); (B) */ |
2609 | + smp_mb(); /* explicit smp_mb(); (B) */ |
2610 | break; |
2611 | case FUT_OFF_MMSHARED: |
2612 | futex_get_mm(key); /* implies smp_mb(); (B) */ |
2613 | @@ -463,7 +463,6 @@ static void drop_futex_key_refs(union futex_key *key) |
2614 | |
2615 | switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { |
2616 | case FUT_OFF_INODE: |
2617 | - iput(key->shared.inode); |
2618 | break; |
2619 | case FUT_OFF_MMSHARED: |
2620 | mmdrop(key->private.mm); |
2621 | @@ -505,6 +504,46 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, |
2622 | return timeout; |
2623 | } |
2624 | |
2625 | +/* |
2626 | + * Generate a machine wide unique identifier for this inode. |
2627 | + * |
2628 | + * This relies on u64 not wrapping in the life-time of the machine; which with |
2629 | + * 1ns resolution means almost 585 years. |
2630 | + * |
2631 | + * This further relies on the fact that a well formed program will not unmap |
2632 | + * the file while it has a (shared) futex waiting on it. This mapping will have |
2633 | + * a file reference which pins the mount and inode. |
2634 | + * |
2635 | + * If for some reason an inode gets evicted and read back in again, it will get |
2636 | + * a new sequence number and will _NOT_ match, even though it is the exact same |
2637 | + * file. |
2638 | + * |
2639 | + * It is important that match_futex() will never have a false-positive, esp. |
2640 | + * for PI futexes that can mess up the state. The above argues that false-negatives |
2641 | + * are only possible for malformed programs. |
2642 | + */ |
2643 | +static u64 get_inode_sequence_number(struct inode *inode) |
2644 | +{ |
2645 | + static atomic64_t i_seq; |
2646 | + u64 old; |
2647 | + |
2648 | + /* Does the inode already have a sequence number? */ |
2649 | + old = atomic64_read(&inode->i_sequence); |
2650 | + if (likely(old)) |
2651 | + return old; |
2652 | + |
2653 | + for (;;) { |
2654 | + u64 new = atomic64_add_return(1, &i_seq); |
2655 | + if (WARN_ON_ONCE(!new)) |
2656 | + continue; |
2657 | + |
2658 | + old = atomic64_cmpxchg_relaxed(&inode->i_sequence, 0, new); |
2659 | + if (old) |
2660 | + return old; |
2661 | + return new; |
2662 | + } |
2663 | +} |
2664 | + |
2665 | /** |
2666 | * get_futex_key() - Get parameters which are the keys for a futex |
2667 | * @uaddr: virtual address of the futex |
2668 | @@ -517,9 +556,15 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, |
2669 | * |
2670 | * The key words are stored in @key on success. |
2671 | * |
2672 | - * For shared mappings, it's (page->index, file_inode(vma->vm_file), |
2673 | - * offset_within_page). For private mappings, it's (uaddr, current->mm). |
2674 | - * We can usually work out the index without swapping in the page. |
2675 | + * For shared mappings (when @fshared), the key is: |
2676 | + * ( inode->i_sequence, page->index, offset_within_page ) |
2677 | + * [ also see get_inode_sequence_number() ] |
2678 | + * |
2679 | + * For private mappings (or when !@fshared), the key is: |
2680 | + * ( current->mm, address, 0 ) |
2681 | + * |
2682 | + * This allows (cross process, where applicable) identification of the futex |
2683 | + * without keeping the page pinned for the duration of the FUTEX_WAIT. |
2684 | * |
2685 | * lock_page() might sleep, the caller should not hold a spinlock. |
2686 | */ |
2687 | @@ -659,8 +704,6 @@ again: |
2688 | key->private.mm = mm; |
2689 | key->private.address = address; |
2690 | |
2691 | - get_futex_key_refs(key); /* implies smp_mb(); (B) */ |
2692 | - |
2693 | } else { |
2694 | struct inode *inode; |
2695 | |
2696 | @@ -692,40 +735,14 @@ again: |
2697 | goto again; |
2698 | } |
2699 | |
2700 | - /* |
2701 | - * Take a reference unless it is about to be freed. Previously |
2702 | - * this reference was taken by ihold under the page lock |
2703 | - * pinning the inode in place so i_lock was unnecessary. The |
2704 | - * only way for this check to fail is if the inode was |
2705 | - * truncated in parallel which is almost certainly an |
2706 | - * application bug. In such a case, just retry. |
2707 | - * |
2708 | - * We are not calling into get_futex_key_refs() in file-backed |
2709 | - * cases, therefore a successful atomic_inc return below will |
2710 | - * guarantee that get_futex_key() will still imply smp_mb(); (B). |
2711 | - */ |
2712 | - if (!atomic_inc_not_zero(&inode->i_count)) { |
2713 | - rcu_read_unlock(); |
2714 | - put_page(page); |
2715 | - |
2716 | - goto again; |
2717 | - } |
2718 | - |
2719 | - /* Should be impossible but lets be paranoid for now */ |
2720 | - if (WARN_ON_ONCE(inode->i_mapping != mapping)) { |
2721 | - err = -EFAULT; |
2722 | - rcu_read_unlock(); |
2723 | - iput(inode); |
2724 | - |
2725 | - goto out; |
2726 | - } |
2727 | - |
2728 | key->both.offset |= FUT_OFF_INODE; /* inode-based key */ |
2729 | - key->shared.inode = inode; |
2730 | + key->shared.i_seq = get_inode_sequence_number(inode); |
2731 | key->shared.pgoff = basepage_index(tail); |
2732 | rcu_read_unlock(); |
2733 | } |
2734 | |
2735 | + get_futex_key_refs(key); /* implies smp_mb(); (B) */ |
2736 | + |
2737 | out: |
2738 | put_page(page); |
2739 | return err; |
2740 | diff --git a/kernel/notifier.c b/kernel/notifier.c |
2741 | index d9f5081d578d..157d7c29f720 100644 |
2742 | --- a/kernel/notifier.c |
2743 | +++ b/kernel/notifier.c |
2744 | @@ -554,7 +554,7 @@ NOKPROBE_SYMBOL(notify_die); |
2745 | |
2746 | int register_die_notifier(struct notifier_block *nb) |
2747 | { |
2748 | - vmalloc_sync_all(); |
2749 | + vmalloc_sync_mappings(); |
2750 | return atomic_notifier_chain_register(&die_chain, nb); |
2751 | } |
2752 | EXPORT_SYMBOL_GPL(register_die_notifier); |
2753 | diff --git a/mm/madvise.c b/mm/madvise.c |
2754 | index 94c343b4c968..d8cfc3a0c153 100644 |
2755 | --- a/mm/madvise.c |
2756 | +++ b/mm/madvise.c |
2757 | @@ -335,12 +335,14 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, |
2758 | } |
2759 | |
2760 | page = pmd_page(orig_pmd); |
2761 | + |
2762 | + /* Do not interfere with other mappings of this page */ |
2763 | + if (page_mapcount(page) != 1) |
2764 | + goto huge_unlock; |
2765 | + |
2766 | if (next - addr != HPAGE_PMD_SIZE) { |
2767 | int err; |
2768 | |
2769 | - if (page_mapcount(page) != 1) |
2770 | - goto huge_unlock; |
2771 | - |
2772 | get_page(page); |
2773 | spin_unlock(ptl); |
2774 | lock_page(page); |
2775 | @@ -426,6 +428,10 @@ regular_page: |
2776 | continue; |
2777 | } |
2778 | |
2779 | + /* Do not interfere with other mappings of this page */ |
2780 | + if (page_mapcount(page) != 1) |
2781 | + continue; |
2782 | + |
2783 | VM_BUG_ON_PAGE(PageTransCompound(page), page); |
2784 | |
2785 | if (pte_young(ptent)) { |
2786 | diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
2787 | index 23c99c6778d3..d804efb372e2 100644 |
2788 | --- a/mm/memcontrol.c |
2789 | +++ b/mm/memcontrol.c |
2790 | @@ -2414,28 +2414,41 @@ static void high_work_func(struct work_struct *work) |
2791 | #define MEMCG_DELAY_SCALING_SHIFT 14 |
2792 | |
2793 | /* |
2794 | - * Scheduled by try_charge() to be executed from the userland return path |
2795 | - * and reclaims memory over the high limit. |
2796 | + * Get the number of jiffies that we should penalise a mischievous cgroup which |
2797 | + * is exceeding its memory.high by checking both it and its ancestors. |
2798 | */ |
2799 | -void mem_cgroup_handle_over_high(void) |
2800 | +static unsigned long calculate_high_delay(struct mem_cgroup *memcg, |
2801 | + unsigned int nr_pages) |
2802 | { |
2803 | - unsigned long usage, high, clamped_high; |
2804 | - unsigned long pflags; |
2805 | - unsigned long penalty_jiffies, overage; |
2806 | - unsigned int nr_pages = current->memcg_nr_pages_over_high; |
2807 | - struct mem_cgroup *memcg; |
2808 | + unsigned long penalty_jiffies; |
2809 | + u64 max_overage = 0; |
2810 | |
2811 | - if (likely(!nr_pages)) |
2812 | - return; |
2813 | + do { |
2814 | + unsigned long usage, high; |
2815 | + u64 overage; |
2816 | |
2817 | - memcg = get_mem_cgroup_from_mm(current->mm); |
2818 | - reclaim_high(memcg, nr_pages, GFP_KERNEL); |
2819 | - current->memcg_nr_pages_over_high = 0; |
2820 | + usage = page_counter_read(&memcg->memory); |
2821 | + high = READ_ONCE(memcg->high); |
2822 | + |
2823 | + /* |
2824 | + * Prevent division by 0 in overage calculation by acting as if |
2825 | + * it was a threshold of 1 page |
2826 | + */ |
2827 | + high = max(high, 1UL); |
2828 | + |
2829 | + overage = usage - high; |
2830 | + overage <<= MEMCG_DELAY_PRECISION_SHIFT; |
2831 | + overage = div64_u64(overage, high); |
2832 | + |
2833 | + if (overage > max_overage) |
2834 | + max_overage = overage; |
2835 | + } while ((memcg = parent_mem_cgroup(memcg)) && |
2836 | + !mem_cgroup_is_root(memcg)); |
2837 | + |
2838 | + if (!max_overage) |
2839 | + return 0; |
2840 | |
2841 | /* |
2842 | - * memory.high is breached and reclaim is unable to keep up. Throttle |
2843 | - * allocators proactively to slow down excessive growth. |
2844 | - * |
2845 | * We use overage compared to memory.high to calculate the number of |
2846 | * jiffies to sleep (penalty_jiffies). Ideally this value should be |
2847 | * fairly lenient on small overages, and increasingly harsh when the |
2848 | @@ -2443,24 +2456,9 @@ void mem_cgroup_handle_over_high(void) |
2849 | * its crazy behaviour, so we exponentially increase the delay based on |
2850 | * overage amount. |
2851 | */ |
2852 | - |
2853 | - usage = page_counter_read(&memcg->memory); |
2854 | - high = READ_ONCE(memcg->high); |
2855 | - |
2856 | - if (usage <= high) |
2857 | - goto out; |
2858 | - |
2859 | - /* |
2860 | - * Prevent division by 0 in overage calculation by acting as if it was a |
2861 | - * threshold of 1 page |
2862 | - */ |
2863 | - clamped_high = max(high, 1UL); |
2864 | - |
2865 | - overage = div_u64((u64)(usage - high) << MEMCG_DELAY_PRECISION_SHIFT, |
2866 | - clamped_high); |
2867 | - |
2868 | - penalty_jiffies = ((u64)overage * overage * HZ) |
2869 | - >> (MEMCG_DELAY_PRECISION_SHIFT + MEMCG_DELAY_SCALING_SHIFT); |
2870 | + penalty_jiffies = max_overage * max_overage * HZ; |
2871 | + penalty_jiffies >>= MEMCG_DELAY_PRECISION_SHIFT; |
2872 | + penalty_jiffies >>= MEMCG_DELAY_SCALING_SHIFT; |
2873 | |
2874 | /* |
2875 | * Factor in the task's own contribution to the overage, such that four |
2876 | @@ -2477,7 +2475,32 @@ void mem_cgroup_handle_over_high(void) |
2877 | * application moving forwards and also permit diagnostics, albeit |
2878 | * extremely slowly. |
2879 | */ |
2880 | - penalty_jiffies = min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES); |
2881 | + return min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES); |
2882 | +} |
2883 | + |
2884 | +/* |
2885 | + * Scheduled by try_charge() to be executed from the userland return path |
2886 | + * and reclaims memory over the high limit. |
2887 | + */ |
2888 | +void mem_cgroup_handle_over_high(void) |
2889 | +{ |
2890 | + unsigned long penalty_jiffies; |
2891 | + unsigned long pflags; |
2892 | + unsigned int nr_pages = current->memcg_nr_pages_over_high; |
2893 | + struct mem_cgroup *memcg; |
2894 | + |
2895 | + if (likely(!nr_pages)) |
2896 | + return; |
2897 | + |
2898 | + memcg = get_mem_cgroup_from_mm(current->mm); |
2899 | + reclaim_high(memcg, nr_pages, GFP_KERNEL); |
2900 | + current->memcg_nr_pages_over_high = 0; |
2901 | + |
2902 | + /* |
2903 | + * memory.high is breached and reclaim is unable to keep up. Throttle |
2904 | + * allocators proactively to slow down excessive growth. |
2905 | + */ |
2906 | + penalty_jiffies = calculate_high_delay(memcg, nr_pages); |
2907 | |
2908 | /* |
2909 | * Don't sleep if the amount of jiffies this memcg owes us is so low |
2910 | @@ -4151,7 +4174,7 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, |
2911 | struct mem_cgroup_thresholds *thresholds; |
2912 | struct mem_cgroup_threshold_ary *new; |
2913 | unsigned long usage; |
2914 | - int i, j, size; |
2915 | + int i, j, size, entries; |
2916 | |
2917 | mutex_lock(&memcg->thresholds_lock); |
2918 | |
2919 | @@ -4171,14 +4194,20 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, |
2920 | __mem_cgroup_threshold(memcg, type == _MEMSWAP); |
2921 | |
2922 | /* Calculate new number of threshold */ |
2923 | - size = 0; |
2924 | + size = entries = 0; |
2925 | for (i = 0; i < thresholds->primary->size; i++) { |
2926 | if (thresholds->primary->entries[i].eventfd != eventfd) |
2927 | size++; |
2928 | + else |
2929 | + entries++; |
2930 | } |
2931 | |
2932 | new = thresholds->spare; |
2933 | |
2934 | + /* If no items related to eventfd have been cleared, nothing to do */ |
2935 | + if (!entries) |
2936 | + goto unlock; |
2937 | + |
2938 | /* Set thresholds array to NULL if we don't have thresholds */ |
2939 | if (!size) { |
2940 | kfree(new); |
2941 | diff --git a/mm/nommu.c b/mm/nommu.c |
2942 | index 99b7ec318824..3b67bd20c2af 100644 |
2943 | --- a/mm/nommu.c |
2944 | +++ b/mm/nommu.c |
2945 | @@ -359,10 +359,14 @@ void vm_unmap_aliases(void) |
2946 | EXPORT_SYMBOL_GPL(vm_unmap_aliases); |
2947 | |
2948 | /* |
2949 | - * Implement a stub for vmalloc_sync_all() if the architecture chose not to |
2950 | - * have one. |
2951 | + * Implement a stub for vmalloc_sync_[un]mapping() if the architecture |
2952 | + * chose not to have one. |
2953 | */ |
2954 | -void __weak vmalloc_sync_all(void) |
2955 | +void __weak vmalloc_sync_mappings(void) |
2956 | +{ |
2957 | +} |
2958 | + |
2959 | +void __weak vmalloc_sync_unmappings(void) |
2960 | { |
2961 | } |
2962 | |
2963 | diff --git a/mm/slub.c b/mm/slub.c |
2964 | index 3ca4a223f44c..59ed00be02cb 100644 |
2965 | --- a/mm/slub.c |
2966 | +++ b/mm/slub.c |
2967 | @@ -1953,8 +1953,6 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node, |
2968 | |
2969 | if (node == NUMA_NO_NODE) |
2970 | searchnode = numa_mem_id(); |
2971 | - else if (!node_present_pages(node)) |
2972 | - searchnode = node_to_mem_node(node); |
2973 | |
2974 | object = get_partial_node(s, get_node(s, searchnode), c, flags); |
2975 | if (object || node != NUMA_NO_NODE) |
2976 | @@ -2543,17 +2541,27 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, |
2977 | struct page *page; |
2978 | |
2979 | page = c->page; |
2980 | - if (!page) |
2981 | + if (!page) { |
2982 | + /* |
2983 | + * if the node is not online or has no normal memory, just |
2984 | + * ignore the node constraint |
2985 | + */ |
2986 | + if (unlikely(node != NUMA_NO_NODE && |
2987 | + !node_state(node, N_NORMAL_MEMORY))) |
2988 | + node = NUMA_NO_NODE; |
2989 | goto new_slab; |
2990 | + } |
2991 | redo: |
2992 | |
2993 | if (unlikely(!node_match(page, node))) { |
2994 | - int searchnode = node; |
2995 | - |
2996 | - if (node != NUMA_NO_NODE && !node_present_pages(node)) |
2997 | - searchnode = node_to_mem_node(node); |
2998 | - |
2999 | - if (unlikely(!node_match(page, searchnode))) { |
3000 | + /* |
3001 | + * same as above but node_match() being false already |
3002 | + * implies node != NUMA_NO_NODE |
3003 | + */ |
3004 | + if (!node_state(node, N_NORMAL_MEMORY)) { |
3005 | + node = NUMA_NO_NODE; |
3006 | + goto redo; |
3007 | + } else { |
3008 | stat(s, ALLOC_NODE_MISMATCH); |
3009 | deactivate_slab(s, page, c->freelist, c); |
3010 | goto new_slab; |
3011 | @@ -2977,11 +2985,13 @@ redo: |
3012 | barrier(); |
3013 | |
3014 | if (likely(page == c->page)) { |
3015 | - set_freepointer(s, tail_obj, c->freelist); |
3016 | + void **freelist = READ_ONCE(c->freelist); |
3017 | + |
3018 | + set_freepointer(s, tail_obj, freelist); |
3019 | |
3020 | if (unlikely(!this_cpu_cmpxchg_double( |
3021 | s->cpu_slab->freelist, s->cpu_slab->tid, |
3022 | - c->freelist, tid, |
3023 | + freelist, tid, |
3024 | head, next_tid(tid)))) { |
3025 | |
3026 | note_cmpxchg_failure("slab_free", s, tid); |
3027 | diff --git a/mm/sparse.c b/mm/sparse.c |
3028 | index a5e5c1c3a2a8..a18ad9390d9f 100644 |
3029 | --- a/mm/sparse.c |
3030 | +++ b/mm/sparse.c |
3031 | @@ -742,6 +742,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, |
3032 | struct mem_section *ms = __pfn_to_section(pfn); |
3033 | bool section_is_early = early_section(ms); |
3034 | struct page *memmap = NULL; |
3035 | + bool empty; |
3036 | unsigned long *subsection_map = ms->usage |
3037 | ? &ms->usage->subsection_map[0] : NULL; |
3038 | |
3039 | @@ -772,7 +773,8 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, |
3040 | * For 2/ and 3/ the SPARSEMEM_VMEMMAP={y,n} cases are unified |
3041 | */ |
3042 | bitmap_xor(subsection_map, map, subsection_map, SUBSECTIONS_PER_SECTION); |
3043 | - if (bitmap_empty(subsection_map, SUBSECTIONS_PER_SECTION)) { |
3044 | + empty = bitmap_empty(subsection_map, SUBSECTIONS_PER_SECTION); |
3045 | + if (empty) { |
3046 | unsigned long section_nr = pfn_to_section_nr(pfn); |
3047 | |
3048 | /* |
3049 | @@ -787,13 +789,15 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, |
3050 | ms->usage = NULL; |
3051 | } |
3052 | memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr); |
3053 | - ms->section_mem_map = (unsigned long)NULL; |
3054 | } |
3055 | |
3056 | if (section_is_early && memmap) |
3057 | free_map_bootmem(memmap); |
3058 | else |
3059 | depopulate_section_memmap(pfn, nr_pages, altmap); |
3060 | + |
3061 | + if (empty) |
3062 | + ms->section_mem_map = (unsigned long)NULL; |
3063 | } |
3064 | |
3065 | static struct page * __meminit section_activate(int nid, unsigned long pfn, |
3066 | diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
3067 | index 61bdbaf20cde..7d05834e594c 100644 |
3068 | --- a/mm/vmalloc.c |
3069 | +++ b/mm/vmalloc.c |
3070 | @@ -1259,7 +1259,7 @@ static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end) |
3071 | * First make sure the mappings are removed from all page-tables |
3072 | * before they are freed. |
3073 | */ |
3074 | - vmalloc_sync_all(); |
3075 | + vmalloc_sync_unmappings(); |
3076 | |
3077 | /* |
3078 | * TODO: to calculate a flush range without looping. |
3079 | @@ -3050,16 +3050,19 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
3080 | EXPORT_SYMBOL(remap_vmalloc_range); |
3081 | |
3082 | /* |
3083 | - * Implement a stub for vmalloc_sync_all() if the architecture chose not to |
3084 | - * have one. |
3085 | + * Implement stubs for vmalloc_sync_[un]mappings () if the architecture chose |
3086 | + * not to have one. |
3087 | * |
3088 | * The purpose of this function is to make sure the vmalloc area |
3089 | * mappings are identical in all page-tables in the system. |
3090 | */ |
3091 | -void __weak vmalloc_sync_all(void) |
3092 | +void __weak vmalloc_sync_mappings(void) |
3093 | { |
3094 | } |
3095 | |
3096 | +void __weak vmalloc_sync_unmappings(void) |
3097 | +{ |
3098 | +} |
3099 | |
3100 | static int f(pte_t *pte, unsigned long addr, void *data) |
3101 | { |
3102 | diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn |
3103 | index ecddf83ac142..ca08f2fe7c34 100644 |
3104 | --- a/scripts/Makefile.extrawarn |
3105 | +++ b/scripts/Makefile.extrawarn |
3106 | @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides |
3107 | KBUILD_CFLAGS += -Wno-format |
3108 | KBUILD_CFLAGS += -Wno-sign-compare |
3109 | KBUILD_CFLAGS += -Wno-format-zero-length |
3110 | +KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) |
3111 | endif |
3112 | |
3113 | endif |
3114 | diff --git a/scripts/export_report.pl b/scripts/export_report.pl |
3115 | index 548330e8c4e7..feb3d5542a62 100755 |
3116 | --- a/scripts/export_report.pl |
3117 | +++ b/scripts/export_report.pl |
3118 | @@ -94,7 +94,7 @@ if (defined $opt{'o'}) { |
3119 | # |
3120 | while ( <$module_symvers> ) { |
3121 | chomp; |
3122 | - my (undef, $symbol, $namespace, $module, $gpl) = split('\t'); |
3123 | + my (undef, $symbol, $module, $gpl, $namespace) = split('\t'); |
3124 | $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; |
3125 | } |
3126 | close($module_symvers); |
3127 | diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c |
3128 | index d2a30a7b3f07..52f1152c9838 100644 |
3129 | --- a/scripts/mod/modpost.c |
3130 | +++ b/scripts/mod/modpost.c |
3131 | @@ -2434,7 +2434,7 @@ static void write_if_changed(struct buffer *b, const char *fname) |
3132 | } |
3133 | |
3134 | /* parse Module.symvers file. line format: |
3135 | - * 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something] |
3136 | + * 0x12345678<tab>symbol<tab>module<tab>export<tab>namespace |
3137 | **/ |
3138 | static void read_dump(const char *fname, unsigned int kernel) |
3139 | { |
3140 | @@ -2447,7 +2447,7 @@ static void read_dump(const char *fname, unsigned int kernel) |
3141 | return; |
3142 | |
3143 | while ((line = get_next_line(&pos, file, size))) { |
3144 | - char *symname, *namespace, *modname, *d, *export, *end; |
3145 | + char *symname, *namespace, *modname, *d, *export; |
3146 | unsigned int crc; |
3147 | struct module *mod; |
3148 | struct symbol *s; |
3149 | @@ -2455,16 +2455,16 @@ static void read_dump(const char *fname, unsigned int kernel) |
3150 | if (!(symname = strchr(line, '\t'))) |
3151 | goto fail; |
3152 | *symname++ = '\0'; |
3153 | - if (!(namespace = strchr(symname, '\t'))) |
3154 | - goto fail; |
3155 | - *namespace++ = '\0'; |
3156 | - if (!(modname = strchr(namespace, '\t'))) |
3157 | + if (!(modname = strchr(symname, '\t'))) |
3158 | goto fail; |
3159 | *modname++ = '\0'; |
3160 | - if ((export = strchr(modname, '\t')) != NULL) |
3161 | - *export++ = '\0'; |
3162 | - if (export && ((end = strchr(export, '\t')) != NULL)) |
3163 | - *end = '\0'; |
3164 | + if (!(export = strchr(modname, '\t'))) |
3165 | + goto fail; |
3166 | + *export++ = '\0'; |
3167 | + if (!(namespace = strchr(export, '\t'))) |
3168 | + goto fail; |
3169 | + *namespace++ = '\0'; |
3170 | + |
3171 | crc = strtoul(line, &d, 16); |
3172 | if (*symname == '\0' || *modname == '\0' || *d != '\0') |
3173 | goto fail; |
3174 | @@ -2516,9 +2516,9 @@ static void write_dump(const char *fname) |
3175 | namespace = symbol->namespace; |
3176 | buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n", |
3177 | symbol->crc, symbol->name, |
3178 | - namespace ? namespace : "", |
3179 | symbol->module->name, |
3180 | - export_str(symbol->export)); |
3181 | + export_str(symbol->export), |
3182 | + namespace ? namespace : ""); |
3183 | } |
3184 | symbol = symbol->next; |
3185 | } |
3186 | diff --git a/scripts/parse-maintainers.pl b/scripts/parse-maintainers.pl |
3187 | old mode 100644 |
3188 | new mode 100755 |
3189 | diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c |
3190 | index 31cb2acf8afc..732bbede7ebf 100644 |
3191 | --- a/sound/core/oss/pcm_plugin.c |
3192 | +++ b/sound/core/oss/pcm_plugin.c |
3193 | @@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) |
3194 | while (plugin->next) { |
3195 | if (plugin->dst_frames) |
3196 | frames = plugin->dst_frames(plugin, frames); |
3197 | - if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) |
3198 | + if ((snd_pcm_sframes_t)frames <= 0) |
3199 | return -ENXIO; |
3200 | plugin = plugin->next; |
3201 | err = snd_pcm_plugin_alloc(plugin, frames); |
3202 | @@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) |
3203 | while (plugin->prev) { |
3204 | if (plugin->src_frames) |
3205 | frames = plugin->src_frames(plugin, frames); |
3206 | - if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) |
3207 | + if ((snd_pcm_sframes_t)frames <= 0) |
3208 | return -ENXIO; |
3209 | plugin = plugin->prev; |
3210 | err = snd_pcm_plugin_alloc(plugin, frames); |
3211 | @@ -209,6 +209,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p |
3212 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
3213 | plugin = snd_pcm_plug_last(plug); |
3214 | while (plugin && drv_frames > 0) { |
3215 | + if (drv_frames > plugin->buf_frames) |
3216 | + drv_frames = plugin->buf_frames; |
3217 | plugin_prev = plugin->prev; |
3218 | if (plugin->src_frames) |
3219 | drv_frames = plugin->src_frames(plugin, drv_frames); |
3220 | @@ -220,6 +222,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p |
3221 | plugin_next = plugin->next; |
3222 | if (plugin->dst_frames) |
3223 | drv_frames = plugin->dst_frames(plugin, drv_frames); |
3224 | + if (drv_frames > plugin->buf_frames) |
3225 | + drv_frames = plugin->buf_frames; |
3226 | plugin = plugin_next; |
3227 | } |
3228 | } else |
3229 | @@ -248,11 +252,15 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc |
3230 | if (frames < 0) |
3231 | return frames; |
3232 | } |
3233 | + if (frames > plugin->buf_frames) |
3234 | + frames = plugin->buf_frames; |
3235 | plugin = plugin_next; |
3236 | } |
3237 | } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { |
3238 | plugin = snd_pcm_plug_last(plug); |
3239 | while (plugin) { |
3240 | + if (frames > plugin->buf_frames) |
3241 | + frames = plugin->buf_frames; |
3242 | plugin_prev = plugin->prev; |
3243 | if (plugin->src_frames) { |
3244 | frames = plugin->src_frames(plugin, frames); |
3245 | diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c |
3246 | index a88c235b2ea3..2ddfe2226651 100644 |
3247 | --- a/sound/core/seq/oss/seq_oss_midi.c |
3248 | +++ b/sound/core/seq/oss/seq_oss_midi.c |
3249 | @@ -602,6 +602,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq |
3250 | len = snd_seq_oss_timer_start(dp->timer); |
3251 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { |
3252 | snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev); |
3253 | + snd_midi_event_reset_decode(mdev->coder); |
3254 | } else { |
3255 | len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev); |
3256 | if (len > 0) |
3257 | diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c |
3258 | index 626d87c1539b..77d7037d1476 100644 |
3259 | --- a/sound/core/seq/seq_virmidi.c |
3260 | +++ b/sound/core/seq/seq_virmidi.c |
3261 | @@ -81,6 +81,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, |
3262 | if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) |
3263 | continue; |
3264 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream); |
3265 | + snd_midi_event_reset_decode(vmidi->parser); |
3266 | } else { |
3267 | len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); |
3268 | if (len > 0) |
3269 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3270 | index 12858d95c2c8..128db2e6bc64 100644 |
3271 | --- a/sound/pci/hda/patch_realtek.c |
3272 | +++ b/sound/pci/hda/patch_realtek.c |
3273 | @@ -8080,6 +8080,8 @@ static int patch_alc269(struct hda_codec *codec) |
3274 | spec->gen.mixer_nid = 0; |
3275 | break; |
3276 | case 0x10ec0225: |
3277 | + codec->power_save_node = 1; |
3278 | + /* fall through */ |
3279 | case 0x10ec0295: |
3280 | case 0x10ec0299: |
3281 | spec->codec_variant = ALC269_TYPE_ALC225; |
3282 | @@ -8639,6 +8641,8 @@ enum { |
3283 | ALC669_FIXUP_ACER_ASPIRE_ETHOS, |
3284 | ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, |
3285 | ALC671_FIXUP_HP_HEADSET_MIC2, |
3286 | + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, |
3287 | + ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, |
3288 | }; |
3289 | |
3290 | static const struct hda_fixup alc662_fixups[] = { |
3291 | @@ -8984,6 +8988,25 @@ static const struct hda_fixup alc662_fixups[] = { |
3292 | .type = HDA_FIXUP_FUNC, |
3293 | .v.func = alc671_fixup_hp_headset_mic2, |
3294 | }, |
3295 | + [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = { |
3296 | + .type = HDA_FIXUP_PINS, |
3297 | + .v.pins = (const struct hda_pintbl[]) { |
3298 | + { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */ |
3299 | + { } |
3300 | + }, |
3301 | + .chained = true, |
3302 | + .chain_id = ALC662_FIXUP_USI_FUNC |
3303 | + }, |
3304 | + [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = { |
3305 | + .type = HDA_FIXUP_PINS, |
3306 | + .v.pins = (const struct hda_pintbl[]) { |
3307 | + { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */ |
3308 | + { 0x1b, 0x0221144f }, |
3309 | + { } |
3310 | + }, |
3311 | + .chained = true, |
3312 | + .chain_id = ALC662_FIXUP_USI_FUNC |
3313 | + }, |
3314 | }; |
3315 | |
3316 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
3317 | @@ -8995,6 +9018,8 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
3318 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
3319 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), |
3320 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
3321 | + SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE), |
3322 | + SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE), |
3323 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
3324 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
3325 | SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), |
3326 | diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c |
3327 | index 30bcd5d3a32a..10eb4b8e8e7e 100644 |
3328 | --- a/sound/soc/stm/stm32_sai_sub.c |
3329 | +++ b/sound/soc/stm/stm32_sai_sub.c |
3330 | @@ -1543,20 +1543,20 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) |
3331 | return ret; |
3332 | } |
3333 | |
3334 | - ret = devm_snd_soc_register_component(&pdev->dev, &stm32_component, |
3335 | - &sai->cpu_dai_drv, 1); |
3336 | + ret = snd_dmaengine_pcm_register(&pdev->dev, conf, 0); |
3337 | + if (ret) { |
3338 | + dev_err(&pdev->dev, "Could not register pcm dma\n"); |
3339 | + return ret; |
3340 | + } |
3341 | + |
3342 | + ret = snd_soc_register_component(&pdev->dev, &stm32_component, |
3343 | + &sai->cpu_dai_drv, 1); |
3344 | if (ret) |
3345 | return ret; |
3346 | |
3347 | if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) |
3348 | conf = &stm32_sai_pcm_config_spdif; |
3349 | |
3350 | - ret = devm_snd_dmaengine_pcm_register(&pdev->dev, conf, 0); |
3351 | - if (ret) { |
3352 | - dev_err(&pdev->dev, "Could not register pcm dma\n"); |
3353 | - return ret; |
3354 | - } |
3355 | - |
3356 | return 0; |
3357 | } |
3358 | |
3359 | @@ -1565,6 +1565,8 @@ static int stm32_sai_sub_remove(struct platform_device *pdev) |
3360 | struct stm32_sai_sub_data *sai = dev_get_drvdata(&pdev->dev); |
3361 | |
3362 | clk_unprepare(sai->pdata->pclk); |
3363 | + snd_dmaengine_pcm_unregister(&pdev->dev); |
3364 | + snd_soc_unregister_component(&pdev->dev); |
3365 | |
3366 | return 0; |
3367 | } |
3368 | diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c |
3369 | index b5a3f754a4f1..4f096685ed65 100644 |
3370 | --- a/sound/usb/line6/driver.c |
3371 | +++ b/sound/usb/line6/driver.c |
3372 | @@ -305,7 +305,7 @@ static void line6_data_received(struct urb *urb) |
3373 | line6_midibuf_read(mb, line6->buffer_message, |
3374 | LINE6_MIDI_MESSAGE_MAXLEN); |
3375 | |
3376 | - if (done == 0) |
3377 | + if (done <= 0) |
3378 | break; |
3379 | |
3380 | line6->message_length = done; |
3381 | diff --git a/sound/usb/line6/midibuf.c b/sound/usb/line6/midibuf.c |
3382 | index 8d6eefa0d936..6a70463f82c4 100644 |
3383 | --- a/sound/usb/line6/midibuf.c |
3384 | +++ b/sound/usb/line6/midibuf.c |
3385 | @@ -159,7 +159,7 @@ int line6_midibuf_read(struct midi_buffer *this, unsigned char *data, |
3386 | int midi_length_prev = |
3387 | midibuf_message_length(this->command_prev); |
3388 | |
3389 | - if (midi_length_prev > 0) { |
3390 | + if (midi_length_prev > 1) { |
3391 | midi_length = midi_length_prev - 1; |
3392 | repeat = 1; |
3393 | } else |