Annotation of /trunk/kernel-alx/patches-4.9/0328-4.9.229-all-fixes.patch
Parent Directory | Revision Log
Revision 3603 -
(hide annotations)
(download)
Thu Aug 13 10:21:42 2020 UTC (4 years, 1 month ago) by niro
File size: 236385 byte(s)
Thu Aug 13 10:21:42 2020 UTC (4 years, 1 month ago) by niro
File size: 236385 byte(s)
linux-229
1 | niro | 3603 | diff --git a/Documentation/media/uapi/dvb/fe-get-property.rst b/Documentation/media/uapi/dvb/fe-get-property.rst |
2 | index 015d4db597b5..c80c5fc6e916 100644 | ||
3 | --- a/Documentation/media/uapi/dvb/fe-get-property.rst | ||
4 | +++ b/Documentation/media/uapi/dvb/fe-get-property.rst | ||
5 | @@ -48,8 +48,11 @@ depends on the delivery system and on the device: | ||
6 | |||
7 | - This call requires read/write access to the device. | ||
8 | |||
9 | - - At return, the values are updated to reflect the actual parameters | ||
10 | - used. | ||
11 | +.. note:: | ||
12 | + | ||
13 | + At return, the values aren't updated to reflect the actual | ||
14 | + parameters used. If the actual parameters are needed, an explicit | ||
15 | + call to ``FE_GET_PROPERTY`` is needed. | ||
16 | |||
17 | - ``FE_GET_PROPERTY:`` | ||
18 | |||
19 | diff --git a/Makefile b/Makefile | ||
20 | index af23d7b67442..a8a9704a6e2e 100644 | ||
21 | --- a/Makefile | ||
22 | +++ b/Makefile | ||
23 | @@ -1,6 +1,6 @@ | ||
24 | VERSION = 4 | ||
25 | PATCHLEVEL = 9 | ||
26 | -SUBLEVEL = 228 | ||
27 | +SUBLEVEL = 229 | ||
28 | EXTRAVERSION = | ||
29 | NAME = Roaring Lionus | ||
30 | |||
31 | diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c | ||
32 | index 868781fd460c..14c630c899c5 100644 | ||
33 | --- a/arch/arm/mach-imx/pm-imx5.c | ||
34 | +++ b/arch/arm/mach-imx/pm-imx5.c | ||
35 | @@ -301,14 +301,14 @@ static int __init imx_suspend_alloc_ocram( | ||
36 | if (!ocram_pool) { | ||
37 | pr_warn("%s: ocram pool unavailable!\n", __func__); | ||
38 | ret = -ENODEV; | ||
39 | - goto put_node; | ||
40 | + goto put_device; | ||
41 | } | ||
42 | |||
43 | ocram_base = gen_pool_alloc(ocram_pool, size); | ||
44 | if (!ocram_base) { | ||
45 | pr_warn("%s: unable to alloc ocram!\n", __func__); | ||
46 | ret = -ENOMEM; | ||
47 | - goto put_node; | ||
48 | + goto put_device; | ||
49 | } | ||
50 | |||
51 | phys = gen_pool_virt_to_phys(ocram_pool, ocram_base); | ||
52 | @@ -318,6 +318,8 @@ static int __init imx_suspend_alloc_ocram( | ||
53 | if (virt_out) | ||
54 | *virt_out = virt; | ||
55 | |||
56 | +put_device: | ||
57 | + put_device(&pdev->dev); | ||
58 | put_node: | ||
59 | of_node_put(node); | ||
60 | |||
61 | diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig | ||
62 | index cefe44f6889b..ba124f8704fa 100644 | ||
63 | --- a/arch/arm/mach-integrator/Kconfig | ||
64 | +++ b/arch/arm/mach-integrator/Kconfig | ||
65 | @@ -3,6 +3,8 @@ menuconfig ARCH_INTEGRATOR | ||
66 | depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 | ||
67 | select ARM_AMBA | ||
68 | select COMMON_CLK_VERSATILE | ||
69 | + select CMA | ||
70 | + select DMA_CMA | ||
71 | select HAVE_TCM | ||
72 | select ICST | ||
73 | select MFD_SYSCON | ||
74 | @@ -34,14 +36,13 @@ config INTEGRATOR_IMPD1 | ||
75 | select ARM_VIC | ||
76 | select GPIO_PL061 | ||
77 | select GPIOLIB | ||
78 | + select REGULATOR | ||
79 | + select REGULATOR_FIXED_VOLTAGE | ||
80 | help | ||
81 | The IM-PD1 is an add-on logic module for the Integrator which | ||
82 | allows ARM(R) Ltd PrimeCells to be developed and evaluated. | ||
83 | The IM-PD1 can be found on the Integrator/PP2 platform. | ||
84 | |||
85 | - To compile this driver as a module, choose M here: the | ||
86 | - module will be called impd1. | ||
87 | - | ||
88 | config INTEGRATOR_CM7TDMI | ||
89 | bool "Integrator/CM7TDMI core module" | ||
90 | depends on ARCH_INTEGRATOR_AP | ||
91 | diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c | ||
92 | index 3f62b35fb6f1..815c395a1076 100644 | ||
93 | --- a/arch/arm64/kernel/perf_regs.c | ||
94 | +++ b/arch/arm64/kernel/perf_regs.c | ||
95 | @@ -13,15 +13,34 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) | ||
96 | return 0; | ||
97 | |||
98 | /* | ||
99 | - * Compat (i.e. 32 bit) mode: | ||
100 | - * - PC has been set in the pt_regs struct in kernel_entry, | ||
101 | - * - Handle SP and LR here. | ||
102 | + * Our handling of compat tasks (PERF_SAMPLE_REGS_ABI_32) is weird, but | ||
103 | + * we're stuck with it for ABI compatability reasons. | ||
104 | + * | ||
105 | + * For a 32-bit consumer inspecting a 32-bit task, then it will look at | ||
106 | + * the first 16 registers (see arch/arm/include/uapi/asm/perf_regs.h). | ||
107 | + * These correspond directly to a prefix of the registers saved in our | ||
108 | + * 'struct pt_regs', with the exception of the PC, so we copy that down | ||
109 | + * (x15 corresponds to SP_hyp in the architecture). | ||
110 | + * | ||
111 | + * So far, so good. | ||
112 | + * | ||
113 | + * The oddity arises when a 64-bit consumer looks at a 32-bit task and | ||
114 | + * asks for registers beyond PERF_REG_ARM_MAX. In this case, we return | ||
115 | + * SP_usr, LR_usr and PC in the positions where the AArch64 SP, LR and | ||
116 | + * PC registers would normally live. The initial idea was to allow a | ||
117 | + * 64-bit unwinder to unwind a 32-bit task and, although it's not clear | ||
118 | + * how well that works in practice, somebody might be relying on it. | ||
119 | + * | ||
120 | + * At the time we make a sample, we don't know whether the consumer is | ||
121 | + * 32-bit or 64-bit, so we have to cater for both possibilities. | ||
122 | */ | ||
123 | if (compat_user_mode(regs)) { | ||
124 | if ((u32)idx == PERF_REG_ARM64_SP) | ||
125 | return regs->compat_sp; | ||
126 | if ((u32)idx == PERF_REG_ARM64_LR) | ||
127 | return regs->compat_lr; | ||
128 | + if (idx == 15) | ||
129 | + return regs->pc; | ||
130 | } | ||
131 | |||
132 | if ((u32)idx == PERF_REG_ARM64_SP) | ||
133 | diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S | ||
134 | index c17e8451d997..3fbe420f49c4 100644 | ||
135 | --- a/arch/openrisc/kernel/entry.S | ||
136 | +++ b/arch/openrisc/kernel/entry.S | ||
137 | @@ -1092,13 +1092,13 @@ ENTRY(__sys_clone) | ||
138 | l.movhi r29,hi(sys_clone) | ||
139 | l.ori r29,r29,lo(sys_clone) | ||
140 | l.j _fork_save_extra_regs_and_call | ||
141 | - l.addi r7,r1,0 | ||
142 | + l.nop | ||
143 | |||
144 | ENTRY(__sys_fork) | ||
145 | l.movhi r29,hi(sys_fork) | ||
146 | l.ori r29,r29,lo(sys_fork) | ||
147 | l.j _fork_save_extra_regs_and_call | ||
148 | - l.addi r3,r1,0 | ||
149 | + l.nop | ||
150 | |||
151 | ENTRY(sys_rt_sigreturn) | ||
152 | l.j _sys_rt_sigreturn | ||
153 | diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h | ||
154 | index 9fd77f8794a0..315758c84187 100644 | ||
155 | --- a/arch/powerpc/include/asm/book3s/64/pgtable.h | ||
156 | +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h | ||
157 | @@ -754,10 +754,25 @@ extern struct page *pgd_page(pgd_t pgd); | ||
158 | #define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS) | ||
159 | #define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS) | ||
160 | |||
161 | -#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1)) | ||
162 | -#define pud_index(address) (((address) >> (PUD_SHIFT)) & (PTRS_PER_PUD - 1)) | ||
163 | -#define pmd_index(address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1)) | ||
164 | -#define pte_index(address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1)) | ||
165 | +static inline unsigned long pgd_index(unsigned long address) | ||
166 | +{ | ||
167 | + return (address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1); | ||
168 | +} | ||
169 | + | ||
170 | +static inline unsigned long pud_index(unsigned long address) | ||
171 | +{ | ||
172 | + return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1); | ||
173 | +} | ||
174 | + | ||
175 | +static inline unsigned long pmd_index(unsigned long address) | ||
176 | +{ | ||
177 | + return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); | ||
178 | +} | ||
179 | + | ||
180 | +static inline unsigned long pte_index(unsigned long address) | ||
181 | +{ | ||
182 | + return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); | ||
183 | +} | ||
184 | |||
185 | /* | ||
186 | * Find an entry in a page-table-directory. We combine the address region | ||
187 | diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h | ||
188 | index 2c9759bdb63b..063d64c1c9e8 100644 | ||
189 | --- a/arch/powerpc/include/asm/kprobes.h | ||
190 | +++ b/arch/powerpc/include/asm/kprobes.h | ||
191 | @@ -29,6 +29,7 @@ | ||
192 | #include <linux/types.h> | ||
193 | #include <linux/ptrace.h> | ||
194 | #include <linux/percpu.h> | ||
195 | +#include <linux/module.h> | ||
196 | #include <asm/probes.h> | ||
197 | #include <asm/code-patching.h> | ||
198 | |||
199 | @@ -60,7 +61,7 @@ typedef ppc_opcode_t kprobe_opcode_t; | ||
200 | #define kprobe_lookup_name(name, addr) \ | ||
201 | { \ | ||
202 | char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \ | ||
203 | - char *modsym; \ | ||
204 | + const char *modsym; \ | ||
205 | bool dot_appended = false; \ | ||
206 | if ((modsym = strchr(name, ':')) != NULL) { \ | ||
207 | modsym++; \ | ||
208 | diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c | ||
209 | index 9dafd7af39b8..cb4d6cd949fc 100644 | ||
210 | --- a/arch/powerpc/kernel/machine_kexec.c | ||
211 | +++ b/arch/powerpc/kernel/machine_kexec.c | ||
212 | @@ -113,11 +113,12 @@ void machine_kexec(struct kimage *image) | ||
213 | |||
214 | void __init reserve_crashkernel(void) | ||
215 | { | ||
216 | - unsigned long long crash_size, crash_base; | ||
217 | + unsigned long long crash_size, crash_base, total_mem_sz; | ||
218 | int ret; | ||
219 | |||
220 | + total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size(); | ||
221 | /* use common parsing */ | ||
222 | - ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), | ||
223 | + ret = parse_crashkernel(boot_command_line, total_mem_sz, | ||
224 | &crash_size, &crash_base); | ||
225 | if (ret == 0 && crash_size > 0) { | ||
226 | crashk_res.start = crash_base; | ||
227 | @@ -176,6 +177,7 @@ void __init reserve_crashkernel(void) | ||
228 | /* Crash kernel trumps memory limit */ | ||
229 | if (memory_limit && memory_limit <= crashk_res.end) { | ||
230 | memory_limit = crashk_res.end + 1; | ||
231 | + total_mem_sz = memory_limit; | ||
232 | printk("Adjusted memory limit for crashkernel, now 0x%llx\n", | ||
233 | memory_limit); | ||
234 | } | ||
235 | @@ -184,7 +186,7 @@ void __init reserve_crashkernel(void) | ||
236 | "for crashkernel (System RAM: %ldMB)\n", | ||
237 | (unsigned long)(crash_size >> 20), | ||
238 | (unsigned long)(crashk_res.start >> 20), | ||
239 | - (unsigned long)(memblock_phys_mem_size() >> 20)); | ||
240 | + (unsigned long)(total_mem_sz >> 20)); | ||
241 | |||
242 | if (!memblock_is_region_memory(crashk_res.start, crash_size) || | ||
243 | memblock_reserve(crashk_res.start, crash_size)) { | ||
244 | diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c | ||
245 | index 991c6a517ddc..2456522583c2 100644 | ||
246 | --- a/arch/powerpc/perf/hv-24x7.c | ||
247 | +++ b/arch/powerpc/perf/hv-24x7.c | ||
248 | @@ -1306,16 +1306,6 @@ static void h_24x7_event_read(struct perf_event *event) | ||
249 | h24x7hw = &get_cpu_var(hv_24x7_hw); | ||
250 | h24x7hw->events[i] = event; | ||
251 | put_cpu_var(h24x7hw); | ||
252 | - /* | ||
253 | - * Clear the event count so we can compute the _change_ | ||
254 | - * in the 24x7 raw counter value at the end of the txn. | ||
255 | - * | ||
256 | - * Note that we could alternatively read the 24x7 value | ||
257 | - * now and save its value in event->hw.prev_count. But | ||
258 | - * that would require issuing a hcall, which would then | ||
259 | - * defeat the purpose of using the txn interface. | ||
260 | - */ | ||
261 | - local64_set(&event->count, 0); | ||
262 | } | ||
263 | |||
264 | put_cpu_var(hv_24x7_reqb); | ||
265 | diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c | ||
266 | index b0f34663b1ae..19bae78b1f25 100644 | ||
267 | --- a/arch/powerpc/platforms/ps3/mm.c | ||
268 | +++ b/arch/powerpc/platforms/ps3/mm.c | ||
269 | @@ -212,13 +212,14 @@ void ps3_mm_vas_destroy(void) | ||
270 | { | ||
271 | int result; | ||
272 | |||
273 | - DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id); | ||
274 | - | ||
275 | if (map.vas_id) { | ||
276 | result = lv1_select_virtual_address_space(0); | ||
277 | - BUG_ON(result); | ||
278 | - result = lv1_destruct_virtual_address_space(map.vas_id); | ||
279 | - BUG_ON(result); | ||
280 | + result += lv1_destruct_virtual_address_space(map.vas_id); | ||
281 | + | ||
282 | + if (result) { | ||
283 | + lv1_panic(0); | ||
284 | + } | ||
285 | + | ||
286 | map.vas_id = 0; | ||
287 | } | ||
288 | } | ||
289 | @@ -316,19 +317,20 @@ static void ps3_mm_region_destroy(struct mem_region *r) | ||
290 | int result; | ||
291 | |||
292 | if (!r->destroy) { | ||
293 | - pr_info("%s:%d: Not destroying high region: %llxh %llxh\n", | ||
294 | - __func__, __LINE__, r->base, r->size); | ||
295 | return; | ||
296 | } | ||
297 | |||
298 | - DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base); | ||
299 | - | ||
300 | if (r->base) { | ||
301 | result = lv1_release_memory(r->base); | ||
302 | - BUG_ON(result); | ||
303 | + | ||
304 | + if (result) { | ||
305 | + lv1_panic(0); | ||
306 | + } | ||
307 | + | ||
308 | r->size = r->base = r->offset = 0; | ||
309 | map.total = map.rm.size; | ||
310 | } | ||
311 | + | ||
312 | ps3_mm_set_repository_highmem(NULL); | ||
313 | } | ||
314 | |||
315 | diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c | ||
316 | index 8799d8a83d56..0af19aa1df57 100644 | ||
317 | --- a/arch/powerpc/platforms/pseries/ras.c | ||
318 | +++ b/arch/powerpc/platforms/pseries/ras.c | ||
319 | @@ -311,10 +311,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id) | ||
320 | /* | ||
321 | * Some versions of FWNMI place the buffer inside the 4kB page starting at | ||
322 | * 0x7000. Other versions place it inside the rtas buffer. We check both. | ||
323 | + * Minimum size of the buffer is 16 bytes. | ||
324 | */ | ||
325 | #define VALID_FWNMI_BUFFER(A) \ | ||
326 | - ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ | ||
327 | - (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) | ||
328 | + ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ | ||
329 | + (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16)))) | ||
330 | |||
331 | /* | ||
332 | * Get the error information for errors coming through the | ||
333 | diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h | ||
334 | index 6bc941be6921..166fbd74e316 100644 | ||
335 | --- a/arch/s390/include/asm/syscall.h | ||
336 | +++ b/arch/s390/include/asm/syscall.h | ||
337 | @@ -41,7 +41,17 @@ static inline void syscall_rollback(struct task_struct *task, | ||
338 | static inline long syscall_get_error(struct task_struct *task, | ||
339 | struct pt_regs *regs) | ||
340 | { | ||
341 | - return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0; | ||
342 | + unsigned long error = regs->gprs[2]; | ||
343 | +#ifdef CONFIG_COMPAT | ||
344 | + if (test_tsk_thread_flag(task, TIF_31BIT)) { | ||
345 | + /* | ||
346 | + * Sign-extend the value so (int)-EFOO becomes (long)-EFOO | ||
347 | + * and will match correctly in comparisons. | ||
348 | + */ | ||
349 | + error = (long)(int)error; | ||
350 | + } | ||
351 | +#endif | ||
352 | + return IS_ERR_VALUE(error) ? error : 0; | ||
353 | } | ||
354 | |||
355 | static inline long syscall_get_return_value(struct task_struct *task, | ||
356 | diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c | ||
357 | index fc2974b929c3..ee757d6f585e 100644 | ||
358 | --- a/arch/s390/kernel/ptrace.c | ||
359 | +++ b/arch/s390/kernel/ptrace.c | ||
360 | @@ -308,6 +308,25 @@ static inline void __poke_user_per(struct task_struct *child, | ||
361 | child->thread.per_user.end = data; | ||
362 | } | ||
363 | |||
364 | +static void fixup_int_code(struct task_struct *child, addr_t data) | ||
365 | +{ | ||
366 | + struct pt_regs *regs = task_pt_regs(child); | ||
367 | + int ilc = regs->int_code >> 16; | ||
368 | + u16 insn; | ||
369 | + | ||
370 | + if (ilc > 6) | ||
371 | + return; | ||
372 | + | ||
373 | + if (ptrace_access_vm(child, regs->psw.addr - (regs->int_code >> 16), | ||
374 | + &insn, sizeof(insn), FOLL_FORCE) != sizeof(insn)) | ||
375 | + return; | ||
376 | + | ||
377 | + /* double check that tracee stopped on svc instruction */ | ||
378 | + if ((insn >> 8) != 0xa) | ||
379 | + return; | ||
380 | + | ||
381 | + regs->int_code = 0x20000 | (data & 0xffff); | ||
382 | +} | ||
383 | /* | ||
384 | * Write a word to the user area of a process at location addr. This | ||
385 | * operation does have an additional problem compared to peek_user. | ||
386 | @@ -319,7 +338,9 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | ||
387 | struct user *dummy = NULL; | ||
388 | addr_t offset; | ||
389 | |||
390 | + | ||
391 | if (addr < (addr_t) &dummy->regs.acrs) { | ||
392 | + struct pt_regs *regs = task_pt_regs(child); | ||
393 | /* | ||
394 | * psw and gprs are stored on the stack | ||
395 | */ | ||
396 | @@ -337,7 +358,11 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | ||
397 | /* Invalid addressing mode bits */ | ||
398 | return -EINVAL; | ||
399 | } | ||
400 | - *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; | ||
401 | + | ||
402 | + if (test_pt_regs_flag(regs, PIF_SYSCALL) && | ||
403 | + addr == offsetof(struct user, regs.gprs[2])) | ||
404 | + fixup_int_code(child, data); | ||
405 | + *(addr_t *)((addr_t) ®s->psw + addr) = data; | ||
406 | |||
407 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { | ||
408 | /* | ||
409 | @@ -703,6 +728,10 @@ static int __poke_user_compat(struct task_struct *child, | ||
410 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | | ||
411 | (__u64)(tmp & PSW32_ADDR_AMODE); | ||
412 | } else { | ||
413 | + | ||
414 | + if (test_pt_regs_flag(regs, PIF_SYSCALL) && | ||
415 | + addr == offsetof(struct compat_user, regs.gprs[2])) | ||
416 | + fixup_int_code(child, data); | ||
417 | /* gpr 0-15 */ | ||
418 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; | ||
419 | } | ||
420 | diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c | ||
421 | index 396dbdea0cfa..2f4316c14266 100644 | ||
422 | --- a/arch/sparc/kernel/ptrace_32.c | ||
423 | +++ b/arch/sparc/kernel/ptrace_32.c | ||
424 | @@ -167,12 +167,17 @@ static int genregs32_set(struct task_struct *target, | ||
425 | if (ret || !count) | ||
426 | return ret; | ||
427 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
428 | - ®s->y, | ||
429 | + ®s->npc, | ||
430 | 34 * sizeof(u32), 35 * sizeof(u32)); | ||
431 | if (ret || !count) | ||
432 | return ret; | ||
433 | + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
434 | + ®s->y, | ||
435 | + 35 * sizeof(u32), 36 * sizeof(u32)); | ||
436 | + if (ret || !count) | ||
437 | + return ret; | ||
438 | return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, | ||
439 | - 35 * sizeof(u32), 38 * sizeof(u32)); | ||
440 | + 36 * sizeof(u32), 38 * sizeof(u32)); | ||
441 | } | ||
442 | |||
443 | static int fpregs32_get(struct task_struct *target, | ||
444 | diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile | ||
445 | index 3b16935b22bc..d1df7d2e31b1 100644 | ||
446 | --- a/arch/x86/boot/Makefile | ||
447 | +++ b/arch/x86/boot/Makefile | ||
448 | @@ -87,7 +87,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE | ||
449 | |||
450 | SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) | ||
451 | |||
452 | -sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' | ||
453 | +sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' | ||
454 | |||
455 | quiet_cmd_zoffset = ZOFFSET $@ | ||
456 | cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ | ||
457 | diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c | ||
458 | index dcd6df5943d6..86aec286e4f2 100644 | ||
459 | --- a/arch/x86/kernel/kprobes/core.c | ||
460 | +++ b/arch/x86/kernel/kprobes/core.c | ||
461 | @@ -754,6 +754,13 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) | ||
462 | void *frame_pointer; | ||
463 | bool skipped = false; | ||
464 | |||
465 | + /* | ||
466 | + * Set a dummy kprobe for avoiding kretprobe recursion. | ||
467 | + * Since kretprobe never run in kprobe handler, kprobe must not | ||
468 | + * be running at this point. | ||
469 | + */ | ||
470 | + kprobe_busy_begin(); | ||
471 | + | ||
472 | INIT_HLIST_HEAD(&empty_rp); | ||
473 | kretprobe_hash_lock(current, &head, &flags); | ||
474 | /* fixup registers */ | ||
475 | @@ -829,10 +836,9 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) | ||
476 | orig_ret_address = (unsigned long)ri->ret_addr; | ||
477 | if (ri->rp && ri->rp->handler) { | ||
478 | __this_cpu_write(current_kprobe, &ri->rp->kp); | ||
479 | - get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE; | ||
480 | ri->ret_addr = correct_ret_addr; | ||
481 | ri->rp->handler(ri, regs); | ||
482 | - __this_cpu_write(current_kprobe, NULL); | ||
483 | + __this_cpu_write(current_kprobe, &kprobe_busy); | ||
484 | } | ||
485 | |||
486 | recycle_rp_inst(ri, &empty_rp); | ||
487 | @@ -848,6 +854,8 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) | ||
488 | |||
489 | kretprobe_hash_unlock(current, &flags); | ||
490 | |||
491 | + kprobe_busy_end(); | ||
492 | + | ||
493 | hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { | ||
494 | hlist_del(&ri->hlist); | ||
495 | kfree(ri); | ||
496 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c | ||
497 | index 0f66f7dd8938..6b7faa14c27b 100644 | ||
498 | --- a/arch/x86/kvm/x86.c | ||
499 | +++ b/arch/x86/kvm/x86.c | ||
500 | @@ -2304,7 +2304,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | ||
501 | return kvm_mtrr_set_msr(vcpu, msr, data); | ||
502 | case MSR_IA32_APICBASE: | ||
503 | return kvm_set_apic_base(vcpu, msr_info); | ||
504 | - case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff: | ||
505 | + case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff: | ||
506 | return kvm_x2apic_msr_write(vcpu, msr, data); | ||
507 | case MSR_IA32_TSCDEADLINE: | ||
508 | kvm_set_lapic_tscdeadline_msr(vcpu, data); | ||
509 | @@ -2576,7 +2576,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | ||
510 | case MSR_IA32_APICBASE: | ||
511 | msr_info->data = kvm_get_apic_base(vcpu); | ||
512 | break; | ||
513 | - case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff: | ||
514 | + case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff: | ||
515 | return kvm_x2apic_msr_read(vcpu, msr_info->index, &msr_info->data); | ||
516 | break; | ||
517 | case MSR_IA32_TSCDEADLINE: | ||
518 | diff --git a/crypto/algboss.c b/crypto/algboss.c | ||
519 | index 6e39d9c05b98..5cbc588555ca 100644 | ||
520 | --- a/crypto/algboss.c | ||
521 | +++ b/crypto/algboss.c | ||
522 | @@ -194,8 +194,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) | ||
523 | if (IS_ERR(thread)) | ||
524 | goto err_put_larval; | ||
525 | |||
526 | - wait_for_completion_interruptible(&larval->completion); | ||
527 | - | ||
528 | return NOTIFY_STOP; | ||
529 | |||
530 | err_put_larval: | ||
531 | diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c | ||
532 | index 7502441b1400..764786cfb0d9 100644 | ||
533 | --- a/drivers/acpi/sysfs.c | ||
534 | +++ b/drivers/acpi/sysfs.c | ||
535 | @@ -843,13 +843,13 @@ static void __exit interrupt_stats_exit(void) | ||
536 | } | ||
537 | |||
538 | static ssize_t | ||
539 | -acpi_show_profile(struct device *dev, struct device_attribute *attr, | ||
540 | +acpi_show_profile(struct kobject *kobj, struct kobj_attribute *attr, | ||
541 | char *buf) | ||
542 | { | ||
543 | return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile); | ||
544 | } | ||
545 | |||
546 | -static const struct device_attribute pm_profile_attr = | ||
547 | +static const struct kobj_attribute pm_profile_attr = | ||
548 | __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL); | ||
549 | |||
550 | static ssize_t hotplug_enabled_show(struct kobject *kobj, | ||
551 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
552 | index ba0cffbd0bb6..46bf7e9d00ab 100644 | ||
553 | --- a/drivers/ata/libata-core.c | ||
554 | +++ b/drivers/ata/libata-core.c | ||
555 | @@ -57,7 +57,6 @@ | ||
556 | #include <linux/workqueue.h> | ||
557 | #include <linux/scatterlist.h> | ||
558 | #include <linux/io.h> | ||
559 | -#include <linux/async.h> | ||
560 | #include <linux/log2.h> | ||
561 | #include <linux/slab.h> | ||
562 | #include <linux/glob.h> | ||
563 | @@ -6410,7 +6409,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | ||
564 | /* perform each probe asynchronously */ | ||
565 | for (i = 0; i < host->n_ports; i++) { | ||
566 | struct ata_port *ap = host->ports[i]; | ||
567 | - async_schedule(async_port_probe, ap); | ||
568 | + ap->cookie = async_schedule(async_port_probe, ap); | ||
569 | } | ||
570 | |||
571 | return 0; | ||
572 | @@ -6550,11 +6549,11 @@ void ata_host_detach(struct ata_host *host) | ||
573 | { | ||
574 | int i; | ||
575 | |||
576 | - /* Ensure ata_port probe has completed */ | ||
577 | - async_synchronize_full(); | ||
578 | - | ||
579 | - for (i = 0; i < host->n_ports; i++) | ||
580 | + for (i = 0; i < host->n_ports; i++) { | ||
581 | + /* Ensure ata_port probe has completed */ | ||
582 | + async_synchronize_cookie(host->ports[i]->cookie + 1); | ||
583 | ata_port_detach(host->ports[i]); | ||
584 | + } | ||
585 | |||
586 | /* the host is dead now, dissociate ACPI */ | ||
587 | ata_acpi_dissociate(host); | ||
588 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c | ||
589 | index c4f2b563c9f0..f4b38adb9d8a 100644 | ||
590 | --- a/drivers/ata/libata-scsi.c | ||
591 | +++ b/drivers/ata/libata-scsi.c | ||
592 | @@ -3967,12 +3967,13 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) | ||
593 | { | ||
594 | struct scsi_cmnd *scmd = qc->scsicmd; | ||
595 | const u8 *cdb = scmd->cmnd; | ||
596 | - const u8 *p; | ||
597 | u8 pg, spg; | ||
598 | unsigned six_byte, pg_len, hdr_len, bd_len; | ||
599 | int len; | ||
600 | u16 fp = (u16)-1; | ||
601 | u8 bp = 0xff; | ||
602 | + u8 buffer[64]; | ||
603 | + const u8 *p = buffer; | ||
604 | |||
605 | VPRINTK("ENTER\n"); | ||
606 | |||
607 | @@ -4006,12 +4007,14 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) | ||
608 | if (!scsi_sg_count(scmd) || scsi_sglist(scmd)->length < len) | ||
609 | goto invalid_param_len; | ||
610 | |||
611 | - p = page_address(sg_page(scsi_sglist(scmd))); | ||
612 | - | ||
613 | /* Move past header and block descriptors. */ | ||
614 | if (len < hdr_len) | ||
615 | goto invalid_param_len; | ||
616 | |||
617 | + if (!sg_copy_to_buffer(scsi_sglist(scmd), scsi_sg_count(scmd), | ||
618 | + buffer, sizeof(buffer))) | ||
619 | + goto invalid_param_len; | ||
620 | + | ||
621 | if (six_byte) | ||
622 | bd_len = p[3]; | ||
623 | else | ||
624 | diff --git a/drivers/base/platform.c b/drivers/base/platform.c | ||
625 | index bef299ef6227..ec2e4b6bc56f 100644 | ||
626 | --- a/drivers/base/platform.c | ||
627 | +++ b/drivers/base/platform.c | ||
628 | @@ -692,6 +692,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, | ||
629 | /* temporary section violation during probe() */ | ||
630 | drv->probe = probe; | ||
631 | retval = code = __platform_driver_register(drv, module); | ||
632 | + if (retval) | ||
633 | + return retval; | ||
634 | |||
635 | /* | ||
636 | * Fixup that section violation, being paranoid about code scanning | ||
637 | diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c | ||
638 | index 76f33c84ce3d..7ec5e8f0cbe5 100644 | ||
639 | --- a/drivers/block/ps3disk.c | ||
640 | +++ b/drivers/block/ps3disk.c | ||
641 | @@ -464,7 +464,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev) | ||
642 | blk_queue_bounce_limit(queue, BLK_BOUNCE_HIGH); | ||
643 | |||
644 | blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9); | ||
645 | - blk_queue_segment_boundary(queue, -1UL); | ||
646 | blk_queue_dma_alignment(queue, dev->blk_size-1); | ||
647 | blk_queue_logical_block_size(queue, dev->blk_size); | ||
648 | |||
649 | diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c | ||
650 | index 73aab6e984cd..2b5075298cdc 100644 | ||
651 | --- a/drivers/clk/bcm/clk-bcm2835.c | ||
652 | +++ b/drivers/clk/bcm/clk-bcm2835.c | ||
653 | @@ -1295,13 +1295,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, | ||
654 | return &clock->hw; | ||
655 | } | ||
656 | |||
657 | -static struct clk *bcm2835_register_gate(struct bcm2835_cprman *cprman, | ||
658 | +static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman, | ||
659 | const struct bcm2835_gate_data *data) | ||
660 | { | ||
661 | - return clk_register_gate(cprman->dev, data->name, data->parent, | ||
662 | - CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, | ||
663 | - cprman->regs + data->ctl_reg, | ||
664 | - CM_GATE_BIT, 0, &cprman->regs_lock); | ||
665 | + return clk_hw_register_gate(cprman->dev, data->name, data->parent, | ||
666 | + CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, | ||
667 | + cprman->regs + data->ctl_reg, | ||
668 | + CM_GATE_BIT, 0, &cprman->regs_lock); | ||
669 | } | ||
670 | |||
671 | typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman, | ||
672 | diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c | ||
673 | index 8dd71345b5d0..55430c8f1bc2 100644 | ||
674 | --- a/drivers/clk/qcom/gcc-msm8916.c | ||
675 | +++ b/drivers/clk/qcom/gcc-msm8916.c | ||
676 | @@ -270,7 +270,7 @@ static struct clk_pll gpll0 = { | ||
677 | .l_reg = 0x21004, | ||
678 | .m_reg = 0x21008, | ||
679 | .n_reg = 0x2100c, | ||
680 | - .config_reg = 0x21014, | ||
681 | + .config_reg = 0x21010, | ||
682 | .mode_reg = 0x21000, | ||
683 | .status_reg = 0x2101c, | ||
684 | .status_bit = 17, | ||
685 | @@ -297,7 +297,7 @@ static struct clk_pll gpll1 = { | ||
686 | .l_reg = 0x20004, | ||
687 | .m_reg = 0x20008, | ||
688 | .n_reg = 0x2000c, | ||
689 | - .config_reg = 0x20014, | ||
690 | + .config_reg = 0x20010, | ||
691 | .mode_reg = 0x20000, | ||
692 | .status_reg = 0x2001c, | ||
693 | .status_bit = 17, | ||
694 | @@ -324,7 +324,7 @@ static struct clk_pll gpll2 = { | ||
695 | .l_reg = 0x4a004, | ||
696 | .m_reg = 0x4a008, | ||
697 | .n_reg = 0x4a00c, | ||
698 | - .config_reg = 0x4a014, | ||
699 | + .config_reg = 0x4a010, | ||
700 | .mode_reg = 0x4a000, | ||
701 | .status_reg = 0x4a01c, | ||
702 | .status_bit = 17, | ||
703 | @@ -351,7 +351,7 @@ static struct clk_pll bimc_pll = { | ||
704 | .l_reg = 0x23004, | ||
705 | .m_reg = 0x23008, | ||
706 | .n_reg = 0x2300c, | ||
707 | - .config_reg = 0x23014, | ||
708 | + .config_reg = 0x23010, | ||
709 | .mode_reg = 0x23000, | ||
710 | .status_reg = 0x2301c, | ||
711 | .status_bit = 17, | ||
712 | diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c | ||
713 | index 09cdd35dc434..a082b026791a 100644 | ||
714 | --- a/drivers/clk/samsung/clk-exynos5433.c | ||
715 | +++ b/drivers/clk/samsung/clk-exynos5433.c | ||
716 | @@ -1672,7 +1672,8 @@ static const struct samsung_gate_clock peric_gate_clks[] __initconst = { | ||
717 | GATE(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_pcm1_peric", | ||
718 | ENABLE_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0), | ||
719 | GATE(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_i2s1_peric", | ||
720 | - ENABLE_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0), | ||
721 | + ENABLE_SCLK_PERIC, 6, | ||
722 | + CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0), | ||
723 | GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC, | ||
724 | 5, CLK_SET_RATE_PARENT, 0), | ||
725 | GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC, | ||
726 | diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c | ||
727 | index a485f3b284b9..033e6062599d 100644 | ||
728 | --- a/drivers/clk/st/clk-flexgen.c | ||
729 | +++ b/drivers/clk/st/clk-flexgen.c | ||
730 | @@ -371,6 +371,7 @@ static void __init st_of_flexgen_setup(struct device_node *np) | ||
731 | break; | ||
732 | } | ||
733 | |||
734 | + flex_flags &= ~CLK_IS_CRITICAL; | ||
735 | of_clk_detect_critical(np, i, &flex_flags); | ||
736 | |||
737 | /* | ||
738 | diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c | ||
739 | index f2c9274b8bd5..369164f0bd0e 100644 | ||
740 | --- a/drivers/clk/sunxi/clk-sunxi.c | ||
741 | +++ b/drivers/clk/sunxi/clk-sunxi.c | ||
742 | @@ -98,7 +98,7 @@ static void sun6i_a31_get_pll1_factors(struct factors_request *req) | ||
743 | * Round down the frequency to the closest multiple of either | ||
744 | * 6 or 16 | ||
745 | */ | ||
746 | - u32 round_freq_6 = round_down(freq_mhz, 6); | ||
747 | + u32 round_freq_6 = rounddown(freq_mhz, 6); | ||
748 | u32 round_freq_16 = round_down(freq_mhz, 16); | ||
749 | |||
750 | if (round_freq_6 > round_freq_16) | ||
751 | diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c | ||
752 | index 1cf70f452e1e..3725b2e0c788 100644 | ||
753 | --- a/drivers/clk/ti/composite.c | ||
754 | +++ b/drivers/clk/ti/composite.c | ||
755 | @@ -226,6 +226,7 @@ cleanup: | ||
756 | if (!cclk->comp_clks[i]) | ||
757 | continue; | ||
758 | list_del(&cclk->comp_clks[i]->link); | ||
759 | + kfree(cclk->comp_clks[i]->parent_names); | ||
760 | kfree(cclk->comp_clks[i]); | ||
761 | } | ||
762 | |||
763 | diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c | ||
764 | index ff6ac4e824b5..e7ca922a45e1 100644 | ||
765 | --- a/drivers/crypto/omap-sham.c | ||
766 | +++ b/drivers/crypto/omap-sham.c | ||
767 | @@ -167,8 +167,6 @@ struct omap_sham_hmac_ctx { | ||
768 | }; | ||
769 | |||
770 | struct omap_sham_ctx { | ||
771 | - struct omap_sham_dev *dd; | ||
772 | - | ||
773 | unsigned long flags; | ||
774 | |||
775 | /* fallback stuff */ | ||
776 | @@ -915,27 +913,35 @@ static int omap_sham_update_dma_stop(struct omap_sham_dev *dd) | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | +struct omap_sham_dev *omap_sham_find_dev(struct omap_sham_reqctx *ctx) | ||
781 | +{ | ||
782 | + struct omap_sham_dev *dd; | ||
783 | + | ||
784 | + if (ctx->dd) | ||
785 | + return ctx->dd; | ||
786 | + | ||
787 | + spin_lock_bh(&sham.lock); | ||
788 | + dd = list_first_entry(&sham.dev_list, struct omap_sham_dev, list); | ||
789 | + list_move_tail(&dd->list, &sham.dev_list); | ||
790 | + ctx->dd = dd; | ||
791 | + spin_unlock_bh(&sham.lock); | ||
792 | + | ||
793 | + return dd; | ||
794 | +} | ||
795 | + | ||
796 | static int omap_sham_init(struct ahash_request *req) | ||
797 | { | ||
798 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); | ||
799 | struct omap_sham_ctx *tctx = crypto_ahash_ctx(tfm); | ||
800 | struct omap_sham_reqctx *ctx = ahash_request_ctx(req); | ||
801 | - struct omap_sham_dev *dd = NULL, *tmp; | ||
802 | + struct omap_sham_dev *dd; | ||
803 | int bs = 0; | ||
804 | |||
805 | - spin_lock_bh(&sham.lock); | ||
806 | - if (!tctx->dd) { | ||
807 | - list_for_each_entry(tmp, &sham.dev_list, list) { | ||
808 | - dd = tmp; | ||
809 | - break; | ||
810 | - } | ||
811 | - tctx->dd = dd; | ||
812 | - } else { | ||
813 | - dd = tctx->dd; | ||
814 | - } | ||
815 | - spin_unlock_bh(&sham.lock); | ||
816 | + ctx->dd = NULL; | ||
817 | |||
818 | - ctx->dd = dd; | ||
819 | + dd = omap_sham_find_dev(ctx); | ||
820 | + if (!dd) | ||
821 | + return -ENODEV; | ||
822 | |||
823 | ctx->flags = 0; | ||
824 | |||
825 | @@ -1185,8 +1191,7 @@ err1: | ||
826 | static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) | ||
827 | { | ||
828 | struct omap_sham_reqctx *ctx = ahash_request_ctx(req); | ||
829 | - struct omap_sham_ctx *tctx = crypto_tfm_ctx(req->base.tfm); | ||
830 | - struct omap_sham_dev *dd = tctx->dd; | ||
831 | + struct omap_sham_dev *dd = ctx->dd; | ||
832 | |||
833 | ctx->op = op; | ||
834 | |||
835 | @@ -1196,7 +1201,7 @@ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) | ||
836 | static int omap_sham_update(struct ahash_request *req) | ||
837 | { | ||
838 | struct omap_sham_reqctx *ctx = ahash_request_ctx(req); | ||
839 | - struct omap_sham_dev *dd = ctx->dd; | ||
840 | + struct omap_sham_dev *dd = omap_sham_find_dev(ctx); | ||
841 | |||
842 | if (!req->nbytes) | ||
843 | return 0; | ||
844 | @@ -1301,21 +1306,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, | ||
845 | struct omap_sham_hmac_ctx *bctx = tctx->base; | ||
846 | int bs = crypto_shash_blocksize(bctx->shash); | ||
847 | int ds = crypto_shash_digestsize(bctx->shash); | ||
848 | - struct omap_sham_dev *dd = NULL, *tmp; | ||
849 | int err, i; | ||
850 | |||
851 | - spin_lock_bh(&sham.lock); | ||
852 | - if (!tctx->dd) { | ||
853 | - list_for_each_entry(tmp, &sham.dev_list, list) { | ||
854 | - dd = tmp; | ||
855 | - break; | ||
856 | - } | ||
857 | - tctx->dd = dd; | ||
858 | - } else { | ||
859 | - dd = tctx->dd; | ||
860 | - } | ||
861 | - spin_unlock_bh(&sham.lock); | ||
862 | - | ||
863 | err = crypto_shash_setkey(tctx->fallback, key, keylen); | ||
864 | if (err) | ||
865 | return err; | ||
866 | @@ -1333,7 +1325,7 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, | ||
867 | |||
868 | memset(bctx->ipad + keylen, 0, bs - keylen); | ||
869 | |||
870 | - if (!test_bit(FLAGS_AUTO_XOR, &dd->flags)) { | ||
871 | + if (!test_bit(FLAGS_AUTO_XOR, &sham.flags)) { | ||
872 | memcpy(bctx->opad, bctx->ipad, bs); | ||
873 | |||
874 | for (i = 0; i < bs; i++) { | ||
875 | @@ -2072,6 +2064,7 @@ static int omap_sham_probe(struct platform_device *pdev) | ||
876 | } | ||
877 | |||
878 | dd->flags |= dd->pdata->flags; | ||
879 | + sham.flags |= dd->pdata->flags; | ||
880 | |||
881 | pm_runtime_use_autosuspend(dev); | ||
882 | pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); | ||
883 | @@ -2097,6 +2090,9 @@ static int omap_sham_probe(struct platform_device *pdev) | ||
884 | spin_unlock(&sham.lock); | ||
885 | |||
886 | for (i = 0; i < dd->pdata->algs_info_size; i++) { | ||
887 | + if (dd->pdata->algs_info[i].registered) | ||
888 | + break; | ||
889 | + | ||
890 | for (j = 0; j < dd->pdata->algs_info[i].size; j++) { | ||
891 | struct ahash_alg *alg; | ||
892 | |||
893 | @@ -2142,9 +2138,11 @@ static int omap_sham_remove(struct platform_device *pdev) | ||
894 | list_del(&dd->list); | ||
895 | spin_unlock(&sham.lock); | ||
896 | for (i = dd->pdata->algs_info_size - 1; i >= 0; i--) | ||
897 | - for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) | ||
898 | + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) { | ||
899 | crypto_unregister_ahash( | ||
900 | &dd->pdata->algs_info[i].algs_list[j]); | ||
901 | + dd->pdata->algs_info[i].registered--; | ||
902 | + } | ||
903 | tasklet_kill(&dd->done_task); | ||
904 | pm_runtime_disable(&pdev->dev); | ||
905 | |||
906 | diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c | ||
907 | index bc538708c753..cdee6d6d5453 100644 | ||
908 | --- a/drivers/extcon/extcon-adc-jack.c | ||
909 | +++ b/drivers/extcon/extcon-adc-jack.c | ||
910 | @@ -128,7 +128,7 @@ static int adc_jack_probe(struct platform_device *pdev) | ||
911 | for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); | ||
912 | data->num_conditions = i; | ||
913 | |||
914 | - data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); | ||
915 | + data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); | ||
916 | if (IS_ERR(data->chan)) | ||
917 | return PTR_ERR(data->chan); | ||
918 | |||
919 | @@ -170,7 +170,6 @@ static int adc_jack_remove(struct platform_device *pdev) | ||
920 | |||
921 | free_irq(data->irq, data); | ||
922 | cancel_work_sync(&data->handler.work); | ||
923 | - iio_channel_release(data->chan); | ||
924 | |||
925 | return 0; | ||
926 | } | ||
927 | diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c | ||
928 | index 241dd7c63d2c..481b2f0a190b 100644 | ||
929 | --- a/drivers/firmware/efi/esrt.c | ||
930 | +++ b/drivers/firmware/efi/esrt.c | ||
931 | @@ -180,7 +180,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num) | ||
932 | rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL, | ||
933 | "entry%d", entry_num); | ||
934 | if (rc) { | ||
935 | - kfree(entry); | ||
936 | + kobject_put(&entry->kobj); | ||
937 | return rc; | ||
938 | } | ||
939 | } | ||
940 | diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c | ||
941 | index 41e67e983a7f..bb70c5272fe8 100644 | ||
942 | --- a/drivers/gpu/drm/drm_dp_mst_topology.c | ||
943 | +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | ||
944 | @@ -29,6 +29,7 @@ | ||
945 | #include <linux/i2c.h> | ||
946 | #include <drm/drm_dp_mst_helper.h> | ||
947 | #include <drm/drmP.h> | ||
948 | +#include <linux/iopoll.h> | ||
949 | |||
950 | #include <drm/drm_fixed.h> | ||
951 | |||
952 | @@ -2673,6 +2674,17 @@ fail: | ||
953 | return ret; | ||
954 | } | ||
955 | |||
956 | +static int do_get_act_status(struct drm_dp_aux *aux) | ||
957 | +{ | ||
958 | + int ret; | ||
959 | + u8 status; | ||
960 | + | ||
961 | + ret = drm_dp_dpcd_readb(aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); | ||
962 | + if (ret < 0) | ||
963 | + return ret; | ||
964 | + | ||
965 | + return status; | ||
966 | +} | ||
967 | |||
968 | /** | ||
969 | * drm_dp_check_act_status() - Check ACT handled status. | ||
970 | @@ -2682,33 +2694,29 @@ fail: | ||
971 | */ | ||
972 | int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr) | ||
973 | { | ||
974 | - u8 status; | ||
975 | - int ret; | ||
976 | - int count = 0; | ||
977 | - | ||
978 | - do { | ||
979 | - ret = drm_dp_dpcd_readb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); | ||
980 | - | ||
981 | - if (ret < 0) { | ||
982 | - DRM_DEBUG_KMS("failed to read payload table status %d\n", ret); | ||
983 | - goto fail; | ||
984 | - } | ||
985 | - | ||
986 | - if (status & DP_PAYLOAD_ACT_HANDLED) | ||
987 | - break; | ||
988 | - count++; | ||
989 | - udelay(100); | ||
990 | - | ||
991 | - } while (count < 30); | ||
992 | - | ||
993 | - if (!(status & DP_PAYLOAD_ACT_HANDLED)) { | ||
994 | - DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n", status, count); | ||
995 | - ret = -EINVAL; | ||
996 | - goto fail; | ||
997 | + /* | ||
998 | + * There doesn't seem to be any recommended retry count or timeout in | ||
999 | + * the MST specification. Since some hubs have been observed to take | ||
1000 | + * over 1 second to update their payload allocations under certain | ||
1001 | + * conditions, we use a rather large timeout value. | ||
1002 | + */ | ||
1003 | + const int timeout_ms = 3000; | ||
1004 | + int ret, status; | ||
1005 | + | ||
1006 | + ret = readx_poll_timeout(do_get_act_status, mgr->aux, status, | ||
1007 | + status & DP_PAYLOAD_ACT_HANDLED || status < 0, | ||
1008 | + 200, timeout_ms * USEC_PER_MSEC); | ||
1009 | + if (ret < 0 && status >= 0) { | ||
1010 | + DRM_DEBUG_KMS("Failed to get ACT after %dms, last status: %02x\n", | ||
1011 | + timeout_ms, status); | ||
1012 | + return -EINVAL; | ||
1013 | + } else if (status < 0) { | ||
1014 | + DRM_DEBUG_KMS("Failed to read payload table status: %d\n", | ||
1015 | + status); | ||
1016 | + return status; | ||
1017 | } | ||
1018 | + | ||
1019 | return 0; | ||
1020 | -fail: | ||
1021 | - return ret; | ||
1022 | } | ||
1023 | EXPORT_SYMBOL(drm_dp_check_act_status); | ||
1024 | |||
1025 | diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c | ||
1026 | index 4484785cd9ac..95d5a5949753 100644 | ||
1027 | --- a/drivers/gpu/drm/drm_encoder_slave.c | ||
1028 | +++ b/drivers/gpu/drm/drm_encoder_slave.c | ||
1029 | @@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, | ||
1030 | |||
1031 | err = encoder_drv->encoder_init(client, dev, encoder); | ||
1032 | if (err) | ||
1033 | - goto fail_unregister; | ||
1034 | + goto fail_module_put; | ||
1035 | |||
1036 | if (info->platform_data) | ||
1037 | encoder->slave_funcs->set_config(&encoder->base, | ||
1038 | @@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev, | ||
1039 | |||
1040 | return 0; | ||
1041 | |||
1042 | +fail_module_put: | ||
1043 | + module_put(module); | ||
1044 | fail_unregister: | ||
1045 | i2c_unregister_device(client); | ||
1046 | - module_put(module); | ||
1047 | fail: | ||
1048 | return err; | ||
1049 | } | ||
1050 | diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c | ||
1051 | index 1e104518192d..8a98442d494b 100644 | ||
1052 | --- a/drivers/gpu/drm/i915/i915_cmd_parser.c | ||
1053 | +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c | ||
1054 | @@ -570,6 +570,9 @@ struct drm_i915_reg_descriptor { | ||
1055 | #define REG32(_reg, ...) \ | ||
1056 | { .addr = (_reg), __VA_ARGS__ } | ||
1057 | |||
1058 | +#define REG32_IDX(_reg, idx) \ | ||
1059 | + { .addr = _reg(idx) } | ||
1060 | + | ||
1061 | /* | ||
1062 | * Convenience macro for adding 64-bit registers. | ||
1063 | * | ||
1064 | @@ -667,6 +670,7 @@ static const struct drm_i915_reg_descriptor gen9_blt_regs[] = { | ||
1065 | REG64_IDX(RING_TIMESTAMP, BSD_RING_BASE), | ||
1066 | REG32(BCS_SWCTRL), | ||
1067 | REG64_IDX(RING_TIMESTAMP, BLT_RING_BASE), | ||
1068 | + REG32_IDX(RING_CTX_TIMESTAMP, BLT_RING_BASE), | ||
1069 | REG64_IDX(BCS_GPR, 0), | ||
1070 | REG64_IDX(BCS_GPR, 1), | ||
1071 | REG64_IDX(BCS_GPR, 2), | ||
1072 | diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | ||
1073 | index ed7143d35b25..6224aca7cd29 100644 | ||
1074 | --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | ||
1075 | +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | ||
1076 | @@ -769,7 +769,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) | ||
1077 | |||
1078 | return 0; | ||
1079 | fail: | ||
1080 | - mdp5_destroy(pdev); | ||
1081 | + if (mdp5_kms) | ||
1082 | + mdp5_destroy(pdev); | ||
1083 | return ret; | ||
1084 | } | ||
1085 | |||
1086 | diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c | ||
1087 | index e642242728c0..a886652ed895 100644 | ||
1088 | --- a/drivers/gpu/drm/qxl/qxl_kms.c | ||
1089 | +++ b/drivers/gpu/drm/qxl/qxl_kms.c | ||
1090 | @@ -199,7 +199,7 @@ static int qxl_device_init(struct qxl_device *qdev, | ||
1091 | &(qdev->ram_header->cursor_ring_hdr), | ||
1092 | sizeof(struct qxl_command), | ||
1093 | QXL_CURSOR_RING_SIZE, | ||
1094 | - qdev->io_base + QXL_IO_NOTIFY_CMD, | ||
1095 | + qdev->io_base + QXL_IO_NOTIFY_CURSOR, | ||
1096 | false, | ||
1097 | &qdev->cursor_event); | ||
1098 | |||
1099 | diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c | ||
1100 | index 4a601f990562..a32cf6dbd3ee 100644 | ||
1101 | --- a/drivers/gpu/drm/radeon/ni_dpm.c | ||
1102 | +++ b/drivers/gpu/drm/radeon/ni_dpm.c | ||
1103 | @@ -2126,7 +2126,7 @@ static int ni_init_smc_spll_table(struct radeon_device *rdev) | ||
1104 | if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT)) | ||
1105 | ret = -EINVAL; | ||
1106 | |||
1107 | - if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT)) | ||
1108 | + if (fb_div & ~(SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT)) | ||
1109 | ret = -EINVAL; | ||
1110 | |||
1111 | if (clk_v & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT)) | ||
1112 | diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c | ||
1113 | index 62785aa76b3f..8324d2729088 100644 | ||
1114 | --- a/drivers/i2c/busses/i2c-piix4.c | ||
1115 | +++ b/drivers/i2c/busses/i2c-piix4.c | ||
1116 | @@ -840,7 +840,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
1117 | } | ||
1118 | |||
1119 | if (dev->vendor == PCI_VENDOR_ID_AMD && | ||
1120 | - dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) { | ||
1121 | + (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS || | ||
1122 | + dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) { | ||
1123 | retval = piix4_setup_sb800(dev, id, 1); | ||
1124 | } | ||
1125 | |||
1126 | diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c | ||
1127 | index e28b825b0433..fb191ad8fc3a 100644 | ||
1128 | --- a/drivers/i2c/busses/i2c-pxa.c | ||
1129 | +++ b/drivers/i2c/busses/i2c-pxa.c | ||
1130 | @@ -297,11 +297,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) | ||
1131 | dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n", | ||
1132 | readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)), | ||
1133 | readl(_ISR(i2c))); | ||
1134 | - dev_dbg(dev, "log: "); | ||
1135 | + dev_err(dev, "log:"); | ||
1136 | for (i = 0; i < i2c->irqlogidx; i++) | ||
1137 | - pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]); | ||
1138 | - | ||
1139 | - pr_debug("\n"); | ||
1140 | + pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]); | ||
1141 | + pr_cont("\n"); | ||
1142 | } | ||
1143 | |||
1144 | #else /* ifdef DEBUG */ | ||
1145 | @@ -691,11 +690,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) | ||
1146 | { | ||
1147 | u32 icr; | ||
1148 | |||
1149 | - /* | ||
1150 | - * Clear the STOP and ACK flags | ||
1151 | - */ | ||
1152 | + /* Clear the START, STOP, ACK, TB and MA flags */ | ||
1153 | icr = readl(_ICR(i2c)); | ||
1154 | - icr &= ~(ICR_STOP | ICR_ACKNAK); | ||
1155 | + icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA); | ||
1156 | writel(icr, _ICR(i2c)); | ||
1157 | } | ||
1158 | |||
1159 | diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c | ||
1160 | index c9263acc190b..85b90b5939db 100644 | ||
1161 | --- a/drivers/iio/pressure/bmp280-core.c | ||
1162 | +++ b/drivers/iio/pressure/bmp280-core.c | ||
1163 | @@ -182,6 +182,8 @@ static u32 bmp280_compensate_humidity(struct bmp280_data *data, | ||
1164 | + (s32)2097152) * H2 + 8192) >> 14); | ||
1165 | var -= ((((var >> 15) * (var >> 15)) >> 7) * (s32)H1) >> 4; | ||
1166 | |||
1167 | + var = clamp_val(var, 0, 419430400); | ||
1168 | + | ||
1169 | return var >> 12; | ||
1170 | }; | ||
1171 | |||
1172 | @@ -630,7 +632,7 @@ static int bmp180_measure(struct bmp280_data *data, u8 ctrl_meas) | ||
1173 | unsigned int ctrl; | ||
1174 | |||
1175 | if (data->use_eoc) | ||
1176 | - init_completion(&data->done); | ||
1177 | + reinit_completion(&data->done); | ||
1178 | |||
1179 | ret = regmap_write(data->regmap, BMP280_REG_CTRL_MEAS, ctrl_meas); | ||
1180 | if (ret) | ||
1181 | @@ -886,6 +888,9 @@ static int bmp085_fetch_eoc_irq(struct device *dev, | ||
1182 | "trying to enforce it\n"); | ||
1183 | irq_trig = IRQF_TRIGGER_RISING; | ||
1184 | } | ||
1185 | + | ||
1186 | + init_completion(&data->done); | ||
1187 | + | ||
1188 | ret = devm_request_threaded_irq(dev, | ||
1189 | irq, | ||
1190 | bmp085_eoc_irq, | ||
1191 | diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c | ||
1192 | index 41573df1d9fc..692fc42255c9 100644 | ||
1193 | --- a/drivers/infiniband/core/cma_configfs.c | ||
1194 | +++ b/drivers/infiniband/core/cma_configfs.c | ||
1195 | @@ -277,8 +277,21 @@ fail: | ||
1196 | return ERR_PTR(err); | ||
1197 | } | ||
1198 | |||
1199 | +static void drop_cma_dev(struct config_group *cgroup, struct config_item *item) | ||
1200 | +{ | ||
1201 | + struct config_group *group = | ||
1202 | + container_of(item, struct config_group, cg_item); | ||
1203 | + struct cma_dev_group *cma_dev_group = | ||
1204 | + container_of(group, struct cma_dev_group, device_group); | ||
1205 | + | ||
1206 | + configfs_remove_default_groups(&cma_dev_group->ports_group); | ||
1207 | + configfs_remove_default_groups(&cma_dev_group->device_group); | ||
1208 | + config_item_put(item); | ||
1209 | +} | ||
1210 | + | ||
1211 | static struct configfs_group_operations cma_subsys_group_ops = { | ||
1212 | .make_group = make_cma_dev, | ||
1213 | + .drop_item = drop_cma_dev, | ||
1214 | }; | ||
1215 | |||
1216 | static struct config_item_type cma_subsys_type = { | ||
1217 | diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c | ||
1218 | index a1f059a9c751..f03e10517acc 100644 | ||
1219 | --- a/drivers/infiniband/core/mad.c | ||
1220 | +++ b/drivers/infiniband/core/mad.c | ||
1221 | @@ -2885,6 +2885,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, | ||
1222 | DMA_FROM_DEVICE); | ||
1223 | if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device, | ||
1224 | sg_list.addr))) { | ||
1225 | + kfree(mad_priv); | ||
1226 | ret = -ENOMEM; | ||
1227 | break; | ||
1228 | } | ||
1229 | diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c | ||
1230 | index c8c5e3368b8b..12849829077d 100644 | ||
1231 | --- a/drivers/md/bcache/btree.c | ||
1232 | +++ b/drivers/md/bcache/btree.c | ||
1233 | @@ -1370,7 +1370,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, | ||
1234 | if (__set_blocks(n1, n1->keys + n2->keys, | ||
1235 | block_bytes(b->c)) > | ||
1236 | btree_blocks(new_nodes[i])) | ||
1237 | - goto out_nocoalesce; | ||
1238 | + goto out_unlock_nocoalesce; | ||
1239 | |||
1240 | keys = n2->keys; | ||
1241 | /* Take the key of the node we're getting rid of */ | ||
1242 | @@ -1399,7 +1399,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, | ||
1243 | |||
1244 | if (__bch_keylist_realloc(&keylist, | ||
1245 | bkey_u64s(&new_nodes[i]->key))) | ||
1246 | - goto out_nocoalesce; | ||
1247 | + goto out_unlock_nocoalesce; | ||
1248 | |||
1249 | bch_btree_node_write(new_nodes[i], &cl); | ||
1250 | bch_keylist_add(&keylist, &new_nodes[i]->key); | ||
1251 | @@ -1445,6 +1445,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, | ||
1252 | /* Invalidated our iterator */ | ||
1253 | return -EINTR; | ||
1254 | |||
1255 | +out_unlock_nocoalesce: | ||
1256 | + for (i = 0; i < nodes; i++) | ||
1257 | + mutex_unlock(&new_nodes[i]->write_lock); | ||
1258 | + | ||
1259 | out_nocoalesce: | ||
1260 | closure_sync(&cl); | ||
1261 | bch_keylist_free(&keylist); | ||
1262 | diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c | ||
1263 | index 372057cabea4..cd45b3894661 100644 | ||
1264 | --- a/drivers/media/dvb-core/dvb_frontend.c | ||
1265 | +++ b/drivers/media/dvb-core/dvb_frontend.c | ||
1266 | @@ -41,6 +41,7 @@ | ||
1267 | #include <linux/jiffies.h> | ||
1268 | #include <linux/kthread.h> | ||
1269 | #include <linux/ktime.h> | ||
1270 | +#include <linux/compat.h> | ||
1271 | #include <asm/processor.h> | ||
1272 | |||
1273 | #include "dvb_frontend.h" | ||
1274 | @@ -458,7 +459,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra | ||
1275 | |||
1276 | static void dvb_frontend_swzigzag(struct dvb_frontend *fe) | ||
1277 | { | ||
1278 | - enum fe_status s = 0; | ||
1279 | + enum fe_status s = FE_NONE; | ||
1280 | int retval = 0; | ||
1281 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1282 | struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; | ||
1283 | @@ -932,8 +933,6 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) | ||
1284 | memset(c, 0, offsetof(struct dtv_frontend_properties, strength)); | ||
1285 | c->delivery_system = delsys; | ||
1286 | |||
1287 | - c->state = DTV_CLEAR; | ||
1288 | - | ||
1289 | dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n", | ||
1290 | __func__, c->delivery_system); | ||
1291 | |||
1292 | @@ -998,6 +997,17 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) | ||
1293 | .buffer = b \ | ||
1294 | } | ||
1295 | |||
1296 | +struct dtv_cmds_h { | ||
1297 | + char *name; /* A display name for debugging purposes */ | ||
1298 | + | ||
1299 | + __u32 cmd; /* A unique ID */ | ||
1300 | + | ||
1301 | + /* Flags */ | ||
1302 | + __u32 set:1; /* Either a set or get property */ | ||
1303 | + __u32 buffer:1; /* Does this property use the buffer? */ | ||
1304 | + __u32 reserved:30; /* Align */ | ||
1305 | +}; | ||
1306 | + | ||
1307 | static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { | ||
1308 | _DTV_CMD(DTV_TUNE, 1, 0), | ||
1309 | _DTV_CMD(DTV_CLEAR, 1, 0), | ||
1310 | @@ -1079,22 +1089,19 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { | ||
1311 | _DTV_CMD(DTV_STAT_TOTAL_BLOCK_COUNT, 0, 0), | ||
1312 | }; | ||
1313 | |||
1314 | -static void dtv_property_dump(struct dvb_frontend *fe, | ||
1315 | - bool is_set, | ||
1316 | +static void dtv_get_property_dump(struct dvb_frontend *fe, | ||
1317 | struct dtv_property *tvp) | ||
1318 | { | ||
1319 | int i; | ||
1320 | |||
1321 | if (tvp->cmd <= 0 || tvp->cmd > DTV_MAX_COMMAND) { | ||
1322 | - dev_warn(fe->dvb->device, "%s: %s tvp.cmd = 0x%08x undefined\n", | ||
1323 | - __func__, | ||
1324 | - is_set ? "SET" : "GET", | ||
1325 | + dev_warn(fe->dvb->device, "%s: GET tvp.cmd = 0x%08x undefined\n" | ||
1326 | + , __func__, | ||
1327 | tvp->cmd); | ||
1328 | return; | ||
1329 | } | ||
1330 | |||
1331 | - dev_dbg(fe->dvb->device, "%s: %s tvp.cmd = 0x%08x (%s)\n", __func__, | ||
1332 | - is_set ? "SET" : "GET", | ||
1333 | + dev_dbg(fe->dvb->device, "%s: GET tvp.cmd = 0x%08x (%s)\n", __func__, | ||
1334 | tvp->cmd, | ||
1335 | dtv_cmds[tvp->cmd].name); | ||
1336 | |||
1337 | @@ -1285,17 +1292,15 @@ static int dtv_get_frontend(struct dvb_frontend *fe, | ||
1338 | return 0; | ||
1339 | } | ||
1340 | |||
1341 | -static int dvb_frontend_ioctl_legacy(struct file *file, | ||
1342 | - unsigned int cmd, void *parg); | ||
1343 | -static int dvb_frontend_ioctl_properties(struct file *file, | ||
1344 | - unsigned int cmd, void *parg); | ||
1345 | +static int dvb_frontend_handle_ioctl(struct file *file, | ||
1346 | + unsigned int cmd, void *parg); | ||
1347 | |||
1348 | static int dtv_property_process_get(struct dvb_frontend *fe, | ||
1349 | const struct dtv_frontend_properties *c, | ||
1350 | struct dtv_property *tvp, | ||
1351 | struct file *file) | ||
1352 | { | ||
1353 | - int r, ncaps; | ||
1354 | + int ncaps; | ||
1355 | |||
1356 | switch(tvp->cmd) { | ||
1357 | case DTV_ENUM_DELSYS: | ||
1358 | @@ -1506,14 +1511,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, | ||
1359 | return -EINVAL; | ||
1360 | } | ||
1361 | |||
1362 | - /* Allow the frontend to override outgoing properties */ | ||
1363 | - if (fe->ops.get_property) { | ||
1364 | - r = fe->ops.get_property(fe, tvp); | ||
1365 | - if (r < 0) | ||
1366 | - return r; | ||
1367 | - } | ||
1368 | - | ||
1369 | - dtv_property_dump(fe, false, tvp); | ||
1370 | + dtv_get_property_dump(fe, tvp); | ||
1371 | |||
1372 | return 0; | ||
1373 | } | ||
1374 | @@ -1740,23 +1738,36 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe) | ||
1375 | return emulate_delivery_system(fe, delsys); | ||
1376 | } | ||
1377 | |||
1378 | +/** | ||
1379 | + * dtv_property_process_set - Sets a single DTV property | ||
1380 | + * @fe: Pointer to &struct dvb_frontend | ||
1381 | + * @file: Pointer to &struct file | ||
1382 | + * @cmd: Digital TV command | ||
1383 | + * @data: An unsigned 32-bits number | ||
1384 | + * | ||
1385 | + * This routine assigns the property | ||
1386 | + * value to the corresponding member of | ||
1387 | + * &struct dtv_frontend_properties | ||
1388 | + * | ||
1389 | + * Returns: | ||
1390 | + * Zero on success, negative errno on failure. | ||
1391 | + */ | ||
1392 | static int dtv_property_process_set(struct dvb_frontend *fe, | ||
1393 | - struct dtv_property *tvp, | ||
1394 | - struct file *file) | ||
1395 | + struct file *file, | ||
1396 | + u32 cmd, u32 data) | ||
1397 | { | ||
1398 | int r = 0; | ||
1399 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
1400 | |||
1401 | - /* Allow the frontend to validate incoming properties */ | ||
1402 | - if (fe->ops.set_property) { | ||
1403 | - r = fe->ops.set_property(fe, tvp); | ||
1404 | - if (r < 0) | ||
1405 | - return r; | ||
1406 | - } | ||
1407 | - | ||
1408 | - dtv_property_dump(fe, true, tvp); | ||
1409 | - | ||
1410 | - switch(tvp->cmd) { | ||
1411 | + /** Dump DTV command name and value*/ | ||
1412 | + if (!cmd || cmd > DTV_MAX_COMMAND) | ||
1413 | + dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", | ||
1414 | + __func__, cmd); | ||
1415 | + else | ||
1416 | + dev_dbg(fe->dvb->device, | ||
1417 | + "%s: SET cmd 0x%08x (%s) to 0x%08x\n", | ||
1418 | + __func__, cmd, dtv_cmds[cmd].name, data); | ||
1419 | + switch (cmd) { | ||
1420 | case DTV_CLEAR: | ||
1421 | /* | ||
1422 | * Reset a cache of data specific to the frontend here. This does | ||
1423 | @@ -1765,144 +1776,144 @@ static int dtv_property_process_set(struct dvb_frontend *fe, | ||
1424 | dvb_frontend_clear_cache(fe); | ||
1425 | break; | ||
1426 | case DTV_TUNE: | ||
1427 | - /* interpret the cache of data, build either a traditional frontend | ||
1428 | - * tunerequest so we can pass validation in the FE_SET_FRONTEND | ||
1429 | - * ioctl. | ||
1430 | + /* | ||
1431 | + * Use the cached Digital TV properties to tune the | ||
1432 | + * frontend | ||
1433 | */ | ||
1434 | - c->state = tvp->cmd; | ||
1435 | - dev_dbg(fe->dvb->device, "%s: Finalised property cache\n", | ||
1436 | - __func__); | ||
1437 | + dev_dbg(fe->dvb->device, | ||
1438 | + "%s: Setting the frontend from property cache\n", | ||
1439 | + __func__); | ||
1440 | |||
1441 | r = dtv_set_frontend(fe); | ||
1442 | break; | ||
1443 | case DTV_FREQUENCY: | ||
1444 | - c->frequency = tvp->u.data; | ||
1445 | + c->frequency = data; | ||
1446 | break; | ||
1447 | case DTV_MODULATION: | ||
1448 | - c->modulation = tvp->u.data; | ||
1449 | + c->modulation = data; | ||
1450 | break; | ||
1451 | case DTV_BANDWIDTH_HZ: | ||
1452 | - c->bandwidth_hz = tvp->u.data; | ||
1453 | + c->bandwidth_hz = data; | ||
1454 | break; | ||
1455 | case DTV_INVERSION: | ||
1456 | - c->inversion = tvp->u.data; | ||
1457 | + c->inversion = data; | ||
1458 | break; | ||
1459 | case DTV_SYMBOL_RATE: | ||
1460 | - c->symbol_rate = tvp->u.data; | ||
1461 | + c->symbol_rate = data; | ||
1462 | break; | ||
1463 | case DTV_INNER_FEC: | ||
1464 | - c->fec_inner = tvp->u.data; | ||
1465 | + c->fec_inner = data; | ||
1466 | break; | ||
1467 | case DTV_PILOT: | ||
1468 | - c->pilot = tvp->u.data; | ||
1469 | + c->pilot = data; | ||
1470 | break; | ||
1471 | case DTV_ROLLOFF: | ||
1472 | - c->rolloff = tvp->u.data; | ||
1473 | + c->rolloff = data; | ||
1474 | break; | ||
1475 | case DTV_DELIVERY_SYSTEM: | ||
1476 | - r = dvbv5_set_delivery_system(fe, tvp->u.data); | ||
1477 | + r = dvbv5_set_delivery_system(fe, data); | ||
1478 | break; | ||
1479 | case DTV_VOLTAGE: | ||
1480 | - c->voltage = tvp->u.data; | ||
1481 | - r = dvb_frontend_ioctl_legacy(file, FE_SET_VOLTAGE, | ||
1482 | + c->voltage = data; | ||
1483 | + r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE, | ||
1484 | (void *)c->voltage); | ||
1485 | break; | ||
1486 | case DTV_TONE: | ||
1487 | - c->sectone = tvp->u.data; | ||
1488 | - r = dvb_frontend_ioctl_legacy(file, FE_SET_TONE, | ||
1489 | + c->sectone = data; | ||
1490 | + r = dvb_frontend_handle_ioctl(file, FE_SET_TONE, | ||
1491 | (void *)c->sectone); | ||
1492 | break; | ||
1493 | case DTV_CODE_RATE_HP: | ||
1494 | - c->code_rate_HP = tvp->u.data; | ||
1495 | + c->code_rate_HP = data; | ||
1496 | break; | ||
1497 | case DTV_CODE_RATE_LP: | ||
1498 | - c->code_rate_LP = tvp->u.data; | ||
1499 | + c->code_rate_LP = data; | ||
1500 | break; | ||
1501 | case DTV_GUARD_INTERVAL: | ||
1502 | - c->guard_interval = tvp->u.data; | ||
1503 | + c->guard_interval = data; | ||
1504 | break; | ||
1505 | case DTV_TRANSMISSION_MODE: | ||
1506 | - c->transmission_mode = tvp->u.data; | ||
1507 | + c->transmission_mode = data; | ||
1508 | break; | ||
1509 | case DTV_HIERARCHY: | ||
1510 | - c->hierarchy = tvp->u.data; | ||
1511 | + c->hierarchy = data; | ||
1512 | break; | ||
1513 | case DTV_INTERLEAVING: | ||
1514 | - c->interleaving = tvp->u.data; | ||
1515 | + c->interleaving = data; | ||
1516 | break; | ||
1517 | |||
1518 | /* ISDB-T Support here */ | ||
1519 | case DTV_ISDBT_PARTIAL_RECEPTION: | ||
1520 | - c->isdbt_partial_reception = tvp->u.data; | ||
1521 | + c->isdbt_partial_reception = data; | ||
1522 | break; | ||
1523 | case DTV_ISDBT_SOUND_BROADCASTING: | ||
1524 | - c->isdbt_sb_mode = tvp->u.data; | ||
1525 | + c->isdbt_sb_mode = data; | ||
1526 | break; | ||
1527 | case DTV_ISDBT_SB_SUBCHANNEL_ID: | ||
1528 | - c->isdbt_sb_subchannel = tvp->u.data; | ||
1529 | + c->isdbt_sb_subchannel = data; | ||
1530 | break; | ||
1531 | case DTV_ISDBT_SB_SEGMENT_IDX: | ||
1532 | - c->isdbt_sb_segment_idx = tvp->u.data; | ||
1533 | + c->isdbt_sb_segment_idx = data; | ||
1534 | break; | ||
1535 | case DTV_ISDBT_SB_SEGMENT_COUNT: | ||
1536 | - c->isdbt_sb_segment_count = tvp->u.data; | ||
1537 | + c->isdbt_sb_segment_count = data; | ||
1538 | break; | ||
1539 | case DTV_ISDBT_LAYER_ENABLED: | ||
1540 | - c->isdbt_layer_enabled = tvp->u.data; | ||
1541 | + c->isdbt_layer_enabled = data; | ||
1542 | break; | ||
1543 | case DTV_ISDBT_LAYERA_FEC: | ||
1544 | - c->layer[0].fec = tvp->u.data; | ||
1545 | + c->layer[0].fec = data; | ||
1546 | break; | ||
1547 | case DTV_ISDBT_LAYERA_MODULATION: | ||
1548 | - c->layer[0].modulation = tvp->u.data; | ||
1549 | + c->layer[0].modulation = data; | ||
1550 | break; | ||
1551 | case DTV_ISDBT_LAYERA_SEGMENT_COUNT: | ||
1552 | - c->layer[0].segment_count = tvp->u.data; | ||
1553 | + c->layer[0].segment_count = data; | ||
1554 | break; | ||
1555 | case DTV_ISDBT_LAYERA_TIME_INTERLEAVING: | ||
1556 | - c->layer[0].interleaving = tvp->u.data; | ||
1557 | + c->layer[0].interleaving = data; | ||
1558 | break; | ||
1559 | case DTV_ISDBT_LAYERB_FEC: | ||
1560 | - c->layer[1].fec = tvp->u.data; | ||
1561 | + c->layer[1].fec = data; | ||
1562 | break; | ||
1563 | case DTV_ISDBT_LAYERB_MODULATION: | ||
1564 | - c->layer[1].modulation = tvp->u.data; | ||
1565 | + c->layer[1].modulation = data; | ||
1566 | break; | ||
1567 | case DTV_ISDBT_LAYERB_SEGMENT_COUNT: | ||
1568 | - c->layer[1].segment_count = tvp->u.data; | ||
1569 | + c->layer[1].segment_count = data; | ||
1570 | break; | ||
1571 | case DTV_ISDBT_LAYERB_TIME_INTERLEAVING: | ||
1572 | - c->layer[1].interleaving = tvp->u.data; | ||
1573 | + c->layer[1].interleaving = data; | ||
1574 | break; | ||
1575 | case DTV_ISDBT_LAYERC_FEC: | ||
1576 | - c->layer[2].fec = tvp->u.data; | ||
1577 | + c->layer[2].fec = data; | ||
1578 | break; | ||
1579 | case DTV_ISDBT_LAYERC_MODULATION: | ||
1580 | - c->layer[2].modulation = tvp->u.data; | ||
1581 | + c->layer[2].modulation = data; | ||
1582 | break; | ||
1583 | case DTV_ISDBT_LAYERC_SEGMENT_COUNT: | ||
1584 | - c->layer[2].segment_count = tvp->u.data; | ||
1585 | + c->layer[2].segment_count = data; | ||
1586 | break; | ||
1587 | case DTV_ISDBT_LAYERC_TIME_INTERLEAVING: | ||
1588 | - c->layer[2].interleaving = tvp->u.data; | ||
1589 | + c->layer[2].interleaving = data; | ||
1590 | break; | ||
1591 | |||
1592 | /* Multistream support */ | ||
1593 | case DTV_STREAM_ID: | ||
1594 | case DTV_DVBT2_PLP_ID_LEGACY: | ||
1595 | - c->stream_id = tvp->u.data; | ||
1596 | + c->stream_id = data; | ||
1597 | break; | ||
1598 | |||
1599 | /* ATSC-MH */ | ||
1600 | case DTV_ATSCMH_PARADE_ID: | ||
1601 | - fe->dtv_property_cache.atscmh_parade_id = tvp->u.data; | ||
1602 | + fe->dtv_property_cache.atscmh_parade_id = data; | ||
1603 | break; | ||
1604 | case DTV_ATSCMH_RS_FRAME_ENSEMBLE: | ||
1605 | - fe->dtv_property_cache.atscmh_rs_frame_ensemble = tvp->u.data; | ||
1606 | + fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; | ||
1607 | break; | ||
1608 | |||
1609 | case DTV_LNA: | ||
1610 | - c->lna = tvp->u.data; | ||
1611 | + c->lna = data; | ||
1612 | if (fe->ops.set_lna) | ||
1613 | r = fe->ops.set_lna(fe); | ||
1614 | if (r < 0) | ||
1615 | @@ -1916,14 +1927,13 @@ static int dtv_property_process_set(struct dvb_frontend *fe, | ||
1616 | return r; | ||
1617 | } | ||
1618 | |||
1619 | -static int dvb_frontend_ioctl(struct file *file, | ||
1620 | - unsigned int cmd, void *parg) | ||
1621 | +static int dvb_frontend_do_ioctl(struct file *file, unsigned int cmd, | ||
1622 | + void *parg) | ||
1623 | { | ||
1624 | struct dvb_device *dvbdev = file->private_data; | ||
1625 | struct dvb_frontend *fe = dvbdev->priv; | ||
1626 | - struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
1627 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1628 | - int err = -EOPNOTSUPP; | ||
1629 | + int err; | ||
1630 | |||
1631 | dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); | ||
1632 | if (down_interruptible(&fepriv->sem)) | ||
1633 | @@ -1934,74 +1944,125 @@ static int dvb_frontend_ioctl(struct file *file, | ||
1634 | return -ENODEV; | ||
1635 | } | ||
1636 | |||
1637 | - if ((file->f_flags & O_ACCMODE) == O_RDONLY && | ||
1638 | - (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT || | ||
1639 | - cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { | ||
1640 | + /* | ||
1641 | + * If the frontend is opened in read-only mode, only the ioctls | ||
1642 | + * that don't interfere with the tune logic should be accepted. | ||
1643 | + * That allows an external application to monitor the DVB QoS and | ||
1644 | + * statistics parameters. | ||
1645 | + * | ||
1646 | + * That matches all _IOR() ioctls, except for two special cases: | ||
1647 | + * - FE_GET_EVENT is part of the tuning logic on a DVB application; | ||
1648 | + * - FE_DISEQC_RECV_SLAVE_REPLY is part of DiSEqC 2.0 | ||
1649 | + * setup | ||
1650 | + * So, those two ioctls should also return -EPERM, as otherwise | ||
1651 | + * reading from them would interfere with a DVB tune application | ||
1652 | + */ | ||
1653 | + if ((file->f_flags & O_ACCMODE) == O_RDONLY | ||
1654 | + && (_IOC_DIR(cmd) != _IOC_READ | ||
1655 | + || cmd == FE_GET_EVENT | ||
1656 | + || cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { | ||
1657 | up(&fepriv->sem); | ||
1658 | return -EPERM; | ||
1659 | } | ||
1660 | |||
1661 | - if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY)) | ||
1662 | - err = dvb_frontend_ioctl_properties(file, cmd, parg); | ||
1663 | - else { | ||
1664 | - c->state = DTV_UNDEFINED; | ||
1665 | - err = dvb_frontend_ioctl_legacy(file, cmd, parg); | ||
1666 | - } | ||
1667 | + err = dvb_frontend_handle_ioctl(file, cmd, parg); | ||
1668 | |||
1669 | up(&fepriv->sem); | ||
1670 | return err; | ||
1671 | } | ||
1672 | |||
1673 | -static int dvb_frontend_ioctl_properties(struct file *file, | ||
1674 | - unsigned int cmd, void *parg) | ||
1675 | +static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, | ||
1676 | + unsigned long arg) | ||
1677 | +{ | ||
1678 | + struct dvb_device *dvbdev = file->private_data; | ||
1679 | + | ||
1680 | + if (!dvbdev) | ||
1681 | + return -ENODEV; | ||
1682 | + | ||
1683 | + return dvb_usercopy(file, cmd, arg, dvb_frontend_do_ioctl); | ||
1684 | +} | ||
1685 | + | ||
1686 | +#ifdef CONFIG_COMPAT | ||
1687 | +struct compat_dtv_property { | ||
1688 | + __u32 cmd; | ||
1689 | + __u32 reserved[3]; | ||
1690 | + union { | ||
1691 | + __u32 data; | ||
1692 | + struct dtv_fe_stats st; | ||
1693 | + struct { | ||
1694 | + __u8 data[32]; | ||
1695 | + __u32 len; | ||
1696 | + __u32 reserved1[3]; | ||
1697 | + compat_uptr_t reserved2; | ||
1698 | + } buffer; | ||
1699 | + } u; | ||
1700 | + int result; | ||
1701 | +} __attribute__ ((packed)); | ||
1702 | + | ||
1703 | +struct compat_dtv_properties { | ||
1704 | + __u32 num; | ||
1705 | + compat_uptr_t props; | ||
1706 | +}; | ||
1707 | + | ||
1708 | +#define COMPAT_FE_SET_PROPERTY _IOW('o', 82, struct compat_dtv_properties) | ||
1709 | +#define COMPAT_FE_GET_PROPERTY _IOR('o', 83, struct compat_dtv_properties) | ||
1710 | + | ||
1711 | +static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, | ||
1712 | + unsigned long arg) | ||
1713 | { | ||
1714 | struct dvb_device *dvbdev = file->private_data; | ||
1715 | struct dvb_frontend *fe = dvbdev->priv; | ||
1716 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1717 | - struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
1718 | - int err = 0; | ||
1719 | + int i, err = 0; | ||
1720 | |||
1721 | - struct dtv_properties *tvps = parg; | ||
1722 | - struct dtv_property *tvp = NULL; | ||
1723 | - int i; | ||
1724 | + if (cmd == COMPAT_FE_SET_PROPERTY) { | ||
1725 | + struct compat_dtv_properties prop, *tvps = NULL; | ||
1726 | + struct compat_dtv_property *tvp = NULL; | ||
1727 | |||
1728 | - dev_dbg(fe->dvb->device, "%s:\n", __func__); | ||
1729 | + if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop))) | ||
1730 | + return -EFAULT; | ||
1731 | |||
1732 | - if (cmd == FE_SET_PROPERTY) { | ||
1733 | - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); | ||
1734 | - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); | ||
1735 | + tvps = ∝ | ||
1736 | |||
1737 | - /* Put an arbitrary limit on the number of messages that can | ||
1738 | - * be sent at once */ | ||
1739 | - if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) | ||
1740 | + /* | ||
1741 | + * Put an arbitrary limit on the number of messages that can | ||
1742 | + * be sent at once | ||
1743 | + */ | ||
1744 | + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) | ||
1745 | return -EINVAL; | ||
1746 | |||
1747 | - tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); | ||
1748 | + tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp)); | ||
1749 | if (IS_ERR(tvp)) | ||
1750 | return PTR_ERR(tvp); | ||
1751 | |||
1752 | for (i = 0; i < tvps->num; i++) { | ||
1753 | - err = dtv_property_process_set(fe, tvp + i, file); | ||
1754 | - if (err < 0) | ||
1755 | - goto out; | ||
1756 | - (tvp + i)->result = err; | ||
1757 | + err = dtv_property_process_set(fe, file, | ||
1758 | + (tvp + i)->cmd, | ||
1759 | + (tvp + i)->u.data); | ||
1760 | + if (err < 0) { | ||
1761 | + kfree(tvp); | ||
1762 | + return err; | ||
1763 | + } | ||
1764 | } | ||
1765 | - | ||
1766 | - if (c->state == DTV_TUNE) | ||
1767 | - dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__); | ||
1768 | - | ||
1769 | - } else if (cmd == FE_GET_PROPERTY) { | ||
1770 | + kfree(tvp); | ||
1771 | + } else if (cmd == COMPAT_FE_GET_PROPERTY) { | ||
1772 | + struct compat_dtv_properties prop, *tvps = NULL; | ||
1773 | + struct compat_dtv_property *tvp = NULL; | ||
1774 | struct dtv_frontend_properties getp = fe->dtv_property_cache; | ||
1775 | |||
1776 | - dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num); | ||
1777 | - dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props); | ||
1778 | + if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop))) | ||
1779 | + return -EFAULT; | ||
1780 | |||
1781 | - /* Put an arbitrary limit on the number of messages that can | ||
1782 | - * be sent at once */ | ||
1783 | - if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) | ||
1784 | + tvps = ∝ | ||
1785 | + | ||
1786 | + /* | ||
1787 | + * Put an arbitrary limit on the number of messages that can | ||
1788 | + * be sent at once | ||
1789 | + */ | ||
1790 | + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) | ||
1791 | return -EINVAL; | ||
1792 | |||
1793 | - tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); | ||
1794 | + tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp)); | ||
1795 | if (IS_ERR(tvp)) | ||
1796 | return PTR_ERR(tvp); | ||
1797 | |||
1798 | @@ -2013,30 +2074,53 @@ static int dvb_frontend_ioctl_properties(struct file *file, | ||
1799 | */ | ||
1800 | if (fepriv->state != FESTATE_IDLE) { | ||
1801 | err = dtv_get_frontend(fe, &getp, NULL); | ||
1802 | - if (err < 0) | ||
1803 | - goto out; | ||
1804 | + if (err < 0) { | ||
1805 | + kfree(tvp); | ||
1806 | + return err; | ||
1807 | + } | ||
1808 | } | ||
1809 | for (i = 0; i < tvps->num; i++) { | ||
1810 | - err = dtv_property_process_get(fe, &getp, tvp + i, file); | ||
1811 | - if (err < 0) | ||
1812 | - goto out; | ||
1813 | - (tvp + i)->result = err; | ||
1814 | + err = dtv_property_process_get( | ||
1815 | + fe, &getp, (struct dtv_property *)(tvp + i), file); | ||
1816 | + if (err < 0) { | ||
1817 | + kfree(tvp); | ||
1818 | + return err; | ||
1819 | + } | ||
1820 | } | ||
1821 | |||
1822 | - if (copy_to_user((void __user *)tvps->props, tvp, | ||
1823 | - tvps->num * sizeof(struct dtv_property))) { | ||
1824 | - err = -EFAULT; | ||
1825 | - goto out; | ||
1826 | + if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp, | ||
1827 | + tvps->num * sizeof(struct compat_dtv_property))) { | ||
1828 | + kfree(tvp); | ||
1829 | + return -EFAULT; | ||
1830 | } | ||
1831 | + kfree(tvp); | ||
1832 | + } | ||
1833 | |||
1834 | - } else | ||
1835 | - err = -EOPNOTSUPP; | ||
1836 | - | ||
1837 | -out: | ||
1838 | - kfree(tvp); | ||
1839 | return err; | ||
1840 | } | ||
1841 | |||
1842 | +static long dvb_frontend_compat_ioctl(struct file *file, unsigned int cmd, | ||
1843 | + unsigned long arg) | ||
1844 | +{ | ||
1845 | + struct dvb_device *dvbdev = file->private_data; | ||
1846 | + struct dvb_frontend *fe = dvbdev->priv; | ||
1847 | + struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1848 | + int err; | ||
1849 | + | ||
1850 | + if (cmd == COMPAT_FE_SET_PROPERTY || cmd == COMPAT_FE_GET_PROPERTY) { | ||
1851 | + if (down_interruptible(&fepriv->sem)) | ||
1852 | + return -ERESTARTSYS; | ||
1853 | + | ||
1854 | + err = dvb_frontend_handle_compat_ioctl(file, cmd, arg); | ||
1855 | + | ||
1856 | + up(&fepriv->sem); | ||
1857 | + return err; | ||
1858 | + } | ||
1859 | + | ||
1860 | + return dvb_frontend_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); | ||
1861 | +} | ||
1862 | +#endif | ||
1863 | + | ||
1864 | static int dtv_set_frontend(struct dvb_frontend *fe) | ||
1865 | { | ||
1866 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1867 | @@ -2174,16 +2258,103 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | ||
1868 | } | ||
1869 | |||
1870 | |||
1871 | -static int dvb_frontend_ioctl_legacy(struct file *file, | ||
1872 | - unsigned int cmd, void *parg) | ||
1873 | +static int dvb_frontend_handle_ioctl(struct file *file, | ||
1874 | + unsigned int cmd, void *parg) | ||
1875 | { | ||
1876 | struct dvb_device *dvbdev = file->private_data; | ||
1877 | struct dvb_frontend *fe = dvbdev->priv; | ||
1878 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1879 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
1880 | - int err = -EOPNOTSUPP; | ||
1881 | + int i, err = -ENOTSUPP; | ||
1882 | + | ||
1883 | + dev_dbg(fe->dvb->device, "%s:\n", __func__); | ||
1884 | + | ||
1885 | + switch(cmd) { | ||
1886 | + case FE_SET_PROPERTY: { | ||
1887 | + struct dtv_properties *tvps = parg; | ||
1888 | + struct dtv_property *tvp = NULL; | ||
1889 | + | ||
1890 | + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", | ||
1891 | + __func__, tvps->num); | ||
1892 | + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", | ||
1893 | + __func__, tvps->props); | ||
1894 | + | ||
1895 | + /* | ||
1896 | + * Put an arbitrary limit on the number of messages that can | ||
1897 | + * be sent at once | ||
1898 | + */ | ||
1899 | + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) | ||
1900 | + return -EINVAL; | ||
1901 | + | ||
1902 | + tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); | ||
1903 | + if (IS_ERR(tvp)) | ||
1904 | + return PTR_ERR(tvp); | ||
1905 | + | ||
1906 | + for (i = 0; i < tvps->num; i++) { | ||
1907 | + err = dtv_property_process_set(fe, file, | ||
1908 | + (tvp + i)->cmd, | ||
1909 | + (tvp + i)->u.data); | ||
1910 | + if (err < 0) { | ||
1911 | + kfree(tvp); | ||
1912 | + return err; | ||
1913 | + } | ||
1914 | + } | ||
1915 | + kfree(tvp); | ||
1916 | + err = 0; | ||
1917 | + break; | ||
1918 | + } | ||
1919 | + case FE_GET_PROPERTY: { | ||
1920 | + struct dtv_properties *tvps = parg; | ||
1921 | + struct dtv_property *tvp = NULL; | ||
1922 | + struct dtv_frontend_properties getp = fe->dtv_property_cache; | ||
1923 | + | ||
1924 | + dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", | ||
1925 | + __func__, tvps->num); | ||
1926 | + dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", | ||
1927 | + __func__, tvps->props); | ||
1928 | + | ||
1929 | + /* | ||
1930 | + * Put an arbitrary limit on the number of messages that can | ||
1931 | + * be sent at once | ||
1932 | + */ | ||
1933 | + if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS)) | ||
1934 | + return -EINVAL; | ||
1935 | + | ||
1936 | + tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); | ||
1937 | + if (IS_ERR(tvp)) | ||
1938 | + return PTR_ERR(tvp); | ||
1939 | + | ||
1940 | + /* | ||
1941 | + * Let's use our own copy of property cache, in order to | ||
1942 | + * avoid mangling with DTV zigzag logic, as drivers might | ||
1943 | + * return crap, if they don't check if the data is available | ||
1944 | + * before updating the properties cache. | ||
1945 | + */ | ||
1946 | + if (fepriv->state != FESTATE_IDLE) { | ||
1947 | + err = dtv_get_frontend(fe, &getp, NULL); | ||
1948 | + if (err < 0) { | ||
1949 | + kfree(tvp); | ||
1950 | + return err; | ||
1951 | + } | ||
1952 | + } | ||
1953 | + for (i = 0; i < tvps->num; i++) { | ||
1954 | + err = dtv_property_process_get(fe, &getp, tvp + i, file); | ||
1955 | + if (err < 0) { | ||
1956 | + kfree(tvp); | ||
1957 | + return err; | ||
1958 | + } | ||
1959 | + } | ||
1960 | + | ||
1961 | + if (copy_to_user((void __user *)tvps->props, tvp, | ||
1962 | + tvps->num * sizeof(struct dtv_property))) { | ||
1963 | + kfree(tvp); | ||
1964 | + return -EFAULT; | ||
1965 | + } | ||
1966 | + kfree(tvp); | ||
1967 | + err = 0; | ||
1968 | + break; | ||
1969 | + } | ||
1970 | |||
1971 | - switch (cmd) { | ||
1972 | case FE_GET_INFO: { | ||
1973 | struct dvb_frontend_info* info = parg; | ||
1974 | |||
1975 | @@ -2247,42 +2418,6 @@ static int dvb_frontend_ioctl_legacy(struct file *file, | ||
1976 | break; | ||
1977 | } | ||
1978 | |||
1979 | - case FE_READ_BER: | ||
1980 | - if (fe->ops.read_ber) { | ||
1981 | - if (fepriv->thread) | ||
1982 | - err = fe->ops.read_ber(fe, (__u32 *) parg); | ||
1983 | - else | ||
1984 | - err = -EAGAIN; | ||
1985 | - } | ||
1986 | - break; | ||
1987 | - | ||
1988 | - case FE_READ_SIGNAL_STRENGTH: | ||
1989 | - if (fe->ops.read_signal_strength) { | ||
1990 | - if (fepriv->thread) | ||
1991 | - err = fe->ops.read_signal_strength(fe, (__u16 *) parg); | ||
1992 | - else | ||
1993 | - err = -EAGAIN; | ||
1994 | - } | ||
1995 | - break; | ||
1996 | - | ||
1997 | - case FE_READ_SNR: | ||
1998 | - if (fe->ops.read_snr) { | ||
1999 | - if (fepriv->thread) | ||
2000 | - err = fe->ops.read_snr(fe, (__u16 *) parg); | ||
2001 | - else | ||
2002 | - err = -EAGAIN; | ||
2003 | - } | ||
2004 | - break; | ||
2005 | - | ||
2006 | - case FE_READ_UNCORRECTED_BLOCKS: | ||
2007 | - if (fe->ops.read_ucblocks) { | ||
2008 | - if (fepriv->thread) | ||
2009 | - err = fe->ops.read_ucblocks(fe, (__u32 *) parg); | ||
2010 | - else | ||
2011 | - err = -EAGAIN; | ||
2012 | - } | ||
2013 | - break; | ||
2014 | - | ||
2015 | case FE_DISEQC_RESET_OVERLOAD: | ||
2016 | if (fe->ops.diseqc_reset_overload) { | ||
2017 | err = fe->ops.diseqc_reset_overload(fe); | ||
2018 | @@ -2334,6 +2469,23 @@ static int dvb_frontend_ioctl_legacy(struct file *file, | ||
2019 | } | ||
2020 | break; | ||
2021 | |||
2022 | + case FE_DISEQC_RECV_SLAVE_REPLY: | ||
2023 | + if (fe->ops.diseqc_recv_slave_reply) | ||
2024 | + err = fe->ops.diseqc_recv_slave_reply(fe, (struct dvb_diseqc_slave_reply*) parg); | ||
2025 | + break; | ||
2026 | + | ||
2027 | + case FE_ENABLE_HIGH_LNB_VOLTAGE: | ||
2028 | + if (fe->ops.enable_high_lnb_voltage) | ||
2029 | + err = fe->ops.enable_high_lnb_voltage(fe, (long) parg); | ||
2030 | + break; | ||
2031 | + | ||
2032 | + case FE_SET_FRONTEND_TUNE_MODE: | ||
2033 | + fepriv->tune_mode_flags = (unsigned long) parg; | ||
2034 | + err = 0; | ||
2035 | + break; | ||
2036 | + | ||
2037 | + /* DEPRECATED dish control ioctls */ | ||
2038 | + | ||
2039 | case FE_DISHNETWORK_SEND_LEGACY_CMD: | ||
2040 | if (fe->ops.dishnetwork_send_legacy_command) { | ||
2041 | err = fe->ops.dishnetwork_send_legacy_command(fe, | ||
2042 | @@ -2398,16 +2550,46 @@ static int dvb_frontend_ioctl_legacy(struct file *file, | ||
2043 | } | ||
2044 | break; | ||
2045 | |||
2046 | - case FE_DISEQC_RECV_SLAVE_REPLY: | ||
2047 | - if (fe->ops.diseqc_recv_slave_reply) | ||
2048 | - err = fe->ops.diseqc_recv_slave_reply(fe, (struct dvb_diseqc_slave_reply*) parg); | ||
2049 | + /* DEPRECATED statistics ioctls */ | ||
2050 | + | ||
2051 | + case FE_READ_BER: | ||
2052 | + if (fe->ops.read_ber) { | ||
2053 | + if (fepriv->thread) | ||
2054 | + err = fe->ops.read_ber(fe, (__u32 *) parg); | ||
2055 | + else | ||
2056 | + err = -EAGAIN; | ||
2057 | + } | ||
2058 | break; | ||
2059 | |||
2060 | - case FE_ENABLE_HIGH_LNB_VOLTAGE: | ||
2061 | - if (fe->ops.enable_high_lnb_voltage) | ||
2062 | - err = fe->ops.enable_high_lnb_voltage(fe, (long) parg); | ||
2063 | + case FE_READ_SIGNAL_STRENGTH: | ||
2064 | + if (fe->ops.read_signal_strength) { | ||
2065 | + if (fepriv->thread) | ||
2066 | + err = fe->ops.read_signal_strength(fe, (__u16 *) parg); | ||
2067 | + else | ||
2068 | + err = -EAGAIN; | ||
2069 | + } | ||
2070 | + break; | ||
2071 | + | ||
2072 | + case FE_READ_SNR: | ||
2073 | + if (fe->ops.read_snr) { | ||
2074 | + if (fepriv->thread) | ||
2075 | + err = fe->ops.read_snr(fe, (__u16 *) parg); | ||
2076 | + else | ||
2077 | + err = -EAGAIN; | ||
2078 | + } | ||
2079 | + break; | ||
2080 | + | ||
2081 | + case FE_READ_UNCORRECTED_BLOCKS: | ||
2082 | + if (fe->ops.read_ucblocks) { | ||
2083 | + if (fepriv->thread) | ||
2084 | + err = fe->ops.read_ucblocks(fe, (__u32 *) parg); | ||
2085 | + else | ||
2086 | + err = -EAGAIN; | ||
2087 | + } | ||
2088 | break; | ||
2089 | |||
2090 | + /* DEPRECATED DVBv3 ioctls */ | ||
2091 | + | ||
2092 | case FE_SET_FRONTEND: | ||
2093 | err = dvbv3_set_delivery_system(fe); | ||
2094 | if (err) | ||
2095 | @@ -2434,11 +2616,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file, | ||
2096 | err = dtv_get_frontend(fe, &getp, parg); | ||
2097 | break; | ||
2098 | } | ||
2099 | - case FE_SET_FRONTEND_TUNE_MODE: | ||
2100 | - fepriv->tune_mode_flags = (unsigned long) parg; | ||
2101 | - err = 0; | ||
2102 | - break; | ||
2103 | - } | ||
2104 | + | ||
2105 | + default: | ||
2106 | + return -ENOTSUPP; | ||
2107 | + } /* switch */ | ||
2108 | |||
2109 | return err; | ||
2110 | } | ||
2111 | @@ -2609,7 +2790,10 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) | ||
2112 | |||
2113 | static const struct file_operations dvb_frontend_fops = { | ||
2114 | .owner = THIS_MODULE, | ||
2115 | - .unlocked_ioctl = dvb_generic_ioctl, | ||
2116 | + .unlocked_ioctl = dvb_frontend_ioctl, | ||
2117 | +#ifdef CONFIG_COMPAT | ||
2118 | + .compat_ioctl = dvb_frontend_compat_ioctl, | ||
2119 | +#endif | ||
2120 | .poll = dvb_frontend_poll, | ||
2121 | .open = dvb_frontend_open, | ||
2122 | .release = dvb_frontend_release, | ||
2123 | @@ -2677,7 +2861,6 @@ int dvb_register_frontend(struct dvb_adapter* dvb, | ||
2124 | #if defined(CONFIG_MEDIA_CONTROLLER_DVB) | ||
2125 | .name = fe->ops.info.name, | ||
2126 | #endif | ||
2127 | - .kernel_ioctl = dvb_frontend_ioctl | ||
2128 | }; | ||
2129 | |||
2130 | dev_dbg(dvb->device, "%s:\n", __func__); | ||
2131 | diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h | ||
2132 | index fb6e84811504..8a6267ad56d6 100644 | ||
2133 | --- a/drivers/media/dvb-core/dvb_frontend.h | ||
2134 | +++ b/drivers/media/dvb-core/dvb_frontend.h | ||
2135 | @@ -397,13 +397,8 @@ struct dtv_frontend_properties; | ||
2136 | * @search: callback function used on some custom algo search algos. | ||
2137 | * @tuner_ops: pointer to struct dvb_tuner_ops | ||
2138 | * @analog_ops: pointer to struct analog_demod_ops | ||
2139 | - * @set_property: callback function to allow the frontend to validade | ||
2140 | - * incoming properties. Should not be used on new drivers. | ||
2141 | - * @get_property: callback function to allow the frontend to override | ||
2142 | - * outcoming properties. Should not be used on new drivers. | ||
2143 | */ | ||
2144 | struct dvb_frontend_ops { | ||
2145 | - | ||
2146 | struct dvb_frontend_info info; | ||
2147 | |||
2148 | u8 delsys[MAX_DELSYS]; | ||
2149 | @@ -461,9 +456,6 @@ struct dvb_frontend_ops { | ||
2150 | |||
2151 | struct dvb_tuner_ops tuner_ops; | ||
2152 | struct analog_demod_ops analog_ops; | ||
2153 | - | ||
2154 | - int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp); | ||
2155 | - int (*get_property)(struct dvb_frontend* fe, struct dtv_property* tvp); | ||
2156 | }; | ||
2157 | |||
2158 | #ifdef __DVB_CORE__ | ||
2159 | @@ -623,11 +615,6 @@ struct dtv_frontend_properties { | ||
2160 | struct dtv_fe_stats post_bit_count; | ||
2161 | struct dtv_fe_stats block_error; | ||
2162 | struct dtv_fe_stats block_count; | ||
2163 | - | ||
2164 | - /* private: */ | ||
2165 | - /* Cache State */ | ||
2166 | - u32 state; | ||
2167 | - | ||
2168 | }; | ||
2169 | |||
2170 | #define DVB_FE_NO_EXIT 0 | ||
2171 | diff --git a/drivers/media/dvb-frontends/lg2160.c b/drivers/media/dvb-frontends/lg2160.c | ||
2172 | index f51a3a0b3949..1b640651531d 100644 | ||
2173 | --- a/drivers/media/dvb-frontends/lg2160.c | ||
2174 | +++ b/drivers/media/dvb-frontends/lg2160.c | ||
2175 | @@ -1052,16 +1052,6 @@ fail: | ||
2176 | return ret; | ||
2177 | } | ||
2178 | |||
2179 | -static int lg216x_get_property(struct dvb_frontend *fe, | ||
2180 | - struct dtv_property *tvp) | ||
2181 | -{ | ||
2182 | - struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
2183 | - | ||
2184 | - return (DTV_ATSCMH_FIC_VER == tvp->cmd) ? | ||
2185 | - lg216x_get_frontend(fe, c) : 0; | ||
2186 | -} | ||
2187 | - | ||
2188 | - | ||
2189 | static int lg2160_set_frontend(struct dvb_frontend *fe) | ||
2190 | { | ||
2191 | struct lg216x_state *state = fe->demodulator_priv; | ||
2192 | @@ -1372,8 +1362,6 @@ static struct dvb_frontend_ops lg2160_ops = { | ||
2193 | .init = lg216x_init, | ||
2194 | .sleep = lg216x_sleep, | ||
2195 | #endif | ||
2196 | - .get_property = lg216x_get_property, | ||
2197 | - | ||
2198 | .set_frontend = lg2160_set_frontend, | ||
2199 | .get_frontend = lg216x_get_frontend, | ||
2200 | .get_tune_settings = lg216x_get_tune_settings, | ||
2201 | @@ -1400,8 +1388,6 @@ static struct dvb_frontend_ops lg2161_ops = { | ||
2202 | .init = lg216x_init, | ||
2203 | .sleep = lg216x_sleep, | ||
2204 | #endif | ||
2205 | - .get_property = lg216x_get_property, | ||
2206 | - | ||
2207 | .set_frontend = lg2160_set_frontend, | ||
2208 | .get_frontend = lg216x_get_frontend, | ||
2209 | .get_tune_settings = lg216x_get_tune_settings, | ||
2210 | diff --git a/drivers/media/dvb-frontends/stv0288.c b/drivers/media/dvb-frontends/stv0288.c | ||
2211 | index c93d9a45f7f7..2b8c75f28d2e 100644 | ||
2212 | --- a/drivers/media/dvb-frontends/stv0288.c | ||
2213 | +++ b/drivers/media/dvb-frontends/stv0288.c | ||
2214 | @@ -447,12 +447,6 @@ static int stv0288_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | ||
2215 | return 0; | ||
2216 | } | ||
2217 | |||
2218 | -static int stv0288_set_property(struct dvb_frontend *fe, struct dtv_property *p) | ||
2219 | -{ | ||
2220 | - dprintk("%s(..)\n", __func__); | ||
2221 | - return 0; | ||
2222 | -} | ||
2223 | - | ||
2224 | static int stv0288_set_frontend(struct dvb_frontend *fe) | ||
2225 | { | ||
2226 | struct stv0288_state *state = fe->demodulator_priv; | ||
2227 | @@ -568,7 +562,6 @@ static struct dvb_frontend_ops stv0288_ops = { | ||
2228 | .set_tone = stv0288_set_tone, | ||
2229 | .set_voltage = stv0288_set_voltage, | ||
2230 | |||
2231 | - .set_property = stv0288_set_property, | ||
2232 | .set_frontend = stv0288_set_frontend, | ||
2233 | }; | ||
2234 | |||
2235 | diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c | ||
2236 | index 66a5a7f2295c..93262b13c644 100644 | ||
2237 | --- a/drivers/media/dvb-frontends/stv6110.c | ||
2238 | +++ b/drivers/media/dvb-frontends/stv6110.c | ||
2239 | @@ -263,11 +263,9 @@ static int stv6110_get_frequency(struct dvb_frontend *fe, u32 *frequency) | ||
2240 | static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) | ||
2241 | { | ||
2242 | struct stv6110_priv *priv = fe->tuner_priv; | ||
2243 | - struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
2244 | u8 ret = 0x04; | ||
2245 | u32 divider, ref, p, presc, i, result_freq, vco_freq; | ||
2246 | s32 p_calc, p_calc_opt = 1000, r_div, r_div_opt = 0, p_val; | ||
2247 | - s32 srate; | ||
2248 | |||
2249 | dprintk("%s, freq=%d kHz, mclk=%d Hz\n", __func__, | ||
2250 | frequency, priv->mclk); | ||
2251 | @@ -278,13 +276,6 @@ static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) | ||
2252 | ((((priv->mclk / 1000000) - 16) & 0x1f) << 3); | ||
2253 | |||
2254 | /* BB_GAIN = db/2 */ | ||
2255 | - if (fe->ops.set_property && fe->ops.get_property) { | ||
2256 | - srate = c->symbol_rate; | ||
2257 | - dprintk("%s: Get Frontend parameters: srate=%d\n", | ||
2258 | - __func__, srate); | ||
2259 | - } else | ||
2260 | - srate = 15000000; | ||
2261 | - | ||
2262 | priv->regs[RSTV6110_CTRL2] &= ~0x0f; | ||
2263 | priv->regs[RSTV6110_CTRL2] |= (priv->gain & 0x0f); | ||
2264 | |||
2265 | diff --git a/drivers/media/usb/dvb-usb/friio-fe.c b/drivers/media/usb/dvb-usb/friio-fe.c | ||
2266 | index 979f05b4b87c..237f12f9a7f2 100644 | ||
2267 | --- a/drivers/media/usb/dvb-usb/friio-fe.c | ||
2268 | +++ b/drivers/media/usb/dvb-usb/friio-fe.c | ||
2269 | @@ -261,28 +261,6 @@ static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe, | ||
2270 | return 0; | ||
2271 | } | ||
2272 | |||
2273 | - | ||
2274 | -/* filter out un-supported properties to notify users */ | ||
2275 | -static int jdvbt90502_set_property(struct dvb_frontend *fe, | ||
2276 | - struct dtv_property *tvp) | ||
2277 | -{ | ||
2278 | - int r = 0; | ||
2279 | - | ||
2280 | - switch (tvp->cmd) { | ||
2281 | - case DTV_DELIVERY_SYSTEM: | ||
2282 | - if (tvp->u.data != SYS_ISDBT) | ||
2283 | - r = -EINVAL; | ||
2284 | - break; | ||
2285 | - case DTV_CLEAR: | ||
2286 | - case DTV_TUNE: | ||
2287 | - case DTV_FREQUENCY: | ||
2288 | - break; | ||
2289 | - default: | ||
2290 | - r = -EINVAL; | ||
2291 | - } | ||
2292 | - return r; | ||
2293 | -} | ||
2294 | - | ||
2295 | static int jdvbt90502_set_frontend(struct dvb_frontend *fe) | ||
2296 | { | ||
2297 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; | ||
2298 | @@ -457,8 +435,6 @@ static struct dvb_frontend_ops jdvbt90502_ops = { | ||
2299 | .init = jdvbt90502_init, | ||
2300 | .write = _jdvbt90502_write, | ||
2301 | |||
2302 | - .set_property = jdvbt90502_set_property, | ||
2303 | - | ||
2304 | .set_frontend = jdvbt90502_set_frontend, | ||
2305 | |||
2306 | .read_status = jdvbt90502_read_status, | ||
2307 | diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c | ||
2308 | index 8588dbad3301..925c1828ec28 100644 | ||
2309 | --- a/drivers/mfd/wm8994-core.c | ||
2310 | +++ b/drivers/mfd/wm8994-core.c | ||
2311 | @@ -698,3 +698,4 @@ module_i2c_driver(wm8994_i2c_driver); | ||
2312 | MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC"); | ||
2313 | MODULE_LICENSE("GPL"); | ||
2314 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | ||
2315 | +MODULE_SOFTDEP("pre: wm8994_regulator"); | ||
2316 | diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c | ||
2317 | index 78e12cc8bac2..02ec2d183607 100644 | ||
2318 | --- a/drivers/mtd/nand/ams-delta.c | ||
2319 | +++ b/drivers/mtd/nand/ams-delta.c | ||
2320 | @@ -264,7 +264,7 @@ static int ams_delta_cleanup(struct platform_device *pdev) | ||
2321 | void __iomem *io_base = platform_get_drvdata(pdev); | ||
2322 | |||
2323 | /* Release resources, unregister device */ | ||
2324 | - nand_release(ams_delta_mtd); | ||
2325 | + nand_release(mtd_to_nand(ams_delta_mtd)); | ||
2326 | |||
2327 | gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); | ||
2328 | gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); | ||
2329 | diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c | ||
2330 | index 68b9160108c9..45495bc1a70e 100644 | ||
2331 | --- a/drivers/mtd/nand/atmel_nand.c | ||
2332 | +++ b/drivers/mtd/nand/atmel_nand.c | ||
2333 | @@ -2336,7 +2336,7 @@ static int atmel_nand_remove(struct platform_device *pdev) | ||
2334 | struct atmel_nand_host *host = platform_get_drvdata(pdev); | ||
2335 | struct mtd_info *mtd = nand_to_mtd(&host->nand_chip); | ||
2336 | |||
2337 | - nand_release(mtd); | ||
2338 | + nand_release(&host->nand_chip); | ||
2339 | |||
2340 | atmel_nand_disable(host); | ||
2341 | |||
2342 | diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c | ||
2343 | index 9bf6d9915694..a0e7789131df 100644 | ||
2344 | --- a/drivers/mtd/nand/au1550nd.c | ||
2345 | +++ b/drivers/mtd/nand/au1550nd.c | ||
2346 | @@ -496,7 +496,7 @@ static int au1550nd_remove(struct platform_device *pdev) | ||
2347 | struct au1550nd_ctx *ctx = platform_get_drvdata(pdev); | ||
2348 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
2349 | |||
2350 | - nand_release(nand_to_mtd(&ctx->chip)); | ||
2351 | + nand_release(&ctx->chip); | ||
2352 | iounmap(ctx->base); | ||
2353 | release_mem_region(r->start, 0x1000); | ||
2354 | kfree(ctx); | ||
2355 | diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c | ||
2356 | index fb31429b70a9..d79694160845 100644 | ||
2357 | --- a/drivers/mtd/nand/bcm47xxnflash/main.c | ||
2358 | +++ b/drivers/mtd/nand/bcm47xxnflash/main.c | ||
2359 | @@ -65,7 +65,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev) | ||
2360 | { | ||
2361 | struct bcm47xxnflash *nflash = platform_get_drvdata(pdev); | ||
2362 | |||
2363 | - nand_release(nand_to_mtd(&nflash->nand_chip)); | ||
2364 | + nand_release(&nflash->nand_chip); | ||
2365 | |||
2366 | return 0; | ||
2367 | } | ||
2368 | diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c | ||
2369 | index 3962f55bd034..020bb350a2db 100644 | ||
2370 | --- a/drivers/mtd/nand/bf5xx_nand.c | ||
2371 | +++ b/drivers/mtd/nand/bf5xx_nand.c | ||
2372 | @@ -688,7 +688,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev) | ||
2373 | * and their partitions, then go through freeing the | ||
2374 | * resources used | ||
2375 | */ | ||
2376 | - nand_release(nand_to_mtd(&info->chip)); | ||
2377 | + nand_release(&info->chip); | ||
2378 | |||
2379 | peripheral_free_list(bfin_nfc_pin_req); | ||
2380 | bf5xx_nand_dma_remove(info); | ||
2381 | diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c | ||
2382 | index 1291492a1cef..fbee81909d38 100644 | ||
2383 | --- a/drivers/mtd/nand/brcmnand/brcmnand.c | ||
2384 | +++ b/drivers/mtd/nand/brcmnand/brcmnand.c | ||
2385 | @@ -2595,7 +2595,7 @@ int brcmnand_remove(struct platform_device *pdev) | ||
2386 | struct brcmnand_host *host; | ||
2387 | |||
2388 | list_for_each_entry(host, &ctrl->host_list, node) | ||
2389 | - nand_release(nand_to_mtd(&host->chip)); | ||
2390 | + nand_release(&host->chip); | ||
2391 | |||
2392 | clk_disable_unprepare(ctrl->clk); | ||
2393 | |||
2394 | diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c | ||
2395 | index 0b0c93702abb..c16e740c01c3 100644 | ||
2396 | --- a/drivers/mtd/nand/cafe_nand.c | ||
2397 | +++ b/drivers/mtd/nand/cafe_nand.c | ||
2398 | @@ -825,7 +825,7 @@ static void cafe_nand_remove(struct pci_dev *pdev) | ||
2399 | /* Disable NAND IRQ in global IRQ mask register */ | ||
2400 | cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); | ||
2401 | free_irq(pdev->irq, mtd); | ||
2402 | - nand_release(mtd); | ||
2403 | + nand_release(chip); | ||
2404 | free_rs(cafe->rs); | ||
2405 | pci_iounmap(pdev, cafe->mmio); | ||
2406 | dma_free_coherent(&cafe->pdev->dev, | ||
2407 | diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c | ||
2408 | index 49133783ca53..b9667204e711 100644 | ||
2409 | --- a/drivers/mtd/nand/cmx270_nand.c | ||
2410 | +++ b/drivers/mtd/nand/cmx270_nand.c | ||
2411 | @@ -230,7 +230,7 @@ module_init(cmx270_init); | ||
2412 | static void __exit cmx270_cleanup(void) | ||
2413 | { | ||
2414 | /* Release resources, unregister device */ | ||
2415 | - nand_release(cmx270_nand_mtd); | ||
2416 | + nand_release(mtd_to_nand(cmx270_nand_mtd)); | ||
2417 | |||
2418 | gpio_free(GPIO_NAND_RB); | ||
2419 | gpio_free(GPIO_NAND_CS); | ||
2420 | diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c | ||
2421 | index a65e4e0f57a1..4779dfec3576 100644 | ||
2422 | --- a/drivers/mtd/nand/cs553x_nand.c | ||
2423 | +++ b/drivers/mtd/nand/cs553x_nand.c | ||
2424 | @@ -339,7 +339,7 @@ static void __exit cs553x_cleanup(void) | ||
2425 | mmio_base = this->IO_ADDR_R; | ||
2426 | |||
2427 | /* Release resources, unregister device */ | ||
2428 | - nand_release(mtd); | ||
2429 | + nand_release(this); | ||
2430 | kfree(mtd->name); | ||
2431 | cs553x_mtd[i] = NULL; | ||
2432 | |||
2433 | diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c | ||
2434 | index 27fa8b87cd5f..c7f535676e49 100644 | ||
2435 | --- a/drivers/mtd/nand/davinci_nand.c | ||
2436 | +++ b/drivers/mtd/nand/davinci_nand.c | ||
2437 | @@ -840,7 +840,7 @@ static int nand_davinci_remove(struct platform_device *pdev) | ||
2438 | ecc4_busy = false; | ||
2439 | spin_unlock_irq(&davinci_nand_lock); | ||
2440 | |||
2441 | - nand_release(nand_to_mtd(&info->chip)); | ||
2442 | + nand_release(&info->chip); | ||
2443 | |||
2444 | clk_disable_unprepare(info->clk); | ||
2445 | |||
2446 | diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c | ||
2447 | index 0476ae8776d9..982cbc7f412f 100644 | ||
2448 | --- a/drivers/mtd/nand/denali.c | ||
2449 | +++ b/drivers/mtd/nand/denali.c | ||
2450 | @@ -1655,7 +1655,7 @@ void denali_remove(struct denali_nand_info *denali) | ||
2451 | */ | ||
2452 | int bufsize = mtd->writesize + mtd->oobsize; | ||
2453 | |||
2454 | - nand_release(mtd); | ||
2455 | + nand_release(&denali->nand); | ||
2456 | denali_irq_cleanup(denali->irq, denali); | ||
2457 | dma_unmap_single(denali->dev, denali->buf.dma_buf, bufsize, | ||
2458 | DMA_BIDIRECTIONAL); | ||
2459 | diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c | ||
2460 | index a023ab9e9cbf..374b7a10ba51 100644 | ||
2461 | --- a/drivers/mtd/nand/diskonchip.c | ||
2462 | +++ b/drivers/mtd/nand/diskonchip.c | ||
2463 | @@ -1605,13 +1605,10 @@ static int __init doc_probe(unsigned long physadr) | ||
2464 | numchips = doc2001_init(mtd); | ||
2465 | |||
2466 | if ((ret = nand_scan(mtd, numchips)) || (ret = doc->late_init(mtd))) { | ||
2467 | - /* DBB note: i believe nand_release is necessary here, as | ||
2468 | + /* DBB note: i believe nand_cleanup is necessary here, as | ||
2469 | buffers may have been allocated in nand_base. Check with | ||
2470 | Thomas. FIX ME! */ | ||
2471 | - /* nand_release will call mtd_device_unregister, but we | ||
2472 | - haven't yet added it. This is handled without incident by | ||
2473 | - mtd_device_unregister, as far as I can tell. */ | ||
2474 | - nand_release(mtd); | ||
2475 | + nand_cleanup(nand); | ||
2476 | kfree(nand); | ||
2477 | goto fail; | ||
2478 | } | ||
2479 | @@ -1644,7 +1641,7 @@ static void release_nanddoc(void) | ||
2480 | doc = nand_get_controller_data(nand); | ||
2481 | |||
2482 | nextmtd = doc->nextdoc; | ||
2483 | - nand_release(mtd); | ||
2484 | + nand_release(nand); | ||
2485 | iounmap(doc->virtadr); | ||
2486 | release_mem_region(doc->physadr, DOC_IOREMAP_LEN); | ||
2487 | kfree(nand); | ||
2488 | diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c | ||
2489 | index 7af2a3cd949e..5798cd87f340 100644 | ||
2490 | --- a/drivers/mtd/nand/docg4.c | ||
2491 | +++ b/drivers/mtd/nand/docg4.c | ||
2492 | @@ -1374,7 +1374,7 @@ static int __init probe_docg4(struct platform_device *pdev) | ||
2493 | return 0; | ||
2494 | |||
2495 | fail: | ||
2496 | - nand_release(mtd); /* deletes partitions and mtd devices */ | ||
2497 | + nand_release(nand); /* deletes partitions and mtd devices */ | ||
2498 | free_bch(doc->bch); | ||
2499 | kfree(nand); | ||
2500 | |||
2501 | @@ -1387,7 +1387,7 @@ fail_unmap: | ||
2502 | static int __exit cleanup_docg4(struct platform_device *pdev) | ||
2503 | { | ||
2504 | struct docg4_priv *doc = platform_get_drvdata(pdev); | ||
2505 | - nand_release(doc->mtd); | ||
2506 | + nand_release(mtd_to_nand(doc->mtd)); | ||
2507 | free_bch(doc->bch); | ||
2508 | kfree(mtd_to_nand(doc->mtd)); | ||
2509 | iounmap(doc->virtadr); | ||
2510 | diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c | ||
2511 | index 113f76e59937..2fc4f2ab89ff 100644 | ||
2512 | --- a/drivers/mtd/nand/fsl_elbc_nand.c | ||
2513 | +++ b/drivers/mtd/nand/fsl_elbc_nand.c | ||
2514 | @@ -811,7 +811,7 @@ static int fsl_elbc_chip_remove(struct fsl_elbc_mtd *priv) | ||
2515 | struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand; | ||
2516 | struct mtd_info *mtd = nand_to_mtd(&priv->chip); | ||
2517 | |||
2518 | - nand_release(mtd); | ||
2519 | + nand_release(&priv->chip); | ||
2520 | |||
2521 | kfree(mtd->name); | ||
2522 | |||
2523 | diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c | ||
2524 | index 4c3b986dd74d..cf0fccb5908e 100644 | ||
2525 | --- a/drivers/mtd/nand/fsl_ifc_nand.c | ||
2526 | +++ b/drivers/mtd/nand/fsl_ifc_nand.c | ||
2527 | @@ -918,7 +918,7 @@ static int fsl_ifc_chip_remove(struct fsl_ifc_mtd *priv) | ||
2528 | { | ||
2529 | struct mtd_info *mtd = nand_to_mtd(&priv->chip); | ||
2530 | |||
2531 | - nand_release(mtd); | ||
2532 | + nand_release(&priv->chip); | ||
2533 | |||
2534 | kfree(mtd->name); | ||
2535 | |||
2536 | diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c | ||
2537 | index d85fa2555b68..0b4d2489cc71 100644 | ||
2538 | --- a/drivers/mtd/nand/fsl_upm.c | ||
2539 | +++ b/drivers/mtd/nand/fsl_upm.c | ||
2540 | @@ -326,7 +326,7 @@ static int fun_remove(struct platform_device *ofdev) | ||
2541 | struct mtd_info *mtd = nand_to_mtd(&fun->chip); | ||
2542 | int i; | ||
2543 | |||
2544 | - nand_release(mtd); | ||
2545 | + nand_release(&fun->chip); | ||
2546 | kfree(mtd->name); | ||
2547 | |||
2548 | for (i = 0; i < fun->mchip_count; i++) { | ||
2549 | diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c | ||
2550 | index d4f454a4b35e..92737deb7845 100644 | ||
2551 | --- a/drivers/mtd/nand/fsmc_nand.c | ||
2552 | +++ b/drivers/mtd/nand/fsmc_nand.c | ||
2553 | @@ -1038,7 +1038,7 @@ static int fsmc_nand_remove(struct platform_device *pdev) | ||
2554 | struct fsmc_nand_data *host = platform_get_drvdata(pdev); | ||
2555 | |||
2556 | if (host) { | ||
2557 | - nand_release(nand_to_mtd(&host->nand)); | ||
2558 | + nand_release(&host->nand); | ||
2559 | |||
2560 | if (host->mode == USE_DMA_ACCESS) { | ||
2561 | dma_release_channel(host->write_dma_chan); | ||
2562 | diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c | ||
2563 | index 6317f6836022..c7461ca1c1a6 100644 | ||
2564 | --- a/drivers/mtd/nand/gpio.c | ||
2565 | +++ b/drivers/mtd/nand/gpio.c | ||
2566 | @@ -197,7 +197,7 @@ static int gpio_nand_remove(struct platform_device *pdev) | ||
2567 | { | ||
2568 | struct gpiomtd *gpiomtd = platform_get_drvdata(pdev); | ||
2569 | |||
2570 | - nand_release(nand_to_mtd(&gpiomtd->nand_chip)); | ||
2571 | + nand_release(&gpiomtd->nand_chip); | ||
2572 | |||
2573 | if (gpio_is_valid(gpiomtd->plat.gpio_nwp)) | ||
2574 | gpio_set_value(gpiomtd->plat.gpio_nwp, 0); | ||
2575 | diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | ||
2576 | index d9dab4275859..f4a99e91c250 100644 | ||
2577 | --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | ||
2578 | +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | ||
2579 | @@ -1930,7 +1930,7 @@ static int gpmi_set_geometry(struct gpmi_nand_data *this) | ||
2580 | |||
2581 | static void gpmi_nand_exit(struct gpmi_nand_data *this) | ||
2582 | { | ||
2583 | - nand_release(nand_to_mtd(&this->nand)); | ||
2584 | + nand_release(&this->nand); | ||
2585 | gpmi_free_dma_buffer(this); | ||
2586 | } | ||
2587 | |||
2588 | diff --git a/drivers/mtd/nand/hisi504_nand.c b/drivers/mtd/nand/hisi504_nand.c | ||
2589 | index 9432546f4cd4..6c96d9d29a31 100644 | ||
2590 | --- a/drivers/mtd/nand/hisi504_nand.c | ||
2591 | +++ b/drivers/mtd/nand/hisi504_nand.c | ||
2592 | @@ -823,7 +823,7 @@ static int hisi_nfc_probe(struct platform_device *pdev) | ||
2593 | return 0; | ||
2594 | |||
2595 | err_mtd: | ||
2596 | - nand_release(mtd); | ||
2597 | + nand_release(chip); | ||
2598 | err_res: | ||
2599 | return ret; | ||
2600 | } | ||
2601 | @@ -831,9 +831,8 @@ err_res: | ||
2602 | static int hisi_nfc_remove(struct platform_device *pdev) | ||
2603 | { | ||
2604 | struct hinfc_host *host = platform_get_drvdata(pdev); | ||
2605 | - struct mtd_info *mtd = nand_to_mtd(&host->chip); | ||
2606 | |||
2607 | - nand_release(mtd); | ||
2608 | + nand_release(&host->chip); | ||
2609 | |||
2610 | return 0; | ||
2611 | } | ||
2612 | diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c | ||
2613 | index 5551c36adbdf..6f323858d51a 100644 | ||
2614 | --- a/drivers/mtd/nand/jz4740_nand.c | ||
2615 | +++ b/drivers/mtd/nand/jz4740_nand.c | ||
2616 | @@ -499,7 +499,7 @@ static int jz_nand_probe(struct platform_device *pdev) | ||
2617 | return 0; | ||
2618 | |||
2619 | err_nand_release: | ||
2620 | - nand_release(mtd); | ||
2621 | + nand_release(chip); | ||
2622 | err_unclaim_banks: | ||
2623 | while (chipnr--) { | ||
2624 | unsigned char bank = nand->banks[chipnr]; | ||
2625 | @@ -520,7 +520,7 @@ static int jz_nand_remove(struct platform_device *pdev) | ||
2626 | struct jz_nand *nand = platform_get_drvdata(pdev); | ||
2627 | size_t i; | ||
2628 | |||
2629 | - nand_release(nand_to_mtd(&nand->chip)); | ||
2630 | + nand_release(&nand->chip); | ||
2631 | |||
2632 | /* Deassert and disable all chips */ | ||
2633 | writel(0, nand->base + JZ_REG_NAND_CTRL); | ||
2634 | diff --git a/drivers/mtd/nand/jz4780_nand.c b/drivers/mtd/nand/jz4780_nand.c | ||
2635 | index a39bb70175ee..e8aaf2543946 100644 | ||
2636 | --- a/drivers/mtd/nand/jz4780_nand.c | ||
2637 | +++ b/drivers/mtd/nand/jz4780_nand.c | ||
2638 | @@ -293,7 +293,7 @@ static int jz4780_nand_init_chip(struct platform_device *pdev, | ||
2639 | |||
2640 | ret = mtd_device_register(mtd, NULL, 0); | ||
2641 | if (ret) { | ||
2642 | - nand_release(mtd); | ||
2643 | + nand_release(chip); | ||
2644 | return ret; | ||
2645 | } | ||
2646 | |||
2647 | @@ -308,7 +308,7 @@ static void jz4780_nand_cleanup_chips(struct jz4780_nand_controller *nfc) | ||
2648 | |||
2649 | while (!list_empty(&nfc->chips)) { | ||
2650 | chip = list_first_entry(&nfc->chips, struct jz4780_nand_chip, chip_list); | ||
2651 | - nand_release(nand_to_mtd(&chip->chip)); | ||
2652 | + nand_release(&chip->chip); | ||
2653 | list_del(&chip->chip_list); | ||
2654 | } | ||
2655 | } | ||
2656 | diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c | ||
2657 | index bc6e49af063a..839f8f4ace9e 100644 | ||
2658 | --- a/drivers/mtd/nand/lpc32xx_mlc.c | ||
2659 | +++ b/drivers/mtd/nand/lpc32xx_mlc.c | ||
2660 | @@ -805,7 +805,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) | ||
2661 | if (!res) | ||
2662 | return res; | ||
2663 | |||
2664 | - nand_release(mtd); | ||
2665 | + nand_release(nand_chip); | ||
2666 | |||
2667 | err_exit4: | ||
2668 | free_irq(host->irq, host); | ||
2669 | @@ -828,9 +828,8 @@ err_exit1: | ||
2670 | static int lpc32xx_nand_remove(struct platform_device *pdev) | ||
2671 | { | ||
2672 | struct lpc32xx_nand_host *host = platform_get_drvdata(pdev); | ||
2673 | - struct mtd_info *mtd = nand_to_mtd(&host->nand_chip); | ||
2674 | |||
2675 | - nand_release(mtd); | ||
2676 | + nand_release(&host->nand_chip); | ||
2677 | free_irq(host->irq, host); | ||
2678 | if (use_dma) | ||
2679 | dma_release_channel(host->dma_chan); | ||
2680 | diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c | ||
2681 | index 8d3edc34958e..0b5fa254ea60 100644 | ||
2682 | --- a/drivers/mtd/nand/lpc32xx_slc.c | ||
2683 | +++ b/drivers/mtd/nand/lpc32xx_slc.c | ||
2684 | @@ -940,7 +940,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) | ||
2685 | if (!res) | ||
2686 | return res; | ||
2687 | |||
2688 | - nand_release(mtd); | ||
2689 | + nand_release(chip); | ||
2690 | |||
2691 | err_exit3: | ||
2692 | dma_release_channel(host->dma_chan); | ||
2693 | @@ -959,9 +959,8 @@ static int lpc32xx_nand_remove(struct platform_device *pdev) | ||
2694 | { | ||
2695 | uint32_t tmp; | ||
2696 | struct lpc32xx_nand_host *host = platform_get_drvdata(pdev); | ||
2697 | - struct mtd_info *mtd = nand_to_mtd(&host->nand_chip); | ||
2698 | |||
2699 | - nand_release(mtd); | ||
2700 | + nand_release(&host->nand_chip); | ||
2701 | dma_release_channel(host->dma_chan); | ||
2702 | |||
2703 | /* Force CE high */ | ||
2704 | diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c | ||
2705 | index 7eacb2f545f5..9662f8fe4713 100644 | ||
2706 | --- a/drivers/mtd/nand/mpc5121_nfc.c | ||
2707 | +++ b/drivers/mtd/nand/mpc5121_nfc.c | ||
2708 | @@ -827,7 +827,7 @@ static int mpc5121_nfc_remove(struct platform_device *op) | ||
2709 | struct device *dev = &op->dev; | ||
2710 | struct mtd_info *mtd = dev_get_drvdata(dev); | ||
2711 | |||
2712 | - nand_release(mtd); | ||
2713 | + nand_release(mtd_to_nand(mtd)); | ||
2714 | mpc5121_nfc_free(dev, mtd); | ||
2715 | |||
2716 | return 0; | ||
2717 | diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c | ||
2718 | index ca95ae00215e..2375dce766ef 100644 | ||
2719 | --- a/drivers/mtd/nand/mtk_nand.c | ||
2720 | +++ b/drivers/mtd/nand/mtk_nand.c | ||
2721 | @@ -1327,7 +1327,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc, | ||
2722 | ret = mtd_device_parse_register(mtd, NULL, NULL, NULL, 0); | ||
2723 | if (ret) { | ||
2724 | dev_err(dev, "mtd parse partition error\n"); | ||
2725 | - nand_release(mtd); | ||
2726 | + nand_cleanup(nand); | ||
2727 | return ret; | ||
2728 | } | ||
2729 | |||
2730 | @@ -1450,7 +1450,7 @@ static int mtk_nfc_remove(struct platform_device *pdev) | ||
2731 | while (!list_empty(&nfc->chips)) { | ||
2732 | chip = list_first_entry(&nfc->chips, struct mtk_nfc_nand_chip, | ||
2733 | node); | ||
2734 | - nand_release(nand_to_mtd(&chip->nand)); | ||
2735 | + nand_release(&chip->nand); | ||
2736 | list_del(&chip->node); | ||
2737 | } | ||
2738 | |||
2739 | diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c | ||
2740 | index 5c44eb57885b..deb3cbadbc51 100644 | ||
2741 | --- a/drivers/mtd/nand/mxc_nand.c | ||
2742 | +++ b/drivers/mtd/nand/mxc_nand.c | ||
2743 | @@ -1838,7 +1838,7 @@ static int mxcnd_remove(struct platform_device *pdev) | ||
2744 | { | ||
2745 | struct mxc_nand_host *host = platform_get_drvdata(pdev); | ||
2746 | |||
2747 | - nand_release(nand_to_mtd(&host->nand)); | ||
2748 | + nand_release(&host->nand); | ||
2749 | if (host->clk_act) | ||
2750 | clk_disable_unprepare(host->clk); | ||
2751 | |||
2752 | diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c | ||
2753 | index 5fb45161789c..bdf40c090acd 100644 | ||
2754 | --- a/drivers/mtd/nand/nand_base.c | ||
2755 | +++ b/drivers/mtd/nand/nand_base.c | ||
2756 | @@ -4941,12 +4941,12 @@ EXPORT_SYMBOL_GPL(nand_cleanup); | ||
2757 | /** | ||
2758 | * nand_release - [NAND Interface] Unregister the MTD device and free resources | ||
2759 | * held by the NAND device | ||
2760 | - * @mtd: MTD device structure | ||
2761 | + * @chip: NAND chip object | ||
2762 | */ | ||
2763 | -void nand_release(struct mtd_info *mtd) | ||
2764 | +void nand_release(struct nand_chip *chip) | ||
2765 | { | ||
2766 | - mtd_device_unregister(mtd); | ||
2767 | - nand_cleanup(mtd_to_nand(mtd)); | ||
2768 | + mtd_device_unregister(nand_to_mtd(chip)); | ||
2769 | + nand_cleanup(chip); | ||
2770 | } | ||
2771 | EXPORT_SYMBOL_GPL(nand_release); | ||
2772 | |||
2773 | diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c | ||
2774 | index 1eb934414eb5..fe593f2f1ec7 100644 | ||
2775 | --- a/drivers/mtd/nand/nandsim.c | ||
2776 | +++ b/drivers/mtd/nand/nandsim.c | ||
2777 | @@ -2394,7 +2394,7 @@ static int __init ns_init_module(void) | ||
2778 | |||
2779 | err_exit: | ||
2780 | free_nandsim(nand); | ||
2781 | - nand_release(nsmtd); | ||
2782 | + nand_release(chip); | ||
2783 | for (i = 0;i < ARRAY_SIZE(nand->partitions); ++i) | ||
2784 | kfree(nand->partitions[i].name); | ||
2785 | error: | ||
2786 | @@ -2417,7 +2417,7 @@ static void __exit ns_cleanup_module(void) | ||
2787 | |||
2788 | nandsim_debugfs_remove(ns); | ||
2789 | free_nandsim(ns); /* Free nandsim private resources */ | ||
2790 | - nand_release(nsmtd); /* Unregister driver */ | ||
2791 | + nand_release(chip); /* Unregister driver */ | ||
2792 | for (i = 0;i < ARRAY_SIZE(ns->partitions); ++i) | ||
2793 | kfree(ns->partitions[i].name); | ||
2794 | kfree(mtd_to_nand(nsmtd)); /* Free other structures */ | ||
2795 | diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c | ||
2796 | index 28e6118362f7..d03b47d2664b 100644 | ||
2797 | --- a/drivers/mtd/nand/ndfc.c | ||
2798 | +++ b/drivers/mtd/nand/ndfc.c | ||
2799 | @@ -258,7 +258,7 @@ static int ndfc_remove(struct platform_device *ofdev) | ||
2800 | struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev); | ||
2801 | struct mtd_info *mtd = nand_to_mtd(&ndfc->chip); | ||
2802 | |||
2803 | - nand_release(mtd); | ||
2804 | + nand_release(&ndfc->chip); | ||
2805 | kfree(mtd->name); | ||
2806 | |||
2807 | return 0; | ||
2808 | diff --git a/drivers/mtd/nand/nuc900_nand.c b/drivers/mtd/nand/nuc900_nand.c | ||
2809 | index 8f64011d32ef..f7f54b46f246 100644 | ||
2810 | --- a/drivers/mtd/nand/nuc900_nand.c | ||
2811 | +++ b/drivers/mtd/nand/nuc900_nand.c | ||
2812 | @@ -284,7 +284,7 @@ static int nuc900_nand_remove(struct platform_device *pdev) | ||
2813 | { | ||
2814 | struct nuc900_nand *nuc900_nand = platform_get_drvdata(pdev); | ||
2815 | |||
2816 | - nand_release(nand_to_mtd(&nuc900_nand->chip)); | ||
2817 | + nand_release(&nuc900_nand->chip); | ||
2818 | clk_disable(nuc900_nand->clk); | ||
2819 | |||
2820 | return 0; | ||
2821 | diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c | ||
2822 | index f3a516b3f108..62c0ca437c91 100644 | ||
2823 | --- a/drivers/mtd/nand/omap2.c | ||
2824 | +++ b/drivers/mtd/nand/omap2.c | ||
2825 | @@ -2307,7 +2307,7 @@ static int omap_nand_remove(struct platform_device *pdev) | ||
2826 | } | ||
2827 | if (info->dma) | ||
2828 | dma_release_channel(info->dma); | ||
2829 | - nand_release(mtd); | ||
2830 | + nand_release(nand_chip); | ||
2831 | return 0; | ||
2832 | } | ||
2833 | |||
2834 | diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c | ||
2835 | index af2f09135fb0..0acfc0a7d8e0 100644 | ||
2836 | --- a/drivers/mtd/nand/orion_nand.c | ||
2837 | +++ b/drivers/mtd/nand/orion_nand.c | ||
2838 | @@ -167,7 +167,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) | ||
2839 | mtd->name = "orion_nand"; | ||
2840 | ret = mtd_device_register(mtd, board->parts, board->nr_parts); | ||
2841 | if (ret) { | ||
2842 | - nand_release(mtd); | ||
2843 | + nand_cleanup(nc); | ||
2844 | goto no_dev; | ||
2845 | } | ||
2846 | |||
2847 | @@ -184,9 +184,8 @@ static int orion_nand_remove(struct platform_device *pdev) | ||
2848 | { | ||
2849 | struct orion_nand_info *info = platform_get_drvdata(pdev); | ||
2850 | struct nand_chip *chip = &info->chip; | ||
2851 | - struct mtd_info *mtd = nand_to_mtd(chip); | ||
2852 | |||
2853 | - nand_release(mtd); | ||
2854 | + nand_release(chip); | ||
2855 | |||
2856 | if (!IS_ERR(info->clk)) | ||
2857 | clk_disable_unprepare(info->clk); | ||
2858 | diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c | ||
2859 | index 80c98eef44d9..3300e43e2cb9 100644 | ||
2860 | --- a/drivers/mtd/nand/pasemi_nand.c | ||
2861 | +++ b/drivers/mtd/nand/pasemi_nand.c | ||
2862 | @@ -194,7 +194,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev) | ||
2863 | chip = mtd_to_nand(pasemi_nand_mtd); | ||
2864 | |||
2865 | /* Release resources, unregister device */ | ||
2866 | - nand_release(pasemi_nand_mtd); | ||
2867 | + nand_release(chip); | ||
2868 | |||
2869 | release_region(lpcctl, 4); | ||
2870 | |||
2871 | diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c | ||
2872 | index 415a53a0deeb..ae2b3c0804ce 100644 | ||
2873 | --- a/drivers/mtd/nand/plat_nand.c | ||
2874 | +++ b/drivers/mtd/nand/plat_nand.c | ||
2875 | @@ -100,7 +100,7 @@ static int plat_nand_probe(struct platform_device *pdev) | ||
2876 | if (!err) | ||
2877 | return err; | ||
2878 | |||
2879 | - nand_release(mtd); | ||
2880 | + nand_cleanup(&data->chip); | ||
2881 | out: | ||
2882 | if (pdata->ctrl.remove) | ||
2883 | pdata->ctrl.remove(pdev); | ||
2884 | @@ -115,7 +115,7 @@ static int plat_nand_remove(struct platform_device *pdev) | ||
2885 | struct plat_nand_data *data = platform_get_drvdata(pdev); | ||
2886 | struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev); | ||
2887 | |||
2888 | - nand_release(nand_to_mtd(&data->chip)); | ||
2889 | + nand_release(&data->chip); | ||
2890 | if (pdata->ctrl.remove) | ||
2891 | pdata->ctrl.remove(pdev); | ||
2892 | |||
2893 | diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c | ||
2894 | index 3b8911cd3a19..46f13f7e54da 100644 | ||
2895 | --- a/drivers/mtd/nand/pxa3xx_nand.c | ||
2896 | +++ b/drivers/mtd/nand/pxa3xx_nand.c | ||
2897 | @@ -1907,7 +1907,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) | ||
2898 | clk_disable_unprepare(info->clk); | ||
2899 | |||
2900 | for (cs = 0; cs < pdata->num_cs; cs++) | ||
2901 | - nand_release(nand_to_mtd(&info->host[cs]->chip)); | ||
2902 | + nand_release(&info->host[cs]->chip); | ||
2903 | return 0; | ||
2904 | } | ||
2905 | |||
2906 | diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c | ||
2907 | index 9f6c9a34b9eb..1594770987fd 100644 | ||
2908 | --- a/drivers/mtd/nand/qcom_nandc.c | ||
2909 | +++ b/drivers/mtd/nand/qcom_nandc.c | ||
2910 | @@ -2163,7 +2163,7 @@ static int qcom_nandc_probe(struct platform_device *pdev) | ||
2911 | |||
2912 | err_cs_init: | ||
2913 | list_for_each_entry(host, &nandc->host_list, node) | ||
2914 | - nand_release(nand_to_mtd(&host->chip)); | ||
2915 | + nand_release(&host->chip); | ||
2916 | err_setup: | ||
2917 | clk_disable_unprepare(nandc->aon_clk); | ||
2918 | err_aon_clk: | ||
2919 | @@ -2180,7 +2180,7 @@ static int qcom_nandc_remove(struct platform_device *pdev) | ||
2920 | struct qcom_nand_host *host; | ||
2921 | |||
2922 | list_for_each_entry(host, &nandc->host_list, node) | ||
2923 | - nand_release(nand_to_mtd(&host->chip)); | ||
2924 | + nand_release(&host->chip); | ||
2925 | |||
2926 | qcom_nandc_unalloc(nandc); | ||
2927 | |||
2928 | diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c | ||
2929 | index fc9287af4614..2cfa54941395 100644 | ||
2930 | --- a/drivers/mtd/nand/r852.c | ||
2931 | +++ b/drivers/mtd/nand/r852.c | ||
2932 | @@ -656,7 +656,7 @@ static int r852_register_nand_device(struct r852_device *dev) | ||
2933 | dev->card_registred = 1; | ||
2934 | return 0; | ||
2935 | error3: | ||
2936 | - nand_release(mtd); | ||
2937 | + nand_release(dev->chip); | ||
2938 | error1: | ||
2939 | /* Force card redetect */ | ||
2940 | dev->card_detected = 0; | ||
2941 | @@ -675,7 +675,7 @@ static void r852_unregister_nand_device(struct r852_device *dev) | ||
2942 | return; | ||
2943 | |||
2944 | device_remove_file(&mtd->dev, &dev_attr_media_type); | ||
2945 | - nand_release(mtd); | ||
2946 | + nand_release(dev->chip); | ||
2947 | r852_engine_disable(dev); | ||
2948 | dev->card_registred = 0; | ||
2949 | } | ||
2950 | diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c | ||
2951 | index d459c19d78de..be9c145b743c 100644 | ||
2952 | --- a/drivers/mtd/nand/s3c2410.c | ||
2953 | +++ b/drivers/mtd/nand/s3c2410.c | ||
2954 | @@ -768,7 +768,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev) | ||
2955 | |||
2956 | for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) { | ||
2957 | pr_debug("releasing mtd %d (%p)\n", mtdno, ptr); | ||
2958 | - nand_release(nand_to_mtd(&ptr->chip)); | ||
2959 | + nand_release(&ptr->chip); | ||
2960 | } | ||
2961 | } | ||
2962 | |||
2963 | diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c | ||
2964 | index d6c013f93b8c..31f98acdba07 100644 | ||
2965 | --- a/drivers/mtd/nand/sh_flctl.c | ||
2966 | +++ b/drivers/mtd/nand/sh_flctl.c | ||
2967 | @@ -1229,7 +1229,7 @@ static int flctl_remove(struct platform_device *pdev) | ||
2968 | struct sh_flctl *flctl = platform_get_drvdata(pdev); | ||
2969 | |||
2970 | flctl_release_dma(flctl); | ||
2971 | - nand_release(nand_to_mtd(&flctl->chip)); | ||
2972 | + nand_release(&flctl->chip); | ||
2973 | pm_runtime_disable(&pdev->dev); | ||
2974 | |||
2975 | return 0; | ||
2976 | diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c | ||
2977 | index 064ca1757589..661b4928e0fc 100644 | ||
2978 | --- a/drivers/mtd/nand/sharpsl.c | ||
2979 | +++ b/drivers/mtd/nand/sharpsl.c | ||
2980 | @@ -192,7 +192,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev) | ||
2981 | return 0; | ||
2982 | |||
2983 | err_add: | ||
2984 | - nand_release(mtd); | ||
2985 | + nand_cleanup(this); | ||
2986 | |||
2987 | err_scan: | ||
2988 | iounmap(sharpsl->io); | ||
2989 | @@ -210,7 +210,7 @@ static int sharpsl_nand_remove(struct platform_device *pdev) | ||
2990 | struct sharpsl_nand *sharpsl = platform_get_drvdata(pdev); | ||
2991 | |||
2992 | /* Release resources, unregister device */ | ||
2993 | - nand_release(nand_to_mtd(&sharpsl->chip)); | ||
2994 | + nand_release(&sharpsl->chip); | ||
2995 | |||
2996 | iounmap(sharpsl->io); | ||
2997 | |||
2998 | diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c | ||
2999 | index 888fd314c62a..957d9597c484 100644 | ||
3000 | --- a/drivers/mtd/nand/socrates_nand.c | ||
3001 | +++ b/drivers/mtd/nand/socrates_nand.c | ||
3002 | @@ -203,7 +203,7 @@ static int socrates_nand_probe(struct platform_device *ofdev) | ||
3003 | if (!res) | ||
3004 | return res; | ||
3005 | |||
3006 | - nand_release(mtd); | ||
3007 | + nand_cleanup(nand_chip); | ||
3008 | |||
3009 | out: | ||
3010 | iounmap(host->io_base); | ||
3011 | @@ -216,9 +216,8 @@ out: | ||
3012 | static int socrates_nand_remove(struct platform_device *ofdev) | ||
3013 | { | ||
3014 | struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev); | ||
3015 | - struct mtd_info *mtd = nand_to_mtd(&host->nand_chip); | ||
3016 | |||
3017 | - nand_release(mtd); | ||
3018 | + nand_release(&host->nand_chip); | ||
3019 | |||
3020 | iounmap(host->io_base); | ||
3021 | |||
3022 | diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c | ||
3023 | index 886355bfa761..ddf3e24cc289 100644 | ||
3024 | --- a/drivers/mtd/nand/sunxi_nand.c | ||
3025 | +++ b/drivers/mtd/nand/sunxi_nand.c | ||
3026 | @@ -2108,7 +2108,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc, | ||
3027 | ret = mtd_device_register(mtd, NULL, 0); | ||
3028 | if (ret) { | ||
3029 | dev_err(dev, "failed to register mtd device: %d\n", ret); | ||
3030 | - nand_release(mtd); | ||
3031 | + nand_release(nand); | ||
3032 | return ret; | ||
3033 | } | ||
3034 | |||
3035 | @@ -2147,7 +2147,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc) | ||
3036 | while (!list_empty(&nfc->chips)) { | ||
3037 | chip = list_first_entry(&nfc->chips, struct sunxi_nand_chip, | ||
3038 | node); | ||
3039 | - nand_release(nand_to_mtd(&chip->nand)); | ||
3040 | + nand_release(&chip->nand); | ||
3041 | sunxi_nand_ecc_cleanup(&chip->nand.ecc); | ||
3042 | list_del(&chip->node); | ||
3043 | } | ||
3044 | diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c | ||
3045 | index 08b30549ec0a..d07c729f5b9b 100644 | ||
3046 | --- a/drivers/mtd/nand/tmio_nand.c | ||
3047 | +++ b/drivers/mtd/nand/tmio_nand.c | ||
3048 | @@ -446,7 +446,7 @@ static int tmio_probe(struct platform_device *dev) | ||
3049 | if (!retval) | ||
3050 | return retval; | ||
3051 | |||
3052 | - nand_release(mtd); | ||
3053 | + nand_cleanup(nand_chip); | ||
3054 | |||
3055 | err_irq: | ||
3056 | tmio_hw_stop(dev, tmio); | ||
3057 | @@ -457,7 +457,7 @@ static int tmio_remove(struct platform_device *dev) | ||
3058 | { | ||
3059 | struct tmio_nand *tmio = platform_get_drvdata(dev); | ||
3060 | |||
3061 | - nand_release(nand_to_mtd(&tmio->chip)); | ||
3062 | + nand_release(&tmio->chip); | ||
3063 | tmio_hw_stop(dev, tmio); | ||
3064 | return 0; | ||
3065 | } | ||
3066 | diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c | ||
3067 | index 0a14fda2e41b..f2ba55b0a1e9 100644 | ||
3068 | --- a/drivers/mtd/nand/txx9ndfmc.c | ||
3069 | +++ b/drivers/mtd/nand/txx9ndfmc.c | ||
3070 | @@ -390,7 +390,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) | ||
3071 | chip = mtd_to_nand(mtd); | ||
3072 | txx9_priv = nand_get_controller_data(chip); | ||
3073 | |||
3074 | - nand_release(mtd); | ||
3075 | + nand_release(chip); | ||
3076 | kfree(txx9_priv->mtdname); | ||
3077 | kfree(txx9_priv); | ||
3078 | } | ||
3079 | diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c | ||
3080 | index ddc629e3f63a..ec004e0a94a3 100644 | ||
3081 | --- a/drivers/mtd/nand/vf610_nfc.c | ||
3082 | +++ b/drivers/mtd/nand/vf610_nfc.c | ||
3083 | @@ -795,7 +795,7 @@ static int vf610_nfc_remove(struct platform_device *pdev) | ||
3084 | struct mtd_info *mtd = platform_get_drvdata(pdev); | ||
3085 | struct vf610_nfc *nfc = mtd_to_nfc(mtd); | ||
3086 | |||
3087 | - nand_release(mtd); | ||
3088 | + nand_release(mtd_to_nand(mtd)); | ||
3089 | clk_disable_unprepare(nfc->clk); | ||
3090 | return 0; | ||
3091 | } | ||
3092 | diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c | ||
3093 | index 895101a5e686..3d51b8fc5aaf 100644 | ||
3094 | --- a/drivers/mtd/nand/xway_nand.c | ||
3095 | +++ b/drivers/mtd/nand/xway_nand.c | ||
3096 | @@ -211,7 +211,7 @@ static int xway_nand_probe(struct platform_device *pdev) | ||
3097 | |||
3098 | err = mtd_device_register(mtd, NULL, 0); | ||
3099 | if (err) | ||
3100 | - nand_release(mtd); | ||
3101 | + nand_cleanup(&data->chip); | ||
3102 | |||
3103 | return err; | ||
3104 | } | ||
3105 | @@ -223,7 +223,7 @@ static int xway_nand_remove(struct platform_device *pdev) | ||
3106 | { | ||
3107 | struct xway_nand_data *data = platform_get_drvdata(pdev); | ||
3108 | |||
3109 | - nand_release(nand_to_mtd(&data->chip)); | ||
3110 | + nand_release(&data->chip); | ||
3111 | |||
3112 | return 0; | ||
3113 | } | ||
3114 | diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c | ||
3115 | index c0f84b73574d..2a5bb1012385 100644 | ||
3116 | --- a/drivers/net/ethernet/atheros/alx/main.c | ||
3117 | +++ b/drivers/net/ethernet/atheros/alx/main.c | ||
3118 | @@ -1056,8 +1056,12 @@ out_disable_adv_intr: | ||
3119 | |||
3120 | static void __alx_stop(struct alx_priv *alx) | ||
3121 | { | ||
3122 | - alx_halt(alx); | ||
3123 | alx_free_irq(alx); | ||
3124 | + | ||
3125 | + cancel_work_sync(&alx->link_check_wk); | ||
3126 | + cancel_work_sync(&alx->reset_wk); | ||
3127 | + | ||
3128 | + alx_halt(alx); | ||
3129 | alx_free_rings(alx); | ||
3130 | } | ||
3131 | |||
3132 | @@ -1659,9 +1663,6 @@ static void alx_remove(struct pci_dev *pdev) | ||
3133 | struct alx_priv *alx = pci_get_drvdata(pdev); | ||
3134 | struct alx_hw *hw = &alx->hw; | ||
3135 | |||
3136 | - cancel_work_sync(&alx->link_check_wk); | ||
3137 | - cancel_work_sync(&alx->reset_wk); | ||
3138 | - | ||
3139 | /* restore permanent mac address */ | ||
3140 | alx_set_macaddr(hw, hw->perm_addr); | ||
3141 | |||
3142 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c | ||
3143 | index c069a04a6e7e..5790b35064a8 100644 | ||
3144 | --- a/drivers/net/ethernet/broadcom/tg3.c | ||
3145 | +++ b/drivers/net/ethernet/broadcom/tg3.c | ||
3146 | @@ -18174,8 +18174,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | ||
3147 | |||
3148 | rtnl_lock(); | ||
3149 | |||
3150 | - /* We probably don't have netdev yet */ | ||
3151 | - if (!netdev || !netif_running(netdev)) | ||
3152 | + /* Could be second call or maybe we don't have netdev yet */ | ||
3153 | + if (!netdev || tp->pcierr_recovery || !netif_running(netdev)) | ||
3154 | goto done; | ||
3155 | |||
3156 | /* We needn't recover from permanent error */ | ||
3157 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
3158 | index be324b4761eb..3c01bc43889a 100644 | ||
3159 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c | ||
3160 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
3161 | @@ -6315,11 +6315,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | ||
3162 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
3163 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
3164 | struct e1000_hw *hw = &adapter->hw; | ||
3165 | - u32 ctrl, ctrl_ext, rctl, status; | ||
3166 | - /* Runtime suspend should only enable wakeup for link changes */ | ||
3167 | - u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; | ||
3168 | + u32 ctrl, ctrl_ext, rctl, status, wufc; | ||
3169 | int retval = 0; | ||
3170 | |||
3171 | + /* Runtime suspend should only enable wakeup for link changes */ | ||
3172 | + if (runtime) | ||
3173 | + wufc = E1000_WUFC_LNKC; | ||
3174 | + else if (device_may_wakeup(&pdev->dev)) | ||
3175 | + wufc = adapter->wol; | ||
3176 | + else | ||
3177 | + wufc = 0; | ||
3178 | + | ||
3179 | status = er32(STATUS); | ||
3180 | if (status & E1000_STATUS_LU) | ||
3181 | wufc &= ~E1000_WUFC_LNKC; | ||
3182 | @@ -6377,7 +6383,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) | ||
3183 | e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); | ||
3184 | } else if ((hw->mac.type == e1000_pch_lpt) || | ||
3185 | (hw->mac.type == e1000_pch_spt)) { | ||
3186 | - if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) | ||
3187 | + if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) | ||
3188 | /* ULP does not support wake from unicast, multicast | ||
3189 | * or broadcast. | ||
3190 | */ | ||
3191 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c | ||
3192 | index f1956c4d02a0..d026da36e47e 100644 | ||
3193 | --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c | ||
3194 | +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c | ||
3195 | @@ -339,7 +339,7 @@ static void qed_cxt_qm_iids(struct qed_hwfn *p_hwfn, | ||
3196 | vf_tids += segs[NUM_TASK_PF_SEGMENTS].count; | ||
3197 | } | ||
3198 | |||
3199 | - iids->vf_cids += vf_cids * p_mngr->vf_count; | ||
3200 | + iids->vf_cids = vf_cids; | ||
3201 | iids->tids += vf_tids * p_mngr->vf_count; | ||
3202 | |||
3203 | DP_VERBOSE(p_hwfn, QED_MSG_ILT, | ||
3204 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c | ||
3205 | index cf34908ec8e1..170243d3276b 100644 | ||
3206 | --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c | ||
3207 | +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c | ||
3208 | @@ -57,12 +57,17 @@ static void qed_vf_pf_req_end(struct qed_hwfn *p_hwfn, int req_status) | ||
3209 | mutex_unlock(&(p_hwfn->vf_iov_info->mutex)); | ||
3210 | } | ||
3211 | |||
3212 | +#define QED_VF_CHANNEL_USLEEP_ITERATIONS 90 | ||
3213 | +#define QED_VF_CHANNEL_USLEEP_DELAY 100 | ||
3214 | +#define QED_VF_CHANNEL_MSLEEP_ITERATIONS 10 | ||
3215 | +#define QED_VF_CHANNEL_MSLEEP_DELAY 25 | ||
3216 | + | ||
3217 | static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size) | ||
3218 | { | ||
3219 | union vfpf_tlvs *p_req = p_hwfn->vf_iov_info->vf2pf_request; | ||
3220 | struct ustorm_trigger_vf_zone trigger; | ||
3221 | struct ustorm_vf_zone *zone_data; | ||
3222 | - int rc = 0, time = 100; | ||
3223 | + int iter, rc = 0; | ||
3224 | |||
3225 | zone_data = (struct ustorm_vf_zone *)PXP_VF_BAR0_START_USDM_ZONE_B; | ||
3226 | |||
3227 | @@ -102,11 +107,19 @@ static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size) | ||
3228 | REG_WR(p_hwfn, (uintptr_t)&zone_data->trigger, *((u32 *)&trigger)); | ||
3229 | |||
3230 | /* When PF would be done with the response, it would write back to the | ||
3231 | - * `done' address. Poll until then. | ||
3232 | + * `done' address from a coherent DMA zone. Poll until then. | ||
3233 | */ | ||
3234 | - while ((!*done) && time) { | ||
3235 | - msleep(25); | ||
3236 | - time--; | ||
3237 | + | ||
3238 | + iter = QED_VF_CHANNEL_USLEEP_ITERATIONS; | ||
3239 | + while (!*done && iter--) { | ||
3240 | + udelay(QED_VF_CHANNEL_USLEEP_DELAY); | ||
3241 | + dma_rmb(); | ||
3242 | + } | ||
3243 | + | ||
3244 | + iter = QED_VF_CHANNEL_MSLEEP_ITERATIONS; | ||
3245 | + while (!*done && iter--) { | ||
3246 | + msleep(QED_VF_CHANNEL_MSLEEP_DELAY); | ||
3247 | + dma_rmb(); | ||
3248 | } | ||
3249 | |||
3250 | if (!*done) { | ||
3251 | diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c | ||
3252 | index 24b746406bc7..4640e6c4aecf 100644 | ||
3253 | --- a/drivers/net/ethernet/rocker/rocker_main.c | ||
3254 | +++ b/drivers/net/ethernet/rocker/rocker_main.c | ||
3255 | @@ -648,10 +648,10 @@ static int rocker_dma_rings_init(struct rocker *rocker) | ||
3256 | err_dma_event_ring_bufs_alloc: | ||
3257 | rocker_dma_ring_destroy(rocker, &rocker->event_ring); | ||
3258 | err_dma_event_ring_create: | ||
3259 | + rocker_dma_cmd_ring_waits_free(rocker); | ||
3260 | +err_dma_cmd_ring_waits_alloc: | ||
3261 | rocker_dma_ring_bufs_free(rocker, &rocker->cmd_ring, | ||
3262 | PCI_DMA_BIDIRECTIONAL); | ||
3263 | -err_dma_cmd_ring_waits_alloc: | ||
3264 | - rocker_dma_cmd_ring_waits_free(rocker); | ||
3265 | err_dma_cmd_ring_bufs_alloc: | ||
3266 | rocker_dma_ring_destroy(rocker, &rocker->cmd_ring); | ||
3267 | return err; | ||
3268 | diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c | ||
3269 | index aaff07c10058..a453b82d1077 100644 | ||
3270 | --- a/drivers/net/hamradio/yam.c | ||
3271 | +++ b/drivers/net/hamradio/yam.c | ||
3272 | @@ -1160,6 +1160,7 @@ static int __init yam_init_driver(void) | ||
3273 | err = register_netdev(dev); | ||
3274 | if (err) { | ||
3275 | printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name); | ||
3276 | + free_netdev(dev); | ||
3277 | goto error; | ||
3278 | } | ||
3279 | yam_devs[i] = dev; | ||
3280 | diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c | ||
3281 | index 559af8e6ad90..0434ecf67712 100644 | ||
3282 | --- a/drivers/net/usb/ax88179_178a.c | ||
3283 | +++ b/drivers/net/usb/ax88179_178a.c | ||
3284 | @@ -1396,10 +1396,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
3285 | } | ||
3286 | |||
3287 | if (pkt_cnt == 0) { | ||
3288 | - /* Skip IP alignment psudo header */ | ||
3289 | - skb_pull(skb, 2); | ||
3290 | skb->len = pkt_len; | ||
3291 | - skb_set_tail_pointer(skb, pkt_len); | ||
3292 | + /* Skip IP alignment pseudo header */ | ||
3293 | + skb_pull(skb, 2); | ||
3294 | + skb_set_tail_pointer(skb, skb->len); | ||
3295 | skb->truesize = pkt_len + sizeof(struct sk_buff); | ||
3296 | ax88179_rx_checksum(skb, pkt_hdr); | ||
3297 | return 1; | ||
3298 | @@ -1408,8 +1408,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
3299 | ax_skb = skb_clone(skb, GFP_ATOMIC); | ||
3300 | if (ax_skb) { | ||
3301 | ax_skb->len = pkt_len; | ||
3302 | - ax_skb->data = skb->data + 2; | ||
3303 | - skb_set_tail_pointer(ax_skb, pkt_len); | ||
3304 | + /* Skip IP alignment pseudo header */ | ||
3305 | + skb_pull(ax_skb, 2); | ||
3306 | + skb_set_tail_pointer(ax_skb, ax_skb->len); | ||
3307 | ax_skb->truesize = pkt_len + sizeof(struct sk_buff); | ||
3308 | ax88179_rx_checksum(ax_skb, pkt_hdr); | ||
3309 | usbnet_skb_return(dev, ax_skb); | ||
3310 | diff --git a/drivers/pci/host/pci-aardvark.c b/drivers/pci/host/pci-aardvark.c | ||
3311 | index 1dbd09c91a7c..736d9f58438e 100644 | ||
3312 | --- a/drivers/pci/host/pci-aardvark.c | ||
3313 | +++ b/drivers/pci/host/pci-aardvark.c | ||
3314 | @@ -363,10 +363,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) | ||
3315 | |||
3316 | advk_pcie_wait_for_link(pcie); | ||
3317 | |||
3318 | - reg = PCIE_CORE_LINK_L0S_ENTRY | | ||
3319 | - (1 << PCIE_CORE_LINK_WIDTH_SHIFT); | ||
3320 | - advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); | ||
3321 | - | ||
3322 | reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); | ||
3323 | reg |= PCIE_CORE_CMD_MEM_ACCESS_EN | | ||
3324 | PCIE_CORE_CMD_IO_ACCESS_EN | | ||
3325 | diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c | ||
3326 | index 7f6b454bca65..3ff423220df6 100644 | ||
3327 | --- a/drivers/pci/host/pcie-rcar.c | ||
3328 | +++ b/drivers/pci/host/pcie-rcar.c | ||
3329 | @@ -328,11 +328,12 @@ static struct pci_ops rcar_pcie_ops = { | ||
3330 | }; | ||
3331 | |||
3332 | static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, | ||
3333 | - struct resource *res) | ||
3334 | + struct resource_entry *window) | ||
3335 | { | ||
3336 | /* Setup PCIe address space mappings for each resource */ | ||
3337 | resource_size_t size; | ||
3338 | resource_size_t res_start; | ||
3339 | + struct resource *res = window->res; | ||
3340 | u32 mask; | ||
3341 | |||
3342 | rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win)); | ||
3343 | @@ -346,9 +347,9 @@ static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, | ||
3344 | rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); | ||
3345 | |||
3346 | if (res->flags & IORESOURCE_IO) | ||
3347 | - res_start = pci_pio_to_address(res->start); | ||
3348 | + res_start = pci_pio_to_address(res->start) - window->offset; | ||
3349 | else | ||
3350 | - res_start = res->start; | ||
3351 | + res_start = res->start - window->offset; | ||
3352 | |||
3353 | rcar_pci_write_reg(pcie, upper_32_bits(res_start), PCIEPAUR(win)); | ||
3354 | rcar_pci_write_reg(pcie, lower_32_bits(res_start) & ~0x7F, | ||
3355 | @@ -377,7 +378,7 @@ static int rcar_pcie_setup(struct list_head *resource, struct rcar_pcie *pci) | ||
3356 | switch (resource_type(res)) { | ||
3357 | case IORESOURCE_IO: | ||
3358 | case IORESOURCE_MEM: | ||
3359 | - rcar_pcie_setup_window(i, pci, res); | ||
3360 | + rcar_pcie_setup_window(i, pci, win); | ||
3361 | i++; | ||
3362 | break; | ||
3363 | case IORESOURCE_BUS: | ||
3364 | diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c | ||
3365 | index 4a5fde58974a..75551a781e88 100644 | ||
3366 | --- a/drivers/pci/pcie/aspm.c | ||
3367 | +++ b/drivers/pci/pcie/aspm.c | ||
3368 | @@ -410,16 +410,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) | ||
3369 | |||
3370 | /* Setup initial capable state. Will be updated later */ | ||
3371 | link->aspm_capable = link->aspm_support; | ||
3372 | - /* | ||
3373 | - * If the downstream component has pci bridge function, don't | ||
3374 | - * do ASPM for now. | ||
3375 | - */ | ||
3376 | - list_for_each_entry(child, &linkbus->devices, bus_list) { | ||
3377 | - if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) { | ||
3378 | - link->aspm_disable = ASPM_STATE_ALL; | ||
3379 | - break; | ||
3380 | - } | ||
3381 | - } | ||
3382 | |||
3383 | /* Get and check endpoint acceptable latencies */ | ||
3384 | list_for_each_entry(child, &linkbus->devices, bus_list) { | ||
3385 | diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c | ||
3386 | index 3008bba360f3..ec6f6213960b 100644 | ||
3387 | --- a/drivers/pci/pcie/ptm.c | ||
3388 | +++ b/drivers/pci/pcie/ptm.c | ||
3389 | @@ -47,10 +47,6 @@ void pci_ptm_init(struct pci_dev *dev) | ||
3390 | if (!pci_is_pcie(dev)) | ||
3391 | return; | ||
3392 | |||
3393 | - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); | ||
3394 | - if (!pos) | ||
3395 | - return; | ||
3396 | - | ||
3397 | /* | ||
3398 | * Enable PTM only on interior devices (root ports, switch ports, | ||
3399 | * etc.) on the assumption that it causes no link traffic until an | ||
3400 | @@ -60,6 +56,23 @@ void pci_ptm_init(struct pci_dev *dev) | ||
3401 | pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END)) | ||
3402 | return; | ||
3403 | |||
3404 | + /* | ||
3405 | + * Switch Downstream Ports are not permitted to have a PTM | ||
3406 | + * capability; their PTM behavior is controlled by the Upstream | ||
3407 | + * Port (PCIe r5.0, sec 7.9.16). | ||
3408 | + */ | ||
3409 | + ups = pci_upstream_bridge(dev); | ||
3410 | + if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM && | ||
3411 | + ups && ups->ptm_enabled) { | ||
3412 | + dev->ptm_granularity = ups->ptm_granularity; | ||
3413 | + dev->ptm_enabled = 1; | ||
3414 | + return; | ||
3415 | + } | ||
3416 | + | ||
3417 | + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); | ||
3418 | + if (!pos) | ||
3419 | + return; | ||
3420 | + | ||
3421 | pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); | ||
3422 | local_clock = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; | ||
3423 | |||
3424 | @@ -69,7 +82,6 @@ void pci_ptm_init(struct pci_dev *dev) | ||
3425 | * the spec recommendation (PCIe r3.1, sec 7.32.3), select the | ||
3426 | * furthest upstream Time Source as the PTM Root. | ||
3427 | */ | ||
3428 | - ups = pci_upstream_bridge(dev); | ||
3429 | if (ups && ups->ptm_enabled) { | ||
3430 | ctrl = PCI_PTM_CTRL_ENABLE; | ||
3431 | if (ups->ptm_granularity == 0) | ||
3432 | diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c | ||
3433 | index e2cca91fd266..68108c4c3969 100644 | ||
3434 | --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c | ||
3435 | +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c | ||
3436 | @@ -642,7 +642,6 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, | ||
3437 | |||
3438 | ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); | ||
3439 | if (ret) { | ||
3440 | - pinctrl_unregister(ipctl->pctl); | ||
3441 | dev_err(&pdev->dev, "Failed to populate subdevices\n"); | ||
3442 | return ret; | ||
3443 | } | ||
3444 | diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig | ||
3445 | index 76806a0be820..0de9a958b29a 100644 | ||
3446 | --- a/drivers/power/supply/Kconfig | ||
3447 | +++ b/drivers/power/supply/Kconfig | ||
3448 | @@ -424,7 +424,7 @@ config CHARGER_BQ24257 | ||
3449 | tristate "TI BQ24250/24251/24257 battery charger driver" | ||
3450 | depends on I2C | ||
3451 | depends on GPIOLIB || COMPILE_TEST | ||
3452 | - depends on REGMAP_I2C | ||
3453 | + select REGMAP_I2C | ||
3454 | help | ||
3455 | Say Y to enable support for the TI BQ24250, BQ24251, and BQ24257 battery | ||
3456 | chargers. | ||
3457 | diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c | ||
3458 | index cd614fe69d14..c3075ea011b6 100644 | ||
3459 | --- a/drivers/power/supply/lp8788-charger.c | ||
3460 | +++ b/drivers/power/supply/lp8788-charger.c | ||
3461 | @@ -603,27 +603,14 @@ static void lp8788_setup_adc_channel(struct device *dev, | ||
3462 | return; | ||
3463 | |||
3464 | /* ADC channel for battery voltage */ | ||
3465 | - chan = iio_channel_get(dev, pdata->adc_vbatt); | ||
3466 | + chan = devm_iio_channel_get(dev, pdata->adc_vbatt); | ||
3467 | pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan; | ||
3468 | |||
3469 | /* ADC channel for battery temperature */ | ||
3470 | - chan = iio_channel_get(dev, pdata->adc_batt_temp); | ||
3471 | + chan = devm_iio_channel_get(dev, pdata->adc_batt_temp); | ||
3472 | pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan; | ||
3473 | } | ||
3474 | |||
3475 | -static void lp8788_release_adc_channel(struct lp8788_charger *pchg) | ||
3476 | -{ | ||
3477 | - int i; | ||
3478 | - | ||
3479 | - for (i = 0; i < LP8788_NUM_CHG_ADC; i++) { | ||
3480 | - if (!pchg->chan[i]) | ||
3481 | - continue; | ||
3482 | - | ||
3483 | - iio_channel_release(pchg->chan[i]); | ||
3484 | - pchg->chan[i] = NULL; | ||
3485 | - } | ||
3486 | -} | ||
3487 | - | ||
3488 | static ssize_t lp8788_show_charger_status(struct device *dev, | ||
3489 | struct device_attribute *attr, char *buf) | ||
3490 | { | ||
3491 | @@ -744,7 +731,6 @@ static int lp8788_charger_remove(struct platform_device *pdev) | ||
3492 | lp8788_irq_unregister(pdev, pchg); | ||
3493 | sysfs_remove_group(&pdev->dev.kobj, &lp8788_attr_group); | ||
3494 | lp8788_psy_unregister(pchg); | ||
3495 | - lp8788_release_adc_channel(pchg); | ||
3496 | |||
3497 | return 0; | ||
3498 | } | ||
3499 | diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c | ||
3500 | index 072c5189bd6d..0655dbdc7000 100644 | ||
3501 | --- a/drivers/power/supply/smb347-charger.c | ||
3502 | +++ b/drivers/power/supply/smb347-charger.c | ||
3503 | @@ -1141,6 +1141,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg) | ||
3504 | switch (reg) { | ||
3505 | case IRQSTAT_A: | ||
3506 | case IRQSTAT_C: | ||
3507 | + case IRQSTAT_D: | ||
3508 | case IRQSTAT_E: | ||
3509 | case IRQSTAT_F: | ||
3510 | case STAT_A: | ||
3511 | diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h | ||
3512 | index 7e70f9298cc1..11f6ebd04545 100644 | ||
3513 | --- a/drivers/s390/cio/qdio.h | ||
3514 | +++ b/drivers/s390/cio/qdio.h | ||
3515 | @@ -376,7 +376,6 @@ static inline int multicast_outbound(struct qdio_q *q) | ||
3516 | extern u64 last_ai_time; | ||
3517 | |||
3518 | /* prototypes for thin interrupt */ | ||
3519 | -void qdio_setup_thinint(struct qdio_irq *irq_ptr); | ||
3520 | int qdio_establish_thinint(struct qdio_irq *irq_ptr); | ||
3521 | void qdio_shutdown_thinint(struct qdio_irq *irq_ptr); | ||
3522 | void tiqdio_add_input_queues(struct qdio_irq *irq_ptr); | ||
3523 | diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c | ||
3524 | index d0090c5c88e7..a64615a10352 100644 | ||
3525 | --- a/drivers/s390/cio/qdio_setup.c | ||
3526 | +++ b/drivers/s390/cio/qdio_setup.c | ||
3527 | @@ -479,7 +479,6 @@ int qdio_setup_irq(struct qdio_initialize *init_data) | ||
3528 | setup_queues(irq_ptr, init_data); | ||
3529 | |||
3530 | setup_qib(irq_ptr, init_data); | ||
3531 | - qdio_setup_thinint(irq_ptr); | ||
3532 | set_impl_params(irq_ptr, init_data->qib_param_field_format, | ||
3533 | init_data->qib_param_field, | ||
3534 | init_data->input_slib_elements, | ||
3535 | diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c | ||
3536 | index debe69adfc70..aecb6445a567 100644 | ||
3537 | --- a/drivers/s390/cio/qdio_thinint.c | ||
3538 | +++ b/drivers/s390/cio/qdio_thinint.c | ||
3539 | @@ -268,17 +268,19 @@ int __init tiqdio_register_thinints(void) | ||
3540 | |||
3541 | int qdio_establish_thinint(struct qdio_irq *irq_ptr) | ||
3542 | { | ||
3543 | + int rc; | ||
3544 | + | ||
3545 | if (!is_thinint_irq(irq_ptr)) | ||
3546 | return 0; | ||
3547 | - return set_subchannel_ind(irq_ptr, 0); | ||
3548 | -} | ||
3549 | |||
3550 | -void qdio_setup_thinint(struct qdio_irq *irq_ptr) | ||
3551 | -{ | ||
3552 | - if (!is_thinint_irq(irq_ptr)) | ||
3553 | - return; | ||
3554 | irq_ptr->dsci = get_indicator(); | ||
3555 | DBF_HEX(&irq_ptr->dsci, sizeof(void *)); | ||
3556 | + | ||
3557 | + rc = set_subchannel_ind(irq_ptr, 0); | ||
3558 | + if (rc) | ||
3559 | + put_indicator(irq_ptr->dsci); | ||
3560 | + | ||
3561 | + return rc; | ||
3562 | } | ||
3563 | |||
3564 | void qdio_shutdown_thinint(struct qdio_irq *irq_ptr) | ||
3565 | diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c | ||
3566 | index 12b88294d667..76ad20e49126 100644 | ||
3567 | --- a/drivers/scsi/arm/acornscsi.c | ||
3568 | +++ b/drivers/scsi/arm/acornscsi.c | ||
3569 | @@ -2913,8 +2913,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) | ||
3570 | |||
3571 | ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); | ||
3572 | ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | ||
3573 | - if (!ashost->base || !ashost->fast) | ||
3574 | + if (!ashost->base || !ashost->fast) { | ||
3575 | + ret = -ENOMEM; | ||
3576 | goto out_put; | ||
3577 | + } | ||
3578 | |||
3579 | host->irq = ec->irq; | ||
3580 | ashost->host = host; | ||
3581 | diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c | ||
3582 | index e1730227b448..f299839698a3 100644 | ||
3583 | --- a/drivers/scsi/ibmvscsi/ibmvscsi.c | ||
3584 | +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | ||
3585 | @@ -425,6 +425,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, | ||
3586 | int rc = 0; | ||
3587 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); | ||
3588 | |||
3589 | + set_adapter_info(hostdata); | ||
3590 | + | ||
3591 | /* Re-enable the CRQ */ | ||
3592 | do { | ||
3593 | if (rc) | ||
3594 | diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c | ||
3595 | index d453667612f8..15d64f96e623 100644 | ||
3596 | --- a/drivers/scsi/iscsi_boot_sysfs.c | ||
3597 | +++ b/drivers/scsi/iscsi_boot_sysfs.c | ||
3598 | @@ -360,7 +360,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset, | ||
3599 | boot_kobj->kobj.kset = boot_kset->kset; | ||
3600 | if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype, | ||
3601 | NULL, name, index)) { | ||
3602 | - kfree(boot_kobj); | ||
3603 | + kobject_put(&boot_kobj->kobj); | ||
3604 | return NULL; | ||
3605 | } | ||
3606 | boot_kobj->data = data; | ||
3607 | diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c | ||
3608 | index 4901bf24916b..09dbf3021bb0 100644 | ||
3609 | --- a/drivers/scsi/lpfc/lpfc_els.c | ||
3610 | +++ b/drivers/scsi/lpfc/lpfc_els.c | ||
3611 | @@ -7606,6 +7606,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | ||
3612 | spin_lock_irq(shost->host_lock); | ||
3613 | if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) { | ||
3614 | spin_unlock_irq(shost->host_lock); | ||
3615 | + if (newnode) | ||
3616 | + lpfc_nlp_put(ndlp); | ||
3617 | goto dropit; | ||
3618 | } | ||
3619 | spin_unlock_irq(shost->host_lock); | ||
3620 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c | ||
3621 | index 6ccde2b41517..601a93953307 100644 | ||
3622 | --- a/drivers/scsi/mpt3sas/mpt3sas_base.c | ||
3623 | +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c | ||
3624 | @@ -3166,7 +3166,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) | ||
3625 | ioc->scsi_lookup = NULL; | ||
3626 | } | ||
3627 | kfree(ioc->hpr_lookup); | ||
3628 | + ioc->hpr_lookup = NULL; | ||
3629 | kfree(ioc->internal_lookup); | ||
3630 | + ioc->internal_lookup = NULL; | ||
3631 | if (ioc->chain_lookup) { | ||
3632 | for (i = 0; i < ioc->chain_depth; i++) { | ||
3633 | if (ioc->chain_lookup[i].chain_buffer) | ||
3634 | diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | ||
3635 | index abdd6f93c8fe..324cddd4656e 100644 | ||
3636 | --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c | ||
3637 | +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | ||
3638 | @@ -855,6 +855,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, | ||
3639 | |||
3640 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
3641 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
3642 | + qlt_stop_phase2(vha->vha_tgt.qla_tgt); | ||
3643 | } | ||
3644 | |||
3645 | return count; | ||
3646 | @@ -1019,6 +1020,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, | ||
3647 | |||
3648 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
3649 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
3650 | + qlt_stop_phase2(vha->vha_tgt.qla_tgt); | ||
3651 | } | ||
3652 | |||
3653 | return count; | ||
3654 | diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c | ||
3655 | index d596b76eea64..aad9195b356a 100644 | ||
3656 | --- a/drivers/scsi/scsi_devinfo.c | ||
3657 | +++ b/drivers/scsi/scsi_devinfo.c | ||
3658 | @@ -451,7 +451,8 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | ||
3659 | /* | ||
3660 | * vendor strings must be an exact match | ||
3661 | */ | ||
3662 | - if (vmax != strlen(devinfo->vendor) || | ||
3663 | + if (vmax != strnlen(devinfo->vendor, | ||
3664 | + sizeof(devinfo->vendor)) || | ||
3665 | memcmp(devinfo->vendor, vskip, vmax)) | ||
3666 | continue; | ||
3667 | |||
3668 | @@ -459,7 +460,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | ||
3669 | * @model specifies the full string, and | ||
3670 | * must be larger or equal to devinfo->model | ||
3671 | */ | ||
3672 | - mlen = strlen(devinfo->model); | ||
3673 | + mlen = strnlen(devinfo->model, sizeof(devinfo->model)); | ||
3674 | if (mmax < mlen || memcmp(devinfo->model, mskip, mlen)) | ||
3675 | continue; | ||
3676 | return devinfo; | ||
3677 | diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c | ||
3678 | index cc484cb287d2..67a73ea0a615 100644 | ||
3679 | --- a/drivers/scsi/sr.c | ||
3680 | +++ b/drivers/scsi/sr.c | ||
3681 | @@ -745,7 +745,7 @@ static int sr_probe(struct device *dev) | ||
3682 | cd->cdi.disk = disk; | ||
3683 | |||
3684 | if (register_cdrom(&cd->cdi)) | ||
3685 | - goto fail_put; | ||
3686 | + goto fail_minor; | ||
3687 | |||
3688 | /* | ||
3689 | * Initialize block layer runtime PM stuffs before the | ||
3690 | @@ -763,6 +763,10 @@ static int sr_probe(struct device *dev) | ||
3691 | |||
3692 | return 0; | ||
3693 | |||
3694 | +fail_minor: | ||
3695 | + spin_lock(&sr_index_lock); | ||
3696 | + clear_bit(minor, sr_index_bits); | ||
3697 | + spin_unlock(&sr_index_lock); | ||
3698 | fail_put: | ||
3699 | put_disk(disk); | ||
3700 | fail_free: | ||
3701 | diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c | ||
3702 | index 86ace1449309..ee54711cf8e8 100644 | ||
3703 | --- a/drivers/staging/sm750fb/sm750.c | ||
3704 | +++ b/drivers/staging/sm750fb/sm750.c | ||
3705 | @@ -897,6 +897,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) | ||
3706 | fix->visual = FB_VISUAL_PSEUDOCOLOR; | ||
3707 | break; | ||
3708 | case 16: | ||
3709 | + case 24: | ||
3710 | case 32: | ||
3711 | fix->visual = FB_VISUAL_TRUECOLOR; | ||
3712 | break; | ||
3713 | diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c | ||
3714 | index 9e9016e67843..1ab9bd433542 100644 | ||
3715 | --- a/drivers/tty/n_gsm.c | ||
3716 | +++ b/drivers/tty/n_gsm.c | ||
3717 | @@ -681,11 +681,10 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len, | ||
3718 | * FIXME: lock against link layer control transmissions | ||
3719 | */ | ||
3720 | |||
3721 | -static void gsm_data_kick(struct gsm_mux *gsm) | ||
3722 | +static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) | ||
3723 | { | ||
3724 | struct gsm_msg *msg, *nmsg; | ||
3725 | int len; | ||
3726 | - int skip_sof = 0; | ||
3727 | |||
3728 | list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { | ||
3729 | if (gsm->constipated && msg->addr) | ||
3730 | @@ -707,18 +706,23 @@ static void gsm_data_kick(struct gsm_mux *gsm) | ||
3731 | print_hex_dump_bytes("gsm_data_kick: ", | ||
3732 | DUMP_PREFIX_OFFSET, | ||
3733 | gsm->txframe, len); | ||
3734 | - | ||
3735 | - if (gsm->output(gsm, gsm->txframe + skip_sof, | ||
3736 | - len - skip_sof) < 0) | ||
3737 | + if (gsm->output(gsm, gsm->txframe, len) < 0) | ||
3738 | break; | ||
3739 | /* FIXME: Can eliminate one SOF in many more cases */ | ||
3740 | gsm->tx_bytes -= msg->len; | ||
3741 | - /* For a burst of frames skip the extra SOF within the | ||
3742 | - burst */ | ||
3743 | - skip_sof = 1; | ||
3744 | |||
3745 | list_del(&msg->list); | ||
3746 | kfree(msg); | ||
3747 | + | ||
3748 | + if (dlci) { | ||
3749 | + tty_port_tty_wakeup(&dlci->port); | ||
3750 | + } else { | ||
3751 | + int i = 0; | ||
3752 | + | ||
3753 | + for (i = 0; i < NUM_DLCI; i++) | ||
3754 | + if (gsm->dlci[i]) | ||
3755 | + tty_port_tty_wakeup(&gsm->dlci[i]->port); | ||
3756 | + } | ||
3757 | } | ||
3758 | } | ||
3759 | |||
3760 | @@ -770,7 +774,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) | ||
3761 | /* Add to the actual output queue */ | ||
3762 | list_add_tail(&msg->list, &gsm->tx_list); | ||
3763 | gsm->tx_bytes += msg->len; | ||
3764 | - gsm_data_kick(gsm); | ||
3765 | + gsm_data_kick(gsm, dlci); | ||
3766 | } | ||
3767 | |||
3768 | /** | ||
3769 | @@ -1231,7 +1235,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, | ||
3770 | gsm_control_reply(gsm, CMD_FCON, NULL, 0); | ||
3771 | /* Kick the link in case it is idling */ | ||
3772 | spin_lock_irqsave(&gsm->tx_lock, flags); | ||
3773 | - gsm_data_kick(gsm); | ||
3774 | + gsm_data_kick(gsm, NULL); | ||
3775 | spin_unlock_irqrestore(&gsm->tx_lock, flags); | ||
3776 | break; | ||
3777 | case CMD_FCOFF: | ||
3778 | @@ -2414,7 +2418,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty) | ||
3779 | /* Queue poll */ | ||
3780 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | ||
3781 | spin_lock_irqsave(&gsm->tx_lock, flags); | ||
3782 | - gsm_data_kick(gsm); | ||
3783 | + gsm_data_kick(gsm, NULL); | ||
3784 | if (gsm->tx_bytes < TX_THRESH_LO) { | ||
3785 | gsm_dlci_data_sweep(gsm); | ||
3786 | } | ||
3787 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c | ||
3788 | index f6586a8681b9..b3b9b3d2cddf 100644 | ||
3789 | --- a/drivers/tty/serial/amba-pl011.c | ||
3790 | +++ b/drivers/tty/serial/amba-pl011.c | ||
3791 | @@ -2524,6 +2524,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, | ||
3792 | uap->port.fifosize = uap->fifosize; | ||
3793 | uap->port.flags = UPF_BOOT_AUTOCONF; | ||
3794 | uap->port.line = index; | ||
3795 | + spin_lock_init(&uap->port.lock); | ||
3796 | |||
3797 | amba_ports[index] = uap; | ||
3798 | |||
3799 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c | ||
3800 | index 5b0bffba4aac..2dc563b61b88 100644 | ||
3801 | --- a/drivers/usb/class/cdc-acm.c | ||
3802 | +++ b/drivers/usb/class/cdc-acm.c | ||
3803 | @@ -1627,6 +1627,8 @@ static int acm_reset_resume(struct usb_interface *intf) | ||
3804 | |||
3805 | static const struct usb_device_id acm_ids[] = { | ||
3806 | /* quirky and broken devices */ | ||
3807 | + { USB_DEVICE(0x0424, 0x274e), /* Microchip Technology, Inc. (formerly SMSC) */ | ||
3808 | + .driver_info = DISABLE_ECHO, }, /* DISABLE ECHO in termios flag */ | ||
3809 | { USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */ | ||
3810 | .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */ | ||
3811 | { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */ | ||
3812 | diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c | ||
3813 | index 07c3c3449147..c578d64edc15 100644 | ||
3814 | --- a/drivers/usb/class/usblp.c | ||
3815 | +++ b/drivers/usb/class/usblp.c | ||
3816 | @@ -481,7 +481,8 @@ static int usblp_release(struct inode *inode, struct file *file) | ||
3817 | usb_autopm_put_interface(usblp->intf); | ||
3818 | |||
3819 | if (!usblp->present) /* finish cleanup from disconnect */ | ||
3820 | - usblp_cleanup(usblp); | ||
3821 | + usblp_cleanup(usblp); /* any URBs must be dead */ | ||
3822 | + | ||
3823 | mutex_unlock(&usblp_mutex); | ||
3824 | return 0; | ||
3825 | } | ||
3826 | @@ -1397,9 +1398,11 @@ static void usblp_disconnect(struct usb_interface *intf) | ||
3827 | |||
3828 | usblp_unlink_urbs(usblp); | ||
3829 | mutex_unlock(&usblp->mut); | ||
3830 | + usb_poison_anchored_urbs(&usblp->urbs); | ||
3831 | |||
3832 | if (!usblp->used) | ||
3833 | usblp_cleanup(usblp); | ||
3834 | + | ||
3835 | mutex_unlock(&usblp_mutex); | ||
3836 | } | ||
3837 | |||
3838 | diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c | ||
3839 | index 27d05f0134de..e6e0f786547b 100644 | ||
3840 | --- a/drivers/usb/core/quirks.c | ||
3841 | +++ b/drivers/usb/core/quirks.c | ||
3842 | @@ -73,11 +73,12 @@ static const struct usb_device_id usb_quirk_list[] = { | ||
3843 | /* Logitech HD Webcam C270 */ | ||
3844 | { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
3845 | |||
3846 | - /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */ | ||
3847 | + /* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */ | ||
3848 | { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
3849 | { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
3850 | { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
3851 | { USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
3852 | + { USB_DEVICE(0x046d, 0x085c), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
3853 | |||
3854 | /* Logitech ConferenceCam CC3000e */ | ||
3855 | { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
3856 | diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c | ||
3857 | index d85c5c9f96c1..f046703f63f2 100644 | ||
3858 | --- a/drivers/usb/dwc2/core_intr.c | ||
3859 | +++ b/drivers/usb/dwc2/core_intr.c | ||
3860 | @@ -365,10 +365,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) | ||
3861 | if (ret && (ret != -ENOTSUPP)) | ||
3862 | dev_err(hsotg->dev, "exit hibernation failed\n"); | ||
3863 | |||
3864 | + /* Change to L0 state */ | ||
3865 | + hsotg->lx_state = DWC2_L0; | ||
3866 | call_gadget(hsotg, resume); | ||
3867 | + } else { | ||
3868 | + /* Change to L0 state */ | ||
3869 | + hsotg->lx_state = DWC2_L0; | ||
3870 | } | ||
3871 | - /* Change to L0 state */ | ||
3872 | - hsotg->lx_state = DWC2_L0; | ||
3873 | } else { | ||
3874 | if (hsotg->core_params->hibernation) | ||
3875 | return; | ||
3876 | diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c | ||
3877 | index 3ae27b6ed07c..9381a108a985 100644 | ||
3878 | --- a/drivers/usb/dwc2/gadget.c | ||
3879 | +++ b/drivers/usb/dwc2/gadget.c | ||
3880 | @@ -3947,12 +3947,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) | ||
3881 | epnum, 0); | ||
3882 | } | ||
3883 | |||
3884 | - ret = usb_add_gadget_udc(dev, &hsotg->gadget); | ||
3885 | - if (ret) { | ||
3886 | - dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep, | ||
3887 | - hsotg->ctrl_req); | ||
3888 | - return ret; | ||
3889 | - } | ||
3890 | dwc2_hsotg_dump(hsotg); | ||
3891 | |||
3892 | return 0; | ||
3893 | diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c | ||
3894 | index 8e1728b39a49..63178ed7f650 100644 | ||
3895 | --- a/drivers/usb/dwc2/platform.c | ||
3896 | +++ b/drivers/usb/dwc2/platform.c | ||
3897 | @@ -661,6 +661,17 @@ static int dwc2_driver_probe(struct platform_device *dev) | ||
3898 | if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL) | ||
3899 | dwc2_lowlevel_hw_disable(hsotg); | ||
3900 | |||
3901 | +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ | ||
3902 | + IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) | ||
3903 | + /* Postponed adding a new gadget to the udc class driver list */ | ||
3904 | + if (hsotg->gadget_enabled) { | ||
3905 | + retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget); | ||
3906 | + if (retval) { | ||
3907 | + dwc2_hsotg_remove(hsotg); | ||
3908 | + goto error; | ||
3909 | + } | ||
3910 | + } | ||
3911 | +#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ | ||
3912 | return 0; | ||
3913 | |||
3914 | error: | ||
3915 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c | ||
3916 | index 2e545d025030..5a1723d99fe5 100644 | ||
3917 | --- a/drivers/usb/gadget/composite.c | ||
3918 | +++ b/drivers/usb/gadget/composite.c | ||
3919 | @@ -100,40 +100,43 @@ function_descriptors(struct usb_function *f, | ||
3920 | } | ||
3921 | |||
3922 | /** | ||
3923 | - * next_ep_desc() - advance to the next EP descriptor | ||
3924 | + * next_desc() - advance to the next desc_type descriptor | ||
3925 | * @t: currect pointer within descriptor array | ||
3926 | + * @desc_type: descriptor type | ||
3927 | * | ||
3928 | - * Return: next EP descriptor or NULL | ||
3929 | + * Return: next desc_type descriptor or NULL | ||
3930 | * | ||
3931 | - * Iterate over @t until either EP descriptor found or | ||
3932 | + * Iterate over @t until either desc_type descriptor found or | ||
3933 | * NULL (that indicates end of list) encountered | ||
3934 | */ | ||
3935 | static struct usb_descriptor_header** | ||
3936 | -next_ep_desc(struct usb_descriptor_header **t) | ||
3937 | +next_desc(struct usb_descriptor_header **t, u8 desc_type) | ||
3938 | { | ||
3939 | for (; *t; t++) { | ||
3940 | - if ((*t)->bDescriptorType == USB_DT_ENDPOINT) | ||
3941 | + if ((*t)->bDescriptorType == desc_type) | ||
3942 | return t; | ||
3943 | } | ||
3944 | return NULL; | ||
3945 | } | ||
3946 | |||
3947 | /* | ||
3948 | - * for_each_ep_desc()- iterate over endpoint descriptors in the | ||
3949 | - * descriptors list | ||
3950 | - * @start: pointer within descriptor array. | ||
3951 | - * @ep_desc: endpoint descriptor to use as the loop cursor | ||
3952 | + * for_each_desc() - iterate over desc_type descriptors in the | ||
3953 | + * descriptors list | ||
3954 | + * @start: pointer within descriptor array. | ||
3955 | + * @iter_desc: desc_type descriptor to use as the loop cursor | ||
3956 | + * @desc_type: wanted descriptr type | ||
3957 | */ | ||
3958 | -#define for_each_ep_desc(start, ep_desc) \ | ||
3959 | - for (ep_desc = next_ep_desc(start); \ | ||
3960 | - ep_desc; ep_desc = next_ep_desc(ep_desc+1)) | ||
3961 | +#define for_each_desc(start, iter_desc, desc_type) \ | ||
3962 | + for (iter_desc = next_desc(start, desc_type); \ | ||
3963 | + iter_desc; iter_desc = next_desc(iter_desc + 1, desc_type)) | ||
3964 | |||
3965 | /** | ||
3966 | - * config_ep_by_speed() - configures the given endpoint | ||
3967 | + * config_ep_by_speed_and_alt() - configures the given endpoint | ||
3968 | * according to gadget speed. | ||
3969 | * @g: pointer to the gadget | ||
3970 | * @f: usb function | ||
3971 | * @_ep: the endpoint to configure | ||
3972 | + * @alt: alternate setting number | ||
3973 | * | ||
3974 | * Return: error code, 0 on success | ||
3975 | * | ||
3976 | @@ -146,11 +149,13 @@ next_ep_desc(struct usb_descriptor_header **t) | ||
3977 | * Note: the supplied function should hold all the descriptors | ||
3978 | * for supported speeds | ||
3979 | */ | ||
3980 | -int config_ep_by_speed(struct usb_gadget *g, | ||
3981 | - struct usb_function *f, | ||
3982 | - struct usb_ep *_ep) | ||
3983 | +int config_ep_by_speed_and_alt(struct usb_gadget *g, | ||
3984 | + struct usb_function *f, | ||
3985 | + struct usb_ep *_ep, | ||
3986 | + u8 alt) | ||
3987 | { | ||
3988 | struct usb_endpoint_descriptor *chosen_desc = NULL; | ||
3989 | + struct usb_interface_descriptor *int_desc = NULL; | ||
3990 | struct usb_descriptor_header **speed_desc = NULL; | ||
3991 | |||
3992 | struct usb_ss_ep_comp_descriptor *comp_desc = NULL; | ||
3993 | @@ -186,8 +191,21 @@ int config_ep_by_speed(struct usb_gadget *g, | ||
3994 | default: | ||
3995 | speed_desc = f->fs_descriptors; | ||
3996 | } | ||
3997 | + | ||
3998 | + /* find correct alternate setting descriptor */ | ||
3999 | + for_each_desc(speed_desc, d_spd, USB_DT_INTERFACE) { | ||
4000 | + int_desc = (struct usb_interface_descriptor *)*d_spd; | ||
4001 | + | ||
4002 | + if (int_desc->bAlternateSetting == alt) { | ||
4003 | + speed_desc = d_spd; | ||
4004 | + goto intf_found; | ||
4005 | + } | ||
4006 | + } | ||
4007 | + return -EIO; | ||
4008 | + | ||
4009 | +intf_found: | ||
4010 | /* find descriptors */ | ||
4011 | - for_each_ep_desc(speed_desc, d_spd) { | ||
4012 | + for_each_desc(speed_desc, d_spd, USB_DT_ENDPOINT) { | ||
4013 | chosen_desc = (struct usb_endpoint_descriptor *)*d_spd; | ||
4014 | if (chosen_desc->bEndpointAddress == _ep->address) | ||
4015 | goto ep_found; | ||
4016 | @@ -240,6 +258,32 @@ ep_found: | ||
4017 | } | ||
4018 | return 0; | ||
4019 | } | ||
4020 | +EXPORT_SYMBOL_GPL(config_ep_by_speed_and_alt); | ||
4021 | + | ||
4022 | +/** | ||
4023 | + * config_ep_by_speed() - configures the given endpoint | ||
4024 | + * according to gadget speed. | ||
4025 | + * @g: pointer to the gadget | ||
4026 | + * @f: usb function | ||
4027 | + * @_ep: the endpoint to configure | ||
4028 | + * | ||
4029 | + * Return: error code, 0 on success | ||
4030 | + * | ||
4031 | + * This function chooses the right descriptors for a given | ||
4032 | + * endpoint according to gadget speed and saves it in the | ||
4033 | + * endpoint desc field. If the endpoint already has a descriptor | ||
4034 | + * assigned to it - overwrites it with currently corresponding | ||
4035 | + * descriptor. The endpoint maxpacket field is updated according | ||
4036 | + * to the chosen descriptor. | ||
4037 | + * Note: the supplied function should hold all the descriptors | ||
4038 | + * for supported speeds | ||
4039 | + */ | ||
4040 | +int config_ep_by_speed(struct usb_gadget *g, | ||
4041 | + struct usb_function *f, | ||
4042 | + struct usb_ep *_ep) | ||
4043 | +{ | ||
4044 | + return config_ep_by_speed_and_alt(g, f, _ep, 0); | ||
4045 | +} | ||
4046 | EXPORT_SYMBOL_GPL(config_ep_by_speed); | ||
4047 | |||
4048 | /** | ||
4049 | diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c | ||
4050 | index ac2aa04ca657..710793161795 100644 | ||
4051 | --- a/drivers/usb/gadget/udc/lpc32xx_udc.c | ||
4052 | +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c | ||
4053 | @@ -1615,17 +1615,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep, | ||
4054 | const struct usb_endpoint_descriptor *desc) | ||
4055 | { | ||
4056 | struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); | ||
4057 | - struct lpc32xx_udc *udc = ep->udc; | ||
4058 | + struct lpc32xx_udc *udc; | ||
4059 | u16 maxpacket; | ||
4060 | u32 tmp; | ||
4061 | unsigned long flags; | ||
4062 | |||
4063 | /* Verify EP data */ | ||
4064 | if ((!_ep) || (!ep) || (!desc) || | ||
4065 | - (desc->bDescriptorType != USB_DT_ENDPOINT)) { | ||
4066 | - dev_dbg(udc->dev, "bad ep or descriptor\n"); | ||
4067 | + (desc->bDescriptorType != USB_DT_ENDPOINT)) | ||
4068 | return -EINVAL; | ||
4069 | - } | ||
4070 | + | ||
4071 | + udc = ep->udc; | ||
4072 | maxpacket = usb_endpoint_maxp(desc); | ||
4073 | if ((maxpacket == 0) || (maxpacket > ep->maxpacket)) { | ||
4074 | dev_dbg(udc->dev, "bad ep descriptor's packet size\n"); | ||
4075 | @@ -1873,7 +1873,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | ||
4076 | static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) | ||
4077 | { | ||
4078 | struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); | ||
4079 | - struct lpc32xx_udc *udc = ep->udc; | ||
4080 | + struct lpc32xx_udc *udc; | ||
4081 | unsigned long flags; | ||
4082 | |||
4083 | if ((!ep) || (ep->hwep_num <= 1)) | ||
4084 | @@ -1883,6 +1883,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) | ||
4085 | if (ep->is_in) | ||
4086 | return -EAGAIN; | ||
4087 | |||
4088 | + udc = ep->udc; | ||
4089 | spin_lock_irqsave(&udc->lock, flags); | ||
4090 | |||
4091 | if (value == 1) { | ||
4092 | diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c | ||
4093 | index 6e977dc22570..1be409644a48 100644 | ||
4094 | --- a/drivers/usb/gadget/udc/m66592-udc.c | ||
4095 | +++ b/drivers/usb/gadget/udc/m66592-udc.c | ||
4096 | @@ -1672,7 +1672,7 @@ static int m66592_probe(struct platform_device *pdev) | ||
4097 | |||
4098 | err_add_udc: | ||
4099 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); | ||
4100 | - | ||
4101 | + m66592->ep0_req = NULL; | ||
4102 | clean_up3: | ||
4103 | if (m66592->pdata->on_chip) { | ||
4104 | clk_disable(m66592->clk); | ||
4105 | diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c | ||
4106 | index ce73b3552269..8700db903382 100644 | ||
4107 | --- a/drivers/usb/gadget/udc/mv_udc_core.c | ||
4108 | +++ b/drivers/usb/gadget/udc/mv_udc_core.c | ||
4109 | @@ -2317,7 +2317,8 @@ static int mv_udc_probe(struct platform_device *pdev) | ||
4110 | return 0; | ||
4111 | |||
4112 | err_create_workqueue: | ||
4113 | - destroy_workqueue(udc->qwork); | ||
4114 | + if (udc->qwork) | ||
4115 | + destroy_workqueue(udc->qwork); | ||
4116 | err_destroy_dma: | ||
4117 | dma_pool_destroy(udc->dtd_pool); | ||
4118 | err_free_dma: | ||
4119 | diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c | ||
4120 | index eb3571ee59e3..08153a48704b 100644 | ||
4121 | --- a/drivers/usb/gadget/udc/s3c2410_udc.c | ||
4122 | +++ b/drivers/usb/gadget/udc/s3c2410_udc.c | ||
4123 | @@ -269,10 +269,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep, | ||
4124 | static void s3c2410_udc_nuke(struct s3c2410_udc *udc, | ||
4125 | struct s3c2410_ep *ep, int status) | ||
4126 | { | ||
4127 | - /* Sanity check */ | ||
4128 | - if (&ep->queue == NULL) | ||
4129 | - return; | ||
4130 | - | ||
4131 | while (!list_empty(&ep->queue)) { | ||
4132 | struct s3c2410_request *req; | ||
4133 | req = list_entry(ep->queue.next, struct s3c2410_request, | ||
4134 | diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c | ||
4135 | index 7a603f66a9bc..44b7c3e780f6 100644 | ||
4136 | --- a/drivers/usb/host/ehci-exynos.c | ||
4137 | +++ b/drivers/usb/host/ehci-exynos.c | ||
4138 | @@ -199,9 +199,8 @@ skip_phy: | ||
4139 | hcd->rsrc_len = resource_size(res); | ||
4140 | |||
4141 | irq = platform_get_irq(pdev, 0); | ||
4142 | - if (!irq) { | ||
4143 | - dev_err(&pdev->dev, "Failed to get IRQ\n"); | ||
4144 | - err = -ENODEV; | ||
4145 | + if (irq < 0) { | ||
4146 | + err = irq; | ||
4147 | goto fail_io; | ||
4148 | } | ||
4149 | |||
4150 | diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c | ||
4151 | index c7a9b31eeaef..637079a35003 100644 | ||
4152 | --- a/drivers/usb/host/ehci-mxc.c | ||
4153 | +++ b/drivers/usb/host/ehci-mxc.c | ||
4154 | @@ -63,6 +63,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | ||
4155 | } | ||
4156 | |||
4157 | irq = platform_get_irq(pdev, 0); | ||
4158 | + if (irq < 0) | ||
4159 | + return irq; | ||
4160 | |||
4161 | hcd = usb_create_hcd(&ehci_mxc_hc_driver, dev, dev_name(dev)); | ||
4162 | if (!hcd) | ||
4163 | diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c | ||
4164 | index 3b3649d88c5f..08b3f8c80601 100644 | ||
4165 | --- a/drivers/usb/host/ehci-pci.c | ||
4166 | +++ b/drivers/usb/host/ehci-pci.c | ||
4167 | @@ -229,6 +229,13 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | ||
4168 | ehci_info(ehci, "applying MosChip frame-index workaround\n"); | ||
4169 | ehci->frame_index_bug = 1; | ||
4170 | break; | ||
4171 | + case PCI_VENDOR_ID_HUAWEI: | ||
4172 | + /* Synopsys HC bug */ | ||
4173 | + if (pdev->device == 0xa239) { | ||
4174 | + ehci_info(ehci, "applying Synopsys HC workaround\n"); | ||
4175 | + ehci->has_synopsys_hc_bug = 1; | ||
4176 | + } | ||
4177 | + break; | ||
4178 | } | ||
4179 | |||
4180 | /* optional debug port, normally in the first BAR */ | ||
4181 | diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c | ||
4182 | index a268d9e8d6cf..1b141e9299f9 100644 | ||
4183 | --- a/drivers/usb/host/ehci-platform.c | ||
4184 | +++ b/drivers/usb/host/ehci-platform.c | ||
4185 | @@ -378,6 +378,11 @@ static int ehci_platform_resume(struct device *dev) | ||
4186 | } | ||
4187 | |||
4188 | ehci_resume(hcd, priv->reset_on_resume); | ||
4189 | + | ||
4190 | + pm_runtime_disable(dev); | ||
4191 | + pm_runtime_set_active(dev); | ||
4192 | + pm_runtime_enable(dev); | ||
4193 | + | ||
4194 | return 0; | ||
4195 | } | ||
4196 | #endif /* CONFIG_PM_SLEEP */ | ||
4197 | diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c | ||
4198 | index 898b74086c12..9e3fdb1421f7 100644 | ||
4199 | --- a/drivers/usb/host/ohci-platform.c | ||
4200 | +++ b/drivers/usb/host/ohci-platform.c | ||
4201 | @@ -340,6 +340,11 @@ static int ohci_platform_resume(struct device *dev) | ||
4202 | } | ||
4203 | |||
4204 | ohci_resume(hcd, false); | ||
4205 | + | ||
4206 | + pm_runtime_disable(dev); | ||
4207 | + pm_runtime_set_active(dev); | ||
4208 | + pm_runtime_enable(dev); | ||
4209 | + | ||
4210 | return 0; | ||
4211 | } | ||
4212 | #endif /* CONFIG_PM_SLEEP */ | ||
4213 | diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c | ||
4214 | index a8b8d8b8d9f3..a960d2bb8dd1 100644 | ||
4215 | --- a/drivers/usb/host/ohci-sm501.c | ||
4216 | +++ b/drivers/usb/host/ohci-sm501.c | ||
4217 | @@ -196,6 +196,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) | ||
4218 | struct resource *mem; | ||
4219 | |||
4220 | usb_remove_hcd(hcd); | ||
4221 | + iounmap(hcd->regs); | ||
4222 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
4223 | usb_put_hcd(hcd); | ||
4224 | dma_release_declared_memory(&pdev->dev); | ||
4225 | diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c | ||
4226 | index 781283a5138e..169d7b2feb1f 100644 | ||
4227 | --- a/drivers/usb/host/xhci-plat.c | ||
4228 | +++ b/drivers/usb/host/xhci-plat.c | ||
4229 | @@ -313,8 +313,17 @@ static int xhci_plat_resume(struct device *dev) | ||
4230 | { | ||
4231 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
4232 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
4233 | + int ret; | ||
4234 | + | ||
4235 | + ret = xhci_resume(xhci, 0); | ||
4236 | + if (ret) | ||
4237 | + return ret; | ||
4238 | + | ||
4239 | + pm_runtime_disable(dev); | ||
4240 | + pm_runtime_set_active(dev); | ||
4241 | + pm_runtime_enable(dev); | ||
4242 | |||
4243 | - return xhci_resume(xhci, 0); | ||
4244 | + return 0; | ||
4245 | } | ||
4246 | |||
4247 | static const struct dev_pm_ops xhci_plat_pm_ops = { | ||
4248 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
4249 | index baacc442ec6a..b27987431079 100644 | ||
4250 | --- a/drivers/usb/host/xhci.c | ||
4251 | +++ b/drivers/usb/host/xhci.c | ||
4252 | @@ -1347,6 +1347,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, | ||
4253 | xhci->devs[slot_id]->out_ctx, ep_index); | ||
4254 | |||
4255 | ep_ctx = xhci_get_ep_ctx(xhci, command->in_ctx, ep_index); | ||
4256 | + ep_ctx->ep_info &= cpu_to_le32(~EP_STATE_MASK);/* must clear */ | ||
4257 | ep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK); | ||
4258 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size)); | ||
4259 | |||
4260 | @@ -4244,6 +4245,9 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | ||
4261 | mutex_lock(hcd->bandwidth_mutex); | ||
4262 | xhci_change_max_exit_latency(xhci, udev, 0); | ||
4263 | mutex_unlock(hcd->bandwidth_mutex); | ||
4264 | + readl_poll_timeout(port_array[port_num], pm_val, | ||
4265 | + (pm_val & PORT_PLS_MASK) == XDEV_U0, | ||
4266 | + 100, 10000); | ||
4267 | return 0; | ||
4268 | } | ||
4269 | } | ||
4270 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h | ||
4271 | index 2b603ef5c10c..2b8df83dad38 100644 | ||
4272 | --- a/drivers/usb/host/xhci.h | ||
4273 | +++ b/drivers/usb/host/xhci.h | ||
4274 | @@ -709,7 +709,7 @@ struct xhci_ep_ctx { | ||
4275 | * 4 - TRB error | ||
4276 | * 5-7 - reserved | ||
4277 | */ | ||
4278 | -#define EP_STATE_MASK (0xf) | ||
4279 | +#define EP_STATE_MASK (0x7) | ||
4280 | #define EP_STATE_DISABLED 0 | ||
4281 | #define EP_STATE_RUNNING 1 | ||
4282 | #define EP_STATE_HALTED 2 | ||
4283 | diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c | ||
4284 | index 84905d074c4f..ef45b8f5bf51 100644 | ||
4285 | --- a/drivers/vfio/pci/vfio_pci_config.c | ||
4286 | +++ b/drivers/vfio/pci/vfio_pci_config.c | ||
4287 | @@ -1461,7 +1461,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev) | ||
4288 | if (ret) | ||
4289 | return ret; | ||
4290 | |||
4291 | - if (cap <= PCI_CAP_ID_MAX) { | ||
4292 | + /* | ||
4293 | + * ID 0 is a NULL capability, conflicting with our fake | ||
4294 | + * PCI_CAP_ID_BASIC. As it has no content, consider it | ||
4295 | + * hidden for now. | ||
4296 | + */ | ||
4297 | + if (cap && cap <= PCI_CAP_ID_MAX) { | ||
4298 | len = pci_cap_length[cap]; | ||
4299 | if (len == 0xFF) { /* Variable length */ | ||
4300 | len = vfio_cap_len(vdev, cap, pos); | ||
4301 | @@ -1729,8 +1734,11 @@ void vfio_config_free(struct vfio_pci_device *vdev) | ||
4302 | vdev->vconfig = NULL; | ||
4303 | kfree(vdev->pci_config_map); | ||
4304 | vdev->pci_config_map = NULL; | ||
4305 | - kfree(vdev->msi_perm); | ||
4306 | - vdev->msi_perm = NULL; | ||
4307 | + if (vdev->msi_perm) { | ||
4308 | + free_perm_bits(vdev->msi_perm); | ||
4309 | + kfree(vdev->msi_perm); | ||
4310 | + vdev->msi_perm = NULL; | ||
4311 | + } | ||
4312 | } | ||
4313 | |||
4314 | /* | ||
4315 | diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c | ||
4316 | index 939f057836e1..4cdc7a3f6dc5 100644 | ||
4317 | --- a/drivers/video/backlight/lp855x_bl.c | ||
4318 | +++ b/drivers/video/backlight/lp855x_bl.c | ||
4319 | @@ -460,7 +460,7 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) | ||
4320 | ret = regulator_enable(lp->enable); | ||
4321 | if (ret < 0) { | ||
4322 | dev_err(lp->dev, "failed to enable vddio: %d\n", ret); | ||
4323 | - return ret; | ||
4324 | + goto disable_supply; | ||
4325 | } | ||
4326 | |||
4327 | /* | ||
4328 | @@ -475,24 +475,34 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) | ||
4329 | ret = lp855x_configure(lp); | ||
4330 | if (ret) { | ||
4331 | dev_err(lp->dev, "device config err: %d", ret); | ||
4332 | - return ret; | ||
4333 | + goto disable_vddio; | ||
4334 | } | ||
4335 | |||
4336 | ret = lp855x_backlight_register(lp); | ||
4337 | if (ret) { | ||
4338 | dev_err(lp->dev, | ||
4339 | "failed to register backlight. err: %d\n", ret); | ||
4340 | - return ret; | ||
4341 | + goto disable_vddio; | ||
4342 | } | ||
4343 | |||
4344 | ret = sysfs_create_group(&lp->dev->kobj, &lp855x_attr_group); | ||
4345 | if (ret) { | ||
4346 | dev_err(lp->dev, "failed to register sysfs. err: %d\n", ret); | ||
4347 | - return ret; | ||
4348 | + goto disable_vddio; | ||
4349 | } | ||
4350 | |||
4351 | backlight_update_status(lp->bl); | ||
4352 | + | ||
4353 | return 0; | ||
4354 | + | ||
4355 | +disable_vddio: | ||
4356 | + if (lp->enable) | ||
4357 | + regulator_disable(lp->enable); | ||
4358 | +disable_supply: | ||
4359 | + if (lp->supply) | ||
4360 | + regulator_disable(lp->supply); | ||
4361 | + | ||
4362 | + return ret; | ||
4363 | } | ||
4364 | |||
4365 | static int lp855x_remove(struct i2c_client *cl) | ||
4366 | @@ -501,6 +511,8 @@ static int lp855x_remove(struct i2c_client *cl) | ||
4367 | |||
4368 | lp->bl->props.brightness = 0; | ||
4369 | backlight_update_status(lp->bl); | ||
4370 | + if (lp->enable) | ||
4371 | + regulator_disable(lp->enable); | ||
4372 | if (lp->supply) | ||
4373 | regulator_disable(lp->supply); | ||
4374 | sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); | ||
4375 | diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c | ||
4376 | index daeb645fcea8..519419136ce8 100644 | ||
4377 | --- a/drivers/watchdog/da9062_wdt.c | ||
4378 | +++ b/drivers/watchdog/da9062_wdt.c | ||
4379 | @@ -94,11 +94,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt, | ||
4380 | unsigned int regval) | ||
4381 | { | ||
4382 | struct da9062 *chip = wdt->hw; | ||
4383 | - int ret; | ||
4384 | - | ||
4385 | - ret = da9062_reset_watchdog_timer(wdt); | ||
4386 | - if (ret) | ||
4387 | - return ret; | ||
4388 | |||
4389 | return regmap_update_bits(chip->regmap, | ||
4390 | DA9062AA_CONTROL_D, | ||
4391 | diff --git a/fs/block_dev.c b/fs/block_dev.c | ||
4392 | index 8a894cd4875b..06f7cbe20132 100644 | ||
4393 | --- a/fs/block_dev.c | ||
4394 | +++ b/fs/block_dev.c | ||
4395 | @@ -1255,10 +1255,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | ||
4396 | */ | ||
4397 | if (!for_part) { | ||
4398 | ret = devcgroup_inode_permission(bdev->bd_inode, perm); | ||
4399 | - if (ret != 0) { | ||
4400 | - bdput(bdev); | ||
4401 | + if (ret != 0) | ||
4402 | return ret; | ||
4403 | - } | ||
4404 | } | ||
4405 | |||
4406 | restart: | ||
4407 | @@ -1330,8 +1328,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | ||
4408 | goto out_clear; | ||
4409 | BUG_ON(for_part); | ||
4410 | ret = __blkdev_get(whole, mode, 1); | ||
4411 | - if (ret) | ||
4412 | + if (ret) { | ||
4413 | + bdput(whole); | ||
4414 | goto out_clear; | ||
4415 | + } | ||
4416 | bdev->bd_contains = whole; | ||
4417 | bdev->bd_part = disk_get_part(disk, partno); | ||
4418 | if (!(disk->flags & GENHD_FL_UP) || | ||
4419 | @@ -1382,7 +1382,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | ||
4420 | put_disk(disk); | ||
4421 | module_put(owner); | ||
4422 | out: | ||
4423 | - bdput(bdev); | ||
4424 | |||
4425 | return ret; | ||
4426 | } | ||
4427 | @@ -1468,6 +1467,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) | ||
4428 | bdput(whole); | ||
4429 | } | ||
4430 | |||
4431 | + if (res) | ||
4432 | + bdput(bdev); | ||
4433 | + | ||
4434 | return res; | ||
4435 | } | ||
4436 | EXPORT_SYMBOL(blkdev_get); | ||
4437 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c | ||
4438 | index 67d9b7a277a3..edd4c7292be0 100644 | ||
4439 | --- a/fs/cifs/smb2ops.c | ||
4440 | +++ b/fs/cifs/smb2ops.c | ||
4441 | @@ -1220,6 +1220,12 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | ||
4442 | inode = d_inode(cfile->dentry); | ||
4443 | cifsi = CIFS_I(inode); | ||
4444 | |||
4445 | + /* | ||
4446 | + * We zero the range through ioctl, so we need remove the page caches | ||
4447 | + * first, otherwise the data may be inconsistent with the server. | ||
4448 | + */ | ||
4449 | + truncate_pagecache_range(inode, offset, offset + len - 1); | ||
4450 | + | ||
4451 | /* if file not oplocked can't be sure whether asking to extend size */ | ||
4452 | if (!CIFS_CACHE_READ(cifsi)) | ||
4453 | if (keep_size == false) | ||
4454 | @@ -1276,6 +1282,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, | ||
4455 | if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse)) | ||
4456 | return -EOPNOTSUPP; | ||
4457 | |||
4458 | + /* | ||
4459 | + * We implement the punch hole through ioctl, so we need remove the page | ||
4460 | + * caches first, otherwise the data may be inconsistent with the server. | ||
4461 | + */ | ||
4462 | + truncate_pagecache_range(inode, offset, offset + len - 1); | ||
4463 | + | ||
4464 | cifs_dbg(FYI, "offset %lld len %lld", offset, len); | ||
4465 | |||
4466 | fsctl_buf.FileOffset = cpu_to_le64(offset); | ||
4467 | diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c | ||
4468 | index 02ac9067a354..9fa3285425fe 100644 | ||
4469 | --- a/fs/compat_ioctl.c | ||
4470 | +++ b/fs/compat_ioctl.c | ||
4471 | @@ -1340,23 +1340,6 @@ COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) | ||
4472 | COMPATIBLE_IOCTL(DMX_GET_CAPS) | ||
4473 | COMPATIBLE_IOCTL(DMX_SET_SOURCE) | ||
4474 | COMPATIBLE_IOCTL(DMX_GET_STC) | ||
4475 | -COMPATIBLE_IOCTL(FE_GET_INFO) | ||
4476 | -COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD) | ||
4477 | -COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD) | ||
4478 | -COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY) | ||
4479 | -COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST) | ||
4480 | -COMPATIBLE_IOCTL(FE_SET_TONE) | ||
4481 | -COMPATIBLE_IOCTL(FE_SET_VOLTAGE) | ||
4482 | -COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE) | ||
4483 | -COMPATIBLE_IOCTL(FE_READ_STATUS) | ||
4484 | -COMPATIBLE_IOCTL(FE_READ_BER) | ||
4485 | -COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH) | ||
4486 | -COMPATIBLE_IOCTL(FE_READ_SNR) | ||
4487 | -COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS) | ||
4488 | -COMPATIBLE_IOCTL(FE_SET_FRONTEND) | ||
4489 | -COMPATIBLE_IOCTL(FE_GET_FRONTEND) | ||
4490 | -COMPATIBLE_IOCTL(FE_GET_EVENT) | ||
4491 | -COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD) | ||
4492 | COMPATIBLE_IOCTL(VIDEO_STOP) | ||
4493 | COMPATIBLE_IOCTL(VIDEO_PLAY) | ||
4494 | COMPATIBLE_IOCTL(VIDEO_FREEZE) | ||
4495 | diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h | ||
4496 | index 216b61604ef9..c211156aabe2 100644 | ||
4497 | --- a/fs/dlm/dlm_internal.h | ||
4498 | +++ b/fs/dlm/dlm_internal.h | ||
4499 | @@ -100,7 +100,6 @@ do { \ | ||
4500 | __LINE__, __FILE__, #x, jiffies); \ | ||
4501 | {do} \ | ||
4502 | printk("\n"); \ | ||
4503 | - BUG(); \ | ||
4504 | panic("DLM: Record message above and reboot.\n"); \ | ||
4505 | } \ | ||
4506 | } | ||
4507 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c | ||
4508 | index 51c2713a615a..ab19f61bd04b 100644 | ||
4509 | --- a/fs/ext4/extents.c | ||
4510 | +++ b/fs/ext4/extents.c | ||
4511 | @@ -2916,7 +2916,7 @@ again: | ||
4512 | * in use to avoid freeing it when removing blocks. | ||
4513 | */ | ||
4514 | if (sbi->s_cluster_ratio > 1) { | ||
4515 | - pblk = ext4_ext_pblock(ex) + end - ee_block + 2; | ||
4516 | + pblk = ext4_ext_pblock(ex) + end - ee_block + 1; | ||
4517 | partial_cluster = | ||
4518 | -(long long) EXT4_B2C(sbi, pblk); | ||
4519 | } | ||
4520 | diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c | ||
4521 | index 84e5ac061b17..bb5ddaabc218 100644 | ||
4522 | --- a/fs/gfs2/ops_fstype.c | ||
4523 | +++ b/fs/gfs2/ops_fstype.c | ||
4524 | @@ -920,7 +920,7 @@ fail: | ||
4525 | } | ||
4526 | |||
4527 | static const match_table_t nolock_tokens = { | ||
4528 | - { Opt_jid, "jid=%d\n", }, | ||
4529 | + { Opt_jid, "jid=%d", }, | ||
4530 | { Opt_err, NULL }, | ||
4531 | }; | ||
4532 | |||
4533 | diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c | ||
4534 | index de135d2591ff..1affdec23729 100644 | ||
4535 | --- a/fs/nfs/direct.c | ||
4536 | +++ b/fs/nfs/direct.c | ||
4537 | @@ -379,8 +379,6 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) | ||
4538 | { | ||
4539 | struct inode *inode = dreq->inode; | ||
4540 | |||
4541 | - inode_dio_end(inode); | ||
4542 | - | ||
4543 | if (dreq->iocb) { | ||
4544 | long res = (long) dreq->error; | ||
4545 | if (dreq->count != 0) { | ||
4546 | @@ -392,7 +390,10 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) | ||
4547 | |||
4548 | complete(&dreq->completion); | ||
4549 | |||
4550 | + igrab(inode); | ||
4551 | nfs_direct_req_release(dreq); | ||
4552 | + inode_dio_end(inode); | ||
4553 | + iput(inode); | ||
4554 | } | ||
4555 | |||
4556 | static void nfs_direct_readpage_release(struct nfs_page *req) | ||
4557 | @@ -534,8 +535,10 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | ||
4558 | * generic layer handle the completion. | ||
4559 | */ | ||
4560 | if (requested_bytes == 0) { | ||
4561 | - inode_dio_end(inode); | ||
4562 | + igrab(inode); | ||
4563 | nfs_direct_req_release(dreq); | ||
4564 | + inode_dio_end(inode); | ||
4565 | + iput(inode); | ||
4566 | return result < 0 ? result : -EIO; | ||
4567 | } | ||
4568 | |||
4569 | @@ -953,8 +956,10 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | ||
4570 | * generic layer handle the completion. | ||
4571 | */ | ||
4572 | if (requested_bytes == 0) { | ||
4573 | - inode_dio_end(inode); | ||
4574 | + igrab(inode); | ||
4575 | nfs_direct_req_release(dreq); | ||
4576 | + inode_dio_end(inode); | ||
4577 | + iput(inode); | ||
4578 | return result < 0 ? result : -EIO; | ||
4579 | } | ||
4580 | |||
4581 | diff --git a/fs/nfs/file.c b/fs/nfs/file.c | ||
4582 | index 1eec947c562d..a89d2f793c1b 100644 | ||
4583 | --- a/fs/nfs/file.c | ||
4584 | +++ b/fs/nfs/file.c | ||
4585 | @@ -82,6 +82,7 @@ nfs_file_release(struct inode *inode, struct file *filp) | ||
4586 | dprintk("NFS: release(%pD2)\n", filp); | ||
4587 | |||
4588 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); | ||
4589 | + inode_dio_wait(inode); | ||
4590 | nfs_file_clear_open_context(filp); | ||
4591 | return 0; | ||
4592 | } | ||
4593 | diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c | ||
4594 | index 4539008502ce..83149cbae093 100644 | ||
4595 | --- a/fs/nfs/flexfilelayout/flexfilelayout.c | ||
4596 | +++ b/fs/nfs/flexfilelayout/flexfilelayout.c | ||
4597 | @@ -939,9 +939,8 @@ retry: | ||
4598 | goto out_mds; | ||
4599 | |||
4600 | /* Use a direct mapping of ds_idx to pgio mirror_idx */ | ||
4601 | - if (WARN_ON_ONCE(pgio->pg_mirror_count != | ||
4602 | - FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg))) | ||
4603 | - goto out_mds; | ||
4604 | + if (pgio->pg_mirror_count != FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)) | ||
4605 | + goto out_eagain; | ||
4606 | |||
4607 | for (i = 0; i < pgio->pg_mirror_count; i++) { | ||
4608 | ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, i, true); | ||
4609 | @@ -960,11 +959,15 @@ retry: | ||
4610 | } | ||
4611 | |||
4612 | return; | ||
4613 | - | ||
4614 | +out_eagain: | ||
4615 | + pnfs_generic_pg_cleanup(pgio); | ||
4616 | + pgio->pg_error = -EAGAIN; | ||
4617 | + return; | ||
4618 | out_mds: | ||
4619 | pnfs_put_lseg(pgio->pg_lseg); | ||
4620 | pgio->pg_lseg = NULL; | ||
4621 | nfs_pageio_reset_write_mds(pgio); | ||
4622 | + pgio->pg_error = -EAGAIN; | ||
4623 | } | ||
4624 | |||
4625 | static unsigned int | ||
4626 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
4627 | index 632d3c3f8dfb..c189722bf9c7 100644 | ||
4628 | --- a/fs/nfs/nfs4proc.c | ||
4629 | +++ b/fs/nfs/nfs4proc.c | ||
4630 | @@ -7151,7 +7151,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) | ||
4631 | } | ||
4632 | |||
4633 | static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { | ||
4634 | - .rpc_call_done = &nfs4_bind_one_conn_to_session_done, | ||
4635 | + .rpc_call_done = nfs4_bind_one_conn_to_session_done, | ||
4636 | }; | ||
4637 | |||
4638 | /* | ||
4639 | diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c | ||
4640 | index 8d842282111b..172f697864ab 100644 | ||
4641 | --- a/fs/nfsd/nfs4callback.c | ||
4642 | +++ b/fs/nfsd/nfs4callback.c | ||
4643 | @@ -1156,6 +1156,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) | ||
4644 | err = setup_callback_client(clp, &conn, ses); | ||
4645 | if (err) { | ||
4646 | nfsd4_mark_cb_down(clp, err); | ||
4647 | + if (c) | ||
4648 | + svc_xprt_put(c->cn_xprt); | ||
4649 | return; | ||
4650 | } | ||
4651 | } | ||
4652 | diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h | ||
4653 | index 44d178b8d1aa..c3697cf60500 100644 | ||
4654 | --- a/fs/ocfs2/ocfs2_fs.h | ||
4655 | +++ b/fs/ocfs2/ocfs2_fs.h | ||
4656 | @@ -304,7 +304,7 @@ | ||
4657 | #define OCFS2_MAX_SLOTS 255 | ||
4658 | |||
4659 | /* Slot map indicator for an empty slot */ | ||
4660 | -#define OCFS2_INVALID_SLOT -1 | ||
4661 | +#define OCFS2_INVALID_SLOT ((u16)-1) | ||
4662 | |||
4663 | #define OCFS2_VOL_UUID_LEN 16 | ||
4664 | #define OCFS2_MAX_VOL_LABEL_LEN 64 | ||
4665 | @@ -340,8 +340,8 @@ struct ocfs2_system_inode_info { | ||
4666 | enum { | ||
4667 | BAD_BLOCK_SYSTEM_INODE = 0, | ||
4668 | GLOBAL_INODE_ALLOC_SYSTEM_INODE, | ||
4669 | +#define OCFS2_FIRST_ONLINE_SYSTEM_INODE GLOBAL_INODE_ALLOC_SYSTEM_INODE | ||
4670 | SLOT_MAP_SYSTEM_INODE, | ||
4671 | -#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE | ||
4672 | HEARTBEAT_SYSTEM_INODE, | ||
4673 | GLOBAL_BITMAP_SYSTEM_INODE, | ||
4674 | USER_QUOTA_SYSTEM_INODE, | ||
4675 | diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c | ||
4676 | index 6ad3533940ba..00558bc59052 100644 | ||
4677 | --- a/fs/ocfs2/suballoc.c | ||
4678 | +++ b/fs/ocfs2/suballoc.c | ||
4679 | @@ -2891,9 +2891,12 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) | ||
4680 | goto bail; | ||
4681 | } | ||
4682 | |||
4683 | - inode_alloc_inode = | ||
4684 | - ocfs2_get_system_file_inode(osb, INODE_ALLOC_SYSTEM_INODE, | ||
4685 | - suballoc_slot); | ||
4686 | + if (suballoc_slot == (u16)OCFS2_INVALID_SLOT) | ||
4687 | + inode_alloc_inode = ocfs2_get_system_file_inode(osb, | ||
4688 | + GLOBAL_INODE_ALLOC_SYSTEM_INODE, suballoc_slot); | ||
4689 | + else | ||
4690 | + inode_alloc_inode = ocfs2_get_system_file_inode(osb, | ||
4691 | + INODE_ALLOC_SYSTEM_INODE, suballoc_slot); | ||
4692 | if (!inode_alloc_inode) { | ||
4693 | /* the error code could be inaccurate, but we are not able to | ||
4694 | * get the correct one. */ | ||
4695 | diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c | ||
4696 | index e567551402a6..b904d4634355 100644 | ||
4697 | --- a/fs/xfs/libxfs/xfs_alloc.c | ||
4698 | +++ b/fs/xfs/libxfs/xfs_alloc.c | ||
4699 | @@ -2507,6 +2507,13 @@ xfs_agf_verify( | ||
4700 | be32_to_cpu(agf->agf_flcount) <= XFS_AGFL_SIZE(mp))) | ||
4701 | return false; | ||
4702 | |||
4703 | + if (be32_to_cpu(agf->agf_length) > mp->m_sb.sb_dblocks) | ||
4704 | + return false; | ||
4705 | + | ||
4706 | + if (be32_to_cpu(agf->agf_freeblks) < be32_to_cpu(agf->agf_longest) || | ||
4707 | + be32_to_cpu(agf->agf_freeblks) > be32_to_cpu(agf->agf_length)) | ||
4708 | + return false; | ||
4709 | + | ||
4710 | if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) < 1 || | ||
4711 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) < 1 || | ||
4712 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > XFS_BTREE_MAXLEVELS || | ||
4713 | @@ -2518,6 +2525,10 @@ xfs_agf_verify( | ||
4714 | be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > XFS_BTREE_MAXLEVELS)) | ||
4715 | return false; | ||
4716 | |||
4717 | + if (xfs_sb_version_hasrmapbt(&mp->m_sb) && | ||
4718 | + be32_to_cpu(agf->agf_rmap_blocks) > be32_to_cpu(agf->agf_length)) | ||
4719 | + return false; | ||
4720 | + | ||
4721 | /* | ||
4722 | * during growfs operations, the perag is not fully initialised, | ||
4723 | * so we can't use it for any useful checking. growfs ensures we can't | ||
4724 | @@ -2531,6 +2542,11 @@ xfs_agf_verify( | ||
4725 | be32_to_cpu(agf->agf_btreeblks) > be32_to_cpu(agf->agf_length)) | ||
4726 | return false; | ||
4727 | |||
4728 | + if (xfs_sb_version_hasreflink(&mp->m_sb) && | ||
4729 | + be32_to_cpu(agf->agf_refcount_blocks) > | ||
4730 | + be32_to_cpu(agf->agf_length)) | ||
4731 | + return false; | ||
4732 | + | ||
4733 | if (xfs_sb_version_hasreflink(&mp->m_sb) && | ||
4734 | (be32_to_cpu(agf->agf_refcount_level) < 1 || | ||
4735 | be32_to_cpu(agf->agf_refcount_level) > XFS_BTREE_MAXLEVELS)) | ||
4736 | diff --git a/include/linux/bitops.h b/include/linux/bitops.h | ||
4737 | index cee74a52b9eb..e1dee6c91ff5 100644 | ||
4738 | --- a/include/linux/bitops.h | ||
4739 | +++ b/include/linux/bitops.h | ||
4740 | @@ -49,7 +49,7 @@ static inline int get_bitmask_order(unsigned int count) | ||
4741 | |||
4742 | static __always_inline unsigned long hweight_long(unsigned long w) | ||
4743 | { | ||
4744 | - return sizeof(w) == 4 ? hweight32(w) : hweight64(w); | ||
4745 | + return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w); | ||
4746 | } | ||
4747 | |||
4748 | /** | ||
4749 | diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h | ||
4750 | index 278e3ef05336..56c6d9031663 100644 | ||
4751 | --- a/include/linux/elfnote.h | ||
4752 | +++ b/include/linux/elfnote.h | ||
4753 | @@ -53,7 +53,7 @@ | ||
4754 | .popsection ; | ||
4755 | |||
4756 | #define ELFNOTE(name, type, desc) \ | ||
4757 | - ELFNOTE_START(name, type, "") \ | ||
4758 | + ELFNOTE_START(name, type, "a") \ | ||
4759 | desc ; \ | ||
4760 | ELFNOTE_END | ||
4761 | |||
4762 | diff --git a/include/linux/genhd.h b/include/linux/genhd.h | ||
4763 | index 3c99fb6727ca..12a2f5ac51c9 100644 | ||
4764 | --- a/include/linux/genhd.h | ||
4765 | +++ b/include/linux/genhd.h | ||
4766 | @@ -716,9 +716,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part) | ||
4767 | static inline void part_nr_sects_write(struct hd_struct *part, sector_t size) | ||
4768 | { | ||
4769 | #if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP) | ||
4770 | + preempt_disable(); | ||
4771 | write_seqcount_begin(&part->nr_sects_seq); | ||
4772 | part->nr_sects = size; | ||
4773 | write_seqcount_end(&part->nr_sects_seq); | ||
4774 | + preempt_enable(); | ||
4775 | #elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT) | ||
4776 | preempt_disable(); | ||
4777 | part->nr_sects = size; | ||
4778 | diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h | ||
4779 | index cb527c78de9f..4db62045f01a 100644 | ||
4780 | --- a/include/linux/kprobes.h | ||
4781 | +++ b/include/linux/kprobes.h | ||
4782 | @@ -366,6 +366,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) | ||
4783 | return this_cpu_ptr(&kprobe_ctlblk); | ||
4784 | } | ||
4785 | |||
4786 | +extern struct kprobe kprobe_busy; | ||
4787 | +void kprobe_busy_begin(void); | ||
4788 | +void kprobe_busy_end(void); | ||
4789 | + | ||
4790 | int register_kprobe(struct kprobe *p); | ||
4791 | void unregister_kprobe(struct kprobe *p); | ||
4792 | int register_kprobes(struct kprobe **kps, int num); | ||
4793 | diff --git a/include/linux/libata.h b/include/linux/libata.h | ||
4794 | index cdfb67b22317..780ccde2c312 100644 | ||
4795 | --- a/include/linux/libata.h | ||
4796 | +++ b/include/linux/libata.h | ||
4797 | @@ -38,6 +38,7 @@ | ||
4798 | #include <linux/acpi.h> | ||
4799 | #include <linux/cdrom.h> | ||
4800 | #include <linux/sched.h> | ||
4801 | +#include <linux/async.h> | ||
4802 | |||
4803 | /* | ||
4804 | * Define if arch has non-standard setup. This is a _PCI_ standard | ||
4805 | @@ -878,6 +879,8 @@ struct ata_port { | ||
4806 | struct timer_list fastdrain_timer; | ||
4807 | unsigned long fastdrain_cnt; | ||
4808 | |||
4809 | + async_cookie_t cookie; | ||
4810 | + | ||
4811 | int em_message_type; | ||
4812 | void *private_data; | ||
4813 | |||
4814 | diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h | ||
4815 | index d8905a229f34..573e744223a2 100644 | ||
4816 | --- a/include/linux/mtd/nand.h | ||
4817 | +++ b/include/linux/mtd/nand.h | ||
4818 | @@ -24,6 +24,7 @@ | ||
4819 | #include <linux/mtd/flashchip.h> | ||
4820 | #include <linux/mtd/bbm.h> | ||
4821 | |||
4822 | +struct nand_chip; | ||
4823 | struct mtd_info; | ||
4824 | struct nand_flash_dev; | ||
4825 | struct device_node; | ||
4826 | @@ -39,7 +40,7 @@ int nand_scan_ident(struct mtd_info *mtd, int max_chips, | ||
4827 | int nand_scan_tail(struct mtd_info *mtd); | ||
4828 | |||
4829 | /* Unregister the MTD device and free resources held by the NAND device */ | ||
4830 | -void nand_release(struct mtd_info *mtd); | ||
4831 | +void nand_release(struct nand_chip *chip); | ||
4832 | |||
4833 | /* Internal helper for board drivers which need to override command function */ | ||
4834 | void nand_wait_ready(struct mtd_info *mtd); | ||
4835 | @@ -219,9 +220,6 @@ enum nand_ecc_algo { | ||
4836 | #define NAND_CI_CELLTYPE_MSK 0x0C | ||
4837 | #define NAND_CI_CELLTYPE_SHIFT 2 | ||
4838 | |||
4839 | -/* Keep gcc happy */ | ||
4840 | -struct nand_chip; | ||
4841 | - | ||
4842 | /* ONFI features */ | ||
4843 | #define ONFI_FEATURE_16_BIT_BUS (1 << 0) | ||
4844 | #define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7) | ||
4845 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h | ||
4846 | index 81c85ba6e2b8..4d1b1056ac97 100644 | ||
4847 | --- a/include/linux/netdevice.h | ||
4848 | +++ b/include/linux/netdevice.h | ||
4849 | @@ -2480,7 +2480,7 @@ void synchronize_net(void); | ||
4850 | int init_dummy_netdev(struct net_device *dev); | ||
4851 | |||
4852 | DECLARE_PER_CPU(int, xmit_recursion); | ||
4853 | -#define XMIT_RECURSION_LIMIT 10 | ||
4854 | +#define XMIT_RECURSION_LIMIT 8 | ||
4855 | |||
4856 | static inline int dev_recursion_level(void) | ||
4857 | { | ||
4858 | diff --git a/include/linux/qed/qed_chain.h b/include/linux/qed/qed_chain.h | ||
4859 | index 72d88cf3ca25..5a215da57b55 100644 | ||
4860 | --- a/include/linux/qed/qed_chain.h | ||
4861 | +++ b/include/linux/qed/qed_chain.h | ||
4862 | @@ -155,28 +155,34 @@ static inline u32 qed_chain_get_cons_idx_u32(struct qed_chain *p_chain) | ||
4863 | |||
4864 | static inline u16 qed_chain_get_elem_left(struct qed_chain *p_chain) | ||
4865 | { | ||
4866 | + u16 elem_per_page = p_chain->elem_per_page; | ||
4867 | + u32 prod = p_chain->u.chain16.prod_idx; | ||
4868 | + u32 cons = p_chain->u.chain16.cons_idx; | ||
4869 | u16 used; | ||
4870 | |||
4871 | - used = (u16) (((u32)0x10000 + | ||
4872 | - (u32)p_chain->u.chain16.prod_idx) - | ||
4873 | - (u32)p_chain->u.chain16.cons_idx); | ||
4874 | + if (prod < cons) | ||
4875 | + prod += (u32)U16_MAX + 1; | ||
4876 | + | ||
4877 | + used = (u16)(prod - cons); | ||
4878 | if (p_chain->mode == QED_CHAIN_MODE_NEXT_PTR) | ||
4879 | - used -= p_chain->u.chain16.prod_idx / p_chain->elem_per_page - | ||
4880 | - p_chain->u.chain16.cons_idx / p_chain->elem_per_page; | ||
4881 | + used -= prod / elem_per_page - cons / elem_per_page; | ||
4882 | |||
4883 | return (u16)(p_chain->capacity - used); | ||
4884 | } | ||
4885 | |||
4886 | static inline u32 qed_chain_get_elem_left_u32(struct qed_chain *p_chain) | ||
4887 | { | ||
4888 | + u16 elem_per_page = p_chain->elem_per_page; | ||
4889 | + u64 prod = p_chain->u.chain32.prod_idx; | ||
4890 | + u64 cons = p_chain->u.chain32.cons_idx; | ||
4891 | u32 used; | ||
4892 | |||
4893 | - used = (u32) (((u64)0x100000000ULL + | ||
4894 | - (u64)p_chain->u.chain32.prod_idx) - | ||
4895 | - (u64)p_chain->u.chain32.cons_idx); | ||
4896 | + if (prod < cons) | ||
4897 | + prod += (u64)U32_MAX + 1; | ||
4898 | + | ||
4899 | + used = (u32)(prod - cons); | ||
4900 | if (p_chain->mode == QED_CHAIN_MODE_NEXT_PTR) | ||
4901 | - used -= p_chain->u.chain32.prod_idx / p_chain->elem_per_page - | ||
4902 | - p_chain->u.chain32.cons_idx / p_chain->elem_per_page; | ||
4903 | + used -= (u32)(prod / elem_per_page - cons / elem_per_page); | ||
4904 | |||
4905 | return p_chain->capacity - used; | ||
4906 | } | ||
4907 | diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h | ||
4908 | index 667d20454a21..0ec7185e5ddf 100644 | ||
4909 | --- a/include/linux/usb/composite.h | ||
4910 | +++ b/include/linux/usb/composite.h | ||
4911 | @@ -248,6 +248,9 @@ int usb_function_activate(struct usb_function *); | ||
4912 | |||
4913 | int usb_interface_id(struct usb_configuration *, struct usb_function *); | ||
4914 | |||
4915 | +int config_ep_by_speed_and_alt(struct usb_gadget *g, struct usb_function *f, | ||
4916 | + struct usb_ep *_ep, u8 alt); | ||
4917 | + | ||
4918 | int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, | ||
4919 | struct usb_ep *_ep); | ||
4920 | |||
4921 | diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h | ||
4922 | index 5b847e49f7e9..8890fd66021d 100644 | ||
4923 | --- a/include/net/sctp/constants.h | ||
4924 | +++ b/include/net/sctp/constants.h | ||
4925 | @@ -357,11 +357,13 @@ typedef enum { | ||
4926 | ipv4_is_anycast_6to4(a)) | ||
4927 | |||
4928 | /* Flags used for the bind address copy functions. */ | ||
4929 | -#define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by | ||
4930 | +#define SCTP_ADDR4_ALLOWED 0x00000001 /* IPv4 address is allowed by | ||
4931 | local sock family */ | ||
4932 | -#define SCTP_ADDR4_PEERSUPP 0x00000002 /* IPv4 address is supported by | ||
4933 | +#define SCTP_ADDR6_ALLOWED 0x00000002 /* IPv6 address is allowed by | ||
4934 | + local sock family */ | ||
4935 | +#define SCTP_ADDR4_PEERSUPP 0x00000004 /* IPv4 address is supported by | ||
4936 | peer */ | ||
4937 | -#define SCTP_ADDR6_PEERSUPP 0x00000004 /* IPv6 address is supported by | ||
4938 | +#define SCTP_ADDR6_PEERSUPP 0x00000008 /* IPv6 address is supported by | ||
4939 | peer */ | ||
4940 | |||
4941 | /* Reasons to retransmit. */ | ||
4942 | diff --git a/include/net/sock.h b/include/net/sock.h | ||
4943 | index d6bce19ca261..db68c72126d5 100644 | ||
4944 | --- a/include/net/sock.h | ||
4945 | +++ b/include/net/sock.h | ||
4946 | @@ -1631,7 +1631,6 @@ static inline int sk_tx_queue_get(const struct sock *sk) | ||
4947 | |||
4948 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) | ||
4949 | { | ||
4950 | - sk_tx_queue_clear(sk); | ||
4951 | sk->sk_socket = sock; | ||
4952 | } | ||
4953 | |||
4954 | diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h | ||
4955 | index afc3972b0879..b653754ee9cf 100644 | ||
4956 | --- a/include/uapi/linux/dvb/frontend.h | ||
4957 | +++ b/include/uapi/linux/dvb/frontend.h | ||
4958 | @@ -28,13 +28,46 @@ | ||
4959 | |||
4960 | #include <linux/types.h> | ||
4961 | |||
4962 | -enum fe_type { | ||
4963 | - FE_QPSK, | ||
4964 | - FE_QAM, | ||
4965 | - FE_OFDM, | ||
4966 | - FE_ATSC | ||
4967 | -}; | ||
4968 | - | ||
4969 | +/** | ||
4970 | + * enum fe_caps - Frontend capabilities | ||
4971 | + * | ||
4972 | + * @FE_IS_STUPID: There's something wrong at the | ||
4973 | + * frontend, and it can't report its | ||
4974 | + * capabilities. | ||
4975 | + * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral | ||
4976 | + * band inversion | ||
4977 | + * @FE_CAN_FEC_1_2: Supports FEC 1/2 | ||
4978 | + * @FE_CAN_FEC_2_3: Supports FEC 2/3 | ||
4979 | + * @FE_CAN_FEC_3_4: Supports FEC 3/4 | ||
4980 | + * @FE_CAN_FEC_4_5: Supports FEC 4/5 | ||
4981 | + * @FE_CAN_FEC_5_6: Supports FEC 5/6 | ||
4982 | + * @FE_CAN_FEC_6_7: Supports FEC 6/7 | ||
4983 | + * @FE_CAN_FEC_7_8: Supports FEC 7/8 | ||
4984 | + * @FE_CAN_FEC_8_9: Supports FEC 8/9 | ||
4985 | + * @FE_CAN_FEC_AUTO: Can auto-detect FEC | ||
4986 | + * @FE_CAN_QPSK: Supports QPSK modulation | ||
4987 | + * @FE_CAN_QAM_16: Supports 16-QAM modulation | ||
4988 | + * @FE_CAN_QAM_32: Supports 32-QAM modulation | ||
4989 | + * @FE_CAN_QAM_64: Supports 64-QAM modulation | ||
4990 | + * @FE_CAN_QAM_128: Supports 128-QAM modulation | ||
4991 | + * @FE_CAN_QAM_256: Supports 256-QAM modulation | ||
4992 | + * @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation | ||
4993 | + * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode | ||
4994 | + * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth | ||
4995 | + * @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval | ||
4996 | + * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy | ||
4997 | + * @FE_CAN_8VSB: Supports 8-VSB modulation | ||
4998 | + * @FE_CAN_16VSB: Supporta 16-VSB modulation | ||
4999 | + * @FE_HAS_EXTENDED_CAPS: Unused | ||
5000 | + * @FE_CAN_MULTISTREAM: Supports multistream filtering | ||
5001 | + * @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation | ||
5002 | + * @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation, | ||
5003 | + * e. g. DVB-S2, DVB-T2, DVB-C2 | ||
5004 | + * @FE_NEEDS_BENDING: Unused | ||
5005 | + * @FE_CAN_RECOVER: Can recover from a cable unplug | ||
5006 | + * automatically | ||
5007 | + * @FE_CAN_MUTE_TS: Can stop spurious TS data output | ||
5008 | + */ | ||
5009 | enum fe_caps { | ||
5010 | FE_IS_STUPID = 0, | ||
5011 | FE_CAN_INVERSION_AUTO = 0x1, | ||
5012 | @@ -60,15 +93,55 @@ enum fe_caps { | ||
5013 | FE_CAN_HIERARCHY_AUTO = 0x100000, | ||
5014 | FE_CAN_8VSB = 0x200000, | ||
5015 | FE_CAN_16VSB = 0x400000, | ||
5016 | - FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ | ||
5017 | - FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */ | ||
5018 | - FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ | ||
5019 | - FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ | ||
5020 | - FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ | ||
5021 | - FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ | ||
5022 | - FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ | ||
5023 | + FE_HAS_EXTENDED_CAPS = 0x800000, | ||
5024 | + FE_CAN_MULTISTREAM = 0x4000000, | ||
5025 | + FE_CAN_TURBO_FEC = 0x8000000, | ||
5026 | + FE_CAN_2G_MODULATION = 0x10000000, | ||
5027 | + FE_NEEDS_BENDING = 0x20000000, | ||
5028 | + FE_CAN_RECOVER = 0x40000000, | ||
5029 | + FE_CAN_MUTE_TS = 0x80000000 | ||
5030 | +}; | ||
5031 | + | ||
5032 | +/* | ||
5033 | + * DEPRECATED: Should be kept just due to backward compatibility. | ||
5034 | + */ | ||
5035 | +enum fe_type { | ||
5036 | + FE_QPSK, | ||
5037 | + FE_QAM, | ||
5038 | + FE_OFDM, | ||
5039 | + FE_ATSC | ||
5040 | }; | ||
5041 | |||
5042 | +/** | ||
5043 | + * struct dvb_frontend_info - Frontend properties and capabilities | ||
5044 | + * | ||
5045 | + * @name: Name of the frontend | ||
5046 | + * @type: **DEPRECATED**. | ||
5047 | + * Should not be used on modern programs, | ||
5048 | + * as a frontend may have more than one type. | ||
5049 | + * In order to get the support types of a given | ||
5050 | + * frontend, use :c:type:`DTV_ENUM_DELSYS` | ||
5051 | + * instead. | ||
5052 | + * @frequency_min: Minimal frequency supported by the frontend. | ||
5053 | + * @frequency_max: Minimal frequency supported by the frontend. | ||
5054 | + * @frequency_stepsize: All frequencies are multiple of this value. | ||
5055 | + * @frequency_tolerance: Frequency tolerance. | ||
5056 | + * @symbol_rate_min: Minimal symbol rate, in bauds | ||
5057 | + * (for Cable/Satellite systems). | ||
5058 | + * @symbol_rate_max: Maximal symbol rate, in bauds | ||
5059 | + * (for Cable/Satellite systems). | ||
5060 | + * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm | ||
5061 | + * (for Cable/Satellite systems). | ||
5062 | + * @notifier_delay: **DEPRECATED**. Not used by any driver. | ||
5063 | + * @caps: Capabilities supported by the frontend, | ||
5064 | + * as specified in &enum fe_caps. | ||
5065 | + * | ||
5066 | + * .. note: | ||
5067 | + * | ||
5068 | + * #. The frequencies are specified in Hz for Terrestrial and Cable | ||
5069 | + * systems. | ||
5070 | + * #. The frequencies are specified in kHz for Satellite systems. | ||
5071 | + */ | ||
5072 | struct dvb_frontend_info { | ||
5073 | char name[128]; | ||
5074 | enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ | ||
5075 | @@ -78,53 +151,102 @@ struct dvb_frontend_info { | ||
5076 | __u32 frequency_tolerance; | ||
5077 | __u32 symbol_rate_min; | ||
5078 | __u32 symbol_rate_max; | ||
5079 | - __u32 symbol_rate_tolerance; /* ppm */ | ||
5080 | + __u32 symbol_rate_tolerance; | ||
5081 | __u32 notifier_delay; /* DEPRECATED */ | ||
5082 | enum fe_caps caps; | ||
5083 | }; | ||
5084 | |||
5085 | - | ||
5086 | /** | ||
5087 | - * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for | ||
5088 | - * the meaning of this struct... | ||
5089 | + * struct dvb_diseqc_master_cmd - DiSEqC master command | ||
5090 | + * | ||
5091 | + * @msg: | ||
5092 | + * DiSEqC message to be sent. It contains a 3 bytes header with: | ||
5093 | + * framing + address + command, and an optional argument | ||
5094 | + * of up to 3 bytes of data. | ||
5095 | + * @msg_len: | ||
5096 | + * Length of the DiSEqC message. Valid values are 3 to 6. | ||
5097 | + * | ||
5098 | + * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for | ||
5099 | + * the possible messages that can be used. | ||
5100 | */ | ||
5101 | struct dvb_diseqc_master_cmd { | ||
5102 | - __u8 msg [6]; /* { framing, address, command, data [3] } */ | ||
5103 | - __u8 msg_len; /* valid values are 3...6 */ | ||
5104 | + __u8 msg[6]; | ||
5105 | + __u8 msg_len; | ||
5106 | }; | ||
5107 | |||
5108 | +/** | ||
5109 | + * struct dvb_diseqc_slave_reply - DiSEqC received data | ||
5110 | + * | ||
5111 | + * @msg: | ||
5112 | + * DiSEqC message buffer to store a message received via DiSEqC. | ||
5113 | + * It contains one byte header with: framing and | ||
5114 | + * an optional argument of up to 3 bytes of data. | ||
5115 | + * @msg_len: | ||
5116 | + * Length of the DiSEqC message. Valid values are 0 to 4, | ||
5117 | + * where 0 means no message. | ||
5118 | + * @timeout: | ||
5119 | + * Return from ioctl after timeout ms with errorcode when | ||
5120 | + * no message was received. | ||
5121 | + * | ||
5122 | + * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for | ||
5123 | + * the possible messages that can be used. | ||
5124 | + */ | ||
5125 | struct dvb_diseqc_slave_reply { | ||
5126 | - __u8 msg [4]; /* { framing, data [3] } */ | ||
5127 | - __u8 msg_len; /* valid values are 0...4, 0 means no msg */ | ||
5128 | - int timeout; /* return from ioctl after timeout ms with */ | ||
5129 | -}; /* errorcode when no message was received */ | ||
5130 | + __u8 msg[4]; | ||
5131 | + __u8 msg_len; | ||
5132 | + int timeout; | ||
5133 | +}; | ||
5134 | |||
5135 | +/** | ||
5136 | + * enum fe_sec_voltage - DC Voltage used to feed the LNBf | ||
5137 | + * | ||
5138 | + * @SEC_VOLTAGE_13: Output 13V to the LNBf | ||
5139 | + * @SEC_VOLTAGE_18: Output 18V to the LNBf | ||
5140 | + * @SEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage | ||
5141 | + */ | ||
5142 | enum fe_sec_voltage { | ||
5143 | SEC_VOLTAGE_13, | ||
5144 | SEC_VOLTAGE_18, | ||
5145 | SEC_VOLTAGE_OFF | ||
5146 | }; | ||
5147 | |||
5148 | +/** | ||
5149 | + * enum fe_sec_tone_mode - Type of tone to be send to the LNBf. | ||
5150 | + * @SEC_TONE_ON: Sends a 22kHz tone burst to the antenna. | ||
5151 | + * @SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except | ||
5152 | + * if the ``FE_DISEQC_*`` ioctls are called). | ||
5153 | + */ | ||
5154 | enum fe_sec_tone_mode { | ||
5155 | SEC_TONE_ON, | ||
5156 | SEC_TONE_OFF | ||
5157 | }; | ||
5158 | |||
5159 | +/** | ||
5160 | + * enum fe_sec_mini_cmd - Type of mini burst to be sent | ||
5161 | + * | ||
5162 | + * @SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select | ||
5163 | + * satellite-A | ||
5164 | + * @SEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select | ||
5165 | + * satellite-B | ||
5166 | + */ | ||
5167 | enum fe_sec_mini_cmd { | ||
5168 | SEC_MINI_A, | ||
5169 | SEC_MINI_B | ||
5170 | }; | ||
5171 | |||
5172 | /** | ||
5173 | - * enum fe_status - enumerates the possible frontend status | ||
5174 | - * @FE_HAS_SIGNAL: found something above the noise level | ||
5175 | - * @FE_HAS_CARRIER: found a DVB signal | ||
5176 | - * @FE_HAS_VITERBI: FEC is stable | ||
5177 | - * @FE_HAS_SYNC: found sync bytes | ||
5178 | - * @FE_HAS_LOCK: everything's working | ||
5179 | - * @FE_TIMEDOUT: no lock within the last ~2 seconds | ||
5180 | - * @FE_REINIT: frontend was reinitialized, application is recommended | ||
5181 | - * to reset DiSEqC, tone and parameters | ||
5182 | + * enum fe_status - Enumerates the possible frontend status. | ||
5183 | + * @FE_NONE: The frontend doesn't have any kind of lock. | ||
5184 | + * That's the initial frontend status | ||
5185 | + * @FE_HAS_SIGNAL: Has found something above the noise level. | ||
5186 | + * @FE_HAS_CARRIER: Has found a DVB signal. | ||
5187 | + * @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). | ||
5188 | + * is stable. | ||
5189 | + * @FE_HAS_SYNC: Synchronization bytes was found. | ||
5190 | + * @FE_HAS_LOCK: DVB were locked and everything is working. | ||
5191 | + * @FE_TIMEDOUT: Fo lock within the last about 2 seconds. | ||
5192 | + * @FE_REINIT: Frontend was reinitialized, application is recommended | ||
5193 | + * to reset DiSEqC, tone and parameters. | ||
5194 | */ | ||
5195 | enum fe_status { | ||
5196 | FE_NONE = 0x00, | ||
5197 | @@ -137,12 +259,45 @@ enum fe_status { | ||
5198 | FE_REINIT = 0x40, | ||
5199 | }; | ||
5200 | |||
5201 | +/** | ||
5202 | + * enum fe_spectral_inversion - Type of inversion band | ||
5203 | + * | ||
5204 | + * @INVERSION_OFF: Don't do spectral band inversion. | ||
5205 | + * @INVERSION_ON: Do spectral band inversion. | ||
5206 | + * @INVERSION_AUTO: Autodetect spectral band inversion. | ||
5207 | + * | ||
5208 | + * This parameter indicates if spectral inversion should be presumed or | ||
5209 | + * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try | ||
5210 | + * to figure out the correct setting by itself. If the hardware doesn't | ||
5211 | + * support, the DVB core will try to lock at the carrier first with | ||
5212 | + * inversion off. If it fails, it will try to enable inversion. | ||
5213 | + */ | ||
5214 | enum fe_spectral_inversion { | ||
5215 | INVERSION_OFF, | ||
5216 | INVERSION_ON, | ||
5217 | INVERSION_AUTO | ||
5218 | }; | ||
5219 | |||
5220 | +/** | ||
5221 | + * enum fe_code_rate - Type of Forward Error Correction (FEC) | ||
5222 | + * | ||
5223 | + * | ||
5224 | + * @FEC_NONE: No Forward Error Correction Code | ||
5225 | + * @FEC_1_2: Forward Error Correction Code 1/2 | ||
5226 | + * @FEC_2_3: Forward Error Correction Code 2/3 | ||
5227 | + * @FEC_3_4: Forward Error Correction Code 3/4 | ||
5228 | + * @FEC_4_5: Forward Error Correction Code 4/5 | ||
5229 | + * @FEC_5_6: Forward Error Correction Code 5/6 | ||
5230 | + * @FEC_6_7: Forward Error Correction Code 6/7 | ||
5231 | + * @FEC_7_8: Forward Error Correction Code 7/8 | ||
5232 | + * @FEC_8_9: Forward Error Correction Code 8/9 | ||
5233 | + * @FEC_AUTO: Autodetect Error Correction Code | ||
5234 | + * @FEC_3_5: Forward Error Correction Code 3/5 | ||
5235 | + * @FEC_9_10: Forward Error Correction Code 9/10 | ||
5236 | + * @FEC_2_5: Forward Error Correction Code 2/5 | ||
5237 | + * | ||
5238 | + * Please note that not all FEC types are supported by a given standard. | ||
5239 | + */ | ||
5240 | enum fe_code_rate { | ||
5241 | FEC_NONE = 0, | ||
5242 | FEC_1_2, | ||
5243 | @@ -159,6 +314,26 @@ enum fe_code_rate { | ||
5244 | FEC_2_5, | ||
5245 | }; | ||
5246 | |||
5247 | +/** | ||
5248 | + * enum fe_modulation - Type of modulation/constellation | ||
5249 | + * @QPSK: QPSK modulation | ||
5250 | + * @QAM_16: 16-QAM modulation | ||
5251 | + * @QAM_32: 32-QAM modulation | ||
5252 | + * @QAM_64: 64-QAM modulation | ||
5253 | + * @QAM_128: 128-QAM modulation | ||
5254 | + * @QAM_256: 256-QAM modulation | ||
5255 | + * @QAM_AUTO: Autodetect QAM modulation | ||
5256 | + * @VSB_8: 8-VSB modulation | ||
5257 | + * @VSB_16: 16-VSB modulation | ||
5258 | + * @PSK_8: 8-PSK modulation | ||
5259 | + * @APSK_16: 16-APSK modulation | ||
5260 | + * @APSK_32: 32-APSK modulation | ||
5261 | + * @DQPSK: DQPSK modulation | ||
5262 | + * @QAM_4_NR: 4-QAM-NR modulation | ||
5263 | + * | ||
5264 | + * Please note that not all modulations are supported by a given standard. | ||
5265 | + * | ||
5266 | + */ | ||
5267 | enum fe_modulation { | ||
5268 | QPSK, | ||
5269 | QAM_16, | ||
5270 | @@ -176,6 +351,32 @@ enum fe_modulation { | ||
5271 | QAM_4_NR, | ||
5272 | }; | ||
5273 | |||
5274 | +/** | ||
5275 | + * enum fe_transmit_mode - Transmission mode | ||
5276 | + * | ||
5277 | + * @TRANSMISSION_MODE_AUTO: | ||
5278 | + * Autodetect transmission mode. The hardware will try to find the | ||
5279 | + * correct FFT-size (if capable) to fill in the missing parameters. | ||
5280 | + * @TRANSMISSION_MODE_1K: | ||
5281 | + * Transmission mode 1K | ||
5282 | + * @TRANSMISSION_MODE_2K: | ||
5283 | + * Transmission mode 2K | ||
5284 | + * @TRANSMISSION_MODE_8K: | ||
5285 | + * Transmission mode 8K | ||
5286 | + * @TRANSMISSION_MODE_4K: | ||
5287 | + * Transmission mode 4K | ||
5288 | + * @TRANSMISSION_MODE_16K: | ||
5289 | + * Transmission mode 16K | ||
5290 | + * @TRANSMISSION_MODE_32K: | ||
5291 | + * Transmission mode 32K | ||
5292 | + * @TRANSMISSION_MODE_C1: | ||
5293 | + * Single Carrier (C=1) transmission mode (DTMB only) | ||
5294 | + * @TRANSMISSION_MODE_C3780: | ||
5295 | + * Multi Carrier (C=3780) transmission mode (DTMB only) | ||
5296 | + * | ||
5297 | + * Please note that not all transmission modes are supported by a given | ||
5298 | + * standard. | ||
5299 | + */ | ||
5300 | enum fe_transmit_mode { | ||
5301 | TRANSMISSION_MODE_2K, | ||
5302 | TRANSMISSION_MODE_8K, | ||
5303 | @@ -188,6 +389,23 @@ enum fe_transmit_mode { | ||
5304 | TRANSMISSION_MODE_C3780, | ||
5305 | }; | ||
5306 | |||
5307 | +/** | ||
5308 | + * enum fe_guard_interval - Guard interval | ||
5309 | + * | ||
5310 | + * @GUARD_INTERVAL_AUTO: Autodetect the guard interval | ||
5311 | + * @GUARD_INTERVAL_1_128: Guard interval 1/128 | ||
5312 | + * @GUARD_INTERVAL_1_32: Guard interval 1/32 | ||
5313 | + * @GUARD_INTERVAL_1_16: Guard interval 1/16 | ||
5314 | + * @GUARD_INTERVAL_1_8: Guard interval 1/8 | ||
5315 | + * @GUARD_INTERVAL_1_4: Guard interval 1/4 | ||
5316 | + * @GUARD_INTERVAL_19_128: Guard interval 19/128 | ||
5317 | + * @GUARD_INTERVAL_19_256: Guard interval 19/256 | ||
5318 | + * @GUARD_INTERVAL_PN420: PN length 420 (1/4) | ||
5319 | + * @GUARD_INTERVAL_PN595: PN length 595 (1/6) | ||
5320 | + * @GUARD_INTERVAL_PN945: PN length 945 (1/9) | ||
5321 | + * | ||
5322 | + * Please note that not all guard intervals are supported by a given standard. | ||
5323 | + */ | ||
5324 | enum fe_guard_interval { | ||
5325 | GUARD_INTERVAL_1_32, | ||
5326 | GUARD_INTERVAL_1_16, | ||
5327 | @@ -202,6 +420,16 @@ enum fe_guard_interval { | ||
5328 | GUARD_INTERVAL_PN945, | ||
5329 | }; | ||
5330 | |||
5331 | +/** | ||
5332 | + * enum fe_hierarchy - Hierarchy | ||
5333 | + * @HIERARCHY_NONE: No hierarchy | ||
5334 | + * @HIERARCHY_AUTO: Autodetect hierarchy (if supported) | ||
5335 | + * @HIERARCHY_1: Hierarchy 1 | ||
5336 | + * @HIERARCHY_2: Hierarchy 2 | ||
5337 | + * @HIERARCHY_4: Hierarchy 4 | ||
5338 | + * | ||
5339 | + * Please note that not all hierarchy types are supported by a given standard. | ||
5340 | + */ | ||
5341 | enum fe_hierarchy { | ||
5342 | HIERARCHY_NONE, | ||
5343 | HIERARCHY_1, | ||
5344 | @@ -210,6 +438,15 @@ enum fe_hierarchy { | ||
5345 | HIERARCHY_AUTO | ||
5346 | }; | ||
5347 | |||
5348 | +/** | ||
5349 | + * enum fe_interleaving - Interleaving | ||
5350 | + * @INTERLEAVING_NONE: No interleaving. | ||
5351 | + * @INTERLEAVING_AUTO: Auto-detect interleaving. | ||
5352 | + * @INTERLEAVING_240: Interleaving of 240 symbols. | ||
5353 | + * @INTERLEAVING_720: Interleaving of 720 symbols. | ||
5354 | + * | ||
5355 | + * Please note that, currently, only DTMB uses it. | ||
5356 | + */ | ||
5357 | enum fe_interleaving { | ||
5358 | INTERLEAVING_NONE, | ||
5359 | INTERLEAVING_AUTO, | ||
5360 | @@ -217,7 +454,8 @@ enum fe_interleaving { | ||
5361 | INTERLEAVING_720, | ||
5362 | }; | ||
5363 | |||
5364 | -/* S2API Commands */ | ||
5365 | +/* DVBv5 property Commands */ | ||
5366 | + | ||
5367 | #define DTV_UNDEFINED 0 | ||
5368 | #define DTV_TUNE 1 | ||
5369 | #define DTV_CLEAR 2 | ||
5370 | @@ -310,19 +548,79 @@ enum fe_interleaving { | ||
5371 | |||
5372 | #define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT | ||
5373 | |||
5374 | +/** | ||
5375 | + * enum fe_pilot - Type of pilot tone | ||
5376 | + * | ||
5377 | + * @PILOT_ON: Pilot tones enabled | ||
5378 | + * @PILOT_OFF: Pilot tones disabled | ||
5379 | + * @PILOT_AUTO: Autodetect pilot tones | ||
5380 | + */ | ||
5381 | enum fe_pilot { | ||
5382 | PILOT_ON, | ||
5383 | PILOT_OFF, | ||
5384 | PILOT_AUTO, | ||
5385 | }; | ||
5386 | |||
5387 | +/** | ||
5388 | + * enum fe_rolloff - Rolloff factor (also known as alpha) | ||
5389 | + * @ROLLOFF_35: Roloff factor: 35% | ||
5390 | + * @ROLLOFF_20: Roloff factor: 20% | ||
5391 | + * @ROLLOFF_25: Roloff factor: 25% | ||
5392 | + * @ROLLOFF_AUTO: Auto-detect the roloff factor. | ||
5393 | + * | ||
5394 | + * .. note: | ||
5395 | + * | ||
5396 | + * Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default. | ||
5397 | + */ | ||
5398 | enum fe_rolloff { | ||
5399 | - ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ | ||
5400 | + ROLLOFF_35, | ||
5401 | ROLLOFF_20, | ||
5402 | ROLLOFF_25, | ||
5403 | ROLLOFF_AUTO, | ||
5404 | }; | ||
5405 | |||
5406 | +/** | ||
5407 | + * enum fe_delivery_system - Type of the delivery system | ||
5408 | + * | ||
5409 | + * @SYS_UNDEFINED: | ||
5410 | + * Undefined standard. Generally, indicates an error | ||
5411 | + * @SYS_DVBC_ANNEX_A: | ||
5412 | + * Cable TV: DVB-C following ITU-T J.83 Annex A spec | ||
5413 | + * @SYS_DVBC_ANNEX_B: | ||
5414 | + * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) | ||
5415 | + * @SYS_DVBC_ANNEX_C: | ||
5416 | + * Cable TV: DVB-C following ITU-T J.83 Annex C spec | ||
5417 | + * @SYS_ISDBC: | ||
5418 | + * Cable TV: ISDB-C (no drivers yet) | ||
5419 | + * @SYS_DVBT: | ||
5420 | + * Terrestrial TV: DVB-T | ||
5421 | + * @SYS_DVBT2: | ||
5422 | + * Terrestrial TV: DVB-T2 | ||
5423 | + * @SYS_ISDBT: | ||
5424 | + * Terrestrial TV: ISDB-T | ||
5425 | + * @SYS_ATSC: | ||
5426 | + * Terrestrial TV: ATSC | ||
5427 | + * @SYS_ATSCMH: | ||
5428 | + * Terrestrial TV (mobile): ATSC-M/H | ||
5429 | + * @SYS_DTMB: | ||
5430 | + * Terrestrial TV: DTMB | ||
5431 | + * @SYS_DVBS: | ||
5432 | + * Satellite TV: DVB-S | ||
5433 | + * @SYS_DVBS2: | ||
5434 | + * Satellite TV: DVB-S2 | ||
5435 | + * @SYS_TURBO: | ||
5436 | + * Satellite TV: DVB-S Turbo | ||
5437 | + * @SYS_ISDBS: | ||
5438 | + * Satellite TV: ISDB-S | ||
5439 | + * @SYS_DAB: | ||
5440 | + * Digital audio: DAB (not fully supported) | ||
5441 | + * @SYS_DSS: | ||
5442 | + * Satellite TV: DSS (not fully supported) | ||
5443 | + * @SYS_CMMB: | ||
5444 | + * Terrestrial TV (mobile): CMMB (not fully supported) | ||
5445 | + * @SYS_DVBH: | ||
5446 | + * Terrestrial TV (mobile): DVB-H (standard deprecated) | ||
5447 | + */ | ||
5448 | enum fe_delivery_system { | ||
5449 | SYS_UNDEFINED, | ||
5450 | SYS_DVBC_ANNEX_A, | ||
5451 | @@ -345,35 +643,85 @@ enum fe_delivery_system { | ||
5452 | SYS_DVBC_ANNEX_C, | ||
5453 | }; | ||
5454 | |||
5455 | -/* backward compatibility */ | ||
5456 | +/* backward compatibility definitions for delivery systems */ | ||
5457 | #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A | ||
5458 | -#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */ | ||
5459 | +#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB */ | ||
5460 | |||
5461 | -/* ATSC-MH */ | ||
5462 | +/* ATSC-MH specific parameters */ | ||
5463 | |||
5464 | +/** | ||
5465 | + * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional | ||
5466 | + * Code Block Mode. | ||
5467 | + * | ||
5468 | + * @ATSCMH_SCCC_BLK_SEP: | ||
5469 | + * Separate SCCC: the SCCC outer code mode shall be set independently | ||
5470 | + * for each Group Region (A, B, C, D) | ||
5471 | + * @ATSCMH_SCCC_BLK_COMB: | ||
5472 | + * Combined SCCC: all four Regions shall have the same SCCC outer | ||
5473 | + * code mode. | ||
5474 | + * @ATSCMH_SCCC_BLK_RES: | ||
5475 | + * Reserved. Shouldn't be used. | ||
5476 | + */ | ||
5477 | enum atscmh_sccc_block_mode { | ||
5478 | ATSCMH_SCCC_BLK_SEP = 0, | ||
5479 | ATSCMH_SCCC_BLK_COMB = 1, | ||
5480 | ATSCMH_SCCC_BLK_RES = 2, | ||
5481 | }; | ||
5482 | |||
5483 | +/** | ||
5484 | + * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional | ||
5485 | + * Code Rate. | ||
5486 | + * | ||
5487 | + * @ATSCMH_SCCC_CODE_HLF: | ||
5488 | + * The outer code rate of a SCCC Block is 1/2 rate. | ||
5489 | + * @ATSCMH_SCCC_CODE_QTR: | ||
5490 | + * The outer code rate of a SCCC Block is 1/4 rate. | ||
5491 | + * @ATSCMH_SCCC_CODE_RES: | ||
5492 | + * Reserved. Should not be used. | ||
5493 | + */ | ||
5494 | enum atscmh_sccc_code_mode { | ||
5495 | ATSCMH_SCCC_CODE_HLF = 0, | ||
5496 | ATSCMH_SCCC_CODE_QTR = 1, | ||
5497 | ATSCMH_SCCC_CODE_RES = 2, | ||
5498 | }; | ||
5499 | |||
5500 | +/** | ||
5501 | + * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble. | ||
5502 | + * | ||
5503 | + * @ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble. | ||
5504 | + * @ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble. | ||
5505 | + */ | ||
5506 | enum atscmh_rs_frame_ensemble { | ||
5507 | ATSCMH_RSFRAME_ENS_PRI = 0, | ||
5508 | ATSCMH_RSFRAME_ENS_SEC = 1, | ||
5509 | }; | ||
5510 | |||
5511 | +/** | ||
5512 | + * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode. | ||
5513 | + * | ||
5514 | + * @ATSCMH_RSFRAME_PRI_ONLY: | ||
5515 | + * Single Frame: There is only a primary RS Frame for all Group | ||
5516 | + * Regions. | ||
5517 | + * @ATSCMH_RSFRAME_PRI_SEC: | ||
5518 | + * Dual Frame: There are two separate RS Frames: Primary RS Frame for | ||
5519 | + * Group Region A and B and Secondary RS Frame for Group Region C and | ||
5520 | + * D. | ||
5521 | + * @ATSCMH_RSFRAME_RES: | ||
5522 | + * Reserved. Shouldn't be used. | ||
5523 | + */ | ||
5524 | enum atscmh_rs_frame_mode { | ||
5525 | ATSCMH_RSFRAME_PRI_ONLY = 0, | ||
5526 | ATSCMH_RSFRAME_PRI_SEC = 1, | ||
5527 | ATSCMH_RSFRAME_RES = 2, | ||
5528 | }; | ||
5529 | |||
5530 | +/** | ||
5531 | + * enum atscmh_rs_code_mode | ||
5532 | + * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). | ||
5533 | + * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). | ||
5534 | + * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). | ||
5535 | + * @ATSCMH_RSCODE_RES: Reserved. Shouldn't be used. | ||
5536 | + */ | ||
5537 | enum atscmh_rs_code_mode { | ||
5538 | ATSCMH_RSCODE_211_187 = 0, | ||
5539 | ATSCMH_RSCODE_223_187 = 1, | ||
5540 | @@ -384,28 +732,18 @@ enum atscmh_rs_code_mode { | ||
5541 | #define NO_STREAM_ID_FILTER (~0U) | ||
5542 | #define LNA_AUTO (~0U) | ||
5543 | |||
5544 | -struct dtv_cmds_h { | ||
5545 | - char *name; /* A display name for debugging purposes */ | ||
5546 | - | ||
5547 | - __u32 cmd; /* A unique ID */ | ||
5548 | - | ||
5549 | - /* Flags */ | ||
5550 | - __u32 set:1; /* Either a set or get property */ | ||
5551 | - __u32 buffer:1; /* Does this property use the buffer? */ | ||
5552 | - __u32 reserved:30; /* Align */ | ||
5553 | -}; | ||
5554 | - | ||
5555 | /** | ||
5556 | - * Scale types for the quality parameters. | ||
5557 | + * enum fecap_scale_params - scale types for the quality parameters. | ||
5558 | + * | ||
5559 | * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That | ||
5560 | * could indicate a temporary or a permanent | ||
5561 | * condition. | ||
5562 | * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically | ||
5563 | - * used on signal measures. | ||
5564 | + * used on signal measures. | ||
5565 | * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, | ||
5566 | - * ranging from 0 (0%) to 0xffff (100%). | ||
5567 | + * ranging from 0 (0%) to 0xffff (100%). | ||
5568 | * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like | ||
5569 | - * bit error, block error, lapsed time. | ||
5570 | + * bit error, block error, lapsed time. | ||
5571 | */ | ||
5572 | enum fecap_scale_params { | ||
5573 | FE_SCALE_NOT_AVAILABLE = 0, | ||
5574 | @@ -417,24 +755,38 @@ enum fecap_scale_params { | ||
5575 | /** | ||
5576 | * struct dtv_stats - Used for reading a DTV status property | ||
5577 | * | ||
5578 | - * @value: value of the measure. Should range from 0 to 0xffff; | ||
5579 | * @scale: Filled with enum fecap_scale_params - the scale | ||
5580 | * in usage for that parameter | ||
5581 | * | ||
5582 | + * The ``{unnamed_union}`` may have either one of the values below: | ||
5583 | + * | ||
5584 | + * %svalue | ||
5585 | + * integer value of the measure, for %FE_SCALE_DECIBEL, | ||
5586 | + * used for dB measures. The unit is 0.001 dB. | ||
5587 | + * | ||
5588 | + * %uvalue | ||
5589 | + * unsigned integer value of the measure, used when @scale is | ||
5590 | + * either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER. | ||
5591 | + * | ||
5592 | * For most delivery systems, this will return a single value for each | ||
5593 | * parameter. | ||
5594 | + * | ||
5595 | * It should be noticed, however, that new OFDM delivery systems like | ||
5596 | * ISDB can use different modulation types for each group of carriers. | ||
5597 | * On such standards, up to 8 groups of statistics can be provided, one | ||
5598 | * for each carrier group (called "layer" on ISDB). | ||
5599 | + * | ||
5600 | * In order to be consistent with other delivery systems, the first | ||
5601 | * value refers to the entire set of carriers ("global"). | ||
5602 | - * dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when | ||
5603 | + * | ||
5604 | + * @scale should use the value %FE_SCALE_NOT_AVAILABLE when | ||
5605 | * the value for the entire group of carriers or from one specific layer | ||
5606 | * is not provided by the hardware. | ||
5607 | - * st.len should be filled with the latest filled status + 1. | ||
5608 | * | ||
5609 | - * In other words, for ISDB, those values should be filled like: | ||
5610 | + * @len should be filled with the latest filled status + 1. | ||
5611 | + * | ||
5612 | + * In other words, for ISDB, those values should be filled like:: | ||
5613 | + * | ||
5614 | * u.st.stat.svalue[0] = global statistics; | ||
5615 | * u.st.stat.scale[0] = FE_SCALE_DECIBEL; | ||
5616 | * u.st.stat.value[1] = layer A statistics; | ||
5617 | @@ -456,11 +808,39 @@ struct dtv_stats { | ||
5618 | |||
5619 | #define MAX_DTV_STATS 4 | ||
5620 | |||
5621 | +/** | ||
5622 | + * struct dtv_fe_stats - store Digital TV frontend statistics | ||
5623 | + * | ||
5624 | + * @len: length of the statistics - if zero, stats is disabled. | ||
5625 | + * @stat: array with digital TV statistics. | ||
5626 | + * | ||
5627 | + * On most standards, @len can either be 0 or 1. However, for ISDB, each | ||
5628 | + * layer is modulated in separate. So, each layer may have its own set | ||
5629 | + * of statistics. If so, stat[0] carries on a global value for the property. | ||
5630 | + * Indexes 1 to 3 means layer A to B. | ||
5631 | + */ | ||
5632 | struct dtv_fe_stats { | ||
5633 | __u8 len; | ||
5634 | struct dtv_stats stat[MAX_DTV_STATS]; | ||
5635 | } __attribute__ ((packed)); | ||
5636 | |||
5637 | +/** | ||
5638 | + * struct dtv_property - store one of frontend command and its value | ||
5639 | + * | ||
5640 | + * @cmd: Digital TV command. | ||
5641 | + * @reserved: Not used. | ||
5642 | + * @u: Union with the values for the command. | ||
5643 | + * @result: Unused | ||
5644 | + * | ||
5645 | + * The @u union may have either one of the values below: | ||
5646 | + * | ||
5647 | + * %data | ||
5648 | + * an unsigned 32-bits number. | ||
5649 | + * %st | ||
5650 | + * a &struct dtv_fe_stats array of statistics. | ||
5651 | + * %buffer | ||
5652 | + * a buffer of up to 32 characters (currently unused). | ||
5653 | + */ | ||
5654 | struct dtv_property { | ||
5655 | __u32 cmd; | ||
5656 | __u32 reserved[3]; | ||
5657 | @@ -480,17 +860,70 @@ struct dtv_property { | ||
5658 | /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ | ||
5659 | #define DTV_IOCTL_MAX_MSGS 64 | ||
5660 | |||
5661 | +/** | ||
5662 | + * struct dtv_properties - a set of command/value pairs. | ||
5663 | + * | ||
5664 | + * @num: amount of commands stored at the struct. | ||
5665 | + * @props: a pointer to &struct dtv_property. | ||
5666 | + */ | ||
5667 | struct dtv_properties { | ||
5668 | __u32 num; | ||
5669 | struct dtv_property *props; | ||
5670 | }; | ||
5671 | |||
5672 | +/* | ||
5673 | + * When set, this flag will disable any zigzagging or other "normal" tuning | ||
5674 | + * behavior. Additionally, there will be no automatic monitoring of the lock | ||
5675 | + * status, and hence no frontend events will be generated. If a frontend device | ||
5676 | + * is closed, this flag will be automatically turned off when the device is | ||
5677 | + * reopened read-write. | ||
5678 | + */ | ||
5679 | +#define FE_TUNE_MODE_ONESHOT 0x01 | ||
5680 | + | ||
5681 | +/* Digital TV Frontend API calls */ | ||
5682 | + | ||
5683 | +#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) | ||
5684 | + | ||
5685 | +#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) | ||
5686 | +#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) | ||
5687 | +#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) | ||
5688 | +#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ | ||
5689 | + | ||
5690 | +#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ | ||
5691 | +#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ | ||
5692 | +#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ | ||
5693 | + | ||
5694 | +#define FE_READ_STATUS _IOR('o', 69, fe_status_t) | ||
5695 | +#define FE_READ_BER _IOR('o', 70, __u32) | ||
5696 | +#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) | ||
5697 | +#define FE_READ_SNR _IOR('o', 72, __u16) | ||
5698 | +#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) | ||
5699 | + | ||
5700 | +#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ | ||
5701 | +#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) | ||
5702 | + | ||
5703 | +#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ | ||
5704 | + | ||
5705 | +#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) | ||
5706 | +#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) | ||
5707 | + | ||
5708 | #if defined(__DVB_CORE__) || !defined (__KERNEL__) | ||
5709 | |||
5710 | /* | ||
5711 | - * DEPRECATED: The DVBv3 ioctls, structs and enums should not be used on | ||
5712 | - * newer programs, as it doesn't support the second generation of digital | ||
5713 | - * TV standards, nor supports newer delivery systems. | ||
5714 | + * DEPRECATED: Everything below is deprecated in favor of DVBv5 API | ||
5715 | + * | ||
5716 | + * The DVBv3 only ioctls, structs and enums should not be used on | ||
5717 | + * newer programs, as it doesn't support the second generation of | ||
5718 | + * digital TV standards, nor supports newer delivery systems. | ||
5719 | + * They also don't support modern frontends with usually support multiple | ||
5720 | + * delivery systems. | ||
5721 | + * | ||
5722 | + * Drivers shouldn't use them. | ||
5723 | + * | ||
5724 | + * New applications should use DVBv5 delivery system instead | ||
5725 | + */ | ||
5726 | + | ||
5727 | +/* | ||
5728 | */ | ||
5729 | |||
5730 | enum fe_bandwidth { | ||
5731 | @@ -503,7 +936,7 @@ enum fe_bandwidth { | ||
5732 | BANDWIDTH_1_712_MHZ, | ||
5733 | }; | ||
5734 | |||
5735 | -/* This is needed for legacy userspace support */ | ||
5736 | +/* This is kept for legacy userspace support */ | ||
5737 | typedef enum fe_sec_voltage fe_sec_voltage_t; | ||
5738 | typedef enum fe_caps fe_caps_t; | ||
5739 | typedef enum fe_type fe_type_t; | ||
5740 | @@ -521,6 +954,8 @@ typedef enum fe_pilot fe_pilot_t; | ||
5741 | typedef enum fe_rolloff fe_rolloff_t; | ||
5742 | typedef enum fe_delivery_system fe_delivery_system_t; | ||
5743 | |||
5744 | +/* DVBv3 structs */ | ||
5745 | + | ||
5746 | struct dvb_qpsk_parameters { | ||
5747 | __u32 symbol_rate; /* symbol rate in Symbols per second */ | ||
5748 | fe_code_rate_t fec_inner; /* forward error correction (see above) */ | ||
5749 | @@ -562,42 +997,12 @@ struct dvb_frontend_event { | ||
5750 | fe_status_t status; | ||
5751 | struct dvb_frontend_parameters parameters; | ||
5752 | }; | ||
5753 | -#endif | ||
5754 | |||
5755 | -#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) | ||
5756 | -#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) | ||
5757 | - | ||
5758 | -/** | ||
5759 | - * When set, this flag will disable any zigzagging or other "normal" tuning | ||
5760 | - * behaviour. Additionally, there will be no automatic monitoring of the lock | ||
5761 | - * status, and hence no frontend events will be generated. If a frontend device | ||
5762 | - * is closed, this flag will be automatically turned off when the device is | ||
5763 | - * reopened read-write. | ||
5764 | - */ | ||
5765 | -#define FE_TUNE_MODE_ONESHOT 0x01 | ||
5766 | - | ||
5767 | -#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) | ||
5768 | - | ||
5769 | -#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) | ||
5770 | -#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) | ||
5771 | -#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) | ||
5772 | -#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ | ||
5773 | - | ||
5774 | -#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ | ||
5775 | -#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ | ||
5776 | -#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ | ||
5777 | - | ||
5778 | -#define FE_READ_STATUS _IOR('o', 69, fe_status_t) | ||
5779 | -#define FE_READ_BER _IOR('o', 70, __u32) | ||
5780 | -#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) | ||
5781 | -#define FE_READ_SNR _IOR('o', 72, __u16) | ||
5782 | -#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) | ||
5783 | +/* DVBv3 API calls */ | ||
5784 | |||
5785 | #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) | ||
5786 | #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) | ||
5787 | -#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ | ||
5788 | -#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) | ||
5789 | |||
5790 | -#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ | ||
5791 | +#endif | ||
5792 | |||
5793 | #endif /*_DVBFRONTEND_H_*/ | ||
5794 | diff --git a/kernel/kprobes.c b/kernel/kprobes.c | ||
5795 | index 1b75fb8c7735..a864e94ecb6b 100644 | ||
5796 | --- a/kernel/kprobes.c | ||
5797 | +++ b/kernel/kprobes.c | ||
5798 | @@ -561,11 +561,12 @@ static void kprobe_optimizer(struct work_struct *work) | ||
5799 | do_free_cleaned_kprobes(); | ||
5800 | |||
5801 | mutex_unlock(&module_mutex); | ||
5802 | - mutex_unlock(&kprobe_mutex); | ||
5803 | |||
5804 | /* Step 5: Kick optimizer again if needed */ | ||
5805 | if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) | ||
5806 | kick_kprobe_optimizer(); | ||
5807 | + | ||
5808 | + mutex_unlock(&kprobe_mutex); | ||
5809 | } | ||
5810 | |||
5811 | /* Wait for completing optimization and unoptimization */ | ||
5812 | @@ -1149,6 +1150,26 @@ __releases(hlist_lock) | ||
5813 | } | ||
5814 | NOKPROBE_SYMBOL(kretprobe_table_unlock); | ||
5815 | |||
5816 | +struct kprobe kprobe_busy = { | ||
5817 | + .addr = (void *) get_kprobe, | ||
5818 | +}; | ||
5819 | + | ||
5820 | +void kprobe_busy_begin(void) | ||
5821 | +{ | ||
5822 | + struct kprobe_ctlblk *kcb; | ||
5823 | + | ||
5824 | + preempt_disable(); | ||
5825 | + __this_cpu_write(current_kprobe, &kprobe_busy); | ||
5826 | + kcb = get_kprobe_ctlblk(); | ||
5827 | + kcb->kprobe_status = KPROBE_HIT_ACTIVE; | ||
5828 | +} | ||
5829 | + | ||
5830 | +void kprobe_busy_end(void) | ||
5831 | +{ | ||
5832 | + __this_cpu_write(current_kprobe, NULL); | ||
5833 | + preempt_enable(); | ||
5834 | +} | ||
5835 | + | ||
5836 | /* | ||
5837 | * This function is called from finish_task_switch when task tk becomes dead, | ||
5838 | * so that we can recycle any function-return probe instances associated | ||
5839 | @@ -1166,6 +1187,8 @@ void kprobe_flush_task(struct task_struct *tk) | ||
5840 | /* Early boot. kretprobe_table_locks not yet initialized. */ | ||
5841 | return; | ||
5842 | |||
5843 | + kprobe_busy_begin(); | ||
5844 | + | ||
5845 | INIT_HLIST_HEAD(&empty_rp); | ||
5846 | hash = hash_ptr(tk, KPROBE_HASH_BITS); | ||
5847 | head = &kretprobe_inst_table[hash]; | ||
5848 | @@ -1179,6 +1202,8 @@ void kprobe_flush_task(struct task_struct *tk) | ||
5849 | hlist_del(&ri->hlist); | ||
5850 | kfree(ri); | ||
5851 | } | ||
5852 | + | ||
5853 | + kprobe_busy_end(); | ||
5854 | } | ||
5855 | NOKPROBE_SYMBOL(kprobe_flush_task); | ||
5856 | |||
5857 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
5858 | index 82cec9a666e7..870d802c46f9 100644 | ||
5859 | --- a/kernel/sched/core.c | ||
5860 | +++ b/kernel/sched/core.c | ||
5861 | @@ -3697,7 +3697,8 @@ void rt_mutex_setprio(struct task_struct *p, int prio) | ||
5862 | if (dl_prio(prio)) { | ||
5863 | struct task_struct *pi_task = rt_mutex_get_top_task(p); | ||
5864 | if (!dl_prio(p->normal_prio) || | ||
5865 | - (pi_task && dl_entity_preempt(&pi_task->dl, &p->dl))) { | ||
5866 | + (pi_task && dl_prio(pi_task->prio) && | ||
5867 | + dl_entity_preempt(&pi_task->dl, &p->dl))) { | ||
5868 | p->dl.dl_boosted = 1; | ||
5869 | queue_flag |= ENQUEUE_REPLENISH; | ||
5870 | } else | ||
5871 | diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c | ||
5872 | index 6d3b432a748a..88eb9261c7b5 100644 | ||
5873 | --- a/kernel/trace/blktrace.c | ||
5874 | +++ b/kernel/trace/blktrace.c | ||
5875 | @@ -15,6 +15,9 @@ | ||
5876 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
5877 | * | ||
5878 | */ | ||
5879 | + | ||
5880 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
5881 | + | ||
5882 | #include <linux/kernel.h> | ||
5883 | #include <linux/blkdev.h> | ||
5884 | #include <linux/blktrace_api.h> | ||
5885 | @@ -481,6 +484,16 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | ||
5886 | */ | ||
5887 | strreplace(buts->name, '/', '_'); | ||
5888 | |||
5889 | + /* | ||
5890 | + * bdev can be NULL, as with scsi-generic, this is a helpful as | ||
5891 | + * we can be. | ||
5892 | + */ | ||
5893 | + if (q->blk_trace) { | ||
5894 | + pr_warn("Concurrent blktraces are not allowed on %s\n", | ||
5895 | + buts->name); | ||
5896 | + return -EBUSY; | ||
5897 | + } | ||
5898 | + | ||
5899 | bt = kzalloc(sizeof(*bt), GFP_KERNEL); | ||
5900 | if (!bt) | ||
5901 | return -ENOMEM; | ||
5902 | diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c | ||
5903 | index c9ca2ed50c0e..a371c7def875 100644 | ||
5904 | --- a/kernel/trace/trace_events_trigger.c | ||
5905 | +++ b/kernel/trace/trace_events_trigger.c | ||
5906 | @@ -222,11 +222,17 @@ static int event_trigger_regex_open(struct inode *inode, struct file *file) | ||
5907 | |||
5908 | static int trigger_process_regex(struct trace_event_file *file, char *buff) | ||
5909 | { | ||
5910 | - char *command, *next = buff; | ||
5911 | + char *command, *next; | ||
5912 | struct event_command *p; | ||
5913 | int ret = -EINVAL; | ||
5914 | |||
5915 | + next = buff = skip_spaces(buff); | ||
5916 | command = strsep(&next, ": \t"); | ||
5917 | + if (next) { | ||
5918 | + next = skip_spaces(next); | ||
5919 | + if (!*next) | ||
5920 | + next = NULL; | ||
5921 | + } | ||
5922 | command = (command[0] != '!') ? command : command + 1; | ||
5923 | |||
5924 | mutex_lock(&trigger_cmd_mutex); | ||
5925 | @@ -629,8 +635,14 @@ event_trigger_callback(struct event_command *cmd_ops, | ||
5926 | int ret; | ||
5927 | |||
5928 | /* separate the trigger from the filter (t:n [if filter]) */ | ||
5929 | - if (param && isdigit(param[0])) | ||
5930 | + if (param && isdigit(param[0])) { | ||
5931 | trigger = strsep(¶m, " \t"); | ||
5932 | + if (param) { | ||
5933 | + param = skip_spaces(param); | ||
5934 | + if (!*param) | ||
5935 | + param = NULL; | ||
5936 | + } | ||
5937 | + } | ||
5938 | |||
5939 | trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger); | ||
5940 | |||
5941 | @@ -1335,6 +1347,11 @@ int event_enable_trigger_func(struct event_command *cmd_ops, | ||
5942 | trigger = strsep(¶m, " \t"); | ||
5943 | if (!trigger) | ||
5944 | return -EINVAL; | ||
5945 | + if (param) { | ||
5946 | + param = skip_spaces(param); | ||
5947 | + if (!*param) | ||
5948 | + param = NULL; | ||
5949 | + } | ||
5950 | |||
5951 | system = strsep(&trigger, ":"); | ||
5952 | if (!trigger) | ||
5953 | diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c | ||
5954 | index 2c13ecc5bb2c..ed1f3df27260 100644 | ||
5955 | --- a/lib/zlib_inflate/inffast.c | ||
5956 | +++ b/lib/zlib_inflate/inffast.c | ||
5957 | @@ -10,17 +10,6 @@ | ||
5958 | |||
5959 | #ifndef ASMINF | ||
5960 | |||
5961 | -/* Allow machine dependent optimization for post-increment or pre-increment. | ||
5962 | - Based on testing to date, | ||
5963 | - Pre-increment preferred for: | ||
5964 | - - PowerPC G3 (Adler) | ||
5965 | - - MIPS R5000 (Randers-Pehrson) | ||
5966 | - Post-increment preferred for: | ||
5967 | - - none | ||
5968 | - No measurable difference: | ||
5969 | - - Pentium III (Anderson) | ||
5970 | - - M68060 (Nikl) | ||
5971 | - */ | ||
5972 | union uu { | ||
5973 | unsigned short us; | ||
5974 | unsigned char b[2]; | ||
5975 | @@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p) | ||
5976 | return mm.us; | ||
5977 | } | ||
5978 | |||
5979 | -#ifdef POSTINC | ||
5980 | -# define OFF 0 | ||
5981 | -# define PUP(a) *(a)++ | ||
5982 | -# define UP_UNALIGNED(a) get_unaligned16((a)++) | ||
5983 | -#else | ||
5984 | -# define OFF 1 | ||
5985 | -# define PUP(a) *++(a) | ||
5986 | -# define UP_UNALIGNED(a) get_unaligned16(++(a)) | ||
5987 | -#endif | ||
5988 | - | ||
5989 | /* | ||
5990 | Decode literal, length, and distance codes and write out the resulting | ||
5991 | literal and match bytes until either not enough input or output is | ||
5992 | @@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
5993 | |||
5994 | /* copy state to local variables */ | ||
5995 | state = (struct inflate_state *)strm->state; | ||
5996 | - in = strm->next_in - OFF; | ||
5997 | + in = strm->next_in; | ||
5998 | last = in + (strm->avail_in - 5); | ||
5999 | - out = strm->next_out - OFF; | ||
6000 | + out = strm->next_out; | ||
6001 | beg = out - (start - strm->avail_out); | ||
6002 | end = out + (strm->avail_out - 257); | ||
6003 | #ifdef INFLATE_STRICT | ||
6004 | @@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6005 | input data or output space */ | ||
6006 | do { | ||
6007 | if (bits < 15) { | ||
6008 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6009 | + hold += (unsigned long)(*in++) << bits; | ||
6010 | bits += 8; | ||
6011 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6012 | + hold += (unsigned long)(*in++) << bits; | ||
6013 | bits += 8; | ||
6014 | } | ||
6015 | this = lcode[hold & lmask]; | ||
6016 | @@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6017 | bits -= op; | ||
6018 | op = (unsigned)(this.op); | ||
6019 | if (op == 0) { /* literal */ | ||
6020 | - PUP(out) = (unsigned char)(this.val); | ||
6021 | + *out++ = (unsigned char)(this.val); | ||
6022 | } | ||
6023 | else if (op & 16) { /* length base */ | ||
6024 | len = (unsigned)(this.val); | ||
6025 | op &= 15; /* number of extra bits */ | ||
6026 | if (op) { | ||
6027 | if (bits < op) { | ||
6028 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6029 | + hold += (unsigned long)(*in++) << bits; | ||
6030 | bits += 8; | ||
6031 | } | ||
6032 | len += (unsigned)hold & ((1U << op) - 1); | ||
6033 | @@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6034 | bits -= op; | ||
6035 | } | ||
6036 | if (bits < 15) { | ||
6037 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6038 | + hold += (unsigned long)(*in++) << bits; | ||
6039 | bits += 8; | ||
6040 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6041 | + hold += (unsigned long)(*in++) << bits; | ||
6042 | bits += 8; | ||
6043 | } | ||
6044 | this = dcode[hold & dmask]; | ||
6045 | @@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6046 | dist = (unsigned)(this.val); | ||
6047 | op &= 15; /* number of extra bits */ | ||
6048 | if (bits < op) { | ||
6049 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6050 | + hold += (unsigned long)(*in++) << bits; | ||
6051 | bits += 8; | ||
6052 | if (bits < op) { | ||
6053 | - hold += (unsigned long)(PUP(in)) << bits; | ||
6054 | + hold += (unsigned long)(*in++) << bits; | ||
6055 | bits += 8; | ||
6056 | } | ||
6057 | } | ||
6058 | @@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6059 | state->mode = BAD; | ||
6060 | break; | ||
6061 | } | ||
6062 | - from = window - OFF; | ||
6063 | + from = window; | ||
6064 | if (write == 0) { /* very common case */ | ||
6065 | from += wsize - op; | ||
6066 | if (op < len) { /* some from window */ | ||
6067 | len -= op; | ||
6068 | do { | ||
6069 | - PUP(out) = PUP(from); | ||
6070 | + *out++ = *from++; | ||
6071 | } while (--op); | ||
6072 | from = out - dist; /* rest from output */ | ||
6073 | } | ||
6074 | @@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6075 | if (op < len) { /* some from end of window */ | ||
6076 | len -= op; | ||
6077 | do { | ||
6078 | - PUP(out) = PUP(from); | ||
6079 | + *out++ = *from++; | ||
6080 | } while (--op); | ||
6081 | - from = window - OFF; | ||
6082 | + from = window; | ||
6083 | if (write < len) { /* some from start of window */ | ||
6084 | op = write; | ||
6085 | len -= op; | ||
6086 | do { | ||
6087 | - PUP(out) = PUP(from); | ||
6088 | + *out++ = *from++; | ||
6089 | } while (--op); | ||
6090 | from = out - dist; /* rest from output */ | ||
6091 | } | ||
6092 | @@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6093 | if (op < len) { /* some from window */ | ||
6094 | len -= op; | ||
6095 | do { | ||
6096 | - PUP(out) = PUP(from); | ||
6097 | + *out++ = *from++; | ||
6098 | } while (--op); | ||
6099 | from = out - dist; /* rest from output */ | ||
6100 | } | ||
6101 | } | ||
6102 | while (len > 2) { | ||
6103 | - PUP(out) = PUP(from); | ||
6104 | - PUP(out) = PUP(from); | ||
6105 | - PUP(out) = PUP(from); | ||
6106 | + *out++ = *from++; | ||
6107 | + *out++ = *from++; | ||
6108 | + *out++ = *from++; | ||
6109 | len -= 3; | ||
6110 | } | ||
6111 | if (len) { | ||
6112 | - PUP(out) = PUP(from); | ||
6113 | + *out++ = *from++; | ||
6114 | if (len > 1) | ||
6115 | - PUP(out) = PUP(from); | ||
6116 | + *out++ = *from++; | ||
6117 | } | ||
6118 | } | ||
6119 | else { | ||
6120 | @@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6121 | from = out - dist; /* copy direct from output */ | ||
6122 | /* minimum length is three */ | ||
6123 | /* Align out addr */ | ||
6124 | - if (!((long)(out - 1 + OFF) & 1)) { | ||
6125 | - PUP(out) = PUP(from); | ||
6126 | + if (!((long)(out - 1) & 1)) { | ||
6127 | + *out++ = *from++; | ||
6128 | len--; | ||
6129 | } | ||
6130 | - sout = (unsigned short *)(out - OFF); | ||
6131 | + sout = (unsigned short *)(out); | ||
6132 | if (dist > 2) { | ||
6133 | unsigned short *sfrom; | ||
6134 | |||
6135 | - sfrom = (unsigned short *)(from - OFF); | ||
6136 | + sfrom = (unsigned short *)(from); | ||
6137 | loops = len >> 1; | ||
6138 | do | ||
6139 | #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
6140 | - PUP(sout) = PUP(sfrom); | ||
6141 | + *sout++ = *sfrom++; | ||
6142 | #else | ||
6143 | - PUP(sout) = UP_UNALIGNED(sfrom); | ||
6144 | + *sout++ = get_unaligned16(sfrom++); | ||
6145 | #endif | ||
6146 | while (--loops); | ||
6147 | - out = (unsigned char *)sout + OFF; | ||
6148 | - from = (unsigned char *)sfrom + OFF; | ||
6149 | + out = (unsigned char *)sout; | ||
6150 | + from = (unsigned char *)sfrom; | ||
6151 | } else { /* dist == 1 or dist == 2 */ | ||
6152 | unsigned short pat16; | ||
6153 | |||
6154 | - pat16 = *(sout-1+OFF); | ||
6155 | + pat16 = *(sout-1); | ||
6156 | if (dist == 1) { | ||
6157 | union uu mm; | ||
6158 | /* copy one char pattern to both bytes */ | ||
6159 | @@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6160 | } | ||
6161 | loops = len >> 1; | ||
6162 | do | ||
6163 | - PUP(sout) = pat16; | ||
6164 | + *sout++ = pat16; | ||
6165 | while (--loops); | ||
6166 | - out = (unsigned char *)sout + OFF; | ||
6167 | + out = (unsigned char *)sout; | ||
6168 | } | ||
6169 | if (len & 1) | ||
6170 | - PUP(out) = PUP(from); | ||
6171 | + *out++ = *from++; | ||
6172 | } | ||
6173 | } | ||
6174 | else if ((op & 64) == 0) { /* 2nd level distance code */ | ||
6175 | @@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start) | ||
6176 | hold &= (1U << bits) - 1; | ||
6177 | |||
6178 | /* update state and return */ | ||
6179 | - strm->next_in = in + OFF; | ||
6180 | - strm->next_out = out + OFF; | ||
6181 | + strm->next_in = in; | ||
6182 | + strm->next_out = out; | ||
6183 | strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); | ||
6184 | strm->avail_out = (unsigned)(out < end ? | ||
6185 | 257 + (end - out) : 257 - (out - end)); | ||
6186 | diff --git a/mm/slab_common.c b/mm/slab_common.c | ||
6187 | index 13f1926f8fcd..26c4d4722927 100644 | ||
6188 | --- a/mm/slab_common.c | ||
6189 | +++ b/mm/slab_common.c | ||
6190 | @@ -1345,7 +1345,7 @@ void kzfree(const void *p) | ||
6191 | if (unlikely(ZERO_OR_NULL_PTR(mem))) | ||
6192 | return; | ||
6193 | ks = ksize(mem); | ||
6194 | - memset(mem, 0, ks); | ||
6195 | + memzero_explicit(mem, ks); | ||
6196 | kfree(mem); | ||
6197 | } | ||
6198 | EXPORT_SYMBOL(kzfree); | ||
6199 | diff --git a/net/core/dev.c b/net/core/dev.c | ||
6200 | index 1041523aaa76..267b648a0645 100644 | ||
6201 | --- a/net/core/dev.c | ||
6202 | +++ b/net/core/dev.c | ||
6203 | @@ -82,6 +82,7 @@ | ||
6204 | #include <linux/slab.h> | ||
6205 | #include <linux/sched.h> | ||
6206 | #include <linux/mutex.h> | ||
6207 | +#include <linux/rwsem.h> | ||
6208 | #include <linux/string.h> | ||
6209 | #include <linux/mm.h> | ||
6210 | #include <linux/socket.h> | ||
6211 | @@ -189,7 +190,7 @@ static DEFINE_SPINLOCK(napi_hash_lock); | ||
6212 | static unsigned int napi_gen_id = NR_CPUS; | ||
6213 | static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8); | ||
6214 | |||
6215 | -static seqcount_t devnet_rename_seq; | ||
6216 | +static DECLARE_RWSEM(devnet_rename_sem); | ||
6217 | |||
6218 | static inline void dev_base_seq_inc(struct net *net) | ||
6219 | { | ||
6220 | @@ -866,33 +867,28 @@ EXPORT_SYMBOL(dev_get_by_index); | ||
6221 | * @net: network namespace | ||
6222 | * @name: a pointer to the buffer where the name will be stored. | ||
6223 | * @ifindex: the ifindex of the interface to get the name from. | ||
6224 | - * | ||
6225 | - * The use of raw_seqcount_begin() and cond_resched() before | ||
6226 | - * retrying is required as we want to give the writers a chance | ||
6227 | - * to complete when CONFIG_PREEMPT is not set. | ||
6228 | */ | ||
6229 | int netdev_get_name(struct net *net, char *name, int ifindex) | ||
6230 | { | ||
6231 | struct net_device *dev; | ||
6232 | - unsigned int seq; | ||
6233 | + int ret; | ||
6234 | |||
6235 | -retry: | ||
6236 | - seq = raw_seqcount_begin(&devnet_rename_seq); | ||
6237 | + down_read(&devnet_rename_sem); | ||
6238 | rcu_read_lock(); | ||
6239 | + | ||
6240 | dev = dev_get_by_index_rcu(net, ifindex); | ||
6241 | if (!dev) { | ||
6242 | - rcu_read_unlock(); | ||
6243 | - return -ENODEV; | ||
6244 | + ret = -ENODEV; | ||
6245 | + goto out; | ||
6246 | } | ||
6247 | |||
6248 | strcpy(name, dev->name); | ||
6249 | - rcu_read_unlock(); | ||
6250 | - if (read_seqcount_retry(&devnet_rename_seq, seq)) { | ||
6251 | - cond_resched(); | ||
6252 | - goto retry; | ||
6253 | - } | ||
6254 | |||
6255 | - return 0; | ||
6256 | + ret = 0; | ||
6257 | +out: | ||
6258 | + rcu_read_unlock(); | ||
6259 | + up_read(&devnet_rename_sem); | ||
6260 | + return ret; | ||
6261 | } | ||
6262 | |||
6263 | /** | ||
6264 | @@ -1157,10 +1153,10 @@ int dev_change_name(struct net_device *dev, const char *newname) | ||
6265 | if (dev->flags & IFF_UP) | ||
6266 | return -EBUSY; | ||
6267 | |||
6268 | - write_seqcount_begin(&devnet_rename_seq); | ||
6269 | + down_write(&devnet_rename_sem); | ||
6270 | |||
6271 | if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { | ||
6272 | - write_seqcount_end(&devnet_rename_seq); | ||
6273 | + up_write(&devnet_rename_sem); | ||
6274 | return 0; | ||
6275 | } | ||
6276 | |||
6277 | @@ -1168,7 +1164,7 @@ int dev_change_name(struct net_device *dev, const char *newname) | ||
6278 | |||
6279 | err = dev_get_valid_name(net, dev, newname); | ||
6280 | if (err < 0) { | ||
6281 | - write_seqcount_end(&devnet_rename_seq); | ||
6282 | + up_write(&devnet_rename_sem); | ||
6283 | return err; | ||
6284 | } | ||
6285 | |||
6286 | @@ -1183,11 +1179,11 @@ rollback: | ||
6287 | if (ret) { | ||
6288 | memcpy(dev->name, oldname, IFNAMSIZ); | ||
6289 | dev->name_assign_type = old_assign_type; | ||
6290 | - write_seqcount_end(&devnet_rename_seq); | ||
6291 | + up_write(&devnet_rename_sem); | ||
6292 | return ret; | ||
6293 | } | ||
6294 | |||
6295 | - write_seqcount_end(&devnet_rename_seq); | ||
6296 | + up_write(&devnet_rename_sem); | ||
6297 | |||
6298 | netdev_adjacent_rename_links(dev, oldname); | ||
6299 | |||
6300 | @@ -1208,7 +1204,7 @@ rollback: | ||
6301 | /* err >= 0 after dev_alloc_name() or stores the first errno */ | ||
6302 | if (err >= 0) { | ||
6303 | err = ret; | ||
6304 | - write_seqcount_begin(&devnet_rename_seq); | ||
6305 | + down_write(&devnet_rename_sem); | ||
6306 | memcpy(dev->name, oldname, IFNAMSIZ); | ||
6307 | memcpy(oldname, newname, IFNAMSIZ); | ||
6308 | dev->name_assign_type = old_assign_type; | ||
6309 | @@ -7359,6 +7355,13 @@ int register_netdevice(struct net_device *dev) | ||
6310 | rcu_barrier(); | ||
6311 | |||
6312 | dev->reg_state = NETREG_UNREGISTERED; | ||
6313 | + /* We should put the kobject that hold in | ||
6314 | + * netdev_unregister_kobject(), otherwise | ||
6315 | + * the net device cannot be freed when | ||
6316 | + * driver calls free_netdev(), because the | ||
6317 | + * kobject is being hold. | ||
6318 | + */ | ||
6319 | + kobject_put(&dev->dev.kobj); | ||
6320 | } | ||
6321 | /* | ||
6322 | * Prevent userspace races by waiting until the network | ||
6323 | diff --git a/net/core/sock.c b/net/core/sock.c | ||
6324 | index 41794a698da6..dac9365151df 100644 | ||
6325 | --- a/net/core/sock.c | ||
6326 | +++ b/net/core/sock.c | ||
6327 | @@ -1403,6 +1403,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | ||
6328 | cgroup_sk_alloc(&sk->sk_cgrp_data); | ||
6329 | sock_update_classid(&sk->sk_cgrp_data); | ||
6330 | sock_update_netprioidx(&sk->sk_cgrp_data); | ||
6331 | + sk_tx_queue_clear(sk); | ||
6332 | } | ||
6333 | |||
6334 | return sk; | ||
6335 | @@ -1587,6 +1588,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | ||
6336 | */ | ||
6337 | sk_refcnt_debug_inc(newsk); | ||
6338 | sk_set_socket(newsk, NULL); | ||
6339 | + sk_tx_queue_clear(newsk); | ||
6340 | newsk->sk_wq = NULL; | ||
6341 | |||
6342 | if (newsk->sk_prot->sockets_allocated) | ||
6343 | diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c | ||
6344 | index 6aec95e1fc13..305104d116d6 100644 | ||
6345 | --- a/net/ipv4/fib_semantics.c | ||
6346 | +++ b/net/ipv4/fib_semantics.c | ||
6347 | @@ -776,7 +776,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, | ||
6348 | if (fl4.flowi4_scope < RT_SCOPE_LINK) | ||
6349 | fl4.flowi4_scope = RT_SCOPE_LINK; | ||
6350 | |||
6351 | - if (cfg->fc_table) | ||
6352 | + if (cfg->fc_table && cfg->fc_table != RT_TABLE_MAIN) | ||
6353 | tbl = fib_get_table(net, cfg->fc_table); | ||
6354 | |||
6355 | if (tbl) | ||
6356 | diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c | ||
6357 | index dd5db4cc7d06..5f2e3334ccce 100644 | ||
6358 | --- a/net/ipv4/ip_tunnel.c | ||
6359 | +++ b/net/ipv4/ip_tunnel.c | ||
6360 | @@ -98,9 +98,10 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, | ||
6361 | __be32 remote, __be32 local, | ||
6362 | __be32 key) | ||
6363 | { | ||
6364 | - unsigned int hash; | ||
6365 | struct ip_tunnel *t, *cand = NULL; | ||
6366 | struct hlist_head *head; | ||
6367 | + struct net_device *ndev; | ||
6368 | + unsigned int hash; | ||
6369 | |||
6370 | hash = ip_tunnel_hash(key, remote); | ||
6371 | head = &itn->tunnels[hash]; | ||
6372 | @@ -175,8 +176,9 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, | ||
6373 | if (t) | ||
6374 | return t; | ||
6375 | |||
6376 | - if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags & IFF_UP) | ||
6377 | - return netdev_priv(itn->fb_tunnel_dev); | ||
6378 | + ndev = READ_ONCE(itn->fb_tunnel_dev); | ||
6379 | + if (ndev && ndev->flags & IFF_UP) | ||
6380 | + return netdev_priv(ndev); | ||
6381 | |||
6382 | return NULL; | ||
6383 | } | ||
6384 | @@ -1193,9 +1195,9 @@ void ip_tunnel_uninit(struct net_device *dev) | ||
6385 | struct ip_tunnel_net *itn; | ||
6386 | |||
6387 | itn = net_generic(net, tunnel->ip_tnl_net_id); | ||
6388 | - /* fb_tunnel_dev will be unregisted in net-exit call. */ | ||
6389 | - if (itn->fb_tunnel_dev != dev) | ||
6390 | - ip_tunnel_del(itn, netdev_priv(dev)); | ||
6391 | + ip_tunnel_del(itn, netdev_priv(dev)); | ||
6392 | + if (itn->fb_tunnel_dev == dev) | ||
6393 | + WRITE_ONCE(itn->fb_tunnel_dev, NULL); | ||
6394 | |||
6395 | dst_cache_reset(&tunnel->dst_cache); | ||
6396 | } | ||
6397 | diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c | ||
6398 | index c99230efcd52..00397c6add20 100644 | ||
6399 | --- a/net/ipv4/tcp_cubic.c | ||
6400 | +++ b/net/ipv4/tcp_cubic.c | ||
6401 | @@ -414,6 +414,8 @@ static void hystart_update(struct sock *sk, u32 delay) | ||
6402 | |||
6403 | if (hystart_detect & HYSTART_DELAY) { | ||
6404 | /* obtain the minimum delay of more than sampling packets */ | ||
6405 | + if (ca->curr_rtt > delay) | ||
6406 | + ca->curr_rtt = delay; | ||
6407 | if (ca->sample_cnt < HYSTART_MIN_SAMPLES) { | ||
6408 | if (ca->curr_rtt == 0 || ca->curr_rtt > delay) | ||
6409 | ca->curr_rtt = delay; | ||
6410 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c | ||
6411 | index 52014c5312b9..b3953f789891 100644 | ||
6412 | --- a/net/ipv4/tcp_input.c | ||
6413 | +++ b/net/ipv4/tcp_input.c | ||
6414 | @@ -4537,7 +4537,11 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) | ||
6415 | if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb, | ||
6416 | skb, &fragstolen)) { | ||
6417 | coalesce_done: | ||
6418 | - tcp_grow_window(sk, skb); | ||
6419 | + /* For non sack flows, do not grow window to force DUPACK | ||
6420 | + * and trigger fast retransmit. | ||
6421 | + */ | ||
6422 | + if (tcp_is_sack(tp)) | ||
6423 | + tcp_grow_window(sk, skb); | ||
6424 | kfree_skb_partial(skb, fragstolen); | ||
6425 | skb = NULL; | ||
6426 | goto add_sack; | ||
6427 | @@ -4621,7 +4625,11 @@ add_sack: | ||
6428 | tcp_sack_new_ofo_skb(sk, seq, end_seq); | ||
6429 | end: | ||
6430 | if (skb) { | ||
6431 | - tcp_grow_window(sk, skb); | ||
6432 | + /* For non sack flows, do not grow window to force DUPACK | ||
6433 | + * and trigger fast retransmit. | ||
6434 | + */ | ||
6435 | + if (tcp_is_sack(tp)) | ||
6436 | + tcp_grow_window(sk, skb); | ||
6437 | skb_set_owner_r(skb, sk); | ||
6438 | } | ||
6439 | } | ||
6440 | diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c | ||
6441 | index caee5530ae2c..ca001ecb7197 100644 | ||
6442 | --- a/net/ipv6/ip6_gre.c | ||
6443 | +++ b/net/ipv6/ip6_gre.c | ||
6444 | @@ -124,6 +124,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev, | ||
6445 | int dev_type = (gre_proto == htons(ETH_P_TEB)) ? | ||
6446 | ARPHRD_ETHER : ARPHRD_IP6GRE; | ||
6447 | int score, cand_score = 4; | ||
6448 | + struct net_device *ndev; | ||
6449 | |||
6450 | for_each_ip_tunnel_rcu(t, ign->tunnels_r_l[h0 ^ h1]) { | ||
6451 | if (!ipv6_addr_equal(local, &t->parms.laddr) || | ||
6452 | @@ -226,9 +227,9 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev, | ||
6453 | if (cand) | ||
6454 | return cand; | ||
6455 | |||
6456 | - dev = ign->fb_tunnel_dev; | ||
6457 | - if (dev->flags & IFF_UP) | ||
6458 | - return netdev_priv(dev); | ||
6459 | + ndev = READ_ONCE(ign->fb_tunnel_dev); | ||
6460 | + if (ndev && ndev->flags & IFF_UP) | ||
6461 | + return netdev_priv(ndev); | ||
6462 | |||
6463 | return NULL; | ||
6464 | } | ||
6465 | @@ -364,6 +365,8 @@ static void ip6gre_tunnel_uninit(struct net_device *dev) | ||
6466 | struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id); | ||
6467 | |||
6468 | ip6gre_tunnel_unlink(ign, t); | ||
6469 | + if (ign->fb_tunnel_dev == dev) | ||
6470 | + WRITE_ONCE(ign->fb_tunnel_dev, NULL); | ||
6471 | dst_cache_reset(&t->dst_cache); | ||
6472 | dev_put(dev); | ||
6473 | } | ||
6474 | diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c | ||
6475 | index e065d48b31b9..f904b9b24027 100644 | ||
6476 | --- a/net/ipv6/mcast.c | ||
6477 | +++ b/net/ipv6/mcast.c | ||
6478 | @@ -2601,6 +2601,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev) | ||
6479 | idev->mc_list = i->next; | ||
6480 | |||
6481 | write_unlock_bh(&idev->lock); | ||
6482 | + ip6_mc_clear_src(i); | ||
6483 | ma_put(i); | ||
6484 | write_lock_bh(&idev->lock); | ||
6485 | } | ||
6486 | diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c | ||
6487 | index fdc1de1cb4fa..c191ea65a6c7 100644 | ||
6488 | --- a/net/l2tp/l2tp_core.c | ||
6489 | +++ b/net/l2tp/l2tp_core.c | ||
6490 | @@ -351,8 +351,13 @@ int l2tp_session_register(struct l2tp_session *session, | ||
6491 | |||
6492 | spin_lock_bh(&pn->l2tp_session_hlist_lock); | ||
6493 | |||
6494 | + /* IP encap expects session IDs to be globally unique, while | ||
6495 | + * UDP encap doesn't. | ||
6496 | + */ | ||
6497 | hlist_for_each_entry(session_walk, g_head, global_hlist) | ||
6498 | - if (session_walk->session_id == session->session_id) { | ||
6499 | + if (session_walk->session_id == session->session_id && | ||
6500 | + (session_walk->tunnel->encap == L2TP_ENCAPTYPE_IP || | ||
6501 | + tunnel->encap == L2TP_ENCAPTYPE_IP)) { | ||
6502 | err = -EEXIST; | ||
6503 | goto err_tlock_pnlock; | ||
6504 | } | ||
6505 | diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c | ||
6506 | index f64660e9ff87..511496278262 100644 | ||
6507 | --- a/net/netfilter/ipset/ip_set_core.c | ||
6508 | +++ b/net/netfilter/ipset/ip_set_core.c | ||
6509 | @@ -379,6 +379,8 @@ ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], size_t len, | ||
6510 | for (id = 0; id < IPSET_EXT_ID_MAX; id++) { | ||
6511 | if (!add_extension(id, cadt_flags, tb)) | ||
6512 | continue; | ||
6513 | + if (align < ip_set_extensions[id].align) | ||
6514 | + align = ip_set_extensions[id].align; | ||
6515 | len = ALIGN(len, ip_set_extensions[id].align); | ||
6516 | set->offset[id] = len; | ||
6517 | set->extensions |= ip_set_extensions[id].type; | ||
6518 | diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c | ||
6519 | index 832d854c2d5c..01ad588144e3 100644 | ||
6520 | --- a/net/rxrpc/call_accept.c | ||
6521 | +++ b/net/rxrpc/call_accept.c | ||
6522 | @@ -26,6 +26,11 @@ | ||
6523 | #include <net/ip.h> | ||
6524 | #include "ar-internal.h" | ||
6525 | |||
6526 | +static void rxrpc_dummy_notify(struct sock *sk, struct rxrpc_call *call, | ||
6527 | + unsigned long user_call_ID) | ||
6528 | +{ | ||
6529 | +} | ||
6530 | + | ||
6531 | /* | ||
6532 | * Preallocate a single service call, connection and peer and, if possible, | ||
6533 | * give them a user ID and attach the user's side of the ID to them. | ||
6534 | @@ -224,6 +229,8 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx) | ||
6535 | if (rx->discard_new_call) { | ||
6536 | _debug("discard %lx", call->user_call_ID); | ||
6537 | rx->discard_new_call(call, call->user_call_ID); | ||
6538 | + if (call->notify_rx) | ||
6539 | + call->notify_rx = rxrpc_dummy_notify; | ||
6540 | rxrpc_put_call(call, rxrpc_call_put_kernel); | ||
6541 | } | ||
6542 | rxrpc_call_completed(call); | ||
6543 | diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c | ||
6544 | index 88ce8edf1261..04ca08f85220 100644 | ||
6545 | --- a/net/sched/sch_generic.c | ||
6546 | +++ b/net/sched/sch_generic.c | ||
6547 | @@ -337,6 +337,7 @@ void __netdev_watchdog_up(struct net_device *dev) | ||
6548 | dev_hold(dev); | ||
6549 | } | ||
6550 | } | ||
6551 | +EXPORT_SYMBOL_GPL(__netdev_watchdog_up); | ||
6552 | |||
6553 | static void dev_watchdog_up(struct net_device *dev) | ||
6554 | { | ||
6555 | diff --git a/net/sctp/associola.c b/net/sctp/associola.c | ||
6556 | index 16e120b84118..8c5597d07240 100644 | ||
6557 | --- a/net/sctp/associola.c | ||
6558 | +++ b/net/sctp/associola.c | ||
6559 | @@ -1583,12 +1583,15 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len) | ||
6560 | int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, | ||
6561 | sctp_scope_t scope, gfp_t gfp) | ||
6562 | { | ||
6563 | + struct sock *sk = asoc->base.sk; | ||
6564 | int flags; | ||
6565 | |||
6566 | /* Use scoping rules to determine the subset of addresses from | ||
6567 | * the endpoint. | ||
6568 | */ | ||
6569 | - flags = (PF_INET6 == asoc->base.sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0; | ||
6570 | + flags = (PF_INET6 == sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0; | ||
6571 | + if (!inet_v6_ipv6only(sk)) | ||
6572 | + flags |= SCTP_ADDR4_ALLOWED; | ||
6573 | if (asoc->peer.ipv4_address) | ||
6574 | flags |= SCTP_ADDR4_PEERSUPP; | ||
6575 | if (asoc->peer.ipv6_address) | ||
6576 | diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c | ||
6577 | index 401c60750b20..dc4335d817d8 100644 | ||
6578 | --- a/net/sctp/bind_addr.c | ||
6579 | +++ b/net/sctp/bind_addr.c | ||
6580 | @@ -451,6 +451,7 @@ static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest, | ||
6581 | * well as the remote peer. | ||
6582 | */ | ||
6583 | if ((((AF_INET == addr->sa.sa_family) && | ||
6584 | + (flags & SCTP_ADDR4_ALLOWED) && | ||
6585 | (flags & SCTP_ADDR4_PEERSUPP))) || | ||
6586 | (((AF_INET6 == addr->sa.sa_family) && | ||
6587 | (flags & SCTP_ADDR6_ALLOWED) && | ||
6588 | diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c | ||
6589 | index c5a2a538279b..b2c242facf1b 100644 | ||
6590 | --- a/net/sctp/protocol.c | ||
6591 | +++ b/net/sctp/protocol.c | ||
6592 | @@ -210,6 +210,7 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp, | ||
6593 | * sock as well as the remote peer. | ||
6594 | */ | ||
6595 | if ((((AF_INET == addr->a.sa.sa_family) && | ||
6596 | + (copy_flags & SCTP_ADDR4_ALLOWED) && | ||
6597 | (copy_flags & SCTP_ADDR4_PEERSUPP))) || | ||
6598 | (((AF_INET6 == addr->a.sa.sa_family) && | ||
6599 | (copy_flags & SCTP_ADDR6_ALLOWED) && | ||
6600 | diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c | ||
6601 | index 2e0a6f92e563..8391c2785550 100644 | ||
6602 | --- a/net/sunrpc/addr.c | ||
6603 | +++ b/net/sunrpc/addr.c | ||
6604 | @@ -81,11 +81,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap, | ||
6605 | |||
6606 | rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u", | ||
6607 | IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id); | ||
6608 | - if (unlikely((size_t)rc > sizeof(scopebuf))) | ||
6609 | + if (unlikely((size_t)rc >= sizeof(scopebuf))) | ||
6610 | return 0; | ||
6611 | |||
6612 | len += rc; | ||
6613 | - if (unlikely(len > buflen)) | ||
6614 | + if (unlikely(len >= buflen)) | ||
6615 | return 0; | ||
6616 | |||
6617 | strcat(buf, scopebuf); | ||
6618 | diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c | ||
6619 | index 34f94052c519..137f92bfafac 100644 | ||
6620 | --- a/net/sunrpc/rpc_pipe.c | ||
6621 | +++ b/net/sunrpc/rpc_pipe.c | ||
6622 | @@ -1347,6 +1347,7 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data) | ||
6623 | q.len = strlen(gssd_dummy_clnt_dir[0].name); | ||
6624 | clnt_dentry = d_hash_and_lookup(gssd_dentry, &q); | ||
6625 | if (!clnt_dentry) { | ||
6626 | + __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1); | ||
6627 | pipe_dentry = ERR_PTR(-ENOENT); | ||
6628 | goto out; | ||
6629 | } | ||
6630 | diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c | ||
6631 | index 69846c6574ef..dd547edee59f 100644 | ||
6632 | --- a/net/sunrpc/xdr.c | ||
6633 | +++ b/net/sunrpc/xdr.c | ||
6634 | @@ -1036,6 +1036,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf, | ||
6635 | base = 0; | ||
6636 | } else { | ||
6637 | base -= buf->head[0].iov_len; | ||
6638 | + subbuf->head[0].iov_base = buf->head[0].iov_base; | ||
6639 | subbuf->head[0].iov_len = 0; | ||
6640 | } | ||
6641 | |||
6642 | @@ -1048,6 +1049,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf, | ||
6643 | base = 0; | ||
6644 | } else { | ||
6645 | base -= buf->page_len; | ||
6646 | + subbuf->pages = buf->pages; | ||
6647 | + subbuf->page_base = 0; | ||
6648 | subbuf->page_len = 0; | ||
6649 | } | ||
6650 | |||
6651 | @@ -1059,6 +1062,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf, | ||
6652 | base = 0; | ||
6653 | } else { | ||
6654 | base -= buf->tail[0].iov_len; | ||
6655 | + subbuf->tail[0].iov_base = buf->tail[0].iov_base; | ||
6656 | subbuf->tail[0].iov_len = 0; | ||
6657 | } | ||
6658 | |||
6659 | diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include | ||
6660 | index 558dea61db11..1920b9e2d251 100644 | ||
6661 | --- a/scripts/Kbuild.include | ||
6662 | +++ b/scripts/Kbuild.include | ||
6663 | @@ -82,20 +82,21 @@ cc-cross-prefix = \ | ||
6664 | fi))) | ||
6665 | |||
6666 | # output directory for tests below | ||
6667 | -TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | ||
6668 | +TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$ | ||
6669 | |||
6670 | # try-run | ||
6671 | # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) | ||
6672 | # Exit code chooses option. "$$TMP" is can be used as temporary file and | ||
6673 | # is automatically cleaned up. | ||
6674 | try-run = $(shell set -e; \ | ||
6675 | - TMP="$(TMPOUT).$$$$.tmp"; \ | ||
6676 | - TMPO="$(TMPOUT).$$$$.o"; \ | ||
6677 | + TMP=$(TMPOUT)/tmp; \ | ||
6678 | + TMPO=$(TMPOUT)/tmp.o; \ | ||
6679 | + mkdir -p $(TMPOUT); \ | ||
6680 | + trap "rm -rf $(TMPOUT)" EXIT; \ | ||
6681 | if ($(1)) >/dev/null 2>&1; \ | ||
6682 | then echo "$(2)"; \ | ||
6683 | else echo "$(3)"; \ | ||
6684 | - fi; \ | ||
6685 | - rm -f "$$TMP" "$$TMPO") | ||
6686 | + fi) | ||
6687 | |||
6688 | # as-option | ||
6689 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) | ||
6690 | diff --git a/scripts/mksysmap b/scripts/mksysmap | ||
6691 | index a35acc0d0b82..9aa23d15862a 100755 | ||
6692 | --- a/scripts/mksysmap | ||
6693 | +++ b/scripts/mksysmap | ||
6694 | @@ -41,4 +41,4 @@ | ||
6695 | # so we just ignore them to let readprofile continue to work. | ||
6696 | # (At least sparc64 has __crc_ in the middle). | ||
6697 | |||
6698 | -$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2 | ||
6699 | +$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2 | ||
6700 | diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c | ||
6701 | index bfc4ffa1fa1a..6ca297821d45 100644 | ||
6702 | --- a/security/selinux/ss/services.c | ||
6703 | +++ b/security/selinux/ss/services.c | ||
6704 | @@ -2616,8 +2616,12 @@ err: | ||
6705 | if (*names) { | ||
6706 | for (i = 0; i < *len; i++) | ||
6707 | kfree((*names)[i]); | ||
6708 | + kfree(*names); | ||
6709 | } | ||
6710 | kfree(*values); | ||
6711 | + *len = 0; | ||
6712 | + *names = NULL; | ||
6713 | + *values = NULL; | ||
6714 | goto out; | ||
6715 | } | ||
6716 | |||
6717 | diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c | ||
6718 | index 718d5e3b7806..6c06d0645779 100644 | ||
6719 | --- a/sound/isa/wavefront/wavefront_synth.c | ||
6720 | +++ b/sound/isa/wavefront/wavefront_synth.c | ||
6721 | @@ -1174,7 +1174,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header) | ||
6722 | "alias for %d\n", | ||
6723 | header->number, | ||
6724 | header->hdr.a.OriginalSample); | ||
6725 | - | ||
6726 | + | ||
6727 | + if (header->number >= WF_MAX_SAMPLE) | ||
6728 | + return -EINVAL; | ||
6729 | + | ||
6730 | munge_int32 (header->number, &alias_hdr[0], 2); | ||
6731 | munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2); | ||
6732 | munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset), | ||
6733 | @@ -1205,6 +1208,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header) | ||
6734 | int num_samples; | ||
6735 | unsigned char *msample_hdr; | ||
6736 | |||
6737 | + if (header->number >= WF_MAX_SAMPLE) | ||
6738 | + return -EINVAL; | ||
6739 | + | ||
6740 | msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL); | ||
6741 | if (! msample_hdr) | ||
6742 | return -ENOMEM; | ||
6743 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c | ||
6744 | index a866a20349c3..2def4ad579cc 100644 | ||
6745 | --- a/sound/pci/hda/patch_hdmi.c | ||
6746 | +++ b/sound/pci/hda/patch_hdmi.c | ||
6747 | @@ -3687,6 +3687,11 @@ HDA_CODEC_ENTRY(0x10de0095, "GPU 95 HDMI/DP", patch_nvhdmi), | ||
6748 | HDA_CODEC_ENTRY(0x10de0097, "GPU 97 HDMI/DP", patch_nvhdmi), | ||
6749 | HDA_CODEC_ENTRY(0x10de0098, "GPU 98 HDMI/DP", patch_nvhdmi), | ||
6750 | HDA_CODEC_ENTRY(0x10de0099, "GPU 99 HDMI/DP", patch_nvhdmi), | ||
6751 | +HDA_CODEC_ENTRY(0x10de009a, "GPU 9a HDMI/DP", patch_nvhdmi), | ||
6752 | +HDA_CODEC_ENTRY(0x10de009d, "GPU 9d HDMI/DP", patch_nvhdmi), | ||
6753 | +HDA_CODEC_ENTRY(0x10de009e, "GPU 9e HDMI/DP", patch_nvhdmi), | ||
6754 | +HDA_CODEC_ENTRY(0x10de009f, "GPU 9f HDMI/DP", patch_nvhdmi), | ||
6755 | +HDA_CODEC_ENTRY(0x10de00a0, "GPU a0 HDMI/DP", patch_nvhdmi), | ||
6756 | HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI", patch_nvhdmi_2ch), | ||
6757 | HDA_CODEC_ENTRY(0x10de8067, "MCP67/68 HDMI", patch_nvhdmi_2ch), | ||
6758 | HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP", patch_via_hdmi), | ||
6759 | diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c | ||
6760 | index dc30d780f874..3fcf174b99d3 100644 | ||
6761 | --- a/sound/soc/fsl/fsl_asrc_dma.c | ||
6762 | +++ b/sound/soc/fsl/fsl_asrc_dma.c | ||
6763 | @@ -243,6 +243,7 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream, | ||
6764 | ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be); | ||
6765 | if (ret) { | ||
6766 | dev_err(dev, "failed to config DMA channel for Back-End\n"); | ||
6767 | + dma_release_channel(pair->dma_chan[dir]); | ||
6768 | return ret; | ||
6769 | } | ||
6770 | |||
6771 | diff --git a/sound/usb/card.h b/sound/usb/card.h | ||
6772 | index 111b0f009afa..c4599cf0ddc9 100644 | ||
6773 | --- a/sound/usb/card.h | ||
6774 | +++ b/sound/usb/card.h | ||
6775 | @@ -80,6 +80,10 @@ struct snd_usb_endpoint { | ||
6776 | dma_addr_t sync_dma; /* DMA address of syncbuf */ | ||
6777 | |||
6778 | unsigned int pipe; /* the data i/o pipe */ | ||
6779 | + unsigned int framesize[2]; /* small/large frame sizes in samples */ | ||
6780 | + unsigned int sample_rem; /* remainder from division fs/fps */ | ||
6781 | + unsigned int sample_accum; /* sample accumulator */ | ||
6782 | + unsigned int fps; /* frames per second */ | ||
6783 | unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ | ||
6784 | unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ | ||
6785 | int freqshift; /* how much to shift the feedback value to get Q16.16 */ | ||
6786 | diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c | ||
6787 | index 30aa5f2df6da..b5207e71ed72 100644 | ||
6788 | --- a/sound/usb/endpoint.c | ||
6789 | +++ b/sound/usb/endpoint.c | ||
6790 | @@ -137,12 +137,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep) | ||
6791 | |||
6792 | /* | ||
6793 | * For streaming based on information derived from sync endpoints, | ||
6794 | - * prepare_outbound_urb_sizes() will call next_packet_size() to | ||
6795 | + * prepare_outbound_urb_sizes() will call slave_next_packet_size() to | ||
6796 | * determine the number of samples to be sent in the next packet. | ||
6797 | * | ||
6798 | - * For implicit feedback, next_packet_size() is unused. | ||
6799 | + * For implicit feedback, slave_next_packet_size() is unused. | ||
6800 | */ | ||
6801 | -int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) | ||
6802 | +int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep) | ||
6803 | { | ||
6804 | unsigned long flags; | ||
6805 | int ret; | ||
6806 | @@ -159,6 +159,29 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) | ||
6807 | return ret; | ||
6808 | } | ||
6809 | |||
6810 | +/* | ||
6811 | + * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes() | ||
6812 | + * will call next_packet_size() to determine the number of samples to be | ||
6813 | + * sent in the next packet. | ||
6814 | + */ | ||
6815 | +int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) | ||
6816 | +{ | ||
6817 | + int ret; | ||
6818 | + | ||
6819 | + if (ep->fill_max) | ||
6820 | + return ep->maxframesize; | ||
6821 | + | ||
6822 | + ep->sample_accum += ep->sample_rem; | ||
6823 | + if (ep->sample_accum >= ep->fps) { | ||
6824 | + ep->sample_accum -= ep->fps; | ||
6825 | + ret = ep->framesize[1]; | ||
6826 | + } else { | ||
6827 | + ret = ep->framesize[0]; | ||
6828 | + } | ||
6829 | + | ||
6830 | + return ret; | ||
6831 | +} | ||
6832 | + | ||
6833 | static void retire_outbound_urb(struct snd_usb_endpoint *ep, | ||
6834 | struct snd_urb_ctx *urb_ctx) | ||
6835 | { | ||
6836 | @@ -203,6 +226,8 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep, | ||
6837 | |||
6838 | if (ctx->packet_size[i]) | ||
6839 | counts = ctx->packet_size[i]; | ||
6840 | + else if (ep->sync_master) | ||
6841 | + counts = snd_usb_endpoint_slave_next_packet_size(ep); | ||
6842 | else | ||
6843 | counts = snd_usb_endpoint_next_packet_size(ep); | ||
6844 | |||
6845 | @@ -875,10 +900,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | ||
6846 | ep->maxpacksize = fmt->maxpacksize; | ||
6847 | ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX); | ||
6848 | |||
6849 | - if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) | ||
6850 | + if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) { | ||
6851 | ep->freqn = get_usb_full_speed_rate(rate); | ||
6852 | - else | ||
6853 | + ep->fps = 1000; | ||
6854 | + } else { | ||
6855 | ep->freqn = get_usb_high_speed_rate(rate); | ||
6856 | + ep->fps = 8000; | ||
6857 | + } | ||
6858 | + | ||
6859 | + ep->sample_rem = rate % ep->fps; | ||
6860 | + ep->framesize[0] = rate / ep->fps; | ||
6861 | + ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps; | ||
6862 | |||
6863 | /* calculate the frequency in 16.16 format */ | ||
6864 | ep->freqm = ep->freqn; | ||
6865 | @@ -937,6 +969,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | ||
6866 | ep->active_mask = 0; | ||
6867 | ep->unlink_mask = 0; | ||
6868 | ep->phase = 0; | ||
6869 | + ep->sample_accum = 0; | ||
6870 | |||
6871 | snd_usb_endpoint_start_quirk(ep); | ||
6872 | |||
6873 | diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h | ||
6874 | index 584f295d7c77..4aad49cbeb5f 100644 | ||
6875 | --- a/sound/usb/endpoint.h | ||
6876 | +++ b/sound/usb/endpoint.h | ||
6877 | @@ -27,6 +27,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep); | ||
6878 | void snd_usb_endpoint_free(struct snd_usb_endpoint *ep); | ||
6879 | |||
6880 | int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); | ||
6881 | +int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep); | ||
6882 | int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep); | ||
6883 | |||
6884 | void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, | ||
6885 | diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c | ||
6886 | index 024864ce3f76..6913ea27e978 100644 | ||
6887 | --- a/sound/usb/mixer.c | ||
6888 | +++ b/sound/usb/mixer.c | ||
6889 | @@ -585,8 +585,9 @@ static int check_matrix_bitmap(unsigned char *bmap, | ||
6890 | * if failed, give up and free the control instance. | ||
6891 | */ | ||
6892 | |||
6893 | -int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list, | ||
6894 | - struct snd_kcontrol *kctl) | ||
6895 | +int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list, | ||
6896 | + struct snd_kcontrol *kctl, | ||
6897 | + bool is_std_info) | ||
6898 | { | ||
6899 | struct usb_mixer_interface *mixer = list->mixer; | ||
6900 | int err; | ||
6901 | @@ -599,6 +600,7 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list, | ||
6902 | return err; | ||
6903 | } | ||
6904 | list->kctl = kctl; | ||
6905 | + list->is_std_info = is_std_info; | ||
6906 | list->next_id_elem = mixer->id_elems[list->id]; | ||
6907 | mixer->id_elems[list->id] = list; | ||
6908 | return 0; | ||
6909 | @@ -2397,15 +2399,23 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid) | ||
6910 | { | ||
6911 | struct usb_mixer_elem_list *list; | ||
6912 | |||
6913 | - for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) | ||
6914 | + for_each_mixer_elem(list, mixer, unitid) { | ||
6915 | + struct usb_mixer_elem_info *info; | ||
6916 | + | ||
6917 | + if (!list->is_std_info) | ||
6918 | + continue; | ||
6919 | + info = mixer_elem_list_to_info(list); | ||
6920 | + /* invalidate cache, so the value is read from the device */ | ||
6921 | + info->cached = 0; | ||
6922 | snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
6923 | &list->kctl->id); | ||
6924 | + } | ||
6925 | } | ||
6926 | |||
6927 | static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, | ||
6928 | struct usb_mixer_elem_list *list) | ||
6929 | { | ||
6930 | - struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list; | ||
6931 | + struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); | ||
6932 | static char *val_types[] = {"BOOLEAN", "INV_BOOLEAN", | ||
6933 | "S8", "U8", "S16", "U16"}; | ||
6934 | snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " | ||
6935 | @@ -2431,8 +2441,7 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry, | ||
6936 | mixer->ignore_ctl_error); | ||
6937 | snd_iprintf(buffer, "Card: %s\n", chip->card->longname); | ||
6938 | for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) { | ||
6939 | - for (list = mixer->id_elems[unitid]; list; | ||
6940 | - list = list->next_id_elem) { | ||
6941 | + for_each_mixer_elem(list, mixer, unitid) { | ||
6942 | snd_iprintf(buffer, " Unit: %i\n", list->id); | ||
6943 | if (list->kctl) | ||
6944 | snd_iprintf(buffer, | ||
6945 | @@ -2462,19 +2471,21 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, | ||
6946 | return; | ||
6947 | } | ||
6948 | |||
6949 | - for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) | ||
6950 | + for_each_mixer_elem(list, mixer, unitid) | ||
6951 | count++; | ||
6952 | |||
6953 | if (count == 0) | ||
6954 | return; | ||
6955 | |||
6956 | - for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) { | ||
6957 | + for_each_mixer_elem(list, mixer, unitid) { | ||
6958 | struct usb_mixer_elem_info *info; | ||
6959 | |||
6960 | if (!list->kctl) | ||
6961 | continue; | ||
6962 | + if (!list->is_std_info) | ||
6963 | + continue; | ||
6964 | |||
6965 | - info = (struct usb_mixer_elem_info *)list; | ||
6966 | + info = mixer_elem_list_to_info(list); | ||
6967 | if (count > 1 && info->control != control) | ||
6968 | continue; | ||
6969 | |||
6970 | @@ -2694,7 +2705,7 @@ int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer) | ||
6971 | |||
6972 | static int restore_mixer_value(struct usb_mixer_elem_list *list) | ||
6973 | { | ||
6974 | - struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list; | ||
6975 | + struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); | ||
6976 | int c, err, idx; | ||
6977 | |||
6978 | if (cval->cmask) { | ||
6979 | @@ -2730,8 +2741,7 @@ int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume) | ||
6980 | if (reset_resume) { | ||
6981 | /* restore cached mixer values */ | ||
6982 | for (id = 0; id < MAX_ID_ELEMS; id++) { | ||
6983 | - for (list = mixer->id_elems[id]; list; | ||
6984 | - list = list->next_id_elem) { | ||
6985 | + for_each_mixer_elem(list, mixer, id) { | ||
6986 | if (list->resume) { | ||
6987 | err = list->resume(list); | ||
6988 | if (err < 0) | ||
6989 | diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h | ||
6990 | index 545d99b09706..7d16a9221070 100644 | ||
6991 | --- a/sound/usb/mixer.h | ||
6992 | +++ b/sound/usb/mixer.h | ||
6993 | @@ -48,10 +48,17 @@ struct usb_mixer_elem_list { | ||
6994 | struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */ | ||
6995 | struct snd_kcontrol *kctl; | ||
6996 | unsigned int id; | ||
6997 | + bool is_std_info; | ||
6998 | usb_mixer_elem_dump_func_t dump; | ||
6999 | usb_mixer_elem_resume_func_t resume; | ||
7000 | }; | ||
7001 | |||
7002 | +/* iterate over mixer element list of the given unit id */ | ||
7003 | +#define for_each_mixer_elem(list, mixer, id) \ | ||
7004 | + for ((list) = (mixer)->id_elems[id]; (list); (list) = (list)->next_id_elem) | ||
7005 | +#define mixer_elem_list_to_info(list) \ | ||
7006 | + container_of(list, struct usb_mixer_elem_info, head) | ||
7007 | + | ||
7008 | struct usb_mixer_elem_info { | ||
7009 | struct usb_mixer_elem_list head; | ||
7010 | unsigned int control; /* CS or ICN (high byte) */ | ||
7011 | @@ -79,8 +86,12 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid); | ||
7012 | int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | ||
7013 | int request, int validx, int value_set); | ||
7014 | |||
7015 | -int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list, | ||
7016 | - struct snd_kcontrol *kctl); | ||
7017 | +int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list, | ||
7018 | + struct snd_kcontrol *kctl, | ||
7019 | + bool is_std_info); | ||
7020 | + | ||
7021 | +#define snd_usb_mixer_add_control(list, kctl) \ | ||
7022 | + snd_usb_mixer_add_list(list, kctl, true) | ||
7023 | |||
7024 | void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list, | ||
7025 | struct usb_mixer_interface *mixer, | ||
7026 | diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c | ||
7027 | index 723b535ca2ec..198515f86fcc 100644 | ||
7028 | --- a/sound/usb/mixer_quirks.c | ||
7029 | +++ b/sound/usb/mixer_quirks.c | ||
7030 | @@ -168,7 +168,8 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer, | ||
7031 | return -ENOMEM; | ||
7032 | } | ||
7033 | kctl->private_free = snd_usb_mixer_elem_free; | ||
7034 | - return snd_usb_mixer_add_control(list, kctl); | ||
7035 | + /* don't use snd_usb_mixer_add_control() here, this is a special list element */ | ||
7036 | + return snd_usb_mixer_add_list(list, kctl, false); | ||
7037 | } | ||
7038 | |||
7039 | /* | ||
7040 | @@ -1170,7 +1171,7 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, | ||
7041 | int unitid = 12; /* SamleRate ExtensionUnit ID */ | ||
7042 | |||
7043 | list_for_each_entry(mixer, &chip->mixer_list, list) { | ||
7044 | - cval = (struct usb_mixer_elem_info *)mixer->id_elems[unitid]; | ||
7045 | + cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); | ||
7046 | if (cval) { | ||
7047 | snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, | ||
7048 | cval->control << 8, | ||
7049 | diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c | ||
7050 | index 7438e7c4a842..2876cd9b35b3 100644 | ||
7051 | --- a/sound/usb/mixer_scarlett.c | ||
7052 | +++ b/sound/usb/mixer_scarlett.c | ||
7053 | @@ -287,8 +287,7 @@ static int scarlett_ctl_switch_put(struct snd_kcontrol *kctl, | ||
7054 | |||
7055 | static int scarlett_ctl_resume(struct usb_mixer_elem_list *list) | ||
7056 | { | ||
7057 | - struct usb_mixer_elem_info *elem = | ||
7058 | - container_of(list, struct usb_mixer_elem_info, head); | ||
7059 | + struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list); | ||
7060 | int i; | ||
7061 | |||
7062 | for (i = 0; i < elem->channels; i++) | ||
7063 | @@ -447,8 +446,7 @@ static int scarlett_ctl_enum_put(struct snd_kcontrol *kctl, | ||
7064 | |||
7065 | static int scarlett_ctl_enum_resume(struct usb_mixer_elem_list *list) | ||
7066 | { | ||
7067 | - struct usb_mixer_elem_info *elem = | ||
7068 | - container_of(list, struct usb_mixer_elem_info, head); | ||
7069 | + struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list); | ||
7070 | |||
7071 | if (elem->cached) | ||
7072 | snd_usb_set_cur_mix_value(elem, 0, 0, *elem->cache_val); | ||
7073 | diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c | ||
7074 | index 9bc995f9b4e1..615213aeda33 100644 | ||
7075 | --- a/sound/usb/pcm.c | ||
7076 | +++ b/sound/usb/pcm.c | ||
7077 | @@ -1483,6 +1483,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | ||
7078 | for (i = 0; i < ctx->packets; i++) { | ||
7079 | if (ctx->packet_size[i]) | ||
7080 | counts = ctx->packet_size[i]; | ||
7081 | + else if (ep->sync_master) | ||
7082 | + counts = snd_usb_endpoint_slave_next_packet_size(ep); | ||
7083 | else | ||
7084 | counts = snd_usb_endpoint_next_packet_size(ep); | ||
7085 | |||
7086 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c | ||
7087 | index 0484a8d8a5bb..486d27129ac3 100644 | ||
7088 | --- a/sound/usb/quirks.c | ||
7089 | +++ b/sound/usb/quirks.c | ||
7090 | @@ -1162,6 +1162,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | ||
7091 | static bool is_itf_usb_dsd_2alts_dac(unsigned int id) | ||
7092 | { | ||
7093 | switch (id) { | ||
7094 | + case USB_ID(0x154e, 0x1002): /* Denon DCD-1500RE */ | ||
7095 | case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ | ||
7096 | case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ | ||
7097 | case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ | ||
7098 | diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c | ||
7099 | index 0abca8783bb3..78485edb9467 100644 | ||
7100 | --- a/tools/perf/builtin-report.c | ||
7101 | +++ b/tools/perf/builtin-report.c | ||
7102 | @@ -341,8 +341,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report | ||
7103 | if (evname != NULL) | ||
7104 | ret += fprintf(fp, " of event '%s'", evname); | ||
7105 | |||
7106 | - if (symbol_conf.show_ref_callgraph && | ||
7107 | - strstr(evname, "call-graph=no")) { | ||
7108 | + if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) { | ||
7109 | ret += fprintf(fp, ", show reference callgraph"); | ||
7110 | } | ||
7111 | |||
7112 | diff --git a/tools/testing/selftests/networking/timestamping/timestamping.c b/tools/testing/selftests/networking/timestamping/timestamping.c | ||
7113 | index 5cdfd743447b..900ed4b47899 100644 | ||
7114 | --- a/tools/testing/selftests/networking/timestamping/timestamping.c | ||
7115 | +++ b/tools/testing/selftests/networking/timestamping/timestamping.c | ||
7116 | @@ -332,10 +332,16 @@ int main(int argc, char **argv) | ||
7117 | int val; | ||
7118 | socklen_t len; | ||
7119 | struct timeval next; | ||
7120 | + size_t if_len; | ||
7121 | |||
7122 | if (argc < 2) | ||
7123 | usage(0); | ||
7124 | interface = argv[1]; | ||
7125 | + if_len = strlen(interface); | ||
7126 | + if (if_len >= IFNAMSIZ) { | ||
7127 | + printf("interface name exceeds IFNAMSIZ\n"); | ||
7128 | + exit(1); | ||
7129 | + } | ||
7130 | |||
7131 | for (i = 2; i < argc; i++) { | ||
7132 | if (!strcasecmp(argv[i], "SO_TIMESTAMP")) | ||
7133 | @@ -369,12 +375,12 @@ int main(int argc, char **argv) | ||
7134 | bail("socket"); | ||
7135 | |||
7136 | memset(&device, 0, sizeof(device)); | ||
7137 | - strncpy(device.ifr_name, interface, sizeof(device.ifr_name)); | ||
7138 | + memcpy(device.ifr_name, interface, if_len + 1); | ||
7139 | if (ioctl(sock, SIOCGIFADDR, &device) < 0) | ||
7140 | bail("getting interface IP address"); | ||
7141 | |||
7142 | memset(&hwtstamp, 0, sizeof(hwtstamp)); | ||
7143 | - strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name)); | ||
7144 | + memcpy(hwtstamp.ifr_name, interface, if_len + 1); | ||
7145 | hwtstamp.ifr_data = (void *)&hwconfig; | ||
7146 | memset(&hwconfig, 0, sizeof(hwconfig)); | ||
7147 | hwconfig.tx_type = | ||
7148 | diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c | ||
7149 | index 874972ccfc95..5338e668b5e6 100644 | ||
7150 | --- a/tools/testing/selftests/x86/protection_keys.c | ||
7151 | +++ b/tools/testing/selftests/x86/protection_keys.c | ||
7152 | @@ -23,6 +23,7 @@ | ||
7153 | #define _GNU_SOURCE | ||
7154 | #include <errno.h> | ||
7155 | #include <linux/futex.h> | ||
7156 | +#include <time.h> | ||
7157 | #include <sys/time.h> | ||
7158 | #include <sys/syscall.h> | ||
7159 | #include <string.h> | ||
7160 | @@ -608,10 +609,10 @@ int alloc_random_pkey(void) | ||
7161 | int nr_alloced = 0; | ||
7162 | int random_index; | ||
7163 | memset(alloced_pkeys, 0, sizeof(alloced_pkeys)); | ||
7164 | + srand((unsigned int)time(NULL)); | ||
7165 | |||
7166 | /* allocate every possible key and make a note of which ones we got */ | ||
7167 | max_nr_pkey_allocs = NR_PKEYS; | ||
7168 | - max_nr_pkey_allocs = 1; | ||
7169 | for (i = 0; i < max_nr_pkey_allocs; i++) { | ||
7170 | int new_pkey = alloc_pkey(); | ||
7171 | if (new_pkey < 0) |