Contents of /trunk/kernel26-alx/patches-2.6.37/0100-2.6.37.1-all-fixes.patch
Parent Directory | Revision Log
Revision 1714 -
(show annotations)
(download)
Tue Mar 27 14:22:06 2012 UTC (12 years, 6 months ago) by niro
File size: 356597 byte(s)
Tue Mar 27 14:22:06 2012 UTC (12 years, 6 months ago) by niro
File size: 356597 byte(s)
1 | diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt |
2 | index 01ece1b..596bb3c 100644 |
3 | --- a/Documentation/kernel-parameters.txt |
4 | +++ b/Documentation/kernel-parameters.txt |
5 | @@ -884,6 +884,7 @@ and is between 256 and 4096 characters. It is defined in the file |
6 | controller |
7 | i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX |
8 | controllers |
9 | + i8042.notimeout [HW] Ignore timeout condition signalled by conroller |
10 | i8042.reset [HW] Reset the controller during init and cleanup |
11 | i8042.unlock [HW] Unlock (ignore) the keylock |
12 | |
13 | diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S |
14 | index 6bd82d2..7306b8e 100644 |
15 | --- a/arch/arm/kernel/head.S |
16 | +++ b/arch/arm/kernel/head.S |
17 | @@ -91,6 +91,11 @@ ENTRY(stext) |
18 | movs r8, r5 @ invalid machine (r5=0)? |
19 | THUMB( it eq ) @ force fixup-able long branch encoding |
20 | beq __error_a @ yes, error 'a' |
21 | + |
22 | + /* |
23 | + * r1 = machine no, r2 = atags, |
24 | + * r8 = machinfo, r9 = cpuid, r10 = procinfo |
25 | + */ |
26 | bl __vet_atags |
27 | #ifdef CONFIG_SMP_ON_UP |
28 | bl __fixup_smp |
29 | @@ -387,34 +392,32 @@ ENDPROC(__turn_mmu_on) |
30 | |
31 | #ifdef CONFIG_SMP_ON_UP |
32 | __fixup_smp: |
33 | - mov r7, #0x00070000 |
34 | - orr r6, r7, #0xff000000 @ mask 0xff070000 |
35 | - orr r7, r7, #0x41000000 @ val 0x41070000 |
36 | - and r0, r9, r6 |
37 | - teq r0, r7 @ ARM CPU and ARMv6/v7? |
38 | + and r3, r9, #0x000f0000 @ architecture version |
39 | + teq r3, #0x000f0000 @ CPU ID supported? |
40 | bne __fixup_smp_on_up @ no, assume UP |
41 | |
42 | - orr r6, r6, #0x0000ff00 |
43 | - orr r6, r6, #0x000000f0 @ mask 0xff07fff0 |
44 | - orr r7, r7, #0x0000b000 |
45 | - orr r7, r7, #0x00000020 @ val 0x4107b020 |
46 | - and r0, r9, r6 |
47 | - teq r0, r7 @ ARM 11MPCore? |
48 | + bic r3, r9, #0x00ff0000 |
49 | + bic r3, r3, #0x0000000f @ mask 0xff00fff0 |
50 | + mov r4, #0x41000000 |
51 | + orr r4, r4, #0x0000b000 |
52 | + orr r4, r4, #0x00000020 @ val 0x4100b020 |
53 | + teq r3, r4 @ ARM 11MPCore? |
54 | moveq pc, lr @ yes, assume SMP |
55 | |
56 | mrc p15, 0, r0, c0, c0, 5 @ read MPIDR |
57 | - tst r0, #1 << 31 |
58 | - movne pc, lr @ bit 31 => SMP |
59 | + and r0, r0, #0xc0000000 @ multiprocessing extensions and |
60 | + teq r0, #0x80000000 @ not part of a uniprocessor system? |
61 | + moveq pc, lr @ yes, assume SMP |
62 | |
63 | __fixup_smp_on_up: |
64 | adr r0, 1f |
65 | - ldmia r0, {r3, r6, r7} |
66 | + ldmia r0, {r3 - r5} |
67 | sub r3, r0, r3 |
68 | - add r6, r6, r3 |
69 | - add r7, r7, r3 |
70 | -2: cmp r6, r7 |
71 | - ldmia r6!, {r0, r4} |
72 | - strlo r4, [r0, r3] |
73 | + add r4, r4, r3 |
74 | + add r5, r5, r3 |
75 | +2: cmp r4, r5 |
76 | + ldmia r4!, {r0, r6} |
77 | + strlo r6, [r0, r3] |
78 | blo 2b |
79 | mov pc, lr |
80 | ENDPROC(__fixup_smp) |
81 | diff --git a/arch/arm/mach-s5pv310/cpu.c b/arch/arm/mach-s5pv310/cpu.c |
82 | index 82ce4aa..b2a37d0 100644 |
83 | --- a/arch/arm/mach-s5pv310/cpu.c |
84 | +++ b/arch/arm/mach-s5pv310/cpu.c |
85 | @@ -168,7 +168,7 @@ static int __init s5pv310_l2x0_cache_init(void) |
86 | __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN, |
87 | S5P_VA_L2CC + L2X0_POWER_CTRL); |
88 | |
89 | - l2x0_init(S5P_VA_L2CC, 0x7C070001, 0xC200ffff); |
90 | + l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff); |
91 | |
92 | return 0; |
93 | } |
94 | diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c |
95 | index 5164069..cddd684 100644 |
96 | --- a/arch/arm/mm/init.c |
97 | +++ b/arch/arm/mm/init.c |
98 | @@ -297,6 +297,12 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) |
99 | memblock_reserve(__pa(_stext), _end - _stext); |
100 | #endif |
101 | #ifdef CONFIG_BLK_DEV_INITRD |
102 | + if (phys_initrd_size && |
103 | + memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { |
104 | + pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n", |
105 | + phys_initrd_start, phys_initrd_size); |
106 | + phys_initrd_start = phys_initrd_size = 0; |
107 | + } |
108 | if (phys_initrd_size) { |
109 | memblock_reserve(phys_initrd_start, phys_initrd_size); |
110 | |
111 | diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c |
112 | index 8aa9744..2b66391 100644 |
113 | --- a/arch/arm/oprofile/common.c |
114 | +++ b/arch/arm/oprofile/common.c |
115 | @@ -10,8 +10,6 @@ |
116 | */ |
117 | |
118 | #include <linux/cpumask.h> |
119 | -#include <linux/err.h> |
120 | -#include <linux/errno.h> |
121 | #include <linux/init.h> |
122 | #include <linux/mutex.h> |
123 | #include <linux/oprofile.h> |
124 | @@ -46,6 +44,7 @@ char *op_name_from_perf_id(void) |
125 | return NULL; |
126 | } |
127 | } |
128 | +#endif |
129 | |
130 | static int report_trace(struct stackframe *frame, void *d) |
131 | { |
132 | @@ -111,6 +110,7 @@ static void arm_backtrace(struct pt_regs * const regs, unsigned int depth) |
133 | |
134 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
135 | { |
136 | + /* provide backtrace support also in timer mode: */ |
137 | ops->backtrace = arm_backtrace; |
138 | |
139 | return oprofile_perf_init(ops); |
140 | @@ -120,11 +120,3 @@ void __exit oprofile_arch_exit(void) |
141 | { |
142 | oprofile_perf_exit(); |
143 | } |
144 | -#else |
145 | -int __init oprofile_arch_init(struct oprofile_operations *ops) |
146 | -{ |
147 | - pr_info("oprofile: hardware counters not available\n"); |
148 | - return -ENODEV; |
149 | -} |
150 | -void __exit oprofile_arch_exit(void) {} |
151 | -#endif /* CONFIG_HW_PERF_EVENTS */ |
152 | diff --git a/arch/avr32/include/asm/syscalls.h b/arch/avr32/include/asm/syscalls.h |
153 | index ab608b7..730a461 100644 |
154 | --- a/arch/avr32/include/asm/syscalls.h |
155 | +++ b/arch/avr32/include/asm/syscalls.h |
156 | @@ -16,18 +16,9 @@ |
157 | #include <linux/signal.h> |
158 | |
159 | /* kernel/process.c */ |
160 | -asmlinkage int sys_fork(struct pt_regs *); |
161 | asmlinkage int sys_clone(unsigned long, unsigned long, |
162 | unsigned long, unsigned long, |
163 | struct pt_regs *); |
164 | -asmlinkage int sys_vfork(struct pt_regs *); |
165 | -asmlinkage int sys_execve(const char __user *, char __user *__user *, |
166 | - char __user *__user *, struct pt_regs *); |
167 | - |
168 | -/* kernel/signal.c */ |
169 | -asmlinkage int sys_sigaltstack(const stack_t __user *, stack_t __user *, |
170 | - struct pt_regs *); |
171 | -asmlinkage int sys_rt_sigreturn(struct pt_regs *); |
172 | |
173 | /* mm/cache.c */ |
174 | asmlinkage int sys_cacheflush(int, void __user *, size_t); |
175 | diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c |
176 | index df971fa..4896ed0 100644 |
177 | --- a/arch/parisc/kernel/firmware.c |
178 | +++ b/arch/parisc/kernel/firmware.c |
179 | @@ -1126,15 +1126,13 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) |
180 | unsigned int i; |
181 | unsigned long flags; |
182 | |
183 | - for (i = 0; i < count && i < 79;) { |
184 | + for (i = 0; i < count;) { |
185 | switch(str[i]) { |
186 | case '\n': |
187 | iodc_dbuf[i+0] = '\r'; |
188 | iodc_dbuf[i+1] = '\n'; |
189 | i += 2; |
190 | goto print; |
191 | - case '\b': /* BS */ |
192 | - i--; /* overwrite last */ |
193 | default: |
194 | iodc_dbuf[i] = str[i]; |
195 | i++; |
196 | @@ -1142,15 +1140,6 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) |
197 | } |
198 | } |
199 | |
200 | - /* if we're at the end of line, and not already inserting a newline, |
201 | - * insert one anyway. iodc console doesn't claim to support >79 char |
202 | - * lines. don't account for this in the return value. |
203 | - */ |
204 | - if (i == 79 && iodc_dbuf[i-1] != '\n') { |
205 | - iodc_dbuf[i+0] = '\r'; |
206 | - iodc_dbuf[i+1] = '\n'; |
207 | - } |
208 | - |
209 | print: |
210 | spin_lock_irqsave(&pdc_lock, flags); |
211 | real32_call(PAGE0->mem_cons.iodc_io, |
212 | diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts |
213 | index 2bbecbb..69422eb 100644 |
214 | --- a/arch/powerpc/boot/dts/p1022ds.dts |
215 | +++ b/arch/powerpc/boot/dts/p1022ds.dts |
216 | @@ -291,13 +291,13 @@ |
217 | ranges = <0x0 0xc100 0x200>; |
218 | cell-index = <1>; |
219 | dma00: dma-channel@0 { |
220 | - compatible = "fsl,eloplus-dma-channel"; |
221 | + compatible = "fsl,ssi-dma-channel"; |
222 | reg = <0x0 0x80>; |
223 | cell-index = <0>; |
224 | interrupts = <76 2>; |
225 | }; |
226 | dma01: dma-channel@80 { |
227 | - compatible = "fsl,eloplus-dma-channel"; |
228 | + compatible = "fsl,ssi-dma-channel"; |
229 | reg = <0x80 0x80>; |
230 | cell-index = <1>; |
231 | interrupts = <77 2>; |
232 | diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S |
233 | index 55cba4a..f8cd9fb 100644 |
234 | --- a/arch/powerpc/kernel/cpu_setup_6xx.S |
235 | +++ b/arch/powerpc/kernel/cpu_setup_6xx.S |
236 | @@ -18,7 +18,7 @@ |
237 | #include <asm/mmu.h> |
238 | |
239 | _GLOBAL(__setup_cpu_603) |
240 | - mflr r4 |
241 | + mflr r5 |
242 | BEGIN_MMU_FTR_SECTION |
243 | li r10,0 |
244 | mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ |
245 | @@ -27,60 +27,60 @@ BEGIN_FTR_SECTION |
246 | bl __init_fpu_registers |
247 | END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) |
248 | bl setup_common_caches |
249 | - mtlr r4 |
250 | + mtlr r5 |
251 | blr |
252 | _GLOBAL(__setup_cpu_604) |
253 | - mflr r4 |
254 | + mflr r5 |
255 | bl setup_common_caches |
256 | bl setup_604_hid0 |
257 | - mtlr r4 |
258 | + mtlr r5 |
259 | blr |
260 | _GLOBAL(__setup_cpu_750) |
261 | - mflr r4 |
262 | + mflr r5 |
263 | bl __init_fpu_registers |
264 | bl setup_common_caches |
265 | bl setup_750_7400_hid0 |
266 | - mtlr r4 |
267 | + mtlr r5 |
268 | blr |
269 | _GLOBAL(__setup_cpu_750cx) |
270 | - mflr r4 |
271 | + mflr r5 |
272 | bl __init_fpu_registers |
273 | bl setup_common_caches |
274 | bl setup_750_7400_hid0 |
275 | bl setup_750cx |
276 | - mtlr r4 |
277 | + mtlr r5 |
278 | blr |
279 | _GLOBAL(__setup_cpu_750fx) |
280 | - mflr r4 |
281 | + mflr r5 |
282 | bl __init_fpu_registers |
283 | bl setup_common_caches |
284 | bl setup_750_7400_hid0 |
285 | bl setup_750fx |
286 | - mtlr r4 |
287 | + mtlr r5 |
288 | blr |
289 | _GLOBAL(__setup_cpu_7400) |
290 | - mflr r4 |
291 | + mflr r5 |
292 | bl __init_fpu_registers |
293 | bl setup_7400_workarounds |
294 | bl setup_common_caches |
295 | bl setup_750_7400_hid0 |
296 | - mtlr r4 |
297 | + mtlr r5 |
298 | blr |
299 | _GLOBAL(__setup_cpu_7410) |
300 | - mflr r4 |
301 | + mflr r5 |
302 | bl __init_fpu_registers |
303 | bl setup_7410_workarounds |
304 | bl setup_common_caches |
305 | bl setup_750_7400_hid0 |
306 | li r3,0 |
307 | mtspr SPRN_L2CR2,r3 |
308 | - mtlr r4 |
309 | + mtlr r5 |
310 | blr |
311 | _GLOBAL(__setup_cpu_745x) |
312 | - mflr r4 |
313 | + mflr r5 |
314 | bl setup_common_caches |
315 | bl setup_745x_specifics |
316 | - mtlr r4 |
317 | + mtlr r5 |
318 | blr |
319 | |
320 | /* Enable caches for 603's, 604, 750 & 7400 */ |
321 | @@ -194,10 +194,10 @@ setup_750cx: |
322 | cror 4*cr0+eq,4*cr0+eq,4*cr1+eq |
323 | cror 4*cr0+eq,4*cr0+eq,4*cr2+eq |
324 | bnelr |
325 | - lwz r6,CPU_SPEC_FEATURES(r5) |
326 | + lwz r6,CPU_SPEC_FEATURES(r4) |
327 | li r7,CPU_FTR_CAN_NAP |
328 | andc r6,r6,r7 |
329 | - stw r6,CPU_SPEC_FEATURES(r5) |
330 | + stw r6,CPU_SPEC_FEATURES(r4) |
331 | blr |
332 | |
333 | /* 750fx specific |
334 | @@ -225,12 +225,12 @@ BEGIN_FTR_SECTION |
335 | andis. r11,r11,L3CR_L3E@h |
336 | beq 1f |
337 | END_FTR_SECTION_IFSET(CPU_FTR_L3CR) |
338 | - lwz r6,CPU_SPEC_FEATURES(r5) |
339 | + lwz r6,CPU_SPEC_FEATURES(r4) |
340 | andi. r0,r6,CPU_FTR_L3_DISABLE_NAP |
341 | beq 1f |
342 | li r7,CPU_FTR_CAN_NAP |
343 | andc r6,r6,r7 |
344 | - stw r6,CPU_SPEC_FEATURES(r5) |
345 | + stw r6,CPU_SPEC_FEATURES(r4) |
346 | 1: |
347 | mfspr r11,SPRN_HID0 |
348 | |
349 | diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
350 | index 74505b2..c33210a 100644 |
351 | --- a/arch/powerpc/mm/numa.c |
352 | +++ b/arch/powerpc/mm/numa.c |
353 | @@ -181,7 +181,7 @@ static void unmap_cpu_from_node(unsigned long cpu) |
354 | dbg("removing cpu %lu from node %d\n", cpu, node); |
355 | |
356 | if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) { |
357 | - cpumask_set_cpu(cpu, node_to_cpumask_map[node]); |
358 | + cpumask_clear_cpu(cpu, node_to_cpumask_map[node]); |
359 | } else { |
360 | printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", |
361 | cpu, node); |
362 | diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c |
363 | index f129040..8323f14 100644 |
364 | --- a/arch/powerpc/platforms/pseries/lpar.c |
365 | +++ b/arch/powerpc/platforms/pseries/lpar.c |
366 | @@ -701,6 +701,13 @@ EXPORT_SYMBOL(arch_free_page); |
367 | /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ |
368 | extern long hcall_tracepoint_refcount; |
369 | |
370 | +/* |
371 | + * Since the tracing code might execute hcalls we need to guard against |
372 | + * recursion. One example of this are spinlocks calling H_YIELD on |
373 | + * shared processor partitions. |
374 | + */ |
375 | +static DEFINE_PER_CPU(unsigned int, hcall_trace_depth); |
376 | + |
377 | void hcall_tracepoint_regfunc(void) |
378 | { |
379 | hcall_tracepoint_refcount++; |
380 | @@ -713,12 +720,42 @@ void hcall_tracepoint_unregfunc(void) |
381 | |
382 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args) |
383 | { |
384 | + unsigned long flags; |
385 | + unsigned int *depth; |
386 | + |
387 | + local_irq_save(flags); |
388 | + |
389 | + depth = &__get_cpu_var(hcall_trace_depth); |
390 | + |
391 | + if (*depth) |
392 | + goto out; |
393 | + |
394 | + (*depth)++; |
395 | trace_hcall_entry(opcode, args); |
396 | + (*depth)--; |
397 | + |
398 | +out: |
399 | + local_irq_restore(flags); |
400 | } |
401 | |
402 | void __trace_hcall_exit(long opcode, unsigned long retval, |
403 | unsigned long *retbuf) |
404 | { |
405 | + unsigned long flags; |
406 | + unsigned int *depth; |
407 | + |
408 | + local_irq_save(flags); |
409 | + |
410 | + depth = &__get_cpu_var(hcall_trace_depth); |
411 | + |
412 | + if (*depth) |
413 | + goto out; |
414 | + |
415 | + (*depth)++; |
416 | trace_hcall_exit(opcode, retval, retbuf); |
417 | + (*depth)--; |
418 | + |
419 | +out: |
420 | + local_irq_restore(flags); |
421 | } |
422 | #endif |
423 | diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c |
424 | index 9725369..9f99bef 100644 |
425 | --- a/arch/powerpc/sysdev/fsl_rio.c |
426 | +++ b/arch/powerpc/sysdev/fsl_rio.c |
427 | @@ -973,7 +973,6 @@ fsl_rio_dbell_handler(int irq, void *dev_instance) |
428 | if (dsr & DOORBELL_DSR_QFI) { |
429 | pr_info("RIO: doorbell queue full\n"); |
430 | out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_QFI); |
431 | - goto out; |
432 | } |
433 | |
434 | /* XXX Need to check/dispatch until queue empty */ |
435 | diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h |
436 | index b237d52..34ba197 100644 |
437 | --- a/arch/sh/include/asm/io.h |
438 | +++ b/arch/sh/include/asm/io.h |
439 | @@ -322,7 +322,15 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot) |
440 | * mapping must be done by the PMB or by using page tables. |
441 | */ |
442 | if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) { |
443 | - if (unlikely(pgprot_val(prot) & _PAGE_CACHABLE)) |
444 | + u64 flags = pgprot_val(prot); |
445 | + |
446 | + /* |
447 | + * Anything using the legacy PTEA space attributes needs |
448 | + * to be kicked down to page table mappings. |
449 | + */ |
450 | + if (unlikely(flags & _PAGE_PCC_MASK)) |
451 | + return NULL; |
452 | + if (unlikely(flags & _PAGE_CACHABLE)) |
453 | return (void __iomem *)P1SEGADDR(offset); |
454 | |
455 | return (void __iomem *)P2SEGADDR(offset); |
456 | diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h |
457 | index 43528ec..68f3eff 100644 |
458 | --- a/arch/sh/include/asm/pgtable_32.h |
459 | +++ b/arch/sh/include/asm/pgtable_32.h |
460 | @@ -76,6 +76,10 @@ |
461 | /* Wrapper for extended mode pgprot twiddling */ |
462 | #define _PAGE_EXT(x) ((unsigned long long)(x) << 32) |
463 | |
464 | +#ifdef CONFIG_X2TLB |
465 | +#define _PAGE_PCC_MASK 0x00000000 /* No legacy PTEA support */ |
466 | +#else |
467 | + |
468 | /* software: moves to PTEA.TC (Timing Control) */ |
469 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ |
470 | #define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */ |
471 | @@ -89,7 +93,8 @@ |
472 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ |
473 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ |
474 | |
475 | -#ifndef CONFIG_X2TLB |
476 | +#define _PAGE_PCC_MASK 0xe0000001 |
477 | + |
478 | /* copy the ptea attributes */ |
479 | static inline unsigned long copy_ptea_attributes(unsigned long x) |
480 | { |
481 | diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
482 | index e330da2..57e823a 100644 |
483 | --- a/arch/x86/Kconfig |
484 | +++ b/arch/x86/Kconfig |
485 | @@ -2035,6 +2035,7 @@ config OLPC |
486 | bool "One Laptop Per Child support" |
487 | select GPIOLIB |
488 | select OLPC_OPENFIRMWARE |
489 | + depends on !X86_64 && !X86_PAE |
490 | ---help--- |
491 | Add support for detecting the unique features of the OLPC |
492 | XO hardware. |
493 | diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h |
494 | index 4a2d4e0..8b5393e 100644 |
495 | --- a/arch/x86/include/asm/mmu_context.h |
496 | +++ b/arch/x86/include/asm/mmu_context.h |
497 | @@ -36,8 +36,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
498 | unsigned cpu = smp_processor_id(); |
499 | |
500 | if (likely(prev != next)) { |
501 | - /* stop flush ipis for the previous mm */ |
502 | - cpumask_clear_cpu(cpu, mm_cpumask(prev)); |
503 | #ifdef CONFIG_SMP |
504 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); |
505 | percpu_write(cpu_tlbstate.active_mm, next); |
506 | @@ -47,6 +45,9 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
507 | /* Re-load page tables */ |
508 | load_cr3(next->pgd); |
509 | |
510 | + /* stop flush ipis for the previous mm */ |
511 | + cpumask_clear_cpu(cpu, mm_cpumask(prev)); |
512 | + |
513 | /* |
514 | * load the LDT, if the LDT is different: |
515 | */ |
516 | diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h |
517 | index 42d412f..ce1d54c 100644 |
518 | --- a/arch/x86/include/asm/uv/uv_bau.h |
519 | +++ b/arch/x86/include/asm/uv/uv_bau.h |
520 | @@ -26,20 +26,22 @@ |
521 | * BAU_SB_DESCRIPTOR_BASE register, set 1 is located at BASE + 512, |
522 | * set 2 is at BASE + 2*512, set 3 at BASE + 3*512, and so on. |
523 | * |
524 | - * We will use 31 sets, one for sending BAU messages from each of the 32 |
525 | + * We will use one set for sending BAU messages from each of the |
526 | * cpu's on the uvhub. |
527 | * |
528 | * TLB shootdown will use the first of the 8 descriptors of each set. |
529 | * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set). |
530 | */ |
531 | |
532 | +#define MAX_CPUS_PER_UVHUB 64 |
533 | +#define MAX_CPUS_PER_SOCKET 32 |
534 | +#define UV_ADP_SIZE 64 /* hardware-provided max. */ |
535 | +#define UV_CPUS_PER_ACT_STATUS 32 /* hardware-provided max. */ |
536 | #define UV_ITEMS_PER_DESCRIPTOR 8 |
537 | /* the 'throttle' to prevent the hardware stay-busy bug */ |
538 | #define MAX_BAU_CONCURRENT 3 |
539 | -#define UV_CPUS_PER_ACT_STATUS 32 |
540 | #define UV_ACT_STATUS_MASK 0x3 |
541 | #define UV_ACT_STATUS_SIZE 2 |
542 | -#define UV_ADP_SIZE 32 |
543 | #define UV_DISTRIBUTION_SIZE 256 |
544 | #define UV_SW_ACK_NPENDING 8 |
545 | #define UV_NET_ENDPOINT_INTD 0x38 |
546 | @@ -100,7 +102,6 @@ |
547 | * number of destination side software ack resources |
548 | */ |
549 | #define DEST_NUM_RESOURCES 8 |
550 | -#define MAX_CPUS_PER_NODE 32 |
551 | /* |
552 | * completion statuses for sending a TLB flush message |
553 | */ |
554 | diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c |
555 | index 01c0f3e..bebabec 100644 |
556 | --- a/arch/x86/kernel/cpu/mtrr/main.c |
557 | +++ b/arch/x86/kernel/cpu/mtrr/main.c |
558 | @@ -793,13 +793,21 @@ void set_mtrr_aps_delayed_init(void) |
559 | } |
560 | |
561 | /* |
562 | - * MTRR initialization for all AP's |
563 | + * Delayed MTRR initialization for all AP's |
564 | */ |
565 | void mtrr_aps_init(void) |
566 | { |
567 | if (!use_intel()) |
568 | return; |
569 | |
570 | + /* |
571 | + * Check if someone has requested the delay of AP MTRR initialization, |
572 | + * by doing set_mtrr_aps_delayed_init(), prior to this point. If not, |
573 | + * then we are done. |
574 | + */ |
575 | + if (!mtrr_aps_delayed_init) |
576 | + return; |
577 | + |
578 | set_mtrr(~0U, 0, 0, 0); |
579 | mtrr_aps_delayed_init = false; |
580 | } |
581 | diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c |
582 | index 83ec017..e430114 100644 |
583 | --- a/arch/x86/kernel/irq.c |
584 | +++ b/arch/x86/kernel/irq.c |
585 | @@ -357,7 +357,8 @@ void fixup_irqs(void) |
586 | if (irr & (1 << (vector % 32))) { |
587 | irq = __get_cpu_var(vector_irq)[vector]; |
588 | |
589 | - data = irq_get_irq_data(irq); |
590 | + desc = irq_to_desc(irq); |
591 | + data = &desc->irq_data; |
592 | raw_spin_lock(&desc->lock); |
593 | if (data->chip->irq_retrigger) |
594 | data->chip->irq_retrigger(data); |
595 | diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c |
596 | index 57d1868..2502aaf 100644 |
597 | --- a/arch/x86/kernel/process.c |
598 | +++ b/arch/x86/kernel/process.c |
599 | @@ -97,21 +97,31 @@ void show_regs(struct pt_regs *regs) |
600 | |
601 | void show_regs_common(void) |
602 | { |
603 | - const char *board, *product; |
604 | + const char *vendor, *product, *board; |
605 | |
606 | - board = dmi_get_system_info(DMI_BOARD_NAME); |
607 | - if (!board) |
608 | - board = ""; |
609 | + vendor = dmi_get_system_info(DMI_SYS_VENDOR); |
610 | + if (!vendor) |
611 | + vendor = ""; |
612 | product = dmi_get_system_info(DMI_PRODUCT_NAME); |
613 | if (!product) |
614 | product = ""; |
615 | |
616 | + /* Board Name is optional */ |
617 | + board = dmi_get_system_info(DMI_BOARD_NAME); |
618 | + |
619 | printk(KERN_CONT "\n"); |
620 | - printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n", |
621 | + printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s", |
622 | current->pid, current->comm, print_tainted(), |
623 | init_utsname()->release, |
624 | (int)strcspn(init_utsname()->version, " "), |
625 | - init_utsname()->version, board, product); |
626 | + init_utsname()->version); |
627 | + printk(KERN_CONT " "); |
628 | + printk(KERN_CONT "%s %s", vendor, product); |
629 | + if (board) { |
630 | + printk(KERN_CONT "/"); |
631 | + printk(KERN_CONT "%s", board); |
632 | + } |
633 | + printk(KERN_CONT "\n"); |
634 | } |
635 | |
636 | void flush_thread(void) |
637 | diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c |
638 | index ba9caa8..df58e9c 100644 |
639 | --- a/arch/x86/platform/uv/tlb_uv.c |
640 | +++ b/arch/x86/platform/uv/tlb_uv.c |
641 | @@ -1341,7 +1341,7 @@ uv_activation_descriptor_init(int node, int pnode) |
642 | |
643 | /* |
644 | * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR) |
645 | - * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub |
646 | + * per cpu; and one per cpu on the uvhub (UV_ADP_SIZE) |
647 | */ |
648 | bau_desc = kmalloc_node(sizeof(struct bau_desc) * UV_ADP_SIZE |
649 | * UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node); |
650 | @@ -1490,7 +1490,7 @@ calculate_destination_timeout(void) |
651 | /* |
652 | * initialize the bau_control structure for each cpu |
653 | */ |
654 | -static void __init uv_init_per_cpu(int nuvhubs) |
655 | +static int __init uv_init_per_cpu(int nuvhubs) |
656 | { |
657 | int i; |
658 | int cpu; |
659 | @@ -1507,7 +1507,7 @@ static void __init uv_init_per_cpu(int nuvhubs) |
660 | struct bau_control *smaster = NULL; |
661 | struct socket_desc { |
662 | short num_cpus; |
663 | - short cpu_number[16]; |
664 | + short cpu_number[MAX_CPUS_PER_SOCKET]; |
665 | }; |
666 | struct uvhub_desc { |
667 | unsigned short socket_mask; |
668 | @@ -1540,6 +1540,10 @@ static void __init uv_init_per_cpu(int nuvhubs) |
669 | sdp = &bdp->socket[socket]; |
670 | sdp->cpu_number[sdp->num_cpus] = cpu; |
671 | sdp->num_cpus++; |
672 | + if (sdp->num_cpus > MAX_CPUS_PER_SOCKET) { |
673 | + printk(KERN_EMERG "%d cpus per socket invalid\n", sdp->num_cpus); |
674 | + return 1; |
675 | + } |
676 | } |
677 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) { |
678 | if (!(*(uvhub_mask + (uvhub/8)) & (1 << (uvhub%8)))) |
679 | @@ -1570,6 +1574,12 @@ static void __init uv_init_per_cpu(int nuvhubs) |
680 | bcp->uvhub_master = hmaster; |
681 | bcp->uvhub_cpu = uv_cpu_hub_info(cpu)-> |
682 | blade_processor_id; |
683 | + if (bcp->uvhub_cpu >= MAX_CPUS_PER_UVHUB) { |
684 | + printk(KERN_EMERG |
685 | + "%d cpus per uvhub invalid\n", |
686 | + bcp->uvhub_cpu); |
687 | + return 1; |
688 | + } |
689 | } |
690 | nextsocket: |
691 | socket++; |
692 | @@ -1595,6 +1605,7 @@ nextsocket: |
693 | bcp->congested_reps = congested_reps; |
694 | bcp->congested_period = congested_period; |
695 | } |
696 | + return 0; |
697 | } |
698 | |
699 | /* |
700 | @@ -1625,7 +1636,10 @@ static int __init uv_bau_init(void) |
701 | spin_lock_init(&disable_lock); |
702 | congested_cycles = microsec_2_cycles(congested_response_us); |
703 | |
704 | - uv_init_per_cpu(nuvhubs); |
705 | + if (uv_init_per_cpu(nuvhubs)) { |
706 | + nobau = 1; |
707 | + return 0; |
708 | + } |
709 | |
710 | uv_partition_base_pnode = 0x7fffffff; |
711 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) |
712 | diff --git a/block/blk-core.c b/block/blk-core.c |
713 | index 4ce953f..8767520 100644 |
714 | --- a/block/blk-core.c |
715 | +++ b/block/blk-core.c |
716 | @@ -64,13 +64,27 @@ static void drive_stat_acct(struct request *rq, int new_io) |
717 | return; |
718 | |
719 | cpu = part_stat_lock(); |
720 | - part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq)); |
721 | |
722 | - if (!new_io) |
723 | + if (!new_io) { |
724 | + part = rq->part; |
725 | part_stat_inc(cpu, part, merges[rw]); |
726 | - else { |
727 | + } else { |
728 | + part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq)); |
729 | + if (!kref_test_and_get(&part->ref)) { |
730 | + /* |
731 | + * The partition is already being removed, |
732 | + * the request will be accounted on the disk only |
733 | + * |
734 | + * We take a reference on disk->part0 although that |
735 | + * partition will never be deleted, so we can treat |
736 | + * it as any other partition. |
737 | + */ |
738 | + part = &rq->rq_disk->part0; |
739 | + kref_get(&part->ref); |
740 | + } |
741 | part_round_stats(cpu, part); |
742 | part_inc_in_flight(part, rw); |
743 | + rq->part = part; |
744 | } |
745 | |
746 | part_stat_unlock(); |
747 | @@ -128,6 +142,7 @@ void blk_rq_init(struct request_queue *q, struct request *rq) |
748 | rq->ref_count = 1; |
749 | rq->start_time = jiffies; |
750 | set_start_time_ns(rq); |
751 | + rq->part = NULL; |
752 | } |
753 | EXPORT_SYMBOL(blk_rq_init); |
754 | |
755 | @@ -1776,7 +1791,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes) |
756 | int cpu; |
757 | |
758 | cpu = part_stat_lock(); |
759 | - part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); |
760 | + part = req->part; |
761 | part_stat_add(cpu, part, sectors[rw], bytes >> 9); |
762 | part_stat_unlock(); |
763 | } |
764 | @@ -1796,13 +1811,14 @@ static void blk_account_io_done(struct request *req) |
765 | int cpu; |
766 | |
767 | cpu = part_stat_lock(); |
768 | - part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); |
769 | + part = req->part; |
770 | |
771 | part_stat_inc(cpu, part, ios[rw]); |
772 | part_stat_add(cpu, part, ticks[rw], duration); |
773 | part_round_stats(cpu, part); |
774 | part_dec_in_flight(part, rw); |
775 | |
776 | + kref_put(&part->ref, __delete_partition); |
777 | part_stat_unlock(); |
778 | } |
779 | } |
780 | diff --git a/block/blk-merge.c b/block/blk-merge.c |
781 | index 74bc4a7..23ea74b 100644 |
782 | --- a/block/blk-merge.c |
783 | +++ b/block/blk-merge.c |
784 | @@ -351,11 +351,12 @@ static void blk_account_io_merge(struct request *req) |
785 | int cpu; |
786 | |
787 | cpu = part_stat_lock(); |
788 | - part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); |
789 | + part = req->part; |
790 | |
791 | part_round_stats(cpu, part); |
792 | part_dec_in_flight(part, rq_data_dir(req)); |
793 | |
794 | + kref_put(&part->ref, __delete_partition); |
795 | part_stat_unlock(); |
796 | } |
797 | } |
798 | diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c |
799 | index 4cd59b0..6f2a966 100644 |
800 | --- a/block/cfq-iosched.c |
801 | +++ b/block/cfq-iosched.c |
802 | @@ -3412,6 +3412,10 @@ static bool cfq_should_wait_busy(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
803 | { |
804 | struct cfq_io_context *cic = cfqd->active_cic; |
805 | |
806 | + /* If the queue already has requests, don't wait */ |
807 | + if (!RB_EMPTY_ROOT(&cfqq->sort_list)) |
808 | + return false; |
809 | + |
810 | /* If there are other queues in the group, don't wait */ |
811 | if (cfqq->cfqg->nr_cfqq > 1) |
812 | return false; |
813 | diff --git a/block/genhd.c b/block/genhd.c |
814 | index 5fa2b44..0c55eae 100644 |
815 | --- a/block/genhd.c |
816 | +++ b/block/genhd.c |
817 | @@ -1192,6 +1192,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id) |
818 | return NULL; |
819 | } |
820 | disk->part_tbl->part[0] = &disk->part0; |
821 | + kref_init(&disk->part0.ref); |
822 | |
823 | disk->minors = minors; |
824 | rand_initialize_disk(disk); |
825 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
826 | index 66aa4be..f03ea29 100644 |
827 | --- a/drivers/ata/libata-scsi.c |
828 | +++ b/drivers/ata/libata-scsi.c |
829 | @@ -1102,9 +1102,9 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, |
830 | struct request_queue *q = sdev->request_queue; |
831 | void *buf; |
832 | |
833 | - /* set the min alignment and padding */ |
834 | - blk_queue_update_dma_alignment(sdev->request_queue, |
835 | - ATA_DMA_PAD_SZ - 1); |
836 | + sdev->sector_size = ATA_SECT_SIZE; |
837 | + |
838 | + /* set DMA padding */ |
839 | blk_queue_update_dma_pad(sdev->request_queue, |
840 | ATA_DMA_PAD_SZ - 1); |
841 | |
842 | @@ -1118,13 +1118,25 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, |
843 | |
844 | blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN); |
845 | } else { |
846 | - /* ATA devices must be sector aligned */ |
847 | sdev->sector_size = ata_id_logical_sector_size(dev->id); |
848 | - blk_queue_update_dma_alignment(sdev->request_queue, |
849 | - sdev->sector_size - 1); |
850 | sdev->manage_start_stop = 1; |
851 | } |
852 | |
853 | + /* |
854 | + * ata_pio_sectors() expects buffer for each sector to not cross |
855 | + * page boundary. Enforce it by requiring buffers to be sector |
856 | + * aligned, which works iff sector_size is not larger than |
857 | + * PAGE_SIZE. ATAPI devices also need the alignment as |
858 | + * IDENTIFY_PACKET is executed as ATA_PROT_PIO. |
859 | + */ |
860 | + if (sdev->sector_size > PAGE_SIZE) |
861 | + ata_dev_printk(dev, KERN_WARNING, |
862 | + "sector_size=%u > PAGE_SIZE, PIO may malfunction\n", |
863 | + sdev->sector_size); |
864 | + |
865 | + blk_queue_update_dma_alignment(sdev->request_queue, |
866 | + sdev->sector_size - 1); |
867 | + |
868 | if (dev->flags & ATA_DFLAG_AN) |
869 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); |
870 | |
871 | diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c |
872 | index 8cc536e..d7d8026 100644 |
873 | --- a/drivers/ata/pata_mpc52xx.c |
874 | +++ b/drivers/ata/pata_mpc52xx.c |
875 | @@ -610,7 +610,7 @@ static struct scsi_host_template mpc52xx_ata_sht = { |
876 | }; |
877 | |
878 | static struct ata_port_operations mpc52xx_ata_port_ops = { |
879 | - .inherits = &ata_sff_port_ops, |
880 | + .inherits = &ata_bmdma_port_ops, |
881 | .sff_dev_select = mpc52xx_ata_dev_select, |
882 | .set_piomode = mpc52xx_ata_set_piomode, |
883 | .set_dmamode = mpc52xx_ata_set_dmamode, |
884 | diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c |
885 | index 02c652b..6b2d409 100644 |
886 | --- a/drivers/base/power/runtime.c |
887 | +++ b/drivers/base/power/runtime.c |
888 | @@ -404,12 +404,15 @@ static int rpm_suspend(struct device *dev, int rpmflags) |
889 | goto out; |
890 | } |
891 | |
892 | + /* Maybe the parent is now able to suspend. */ |
893 | if (parent && !parent->power.ignore_children) { |
894 | - spin_unlock_irq(&dev->power.lock); |
895 | + spin_unlock(&dev->power.lock); |
896 | |
897 | - pm_request_idle(parent); |
898 | + spin_lock(&parent->power.lock); |
899 | + rpm_idle(parent, RPM_ASYNC); |
900 | + spin_unlock(&parent->power.lock); |
901 | |
902 | - spin_lock_irq(&dev->power.lock); |
903 | + spin_lock(&dev->power.lock); |
904 | } |
905 | |
906 | out: |
907 | diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
908 | index a32fb41..e6fc716 100644 |
909 | --- a/drivers/block/nbd.c |
910 | +++ b/drivers/block/nbd.c |
911 | @@ -53,7 +53,6 @@ |
912 | #define DBG_BLKDEV 0x0100 |
913 | #define DBG_RX 0x0200 |
914 | #define DBG_TX 0x0400 |
915 | -static DEFINE_MUTEX(nbd_mutex); |
916 | static unsigned int debugflags; |
917 | #endif /* NDEBUG */ |
918 | |
919 | @@ -718,11 +717,9 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode, |
920 | dprintk(DBG_IOCTL, "%s: nbd_ioctl cmd=%s(0x%x) arg=%lu\n", |
921 | lo->disk->disk_name, ioctl_cmd_to_ascii(cmd), cmd, arg); |
922 | |
923 | - mutex_lock(&nbd_mutex); |
924 | mutex_lock(&lo->tx_lock); |
925 | error = __nbd_ioctl(bdev, lo, cmd, arg); |
926 | mutex_unlock(&lo->tx_lock); |
927 | - mutex_unlock(&nbd_mutex); |
928 | |
929 | return error; |
930 | } |
931 | diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c |
932 | index e72f49d..2c9dca9 100644 |
933 | --- a/drivers/char/agp/intel-agp.c |
934 | +++ b/drivers/char/agp/intel-agp.c |
935 | @@ -774,20 +774,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, |
936 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
937 | |
938 | /* |
939 | - * If the device has not been properly setup, the following will catch |
940 | - * the problem and should stop the system from crashing. |
941 | - * 20030610 - hamish@zot.org |
942 | - */ |
943 | - if (pci_enable_device(pdev)) { |
944 | - dev_err(&pdev->dev, "can't enable PCI device\n"); |
945 | - agp_put_bridge(bridge); |
946 | - return -ENODEV; |
947 | - } |
948 | - |
949 | - /* |
950 | * The following fixes the case where the BIOS has "forgotten" to |
951 | * provide an address range for the GART. |
952 | * 20030610 - hamish@zot.org |
953 | + * This happens before pci_enable_device() intentionally; |
954 | + * calling pci_enable_device() before assigning the resource |
955 | + * will result in the GART being disabled on machines with such |
956 | + * BIOSs (the GART ends up with a BAR starting at 0, which |
957 | + * conflicts a lot of other devices). |
958 | */ |
959 | r = &pdev->resource[0]; |
960 | if (!r->start && r->end) { |
961 | @@ -798,6 +792,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, |
962 | } |
963 | } |
964 | |
965 | + /* |
966 | + * If the device has not been properly setup, the following will catch |
967 | + * the problem and should stop the system from crashing. |
968 | + * 20030610 - hamish@zot.org |
969 | + */ |
970 | + if (pci_enable_device(pdev)) { |
971 | + dev_err(&pdev->dev, "can't enable PCI device\n"); |
972 | + agp_put_bridge(bridge); |
973 | + return -ENODEV; |
974 | + } |
975 | + |
976 | /* Fill in the mode register */ |
977 | if (cap_ptr) { |
978 | pci_read_config_dword(pdev, |
979 | diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c |
980 | index 035da9e..2689ddb 100644 |
981 | --- a/drivers/char/ipmi/ipmi_si_intf.c |
982 | +++ b/drivers/char/ipmi/ipmi_si_intf.c |
983 | @@ -320,6 +320,7 @@ static int unload_when_empty = 1; |
984 | static int add_smi(struct smi_info *smi); |
985 | static int try_smi_init(struct smi_info *smi); |
986 | static void cleanup_one_si(struct smi_info *to_clean); |
987 | +static void cleanup_ipmi_si(void); |
988 | |
989 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); |
990 | static int register_xaction_notifier(struct notifier_block *nb) |
991 | @@ -3435,16 +3436,7 @@ static int __devinit init_ipmi_si(void) |
992 | mutex_lock(&smi_infos_lock); |
993 | if (unload_when_empty && list_empty(&smi_infos)) { |
994 | mutex_unlock(&smi_infos_lock); |
995 | -#ifdef CONFIG_PCI |
996 | - if (pci_registered) |
997 | - pci_unregister_driver(&ipmi_pci_driver); |
998 | -#endif |
999 | - |
1000 | -#ifdef CONFIG_PPC_OF |
1001 | - if (of_registered) |
1002 | - of_unregister_platform_driver(&ipmi_of_platform_driver); |
1003 | -#endif |
1004 | - driver_unregister(&ipmi_driver.driver); |
1005 | + cleanup_ipmi_si(); |
1006 | printk(KERN_WARNING PFX |
1007 | "Unable to find any System Interface(s)\n"); |
1008 | return -ENODEV; |
1009 | diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c |
1010 | index 7c41335..55d0466 100644 |
1011 | --- a/drivers/char/tpm/tpm.c |
1012 | +++ b/drivers/char/tpm/tpm.c |
1013 | @@ -364,12 +364,14 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, |
1014 | tpm_protected_ordinal_duration[ordinal & |
1015 | TPM_PROTECTED_ORDINAL_MASK]; |
1016 | |
1017 | - if (duration_idx != TPM_UNDEFINED) |
1018 | + if (duration_idx != TPM_UNDEFINED) { |
1019 | duration = chip->vendor.duration[duration_idx]; |
1020 | - if (duration <= 0) |
1021 | + /* if duration is 0, it's because chip->vendor.duration wasn't */ |
1022 | + /* filled yet, so we set the lowest timeout just to give enough */ |
1023 | + /* time for tpm_get_timeouts() to succeed */ |
1024 | + return (duration <= 0 ? HZ : duration); |
1025 | + } else |
1026 | return 2 * 60 * HZ; |
1027 | - else |
1028 | - return duration; |
1029 | } |
1030 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
1031 | |
1032 | @@ -575,9 +577,11 @@ duration: |
1033 | if (rc) |
1034 | return; |
1035 | |
1036 | - if (be32_to_cpu(tpm_cmd.header.out.return_code) |
1037 | - != 3 * sizeof(u32)) |
1038 | + if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
1039 | + be32_to_cpu(tpm_cmd.header.out.length) |
1040 | + != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) |
1041 | return; |
1042 | + |
1043 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
1044 | chip->vendor.duration[TPM_SHORT] = |
1045 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); |
1046 | @@ -921,6 +925,18 @@ ssize_t tpm_show_caps_1_2(struct device * dev, |
1047 | } |
1048 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); |
1049 | |
1050 | +ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr, |
1051 | + char *buf) |
1052 | +{ |
1053 | + struct tpm_chip *chip = dev_get_drvdata(dev); |
1054 | + |
1055 | + return sprintf(buf, "%d %d %d\n", |
1056 | + jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), |
1057 | + jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), |
1058 | + jiffies_to_usecs(chip->vendor.duration[TPM_LONG])); |
1059 | +} |
1060 | +EXPORT_SYMBOL_GPL(tpm_show_timeouts); |
1061 | + |
1062 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, |
1063 | const char *buf, size_t count) |
1064 | { |
1065 | diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
1066 | index 792868d..ba1779c 100644 |
1067 | --- a/drivers/char/tpm/tpm.h |
1068 | +++ b/drivers/char/tpm/tpm.h |
1069 | @@ -56,6 +56,8 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, |
1070 | char *); |
1071 | extern ssize_t tpm_show_temp_deactivated(struct device *, |
1072 | struct device_attribute *attr, char *); |
1073 | +extern ssize_t tpm_show_timeouts(struct device *, |
1074 | + struct device_attribute *attr, char *); |
1075 | |
1076 | struct tpm_chip; |
1077 | |
1078 | diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c |
1079 | index c17a305..0d1d38e 100644 |
1080 | --- a/drivers/char/tpm/tpm_tis.c |
1081 | +++ b/drivers/char/tpm/tpm_tis.c |
1082 | @@ -376,6 +376,7 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, |
1083 | NULL); |
1084 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); |
1085 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); |
1086 | +static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); |
1087 | |
1088 | static struct attribute *tis_attrs[] = { |
1089 | &dev_attr_pubek.attr, |
1090 | @@ -385,7 +386,8 @@ static struct attribute *tis_attrs[] = { |
1091 | &dev_attr_owned.attr, |
1092 | &dev_attr_temp_deactivated.attr, |
1093 | &dev_attr_caps.attr, |
1094 | - &dev_attr_cancel.attr, NULL, |
1095 | + &dev_attr_cancel.attr, |
1096 | + &dev_attr_timeouts.attr, NULL, |
1097 | }; |
1098 | |
1099 | static struct attribute_group tis_attr_grp = { |
1100 | @@ -493,9 +495,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, |
1101 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
1102 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
1103 | |
1104 | - if (is_itpm(to_pnp_dev(dev))) |
1105 | - itpm = 1; |
1106 | - |
1107 | if (itpm) |
1108 | dev_info(dev, "Intel iTPM workaround enabled\n"); |
1109 | |
1110 | @@ -637,6 +636,9 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, |
1111 | else |
1112 | interrupts = 0; |
1113 | |
1114 | + if (is_itpm(pnp_dev)) |
1115 | + itpm = 1; |
1116 | + |
1117 | return tpm_tis_init(&pnp_dev->dev, start, len, irq); |
1118 | } |
1119 | |
1120 | diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c |
1121 | index 896a2ce..ad2520b 100644 |
1122 | --- a/drivers/char/virtio_console.c |
1123 | +++ b/drivers/char/virtio_console.c |
1124 | @@ -1462,6 +1462,17 @@ static void control_work_handler(struct work_struct *work) |
1125 | spin_unlock(&portdev->cvq_lock); |
1126 | } |
1127 | |
1128 | +static void out_intr(struct virtqueue *vq) |
1129 | +{ |
1130 | + struct port *port; |
1131 | + |
1132 | + port = find_port_by_vq(vq->vdev->priv, vq); |
1133 | + if (!port) |
1134 | + return; |
1135 | + |
1136 | + wake_up_interruptible(&port->waitqueue); |
1137 | +} |
1138 | + |
1139 | static void in_intr(struct virtqueue *vq) |
1140 | { |
1141 | struct port *port; |
1142 | @@ -1566,7 +1577,7 @@ static int init_vqs(struct ports_device *portdev) |
1143 | */ |
1144 | j = 0; |
1145 | io_callbacks[j] = in_intr; |
1146 | - io_callbacks[j + 1] = NULL; |
1147 | + io_callbacks[j + 1] = out_intr; |
1148 | io_names[j] = "input"; |
1149 | io_names[j + 1] = "output"; |
1150 | j += 2; |
1151 | @@ -1580,7 +1591,7 @@ static int init_vqs(struct ports_device *portdev) |
1152 | for (i = 1; i < nr_ports; i++) { |
1153 | j += 2; |
1154 | io_callbacks[j] = in_intr; |
1155 | - io_callbacks[j + 1] = NULL; |
1156 | + io_callbacks[j + 1] = out_intr; |
1157 | io_names[j] = "input"; |
1158 | io_names[j + 1] = "output"; |
1159 | } |
1160 | diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c |
1161 | index a507108..97df791 100644 |
1162 | --- a/drivers/cpuidle/cpuidle.c |
1163 | +++ b/drivers/cpuidle/cpuidle.c |
1164 | @@ -154,6 +154,45 @@ void cpuidle_resume_and_unlock(void) |
1165 | |
1166 | EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock); |
1167 | |
1168 | +#ifdef CONFIG_ARCH_HAS_CPU_RELAX |
1169 | +static int poll_idle(struct cpuidle_device *dev, struct cpuidle_state *st) |
1170 | +{ |
1171 | + ktime_t t1, t2; |
1172 | + s64 diff; |
1173 | + int ret; |
1174 | + |
1175 | + t1 = ktime_get(); |
1176 | + local_irq_enable(); |
1177 | + while (!need_resched()) |
1178 | + cpu_relax(); |
1179 | + |
1180 | + t2 = ktime_get(); |
1181 | + diff = ktime_to_us(ktime_sub(t2, t1)); |
1182 | + if (diff > INT_MAX) |
1183 | + diff = INT_MAX; |
1184 | + |
1185 | + ret = (int) diff; |
1186 | + return ret; |
1187 | +} |
1188 | + |
1189 | +static void poll_idle_init(struct cpuidle_device *dev) |
1190 | +{ |
1191 | + struct cpuidle_state *state = &dev->states[0]; |
1192 | + |
1193 | + cpuidle_set_statedata(state, NULL); |
1194 | + |
1195 | + snprintf(state->name, CPUIDLE_NAME_LEN, "C0"); |
1196 | + snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE"); |
1197 | + state->exit_latency = 0; |
1198 | + state->target_residency = 0; |
1199 | + state->power_usage = -1; |
1200 | + state->flags = CPUIDLE_FLAG_POLL; |
1201 | + state->enter = poll_idle; |
1202 | +} |
1203 | +#else |
1204 | +static void poll_idle_init(struct cpuidle_device *dev) {} |
1205 | +#endif /* CONFIG_ARCH_HAS_CPU_RELAX */ |
1206 | + |
1207 | /** |
1208 | * cpuidle_enable_device - enables idle PM for a CPU |
1209 | * @dev: the CPU |
1210 | @@ -178,6 +217,8 @@ int cpuidle_enable_device(struct cpuidle_device *dev) |
1211 | return ret; |
1212 | } |
1213 | |
1214 | + poll_idle_init(dev); |
1215 | + |
1216 | if ((ret = cpuidle_add_state_sysfs(dev))) |
1217 | return ret; |
1218 | |
1219 | @@ -232,45 +273,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev) |
1220 | |
1221 | EXPORT_SYMBOL_GPL(cpuidle_disable_device); |
1222 | |
1223 | -#ifdef CONFIG_ARCH_HAS_CPU_RELAX |
1224 | -static int poll_idle(struct cpuidle_device *dev, struct cpuidle_state *st) |
1225 | -{ |
1226 | - ktime_t t1, t2; |
1227 | - s64 diff; |
1228 | - int ret; |
1229 | - |
1230 | - t1 = ktime_get(); |
1231 | - local_irq_enable(); |
1232 | - while (!need_resched()) |
1233 | - cpu_relax(); |
1234 | - |
1235 | - t2 = ktime_get(); |
1236 | - diff = ktime_to_us(ktime_sub(t2, t1)); |
1237 | - if (diff > INT_MAX) |
1238 | - diff = INT_MAX; |
1239 | - |
1240 | - ret = (int) diff; |
1241 | - return ret; |
1242 | -} |
1243 | - |
1244 | -static void poll_idle_init(struct cpuidle_device *dev) |
1245 | -{ |
1246 | - struct cpuidle_state *state = &dev->states[0]; |
1247 | - |
1248 | - cpuidle_set_statedata(state, NULL); |
1249 | - |
1250 | - snprintf(state->name, CPUIDLE_NAME_LEN, "C0"); |
1251 | - snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE"); |
1252 | - state->exit_latency = 0; |
1253 | - state->target_residency = 0; |
1254 | - state->power_usage = -1; |
1255 | - state->flags = CPUIDLE_FLAG_POLL; |
1256 | - state->enter = poll_idle; |
1257 | -} |
1258 | -#else |
1259 | -static void poll_idle_init(struct cpuidle_device *dev) {} |
1260 | -#endif /* CONFIG_ARCH_HAS_CPU_RELAX */ |
1261 | - |
1262 | /** |
1263 | * __cpuidle_register_device - internal register function called before register |
1264 | * and enable routines |
1265 | @@ -291,8 +293,6 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) |
1266 | |
1267 | init_completion(&dev->kobj_unregister); |
1268 | |
1269 | - poll_idle_init(dev); |
1270 | - |
1271 | /* |
1272 | * cpuidle driver should set the dev->power_specified bit |
1273 | * before registering the device if the driver provides |
1274 | diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c |
1275 | index be04923..24ff355 100644 |
1276 | --- a/drivers/firewire/core-card.c |
1277 | +++ b/drivers/firewire/core-card.c |
1278 | @@ -75,6 +75,8 @@ static size_t config_rom_length = 1 + 4 + 1 + 1; |
1279 | #define BIB_IRMC ((1) << 31) |
1280 | #define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ |
1281 | |
1282 | +#define CANON_OUI 0x000085 |
1283 | + |
1284 | static void generate_config_rom(struct fw_card *card, __be32 *config_rom) |
1285 | { |
1286 | struct fw_descriptor *desc; |
1287 | @@ -284,6 +286,7 @@ static void bm_work(struct work_struct *work) |
1288 | bool root_device_is_running; |
1289 | bool root_device_is_cmc; |
1290 | bool irm_is_1394_1995_only; |
1291 | + bool keep_this_irm; |
1292 | |
1293 | spin_lock_irq(&card->lock); |
1294 | |
1295 | @@ -305,6 +308,10 @@ static void bm_work(struct work_struct *work) |
1296 | irm_is_1394_1995_only = irm_device && irm_device->config_rom && |
1297 | (irm_device->config_rom[2] & 0x000000f0) == 0; |
1298 | |
1299 | + /* Canon MV5i works unreliably if it is not root node. */ |
1300 | + keep_this_irm = irm_device && irm_device->config_rom && |
1301 | + irm_device->config_rom[3] >> 8 == CANON_OUI; |
1302 | + |
1303 | root_id = root_node->node_id; |
1304 | irm_id = card->irm_node->node_id; |
1305 | local_id = card->local_node->node_id; |
1306 | @@ -333,7 +340,7 @@ static void bm_work(struct work_struct *work) |
1307 | goto pick_me; |
1308 | } |
1309 | |
1310 | - if (irm_is_1394_1995_only) { |
1311 | + if (irm_is_1394_1995_only && !keep_this_irm) { |
1312 | new_root_id = local_id; |
1313 | fw_notify("%s, making local node (%02x) root.\n", |
1314 | "IRM is not 1394a compliant", new_root_id); |
1315 | @@ -382,7 +389,7 @@ static void bm_work(struct work_struct *work) |
1316 | |
1317 | spin_lock_irq(&card->lock); |
1318 | |
1319 | - if (rcode != RCODE_COMPLETE) { |
1320 | + if (rcode != RCODE_COMPLETE && !keep_this_irm) { |
1321 | /* |
1322 | * The lock request failed, maybe the IRM |
1323 | * isn't really IRM capable after all. Let's |
1324 | diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c |
1325 | index e28e41668..bcb1126 100644 |
1326 | --- a/drivers/firmware/dmi_scan.c |
1327 | +++ b/drivers/firmware/dmi_scan.c |
1328 | @@ -378,10 +378,17 @@ static void __init print_filtered(const char *info) |
1329 | |
1330 | static void __init dmi_dump_ids(void) |
1331 | { |
1332 | + const char *board; /* Board Name is optional */ |
1333 | + |
1334 | printk(KERN_DEBUG "DMI: "); |
1335 | - print_filtered(dmi_get_system_info(DMI_BOARD_NAME)); |
1336 | - printk(KERN_CONT "/"); |
1337 | + print_filtered(dmi_get_system_info(DMI_SYS_VENDOR)); |
1338 | + printk(KERN_CONT " "); |
1339 | print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME)); |
1340 | + board = dmi_get_system_info(DMI_BOARD_NAME); |
1341 | + if (board) { |
1342 | + printk(KERN_CONT "/"); |
1343 | + print_filtered(board); |
1344 | + } |
1345 | printk(KERN_CONT ", BIOS "); |
1346 | print_filtered(dmi_get_system_info(DMI_BIOS_VERSION)); |
1347 | printk(KERN_CONT " "); |
1348 | diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig |
1349 | index 7af4436..7ea4bdd 100644 |
1350 | --- a/drivers/gpu/drm/Kconfig |
1351 | +++ b/drivers/gpu/drm/Kconfig |
1352 | @@ -100,7 +100,10 @@ config DRM_I830 |
1353 | config DRM_I915 |
1354 | tristate "i915 driver" |
1355 | depends on AGP_INTEL |
1356 | + # we need shmfs for the swappable backing store, and in particular |
1357 | + # the shmem_readpage() which depends upon tmpfs |
1358 | select SHMEM |
1359 | + select TMPFS |
1360 | select DRM_KMS_HELPER |
1361 | select FB_CFB_FILLRECT |
1362 | select FB_CFB_COPYAREA |
1363 | diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c |
1364 | index 2d4e17a..a0ce53d 100644 |
1365 | --- a/drivers/gpu/drm/drm_crtc_helper.c |
1366 | +++ b/drivers/gpu/drm/drm_crtc_helper.c |
1367 | @@ -650,9 +650,16 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) |
1368 | old_fb)) { |
1369 | DRM_ERROR("failed to set mode on [CRTC:%d]\n", |
1370 | set->crtc->base.id); |
1371 | + set->crtc->fb = old_fb; |
1372 | ret = -EINVAL; |
1373 | goto fail; |
1374 | } |
1375 | + DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); |
1376 | + for (i = 0; i < set->num_connectors; i++) { |
1377 | + DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, |
1378 | + drm_get_connector_name(set->connectors[i])); |
1379 | + set->connectors[i]->dpms = DRM_MODE_DPMS_ON; |
1380 | + } |
1381 | } |
1382 | drm_helper_disable_unused_functions(dev); |
1383 | } else if (fb_changed) { |
1384 | @@ -664,14 +671,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) |
1385 | set->crtc->fb = set->fb; |
1386 | ret = crtc_funcs->mode_set_base(set->crtc, |
1387 | set->x, set->y, old_fb); |
1388 | - if (ret != 0) |
1389 | + if (ret != 0) { |
1390 | + set->crtc->fb = old_fb; |
1391 | goto fail; |
1392 | - } |
1393 | - DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); |
1394 | - for (i = 0; i < set->num_connectors; i++) { |
1395 | - DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, |
1396 | - drm_get_connector_name(set->connectors[i])); |
1397 | - set->connectors[i]->dpms = DRM_MODE_DPMS_ON; |
1398 | + } |
1399 | } |
1400 | |
1401 | kfree(save_connectors); |
1402 | diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c |
1403 | index cb900dc..4916c10 100644 |
1404 | --- a/drivers/gpu/drm/i915/i915_dma.c |
1405 | +++ b/drivers/gpu/drm/i915/i915_dma.c |
1406 | @@ -1243,9 +1243,15 @@ static int i915_load_modeset_init(struct drm_device *dev, |
1407 | if (ret) |
1408 | DRM_INFO("failed to find VBIOS tables\n"); |
1409 | |
1410 | - /* if we have > 1 VGA cards, then disable the radeon VGA resources */ |
1411 | + /* If we have > 1 VGA cards, then we need to arbitrate access |
1412 | + * to the common VGA resources. |
1413 | + * |
1414 | + * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA), |
1415 | + * then we do not take part in VGA arbitration and the |
1416 | + * vga_client_register() fails with -ENODEV. |
1417 | + */ |
1418 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
1419 | - if (ret) |
1420 | + if (ret && ret != -ENODEV) |
1421 | goto cleanup_ringbuffer; |
1422 | |
1423 | intel_register_dsm_handler(); |
1424 | diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c |
1425 | index f737960..da769bc 100644 |
1426 | --- a/drivers/gpu/drm/i915/i915_drv.c |
1427 | +++ b/drivers/gpu/drm/i915/i915_drv.c |
1428 | @@ -54,7 +54,7 @@ extern int intel_agp_enabled; |
1429 | |
1430 | #define INTEL_VGA_DEVICE(id, info) { \ |
1431 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ |
1432 | - .class_mask = 0xffff00, \ |
1433 | + .class_mask = 0xff0000, \ |
1434 | .vendor = 0x8086, \ |
1435 | .device = id, \ |
1436 | .subvendor = PCI_ANY_ID, \ |
1437 | @@ -501,6 +501,14 @@ int i915_reset(struct drm_device *dev, u8 flags) |
1438 | static int __devinit |
1439 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1440 | { |
1441 | + /* Only bind to function 0 of the device. Early generations |
1442 | + * used function 1 as a placeholder for multi-head. This causes |
1443 | + * us confusion instead, especially on the systems where both |
1444 | + * functions have the same PCI-ID! |
1445 | + */ |
1446 | + if (PCI_FUNC(pdev->devfn)) |
1447 | + return -ENODEV; |
1448 | + |
1449 | return drm_get_pci_dev(pdev, ent, &driver); |
1450 | } |
1451 | |
1452 | diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h |
1453 | index 409826d..d2896eb 100644 |
1454 | --- a/drivers/gpu/drm/i915/i915_drv.h |
1455 | +++ b/drivers/gpu/drm/i915/i915_drv.h |
1456 | @@ -329,6 +329,7 @@ typedef struct drm_i915_private { |
1457 | |
1458 | /* LVDS info */ |
1459 | int backlight_level; /* restore backlight to this value */ |
1460 | + bool backlight_enabled; |
1461 | struct drm_display_mode *panel_fixed_mode; |
1462 | struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ |
1463 | struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ |
1464 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
1465 | index cb8f434..0a1b276 100644 |
1466 | --- a/drivers/gpu/drm/i915/i915_reg.h |
1467 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
1468 | @@ -3057,10 +3057,11 @@ |
1469 | #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22) |
1470 | #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22) |
1471 | /* SNB B-stepping */ |
1472 | -#define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22) |
1473 | -#define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22) |
1474 | -#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22) |
1475 | -#define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22) |
1476 | +#define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0<<22) |
1477 | +#define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1<<22) |
1478 | +#define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a<<22) |
1479 | +#define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39<<22) |
1480 | +#define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22) |
1481 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) |
1482 | |
1483 | #endif /* _I915_REG_H_ */ |
1484 | diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c |
1485 | index 8df5743..17035b8 100644 |
1486 | --- a/drivers/gpu/drm/i915/intel_crt.c |
1487 | +++ b/drivers/gpu/drm/i915/intel_crt.c |
1488 | @@ -30,6 +30,7 @@ |
1489 | #include "drm.h" |
1490 | #include "drm_crtc.h" |
1491 | #include "drm_crtc_helper.h" |
1492 | +#include "drm_edid.h" |
1493 | #include "intel_drv.h" |
1494 | #include "i915_drm.h" |
1495 | #include "i915_drv.h" |
1496 | @@ -287,8 +288,9 @@ static bool intel_crt_ddc_probe(struct drm_i915_private *dev_priv, int ddc_bus) |
1497 | return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1; |
1498 | } |
1499 | |
1500 | -static bool intel_crt_detect_ddc(struct intel_crt *crt) |
1501 | +static bool intel_crt_detect_ddc(struct drm_connector *connector) |
1502 | { |
1503 | + struct intel_crt *crt = intel_attached_crt(connector); |
1504 | struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private; |
1505 | |
1506 | /* CRT should always be at 0, but check anyway */ |
1507 | @@ -301,8 +303,26 @@ static bool intel_crt_detect_ddc(struct intel_crt *crt) |
1508 | } |
1509 | |
1510 | if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) { |
1511 | - DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); |
1512 | - return true; |
1513 | + struct edid *edid; |
1514 | + bool is_digital = false; |
1515 | + |
1516 | + edid = drm_get_edid(connector, |
1517 | + &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter); |
1518 | + /* |
1519 | + * This may be a DVI-I connector with a shared DDC |
1520 | + * link between analog and digital outputs, so we |
1521 | + * have to check the EDID input spec of the attached device. |
1522 | + */ |
1523 | + if (edid != NULL) { |
1524 | + is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; |
1525 | + connector->display_info.raw_edid = NULL; |
1526 | + kfree(edid); |
1527 | + } |
1528 | + |
1529 | + if (!is_digital) { |
1530 | + DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); |
1531 | + return true; |
1532 | + } |
1533 | } |
1534 | |
1535 | return false; |
1536 | @@ -458,7 +478,7 @@ intel_crt_detect(struct drm_connector *connector, bool force) |
1537 | } |
1538 | } |
1539 | |
1540 | - if (intel_crt_detect_ddc(crt)) |
1541 | + if (intel_crt_detect_ddc(connector)) |
1542 | return connector_status_connected; |
1543 | |
1544 | if (!force) |
1545 | @@ -472,7 +492,7 @@ intel_crt_detect(struct drm_connector *connector, bool force) |
1546 | crtc = intel_get_load_detect_pipe(&crt->base, connector, |
1547 | NULL, &dpms_mode); |
1548 | if (crtc) { |
1549 | - if (intel_crt_detect_ddc(crt)) |
1550 | + if (intel_crt_detect_ddc(connector)) |
1551 | status = connector_status_connected; |
1552 | else |
1553 | status = intel_crt_load_detect(crtc, crt); |
1554 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1555 | index fca5232..3abd904 100644 |
1556 | --- a/drivers/gpu/drm/i915/intel_display.c |
1557 | +++ b/drivers/gpu/drm/i915/intel_display.c |
1558 | @@ -3714,7 +3714,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, |
1559 | int lane = 0, link_bw, bpp; |
1560 | /* CPU eDP doesn't require FDI link, so just set DP M/N |
1561 | according to current link config */ |
1562 | - if (has_edp_encoder && !intel_encoder_is_pch_edp(&encoder->base)) { |
1563 | + if (has_edp_encoder && !intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
1564 | target_clock = mode->clock; |
1565 | intel_edp_link_config(has_edp_encoder, |
1566 | &lane, &link_bw); |
1567 | @@ -5498,6 +5498,8 @@ static void intel_setup_outputs(struct drm_device *dev) |
1568 | encoder->base.possible_clones = |
1569 | intel_encoder_clones(dev, encoder->clone_mask); |
1570 | } |
1571 | + |
1572 | + intel_panel_setup_backlight(dev); |
1573 | } |
1574 | |
1575 | static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb) |
1576 | diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c |
1577 | index 864417c..c1f13bf 100644 |
1578 | --- a/drivers/gpu/drm/i915/intel_dp.c |
1579 | +++ b/drivers/gpu/drm/i915/intel_dp.c |
1580 | @@ -1153,18 +1153,27 @@ intel_dp_signal_levels(uint8_t train_set, int lane_count) |
1581 | static uint32_t |
1582 | intel_gen6_edp_signal_levels(uint8_t train_set) |
1583 | { |
1584 | - switch (train_set & (DP_TRAIN_VOLTAGE_SWING_MASK|DP_TRAIN_PRE_EMPHASIS_MASK)) { |
1585 | + int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK | |
1586 | + DP_TRAIN_PRE_EMPHASIS_MASK); |
1587 | + switch (signal_levels) { |
1588 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: |
1589 | - return EDP_LINK_TRAIN_400MV_0DB_SNB_B; |
1590 | + case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0: |
1591 | + return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B; |
1592 | + case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5: |
1593 | + return EDP_LINK_TRAIN_400MV_3_5DB_SNB_B; |
1594 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: |
1595 | - return EDP_LINK_TRAIN_400MV_6DB_SNB_B; |
1596 | + case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_6: |
1597 | + return EDP_LINK_TRAIN_400_600MV_6DB_SNB_B; |
1598 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: |
1599 | - return EDP_LINK_TRAIN_600MV_3_5DB_SNB_B; |
1600 | + case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5: |
1601 | + return EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B; |
1602 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: |
1603 | - return EDP_LINK_TRAIN_800MV_0DB_SNB_B; |
1604 | + case DP_TRAIN_VOLTAGE_SWING_1200 | DP_TRAIN_PRE_EMPHASIS_0: |
1605 | + return EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B; |
1606 | default: |
1607 | - DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level\n"); |
1608 | - return EDP_LINK_TRAIN_400MV_0DB_SNB_B; |
1609 | + DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:" |
1610 | + "0x%x\n", signal_levels); |
1611 | + return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B; |
1612 | } |
1613 | } |
1614 | |
1615 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
1616 | index e52c612..1e68293 100644 |
1617 | --- a/drivers/gpu/drm/i915/intel_drv.h |
1618 | +++ b/drivers/gpu/drm/i915/intel_drv.h |
1619 | @@ -256,6 +256,9 @@ extern void intel_pch_panel_fitting(struct drm_device *dev, |
1620 | extern u32 intel_panel_get_max_backlight(struct drm_device *dev); |
1621 | extern u32 intel_panel_get_backlight(struct drm_device *dev); |
1622 | extern void intel_panel_set_backlight(struct drm_device *dev, u32 level); |
1623 | +extern void intel_panel_setup_backlight(struct drm_device *dev); |
1624 | +extern void intel_panel_enable_backlight(struct drm_device *dev); |
1625 | +extern void intel_panel_disable_backlight(struct drm_device *dev); |
1626 | |
1627 | extern void intel_crtc_load_lut(struct drm_crtc *crtc); |
1628 | extern void intel_encoder_prepare (struct drm_encoder *encoder); |
1629 | diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c |
1630 | index 25bcedf..fe779b3 100644 |
1631 | --- a/drivers/gpu/drm/i915/intel_lvds.c |
1632 | +++ b/drivers/gpu/drm/i915/intel_lvds.c |
1633 | @@ -106,7 +106,7 @@ static void intel_lvds_enable(struct intel_lvds *intel_lvds) |
1634 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON); |
1635 | POSTING_READ(lvds_reg); |
1636 | |
1637 | - intel_panel_set_backlight(dev, dev_priv->backlight_level); |
1638 | + intel_panel_enable_backlight(dev); |
1639 | } |
1640 | |
1641 | static void intel_lvds_disable(struct intel_lvds *intel_lvds) |
1642 | @@ -123,8 +123,7 @@ static void intel_lvds_disable(struct intel_lvds *intel_lvds) |
1643 | lvds_reg = LVDS; |
1644 | } |
1645 | |
1646 | - dev_priv->backlight_level = intel_panel_get_backlight(dev); |
1647 | - intel_panel_set_backlight(dev, 0); |
1648 | + intel_panel_disable_backlight(dev); |
1649 | |
1650 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); |
1651 | |
1652 | @@ -395,8 +394,6 @@ static void intel_lvds_prepare(struct drm_encoder *encoder) |
1653 | struct drm_i915_private *dev_priv = dev->dev_private; |
1654 | struct intel_lvds *intel_lvds = to_intel_lvds(encoder); |
1655 | |
1656 | - dev_priv->backlight_level = intel_panel_get_backlight(dev); |
1657 | - |
1658 | /* We try to do the minimum that is necessary in order to unlock |
1659 | * the registers for mode setting. |
1660 | * |
1661 | @@ -427,9 +424,6 @@ static void intel_lvds_commit(struct drm_encoder *encoder) |
1662 | struct drm_i915_private *dev_priv = dev->dev_private; |
1663 | struct intel_lvds *intel_lvds = to_intel_lvds(encoder); |
1664 | |
1665 | - if (dev_priv->backlight_level == 0) |
1666 | - dev_priv->backlight_level = intel_panel_get_max_backlight(dev); |
1667 | - |
1668 | /* Undo any unlocking done in prepare to prevent accidental |
1669 | * adjustment of the registers. |
1670 | */ |
1671 | @@ -703,6 +697,14 @@ static const struct dmi_system_id intel_no_lvds[] = { |
1672 | }, |
1673 | { |
1674 | .callback = intel_no_lvds_dmi_callback, |
1675 | + .ident = "AOpen i915GMm-HFS", |
1676 | + .matches = { |
1677 | + DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), |
1678 | + DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
1679 | + }, |
1680 | + }, |
1681 | + { |
1682 | + .callback = intel_no_lvds_dmi_callback, |
1683 | .ident = "Aopen i945GTt-VFA", |
1684 | .matches = { |
1685 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), |
1686 | diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c |
1687 | index 92ff8f3..0df86b5 100644 |
1688 | --- a/drivers/gpu/drm/i915/intel_panel.c |
1689 | +++ b/drivers/gpu/drm/i915/intel_panel.c |
1690 | @@ -218,3 +218,34 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level) |
1691 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; |
1692 | I915_WRITE(BLC_PWM_CTL, tmp | level); |
1693 | } |
1694 | + |
1695 | +void intel_panel_disable_backlight(struct drm_device *dev) |
1696 | +{ |
1697 | + struct drm_i915_private *dev_priv = dev->dev_private; |
1698 | + |
1699 | + if (dev_priv->backlight_enabled) { |
1700 | + dev_priv->backlight_level = intel_panel_get_backlight(dev); |
1701 | + dev_priv->backlight_enabled = false; |
1702 | + } |
1703 | + |
1704 | + intel_panel_set_backlight(dev, 0); |
1705 | +} |
1706 | + |
1707 | +void intel_panel_enable_backlight(struct drm_device *dev) |
1708 | +{ |
1709 | + struct drm_i915_private *dev_priv = dev->dev_private; |
1710 | + |
1711 | + if (dev_priv->backlight_level == 0) |
1712 | + dev_priv->backlight_level = intel_panel_get_max_backlight(dev); |
1713 | + |
1714 | + intel_panel_set_backlight(dev, dev_priv->backlight_level); |
1715 | + dev_priv->backlight_enabled = true; |
1716 | +} |
1717 | + |
1718 | +void intel_panel_setup_backlight(struct drm_device *dev) |
1719 | +{ |
1720 | + struct drm_i915_private *dev_priv = dev->dev_private; |
1721 | + |
1722 | + dev_priv->backlight_level = intel_panel_get_backlight(dev); |
1723 | + dev_priv->backlight_enabled = dev_priv->backlight_level != 0; |
1724 | +} |
1725 | diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c |
1726 | index 6bc42fa..920ca27 100644 |
1727 | --- a/drivers/gpu/drm/i915/intel_sdvo.c |
1728 | +++ b/drivers/gpu/drm/i915/intel_sdvo.c |
1729 | @@ -1024,9 +1024,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, |
1730 | if (!intel_sdvo_set_target_input(intel_sdvo)) |
1731 | return; |
1732 | |
1733 | - if (intel_sdvo->has_hdmi_monitor && |
1734 | - !intel_sdvo_set_avi_infoframe(intel_sdvo)) |
1735 | - return; |
1736 | + if (intel_sdvo->has_hdmi_monitor) { |
1737 | + intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); |
1738 | + intel_sdvo_set_colorimetry(intel_sdvo, |
1739 | + SDVO_COLORIMETRY_RGB256); |
1740 | + intel_sdvo_set_avi_infoframe(intel_sdvo); |
1741 | + } else |
1742 | + intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI); |
1743 | |
1744 | if (intel_sdvo->is_tv && |
1745 | !intel_sdvo_set_tv_format(intel_sdvo)) |
1746 | @@ -1395,6 +1399,9 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) |
1747 | |
1748 | intel_sdvo->attached_output = response; |
1749 | |
1750 | + intel_sdvo->has_hdmi_monitor = false; |
1751 | + intel_sdvo->has_hdmi_audio = false; |
1752 | + |
1753 | if ((intel_sdvo_connector->output_flag & response) == 0) |
1754 | ret = connector_status_disconnected; |
1755 | else if (response & SDVO_TMDS_MASK) |
1756 | @@ -1919,20 +1926,7 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv, |
1757 | static bool |
1758 | intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device) |
1759 | { |
1760 | - int is_hdmi; |
1761 | - |
1762 | - if (!intel_sdvo_check_supp_encode(intel_sdvo)) |
1763 | - return false; |
1764 | - |
1765 | - if (!intel_sdvo_set_target_output(intel_sdvo, |
1766 | - device == 0 ? SDVO_OUTPUT_TMDS0 : SDVO_OUTPUT_TMDS1)) |
1767 | - return false; |
1768 | - |
1769 | - is_hdmi = 0; |
1770 | - if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE, &is_hdmi, 1)) |
1771 | - return false; |
1772 | - |
1773 | - return !!is_hdmi; |
1774 | + return intel_sdvo_check_supp_encode(intel_sdvo); |
1775 | } |
1776 | |
1777 | static u8 |
1778 | @@ -2034,12 +2028,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) |
1779 | connector->connector_type = DRM_MODE_CONNECTOR_DVID; |
1780 | |
1781 | if (intel_sdvo_is_hdmi_connector(intel_sdvo, device)) { |
1782 | - /* enable hdmi encoding mode if supported */ |
1783 | - intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); |
1784 | - intel_sdvo_set_colorimetry(intel_sdvo, |
1785 | - SDVO_COLORIMETRY_RGB256); |
1786 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; |
1787 | - |
1788 | intel_sdvo->is_hdmi = true; |
1789 | } |
1790 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | |
1791 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c |
1792 | index 9fbabaa..6b7fc4b 100644 |
1793 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c |
1794 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c |
1795 | @@ -531,6 +531,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, |
1796 | dp_clock = dig_connector->dp_clock; |
1797 | } |
1798 | } |
1799 | +/* this might work properly with the new pll algo */ |
1800 | #if 0 /* doesn't work properly on some laptops */ |
1801 | /* use recommended ref_div for ss */ |
1802 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
1803 | @@ -548,6 +549,11 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, |
1804 | adjusted_clock = mode->clock * 2; |
1805 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
1806 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; |
1807 | + /* rv515 needs more testing with this option */ |
1808 | + if (rdev->family != CHIP_RV515) { |
1809 | + if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) |
1810 | + pll->flags |= RADEON_PLL_IS_LCD; |
1811 | + } |
1812 | } else { |
1813 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
1814 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; |
1815 | @@ -915,8 +921,16 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode |
1816 | /* adjust pixel clock as needed */ |
1817 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); |
1818 | |
1819 | - radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
1820 | - &ref_div, &post_div); |
1821 | + /* rv515 seems happier with the old algo */ |
1822 | + if (rdev->family == CHIP_RV515) |
1823 | + radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
1824 | + &ref_div, &post_div); |
1825 | + else if (ASIC_IS_AVIVO(rdev)) |
1826 | + radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
1827 | + &ref_div, &post_div); |
1828 | + else |
1829 | + radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
1830 | + &ref_div, &post_div); |
1831 | |
1832 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); |
1833 | |
1834 | diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c |
1835 | index 4e7778d..695de9a 100644 |
1836 | --- a/drivers/gpu/drm/radeon/atombios_dp.c |
1837 | +++ b/drivers/gpu/drm/radeon/atombios_dp.c |
1838 | @@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock) |
1839 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) |
1840 | { |
1841 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); |
1842 | - int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); |
1843 | + int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock); |
1844 | |
1845 | - if ((lanes == 0) || (bw == 0)) |
1846 | + if ((lanes == 0) || (dp_clock == 0)) |
1847 | return MODE_CLOCK_HIGH; |
1848 | |
1849 | return MODE_OK; |
1850 | diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c |
1851 | index 7b337c3..cff593d 100644 |
1852 | --- a/drivers/gpu/drm/radeon/evergreen.c |
1853 | +++ b/drivers/gpu/drm/radeon/evergreen.c |
1854 | @@ -1135,7 +1135,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) |
1855 | cp_me = 0xff; |
1856 | WREG32(CP_ME_CNTL, cp_me); |
1857 | |
1858 | - r = radeon_ring_lock(rdev, evergreen_default_size + 15); |
1859 | + r = radeon_ring_lock(rdev, evergreen_default_size + 19); |
1860 | if (r) { |
1861 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
1862 | return r; |
1863 | @@ -1168,6 +1168,11 @@ static int evergreen_cp_start(struct radeon_device *rdev) |
1864 | radeon_ring_write(rdev, 0xffffffff); |
1865 | radeon_ring_write(rdev, 0xffffffff); |
1866 | |
1867 | + radeon_ring_write(rdev, 0xc0026900); |
1868 | + radeon_ring_write(rdev, 0x00000316); |
1869 | + radeon_ring_write(rdev, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
1870 | + radeon_ring_write(rdev, 0x00000010); /* */ |
1871 | + |
1872 | radeon_ring_unlock_commit(rdev); |
1873 | |
1874 | return 0; |
1875 | diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c |
1876 | index e0e5901..a2cfead 100644 |
1877 | --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c |
1878 | +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c |
1879 | @@ -230,7 +230,7 @@ draw_auto(struct radeon_device *rdev) |
1880 | |
1881 | } |
1882 | |
1883 | -/* emits 30 */ |
1884 | +/* emits 34 */ |
1885 | static void |
1886 | set_default_state(struct radeon_device *rdev) |
1887 | { |
1888 | @@ -243,6 +243,8 @@ set_default_state(struct radeon_device *rdev) |
1889 | int num_hs_threads, num_ls_threads; |
1890 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; |
1891 | int num_hs_stack_entries, num_ls_stack_entries; |
1892 | + u64 gpu_addr; |
1893 | + int dwords; |
1894 | |
1895 | switch (rdev->family) { |
1896 | case CHIP_CEDAR: |
1897 | @@ -409,6 +411,14 @@ set_default_state(struct radeon_device *rdev) |
1898 | radeon_ring_write(rdev, 0x00000000); |
1899 | radeon_ring_write(rdev, 0x00000000); |
1900 | |
1901 | + /* emit an IB pointing at default state */ |
1902 | + dwords = ALIGN(rdev->r600_blit.state_len, 0x10); |
1903 | + gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; |
1904 | + radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
1905 | + radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); |
1906 | + radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); |
1907 | + radeon_ring_write(rdev, dwords); |
1908 | + |
1909 | } |
1910 | |
1911 | static inline uint32_t i2f(uint32_t input) |
1912 | @@ -439,8 +449,10 @@ static inline uint32_t i2f(uint32_t input) |
1913 | int evergreen_blit_init(struct radeon_device *rdev) |
1914 | { |
1915 | u32 obj_size; |
1916 | - int r; |
1917 | + int r, dwords; |
1918 | void *ptr; |
1919 | + u32 packet2s[16]; |
1920 | + int num_packet2s = 0; |
1921 | |
1922 | /* pin copy shader into vram if already initialized */ |
1923 | if (rdev->r600_blit.shader_obj) |
1924 | @@ -448,8 +460,17 @@ int evergreen_blit_init(struct radeon_device *rdev) |
1925 | |
1926 | mutex_init(&rdev->r600_blit.mutex); |
1927 | rdev->r600_blit.state_offset = 0; |
1928 | - rdev->r600_blit.state_len = 0; |
1929 | - obj_size = 0; |
1930 | + |
1931 | + rdev->r600_blit.state_len = evergreen_default_size; |
1932 | + |
1933 | + dwords = rdev->r600_blit.state_len; |
1934 | + while (dwords & 0xf) { |
1935 | + packet2s[num_packet2s++] = PACKET2(0); |
1936 | + dwords++; |
1937 | + } |
1938 | + |
1939 | + obj_size = dwords * 4; |
1940 | + obj_size = ALIGN(obj_size, 256); |
1941 | |
1942 | rdev->r600_blit.vs_offset = obj_size; |
1943 | obj_size += evergreen_vs_size * 4; |
1944 | @@ -479,6 +500,12 @@ int evergreen_blit_init(struct radeon_device *rdev) |
1945 | return r; |
1946 | } |
1947 | |
1948 | + memcpy_toio(ptr + rdev->r600_blit.state_offset, |
1949 | + evergreen_default_state, rdev->r600_blit.state_len * 4); |
1950 | + |
1951 | + if (num_packet2s) |
1952 | + memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), |
1953 | + packet2s, num_packet2s * 4); |
1954 | memcpy(ptr + rdev->r600_blit.vs_offset, evergreen_vs, evergreen_vs_size * 4); |
1955 | memcpy(ptr + rdev->r600_blit.ps_offset, evergreen_ps, evergreen_ps_size * 4); |
1956 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
1957 | @@ -564,7 +591,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) |
1958 | /* calculate number of loops correctly */ |
1959 | ring_size = num_loops * dwords_per_loop; |
1960 | /* set default + shaders */ |
1961 | - ring_size += 46; /* shaders + def state */ |
1962 | + ring_size += 50; /* shaders + def state */ |
1963 | ring_size += 10; /* fence emit for VB IB */ |
1964 | ring_size += 5; /* done copy */ |
1965 | ring_size += 10; /* fence emit for done copy */ |
1966 | @@ -572,7 +599,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) |
1967 | if (r) |
1968 | return r; |
1969 | |
1970 | - set_default_state(rdev); /* 30 */ |
1971 | + set_default_state(rdev); /* 34 */ |
1972 | set_shaders(rdev); /* 16 */ |
1973 | return 0; |
1974 | } |
1975 | diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c |
1976 | index bc5a2c3..57b9de3 100644 |
1977 | --- a/drivers/gpu/drm/radeon/radeon_atombios.c |
1978 | +++ b/drivers/gpu/drm/radeon/radeon_atombios.c |
1979 | @@ -313,7 +313,6 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, |
1980 | uint16_t *line_mux, |
1981 | struct radeon_hpd *hpd) |
1982 | { |
1983 | - struct radeon_device *rdev = dev->dev_private; |
1984 | |
1985 | /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ |
1986 | if ((dev->pdev->device == 0x791e) && |
1987 | @@ -388,6 +387,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, |
1988 | *line_mux = 0x90; |
1989 | } |
1990 | |
1991 | + /* mac rv630, rv730, others */ |
1992 | + if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) && |
1993 | + (*connector_type == DRM_MODE_CONNECTOR_DVII)) { |
1994 | + *connector_type = DRM_MODE_CONNECTOR_9PinDIN; |
1995 | + *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1; |
1996 | + } |
1997 | + |
1998 | /* ASUS HD 3600 XT board lists the DVI port as HDMI */ |
1999 | if ((dev->pdev->device == 0x9598) && |
2000 | (dev->pdev->subsystem_vendor == 0x1043) && |
2001 | @@ -425,21 +431,23 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, |
2002 | } |
2003 | } |
2004 | |
2005 | - /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */ |
2006 | + /* Acer laptop (Acer TravelMate 5730G) has an HDMI port |
2007 | + * on the laptop and a DVI port on the docking station and |
2008 | + * both share the same encoder, hpd pin, and ddc line. |
2009 | + * So while the bios table is technically correct, |
2010 | + * we drop the DVI port here since xrandr has no concept of |
2011 | + * encoders and will try and drive both connectors |
2012 | + * with different crtcs which isn't possible on the hardware |
2013 | + * side and leaves no crtcs for LVDS or VGA. |
2014 | + */ |
2015 | if ((dev->pdev->device == 0x95c4) && |
2016 | (dev->pdev->subsystem_vendor == 0x1025) && |
2017 | (dev->pdev->subsystem_device == 0x013c)) { |
2018 | - struct radeon_gpio_rec gpio; |
2019 | - |
2020 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && |
2021 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { |
2022 | - gpio = radeon_lookup_gpio(rdev, 6); |
2023 | - *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio); |
2024 | + /* actually it's a DVI-D port not DVI-I */ |
2025 | *connector_type = DRM_MODE_CONNECTOR_DVID; |
2026 | - } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && |
2027 | - (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { |
2028 | - gpio = radeon_lookup_gpio(rdev, 7); |
2029 | - *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio); |
2030 | + return false; |
2031 | } |
2032 | } |
2033 | |
2034 | @@ -1128,16 +1136,6 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) |
2035 | p1pll->pll_out_min = 64800; |
2036 | else |
2037 | p1pll->pll_out_min = 20000; |
2038 | - } else if (p1pll->pll_out_min > 64800) { |
2039 | - /* Limiting the pll output range is a good thing generally as |
2040 | - * it limits the number of possible pll combinations for a given |
2041 | - * frequency presumably to the ones that work best on each card. |
2042 | - * However, certain duallink DVI monitors seem to like |
2043 | - * pll combinations that would be limited by this at least on |
2044 | - * pre-DCE 3.0 r6xx hardware. This might need to be adjusted per |
2045 | - * family. |
2046 | - */ |
2047 | - p1pll->pll_out_min = 64800; |
2048 | } |
2049 | |
2050 | p1pll->pll_in_min = |
2051 | @@ -2359,7 +2357,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) |
2052 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; |
2053 | |
2054 | /* tell the bios not to handle mode switching */ |
2055 | - bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); |
2056 | + bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; |
2057 | |
2058 | if (rdev->family >= CHIP_R600) { |
2059 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); |
2060 | @@ -2410,10 +2408,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock) |
2061 | else |
2062 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); |
2063 | |
2064 | - if (lock) |
2065 | + if (lock) { |
2066 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; |
2067 | - else |
2068 | + bios_6_scratch &= ~ATOM_S6_ACC_MODE; |
2069 | + } else { |
2070 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; |
2071 | + bios_6_scratch |= ATOM_S6_ACC_MODE; |
2072 | + } |
2073 | |
2074 | if (rdev->family >= CHIP_R600) |
2075 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); |
2076 | diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
2077 | index 1df4dc6..a26a70d 100644 |
2078 | --- a/drivers/gpu/drm/radeon/radeon_display.c |
2079 | +++ b/drivers/gpu/drm/radeon/radeon_display.c |
2080 | @@ -448,6 +448,115 @@ static int radeon_ddc_dump(struct drm_connector *connector) |
2081 | return ret; |
2082 | } |
2083 | |
2084 | +/* avivo */ |
2085 | +static void avivo_get_fb_div(struct radeon_pll *pll, |
2086 | + u32 target_clock, |
2087 | + u32 post_div, |
2088 | + u32 ref_div, |
2089 | + u32 *fb_div, |
2090 | + u32 *frac_fb_div) |
2091 | +{ |
2092 | + u32 tmp = post_div * ref_div; |
2093 | + |
2094 | + tmp *= target_clock; |
2095 | + *fb_div = tmp / pll->reference_freq; |
2096 | + *frac_fb_div = tmp % pll->reference_freq; |
2097 | +} |
2098 | + |
2099 | +static u32 avivo_get_post_div(struct radeon_pll *pll, |
2100 | + u32 target_clock) |
2101 | +{ |
2102 | + u32 vco, post_div, tmp; |
2103 | + |
2104 | + if (pll->flags & RADEON_PLL_USE_POST_DIV) |
2105 | + return pll->post_div; |
2106 | + |
2107 | + if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP) { |
2108 | + if (pll->flags & RADEON_PLL_IS_LCD) |
2109 | + vco = pll->lcd_pll_out_min; |
2110 | + else |
2111 | + vco = pll->pll_out_min; |
2112 | + } else { |
2113 | + if (pll->flags & RADEON_PLL_IS_LCD) |
2114 | + vco = pll->lcd_pll_out_max; |
2115 | + else |
2116 | + vco = pll->pll_out_max; |
2117 | + } |
2118 | + |
2119 | + post_div = vco / target_clock; |
2120 | + tmp = vco % target_clock; |
2121 | + |
2122 | + if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP) { |
2123 | + if (tmp) |
2124 | + post_div++; |
2125 | + } else { |
2126 | + if (!tmp) |
2127 | + post_div--; |
2128 | + } |
2129 | + |
2130 | + return post_div; |
2131 | +} |
2132 | + |
2133 | +#define MAX_TOLERANCE 10 |
2134 | + |
2135 | +void radeon_compute_pll_avivo(struct radeon_pll *pll, |
2136 | + u32 freq, |
2137 | + u32 *dot_clock_p, |
2138 | + u32 *fb_div_p, |
2139 | + u32 *frac_fb_div_p, |
2140 | + u32 *ref_div_p, |
2141 | + u32 *post_div_p) |
2142 | +{ |
2143 | + u32 target_clock = freq / 10; |
2144 | + u32 post_div = avivo_get_post_div(pll, target_clock); |
2145 | + u32 ref_div = pll->min_ref_div; |
2146 | + u32 fb_div = 0, frac_fb_div = 0, tmp; |
2147 | + |
2148 | + if (pll->flags & RADEON_PLL_USE_REF_DIV) |
2149 | + ref_div = pll->reference_div; |
2150 | + |
2151 | + if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { |
2152 | + avivo_get_fb_div(pll, target_clock, post_div, ref_div, &fb_div, &frac_fb_div); |
2153 | + frac_fb_div = (100 * frac_fb_div) / pll->reference_freq; |
2154 | + if (frac_fb_div >= 5) { |
2155 | + frac_fb_div -= 5; |
2156 | + frac_fb_div = frac_fb_div / 10; |
2157 | + frac_fb_div++; |
2158 | + } |
2159 | + if (frac_fb_div >= 10) { |
2160 | + fb_div++; |
2161 | + frac_fb_div = 0; |
2162 | + } |
2163 | + } else { |
2164 | + while (ref_div <= pll->max_ref_div) { |
2165 | + avivo_get_fb_div(pll, target_clock, post_div, ref_div, |
2166 | + &fb_div, &frac_fb_div); |
2167 | + if (frac_fb_div >= (pll->reference_freq / 2)) |
2168 | + fb_div++; |
2169 | + frac_fb_div = 0; |
2170 | + tmp = (pll->reference_freq * fb_div) / (post_div * ref_div); |
2171 | + tmp = (tmp * 10000) / target_clock; |
2172 | + |
2173 | + if (tmp > (10000 + MAX_TOLERANCE)) |
2174 | + ref_div++; |
2175 | + else if (tmp >= (10000 - MAX_TOLERANCE)) |
2176 | + break; |
2177 | + else |
2178 | + ref_div++; |
2179 | + } |
2180 | + } |
2181 | + |
2182 | + *dot_clock_p = ((pll->reference_freq * fb_div * 10) + (pll->reference_freq * frac_fb_div)) / |
2183 | + (ref_div * post_div * 10); |
2184 | + *fb_div_p = fb_div; |
2185 | + *frac_fb_div_p = frac_fb_div; |
2186 | + *ref_div_p = ref_div; |
2187 | + *post_div_p = post_div; |
2188 | + DRM_DEBUG_KMS("%d, pll dividers - fb: %d.%d ref: %d, post %d\n", |
2189 | + *dot_clock_p, fb_div, frac_fb_div, ref_div, post_div); |
2190 | +} |
2191 | + |
2192 | +/* pre-avivo */ |
2193 | static inline uint32_t radeon_div(uint64_t n, uint32_t d) |
2194 | { |
2195 | uint64_t mod; |
2196 | @@ -458,13 +567,13 @@ static inline uint32_t radeon_div(uint64_t n, uint32_t d) |
2197 | return n; |
2198 | } |
2199 | |
2200 | -void radeon_compute_pll(struct radeon_pll *pll, |
2201 | - uint64_t freq, |
2202 | - uint32_t *dot_clock_p, |
2203 | - uint32_t *fb_div_p, |
2204 | - uint32_t *frac_fb_div_p, |
2205 | - uint32_t *ref_div_p, |
2206 | - uint32_t *post_div_p) |
2207 | +void radeon_compute_pll_legacy(struct radeon_pll *pll, |
2208 | + uint64_t freq, |
2209 | + uint32_t *dot_clock_p, |
2210 | + uint32_t *fb_div_p, |
2211 | + uint32_t *frac_fb_div_p, |
2212 | + uint32_t *ref_div_p, |
2213 | + uint32_t *post_div_p) |
2214 | { |
2215 | uint32_t min_ref_div = pll->min_ref_div; |
2216 | uint32_t max_ref_div = pll->max_ref_div; |
2217 | @@ -494,6 +603,9 @@ void radeon_compute_pll(struct radeon_pll *pll, |
2218 | pll_out_max = pll->pll_out_max; |
2219 | } |
2220 | |
2221 | + if (pll_out_min > 64800) |
2222 | + pll_out_min = 64800; |
2223 | + |
2224 | if (pll->flags & RADEON_PLL_USE_REF_DIV) |
2225 | min_ref_div = max_ref_div = pll->reference_div; |
2226 | else { |
2227 | @@ -517,7 +629,7 @@ void radeon_compute_pll(struct radeon_pll *pll, |
2228 | max_fractional_feed_div = pll->max_frac_feedback_div; |
2229 | } |
2230 | |
2231 | - for (post_div = max_post_div; post_div >= min_post_div; --post_div) { |
2232 | + for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { |
2233 | uint32_t ref_div; |
2234 | |
2235 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) |
2236 | @@ -633,6 +745,10 @@ void radeon_compute_pll(struct radeon_pll *pll, |
2237 | *frac_fb_div_p = best_frac_feedback_div; |
2238 | *ref_div_p = best_ref_div; |
2239 | *post_div_p = best_post_div; |
2240 | + DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n", |
2241 | + freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div, |
2242 | + best_ref_div, best_post_div); |
2243 | + |
2244 | } |
2245 | |
2246 | static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) |
2247 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
2248 | index ace2e63..cf0638c 100644 |
2249 | --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
2250 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
2251 | @@ -778,9 +778,9 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) |
2252 | DRM_DEBUG_KMS("\n"); |
2253 | |
2254 | if (!use_bios_divs) { |
2255 | - radeon_compute_pll(pll, mode->clock, |
2256 | - &freq, &feedback_div, &frac_fb_div, |
2257 | - &reference_div, &post_divider); |
2258 | + radeon_compute_pll_legacy(pll, mode->clock, |
2259 | + &freq, &feedback_div, &frac_fb_div, |
2260 | + &reference_div, &post_divider); |
2261 | |
2262 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { |
2263 | if (post_div->divider == post_divider) |
2264 | diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h |
2265 | index e301c6f..aa22570 100644 |
2266 | --- a/drivers/gpu/drm/radeon/radeon_mode.h |
2267 | +++ b/drivers/gpu/drm/radeon/radeon_mode.h |
2268 | @@ -149,6 +149,7 @@ struct radeon_tmds_pll { |
2269 | #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) |
2270 | #define RADEON_PLL_USE_POST_DIV (1 << 12) |
2271 | #define RADEON_PLL_IS_LCD (1 << 13) |
2272 | +#define RADEON_PLL_PREFER_MINM_OVER_MAXP (1 << 14) |
2273 | |
2274 | struct radeon_pll { |
2275 | /* reference frequency */ |
2276 | @@ -510,13 +511,21 @@ extern bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, |
2277 | struct radeon_atom_ss *ss, |
2278 | int id, u32 clock); |
2279 | |
2280 | -extern void radeon_compute_pll(struct radeon_pll *pll, |
2281 | - uint64_t freq, |
2282 | - uint32_t *dot_clock_p, |
2283 | - uint32_t *fb_div_p, |
2284 | - uint32_t *frac_fb_div_p, |
2285 | - uint32_t *ref_div_p, |
2286 | - uint32_t *post_div_p); |
2287 | +extern void radeon_compute_pll_legacy(struct radeon_pll *pll, |
2288 | + uint64_t freq, |
2289 | + uint32_t *dot_clock_p, |
2290 | + uint32_t *fb_div_p, |
2291 | + uint32_t *frac_fb_div_p, |
2292 | + uint32_t *ref_div_p, |
2293 | + uint32_t *post_div_p); |
2294 | + |
2295 | +extern void radeon_compute_pll_avivo(struct radeon_pll *pll, |
2296 | + u32 freq, |
2297 | + u32 *dot_clock_p, |
2298 | + u32 *fb_div_p, |
2299 | + u32 *frac_fb_div_p, |
2300 | + u32 *ref_div_p, |
2301 | + u32 *post_div_p); |
2302 | |
2303 | extern void radeon_setup_encoder_clones(struct drm_device *dev); |
2304 | |
2305 | diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c |
2306 | index c380c65..ace2b16 100644 |
2307 | --- a/drivers/gpu/vga/vgaarb.c |
2308 | +++ b/drivers/gpu/vga/vgaarb.c |
2309 | @@ -636,7 +636,7 @@ int vga_client_register(struct pci_dev *pdev, void *cookie, |
2310 | void (*irq_set_state)(void *cookie, bool state), |
2311 | unsigned int (*set_vga_decode)(void *cookie, bool decode)) |
2312 | { |
2313 | - int ret = -1; |
2314 | + int ret = -ENODEV; |
2315 | struct vga_device *vgadev; |
2316 | unsigned long flags; |
2317 | |
2318 | diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c |
2319 | index b6598aa..87a5fd51 100644 |
2320 | --- a/drivers/hwmon/applesmc.c |
2321 | +++ b/drivers/hwmon/applesmc.c |
2322 | @@ -162,6 +162,10 @@ static const char *temperature_sensors_sets[][41] = { |
2323 | /* Set 22: MacBook Pro 7,1 */ |
2324 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", |
2325 | "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, |
2326 | +/* Set 23: MacBook Air 3,1 */ |
2327 | + { "TB0T", "TB1T", "TB2T", "TC0D", "TC0E", "TC0P", "TC1E", "TCZ3", |
2328 | + "TCZ4", "TCZ5", "TG0E", "TG1E", "TG2E", "TGZ3", "TGZ4", "TGZ5", |
2329 | + "TH0F", "TH0O", "TM0P" }, |
2330 | }; |
2331 | |
2332 | /* List of keys used to read/write fan speeds */ |
2333 | @@ -444,38 +448,22 @@ static int applesmc_read_motion_sensor(int index, s16* value) |
2334 | } |
2335 | |
2336 | /* |
2337 | - * applesmc_device_init - initialize the accelerometer. Returns zero on success |
2338 | - * and negative error code on failure. Can sleep. |
2339 | + * applesmc_device_init - initialize the accelerometer. Can sleep. |
2340 | */ |
2341 | -static int applesmc_device_init(void) |
2342 | +static void applesmc_device_init(void) |
2343 | { |
2344 | - int total, ret = -ENXIO; |
2345 | + int total; |
2346 | u8 buffer[2]; |
2347 | |
2348 | if (!applesmc_accelerometer) |
2349 | - return 0; |
2350 | + return; |
2351 | |
2352 | mutex_lock(&applesmc_lock); |
2353 | |
2354 | for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { |
2355 | - if (debug) |
2356 | - printk(KERN_DEBUG "applesmc try %d\n", total); |
2357 | if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && |
2358 | - (buffer[0] != 0x00 || buffer[1] != 0x00)) { |
2359 | - if (total == INIT_TIMEOUT_MSECS) { |
2360 | - printk(KERN_DEBUG "applesmc: device has" |
2361 | - " already been initialized" |
2362 | - " (0x%02x, 0x%02x).\n", |
2363 | - buffer[0], buffer[1]); |
2364 | - } else { |
2365 | - printk(KERN_DEBUG "applesmc: device" |
2366 | - " successfully initialized" |
2367 | - " (0x%02x, 0x%02x).\n", |
2368 | - buffer[0], buffer[1]); |
2369 | - } |
2370 | - ret = 0; |
2371 | + (buffer[0] != 0x00 || buffer[1] != 0x00)) |
2372 | goto out; |
2373 | - } |
2374 | buffer[0] = 0xe0; |
2375 | buffer[1] = 0x00; |
2376 | applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); |
2377 | @@ -486,7 +474,6 @@ static int applesmc_device_init(void) |
2378 | |
2379 | out: |
2380 | mutex_unlock(&applesmc_lock); |
2381 | - return ret; |
2382 | } |
2383 | |
2384 | /* |
2385 | @@ -512,13 +499,8 @@ static int applesmc_get_fan_count(void) |
2386 | /* Device model stuff */ |
2387 | static int applesmc_probe(struct platform_device *dev) |
2388 | { |
2389 | - int ret; |
2390 | - |
2391 | - ret = applesmc_device_init(); |
2392 | - if (ret) |
2393 | - return ret; |
2394 | + applesmc_device_init(); |
2395 | |
2396 | - printk(KERN_INFO "applesmc: device successfully initialized.\n"); |
2397 | return 0; |
2398 | } |
2399 | |
2400 | @@ -535,9 +517,7 @@ static int applesmc_pm_resume(struct device *dev) |
2401 | /* Reinitialize device on resume from hibernation */ |
2402 | static int applesmc_pm_restore(struct device *dev) |
2403 | { |
2404 | - int ret = applesmc_device_init(); |
2405 | - if (ret) |
2406 | - return ret; |
2407 | + applesmc_device_init(); |
2408 | return applesmc_pm_resume(dev); |
2409 | } |
2410 | |
2411 | @@ -1524,11 +1504,17 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { |
2412 | { .accelerometer = 1, .light = 1, .temperature_set = 21 }, |
2413 | /* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ |
2414 | { .accelerometer = 1, .light = 1, .temperature_set = 22 }, |
2415 | +/* MacBook Air 3,1: accelerometer, backlight and temperature set 23 */ |
2416 | + { .accelerometer = 0, .light = 0, .temperature_set = 23 }, |
2417 | }; |
2418 | |
2419 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
2420 | * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ |
2421 | static __initdata struct dmi_system_id applesmc_whitelist[] = { |
2422 | + { applesmc_dmi_match, "Apple MacBook Air 3", { |
2423 | + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), |
2424 | + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3") }, |
2425 | + &applesmc_dmi_data[23]}, |
2426 | { applesmc_dmi_match, "Apple MacBook Air 2", { |
2427 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), |
2428 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, |
2429 | diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c |
2430 | index 776aeb3..508cb29 100644 |
2431 | --- a/drivers/hwmon/lm63.c |
2432 | +++ b/drivers/hwmon/lm63.c |
2433 | @@ -98,6 +98,9 @@ static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END }; |
2434 | * value, it uses signed 8-bit values with LSB = 1 degree Celsius. |
2435 | * For remote temperature, low and high limits, it uses signed 11-bit values |
2436 | * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. |
2437 | + * For LM64 the actual remote diode temperature is 16 degree Celsius higher |
2438 | + * than the register reading. Remote temperature setpoints have to be |
2439 | + * adapted accordingly. |
2440 | */ |
2441 | |
2442 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ |
2443 | @@ -165,6 +168,8 @@ struct lm63_data { |
2444 | struct mutex update_lock; |
2445 | char valid; /* zero until following fields are valid */ |
2446 | unsigned long last_updated; /* in jiffies */ |
2447 | + int kind; |
2448 | + int temp2_offset; |
2449 | |
2450 | /* registers values */ |
2451 | u8 config, config_fan; |
2452 | @@ -247,16 +252,34 @@ static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *dum |
2453 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); |
2454 | } |
2455 | |
2456 | -static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr, |
2457 | - char *buf) |
2458 | +/* |
2459 | + * There are 8bit registers for both local(temp1) and remote(temp2) sensor. |
2460 | + * For remote sensor registers temp2_offset has to be considered, |
2461 | + * for local sensor it must not. |
2462 | + * So we need separate 8bit accessors for local and remote sensor. |
2463 | + */ |
2464 | +static ssize_t show_local_temp8(struct device *dev, |
2465 | + struct device_attribute *devattr, |
2466 | + char *buf) |
2467 | { |
2468 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
2469 | struct lm63_data *data = lm63_update_device(dev); |
2470 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); |
2471 | } |
2472 | |
2473 | -static ssize_t set_temp8(struct device *dev, struct device_attribute *dummy, |
2474 | - const char *buf, size_t count) |
2475 | +static ssize_t show_remote_temp8(struct device *dev, |
2476 | + struct device_attribute *devattr, |
2477 | + char *buf) |
2478 | +{ |
2479 | + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
2480 | + struct lm63_data *data = lm63_update_device(dev); |
2481 | + return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index]) |
2482 | + + data->temp2_offset); |
2483 | +} |
2484 | + |
2485 | +static ssize_t set_local_temp8(struct device *dev, |
2486 | + struct device_attribute *dummy, |
2487 | + const char *buf, size_t count) |
2488 | { |
2489 | struct i2c_client *client = to_i2c_client(dev); |
2490 | struct lm63_data *data = i2c_get_clientdata(client); |
2491 | @@ -274,7 +297,8 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, |
2492 | { |
2493 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
2494 | struct lm63_data *data = lm63_update_device(dev); |
2495 | - return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])); |
2496 | + return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index]) |
2497 | + + data->temp2_offset); |
2498 | } |
2499 | |
2500 | static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, |
2501 | @@ -294,7 +318,7 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, |
2502 | int nr = attr->index; |
2503 | |
2504 | mutex_lock(&data->update_lock); |
2505 | - data->temp11[nr] = TEMP11_TO_REG(val); |
2506 | + data->temp11[nr] = TEMP11_TO_REG(val - data->temp2_offset); |
2507 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], |
2508 | data->temp11[nr] >> 8); |
2509 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], |
2510 | @@ -310,6 +334,7 @@ static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute |
2511 | { |
2512 | struct lm63_data *data = lm63_update_device(dev); |
2513 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) |
2514 | + + data->temp2_offset |
2515 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); |
2516 | } |
2517 | |
2518 | @@ -324,7 +349,7 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute * |
2519 | long hyst; |
2520 | |
2521 | mutex_lock(&data->update_lock); |
2522 | - hyst = TEMP8_FROM_REG(data->temp8[2]) - val; |
2523 | + hyst = TEMP8_FROM_REG(data->temp8[2]) + data->temp2_offset - val; |
2524 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, |
2525 | HYST_TO_REG(hyst)); |
2526 | mutex_unlock(&data->update_lock); |
2527 | @@ -355,16 +380,21 @@ static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan, |
2528 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); |
2529 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); |
2530 | |
2531 | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); |
2532 | -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp8, |
2533 | - set_temp8, 1); |
2534 | +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_local_temp8, NULL, 0); |
2535 | +static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_local_temp8, |
2536 | + set_local_temp8, 1); |
2537 | |
2538 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); |
2539 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, |
2540 | set_temp11, 1); |
2541 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, |
2542 | set_temp11, 2); |
2543 | -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp8, NULL, 2); |
2544 | +/* |
2545 | + * On LM63, temp2_crit can be set only once, which should be job |
2546 | + * of the bootloader. |
2547 | + */ |
2548 | +static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_remote_temp8, |
2549 | + NULL, 2); |
2550 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, |
2551 | set_temp2_crit_hyst); |
2552 | |
2553 | @@ -479,7 +509,12 @@ static int lm63_probe(struct i2c_client *new_client, |
2554 | data->valid = 0; |
2555 | mutex_init(&data->update_lock); |
2556 | |
2557 | - /* Initialize the LM63 chip */ |
2558 | + /* Set the device type */ |
2559 | + data->kind = id->driver_data; |
2560 | + if (data->kind == lm64) |
2561 | + data->temp2_offset = 16000; |
2562 | + |
2563 | + /* Initialize chip */ |
2564 | lm63_init_client(new_client); |
2565 | |
2566 | /* Register sysfs hooks */ |
2567 | diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c |
2568 | index f397ce7..b2074e3 100644 |
2569 | --- a/drivers/hwmon/via686a.c |
2570 | +++ b/drivers/hwmon/via686a.c |
2571 | @@ -687,6 +687,13 @@ static int __devexit via686a_remove(struct platform_device *pdev) |
2572 | return 0; |
2573 | } |
2574 | |
2575 | +static void via686a_update_fan_div(struct via686a_data *data) |
2576 | +{ |
2577 | + int reg = via686a_read_value(data, VIA686A_REG_FANDIV); |
2578 | + data->fan_div[0] = (reg >> 4) & 0x03; |
2579 | + data->fan_div[1] = reg >> 6; |
2580 | +} |
2581 | + |
2582 | static void __devinit via686a_init_device(struct via686a_data *data) |
2583 | { |
2584 | u8 reg; |
2585 | @@ -700,6 +707,9 @@ static void __devinit via686a_init_device(struct via686a_data *data) |
2586 | via686a_write_value(data, VIA686A_REG_TEMP_MODE, |
2587 | (reg & ~VIA686A_TEMP_MODE_MASK) |
2588 | | VIA686A_TEMP_MODE_CONTINUOUS); |
2589 | + |
2590 | + /* Pre-read fan clock divisor values */ |
2591 | + via686a_update_fan_div(data); |
2592 | } |
2593 | |
2594 | static struct via686a_data *via686a_update_device(struct device *dev) |
2595 | @@ -751,9 +761,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) |
2596 | (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) & |
2597 | 0xc0) >> 6; |
2598 | |
2599 | - i = via686a_read_value(data, VIA686A_REG_FANDIV); |
2600 | - data->fan_div[0] = (i >> 4) & 0x03; |
2601 | - data->fan_div[1] = i >> 6; |
2602 | + via686a_update_fan_div(data); |
2603 | data->alarms = |
2604 | via686a_read_value(data, |
2605 | VIA686A_REG_ALARM1) | |
2606 | diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c |
2607 | index 6b4cc56..44bb9c2 100644 |
2608 | --- a/drivers/i2c/i2c-core.c |
2609 | +++ b/drivers/i2c/i2c-core.c |
2610 | @@ -1021,6 +1021,14 @@ static int i2c_do_del_adapter(struct i2c_driver *driver, |
2611 | static int __unregister_client(struct device *dev, void *dummy) |
2612 | { |
2613 | struct i2c_client *client = i2c_verify_client(dev); |
2614 | + if (client && strcmp(client->name, "dummy")) |
2615 | + i2c_unregister_device(client); |
2616 | + return 0; |
2617 | +} |
2618 | + |
2619 | +static int __unregister_dummy(struct device *dev, void *dummy) |
2620 | +{ |
2621 | + struct i2c_client *client = i2c_verify_client(dev); |
2622 | if (client) |
2623 | i2c_unregister_device(client); |
2624 | return 0; |
2625 | @@ -1075,8 +1083,12 @@ int i2c_del_adapter(struct i2c_adapter *adap) |
2626 | mutex_unlock(&adap->userspace_clients_lock); |
2627 | |
2628 | /* Detach any active clients. This can't fail, thus we do not |
2629 | - checking the returned value. */ |
2630 | + * check the returned value. This is a two-pass process, because |
2631 | + * we can't remove the dummy devices during the first pass: they |
2632 | + * could have been instantiated by real devices wishing to clean |
2633 | + * them up properly, so we give them a chance to do that first. */ |
2634 | res = device_for_each_child(&adap->dev, NULL, __unregister_client); |
2635 | + res = device_for_each_child(&adap->dev, NULL, __unregister_dummy); |
2636 | |
2637 | #ifdef CONFIG_I2C_COMPAT |
2638 | class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, |
2639 | diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c |
2640 | index c131d58..a1e141e 100644 |
2641 | --- a/drivers/idle/intel_idle.c |
2642 | +++ b/drivers/idle/intel_idle.c |
2643 | @@ -59,6 +59,8 @@ |
2644 | #include <linux/hrtimer.h> /* ktime_get_real() */ |
2645 | #include <trace/events/power.h> |
2646 | #include <linux/sched.h> |
2647 | +#include <linux/notifier.h> |
2648 | +#include <linux/cpu.h> |
2649 | #include <asm/mwait.h> |
2650 | |
2651 | #define INTEL_IDLE_VERSION "0.4" |
2652 | @@ -73,6 +75,7 @@ static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1; |
2653 | |
2654 | static unsigned int mwait_substates; |
2655 | |
2656 | +#define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF |
2657 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ |
2658 | static unsigned int lapic_timer_reliable_states = (1 << 1); /* Default to only C1 */ |
2659 | |
2660 | @@ -244,6 +247,35 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) |
2661 | return usec_delta; |
2662 | } |
2663 | |
2664 | +static void __setup_broadcast_timer(void *arg) |
2665 | +{ |
2666 | + unsigned long reason = (unsigned long)arg; |
2667 | + int cpu = smp_processor_id(); |
2668 | + |
2669 | + reason = reason ? |
2670 | + CLOCK_EVT_NOTIFY_BROADCAST_ON : CLOCK_EVT_NOTIFY_BROADCAST_OFF; |
2671 | + |
2672 | + clockevents_notify(reason, &cpu); |
2673 | +} |
2674 | + |
2675 | +static int setup_broadcast_cpuhp_notify(struct notifier_block *n, |
2676 | + unsigned long action, void *hcpu) |
2677 | +{ |
2678 | + int hotcpu = (unsigned long)hcpu; |
2679 | + |
2680 | + switch (action & 0xf) { |
2681 | + case CPU_ONLINE: |
2682 | + smp_call_function_single(hotcpu, __setup_broadcast_timer, |
2683 | + (void *)true, 1); |
2684 | + break; |
2685 | + } |
2686 | + return NOTIFY_OK; |
2687 | +} |
2688 | + |
2689 | +static struct notifier_block setup_broadcast_notifier = { |
2690 | + .notifier_call = setup_broadcast_cpuhp_notify, |
2691 | +}; |
2692 | + |
2693 | /* |
2694 | * intel_idle_probe() |
2695 | */ |
2696 | @@ -306,7 +338,11 @@ static int intel_idle_probe(void) |
2697 | } |
2698 | |
2699 | if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ |
2700 | - lapic_timer_reliable_states = 0xFFFFFFFF; |
2701 | + lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE; |
2702 | + else { |
2703 | + smp_call_function(__setup_broadcast_timer, (void *)true, 1); |
2704 | + register_cpu_notifier(&setup_broadcast_notifier); |
2705 | + } |
2706 | |
2707 | pr_debug(PREFIX "v" INTEL_IDLE_VERSION |
2708 | " model 0x%X\n", boot_cpu_data.x86_model); |
2709 | @@ -429,6 +465,11 @@ static void __exit intel_idle_exit(void) |
2710 | intel_idle_cpuidle_devices_uninit(); |
2711 | cpuidle_unregister_driver(&intel_idle_driver); |
2712 | |
2713 | + if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) { |
2714 | + smp_call_function(__setup_broadcast_timer, (void *)false, 1); |
2715 | + unregister_cpu_notifier(&setup_broadcast_notifier); |
2716 | + } |
2717 | + |
2718 | return; |
2719 | } |
2720 | |
2721 | diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c |
2722 | index 0dc62b1..8b00e6c 100644 |
2723 | --- a/drivers/infiniband/hw/cxgb4/cm.c |
2724 | +++ b/drivers/infiniband/hw/cxgb4/cm.c |
2725 | @@ -380,7 +380,7 @@ static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb) |
2726 | 16)) | FW_WR_FLOWID(ep->hwtid)); |
2727 | |
2728 | flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN; |
2729 | - flowc->mnemval[0].val = cpu_to_be32(0); |
2730 | + flowc->mnemval[0].val = cpu_to_be32(PCI_FUNC(ep->com.dev->rdev.lldi.pdev->devfn) << 8); |
2731 | flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH; |
2732 | flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); |
2733 | flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT; |
2734 | diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
2735 | index 057cb25..8ae09e7 100644 |
2736 | --- a/drivers/infiniband/hw/cxgb4/qp.c |
2737 | +++ b/drivers/infiniband/hw/cxgb4/qp.c |
2738 | @@ -220,7 +220,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, |
2739 | V_FW_RI_RES_WR_DCAEN(0) | |
2740 | V_FW_RI_RES_WR_DCACPU(0) | |
2741 | V_FW_RI_RES_WR_FBMIN(2) | |
2742 | - V_FW_RI_RES_WR_FBMAX(3) | |
2743 | + V_FW_RI_RES_WR_FBMAX(2) | |
2744 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | |
2745 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | |
2746 | V_FW_RI_RES_WR_EQSIZE(eqsize)); |
2747 | @@ -243,7 +243,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, |
2748 | V_FW_RI_RES_WR_DCAEN(0) | |
2749 | V_FW_RI_RES_WR_DCACPU(0) | |
2750 | V_FW_RI_RES_WR_FBMIN(2) | |
2751 | - V_FW_RI_RES_WR_FBMAX(3) | |
2752 | + V_FW_RI_RES_WR_FBMAX(2) | |
2753 | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | |
2754 | V_FW_RI_RES_WR_CIDXFTHRESH(0) | |
2755 | V_FW_RI_RES_WR_EQSIZE(eqsize)); |
2756 | @@ -1029,7 +1029,6 @@ static int rdma_fini(struct c4iw_dev *rhp, struct c4iw_qp *qhp, |
2757 | wqe->cookie = (unsigned long) &ep->com.wr_wait; |
2758 | |
2759 | wqe->u.fini.type = FW_RI_TYPE_FINI; |
2760 | - c4iw_init_wr_wait(&ep->com.wr_wait); |
2761 | ret = c4iw_ofld_send(&rhp->rdev, skb); |
2762 | if (ret) |
2763 | goto out; |
2764 | @@ -1125,7 +1124,6 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw_qp *qhp) |
2765 | if (qhp->attr.mpa_attr.initiator) |
2766 | build_rtr_msg(qhp->attr.mpa_attr.p2p_type, &wqe->u.init); |
2767 | |
2768 | - c4iw_init_wr_wait(&qhp->ep->com.wr_wait); |
2769 | ret = c4iw_ofld_send(&rhp->rdev, skb); |
2770 | if (ret) |
2771 | goto out; |
2772 | diff --git a/drivers/input/input.c b/drivers/input/input.c |
2773 | index db409d6..e8a8802 100644 |
2774 | --- a/drivers/input/input.c |
2775 | +++ b/drivers/input/input.c |
2776 | @@ -73,7 +73,6 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz) |
2777 | * dev->event_lock held and interrupts disabled. |
2778 | */ |
2779 | static void input_pass_event(struct input_dev *dev, |
2780 | - struct input_handler *src_handler, |
2781 | unsigned int type, unsigned int code, int value) |
2782 | { |
2783 | struct input_handler *handler; |
2784 | @@ -92,15 +91,6 @@ static void input_pass_event(struct input_dev *dev, |
2785 | continue; |
2786 | |
2787 | handler = handle->handler; |
2788 | - |
2789 | - /* |
2790 | - * If this is the handler that injected this |
2791 | - * particular event we want to skip it to avoid |
2792 | - * filters firing again and again. |
2793 | - */ |
2794 | - if (handler == src_handler) |
2795 | - continue; |
2796 | - |
2797 | if (!handler->filter) { |
2798 | if (filtered) |
2799 | break; |
2800 | @@ -130,7 +120,7 @@ static void input_repeat_key(unsigned long data) |
2801 | if (test_bit(dev->repeat_key, dev->key) && |
2802 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { |
2803 | |
2804 | - input_pass_event(dev, NULL, EV_KEY, dev->repeat_key, 2); |
2805 | + input_pass_event(dev, EV_KEY, dev->repeat_key, 2); |
2806 | |
2807 | if (dev->sync) { |
2808 | /* |
2809 | @@ -139,7 +129,7 @@ static void input_repeat_key(unsigned long data) |
2810 | * Otherwise assume that the driver will send |
2811 | * SYN_REPORT once it's done. |
2812 | */ |
2813 | - input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); |
2814 | + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
2815 | } |
2816 | |
2817 | if (dev->rep[REP_PERIOD]) |
2818 | @@ -172,7 +162,6 @@ static void input_stop_autorepeat(struct input_dev *dev) |
2819 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) |
2820 | |
2821 | static int input_handle_abs_event(struct input_dev *dev, |
2822 | - struct input_handler *src_handler, |
2823 | unsigned int code, int *pval) |
2824 | { |
2825 | bool is_mt_event; |
2826 | @@ -216,15 +205,13 @@ static int input_handle_abs_event(struct input_dev *dev, |
2827 | /* Flush pending "slot" event */ |
2828 | if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { |
2829 | input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); |
2830 | - input_pass_event(dev, src_handler, |
2831 | - EV_ABS, ABS_MT_SLOT, dev->slot); |
2832 | + input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot); |
2833 | } |
2834 | |
2835 | return INPUT_PASS_TO_HANDLERS; |
2836 | } |
2837 | |
2838 | static void input_handle_event(struct input_dev *dev, |
2839 | - struct input_handler *src_handler, |
2840 | unsigned int type, unsigned int code, int value) |
2841 | { |
2842 | int disposition = INPUT_IGNORE_EVENT; |
2843 | @@ -277,8 +264,7 @@ static void input_handle_event(struct input_dev *dev, |
2844 | |
2845 | case EV_ABS: |
2846 | if (is_event_supported(code, dev->absbit, ABS_MAX)) |
2847 | - disposition = input_handle_abs_event(dev, src_handler, |
2848 | - code, &value); |
2849 | + disposition = input_handle_abs_event(dev, code, &value); |
2850 | |
2851 | break; |
2852 | |
2853 | @@ -336,7 +322,7 @@ static void input_handle_event(struct input_dev *dev, |
2854 | dev->event(dev, type, code, value); |
2855 | |
2856 | if (disposition & INPUT_PASS_TO_HANDLERS) |
2857 | - input_pass_event(dev, src_handler, type, code, value); |
2858 | + input_pass_event(dev, type, code, value); |
2859 | } |
2860 | |
2861 | /** |
2862 | @@ -365,7 +351,7 @@ void input_event(struct input_dev *dev, |
2863 | |
2864 | spin_lock_irqsave(&dev->event_lock, flags); |
2865 | add_input_randomness(type, code, value); |
2866 | - input_handle_event(dev, NULL, type, code, value); |
2867 | + input_handle_event(dev, type, code, value); |
2868 | spin_unlock_irqrestore(&dev->event_lock, flags); |
2869 | } |
2870 | } |
2871 | @@ -395,8 +381,7 @@ void input_inject_event(struct input_handle *handle, |
2872 | rcu_read_lock(); |
2873 | grab = rcu_dereference(dev->grab); |
2874 | if (!grab || grab == handle) |
2875 | - input_handle_event(dev, handle->handler, |
2876 | - type, code, value); |
2877 | + input_handle_event(dev, type, code, value); |
2878 | rcu_read_unlock(); |
2879 | |
2880 | spin_unlock_irqrestore(&dev->event_lock, flags); |
2881 | @@ -609,10 +594,10 @@ static void input_dev_release_keys(struct input_dev *dev) |
2882 | for (code = 0; code <= KEY_MAX; code++) { |
2883 | if (is_event_supported(code, dev->keybit, KEY_MAX) && |
2884 | __test_and_clear_bit(code, dev->key)) { |
2885 | - input_pass_event(dev, NULL, EV_KEY, code, 0); |
2886 | + input_pass_event(dev, EV_KEY, code, 0); |
2887 | } |
2888 | } |
2889 | - input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); |
2890 | + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
2891 | } |
2892 | } |
2893 | |
2894 | @@ -887,9 +872,9 @@ int input_set_keycode(struct input_dev *dev, |
2895 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && |
2896 | __test_and_clear_bit(old_keycode, dev->key)) { |
2897 | |
2898 | - input_pass_event(dev, NULL, EV_KEY, old_keycode, 0); |
2899 | + input_pass_event(dev, EV_KEY, old_keycode, 0); |
2900 | if (dev->sync) |
2901 | - input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); |
2902 | + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); |
2903 | } |
2904 | |
2905 | out: |
2906 | diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c |
2907 | index b952317..ee82851 100644 |
2908 | --- a/drivers/input/mouse/bcm5974.c |
2909 | +++ b/drivers/input/mouse/bcm5974.c |
2910 | @@ -55,6 +55,14 @@ |
2911 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 |
2912 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 |
2913 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 |
2914 | +/* MacbookAir3,2 (unibody), aka wellspring5 */ |
2915 | +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f |
2916 | +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 |
2917 | +#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 |
2918 | +/* MacbookAir3,1 (unibody), aka wellspring4 */ |
2919 | +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 |
2920 | +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 |
2921 | +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 |
2922 | |
2923 | #define BCM5974_DEVICE(prod) { \ |
2924 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
2925 | @@ -80,6 +88,14 @@ static const struct usb_device_id bcm5974_table[] = { |
2926 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), |
2927 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), |
2928 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), |
2929 | + /* MacbookAir3,2 */ |
2930 | + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), |
2931 | + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), |
2932 | + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), |
2933 | + /* MacbookAir3,1 */ |
2934 | + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), |
2935 | + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), |
2936 | + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), |
2937 | /* Terminating entry */ |
2938 | {} |
2939 | }; |
2940 | @@ -234,6 +250,30 @@ static const struct bcm5974_config bcm5974_config_table[] = { |
2941 | { DIM_X, DIM_X / SN_COORD, -4460, 5166 }, |
2942 | { DIM_Y, DIM_Y / SN_COORD, -75, 6700 } |
2943 | }, |
2944 | + { |
2945 | + USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI, |
2946 | + USB_DEVICE_ID_APPLE_WELLSPRING4_ISO, |
2947 | + USB_DEVICE_ID_APPLE_WELLSPRING4_JIS, |
2948 | + HAS_INTEGRATED_BUTTON, |
2949 | + 0x84, sizeof(struct bt_data), |
2950 | + 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, |
2951 | + { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, |
2952 | + { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, |
2953 | + { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, |
2954 | + { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } |
2955 | + }, |
2956 | + { |
2957 | + USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI, |
2958 | + USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO, |
2959 | + USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS, |
2960 | + HAS_INTEGRATED_BUTTON, |
2961 | + 0x84, sizeof(struct bt_data), |
2962 | + 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, |
2963 | + { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, |
2964 | + { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, |
2965 | + { DIM_X, DIM_X / SN_COORD, -4616, 5112 }, |
2966 | + { DIM_Y, DIM_Y / SN_COORD, -142, 5234 } |
2967 | + }, |
2968 | {} |
2969 | }; |
2970 | |
2971 | diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
2972 | index a5475b5..b04dd27 100644 |
2973 | --- a/drivers/input/serio/i8042-x86ia64io.h |
2974 | +++ b/drivers/input/serio/i8042-x86ia64io.h |
2975 | @@ -424,6 +424,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { |
2976 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), |
2977 | }, |
2978 | }, |
2979 | + { |
2980 | + /* Dell Vostro V13 */ |
2981 | + .matches = { |
2982 | + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
2983 | + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), |
2984 | + }, |
2985 | + }, |
2986 | { } |
2987 | }; |
2988 | |
2989 | @@ -545,6 +552,17 @@ static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = { |
2990 | }; |
2991 | #endif |
2992 | |
2993 | +static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { |
2994 | + { |
2995 | + /* Dell Vostro V13 */ |
2996 | + .matches = { |
2997 | + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
2998 | + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), |
2999 | + }, |
3000 | + }, |
3001 | + { } |
3002 | +}; |
3003 | + |
3004 | /* |
3005 | * Some Wistron based laptops need us to explicitly enable the 'Dritek |
3006 | * keyboard extension' to make their extra keys start generating scancodes. |
3007 | @@ -897,6 +915,9 @@ static int __init i8042_platform_init(void) |
3008 | if (dmi_check_system(i8042_dmi_nomux_table)) |
3009 | i8042_nomux = true; |
3010 | |
3011 | + if (dmi_check_system(i8042_dmi_notimeout_table)) |
3012 | + i8042_notimeout = true; |
3013 | + |
3014 | if (dmi_check_system(i8042_dmi_dritek_table)) |
3015 | i8042_dritek = true; |
3016 | #endif /* CONFIG_X86 */ |
3017 | diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
3018 | index 18db5a8..039037d 100644 |
3019 | --- a/drivers/input/serio/i8042.c |
3020 | +++ b/drivers/input/serio/i8042.c |
3021 | @@ -61,6 +61,10 @@ static bool i8042_noloop; |
3022 | module_param_named(noloop, i8042_noloop, bool, 0); |
3023 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); |
3024 | |
3025 | +static bool i8042_notimeout; |
3026 | +module_param_named(notimeout, i8042_notimeout, bool, 0); |
3027 | +MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042"); |
3028 | + |
3029 | #ifdef CONFIG_X86 |
3030 | static bool i8042_dritek; |
3031 | module_param_named(dritek, i8042_dritek, bool, 0); |
3032 | @@ -503,7 +507,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id) |
3033 | } else { |
3034 | |
3035 | dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | |
3036 | - ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); |
3037 | + ((str & I8042_STR_TIMEOUT && !i8042_notimeout) ? SERIO_TIMEOUT : 0); |
3038 | |
3039 | port_no = (str & I8042_STR_AUXDATA) ? |
3040 | I8042_AUX_PORT_NO : I8042_KBD_PORT_NO; |
3041 | diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
3042 | index 487ecda..406091f 100644 |
3043 | --- a/drivers/md/dm-mpath.c |
3044 | +++ b/drivers/md/dm-mpath.c |
3045 | @@ -33,7 +33,6 @@ struct pgpath { |
3046 | unsigned fail_count; /* Cumulative failure count */ |
3047 | |
3048 | struct dm_path path; |
3049 | - struct work_struct deactivate_path; |
3050 | struct work_struct activate_path; |
3051 | }; |
3052 | |
3053 | @@ -116,7 +115,6 @@ static struct workqueue_struct *kmultipathd, *kmpath_handlerd; |
3054 | static void process_queued_ios(struct work_struct *work); |
3055 | static void trigger_event(struct work_struct *work); |
3056 | static void activate_path(struct work_struct *work); |
3057 | -static void deactivate_path(struct work_struct *work); |
3058 | |
3059 | |
3060 | /*----------------------------------------------- |
3061 | @@ -129,7 +127,6 @@ static struct pgpath *alloc_pgpath(void) |
3062 | |
3063 | if (pgpath) { |
3064 | pgpath->is_active = 1; |
3065 | - INIT_WORK(&pgpath->deactivate_path, deactivate_path); |
3066 | INIT_WORK(&pgpath->activate_path, activate_path); |
3067 | } |
3068 | |
3069 | @@ -141,14 +138,6 @@ static void free_pgpath(struct pgpath *pgpath) |
3070 | kfree(pgpath); |
3071 | } |
3072 | |
3073 | -static void deactivate_path(struct work_struct *work) |
3074 | -{ |
3075 | - struct pgpath *pgpath = |
3076 | - container_of(work, struct pgpath, deactivate_path); |
3077 | - |
3078 | - blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); |
3079 | -} |
3080 | - |
3081 | static struct priority_group *alloc_priority_group(void) |
3082 | { |
3083 | struct priority_group *pg; |
3084 | @@ -995,7 +984,6 @@ static int fail_path(struct pgpath *pgpath) |
3085 | pgpath->path.dev->name, m->nr_valid_paths); |
3086 | |
3087 | schedule_work(&m->trigger_event); |
3088 | - queue_work(kmultipathd, &pgpath->deactivate_path); |
3089 | |
3090 | out: |
3091 | spin_unlock_irqrestore(&m->lock, flags); |
3092 | diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
3093 | index 7cb1352..81cb2f5 100644 |
3094 | --- a/drivers/md/dm.c |
3095 | +++ b/drivers/md/dm.c |
3096 | @@ -1992,13 +1992,14 @@ static void event_callback(void *context) |
3097 | wake_up(&md->eventq); |
3098 | } |
3099 | |
3100 | +/* |
3101 | + * Protected by md->suspend_lock obtained by dm_swap_table(). |
3102 | + */ |
3103 | static void __set_size(struct mapped_device *md, sector_t size) |
3104 | { |
3105 | set_capacity(md->disk, size); |
3106 | |
3107 | - mutex_lock(&md->bdev->bd_inode->i_mutex); |
3108 | i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
3109 | - mutex_unlock(&md->bdev->bd_inode->i_mutex); |
3110 | } |
3111 | |
3112 | /* |
3113 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
3114 | index 175c424..0e5a483 100644 |
3115 | --- a/drivers/md/md.c |
3116 | +++ b/drivers/md/md.c |
3117 | @@ -287,11 +287,14 @@ static int md_make_request(struct request_queue *q, struct bio *bio) |
3118 | mddev_t *mddev = q->queuedata; |
3119 | int rv; |
3120 | int cpu; |
3121 | + unsigned int sectors; |
3122 | |
3123 | - if (mddev == NULL || mddev->pers == NULL) { |
3124 | + if (mddev == NULL || mddev->pers == NULL |
3125 | + || !mddev->ready) { |
3126 | bio_io_error(bio); |
3127 | return 0; |
3128 | } |
3129 | + smp_rmb(); /* Ensure implications of 'active' are visible */ |
3130 | rcu_read_lock(); |
3131 | if (mddev->suspended) { |
3132 | DEFINE_WAIT(__wait); |
3133 | @@ -309,12 +312,16 @@ static int md_make_request(struct request_queue *q, struct bio *bio) |
3134 | atomic_inc(&mddev->active_io); |
3135 | rcu_read_unlock(); |
3136 | |
3137 | + /* |
3138 | + * save the sectors now since our bio can |
3139 | + * go away inside make_request |
3140 | + */ |
3141 | + sectors = bio_sectors(bio); |
3142 | rv = mddev->pers->make_request(mddev, bio); |
3143 | |
3144 | cpu = part_stat_lock(); |
3145 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); |
3146 | - part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], |
3147 | - bio_sectors(bio)); |
3148 | + part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors); |
3149 | part_stat_unlock(); |
3150 | |
3151 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) |
3152 | @@ -3115,7 +3122,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) |
3153 | char nm[20]; |
3154 | if (rdev->raid_disk < 0) |
3155 | continue; |
3156 | - if (rdev->new_raid_disk > mddev->raid_disks) |
3157 | + if (rdev->new_raid_disk >= mddev->raid_disks) |
3158 | rdev->new_raid_disk = -1; |
3159 | if (rdev->new_raid_disk == rdev->raid_disk) |
3160 | continue; |
3161 | @@ -4564,7 +4571,8 @@ int md_run(mddev_t *mddev) |
3162 | mddev->safemode_timer.data = (unsigned long) mddev; |
3163 | mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */ |
3164 | mddev->in_sync = 1; |
3165 | - |
3166 | + smp_wmb(); |
3167 | + mddev->ready = 1; |
3168 | list_for_each_entry(rdev, &mddev->disks, same_set) |
3169 | if (rdev->raid_disk >= 0) { |
3170 | char nm[20]; |
3171 | @@ -4725,6 +4733,7 @@ EXPORT_SYMBOL_GPL(md_stop_writes); |
3172 | |
3173 | void md_stop(mddev_t *mddev) |
3174 | { |
3175 | + mddev->ready = 0; |
3176 | mddev->pers->stop(mddev); |
3177 | if (mddev->pers->sync_request && mddev->to_remove == NULL) |
3178 | mddev->to_remove = &md_redundancy_group; |
3179 | @@ -5159,9 +5168,10 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) |
3180 | /* set saved_raid_disk if appropriate */ |
3181 | if (!mddev->persistent) { |
3182 | if (info->state & (1<<MD_DISK_SYNC) && |
3183 | - info->raid_disk < mddev->raid_disks) |
3184 | + info->raid_disk < mddev->raid_disks) { |
3185 | rdev->raid_disk = info->raid_disk; |
3186 | - else |
3187 | + set_bit(In_sync, &rdev->flags); |
3188 | + } else |
3189 | rdev->raid_disk = -1; |
3190 | } else |
3191 | super_types[mddev->major_version]. |
3192 | @@ -6041,7 +6051,8 @@ static int md_thread(void * arg) |
3193 | || kthread_should_stop(), |
3194 | thread->timeout); |
3195 | |
3196 | - if (test_and_clear_bit(THREAD_WAKEUP, &thread->flags)) |
3197 | + clear_bit(THREAD_WAKEUP, &thread->flags); |
3198 | + if (!kthread_should_stop()) |
3199 | thread->run(thread->mddev); |
3200 | } |
3201 | |
3202 | diff --git a/drivers/md/md.h b/drivers/md/md.h |
3203 | index d05bab5..a161283 100644 |
3204 | --- a/drivers/md/md.h |
3205 | +++ b/drivers/md/md.h |
3206 | @@ -148,7 +148,8 @@ struct mddev_s |
3207 | * are happening, so run/ |
3208 | * takeover/stop are not safe |
3209 | */ |
3210 | - |
3211 | + int ready; /* See when safe to pass |
3212 | + * IO requests down */ |
3213 | struct gendisk *gendisk; |
3214 | |
3215 | struct kobject kobj; |
3216 | diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c |
3217 | index f60107c..c4645d7 100644 |
3218 | --- a/drivers/media/IR/ir-keytable.c |
3219 | +++ b/drivers/media/IR/ir-keytable.c |
3220 | @@ -374,21 +374,27 @@ static int ir_getkeycode(struct input_dev *dev, |
3221 | index = ir_lookup_by_scancode(rc_tab, scancode); |
3222 | } |
3223 | |
3224 | - if (index >= rc_tab->len) { |
3225 | - if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) |
3226 | - IR_dprintk(1, "unknown key for scancode 0x%04x\n", |
3227 | - scancode); |
3228 | + if (index < rc_tab->len) { |
3229 | + entry = &rc_tab->scan[index]; |
3230 | + |
3231 | + ke->index = index; |
3232 | + ke->keycode = entry->keycode; |
3233 | + ke->len = sizeof(entry->scancode); |
3234 | + memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); |
3235 | + |
3236 | + } else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) { |
3237 | + /* |
3238 | + * We do not really know the valid range of scancodes |
3239 | + * so let's respond with KEY_RESERVED to anything we |
3240 | + * do not have mapping for [yet]. |
3241 | + */ |
3242 | + ke->index = index; |
3243 | + ke->keycode = KEY_RESERVED; |
3244 | + } else { |
3245 | retval = -EINVAL; |
3246 | goto out; |
3247 | } |
3248 | |
3249 | - entry = &rc_tab->scan[index]; |
3250 | - |
3251 | - ke->index = index; |
3252 | - ke->keycode = entry->keycode; |
3253 | - ke->len = sizeof(entry->scancode); |
3254 | - memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); |
3255 | - |
3256 | retval = 0; |
3257 | |
3258 | out: |
3259 | diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c |
3260 | index 55f2eba..6360c68 100644 |
3261 | --- a/drivers/media/dvb/frontends/ix2505v.c |
3262 | +++ b/drivers/media/dvb/frontends/ix2505v.c |
3263 | @@ -72,7 +72,7 @@ static int ix2505v_read_status_reg(struct ix2505v_state *state) |
3264 | ret = i2c_transfer(state->i2c, msg, 1); |
3265 | deb_i2c("Read %s ", __func__); |
3266 | |
3267 | - return (ret = 1) ? (int) b2[0] : -1; |
3268 | + return (ret == 1) ? (int) b2[0] : -1; |
3269 | } |
3270 | |
3271 | static int ix2505v_write(struct ix2505v_state *state, u8 buf[], u8 count) |
3272 | diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c |
3273 | index 05e832f..6cc5d13 100644 |
3274 | --- a/drivers/media/radio/radio-aimslab.c |
3275 | +++ b/drivers/media/radio/radio-aimslab.c |
3276 | @@ -31,7 +31,6 @@ |
3277 | #include <linux/module.h> /* Modules */ |
3278 | #include <linux/init.h> /* Initdata */ |
3279 | #include <linux/ioport.h> /* request_region */ |
3280 | -#include <linux/delay.h> /* udelay */ |
3281 | #include <linux/videodev2.h> /* kernel radio structs */ |
3282 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ |
3283 | #include <linux/io.h> /* outb, outb_p */ |
3284 | @@ -71,27 +70,17 @@ static struct rtrack rtrack_card; |
3285 | |
3286 | /* local things */ |
3287 | |
3288 | -static void sleep_delay(long n) |
3289 | -{ |
3290 | - /* Sleep nicely for 'n' uS */ |
3291 | - int d = n / msecs_to_jiffies(1000); |
3292 | - if (!d) |
3293 | - udelay(n); |
3294 | - else |
3295 | - msleep(jiffies_to_msecs(d)); |
3296 | -} |
3297 | - |
3298 | static void rt_decvol(struct rtrack *rt) |
3299 | { |
3300 | outb(0x58, rt->io); /* volume down + sigstr + on */ |
3301 | - sleep_delay(100000); |
3302 | + msleep(100); |
3303 | outb(0xd8, rt->io); /* volume steady + sigstr + on */ |
3304 | } |
3305 | |
3306 | static void rt_incvol(struct rtrack *rt) |
3307 | { |
3308 | outb(0x98, rt->io); /* volume up + sigstr + on */ |
3309 | - sleep_delay(100000); |
3310 | + msleep(100); |
3311 | outb(0xd8, rt->io); /* volume steady + sigstr + on */ |
3312 | } |
3313 | |
3314 | @@ -120,7 +109,7 @@ static int rt_setvol(struct rtrack *rt, int vol) |
3315 | |
3316 | if (vol == 0) { /* volume = 0 means mute the card */ |
3317 | outb(0x48, rt->io); /* volume down but still "on" */ |
3318 | - sleep_delay(2000000); /* make sure it's totally down */ |
3319 | + msleep(2000); /* make sure it's totally down */ |
3320 | outb(0xd0, rt->io); /* volume steady, off */ |
3321 | rt->curvol = 0; /* track the volume state! */ |
3322 | mutex_unlock(&rt->lock); |
3323 | @@ -155,7 +144,7 @@ static void send_0_byte(struct rtrack *rt) |
3324 | outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */ |
3325 | outb_p(128+64+16+8+2+1, rt->io); /* clock */ |
3326 | } |
3327 | - sleep_delay(1000); |
3328 | + msleep(1); |
3329 | } |
3330 | |
3331 | static void send_1_byte(struct rtrack *rt) |
3332 | @@ -169,7 +158,7 @@ static void send_1_byte(struct rtrack *rt) |
3333 | outb_p(128+64+16+8+4+2+1, rt->io); /* clock */ |
3334 | } |
3335 | |
3336 | - sleep_delay(1000); |
3337 | + msleep(1); |
3338 | } |
3339 | |
3340 | static int rt_setfreq(struct rtrack *rt, unsigned long freq) |
3341 | @@ -420,7 +409,7 @@ static int __init rtrack_init(void) |
3342 | |
3343 | /* this ensures that the volume is all the way down */ |
3344 | outb(0x48, rt->io); /* volume down but still "on" */ |
3345 | - sleep_delay(2000000); /* make sure it's totally down */ |
3346 | + msleep(2000); /* make sure it's totally down */ |
3347 | outb(0xc0, rt->io); /* steady volume, mute card */ |
3348 | |
3349 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
3350 | diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c |
3351 | index f7e9168..2637f6f 100644 |
3352 | --- a/drivers/media/video/em28xx/em28xx-cards.c |
3353 | +++ b/drivers/media/video/em28xx/em28xx-cards.c |
3354 | @@ -1633,11 +1633,11 @@ struct em28xx_board em28xx_boards[] = { |
3355 | .input = { { |
3356 | .type = EM28XX_VMUX_COMPOSITE1, |
3357 | .vmux = SAA7115_COMPOSITE0, |
3358 | - .amux = EM28XX_AMUX_VIDEO2, |
3359 | + .amux = EM28XX_AMUX_LINE_IN, |
3360 | }, { |
3361 | .type = EM28XX_VMUX_SVIDEO, |
3362 | .vmux = SAA7115_SVIDEO3, |
3363 | - .amux = EM28XX_AMUX_VIDEO2, |
3364 | + .amux = EM28XX_AMUX_LINE_IN, |
3365 | } }, |
3366 | }, |
3367 | [EM2860_BOARD_TERRATEC_AV350] = { |
3368 | diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c |
3369 | index bac7d62..0371bf5 100644 |
3370 | --- a/drivers/mmc/host/bfin_sdh.c |
3371 | +++ b/drivers/mmc/host/bfin_sdh.c |
3372 | @@ -462,7 +462,7 @@ static int __devinit sdh_probe(struct platform_device *pdev) |
3373 | goto out; |
3374 | } |
3375 | |
3376 | - mmc = mmc_alloc_host(sizeof(*mmc), &pdev->dev); |
3377 | + mmc = mmc_alloc_host(sizeof(struct sdh_host), &pdev->dev); |
3378 | if (!mmc) { |
3379 | ret = -ENOMEM; |
3380 | goto out; |
3381 | diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c |
3382 | index 17f8518..ea2c288 100644 |
3383 | --- a/drivers/mtd/nand/pxa3xx_nand.c |
3384 | +++ b/drivers/mtd/nand/pxa3xx_nand.c |
3385 | @@ -885,6 +885,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) |
3386 | /* set info fields needed to __readid */ |
3387 | info->read_id_bytes = (info->page_size == 2048) ? 4 : 2; |
3388 | info->reg_ndcr = ndcr; |
3389 | + info->cmdset = &default_cmdset; |
3390 | |
3391 | if (__readid(info, &id)) |
3392 | return -ENODEV; |
3393 | @@ -915,7 +916,6 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) |
3394 | |
3395 | info->ndtr0cs0 = nand_readl(info, NDTR0CS0); |
3396 | info->ndtr1cs0 = nand_readl(info, NDTR1CS0); |
3397 | - info->cmdset = &default_cmdset; |
3398 | |
3399 | return 0; |
3400 | } |
3401 | diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c |
3402 | index 4d62f7b..b3b251e 100644 |
3403 | --- a/drivers/net/e1000/e1000_main.c |
3404 | +++ b/drivers/net/e1000/e1000_main.c |
3405 | @@ -971,11 +971,13 @@ static int __devinit e1000_probe(struct pci_dev *pdev, |
3406 | */ |
3407 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); |
3408 | pci_using_dac = 1; |
3409 | - } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { |
3410 | - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
3411 | } else { |
3412 | - pr_err("No usable DMA config, aborting\n"); |
3413 | - goto err_dma; |
3414 | + err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
3415 | + if (err) { |
3416 | + pr_err("No usable DMA config, aborting\n"); |
3417 | + goto err_dma; |
3418 | + } |
3419 | + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
3420 | } |
3421 | |
3422 | netdev->netdev_ops = &e1000_netdev_ops; |
3423 | diff --git a/drivers/net/fec.c b/drivers/net/fec.c |
3424 | index cce32d4..52e9ca8 100644 |
3425 | --- a/drivers/net/fec.c |
3426 | +++ b/drivers/net/fec.c |
3427 | @@ -651,8 +651,8 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, |
3428 | fep->mii_timeout = 0; |
3429 | init_completion(&fep->mdio_done); |
3430 | |
3431 | - /* start a read op */ |
3432 | - writel(FEC_MMFR_ST | FEC_MMFR_OP_READ | |
3433 | + /* start a write op */ |
3434 | + writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE | |
3435 | FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) | |
3436 | FEC_MMFR_TA | FEC_MMFR_DATA(value), |
3437 | fep->hwp + FEC_MII_DATA); |
3438 | diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c |
3439 | index eee0b29..57d747a 100644 |
3440 | --- a/drivers/net/ixgbe/ixgbe_main.c |
3441 | +++ b/drivers/net/ixgbe/ixgbe_main.c |
3442 | @@ -2912,9 +2912,16 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) |
3443 | u32 mhadd, hlreg0; |
3444 | |
3445 | /* Decide whether to use packet split mode or not */ |
3446 | + /* On by default */ |
3447 | + adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; |
3448 | + |
3449 | /* Do not use packet split if we're in SR-IOV Mode */ |
3450 | - if (!adapter->num_vfs) |
3451 | - adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; |
3452 | + if (adapter->num_vfs) |
3453 | + adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; |
3454 | + |
3455 | + /* Disable packet split due to 82599 erratum #45 */ |
3456 | + if (hw->mac.type == ixgbe_mac_82599EB) |
3457 | + adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; |
3458 | |
3459 | /* Set the RX buffer length according to the mode */ |
3460 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { |
3461 | diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
3462 | index b6d4028..c1689ba 100644 |
3463 | --- a/drivers/net/virtio_net.c |
3464 | +++ b/drivers/net/virtio_net.c |
3465 | @@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq) |
3466 | } |
3467 | } |
3468 | |
3469 | +static void virtnet_napi_enable(struct virtnet_info *vi) |
3470 | +{ |
3471 | + napi_enable(&vi->napi); |
3472 | + |
3473 | + /* If all buffers were filled by other side before we napi_enabled, we |
3474 | + * won't get another interrupt, so process any outstanding packets |
3475 | + * now. virtnet_poll wants re-enable the queue, so we disable here. |
3476 | + * We synchronize against interrupts via NAPI_STATE_SCHED */ |
3477 | + if (napi_schedule_prep(&vi->napi)) { |
3478 | + virtqueue_disable_cb(vi->rvq); |
3479 | + __napi_schedule(&vi->napi); |
3480 | + } |
3481 | +} |
3482 | + |
3483 | static void refill_work(struct work_struct *work) |
3484 | { |
3485 | struct virtnet_info *vi; |
3486 | @@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work) |
3487 | vi = container_of(work, struct virtnet_info, refill.work); |
3488 | napi_disable(&vi->napi); |
3489 | still_empty = !try_fill_recv(vi, GFP_KERNEL); |
3490 | - napi_enable(&vi->napi); |
3491 | + virtnet_napi_enable(vi); |
3492 | |
3493 | /* In theory, this can happen: if we don't get any buffers in |
3494 | * we will *never* try to fill again. */ |
3495 | @@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev) |
3496 | { |
3497 | struct virtnet_info *vi = netdev_priv(dev); |
3498 | |
3499 | - napi_enable(&vi->napi); |
3500 | - |
3501 | - /* If all buffers were filled by other side before we napi_enabled, we |
3502 | - * won't get another interrupt, so process any outstanding packets |
3503 | - * now. virtnet_poll wants re-enable the queue, so we disable here. |
3504 | - * We synchronize against interrupts via NAPI_STATE_SCHED */ |
3505 | - if (napi_schedule_prep(&vi->napi)) { |
3506 | - virtqueue_disable_cb(vi->rvq); |
3507 | - __napi_schedule(&vi->napi); |
3508 | - } |
3509 | + virtnet_napi_enable(vi); |
3510 | return 0; |
3511 | } |
3512 | |
3513 | diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c |
3514 | index 15f62cd..9b6ba23 100644 |
3515 | --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c |
3516 | +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c |
3517 | @@ -681,10 +681,6 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah, |
3518 | |
3519 | /* Do NF cal only at longer intervals */ |
3520 | if (longcal || nfcal_pending) { |
3521 | - /* Do periodic PAOffset Cal */ |
3522 | - ar9002_hw_pa_cal(ah, false); |
3523 | - ar9002_hw_olc_temp_compensation(ah); |
3524 | - |
3525 | /* |
3526 | * Get the value from the previous NF cal and update |
3527 | * history buffer. |
3528 | @@ -699,8 +695,12 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah, |
3529 | ath9k_hw_loadnf(ah, ah->curchan); |
3530 | } |
3531 | |
3532 | - if (longcal) |
3533 | + if (longcal) { |
3534 | ath9k_hw_start_nfcal(ah, false); |
3535 | + /* Do periodic PAOffset Cal */ |
3536 | + ar9002_hw_pa_cal(ah, false); |
3537 | + ar9002_hw_olc_temp_compensation(ah); |
3538 | + } |
3539 | } |
3540 | |
3541 | return iscaldone; |
3542 | diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c |
3543 | index 48261b7..2528b29 100644 |
3544 | --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c |
3545 | +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c |
3546 | @@ -444,9 +444,8 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, |
3547 | } |
3548 | |
3549 | /* WAR for ASPM system hang */ |
3550 | - if (AR_SREV_9280(ah) || AR_SREV_9285(ah) || AR_SREV_9287(ah)) { |
3551 | + if (AR_SREV_9285(ah) || AR_SREV_9287(ah)) |
3552 | val |= (AR_WA_BIT6 | AR_WA_BIT7); |
3553 | - } |
3554 | |
3555 | if (AR_SREV_9285E_20(ah)) |
3556 | val |= AR_WA_BIT23; |
3557 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |
3558 | index a7b82f0..aa355df 100644 |
3559 | --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |
3560 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |
3561 | @@ -22,12 +22,14 @@ |
3562 | #define COMP_CKSUM_LEN 2 |
3563 | |
3564 | #define AR_CH0_TOP (0x00016288) |
3565 | -#define AR_CH0_TOP_XPABIASLVL (0x3) |
3566 | +#define AR_CH0_TOP_XPABIASLVL (0x300) |
3567 | #define AR_CH0_TOP_XPABIASLVL_S (8) |
3568 | |
3569 | #define AR_CH0_THERM (0x00016290) |
3570 | -#define AR_CH0_THERM_SPARE (0x3f) |
3571 | -#define AR_CH0_THERM_SPARE_S (0) |
3572 | +#define AR_CH0_THERM_XPABIASLVL_MSB 0x3 |
3573 | +#define AR_CH0_THERM_XPABIASLVL_MSB_S 0 |
3574 | +#define AR_CH0_THERM_XPASHORT2GND 0x4 |
3575 | +#define AR_CH0_THERM_XPASHORT2GND_S 2 |
3576 | |
3577 | #define AR_SWITCH_TABLE_COM_ALL (0xffff) |
3578 | #define AR_SWITCH_TABLE_COM_ALL_S (0) |
3579 | @@ -995,9 +997,9 @@ static s32 ar9003_hw_xpa_bias_level_get(struct ath_hw *ah, bool is2ghz) |
3580 | static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) |
3581 | { |
3582 | int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz); |
3583 | - REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, (bias & 0x3)); |
3584 | - REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_SPARE, |
3585 | - ((bias >> 2) & 0x3)); |
3586 | + REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); |
3587 | + REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, bias >> 2); |
3588 | + REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1); |
3589 | } |
3590 | |
3591 | static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) |
3592 | diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h |
3593 | index 0963071..c0b60ce 100644 |
3594 | --- a/drivers/net/wireless/ath/ath9k/ath9k.h |
3595 | +++ b/drivers/net/wireless/ath/ath9k/ath9k.h |
3596 | @@ -178,8 +178,8 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd, |
3597 | |
3598 | /* returns delimiter padding required given the packet length */ |
3599 | #define ATH_AGGR_GET_NDELIM(_len) \ |
3600 | - (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ? \ |
3601 | - (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2) |
3602 | + (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \ |
3603 | + DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ)) |
3604 | |
3605 | #define BAW_WITHIN(_start, _bawsz, _seqno) \ |
3606 | ((((_seqno) - (_start)) & 4095) < (_bawsz)) |
3607 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
3608 | index 0de3c3d..270671f 100644 |
3609 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
3610 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
3611 | @@ -144,16 +144,36 @@ static void hif_usb_tx_cb(struct urb *urb) |
3612 | case -ENODEV: |
3613 | case -ESHUTDOWN: |
3614 | /* |
3615 | - * The URB has been killed, free the SKBs |
3616 | - * and return. |
3617 | + * The URB has been killed, free the SKBs. |
3618 | */ |
3619 | ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue); |
3620 | - return; |
3621 | + |
3622 | + /* |
3623 | + * If the URBs are being flushed, no need to add this |
3624 | + * URB to the free list. |
3625 | + */ |
3626 | + spin_lock(&hif_dev->tx.tx_lock); |
3627 | + if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) { |
3628 | + spin_unlock(&hif_dev->tx.tx_lock); |
3629 | + return; |
3630 | + } |
3631 | + spin_unlock(&hif_dev->tx.tx_lock); |
3632 | + |
3633 | + /* |
3634 | + * In the stop() case, this URB has to be added to |
3635 | + * the free list. |
3636 | + */ |
3637 | + goto add_free; |
3638 | default: |
3639 | break; |
3640 | } |
3641 | |
3642 | - /* Check if TX has been stopped */ |
3643 | + /* |
3644 | + * Check if TX has been stopped, this is needed because |
3645 | + * this CB could have been invoked just after the TX lock |
3646 | + * was released in hif_stop() and kill_urb() hasn't been |
3647 | + * called yet. |
3648 | + */ |
3649 | spin_lock(&hif_dev->tx.tx_lock); |
3650 | if (hif_dev->tx.flags & HIF_USB_TX_STOP) { |
3651 | spin_unlock(&hif_dev->tx.tx_lock); |
3652 | @@ -305,6 +325,7 @@ static void hif_usb_start(void *hif_handle, u8 pipe_id) |
3653 | static void hif_usb_stop(void *hif_handle, u8 pipe_id) |
3654 | { |
3655 | struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; |
3656 | + struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; |
3657 | unsigned long flags; |
3658 | |
3659 | spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
3660 | @@ -312,6 +333,12 @@ static void hif_usb_stop(void *hif_handle, u8 pipe_id) |
3661 | hif_dev->tx.tx_skb_cnt = 0; |
3662 | hif_dev->tx.flags |= HIF_USB_TX_STOP; |
3663 | spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
3664 | + |
3665 | + /* The pending URBs have to be canceled. */ |
3666 | + list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
3667 | + &hif_dev->tx.tx_pending, list) { |
3668 | + usb_kill_urb(tx_buf->urb); |
3669 | + } |
3670 | } |
3671 | |
3672 | static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb, |
3673 | @@ -578,6 +605,7 @@ free: |
3674 | static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) |
3675 | { |
3676 | struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; |
3677 | + unsigned long flags; |
3678 | |
3679 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
3680 | &hif_dev->tx.tx_buf, list) { |
3681 | @@ -588,6 +616,10 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) |
3682 | kfree(tx_buf); |
3683 | } |
3684 | |
3685 | + spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
3686 | + hif_dev->tx.flags |= HIF_USB_TX_FLUSH; |
3687 | + spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
3688 | + |
3689 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
3690 | &hif_dev->tx.tx_pending, list) { |
3691 | usb_kill_urb(tx_buf->urb); |
3692 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h |
3693 | index 2daf97b..30d0938 100644 |
3694 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.h |
3695 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h |
3696 | @@ -62,6 +62,7 @@ struct tx_buf { |
3697 | }; |
3698 | |
3699 | #define HIF_USB_TX_STOP BIT(0) |
3700 | +#define HIF_USB_TX_FLUSH BIT(1) |
3701 | |
3702 | struct hif_usb_tx { |
3703 | u8 flags; |
3704 | diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c |
3705 | index c7fbe25..5dcf140 100644 |
3706 | --- a/drivers/net/wireless/ath/ath9k/hw.c |
3707 | +++ b/drivers/net/wireless/ath/ath9k/hw.c |
3708 | @@ -385,6 +385,9 @@ static void ath9k_hw_init_config(struct ath_hw *ah) |
3709 | else |
3710 | ah->config.ht_enable = 0; |
3711 | |
3712 | + /* PAPRD needs some more work to be enabled */ |
3713 | + ah->config.paprd_disable = 1; |
3714 | + |
3715 | ah->config.rx_intr_mitigation = true; |
3716 | ah->config.pcieSerDesWrite = true; |
3717 | |
3718 | @@ -1949,7 +1952,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) |
3719 | pCap->rx_status_len = sizeof(struct ar9003_rxs); |
3720 | pCap->tx_desc_len = sizeof(struct ar9003_txc); |
3721 | pCap->txs_len = sizeof(struct ar9003_txs); |
3722 | - if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) |
3723 | + if (!ah->config.paprd_disable && |
3724 | + ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) |
3725 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; |
3726 | } else { |
3727 | pCap->tx_desc_len = sizeof(struct ath_desc); |
3728 | diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h |
3729 | index d47d1b4..1240376 100644 |
3730 | --- a/drivers/net/wireless/ath/ath9k/hw.h |
3731 | +++ b/drivers/net/wireless/ath/ath9k/hw.h |
3732 | @@ -215,6 +215,7 @@ struct ath9k_ops_config { |
3733 | u32 pcie_waen; |
3734 | u8 analog_shiftreg; |
3735 | u8 ht_enable; |
3736 | + u8 paprd_disable; |
3737 | u32 ofdm_trig_low; |
3738 | u32 ofdm_trig_high; |
3739 | u32 cck_trig_high; |
3740 | diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
3741 | index c0c3464..d1b0db4 100644 |
3742 | --- a/drivers/net/wireless/ath/ath9k/main.c |
3743 | +++ b/drivers/net/wireless/ath/ath9k/main.c |
3744 | @@ -295,7 +295,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, |
3745 | ath9k_hw_set_interrupts(ah, ah->imask); |
3746 | |
3747 | if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) { |
3748 | - ath_beacon_config(sc, NULL); |
3749 | + if (sc->sc_flags & SC_OP_BEACONS) |
3750 | + ath_beacon_config(sc, NULL); |
3751 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
3752 | ath_start_ani(common); |
3753 | } |
3754 | @@ -1418,8 +1419,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) |
3755 | ath9k_hw_configpcipowersave(ah, 1, 1); |
3756 | ath9k_ps_restore(sc); |
3757 | |
3758 | - /* Finally, put the chip in FULL SLEEP mode */ |
3759 | - ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); |
3760 | + sc->ps_idle = true; |
3761 | + ath9k_set_wiphy_idle(aphy, true); |
3762 | + ath_radio_disable(sc, hw); |
3763 | |
3764 | sc->sc_flags |= SC_OP_INVALID; |
3765 | |
3766 | diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c |
3767 | index b5b6514..894ebadb 100644 |
3768 | --- a/drivers/net/wireless/ath/ath9k/pci.c |
3769 | +++ b/drivers/net/wireless/ath/ath9k/pci.c |
3770 | @@ -290,6 +290,10 @@ static int ath_pci_resume(struct pci_dev *pdev) |
3771 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
3772 | ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); |
3773 | |
3774 | + sc->ps_idle = true; |
3775 | + ath9k_set_wiphy_idle(aphy, true); |
3776 | + ath_radio_disable(sc, hw); |
3777 | + |
3778 | return 0; |
3779 | } |
3780 | |
3781 | diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c |
3782 | index 939a0e9..84866a4 100644 |
3783 | --- a/drivers/net/wireless/ath/carl9170/rx.c |
3784 | +++ b/drivers/net/wireless/ath/carl9170/rx.c |
3785 | @@ -564,7 +564,7 @@ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len) |
3786 | cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid); |
3787 | |
3788 | /* 2. Maybe the AP wants to send multicast/broadcast data? */ |
3789 | - cam = !!(tim_ie->bitmap_ctrl & 0x01); |
3790 | + cam |= !!(tim_ie->bitmap_ctrl & 0x01); |
3791 | |
3792 | if (!cam) { |
3793 | /* back to low-power land. */ |
3794 | diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c |
3795 | index bd21a4d..32fcc19 100644 |
3796 | --- a/drivers/net/wireless/ath/key.c |
3797 | +++ b/drivers/net/wireless/ath/key.c |
3798 | @@ -60,6 +60,8 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry) |
3799 | REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0); |
3800 | REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), 0); |
3801 | REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0); |
3802 | + if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) |
3803 | + REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0); |
3804 | |
3805 | } |
3806 | |
3807 | diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c |
3808 | index bd8a413..2176ede 100644 |
3809 | --- a/drivers/net/wireless/hostap/hostap_cs.c |
3810 | +++ b/drivers/net/wireless/hostap/hostap_cs.c |
3811 | @@ -518,22 +518,21 @@ static int prism2_config(struct pcmcia_device *link) |
3812 | hw_priv->link = link; |
3813 | |
3814 | /* |
3815 | - * Make sure the IRQ handler cannot proceed until at least |
3816 | - * dev->base_addr is initialized. |
3817 | + * We enable IRQ here, but IRQ handler will not proceed |
3818 | + * until dev->base_addr is set below. This protect us from |
3819 | + * receive interrupts when driver is not initialized. |
3820 | */ |
3821 | - spin_lock_irqsave(&local->irq_init_lock, flags); |
3822 | - |
3823 | ret = pcmcia_request_irq(link, prism2_interrupt); |
3824 | if (ret) |
3825 | - goto failed_unlock; |
3826 | + goto failed; |
3827 | |
3828 | ret = pcmcia_enable_device(link); |
3829 | if (ret) |
3830 | - goto failed_unlock; |
3831 | + goto failed; |
3832 | |
3833 | + spin_lock_irqsave(&local->irq_init_lock, flags); |
3834 | dev->irq = link->irq; |
3835 | dev->base_addr = link->resource[0]->start; |
3836 | - |
3837 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
3838 | |
3839 | local->shutdown = 0; |
3840 | @@ -546,8 +545,6 @@ static int prism2_config(struct pcmcia_device *link) |
3841 | |
3842 | return ret; |
3843 | |
3844 | - failed_unlock: |
3845 | - spin_unlock_irqrestore(&local->irq_init_lock, flags); |
3846 | failed: |
3847 | kfree(hw_priv); |
3848 | prism2_release((u_long)link); |
3849 | diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c |
3850 | index c2636a7..f0468cd 100644 |
3851 | --- a/drivers/net/wireless/iwlwifi/iwl-agn.c |
3852 | +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c |
3853 | @@ -1319,6 +1319,9 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv) |
3854 | /* only Re-enable if diabled by irq */ |
3855 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
3856 | iwl_enable_interrupts(priv); |
3857 | + /* Re-enable RF_KILL if it occurred */ |
3858 | + else if (handled & CSR_INT_BIT_RF_KILL) |
3859 | + iwl_enable_rfkill_int(priv); |
3860 | |
3861 | #ifdef CONFIG_IWLWIFI_DEBUG |
3862 | if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) { |
3863 | @@ -1533,6 +1536,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) |
3864 | /* only Re-enable if diabled by irq */ |
3865 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
3866 | iwl_enable_interrupts(priv); |
3867 | + /* Re-enable RF_KILL if it occurred */ |
3868 | + else if (handled & CSR_INT_BIT_RF_KILL) |
3869 | + iwl_enable_rfkill_int(priv); |
3870 | } |
3871 | |
3872 | /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ |
3873 | @@ -3530,9 +3536,10 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) |
3874 | |
3875 | flush_workqueue(priv->workqueue); |
3876 | |
3877 | - /* enable interrupts again in order to receive rfkill changes */ |
3878 | + /* User space software may expect getting rfkill changes |
3879 | + * even if interface is down */ |
3880 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
3881 | - iwl_enable_interrupts(priv); |
3882 | + iwl_enable_rfkill_int(priv); |
3883 | |
3884 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
3885 | } |
3886 | @@ -4515,14 +4522,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
3887 | * 8. Enable interrupts and read RFKILL state |
3888 | *********************************************/ |
3889 | |
3890 | - /* enable interrupts if needed: hw bug w/a */ |
3891 | + /* enable rfkill interrupt: hw bug w/a */ |
3892 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); |
3893 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { |
3894 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; |
3895 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); |
3896 | } |
3897 | |
3898 | - iwl_enable_interrupts(priv); |
3899 | + iwl_enable_rfkill_int(priv); |
3900 | |
3901 | /* If platform's RF_KILL switch is NOT set to KILL */ |
3902 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
3903 | diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h |
3904 | index 1aaef70..19f5586 100644 |
3905 | --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h |
3906 | +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h |
3907 | @@ -163,6 +163,12 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv) |
3908 | IWL_DEBUG_ISR(priv, "Disabled interrupts\n"); |
3909 | } |
3910 | |
3911 | +static inline void iwl_enable_rfkill_int(struct iwl_priv *priv) |
3912 | +{ |
3913 | + IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); |
3914 | + iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); |
3915 | +} |
3916 | + |
3917 | static inline void iwl_enable_interrupts(struct iwl_priv *priv) |
3918 | { |
3919 | IWL_DEBUG_ISR(priv, "Enabling interrupts\n"); |
3920 | diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c |
3921 | index 76b2318a..f618b96 100644 |
3922 | --- a/drivers/net/wireless/p54/txrx.c |
3923 | +++ b/drivers/net/wireless/p54/txrx.c |
3924 | @@ -618,7 +618,7 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, |
3925 | else |
3926 | *burst_possible = false; |
3927 | |
3928 | - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) |
3929 | + if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) |
3930 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; |
3931 | |
3932 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) |
3933 | diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c |
3934 | index 9be8089..4c6fba7 100644 |
3935 | --- a/drivers/net/wireless/rt2x00/rt73usb.c |
3936 | +++ b/drivers/net/wireless/rt2x00/rt73usb.c |
3937 | @@ -2417,6 +2417,7 @@ static struct usb_device_id rt73usb_device_table[] = { |
3938 | { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, |
3939 | { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, |
3940 | { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, |
3941 | + { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) }, |
3942 | /* Qcom */ |
3943 | { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, |
3944 | { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, |
3945 | diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c |
3946 | index f7b68ca..4ae494b 100644 |
3947 | --- a/drivers/pci/pci-stub.c |
3948 | +++ b/drivers/pci/pci-stub.c |
3949 | @@ -54,6 +54,9 @@ static int __init pci_stub_init(void) |
3950 | subdevice = PCI_ANY_ID, class=0, class_mask=0; |
3951 | int fields; |
3952 | |
3953 | + if (!strlen(id)) |
3954 | + continue; |
3955 | + |
3956 | fields = sscanf(id, "%x:%x:%x:%x:%x:%x", |
3957 | &vendor, &device, &subvendor, &subdevice, |
3958 | &class, &class_mask); |
3959 | diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c |
3960 | index b3c01c1..11e1ac5 100644 |
3961 | --- a/drivers/power/ds2760_battery.c |
3962 | +++ b/drivers/power/ds2760_battery.c |
3963 | @@ -212,7 +212,7 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di) |
3964 | if (di->rem_capacity > 100) |
3965 | di->rem_capacity = 100; |
3966 | |
3967 | - if (di->current_uA >= 100L) |
3968 | + if (di->current_uA < -100L) |
3969 | di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) |
3970 | / (di->current_uA / 100L); |
3971 | else |
3972 | diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c |
3973 | index a8108a7..2bbe04a 100644 |
3974 | --- a/drivers/power/jz4740-battery.c |
3975 | +++ b/drivers/power/jz4740-battery.c |
3976 | @@ -47,6 +47,8 @@ struct jz_battery { |
3977 | |
3978 | struct power_supply battery; |
3979 | struct delayed_work work; |
3980 | + |
3981 | + struct mutex lock; |
3982 | }; |
3983 | |
3984 | static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) |
3985 | @@ -68,6 +70,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery) |
3986 | unsigned long val; |
3987 | long voltage; |
3988 | |
3989 | + mutex_lock(&battery->lock); |
3990 | + |
3991 | INIT_COMPLETION(battery->read_completion); |
3992 | |
3993 | enable_irq(battery->irq); |
3994 | @@ -91,6 +95,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery) |
3995 | battery->cell->disable(battery->pdev); |
3996 | disable_irq(battery->irq); |
3997 | |
3998 | + mutex_unlock(&battery->lock); |
3999 | + |
4000 | return voltage; |
4001 | } |
4002 | |
4003 | @@ -291,6 +297,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev) |
4004 | jz_battery->pdev = pdev; |
4005 | |
4006 | init_completion(&jz_battery->read_completion); |
4007 | + mutex_init(&jz_battery->lock); |
4008 | |
4009 | INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); |
4010 | |
4011 | diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c |
4012 | index 5856167..dd8242d 100644 |
4013 | --- a/drivers/rtc/rtc-cmos.c |
4014 | +++ b/drivers/rtc/rtc-cmos.c |
4015 | @@ -36,6 +36,7 @@ |
4016 | #include <linux/platform_device.h> |
4017 | #include <linux/mod_devicetable.h> |
4018 | #include <linux/log2.h> |
4019 | +#include <linux/pm.h> |
4020 | |
4021 | /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ |
4022 | #include <asm-generic/rtc.h> |
4023 | @@ -850,7 +851,7 @@ static void __exit cmos_do_remove(struct device *dev) |
4024 | |
4025 | #ifdef CONFIG_PM |
4026 | |
4027 | -static int cmos_suspend(struct device *dev, pm_message_t mesg) |
4028 | +static int cmos_suspend(struct device *dev) |
4029 | { |
4030 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
4031 | unsigned char tmp; |
4032 | @@ -898,7 +899,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) |
4033 | */ |
4034 | static inline int cmos_poweroff(struct device *dev) |
4035 | { |
4036 | - return cmos_suspend(dev, PMSG_HIBERNATE); |
4037 | + return cmos_suspend(dev); |
4038 | } |
4039 | |
4040 | static int cmos_resume(struct device *dev) |
4041 | @@ -945,9 +946,9 @@ static int cmos_resume(struct device *dev) |
4042 | return 0; |
4043 | } |
4044 | |
4045 | +static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume); |
4046 | + |
4047 | #else |
4048 | -#define cmos_suspend NULL |
4049 | -#define cmos_resume NULL |
4050 | |
4051 | static inline int cmos_poweroff(struct device *dev) |
4052 | { |
4053 | @@ -1077,7 +1078,7 @@ static void __exit cmos_pnp_remove(struct pnp_dev *pnp) |
4054 | |
4055 | static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg) |
4056 | { |
4057 | - return cmos_suspend(&pnp->dev, mesg); |
4058 | + return cmos_suspend(&pnp->dev); |
4059 | } |
4060 | |
4061 | static int cmos_pnp_resume(struct pnp_dev *pnp) |
4062 | @@ -1157,8 +1158,9 @@ static struct platform_driver cmos_platform_driver = { |
4063 | .shutdown = cmos_platform_shutdown, |
4064 | .driver = { |
4065 | .name = (char *) driver_name, |
4066 | - .suspend = cmos_suspend, |
4067 | - .resume = cmos_resume, |
4068 | +#ifdef CONFIG_PM |
4069 | + .pm = &cmos_pm_ops, |
4070 | +#endif |
4071 | } |
4072 | }; |
4073 | |
4074 | diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h |
4075 | index 0f4ef87..3e6ad23 100644 |
4076 | --- a/drivers/s390/cio/qdio.h |
4077 | +++ b/drivers/s390/cio/qdio.h |
4078 | @@ -91,6 +91,12 @@ enum qdio_irq_states { |
4079 | #define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ |
4080 | #define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ |
4081 | |
4082 | +/* SIGA flags */ |
4083 | +#define QDIO_SIGA_WRITE 0x00 |
4084 | +#define QDIO_SIGA_READ 0x01 |
4085 | +#define QDIO_SIGA_SYNC 0x02 |
4086 | +#define QDIO_SIGA_QEBSM_FLAG 0x80 |
4087 | + |
4088 | #ifdef CONFIG_64BIT |
4089 | static inline int do_sqbs(u64 token, unsigned char state, int queue, |
4090 | int *start, int *count) |
4091 | diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c |
4092 | index 5fcfa7f..27de2ea 100644 |
4093 | --- a/drivers/s390/cio/qdio_main.c |
4094 | +++ b/drivers/s390/cio/qdio_main.c |
4095 | @@ -29,11 +29,12 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\ |
4096 | MODULE_DESCRIPTION("QDIO base support"); |
4097 | MODULE_LICENSE("GPL"); |
4098 | |
4099 | -static inline int do_siga_sync(struct subchannel_id schid, |
4100 | - unsigned int out_mask, unsigned int in_mask) |
4101 | +static inline int do_siga_sync(unsigned long schid, |
4102 | + unsigned int out_mask, unsigned int in_mask, |
4103 | + unsigned int fc) |
4104 | { |
4105 | - register unsigned long __fc asm ("0") = 2; |
4106 | - register struct subchannel_id __schid asm ("1") = schid; |
4107 | + register unsigned long __fc asm ("0") = fc; |
4108 | + register unsigned long __schid asm ("1") = schid; |
4109 | register unsigned long out asm ("2") = out_mask; |
4110 | register unsigned long in asm ("3") = in_mask; |
4111 | int cc; |
4112 | @@ -47,10 +48,11 @@ static inline int do_siga_sync(struct subchannel_id schid, |
4113 | return cc; |
4114 | } |
4115 | |
4116 | -static inline int do_siga_input(struct subchannel_id schid, unsigned int mask) |
4117 | +static inline int do_siga_input(unsigned long schid, unsigned int mask, |
4118 | + unsigned int fc) |
4119 | { |
4120 | - register unsigned long __fc asm ("0") = 1; |
4121 | - register struct subchannel_id __schid asm ("1") = schid; |
4122 | + register unsigned long __fc asm ("0") = fc; |
4123 | + register unsigned long __schid asm ("1") = schid; |
4124 | register unsigned long __mask asm ("2") = mask; |
4125 | int cc; |
4126 | |
4127 | @@ -279,6 +281,8 @@ void qdio_init_buf_states(struct qdio_irq *irq_ptr) |
4128 | static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, |
4129 | unsigned int input) |
4130 | { |
4131 | + unsigned long schid = *((u32 *) &q->irq_ptr->schid); |
4132 | + unsigned int fc = QDIO_SIGA_SYNC; |
4133 | int cc; |
4134 | |
4135 | if (!need_siga_sync(q)) |
4136 | @@ -287,7 +291,12 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, |
4137 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); |
4138 | qperf_inc(q, siga_sync); |
4139 | |
4140 | - cc = do_siga_sync(q->irq_ptr->schid, output, input); |
4141 | + if (is_qebsm(q)) { |
4142 | + schid = q->irq_ptr->sch_token; |
4143 | + fc |= QDIO_SIGA_QEBSM_FLAG; |
4144 | + } |
4145 | + |
4146 | + cc = do_siga_sync(schid, output, input, fc); |
4147 | if (cc) |
4148 | DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc); |
4149 | return cc; |
4150 | @@ -313,8 +322,8 @@ static inline int qdio_siga_sync_all(struct qdio_q *q) |
4151 | |
4152 | static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) |
4153 | { |
4154 | - unsigned long schid; |
4155 | - unsigned int fc = 0; |
4156 | + unsigned long schid = *((u32 *) &q->irq_ptr->schid); |
4157 | + unsigned int fc = QDIO_SIGA_WRITE; |
4158 | u64 start_time = 0; |
4159 | int cc; |
4160 | |
4161 | @@ -323,11 +332,8 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) |
4162 | |
4163 | if (is_qebsm(q)) { |
4164 | schid = q->irq_ptr->sch_token; |
4165 | - fc |= 0x80; |
4166 | + fc |= QDIO_SIGA_QEBSM_FLAG; |
4167 | } |
4168 | - else |
4169 | - schid = *((u32 *)&q->irq_ptr->schid); |
4170 | - |
4171 | again: |
4172 | cc = do_siga_output(schid, q->mask, busy_bit, fc); |
4173 | |
4174 | @@ -347,12 +353,19 @@ again: |
4175 | |
4176 | static inline int qdio_siga_input(struct qdio_q *q) |
4177 | { |
4178 | + unsigned long schid = *((u32 *) &q->irq_ptr->schid); |
4179 | + unsigned int fc = QDIO_SIGA_READ; |
4180 | int cc; |
4181 | |
4182 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); |
4183 | qperf_inc(q, siga_read); |
4184 | |
4185 | - cc = do_siga_input(q->irq_ptr->schid, q->mask); |
4186 | + if (is_qebsm(q)) { |
4187 | + schid = q->irq_ptr->sch_token; |
4188 | + fc |= QDIO_SIGA_QEBSM_FLAG; |
4189 | + } |
4190 | + |
4191 | + cc = do_siga_input(schid, q->mask, fc); |
4192 | if (cc) |
4193 | DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc); |
4194 | return cc; |
4195 | diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c |
4196 | index 8fd8c62..a1ba52a 100644 |
4197 | --- a/drivers/s390/crypto/ap_bus.c |
4198 | +++ b/drivers/s390/crypto/ap_bus.c |
4199 | @@ -154,7 +154,7 @@ static inline int ap_instructions_available(void) |
4200 | */ |
4201 | static int ap_interrupts_available(void) |
4202 | { |
4203 | - return test_facility(1) && test_facility(2); |
4204 | + return test_facility(2) && test_facility(65); |
4205 | } |
4206 | |
4207 | /** |
4208 | diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c |
4209 | index 29251fa..812d32c 100644 |
4210 | --- a/drivers/scsi/libsas/sas_scsi_host.c |
4211 | +++ b/drivers/scsi/libsas/sas_scsi_host.c |
4212 | @@ -647,6 +647,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost) |
4213 | |
4214 | spin_lock_irqsave(shost->host_lock, flags); |
4215 | list_splice_init(&shost->eh_cmd_q, &eh_work_q); |
4216 | + shost->host_eh_scheduled = 0; |
4217 | spin_unlock_irqrestore(shost->host_lock, flags); |
4218 | |
4219 | SAS_DPRINTK("Enter %s\n", __func__); |
4220 | diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c |
4221 | index 12faf64..7227227 100644 |
4222 | --- a/drivers/scsi/mpt2sas/mpt2sas_base.c |
4223 | +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c |
4224 | @@ -2057,9 +2057,9 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) |
4225 | /* adjust hba_queue_depth, reply_free_queue_depth, |
4226 | * and queue_size |
4227 | */ |
4228 | - ioc->hba_queue_depth -= queue_diff; |
4229 | - ioc->reply_free_queue_depth -= queue_diff; |
4230 | - queue_size -= queue_diff; |
4231 | + ioc->hba_queue_depth -= (queue_diff / 2); |
4232 | + ioc->reply_free_queue_depth -= (queue_diff / 2); |
4233 | + queue_size = facts->MaxReplyDescriptorPostQueueDepth; |
4234 | } |
4235 | ioc->reply_post_queue_depth = queue_size; |
4236 | |
4237 | @@ -3662,6 +3662,11 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) |
4238 | ioc->scsih_cmds.status = MPT2_CMD_NOT_USED; |
4239 | mutex_init(&ioc->scsih_cmds.mutex); |
4240 | |
4241 | + /* scsih internal command bits */ |
4242 | + ioc->scsih_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
4243 | + ioc->scsih_cmds.status = MPT2_CMD_NOT_USED; |
4244 | + mutex_init(&ioc->scsih_cmds.mutex); |
4245 | + |
4246 | /* task management internal command bits */ |
4247 | ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
4248 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; |
4249 | @@ -3786,6 +3791,8 @@ mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc) |
4250 | static void |
4251 | _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) |
4252 | { |
4253 | + mpt2sas_scsih_reset_handler(ioc, reset_phase); |
4254 | + mpt2sas_ctl_reset_handler(ioc, reset_phase); |
4255 | switch (reset_phase) { |
4256 | case MPT2_IOC_PRE_RESET: |
4257 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: " |
4258 | @@ -3816,8 +3823,6 @@ _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) |
4259 | "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); |
4260 | break; |
4261 | } |
4262 | - mpt2sas_scsih_reset_handler(ioc, reset_phase); |
4263 | - mpt2sas_ctl_reset_handler(ioc, reset_phase); |
4264 | } |
4265 | |
4266 | /** |
4267 | @@ -3871,6 +3876,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, |
4268 | { |
4269 | int r; |
4270 | unsigned long flags; |
4271 | + u8 pe_complete = ioc->wait_for_port_enable_to_complete; |
4272 | |
4273 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, |
4274 | __func__)); |
4275 | @@ -3913,6 +3919,14 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, |
4276 | if (r) |
4277 | goto out; |
4278 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); |
4279 | + |
4280 | + /* If this hard reset is called while port enable is active, then |
4281 | + * there is no reason to call make_ioc_operational |
4282 | + */ |
4283 | + if (pe_complete) { |
4284 | + r = -EFAULT; |
4285 | + goto out; |
4286 | + } |
4287 | r = _base_make_ioc_operational(ioc, sleep_flag); |
4288 | if (!r) |
4289 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); |
4290 | diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c |
4291 | index 1a96a00..90bc21e 100644 |
4292 | --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c |
4293 | +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c |
4294 | @@ -819,7 +819,7 @@ _scsih_is_end_device(u32 device_info) |
4295 | } |
4296 | |
4297 | /** |
4298 | - * mptscsih_get_scsi_lookup - returns scmd entry |
4299 | + * _scsih_scsi_lookup_get - returns scmd entry |
4300 | * @ioc: per adapter object |
4301 | * @smid: system request message index |
4302 | * |
4303 | @@ -832,6 +832,28 @@ _scsih_scsi_lookup_get(struct MPT2SAS_ADAPTER *ioc, u16 smid) |
4304 | } |
4305 | |
4306 | /** |
4307 | + * _scsih_scsi_lookup_get_clear - returns scmd entry |
4308 | + * @ioc: per adapter object |
4309 | + * @smid: system request message index |
4310 | + * |
4311 | + * Returns the smid stored scmd pointer. |
4312 | + * Then will derefrence the stored scmd pointer. |
4313 | + */ |
4314 | +static inline struct scsi_cmnd * |
4315 | +_scsih_scsi_lookup_get_clear(struct MPT2SAS_ADAPTER *ioc, u16 smid) |
4316 | +{ |
4317 | + unsigned long flags; |
4318 | + struct scsi_cmnd *scmd; |
4319 | + |
4320 | + spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
4321 | + scmd = ioc->scsi_lookup[smid - 1].scmd; |
4322 | + ioc->scsi_lookup[smid - 1].scmd = NULL; |
4323 | + spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
4324 | + |
4325 | + return scmd; |
4326 | +} |
4327 | + |
4328 | +/** |
4329 | * _scsih_scsi_lookup_find_by_scmd - scmd lookup |
4330 | * @ioc: per adapter object |
4331 | * @smid: system request message index |
4332 | @@ -2957,9 +2979,6 @@ _scsih_check_topo_delete_events(struct MPT2SAS_ADAPTER *ioc, |
4333 | u16 handle; |
4334 | |
4335 | for (i = 0 ; i < event_data->NumEntries; i++) { |
4336 | - if (event_data->PHY[i].PhyStatus & |
4337 | - MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT) |
4338 | - continue; |
4339 | handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle); |
4340 | if (!handle) |
4341 | continue; |
4342 | @@ -3186,7 +3205,7 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc) |
4343 | u16 count = 0; |
4344 | |
4345 | for (smid = 1; smid <= ioc->scsiio_depth; smid++) { |
4346 | - scmd = _scsih_scsi_lookup_get(ioc, smid); |
4347 | + scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
4348 | if (!scmd) |
4349 | continue; |
4350 | count++; |
4351 | @@ -3780,7 +3799,7 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) |
4352 | u32 response_code = 0; |
4353 | |
4354 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); |
4355 | - scmd = _scsih_scsi_lookup_get(ioc, smid); |
4356 | + scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
4357 | if (scmd == NULL) |
4358 | return 1; |
4359 | |
4360 | @@ -4942,6 +4961,12 @@ _scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc, |
4361 | event_data); |
4362 | #endif |
4363 | |
4364 | + /* In MPI Revision K (0xC), the internal device reset complete was |
4365 | + * implemented, so avoid setting tm_busy flag for older firmware. |
4366 | + */ |
4367 | + if ((ioc->facts.HeaderVersion >> 8) < 0xC) |
4368 | + return; |
4369 | + |
4370 | if (event_data->ReasonCode != |
4371 | MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET && |
4372 | event_data->ReasonCode != |
4373 | @@ -5036,6 +5061,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, |
4374 | struct fw_event_work *fw_event) |
4375 | { |
4376 | struct scsi_cmnd *scmd; |
4377 | + struct scsi_device *sdev; |
4378 | u16 smid, handle; |
4379 | u32 lun; |
4380 | struct MPT2SAS_DEVICE *sas_device_priv_data; |
4381 | @@ -5046,12 +5072,17 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, |
4382 | Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; |
4383 | #endif |
4384 | u16 ioc_status; |
4385 | + unsigned long flags; |
4386 | + int r; |
4387 | + |
4388 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: " |
4389 | "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, |
4390 | event_data->PortWidth)); |
4391 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, |
4392 | __func__)); |
4393 | |
4394 | + spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
4395 | + ioc->broadcast_aen_busy = 0; |
4396 | termination_count = 0; |
4397 | query_count = 0; |
4398 | mpi_reply = ioc->tm_cmds.reply; |
4399 | @@ -5059,7 +5090,8 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, |
4400 | scmd = _scsih_scsi_lookup_get(ioc, smid); |
4401 | if (!scmd) |
4402 | continue; |
4403 | - sas_device_priv_data = scmd->device->hostdata; |
4404 | + sdev = scmd->device; |
4405 | + sas_device_priv_data = sdev->hostdata; |
4406 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) |
4407 | continue; |
4408 | /* skip hidden raid components */ |
4409 | @@ -5075,6 +5107,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, |
4410 | lun = sas_device_priv_data->lun; |
4411 | query_count++; |
4412 | |
4413 | + spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
4414 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, |
4415 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL); |
4416 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; |
4417 | @@ -5084,14 +5117,20 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, |
4418 | (mpi_reply->ResponseCode == |
4419 | MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || |
4420 | mpi_reply->ResponseCode == |
4421 | - MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) |
4422 | + MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) { |
4423 | + spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
4424 | continue; |
4425 | - |
4426 | - mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, |
4427 | - MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, 0, 30, NULL); |
4428 | + } |
4429 | + r = mpt2sas_scsih_issue_tm(ioc, handle, sdev->channel, sdev->id, |
4430 | + sdev->lun, MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK, smid, 30, |
4431 | + scmd); |
4432 | + if (r == FAILED) |
4433 | + sdev_printk(KERN_WARNING, sdev, "task abort: FAILED " |
4434 | + "scmd(%p)\n", scmd); |
4435 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); |
4436 | + spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
4437 | } |
4438 | - ioc->broadcast_aen_busy = 0; |
4439 | + spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
4440 | |
4441 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT |
4442 | "%s - exit, query_count = %d termination_count = %d\n", |
4443 | @@ -6687,6 +6726,7 @@ _scsih_remove(struct pci_dev *pdev) |
4444 | destroy_workqueue(wq); |
4445 | |
4446 | /* release all the volumes */ |
4447 | + _scsih_ir_shutdown(ioc); |
4448 | list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, |
4449 | list) { |
4450 | if (raid_device->starget) { |
4451 | diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
4452 | index 9564961..9c9e6d3 100644 |
4453 | --- a/drivers/scsi/sd.c |
4454 | +++ b/drivers/scsi/sd.c |
4455 | @@ -1175,6 +1175,12 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) |
4456 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); |
4457 | u64 bad_lba; |
4458 | int info_valid; |
4459 | + /* |
4460 | + * resid is optional but mostly filled in. When it's unused, |
4461 | + * its value is zero, so we assume the whole buffer transferred |
4462 | + */ |
4463 | + unsigned int transferred = scsi_bufflen(scmd) - scsi_get_resid(scmd); |
4464 | + unsigned int good_bytes; |
4465 | |
4466 | if (scmd->request->cmd_type != REQ_TYPE_FS) |
4467 | return 0; |
4468 | @@ -1208,7 +1214,8 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) |
4469 | /* This computation should always be done in terms of |
4470 | * the resolution of the device's medium. |
4471 | */ |
4472 | - return (bad_lba - start_lba) * scmd->device->sector_size; |
4473 | + good_bytes = (bad_lba - start_lba) * scmd->device->sector_size; |
4474 | + return min(good_bytes, transferred); |
4475 | } |
4476 | |
4477 | /** |
4478 | diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c |
4479 | index 88b1335..bc21eea 100644 |
4480 | --- a/drivers/serial/68360serial.c |
4481 | +++ b/drivers/serial/68360serial.c |
4482 | @@ -2428,6 +2428,7 @@ static const struct tty_operations rs_360_ops = { |
4483 | /* .read_proc = rs_360_read_proc, */ |
4484 | .tiocmget = rs_360_tiocmget, |
4485 | .tiocmset = rs_360_tiocmset, |
4486 | + .get_icount = rs_360_get_icount, |
4487 | }; |
4488 | |
4489 | static int __init rs_360_init(void) |
4490 | diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c |
4491 | index 09a5508..b2b40f91 100644 |
4492 | --- a/drivers/serial/8250.c |
4493 | +++ b/drivers/serial/8250.c |
4494 | @@ -236,7 +236,8 @@ static const struct serial8250_config uart_config[] = { |
4495 | .fifo_size = 128, |
4496 | .tx_loadsz = 128, |
4497 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
4498 | - .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, |
4499 | + /* UART_CAP_EFR breaks billionon CF bluetooth card. */ |
4500 | + .flags = UART_CAP_FIFO | UART_CAP_SLEEP, |
4501 | }, |
4502 | [PORT_16654] = { |
4503 | .name = "ST16654", |
4504 | diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c |
4505 | index c7345db..f853379 100644 |
4506 | --- a/drivers/ssb/pcmcia.c |
4507 | +++ b/drivers/ssb/pcmcia.c |
4508 | @@ -733,7 +733,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, |
4509 | |
4510 | /* Fetch the vendor specific tuples. */ |
4511 | res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, |
4512 | - ssb_pcmcia_do_get_invariants, sprom); |
4513 | + ssb_pcmcia_do_get_invariants, iv); |
4514 | if ((res == 0) || (res == -ENOSPC)) |
4515 | return 0; |
4516 | |
4517 | diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c |
4518 | index 824f9a4..dc760ef 100644 |
4519 | --- a/drivers/staging/bcm/InterfaceInit.c |
4520 | +++ b/drivers/staging/bcm/InterfaceInit.c |
4521 | @@ -4,6 +4,7 @@ static struct usb_device_id InterfaceUsbtable[] = { |
4522 | { USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3) }, |
4523 | { USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3B) }, |
4524 | { USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3L) }, |
4525 | + { USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_SM250) }, |
4526 | { USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_226) }, |
4527 | { USB_DEVICE(BCM_USB_VENDOR_ID_FOXCONN, BCM_USB_PRODUCT_ID_1901) }, |
4528 | {} |
4529 | diff --git a/drivers/staging/bcm/InterfaceInit.h b/drivers/staging/bcm/InterfaceInit.h |
4530 | index e7a96e5..6c21625 100644 |
4531 | --- a/drivers/staging/bcm/InterfaceInit.h |
4532 | +++ b/drivers/staging/bcm/InterfaceInit.h |
4533 | @@ -8,6 +8,7 @@ |
4534 | #define BCM_USB_PRODUCT_ID_T3 0x0300 |
4535 | #define BCM_USB_PRODUCT_ID_T3B 0x0210 |
4536 | #define BCM_USB_PRODUCT_ID_T3L 0x0220 |
4537 | +#define BCM_USB_PRODUCT_ID_SM250 0xbccd |
4538 | #define BCM_USB_PRODUCT_ID_SYM 0x15E |
4539 | #define BCM_USB_PRODUCT_ID_1901 0xe017 |
4540 | #define BCM_USB_PRODUCT_ID_226 0x0132 |
4541 | diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.c b/drivers/staging/brcm80211/sys/wl_mac80211.c |
4542 | index d060377..cb2041a 100644 |
4543 | --- a/drivers/staging/brcm80211/sys/wl_mac80211.c |
4544 | +++ b/drivers/staging/brcm80211/sys/wl_mac80211.c |
4545 | @@ -299,11 +299,8 @@ static void wl_ops_stop(struct ieee80211_hw *hw) |
4546 | wl_info_t *wl = hw->priv; |
4547 | ASSERT(wl); |
4548 | WL_LOCK(wl); |
4549 | - wl_down(wl); |
4550 | ieee80211_stop_queues(hw); |
4551 | WL_UNLOCK(wl); |
4552 | - |
4553 | - return; |
4554 | } |
4555 | |
4556 | static int |
4557 | @@ -336,7 +333,14 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
4558 | static void |
4559 | wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
4560 | { |
4561 | - return; |
4562 | + struct wl_info *wl; |
4563 | + |
4564 | + wl = HW_TO_WL(hw); |
4565 | + |
4566 | + /* put driver in down state */ |
4567 | + WL_LOCK(wl); |
4568 | + wl_down(wl); |
4569 | + WL_UNLOCK(wl); |
4570 | } |
4571 | |
4572 | static int |
4573 | @@ -972,7 +976,7 @@ static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs, |
4574 | wl_found++; |
4575 | return wl; |
4576 | |
4577 | - fail: |
4578 | +fail: |
4579 | wl_free(wl); |
4580 | fail1: |
4581 | return NULL; |
4582 | @@ -1356,7 +1360,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
4583 | return 0; |
4584 | } |
4585 | |
4586 | -#ifdef LINUXSTA_PS |
4587 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) |
4588 | { |
4589 | wl_info_t *wl; |
4590 | @@ -1371,11 +1374,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state) |
4591 | return -ENODEV; |
4592 | } |
4593 | |
4594 | + /* only need to flag hw is down for proper resume */ |
4595 | WL_LOCK(wl); |
4596 | - wl_down(wl); |
4597 | wl->pub->hw_up = false; |
4598 | WL_UNLOCK(wl); |
4599 | - pci_save_state(pdev, wl->pci_psstate); |
4600 | + |
4601 | + pci_save_state(pdev); |
4602 | pci_disable_device(pdev); |
4603 | return pci_set_power_state(pdev, PCI_D3hot); |
4604 | } |
4605 | @@ -1399,7 +1403,7 @@ static int wl_resume(struct pci_dev *pdev) |
4606 | if (err) |
4607 | return err; |
4608 | |
4609 | - pci_restore_state(pdev, wl->pci_psstate); |
4610 | + pci_restore_state(pdev); |
4611 | |
4612 | err = pci_enable_device(pdev); |
4613 | if (err) |
4614 | @@ -1411,13 +1415,12 @@ static int wl_resume(struct pci_dev *pdev) |
4615 | if ((val & 0x0000ff00) != 0) |
4616 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); |
4617 | |
4618 | - WL_LOCK(wl); |
4619 | - err = wl_up(wl); |
4620 | - WL_UNLOCK(wl); |
4621 | - |
4622 | + /* |
4623 | + * done. driver will be put in up state |
4624 | + * in wl_ops_add_interface() call. |
4625 | + */ |
4626 | return err; |
4627 | } |
4628 | -#endif /* LINUXSTA_PS */ |
4629 | |
4630 | static void wl_remove(struct pci_dev *pdev) |
4631 | { |
4632 | @@ -1450,14 +1453,12 @@ static void wl_remove(struct pci_dev *pdev) |
4633 | } |
4634 | |
4635 | static struct pci_driver wl_pci_driver = { |
4636 | - .name = "brcm80211", |
4637 | - .probe = wl_pci_probe, |
4638 | -#ifdef LINUXSTA_PS |
4639 | - .suspend = wl_suspend, |
4640 | - .resume = wl_resume, |
4641 | -#endif /* LINUXSTA_PS */ |
4642 | - .remove = __devexit_p(wl_remove), |
4643 | - .id_table = wl_id_table, |
4644 | + .name = "brcm80211", |
4645 | + .probe = wl_pci_probe, |
4646 | + .suspend = wl_suspend, |
4647 | + .resume = wl_resume, |
4648 | + .remove = __devexit_p(wl_remove), |
4649 | + .id_table = wl_id_table, |
4650 | }; |
4651 | #endif /* !BCMSDIO */ |
4652 | |
4653 | diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c |
4654 | index 8b383ee..5c6c727 100644 |
4655 | --- a/drivers/staging/comedi/drivers/jr3_pci.c |
4656 | +++ b/drivers/staging/comedi/drivers/jr3_pci.c |
4657 | @@ -54,6 +54,7 @@ Devices: [JR3] PCI force sensor board (jr3_pci) |
4658 | |
4659 | #define PCI_VENDOR_ID_JR3 0x1762 |
4660 | #define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111 |
4661 | +#define PCI_DEVICE_ID_JR3_1_CHANNEL_NEW 0x1111 |
4662 | #define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112 |
4663 | #define PCI_DEVICE_ID_JR3_3_CHANNEL 0x3113 |
4664 | #define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114 |
4665 | @@ -73,6 +74,8 @@ static DEFINE_PCI_DEVICE_TABLE(jr3_pci_pci_table) = { |
4666 | { |
4667 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL, |
4668 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { |
4669 | + PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW, |
4670 | + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { |
4671 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL, |
4672 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { |
4673 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL, |
4674 | @@ -807,6 +810,10 @@ static int jr3_pci_attach(struct comedi_device *dev, |
4675 | devpriv->n_channels = 1; |
4676 | } |
4677 | break; |
4678 | + case PCI_DEVICE_ID_JR3_1_CHANNEL_NEW:{ |
4679 | + devpriv->n_channels = 1; |
4680 | + } |
4681 | + break; |
4682 | case PCI_DEVICE_ID_JR3_2_CHANNEL:{ |
4683 | devpriv->n_channels = 2; |
4684 | } |
4685 | diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c |
4686 | index 4d1868d..0728c3c 100644 |
4687 | --- a/drivers/staging/comedi/drivers/ni_labpc.c |
4688 | +++ b/drivers/staging/comedi/drivers/ni_labpc.c |
4689 | @@ -575,7 +575,8 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, |
4690 | /* grab our IRQ */ |
4691 | if (irq) { |
4692 | isr_flags = 0; |
4693 | - if (thisboard->bustype == pci_bustype) |
4694 | + if (thisboard->bustype == pci_bustype |
4695 | + || thisboard->bustype == pcmcia_bustype) |
4696 | isr_flags |= IRQF_SHARED; |
4697 | if (request_irq(irq, labpc_interrupt, isr_flags, |
4698 | driver_labpc.driver_name, dev)) { |
4699 | diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c |
4700 | index 3f81ca5..b255c8b 100644 |
4701 | --- a/drivers/staging/hv/blkvsc_drv.c |
4702 | +++ b/drivers/staging/hv/blkvsc_drv.c |
4703 | @@ -368,6 +368,7 @@ static int blkvsc_probe(struct device *device) |
4704 | blkdev->gd->first_minor = 0; |
4705 | blkdev->gd->fops = &block_ops; |
4706 | blkdev->gd->private_data = blkdev; |
4707 | + blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device); |
4708 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); |
4709 | |
4710 | blkvsc_do_inquiry(blkdev); |
4711 | diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c |
4712 | index 4c2632c..d7dcc66 100644 |
4713 | --- a/drivers/staging/hv/netvsc.c |
4714 | +++ b/drivers/staging/hv/netvsc.c |
4715 | @@ -1236,7 +1236,7 @@ static void NetVscOnChannelCallback(void *Context) |
4716 | /* ASSERT(device); */ |
4717 | |
4718 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), |
4719 | - GFP_KERNEL); |
4720 | + GFP_ATOMIC); |
4721 | if (!packet) |
4722 | return; |
4723 | buffer = packet; |
4724 | diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c |
4725 | index 1415352..cb79dff 100644 |
4726 | --- a/drivers/staging/hv/netvsc_drv.c |
4727 | +++ b/drivers/staging/hv/netvsc_drv.c |
4728 | @@ -233,6 +233,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj, |
4729 | if (status == 1) { |
4730 | netif_carrier_on(net); |
4731 | netif_wake_queue(net); |
4732 | + netif_notify_peers(net); |
4733 | } else { |
4734 | netif_carrier_off(net); |
4735 | netif_stop_queue(net); |
4736 | @@ -355,7 +356,6 @@ static int netvsc_probe(struct device *device) |
4737 | |
4738 | /* Set initial state */ |
4739 | netif_carrier_off(net); |
4740 | - netif_stop_queue(net); |
4741 | |
4742 | net_device_ctx = netdev_priv(net); |
4743 | net_device_ctx->device_ctx = device_ctx; |
4744 | diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c |
4745 | index deb68c8..b8b54da 100644 |
4746 | --- a/drivers/staging/iio/adc/ad7476_core.c |
4747 | +++ b/drivers/staging/iio/adc/ad7476_core.c |
4748 | @@ -68,7 +68,7 @@ static ssize_t ad7476_show_scale(struct device *dev, |
4749 | /* Corresponds to Vref / 2^(bits) */ |
4750 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
4751 | |
4752 | - return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); |
4753 | + return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
4754 | } |
4755 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0); |
4756 | |
4757 | diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c |
4758 | index 6309d52..89ccf37 100644 |
4759 | --- a/drivers/staging/iio/adc/ad799x_core.c |
4760 | +++ b/drivers/staging/iio/adc/ad799x_core.c |
4761 | @@ -432,7 +432,7 @@ static ssize_t ad799x_show_scale(struct device *dev, |
4762 | /* Corresponds to Vref / 2^(bits) */ |
4763 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
4764 | |
4765 | - return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); |
4766 | + return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
4767 | } |
4768 | |
4769 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0); |
4770 | diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c |
4771 | index c2933c6..cbc59f8 100644 |
4772 | --- a/drivers/staging/rt2860/chips/rt3090.c |
4773 | +++ b/drivers/staging/rt2860/chips/rt3090.c |
4774 | @@ -51,7 +51,8 @@ void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd) |
4775 | if (IS_RT3090(pAd)) { |
4776 | /* Init RF calibration */ |
4777 | /* Driver should toggle RF R30 bit7 before init RF registers */ |
4778 | - u32 RfReg = 0, data; |
4779 | + u8 RfReg; |
4780 | + u32 data; |
4781 | |
4782 | RT30xxReadRFRegister(pAd, RF_R30, (u8 *)&RfReg); |
4783 | RfReg |= 0x80; |
4784 | diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c |
4785 | index 4367a19..88eba51 100644 |
4786 | --- a/drivers/staging/rt2860/chips/rt30xx.c |
4787 | +++ b/drivers/staging/rt2860/chips/rt30xx.c |
4788 | @@ -53,7 +53,7 @@ struct rt_reg_pair RT30xx_RFRegTable[] = { |
4789 | , |
4790 | {RF_R06, 0x02} |
4791 | , |
4792 | - {RF_R07, 0x70} |
4793 | + {RF_R07, 0x60} |
4794 | , |
4795 | {RF_R09, 0x0F} |
4796 | , |
4797 | @@ -441,7 +441,7 @@ void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd) |
4798 | |
4799 | /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 */ |
4800 | RT30xxReadRFRegister(pAd, RF_R07, &RFValue); |
4801 | - RFValue |= 0x30; |
4802 | + RFValue |= 0x20; |
4803 | RT30xxWriteRFRegister(pAd, RF_R07, RFValue); |
4804 | |
4805 | /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 */ |
4806 | diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c |
4807 | index ad60cea..caf8b76 100644 |
4808 | --- a/drivers/staging/rt2860/rt_main_dev.c |
4809 | +++ b/drivers/staging/rt2860/rt_main_dev.c |
4810 | @@ -483,8 +483,6 @@ struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, |
4811 | net_dev->ml_priv = (void *)pAd; |
4812 | pAd->net_dev = net_dev; |
4813 | |
4814 | - netif_stop_queue(net_dev); |
4815 | - |
4816 | return net_dev; |
4817 | |
4818 | } |
4819 | diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c |
4820 | index cd15daa..aca0c46 100644 |
4821 | --- a/drivers/staging/rt2860/usb_main_dev.c |
4822 | +++ b/drivers/staging/rt2860/usb_main_dev.c |
4823 | @@ -106,6 +106,7 @@ struct usb_device_id rtusb_usb_id[] = { |
4824 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ |
4825 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ |
4826 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ |
4827 | + {USB_DEVICE(0x1737, 0x0078)}, /* Linksys WUSB100v2 */ |
4828 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ |
4829 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ |
4830 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ |
4831 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
4832 | index f1f0c63..e2b2cd9 100644 |
4833 | --- a/drivers/staging/rtl8712/usb_intf.c |
4834 | +++ b/drivers/staging/rtl8712/usb_intf.c |
4835 | @@ -47,54 +47,123 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, |
4836 | static void r871xu_dev_remove(struct usb_interface *pusb_intf); |
4837 | |
4838 | static struct usb_device_id rtl871x_usb_id_tbl[] = { |
4839 | - /*92SU |
4840 | - * Realtek */ |
4841 | - {USB_DEVICE(0x0bda, 0x8171)}, |
4842 | - {USB_DEVICE(0x0bda, 0x8172)}, |
4843 | + |
4844 | +/* RTL8188SU */ |
4845 | + /* Realtek */ |
4846 | + {USB_DEVICE(0x0BDA, 0x8171)}, |
4847 | {USB_DEVICE(0x0bda, 0x8173)}, |
4848 | - {USB_DEVICE(0x0bda, 0x8174)}, |
4849 | {USB_DEVICE(0x0bda, 0x8712)}, |
4850 | {USB_DEVICE(0x0bda, 0x8713)}, |
4851 | {USB_DEVICE(0x0bda, 0xC512)}, |
4852 | - /* Abocom */ |
4853 | + /* Abocom */ |
4854 | {USB_DEVICE(0x07B8, 0x8188)}, |
4855 | + /* ASUS */ |
4856 | + {USB_DEVICE(0x0B05, 0x1786)}, |
4857 | + {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ |
4858 | + /* Belkin */ |
4859 | + {USB_DEVICE(0x050D, 0x945A)}, |
4860 | /* Corega */ |
4861 | - {USB_DEVICE(0x07aa, 0x0047)}, |
4862 | - /* Dlink */ |
4863 | - {USB_DEVICE(0x07d1, 0x3303)}, |
4864 | - {USB_DEVICE(0x07d1, 0x3302)}, |
4865 | - {USB_DEVICE(0x07d1, 0x3300)}, |
4866 | - /* Dlink for Skyworth */ |
4867 | - {USB_DEVICE(0x14b2, 0x3300)}, |
4868 | - {USB_DEVICE(0x14b2, 0x3301)}, |
4869 | - {USB_DEVICE(0x14b2, 0x3302)}, |
4870 | + {USB_DEVICE(0x07AA, 0x0047)}, |
4871 | + /* D-Link */ |
4872 | + {USB_DEVICE(0x2001, 0x3306)}, |
4873 | + {USB_DEVICE(0x07D1, 0x3306)}, /* 11n mode disable */ |
4874 | + /* Edimax */ |
4875 | + {USB_DEVICE(0x7392, 0x7611)}, |
4876 | /* EnGenius */ |
4877 | {USB_DEVICE(0x1740, 0x9603)}, |
4878 | - {USB_DEVICE(0x1740, 0x9605)}, |
4879 | + /* Hawking */ |
4880 | + {USB_DEVICE(0x0E66, 0x0016)}, |
4881 | + /* Hercules */ |
4882 | + {USB_DEVICE(0x06F8, 0xE034)}, |
4883 | + {USB_DEVICE(0x06F8, 0xE032)}, |
4884 | + /* Logitec */ |
4885 | + {USB_DEVICE(0x0789, 0x0167)}, |
4886 | + /* PCI */ |
4887 | + {USB_DEVICE(0x2019, 0xAB28)}, |
4888 | + {USB_DEVICE(0x2019, 0xED16)}, |
4889 | + /* Sitecom */ |
4890 | + {USB_DEVICE(0x0DF6, 0x0057)}, |
4891 | + {USB_DEVICE(0x0DF6, 0x0045)}, |
4892 | + {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ |
4893 | + {USB_DEVICE(0x0DF6, 0x004B)}, |
4894 | + {USB_DEVICE(0x0DF6, 0x0063)}, |
4895 | + /* Sweex */ |
4896 | + {USB_DEVICE(0x177F, 0x0154)}, |
4897 | + /* Thinkware */ |
4898 | + {USB_DEVICE(0x0BDA, 0x5077)}, |
4899 | + /* Toshiba */ |
4900 | + {USB_DEVICE(0x1690, 0x0752)}, |
4901 | + /* - */ |
4902 | + {USB_DEVICE(0x20F4, 0x646B)}, |
4903 | + {USB_DEVICE(0x083A, 0xC512)}, |
4904 | + |
4905 | +/* RTL8191SU */ |
4906 | + /* Realtek */ |
4907 | + {USB_DEVICE(0x0BDA, 0x8172)}, |
4908 | + /* Amigo */ |
4909 | + {USB_DEVICE(0x0EB0, 0x9061)}, |
4910 | + /* ASUS/EKB */ |
4911 | + {USB_DEVICE(0x0BDA, 0x8172)}, |
4912 | + {USB_DEVICE(0x13D3, 0x3323)}, |
4913 | + {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */ |
4914 | + {USB_DEVICE(0x13D3, 0x3342)}, |
4915 | + /* ASUS/EKBLenovo */ |
4916 | + {USB_DEVICE(0x13D3, 0x3333)}, |
4917 | + {USB_DEVICE(0x13D3, 0x3334)}, |
4918 | + {USB_DEVICE(0x13D3, 0x3335)}, /* 11n mode disable */ |
4919 | + {USB_DEVICE(0x13D3, 0x3336)}, /* 11n mode disable */ |
4920 | + /* ASUS/Media BOX */ |
4921 | + {USB_DEVICE(0x13D3, 0x3309)}, |
4922 | /* Belkin */ |
4923 | - {USB_DEVICE(0x050d, 0x815F)}, |
4924 | - {USB_DEVICE(0x050d, 0x945A)}, |
4925 | - {USB_DEVICE(0x050d, 0x845A)}, |
4926 | - /* Guillemot */ |
4927 | - {USB_DEVICE(0x06f8, 0xe031)}, |
4928 | + {USB_DEVICE(0x050D, 0x815F)}, |
4929 | + /* D-Link */ |
4930 | + {USB_DEVICE(0x07D1, 0x3302)}, |
4931 | + {USB_DEVICE(0x07D1, 0x3300)}, |
4932 | + {USB_DEVICE(0x07D1, 0x3303)}, |
4933 | /* Edimax */ |
4934 | - {USB_DEVICE(0x7392, 0x7611)}, |
4935 | {USB_DEVICE(0x7392, 0x7612)}, |
4936 | - {USB_DEVICE(0x7392, 0x7622)}, |
4937 | - /* Sitecom */ |
4938 | - {USB_DEVICE(0x0DF6, 0x0045)}, |
4939 | + /* EnGenius */ |
4940 | + {USB_DEVICE(0x1740, 0x9605)}, |
4941 | + /* Guillemot */ |
4942 | + {USB_DEVICE(0x06F8, 0xE031)}, |
4943 | /* Hawking */ |
4944 | {USB_DEVICE(0x0E66, 0x0015)}, |
4945 | - {USB_DEVICE(0x0E66, 0x0016)}, |
4946 | - {USB_DEVICE(0x0b05, 0x1786)}, |
4947 | - {USB_DEVICE(0x0b05, 0x1791)}, /* 11n mode disable */ |
4948 | - |
4949 | + /* Mediao */ |
4950 | {USB_DEVICE(0x13D3, 0x3306)}, |
4951 | - {USB_DEVICE(0x13D3, 0x3309)}, |
4952 | + /* PCI */ |
4953 | + {USB_DEVICE(0x2019, 0xED18)}, |
4954 | + {USB_DEVICE(0x2019, 0x4901)}, |
4955 | + /* Sitecom */ |
4956 | + {USB_DEVICE(0x0DF6, 0x0058)}, |
4957 | + {USB_DEVICE(0x0DF6, 0x0049)}, |
4958 | + {USB_DEVICE(0x0DF6, 0x004C)}, |
4959 | + {USB_DEVICE(0x0DF6, 0x0064)}, |
4960 | + /* Skyworth */ |
4961 | + {USB_DEVICE(0x14b2, 0x3300)}, |
4962 | + {USB_DEVICE(0x14b2, 0x3301)}, |
4963 | + {USB_DEVICE(0x14B2, 0x3302)}, |
4964 | + /* - */ |
4965 | + {USB_DEVICE(0x04F2, 0xAFF2)}, |
4966 | + {USB_DEVICE(0x04F2, 0xAFF5)}, |
4967 | + {USB_DEVICE(0x04F2, 0xAFF6)}, |
4968 | + {USB_DEVICE(0x13D3, 0x3339)}, |
4969 | + {USB_DEVICE(0x13D3, 0x3340)}, /* 11n mode disable */ |
4970 | + {USB_DEVICE(0x13D3, 0x3341)}, /* 11n mode disable */ |
4971 | {USB_DEVICE(0x13D3, 0x3310)}, |
4972 | - {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */ |
4973 | {USB_DEVICE(0x13D3, 0x3325)}, |
4974 | - {USB_DEVICE(0x083A, 0xC512)}, |
4975 | + |
4976 | +/* RTL8192SU */ |
4977 | + /* Realtek */ |
4978 | + {USB_DEVICE(0x0BDA, 0x8174)}, |
4979 | + {USB_DEVICE(0x0BDA, 0x8174)}, |
4980 | + /* Belkin */ |
4981 | + {USB_DEVICE(0x050D, 0x845A)}, |
4982 | + /* Corega */ |
4983 | + {USB_DEVICE(0x07AA, 0x0051)}, |
4984 | + /* Edimax */ |
4985 | + {USB_DEVICE(0x7392, 0x7622)}, |
4986 | + /* NEC */ |
4987 | + {USB_DEVICE(0x0409, 0x02B6)}, |
4988 | {} |
4989 | }; |
4990 | |
4991 | @@ -103,8 +172,20 @@ MODULE_DEVICE_TABLE(usb, rtl871x_usb_id_tbl); |
4992 | static struct specific_device_id specific_device_id_tbl[] = { |
4993 | {.idVendor = 0x0b05, .idProduct = 0x1791, |
4994 | .flags = SPEC_DEV_ID_DISABLE_HT}, |
4995 | + {.idVendor = 0x0df6, .idProduct = 0x0059, |
4996 | + .flags = SPEC_DEV_ID_DISABLE_HT}, |
4997 | + {.idVendor = 0x13d3, .idProduct = 0x3306, |
4998 | + .flags = SPEC_DEV_ID_DISABLE_HT}, |
4999 | {.idVendor = 0x13D3, .idProduct = 0x3311, |
5000 | .flags = SPEC_DEV_ID_DISABLE_HT}, |
5001 | + {.idVendor = 0x13d3, .idProduct = 0x3335, |
5002 | + .flags = SPEC_DEV_ID_DISABLE_HT}, |
5003 | + {.idVendor = 0x13d3, .idProduct = 0x3336, |
5004 | + .flags = SPEC_DEV_ID_DISABLE_HT}, |
5005 | + {.idVendor = 0x13d3, .idProduct = 0x3340, |
5006 | + .flags = SPEC_DEV_ID_DISABLE_HT}, |
5007 | + {.idVendor = 0x13d3, .idProduct = 0x3341, |
5008 | + .flags = SPEC_DEV_ID_DISABLE_HT}, |
5009 | {} |
5010 | }; |
5011 | |
5012 | diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c |
5013 | index cc79f9e..a082f8d 100644 |
5014 | --- a/drivers/staging/speakup/kobjects.c |
5015 | +++ b/drivers/staging/speakup/kobjects.c |
5016 | @@ -332,7 +332,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, |
5017 | unsigned long flags; |
5018 | |
5019 | len = strlen(buf); |
5020 | - if (len > 0 || len < 3) { |
5021 | + if (len > 0 && len < 3) { |
5022 | ch = buf[0]; |
5023 | if (ch == '\n') |
5024 | ch = '0'; |
5025 | diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c |
5026 | index 832608d..08bd26a 100644 |
5027 | --- a/drivers/staging/usbip/vhci_hcd.c |
5028 | +++ b/drivers/staging/usbip/vhci_hcd.c |
5029 | @@ -799,20 +799,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) |
5030 | spin_unlock_irqrestore(&vdev->priv_lock, flags2); |
5031 | } |
5032 | |
5033 | - |
5034 | - if (!vdev->ud.tcp_socket) { |
5035 | - /* tcp connection is closed */ |
5036 | - usbip_uinfo("vhci_hcd: vhci_urb_dequeue() gives back urb %p\n", |
5037 | - urb); |
5038 | - |
5039 | - usb_hcd_unlink_urb_from_ep(hcd, urb); |
5040 | - |
5041 | - spin_unlock_irqrestore(&the_controller->lock, flags); |
5042 | - usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, |
5043 | - urb->status); |
5044 | - spin_lock_irqsave(&the_controller->lock, flags); |
5045 | - } |
5046 | - |
5047 | spin_unlock_irqrestore(&the_controller->lock, flags); |
5048 | |
5049 | usbip_dbg_vhci_hc("leave\n"); |
5050 | diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c |
5051 | index d0e9e02..080e85f 100644 |
5052 | --- a/drivers/staging/zram/zram_drv.c |
5053 | +++ b/drivers/staging/zram/zram_drv.c |
5054 | @@ -227,6 +227,7 @@ static int zram_read(struct zram *zram, struct bio *bio) |
5055 | |
5056 | if (zram_test_flag(zram, index, ZRAM_ZERO)) { |
5057 | handle_zero_page(page); |
5058 | + index++; |
5059 | continue; |
5060 | } |
5061 | |
5062 | @@ -235,12 +236,14 @@ static int zram_read(struct zram *zram, struct bio *bio) |
5063 | pr_debug("Read before write: sector=%lu, size=%u", |
5064 | (ulong)(bio->bi_sector), bio->bi_size); |
5065 | /* Do nothing */ |
5066 | + index++; |
5067 | continue; |
5068 | } |
5069 | |
5070 | /* Page is stored uncompressed since it's incompressible */ |
5071 | if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { |
5072 | handle_uncompressed_page(zram, page, index); |
5073 | + index++; |
5074 | continue; |
5075 | } |
5076 | |
5077 | @@ -320,6 +323,7 @@ static int zram_write(struct zram *zram, struct bio *bio) |
5078 | mutex_unlock(&zram->lock); |
5079 | zram_stat_inc(&zram->stats.pages_zero); |
5080 | zram_set_flag(zram, index, ZRAM_ZERO); |
5081 | + index++; |
5082 | continue; |
5083 | } |
5084 | |
5085 | diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
5086 | index c5f8e5b..dc74295 100644 |
5087 | --- a/drivers/tty/n_gsm.c |
5088 | +++ b/drivers/tty/n_gsm.c |
5089 | @@ -2375,6 +2375,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm, |
5090 | |
5091 | gsm->initiator = c->initiator; |
5092 | gsm->mru = c->mru; |
5093 | + gsm->mtu = c->mtu; |
5094 | gsm->encoding = c->encapsulation; |
5095 | gsm->adaption = c->adaption; |
5096 | gsm->n2 = c->n2; |
5097 | diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c |
5098 | index c556ed9..81f1395 100644 |
5099 | --- a/drivers/tty/sysrq.c |
5100 | +++ b/drivers/tty/sysrq.c |
5101 | @@ -46,7 +46,7 @@ |
5102 | #include <asm/irq_regs.h> |
5103 | |
5104 | /* Whether we react on sysrq keys or just ignore them */ |
5105 | -static int __read_mostly sysrq_enabled = 1; |
5106 | +static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE; |
5107 | static bool __read_mostly sysrq_always_enabled; |
5108 | |
5109 | static bool sysrq_on(void) |
5110 | @@ -571,6 +571,7 @@ struct sysrq_state { |
5111 | unsigned int alt_use; |
5112 | bool active; |
5113 | bool need_reinject; |
5114 | + bool reinjecting; |
5115 | }; |
5116 | |
5117 | static void sysrq_reinject_alt_sysrq(struct work_struct *work) |
5118 | @@ -581,6 +582,10 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work) |
5119 | unsigned int alt_code = sysrq->alt_use; |
5120 | |
5121 | if (sysrq->need_reinject) { |
5122 | + /* we do not want the assignment to be reordered */ |
5123 | + sysrq->reinjecting = true; |
5124 | + mb(); |
5125 | + |
5126 | /* Simulate press and release of Alt + SysRq */ |
5127 | input_inject_event(handle, EV_KEY, alt_code, 1); |
5128 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1); |
5129 | @@ -589,6 +594,9 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work) |
5130 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0); |
5131 | input_inject_event(handle, EV_KEY, alt_code, 0); |
5132 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); |
5133 | + |
5134 | + mb(); |
5135 | + sysrq->reinjecting = false; |
5136 | } |
5137 | } |
5138 | |
5139 | @@ -599,6 +607,13 @@ static bool sysrq_filter(struct input_handle *handle, |
5140 | bool was_active = sysrq->active; |
5141 | bool suppress; |
5142 | |
5143 | + /* |
5144 | + * Do not filter anything if we are in the process of re-injecting |
5145 | + * Alt+SysRq combination. |
5146 | + */ |
5147 | + if (sysrq->reinjecting) |
5148 | + return false; |
5149 | + |
5150 | switch (type) { |
5151 | |
5152 | case EV_SYN: |
5153 | @@ -629,7 +644,7 @@ static bool sysrq_filter(struct input_handle *handle, |
5154 | sysrq->alt_use = sysrq->alt; |
5155 | /* |
5156 | * If nothing else will be pressed we'll need |
5157 | - * to * re-inject Alt-SysRq keysroke. |
5158 | + * to re-inject Alt-SysRq keysroke. |
5159 | */ |
5160 | sysrq->need_reinject = true; |
5161 | } |
5162 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
5163 | index d6ede98..4ab49d4 100644 |
5164 | --- a/drivers/usb/class/cdc-acm.c |
5165 | +++ b/drivers/usb/class/cdc-acm.c |
5166 | @@ -1607,6 +1607,7 @@ static const struct usb_device_id acm_ids[] = { |
5167 | { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ |
5168 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ |
5169 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ |
5170 | + { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */ |
5171 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ |
5172 | |
5173 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
5174 | diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c |
5175 | index 3799573..4de52dc 100644 |
5176 | --- a/drivers/usb/core/hcd-pci.c |
5177 | +++ b/drivers/usb/core/hcd-pci.c |
5178 | @@ -406,7 +406,12 @@ static int suspend_common(struct device *dev, bool do_wakeup) |
5179 | return retval; |
5180 | } |
5181 | |
5182 | - synchronize_irq(pci_dev->irq); |
5183 | + /* If MSI-X is enabled, the driver will have synchronized all vectors |
5184 | + * in pci_suspend(). If MSI or legacy PCI is enabled, that will be |
5185 | + * synchronized here. |
5186 | + */ |
5187 | + if (!hcd->msix_enabled) |
5188 | + synchronize_irq(pci_dev->irq); |
5189 | |
5190 | /* Downstream ports from this root hub should already be quiesced, so |
5191 | * there will be no DMA activity. Now we can shut down the upstream |
5192 | diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
5193 | index ced846a..8aa6b51 100644 |
5194 | --- a/drivers/usb/core/hcd.c |
5195 | +++ b/drivers/usb/core/hcd.c |
5196 | @@ -1956,7 +1956,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) |
5197 | |
5198 | dev_dbg(&rhdev->dev, "usb %s%s\n", |
5199 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); |
5200 | - clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); |
5201 | if (!hcd->driver->bus_resume) |
5202 | return -ENOENT; |
5203 | if (hcd->state == HC_STATE_RUNNING) |
5204 | @@ -1964,6 +1963,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) |
5205 | |
5206 | hcd->state = HC_STATE_RESUMING; |
5207 | status = hcd->driver->bus_resume(hcd); |
5208 | + clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); |
5209 | if (status == 0) { |
5210 | /* TRSMRCY = 10 msec */ |
5211 | msleep(10); |
5212 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
5213 | index 27115b4..31edd87 100644 |
5214 | --- a/drivers/usb/core/hub.c |
5215 | +++ b/drivers/usb/core/hub.c |
5216 | @@ -677,6 +677,8 @@ static void hub_init_func3(struct work_struct *ws); |
5217 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
5218 | { |
5219 | struct usb_device *hdev = hub->hdev; |
5220 | + struct usb_hcd *hcd; |
5221 | + int ret; |
5222 | int port1; |
5223 | int status; |
5224 | bool need_debounce_delay = false; |
5225 | @@ -715,6 +717,25 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
5226 | usb_autopm_get_interface_no_resume( |
5227 | to_usb_interface(hub->intfdev)); |
5228 | return; /* Continues at init2: below */ |
5229 | + } else if (type == HUB_RESET_RESUME) { |
5230 | + /* The internal host controller state for the hub device |
5231 | + * may be gone after a host power loss on system resume. |
5232 | + * Update the device's info so the HW knows it's a hub. |
5233 | + */ |
5234 | + hcd = bus_to_hcd(hdev->bus); |
5235 | + if (hcd->driver->update_hub_device) { |
5236 | + ret = hcd->driver->update_hub_device(hcd, hdev, |
5237 | + &hub->tt, GFP_NOIO); |
5238 | + if (ret < 0) { |
5239 | + dev_err(hub->intfdev, "Host not " |
5240 | + "accepting hub info " |
5241 | + "update.\n"); |
5242 | + dev_err(hub->intfdev, "LS/FS devices " |
5243 | + "and hubs may not work " |
5244 | + "under this hub\n."); |
5245 | + } |
5246 | + } |
5247 | + hub_power_on(hub, true); |
5248 | } else { |
5249 | hub_power_on(hub, true); |
5250 | } |
5251 | @@ -2723,6 +2744,11 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, |
5252 | udev->ttport = hdev->ttport; |
5253 | } else if (udev->speed != USB_SPEED_HIGH |
5254 | && hdev->speed == USB_SPEED_HIGH) { |
5255 | + if (!hub->tt.hub) { |
5256 | + dev_err(&udev->dev, "parent hub has no TT\n"); |
5257 | + retval = -EINVAL; |
5258 | + goto fail; |
5259 | + } |
5260 | udev->tt = &hub->tt; |
5261 | udev->ttport = port1; |
5262 | } |
5263 | diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c |
5264 | index 2fc8636..12ff6cf 100644 |
5265 | --- a/drivers/usb/gadget/printer.c |
5266 | +++ b/drivers/usb/gadget/printer.c |
5267 | @@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget; |
5268 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). |
5269 | */ |
5270 | |
5271 | -static ushort __initdata idVendor; |
5272 | +static ushort idVendor; |
5273 | module_param(idVendor, ushort, S_IRUGO); |
5274 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); |
5275 | |
5276 | -static ushort __initdata idProduct; |
5277 | +static ushort idProduct; |
5278 | module_param(idProduct, ushort, S_IRUGO); |
5279 | MODULE_PARM_DESC(idProduct, "USB Product ID"); |
5280 | |
5281 | -static ushort __initdata bcdDevice; |
5282 | +static ushort bcdDevice; |
5283 | module_param(bcdDevice, ushort, S_IRUGO); |
5284 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); |
5285 | |
5286 | -static char *__initdata iManufacturer; |
5287 | +static char *iManufacturer; |
5288 | module_param(iManufacturer, charp, S_IRUGO); |
5289 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); |
5290 | |
5291 | -static char *__initdata iProduct; |
5292 | +static char *iProduct; |
5293 | module_param(iProduct, charp, S_IRUGO); |
5294 | MODULE_PARM_DESC(iProduct, "USB Product string"); |
5295 | |
5296 | -static char *__initdata iSerialNum; |
5297 | +static char *iSerialNum; |
5298 | module_param(iSerialNum, charp, S_IRUGO); |
5299 | MODULE_PARM_DESC(iSerialNum, "1"); |
5300 | |
5301 | -static char *__initdata iPNPstring; |
5302 | +static char *iPNPstring; |
5303 | module_param(iPNPstring, charp, S_IRUGO); |
5304 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); |
5305 | |
5306 | @@ -1596,13 +1596,12 @@ cleanup(void) |
5307 | int status; |
5308 | |
5309 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
5310 | - class_destroy(usb_gadget_class); |
5311 | - unregister_chrdev_region(g_printer_devno, 2); |
5312 | - |
5313 | status = usb_gadget_unregister_driver(&printer_driver); |
5314 | if (status) |
5315 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
5316 | |
5317 | + unregister_chrdev_region(g_printer_devno, 2); |
5318 | + class_destroy(usb_gadget_class); |
5319 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
5320 | } |
5321 | module_exit(cleanup); |
5322 | diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c |
5323 | index 2baf8a8..a869e3c 100644 |
5324 | --- a/drivers/usb/host/ehci-au1xxx.c |
5325 | +++ b/drivers/usb/host/ehci-au1xxx.c |
5326 | @@ -227,8 +227,8 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev) |
5327 | * mark HW unaccessible. The PM and USB cores make sure that |
5328 | * the root hub is either suspended or stopped. |
5329 | */ |
5330 | - spin_lock_irqsave(&ehci->lock, flags); |
5331 | ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); |
5332 | + spin_lock_irqsave(&ehci->lock, flags); |
5333 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
5334 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); |
5335 | |
5336 | diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c |
5337 | index e906280..6716312 100644 |
5338 | --- a/drivers/usb/host/ehci-hcd.c |
5339 | +++ b/drivers/usb/host/ehci-hcd.c |
5340 | @@ -114,6 +114,9 @@ MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us\n"); |
5341 | |
5342 | #define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT) |
5343 | |
5344 | +/* for ASPM quirk of ISOC on AMD SB800 */ |
5345 | +static struct pci_dev *amd_nb_dev; |
5346 | + |
5347 | /*-------------------------------------------------------------------------*/ |
5348 | |
5349 | #include "ehci.h" |
5350 | @@ -529,6 +532,11 @@ static void ehci_stop (struct usb_hcd *hcd) |
5351 | spin_unlock_irq (&ehci->lock); |
5352 | ehci_mem_cleanup (ehci); |
5353 | |
5354 | + if (amd_nb_dev) { |
5355 | + pci_dev_put(amd_nb_dev); |
5356 | + amd_nb_dev = NULL; |
5357 | + } |
5358 | + |
5359 | #ifdef EHCI_STATS |
5360 | ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n", |
5361 | ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim, |
5362 | @@ -564,6 +572,8 @@ static int ehci_init(struct usb_hcd *hcd) |
5363 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; |
5364 | ehci->iaa_watchdog.data = (unsigned long) ehci; |
5365 | |
5366 | + hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); |
5367 | + |
5368 | /* |
5369 | * hw default: 1K periodic list heads, one per frame. |
5370 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
5371 | @@ -571,11 +581,20 @@ static int ehci_init(struct usb_hcd *hcd) |
5372 | ehci->periodic_size = DEFAULT_I_TDPS; |
5373 | INIT_LIST_HEAD(&ehci->cached_itd_list); |
5374 | INIT_LIST_HEAD(&ehci->cached_sitd_list); |
5375 | + |
5376 | + if (HCC_PGM_FRAMELISTLEN(hcc_params)) { |
5377 | + /* periodic schedule size can be smaller than default */ |
5378 | + switch (EHCI_TUNE_FLS) { |
5379 | + case 0: ehci->periodic_size = 1024; break; |
5380 | + case 1: ehci->periodic_size = 512; break; |
5381 | + case 2: ehci->periodic_size = 256; break; |
5382 | + default: BUG(); |
5383 | + } |
5384 | + } |
5385 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
5386 | return retval; |
5387 | |
5388 | /* controllers may cache some of the periodic schedule ... */ |
5389 | - hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); |
5390 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
5391 | ehci->i_thresh = 2 + 8; |
5392 | else // N microframes cached |
5393 | @@ -629,12 +648,6 @@ static int ehci_init(struct usb_hcd *hcd) |
5394 | /* periodic schedule size can be smaller than default */ |
5395 | temp &= ~(3 << 2); |
5396 | temp |= (EHCI_TUNE_FLS << 2); |
5397 | - switch (EHCI_TUNE_FLS) { |
5398 | - case 0: ehci->periodic_size = 1024; break; |
5399 | - case 1: ehci->periodic_size = 512; break; |
5400 | - case 2: ehci->periodic_size = 256; break; |
5401 | - default: BUG(); |
5402 | - } |
5403 | } |
5404 | if (HCC_LPM(hcc_params)) { |
5405 | /* support link power management EHCI 1.1 addendum */ |
5406 | diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c |
5407 | index 796ea0c..8a515f0 100644 |
5408 | --- a/drivers/usb/host/ehci-hub.c |
5409 | +++ b/drivers/usb/host/ehci-hub.c |
5410 | @@ -111,6 +111,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, |
5411 | { |
5412 | int port; |
5413 | u32 temp; |
5414 | + unsigned long flags; |
5415 | |
5416 | /* If remote wakeup is enabled for the root hub but disabled |
5417 | * for the controller, we must adjust all the port wakeup flags |
5418 | @@ -120,6 +121,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, |
5419 | if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) |
5420 | return; |
5421 | |
5422 | + spin_lock_irqsave(&ehci->lock, flags); |
5423 | + |
5424 | /* clear phy low-power mode before changing wakeup flags */ |
5425 | if (ehci->has_hostpc) { |
5426 | port = HCS_N_PORTS(ehci->hcs_params); |
5427 | @@ -131,7 +134,9 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, |
5428 | temp = ehci_readl(ehci, hostpc_reg); |
5429 | ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); |
5430 | } |
5431 | + spin_unlock_irqrestore(&ehci->lock, flags); |
5432 | msleep(5); |
5433 | + spin_lock_irqsave(&ehci->lock, flags); |
5434 | } |
5435 | |
5436 | port = HCS_N_PORTS(ehci->hcs_params); |
5437 | @@ -170,6 +175,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, |
5438 | /* Does the root hub have a port wakeup pending? */ |
5439 | if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) |
5440 | usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); |
5441 | + |
5442 | + spin_unlock_irqrestore(&ehci->lock, flags); |
5443 | } |
5444 | |
5445 | static int ehci_bus_suspend (struct usb_hcd *hcd) |
5446 | diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c |
5447 | index 655f3c9..331ab20 100644 |
5448 | --- a/drivers/usb/host/ehci-pci.c |
5449 | +++ b/drivers/usb/host/ehci-pci.c |
5450 | @@ -41,6 +41,42 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) |
5451 | return 0; |
5452 | } |
5453 | |
5454 | +static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci) |
5455 | +{ |
5456 | + struct pci_dev *amd_smbus_dev; |
5457 | + u8 rev = 0; |
5458 | + |
5459 | + amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); |
5460 | + if (amd_smbus_dev) { |
5461 | + pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
5462 | + if (rev < 0x40) { |
5463 | + pci_dev_put(amd_smbus_dev); |
5464 | + amd_smbus_dev = NULL; |
5465 | + return 0; |
5466 | + } |
5467 | + } else { |
5468 | + amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL); |
5469 | + if (!amd_smbus_dev) |
5470 | + return 0; |
5471 | + pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
5472 | + if (rev < 0x11 || rev > 0x18) { |
5473 | + pci_dev_put(amd_smbus_dev); |
5474 | + amd_smbus_dev = NULL; |
5475 | + return 0; |
5476 | + } |
5477 | + } |
5478 | + |
5479 | + if (!amd_nb_dev) |
5480 | + amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); |
5481 | + |
5482 | + ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n"); |
5483 | + |
5484 | + pci_dev_put(amd_smbus_dev); |
5485 | + amd_smbus_dev = NULL; |
5486 | + |
5487 | + return 1; |
5488 | +} |
5489 | + |
5490 | /* called during probe() after chip reset completes */ |
5491 | static int ehci_pci_setup(struct usb_hcd *hcd) |
5492 | { |
5493 | @@ -99,6 +135,9 @@ static int ehci_pci_setup(struct usb_hcd *hcd) |
5494 | /* cache this readonly data; minimize chip reads */ |
5495 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
5496 | |
5497 | + if (ehci_quirk_amd_hudson(ehci)) |
5498 | + ehci->amd_l1_fix = 1; |
5499 | + |
5500 | retval = ehci_halt(ehci); |
5501 | if (retval) |
5502 | return retval; |
5503 | @@ -321,8 +360,8 @@ static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) |
5504 | * mark HW unaccessible. The PM and USB cores make sure that |
5505 | * the root hub is either suspended or stopped. |
5506 | */ |
5507 | - spin_lock_irqsave (&ehci->lock, flags); |
5508 | ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup); |
5509 | + spin_lock_irqsave (&ehci->lock, flags); |
5510 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
5511 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); |
5512 | |
5513 | diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c |
5514 | index d9f78eb..aa46f57 100644 |
5515 | --- a/drivers/usb/host/ehci-sched.c |
5516 | +++ b/drivers/usb/host/ehci-sched.c |
5517 | @@ -1590,6 +1590,63 @@ itd_link (struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd) |
5518 | *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); |
5519 | } |
5520 | |
5521 | +#define AB_REG_BAR_LOW 0xe0 |
5522 | +#define AB_REG_BAR_HIGH 0xe1 |
5523 | +#define AB_INDX(addr) ((addr) + 0x00) |
5524 | +#define AB_DATA(addr) ((addr) + 0x04) |
5525 | +#define NB_PCIE_INDX_ADDR 0xe0 |
5526 | +#define NB_PCIE_INDX_DATA 0xe4 |
5527 | +#define NB_PIF0_PWRDOWN_0 0x01100012 |
5528 | +#define NB_PIF0_PWRDOWN_1 0x01100013 |
5529 | + |
5530 | +static void ehci_quirk_amd_L1(struct ehci_hcd *ehci, int disable) |
5531 | +{ |
5532 | + u32 addr, addr_low, addr_high, val; |
5533 | + |
5534 | + outb_p(AB_REG_BAR_LOW, 0xcd6); |
5535 | + addr_low = inb_p(0xcd7); |
5536 | + outb_p(AB_REG_BAR_HIGH, 0xcd6); |
5537 | + addr_high = inb_p(0xcd7); |
5538 | + addr = addr_high << 8 | addr_low; |
5539 | + outl_p(0x30, AB_INDX(addr)); |
5540 | + outl_p(0x40, AB_DATA(addr)); |
5541 | + outl_p(0x34, AB_INDX(addr)); |
5542 | + val = inl_p(AB_DATA(addr)); |
5543 | + |
5544 | + if (disable) { |
5545 | + val &= ~0x8; |
5546 | + val |= (1 << 4) | (1 << 9); |
5547 | + } else { |
5548 | + val |= 0x8; |
5549 | + val &= ~((1 << 4) | (1 << 9)); |
5550 | + } |
5551 | + outl_p(val, AB_DATA(addr)); |
5552 | + |
5553 | + if (amd_nb_dev) { |
5554 | + addr = NB_PIF0_PWRDOWN_0; |
5555 | + pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr); |
5556 | + pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val); |
5557 | + if (disable) |
5558 | + val &= ~(0x3f << 7); |
5559 | + else |
5560 | + val |= 0x3f << 7; |
5561 | + |
5562 | + pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val); |
5563 | + |
5564 | + addr = NB_PIF0_PWRDOWN_1; |
5565 | + pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr); |
5566 | + pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val); |
5567 | + if (disable) |
5568 | + val &= ~(0x3f << 7); |
5569 | + else |
5570 | + val |= 0x3f << 7; |
5571 | + |
5572 | + pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val); |
5573 | + } |
5574 | + |
5575 | + return; |
5576 | +} |
5577 | + |
5578 | /* fit urb's itds into the selected schedule slot; activate as needed */ |
5579 | static int |
5580 | itd_link_urb ( |
5581 | @@ -1616,6 +1673,12 @@ itd_link_urb ( |
5582 | urb->interval, |
5583 | next_uframe >> 3, next_uframe & 0x7); |
5584 | } |
5585 | + |
5586 | + if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { |
5587 | + if (ehci->amd_l1_fix == 1) |
5588 | + ehci_quirk_amd_L1(ehci, 1); |
5589 | + } |
5590 | + |
5591 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; |
5592 | |
5593 | /* fill iTDs uframe by uframe */ |
5594 | @@ -1740,6 +1803,11 @@ itd_complete ( |
5595 | (void) disable_periodic(ehci); |
5596 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; |
5597 | |
5598 | + if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { |
5599 | + if (ehci->amd_l1_fix == 1) |
5600 | + ehci_quirk_amd_L1(ehci, 0); |
5601 | + } |
5602 | + |
5603 | if (unlikely(list_is_singular(&stream->td_list))) { |
5604 | ehci_to_hcd(ehci)->self.bandwidth_allocated |
5605 | -= stream->bandwidth; |
5606 | @@ -2025,6 +2093,12 @@ sitd_link_urb ( |
5607 | (next_uframe >> 3) & (ehci->periodic_size - 1), |
5608 | stream->interval, hc32_to_cpu(ehci, stream->splits)); |
5609 | } |
5610 | + |
5611 | + if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { |
5612 | + if (ehci->amd_l1_fix == 1) |
5613 | + ehci_quirk_amd_L1(ehci, 1); |
5614 | + } |
5615 | + |
5616 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; |
5617 | |
5618 | /* fill sITDs frame by frame */ |
5619 | @@ -2125,6 +2199,11 @@ sitd_complete ( |
5620 | (void) disable_periodic(ehci); |
5621 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; |
5622 | |
5623 | + if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { |
5624 | + if (ehci->amd_l1_fix == 1) |
5625 | + ehci_quirk_amd_L1(ehci, 0); |
5626 | + } |
5627 | + |
5628 | if (list_is_singular(&stream->td_list)) { |
5629 | ehci_to_hcd(ehci)->self.bandwidth_allocated |
5630 | -= stream->bandwidth; |
5631 | diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h |
5632 | index ba8eab3..799ac16 100644 |
5633 | --- a/drivers/usb/host/ehci.h |
5634 | +++ b/drivers/usb/host/ehci.h |
5635 | @@ -131,6 +131,7 @@ struct ehci_hcd { /* one per controller */ |
5636 | unsigned has_amcc_usb23:1; |
5637 | unsigned need_io_watchdog:1; |
5638 | unsigned broken_periodic:1; |
5639 | + unsigned amd_l1_fix:1; |
5640 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ |
5641 | unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ |
5642 | |
5643 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
5644 | index df558f6..62c70c2 100644 |
5645 | --- a/drivers/usb/host/xhci-ring.c |
5646 | +++ b/drivers/usb/host/xhci-ring.c |
5647 | @@ -1188,7 +1188,7 @@ static void handle_port_status(struct xhci_hcd *xhci, |
5648 | |
5649 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); |
5650 | temp = xhci_readl(xhci, addr); |
5651 | - if ((temp & PORT_CONNECT) && (hcd->state == HC_STATE_SUSPENDED)) { |
5652 | + if (hcd->state == HC_STATE_SUSPENDED) { |
5653 | xhci_dbg(xhci, "resume root hub\n"); |
5654 | usb_hcd_resume_root_hub(hcd); |
5655 | } |
5656 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
5657 | index 45e4a31..34cf4e1 100644 |
5658 | --- a/drivers/usb/host/xhci.c |
5659 | +++ b/drivers/usb/host/xhci.c |
5660 | @@ -226,7 +226,8 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) |
5661 | static int xhci_setup_msix(struct xhci_hcd *xhci) |
5662 | { |
5663 | int i, ret = 0; |
5664 | - struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); |
5665 | + struct usb_hcd *hcd = xhci_to_hcd(xhci); |
5666 | + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
5667 | |
5668 | /* |
5669 | * calculate number of msi-x vectors supported. |
5670 | @@ -265,6 +266,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) |
5671 | goto disable_msix; |
5672 | } |
5673 | |
5674 | + hcd->msix_enabled = 1; |
5675 | return ret; |
5676 | |
5677 | disable_msix: |
5678 | @@ -280,7 +282,8 @@ free_entries: |
5679 | /* Free any IRQs and disable MSI-X */ |
5680 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) |
5681 | { |
5682 | - struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); |
5683 | + struct usb_hcd *hcd = xhci_to_hcd(xhci); |
5684 | + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
5685 | |
5686 | xhci_free_irq(xhci); |
5687 | |
5688 | @@ -292,6 +295,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) |
5689 | pci_disable_msi(pdev); |
5690 | } |
5691 | |
5692 | + hcd->msix_enabled = 0; |
5693 | return; |
5694 | } |
5695 | |
5696 | @@ -508,9 +512,10 @@ void xhci_stop(struct usb_hcd *hcd) |
5697 | spin_lock_irq(&xhci->lock); |
5698 | xhci_halt(xhci); |
5699 | xhci_reset(xhci); |
5700 | - xhci_cleanup_msix(xhci); |
5701 | spin_unlock_irq(&xhci->lock); |
5702 | |
5703 | + xhci_cleanup_msix(xhci); |
5704 | + |
5705 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
5706 | /* Tell the event ring poll function not to reschedule */ |
5707 | xhci->zombie = 1; |
5708 | @@ -544,9 +549,10 @@ void xhci_shutdown(struct usb_hcd *hcd) |
5709 | |
5710 | spin_lock_irq(&xhci->lock); |
5711 | xhci_halt(xhci); |
5712 | - xhci_cleanup_msix(xhci); |
5713 | spin_unlock_irq(&xhci->lock); |
5714 | |
5715 | + xhci_cleanup_msix(xhci); |
5716 | + |
5717 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", |
5718 | xhci_readl(xhci, &xhci->op_regs->status)); |
5719 | } |
5720 | @@ -647,6 +653,7 @@ int xhci_suspend(struct xhci_hcd *xhci) |
5721 | int rc = 0; |
5722 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
5723 | u32 command; |
5724 | + int i; |
5725 | |
5726 | spin_lock_irq(&xhci->lock); |
5727 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
5728 | @@ -677,10 +684,15 @@ int xhci_suspend(struct xhci_hcd *xhci) |
5729 | spin_unlock_irq(&xhci->lock); |
5730 | return -ETIMEDOUT; |
5731 | } |
5732 | - /* step 5: remove core well power */ |
5733 | - xhci_cleanup_msix(xhci); |
5734 | spin_unlock_irq(&xhci->lock); |
5735 | |
5736 | + /* step 5: remove core well power */ |
5737 | + /* synchronize irq when using MSI-X */ |
5738 | + if (xhci->msix_entries) { |
5739 | + for (i = 0; i < xhci->msix_count; i++) |
5740 | + synchronize_irq(xhci->msix_entries[i].vector); |
5741 | + } |
5742 | + |
5743 | return rc; |
5744 | } |
5745 | |
5746 | @@ -694,7 +706,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
5747 | { |
5748 | u32 command, temp = 0; |
5749 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
5750 | - struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
5751 | int old_state, retval; |
5752 | |
5753 | old_state = hcd->state; |
5754 | @@ -729,9 +740,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
5755 | xhci_dbg(xhci, "Stop HCD\n"); |
5756 | xhci_halt(xhci); |
5757 | xhci_reset(xhci); |
5758 | - if (hibernated) |
5759 | - xhci_cleanup_msix(xhci); |
5760 | spin_unlock_irq(&xhci->lock); |
5761 | + xhci_cleanup_msix(xhci); |
5762 | |
5763 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
5764 | /* Tell the event ring poll function not to reschedule */ |
5765 | @@ -765,30 +775,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
5766 | return retval; |
5767 | } |
5768 | |
5769 | - spin_unlock_irq(&xhci->lock); |
5770 | - /* Re-setup MSI-X */ |
5771 | - if (hcd->irq) |
5772 | - free_irq(hcd->irq, hcd); |
5773 | - hcd->irq = -1; |
5774 | - |
5775 | - retval = xhci_setup_msix(xhci); |
5776 | - if (retval) |
5777 | - /* fall back to msi*/ |
5778 | - retval = xhci_setup_msi(xhci); |
5779 | - |
5780 | - if (retval) { |
5781 | - /* fall back to legacy interrupt*/ |
5782 | - retval = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
5783 | - hcd->irq_descr, hcd); |
5784 | - if (retval) { |
5785 | - xhci_err(xhci, "request interrupt %d failed\n", |
5786 | - pdev->irq); |
5787 | - return retval; |
5788 | - } |
5789 | - hcd->irq = pdev->irq; |
5790 | - } |
5791 | - |
5792 | - spin_lock_irq(&xhci->lock); |
5793 | /* step 4: set Run/Stop bit */ |
5794 | command = xhci_readl(xhci, &xhci->op_regs->command); |
5795 | command |= CMD_RUN; |
5796 | @@ -2445,8 +2431,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) |
5797 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
5798 | return 0; |
5799 | } |
5800 | - /* xhci_alloc_virt_device() does not touch rings; no need to lock */ |
5801 | - if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { |
5802 | + /* xhci_alloc_virt_device() does not touch rings; no need to lock. |
5803 | + * Use GFP_NOIO, since this function can be called from |
5804 | + * xhci_discover_or_reset_device(), which may be called as part of |
5805 | + * mass storage driver error handling. |
5806 | + */ |
5807 | + if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { |
5808 | /* Disable slot, if we can do it without mem alloc */ |
5809 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
5810 | spin_lock_irqsave(&xhci->lock, flags); |
5811 | diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c |
5812 | index 63f7cc4..7b8815d 100644 |
5813 | --- a/drivers/usb/serial/ch341.c |
5814 | +++ b/drivers/usb/serial/ch341.c |
5815 | @@ -486,12 +486,22 @@ static void ch341_read_int_callback(struct urb *urb) |
5816 | if (actual_length >= 4) { |
5817 | struct ch341_private *priv = usb_get_serial_port_data(port); |
5818 | unsigned long flags; |
5819 | + u8 prev_line_status = priv->line_status; |
5820 | |
5821 | spin_lock_irqsave(&priv->lock, flags); |
5822 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; |
5823 | if ((data[1] & CH341_MULT_STAT)) |
5824 | priv->multi_status_change = 1; |
5825 | spin_unlock_irqrestore(&priv->lock, flags); |
5826 | + |
5827 | + if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) { |
5828 | + struct tty_struct *tty = tty_port_tty_get(&port->port); |
5829 | + if (tty) |
5830 | + usb_serial_handle_dcd_change(port, tty, |
5831 | + priv->line_status & CH341_BIT_DCD); |
5832 | + tty_kref_put(tty); |
5833 | + } |
5834 | + |
5835 | wake_up_interruptible(&priv->delta_msr_wait); |
5836 | } |
5837 | |
5838 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
5839 | index 8d7731d..735ea03 100644 |
5840 | --- a/drivers/usb/serial/cp210x.c |
5841 | +++ b/drivers/usb/serial/cp210x.c |
5842 | @@ -49,7 +49,6 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, |
5843 | static void cp210x_break_ctl(struct tty_struct *, int); |
5844 | static int cp210x_startup(struct usb_serial *); |
5845 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); |
5846 | -static int cp210x_carrier_raised(struct usb_serial_port *p); |
5847 | |
5848 | static int debug; |
5849 | |
5850 | @@ -87,7 +86,6 @@ static const struct usb_device_id id_table[] = { |
5851 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ |
5852 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
5853 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
5854 | - { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ |
5855 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
5856 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
5857 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
5858 | @@ -110,7 +108,9 @@ static const struct usb_device_id id_table[] = { |
5859 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
5860 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
5861 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ |
5862 | + { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ |
5863 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
5864 | + { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ |
5865 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
5866 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
5867 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
5868 | @@ -165,8 +165,7 @@ static struct usb_serial_driver cp210x_device = { |
5869 | .tiocmget = cp210x_tiocmget, |
5870 | .tiocmset = cp210x_tiocmset, |
5871 | .attach = cp210x_startup, |
5872 | - .dtr_rts = cp210x_dtr_rts, |
5873 | - .carrier_raised = cp210x_carrier_raised |
5874 | + .dtr_rts = cp210x_dtr_rts |
5875 | }; |
5876 | |
5877 | /* Config request types */ |
5878 | @@ -765,15 +764,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) |
5879 | return result; |
5880 | } |
5881 | |
5882 | -static int cp210x_carrier_raised(struct usb_serial_port *p) |
5883 | -{ |
5884 | - unsigned int control; |
5885 | - cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); |
5886 | - if (control & CONTROL_DCD) |
5887 | - return 1; |
5888 | - return 0; |
5889 | -} |
5890 | - |
5891 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
5892 | { |
5893 | struct usb_serial_port *port = tty->driver_data; |
5894 | diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c |
5895 | index b92070c..666e5a6 100644 |
5896 | --- a/drivers/usb/serial/digi_acceleport.c |
5897 | +++ b/drivers/usb/serial/digi_acceleport.c |
5898 | @@ -455,7 +455,6 @@ static int digi_write_room(struct tty_struct *tty); |
5899 | static int digi_chars_in_buffer(struct tty_struct *tty); |
5900 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); |
5901 | static void digi_close(struct usb_serial_port *port); |
5902 | -static int digi_carrier_raised(struct usb_serial_port *port); |
5903 | static void digi_dtr_rts(struct usb_serial_port *port, int on); |
5904 | static int digi_startup_device(struct usb_serial *serial); |
5905 | static int digi_startup(struct usb_serial *serial); |
5906 | @@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { |
5907 | .open = digi_open, |
5908 | .close = digi_close, |
5909 | .dtr_rts = digi_dtr_rts, |
5910 | - .carrier_raised = digi_carrier_raised, |
5911 | .write = digi_write, |
5912 | .write_room = digi_write_room, |
5913 | .write_bulk_callback = digi_write_bulk_callback, |
5914 | @@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on) |
5915 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); |
5916 | } |
5917 | |
5918 | -static int digi_carrier_raised(struct usb_serial_port *port) |
5919 | -{ |
5920 | - struct digi_port *priv = usb_get_serial_port_data(port); |
5921 | - if (priv->dp_modem_signals & TIOCM_CD) |
5922 | - return 1; |
5923 | - return 0; |
5924 | -} |
5925 | - |
5926 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) |
5927 | { |
5928 | int ret; |
5929 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
5930 | index 2dec500..48ce01e 100644 |
5931 | --- a/drivers/usb/serial/ftdi_sio.c |
5932 | +++ b/drivers/usb/serial/ftdi_sio.c |
5933 | @@ -99,6 +99,7 @@ struct ftdi_sio_quirk { |
5934 | static int ftdi_jtag_probe(struct usb_serial *serial); |
5935 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); |
5936 | static int ftdi_NDI_device_setup(struct usb_serial *serial); |
5937 | +static int ftdi_stmclite_probe(struct usb_serial *serial); |
5938 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); |
5939 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); |
5940 | |
5941 | @@ -122,6 +123,10 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { |
5942 | .port_probe = ftdi_HE_TIRA1_setup, |
5943 | }; |
5944 | |
5945 | +static struct ftdi_sio_quirk ftdi_stmclite_quirk = { |
5946 | + .probe = ftdi_stmclite_probe, |
5947 | +}; |
5948 | + |
5949 | /* |
5950 | * The 8U232AM has the same API as the sio except for: |
5951 | * - it can support MUCH higher baudrates; up to: |
5952 | @@ -615,6 +620,7 @@ static struct usb_device_id id_table_combined [] = { |
5953 | { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, |
5954 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, |
5955 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
5956 | + { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, |
5957 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, |
5958 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
5959 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, |
5960 | @@ -675,7 +681,17 @@ static struct usb_device_id id_table_combined [] = { |
5961 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
5962 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, |
5963 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
5964 | - { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, |
5965 | + { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, |
5966 | + { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, |
5967 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, |
5968 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, |
5969 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, |
5970 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, |
5971 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, |
5972 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, |
5973 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, |
5974 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, |
5975 | + { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, |
5976 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
5977 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
5978 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
5979 | @@ -799,6 +815,8 @@ static struct usb_device_id id_table_combined [] = { |
5980 | { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, |
5981 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), |
5982 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
5983 | + { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), |
5984 | + .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, |
5985 | { }, /* Optional parameter entry */ |
5986 | { } /* Terminating entry */ |
5987 | }; |
5988 | @@ -1681,6 +1699,25 @@ static int ftdi_jtag_probe(struct usb_serial *serial) |
5989 | } |
5990 | |
5991 | /* |
5992 | + * First and second port on STMCLiteadaptors is reserved for JTAG interface |
5993 | + * and the forth port for pio |
5994 | + */ |
5995 | +static int ftdi_stmclite_probe(struct usb_serial *serial) |
5996 | +{ |
5997 | + struct usb_device *udev = serial->dev; |
5998 | + struct usb_interface *interface = serial->interface; |
5999 | + |
6000 | + dbg("%s", __func__); |
6001 | + |
6002 | + if (interface == udev->actconfig->interface[2]) |
6003 | + return 0; |
6004 | + |
6005 | + dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n"); |
6006 | + |
6007 | + return -ENODEV; |
6008 | +} |
6009 | + |
6010 | +/* |
6011 | * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. |
6012 | * We have to correct it if we want to read from it. |
6013 | */ |
6014 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
6015 | index bf08672..117e8e6 100644 |
6016 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
6017 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
6018 | @@ -518,6 +518,12 @@ |
6019 | #define RATOC_PRODUCT_ID_USB60F 0xb020 |
6020 | |
6021 | /* |
6022 | + * Acton Research Corp. |
6023 | + */ |
6024 | +#define ACTON_VID 0x0647 /* Vendor ID */ |
6025 | +#define ACTON_SPECTRAPRO_PID 0x0100 |
6026 | + |
6027 | +/* |
6028 | * Contec products (http://www.contec.com) |
6029 | * Submitted by Daniel Sangorrin |
6030 | */ |
6031 | @@ -569,11 +575,23 @@ |
6032 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
6033 | |
6034 | /* |
6035 | - * Icom ID-1 digital transceiver |
6036 | + * Definitions for Icom Inc. devices |
6037 | */ |
6038 | - |
6039 | -#define ICOM_ID1_VID 0x0C26 |
6040 | -#define ICOM_ID1_PID 0x0004 |
6041 | +#define ICOM_VID 0x0C26 /* Icom vendor ID */ |
6042 | +/* Note: ID-1 is a communications tranceiver for HAM-radio operators */ |
6043 | +#define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ |
6044 | +/* Note: OPC is an Optional cable to connect an Icom Tranceiver */ |
6045 | +#define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ |
6046 | +/* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ |
6047 | +#define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ |
6048 | +#define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */ |
6049 | +#define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/ |
6050 | +#define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */ |
6051 | +#define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */ |
6052 | +#define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */ |
6053 | +#define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */ |
6054 | +#define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */ |
6055 | +#define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */ |
6056 | |
6057 | /* |
6058 | * GN Otometrics (http://www.otometrics.com) |
6059 | @@ -1022,6 +1040,12 @@ |
6060 | #define WHT_PID 0x0004 /* Wireless Handheld Terminal */ |
6061 | |
6062 | /* |
6063 | + * STMicroelectonics |
6064 | + */ |
6065 | +#define ST_VID 0x0483 |
6066 | +#define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */ |
6067 | + |
6068 | +/* |
6069 | * Papouch products (http://www.papouch.com/) |
6070 | * Submitted by Folkert van Heusden |
6071 | */ |
6072 | diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c |
6073 | index e6833e2..e4db5ad 100644 |
6074 | --- a/drivers/usb/serial/generic.c |
6075 | +++ b/drivers/usb/serial/generic.c |
6076 | @@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port) |
6077 | } |
6078 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); |
6079 | |
6080 | +/** |
6081 | + * usb_serial_handle_dcd_change - handle a change of carrier detect state |
6082 | + * @port: usb_serial_port structure for the open port |
6083 | + * @tty: tty_struct structure for the port |
6084 | + * @status: new carrier detect status, nonzero if active |
6085 | + */ |
6086 | +void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, |
6087 | + struct tty_struct *tty, unsigned int status) |
6088 | +{ |
6089 | + struct tty_port *port = &usb_port->port; |
6090 | + |
6091 | + dbg("%s - port %d, status %d", __func__, usb_port->number, status); |
6092 | + |
6093 | + if (status) |
6094 | + wake_up_interruptible(&port->open_wait); |
6095 | + else if (tty && !C_CLOCAL(tty)) |
6096 | + tty_hangup(tty); |
6097 | +} |
6098 | +EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change); |
6099 | + |
6100 | int usb_serial_generic_resume(struct usb_serial *serial) |
6101 | { |
6102 | struct usb_serial_port *port; |
6103 | diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c |
6104 | index cd769ef..3b246d9 100644 |
6105 | --- a/drivers/usb/serial/io_edgeport.c |
6106 | +++ b/drivers/usb/serial/io_edgeport.c |
6107 | @@ -2889,8 +2889,8 @@ static void load_application_firmware(struct edgeport_serial *edge_serial) |
6108 | |
6109 | dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); |
6110 | |
6111 | - edge_serial->product_info.FirmwareMajorVersion = fw->data[0]; |
6112 | - edge_serial->product_info.FirmwareMinorVersion = fw->data[1]; |
6113 | + edge_serial->product_info.FirmwareMajorVersion = rec->data[0]; |
6114 | + edge_serial->product_info.FirmwareMinorVersion = rec->data[1]; |
6115 | edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); |
6116 | |
6117 | for (rec = ihex_next_binrec(rec); rec; |
6118 | diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h |
6119 | index 6ab2a3f..178b22e 100644 |
6120 | --- a/drivers/usb/serial/io_tables.h |
6121 | +++ b/drivers/usb/serial/io_tables.h |
6122 | @@ -199,6 +199,7 @@ static struct usb_serial_driver epic_device = { |
6123 | .name = "epic", |
6124 | }, |
6125 | .description = "EPiC device", |
6126 | + .usb_driver = &io_driver, |
6127 | .id_table = Epic_port_id_table, |
6128 | .num_ports = 1, |
6129 | .open = edge_open, |
6130 | diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c |
6131 | index 12ed594..99b97c0 100644 |
6132 | --- a/drivers/usb/serial/iuu_phoenix.c |
6133 | +++ b/drivers/usb/serial/iuu_phoenix.c |
6134 | @@ -1275,6 +1275,7 @@ static struct usb_serial_driver iuu_device = { |
6135 | .name = "iuu_phoenix", |
6136 | }, |
6137 | .id_table = id_table, |
6138 | + .usb_driver = &iuu_driver, |
6139 | .num_ports = 1, |
6140 | .bulk_in_size = 512, |
6141 | .bulk_out_size = 512, |
6142 | diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h |
6143 | index 2d8baf6..ce134dc 100644 |
6144 | --- a/drivers/usb/serial/keyspan.h |
6145 | +++ b/drivers/usb/serial/keyspan.h |
6146 | @@ -546,6 +546,7 @@ static struct usb_serial_driver keyspan_pre_device = { |
6147 | .name = "keyspan_no_firm", |
6148 | }, |
6149 | .description = "Keyspan - (without firmware)", |
6150 | + .usb_driver = &keyspan_driver, |
6151 | .id_table = keyspan_pre_ids, |
6152 | .num_ports = 1, |
6153 | .attach = keyspan_fake_startup, |
6154 | @@ -557,6 +558,7 @@ static struct usb_serial_driver keyspan_1port_device = { |
6155 | .name = "keyspan_1", |
6156 | }, |
6157 | .description = "Keyspan 1 port adapter", |
6158 | + .usb_driver = &keyspan_driver, |
6159 | .id_table = keyspan_1port_ids, |
6160 | .num_ports = 1, |
6161 | .open = keyspan_open, |
6162 | @@ -579,6 +581,7 @@ static struct usb_serial_driver keyspan_2port_device = { |
6163 | .name = "keyspan_2", |
6164 | }, |
6165 | .description = "Keyspan 2 port adapter", |
6166 | + .usb_driver = &keyspan_driver, |
6167 | .id_table = keyspan_2port_ids, |
6168 | .num_ports = 2, |
6169 | .open = keyspan_open, |
6170 | @@ -601,6 +604,7 @@ static struct usb_serial_driver keyspan_4port_device = { |
6171 | .name = "keyspan_4", |
6172 | }, |
6173 | .description = "Keyspan 4 port adapter", |
6174 | + .usb_driver = &keyspan_driver, |
6175 | .id_table = keyspan_4port_ids, |
6176 | .num_ports = 4, |
6177 | .open = keyspan_open, |
6178 | diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c |
6179 | index a10dd56..554a869 100644 |
6180 | --- a/drivers/usb/serial/keyspan_pda.c |
6181 | +++ b/drivers/usb/serial/keyspan_pda.c |
6182 | @@ -679,22 +679,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) |
6183 | } |
6184 | } |
6185 | |
6186 | -static int keyspan_pda_carrier_raised(struct usb_serial_port *port) |
6187 | -{ |
6188 | - struct usb_serial *serial = port->serial; |
6189 | - unsigned char modembits; |
6190 | - |
6191 | - /* If we can read the modem status and the DCD is low then |
6192 | - carrier is not raised yet */ |
6193 | - if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { |
6194 | - if (!(modembits & (1>>6))) |
6195 | - return 0; |
6196 | - } |
6197 | - /* Carrier raised, or we failed (eg disconnected) so |
6198 | - progress accordingly */ |
6199 | - return 1; |
6200 | -} |
6201 | - |
6202 | |
6203 | static int keyspan_pda_open(struct tty_struct *tty, |
6204 | struct usb_serial_port *port) |
6205 | @@ -881,7 +865,6 @@ static struct usb_serial_driver keyspan_pda_device = { |
6206 | .id_table = id_table_std, |
6207 | .num_ports = 1, |
6208 | .dtr_rts = keyspan_pda_dtr_rts, |
6209 | - .carrier_raised = keyspan_pda_carrier_raised, |
6210 | .open = keyspan_pda_open, |
6211 | .close = keyspan_pda_close, |
6212 | .write = keyspan_pda_write, |
6213 | diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c |
6214 | index cf17183..653465f 100644 |
6215 | --- a/drivers/usb/serial/moto_modem.c |
6216 | +++ b/drivers/usb/serial/moto_modem.c |
6217 | @@ -44,6 +44,7 @@ static struct usb_serial_driver moto_device = { |
6218 | .name = "moto-modem", |
6219 | }, |
6220 | .id_table = id_table, |
6221 | + .usb_driver = &moto_driver, |
6222 | .num_ports = 1, |
6223 | }; |
6224 | |
6225 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
6226 | index ef2977d..356c870 100644 |
6227 | --- a/drivers/usb/serial/option.c |
6228 | +++ b/drivers/usb/serial/option.c |
6229 | @@ -382,7 +382,16 @@ static void option_instat_callback(struct urb *urb); |
6230 | #define HAIER_VENDOR_ID 0x201e |
6231 | #define HAIER_PRODUCT_CE100 0x2009 |
6232 | |
6233 | -#define CINTERION_VENDOR_ID 0x0681 |
6234 | +/* Cinterion (formerly Siemens) products */ |
6235 | +#define SIEMENS_VENDOR_ID 0x0681 |
6236 | +#define CINTERION_VENDOR_ID 0x1e2d |
6237 | +#define CINTERION_PRODUCT_HC25_MDM 0x0047 |
6238 | +#define CINTERION_PRODUCT_HC25_MDMNET 0x0040 |
6239 | +#define CINTERION_PRODUCT_HC28_MDM 0x004C |
6240 | +#define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ |
6241 | +#define CINTERION_PRODUCT_EU3_E 0x0051 |
6242 | +#define CINTERION_PRODUCT_EU3_P 0x0052 |
6243 | +#define CINTERION_PRODUCT_PH8 0x0053 |
6244 | |
6245 | /* Olivetti products */ |
6246 | #define OLIVETTI_VENDOR_ID 0x0b3c |
6247 | @@ -945,7 +954,17 @@ static const struct usb_device_id option_ids[] = { |
6248 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, |
6249 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, |
6250 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, |
6251 | - { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, |
6252 | + /* Cinterion */ |
6253 | + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, |
6254 | + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, |
6255 | + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, |
6256 | + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
6257 | + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
6258 | + { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, |
6259 | + { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, |
6260 | + { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ |
6261 | + { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
6262 | + |
6263 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
6264 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
6265 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
6266 | diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c |
6267 | index e199b0f..1c46a86 100644 |
6268 | --- a/drivers/usb/serial/oti6858.c |
6269 | +++ b/drivers/usb/serial/oti6858.c |
6270 | @@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = { |
6271 | .name = "oti6858", |
6272 | }, |
6273 | .id_table = id_table, |
6274 | + .usb_driver = &oti6858_driver, |
6275 | .num_ports = 1, |
6276 | .open = oti6858_open, |
6277 | .close = oti6858_close, |
6278 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
6279 | index 8ae4c6c..08c9181 100644 |
6280 | --- a/drivers/usb/serial/pl2303.c |
6281 | +++ b/drivers/usb/serial/pl2303.c |
6282 | @@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = { |
6283 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, |
6284 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
6285 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
6286 | + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, |
6287 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
6288 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
6289 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
6290 | @@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port, |
6291 | { |
6292 | |
6293 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
6294 | + struct tty_struct *tty; |
6295 | unsigned long flags; |
6296 | u8 status_idx = UART_STATE; |
6297 | u8 length = UART_STATE + 1; |
6298 | + u8 prev_line_status; |
6299 | u16 idv, idp; |
6300 | |
6301 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); |
6302 | @@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port, |
6303 | |
6304 | /* Save off the uart status for others to look at */ |
6305 | spin_lock_irqsave(&priv->lock, flags); |
6306 | + prev_line_status = priv->line_status; |
6307 | priv->line_status = data[status_idx]; |
6308 | spin_unlock_irqrestore(&priv->lock, flags); |
6309 | if (priv->line_status & UART_BREAK_ERROR) |
6310 | usb_serial_handle_break(port); |
6311 | wake_up_interruptible(&priv->delta_msr_wait); |
6312 | + |
6313 | + tty = tty_port_tty_get(&port->port); |
6314 | + if (!tty) |
6315 | + return; |
6316 | + if ((priv->line_status ^ prev_line_status) & UART_DCD) |
6317 | + usb_serial_handle_dcd_change(port, tty, |
6318 | + priv->line_status & UART_DCD); |
6319 | + tty_kref_put(tty); |
6320 | } |
6321 | |
6322 | static void pl2303_read_int_callback(struct urb *urb) |
6323 | diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h |
6324 | index 43eb9bd..1b025f7 100644 |
6325 | --- a/drivers/usb/serial/pl2303.h |
6326 | +++ b/drivers/usb/serial/pl2303.h |
6327 | @@ -21,6 +21,7 @@ |
6328 | #define PL2303_PRODUCT_ID_MMX 0x0612 |
6329 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
6330 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
6331 | +#define PL2303_PRODUCT_ID_MOTOROLA 0x0307 |
6332 | |
6333 | #define ATEN_VENDOR_ID 0x0557 |
6334 | #define ATEN_VENDOR_ID2 0x0547 |
6335 | diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c |
6336 | index 214a3e5..30b73e6 100644 |
6337 | --- a/drivers/usb/serial/qcaux.c |
6338 | +++ b/drivers/usb/serial/qcaux.c |
6339 | @@ -36,6 +36,7 @@ |
6340 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 |
6341 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 |
6342 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 |
6343 | +#define PANTECH_PRODUCT_UML290_VZW 0x3718 |
6344 | |
6345 | /* CMOTECH devices */ |
6346 | #define CMOTECH_VENDOR_ID 0x16d8 |
6347 | @@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = { |
6348 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, |
6349 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, |
6350 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, |
6351 | + { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, |
6352 | { }, |
6353 | }; |
6354 | MODULE_DEVICE_TABLE(usb, id_table); |
6355 | @@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = { |
6356 | .name = "qcaux", |
6357 | }, |
6358 | .id_table = id_table, |
6359 | + .usb_driver = &qcaux_driver, |
6360 | .num_ports = 1, |
6361 | }; |
6362 | |
6363 | diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c |
6364 | index cb8195c..74cd4cc 100644 |
6365 | --- a/drivers/usb/serial/siemens_mpi.c |
6366 | +++ b/drivers/usb/serial/siemens_mpi.c |
6367 | @@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = { |
6368 | .name = "siemens_mpi", |
6369 | }, |
6370 | .id_table = id_table, |
6371 | + .usb_driver = &siemens_usb_mpi_driver, |
6372 | .num_ports = 1, |
6373 | }; |
6374 | |
6375 | diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c |
6376 | index 765aa98..cbfb70b 100644 |
6377 | --- a/drivers/usb/serial/spcp8x5.c |
6378 | +++ b/drivers/usb/serial/spcp8x5.c |
6379 | @@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg { |
6380 | |
6381 | /* how come ??? */ |
6382 | #define UART_STATE 0x08 |
6383 | -#define UART_STATE_TRANSIENT_MASK 0x74 |
6384 | +#define UART_STATE_TRANSIENT_MASK 0x75 |
6385 | #define UART_DCD 0x01 |
6386 | #define UART_DSR 0x02 |
6387 | #define UART_BREAK_ERROR 0x04 |
6388 | @@ -525,6 +525,10 @@ static void spcp8x5_process_read_urb(struct urb *urb) |
6389 | /* overrun is special, not associated with a char */ |
6390 | if (status & UART_OVERRUN_ERROR) |
6391 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
6392 | + |
6393 | + if (status & UART_DCD) |
6394 | + usb_serial_handle_dcd_change(port, tty, |
6395 | + priv->line_status & MSR_STATUS_LINE_DCD); |
6396 | } |
6397 | |
6398 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, |
6399 | @@ -645,6 +649,7 @@ static struct usb_serial_driver spcp8x5_device = { |
6400 | .name = "SPCP8x5", |
6401 | }, |
6402 | .id_table = id_table, |
6403 | + .usb_driver = &spcp8x5_driver, |
6404 | .num_ports = 1, |
6405 | .open = spcp8x5_open, |
6406 | .dtr_rts = spcp8x5_dtr_rts, |
6407 | diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c |
6408 | index b2902f3..a910004 100644 |
6409 | --- a/drivers/usb/serial/ti_usb_3410_5052.c |
6410 | +++ b/drivers/usb/serial/ti_usb_3410_5052.c |
6411 | @@ -369,9 +369,9 @@ failed_1port: |
6412 | |
6413 | static void __exit ti_exit(void) |
6414 | { |
6415 | + usb_deregister(&ti_usb_driver); |
6416 | usb_serial_deregister(&ti_1port_device); |
6417 | usb_serial_deregister(&ti_2port_device); |
6418 | - usb_deregister(&ti_usb_driver); |
6419 | } |
6420 | |
6421 | |
6422 | diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
6423 | index 6954de5..546a521 100644 |
6424 | --- a/drivers/usb/serial/usb-serial.c |
6425 | +++ b/drivers/usb/serial/usb-serial.c |
6426 | @@ -1344,11 +1344,15 @@ int usb_serial_register(struct usb_serial_driver *driver) |
6427 | return -ENODEV; |
6428 | |
6429 | fixup_generic(driver); |
6430 | - if (driver->usb_driver) |
6431 | - driver->usb_driver->supports_autosuspend = 1; |
6432 | |
6433 | if (!driver->description) |
6434 | driver->description = driver->driver.name; |
6435 | + if (!driver->usb_driver) { |
6436 | + WARN(1, "Serial driver %s has no usb_driver\n", |
6437 | + driver->description); |
6438 | + return -EINVAL; |
6439 | + } |
6440 | + driver->usb_driver->supports_autosuspend = 1; |
6441 | |
6442 | /* Add this device to our list of devices */ |
6443 | mutex_lock(&table_lock); |
6444 | diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c |
6445 | index f2ed6a3..95a8214 100644 |
6446 | --- a/drivers/usb/serial/usb_debug.c |
6447 | +++ b/drivers/usb/serial/usb_debug.c |
6448 | @@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = { |
6449 | .name = "debug", |
6450 | }, |
6451 | .id_table = id_table, |
6452 | + .usb_driver = &debug_driver, |
6453 | .num_ports = 1, |
6454 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, |
6455 | .break_ctl = usb_debug_break_ctl, |
6456 | diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h |
6457 | index c854fde..2c85530 100644 |
6458 | --- a/drivers/usb/storage/unusual_cypress.h |
6459 | +++ b/drivers/usb/storage/unusual_cypress.h |
6460 | @@ -31,4 +31,9 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999, |
6461 | "Cypress ISD-300LP", |
6462 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
6463 | |
6464 | +UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999, |
6465 | + "Super Top", |
6466 | + "USB 2.0 SATA BRIDGE", |
6467 | + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
6468 | + |
6469 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ |
6470 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
6471 | index fcc1e32..c1602b8 100644 |
6472 | --- a/drivers/usb/storage/unusual_devs.h |
6473 | +++ b/drivers/usb/storage/unusual_devs.h |
6474 | @@ -1044,6 +1044,15 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110, |
6475 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
6476 | US_FL_BULK32), |
6477 | |
6478 | +/* Reported by <ttkspam@free.fr> |
6479 | + * The device reports a vendor-specific device class, requiring an |
6480 | + * explicit vendor/product match. |
6481 | + */ |
6482 | +UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002, |
6483 | + "MagicPixel", |
6484 | + "FW_Omega2", |
6485 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 0), |
6486 | + |
6487 | /* Andrew Lunn <andrew@lunn.ch> |
6488 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL |
6489 | * on LUN 4. |
6490 | @@ -1388,6 +1397,13 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, |
6491 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
6492 | US_FL_IGNORE_RESIDUE ), |
6493 | |
6494 | +/* Submitted by Nick Holloway */ |
6495 | +UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100, |
6496 | + "VTech", |
6497 | + "Kidizoom", |
6498 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
6499 | + US_FL_FIX_CAPACITY ), |
6500 | + |
6501 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
6502 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
6503 | "Sony Ericsson", |
6504 | @@ -1872,6 +1888,22 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, |
6505 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
6506 | US_FL_NO_READ_DISC_INFO ), |
6507 | |
6508 | +/* Patch by Richard Schütz <r.schtz@t-online.de> |
6509 | + * This external hard drive enclosure uses a JMicron chip which |
6510 | + * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ |
6511 | +UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000, |
6512 | + "TrekStor GmbH & Co. KG", |
6513 | + "DataStation maxi g.u", |
6514 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
6515 | + US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), |
6516 | + |
6517 | +/* Reported by Jasper Mackenzie <scarletpimpernal@hotmail.com> */ |
6518 | +UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000, |
6519 | + "Coby Electronics", |
6520 | + "MP3 Player", |
6521 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
6522 | + US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), |
6523 | + |
6524 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
6525 | "ST", |
6526 | "2A", |
6527 | diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c |
6528 | index 5bf9123..5a3ce3a 100644 |
6529 | --- a/drivers/video/aty/atyfb_base.c |
6530 | +++ b/drivers/video/aty/atyfb_base.c |
6531 | @@ -2969,10 +2969,8 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, |
6532 | { |
6533 | struct atyfb_par *par = info->par; |
6534 | struct device_node *dp; |
6535 | - char prop[128]; |
6536 | - phandle node; |
6537 | - int len, i, j, ret; |
6538 | u32 mem, chip_id; |
6539 | + int i, j, ret; |
6540 | |
6541 | /* |
6542 | * Map memory-mapped registers. |
6543 | @@ -3088,23 +3086,8 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, |
6544 | aty_st_le32(MEM_CNTL, mem, par); |
6545 | } |
6546 | |
6547 | - /* |
6548 | - * If this is the console device, we will set default video |
6549 | - * settings to what the PROM left us with. |
6550 | - */ |
6551 | - node = prom_getchild(prom_root_node); |
6552 | - node = prom_searchsiblings(node, "aliases"); |
6553 | - if (node) { |
6554 | - len = prom_getproperty(node, "screen", prop, sizeof(prop)); |
6555 | - if (len > 0) { |
6556 | - prop[len] = '\0'; |
6557 | - node = prom_finddevice(prop); |
6558 | - } else |
6559 | - node = 0; |
6560 | - } |
6561 | - |
6562 | dp = pci_device_to_OF_node(pdev); |
6563 | - if (node == dp->phandle) { |
6564 | + if (dp == of_console_device) { |
6565 | struct fb_var_screeninfo *var = &default_var; |
6566 | unsigned int N, P, Q, M, T, R; |
6567 | u32 v_total, h_total; |
6568 | @@ -3112,9 +3095,9 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, |
6569 | u8 pll_regs[16]; |
6570 | u8 clock_cntl; |
6571 | |
6572 | - crtc.vxres = prom_getintdefault(node, "width", 1024); |
6573 | - crtc.vyres = prom_getintdefault(node, "height", 768); |
6574 | - var->bits_per_pixel = prom_getintdefault(node, "depth", 8); |
6575 | + crtc.vxres = of_getintprop_default(dp, "width", 1024); |
6576 | + crtc.vyres = of_getintprop_default(dp, "height", 768); |
6577 | + var->bits_per_pixel = of_getintprop_default(dp, "depth", 8); |
6578 | var->xoffset = var->yoffset = 0; |
6579 | crtc.h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); |
6580 | crtc.h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); |
6581 | diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c |
6582 | index 38ffc3f..c06c667 100644 |
6583 | --- a/drivers/video/backlight/88pm860x_bl.c |
6584 | +++ b/drivers/video/backlight/88pm860x_bl.c |
6585 | @@ -21,7 +21,7 @@ |
6586 | #define MAX_BRIGHTNESS (0xFF) |
6587 | #define MIN_BRIGHTNESS (0) |
6588 | |
6589 | -#define CURRENT_MASK (0x1F << 1) |
6590 | +#define CURRENT_BITMASK (0x1F << 1) |
6591 | |
6592 | struct pm860x_backlight_data { |
6593 | struct pm860x_chip *chip; |
6594 | @@ -85,7 +85,7 @@ static int pm860x_backlight_set(struct backlight_device *bl, int brightness) |
6595 | if ((data->current_brightness == 0) && brightness) { |
6596 | if (data->iset) { |
6597 | ret = pm860x_set_bits(data->i2c, wled_idc(data->port), |
6598 | - CURRENT_MASK, data->iset); |
6599 | + CURRENT_BITMASK, data->iset); |
6600 | if (ret < 0) |
6601 | goto out; |
6602 | } |
6603 | diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c |
6604 | index ef8d9d5..4fb5b2b 100644 |
6605 | --- a/drivers/virtio/virtio_pci.c |
6606 | +++ b/drivers/virtio/virtio_pci.c |
6607 | @@ -96,11 +96,6 @@ static struct pci_device_id virtio_pci_id_table[] = { |
6608 | |
6609 | MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); |
6610 | |
6611 | -/* A PCI device has it's own struct device and so does a virtio device so |
6612 | - * we create a place for the virtio devices to show up in sysfs. I think it |
6613 | - * would make more sense for virtio to not insist on having it's own device. */ |
6614 | -static struct device *virtio_pci_root; |
6615 | - |
6616 | /* Convert a generic virtio device to our structure */ |
6617 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) |
6618 | { |
6619 | @@ -629,7 +624,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, |
6620 | if (vp_dev == NULL) |
6621 | return -ENOMEM; |
6622 | |
6623 | - vp_dev->vdev.dev.parent = virtio_pci_root; |
6624 | + vp_dev->vdev.dev.parent = &pci_dev->dev; |
6625 | vp_dev->vdev.dev.release = virtio_pci_release_dev; |
6626 | vp_dev->vdev.config = &virtio_pci_config_ops; |
6627 | vp_dev->pci_dev = pci_dev; |
6628 | @@ -717,17 +712,7 @@ static struct pci_driver virtio_pci_driver = { |
6629 | |
6630 | static int __init virtio_pci_init(void) |
6631 | { |
6632 | - int err; |
6633 | - |
6634 | - virtio_pci_root = root_device_register("virtio-pci"); |
6635 | - if (IS_ERR(virtio_pci_root)) |
6636 | - return PTR_ERR(virtio_pci_root); |
6637 | - |
6638 | - err = pci_register_driver(&virtio_pci_driver); |
6639 | - if (err) |
6640 | - root_device_unregister(virtio_pci_root); |
6641 | - |
6642 | - return err; |
6643 | + return pci_register_driver(&virtio_pci_driver); |
6644 | } |
6645 | |
6646 | module_init(virtio_pci_init); |
6647 | @@ -735,7 +720,6 @@ module_init(virtio_pci_init); |
6648 | static void __exit virtio_pci_exit(void) |
6649 | { |
6650 | pci_unregister_driver(&virtio_pci_driver); |
6651 | - root_device_unregister(virtio_pci_root); |
6652 | } |
6653 | |
6654 | module_exit(virtio_pci_exit); |
6655 | diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c |
6656 | index c01b5dd..afbe041 100644 |
6657 | --- a/drivers/xen/platform-pci.c |
6658 | +++ b/drivers/xen/platform-pci.c |
6659 | @@ -105,7 +105,7 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, |
6660 | const struct pci_device_id *ent) |
6661 | { |
6662 | int i, ret; |
6663 | - long ioaddr, iolen; |
6664 | + long ioaddr; |
6665 | long mmio_addr, mmio_len; |
6666 | unsigned int max_nr_gframes; |
6667 | |
6668 | @@ -114,7 +114,6 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, |
6669 | return i; |
6670 | |
6671 | ioaddr = pci_resource_start(pdev, 0); |
6672 | - iolen = pci_resource_len(pdev, 0); |
6673 | |
6674 | mmio_addr = pci_resource_start(pdev, 1); |
6675 | mmio_len = pci_resource_len(pdev, 1); |
6676 | @@ -125,19 +124,13 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, |
6677 | goto pci_out; |
6678 | } |
6679 | |
6680 | - if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) { |
6681 | - dev_err(&pdev->dev, "MEM I/O resource 0x%lx @ 0x%lx busy\n", |
6682 | - mmio_addr, mmio_len); |
6683 | - ret = -EBUSY; |
6684 | + ret = pci_request_region(pdev, 1, DRV_NAME); |
6685 | + if (ret < 0) |
6686 | goto pci_out; |
6687 | - } |
6688 | |
6689 | - if (request_region(ioaddr, iolen, DRV_NAME) == NULL) { |
6690 | - dev_err(&pdev->dev, "I/O resource 0x%lx @ 0x%lx busy\n", |
6691 | - iolen, ioaddr); |
6692 | - ret = -EBUSY; |
6693 | + ret = pci_request_region(pdev, 0, DRV_NAME); |
6694 | + if (ret < 0) |
6695 | goto mem_out; |
6696 | - } |
6697 | |
6698 | platform_mmio = mmio_addr; |
6699 | platform_mmiolen = mmio_len; |
6700 | @@ -169,9 +162,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, |
6701 | return 0; |
6702 | |
6703 | out: |
6704 | - release_region(ioaddr, iolen); |
6705 | + pci_release_region(pdev, 0); |
6706 | mem_out: |
6707 | - release_mem_region(mmio_addr, mmio_len); |
6708 | + pci_release_region(pdev, 1); |
6709 | pci_out: |
6710 | pci_disable_device(pdev); |
6711 | return ret; |
6712 | diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h |
6713 | index e6d1481..95d5dbb 100644 |
6714 | --- a/fs/cifs/cifsproto.h |
6715 | +++ b/fs/cifs/cifsproto.h |
6716 | @@ -347,7 +347,7 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, |
6717 | const __u16 netfid, const __u64 len, |
6718 | const __u64 offset, const __u32 numUnlock, |
6719 | const __u32 numLock, const __u8 lockType, |
6720 | - const bool waitFlag); |
6721 | + const bool waitFlag, const __u8 oplock_level); |
6722 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
6723 | const __u16 smb_file_id, const int get_flag, |
6724 | const __u64 len, struct file_lock *, |
6725 | diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c |
6726 | index 67acfb3..0fa5c1f 100644 |
6727 | --- a/fs/cifs/cifssmb.c |
6728 | +++ b/fs/cifs/cifssmb.c |
6729 | @@ -1666,7 +1666,8 @@ int |
6730 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, |
6731 | const __u16 smb_file_id, const __u64 len, |
6732 | const __u64 offset, const __u32 numUnlock, |
6733 | - const __u32 numLock, const __u8 lockType, const bool waitFlag) |
6734 | + const __u32 numLock, const __u8 lockType, |
6735 | + const bool waitFlag, const __u8 oplock_level) |
6736 | { |
6737 | int rc = 0; |
6738 | LOCK_REQ *pSMB = NULL; |
6739 | @@ -1694,6 +1695,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, |
6740 | pSMB->NumberOfLocks = cpu_to_le16(numLock); |
6741 | pSMB->NumberOfUnlocks = cpu_to_le16(numUnlock); |
6742 | pSMB->LockType = lockType; |
6743 | + pSMB->OplockLevel = oplock_level; |
6744 | pSMB->AndXCommand = 0xFF; /* none */ |
6745 | pSMB->Fid = smb_file_id; /* netfid stays le */ |
6746 | |
6747 | diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
6748 | index cc1a860..ac75883 100644 |
6749 | --- a/fs/cifs/connect.c |
6750 | +++ b/fs/cifs/connect.c |
6751 | @@ -2999,7 +2999,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, |
6752 | bcc_ptr++; /* skip password */ |
6753 | /* already aligned so no need to do it below */ |
6754 | } else { |
6755 | - pSMB->PasswordLength = cpu_to_le16(CIFS_SESS_KEY_SIZE); |
6756 | + pSMB->PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE); |
6757 | /* BB FIXME add code to fail this if NTLMv2 or Kerberos |
6758 | specified as required (when that support is added to |
6759 | the vfs in the future) as only NTLM or the much |
6760 | @@ -3017,7 +3017,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, |
6761 | #endif /* CIFS_WEAK_PW_HASH */ |
6762 | SMBNTencrypt(tcon->password, ses->server->cryptkey, bcc_ptr); |
6763 | |
6764 | - bcc_ptr += CIFS_SESS_KEY_SIZE; |
6765 | + bcc_ptr += CIFS_AUTH_RESP_SIZE; |
6766 | if (ses->capabilities & CAP_UNICODE) { |
6767 | /* must align unicode strings */ |
6768 | *bcc_ptr = 0; /* null byte password */ |
6769 | diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
6770 | index 5a28660..904edbe 100644 |
6771 | --- a/fs/cifs/file.c |
6772 | +++ b/fs/cifs/file.c |
6773 | @@ -779,12 +779,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) |
6774 | |
6775 | /* BB we could chain these into one lock request BB */ |
6776 | rc = CIFSSMBLock(xid, tcon, netfid, length, pfLock->fl_start, |
6777 | - 0, 1, lockType, 0 /* wait flag */ ); |
6778 | + 0, 1, lockType, 0 /* wait flag */, 0); |
6779 | if (rc == 0) { |
6780 | rc = CIFSSMBLock(xid, tcon, netfid, length, |
6781 | pfLock->fl_start, 1 /* numUnlock */ , |
6782 | 0 /* numLock */ , lockType, |
6783 | - 0 /* wait flag */ ); |
6784 | + 0 /* wait flag */, 0); |
6785 | pfLock->fl_type = F_UNLCK; |
6786 | if (rc != 0) |
6787 | cERROR(1, "Error unlocking previously locked " |
6788 | @@ -801,13 +801,13 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) |
6789 | rc = CIFSSMBLock(xid, tcon, netfid, length, |
6790 | pfLock->fl_start, 0, 1, |
6791 | lockType | LOCKING_ANDX_SHARED_LOCK, |
6792 | - 0 /* wait flag */); |
6793 | + 0 /* wait flag */, 0); |
6794 | if (rc == 0) { |
6795 | rc = CIFSSMBLock(xid, tcon, netfid, |
6796 | length, pfLock->fl_start, 1, 0, |
6797 | lockType | |
6798 | LOCKING_ANDX_SHARED_LOCK, |
6799 | - 0 /* wait flag */); |
6800 | + 0 /* wait flag */, 0); |
6801 | pfLock->fl_type = F_RDLCK; |
6802 | if (rc != 0) |
6803 | cERROR(1, "Error unlocking " |
6804 | @@ -850,8 +850,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) |
6805 | |
6806 | if (numLock) { |
6807 | rc = CIFSSMBLock(xid, tcon, netfid, length, |
6808 | - pfLock->fl_start, |
6809 | - 0, numLock, lockType, wait_flag); |
6810 | + pfLock->fl_start, 0, numLock, lockType, |
6811 | + wait_flag, 0); |
6812 | |
6813 | if (rc == 0) { |
6814 | /* For Windows locks we must store them. */ |
6815 | @@ -871,9 +871,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) |
6816 | (pfLock->fl_start + length) >= |
6817 | (li->offset + li->length)) { |
6818 | stored_rc = CIFSSMBLock(xid, tcon, |
6819 | - netfid, |
6820 | - li->length, li->offset, |
6821 | - 1, 0, li->type, false); |
6822 | + netfid, li->length, |
6823 | + li->offset, 1, 0, |
6824 | + li->type, false, 0); |
6825 | if (stored_rc) |
6826 | rc = stored_rc; |
6827 | else { |
6828 | @@ -2245,7 +2245,8 @@ void cifs_oplock_break(struct work_struct *work) |
6829 | */ |
6830 | if (!cfile->oplock_break_cancelled) { |
6831 | rc = CIFSSMBLock(0, tlink_tcon(cfile->tlink), cfile->netfid, 0, |
6832 | - 0, 0, 0, LOCKING_ANDX_OPLOCK_RELEASE, false); |
6833 | + 0, 0, 0, LOCKING_ANDX_OPLOCK_RELEASE, false, |
6834 | + cinode->clientCanCacheRead ? 1 : 0); |
6835 | cFYI(1, "Oplock release rc = %d", rc); |
6836 | } |
6837 | |
6838 | diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c |
6839 | index 43f1028..09bfcf0 100644 |
6840 | --- a/fs/cifs/misc.c |
6841 | +++ b/fs/cifs/misc.c |
6842 | @@ -571,7 +571,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) |
6843 | pCifsInode = CIFS_I(netfile->dentry->d_inode); |
6844 | |
6845 | cifs_set_oplock_level(pCifsInode, |
6846 | - pSMB->OplockLevel); |
6847 | + pSMB->OplockLevel ? OPLOCK_READ : 0); |
6848 | /* |
6849 | * cifs_oplock_break_put() can't be called |
6850 | * from here. Get reference after queueing |
6851 | diff --git a/fs/direct-io.c b/fs/direct-io.c |
6852 | index 85882f6..b044705 100644 |
6853 | --- a/fs/direct-io.c |
6854 | +++ b/fs/direct-io.c |
6855 | @@ -325,12 +325,16 @@ void dio_end_io(struct bio *bio, int error) |
6856 | } |
6857 | EXPORT_SYMBOL_GPL(dio_end_io); |
6858 | |
6859 | -static int |
6860 | +static void |
6861 | dio_bio_alloc(struct dio *dio, struct block_device *bdev, |
6862 | sector_t first_sector, int nr_vecs) |
6863 | { |
6864 | struct bio *bio; |
6865 | |
6866 | + /* |
6867 | + * bio_alloc() is guaranteed to return a bio when called with |
6868 | + * __GFP_WAIT and we request a valid number of vectors. |
6869 | + */ |
6870 | bio = bio_alloc(GFP_KERNEL, nr_vecs); |
6871 | |
6872 | bio->bi_bdev = bdev; |
6873 | @@ -342,7 +346,6 @@ dio_bio_alloc(struct dio *dio, struct block_device *bdev, |
6874 | |
6875 | dio->bio = bio; |
6876 | dio->logical_offset_in_bio = dio->cur_page_fs_offset; |
6877 | - return 0; |
6878 | } |
6879 | |
6880 | /* |
6881 | @@ -583,8 +586,9 @@ static int dio_new_bio(struct dio *dio, sector_t start_sector) |
6882 | goto out; |
6883 | sector = start_sector << (dio->blkbits - 9); |
6884 | nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev)); |
6885 | + nr_pages = min(nr_pages, BIO_MAX_PAGES); |
6886 | BUG_ON(nr_pages <= 0); |
6887 | - ret = dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); |
6888 | + dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); |
6889 | dio->boundary = 0; |
6890 | out: |
6891 | return ret; |
6892 | diff --git a/fs/eventpoll.c b/fs/eventpoll.c |
6893 | index 8cf0724..7daf1e6 100644 |
6894 | --- a/fs/eventpoll.c |
6895 | +++ b/fs/eventpoll.c |
6896 | @@ -1111,6 +1111,17 @@ static int ep_send_events(struct eventpoll *ep, |
6897 | return ep_scan_ready_list(ep, ep_send_events_proc, &esed); |
6898 | } |
6899 | |
6900 | +static inline struct timespec ep_set_mstimeout(long ms) |
6901 | +{ |
6902 | + struct timespec now, ts = { |
6903 | + .tv_sec = ms / MSEC_PER_SEC, |
6904 | + .tv_nsec = NSEC_PER_MSEC * (ms % MSEC_PER_SEC), |
6905 | + }; |
6906 | + |
6907 | + ktime_get_ts(&now); |
6908 | + return timespec_add_safe(now, ts); |
6909 | +} |
6910 | + |
6911 | static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, |
6912 | int maxevents, long timeout) |
6913 | { |
6914 | @@ -1118,12 +1129,11 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, |
6915 | unsigned long flags; |
6916 | long slack; |
6917 | wait_queue_t wait; |
6918 | - struct timespec end_time; |
6919 | ktime_t expires, *to = NULL; |
6920 | |
6921 | if (timeout > 0) { |
6922 | - ktime_get_ts(&end_time); |
6923 | - timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC); |
6924 | + struct timespec end_time = ep_set_mstimeout(timeout); |
6925 | + |
6926 | slack = select_estimate_accuracy(&end_time); |
6927 | to = &expires; |
6928 | *to = timespec_to_ktime(end_time); |
6929 | diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c |
6930 | index 4268542..a755523 100644 |
6931 | --- a/fs/exofs/inode.c |
6932 | +++ b/fs/exofs/inode.c |
6933 | @@ -1030,7 +1030,6 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino) |
6934 | memcpy(oi->i_data, fcb.i_data, sizeof(fcb.i_data)); |
6935 | } |
6936 | |
6937 | - inode->i_mapping->backing_dev_info = sb->s_bdi; |
6938 | if (S_ISREG(inode->i_mode)) { |
6939 | inode->i_op = &exofs_file_inode_operations; |
6940 | inode->i_fop = &exofs_file_operations; |
6941 | @@ -1131,7 +1130,6 @@ struct inode *exofs_new_inode(struct inode *dir, int mode) |
6942 | |
6943 | sbi = sb->s_fs_info; |
6944 | |
6945 | - inode->i_mapping->backing_dev_info = sb->s_bdi; |
6946 | sb->s_dirt = 1; |
6947 | inode_init_owner(inode, dir, mode); |
6948 | inode->i_ino = sbi->s_nextid++; |
6949 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
6950 | index e659597..97a28e9 100644 |
6951 | --- a/fs/ext4/inode.c |
6952 | +++ b/fs/ext4/inode.c |
6953 | @@ -4349,6 +4349,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, |
6954 | (__le32 *) bh->b_data, |
6955 | (__le32 *) bh->b_data + addr_per_block, |
6956 | depth); |
6957 | + brelse(bh); |
6958 | |
6959 | /* |
6960 | * Everything below this this pointer has been |
6961 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
6962 | index 5b4d4e3..f1811d5 100644 |
6963 | --- a/fs/ext4/mballoc.c |
6964 | +++ b/fs/ext4/mballoc.c |
6965 | @@ -342,10 +342,15 @@ static struct kmem_cache *ext4_free_ext_cachep; |
6966 | /* We create slab caches for groupinfo data structures based on the |
6967 | * superblock block size. There will be one per mounted filesystem for |
6968 | * each unique s_blocksize_bits */ |
6969 | -#define NR_GRPINFO_CACHES \ |
6970 | - (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE + 1) |
6971 | +#define NR_GRPINFO_CACHES 8 |
6972 | static struct kmem_cache *ext4_groupinfo_caches[NR_GRPINFO_CACHES]; |
6973 | |
6974 | +static const char *ext4_groupinfo_slab_names[NR_GRPINFO_CACHES] = { |
6975 | + "ext4_groupinfo_1k", "ext4_groupinfo_2k", "ext4_groupinfo_4k", |
6976 | + "ext4_groupinfo_8k", "ext4_groupinfo_16k", "ext4_groupinfo_32k", |
6977 | + "ext4_groupinfo_64k", "ext4_groupinfo_128k" |
6978 | +}; |
6979 | + |
6980 | static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, |
6981 | ext4_group_t group); |
6982 | static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap, |
6983 | @@ -2414,6 +2419,55 @@ err_freesgi: |
6984 | return -ENOMEM; |
6985 | } |
6986 | |
6987 | +static void ext4_groupinfo_destroy_slabs(void) |
6988 | +{ |
6989 | + int i; |
6990 | + |
6991 | + for (i = 0; i < NR_GRPINFO_CACHES; i++) { |
6992 | + if (ext4_groupinfo_caches[i]) |
6993 | + kmem_cache_destroy(ext4_groupinfo_caches[i]); |
6994 | + ext4_groupinfo_caches[i] = NULL; |
6995 | + } |
6996 | +} |
6997 | + |
6998 | +static int ext4_groupinfo_create_slab(size_t size) |
6999 | +{ |
7000 | + static DEFINE_MUTEX(ext4_grpinfo_slab_create_mutex); |
7001 | + int slab_size; |
7002 | + int blocksize_bits = order_base_2(size); |
7003 | + int cache_index = blocksize_bits - EXT4_MIN_BLOCK_LOG_SIZE; |
7004 | + struct kmem_cache *cachep; |
7005 | + |
7006 | + if (cache_index >= NR_GRPINFO_CACHES) |
7007 | + return -EINVAL; |
7008 | + |
7009 | + if (unlikely(cache_index < 0)) |
7010 | + cache_index = 0; |
7011 | + |
7012 | + mutex_lock(&ext4_grpinfo_slab_create_mutex); |
7013 | + if (ext4_groupinfo_caches[cache_index]) { |
7014 | + mutex_unlock(&ext4_grpinfo_slab_create_mutex); |
7015 | + return 0; /* Already created */ |
7016 | + } |
7017 | + |
7018 | + slab_size = offsetof(struct ext4_group_info, |
7019 | + bb_counters[blocksize_bits + 2]); |
7020 | + |
7021 | + cachep = kmem_cache_create(ext4_groupinfo_slab_names[cache_index], |
7022 | + slab_size, 0, SLAB_RECLAIM_ACCOUNT, |
7023 | + NULL); |
7024 | + |
7025 | + mutex_unlock(&ext4_grpinfo_slab_create_mutex); |
7026 | + if (!cachep) { |
7027 | + printk(KERN_EMERG "EXT4: no memory for groupinfo slab cache\n"); |
7028 | + return -ENOMEM; |
7029 | + } |
7030 | + |
7031 | + ext4_groupinfo_caches[cache_index] = cachep; |
7032 | + |
7033 | + return 0; |
7034 | +} |
7035 | + |
7036 | int ext4_mb_init(struct super_block *sb, int needs_recovery) |
7037 | { |
7038 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
7039 | @@ -2421,9 +2475,6 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) |
7040 | unsigned offset; |
7041 | unsigned max; |
7042 | int ret; |
7043 | - int cache_index; |
7044 | - struct kmem_cache *cachep; |
7045 | - char *namep = NULL; |
7046 | |
7047 | i = (sb->s_blocksize_bits + 2) * sizeof(*sbi->s_mb_offsets); |
7048 | |
7049 | @@ -2440,30 +2491,9 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) |
7050 | goto out; |
7051 | } |
7052 | |
7053 | - cache_index = sb->s_blocksize_bits - EXT4_MIN_BLOCK_LOG_SIZE; |
7054 | - cachep = ext4_groupinfo_caches[cache_index]; |
7055 | - if (!cachep) { |
7056 | - char name[32]; |
7057 | - int len = offsetof(struct ext4_group_info, |
7058 | - bb_counters[sb->s_blocksize_bits + 2]); |
7059 | - |
7060 | - sprintf(name, "ext4_groupinfo_%d", sb->s_blocksize_bits); |
7061 | - namep = kstrdup(name, GFP_KERNEL); |
7062 | - if (!namep) { |
7063 | - ret = -ENOMEM; |
7064 | - goto out; |
7065 | - } |
7066 | - |
7067 | - /* Need to free the kmem_cache_name() when we |
7068 | - * destroy the slab */ |
7069 | - cachep = kmem_cache_create(namep, len, 0, |
7070 | - SLAB_RECLAIM_ACCOUNT, NULL); |
7071 | - if (!cachep) { |
7072 | - ret = -ENOMEM; |
7073 | - goto out; |
7074 | - } |
7075 | - ext4_groupinfo_caches[cache_index] = cachep; |
7076 | - } |
7077 | + ret = ext4_groupinfo_create_slab(sb->s_blocksize); |
7078 | + if (ret < 0) |
7079 | + goto out; |
7080 | |
7081 | /* order 0 is regular bitmap */ |
7082 | sbi->s_mb_maxs[0] = sb->s_blocksize << 3; |
7083 | @@ -2520,7 +2550,6 @@ out: |
7084 | if (ret) { |
7085 | kfree(sbi->s_mb_offsets); |
7086 | kfree(sbi->s_mb_maxs); |
7087 | - kfree(namep); |
7088 | } |
7089 | return ret; |
7090 | } |
7091 | @@ -2734,7 +2763,6 @@ int __init ext4_init_mballoc(void) |
7092 | |
7093 | void ext4_exit_mballoc(void) |
7094 | { |
7095 | - int i; |
7096 | /* |
7097 | * Wait for completion of call_rcu()'s on ext4_pspace_cachep |
7098 | * before destroying the slab cache. |
7099 | @@ -2743,15 +2771,7 @@ void ext4_exit_mballoc(void) |
7100 | kmem_cache_destroy(ext4_pspace_cachep); |
7101 | kmem_cache_destroy(ext4_ac_cachep); |
7102 | kmem_cache_destroy(ext4_free_ext_cachep); |
7103 | - |
7104 | - for (i = 0; i < NR_GRPINFO_CACHES; i++) { |
7105 | - struct kmem_cache *cachep = ext4_groupinfo_caches[i]; |
7106 | - if (cachep) { |
7107 | - char *name = (char *)kmem_cache_name(cachep); |
7108 | - kmem_cache_destroy(cachep); |
7109 | - kfree(name); |
7110 | - } |
7111 | - } |
7112 | + ext4_groupinfo_destroy_slabs(); |
7113 | ext4_remove_debugfs_entry(); |
7114 | } |
7115 | |
7116 | @@ -4851,7 +4871,7 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
7117 | if (len >= EXT4_BLOCKS_PER_GROUP(sb)) |
7118 | len -= (EXT4_BLOCKS_PER_GROUP(sb) - first_block); |
7119 | else |
7120 | - last_block = len; |
7121 | + last_block = first_block + len; |
7122 | |
7123 | if (e4b.bd_info->bb_free >= minlen) { |
7124 | cnt = ext4_trim_all_free(sb, &e4b, first_block, |
7125 | diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c |
7126 | index beacce1..736f4ee 100644 |
7127 | --- a/fs/ext4/page-io.c |
7128 | +++ b/fs/ext4/page-io.c |
7129 | @@ -193,6 +193,7 @@ static void ext4_end_bio(struct bio *bio, int error) |
7130 | struct inode *inode; |
7131 | unsigned long flags; |
7132 | int i; |
7133 | + sector_t bi_sector = bio->bi_sector; |
7134 | |
7135 | BUG_ON(!io_end); |
7136 | bio->bi_private = NULL; |
7137 | @@ -210,9 +211,7 @@ static void ext4_end_bio(struct bio *bio, int error) |
7138 | if (error) |
7139 | SetPageError(page); |
7140 | BUG_ON(!head); |
7141 | - if (head->b_size == PAGE_CACHE_SIZE) |
7142 | - clear_buffer_dirty(head); |
7143 | - else { |
7144 | + if (head->b_size != PAGE_CACHE_SIZE) { |
7145 | loff_t offset; |
7146 | loff_t io_end_offset = io_end->offset + io_end->size; |
7147 | |
7148 | @@ -224,7 +223,6 @@ static void ext4_end_bio(struct bio *bio, int error) |
7149 | if (error) |
7150 | buffer_io_error(bh); |
7151 | |
7152 | - clear_buffer_dirty(bh); |
7153 | } |
7154 | if (buffer_delay(bh)) |
7155 | partial_write = 1; |
7156 | @@ -260,7 +258,7 @@ static void ext4_end_bio(struct bio *bio, int error) |
7157 | (unsigned long long) io_end->offset, |
7158 | (long) io_end->size, |
7159 | (unsigned long long) |
7160 | - bio->bi_sector >> (inode->i_blkbits - 9)); |
7161 | + bi_sector >> (inode->i_blkbits - 9)); |
7162 | } |
7163 | |
7164 | /* Add the io_end to per-inode completed io list*/ |
7165 | @@ -383,6 +381,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, |
7166 | |
7167 | blocksize = 1 << inode->i_blkbits; |
7168 | |
7169 | + BUG_ON(!PageLocked(page)); |
7170 | BUG_ON(PageWriteback(page)); |
7171 | set_page_writeback(page); |
7172 | ClearPageError(page); |
7173 | @@ -400,12 +399,14 @@ int ext4_bio_write_page(struct ext4_io_submit *io, |
7174 | for (bh = head = page_buffers(page), block_start = 0; |
7175 | bh != head || !block_start; |
7176 | block_start = block_end, bh = bh->b_this_page) { |
7177 | + |
7178 | block_end = block_start + blocksize; |
7179 | if (block_start >= len) { |
7180 | clear_buffer_dirty(bh); |
7181 | set_buffer_uptodate(bh); |
7182 | continue; |
7183 | } |
7184 | + clear_buffer_dirty(bh); |
7185 | ret = io_submit_add_bh(io, io_page, inode, wbc, bh); |
7186 | if (ret) { |
7187 | /* |
7188 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
7189 | index fb15c9c..851eac3 100644 |
7190 | --- a/fs/ext4/super.c |
7191 | +++ b/fs/ext4/super.c |
7192 | @@ -77,6 +77,7 @@ static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags, |
7193 | const char *dev_name, void *data); |
7194 | static void ext4_destroy_lazyinit_thread(void); |
7195 | static void ext4_unregister_li_request(struct super_block *sb); |
7196 | +static void ext4_clear_request_list(void); |
7197 | |
7198 | #if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) |
7199 | static struct file_system_type ext3_fs_type = { |
7200 | @@ -2704,6 +2705,8 @@ static void ext4_unregister_li_request(struct super_block *sb) |
7201 | mutex_unlock(&ext4_li_info->li_list_mtx); |
7202 | } |
7203 | |
7204 | +static struct task_struct *ext4_lazyinit_task; |
7205 | + |
7206 | /* |
7207 | * This is the function where ext4lazyinit thread lives. It walks |
7208 | * through the request list searching for next scheduled filesystem. |
7209 | @@ -2772,6 +2775,10 @@ cont_thread: |
7210 | if (time_before(jiffies, next_wakeup)) |
7211 | schedule(); |
7212 | finish_wait(&eli->li_wait_daemon, &wait); |
7213 | + if (kthread_should_stop()) { |
7214 | + ext4_clear_request_list(); |
7215 | + goto exit_thread; |
7216 | + } |
7217 | } |
7218 | |
7219 | exit_thread: |
7220 | @@ -2796,6 +2803,7 @@ exit_thread: |
7221 | wake_up(&eli->li_wait_task); |
7222 | |
7223 | kfree(ext4_li_info); |
7224 | + ext4_lazyinit_task = NULL; |
7225 | ext4_li_info = NULL; |
7226 | mutex_unlock(&ext4_li_mtx); |
7227 | |
7228 | @@ -2818,11 +2826,10 @@ static void ext4_clear_request_list(void) |
7229 | |
7230 | static int ext4_run_lazyinit_thread(void) |
7231 | { |
7232 | - struct task_struct *t; |
7233 | - |
7234 | - t = kthread_run(ext4_lazyinit_thread, ext4_li_info, "ext4lazyinit"); |
7235 | - if (IS_ERR(t)) { |
7236 | - int err = PTR_ERR(t); |
7237 | + ext4_lazyinit_task = kthread_run(ext4_lazyinit_thread, |
7238 | + ext4_li_info, "ext4lazyinit"); |
7239 | + if (IS_ERR(ext4_lazyinit_task)) { |
7240 | + int err = PTR_ERR(ext4_lazyinit_task); |
7241 | ext4_clear_request_list(); |
7242 | del_timer_sync(&ext4_li_info->li_timer); |
7243 | kfree(ext4_li_info); |
7244 | @@ -2916,7 +2923,7 @@ static int ext4_register_li_request(struct super_block *sb, |
7245 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
7246 | struct ext4_li_request *elr; |
7247 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; |
7248 | - int ret; |
7249 | + int ret = 0; |
7250 | |
7251 | if (sbi->s_li_request != NULL) |
7252 | return 0; |
7253 | @@ -2973,16 +2980,10 @@ static void ext4_destroy_lazyinit_thread(void) |
7254 | * If thread exited earlier |
7255 | * there's nothing to be done. |
7256 | */ |
7257 | - if (!ext4_li_info) |
7258 | + if (!ext4_li_info || !ext4_lazyinit_task) |
7259 | return; |
7260 | |
7261 | - ext4_clear_request_list(); |
7262 | - |
7263 | - while (ext4_li_info->li_task) { |
7264 | - wake_up(&ext4_li_info->li_wait_daemon); |
7265 | - wait_event(ext4_li_info->li_wait_task, |
7266 | - ext4_li_info->li_task == NULL); |
7267 | - } |
7268 | + kthread_stop(ext4_lazyinit_task); |
7269 | } |
7270 | |
7271 | static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
7272 | @@ -4756,7 +4757,7 @@ static struct file_system_type ext4_fs_type = { |
7273 | .fs_flags = FS_REQUIRES_DEV, |
7274 | }; |
7275 | |
7276 | -int __init ext4_init_feat_adverts(void) |
7277 | +static int __init ext4_init_feat_adverts(void) |
7278 | { |
7279 | struct ext4_features *ef; |
7280 | int ret = -ENOMEM; |
7281 | @@ -4780,6 +4781,13 @@ out: |
7282 | return ret; |
7283 | } |
7284 | |
7285 | +static void ext4_exit_feat_adverts(void) |
7286 | +{ |
7287 | + kobject_put(&ext4_feat->f_kobj); |
7288 | + wait_for_completion(&ext4_feat->f_kobj_unregister); |
7289 | + kfree(ext4_feat); |
7290 | +} |
7291 | + |
7292 | static int __init ext4_init_fs(void) |
7293 | { |
7294 | int err; |
7295 | @@ -4826,7 +4834,7 @@ out1: |
7296 | out2: |
7297 | ext4_exit_mballoc(); |
7298 | out3: |
7299 | - kfree(ext4_feat); |
7300 | + ext4_exit_feat_adverts(); |
7301 | remove_proc_entry("fs/ext4", NULL); |
7302 | kset_unregister(ext4_kset); |
7303 | out4: |
7304 | @@ -4845,6 +4853,7 @@ static void __exit ext4_exit_fs(void) |
7305 | destroy_inodecache(); |
7306 | ext4_exit_xattr(); |
7307 | ext4_exit_mballoc(); |
7308 | + ext4_exit_feat_adverts(); |
7309 | remove_proc_entry("fs/ext4", NULL); |
7310 | kset_unregister(ext4_kset); |
7311 | ext4_exit_system_zone(); |
7312 | diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c |
7313 | index 3d06ccc..cdbf7ac 100644 |
7314 | --- a/fs/fs-writeback.c |
7315 | +++ b/fs/fs-writeback.c |
7316 | @@ -84,13 +84,9 @@ static inline struct inode *wb_inode(struct list_head *head) |
7317 | return list_entry(head, struct inode, i_wb_list); |
7318 | } |
7319 | |
7320 | -static void bdi_queue_work(struct backing_dev_info *bdi, |
7321 | - struct wb_writeback_work *work) |
7322 | +/* Wakeup flusher thread or forker thread to fork it. Requires bdi->wb_lock. */ |
7323 | +static void bdi_wakeup_flusher(struct backing_dev_info *bdi) |
7324 | { |
7325 | - trace_writeback_queue(bdi, work); |
7326 | - |
7327 | - spin_lock_bh(&bdi->wb_lock); |
7328 | - list_add_tail(&work->list, &bdi->work_list); |
7329 | if (bdi->wb.task) { |
7330 | wake_up_process(bdi->wb.task); |
7331 | } else { |
7332 | @@ -98,15 +94,26 @@ static void bdi_queue_work(struct backing_dev_info *bdi, |
7333 | * The bdi thread isn't there, wake up the forker thread which |
7334 | * will create and run it. |
7335 | */ |
7336 | - trace_writeback_nothread(bdi, work); |
7337 | wake_up_process(default_backing_dev_info.wb.task); |
7338 | } |
7339 | +} |
7340 | + |
7341 | +static void bdi_queue_work(struct backing_dev_info *bdi, |
7342 | + struct wb_writeback_work *work) |
7343 | +{ |
7344 | + trace_writeback_queue(bdi, work); |
7345 | + |
7346 | + spin_lock_bh(&bdi->wb_lock); |
7347 | + list_add_tail(&work->list, &bdi->work_list); |
7348 | + if (!bdi->wb.task) |
7349 | + trace_writeback_nothread(bdi, work); |
7350 | + bdi_wakeup_flusher(bdi); |
7351 | spin_unlock_bh(&bdi->wb_lock); |
7352 | } |
7353 | |
7354 | static void |
7355 | __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
7356 | - bool range_cyclic, bool for_background) |
7357 | + bool range_cyclic) |
7358 | { |
7359 | struct wb_writeback_work *work; |
7360 | |
7361 | @@ -126,7 +133,6 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
7362 | work->sync_mode = WB_SYNC_NONE; |
7363 | work->nr_pages = nr_pages; |
7364 | work->range_cyclic = range_cyclic; |
7365 | - work->for_background = for_background; |
7366 | |
7367 | bdi_queue_work(bdi, work); |
7368 | } |
7369 | @@ -144,7 +150,7 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
7370 | */ |
7371 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages) |
7372 | { |
7373 | - __bdi_start_writeback(bdi, nr_pages, true, false); |
7374 | + __bdi_start_writeback(bdi, nr_pages, true); |
7375 | } |
7376 | |
7377 | /** |
7378 | @@ -152,13 +158,20 @@ void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages) |
7379 | * @bdi: the backing device to write from |
7380 | * |
7381 | * Description: |
7382 | - * This does WB_SYNC_NONE background writeback. The IO is only |
7383 | - * started when this function returns, we make no guarentees on |
7384 | - * completion. Caller need not hold sb s_umount semaphore. |
7385 | + * This makes sure WB_SYNC_NONE background writeback happens. When |
7386 | + * this function returns, it is only guaranteed that for given BDI |
7387 | + * some IO is happening if we are over background dirty threshold. |
7388 | + * Caller need not hold sb s_umount semaphore. |
7389 | */ |
7390 | void bdi_start_background_writeback(struct backing_dev_info *bdi) |
7391 | { |
7392 | - __bdi_start_writeback(bdi, LONG_MAX, true, true); |
7393 | + /* |
7394 | + * We just wake up the flusher thread. It will perform background |
7395 | + * writeback as soon as there is no other work to do. |
7396 | + */ |
7397 | + spin_lock_bh(&bdi->wb_lock); |
7398 | + bdi_wakeup_flusher(bdi); |
7399 | + spin_unlock_bh(&bdi->wb_lock); |
7400 | } |
7401 | |
7402 | /* |
7403 | @@ -616,6 +629,7 @@ static long wb_writeback(struct bdi_writeback *wb, |
7404 | }; |
7405 | unsigned long oldest_jif; |
7406 | long wrote = 0; |
7407 | + long write_chunk; |
7408 | struct inode *inode; |
7409 | |
7410 | if (wbc.for_kupdate) { |
7411 | @@ -628,6 +642,24 @@ static long wb_writeback(struct bdi_writeback *wb, |
7412 | wbc.range_end = LLONG_MAX; |
7413 | } |
7414 | |
7415 | + /* |
7416 | + * WB_SYNC_ALL mode does livelock avoidance by syncing dirty |
7417 | + * inodes/pages in one big loop. Setting wbc.nr_to_write=LONG_MAX |
7418 | + * here avoids calling into writeback_inodes_wb() more than once. |
7419 | + * |
7420 | + * The intended call sequence for WB_SYNC_ALL writeback is: |
7421 | + * |
7422 | + * wb_writeback() |
7423 | + * __writeback_inodes_sb() <== called only once |
7424 | + * write_cache_pages() <== called once for each inode |
7425 | + * (quickly) tag currently dirty pages |
7426 | + * (maybe slowly) sync all tagged pages |
7427 | + */ |
7428 | + if (wbc.sync_mode == WB_SYNC_NONE) |
7429 | + write_chunk = MAX_WRITEBACK_PAGES; |
7430 | + else |
7431 | + write_chunk = LONG_MAX; |
7432 | + |
7433 | wbc.wb_start = jiffies; /* livelock avoidance */ |
7434 | for (;;) { |
7435 | /* |
7436 | @@ -637,6 +669,16 @@ static long wb_writeback(struct bdi_writeback *wb, |
7437 | break; |
7438 | |
7439 | /* |
7440 | + * Background writeout and kupdate-style writeback may |
7441 | + * run forever. Stop them if there is other work to do |
7442 | + * so that e.g. sync can proceed. They'll be restarted |
7443 | + * after the other works are all done. |
7444 | + */ |
7445 | + if ((work->for_background || work->for_kupdate) && |
7446 | + !list_empty(&wb->bdi->work_list)) |
7447 | + break; |
7448 | + |
7449 | + /* |
7450 | * For background writeout, stop when we are below the |
7451 | * background dirty threshold |
7452 | */ |
7453 | @@ -644,7 +686,7 @@ static long wb_writeback(struct bdi_writeback *wb, |
7454 | break; |
7455 | |
7456 | wbc.more_io = 0; |
7457 | - wbc.nr_to_write = MAX_WRITEBACK_PAGES; |
7458 | + wbc.nr_to_write = write_chunk; |
7459 | wbc.pages_skipped = 0; |
7460 | |
7461 | trace_wbc_writeback_start(&wbc, wb->bdi); |
7462 | @@ -654,8 +696,8 @@ static long wb_writeback(struct bdi_writeback *wb, |
7463 | writeback_inodes_wb(wb, &wbc); |
7464 | trace_wbc_writeback_written(&wbc, wb->bdi); |
7465 | |
7466 | - work->nr_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; |
7467 | - wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write; |
7468 | + work->nr_pages -= write_chunk - wbc.nr_to_write; |
7469 | + wrote += write_chunk - wbc.nr_to_write; |
7470 | |
7471 | /* |
7472 | * If we consumed everything, see if we have more |
7473 | @@ -670,7 +712,7 @@ static long wb_writeback(struct bdi_writeback *wb, |
7474 | /* |
7475 | * Did we write something? Try for more |
7476 | */ |
7477 | - if (wbc.nr_to_write < MAX_WRITEBACK_PAGES) |
7478 | + if (wbc.nr_to_write < write_chunk) |
7479 | continue; |
7480 | /* |
7481 | * Nothing written. Wait for some inode to |
7482 | @@ -718,6 +760,23 @@ static unsigned long get_nr_dirty_pages(void) |
7483 | get_nr_dirty_inodes(); |
7484 | } |
7485 | |
7486 | +static long wb_check_background_flush(struct bdi_writeback *wb) |
7487 | +{ |
7488 | + if (over_bground_thresh()) { |
7489 | + |
7490 | + struct wb_writeback_work work = { |
7491 | + .nr_pages = LONG_MAX, |
7492 | + .sync_mode = WB_SYNC_NONE, |
7493 | + .for_background = 1, |
7494 | + .range_cyclic = 1, |
7495 | + }; |
7496 | + |
7497 | + return wb_writeback(wb, &work); |
7498 | + } |
7499 | + |
7500 | + return 0; |
7501 | +} |
7502 | + |
7503 | static long wb_check_old_data_flush(struct bdi_writeback *wb) |
7504 | { |
7505 | unsigned long expired; |
7506 | @@ -787,6 +846,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait) |
7507 | * Check for periodic writeback, kupdated() style |
7508 | */ |
7509 | wrote += wb_check_old_data_flush(wb); |
7510 | + wrote += wb_check_background_flush(wb); |
7511 | clear_bit(BDI_writeback_running, &wb->bdi->state); |
7512 | |
7513 | return wrote; |
7514 | @@ -873,7 +933,7 @@ void wakeup_flusher_threads(long nr_pages) |
7515 | list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) { |
7516 | if (!bdi_has_dirty_io(bdi)) |
7517 | continue; |
7518 | - __bdi_start_writeback(bdi, nr_pages, false, false); |
7519 | + __bdi_start_writeback(bdi, nr_pages, false); |
7520 | } |
7521 | rcu_read_unlock(); |
7522 | } |
7523 | diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c |
7524 | index 1fd62fc..78df330 100644 |
7525 | --- a/fs/nfs/delegation.c |
7526 | +++ b/fs/nfs/delegation.c |
7527 | @@ -23,8 +23,6 @@ |
7528 | |
7529 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) |
7530 | { |
7531 | - if (delegation->cred) |
7532 | - put_rpccred(delegation->cred); |
7533 | kfree(delegation); |
7534 | } |
7535 | |
7536 | @@ -37,6 +35,10 @@ static void nfs_free_delegation_callback(struct rcu_head *head) |
7537 | |
7538 | static void nfs_free_delegation(struct nfs_delegation *delegation) |
7539 | { |
7540 | + if (delegation->cred) { |
7541 | + put_rpccred(delegation->cred); |
7542 | + delegation->cred = NULL; |
7543 | + } |
7544 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); |
7545 | } |
7546 | |
7547 | diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
7548 | index 996dd89..bd80b38 100644 |
7549 | --- a/fs/nfs/dir.c |
7550 | +++ b/fs/nfs/dir.c |
7551 | @@ -33,7 +33,6 @@ |
7552 | #include <linux/namei.h> |
7553 | #include <linux/mount.h> |
7554 | #include <linux/sched.h> |
7555 | -#include <linux/vmalloc.h> |
7556 | #include <linux/kmemleak.h> |
7557 | |
7558 | #include "delegation.h" |
7559 | @@ -459,25 +458,26 @@ out: |
7560 | /* Perform conversion from xdr to cache array */ |
7561 | static |
7562 | int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, |
7563 | - void *xdr_page, struct page *page, unsigned int buflen) |
7564 | + struct page **xdr_pages, struct page *page, unsigned int buflen) |
7565 | { |
7566 | struct xdr_stream stream; |
7567 | - struct xdr_buf buf; |
7568 | - __be32 *ptr = xdr_page; |
7569 | + struct xdr_buf buf = { |
7570 | + .pages = xdr_pages, |
7571 | + .page_len = buflen, |
7572 | + .buflen = buflen, |
7573 | + .len = buflen, |
7574 | + }; |
7575 | + struct page *scratch; |
7576 | struct nfs_cache_array *array; |
7577 | unsigned int count = 0; |
7578 | int status; |
7579 | |
7580 | - buf.head->iov_base = xdr_page; |
7581 | - buf.head->iov_len = buflen; |
7582 | - buf.tail->iov_len = 0; |
7583 | - buf.page_base = 0; |
7584 | - buf.page_len = 0; |
7585 | - buf.buflen = buf.head->iov_len; |
7586 | - buf.len = buf.head->iov_len; |
7587 | - |
7588 | - xdr_init_decode(&stream, &buf, ptr); |
7589 | + scratch = alloc_page(GFP_KERNEL); |
7590 | + if (scratch == NULL) |
7591 | + return -ENOMEM; |
7592 | |
7593 | + xdr_init_decode(&stream, &buf, NULL); |
7594 | + xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); |
7595 | |
7596 | do { |
7597 | status = xdr_decode(desc, entry, &stream); |
7598 | @@ -506,6 +506,8 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en |
7599 | } else |
7600 | status = PTR_ERR(array); |
7601 | } |
7602 | + |
7603 | + put_page(scratch); |
7604 | return status; |
7605 | } |
7606 | |
7607 | @@ -521,7 +523,6 @@ static |
7608 | void nfs_readdir_free_large_page(void *ptr, struct page **pages, |
7609 | unsigned int npages) |
7610 | { |
7611 | - vm_unmap_ram(ptr, npages); |
7612 | nfs_readdir_free_pagearray(pages, npages); |
7613 | } |
7614 | |
7615 | @@ -530,9 +531,8 @@ void nfs_readdir_free_large_page(void *ptr, struct page **pages, |
7616 | * to nfs_readdir_free_large_page |
7617 | */ |
7618 | static |
7619 | -void *nfs_readdir_large_page(struct page **pages, unsigned int npages) |
7620 | +int nfs_readdir_large_page(struct page **pages, unsigned int npages) |
7621 | { |
7622 | - void *ptr; |
7623 | unsigned int i; |
7624 | |
7625 | for (i = 0; i < npages; i++) { |
7626 | @@ -541,13 +541,11 @@ void *nfs_readdir_large_page(struct page **pages, unsigned int npages) |
7627 | goto out_freepages; |
7628 | pages[i] = page; |
7629 | } |
7630 | + return 0; |
7631 | |
7632 | - ptr = vm_map_ram(pages, npages, 0, PAGE_KERNEL); |
7633 | - if (!IS_ERR_OR_NULL(ptr)) |
7634 | - return ptr; |
7635 | out_freepages: |
7636 | nfs_readdir_free_pagearray(pages, i); |
7637 | - return NULL; |
7638 | + return -ENOMEM; |
7639 | } |
7640 | |
7641 | static |
7642 | @@ -577,8 +575,8 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, |
7643 | memset(array, 0, sizeof(struct nfs_cache_array)); |
7644 | array->eof_index = -1; |
7645 | |
7646 | - pages_ptr = nfs_readdir_large_page(pages, array_size); |
7647 | - if (!pages_ptr) |
7648 | + status = nfs_readdir_large_page(pages, array_size); |
7649 | + if (status < 0) |
7650 | goto out_release_array; |
7651 | do { |
7652 | unsigned int pglen; |
7653 | @@ -587,7 +585,7 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, |
7654 | if (status < 0) |
7655 | break; |
7656 | pglen = status; |
7657 | - status = nfs_readdir_page_filler(desc, &entry, pages_ptr, page, pglen); |
7658 | + status = nfs_readdir_page_filler(desc, &entry, pages, page, pglen); |
7659 | if (status < 0) { |
7660 | if (status == -ENOSPC) |
7661 | status = 0; |
7662 | @@ -1579,6 +1577,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, |
7663 | { |
7664 | struct iattr attr; |
7665 | int error; |
7666 | + int open_flags = 0; |
7667 | |
7668 | dfprintk(VFS, "NFS: create(%s/%ld), %s\n", |
7669 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); |
7670 | @@ -1586,7 +1585,10 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, |
7671 | attr.ia_mode = mode; |
7672 | attr.ia_valid = ATTR_MODE; |
7673 | |
7674 | - error = NFS_PROTO(dir)->create(dir, dentry, &attr, 0, NULL); |
7675 | + if ((nd->flags & LOOKUP_CREATE) != 0) |
7676 | + open_flags = nd->intent.open.flags; |
7677 | + |
7678 | + error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, NULL); |
7679 | if (error != 0) |
7680 | goto out_err; |
7681 | return 0; |
7682 | diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c |
7683 | index e6ace0d..9943a75 100644 |
7684 | --- a/fs/nfs/direct.c |
7685 | +++ b/fs/nfs/direct.c |
7686 | @@ -407,15 +407,18 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, |
7687 | pos += vec->iov_len; |
7688 | } |
7689 | |
7690 | + /* |
7691 | + * If no bytes were started, return the error, and let the |
7692 | + * generic layer handle the completion. |
7693 | + */ |
7694 | + if (requested_bytes == 0) { |
7695 | + nfs_direct_req_release(dreq); |
7696 | + return result < 0 ? result : -EIO; |
7697 | + } |
7698 | + |
7699 | if (put_dreq(dreq)) |
7700 | nfs_direct_complete(dreq); |
7701 | - |
7702 | - if (requested_bytes != 0) |
7703 | - return 0; |
7704 | - |
7705 | - if (result < 0) |
7706 | - return result; |
7707 | - return -EIO; |
7708 | + return 0; |
7709 | } |
7710 | |
7711 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, |
7712 | @@ -841,15 +844,18 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, |
7713 | pos += vec->iov_len; |
7714 | } |
7715 | |
7716 | + /* |
7717 | + * If no bytes were started, return the error, and let the |
7718 | + * generic layer handle the completion. |
7719 | + */ |
7720 | + if (requested_bytes == 0) { |
7721 | + nfs_direct_req_release(dreq); |
7722 | + return result < 0 ? result : -EIO; |
7723 | + } |
7724 | + |
7725 | if (put_dreq(dreq)) |
7726 | nfs_direct_write_complete(dreq, dreq->inode); |
7727 | - |
7728 | - if (requested_bytes != 0) |
7729 | - return 0; |
7730 | - |
7731 | - if (result < 0) |
7732 | - return result; |
7733 | - return -EIO; |
7734 | + return 0; |
7735 | } |
7736 | |
7737 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, |
7738 | diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c |
7739 | index 5914a19..b382a1b 100644 |
7740 | --- a/fs/nfs/nfs2xdr.c |
7741 | +++ b/fs/nfs/nfs2xdr.c |
7742 | @@ -487,12 +487,6 @@ nfs_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, struct nfs_se |
7743 | |
7744 | entry->d_type = DT_UNKNOWN; |
7745 | |
7746 | - p = xdr_inline_peek(xdr, 8); |
7747 | - if (p != NULL) |
7748 | - entry->eof = !p[0] && p[1]; |
7749 | - else |
7750 | - entry->eof = 0; |
7751 | - |
7752 | return p; |
7753 | |
7754 | out_overflow: |
7755 | diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c |
7756 | index f6cc60f..ba91236 100644 |
7757 | --- a/fs/nfs/nfs3xdr.c |
7758 | +++ b/fs/nfs/nfs3xdr.c |
7759 | @@ -647,12 +647,6 @@ nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, struct nfs_s |
7760 | memset((u8*)(entry->fh), 0, sizeof(*entry->fh)); |
7761 | } |
7762 | |
7763 | - p = xdr_inline_peek(xdr, 8); |
7764 | - if (p != NULL) |
7765 | - entry->eof = !p[0] && p[1]; |
7766 | - else |
7767 | - entry->eof = 0; |
7768 | - |
7769 | return p; |
7770 | |
7771 | out_overflow: |
7772 | diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c |
7773 | index 9f1826b..0662a98 100644 |
7774 | --- a/fs/nfs/nfs4xdr.c |
7775 | +++ b/fs/nfs/nfs4xdr.c |
7776 | @@ -6215,12 +6215,6 @@ __be32 *nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
7777 | if (verify_attr_len(xdr, p, len) < 0) |
7778 | goto out_overflow; |
7779 | |
7780 | - p = xdr_inline_peek(xdr, 8); |
7781 | - if (p != NULL) |
7782 | - entry->eof = !p[0] && p[1]; |
7783 | - else |
7784 | - entry->eof = 0; |
7785 | - |
7786 | return p; |
7787 | |
7788 | out_overflow: |
7789 | diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c |
7790 | index f0695e8..844960f 100644 |
7791 | --- a/fs/nfsd/nfs4idmap.c |
7792 | +++ b/fs/nfsd/nfs4idmap.c |
7793 | @@ -524,13 +524,13 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen |
7794 | int ret; |
7795 | |
7796 | if (namelen + 1 > sizeof(key.name)) |
7797 | - return -EINVAL; |
7798 | + return -ESRCH; /* nfserr_badowner */ |
7799 | memcpy(key.name, name, namelen); |
7800 | key.name[namelen] = '\0'; |
7801 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); |
7802 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); |
7803 | if (ret == -ENOENT) |
7804 | - ret = -ESRCH; /* nfserr_badname */ |
7805 | + ret = -ESRCH; /* nfserr_badowner */ |
7806 | if (ret) |
7807 | return ret; |
7808 | *id = item->id; |
7809 | diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h |
7810 | index 6b641cf..7ecfa24 100644 |
7811 | --- a/fs/nfsd/nfsd.h |
7812 | +++ b/fs/nfsd/nfsd.h |
7813 | @@ -158,6 +158,7 @@ void nfsd_lockd_shutdown(void); |
7814 | #define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP) |
7815 | #define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR) |
7816 | #define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE) |
7817 | +#define nfserr_badowner cpu_to_be32(NFSERR_BADOWNER) |
7818 | #define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD) |
7819 | #define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL) |
7820 | #define nfserr_grace cpu_to_be32(NFSERR_GRACE) |
7821 | diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c |
7822 | index 08e1726..f0c2f23 100644 |
7823 | --- a/fs/nfsd/nfsproc.c |
7824 | +++ b/fs/nfsd/nfsproc.c |
7825 | @@ -737,7 +737,7 @@ nfserrno (int errno) |
7826 | { nfserr_jukebox, -ERESTARTSYS }, |
7827 | { nfserr_dropit, -EAGAIN }, |
7828 | { nfserr_dropit, -ENOMEM }, |
7829 | - { nfserr_badname, -ESRCH }, |
7830 | + { nfserr_badowner, -ESRCH }, |
7831 | { nfserr_io, -ETXTBSY }, |
7832 | { nfserr_notsupp, -EOPNOTSUPP }, |
7833 | { nfserr_toosmall, -ETOOSMALL }, |
7834 | diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c |
7835 | index f804d41..2940a58 100644 |
7836 | --- a/fs/nilfs2/super.c |
7837 | +++ b/fs/nilfs2/super.c |
7838 | @@ -688,7 +688,8 @@ skip_mount_setup: |
7839 | sbp[0]->s_state = |
7840 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); |
7841 | /* synchronize sbp[1] with sbp[0] */ |
7842 | - memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); |
7843 | + if (sbp[1]) |
7844 | + memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); |
7845 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); |
7846 | } |
7847 | |
7848 | diff --git a/fs/partitions/check.c b/fs/partitions/check.c |
7849 | index 0a8b0ad..0123717 100644 |
7850 | --- a/fs/partitions/check.c |
7851 | +++ b/fs/partitions/check.c |
7852 | @@ -372,6 +372,13 @@ static void delete_partition_rcu_cb(struct rcu_head *head) |
7853 | put_device(part_to_dev(part)); |
7854 | } |
7855 | |
7856 | +void __delete_partition(struct kref *ref) |
7857 | +{ |
7858 | + struct hd_struct *part = container_of(ref, struct hd_struct, ref); |
7859 | + |
7860 | + call_rcu(&part->rcu_head, delete_partition_rcu_cb); |
7861 | +} |
7862 | + |
7863 | void delete_partition(struct gendisk *disk, int partno) |
7864 | { |
7865 | struct disk_part_tbl *ptbl = disk->part_tbl; |
7866 | @@ -390,7 +397,7 @@ void delete_partition(struct gendisk *disk, int partno) |
7867 | kobject_put(part->holder_dir); |
7868 | device_del(part_to_dev(part)); |
7869 | |
7870 | - call_rcu(&part->rcu_head, delete_partition_rcu_cb); |
7871 | + kref_put(&part->ref, __delete_partition); |
7872 | } |
7873 | |
7874 | static ssize_t whole_disk_show(struct device *dev, |
7875 | @@ -489,6 +496,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, |
7876 | if (!dev_get_uevent_suppress(ddev)) |
7877 | kobject_uevent(&pdev->kobj, KOBJ_ADD); |
7878 | |
7879 | + kref_init(&p->ref); |
7880 | return p; |
7881 | |
7882 | out_free_info: |
7883 | diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c |
7884 | index 6f37c39..d245cb2 100644 |
7885 | --- a/fs/proc/kcore.c |
7886 | +++ b/fs/proc/kcore.c |
7887 | @@ -558,7 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp) |
7888 | static const struct file_operations proc_kcore_operations = { |
7889 | .read = read_kcore, |
7890 | .open = open_kcore, |
7891 | - .llseek = generic_file_llseek, |
7892 | + .llseek = default_llseek, |
7893 | }; |
7894 | |
7895 | #ifdef CONFIG_MEMORY_HOTPLUG |
7896 | diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h |
7897 | index 883c1d4..40b1f0e 100644 |
7898 | --- a/include/drm/drm_pciids.h |
7899 | +++ b/include/drm/drm_pciids.h |
7900 | @@ -28,7 +28,6 @@ |
7901 | {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ |
7902 | {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \ |
7903 | {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ |
7904 | - {0x1002, 0x4243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ |
7905 | {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
7906 | {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
7907 | {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
7908 | diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h |
7909 | index 36ab42c..7572b19 100644 |
7910 | --- a/include/linux/blkdev.h |
7911 | +++ b/include/linux/blkdev.h |
7912 | @@ -115,6 +115,7 @@ struct request { |
7913 | void *elevator_private3; |
7914 | |
7915 | struct gendisk *rq_disk; |
7916 | + struct hd_struct *part; |
7917 | unsigned long start_time; |
7918 | #ifdef CONFIG_BLK_CGROUP |
7919 | unsigned long long start_time_ns; |
7920 | diff --git a/include/linux/completion.h b/include/linux/completion.h |
7921 | index 36d57f7..51494e6 100644 |
7922 | --- a/include/linux/completion.h |
7923 | +++ b/include/linux/completion.h |
7924 | @@ -81,10 +81,10 @@ extern int wait_for_completion_interruptible(struct completion *x); |
7925 | extern int wait_for_completion_killable(struct completion *x); |
7926 | extern unsigned long wait_for_completion_timeout(struct completion *x, |
7927 | unsigned long timeout); |
7928 | -extern unsigned long wait_for_completion_interruptible_timeout( |
7929 | - struct completion *x, unsigned long timeout); |
7930 | -extern unsigned long wait_for_completion_killable_timeout( |
7931 | - struct completion *x, unsigned long timeout); |
7932 | +extern long wait_for_completion_interruptible_timeout( |
7933 | + struct completion *x, unsigned long timeout); |
7934 | +extern long wait_for_completion_killable_timeout( |
7935 | + struct completion *x, unsigned long timeout); |
7936 | extern bool try_wait_for_completion(struct completion *x); |
7937 | extern bool completion_done(struct completion *x); |
7938 | |
7939 | diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h |
7940 | index a90b389..1c70028 100644 |
7941 | --- a/include/linux/dynamic_debug.h |
7942 | +++ b/include/linux/dynamic_debug.h |
7943 | @@ -44,34 +44,24 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, |
7944 | extern int ddebug_remove_module(const char *mod_name); |
7945 | |
7946 | #define dynamic_pr_debug(fmt, ...) do { \ |
7947 | - __label__ do_printk; \ |
7948 | - __label__ out; \ |
7949 | static struct _ddebug descriptor \ |
7950 | __used \ |
7951 | __attribute__((section("__verbose"), aligned(8))) = \ |
7952 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ |
7953 | _DPRINTK_FLAGS_DEFAULT }; \ |
7954 | - JUMP_LABEL(&descriptor.enabled, do_printk); \ |
7955 | - goto out; \ |
7956 | -do_printk: \ |
7957 | - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ |
7958 | -out: ; \ |
7959 | + if (unlikely(descriptor.enabled)) \ |
7960 | + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ |
7961 | } while (0) |
7962 | |
7963 | |
7964 | #define dynamic_dev_dbg(dev, fmt, ...) do { \ |
7965 | - __label__ do_printk; \ |
7966 | - __label__ out; \ |
7967 | static struct _ddebug descriptor \ |
7968 | __used \ |
7969 | __attribute__((section("__verbose"), aligned(8))) = \ |
7970 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ |
7971 | _DPRINTK_FLAGS_DEFAULT }; \ |
7972 | - JUMP_LABEL(&descriptor.enabled, do_printk); \ |
7973 | - goto out; \ |
7974 | -do_printk: \ |
7975 | - dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ |
7976 | -out: ; \ |
7977 | + if (unlikely(descriptor.enabled)) \ |
7978 | + dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ |
7979 | } while (0) |
7980 | |
7981 | #else |
7982 | diff --git a/include/linux/genhd.h b/include/linux/genhd.h |
7983 | index 7a7b9c1..2ba2792 100644 |
7984 | --- a/include/linux/genhd.h |
7985 | +++ b/include/linux/genhd.h |
7986 | @@ -116,6 +116,7 @@ struct hd_struct { |
7987 | struct disk_stats dkstats; |
7988 | #endif |
7989 | struct rcu_head rcu_head; |
7990 | + struct kref ref; |
7991 | }; |
7992 | |
7993 | #define GENHD_FL_REMOVABLE 1 |
7994 | @@ -583,6 +584,7 @@ extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
7995 | sector_t len, int flags, |
7996 | struct partition_meta_info |
7997 | *info); |
7998 | +extern void __delete_partition(struct kref *ref); |
7999 | extern void delete_partition(struct gendisk *, int); |
8000 | extern void printk_all_partitions(void); |
8001 | |
8002 | diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h |
8003 | index ed5a03c..1c2138d 100644 |
8004 | --- a/include/linux/ieee80211.h |
8005 | +++ b/include/linux/ieee80211.h |
8006 | @@ -959,7 +959,7 @@ struct ieee80211_ht_info { |
8007 | /* block-ack parameters */ |
8008 | #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 |
8009 | #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C |
8010 | -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 |
8011 | +#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 |
8012 | #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 |
8013 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 |
8014 | |
8015 | diff --git a/include/linux/klist.h b/include/linux/klist.h |
8016 | index e91a4e5..a370ce5 100644 |
8017 | --- a/include/linux/klist.h |
8018 | +++ b/include/linux/klist.h |
8019 | @@ -22,7 +22,7 @@ struct klist { |
8020 | struct list_head k_list; |
8021 | void (*get)(struct klist_node *); |
8022 | void (*put)(struct klist_node *); |
8023 | -} __attribute__ ((aligned (4))); |
8024 | +} __attribute__ ((aligned (sizeof(void *)))); |
8025 | |
8026 | #define KLIST_INIT(_name, _get, _put) \ |
8027 | { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ |
8028 | diff --git a/include/linux/kref.h b/include/linux/kref.h |
8029 | index 6cc38fc..90b9e44 100644 |
8030 | --- a/include/linux/kref.h |
8031 | +++ b/include/linux/kref.h |
8032 | @@ -23,6 +23,7 @@ struct kref { |
8033 | |
8034 | void kref_init(struct kref *kref); |
8035 | void kref_get(struct kref *kref); |
8036 | +int kref_test_and_get(struct kref *kref); |
8037 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); |
8038 | |
8039 | #endif /* _KREF_H_ */ |
8040 | diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h |
8041 | index 71c09b2..9f19430 100644 |
8042 | --- a/include/linux/lockdep.h |
8043 | +++ b/include/linux/lockdep.h |
8044 | @@ -522,12 +522,15 @@ static inline void print_irqtrace_events(struct task_struct *curr) |
8045 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
8046 | # ifdef CONFIG_PROVE_LOCKING |
8047 | # define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_) |
8048 | +# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_) |
8049 | # else |
8050 | # define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_) |
8051 | +# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_) |
8052 | # endif |
8053 | # define lock_map_release(l) lock_release(l, 1, _THIS_IP_) |
8054 | #else |
8055 | # define lock_map_acquire(l) do { } while (0) |
8056 | +# define lock_map_acquire_read(l) do { } while (0) |
8057 | # define lock_map_release(l) do { } while (0) |
8058 | #endif |
8059 | |
8060 | diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h |
8061 | index 31c237a..12b9eb5 100644 |
8062 | --- a/include/linux/memory_hotplug.h |
8063 | +++ b/include/linux/memory_hotplug.h |
8064 | @@ -161,6 +161,12 @@ extern void register_page_bootmem_info_node(struct pglist_data *pgdat); |
8065 | extern void put_page_bootmem(struct page *page); |
8066 | #endif |
8067 | |
8068 | +/* |
8069 | + * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug |
8070 | + * notifier will be called under this. 2) offline/online/add/remove memory |
8071 | + * will not run simultaneously. |
8072 | + */ |
8073 | + |
8074 | void lock_memory_hotplug(void); |
8075 | void unlock_memory_hotplug(void); |
8076 | |
8077 | diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h |
8078 | index 39c24eb..4890662 100644 |
8079 | --- a/include/linux/mmzone.h |
8080 | +++ b/include/linux/mmzone.h |
8081 | @@ -458,12 +458,6 @@ static inline int zone_is_oom_locked(const struct zone *zone) |
8082 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); |
8083 | } |
8084 | |
8085 | -#ifdef CONFIG_SMP |
8086 | -unsigned long zone_nr_free_pages(struct zone *zone); |
8087 | -#else |
8088 | -#define zone_nr_free_pages(zone) zone_page_state(zone, NR_FREE_PAGES) |
8089 | -#endif /* CONFIG_SMP */ |
8090 | - |
8091 | /* |
8092 | * The "priority" of VM scanning is how much of the queues we will scan in one |
8093 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the |
8094 | @@ -661,7 +655,9 @@ typedef struct pglist_data { |
8095 | extern struct mutex zonelists_mutex; |
8096 | void build_all_zonelists(void *data); |
8097 | void wakeup_kswapd(struct zone *zone, int order); |
8098 | -int zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
8099 | +bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
8100 | + int classzone_idx, int alloc_flags); |
8101 | +bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, |
8102 | int classzone_idx, int alloc_flags); |
8103 | enum memmap_context { |
8104 | MEMMAP_EARLY, |
8105 | diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h |
8106 | index 0edb256..fb877b5 100644 |
8107 | --- a/include/linux/nl80211.h |
8108 | +++ b/include/linux/nl80211.h |
8109 | @@ -1307,7 +1307,11 @@ enum nl80211_bitrate_attr { |
8110 | * wireless core it thinks its knows the regulatory domain we should be in. |
8111 | * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an |
8112 | * 802.11 country information element with regulatory information it |
8113 | - * thinks we should consider. |
8114 | + * thinks we should consider. cfg80211 only processes the country |
8115 | + * code from the IE, and relies on the regulatory domain information |
8116 | + * structure pased by userspace (CRDA) from our wireless-regdb. |
8117 | + * If a channel is enabled but the country code indicates it should |
8118 | + * be disabled we disable the channel and re-enable it upon disassociation. |
8119 | */ |
8120 | enum nl80211_reg_initiator { |
8121 | NL80211_REGDOM_SET_BY_CORE, |
8122 | diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h |
8123 | index 32fb812..1ca6411 100644 |
8124 | --- a/include/linux/oprofile.h |
8125 | +++ b/include/linux/oprofile.h |
8126 | @@ -16,6 +16,8 @@ |
8127 | #include <linux/types.h> |
8128 | #include <linux/spinlock.h> |
8129 | #include <linux/init.h> |
8130 | +#include <linux/errno.h> |
8131 | +#include <linux/printk.h> |
8132 | #include <asm/atomic.h> |
8133 | |
8134 | /* Each escaped entry is prefixed by ESCAPE_CODE |
8135 | @@ -186,10 +188,17 @@ int oprofile_add_data(struct op_entry *entry, unsigned long val); |
8136 | int oprofile_add_data64(struct op_entry *entry, u64 val); |
8137 | int oprofile_write_commit(struct op_entry *entry); |
8138 | |
8139 | -#ifdef CONFIG_PERF_EVENTS |
8140 | +#ifdef CONFIG_HW_PERF_EVENTS |
8141 | int __init oprofile_perf_init(struct oprofile_operations *ops); |
8142 | void oprofile_perf_exit(void); |
8143 | char *op_name_from_perf_id(void); |
8144 | -#endif /* CONFIG_PERF_EVENTS */ |
8145 | +#else |
8146 | +static inline int __init oprofile_perf_init(struct oprofile_operations *ops) |
8147 | +{ |
8148 | + pr_info("oprofile: hardware counters not available\n"); |
8149 | + return -ENODEV; |
8150 | +} |
8151 | +static inline void oprofile_perf_exit(void) { } |
8152 | +#endif /* CONFIG_HW_PERF_EVENTS */ |
8153 | |
8154 | #endif /* OPROFILE_H */ |
8155 | diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h |
8156 | index ab2baa5..23241c2 100644 |
8157 | --- a/include/linux/radix-tree.h |
8158 | +++ b/include/linux/radix-tree.h |
8159 | @@ -146,6 +146,22 @@ static inline void *radix_tree_deref_slot(void **pslot) |
8160 | } |
8161 | |
8162 | /** |
8163 | + * radix_tree_deref_slot_protected - dereference a slot without RCU lock but with tree lock held |
8164 | + * @pslot: pointer to slot, returned by radix_tree_lookup_slot |
8165 | + * Returns: item that was stored in that slot with any direct pointer flag |
8166 | + * removed. |
8167 | + * |
8168 | + * Similar to radix_tree_deref_slot but only used during migration when a pages |
8169 | + * mapping is being moved. The caller does not hold the RCU read lock but it |
8170 | + * must hold the tree lock to prevent parallel updates. |
8171 | + */ |
8172 | +static inline void *radix_tree_deref_slot_protected(void **pslot, |
8173 | + spinlock_t *treelock) |
8174 | +{ |
8175 | + return rcu_dereference_protected(*pslot, lockdep_is_held(treelock)); |
8176 | +} |
8177 | + |
8178 | +/** |
8179 | * radix_tree_deref_retry - check radix_tree_deref_slot |
8180 | * @arg: pointer returned by radix_tree_deref_slot |
8181 | * Returns: 0 if retry is not required, otherwise retry is required |
8182 | diff --git a/include/linux/security.h b/include/linux/security.h |
8183 | index fd4d55f..d47a4c2 100644 |
8184 | --- a/include/linux/security.h |
8185 | +++ b/include/linux/security.h |
8186 | @@ -796,8 +796,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) |
8187 | * @unix_stream_connect: |
8188 | * Check permissions before establishing a Unix domain stream connection |
8189 | * between @sock and @other. |
8190 | - * @sock contains the socket structure. |
8191 | - * @other contains the peer socket structure. |
8192 | + * @sock contains the sock structure. |
8193 | + * @other contains the peer sock structure. |
8194 | + * @newsk contains the new sock structure. |
8195 | * Return 0 if permission is granted. |
8196 | * @unix_may_send: |
8197 | * Check permissions before connecting or sending datagrams from @sock to |
8198 | @@ -1568,8 +1569,7 @@ struct security_operations { |
8199 | int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); |
8200 | |
8201 | #ifdef CONFIG_SECURITY_NETWORK |
8202 | - int (*unix_stream_connect) (struct socket *sock, |
8203 | - struct socket *other, struct sock *newsk); |
8204 | + int (*unix_stream_connect) (struct sock *sock, struct sock *other, struct sock *newsk); |
8205 | int (*unix_may_send) (struct socket *sock, struct socket *other); |
8206 | |
8207 | int (*socket_create) (int family, int type, int protocol, int kern); |
8208 | @@ -2525,8 +2525,7 @@ static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 |
8209 | |
8210 | #ifdef CONFIG_SECURITY_NETWORK |
8211 | |
8212 | -int security_unix_stream_connect(struct socket *sock, struct socket *other, |
8213 | - struct sock *newsk); |
8214 | +int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk); |
8215 | int security_unix_may_send(struct socket *sock, struct socket *other); |
8216 | int security_socket_create(int family, int type, int protocol, int kern); |
8217 | int security_socket_post_create(struct socket *sock, int family, |
8218 | @@ -2567,8 +2566,8 @@ void security_tun_dev_post_create(struct sock *sk); |
8219 | int security_tun_dev_attach(struct sock *sk); |
8220 | |
8221 | #else /* CONFIG_SECURITY_NETWORK */ |
8222 | -static inline int security_unix_stream_connect(struct socket *sock, |
8223 | - struct socket *other, |
8224 | +static inline int security_unix_stream_connect(struct sock *sock, |
8225 | + struct sock *other, |
8226 | struct sock *newsk) |
8227 | { |
8228 | return 0; |
8229 | diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h |
8230 | index 498ab93..7783c68 100644 |
8231 | --- a/include/linux/sunrpc/xdr.h |
8232 | +++ b/include/linux/sunrpc/xdr.h |
8233 | @@ -201,6 +201,8 @@ struct xdr_stream { |
8234 | |
8235 | __be32 *end; /* end of available buffer space */ |
8236 | struct kvec *iov; /* pointer to the current kvec */ |
8237 | + struct kvec scratch; /* Scratch buffer */ |
8238 | + struct page **page_ptr; /* pointer to the current page */ |
8239 | }; |
8240 | |
8241 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); |
8242 | @@ -208,7 +210,7 @@ extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); |
8243 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, |
8244 | unsigned int base, unsigned int len); |
8245 | extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); |
8246 | -extern __be32 *xdr_inline_peek(struct xdr_stream *xdr, size_t nbytes); |
8247 | +extern void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen); |
8248 | extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); |
8249 | extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); |
8250 | extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); |
8251 | diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h |
8252 | index 387fa7d..7faf933 100644 |
8253 | --- a/include/linux/sysrq.h |
8254 | +++ b/include/linux/sysrq.h |
8255 | @@ -17,6 +17,9 @@ |
8256 | #include <linux/errno.h> |
8257 | #include <linux/types.h> |
8258 | |
8259 | +/* Enable/disable SYSRQ support by default (0==no, 1==yes). */ |
8260 | +#define SYSRQ_DEFAULT_ENABLE 1 |
8261 | + |
8262 | /* Possible values of bitmask for enabling sysrq functions */ |
8263 | /* 0x0001 is reserved for enable everything */ |
8264 | #define SYSRQ_ENABLE_LOG 0x0002 |
8265 | diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h |
8266 | index 0b6e751..6c37d78 100644 |
8267 | --- a/include/linux/usb/hcd.h |
8268 | +++ b/include/linux/usb/hcd.h |
8269 | @@ -112,6 +112,7 @@ struct usb_hcd { |
8270 | /* Flags that get set only during HCD registration or removal. */ |
8271 | unsigned rh_registered:1;/* is root hub registered? */ |
8272 | unsigned rh_pollable:1; /* may we poll the root hub? */ |
8273 | + unsigned msix_enabled:1; /* driver has MSI-X enabled? */ |
8274 | |
8275 | /* The next flag is a stopgap, to be removed when all the HCDs |
8276 | * support the new root-hub polling mechanism. */ |
8277 | diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h |
8278 | index 16d682f..c904913 100644 |
8279 | --- a/include/linux/usb/serial.h |
8280 | +++ b/include/linux/usb/serial.h |
8281 | @@ -347,6 +347,9 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, |
8282 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, |
8283 | unsigned int ch); |
8284 | extern int usb_serial_handle_break(struct usb_serial_port *port); |
8285 | +extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, |
8286 | + struct tty_struct *tty, |
8287 | + unsigned int status); |
8288 | |
8289 | |
8290 | extern int usb_serial_bus_register(struct usb_serial_driver *device); |
8291 | diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h |
8292 | index eaaea37..e4cc21c 100644 |
8293 | --- a/include/linux/vmstat.h |
8294 | +++ b/include/linux/vmstat.h |
8295 | @@ -254,6 +254,8 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item); |
8296 | extern void __dec_zone_state(struct zone *, enum zone_stat_item); |
8297 | |
8298 | void refresh_cpu_vm_stats(int); |
8299 | +void reduce_pgdat_percpu_threshold(pg_data_t *pgdat); |
8300 | +void restore_pgdat_percpu_threshold(pg_data_t *pgdat); |
8301 | #else /* CONFIG_SMP */ |
8302 | |
8303 | /* |
8304 | @@ -298,6 +300,9 @@ static inline void __dec_zone_page_state(struct page *page, |
8305 | #define dec_zone_page_state __dec_zone_page_state |
8306 | #define mod_zone_page_state __mod_zone_page_state |
8307 | |
8308 | +static inline void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) { } |
8309 | +static inline void restore_pgdat_percpu_threshold(pg_data_t *pgdat) { } |
8310 | + |
8311 | static inline void refresh_cpu_vm_stats(int cpu) { } |
8312 | #endif |
8313 | |
8314 | diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
8315 | index 97b8b7c..772dea2 100644 |
8316 | --- a/include/net/cfg80211.h |
8317 | +++ b/include/net/cfg80211.h |
8318 | @@ -1321,13 +1321,14 @@ struct cfg80211_ops { |
8319 | * initiator is %REGDOM_SET_BY_CORE). |
8320 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will |
8321 | * ignore regulatory domain settings until it gets its own regulatory |
8322 | - * domain via its regulatory_hint(). After its gets its own regulatory |
8323 | - * domain it will only allow further regulatory domain settings to |
8324 | - * further enhance compliance. For example if channel 13 and 14 are |
8325 | - * disabled by this regulatory domain no user regulatory domain can |
8326 | - * enable these channels at a later time. This can be used for devices |
8327 | - * which do not have calibration information gauranteed for frequencies |
8328 | - * or settings outside of its regulatory domain. |
8329 | + * domain via its regulatory_hint() unless the regulatory hint is |
8330 | + * from a country IE. After its gets its own regulatory domain it will |
8331 | + * only allow further regulatory domain settings to further enhance |
8332 | + * compliance. For example if channel 13 and 14 are disabled by this |
8333 | + * regulatory domain no user regulatory domain can enable these channels |
8334 | + * at a later time. This can be used for devices which do not have |
8335 | + * calibration information guaranteed for frequencies or settings |
8336 | + * outside of its regulatory domain. |
8337 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure |
8338 | * that passive scan flags and beaconing flags may not be lifted by |
8339 | * cfg80211 due to regulatory beacon hints. For more information on beacon |
8340 | diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h |
8341 | index 216af85..1933e3c 100644 |
8342 | --- a/include/scsi/scsi.h |
8343 | +++ b/include/scsi/scsi.h |
8344 | @@ -9,6 +9,7 @@ |
8345 | #define _SCSI_SCSI_H |
8346 | |
8347 | #include <linux/types.h> |
8348 | +#include <linux/scatterlist.h> |
8349 | |
8350 | struct scsi_cmnd; |
8351 | |
8352 | diff --git a/init/calibrate.c b/init/calibrate.c |
8353 | index 6eb48e5..24fe022 100644 |
8354 | --- a/init/calibrate.c |
8355 | +++ b/init/calibrate.c |
8356 | @@ -66,7 +66,7 @@ static unsigned long __cpuinit calibrate_delay_direct(void) |
8357 | pre_start = 0; |
8358 | read_current_timer(&start); |
8359 | start_jiffies = jiffies; |
8360 | - while (jiffies <= (start_jiffies + 1)) { |
8361 | + while (time_before_eq(jiffies, start_jiffies + 1)) { |
8362 | pre_start = start; |
8363 | read_current_timer(&start); |
8364 | } |
8365 | @@ -74,8 +74,8 @@ static unsigned long __cpuinit calibrate_delay_direct(void) |
8366 | |
8367 | pre_end = 0; |
8368 | end = post_start; |
8369 | - while (jiffies <= |
8370 | - (start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) { |
8371 | + while (time_before_eq(jiffies, start_jiffies + 1 + |
8372 | + DELAY_CALIBRATION_TICKS)) { |
8373 | pre_end = end; |
8374 | read_current_timer(&end); |
8375 | } |
8376 | diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c |
8377 | index 1d25419..441fd62 100644 |
8378 | --- a/kernel/irq/migration.c |
8379 | +++ b/kernel/irq/migration.c |
8380 | @@ -56,6 +56,7 @@ void move_masked_irq(int irq) |
8381 | void move_native_irq(int irq) |
8382 | { |
8383 | struct irq_desc *desc = irq_to_desc(irq); |
8384 | + bool masked; |
8385 | |
8386 | if (likely(!(desc->status & IRQ_MOVE_PENDING))) |
8387 | return; |
8388 | @@ -63,8 +64,15 @@ void move_native_irq(int irq) |
8389 | if (unlikely(desc->status & IRQ_DISABLED)) |
8390 | return; |
8391 | |
8392 | - desc->irq_data.chip->irq_mask(&desc->irq_data); |
8393 | + /* |
8394 | + * Be careful vs. already masked interrupts. If this is a |
8395 | + * threaded interrupt with ONESHOT set, we can end up with an |
8396 | + * interrupt storm. |
8397 | + */ |
8398 | + masked = desc->status & IRQ_MASKED; |
8399 | + if (!masked) |
8400 | + desc->irq_data.chip->irq_mask(&desc->irq_data); |
8401 | move_masked_irq(irq); |
8402 | - desc->irq_data.chip->irq_unmask(&desc->irq_data); |
8403 | + if (!masked) |
8404 | + desc->irq_data.chip->irq_unmask(&desc->irq_data); |
8405 | } |
8406 | - |
8407 | diff --git a/kernel/perf_event.c b/kernel/perf_event.c |
8408 | index 2870fee..64668bd 100644 |
8409 | --- a/kernel/perf_event.c |
8410 | +++ b/kernel/perf_event.c |
8411 | @@ -1872,8 +1872,7 @@ static int alloc_callchain_buffers(void) |
8412 | * accessed from NMI. Use a temporary manual per cpu allocation |
8413 | * until that gets sorted out. |
8414 | */ |
8415 | - size = sizeof(*entries) + sizeof(struct perf_callchain_entry *) * |
8416 | - num_possible_cpus(); |
8417 | + size = offsetof(struct callchain_cpus_entries, cpu_entries[nr_cpu_ids]); |
8418 | |
8419 | entries = kzalloc(size, GFP_KERNEL); |
8420 | if (!entries) |
8421 | @@ -2101,14 +2100,11 @@ find_get_context(struct pmu *pmu, struct task_struct *task, int cpu) |
8422 | unsigned long flags; |
8423 | int ctxn, err; |
8424 | |
8425 | - if (!task && cpu != -1) { |
8426 | + if (!task) { |
8427 | /* Must be root to operate on a CPU event: */ |
8428 | if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) |
8429 | return ERR_PTR(-EACCES); |
8430 | |
8431 | - if (cpu < 0 || cpu >= nr_cpumask_bits) |
8432 | - return ERR_PTR(-EINVAL); |
8433 | - |
8434 | /* |
8435 | * We could be clever and allow to attach a event to an |
8436 | * offline CPU and activate it when the CPU comes up, but |
8437 | @@ -5305,6 +5301,11 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, |
8438 | struct hw_perf_event *hwc; |
8439 | long err; |
8440 | |
8441 | + if ((unsigned)cpu >= nr_cpu_ids) { |
8442 | + if (!task || cpu != -1) |
8443 | + return ERR_PTR(-EINVAL); |
8444 | + } |
8445 | + |
8446 | event = kzalloc(sizeof(*event), GFP_KERNEL); |
8447 | if (!event) |
8448 | return ERR_PTR(-ENOMEM); |
8449 | @@ -5353,7 +5354,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, |
8450 | |
8451 | if (!overflow_handler && parent_event) |
8452 | overflow_handler = parent_event->overflow_handler; |
8453 | - |
8454 | + |
8455 | event->overflow_handler = overflow_handler; |
8456 | |
8457 | if (attr->disabled) |
8458 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
8459 | index 99bbaa3..1708b1e 100644 |
8460 | --- a/kernel/ptrace.c |
8461 | +++ b/kernel/ptrace.c |
8462 | @@ -313,7 +313,7 @@ int ptrace_detach(struct task_struct *child, unsigned int data) |
8463 | child->exit_code = data; |
8464 | dead = __ptrace_detach(current, child); |
8465 | if (!child->exit_state) |
8466 | - wake_up_process(child); |
8467 | + wake_up_state(child, TASK_TRACED | TASK_STOPPED); |
8468 | } |
8469 | write_unlock_irq(&tasklist_lock); |
8470 | |
8471 | diff --git a/kernel/sched.c b/kernel/sched.c |
8472 | index 297d1a0..2f912b7 100644 |
8473 | --- a/kernel/sched.c |
8474 | +++ b/kernel/sched.c |
8475 | @@ -607,6 +607,9 @@ static inline struct task_group *task_group(struct task_struct *p) |
8476 | { |
8477 | struct cgroup_subsys_state *css; |
8478 | |
8479 | + if (p->flags & PF_EXITING) |
8480 | + return &root_task_group; |
8481 | + |
8482 | css = task_subsys_state_check(p, cpu_cgroup_subsys_id, |
8483 | lockdep_is_held(&task_rq(p)->lock)); |
8484 | return container_of(css, struct task_group, css); |
8485 | @@ -4526,7 +4529,7 @@ EXPORT_SYMBOL(wait_for_completion_interruptible); |
8486 | * This waits for either a completion of a specific task to be signaled or for a |
8487 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. |
8488 | */ |
8489 | -unsigned long __sched |
8490 | +long __sched |
8491 | wait_for_completion_interruptible_timeout(struct completion *x, |
8492 | unsigned long timeout) |
8493 | { |
8494 | @@ -4559,7 +4562,7 @@ EXPORT_SYMBOL(wait_for_completion_killable); |
8495 | * signaled or for a specified timeout to expire. It can be |
8496 | * interrupted by a kill signal. The timeout is in jiffies. |
8497 | */ |
8498 | -unsigned long __sched |
8499 | +long __sched |
8500 | wait_for_completion_killable_timeout(struct completion *x, |
8501 | unsigned long timeout) |
8502 | { |
8503 | @@ -9178,6 +9181,20 @@ cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
8504 | } |
8505 | } |
8506 | |
8507 | +static void |
8508 | +cpu_cgroup_exit(struct cgroup_subsys *ss, struct task_struct *task) |
8509 | +{ |
8510 | + /* |
8511 | + * cgroup_exit() is called in the copy_process() failure path. |
8512 | + * Ignore this case since the task hasn't ran yet, this avoids |
8513 | + * trying to poke a half freed task state from generic code. |
8514 | + */ |
8515 | + if (!(task->flags & PF_EXITING)) |
8516 | + return; |
8517 | + |
8518 | + sched_move_task(task); |
8519 | +} |
8520 | + |
8521 | #ifdef CONFIG_FAIR_GROUP_SCHED |
8522 | static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype, |
8523 | u64 shareval) |
8524 | @@ -9250,6 +9267,7 @@ struct cgroup_subsys cpu_cgroup_subsys = { |
8525 | .destroy = cpu_cgroup_destroy, |
8526 | .can_attach = cpu_cgroup_can_attach, |
8527 | .attach = cpu_cgroup_attach, |
8528 | + .exit = cpu_cgroup_exit, |
8529 | .populate = cpu_cgroup_populate, |
8530 | .subsys_id = cpu_cgroup_subsys_id, |
8531 | .early_init = 1, |
8532 | diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c |
8533 | index bea7d79..c5f1d23 100644 |
8534 | --- a/kernel/sched_rt.c |
8535 | +++ b/kernel/sched_rt.c |
8536 | @@ -606,7 +606,7 @@ static void update_curr_rt(struct rq *rq) |
8537 | struct rt_rq *rt_rq = rt_rq_of_se(rt_se); |
8538 | u64 delta_exec; |
8539 | |
8540 | - if (!task_has_rt_policy(curr)) |
8541 | + if (curr->sched_class != &rt_sched_class) |
8542 | return; |
8543 | |
8544 | delta_exec = rq->clock_task - curr->se.exec_start; |
8545 | diff --git a/kernel/smp.c b/kernel/smp.c |
8546 | index 12ed8b0..8448f8f 100644 |
8547 | --- a/kernel/smp.c |
8548 | +++ b/kernel/smp.c |
8549 | @@ -194,6 +194,24 @@ void generic_smp_call_function_interrupt(void) |
8550 | list_for_each_entry_rcu(data, &call_function.queue, csd.list) { |
8551 | int refs; |
8552 | |
8553 | + /* |
8554 | + * Since we walk the list without any locks, we might |
8555 | + * see an entry that was completed, removed from the |
8556 | + * list and is in the process of being reused. |
8557 | + * |
8558 | + * We must check that the cpu is in the cpumask before |
8559 | + * checking the refs, and both must be set before |
8560 | + * executing the callback on this cpu. |
8561 | + */ |
8562 | + |
8563 | + if (!cpumask_test_cpu(cpu, data->cpumask)) |
8564 | + continue; |
8565 | + |
8566 | + smp_rmb(); |
8567 | + |
8568 | + if (atomic_read(&data->refs) == 0) |
8569 | + continue; |
8570 | + |
8571 | if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) |
8572 | continue; |
8573 | |
8574 | @@ -202,6 +220,8 @@ void generic_smp_call_function_interrupt(void) |
8575 | refs = atomic_dec_return(&data->refs); |
8576 | WARN_ON(refs < 0); |
8577 | if (!refs) { |
8578 | + WARN_ON(!cpumask_empty(data->cpumask)); |
8579 | + |
8580 | raw_spin_lock(&call_function.lock); |
8581 | list_del_rcu(&data->csd.list); |
8582 | raw_spin_unlock(&call_function.lock); |
8583 | @@ -453,11 +473,21 @@ void smp_call_function_many(const struct cpumask *mask, |
8584 | |
8585 | data = &__get_cpu_var(cfd_data); |
8586 | csd_lock(&data->csd); |
8587 | + BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask)); |
8588 | |
8589 | data->csd.func = func; |
8590 | data->csd.info = info; |
8591 | cpumask_and(data->cpumask, mask, cpu_online_mask); |
8592 | cpumask_clear_cpu(this_cpu, data->cpumask); |
8593 | + |
8594 | + /* |
8595 | + * To ensure the interrupt handler gets an complete view |
8596 | + * we order the cpumask and refs writes and order the read |
8597 | + * of them in the interrupt handler. In addition we may |
8598 | + * only clear our own cpu bit from the mask. |
8599 | + */ |
8600 | + smp_wmb(); |
8601 | + |
8602 | atomic_set(&data->refs, cpumask_weight(data->cpumask)); |
8603 | |
8604 | raw_spin_lock_irqsave(&call_function.lock, flags); |
8605 | diff --git a/kernel/sys.c b/kernel/sys.c |
8606 | index 7f5a0cd..66136ca 100644 |
8607 | --- a/kernel/sys.c |
8608 | +++ b/kernel/sys.c |
8609 | @@ -1377,7 +1377,8 @@ static int check_prlimit_permission(struct task_struct *task) |
8610 | const struct cred *cred = current_cred(), *tcred; |
8611 | |
8612 | tcred = __task_cred(task); |
8613 | - if ((cred->uid != tcred->euid || |
8614 | + if (current != task && |
8615 | + (cred->uid != tcred->euid || |
8616 | cred->uid != tcred->suid || |
8617 | cred->uid != tcred->uid || |
8618 | cred->gid != tcred->egid || |
8619 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
8620 | index 5abfa15..4e17828 100644 |
8621 | --- a/kernel/sysctl.c |
8622 | +++ b/kernel/sysctl.c |
8623 | @@ -169,7 +169,8 @@ static int proc_taint(struct ctl_table *table, int write, |
8624 | #endif |
8625 | |
8626 | #ifdef CONFIG_MAGIC_SYSRQ |
8627 | -static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ |
8628 | +/* Note: sysrq code uses it's own private copy */ |
8629 | +static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE; |
8630 | |
8631 | static int sysrq_sysctl_handler(ctl_table *table, int write, |
8632 | void __user *buffer, size_t *lenp, |
8633 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
8634 | index f8cf959..dc53ecb 100644 |
8635 | --- a/kernel/trace/trace.c |
8636 | +++ b/kernel/trace/trace.c |
8637 | @@ -1313,12 +1313,10 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) |
8638 | |
8639 | __this_cpu_inc(user_stack_count); |
8640 | |
8641 | - |
8642 | - |
8643 | event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK, |
8644 | sizeof(*entry), flags, pc); |
8645 | if (!event) |
8646 | - return; |
8647 | + goto out_drop_count; |
8648 | entry = ring_buffer_event_data(event); |
8649 | |
8650 | entry->tgid = current->tgid; |
8651 | @@ -1333,8 +1331,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) |
8652 | if (!filter_check_discard(call, entry, buffer, event)) |
8653 | ring_buffer_unlock_commit(buffer, event); |
8654 | |
8655 | + out_drop_count: |
8656 | __this_cpu_dec(user_stack_count); |
8657 | - |
8658 | out: |
8659 | preempt_enable(); |
8660 | } |
8661 | diff --git a/kernel/watchdog.c b/kernel/watchdog.c |
8662 | index 5b08215..32a9ce5 100644 |
8663 | --- a/kernel/watchdog.c |
8664 | +++ b/kernel/watchdog.c |
8665 | @@ -27,7 +27,7 @@ |
8666 | #include <asm/irq_regs.h> |
8667 | #include <linux/perf_event.h> |
8668 | |
8669 | -int watchdog_enabled; |
8670 | +int watchdog_enabled = 1; |
8671 | int __read_mostly softlockup_thresh = 60; |
8672 | |
8673 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); |
8674 | @@ -43,9 +43,6 @@ static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); |
8675 | static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); |
8676 | #endif |
8677 | |
8678 | -static int no_watchdog; |
8679 | - |
8680 | - |
8681 | /* boot commands */ |
8682 | /* |
8683 | * Should we panic when a soft-lockup or hard-lockup occurs: |
8684 | @@ -75,7 +72,7 @@ __setup("softlockup_panic=", softlockup_panic_setup); |
8685 | |
8686 | static int __init nowatchdog_setup(char *str) |
8687 | { |
8688 | - no_watchdog = 1; |
8689 | + watchdog_enabled = 0; |
8690 | return 1; |
8691 | } |
8692 | __setup("nowatchdog", nowatchdog_setup); |
8693 | @@ -83,7 +80,7 @@ __setup("nowatchdog", nowatchdog_setup); |
8694 | /* deprecated */ |
8695 | static int __init nosoftlockup_setup(char *str) |
8696 | { |
8697 | - no_watchdog = 1; |
8698 | + watchdog_enabled = 0; |
8699 | return 1; |
8700 | } |
8701 | __setup("nosoftlockup", nosoftlockup_setup); |
8702 | @@ -430,9 +427,6 @@ static int watchdog_enable(int cpu) |
8703 | wake_up_process(p); |
8704 | } |
8705 | |
8706 | - /* if any cpu succeeds, watchdog is considered enabled for the system */ |
8707 | - watchdog_enabled = 1; |
8708 | - |
8709 | return 0; |
8710 | } |
8711 | |
8712 | @@ -460,12 +454,16 @@ static void watchdog_disable(int cpu) |
8713 | static void watchdog_enable_all_cpus(void) |
8714 | { |
8715 | int cpu; |
8716 | - int result = 0; |
8717 | + |
8718 | + watchdog_enabled = 0; |
8719 | |
8720 | for_each_online_cpu(cpu) |
8721 | - result += watchdog_enable(cpu); |
8722 | + if (!watchdog_enable(cpu)) |
8723 | + /* if any cpu succeeds, watchdog is considered |
8724 | + enabled for the system */ |
8725 | + watchdog_enabled = 1; |
8726 | |
8727 | - if (result) |
8728 | + if (!watchdog_enabled) |
8729 | printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n"); |
8730 | |
8731 | } |
8732 | @@ -474,9 +472,6 @@ static void watchdog_disable_all_cpus(void) |
8733 | { |
8734 | int cpu; |
8735 | |
8736 | - if (no_watchdog) |
8737 | - return; |
8738 | - |
8739 | for_each_online_cpu(cpu) |
8740 | watchdog_disable(cpu); |
8741 | |
8742 | @@ -496,10 +491,12 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write, |
8743 | { |
8744 | proc_dointvec(table, write, buffer, length, ppos); |
8745 | |
8746 | - if (watchdog_enabled) |
8747 | - watchdog_enable_all_cpus(); |
8748 | - else |
8749 | - watchdog_disable_all_cpus(); |
8750 | + if (write) { |
8751 | + if (watchdog_enabled) |
8752 | + watchdog_enable_all_cpus(); |
8753 | + else |
8754 | + watchdog_disable_all_cpus(); |
8755 | + } |
8756 | return 0; |
8757 | } |
8758 | |
8759 | @@ -528,7 +525,8 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) |
8760 | break; |
8761 | case CPU_ONLINE: |
8762 | case CPU_ONLINE_FROZEN: |
8763 | - err = watchdog_enable(hotcpu); |
8764 | + if (watchdog_enabled) |
8765 | + err = watchdog_enable(hotcpu); |
8766 | break; |
8767 | #ifdef CONFIG_HOTPLUG_CPU |
8768 | case CPU_UP_CANCELED: |
8769 | @@ -553,9 +551,6 @@ static int __init spawn_watchdog_task(void) |
8770 | void *cpu = (void *)(long)smp_processor_id(); |
8771 | int err; |
8772 | |
8773 | - if (no_watchdog) |
8774 | - return 0; |
8775 | - |
8776 | err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); |
8777 | WARN_ON(notifier_to_errno(err)); |
8778 | |
8779 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
8780 | index e785b0f..4be7fa5 100644 |
8781 | --- a/kernel/workqueue.c |
8782 | +++ b/kernel/workqueue.c |
8783 | @@ -1806,7 +1806,7 @@ __acquires(&gcwq->lock) |
8784 | spin_unlock_irq(&gcwq->lock); |
8785 | |
8786 | work_clear_pending(work); |
8787 | - lock_map_acquire(&cwq->wq->lockdep_map); |
8788 | + lock_map_acquire_read(&cwq->wq->lockdep_map); |
8789 | lock_map_acquire(&lockdep_map); |
8790 | trace_workqueue_execute_start(work); |
8791 | f(work); |
8792 | @@ -2350,8 +2350,18 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, |
8793 | insert_wq_barrier(cwq, barr, work, worker); |
8794 | spin_unlock_irq(&gcwq->lock); |
8795 | |
8796 | - lock_map_acquire(&cwq->wq->lockdep_map); |
8797 | + /* |
8798 | + * If @max_active is 1 or rescuer is in use, flushing another work |
8799 | + * item on the same workqueue may lead to deadlock. Make sure the |
8800 | + * flusher is not running on the same workqueue by verifying write |
8801 | + * access. |
8802 | + */ |
8803 | + if (cwq->wq->saved_max_active == 1 || cwq->wq->flags & WQ_RESCUER) |
8804 | + lock_map_acquire(&cwq->wq->lockdep_map); |
8805 | + else |
8806 | + lock_map_acquire_read(&cwq->wq->lockdep_map); |
8807 | lock_map_release(&cwq->wq->lockdep_map); |
8808 | + |
8809 | return true; |
8810 | already_gone: |
8811 | spin_unlock_irq(&gcwq->lock); |
8812 | diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
8813 | index 3094318..b335acb 100644 |
8814 | --- a/lib/dynamic_debug.c |
8815 | +++ b/lib/dynamic_debug.c |
8816 | @@ -141,11 +141,10 @@ static void ddebug_change(const struct ddebug_query *query, |
8817 | else if (!dp->flags) |
8818 | dt->num_enabled++; |
8819 | dp->flags = newflags; |
8820 | - if (newflags) { |
8821 | - jump_label_enable(&dp->enabled); |
8822 | - } else { |
8823 | - jump_label_disable(&dp->enabled); |
8824 | - } |
8825 | + if (newflags) |
8826 | + dp->enabled = 1; |
8827 | + else |
8828 | + dp->enabled = 0; |
8829 | if (verbose) |
8830 | printk(KERN_INFO |
8831 | "ddebug: changed %s:%d [%s]%s %s\n", |
8832 | diff --git a/lib/kref.c b/lib/kref.c |
8833 | index d3d227a..e7a6e10 100644 |
8834 | --- a/lib/kref.c |
8835 | +++ b/lib/kref.c |
8836 | @@ -37,6 +37,18 @@ void kref_get(struct kref *kref) |
8837 | } |
8838 | |
8839 | /** |
8840 | + * kref_test_and_get - increment refcount for object only if refcount is not |
8841 | + * zero. |
8842 | + * @kref: object. |
8843 | + * |
8844 | + * Return non-zero if the refcount was incremented, 0 otherwise |
8845 | + */ |
8846 | +int kref_test_and_get(struct kref *kref) |
8847 | +{ |
8848 | + return atomic_inc_not_zero(&kref->refcount); |
8849 | +} |
8850 | + |
8851 | +/** |
8852 | * kref_put - decrement refcount for object. |
8853 | * @kref: object. |
8854 | * @release: pointer to the function that will clean up the object when the |
8855 | diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
8856 | index 00bb8a6..d7a1e3d 100644 |
8857 | --- a/mm/memcontrol.c |
8858 | +++ b/mm/memcontrol.c |
8859 | @@ -1842,6 +1842,7 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem, gfp_t gfp_mask, |
8860 | if (likely(!ret)) |
8861 | return CHARGE_OK; |
8862 | |
8863 | + res_counter_uncharge(&mem->res, csize); |
8864 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); |
8865 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; |
8866 | } else |
8867 | @@ -4929,9 +4930,9 @@ struct cgroup_subsys mem_cgroup_subsys = { |
8868 | static int __init enable_swap_account(char *s) |
8869 | { |
8870 | /* consider enabled if no parameter or 1 is given */ |
8871 | - if (!s || !strcmp(s, "1")) |
8872 | + if (!(*s) || !strcmp(s, "=1")) |
8873 | really_do_swap_account = 1; |
8874 | - else if (!strcmp(s, "0")) |
8875 | + else if (!strcmp(s, "=0")) |
8876 | really_do_swap_account = 0; |
8877 | return 1; |
8878 | } |
8879 | @@ -4939,7 +4940,7 @@ __setup("swapaccount", enable_swap_account); |
8880 | |
8881 | static int __init disable_swap_account(char *s) |
8882 | { |
8883 | - enable_swap_account("0"); |
8884 | + enable_swap_account("=0"); |
8885 | return 1; |
8886 | } |
8887 | __setup("noswapaccount", disable_swap_account); |
8888 | diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
8889 | index 2c6523a..83163c0 100644 |
8890 | --- a/mm/memory_hotplug.c |
8891 | +++ b/mm/memory_hotplug.c |
8892 | @@ -407,6 +407,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) |
8893 | int ret; |
8894 | struct memory_notify arg; |
8895 | |
8896 | + lock_memory_hotplug(); |
8897 | arg.start_pfn = pfn; |
8898 | arg.nr_pages = nr_pages; |
8899 | arg.status_change_nid = -1; |
8900 | @@ -419,6 +420,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) |
8901 | ret = notifier_to_errno(ret); |
8902 | if (ret) { |
8903 | memory_notify(MEM_CANCEL_ONLINE, &arg); |
8904 | + unlock_memory_hotplug(); |
8905 | return ret; |
8906 | } |
8907 | /* |
8908 | @@ -443,6 +445,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) |
8909 | printk(KERN_DEBUG "online_pages %lx at %lx failed\n", |
8910 | nr_pages, pfn); |
8911 | memory_notify(MEM_CANCEL_ONLINE, &arg); |
8912 | + unlock_memory_hotplug(); |
8913 | return ret; |
8914 | } |
8915 | |
8916 | @@ -467,6 +470,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) |
8917 | |
8918 | if (onlined_pages) |
8919 | memory_notify(MEM_ONLINE, &arg); |
8920 | + unlock_memory_hotplug(); |
8921 | |
8922 | return 0; |
8923 | } |
8924 | diff --git a/mm/migrate.c b/mm/migrate.c |
8925 | index 6ae8a66..87e7e3a 100644 |
8926 | --- a/mm/migrate.c |
8927 | +++ b/mm/migrate.c |
8928 | @@ -246,7 +246,7 @@ static int migrate_page_move_mapping(struct address_space *mapping, |
8929 | |
8930 | expected_count = 2 + page_has_private(page); |
8931 | if (page_count(page) != expected_count || |
8932 | - (struct page *)radix_tree_deref_slot(pslot) != page) { |
8933 | + radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) { |
8934 | spin_unlock_irq(&mapping->tree_lock); |
8935 | return -EAGAIN; |
8936 | } |
8937 | @@ -318,7 +318,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping, |
8938 | |
8939 | expected_count = 2 + page_has_private(page); |
8940 | if (page_count(page) != expected_count || |
8941 | - (struct page *)radix_tree_deref_slot(pslot) != page) { |
8942 | + radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) { |
8943 | spin_unlock_irq(&mapping->tree_lock); |
8944 | return -EAGAIN; |
8945 | } |
8946 | @@ -620,7 +620,6 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, |
8947 | int *result = NULL; |
8948 | struct page *newpage = get_new_page(page, private, &result); |
8949 | int remap_swapcache = 1; |
8950 | - int rcu_locked = 0; |
8951 | int charge = 0; |
8952 | struct mem_cgroup *mem = NULL; |
8953 | struct anon_vma *anon_vma = NULL; |
8954 | @@ -672,20 +671,26 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, |
8955 | /* |
8956 | * By try_to_unmap(), page->mapcount goes down to 0 here. In this case, |
8957 | * we cannot notice that anon_vma is freed while we migrates a page. |
8958 | - * This rcu_read_lock() delays freeing anon_vma pointer until the end |
8959 | + * This get_anon_vma() delays freeing anon_vma pointer until the end |
8960 | * of migration. File cache pages are no problem because of page_lock() |
8961 | * File Caches may use write_page() or lock_page() in migration, then, |
8962 | * just care Anon page here. |
8963 | */ |
8964 | if (PageAnon(page)) { |
8965 | - rcu_read_lock(); |
8966 | - rcu_locked = 1; |
8967 | - |
8968 | - /* Determine how to safely use anon_vma */ |
8969 | - if (!page_mapped(page)) { |
8970 | - if (!PageSwapCache(page)) |
8971 | - goto rcu_unlock; |
8972 | - |
8973 | + /* |
8974 | + * Only page_lock_anon_vma() understands the subtleties of |
8975 | + * getting a hold on an anon_vma from outside one of its mms. |
8976 | + */ |
8977 | + anon_vma = page_lock_anon_vma(page); |
8978 | + if (anon_vma) { |
8979 | + /* |
8980 | + * Take a reference count on the anon_vma if the |
8981 | + * page is mapped so that it is guaranteed to |
8982 | + * exist when the page is remapped later |
8983 | + */ |
8984 | + get_anon_vma(anon_vma); |
8985 | + page_unlock_anon_vma(anon_vma); |
8986 | + } else if (PageSwapCache(page)) { |
8987 | /* |
8988 | * We cannot be sure that the anon_vma of an unmapped |
8989 | * swapcache page is safe to use because we don't |
8990 | @@ -700,13 +705,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, |
8991 | */ |
8992 | remap_swapcache = 0; |
8993 | } else { |
8994 | - /* |
8995 | - * Take a reference count on the anon_vma if the |
8996 | - * page is mapped so that it is guaranteed to |
8997 | - * exist when the page is remapped later |
8998 | - */ |
8999 | - anon_vma = page_anon_vma(page); |
9000 | - get_anon_vma(anon_vma); |
9001 | + goto uncharge; |
9002 | } |
9003 | } |
9004 | |
9005 | @@ -723,16 +722,10 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, |
9006 | * free the metadata, so the page can be freed. |
9007 | */ |
9008 | if (!page->mapping) { |
9009 | - if (!PageAnon(page) && page_has_private(page)) { |
9010 | - /* |
9011 | - * Go direct to try_to_free_buffers() here because |
9012 | - * a) that's what try_to_release_page() would do anyway |
9013 | - * b) we may be under rcu_read_lock() here, so we can't |
9014 | - * use GFP_KERNEL which is what try_to_release_page() |
9015 | - * needs to be effective. |
9016 | - */ |
9017 | + VM_BUG_ON(PageAnon(page)); |
9018 | + if (page_has_private(page)) { |
9019 | try_to_free_buffers(page); |
9020 | - goto rcu_unlock; |
9021 | + goto uncharge; |
9022 | } |
9023 | goto skip_unmap; |
9024 | } |
9025 | @@ -746,14 +739,11 @@ skip_unmap: |
9026 | |
9027 | if (rc && remap_swapcache) |
9028 | remove_migration_ptes(page, page); |
9029 | -rcu_unlock: |
9030 | |
9031 | /* Drop an anon_vma reference if we took one */ |
9032 | if (anon_vma) |
9033 | drop_anon_vma(anon_vma); |
9034 | |
9035 | - if (rcu_locked) |
9036 | - rcu_read_unlock(); |
9037 | uncharge: |
9038 | if (!charge) |
9039 | mem_cgroup_end_migration(mem, page, newpage); |
9040 | @@ -815,7 +805,6 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, |
9041 | int rc = 0; |
9042 | int *result = NULL; |
9043 | struct page *new_hpage = get_new_page(hpage, private, &result); |
9044 | - int rcu_locked = 0; |
9045 | struct anon_vma *anon_vma = NULL; |
9046 | |
9047 | if (!new_hpage) |
9048 | @@ -830,12 +819,10 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, |
9049 | } |
9050 | |
9051 | if (PageAnon(hpage)) { |
9052 | - rcu_read_lock(); |
9053 | - rcu_locked = 1; |
9054 | - |
9055 | - if (page_mapped(hpage)) { |
9056 | - anon_vma = page_anon_vma(hpage); |
9057 | - atomic_inc(&anon_vma->external_refcount); |
9058 | + anon_vma = page_lock_anon_vma(hpage); |
9059 | + if (anon_vma) { |
9060 | + get_anon_vma(anon_vma); |
9061 | + page_unlock_anon_vma(anon_vma); |
9062 | } |
9063 | } |
9064 | |
9065 | @@ -847,16 +834,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, |
9066 | if (rc) |
9067 | remove_migration_ptes(hpage, hpage); |
9068 | |
9069 | - if (anon_vma && atomic_dec_and_lock(&anon_vma->external_refcount, |
9070 | - &anon_vma->lock)) { |
9071 | - int empty = list_empty(&anon_vma->head); |
9072 | - spin_unlock(&anon_vma->lock); |
9073 | - if (empty) |
9074 | - anon_vma_free(anon_vma); |
9075 | - } |
9076 | - |
9077 | - if (rcu_locked) |
9078 | - rcu_read_unlock(); |
9079 | + if (anon_vma) |
9080 | + drop_anon_vma(anon_vma); |
9081 | out: |
9082 | unlock_page(hpage); |
9083 | |
9084 | diff --git a/mm/mmzone.c b/mm/mmzone.c |
9085 | index e35bfb8..f5b7d17 100644 |
9086 | --- a/mm/mmzone.c |
9087 | +++ b/mm/mmzone.c |
9088 | @@ -87,24 +87,3 @@ int memmap_valid_within(unsigned long pfn, |
9089 | return 1; |
9090 | } |
9091 | #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ |
9092 | - |
9093 | -#ifdef CONFIG_SMP |
9094 | -/* Called when a more accurate view of NR_FREE_PAGES is needed */ |
9095 | -unsigned long zone_nr_free_pages(struct zone *zone) |
9096 | -{ |
9097 | - unsigned long nr_free_pages = zone_page_state(zone, NR_FREE_PAGES); |
9098 | - |
9099 | - /* |
9100 | - * While kswapd is awake, it is considered the zone is under some |
9101 | - * memory pressure. Under pressure, there is a risk that |
9102 | - * per-cpu-counter-drift will allow the min watermark to be breached |
9103 | - * potentially causing a live-lock. While kswapd is awake and |
9104 | - * free pages are low, get a better estimate for free pages |
9105 | - */ |
9106 | - if (nr_free_pages < zone->percpu_drift_mark && |
9107 | - !waitqueue_active(&zone->zone_pgdat->kswapd_wait)) |
9108 | - return zone_page_state_snapshot(zone, NR_FREE_PAGES); |
9109 | - |
9110 | - return nr_free_pages; |
9111 | -} |
9112 | -#endif /* CONFIG_SMP */ |
9113 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
9114 | index ff7e158..91b6d8c 100644 |
9115 | --- a/mm/page_alloc.c |
9116 | +++ b/mm/page_alloc.c |
9117 | @@ -1460,24 +1460,24 @@ static inline int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) |
9118 | #endif /* CONFIG_FAIL_PAGE_ALLOC */ |
9119 | |
9120 | /* |
9121 | - * Return 1 if free pages are above 'mark'. This takes into account the order |
9122 | + * Return true if free pages are above 'mark'. This takes into account the order |
9123 | * of the allocation. |
9124 | */ |
9125 | -int zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
9126 | - int classzone_idx, int alloc_flags) |
9127 | +static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
9128 | + int classzone_idx, int alloc_flags, long free_pages) |
9129 | { |
9130 | /* free_pages my go negative - that's OK */ |
9131 | long min = mark; |
9132 | - long free_pages = zone_nr_free_pages(z) - (1 << order) + 1; |
9133 | int o; |
9134 | |
9135 | + free_pages -= (1 << order) + 1; |
9136 | if (alloc_flags & ALLOC_HIGH) |
9137 | min -= min / 2; |
9138 | if (alloc_flags & ALLOC_HARDER) |
9139 | min -= min / 4; |
9140 | |
9141 | if (free_pages <= min + z->lowmem_reserve[classzone_idx]) |
9142 | - return 0; |
9143 | + return false; |
9144 | for (o = 0; o < order; o++) { |
9145 | /* At the next order, this order's pages become unavailable */ |
9146 | free_pages -= z->free_area[o].nr_free << o; |
9147 | @@ -1486,9 +1486,28 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
9148 | min >>= 1; |
9149 | |
9150 | if (free_pages <= min) |
9151 | - return 0; |
9152 | + return false; |
9153 | } |
9154 | - return 1; |
9155 | + return true; |
9156 | +} |
9157 | + |
9158 | +bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
9159 | + int classzone_idx, int alloc_flags) |
9160 | +{ |
9161 | + return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, |
9162 | + zone_page_state(z, NR_FREE_PAGES)); |
9163 | +} |
9164 | + |
9165 | +bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, |
9166 | + int classzone_idx, int alloc_flags) |
9167 | +{ |
9168 | + long free_pages = zone_page_state(z, NR_FREE_PAGES); |
9169 | + |
9170 | + if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark) |
9171 | + free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES); |
9172 | + |
9173 | + return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, |
9174 | + free_pages); |
9175 | } |
9176 | |
9177 | #ifdef CONFIG_NUMA |
9178 | @@ -2442,7 +2461,7 @@ void show_free_areas(void) |
9179 | " all_unreclaimable? %s" |
9180 | "\n", |
9181 | zone->name, |
9182 | - K(zone_nr_free_pages(zone)), |
9183 | + K(zone_page_state(zone, NR_FREE_PAGES)), |
9184 | K(min_wmark_pages(zone)), |
9185 | K(low_wmark_pages(zone)), |
9186 | K(high_wmark_pages(zone)), |
9187 | diff --git a/mm/slub.c b/mm/slub.c |
9188 | index bec0e35..96e6907 100644 |
9189 | --- a/mm/slub.c |
9190 | +++ b/mm/slub.c |
9191 | @@ -3821,7 +3821,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, |
9192 | } |
9193 | } |
9194 | |
9195 | - down_read(&slub_lock); |
9196 | + lock_memory_hotplug(); |
9197 | #ifdef CONFIG_SLUB_DEBUG |
9198 | if (flags & SO_ALL) { |
9199 | for_each_node_state(node, N_NORMAL_MEMORY) { |
9200 | @@ -3862,7 +3862,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, |
9201 | x += sprintf(buf + x, " N%d=%lu", |
9202 | node, nodes[node]); |
9203 | #endif |
9204 | - up_read(&slub_lock); |
9205 | + unlock_memory_hotplug(); |
9206 | kfree(nodes); |
9207 | return x + sprintf(buf + x, "\n"); |
9208 | } |
9209 | diff --git a/mm/vmscan.c b/mm/vmscan.c |
9210 | index 9ca587c..5da4295 100644 |
9211 | --- a/mm/vmscan.c |
9212 | +++ b/mm/vmscan.c |
9213 | @@ -2143,7 +2143,7 @@ static int sleeping_prematurely(pg_data_t *pgdat, int order, long remaining) |
9214 | if (zone->all_unreclaimable) |
9215 | continue; |
9216 | |
9217 | - if (!zone_watermark_ok(zone, order, high_wmark_pages(zone), |
9218 | + if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone), |
9219 | 0, 0)) |
9220 | return 1; |
9221 | } |
9222 | @@ -2230,7 +2230,7 @@ loop_again: |
9223 | shrink_active_list(SWAP_CLUSTER_MAX, zone, |
9224 | &sc, priority, 0); |
9225 | |
9226 | - if (!zone_watermark_ok(zone, order, |
9227 | + if (!zone_watermark_ok_safe(zone, order, |
9228 | high_wmark_pages(zone), 0, 0)) { |
9229 | end_zone = i; |
9230 | break; |
9231 | @@ -2276,7 +2276,7 @@ loop_again: |
9232 | * We put equal pressure on every zone, unless one |
9233 | * zone has way too many pages free already. |
9234 | */ |
9235 | - if (!zone_watermark_ok(zone, order, |
9236 | + if (!zone_watermark_ok_safe(zone, order, |
9237 | 8*high_wmark_pages(zone), end_zone, 0)) |
9238 | shrink_zone(priority, zone, &sc); |
9239 | reclaim_state->reclaimed_slab = 0; |
9240 | @@ -2297,7 +2297,7 @@ loop_again: |
9241 | total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) |
9242 | sc.may_writepage = 1; |
9243 | |
9244 | - if (!zone_watermark_ok(zone, order, |
9245 | + if (!zone_watermark_ok_safe(zone, order, |
9246 | high_wmark_pages(zone), end_zone, 0)) { |
9247 | all_zones_ok = 0; |
9248 | /* |
9249 | @@ -2305,7 +2305,7 @@ loop_again: |
9250 | * means that we have a GFP_ATOMIC allocation |
9251 | * failure risk. Hurry up! |
9252 | */ |
9253 | - if (!zone_watermark_ok(zone, order, |
9254 | + if (!zone_watermark_ok_safe(zone, order, |
9255 | min_wmark_pages(zone), end_zone, 0)) |
9256 | has_under_min_watermark_zone = 1; |
9257 | } else { |
9258 | @@ -2448,7 +2448,9 @@ static int kswapd(void *p) |
9259 | */ |
9260 | if (!sleeping_prematurely(pgdat, order, remaining)) { |
9261 | trace_mm_vmscan_kswapd_sleep(pgdat->node_id); |
9262 | + restore_pgdat_percpu_threshold(pgdat); |
9263 | schedule(); |
9264 | + reduce_pgdat_percpu_threshold(pgdat); |
9265 | } else { |
9266 | if (remaining) |
9267 | count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY); |
9268 | @@ -2487,16 +2489,17 @@ void wakeup_kswapd(struct zone *zone, int order) |
9269 | if (!populated_zone(zone)) |
9270 | return; |
9271 | |
9272 | - pgdat = zone->zone_pgdat; |
9273 | - if (zone_watermark_ok(zone, order, low_wmark_pages(zone), 0, 0)) |
9274 | + if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) |
9275 | return; |
9276 | + pgdat = zone->zone_pgdat; |
9277 | if (pgdat->kswapd_max_order < order) |
9278 | pgdat->kswapd_max_order = order; |
9279 | - trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order); |
9280 | - if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) |
9281 | - return; |
9282 | if (!waitqueue_active(&pgdat->kswapd_wait)) |
9283 | return; |
9284 | + if (zone_watermark_ok_safe(zone, order, low_wmark_pages(zone), 0, 0)) |
9285 | + return; |
9286 | + |
9287 | + trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order); |
9288 | wake_up_interruptible(&pgdat->kswapd_wait); |
9289 | } |
9290 | |
9291 | diff --git a/mm/vmstat.c b/mm/vmstat.c |
9292 | index 8f62f17..8aff417 100644 |
9293 | --- a/mm/vmstat.c |
9294 | +++ b/mm/vmstat.c |
9295 | @@ -83,6 +83,30 @@ EXPORT_SYMBOL(vm_stat); |
9296 | |
9297 | #ifdef CONFIG_SMP |
9298 | |
9299 | +static int calculate_pressure_threshold(struct zone *zone) |
9300 | +{ |
9301 | + int threshold; |
9302 | + int watermark_distance; |
9303 | + |
9304 | + /* |
9305 | + * As vmstats are not up to date, there is drift between the estimated |
9306 | + * and real values. For high thresholds and a high number of CPUs, it |
9307 | + * is possible for the min watermark to be breached while the estimated |
9308 | + * value looks fine. The pressure threshold is a reduced value such |
9309 | + * that even the maximum amount of drift will not accidentally breach |
9310 | + * the min watermark |
9311 | + */ |
9312 | + watermark_distance = low_wmark_pages(zone) - min_wmark_pages(zone); |
9313 | + threshold = max(1, (int)(watermark_distance / num_online_cpus())); |
9314 | + |
9315 | + /* |
9316 | + * Maximum threshold is 125 |
9317 | + */ |
9318 | + threshold = min(125, threshold); |
9319 | + |
9320 | + return threshold; |
9321 | +} |
9322 | + |
9323 | static int calculate_threshold(struct zone *zone) |
9324 | { |
9325 | int threshold; |
9326 | @@ -161,6 +185,48 @@ static void refresh_zone_stat_thresholds(void) |
9327 | } |
9328 | } |
9329 | |
9330 | +void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) |
9331 | +{ |
9332 | + struct zone *zone; |
9333 | + int cpu; |
9334 | + int threshold; |
9335 | + int i; |
9336 | + |
9337 | + get_online_cpus(); |
9338 | + for (i = 0; i < pgdat->nr_zones; i++) { |
9339 | + zone = &pgdat->node_zones[i]; |
9340 | + if (!zone->percpu_drift_mark) |
9341 | + continue; |
9342 | + |
9343 | + threshold = calculate_pressure_threshold(zone); |
9344 | + for_each_online_cpu(cpu) |
9345 | + per_cpu_ptr(zone->pageset, cpu)->stat_threshold |
9346 | + = threshold; |
9347 | + } |
9348 | + put_online_cpus(); |
9349 | +} |
9350 | + |
9351 | +void restore_pgdat_percpu_threshold(pg_data_t *pgdat) |
9352 | +{ |
9353 | + struct zone *zone; |
9354 | + int cpu; |
9355 | + int threshold; |
9356 | + int i; |
9357 | + |
9358 | + get_online_cpus(); |
9359 | + for (i = 0; i < pgdat->nr_zones; i++) { |
9360 | + zone = &pgdat->node_zones[i]; |
9361 | + if (!zone->percpu_drift_mark) |
9362 | + continue; |
9363 | + |
9364 | + threshold = calculate_threshold(zone); |
9365 | + for_each_online_cpu(cpu) |
9366 | + per_cpu_ptr(zone->pageset, cpu)->stat_threshold |
9367 | + = threshold; |
9368 | + } |
9369 | + put_online_cpus(); |
9370 | +} |
9371 | + |
9372 | /* |
9373 | * For use when we know that interrupts are disabled. |
9374 | */ |
9375 | @@ -834,7 +900,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
9376 | "\n scanned %lu" |
9377 | "\n spanned %lu" |
9378 | "\n present %lu", |
9379 | - zone_nr_free_pages(zone), |
9380 | + zone_page_state(zone, NR_FREE_PAGES), |
9381 | min_wmark_pages(zone), |
9382 | low_wmark_pages(zone), |
9383 | high_wmark_pages(zone), |
9384 | diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c |
9385 | index bb86d29..6da5dae 100644 |
9386 | --- a/net/ax25/af_ax25.c |
9387 | +++ b/net/ax25/af_ax25.c |
9388 | @@ -1392,7 +1392,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, |
9389 | ax25_cb *ax25; |
9390 | int err = 0; |
9391 | |
9392 | - memset(fsa, 0, sizeof(fsa)); |
9393 | + memset(fsa, 0, sizeof(*fsa)); |
9394 | lock_sock(sk); |
9395 | ax25 = ax25_sk(sk); |
9396 | |
9397 | diff --git a/net/core/ethtool.c b/net/core/ethtool.c |
9398 | index 956a9f4..1c6c3ac 100644 |
9399 | --- a/net/core/ethtool.c |
9400 | +++ b/net/core/ethtool.c |
9401 | @@ -817,7 +817,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) |
9402 | if (regs.len > reglen) |
9403 | regs.len = reglen; |
9404 | |
9405 | - regbuf = vmalloc(reglen); |
9406 | + regbuf = vzalloc(reglen); |
9407 | if (!regbuf) |
9408 | return -ENOMEM; |
9409 | |
9410 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
9411 | index 841c287..b078d90 100644 |
9412 | --- a/net/core/rtnetlink.c |
9413 | +++ b/net/core/rtnetlink.c |
9414 | @@ -1510,6 +1510,9 @@ replay: |
9415 | snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); |
9416 | |
9417 | dest_net = rtnl_link_get_net(net, tb); |
9418 | + if (IS_ERR(dest_net)) |
9419 | + return PTR_ERR(dest_net); |
9420 | + |
9421 | dev = rtnl_create_link(net, dest_net, ifname, ops, tb); |
9422 | |
9423 | if (IS_ERR(dev)) |
9424 | diff --git a/net/core/sock.c b/net/core/sock.c |
9425 | index e5af8d5..7fd3541 100644 |
9426 | --- a/net/core/sock.c |
9427 | +++ b/net/core/sock.c |
9428 | @@ -1907,7 +1907,7 @@ static void sock_def_readable(struct sock *sk, int len) |
9429 | rcu_read_lock(); |
9430 | wq = rcu_dereference(sk->sk_wq); |
9431 | if (wq_has_sleeper(wq)) |
9432 | - wake_up_interruptible_sync_poll(&wq->wait, POLLIN | |
9433 | + wake_up_interruptible_sync_poll(&wq->wait, POLLIN | POLLPRI | |
9434 | POLLRDNORM | POLLRDBAND); |
9435 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); |
9436 | rcu_read_unlock(); |
9437 | diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c |
9438 | index 1684408..fb9b94a 100644 |
9439 | --- a/net/ipv4/ip_fragment.c |
9440 | +++ b/net/ipv4/ip_fragment.c |
9441 | @@ -45,6 +45,7 @@ |
9442 | #include <linux/udp.h> |
9443 | #include <linux/inet.h> |
9444 | #include <linux/netfilter_ipv4.h> |
9445 | +#include <net/inet_ecn.h> |
9446 | |
9447 | /* NOTE. Logic of IP defragmentation is parallel to corresponding IPv6 |
9448 | * code now. If you change something here, _PLEASE_ update ipv6/reassembly.c |
9449 | @@ -70,11 +71,28 @@ struct ipq { |
9450 | __be32 daddr; |
9451 | __be16 id; |
9452 | u8 protocol; |
9453 | + u8 ecn; /* RFC3168 support */ |
9454 | int iif; |
9455 | unsigned int rid; |
9456 | struct inet_peer *peer; |
9457 | }; |
9458 | |
9459 | +#define IPFRAG_ECN_CLEAR 0x01 /* one frag had INET_ECN_NOT_ECT */ |
9460 | +#define IPFRAG_ECN_SET_CE 0x04 /* one frag had INET_ECN_CE */ |
9461 | + |
9462 | +static inline u8 ip4_frag_ecn(u8 tos) |
9463 | +{ |
9464 | + tos = (tos & INET_ECN_MASK) + 1; |
9465 | + /* |
9466 | + * After the last operation we have (in binary): |
9467 | + * INET_ECN_NOT_ECT => 001 |
9468 | + * INET_ECN_ECT_1 => 010 |
9469 | + * INET_ECN_ECT_0 => 011 |
9470 | + * INET_ECN_CE => 100 |
9471 | + */ |
9472 | + return (tos & 2) ? 0 : tos; |
9473 | +} |
9474 | + |
9475 | static struct inet_frags ip4_frags; |
9476 | |
9477 | int ip_frag_nqueues(struct net *net) |
9478 | @@ -137,6 +155,7 @@ static void ip4_frag_init(struct inet_frag_queue *q, void *a) |
9479 | |
9480 | qp->protocol = arg->iph->protocol; |
9481 | qp->id = arg->iph->id; |
9482 | + qp->ecn = ip4_frag_ecn(arg->iph->tos); |
9483 | qp->saddr = arg->iph->saddr; |
9484 | qp->daddr = arg->iph->daddr; |
9485 | qp->user = arg->user; |
9486 | @@ -316,6 +335,7 @@ static int ip_frag_reinit(struct ipq *qp) |
9487 | qp->q.fragments = NULL; |
9488 | qp->q.fragments_tail = NULL; |
9489 | qp->iif = 0; |
9490 | + qp->ecn = 0; |
9491 | |
9492 | return 0; |
9493 | } |
9494 | @@ -328,6 +348,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) |
9495 | int flags, offset; |
9496 | int ihl, end; |
9497 | int err = -ENOENT; |
9498 | + u8 ecn; |
9499 | |
9500 | if (qp->q.last_in & INET_FRAG_COMPLETE) |
9501 | goto err; |
9502 | @@ -339,6 +360,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) |
9503 | goto err; |
9504 | } |
9505 | |
9506 | + ecn = ip4_frag_ecn(ip_hdr(skb)->tos); |
9507 | offset = ntohs(ip_hdr(skb)->frag_off); |
9508 | flags = offset & ~IP_OFFSET; |
9509 | offset &= IP_OFFSET; |
9510 | @@ -472,6 +494,7 @@ found: |
9511 | } |
9512 | qp->q.stamp = skb->tstamp; |
9513 | qp->q.meat += skb->len; |
9514 | + qp->ecn |= ecn; |
9515 | atomic_add(skb->truesize, &qp->q.net->mem); |
9516 | if (offset == 0) |
9517 | qp->q.last_in |= INET_FRAG_FIRST_IN; |
9518 | @@ -583,6 +606,17 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, |
9519 | iph = ip_hdr(head); |
9520 | iph->frag_off = 0; |
9521 | iph->tot_len = htons(len); |
9522 | + /* RFC3168 5.3 Fragmentation support |
9523 | + * If one fragment had INET_ECN_NOT_ECT, |
9524 | + * reassembled frame also has INET_ECN_NOT_ECT |
9525 | + * Elif one fragment had INET_ECN_CE |
9526 | + * reassembled frame also has INET_ECN_CE |
9527 | + */ |
9528 | + if (qp->ecn & IPFRAG_ECN_CLEAR) |
9529 | + iph->tos &= ~INET_ECN_MASK; |
9530 | + else if (qp->ecn & IPFRAG_ECN_SET_CE) |
9531 | + iph->tos |= INET_ECN_CE; |
9532 | + |
9533 | IP_INC_STATS_BH(net, IPSTATS_MIB_REASMOKS); |
9534 | qp->q.fragments = NULL; |
9535 | qp->q.fragments_tail = NULL; |
9536 | diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
9537 | index 94b5bf1..5f8d242 100644 |
9538 | --- a/net/ipv6/ip6_output.c |
9539 | +++ b/net/ipv6/ip6_output.c |
9540 | @@ -401,6 +401,9 @@ int ip6_forward(struct sk_buff *skb) |
9541 | goto drop; |
9542 | } |
9543 | |
9544 | + if (skb->pkt_type != PACKET_HOST) |
9545 | + goto drop; |
9546 | + |
9547 | skb_forward_csum(skb); |
9548 | |
9549 | /* |
9550 | diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c |
9551 | index 720b7a8..c080a5d 100644 |
9552 | --- a/net/mac80211/agg-rx.c |
9553 | +++ b/net/mac80211/agg-rx.c |
9554 | @@ -187,8 +187,6 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, |
9555 | struct ieee80211_mgmt *mgmt, |
9556 | size_t len) |
9557 | { |
9558 | - struct ieee80211_hw *hw = &local->hw; |
9559 | - struct ieee80211_conf *conf = &hw->conf; |
9560 | struct tid_ampdu_rx *tid_agg_rx; |
9561 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; |
9562 | u8 dialog_token; |
9563 | @@ -233,13 +231,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, |
9564 | goto end_no_lock; |
9565 | } |
9566 | /* determine default buffer size */ |
9567 | - if (buf_size == 0) { |
9568 | - struct ieee80211_supported_band *sband; |
9569 | - |
9570 | - sband = local->hw.wiphy->bands[conf->channel->band]; |
9571 | - buf_size = IEEE80211_MIN_AMPDU_BUF; |
9572 | - buf_size = buf_size << sband->ht_cap.ampdu_factor; |
9573 | - } |
9574 | + if (buf_size == 0) |
9575 | + buf_size = IEEE80211_MAX_AMPDU_BUF; |
9576 | |
9577 | |
9578 | /* examine state machine */ |
9579 | diff --git a/net/mac80211/key.c b/net/mac80211/key.c |
9580 | index ccd676b..aa1b734 100644 |
9581 | --- a/net/mac80211/key.c |
9582 | +++ b/net/mac80211/key.c |
9583 | @@ -366,6 +366,12 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key) |
9584 | if (!key) |
9585 | return; |
9586 | |
9587 | + /* |
9588 | + * Synchronize so the TX path can no longer be using |
9589 | + * this key before we free/remove it. |
9590 | + */ |
9591 | + synchronize_rcu(); |
9592 | + |
9593 | if (key->local) |
9594 | ieee80211_key_disable_hw_accel(key); |
9595 | |
9596 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
9597 | index b01e467..e98668f 100644 |
9598 | --- a/net/mac80211/rx.c |
9599 | +++ b/net/mac80211/rx.c |
9600 | @@ -1788,11 +1788,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) |
9601 | |
9602 | fwd_skb = skb_copy(skb, GFP_ATOMIC); |
9603 | |
9604 | - if (!fwd_skb && net_ratelimit()) { |
9605 | + if (!fwd_skb && net_ratelimit()) |
9606 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", |
9607 | sdata->name); |
9608 | + if (!fwd_skb) |
9609 | goto out; |
9610 | - } |
9611 | |
9612 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
9613 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); |
9614 | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
9615 | index 7a637b8..2f09db5 100644 |
9616 | --- a/net/mac80211/tx.c |
9617 | +++ b/net/mac80211/tx.c |
9618 | @@ -1726,7 +1726,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, |
9619 | { |
9620 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
9621 | struct ieee80211_local *local = sdata->local; |
9622 | - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
9623 | + struct ieee80211_tx_info *info; |
9624 | int ret = NETDEV_TX_BUSY, head_need; |
9625 | u16 ethertype, hdrlen, meshhdrlen = 0; |
9626 | __le16 fc; |
9627 | @@ -2017,6 +2017,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, |
9628 | skb_set_network_header(skb, nh_pos); |
9629 | skb_set_transport_header(skb, h_pos); |
9630 | |
9631 | + info = IEEE80211_SKB_CB(skb); |
9632 | memset(info, 0, sizeof(*info)); |
9633 | |
9634 | dev->trans_start = jiffies; |
9635 | @@ -2207,6 +2208,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, |
9636 | |
9637 | sdata = vif_to_sdata(vif); |
9638 | |
9639 | + if (!ieee80211_sdata_running(sdata)) |
9640 | + goto out; |
9641 | + |
9642 | if (tim_offset) |
9643 | *tim_offset = 0; |
9644 | if (tim_length) |
9645 | diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c |
9646 | index 4dfecb0..aa4d633 100644 |
9647 | --- a/net/sched/sch_fifo.c |
9648 | +++ b/net/sched/sch_fifo.c |
9649 | @@ -54,8 +54,6 @@ static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc* sch) |
9650 | |
9651 | /* queue full, remove one skb to fulfill the limit */ |
9652 | skb_head = qdisc_dequeue_head(sch); |
9653 | - sch->bstats.bytes -= qdisc_pkt_len(skb_head); |
9654 | - sch->bstats.packets--; |
9655 | sch->qstats.drops++; |
9656 | kfree_skb(skb_head); |
9657 | |
9658 | diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c |
9659 | index cd9e841..679cd67 100644 |
9660 | --- a/net/sunrpc/xdr.c |
9661 | +++ b/net/sunrpc/xdr.c |
9662 | @@ -552,6 +552,74 @@ void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, unsigned int b |
9663 | } |
9664 | EXPORT_SYMBOL_GPL(xdr_write_pages); |
9665 | |
9666 | +static void xdr_set_iov(struct xdr_stream *xdr, struct kvec *iov, |
9667 | + __be32 *p, unsigned int len) |
9668 | +{ |
9669 | + if (len > iov->iov_len) |
9670 | + len = iov->iov_len; |
9671 | + if (p == NULL) |
9672 | + p = (__be32*)iov->iov_base; |
9673 | + xdr->p = p; |
9674 | + xdr->end = (__be32*)(iov->iov_base + len); |
9675 | + xdr->iov = iov; |
9676 | + xdr->page_ptr = NULL; |
9677 | +} |
9678 | + |
9679 | +static int xdr_set_page_base(struct xdr_stream *xdr, |
9680 | + unsigned int base, unsigned int len) |
9681 | +{ |
9682 | + unsigned int pgnr; |
9683 | + unsigned int maxlen; |
9684 | + unsigned int pgoff; |
9685 | + unsigned int pgend; |
9686 | + void *kaddr; |
9687 | + |
9688 | + maxlen = xdr->buf->page_len; |
9689 | + if (base >= maxlen) |
9690 | + return -EINVAL; |
9691 | + maxlen -= base; |
9692 | + if (len > maxlen) |
9693 | + len = maxlen; |
9694 | + |
9695 | + base += xdr->buf->page_base; |
9696 | + |
9697 | + pgnr = base >> PAGE_SHIFT; |
9698 | + xdr->page_ptr = &xdr->buf->pages[pgnr]; |
9699 | + kaddr = page_address(*xdr->page_ptr); |
9700 | + |
9701 | + pgoff = base & ~PAGE_MASK; |
9702 | + xdr->p = (__be32*)(kaddr + pgoff); |
9703 | + |
9704 | + pgend = pgoff + len; |
9705 | + if (pgend > PAGE_SIZE) |
9706 | + pgend = PAGE_SIZE; |
9707 | + xdr->end = (__be32*)(kaddr + pgend); |
9708 | + xdr->iov = NULL; |
9709 | + return 0; |
9710 | +} |
9711 | + |
9712 | +static void xdr_set_next_page(struct xdr_stream *xdr) |
9713 | +{ |
9714 | + unsigned int newbase; |
9715 | + |
9716 | + newbase = (1 + xdr->page_ptr - xdr->buf->pages) << PAGE_SHIFT; |
9717 | + newbase -= xdr->buf->page_base; |
9718 | + |
9719 | + if (xdr_set_page_base(xdr, newbase, PAGE_SIZE) < 0) |
9720 | + xdr_set_iov(xdr, xdr->buf->tail, NULL, xdr->buf->len); |
9721 | +} |
9722 | + |
9723 | +static bool xdr_set_next_buffer(struct xdr_stream *xdr) |
9724 | +{ |
9725 | + if (xdr->page_ptr != NULL) |
9726 | + xdr_set_next_page(xdr); |
9727 | + else if (xdr->iov == xdr->buf->head) { |
9728 | + if (xdr_set_page_base(xdr, 0, PAGE_SIZE) < 0) |
9729 | + xdr_set_iov(xdr, xdr->buf->tail, NULL, xdr->buf->len); |
9730 | + } |
9731 | + return xdr->p != xdr->end; |
9732 | +} |
9733 | + |
9734 | /** |
9735 | * xdr_init_decode - Initialize an xdr_stream for decoding data. |
9736 | * @xdr: pointer to xdr_stream struct |
9737 | @@ -560,41 +628,67 @@ EXPORT_SYMBOL_GPL(xdr_write_pages); |
9738 | */ |
9739 | void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p) |
9740 | { |
9741 | - struct kvec *iov = buf->head; |
9742 | - unsigned int len = iov->iov_len; |
9743 | - |
9744 | - if (len > buf->len) |
9745 | - len = buf->len; |
9746 | xdr->buf = buf; |
9747 | - xdr->iov = iov; |
9748 | - xdr->p = p; |
9749 | - xdr->end = (__be32 *)((char *)iov->iov_base + len); |
9750 | + xdr->scratch.iov_base = NULL; |
9751 | + xdr->scratch.iov_len = 0; |
9752 | + if (buf->head[0].iov_len != 0) |
9753 | + xdr_set_iov(xdr, buf->head, p, buf->len); |
9754 | + else if (buf->page_len != 0) |
9755 | + xdr_set_page_base(xdr, 0, buf->len); |
9756 | } |
9757 | EXPORT_SYMBOL_GPL(xdr_init_decode); |
9758 | |
9759 | -/** |
9760 | - * xdr_inline_peek - Allow read-ahead in the XDR data stream |
9761 | - * @xdr: pointer to xdr_stream struct |
9762 | - * @nbytes: number of bytes of data to decode |
9763 | - * |
9764 | - * Check if the input buffer is long enough to enable us to decode |
9765 | - * 'nbytes' more bytes of data starting at the current position. |
9766 | - * If so return the current pointer without updating the current |
9767 | - * pointer position. |
9768 | - */ |
9769 | -__be32 * xdr_inline_peek(struct xdr_stream *xdr, size_t nbytes) |
9770 | +static __be32 * __xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) |
9771 | { |
9772 | __be32 *p = xdr->p; |
9773 | __be32 *q = p + XDR_QUADLEN(nbytes); |
9774 | |
9775 | if (unlikely(q > xdr->end || q < p)) |
9776 | return NULL; |
9777 | + xdr->p = q; |
9778 | return p; |
9779 | } |
9780 | -EXPORT_SYMBOL_GPL(xdr_inline_peek); |
9781 | |
9782 | /** |
9783 | - * xdr_inline_decode - Retrieve non-page XDR data to decode |
9784 | + * xdr_set_scratch_buffer - Attach a scratch buffer for decoding data. |
9785 | + * @xdr: pointer to xdr_stream struct |
9786 | + * @buf: pointer to an empty buffer |
9787 | + * @buflen: size of 'buf' |
9788 | + * |
9789 | + * The scratch buffer is used when decoding from an array of pages. |
9790 | + * If an xdr_inline_decode() call spans across page boundaries, then |
9791 | + * we copy the data into the scratch buffer in order to allow linear |
9792 | + * access. |
9793 | + */ |
9794 | +void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen) |
9795 | +{ |
9796 | + xdr->scratch.iov_base = buf; |
9797 | + xdr->scratch.iov_len = buflen; |
9798 | +} |
9799 | +EXPORT_SYMBOL_GPL(xdr_set_scratch_buffer); |
9800 | + |
9801 | +static __be32 *xdr_copy_to_scratch(struct xdr_stream *xdr, size_t nbytes) |
9802 | +{ |
9803 | + __be32 *p; |
9804 | + void *cpdest = xdr->scratch.iov_base; |
9805 | + size_t cplen = (char *)xdr->end - (char *)xdr->p; |
9806 | + |
9807 | + if (nbytes > xdr->scratch.iov_len) |
9808 | + return NULL; |
9809 | + memcpy(cpdest, xdr->p, cplen); |
9810 | + cpdest += cplen; |
9811 | + nbytes -= cplen; |
9812 | + if (!xdr_set_next_buffer(xdr)) |
9813 | + return NULL; |
9814 | + p = __xdr_inline_decode(xdr, nbytes); |
9815 | + if (p == NULL) |
9816 | + return NULL; |
9817 | + memcpy(cpdest, p, nbytes); |
9818 | + return xdr->scratch.iov_base; |
9819 | +} |
9820 | + |
9821 | +/** |
9822 | + * xdr_inline_decode - Retrieve XDR data to decode |
9823 | * @xdr: pointer to xdr_stream struct |
9824 | * @nbytes: number of bytes of data to decode |
9825 | * |
9826 | @@ -605,13 +699,16 @@ EXPORT_SYMBOL_GPL(xdr_inline_peek); |
9827 | */ |
9828 | __be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) |
9829 | { |
9830 | - __be32 *p = xdr->p; |
9831 | - __be32 *q = p + XDR_QUADLEN(nbytes); |
9832 | + __be32 *p; |
9833 | |
9834 | - if (unlikely(q > xdr->end || q < p)) |
9835 | + if (nbytes == 0) |
9836 | + return xdr->p; |
9837 | + if (xdr->p == xdr->end && !xdr_set_next_buffer(xdr)) |
9838 | return NULL; |
9839 | - xdr->p = q; |
9840 | - return p; |
9841 | + p = __xdr_inline_decode(xdr, nbytes); |
9842 | + if (p != NULL) |
9843 | + return p; |
9844 | + return xdr_copy_to_scratch(xdr, nbytes); |
9845 | } |
9846 | EXPORT_SYMBOL_GPL(xdr_inline_decode); |
9847 | |
9848 | @@ -671,16 +768,12 @@ EXPORT_SYMBOL_GPL(xdr_read_pages); |
9849 | */ |
9850 | void xdr_enter_page(struct xdr_stream *xdr, unsigned int len) |
9851 | { |
9852 | - char * kaddr = page_address(xdr->buf->pages[0]); |
9853 | xdr_read_pages(xdr, len); |
9854 | /* |
9855 | * Position current pointer at beginning of tail, and |
9856 | * set remaining message length. |
9857 | */ |
9858 | - if (len > PAGE_CACHE_SIZE - xdr->buf->page_base) |
9859 | - len = PAGE_CACHE_SIZE - xdr->buf->page_base; |
9860 | - xdr->p = (__be32 *)(kaddr + xdr->buf->page_base); |
9861 | - xdr->end = (__be32 *)((char *)xdr->p + len); |
9862 | + xdr_set_page_base(xdr, 0, len); |
9863 | } |
9864 | EXPORT_SYMBOL_GPL(xdr_enter_page); |
9865 | |
9866 | diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
9867 | index 2268e67..759bbcb 100644 |
9868 | --- a/net/unix/af_unix.c |
9869 | +++ b/net/unix/af_unix.c |
9870 | @@ -1156,7 +1156,7 @@ restart: |
9871 | goto restart; |
9872 | } |
9873 | |
9874 | - err = security_unix_stream_connect(sock, other->sk_socket, newsk); |
9875 | + err = security_unix_stream_connect(sk, other, newsk); |
9876 | if (err) { |
9877 | unix_state_unlock(sk); |
9878 | goto out_unlock; |
9879 | diff --git a/net/wireless/reg.c b/net/wireless/reg.c |
9880 | index 4b9f891..8ab65f2 100644 |
9881 | --- a/net/wireless/reg.c |
9882 | +++ b/net/wireless/reg.c |
9883 | @@ -720,7 +720,9 @@ EXPORT_SYMBOL(freq_reg_info); |
9884 | * on the wiphy with the target_bw specified. Then we can simply use |
9885 | * that below for the desired_bw_khz below. |
9886 | */ |
9887 | -static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, |
9888 | +static void handle_channel(struct wiphy *wiphy, |
9889 | + enum nl80211_reg_initiator initiator, |
9890 | + enum ieee80211_band band, |
9891 | unsigned int chan_idx) |
9892 | { |
9893 | int r; |
9894 | @@ -748,8 +750,26 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, |
9895 | desired_bw_khz, |
9896 | ®_rule); |
9897 | |
9898 | - if (r) |
9899 | + if (r) { |
9900 | + /* |
9901 | + * We will disable all channels that do not match our |
9902 | + * recieved regulatory rule unless the hint is coming |
9903 | + * from a Country IE and the Country IE had no information |
9904 | + * about a band. The IEEE 802.11 spec allows for an AP |
9905 | + * to send only a subset of the regulatory rules allowed, |
9906 | + * so an AP in the US that only supports 2.4 GHz may only send |
9907 | + * a country IE with information for the 2.4 GHz band |
9908 | + * while 5 GHz is still supported. |
9909 | + */ |
9910 | + if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && |
9911 | + r == -ERANGE) |
9912 | + return; |
9913 | + |
9914 | + REG_DBG_PRINT("cfg80211: Disabling freq %d MHz\n", |
9915 | + chan->center_freq); |
9916 | + chan->flags = IEEE80211_CHAN_DISABLED; |
9917 | return; |
9918 | + } |
9919 | |
9920 | power_rule = ®_rule->power_rule; |
9921 | freq_range = ®_rule->freq_range; |
9922 | @@ -784,7 +804,9 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, |
9923 | chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); |
9924 | } |
9925 | |
9926 | -static void handle_band(struct wiphy *wiphy, enum ieee80211_band band) |
9927 | +static void handle_band(struct wiphy *wiphy, |
9928 | + enum ieee80211_band band, |
9929 | + enum nl80211_reg_initiator initiator) |
9930 | { |
9931 | unsigned int i; |
9932 | struct ieee80211_supported_band *sband; |
9933 | @@ -793,7 +815,7 @@ static void handle_band(struct wiphy *wiphy, enum ieee80211_band band) |
9934 | sband = wiphy->bands[band]; |
9935 | |
9936 | for (i = 0; i < sband->n_channels; i++) |
9937 | - handle_channel(wiphy, band, i); |
9938 | + handle_channel(wiphy, initiator, band, i); |
9939 | } |
9940 | |
9941 | static bool ignore_reg_update(struct wiphy *wiphy, |
9942 | @@ -809,6 +831,7 @@ static bool ignore_reg_update(struct wiphy *wiphy, |
9943 | * desired regulatory domain set |
9944 | */ |
9945 | if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd && |
9946 | + initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && |
9947 | !is_world_regdom(last_request->alpha2)) |
9948 | return true; |
9949 | return false; |
9950 | @@ -1030,7 +1053,7 @@ void wiphy_update_regulatory(struct wiphy *wiphy, |
9951 | goto out; |
9952 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
9953 | if (wiphy->bands[band]) |
9954 | - handle_band(wiphy, band); |
9955 | + handle_band(wiphy, band, initiator); |
9956 | } |
9957 | out: |
9958 | reg_process_beacons(wiphy); |
9959 | diff --git a/security/capability.c b/security/capability.c |
9960 | index c773635..2a5df2b 100644 |
9961 | --- a/security/capability.c |
9962 | +++ b/security/capability.c |
9963 | @@ -548,7 +548,7 @@ static int cap_sem_semop(struct sem_array *sma, struct sembuf *sops, |
9964 | } |
9965 | |
9966 | #ifdef CONFIG_SECURITY_NETWORK |
9967 | -static int cap_unix_stream_connect(struct socket *sock, struct socket *other, |
9968 | +static int cap_unix_stream_connect(struct sock *sock, struct sock *other, |
9969 | struct sock *newsk) |
9970 | { |
9971 | return 0; |
9972 | diff --git a/security/security.c b/security/security.c |
9973 | index 1b798d3..e5fb07a 100644 |
9974 | --- a/security/security.c |
9975 | +++ b/security/security.c |
9976 | @@ -977,8 +977,7 @@ EXPORT_SYMBOL(security_inode_getsecctx); |
9977 | |
9978 | #ifdef CONFIG_SECURITY_NETWORK |
9979 | |
9980 | -int security_unix_stream_connect(struct socket *sock, struct socket *other, |
9981 | - struct sock *newsk) |
9982 | +int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk) |
9983 | { |
9984 | return security_ops->unix_stream_connect(sock, other, newsk); |
9985 | } |
9986 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
9987 | index 65fa8bf..11d5c47 100644 |
9988 | --- a/security/selinux/hooks.c |
9989 | +++ b/security/selinux/hooks.c |
9990 | @@ -2525,7 +2525,10 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, |
9991 | sid = tsec->sid; |
9992 | newsid = tsec->create_sid; |
9993 | |
9994 | - if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { |
9995 | + if ((sbsec->flags & SE_SBINITIALIZED) && |
9996 | + (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)) |
9997 | + newsid = sbsec->mntpoint_sid; |
9998 | + else if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { |
9999 | rc = security_transition_sid(sid, dsec->sid, |
10000 | inode_mode_to_security_class(inode->i_mode), |
10001 | &newsid); |
10002 | @@ -3921,18 +3924,18 @@ static int selinux_socket_shutdown(struct socket *sock, int how) |
10003 | return sock_has_perm(current, sock->sk, SOCKET__SHUTDOWN); |
10004 | } |
10005 | |
10006 | -static int selinux_socket_unix_stream_connect(struct socket *sock, |
10007 | - struct socket *other, |
10008 | +static int selinux_socket_unix_stream_connect(struct sock *sock, |
10009 | + struct sock *other, |
10010 | struct sock *newsk) |
10011 | { |
10012 | - struct sk_security_struct *sksec_sock = sock->sk->sk_security; |
10013 | - struct sk_security_struct *sksec_other = other->sk->sk_security; |
10014 | + struct sk_security_struct *sksec_sock = sock->sk_security; |
10015 | + struct sk_security_struct *sksec_other = other->sk_security; |
10016 | struct sk_security_struct *sksec_new = newsk->sk_security; |
10017 | struct common_audit_data ad; |
10018 | int err; |
10019 | |
10020 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
10021 | - ad.u.net.sk = other->sk; |
10022 | + ad.u.net.sk = other; |
10023 | |
10024 | err = avc_has_perm(sksec_sock->sid, sksec_other->sid, |
10025 | sksec_other->sclass, |
10026 | diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c |
10027 | index 75ec0c6..8b02b21 100644 |
10028 | --- a/security/selinux/nlmsgtab.c |
10029 | +++ b/security/selinux/nlmsgtab.c |
10030 | @@ -65,6 +65,8 @@ static struct nlmsg_perm nlmsg_route_perms[] = |
10031 | { RTM_NEWADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
10032 | { RTM_DELADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
10033 | { RTM_GETADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
10034 | + { RTM_GETDCB, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
10035 | + { RTM_SETDCB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
10036 | }; |
10037 | |
10038 | static struct nlmsg_perm nlmsg_firewall_perms[] = |
10039 | diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
10040 | index 489a85a..ccb71a0 100644 |
10041 | --- a/security/smack/smack_lsm.c |
10042 | +++ b/security/smack/smack_lsm.c |
10043 | @@ -2408,22 +2408,22 @@ static int smack_setprocattr(struct task_struct *p, char *name, |
10044 | |
10045 | /** |
10046 | * smack_unix_stream_connect - Smack access on UDS |
10047 | - * @sock: one socket |
10048 | - * @other: the other socket |
10049 | + * @sock: one sock |
10050 | + * @other: the other sock |
10051 | * @newsk: unused |
10052 | * |
10053 | * Return 0 if a subject with the smack of sock could access |
10054 | * an object with the smack of other, otherwise an error code |
10055 | */ |
10056 | -static int smack_unix_stream_connect(struct socket *sock, |
10057 | - struct socket *other, struct sock *newsk) |
10058 | +static int smack_unix_stream_connect(struct sock *sock, |
10059 | + struct sock *other, struct sock *newsk) |
10060 | { |
10061 | - struct inode *sp = SOCK_INODE(sock); |
10062 | - struct inode *op = SOCK_INODE(other); |
10063 | + struct inode *sp = SOCK_INODE(sock->sk_socket); |
10064 | + struct inode *op = SOCK_INODE(other->sk_socket); |
10065 | struct smk_audit_info ad; |
10066 | |
10067 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET); |
10068 | - smk_ad_setfield_u_net_sk(&ad, other->sk); |
10069 | + smk_ad_setfield_u_net_sk(&ad, other); |
10070 | return smk_access(smk_of_inode(sp), smk_of_inode(op), |
10071 | MAY_READWRITE, &ad); |
10072 | } |
10073 | diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c |
10074 | index 10c3a87..b310702 100644 |
10075 | --- a/sound/atmel/ac97c.c |
10076 | +++ b/sound/atmel/ac97c.c |
10077 | @@ -33,9 +33,12 @@ |
10078 | #include <linux/dw_dmac.h> |
10079 | |
10080 | #include <mach/cpu.h> |
10081 | -#include <mach/hardware.h> |
10082 | #include <mach/gpio.h> |
10083 | |
10084 | +#ifdef CONFIG_ARCH_AT91 |
10085 | +#include <mach/hardware.h> |
10086 | +#endif |
10087 | + |
10088 | #include "ac97c.h" |
10089 | |
10090 | enum { |
10091 | diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c |
10092 | index 7730575..07efa29 100644 |
10093 | --- a/sound/core/hrtimer.c |
10094 | +++ b/sound/core/hrtimer.c |
10095 | @@ -45,12 +45,13 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) |
10096 | { |
10097 | struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt); |
10098 | struct snd_timer *t = stime->timer; |
10099 | + unsigned long oruns; |
10100 | |
10101 | if (!atomic_read(&stime->running)) |
10102 | return HRTIMER_NORESTART; |
10103 | |
10104 | - hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); |
10105 | - snd_timer_interrupt(stime->timer, t->sticks); |
10106 | + oruns = hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); |
10107 | + snd_timer_interrupt(stime->timer, t->sticks * oruns); |
10108 | |
10109 | if (!atomic_read(&stime->running)) |
10110 | return HRTIMER_NORESTART; |
10111 | diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c |
10112 | index b9d2f20..5439d66 100644 |
10113 | --- a/sound/pci/au88x0/au88x0_pcm.c |
10114 | +++ b/sound/pci/au88x0/au88x0_pcm.c |
10115 | @@ -42,11 +42,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_adb = { |
10116 | .rate_min = 5000, |
10117 | .rate_max = 48000, |
10118 | .channels_min = 1, |
10119 | -#ifdef CHIP_AU8830 |
10120 | - .channels_max = 4, |
10121 | -#else |
10122 | .channels_max = 2, |
10123 | -#endif |
10124 | .buffer_bytes_max = 0x10000, |
10125 | .period_bytes_min = 0x1, |
10126 | .period_bytes_max = 0x1000, |
10127 | @@ -115,6 +111,17 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_wt = { |
10128 | .periods_max = 64, |
10129 | }; |
10130 | #endif |
10131 | +#ifdef CHIP_AU8830 |
10132 | +static unsigned int au8830_channels[3] = { |
10133 | + 1, 2, 4, |
10134 | +}; |
10135 | + |
10136 | +static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = { |
10137 | + .count = ARRAY_SIZE(au8830_channels), |
10138 | + .list = au8830_channels, |
10139 | + .mask = 0, |
10140 | +}; |
10141 | +#endif |
10142 | /* open callback */ |
10143 | static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) |
10144 | { |
10145 | @@ -156,6 +163,15 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) |
10146 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB |
10147 | || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S) |
10148 | runtime->hw = snd_vortex_playback_hw_adb; |
10149 | +#ifdef CHIP_AU8830 |
10150 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
10151 | + VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) { |
10152 | + runtime->hw.channels_max = 4; |
10153 | + snd_pcm_hw_constraint_list(runtime, 0, |
10154 | + SNDRV_PCM_HW_PARAM_CHANNELS, |
10155 | + &hw_constraints_au8830_channels); |
10156 | + } |
10157 | +#endif |
10158 | substream->runtime->private_data = NULL; |
10159 | } |
10160 | #ifndef CHIP_AU8810 |
10161 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
10162 | index 98b6d02..05e5ec8 100644 |
10163 | --- a/sound/pci/hda/hda_codec.c |
10164 | +++ b/sound/pci/hda/hda_codec.c |
10165 | @@ -4571,6 +4571,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, |
10166 | } |
10167 | memset(cfg->hp_pins + cfg->hp_outs, 0, |
10168 | sizeof(hda_nid_t) * (AUTO_CFG_MAX_OUTS - cfg->hp_outs)); |
10169 | + if (!cfg->hp_outs) |
10170 | + cfg->line_out_type = AUTO_PIN_HP_OUT; |
10171 | + |
10172 | } |
10173 | |
10174 | /* sort by sequence */ |
10175 | diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c |
10176 | index 4a66347..74b0560 100644 |
10177 | --- a/sound/pci/hda/hda_eld.c |
10178 | +++ b/sound/pci/hda/hda_eld.c |
10179 | @@ -381,7 +381,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) |
10180 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); |
10181 | |
10182 | if (a->format == AUDIO_CODING_TYPE_LPCM) |
10183 | - snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8)); |
10184 | + snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); |
10185 | else if (a->max_bitrate) |
10186 | snprintf(buf2, sizeof(buf2), |
10187 | ", max bitrate = %d", a->max_bitrate); |
10188 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
10189 | index 76bd58a..5667fb9 100644 |
10190 | --- a/sound/pci/hda/patch_conexant.c |
10191 | +++ b/sound/pci/hda/patch_conexant.c |
10192 | @@ -403,10 +403,16 @@ static int conexant_add_jack(struct hda_codec *codec, |
10193 | struct conexant_spec *spec; |
10194 | struct conexant_jack *jack; |
10195 | const char *name; |
10196 | - int err; |
10197 | + int i, err; |
10198 | |
10199 | spec = codec->spec; |
10200 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
10201 | + |
10202 | + jack = spec->jacks.list; |
10203 | + for (i = 0; i < spec->jacks.used; i++, jack++) |
10204 | + if (jack->nid == nid) |
10205 | + return 0 ; /* already present */ |
10206 | + |
10207 | jack = snd_array_new(&spec->jacks); |
10208 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
10209 | |
10210 | @@ -3097,6 +3103,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { |
10211 | SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD), |
10212 | SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO), |
10213 | SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD), |
10214 | + SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), |
10215 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
10216 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
10217 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
10218 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
10219 | index 31df774..232833b 100644 |
10220 | --- a/sound/pci/hda/patch_hdmi.c |
10221 | +++ b/sound/pci/hda/patch_hdmi.c |
10222 | @@ -31,10 +31,15 @@ |
10223 | #include <linux/init.h> |
10224 | #include <linux/delay.h> |
10225 | #include <linux/slab.h> |
10226 | +#include <linux/moduleparam.h> |
10227 | #include <sound/core.h> |
10228 | #include "hda_codec.h" |
10229 | #include "hda_local.h" |
10230 | |
10231 | +static bool static_hdmi_pcm; |
10232 | +module_param(static_hdmi_pcm, bool, 0644); |
10233 | +MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); |
10234 | + |
10235 | /* |
10236 | * The HDMI/DisplayPort configuration can be highly dynamic. A graphics device |
10237 | * could support two independent pipes, each of them can be connected to one or |
10238 | @@ -637,6 +642,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, |
10239 | hdmi_ai->ver = 0x01; |
10240 | hdmi_ai->len = 0x0a; |
10241 | hdmi_ai->CC02_CT47 = channels - 1; |
10242 | + hdmi_ai->CA = ca; |
10243 | hdmi_checksum_audio_infoframe(hdmi_ai); |
10244 | } else if (spec->sink_eld[i].conn_type == 1) { /* DisplayPort */ |
10245 | struct dp_audio_infoframe *dp_ai; |
10246 | @@ -646,6 +652,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, |
10247 | dp_ai->len = 0x1b; |
10248 | dp_ai->ver = 0x11 << 2; |
10249 | dp_ai->CC02_CT47 = channels - 1; |
10250 | + dp_ai->CA = ca; |
10251 | } else { |
10252 | snd_printd("HDMI: unknown connection type at pin %d\n", |
10253 | pin_nid); |
10254 | @@ -827,7 +834,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, |
10255 | *codec_pars = *hinfo; |
10256 | |
10257 | eld = &spec->sink_eld[idx]; |
10258 | - if (eld->sad_count > 0) { |
10259 | + if (!static_hdmi_pcm && eld->eld_valid && eld->sad_count > 0) { |
10260 | hdmi_eld_update_pcm_info(eld, hinfo, codec_pars); |
10261 | if (hinfo->channels_min > hinfo->channels_max || |
10262 | !hinfo->rates || !hinfo->formats) |
10263 | @@ -1165,11 +1172,53 @@ static int nvhdmi_7x_init(struct hda_codec *codec) |
10264 | return 0; |
10265 | } |
10266 | |
10267 | +static unsigned int channels_2_6_8[] = { |
10268 | + 2, 6, 8 |
10269 | +}; |
10270 | + |
10271 | +static unsigned int channels_2_8[] = { |
10272 | + 2, 8 |
10273 | +}; |
10274 | + |
10275 | +static struct snd_pcm_hw_constraint_list hw_constraints_2_6_8_channels = { |
10276 | + .count = ARRAY_SIZE(channels_2_6_8), |
10277 | + .list = channels_2_6_8, |
10278 | + .mask = 0, |
10279 | +}; |
10280 | + |
10281 | +static struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = { |
10282 | + .count = ARRAY_SIZE(channels_2_8), |
10283 | + .list = channels_2_8, |
10284 | + .mask = 0, |
10285 | +}; |
10286 | + |
10287 | static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo, |
10288 | struct hda_codec *codec, |
10289 | struct snd_pcm_substream *substream) |
10290 | { |
10291 | struct hdmi_spec *spec = codec->spec; |
10292 | + struct snd_pcm_hw_constraint_list *hw_constraints_channels = NULL; |
10293 | + |
10294 | + switch (codec->preset->id) { |
10295 | + case 0x10de0002: |
10296 | + case 0x10de0003: |
10297 | + case 0x10de0005: |
10298 | + case 0x10de0006: |
10299 | + hw_constraints_channels = &hw_constraints_2_8_channels; |
10300 | + break; |
10301 | + case 0x10de0007: |
10302 | + hw_constraints_channels = &hw_constraints_2_6_8_channels; |
10303 | + break; |
10304 | + default: |
10305 | + break; |
10306 | + } |
10307 | + |
10308 | + if (hw_constraints_channels != NULL) { |
10309 | + snd_pcm_hw_constraint_list(substream->runtime, 0, |
10310 | + SNDRV_PCM_HW_PARAM_CHANNELS, |
10311 | + hw_constraints_channels); |
10312 | + } |
10313 | + |
10314 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
10315 | } |
10316 | |
10317 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
10318 | index 552a09e..0bc6e4e 100644 |
10319 | --- a/sound/pci/hda/patch_realtek.c |
10320 | +++ b/sound/pci/hda/patch_realtek.c |
10321 | @@ -14824,6 +14824,7 @@ static const struct alc_fixup alc269_fixups[] = { |
10322 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
10323 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
10324 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
10325 | + {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
10326 | { } |
10327 | } |
10328 | }, |
10329 | @@ -19379,6 +19380,7 @@ static const struct alc_fixup alc662_fixups[] = { |
10330 | }; |
10331 | |
10332 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
10333 | + SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
10334 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
10335 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
10336 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
10337 | diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c |
10338 | index f03b2ff..fc16beb 100644 |
10339 | --- a/sound/pci/hda/patch_sigmatel.c |
10340 | +++ b/sound/pci/hda/patch_sigmatel.c |
10341 | @@ -3591,7 +3591,7 @@ static int stac_check_auto_mic(struct hda_codec *codec) |
10342 | if (check_mic_pin(codec, spec->dmic_nids[i], |
10343 | &fixed, &ext, &dock)) |
10344 | return 0; |
10345 | - if (!fixed && !ext && !dock) |
10346 | + if (!fixed || (!ext && !dock)) |
10347 | return 0; /* no input to switch */ |
10348 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
10349 | return 0; /* no unsol support */ |
10350 | diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c |
10351 | index c5f856e..ffbac26 100644 |
10352 | --- a/sound/soc/blackfin/bf5xx-ac97.c |
10353 | +++ b/sound/soc/blackfin/bf5xx-ac97.c |
10354 | @@ -260,9 +260,9 @@ static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) |
10355 | pr_debug("%s : sport %d\n", __func__, dai->id); |
10356 | if (!dai->active) |
10357 | return 0; |
10358 | - if (dai->capture.active) |
10359 | + if (dai->capture_active) |
10360 | sport_rx_stop(sport); |
10361 | - if (dai->playback.active) |
10362 | + if (dai->playback_active) |
10363 | sport_tx_stop(sport); |
10364 | return 0; |
10365 | } |
10366 | diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c |
10367 | index 1251239..b2cf239 100644 |
10368 | --- a/sound/soc/blackfin/bf5xx-tdm.c |
10369 | +++ b/sound/soc/blackfin/bf5xx-tdm.c |
10370 | @@ -210,7 +210,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai, |
10371 | #ifdef CONFIG_PM |
10372 | static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) |
10373 | { |
10374 | - struct sport_device *sport = dai->private_data; |
10375 | + struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
10376 | |
10377 | if (!dai->active) |
10378 | return 0; |
10379 | diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c |
10380 | index 264828e..f007d77 100644 |
10381 | --- a/sound/soc/codecs/wm8990.c |
10382 | +++ b/sound/soc/codecs/wm8990.c |
10383 | @@ -1183,7 +1183,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, |
10384 | WM8990_VMIDTOG); |
10385 | |
10386 | /* Delay to allow output caps to discharge */ |
10387 | - msleep(msecs_to_jiffies(300)); |
10388 | + msleep(300); |
10389 | |
10390 | /* Disable VMIDTOG */ |
10391 | snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | |
10392 | @@ -1195,17 +1195,17 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, |
10393 | /* Enable outputs */ |
10394 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1b00); |
10395 | |
10396 | - msleep(msecs_to_jiffies(50)); |
10397 | + msleep(50); |
10398 | |
10399 | /* Enable VMID at 2x50k */ |
10400 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f02); |
10401 | |
10402 | - msleep(msecs_to_jiffies(100)); |
10403 | + msleep(100); |
10404 | |
10405 | /* Enable VREF */ |
10406 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f03); |
10407 | |
10408 | - msleep(msecs_to_jiffies(600)); |
10409 | + msleep(600); |
10410 | |
10411 | /* Enable BUFIOEN */ |
10412 | snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | |
10413 | @@ -1250,7 +1250,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, |
10414 | /* Disable VMID */ |
10415 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f01); |
10416 | |
10417 | - msleep(msecs_to_jiffies(300)); |
10418 | + msleep(300); |
10419 | |
10420 | /* Enable all output discharge bits */ |
10421 | snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | |
10422 | diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c |
10423 | index 4d3e6f1..f451a2c 100644 |
10424 | --- a/sound/soc/codecs/wm8994.c |
10425 | +++ b/sound/soc/codecs/wm8994.c |
10426 | @@ -2536,18 +2536,18 @@ SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), |
10427 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), |
10428 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), |
10429 | |
10430 | -SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", "AIF1 Capture", |
10431 | +SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, |
10432 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), |
10433 | -SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", "AIF1 Capture", |
10434 | +SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, |
10435 | 0, WM8994_POWER_MANAGEMENT_4, 8, 0), |
10436 | SND_SOC_DAPM_AIF_IN("AIF1DAC1L", NULL, 0, |
10437 | WM8994_POWER_MANAGEMENT_5, 9, 0), |
10438 | SND_SOC_DAPM_AIF_IN("AIF1DAC1R", NULL, 0, |
10439 | WM8994_POWER_MANAGEMENT_5, 8, 0), |
10440 | |
10441 | -SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", "AIF1 Capture", |
10442 | +SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL, |
10443 | 0, WM8994_POWER_MANAGEMENT_4, 11, 0), |
10444 | -SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", "AIF1 Capture", |
10445 | +SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL, |
10446 | 0, WM8994_POWER_MANAGEMENT_4, 10, 0), |
10447 | SND_SOC_DAPM_AIF_IN("AIF1DAC2L", NULL, 0, |
10448 | WM8994_POWER_MANAGEMENT_5, 11, 0), |
10449 | @@ -2588,6 +2588,7 @@ SND_SOC_DAPM_AIF_IN("AIF2DACR", NULL, 0, |
10450 | |
10451 | SND_SOC_DAPM_AIF_IN("AIF1DACDAT", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), |
10452 | SND_SOC_DAPM_AIF_IN("AIF2DACDAT", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0), |
10453 | +SND_SOC_DAPM_AIF_OUT("AIF1ADCDAT", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0), |
10454 | SND_SOC_DAPM_AIF_OUT("AIF2ADCDAT", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0), |
10455 | |
10456 | SND_SOC_DAPM_MUX("AIF1DAC Mux", SND_SOC_NOPM, 0, 0, &aif1dac_mux), |
10457 | @@ -2783,6 +2784,11 @@ static const struct snd_soc_dapm_route intercon[] = { |
10458 | { "AIF2DAC2R Mixer", "Left Sidetone Switch", "Left Sidetone" }, |
10459 | { "AIF2DAC2R Mixer", "Right Sidetone Switch", "Right Sidetone" }, |
10460 | |
10461 | + { "AIF1ADCDAT", NULL, "AIF1ADC1L" }, |
10462 | + { "AIF1ADCDAT", NULL, "AIF1ADC1R" }, |
10463 | + { "AIF1ADCDAT", NULL, "AIF1ADC2L" }, |
10464 | + { "AIF1ADCDAT", NULL, "AIF1ADC2R" }, |
10465 | + |
10466 | { "AIF2ADCDAT", NULL, "AIF2ADC Mux" }, |
10467 | |
10468 | /* AIF3 output */ |
10469 | @@ -2930,6 +2936,7 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, |
10470 | /* Allow no source specification when stopping */ |
10471 | if (freq_out) |
10472 | return -EINVAL; |
10473 | + src = wm8994->fll[id].src; |
10474 | break; |
10475 | case WM8994_FLL_SRC_MCLK1: |
10476 | case WM8994_FLL_SRC_MCLK2: |
10477 | @@ -3512,7 +3519,7 @@ static int wm8994_set_tristate(struct snd_soc_dai *codec_dai, int tristate) |
10478 | else |
10479 | val = 0; |
10480 | |
10481 | - return snd_soc_update_bits(codec, reg, mask, reg); |
10482 | + return snd_soc_update_bits(codec, reg, mask, val); |
10483 | } |
10484 | |
10485 | #define WM8994_RATES SNDRV_PCM_RATE_8000_96000 |
10486 | diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c |
10487 | index 0e24092..feacf18 100644 |
10488 | --- a/sound/soc/codecs/wm_hubs.c |
10489 | +++ b/sound/soc/codecs/wm_hubs.c |
10490 | @@ -92,6 +92,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) |
10491 | static void calibrate_dc_servo(struct snd_soc_codec *codec) |
10492 | { |
10493 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
10494 | + s8 offset; |
10495 | u16 reg, reg_l, reg_r, dcs_cfg; |
10496 | |
10497 | /* Set for 32 series updates */ |
10498 | @@ -130,16 +131,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) |
10499 | dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r); |
10500 | |
10501 | /* HPOUT1L */ |
10502 | - if (reg_l + hubs->dcs_codes > 0 && |
10503 | - reg_l + hubs->dcs_codes < 0xff) |
10504 | - reg_l += hubs->dcs_codes; |
10505 | - dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT; |
10506 | + offset = reg_l; |
10507 | + offset += hubs->dcs_codes; |
10508 | + dcs_cfg = (u8)offset << WM8993_DCS_DAC_WR_VAL_1_SHIFT; |
10509 | |
10510 | /* HPOUT1R */ |
10511 | - if (reg_r + hubs->dcs_codes > 0 && |
10512 | - reg_r + hubs->dcs_codes < 0xff) |
10513 | - reg_r += hubs->dcs_codes; |
10514 | - dcs_cfg |= reg_r; |
10515 | + offset = reg_r; |
10516 | + offset += hubs->dcs_codes; |
10517 | + dcs_cfg |= (u8)offset; |
10518 | |
10519 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); |
10520 | |
10521 | diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c |
10522 | index bc9e6b0..07db881 100644 |
10523 | --- a/sound/soc/davinci/davinci-evm.c |
10524 | +++ b/sound/soc/davinci/davinci-evm.c |
10525 | @@ -224,7 +224,7 @@ static struct snd_soc_dai_link da8xx_evm_dai = { |
10526 | .stream_name = "AIC3X", |
10527 | .cpu_dai_name= "davinci-mcasp.0", |
10528 | .codec_dai_name = "tlv320aic3x-hifi", |
10529 | - .codec_name = "tlv320aic3x-codec.0-001a", |
10530 | + .codec_name = "tlv320aic3x-codec.1-0018", |
10531 | .platform_name = "davinci-pcm-audio", |
10532 | .init = evm_aic3x_init, |
10533 | .ops = &evm_ops, |
10534 | diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c |
10535 | index f451acd..135d903 100644 |
10536 | --- a/sound/soc/pxa/corgi.c |
10537 | +++ b/sound/soc/pxa/corgi.c |
10538 | @@ -305,10 +305,10 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
10539 | static struct snd_soc_dai_link corgi_dai = { |
10540 | .name = "WM8731", |
10541 | .stream_name = "WM8731", |
10542 | - .cpu_dai_name = "pxa-is2-dai", |
10543 | + .cpu_dai_name = "pxa2xx-i2s", |
10544 | .codec_dai_name = "wm8731-hifi", |
10545 | .platform_name = "pxa-pcm-audio", |
10546 | - .codec_name = "wm8731-codec-0.001a", |
10547 | + .codec_name = "wm8731-codec-0.001b", |
10548 | .init = corgi_wm8731_init, |
10549 | .ops = &corgi_ops, |
10550 | }; |
10551 | diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c |
10552 | index 84edd03..0eebe11 100644 |
10553 | --- a/sound/soc/pxa/poodle.c |
10554 | +++ b/sound/soc/pxa/poodle.c |
10555 | @@ -274,7 +274,7 @@ static struct snd_soc_dai_link poodle_dai = { |
10556 | .cpu_dai_name = "pxa2xx-i2s", |
10557 | .codec_dai_name = "wm8731-hifi", |
10558 | .platform_name = "pxa-pcm-audio", |
10559 | - .codec_name = "wm8731-codec.0-001a", |
10560 | + .codec_name = "wm8731-codec.0-001b", |
10561 | .init = poodle_wm8731_init, |
10562 | .ops = &poodle_ops, |
10563 | }; |
10564 | diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c |
10565 | index 0b30d7d..7604471 100644 |
10566 | --- a/sound/soc/pxa/spitz.c |
10567 | +++ b/sound/soc/pxa/spitz.c |
10568 | @@ -313,10 +313,10 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) |
10569 | static struct snd_soc_dai_link spitz_dai = { |
10570 | .name = "wm8750", |
10571 | .stream_name = "WM8750", |
10572 | - .cpu_dai_name = "pxa-is2", |
10573 | + .cpu_dai_name = "pxa2xx-i2s", |
10574 | .codec_dai_name = "wm8750-hifi", |
10575 | .platform_name = "pxa-pcm-audio", |
10576 | - .codec_name = "wm8750-codec.0-001a", |
10577 | + .codec_name = "wm8750-codec.0-001b", |
10578 | .init = spitz_wm8750_init, |
10579 | .ops = &spitz_ops, |
10580 | }; |
10581 | diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
10582 | index 85b7d54..757ba59 100644 |
10583 | --- a/sound/soc/soc-core.c |
10584 | +++ b/sound/soc/soc-core.c |
10585 | @@ -1623,7 +1623,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) |
10586 | if (ret < 0) { |
10587 | printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); |
10588 | while (--i >= 0) |
10589 | - soc_unregister_ac97_dai_link(&card->rtd[i]); |
10590 | + soc_unregister_ac97_dai_link(card->rtd[i].codec); |
10591 | goto probe_dai_err; |
10592 | } |
10593 | } |
10594 | diff --git a/sound/usb/midi.c b/sound/usb/midi.c |
10595 | index 25bce7e..b1f9ec9 100644 |
10596 | --- a/sound/usb/midi.c |
10597 | +++ b/sound/usb/midi.c |
10598 | @@ -850,8 +850,8 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep, |
10599 | return; |
10600 | } |
10601 | |
10602 | - memset(urb->transfer_buffer + count, 0xFD, 9 - count); |
10603 | - urb->transfer_buffer_length = count; |
10604 | + memset(urb->transfer_buffer + count, 0xFD, ep->max_transfer - count); |
10605 | + urb->transfer_buffer_length = ep->max_transfer; |
10606 | } |
10607 | |
10608 | static struct usb_protocol_ops snd_usbmidi_122l_ops = { |
10609 | @@ -1295,6 +1295,13 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, |
10610 | case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */ |
10611 | ep->max_transfer = 4; |
10612 | break; |
10613 | + /* |
10614 | + * Some devices only work with 9 bytes packet size: |
10615 | + */ |
10616 | + case USB_ID(0x0644, 0x800E): /* Tascam US-122L */ |
10617 | + case USB_ID(0x0644, 0x800F): /* Tascam US-144 */ |
10618 | + ep->max_transfer = 9; |
10619 | + break; |
10620 | } |
10621 | for (i = 0; i < OUTPUT_URBS; ++i) { |
10622 | buffer = usb_alloc_coherent(umidi->dev, |
10623 | diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c |
10624 | index 6ef68e4..084e6fc 100644 |
10625 | --- a/sound/usb/usx2y/us122l.c |
10626 | +++ b/sound/usb/usx2y/us122l.c |
10627 | @@ -273,29 +273,26 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw, |
10628 | struct file *file, poll_table *wait) |
10629 | { |
10630 | struct us122l *us122l = hw->private_data; |
10631 | - struct usb_stream *s = us122l->sk.s; |
10632 | unsigned *polled; |
10633 | unsigned int mask; |
10634 | |
10635 | poll_wait(file, &us122l->sk.sleep, wait); |
10636 | |
10637 | - switch (s->state) { |
10638 | - case usb_stream_ready: |
10639 | - if (us122l->first == file) |
10640 | - polled = &s->periods_polled; |
10641 | - else |
10642 | - polled = &us122l->second_periods_polled; |
10643 | - if (*polled != s->periods_done) { |
10644 | - *polled = s->periods_done; |
10645 | - mask = POLLIN | POLLOUT | POLLWRNORM; |
10646 | - break; |
10647 | + mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR; |
10648 | + if (mutex_trylock(&us122l->mutex)) { |
10649 | + struct usb_stream *s = us122l->sk.s; |
10650 | + if (s && s->state == usb_stream_ready) { |
10651 | + if (us122l->first == file) |
10652 | + polled = &s->periods_polled; |
10653 | + else |
10654 | + polled = &us122l->second_periods_polled; |
10655 | + if (*polled != s->periods_done) { |
10656 | + *polled = s->periods_done; |
10657 | + mask = POLLIN | POLLOUT | POLLWRNORM; |
10658 | + } else |
10659 | + mask = 0; |
10660 | } |
10661 | - /* Fall through */ |
10662 | - mask = 0; |
10663 | - break; |
10664 | - default: |
10665 | - mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR; |
10666 | - break; |
10667 | + mutex_unlock(&us122l->mutex); |
10668 | } |
10669 | return mask; |
10670 | } |
10671 | @@ -381,6 +378,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, |
10672 | { |
10673 | struct usb_stream_config *cfg; |
10674 | struct us122l *us122l = hw->private_data; |
10675 | + struct usb_stream *s; |
10676 | unsigned min_period_frames; |
10677 | int err = 0; |
10678 | bool high_speed; |
10679 | @@ -426,18 +424,18 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, |
10680 | snd_power_wait(hw->card, SNDRV_CTL_POWER_D0); |
10681 | |
10682 | mutex_lock(&us122l->mutex); |
10683 | + s = us122l->sk.s; |
10684 | if (!us122l->master) |
10685 | us122l->master = file; |
10686 | else if (us122l->master != file) { |
10687 | - if (memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg))) { |
10688 | + if (!s || memcmp(cfg, &s->cfg, sizeof(*cfg))) { |
10689 | err = -EIO; |
10690 | goto unlock; |
10691 | } |
10692 | us122l->slave = file; |
10693 | } |
10694 | - if (!us122l->sk.s || |
10695 | - memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg)) || |
10696 | - us122l->sk.s->state == usb_stream_xrun) { |
10697 | + if (!s || memcmp(cfg, &s->cfg, sizeof(*cfg)) || |
10698 | + s->state == usb_stream_xrun) { |
10699 | us122l_stop(us122l); |
10700 | if (!us122l_start(us122l, cfg->sample_rate, cfg->period_frames)) |
10701 | err = -EIO; |
10702 | @@ -448,6 +446,7 @@ unlock: |
10703 | mutex_unlock(&us122l->mutex); |
10704 | free: |
10705 | kfree(cfg); |
10706 | + wake_up_all(&us122l->sk.sleep); |
10707 | return err; |
10708 | } |
10709 |