Magellan Linux

Contents of /trunk/kernel-alx/patches-3.12/0111-3.12.12-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2423 - (show annotations) (download)
Tue Mar 25 12:29:50 2014 UTC (10 years, 1 month ago) by niro
File size: 36837 byte(s)
-added 3.12 branch
1 diff --git a/Makefile b/Makefile
2 index b9e092666bf9..563297e159b7 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 12
8 -SUBLEVEL = 11
9 +SUBLEVEL = 12
10 EXTRAVERSION =
11 NAME = One Giant Leap for Frogkind
12
13 diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
14 index fea9ee327206..889324981aa4 100644
15 --- a/arch/arm64/include/asm/cacheflush.h
16 +++ b/arch/arm64/include/asm/cacheflush.h
17 @@ -116,6 +116,7 @@ extern void flush_dcache_page(struct page *);
18 static inline void __flush_icache_all(void)
19 {
20 asm("ic ialluis");
21 + dsb();
22 }
23
24 #define flush_dcache_mmap_lock(mapping) \
25 diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
26 index 6a389dc1bd49..0ea7a22bcdf2 100644
27 --- a/arch/arm64/kernel/vdso.c
28 +++ b/arch/arm64/kernel/vdso.c
29 @@ -235,6 +235,8 @@ void update_vsyscall(struct timekeeper *tk)
30 vdso_data->use_syscall = use_syscall;
31 vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec;
32 vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec;
33 + vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
34 + vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
35
36 if (!use_syscall) {
37 vdso_data->cs_cycle_last = tk->clock->cycle_last;
38 @@ -242,8 +244,6 @@ void update_vsyscall(struct timekeeper *tk)
39 vdso_data->xtime_clock_nsec = tk->xtime_nsec;
40 vdso_data->cs_mult = tk->mult;
41 vdso_data->cs_shift = tk->shift;
42 - vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
43 - vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
44 }
45
46 smp_wmb();
47 diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
48 index d8064af42e62..6d20b7d162d8 100644
49 --- a/arch/arm64/kernel/vdso/Makefile
50 +++ b/arch/arm64/kernel/vdso/Makefile
51 @@ -48,7 +48,7 @@ $(obj-vdso): %.o: %.S
52
53 # Actual build commands
54 quiet_cmd_vdsold = VDSOL $@
55 - cmd_vdsold = $(CC) $(c_flags) -Wl,-T $^ -o $@
56 + cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
57 quiet_cmd_vdsoas = VDSOA $@
58 cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
59
60 diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
61 index f0a6d10b5211..fe652ffd34c2 100644
62 --- a/arch/arm64/kernel/vdso/gettimeofday.S
63 +++ b/arch/arm64/kernel/vdso/gettimeofday.S
64 @@ -103,6 +103,8 @@ ENTRY(__kernel_clock_gettime)
65 bl __do_get_tspec
66 seqcnt_check w9, 1b
67
68 + mov x30, x2
69 +
70 cmp w0, #CLOCK_MONOTONIC
71 b.ne 6f
72
73 @@ -118,6 +120,9 @@ ENTRY(__kernel_clock_gettime)
74 ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne
75 b.ne 8f
76
77 + /* xtime_coarse_nsec is already right-shifted */
78 + mov x12, #0
79 +
80 /* Get coarse timespec. */
81 adr vdso_data, _vdso_data
82 3: seqcnt_acquire
83 @@ -156,7 +161,7 @@ ENTRY(__kernel_clock_gettime)
84 lsr x11, x11, x12
85 stp x10, x11, [x1, #TSPEC_TV_SEC]
86 mov x0, xzr
87 - ret x2
88 + ret
89 7:
90 mov x30, x2
91 8: /* Syscall fallback. */
92 diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
93 index f557ebbe7013..f8dc7e8fce6f 100644
94 --- a/arch/arm64/mm/mmu.c
95 +++ b/arch/arm64/mm/mmu.c
96 @@ -203,10 +203,18 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
97 do {
98 next = pmd_addr_end(addr, end);
99 /* try section mapping first */
100 - if (((addr | next | phys) & ~SECTION_MASK) == 0)
101 + if (((addr | next | phys) & ~SECTION_MASK) == 0) {
102 + pmd_t old_pmd =*pmd;
103 set_pmd(pmd, __pmd(phys | prot_sect_kernel));
104 - else
105 + /*
106 + * Check for previous table entries created during
107 + * boot (__create_page_tables) and flush them.
108 + */
109 + if (!pmd_none(old_pmd))
110 + flush_tlb_all();
111 + } else {
112 alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys));
113 + }
114 phys += next - addr;
115 } while (pmd++, addr = next, addr != end);
116 }
117 diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
118 index 94e20dd2729f..2a245b55bb71 100644
119 --- a/arch/s390/crypto/aes_s390.c
120 +++ b/arch/s390/crypto/aes_s390.c
121 @@ -25,6 +25,7 @@
122 #include <linux/err.h>
123 #include <linux/module.h>
124 #include <linux/init.h>
125 +#include <linux/spinlock.h>
126 #include "crypt_s390.h"
127
128 #define AES_KEYLEN_128 1
129 @@ -32,6 +33,7 @@
130 #define AES_KEYLEN_256 4
131
132 static u8 *ctrblk;
133 +static DEFINE_SPINLOCK(ctrblk_lock);
134 static char keylen_flag;
135
136 struct s390_aes_ctx {
137 @@ -756,43 +758,67 @@ static int ctr_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
138 return aes_set_key(tfm, in_key, key_len);
139 }
140
141 +static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes)
142 +{
143 + unsigned int i, n;
144 +
145 + /* only use complete blocks, max. PAGE_SIZE */
146 + n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(AES_BLOCK_SIZE - 1);
147 + for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) {
148 + memcpy(ctrptr + i, ctrptr + i - AES_BLOCK_SIZE,
149 + AES_BLOCK_SIZE);
150 + crypto_inc(ctrptr + i, AES_BLOCK_SIZE);
151 + }
152 + return n;
153 +}
154 +
155 static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
156 struct s390_aes_ctx *sctx, struct blkcipher_walk *walk)
157 {
158 int ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE);
159 - unsigned int i, n, nbytes;
160 - u8 buf[AES_BLOCK_SIZE];
161 - u8 *out, *in;
162 + unsigned int n, nbytes;
163 + u8 buf[AES_BLOCK_SIZE], ctrbuf[AES_BLOCK_SIZE];
164 + u8 *out, *in, *ctrptr = ctrbuf;
165
166 if (!walk->nbytes)
167 return ret;
168
169 - memcpy(ctrblk, walk->iv, AES_BLOCK_SIZE);
170 + if (spin_trylock(&ctrblk_lock))
171 + ctrptr = ctrblk;
172 +
173 + memcpy(ctrptr, walk->iv, AES_BLOCK_SIZE);
174 while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) {
175 out = walk->dst.virt.addr;
176 in = walk->src.virt.addr;
177 while (nbytes >= AES_BLOCK_SIZE) {
178 - /* only use complete blocks, max. PAGE_SIZE */
179 - n = (nbytes > PAGE_SIZE) ? PAGE_SIZE :
180 - nbytes & ~(AES_BLOCK_SIZE - 1);
181 - for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) {
182 - memcpy(ctrblk + i, ctrblk + i - AES_BLOCK_SIZE,
183 - AES_BLOCK_SIZE);
184 - crypto_inc(ctrblk + i, AES_BLOCK_SIZE);
185 - }
186 - ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk);
187 - if (ret < 0 || ret != n)
188 + if (ctrptr == ctrblk)
189 + n = __ctrblk_init(ctrptr, nbytes);
190 + else
191 + n = AES_BLOCK_SIZE;
192 + ret = crypt_s390_kmctr(func, sctx->key, out, in,
193 + n, ctrptr);
194 + if (ret < 0 || ret != n) {
195 + if (ctrptr == ctrblk)
196 + spin_unlock(&ctrblk_lock);
197 return -EIO;
198 + }
199 if (n > AES_BLOCK_SIZE)
200 - memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE,
201 + memcpy(ctrptr, ctrptr + n - AES_BLOCK_SIZE,
202 AES_BLOCK_SIZE);
203 - crypto_inc(ctrblk, AES_BLOCK_SIZE);
204 + crypto_inc(ctrptr, AES_BLOCK_SIZE);
205 out += n;
206 in += n;
207 nbytes -= n;
208 }
209 ret = blkcipher_walk_done(desc, walk, nbytes);
210 }
211 + if (ctrptr == ctrblk) {
212 + if (nbytes)
213 + memcpy(ctrbuf, ctrptr, AES_BLOCK_SIZE);
214 + else
215 + memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
216 + spin_unlock(&ctrblk_lock);
217 + }
218 /*
219 * final block may be < AES_BLOCK_SIZE, copy only nbytes
220 */
221 @@ -800,14 +826,15 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
222 out = walk->dst.virt.addr;
223 in = walk->src.virt.addr;
224 ret = crypt_s390_kmctr(func, sctx->key, buf, in,
225 - AES_BLOCK_SIZE, ctrblk);
226 + AES_BLOCK_SIZE, ctrbuf);
227 if (ret < 0 || ret != AES_BLOCK_SIZE)
228 return -EIO;
229 memcpy(out, buf, nbytes);
230 - crypto_inc(ctrblk, AES_BLOCK_SIZE);
231 + crypto_inc(ctrbuf, AES_BLOCK_SIZE);
232 ret = blkcipher_walk_done(desc, walk, 0);
233 + memcpy(walk->iv, ctrbuf, AES_BLOCK_SIZE);
234 }
235 - memcpy(walk->iv, ctrblk, AES_BLOCK_SIZE);
236 +
237 return ret;
238 }
239
240 diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
241 index bcca01c9989d..2d96e68febb2 100644
242 --- a/arch/s390/crypto/des_s390.c
243 +++ b/arch/s390/crypto/des_s390.c
244 @@ -25,6 +25,7 @@
245 #define DES3_KEY_SIZE (3 * DES_KEY_SIZE)
246
247 static u8 *ctrblk;
248 +static DEFINE_SPINLOCK(ctrblk_lock);
249
250 struct s390_des_ctx {
251 u8 iv[DES_BLOCK_SIZE];
252 @@ -105,29 +106,35 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func,
253 }
254
255 static int cbc_desall_crypt(struct blkcipher_desc *desc, long func,
256 - u8 *iv, struct blkcipher_walk *walk)
257 + struct blkcipher_walk *walk)
258 {
259 + struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
260 int ret = blkcipher_walk_virt(desc, walk);
261 unsigned int nbytes = walk->nbytes;
262 + struct {
263 + u8 iv[DES_BLOCK_SIZE];
264 + u8 key[DES3_KEY_SIZE];
265 + } param;
266
267 if (!nbytes)
268 goto out;
269
270 - memcpy(iv, walk->iv, DES_BLOCK_SIZE);
271 + memcpy(param.iv, walk->iv, DES_BLOCK_SIZE);
272 + memcpy(param.key, ctx->key, DES3_KEY_SIZE);
273 do {
274 /* only use complete blocks */
275 unsigned int n = nbytes & ~(DES_BLOCK_SIZE - 1);
276 u8 *out = walk->dst.virt.addr;
277 u8 *in = walk->src.virt.addr;
278
279 - ret = crypt_s390_kmc(func, iv, out, in, n);
280 + ret = crypt_s390_kmc(func, &param, out, in, n);
281 if (ret < 0 || ret != n)
282 return -EIO;
283
284 nbytes &= DES_BLOCK_SIZE - 1;
285 ret = blkcipher_walk_done(desc, walk, nbytes);
286 } while ((nbytes = walk->nbytes));
287 - memcpy(walk->iv, iv, DES_BLOCK_SIZE);
288 + memcpy(walk->iv, param.iv, DES_BLOCK_SIZE);
289
290 out:
291 return ret;
292 @@ -179,22 +186,20 @@ static int cbc_des_encrypt(struct blkcipher_desc *desc,
293 struct scatterlist *dst, struct scatterlist *src,
294 unsigned int nbytes)
295 {
296 - struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
297 struct blkcipher_walk walk;
298
299 blkcipher_walk_init(&walk, dst, src, nbytes);
300 - return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, ctx->iv, &walk);
301 + return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, &walk);
302 }
303
304 static int cbc_des_decrypt(struct blkcipher_desc *desc,
305 struct scatterlist *dst, struct scatterlist *src,
306 unsigned int nbytes)
307 {
308 - struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
309 struct blkcipher_walk walk;
310
311 blkcipher_walk_init(&walk, dst, src, nbytes);
312 - return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, ctx->iv, &walk);
313 + return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, &walk);
314 }
315
316 static struct crypto_alg cbc_des_alg = {
317 @@ -327,22 +332,20 @@ static int cbc_des3_encrypt(struct blkcipher_desc *desc,
318 struct scatterlist *dst, struct scatterlist *src,
319 unsigned int nbytes)
320 {
321 - struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
322 struct blkcipher_walk walk;
323
324 blkcipher_walk_init(&walk, dst, src, nbytes);
325 - return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, ctx->iv, &walk);
326 + return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, &walk);
327 }
328
329 static int cbc_des3_decrypt(struct blkcipher_desc *desc,
330 struct scatterlist *dst, struct scatterlist *src,
331 unsigned int nbytes)
332 {
333 - struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
334 struct blkcipher_walk walk;
335
336 blkcipher_walk_init(&walk, dst, src, nbytes);
337 - return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, ctx->iv, &walk);
338 + return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, &walk);
339 }
340
341 static struct crypto_alg cbc_des3_alg = {
342 @@ -366,54 +369,80 @@ static struct crypto_alg cbc_des3_alg = {
343 }
344 };
345
346 +static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes)
347 +{
348 + unsigned int i, n;
349 +
350 + /* align to block size, max. PAGE_SIZE */
351 + n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(DES_BLOCK_SIZE - 1);
352 + for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) {
353 + memcpy(ctrptr + i, ctrptr + i - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
354 + crypto_inc(ctrptr + i, DES_BLOCK_SIZE);
355 + }
356 + return n;
357 +}
358 +
359 static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
360 - struct s390_des_ctx *ctx, struct blkcipher_walk *walk)
361 + struct s390_des_ctx *ctx,
362 + struct blkcipher_walk *walk)
363 {
364 int ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE);
365 - unsigned int i, n, nbytes;
366 - u8 buf[DES_BLOCK_SIZE];
367 - u8 *out, *in;
368 + unsigned int n, nbytes;
369 + u8 buf[DES_BLOCK_SIZE], ctrbuf[DES_BLOCK_SIZE];
370 + u8 *out, *in, *ctrptr = ctrbuf;
371 +
372 + if (!walk->nbytes)
373 + return ret;
374
375 - memcpy(ctrblk, walk->iv, DES_BLOCK_SIZE);
376 + if (spin_trylock(&ctrblk_lock))
377 + ctrptr = ctrblk;
378 +
379 + memcpy(ctrptr, walk->iv, DES_BLOCK_SIZE);
380 while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) {
381 out = walk->dst.virt.addr;
382 in = walk->src.virt.addr;
383 while (nbytes >= DES_BLOCK_SIZE) {
384 - /* align to block size, max. PAGE_SIZE */
385 - n = (nbytes > PAGE_SIZE) ? PAGE_SIZE :
386 - nbytes & ~(DES_BLOCK_SIZE - 1);
387 - for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) {
388 - memcpy(ctrblk + i, ctrblk + i - DES_BLOCK_SIZE,
389 - DES_BLOCK_SIZE);
390 - crypto_inc(ctrblk + i, DES_BLOCK_SIZE);
391 - }
392 - ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk);
393 - if (ret < 0 || ret != n)
394 + if (ctrptr == ctrblk)
395 + n = __ctrblk_init(ctrptr, nbytes);
396 + else
397 + n = DES_BLOCK_SIZE;
398 + ret = crypt_s390_kmctr(func, ctx->key, out, in,
399 + n, ctrptr);
400 + if (ret < 0 || ret != n) {
401 + if (ctrptr == ctrblk)
402 + spin_unlock(&ctrblk_lock);
403 return -EIO;
404 + }
405 if (n > DES_BLOCK_SIZE)
406 - memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE,
407 + memcpy(ctrptr, ctrptr + n - DES_BLOCK_SIZE,
408 DES_BLOCK_SIZE);
409 - crypto_inc(ctrblk, DES_BLOCK_SIZE);
410 + crypto_inc(ctrptr, DES_BLOCK_SIZE);
411 out += n;
412 in += n;
413 nbytes -= n;
414 }
415 ret = blkcipher_walk_done(desc, walk, nbytes);
416 }
417 -
418 + if (ctrptr == ctrblk) {
419 + if (nbytes)
420 + memcpy(ctrbuf, ctrptr, DES_BLOCK_SIZE);
421 + else
422 + memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
423 + spin_unlock(&ctrblk_lock);
424 + }
425 /* final block may be < DES_BLOCK_SIZE, copy only nbytes */
426 if (nbytes) {
427 out = walk->dst.virt.addr;
428 in = walk->src.virt.addr;
429 ret = crypt_s390_kmctr(func, ctx->key, buf, in,
430 - DES_BLOCK_SIZE, ctrblk);
431 + DES_BLOCK_SIZE, ctrbuf);
432 if (ret < 0 || ret != DES_BLOCK_SIZE)
433 return -EIO;
434 memcpy(out, buf, nbytes);
435 - crypto_inc(ctrblk, DES_BLOCK_SIZE);
436 + crypto_inc(ctrbuf, DES_BLOCK_SIZE);
437 ret = blkcipher_walk_done(desc, walk, 0);
438 + memcpy(walk->iv, ctrbuf, DES_BLOCK_SIZE);
439 }
440 - memcpy(walk->iv, ctrblk, DES_BLOCK_SIZE);
441 return ret;
442 }
443
444 diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
445 index a51efc90b534..87c0be59970a 100644
446 --- a/arch/x86/kernel/cpu/intel.c
447 +++ b/arch/x86/kernel/cpu/intel.c
448 @@ -628,7 +628,7 @@ static void intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c)
449 tlb_flushall_shift = 5;
450 break;
451 case 0x63a: /* Ivybridge */
452 - tlb_flushall_shift = 1;
453 + tlb_flushall_shift = 2;
454 break;
455 default:
456 tlb_flushall_shift = 6;
457 diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
458 index bb328a366122..a51ee009ed83 100644
459 --- a/drivers/irqchip/irq-armada-370-xp.c
460 +++ b/drivers/irqchip/irq-armada-370-xp.c
461 @@ -229,7 +229,7 @@ armada_370_xp_handle_irq(struct pt_regs *regs)
462 ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS)
463 & IPI_DOORBELL_MASK;
464
465 - writel(~IPI_DOORBELL_MASK, per_cpu_int_base +
466 + writel(~ipimask, per_cpu_int_base +
467 ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS);
468
469 /* Handle all pending doorbells */
470 diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
471 index 8f9b2cea88f0..8ede8ea762e6 100644
472 --- a/drivers/media/usb/dvb-usb-v2/af9035.c
473 +++ b/drivers/media/usb/dvb-usb-v2/af9035.c
474 @@ -1539,6 +1539,8 @@ static const struct usb_device_id af9035_id_table[] = {
475 &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) },
476 { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a05,
477 &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) },
478 + { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900,
479 + &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) },
480 { }
481 };
482 MODULE_DEVICE_TABLE(usb, af9035_id_table);
483 diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h
484 index 90f583e5d6a6..a8f65d88c9e7 100644
485 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h
486 +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h
487 @@ -68,7 +68,7 @@ struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
488 #else
489 static inline
490 struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
491 - struct mxl111sf_state *mxl_state
492 + struct mxl111sf_state *mxl_state,
493 struct mxl111sf_tuner_config *cfg)
494 {
495 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
496 diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
497 index 2627553f7de1..3b948e3d4583 100644
498 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c
499 +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
500 @@ -105,7 +105,7 @@ int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data)
501 ret = -EINVAL;
502 }
503
504 - pr_debug("R: (0x%02x, 0x%02x)\n", addr, *data);
505 + pr_debug("R: (0x%02x, 0x%02x)\n", addr, buf[1]);
506 fail:
507 return ret;
508 }
509 diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c b/drivers/media/v4l2-core/videobuf-dma-contig.c
510 index 65411adcd0ea..7e6b209b7002 100644
511 --- a/drivers/media/v4l2-core/videobuf-dma-contig.c
512 +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c
513 @@ -66,14 +66,11 @@ static void __videobuf_dc_free(struct device *dev,
514 static void videobuf_vm_open(struct vm_area_struct *vma)
515 {
516 struct videobuf_mapping *map = vma->vm_private_data;
517 - struct videobuf_queue *q = map->q;
518
519 - dev_dbg(q->dev, "vm_open %p [count=%u,vma=%08lx-%08lx]\n",
520 + dev_dbg(map->q->dev, "vm_open %p [count=%u,vma=%08lx-%08lx]\n",
521 map, map->count, vma->vm_start, vma->vm_end);
522
523 - videobuf_queue_lock(q);
524 map->count++;
525 - videobuf_queue_unlock(q);
526 }
527
528 static void videobuf_vm_close(struct vm_area_struct *vma)
529 @@ -85,11 +82,12 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
530 dev_dbg(q->dev, "vm_close %p [count=%u,vma=%08lx-%08lx]\n",
531 map, map->count, vma->vm_start, vma->vm_end);
532
533 - videobuf_queue_lock(q);
534 - if (!--map->count) {
535 + map->count--;
536 + if (0 == map->count) {
537 struct videobuf_dma_contig_memory *mem;
538
539 dev_dbg(q->dev, "munmap %p q=%p\n", map, q);
540 + videobuf_queue_lock(q);
541
542 /* We need first to cancel streams, before unmapping */
543 if (q->streaming)
544 @@ -128,8 +126,8 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
545
546 kfree(map);
547
548 + videobuf_queue_unlock(q);
549 }
550 - videobuf_queue_unlock(q);
551 }
552
553 static const struct vm_operations_struct videobuf_vm_ops = {
554 diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
555 index 9db674ccdc68..828e7c10bd70 100644
556 --- a/drivers/media/v4l2-core/videobuf-dma-sg.c
557 +++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
558 @@ -338,14 +338,11 @@ EXPORT_SYMBOL_GPL(videobuf_dma_free);
559 static void videobuf_vm_open(struct vm_area_struct *vma)
560 {
561 struct videobuf_mapping *map = vma->vm_private_data;
562 - struct videobuf_queue *q = map->q;
563
564 dprintk(2, "vm_open %p [count=%d,vma=%08lx-%08lx]\n", map,
565 map->count, vma->vm_start, vma->vm_end);
566
567 - videobuf_queue_lock(q);
568 map->count++;
569 - videobuf_queue_unlock(q);
570 }
571
572 static void videobuf_vm_close(struct vm_area_struct *vma)
573 @@ -358,9 +355,10 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
574 dprintk(2, "vm_close %p [count=%d,vma=%08lx-%08lx]\n", map,
575 map->count, vma->vm_start, vma->vm_end);
576
577 - videobuf_queue_lock(q);
578 - if (!--map->count) {
579 + map->count--;
580 + if (0 == map->count) {
581 dprintk(1, "munmap %p q=%p\n", map, q);
582 + videobuf_queue_lock(q);
583 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
584 if (NULL == q->bufs[i])
585 continue;
586 @@ -376,9 +374,9 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
587 q->bufs[i]->baddr = 0;
588 q->ops->buf_release(q, q->bufs[i]);
589 }
590 + videobuf_queue_unlock(q);
591 kfree(map);
592 }
593 - videobuf_queue_unlock(q);
594 return;
595 }
596
597 diff --git a/drivers/media/v4l2-core/videobuf-vmalloc.c b/drivers/media/v4l2-core/videobuf-vmalloc.c
598 index 1365c651c177..2ff7fcc77b11 100644
599 --- a/drivers/media/v4l2-core/videobuf-vmalloc.c
600 +++ b/drivers/media/v4l2-core/videobuf-vmalloc.c
601 @@ -54,14 +54,11 @@ MODULE_LICENSE("GPL");
602 static void videobuf_vm_open(struct vm_area_struct *vma)
603 {
604 struct videobuf_mapping *map = vma->vm_private_data;
605 - struct videobuf_queue *q = map->q;
606
607 dprintk(2, "vm_open %p [count=%u,vma=%08lx-%08lx]\n", map,
608 map->count, vma->vm_start, vma->vm_end);
609
610 - videobuf_queue_lock(q);
611 map->count++;
612 - videobuf_queue_unlock(q);
613 }
614
615 static void videobuf_vm_close(struct vm_area_struct *vma)
616 @@ -73,11 +70,12 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
617 dprintk(2, "vm_close %p [count=%u,vma=%08lx-%08lx]\n", map,
618 map->count, vma->vm_start, vma->vm_end);
619
620 - videobuf_queue_lock(q);
621 - if (!--map->count) {
622 + map->count--;
623 + if (0 == map->count) {
624 struct videobuf_vmalloc_memory *mem;
625
626 dprintk(1, "munmap %p q=%p\n", map, q);
627 + videobuf_queue_lock(q);
628
629 /* We need first to cancel streams, before unmapping */
630 if (q->streaming)
631 @@ -116,8 +114,8 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
632
633 kfree(map);
634
635 + videobuf_queue_unlock(q);
636 }
637 - videobuf_queue_unlock(q);
638
639 return;
640 }
641 diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
642 index 92f86ab30a13..a1ffae4c3770 100644
643 --- a/drivers/pinctrl/core.c
644 +++ b/drivers/pinctrl/core.c
645 @@ -837,7 +837,9 @@ static struct pinctrl *create_pinctrl(struct device *dev)
646 kref_init(&p->users);
647
648 /* Add the pinctrl handle to the global list */
649 + mutex_lock(&pinctrl_list_mutex);
650 list_add_tail(&p->node, &pinctrl_list);
651 + mutex_unlock(&pinctrl_list_mutex);
652
653 return p;
654 }
655 diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
656 index f350fd2e170e..f4e99a9491cc 100644
657 --- a/drivers/pinctrl/pinctrl-at91.c
658 +++ b/drivers/pinctrl/pinctrl-at91.c
659 @@ -1251,22 +1251,22 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
660
661 switch (type) {
662 case IRQ_TYPE_EDGE_RISING:
663 - irq_set_handler(d->irq, handle_simple_irq);
664 + __irq_set_handler_locked(d->irq, handle_simple_irq);
665 writel_relaxed(mask, pio + PIO_ESR);
666 writel_relaxed(mask, pio + PIO_REHLSR);
667 break;
668 case IRQ_TYPE_EDGE_FALLING:
669 - irq_set_handler(d->irq, handle_simple_irq);
670 + __irq_set_handler_locked(d->irq, handle_simple_irq);
671 writel_relaxed(mask, pio + PIO_ESR);
672 writel_relaxed(mask, pio + PIO_FELLSR);
673 break;
674 case IRQ_TYPE_LEVEL_LOW:
675 - irq_set_handler(d->irq, handle_level_irq);
676 + __irq_set_handler_locked(d->irq, handle_level_irq);
677 writel_relaxed(mask, pio + PIO_LSR);
678 writel_relaxed(mask, pio + PIO_FELLSR);
679 break;
680 case IRQ_TYPE_LEVEL_HIGH:
681 - irq_set_handler(d->irq, handle_level_irq);
682 + __irq_set_handler_locked(d->irq, handle_level_irq);
683 writel_relaxed(mask, pio + PIO_LSR);
684 writel_relaxed(mask, pio + PIO_REHLSR);
685 break;
686 @@ -1275,7 +1275,7 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
687 * disable additional interrupt modes:
688 * fall back to default behavior
689 */
690 - irq_set_handler(d->irq, handle_simple_irq);
691 + __irq_set_handler_locked(d->irq, handle_simple_irq);
692 writel_relaxed(mask, pio + PIO_AIMDR);
693 return 0;
694 case IRQ_TYPE_NONE:
695 diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
696 index 39aec0850810..25ab2eec92e4 100644
697 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
698 +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
699 @@ -276,7 +276,20 @@ static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data,
700 if (!configs)
701 return -ENOMEM;
702
703 - configs[0] = pull;
704 + switch (pull) {
705 + case 0:
706 + configs[0] = PIN_CONFIG_BIAS_DISABLE;
707 + break;
708 + case 1:
709 + configs[0] = PIN_CONFIG_BIAS_PULL_DOWN;
710 + break;
711 + case 2:
712 + configs[0] = PIN_CONFIG_BIAS_PULL_UP;
713 + break;
714 + default:
715 + configs[0] = PIN_CONFIG_BIAS_DISABLE;
716 + dev_err(data->dev, "invalid pull state %d - disabling\n", pull);
717 + }
718
719 map->type = PIN_MAP_TYPE_CONFIGS_PIN;
720 map->data.configs.group_or_pin = data->groups[group];
721 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
722 index 8b8eff051493..1b63d29e44b7 100644
723 --- a/fs/btrfs/inode.c
724 +++ b/fs/btrfs/inode.c
725 @@ -2613,7 +2613,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
726 EXTENT_DEFRAG, 1, cached_state);
727 if (ret) {
728 u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item);
729 - if (last_snapshot >= BTRFS_I(inode)->generation)
730 + if (0 && last_snapshot >= BTRFS_I(inode)->generation)
731 /* the inode is shared */
732 new = record_old_file_extents(inode, ordered_extent);
733
734 diff --git a/fs/buffer.c b/fs/buffer.c
735 index 6024877335ca..aeeea6529bcd 100644
736 --- a/fs/buffer.c
737 +++ b/fs/buffer.c
738 @@ -654,14 +654,16 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode);
739 static void __set_page_dirty(struct page *page,
740 struct address_space *mapping, int warn)
741 {
742 - spin_lock_irq(&mapping->tree_lock);
743 + unsigned long flags;
744 +
745 + spin_lock_irqsave(&mapping->tree_lock, flags);
746 if (page->mapping) { /* Race with truncate? */
747 WARN_ON_ONCE(warn && !PageUptodate(page));
748 account_page_dirtied(page, mapping);
749 radix_tree_tag_set(&mapping->page_tree,
750 page_index(page), PAGECACHE_TAG_DIRTY);
751 }
752 - spin_unlock_irq(&mapping->tree_lock);
753 + spin_unlock_irqrestore(&mapping->tree_lock, flags);
754 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
755 }
756
757 diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
758 index 8a572ddde55b..55ebebec4d3b 100644
759 --- a/fs/nfs/nfs4client.c
760 +++ b/fs/nfs/nfs4client.c
761 @@ -169,7 +169,7 @@ void nfs41_shutdown_client(struct nfs_client *clp)
762 void nfs40_shutdown_client(struct nfs_client *clp)
763 {
764 if (clp->cl_slot_tbl) {
765 - nfs4_release_slot_table(clp->cl_slot_tbl);
766 + nfs4_shutdown_slot_table(clp->cl_slot_tbl);
767 kfree(clp->cl_slot_tbl);
768 }
769 }
770 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
771 index 29c5a2c08f02..d3d7766f55e3 100644
772 --- a/fs/nfs/nfs4proc.c
773 +++ b/fs/nfs/nfs4proc.c
774 @@ -1611,15 +1611,15 @@ static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata)
775 {
776 struct nfs4_opendata *data = calldata;
777
778 - nfs40_setup_sequence(data->o_arg.server, &data->o_arg.seq_args,
779 - &data->o_res.seq_res, task);
780 + nfs40_setup_sequence(data->o_arg.server, &data->c_arg.seq_args,
781 + &data->c_res.seq_res, task);
782 }
783
784 static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
785 {
786 struct nfs4_opendata *data = calldata;
787
788 - nfs40_sequence_done(task, &data->o_res.seq_res);
789 + nfs40_sequence_done(task, &data->c_res.seq_res);
790
791 data->rpc_status = task->tk_status;
792 if (data->rpc_status == 0) {
793 @@ -1677,7 +1677,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
794 };
795 int status;
796
797 - nfs4_init_sequence(&data->o_arg.seq_args, &data->o_res.seq_res, 1);
798 + nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1);
799 kref_get(&data->kref);
800 data->rpc_done = 0;
801 data->rpc_status = 0;
802 diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
803 index cf883c7ae053..e799dc3c3b1d 100644
804 --- a/fs/nfs/nfs4session.c
805 +++ b/fs/nfs/nfs4session.c
806 @@ -231,14 +231,23 @@ out:
807 return ret;
808 }
809
810 +/*
811 + * nfs4_release_slot_table - release all slot table entries
812 + */
813 +static void nfs4_release_slot_table(struct nfs4_slot_table *tbl)
814 +{
815 + nfs4_shrink_slot_table(tbl, 0);
816 +}
817 +
818 /**
819 - * nfs4_release_slot_table - release resources attached to a slot table
820 + * nfs4_shutdown_slot_table - release resources attached to a slot table
821 * @tbl: slot table to shut down
822 *
823 */
824 -void nfs4_release_slot_table(struct nfs4_slot_table *tbl)
825 +void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl)
826 {
827 - nfs4_shrink_slot_table(tbl, 0);
828 + nfs4_release_slot_table(tbl);
829 + rpc_destroy_wait_queue(&tbl->slot_tbl_waitq);
830 }
831
832 /**
833 @@ -422,7 +431,7 @@ void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
834 spin_unlock(&tbl->slot_tbl_lock);
835 }
836
837 -static void nfs4_destroy_session_slot_tables(struct nfs4_session *session)
838 +static void nfs4_release_session_slot_tables(struct nfs4_session *session)
839 {
840 nfs4_release_slot_table(&session->fc_slot_table);
841 nfs4_release_slot_table(&session->bc_slot_table);
842 @@ -450,7 +459,7 @@ int nfs4_setup_session_slot_tables(struct nfs4_session *ses)
843 if (status && tbl->slots == NULL)
844 /* Fore and back channel share a connection so get
845 * both slot tables or neither */
846 - nfs4_destroy_session_slot_tables(ses);
847 + nfs4_release_session_slot_tables(ses);
848 return status;
849 }
850
851 @@ -470,6 +479,12 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
852 return session;
853 }
854
855 +static void nfs4_destroy_session_slot_tables(struct nfs4_session *session)
856 +{
857 + nfs4_shutdown_slot_table(&session->fc_slot_table);
858 + nfs4_shutdown_slot_table(&session->bc_slot_table);
859 +}
860 +
861 void nfs4_destroy_session(struct nfs4_session *session)
862 {
863 struct rpc_xprt *xprt;
864 diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h
865 index 232306100651..b34ada9bc6a2 100644
866 --- a/fs/nfs/nfs4session.h
867 +++ b/fs/nfs/nfs4session.h
868 @@ -74,7 +74,7 @@ enum nfs4_session_state {
869
870 extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl,
871 unsigned int max_reqs, const char *queue);
872 -extern void nfs4_release_slot_table(struct nfs4_slot_table *tbl);
873 +extern void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl);
874 extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl);
875 extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot);
876 extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl);
877 diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
878 index 49f52c8f4422..ea9e076a91bf 100644
879 --- a/include/linux/nfs_xdr.h
880 +++ b/include/linux/nfs_xdr.h
881 @@ -379,12 +379,14 @@ struct nfs_openres {
882 * Arguments to the open_confirm call.
883 */
884 struct nfs_open_confirmargs {
885 + struct nfs4_sequence_args seq_args;
886 const struct nfs_fh * fh;
887 nfs4_stateid * stateid;
888 struct nfs_seqid * seqid;
889 };
890
891 struct nfs_open_confirmres {
892 + struct nfs4_sequence_res seq_res;
893 nfs4_stateid stateid;
894 struct nfs_seqid * seqid;
895 };
896 diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
897 index 4a1fef09f658..07cbdfea9ae2 100644
898 --- a/kernel/irq/Kconfig
899 +++ b/kernel/irq/Kconfig
900 @@ -40,6 +40,7 @@ config IRQ_EDGE_EOI_HANDLER
901 # Generic configurable interrupt chip implementation
902 config GENERIC_IRQ_CHIP
903 bool
904 + select IRQ_DOMAIN
905
906 # Generic irq_domain hw <--> linux irq number translation
907 config IRQ_DOMAIN
908 diff --git a/lib/Makefile b/lib/Makefile
909 index f3bb2cb98adf..6af6fbb053e3 100644
910 --- a/lib/Makefile
911 +++ b/lib/Makefile
912 @@ -47,6 +47,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
913 lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
914 lib-$(CONFIG_PERCPU_RWSEM) += percpu-rwsem.o
915
916 +GCOV_PROFILE_hweight.o := n
917 CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
918 obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
919
920 diff --git a/mm/page-writeback.c b/mm/page-writeback.c
921 index 2d30e2cfe804..7106cb1aca8e 100644
922 --- a/mm/page-writeback.c
923 +++ b/mm/page-writeback.c
924 @@ -2173,11 +2173,12 @@ int __set_page_dirty_nobuffers(struct page *page)
925 if (!TestSetPageDirty(page)) {
926 struct address_space *mapping = page_mapping(page);
927 struct address_space *mapping2;
928 + unsigned long flags;
929
930 if (!mapping)
931 return 1;
932
933 - spin_lock_irq(&mapping->tree_lock);
934 + spin_lock_irqsave(&mapping->tree_lock, flags);
935 mapping2 = page_mapping(page);
936 if (mapping2) { /* Race with truncate? */
937 BUG_ON(mapping2 != mapping);
938 @@ -2186,7 +2187,7 @@ int __set_page_dirty_nobuffers(struct page *page)
939 radix_tree_tag_set(&mapping->page_tree,
940 page_index(page), PAGECACHE_TAG_DIRTY);
941 }
942 - spin_unlock_irq(&mapping->tree_lock);
943 + spin_unlock_irqrestore(&mapping->tree_lock, flags);
944 if (mapping->host) {
945 /* !PageAnon && !swapper_space */
946 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
947 diff --git a/mm/swapfile.c b/mm/swapfile.c
948 index de7c904e52e5..0ec2eaf3ccfd 100644
949 --- a/mm/swapfile.c
950 +++ b/mm/swapfile.c
951 @@ -1922,7 +1922,6 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
952 p->swap_map = NULL;
953 cluster_info = p->cluster_info;
954 p->cluster_info = NULL;
955 - p->flags = 0;
956 frontswap_map = frontswap_map_get(p);
957 frontswap_map_set(p, NULL);
958 spin_unlock(&p->lock);
959 @@ -1948,6 +1947,16 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
960 mutex_unlock(&inode->i_mutex);
961 }
962 filp_close(swap_file, NULL);
963 +
964 + /*
965 + * Clear the SWP_USED flag after all resources are freed so that swapon
966 + * can reuse this swap_info in alloc_swap_info() safely. It is ok to
967 + * not hold p->lock after we cleared its SWP_WRITEOK.
968 + */
969 + spin_lock(&swap_lock);
970 + p->flags = 0;
971 + spin_unlock(&swap_lock);
972 +
973 err = 0;
974 atomic_inc(&proc_poll_event);
975 wake_up_interruptible(&proc_poll_wait);
976 diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
977 index b4feecc3fe01..18caa16de27b 100644
978 --- a/security/selinux/ss/services.c
979 +++ b/security/selinux/ss/services.c
980 @@ -1231,6 +1231,10 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
981 struct context context;
982 int rc = 0;
983
984 + /* An empty security context is never valid. */
985 + if (!scontext_len)
986 + return -EINVAL;
987 +
988 if (!ss_initialized) {
989 int i;
990
991 diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
992 index 31230c68b603..7fc15814c618 100644
993 --- a/sound/pci/hda/patch_analog.c
994 +++ b/sound/pci/hda/patch_analog.c
995 @@ -227,6 +227,19 @@ static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
996 }
997 }
998
999 +/* Toshiba Satellite L40 implements EAPD in a standard way unlike others */
1000 +static void ad1986a_fixup_eapd(struct hda_codec *codec,
1001 + const struct hda_fixup *fix, int action)
1002 +{
1003 + struct ad198x_spec *spec = codec->spec;
1004 +
1005 + if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1006 + codec->inv_eapd = 0;
1007 + spec->gen.keep_eapd_on = 1;
1008 + spec->eapd_nid = 0x1b;
1009 + }
1010 +}
1011 +
1012 enum {
1013 AD1986A_FIXUP_INV_JACK_DETECT,
1014 AD1986A_FIXUP_ULTRA,
1015 @@ -234,6 +247,7 @@ enum {
1016 AD1986A_FIXUP_3STACK,
1017 AD1986A_FIXUP_LAPTOP,
1018 AD1986A_FIXUP_LAPTOP_IMIC,
1019 + AD1986A_FIXUP_EAPD,
1020 };
1021
1022 static const struct hda_fixup ad1986a_fixups[] = {
1023 @@ -294,6 +308,10 @@ static const struct hda_fixup ad1986a_fixups[] = {
1024 .chained_before = 1,
1025 .chain_id = AD1986A_FIXUP_LAPTOP,
1026 },
1027 + [AD1986A_FIXUP_EAPD] = {
1028 + .type = HDA_FIXUP_FUNC,
1029 + .v.func = ad1986a_fixup_eapd,
1030 + },
1031 };
1032
1033 static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
1034 @@ -301,6 +319,7 @@ static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
1035 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
1036 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
1037 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
1038 + SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
1039 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
1040 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
1041 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
1042 @@ -455,6 +474,8 @@ static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
1043 static int patch_ad1983(struct hda_codec *codec)
1044 {
1045 struct ad198x_spec *spec;
1046 + static hda_nid_t conn_0c[] = { 0x08 };
1047 + static hda_nid_t conn_0d[] = { 0x09 };
1048 int err;
1049
1050 err = alloc_ad_spec(codec);
1051 @@ -462,8 +483,14 @@ static int patch_ad1983(struct hda_codec *codec)
1052 return err;
1053 spec = codec->spec;
1054
1055 + spec->gen.mixer_nid = 0x0e;
1056 spec->gen.beep_nid = 0x10;
1057 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
1058 +
1059 + /* limit the loopback routes not to confuse the parser */
1060 + snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c);
1061 + snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d);
1062 +
1063 err = ad198x_parse_auto_config(codec, false);
1064 if (err < 0)
1065 goto error;
1066 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1067 index 56b62555eef4..6195a4f8d9b8 100644
1068 --- a/sound/pci/hda/patch_realtek.c
1069 +++ b/sound/pci/hda/patch_realtek.c
1070 @@ -1771,6 +1771,7 @@ enum {
1071 ALC889_FIXUP_IMAC91_VREF,
1072 ALC889_FIXUP_MBA11_VREF,
1073 ALC889_FIXUP_MBA21_VREF,
1074 + ALC889_FIXUP_MP11_VREF,
1075 ALC882_FIXUP_INV_DMIC,
1076 ALC882_FIXUP_NO_PRIMARY_HP,
1077 ALC887_FIXUP_ASUS_BASS,
1078 @@ -2127,6 +2128,12 @@ static const struct hda_fixup alc882_fixups[] = {
1079 .chained = true,
1080 .chain_id = ALC889_FIXUP_MBP_VREF,
1081 },
1082 + [ALC889_FIXUP_MP11_VREF] = {
1083 + .type = HDA_FIXUP_FUNC,
1084 + .v.func = alc889_fixup_mba11_vref,
1085 + .chained = true,
1086 + .chain_id = ALC885_FIXUP_MACPRO_GPIO,
1087 + },
1088 [ALC882_FIXUP_INV_DMIC] = {
1089 .type = HDA_FIXUP_FUNC,
1090 .v.func = alc_fixup_inv_dmic_0x12,
1091 @@ -2184,7 +2191,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
1092 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
1093 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
1094 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
1095 - SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO),
1096 + SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
1097 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
1098 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1099 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
1100 diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig
1101 index de9408b83f75..e05a86b7c0da 100644
1102 --- a/sound/usb/Kconfig
1103 +++ b/sound/usb/Kconfig
1104 @@ -14,6 +14,7 @@ config SND_USB_AUDIO
1105 select SND_HWDEP
1106 select SND_RAWMIDI
1107 select SND_PCM
1108 + select BITREVERSE
1109 help
1110 Say Y here to include support for USB audio and USB MIDI
1111 devices.