Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2696 - genpatches-2.6/trunk/3.12
Date: Mon, 24 Feb 2014 23:42:43
Message-Id: 20140224234238.5A40E2004C@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2014-02-24 23:42:38 +0000 (Mon, 24 Feb 2014)
3 New Revision: 2696
4
5 Added:
6 genpatches-2.6/trunk/3.12/1012_linux-3.12.13.patch
7 Modified:
8 genpatches-2.6/trunk/3.12/0000_README
9 Log:
10 Linux patch 3.12.13
11
12 Modified: genpatches-2.6/trunk/3.12/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/3.12/0000_README 2014-02-24 23:03:11 UTC (rev 2695)
15 +++ genpatches-2.6/trunk/3.12/0000_README 2014-02-24 23:42:38 UTC (rev 2696)
16 @@ -86,10 +86,14 @@
17 From: http://www.kernel.org
18 Desc: Linux 3.12.11
19
20 -Patch: 1010_linux-3.12.12.patch
21 +Patch: 1011_linux-3.12.12.patch
22 From: http://www.kernel.org
23 Desc: Linux 3.12.12
24
25 +Patch: 1012_linux-3.12.13.patch
26 +From: http://www.kernel.org
27 +Desc: Linux 3.12.13
28 +
29 Patch: 1500_XATTR_USER_PREFIX.patch
30 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
31 Desc: Support for namespace user.pax.* on tmpfs.
32
33 Added: genpatches-2.6/trunk/3.12/1012_linux-3.12.13.patch
34 ===================================================================
35 --- genpatches-2.6/trunk/3.12/1012_linux-3.12.13.patch (rev 0)
36 +++ genpatches-2.6/trunk/3.12/1012_linux-3.12.13.patch 2014-02-24 23:42:38 UTC (rev 2696)
37 @@ -0,0 +1,2461 @@
38 +diff --git a/Makefile b/Makefile
39 +index 563297e159b7..0a89e7d84a2d 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 3
44 + PATCHLEVEL = 12
45 +-SUBLEVEL = 12
46 ++SUBLEVEL = 13
47 + EXTRAVERSION =
48 + NAME = One Giant Leap for Frogkind
49 +
50 +diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
51 +index b9e25ae2579c..d7c00507568a 100644
52 +--- a/arch/s390/kernel/head64.S
53 ++++ b/arch/s390/kernel/head64.S
54 +@@ -59,7 +59,7 @@ ENTRY(startup_continue)
55 + .quad 0 # cr12: tracing off
56 + .quad 0 # cr13: home space segment table
57 + .quad 0xc0000000 # cr14: machine check handling off
58 +- .quad 0 # cr15: linkage stack operations
59 ++ .quad .Llinkage_stack # cr15: linkage stack operations
60 + .Lpcmsk:.quad 0x0000000180000000
61 + .L4malign:.quad 0xffffffffffc00000
62 + .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
63 +@@ -67,12 +67,15 @@ ENTRY(startup_continue)
64 + .Lparmaddr:
65 + .quad PARMAREA
66 + .align 64
67 +-.Lduct: .long 0,0,0,0,.Lduald,0,0,0
68 ++.Lduct: .long 0,.Laste,.Laste,0,.Lduald,0,0,0
69 + .long 0,0,0,0,0,0,0,0
70 ++.Laste: .quad 0,0xffffffffffffffff,0,0,0,0,0,0
71 + .align 128
72 + .Lduald:.rept 8
73 + .long 0x80000000,0,0,0 # invalid access-list entries
74 + .endr
75 ++.Llinkage_stack:
76 ++ .long 0,0,0x89000000,0,0,0,0x8a000000,0
77 +
78 + ENTRY(_ehead)
79 +
80 +diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c
81 +index a90d45e9dfb0..27c50f4d90cb 100644
82 +--- a/arch/s390/mm/page-states.c
83 ++++ b/arch/s390/mm/page-states.c
84 +@@ -12,6 +12,8 @@
85 + #include <linux/mm.h>
86 + #include <linux/gfp.h>
87 + #include <linux/init.h>
88 ++#include <asm/setup.h>
89 ++#include <asm/ipl.h>
90 +
91 + #define ESSA_SET_STABLE 1
92 + #define ESSA_SET_UNUSED 2
93 +@@ -41,6 +43,14 @@ void __init cmma_init(void)
94 +
95 + if (!cmma_flag)
96 + return;
97 ++ /*
98 ++ * Disable CMM for dump, otherwise the tprot based memory
99 ++ * detection can fail because of unstable pages.
100 ++ */
101 ++ if (OLDMEM_BASE || ipl_info.type == IPL_TYPE_FCP_DUMP) {
102 ++ cmma_flag = 0;
103 ++ return;
104 ++ }
105 + asm volatile(
106 + " .insn rrf,0xb9ab0000,%1,%1,0,0\n"
107 + "0: la %0,0\n"
108 +diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
109 +index bbc8b12fa443..5ad38ad07890 100644
110 +--- a/arch/x86/include/asm/pgtable.h
111 ++++ b/arch/x86/include/asm/pgtable.h
112 +@@ -445,10 +445,20 @@ static inline int pte_same(pte_t a, pte_t b)
113 + return a.pte == b.pte;
114 + }
115 +
116 ++static inline int pteval_present(pteval_t pteval)
117 ++{
118 ++ /*
119 ++ * Yes Linus, _PAGE_PROTNONE == _PAGE_NUMA. Expressing it this
120 ++ * way clearly states that the intent is that protnone and numa
121 ++ * hinting ptes are considered present for the purposes of
122 ++ * pagetable operations like zapping, protection changes, gup etc.
123 ++ */
124 ++ return pteval & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_NUMA);
125 ++}
126 ++
127 + static inline int pte_present(pte_t a)
128 + {
129 +- return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE |
130 +- _PAGE_NUMA);
131 ++ return pteval_present(pte_flags(a));
132 + }
133 +
134 + #define pte_accessible pte_accessible
135 +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
136 +index 2793d1f095a2..3533e2c082a3 100644
137 +--- a/arch/x86/kernel/cpu/common.c
138 ++++ b/arch/x86/kernel/cpu/common.c
139 +@@ -284,8 +284,13 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c)
140 + raw_local_save_flags(eflags);
141 + BUG_ON(eflags & X86_EFLAGS_AC);
142 +
143 +- if (cpu_has(c, X86_FEATURE_SMAP))
144 ++ if (cpu_has(c, X86_FEATURE_SMAP)) {
145 ++#ifdef CONFIG_X86_SMAP
146 + set_in_cr4(X86_CR4_SMAP);
147 ++#else
148 ++ clear_in_cr4(X86_CR4_SMAP);
149 ++#endif
150 ++ }
151 + }
152 +
153 + /*
154 +diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
155 +index d4bdd253fea7..e6253195a301 100644
156 +--- a/arch/x86/kernel/ftrace.c
157 ++++ b/arch/x86/kernel/ftrace.c
158 +@@ -77,8 +77,7 @@ within(unsigned long addr, unsigned long start, unsigned long end)
159 + return addr >= start && addr < end;
160 + }
161 +
162 +-static int
163 +-do_ftrace_mod_code(unsigned long ip, const void *new_code)
164 ++static unsigned long text_ip_addr(unsigned long ip)
165 + {
166 + /*
167 + * On x86_64, kernel text mappings are mapped read-only with
168 +@@ -91,7 +90,7 @@ do_ftrace_mod_code(unsigned long ip, const void *new_code)
169 + if (within(ip, (unsigned long)_text, (unsigned long)_etext))
170 + ip = (unsigned long)__va(__pa_symbol(ip));
171 +
172 +- return probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE);
173 ++ return ip;
174 + }
175 +
176 + static const unsigned char *ftrace_nop_replace(void)
177 +@@ -123,8 +122,10 @@ ftrace_modify_code_direct(unsigned long ip, unsigned const char *old_code,
178 + if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
179 + return -EINVAL;
180 +
181 ++ ip = text_ip_addr(ip);
182 ++
183 + /* replace the text with the new text */
184 +- if (do_ftrace_mod_code(ip, new_code))
185 ++ if (probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE))
186 + return -EPERM;
187 +
188 + sync_core();
189 +@@ -221,37 +222,51 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
190 + return -EINVAL;
191 + }
192 +
193 +-int ftrace_update_ftrace_func(ftrace_func_t func)
194 ++static unsigned long ftrace_update_func;
195 ++
196 ++static int update_ftrace_func(unsigned long ip, void *new)
197 + {
198 +- unsigned long ip = (unsigned long)(&ftrace_call);
199 +- unsigned char old[MCOUNT_INSN_SIZE], *new;
200 ++ unsigned char old[MCOUNT_INSN_SIZE];
201 + int ret;
202 +
203 +- memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE);
204 +- new = ftrace_call_replace(ip, (unsigned long)func);
205 ++ memcpy(old, (void *)ip, MCOUNT_INSN_SIZE);
206 ++
207 ++ ftrace_update_func = ip;
208 ++ /* Make sure the breakpoints see the ftrace_update_func update */
209 ++ smp_wmb();
210 +
211 + /* See comment above by declaration of modifying_ftrace_code */
212 + atomic_inc(&modifying_ftrace_code);
213 +
214 + ret = ftrace_modify_code(ip, old, new);
215 +
216 ++ atomic_dec(&modifying_ftrace_code);
217 ++
218 ++ return ret;
219 ++}
220 ++
221 ++int ftrace_update_ftrace_func(ftrace_func_t func)
222 ++{
223 ++ unsigned long ip = (unsigned long)(&ftrace_call);
224 ++ unsigned char *new;
225 ++ int ret;
226 ++
227 ++ new = ftrace_call_replace(ip, (unsigned long)func);
228 ++ ret = update_ftrace_func(ip, new);
229 ++
230 + /* Also update the regs callback function */
231 + if (!ret) {
232 + ip = (unsigned long)(&ftrace_regs_call);
233 +- memcpy(old, &ftrace_regs_call, MCOUNT_INSN_SIZE);
234 + new = ftrace_call_replace(ip, (unsigned long)func);
235 +- ret = ftrace_modify_code(ip, old, new);
236 ++ ret = update_ftrace_func(ip, new);
237 + }
238 +
239 +- atomic_dec(&modifying_ftrace_code);
240 +-
241 + return ret;
242 + }
243 +
244 + static int is_ftrace_caller(unsigned long ip)
245 + {
246 +- if (ip == (unsigned long)(&ftrace_call) ||
247 +- ip == (unsigned long)(&ftrace_regs_call))
248 ++ if (ip == ftrace_update_func)
249 + return 1;
250 +
251 + return 0;
252 +@@ -677,45 +692,41 @@ int __init ftrace_dyn_arch_init(void *data)
253 + #ifdef CONFIG_DYNAMIC_FTRACE
254 + extern void ftrace_graph_call(void);
255 +
256 +-static int ftrace_mod_jmp(unsigned long ip,
257 +- int old_offset, int new_offset)
258 ++static unsigned char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
259 + {
260 +- unsigned char code[MCOUNT_INSN_SIZE];
261 ++ static union ftrace_code_union calc;
262 +
263 +- if (probe_kernel_read(code, (void *)ip, MCOUNT_INSN_SIZE))
264 +- return -EFAULT;
265 ++ /* Jmp not a call (ignore the .e8) */
266 ++ calc.e8 = 0xe9;
267 ++ calc.offset = ftrace_calc_offset(ip + MCOUNT_INSN_SIZE, addr);
268 +
269 +- if (code[0] != 0xe9 || old_offset != *(int *)(&code[1]))
270 +- return -EINVAL;
271 ++ /*
272 ++ * ftrace external locks synchronize the access to the static variable.
273 ++ */
274 ++ return calc.code;
275 ++}
276 +
277 +- *(int *)(&code[1]) = new_offset;
278 ++static int ftrace_mod_jmp(unsigned long ip, void *func)
279 ++{
280 ++ unsigned char *new;
281 +
282 +- if (do_ftrace_mod_code(ip, &code))
283 +- return -EPERM;
284 ++ new = ftrace_jmp_replace(ip, (unsigned long)func);
285 +
286 +- return 0;
287 ++ return update_ftrace_func(ip, new);
288 + }
289 +
290 + int ftrace_enable_ftrace_graph_caller(void)
291 + {
292 + unsigned long ip = (unsigned long)(&ftrace_graph_call);
293 +- int old_offset, new_offset;
294 +
295 +- old_offset = (unsigned long)(&ftrace_stub) - (ip + MCOUNT_INSN_SIZE);
296 +- new_offset = (unsigned long)(&ftrace_graph_caller) - (ip + MCOUNT_INSN_SIZE);
297 +-
298 +- return ftrace_mod_jmp(ip, old_offset, new_offset);
299 ++ return ftrace_mod_jmp(ip, &ftrace_graph_caller);
300 + }
301 +
302 + int ftrace_disable_ftrace_graph_caller(void)
303 + {
304 + unsigned long ip = (unsigned long)(&ftrace_graph_call);
305 +- int old_offset, new_offset;
306 +-
307 +- old_offset = (unsigned long)(&ftrace_graph_caller) - (ip + MCOUNT_INSN_SIZE);
308 +- new_offset = (unsigned long)(&ftrace_stub) - (ip + MCOUNT_INSN_SIZE);
309 +
310 +- return ftrace_mod_jmp(ip, old_offset, new_offset);
311 ++ return ftrace_mod_jmp(ip, &ftrace_stub);
312 + }
313 +
314 + #endif /* !CONFIG_DYNAMIC_FTRACE */
315 +diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
316 +index 3aaeffcfd67a..d8b1ff68dbb9 100644
317 +--- a/arch/x86/mm/fault.c
318 ++++ b/arch/x86/mm/fault.c
319 +@@ -980,6 +980,12 @@ static int fault_in_kernel_space(unsigned long address)
320 +
321 + static inline bool smap_violation(int error_code, struct pt_regs *regs)
322 + {
323 ++ if (!IS_ENABLED(CONFIG_X86_SMAP))
324 ++ return false;
325 ++
326 ++ if (!static_cpu_has(X86_FEATURE_SMAP))
327 ++ return false;
328 ++
329 + if (error_code & PF_USER)
330 + return false;
331 +
332 +@@ -1081,11 +1087,9 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
333 + if (unlikely(error_code & PF_RSVD))
334 + pgtable_bad(regs, error_code, address);
335 +
336 +- if (static_cpu_has(X86_FEATURE_SMAP)) {
337 +- if (unlikely(smap_violation(error_code, regs))) {
338 +- bad_area_nosemaphore(regs, error_code, address);
339 +- return;
340 +- }
341 ++ if (unlikely(smap_violation(error_code, regs))) {
342 ++ bad_area_nosemaphore(regs, error_code, address);
343 ++ return;
344 + }
345 +
346 + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
347 +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
348 +index fdc3ba28ca38..d5af43af64dc 100644
349 +--- a/arch/x86/xen/mmu.c
350 ++++ b/arch/x86/xen/mmu.c
351 +@@ -365,7 +365,7 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
352 + /* Assume pteval_t is equivalent to all the other *val_t types. */
353 + static pteval_t pte_mfn_to_pfn(pteval_t val)
354 + {
355 +- if (val & _PAGE_PRESENT) {
356 ++ if (pteval_present(val)) {
357 + unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
358 + unsigned long pfn = mfn_to_pfn(mfn);
359 +
360 +@@ -381,7 +381,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
361 +
362 + static pteval_t pte_pfn_to_mfn(pteval_t val)
363 + {
364 +- if (val & _PAGE_PRESENT) {
365 ++ if (pteval_present(val)) {
366 + unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
367 + pteval_t flags = val & PTE_FLAGS_MASK;
368 + unsigned long mfn;
369 +diff --git a/block/blk-lib.c b/block/blk-lib.c
370 +index d6f50d572565..9a32f5868fb9 100644
371 +--- a/block/blk-lib.c
372 ++++ b/block/blk-lib.c
373 +@@ -121,6 +121,14 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
374 +
375 + atomic_inc(&bb.done);
376 + submit_bio(type, bio);
377 ++
378 ++ /*
379 ++ * We can loop for a long time in here, if someone does
380 ++ * full device discards (like mkfs). Be nice and allow
381 ++ * us to schedule out to avoid softlocking if preempt
382 ++ * is disabled.
383 ++ */
384 ++ cond_resched();
385 + }
386 + blk_finish_plug(&plug);
387 +
388 +diff --git a/block/blk.h b/block/blk.h
389 +index e837b8f619b7..b3bdeb36f361 100644
390 +--- a/block/blk.h
391 ++++ b/block/blk.h
392 +@@ -96,7 +96,7 @@ static inline struct request *__elv_next_request(struct request_queue *q)
393 + q->flush_queue_delayed = 1;
394 + return NULL;
395 + }
396 +- if (unlikely(blk_queue_dying(q)) ||
397 ++ if (unlikely(blk_queue_bypass(q)) ||
398 + !q->elevator->type->ops.elevator_dispatch_fn(q, 0))
399 + return NULL;
400 + }
401 +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
402 +index ed88b3c2e8ea..e85bc358e052 100644
403 +--- a/drivers/block/xen-blkfront.c
404 ++++ b/drivers/block/xen-blkfront.c
405 +@@ -1852,13 +1852,16 @@ static void blkback_changed(struct xenbus_device *dev,
406 + case XenbusStateReconfiguring:
407 + case XenbusStateReconfigured:
408 + case XenbusStateUnknown:
409 +- case XenbusStateClosed:
410 + break;
411 +
412 + case XenbusStateConnected:
413 + blkfront_connect(info);
414 + break;
415 +
416 ++ case XenbusStateClosed:
417 ++ if (dev->state == XenbusStateClosed)
418 ++ break;
419 ++ /* Missed the backend's Closing state -- fallthrough */
420 + case XenbusStateClosing:
421 + blkfront_closing(info);
422 + break;
423 +diff --git a/drivers/char/raw.c b/drivers/char/raw.c
424 +index f3223aac4df1..6e8d65e9b1d3 100644
425 +--- a/drivers/char/raw.c
426 ++++ b/drivers/char/raw.c
427 +@@ -190,7 +190,7 @@ static int bind_get(int number, dev_t *dev)
428 + struct raw_device_data *rawdev;
429 + struct block_device *bdev;
430 +
431 +- if (number <= 0 || number >= MAX_RAW_MINORS)
432 ++ if (number <= 0 || number >= max_raw_minors)
433 + return -EINVAL;
434 +
435 + rawdev = &raw_devices[number];
436 +diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
437 +index 89e109022d78..a9d98cdd11f4 100644
438 +--- a/drivers/edac/edac_mc.c
439 ++++ b/drivers/edac/edac_mc.c
440 +@@ -559,7 +559,8 @@ static void edac_mc_workq_function(struct work_struct *work_req)
441 + *
442 + * called with the mem_ctls_mutex held
443 + */
444 +-static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
445 ++static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec,
446 ++ bool init)
447 + {
448 + edac_dbg(0, "\n");
449 +
450 +@@ -567,7 +568,9 @@ static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
451 + if (mci->op_state != OP_RUNNING_POLL)
452 + return;
453 +
454 +- INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
455 ++ if (init)
456 ++ INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
457 ++
458 + mod_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec));
459 + }
460 +
461 +@@ -601,7 +604,7 @@ static void edac_mc_workq_teardown(struct mem_ctl_info *mci)
462 + * user space has updated our poll period value, need to
463 + * reset our workq delays
464 + */
465 +-void edac_mc_reset_delay_period(int value)
466 ++void edac_mc_reset_delay_period(unsigned long value)
467 + {
468 + struct mem_ctl_info *mci;
469 + struct list_head *item;
470 +@@ -611,7 +614,7 @@ void edac_mc_reset_delay_period(int value)
471 + list_for_each(item, &mc_devices) {
472 + mci = list_entry(item, struct mem_ctl_info, link);
473 +
474 +- edac_mc_workq_setup(mci, (unsigned long) value);
475 ++ edac_mc_workq_setup(mci, value, false);
476 + }
477 +
478 + mutex_unlock(&mem_ctls_mutex);
479 +@@ -782,7 +785,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
480 + /* This instance is NOW RUNNING */
481 + mci->op_state = OP_RUNNING_POLL;
482 +
483 +- edac_mc_workq_setup(mci, edac_mc_get_poll_msec());
484 ++ edac_mc_workq_setup(mci, edac_mc_get_poll_msec(), true);
485 + } else {
486 + mci->op_state = OP_RUNNING_INTERRUPT;
487 + }
488 +diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
489 +index 9f7e0e609516..e5bdf216effe 100644
490 +--- a/drivers/edac/edac_mc_sysfs.c
491 ++++ b/drivers/edac/edac_mc_sysfs.c
492 +@@ -52,18 +52,20 @@ int edac_mc_get_poll_msec(void)
493 +
494 + static int edac_set_poll_msec(const char *val, struct kernel_param *kp)
495 + {
496 +- long l;
497 ++ unsigned long l;
498 + int ret;
499 +
500 + if (!val)
501 + return -EINVAL;
502 +
503 +- ret = kstrtol(val, 0, &l);
504 ++ ret = kstrtoul(val, 0, &l);
505 + if (ret)
506 + return ret;
507 +- if ((int)l != l)
508 ++
509 ++ if (l < 1000)
510 + return -EINVAL;
511 +- *((int *)kp->arg) = l;
512 ++
513 ++ *((unsigned long *)kp->arg) = l;
514 +
515 + /* notify edac_mc engine to reset the poll period */
516 + edac_mc_reset_delay_period(l);
517 +diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
518 +index 3d139c6e7fe3..f2118bfcf8df 100644
519 +--- a/drivers/edac/edac_module.h
520 ++++ b/drivers/edac/edac_module.h
521 +@@ -52,7 +52,7 @@ extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
522 + extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev);
523 + extern void edac_device_reset_delay_period(struct edac_device_ctl_info
524 + *edac_dev, unsigned long value);
525 +-extern void edac_mc_reset_delay_period(int value);
526 ++extern void edac_mc_reset_delay_period(unsigned long value);
527 +
528 + extern void *edac_align_ptr(void **p, unsigned size, int n_elems);
529 +
530 +diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
531 +index 354e3e32b30e..eb7af5b430aa 100644
532 +--- a/drivers/gpu/drm/i915/i915_gpu_error.c
533 ++++ b/drivers/gpu/drm/i915/i915_gpu_error.c
534 +@@ -146,7 +146,10 @@ static void i915_error_vprintf(struct drm_i915_error_state_buf *e,
535 + va_list tmp;
536 +
537 + va_copy(tmp, args);
538 +- if (!__i915_error_seek(e, vsnprintf(NULL, 0, f, tmp)))
539 ++ len = vsnprintf(NULL, 0, f, tmp);
540 ++ va_end(tmp);
541 ++
542 ++ if (!__i915_error_seek(e, len))
543 + return;
544 + }
545 +
546 +diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
547 +index 2acbf89cdfd3..67da7e285cde 100644
548 +--- a/drivers/gpu/drm/radeon/r600.c
549 ++++ b/drivers/gpu/drm/radeon/r600.c
550 +@@ -3854,6 +3854,10 @@ restart_ih:
551 + break;
552 + }
553 + break;
554 ++ case 124: /* UVD */
555 ++ DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data);
556 ++ radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX);
557 ++ break;
558 + case 176: /* CP_INT in ring buffer */
559 + case 177: /* CP_INT in IB1 */
560 + case 178: /* CP_INT in IB2 */
561 +diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
562 +index 3f39f15d48a6..8277ee01a7b4 100644
563 +--- a/drivers/gpu/drm/radeon/si.c
564 ++++ b/drivers/gpu/drm/radeon/si.c
565 +@@ -6281,6 +6281,10 @@ restart_ih:
566 + break;
567 + }
568 + break;
569 ++ case 124: /* UVD */
570 ++ DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data);
571 ++ radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX);
572 ++ break;
573 + case 146:
574 + case 147:
575 + addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR);
576 +diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
577 +index 936093e0271e..13c23a4789de 100644
578 +--- a/drivers/hv/connection.c
579 ++++ b/drivers/hv/connection.c
580 +@@ -67,7 +67,6 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
581 + int ret = 0;
582 + struct vmbus_channel_initiate_contact *msg;
583 + unsigned long flags;
584 +- int t;
585 +
586 + init_completion(&msginfo->waitevent);
587 +
588 +@@ -102,15 +101,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
589 + }
590 +
591 + /* Wait for the connection response */
592 +- t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ);
593 +- if (t == 0) {
594 +- spin_lock_irqsave(&vmbus_connection.channelmsg_lock,
595 +- flags);
596 +- list_del(&msginfo->msglistentry);
597 +- spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock,
598 +- flags);
599 +- return -ETIMEDOUT;
600 +- }
601 ++ wait_for_completion(&msginfo->waitevent);
602 +
603 + spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
604 + list_del(&msginfo->msglistentry);
605 +diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
606 +index 8c23203915af..8a17f01e8672 100644
607 +--- a/drivers/hwmon/ntc_thermistor.c
608 ++++ b/drivers/hwmon/ntc_thermistor.c
609 +@@ -145,7 +145,7 @@ struct ntc_data {
610 + static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
611 + {
612 + struct iio_channel *channel = pdata->chan;
613 +- unsigned int result;
614 ++ s64 result;
615 + int val, ret;
616 +
617 + ret = iio_read_channel_raw(channel, &val);
618 +@@ -155,10 +155,10 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
619 + }
620 +
621 + /* unit: mV */
622 +- result = pdata->pullup_uv * val;
623 ++ result = pdata->pullup_uv * (s64) val;
624 + result >>= 12;
625 +
626 +- return result;
627 ++ return (int)result;
628 + }
629 +
630 + static const struct of_device_id ntc_match[] = {
631 +diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
632 +index 6f02eb883e5e..564c1c076ea2 100644
633 +--- a/drivers/i2c/busses/i2c-mv64xxx.c
634 ++++ b/drivers/i2c/busses/i2c-mv64xxx.c
635 +@@ -97,7 +97,6 @@ enum {
636 + enum {
637 + MV64XXX_I2C_ACTION_INVALID,
638 + MV64XXX_I2C_ACTION_CONTINUE,
639 +- MV64XXX_I2C_ACTION_OFFLOAD_SEND_START,
640 + MV64XXX_I2C_ACTION_SEND_START,
641 + MV64XXX_I2C_ACTION_SEND_RESTART,
642 + MV64XXX_I2C_ACTION_OFFLOAD_RESTART,
643 +@@ -204,6 +203,9 @@ static int mv64xxx_i2c_offload_msg(struct mv64xxx_i2c_data *drv_data)
644 + unsigned long ctrl_reg;
645 + struct i2c_msg *msg = drv_data->msgs;
646 +
647 ++ if (!drv_data->offload_enabled)
648 ++ return -EOPNOTSUPP;
649 ++
650 + drv_data->msg = msg;
651 + drv_data->byte_posn = 0;
652 + drv_data->bytes_left = msg->len;
653 +@@ -433,8 +435,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
654 +
655 + drv_data->msgs++;
656 + drv_data->num_msgs--;
657 +- if (!(drv_data->offload_enabled &&
658 +- mv64xxx_i2c_offload_msg(drv_data))) {
659 ++ if (mv64xxx_i2c_offload_msg(drv_data) < 0) {
660 + drv_data->cntl_bits |= MV64XXX_I2C_REG_CONTROL_START;
661 + writel(drv_data->cntl_bits,
662 + drv_data->reg_base + drv_data->reg_offsets.control);
663 +@@ -458,15 +459,14 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
664 + drv_data->reg_base + drv_data->reg_offsets.control);
665 + break;
666 +
667 +- case MV64XXX_I2C_ACTION_OFFLOAD_SEND_START:
668 +- if (!mv64xxx_i2c_offload_msg(drv_data))
669 +- break;
670 +- else
671 +- drv_data->action = MV64XXX_I2C_ACTION_SEND_START;
672 +- /* FALLTHRU */
673 + case MV64XXX_I2C_ACTION_SEND_START:
674 +- writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_START,
675 +- drv_data->reg_base + drv_data->reg_offsets.control);
676 ++ /* Can we offload this msg ? */
677 ++ if (mv64xxx_i2c_offload_msg(drv_data) < 0) {
678 ++ /* No, switch to standard path */
679 ++ mv64xxx_i2c_prepare_for_io(drv_data, drv_data->msgs);
680 ++ writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_START,
681 ++ drv_data->reg_base + drv_data->reg_offsets.control);
682 ++ }
683 + break;
684 +
685 + case MV64XXX_I2C_ACTION_SEND_ADDR_1:
686 +@@ -625,15 +625,10 @@ mv64xxx_i2c_execute_msg(struct mv64xxx_i2c_data *drv_data, struct i2c_msg *msg,
687 + unsigned long flags;
688 +
689 + spin_lock_irqsave(&drv_data->lock, flags);
690 +- if (drv_data->offload_enabled) {
691 +- drv_data->action = MV64XXX_I2C_ACTION_OFFLOAD_SEND_START;
692 +- drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_START_COND;
693 +- } else {
694 +- mv64xxx_i2c_prepare_for_io(drv_data, msg);
695 +
696 +- drv_data->action = MV64XXX_I2C_ACTION_SEND_START;
697 +- drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_START_COND;
698 +- }
699 ++ drv_data->action = MV64XXX_I2C_ACTION_SEND_START;
700 ++ drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_START_COND;
701 ++
702 + drv_data->send_stop = is_last;
703 + drv_data->block = 1;
704 + mv64xxx_i2c_do_action(drv_data);
705 +diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
706 +index 4fb35d1d7494..cfb3d39b6664 100644
707 +--- a/drivers/iio/adc/max1363.c
708 ++++ b/drivers/iio/adc/max1363.c
709 +@@ -1527,7 +1527,7 @@ static int max1363_probe(struct i2c_client *client,
710 + st->client = client;
711 +
712 + st->vref_uv = st->chip_info->int_vref_mv * 1000;
713 +- vref = devm_regulator_get(&client->dev, "vref");
714 ++ vref = devm_regulator_get_optional(&client->dev, "vref");
715 + if (!IS_ERR(vref)) {
716 + int vref_uv;
717 +
718 +diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h
719 +index 2f8f9d632386..0916bf6b6c31 100644
720 +--- a/drivers/iio/imu/adis16400.h
721 ++++ b/drivers/iio/imu/adis16400.h
722 +@@ -189,6 +189,7 @@ enum {
723 + ADIS16300_SCAN_INCLI_X,
724 + ADIS16300_SCAN_INCLI_Y,
725 + ADIS16400_SCAN_ADC,
726 ++ ADIS16400_SCAN_TIMESTAMP,
727 + };
728 +
729 + #ifdef CONFIG_IIO_BUFFER
730 +diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
731 +index 368660dfe135..7c582f7ae34e 100644
732 +--- a/drivers/iio/imu/adis16400_core.c
733 ++++ b/drivers/iio/imu/adis16400_core.c
734 +@@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = {
735 + ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
736 + ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
737 + ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
738 +- IIO_CHAN_SOFT_TIMESTAMP(12)
739 ++ IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
740 + };
741 +
742 + static const struct iio_chan_spec adis16448_channels[] = {
743 +@@ -659,7 +659,7 @@ static const struct iio_chan_spec adis16448_channels[] = {
744 + },
745 + },
746 + ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
747 +- IIO_CHAN_SOFT_TIMESTAMP(11)
748 ++ IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
749 + };
750 +
751 + static const struct iio_chan_spec adis16350_channels[] = {
752 +@@ -677,7 +677,7 @@ static const struct iio_chan_spec adis16350_channels[] = {
753 + ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
754 + ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
755 + ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
756 +- IIO_CHAN_SOFT_TIMESTAMP(11)
757 ++ IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
758 + };
759 +
760 + static const struct iio_chan_spec adis16300_channels[] = {
761 +@@ -690,7 +690,7 @@ static const struct iio_chan_spec adis16300_channels[] = {
762 + ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
763 + ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
764 + ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
765 +- IIO_CHAN_SOFT_TIMESTAMP(14)
766 ++ IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
767 + };
768 +
769 + static const struct iio_chan_spec adis16334_channels[] = {
770 +@@ -701,7 +701,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
771 + ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
772 + ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
773 + ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
774 +- IIO_CHAN_SOFT_TIMESTAMP(8)
775 ++ IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
776 + };
777 +
778 + static struct attribute *adis16400_attributes[] = {
779 +diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
780 +index 7105f22d6cd7..9edf4c935fd7 100644
781 +--- a/drivers/iio/magnetometer/ak8975.c
782 ++++ b/drivers/iio/magnetometer/ak8975.c
783 +@@ -85,6 +85,7 @@
784 + #define AK8975_MAX_CONVERSION_TIMEOUT 500
785 + #define AK8975_CONVERSION_DONE_POLL_TIME 10
786 + #define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000)
787 ++#define RAW_TO_GAUSS(asa) ((((asa) + 128) * 3000) / 256)
788 +
789 + /*
790 + * Per-instance context data for the device.
791 +@@ -265,15 +266,15 @@ static int ak8975_setup(struct i2c_client *client)
792 + *
793 + * Since 1uT = 100 gauss, our final scale factor becomes:
794 + *
795 +- * Hadj = H * ((ASA + 128) / 256) * 3/10 * 100
796 +- * Hadj = H * ((ASA + 128) * 30 / 256
797 ++ * Hadj = H * ((ASA + 128) / 256) * 3/10 * 1/100
798 ++ * Hadj = H * ((ASA + 128) * 0.003) / 256
799 + *
800 + * Since ASA doesn't change, we cache the resultant scale factor into the
801 + * device context in ak8975_setup().
802 + */
803 +- data->raw_to_gauss[0] = ((data->asa[0] + 128) * 30) >> 8;
804 +- data->raw_to_gauss[1] = ((data->asa[1] + 128) * 30) >> 8;
805 +- data->raw_to_gauss[2] = ((data->asa[2] + 128) * 30) >> 8;
806 ++ data->raw_to_gauss[0] = RAW_TO_GAUSS(data->asa[0]);
807 ++ data->raw_to_gauss[1] = RAW_TO_GAUSS(data->asa[1]);
808 ++ data->raw_to_gauss[2] = RAW_TO_GAUSS(data->asa[2]);
809 +
810 + return 0;
811 + }
812 +@@ -428,8 +429,9 @@ static int ak8975_read_raw(struct iio_dev *indio_dev,
813 + case IIO_CHAN_INFO_RAW:
814 + return ak8975_read_axis(indio_dev, chan->address, val);
815 + case IIO_CHAN_INFO_SCALE:
816 +- *val = data->raw_to_gauss[chan->address];
817 +- return IIO_VAL_INT;
818 ++ *val = 0;
819 ++ *val2 = data->raw_to_gauss[chan->address];
820 ++ return IIO_VAL_INT_PLUS_MICRO;
821 + }
822 + return -EINVAL;
823 + }
824 +diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
825 +index 5bfc02f450e6..d1bd21319d7d 100644
826 +--- a/drivers/infiniband/hw/qib/qib_iba7322.c
827 ++++ b/drivers/infiniband/hw/qib/qib_iba7322.c
828 +@@ -2395,6 +2395,11 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd)
829 + qib_write_kreg_port(ppd, krp_ibcctrl_a, ppd->cpspec->ibcctrl_a);
830 + qib_write_kreg(dd, kr_scratch, 0ULL);
831 +
832 ++ /* ensure previous Tx parameters are not still forced */
833 ++ qib_write_kreg_port(ppd, krp_tx_deemph_override,
834 ++ SYM_MASK(IBSD_TX_DEEMPHASIS_OVERRIDE_0,
835 ++ reset_tx_deemphasis_override));
836 ++
837 + if (qib_compat_ddr_negotiate) {
838 + ppd->cpspec->ibdeltainprog = 1;
839 + ppd->cpspec->ibsymsnap = read_7322_creg32_port(ppd,
840 +diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
841 +index aacf6bf352d8..6edc2db428e9 100644
842 +--- a/drivers/md/raid1.c
843 ++++ b/drivers/md/raid1.c
844 +@@ -1855,11 +1855,15 @@ static int process_checks(struct r1bio *r1_bio)
845 + for (i = 0; i < conf->raid_disks * 2; i++) {
846 + int j;
847 + int size;
848 ++ int uptodate;
849 + struct bio *b = r1_bio->bios[i];
850 + if (b->bi_end_io != end_sync_read)
851 + continue;
852 +- /* fixup the bio for reuse */
853 ++ /* fixup the bio for reuse, but preserve BIO_UPTODATE */
854 ++ uptodate = test_bit(BIO_UPTODATE, &b->bi_flags);
855 + bio_reset(b);
856 ++ if (!uptodate)
857 ++ clear_bit(BIO_UPTODATE, &b->bi_flags);
858 + b->bi_vcnt = vcnt;
859 + b->bi_size = r1_bio->sectors << 9;
860 + b->bi_sector = r1_bio->sector +
861 +@@ -1892,11 +1896,14 @@ static int process_checks(struct r1bio *r1_bio)
862 + int j;
863 + struct bio *pbio = r1_bio->bios[primary];
864 + struct bio *sbio = r1_bio->bios[i];
865 ++ int uptodate = test_bit(BIO_UPTODATE, &sbio->bi_flags);
866 +
867 + if (sbio->bi_end_io != end_sync_read)
868 + continue;
869 ++ /* Now we can 'fixup' the BIO_UPTODATE flag */
870 ++ set_bit(BIO_UPTODATE, &sbio->bi_flags);
871 +
872 +- if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
873 ++ if (uptodate) {
874 + for (j = vcnt; j-- ; ) {
875 + struct page *p, *s;
876 + p = pbio->bi_io_vec[j].bv_page;
877 +@@ -1911,7 +1918,7 @@ static int process_checks(struct r1bio *r1_bio)
878 + if (j >= 0)
879 + atomic64_add(r1_bio->sectors, &mddev->resync_mismatches);
880 + if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
881 +- && test_bit(BIO_UPTODATE, &sbio->bi_flags))) {
882 ++ && uptodate)) {
883 + /* No need to write to this device. */
884 + sbio->bi_end_io = NULL;
885 + rdev_dec_pending(conf->mirrors[i].rdev, mddev);
886 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
887 +index 10e9e46108fd..3ecfb063ec0b 100644
888 +--- a/drivers/md/raid5.c
889 ++++ b/drivers/md/raid5.c
890 +@@ -5351,23 +5351,43 @@ raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks)
891 + return sectors * (raid_disks - conf->max_degraded);
892 + }
893 +
894 ++static void free_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu)
895 ++{
896 ++ safe_put_page(percpu->spare_page);
897 ++ kfree(percpu->scribble);
898 ++ percpu->spare_page = NULL;
899 ++ percpu->scribble = NULL;
900 ++}
901 ++
902 ++static int alloc_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu)
903 ++{
904 ++ if (conf->level == 6 && !percpu->spare_page)
905 ++ percpu->spare_page = alloc_page(GFP_KERNEL);
906 ++ if (!percpu->scribble)
907 ++ percpu->scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
908 ++
909 ++ if (!percpu->scribble || (conf->level == 6 && !percpu->spare_page)) {
910 ++ free_scratch_buffer(conf, percpu);
911 ++ return -ENOMEM;
912 ++ }
913 ++
914 ++ return 0;
915 ++}
916 ++
917 + static void raid5_free_percpu(struct r5conf *conf)
918 + {
919 +- struct raid5_percpu *percpu;
920 + unsigned long cpu;
921 +
922 + if (!conf->percpu)
923 + return;
924 +
925 +- get_online_cpus();
926 +- for_each_possible_cpu(cpu) {
927 +- percpu = per_cpu_ptr(conf->percpu, cpu);
928 +- safe_put_page(percpu->spare_page);
929 +- kfree(percpu->scribble);
930 +- }
931 + #ifdef CONFIG_HOTPLUG_CPU
932 + unregister_cpu_notifier(&conf->cpu_notify);
933 + #endif
934 ++
935 ++ get_online_cpus();
936 ++ for_each_possible_cpu(cpu)
937 ++ free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
938 + put_online_cpus();
939 +
940 + free_percpu(conf->percpu);
941 +@@ -5394,15 +5414,7 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
942 + switch (action) {
943 + case CPU_UP_PREPARE:
944 + case CPU_UP_PREPARE_FROZEN:
945 +- if (conf->level == 6 && !percpu->spare_page)
946 +- percpu->spare_page = alloc_page(GFP_KERNEL);
947 +- if (!percpu->scribble)
948 +- percpu->scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
949 +-
950 +- if (!percpu->scribble ||
951 +- (conf->level == 6 && !percpu->spare_page)) {
952 +- safe_put_page(percpu->spare_page);
953 +- kfree(percpu->scribble);
954 ++ if (alloc_scratch_buffer(conf, percpu)) {
955 + pr_err("%s: failed memory allocation for cpu%ld\n",
956 + __func__, cpu);
957 + return notifier_from_errno(-ENOMEM);
958 +@@ -5410,10 +5422,7 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
959 + break;
960 + case CPU_DEAD:
961 + case CPU_DEAD_FROZEN:
962 +- safe_put_page(percpu->spare_page);
963 +- kfree(percpu->scribble);
964 +- percpu->spare_page = NULL;
965 +- percpu->scribble = NULL;
966 ++ free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
967 + break;
968 + default:
969 + break;
970 +@@ -5425,40 +5434,29 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
971 + static int raid5_alloc_percpu(struct r5conf *conf)
972 + {
973 + unsigned long cpu;
974 +- struct page *spare_page;
975 +- struct raid5_percpu __percpu *allcpus;
976 +- void *scribble;
977 +- int err;
978 ++ int err = 0;
979 +
980 +- allcpus = alloc_percpu(struct raid5_percpu);
981 +- if (!allcpus)
982 ++ conf->percpu = alloc_percpu(struct raid5_percpu);
983 ++ if (!conf->percpu)
984 + return -ENOMEM;
985 +- conf->percpu = allcpus;
986 ++
987 ++#ifdef CONFIG_HOTPLUG_CPU
988 ++ conf->cpu_notify.notifier_call = raid456_cpu_notify;
989 ++ conf->cpu_notify.priority = 0;
990 ++ err = register_cpu_notifier(&conf->cpu_notify);
991 ++ if (err)
992 ++ return err;
993 ++#endif
994 +
995 + get_online_cpus();
996 +- err = 0;
997 + for_each_present_cpu(cpu) {
998 +- if (conf->level == 6) {
999 +- spare_page = alloc_page(GFP_KERNEL);
1000 +- if (!spare_page) {
1001 +- err = -ENOMEM;
1002 +- break;
1003 +- }
1004 +- per_cpu_ptr(conf->percpu, cpu)->spare_page = spare_page;
1005 +- }
1006 +- scribble = kmalloc(conf->scribble_len, GFP_KERNEL);
1007 +- if (!scribble) {
1008 +- err = -ENOMEM;
1009 ++ err = alloc_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
1010 ++ if (err) {
1011 ++ pr_err("%s: failed memory allocation for cpu%ld\n",
1012 ++ __func__, cpu);
1013 + break;
1014 + }
1015 +- per_cpu_ptr(conf->percpu, cpu)->scribble = scribble;
1016 + }
1017 +-#ifdef CONFIG_HOTPLUG_CPU
1018 +- conf->cpu_notify.notifier_call = raid456_cpu_notify;
1019 +- conf->cpu_notify.priority = 0;
1020 +- if (err == 0)
1021 +- err = register_cpu_notifier(&conf->cpu_notify);
1022 +-#endif
1023 + put_online_cpus();
1024 +
1025 + return err;
1026 +diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
1027 +index e0684b4d9a08..8c33f943abbf 100644
1028 +--- a/drivers/misc/mei/client.c
1029 ++++ b/drivers/misc/mei/client.c
1030 +@@ -882,7 +882,6 @@ void mei_cl_all_disconnect(struct mei_device *dev)
1031 + list_for_each_entry_safe(cl, next, &dev->file_list, link) {
1032 + cl->state = MEI_FILE_DISCONNECTED;
1033 + cl->mei_flow_ctrl_creds = 0;
1034 +- cl->read_cb = NULL;
1035 + cl->timer_count = 0;
1036 + }
1037 + }
1038 +@@ -916,8 +915,16 @@ void mei_cl_all_wakeup(struct mei_device *dev)
1039 + void mei_cl_all_write_clear(struct mei_device *dev)
1040 + {
1041 + struct mei_cl_cb *cb, *next;
1042 ++ struct list_head *list;
1043 +
1044 +- list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
1045 ++ list = &dev->write_list.list;
1046 ++ list_for_each_entry_safe(cb, next, list, list) {
1047 ++ list_del(&cb->list);
1048 ++ mei_io_cb_free(cb);
1049 ++ }
1050 ++
1051 ++ list = &dev->write_waiting_list.list;
1052 ++ list_for_each_entry_safe(cb, next, list, list) {
1053 + list_del(&cb->list);
1054 + mei_io_cb_free(cb);
1055 + }
1056 +diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
1057 +index 17d7fece35d2..57fc06e0f434 100644
1058 +--- a/drivers/net/wireless/ath/ar5523/ar5523.c
1059 ++++ b/drivers/net/wireless/ath/ar5523/ar5523.c
1060 +@@ -1764,7 +1764,7 @@ static struct usb_device_id ar5523_id_table[] = {
1061 + AR5523_DEVICE_UX(0x2001, 0x3a04), /* Dlink / DWLAG122 */
1062 + AR5523_DEVICE_UG(0x1690, 0x0712), /* Gigaset / AR5523 */
1063 + AR5523_DEVICE_UG(0x1690, 0x0710), /* Gigaset / SMCWUSBTG */
1064 +- AR5523_DEVICE_UG(0x129b, 0x160c), /* Gigaset / USB stick 108
1065 ++ AR5523_DEVICE_UG(0x129b, 0x160b), /* Gigaset / USB stick 108
1066 + (CyberTAN Technology) */
1067 + AR5523_DEVICE_UG(0x16ab, 0x7801), /* Globalsun / AR5523_1 */
1068 + AR5523_DEVICE_UX(0x16ab, 0x7811), /* Globalsun / AR5523_2 */
1069 +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
1070 +index c3676bf1d6c4..50f991c89cfe 100644
1071 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
1072 ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
1073 +@@ -34,6 +34,10 @@ static int ath9k_htc_btcoex_enable;
1074 + module_param_named(btcoex_enable, ath9k_htc_btcoex_enable, int, 0444);
1075 + MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
1076 +
1077 ++static int ath9k_ps_enable;
1078 ++module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
1079 ++MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
1080 ++
1081 + #define CHAN2G(_freq, _idx) { \
1082 + .center_freq = (_freq), \
1083 + .hw_value = (_idx), \
1084 +@@ -725,12 +729,14 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
1085 + IEEE80211_HW_SPECTRUM_MGMT |
1086 + IEEE80211_HW_HAS_RATE_CONTROL |
1087 + IEEE80211_HW_RX_INCLUDES_FCS |
1088 +- IEEE80211_HW_SUPPORTS_PS |
1089 + IEEE80211_HW_PS_NULLFUNC_STACK |
1090 + IEEE80211_HW_REPORTS_TX_ACK_STATUS |
1091 + IEEE80211_HW_MFP_CAPABLE |
1092 + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
1093 +
1094 ++ if (ath9k_ps_enable)
1095 ++ hw->flags |= IEEE80211_HW_SUPPORTS_PS;
1096 ++
1097 + hw->wiphy->interface_modes =
1098 + BIT(NL80211_IFTYPE_STATION) |
1099 + BIT(NL80211_IFTYPE_ADHOC) |
1100 +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
1101 +index 79d67c35299b..968345e30436 100644
1102 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
1103 ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
1104 +@@ -1337,21 +1337,22 @@ static void ath9k_htc_sta_rc_update(struct ieee80211_hw *hw,
1105 + struct ath_common *common = ath9k_hw_common(priv->ah);
1106 + struct ath9k_htc_target_rate trate;
1107 +
1108 ++ if (!(changed & IEEE80211_RC_SUPP_RATES_CHANGED))
1109 ++ return;
1110 ++
1111 + mutex_lock(&priv->mutex);
1112 + ath9k_htc_ps_wakeup(priv);
1113 +
1114 +- if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) {
1115 +- memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
1116 +- ath9k_htc_setup_rate(priv, sta, &trate);
1117 +- if (!ath9k_htc_send_rate_cmd(priv, &trate))
1118 +- ath_dbg(common, CONFIG,
1119 +- "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
1120 +- sta->addr, be32_to_cpu(trate.capflags));
1121 +- else
1122 +- ath_dbg(common, CONFIG,
1123 +- "Unable to update supported rates for sta: %pM\n",
1124 +- sta->addr);
1125 +- }
1126 ++ memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
1127 ++ ath9k_htc_setup_rate(priv, sta, &trate);
1128 ++ if (!ath9k_htc_send_rate_cmd(priv, &trate))
1129 ++ ath_dbg(common, CONFIG,
1130 ++ "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
1131 ++ sta->addr, be32_to_cpu(trate.capflags));
1132 ++ else
1133 ++ ath_dbg(common, CONFIG,
1134 ++ "Unable to update supported rates for sta: %pM\n",
1135 ++ sta->addr);
1136 +
1137 + ath9k_htc_ps_restore(priv);
1138 + mutex_unlock(&priv->mutex);
1139 +diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
1140 +index 9a1f349f9260..c9887cb60650 100644
1141 +--- a/drivers/net/wireless/ath/ath9k/init.c
1142 ++++ b/drivers/net/wireless/ath/ath9k/init.c
1143 +@@ -57,6 +57,10 @@ static int ath9k_bt_ant_diversity;
1144 + module_param_named(bt_ant_diversity, ath9k_bt_ant_diversity, int, 0444);
1145 + MODULE_PARM_DESC(bt_ant_diversity, "Enable WLAN/BT RX antenna diversity");
1146 +
1147 ++static int ath9k_ps_enable;
1148 ++module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
1149 ++MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
1150 ++
1151 + bool is_ath9k_unloaded;
1152 + /* We use the hw_value as an index into our private channel structure */
1153 +
1154 +@@ -830,13 +834,15 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
1155 + hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
1156 + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
1157 + IEEE80211_HW_SIGNAL_DBM |
1158 +- IEEE80211_HW_SUPPORTS_PS |
1159 + IEEE80211_HW_PS_NULLFUNC_STACK |
1160 + IEEE80211_HW_SPECTRUM_MGMT |
1161 + IEEE80211_HW_REPORTS_TX_ACK_STATUS |
1162 + IEEE80211_HW_SUPPORTS_RC_TABLE |
1163 + IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
1164 +
1165 ++ if (ath9k_ps_enable)
1166 ++ hw->flags |= IEEE80211_HW_SUPPORTS_PS;
1167 ++
1168 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
1169 + hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
1170 +
1171 +diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
1172 +index b76a9a8fc0b3..4a1cf1344fdb 100644
1173 +--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
1174 ++++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
1175 +@@ -182,6 +182,11 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
1176 +
1177 + for (ch_idx = 0; ch_idx < IWL_NUM_CHANNELS; ch_idx++) {
1178 + ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx);
1179 ++
1180 ++ if (ch_idx >= NUM_2GHZ_CHANNELS &&
1181 ++ !data->sku_cap_band_52GHz_enable)
1182 ++ ch_flags &= ~NVM_CHANNEL_VALID;
1183 ++
1184 + if (!(ch_flags & NVM_CHANNEL_VALID)) {
1185 + IWL_DEBUG_EEPROM(dev,
1186 + "Ch. %d Flags %x [%sGHz] - No traffic\n",
1187 +diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
1188 +index 621fb71f282a..62258ebe3348 100644
1189 +--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
1190 ++++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
1191 +@@ -311,7 +311,8 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
1192 +
1193 + iwl_mvm_scan_fill_ssids(cmd, req);
1194 +
1195 +- cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL);
1196 ++ cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL |
1197 ++ TX_CMD_FLG_BT_DIS);
1198 + cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id;
1199 + cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
1200 + cmd->tx_cmd.rate_n_flags =
1201 +diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c
1202 +index a9c357491434..45746674a1a1 100644
1203 +--- a/drivers/net/wireless/iwlwifi/mvm/utils.c
1204 ++++ b/drivers/net/wireless/iwlwifi/mvm/utils.c
1205 +@@ -411,6 +411,8 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
1206 + mvm->status, table.valid);
1207 + }
1208 +
1209 ++ IWL_ERR(mvm, "Loaded firmware version: %s\n", mvm->fw->fw_version);
1210 ++
1211 + trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low,
1212 + table.data1, table.data2, table.data3,
1213 + table.blink1, table.blink2, table.ilink1,
1214 +diff --git a/drivers/of/address.c b/drivers/of/address.c
1215 +index 3c4b2af51611..503b4e4cb551 100644
1216 +--- a/drivers/of/address.c
1217 ++++ b/drivers/of/address.c
1218 +@@ -99,11 +99,12 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr)
1219 + static int of_bus_pci_match(struct device_node *np)
1220 + {
1221 + /*
1222 ++ * "pciex" is PCI Express
1223 + * "vci" is for the /chaos bridge on 1st-gen PCI powermacs
1224 + * "ht" is hypertransport
1225 + */
1226 +- return !strcmp(np->type, "pci") || !strcmp(np->type, "vci") ||
1227 +- !strcmp(np->type, "ht");
1228 ++ return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
1229 ++ !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
1230 + }
1231 +
1232 + static void of_bus_pci_count_cells(struct device_node *np,
1233 +diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
1234 +index be5cba52a09c..5707135db526 100644
1235 +--- a/drivers/pci/hotplug/acpiphp_glue.c
1236 ++++ b/drivers/pci/hotplug/acpiphp_glue.c
1237 +@@ -706,6 +706,17 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
1238 + return (unsigned int)sta;
1239 + }
1240 +
1241 ++static inline bool device_status_valid(unsigned int sta)
1242 ++{
1243 ++ /*
1244 ++ * ACPI spec says that _STA may return bit 0 clear with bit 3 set
1245 ++ * if the device is valid but does not require a device driver to be
1246 ++ * loaded (Section 6.3.7 of ACPI 5.0A).
1247 ++ */
1248 ++ unsigned int mask = ACPI_STA_DEVICE_ENABLED | ACPI_STA_DEVICE_FUNCTIONING;
1249 ++ return (sta & mask) == mask;
1250 ++}
1251 ++
1252 + /**
1253 + * trim_stale_devices - remove PCI devices that are not responding.
1254 + * @dev: PCI device to start walking the hierarchy from.
1255 +@@ -721,7 +732,7 @@ static void trim_stale_devices(struct pci_dev *dev)
1256 + unsigned long long sta;
1257 +
1258 + status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
1259 +- alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL)
1260 ++ alive = (ACPI_SUCCESS(status) && device_status_valid(sta))
1261 + || acpiphp_no_hotplug(handle);
1262 + }
1263 + if (!alive) {
1264 +@@ -764,7 +775,7 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
1265 + mutex_lock(&slot->crit_sect);
1266 + if (slot_no_hotplug(slot)) {
1267 + ; /* do nothing */
1268 +- } else if (get_slot_status(slot) == ACPI_STA_ALL) {
1269 ++ } else if (device_status_valid(get_slot_status(slot))) {
1270 + /* remove stale devices if any */
1271 + list_for_each_entry_safe(dev, tmp, &bus->devices,
1272 + bus_list)
1273 +diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c
1274 +index c7ff6d67f158..0fbac861080d 100644
1275 +--- a/drivers/power/max17040_battery.c
1276 ++++ b/drivers/power/max17040_battery.c
1277 +@@ -148,7 +148,7 @@ static void max17040_get_online(struct i2c_client *client)
1278 + {
1279 + struct max17040_chip *chip = i2c_get_clientdata(client);
1280 +
1281 +- if (chip->pdata->battery_online)
1282 ++ if (chip->pdata && chip->pdata->battery_online)
1283 + chip->online = chip->pdata->battery_online();
1284 + else
1285 + chip->online = 1;
1286 +@@ -158,7 +158,8 @@ static void max17040_get_status(struct i2c_client *client)
1287 + {
1288 + struct max17040_chip *chip = i2c_get_clientdata(client);
1289 +
1290 +- if (!chip->pdata->charger_online || !chip->pdata->charger_enable) {
1291 ++ if (!chip->pdata || !chip->pdata->charger_online
1292 ++ || !chip->pdata->charger_enable) {
1293 + chip->status = POWER_SUPPLY_STATUS_UNKNOWN;
1294 + return;
1295 + }
1296 +diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c
1297 +index 47a68b43bcd5..ba4e99a37327 100644
1298 +--- a/drivers/spi/spi-nuc900.c
1299 ++++ b/drivers/spi/spi-nuc900.c
1300 +@@ -363,6 +363,8 @@ static int nuc900_spi_probe(struct platform_device *pdev)
1301 + init_completion(&hw->done);
1302 +
1303 + master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1304 ++ if (hw->pdata->lsb)
1305 ++ master->mode_bits |= SPI_LSB_FIRST;
1306 + master->num_chipselect = hw->pdata->num_cs;
1307 + master->bus_num = hw->pdata->bus_num;
1308 + hw->bitbang.master = hw->master;
1309 +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
1310 +index 30b1229f6406..9e039c60c068 100644
1311 +--- a/drivers/spi/spi.c
1312 ++++ b/drivers/spi/spi.c
1313 +@@ -600,9 +600,7 @@ static void spi_pump_messages(struct kthread_work *work)
1314 + ret = master->transfer_one_message(master, master->cur_msg);
1315 + if (ret) {
1316 + dev_err(&master->dev,
1317 +- "failed to transfer one message from queue: %d\n", ret);
1318 +- master->cur_msg->status = ret;
1319 +- spi_finalize_current_message(master);
1320 ++ "failed to transfer one message from queue\n");
1321 + return;
1322 + }
1323 + }
1324 +diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
1325 +index f84df46d326a..a917eda80ef0 100644
1326 +--- a/drivers/staging/comedi/drivers/adv_pci1710.c
1327 ++++ b/drivers/staging/comedi/drivers/adv_pci1710.c
1328 +@@ -490,6 +490,7 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
1329 + struct comedi_insn *insn, unsigned int *data)
1330 + {
1331 + struct pci1710_private *devpriv = dev->private;
1332 ++ unsigned int val;
1333 + int n, chan, range, ofs;
1334 +
1335 + chan = CR_CHAN(insn->chanspec);
1336 +@@ -505,11 +506,14 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
1337 + outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
1338 + ofs = PCI171x_DA1;
1339 + }
1340 ++ val = devpriv->ao_data[chan];
1341 +
1342 +- for (n = 0; n < insn->n; n++)
1343 +- outw(data[n], dev->iobase + ofs);
1344 ++ for (n = 0; n < insn->n; n++) {
1345 ++ val = data[n];
1346 ++ outw(val, dev->iobase + ofs);
1347 ++ }
1348 +
1349 +- devpriv->ao_data[chan] = data[n];
1350 ++ devpriv->ao_data[chan] = val;
1351 +
1352 + return n;
1353 +
1354 +@@ -679,6 +683,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
1355 + struct comedi_insn *insn, unsigned int *data)
1356 + {
1357 + struct pci1710_private *devpriv = dev->private;
1358 ++ unsigned int val;
1359 + int n, rangereg, chan;
1360 +
1361 + chan = CR_CHAN(insn->chanspec);
1362 +@@ -688,13 +693,15 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
1363 + outb(rangereg, dev->iobase + PCI1720_RANGE);
1364 + devpriv->da_ranges = rangereg;
1365 + }
1366 ++ val = devpriv->ao_data[chan];
1367 +
1368 + for (n = 0; n < insn->n; n++) {
1369 +- outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1));
1370 ++ val = data[n];
1371 ++ outw(val, dev->iobase + PCI1720_DA0 + (chan << 1));
1372 + outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */
1373 + }
1374 +
1375 +- devpriv->ao_data[chan] = data[n];
1376 ++ devpriv->ao_data[chan] = val;
1377 +
1378 + return n;
1379 + }
1380 +diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
1381 +index 2b2049c8bc6b..2c3af3f8c352 100644
1382 +--- a/drivers/staging/iio/adc/ad799x_core.c
1383 ++++ b/drivers/staging/iio/adc/ad799x_core.c
1384 +@@ -644,7 +644,8 @@ static int ad799x_probe(struct i2c_client *client,
1385 + return 0;
1386 +
1387 + error_free_irq:
1388 +- free_irq(client->irq, indio_dev);
1389 ++ if (client->irq > 0)
1390 ++ free_irq(client->irq, indio_dev);
1391 + error_cleanup_ring:
1392 + ad799x_ring_cleanup(indio_dev);
1393 + error_disable_reg:
1394 +diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
1395 +index 09844be5eec4..b369dff44756 100644
1396 +--- a/drivers/staging/lustre/lustre/llite/dir.c
1397 ++++ b/drivers/staging/lustre/lustre/llite/dir.c
1398 +@@ -1086,7 +1086,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
1399 + break;
1400 + case Q_GETQUOTA:
1401 + if (((type == USRQUOTA &&
1402 +- uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
1403 ++ !uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
1404 + (type == GRPQUOTA &&
1405 + !in_egroup_p(make_kgid(&init_user_ns, id)))) &&
1406 + (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
1407 +diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1408 +index 9ca3180ebaa0..606d6f059972 100644
1409 +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1410 ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1411 +@@ -53,7 +53,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
1412 + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
1413 + /*=== Customer ID ===*/
1414 + /****** 8188EUS ********/
1415 +- {USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */
1416 ++ {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
1417 + {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
1418 + {} /* Terminating entry */
1419 + };
1420 +diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
1421 +index d1ae4c5c3ffd..dfe3db7942ea 100644
1422 +--- a/drivers/target/target_core_pr.c
1423 ++++ b/drivers/target/target_core_pr.c
1424 +@@ -2009,7 +2009,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
1425 + struct t10_reservation *pr_tmpl = &dev->t10_pr;
1426 + unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL;
1427 + sense_reason_t ret = TCM_NO_SENSE;
1428 +- int pr_holder = 0;
1429 ++ int pr_holder = 0, type;
1430 +
1431 + if (!se_sess || !se_lun) {
1432 + pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n");
1433 +@@ -2131,6 +2131,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
1434 + ret = TCM_RESERVATION_CONFLICT;
1435 + goto out;
1436 + }
1437 ++ type = pr_reg->pr_res_type;
1438 +
1439 + spin_lock(&pr_tmpl->registration_lock);
1440 + /*
1441 +@@ -2161,6 +2162,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
1442 + * Release the calling I_T Nexus registration now..
1443 + */
1444 + __core_scsi3_free_registration(cmd->se_dev, pr_reg, NULL, 1);
1445 ++ pr_reg = NULL;
1446 +
1447 + /*
1448 + * From spc4r17, section 5.7.11.3 Unregistering
1449 +@@ -2174,8 +2176,8 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
1450 + * RESERVATIONS RELEASED.
1451 + */
1452 + if (pr_holder &&
1453 +- (pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_REGONLY ||
1454 +- pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_REGONLY)) {
1455 ++ (type == PR_TYPE_WRITE_EXCLUSIVE_REGONLY ||
1456 ++ type == PR_TYPE_EXCLUSIVE_ACCESS_REGONLY)) {
1457 + list_for_each_entry(pr_reg_p,
1458 + &pr_tmpl->registration_list,
1459 + pr_reg_list) {
1460 +@@ -2194,7 +2196,8 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
1461 + ret = core_scsi3_update_and_write_aptpl(dev, aptpl);
1462 +
1463 + out:
1464 +- core_scsi3_put_pr_reg(pr_reg);
1465 ++ if (pr_reg)
1466 ++ core_scsi3_put_pr_reg(pr_reg);
1467 + return ret;
1468 + }
1469 +
1470 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
1471 +index c0f76da55304..5056090f1b3d 100644
1472 +--- a/drivers/tty/n_gsm.c
1473 ++++ b/drivers/tty/n_gsm.c
1474 +@@ -1089,6 +1089,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
1475 + {
1476 + unsigned int addr = 0;
1477 + unsigned int modem = 0;
1478 ++ unsigned int brk = 0;
1479 + struct gsm_dlci *dlci;
1480 + int len = clen;
1481 + u8 *dp = data;
1482 +@@ -1115,6 +1116,16 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
1483 + if (len == 0)
1484 + return;
1485 + }
1486 ++ len--;
1487 ++ if (len > 0) {
1488 ++ while (gsm_read_ea(&brk, *dp++) == 0) {
1489 ++ len--;
1490 ++ if (len == 0)
1491 ++ return;
1492 ++ }
1493 ++ modem <<= 7;
1494 ++ modem |= (brk & 0x7f);
1495 ++ }
1496 + tty = tty_port_tty_get(&dlci->port);
1497 + gsm_process_modem(tty, dlci, modem, clen);
1498 + if (tty) {
1499 +diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
1500 +index 61c1ad03db5b..a72c33f8e263 100644
1501 +--- a/drivers/tty/serial/sirfsoc_uart.c
1502 ++++ b/drivers/tty/serial/sirfsoc_uart.c
1503 +@@ -540,8 +540,10 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param)
1504 + wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl,
1505 + rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) |
1506 + SIRFUART_IO_MODE);
1507 +- sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count);
1508 + spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1509 ++ spin_lock(&port->lock);
1510 ++ sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count);
1511 ++ spin_unlock(&port->lock);
1512 + if (sirfport->rx_io_count == 4) {
1513 + spin_lock_irqsave(&sirfport->rx_lock, flags);
1514 + sirfport->rx_io_count = 0;
1515 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
1516 +index 9a8e8c5a0c73..239eae55600a 100644
1517 +--- a/drivers/tty/vt/vt.c
1518 ++++ b/drivers/tty/vt/vt.c
1519 +@@ -1164,6 +1164,8 @@ static void csi_J(struct vc_data *vc, int vpar)
1520 + scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char,
1521 + vc->vc_screenbuf_size >> 1);
1522 + set_origin(vc);
1523 ++ if (CON_IS_VISIBLE(vc))
1524 ++ update_screen(vc);
1525 + /* fall through */
1526 + case 2: /* erase whole display */
1527 + count = vc->vc_cols * vc->vc_rows;
1528 +diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
1529 +index f20a04494e16..d6a8d23f047b 100644
1530 +--- a/drivers/usb/core/hcd.c
1531 ++++ b/drivers/usb/core/hcd.c
1532 +@@ -1033,7 +1033,6 @@ static int register_root_hub(struct usb_hcd *hcd)
1533 + dev_name(&usb_dev->dev), retval);
1534 + return retval;
1535 + }
1536 +- usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev);
1537 + }
1538 +
1539 + retval = usb_new_device (usb_dev);
1540 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1541 +index e3f7e41818f8..3670086fb7c8 100644
1542 +--- a/drivers/usb/core/hub.c
1543 ++++ b/drivers/usb/core/hub.c
1544 +@@ -135,7 +135,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev)
1545 + return usb_get_intfdata(hdev->actconfig->interface[0]);
1546 + }
1547 +
1548 +-int usb_device_supports_lpm(struct usb_device *udev)
1549 ++static int usb_device_supports_lpm(struct usb_device *udev)
1550 + {
1551 + /* USB 2.1 (and greater) devices indicate LPM support through
1552 + * their USB 2.0 Extended Capabilities BOS descriptor.
1553 +@@ -156,11 +156,6 @@ int usb_device_supports_lpm(struct usb_device *udev)
1554 + "Power management will be impacted.\n");
1555 + return 0;
1556 + }
1557 +-
1558 +- /* udev is root hub */
1559 +- if (!udev->parent)
1560 +- return 1;
1561 +-
1562 + if (udev->parent->lpm_capable)
1563 + return 1;
1564 +
1565 +diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
1566 +index c49383669cd8..823857767a16 100644
1567 +--- a/drivers/usb/core/usb.h
1568 ++++ b/drivers/usb/core/usb.h
1569 +@@ -35,7 +35,6 @@ extern int usb_get_device_descriptor(struct usb_device *dev,
1570 + unsigned int size);
1571 + extern int usb_get_bos_descriptor(struct usb_device *dev);
1572 + extern void usb_release_bos_descriptor(struct usb_device *dev);
1573 +-extern int usb_device_supports_lpm(struct usb_device *udev);
1574 + extern char *usb_cache_string(struct usb_device *udev, int index);
1575 + extern int usb_set_configuration(struct usb_device *dev, int configuration);
1576 + extern int usb_choose_configuration(struct usb_device *udev);
1577 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1578 +index fec3c8654ccd..6bfbd80ec2b9 100644
1579 +--- a/drivers/usb/host/xhci-ring.c
1580 ++++ b/drivers/usb/host/xhci-ring.c
1581 +@@ -2929,58 +2929,8 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
1582 + }
1583 +
1584 + while (1) {
1585 +- if (room_on_ring(xhci, ep_ring, num_trbs)) {
1586 +- union xhci_trb *trb = ep_ring->enqueue;
1587 +- unsigned int usable = ep_ring->enq_seg->trbs +
1588 +- TRBS_PER_SEGMENT - 1 - trb;
1589 +- u32 nop_cmd;
1590 +-
1591 +- /*
1592 +- * Section 4.11.7.1 TD Fragments states that a link
1593 +- * TRB must only occur at the boundary between
1594 +- * data bursts (eg 512 bytes for 480M).
1595 +- * While it is possible to split a large fragment
1596 +- * we don't know the size yet.
1597 +- * Simplest solution is to fill the trb before the
1598 +- * LINK with nop commands.
1599 +- */
1600 +- if (num_trbs == 1 || num_trbs <= usable || usable == 0)
1601 +- break;
1602 +-
1603 +- if (ep_ring->type != TYPE_BULK)
1604 +- /*
1605 +- * While isoc transfers might have a buffer that
1606 +- * crosses a 64k boundary it is unlikely.
1607 +- * Since we can't add NOPs without generating
1608 +- * gaps in the traffic just hope it never
1609 +- * happens at the end of the ring.
1610 +- * This could be fixed by writing a LINK TRB
1611 +- * instead of the first NOP - however the
1612 +- * TRB_TYPE_LINK_LE32() calls would all need
1613 +- * changing to check the ring length.
1614 +- */
1615 +- break;
1616 +-
1617 +- if (num_trbs >= TRBS_PER_SEGMENT) {
1618 +- xhci_err(xhci, "Too many fragments %d, max %d\n",
1619 +- num_trbs, TRBS_PER_SEGMENT - 1);
1620 +- return -EINVAL;
1621 +- }
1622 +-
1623 +- nop_cmd = cpu_to_le32(TRB_TYPE(TRB_TR_NOOP) |
1624 +- ep_ring->cycle_state);
1625 +- ep_ring->num_trbs_free -= usable;
1626 +- do {
1627 +- trb->generic.field[0] = 0;
1628 +- trb->generic.field[1] = 0;
1629 +- trb->generic.field[2] = 0;
1630 +- trb->generic.field[3] = nop_cmd;
1631 +- trb++;
1632 +- } while (--usable);
1633 +- ep_ring->enqueue = trb;
1634 +- if (room_on_ring(xhci, ep_ring, num_trbs))
1635 +- break;
1636 +- }
1637 ++ if (room_on_ring(xhci, ep_ring, num_trbs))
1638 ++ break;
1639 +
1640 + if (ep_ring == xhci->cmd_ring) {
1641 + xhci_err(xhci, "Do not support expand command ring\n");
1642 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1643 +index 1dceec25223e..82fb34183a7f 100644
1644 +--- a/drivers/usb/host/xhci.c
1645 ++++ b/drivers/usb/host/xhci.c
1646 +@@ -4727,11 +4727,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
1647 + struct device *dev = hcd->self.controller;
1648 + int retval;
1649 +
1650 +- /* Limit the block layer scatter-gather lists to half a segment. */
1651 +- hcd->self.sg_tablesize = TRBS_PER_SEGMENT / 2;
1652 +-
1653 +- /* support to build packet from discontinuous buffers */
1654 +- hcd->self.no_sg_constraint = 1;
1655 ++ /* Accept arbitrarily long scatter-gather lists */
1656 ++ hcd->self.sg_tablesize = ~0;
1657 +
1658 + /* XHCI controllers don't stop the ep queue on short packets :| */
1659 + hcd->self.no_stop_on_short = 1;
1660 +@@ -4757,6 +4754,14 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
1661 + /* xHCI private pointer was set in xhci_pci_probe for the second
1662 + * registered roothub.
1663 + */
1664 ++ xhci = hcd_to_xhci(hcd);
1665 ++ /*
1666 ++ * Support arbitrarily aligned sg-list entries on hosts without
1667 ++ * TD fragment rules (which are currently unsupported).
1668 ++ */
1669 ++ if (xhci->hci_version < 0x100)
1670 ++ hcd->self.no_sg_constraint = 1;
1671 ++
1672 + return 0;
1673 + }
1674 +
1675 +@@ -4783,6 +4788,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
1676 + if (xhci->hci_version > 0x96)
1677 + xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
1678 +
1679 ++ if (xhci->hci_version < 0x100)
1680 ++ hcd->self.no_sg_constraint = 1;
1681 ++
1682 + /* Make sure the HC is halted. */
1683 + retval = xhci_halt(xhci);
1684 + if (retval)
1685 +diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
1686 +index 6b3164c75c98..ed3a425de8ce 100644
1687 +--- a/drivers/usb/host/xhci.h
1688 ++++ b/drivers/usb/host/xhci.h
1689 +@@ -1262,7 +1262,7 @@ union xhci_trb {
1690 + * since the command ring is 64-byte aligned.
1691 + * It must also be greater than 16.
1692 + */
1693 +-#define TRBS_PER_SEGMENT 256
1694 ++#define TRBS_PER_SEGMENT 64
1695 + /* Allow two commands + a link TRB, along with any reserved command TRBs */
1696 + #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3)
1697 + #define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16)
1698 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1699 +index 6f1cbbf51ae8..eea9e7b6af4c 100644
1700 +--- a/drivers/usb/serial/ftdi_sio.c
1701 ++++ b/drivers/usb/serial/ftdi_sio.c
1702 +@@ -153,6 +153,7 @@ static struct usb_device_id id_table_combined [] = {
1703 + { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
1704 + { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
1705 + { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) },
1706 ++ { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) },
1707 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) },
1708 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) },
1709 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) },
1710 +@@ -192,6 +193,8 @@ static struct usb_device_id id_table_combined [] = {
1711 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
1712 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
1713 + { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
1714 ++ { USB_DEVICE(FTDI_VID, FTDI_TAGSYS_LP101_PID) },
1715 ++ { USB_DEVICE(FTDI_VID, FTDI_TAGSYS_P200X_PID) },
1716 + { USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) },
1717 + { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) },
1718 + { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) },
1719 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1720 +index a7019d1e3058..1e2d369df86e 100644
1721 +--- a/drivers/usb/serial/ftdi_sio_ids.h
1722 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
1723 +@@ -50,6 +50,7 @@
1724 + #define TI_XDS100V2_PID 0xa6d0
1725 +
1726 + #define FTDI_NXTCAM_PID 0xABB8 /* NXTCam for Mindstorms NXT */
1727 ++#define FTDI_EV3CON_PID 0xABB9 /* Mindstorms EV3 Console Adapter */
1728 +
1729 + /* US Interface Navigator (http://www.usinterface.com/) */
1730 + #define FTDI_USINT_CAT_PID 0xb810 /* Navigator CAT and 2nd PTT lines */
1731 +@@ -363,6 +364,12 @@
1732 + /* Sprog II (Andrew Crosland's SprogII DCC interface) */
1733 + #define FTDI_SPROG_II 0xF0C8
1734 +
1735 ++/*
1736 ++ * Two of the Tagsys RFID Readers
1737 ++ */
1738 ++#define FTDI_TAGSYS_LP101_PID 0xF0E9 /* Tagsys L-P101 RFID*/
1739 ++#define FTDI_TAGSYS_P200X_PID 0xF0EE /* Tagsys Medio P200x RFID*/
1740 ++
1741 + /* an infrared receiver for user access control with IR tags */
1742 + #define FTDI_PIEGROUP_PID 0xF208 /* Product Id */
1743 +
1744 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1745 +index 5c86f57e4afa..216d20affba8 100644
1746 +--- a/drivers/usb/serial/option.c
1747 ++++ b/drivers/usb/serial/option.c
1748 +@@ -1362,7 +1362,8 @@ static const struct usb_device_id option_ids[] = {
1749 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1267, 0xff, 0xff, 0xff) },
1750 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1268, 0xff, 0xff, 0xff) },
1751 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1269, 0xff, 0xff, 0xff) },
1752 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1270, 0xff, 0xff, 0xff) },
1753 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1270, 0xff, 0xff, 0xff),
1754 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1755 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1271, 0xff, 0xff, 0xff) },
1756 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) },
1757 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) },
1758 +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1759 +index c65437cfd4a2..968a40201e5f 100644
1760 +--- a/drivers/usb/serial/qcserial.c
1761 ++++ b/drivers/usb/serial/qcserial.c
1762 +@@ -139,6 +139,9 @@ static const struct usb_device_id id_table[] = {
1763 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 0)}, /* Sierra Wireless EM7700 Device Management */
1764 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 2)}, /* Sierra Wireless EM7700 NMEA */
1765 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 3)}, /* Sierra Wireless EM7700 Modem */
1766 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 0)}, /* Netgear AirCard 340U Device Management */
1767 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 2)}, /* Netgear AirCard 340U NMEA */
1768 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 3)}, /* Netgear AirCard 340U Modem */
1769 +
1770 + { } /* Terminating entry */
1771 + };
1772 +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
1773 +index 52eb91f2eb2a..147f01971c39 100644
1774 +--- a/drivers/usb/serial/usb-serial-simple.c
1775 ++++ b/drivers/usb/serial/usb-serial-simple.c
1776 +@@ -72,7 +72,8 @@ DEVICE(hp4x, HP4X_IDS);
1777 +
1778 + /* Suunto ANT+ USB Driver */
1779 + #define SUUNTO_IDS() \
1780 +- { USB_DEVICE(0x0fcf, 0x1008) }
1781 ++ { USB_DEVICE(0x0fcf, 0x1008) }, \
1782 ++ { USB_DEVICE(0x0fcf, 0x1009) } /* Dynastream ANT USB-m Stick */
1783 + DEVICE(suunto, SUUNTO_IDS);
1784 +
1785 + /* Siemens USB/MPI adapter */
1786 +diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
1787 +index 8470e1b114f2..1dd0604d1911 100644
1788 +--- a/drivers/usb/storage/Kconfig
1789 ++++ b/drivers/usb/storage/Kconfig
1790 +@@ -18,7 +18,9 @@ config USB_STORAGE
1791 +
1792 + This option depends on 'SCSI' support being enabled, but you
1793 + probably also need 'SCSI device support: SCSI disk support'
1794 +- (BLK_DEV_SD) for most USB storage devices.
1795 ++ (BLK_DEV_SD) for most USB storage devices. Some devices also
1796 ++ will require 'Probe all LUNs on each SCSI device'
1797 ++ (SCSI_MULTI_LUN).
1798 +
1799 + To compile this driver as a module, choose M here: the
1800 + module will be called usb-storage.
1801 +diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
1802 +index 18509e6c21ab..9d38ddc8da49 100644
1803 +--- a/drivers/usb/storage/scsiglue.c
1804 ++++ b/drivers/usb/storage/scsiglue.c
1805 +@@ -78,6 +78,8 @@ static const char* host_info(struct Scsi_Host *host)
1806 +
1807 + static int slave_alloc (struct scsi_device *sdev)
1808 + {
1809 ++ struct us_data *us = host_to_us(sdev->host);
1810 ++
1811 + /*
1812 + * Set the INQUIRY transfer length to 36. We don't use any of
1813 + * the extra data and many devices choke if asked for more or
1814 +@@ -102,6 +104,10 @@ static int slave_alloc (struct scsi_device *sdev)
1815 + */
1816 + blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1));
1817 +
1818 ++ /* Tell the SCSI layer if we know there is more than one LUN */
1819 ++ if (us->protocol == USB_PR_BULK && us->max_lun > 0)
1820 ++ sdev->sdev_bflags |= BLIST_FORCELUN;
1821 ++
1822 + return 0;
1823 + }
1824 +
1825 +diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h
1826 +index 65a6a75066a8..82e8ed0324e3 100644
1827 +--- a/drivers/usb/storage/unusual_cypress.h
1828 ++++ b/drivers/usb/storage/unusual_cypress.h
1829 +@@ -31,7 +31,7 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
1830 + "Cypress ISD-300LP",
1831 + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
1832 +
1833 +-UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x0219,
1834 ++UNUSUAL_DEV( 0x14cd, 0x6116, 0x0160, 0x0160,
1835 + "Super Top",
1836 + "USB 2.0 SATA BRIDGE",
1837 + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
1838 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1839 +index ad06255c2ade..adbeb255616a 100644
1840 +--- a/drivers/usb/storage/unusual_devs.h
1841 ++++ b/drivers/usb/storage/unusual_devs.h
1842 +@@ -1455,6 +1455,13 @@ UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100,
1843 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1844 + US_FL_FIX_CAPACITY ),
1845 +
1846 ++/* Reported by Moritz Moeller-Herrmann <moritz-kernel@××××××××××××××××.de> */
1847 ++UNUSUAL_DEV( 0x0fca, 0x8004, 0x0201, 0x0201,
1848 ++ "Research In Motion",
1849 ++ "BlackBerry Bold 9000",
1850 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1851 ++ US_FL_MAX_SECTORS_64 ),
1852 ++
1853 + /* Reported by Michael Stattmann <michael@×××××××××.com> */
1854 + UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1855 + "Sony Ericsson",
1856 +diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
1857 +index f8448573d030..0b2fefbfcd10 100644
1858 +--- a/drivers/vme/bridges/vme_ca91cx42.c
1859 ++++ b/drivers/vme/bridges/vme_ca91cx42.c
1860 +@@ -884,7 +884,7 @@ static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
1861 + if (done == count)
1862 + goto out;
1863 + }
1864 +- if ((uintptr_t)addr & 0x2) {
1865 ++ if ((uintptr_t)(addr + done) & 0x2) {
1866 + if ((count - done) < 2) {
1867 + *(u8 *)(buf + done) = ioread8(addr + done);
1868 + done += 1;
1869 +@@ -938,7 +938,7 @@ static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
1870 + if (done == count)
1871 + goto out;
1872 + }
1873 +- if ((uintptr_t)addr & 0x2) {
1874 ++ if ((uintptr_t)(addr + done) & 0x2) {
1875 + if ((count - done) < 2) {
1876 + iowrite8(*(u8 *)(buf + done), addr + done);
1877 + done += 1;
1878 +diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
1879 +index 9cf88337e4e9..7db4e6395e23 100644
1880 +--- a/drivers/vme/bridges/vme_tsi148.c
1881 ++++ b/drivers/vme/bridges/vme_tsi148.c
1882 +@@ -1289,7 +1289,7 @@ static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf,
1883 + if (done == count)
1884 + goto out;
1885 + }
1886 +- if ((uintptr_t)addr & 0x2) {
1887 ++ if ((uintptr_t)(addr + done) & 0x2) {
1888 + if ((count - done) < 2) {
1889 + *(u8 *)(buf + done) = ioread8(addr + done);
1890 + done += 1;
1891 +@@ -1371,7 +1371,7 @@ static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
1892 + if (done == count)
1893 + goto out;
1894 + }
1895 +- if ((uintptr_t)addr & 0x2) {
1896 ++ if ((uintptr_t)(addr + done) & 0x2) {
1897 + if ((count - done) < 2) {
1898 + iowrite8(*(u8 *)(buf + done), addr + done);
1899 + done += 1;
1900 +diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
1901 +index fc60b31453ee..6dea2b90b4d5 100644
1902 +--- a/fs/bio-integrity.c
1903 ++++ b/fs/bio-integrity.c
1904 +@@ -114,6 +114,14 @@ void bio_integrity_free(struct bio *bio)
1905 + }
1906 + EXPORT_SYMBOL(bio_integrity_free);
1907 +
1908 ++static inline unsigned int bip_integrity_vecs(struct bio_integrity_payload *bip)
1909 ++{
1910 ++ if (bip->bip_slab == BIO_POOL_NONE)
1911 ++ return BIP_INLINE_VECS;
1912 ++
1913 ++ return bvec_nr_vecs(bip->bip_slab);
1914 ++}
1915 ++
1916 + /**
1917 + * bio_integrity_add_page - Attach integrity metadata
1918 + * @bio: bio to update
1919 +@@ -129,7 +137,7 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
1920 + struct bio_integrity_payload *bip = bio->bi_integrity;
1921 + struct bio_vec *iv;
1922 +
1923 +- if (bip->bip_vcnt >= bvec_nr_vecs(bip->bip_slab)) {
1924 ++ if (bip->bip_vcnt >= bip_integrity_vecs(bip)) {
1925 + printk(KERN_ERR "%s: bip_vec full\n", __func__);
1926 + return 0;
1927 + }
1928 +diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
1929 +index 51f5e0ee7237..494b68349667 100644
1930 +--- a/fs/cifs/cifsacl.c
1931 ++++ b/fs/cifs/cifsacl.c
1932 +@@ -1027,15 +1027,30 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1933 + __u32 secdesclen = 0;
1934 + struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */
1935 + struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
1936 ++ struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1937 ++ struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
1938 ++ struct cifs_tcon *tcon;
1939 ++
1940 ++ if (IS_ERR(tlink))
1941 ++ return PTR_ERR(tlink);
1942 ++ tcon = tlink_tcon(tlink);
1943 +
1944 + cifs_dbg(NOISY, "set ACL from mode for %s\n", path);
1945 +
1946 + /* Get the security descriptor */
1947 +- pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen);
1948 ++
1949 ++ if (tcon->ses->server->ops->get_acl == NULL) {
1950 ++ cifs_put_tlink(tlink);
1951 ++ return -EOPNOTSUPP;
1952 ++ }
1953 ++
1954 ++ pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path,
1955 ++ &secdesclen);
1956 + if (IS_ERR(pntsd)) {
1957 + rc = PTR_ERR(pntsd);
1958 + cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc);
1959 +- goto out;
1960 ++ cifs_put_tlink(tlink);
1961 ++ return rc;
1962 + }
1963 +
1964 + /*
1965 +@@ -1048,6 +1063,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1966 + pnntsd = kmalloc(secdesclen, GFP_KERNEL);
1967 + if (!pnntsd) {
1968 + kfree(pntsd);
1969 ++ cifs_put_tlink(tlink);
1970 + return -ENOMEM;
1971 + }
1972 +
1973 +@@ -1056,14 +1072,18 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1974 +
1975 + cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc);
1976 +
1977 ++ if (tcon->ses->server->ops->set_acl == NULL)
1978 ++ rc = -EOPNOTSUPP;
1979 ++
1980 + if (!rc) {
1981 + /* Set the security descriptor */
1982 +- rc = set_cifs_acl(pnntsd, secdesclen, inode, path, aclflag);
1983 ++ rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode,
1984 ++ path, aclflag);
1985 + cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc);
1986 + }
1987 ++ cifs_put_tlink(tlink);
1988 +
1989 + kfree(pnntsd);
1990 + kfree(pntsd);
1991 +-out:
1992 + return rc;
1993 + }
1994 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
1995 +index c8e03f8d628f..db95dca335ca 100644
1996 +--- a/fs/cifs/cifsglob.h
1997 ++++ b/fs/cifs/cifsglob.h
1998 +@@ -379,6 +379,16 @@ struct smb_version_operations {
1999 + char * (*create_lease_buf)(u8 *, u8);
2000 + /* parse lease context buffer and return oplock/epoch info */
2001 + __u8 (*parse_lease_buf)(void *, unsigned int *);
2002 ++ ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *,
2003 ++ const unsigned char *, const unsigned char *, char *,
2004 ++ size_t, const struct nls_table *, int);
2005 ++ int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *,
2006 ++ const char *, const void *, const __u16,
2007 ++ const struct nls_table *, int);
2008 ++ struct cifs_ntsd * (*get_acl)(struct cifs_sb_info *, struct inode *,
2009 ++ const char *, u32 *);
2010 ++ int (*set_acl)(struct cifs_ntsd *, __u32, struct inode *, const char *,
2011 ++ int);
2012 + };
2013 +
2014 + struct smb_version_values {
2015 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
2016 +index 49719b8228e5..5f8bdff3a758 100644
2017 +--- a/fs/cifs/inode.c
2018 ++++ b/fs/cifs/inode.c
2019 +@@ -518,10 +518,15 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
2020 + return PTR_ERR(tlink);
2021 + tcon = tlink_tcon(tlink);
2022 +
2023 +- rc = CIFSSMBQAllEAs(xid, tcon, path, "SETFILEBITS",
2024 +- ea_value, 4 /* size of buf */, cifs_sb->local_nls,
2025 +- cifs_sb->mnt_cifs_flags &
2026 +- CIFS_MOUNT_MAP_SPECIAL_CHR);
2027 ++ if (tcon->ses->server->ops->query_all_EAs == NULL) {
2028 ++ cifs_put_tlink(tlink);
2029 ++ return -EOPNOTSUPP;
2030 ++ }
2031 ++
2032 ++ rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path,
2033 ++ "SETFILEBITS", ea_value, 4 /* size of buf */,
2034 ++ cifs_sb->local_nls,
2035 ++ cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
2036 + cifs_put_tlink(tlink);
2037 + if (rc < 0)
2038 + return (int)rc;
2039 +diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
2040 +index e50554b75463..e6ed0dc3071b 100644
2041 +--- a/fs/cifs/smb1ops.c
2042 ++++ b/fs/cifs/smb1ops.c
2043 +@@ -1003,6 +1003,14 @@ struct smb_version_operations smb1_operations = {
2044 + .push_mand_locks = cifs_push_mandatory_locks,
2045 + .query_mf_symlink = open_query_close_cifs_symlink,
2046 + .is_read_op = cifs_is_read_op,
2047 ++#ifdef CONFIG_CIFS_XATTR
2048 ++ .query_all_EAs = CIFSSMBQAllEAs,
2049 ++ .set_EA = CIFSSMBSetEA,
2050 ++#endif /* CIFS_XATTR */
2051 ++#ifdef CONFIG_CIFS_ACL
2052 ++ .get_acl = get_cifs_acl,
2053 ++ .set_acl = set_cifs_acl,
2054 ++#endif /* CIFS_ACL */
2055 + };
2056 +
2057 + struct smb_version_values smb1_values = {
2058 +diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
2059 +index 09afda4cc58e..5ac836a86b18 100644
2060 +--- a/fs/cifs/xattr.c
2061 ++++ b/fs/cifs/xattr.c
2062 +@@ -82,9 +82,11 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
2063 + goto remove_ea_exit;
2064 +
2065 + ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
2066 +- rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, NULL,
2067 +- (__u16)0, cifs_sb->local_nls,
2068 +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
2069 ++ if (pTcon->ses->server->ops->set_EA)
2070 ++ rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
2071 ++ full_path, ea_name, NULL, (__u16)0,
2072 ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
2073 ++ CIFS_MOUNT_MAP_SPECIAL_CHR);
2074 + }
2075 + remove_ea_exit:
2076 + kfree(full_path);
2077 +@@ -149,18 +151,22 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
2078 + cifs_dbg(FYI, "attempt to set cifs inode metadata\n");
2079 +
2080 + ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
2081 +- rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
2082 +- (__u16)value_size, cifs_sb->local_nls,
2083 +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
2084 ++ if (pTcon->ses->server->ops->set_EA)
2085 ++ rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
2086 ++ full_path, ea_name, ea_value, (__u16)value_size,
2087 ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
2088 ++ CIFS_MOUNT_MAP_SPECIAL_CHR);
2089 + } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)
2090 + == 0) {
2091 + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
2092 + goto set_ea_exit;
2093 +
2094 + ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */
2095 +- rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
2096 +- (__u16)value_size, cifs_sb->local_nls,
2097 +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
2098 ++ if (pTcon->ses->server->ops->set_EA)
2099 ++ rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
2100 ++ full_path, ea_name, ea_value, (__u16)value_size,
2101 ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
2102 ++ CIFS_MOUNT_MAP_SPECIAL_CHR);
2103 + } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL,
2104 + strlen(CIFS_XATTR_CIFS_ACL)) == 0) {
2105 + #ifdef CONFIG_CIFS_ACL
2106 +@@ -170,8 +176,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
2107 + rc = -ENOMEM;
2108 + } else {
2109 + memcpy(pacl, ea_value, value_size);
2110 +- rc = set_cifs_acl(pacl, value_size,
2111 +- direntry->d_inode, full_path, CIFS_ACL_DACL);
2112 ++ if (pTcon->ses->server->ops->set_acl)
2113 ++ rc = pTcon->ses->server->ops->set_acl(pacl,
2114 ++ value_size, direntry->d_inode,
2115 ++ full_path, CIFS_ACL_DACL);
2116 ++ else
2117 ++ rc = -EOPNOTSUPP;
2118 + if (rc == 0) /* force revalidate of the inode */
2119 + CIFS_I(direntry->d_inode)->time = 0;
2120 + kfree(pacl);
2121 +@@ -272,17 +282,21 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
2122 + /* revalidate/getattr then populate from inode */
2123 + } /* BB add else when above is implemented */
2124 + ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
2125 +- rc = CIFSSMBQAllEAs(xid, pTcon, full_path, ea_name, ea_value,
2126 +- buf_size, cifs_sb->local_nls,
2127 +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
2128 ++ if (pTcon->ses->server->ops->query_all_EAs)
2129 ++ rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
2130 ++ full_path, ea_name, ea_value, buf_size,
2131 ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
2132 ++ CIFS_MOUNT_MAP_SPECIAL_CHR);
2133 + } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) {
2134 + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
2135 + goto get_ea_exit;
2136 +
2137 + ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */
2138 +- rc = CIFSSMBQAllEAs(xid, pTcon, full_path, ea_name, ea_value,
2139 +- buf_size, cifs_sb->local_nls,
2140 +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
2141 ++ if (pTcon->ses->server->ops->query_all_EAs)
2142 ++ rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
2143 ++ full_path, ea_name, ea_value, buf_size,
2144 ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
2145 ++ CIFS_MOUNT_MAP_SPECIAL_CHR);
2146 + } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
2147 + strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
2148 + #ifdef CONFIG_CIFS_POSIX
2149 +@@ -313,8 +327,11 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
2150 + u32 acllen;
2151 + struct cifs_ntsd *pacl;
2152 +
2153 +- pacl = get_cifs_acl(cifs_sb, direntry->d_inode,
2154 +- full_path, &acllen);
2155 ++ if (pTcon->ses->server->ops->get_acl == NULL)
2156 ++ goto get_ea_exit; /* rc already EOPNOTSUPP */
2157 ++
2158 ++ pacl = pTcon->ses->server->ops->get_acl(cifs_sb,
2159 ++ direntry->d_inode, full_path, &acllen);
2160 + if (IS_ERR(pacl)) {
2161 + rc = PTR_ERR(pacl);
2162 + cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
2163 +@@ -400,11 +417,12 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
2164 + /* if proc/fs/cifs/streamstoxattr is set then
2165 + search server for EAs or streams to
2166 + returns as xattrs */
2167 +- rc = CIFSSMBQAllEAs(xid, pTcon, full_path, NULL, data,
2168 +- buf_size, cifs_sb->local_nls,
2169 +- cifs_sb->mnt_cifs_flags &
2170 +- CIFS_MOUNT_MAP_SPECIAL_CHR);
2171 +
2172 ++ if (pTcon->ses->server->ops->query_all_EAs)
2173 ++ rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
2174 ++ full_path, NULL, data, buf_size,
2175 ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
2176 ++ CIFS_MOUNT_MAP_SPECIAL_CHR);
2177 + list_ea_exit:
2178 + kfree(full_path);
2179 + free_xid(xid);
2180 +diff --git a/fs/file.c b/fs/file.c
2181 +index 4a78f981557a..9de20265a78c 100644
2182 +--- a/fs/file.c
2183 ++++ b/fs/file.c
2184 +@@ -34,7 +34,7 @@ static void *alloc_fdmem(size_t size)
2185 + * vmalloc() if the allocation size will be considered "large" by the VM.
2186 + */
2187 + if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
2188 +- void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);
2189 ++ void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY);
2190 + if (data != NULL)
2191 + return data;
2192 + }
2193 +diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
2194 +index e066a3902973..ab798a88ec1d 100644
2195 +--- a/fs/lockd/svclock.c
2196 ++++ b/fs/lockd/svclock.c
2197 +@@ -779,6 +779,7 @@ nlmsvc_grant_blocked(struct nlm_block *block)
2198 + struct nlm_file *file = block->b_file;
2199 + struct nlm_lock *lock = &block->b_call->a_args.lock;
2200 + int error;
2201 ++ loff_t fl_start, fl_end;
2202 +
2203 + dprintk("lockd: grant blocked lock %p\n", block);
2204 +
2205 +@@ -796,9 +797,16 @@ nlmsvc_grant_blocked(struct nlm_block *block)
2206 + }
2207 +
2208 + /* Try the lock operation again */
2209 ++ /* vfs_lock_file() can mangle fl_start and fl_end, but we need
2210 ++ * them unchanged for the GRANT_MSG
2211 ++ */
2212 + lock->fl.fl_flags |= FL_SLEEP;
2213 ++ fl_start = lock->fl.fl_start;
2214 ++ fl_end = lock->fl.fl_end;
2215 + error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL);
2216 + lock->fl.fl_flags &= ~FL_SLEEP;
2217 ++ lock->fl.fl_start = fl_start;
2218 ++ lock->fl.fl_end = fl_end;
2219 +
2220 + switch (error) {
2221 + case 0:
2222 +diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
2223 +index 02b0df769e2d..e81a1cae81b5 100644
2224 +--- a/fs/nfs/dir.c
2225 ++++ b/fs/nfs/dir.c
2226 +@@ -1852,6 +1852,11 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
2227 + GFP_KERNEL)) {
2228 + SetPageUptodate(page);
2229 + unlock_page(page);
2230 ++ /*
2231 ++ * add_to_page_cache_lru() grabs an extra page refcount.
2232 ++ * Drop it here to avoid leaking this page later.
2233 ++ */
2234 ++ page_cache_release(page);
2235 + } else
2236 + __free_page(page);
2237 +
2238 +diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
2239 +index ded429966c1f..2507fd2a1eb4 100644
2240 +--- a/include/linux/compiler-gcc4.h
2241 ++++ b/include/linux/compiler-gcc4.h
2242 +@@ -75,11 +75,7 @@
2243 + *
2244 + * (asm goto is automatically volatile - the naming reflects this.)
2245 + */
2246 +-#if GCC_VERSION <= 40801
2247 +-# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
2248 +-#else
2249 +-# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
2250 +-#endif
2251 ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
2252 +
2253 + #ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
2254 + #if GCC_VERSION >= 40400
2255 +diff --git a/include/linux/usb.h b/include/linux/usb.h
2256 +index 6b02370256e4..39cfa0aca91f 100644
2257 +--- a/include/linux/usb.h
2258 ++++ b/include/linux/usb.h
2259 +@@ -1262,8 +1262,6 @@ typedef void (*usb_complete_t)(struct urb *);
2260 + * @sg: scatter gather buffer list, the buffer size of each element in
2261 + * the list (except the last) must be divisible by the endpoint's
2262 + * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
2263 +- * (FIXME: scatter-gather under xHCI is broken for periodic transfers.
2264 +- * Do not use urb->sg for interrupt endpoints for now, only bulk.)
2265 + * @num_mapped_sgs: (internal) number of mapped sg entries
2266 + * @num_sgs: number of entries in the sg list
2267 + * @transfer_buffer_length: How big is transfer_buffer. The transfer may
2268 +diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
2269 +index 192a302d6cfd..8ab8e9390297 100644
2270 +--- a/kernel/irq/irqdesc.c
2271 ++++ b/kernel/irq/irqdesc.c
2272 +@@ -274,6 +274,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
2273 + {
2274 + return (irq < NR_IRQS) ? irq_desc + irq : NULL;
2275 + }
2276 ++EXPORT_SYMBOL(irq_to_desc);
2277 +
2278 + static void free_desc(unsigned int irq)
2279 + {
2280 +diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
2281 +index 7a925ba456fb..a6a5bf53e86d 100644
2282 +--- a/kernel/time/jiffies.c
2283 ++++ b/kernel/time/jiffies.c
2284 +@@ -51,7 +51,13 @@
2285 + * HZ shrinks, so values greater than 8 overflow 32bits when
2286 + * HZ=100.
2287 + */
2288 ++#if HZ < 34
2289 ++#define JIFFIES_SHIFT 6
2290 ++#elif HZ < 67
2291 ++#define JIFFIES_SHIFT 7
2292 ++#else
2293 + #define JIFFIES_SHIFT 8
2294 ++#endif
2295 +
2296 + static cycle_t jiffies_read(struct clocksource *cs)
2297 + {
2298 +diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
2299 +index 218bcb565fed..8a95408b1345 100644
2300 +--- a/kernel/time/tick-broadcast.c
2301 ++++ b/kernel/time/tick-broadcast.c
2302 +@@ -755,6 +755,7 @@ out:
2303 + static void tick_broadcast_clear_oneshot(int cpu)
2304 + {
2305 + cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask);
2306 ++ cpumask_clear_cpu(cpu, tick_broadcast_pending_mask);
2307 + }
2308 +
2309 + static void tick_broadcast_init_next_event(struct cpumask *mask,
2310 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
2311 +index cc2f66f68dc5..0e337eedb909 100644
2312 +--- a/kernel/trace/ring_buffer.c
2313 ++++ b/kernel/trace/ring_buffer.c
2314 +@@ -2397,6 +2397,13 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
2315 + write &= RB_WRITE_MASK;
2316 + tail = write - length;
2317 +
2318 ++ /*
2319 ++ * If this is the first commit on the page, then it has the same
2320 ++ * timestamp as the page itself.
2321 ++ */
2322 ++ if (!tail)
2323 ++ delta = 0;
2324 ++
2325 + /* See if we shot pass the end of this buffer page */
2326 + if (unlikely(write > BUF_PAGE_SIZE))
2327 + return rb_move_tail(cpu_buffer, length, tail,
2328 +diff --git a/mm/memory-failure.c b/mm/memory-failure.c
2329 +index 428adeedd3be..de476c2f8827 100644
2330 +--- a/mm/memory-failure.c
2331 ++++ b/mm/memory-failure.c
2332 +@@ -945,8 +945,10 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
2333 + * to it. Similarly, page lock is shifted.
2334 + */
2335 + if (hpage != p) {
2336 +- put_page(hpage);
2337 +- get_page(p);
2338 ++ if (!(flags & MF_COUNT_INCREASED)) {
2339 ++ put_page(hpage);
2340 ++ get_page(p);
2341 ++ }
2342 + lock_page(p);
2343 + unlock_page(hpage);
2344 + *hpagep = p;
2345 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
2346 +index 9903ee585561..c6d417a3885f 100644
2347 +--- a/net/mac80211/cfg.c
2348 ++++ b/net/mac80211/cfg.c
2349 +@@ -995,8 +995,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
2350 + IEEE80211_P2P_OPPPS_ENABLE_BIT;
2351 +
2352 + err = ieee80211_assign_beacon(sdata, &params->beacon);
2353 +- if (err < 0)
2354 ++ if (err < 0) {
2355 ++ ieee80211_vif_release_channel(sdata);
2356 + return err;
2357 ++ }
2358 + changed |= err;
2359 +
2360 + err = drv_start_ap(sdata->local, sdata);
2361 +@@ -1005,6 +1007,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
2362 + if (old)
2363 + kfree_rcu(old, rcu_head);
2364 + RCU_INIT_POINTER(sdata->u.ap.beacon, NULL);
2365 ++ ieee80211_vif_release_channel(sdata);
2366 + return err;
2367 + }
2368 +
2369 +@@ -2506,6 +2509,24 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2370 + INIT_DELAYED_WORK(&roc->work, ieee80211_sw_roc_work);
2371 + INIT_LIST_HEAD(&roc->dependents);
2372 +
2373 ++ /*
2374 ++ * cookie is either the roc cookie (for normal roc)
2375 ++ * or the SKB (for mgmt TX)
2376 ++ */
2377 ++ if (!txskb) {
2378 ++ /* local->mtx protects this */
2379 ++ local->roc_cookie_counter++;
2380 ++ roc->cookie = local->roc_cookie_counter;
2381 ++ /* wow, you wrapped 64 bits ... more likely a bug */
2382 ++ if (WARN_ON(roc->cookie == 0)) {
2383 ++ roc->cookie = 1;
2384 ++ local->roc_cookie_counter++;
2385 ++ }
2386 ++ *cookie = roc->cookie;
2387 ++ } else {
2388 ++ *cookie = (unsigned long)txskb;
2389 ++ }
2390 ++
2391 + /* if there's one pending or we're scanning, queue this one */
2392 + if (!list_empty(&local->roc_list) ||
2393 + local->scanning || local->radar_detect_enabled)
2394 +@@ -2640,24 +2661,6 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2395 + if (!queued)
2396 + list_add_tail(&roc->list, &local->roc_list);
2397 +
2398 +- /*
2399 +- * cookie is either the roc cookie (for normal roc)
2400 +- * or the SKB (for mgmt TX)
2401 +- */
2402 +- if (!txskb) {
2403 +- /* local->mtx protects this */
2404 +- local->roc_cookie_counter++;
2405 +- roc->cookie = local->roc_cookie_counter;
2406 +- /* wow, you wrapped 64 bits ... more likely a bug */
2407 +- if (WARN_ON(roc->cookie == 0)) {
2408 +- roc->cookie = 1;
2409 +- local->roc_cookie_counter++;
2410 +- }
2411 +- *cookie = roc->cookie;
2412 +- } else {
2413 +- *cookie = (unsigned long)txskb;
2414 +- }
2415 +-
2416 + return 0;
2417 + }
2418 +
2419 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
2420 +index 1eb2b78e927b..81dca92176c7 100644
2421 +--- a/net/mac80211/tx.c
2422 ++++ b/net/mac80211/tx.c
2423 +@@ -874,7 +874,7 @@ static int ieee80211_fragment(struct ieee80211_tx_data *tx,
2424 + }
2425 +
2426 + /* adjust first fragment's length */
2427 +- skb->len = hdrlen + per_fragm;
2428 ++ skb_trim(skb, hdrlen + per_fragm);
2429 + return 0;
2430 + }
2431 +
2432 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2433 +index 626dc3b5fd8d..c2853bbf8059 100644
2434 +--- a/net/wireless/nl80211.c
2435 ++++ b/net/wireless/nl80211.c
2436 +@@ -1655,9 +1655,10 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
2437 + * We can then retry with the larger buffer.
2438 + */
2439 + if ((ret == -ENOBUFS || ret == -EMSGSIZE) &&
2440 +- !skb->len &&
2441 ++ !skb->len && !state->split &&
2442 + cb->min_dump_alloc < 4096) {
2443 + cb->min_dump_alloc = 4096;
2444 ++ state->split_start = 0;
2445 + rtnl_unlock();
2446 + return 1;
2447 + }
2448 +diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
2449 +index 23708636b05c..25e5cb0aaef6 100644
2450 +--- a/scripts/mod/file2alias.c
2451 ++++ b/scripts/mod/file2alias.c
2452 +@@ -210,8 +210,8 @@ static void do_usb_entry(void *symval,
2453 + range_lo < 0x9 ? "[%X-9" : "[%X",
2454 + range_lo);
2455 + sprintf(alias + strlen(alias),
2456 +- range_hi > 0xA ? "a-%X]" : "%X]",
2457 +- range_lo);
2458 ++ range_hi > 0xA ? "A-%X]" : "%X]",
2459 ++ range_hi);
2460 + }
2461 + }
2462 + if (bcdDevice_initial_digits < (sizeof(bcdDevice_lo) * 2 - 1))
2463 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2464 +index 6195a4f8d9b8..003a7ce5791c 100644
2465 +--- a/sound/pci/hda/patch_realtek.c
2466 ++++ b/sound/pci/hda/patch_realtek.c
2467 +@@ -4057,6 +4057,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2468 + SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
2469 + SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
2470 + SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
2471 ++ SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
2472 + SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
2473 + SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
2474 + SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
2475 +diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
2476 +index 88b2fe3ddf42..00d86427af0f 100644
2477 +--- a/virt/kvm/coalesced_mmio.c
2478 ++++ b/virt/kvm/coalesced_mmio.c
2479 +@@ -154,17 +154,13 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
2480 + list_add_tail(&dev->list, &kvm->coalesced_zones);
2481 + mutex_unlock(&kvm->slots_lock);
2482 +
2483 +- return ret;
2484 ++ return 0;
2485 +
2486 + out_free_dev:
2487 + mutex_unlock(&kvm->slots_lock);
2488 +-
2489 + kfree(dev);
2490 +
2491 +- if (dev == NULL)
2492 +- return -ENXIO;
2493 +-
2494 +- return 0;
2495 ++ return ret;
2496 + }
2497 +
2498 + int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,