Annotation of /trunk/kernel-magellan/patches-3.2/0116-3.2.17-all-fixes.patch
Parent Directory | Revision Log
Revision 1776 -
(hide annotations)
(download)
Mon May 14 08:01:13 2012 UTC (12 years, 4 months ago) by niro
File size: 188129 byte(s)
Mon May 14 08:01:13 2012 UTC (12 years, 4 months ago) by niro
File size: 188129 byte(s)
-added linux-3.2.17 patch
1 | niro | 1776 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig |
2 | index ab3740e..ef642a0 100644 | ||
3 | --- a/arch/arm/Kconfig | ||
4 | +++ b/arch/arm/Kconfig | ||
5 | @@ -1155,6 +1155,15 @@ if !MMU | ||
6 | source "arch/arm/Kconfig-nommu" | ||
7 | endif | ||
8 | |||
9 | +config ARM_ERRATA_326103 | ||
10 | + bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory" | ||
11 | + depends on CPU_V6 | ||
12 | + help | ||
13 | + Executing a SWP instruction to read-only memory does not set bit 11 | ||
14 | + of the FSR on the ARM 1136 prior to r1p0. This causes the kernel to | ||
15 | + treat the access as a read, preventing a COW from occurring and | ||
16 | + causing the faulting task to livelock. | ||
17 | + | ||
18 | config ARM_ERRATA_411920 | ||
19 | bool "ARM errata: Invalidation of the Instruction Cache operation can fail" | ||
20 | depends on CPU_V6 || CPU_V6K | ||
21 | diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h | ||
22 | index 60843eb..73409e6 100644 | ||
23 | --- a/arch/arm/include/asm/tls.h | ||
24 | +++ b/arch/arm/include/asm/tls.h | ||
25 | @@ -7,6 +7,8 @@ | ||
26 | |||
27 | .macro set_tls_v6k, tp, tmp1, tmp2 | ||
28 | mcr p15, 0, \tp, c13, c0, 3 @ set TLS register | ||
29 | + mov \tmp1, #0 | ||
30 | + mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register | ||
31 | .endm | ||
32 | |||
33 | .macro set_tls_v6, tp, tmp1, tmp2 | ||
34 | @@ -15,6 +17,8 @@ | ||
35 | mov \tmp2, #0xffff0fff | ||
36 | tst \tmp1, #HWCAP_TLS @ hardware TLS available? | ||
37 | mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register | ||
38 | + movne \tmp1, #0 | ||
39 | + mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register | ||
40 | streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 | ||
41 | .endm | ||
42 | |||
43 | diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c | ||
44 | index 3efd82c..87c8be5 100644 | ||
45 | --- a/arch/arm/kernel/irq.c | ||
46 | +++ b/arch/arm/kernel/irq.c | ||
47 | @@ -156,10 +156,10 @@ static bool migrate_one_irq(struct irq_desc *desc) | ||
48 | } | ||
49 | |||
50 | c = irq_data_get_irq_chip(d); | ||
51 | - if (c->irq_set_affinity) | ||
52 | - c->irq_set_affinity(d, affinity, true); | ||
53 | - else | ||
54 | + if (!c->irq_set_affinity) | ||
55 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | ||
56 | + else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | ||
57 | + cpumask_copy(d->affinity, affinity); | ||
58 | |||
59 | return ret; | ||
60 | } | ||
61 | diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c | ||
62 | index ef5640b..e10e59a 100644 | ||
63 | --- a/arch/arm/kernel/smp.c | ||
64 | +++ b/arch/arm/kernel/smp.c | ||
65 | @@ -297,8 +297,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | ||
66 | struct mm_struct *mm = &init_mm; | ||
67 | unsigned int cpu = smp_processor_id(); | ||
68 | |||
69 | - printk("CPU%u: Booted secondary processor\n", cpu); | ||
70 | - | ||
71 | /* | ||
72 | * All kernel threads share the same mm context; grab a | ||
73 | * reference and switch to it. | ||
74 | @@ -310,6 +308,8 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | ||
75 | enter_lazy_tlb(mm, current); | ||
76 | local_flush_tlb_all(); | ||
77 | |||
78 | + printk("CPU%u: Booted secondary processor\n", cpu); | ||
79 | + | ||
80 | cpu_init(); | ||
81 | preempt_disable(); | ||
82 | trace_hardirqs_off(); | ||
83 | diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c | ||
84 | index d2b1779..76cbb05 100644 | ||
85 | --- a/arch/arm/kernel/sys_arm.c | ||
86 | +++ b/arch/arm/kernel/sys_arm.c | ||
87 | @@ -115,7 +115,7 @@ int kernel_execve(const char *filename, | ||
88 | "Ir" (THREAD_START_SP - sizeof(regs)), | ||
89 | "r" (®s), | ||
90 | "Ir" (sizeof(regs)) | ||
91 | - : "r0", "r1", "r2", "r3", "ip", "lr", "memory"); | ||
92 | + : "r0", "r1", "r2", "r3", "r8", "r9", "ip", "lr", "memory"); | ||
93 | |||
94 | out: | ||
95 | return ret; | ||
96 | diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c | ||
97 | index 6e90665..fb202af 100644 | ||
98 | --- a/arch/arm/mach-omap1/timer.c | ||
99 | +++ b/arch/arm/mach-omap1/timer.c | ||
100 | @@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev, | ||
101 | int n = (pdev->id - 1) << 1; | ||
102 | u32 l; | ||
103 | |||
104 | - l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); | ||
105 | + l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); | ||
106 | l |= source << n; | ||
107 | - __raw_writel(l, MOD_CONF_CTRL_1); | ||
108 | + omap_writel(l, MOD_CONF_CTRL_1); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S | ||
113 | index ff1f7cc..8074199 100644 | ||
114 | --- a/arch/arm/mm/abort-ev6.S | ||
115 | +++ b/arch/arm/mm/abort-ev6.S | ||
116 | @@ -26,18 +26,23 @@ ENTRY(v6_early_abort) | ||
117 | mrc p15, 0, r1, c5, c0, 0 @ get FSR | ||
118 | mrc p15, 0, r0, c6, c0, 0 @ get FAR | ||
119 | /* | ||
120 | - * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103). | ||
121 | - * The test below covers all the write situations, including Java bytecodes | ||
122 | + * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR. | ||
123 | */ | ||
124 | - bic r1, r1, #1 << 11 @ clear bit 11 of FSR | ||
125 | +#ifdef CONFIG_ARM_ERRATA_326103 | ||
126 | + ldr ip, =0x4107b36 | ||
127 | + mrc p15, 0, r3, c0, c0, 0 @ get processor id | ||
128 | + teq ip, r3, lsr #4 @ r0 ARM1136? | ||
129 | + bne do_DataAbort | ||
130 | tst r5, #PSR_J_BIT @ Java? | ||
131 | + tsteq r5, #PSR_T_BIT @ Thumb? | ||
132 | bne do_DataAbort | ||
133 | - do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3 | ||
134 | - ldreq r3, [r4] @ read aborted ARM instruction | ||
135 | + bic r1, r1, #1 << 11 @ clear bit 11 of FSR | ||
136 | + ldr r3, [r4] @ read aborted ARM instruction | ||
137 | #ifdef CONFIG_CPU_ENDIAN_BE8 | ||
138 | - reveq r3, r3 | ||
139 | + rev r3, r3 | ||
140 | #endif | ||
141 | do_ldrd_abort tmp=ip, insn=r3 | ||
142 | tst r3, #1 << 20 @ L = 0 -> write | ||
143 | orreq r1, r1, #1 << 11 @ yes. | ||
144 | +#endif | ||
145 | b do_DataAbort | ||
146 | diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c | ||
147 | index b1e192b..db7bcc0 100644 | ||
148 | --- a/arch/arm/mm/cache-l2x0.c | ||
149 | +++ b/arch/arm/mm/cache-l2x0.c | ||
150 | @@ -32,6 +32,7 @@ static void __iomem *l2x0_base; | ||
151 | static DEFINE_RAW_SPINLOCK(l2x0_lock); | ||
152 | static uint32_t l2x0_way_mask; /* Bitmask of active ways */ | ||
153 | static uint32_t l2x0_size; | ||
154 | +static unsigned long sync_reg_offset = L2X0_CACHE_SYNC; | ||
155 | |||
156 | struct l2x0_regs l2x0_saved_regs; | ||
157 | |||
158 | @@ -61,12 +62,7 @@ static inline void cache_sync(void) | ||
159 | { | ||
160 | void __iomem *base = l2x0_base; | ||
161 | |||
162 | -#ifdef CONFIG_PL310_ERRATA_753970 | ||
163 | - /* write to an unmmapped register */ | ||
164 | - writel_relaxed(0, base + L2X0_DUMMY_REG); | ||
165 | -#else | ||
166 | - writel_relaxed(0, base + L2X0_CACHE_SYNC); | ||
167 | -#endif | ||
168 | + writel_relaxed(0, base + sync_reg_offset); | ||
169 | cache_wait(base + L2X0_CACHE_SYNC, 1); | ||
170 | } | ||
171 | |||
172 | @@ -85,10 +81,13 @@ static inline void l2x0_inv_line(unsigned long addr) | ||
173 | } | ||
174 | |||
175 | #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) | ||
176 | +static inline void debug_writel(unsigned long val) | ||
177 | +{ | ||
178 | + if (outer_cache.set_debug) | ||
179 | + outer_cache.set_debug(val); | ||
180 | +} | ||
181 | |||
182 | -#define debug_writel(val) outer_cache.set_debug(val) | ||
183 | - | ||
184 | -static void l2x0_set_debug(unsigned long val) | ||
185 | +static void pl310_set_debug(unsigned long val) | ||
186 | { | ||
187 | writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL); | ||
188 | } | ||
189 | @@ -98,7 +97,7 @@ static inline void debug_writel(unsigned long val) | ||
190 | { | ||
191 | } | ||
192 | |||
193 | -#define l2x0_set_debug NULL | ||
194 | +#define pl310_set_debug NULL | ||
195 | #endif | ||
196 | |||
197 | #ifdef CONFIG_PL310_ERRATA_588369 | ||
198 | @@ -331,6 +330,11 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) | ||
199 | else | ||
200 | ways = 8; | ||
201 | type = "L310"; | ||
202 | +#ifdef CONFIG_PL310_ERRATA_753970 | ||
203 | + /* Unmapped register. */ | ||
204 | + sync_reg_offset = L2X0_DUMMY_REG; | ||
205 | +#endif | ||
206 | + outer_cache.set_debug = pl310_set_debug; | ||
207 | break; | ||
208 | case L2X0_CACHE_ID_PART_L210: | ||
209 | ways = (aux >> 13) & 0xf; | ||
210 | @@ -379,7 +383,6 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) | ||
211 | outer_cache.flush_all = l2x0_flush_all; | ||
212 | outer_cache.inv_all = l2x0_inv_all; | ||
213 | outer_cache.disable = l2x0_disable; | ||
214 | - outer_cache.set_debug = l2x0_set_debug; | ||
215 | |||
216 | printk(KERN_INFO "%s cache controller enabled\n", type); | ||
217 | printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", | ||
218 | diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c | ||
219 | index 89bbf4e..e77f4e4 100644 | ||
220 | --- a/arch/x86/boot/compressed/relocs.c | ||
221 | +++ b/arch/x86/boot/compressed/relocs.c | ||
222 | @@ -402,13 +402,11 @@ static void print_absolute_symbols(void) | ||
223 | for (i = 0; i < ehdr.e_shnum; i++) { | ||
224 | struct section *sec = &secs[i]; | ||
225 | char *sym_strtab; | ||
226 | - Elf32_Sym *sh_symtab; | ||
227 | int j; | ||
228 | |||
229 | if (sec->shdr.sh_type != SHT_SYMTAB) { | ||
230 | continue; | ||
231 | } | ||
232 | - sh_symtab = sec->symtab; | ||
233 | sym_strtab = sec->link->strtab; | ||
234 | for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { | ||
235 | Elf32_Sym *sym; | ||
236 | diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c | ||
237 | index f98d84c..c4e3581 100644 | ||
238 | --- a/arch/x86/kernel/apic/apic.c | ||
239 | +++ b/arch/x86/kernel/apic/apic.c | ||
240 | @@ -1577,9 +1577,11 @@ static int __init apic_verify(void) | ||
241 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; | ||
242 | |||
243 | /* The BIOS may have set up the APIC at some other address */ | ||
244 | - rdmsr(MSR_IA32_APICBASE, l, h); | ||
245 | - if (l & MSR_IA32_APICBASE_ENABLE) | ||
246 | - mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; | ||
247 | + if (boot_cpu_data.x86 >= 6) { | ||
248 | + rdmsr(MSR_IA32_APICBASE, l, h); | ||
249 | + if (l & MSR_IA32_APICBASE_ENABLE) | ||
250 | + mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; | ||
251 | + } | ||
252 | |||
253 | pr_info("Found and enabled local APIC!\n"); | ||
254 | return 0; | ||
255 | @@ -1597,13 +1599,15 @@ int __init apic_force_enable(unsigned long addr) | ||
256 | * MSR. This can only be done in software for Intel P6 or later | ||
257 | * and AMD K7 (Model > 1) or later. | ||
258 | */ | ||
259 | - rdmsr(MSR_IA32_APICBASE, l, h); | ||
260 | - if (!(l & MSR_IA32_APICBASE_ENABLE)) { | ||
261 | - pr_info("Local APIC disabled by BIOS -- reenabling.\n"); | ||
262 | - l &= ~MSR_IA32_APICBASE_BASE; | ||
263 | - l |= MSR_IA32_APICBASE_ENABLE | addr; | ||
264 | - wrmsr(MSR_IA32_APICBASE, l, h); | ||
265 | - enabled_via_apicbase = 1; | ||
266 | + if (boot_cpu_data.x86 >= 6) { | ||
267 | + rdmsr(MSR_IA32_APICBASE, l, h); | ||
268 | + if (!(l & MSR_IA32_APICBASE_ENABLE)) { | ||
269 | + pr_info("Local APIC disabled by BIOS -- reenabling.\n"); | ||
270 | + l &= ~MSR_IA32_APICBASE_BASE; | ||
271 | + l |= MSR_IA32_APICBASE_ENABLE | addr; | ||
272 | + wrmsr(MSR_IA32_APICBASE, l, h); | ||
273 | + enabled_via_apicbase = 1; | ||
274 | + } | ||
275 | } | ||
276 | return apic_verify(); | ||
277 | } | ||
278 | @@ -2149,10 +2153,12 @@ static void lapic_resume(void) | ||
279 | * FIXME! This will be wrong if we ever support suspend on | ||
280 | * SMP! We'll need to do this as part of the CPU restore! | ||
281 | */ | ||
282 | - rdmsr(MSR_IA32_APICBASE, l, h); | ||
283 | - l &= ~MSR_IA32_APICBASE_BASE; | ||
284 | - l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; | ||
285 | - wrmsr(MSR_IA32_APICBASE, l, h); | ||
286 | + if (boot_cpu_data.x86 >= 6) { | ||
287 | + rdmsr(MSR_IA32_APICBASE, l, h); | ||
288 | + l &= ~MSR_IA32_APICBASE_BASE; | ||
289 | + l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; | ||
290 | + wrmsr(MSR_IA32_APICBASE, l, h); | ||
291 | + } | ||
292 | } | ||
293 | |||
294 | maxlvt = lapic_get_maxlvt(); | ||
295 | diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c | ||
296 | index 9d46f5e..563a09d 100644 | ||
297 | --- a/arch/x86/kernel/microcode_core.c | ||
298 | +++ b/arch/x86/kernel/microcode_core.c | ||
299 | @@ -418,10 +418,8 @@ static int mc_sysdev_add(struct sys_device *sys_dev) | ||
300 | if (err) | ||
301 | return err; | ||
302 | |||
303 | - if (microcode_init_cpu(cpu) == UCODE_ERROR) { | ||
304 | - sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); | ||
305 | + if (microcode_init_cpu(cpu) == UCODE_ERROR) | ||
306 | return -EINVAL; | ||
307 | - } | ||
308 | |||
309 | return err; | ||
310 | } | ||
311 | diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c | ||
312 | index 71f4727..5a98aa2 100644 | ||
313 | --- a/arch/x86/kernel/setup_percpu.c | ||
314 | +++ b/arch/x86/kernel/setup_percpu.c | ||
315 | @@ -185,10 +185,22 @@ void __init setup_per_cpu_areas(void) | ||
316 | #endif | ||
317 | rc = -EINVAL; | ||
318 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { | ||
319 | - const size_t atom_size = cpu_has_pse ? PMD_SIZE : PAGE_SIZE; | ||
320 | const size_t dyn_size = PERCPU_MODULE_RESERVE + | ||
321 | PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE; | ||
322 | + size_t atom_size; | ||
323 | |||
324 | + /* | ||
325 | + * On 64bit, use PMD_SIZE for atom_size so that embedded | ||
326 | + * percpu areas are aligned to PMD. This, in the future, | ||
327 | + * can also allow using PMD mappings in vmalloc area. Use | ||
328 | + * PAGE_SIZE on 32bit as vmalloc space is highly contended | ||
329 | + * and large vmalloc area allocs can easily fail. | ||
330 | + */ | ||
331 | +#ifdef CONFIG_X86_64 | ||
332 | + atom_size = PMD_SIZE; | ||
333 | +#else | ||
334 | + atom_size = PAGE_SIZE; | ||
335 | +#endif | ||
336 | rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, | ||
337 | dyn_size, atom_size, | ||
338 | pcpu_cpu_distance, | ||
339 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c | ||
340 | index 1f92865..e7c920b 100644 | ||
341 | --- a/arch/x86/xen/enlighten.c | ||
342 | +++ b/arch/x86/xen/enlighten.c | ||
343 | @@ -62,6 +62,7 @@ | ||
344 | #include <asm/reboot.h> | ||
345 | #include <asm/stackprotector.h> | ||
346 | #include <asm/hypervisor.h> | ||
347 | +#include <asm/pci_x86.h> | ||
348 | |||
349 | #include "xen-ops.h" | ||
350 | #include "mmu.h" | ||
351 | @@ -1278,8 +1279,10 @@ asmlinkage void __init xen_start_kernel(void) | ||
352 | /* Make sure ACS will be enabled */ | ||
353 | pci_request_acs(); | ||
354 | } | ||
355 | - | ||
356 | - | ||
357 | +#ifdef CONFIG_PCI | ||
358 | + /* PCI BIOS service won't work from a PV guest. */ | ||
359 | + pci_probe &= ~PCI_PROBE_BIOS; | ||
360 | +#endif | ||
361 | xen_raw_console_write("about to get started...\n"); | ||
362 | |||
363 | xen_setup_runstate_info(0); | ||
364 | diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c | ||
365 | index 87f6673..ec3d603 100644 | ||
366 | --- a/arch/x86/xen/mmu.c | ||
367 | +++ b/arch/x86/xen/mmu.c | ||
368 | @@ -353,8 +353,13 @@ static pteval_t pte_mfn_to_pfn(pteval_t val) | ||
369 | { | ||
370 | if (val & _PAGE_PRESENT) { | ||
371 | unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; | ||
372 | + unsigned long pfn = mfn_to_pfn(mfn); | ||
373 | + | ||
374 | pteval_t flags = val & PTE_FLAGS_MASK; | ||
375 | - val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags; | ||
376 | + if (unlikely(pfn == ~0)) | ||
377 | + val = flags & ~_PAGE_PRESENT; | ||
378 | + else | ||
379 | + val = ((pteval_t)pfn << PAGE_SHIFT) | flags; | ||
380 | } | ||
381 | |||
382 | return val; | ||
383 | diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c | ||
384 | index 041d4fe..9a23fff 100644 | ||
385 | --- a/arch/x86/xen/smp.c | ||
386 | +++ b/arch/x86/xen/smp.c | ||
387 | @@ -172,6 +172,7 @@ static void __init xen_fill_possible_map(void) | ||
388 | static void __init xen_filter_cpu_maps(void) | ||
389 | { | ||
390 | int i, rc; | ||
391 | + unsigned int subtract = 0; | ||
392 | |||
393 | if (!xen_initial_domain()) | ||
394 | return; | ||
395 | @@ -186,8 +187,22 @@ static void __init xen_filter_cpu_maps(void) | ||
396 | } else { | ||
397 | set_cpu_possible(i, false); | ||
398 | set_cpu_present(i, false); | ||
399 | + subtract++; | ||
400 | } | ||
401 | } | ||
402 | +#ifdef CONFIG_HOTPLUG_CPU | ||
403 | + /* This is akin to using 'nr_cpus' on the Linux command line. | ||
404 | + * Which is OK as when we use 'dom0_max_vcpus=X' we can only | ||
405 | + * have up to X, while nr_cpu_ids is greater than X. This | ||
406 | + * normally is not a problem, except when CPU hotplugging | ||
407 | + * is involved and then there might be more than X CPUs | ||
408 | + * in the guest - which will not work as there is no | ||
409 | + * hypercall to expand the max number of VCPUs an already | ||
410 | + * running guest has. So cap it up to X. */ | ||
411 | + if (subtract) | ||
412 | + nr_cpu_ids = nr_cpu_ids - subtract; | ||
413 | +#endif | ||
414 | + | ||
415 | } | ||
416 | |||
417 | static void __init xen_smp_prepare_boot_cpu(void) | ||
418 | diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S | ||
419 | index 79d7362..3e45aa0 100644 | ||
420 | --- a/arch/x86/xen/xen-asm.S | ||
421 | +++ b/arch/x86/xen/xen-asm.S | ||
422 | @@ -96,7 +96,7 @@ ENTRY(xen_restore_fl_direct) | ||
423 | |||
424 | /* check for unmasked and pending */ | ||
425 | cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending | ||
426 | - jz 1f | ||
427 | + jnz 1f | ||
428 | 2: call check_events | ||
429 | 1: | ||
430 | ENDPATCH(xen_restore_fl_direct) | ||
431 | diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c | ||
432 | index 107f6f7..dd30f40 100644 | ||
433 | --- a/crypto/sha512_generic.c | ||
434 | +++ b/crypto/sha512_generic.c | ||
435 | @@ -174,7 +174,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len) | ||
436 | index = sctx->count[0] & 0x7f; | ||
437 | |||
438 | /* Update number of bytes */ | ||
439 | - if (!(sctx->count[0] += len)) | ||
440 | + if ((sctx->count[0] += len) < len) | ||
441 | sctx->count[1]++; | ||
442 | |||
443 | part_len = 128 - index; | ||
444 | diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c | ||
445 | index a9b2820..58db834 100644 | ||
446 | --- a/drivers/ata/libata-eh.c | ||
447 | +++ b/drivers/ata/libata-eh.c | ||
448 | @@ -3500,7 +3500,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg | ||
449 | u64 now = get_jiffies_64(); | ||
450 | int *trials = void_arg; | ||
451 | |||
452 | - if (ent->timestamp < now - min(now, interval)) | ||
453 | + if ((ent->eflags & ATA_EFLAG_OLD_ER) || | ||
454 | + (ent->timestamp < now - min(now, interval))) | ||
455 | return -1; | ||
456 | |||
457 | (*trials)++; | ||
458 | diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c | ||
459 | index 003cd8d..99fefbd 100644 | ||
460 | --- a/drivers/bluetooth/ath3k.c | ||
461 | +++ b/drivers/bluetooth/ath3k.c | ||
462 | @@ -73,6 +73,7 @@ static struct usb_device_id ath3k_table[] = { | ||
463 | { USB_DEVICE(0x0CF3, 0x3004) }, | ||
464 | { USB_DEVICE(0x0CF3, 0x311D) }, | ||
465 | { USB_DEVICE(0x13d3, 0x3375) }, | ||
466 | + { USB_DEVICE(0x04CA, 0x3005) }, | ||
467 | |||
468 | /* Atheros AR5BBU12 with sflash firmware */ | ||
469 | { USB_DEVICE(0x0489, 0xE02C) }, | ||
470 | @@ -91,6 +92,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { | ||
471 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | ||
472 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | ||
473 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | ||
474 | + { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
475 | |||
476 | { } /* Terminating entry */ | ||
477 | }; | ||
478 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c | ||
479 | index db44ad5..e56da6a 100644 | ||
480 | --- a/drivers/bluetooth/btusb.c | ||
481 | +++ b/drivers/bluetooth/btusb.c | ||
482 | @@ -129,6 +129,7 @@ static struct usb_device_id blacklist_table[] = { | ||
483 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | ||
484 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | ||
485 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | ||
486 | + { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
487 | |||
488 | /* Atheros AR5BBU12 with sflash firmware */ | ||
489 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | ||
490 | diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c | ||
491 | index a60adbf..79dcf6e 100644 | ||
492 | --- a/drivers/dma/at_hdmac.c | ||
493 | +++ b/drivers/dma/at_hdmac.c | ||
494 | @@ -239,10 +239,6 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first) | ||
495 | |||
496 | vdbg_dump_regs(atchan); | ||
497 | |||
498 | - /* clear any pending interrupt */ | ||
499 | - while (dma_readl(atdma, EBCISR)) | ||
500 | - cpu_relax(); | ||
501 | - | ||
502 | channel_writel(atchan, SADDR, 0); | ||
503 | channel_writel(atchan, DADDR, 0); | ||
504 | channel_writel(atchan, CTRLA, 0); | ||
505 | diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c | ||
506 | index b0a8117..0535c21 100644 | ||
507 | --- a/drivers/firmware/efivars.c | ||
508 | +++ b/drivers/firmware/efivars.c | ||
509 | @@ -191,6 +191,190 @@ utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) | ||
510 | } | ||
511 | } | ||
512 | |||
513 | +static bool | ||
514 | +validate_device_path(struct efi_variable *var, int match, u8 *buffer, | ||
515 | + unsigned long len) | ||
516 | +{ | ||
517 | + struct efi_generic_dev_path *node; | ||
518 | + int offset = 0; | ||
519 | + | ||
520 | + node = (struct efi_generic_dev_path *)buffer; | ||
521 | + | ||
522 | + if (len < sizeof(*node)) | ||
523 | + return false; | ||
524 | + | ||
525 | + while (offset <= len - sizeof(*node) && | ||
526 | + node->length >= sizeof(*node) && | ||
527 | + node->length <= len - offset) { | ||
528 | + offset += node->length; | ||
529 | + | ||
530 | + if ((node->type == EFI_DEV_END_PATH || | ||
531 | + node->type == EFI_DEV_END_PATH2) && | ||
532 | + node->sub_type == EFI_DEV_END_ENTIRE) | ||
533 | + return true; | ||
534 | + | ||
535 | + node = (struct efi_generic_dev_path *)(buffer + offset); | ||
536 | + } | ||
537 | + | ||
538 | + /* | ||
539 | + * If we're here then either node->length pointed past the end | ||
540 | + * of the buffer or we reached the end of the buffer without | ||
541 | + * finding a device path end node. | ||
542 | + */ | ||
543 | + return false; | ||
544 | +} | ||
545 | + | ||
546 | +static bool | ||
547 | +validate_boot_order(struct efi_variable *var, int match, u8 *buffer, | ||
548 | + unsigned long len) | ||
549 | +{ | ||
550 | + /* An array of 16-bit integers */ | ||
551 | + if ((len % 2) != 0) | ||
552 | + return false; | ||
553 | + | ||
554 | + return true; | ||
555 | +} | ||
556 | + | ||
557 | +static bool | ||
558 | +validate_load_option(struct efi_variable *var, int match, u8 *buffer, | ||
559 | + unsigned long len) | ||
560 | +{ | ||
561 | + u16 filepathlength; | ||
562 | + int i, desclength = 0, namelen; | ||
563 | + | ||
564 | + namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName)); | ||
565 | + | ||
566 | + /* Either "Boot" or "Driver" followed by four digits of hex */ | ||
567 | + for (i = match; i < match+4; i++) { | ||
568 | + if (var->VariableName[i] > 127 || | ||
569 | + hex_to_bin(var->VariableName[i] & 0xff) < 0) | ||
570 | + return true; | ||
571 | + } | ||
572 | + | ||
573 | + /* Reject it if there's 4 digits of hex and then further content */ | ||
574 | + if (namelen > match + 4) | ||
575 | + return false; | ||
576 | + | ||
577 | + /* A valid entry must be at least 8 bytes */ | ||
578 | + if (len < 8) | ||
579 | + return false; | ||
580 | + | ||
581 | + filepathlength = buffer[4] | buffer[5] << 8; | ||
582 | + | ||
583 | + /* | ||
584 | + * There's no stored length for the description, so it has to be | ||
585 | + * found by hand | ||
586 | + */ | ||
587 | + desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | ||
588 | + | ||
589 | + /* Each boot entry must have a descriptor */ | ||
590 | + if (!desclength) | ||
591 | + return false; | ||
592 | + | ||
593 | + /* | ||
594 | + * If the sum of the length of the description, the claimed filepath | ||
595 | + * length and the original header are greater than the length of the | ||
596 | + * variable, it's malformed | ||
597 | + */ | ||
598 | + if ((desclength + filepathlength + 6) > len) | ||
599 | + return false; | ||
600 | + | ||
601 | + /* | ||
602 | + * And, finally, check the filepath | ||
603 | + */ | ||
604 | + return validate_device_path(var, match, buffer + desclength + 6, | ||
605 | + filepathlength); | ||
606 | +} | ||
607 | + | ||
608 | +static bool | ||
609 | +validate_uint16(struct efi_variable *var, int match, u8 *buffer, | ||
610 | + unsigned long len) | ||
611 | +{ | ||
612 | + /* A single 16-bit integer */ | ||
613 | + if (len != 2) | ||
614 | + return false; | ||
615 | + | ||
616 | + return true; | ||
617 | +} | ||
618 | + | ||
619 | +static bool | ||
620 | +validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, | ||
621 | + unsigned long len) | ||
622 | +{ | ||
623 | + int i; | ||
624 | + | ||
625 | + for (i = 0; i < len; i++) { | ||
626 | + if (buffer[i] > 127) | ||
627 | + return false; | ||
628 | + | ||
629 | + if (buffer[i] == 0) | ||
630 | + return true; | ||
631 | + } | ||
632 | + | ||
633 | + return false; | ||
634 | +} | ||
635 | + | ||
636 | +struct variable_validate { | ||
637 | + char *name; | ||
638 | + bool (*validate)(struct efi_variable *var, int match, u8 *data, | ||
639 | + unsigned long len); | ||
640 | +}; | ||
641 | + | ||
642 | +static const struct variable_validate variable_validate[] = { | ||
643 | + { "BootNext", validate_uint16 }, | ||
644 | + { "BootOrder", validate_boot_order }, | ||
645 | + { "DriverOrder", validate_boot_order }, | ||
646 | + { "Boot*", validate_load_option }, | ||
647 | + { "Driver*", validate_load_option }, | ||
648 | + { "ConIn", validate_device_path }, | ||
649 | + { "ConInDev", validate_device_path }, | ||
650 | + { "ConOut", validate_device_path }, | ||
651 | + { "ConOutDev", validate_device_path }, | ||
652 | + { "ErrOut", validate_device_path }, | ||
653 | + { "ErrOutDev", validate_device_path }, | ||
654 | + { "Timeout", validate_uint16 }, | ||
655 | + { "Lang", validate_ascii_string }, | ||
656 | + { "PlatformLang", validate_ascii_string }, | ||
657 | + { "", NULL }, | ||
658 | +}; | ||
659 | + | ||
660 | +static bool | ||
661 | +validate_var(struct efi_variable *var, u8 *data, unsigned long len) | ||
662 | +{ | ||
663 | + int i; | ||
664 | + u16 *unicode_name = var->VariableName; | ||
665 | + | ||
666 | + for (i = 0; variable_validate[i].validate != NULL; i++) { | ||
667 | + const char *name = variable_validate[i].name; | ||
668 | + int match; | ||
669 | + | ||
670 | + for (match = 0; ; match++) { | ||
671 | + char c = name[match]; | ||
672 | + u16 u = unicode_name[match]; | ||
673 | + | ||
674 | + /* All special variables are plain ascii */ | ||
675 | + if (u > 127) | ||
676 | + return true; | ||
677 | + | ||
678 | + /* Wildcard in the matching name means we've matched */ | ||
679 | + if (c == '*') | ||
680 | + return variable_validate[i].validate(var, | ||
681 | + match, data, len); | ||
682 | + | ||
683 | + /* Case sensitive match */ | ||
684 | + if (c != u) | ||
685 | + break; | ||
686 | + | ||
687 | + /* Reached the end of the string while matching */ | ||
688 | + if (!c) | ||
689 | + return variable_validate[i].validate(var, | ||
690 | + match, data, len); | ||
691 | + } | ||
692 | + } | ||
693 | + | ||
694 | + return true; | ||
695 | +} | ||
696 | + | ||
697 | static efi_status_t | ||
698 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) | ||
699 | { | ||
700 | @@ -324,6 +508,12 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | ||
701 | return -EINVAL; | ||
702 | } | ||
703 | |||
704 | + if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
705 | + validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
706 | + printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
707 | + return -EINVAL; | ||
708 | + } | ||
709 | + | ||
710 | spin_lock(&efivars->lock); | ||
711 | status = efivars->ops->set_variable(new_var->VariableName, | ||
712 | &new_var->VendorGuid, | ||
713 | @@ -624,6 +814,12 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | ||
714 | if (!capable(CAP_SYS_ADMIN)) | ||
715 | return -EACCES; | ||
716 | |||
717 | + if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
718 | + validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
719 | + printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
720 | + return -EINVAL; | ||
721 | + } | ||
722 | + | ||
723 | spin_lock(&efivars->lock); | ||
724 | |||
725 | /* | ||
726 | diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
727 | index b9da890..a6c2f7a 100644 | ||
728 | --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
729 | +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
730 | @@ -984,6 +984,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | ||
731 | struct intel_ring_buffer *ring; | ||
732 | u32 exec_start, exec_len; | ||
733 | u32 seqno; | ||
734 | + u32 mask; | ||
735 | int ret, mode, i; | ||
736 | |||
737 | if (!i915_gem_check_execbuffer(args)) { | ||
738 | @@ -1021,6 +1022,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | ||
739 | } | ||
740 | |||
741 | mode = args->flags & I915_EXEC_CONSTANTS_MASK; | ||
742 | + mask = I915_EXEC_CONSTANTS_MASK; | ||
743 | switch (mode) { | ||
744 | case I915_EXEC_CONSTANTS_REL_GENERAL: | ||
745 | case I915_EXEC_CONSTANTS_ABSOLUTE: | ||
746 | @@ -1034,18 +1036,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | ||
747 | mode == I915_EXEC_CONSTANTS_REL_SURFACE) | ||
748 | return -EINVAL; | ||
749 | |||
750 | - ret = intel_ring_begin(ring, 4); | ||
751 | - if (ret) | ||
752 | - return ret; | ||
753 | - | ||
754 | - intel_ring_emit(ring, MI_NOOP); | ||
755 | - intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1)); | ||
756 | - intel_ring_emit(ring, INSTPM); | ||
757 | - intel_ring_emit(ring, | ||
758 | - I915_EXEC_CONSTANTS_MASK << 16 | mode); | ||
759 | - intel_ring_advance(ring); | ||
760 | - | ||
761 | - dev_priv->relative_constants_mode = mode; | ||
762 | + /* The HW changed the meaning on this bit on gen6 */ | ||
763 | + if (INTEL_INFO(dev)->gen >= 6) | ||
764 | + mask &= ~I915_EXEC_CONSTANTS_REL_SURFACE; | ||
765 | } | ||
766 | break; | ||
767 | default: | ||
768 | @@ -1064,6 +1057,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | ||
769 | return -EINVAL; | ||
770 | } | ||
771 | |||
772 | + if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) { | ||
773 | + DRM_DEBUG("execbuf with %u cliprects\n", | ||
774 | + args->num_cliprects); | ||
775 | + return -EINVAL; | ||
776 | + } | ||
777 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), | ||
778 | GFP_KERNEL); | ||
779 | if (cliprects == NULL) { | ||
780 | @@ -1176,6 +1174,21 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | ||
781 | } | ||
782 | } | ||
783 | |||
784 | + if (ring == &dev_priv->ring[RCS] && | ||
785 | + mode != dev_priv->relative_constants_mode) { | ||
786 | + ret = intel_ring_begin(ring, 4); | ||
787 | + if (ret) | ||
788 | + goto err; | ||
789 | + | ||
790 | + intel_ring_emit(ring, MI_NOOP); | ||
791 | + intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1)); | ||
792 | + intel_ring_emit(ring, INSTPM); | ||
793 | + intel_ring_emit(ring, mask << 16 | mode); | ||
794 | + intel_ring_advance(ring); | ||
795 | + | ||
796 | + dev_priv->relative_constants_mode = mode; | ||
797 | + } | ||
798 | + | ||
799 | trace_i915_gem_ring_dispatch(ring, seqno); | ||
800 | |||
801 | exec_start = batch_obj->gtt_offset + args->batch_start_offset; | ||
802 | @@ -1314,7 +1327,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data, | ||
803 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | ||
804 | int ret; | ||
805 | |||
806 | - if (args->buffer_count < 1) { | ||
807 | + if (args->buffer_count < 1 || | ||
808 | + args->buffer_count > UINT_MAX / sizeof(*exec2_list)) { | ||
809 | DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count); | ||
810 | return -EINVAL; | ||
811 | } | ||
812 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h | ||
813 | index 2f99fd4..cbe5a88 100644 | ||
814 | --- a/drivers/gpu/drm/i915/i915_reg.h | ||
815 | +++ b/drivers/gpu/drm/i915/i915_reg.h | ||
816 | @@ -442,6 +442,7 @@ | ||
817 | #define INSTPM_AGPBUSY_DIS (1<<11) /* gen3: when disabled, pending interrupts | ||
818 | will not assert AGPBUSY# and will only | ||
819 | be delivered when out of C3. */ | ||
820 | +#define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */ | ||
821 | #define ACTHD 0x020c8 | ||
822 | #define FW_BLC 0x020d8 | ||
823 | #define FW_BLC2 0x020dc | ||
824 | @@ -522,6 +523,7 @@ | ||
825 | #define CM0_MASK_SHIFT 16 | ||
826 | #define CM0_IZ_OPT_DISABLE (1<<6) | ||
827 | #define CM0_ZR_OPT_DISABLE (1<<5) | ||
828 | +#define CM0_STC_EVICT_DISABLE_LRA_SNB (1<<5) | ||
829 | #define CM0_DEPTH_EVICT_DISABLE (1<<4) | ||
830 | #define CM0_COLOR_EVICT_DISABLE (1<<3) | ||
831 | #define CM0_DEPTH_WRITE_DISABLE (1<<1) | ||
832 | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c | ||
833 | index 64541f7..9cd81ba 100644 | ||
834 | --- a/drivers/gpu/drm/i915/intel_hdmi.c | ||
835 | +++ b/drivers/gpu/drm/i915/intel_hdmi.c | ||
836 | @@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder, | ||
837 | |||
838 | val &= ~VIDEO_DIP_SELECT_MASK; | ||
839 | |||
840 | - I915_WRITE(VIDEO_DIP_CTL, val | port | flags); | ||
841 | + I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); | ||
842 | |||
843 | for (i = 0; i < len; i += 4) { | ||
844 | I915_WRITE(VIDEO_DIP_DATA, *data); | ||
845 | diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c | ||
846 | index 8673581..62f9ac5 100644 | ||
847 | --- a/drivers/gpu/drm/i915/intel_ringbuffer.c | ||
848 | +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | ||
849 | @@ -414,6 +414,22 @@ static int init_render_ring(struct intel_ring_buffer *ring) | ||
850 | return ret; | ||
851 | } | ||
852 | |||
853 | + | ||
854 | + if (IS_GEN6(dev)) { | ||
855 | + /* From the Sandybridge PRM, volume 1 part 3, page 24: | ||
856 | + * "If this bit is set, STCunit will have LRA as replacement | ||
857 | + * policy. [...] This bit must be reset. LRA replacement | ||
858 | + * policy is not supported." | ||
859 | + */ | ||
860 | + I915_WRITE(CACHE_MODE_0, | ||
861 | + CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT); | ||
862 | + } | ||
863 | + | ||
864 | + if (INTEL_INFO(dev)->gen >= 6) { | ||
865 | + I915_WRITE(INSTPM, | ||
866 | + INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); | ||
867 | + } | ||
868 | + | ||
869 | return ret; | ||
870 | } | ||
871 | |||
872 | diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c | ||
873 | index e334ec3..8eddcca 100644 | ||
874 | --- a/drivers/gpu/drm/i915/intel_sdvo.c | ||
875 | +++ b/drivers/gpu/drm/i915/intel_sdvo.c | ||
876 | @@ -731,6 +731,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | ||
877 | uint16_t width, height; | ||
878 | uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; | ||
879 | uint16_t h_sync_offset, v_sync_offset; | ||
880 | + int mode_clock; | ||
881 | |||
882 | width = mode->crtc_hdisplay; | ||
883 | height = mode->crtc_vdisplay; | ||
884 | @@ -745,7 +746,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | ||
885 | h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; | ||
886 | v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; | ||
887 | |||
888 | - dtd->part1.clock = mode->clock / 10; | ||
889 | + mode_clock = mode->clock; | ||
890 | + mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1; | ||
891 | + mode_clock /= 10; | ||
892 | + dtd->part1.clock = mode_clock; | ||
893 | + | ||
894 | dtd->part1.h_active = width & 0xff; | ||
895 | dtd->part1.h_blank = h_blank_len & 0xff; | ||
896 | dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | | ||
897 | @@ -997,7 +1002,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | ||
898 | struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); | ||
899 | u32 sdvox; | ||
900 | struct intel_sdvo_in_out_map in_out; | ||
901 | - struct intel_sdvo_dtd input_dtd; | ||
902 | + struct intel_sdvo_dtd input_dtd, output_dtd; | ||
903 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); | ||
904 | int rate; | ||
905 | |||
906 | @@ -1022,20 +1027,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | ||
907 | intel_sdvo->attached_output)) | ||
908 | return; | ||
909 | |||
910 | - /* We have tried to get input timing in mode_fixup, and filled into | ||
911 | - * adjusted_mode. | ||
912 | - */ | ||
913 | - if (intel_sdvo->is_tv || intel_sdvo->is_lvds) { | ||
914 | - input_dtd = intel_sdvo->input_dtd; | ||
915 | - } else { | ||
916 | - /* Set the output timing to the screen */ | ||
917 | - if (!intel_sdvo_set_target_output(intel_sdvo, | ||
918 | - intel_sdvo->attached_output)) | ||
919 | - return; | ||
920 | - | ||
921 | - intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | ||
922 | - (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd); | ||
923 | - } | ||
924 | + /* lvds has a special fixed output timing. */ | ||
925 | + if (intel_sdvo->is_lvds) | ||
926 | + intel_sdvo_get_dtd_from_mode(&output_dtd, | ||
927 | + intel_sdvo->sdvo_lvds_fixed_mode); | ||
928 | + else | ||
929 | + intel_sdvo_get_dtd_from_mode(&output_dtd, mode); | ||
930 | + (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd); | ||
931 | |||
932 | /* Set the input timing to the screen. Assume always input 0. */ | ||
933 | if (!intel_sdvo_set_target_input(intel_sdvo)) | ||
934 | @@ -1053,6 +1051,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | ||
935 | !intel_sdvo_set_tv_format(intel_sdvo)) | ||
936 | return; | ||
937 | |||
938 | + /* We have tried to get input timing in mode_fixup, and filled into | ||
939 | + * adjusted_mode. | ||
940 | + */ | ||
941 | + intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | ||
942 | (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); | ||
943 | |||
944 | switch (pixel_multiplier) { | ||
945 | @@ -1219,8 +1221,14 @@ static bool intel_sdvo_get_capabilities(struct intel_sdvo *intel_sdvo, struct in | ||
946 | |||
947 | static int intel_sdvo_supports_hotplug(struct intel_sdvo *intel_sdvo) | ||
948 | { | ||
949 | + struct drm_device *dev = intel_sdvo->base.base.dev; | ||
950 | u8 response[2]; | ||
951 | |||
952 | + /* HW Erratum: SDVO Hotplug is broken on all i945G chips, there's noise | ||
953 | + * on the line. */ | ||
954 | + if (IS_I945G(dev) || IS_I945GM(dev)) | ||
955 | + return false; | ||
956 | + | ||
957 | return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, | ||
958 | &response, 2) && response[0]; | ||
959 | } | ||
960 | diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c | ||
961 | index 525744d..3df56c7 100644 | ||
962 | --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c | ||
963 | +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | ||
964 | @@ -245,7 +245,7 @@ static bool nouveau_dsm_detect(void) | ||
965 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; | ||
966 | struct pci_dev *pdev = NULL; | ||
967 | int has_dsm = 0; | ||
968 | - int has_optimus; | ||
969 | + int has_optimus = 0; | ||
970 | int vga_count = 0; | ||
971 | bool guid_valid; | ||
972 | int retval; | ||
973 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c | ||
974 | index b30081f..757c549 100644 | ||
975 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c | ||
976 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | ||
977 | @@ -917,8 +917,8 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | ||
978 | break; | ||
979 | } | ||
980 | |||
981 | - if (radeon_encoder->active_device & | ||
982 | - (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) { | ||
983 | + if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) || | ||
984 | + (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) { | ||
985 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | ||
986 | struct drm_connector *connector = | ||
987 | radeon_get_connector_for_encoder(encoder); | ||
988 | diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c | ||
989 | index 104b376..427468f 100644 | ||
990 | --- a/drivers/hwmon/coretemp.c | ||
991 | +++ b/drivers/hwmon/coretemp.c | ||
992 | @@ -51,7 +51,7 @@ module_param_named(tjmax, force_tjmax, int, 0444); | ||
993 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | ||
994 | |||
995 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | ||
996 | -#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | ||
997 | +#define NUM_REAL_CORES 32 /* Number of Real cores per cpu */ | ||
998 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | ||
999 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | ||
1000 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | ||
1001 | @@ -705,6 +705,10 @@ static void __cpuinit put_core_offline(unsigned int cpu) | ||
1002 | |||
1003 | indx = TO_ATTR_NO(cpu); | ||
1004 | |||
1005 | + /* The core id is too big, just return */ | ||
1006 | + if (indx > MAX_CORE_DATA - 1) | ||
1007 | + return; | ||
1008 | + | ||
1009 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) | ||
1010 | coretemp_remove_core(pdata, &pdev->dev, indx); | ||
1011 | |||
1012 | diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c | ||
1013 | index 930370d..9a4c3ab 100644 | ||
1014 | --- a/drivers/hwmon/fam15h_power.c | ||
1015 | +++ b/drivers/hwmon/fam15h_power.c | ||
1016 | @@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | ||
1017 | return true; | ||
1018 | } | ||
1019 | |||
1020 | +/* | ||
1021 | + * Newer BKDG versions have an updated recommendation on how to properly | ||
1022 | + * initialize the running average range (was: 0xE, now: 0x9). This avoids | ||
1023 | + * counter saturations resulting in bogus power readings. | ||
1024 | + * We correct this value ourselves to cope with older BIOSes. | ||
1025 | + */ | ||
1026 | +static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | ||
1027 | + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
1028 | + { 0 } | ||
1029 | +}; | ||
1030 | + | ||
1031 | +static void __devinit tweak_runavg_range(struct pci_dev *pdev) | ||
1032 | +{ | ||
1033 | + u32 val; | ||
1034 | + | ||
1035 | + /* | ||
1036 | + * let this quirk apply only to the current version of the | ||
1037 | + * northbridge, since future versions may change the behavior | ||
1038 | + */ | ||
1039 | + if (!pci_match_id(affected_device, pdev)) | ||
1040 | + return; | ||
1041 | + | ||
1042 | + pci_bus_read_config_dword(pdev->bus, | ||
1043 | + PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
1044 | + REG_TDP_RUNNING_AVERAGE, &val); | ||
1045 | + if ((val & 0xf) != 0xe) | ||
1046 | + return; | ||
1047 | + | ||
1048 | + val &= ~0xf; | ||
1049 | + val |= 0x9; | ||
1050 | + pci_bus_write_config_dword(pdev->bus, | ||
1051 | + PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
1052 | + REG_TDP_RUNNING_AVERAGE, val); | ||
1053 | +} | ||
1054 | + | ||
1055 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | ||
1056 | struct fam15h_power_data *data) | ||
1057 | { | ||
1058 | @@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev, | ||
1059 | struct device *dev; | ||
1060 | int err; | ||
1061 | |||
1062 | + /* | ||
1063 | + * though we ignore every other northbridge, we still have to | ||
1064 | + * do the tweaking on _each_ node in MCM processors as the counters | ||
1065 | + * are working hand-in-hand | ||
1066 | + */ | ||
1067 | + tweak_runavg_range(pdev); | ||
1068 | + | ||
1069 | if (!fam15h_power_is_internal_node0(pdev)) { | ||
1070 | err = -ENODEV; | ||
1071 | goto exit; | ||
1072 | diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c | ||
1073 | index 04be9f8..eb8ad53 100644 | ||
1074 | --- a/drivers/i2c/busses/i2c-pnx.c | ||
1075 | +++ b/drivers/i2c/busses/i2c-pnx.c | ||
1076 | @@ -546,8 +546,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev, | ||
1077 | { | ||
1078 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); | ||
1079 | |||
1080 | - /* FIXME: shouldn't this be clk_disable? */ | ||
1081 | - clk_enable(alg_data->clk); | ||
1082 | + clk_disable(alg_data->clk); | ||
1083 | |||
1084 | return 0; | ||
1085 | } | ||
1086 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
1087 | index 6f37aa4..065ab4f 100644 | ||
1088 | --- a/drivers/md/md.c | ||
1089 | +++ b/drivers/md/md.c | ||
1090 | @@ -8100,7 +8100,8 @@ static int md_notify_reboot(struct notifier_block *this, | ||
1091 | |||
1092 | for_each_mddev(mddev, tmp) { | ||
1093 | if (mddev_trylock(mddev)) { | ||
1094 | - __md_stop_writes(mddev); | ||
1095 | + if (mddev->pers) | ||
1096 | + __md_stop_writes(mddev); | ||
1097 | mddev->safemode = 2; | ||
1098 | mddev_unlock(mddev); | ||
1099 | } | ||
1100 | diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c | ||
1101 | index f6431ef..a1f5e3d 100644 | ||
1102 | --- a/drivers/media/dvb/frontends/drxk_hard.c | ||
1103 | +++ b/drivers/media/dvb/frontends/drxk_hard.c | ||
1104 | @@ -1523,8 +1523,10 @@ static int scu_command(struct drxk_state *state, | ||
1105 | dprintk(1, "\n"); | ||
1106 | |||
1107 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || | ||
1108 | - ((resultLen > 0) && (result == NULL))) | ||
1109 | - goto error; | ||
1110 | + ((resultLen > 0) && (result == NULL))) { | ||
1111 | + printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); | ||
1112 | + return status; | ||
1113 | + } | ||
1114 | |||
1115 | mutex_lock(&state->mutex); | ||
1116 | |||
1117 | diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c | ||
1118 | index 13f54b5..a7e7d6f 100644 | ||
1119 | --- a/drivers/media/rc/winbond-cir.c | ||
1120 | +++ b/drivers/media/rc/winbond-cir.c | ||
1121 | @@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | ||
1122 | goto exit_unregister_led; | ||
1123 | } | ||
1124 | |||
1125 | + data->dev->driver_type = RC_DRIVER_IR_RAW; | ||
1126 | data->dev->driver_name = WBCIR_NAME; | ||
1127 | data->dev->input_name = WBCIR_NAME; | ||
1128 | data->dev->input_phys = "wbcir/cir0"; | ||
1129 | diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c | ||
1130 | index e15e47d..34416d4 100644 | ||
1131 | --- a/drivers/mmc/card/block.c | ||
1132 | +++ b/drivers/mmc/card/block.c | ||
1133 | @@ -799,7 +799,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | ||
1134 | { | ||
1135 | struct mmc_blk_data *md = mq->data; | ||
1136 | struct mmc_card *card = md->queue.card; | ||
1137 | - unsigned int from, nr, arg; | ||
1138 | + unsigned int from, nr, arg, trim_arg, erase_arg; | ||
1139 | int err = 0, type = MMC_BLK_SECDISCARD; | ||
1140 | |||
1141 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { | ||
1142 | @@ -807,20 +807,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | ||
1143 | goto out; | ||
1144 | } | ||
1145 | |||
1146 | + from = blk_rq_pos(req); | ||
1147 | + nr = blk_rq_sectors(req); | ||
1148 | + | ||
1149 | /* The sanitize operation is supported at v4.5 only */ | ||
1150 | if (mmc_can_sanitize(card)) { | ||
1151 | - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1152 | - EXT_CSD_SANITIZE_START, 1, 0); | ||
1153 | - goto out; | ||
1154 | + erase_arg = MMC_ERASE_ARG; | ||
1155 | + trim_arg = MMC_TRIM_ARG; | ||
1156 | + } else { | ||
1157 | + erase_arg = MMC_SECURE_ERASE_ARG; | ||
1158 | + trim_arg = MMC_SECURE_TRIM1_ARG; | ||
1159 | } | ||
1160 | |||
1161 | - from = blk_rq_pos(req); | ||
1162 | - nr = blk_rq_sectors(req); | ||
1163 | - | ||
1164 | - if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) | ||
1165 | - arg = MMC_SECURE_TRIM1_ARG; | ||
1166 | - else | ||
1167 | - arg = MMC_SECURE_ERASE_ARG; | ||
1168 | + if (mmc_erase_group_aligned(card, from, nr)) | ||
1169 | + arg = erase_arg; | ||
1170 | + else if (mmc_can_trim(card)) | ||
1171 | + arg = trim_arg; | ||
1172 | + else { | ||
1173 | + err = -EINVAL; | ||
1174 | + goto out; | ||
1175 | + } | ||
1176 | retry: | ||
1177 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | ||
1178 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1179 | @@ -830,25 +836,41 @@ retry: | ||
1180 | INAND_CMD38_ARG_SECERASE, | ||
1181 | 0); | ||
1182 | if (err) | ||
1183 | - goto out; | ||
1184 | + goto out_retry; | ||
1185 | } | ||
1186 | + | ||
1187 | err = mmc_erase(card, from, nr, arg); | ||
1188 | - if (!err && arg == MMC_SECURE_TRIM1_ARG) { | ||
1189 | + if (err == -EIO) | ||
1190 | + goto out_retry; | ||
1191 | + if (err) | ||
1192 | + goto out; | ||
1193 | + | ||
1194 | + if (arg == MMC_SECURE_TRIM1_ARG) { | ||
1195 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | ||
1196 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1197 | INAND_CMD38_ARG_EXT_CSD, | ||
1198 | INAND_CMD38_ARG_SECTRIM2, | ||
1199 | 0); | ||
1200 | if (err) | ||
1201 | - goto out; | ||
1202 | + goto out_retry; | ||
1203 | } | ||
1204 | + | ||
1205 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); | ||
1206 | + if (err == -EIO) | ||
1207 | + goto out_retry; | ||
1208 | + if (err) | ||
1209 | + goto out; | ||
1210 | } | ||
1211 | -out: | ||
1212 | - if (err == -EIO && !mmc_blk_reset(md, card->host, type)) | ||
1213 | + | ||
1214 | + if (mmc_can_sanitize(card)) | ||
1215 | + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1216 | + EXT_CSD_SANITIZE_START, 1, 0); | ||
1217 | +out_retry: | ||
1218 | + if (err && !mmc_blk_reset(md, card->host, type)) | ||
1219 | goto retry; | ||
1220 | if (!err) | ||
1221 | mmc_blk_reset_success(md, type); | ||
1222 | +out: | ||
1223 | spin_lock_irq(&md->lock); | ||
1224 | __blk_end_request(req, err, blk_rq_bytes(req)); | ||
1225 | spin_unlock_irq(&md->lock); | ||
1226 | diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c | ||
1227 | index dcad59c..78690f2 100644 | ||
1228 | --- a/drivers/mmc/card/queue.c | ||
1229 | +++ b/drivers/mmc/card/queue.c | ||
1230 | @@ -134,7 +134,7 @@ static void mmc_queue_setup_discard(struct request_queue *q, | ||
1231 | |||
1232 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | ||
1233 | q->limits.max_discard_sectors = max_discard; | ||
1234 | - if (card->erased_byte == 0) | ||
1235 | + if (card->erased_byte == 0 && !mmc_can_discard(card)) | ||
1236 | q->limits.discard_zeroes_data = 1; | ||
1237 | q->limits.discard_granularity = card->pref_erase << 9; | ||
1238 | /* granularity must not be greater than max. discard */ | ||
1239 | diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c | ||
1240 | index 950b97d..411a994 100644 | ||
1241 | --- a/drivers/mmc/core/core.c | ||
1242 | +++ b/drivers/mmc/core/core.c | ||
1243 | @@ -1516,7 +1516,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, | ||
1244 | { | ||
1245 | unsigned int erase_timeout; | ||
1246 | |||
1247 | - if (card->ext_csd.erase_group_def & 1) { | ||
1248 | + if (arg == MMC_DISCARD_ARG || | ||
1249 | + (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { | ||
1250 | + erase_timeout = card->ext_csd.trim_timeout; | ||
1251 | + } else if (card->ext_csd.erase_group_def & 1) { | ||
1252 | /* High Capacity Erase Group Size uses HC timeouts */ | ||
1253 | if (arg == MMC_TRIM_ARG) | ||
1254 | erase_timeout = card->ext_csd.trim_timeout; | ||
1255 | @@ -1788,8 +1791,6 @@ int mmc_can_trim(struct mmc_card *card) | ||
1256 | { | ||
1257 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) | ||
1258 | return 1; | ||
1259 | - if (mmc_can_discard(card)) | ||
1260 | - return 1; | ||
1261 | return 0; | ||
1262 | } | ||
1263 | EXPORT_SYMBOL(mmc_can_trim); | ||
1264 | @@ -1808,6 +1809,8 @@ EXPORT_SYMBOL(mmc_can_discard); | ||
1265 | |||
1266 | int mmc_can_sanitize(struct mmc_card *card) | ||
1267 | { | ||
1268 | + if (!mmc_can_trim(card) && !mmc_can_erase(card)) | ||
1269 | + return 0; | ||
1270 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) | ||
1271 | return 1; | ||
1272 | return 0; | ||
1273 | diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c | ||
1274 | index 4540e37..1b47937 100644 | ||
1275 | --- a/drivers/mmc/host/sdhci-esdhc-imx.c | ||
1276 | +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | ||
1277 | @@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | ||
1278 | clk_enable(clk); | ||
1279 | pltfm_host->clk = clk; | ||
1280 | |||
1281 | - if (!is_imx25_esdhc(imx_data)) | ||
1282 | - host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | ||
1283 | + host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | ||
1284 | |||
1285 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) | ||
1286 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ | ||
1287 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c | ||
1288 | index e58aa2b..f65e0b9 100644 | ||
1289 | --- a/drivers/net/bonding/bond_main.c | ||
1290 | +++ b/drivers/net/bonding/bond_main.c | ||
1291 | @@ -2982,7 +2982,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | ||
1292 | trans_start + delta_in_ticks)) || | ||
1293 | bond->curr_active_slave != slave) { | ||
1294 | slave->link = BOND_LINK_UP; | ||
1295 | - bond->current_arp_slave = NULL; | ||
1296 | + if (bond->current_arp_slave) { | ||
1297 | + bond_set_slave_inactive_flags( | ||
1298 | + bond->current_arp_slave); | ||
1299 | + bond->current_arp_slave = NULL; | ||
1300 | + } | ||
1301 | |||
1302 | pr_info("%s: link status definitely up for interface %s.\n", | ||
1303 | bond->dev->name, slave->dev->name); | ||
1304 | diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c | ||
1305 | index a7c5e88..eeac9ca 100644 | ||
1306 | --- a/drivers/net/dummy.c | ||
1307 | +++ b/drivers/net/dummy.c | ||
1308 | @@ -106,14 +106,14 @@ static int dummy_dev_init(struct net_device *dev) | ||
1309 | return 0; | ||
1310 | } | ||
1311 | |||
1312 | -static void dummy_dev_free(struct net_device *dev) | ||
1313 | +static void dummy_dev_uninit(struct net_device *dev) | ||
1314 | { | ||
1315 | free_percpu(dev->dstats); | ||
1316 | - free_netdev(dev); | ||
1317 | } | ||
1318 | |||
1319 | static const struct net_device_ops dummy_netdev_ops = { | ||
1320 | .ndo_init = dummy_dev_init, | ||
1321 | + .ndo_uninit = dummy_dev_uninit, | ||
1322 | .ndo_start_xmit = dummy_xmit, | ||
1323 | .ndo_validate_addr = eth_validate_addr, | ||
1324 | .ndo_set_rx_mode = set_multicast_list, | ||
1325 | @@ -127,7 +127,7 @@ static void dummy_setup(struct net_device *dev) | ||
1326 | |||
1327 | /* Initialize the device structure. */ | ||
1328 | dev->netdev_ops = &dummy_netdev_ops; | ||
1329 | - dev->destructor = dummy_dev_free; | ||
1330 | + dev->destructor = free_netdev; | ||
1331 | |||
1332 | /* Fill in device structure with ethernet-generic values. */ | ||
1333 | dev->tx_queue_len = 0; | ||
1334 | diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c | ||
1335 | index 33a4e35..ee532e1 100644 | ||
1336 | --- a/drivers/net/ethernet/atheros/atlx/atl1.c | ||
1337 | +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | ||
1338 | @@ -2473,7 +2473,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | ||
1339 | "pcie phy link down %x\n", status); | ||
1340 | if (netif_running(adapter->netdev)) { /* reset MAC */ | ||
1341 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | ||
1342 | - schedule_work(&adapter->pcie_dma_to_rst_task); | ||
1343 | + schedule_work(&adapter->reset_dev_task); | ||
1344 | return IRQ_HANDLED; | ||
1345 | } | ||
1346 | } | ||
1347 | @@ -2485,7 +2485,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | ||
1348 | "pcie DMA r/w error (status = 0x%x)\n", | ||
1349 | status); | ||
1350 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | ||
1351 | - schedule_work(&adapter->pcie_dma_to_rst_task); | ||
1352 | + schedule_work(&adapter->reset_dev_task); | ||
1353 | return IRQ_HANDLED; | ||
1354 | } | ||
1355 | |||
1356 | @@ -2630,10 +2630,10 @@ static void atl1_down(struct atl1_adapter *adapter) | ||
1357 | atl1_clean_rx_ring(adapter); | ||
1358 | } | ||
1359 | |||
1360 | -static void atl1_tx_timeout_task(struct work_struct *work) | ||
1361 | +static void atl1_reset_dev_task(struct work_struct *work) | ||
1362 | { | ||
1363 | struct atl1_adapter *adapter = | ||
1364 | - container_of(work, struct atl1_adapter, tx_timeout_task); | ||
1365 | + container_of(work, struct atl1_adapter, reset_dev_task); | ||
1366 | struct net_device *netdev = adapter->netdev; | ||
1367 | |||
1368 | netif_device_detach(netdev); | ||
1369 | @@ -3032,12 +3032,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | ||
1370 | (unsigned long)adapter); | ||
1371 | adapter->phy_timer_pending = false; | ||
1372 | |||
1373 | - INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | ||
1374 | + INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task); | ||
1375 | |||
1376 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); | ||
1377 | |||
1378 | - INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task); | ||
1379 | - | ||
1380 | err = register_netdev(netdev); | ||
1381 | if (err) | ||
1382 | goto err_common; | ||
1383 | diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h | ||
1384 | index 109d6da..e04bf4d 100644 | ||
1385 | --- a/drivers/net/ethernet/atheros/atlx/atl1.h | ||
1386 | +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | ||
1387 | @@ -758,9 +758,8 @@ struct atl1_adapter { | ||
1388 | u16 link_speed; | ||
1389 | u16 link_duplex; | ||
1390 | spinlock_t lock; | ||
1391 | - struct work_struct tx_timeout_task; | ||
1392 | + struct work_struct reset_dev_task; | ||
1393 | struct work_struct link_chg_task; | ||
1394 | - struct work_struct pcie_dma_to_rst_task; | ||
1395 | |||
1396 | struct timer_list phy_config_timer; | ||
1397 | bool phy_timer_pending; | ||
1398 | diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c | ||
1399 | index aabcf4b..41c6d83 100644 | ||
1400 | --- a/drivers/net/ethernet/atheros/atlx/atlx.c | ||
1401 | +++ b/drivers/net/ethernet/atheros/atlx/atlx.c | ||
1402 | @@ -193,7 +193,7 @@ static void atlx_tx_timeout(struct net_device *netdev) | ||
1403 | { | ||
1404 | struct atlx_adapter *adapter = netdev_priv(netdev); | ||
1405 | /* Do the reset outside of interrupt context */ | ||
1406 | - schedule_work(&adapter->tx_timeout_task); | ||
1407 | + schedule_work(&adapter->reset_dev_task); | ||
1408 | } | ||
1409 | |||
1410 | /* | ||
1411 | diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c | ||
1412 | index d19c849..77241b6 100644 | ||
1413 | --- a/drivers/net/ethernet/micrel/ks8851_mll.c | ||
1414 | +++ b/drivers/net/ethernet/micrel/ks8851_mll.c | ||
1415 | @@ -40,7 +40,7 @@ | ||
1416 | #define DRV_NAME "ks8851_mll" | ||
1417 | |||
1418 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; | ||
1419 | -#define MAX_RECV_FRAMES 32 | ||
1420 | +#define MAX_RECV_FRAMES 255 | ||
1421 | #define MAX_BUF_SIZE 2048 | ||
1422 | #define TX_BUF_SIZE 2000 | ||
1423 | #define RX_BUF_SIZE 2000 | ||
1424 | diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c | ||
1425 | index 7ece990..4b9f4bd 100644 | ||
1426 | --- a/drivers/net/ethernet/micrel/ksz884x.c | ||
1427 | +++ b/drivers/net/ethernet/micrel/ksz884x.c | ||
1428 | @@ -5679,7 +5679,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr) | ||
1429 | memcpy(hw->override_addr, mac->sa_data, MAC_ADDR_LEN); | ||
1430 | } | ||
1431 | |||
1432 | - memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN); | ||
1433 | + memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN); | ||
1434 | |||
1435 | interrupt = hw_block_intr(hw); | ||
1436 | |||
1437 | diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c | ||
1438 | index aba4f67..8f47907 100644 | ||
1439 | --- a/drivers/net/ethernet/realtek/8139cp.c | ||
1440 | +++ b/drivers/net/ethernet/realtek/8139cp.c | ||
1441 | @@ -961,6 +961,11 @@ static inline void cp_start_hw (struct cp_private *cp) | ||
1442 | cpw8(Cmd, RxOn | TxOn); | ||
1443 | } | ||
1444 | |||
1445 | +static void cp_enable_irq(struct cp_private *cp) | ||
1446 | +{ | ||
1447 | + cpw16_f(IntrMask, cp_intr_mask); | ||
1448 | +} | ||
1449 | + | ||
1450 | static void cp_init_hw (struct cp_private *cp) | ||
1451 | { | ||
1452 | struct net_device *dev = cp->dev; | ||
1453 | @@ -1000,8 +1005,6 @@ static void cp_init_hw (struct cp_private *cp) | ||
1454 | |||
1455 | cpw16(MultiIntr, 0); | ||
1456 | |||
1457 | - cpw16_f(IntrMask, cp_intr_mask); | ||
1458 | - | ||
1459 | cpw8_f(Cfg9346, Cfg9346_Lock); | ||
1460 | } | ||
1461 | |||
1462 | @@ -1133,6 +1136,8 @@ static int cp_open (struct net_device *dev) | ||
1463 | if (rc) | ||
1464 | goto err_out_hw; | ||
1465 | |||
1466 | + cp_enable_irq(cp); | ||
1467 | + | ||
1468 | netif_carrier_off(dev); | ||
1469 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); | ||
1470 | netif_start_queue(dev); | ||
1471 | @@ -2034,6 +2039,7 @@ static int cp_resume (struct pci_dev *pdev) | ||
1472 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ | ||
1473 | cp_init_rings_index (cp); | ||
1474 | cp_init_hw (cp); | ||
1475 | + cp_enable_irq(cp); | ||
1476 | netif_start_queue (dev); | ||
1477 | |||
1478 | spin_lock_irqsave (&cp->lock, flags); | ||
1479 | diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c | ||
1480 | index 8843071..8c7dd21 100644 | ||
1481 | --- a/drivers/net/ethernet/smsc/smsc911x.c | ||
1482 | +++ b/drivers/net/ethernet/smsc/smsc911x.c | ||
1483 | @@ -1089,10 +1089,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat) | ||
1484 | |||
1485 | /* Quickly dumps bad packets */ | ||
1486 | static void | ||
1487 | -smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes) | ||
1488 | +smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords) | ||
1489 | { | ||
1490 | - unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2; | ||
1491 | - | ||
1492 | if (likely(pktwords >= 4)) { | ||
1493 | unsigned int timeout = 500; | ||
1494 | unsigned int val; | ||
1495 | @@ -1156,7 +1154,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | ||
1496 | continue; | ||
1497 | } | ||
1498 | |||
1499 | - skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); | ||
1500 | + skb = netdev_alloc_skb(dev, pktwords << 2); | ||
1501 | if (unlikely(!skb)) { | ||
1502 | SMSC_WARN(pdata, rx_err, | ||
1503 | "Unable to allocate skb for rx packet"); | ||
1504 | @@ -1166,14 +1164,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | ||
1505 | break; | ||
1506 | } | ||
1507 | |||
1508 | - skb->data = skb->head; | ||
1509 | - skb_reset_tail_pointer(skb); | ||
1510 | + pdata->ops->rx_readfifo(pdata, | ||
1511 | + (unsigned int *)skb->data, pktwords); | ||
1512 | |||
1513 | /* Align IP on 16B boundary */ | ||
1514 | skb_reserve(skb, NET_IP_ALIGN); | ||
1515 | skb_put(skb, pktlength - 4); | ||
1516 | - pdata->ops->rx_readfifo(pdata, | ||
1517 | - (unsigned int *)skb->head, pktwords); | ||
1518 | skb->protocol = eth_type_trans(skb, dev); | ||
1519 | skb_checksum_none_assert(skb); | ||
1520 | netif_receive_skb(skb); | ||
1521 | @@ -1396,7 +1392,7 @@ static int smsc911x_open(struct net_device *dev) | ||
1522 | smsc911x_reg_write(pdata, FIFO_INT, temp); | ||
1523 | |||
1524 | /* set RX Data offset to 2 bytes for alignment */ | ||
1525 | - smsc911x_reg_write(pdata, RX_CFG, (2 << 8)); | ||
1526 | + smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8)); | ||
1527 | |||
1528 | /* enable NAPI polling before enabling RX interrupts */ | ||
1529 | napi_enable(&pdata->napi); | ||
1530 | diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c | ||
1531 | index 7615040..f470ab6 100644 | ||
1532 | --- a/drivers/net/ethernet/ti/davinci_mdio.c | ||
1533 | +++ b/drivers/net/ethernet/ti/davinci_mdio.c | ||
1534 | @@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data) | ||
1535 | __davinci_mdio_reset(data); | ||
1536 | return -EAGAIN; | ||
1537 | } | ||
1538 | + | ||
1539 | + reg = __raw_readl(®s->user[0].access); | ||
1540 | + if ((reg & USERACCESS_GO) == 0) | ||
1541 | + return 0; | ||
1542 | + | ||
1543 | dev_err(data->dev, "timed out waiting for user access\n"); | ||
1544 | return -ETIMEDOUT; | ||
1545 | } | ||
1546 | diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c | ||
1547 | index 486b404..3ed983c 100644 | ||
1548 | --- a/drivers/net/ppp/ppp_generic.c | ||
1549 | +++ b/drivers/net/ppp/ppp_generic.c | ||
1550 | @@ -968,7 +968,6 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
1551 | proto = npindex_to_proto[npi]; | ||
1552 | put_unaligned_be16(proto, pp); | ||
1553 | |||
1554 | - netif_stop_queue(dev); | ||
1555 | skb_queue_tail(&ppp->file.xq, skb); | ||
1556 | ppp_xmit_process(ppp); | ||
1557 | return NETDEV_TX_OK; | ||
1558 | @@ -1063,6 +1062,8 @@ ppp_xmit_process(struct ppp *ppp) | ||
1559 | code that we can accept some more. */ | ||
1560 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) | ||
1561 | netif_wake_queue(ppp->dev); | ||
1562 | + else | ||
1563 | + netif_stop_queue(ppp->dev); | ||
1564 | } | ||
1565 | ppp_xmit_unlock(ppp); | ||
1566 | } | ||
1567 | diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c | ||
1568 | index a5b9b12..7bd219b 100644 | ||
1569 | --- a/drivers/net/usb/smsc75xx.c | ||
1570 | +++ b/drivers/net/usb/smsc75xx.c | ||
1571 | @@ -1050,6 +1050,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) | ||
1572 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; | ||
1573 | dev->net->flags |= IFF_MULTICAST; | ||
1574 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; | ||
1575 | + dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
1576 | return 0; | ||
1577 | } | ||
1578 | |||
1579 | diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c | ||
1580 | index eff6767..55b3218 100644 | ||
1581 | --- a/drivers/net/usb/smsc95xx.c | ||
1582 | +++ b/drivers/net/usb/smsc95xx.c | ||
1583 | @@ -1190,7 +1190,7 @@ static const struct driver_info smsc95xx_info = { | ||
1584 | .rx_fixup = smsc95xx_rx_fixup, | ||
1585 | .tx_fixup = smsc95xx_tx_fixup, | ||
1586 | .status = smsc95xx_status, | ||
1587 | - .flags = FLAG_ETHER | FLAG_SEND_ZLP, | ||
1588 | + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, | ||
1589 | }; | ||
1590 | |||
1591 | static const struct usb_device_id products[] = { | ||
1592 | diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c | ||
1593 | index 64a1106..4697cf3 100644 | ||
1594 | --- a/drivers/net/wimax/i2400m/netdev.c | ||
1595 | +++ b/drivers/net/wimax/i2400m/netdev.c | ||
1596 | @@ -607,7 +607,8 @@ static void i2400m_get_drvinfo(struct net_device *net_dev, | ||
1597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | ||
1598 | |||
1599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | ||
1600 | - strncpy(info->fw_version, i2400m->fw_name, sizeof(info->fw_version) - 1); | ||
1601 | + strncpy(info->fw_version, | ||
1602 | + i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | ||
1603 | if (net_dev->dev.parent) | ||
1604 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), | ||
1605 | sizeof(info->bus_info) - 1); | ||
1606 | diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c | ||
1607 | index 5634d9a..680709c 100644 | ||
1608 | --- a/drivers/net/wireless/b43/main.c | ||
1609 | +++ b/drivers/net/wireless/b43/main.c | ||
1610 | @@ -4820,8 +4820,14 @@ static int b43_op_start(struct ieee80211_hw *hw) | ||
1611 | out_mutex_unlock: | ||
1612 | mutex_unlock(&wl->mutex); | ||
1613 | |||
1614 | - /* reload configuration */ | ||
1615 | - b43_op_config(hw, ~0); | ||
1616 | + /* | ||
1617 | + * Configuration may have been overwritten during initialization. | ||
1618 | + * Reload the configuration, but only if initialization was | ||
1619 | + * successful. Reloading the configuration after a failed init | ||
1620 | + * may hang the system. | ||
1621 | + */ | ||
1622 | + if (!err) | ||
1623 | + b43_op_config(hw, ~0); | ||
1624 | |||
1625 | return err; | ||
1626 | } | ||
1627 | diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c | ||
1628 | index 453f58e..f98becc 100644 | ||
1629 | --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c | ||
1630 | +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | ||
1631 | @@ -7865,6 +7865,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | ||
1632 | { | ||
1633 | int len_mpdu; | ||
1634 | struct ieee80211_rx_status rx_status; | ||
1635 | + struct ieee80211_hdr *hdr; | ||
1636 | |||
1637 | memset(&rx_status, 0, sizeof(rx_status)); | ||
1638 | prep_mac80211_status(wlc, rxh, p, &rx_status); | ||
1639 | @@ -7874,6 +7875,13 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | ||
1640 | skb_pull(p, D11_PHY_HDR_LEN); | ||
1641 | __skb_trim(p, len_mpdu); | ||
1642 | |||
1643 | + /* unmute transmit */ | ||
1644 | + if (wlc->hw->suspended_fifos) { | ||
1645 | + hdr = (struct ieee80211_hdr *)p->data; | ||
1646 | + if (ieee80211_is_beacon(hdr->frame_control)) | ||
1647 | + brcms_b_mute(wlc->hw, false); | ||
1648 | + } | ||
1649 | + | ||
1650 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); | ||
1651 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); | ||
1652 | } | ||
1653 | diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c | ||
1654 | index 99a710d..827889b 100644 | ||
1655 | --- a/drivers/net/wireless/ipw2x00/ipw2200.c | ||
1656 | +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | ||
1657 | @@ -2183,6 +2183,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | ||
1658 | { | ||
1659 | int rc = 0; | ||
1660 | unsigned long flags; | ||
1661 | + unsigned long now, end; | ||
1662 | |||
1663 | spin_lock_irqsave(&priv->lock, flags); | ||
1664 | if (priv->status & STATUS_HCMD_ACTIVE) { | ||
1665 | @@ -2224,10 +2225,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | ||
1666 | } | ||
1667 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1668 | |||
1669 | + now = jiffies; | ||
1670 | + end = now + HOST_COMPLETE_TIMEOUT; | ||
1671 | +again: | ||
1672 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | ||
1673 | !(priv-> | ||
1674 | status & STATUS_HCMD_ACTIVE), | ||
1675 | - HOST_COMPLETE_TIMEOUT); | ||
1676 | + end - now); | ||
1677 | + if (rc < 0) { | ||
1678 | + now = jiffies; | ||
1679 | + if (time_before(now, end)) | ||
1680 | + goto again; | ||
1681 | + rc = 0; | ||
1682 | + } | ||
1683 | + | ||
1684 | if (rc == 0) { | ||
1685 | spin_lock_irqsave(&priv->lock, flags); | ||
1686 | if (priv->status & STATUS_HCMD_ACTIVE) { | ||
1687 | diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c | ||
1688 | index dd008b0..1e6c8cc 100644 | ||
1689 | --- a/drivers/net/wireless/iwlwifi/iwl-1000.c | ||
1690 | +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | ||
1691 | @@ -45,8 +45,8 @@ | ||
1692 | #include "iwl-cfg.h" | ||
1693 | |||
1694 | /* Highest firmware API version supported */ | ||
1695 | -#define IWL1000_UCODE_API_MAX 6 | ||
1696 | -#define IWL100_UCODE_API_MAX 6 | ||
1697 | +#define IWL1000_UCODE_API_MAX 5 | ||
1698 | +#define IWL100_UCODE_API_MAX 5 | ||
1699 | |||
1700 | /* Oldest version we won't warn about */ | ||
1701 | #define IWL1000_UCODE_API_OK 5 | ||
1702 | @@ -244,5 +244,5 @@ struct iwl_cfg iwl100_bg_cfg = { | ||
1703 | IWL_DEVICE_100, | ||
1704 | }; | ||
1705 | |||
1706 | -MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | ||
1707 | -MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | ||
1708 | +MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); | ||
1709 | +MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); | ||
1710 | diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c | ||
1711 | index 7943197..9823e41 100644 | ||
1712 | --- a/drivers/net/wireless/iwlwifi/iwl-2000.c | ||
1713 | +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | ||
1714 | @@ -51,10 +51,10 @@ | ||
1715 | #define IWL135_UCODE_API_MAX 6 | ||
1716 | |||
1717 | /* Oldest version we won't warn about */ | ||
1718 | -#define IWL2030_UCODE_API_OK 5 | ||
1719 | -#define IWL2000_UCODE_API_OK 5 | ||
1720 | -#define IWL105_UCODE_API_OK 5 | ||
1721 | -#define IWL135_UCODE_API_OK 5 | ||
1722 | +#define IWL2030_UCODE_API_OK 6 | ||
1723 | +#define IWL2000_UCODE_API_OK 6 | ||
1724 | +#define IWL105_UCODE_API_OK 6 | ||
1725 | +#define IWL135_UCODE_API_OK 6 | ||
1726 | |||
1727 | /* Lowest firmware API version supported */ | ||
1728 | #define IWL2030_UCODE_API_MIN 5 | ||
1729 | @@ -372,7 +372,7 @@ struct iwl_cfg iwl135_bgn_cfg = { | ||
1730 | .ht_params = &iwl2000_ht_params, | ||
1731 | }; | ||
1732 | |||
1733 | -MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | ||
1734 | -MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | ||
1735 | -MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | ||
1736 | -MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | ||
1737 | +MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); | ||
1738 | +MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); | ||
1739 | +MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); | ||
1740 | +MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); | ||
1741 | diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c | ||
1742 | index f55fb2d..606213f 100644 | ||
1743 | --- a/drivers/net/wireless/iwlwifi/iwl-5000.c | ||
1744 | +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | ||
1745 | @@ -50,6 +50,10 @@ | ||
1746 | #define IWL5000_UCODE_API_MAX 5 | ||
1747 | #define IWL5150_UCODE_API_MAX 2 | ||
1748 | |||
1749 | +/* Oldest version we won't warn about */ | ||
1750 | +#define IWL5000_UCODE_API_OK 5 | ||
1751 | +#define IWL5150_UCODE_API_OK 2 | ||
1752 | + | ||
1753 | /* Lowest firmware API version supported */ | ||
1754 | #define IWL5000_UCODE_API_MIN 1 | ||
1755 | #define IWL5150_UCODE_API_MIN 1 | ||
1756 | @@ -373,6 +377,7 @@ static struct iwl_ht_params iwl5000_ht_params = { | ||
1757 | #define IWL_DEVICE_5000 \ | ||
1758 | .fw_name_pre = IWL5000_FW_PRE, \ | ||
1759 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ | ||
1760 | + .ucode_api_ok = IWL5000_UCODE_API_OK, \ | ||
1761 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ | ||
1762 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, \ | ||
1763 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ | ||
1764 | @@ -416,6 +421,7 @@ struct iwl_cfg iwl5350_agn_cfg = { | ||
1765 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", | ||
1766 | .fw_name_pre = IWL5000_FW_PRE, | ||
1767 | .ucode_api_max = IWL5000_UCODE_API_MAX, | ||
1768 | + .ucode_api_ok = IWL5000_UCODE_API_OK, | ||
1769 | .ucode_api_min = IWL5000_UCODE_API_MIN, | ||
1770 | .eeprom_ver = EEPROM_5050_EEPROM_VERSION, | ||
1771 | .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, | ||
1772 | @@ -429,6 +435,7 @@ struct iwl_cfg iwl5350_agn_cfg = { | ||
1773 | #define IWL_DEVICE_5150 \ | ||
1774 | .fw_name_pre = IWL5150_FW_PRE, \ | ||
1775 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ | ||
1776 | + .ucode_api_ok = IWL5150_UCODE_API_OK, \ | ||
1777 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ | ||
1778 | .eeprom_ver = EEPROM_5050_EEPROM_VERSION, \ | ||
1779 | .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \ | ||
1780 | @@ -450,5 +457,5 @@ struct iwl_cfg iwl5150_abg_cfg = { | ||
1781 | IWL_DEVICE_5150, | ||
1782 | }; | ||
1783 | |||
1784 | -MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | ||
1785 | -MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | ||
1786 | +MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); | ||
1787 | +MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); | ||
1788 | diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c | ||
1789 | index c840c78..b4f809c 100644 | ||
1790 | --- a/drivers/net/wireless/iwlwifi/iwl-6000.c | ||
1791 | +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | ||
1792 | @@ -46,12 +46,15 @@ | ||
1793 | #include "iwl-cfg.h" | ||
1794 | |||
1795 | /* Highest firmware API version supported */ | ||
1796 | -#define IWL6000_UCODE_API_MAX 4 | ||
1797 | +#define IWL6000_UCODE_API_MAX 6 | ||
1798 | #define IWL6050_UCODE_API_MAX 5 | ||
1799 | #define IWL6000G2_UCODE_API_MAX 6 | ||
1800 | |||
1801 | /* Oldest version we won't warn about */ | ||
1802 | +#define IWL6000_UCODE_API_OK 4 | ||
1803 | #define IWL6000G2_UCODE_API_OK 5 | ||
1804 | +#define IWL6050_UCODE_API_OK 5 | ||
1805 | +#define IWL6000G2B_UCODE_API_OK 6 | ||
1806 | |||
1807 | /* Lowest firmware API version supported */ | ||
1808 | #define IWL6000_UCODE_API_MIN 4 | ||
1809 | @@ -399,7 +402,7 @@ struct iwl_cfg iwl6005_2agn_d_cfg = { | ||
1810 | #define IWL_DEVICE_6030 \ | ||
1811 | .fw_name_pre = IWL6030_FW_PRE, \ | ||
1812 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ | ||
1813 | - .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | ||
1814 | + .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ | ||
1815 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ | ||
1816 | .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \ | ||
1817 | .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ | ||
1818 | @@ -479,6 +482,7 @@ struct iwl_cfg iwl130_bg_cfg = { | ||
1819 | #define IWL_DEVICE_6000i \ | ||
1820 | .fw_name_pre = IWL6000_FW_PRE, \ | ||
1821 | .ucode_api_max = IWL6000_UCODE_API_MAX, \ | ||
1822 | + .ucode_api_ok = IWL6000_UCODE_API_OK, \ | ||
1823 | .ucode_api_min = IWL6000_UCODE_API_MIN, \ | ||
1824 | .valid_tx_ant = ANT_BC, /* .cfg overwrite */ \ | ||
1825 | .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \ | ||
1826 | @@ -559,6 +563,7 @@ struct iwl_cfg iwl6000_3agn_cfg = { | ||
1827 | .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN", | ||
1828 | .fw_name_pre = IWL6000_FW_PRE, | ||
1829 | .ucode_api_max = IWL6000_UCODE_API_MAX, | ||
1830 | + .ucode_api_ok = IWL6000_UCODE_API_OK, | ||
1831 | .ucode_api_min = IWL6000_UCODE_API_MIN, | ||
1832 | .eeprom_ver = EEPROM_6000_EEPROM_VERSION, | ||
1833 | .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, | ||
1834 | @@ -569,7 +574,7 @@ struct iwl_cfg iwl6000_3agn_cfg = { | ||
1835 | .led_mode = IWL_LED_BLINK, | ||
1836 | }; | ||
1837 | |||
1838 | -MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | ||
1839 | -MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | ||
1840 | -MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | ||
1841 | -MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | ||
1842 | +MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); | ||
1843 | +MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); | ||
1844 | +MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); | ||
1845 | +MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); | ||
1846 | diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c | ||
1847 | index e0e9a3d..d7d2512 100644 | ||
1848 | --- a/drivers/net/wireless/iwlwifi/iwl-agn.c | ||
1849 | +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | ||
1850 | @@ -1504,7 +1504,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | ||
1851 | |||
1852 | static void iwlagn_prepare_restart(struct iwl_priv *priv) | ||
1853 | { | ||
1854 | - struct iwl_rxon_context *ctx; | ||
1855 | bool bt_full_concurrent; | ||
1856 | u8 bt_ci_compliance; | ||
1857 | u8 bt_load; | ||
1858 | @@ -1513,8 +1512,6 @@ static void iwlagn_prepare_restart(struct iwl_priv *priv) | ||
1859 | |||
1860 | lockdep_assert_held(&priv->shrd->mutex); | ||
1861 | |||
1862 | - for_each_context(priv, ctx) | ||
1863 | - ctx->vif = NULL; | ||
1864 | priv->is_open = 0; | ||
1865 | |||
1866 | /* | ||
1867 | diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c | ||
1868 | index 3d75d4c..832ec4d 100644 | ||
1869 | --- a/drivers/net/wireless/iwlwifi/iwl-core.c | ||
1870 | +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | ||
1871 | @@ -1228,6 +1228,7 @@ int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | ||
1872 | struct iwl_rxon_context *tmp, *ctx = NULL; | ||
1873 | int err; | ||
1874 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); | ||
1875 | + bool reset = false; | ||
1876 | |||
1877 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | ||
1878 | viftype, vif->addr); | ||
1879 | @@ -1249,6 +1250,13 @@ int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | ||
1880 | tmp->interface_modes | tmp->exclusive_interface_modes; | ||
1881 | |||
1882 | if (tmp->vif) { | ||
1883 | + /* On reset we need to add the same interface again */ | ||
1884 | + if (tmp->vif == vif) { | ||
1885 | + reset = true; | ||
1886 | + ctx = tmp; | ||
1887 | + break; | ||
1888 | + } | ||
1889 | + | ||
1890 | /* check if this busy context is exclusive */ | ||
1891 | if (tmp->exclusive_interface_modes & | ||
1892 | BIT(tmp->vif->type)) { | ||
1893 | @@ -1275,7 +1283,7 @@ int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | ||
1894 | ctx->vif = vif; | ||
1895 | |||
1896 | err = iwl_setup_interface(priv, ctx); | ||
1897 | - if (!err) | ||
1898 | + if (!err || reset) | ||
1899 | goto out; | ||
1900 | |||
1901 | ctx->vif = NULL; | ||
1902 | diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h | ||
1903 | index 5bede9d..aae992a 100644 | ||
1904 | --- a/drivers/net/wireless/iwlwifi/iwl-fh.h | ||
1905 | +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | ||
1906 | @@ -104,15 +104,29 @@ | ||
1907 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 | ||
1908 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte | ||
1909 | * aligned (address bits 0-7 must be 0). | ||
1910 | + * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers | ||
1911 | + * for them are in different places. | ||
1912 | * | ||
1913 | * Bit fields in each pointer register: | ||
1914 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned | ||
1915 | */ | ||
1916 | -#define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | ||
1917 | -#define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | ||
1918 | - | ||
1919 | -/* Find TFD CB base pointer for given queue (range 0-15). */ | ||
1920 | -#define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) | ||
1921 | +#define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | ||
1922 | +#define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | ||
1923 | +#define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) | ||
1924 | +#define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) | ||
1925 | +#define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) | ||
1926 | +#define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | ||
1927 | + | ||
1928 | +/* Find TFD CB base pointer for given queue */ | ||
1929 | +static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | ||
1930 | +{ | ||
1931 | + if (chnl < 16) | ||
1932 | + return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | ||
1933 | + if (chnl < 20) | ||
1934 | + return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); | ||
1935 | + WARN_ON_ONCE(chnl >= 32); | ||
1936 | + return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | ||
1937 | +} | ||
1938 | |||
1939 | |||
1940 | /** | ||
1941 | diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h | ||
1942 | index bebdd82..d9b089e 100644 | ||
1943 | --- a/drivers/net/wireless/iwlwifi/iwl-prph.h | ||
1944 | +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | ||
1945 | @@ -227,12 +227,33 @@ | ||
1946 | #define SCD_AIT (SCD_BASE + 0x0c) | ||
1947 | #define SCD_TXFACT (SCD_BASE + 0x10) | ||
1948 | #define SCD_ACTIVE (SCD_BASE + 0x14) | ||
1949 | -#define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4) | ||
1950 | -#define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4) | ||
1951 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) | ||
1952 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) | ||
1953 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) | ||
1954 | -#define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) | ||
1955 | + | ||
1956 | +static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) | ||
1957 | +{ | ||
1958 | + if (chnl < 20) | ||
1959 | + return SCD_BASE + 0x18 + chnl * 4; | ||
1960 | + WARN_ON_ONCE(chnl >= 32); | ||
1961 | + return SCD_BASE + 0x284 + (chnl - 20) * 4; | ||
1962 | +} | ||
1963 | + | ||
1964 | +static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) | ||
1965 | +{ | ||
1966 | + if (chnl < 20) | ||
1967 | + return SCD_BASE + 0x68 + chnl * 4; | ||
1968 | + WARN_ON_ONCE(chnl >= 32); | ||
1969 | + return SCD_BASE + 0x2B4 + (chnl - 20) * 4; | ||
1970 | +} | ||
1971 | + | ||
1972 | +static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) | ||
1973 | +{ | ||
1974 | + if (chnl < 20) | ||
1975 | + return SCD_BASE + 0x10c + chnl * 4; | ||
1976 | + WARN_ON_ONCE(chnl >= 32); | ||
1977 | + return SCD_BASE + 0x384 + (chnl - 20) * 4; | ||
1978 | +} | ||
1979 | |||
1980 | /*********************** END TX SCHEDULER *************************************/ | ||
1981 | |||
1982 | diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h | ||
1983 | index 445ff21..2f218f9 100644 | ||
1984 | --- a/drivers/net/wireless/mwifiex/pcie.h | ||
1985 | +++ b/drivers/net/wireless/mwifiex/pcie.h | ||
1986 | @@ -48,15 +48,15 @@ | ||
1987 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C | ||
1988 | #define PCIE_SCRATCH_2_REG 0xC40 | ||
1989 | #define PCIE_SCRATCH_3_REG 0xC44 | ||
1990 | -#define PCIE_SCRATCH_4_REG 0xCC0 | ||
1991 | -#define PCIE_SCRATCH_5_REG 0xCC4 | ||
1992 | -#define PCIE_SCRATCH_6_REG 0xCC8 | ||
1993 | -#define PCIE_SCRATCH_7_REG 0xCCC | ||
1994 | -#define PCIE_SCRATCH_8_REG 0xCD0 | ||
1995 | -#define PCIE_SCRATCH_9_REG 0xCD4 | ||
1996 | -#define PCIE_SCRATCH_10_REG 0xCD8 | ||
1997 | -#define PCIE_SCRATCH_11_REG 0xCDC | ||
1998 | -#define PCIE_SCRATCH_12_REG 0xCE0 | ||
1999 | +#define PCIE_SCRATCH_4_REG 0xCD0 | ||
2000 | +#define PCIE_SCRATCH_5_REG 0xCD4 | ||
2001 | +#define PCIE_SCRATCH_6_REG 0xCD8 | ||
2002 | +#define PCIE_SCRATCH_7_REG 0xCDC | ||
2003 | +#define PCIE_SCRATCH_8_REG 0xCE0 | ||
2004 | +#define PCIE_SCRATCH_9_REG 0xCE4 | ||
2005 | +#define PCIE_SCRATCH_10_REG 0xCE8 | ||
2006 | +#define PCIE_SCRATCH_11_REG 0xCEC | ||
2007 | +#define PCIE_SCRATCH_12_REG 0xCF0 | ||
2008 | |||
2009 | #define CPU_INTR_DNLD_RDY BIT(0) | ||
2010 | #define CPU_INTR_DOOR_BELL BIT(1) | ||
2011 | diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c | ||
2012 | index cb71e88..0ffa111 100644 | ||
2013 | --- a/drivers/net/wireless/rt2x00/rt2800usb.c | ||
2014 | +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | ||
2015 | @@ -914,12 +914,14 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2016 | { USB_DEVICE(0x050d, 0x8053) }, | ||
2017 | { USB_DEVICE(0x050d, 0x805c) }, | ||
2018 | { USB_DEVICE(0x050d, 0x815c) }, | ||
2019 | + { USB_DEVICE(0x050d, 0x825a) }, | ||
2020 | { USB_DEVICE(0x050d, 0x825b) }, | ||
2021 | { USB_DEVICE(0x050d, 0x935a) }, | ||
2022 | { USB_DEVICE(0x050d, 0x935b) }, | ||
2023 | /* Buffalo */ | ||
2024 | { USB_DEVICE(0x0411, 0x00e8) }, | ||
2025 | { USB_DEVICE(0x0411, 0x0158) }, | ||
2026 | + { USB_DEVICE(0x0411, 0x015d) }, | ||
2027 | { USB_DEVICE(0x0411, 0x016f) }, | ||
2028 | { USB_DEVICE(0x0411, 0x01a2) }, | ||
2029 | /* Corega */ | ||
2030 | @@ -934,6 +936,8 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2031 | { USB_DEVICE(0x07d1, 0x3c0e) }, | ||
2032 | { USB_DEVICE(0x07d1, 0x3c0f) }, | ||
2033 | { USB_DEVICE(0x07d1, 0x3c11) }, | ||
2034 | + { USB_DEVICE(0x07d1, 0x3c13) }, | ||
2035 | + { USB_DEVICE(0x07d1, 0x3c15) }, | ||
2036 | { USB_DEVICE(0x07d1, 0x3c16) }, | ||
2037 | { USB_DEVICE(0x2001, 0x3c1b) }, | ||
2038 | /* Draytek */ | ||
2039 | @@ -944,6 +948,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2040 | { USB_DEVICE(0x7392, 0x7711) }, | ||
2041 | { USB_DEVICE(0x7392, 0x7717) }, | ||
2042 | { USB_DEVICE(0x7392, 0x7718) }, | ||
2043 | + { USB_DEVICE(0x7392, 0x7722) }, | ||
2044 | /* Encore */ | ||
2045 | { USB_DEVICE(0x203d, 0x1480) }, | ||
2046 | { USB_DEVICE(0x203d, 0x14a9) }, | ||
2047 | @@ -978,6 +983,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2048 | { USB_DEVICE(0x1737, 0x0070) }, | ||
2049 | { USB_DEVICE(0x1737, 0x0071) }, | ||
2050 | { USB_DEVICE(0x1737, 0x0077) }, | ||
2051 | + { USB_DEVICE(0x1737, 0x0078) }, | ||
2052 | /* Logitec */ | ||
2053 | { USB_DEVICE(0x0789, 0x0162) }, | ||
2054 | { USB_DEVICE(0x0789, 0x0163) }, | ||
2055 | @@ -1001,9 +1007,13 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2056 | { USB_DEVICE(0x0db0, 0x871b) }, | ||
2057 | { USB_DEVICE(0x0db0, 0x871c) }, | ||
2058 | { USB_DEVICE(0x0db0, 0x899a) }, | ||
2059 | + /* Ovislink */ | ||
2060 | + { USB_DEVICE(0x1b75, 0x3071) }, | ||
2061 | + { USB_DEVICE(0x1b75, 0x3072) }, | ||
2062 | /* Para */ | ||
2063 | { USB_DEVICE(0x20b8, 0x8888) }, | ||
2064 | /* Pegatron */ | ||
2065 | + { USB_DEVICE(0x1d4d, 0x0002) }, | ||
2066 | { USB_DEVICE(0x1d4d, 0x000c) }, | ||
2067 | { USB_DEVICE(0x1d4d, 0x000e) }, | ||
2068 | { USB_DEVICE(0x1d4d, 0x0011) }, | ||
2069 | @@ -1056,7 +1066,9 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2070 | /* Sparklan */ | ||
2071 | { USB_DEVICE(0x15a9, 0x0006) }, | ||
2072 | /* Sweex */ | ||
2073 | + { USB_DEVICE(0x177f, 0x0153) }, | ||
2074 | { USB_DEVICE(0x177f, 0x0302) }, | ||
2075 | + { USB_DEVICE(0x177f, 0x0313) }, | ||
2076 | /* U-Media */ | ||
2077 | { USB_DEVICE(0x157e, 0x300e) }, | ||
2078 | { USB_DEVICE(0x157e, 0x3013) }, | ||
2079 | @@ -1140,27 +1152,24 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2080 | { USB_DEVICE(0x13d3, 0x3322) }, | ||
2081 | /* Belkin */ | ||
2082 | { USB_DEVICE(0x050d, 0x1003) }, | ||
2083 | - { USB_DEVICE(0x050d, 0x825a) }, | ||
2084 | /* Buffalo */ | ||
2085 | { USB_DEVICE(0x0411, 0x012e) }, | ||
2086 | { USB_DEVICE(0x0411, 0x0148) }, | ||
2087 | { USB_DEVICE(0x0411, 0x0150) }, | ||
2088 | - { USB_DEVICE(0x0411, 0x015d) }, | ||
2089 | /* Corega */ | ||
2090 | { USB_DEVICE(0x07aa, 0x0041) }, | ||
2091 | { USB_DEVICE(0x07aa, 0x0042) }, | ||
2092 | { USB_DEVICE(0x18c5, 0x0008) }, | ||
2093 | /* D-Link */ | ||
2094 | { USB_DEVICE(0x07d1, 0x3c0b) }, | ||
2095 | - { USB_DEVICE(0x07d1, 0x3c13) }, | ||
2096 | - { USB_DEVICE(0x07d1, 0x3c15) }, | ||
2097 | { USB_DEVICE(0x07d1, 0x3c17) }, | ||
2098 | { USB_DEVICE(0x2001, 0x3c17) }, | ||
2099 | /* Edimax */ | ||
2100 | { USB_DEVICE(0x7392, 0x4085) }, | ||
2101 | - { USB_DEVICE(0x7392, 0x7722) }, | ||
2102 | /* Encore */ | ||
2103 | { USB_DEVICE(0x203d, 0x14a1) }, | ||
2104 | + /* Fujitsu Stylistic 550 */ | ||
2105 | + { USB_DEVICE(0x1690, 0x0761) }, | ||
2106 | /* Gemtek */ | ||
2107 | { USB_DEVICE(0x15a9, 0x0010) }, | ||
2108 | /* Gigabyte */ | ||
2109 | @@ -1172,19 +1181,13 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2110 | /* LevelOne */ | ||
2111 | { USB_DEVICE(0x1740, 0x0605) }, | ||
2112 | { USB_DEVICE(0x1740, 0x0615) }, | ||
2113 | - /* Linksys */ | ||
2114 | - { USB_DEVICE(0x1737, 0x0078) }, | ||
2115 | /* Logitec */ | ||
2116 | { USB_DEVICE(0x0789, 0x0168) }, | ||
2117 | { USB_DEVICE(0x0789, 0x0169) }, | ||
2118 | /* Motorola */ | ||
2119 | { USB_DEVICE(0x100d, 0x9032) }, | ||
2120 | - /* Ovislink */ | ||
2121 | - { USB_DEVICE(0x1b75, 0x3071) }, | ||
2122 | - { USB_DEVICE(0x1b75, 0x3072) }, | ||
2123 | /* Pegatron */ | ||
2124 | { USB_DEVICE(0x05a6, 0x0101) }, | ||
2125 | - { USB_DEVICE(0x1d4d, 0x0002) }, | ||
2126 | { USB_DEVICE(0x1d4d, 0x0010) }, | ||
2127 | /* Planex */ | ||
2128 | { USB_DEVICE(0x2019, 0x5201) }, | ||
2129 | @@ -1203,9 +1206,6 @@ static struct usb_device_id rt2800usb_device_table[] = { | ||
2130 | { USB_DEVICE(0x083a, 0xc522) }, | ||
2131 | { USB_DEVICE(0x083a, 0xd522) }, | ||
2132 | { USB_DEVICE(0x083a, 0xf511) }, | ||
2133 | - /* Sweex */ | ||
2134 | - { USB_DEVICE(0x177f, 0x0153) }, | ||
2135 | - { USB_DEVICE(0x177f, 0x0313) }, | ||
2136 | /* Zyxel */ | ||
2137 | { USB_DEVICE(0x0586, 0x341a) }, | ||
2138 | #endif | ||
2139 | diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c | ||
2140 | index d44d398..47ba0f7 100644 | ||
2141 | --- a/drivers/net/wireless/rtlwifi/pci.c | ||
2142 | +++ b/drivers/net/wireless/rtlwifi/pci.c | ||
2143 | @@ -1961,6 +1961,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) | ||
2144 | rtl_deinit_deferred_work(hw); | ||
2145 | rtlpriv->intf_ops->adapter_stop(hw); | ||
2146 | } | ||
2147 | + rtlpriv->cfg->ops->disable_interrupt(hw); | ||
2148 | |||
2149 | /*deinit rfkill */ | ||
2150 | rtl_deinit_rfkill(hw); | ||
2151 | diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c | ||
2152 | index ba3268e..40c1574 100644 | ||
2153 | --- a/drivers/net/wireless/wl1251/main.c | ||
2154 | +++ b/drivers/net/wireless/wl1251/main.c | ||
2155 | @@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | ||
2156 | cancel_work_sync(&wl->irq_work); | ||
2157 | cancel_work_sync(&wl->tx_work); | ||
2158 | cancel_work_sync(&wl->filter_work); | ||
2159 | + cancel_delayed_work_sync(&wl->elp_work); | ||
2160 | |||
2161 | mutex_lock(&wl->mutex); | ||
2162 | |||
2163 | diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c | ||
2164 | index f786942..1b851f6 100644 | ||
2165 | --- a/drivers/net/wireless/wl1251/sdio.c | ||
2166 | +++ b/drivers/net/wireless/wl1251/sdio.c | ||
2167 | @@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) | ||
2168 | |||
2169 | if (wl->irq) | ||
2170 | free_irq(wl->irq, wl); | ||
2171 | - kfree(wl_sdio); | ||
2172 | wl1251_free_hw(wl); | ||
2173 | + kfree(wl_sdio); | ||
2174 | |||
2175 | sdio_claim_host(func); | ||
2176 | sdio_release_irq(func); | ||
2177 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | ||
2178 | index 6476547..78fda9c 100644 | ||
2179 | --- a/drivers/pci/quirks.c | ||
2180 | +++ b/drivers/pci/quirks.c | ||
2181 | @@ -2906,6 +2906,40 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f8, quirk_intel_mc_errata); | ||
2182 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); | ||
2183 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); | ||
2184 | |||
2185 | +/* | ||
2186 | + * Some BIOS implementations leave the Intel GPU interrupts enabled, | ||
2187 | + * even though no one is handling them (f.e. i915 driver is never loaded). | ||
2188 | + * Additionally the interrupt destination is not set up properly | ||
2189 | + * and the interrupt ends up -somewhere-. | ||
2190 | + * | ||
2191 | + * These spurious interrupts are "sticky" and the kernel disables | ||
2192 | + * the (shared) interrupt line after 100.000+ generated interrupts. | ||
2193 | + * | ||
2194 | + * Fix it by disabling the still enabled interrupts. | ||
2195 | + * This resolves crashes often seen on monitor unplug. | ||
2196 | + */ | ||
2197 | +#define I915_DEIER_REG 0x4400c | ||
2198 | +static void __devinit disable_igfx_irq(struct pci_dev *dev) | ||
2199 | +{ | ||
2200 | + void __iomem *regs = pci_iomap(dev, 0, 0); | ||
2201 | + if (regs == NULL) { | ||
2202 | + dev_warn(&dev->dev, "igfx quirk: Can't iomap PCI device\n"); | ||
2203 | + return; | ||
2204 | + } | ||
2205 | + | ||
2206 | + /* Check if any interrupt line is still enabled */ | ||
2207 | + if (readl(regs + I915_DEIER_REG) != 0) { | ||
2208 | + dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; " | ||
2209 | + "disabling\n"); | ||
2210 | + | ||
2211 | + writel(0, regs + I915_DEIER_REG); | ||
2212 | + } | ||
2213 | + | ||
2214 | + pci_iounmap(dev, regs); | ||
2215 | +} | ||
2216 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); | ||
2217 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); | ||
2218 | + | ||
2219 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, | ||
2220 | struct pci_fixup *end) | ||
2221 | { | ||
2222 | diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c | ||
2223 | index d93e962..1d3bcce 100644 | ||
2224 | --- a/drivers/platform/x86/dell-laptop.c | ||
2225 | +++ b/drivers/platform/x86/dell-laptop.c | ||
2226 | @@ -184,6 +184,34 @@ static struct dmi_system_id __devinitdata dell_quirks[] = { | ||
2227 | }, | ||
2228 | .driver_data = &quirk_dell_vostro_v130, | ||
2229 | }, | ||
2230 | + { | ||
2231 | + .callback = dmi_matched, | ||
2232 | + .ident = "Dell Vostro 3555", | ||
2233 | + .matches = { | ||
2234 | + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
2235 | + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3555"), | ||
2236 | + }, | ||
2237 | + .driver_data = &quirk_dell_vostro_v130, | ||
2238 | + }, | ||
2239 | + { | ||
2240 | + .callback = dmi_matched, | ||
2241 | + .ident = "Dell Inspiron N311z", | ||
2242 | + .matches = { | ||
2243 | + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
2244 | + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N311z"), | ||
2245 | + }, | ||
2246 | + .driver_data = &quirk_dell_vostro_v130, | ||
2247 | + }, | ||
2248 | + { | ||
2249 | + .callback = dmi_matched, | ||
2250 | + .ident = "Dell Inspiron M5110", | ||
2251 | + .matches = { | ||
2252 | + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
2253 | + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron M5110"), | ||
2254 | + }, | ||
2255 | + .driver_data = &quirk_dell_vostro_v130, | ||
2256 | + }, | ||
2257 | + { } | ||
2258 | }; | ||
2259 | |||
2260 | static struct calling_interface_buffer *buffer; | ||
2261 | @@ -615,6 +643,7 @@ static void touchpad_led_set(struct led_classdev *led_cdev, | ||
2262 | static struct led_classdev touchpad_led = { | ||
2263 | .name = "dell-laptop::touchpad", | ||
2264 | .brightness_set = touchpad_led_set, | ||
2265 | + .flags = LED_CORE_SUSPENDRESUME, | ||
2266 | }; | ||
2267 | |||
2268 | static int __devinit touchpad_led_init(struct device *dev) | ||
2269 | diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c | ||
2270 | index 1b831c5..e48ba4b 100644 | ||
2271 | --- a/drivers/scsi/libsas/sas_expander.c | ||
2272 | +++ b/drivers/scsi/libsas/sas_expander.c | ||
2273 | @@ -192,7 +192,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, | ||
2274 | phy->attached_sata_ps = dr->attached_sata_ps; | ||
2275 | phy->attached_iproto = dr->iproto << 1; | ||
2276 | phy->attached_tproto = dr->tproto << 1; | ||
2277 | - memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
2278 | + /* help some expanders that fail to zero sas_address in the 'no | ||
2279 | + * device' case | ||
2280 | + */ | ||
2281 | + if (phy->attached_dev_type == NO_DEVICE || | ||
2282 | + phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | ||
2283 | + memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
2284 | + else | ||
2285 | + memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
2286 | phy->attached_phy_id = dr->attached_phy_id; | ||
2287 | phy->phy_change_count = dr->change_count; | ||
2288 | phy->routing_attr = dr->routing_attr; | ||
2289 | @@ -1643,9 +1650,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | ||
2290 | int phy_change_count = 0; | ||
2291 | |||
2292 | res = sas_get_phy_change_count(dev, i, &phy_change_count); | ||
2293 | - if (res) | ||
2294 | - goto out; | ||
2295 | - else if (phy_change_count != ex->ex_phy[i].phy_change_count) { | ||
2296 | + switch (res) { | ||
2297 | + case SMP_RESP_PHY_VACANT: | ||
2298 | + case SMP_RESP_NO_PHY: | ||
2299 | + continue; | ||
2300 | + case SMP_RESP_FUNC_ACC: | ||
2301 | + break; | ||
2302 | + default: | ||
2303 | + return res; | ||
2304 | + } | ||
2305 | + | ||
2306 | + if (phy_change_count != ex->ex_phy[i].phy_change_count) { | ||
2307 | if (update) | ||
2308 | ex->ex_phy[i].phy_change_count = | ||
2309 | phy_change_count; | ||
2310 | @@ -1653,8 +1668,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | ||
2311 | return 0; | ||
2312 | } | ||
2313 | } | ||
2314 | -out: | ||
2315 | - return res; | ||
2316 | + return 0; | ||
2317 | } | ||
2318 | |||
2319 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) | ||
2320 | diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c | ||
2321 | index 24cacff..5f748c0 100644 | ||
2322 | --- a/drivers/spi/spi-fsl-spi.c | ||
2323 | +++ b/drivers/spi/spi-fsl-spi.c | ||
2324 | @@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi) | ||
2325 | static void fsl_spi_chipselect(struct spi_device *spi, int value) | ||
2326 | { | ||
2327 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | ||
2328 | - struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; | ||
2329 | + struct fsl_spi_platform_data *pdata; | ||
2330 | bool pol = spi->mode & SPI_CS_HIGH; | ||
2331 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | ||
2332 | |||
2333 | + pdata = spi->dev.parent->parent->platform_data; | ||
2334 | + | ||
2335 | if (value == BITBANG_CS_INACTIVE) { | ||
2336 | if (pdata->cs_control) | ||
2337 | pdata->cs_control(spi, !pol); | ||
2338 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c | ||
2339 | index 77eae99..b2ccdea 100644 | ||
2340 | --- a/drivers/spi/spi.c | ||
2341 | +++ b/drivers/spi/spi.c | ||
2342 | @@ -319,7 +319,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master) | ||
2343 | } | ||
2344 | |||
2345 | spi->master = master; | ||
2346 | - spi->dev.parent = dev; | ||
2347 | + spi->dev.parent = &master->dev; | ||
2348 | spi->dev.bus = &spi_bus_type; | ||
2349 | spi->dev.release = spidev_release; | ||
2350 | device_initialize(&spi->dev); | ||
2351 | diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c | ||
2352 | index fb11743..4bb2797 100644 | ||
2353 | --- a/drivers/staging/rtl8712/os_intfs.c | ||
2354 | +++ b/drivers/staging/rtl8712/os_intfs.c | ||
2355 | @@ -476,9 +476,6 @@ static int netdev_close(struct net_device *pnetdev) | ||
2356 | r8712_free_assoc_resources(padapter); | ||
2357 | /*s2-4.*/ | ||
2358 | r8712_free_network_queue(padapter); | ||
2359 | - release_firmware(padapter->fw); | ||
2360 | - /* never exit with a firmware callback pending */ | ||
2361 | - wait_for_completion(&padapter->rtl8712_fw_ready); | ||
2362 | return 0; | ||
2363 | } | ||
2364 | |||
2365 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c | ||
2366 | index 9bade18..ec41d38 100644 | ||
2367 | --- a/drivers/staging/rtl8712/usb_intf.c | ||
2368 | +++ b/drivers/staging/rtl8712/usb_intf.c | ||
2369 | @@ -30,6 +30,7 @@ | ||
2370 | |||
2371 | #include <linux/usb.h> | ||
2372 | #include <linux/module.h> | ||
2373 | +#include <linux/firmware.h> | ||
2374 | |||
2375 | #include "osdep_service.h" | ||
2376 | #include "drv_types.h" | ||
2377 | @@ -621,6 +622,10 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf) | ||
2378 | struct _adapter *padapter = netdev_priv(pnetdev); | ||
2379 | struct usb_device *udev = interface_to_usbdev(pusb_intf); | ||
2380 | |||
2381 | + if (padapter->fw_found) | ||
2382 | + release_firmware(padapter->fw); | ||
2383 | + /* never exit with a firmware callback pending */ | ||
2384 | + wait_for_completion(&padapter->rtl8712_fw_ready); | ||
2385 | usb_set_intfdata(pusb_intf, NULL); | ||
2386 | if (padapter) { | ||
2387 | if (drvpriv.drv_registered == true) | ||
2388 | diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c | ||
2389 | index b84c834..8daf073 100644 | ||
2390 | --- a/drivers/tty/amiserial.c | ||
2391 | +++ b/drivers/tty/amiserial.c | ||
2392 | @@ -1113,8 +1113,10 @@ static int set_serial_info(struct async_struct * info, | ||
2393 | (new_serial.close_delay != state->close_delay) || | ||
2394 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || | ||
2395 | ((new_serial.flags & ~ASYNC_USR_MASK) != | ||
2396 | - (state->flags & ~ASYNC_USR_MASK))) | ||
2397 | + (state->flags & ~ASYNC_USR_MASK))) { | ||
2398 | + tty_unlock(); | ||
2399 | return -EPERM; | ||
2400 | + } | ||
2401 | state->flags = ((state->flags & ~ASYNC_USR_MASK) | | ||
2402 | (new_serial.flags & ASYNC_USR_MASK)); | ||
2403 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | ||
2404 | diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c | ||
2405 | index e6c3dbd..836fe273 100644 | ||
2406 | --- a/drivers/tty/serial/clps711x.c | ||
2407 | +++ b/drivers/tty/serial/clps711x.c | ||
2408 | @@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | ||
2409 | port->x_char = 0; | ||
2410 | return IRQ_HANDLED; | ||
2411 | } | ||
2412 | - if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { | ||
2413 | - clps711xuart_stop_tx(port); | ||
2414 | - return IRQ_HANDLED; | ||
2415 | - } | ||
2416 | + | ||
2417 | + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) | ||
2418 | + goto disable_tx_irq; | ||
2419 | |||
2420 | count = port->fifosize >> 1; | ||
2421 | do { | ||
2422 | @@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | ||
2423 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
2424 | uart_write_wakeup(port); | ||
2425 | |||
2426 | - if (uart_circ_empty(xmit)) | ||
2427 | - clps711xuart_stop_tx(port); | ||
2428 | + if (uart_circ_empty(xmit)) { | ||
2429 | + disable_tx_irq: | ||
2430 | + disable_irq_nosync(TX_IRQ(port)); | ||
2431 | + tx_enabled(port) = 0; | ||
2432 | + } | ||
2433 | |||
2434 | return IRQ_HANDLED; | ||
2435 | } | ||
2436 | diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c | ||
2437 | index da776a0..a4b192d 100644 | ||
2438 | --- a/drivers/tty/serial/pch_uart.c | ||
2439 | +++ b/drivers/tty/serial/pch_uart.c | ||
2440 | @@ -1356,9 +1356,11 @@ static int pch_uart_verify_port(struct uart_port *port, | ||
2441 | __func__); | ||
2442 | return -EOPNOTSUPP; | ||
2443 | #endif | ||
2444 | - priv->use_dma = 1; | ||
2445 | priv->use_dma_flag = 1; | ||
2446 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); | ||
2447 | + if (!priv->use_dma) | ||
2448 | + pch_request_dma(port); | ||
2449 | + priv->use_dma = 1; | ||
2450 | } | ||
2451 | |||
2452 | return 0; | ||
2453 | diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c | ||
2454 | index 9eb71d8..2db0327 100644 | ||
2455 | --- a/drivers/usb/class/cdc-wdm.c | ||
2456 | +++ b/drivers/usb/class/cdc-wdm.c | ||
2457 | @@ -108,8 +108,9 @@ static void wdm_out_callback(struct urb *urb) | ||
2458 | spin_lock(&desc->iuspin); | ||
2459 | desc->werr = urb->status; | ||
2460 | spin_unlock(&desc->iuspin); | ||
2461 | - clear_bit(WDM_IN_USE, &desc->flags); | ||
2462 | kfree(desc->outbuf); | ||
2463 | + desc->outbuf = NULL; | ||
2464 | + clear_bit(WDM_IN_USE, &desc->flags); | ||
2465 | wake_up(&desc->wait); | ||
2466 | } | ||
2467 | |||
2468 | @@ -312,7 +313,7 @@ static ssize_t wdm_write | ||
2469 | if (we < 0) | ||
2470 | return -EIO; | ||
2471 | |||
2472 | - desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | ||
2473 | + buf = kmalloc(count, GFP_KERNEL); | ||
2474 | if (!buf) { | ||
2475 | rv = -ENOMEM; | ||
2476 | goto outnl; | ||
2477 | @@ -376,10 +377,12 @@ static ssize_t wdm_write | ||
2478 | req->wIndex = desc->inum; | ||
2479 | req->wLength = cpu_to_le16(count); | ||
2480 | set_bit(WDM_IN_USE, &desc->flags); | ||
2481 | + desc->outbuf = buf; | ||
2482 | |||
2483 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | ||
2484 | if (rv < 0) { | ||
2485 | kfree(buf); | ||
2486 | + desc->outbuf = NULL; | ||
2487 | clear_bit(WDM_IN_USE, &desc->flags); | ||
2488 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); | ||
2489 | } else { | ||
2490 | diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c | ||
2491 | index 61d08dd..5f1404a 100644 | ||
2492 | --- a/drivers/usb/core/hcd-pci.c | ||
2493 | +++ b/drivers/usb/core/hcd-pci.c | ||
2494 | @@ -495,6 +495,15 @@ static int hcd_pci_suspend_noirq(struct device *dev) | ||
2495 | |||
2496 | pci_save_state(pci_dev); | ||
2497 | |||
2498 | + /* | ||
2499 | + * Some systems crash if an EHCI controller is in D3 during | ||
2500 | + * a sleep transition. We have to leave such controllers in D0. | ||
2501 | + */ | ||
2502 | + if (hcd->broken_pci_sleep) { | ||
2503 | + dev_dbg(dev, "Staying in PCI D0\n"); | ||
2504 | + return retval; | ||
2505 | + } | ||
2506 | + | ||
2507 | /* If the root hub is dead rather than suspended, disallow remote | ||
2508 | * wakeup. usb_hc_died() should ensure that both hosts are marked as | ||
2509 | * dying, so we only need to check the primary roothub. | ||
2510 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
2511 | index e238b3b..2b0a341 100644 | ||
2512 | --- a/drivers/usb/core/hub.c | ||
2513 | +++ b/drivers/usb/core/hub.c | ||
2514 | @@ -1644,7 +1644,6 @@ void usb_disconnect(struct usb_device **pdev) | ||
2515 | { | ||
2516 | struct usb_device *udev = *pdev; | ||
2517 | int i; | ||
2518 | - struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
2519 | |||
2520 | /* mark the device as inactive, so any further urb submissions for | ||
2521 | * this device (and any of its children) will fail immediately. | ||
2522 | @@ -1667,9 +1666,7 @@ void usb_disconnect(struct usb_device **pdev) | ||
2523 | * so that the hardware is now fully quiesced. | ||
2524 | */ | ||
2525 | dev_dbg (&udev->dev, "unregistering device\n"); | ||
2526 | - mutex_lock(hcd->bandwidth_mutex); | ||
2527 | usb_disable_device(udev, 0); | ||
2528 | - mutex_unlock(hcd->bandwidth_mutex); | ||
2529 | usb_hcd_synchronize_unlinks(udev); | ||
2530 | |||
2531 | usb_remove_ep_devs(&udev->ep0); | ||
2532 | diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c | ||
2533 | index aed3e07..ca717da 100644 | ||
2534 | --- a/drivers/usb/core/message.c | ||
2535 | +++ b/drivers/usb/core/message.c | ||
2536 | @@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, | ||
2537 | * Deallocates hcd/hardware state for the endpoints (nuking all or most | ||
2538 | * pending urbs) and usbcore state for the interfaces, so that usbcore | ||
2539 | * must usb_set_configuration() before any interfaces could be used. | ||
2540 | - * | ||
2541 | - * Must be called with hcd->bandwidth_mutex held. | ||
2542 | */ | ||
2543 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | ||
2544 | { | ||
2545 | @@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | ||
2546 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | ||
2547 | } | ||
2548 | /* Remove endpoints from the host controller internal state */ | ||
2549 | + mutex_lock(hcd->bandwidth_mutex); | ||
2550 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
2551 | + mutex_unlock(hcd->bandwidth_mutex); | ||
2552 | /* Second pass: remove endpoint pointers */ | ||
2553 | } | ||
2554 | for (i = skip_ep0; i < 16; ++i) { | ||
2555 | @@ -1750,7 +1750,6 @@ free_interfaces: | ||
2556 | /* if it's already configured, clear out old state first. | ||
2557 | * getting rid of old interfaces means unbinding their drivers. | ||
2558 | */ | ||
2559 | - mutex_lock(hcd->bandwidth_mutex); | ||
2560 | if (dev->state != USB_STATE_ADDRESS) | ||
2561 | usb_disable_device(dev, 1); /* Skip ep0 */ | ||
2562 | |||
2563 | @@ -1763,6 +1762,7 @@ free_interfaces: | ||
2564 | * host controller will not allow submissions to dropped endpoints. If | ||
2565 | * this call fails, the device state is unchanged. | ||
2566 | */ | ||
2567 | + mutex_lock(hcd->bandwidth_mutex); | ||
2568 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | ||
2569 | if (ret < 0) { | ||
2570 | mutex_unlock(hcd->bandwidth_mutex); | ||
2571 | diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c | ||
2572 | index 27bd50a..c0dcf69 100644 | ||
2573 | --- a/drivers/usb/dwc3/ep0.c | ||
2574 | +++ b/drivers/usb/dwc3/ep0.c | ||
2575 | @@ -572,9 +572,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | ||
2576 | dwc->ep0_bounced = false; | ||
2577 | } else { | ||
2578 | transferred = ur->length - trb.length; | ||
2579 | - ur->actual += transferred; | ||
2580 | } | ||
2581 | |||
2582 | + ur->actual += transferred; | ||
2583 | + | ||
2584 | if ((epnum & 1) && ur->actual < ur->length) { | ||
2585 | /* for some reason we did not get everything out */ | ||
2586 | |||
2587 | diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c | ||
2588 | index ab8f1b4..527736e 100644 | ||
2589 | --- a/drivers/usb/gadget/dummy_hcd.c | ||
2590 | +++ b/drivers/usb/gadget/dummy_hcd.c | ||
2591 | @@ -925,7 +925,6 @@ static int dummy_udc_stop(struct usb_gadget *g, | ||
2592 | |||
2593 | dum->driver = NULL; | ||
2594 | |||
2595 | - dummy_pullup(&dum->gadget, 0); | ||
2596 | return 0; | ||
2597 | } | ||
2598 | |||
2599 | diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c | ||
2600 | index acb3800..0e641a1 100644 | ||
2601 | --- a/drivers/usb/gadget/f_fs.c | ||
2602 | +++ b/drivers/usb/gadget/f_fs.c | ||
2603 | @@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) | ||
2604 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { | ||
2605 | struct ffs_function *func = ffs->func; | ||
2606 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; | ||
2607 | - } else if (gadget->ops->ioctl) { | ||
2608 | + } else if (gadget && gadget->ops->ioctl) { | ||
2609 | ret = gadget->ops->ioctl(gadget, code, value); | ||
2610 | } else { | ||
2611 | ret = -ENOTTY; | ||
2612 | diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c | ||
2613 | index 1a6f415..a5570b6 100644 | ||
2614 | --- a/drivers/usb/gadget/f_mass_storage.c | ||
2615 | +++ b/drivers/usb/gadget/f_mass_storage.c | ||
2616 | @@ -2182,7 +2182,7 @@ unknown_cmnd: | ||
2617 | common->data_size_from_cmnd = 0; | ||
2618 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); | ||
2619 | reply = check_command(common, common->cmnd_size, | ||
2620 | - DATA_DIR_UNKNOWN, 0xff, 0, unknown); | ||
2621 | + DATA_DIR_UNKNOWN, ~0, 0, unknown); | ||
2622 | if (reply == 0) { | ||
2623 | common->curlun->sense_data = SS_INVALID_COMMAND; | ||
2624 | reply = -EINVAL; | ||
2625 | diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c | ||
2626 | index 11b5196..db2d607 100644 | ||
2627 | --- a/drivers/usb/gadget/file_storage.c | ||
2628 | +++ b/drivers/usb/gadget/file_storage.c | ||
2629 | @@ -2569,7 +2569,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | ||
2630 | fsg->data_size_from_cmnd = 0; | ||
2631 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); | ||
2632 | if ((reply = check_command(fsg, fsg->cmnd_size, | ||
2633 | - DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) { | ||
2634 | + DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { | ||
2635 | fsg->curlun->sense_data = SS_INVALID_COMMAND; | ||
2636 | reply = -EINVAL; | ||
2637 | } | ||
2638 | diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c | ||
2639 | index 6939e17..901924a 100644 | ||
2640 | --- a/drivers/usb/gadget/udc-core.c | ||
2641 | +++ b/drivers/usb/gadget/udc-core.c | ||
2642 | @@ -211,9 +211,9 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | ||
2643 | |||
2644 | if (udc_is_newstyle(udc)) { | ||
2645 | udc->driver->disconnect(udc->gadget); | ||
2646 | + usb_gadget_disconnect(udc->gadget); | ||
2647 | udc->driver->unbind(udc->gadget); | ||
2648 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
2649 | - usb_gadget_disconnect(udc->gadget); | ||
2650 | } else { | ||
2651 | usb_gadget_stop(udc->gadget, udc->driver); | ||
2652 | } | ||
2653 | @@ -359,9 +359,13 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | ||
2654 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | ||
2655 | |||
2656 | if (sysfs_streq(buf, "connect")) { | ||
2657 | + if (udc_is_newstyle(udc)) | ||
2658 | + usb_gadget_udc_start(udc->gadget, udc->driver); | ||
2659 | usb_gadget_connect(udc->gadget); | ||
2660 | } else if (sysfs_streq(buf, "disconnect")) { | ||
2661 | usb_gadget_disconnect(udc->gadget); | ||
2662 | + if (udc_is_newstyle(udc)) | ||
2663 | + usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
2664 | } else { | ||
2665 | dev_err(dev, "unsupported command '%s'\n", buf); | ||
2666 | return -EINVAL; | ||
2667 | diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h | ||
2668 | index bc78c60..ca4e03a 100644 | ||
2669 | --- a/drivers/usb/gadget/uvc.h | ||
2670 | +++ b/drivers/usb/gadget/uvc.h | ||
2671 | @@ -28,7 +28,7 @@ | ||
2672 | |||
2673 | struct uvc_request_data | ||
2674 | { | ||
2675 | - unsigned int length; | ||
2676 | + __s32 length; | ||
2677 | __u8 data[60]; | ||
2678 | }; | ||
2679 | |||
2680 | diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c | ||
2681 | index f6e083b..54d7ca5 100644 | ||
2682 | --- a/drivers/usb/gadget/uvc_v4l2.c | ||
2683 | +++ b/drivers/usb/gadget/uvc_v4l2.c | ||
2684 | @@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) | ||
2685 | if (data->length < 0) | ||
2686 | return usb_ep_set_halt(cdev->gadget->ep0); | ||
2687 | |||
2688 | - req->length = min(uvc->event_length, data->length); | ||
2689 | + req->length = min_t(unsigned int, uvc->event_length, data->length); | ||
2690 | req->zero = data->length < uvc->event_length; | ||
2691 | req->dma = DMA_ADDR_INVALID; | ||
2692 | |||
2693 | diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c | ||
2694 | index 3ff9f82..da2f711 100644 | ||
2695 | --- a/drivers/usb/host/ehci-hcd.c | ||
2696 | +++ b/drivers/usb/host/ehci-hcd.c | ||
2697 | @@ -815,8 +815,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | ||
2698 | goto dead; | ||
2699 | } | ||
2700 | |||
2701 | + /* | ||
2702 | + * We don't use STS_FLR, but some controllers don't like it to | ||
2703 | + * remain on, so mask it out along with the other status bits. | ||
2704 | + */ | ||
2705 | + masked_status = status & (INTR_MASK | STS_FLR); | ||
2706 | + | ||
2707 | /* Shared IRQ? */ | ||
2708 | - masked_status = status & INTR_MASK; | ||
2709 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | ||
2710 | spin_unlock(&ehci->lock); | ||
2711 | return IRQ_NONE; | ||
2712 | @@ -867,7 +872,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | ||
2713 | pcd_status = status; | ||
2714 | |||
2715 | /* resume root hub? */ | ||
2716 | - if (!(cmd & CMD_RUN)) | ||
2717 | + if (ehci->rh_state == EHCI_RH_SUSPENDED) | ||
2718 | usb_hcd_resume_root_hub(hcd); | ||
2719 | |||
2720 | /* get per-port change detect bits */ | ||
2721 | diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c | ||
2722 | index f4b627d..971d312 100644 | ||
2723 | --- a/drivers/usb/host/ehci-pci.c | ||
2724 | +++ b/drivers/usb/host/ehci-pci.c | ||
2725 | @@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | ||
2726 | hcd->has_tt = 1; | ||
2727 | tdi_reset(ehci); | ||
2728 | } | ||
2729 | + if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) { | ||
2730 | + /* EHCI #1 or #2 on 6 Series/C200 Series chipset */ | ||
2731 | + if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) { | ||
2732 | + ehci_info(ehci, "broken D3 during system sleep on ASUS\n"); | ||
2733 | + hcd->broken_pci_sleep = 1; | ||
2734 | + device_set_wakeup_capable(&pdev->dev, false); | ||
2735 | + } | ||
2736 | + } | ||
2737 | break; | ||
2738 | case PCI_VENDOR_ID_TDI: | ||
2739 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | ||
2740 | diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c | ||
2741 | index ac5bfd6..2504694 100644 | ||
2742 | --- a/drivers/usb/misc/yurex.c | ||
2743 | +++ b/drivers/usb/misc/yurex.c | ||
2744 | @@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref) | ||
2745 | usb_put_dev(dev->udev); | ||
2746 | if (dev->cntl_urb) { | ||
2747 | usb_kill_urb(dev->cntl_urb); | ||
2748 | - if (dev->cntl_req) | ||
2749 | - usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | ||
2750 | - dev->cntl_req, dev->cntl_urb->setup_dma); | ||
2751 | + kfree(dev->cntl_req); | ||
2752 | if (dev->cntl_buffer) | ||
2753 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | ||
2754 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); | ||
2755 | @@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | ||
2756 | } | ||
2757 | |||
2758 | /* allocate buffer for control req */ | ||
2759 | - dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, | ||
2760 | - GFP_KERNEL, | ||
2761 | - &dev->cntl_urb->setup_dma); | ||
2762 | + dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); | ||
2763 | if (!dev->cntl_req) { | ||
2764 | err("Could not allocate cntl_req"); | ||
2765 | goto error; | ||
2766 | @@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | ||
2767 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), | ||
2768 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, | ||
2769 | dev, 1); | ||
2770 | - dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
2771 | + dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
2772 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { | ||
2773 | retval = -EIO; | ||
2774 | err("Could not submitting URB"); | ||
2775 | diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c | ||
2776 | index ba85f27..a8f0c09 100644 | ||
2777 | --- a/drivers/usb/musb/omap2430.c | ||
2778 | +++ b/drivers/usb/musb/omap2430.c | ||
2779 | @@ -282,7 +282,8 @@ static int musb_otg_notifications(struct notifier_block *nb, | ||
2780 | |||
2781 | static int omap2430_musb_init(struct musb *musb) | ||
2782 | { | ||
2783 | - u32 l, status = 0; | ||
2784 | + u32 l; | ||
2785 | + int status = 0; | ||
2786 | struct device *dev = musb->controller; | ||
2787 | struct musb_hdrc_platform_data *plat = dev->platform_data; | ||
2788 | struct omap_musb_board_data *data = plat->board_data; | ||
2789 | @@ -299,7 +300,7 @@ static int omap2430_musb_init(struct musb *musb) | ||
2790 | |||
2791 | status = pm_runtime_get_sync(dev); | ||
2792 | if (status < 0) { | ||
2793 | - dev_err(dev, "pm_runtime_get_sync FAILED"); | ||
2794 | + dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); | ||
2795 | goto err1; | ||
2796 | } | ||
2797 | |||
2798 | @@ -451,14 +452,14 @@ static int __init omap2430_probe(struct platform_device *pdev) | ||
2799 | goto err2; | ||
2800 | } | ||
2801 | |||
2802 | + pm_runtime_enable(&pdev->dev); | ||
2803 | + | ||
2804 | ret = platform_device_add(musb); | ||
2805 | if (ret) { | ||
2806 | dev_err(&pdev->dev, "failed to register musb device\n"); | ||
2807 | goto err2; | ||
2808 | } | ||
2809 | |||
2810 | - pm_runtime_enable(&pdev->dev); | ||
2811 | - | ||
2812 | return 0; | ||
2813 | |||
2814 | err2: | ||
2815 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c | ||
2816 | index 4c12404..f2c57e0 100644 | ||
2817 | --- a/drivers/usb/serial/cp210x.c | ||
2818 | +++ b/drivers/usb/serial/cp210x.c | ||
2819 | @@ -285,7 +285,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | ||
2820 | /* Issue the request, attempting to read 'size' bytes */ | ||
2821 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | ||
2822 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, | ||
2823 | - port_priv->bInterfaceNumber, buf, size, 300); | ||
2824 | + port_priv->bInterfaceNumber, buf, size, | ||
2825 | + USB_CTRL_GET_TIMEOUT); | ||
2826 | |||
2827 | /* Convert data into an array of integers */ | ||
2828 | for (i = 0; i < length; i++) | ||
2829 | @@ -335,12 +336,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | ||
2830 | result = usb_control_msg(serial->dev, | ||
2831 | usb_sndctrlpipe(serial->dev, 0), | ||
2832 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, | ||
2833 | - port_priv->bInterfaceNumber, buf, size, 300); | ||
2834 | + port_priv->bInterfaceNumber, buf, size, | ||
2835 | + USB_CTRL_SET_TIMEOUT); | ||
2836 | } else { | ||
2837 | result = usb_control_msg(serial->dev, | ||
2838 | usb_sndctrlpipe(serial->dev, 0), | ||
2839 | request, REQTYPE_HOST_TO_DEVICE, data[0], | ||
2840 | - port_priv->bInterfaceNumber, NULL, 0, 300); | ||
2841 | + port_priv->bInterfaceNumber, NULL, 0, | ||
2842 | + USB_CTRL_SET_TIMEOUT); | ||
2843 | } | ||
2844 | |||
2845 | kfree(buf); | ||
2846 | diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c | ||
2847 | index 7c3ec9e..e093585 100644 | ||
2848 | --- a/drivers/usb/serial/sierra.c | ||
2849 | +++ b/drivers/usb/serial/sierra.c | ||
2850 | @@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = { | ||
2851 | }; | ||
2852 | |||
2853 | /* 'blacklist' of interfaces not served by this driver */ | ||
2854 | -static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; | ||
2855 | +static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 }; | ||
2856 | static const struct sierra_iface_info direct_ip_interface_blacklist = { | ||
2857 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), | ||
2858 | .ifaceinfo = direct_ip_non_serial_ifaces, | ||
2859 | @@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = { | ||
2860 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ | ||
2861 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ | ||
2862 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | ||
2863 | - { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */ | ||
2864 | /* Sierra Wireless C885 */ | ||
2865 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | ||
2866 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ | ||
2867 | @@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = { | ||
2868 | /* Sierra Wireless HSPA Non-Composite Device */ | ||
2869 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | ||
2870 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | ||
2871 | + { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */ | ||
2872 | + .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
2873 | + }, | ||
2874 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | ||
2875 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
2876 | }, | ||
2877 | diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c | ||
2878 | index 2babcd4..86685e9 100644 | ||
2879 | --- a/drivers/uwb/hwa-rc.c | ||
2880 | +++ b/drivers/uwb/hwa-rc.c | ||
2881 | @@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb) | ||
2882 | dev_err(dev, "NEEP: URB error %d\n", urb->status); | ||
2883 | } | ||
2884 | result = usb_submit_urb(urb, GFP_ATOMIC); | ||
2885 | - if (result < 0) { | ||
2886 | + if (result < 0 && result != -ENODEV && result != -EPERM) { | ||
2887 | + /* ignoring unrecoverable errors */ | ||
2888 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", | ||
2889 | result); | ||
2890 | goto error; | ||
2891 | diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c | ||
2892 | index a269937..8cb71bb 100644 | ||
2893 | --- a/drivers/uwb/neh.c | ||
2894 | +++ b/drivers/uwb/neh.c | ||
2895 | @@ -107,6 +107,7 @@ struct uwb_rc_neh { | ||
2896 | u8 evt_type; | ||
2897 | __le16 evt; | ||
2898 | u8 context; | ||
2899 | + u8 completed; | ||
2900 | uwb_rc_cmd_cb_f cb; | ||
2901 | void *arg; | ||
2902 | |||
2903 | @@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | ||
2904 | struct device *dev = &rc->uwb_dev.dev; | ||
2905 | struct uwb_rc_neh *neh; | ||
2906 | struct uwb_rceb *notif; | ||
2907 | + unsigned long flags; | ||
2908 | |||
2909 | if (rceb->bEventContext == 0) { | ||
2910 | notif = kmalloc(size, GFP_ATOMIC); | ||
2911 | @@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | ||
2912 | } else { | ||
2913 | neh = uwb_rc_neh_lookup(rc, rceb); | ||
2914 | if (neh) { | ||
2915 | - del_timer_sync(&neh->timer); | ||
2916 | + spin_lock_irqsave(&rc->neh_lock, flags); | ||
2917 | + /* to guard against a timeout */ | ||
2918 | + neh->completed = 1; | ||
2919 | + del_timer(&neh->timer); | ||
2920 | + spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
2921 | uwb_rc_neh_cb(neh, rceb, size); | ||
2922 | } else | ||
2923 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", | ||
2924 | @@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg) | ||
2925 | unsigned long flags; | ||
2926 | |||
2927 | spin_lock_irqsave(&rc->neh_lock, flags); | ||
2928 | + if (neh->completed) { | ||
2929 | + spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
2930 | + return; | ||
2931 | + } | ||
2932 | if (neh->context) | ||
2933 | __uwb_rc_neh_rm(rc, neh); | ||
2934 | else | ||
2935 | diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c | ||
2936 | index afca14d..625890c 100644 | ||
2937 | --- a/drivers/xen/gntdev.c | ||
2938 | +++ b/drivers/xen/gntdev.c | ||
2939 | @@ -692,7 +692,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | ||
2940 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; | ||
2941 | |||
2942 | if (use_ptemod) | ||
2943 | - vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; | ||
2944 | + vma->vm_flags |= VM_DONTCOPY; | ||
2945 | |||
2946 | vma->vm_private_data = map; | ||
2947 | |||
2948 | diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c | ||
2949 | index 2f73195..2ce95c0 100644 | ||
2950 | --- a/drivers/xen/xenbus/xenbus_probe_frontend.c | ||
2951 | +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | ||
2952 | @@ -129,7 +129,7 @@ static int read_backend_details(struct xenbus_device *xendev) | ||
2953 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); | ||
2954 | } | ||
2955 | |||
2956 | -static int is_device_connecting(struct device *dev, void *data) | ||
2957 | +static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) | ||
2958 | { | ||
2959 | struct xenbus_device *xendev = to_xenbus_device(dev); | ||
2960 | struct device_driver *drv = data; | ||
2961 | @@ -146,16 +146,41 @@ static int is_device_connecting(struct device *dev, void *data) | ||
2962 | if (drv && (dev->driver != drv)) | ||
2963 | return 0; | ||
2964 | |||
2965 | + if (ignore_nonessential) { | ||
2966 | + /* With older QEMU, for PVonHVM guests the guest config files | ||
2967 | + * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] | ||
2968 | + * which is nonsensical as there is no PV FB (there can be | ||
2969 | + * a PVKB) running as HVM guest. */ | ||
2970 | + | ||
2971 | + if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) | ||
2972 | + return 0; | ||
2973 | + | ||
2974 | + if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) | ||
2975 | + return 0; | ||
2976 | + } | ||
2977 | xendrv = to_xenbus_driver(dev->driver); | ||
2978 | return (xendev->state < XenbusStateConnected || | ||
2979 | (xendev->state == XenbusStateConnected && | ||
2980 | xendrv->is_ready && !xendrv->is_ready(xendev))); | ||
2981 | } | ||
2982 | +static int essential_device_connecting(struct device *dev, void *data) | ||
2983 | +{ | ||
2984 | + return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); | ||
2985 | +} | ||
2986 | +static int non_essential_device_connecting(struct device *dev, void *data) | ||
2987 | +{ | ||
2988 | + return is_device_connecting(dev, data, false); | ||
2989 | +} | ||
2990 | |||
2991 | -static int exists_connecting_device(struct device_driver *drv) | ||
2992 | +static int exists_essential_connecting_device(struct device_driver *drv) | ||
2993 | { | ||
2994 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
2995 | - is_device_connecting); | ||
2996 | + essential_device_connecting); | ||
2997 | +} | ||
2998 | +static int exists_non_essential_connecting_device(struct device_driver *drv) | ||
2999 | +{ | ||
3000 | + return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
3001 | + non_essential_device_connecting); | ||
3002 | } | ||
3003 | |||
3004 | static int print_device_status(struct device *dev, void *data) | ||
3005 | @@ -186,6 +211,23 @@ static int print_device_status(struct device *dev, void *data) | ||
3006 | /* We only wait for device setup after most initcalls have run. */ | ||
3007 | static int ready_to_wait_for_devices; | ||
3008 | |||
3009 | +static bool wait_loop(unsigned long start, unsigned int max_delay, | ||
3010 | + unsigned int *seconds_waited) | ||
3011 | +{ | ||
3012 | + if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { | ||
3013 | + if (!*seconds_waited) | ||
3014 | + printk(KERN_WARNING "XENBUS: Waiting for " | ||
3015 | + "devices to initialise: "); | ||
3016 | + *seconds_waited += 5; | ||
3017 | + printk("%us...", max_delay - *seconds_waited); | ||
3018 | + if (*seconds_waited == max_delay) | ||
3019 | + return true; | ||
3020 | + } | ||
3021 | + | ||
3022 | + schedule_timeout_interruptible(HZ/10); | ||
3023 | + | ||
3024 | + return false; | ||
3025 | +} | ||
3026 | /* | ||
3027 | * On a 5-minute timeout, wait for all devices currently configured. We need | ||
3028 | * to do this to guarantee that the filesystems and / or network devices | ||
3029 | @@ -209,19 +251,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv) | ||
3030 | if (!ready_to_wait_for_devices || !xen_domain()) | ||
3031 | return; | ||
3032 | |||
3033 | - while (exists_connecting_device(drv)) { | ||
3034 | - if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { | ||
3035 | - if (!seconds_waited) | ||
3036 | - printk(KERN_WARNING "XENBUS: Waiting for " | ||
3037 | - "devices to initialise: "); | ||
3038 | - seconds_waited += 5; | ||
3039 | - printk("%us...", 300 - seconds_waited); | ||
3040 | - if (seconds_waited == 300) | ||
3041 | - break; | ||
3042 | - } | ||
3043 | - | ||
3044 | - schedule_timeout_interruptible(HZ/10); | ||
3045 | - } | ||
3046 | + while (exists_non_essential_connecting_device(drv)) | ||
3047 | + if (wait_loop(start, 30, &seconds_waited)) | ||
3048 | + break; | ||
3049 | + | ||
3050 | + /* Skips PVKB and PVFB check.*/ | ||
3051 | + while (exists_essential_connecting_device(drv)) | ||
3052 | + if (wait_loop(start, 270, &seconds_waited)) | ||
3053 | + break; | ||
3054 | |||
3055 | if (seconds_waited) | ||
3056 | printk("\n"); | ||
3057 | diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h | ||
3058 | index 308a98b..650d520 100644 | ||
3059 | --- a/fs/autofs4/autofs_i.h | ||
3060 | +++ b/fs/autofs4/autofs_i.h | ||
3061 | @@ -110,7 +110,6 @@ struct autofs_sb_info { | ||
3062 | int sub_version; | ||
3063 | int min_proto; | ||
3064 | int max_proto; | ||
3065 | - int compat_daemon; | ||
3066 | unsigned long exp_timeout; | ||
3067 | unsigned int type; | ||
3068 | int reghost_enabled; | ||
3069 | @@ -269,6 +268,17 @@ int autofs4_fill_super(struct super_block *, void *, int); | ||
3070 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *); | ||
3071 | void autofs4_clean_ino(struct autofs_info *); | ||
3072 | |||
3073 | +static inline int autofs_prepare_pipe(struct file *pipe) | ||
3074 | +{ | ||
3075 | + if (!pipe->f_op || !pipe->f_op->write) | ||
3076 | + return -EINVAL; | ||
3077 | + if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode)) | ||
3078 | + return -EINVAL; | ||
3079 | + /* We want a packet pipe */ | ||
3080 | + pipe->f_flags |= O_DIRECT; | ||
3081 | + return 0; | ||
3082 | +} | ||
3083 | + | ||
3084 | /* Queue management functions */ | ||
3085 | |||
3086 | int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | ||
3087 | diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c | ||
3088 | index 56bac70..de54271 100644 | ||
3089 | --- a/fs/autofs4/dev-ioctl.c | ||
3090 | +++ b/fs/autofs4/dev-ioctl.c | ||
3091 | @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, | ||
3092 | err = -EBADF; | ||
3093 | goto out; | ||
3094 | } | ||
3095 | - if (!pipe->f_op || !pipe->f_op->write) { | ||
3096 | + if (autofs_prepare_pipe(pipe) < 0) { | ||
3097 | err = -EPIPE; | ||
3098 | fput(pipe); | ||
3099 | goto out; | ||
3100 | @@ -385,7 +385,6 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, | ||
3101 | sbi->pipefd = pipefd; | ||
3102 | sbi->pipe = pipe; | ||
3103 | sbi->catatonic = 0; | ||
3104 | - sbi->compat_daemon = is_compat_task(); | ||
3105 | } | ||
3106 | out: | ||
3107 | mutex_unlock(&sbi->wq_mutex); | ||
3108 | diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c | ||
3109 | index 98a5695..7b5293e 100644 | ||
3110 | --- a/fs/autofs4/inode.c | ||
3111 | +++ b/fs/autofs4/inode.c | ||
3112 | @@ -19,7 +19,6 @@ | ||
3113 | #include <linux/parser.h> | ||
3114 | #include <linux/bitops.h> | ||
3115 | #include <linux/magic.h> | ||
3116 | -#include <linux/compat.h> | ||
3117 | #include "autofs_i.h" | ||
3118 | #include <linux/module.h> | ||
3119 | |||
3120 | @@ -225,7 +224,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | ||
3121 | set_autofs_type_indirect(&sbi->type); | ||
3122 | sbi->min_proto = 0; | ||
3123 | sbi->max_proto = 0; | ||
3124 | - sbi->compat_daemon = is_compat_task(); | ||
3125 | mutex_init(&sbi->wq_mutex); | ||
3126 | spin_lock_init(&sbi->fs_lock); | ||
3127 | sbi->queues = NULL; | ||
3128 | @@ -294,7 +292,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | ||
3129 | printk("autofs: could not open pipe file descriptor\n"); | ||
3130 | goto fail_dput; | ||
3131 | } | ||
3132 | - if (!pipe->f_op || !pipe->f_op->write) | ||
3133 | + if (autofs_prepare_pipe(pipe) < 0) | ||
3134 | goto fail_fput; | ||
3135 | sbi->pipe = pipe; | ||
3136 | sbi->pipefd = pipefd; | ||
3137 | diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c | ||
3138 | index 6861f61..e1fbdee 100644 | ||
3139 | --- a/fs/autofs4/waitq.c | ||
3140 | +++ b/fs/autofs4/waitq.c | ||
3141 | @@ -90,24 +90,7 @@ static int autofs4_write(struct file *file, const void *addr, int bytes) | ||
3142 | |||
3143 | return (bytes > 0); | ||
3144 | } | ||
3145 | - | ||
3146 | -/* | ||
3147 | - * The autofs_v5 packet was misdesigned. | ||
3148 | - * | ||
3149 | - * The packets are identical on x86-32 and x86-64, but have different | ||
3150 | - * alignment. Which means that 'sizeof()' will give different results. | ||
3151 | - * Fix it up for the case of running 32-bit user mode on a 64-bit kernel. | ||
3152 | - */ | ||
3153 | -static noinline size_t autofs_v5_packet_size(struct autofs_sb_info *sbi) | ||
3154 | -{ | ||
3155 | - size_t pktsz = sizeof(struct autofs_v5_packet); | ||
3156 | -#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT) | ||
3157 | - if (sbi->compat_daemon > 0) | ||
3158 | - pktsz -= 4; | ||
3159 | -#endif | ||
3160 | - return pktsz; | ||
3161 | -} | ||
3162 | - | ||
3163 | + | ||
3164 | static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | ||
3165 | struct autofs_wait_queue *wq, | ||
3166 | int type) | ||
3167 | @@ -164,7 +147,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | ||
3168 | { | ||
3169 | struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet; | ||
3170 | |||
3171 | - pktsz = autofs_v5_packet_size(sbi); | ||
3172 | + pktsz = sizeof(*packet); | ||
3173 | + | ||
3174 | packet->wait_queue_token = wq->wait_queue_token; | ||
3175 | packet->len = wq->name.len; | ||
3176 | memcpy(packet->name, wq->name.name, wq->name.len); | ||
3177 | diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h | ||
3178 | index 6738503..83a871f 100644 | ||
3179 | --- a/fs/btrfs/ctree.h | ||
3180 | +++ b/fs/btrfs/ctree.h | ||
3181 | @@ -2025,7 +2025,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item, | ||
3182 | |||
3183 | static inline bool btrfs_root_readonly(struct btrfs_root *root) | ||
3184 | { | ||
3185 | - return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY; | ||
3186 | + return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0; | ||
3187 | } | ||
3188 | |||
3189 | /* struct btrfs_root_backup */ | ||
3190 | diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c | ||
3191 | index 0e6adac..e89803b 100644 | ||
3192 | --- a/fs/cifs/cifssmb.c | ||
3193 | +++ b/fs/cifs/cifssmb.c | ||
3194 | @@ -4826,8 +4826,12 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | ||
3195 | max_len = data_end - temp; | ||
3196 | node->node_name = cifs_strndup_from_ucs(temp, max_len, | ||
3197 | is_unicode, nls_codepage); | ||
3198 | - if (!node->node_name) | ||
3199 | + if (!node->node_name) { | ||
3200 | rc = -ENOMEM; | ||
3201 | + goto parse_DFS_referrals_exit; | ||
3202 | + } | ||
3203 | + | ||
3204 | + ref++; | ||
3205 | } | ||
3206 | |||
3207 | parse_DFS_referrals_exit: | ||
3208 | diff --git a/fs/eventpoll.c b/fs/eventpoll.c | ||
3209 | index ea54cde..4d9d3a4 100644 | ||
3210 | --- a/fs/eventpoll.c | ||
3211 | +++ b/fs/eventpoll.c | ||
3212 | @@ -988,6 +988,10 @@ static int path_count[PATH_ARR_SIZE]; | ||
3213 | |||
3214 | static int path_count_inc(int nests) | ||
3215 | { | ||
3216 | + /* Allow an arbitrary number of depth 1 paths */ | ||
3217 | + if (nests == 0) | ||
3218 | + return 0; | ||
3219 | + | ||
3220 | if (++path_count[nests] > path_limits[nests]) | ||
3221 | return -1; | ||
3222 | return 0; | ||
3223 | diff --git a/fs/exec.c b/fs/exec.c | ||
3224 | index 3625464..160cd2f 100644 | ||
3225 | --- a/fs/exec.c | ||
3226 | +++ b/fs/exec.c | ||
3227 | @@ -973,6 +973,9 @@ static int de_thread(struct task_struct *tsk) | ||
3228 | sig->notify_count = 0; | ||
3229 | |||
3230 | no_thread_group: | ||
3231 | + /* we have changed execution domain */ | ||
3232 | + tsk->exit_signal = SIGCHLD; | ||
3233 | + | ||
3234 | if (current->mm) | ||
3235 | setmax_mm_hiwater_rss(&sig->maxrss, current->mm); | ||
3236 | |||
3237 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c | ||
3238 | index c2a2012..54f2bdc 100644 | ||
3239 | --- a/fs/ext4/extents.c | ||
3240 | +++ b/fs/ext4/extents.c | ||
3241 | @@ -2812,7 +2812,7 @@ static int ext4_split_extent_at(handle_t *handle, | ||
3242 | if (err) | ||
3243 | goto fix_extent_len; | ||
3244 | /* update the extent length and mark as initialized */ | ||
3245 | - ex->ee_len = cpu_to_le32(ee_len); | ||
3246 | + ex->ee_len = cpu_to_le16(ee_len); | ||
3247 | ext4_ext_try_to_merge(inode, path, ex); | ||
3248 | err = ext4_ext_dirty(handle, inode, path + depth); | ||
3249 | goto out; | ||
3250 | diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c | ||
3251 | index 4dfbfec..ec2a9c2 100644 | ||
3252 | --- a/fs/hfsplus/catalog.c | ||
3253 | +++ b/fs/hfsplus/catalog.c | ||
3254 | @@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid, | ||
3255 | err = hfs_brec_find(&src_fd); | ||
3256 | if (err) | ||
3257 | goto out; | ||
3258 | + if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) { | ||
3259 | + err = -EIO; | ||
3260 | + goto out; | ||
3261 | + } | ||
3262 | |||
3263 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, | ||
3264 | src_fd.entrylength); | ||
3265 | diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c | ||
3266 | index 4536cd3..5adb740 100644 | ||
3267 | --- a/fs/hfsplus/dir.c | ||
3268 | +++ b/fs/hfsplus/dir.c | ||
3269 | @@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | ||
3270 | filp->f_pos++; | ||
3271 | /* fall through */ | ||
3272 | case 1: | ||
3273 | + if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
3274 | + err = -EIO; | ||
3275 | + goto out; | ||
3276 | + } | ||
3277 | + | ||
3278 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | ||
3279 | fd.entrylength); | ||
3280 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { | ||
3281 | @@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | ||
3282 | err = -EIO; | ||
3283 | goto out; | ||
3284 | } | ||
3285 | + | ||
3286 | + if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
3287 | + err = -EIO; | ||
3288 | + goto out; | ||
3289 | + } | ||
3290 | + | ||
3291 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | ||
3292 | fd.entrylength); | ||
3293 | type = be16_to_cpu(entry.type); | ||
3294 | diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c | ||
3295 | index 68d704d..d751f04 100644 | ||
3296 | --- a/fs/jbd2/commit.c | ||
3297 | +++ b/fs/jbd2/commit.c | ||
3298 | @@ -683,7 +683,7 @@ start_journal_io: | ||
3299 | if (commit_transaction->t_need_data_flush && | ||
3300 | (journal->j_fs_dev != journal->j_dev) && | ||
3301 | (journal->j_flags & JBD2_BARRIER)) | ||
3302 | - blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); | ||
3303 | + blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); | ||
3304 | |||
3305 | /* Done it all: now write the commit record asynchronously. */ | ||
3306 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | ||
3307 | @@ -819,7 +819,7 @@ wait_for_iobuf: | ||
3308 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | ||
3309 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | ||
3310 | journal->j_flags & JBD2_BARRIER) { | ||
3311 | - blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL); | ||
3312 | + blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); | ||
3313 | } | ||
3314 | |||
3315 | if (err) | ||
3316 | diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c | ||
3317 | index f848b52..046bb77 100644 | ||
3318 | --- a/fs/lockd/clnt4xdr.c | ||
3319 | +++ b/fs/lockd/clnt4xdr.c | ||
3320 | @@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat) | ||
3321 | p = xdr_inline_decode(xdr, 4); | ||
3322 | if (unlikely(p == NULL)) | ||
3323 | goto out_overflow; | ||
3324 | - if (unlikely(*p > nlm4_failed)) | ||
3325 | + if (unlikely(ntohl(*p) > ntohl(nlm4_failed))) | ||
3326 | goto out_bad_xdr; | ||
3327 | *stat = *p; | ||
3328 | return 0; | ||
3329 | diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c | ||
3330 | index 180ac34..36057ce 100644 | ||
3331 | --- a/fs/lockd/clntxdr.c | ||
3332 | +++ b/fs/lockd/clntxdr.c | ||
3333 | @@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr, | ||
3334 | p = xdr_inline_decode(xdr, 4); | ||
3335 | if (unlikely(p == NULL)) | ||
3336 | goto out_overflow; | ||
3337 | - if (unlikely(*p > nlm_lck_denied_grace_period)) | ||
3338 | + if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period))) | ||
3339 | goto out_enum; | ||
3340 | *stat = *p; | ||
3341 | return 0; | ||
3342 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
3343 | index 757293b..51f6a40 100644 | ||
3344 | --- a/fs/nfs/nfs4proc.c | ||
3345 | +++ b/fs/nfs/nfs4proc.c | ||
3346 | @@ -4453,7 +4453,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | ||
3347 | static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) | ||
3348 | { | ||
3349 | struct nfs_server *server = NFS_SERVER(state->inode); | ||
3350 | - struct nfs4_exception exception = { }; | ||
3351 | + struct nfs4_exception exception = { | ||
3352 | + .inode = state->inode, | ||
3353 | + }; | ||
3354 | int err; | ||
3355 | |||
3356 | do { | ||
3357 | @@ -4471,7 +4473,9 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request | ||
3358 | static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) | ||
3359 | { | ||
3360 | struct nfs_server *server = NFS_SERVER(state->inode); | ||
3361 | - struct nfs4_exception exception = { }; | ||
3362 | + struct nfs4_exception exception = { | ||
3363 | + .inode = state->inode, | ||
3364 | + }; | ||
3365 | int err; | ||
3366 | |||
3367 | err = nfs4_set_lock_state(state, request); | ||
3368 | @@ -4551,6 +4555,7 @@ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock * | ||
3369 | { | ||
3370 | struct nfs4_exception exception = { | ||
3371 | .state = state, | ||
3372 | + .inode = state->inode, | ||
3373 | }; | ||
3374 | int err; | ||
3375 | |||
3376 | @@ -4596,6 +4601,20 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) | ||
3377 | |||
3378 | if (state == NULL) | ||
3379 | return -ENOLCK; | ||
3380 | + /* | ||
3381 | + * Don't rely on the VFS having checked the file open mode, | ||
3382 | + * since it won't do this for flock() locks. | ||
3383 | + */ | ||
3384 | + switch (request->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) { | ||
3385 | + case F_RDLCK: | ||
3386 | + if (!(filp->f_mode & FMODE_READ)) | ||
3387 | + return -EBADF; | ||
3388 | + break; | ||
3389 | + case F_WRLCK: | ||
3390 | + if (!(filp->f_mode & FMODE_WRITE)) | ||
3391 | + return -EBADF; | ||
3392 | + } | ||
3393 | + | ||
3394 | do { | ||
3395 | status = nfs4_proc_setlk(state, cmd, request); | ||
3396 | if ((status != -EAGAIN) || IS_SETLK(cmd)) | ||
3397 | diff --git a/fs/nfs/read.c b/fs/nfs/read.c | ||
3398 | index cfa175c..41bae32 100644 | ||
3399 | --- a/fs/nfs/read.c | ||
3400 | +++ b/fs/nfs/read.c | ||
3401 | @@ -324,7 +324,7 @@ out_bad: | ||
3402 | while (!list_empty(res)) { | ||
3403 | data = list_entry(res->next, struct nfs_read_data, list); | ||
3404 | list_del(&data->list); | ||
3405 | - nfs_readdata_free(data); | ||
3406 | + nfs_readdata_release(data); | ||
3407 | } | ||
3408 | nfs_readpage_release(req); | ||
3409 | return -ENOMEM; | ||
3410 | diff --git a/fs/nfs/super.c b/fs/nfs/super.c | ||
3411 | index 3ada13c..376cd65 100644 | ||
3412 | --- a/fs/nfs/super.c | ||
3413 | +++ b/fs/nfs/super.c | ||
3414 | @@ -2708,11 +2708,15 @@ static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type, | ||
3415 | char *root_devname; | ||
3416 | size_t len; | ||
3417 | |||
3418 | - len = strlen(hostname) + 3; | ||
3419 | + len = strlen(hostname) + 5; | ||
3420 | root_devname = kmalloc(len, GFP_KERNEL); | ||
3421 | if (root_devname == NULL) | ||
3422 | return ERR_PTR(-ENOMEM); | ||
3423 | - snprintf(root_devname, len, "%s:/", hostname); | ||
3424 | + /* Does hostname needs to be enclosed in brackets? */ | ||
3425 | + if (strchr(hostname, ':')) | ||
3426 | + snprintf(root_devname, len, "[%s]:/", hostname); | ||
3427 | + else | ||
3428 | + snprintf(root_devname, len, "%s:/", hostname); | ||
3429 | root_mnt = vfs_kern_mount(fs_type, flags, root_devname, data); | ||
3430 | kfree(root_devname); | ||
3431 | return root_mnt; | ||
3432 | diff --git a/fs/nfs/write.c b/fs/nfs/write.c | ||
3433 | index 1dda78d..4efd421 100644 | ||
3434 | --- a/fs/nfs/write.c | ||
3435 | +++ b/fs/nfs/write.c | ||
3436 | @@ -974,7 +974,7 @@ out_bad: | ||
3437 | while (!list_empty(res)) { | ||
3438 | data = list_entry(res->next, struct nfs_write_data, list); | ||
3439 | list_del(&data->list); | ||
3440 | - nfs_writedata_free(data); | ||
3441 | + nfs_writedata_release(data); | ||
3442 | } | ||
3443 | nfs_redirty_request(req); | ||
3444 | return -ENOMEM; | ||
3445 | diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c | ||
3446 | index 08c6e36..43f46cd 100644 | ||
3447 | --- a/fs/nfsd/nfs3xdr.c | ||
3448 | +++ b/fs/nfsd/nfs3xdr.c | ||
3449 | @@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, | ||
3450 | return p; | ||
3451 | } | ||
3452 | |||
3453 | -static int | ||
3454 | +static __be32 | ||
3455 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | ||
3456 | const char *name, int namlen) | ||
3457 | { | ||
3458 | struct svc_export *exp; | ||
3459 | struct dentry *dparent, *dchild; | ||
3460 | - int rv = 0; | ||
3461 | + __be32 rv = nfserr_noent; | ||
3462 | |||
3463 | dparent = cd->fh.fh_dentry; | ||
3464 | exp = cd->fh.fh_export; | ||
3465 | @@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | ||
3466 | if (isdotent(name, namlen)) { | ||
3467 | if (namlen == 2) { | ||
3468 | dchild = dget_parent(dparent); | ||
3469 | - if (dchild == dparent) { | ||
3470 | - /* filesystem root - cannot return filehandle for ".." */ | ||
3471 | - dput(dchild); | ||
3472 | - return -ENOENT; | ||
3473 | - } | ||
3474 | + /* filesystem root - cannot return filehandle for ".." */ | ||
3475 | + if (dchild == dparent) | ||
3476 | + goto out; | ||
3477 | } else | ||
3478 | dchild = dget(dparent); | ||
3479 | } else | ||
3480 | dchild = lookup_one_len(name, dparent, namlen); | ||
3481 | if (IS_ERR(dchild)) | ||
3482 | - return -ENOENT; | ||
3483 | - rv = -ENOENT; | ||
3484 | + return rv; | ||
3485 | if (d_mountpoint(dchild)) | ||
3486 | goto out; | ||
3487 | - rv = fh_compose(fhp, exp, dchild, &cd->fh); | ||
3488 | - if (rv) | ||
3489 | - goto out; | ||
3490 | if (!dchild->d_inode) | ||
3491 | goto out; | ||
3492 | - rv = 0; | ||
3493 | + rv = fh_compose(fhp, exp, dchild, &cd->fh); | ||
3494 | out: | ||
3495 | dput(dchild); | ||
3496 | return rv; | ||
3497 | @@ -845,7 +839,7 @@ out: | ||
3498 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) | ||
3499 | { | ||
3500 | struct svc_fh fh; | ||
3501 | - int err; | ||
3502 | + __be32 err; | ||
3503 | |||
3504 | fh_init(&fh, NFS3_FHSIZE); | ||
3505 | err = compose_entry_fh(cd, &fh, name, namlen); | ||
3506 | diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c | ||
3507 | index fa38336..b8c5538 100644 | ||
3508 | --- a/fs/nfsd/nfs4proc.c | ||
3509 | +++ b/fs/nfsd/nfs4proc.c | ||
3510 | @@ -231,17 +231,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | ||
3511 | */ | ||
3512 | if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) | ||
3513 | open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | | ||
3514 | - FATTR4_WORD1_TIME_MODIFY); | ||
3515 | + FATTR4_WORD1_TIME_MODIFY); | ||
3516 | } else { | ||
3517 | status = nfsd_lookup(rqstp, current_fh, | ||
3518 | open->op_fname.data, open->op_fname.len, &resfh); | ||
3519 | fh_unlock(current_fh); | ||
3520 | - if (status) | ||
3521 | - goto out; | ||
3522 | - status = nfsd_check_obj_isreg(&resfh); | ||
3523 | } | ||
3524 | if (status) | ||
3525 | goto out; | ||
3526 | + status = nfsd_check_obj_isreg(&resfh); | ||
3527 | + if (status) | ||
3528 | + goto out; | ||
3529 | |||
3530 | if (is_create_with_attrs(open) && open->op_acl != NULL) | ||
3531 | do_set_nfs4_acl(rqstp, &resfh, open->op_acl, open->op_bmval); | ||
3532 | @@ -827,6 +827,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | ||
3533 | struct nfsd4_setattr *setattr) | ||
3534 | { | ||
3535 | __be32 status = nfs_ok; | ||
3536 | + int err; | ||
3537 | |||
3538 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { | ||
3539 | nfs4_lock_state(); | ||
3540 | @@ -838,9 +839,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | ||
3541 | return status; | ||
3542 | } | ||
3543 | } | ||
3544 | - status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt); | ||
3545 | - if (status) | ||
3546 | - return status; | ||
3547 | + err = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt); | ||
3548 | + if (err) | ||
3549 | + return nfserrno(err); | ||
3550 | status = nfs_ok; | ||
3551 | |||
3552 | status = check_attr_support(rqstp, cstate, setattr->sa_bmval, | ||
3553 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c | ||
3554 | index 5abced7..4cfe260 100644 | ||
3555 | --- a/fs/nfsd/nfs4state.c | ||
3556 | +++ b/fs/nfsd/nfs4state.c | ||
3557 | @@ -4080,16 +4080,14 @@ out: | ||
3558 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an | ||
3559 | * inode operation.) | ||
3560 | */ | ||
3561 | -static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) | ||
3562 | +static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) | ||
3563 | { | ||
3564 | struct file *file; | ||
3565 | - int err; | ||
3566 | - | ||
3567 | - err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); | ||
3568 | - if (err) | ||
3569 | - return err; | ||
3570 | - err = vfs_test_lock(file, lock); | ||
3571 | - nfsd_close(file); | ||
3572 | + __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); | ||
3573 | + if (!err) { | ||
3574 | + err = nfserrno(vfs_test_lock(file, lock)); | ||
3575 | + nfsd_close(file); | ||
3576 | + } | ||
3577 | return err; | ||
3578 | } | ||
3579 | |||
3580 | @@ -4103,7 +4101,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | ||
3581 | struct inode *inode; | ||
3582 | struct file_lock file_lock; | ||
3583 | struct nfs4_lockowner *lo; | ||
3584 | - int error; | ||
3585 | __be32 status; | ||
3586 | |||
3587 | if (locks_in_grace()) | ||
3588 | @@ -4149,12 +4146,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | ||
3589 | |||
3590 | nfs4_transform_lock_offset(&file_lock); | ||
3591 | |||
3592 | - status = nfs_ok; | ||
3593 | - error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); | ||
3594 | - if (error) { | ||
3595 | - status = nfserrno(error); | ||
3596 | + status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); | ||
3597 | + if (status) | ||
3598 | goto out; | ||
3599 | - } | ||
3600 | + | ||
3601 | if (file_lock.fl_type != F_UNLCK) { | ||
3602 | status = nfserr_denied; | ||
3603 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); | ||
3604 | diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c | ||
3605 | index b6fa792..9cfa60a 100644 | ||
3606 | --- a/fs/nfsd/nfs4xdr.c | ||
3607 | +++ b/fs/nfsd/nfs4xdr.c | ||
3608 | @@ -3411,7 +3411,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr, | ||
3609 | nfsd4_decode_stateid(argp, &si); | ||
3610 | valid = nfs4_validate_stateid(cl, &si); | ||
3611 | RESERVE_SPACE(4); | ||
3612 | - *p++ = htonl(valid); | ||
3613 | + *p++ = valid; | ||
3614 | resp->p = p; | ||
3615 | } | ||
3616 | nfs4_unlock_state(); | ||
3617 | diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c | ||
3618 | index 7a2e442..5c3cd82 100644 | ||
3619 | --- a/fs/nfsd/vfs.c | ||
3620 | +++ b/fs/nfsd/vfs.c | ||
3621 | @@ -1439,7 +1439,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | ||
3622 | switch (createmode) { | ||
3623 | case NFS3_CREATE_UNCHECKED: | ||
3624 | if (! S_ISREG(dchild->d_inode->i_mode)) | ||
3625 | - err = nfserr_exist; | ||
3626 | + goto out; | ||
3627 | else if (truncp) { | ||
3628 | /* in nfsv4, we need to treat this case a little | ||
3629 | * differently. we don't want to truncate the | ||
3630 | diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c | ||
3631 | index 3165aeb..31b9463 100644 | ||
3632 | --- a/fs/ocfs2/alloc.c | ||
3633 | +++ b/fs/ocfs2/alloc.c | ||
3634 | @@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle, | ||
3635 | } | ||
3636 | |||
3637 | el = path_leaf_el(path); | ||
3638 | - rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1]; | ||
3639 | + rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1]; | ||
3640 | |||
3641 | ocfs2_adjust_rightmost_records(handle, et, path, rec); | ||
3642 | |||
3643 | diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c | ||
3644 | index cf78233..9f32d7c 100644 | ||
3645 | --- a/fs/ocfs2/refcounttree.c | ||
3646 | +++ b/fs/ocfs2/refcounttree.c | ||
3647 | @@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci, | ||
3648 | |||
3649 | tmp_el = left_path->p_node[subtree_root].el; | ||
3650 | blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; | ||
3651 | - for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { | ||
3652 | + for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) { | ||
3653 | if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { | ||
3654 | *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); | ||
3655 | break; | ||
3656 | } | ||
3657 | } | ||
3658 | |||
3659 | - BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); | ||
3660 | + BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec)); | ||
3661 | |||
3662 | out: | ||
3663 | ocfs2_free_path(left_path); | ||
3664 | @@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh, | ||
3665 | |||
3666 | trace_ocfs2_divide_leaf_refcount_block( | ||
3667 | (unsigned long long)ref_leaf_bh->b_blocknr, | ||
3668 | - le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); | ||
3669 | + le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used)); | ||
3670 | |||
3671 | /* | ||
3672 | * XXX: Improvement later. | ||
3673 | @@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | ||
3674 | rb = (struct ocfs2_refcount_block *) | ||
3675 | prev_bh->b_data; | ||
3676 | |||
3677 | - if (le64_to_cpu(rb->rf_records.rl_used) + | ||
3678 | + if (le16_to_cpu(rb->rf_records.rl_used) + | ||
3679 | recs_add > | ||
3680 | le16_to_cpu(rb->rf_records.rl_count)) | ||
3681 | ref_blocks++; | ||
3682 | @@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | ||
3683 | if (prev_bh) { | ||
3684 | rb = (struct ocfs2_refcount_block *)prev_bh->b_data; | ||
3685 | |||
3686 | - if (le64_to_cpu(rb->rf_records.rl_used) + recs_add > | ||
3687 | + if (le16_to_cpu(rb->rf_records.rl_used) + recs_add > | ||
3688 | le16_to_cpu(rb->rf_records.rl_count)) | ||
3689 | ref_blocks++; | ||
3690 | |||
3691 | @@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode, | ||
3692 | * one will split a refcount rec, so totally we need | ||
3693 | * clusters * 2 new refcount rec. | ||
3694 | */ | ||
3695 | - if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 > | ||
3696 | + if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 > | ||
3697 | le16_to_cpu(rb->rf_records.rl_count)) | ||
3698 | ref_blocks++; | ||
3699 | |||
3700 | diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c | ||
3701 | index ba5d97e..f169da4 100644 | ||
3702 | --- a/fs/ocfs2/suballoc.c | ||
3703 | +++ b/fs/ocfs2/suballoc.c | ||
3704 | @@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle, | ||
3705 | ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, | ||
3706 | cluster_ac->ac_bh, | ||
3707 | le64_to_cpu(rec->e_blkno), | ||
3708 | - le32_to_cpu(rec->e_leaf_clusters)); | ||
3709 | + le16_to_cpu(rec->e_leaf_clusters)); | ||
3710 | if (ret) | ||
3711 | mlog_errno(ret); | ||
3712 | /* Try all the clusters to free */ | ||
3713 | @@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res, | ||
3714 | { | ||
3715 | unsigned int bpc = le16_to_cpu(cl->cl_bpc); | ||
3716 | unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; | ||
3717 | - unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc; | ||
3718 | + unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc; | ||
3719 | |||
3720 | if (res->sr_bit_offset < bitoff) | ||
3721 | return 0; | ||
3722 | diff --git a/fs/pipe.c b/fs/pipe.c | ||
3723 | index 4065f07..05ed5ca 100644 | ||
3724 | --- a/fs/pipe.c | ||
3725 | +++ b/fs/pipe.c | ||
3726 | @@ -345,6 +345,16 @@ static const struct pipe_buf_operations anon_pipe_buf_ops = { | ||
3727 | .get = generic_pipe_buf_get, | ||
3728 | }; | ||
3729 | |||
3730 | +static const struct pipe_buf_operations packet_pipe_buf_ops = { | ||
3731 | + .can_merge = 0, | ||
3732 | + .map = generic_pipe_buf_map, | ||
3733 | + .unmap = generic_pipe_buf_unmap, | ||
3734 | + .confirm = generic_pipe_buf_confirm, | ||
3735 | + .release = anon_pipe_buf_release, | ||
3736 | + .steal = generic_pipe_buf_steal, | ||
3737 | + .get = generic_pipe_buf_get, | ||
3738 | +}; | ||
3739 | + | ||
3740 | static ssize_t | ||
3741 | pipe_read(struct kiocb *iocb, const struct iovec *_iov, | ||
3742 | unsigned long nr_segs, loff_t pos) | ||
3743 | @@ -406,6 +416,13 @@ redo: | ||
3744 | ret += chars; | ||
3745 | buf->offset += chars; | ||
3746 | buf->len -= chars; | ||
3747 | + | ||
3748 | + /* Was it a packet buffer? Clean up and exit */ | ||
3749 | + if (buf->flags & PIPE_BUF_FLAG_PACKET) { | ||
3750 | + total_len = chars; | ||
3751 | + buf->len = 0; | ||
3752 | + } | ||
3753 | + | ||
3754 | if (!buf->len) { | ||
3755 | buf->ops = NULL; | ||
3756 | ops->release(pipe, buf); | ||
3757 | @@ -458,6 +475,11 @@ redo: | ||
3758 | return ret; | ||
3759 | } | ||
3760 | |||
3761 | +static inline int is_packetized(struct file *file) | ||
3762 | +{ | ||
3763 | + return (file->f_flags & O_DIRECT) != 0; | ||
3764 | +} | ||
3765 | + | ||
3766 | static ssize_t | ||
3767 | pipe_write(struct kiocb *iocb, const struct iovec *_iov, | ||
3768 | unsigned long nr_segs, loff_t ppos) | ||
3769 | @@ -592,6 +614,11 @@ redo2: | ||
3770 | buf->ops = &anon_pipe_buf_ops; | ||
3771 | buf->offset = 0; | ||
3772 | buf->len = chars; | ||
3773 | + buf->flags = 0; | ||
3774 | + if (is_packetized(filp)) { | ||
3775 | + buf->ops = &packet_pipe_buf_ops; | ||
3776 | + buf->flags = PIPE_BUF_FLAG_PACKET; | ||
3777 | + } | ||
3778 | pipe->nrbufs = ++bufs; | ||
3779 | pipe->tmp_page = NULL; | ||
3780 | |||
3781 | @@ -1012,7 +1039,7 @@ struct file *create_write_pipe(int flags) | ||
3782 | goto err_dentry; | ||
3783 | f->f_mapping = inode->i_mapping; | ||
3784 | |||
3785 | - f->f_flags = O_WRONLY | (flags & O_NONBLOCK); | ||
3786 | + f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); | ||
3787 | f->f_version = 0; | ||
3788 | |||
3789 | return f; | ||
3790 | @@ -1056,7 +1083,7 @@ int do_pipe_flags(int *fd, int flags) | ||
3791 | int error; | ||
3792 | int fdw, fdr; | ||
3793 | |||
3794 | - if (flags & ~(O_CLOEXEC | O_NONBLOCK)) | ||
3795 | + if (flags & ~(O_CLOEXEC | O_NONBLOCK | O_DIRECT)) | ||
3796 | return -EINVAL; | ||
3797 | |||
3798 | fw = create_write_pipe(flags); | ||
3799 | diff --git a/fs/splice.c b/fs/splice.c | ||
3800 | index fa2defa..6d0dfb8 100644 | ||
3801 | --- a/fs/splice.c | ||
3802 | +++ b/fs/splice.c | ||
3803 | @@ -31,6 +31,7 @@ | ||
3804 | #include <linux/uio.h> | ||
3805 | #include <linux/security.h> | ||
3806 | #include <linux/gfp.h> | ||
3807 | +#include <linux/socket.h> | ||
3808 | |||
3809 | /* | ||
3810 | * Attempt to steal a page from a pipe buffer. This should perhaps go into | ||
3811 | @@ -691,7 +692,9 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, | ||
3812 | if (!likely(file->f_op && file->f_op->sendpage)) | ||
3813 | return -EINVAL; | ||
3814 | |||
3815 | - more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len; | ||
3816 | + more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; | ||
3817 | + if (sd->len < sd->total_len) | ||
3818 | + more |= MSG_SENDPAGE_NOTLAST; | ||
3819 | return file->f_op->sendpage(file, buf->page, buf->offset, | ||
3820 | sd->len, &pos, more); | ||
3821 | } | ||
3822 | diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h | ||
3823 | index 0fd28e0..c749af9 100644 | ||
3824 | --- a/include/asm-generic/statfs.h | ||
3825 | +++ b/include/asm-generic/statfs.h | ||
3826 | @@ -15,7 +15,7 @@ typedef __kernel_fsid_t fsid_t; | ||
3827 | * with a 10' pole. | ||
3828 | */ | ||
3829 | #ifndef __statfs_word | ||
3830 | -#if BITS_PER_LONG == 64 | ||
3831 | +#if __BITS_PER_LONG == 64 | ||
3832 | #define __statfs_word long | ||
3833 | #else | ||
3834 | #define __statfs_word __u32 | ||
3835 | diff --git a/include/linux/efi.h b/include/linux/efi.h | ||
3836 | index 2362a0b..1328d8c 100644 | ||
3837 | --- a/include/linux/efi.h | ||
3838 | +++ b/include/linux/efi.h | ||
3839 | @@ -383,7 +383,18 @@ extern int __init efi_setup_pcdp_console(char *); | ||
3840 | #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 | ||
3841 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 | ||
3842 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 | ||
3843 | - | ||
3844 | +#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008 | ||
3845 | +#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010 | ||
3846 | +#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020 | ||
3847 | +#define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040 | ||
3848 | + | ||
3849 | +#define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \ | ||
3850 | + EFI_VARIABLE_BOOTSERVICE_ACCESS | \ | ||
3851 | + EFI_VARIABLE_RUNTIME_ACCESS | \ | ||
3852 | + EFI_VARIABLE_HARDWARE_ERROR_RECORD | \ | ||
3853 | + EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \ | ||
3854 | + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ | ||
3855 | + EFI_VARIABLE_APPEND_WRITE) | ||
3856 | /* | ||
3857 | * EFI Device Path information | ||
3858 | */ | ||
3859 | diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h | ||
3860 | index d526231..35410ef 100644 | ||
3861 | --- a/include/linux/kvm_host.h | ||
3862 | +++ b/include/linux/kvm_host.h | ||
3863 | @@ -562,6 +562,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | ||
3864 | |||
3865 | #ifdef CONFIG_IOMMU_API | ||
3866 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | ||
3867 | +void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | ||
3868 | int kvm_iommu_map_guest(struct kvm *kvm); | ||
3869 | int kvm_iommu_unmap_guest(struct kvm *kvm); | ||
3870 | int kvm_assign_device(struct kvm *kvm, | ||
3871 | @@ -575,6 +576,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm, | ||
3872 | return 0; | ||
3873 | } | ||
3874 | |||
3875 | +static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | ||
3876 | + struct kvm_memory_slot *slot) | ||
3877 | +{ | ||
3878 | +} | ||
3879 | + | ||
3880 | static inline int kvm_iommu_map_guest(struct kvm *kvm) | ||
3881 | { | ||
3882 | return -ENODEV; | ||
3883 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h | ||
3884 | index a82ad4d..cbeb586 100644 | ||
3885 | --- a/include/linux/netdevice.h | ||
3886 | +++ b/include/linux/netdevice.h | ||
3887 | @@ -2536,8 +2536,6 @@ extern void net_disable_timestamp(void); | ||
3888 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | ||
3889 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | ||
3890 | extern void dev_seq_stop(struct seq_file *seq, void *v); | ||
3891 | -extern int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
3892 | - const struct seq_operations *ops); | ||
3893 | #endif | ||
3894 | |||
3895 | extern int netdev_class_create_file(struct class_attribute *class_attr); | ||
3896 | diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h | ||
3897 | index 77257c9..0072a53 100644 | ||
3898 | --- a/include/linux/pipe_fs_i.h | ||
3899 | +++ b/include/linux/pipe_fs_i.h | ||
3900 | @@ -8,6 +8,7 @@ | ||
3901 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ | ||
3902 | #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ | ||
3903 | #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */ | ||
3904 | +#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */ | ||
3905 | |||
3906 | /** | ||
3907 | * struct pipe_buffer - a linux kernel pipe buffer | ||
3908 | diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h | ||
3909 | index c6db9fb..bb1fac5 100644 | ||
3910 | --- a/include/linux/seqlock.h | ||
3911 | +++ b/include/linux/seqlock.h | ||
3912 | @@ -141,7 +141,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s) | ||
3913 | unsigned ret; | ||
3914 | |||
3915 | repeat: | ||
3916 | - ret = s->sequence; | ||
3917 | + ret = ACCESS_ONCE(s->sequence); | ||
3918 | if (unlikely(ret & 1)) { | ||
3919 | cpu_relax(); | ||
3920 | goto repeat; | ||
3921 | diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h | ||
3922 | index 6cf8b53..e689b47 100644 | ||
3923 | --- a/include/linux/skbuff.h | ||
3924 | +++ b/include/linux/skbuff.h | ||
3925 | @@ -458,6 +458,7 @@ struct sk_buff { | ||
3926 | union { | ||
3927 | __u32 mark; | ||
3928 | __u32 dropcount; | ||
3929 | + __u32 avail_size; | ||
3930 | }; | ||
3931 | |||
3932 | __u16 vlan_tci; | ||
3933 | @@ -1326,6 +1327,18 @@ static inline int skb_tailroom(const struct sk_buff *skb) | ||
3934 | } | ||
3935 | |||
3936 | /** | ||
3937 | + * skb_availroom - bytes at buffer end | ||
3938 | + * @skb: buffer to check | ||
3939 | + * | ||
3940 | + * Return the number of bytes of free space at the tail of an sk_buff | ||
3941 | + * allocated by sk_stream_alloc() | ||
3942 | + */ | ||
3943 | +static inline int skb_availroom(const struct sk_buff *skb) | ||
3944 | +{ | ||
3945 | + return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; | ||
3946 | +} | ||
3947 | + | ||
3948 | +/** | ||
3949 | * skb_reserve - adjust headroom | ||
3950 | * @skb: buffer to alter | ||
3951 | * @len: bytes to move | ||
3952 | diff --git a/include/linux/socket.h b/include/linux/socket.h | ||
3953 | index d0e77f6..ad919e0 100644 | ||
3954 | --- a/include/linux/socket.h | ||
3955 | +++ b/include/linux/socket.h | ||
3956 | @@ -265,7 +265,7 @@ struct ucred { | ||
3957 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ | ||
3958 | #define MSG_MORE 0x8000 /* Sender will send more */ | ||
3959 | #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ | ||
3960 | - | ||
3961 | +#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */ | ||
3962 | #define MSG_EOF MSG_FIN | ||
3963 | |||
3964 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file | ||
3965 | diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h | ||
3966 | index 03354d5..64cec8d 100644 | ||
3967 | --- a/include/linux/usb/hcd.h | ||
3968 | +++ b/include/linux/usb/hcd.h | ||
3969 | @@ -128,6 +128,8 @@ struct usb_hcd { | ||
3970 | unsigned wireless:1; /* Wireless USB HCD */ | ||
3971 | unsigned authorized_default:1; | ||
3972 | unsigned has_tt:1; /* Integrated TT in root hub */ | ||
3973 | + unsigned broken_pci_sleep:1; /* Don't put the | ||
3974 | + controller in PCI-D3 for system sleep */ | ||
3975 | |||
3976 | int irq; /* irq allocated */ | ||
3977 | void __iomem *regs; /* device memory/io */ | ||
3978 | diff --git a/kernel/exit.c b/kernel/exit.c | ||
3979 | index e6e01b9..5a8a66e 100644 | ||
3980 | --- a/kernel/exit.c | ||
3981 | +++ b/kernel/exit.c | ||
3982 | @@ -819,25 +819,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead) | ||
3983 | if (group_dead) | ||
3984 | kill_orphaned_pgrp(tsk->group_leader, NULL); | ||
3985 | |||
3986 | - /* Let father know we died | ||
3987 | - * | ||
3988 | - * Thread signals are configurable, but you aren't going to use | ||
3989 | - * that to send signals to arbitrary processes. | ||
3990 | - * That stops right now. | ||
3991 | - * | ||
3992 | - * If the parent exec id doesn't match the exec id we saved | ||
3993 | - * when we started then we know the parent has changed security | ||
3994 | - * domain. | ||
3995 | - * | ||
3996 | - * If our self_exec id doesn't match our parent_exec_id then | ||
3997 | - * we have changed execution domain as these two values started | ||
3998 | - * the same after a fork. | ||
3999 | - */ | ||
4000 | - if (thread_group_leader(tsk) && tsk->exit_signal != SIGCHLD && | ||
4001 | - (tsk->parent_exec_id != tsk->real_parent->self_exec_id || | ||
4002 | - tsk->self_exec_id != tsk->parent_exec_id)) | ||
4003 | - tsk->exit_signal = SIGCHLD; | ||
4004 | - | ||
4005 | if (unlikely(tsk->ptrace)) { | ||
4006 | int sig = thread_group_leader(tsk) && | ||
4007 | thread_group_empty(tsk) && | ||
4008 | diff --git a/kernel/power/swap.c b/kernel/power/swap.c | ||
4009 | index 11a594c..b313086 100644 | ||
4010 | --- a/kernel/power/swap.c | ||
4011 | +++ b/kernel/power/swap.c | ||
4012 | @@ -52,6 +52,23 @@ | ||
4013 | |||
4014 | #define MAP_PAGE_ENTRIES (PAGE_SIZE / sizeof(sector_t) - 1) | ||
4015 | |||
4016 | +/* | ||
4017 | + * Number of free pages that are not high. | ||
4018 | + */ | ||
4019 | +static inline unsigned long low_free_pages(void) | ||
4020 | +{ | ||
4021 | + return nr_free_pages() - nr_free_highpages(); | ||
4022 | +} | ||
4023 | + | ||
4024 | +/* | ||
4025 | + * Number of pages required to be kept free while writing the image. Always | ||
4026 | + * half of all available low pages before the writing starts. | ||
4027 | + */ | ||
4028 | +static inline unsigned long reqd_free_pages(void) | ||
4029 | +{ | ||
4030 | + return low_free_pages() / 2; | ||
4031 | +} | ||
4032 | + | ||
4033 | struct swap_map_page { | ||
4034 | sector_t entries[MAP_PAGE_ENTRIES]; | ||
4035 | sector_t next_swap; | ||
4036 | @@ -73,7 +90,7 @@ struct swap_map_handle { | ||
4037 | sector_t cur_swap; | ||
4038 | sector_t first_sector; | ||
4039 | unsigned int k; | ||
4040 | - unsigned long nr_free_pages, written; | ||
4041 | + unsigned long reqd_free_pages; | ||
4042 | u32 crc32; | ||
4043 | }; | ||
4044 | |||
4045 | @@ -317,8 +334,7 @@ static int get_swap_writer(struct swap_map_handle *handle) | ||
4046 | goto err_rel; | ||
4047 | } | ||
4048 | handle->k = 0; | ||
4049 | - handle->nr_free_pages = nr_free_pages() >> 1; | ||
4050 | - handle->written = 0; | ||
4051 | + handle->reqd_free_pages = reqd_free_pages(); | ||
4052 | handle->first_sector = handle->cur_swap; | ||
4053 | return 0; | ||
4054 | err_rel: | ||
4055 | @@ -353,11 +369,11 @@ static int swap_write_page(struct swap_map_handle *handle, void *buf, | ||
4056 | handle->cur_swap = offset; | ||
4057 | handle->k = 0; | ||
4058 | } | ||
4059 | - if (bio_chain && ++handle->written > handle->nr_free_pages) { | ||
4060 | + if (bio_chain && low_free_pages() <= handle->reqd_free_pages) { | ||
4061 | error = hib_wait_on_bio_chain(bio_chain); | ||
4062 | if (error) | ||
4063 | goto out; | ||
4064 | - handle->written = 0; | ||
4065 | + handle->reqd_free_pages = reqd_free_pages(); | ||
4066 | } | ||
4067 | out: | ||
4068 | return error; | ||
4069 | @@ -619,7 +635,7 @@ static int save_image_lzo(struct swap_map_handle *handle, | ||
4070 | * Adjust number of free pages after all allocations have been done. | ||
4071 | * We don't want to run out of pages when writing. | ||
4072 | */ | ||
4073 | - handle->nr_free_pages = nr_free_pages() >> 1; | ||
4074 | + handle->reqd_free_pages = reqd_free_pages(); | ||
4075 | |||
4076 | /* | ||
4077 | * Start the CRC32 thread. | ||
4078 | diff --git a/kernel/sched.c b/kernel/sched.c | ||
4079 | index d6b149c..299f55c 100644 | ||
4080 | --- a/kernel/sched.c | ||
4081 | +++ b/kernel/sched.c | ||
4082 | @@ -3538,13 +3538,10 @@ calc_load_n(unsigned long load, unsigned long exp, | ||
4083 | * Once we've updated the global active value, we need to apply the exponential | ||
4084 | * weights adjusted to the number of cycles missed. | ||
4085 | */ | ||
4086 | -static void calc_global_nohz(unsigned long ticks) | ||
4087 | +static void calc_global_nohz(void) | ||
4088 | { | ||
4089 | long delta, active, n; | ||
4090 | |||
4091 | - if (time_before(jiffies, calc_load_update)) | ||
4092 | - return; | ||
4093 | - | ||
4094 | /* | ||
4095 | * If we crossed a calc_load_update boundary, make sure to fold | ||
4096 | * any pending idle changes, the respective CPUs might have | ||
4097 | @@ -3556,31 +3553,25 @@ static void calc_global_nohz(unsigned long ticks) | ||
4098 | atomic_long_add(delta, &calc_load_tasks); | ||
4099 | |||
4100 | /* | ||
4101 | - * If we were idle for multiple load cycles, apply them. | ||
4102 | + * It could be the one fold was all it took, we done! | ||
4103 | */ | ||
4104 | - if (ticks >= LOAD_FREQ) { | ||
4105 | - n = ticks / LOAD_FREQ; | ||
4106 | + if (time_before(jiffies, calc_load_update + 10)) | ||
4107 | + return; | ||
4108 | |||
4109 | - active = atomic_long_read(&calc_load_tasks); | ||
4110 | - active = active > 0 ? active * FIXED_1 : 0; | ||
4111 | + /* | ||
4112 | + * Catch-up, fold however many we are behind still | ||
4113 | + */ | ||
4114 | + delta = jiffies - calc_load_update - 10; | ||
4115 | + n = 1 + (delta / LOAD_FREQ); | ||
4116 | |||
4117 | - avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n); | ||
4118 | - avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n); | ||
4119 | - avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n); | ||
4120 | + active = atomic_long_read(&calc_load_tasks); | ||
4121 | + active = active > 0 ? active * FIXED_1 : 0; | ||
4122 | |||
4123 | - calc_load_update += n * LOAD_FREQ; | ||
4124 | - } | ||
4125 | + avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n); | ||
4126 | + avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n); | ||
4127 | + avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n); | ||
4128 | |||
4129 | - /* | ||
4130 | - * Its possible the remainder of the above division also crosses | ||
4131 | - * a LOAD_FREQ period, the regular check in calc_global_load() | ||
4132 | - * which comes after this will take care of that. | ||
4133 | - * | ||
4134 | - * Consider us being 11 ticks before a cycle completion, and us | ||
4135 | - * sleeping for 4*LOAD_FREQ + 22 ticks, then the above code will | ||
4136 | - * age us 4 cycles, and the test in calc_global_load() will | ||
4137 | - * pick up the final one. | ||
4138 | - */ | ||
4139 | + calc_load_update += n * LOAD_FREQ; | ||
4140 | } | ||
4141 | #else | ||
4142 | static void calc_load_account_idle(struct rq *this_rq) | ||
4143 | @@ -3592,7 +3583,7 @@ static inline long calc_load_fold_idle(void) | ||
4144 | return 0; | ||
4145 | } | ||
4146 | |||
4147 | -static void calc_global_nohz(unsigned long ticks) | ||
4148 | +static void calc_global_nohz(void) | ||
4149 | { | ||
4150 | } | ||
4151 | #endif | ||
4152 | @@ -3620,8 +3611,6 @@ void calc_global_load(unsigned long ticks) | ||
4153 | { | ||
4154 | long active; | ||
4155 | |||
4156 | - calc_global_nohz(ticks); | ||
4157 | - | ||
4158 | if (time_before(jiffies, calc_load_update + 10)) | ||
4159 | return; | ||
4160 | |||
4161 | @@ -3633,6 +3622,16 @@ void calc_global_load(unsigned long ticks) | ||
4162 | avenrun[2] = calc_load(avenrun[2], EXP_15, active); | ||
4163 | |||
4164 | calc_load_update += LOAD_FREQ; | ||
4165 | + | ||
4166 | + /* | ||
4167 | + * Account one period with whatever state we found before | ||
4168 | + * folding in the nohz state and ageing the entire idle period. | ||
4169 | + * | ||
4170 | + * This avoids loosing a sample when we go idle between | ||
4171 | + * calc_load_account_active() (10 ticks ago) and now and thus | ||
4172 | + * under-accounting. | ||
4173 | + */ | ||
4174 | + calc_global_nohz(); | ||
4175 | } | ||
4176 | |||
4177 | /* | ||
4178 | @@ -7605,16 +7604,26 @@ static void __sdt_free(const struct cpumask *cpu_map) | ||
4179 | struct sd_data *sdd = &tl->data; | ||
4180 | |||
4181 | for_each_cpu(j, cpu_map) { | ||
4182 | - struct sched_domain *sd = *per_cpu_ptr(sdd->sd, j); | ||
4183 | - if (sd && (sd->flags & SD_OVERLAP)) | ||
4184 | - free_sched_groups(sd->groups, 0); | ||
4185 | - kfree(*per_cpu_ptr(sdd->sd, j)); | ||
4186 | - kfree(*per_cpu_ptr(sdd->sg, j)); | ||
4187 | - kfree(*per_cpu_ptr(sdd->sgp, j)); | ||
4188 | + struct sched_domain *sd; | ||
4189 | + | ||
4190 | + if (sdd->sd) { | ||
4191 | + sd = *per_cpu_ptr(sdd->sd, j); | ||
4192 | + if (sd && (sd->flags & SD_OVERLAP)) | ||
4193 | + free_sched_groups(sd->groups, 0); | ||
4194 | + kfree(*per_cpu_ptr(sdd->sd, j)); | ||
4195 | + } | ||
4196 | + | ||
4197 | + if (sdd->sg) | ||
4198 | + kfree(*per_cpu_ptr(sdd->sg, j)); | ||
4199 | + if (sdd->sgp) | ||
4200 | + kfree(*per_cpu_ptr(sdd->sgp, j)); | ||
4201 | } | ||
4202 | free_percpu(sdd->sd); | ||
4203 | + sdd->sd = NULL; | ||
4204 | free_percpu(sdd->sg); | ||
4205 | + sdd->sg = NULL; | ||
4206 | free_percpu(sdd->sgp); | ||
4207 | + sdd->sgp = NULL; | ||
4208 | } | ||
4209 | } | ||
4210 | |||
4211 | diff --git a/kernel/signal.c b/kernel/signal.c | ||
4212 | index 2065515..08e0b97 100644 | ||
4213 | --- a/kernel/signal.c | ||
4214 | +++ b/kernel/signal.c | ||
4215 | @@ -1610,6 +1610,15 @@ bool do_notify_parent(struct task_struct *tsk, int sig) | ||
4216 | BUG_ON(!tsk->ptrace && | ||
4217 | (tsk->group_leader != tsk || !thread_group_empty(tsk))); | ||
4218 | |||
4219 | + if (sig != SIGCHLD) { | ||
4220 | + /* | ||
4221 | + * This is only possible if parent == real_parent. | ||
4222 | + * Check if it has changed security domain. | ||
4223 | + */ | ||
4224 | + if (tsk->parent_exec_id != tsk->parent->self_exec_id) | ||
4225 | + sig = SIGCHLD; | ||
4226 | + } | ||
4227 | + | ||
4228 | info.si_signo = sig; | ||
4229 | info.si_errno = 0; | ||
4230 | /* | ||
4231 | diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c | ||
4232 | index 5199930..1dcf253 100644 | ||
4233 | --- a/kernel/trace/trace_output.c | ||
4234 | +++ b/kernel/trace/trace_output.c | ||
4235 | @@ -638,6 +638,8 @@ int trace_print_lat_context(struct trace_iterator *iter) | ||
4236 | { | ||
4237 | u64 next_ts; | ||
4238 | int ret; | ||
4239 | + /* trace_find_next_entry will reset ent_size */ | ||
4240 | + int ent_size = iter->ent_size; | ||
4241 | struct trace_seq *s = &iter->seq; | ||
4242 | struct trace_entry *entry = iter->ent, | ||
4243 | *next_entry = trace_find_next_entry(iter, NULL, | ||
4244 | @@ -646,6 +648,9 @@ int trace_print_lat_context(struct trace_iterator *iter) | ||
4245 | unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start); | ||
4246 | unsigned long rel_usecs; | ||
4247 | |||
4248 | + /* Restore the original ent_size */ | ||
4249 | + iter->ent_size = ent_size; | ||
4250 | + | ||
4251 | if (!next_entry) | ||
4252 | next_ts = iter->ts; | ||
4253 | rel_usecs = ns2usecs(next_ts - iter->ts); | ||
4254 | diff --git a/mm/swap_state.c b/mm/swap_state.c | ||
4255 | index 78cc4d1..7704d9c 100644 | ||
4256 | --- a/mm/swap_state.c | ||
4257 | +++ b/mm/swap_state.c | ||
4258 | @@ -27,7 +27,7 @@ | ||
4259 | */ | ||
4260 | static const struct address_space_operations swap_aops = { | ||
4261 | .writepage = swap_writepage, | ||
4262 | - .set_page_dirty = __set_page_dirty_nobuffers, | ||
4263 | + .set_page_dirty = __set_page_dirty_no_writeback, | ||
4264 | .migratepage = migrate_page, | ||
4265 | }; | ||
4266 | |||
4267 | diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c | ||
4268 | index e7c69f4..b04a6ef 100644 | ||
4269 | --- a/net/ax25/af_ax25.c | ||
4270 | +++ b/net/ax25/af_ax25.c | ||
4271 | @@ -2006,16 +2006,17 @@ static void __exit ax25_exit(void) | ||
4272 | proc_net_remove(&init_net, "ax25_route"); | ||
4273 | proc_net_remove(&init_net, "ax25"); | ||
4274 | proc_net_remove(&init_net, "ax25_calls"); | ||
4275 | - ax25_rt_free(); | ||
4276 | - ax25_uid_free(); | ||
4277 | - ax25_dev_free(); | ||
4278 | |||
4279 | - ax25_unregister_sysctl(); | ||
4280 | unregister_netdevice_notifier(&ax25_dev_notifier); | ||
4281 | + ax25_unregister_sysctl(); | ||
4282 | |||
4283 | dev_remove_pack(&ax25_packet_type); | ||
4284 | |||
4285 | sock_unregister(PF_AX25); | ||
4286 | proto_unregister(&ax25_proto); | ||
4287 | + | ||
4288 | + ax25_rt_free(); | ||
4289 | + ax25_uid_free(); | ||
4290 | + ax25_dev_free(); | ||
4291 | } | ||
4292 | module_exit(ax25_exit); | ||
4293 | diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c | ||
4294 | index 8eb6b15..5ac1811 100644 | ||
4295 | --- a/net/bridge/br_multicast.c | ||
4296 | +++ b/net/bridge/br_multicast.c | ||
4297 | @@ -241,7 +241,6 @@ static void br_multicast_group_expired(unsigned long data) | ||
4298 | hlist_del_rcu(&mp->hlist[mdb->ver]); | ||
4299 | mdb->size--; | ||
4300 | |||
4301 | - del_timer(&mp->query_timer); | ||
4302 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | ||
4303 | |||
4304 | out: | ||
4305 | @@ -271,7 +270,6 @@ static void br_multicast_del_pg(struct net_bridge *br, | ||
4306 | rcu_assign_pointer(*pp, p->next); | ||
4307 | hlist_del_init(&p->mglist); | ||
4308 | del_timer(&p->timer); | ||
4309 | - del_timer(&p->query_timer); | ||
4310 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | ||
4311 | |||
4312 | if (!mp->ports && !mp->mglist && | ||
4313 | @@ -507,74 +505,6 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br, | ||
4314 | return NULL; | ||
4315 | } | ||
4316 | |||
4317 | -static void br_multicast_send_group_query(struct net_bridge_mdb_entry *mp) | ||
4318 | -{ | ||
4319 | - struct net_bridge *br = mp->br; | ||
4320 | - struct sk_buff *skb; | ||
4321 | - | ||
4322 | - skb = br_multicast_alloc_query(br, &mp->addr); | ||
4323 | - if (!skb) | ||
4324 | - goto timer; | ||
4325 | - | ||
4326 | - netif_rx(skb); | ||
4327 | - | ||
4328 | -timer: | ||
4329 | - if (++mp->queries_sent < br->multicast_last_member_count) | ||
4330 | - mod_timer(&mp->query_timer, | ||
4331 | - jiffies + br->multicast_last_member_interval); | ||
4332 | -} | ||
4333 | - | ||
4334 | -static void br_multicast_group_query_expired(unsigned long data) | ||
4335 | -{ | ||
4336 | - struct net_bridge_mdb_entry *mp = (void *)data; | ||
4337 | - struct net_bridge *br = mp->br; | ||
4338 | - | ||
4339 | - spin_lock(&br->multicast_lock); | ||
4340 | - if (!netif_running(br->dev) || !mp->mglist || | ||
4341 | - mp->queries_sent >= br->multicast_last_member_count) | ||
4342 | - goto out; | ||
4343 | - | ||
4344 | - br_multicast_send_group_query(mp); | ||
4345 | - | ||
4346 | -out: | ||
4347 | - spin_unlock(&br->multicast_lock); | ||
4348 | -} | ||
4349 | - | ||
4350 | -static void br_multicast_send_port_group_query(struct net_bridge_port_group *pg) | ||
4351 | -{ | ||
4352 | - struct net_bridge_port *port = pg->port; | ||
4353 | - struct net_bridge *br = port->br; | ||
4354 | - struct sk_buff *skb; | ||
4355 | - | ||
4356 | - skb = br_multicast_alloc_query(br, &pg->addr); | ||
4357 | - if (!skb) | ||
4358 | - goto timer; | ||
4359 | - | ||
4360 | - br_deliver(port, skb); | ||
4361 | - | ||
4362 | -timer: | ||
4363 | - if (++pg->queries_sent < br->multicast_last_member_count) | ||
4364 | - mod_timer(&pg->query_timer, | ||
4365 | - jiffies + br->multicast_last_member_interval); | ||
4366 | -} | ||
4367 | - | ||
4368 | -static void br_multicast_port_group_query_expired(unsigned long data) | ||
4369 | -{ | ||
4370 | - struct net_bridge_port_group *pg = (void *)data; | ||
4371 | - struct net_bridge_port *port = pg->port; | ||
4372 | - struct net_bridge *br = port->br; | ||
4373 | - | ||
4374 | - spin_lock(&br->multicast_lock); | ||
4375 | - if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) || | ||
4376 | - pg->queries_sent >= br->multicast_last_member_count) | ||
4377 | - goto out; | ||
4378 | - | ||
4379 | - br_multicast_send_port_group_query(pg); | ||
4380 | - | ||
4381 | -out: | ||
4382 | - spin_unlock(&br->multicast_lock); | ||
4383 | -} | ||
4384 | - | ||
4385 | static struct net_bridge_mdb_entry *br_multicast_get_group( | ||
4386 | struct net_bridge *br, struct net_bridge_port *port, | ||
4387 | struct br_ip *group, int hash) | ||
4388 | @@ -690,8 +620,6 @@ rehash: | ||
4389 | mp->addr = *group; | ||
4390 | setup_timer(&mp->timer, br_multicast_group_expired, | ||
4391 | (unsigned long)mp); | ||
4392 | - setup_timer(&mp->query_timer, br_multicast_group_query_expired, | ||
4393 | - (unsigned long)mp); | ||
4394 | |||
4395 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); | ||
4396 | mdb->size++; | ||
4397 | @@ -746,8 +674,6 @@ static int br_multicast_add_group(struct net_bridge *br, | ||
4398 | hlist_add_head(&p->mglist, &port->mglist); | ||
4399 | setup_timer(&p->timer, br_multicast_port_group_expired, | ||
4400 | (unsigned long)p); | ||
4401 | - setup_timer(&p->query_timer, br_multicast_port_group_query_expired, | ||
4402 | - (unsigned long)p); | ||
4403 | |||
4404 | rcu_assign_pointer(*pp, p); | ||
4405 | |||
4406 | @@ -1291,9 +1217,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | ||
4407 | time_after(mp->timer.expires, time) : | ||
4408 | try_to_del_timer_sync(&mp->timer) >= 0)) { | ||
4409 | mod_timer(&mp->timer, time); | ||
4410 | - | ||
4411 | - mp->queries_sent = 0; | ||
4412 | - mod_timer(&mp->query_timer, now); | ||
4413 | } | ||
4414 | |||
4415 | goto out; | ||
4416 | @@ -1310,9 +1233,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | ||
4417 | time_after(p->timer.expires, time) : | ||
4418 | try_to_del_timer_sync(&p->timer) >= 0)) { | ||
4419 | mod_timer(&p->timer, time); | ||
4420 | - | ||
4421 | - p->queries_sent = 0; | ||
4422 | - mod_timer(&p->query_timer, now); | ||
4423 | } | ||
4424 | |||
4425 | break; | ||
4426 | @@ -1680,7 +1600,6 @@ void br_multicast_stop(struct net_bridge *br) | ||
4427 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], | ||
4428 | hlist[ver]) { | ||
4429 | del_timer(&mp->timer); | ||
4430 | - del_timer(&mp->query_timer); | ||
4431 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | ||
4432 | } | ||
4433 | } | ||
4434 | diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h | ||
4435 | index d7d6fb0..93264df 100644 | ||
4436 | --- a/net/bridge/br_private.h | ||
4437 | +++ b/net/bridge/br_private.h | ||
4438 | @@ -82,9 +82,7 @@ struct net_bridge_port_group { | ||
4439 | struct hlist_node mglist; | ||
4440 | struct rcu_head rcu; | ||
4441 | struct timer_list timer; | ||
4442 | - struct timer_list query_timer; | ||
4443 | struct br_ip addr; | ||
4444 | - u32 queries_sent; | ||
4445 | }; | ||
4446 | |||
4447 | struct net_bridge_mdb_entry | ||
4448 | @@ -94,10 +92,8 @@ struct net_bridge_mdb_entry | ||
4449 | struct net_bridge_port_group __rcu *ports; | ||
4450 | struct rcu_head rcu; | ||
4451 | struct timer_list timer; | ||
4452 | - struct timer_list query_timer; | ||
4453 | struct br_ip addr; | ||
4454 | bool mglist; | ||
4455 | - u32 queries_sent; | ||
4456 | }; | ||
4457 | |||
4458 | struct net_bridge_mdb_htable | ||
4459 | diff --git a/net/core/dev.c b/net/core/dev.c | ||
4460 | index 55cd370..cd5050e 100644 | ||
4461 | --- a/net/core/dev.c | ||
4462 | +++ b/net/core/dev.c | ||
4463 | @@ -4102,54 +4102,41 @@ static int dev_ifconf(struct net *net, char __user *arg) | ||
4464 | |||
4465 | #ifdef CONFIG_PROC_FS | ||
4466 | |||
4467 | -#define BUCKET_SPACE (32 - NETDEV_HASHBITS) | ||
4468 | - | ||
4469 | -struct dev_iter_state { | ||
4470 | - struct seq_net_private p; | ||
4471 | - unsigned int pos; /* bucket << BUCKET_SPACE + offset */ | ||
4472 | -}; | ||
4473 | +#define BUCKET_SPACE (32 - NETDEV_HASHBITS - 1) | ||
4474 | |||
4475 | #define get_bucket(x) ((x) >> BUCKET_SPACE) | ||
4476 | #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1)) | ||
4477 | #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o)) | ||
4478 | |||
4479 | -static inline struct net_device *dev_from_same_bucket(struct seq_file *seq) | ||
4480 | +static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos) | ||
4481 | { | ||
4482 | - struct dev_iter_state *state = seq->private; | ||
4483 | struct net *net = seq_file_net(seq); | ||
4484 | struct net_device *dev; | ||
4485 | struct hlist_node *p; | ||
4486 | struct hlist_head *h; | ||
4487 | - unsigned int count, bucket, offset; | ||
4488 | + unsigned int count = 0, offset = get_offset(*pos); | ||
4489 | |||
4490 | - bucket = get_bucket(state->pos); | ||
4491 | - offset = get_offset(state->pos); | ||
4492 | - h = &net->dev_name_head[bucket]; | ||
4493 | - count = 0; | ||
4494 | + h = &net->dev_name_head[get_bucket(*pos)]; | ||
4495 | hlist_for_each_entry_rcu(dev, p, h, name_hlist) { | ||
4496 | - if (count++ == offset) { | ||
4497 | - state->pos = set_bucket_offset(bucket, count); | ||
4498 | + if (++count == offset) | ||
4499 | return dev; | ||
4500 | - } | ||
4501 | } | ||
4502 | |||
4503 | return NULL; | ||
4504 | } | ||
4505 | |||
4506 | -static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) | ||
4507 | +static inline struct net_device *dev_from_bucket(struct seq_file *seq, loff_t *pos) | ||
4508 | { | ||
4509 | - struct dev_iter_state *state = seq->private; | ||
4510 | struct net_device *dev; | ||
4511 | unsigned int bucket; | ||
4512 | |||
4513 | - bucket = get_bucket(state->pos); | ||
4514 | do { | ||
4515 | - dev = dev_from_same_bucket(seq); | ||
4516 | + dev = dev_from_same_bucket(seq, pos); | ||
4517 | if (dev) | ||
4518 | return dev; | ||
4519 | |||
4520 | - bucket++; | ||
4521 | - state->pos = set_bucket_offset(bucket, 0); | ||
4522 | + bucket = get_bucket(*pos) + 1; | ||
4523 | + *pos = set_bucket_offset(bucket, 1); | ||
4524 | } while (bucket < NETDEV_HASHENTRIES); | ||
4525 | |||
4526 | return NULL; | ||
4527 | @@ -4162,33 +4149,20 @@ static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) | ||
4528 | void *dev_seq_start(struct seq_file *seq, loff_t *pos) | ||
4529 | __acquires(RCU) | ||
4530 | { | ||
4531 | - struct dev_iter_state *state = seq->private; | ||
4532 | - | ||
4533 | rcu_read_lock(); | ||
4534 | if (!*pos) | ||
4535 | return SEQ_START_TOKEN; | ||
4536 | |||
4537 | - /* check for end of the hash */ | ||
4538 | - if (state->pos == 0 && *pos > 1) | ||
4539 | + if (get_bucket(*pos) >= NETDEV_HASHENTRIES) | ||
4540 | return NULL; | ||
4541 | |||
4542 | - return dev_from_new_bucket(seq); | ||
4543 | + return dev_from_bucket(seq, pos); | ||
4544 | } | ||
4545 | |||
4546 | void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
4547 | { | ||
4548 | - struct net_device *dev; | ||
4549 | - | ||
4550 | ++*pos; | ||
4551 | - | ||
4552 | - if (v == SEQ_START_TOKEN) | ||
4553 | - return dev_from_new_bucket(seq); | ||
4554 | - | ||
4555 | - dev = dev_from_same_bucket(seq); | ||
4556 | - if (dev) | ||
4557 | - return dev; | ||
4558 | - | ||
4559 | - return dev_from_new_bucket(seq); | ||
4560 | + return dev_from_bucket(seq, pos); | ||
4561 | } | ||
4562 | |||
4563 | void dev_seq_stop(struct seq_file *seq, void *v) | ||
4564 | @@ -4287,13 +4261,7 @@ static const struct seq_operations dev_seq_ops = { | ||
4565 | static int dev_seq_open(struct inode *inode, struct file *file) | ||
4566 | { | ||
4567 | return seq_open_net(inode, file, &dev_seq_ops, | ||
4568 | - sizeof(struct dev_iter_state)); | ||
4569 | -} | ||
4570 | - | ||
4571 | -int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
4572 | - const struct seq_operations *ops) | ||
4573 | -{ | ||
4574 | - return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state)); | ||
4575 | + sizeof(struct seq_net_private)); | ||
4576 | } | ||
4577 | |||
4578 | static const struct file_operations dev_seq_fops = { | ||
4579 | diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c | ||
4580 | index febba51..277faef 100644 | ||
4581 | --- a/net/core/dev_addr_lists.c | ||
4582 | +++ b/net/core/dev_addr_lists.c | ||
4583 | @@ -696,7 +696,8 @@ static const struct seq_operations dev_mc_seq_ops = { | ||
4584 | |||
4585 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | ||
4586 | { | ||
4587 | - return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); | ||
4588 | + return seq_open_net(inode, file, &dev_mc_seq_ops, | ||
4589 | + sizeof(struct seq_net_private)); | ||
4590 | } | ||
4591 | |||
4592 | static const struct file_operations dev_mc_seq_fops = { | ||
4593 | diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c | ||
4594 | index 0e950fd..31a5ae5 100644 | ||
4595 | --- a/net/core/net_namespace.c | ||
4596 | +++ b/net/core/net_namespace.c | ||
4597 | @@ -83,21 +83,29 @@ assign: | ||
4598 | |||
4599 | static int ops_init(const struct pernet_operations *ops, struct net *net) | ||
4600 | { | ||
4601 | - int err; | ||
4602 | + int err = -ENOMEM; | ||
4603 | + void *data = NULL; | ||
4604 | + | ||
4605 | if (ops->id && ops->size) { | ||
4606 | - void *data = kzalloc(ops->size, GFP_KERNEL); | ||
4607 | + data = kzalloc(ops->size, GFP_KERNEL); | ||
4608 | if (!data) | ||
4609 | - return -ENOMEM; | ||
4610 | + goto out; | ||
4611 | |||
4612 | err = net_assign_generic(net, *ops->id, data); | ||
4613 | - if (err) { | ||
4614 | - kfree(data); | ||
4615 | - return err; | ||
4616 | - } | ||
4617 | + if (err) | ||
4618 | + goto cleanup; | ||
4619 | } | ||
4620 | + err = 0; | ||
4621 | if (ops->init) | ||
4622 | - return ops->init(net); | ||
4623 | - return 0; | ||
4624 | + err = ops->init(net); | ||
4625 | + if (!err) | ||
4626 | + return 0; | ||
4627 | + | ||
4628 | +cleanup: | ||
4629 | + kfree(data); | ||
4630 | + | ||
4631 | +out: | ||
4632 | + return err; | ||
4633 | } | ||
4634 | |||
4635 | static void ops_free(const struct pernet_operations *ops, struct net *net) | ||
4636 | @@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops) | ||
4637 | static int __register_pernet_operations(struct list_head *list, | ||
4638 | struct pernet_operations *ops) | ||
4639 | { | ||
4640 | - int err = 0; | ||
4641 | - err = ops_init(ops, &init_net); | ||
4642 | - if (err) | ||
4643 | - ops_free(ops, &init_net); | ||
4644 | - return err; | ||
4645 | - | ||
4646 | + return ops_init(ops, &init_net); | ||
4647 | } | ||
4648 | |||
4649 | static void __unregister_pernet_operations(struct pernet_operations *ops) | ||
4650 | diff --git a/net/core/skbuff.c b/net/core/skbuff.c | ||
4651 | index 3c30ee4..2ec200de 100644 | ||
4652 | --- a/net/core/skbuff.c | ||
4653 | +++ b/net/core/skbuff.c | ||
4654 | @@ -903,9 +903,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | ||
4655 | goto adjust_others; | ||
4656 | } | ||
4657 | |||
4658 | - data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | ||
4659 | + data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), | ||
4660 | + gfp_mask); | ||
4661 | if (!data) | ||
4662 | goto nodata; | ||
4663 | + size = SKB_WITH_OVERHEAD(ksize(data)); | ||
4664 | |||
4665 | /* Copy only real data... and, alas, header. This should be | ||
4666 | * optimized for the cases when header is void. | ||
4667 | @@ -3111,6 +3113,8 @@ static void sock_rmem_free(struct sk_buff *skb) | ||
4668 | */ | ||
4669 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | ||
4670 | { | ||
4671 | + int len = skb->len; | ||
4672 | + | ||
4673 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | ||
4674 | (unsigned)sk->sk_rcvbuf) | ||
4675 | return -ENOMEM; | ||
4676 | @@ -3125,7 +3129,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | ||
4677 | |||
4678 | skb_queue_tail(&sk->sk_error_queue, skb); | ||
4679 | if (!sock_flag(sk, SOCK_DEAD)) | ||
4680 | - sk->sk_data_ready(sk, skb->len); | ||
4681 | + sk->sk_data_ready(sk, len); | ||
4682 | return 0; | ||
4683 | } | ||
4684 | EXPORT_SYMBOL(sock_queue_err_skb); | ||
4685 | diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c | ||
4686 | index 34f5db1..7904db4 100644 | ||
4687 | --- a/net/ipv4/tcp.c | ||
4688 | +++ b/net/ipv4/tcp.c | ||
4689 | @@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) | ||
4690 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | ||
4691 | if (skb) { | ||
4692 | if (sk_wmem_schedule(sk, skb->truesize)) { | ||
4693 | + skb_reserve(skb, sk->sk_prot->max_header); | ||
4694 | /* | ||
4695 | * Make sure that we have exactly size bytes | ||
4696 | * available to the caller, no more, no less. | ||
4697 | */ | ||
4698 | - skb_reserve(skb, skb_tailroom(skb) - size); | ||
4699 | + skb->avail_size = size; | ||
4700 | return skb; | ||
4701 | } | ||
4702 | __kfree_skb(skb); | ||
4703 | @@ -860,7 +861,7 @@ wait_for_memory: | ||
4704 | } | ||
4705 | |||
4706 | out: | ||
4707 | - if (copied) | ||
4708 | + if (copied && !(flags & MSG_SENDPAGE_NOTLAST)) | ||
4709 | tcp_push(sk, flags, mss_now, tp->nonagle); | ||
4710 | return copied; | ||
4711 | |||
4712 | @@ -995,10 +996,9 @@ new_segment: | ||
4713 | copy = seglen; | ||
4714 | |||
4715 | /* Where to copy to? */ | ||
4716 | - if (skb_tailroom(skb) > 0) { | ||
4717 | + if (skb_availroom(skb) > 0) { | ||
4718 | /* We have some space in skb head. Superb! */ | ||
4719 | - if (copy > skb_tailroom(skb)) | ||
4720 | - copy = skb_tailroom(skb); | ||
4721 | + copy = min_t(int, copy, skb_availroom(skb)); | ||
4722 | err = skb_add_data_nocache(sk, skb, from, copy); | ||
4723 | if (err) | ||
4724 | goto do_fault; | ||
4725 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c | ||
4726 | index e4d1e4a..daedc07 100644 | ||
4727 | --- a/net/ipv4/tcp_input.c | ||
4728 | +++ b/net/ipv4/tcp_input.c | ||
4729 | @@ -334,6 +334,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) | ||
4730 | incr = __tcp_grow_window(sk, skb); | ||
4731 | |||
4732 | if (incr) { | ||
4733 | + incr = max_t(int, incr, 2 * skb->len); | ||
4734 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, | ||
4735 | tp->window_clamp); | ||
4736 | inet_csk(sk)->icsk_ack.quick |= 1; | ||
4737 | @@ -473,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) | ||
4738 | if (!win_dep) { | ||
4739 | m -= (new_sample >> 3); | ||
4740 | new_sample += m; | ||
4741 | - } else if (m < new_sample) | ||
4742 | - new_sample = m << 3; | ||
4743 | + } else { | ||
4744 | + m <<= 3; | ||
4745 | + if (m < new_sample) | ||
4746 | + new_sample = m; | ||
4747 | + } | ||
4748 | } else { | ||
4749 | /* No previous measure. */ | ||
4750 | new_sample = m << 3; | ||
4751 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c | ||
4752 | index 097e0c7..c51dd5b 100644 | ||
4753 | --- a/net/ipv4/tcp_output.c | ||
4754 | +++ b/net/ipv4/tcp_output.c | ||
4755 | @@ -1093,6 +1093,14 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | ||
4756 | { | ||
4757 | int i, k, eat; | ||
4758 | |||
4759 | + eat = min_t(int, len, skb_headlen(skb)); | ||
4760 | + if (eat) { | ||
4761 | + __skb_pull(skb, eat); | ||
4762 | + skb->avail_size -= eat; | ||
4763 | + len -= eat; | ||
4764 | + if (!len) | ||
4765 | + return; | ||
4766 | + } | ||
4767 | eat = len; | ||
4768 | k = 0; | ||
4769 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | ||
4770 | @@ -1124,11 +1132,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | ||
4771 | if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) | ||
4772 | return -ENOMEM; | ||
4773 | |||
4774 | - /* If len == headlen, we avoid __skb_pull to preserve alignment. */ | ||
4775 | - if (unlikely(len < skb_headlen(skb))) | ||
4776 | - __skb_pull(skb, len); | ||
4777 | - else | ||
4778 | - __pskb_trim_head(skb, len - skb_headlen(skb)); | ||
4779 | + __pskb_trim_head(skb, len); | ||
4780 | |||
4781 | TCP_SKB_CB(skb)->seq += len; | ||
4782 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
4783 | @@ -2057,7 +2061,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to, | ||
4784 | /* Punt if not enough space exists in the first SKB for | ||
4785 | * the data in the second | ||
4786 | */ | ||
4787 | - if (skb->len > skb_tailroom(to)) | ||
4788 | + if (skb->len > skb_availroom(to)) | ||
4789 | break; | ||
4790 | |||
4791 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) | ||
4792 | diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c | ||
4793 | index 2257366..f2d74ea 100644 | ||
4794 | --- a/net/ipv6/mcast.c | ||
4795 | +++ b/net/ipv6/mcast.c | ||
4796 | @@ -2054,7 +2054,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, | ||
4797 | if (!delta) | ||
4798 | pmc->mca_sfcount[sfmode]--; | ||
4799 | for (j=0; j<i; j++) | ||
4800 | - (void) ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); | ||
4801 | + ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]); | ||
4802 | } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { | ||
4803 | struct ip6_sf_list *psf; | ||
4804 | |||
4805 | diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c | ||
4806 | index b859e4a..4a56574 100644 | ||
4807 | --- a/net/ipv6/tcp_ipv6.c | ||
4808 | +++ b/net/ipv6/tcp_ipv6.c | ||
4809 | @@ -1494,6 +1494,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | ||
4810 | tcp_mtup_init(newsk); | ||
4811 | tcp_sync_mss(newsk, dst_mtu(dst)); | ||
4812 | newtp->advmss = dst_metric_advmss(dst); | ||
4813 | + if (tcp_sk(sk)->rx_opt.user_mss && | ||
4814 | + tcp_sk(sk)->rx_opt.user_mss < newtp->advmss) | ||
4815 | + newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; | ||
4816 | + | ||
4817 | tcp_initialize_rcv_mss(newsk); | ||
4818 | if (tcp_rsk(req)->snt_synack) | ||
4819 | tcp_valid_rtt_meas(newsk, | ||
4820 | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c | ||
4821 | index eff1f4e..4ff35bf 100644 | ||
4822 | --- a/net/mac80211/tx.c | ||
4823 | +++ b/net/mac80211/tx.c | ||
4824 | @@ -1121,7 +1121,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | ||
4825 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | ||
4826 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) | ||
4827 | return TX_DROP; | ||
4828 | - } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { | ||
4829 | + } else if (info->flags & IEEE80211_TX_CTL_INJECTED || | ||
4830 | + tx->sdata->control_port_protocol == tx->skb->protocol) { | ||
4831 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | ||
4832 | } | ||
4833 | if (!tx->sta) | ||
4834 | diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c | ||
4835 | index 1201b6d..a99fb41 100644 | ||
4836 | --- a/net/netlink/af_netlink.c | ||
4837 | +++ b/net/netlink/af_netlink.c | ||
4838 | @@ -830,12 +830,19 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, | ||
4839 | return 0; | ||
4840 | } | ||
4841 | |||
4842 | -int netlink_sendskb(struct sock *sk, struct sk_buff *skb) | ||
4843 | +static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb) | ||
4844 | { | ||
4845 | int len = skb->len; | ||
4846 | |||
4847 | skb_queue_tail(&sk->sk_receive_queue, skb); | ||
4848 | sk->sk_data_ready(sk, len); | ||
4849 | + return len; | ||
4850 | +} | ||
4851 | + | ||
4852 | +int netlink_sendskb(struct sock *sk, struct sk_buff *skb) | ||
4853 | +{ | ||
4854 | + int len = __netlink_sendskb(sk, skb); | ||
4855 | + | ||
4856 | sock_put(sk); | ||
4857 | return len; | ||
4858 | } | ||
4859 | @@ -960,8 +967,7 @@ static inline int netlink_broadcast_deliver(struct sock *sk, | ||
4860 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && | ||
4861 | !test_bit(0, &nlk->state)) { | ||
4862 | skb_set_owner_r(skb, sk); | ||
4863 | - skb_queue_tail(&sk->sk_receive_queue, skb); | ||
4864 | - sk->sk_data_ready(sk, skb->len); | ||
4865 | + __netlink_sendskb(sk, skb); | ||
4866 | return atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf; | ||
4867 | } | ||
4868 | return -1; | ||
4869 | @@ -1684,10 +1690,8 @@ static int netlink_dump(struct sock *sk) | ||
4870 | |||
4871 | if (sk_filter(sk, skb)) | ||
4872 | kfree_skb(skb); | ||
4873 | - else { | ||
4874 | - skb_queue_tail(&sk->sk_receive_queue, skb); | ||
4875 | - sk->sk_data_ready(sk, skb->len); | ||
4876 | - } | ||
4877 | + else | ||
4878 | + __netlink_sendskb(sk, skb); | ||
4879 | return 0; | ||
4880 | } | ||
4881 | |||
4882 | @@ -1701,10 +1705,8 @@ static int netlink_dump(struct sock *sk) | ||
4883 | |||
4884 | if (sk_filter(sk, skb)) | ||
4885 | kfree_skb(skb); | ||
4886 | - else { | ||
4887 | - skb_queue_tail(&sk->sk_receive_queue, skb); | ||
4888 | - sk->sk_data_ready(sk, skb->len); | ||
4889 | - } | ||
4890 | + else | ||
4891 | + __netlink_sendskb(sk, skb); | ||
4892 | |||
4893 | if (cb->done) | ||
4894 | cb->done(cb); | ||
4895 | diff --git a/net/phonet/pep.c b/net/phonet/pep.c | ||
4896 | index 2ba6e9f..007546d 100644 | ||
4897 | --- a/net/phonet/pep.c | ||
4898 | +++ b/net/phonet/pep.c | ||
4899 | @@ -1046,6 +1046,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, | ||
4900 | int flags = msg->msg_flags; | ||
4901 | int err, done; | ||
4902 | |||
4903 | + if (len > USHRT_MAX) | ||
4904 | + return -EMSGSIZE; | ||
4905 | + | ||
4906 | if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| | ||
4907 | MSG_CMSG_COMPAT)) || | ||
4908 | !(msg->msg_flags & MSG_EOR)) | ||
4909 | diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c | ||
4910 | index 6cd8ddf..e1afe0c 100644 | ||
4911 | --- a/net/sched/sch_gred.c | ||
4912 | +++ b/net/sched/sch_gred.c | ||
4913 | @@ -544,11 +544,8 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) | ||
4914 | opt.packets = q->packetsin; | ||
4915 | opt.bytesin = q->bytesin; | ||
4916 | |||
4917 | - if (gred_wred_mode(table)) { | ||
4918 | - q->parms.qidlestart = | ||
4919 | - table->tab[table->def]->parms.qidlestart; | ||
4920 | - q->parms.qavg = table->tab[table->def]->parms.qavg; | ||
4921 | - } | ||
4922 | + if (gred_wred_mode(table)) | ||
4923 | + gred_load_wred_set(table, q); | ||
4924 | |||
4925 | opt.qave = red_calc_qavg(&q->parms, q->parms.qavg); | ||
4926 | |||
4927 | diff --git a/net/sctp/socket.c b/net/sctp/socket.c | ||
4928 | index 54a7cd2..0075554 100644 | ||
4929 | --- a/net/sctp/socket.c | ||
4930 | +++ b/net/sctp/socket.c | ||
4931 | @@ -4133,9 +4133,10 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, | ||
4932 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, | ||
4933 | int __user *optlen) | ||
4934 | { | ||
4935 | - if (len < sizeof(struct sctp_event_subscribe)) | ||
4936 | + if (len <= 0) | ||
4937 | return -EINVAL; | ||
4938 | - len = sizeof(struct sctp_event_subscribe); | ||
4939 | + if (len > sizeof(struct sctp_event_subscribe)) | ||
4940 | + len = sizeof(struct sctp_event_subscribe); | ||
4941 | if (put_user(len, optlen)) | ||
4942 | return -EFAULT; | ||
4943 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) | ||
4944 | diff --git a/net/socket.c b/net/socket.c | ||
4945 | index 2dce67a..273cbce 100644 | ||
4946 | --- a/net/socket.c | ||
4947 | +++ b/net/socket.c | ||
4948 | @@ -791,9 +791,9 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, | ||
4949 | |||
4950 | sock = file->private_data; | ||
4951 | |||
4952 | - flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; | ||
4953 | - if (more) | ||
4954 | - flags |= MSG_MORE; | ||
4955 | + flags = (file->f_flags & O_NONBLOCK) ? MSG_DONTWAIT : 0; | ||
4956 | + /* more is a combination of MSG_MORE and MSG_SENDPAGE_NOTLAST */ | ||
4957 | + flags |= more; | ||
4958 | |||
4959 | return kernel_sendpage(sock, page, offset, size, flags); | ||
4960 | } | ||
4961 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c | ||
4962 | index ffafda5..c06c365 100644 | ||
4963 | --- a/net/wireless/nl80211.c | ||
4964 | +++ b/net/wireless/nl80211.c | ||
4965 | @@ -1258,6 +1258,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | ||
4966 | goto bad_res; | ||
4967 | } | ||
4968 | |||
4969 | + if (!netif_running(netdev)) { | ||
4970 | + result = -ENETDOWN; | ||
4971 | + goto bad_res; | ||
4972 | + } | ||
4973 | + | ||
4974 | nla_for_each_nested(nl_txq_params, | ||
4975 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | ||
4976 | rem_txq_params) { | ||
4977 | @@ -5944,7 +5949,7 @@ static struct genl_ops nl80211_ops[] = { | ||
4978 | .doit = nl80211_get_key, | ||
4979 | .policy = nl80211_policy, | ||
4980 | .flags = GENL_ADMIN_PERM, | ||
4981 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
4982 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
4983 | NL80211_FLAG_NEED_RTNL, | ||
4984 | }, | ||
4985 | { | ||
4986 | @@ -5976,7 +5981,7 @@ static struct genl_ops nl80211_ops[] = { | ||
4987 | .policy = nl80211_policy, | ||
4988 | .flags = GENL_ADMIN_PERM, | ||
4989 | .doit = nl80211_addset_beacon, | ||
4990 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
4991 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
4992 | NL80211_FLAG_NEED_RTNL, | ||
4993 | }, | ||
4994 | { | ||
4995 | @@ -5984,7 +5989,7 @@ static struct genl_ops nl80211_ops[] = { | ||
4996 | .policy = nl80211_policy, | ||
4997 | .flags = GENL_ADMIN_PERM, | ||
4998 | .doit = nl80211_addset_beacon, | ||
4999 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5000 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5001 | NL80211_FLAG_NEED_RTNL, | ||
5002 | }, | ||
5003 | { | ||
5004 | @@ -6008,7 +6013,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5005 | .doit = nl80211_set_station, | ||
5006 | .policy = nl80211_policy, | ||
5007 | .flags = GENL_ADMIN_PERM, | ||
5008 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5009 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5010 | NL80211_FLAG_NEED_RTNL, | ||
5011 | }, | ||
5012 | { | ||
5013 | @@ -6024,7 +6029,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5014 | .doit = nl80211_del_station, | ||
5015 | .policy = nl80211_policy, | ||
5016 | .flags = GENL_ADMIN_PERM, | ||
5017 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5018 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5019 | NL80211_FLAG_NEED_RTNL, | ||
5020 | }, | ||
5021 | { | ||
5022 | @@ -6057,7 +6062,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5023 | .doit = nl80211_del_mpath, | ||
5024 | .policy = nl80211_policy, | ||
5025 | .flags = GENL_ADMIN_PERM, | ||
5026 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5027 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5028 | NL80211_FLAG_NEED_RTNL, | ||
5029 | }, | ||
5030 | { | ||
5031 | @@ -6065,7 +6070,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5032 | .doit = nl80211_set_bss, | ||
5033 | .policy = nl80211_policy, | ||
5034 | .flags = GENL_ADMIN_PERM, | ||
5035 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5036 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5037 | NL80211_FLAG_NEED_RTNL, | ||
5038 | }, | ||
5039 | { | ||
5040 | @@ -6091,7 +6096,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5041 | .doit = nl80211_get_mesh_config, | ||
5042 | .policy = nl80211_policy, | ||
5043 | /* can be retrieved by unprivileged users */ | ||
5044 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5045 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5046 | NL80211_FLAG_NEED_RTNL, | ||
5047 | }, | ||
5048 | { | ||
5049 | @@ -6224,7 +6229,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5050 | .doit = nl80211_setdel_pmksa, | ||
5051 | .policy = nl80211_policy, | ||
5052 | .flags = GENL_ADMIN_PERM, | ||
5053 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5054 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5055 | NL80211_FLAG_NEED_RTNL, | ||
5056 | }, | ||
5057 | { | ||
5058 | @@ -6232,7 +6237,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5059 | .doit = nl80211_setdel_pmksa, | ||
5060 | .policy = nl80211_policy, | ||
5061 | .flags = GENL_ADMIN_PERM, | ||
5062 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5063 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5064 | NL80211_FLAG_NEED_RTNL, | ||
5065 | }, | ||
5066 | { | ||
5067 | @@ -6240,7 +6245,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5068 | .doit = nl80211_flush_pmksa, | ||
5069 | .policy = nl80211_policy, | ||
5070 | .flags = GENL_ADMIN_PERM, | ||
5071 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5072 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5073 | NL80211_FLAG_NEED_RTNL, | ||
5074 | }, | ||
5075 | { | ||
5076 | @@ -6328,7 +6333,7 @@ static struct genl_ops nl80211_ops[] = { | ||
5077 | .doit = nl80211_set_wds_peer, | ||
5078 | .policy = nl80211_policy, | ||
5079 | .flags = GENL_ADMIN_PERM, | ||
5080 | - .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
5081 | + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | ||
5082 | NL80211_FLAG_NEED_RTNL, | ||
5083 | }, | ||
5084 | { | ||
5085 | diff --git a/net/wireless/util.c b/net/wireless/util.c | ||
5086 | index 4dde429..8bf8902 100644 | ||
5087 | --- a/net/wireless/util.c | ||
5088 | +++ b/net/wireless/util.c | ||
5089 | @@ -996,7 +996,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, | ||
5090 | if (rdev->wiphy.software_iftypes & BIT(iftype)) | ||
5091 | continue; | ||
5092 | for (j = 0; j < c->n_limits; j++) { | ||
5093 | - if (!(limits[j].types & iftype)) | ||
5094 | + if (!(limits[j].types & BIT(iftype))) | ||
5095 | continue; | ||
5096 | if (limits[j].max < num[iftype]) | ||
5097 | goto cont; | ||
5098 | diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c | ||
5099 | index f936d1f..d1d0ae8 100644 | ||
5100 | --- a/scripts/mod/file2alias.c | ||
5101 | +++ b/scripts/mod/file2alias.c | ||
5102 | @@ -926,6 +926,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | ||
5103 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) | ||
5104 | return; | ||
5105 | |||
5106 | + /* We're looking for an object */ | ||
5107 | + if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) | ||
5108 | + return; | ||
5109 | + | ||
5110 | /* Handle all-NULL symbols allocated into .bss */ | ||
5111 | if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { | ||
5112 | zeros = calloc(1, sym->st_size); | ||
5113 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c | ||
5114 | index ae94929..51a1afc 100644 | ||
5115 | --- a/sound/pci/hda/patch_conexant.c | ||
5116 | +++ b/sound/pci/hda/patch_conexant.c | ||
5117 | @@ -4003,9 +4003,14 @@ static void cx_auto_init_output(struct hda_codec *codec) | ||
5118 | int i; | ||
5119 | |||
5120 | mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); | ||
5121 | - for (i = 0; i < cfg->hp_outs; i++) | ||
5122 | + for (i = 0; i < cfg->hp_outs; i++) { | ||
5123 | + unsigned int val = PIN_OUT; | ||
5124 | + if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) & | ||
5125 | + AC_PINCAP_HP_DRV) | ||
5126 | + val |= AC_PINCTL_HP_EN; | ||
5127 | snd_hda_codec_write(codec, cfg->hp_pins[i], 0, | ||
5128 | - AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); | ||
5129 | + AC_VERB_SET_PIN_WIDGET_CONTROL, val); | ||
5130 | + } | ||
5131 | mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); | ||
5132 | mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); | ||
5133 | mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); | ||
5134 | @@ -4408,8 +4413,10 @@ static void apply_pin_fixup(struct hda_codec *codec, | ||
5135 | |||
5136 | enum { | ||
5137 | CXT_PINCFG_LENOVO_X200, | ||
5138 | + CXT_PINCFG_LENOVO_TP410, | ||
5139 | }; | ||
5140 | |||
5141 | +/* ThinkPad X200 & co with cxt5051 */ | ||
5142 | static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | ||
5143 | { 0x16, 0x042140ff }, /* HP (seq# overridden) */ | ||
5144 | { 0x17, 0x21a11000 }, /* dock-mic */ | ||
5145 | @@ -4417,15 +4424,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | ||
5146 | {} | ||
5147 | }; | ||
5148 | |||
5149 | +/* ThinkPad 410/420/510/520, X201 & co with cxt5066 */ | ||
5150 | +static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = { | ||
5151 | + { 0x19, 0x042110ff }, /* HP (seq# overridden) */ | ||
5152 | + { 0x1a, 0x21a190f0 }, /* dock-mic */ | ||
5153 | + { 0x1c, 0x212140ff }, /* dock-HP */ | ||
5154 | + {} | ||
5155 | +}; | ||
5156 | + | ||
5157 | static const struct cxt_pincfg *cxt_pincfg_tbl[] = { | ||
5158 | [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, | ||
5159 | + [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410, | ||
5160 | }; | ||
5161 | |||
5162 | -static const struct snd_pci_quirk cxt_fixups[] = { | ||
5163 | +static const struct snd_pci_quirk cxt5051_fixups[] = { | ||
5164 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), | ||
5165 | {} | ||
5166 | }; | ||
5167 | |||
5168 | +static const struct snd_pci_quirk cxt5066_fixups[] = { | ||
5169 | + SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), | ||
5170 | + SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), | ||
5171 | + SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), | ||
5172 | + SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), | ||
5173 | + SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), | ||
5174 | + {} | ||
5175 | +}; | ||
5176 | + | ||
5177 | /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches | ||
5178 | * can be created (bko#42825) | ||
5179 | */ | ||
5180 | @@ -4462,11 +4487,13 @@ static int patch_conexant_auto(struct hda_codec *codec) | ||
5181 | break; | ||
5182 | case 0x14f15051: | ||
5183 | add_cx5051_fake_mutes(codec); | ||
5184 | + apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl); | ||
5185 | + break; | ||
5186 | + default: | ||
5187 | + apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl); | ||
5188 | break; | ||
5189 | } | ||
5190 | |||
5191 | - apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); | ||
5192 | - | ||
5193 | err = cx_auto_search_adcs(codec); | ||
5194 | if (err < 0) | ||
5195 | return err; | ||
5196 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
5197 | index dc8a6fc..0bc5a46 100644 | ||
5198 | --- a/sound/pci/hda/patch_realtek.c | ||
5199 | +++ b/sound/pci/hda/patch_realtek.c | ||
5200 | @@ -5032,6 +5032,7 @@ static const struct alc_fixup alc269_fixups[] = { | ||
5201 | }; | ||
5202 | |||
5203 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
5204 | + SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), | ||
5205 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | ||
5206 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), | ||
5207 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), | ||
5208 | diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c | ||
5209 | index 336de8f..0e7e26e 100644 | ||
5210 | --- a/sound/soc/codecs/tlv320aic23.c | ||
5211 | +++ b/sound/soc/codecs/tlv320aic23.c | ||
5212 | @@ -473,7 +473,7 @@ static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai, | ||
5213 | static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | ||
5214 | enum snd_soc_bias_level level) | ||
5215 | { | ||
5216 | - u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0xff7f; | ||
5217 | + u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0x17f; | ||
5218 | |||
5219 | switch (level) { | ||
5220 | case SND_SOC_BIAS_ON: | ||
5221 | @@ -492,7 +492,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | ||
5222 | case SND_SOC_BIAS_OFF: | ||
5223 | /* everything off, dac mute, inactive */ | ||
5224 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); | ||
5225 | - snd_soc_write(codec, TLV320AIC23_PWR, 0xffff); | ||
5226 | + snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff); | ||
5227 | break; | ||
5228 | } | ||
5229 | codec->dapm.bias_level = level; | ||
5230 | diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c | ||
5231 | index 2f1f5f8..7806301 100644 | ||
5232 | --- a/sound/soc/codecs/wm8994.c | ||
5233 | +++ b/sound/soc/codecs/wm8994.c | ||
5234 | @@ -883,61 +883,170 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec) | ||
5235 | } | ||
5236 | } | ||
5237 | |||
5238 | -static int late_enable_ev(struct snd_soc_dapm_widget *w, | ||
5239 | - struct snd_kcontrol *kcontrol, int event) | ||
5240 | +static int aif1clk_ev(struct snd_soc_dapm_widget *w, | ||
5241 | + struct snd_kcontrol *kcontrol, int event) | ||
5242 | { | ||
5243 | struct snd_soc_codec *codec = w->codec; | ||
5244 | - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
5245 | + struct wm8994 *control = codec->control_data; | ||
5246 | + int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; | ||
5247 | + int dac; | ||
5248 | + int adc; | ||
5249 | + int val; | ||
5250 | + | ||
5251 | + switch (control->type) { | ||
5252 | + case WM8994: | ||
5253 | + case WM8958: | ||
5254 | + mask |= WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA; | ||
5255 | + break; | ||
5256 | + default: | ||
5257 | + break; | ||
5258 | + } | ||
5259 | |||
5260 | switch (event) { | ||
5261 | case SND_SOC_DAPM_PRE_PMU: | ||
5262 | - if (wm8994->aif1clk_enable) { | ||
5263 | - snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
5264 | - WM8994_AIF1CLK_ENA_MASK, | ||
5265 | - WM8994_AIF1CLK_ENA); | ||
5266 | - wm8994->aif1clk_enable = 0; | ||
5267 | - } | ||
5268 | - if (wm8994->aif2clk_enable) { | ||
5269 | - snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
5270 | - WM8994_AIF2CLK_ENA_MASK, | ||
5271 | - WM8994_AIF2CLK_ENA); | ||
5272 | - wm8994->aif2clk_enable = 0; | ||
5273 | - } | ||
5274 | + val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); | ||
5275 | + if ((val & WM8994_AIF1ADCL_SRC) && | ||
5276 | + (val & WM8994_AIF1ADCR_SRC)) | ||
5277 | + adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA; | ||
5278 | + else if (!(val & WM8994_AIF1ADCL_SRC) && | ||
5279 | + !(val & WM8994_AIF1ADCR_SRC)) | ||
5280 | + adc = WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA; | ||
5281 | + else | ||
5282 | + adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA | | ||
5283 | + WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA; | ||
5284 | + | ||
5285 | + val = snd_soc_read(codec, WM8994_AIF1_CONTROL_2); | ||
5286 | + if ((val & WM8994_AIF1DACL_SRC) && | ||
5287 | + (val & WM8994_AIF1DACR_SRC)) | ||
5288 | + dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA; | ||
5289 | + else if (!(val & WM8994_AIF1DACL_SRC) && | ||
5290 | + !(val & WM8994_AIF1DACR_SRC)) | ||
5291 | + dac = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA; | ||
5292 | + else | ||
5293 | + dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA | | ||
5294 | + WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA; | ||
5295 | + | ||
5296 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
5297 | + mask, adc); | ||
5298 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
5299 | + mask, dac); | ||
5300 | + snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
5301 | + WM8994_AIF1DSPCLK_ENA | | ||
5302 | + WM8994_SYSDSPCLK_ENA, | ||
5303 | + WM8994_AIF1DSPCLK_ENA | | ||
5304 | + WM8994_SYSDSPCLK_ENA); | ||
5305 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, mask, | ||
5306 | + WM8994_AIF1ADC1R_ENA | | ||
5307 | + WM8994_AIF1ADC1L_ENA | | ||
5308 | + WM8994_AIF1ADC2R_ENA | | ||
5309 | + WM8994_AIF1ADC2L_ENA); | ||
5310 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, mask, | ||
5311 | + WM8994_AIF1DAC1R_ENA | | ||
5312 | + WM8994_AIF1DAC1L_ENA | | ||
5313 | + WM8994_AIF1DAC2R_ENA | | ||
5314 | + WM8994_AIF1DAC2L_ENA); | ||
5315 | + break; | ||
5316 | + | ||
5317 | + case SND_SOC_DAPM_PRE_PMD: | ||
5318 | + case SND_SOC_DAPM_POST_PMD: | ||
5319 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
5320 | + mask, 0); | ||
5321 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
5322 | + mask, 0); | ||
5323 | + | ||
5324 | + val = snd_soc_read(codec, WM8994_CLOCKING_1); | ||
5325 | + if (val & WM8994_AIF2DSPCLK_ENA) | ||
5326 | + val = WM8994_SYSDSPCLK_ENA; | ||
5327 | + else | ||
5328 | + val = 0; | ||
5329 | + snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
5330 | + WM8994_SYSDSPCLK_ENA | | ||
5331 | + WM8994_AIF1DSPCLK_ENA, val); | ||
5332 | break; | ||
5333 | } | ||
5334 | |||
5335 | - /* We may also have postponed startup of DSP, handle that. */ | ||
5336 | - wm8958_aif_ev(w, kcontrol, event); | ||
5337 | - | ||
5338 | return 0; | ||
5339 | } | ||
5340 | |||
5341 | -static int late_disable_ev(struct snd_soc_dapm_widget *w, | ||
5342 | - struct snd_kcontrol *kcontrol, int event) | ||
5343 | +static int aif2clk_ev(struct snd_soc_dapm_widget *w, | ||
5344 | + struct snd_kcontrol *kcontrol, int event) | ||
5345 | { | ||
5346 | struct snd_soc_codec *codec = w->codec; | ||
5347 | - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
5348 | + int dac; | ||
5349 | + int adc; | ||
5350 | + int val; | ||
5351 | |||
5352 | switch (event) { | ||
5353 | + case SND_SOC_DAPM_PRE_PMU: | ||
5354 | + val = snd_soc_read(codec, WM8994_AIF2_CONTROL_1); | ||
5355 | + if ((val & WM8994_AIF2ADCL_SRC) && | ||
5356 | + (val & WM8994_AIF2ADCR_SRC)) | ||
5357 | + adc = WM8994_AIF2ADCR_ENA; | ||
5358 | + else if (!(val & WM8994_AIF2ADCL_SRC) && | ||
5359 | + !(val & WM8994_AIF2ADCR_SRC)) | ||
5360 | + adc = WM8994_AIF2ADCL_ENA; | ||
5361 | + else | ||
5362 | + adc = WM8994_AIF2ADCL_ENA | WM8994_AIF2ADCR_ENA; | ||
5363 | + | ||
5364 | + | ||
5365 | + val = snd_soc_read(codec, WM8994_AIF2_CONTROL_2); | ||
5366 | + if ((val & WM8994_AIF2DACL_SRC) && | ||
5367 | + (val & WM8994_AIF2DACR_SRC)) | ||
5368 | + dac = WM8994_AIF2DACR_ENA; | ||
5369 | + else if (!(val & WM8994_AIF2DACL_SRC) && | ||
5370 | + !(val & WM8994_AIF2DACR_SRC)) | ||
5371 | + dac = WM8994_AIF2DACL_ENA; | ||
5372 | + else | ||
5373 | + dac = WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA; | ||
5374 | + | ||
5375 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
5376 | + WM8994_AIF2ADCL_ENA | | ||
5377 | + WM8994_AIF2ADCR_ENA, adc); | ||
5378 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
5379 | + WM8994_AIF2DACL_ENA | | ||
5380 | + WM8994_AIF2DACR_ENA, dac); | ||
5381 | + snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
5382 | + WM8994_AIF2DSPCLK_ENA | | ||
5383 | + WM8994_SYSDSPCLK_ENA, | ||
5384 | + WM8994_AIF2DSPCLK_ENA | | ||
5385 | + WM8994_SYSDSPCLK_ENA); | ||
5386 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
5387 | + WM8994_AIF2ADCL_ENA | | ||
5388 | + WM8994_AIF2ADCR_ENA, | ||
5389 | + WM8994_AIF2ADCL_ENA | | ||
5390 | + WM8994_AIF2ADCR_ENA); | ||
5391 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
5392 | + WM8994_AIF2DACL_ENA | | ||
5393 | + WM8994_AIF2DACR_ENA, | ||
5394 | + WM8994_AIF2DACL_ENA | | ||
5395 | + WM8994_AIF2DACR_ENA); | ||
5396 | + break; | ||
5397 | + | ||
5398 | + case SND_SOC_DAPM_PRE_PMD: | ||
5399 | case SND_SOC_DAPM_POST_PMD: | ||
5400 | - if (wm8994->aif1clk_disable) { | ||
5401 | - snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
5402 | - WM8994_AIF1CLK_ENA_MASK, 0); | ||
5403 | - wm8994->aif1clk_disable = 0; | ||
5404 | - } | ||
5405 | - if (wm8994->aif2clk_disable) { | ||
5406 | - snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
5407 | - WM8994_AIF2CLK_ENA_MASK, 0); | ||
5408 | - wm8994->aif2clk_disable = 0; | ||
5409 | - } | ||
5410 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
5411 | + WM8994_AIF2DACL_ENA | | ||
5412 | + WM8994_AIF2DACR_ENA, 0); | ||
5413 | + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
5414 | + WM8994_AIF2ADCL_ENA | | ||
5415 | + WM8994_AIF2ADCR_ENA, 0); | ||
5416 | + | ||
5417 | + val = snd_soc_read(codec, WM8994_CLOCKING_1); | ||
5418 | + if (val & WM8994_AIF1DSPCLK_ENA) | ||
5419 | + val = WM8994_SYSDSPCLK_ENA; | ||
5420 | + else | ||
5421 | + val = 0; | ||
5422 | + snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
5423 | + WM8994_SYSDSPCLK_ENA | | ||
5424 | + WM8994_AIF2DSPCLK_ENA, val); | ||
5425 | break; | ||
5426 | } | ||
5427 | |||
5428 | return 0; | ||
5429 | } | ||
5430 | |||
5431 | -static int aif1clk_ev(struct snd_soc_dapm_widget *w, | ||
5432 | - struct snd_kcontrol *kcontrol, int event) | ||
5433 | +static int aif1clk_late_ev(struct snd_soc_dapm_widget *w, | ||
5434 | + struct snd_kcontrol *kcontrol, int event) | ||
5435 | { | ||
5436 | struct snd_soc_codec *codec = w->codec; | ||
5437 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
5438 | @@ -954,8 +1063,8 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w, | ||
5439 | return 0; | ||
5440 | } | ||
5441 | |||
5442 | -static int aif2clk_ev(struct snd_soc_dapm_widget *w, | ||
5443 | - struct snd_kcontrol *kcontrol, int event) | ||
5444 | +static int aif2clk_late_ev(struct snd_soc_dapm_widget *w, | ||
5445 | + struct snd_kcontrol *kcontrol, int event) | ||
5446 | { | ||
5447 | struct snd_soc_codec *codec = w->codec; | ||
5448 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
5449 | @@ -972,6 +1081,63 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w, | ||
5450 | return 0; | ||
5451 | } | ||
5452 | |||
5453 | +static int late_enable_ev(struct snd_soc_dapm_widget *w, | ||
5454 | + struct snd_kcontrol *kcontrol, int event) | ||
5455 | +{ | ||
5456 | + struct snd_soc_codec *codec = w->codec; | ||
5457 | + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
5458 | + | ||
5459 | + switch (event) { | ||
5460 | + case SND_SOC_DAPM_PRE_PMU: | ||
5461 | + if (wm8994->aif1clk_enable) { | ||
5462 | + aif1clk_ev(w, kcontrol, event); | ||
5463 | + snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
5464 | + WM8994_AIF1CLK_ENA_MASK, | ||
5465 | + WM8994_AIF1CLK_ENA); | ||
5466 | + wm8994->aif1clk_enable = 0; | ||
5467 | + } | ||
5468 | + if (wm8994->aif2clk_enable) { | ||
5469 | + aif2clk_ev(w, kcontrol, event); | ||
5470 | + snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
5471 | + WM8994_AIF2CLK_ENA_MASK, | ||
5472 | + WM8994_AIF2CLK_ENA); | ||
5473 | + wm8994->aif2clk_enable = 0; | ||
5474 | + } | ||
5475 | + break; | ||
5476 | + } | ||
5477 | + | ||
5478 | + /* We may also have postponed startup of DSP, handle that. */ | ||
5479 | + wm8958_aif_ev(w, kcontrol, event); | ||
5480 | + | ||
5481 | + return 0; | ||
5482 | +} | ||
5483 | + | ||
5484 | +static int late_disable_ev(struct snd_soc_dapm_widget *w, | ||
5485 | + struct snd_kcontrol *kcontrol, int event) | ||
5486 | +{ | ||
5487 | + struct snd_soc_codec *codec = w->codec; | ||
5488 | + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
5489 | + | ||
5490 | + switch (event) { | ||
5491 | + case SND_SOC_DAPM_POST_PMD: | ||
5492 | + if (wm8994->aif1clk_disable) { | ||
5493 | + snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
5494 | + WM8994_AIF1CLK_ENA_MASK, 0); | ||
5495 | + aif1clk_ev(w, kcontrol, event); | ||
5496 | + wm8994->aif1clk_disable = 0; | ||
5497 | + } | ||
5498 | + if (wm8994->aif2clk_disable) { | ||
5499 | + snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
5500 | + WM8994_AIF2CLK_ENA_MASK, 0); | ||
5501 | + aif2clk_ev(w, kcontrol, event); | ||
5502 | + wm8994->aif2clk_disable = 0; | ||
5503 | + } | ||
5504 | + break; | ||
5505 | + } | ||
5506 | + | ||
5507 | + return 0; | ||
5508 | +} | ||
5509 | + | ||
5510 | static int adc_mux_ev(struct snd_soc_dapm_widget *w, | ||
5511 | struct snd_kcontrol *kcontrol, int event) | ||
5512 | { | ||
5513 | @@ -1268,9 +1434,9 @@ static const struct snd_kcontrol_new aif2dacr_src_mux = | ||
5514 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); | ||
5515 | |||
5516 | static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = { | ||
5517 | -SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_ev, | ||
5518 | +SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_late_ev, | ||
5519 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
5520 | -SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_ev, | ||
5521 | +SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_late_ev, | ||
5522 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
5523 | |||
5524 | SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
5525 | @@ -1299,8 +1465,10 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev) | ||
5526 | }; | ||
5527 | |||
5528 | static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { | ||
5529 | -SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | ||
5530 | -SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), | ||
5531 | +SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev, | ||
5532 | + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
5533 | +SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev, | ||
5534 | + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
5535 | SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0), | ||
5536 | SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0, | ||
5537 | left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)), | ||
5538 | @@ -1353,30 +1521,30 @@ SND_SOC_DAPM_SUPPLY("VMID", SND_SOC_NOPM, 0, 0, vmid_event, | ||
5539 | SND_SOC_DAPM_SUPPLY("CLK_SYS", SND_SOC_NOPM, 0, 0, clk_sys_event, | ||
5540 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | ||
5541 | |||
5542 | -SND_SOC_DAPM_SUPPLY("DSP1CLK", WM8994_CLOCKING_1, 3, 0, NULL, 0), | ||
5543 | -SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), | ||
5544 | -SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), | ||
5545 | +SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM, 3, 0, NULL, 0), | ||
5546 | +SND_SOC_DAPM_SUPPLY("DSP2CLK", SND_SOC_NOPM, 2, 0, NULL, 0), | ||
5547 | +SND_SOC_DAPM_SUPPLY("DSPINTCLK", SND_SOC_NOPM, 1, 0, NULL, 0), | ||
5548 | |||
5549 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, | ||
5550 | - 0, WM8994_POWER_MANAGEMENT_4, 9, 0), | ||
5551 | + 0, SND_SOC_NOPM, 9, 0), | ||
5552 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, | ||
5553 | - 0, WM8994_POWER_MANAGEMENT_4, 8, 0), | ||
5554 | + 0, SND_SOC_NOPM, 8, 0), | ||
5555 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC1L", NULL, 0, | ||
5556 | - WM8994_POWER_MANAGEMENT_5, 9, 0, wm8958_aif_ev, | ||
5557 | + SND_SOC_NOPM, 9, 0, wm8958_aif_ev, | ||
5558 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
5559 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC1R", NULL, 0, | ||
5560 | - WM8994_POWER_MANAGEMENT_5, 8, 0, wm8958_aif_ev, | ||
5561 | + SND_SOC_NOPM, 8, 0, wm8958_aif_ev, | ||
5562 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
5563 | |||
5564 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL, | ||
5565 | - 0, WM8994_POWER_MANAGEMENT_4, 11, 0), | ||
5566 | + 0, SND_SOC_NOPM, 11, 0), | ||
5567 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL, | ||
5568 | - 0, WM8994_POWER_MANAGEMENT_4, 10, 0), | ||
5569 | + 0, SND_SOC_NOPM, 10, 0), | ||
5570 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC2L", NULL, 0, | ||
5571 | - WM8994_POWER_MANAGEMENT_5, 11, 0, wm8958_aif_ev, | ||
5572 | + SND_SOC_NOPM, 11, 0, wm8958_aif_ev, | ||
5573 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
5574 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC2R", NULL, 0, | ||
5575 | - WM8994_POWER_MANAGEMENT_5, 10, 0, wm8958_aif_ev, | ||
5576 | + SND_SOC_NOPM, 10, 0, wm8958_aif_ev, | ||
5577 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
5578 | |||
5579 | SND_SOC_DAPM_MIXER("AIF1ADC1L Mixer", SND_SOC_NOPM, 0, 0, | ||
5580 | @@ -1403,14 +1571,14 @@ SND_SOC_DAPM_MIXER("DAC1R Mixer", SND_SOC_NOPM, 0, 0, | ||
5581 | dac1r_mix, ARRAY_SIZE(dac1r_mix)), | ||
5582 | |||
5583 | SND_SOC_DAPM_AIF_OUT("AIF2ADCL", NULL, 0, | ||
5584 | - WM8994_POWER_MANAGEMENT_4, 13, 0), | ||
5585 | + SND_SOC_NOPM, 13, 0), | ||
5586 | SND_SOC_DAPM_AIF_OUT("AIF2ADCR", NULL, 0, | ||
5587 | - WM8994_POWER_MANAGEMENT_4, 12, 0), | ||
5588 | + SND_SOC_NOPM, 12, 0), | ||
5589 | SND_SOC_DAPM_AIF_IN_E("AIF2DACL", NULL, 0, | ||
5590 | - WM8994_POWER_MANAGEMENT_5, 13, 0, wm8958_aif_ev, | ||
5591 | + SND_SOC_NOPM, 13, 0, wm8958_aif_ev, | ||
5592 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | ||
5593 | SND_SOC_DAPM_AIF_IN_E("AIF2DACR", NULL, 0, | ||
5594 | - WM8994_POWER_MANAGEMENT_5, 12, 0, wm8958_aif_ev, | ||
5595 | + SND_SOC_NOPM, 12, 0, wm8958_aif_ev, | ||
5596 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | ||
5597 | |||
5598 | SND_SOC_DAPM_AIF_IN("AIF1DACDAT", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), | ||
5599 | diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c | ||
5600 | index ea909c5..90e93bf 100644 | ||
5601 | --- a/sound/soc/soc-dapm.c | ||
5602 | +++ b/sound/soc/soc-dapm.c | ||
5603 | @@ -69,6 +69,7 @@ static int dapm_up_seq[] = { | ||
5604 | [snd_soc_dapm_out_drv] = 10, | ||
5605 | [snd_soc_dapm_hp] = 10, | ||
5606 | [snd_soc_dapm_spk] = 10, | ||
5607 | + [snd_soc_dapm_line] = 10, | ||
5608 | [snd_soc_dapm_post] = 11, | ||
5609 | }; | ||
5610 | |||
5611 | @@ -77,6 +78,7 @@ static int dapm_down_seq[] = { | ||
5612 | [snd_soc_dapm_adc] = 1, | ||
5613 | [snd_soc_dapm_hp] = 2, | ||
5614 | [snd_soc_dapm_spk] = 2, | ||
5615 | + [snd_soc_dapm_line] = 2, | ||
5616 | [snd_soc_dapm_out_drv] = 2, | ||
5617 | [snd_soc_dapm_pga] = 4, | ||
5618 | [snd_soc_dapm_mixer_named_ctl] = 5, | ||
5619 | diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c | ||
5620 | index adb372d..e0a0970 100644 | ||
5621 | --- a/tools/perf/util/hist.c | ||
5622 | +++ b/tools/perf/util/hist.c | ||
5623 | @@ -237,8 +237,8 @@ struct hist_entry *__hists__add_entry(struct hists *hists, | ||
5624 | * mis-adjust symbol addresses when computing | ||
5625 | * the history counter to increment. | ||
5626 | */ | ||
5627 | - if (he->ms.map != entry->ms.map) { | ||
5628 | - he->ms.map = entry->ms.map; | ||
5629 | + if (he->ms.map != entry.ms.map) { | ||
5630 | + he->ms.map = entry.ms.map; | ||
5631 | if (he->ms.map) | ||
5632 | he->ms.map->referenced = true; | ||
5633 | } | ||
5634 | diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c | ||
5635 | index a195c07..fd817a2 100644 | ||
5636 | --- a/virt/kvm/iommu.c | ||
5637 | +++ b/virt/kvm/iommu.c | ||
5638 | @@ -309,6 +309,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm, | ||
5639 | } | ||
5640 | } | ||
5641 | |||
5642 | +void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
5643 | +{ | ||
5644 | + kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages); | ||
5645 | +} | ||
5646 | + | ||
5647 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) | ||
5648 | { | ||
5649 | int i, idx; | ||
5650 | @@ -317,10 +322,9 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm) | ||
5651 | idx = srcu_read_lock(&kvm->srcu); | ||
5652 | slots = kvm_memslots(kvm); | ||
5653 | |||
5654 | - for (i = 0; i < slots->nmemslots; i++) { | ||
5655 | - kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn, | ||
5656 | - slots->memslots[i].npages); | ||
5657 | - } | ||
5658 | + for (i = 0; i < slots->nmemslots; i++) | ||
5659 | + kvm_iommu_unmap_pages(kvm, &slots->memslots[i]); | ||
5660 | + | ||
5661 | srcu_read_unlock(&kvm->srcu, idx); | ||
5662 | |||
5663 | return 0; | ||
5664 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c | ||
5665 | index d9cfb78..e401c1b 100644 | ||
5666 | --- a/virt/kvm/kvm_main.c | ||
5667 | +++ b/virt/kvm/kvm_main.c | ||
5668 | @@ -802,12 +802,13 @@ skip_lpage: | ||
5669 | if (r) | ||
5670 | goto out_free; | ||
5671 | |||
5672 | - /* map the pages in iommu page table */ | ||
5673 | + /* map/unmap the pages in iommu page table */ | ||
5674 | if (npages) { | ||
5675 | r = kvm_iommu_map_pages(kvm, &new); | ||
5676 | if (r) | ||
5677 | goto out_free; | ||
5678 | - } | ||
5679 | + } else | ||
5680 | + kvm_iommu_unmap_pages(kvm, &old); | ||
5681 | |||
5682 | r = -ENOMEM; | ||
5683 | slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); |