Magellan Linux

Annotation of /trunk/kernel-alx/patches-3.12/0112-3.12.13-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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