/[linux-patches]/genpatches-2.6/trunk/3.4/1011_linux-3.4.12.patch
Gentoo

Contents of /genpatches-2.6/trunk/3.4/1011_linux-3.4.12.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2254 - (show annotations) (download)
Wed Dec 19 19:51:16 2012 UTC (2 years ago) by mpagano
File size: 281165 byte(s)
Linux patches 3.4.12 through and including 3.4.24
1 diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
2 index 286ec04..82dd174 100644
3 --- a/Documentation/sound/alsa/HD-Audio-Models.txt
4 +++ b/Documentation/sound/alsa/HD-Audio-Models.txt
5 @@ -47,6 +47,7 @@ ALC882/883/885/888/889
6 acer-aspire-4930g Acer Aspire 4930G/5930G/6530G/6930G/7730G
7 acer-aspire-8930g Acer Aspire 8330G/6935G
8 acer-aspire Acer Aspire others
9 + no-primary-hp VAIO Z workaround (for fixed speaker DAC)
10
11 ALC861/660
12 ==========
13 diff --git a/Makefile b/Makefile
14 index 22345c0..bcf5bc4 100644
15 --- a/Makefile
16 +++ b/Makefile
17 @@ -1,6 +1,6 @@
18 VERSION = 3
19 PATCHLEVEL = 4
20 -SUBLEVEL = 11
21 +SUBLEVEL = 12
22 EXTRAVERSION =
23 NAME = Saber-toothed Squirrel
24
25 diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
26 index 3bb7ffe..c2cbe4f 100644
27 --- a/arch/alpha/include/asm/atomic.h
28 +++ b/arch/alpha/include/asm/atomic.h
29 @@ -14,8 +14,8 @@
30 */
31
32
33 -#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
34 -#define ATOMIC64_INIT(i) ( (atomic64_t) { (i) } )
35 +#define ATOMIC_INIT(i) { (i) }
36 +#define ATOMIC64_INIT(i) { (i) }
37
38 #define atomic_read(v) (*(volatile int *)&(v)->counter)
39 #define atomic64_read(v) (*(volatile long *)&(v)->counter)
40 diff --git a/arch/arm/Makefile b/arch/arm/Makefile
41 index 047a207..1d6402c 100644
42 --- a/arch/arm/Makefile
43 +++ b/arch/arm/Makefile
44 @@ -283,10 +283,10 @@ zImage Image xipImage bootpImage uImage: vmlinux
45 zinstall uinstall install: vmlinux
46 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
47
48 -%.dtb:
49 +%.dtb: scripts
50 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
51
52 -dtbs:
53 +dtbs: scripts
54 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
55
56 # We use MRPROPER_FILES and CLEAN_FILES now
57 diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
58 index dc7e8ce..87278fc 100644
59 --- a/arch/arm/boot/compressed/head.S
60 +++ b/arch/arm/boot/compressed/head.S
61 @@ -648,6 +648,7 @@ __armv7_mmu_cache_on:
62 mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
63 #endif
64 mrc p15, 0, r0, c1, c0, 0 @ read control reg
65 + bic r0, r0, #1 << 28 @ clear SCTLR.TRE
66 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
67 orr r0, r0, #0x003c @ write buffer
68 #ifdef CONFIG_MMU
69 diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
70 index 03fb936..5c8b3bf4 100644
71 --- a/arch/arm/include/asm/assembler.h
72 +++ b/arch/arm/include/asm/assembler.h
73 @@ -320,4 +320,12 @@
74 .size \name , . - \name
75 .endm
76
77 + .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
78 +#ifndef CONFIG_CPU_USE_DOMAINS
79 + adds \tmp, \addr, #\size - 1
80 + sbcccs \tmp, \tmp, \limit
81 + bcs \bad
82 +#endif
83 + .endm
84 +
85 #endif /* __ASM_ASSEMBLER_H__ */
86 diff --git a/arch/arm/include/asm/mutex.h b/arch/arm/include/asm/mutex.h
87 index 93226cf..b1479fd 100644
88 --- a/arch/arm/include/asm/mutex.h
89 +++ b/arch/arm/include/asm/mutex.h
90 @@ -7,121 +7,10 @@
91 */
92 #ifndef _ASM_MUTEX_H
93 #define _ASM_MUTEX_H
94 -
95 -#if __LINUX_ARM_ARCH__ < 6
96 -/* On pre-ARMv6 hardware the swp based implementation is the most efficient. */
97 -# include <asm-generic/mutex-xchg.h>
98 -#else
99 -
100 /*
101 - * Attempting to lock a mutex on ARMv6+ can be done with a bastardized
102 - * atomic decrement (it is not a reliable atomic decrement but it satisfies
103 - * the defined semantics for our purpose, while being smaller and faster
104 - * than a real atomic decrement or atomic swap. The idea is to attempt
105 - * decrementing the lock value only once. If once decremented it isn't zero,
106 - * or if its store-back fails due to a dispute on the exclusive store, we
107 - * simply bail out immediately through the slow path where the lock will be
108 - * reattempted until it succeeds.
109 + * On pre-ARMv6 hardware this results in a swp-based implementation,
110 + * which is the most efficient. For ARMv6+, we emit a pair of exclusive
111 + * accesses instead.
112 */
113 -static inline void
114 -__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
115 -{
116 - int __ex_flag, __res;
117 -
118 - __asm__ (
119 -
120 - "ldrex %0, [%2] \n\t"
121 - "sub %0, %0, #1 \n\t"
122 - "strex %1, %0, [%2] "
123 -
124 - : "=&r" (__res), "=&r" (__ex_flag)
125 - : "r" (&(count)->counter)
126 - : "cc","memory" );
127 -
128 - __res |= __ex_flag;
129 - if (unlikely(__res != 0))
130 - fail_fn(count);
131 -}
132 -
133 -static inline int
134 -__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
135 -{
136 - int __ex_flag, __res;
137 -
138 - __asm__ (
139 -
140 - "ldrex %0, [%2] \n\t"
141 - "sub %0, %0, #1 \n\t"
142 - "strex %1, %0, [%2] "
143 -
144 - : "=&r" (__res), "=&r" (__ex_flag)
145 - : "r" (&(count)->counter)
146 - : "cc","memory" );
147 -
148 - __res |= __ex_flag;
149 - if (unlikely(__res != 0))
150 - __res = fail_fn(count);
151 - return __res;
152 -}
153 -
154 -/*
155 - * Same trick is used for the unlock fast path. However the original value,
156 - * rather than the result, is used to test for success in order to have
157 - * better generated assembly.
158 - */
159 -static inline void
160 -__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
161 -{
162 - int __ex_flag, __res, __orig;
163 -
164 - __asm__ (
165 -
166 - "ldrex %0, [%3] \n\t"
167 - "add %1, %0, #1 \n\t"
168 - "strex %2, %1, [%3] "
169 -
170 - : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
171 - : "r" (&(count)->counter)
172 - : "cc","memory" );
173 -
174 - __orig |= __ex_flag;
175 - if (unlikely(__orig != 0))
176 - fail_fn(count);
177 -}
178 -
179 -/*
180 - * If the unlock was done on a contended lock, or if the unlock simply fails
181 - * then the mutex remains locked.
182 - */
183 -#define __mutex_slowpath_needs_to_unlock() 1
184 -
185 -/*
186 - * For __mutex_fastpath_trylock we use another construct which could be
187 - * described as a "single value cmpxchg".
188 - *
189 - * This provides the needed trylock semantics like cmpxchg would, but it is
190 - * lighter and less generic than a true cmpxchg implementation.
191 - */
192 -static inline int
193 -__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
194 -{
195 - int __ex_flag, __res, __orig;
196 -
197 - __asm__ (
198 -
199 - "1: ldrex %0, [%3] \n\t"
200 - "subs %1, %0, #1 \n\t"
201 - "strexeq %2, %1, [%3] \n\t"
202 - "movlt %0, #0 \n\t"
203 - "cmpeq %2, #0 \n\t"
204 - "bgt 1b "
205 -
206 - : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
207 - : "r" (&count->counter)
208 - : "cc", "memory" );
209 -
210 - return __orig;
211 -}
212 -
213 -#endif
214 +#include <asm-generic/mutex-xchg.h>
215 #endif
216 diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
217 index 71f6536..0a070e9 100644
218 --- a/arch/arm/include/asm/uaccess.h
219 +++ b/arch/arm/include/asm/uaccess.h
220 @@ -101,28 +101,39 @@ extern int __get_user_1(void *);
221 extern int __get_user_2(void *);
222 extern int __get_user_4(void *);
223
224 -#define __get_user_x(__r2,__p,__e,__s,__i...) \
225 +#define __GUP_CLOBBER_1 "lr", "cc"
226 +#ifdef CONFIG_CPU_USE_DOMAINS
227 +#define __GUP_CLOBBER_2 "ip", "lr", "cc"
228 +#else
229 +#define __GUP_CLOBBER_2 "lr", "cc"
230 +#endif
231 +#define __GUP_CLOBBER_4 "lr", "cc"
232 +
233 +#define __get_user_x(__r2,__p,__e,__l,__s) \
234 __asm__ __volatile__ ( \
235 __asmeq("%0", "r0") __asmeq("%1", "r2") \
236 + __asmeq("%3", "r1") \
237 "bl __get_user_" #__s \
238 : "=&r" (__e), "=r" (__r2) \
239 - : "0" (__p) \
240 - : __i, "cc")
241 + : "0" (__p), "r" (__l) \
242 + : __GUP_CLOBBER_##__s)
243
244 #define get_user(x,p) \
245 ({ \
246 + unsigned long __limit = current_thread_info()->addr_limit - 1; \
247 register const typeof(*(p)) __user *__p asm("r0") = (p);\
248 register unsigned long __r2 asm("r2"); \
249 + register unsigned long __l asm("r1") = __limit; \
250 register int __e asm("r0"); \
251 switch (sizeof(*(__p))) { \
252 case 1: \
253 - __get_user_x(__r2, __p, __e, 1, "lr"); \
254 - break; \
255 + __get_user_x(__r2, __p, __e, __l, 1); \
256 + break; \
257 case 2: \
258 - __get_user_x(__r2, __p, __e, 2, "r3", "lr"); \
259 + __get_user_x(__r2, __p, __e, __l, 2); \
260 break; \
261 case 4: \
262 - __get_user_x(__r2, __p, __e, 4, "lr"); \
263 + __get_user_x(__r2, __p, __e, __l, 4); \
264 break; \
265 default: __e = __get_user_bad(); break; \
266 } \
267 @@ -135,31 +146,34 @@ extern int __put_user_2(void *, unsigned int);
268 extern int __put_user_4(void *, unsigned int);
269 extern int __put_user_8(void *, unsigned long long);
270
271 -#define __put_user_x(__r2,__p,__e,__s) \
272 +#define __put_user_x(__r2,__p,__e,__l,__s) \
273 __asm__ __volatile__ ( \
274 __asmeq("%0", "r0") __asmeq("%2", "r2") \
275 + __asmeq("%3", "r1") \
276 "bl __put_user_" #__s \
277 : "=&r" (__e) \
278 - : "0" (__p), "r" (__r2) \
279 + : "0" (__p), "r" (__r2), "r" (__l) \
280 : "ip", "lr", "cc")
281
282 #define put_user(x,p) \
283 ({ \
284 + unsigned long __limit = current_thread_info()->addr_limit - 1; \
285 register const typeof(*(p)) __r2 asm("r2") = (x); \
286 register const typeof(*(p)) __user *__p asm("r0") = (p);\
287 + register unsigned long __l asm("r1") = __limit; \
288 register int __e asm("r0"); \
289 switch (sizeof(*(__p))) { \
290 case 1: \
291 - __put_user_x(__r2, __p, __e, 1); \
292 + __put_user_x(__r2, __p, __e, __l, 1); \
293 break; \
294 case 2: \
295 - __put_user_x(__r2, __p, __e, 2); \
296 + __put_user_x(__r2, __p, __e, __l, 2); \
297 break; \
298 case 4: \
299 - __put_user_x(__r2, __p, __e, 4); \
300 + __put_user_x(__r2, __p, __e, __l, 4); \
301 break; \
302 case 8: \
303 - __put_user_x(__r2, __p, __e, 8); \
304 + __put_user_x(__r2, __p, __e, __l, 8); \
305 break; \
306 default: __e = __put_user_bad(); break; \
307 } \
308 diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
309 index ba386bd..18d39ea 100644
310 --- a/arch/arm/kernel/hw_breakpoint.c
311 +++ b/arch/arm/kernel/hw_breakpoint.c
312 @@ -159,6 +159,12 @@ static int debug_arch_supported(void)
313 arch >= ARM_DEBUG_ARCH_V7_1;
314 }
315
316 +/* Can we determine the watchpoint access type from the fsr? */
317 +static int debug_exception_updates_fsr(void)
318 +{
319 + return 0;
320 +}
321 +
322 /* Determine number of WRP registers available. */
323 static int get_num_wrp_resources(void)
324 {
325 @@ -619,18 +625,35 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
326 info->address &= ~alignment_mask;
327 info->ctrl.len <<= offset;
328
329 - /*
330 - * Currently we rely on an overflow handler to take
331 - * care of single-stepping the breakpoint when it fires.
332 - * In the case of userspace breakpoints on a core with V7 debug,
333 - * we can use the mismatch feature as a poor-man's hardware
334 - * single-step, but this only works for per-task breakpoints.
335 - */
336 - if (!bp->overflow_handler && (arch_check_bp_in_kernelspace(bp) ||
337 - !core_has_mismatch_brps() || !bp->hw.bp_target)) {
338 - pr_warning("overflow handler required but none found\n");
339 - ret = -EINVAL;
340 + if (!bp->overflow_handler) {
341 + /*
342 + * Mismatch breakpoints are required for single-stepping
343 + * breakpoints.
344 + */
345 + if (!core_has_mismatch_brps())
346 + return -EINVAL;
347 +
348 + /* We don't allow mismatch breakpoints in kernel space. */
349 + if (arch_check_bp_in_kernelspace(bp))
350 + return -EPERM;
351 +
352 + /*
353 + * Per-cpu breakpoints are not supported by our stepping
354 + * mechanism.
355 + */
356 + if (!bp->hw.bp_target)
357 + return -EINVAL;
358 +
359 + /*
360 + * We only support specific access types if the fsr
361 + * reports them.
362 + */
363 + if (!debug_exception_updates_fsr() &&
364 + (info->ctrl.type == ARM_BREAKPOINT_LOAD ||
365 + info->ctrl.type == ARM_BREAKPOINT_STORE))
366 + return -EINVAL;
367 }
368 +
369 out:
370 return ret;
371 }
372 @@ -706,10 +729,12 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
373 goto unlock;
374
375 /* Check that the access type matches. */
376 - access = (fsr & ARM_FSR_ACCESS_MASK) ? HW_BREAKPOINT_W :
377 - HW_BREAKPOINT_R;
378 - if (!(access & hw_breakpoint_type(wp)))
379 - goto unlock;
380 + if (debug_exception_updates_fsr()) {
381 + access = (fsr & ARM_FSR_ACCESS_MASK) ?
382 + HW_BREAKPOINT_W : HW_BREAKPOINT_R;
383 + if (!(access & hw_breakpoint_type(wp)))
384 + goto unlock;
385 + }
386
387 /* We have a winner. */
388 info->trigger = addr;
389 diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
390 index a8ad1e3..a53a5a3 100644
391 --- a/arch/arm/kernel/traps.c
392 +++ b/arch/arm/kernel/traps.c
393 @@ -388,20 +388,23 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
394 #endif
395 instr = *(u32 *) pc;
396 } else if (thumb_mode(regs)) {
397 - get_user(instr, (u16 __user *)pc);
398 + if (get_user(instr, (u16 __user *)pc))
399 + goto die_sig;
400 if (is_wide_instruction(instr)) {
401 unsigned int instr2;
402 - get_user(instr2, (u16 __user *)pc+1);
403 + if (get_user(instr2, (u16 __user *)pc+1))
404 + goto die_sig;
405 instr <<= 16;
406 instr |= instr2;
407 }
408 - } else {
409 - get_user(instr, (u32 __user *)pc);
410 + } else if (get_user(instr, (u32 __user *)pc)) {
411 + goto die_sig;
412 }
413
414 if (call_undef_hook(regs, instr) == 0)
415 return;
416
417 +die_sig:
418 #ifdef CONFIG_DEBUG_USER
419 if (user_debug & UDBG_UNDEFINED) {
420 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
421 diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
422 index 11093a7..9b06bb4 100644
423 --- a/arch/arm/lib/getuser.S
424 +++ b/arch/arm/lib/getuser.S
425 @@ -16,8 +16,9 @@
426 * __get_user_X
427 *
428 * Inputs: r0 contains the address
429 + * r1 contains the address limit, which must be preserved
430 * Outputs: r0 is the error code
431 - * r2, r3 contains the zero-extended value
432 + * r2 contains the zero-extended value
433 * lr corrupted
434 *
435 * No other registers must be altered. (see <asm/uaccess.h>
436 @@ -27,33 +28,39 @@
437 * Note also that it is intended that __get_user_bad is not global.
438 */
439 #include <linux/linkage.h>
440 +#include <asm/assembler.h>
441 #include <asm/errno.h>
442 #include <asm/domain.h>
443
444 ENTRY(__get_user_1)
445 + check_uaccess r0, 1, r1, r2, __get_user_bad
446 1: TUSER(ldrb) r2, [r0]
447 mov r0, #0
448 mov pc, lr
449 ENDPROC(__get_user_1)
450
451 ENTRY(__get_user_2)
452 -#ifdef CONFIG_THUMB2_KERNEL
453 -2: TUSER(ldrb) r2, [r0]
454 -3: TUSER(ldrb) r3, [r0, #1]
455 + check_uaccess r0, 2, r1, r2, __get_user_bad
456 +#ifdef CONFIG_CPU_USE_DOMAINS
457 +rb .req ip
458 +2: ldrbt r2, [r0], #1
459 +3: ldrbt rb, [r0], #0
460 #else
461 -2: TUSER(ldrb) r2, [r0], #1
462 -3: TUSER(ldrb) r3, [r0]
463 +rb .req r0
464 +2: ldrb r2, [r0]
465 +3: ldrb rb, [r0, #1]
466 #endif
467 #ifndef __ARMEB__
468 - orr r2, r2, r3, lsl #8
469 + orr r2, r2, rb, lsl #8
470 #else
471 - orr r2, r3, r2, lsl #8
472 + orr r2, rb, r2, lsl #8
473 #endif
474 mov r0, #0
475 mov pc, lr
476 ENDPROC(__get_user_2)
477
478 ENTRY(__get_user_4)
479 + check_uaccess r0, 4, r1, r2, __get_user_bad
480 4: TUSER(ldr) r2, [r0]
481 mov r0, #0
482 mov pc, lr
483 diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
484 index 7db2599..3d73dcb 100644
485 --- a/arch/arm/lib/putuser.S
486 +++ b/arch/arm/lib/putuser.S
487 @@ -16,6 +16,7 @@
488 * __put_user_X
489 *
490 * Inputs: r0 contains the address
491 + * r1 contains the address limit, which must be preserved
492 * r2, r3 contains the value
493 * Outputs: r0 is the error code
494 * lr corrupted
495 @@ -27,16 +28,19 @@
496 * Note also that it is intended that __put_user_bad is not global.
497 */
498 #include <linux/linkage.h>
499 +#include <asm/assembler.h>
500 #include <asm/errno.h>
501 #include <asm/domain.h>
502
503 ENTRY(__put_user_1)
504 + check_uaccess r0, 1, r1, ip, __put_user_bad
505 1: TUSER(strb) r2, [r0]
506 mov r0, #0
507 mov pc, lr
508 ENDPROC(__put_user_1)
509
510 ENTRY(__put_user_2)
511 + check_uaccess r0, 2, r1, ip, __put_user_bad
512 mov ip, r2, lsr #8
513 #ifdef CONFIG_THUMB2_KERNEL
514 #ifndef __ARMEB__
515 @@ -60,12 +64,14 @@ ENTRY(__put_user_2)
516 ENDPROC(__put_user_2)
517
518 ENTRY(__put_user_4)
519 + check_uaccess r0, 4, r1, ip, __put_user_bad
520 4: TUSER(str) r2, [r0]
521 mov r0, #0
522 mov pc, lr
523 ENDPROC(__put_user_4)
524
525 ENTRY(__put_user_8)
526 + check_uaccess r0, 8, r1, ip, __put_user_bad
527 #ifdef CONFIG_THUMB2_KERNEL
528 5: TUSER(str) r2, [r0]
529 6: TUSER(str) r3, [r0, #4]
530 diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
531 index 27f4a61..d3f25c9 100644
532 --- a/arch/arm/mm/mm.h
533 +++ b/arch/arm/mm/mm.h
534 @@ -55,6 +55,9 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
535 /* permanent static mappings from iotable_init() */
536 #define VM_ARM_STATIC_MAPPING 0x40000000
537
538 +/* empty mapping */
539 +#define VM_ARM_EMPTY_MAPPING 0x20000000
540 +
541 /* mapping type (attributes) for permanent static mappings */
542 #define VM_ARM_MTYPE(mt) ((mt) << 20)
543 #define VM_ARM_MTYPE_MASK (0x1f << 20)
544 diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
545 index 75f9f9d..7d41919 100644
546 --- a/arch/arm/mm/mmu.c
547 +++ b/arch/arm/mm/mmu.c
548 @@ -805,7 +805,7 @@ static void __init pmd_empty_section_gap(unsigned long addr)
549 vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm));
550 vm->addr = (void *)addr;
551 vm->size = SECTION_SIZE;
552 - vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
553 + vm->flags = VM_IOREMAP | VM_ARM_EMPTY_MAPPING;
554 vm->caller = pmd_empty_section_gap;
555 vm_area_add_early(vm);
556 }
557 @@ -818,7 +818,7 @@ static void __init fill_pmd_gaps(void)
558
559 /* we're still single threaded hence no lock needed here */
560 for (vm = vmlist; vm; vm = vm->next) {
561 - if (!(vm->flags & VM_ARM_STATIC_MAPPING))
562 + if (!(vm->flags & (VM_ARM_STATIC_MAPPING | VM_ARM_EMPTY_MAPPING)))
563 continue;
564 addr = (unsigned long)vm->addr;
565 if (addr < next)
566 diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
567 index 33aadbc..dcfd573 100644
568 --- a/arch/mips/mm/gup.c
569 +++ b/arch/mips/mm/gup.c
570 @@ -152,6 +152,8 @@ static int gup_huge_pud(pud_t pud, unsigned long addr, unsigned long end,
571 do {
572 VM_BUG_ON(compound_head(page) != head);
573 pages[*nr] = page;
574 + if (PageTail(page))
575 + get_huge_page_tail(page);
576 (*nr)++;
577 page++;
578 refs++;
579 diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
580 index 978330c..f80887f 100644
581 --- a/arch/powerpc/platforms/85xx/p1022_ds.c
582 +++ b/arch/powerpc/platforms/85xx/p1022_ds.c
583 @@ -208,6 +208,7 @@ static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
584 u8 __iomem *lbc_lcs0_ba = NULL;
585 u8 __iomem *lbc_lcs1_ba = NULL;
586 phys_addr_t cs0_addr, cs1_addr;
587 + u32 br0, or0, br1, or1;
588 const __be32 *iprop;
589 unsigned int num_laws;
590 u8 b;
591 @@ -256,11 +257,70 @@ static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
592 }
593 num_laws = be32_to_cpup(iprop);
594
595 - cs0_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[0].br));
596 - cs1_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[1].br));
597 + /*
598 + * Indirect mode requires both BR0 and BR1 to be set to "GPCM",
599 + * otherwise writes to these addresses won't actually appear on the
600 + * local bus, and so the PIXIS won't see them.
601 + *
602 + * In FCM mode, writes go to the NAND controller, which does not pass
603 + * them to the localbus directly. So we force BR0 and BR1 into GPCM
604 + * mode, since we don't care about what's behind the localbus any
605 + * more.
606 + */
607 + br0 = in_be32(&lbc->bank[0].br);
608 + br1 = in_be32(&lbc->bank[1].br);
609 + or0 = in_be32(&lbc->bank[0].or);
610 + or1 = in_be32(&lbc->bank[1].or);
611 +
612 + /* Make sure CS0 and CS1 are programmed */
613 + if (!(br0 & BR_V) || !(br1 & BR_V)) {
614 + pr_err("p1022ds: CS0 and/or CS1 is not programmed\n");
615 + goto exit;
616 + }
617 +
618 + /*
619 + * Use the existing BRx/ORx values if it's already GPCM. Otherwise,
620 + * force the values to simple 32KB GPCM windows with the most
621 + * conservative timing.
622 + */
623 + if ((br0 & BR_MSEL) != BR_MS_GPCM) {
624 + br0 = (br0 & BR_BA) | BR_V;
625 + or0 = 0xFFFF8000 | 0xFF7;
626 + out_be32(&lbc->bank[0].br, br0);
627 + out_be32(&lbc->bank[0].or, or0);
628 + }
629 + if ((br1 & BR_MSEL) != BR_MS_GPCM) {
630 + br1 = (br1 & BR_BA) | BR_V;
631 + or1 = 0xFFFF8000 | 0xFF7;
632 + out_be32(&lbc->bank[1].br, br1);
633 + out_be32(&lbc->bank[1].or, or1);
634 + }
635 +
636 + cs0_addr = lbc_br_to_phys(ecm, num_laws, br0);
637 + if (!cs0_addr) {
638 + pr_err("p1022ds: could not determine physical address for CS0"
639 + " (BR0=%08x)\n", br0);
640 + goto exit;
641 + }
642 + cs1_addr = lbc_br_to_phys(ecm, num_laws, br1);
643 + if (!cs0_addr) {
644 + pr_err("p1022ds: could not determine physical address for CS1"
645 + " (BR1=%08x)\n", br1);
646 + goto exit;
647 + }
648
649 lbc_lcs0_ba = ioremap(cs0_addr, 1);
650 + if (!lbc_lcs0_ba) {
651 + pr_err("p1022ds: could not ioremap CS0 address %llx\n",
652 + (unsigned long long)cs0_addr);
653 + goto exit;
654 + }
655 lbc_lcs1_ba = ioremap(cs1_addr, 1);
656 + if (!lbc_lcs1_ba) {
657 + pr_err("p1022ds: could not ioremap CS1 address %llx\n",
658 + (unsigned long long)cs1_addr);
659 + goto exit;
660 + }
661
662 /* Make sure we're in indirect mode first. */
663 if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
664 @@ -435,6 +495,8 @@ static void __init disable_one_node(struct device_node *np, struct property *new
665 prom_update_property(np, new, old);
666 else
667 prom_add_property(np, new);
668 +
669 + pr_info("p1022ds: disabling %s node\n", np->full_name);
670 }
671
672 /* TRUE if there is a "video=fslfb" command-line parameter. */
673 @@ -499,28 +561,46 @@ static void __init p1022_ds_setup_arch(void)
674 diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;
675
676 /*
677 - * Disable the NOR flash node if there is video=fslfb... command-line
678 - * parameter. When the DIU is active, NOR flash is unavailable, so we
679 - * have to disable the node before the MTD driver loads.
680 + * Disable the NOR and NAND flash nodes if there is video=fslfb...
681 + * command-line parameter. When the DIU is active, the localbus is
682 + * unavailable, so we have to disable these nodes before the MTD
683 + * driver loads.
684 */
685 if (fslfb) {
686 struct device_node *np =
687 of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
688
689 if (np) {
690 - np = of_find_compatible_node(np, NULL, "cfi-flash");
691 - if (np) {
692 + struct device_node *np2;
693 +
694 + of_node_get(np);
695 + np2 = of_find_compatible_node(np, NULL, "cfi-flash");
696 + if (np2) {
697 static struct property nor_status = {
698 .name = "status",
699 .value = "disabled",
700 .length = sizeof("disabled"),
701 };
702
703 - pr_info("p1022ds: disabling %s node",
704 - np->full_name);
705 - disable_one_node(np, &nor_status);
706 - of_node_put(np);
707 + disable_one_node(np2, &nor_status);
708 + of_node_put(np2);
709 + }
710 +
711 + of_node_get(np);
712 + np2 = of_find_compatible_node(np, NULL,
713 + "fsl,elbc-fcm-nand");
714 + if (np2) {
715 + static struct property nand_status = {
716 + .name = "status",
717 + .value = "disabled",
718 + .length = sizeof("disabled"),
719 + };
720 +
721 + disable_one_node(np2, &nand_status);
722 + of_node_put(np2);
723 }
724 +
725 + of_node_put(np);
726 }
727
728 }
729 diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
730 index 2297be4..abe8722 100644
731 --- a/arch/s390/oprofile/init.c
732 +++ b/arch/s390/oprofile/init.c
733 @@ -171,7 +171,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf,
734 if (*offset)
735 return -EINVAL;
736 retval = oprofilefs_ulong_from_user(&val, buf, count);
737 - if (retval)
738 + if (retval <= 0)
739 return retval;
740 if (val < oprofile_min_interval)
741 oprofile_hw_interval = oprofile_min_interval;
742 @@ -214,7 +214,7 @@ static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf,
743 return -EINVAL;
744
745 retval = oprofilefs_ulong_from_user(&val, buf, count);
746 - if (retval)
747 + if (retval <= 0)
748 return retval;
749 if (val != 0)
750 return -EINVAL;
751 @@ -245,7 +245,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf,
752 return -EINVAL;
753
754 retval = oprofilefs_ulong_from_user(&val, buf, count);
755 - if (retval)
756 + if (retval <= 0)
757 return retval;
758
759 if (val != 0 && val != 1)
760 @@ -280,7 +280,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf,
761 return -EINVAL;
762
763 retval = oprofilefs_ulong_from_user(&val, buf, count);
764 - if (retval)
765 + if (retval <= 0)
766 return retval;
767
768 if (val != 0 && val != 1)
769 @@ -319,7 +319,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf,
770 return -EINVAL;
771
772 retval = oprofilefs_ulong_from_user(&val, buf, count);
773 - if (retval)
774 + if (retval <= 0)
775 return retval;
776
777 if (val != 0 && val != 1)
778 diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
779 index c34f96c..1bd321d 100644
780 --- a/arch/x86/include/asm/xen/page.h
781 +++ b/arch/x86/include/asm/xen/page.h
782 @@ -50,7 +50,8 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s,
783
784 extern int m2p_add_override(unsigned long mfn, struct page *page,
785 struct gnttab_map_grant_ref *kmap_op);
786 -extern int m2p_remove_override(struct page *page, bool clear_pte);
787 +extern int m2p_remove_override(struct page *page,
788 + struct gnttab_map_grant_ref *kmap_op);
789 extern struct page *m2p_find_override(unsigned long mfn);
790 extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
791
792 diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
793 index d0e6e40..5dd467b 100644
794 --- a/arch/x86/pci/fixup.c
795 +++ b/arch/x86/pci/fixup.c
796 @@ -519,3 +519,20 @@ static void sb600_disable_hpet_bar(struct pci_dev *dev)
797 }
798 }
799 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);
800 +
801 +/*
802 + * Twinhead H12Y needs us to block out a region otherwise we map devices
803 + * there and any access kills the box.
804 + *
805 + * See: https://bugzilla.kernel.org/show_bug.cgi?id=10231
806 + *
807 + * Match off the LPC and svid/sdid (older kernels lose the bridge subvendor)
808 + */
809 +static void __devinit twinhead_reserve_killing_zone(struct pci_dev *dev)
810 +{
811 + if (dev->subsystem_vendor == 0x14FF && dev->subsystem_device == 0xA003) {
812 + pr_info("Reserving memory on Twinhead H12Y\n");
813 + request_mem_region(0xFFB00000, 0x100000, "twinhead");
814 + }
815 +}
816 +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone);
817 diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
818 index 00a0385..3ace817 100644
819 --- a/arch/x86/xen/p2m.c
820 +++ b/arch/x86/xen/p2m.c
821 @@ -714,9 +714,6 @@ int m2p_add_override(unsigned long mfn, struct page *page,
822
823 xen_mc_issue(PARAVIRT_LAZY_MMU);
824 }
825 - /* let's use dev_bus_addr to record the old mfn instead */
826 - kmap_op->dev_bus_addr = page->index;
827 - page->index = (unsigned long) kmap_op;
828 }
829 spin_lock_irqsave(&m2p_override_lock, flags);
830 list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]);
831 @@ -743,7 +740,8 @@ int m2p_add_override(unsigned long mfn, struct page *page,
832 return 0;
833 }
834 EXPORT_SYMBOL_GPL(m2p_add_override);
835 -int m2p_remove_override(struct page *page, bool clear_pte)
836 +int m2p_remove_override(struct page *page,
837 + struct gnttab_map_grant_ref *kmap_op)
838 {
839 unsigned long flags;
840 unsigned long mfn;
841 @@ -773,10 +771,8 @@ int m2p_remove_override(struct page *page, bool clear_pte)
842 WARN_ON(!PagePrivate(page));
843 ClearPagePrivate(page);
844
845 - if (clear_pte) {
846 - struct gnttab_map_grant_ref *map_op =
847 - (struct gnttab_map_grant_ref *) page->index;
848 - set_phys_to_machine(pfn, map_op->dev_bus_addr);
849 + set_phys_to_machine(pfn, page->index);
850 + if (kmap_op != NULL) {
851 if (!PageHighMem(page)) {
852 struct multicall_space mcs;
853 struct gnttab_unmap_grant_ref *unmap_op;
854 @@ -788,13 +784,13 @@ int m2p_remove_override(struct page *page, bool clear_pte)
855 * issued. In this case handle is going to -1 because
856 * it hasn't been modified yet.
857 */
858 - if (map_op->handle == -1)
859 + if (kmap_op->handle == -1)
860 xen_mc_flush();
861 /*
862 - * Now if map_op->handle is negative it means that the
863 + * Now if kmap_op->handle is negative it means that the
864 * hypercall actually returned an error.
865 */
866 - if (map_op->handle == GNTST_general_error) {
867 + if (kmap_op->handle == GNTST_general_error) {
868 printk(KERN_WARNING "m2p_remove_override: "
869 "pfn %lx mfn %lx, failed to modify kernel mappings",
870 pfn, mfn);
871 @@ -804,8 +800,8 @@ int m2p_remove_override(struct page *page, bool clear_pte)
872 mcs = xen_mc_entry(
873 sizeof(struct gnttab_unmap_grant_ref));
874 unmap_op = mcs.args;
875 - unmap_op->host_addr = map_op->host_addr;
876 - unmap_op->handle = map_op->handle;
877 + unmap_op->host_addr = kmap_op->host_addr;
878 + unmap_op->handle = kmap_op->handle;
879 unmap_op->dev_bus_addr = 0;
880
881 MULTI_grant_table_op(mcs.mc,
882 @@ -816,10 +812,9 @@ int m2p_remove_override(struct page *page, bool clear_pte)
883 set_pte_at(&init_mm, address, ptep,
884 pfn_pte(pfn, PAGE_KERNEL));
885 __flush_tlb_single(address);
886 - map_op->host_addr = 0;
887 + kmap_op->host_addr = 0;
888 }
889 - } else
890 - set_phys_to_machine(pfn, page->index);
891 + }
892
893 /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present
894 * somewhere in this domain, even before being added to the
895 diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
896 index 99de967..017d48a 100644
897 --- a/arch/x86/xen/setup.c
898 +++ b/arch/x86/xen/setup.c
899 @@ -17,6 +17,7 @@
900 #include <asm/e820.h>
901 #include <asm/setup.h>
902 #include <asm/acpi.h>
903 +#include <asm/numa.h>
904 #include <asm/xen/hypervisor.h>
905 #include <asm/xen/hypercall.h>
906
907 @@ -431,4 +432,7 @@ void __init xen_arch_setup(void)
908 disable_cpufreq();
909 WARN_ON(set_pm_idle_to_default());
910 fiddle_vdso();
911 +#ifdef CONFIG_NUMA
912 + numa_off = 1;
913 +#endif
914 }
915 diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
916 index 0500f71..2adef53 100644
917 --- a/drivers/acpi/power.c
918 +++ b/drivers/acpi/power.c
919 @@ -103,6 +103,7 @@ struct acpi_power_resource {
920
921 /* List of devices relying on this power resource */
922 struct acpi_power_resource_device *devices;
923 + struct mutex devices_lock;
924 };
925
926 static struct list_head acpi_power_resource_list;
927 @@ -221,7 +222,6 @@ static void acpi_power_on_device(struct acpi_power_managed_device *device)
928
929 static int __acpi_power_on(struct acpi_power_resource *resource)
930 {
931 - struct acpi_power_resource_device *device_list = resource->devices;
932 acpi_status status = AE_OK;
933
934 status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL);
935 @@ -234,19 +234,15 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
936 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n",
937 resource->name));
938
939 - while (device_list) {
940 - acpi_power_on_device(device_list->device);
941 -
942 - device_list = device_list->next;
943 - }
944 -
945 return 0;
946 }
947
948 static int acpi_power_on(acpi_handle handle)
949 {
950 int result = 0;
951 + bool resume_device = false;
952 struct acpi_power_resource *resource = NULL;
953 + struct acpi_power_resource_device *device_list;
954
955 result = acpi_power_get_context(handle, &resource);
956 if (result)
957 @@ -262,10 +258,25 @@ static int acpi_power_on(acpi_handle handle)
958 result = __acpi_power_on(resource);
959 if (result)
960 resource->ref_count--;
961 + else
962 + resume_device = true;
963 }
964
965 mutex_unlock(&resource->resource_lock);
966
967 + if (!resume_device)
968 + return result;
969 +
970 + mutex_lock(&resource->devices_lock);
971 +
972 + device_list = resource->devices;
973 + while (device_list) {
974 + acpi_power_on_device(device_list->device);
975 + device_list = device_list->next;
976 + }
977 +
978 + mutex_unlock(&resource->devices_lock);
979 +
980 return result;
981 }
982
983 @@ -351,7 +362,7 @@ static void __acpi_power_resource_unregister_device(struct device *dev,
984 if (acpi_power_get_context(res_handle, &resource))
985 return;
986
987 - mutex_lock(&resource->resource_lock);
988 + mutex_lock(&resource->devices_lock);
989 prev = NULL;
990 curr = resource->devices;
991 while (curr) {
992 @@ -368,7 +379,7 @@ static void __acpi_power_resource_unregister_device(struct device *dev,
993 prev = curr;
994 curr = curr->next;
995 }
996 - mutex_unlock(&resource->resource_lock);
997 + mutex_unlock(&resource->devices_lock);
998 }
999
1000 /* Unlink dev from all power resources in _PR0 */
1001 @@ -409,10 +420,10 @@ static int __acpi_power_resource_register_device(
1002
1003 power_resource_device->device = powered_device;
1004
1005 - mutex_lock(&resource->resource_lock);
1006 + mutex_lock(&resource->devices_lock);
1007 power_resource_device->next = resource->devices;
1008 resource->devices = power_resource_device;
1009 - mutex_unlock(&resource->resource_lock);
1010 + mutex_unlock(&resource->devices_lock);
1011
1012 return 0;
1013 }
1014 @@ -457,7 +468,7 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
1015 return ret;
1016
1017 no_power_resource:
1018 - printk(KERN_WARNING PREFIX "Invalid Power Resource to register!");
1019 + printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!");
1020 return -ENODEV;
1021 }
1022
1023 @@ -715,6 +726,7 @@ static int acpi_power_add(struct acpi_device *device)
1024
1025 resource->device = device;
1026 mutex_init(&resource->resource_lock);
1027 + mutex_init(&resource->devices_lock);
1028 strcpy(resource->name, device->pnp.bus_id);
1029 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
1030 strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
1031 diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
1032 index ebaf67e..93cbc44 100644
1033 --- a/drivers/ata/ahci.c
1034 +++ b/drivers/ata/ahci.c
1035 @@ -396,6 +396,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
1036 .driver_data = board_ahci_yes_fbs }, /* 88se9125 */
1037 { PCI_DEVICE(0x1b4b, 0x917a),
1038 .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
1039 + { PCI_DEVICE(0x1b4b, 0x9192),
1040 + .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */
1041 { PCI_DEVICE(0x1b4b, 0x91a3),
1042 .driver_data = board_ahci_yes_fbs },
1043
1044 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
1045 index d31ee55..cf4837f 100644
1046 --- a/drivers/ata/libata-core.c
1047 +++ b/drivers/ata/libata-core.c
1048 @@ -4125,6 +4125,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
1049
1050 /* Devices which aren't very happy with higher link speeds */
1051 { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, },
1052 + { "Seagate FreeAgent GoFlex", NULL, ATA_HORKAGE_1_5_GBPS, },
1053
1054 /*
1055 * Devices which choke on SETXFER. Applies only if both the
1056 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
1057 index bd0f394..bb82b18 100644
1058 --- a/drivers/base/power/runtime.c
1059 +++ b/drivers/base/power/runtime.c
1060 @@ -430,7 +430,6 @@ static int rpm_suspend(struct device *dev, int rpmflags)
1061 goto repeat;
1062 }
1063
1064 - dev->power.deferred_resume = false;
1065 if (dev->power.no_callbacks)
1066 goto no_callback; /* Assume success. */
1067
1068 @@ -506,6 +505,7 @@ static int rpm_suspend(struct device *dev, int rpmflags)
1069 wake_up_all(&dev->power.wait_queue);
1070
1071 if (dev->power.deferred_resume) {
1072 + dev->power.deferred_resume = false;
1073 rpm_resume(dev, 0);
1074 retval = -EAGAIN;
1075 goto out;
1076 @@ -652,6 +652,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
1077 || dev->parent->power.runtime_status == RPM_ACTIVE) {
1078 atomic_inc(&dev->parent->power.child_count);
1079 spin_unlock(&dev->parent->power.lock);
1080 + retval = 1;
1081 goto no_callback; /* Assume success. */
1082 }
1083 spin_unlock(&dev->parent->power.lock);
1084 @@ -735,7 +736,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
1085 }
1086 wake_up_all(&dev->power.wait_queue);
1087
1088 - if (!retval)
1089 + if (retval >= 0)
1090 rpm_idle(dev, RPM_ASYNC);
1091
1092 out:
1093 diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
1094 index 38aa6dd..da33111 100644
1095 --- a/drivers/block/cciss_scsi.c
1096 +++ b/drivers/block/cciss_scsi.c
1097 @@ -795,6 +795,7 @@ static void complete_scsi_command(CommandList_struct *c, int timeout,
1098 }
1099 break;
1100 case CMD_PROTOCOL_ERR:
1101 + cmd->result = DID_ERROR << 16;
1102 dev_warn(&h->pdev->dev,
1103 "%p has protocol error\n", c);
1104 break;
1105 diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
1106 index 061427a..3c4c225 100644
1107 --- a/drivers/block/nbd.c
1108 +++ b/drivers/block/nbd.c
1109 @@ -445,6 +445,14 @@ static void nbd_clear_que(struct nbd_device *nbd)
1110 req->errors++;
1111 nbd_end_request(req);
1112 }
1113 +
1114 + while (!list_empty(&nbd->waiting_queue)) {
1115 + req = list_entry(nbd->waiting_queue.next, struct request,
1116 + queuelist);
1117 + list_del_init(&req->queuelist);
1118 + req->errors++;
1119 + nbd_end_request(req);
1120 + }
1121 }
1122
1123
1124 @@ -594,6 +602,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
1125 nbd->file = NULL;
1126 nbd_clear_que(nbd);
1127 BUG_ON(!list_empty(&nbd->queue_head));
1128 + BUG_ON(!list_empty(&nbd->waiting_queue));
1129 if (file)
1130 fput(file);
1131 return 0;
1132 diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
1133 index 73f196c..c6decb9 100644
1134 --- a/drivers/block/xen-blkback/blkback.c
1135 +++ b/drivers/block/xen-blkback/blkback.c
1136 @@ -337,7 +337,7 @@ static void xen_blkbk_unmap(struct pending_req *req)
1137 invcount++;
1138 }
1139
1140 - ret = gnttab_unmap_refs(unmap, pages, invcount, false);
1141 + ret = gnttab_unmap_refs(unmap, NULL, pages, invcount);
1142 BUG_ON(ret);
1143 }
1144
1145 diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
1146 index 9217121..29d31ff 100644
1147 --- a/drivers/bluetooth/btusb.c
1148 +++ b/drivers/bluetooth/btusb.c
1149 @@ -60,6 +60,9 @@ static struct usb_device_id btusb_table[] = {
1150 /* Generic Bluetooth USB device */
1151 { USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
1152
1153 + /* Apple-specific (Broadcom) devices */
1154 + { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) },
1155 +
1156 /* Broadcom SoftSailing reporting vendor specific */
1157 { USB_DEVICE(0x0a5c, 0x21e1) },
1158
1159 @@ -102,15 +105,14 @@ static struct usb_device_id btusb_table[] = {
1160
1161 /* Broadcom BCM20702A0 */
1162 { USB_DEVICE(0x0489, 0xe042) },
1163 - { USB_DEVICE(0x0a5c, 0x21e3) },
1164 - { USB_DEVICE(0x0a5c, 0x21e6) },
1165 - { USB_DEVICE(0x0a5c, 0x21e8) },
1166 - { USB_DEVICE(0x0a5c, 0x21f3) },
1167 { USB_DEVICE(0x413c, 0x8197) },
1168
1169 /* Foxconn - Hon Hai */
1170 { USB_DEVICE(0x0489, 0xe033) },
1171
1172 + /*Broadcom devices with vendor specific id */
1173 + { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
1174 +
1175 { } /* Terminating entry */
1176 };
1177
1178 diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
1179 index c0e8164..1a40935 100644
1180 --- a/drivers/cpufreq/powernow-k8.c
1181 +++ b/drivers/cpufreq/powernow-k8.c
1182 @@ -35,7 +35,6 @@
1183 #include <linux/slab.h>
1184 #include <linux/string.h>
1185 #include <linux/cpumask.h>
1186 -#include <linux/sched.h> /* for current / set_cpus_allowed() */
1187 #include <linux/io.h>
1188 #include <linux/delay.h>
1189
1190 @@ -1139,16 +1138,23 @@ static int transition_frequency_pstate(struct powernow_k8_data *data,
1191 return res;
1192 }
1193
1194 -/* Driver entry point to switch to the target frequency */
1195 -static int powernowk8_target(struct cpufreq_policy *pol,
1196 - unsigned targfreq, unsigned relation)
1197 +struct powernowk8_target_arg {
1198 + struct cpufreq_policy *pol;
1199 + unsigned targfreq;
1200 + unsigned relation;
1201 +};
1202 +
1203 +static long powernowk8_target_fn(void *arg)
1204 {
1205 - cpumask_var_t oldmask;
1206 + struct powernowk8_target_arg *pta = arg;
1207 + struct cpufreq_policy *pol = pta->pol;
1208 + unsigned targfreq = pta->targfreq;
1209 + unsigned relation = pta->relation;
1210 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
1211 u32 checkfid;
1212 u32 checkvid;
1213 unsigned int newstate;
1214 - int ret = -EIO;
1215 + int ret;
1216
1217 if (!data)
1218 return -EINVAL;
1219 @@ -1156,29 +1162,16 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1220 checkfid = data->currfid;
1221 checkvid = data->currvid;
1222
1223 - /* only run on specific CPU from here on. */
1224 - /* This is poor form: use a workqueue or smp_call_function_single */
1225 - if (!alloc_cpumask_var(&oldmask, GFP_KERNEL))
1226 - return -ENOMEM;
1227 -
1228 - cpumask_copy(oldmask, tsk_cpus_allowed(current));
1229 - set_cpus_allowed_ptr(current, cpumask_of(pol->cpu));
1230 -
1231 - if (smp_processor_id() != pol->cpu) {
1232 - printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
1233 - goto err_out;
1234 - }
1235 -
1236 if (pending_bit_stuck()) {
1237 printk(KERN_ERR PFX "failing targ, change pending bit set\n");
1238 - goto err_out;
1239 + return -EIO;
1240 }
1241
1242 pr_debug("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n",
1243 pol->cpu, targfreq, pol->min, pol->max, relation);
1244
1245 if (query_current_values_with_pending_wait(data))
1246 - goto err_out;
1247 + return -EIO;
1248
1249 if (cpu_family != CPU_HW_PSTATE) {
1250 pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
1251 @@ -1196,7 +1189,7 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1252
1253 if (cpufreq_frequency_table_target(pol, data->powernow_table,
1254 targfreq, relation, &newstate))
1255 - goto err_out;
1256 + return -EIO;
1257
1258 mutex_lock(&fidvid_mutex);
1259
1260 @@ -1209,9 +1202,8 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1261 ret = transition_frequency_fidvid(data, newstate);
1262 if (ret) {
1263 printk(KERN_ERR PFX "transition frequency failed\n");
1264 - ret = 1;
1265 mutex_unlock(&fidvid_mutex);
1266 - goto err_out;
1267 + return 1;
1268 }
1269 mutex_unlock(&fidvid_mutex);
1270
1271 @@ -1220,12 +1212,25 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1272 data->powernow_table[newstate].index);
1273 else
1274 pol->cur = find_khz_freq_from_fid(data->currfid);
1275 - ret = 0;
1276
1277 -err_out:
1278 - set_cpus_allowed_ptr(current, oldmask);
1279 - free_cpumask_var(oldmask);
1280 - return ret;
1281 + return 0;
1282 +}
1283 +
1284 +/* Driver entry point to switch to the target frequency */
1285 +static int powernowk8_target(struct cpufreq_policy *pol,
1286 + unsigned targfreq, unsigned relation)
1287 +{
1288 + struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq,
1289 + .relation = relation };
1290 +
1291 + /*
1292 + * Must run on @pol->cpu. cpufreq core is responsible for ensuring
1293 + * that we're bound to the current CPU and pol->cpu stays online.
1294 + */
1295 + if (smp_processor_id() == pol->cpu)
1296 + return powernowk8_target_fn(&pta);
1297 + else
1298 + return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
1299 }
1300
1301 /* Driver entry point to verify the policy and range of frequencies */
1302 diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
1303 index bf0d7e4..9ec3943 100644
1304 --- a/drivers/dma/at_hdmac.c
1305 +++ b/drivers/dma/at_hdmac.c
1306 @@ -664,7 +664,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1307 flags);
1308
1309 if (unlikely(!atslave || !sg_len)) {
1310 - dev_dbg(chan2dev(chan), "prep_dma_memcpy: length is zero!\n");
1311 + dev_dbg(chan2dev(chan), "prep_slave_sg: sg length is zero!\n");
1312 return NULL;
1313 }
1314
1315 @@ -691,6 +691,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1316
1317 mem = sg_dma_address(sg);
1318 len = sg_dma_len(sg);
1319 + if (unlikely(!len)) {
1320 + dev_dbg(chan2dev(chan),
1321 + "prep_slave_sg: sg(%d) data length is zero\n", i);
1322 + goto err;
1323 + }
1324 mem_width = 2;
1325 if (unlikely(mem & 3 || len & 3))
1326 mem_width = 0;
1327 @@ -726,6 +731,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1328
1329 mem = sg_dma_address(sg);
1330 len = sg_dma_len(sg);
1331 + if (unlikely(!len)) {
1332 + dev_dbg(chan2dev(chan),
1333 + "prep_slave_sg: sg(%d) data length is zero\n", i);
1334 + goto err;
1335 + }
1336 mem_width = 2;
1337 if (unlikely(mem & 3 || len & 3))
1338 mem_width = 0;
1339 @@ -759,6 +769,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1340
1341 err_desc_get:
1342 dev_err(chan2dev(chan), "not enough descriptors available\n");
1343 +err:
1344 atc_desc_put(atchan, first);
1345 return NULL;
1346 }
1347 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
1348 index 8c44f17..758122f 100644
1349 --- a/drivers/dma/pl330.c
1350 +++ b/drivers/dma/pl330.c
1351 @@ -1568,17 +1568,19 @@ static int pl330_submit_req(void *ch_id, struct pl330_req *r)
1352 goto xfer_exit;
1353 }
1354
1355 - /* Prefer Secure Channel */
1356 - if (!_manager_ns(thrd))
1357 - r->cfg->nonsecure = 0;
1358 - else
1359 - r->cfg->nonsecure = 1;
1360
1361 /* Use last settings, if not provided */
1362 - if (r->cfg)
1363 + if (r->cfg) {
1364 + /* Prefer Secure Channel */
1365 + if (!_manager_ns(thrd))
1366 + r->cfg->nonsecure = 0;
1367 + else
1368 + r->cfg->nonsecure = 1;
1369 +
1370 ccr = _prepare_ccr(r->cfg);
1371 - else
1372 + } else {
1373 ccr = readl(regs + CC(thrd->id));
1374 + }
1375
1376 /* If this req doesn't have valid xfer settings */
1377 if (!_is_valid(ccr)) {
1378 @@ -2935,6 +2937,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
1379 num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan);
1380
1381 pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
1382 + if (!pdmac->peripherals) {
1383 + ret = -ENOMEM;
1384 + dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n");
1385 + goto probe_err5;
1386 + }
1387
1388 for (i = 0; i < num_chan; i++) {
1389 pch = &pdmac->peripherals[i];
1390 diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c
1391 index 61c2d08..e42e4b8 100644
1392 --- a/drivers/gpio/gpio-lpc32xx.c
1393 +++ b/drivers/gpio/gpio-lpc32xx.c
1394 @@ -304,6 +304,7 @@ static int lpc32xx_gpio_dir_output_p012(struct gpio_chip *chip, unsigned pin,
1395 {
1396 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
1397
1398 + __set_gpio_level_p012(group, pin, value);
1399 __set_gpio_dir_p012(group, pin, 0);
1400
1401 return 0;
1402 @@ -314,6 +315,7 @@ static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin,
1403 {
1404 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
1405
1406 + __set_gpio_level_p3(group, pin, value);
1407 __set_gpio_dir_p3(group, pin, 0);
1408
1409 return 0;
1410 @@ -322,6 +324,9 @@ static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin,
1411 static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin,
1412 int value)
1413 {
1414 + struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
1415 +
1416 + __set_gpo_level_p3(group, pin, value);
1417 return 0;
1418 }
1419
1420 diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
1421 index c79870a..7e479a4 100644
1422 --- a/drivers/gpu/drm/drm_crtc.c
1423 +++ b/drivers/gpu/drm/drm_crtc.c
1424 @@ -1981,7 +1981,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
1425 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1426 return -EINVAL;
1427
1428 - if (!req->flags)
1429 + if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags))
1430 return -EINVAL;
1431
1432 mutex_lock(&dev->mode_config.mutex);
1433 diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
1434 index 90b9793..342ffb7 100644
1435 --- a/drivers/gpu/drm/i915/intel_crt.c
1436 +++ b/drivers/gpu/drm/i915/intel_crt.c
1437 @@ -266,6 +266,36 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
1438 return ret;
1439 }
1440
1441 +static struct edid *intel_crt_get_edid(struct drm_connector *connector,
1442 + struct i2c_adapter *i2c)
1443 +{
1444 + struct edid *edid;
1445 +
1446 + edid = drm_get_edid(connector, i2c);
1447 +
1448 + if (!edid && !intel_gmbus_is_forced_bit(i2c)) {
1449 + DRM_DEBUG_KMS("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n");
1450 + intel_gmbus_force_bit(i2c, true);
1451 + edid = drm_get_edid(connector, i2c);
1452 + intel_gmbus_force_bit(i2c, false);
1453 + }
1454 +
1455 + return edid;
1456 +}
1457 +
1458 +/* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */
1459 +static int intel_crt_ddc_get_modes(struct drm_connector *connector,
1460 + struct i2c_adapter *adapter)
1461 +{
1462 + struct edid *edid;
1463 +
1464 + edid = intel_crt_get_edid(connector, adapter);
1465 + if (!edid)
1466 + return 0;
1467 +
1468 + return intel_connector_update_modes(connector, edid);
1469 +}
1470 +
1471 static bool intel_crt_detect_ddc(struct drm_connector *connector)
1472 {
1473 struct intel_crt *crt = intel_attached_crt(connector);
1474 @@ -279,7 +309,7 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
1475 struct edid *edid;
1476 bool is_digital = false;
1477
1478 - edid = drm_get_edid(connector,
1479 + edid = intel_crt_get_edid(connector,
1480 &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter);
1481 /*
1482 * This may be a DVI-I connector with a shared DDC
1483 @@ -477,13 +507,13 @@ static int intel_crt_get_modes(struct drm_connector *connector)
1484 struct drm_i915_private *dev_priv = dev->dev_private;
1485 int ret;
1486
1487 - ret = intel_ddc_get_modes(connector,
1488 + ret = intel_crt_ddc_get_modes(connector,
1489 &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter);
1490 if (ret || !IS_G4X(dev))
1491 return ret;
1492
1493 /* Try to probe digital port for output in DVI-I -> VGA mode. */
1494 - return intel_ddc_get_modes(connector,
1495 + return intel_crt_ddc_get_modes(connector,
1496 &dev_priv->gmbus[GMBUS_PORT_DPB].adapter);
1497 }
1498
1499 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1500 index 3de3d9b..498bcbe 100644
1501 --- a/drivers/gpu/drm/i915/intel_display.c
1502 +++ b/drivers/gpu/drm/i915/intel_display.c
1503 @@ -1099,7 +1099,7 @@ static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv,
1504 enum pipe pipe, int reg)
1505 {
1506 u32 val = I915_READ(reg);
1507 - WARN(hdmi_pipe_enabled(dev_priv, val, pipe),
1508 + WARN(hdmi_pipe_enabled(dev_priv, pipe, val),
1509 "PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n",
1510 reg, pipe_name(pipe));
1511 }
1512 @@ -1116,13 +1116,13 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv,
1513
1514 reg = PCH_ADPA;
1515 val = I915_READ(reg);
1516 - WARN(adpa_pipe_enabled(dev_priv, val, pipe),
1517 + WARN(adpa_pipe_enabled(dev_priv, pipe, val),
1518 "PCH VGA enabled on transcoder %c, should be disabled\n",
1519 pipe_name(pipe));
1520
1521 reg = PCH_LVDS;
1522 val = I915_READ(reg);
1523 - WARN(lvds_pipe_enabled(dev_priv, val, pipe),
1524 + WARN(lvds_pipe_enabled(dev_priv, pipe, val),
1525 "PCH LVDS enabled on transcoder %c, should be disabled\n",
1526 pipe_name(pipe));
1527
1528 @@ -1487,7 +1487,7 @@ static void disable_pch_hdmi(struct drm_i915_private *dev_priv,
1529 enum pipe pipe, int reg)
1530 {
1531 u32 val = I915_READ(reg);
1532 - if (hdmi_pipe_enabled(dev_priv, val, pipe)) {
1533 + if (hdmi_pipe_enabled(dev_priv, pipe, val)) {
1534 DRM_DEBUG_KMS("Disabling pch HDMI %x on pipe %d\n",
1535 reg, pipe);
1536 I915_WRITE(reg, val & ~PORT_ENABLE);
1537 @@ -1509,12 +1509,12 @@ static void intel_disable_pch_ports(struct drm_i915_private *dev_priv,
1538
1539 reg = PCH_ADPA;
1540 val = I915_READ(reg);
1541 - if (adpa_pipe_enabled(dev_priv, val, pipe))
1542 + if (adpa_pipe_enabled(dev_priv, pipe, val))
1543 I915_WRITE(reg, val & ~ADPA_DAC_ENABLE);
1544
1545 reg = PCH_LVDS;
1546 val = I915_READ(reg);
1547 - if (lvds_pipe_enabled(dev_priv, val, pipe)) {
1548 + if (lvds_pipe_enabled(dev_priv, pipe, val)) {
1549 DRM_DEBUG_KMS("disable lvds on pipe %d val 0x%08x\n", pipe, val);
1550 I915_WRITE(reg, val & ~LVDS_PORT_EN);
1551 POSTING_READ(reg);
1552 diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
1553 index 715afa1..2cae72d 100644
1554 --- a/drivers/gpu/drm/i915/intel_drv.h
1555 +++ b/drivers/gpu/drm/i915/intel_drv.h
1556 @@ -288,6 +288,8 @@ struct intel_fbc_work {
1557 int interval;
1558 };
1559
1560 +int intel_connector_update_modes(struct drm_connector *connector,
1561 + struct edid *edid);
1562 int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
1563 extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus);
1564
1565 diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
1566 index 2d7f47b..fb44e9d 100644
1567 --- a/drivers/gpu/drm/i915/intel_hdmi.c
1568 +++ b/drivers/gpu/drm/i915/intel_hdmi.c
1569 @@ -271,7 +271,7 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
1570 u32 temp;
1571 u32 enable_bits = SDVO_ENABLE;
1572
1573 - if (intel_hdmi->has_audio)
1574 + if (intel_hdmi->has_audio || mode != DRM_MODE_DPMS_ON)
1575 enable_bits |= SDVO_AUDIO_ENABLE;
1576
1577 temp = I915_READ(intel_hdmi->sdvox_reg);
1578 diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
1579 index d1928e7..9a2b270 100644
1580 --- a/drivers/gpu/drm/i915/intel_modes.c
1581 +++ b/drivers/gpu/drm/i915/intel_modes.c
1582 @@ -60,6 +60,25 @@ bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus)
1583 }
1584
1585 /**
1586 + * intel_connector_update_modes - update connector from edid
1587 + * @connector: DRM connector device to use
1588 + * @edid: previously read EDID information
1589 + */
1590 +int intel_connector_update_modes(struct drm_connector *connector,
1591 + struct edid *edid)
1592 +{
1593 + int ret;
1594 +
1595 + drm_mode_connector_update_edid_property(connector, edid);
1596 + ret = drm_add_edid_modes(connector, edid);
1597 + drm_edid_to_eld(connector, edid);
1598 + connector->display_info.raw_edid = NULL;
1599 + kfree(edid);
1600 +
1601 + return ret;
1602 +}
1603 +
1604 +/**
1605 * intel_ddc_get_modes - get modelist from monitor
1606 * @connector: DRM connector device to use
1607 * @adapter: i2c adapter
1608 @@ -70,18 +89,12 @@ int intel_ddc_get_modes(struct drm_connector *connector,
1609 struct i2c_adapter *adapter)
1610 {
1611 struct edid *edid;
1612 - int ret = 0;
1613
1614 edid = drm_get_edid(connector, adapter);
1615 - if (edid) {
1616 - drm_mode_connector_update_edid_property(connector, edid);
1617 - ret = drm_add_edid_modes(connector, edid);
1618 - drm_edid_to_eld(connector, edid);
1619 - connector->display_info.raw_edid = NULL;
1620 - kfree(edid);
1621 - }
1622 + if (!edid)
1623 + return 0;
1624
1625 - return ret;
1626 + return intel_connector_update_modes(connector, edid);
1627 }
1628
1629 static const struct drm_prop_enum_list force_audio_names[] = {
1630 diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
1631 index 12a9e5f..302d3d5 100644
1632 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
1633 +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
1634 @@ -258,6 +258,8 @@ static int init_ring_common(struct intel_ring_buffer *ring)
1635 I915_WRITE_HEAD(ring, 0);
1636 ring->write_tail(ring, 0);
1637
1638 + /* Initialize the ring. */
1639 + I915_WRITE_START(ring, obj->gtt_offset);
1640 head = I915_READ_HEAD(ring) & HEAD_ADDR;
1641
1642 /* G45 ring initialization fails to reset head to zero */
1643 @@ -283,11 +285,6 @@ static int init_ring_common(struct intel_ring_buffer *ring)
1644 }
1645 }
1646
1647 - /* Initialize the ring. This must happen _after_ we've cleared the ring
1648 - * registers with the above sequence (the readback of the HEAD registers
1649 - * also enforces ordering), otherwise the hw might lose the new ring
1650 - * register values. */
1651 - I915_WRITE_START(ring, obj->gtt_offset);
1652 I915_WRITE_CTL(ring,
1653 ((ring->size - PAGE_SIZE) & RING_NR_PAGES)
1654 | RING_VALID);
1655 diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
1656 index a85e112..f233b8f 100644
1657 --- a/drivers/gpu/drm/nouveau/nouveau_display.c
1658 +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
1659 @@ -586,7 +586,7 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
1660 args->size = args->pitch * args->height;
1661 args->size = roundup(args->size, PAGE_SIZE);
1662
1663 - ret = nouveau_gem_new(dev, args->size, 0, TTM_PL_FLAG_VRAM, 0, 0, &bo);
1664 + ret = nouveau_gem_new(dev, args->size, 0, NOUVEAU_GEM_DOMAIN_VRAM, 0, 0, &bo);
1665 if (ret)
1666 return ret;
1667
1668 diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
1669 index a53ca30..19f4082 100644
1670 --- a/drivers/gpu/drm/radeon/atombios_crtc.c
1671 +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
1672 @@ -258,7 +258,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
1673 radeon_crtc->enabled = true;
1674 /* adjust pm to dpms changes BEFORE enabling crtcs */
1675 radeon_pm_compute_clocks(rdev);
1676 - /* disable crtc pair power gating before programming */
1677 if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
1678 atombios_powergate_crtc(crtc, ATOM_DISABLE);
1679 atombios_enable_crtc(crtc, ATOM_ENABLE);
1680 @@ -278,25 +277,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
1681 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
1682 atombios_enable_crtc(crtc, ATOM_DISABLE);
1683 radeon_crtc->enabled = false;
1684 - /* power gating is per-pair */
1685 - if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) {
1686 - struct drm_crtc *other_crtc;
1687 - struct radeon_crtc *other_radeon_crtc;
1688 - list_for_each_entry(other_crtc, &rdev->ddev->mode_config.crtc_list, head) {
1689 - other_radeon_crtc = to_radeon_crtc(other_crtc);
1690 - if (((radeon_crtc->crtc_id == 0) && (other_radeon_crtc->crtc_id == 1)) ||
1691 - ((radeon_crtc->crtc_id == 1) && (other_radeon_crtc->crtc_id == 0)) ||
1692 - ((radeon_crtc->crtc_id == 2) && (other_radeon_crtc->crtc_id == 3)) ||
1693 - ((radeon_crtc->crtc_id == 3) && (other_radeon_crtc->crtc_id == 2)) ||
1694 - ((radeon_crtc->crtc_id == 4) && (other_radeon_crtc->crtc_id == 5)) ||
1695 - ((radeon_crtc->crtc_id == 5) && (other_radeon_crtc->crtc_id == 4))) {
1696 - /* if both crtcs in the pair are off, enable power gating */
1697 - if (other_radeon_crtc->enabled == false)
1698 - atombios_powergate_crtc(crtc, ATOM_ENABLE);
1699 - break;
1700 - }
1701 - }
1702 - }
1703 + if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
1704 + atombios_powergate_crtc(crtc, ATOM_ENABLE);
1705 /* adjust pm to dpms changes AFTER disabling crtcs */
1706 radeon_pm_compute_clocks(rdev);
1707 break;
1708 @@ -444,11 +426,28 @@ union atom_enable_ss {
1709 static void atombios_crtc_program_ss(struct radeon_device *rdev,
1710 int enable,
1711 int pll_id,
1712 + int crtc_id,
1713 struct radeon_atom_ss *ss)
1714 {
1715 + unsigned i;
1716 int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL);
1717 union atom_enable_ss args;
1718
1719 + if (!enable) {
1720 + for (i = 0; i < rdev->num_crtc; i++) {
1721 + if (rdev->mode_info.crtcs[i] &&
1722 + rdev->mode_info.crtcs[i]->enabled &&
1723 + i != crtc_id &&
1724 + pll_id == rdev->mode_info.crtcs[i]->pll_id) {
1725 + /* one other crtc is using this pll don't turn
1726 + * off spread spectrum as it might turn off
1727 + * display on active crtc
1728 + */
1729 + return;
1730 + }
1731 + }
1732 + }
1733 +
1734 memset(&args, 0, sizeof(args));
1735
1736 if (ASIC_IS_DCE5(rdev)) {
1737 @@ -1039,7 +1038,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
1738 radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
1739 &ref_div, &post_div);
1740
1741 - atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, &ss);
1742 + atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss);
1743
1744 atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id,
1745 encoder_mode, radeon_encoder->encoder_id, mode->clock,
1746 @@ -1062,7 +1061,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
1747 ss.step = step_size;
1748 }
1749
1750 - atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, &ss);
1751 + atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss);
1752 }
1753 }
1754
1755 @@ -1571,11 +1570,11 @@ void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev)
1756 ASIC_INTERNAL_SS_ON_DCPLL,
1757 rdev->clock.default_dispclk);
1758 if (ss_enabled)
1759 - atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, &ss);
1760 + atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, -1, &ss);
1761 /* XXX: DCE5, make sure voltage, dispclk is high enough */
1762 atombios_crtc_set_disp_eng_pll(rdev, rdev->clock.default_dispclk);
1763 if (ss_enabled)
1764 - atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, &ss);
1765 + atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, -1, &ss);
1766 }
1767
1768 }
1769 @@ -1664,9 +1663,22 @@ static void atombios_crtc_disable(struct drm_crtc *crtc)
1770 struct drm_device *dev = crtc->dev;
1771 struct radeon_device *rdev = dev->dev_private;
1772 struct radeon_atom_ss ss;
1773 + int i;
1774
1775 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
1776
1777 + for (i = 0; i < rdev->num_crtc; i++) {
1778 + if (rdev->mode_info.crtcs[i] &&
1779 + rdev->mode_info.crtcs[i]->enabled &&
1780 + i != radeon_crtc->crtc_id &&
1781 + radeon_crtc->pll_id == rdev->mode_info.crtcs[i]->pll_id) {
1782 + /* one other crtc is using this pll don't turn
1783 + * off the pll
1784 + */
1785 + goto done;
1786 + }
1787 + }
1788 +
1789 switch (radeon_crtc->pll_id) {
1790 case ATOM_PPLL1:
1791 case ATOM_PPLL2:
1792 @@ -1683,6 +1695,7 @@ static void atombios_crtc_disable(struct drm_crtc *crtc)
1793 default:
1794 break;
1795 }
1796 +done:
1797 radeon_crtc->pll_id = -1;
1798 }
1799
1800 diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
1801 index a3ae788..2d07fbf 100644
1802 --- a/drivers/gpu/drm/radeon/atombios_encoders.c
1803 +++ b/drivers/gpu/drm/radeon/atombios_encoders.c
1804 @@ -1379,6 +1379,8 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
1805 struct drm_device *dev = encoder->dev;
1806 struct radeon_device *rdev = dev->dev_private;
1807 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1808 + struct drm_encoder *ext_encoder = radeon_get_external_encoder(encoder);
1809 + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1810 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
1811 struct radeon_connector *radeon_connector = NULL;
1812 struct radeon_connector_atom_dig *radeon_dig_connector = NULL;
1813 @@ -1390,19 +1392,37 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
1814
1815 switch (mode) {
1816 case DRM_MODE_DPMS_ON:
1817 - /* some early dce3.2 boards have a bug in their transmitter control table */
1818 - if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730) ||
1819 - ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
1820 - if (ASIC_IS_DCE6(rdev)) {
1821 - /* It seems we need to call ATOM_ENCODER_CMD_SETUP again
1822 - * before reenabling encoder on DPMS ON, otherwise we never
1823 - * get picture
1824 - */
1825 - atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
1826 + if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
1827 + if (!connector)
1828 + dig->panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
1829 + else
1830 + dig->panel_mode = radeon_dp_get_panel_mode(encoder, connector);
1831 +
1832 + /* setup and enable the encoder */
1833 + atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
1834 + atombios_dig_encoder_setup(encoder,
1835 + ATOM_ENCODER_CMD_SETUP_PANEL_MODE,
1836 + dig->panel_mode);
1837 + if (ext_encoder) {
1838 + if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev))
1839 + atombios_external_encoder_setup(encoder, ext_encoder,
1840 + EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP);
1841 }
1842 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
1843 - } else {
1844 + } else if (ASIC_IS_DCE4(rdev)) {
1845 + /* setup and enable the encoder */
1846 + atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
1847 + /* enable the transmitter */
1848 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
1849 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
1850 + } else {
1851 + /* setup and enable the encoder and transmitter */
1852 + atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0);
1853 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0);
1854 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
1855 + /* some early dce3.2 boards have a bug in their transmitter control table */
1856 + if ((rdev->family != CHIP_RV710) || (rdev->family != CHIP_RV730))
1857 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
1858 }
1859 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
1860 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
1861 @@ -1420,10 +1440,19 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
1862 case DRM_MODE_DPMS_STANDBY:
1863 case DRM_MODE_DPMS_SUSPEND:
1864 case DRM_MODE_DPMS_OFF:
1865 - if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev))
1866 + if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
1867 + /* disable the transmitter */
1868 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
1869 - else
1870 + } else if (ASIC_IS_DCE4(rdev)) {
1871 + /* disable the transmitter */
1872 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0);
1873 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
1874 + } else {
1875 + /* disable the encoder and transmitter */
1876 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0);
1877 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
1878 + atombios_dig_encoder_setup(encoder, ATOM_DISABLE, 0);
1879 + }
1880 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
1881 if (ASIC_IS_DCE4(rdev))
1882 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF, 0);
1883 @@ -1740,13 +1769,34 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder)
1884 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
1885 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1886 struct drm_encoder *test_encoder;
1887 - struct radeon_encoder_atom_dig *dig;
1888 + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1889 uint32_t dig_enc_in_use = 0;
1890
1891 - /* DCE4/5 */
1892 - if (ASIC_IS_DCE4(rdev)) {
1893 - dig = radeon_encoder->enc_priv;
1894 - if (ASIC_IS_DCE41(rdev)) {
1895 + if (ASIC_IS_DCE6(rdev)) {
1896 + /* DCE6 */
1897 + switch (radeon_encoder->encoder_id) {
1898 + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
1899 + if (dig->linkb)
1900 + return 1;
1901 + else
1902 + return 0;
1903 + break;
1904 + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
1905 + if (dig->linkb)
1906 + return 3;
1907 + else
1908 + return 2;
1909 + break;
1910 + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
1911 + if (dig->linkb)
1912 + return 5;
1913 + else
1914 + return 4;
1915 + break;
1916 + }
1917 + } else if (ASIC_IS_DCE4(rdev)) {
1918 + /* DCE4/5 */
1919 + if (ASIC_IS_DCE41(rdev) && !ASIC_IS_DCE61(rdev)) {
1920 /* ontario follows DCE4 */
1921 if (rdev->family == CHIP_PALM) {
1922 if (dig->linkb)
1923 @@ -1848,10 +1898,12 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1924 struct drm_device *dev = encoder->dev;
1925 struct radeon_device *rdev = dev->dev_private;
1926 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1927 - struct drm_encoder *ext_encoder = radeon_get_external_encoder(encoder);
1928
1929 radeon_encoder->pixel_clock = adjusted_mode->clock;
1930
1931 + /* need to call this here rather than in prepare() since we need some crtc info */
1932 + radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1933 +
1934 if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE4(rdev)) {
1935 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT))
1936 atombios_yuv_setup(encoder, true);
1937 @@ -1870,38 +1922,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1938 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
1939 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
1940 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
1941 - if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
1942 - struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
1943 - struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1944 -
1945 - if (!connector)
1946 - dig->panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
1947 - else
1948 - dig->panel_mode = radeon_dp_get_panel_mode(encoder, connector);
1949 -
1950 - /* setup and enable the encoder */
1951 - atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
1952 - atombios_dig_encoder_setup(encoder,
1953 - ATOM_ENCODER_CMD_SETUP_PANEL_MODE,
1954 - dig->panel_mode);
1955 - } else if (ASIC_IS_DCE4(rdev)) {
1956 - /* disable the transmitter */
1957 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
1958 - /* setup and enable the encoder */
1959 - atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
1960 -
1961 - /* enable the transmitter */
1962 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
1963 - } else {
1964 - /* disable the encoder and transmitter */
1965 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
1966 - atombios_dig_encoder_setup(encoder, ATOM_DISABLE, 0);
1967 -
1968 - /* setup and enable the encoder and transmitter */
1969 - atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0);
1970 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0);
1971 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
1972 - }
1973 + /* handled in dpms */
1974 break;
1975 case ENCODER_OBJECT_ID_INTERNAL_DDI:
1976 case ENCODER_OBJECT_ID_INTERNAL_DVO1:
1977 @@ -1922,14 +1943,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1978 break;
1979 }
1980
1981 - if (ext_encoder) {
1982 - if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev))
1983 - atombios_external_encoder_setup(encoder, ext_encoder,
1984 - EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP);
1985 - else
1986 - atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE);
1987 - }
1988 -
1989 atombios_apply_encoder_quirks(encoder, adjusted_mode);
1990
1991 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
1992 @@ -2102,7 +2115,6 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder)
1993 }
1994
1995 radeon_atom_output_lock(encoder, true);
1996 - radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1997
1998 if (connector) {
1999 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
2000 @@ -2123,6 +2135,7 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder)
2001
2002 static void radeon_atom_encoder_commit(struct drm_encoder *encoder)
2003 {
2004 + /* need to call this here as we need the crtc set up */
2005 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
2006 radeon_atom_output_lock(encoder, false);
2007 }
2008 @@ -2163,14 +2176,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
2009 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
2010 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
2011 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
2012 - if (ASIC_IS_DCE4(rdev))
2013 - /* disable the transmitter */
2014 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
2015 - else {
2016 - /* disable the encoder and transmitter */
2017 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
2018 - atombios_dig_encoder_setup(encoder, ATOM_DISABLE, 0);
2019 - }
2020 + /* handled in dpms */
2021 break;
2022 case ENCODER_OBJECT_ID_INTERNAL_DDI:
2023 case ENCODER_OBJECT_ID_INTERNAL_DVO1:
2024 diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
2025 index 138b952..66150f0 100644
2026 --- a/drivers/gpu/drm/radeon/radeon.h
2027 +++ b/drivers/gpu/drm/radeon/radeon.h
2028 @@ -138,21 +138,6 @@ struct radeon_device;
2029 /*
2030 * BIOS.
2031 */
2032 -#define ATRM_BIOS_PAGE 4096
2033 -
2034 -#if defined(CONFIG_VGA_SWITCHEROO)
2035 -bool radeon_atrm_supported(struct pci_dev *pdev);
2036 -int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len);
2037 -#else
2038 -static inline bool radeon_atrm_supported(struct pci_dev *pdev)
2039 -{
2040 - return false;
2041 -}
2042 -
2043 -static inline int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len){
2044 - return -EINVAL;
2045 -}
2046 -#endif
2047 bool radeon_get_bios(struct radeon_device *rdev);
2048
2049
2050 diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
2051 index b1e3820..5e30e12 100644
2052 --- a/drivers/gpu/drm/radeon/radeon_atombios.c
2053 +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
2054 @@ -452,7 +452,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
2055 }
2056
2057 /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */
2058 - if ((dev->pdev->device == 0x9802) &&
2059 + if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) &&
2060 (dev->pdev->subsystem_vendor == 0x1734) &&
2061 (dev->pdev->subsystem_device == 0x11bd)) {
2062 if (*connector_type == DRM_MODE_CONNECTOR_VGA) {
2063 diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
2064 index 98724fc..2a2cf0b 100644
2065 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
2066 +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
2067 @@ -30,57 +30,8 @@ static struct radeon_atpx_priv {
2068 /* handle for device - and atpx */
2069 acpi_handle dhandle;
2070 acpi_handle atpx_handle;
2071 - acpi_handle atrm_handle;
2072 } radeon_atpx_priv;
2073
2074 -/* retrieve the ROM in 4k blocks */
2075 -static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios,
2076 - int offset, int len)
2077 -{
2078 - acpi_status status;
2079 - union acpi_object atrm_arg_elements[2], *obj;
2080 - struct acpi_object_list atrm_arg;
2081 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL};
2082 -
2083 - atrm_arg.count = 2;
2084 - atrm_arg.pointer = &atrm_arg_elements[0];
2085 -
2086 - atrm_arg_elements[0].type = ACPI_TYPE_INTEGER;
2087 - atrm_arg_elements[0].integer.value = offset;
2088 -
2089 - atrm_arg_elements[1].type = ACPI_TYPE_INTEGER;
2090 - atrm_arg_elements[1].integer.value = len;
2091 -
2092 - status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer);
2093 - if (ACPI_FAILURE(status)) {
2094 - printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status));
2095 - return -ENODEV;
2096 - }
2097 -
2098 - obj = (union acpi_object *)buffer.pointer;
2099 - memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length);
2100 - len = obj->buffer.length;
2101 - kfree(buffer.pointer);
2102 - return len;
2103 -}
2104 -
2105 -bool radeon_atrm_supported(struct pci_dev *pdev)
2106 -{
2107 - /* get the discrete ROM only via ATRM */
2108 - if (!radeon_atpx_priv.atpx_detected)
2109 - return false;
2110 -
2111 - if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev))
2112 - return false;
2113 - return true;
2114 -}
2115 -
2116 -
2117 -int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len)
2118 -{
2119 - return radeon_atrm_call(radeon_atpx_priv.atrm_handle, bios, offset, len);
2120 -}
2121 -
2122 static int radeon_atpx_get_version(acpi_handle handle)
2123 {
2124 acpi_status status;
2125 @@ -198,7 +149,7 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
2126
2127 static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
2128 {
2129 - acpi_handle dhandle, atpx_handle, atrm_handle;
2130 + acpi_handle dhandle, atpx_handle;
2131 acpi_status status;
2132
2133 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
2134 @@ -209,13 +160,8 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
2135 if (ACPI_FAILURE(status))
2136 return false;
2137
2138 - status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
2139 - if (ACPI_FAILURE(status))
2140 - return false;
2141 -
2142 radeon_atpx_priv.dhandle = dhandle;
2143 radeon_atpx_priv.atpx_handle = atpx_handle;
2144 - radeon_atpx_priv.atrm_handle = atrm_handle;
2145 return true;
2146 }
2147
2148 diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
2149 index 501f488..d306cc8 100644
2150 --- a/drivers/gpu/drm/radeon/radeon_bios.c
2151 +++ b/drivers/gpu/drm/radeon/radeon_bios.c
2152 @@ -32,6 +32,7 @@
2153
2154 #include <linux/vga_switcheroo.h>
2155 #include <linux/slab.h>
2156 +#include <linux/acpi.h>
2157 /*
2158 * BIOS.
2159 */
2160 @@ -98,16 +99,81 @@ static bool radeon_read_bios(struct radeon_device *rdev)
2161 return true;
2162 }
2163
2164 +#ifdef CONFIG_ACPI
2165 /* ATRM is used to get the BIOS on the discrete cards in
2166 * dual-gpu systems.
2167 */
2168 +/* retrieve the ROM in 4k blocks */
2169 +#define ATRM_BIOS_PAGE 4096
2170 +/**
2171 + * radeon_atrm_call - fetch a chunk of the vbios
2172 + *
2173 + * @atrm_handle: acpi ATRM handle
2174 + * @bios: vbios image pointer
2175 + * @offset: offset of vbios image data to fetch
2176 + * @len: length of vbios image data to fetch
2177 + *
2178 + * Executes ATRM to fetch a chunk of the discrete
2179 + * vbios image on PX systems (all asics).
2180 + * Returns the length of the buffer fetched.
2181 + */
2182 +static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios,
2183 + int offset, int len)
2184 +{
2185 + acpi_status status;
2186 + union acpi_object atrm_arg_elements[2], *obj;
2187 + struct acpi_object_list atrm_arg;
2188 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL};
2189 +
2190 + atrm_arg.count = 2;
2191 + atrm_arg.pointer = &atrm_arg_elements[0];
2192 +
2193 + atrm_arg_elements[0].type = ACPI_TYPE_INTEGER;
2194 + atrm_arg_elements[0].integer.value = offset;
2195 +
2196 + atrm_arg_elements[1].type = ACPI_TYPE_INTEGER;
2197 + atrm_arg_elements[1].integer.value = len;
2198 +
2199 + status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer);
2200 + if (ACPI_FAILURE(status)) {
2201 + printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status));
2202 + return -ENODEV;
2203 + }
2204 +
2205 + obj = (union acpi_object *)buffer.pointer;
2206 + memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length);
2207 + len = obj->buffer.length;
2208 + kfree(buffer.pointer);
2209 + return len;
2210 +}
2211 +
2212 static bool radeon_atrm_get_bios(struct radeon_device *rdev)
2213 {
2214 int ret;
2215 int size = 256 * 1024;
2216 int i;
2217 + struct pci_dev *pdev = NULL;
2218 + acpi_handle dhandle, atrm_handle;
2219 + acpi_status status;
2220 + bool found = false;
2221 +
2222 + /* ATRM is for the discrete card only */
2223 + if (rdev->flags & RADEON_IS_IGP)
2224 + return false;
2225 +
2226 + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
2227 + dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
2228 + if (!dhandle)
2229 + continue;
2230 +
2231 + status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
2232 + if (!ACPI_FAILURE(status)) {
2233 + found = true;
2234 + break;
2235 + }
2236 + }
2237
2238 - if (!radeon_atrm_supported(rdev->pdev))
2239 + if (!found)
2240 return false;
2241
2242 rdev->bios = kmalloc(size, GFP_KERNEL);
2243 @@ -117,9 +183,10 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
2244 }
2245
2246 for (i = 0; i < size / ATRM_BIOS_PAGE; i++) {
2247 - ret = radeon_atrm_get_bios_chunk(rdev->bios,
2248 - (i * ATRM_BIOS_PAGE),
2249 - ATRM_BIOS_PAGE);
2250 + ret = radeon_atrm_call(atrm_handle,
2251 + rdev->bios,
2252 + (i * ATRM_BIOS_PAGE),
2253 + ATRM_BIOS_PAGE);
2254 if (ret < ATRM_BIOS_PAGE)
2255 break;
2256 }
2257 @@ -130,6 +197,12 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
2258 }
2259 return true;
2260 }
2261 +#else
2262 +static inline bool radeon_atrm_get_bios(struct radeon_device *rdev)
2263 +{
2264 + return false;
2265 +}
2266 +#endif
2267
2268 static bool ni_read_disabled_bios(struct radeon_device *rdev)
2269 {
2270 @@ -476,6 +549,61 @@ static bool radeon_read_disabled_bios(struct radeon_device *rdev)
2271 return legacy_read_disabled_bios(rdev);
2272 }
2273
2274 +#ifdef CONFIG_ACPI
2275 +static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
2276 +{
2277 + bool ret = false;
2278 + struct acpi_table_header *hdr;
2279 + acpi_size tbl_size;
2280 + UEFI_ACPI_VFCT *vfct;
2281 + GOP_VBIOS_CONTENT *vbios;
2282 + VFCT_IMAGE_HEADER *vhdr;
2283 +
2284 + if (!ACPI_SUCCESS(acpi_get_table_with_size("VFCT", 1, &hdr, &tbl_size)))
2285 + return false;
2286 + if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
2287 + DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n");
2288 + goto out_unmap;
2289 + }
2290 +
2291 + vfct = (UEFI_ACPI_VFCT *)hdr;
2292 + if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) > tbl_size) {
2293 + DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n");
2294 + goto out_unmap;
2295 + }
2296 +
2297 + vbios = (GOP_VBIOS_CONTENT *)((char *)hdr + vfct->VBIOSImageOffset);
2298 + vhdr = &vbios->VbiosHeader;
2299 + DRM_INFO("ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n",
2300 + vhdr->PCIBus, vhdr->PCIDevice, vhdr->PCIFunction,
2301 + vhdr->VendorID, vhdr->DeviceID, vhdr->ImageLength);
2302 +
2303 + if (vhdr->PCIBus != rdev->pdev->bus->number ||
2304 + vhdr->PCIDevice != PCI_SLOT(rdev->pdev->devfn) ||
2305 + vhdr->PCIFunction != PCI_FUNC(rdev->pdev->devfn) ||
2306 + vhdr->VendorID != rdev->pdev->vendor ||
2307 + vhdr->DeviceID != rdev->pdev->device) {
2308 + DRM_INFO("ACPI VFCT table is not for this card\n");
2309 + goto out_unmap;
2310 + };
2311 +
2312 + if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) {
2313 + DRM_ERROR("ACPI VFCT image truncated\n");
2314 + goto out_unmap;
2315 + }
2316 +
2317 + rdev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL);
2318 + ret = !!rdev->bios;
2319 +
2320 +out_unmap:
2321 + return ret;
2322 +}
2323 +#else
2324 +static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
2325 +{
2326 + return false;
2327 +}
2328 +#endif
2329
2330 bool radeon_get_bios(struct radeon_device *rdev)
2331 {
2332 @@ -484,6 +612,8 @@ bool radeon_get_bios(struct radeon_device *rdev)
2333
2334 r = radeon_atrm_get_bios(rdev);
2335 if (r == false)
2336 + r = radeon_acpi_vfct_bios(rdev);
2337 + if (r == false)
2338 r = igp_read_bios_from_vram(rdev);
2339 if (r == false)
2340 r = radeon_read_bios(rdev);
2341 diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
2342 index 5992502..de5e0b5 100644
2343 --- a/drivers/gpu/drm/radeon/radeon_device.c
2344 +++ b/drivers/gpu/drm/radeon/radeon_device.c
2345 @@ -772,7 +772,7 @@ int radeon_device_init(struct radeon_device *rdev,
2346 if (rdev->flags & RADEON_IS_AGP)
2347 rdev->need_dma32 = true;
2348 if ((rdev->flags & RADEON_IS_PCI) &&
2349 - (rdev->family < CHIP_RS400))
2350 + (rdev->family <= CHIP_RS740))
2351 rdev->need_dma32 = true;
2352
2353 dma_bits = rdev->need_dma32 ? 32 : 40;
2354 diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
2355 index ba055e9..8d9dc44 100644
2356 --- a/drivers/gpu/drm/udl/udl_connector.c
2357 +++ b/drivers/gpu/drm/udl/udl_connector.c
2358 @@ -69,6 +69,13 @@ static int udl_get_modes(struct drm_connector *connector)
2359 static int udl_mode_valid(struct drm_connector *connector,
2360 struct drm_display_mode *mode)
2361 {
2362 + struct udl_device *udl = connector->dev->dev_private;
2363 + if (!udl->sku_pixel_limit)
2364 + return 0;
2365 +
2366 + if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit)
2367 + return MODE_VIRTUAL_Y;
2368 +
2369 return 0;
2370 }
2371
2372 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
2373 index 7279b3e..3a4b15a 100644
2374 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
2375 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
2376 @@ -1159,6 +1159,11 @@ static struct drm_driver driver = {
2377 .open = vmw_driver_open,
2378 .preclose = vmw_preclose,
2379 .postclose = vmw_postclose,
2380 +
2381 + .dumb_create = vmw_dumb_create,
2382 + .dumb_map_offset = vmw_dumb_map_offset,
2383 + .dumb_destroy = vmw_dumb_destroy,
2384 +
2385 .fops = &vmwgfx_driver_fops,
2386 .name = VMWGFX_DRIVER_NAME,
2387 .desc = VMWGFX_DRIVER_DESC,
2388 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
2389 index d0f2c07..29c984f 100644
2390 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
2391 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
2392 @@ -645,6 +645,16 @@ int vmw_kms_readback(struct vmw_private *dev_priv,
2393 int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
2394 struct drm_file *file_priv);
2395
2396 +int vmw_dumb_create(struct drm_file *file_priv,
2397 + struct drm_device *dev,
2398 + struct drm_mode_create_dumb *args);
2399 +
2400 +int vmw_dumb_map_offset(struct drm_file *file_priv,
2401 + struct drm_device *dev, uint32_t handle,
2402 + uint64_t *offset);
2403 +int vmw_dumb_destroy(struct drm_file *file_priv,
2404 + struct drm_device *dev,
2405 + uint32_t handle);
2406 /**
2407 * Overlay control - vmwgfx_overlay.c
2408 */
2409 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
2410 index f2fb8f1..7e07433 100644
2411 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
2412 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
2413 @@ -1018,7 +1018,7 @@ int vmw_event_fence_action_create(struct drm_file *file_priv,
2414 }
2415
2416
2417 - event = kzalloc(sizeof(event->event), GFP_KERNEL);
2418 + event = kzalloc(sizeof(*event), GFP_KERNEL);
2419 if (unlikely(event == NULL)) {
2420 DRM_ERROR("Failed to allocate an event.\n");
2421 ret = -ENOMEM;
2422 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
2423 index a37abb5..059b32c 100644
2424 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
2425 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
2426 @@ -1917,3 +1917,76 @@ err_ref:
2427 vmw_resource_unreference(&res);
2428 return ret;
2429 }
2430 +
2431 +
2432 +int vmw_dumb_create(struct drm_file *file_priv,
2433 + struct drm_device *dev,
2434 + struct drm_mode_create_dumb *args)
2435 +{
2436 + struct vmw_private *dev_priv = vmw_priv(dev);
2437 + struct vmw_master *vmaster = vmw_master(file_priv->master);
2438 + struct vmw_user_dma_buffer *vmw_user_bo;
2439 + struct ttm_buffer_object *tmp;
2440 + int ret;
2441 +
2442 + args->pitch = args->width * ((args->bpp + 7) / 8);
2443 + args->size = args->pitch * args->height;
2444 +
2445 + vmw_user_bo = kzalloc(sizeof(*vmw_user_bo), GFP_KERNEL);
2446 + if (vmw_user_bo == NULL)
2447 + return -ENOMEM;
2448 +
2449 + ret = ttm_read_lock(&vmaster->lock, true);
2450 + if (ret != 0) {
2451 + kfree(vmw_user_bo);
2452 + return ret;
2453 + }
2454 +
2455 + ret = vmw_dmabuf_init(dev_priv, &vmw_user_bo->dma, args->size,
2456 + &vmw_vram_sys_placement, true,
2457 + &vmw_user_dmabuf_destroy);
2458 + if (ret != 0)
2459 + goto out_no_dmabuf;
2460 +
2461 + tmp = ttm_bo_reference(&vmw_user_bo->dma.base);
2462 + ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile,
2463 + &vmw_user_bo->base,
2464 + false,
2465 + ttm_buffer_type,
2466 + &vmw_user_dmabuf_release, NULL);
2467 + if (unlikely(ret != 0))
2468 + goto out_no_base_object;
2469 +
2470 + args->handle = vmw_user_bo->base.hash.key;
2471 +
2472 +out_no_base_object:
2473 + ttm_bo_unref(&tmp);
2474 +out_no_dmabuf:
2475 + ttm_read_unlock(&vmaster->lock);
2476 + return ret;
2477 +}
2478 +
2479 +int vmw_dumb_map_offset(struct drm_file *file_priv,
2480 + struct drm_device *dev, uint32_t handle,
2481 + uint64_t *offset)
2482 +{
2483 + struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
2484 + struct vmw_dma_buffer *out_buf;
2485 + int ret;
2486 +
2487 + ret = vmw_user_dmabuf_lookup(tfile, handle, &out_buf);
2488 + if (ret != 0)
2489 + return -EINVAL;
2490 +
2491 + *offset = out_buf->base.addr_space_offset;
2492 + vmw_dmabuf_unreference(&out_buf);
2493 + return 0;
2494 +}
2495 +
2496 +int vmw_dumb_destroy(struct drm_file *file_priv,
2497 + struct drm_device *dev,
2498 + uint32_t handle)
2499 +{
2500 + return ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
2501 + handle, TTM_REF_USAGE);
2502 +}
2503 diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
2504 index d44ea58..88d2010 100644
2505 --- a/drivers/hid/hid-logitech-dj.c
2506 +++ b/drivers/hid/hid-logitech-dj.c
2507 @@ -185,6 +185,7 @@ static struct hid_ll_driver logi_dj_ll_driver;
2508 static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf,
2509 size_t count,
2510 unsigned char report_type);
2511 +static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev);
2512
2513 static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev,
2514 struct dj_report *dj_report)
2515 @@ -225,6 +226,7 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
2516 if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] &
2517 SPFUNCTION_DEVICE_LIST_EMPTY) {
2518 dbg_hid("%s: device list is empty\n", __func__);
2519 + djrcv_dev->querying_devices = false;
2520 return;
2521 }
2522
2523 @@ -235,6 +237,12 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
2524 return;
2525 }
2526
2527 + if (djrcv_dev->paired_dj_devices[dj_report->device_index]) {
2528 + /* The device is already known. No need to reallocate it. */
2529 + dbg_hid("%s: device is already known\n", __func__);
2530 + return;
2531 + }
2532 +
2533 dj_hiddev = hid_allocate_device();
2534 if (IS_ERR(dj_hiddev)) {
2535 dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n",
2536 @@ -298,6 +306,7 @@ static void delayedwork_callback(struct work_struct *work)
2537 struct dj_report dj_report;
2538 unsigned long flags;
2539 int count;
2540 + int retval;
2541
2542 dbg_hid("%s\n", __func__);
2543
2544 @@ -330,6 +339,25 @@ static void delayedwork_callback(struct work_struct *work)
2545 logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report);
2546 break;
2547 default:
2548 + /* A normal report (i. e. not belonging to a pair/unpair notification)
2549 + * arriving here, means that the report arrived but we did not have a
2550 + * paired dj_device associated to the report's device_index, this
2551 + * means that the original "device paired" notification corresponding
2552 + * to this dj_device never arrived to this driver. The reason is that
2553 + * hid-core discards all packets coming from a device while probe() is
2554 + * executing. */
2555 + if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) {
2556 + /* ok, we don't know the device, just re-ask the
2557 + * receiver for the list of connected devices. */
2558 + retval = logi_dj_recv_query_paired_devices(djrcv_dev);
2559 + if (!retval) {
2560 + /* everything went fine, so just leave */
2561 + break;
2562 + }
2563 + dev_err(&djrcv_dev->hdev->dev,
2564 + "%s:logi_dj_recv_query_paired_devices "
2565 + "error:%d\n", __func__, retval);
2566 + }
2567 dbg_hid("%s: unexpected report type\n", __func__);
2568 }
2569 }
2570 @@ -360,6 +388,12 @@ static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev,
2571 if (!djdev) {
2572 dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]"
2573 " is NULL, index %d\n", dj_report->device_index);
2574 + kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report));
2575 +
2576 + if (schedule_work(&djrcv_dev->work) == 0) {
2577 + dbg_hid("%s: did not schedule the work item, was already "
2578 + "queued\n", __func__);
2579 + }
2580 return;
2581 }
2582
2583 @@ -390,6 +424,12 @@ static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev,
2584 if (dj_device == NULL) {
2585 dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]"
2586 " is NULL, index %d\n", dj_report->device_index);
2587 + kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report));
2588 +
2589 + if (schedule_work(&djrcv_dev->work) == 0) {
2590 + dbg_hid("%s: did not schedule the work item, was already "
2591 + "queued\n", __func__);
2592 + }
2593 return;
2594 }
2595
2596 @@ -437,6 +477,7 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
2597 return logi_dj_recv_send_report(djrcv_dev, &dj_report);
2598 }
2599
2600 +
2601 static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
2602 unsigned timeout)
2603 {
2604 diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h
2605 index fd28a5e..4a40003 100644
2606 --- a/drivers/hid/hid-logitech-dj.h
2607 +++ b/drivers/hid/hid-logitech-dj.h
2608 @@ -101,6 +101,7 @@ struct dj_receiver_dev {
2609 struct work_struct work;
2610 struct kfifo notif_fifo;
2611 spinlock_t lock;
2612 + bool querying_devices;
2613 };
2614
2615 struct dj_device {
2616 diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c
2617 index f85ce70..9815f9c 100644
2618 --- a/drivers/hwmon/ad7314.c
2619 +++ b/drivers/hwmon/ad7314.c
2620 @@ -94,10 +94,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
2621 }
2622 }
2623
2624 +static ssize_t ad7314_show_name(struct device *dev,
2625 + struct device_attribute *devattr, char *buf)
2626 +{
2627 + return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
2628 +}
2629 +
2630 +static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
2631 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
2632 ad7314_show_temperature, NULL, 0);
2633
2634 static struct attribute *ad7314_attributes[] = {
2635 + &dev_attr_name.attr,
2636 &sensor_dev_attr_temp1_input.dev_attr.attr,
2637 NULL,
2638 };
2639 diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
2640 index e65c6e4..7bf4ce3 100644
2641 --- a/drivers/hwmon/ads7871.c
2642 +++ b/drivers/hwmon/ads7871.c
2643 @@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev,
2644 }
2645 }
2646
2647 +static ssize_t ads7871_show_name(struct device *dev,
2648 + struct device_attribute *devattr, char *buf)
2649 +{
2650 + return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
2651 +}
2652 +
2653 static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);
2654 static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);
2655 static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
2656 @@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5);
2657 static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);
2658 static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7);
2659
2660 +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL);
2661 +
2662 static struct attribute *ads7871_attributes[] = {
2663 &sensor_dev_attr_in0_input.dev_attr.attr,
2664 &sensor_dev_attr_in1_input.dev_attr.attr,
2665 @@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = {
2666 &sensor_dev_attr_in5_input.dev_attr.attr,
2667 &sensor_dev_attr_in6_input.dev_attr.attr,
2668 &sensor_dev_attr_in7_input.dev_attr.attr,
2669 + &dev_attr_name.attr,
2670 NULL
2671 };
2672
2673 diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
2674 index e8e18ca..ac2d6cb 100644
2675 --- a/drivers/hwmon/fam15h_power.c
2676 +++ b/drivers/hwmon/fam15h_power.c
2677 @@ -128,12 +128,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
2678 * counter saturations resulting in bogus power readings.
2679 * We correct this value ourselves to cope with older BIOSes.
2680 */
2681 -static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
2682 +static const struct pci_device_id affected_device[] = {
2683 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
2684 { 0 }
2685 };
2686
2687 -static void __devinit tweak_runavg_range(struct pci_dev *pdev)
2688 +static void tweak_runavg_range(struct pci_dev *pdev)
2689 {
2690 u32 val;
2691
2692 @@ -157,6 +157,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev)
2693 REG_TDP_RUNNING_AVERAGE, val);
2694 }
2695
2696 +#ifdef CONFIG_PM
2697 +static int fam15h_power_resume(struct pci_dev *pdev)
2698 +{
2699 + tweak_runavg_range(pdev);
2700 + return 0;
2701 +}
2702 +#else
2703 +#define fam15h_power_resume NULL
2704 +#endif
2705 +
2706 static void __devinit fam15h_power_init_data(struct pci_dev *f4,
2707 struct fam15h_power_data *data)
2708 {
2709 @@ -255,6 +265,7 @@ static struct pci_driver fam15h_power_driver = {
2710 .id_table = fam15h_power_id_table,
2711 .probe = fam15h_power_probe,
2712 .remove = __devexit_p(fam15h_power_remove),
2713 + .resume = fam15h_power_resume,
2714 };
2715
2716 static int __init fam15h_power_init(void)
2717 diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
2718 index 0018c7d..1a174f0 100644
2719 --- a/drivers/hwmon/twl4030-madc-hwmon.c
2720 +++ b/drivers/hwmon/twl4030-madc-hwmon.c
2721 @@ -44,12 +44,13 @@ static ssize_t madc_read(struct device *dev,
2722 struct device_attribute *devattr, char *buf)
2723 {
2724 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
2725 - struct twl4030_madc_request req;
2726 + struct twl4030_madc_request req = {
2727 + .channels = 1 << attr->index,
2728 + .method = TWL4030_MADC_SW2,
2729 + .type = TWL4030_MADC_WAIT,
2730 + };
2731 long val;
2732
2733 - req.channels = (1 << attr->index);
2734 - req.method = TWL4030_MADC_SW2;
2735 - req.func_cb = NULL;
2736 val = twl4030_madc_conversion(&req);
2737 if (val < 0)
2738 return val;
2739 diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
2740 index 6918773..d6cc77a 100644
2741 --- a/drivers/input/serio/i8042-x86ia64io.h
2742 +++ b/drivers/input/serio/i8042-x86ia64io.h
2743 @@ -335,6 +335,12 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
2744 },
2745 {
2746 .matches = {
2747 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
2748 + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
2749 + },
2750 + },
2751 + {
2752 + .matches = {
2753 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
2754 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
2755 },
2756 diff --git a/drivers/iommu/intr_remapping.c b/drivers/iommu/intr_remapping.c
2757 index 6777ca0..73ca321 100644
2758 --- a/drivers/iommu/intr_remapping.c
2759 +++ b/drivers/iommu/intr_remapping.c
2760 @@ -752,6 +752,7 @@ int __init parse_ioapics_under_ir(void)
2761 {
2762 struct dmar_drhd_unit *drhd;
2763 int ir_supported = 0;
2764 + int ioapic_idx;
2765
2766 for_each_drhd_unit(drhd) {
2767 struct intel_iommu *iommu = drhd->iommu;
2768 @@ -764,13 +765,20 @@ int __init parse_ioapics_under_ir(void)
2769 }
2770 }
2771
2772 - if (ir_supported && ir_ioapic_num != nr_ioapics) {
2773 - printk(KERN_WARNING
2774 - "Not all IO-APIC's listed under remapping hardware\n");
2775 - return -1;
2776 + if (!ir_supported)
2777 + return 0;
2778 +
2779 + for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) {
2780 + int ioapic_id = mpc_ioapic_id(ioapic_idx);
2781 + if (!map_ioapic_to_ir(ioapic_id)) {
2782 + pr_err(FW_BUG "ioapic %d has no mapping iommu, "
2783 + "interrupt remapping will be disabled\n",
2784 + ioapic_id);
2785 + return -1;
2786 + }
2787 }
2788
2789 - return ir_supported;
2790 + return 1;
2791 }
2792
2793 int __init ir_dev_scope_init(void)
2794 diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
2795 index 5405ec6..baf2686 100644
2796 --- a/drivers/isdn/isdnloop/isdnloop.c
2797 +++ b/drivers/isdn/isdnloop/isdnloop.c
2798 @@ -16,7 +16,6 @@
2799 #include <linux/sched.h>
2800 #include "isdnloop.h"
2801
2802 -static char *revision = "$Revision: 1.11.6.7 $";
2803 static char *isdnloop_id = "loop0";
2804
2805 MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
2806 @@ -1494,17 +1493,6 @@ isdnloop_addcard(char *id1)
2807 static int __init
2808 isdnloop_init(void)
2809 {
2810 - char *p;
2811 - char rev[10];
2812 -
2813 - if ((p = strchr(revision, ':'))) {
2814 - strcpy(rev, p + 1);
2815 - p = strchr(rev, '$');
2816 - *p = 0;
2817 - } else
2818 - strcpy(rev, " ??? ");
2819 - printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
2820 -
2821 if (isdnloop_id)
2822 return (isdnloop_addcard(isdnloop_id));
2823
2824 diff --git a/drivers/md/md.c b/drivers/md/md.c
2825 index 9ee8ce3..529ce89 100644
2826 --- a/drivers/md/md.c
2827 +++ b/drivers/md/md.c
2828 @@ -1143,8 +1143,11 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
2829 ret = 0;
2830 }
2831 rdev->sectors = rdev->sb_start;
2832 - /* Limit to 4TB as metadata cannot record more than that */
2833 - if (rdev->sectors >= (2ULL << 32))
2834 + /* Limit to 4TB as metadata cannot record more than that.
2835 + * (not needed for Linear and RAID0 as metadata doesn't
2836 + * record this size)
2837 + */
2838 + if (rdev->sectors >= (2ULL << 32) && sb->level >= 1)
2839 rdev->sectors = (2ULL << 32) - 2;
2840
2841 if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >= 1)
2842 @@ -1426,7 +1429,7 @@ super_90_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors)
2843 /* Limit to 4TB as metadata cannot record more than that.
2844 * 4TB == 2^32 KB, or 2*2^32 sectors.
2845 */
2846 - if (num_sectors >= (2ULL << 32))
2847 + if (num_sectors >= (2ULL << 32) && rdev->mddev->level >= 1)
2848 num_sectors = (2ULL << 32) - 2;
2849 md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
2850 rdev->sb_page);
2851 @@ -7417,6 +7420,8 @@ static int remove_and_add_spares(struct mddev *mddev)
2852 }
2853 }
2854 }
2855 + if (removed)
2856 + set_bit(MD_CHANGE_DEVS, &mddev->flags);
2857 return spares;
2858 }
2859
2860 @@ -7430,9 +7435,11 @@ static void reap_sync_thread(struct mddev *mddev)
2861 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
2862 /* success...*/
2863 /* activate any spares */
2864 - if (mddev->pers->spare_active(mddev))
2865 + if (mddev->pers->spare_active(mddev)) {
2866 sysfs_notify(&mddev->kobj, NULL,
2867 "degraded");
2868 + set_bit(MD_CHANGE_DEVS, &mddev->flags);
2869 + }
2870 }
2871 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
2872 mddev->pers->finish_reshape)
2873 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
2874 index a954c95..1f7e8cd 100644
2875 --- a/drivers/md/raid10.c
2876 +++ b/drivers/md/raid10.c
2877 @@ -612,20 +612,24 @@ static int raid10_mergeable_bvec(struct request_queue *q,
2878 max = biovec->bv_len;
2879
2880 if (mddev->merge_check_needed) {
2881 - struct r10bio r10_bio;
2882 + struct {
2883 + struct r10bio r10_bio;
2884 + struct r10dev devs[conf->copies];
2885 + } on_stack;
2886 + struct r10bio *r10_bio = &on_stack.r10_bio;
2887 int s;
2888 - r10_bio.sector = sector;
2889 - raid10_find_phys(conf, &r10_bio);
2890 + r10_bio->sector = sector;
2891 + raid10_find_phys(conf, r10_bio);
2892 rcu_read_lock();
2893 for (s = 0; s < conf->copies; s++) {
2894 - int disk = r10_bio.devs[s].devnum;
2895 + int disk = r10_bio->devs[s].devnum;
2896 struct md_rdev *rdev = rcu_dereference(
2897 conf->mirrors[disk].rdev);
2898 if (rdev && !test_bit(Faulty, &rdev->flags)) {
2899 struct request_queue *q =
2900 bdev_get_queue(rdev->bdev);
2901 if (q->merge_bvec_fn) {
2902 - bvm->bi_sector = r10_bio.devs[s].addr
2903 + bvm->bi_sector = r10_bio->devs[s].addr
2904 + rdev->data_offset;
2905 bvm->bi_bdev = rdev->bdev;
2906 max = min(max, q->merge_bvec_fn(
2907 @@ -637,7 +641,7 @@ static int raid10_mergeable_bvec(struct request_queue *q,
2908 struct request_queue *q =
2909 bdev_get_queue(rdev->bdev);
2910 if (q->merge_bvec_fn) {
2911 - bvm->bi_sector = r10_bio.devs[s].addr
2912 + bvm->bi_sector = r10_bio->devs[s].addr
2913 + rdev->data_offset;
2914 bvm->bi_bdev = rdev->bdev;
2915 max = min(max, q->merge_bvec_fn(
2916 diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h
2917 index 7c615613..24d45b8 100644
2918 --- a/drivers/md/raid10.h
2919 +++ b/drivers/md/raid10.h
2920 @@ -104,7 +104,7 @@ struct r10bio {
2921 * We choose the number when they are allocated.
2922 * We sometimes need an extra bio to write to the replacement.
2923 */
2924 - struct {
2925 + struct r10dev {
2926 struct bio *bio;
2927 union {
2928 struct bio *repl_bio; /* used for resync and
2929 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
2930 index 73a5800..0240576 100644
2931 --- a/drivers/md/raid5.c
2932 +++ b/drivers/md/raid5.c
2933 @@ -380,6 +380,8 @@ static int calc_degraded(struct r5conf *conf)
2934 degraded = 0;
2935 for (i = 0; i < conf->previous_raid_disks; i++) {
2936 struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev);
2937 + if (rdev && test_bit(Faulty, &rdev->flags))
2938 + rdev = rcu_dereference(conf->disks[i].replacement);
2939 if (!rdev || test_bit(Faulty, &rdev->flags))
2940 degraded++;
2941 else if (test_bit(In_sync, &rdev->flags))
2942 @@ -404,6 +406,8 @@ static int calc_degraded(struct r5conf *conf)
2943 degraded2 = 0;
2944 for (i = 0; i < conf->raid_disks; i++) {
2945 struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev);
2946 + if (rdev && test_bit(Faulty, &rdev->flags))
2947 + rdev = rcu_dereference(conf->disks[i].replacement);
2948 if (!rdev || test_bit(Faulty, &rdev->flags))
2949 degraded2++;
2950 else if (test_bit(In_sync, &rdev->flags))
2951 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
2952 index 6e16b09..cabc19c 100644
2953 --- a/drivers/media/rc/rc-main.c
2954 +++ b/drivers/media/rc/rc-main.c
2955 @@ -775,10 +775,11 @@ static ssize_t show_protocols(struct device *device,
2956 if (dev->driver_type == RC_DRIVER_SCANCODE) {
2957 enabled = dev->rc_map.rc_type;
2958 allowed = dev->allowed_protos;
2959 - } else {
2960 + } else if (dev->raw) {
2961 enabled = dev->raw->enabled_protocols;
2962 allowed = ir_raw_get_allowed_protocols();
2963 - }
2964 + } else
2965 + return -ENODEV;
2966
2967 IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
2968 (long long)allowed,
2969 diff --git a/drivers/media/video/cx25821/cx25821-core.c b/drivers/media/video/cx25821/cx25821-core.c
2970 index 7930ca5..235bf7d 100644
2971 --- a/drivers/media/video/cx25821/cx25821-core.c
2972 +++ b/drivers/media/video/cx25821/cx25821-core.c
2973 @@ -912,9 +912,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
2974 list_add_tail(&dev->devlist, &cx25821_devlist);
2975 mutex_unlock(&cx25821_devlist_mutex);
2976
2977 - strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown");
2978 - strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821");
2979 -
2980 if (dev->pci->device != 0x8210) {
2981 pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n",
2982 __func__, dev->pci->device);
2983 diff --git a/drivers/media/video/cx25821/cx25821.h b/drivers/media/video/cx25821/cx25821.h
2984 index b9aa801..029f293 100644
2985 --- a/drivers/media/video/cx25821/cx25821.h
2986 +++ b/drivers/media/video/cx25821/cx25821.h
2987 @@ -187,7 +187,7 @@ enum port {
2988 };
2989
2990 struct cx25821_board {
2991 - char *name;
2992 + const char *name;
2993 enum port porta;
2994 enum port portb;
2995 enum port portc;
2996 diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
2997 index 17bbacb..cc2ae7e 100644
2998 --- a/drivers/misc/sgi-xp/xpc_uv.c
2999 +++ b/drivers/misc/sgi-xp/xpc_uv.c
3000 @@ -18,6 +18,8 @@
3001 #include <linux/interrupt.h>
3002 #include <linux/delay.h>
3003 #include <linux/device.h>
3004 +#include <linux/cpu.h>
3005 +#include <linux/module.h>
3006 #include <linux/err.h>
3007 #include <linux/slab.h>
3008 #include <asm/uv/uv_hub.h>
3009 @@ -59,6 +61,8 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
3010 XPC_NOTIFY_MSG_SIZE_UV)
3011 #define XPC_NOTIFY_IRQ_NAME "xpc_notify"
3012
3013 +static int xpc_mq_node = -1;
3014 +
3015 static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
3016 static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
3017
3018 @@ -109,11 +113,8 @@ xpc_get_gru_mq_irq_uv(struct xpc_gru_mq_uv *mq, int cpu, char *irq_name)
3019 #if defined CONFIG_X86_64
3020 mq->irq = uv_setup_irq(irq_name, cpu, mq->mmr_blade, mq->mmr_offset,
3021 UV_AFFINITY_CPU);
3022 - if (mq->irq < 0) {
3023 - dev_err(xpc_part, "uv_setup_irq() returned error=%d\n",
3024 - -mq->irq);
3025 + if (mq->irq < 0)
3026 return mq->irq;
3027 - }
3028
3029 mq->mmr_value = uv_read_global_mmr64(mmr_pnode, mq->mmr_offset);
3030
3031 @@ -238,8 +239,9 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name,
3032 mq->mmr_blade = uv_cpu_to_blade_id(cpu);
3033
3034 nid = cpu_to_node(cpu);
3035 - page = alloc_pages_exact_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE,
3036 - pg_order);
3037 + page = alloc_pages_exact_node(nid,
3038 + GFP_KERNEL | __GFP_ZERO | GFP_THISNODE,
3039 + pg_order);
3040 if (page == NULL) {
3041 dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d "
3042 "bytes of memory on nid=%d for GRU mq\n", mq_size, nid);
3043 @@ -1731,9 +1733,50 @@ static struct xpc_arch_operations xpc_arch_ops_uv = {
3044 .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv,
3045 };
3046
3047 +static int
3048 +xpc_init_mq_node(int nid)
3049 +{
3050 + int cpu;
3051 +
3052 + get_online_cpus();
3053 +
3054 + for_each_cpu(cpu, cpumask_of_node(nid)) {
3055 + xpc_activate_mq_uv =
3056 + xpc_create_gru_mq_uv(XPC_ACTIVATE_MQ_SIZE_UV, nid,
3057 + XPC_ACTIVATE_IRQ_NAME,
3058 + xpc_handle_activate_IRQ_uv);
3059 + if (!IS_ERR(xpc_activate_mq_uv))
3060 + break;
3061 + }
3062 + if (IS_ERR(xpc_activate_mq_uv)) {
3063 + put_online_cpus();
3064 + return PTR_ERR(xpc_activate_mq_uv);
3065 + }
3066 +
3067 + for_each_cpu(cpu, cpumask_of_node(nid)) {
3068 + xpc_notify_mq_uv =
3069 + xpc_create_gru_mq_uv(XPC_NOTIFY_MQ_SIZE_UV, nid,
3070 + XPC_NOTIFY_IRQ_NAME,
3071 + xpc_handle_notify_IRQ_uv);
3072 + if (!IS_ERR(xpc_notify_mq_uv))
3073 + break;
3074 + }
3075 + if (IS_ERR(xpc_notify_mq_uv)) {
3076 + xpc_destroy_gru_mq_uv(xpc_activate_mq_uv);
3077 + put_online_cpus();
3078 + return PTR_ERR(xpc_notify_mq_uv);
3079 + }
3080 +
3081 + put_online_cpus();
3082 + return 0;
3083 +}
3084 +
3085 int
3086 xpc_init_uv(void)
3087 {
3088 + int nid;
3089 + int ret = 0;
3090 +
3091 xpc_arch_ops = xpc_arch_ops_uv;
3092
3093 if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) {
3094 @@ -1742,21 +1785,21 @@ xpc_init_uv(void)
3095 return -E2BIG;
3096 }
3097
3098 - xpc_activate_mq_uv = xpc_create_gru_mq_uv(XPC_ACTIVATE_MQ_SIZE_UV, 0,
3099 - XPC_ACTIVATE_IRQ_NAME,
3100 - xpc_handle_activate_IRQ_uv);
3101 - if (IS_ERR(xpc_activate_mq_uv))
3102 - return PTR_ERR(xpc_activate_mq_uv);
3103 + if (xpc_mq_node < 0)
3104 + for_each_online_node(nid) {
3105 + ret = xpc_init_mq_node(nid);
3106
3107 - xpc_notify_mq_uv = xpc_create_gru_mq_uv(XPC_NOTIFY_MQ_SIZE_UV, 0,
3108 - XPC_NOTIFY_IRQ_NAME,
3109 - xpc_handle_notify_IRQ_uv);
3110 - if (IS_ERR(xpc_notify_mq_uv)) {
3111 - xpc_destroy_gru_mq_uv(xpc_activate_mq_uv);
3112 - return PTR_ERR(xpc_notify_mq_uv);
3113 - }
3114 + if (!ret)
3115 + break;
3116 + }
3117 + else
3118 + ret = xpc_init_mq_node(xpc_mq_node);
3119
3120 - return 0;
3121 + if (ret < 0)
3122 + dev_err(xpc_part, "xpc_init_mq_node() returned error=%d\n",
3123 + -ret);
3124 +
3125 + return ret;
3126 }
3127
3128 void
3129 @@ -1765,3 +1808,6 @@ xpc_exit_uv(void)
3130 xpc_destroy_gru_mq_uv(xpc_notify_mq_uv);
3131 xpc_destroy_gru_mq_uv(xpc_activate_mq_uv);
3132 }
3133 +
3134 +module_param(xpc_mq_node, int, 0);
3135 +MODULE_PARM_DESC(xpc_mq_node, "Node number on which to allocate message queues.");
3136 diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
3137 index dabec55..833ff16 100644
3138 --- a/drivers/mmc/card/block.c
3139 +++ b/drivers/mmc/card/block.c
3140 @@ -1430,7 +1430,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
3141 /* complete ongoing async transfer before issuing discard */
3142 if (card->host->areq)
3143 mmc_blk_issue_rw_rq(mq, NULL);
3144 - if (req->cmd_flags & REQ_SECURE)
3145 + if (req->cmd_flags & REQ_SECURE &&
3146 + !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN))
3147 ret = mmc_blk_issue_secdiscard_rq(mq, req);
3148 else
3149 ret = mmc_blk_issue_discard_rq(mq, req);
3150 @@ -1730,6 +1731,7 @@ force_ro_fail:
3151 #define CID_MANFID_SANDISK 0x2
3152 #define CID_MANFID_TOSHIBA 0x11
3153 #define CID_MANFID_MICRON 0x13
3154 +#define CID_MANFID_SAMSUNG 0x15
3155
3156 static const struct mmc_fixup blk_fixups[] =
3157 {
3158 @@ -1766,6 +1768,28 @@ static const struct mmc_fixup blk_fixups[] =
3159 MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
3160 MMC_QUIRK_LONG_READ_TIME),
3161
3162 + /*
3163 + * On these Samsung MoviNAND parts, performing secure erase or
3164 + * secure trim can result in unrecoverable corruption due to a
3165 + * firmware bug.
3166 + */
3167 + MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3168 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3169 + MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3170 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3171 + MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3172 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3173 + MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3174 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3175 + MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3176 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3177 + MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3178 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3179 + MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3180 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3181 + MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
3182 + MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
3183 +
3184 END_FIXUP
3185 };
3186
3187 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
3188 index e3f5af9..b6def20 100644
3189 --- a/drivers/mmc/host/mxs-mmc.c
3190 +++ b/drivers/mmc/host/mxs-mmc.c
3191 @@ -280,11 +280,11 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void *dev_id)
3192 writel(stat & MXS_MMC_IRQ_BITS,
3193 host->base + HW_SSP_CTRL1 + MXS_CLR_ADDR);
3194
3195 + spin_unlock(&host->lock);
3196 +
3197 if ((stat & BM_SSP_CTRL1_SDIO_IRQ) && (stat & BM_SSP_CTRL1_SDIO_IRQ_EN))
3198 mmc_signal_sdio_irq(host->mmc);
3199
3200 - spin_unlock(&host->lock);
3201 -
3202 if (stat & BM_SSP_CTRL1_RESP_TIMEOUT_IRQ)
3203 cmd->error = -ETIMEDOUT;
3204 else if (stat & BM_SSP_CTRL1_RESP_ERR_IRQ)
3205 diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h
3206 index b97b2f5..d25f9ab 100644
3207 --- a/drivers/mmc/host/sdhci-esdhc.h
3208 +++ b/drivers/mmc/host/sdhci-esdhc.h
3209 @@ -48,14 +48,14 @@ static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
3210 int div = 1;
3211 u32 temp;
3212
3213 + if (clock == 0)
3214 + goto out;
3215 +
3216 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL);
3217 temp &= ~(ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN
3218 | ESDHC_CLOCK_MASK);
3219 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
3220
3221 - if (clock == 0)
3222 - goto out;
3223 -
3224 while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
3225 pre_div *= 2;
3226
3227 diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
3228 index 17cec0c..c015fc0 100644
3229 --- a/drivers/mtd/ubi/vtbl.c
3230 +++ b/drivers/mtd/ubi/vtbl.c
3231 @@ -346,7 +346,7 @@ retry:
3232 */
3233 err = ubi_scan_add_used(ubi, si, new_seb->pnum, new_seb->ec,
3234 vid_hdr, 0);
3235 - kfree(new_seb);
3236 + kmem_cache_free(si->scan_leb_slab, new_seb);
3237 ubi_free_vid_hdr(ubi, vid_hdr);
3238 return err;
3239
3240 @@ -359,7 +359,7 @@ write_error:
3241 list_add(&new_seb->u.list, &si->erase);
3242 goto retry;
3243 }
3244 - kfree(new_seb);
3245 + kmem_cache_free(si->scan_leb_slab, new_seb);
3246 out_free:
3247 ubi_free_vid_hdr(ubi, vid_hdr);
3248 return err;
3249 diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
3250 index 08c893c..e7823dd 100644
3251 --- a/drivers/net/can/janz-ican3.c
3252 +++ b/drivers/net/can/janz-ican3.c
3253 @@ -1250,7 +1250,6 @@ static irqreturn_t ican3_irq(int irq, void *dev_id)
3254 */
3255 static int ican3_reset_module(struct ican3_dev *mod)
3256 {
3257 - u8 val = 1 << mod->num;
3258 unsigned long start;
3259 u8 runold, runnew;
3260
3261 @@ -1264,8 +1263,7 @@ static int ican3_reset_module(struct ican3_dev *mod)
3262 runold = ioread8(mod->dpm + TARGET_RUNNING);
3263
3264 /* reset the module */
3265 - iowrite8(val, &mod->ctrl->reset_assert);
3266 - iowrite8(val, &mod->ctrl->reset_deassert);
3267 + iowrite8(0x00, &mod->dpmctrl->hwreset);
3268
3269 /* wait until the module has finished resetting and is running */
3270 start = jiffies;
3271 diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
3272 index 346785c..9d60742 100644
3273 --- a/drivers/net/can/mcp251x.c
3274 +++ b/drivers/net/can/mcp251x.c
3275 @@ -83,6 +83,11 @@
3276 #define INSTRUCTION_LOAD_TXB(n) (0x40 + 2 * (n))
3277 #define INSTRUCTION_READ_RXB(n) (((n) == 0) ? 0x90 : 0x94)
3278 #define INSTRUCTION_RESET 0xC0
3279 +#define RTS_TXB0 0x01
3280 +#define RTS_TXB1 0x02
3281 +#define RTS_TXB2 0x04
3282 +#define INSTRUCTION_RTS(n) (0x80 | ((n) & 0x07))
3283 +
3284
3285 /* MPC251x registers */
3286 #define CANSTAT 0x0e
3287 @@ -397,6 +402,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf,
3288 static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame,
3289 int tx_buf_idx)
3290 {
3291 + struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
3292 u32 sid, eid, exide, rtr;
3293 u8 buf[SPI_TRANSFER_BUF_LEN];
3294
3295 @@ -418,7 +424,10 @@ static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame,
3296 buf[TXBDLC_OFF] = (rtr << DLC_RTR_SHIFT) | frame->can_dlc;
3297 memcpy(buf + TXBDAT_OFF, frame->data, frame->can_dlc);
3298 mcp251x_hw_tx_frame(spi, buf, frame->can_dlc, tx_buf_idx);
3299 - mcp251x_write_reg(spi, TXBCTRL(tx_buf_idx), TXBCTRL_TXREQ);
3300 +
3301 + /* use INSTRUCTION_RTS, to avoid "repeated frame problem" */
3302 + priv->spi_tx_buf[0] = INSTRUCTION_RTS(1 << tx_buf_idx);
3303 + mcp251x_spi_trans(priv->spi, 1);
3304 }
3305
3306 static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf,
3307 diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
3308 index 4accd7e..5ec2700 100644
3309 --- a/drivers/net/can/ti_hecc.c
3310 +++ b/drivers/net/can/ti_hecc.c
3311 @@ -984,12 +984,12 @@ static int __devexit ti_hecc_remove(struct platform_device *pdev)
3312 struct net_device *ndev = platform_get_drvdata(pdev);
3313 struct ti_hecc_priv *priv = netdev_priv(ndev);
3314
3315 + unregister_candev(ndev);
3316 clk_disable(priv->clk);
3317 clk_put(priv->clk);
3318 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
3319 iounmap(priv->base);
3320 release_mem_region(res->start, resource_size(res));
3321 - unregister_candev(ndev);
3322 free_candev(ndev);
3323 platform_set_drvdata(pdev, NULL);
3324
3325 diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
3326 index 24381e1..0819a74 100644
3327 --- a/drivers/net/ethernet/freescale/gianfar.c
3328 +++ b/drivers/net/ethernet/freescale/gianfar.c
3329 @@ -1037,7 +1037,7 @@ static int gfar_probe(struct platform_device *ofdev)
3330
3331 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
3332 dev->hw_features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3333 - dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3334 + dev->features |= NETIF_F_HW_VLAN_RX;
3335 }
3336
3337 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) {
3338 diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
3339 index 9010cea..b68d28a 100644
3340 --- a/drivers/net/ethernet/ibm/ibmveth.c
3341 +++ b/drivers/net/ethernet/ibm/ibmveth.c
3342 @@ -472,14 +472,9 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
3343 }
3344
3345 if (adapter->rx_queue.queue_addr != NULL) {
3346 - if (!dma_mapping_error(dev, adapter->rx_queue.queue_dma)) {
3347 - dma_unmap_single(dev,
3348 - adapter->rx_queue.queue_dma,
3349 - adapter->rx_queue.queue_len,
3350 - DMA_BIDIRECTIONAL);
3351 - adapter->rx_queue.queue_dma = DMA_ERROR_CODE;
3352 - }
3353 - kfree(adapter->rx_queue.queue_addr);
3354 + dma_free_coherent(dev, adapter->rx_queue.queue_len,
3355 + adapter->rx_queue.queue_addr,
3356 + adapter->rx_queue.queue_dma);
3357 adapter->rx_queue.queue_addr = NULL;
3358 }
3359
3360 @@ -556,10 +551,13 @@ static int ibmveth_open(struct net_device *netdev)
3361 goto err_out;
3362 }
3363
3364 + dev = &adapter->vdev->dev;
3365 +
3366 adapter->rx_queue.queue_len = sizeof(struct ibmveth_rx_q_entry) *
3367 rxq_entries;
3368 - adapter->rx_queue.queue_addr = kmalloc(adapter->rx_queue.queue_len,
3369 - GFP_KERNEL);
3370 + adapter->rx_queue.queue_addr =
3371 + dma_alloc_coherent(dev, adapter->rx_queue.queue_len,
3372 + &adapter->rx_queue.queue_dma, GFP_KERNEL);
3373
3374 if (!adapter->rx_queue.queue_addr) {
3375 netdev_err(netdev, "unable to allocate rx queue pages\n");
3376 @@ -567,19 +565,13 @@ static int ibmveth_open(struct net_device *netdev)
3377 goto err_out;
3378 }
3379
3380 - dev = &adapter->vdev->dev;
3381 -
3382 adapter->buffer_list_dma = dma_map_single(dev,
3383 adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL);
3384 adapter->filter_list_dma = dma_map_single(dev,
3385 adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL);
3386 - adapter->rx_queue.queue_dma = dma_map_single(dev,
3387 - adapter->rx_queue.queue_addr,
3388 - adapter->rx_queue.queue_len, DMA_BIDIRECTIONAL);
3389
3390 if ((dma_mapping_error(dev, adapter->buffer_list_dma)) ||
3391 - (dma_mapping_error(dev, adapter->filter_list_dma)) ||
3392 - (dma_mapping_error(dev, adapter->rx_queue.queue_dma))) {
3393 + (dma_mapping_error(dev, adapter->filter_list_dma))) {
3394 netdev_err(netdev, "unable to map filter or buffer list "
3395 "pages\n");
3396 rc = -ENOMEM;
3397 diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
3398 index a73bbe7..5fb74c4 100644
3399 --- a/drivers/net/ethernet/realtek/r8169.c
3400 +++ b/drivers/net/ethernet/realtek/r8169.c
3401 @@ -3737,6 +3737,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
3402 case RTL_GIGA_MAC_VER_22:
3403 case RTL_GIGA_MAC_VER_23:
3404 case RTL_GIGA_MAC_VER_24:
3405 + case RTL_GIGA_MAC_VER_34:
3406 RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST);
3407 break;
3408 default:
3409 diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
3410 index 4a00053..954b885 100644
3411 --- a/drivers/net/ethernet/sfc/efx.c
3412 +++ b/drivers/net/ethernet/sfc/efx.c
3413 @@ -1498,6 +1498,11 @@ static int efx_probe_all(struct efx_nic *efx)
3414 goto fail2;
3415 }
3416
3417 + BUILD_BUG_ON(EFX_DEFAULT_DMAQ_SIZE < EFX_RXQ_MIN_ENT);
3418 + if (WARN_ON(EFX_DEFAULT_DMAQ_SIZE < EFX_TXQ_MIN_ENT(efx))) {
3419 + rc = -EINVAL;
3420 + goto fail3;
3421 + }
3422 efx->rxq_entries = efx->txq_entries = EFX_DEFAULT_DMAQ_SIZE;
3423
3424 rc = efx_probe_filters(efx);
3425 @@ -2065,6 +2070,7 @@ static int efx_register_netdev(struct efx_nic *efx)
3426 net_dev->irq = efx->pci_dev->irq;
3427 net_dev->netdev_ops = &efx_netdev_ops;
3428 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops);
3429 + net_dev->gso_max_segs = EFX_TSO_MAX_SEGS;
3430
3431 rtnl_lock();
3432
3433 diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
3434 index be8f915..70755c9 100644
3435 --- a/drivers/net/ethernet/sfc/efx.h
3436 +++ b/drivers/net/ethernet/sfc/efx.h
3437 @@ -30,6 +30,7 @@ extern netdev_tx_t
3438 efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
3439 extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
3440 extern int efx_setup_tc(struct net_device *net_dev, u8 num_tc);
3441 +extern unsigned int efx_tx_max_skb_descs(struct efx_nic *efx);
3442
3443 /* RX */
3444 extern int efx_probe_rx_queue(struct efx_rx_queue *rx_queue);
3445 @@ -52,10 +53,15 @@ extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
3446 #define EFX_MAX_EVQ_SIZE 16384UL
3447 #define EFX_MIN_EVQ_SIZE 512UL
3448
3449 -/* The smallest [rt]xq_entries that the driver supports. Callers of
3450 - * efx_wake_queue() assume that they can subsequently send at least one
3451 - * skb. Falcon/A1 may require up to three descriptors per skb_frag. */
3452 -#define EFX_MIN_RING_SIZE (roundup_pow_of_two(2 * 3 * MAX_SKB_FRAGS))
3453 +/* Maximum number of TCP segments we support for soft-TSO */
3454 +#define EFX_TSO_MAX_SEGS 100
3455 +
3456 +/* The smallest [rt]xq_entries that the driver supports. RX minimum
3457 + * is a bit arbitrary. For TX, we must have space for at least 2
3458 + * TSO skbs.
3459 + */
3460 +#define EFX_RXQ_MIN_ENT 128U
3461 +#define EFX_TXQ_MIN_ENT(efx) (2 * efx_tx_max_skb_descs(efx))
3462
3463 /* Filters */
3464 extern int efx_probe_filters(struct efx_nic *efx);
3465 diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
3466 index f22f45f..ff64def 100644
3467 --- a/drivers/net/ethernet/sfc/ethtool.c
3468 +++ b/drivers/net/ethernet/sfc/ethtool.c
3469 @@ -680,21 +680,27 @@ static int efx_ethtool_set_ringparam(struct net_device *net_dev,
3470 struct ethtool_ringparam *ring)
3471 {
3472 struct efx_nic *efx = netdev_priv(net_dev);
3473 + u32 txq_entries;
3474
3475 if (ring->rx_mini_pending || ring->rx_jumbo_pending ||
3476 ring->rx_pending > EFX_MAX_DMAQ_SIZE ||
3477 ring->tx_pending > EFX_MAX_DMAQ_SIZE)
3478 return -EINVAL;
3479
3480 - if (ring->rx_pending < EFX_MIN_RING_SIZE ||
3481 - ring->tx_pending < EFX_MIN_RING_SIZE) {
3482 + if (ring->rx_pending < EFX_RXQ_MIN_ENT) {
3483 netif_err(efx, drv, efx->net_dev,
3484 - "TX and RX queues cannot be smaller than %ld\n",
3485 - EFX_MIN_RING_SIZE);
3486 + "RX queues cannot be smaller than %u\n",
3487 + EFX_RXQ_MIN_ENT);
3488 return -EINVAL;
3489 }
3490
3491 - return efx_realloc_channels(efx, ring->rx_pending, ring->tx_pending);
3492 + txq_entries = max(ring->tx_pending, EFX_TXQ_MIN_ENT(efx));
3493 + if (txq_entries != ring->tx_pending)
3494 + netif_warn(efx, drv, efx->net_dev,
3495 + "increasing TX queue size to minimum of %u\n",
3496 + txq_entries);
3497 +
3498 + return efx_realloc_channels(efx, ring->rx_pending, txq_entries);
3499 }
3500
3501 static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
3502 @@ -857,8 +863,8 @@ static int efx_ethtool_get_class_rule(struct efx_nic *efx,
3503 &ip_entry->ip4dst, &ip_entry->pdst);
3504 if (rc != 0) {
3505 rc = efx_filter_get_ipv4_full(
3506 - &spec, &proto, &ip_entry->ip4src, &ip_entry->psrc,
3507 - &ip_entry->ip4dst, &ip_entry->pdst);
3508 + &spec, &proto, &ip_entry->ip4dst, &ip_entry->pdst,
3509 + &ip_entry->ip4src, &ip_entry->psrc);
3510 EFX_WARN_ON_PARANOID(rc);
3511 ip_mask->ip4src = ~0;
3512 ip_mask->psrc = ~0;
3513 diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
3514 index 94d0365..305430d 100644
3515 --- a/drivers/net/ethernet/sfc/tx.c
3516 +++ b/drivers/net/ethernet/sfc/tx.c
3517 @@ -119,6 +119,25 @@ efx_max_tx_len(struct efx_nic *efx, dma_addr_t dma_addr)
3518 return len;
3519 }
3520
3521 +unsigned int efx_tx_max_skb_descs(struct efx_nic *efx)
3522 +{
3523 + /* Header and payload descriptor for each output segment, plus
3524 + * one for every input fragment boundary within a segment
3525 + */
3526 + unsigned int max_descs = EFX_TSO_MAX_SEGS * 2 + MAX_SKB_FRAGS;
3527 +
3528 + /* Possibly one more per segment for the alignment workaround */
3529 + if (EFX_WORKAROUND_5391(efx))
3530 + max_descs += EFX_TSO_MAX_SEGS;
3531 +
3532 + /* Possibly more for PCIe page boundaries within input fragments */
3533 + if (PAGE_SIZE > EFX_PAGE_SIZE)
3534 + max_descs += max_t(unsigned int, MAX_SKB_FRAGS,
3535 + DIV_ROUND_UP(GSO_MAX_SIZE, EFX_PAGE_SIZE));
3536 +
3537 + return max_descs;
3538 +}
3539 +
3540 /*
3541 * Add a socket buffer to a TX queue
3542 *
3543 diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
3544 index c1d602d..b99c418 100644
3545 --- a/drivers/net/macvtap.c
3546 +++ b/drivers/net/macvtap.c
3547 @@ -506,10 +506,11 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
3548 if (copy > size) {
3549 ++from;
3550 --count;
3551 - }
3552 + offset = 0;
3553 + } else
3554 + offset += size;
3555 copy -= size;
3556 offset1 += size;
3557 - offset = 0;
3558 }
3559
3560 if (len == offset1)
3561 @@ -519,25 +520,28 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
3562 struct page *page[MAX_SKB_FRAGS];
3563 int num_pages;
3564 unsigned long base;
3565 + unsigned long truesize;
3566
3567 - len = from->iov_len - offset1;
3568 + len = from->iov_len - offset;
3569 if (!len) {
3570 - offset1 = 0;
3571 + offset = 0;
3572 ++from;
3573 continue;
3574 }
3575 - base = (unsigned long)from->iov_base + offset1;
3576 + base = (unsigned long)from->iov_base + offset;
3577 size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
3578 if (i + size > MAX_SKB_FRAGS)
3579 return -EMSGSIZE;
3580 num_pages = get_user_pages_fast(base, size, 0, &page[i]);
3581 - if (num_pages != size)
3582 - /* put_page is in skb free */
3583 - return -EFAULT;
3584 + if (num_pages != size) {
3585 + for (i = 0; i < num_pages; i++)
3586 + put_page(page[i]);
3587 + }
3588 + truesize = size * PAGE_SIZE;
3589 skb->data_len += len;
3590 skb->len += len;
3591 - skb->truesize += len;
3592 - atomic_add(len, &skb->sk->sk_wmem_alloc);
3593 + skb->truesize += truesize;
3594 + atomic_add(truesize, &skb->sk->sk_wmem_alloc);
3595 while (len) {
3596 int off = base & ~PAGE_MASK;
3597 int size = min_t(int, len, PAGE_SIZE - off);
3598 @@ -548,7 +552,7 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
3599 len -= size;
3600 i++;
3601 }
3602 - offset1 = 0;
3603 + offset = 0;
3604 ++from;
3605 }
3606 return 0;
3607 @@ -712,10 +716,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
3608 if (!skb)
3609 goto err;
3610
3611 - if (zerocopy) {
3612 + if (zerocopy)
3613 err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count);
3614 - skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
3615 - } else
3616 + else
3617 err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len,
3618 len);
3619 if (err)
3620 @@ -734,8 +737,10 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
3621 rcu_read_lock_bh();
3622 vlan = rcu_dereference_bh(q->vlan);
3623 /* copy skb_ubuf_info for callback when skb has no error */
3624 - if (zerocopy)
3625 + if (zerocopy) {
3626 skb_shinfo(skb)->destructor_arg = m->msg_control;
3627 + skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
3628 + }
3629 if (vlan)
3630 macvlan_start_xmit(skb, vlan->dev);
3631 else
3632 diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
3633 index f9347ea..63ffbdf 100644
3634 --- a/drivers/net/netconsole.c
3635 +++ b/drivers/net/netconsole.c
3636 @@ -648,7 +648,6 @@ static int netconsole_netdev_event(struct notifier_block *this,
3637 flags);
3638 dev_put(nt->np.dev);
3639 nt->np.dev = NULL;
3640 - netconsole_target_put(nt);
3641 }
3642 nt->enabled = 0;
3643 stopped = true;
3644 diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
3645 index 885dbdd..f617566 100644
3646 --- a/drivers/net/ppp/pptp.c
3647 +++ b/drivers/net/ppp/pptp.c
3648 @@ -189,7 +189,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
3649 if (sk_pppox(po)->sk_state & PPPOX_DEAD)
3650 goto tx_error;
3651
3652 - rt = ip_route_output_ports(&init_net, &fl4, NULL,
3653 + rt = ip_route_output_ports(sock_net(sk), &fl4, NULL,
3654 opt->dst_addr.sin_addr.s_addr,
3655 opt->src_addr.sin_addr.s_addr,
3656 0, 0, IPPROTO_GRE,
3657 @@ -468,7 +468,7 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
3658 po->chan.private = sk;
3659 po->chan.ops = &pptp_chan_ops;
3660
3661 - rt = ip_route_output_ports(&init_net, &fl4, sk,
3662 + rt = ip_route_output_ports(sock_net(sk), &fl4, sk,
3663 opt->dst_addr.sin_addr.s_addr,
3664 opt->src_addr.sin_addr.s_addr,
3665 0, 0,
3666 diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
3667 index 609fcc3..ef84a58 100644
3668 --- a/drivers/net/usb/asix.c
3669 +++ b/drivers/net/usb/asix.c
3670 @@ -1604,6 +1604,10 @@ static const struct usb_device_id products [] = {
3671 USB_DEVICE (0x2001, 0x3c05),
3672 .driver_info = (unsigned long) &ax88772_info,
3673 }, {
3674 + // DLink DUB-E100 H/W Ver C1
3675 + USB_DEVICE (0x2001, 0x1a02),
3676 + .driver_info = (unsigned long) &ax88772_info,
3677 +}, {
3678 // Linksys USB1000
3679 USB_DEVICE (0x1737, 0x0039),
3680 .driver_info = (unsigned long) &ax88178_info,
3681 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
3682 index c2ae426..8669c77 100644
3683 --- a/drivers/net/usb/qmi_wwan.c
3684 +++ b/drivers/net/usb/qmi_wwan.c
3685 @@ -346,6 +346,15 @@ static const struct driver_info qmi_wwan_force_int1 = {
3686 .data = BIT(1), /* interface whitelist bitmap */
3687 };
3688
3689 +static const struct driver_info qmi_wwan_force_int2 = {
3690 + .description = "Qualcomm WWAN/QMI device",
3691 + .flags = FLAG_WWAN,
3692 + .bind = qmi_wwan_bind_shared,
3693 + .unbind = qmi_wwan_unbind_shared,
3694 + .manage_power = qmi_wwan_manage_power,
3695 + .data = BIT(2), /* interface whitelist bitmap */
3696 +};
3697 +
3698 static const struct driver_info qmi_wwan_force_int3 = {
3699 .description = "Qualcomm WWAN/QMI device",
3700 .flags = FLAG_WWAN,
3701 @@ -407,6 +416,14 @@ static const struct usb_device_id products[] = {
3702 .bInterfaceProtocol = 8, /* NOTE: This is the *slave* interface of the CDC Union! */
3703 .driver_info = (unsigned long)&qmi_wwan_info,
3704 },
3705 + { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
3706 + .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
3707 + .idVendor = HUAWEI_VENDOR_ID,
3708 + .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
3709 + .bInterfaceSubClass = 1,
3710 + .bInterfaceProtocol = 56, /* NOTE: This is the *slave* interface of the CDC Union! */
3711 + .driver_info = (unsigned long)&qmi_wwan_info,
3712 + },
3713 { /* Huawei E392, E398 and possibly others in "Windows mode"
3714 * using a combined control and data interface without any CDC
3715 * functional descriptors
3716 @@ -427,6 +444,15 @@ static const struct usb_device_id products[] = {
3717 .bInterfaceProtocol = 0xff,
3718 .driver_info = (unsigned long)&qmi_wwan_shared,
3719 },
3720 + { /* Pantech UML290 - newer firmware */
3721 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3722 + .idVendor = 0x106c,
3723 + .idProduct = 0x3718,
3724 + .bInterfaceClass = 0xff,
3725 + .bInterfaceSubClass = 0xf1,
3726 + .bInterfaceProtocol = 0xff,
3727 + .driver_info = (unsigned long)&qmi_wwan_shared,
3728 + },
3729 { /* ZTE MF820D */
3730 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3731 .idVendor = 0x19d2,
3732 @@ -436,6 +462,15 @@ static const struct usb_device_id products[] = {
3733 .bInterfaceProtocol = 0xff,
3734 .driver_info = (unsigned long)&qmi_wwan_force_int4,
3735 },
3736 + { /* ZTE MF821D */
3737 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3738 + .idVendor = 0x19d2,
3739 + .idProduct = 0x0326,
3740 + .bInterfaceClass = 0xff,
3741 + .bInterfaceSubClass = 0xff,
3742 + .bInterfaceProtocol = 0xff,
3743 + .driver_info = (unsigned long)&qmi_wwan_force_int4,
3744 + },
3745 { /* ZTE (Vodafone) K3520-Z */
3746 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3747 .idVendor = 0x19d2,
3748 @@ -472,6 +507,15 @@ static const struct usb_device_id products[] = {
3749 .bInterfaceProtocol = 0xff,
3750 .driver_info = (unsigned long)&qmi_wwan_force_int4,
3751 },
3752 + { /* ZTE (Vodafone) K3765-Z */
3753 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3754 + .idVendor = 0x19d2,
3755 + .idProduct = 0x2002,
3756 + .bInterfaceClass = 0xff,
3757 + .bInterfaceSubClass = 0xff,
3758 + .bInterfaceProtocol = 0xff,
3759 + .driver_info = (unsigned long)&qmi_wwan_force_int4,
3760 + },
3761 { /* ZTE (Vodafone) K4505-Z */
3762 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3763 .idVendor = 0x19d2,
3764 @@ -481,6 +525,24 @@ static const struct usb_device_id products[] = {
3765 .bInterfaceProtocol = 0xff,
3766 .driver_info = (unsigned long)&qmi_wwan_force_int4,
3767 },
3768 + { /* ZTE (Vodafone) K5006-Z */
3769 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3770 + .idVendor = 0x19d2,
3771 + .idProduct = 0x1018,
3772 + .bInterfaceClass = 0xff,
3773 + .bInterfaceSubClass = 0xff,
3774 + .bInterfaceProtocol = 0xff,
3775 + .driver_info = (unsigned long)&qmi_wwan_force_int3,
3776 + },
3777 + { /* ZTE MF60 */
3778 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3779 + .idVendor = 0x19d2,
3780 + .idProduct = 0x1402,
3781 + .bInterfaceClass = 0xff,
3782 + .bInterfaceSubClass = 0xff,
3783 + .bInterfaceProtocol = 0xff,
3784 + .driver_info = (unsigned long)&qmi_wwan_force_int2,
3785 + },
3786 { /* Sierra Wireless MC77xx in QMI mode */
3787 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3788 .idVendor = 0x1199,
3789 @@ -490,6 +552,33 @@ static const struct usb_device_id products[] = {
3790 .bInterfaceProtocol = 0xff,
3791 .driver_info = (unsigned long)&qmi_wwan_sierra,
3792 },
3793 + { /* Sierra Wireless MC7700 */
3794 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3795 + .idVendor = 0x0f3d,
3796 + .idProduct = 0x68a2,
3797 + .bInterfaceClass = 0xff,
3798 + .bInterfaceSubClass = 0xff,
3799 + .bInterfaceProtocol = 0xff,
3800 + .driver_info = (unsigned long)&qmi_wwan_sierra,
3801 + },
3802 + { /* Sierra Wireless MC7750 */
3803 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3804 + .idVendor = 0x114f,
3805 + .idProduct = 0x68a2,
3806 + .bInterfaceClass = 0xff,
3807 + .bInterfaceSubClass = 0xff,
3808 + .bInterfaceProtocol = 0xff,
3809 + .driver_info = (unsigned long)&qmi_wwan_sierra,
3810 + },
3811 + { /* Sierra Wireless EM7700 */
3812 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
3813 + .idVendor = 0x1199,
3814 + .idProduct = 0x901c,
3815 + .bInterfaceClass = 0xff,
3816 + .bInterfaceSubClass = 0xff,
3817 + .bInterfaceProtocol = 0xff,
3818 + .driver_info = (unsigned long)&qmi_wwan_sierra,
3819 + },
3820
3821 /* Gobi 1000 devices */
3822 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
3823 @@ -517,6 +606,8 @@ static const struct usb_device_id products[] = {
3824 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
3825 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
3826 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
3827 + {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */
3828 + {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */
3829 {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
3830 {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
3831 {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
3832 @@ -531,6 +622,10 @@ static const struct usb_device_id products[] = {
3833 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
3834 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
3835 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
3836 + {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
3837 + {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
3838 + {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
3839 +
3840 { } /* END */
3841 };
3842 MODULE_DEVICE_TABLE(usb, products);
3843 diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
3844 index 4187435..4db878d 100644
3845 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
3846 +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
3847 @@ -764,8 +764,11 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode)
3848 {
3849 char iovbuf[32];
3850 int retcode;
3851 + __le32 arp_mode_le;
3852
3853 - brcmf_c_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));
3854 + arp_mode_le = cpu_to_le32(arp_mode);
3855 + brcmf_c_mkiovar("arp_ol", (char *)&arp_mode_le, 4, iovbuf,
3856 + sizeof(iovbuf));
3857 retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR,
3858 iovbuf, sizeof(iovbuf));
3859 retcode = retcode >= 0 ? 0 : retcode;
3860 @@ -781,8 +784,11 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
3861 {
3862 char iovbuf[32];
3863 int retcode;
3864 + __le32 arp_enable_le;
3865
3866 - brcmf_c_mkiovar("arpoe", (char *)&arp_enable, 4,
3867 + arp_enable_le = cpu_to_le32(arp_enable);
3868 +
3869 + brcmf_c_mkiovar("arpoe", (char *)&arp_enable_le, 4,
3870 iovbuf, sizeof(iovbuf));
3871 retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR,
3872 iovbuf, sizeof(iovbuf));
3873 @@ -803,10 +809,10 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr)
3874 char buf[128], *ptr;
3875 u32 dongle_align = drvr->bus_if->align;
3876 u32 glom = 0;
3877 - u32 roaming = 1;
3878 - uint bcn_timeout = 3;
3879 - int scan_assoc_time = 40;
3880 - int scan_unassoc_time = 40;
3881 + __le32 roaming_le = cpu_to_le32(1);
3882 + __le32 bcn_timeout_le = cpu_to_le32(3);
3883 + __le32 scan_assoc_time_le = cpu_to_le32(40);
3884 + __le32 scan_unassoc_time_le = cpu_to_le32(40);
3885 int i;
3886
3887 mutex_lock(&drvr->proto_block);
3888 @@ -841,14 +847,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr)
3889
3890 /* Setup timeout if Beacons are lost and roam is off to report
3891 link down */
3892 - brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
3893 + brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout_le, 4, iovbuf,
3894 sizeof(iovbuf));
3895 brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
3896 sizeof(iovbuf));
3897
3898 /* Enable/Disable build-in roaming to allowed ext supplicant to take
3899 of romaing */
3900 - brcmf_c_mkiovar("roam_off", (char *)&roaming, 4,
3901 + brcmf_c_mkiovar("roam_off", (char *)&roaming_le, 4,
3902 iovbuf, sizeof(iovbuf));
3903 brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
3904 sizeof(iovbuf));
3905 @@ -863,9 +869,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr)
3906 sizeof(iovbuf));
3907
3908 brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME,
3909 - (char *)&scan_assoc_time, sizeof(scan_assoc_time));
3910 + (char *)&scan_assoc_time_le, sizeof(scan_assoc_time_le));
3911 brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME,
3912 - (char *)&scan_unassoc_time, sizeof(scan_unassoc_time));
3913 + (char *)&scan_unassoc_time_le, sizeof(scan_unassoc_time_le));
3914
3915 /* Set and enable ARP offload feature */
3916 brcmf_c_arp_offload_set(drvr, BRCMF_ARPOL_MODE);
3917 diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
3918 index d13ae9c..e360939 100644
3919 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
3920 +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
3921 @@ -500,8 +500,10 @@ static void wl_iscan_prep(struct brcmf_scan_params_le *params_le,
3922 params_le->active_time = cpu_to_le32(-1);
3923 params_le->passive_time = cpu_to_le32(-1);
3924 params_le->home_time = cpu_to_le32(-1);
3925 - if (ssid && ssid->SSID_len)
3926 - memcpy(&params_le->ssid_le, ssid, sizeof(struct brcmf_ssid));
3927 + if (ssid && ssid->SSID_len) {
3928 + params_le->ssid_le.SSID_len = cpu_to_le32(ssid->SSID_len);
3929 + memcpy(&params_le->ssid_le.SSID, ssid->SSID, ssid->SSID_len);
3930 + }
3931 }
3932
3933 static s32
3934 diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
3935 index 3a6b402..0ea85f4 100644
3936 --- a/drivers/net/wireless/rt2x00/rt2400pci.c
3937 +++ b/drivers/net/wireless/rt2x00/rt2400pci.c
3938 @@ -1611,6 +1611,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
3939 static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
3940 {
3941 int retval;
3942 + u32 reg;
3943
3944 /*
3945 * Allocate eeprom data.
3946 @@ -1624,6 +1625,14 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
3947 return retval;
3948
3949 /*
3950 + * Enable rfkill polling by setting GPIO direction of the
3951 + * rfkill switch GPIO pin correctly.
3952 + */
3953 + rt2x00pci_register_read(rt2x00dev, GPIOCSR, &reg);
3954 + rt2x00_set_field32(&reg, GPIOCSR_BIT8, 1);
3955 + rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg);
3956 +
3957 + /*
3958 * Initialize hw specifications.
3959 */
3960 retval = rt2400pci_probe_hw_mode(rt2x00dev);
3961 diff --git a/drivers/net/wireless/rt2x00/rt2400pci.h b/drivers/net/wireless/rt2x00/rt2400pci.h
3962 index d3a4a68..7564ae9 100644
3963 --- a/drivers/net/wireless/rt2x00/rt2400pci.h
3964 +++ b/drivers/net/wireless/rt2x00/rt2400pci.h
3965 @@ -670,6 +670,7 @@
3966 #define GPIOCSR_BIT5 FIELD32(0x00000020)
3967 #define GPIOCSR_BIT6 FIELD32(0x00000040)
3968 #define GPIOCSR_BIT7 FIELD32(0x00000080)
3969 +#define GPIOCSR_BIT8 FIELD32(0x00000100)
3970
3971 /*
3972 * BBPPCSR: BBP Pin control register.
3973 diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
3974 index dcc0e1f..aa10c48 100644
3975 --- a/drivers/net/wireless/rt2x00/rt2500pci.c
3976 +++ b/drivers/net/wireless/rt2x00/rt2500pci.c
3977 @@ -1929,6 +1929,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
3978 static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
3979 {
3980 int retval;
3981 + u32 reg;
3982
3983 /*
3984 * Allocate eeprom data.
3985 @@ -1942,6 +1943,14 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
3986 return retval;
3987
3988 /*
3989 + * Enable rfkill polling by setting GPIO direction of the
3990 + * rfkill switch GPIO pin correctly.
3991 + */
3992 + rt2x00pci_register_read(rt2x00dev, GPIOCSR, &reg);
3993 + rt2x00_set_field32(&reg, GPIOCSR_DIR0, 1);
3994 + rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg);
3995 +
3996 + /*
3997 * Initialize hw specifications.
3998 */
3999 retval = rt2500pci_probe_hw_mode(rt2x00dev);
4000 diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
4001 index 1de9c75..e0a7efc 100644
4002 --- a/drivers/net/wireless/rt2x00/rt2500usb.c
4003 +++ b/drivers/net/wireless/rt2x00/rt2500usb.c
4004 @@ -283,7 +283,7 @@ static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)
4005 u16 reg;
4006
4007 rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg);
4008 - return rt2x00_get_field32(reg, MAC_CSR19_BIT7);
4009 + return rt2x00_get_field16(reg, MAC_CSR19_BIT7);
4010 }
4011
4012 #ifdef CONFIG_RT2X00_LIB_LEDS
4013 @@ -1768,6 +1768,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
4014 static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
4015 {
4016 int retval;
4017 + u16 reg;
4018
4019 /*
4020 * Allocate eeprom data.
4021 @@ -1781,6 +1782,14 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
4022 return retval;
4023
4024 /*
4025 + * Enable rfkill polling by setting GPIO direction of the
4026 + * rfkill switch GPIO pin correctly.
4027 + */
4028 + rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg);
4029 + rt2x00_set_field16(&reg, MAC_CSR19_BIT8, 0);
4030 + rt2500usb_register_write(rt2x00dev, MAC_CSR19, reg);
4031 +
4032 + /*
4033 * Initialize hw specifications.
4034 */
4035 retval = rt2500usb_probe_hw_mode(rt2x00dev);
4036 diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h
4037 index b493306..196bd51 100644
4038 --- a/drivers/net/wireless/rt2x00/rt2500usb.h
4039 +++ b/drivers/net/wireless/rt2x00/rt2500usb.h
4040 @@ -189,14 +189,15 @@
4041 * MAC_CSR19: GPIO control register.
4042 */
4043 #define MAC_CSR19 0x0426
4044 -#define MAC_CSR19_BIT0 FIELD32(0x0001)
4045 -#define MAC_CSR19_BIT1 FIELD32(0x0002)
4046 -#define MAC_CSR19_BIT2 FIELD32(0x0004)
4047 -#define MAC_CSR19_BIT3 FIELD32(0x0008)
4048 -#define MAC_CSR19_BIT4 FIELD32(0x0010)
4049 -#define MAC_CSR19_BIT5 FIELD32(0x0020)
4050 -#define MAC_CSR19_BIT6 FIELD32(0x0040)
4051 -#define MAC_CSR19_BIT7 FIELD32(0x0080)
4052 +#define MAC_CSR19_BIT0 FIELD16(0x0001)
4053 +#define MAC_CSR19_BIT1 FIELD16(0x0002)
4054 +#define MAC_CSR19_BIT2 FIELD16(0x0004)
4055 +#define MAC_CSR19_BIT3 FIELD16(0x0008)
4056 +#define MAC_CSR19_BIT4 FIELD16(0x0010)
4057 +#define MAC_CSR19_BIT5 FIELD16(0x0020)
4058 +#define MAC_CSR19_BIT6 FIELD16(0x0040)
4059 +#define MAC_CSR19_BIT7 FIELD16(0x0080)
4060 +#define MAC_CSR19_BIT8 FIELD16(0x0100)
4061
4062 /*
4063 * MAC_CSR20: LED control register.
4064 diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
4065 index 0397bbf..ff81e76 100644
4066 --- a/drivers/net/wireless/rt2x00/rt2800pci.c
4067 +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
4068 @@ -973,6 +973,7 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
4069 static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
4070 {
4071 int retval;
4072 + u32 reg;
4073
4074 /*
4075 * Allocate eeprom data.
4076 @@ -986,6 +987,14 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
4077 return retval;
4078
4079 /*
4080 + * Enable rfkill polling by setting GPIO direction of the
4081 + * rfkill switch GPIO pin correctly.
4082 + */
4083 + rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
4084 + rt2x00_set_field32(&reg, GPIO_CTRL_CFG_GPIOD_BIT2, 1);
4085 + rt2x00pci_register_write(rt2x00dev, GPIO_CTRL_CFG, reg);
4086 +
4087 + /*
4088 * Initialize hw specifications.
4089 */
4090 retval = rt2800_probe_hw_mode(rt2x00dev);
4091 diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
4092 index 7e1a492..65cb425 100644
4093 --- a/drivers/net/wireless/rt2x00/rt2800usb.c
4094 +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
4095 @@ -667,8 +667,16 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
4096 skb_pull(entry->skb, RXINFO_DESC_SIZE);
4097
4098 /*
4099 - * FIXME: we need to check for rx_pkt_len validity
4100 + * Check for rx_pkt_len validity. Return if invalid, leaving
4101 + * rxdesc->size zeroed out by the upper level.
4102 */
4103 + if (unlikely(rx_pkt_len == 0 ||
4104 + rx_pkt_len > entry->queue->data_size)) {
4105 + ERROR(entry->queue->rt2x00dev,
4106 + "Bad frame size %d, forcing to 0\n", rx_pkt_len);
4107 + return;
4108 + }
4109 +
4110 rxd = (__le32 *)(entry->skb->data + rx_pkt_len);
4111
4112 /*
4113 @@ -736,6 +744,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
4114 static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
4115 {
4116 int retval;
4117 + u32 reg;
4118
4119 /*
4120 * Allocate eeprom data.
4121 @@ -749,6 +758,14 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
4122 return retval;
4123
4124 /*
4125 + * Enable rfkill polling by setting GPIO direction of the
4126 + * rfkill switch GPIO pin correctly.
4127 + */
4128 + rt2x00usb_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
4129 + rt2x00_set_field32(&reg, GPIO_CTRL_CFG_GPIOD_BIT2, 1);
4130 + rt2x00usb_register_write(rt2x00dev, GPIO_CTRL_CFG, reg);
4131 +
4132 + /*
4133 * Initialize hw specifications.
4134 */
4135 retval = rt2800_probe_hw_mode(rt2x00dev);
4136 @@ -1157,6 +1174,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
4137 { USB_DEVICE(0x1690, 0x0744) },
4138 { USB_DEVICE(0x1690, 0x0761) },
4139 { USB_DEVICE(0x1690, 0x0764) },
4140 + /* ASUS */
4141 + { USB_DEVICE(0x0b05, 0x179d) },
4142 /* Cisco */
4143 { USB_DEVICE(0x167b, 0x4001) },
4144 /* EnGenius */
4145 @@ -1222,7 +1241,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
4146 { USB_DEVICE(0x0b05, 0x1760) },
4147 { USB_DEVICE(0x0b05, 0x1761) },
4148 { USB_DEVICE(0x0b05, 0x1790) },
4149 - { USB_DEVICE(0x0b05, 0x179d) },
4150 /* AzureWave */
4151 { USB_DEVICE(0x13d3, 0x3262) },
4152 { USB_DEVICE(0x13d3, 0x3284) },
4153 diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
4154 index 90cc5e7..12b1ff5 100644
4155 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
4156 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
4157 @@ -628,7 +628,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry)
4158 */
4159 if (unlikely(rxdesc.size == 0 ||
4160 rxdesc.size > entry->queue->data_size)) {
4161 - WARNING(rt2x00dev, "Wrong frame size %d max %d.\n",
4162 + ERROR(rt2x00dev, "Wrong frame size %d max %d.\n",
4163 rxdesc.size, entry->queue->data_size);
4164 dev_kfree_skb(entry->skb);
4165 goto renew_skb;
4166 diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
4167 index 0f4bf8c..bdaba3f 100644
4168 --- a/drivers/net/wireless/rt2x00/rt61pci.c
4169 +++ b/drivers/net/wireless/rt2x00/rt61pci.c
4170 @@ -2832,6 +2832,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
4171 static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
4172 {
4173 int retval;
4174 + u32 reg;
4175
4176 /*
4177 * Disable power saving.
4178 @@ -2850,6 +2851,14 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
4179 return retval;
4180
4181 /*
4182 + * Enable rfkill polling by setting GPIO direction of the
4183 + * rfkill switch GPIO pin correctly.
4184 + */
4185 + rt2x00pci_register_read(rt2x00dev, MAC_CSR13, &reg);
4186 + rt2x00_set_field32(&reg, MAC_CSR13_BIT13, 1);
4187 + rt2x00pci_register_write(rt2x00dev, MAC_CSR13, reg);
4188 +
4189 + /*
4190 * Initialize hw specifications.
4191 */
4192 retval = rt61pci_probe_hw_mode(rt2x00dev);
4193 diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h
4194 index e3cd6db..8f3da5a 100644
4195 --- a/drivers/net/wireless/rt2x00/rt61pci.h
4196 +++ b/drivers/net/wireless/rt2x00/rt61pci.h
4197 @@ -372,6 +372,7 @@ struct hw_pairwise_ta_entry {
4198 #define MAC_CSR13_BIT10 FIELD32(0x00000400)
4199 #define MAC_CSR13_BIT11 FIELD32(0x00000800)
4200 #define MAC_CSR13_BIT12 FIELD32(0x00001000)
4201 +#define MAC_CSR13_BIT13 FIELD32(0x00002000)
4202
4203 /*
4204 * MAC_CSR14: LED control register.
4205 diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
4206 index e477a96..fda8671 100644
4207 --- a/drivers/net/wireless/rt2x00/rt73usb.c
4208 +++ b/drivers/net/wireless/rt2x00/rt73usb.c
4209 @@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
4210 static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
4211 {
4212 int retval;
4213 + u32 reg;
4214
4215 /*
4216 * Allocate eeprom data.
4217 @@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
4218 return retval;
4219
4220 /*
4221 + * Enable rfkill polling by setting GPIO direction of the
4222 + * rfkill switch GPIO pin correctly.
4223 + */
4224 + rt2x00usb_register_read(rt2x00dev, MAC_CSR13, &reg);
4225 + rt2x00_set_field32(&reg, MAC_CSR13_BIT15, 0);
4226 + rt2x00usb_register_write(rt2x00dev, MAC_CSR13, reg);
4227 +
4228 + /*
4229 * Initialize hw specifications.
4230 */
4231 retval = rt73usb_probe_hw_mode(rt2x00dev);
4232 diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h
4233 index 9f6b470..df1cc11 100644
4234 --- a/drivers/net/wireless/rt2x00/rt73usb.h
4235 +++ b/drivers/net/wireless/rt2x00/rt73usb.h
4236 @@ -282,6 +282,9 @@ struct hw_pairwise_ta_entry {
4237 #define MAC_CSR13_BIT10 FIELD32(0x00000400)
4238 #define MAC_CSR13_BIT11 FIELD32(0x00000800)
4239 #define MAC_CSR13_BIT12 FIELD32(0x00001000)
4240 +#define MAC_CSR13_BIT13 FIELD32(0x00002000)
4241 +#define MAC_CSR13_BIT14 FIELD32(0x00004000)
4242 +#define MAC_CSR13_BIT15 FIELD32(0x00008000)
4243
4244 /*
4245 * MAC_CSR14: LED control register.
4246 diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
4247 index 04c3aef..2925094 100644
4248 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
4249 +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
4250 @@ -117,6 +117,7 @@
4251
4252 #define CHIP_VER_B BIT(4)
4253 #define CHIP_92C_BITMASK BIT(0)
4254 +#define CHIP_UNKNOWN BIT(7)
4255 #define CHIP_92C_1T2R 0x03
4256 #define CHIP_92C 0x01
4257 #define CHIP_88C 0x00
4258 diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
4259 index 5c4d9bc..509f661 100644
4260 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
4261 +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
4262 @@ -995,8 +995,16 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw)
4263 version = (value32 & TYPE_ID) ? VERSION_A_CHIP_92C :
4264 VERSION_A_CHIP_88C;
4265 } else {
4266 - version = (value32 & TYPE_ID) ? VERSION_B_CHIP_92C :
4267 - VERSION_B_CHIP_88C;
4268 + version = (enum version_8192c) (CHIP_VER_B |
4269 + ((value32 & TYPE_ID) ? CHIP_92C_BITMASK : 0) |
4270 + ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : 0));
4271 + if ((!IS_CHIP_VENDOR_UMC(version)) && (value32 &
4272 + CHIP_VER_RTL_MASK)) {
4273 + version = (enum version_8192c)(version |
4274 + ((((value32 & CHIP_VER_RTL_MASK) == BIT(12))
4275 + ? CHIP_VENDOR_UMC_B_CUT : CHIP_UNKNOWN) |
4276 + CHIP_VENDOR_UMC));
4277 + }
4278 }
4279
4280 switch (version) {
4281 diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
4282 index 2c3b733..4e2a458 100644
4283 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
4284 +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
4285 @@ -162,10 +162,12 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
4286
4287 /* request fw */
4288 if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
4289 - !IS_92C_SERIAL(rtlhal->version))
4290 + !IS_92C_SERIAL(rtlhal->version)) {
4291 rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin";
4292 - else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version))
4293 + } else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) {
4294 rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin";
4295 + pr_info("****** This B_CUT device may not work with kernels 3.6 and earlier\n");
4296 + }
4297
4298 rtlpriv->max_fw_size = 0x4000;
4299 pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
4300 diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
4301 index e38f91b..110c777 100644
4302 --- a/drivers/platform/x86/asus-laptop.c
4303 +++ b/drivers/platform/x86/asus-laptop.c
4304 @@ -863,9 +863,9 @@ static ssize_t show_infos(struct device *dev,
4305 * The significance of others is yet to be found.
4306 * If we don't find the method, we assume the device are present.
4307 */
4308 - rv = acpi_evaluate_integer(asus->handle, "HRWS", NULL, &temp);
4309 + rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp);
4310 if (!ACPI_FAILURE(rv))
4311 - len += sprintf(page + len, "HRWS value : %#x\n",
4312 + len += sprintf(page + len, "HWRS value : %#x\n",
4313 (uint) temp);
4314 /*
4315 * Another value for userspace: the ASYM method returns 0x02 for
4316 @@ -1751,9 +1751,9 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
4317 * The significance of others is yet to be found.
4318 */
4319 status =
4320 - acpi_evaluate_integer(asus->handle, "HRWS", NULL, &hwrs_result);
4321 + acpi_evaluate_integer(asus->handle, "HWRS", NULL, &hwrs_result);
4322 if (!ACPI_FAILURE(status))
4323 - pr_notice(" HRWS returned %x", (int)hwrs_result);
4324 + pr_notice(" HWRS returned %x", (int)hwrs_result);
4325
4326 if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL))
4327 asus->have_rsts = true;
4328 diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
4329 index 99a30b5..6de14fd 100644
4330 --- a/drivers/platform/x86/asus-nb-wmi.c
4331 +++ b/drivers/platform/x86/asus-nb-wmi.c
4332 @@ -94,6 +94,10 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
4333 { KE_KEY, 0x8A, { KEY_PROG1 } },
4334 { KE_KEY, 0x95, { KEY_MEDIA } },
4335 { KE_KEY, 0x99, { KEY_PHONE } },
4336 + { KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
4337 + { KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
4338 + { KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
4339 + { KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */
4340 { KE_KEY, 0xb5, { KEY_CALC } },
4341 { KE_KEY, 0xc4, { KEY_KBDILLUMUP } },
4342 { KE_KEY, 0xc5, { KEY_KBDILLUMDOWN } },
4343 diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
4344 index 77074cc..fd5c7af 100644
4345 --- a/drivers/rtc/rtc-rs5c348.c
4346 +++ b/drivers/rtc/rtc-rs5c348.c
4347 @@ -122,9 +122,12 @@ rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm)
4348 tm->tm_min = bcd2bin(rxbuf[RS5C348_REG_MINS] & RS5C348_MINS_MASK);
4349 tm->tm_hour = bcd2bin(rxbuf[RS5C348_REG_HOURS] & RS5C348_HOURS_MASK);
4350 if (!pdata->rtc_24h) {
4351 - tm->tm_hour %= 12;
4352 - if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM)
4353 + if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM) {
4354 + tm->tm_hour -= 20;
4355 + tm->tm_hour %= 12;
4356 tm->tm_hour += 12;
4357 + } else
4358 + tm->tm_hour %= 12;
4359 }
4360 tm->tm_wday = bcd2bin(rxbuf[RS5C348_REG_WDAY] & RS5C348_WDAY_MASK);
4361 tm->tm_mday = bcd2bin(rxbuf[RS5C348_REG_DAY] & RS5C348_DAY_MASK);
4362 diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
4363 index 258abea..63ccc0f 100644
4364 --- a/drivers/rtc/rtc-twl.c
4365 +++ b/drivers/rtc/rtc-twl.c
4366 @@ -495,6 +495,11 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
4367 if (ret < 0)
4368 goto out1;
4369
4370 + /* ensure interrupts are disabled, bootloaders can be strange */
4371 + ret = twl_rtc_write_u8(0, REG_RTC_INTERRUPTS_REG);
4372 + if (ret < 0)
4373 + dev_warn(&pdev->dev, "unable to disable interrupt\n");
4374 +
4375 /* init cached IRQ enable bits */
4376 ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
4377 if (ret < 0)
4378 diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
4379 index f9d6f41..72de3ba 100644
4380 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c
4381 +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
4382 @@ -1264,6 +1264,9 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba)
4383 int rc = 0;
4384 u64 mask64;
4385
4386 + memset(&iscsi_init, 0x00, sizeof(struct iscsi_kwqe_init1));
4387 + memset(&iscsi_init2, 0x00, sizeof(struct iscsi_kwqe_init2));
4388 +
4389 bnx2i_adjust_qp_size(hba);
4390
4391 iscsi_init.flags =
4392 diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
4393 index 500e20d..7c49e0a 100644
4394 --- a/drivers/scsi/hpsa.c
4395 +++ b/drivers/scsi/hpsa.c
4396 @@ -1264,8 +1264,9 @@ static void complete_scsi_command(struct CommandList *cp)
4397 }
4398 break;
4399 case CMD_PROTOCOL_ERR:
4400 + cmd->result = DID_ERROR << 16;
4401 dev_warn(&h->pdev->dev, "cp %p has "
4402 - "protocol error \n", cp);
4403 + "protocol error\n", cp);
4404 break;
4405 case CMD_HARDWARE_ERR:
4406 cmd->result = DID_ERROR << 16;
4407 diff --git a/drivers/scsi/lpfc/Makefile b/drivers/scsi/lpfc/Makefile
4408 index fe5d396..e2516ba 100644
4409 --- a/drivers/scsi/lpfc/Makefile
4410 +++ b/drivers/scsi/lpfc/Makefile
4411 @@ -22,7 +22,9 @@
4412 ccflags-$(GCOV) := -fprofile-arcs -ftest-coverage
4413 ccflags-$(GCOV) += -O0
4414
4415 +ifdef WARNINGS_BECOME_ERRORS
4416 ccflags-y += -Werror
4417 +endif
4418
4419 obj-$(CONFIG_SCSI_LPFC) := lpfc.o
4420
4421 diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
4422 index c4cef56..db79362 100644
4423 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
4424 +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
4425 @@ -1202,6 +1202,13 @@ _base_check_enable_msix(struct MPT2SAS_ADAPTER *ioc)
4426 u16 message_control;
4427
4428
4429 + /* Check whether controller SAS2008 B0 controller,
4430 + if it is SAS2008 B0 controller use IO-APIC instead of MSIX */
4431 + if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 &&
4432 + ioc->pdev->revision == 0x01) {
4433 + return -EINVAL;
4434 + }
4435 +
4436 base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
4437 if (!base) {
4438 dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "msix not "
4439 diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
4440 index 1b38431..6661610 100644
4441 --- a/drivers/scsi/virtio_scsi.c
4442 +++ b/drivers/scsi/virtio_scsi.c
4443 @@ -198,7 +198,7 @@ static void virtscsi_map_sgl(struct scatterlist *sg, unsigned int *p_idx,
4444 int i;
4445
4446 for_each_sg(table->sgl, sg_elem, table->nents, i)
4447 - sg_set_buf(&sg[idx++], sg_virt(sg_elem), sg_elem->length);
4448 + sg[idx++] = *sg_elem;
4449
4450 *p_idx = idx;
4451 }
4452 diff --git a/drivers/staging/android/android_alarm.h b/drivers/staging/android/android_alarm.h
4453 index 6eecbde..66b6e3d 100644
4454 --- a/drivers/staging/android/android_alarm.h
4455 +++ b/drivers/staging/android/android_alarm.h
4456 @@ -110,10 +110,12 @@ enum android_alarm_return_flags {
4457 #define ANDROID_ALARM_WAIT _IO('a', 1)
4458
4459 #define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
4460 +#define ALARM_IOR(c, type, size) _IOR('a', (c) | ((type) << 4), size)
4461 +
4462 /* Set alarm */
4463 #define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
4464 #define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
4465 -#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
4466 +#define ANDROID_ALARM_GET_TIME(type) ALARM_IOR(4, type, struct timespec)
4467 #define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
4468 #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
4469 #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
4470 diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c
4471 index c2dd0ed..d2dd75e 100644
4472 --- a/drivers/staging/comedi/drivers/das08.c
4473 +++ b/drivers/staging/comedi/drivers/das08.c
4474 @@ -653,7 +653,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev,
4475 int chan;
4476
4477 lsb = data[0] & 0xff;
4478 - msb = (data[0] >> 8) & 0xf;
4479 + msb = (data[0] >> 8) & 0xff;
4480
4481 chan = CR_CHAN(insn->chanspec);
4482
4483 diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c
4484 index 945d962..4afc3b4 100644
4485 --- a/drivers/staging/media/lirc/lirc_sir.c
4486 +++ b/drivers/staging/media/lirc/lirc_sir.c
4487 @@ -52,6 +52,7 @@
4488 #include <linux/io.h>
4489 #include <asm/irq.h>
4490 #include <linux/fcntl.h>
4491 +#include <linux/platform_device.h>
4492 #ifdef LIRC_ON_SA1100
4493 #include <asm/hardware.h>
4494 #ifdef CONFIG_SA1100_COLLIE
4495 @@ -487,9 +488,11 @@ static struct lirc_driver driver = {
4496 .owner = THIS_MODULE,
4497 };
4498
4499 +static struct platform_device *lirc_sir_dev;
4500
4501 static int init_chrdev(void)
4502 {
4503 + driver.dev = &lirc_sir_dev->dev;
4504 driver.minor = lirc_register_driver(&driver);
4505 if (driver.minor < 0) {
4506 printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n");
4507 @@ -1215,20 +1218,71 @@ static int init_lirc_sir(void)
4508 return 0;
4509 }
4510
4511 +static int __devinit lirc_sir_probe(struct platform_device *dev)
4512 +{
4513 + return 0;
4514 +}
4515 +
4516 +static int __devexit lirc_sir_remove(struct platform_device *dev)
4517 +{
4518 + return 0;
4519 +}
4520 +
4521 +static struct platform_driver lirc_sir_driver = {
4522 + .probe = lirc_sir_probe,
4523 + .remove = __devexit_p(lirc_sir_remove),
4524 + .driver = {
4525 + .name = "lirc_sir",
4526 + .owner = THIS_MODULE,
4527 + },
4528 +};
4529
4530 static int __init lirc_sir_init(void)
4531 {
4532 int retval;
4533
4534 + retval = platform_driver_register(&lirc_sir_driver);
4535 + if (retval) {
4536 + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform driver register "
4537 + "failed!\n");
4538 + return -ENODEV;
4539 + }
4540 +
4541 + lirc_sir_dev = platform_device_alloc("lirc_dev", 0);
4542 + if (!lirc_sir_dev) {
4543 + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device alloc "
4544 + "failed!\n");
4545 + retval = -ENOMEM;
4546 + goto pdev_alloc_fail;
4547 + }
4548 +
4549 + retval = platform_device_add(lirc_sir_dev);
4550 + if (retval) {
4551 + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device add "
4552 + "failed!\n");
4553 + retval = -ENODEV;
4554 + goto pdev_add_fail;
4555 + }
4556 +
4557 retval = init_chrdev();
4558 if (retval < 0)
4559 - return retval;
4560 + goto fail;
4561 +
4562 retval = init_lirc_sir();
4563 if (retval) {
4564 drop_chrdev();
4565 - return retval;
4566 + goto fail;
4567 }
4568 +
4569 return 0;
4570 +
4571 +fail:
4572 + platform_device_del(lirc_sir_dev);
4573 +pdev_add_fail:
4574 + platform_device_put(lirc_sir_dev);
4575 +pdev_alloc_fail:
4576 + platform_driver_unregister(&lirc_sir_driver);
4577 + return retval;
4578 }
4579
4580 static void __exit lirc_sir_exit(void)
4581 @@ -1236,6 +1290,8 @@ static void __exit lirc_sir_exit(void)
4582 drop_hardware();
4583 drop_chrdev();
4584 drop_port();
4585 + platform_device_unregister(lirc_sir_dev);
4586 + platform_driver_unregister(&lirc_sir_driver);
4587 printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n");
4588 }
4589
4590 diff --git a/drivers/staging/rtl8712/recv_linux.c b/drivers/staging/rtl8712/recv_linux.c
4591 index 0e26d5f..495ee12 100644
4592 --- a/drivers/staging/rtl8712/recv_linux.c
4593 +++ b/drivers/staging/rtl8712/recv_linux.c
4594 @@ -117,13 +117,8 @@ void r8712_recv_indicatepkt(struct _adapter *padapter,
4595 if (skb == NULL)
4596 goto _recv_indicatepkt_drop;
4597 skb->data = precv_frame->u.hdr.rx_data;
4598 -#ifdef NET_SKBUFF_DATA_USES_OFFSET
4599 - skb->tail = (sk_buff_data_t)(precv_frame->u.hdr.rx_tail -
4600 - precv_frame->u.hdr.rx_head);
4601 -#else
4602 - skb->tail = (sk_buff_data_t)precv_frame->u.hdr.rx_tail;
4603 -#endif
4604 skb->len = precv_frame->u.hdr.len;
4605 + skb_set_tail_pointer(skb, skb->len);
4606 if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1))
4607 skb->ip_summed = CHECKSUM_UNNECESSARY;
4608 else
4609 diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
4610 index 92b34e2..40e2488 100644
4611 --- a/drivers/staging/speakup/main.c
4612 +++ b/drivers/staging/speakup/main.c
4613 @@ -1854,7 +1854,7 @@ static void speakup_bits(struct vc_data *vc)
4614
4615 static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
4616 {
4617 - static u_char *goto_buf = "\0\0\0\0\0\0";
4618 + static u_char goto_buf[8];
4619 static int num;
4620 int maxlen, go_pos;
4621 char *cp;
4622 diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
4623 index c0edf97..08021f4 100644
4624 --- a/drivers/staging/vt6656/dpc.c
4625 +++ b/drivers/staging/vt6656/dpc.c
4626 @@ -200,7 +200,7 @@ s_vProcessRxMACHeader (
4627 } else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
4628 cbHeaderSize += 6;
4629 pwType = (PWORD) (pbyRxBufferAddr + cbHeaderSize);
4630 - if ((*pwType == cpu_to_le16(ETH_P_IPX)) ||
4631 + if ((*pwType == cpu_to_be16(ETH_P_IPX)) ||
4632 (*pwType == cpu_to_le16(0xF380))) {
4633 cbHeaderSize -= 8;
4634 pwType = (PWORD) (pbyRxBufferAddr + cbHeaderSize);
4635 diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
4636 index 9b64b10..fe21868 100644
4637 --- a/drivers/staging/vt6656/rxtx.c
4638 +++ b/drivers/staging/vt6656/rxtx.c
4639 @@ -1701,7 +1701,7 @@ s_bPacketToWirelessUsb(
4640 // 802.1H
4641 if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) {
4642 if (pDevice->dwDiagRefCount == 0) {
4643 - if ((psEthHeader->wType == cpu_to_le16(ETH_P_IPX)) ||
4644 + if ((psEthHeader->wType == cpu_to_be16(ETH_P_IPX)) ||
4645 (psEthHeader->wType == cpu_to_le16(0xF380))) {
4646 memcpy((PBYTE) (pbyPayloadHead),
4647 abySNAP_Bridgetunnel, 6);
4648 @@ -2840,10 +2840,10 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb)
4649 Packet_Type = skb->data[ETH_HLEN+1];
4650 Descriptor_type = skb->data[ETH_HLEN+1+1+2];
4651 Key_info = (skb->data[ETH_HLEN+1+1+2+1] << 8)|(skb->data[ETH_HLEN+1+1+2+2]);
4652 - if (pDevice->sTxEthHeader.wType == cpu_to_le16(ETH_P_PAE)) {
4653 - /* 802.1x OR eapol-key challenge frame transfer */
4654 - if (((Protocol_Version == 1) || (Protocol_Version == 2)) &&
4655 - (Packet_Type == 3)) {
4656 + if (pDevice->sTxEthHeader.wType == cpu_to_be16(ETH_P_PAE)) {
4657 + /* 802.1x OR eapol-key challenge frame transfer */
4658 + if (((Protocol_Version == 1) || (Protocol_Version == 2)) &&
4659 + (Packet_Type == 3)) {
4660 bTxeapol_key = TRUE;
4661 if(!(Key_info & BIT3) && //WPA or RSN group-key challenge
4662 (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key
4663 @@ -2989,19 +2989,19 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb)
4664 }
4665 }
4666
4667 - if (pDevice->sTxEthHeader.wType == cpu_to_le16(ETH_P_PAE)) {
4668 - if (pDevice->byBBType != BB_TYPE_11A) {
4669 - pDevice->wCurrentRate = RATE_1M;
4670 - pDevice->byACKRate = RATE_1M;
4671 - pDevice->byTopCCKBasicRate = RATE_1M;
4672 - pDevice->byTopOFDMBasicRate = RATE_6M;
4673 - } else {
4674 - pDevice->wCurrentRate = RATE_6M;
4675 - pDevice->byACKRate = RATE_6M;
4676 - pDevice->byTopCCKBasicRate = RATE_1M;
4677 - pDevice->byTopOFDMBasicRate = RATE_6M;
4678 - }
4679 - }
4680 + if (pDevice->sTxEthHeader.wType == cpu_to_be16(ETH_P_PAE)) {
4681 + if (pDevice->byBBType != BB_TYPE_11A) {
4682 + pDevice->wCurrentRate = RATE_1M;
4683 + pDevice->byACKRate = RATE_1M;
4684 + pDevice->byTopCCKBasicRate = RATE_1M;
4685 + pDevice->byTopOFDMBasicRate = RATE_6M;
4686 + } else {
4687 + pDevice->wCurrentRate = RATE_6M;
4688 + pDevice->byACKRate = RATE_6M;
4689 + pDevice->byTopCCKBasicRate = RATE_1M;
4690 + pDevice->byTopOFDMBasicRate = RATE_6M;
4691 + }
4692 + }
4693
4694 DBG_PRT(MSG_LEVEL_DEBUG,
4695 KERN_INFO "dma_tx: pDevice->wCurrentRate = %d\n",
4696 @@ -3017,7 +3017,7 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb)
4697
4698 if (bNeedEncryption == TRUE) {
4699 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType));
4700 - if ((pDevice->sTxEthHeader.wType) == cpu_to_le16(ETH_P_PAE)) {
4701 + if ((pDevice->sTxEthHeader.wType) == cpu_to_be16(ETH_P_PAE)) {
4702 bNeedEncryption = FALSE;
4703 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType));
4704 if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
4705 diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
4706 index 2734dac..1812bed 100644
4707 --- a/drivers/staging/zcache/zcache-main.c
4708 +++ b/drivers/staging/zcache/zcache-main.c
4709 @@ -1259,13 +1259,12 @@ static int zcache_pampd_get_data_and_free(char *data, size_t *bufsize, bool raw,
4710 void *pampd, struct tmem_pool *pool,
4711 struct tmem_oid *oid, uint32_t index)
4712 {
4713 - int ret = 0;
4714 -
4715 BUG_ON(!is_ephemeral(pool));
4716 - zbud_decompress((struct page *)(data), pampd);
4717 + if (zbud_decompress((struct page *)(data), pampd) < 0)
4718 + return -EINVAL;
4719 zbud_free_and_delist((struct zbud_hdr *)pampd);
4720 atomic_dec(&zcache_curr_eph_pampd_count);
4721 - return ret;
4722 + return 0;
4723 }
4724
4725 /*
4726 diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
4727 index 222f1c5..d594460 100644
4728 --- a/drivers/target/target_core_transport.c
4729 +++ b/drivers/target/target_core_transport.c
4730 @@ -3167,15 +3167,20 @@ static int transport_generic_cmd_sequencer(
4731 /* Returns CHECK_CONDITION + INVALID_CDB_FIELD */
4732 goto out_invalid_cdb_field;
4733 }
4734 -
4735 + /*
4736 + * For the overflow case keep the existing fabric provided
4737 + * ->data_length. Otherwise for the underflow case, reset
4738 + * ->data_length to the smaller SCSI expected data transfer
4739 + * length.
4740 + */
4741 if (size > cmd->data_length) {
4742 cmd->se_cmd_flags |= SCF_OVERFLOW_BIT;
4743 cmd->residual_count = (size - cmd->data_length);
4744 } else {
4745 cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT;
4746 cmd->residual_count = (cmd->data_length - size);
4747 + cmd->data_length = size;
4748 }
4749 - cmd->data_length = size;
4750 }
4751
4752 if (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB &&
4753 diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
4754 index e7fecee..0de7ed7 100644
4755 --- a/drivers/tty/serial/imx.c
4756 +++ b/drivers/tty/serial/imx.c
4757 @@ -756,6 +756,7 @@ static int imx_startup(struct uart_port *port)
4758 }
4759 }
4760
4761 + spin_lock_irqsave(&sport->port.lock, flags);
4762 /*
4763 * Finally, clear and enable interrupts
4764 */
4765 @@ -809,7 +810,6 @@ static int imx_startup(struct uart_port *port)
4766 /*
4767 * Enable modem status interrupts
4768 */
4769 - spin_lock_irqsave(&sport->port.lock,flags);
4770 imx_enable_ms(&sport->port);
4771 spin_unlock_irqrestore(&sport->port.lock,flags);
4772
4773 @@ -839,10 +839,13 @@ static void imx_shutdown(struct uart_port *port)
4774 {
4775 struct imx_port *sport = (struct imx_port *)port;
4776 unsigned long temp;
4777 + unsigned long flags;
4778
4779 + spin_lock_irqsave(&sport->port.lock, flags);
4780 temp = readl(sport->port.membase + UCR2);
4781 temp &= ~(UCR2_TXEN);
4782 writel(temp, sport->port.membase + UCR2);
4783 + spin_unlock_irqrestore(&sport->port.lock, flags);
4784
4785 if (USE_IRDA(sport)) {
4786 struct imxuart_platform_data *pdata;
4787 @@ -871,12 +874,14 @@ static void imx_shutdown(struct uart_port *port)
4788 * Disable all interrupts, port and break condition.
4789 */
4790
4791 + spin_lock_irqsave(&sport->port.lock, flags);
4792 temp = readl(sport->port.membase + UCR1);
4793 temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN);
4794 if (USE_IRDA(sport))
4795 temp &= ~(UCR1_IREN);
4796
4797 writel(temp, sport->port.membase + UCR1);
4798 + spin_unlock_irqrestore(&sport->port.lock, flags);
4799 }
4800
4801 static void
4802 @@ -1219,6 +1224,9 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
4803 struct imx_port *sport = imx_ports[co->index];
4804 struct imx_port_ucrs old_ucr;
4805 unsigned int ucr1;
4806 + unsigned long flags;
4807 +
4808 + spin_lock_irqsave(&sport->port.lock, flags);
4809
4810 /*
4811 * First, save UCR1/2/3 and then disable interrupts
4812 @@ -1244,6 +1252,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
4813 while (!(readl(sport->port.membase + USR2) & USR2_TXDC));
4814
4815 imx_port_ucrs_restore(&sport->port, &old_ucr);
4816 +
4817 + spin_unlock_irqrestore(&sport->port.lock, flags);
4818 }
4819
4820 /*
4821 diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
4822 index c2816f4..7d47514 100644
4823 --- a/drivers/tty/serial/pch_uart.c
4824 +++ b/drivers/tty/serial/pch_uart.c
4825 @@ -252,6 +252,9 @@ struct eg20t_port {
4826 dma_addr_t rx_buf_dma;
4827
4828 struct dentry *debugfs;
4829 +
4830 + /* protect the eg20t_port private structure and io access to membase */
4831 + spinlock_t lock;
4832 };
4833
4834 /**
4835 @@ -754,7 +757,8 @@ static void pch_dma_rx_complete(void *arg)
4836 tty_flip_buffer_push(tty);
4837 tty_kref_put(tty);
4838 async_tx_ack(priv->desc_rx);
4839 - pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT);
4840 + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT |
4841 + PCH_UART_HAL_RX_ERR_INT);
4842 }
4843
4844 static void pch_dma_tx_complete(void *arg)
4845 @@ -809,7 +813,8 @@ static int handle_rx_to(struct eg20t_port *priv)
4846 int rx_size;
4847 int ret;
4848 if (!priv->start_rx) {
4849 - pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT);
4850 + pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT |
4851 + PCH_UART_HAL_RX_ERR_INT);
4852 return 0;
4853 }
4854 buf = &priv->rxbuf;
4855 @@ -1056,7 +1061,7 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
4856 unsigned int iid;
4857 unsigned long flags;
4858
4859 - spin_lock_irqsave(&priv->port.lock, flags);
4860 + spin_lock_irqsave(&priv->lock, flags);
4861 handled = 0;
4862 while ((iid = pch_uart_hal_get_iid(priv)) > 1) {
4863 switch (iid) {
4864 @@ -1071,11 +1076,13 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
4865 case PCH_UART_IID_RDR: /* Received Data Ready */
4866 if (priv->use_dma) {
4867 pch_uart_hal_disable_interrupt(priv,
4868 - PCH_UART_HAL_RX_INT);
4869 + PCH_UART_HAL_RX_INT |
4870 + PCH_UART_HAL_RX_ERR_INT);
4871 ret = dma_handle_rx(priv);
4872 if (!ret)
4873 pch_uart_hal_enable_interrupt(priv,
4874 - PCH_UART_HAL_RX_INT);
4875 + PCH_UART_HAL_RX_INT |
4876 + PCH_UART_HAL_RX_ERR_INT);
4877 } else {
4878 ret = handle_rx(priv);
4879 }
4880 @@ -1107,7 +1114,7 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id)
4881 priv->int_dis_flag = 0;
4882 }
4883
4884 - spin_unlock_irqrestore(&priv->port.lock, flags);
4885 + spin_unlock_irqrestore(&priv->lock, flags);
4886 return IRQ_RETVAL(handled);
4887 }
4888
4889 @@ -1199,7 +1206,8 @@ static void pch_uart_stop_rx(struct uart_port *port)
4890 struct eg20t_port *priv;
4891 priv = container_of(port, struct eg20t_port, port);
4892 priv->start_rx = 0;
4893 - pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT);
4894 + pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_RX_INT |
4895 + PCH_UART_HAL_RX_ERR_INT);
4896 priv->int_dis_flag = 1;
4897 }
4898
4899 @@ -1218,9 +1226,9 @@ static void pch_uart_break_ctl(struct uart_port *port, int ctl)
4900 unsigned long flags;
4901
4902 priv = container_of(port, struct eg20t_port, port);
4903 - spin_lock_irqsave(&port->lock, flags);
4904 + spin_lock_irqsave(&priv->lock, flags);
4905 pch_uart_hal_set_break(priv, ctl);
4906 - spin_unlock_irqrestore(&port->lock, flags);
4907 + spin_unlock_irqrestore(&priv->lock, flags);
4908 }
4909
4910 /* Grab any interrupt resources and initialise any low level driver state. */
4911 @@ -1255,6 +1263,7 @@ static int pch_uart_startup(struct uart_port *port)
4912 break;
4913 case 16:
4914 fifo_size = PCH_UART_HAL_FIFO16;
4915 + break;
4916 case 1:
4917 default:
4918 fifo_size = PCH_UART_HAL_FIFO_DIS;
4919 @@ -1292,7 +1301,8 @@ static int pch_uart_startup(struct uart_port *port)
4920 pch_request_dma(port);
4921
4922 priv->start_rx = 1;
4923 - pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT);
4924 + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT |
4925 + PCH_UART_HAL_RX_ERR_INT);
4926 uart_update_timeout(port, CS8, default_baud);
4927
4928 return 0;
4929 @@ -1350,7 +1360,7 @@ static void pch_uart_set_termios(struct uart_port *port,
4930 stb = PCH_UART_HAL_STB1;
4931
4932 if (termios->c_cflag & PARENB) {
4933 - if (!(termios->c_cflag & PARODD))
4934 + if (termios->c_cflag & PARODD)
4935 parity = PCH_UART_HAL_PARITY_ODD;
4936 else
4937 parity = PCH_UART_HAL_PARITY_EVEN;
4938 @@ -1368,7 +1378,8 @@ static void pch_uart_set_termios(struct uart_port *port,
4939
4940 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
4941
4942 - spin_lock_irqsave(&port->lock, flags);
4943 + spin_lock_irqsave(&priv->lock, flags);
4944 + spin_lock(&port->lock);
4945
4946 uart_update_timeout(port, termios->c_cflag, baud);
4947 rtn = pch_uart_hal_set_line(priv, baud, parity, bits, stb);
4948 @@ -1381,7 +1392,8 @@ static void pch_uart_set_termios(struct uart_port *port,
4949 tty_termios_encode_baud_rate(termios, baud, baud);
4950
4951 out:
4952 - spin_unlock_irqrestore(&port->lock, flags);
4953 + spin_unlock(&port->lock);
4954 + spin_unlock_irqrestore(&priv->lock, flags);
4955 }
4956
4957 static const char *pch_uart_type(struct uart_port *port)
4958 @@ -1531,8 +1543,9 @@ pch_console_write(struct console *co, const char *s, unsigned int count)
4959 {
4960 struct eg20t_port *priv;
4961 unsigned long flags;
4962 + int priv_locked = 1;
4963 + int port_locked = 1;
4964 u8 ier;
4965 - int locked = 1;
4966
4967 priv = pch_uart_ports[co->index];
4968
4969 @@ -1540,12 +1553,16 @@ pch_console_write(struct console *co, const char *s, unsigned int count)
4970
4971 local_irq_save(flags);
4972 if (priv->port.sysrq) {
4973 - /* serial8250_handle_port() already took the lock */
4974 - locked = 0;
4975 + spin_lock(&priv->lock);
4976 + /* serial8250_handle_port() already took the port lock */
4977 + port_locked = 0;
4978 } else if (oops_in_progress) {
4979 - locked = spin_trylock(&priv->port.lock);
4980 - } else
4981 + priv_locked = spin_trylock(&priv->lock);
4982 + port_locked = spin_trylock(&priv->port.lock);
4983 + } else {
4984 + spin_lock(&priv->lock);
4985 spin_lock(&priv->port.lock);
4986 + }
4987
4988 /*
4989 * First save the IER then disable the interrupts
4990 @@ -1563,8 +1580,10 @@ pch_console_write(struct console *co, const char *s, unsigned int count)
4991 wait_for_xmitr(priv, BOTH_EMPTY);
4992 iowrite8(ier, priv->membase + UART_IER);
4993
4994 - if (locked)
4995 + if (port_locked)
4996 spin_unlock(&priv->port.lock);
4997 + if (priv_locked)
4998 + spin_unlock(&priv->lock);
4999 local_irq_restore(flags);
5000 }
5001
5002 @@ -1662,6 +1681,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
5003 pci_enable_msi(pdev);
5004 pci_set_master(pdev);
5005
5006 + spin_lock_init(&priv->lock);
5007 +
5008 iobase = pci_resource_start(pdev, 0);
5009 mapbase = pci_resource_start(pdev, 1);
5010 priv->mapbase = mapbase;
5011 diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
5012 index 01d247e..524fe24 100644
5013 --- a/drivers/usb/class/cdc-wdm.c
5014 +++ b/drivers/usb/class/cdc-wdm.c
5015 @@ -134,12 +134,14 @@ static struct usb_driver wdm_driver;
5016 /* return intfdata if we own the interface, else look up intf in the list */
5017 static struct wdm_device *wdm_find_device(struct usb_interface *intf)
5018 {
5019 - struct wdm_device *desc = NULL;
5020 + struct wdm_device *desc;
5021
5022 spin_lock(&wdm_device_list_lock);
5023 list_for_each_entry(desc, &wdm_device_list, device_list)
5024 if (desc->intf == intf)
5025 - break;
5026 + goto found;
5027 + desc = NULL;
5028 +found:
5029 spin_unlock(&wdm_device_list_lock);
5030
5031 return desc;
5032 @@ -147,12 +149,14 @@ static struct wdm_device *wdm_find_device(struct usb_interface *intf)
5033
5034 static struct wdm_device *wdm_find_device_by_minor(int minor)
5035 {
5036 - struct wdm_device *desc = NULL;
5037 + struct wdm_device *desc;
5038
5039 spin_lock(&wdm_device_list_lock);
5040 list_for_each_entry(desc, &wdm_device_list, device_list)
5041 if (desc->intf->minor == minor)
5042 - break;
5043 + goto found;
5044 + desc = NULL;
5045 +found:
5046 spin_unlock(&wdm_device_list_lock);
5047
5048 return desc;
5049 diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
5050 index d956965..3440812 100644
5051 --- a/drivers/usb/core/devices.c
5052 +++ b/drivers/usb/core/devices.c
5053 @@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf,
5054 /* print devices for all busses */
5055 list_for_each_entry(bus, &usb_bus_list, bus_list) {
5056 /* recurse through all children of the root hub */
5057 - if (!bus->root_hub)
5058 + if (!bus_to_hcd(bus)->rh_registered)
5059 continue;
5060 usb_lock_device(bus->root_hub);
5061 ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos,
5062 diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
5063 index 140d3e1..e2cc8df 100644
5064 --- a/drivers/usb/core/hcd.c
5065 +++ b/drivers/usb/core/hcd.c
5066 @@ -1002,10 +1002,7 @@ static int register_root_hub(struct usb_hcd *hcd)
5067 if (retval) {
5068 dev_err (parent_dev, "can't register root hub for %s, %d\n",
5069 dev_name(&usb_dev->dev), retval);
5070 - }
5071 - mutex_unlock(&usb_bus_list_lock);
5072 -
5073 - if (retval == 0) {
5074 + } else {
5075 spin_lock_irq (&hcd_root_hub_lock);
5076 hcd->rh_registered = 1;
5077 spin_unlock_irq (&hcd_root_hub_lock);
5078 @@ -1014,6 +1011,7 @@ static int register_root_hub(struct usb_hcd *hcd)
5079 if (HCD_DEAD(hcd))
5080 usb_hc_died (hcd); /* This time clean up */
5081 }
5082 + mutex_unlock(&usb_bus_list_lock);
5083
5084 return retval;
5085 }
5086 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
5087 index 32d3adc..8b2a9d8 100644
5088 --- a/drivers/usb/core/quirks.c
5089 +++ b/drivers/usb/core/quirks.c
5090 @@ -96,6 +96,10 @@ static const struct usb_device_id usb_quirk_list[] = {
5091 { USB_DEVICE(0x04b4, 0x0526), .driver_info =
5092 USB_QUIRK_CONFIG_INTF_STRINGS },
5093
5094 + /* Microchip Joss Optical infrared touchboard device */
5095 + { USB_DEVICE(0x04d8, 0x000c), .driver_info =
5096 + USB_QUIRK_CONFIG_INTF_STRINGS },
5097 +
5098 /* Samsung Android phone modem - ID conflict with SPH-I500 */
5099 { USB_DEVICE(0x04e8, 0x6601), .driver_info =
5100 USB_QUIRK_CONFIG_INTF_STRINGS },
5101 diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
5102 index 3584a16..e4d87d7 100644
5103 --- a/drivers/usb/dwc3/ep0.c
5104 +++ b/drivers/usb/dwc3/ep0.c
5105 @@ -569,7 +569,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
5106 transferred = min_t(u32, ur->length,
5107 transfer_size - length);
5108 memcpy(ur->buf, dwc->ep0_bounce, transferred);
5109 - dwc->ep0_bounced = false;
5110 } else {
5111 transferred = ur->length - length;
5112 }
5113 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
5114 index 5255fe9..b8d4697 100644
5115 --- a/drivers/usb/dwc3/gadget.c
5116 +++ b/drivers/usb/dwc3/gadget.c
5117 @@ -238,8 +238,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
5118 if (req->request.status == -EINPROGRESS)
5119 req->request.status = status;
5120
5121 - usb_gadget_unmap_request(&dwc->gadget, &req->request,
5122 - req->direction);
5123 + if (dwc->ep0_bounced && dep->number == 0)
5124 + dwc->ep0_bounced = false;
5125 + else
5126 + usb_gadget_unmap_request(&dwc->gadget, &req->request,
5127 + req->direction);
5128
5129 dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n",
5130 req, dep->name, req->request.actual,
5131 diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
5132 index 36ca507..7261e8f 100644
5133 --- a/drivers/usb/host/ehci-q.c
5134 +++ b/drivers/usb/host/ehci-q.c
5135 @@ -128,9 +128,17 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh)
5136 else {
5137 qtd = list_entry (qh->qtd_list.next,
5138 struct ehci_qtd, qtd_list);
5139 - /* first qtd may already be partially processed */
5140 - if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current)
5141 + /*
5142 + * first qtd may already be partially processed.
5143 + * If we come here during unlink, the QH overlay region
5144 + * might have reference to the just unlinked qtd. The
5145 + * qtd is updated in qh_completions(). Update the QH
5146 + * overlay here.
5147 + */
5148 + if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) {
5149 + qh->hw->hw_qtd_next = qtd->hw_next;
5150 qtd = NULL;
5151 + }
5152 }
5153
5154 if (qtd)
5155 diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
5156 index 55d3d64..7841b0a 100644
5157 --- a/drivers/usb/host/ohci-at91.c
5158 +++ b/drivers/usb/host/ohci-at91.c
5159 @@ -466,7 +466,8 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
5160 /* From the GPIO notifying the over-current situation, find
5161 * out the corresponding port */
5162 at91_for_each_port(port) {
5163 - if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
5164 + if (gpio_is_valid(pdata->overcurrent_pin[port]) &&
5165 + gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
5166 gpio = pdata->overcurrent_pin[port];
5167 break;
5168 }
5169 @@ -569,6 +570,16 @@ static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
5170
5171 if (pdata) {
5172 at91_for_each_port(i) {
5173 + /*
5174 + * do not configure PIO if not in relation with
5175 + * real USB port on board
5176 + */
5177 + if (i >= pdata->ports) {
5178 + pdata->vbus_pin[i] = -EINVAL;
5179 + pdata->overcurrent_pin[i] = -EINVAL;
5180 + break;
5181 + }
5182 +
5183 if (!gpio_is_valid(pdata->vbus_pin[i]))
5184 continue;
5185 gpio = pdata->vbus_pin[i];
5186 diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
5187 index c5e9e4a..966d148 100644
5188 --- a/drivers/usb/host/pci-quirks.c
5189 +++ b/drivers/usb/host/pci-quirks.c
5190 @@ -75,7 +75,9 @@
5191 #define NB_PIF0_PWRDOWN_1 0x01100013
5192
5193 #define USB_INTEL_XUSB2PR 0xD0
5194 +#define USB_INTEL_USB2PRM 0xD4
5195 #define USB_INTEL_USB3_PSSEN 0xD8
5196 +#define USB_INTEL_USB3PRM 0xDC
5197
5198 static struct amd_chipset_info {
5199 struct pci_dev *nb_dev;
5200 @@ -772,10 +774,18 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
5201 return;
5202 }
5203
5204 - ports_available = 0xffffffff;
5205 + /* Read USB3PRM, the USB 3.0 Port Routing Mask Register
5206 + * Indicate the ports that can be changed from OS.
5207 + */
5208 + pci_read_config_dword(xhci_pdev, USB_INTEL_USB3PRM,
5209 + &ports_available);
5210 +
5211 + dev_dbg(&xhci_pdev->dev, "Configurable ports to enable SuperSpeed: 0x%x\n",
5212 + ports_available);
5213 +
5214 /* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable
5215 - * Register, to turn on SuperSpeed terminations for all
5216 - * available ports.
5217 + * Register, to turn on SuperSpeed terminations for the
5218 + * switchable ports.
5219 */
5220 pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN,
5221 cpu_to_le32(ports_available));
5222 @@ -785,7 +795,16 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
5223 dev_dbg(&xhci_pdev->dev, "USB 3.0 ports that are now enabled "
5224 "under xHCI: 0x%x\n", ports_available);
5225
5226 - ports_available = 0xffffffff;
5227 + /* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register
5228 + * Indicate the USB 2.0 ports to be controlled by the xHCI host.
5229 + */
5230 +
5231 + pci_read_config_dword(xhci_pdev, USB_INTEL_USB2PRM,
5232 + &ports_available);
5233 +
5234 + dev_dbg(&xhci_pdev->dev, "Configurable USB 2.0 ports to hand over to xCHI: 0x%x\n",
5235 + ports_available);
5236 +
5237 /* Write XUSB2PR, the xHC USB 2.0 Port Routing Register, to
5238 * switch the USB 2.0 power and data lines over to the xHCI
5239 * host.
5240 @@ -822,12 +841,12 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
5241 void __iomem *op_reg_base;
5242 u32 val;
5243 int timeout;
5244 + int len = pci_resource_len(pdev, 0);
5245
5246 if (!mmio_resource_enabled(pdev, 0))
5247 return;
5248
5249 - base = ioremap_nocache(pci_resource_start(pdev, 0),
5250 - pci_resource_len(pdev, 0));
5251 + base = ioremap_nocache(pci_resource_start(pdev, 0), len);
5252 if (base == NULL)
5253 return;
5254
5255 @@ -837,9 +856,17 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
5256 */
5257 ext_cap_offset = xhci_find_next_cap_offset(base, XHCI_HCC_PARAMS_OFFSET);
5258 do {
5259 + if ((ext_cap_offset + sizeof(val)) > len) {
5260 + /* We're reading garbage from the controller */
5261 + dev_warn(&pdev->dev,
5262 + "xHCI controller failing to respond");
5263 + return;
5264 + }
5265 +
5266 if (!ext_cap_offset)
5267 /* We've reached the end of the extended capabilities */
5268 goto hc_init;
5269 +
5270 val = readl(base + ext_cap_offset);
5271 if (XHCI_EXT_CAPS_ID(val) == XHCI_EXT_CAPS_LEGACY)
5272 break;
5273 @@ -870,9 +897,10 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
5274 /* Disable any BIOS SMIs and clear all SMI events*/
5275 writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
5276
5277 +hc_init:
5278 if (usb_is_intel_switchable_xhci(pdev))
5279 usb_enable_xhci_ports(pdev);
5280 -hc_init:
5281 +
5282 op_reg_base = base + XHCI_HC_LENGTH(readl(base));
5283
5284 /* Wait for the host controller to be ready before writing any
5285 diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
5286 index ef004a5..7f69a39 100644
5287 --- a/drivers/usb/host/pci-quirks.h
5288 +++ b/drivers/usb/host/pci-quirks.h
5289 @@ -15,6 +15,7 @@ void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
5290 static inline void usb_amd_quirk_pll_disable(void) {}
5291 static inline void usb_amd_quirk_pll_enable(void) {}
5292 static inline void usb_amd_dev_put(void) {}
5293 +static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
5294 #endif /* CONFIG_PCI */
5295
5296 #endif /* __LINUX_USB_PCI_QUIRKS_H */
5297 diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
5298 index bbf3c0c..de07b75 100644
5299 --- a/drivers/usb/host/xhci-hub.c
5300 +++ b/drivers/usb/host/xhci-hub.c
5301 @@ -493,11 +493,48 @@ static void xhci_hub_report_link_state(u32 *status, u32 status_reg)
5302 * when this bit is set.
5303 */
5304 pls |= USB_PORT_STAT_CONNECTION;
5305 + } else {
5306 + /*
5307 + * If CAS bit isn't set but the Port is already at
5308 + * Compliance Mode, fake a connection so the USB core
5309 + * notices the Compliance state and resets the port.
5310 + * This resolves an issue generated by the SN65LVPE502CP
5311 + * in which sometimes the port enters compliance mode
5312 + * caused by a delay on the host-device negotiation.
5313 + */
5314 + if (pls == USB_SS_PORT_LS_COMP_MOD)
5315 + pls |= USB_PORT_STAT_CONNECTION;
5316 }
5317 +
5318 /* update status field */
5319 *status |= pls;
5320 }
5321
5322 +/*
5323 + * Function for Compliance Mode Quirk.
5324 + *
5325 + * This Function verifies if all xhc USB3 ports have entered U0, if so,
5326 + * the compliance mode timer is deleted. A port won't enter
5327 + * compliance mode if it has previously entered U0.
5328 + */
5329 +void xhci_del_comp_mod_timer(struct xhci_hcd *xhci, u32 status, u16 wIndex)
5330 +{
5331 + u32 all_ports_seen_u0 = ((1 << xhci->num_usb3_ports)-1);
5332 + bool port_in_u0 = ((status & PORT_PLS_MASK) == XDEV_U0);
5333 +
5334 + if (!(xhci->quirks & XHCI_COMP_MODE_QUIRK))
5335 + return;
5336 +
5337 + if ((xhci->port_status_u0 != all_ports_seen_u0) && port_in_u0) {
5338 + xhci->port_status_u0 |= 1 << wIndex;
5339 + if (xhci->port_status_u0 == all_ports_seen_u0) {
5340 + del_timer_sync(&xhci->comp_mode_recovery_timer);
5341 + xhci_dbg(xhci, "All USB3 ports have entered U0 already!\n");
5342 + xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted.\n");
5343 + }
5344 + }
5345 +}
5346 +
5347 int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
5348 u16 wIndex, char *buf, u16 wLength)
5349 {
5350 @@ -644,6 +681,11 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
5351 /* Update Port Link State for super speed ports*/
5352 if (hcd->speed == HCD_USB3) {
5353 xhci_hub_report_link_state(&status, temp);
5354 + /*
5355 + * Verify if all USB3 Ports Have entered U0 already.
5356 + * Delete Compliance Mode Timer if so.
5357 + */
5358 + xhci_del_comp_mod_timer(xhci, temp, wIndex);
5359 }
5360 if (bus_state->port_c_suspend & (1 << wIndex))
5361 status |= 1 << USB_PORT_FEAT_C_SUSPEND;
5362 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
5363 index 689bc18..df90fe5 100644
5364 --- a/drivers/usb/host/xhci-plat.c
5365 +++ b/drivers/usb/host/xhci-plat.c
5366 @@ -118,7 +118,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
5367 goto put_hcd;
5368 }
5369
5370 - hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
5371 + hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
5372 if (!hcd->regs) {
5373 dev_dbg(&pdev->dev, "error mapping memory\n");
5374 ret = -EFAULT;
5375 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
5376 index 7beed53..6467d79 100644
5377 --- a/drivers/usb/host/xhci.c
5378 +++ b/drivers/usb/host/xhci.c
5379 @@ -26,6 +26,7 @@
5380 #include <linux/module.h>
5381 #include <linux/moduleparam.h>
5382 #include <linux/slab.h>
5383 +#include <linux/dmi.h>
5384
5385 #include "xhci.h"
5386
5387 @@ -398,6 +399,95 @@ static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
5388
5389 #endif
5390
5391 +static void compliance_mode_recovery(unsigned long arg)
5392 +{
5393 + struct xhci_hcd *xhci;
5394 + struct usb_hcd *hcd;
5395 + u32 temp;
5396 + int i;
5397 +
5398 + xhci = (struct xhci_hcd *)arg;
5399 +
5400 + for (i = 0; i < xhci->num_usb3_ports; i++) {
5401 + temp = xhci_readl(xhci, xhci->usb3_ports[i]);
5402 + if ((temp & PORT_PLS_MASK) == USB_SS_PORT_LS_COMP_MOD) {
5403 + /*
5404 + * Compliance Mode Detected. Letting USB Core
5405 + * handle the Warm Reset
5406 + */
5407 + xhci_dbg(xhci, "Compliance Mode Detected->Port %d!\n",
5408 + i + 1);
5409 + xhci_dbg(xhci, "Attempting Recovery routine!\n");
5410 + hcd = xhci->shared_hcd;
5411 +
5412 + if (hcd->state == HC_STATE_SUSPENDED)
5413 + usb_hcd_resume_root_hub(hcd);
5414 +
5415 + usb_hcd_poll_rh_status(hcd);
5416 + }
5417 + }
5418 +
5419 + if (xhci->port_status_u0 != ((1 << xhci->num_usb3_ports)-1))
5420 + mod_timer(&xhci->comp_mode_recovery_timer,
5421 + jiffies + msecs_to_jiffies(COMP_MODE_RCVRY_MSECS));
5422 +}
5423 +
5424 +/*
5425 + * Quirk to work around issue generated by the SN65LVPE502CP USB3.0 re-driver
5426 + * that causes ports behind that hardware to enter compliance mode sometimes.
5427 + * The quirk creates a timer that polls every 2 seconds the link state of
5428 + * each host controller's port and recovers it by issuing a Warm reset
5429 + * if Compliance mode is detected, otherwise the port will become "dead" (no
5430 + * device connections or disconnections will be detected anymore). Becasue no
5431 + * status event is generated when entering compliance mode (per xhci spec),
5432 + * this quirk is needed on systems that have the failing hardware installed.
5433 + */
5434 +static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci)
5435 +{
5436 + xhci->port_status_u0 = 0;
5437 + init_timer(&xhci->comp_mode_recovery_timer);
5438 +
5439 + xhci->comp_mode_recovery_timer.data = (unsigned long) xhci;
5440 + xhci->comp_mode_recovery_timer.function = compliance_mode_recovery;
5441 + xhci->comp_mode_recovery_timer.expires = jiffies +
5442 + msecs_to_jiffies(COMP_MODE_RCVRY_MSECS);
5443 +
5444 + set_timer_slack(&xhci->comp_mode_recovery_timer,
5445 + msecs_to_jiffies(COMP_MODE_RCVRY_MSECS));
5446 + add_timer(&xhci->comp_mode_recovery_timer);
5447 + xhci_dbg(xhci, "Compliance Mode Recovery Timer Initialized.\n");
5448 +}
5449 +
5450 +/*
5451 + * This function identifies the systems that have installed the SN65LVPE502CP
5452 + * USB3.0 re-driver and that need the Compliance Mode Quirk.
5453 + * Systems:
5454 + * Vendor: Hewlett-Packard -> System Models: Z420, Z620 and Z820
5455 + */
5456 +static bool compliance_mode_recovery_timer_quirk_check(void)
5457 +{
5458 + const char *dmi_product_name, *dmi_sys_vendor;
5459 +
5460 + dmi_product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
5461 + dmi_sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
5462 +
5463 + if (!(strstr(dmi_sys_vendor, "Hewlett-Packard")))
5464 + return false;
5465 +
5466 + if (strstr(dmi_product_name, "Z420") ||
5467 + strstr(dmi_product_name, "Z620") ||
5468 + strstr(dmi_product_name, "Z820"))
5469 + return true;
5470 +
5471 + return false;
5472 +}
5473 +
5474 +static int xhci_all_ports_seen_u0(struct xhci_hcd *xhci)
5475 +{
5476 + return (xhci->port_status_u0 == ((1 << xhci->num_usb3_ports)-1));
5477 +}
5478 +
5479 +
5480 /*
5481 * Initialize memory for HCD and xHC (one-time init).
5482 *
5483 @@ -421,6 +511,12 @@ int xhci_init(struct usb_hcd *hcd)
5484 retval = xhci_mem_init(xhci, GFP_KERNEL);
5485 xhci_dbg(xhci, "Finished xhci_init\n");
5486
5487 + /* Initializing Compliance Mode Recovery Data If Needed */
5488 + if (compliance_mode_recovery_timer_quirk_check()) {
5489 + xhci->quirks |= XHCI_COMP_MODE_QUIRK;
5490 + compliance_mode_recovery_timer_init(xhci);
5491 + }
5492 +
5493 return retval;
5494 }
5495
5496 @@ -629,6 +725,11 @@ void xhci_stop(struct usb_hcd *hcd)
5497 del_timer_sync(&xhci->event_ring_timer);
5498 #endif
5499
5500 + /* Deleting Compliance Mode Recovery Timer */
5501 + if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
5502 + (!(xhci_all_ports_seen_u0(xhci))))
5503 + del_timer_sync(&xhci->comp_mode_recovery_timer);
5504 +
5505 if (xhci->quirks & XHCI_AMD_PLL_FIX)
5506 usb_amd_dev_put();
5507
5508 @@ -659,7 +760,7 @@ void xhci_shutdown(struct usb_hcd *hcd)
5509 {
5510 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
5511
5512 - if (xhci->quirks && XHCI_SPURIOUS_REBOOT)
5513 + if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
5514 usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
5515
5516 spin_lock_irq(&xhci->lock);
5517 @@ -806,6 +907,16 @@ int xhci_suspend(struct xhci_hcd *xhci)
5518 }
5519 spin_unlock_irq(&xhci->lock);
5520
5521 + /*
5522 + * Deleting Compliance Mode Recovery Timer because the xHCI Host
5523 + * is about to be suspended.
5524 + */
5525 + if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
5526 + (!(xhci_all_ports_seen_u0(xhci)))) {
5527 + del_timer_sync(&xhci->comp_mode_recovery_timer);
5528 + xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted!\n");
5529 + }
5530 +
5531 /* step 5: remove core well power */
5532 /* synchronize irq when using MSI-X */
5533 xhci_msix_sync_irqs(xhci);
5534 @@ -938,6 +1049,16 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
5535 usb_hcd_resume_root_hub(hcd);
5536 usb_hcd_resume_root_hub(xhci->shared_hcd);
5537 }
5538 +
5539 + /*
5540 + * If system is subject to the Quirk, Compliance Mode Timer needs to
5541 + * be re-initialized Always after a system resume. Ports are subject
5542 + * to suffer the Compliance Mode issue again. It doesn't matter if
5543 + * ports have entered previously to U0 before system's suspension.
5544 + */
5545 + if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
5546 + compliance_mode_recovery_timer_init(xhci);
5547 +
5548 return retval;
5549 }
5550 #endif /* CONFIG_PM */
5551 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
5552 index 19ae30f..6e77f3b 100644
5553 --- a/drivers/usb/host/xhci.h
5554 +++ b/drivers/usb/host/xhci.h
5555 @@ -1487,6 +1487,7 @@ struct xhci_hcd {
5556 #define XHCI_AMD_0x96_HOST (1 << 9)
5557 #define XHCI_TRUST_TX_LENGTH (1 << 10)
5558 #define XHCI_SPURIOUS_REBOOT (1 << 13)
5559 +#define XHCI_COMP_MODE_QUIRK (1 << 14)
5560 unsigned int num_active_eps;
5561 unsigned int limit_active_eps;
5562 /* There are two roothubs to keep track of bus suspend info for */
5563 @@ -1503,6 +1504,11 @@ struct xhci_hcd {
5564 unsigned sw_lpm_support:1;
5565 /* support xHCI 1.0 spec USB2 hardware LPM */
5566 unsigned hw_lpm_support:1;
5567 + /* Compliance Mode Recovery Data */
5568 + struct timer_list comp_mode_recovery_timer;
5569 + u32 port_status_u0;
5570 +/* Compliance Mode Timer Triggered every 2 seconds */
5571 +#define COMP_MODE_RCVRY_MSECS 2000
5572 };
5573
5574 /* convert between an HCD pointer and the corresponding EHCI_HCD */
5575 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
5576 index f5819cb..4d2b7d3 100644
5577 --- a/drivers/usb/serial/ftdi_sio.c
5578 +++ b/drivers/usb/serial/ftdi_sio.c
5579 @@ -704,6 +704,7 @@ static struct usb_device_id id_table_combined [] = {
5580 { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
5581 { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
5582 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
5583 + { USB_DEVICE(FTDI_VID, FTDI_NZR_SEM_USB_PID) },
5584 { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) },
5585 { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) },
5586 { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
5587 @@ -804,13 +805,32 @@ static struct usb_device_id id_table_combined [] = {
5588 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
5589 { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID),
5590 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
5591 - { USB_DEVICE(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID) },
5592 + { USB_DEVICE_AND_INTERFACE_INFO(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID,
5593 + USB_CLASS_VENDOR_SPEC,
5594 + USB_SUBCLASS_VENDOR_SPEC, 0x00) },
5595 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
5596 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
5597 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
5598 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
5599 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
5600 + { USB_DEVICE(FTDI_VID, PI_C865_PID) },
5601 + { USB_DEVICE(FTDI_VID, PI_C857_PID) },
5602 + { USB_DEVICE(PI_VID, PI_C866_PID) },
5603 + { USB_DEVICE(PI_VID, PI_C663_PID) },
5604 + { USB_DEVICE(PI_VID, PI_C725_PID) },
5605 + { USB_DEVICE(PI_VID, PI_E517_PID) },
5606 + { USB_DEVICE(PI_VID, PI_C863_PID) },
5607 { USB_DEVICE(PI_VID, PI_E861_PID) },
5608 + { USB_DEVICE(PI_VID, PI_C867_PID) },
5609 + { USB_DEVICE(PI_VID, PI_E609_PID) },
5610 + { USB_DEVICE(PI_VID, PI_E709_PID) },
5611 + { USB_DEVICE(PI_VID, PI_100F_PID) },
5612 + { USB_DEVICE(PI_VID, PI_1011_PID) },
5613 + { USB_DEVICE(PI_VID, PI_1012_PID) },
5614 + { USB_DEVICE(PI_VID, PI_1013_PID) },
5615 + { USB_DEVICE(PI_VID, PI_1014_PID) },
5616 + { USB_DEVICE(PI_VID, PI_1015_PID) },
5617 + { USB_DEVICE(PI_VID, PI_1016_PID) },
5618 { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
5619 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
5620 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
5621 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
5622 index 5dd96ca..41fe582 100644
5623 --- a/drivers/usb/serial/ftdi_sio_ids.h
5624 +++ b/drivers/usb/serial/ftdi_sio_ids.h
5625 @@ -75,6 +75,9 @@
5626 #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
5627 #define FTDI_OPENDCC_GBM_PID 0xBFDC
5628
5629 +/* NZR SEM 16+ USB (http://www.nzr.de) */
5630 +#define FTDI_NZR_SEM_USB_PID 0xC1E0 /* NZR SEM-LOG16+ */
5631 +
5632 /*
5633 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
5634 */
5635 @@ -539,7 +542,10 @@
5636 /*
5637 * Microchip Technology, Inc.
5638 *
5639 - * MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are also used by:
5640 + * MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are
5641 + * used by single function CDC ACM class based firmware demo
5642 + * applications. The VID/PID has also been used in firmware
5643 + * emulating FTDI serial chips by:
5644 * Hornby Elite - Digital Command Control Console
5645 * http://www.hornby.com/hornby-dcc/controllers/
5646 */
5647 @@ -791,8 +797,27 @@
5648 * Physik Instrumente
5649 * http://www.physikinstrumente.com/en/products/
5650 */
5651 +/* These two devices use the VID of FTDI */
5652 +#define PI_C865_PID 0xe0a0 /* PI C-865 Piezomotor Controller */
5653 +#define PI_C857_PID 0xe0a1 /* PI Encoder Trigger Box */
5654 +
5655 #define PI_VID 0x1a72 /* Vendor ID */
5656 -#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */
5657 +#define PI_C866_PID 0x1000 /* PI C-866 Piezomotor Controller */
5658 +#define PI_C663_PID 0x1001 /* PI C-663 Mercury-Step */
5659 +#define PI_C725_PID 0x1002 /* PI C-725 Piezomotor Controller */
5660 +#define PI_E517_PID 0x1005 /* PI E-517 Digital Piezo Controller Operation Module */
5661 +#define PI_C863_PID 0x1007 /* PI C-863 */
5662 +#define PI_E861_PID 0x1008 /* PI E-861 Piezomotor Controller */
5663 +#define PI_C867_PID 0x1009 /* PI C-867 Piezomotor Controller */
5664 +#define PI_E609_PID 0x100D /* PI E-609 Digital Piezo Controller */
5665 +#define PI_E709_PID 0x100E /* PI E-709 Digital Piezo Controller */
5666 +#define PI_100F_PID 0x100F /* PI Digital Piezo Controller */
5667 +#define PI_1011_PID 0x1011 /* PI Digital Piezo Controller */
5668 +#define PI_1012_PID 0x1012 /* PI Motion Controller */
5669 +#define PI_1013_PID 0x1013 /* PI Motion Controller */
5670 +#define PI_1014_PID 0x1014 /* PI Device */
5671 +#define PI_1015_PID 0x1015 /* PI Device */
5672 +#define PI_1016_PID 0x1016 /* PI Digital Servo Module */
5673
5674 /*
5675 * Kondo Kagaku Co.Ltd.
5676 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
5677 index ee693cc..a49099d 100644
5678 --- a/drivers/usb/serial/option.c
5679 +++ b/drivers/usb/serial/option.c
5680 @@ -886,8 +886,6 @@ static const struct usb_device_id option_ids[] = {
5681 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
5682 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
5683 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
5684 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff),
5685 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
5686 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
5687 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
5688 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
5689 @@ -1092,6 +1090,10 @@ static const struct usb_device_id option_ids[] = {
5690 .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
5691 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
5692 .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
5693 + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
5694 + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
5695 + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
5696 +
5697 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
5698 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
5699 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
5700 diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
5701 index 2e471c2..88e9204 100644
5702 --- a/drivers/video/console/fbcon.c
5703 +++ b/drivers/video/console/fbcon.c
5704 @@ -372,8 +372,15 @@ static void fb_flashcursor(struct work_struct *work)
5705 struct vc_data *vc = NULL;
5706 int c;
5707 int mode;
5708 + int ret;
5709 +
5710 + /* FIXME: we should sort out the unbind locking instead */
5711 + /* instead we just fail to flash the cursor if we can't get
5712 + * the lock instead of blocking fbcon deinit */
5713 + ret = console_trylock();
5714 + if (ret == 0)
5715 + return;
5716
5717 - console_lock();
5718 if (ops && ops->currcon != -1)
5719 vc = vc_cons[ops->currcon].d;
5720
5721 diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
5722 index 9f13b89..6019929 100644
5723 --- a/drivers/watchdog/hpwdt.c
5724 +++ b/drivers/watchdog/hpwdt.c
5725 @@ -806,6 +806,9 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev,
5726 hpwdt_timer_reg = pci_mem_addr + 0x70;
5727 hpwdt_timer_con = pci_mem_addr + 0x72;
5728
5729 + /* Make sure that timer is disabled until /dev/watchdog is opened */
5730 + hpwdt_stop();
5731 +
5732 /* Make sure that we have a valid soft_margin */
5733 if (hpwdt_change_timer(soft_margin))
5734 hpwdt_change_timer(DEFAULT_MARGIN);
5735 diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
5736 index 1ffd03b..7f12416 100644
5737 --- a/drivers/xen/gntdev.c
5738 +++ b/drivers/xen/gntdev.c
5739 @@ -314,8 +314,9 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
5740 }
5741 }
5742
5743 - err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset,
5744 - pages, true);
5745 + err = gnttab_unmap_refs(map->unmap_ops + offset,
5746 + use_ptemod ? map->kmap_ops + offset : NULL, map->pages + offset,
5747 + pages);
5748 if (err)
5749 return err;
5750
5751 diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
5752 index f100ce2..fda491c 100644
5753 --- a/drivers/xen/grant-table.c
5754 +++ b/drivers/xen/grant-table.c
5755 @@ -774,7 +774,8 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
5756 EXPORT_SYMBOL_GPL(gnttab_map_refs);
5757
5758 int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
5759 - struct page **pages, unsigned int count, bool clear_pte)
5760 + struct gnttab_map_grant_ref *kmap_ops,
5761 + struct page **pages, unsigned int count)
5762 {
5763 int i, ret;
5764
5765 @@ -786,7 +787,8 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
5766 return ret;
5767
5768 for (i = 0; i < count; i++) {
5769 - ret = m2p_remove_override(pages[i], clear_pte);
5770 + ret = m2p_remove_override(pages[i], kmap_ops ?
5771 + &kmap_ops[i] : NULL);
5772 if (ret)
5773 return ret;
5774 }
5775 diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
5776 index fbb9da9..33ef60d 100644
5777 --- a/fs/cifs/cifs_unicode.c
5778 +++ b/fs/cifs/cifs_unicode.c
5779 @@ -328,6 +328,6 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
5780 }
5781
5782 ctoUTF16_out:
5783 - return i;
5784 + return j;
5785 }
5786
5787 diff --git a/fs/dcache.c b/fs/dcache.c
5788 index b80531c..10fab26 100644
5789 --- a/fs/dcache.c
5790 +++ b/fs/dcache.c
5791 @@ -373,7 +373,7 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent)
5792 * Inform try_to_ascend() that we are no longer attached to the
5793 * dentry tree
5794 */
5795 - dentry->d_flags |= DCACHE_DISCONNECTED;
5796 + dentry->d_flags |= DCACHE_DENTRY_KILLED;
5797 if (parent)
5798 spin_unlock(&parent->d_lock);
5799 dentry_iput(dentry);
5800 @@ -1030,7 +1030,7 @@ static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq
5801 * or deletion
5802 */
5803 if (new != old->d_parent ||
5804 - (old->d_flags & DCACHE_DISCONNECTED) ||
5805 + (old->d_flags & DCACHE_DENTRY_KILLED) ||
5806 (!locked && read_seqretry(&rename_lock, seq))) {
5807 spin_unlock(&new->d_lock);
5808 new = NULL;
5809 diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
5810 index ab35b11..6f5fb1a 100644
5811 --- a/fs/ecryptfs/inode.c
5812 +++ b/fs/ecryptfs/inode.c
5813 @@ -621,6 +621,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5814 struct dentry *lower_old_dir_dentry;
5815 struct dentry *lower_new_dir_dentry;
5816 struct dentry *trap = NULL;
5817 + struct inode *target_inode;
5818
5819 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
5820 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
5821 @@ -628,6 +629,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5822 dget(lower_new_dentry);
5823 lower_old_dir_dentry = dget_parent(lower_old_dentry);
5824 lower_new_dir_dentry = dget_parent(lower_new_dentry);
5825 + target_inode = new_dentry->d_inode;
5826 trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
5827 /* source should not be ancestor of target */
5828 if (trap == lower_old_dentry) {
5829 @@ -643,6 +645,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
5830 lower_new_dir_dentry->d_inode, lower_new_dentry);
5831 if (rc)
5832 goto out_lock;
5833 + if (target_inode)
5834 + fsstack_copy_attr_all(target_inode,
5835 + ecryptfs_inode_to_lower(target_inode));
5836 fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
5837 if (new_dir != old_dir)
5838 fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode);
5839 diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
5840 index 3250f28..58ddc38 100644
5841 --- a/fs/lockd/svc.c
5842 +++ b/fs/lockd/svc.c
5843 @@ -251,10 +251,9 @@ out_err:
5844 return err;
5845 }
5846
5847 -static int lockd_up_net(struct net *net)
5848 +static int lockd_up_net(struct svc_serv *serv, struct net *net)
5849 {
5850 struct lockd_net *ln = net_generic(net, lockd_net_id);
5851 - struct svc_serv *serv = nlmsvc_rqst->rq_server;
5852 int error;
5853
5854 if (ln->nlmsvc_users++)
5855 @@ -276,10 +275,9 @@ err_rpcb:
5856 return error;
5857 }
5858
5859 -static void lockd_down_net(struct net *net)
5860 +static void lockd_down_net(struct svc_serv *serv, struct net *net)
5861 {
5862 struct lockd_net *ln = net_generic(net, lockd_net_id);
5863 - struct svc_serv *serv = nlmsvc_rqst->rq_server;
5864
5865 if (ln->nlmsvc_users) {
5866 if (--ln->nlmsvc_users == 0) {
5867 @@ -307,7 +305,7 @@ int lockd_up(struct net *net)
5868 * Check whether we're already up and running.
5869 */
5870 if (nlmsvc_rqst) {
5871 - error = lockd_up_net(net);
5872 + error = lockd_up_net(nlmsvc_rqst->rq_server, net);
5873 goto out;
5874 }
5875
5876 @@ -378,7 +376,7 @@ out:
5877 return error;
5878
5879 err_start:
5880 - lockd_down_net(net);
5881 + lockd_down_net(serv, net);
5882 goto destroy_and_out;
5883 }
5884 EXPORT_SYMBOL_GPL(lockd_up);
5885 @@ -390,7 +388,7 @@ void
5886 lockd_down(struct net *net)
5887 {
5888 mutex_lock(&nlmsvc_mutex);
5889 - lockd_down_net(net);
5890 + lockd_down_net(nlmsvc_rqst->rq_server, net);
5891 if (nlmsvc_users) {
5892 if (--nlmsvc_users)
5893 goto out;
5894 diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
5895 index e8bbfa5..edf4119 100644
5896 --- a/fs/nfs/inode.c
5897 +++ b/fs/nfs/inode.c
5898 @@ -152,7 +152,7 @@ static void nfs_zap_caches_locked(struct inode *inode)
5899 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
5900 nfsi->attrtimeo_timestamp = jiffies;
5901
5902 - memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
5903 + memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf));
5904 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))
5905 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
5906 else
5907 diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
5908 index a1e416b..a7a043d 100644
5909 --- a/fs/nfs/nfs3proc.c
5910 +++ b/fs/nfs/nfs3proc.c
5911 @@ -644,7 +644,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
5912 u64 cookie, struct page **pages, unsigned int count, int plus)
5913 {
5914 struct inode *dir = dentry->d_inode;
5915 - __be32 *verf = NFS_COOKIEVERF(dir);
5916 + __be32 *verf = NFS_I(dir)->cookieverf;
5917 struct nfs3_readdirargs arg = {
5918 .fh = NFS_FH(dir),
5919 .cookie = cookie,
5920 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
5921 index dc57324..b106b97 100644
5922 --- a/fs/nfs/nfs4proc.c
5923 +++ b/fs/nfs/nfs4proc.c
5924 @@ -3150,11 +3150,11 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
5925 dentry->d_parent->d_name.name,
5926 dentry->d_name.name,
5927 (unsigned long long)cookie);
5928 - nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
5929 + nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
5930 res.pgbase = args.pgbase;
5931 status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
5932 if (status >= 0) {
5933 - memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
5934 + memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE);
5935 status += args.pgbase;
5936 }
5937
5938 diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
5939 index c54aae3..c8ac9a1 100644
5940 --- a/fs/nfs/nfs4xdr.c
5941 +++ b/fs/nfs/nfs4xdr.c
5942 @@ -6081,7 +6081,8 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5943 status = decode_open(xdr, res);
5944 if (status)
5945 goto out;
5946 - if (decode_getfh(xdr, &res->fh) != 0)
5947 + status = decode_getfh(xdr, &res->fh);
5948 + if (status)
5949 goto out;
5950 if (decode_getfattr(xdr, res->f_attr, res->server) != 0)
5951 goto out;
5952 diff --git a/fs/nfs/super.c b/fs/nfs/super.c
5953 index 7b55f51..5976e24 100644
5954 --- a/fs/nfs/super.c
5955 +++ b/fs/nfs/super.c
5956 @@ -1886,6 +1886,7 @@ static int nfs_validate_mount_data(void *options,
5957
5958 memcpy(sap, &data->addr, sizeof(data->addr));
5959 args->nfs_server.addrlen = sizeof(data->addr);
5960 + args->nfs_server.port = ntohs(data->addr.sin_port);
5961 if (!nfs_verify_server_address(sap))
5962 goto out_no_address;
5963
5964 @@ -2598,6 +2599,7 @@ static int nfs4_validate_mount_data(void *options,
5965 return -EFAULT;
5966 if (!nfs_verify_server_address(sap))
5967 goto out_no_address;
5968 + args->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port);
5969
5970 if (data->auth_flavourlen) {
5971 if (data->auth_flavourlen > 1)
5972 diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
5973 index 3ab12eb..d014727 100644
5974 --- a/fs/nfsd/nfsctl.c
5975 +++ b/fs/nfsd/nfsctl.c
5976 @@ -663,9 +663,7 @@ static ssize_t __write_ports_addfd(char *buf)
5977
5978 err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
5979 if (err < 0) {
5980 - if (nfsd_serv->sv_nrthreads == 1)
5981 - svc_shutdown_net(nfsd_serv, net);
5982 - svc_destroy(nfsd_serv);
5983 + nfsd_destroy(net);
5984 return err;
5985 }
5986
5987 @@ -734,9 +732,7 @@ out_close:
5988 svc_xprt_put(xprt);
5989 }
5990 out_err:
5991 - if (nfsd_serv->sv_nrthreads == 1)
5992 - svc_shutdown_net(nfsd_serv, net);
5993 - svc_destroy(nfsd_serv);
5994 + nfsd_destroy(net);
5995 return err;
5996 }
5997
5998 diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
5999 index 1671429..1336a65 100644
6000 --- a/fs/nfsd/nfsd.h
6001 +++ b/fs/nfsd/nfsd.h
6002 @@ -73,6 +73,17 @@ int nfsd_nrpools(void);
6003 int nfsd_get_nrthreads(int n, int *);
6004 int nfsd_set_nrthreads(int n, int *);
6005
6006 +static inline void nfsd_destroy(struct net *net)
6007 +{
6008 + int destroy = (nfsd_serv->sv_nrthreads == 1);
6009 +
6010 + if (destroy)
6011 + svc_shutdown_net(nfsd_serv, net);
6012 + svc_destroy(nfsd_serv);
6013 + if (destroy)
6014 + nfsd_serv = NULL;
6015 +}
6016 +
6017 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
6018 #ifdef CONFIG_NFSD_V2_ACL
6019 extern struct svc_version nfsd_acl_version2;
6020 diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
6021 index bcda12a..b6f8e65 100644
6022 --- a/fs/nfsd/nfssvc.c
6023 +++ b/fs/nfsd/nfssvc.c
6024 @@ -254,8 +254,6 @@ static void nfsd_shutdown(void)
6025
6026 static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
6027 {
6028 - /* When last nfsd thread exits we need to do some clean-up */
6029 - nfsd_serv = NULL;
6030 nfsd_shutdown();
6031
6032 svc_rpcb_cleanup(serv, net);
6033 @@ -332,6 +330,7 @@ static int nfsd_get_default_max_blksize(void)
6034 int nfsd_create_serv(void)
6035 {
6036 int error;
6037 + struct net *net = current->nsproxy->net_ns;
6038
6039 WARN_ON(!mutex_is_locked(&nfsd_mutex));
6040 if (nfsd_serv) {
6041 @@ -346,7 +345,7 @@ int nfsd_create_serv(void)
6042 if (nfsd_serv == NULL)
6043 return -ENOMEM;
6044
6045 - error = svc_bind(nfsd_serv, current->nsproxy->net_ns);
6046 + error = svc_bind(nfsd_serv, net);
6047 if (error < 0) {
6048 svc_destroy(nfsd_serv);
6049 return error;
6050 @@ -427,11 +426,7 @@ int nfsd_set_nrthreads(int n, int *nthreads)
6051 if (err)
6052 break;
6053 }
6054 -
6055 - if (nfsd_serv->sv_nrthreads == 1)
6056 - svc_shutdown_net(nfsd_serv, net);
6057 - svc_destroy(nfsd_serv);
6058 -
6059 + nfsd_destroy(net);
6060 return err;
6061 }
6062
6063 @@ -478,9 +473,7 @@ out_shutdown:
6064 if (error < 0 && !nfsd_up_before)
6065 nfsd_shutdown();
6066 out_destroy:
6067 - if (nfsd_serv->sv_nrthreads == 1)
6068 - svc_shutdown_net(nfsd_serv, net);
6069 - svc_destroy(nfsd_serv); /* Release server */
6070 + nfsd_destroy(net); /* Release server */
6071 out:
6072 mutex_unlock(&nfsd_mutex);
6073 return error;
6074 @@ -563,12 +556,13 @@ nfsd(void *vrqstp)
6075 nfsdstats.th_cnt --;
6076
6077 out:
6078 - if (rqstp->rq_server->sv_nrthreads == 1)
6079 - svc_shutdown_net(rqstp->rq_server, &init_net);
6080 + rqstp->rq_server = NULL;
6081
6082 /* Release the thread */
6083 svc_exit_thread(rqstp);
6084
6085 + nfsd_destroy(&init_net);
6086 +
6087 /* Release module */
6088 mutex_unlock(&nfsd_mutex);
6089 module_put_and_exit(0);
6090 @@ -682,9 +676,7 @@ int nfsd_pool_stats_release(struct inode *inode, struct file *file)
6091
6092 mutex_lock(&nfsd_mutex);
6093 /* this function really, really should have been called svc_put() */
6094 - if (nfsd_serv->sv_nrthreads == 1)
6095 - svc_shutdown_net(nfsd_serv, net);
6096 - svc_destroy(nfsd_serv);
6097 + nfsd_destroy(net);
6098 mutex_unlock(&nfsd_mutex);
6099 return ret;
6100 }
6101 diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
6102 index 21d836f..ab53521 100644
6103 --- a/fs/proc/proc_sysctl.c
6104 +++ b/fs/proc/proc_sysctl.c
6105 @@ -462,9 +462,6 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
6106
6107 err = ERR_PTR(-ENOMEM);
6108 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
6109 - if (h)
6110 - sysctl_head_finish(h);
6111 -
6112 if (!inode)
6113 goto out;
6114
6115 @@ -473,6 +470,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
6116 d_add(dentry, inode);
6117
6118 out:
6119 + if (h)
6120 + sysctl_head_finish(h);
6121 sysctl_head_finish(head);
6122 return err;
6123 }
6124 diff --git a/fs/stat.c b/fs/stat.c
6125 index c733dc5..dc6d0be 100644
6126 --- a/fs/stat.c
6127 +++ b/fs/stat.c
6128 @@ -57,7 +57,7 @@ EXPORT_SYMBOL(vfs_getattr);
6129
6130 int vfs_fstat(unsigned int fd, struct kstat *stat)
6131 {
6132 - struct file *f = fget(fd);
6133 + struct file *f = fget_raw(fd);
6134 int error = -EBADF;
6135
6136 if (f) {
6137 diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
6138 index 580a6d3..c04e0db 100644
6139 --- a/include/asm-generic/mutex-xchg.h
6140 +++ b/include/asm-generic/mutex-xchg.h
6141 @@ -26,7 +26,13 @@ static inline void
6142 __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
6143 {
6144 if (unlikely(atomic_xchg(count, 0) != 1))
6145 - fail_fn(count);
6146 + /*
6147 + * We failed to acquire the lock, so mark it contended
6148 + * to ensure that any waiting tasks are woken up by the
6149 + * unlock slow path.
6150 + */
6151 + if (likely(atomic_xchg(count, -1) != 1))
6152 + fail_fn(count);
6153 }
6154
6155 /**
6156 @@ -43,7 +49,8 @@ static inline int
6157 __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
6158 {
6159 if (unlikely(atomic_xchg(count, 0) != 1))
6160 - return fail_fn(count);
6161 + if (likely(atomic_xchg(count, -1) != 1))
6162 + return fail_fn(count);
6163 return 0;
6164 }
6165
6166 diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
6167 index 4a0aae3..9242310 100644
6168 --- a/include/drm/drm_mode.h
6169 +++ b/include/drm/drm_mode.h
6170 @@ -343,8 +343,9 @@ struct drm_mode_mode_cmd {
6171 struct drm_mode_modeinfo mode;
6172 };
6173
6174 -#define DRM_MODE_CURSOR_BO (1<<0)
6175 -#define DRM_MODE_CURSOR_MOVE (1<<1)
6176 +#define DRM_MODE_CURSOR_BO 0x01
6177 +#define DRM_MODE_CURSOR_MOVE 0x02
6178 +#define DRM_MODE_CURSOR_FLAGS 0x03
6179
6180 /*
6181 * depending on the value in flags different members are used.
6182 diff --git a/include/linux/dcache.h b/include/linux/dcache.h
6183 index 7e11f14..1332df0 100644
6184 --- a/include/linux/dcache.h
6185 +++ b/include/linux/dcache.h
6186 @@ -191,6 +191,8 @@ struct dentry_operations {
6187 #define DCACHE_MANAGED_DENTRY \
6188 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
6189
6190 +#define DCACHE_DENTRY_KILLED 0x100000
6191 +
6192 extern seqlock_t rename_lock;
6193
6194 static inline int dname_external(struct dentry *dentry)
6195 diff --git a/include/linux/init_task.h b/include/linux/init_task.h
6196 index e4baff5..e7bafa4 100644
6197 --- a/include/linux/init_task.h
6198 +++ b/include/linux/init_task.h
6199 @@ -123,8 +123,17 @@ extern struct group_info init_groups;
6200
6201 extern struct cred init_cred;
6202
6203 +extern struct task_group root_task_group;
6204 +
6205 +#ifdef CONFIG_CGROUP_SCHED
6206 +# define INIT_CGROUP_SCHED(tsk) \
6207 + .sched_task_group = &root_task_group,
6208 +#else
6209 +# define INIT_CGROUP_SCHED(tsk)
6210 +#endif
6211 +
6212 #ifdef CONFIG_PERF_EVENTS
6213 -# define INIT_PERF_EVENTS(tsk) \
6214 +# define INIT_PERF_EVENTS(tsk) \
6215 .perf_event_mutex = \
6216 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
6217 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
6218 @@ -161,6 +170,7 @@ extern struct cred init_cred;
6219 }, \
6220 .tasks = LIST_HEAD_INIT(tsk.tasks), \
6221 INIT_PUSHABLE_TASKS(tsk) \
6222 + INIT_CGROUP_SCHED(tsk) \
6223 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
6224 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
6225 .real_parent = &tsk, \
6226 diff --git a/include/linux/kobject.h b/include/linux/kobject.h
6227 index fc615a9..1e57449 100644
6228 --- a/include/linux/kobject.h
6229 +++ b/include/linux/kobject.h
6230 @@ -224,7 +224,7 @@ static inline int kobject_uevent_env(struct kobject *kobj,
6231
6232 static inline __printf(2, 3)
6233 int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
6234 -{ return 0; }
6235 +{ return -ENOMEM; }
6236
6237 static inline int kobject_action_type(const char *buf, size_t count,
6238 enum kobject_action *type)
6239 diff --git a/include/linux/kthread.h b/include/linux/kthread.h
6240 index 0714b24..22ccf9d 100644
6241 --- a/include/linux/kthread.h
6242 +++ b/include/linux/kthread.h
6243 @@ -49,8 +49,6 @@ extern int tsk_fork_get_node(struct task_struct *tsk);
6244 * can be queued and flushed using queue/flush_kthread_work()
6245 * respectively. Queued kthread_works are processed by a kthread
6246 * running kthread_worker_fn().
6247 - *
6248 - * A kthread_work can't be freed while it is executing.
6249 */
6250 struct kthread_work;
6251 typedef void (*kthread_work_func_t)(struct kthread_work *work);
6252 @@ -59,15 +57,14 @@ struct kthread_worker {
6253 spinlock_t lock;
6254 struct list_head work_list;
6255 struct task_struct *task;
6256 + struct kthread_work *current_work;
6257 };
6258
6259 struct kthread_work {
6260 struct list_head node;
6261 kthread_work_func_t func;
6262 wait_queue_head_t done;
6263 - atomic_t flushing;
6264 - int queue_seq;
6265 - int done_seq;
6266 + struct kthread_worker *worker;
6267 };
6268
6269 #define KTHREAD_WORKER_INIT(worker) { \
6270 @@ -79,7 +76,6 @@ struct kthread_work {
6271 .node = LIST_HEAD_INIT((work).node), \
6272 .func = (fn), \
6273 .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \
6274 - .flushing = ATOMIC_INIT(0), \
6275 }
6276
6277 #define DEFINE_KTHREAD_WORKER(worker) \
6278 diff --git a/include/linux/ktime.h b/include/linux/ktime.h
6279 index 603bec2..06177ba10 100644
6280 --- a/include/linux/ktime.h
6281 +++ b/include/linux/ktime.h
6282 @@ -58,13 +58,6 @@ union ktime {
6283
6284 typedef union ktime ktime_t; /* Kill this */
6285
6286 -#define KTIME_MAX ((s64)~((u64)1 << 63))
6287 -#if (BITS_PER_LONG == 64)
6288 -# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
6289 -#else
6290 -# define KTIME_SEC_MAX LONG_MAX
6291 -#endif
6292 -
6293 /*
6294 * ktime_t definitions when using the 64-bit scalar representation:
6295 */
6296 diff --git a/include/linux/memory.h b/include/linux/memory.h
6297 index 1ac7f6e..ff9a9f8 100644
6298 --- a/include/linux/memory.h
6299 +++ b/include/linux/memory.h
6300 @@ -19,7 +19,7 @@
6301 #include <linux/compiler.h>
6302 #include <linux/mutex.h>
6303
6304 -#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
6305 +#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)
6306
6307 struct memory_block {
6308 unsigned long start_section_nr;
6309 diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
6310 index 629b823..b5292f3 100644
6311 --- a/include/linux/mmc/card.h
6312 +++ b/include/linux/mmc/card.h
6313 @@ -234,6 +234,7 @@ struct mmc_card {
6314 #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
6315 #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
6316 #define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
6317 +#define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */
6318 /* byte mode */
6319 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
6320 #define MMC_NO_POWER_NOTIFICATION 0
6321 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
6322 index 33900a5..e517695 100644
6323 --- a/include/linux/netdevice.h
6324 +++ b/include/linux/netdevice.h
6325 @@ -1279,6 +1279,8 @@ struct net_device {
6326 /* for setting kernel sock attribute on TCP connection setup */
6327 #define GSO_MAX_SIZE 65536
6328 unsigned int gso_max_size;
6329 +#define GSO_MAX_SEGS 65535
6330 + u16 gso_max_segs;
6331
6332 #ifdef CONFIG_DCB
6333 /* Data Center Bridging netlink ops */
6334 @@ -1494,6 +1496,8 @@ struct packet_type {
6335 struct sk_buff **(*gro_receive)(struct sk_buff **head,
6336 struct sk_buff