Magellan Linux

Annotation of /trunk/kernel-lts/patches-3.4/0100-3.4.1-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1907 - (hide annotations) (download)
Wed Oct 10 11:20:27 2012 UTC (11 years, 7 months ago) by niro
File size: 89599 byte(s)
-3.4.13-lts-r1
1 niro 1907 diff --git a/Documentation/HOWTO b/Documentation/HOWTO
2     index f7ade3b..59c080f 100644
3     --- a/Documentation/HOWTO
4     +++ b/Documentation/HOWTO
5     @@ -218,16 +218,16 @@ The development process
6     Linux kernel development process currently consists of a few different
7     main kernel "branches" and lots of different subsystem-specific kernel
8     branches. These different branches are:
9     - - main 2.6.x kernel tree
10     - - 2.6.x.y -stable kernel tree
11     - - 2.6.x -git kernel patches
12     + - main 3.x kernel tree
13     + - 3.x.y -stable kernel tree
14     + - 3.x -git kernel patches
15     - subsystem specific kernel trees and patches
16     - - the 2.6.x -next kernel tree for integration tests
17     + - the 3.x -next kernel tree for integration tests
18    
19     -2.6.x kernel tree
20     +3.x kernel tree
21     -----------------
22     -2.6.x kernels are maintained by Linus Torvalds, and can be found on
23     -kernel.org in the pub/linux/kernel/v2.6/ directory. Its development
24     +3.x kernels are maintained by Linus Torvalds, and can be found on
25     +kernel.org in the pub/linux/kernel/v3.x/ directory. Its development
26     process is as follows:
27     - As soon as a new kernel is released a two weeks window is open,
28     during this period of time maintainers can submit big diffs to
29     @@ -262,20 +262,20 @@ mailing list about kernel releases:
30     released according to perceived bug status, not according to a
31     preconceived timeline."
32    
33     -2.6.x.y -stable kernel tree
34     +3.x.y -stable kernel tree
35     ---------------------------
36     -Kernels with 4-part versions are -stable kernels. They contain
37     +Kernels with 3-part versions are -stable kernels. They contain
38     relatively small and critical fixes for security problems or significant
39     -regressions discovered in a given 2.6.x kernel.
40     +regressions discovered in a given 3.x kernel.
41    
42     This is the recommended branch for users who want the most recent stable
43     kernel and are not interested in helping test development/experimental
44     versions.
45    
46     -If no 2.6.x.y kernel is available, then the highest numbered 2.6.x
47     +If no 3.x.y kernel is available, then the highest numbered 3.x
48     kernel is the current stable kernel.
49    
50     -2.6.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
51     +3.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
52     are released as needs dictate. The normal release period is approximately
53     two weeks, but it can be longer if there are no pressing problems. A
54     security-related problem, instead, can cause a release to happen almost
55     @@ -285,7 +285,7 @@ The file Documentation/stable_kernel_rules.txt in the kernel tree
56     documents what kinds of changes are acceptable for the -stable tree, and
57     how the release process works.
58    
59     -2.6.x -git patches
60     +3.x -git patches
61     ------------------
62     These are daily snapshots of Linus' kernel tree which are managed in a
63     git repository (hence the name.) These patches are usually released
64     @@ -317,13 +317,13 @@ revisions to it, and maintainers can mark patches as under review,
65     accepted, or rejected. Most of these patchwork sites are listed at
66     http://patchwork.kernel.org/.
67    
68     -2.6.x -next kernel tree for integration tests
69     +3.x -next kernel tree for integration tests
70     ---------------------------------------------
71     -Before updates from subsystem trees are merged into the mainline 2.6.x
72     +Before updates from subsystem trees are merged into the mainline 3.x
73     tree, they need to be integration-tested. For this purpose, a special
74     testing repository exists into which virtually all subsystem trees are
75     pulled on an almost daily basis:
76     - http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git
77     + http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
78     http://linux.f-seidel.de/linux-next/pmwiki/
79    
80     This way, the -next kernel gives a summary outlook onto what will be
81     diff --git a/arch/arm/boot/dts/tegra-cardhu.dts b/arch/arm/boot/dts/tegra-cardhu.dts
82     index ac3fb75..631a86c 100644
83     --- a/arch/arm/boot/dts/tegra-cardhu.dts
84     +++ b/arch/arm/boot/dts/tegra-cardhu.dts
85     @@ -64,7 +64,7 @@
86     status = "disable";
87     };
88    
89     - sdhci@78000400 {
90     + sdhci@78000600 {
91     support-8bit;
92     };
93     };
94     diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
95     index d5d8d5c..1252a26 100644
96     --- a/arch/arm/include/asm/cacheflush.h
97     +++ b/arch/arm/include/asm/cacheflush.h
98     @@ -249,7 +249,7 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr
99     * Harvard caches are synchronised for the user space address range.
100     * This is used for the ARM private sys_cacheflush system call.
101     */
102     -#define flush_cache_user_range(vma,start,end) \
103     +#define flush_cache_user_range(start,end) \
104     __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
105    
106     /*
107     diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
108     index 7784547..63d402f 100644
109     --- a/arch/arm/kernel/traps.c
110     +++ b/arch/arm/kernel/traps.c
111     @@ -496,7 +496,9 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
112     if (end > vma->vm_end)
113     end = vma->vm_end;
114    
115     - flush_cache_user_range(vma, start, end);
116     + up_read(&mm->mmap_sem);
117     + flush_cache_user_range(start, end);
118     + return;
119     }
120     up_read(&mm->mmap_sem);
121     }
122     diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
123     index 6d2209a..04d7909 100644
124     --- a/arch/powerpc/kernel/idle.c
125     +++ b/arch/powerpc/kernel/idle.c
126     @@ -113,6 +113,9 @@ void cpu_idle(void)
127     }
128     }
129    
130     +static void do_nothing(void *unused)
131     +{
132     +}
133    
134     /*
135     * cpu_idle_wait - Used to ensure that all the CPUs come out of the old
136     @@ -123,16 +126,9 @@ void cpu_idle(void)
137     */
138     void cpu_idle_wait(void)
139     {
140     - int cpu;
141     smp_mb();
142     -
143     - /* kick all the CPUs so that they exit out of old idle routine */
144     - get_online_cpus();
145     - for_each_online_cpu(cpu) {
146     - if (cpu != smp_processor_id())
147     - smp_send_reschedule(cpu);
148     - }
149     - put_online_cpus();
150     + /* kick all the CPUs so that they exit out of pm_idle */
151     + smp_call_function(do_nothing, NULL, 1);
152     }
153     EXPORT_SYMBOL_GPL(cpu_idle_wait);
154    
155     diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
156     index 46ef3fd..4e66860 100644
157     --- a/arch/s390/mm/fault.c
158     +++ b/arch/s390/mm/fault.c
159     @@ -574,6 +574,7 @@ static void pfault_interrupt(struct ext_code ext_code,
160     tsk->thread.pfault_wait = 0;
161     list_del(&tsk->thread.list);
162     wake_up_process(tsk);
163     + put_task_struct(tsk);
164     } else {
165     /* Completion interrupt was faster than initial
166     * interrupt. Set pfault_wait to -1 so the initial
167     @@ -588,14 +589,22 @@ static void pfault_interrupt(struct ext_code ext_code,
168     put_task_struct(tsk);
169     } else {
170     /* signal bit not set -> a real page is missing. */
171     - if (tsk->thread.pfault_wait == -1) {
172     + if (tsk->thread.pfault_wait == 1) {
173     + /* Already on the list with a reference: put to sleep */
174     + set_task_state(tsk, TASK_UNINTERRUPTIBLE);
175     + set_tsk_need_resched(tsk);
176     + } else if (tsk->thread.pfault_wait == -1) {
177     /* Completion interrupt was faster than the initial
178     * interrupt (pfault_wait == -1). Set pfault_wait
179     * back to zero and exit. */
180     tsk->thread.pfault_wait = 0;
181     } else {
182     /* Initial interrupt arrived before completion
183     - * interrupt. Let the task sleep. */
184     + * interrupt. Let the task sleep.
185     + * An extra task reference is needed since a different
186     + * cpu may set the task state to TASK_RUNNING again
187     + * before the scheduler is reached. */
188     + get_task_struct(tsk);
189     tsk->thread.pfault_wait = 1;
190     list_add(&tsk->thread.list, &pfault_list);
191     set_task_state(tsk, TASK_UNINTERRUPTIBLE);
192     @@ -620,6 +629,7 @@ static int __cpuinit pfault_cpu_notify(struct notifier_block *self,
193     list_del(&thread->list);
194     tsk = container_of(thread, struct task_struct, thread);
195     wake_up_process(tsk);
196     + put_task_struct(tsk);
197     }
198     spin_unlock_irq(&pfault_lock);
199     break;
200     diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
201     index 6c0683d..76c7ccf 100644
202     --- a/arch/sparc/Kconfig
203     +++ b/arch/sparc/Kconfig
204     @@ -584,6 +584,9 @@ config SYSVIPC_COMPAT
205     depends on COMPAT && SYSVIPC
206     default y
207    
208     +config KEYS_COMPAT
209     + def_bool y if COMPAT && KEYS
210     +
211     endmenu
212    
213     source "net/Kconfig"
214     diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
215     index db86b1a..3a58e0d 100644
216     --- a/arch/sparc/kernel/systbls_64.S
217     +++ b/arch/sparc/kernel/systbls_64.S
218     @@ -74,7 +74,7 @@ sys_call_table32:
219     .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
220     /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
221     .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
222     -/*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
223     +/*280*/ .word sys32_tee, sys_add_key, sys_request_key, compat_sys_keyctl, compat_sys_openat
224     .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
225     /*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
226     .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
227     diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h
228     index 16f1fa5..bd186c4 100644
229     --- a/arch/tile/include/asm/bitops.h
230     +++ b/arch/tile/include/asm/bitops.h
231     @@ -77,6 +77,11 @@ static inline int ffs(int x)
232     return __builtin_ffs(x);
233     }
234    
235     +static inline int fls64(__u64 w)
236     +{
237     + return (sizeof(__u64) * 8) - __builtin_clzll(w);
238     +}
239     +
240     /**
241     * fls - find last set bit in word
242     * @x: the word to search
243     @@ -90,12 +95,7 @@ static inline int ffs(int x)
244     */
245     static inline int fls(int x)
246     {
247     - return (sizeof(int) * 8) - __builtin_clz(x);
248     -}
249     -
250     -static inline int fls64(__u64 w)
251     -{
252     - return (sizeof(__u64) * 8) - __builtin_clzll(w);
253     + return fls64((unsigned int) x);
254     }
255    
256     static inline unsigned int __arch_hweight32(unsigned int w)
257     diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
258     index 6a3f984..5888f1b 100644
259     --- a/arch/um/include/asm/pgtable.h
260     +++ b/arch/um/include/asm/pgtable.h
261     @@ -273,6 +273,12 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
262     }
263     #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
264    
265     +#define __HAVE_ARCH_PTE_SAME
266     +static inline int pte_same(pte_t pte_a, pte_t pte_b)
267     +{
268     + return !((pte_val(pte_a) ^ pte_val(pte_b)) & ~_PAGE_NEWPAGE);
269     +}
270     +
271     /*
272     * Conversion functions: convert a page and protection to a page entry,
273     * and a page entry and page directory to the page they refer to.
274     @@ -348,11 +354,11 @@ extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
275     #define update_mmu_cache(vma,address,ptep) do ; while (0)
276    
277     /* Encode and de-code a swap entry */
278     -#define __swp_type(x) (((x).val >> 4) & 0x3f)
279     +#define __swp_type(x) (((x).val >> 5) & 0x1f)
280     #define __swp_offset(x) ((x).val >> 11)
281    
282     #define __swp_entry(type, offset) \
283     - ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
284     + ((swp_entry_t) { ((type) << 5) | ((offset) << 11) })
285     #define __pte_to_swp_entry(pte) \
286     ((swp_entry_t) { pte_val(pte_mkuptodate(pte)) })
287     #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
288     diff --git a/arch/x86/Makefile b/arch/x86/Makefile
289     index 94e91e4..b1c611e 100644
290     --- a/arch/x86/Makefile
291     +++ b/arch/x86/Makefile
292     @@ -206,6 +206,7 @@ archclean:
293     $(Q)rm -rf $(objtree)/arch/i386
294     $(Q)rm -rf $(objtree)/arch/x86_64
295     $(Q)$(MAKE) $(clean)=$(boot)
296     + $(Q)$(MAKE) $(clean)=arch/x86/tools
297    
298     define archhelp
299     echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
300     diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
301     index 0c82091..1ccd453 100644
302     --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
303     +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
304     @@ -165,15 +165,19 @@ static struct severity {
305     };
306    
307     /*
308     - * If the EIPV bit is set, it means the saved IP is the
309     - * instruction which caused the MCE.
310     + * If mcgstatus indicated that ip/cs on the stack were
311     + * no good, then "m->cs" will be zero and we will have
312     + * to assume the worst case (IN_KERNEL) as we actually
313     + * have no idea what we were executing when the machine
314     + * check hit.
315     + * If we do have a good "m->cs" (or a faked one in the
316     + * case we were executing in VM86 mode) we can use it to
317     + * distinguish an exception taken in user from from one
318     + * taken in the kernel.
319     */
320     static int error_context(struct mce *m)
321     {
322     - if (m->mcgstatus & MCG_STATUS_EIPV)
323     - return (m->ip && (m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
324     - /* Unknown, assume kernel */
325     - return IN_KERNEL;
326     + return ((m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
327     }
328    
329     int mce_severity(struct mce *m, int tolerant, char **msg)
330     diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
331     index 11c9166..61604ae 100644
332     --- a/arch/x86/kernel/cpu/mcheck/mce.c
333     +++ b/arch/x86/kernel/cpu/mcheck/mce.c
334     @@ -437,6 +437,14 @@ static inline void mce_gather_info(struct mce *m, struct pt_regs *regs)
335     if (m->mcgstatus & (MCG_STATUS_RIPV|MCG_STATUS_EIPV)) {
336     m->ip = regs->ip;
337     m->cs = regs->cs;
338     +
339     + /*
340     + * When in VM86 mode make the cs look like ring 3
341     + * always. This is a lie, but it's better than passing
342     + * the additional vm86 bit around everywhere.
343     + */
344     + if (v8086_mode(regs))
345     + m->cs |= 3;
346     }
347     /* Use accurate RIP reporting if available. */
348     if (rip_msr)
349     diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
350     index 95e7fe1..9edc786 100644
351     --- a/arch/x86/kernel/cpu/perf_event_amd.c
352     +++ b/arch/x86/kernel/cpu/perf_event_amd.c
353     @@ -493,6 +493,7 @@ static __initconst const struct x86_pmu amd_pmu = {
354     * 0x023 DE PERF_CTL[2:0]
355     * 0x02D LS PERF_CTL[3]
356     * 0x02E LS PERF_CTL[3,0]
357     + * 0x031 LS PERF_CTL[2:0] (**)
358     * 0x043 CU PERF_CTL[2:0]
359     * 0x045 CU PERF_CTL[2:0]
360     * 0x046 CU PERF_CTL[2:0]
361     @@ -506,10 +507,12 @@ static __initconst const struct x86_pmu amd_pmu = {
362     * 0x0DD LS PERF_CTL[5:0]
363     * 0x0DE LS PERF_CTL[5:0]
364     * 0x0DF LS PERF_CTL[5:0]
365     + * 0x1C0 EX PERF_CTL[5:3]
366     * 0x1D6 EX PERF_CTL[5:0]
367     * 0x1D8 EX PERF_CTL[5:0]
368     *
369     - * (*) depending on the umask all FPU counters may be used
370     + * (*) depending on the umask all FPU counters may be used
371     + * (**) only one unitmask enabled at a time
372     */
373    
374     static struct event_constraint amd_f15_PMC0 = EVENT_CONSTRAINT(0, 0x01, 0);
375     @@ -559,6 +562,12 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *ev
376     return &amd_f15_PMC3;
377     case 0x02E:
378     return &amd_f15_PMC30;
379     + case 0x031:
380     + if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1)
381     + return &amd_f15_PMC20;
382     + return &emptyconstraint;
383     + case 0x1C0:
384     + return &amd_f15_PMC53;
385     default:
386     return &amd_f15_PMC50;
387     }
388     diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
389     index 7415aa9..56ab749 100644
390     --- a/arch/x86/pci/xen.c
391     +++ b/arch/x86/pci/xen.c
392     @@ -64,6 +64,10 @@ static int xen_register_pirq(u32 gsi, int gsi_override, int triggering,
393     int shareable = 0;
394     char *name;
395    
396     + irq = xen_irq_from_gsi(gsi);
397     + if (irq > 0)
398     + return irq;
399     +
400     if (set_pirq)
401     pirq = gsi;
402    
403     diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
404     index b43cfcd..b685296 100644
405     --- a/arch/x86/tools/relocs.c
406     +++ b/arch/x86/tools/relocs.c
407     @@ -60,6 +60,18 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
408     "__x86_cpu_dev_(start|end)|"
409     "(__parainstructions|__alt_instructions)(|_end)|"
410     "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
411     + "__(start|end)_pci_.*|"
412     + "__(start|end)_builtin_fw|"
413     + "__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl|_gpl_future)|"
414     + "__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl|_gpl_future)|"
415     + "__(start|stop)___param|"
416     + "__(start|stop)___modver|"
417     + "__(start|stop)___bug_table|"
418     + "__tracedata_(start|end)|"
419     + "__(start|stop)_notes|"
420     + "__end_rodata|"
421     + "__initramfs_start|"
422     + "(jiffies|jiffies_64)|"
423     "_end)$"
424     };
425    
426     diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
427     index e6568c1..5a1817e 100644
428     --- a/drivers/gpio/gpio-mpc8xxx.c
429     +++ b/drivers/gpio/gpio-mpc8xxx.c
430     @@ -163,7 +163,8 @@ static void mpc8xxx_gpio_irq_cascade(unsigned int irq, struct irq_desc *desc)
431     if (mask)
432     generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
433     32 - ffs(mask)));
434     - chip->irq_eoi(&desc->irq_data);
435     + if (chip->irq_eoi)
436     + chip->irq_eoi(&desc->irq_data);
437     }
438    
439     static void mpc8xxx_irq_unmask(struct irq_data *d)
440     diff --git a/drivers/gpu/drm/gma500/psb_device.c b/drivers/gpu/drm/gma500/psb_device.c
441     index 95d163e..328a193 100644
442     --- a/drivers/gpu/drm/gma500/psb_device.c
443     +++ b/drivers/gpu/drm/gma500/psb_device.c
444     @@ -197,7 +197,8 @@ static int psb_save_display_registers(struct drm_device *dev)
445     }
446    
447     list_for_each_entry(connector, &dev->mode_config.connector_list, head)
448     - connector->funcs->save(connector);
449     + if (connector->funcs->save)
450     + connector->funcs->save(connector);
451    
452     mutex_unlock(&dev->mode_config.mutex);
453     return 0;
454     @@ -235,7 +236,8 @@ static int psb_restore_display_registers(struct drm_device *dev)
455     crtc->funcs->restore(crtc);
456    
457     list_for_each_entry(connector, &dev->mode_config.connector_list, head)
458     - connector->funcs->restore(connector);
459     + if (connector->funcs->restore)
460     + connector->funcs->restore(connector);
461    
462     mutex_unlock(&dev->mode_config.mutex);
463     return 0;
464     diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
465     index afd4e03..f57e5cf 100644
466     --- a/drivers/gpu/drm/i915/i915_irq.c
467     +++ b/drivers/gpu/drm/i915/i915_irq.c
468     @@ -424,14 +424,11 @@ static void gen6_pm_rps_work(struct work_struct *work)
469     mutex_unlock(&dev_priv->dev->struct_mutex);
470     }
471    
472     -static void pch_irq_handler(struct drm_device *dev)
473     +static void pch_irq_handler(struct drm_device *dev, u32 pch_iir)
474     {
475     drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
476     - u32 pch_iir;
477     int pipe;
478    
479     - pch_iir = I915_READ(SDEIIR);
480     -
481     if (pch_iir & SDE_AUDIO_POWER_MASK)
482     DRM_DEBUG_DRIVER("PCH audio power change on port %d\n",
483     (pch_iir & SDE_AUDIO_POWER_MASK) >>
484     @@ -529,7 +526,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
485     if (de_iir & DE_PCH_EVENT_IVB) {
486     if (pch_iir & SDE_HOTPLUG_MASK_CPT)
487     queue_work(dev_priv->wq, &dev_priv->hotplug_work);
488     - pch_irq_handler(dev);
489     + pch_irq_handler(dev, pch_iir);
490     }
491    
492     if (pm_iir & GEN6_PM_DEFERRED_EVENTS) {
493     @@ -629,7 +626,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
494     if (de_iir & DE_PCH_EVENT) {
495     if (pch_iir & hotplug_mask)
496     queue_work(dev_priv->wq, &dev_priv->hotplug_work);
497     - pch_irq_handler(dev);
498     + pch_irq_handler(dev, pch_iir);
499     }
500    
501     if (de_iir & DE_PCU_EVENT) {
502     diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
503     index 9d24d65..29bfd89 100644
504     --- a/drivers/gpu/drm/i915/i915_reg.h
505     +++ b/drivers/gpu/drm/i915/i915_reg.h
506     @@ -615,6 +615,21 @@
507    
508     #define GEN6_BSD_RNCID 0x12198
509    
510     +#define GEN7_FF_THREAD_MODE 0x20a0
511     +#define GEN7_FF_SCHED_MASK 0x0077070
512     +#define GEN7_FF_TS_SCHED_HS1 (0x5<<16)
513     +#define GEN7_FF_TS_SCHED_HS0 (0x3<<16)
514     +#define GEN7_FF_TS_SCHED_LOAD_BALANCE (0x1<<16)
515     +#define GEN7_FF_TS_SCHED_HW (0x0<<16) /* Default */
516     +#define GEN7_FF_VS_SCHED_HS1 (0x5<<12)
517     +#define GEN7_FF_VS_SCHED_HS0 (0x3<<12)
518     +#define GEN7_FF_VS_SCHED_LOAD_BALANCE (0x1<<12) /* Default */
519     +#define GEN7_FF_VS_SCHED_HW (0x0<<12)
520     +#define GEN7_FF_DS_SCHED_HS1 (0x5<<4)
521     +#define GEN7_FF_DS_SCHED_HS0 (0x3<<4)
522     +#define GEN7_FF_DS_SCHED_LOAD_BALANCE (0x1<<4) /* Default */
523     +#define GEN7_FF_DS_SCHED_HW (0x0<<4)
524     +
525     /*
526     * Framebuffer compression (915+ only)
527     */
528     diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
529     index 1b1cf3b..79a7de1 100644
530     --- a/drivers/gpu/drm/i915/intel_display.c
531     +++ b/drivers/gpu/drm/i915/intel_display.c
532     @@ -7617,10 +7617,11 @@ static void intel_sanitize_modesetting(struct drm_device *dev,
533     {
534     struct drm_i915_private *dev_priv = dev->dev_private;
535     u32 reg, val;
536     + int i;
537    
538     /* Clear any frame start delays used for debugging left by the BIOS */
539     - for_each_pipe(pipe) {
540     - reg = PIPECONF(pipe);
541     + for_each_pipe(i) {
542     + reg = PIPECONF(i);
543     I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
544     }
545    
546     @@ -8612,6 +8613,18 @@ static void gen6_init_clock_gating(struct drm_device *dev)
547     }
548     }
549    
550     +static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
551     +{
552     + uint32_t reg = I915_READ(GEN7_FF_THREAD_MODE);
553     +
554     + reg &= ~GEN7_FF_SCHED_MASK;
555     + reg |= GEN7_FF_TS_SCHED_HW;
556     + reg |= GEN7_FF_VS_SCHED_HW;
557     + reg |= GEN7_FF_DS_SCHED_HW;
558     +
559     + I915_WRITE(GEN7_FF_THREAD_MODE, reg);
560     +}
561     +
562     static void ivybridge_init_clock_gating(struct drm_device *dev)
563     {
564     struct drm_i915_private *dev_priv = dev->dev_private;
565     @@ -8656,6 +8669,8 @@ static void ivybridge_init_clock_gating(struct drm_device *dev)
566     DISPPLANE_TRICKLE_FEED_DISABLE);
567     intel_flush_display_plane(dev_priv, pipe);
568     }
569     +
570     + gen7_setup_fixed_func_scheduler(dev_priv);
571     }
572    
573     static void g4x_init_clock_gating(struct drm_device *dev)
574     diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
575     index 7d15a77..12ce044 100644
576     --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
577     +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
578     @@ -1030,7 +1030,7 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
579    
580     nvbo->placement.fpfn = 0;
581     nvbo->placement.lpfn = dev_priv->fb_mappable_pages;
582     - nouveau_bo_placement_set(nvbo, TTM_PL_VRAM, 0);
583     + nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0);
584     return nouveau_bo_validate(nvbo, false, true, false);
585     }
586    
587     diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
588     index 2b56efc..d44ea58 100644
589     --- a/drivers/hid/hid-logitech-dj.c
590     +++ b/drivers/hid/hid-logitech-dj.c
591     @@ -26,6 +26,7 @@
592     #include <linux/hid.h>
593     #include <linux/module.h>
594     #include <linux/usb.h>
595     +#include <asm/unaligned.h>
596     #include "usbhid/usbhid.h"
597     #include "hid-ids.h"
598     #include "hid-logitech-dj.h"
599     @@ -265,8 +266,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
600     goto dj_device_allocate_fail;
601     }
602    
603     - dj_dev->reports_supported = le32_to_cpu(
604     - dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
605     + dj_dev->reports_supported = get_unaligned_le32(
606     + dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
607     dj_dev->hdev = dj_hiddev;
608     dj_dev->dj_receiver_dev = djrcv_dev;
609     dj_dev->device_index = dj_report->device_index;
610     diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
611     index cac3589..84e2fbe 100644
612     --- a/drivers/hid/hid-wiimote-core.c
613     +++ b/drivers/hid/hid-wiimote-core.c
614     @@ -769,7 +769,7 @@ static void __ir_to_input(struct wiimote_data *wdata, const __u8 *ir,
615    
616     /*
617     * Basic IR data is encoded into 3 bytes. The first two bytes are the
618     - * upper 8 bit of the X/Y data, the 3rd byte contains the lower 2 bits
619     + * lower 8 bit of the X/Y data, the 3rd byte contains the upper 2 bits
620     * of both.
621     * If data is packed, then the 3rd byte is put first and slightly
622     * reordered. This allows to interleave packed and non-packed data to
623     @@ -778,17 +778,11 @@ static void __ir_to_input(struct wiimote_data *wdata, const __u8 *ir,
624     */
625    
626     if (packed) {
627     - x = ir[1] << 2;
628     - y = ir[2] << 2;
629     -
630     - x |= ir[0] & 0x3;
631     - y |= (ir[0] >> 2) & 0x3;
632     + x = ir[1] | ((ir[0] & 0x03) << 8);
633     + y = ir[2] | ((ir[0] & 0x0c) << 6);
634     } else {
635     - x = ir[0] << 2;
636     - y = ir[1] << 2;
637     -
638     - x |= (ir[2] >> 4) & 0x3;
639     - y |= (ir[2] >> 6) & 0x3;
640     + x = ir[0] | ((ir[2] & 0x30) << 4);
641     + y = ir[1] | ((ir[2] & 0xc0) << 2);
642     }
643    
644     input_report_abs(wdata->ir, xid, x);
645     diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
646     index 5bf91db..4bbb883 100644
647     --- a/drivers/hid/usbhid/hid-core.c
648     +++ b/drivers/hid/usbhid/hid-core.c
649     @@ -399,6 +399,16 @@ static int hid_submit_ctrl(struct hid_device *hid)
650     * Output interrupt completion handler.
651     */
652    
653     +static int irq_out_pump_restart(struct hid_device *hid)
654     +{
655     + struct usbhid_device *usbhid = hid->driver_data;
656     +
657     + if (usbhid->outhead != usbhid->outtail)
658     + return hid_submit_out(hid);
659     + else
660     + return -1;
661     +}
662     +
663     static void hid_irq_out(struct urb *urb)
664     {
665     struct hid_device *hid = urb->context;
666     @@ -428,7 +438,7 @@ static void hid_irq_out(struct urb *urb)
667     else
668     usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1);
669    
670     - if (usbhid->outhead != usbhid->outtail && !hid_submit_out(hid)) {
671     + if (!irq_out_pump_restart(hid)) {
672     /* Successfully submitted next urb in queue */
673     spin_unlock_irqrestore(&usbhid->lock, flags);
674     return;
675     @@ -443,6 +453,15 @@ static void hid_irq_out(struct urb *urb)
676     /*
677     * Control pipe completion handler.
678     */
679     +static int ctrl_pump_restart(struct hid_device *hid)
680     +{
681     + struct usbhid_device *usbhid = hid->driver_data;
682     +
683     + if (usbhid->ctrlhead != usbhid->ctrltail)
684     + return hid_submit_ctrl(hid);
685     + else
686     + return -1;
687     +}
688    
689     static void hid_ctrl(struct urb *urb)
690     {
691     @@ -476,7 +495,7 @@ static void hid_ctrl(struct urb *urb)
692     else
693     usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1);
694    
695     - if (usbhid->ctrlhead != usbhid->ctrltail && !hid_submit_ctrl(hid)) {
696     + if (!ctrl_pump_restart(hid)) {
697     /* Successfully submitted next urb in queue */
698     spin_unlock(&usbhid->lock);
699     return;
700     @@ -535,11 +554,27 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
701     * the queue is known to run
702     * but an earlier request may be stuck
703     * we may need to time out
704     - * no race because this is called under
705     + * no race because the URB is blocked under
706     * spinlock
707     */
708     - if (time_after(jiffies, usbhid->last_out + HZ * 5))
709     + if (time_after(jiffies, usbhid->last_out + HZ * 5)) {
710     + usb_block_urb(usbhid->urbout);
711     + /* drop lock to not deadlock if the callback is called */
712     + spin_unlock(&usbhid->lock);
713     usb_unlink_urb(usbhid->urbout);
714     + spin_lock(&usbhid->lock);
715     + usb_unblock_urb(usbhid->urbout);
716     + /*
717     + * if the unlinking has already completed
718     + * the pump will have been stopped
719     + * it must be restarted now
720     + */
721     + if (!test_bit(HID_OUT_RUNNING, &usbhid->iofl))
722     + if (!irq_out_pump_restart(hid))
723     + set_bit(HID_OUT_RUNNING, &usbhid->iofl);
724     +
725     +
726     + }
727     }
728     return;
729     }
730     @@ -583,11 +618,25 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
731     * the queue is known to run
732     * but an earlier request may be stuck
733     * we may need to time out
734     - * no race because this is called under
735     + * no race because the URB is blocked under
736     * spinlock
737     */
738     - if (time_after(jiffies, usbhid->last_ctrl + HZ * 5))
739     + if (time_after(jiffies, usbhid->last_ctrl + HZ * 5)) {
740     + usb_block_urb(usbhid->urbctrl);
741     + /* drop lock to not deadlock if the callback is called */
742     + spin_unlock(&usbhid->lock);
743     usb_unlink_urb(usbhid->urbctrl);
744     + spin_lock(&usbhid->lock);
745     + usb_unblock_urb(usbhid->urbctrl);
746     + /*
747     + * if the unlinking has already completed
748     + * the pump will have been stopped
749     + * it must be restarted now
750     + */
751     + if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl))
752     + if (!ctrl_pump_restart(hid))
753     + set_bit(HID_CTRL_RUNNING, &usbhid->iofl);
754     + }
755     }
756     }
757    
758     diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
759     index a76d85f..79b4bcb 100644
760     --- a/drivers/i2c/busses/i2c-davinci.c
761     +++ b/drivers/i2c/busses/i2c-davinci.c
762     @@ -755,7 +755,7 @@ static int davinci_i2c_remove(struct platform_device *pdev)
763     dev->clk = NULL;
764    
765     davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
766     - free_irq(IRQ_I2C, dev);
767     + free_irq(dev->irq, dev);
768     iounmap(dev->base);
769     kfree(dev);
770    
771     diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
772     index 55e5ea6..df19f3d 100644
773     --- a/drivers/i2c/busses/i2c-tegra.c
774     +++ b/drivers/i2c/busses/i2c-tegra.c
775     @@ -401,8 +401,6 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
776     disable_irq_nosync(i2c_dev->irq);
777     i2c_dev->irq_disabled = 1;
778     }
779     -
780     - complete(&i2c_dev->msg_complete);
781     goto err;
782     }
783    
784     @@ -411,7 +409,6 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
785     i2c_dev->msg_err |= I2C_ERR_NO_ACK;
786     if (status & I2C_INT_ARBITRATION_LOST)
787     i2c_dev->msg_err |= I2C_ERR_ARBITRATION_LOST;
788     - complete(&i2c_dev->msg_complete);
789     goto err;
790     }
791    
792     @@ -429,14 +426,14 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
793     tegra_i2c_mask_irq(i2c_dev, I2C_INT_TX_FIFO_DATA_REQ);
794     }
795    
796     + i2c_writel(i2c_dev, status, I2C_INT_STATUS);
797     + if (i2c_dev->is_dvc)
798     + dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
799     +
800     if (status & I2C_INT_PACKET_XFER_COMPLETE) {
801     BUG_ON(i2c_dev->msg_buf_remaining);
802     complete(&i2c_dev->msg_complete);
803     }
804     -
805     - i2c_writel(i2c_dev, status, I2C_INT_STATUS);
806     - if (i2c_dev->is_dvc)
807     - dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
808     return IRQ_HANDLED;
809     err:
810     /* An error occurred, mask all interrupts */
811     @@ -446,6 +443,8 @@ err:
812     i2c_writel(i2c_dev, status, I2C_INT_STATUS);
813     if (i2c_dev->is_dvc)
814     dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
815     +
816     + complete(&i2c_dev->msg_complete);
817     return IRQ_HANDLED;
818     }
819    
820     diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
821     index 71f0c0f..a841123 100644
822     --- a/drivers/infiniband/core/umem.c
823     +++ b/drivers/infiniband/core/umem.c
824     @@ -269,7 +269,7 @@ void ib_umem_release(struct ib_umem *umem)
825     } else
826     down_write(&mm->mmap_sem);
827    
828     - current->mm->locked_vm -= diff;
829     + current->mm->pinned_vm -= diff;
830     up_write(&mm->mmap_sem);
831     mmput(mm);
832     kfree(umem);
833     diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
834     index 92b4c2b..4c7c62f 100644
835     --- a/drivers/infiniband/hw/cxgb4/cm.c
836     +++ b/drivers/infiniband/hw/cxgb4/cm.c
837     @@ -1593,7 +1593,7 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst,
838     n, n->dev, 0);
839     if (!ep->l2t)
840     goto out;
841     - ep->mtu = dst_mtu(ep->dst);
842     + ep->mtu = dst_mtu(dst);
843     ep->tx_chan = cxgb4_port_chan(n->dev);
844     ep->smac_idx = (cxgb4_port_viid(n->dev) & 0x7F) << 1;
845     step = cdev->rdev.lldi.ntxq /
846     @@ -2656,6 +2656,12 @@ static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb)
847     unsigned int tid = GET_TID(req);
848    
849     ep = lookup_tid(t, tid);
850     + if (!ep) {
851     + printk(KERN_WARNING MOD
852     + "Abort on non-existent endpoint, tid %d\n", tid);
853     + kfree_skb(skb);
854     + return 0;
855     + }
856     if (is_neg_adv_abort(req->status)) {
857     PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep,
858     ep->hwtid);
859     @@ -2667,11 +2673,8 @@ static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb)
860    
861     /*
862     * Wake up any threads in rdma_init() or rdma_fini().
863     - * However, this is not needed if com state is just
864     - * MPA_REQ_SENT
865     */
866     - if (ep->com.state != MPA_REQ_SENT)
867     - c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
868     + c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
869     sched(dev, skb);
870     return 0;
871     }
872     diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
873     index 35c1e17..97b2e21 100644
874     --- a/drivers/iommu/dmar.c
875     +++ b/drivers/iommu/dmar.c
876     @@ -1056,8 +1056,8 @@ static const char *intr_remap_fault_reasons[] =
877    
878     const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
879     {
880     - if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
881     - ARRAY_SIZE(intr_remap_fault_reasons))) {
882     + if (fault_reason >= 0x20 && (fault_reason - 0x20 <
883     + ARRAY_SIZE(intr_remap_fault_reasons))) {
884     *fault_type = INTR_REMAP;
885     return intr_remap_fault_reasons[fault_reason - 0x20];
886     } else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {
887     diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
888     index f93d5ac..5fda348 100644
889     --- a/drivers/iommu/intel-iommu.c
890     +++ b/drivers/iommu/intel-iommu.c
891     @@ -2286,12 +2286,6 @@ static int domain_add_dev_info(struct dmar_domain *domain,
892     if (!info)
893     return -ENOMEM;
894    
895     - ret = domain_context_mapping(domain, pdev, translation);
896     - if (ret) {
897     - free_devinfo_mem(info);
898     - return ret;
899     - }
900     -
901     info->segment = pci_domain_nr(pdev->bus);
902     info->bus = pdev->bus->number;
903     info->devfn = pdev->devfn;
904     @@ -2304,6 +2298,17 @@ static int domain_add_dev_info(struct dmar_domain *domain,
905     pdev->dev.archdata.iommu = info;
906     spin_unlock_irqrestore(&device_domain_lock, flags);
907    
908     + ret = domain_context_mapping(domain, pdev, translation);
909     + if (ret) {
910     + spin_lock_irqsave(&device_domain_lock, flags);
911     + list_del(&info->link);
912     + list_del(&info->global);
913     + pdev->dev.archdata.iommu = NULL;
914     + spin_unlock_irqrestore(&device_domain_lock, flags);
915     + free_devinfo_mem(info);
916     + return ret;
917     + }
918     +
919     return 0;
920     }
921    
922     diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
923     index 343b5c8..579aa02 100644
924     --- a/drivers/isdn/gigaset/capi.c
925     +++ b/drivers/isdn/gigaset/capi.c
926     @@ -14,6 +14,7 @@
927     #include "gigaset.h"
928     #include <linux/proc_fs.h>
929     #include <linux/seq_file.h>
930     +#include <linux/ratelimit.h>
931     #include <linux/isdn/capilli.h>
932     #include <linux/isdn/capicmd.h>
933     #include <linux/isdn/capiutil.h>
934     @@ -223,10 +224,14 @@ get_appl(struct gigaset_capi_ctr *iif, u16 appl)
935     static inline void dump_cmsg(enum debuglevel level, const char *tag, _cmsg *p)
936     {
937     #ifdef CONFIG_GIGASET_DEBUG
938     + /* dump at most 20 messages in 20 secs */
939     + static DEFINE_RATELIMIT_STATE(msg_dump_ratelimit, 20 * HZ, 20);
940     _cdebbuf *cdb;
941    
942     if (!(gigaset_debuglevel & level))
943     return;
944     + if (!___ratelimit(&msg_dump_ratelimit, tag))
945     + return;
946    
947     cdb = capi_cmsg2str(p);
948     if (cdb) {
949     @@ -1882,6 +1887,9 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
950    
951     /* check for active logical connection */
952     if (bcs->apconnstate >= APCONN_ACTIVE) {
953     + /* clear it */
954     + bcs->apconnstate = APCONN_SETUP;
955     +
956     /*
957     * emit DISCONNECT_B3_IND with cause 0x3301
958     * use separate cmsg structure, as the content of iif->acmsg
959     @@ -1906,6 +1914,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
960     }
961     capi_cmsg2message(b3cmsg,
962     __skb_put(b3skb, CAPI_DISCONNECT_B3_IND_BASELEN));
963     + dump_cmsg(DEBUG_CMD, __func__, b3cmsg);
964     kfree(b3cmsg);
965     capi_ctr_handle_message(&iif->ctr, ap->id, b3skb);
966     }
967     @@ -2059,12 +2068,6 @@ static void do_reset_b3_req(struct gigaset_capi_ctr *iif,
968     }
969    
970     /*
971     - * dump unsupported/ignored messages at most twice per minute,
972     - * some apps send those very frequently
973     - */
974     -static unsigned long ignored_msg_dump_time;
975     -
976     -/*
977     * unsupported CAPI message handler
978     */
979     static void do_unsupported(struct gigaset_capi_ctr *iif,
980     @@ -2073,8 +2076,7 @@ static void do_unsupported(struct gigaset_capi_ctr *iif,
981     {
982     /* decode message */
983     capi_message2cmsg(&iif->acmsg, skb->data);
984     - if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000))
985     - dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
986     + dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
987     send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState);
988     }
989    
990     @@ -2085,11 +2087,9 @@ static void do_nothing(struct gigaset_capi_ctr *iif,
991     struct gigaset_capi_appl *ap,
992     struct sk_buff *skb)
993     {
994     - if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000)) {
995     - /* decode message */
996     - capi_message2cmsg(&iif->acmsg, skb->data);
997     - dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
998     - }
999     + /* decode message */
1000     + capi_message2cmsg(&iif->acmsg, skb->data);
1001     + dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
1002     dev_kfree_skb_any(skb);
1003     }
1004    
1005     diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
1006     index 624a825..685638a 100644
1007     --- a/drivers/isdn/gigaset/ev-layer.c
1008     +++ b/drivers/isdn/gigaset/ev-layer.c
1009     @@ -190,6 +190,7 @@ struct reply_t gigaset_tab_nocid[] =
1010     ACT_INIT} },
1011     {RSP_OK, 121, 121, -1, 0, 0, {ACT_GOTVER,
1012     ACT_INIT} },
1013     + {RSP_NONE, 121, 121, -1, 120, 0, {ACT_GETSTRING} },
1014    
1015     /* leave dle mode */
1016     {RSP_INIT, 0, 0, SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"},
1017     @@ -1314,8 +1315,9 @@ static void do_action(int action, struct cardstate *cs,
1018     s = ev->ptr;
1019    
1020     if (!strcmp(s, "OK")) {
1021     + /* OK without version string: assume old response */
1022     *p_genresp = 1;
1023     - *p_resp_code = RSP_ERROR;
1024     + *p_resp_code = RSP_NONE;
1025     break;
1026     }
1027    
1028     diff --git a/drivers/md/md.c b/drivers/md/md.c
1029     index 01233d8..2b30ffd 100644
1030     --- a/drivers/md/md.c
1031     +++ b/drivers/md/md.c
1032     @@ -452,7 +452,7 @@ static void submit_flushes(struct work_struct *ws)
1033     atomic_inc(&rdev->nr_pending);
1034     atomic_inc(&rdev->nr_pending);
1035     rcu_read_unlock();
1036     - bi = bio_alloc_mddev(GFP_KERNEL, 0, mddev);
1037     + bi = bio_alloc_mddev(GFP_NOIO, 0, mddev);
1038     bi->bi_end_io = md_end_flush;
1039     bi->bi_private = rdev;
1040     bi->bi_bdev = rdev->bdev;
1041     diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
1042     index b1fe513..63c004a 100644
1043     --- a/drivers/media/dvb/siano/smsusb.c
1044     +++ b/drivers/media/dvb/siano/smsusb.c
1045     @@ -542,6 +542,8 @@ static const struct usb_device_id smsusb_id_table[] __devinitconst = {
1046     .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
1047     { USB_DEVICE(0x2040, 0xc090),
1048     .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
1049     + { USB_DEVICE(0x2040, 0xc0a0),
1050     + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
1051     { } /* Terminating entry */
1052     };
1053    
1054     diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
1055     index ff2cddd..53ab972 100644
1056     --- a/drivers/media/video/uvc/uvc_v4l2.c
1057     +++ b/drivers/media/video/uvc/uvc_v4l2.c
1058     @@ -687,7 +687,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1059     break;
1060     }
1061     pin = iterm->id;
1062     - } else if (pin < selector->bNrInPins) {
1063     + } else if (index < selector->bNrInPins) {
1064     pin = selector->baSourceID[index];
1065     list_for_each_entry(iterm, &chain->entities, chain) {
1066     if (!UVC_ENTITY_IS_ITERM(iterm))
1067     diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
1068     index 2c14be7..f13e38d 100644
1069     --- a/drivers/mmc/core/cd-gpio.c
1070     +++ b/drivers/mmc/core/cd-gpio.c
1071     @@ -73,6 +73,9 @@ void mmc_cd_gpio_free(struct mmc_host *host)
1072     {
1073     struct mmc_cd_gpio *cd = host->hotplug.handler_priv;
1074    
1075     + if (!cd)
1076     + return;
1077     +
1078     free_irq(host->hotplug.irq, host);
1079     gpio_free(cd->gpio);
1080     kfree(cd);
1081     diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
1082     index 2c7c83f..13d0e95 100644
1083     --- a/drivers/mmc/core/sdio.c
1084     +++ b/drivers/mmc/core/sdio.c
1085     @@ -947,7 +947,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
1086     }
1087    
1088     if (!err && host->sdio_irqs)
1089     - mmc_signal_sdio_irq(host);
1090     + wake_up_process(host->sdio_irq_thread);
1091     mmc_release_host(host);
1092    
1093     /*
1094     diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
1095     index f573e7f..3d8ceb4 100644
1096     --- a/drivers/mmc/core/sdio_irq.c
1097     +++ b/drivers/mmc/core/sdio_irq.c
1098     @@ -28,18 +28,20 @@
1099    
1100     #include "sdio_ops.h"
1101    
1102     -static int process_sdio_pending_irqs(struct mmc_card *card)
1103     +static int process_sdio_pending_irqs(struct mmc_host *host)
1104     {
1105     + struct mmc_card *card = host->card;
1106     int i, ret, count;
1107     unsigned char pending;
1108     struct sdio_func *func;
1109    
1110     /*
1111     * Optimization, if there is only 1 function interrupt registered
1112     - * call irq handler directly
1113     + * and we know an IRQ was signaled then call irq handler directly.
1114     + * Otherwise do the full probe.
1115     */
1116     func = card->sdio_single_irq;
1117     - if (func) {
1118     + if (func && host->sdio_irq_pending) {
1119     func->irq_handler(func);
1120     return 1;
1121     }
1122     @@ -116,7 +118,8 @@ static int sdio_irq_thread(void *_host)
1123     ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
1124     if (ret)
1125     break;
1126     - ret = process_sdio_pending_irqs(host->card);
1127     + ret = process_sdio_pending_irqs(host);
1128     + host->sdio_irq_pending = false;
1129     mmc_release_host(host);
1130    
1131     /*
1132     diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
1133     index 56d4499..71a0c4e 100644
1134     --- a/drivers/mmc/host/omap_hsmmc.c
1135     +++ b/drivers/mmc/host/omap_hsmmc.c
1136     @@ -1969,7 +1969,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
1137     ret = request_threaded_irq(mmc_slot(host).card_detect_irq,
1138     NULL,
1139     omap_hsmmc_detect,
1140     - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1141     + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
1142     mmc_hostname(mmc), host);
1143     if (ret) {
1144     dev_dbg(mmc_dev(host->mmc),
1145     diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
1146     index df7e16d..a98db30 100644
1147     --- a/drivers/net/wireless/b43legacy/main.c
1148     +++ b/drivers/net/wireless/b43legacy/main.c
1149     @@ -1571,8 +1571,6 @@ static void b43legacy_request_firmware(struct work_struct *work)
1150     const char *filename;
1151     int err;
1152    
1153     - /* do dummy read */
1154     - ssb_read32(dev->dev, SSB_TMSHIGH);
1155     if (!fw->ucode) {
1156     if (rev == 2)
1157     filename = "ucode2";
1158     diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
1159     index 046fb1b..c18f0fd 100644
1160     --- a/drivers/regulator/core.c
1161     +++ b/drivers/regulator/core.c
1162     @@ -2971,6 +2971,8 @@ unset_supplies:
1163     unset_regulator_supplies(rdev);
1164    
1165     scrub:
1166     + if (rdev->supply)
1167     + regulator_put(rdev->supply);
1168     kfree(rdev->constraints);
1169     device_unregister(&rdev->dev);
1170     /* device core frees rdev */
1171     diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
1172     index 5137db5..bc6cf88 100644
1173     --- a/drivers/scsi/isci/init.c
1174     +++ b/drivers/scsi/isci/init.c
1175     @@ -476,7 +476,7 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic
1176     if (!orom)
1177     orom = isci_request_oprom(pdev);
1178    
1179     - for (i = 0; orom && i < ARRAY_SIZE(orom->ctrl); i++) {
1180     + for (i = 0; orom && i < num_controllers(pdev); i++) {
1181     if (sci_oem_parameters_validate(&orom->ctrl[i],
1182     orom->hdr.version)) {
1183     dev_warn(&pdev->dev,
1184     diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
1185     index 8a59a77..1808478 100644
1186     --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
1187     +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
1188     @@ -3343,7 +3343,7 @@ _base_get_port_facts(struct MPT2SAS_ADAPTER *ioc, int port, int sleep_flag)
1189     }
1190    
1191     pfacts = &ioc->pfacts[port];
1192     - memset(pfacts, 0, sizeof(Mpi2PortFactsReply_t));
1193     + memset(pfacts, 0, sizeof(struct mpt2sas_port_facts));
1194     pfacts->PortNumber = mpi_reply.PortNumber;
1195     pfacts->VP_ID = mpi_reply.VP_ID;
1196     pfacts->VF_ID = mpi_reply.VF_ID;
1197     @@ -3385,7 +3385,7 @@ _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
1198     }
1199    
1200     facts = &ioc->facts;
1201     - memset(facts, 0, sizeof(Mpi2IOCFactsReply_t));
1202     + memset(facts, 0, sizeof(struct mpt2sas_facts));
1203     facts->MsgVersion = le16_to_cpu(mpi_reply.MsgVersion);
1204     facts->HeaderVersion = le16_to_cpu(mpi_reply.HeaderVersion);
1205     facts->VP_ID = mpi_reply.VP_ID;
1206     @@ -4262,7 +4262,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
1207     goto out_free_resources;
1208    
1209     ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts,
1210     - sizeof(Mpi2PortFactsReply_t), GFP_KERNEL);
1211     + sizeof(struct mpt2sas_port_facts), GFP_KERNEL);
1212     if (!ioc->pfacts) {
1213     r = -ENOMEM;
1214     goto out_free_resources;
1215     diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
1216     index 5f748c0..6a62934 100644
1217     --- a/drivers/spi/spi-fsl-spi.c
1218     +++ b/drivers/spi/spi-fsl-spi.c
1219     @@ -933,7 +933,7 @@ err:
1220    
1221     static void fsl_spi_cs_control(struct spi_device *spi, bool on)
1222     {
1223     - struct device *dev = spi->dev.parent;
1224     + struct device *dev = spi->dev.parent->parent;
1225     struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev->platform_data);
1226     u16 cs = spi->chip_select;
1227     int gpio = pinfo->gpios[cs];
1228     diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c
1229     index 8d8c1e3..3d986ce 100644
1230     --- a/drivers/staging/android/persistent_ram.c
1231     +++ b/drivers/staging/android/persistent_ram.c
1232     @@ -79,23 +79,6 @@ static inline void buffer_size_add(struct persistent_ram_zone *prz, size_t a)
1233     } while (atomic_cmpxchg(&prz->buffer->size, old, new) != old);
1234     }
1235    
1236     -/* increase the size counter, retuning an error if it hits the max size */
1237     -static inline ssize_t buffer_size_add_clamp(struct persistent_ram_zone *prz,
1238     - size_t a)
1239     -{
1240     - size_t old;
1241     - size_t new;
1242     -
1243     - do {
1244     - old = atomic_read(&prz->buffer->size);
1245     - new = old + a;
1246     - if (new > prz->buffer_size)
1247     - return -ENOMEM;
1248     - } while (atomic_cmpxchg(&prz->buffer->size, old, new) != old);
1249     -
1250     - return 0;
1251     -}
1252     -
1253     static void notrace persistent_ram_encode_rs8(struct persistent_ram_zone *prz,
1254     uint8_t *data, size_t len, uint8_t *ecc)
1255     {
1256     @@ -300,7 +283,7 @@ int notrace persistent_ram_write(struct persistent_ram_zone *prz,
1257     c = prz->buffer_size;
1258     }
1259    
1260     - buffer_size_add_clamp(prz, c);
1261     + buffer_size_add(prz, c);
1262    
1263     start = buffer_start_add(prz, c);
1264    
1265     diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
1266     index 9bcf87a..a796964 100644
1267     --- a/drivers/staging/comedi/comedi_fops.c
1268     +++ b/drivers/staging/comedi/comedi_fops.c
1269     @@ -280,7 +280,7 @@ static int do_devconfig_ioctl(struct comedi_device *dev,
1270     if (ret == 0) {
1271     if (!try_module_get(dev->driver->module)) {
1272     comedi_device_detach(dev);
1273     - return -ENOSYS;
1274     + ret = -ENOSYS;
1275     }
1276     }
1277    
1278     diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
1279     index 83d5c88..d3d91da 100644
1280     --- a/drivers/tty/hvc/hvc_xen.c
1281     +++ b/drivers/tty/hvc/hvc_xen.c
1282     @@ -430,9 +430,9 @@ static int __devinit xencons_probe(struct xenbus_device *dev,
1283     if (devid == 0)
1284     return -ENODEV;
1285    
1286     - info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL | __GFP_ZERO);
1287     + info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
1288     if (!info)
1289     - goto error_nomem;
1290     + return -ENOMEM;
1291     dev_set_drvdata(&dev->dev, info);
1292     info->xbdev = dev;
1293     info->vtermno = xenbus_devid_to_vtermno(devid);
1294     diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
1295     index 5c27f7e..d537431 100644
1296     --- a/drivers/tty/serial/8250/8250.c
1297     +++ b/drivers/tty/serial/8250/8250.c
1298     @@ -2280,10 +2280,11 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
1299     quot++;
1300    
1301     if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) {
1302     - if (baud < 2400)
1303     - fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
1304     - else
1305     - fcr = uart_config[port->type].fcr;
1306     + fcr = uart_config[port->type].fcr;
1307     + if (baud < 2400) {
1308     + fcr &= ~UART_FCR_TRIGGER_MASK;
1309     + fcr |= UART_FCR_TRIGGER_1;
1310     + }
1311     }
1312    
1313     /*
1314     diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1315     index 858dca8..3614973 100644
1316     --- a/drivers/tty/serial/8250/8250_pci.c
1317     +++ b/drivers/tty/serial/8250/8250_pci.c
1318     @@ -1609,54 +1609,72 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1319     {
1320     .vendor = PCI_VENDOR_ID_INTEL,
1321     .device = 0x8811,
1322     + .subvendor = PCI_ANY_ID,
1323     + .subdevice = PCI_ANY_ID,
1324     .init = pci_eg20t_init,
1325     .setup = pci_default_setup,
1326     },
1327     {
1328     .vendor = PCI_VENDOR_ID_INTEL,
1329     .device = 0x8812,
1330     + .subvendor = PCI_ANY_ID,
1331     + .subdevice = PCI_ANY_ID,
1332     .init = pci_eg20t_init,
1333     .setup = pci_default_setup,
1334     },
1335     {
1336     .vendor = PCI_VENDOR_ID_INTEL,
1337     .device = 0x8813,
1338     + .subvendor = PCI_ANY_ID,
1339     + .subdevice = PCI_ANY_ID,
1340     .init = pci_eg20t_init,
1341     .setup = pci_default_setup,
1342     },
1343     {
1344     .vendor = PCI_VENDOR_ID_INTEL,
1345     .device = 0x8814,
1346     + .subvendor = PCI_ANY_ID,
1347     + .subdevice = PCI_ANY_ID,
1348     .init = pci_eg20t_init,
1349     .setup = pci_default_setup,
1350     },
1351     {
1352     .vendor = 0x10DB,
1353     .device = 0x8027,
1354     + .subvendor = PCI_ANY_ID,
1355     + .subdevice = PCI_ANY_ID,
1356     .init = pci_eg20t_init,
1357     .setup = pci_default_setup,
1358     },
1359     {
1360     .vendor = 0x10DB,
1361     .device = 0x8028,
1362     + .subvendor = PCI_ANY_ID,
1363     + .subdevice = PCI_ANY_ID,
1364     .init = pci_eg20t_init,
1365     .setup = pci_default_setup,
1366     },
1367     {
1368     .vendor = 0x10DB,
1369     .device = 0x8029,
1370     + .subvendor = PCI_ANY_ID,
1371     + .subdevice = PCI_ANY_ID,
1372     .init = pci_eg20t_init,
1373     .setup = pci_default_setup,
1374     },
1375     {
1376     .vendor = 0x10DB,
1377     .device = 0x800C,
1378     + .subvendor = PCI_ANY_ID,
1379     + .subdevice = PCI_ANY_ID,
1380     .init = pci_eg20t_init,
1381     .setup = pci_default_setup,
1382     },
1383     {
1384     .vendor = 0x10DB,
1385     .device = 0x800D,
1386     + .subvendor = PCI_ANY_ID,
1387     + .subdevice = PCI_ANY_ID,
1388     .init = pci_eg20t_init,
1389     .setup = pci_default_setup,
1390     },
1391     diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
1392     index 55fd362..039c054 100644
1393     --- a/drivers/tty/serial/mxs-auart.c
1394     +++ b/drivers/tty/serial/mxs-auart.c
1395     @@ -369,6 +369,8 @@ static void mxs_auart_settermios(struct uart_port *u,
1396    
1397     writel(ctrl, u->membase + AUART_LINECTRL);
1398     writel(ctrl2, u->membase + AUART_CTRL2);
1399     +
1400     + uart_update_timeout(u, termios->c_cflag, baud);
1401     }
1402    
1403     static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
1404     diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
1405     index 9c4c05b..246b823 100644
1406     --- a/drivers/tty/serial/serial_core.c
1407     +++ b/drivers/tty/serial/serial_core.c
1408     @@ -2282,6 +2282,7 @@ void uart_unregister_driver(struct uart_driver *drv)
1409     tty_unregister_driver(p);
1410     put_tty_driver(p);
1411     kfree(drv->state);
1412     + drv->state = NULL;
1413     drv->tty_driver = NULL;
1414     }
1415    
1416     diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
1417     index 0bb2b32..4c8321e 100644
1418     --- a/drivers/usb/class/cdc-wdm.c
1419     +++ b/drivers/usb/class/cdc-wdm.c
1420     @@ -309,9 +309,6 @@ static void free_urbs(struct wdm_device *desc)
1421    
1422     static void cleanup(struct wdm_device *desc)
1423     {
1424     - spin_lock(&wdm_device_list_lock);
1425     - list_del(&desc->device_list);
1426     - spin_unlock(&wdm_device_list_lock);
1427     kfree(desc->sbuf);
1428     kfree(desc->inbuf);
1429     kfree(desc->orq);
1430     @@ -530,11 +527,13 @@ static int wdm_flush(struct file *file, fl_owner_t id)
1431     struct wdm_device *desc = file->private_data;
1432    
1433     wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
1434     - if (desc->werr < 0)
1435     +
1436     + /* cannot dereference desc->intf if WDM_DISCONNECTING */
1437     + if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags))
1438     dev_err(&desc->intf->dev, "Error in flush path: %d\n",
1439     desc->werr);
1440    
1441     - return desc->werr;
1442     + return usb_translate_errors(desc->werr);
1443     }
1444    
1445     static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
1446     @@ -545,7 +544,7 @@ static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
1447    
1448     spin_lock_irqsave(&desc->iuspin, flags);
1449     if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
1450     - mask = POLLERR;
1451     + mask = POLLHUP | POLLERR;
1452     spin_unlock_irqrestore(&desc->iuspin, flags);
1453     goto desc_out;
1454     }
1455     @@ -621,10 +620,15 @@ static int wdm_release(struct inode *inode, struct file *file)
1456     mutex_unlock(&desc->wlock);
1457    
1458     if (!desc->count) {
1459     - dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
1460     - kill_urbs(desc);
1461     - if (!test_bit(WDM_DISCONNECTING, &desc->flags))
1462     + if (!test_bit(WDM_DISCONNECTING, &desc->flags)) {
1463     + dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
1464     + kill_urbs(desc);
1465     desc->manage_power(desc->intf, 0);
1466     + } else {
1467     + /* must avoid dev_printk here as desc->intf is invalid */
1468     + pr_debug(KBUILD_MODNAME " %s: device gone - cleaning up\n", __func__);
1469     + cleanup(desc);
1470     + }
1471     }
1472     mutex_unlock(&wdm_mutex);
1473     return 0;
1474     @@ -771,6 +775,9 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
1475     out:
1476     return rv;
1477     err:
1478     + spin_lock(&wdm_device_list_lock);
1479     + list_del(&desc->device_list);
1480     + spin_unlock(&wdm_device_list_lock);
1481     cleanup(desc);
1482     return rv;
1483     }
1484     @@ -896,6 +903,12 @@ static void wdm_disconnect(struct usb_interface *intf)
1485     cancel_work_sync(&desc->rxwork);
1486     mutex_unlock(&desc->wlock);
1487     mutex_unlock(&desc->rlock);
1488     +
1489     + /* the desc->intf pointer used as list key is now invalid */
1490     + spin_lock(&wdm_device_list_lock);
1491     + list_del(&desc->device_list);
1492     + spin_unlock(&wdm_device_list_lock);
1493     +
1494     if (!desc->count)
1495     cleanup(desc);
1496     mutex_unlock(&wdm_mutex);
1497     diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1498     index 8df4b76..4e57772 100644
1499     --- a/drivers/usb/core/devio.c
1500     +++ b/drivers/usb/core/devio.c
1501     @@ -333,17 +333,14 @@ static struct async *async_getcompleted(struct dev_state *ps)
1502     static struct async *async_getpending(struct dev_state *ps,
1503     void __user *userurb)
1504     {
1505     - unsigned long flags;
1506     struct async *as;
1507    
1508     - spin_lock_irqsave(&ps->lock, flags);
1509     list_for_each_entry(as, &ps->async_pending, asynclist)
1510     if (as->userurb == userurb) {
1511     list_del_init(&as->asynclist);
1512     - spin_unlock_irqrestore(&ps->lock, flags);
1513     return as;
1514     }
1515     - spin_unlock_irqrestore(&ps->lock, flags);
1516     +
1517     return NULL;
1518     }
1519    
1520     @@ -398,6 +395,7 @@ static void cancel_bulk_urbs(struct dev_state *ps, unsigned bulk_addr)
1521     __releases(ps->lock)
1522     __acquires(ps->lock)
1523     {
1524     + struct urb *urb;
1525     struct async *as;
1526    
1527     /* Mark all the pending URBs that match bulk_addr, up to but not
1528     @@ -420,8 +418,11 @@ __acquires(ps->lock)
1529     list_for_each_entry(as, &ps->async_pending, asynclist) {
1530     if (as->bulk_status == AS_UNLINK) {
1531     as->bulk_status = 0; /* Only once */
1532     + urb = as->urb;
1533     + usb_get_urb(urb);
1534     spin_unlock(&ps->lock); /* Allow completions */
1535     - usb_unlink_urb(as->urb);
1536     + usb_unlink_urb(urb);
1537     + usb_put_urb(urb);
1538     spin_lock(&ps->lock);
1539     goto rescan;
1540     }
1541     @@ -472,6 +473,7 @@ static void async_completed(struct urb *urb)
1542    
1543     static void destroy_async(struct dev_state *ps, struct list_head *list)
1544     {
1545     + struct urb *urb;
1546     struct async *as;
1547     unsigned long flags;
1548    
1549     @@ -479,10 +481,13 @@ static void destroy_async(struct dev_state *ps, struct list_head *list)
1550     while (!list_empty(list)) {
1551     as = list_entry(list->next, struct async, asynclist);
1552     list_del_init(&as->asynclist);
1553     + urb = as->urb;
1554     + usb_get_urb(urb);
1555    
1556     /* drop the spinlock so the completion handler can run */
1557     spin_unlock_irqrestore(&ps->lock, flags);
1558     - usb_kill_urb(as->urb);
1559     + usb_kill_urb(urb);
1560     + usb_put_urb(urb);
1561     spin_lock_irqsave(&ps->lock, flags);
1562     }
1563     spin_unlock_irqrestore(&ps->lock, flags);
1564     @@ -1410,12 +1415,24 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg)
1565    
1566     static int proc_unlinkurb(struct dev_state *ps, void __user *arg)
1567     {
1568     + struct urb *urb;
1569     struct async *as;
1570     + unsigned long flags;
1571    
1572     + spin_lock_irqsave(&ps->lock, flags);
1573     as = async_getpending(ps, arg);
1574     - if (!as)
1575     + if (!as) {
1576     + spin_unlock_irqrestore(&ps->lock, flags);
1577     return -EINVAL;
1578     - usb_kill_urb(as->urb);
1579     + }
1580     +
1581     + urb = as->urb;
1582     + usb_get_urb(urb);
1583     + spin_unlock_irqrestore(&ps->lock, flags);
1584     +
1585     + usb_kill_urb(urb);
1586     + usb_put_urb(urb);
1587     +
1588     return 0;
1589     }
1590    
1591     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1592     index ec6c97d..c8e0704 100644
1593     --- a/drivers/usb/core/hub.c
1594     +++ b/drivers/usb/core/hub.c
1595     @@ -2499,6 +2499,10 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
1596     NULL, 0,
1597     USB_CTRL_SET_TIMEOUT);
1598    
1599     + /* Try to enable USB2 hardware LPM again */
1600     + if (udev->usb2_hw_lpm_capable == 1)
1601     + usb_set_usb2_hardware_lpm(udev, 1);
1602     +
1603     /* System sleep transitions should never fail */
1604     if (!PMSG_IS_AUTO(msg))
1605     status = 0;
1606     diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1607     index 4c65eb6..32d3adc 100644
1608     --- a/drivers/usb/core/quirks.c
1609     +++ b/drivers/usb/core/quirks.c
1610     @@ -123,6 +123,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1611     /* Guillemot Webcam Hercules Dualpix Exchange*/
1612     { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
1613    
1614     + /* Midiman M-Audio Keystation 88es */
1615     + { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
1616     +
1617     /* M-Systems Flash Disk Pioneers */
1618     { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
1619    
1620     diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
1621     index cd9b3a2..9d912bf 100644
1622     --- a/drivers/usb/core/urb.c
1623     +++ b/drivers/usb/core/urb.c
1624     @@ -681,6 +681,27 @@ void usb_unpoison_urb(struct urb *urb)
1625     EXPORT_SYMBOL_GPL(usb_unpoison_urb);
1626    
1627     /**
1628     + * usb_block_urb - reliably prevent further use of an URB
1629     + * @urb: pointer to URB to be blocked, may be NULL
1630     + *
1631     + * After the routine has run, attempts to resubmit the URB will fail
1632     + * with error -EPERM. Thus even if the URB's completion handler always
1633     + * tries to resubmit, it will not succeed and the URB will become idle.
1634     + *
1635     + * The URB must not be deallocated while this routine is running. In
1636     + * particular, when a driver calls this routine, it must insure that the
1637     + * completion handler cannot deallocate the URB.
1638     + */
1639     +void usb_block_urb(struct urb *urb)
1640     +{
1641     + if (!urb)
1642     + return;
1643     +
1644     + atomic_inc(&urb->reject);
1645     +}
1646     +EXPORT_SYMBOL_GPL(usb_block_urb);
1647     +
1648     +/**
1649     * usb_kill_anchored_urbs - cancel transfer requests en masse
1650     * @anchor: anchor the requests are bound to
1651     *
1652     diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
1653     index 55abfb6..188a89f 100644
1654     --- a/drivers/usb/gadget/fsl_udc_core.c
1655     +++ b/drivers/usb/gadget/fsl_udc_core.c
1656     @@ -736,6 +736,8 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
1657     lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
1658     lastreq->tail->next_td_ptr =
1659     cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK);
1660     + /* Ensure dTD's next dtd pointer to be updated */
1661     + wmb();
1662     /* Read prime bit, if 1 goto done */
1663     if (fsl_readl(&dr_regs->endpointprime) & bitmask)
1664     return;
1665     diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
1666     index 5c78f9e..e669c6a 100644
1667     --- a/drivers/usb/host/ehci-omap.c
1668     +++ b/drivers/usb/host/ehci-omap.c
1669     @@ -242,15 +242,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
1670    
1671     ehci_reset(omap_ehci);
1672    
1673     - ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
1674     - if (ret) {
1675     - dev_err(dev, "failed to add hcd with err %d\n", ret);
1676     - goto err_add_hcd;
1677     - }
1678     -
1679     - /* root ports should always stay powered */
1680     - ehci_port_power(omap_ehci, 1);
1681     -
1682     if (pdata->phy_reset) {
1683     /* Hold the PHY in RESET for enough time till
1684     * PHY is settled and ready
1685     @@ -264,6 +255,15 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
1686     gpio_set_value(pdata->reset_gpio_port[1], 1);
1687     }
1688    
1689     + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
1690     + if (ret) {
1691     + dev_err(dev, "failed to add hcd with err %d\n", ret);
1692     + goto err_add_hcd;
1693     + }
1694     +
1695     + /* root ports should always stay powered */
1696     + ehci_port_power(omap_ehci, 1);
1697     +
1698     return 0;
1699    
1700     err_add_hcd:
1701     diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
1702     index fe8dc06..bc94d7b 100644
1703     --- a/drivers/usb/host/ehci-pci.c
1704     +++ b/drivers/usb/host/ehci-pci.c
1705     @@ -368,7 +368,9 @@ static bool usb_is_intel_switchable_ehci(struct pci_dev *pdev)
1706     {
1707     return pdev->class == PCI_CLASS_SERIAL_USB_EHCI &&
1708     pdev->vendor == PCI_VENDOR_ID_INTEL &&
1709     - pdev->device == 0x1E26;
1710     + (pdev->device == 0x1E26 ||
1711     + pdev->device == 0x8C2D ||
1712     + pdev->device == 0x8C26);
1713     }
1714    
1715     static void ehci_enable_xhci_companion(void)
1716     diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
1717     index d238b4e2..82c1eb8 100644
1718     --- a/drivers/usb/host/ehci-platform.c
1719     +++ b/drivers/usb/host/ehci-platform.c
1720     @@ -75,8 +75,6 @@ static const struct hc_driver ehci_platform_hc_driver = {
1721     .relinquish_port = ehci_relinquish_port,
1722     .port_handed_over = ehci_port_handed_over,
1723    
1724     - .update_device = ehci_update_device,
1725     -
1726     .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
1727     };
1728    
1729     diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
1730     index 13ebeca..55d3d64 100644
1731     --- a/drivers/usb/host/ohci-at91.c
1732     +++ b/drivers/usb/host/ohci-at91.c
1733     @@ -223,7 +223,7 @@ static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd,
1734     /*-------------------------------------------------------------------------*/
1735    
1736     static int __devinit
1737     -ohci_at91_start (struct usb_hcd *hcd)
1738     +ohci_at91_reset (struct usb_hcd *hcd)
1739     {
1740     struct at91_usbh_data *board = hcd->self.controller->platform_data;
1741     struct ohci_hcd *ohci = hcd_to_ohci (hcd);
1742     @@ -233,6 +233,14 @@ ohci_at91_start (struct usb_hcd *hcd)
1743     return ret;
1744    
1745     ohci->num_ports = board->ports;
1746     + return 0;
1747     +}
1748     +
1749     +static int __devinit
1750     +ohci_at91_start (struct usb_hcd *hcd)
1751     +{
1752     + struct ohci_hcd *ohci = hcd_to_ohci (hcd);
1753     + int ret;
1754    
1755     if ((ret = ohci_run(ohci)) < 0) {
1756     err("can't start %s", hcd->self.bus_name);
1757     @@ -418,6 +426,7 @@ static const struct hc_driver ohci_at91_hc_driver = {
1758     /*
1759     * basic lifecycle operations
1760     */
1761     + .reset = ohci_at91_reset,
1762     .start = ohci_at91_start,
1763     .stop = ohci_stop,
1764     .shutdown = ohci_shutdown,
1765     diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
1766     index 32dada8..df0828c 100644
1767     --- a/drivers/usb/host/pci-quirks.c
1768     +++ b/drivers/usb/host/pci-quirks.c
1769     @@ -9,6 +9,7 @@
1770     */
1771    
1772     #include <linux/types.h>
1773     +#include <linux/kconfig.h>
1774     #include <linux/kernel.h>
1775     #include <linux/pci.h>
1776     #include <linux/init.h>
1777     @@ -712,12 +713,28 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,
1778     return -ETIMEDOUT;
1779     }
1780    
1781     -bool usb_is_intel_switchable_xhci(struct pci_dev *pdev)
1782     +#define PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI 0x8C31
1783     +
1784     +bool usb_is_intel_ppt_switchable_xhci(struct pci_dev *pdev)
1785     {
1786     return pdev->class == PCI_CLASS_SERIAL_USB_XHCI &&
1787     pdev->vendor == PCI_VENDOR_ID_INTEL &&
1788     pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI;
1789     }
1790     +
1791     +/* The Intel Lynx Point chipset also has switchable ports. */
1792     +bool usb_is_intel_lpt_switchable_xhci(struct pci_dev *pdev)
1793     +{
1794     + return pdev->class == PCI_CLASS_SERIAL_USB_XHCI &&
1795     + pdev->vendor == PCI_VENDOR_ID_INTEL &&
1796     + pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI;
1797     +}
1798     +
1799     +bool usb_is_intel_switchable_xhci(struct pci_dev *pdev)
1800     +{
1801     + return usb_is_intel_ppt_switchable_xhci(pdev) ||
1802     + usb_is_intel_lpt_switchable_xhci(pdev);
1803     +}
1804     EXPORT_SYMBOL_GPL(usb_is_intel_switchable_xhci);
1805    
1806     /*
1807     @@ -742,6 +759,19 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
1808     {
1809     u32 ports_available;
1810    
1811     + /* Don't switchover the ports if the user hasn't compiled the xHCI
1812     + * driver. Otherwise they will see "dead" USB ports that don't power
1813     + * the devices.
1814     + */
1815     + if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) {
1816     + dev_warn(&xhci_pdev->dev,
1817     + "CONFIG_USB_XHCI_HCD is turned off, "
1818     + "defaulting to EHCI.\n");
1819     + dev_warn(&xhci_pdev->dev,
1820     + "USB 3.0 devices will work at USB 2.0 speeds.\n");
1821     + return;
1822     + }
1823     +
1824     ports_available = 0xffffffff;
1825     /* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable
1826     * Register, to turn on SuperSpeed terminations for all
1827     diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
1828     index 673ad12..89850a8 100644
1829     --- a/drivers/usb/host/xhci-hub.c
1830     +++ b/drivers/usb/host/xhci-hub.c
1831     @@ -558,6 +558,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1832     xhci_dbg(xhci, "Resume USB2 port %d\n",
1833     wIndex + 1);
1834     bus_state->resume_done[wIndex] = 0;
1835     + clear_bit(wIndex, &bus_state->resuming_ports);
1836     xhci_set_link_state(xhci, port_array, wIndex,
1837     XDEV_U0);
1838     xhci_dbg(xhci, "set port %d resume\n",
1839     @@ -845,7 +846,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
1840     /* Initial status is no changes */
1841     retval = (max_ports + 8) / 8;
1842     memset(buf, 0, retval);
1843     - status = 0;
1844     +
1845     + /*
1846     + * Inform the usbcore about resume-in-progress by returning
1847     + * a non-zero value even if there are no status changes.
1848     + */
1849     + status = bus_state->resuming_ports;
1850    
1851     mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;
1852    
1853     @@ -885,15 +891,11 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
1854     spin_lock_irqsave(&xhci->lock, flags);
1855    
1856     if (hcd->self.root_hub->do_remote_wakeup) {
1857     - port_index = max_ports;
1858     - while (port_index--) {
1859     - if (bus_state->resume_done[port_index] != 0) {
1860     - spin_unlock_irqrestore(&xhci->lock, flags);
1861     - xhci_dbg(xhci, "suspend failed because "
1862     - "port %d is resuming\n",
1863     - port_index + 1);
1864     - return -EBUSY;
1865     - }
1866     + if (bus_state->resuming_ports) {
1867     + spin_unlock_irqrestore(&xhci->lock, flags);
1868     + xhci_dbg(xhci, "suspend failed because "
1869     + "a port is resuming\n");
1870     + return -EBUSY;
1871     }
1872     }
1873    
1874     diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
1875     index 68eaa90..497ed77 100644
1876     --- a/drivers/usb/host/xhci-mem.c
1877     +++ b/drivers/usb/host/xhci-mem.c
1878     @@ -1791,6 +1791,14 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1879     {
1880     struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
1881     struct dev_info *dev_info, *next;
1882     + struct list_head *tt_list_head;
1883     + struct list_head *tt;
1884     + struct list_head *endpoints;
1885     + struct list_head *ep, *q;
1886     + struct xhci_tt_bw_info *tt_info;
1887     + struct xhci_interval_bw_table *bwt;
1888     + struct xhci_virt_ep *virt_ep;
1889     +
1890     unsigned long flags;
1891     int size;
1892     int i;
1893     @@ -1807,6 +1815,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1894     xhci->event_ring = NULL;
1895     xhci_dbg(xhci, "Freed event ring\n");
1896    
1897     + xhci->cmd_ring_reserved_trbs = 0;
1898     if (xhci->cmd_ring)
1899     xhci_ring_free(xhci, xhci->cmd_ring);
1900     xhci->cmd_ring = NULL;
1901     @@ -1849,8 +1858,26 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1902     }
1903     spin_unlock_irqrestore(&xhci->lock, flags);
1904    
1905     + bwt = &xhci->rh_bw->bw_table;
1906     + for (i = 0; i < XHCI_MAX_INTERVAL; i++) {
1907     + endpoints = &bwt->interval_bw[i].endpoints;
1908     + list_for_each_safe(ep, q, endpoints) {
1909     + virt_ep = list_entry(ep, struct xhci_virt_ep, bw_endpoint_list);
1910     + list_del(&virt_ep->bw_endpoint_list);
1911     + kfree(virt_ep);
1912     + }
1913     + }
1914     +
1915     + tt_list_head = &xhci->rh_bw->tts;
1916     + list_for_each_safe(tt, q, tt_list_head) {
1917     + tt_info = list_entry(tt, struct xhci_tt_bw_info, tt_list);
1918     + list_del(tt);
1919     + kfree(tt_info);
1920     + }
1921     +
1922     xhci->num_usb2_ports = 0;
1923     xhci->num_usb3_ports = 0;
1924     + xhci->num_active_eps = 0;
1925     kfree(xhci->usb2_ports);
1926     kfree(xhci->usb3_ports);
1927     kfree(xhci->port_array);
1928     diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1929     index 7a856a7..19e8921 100644
1930     --- a/drivers/usb/host/xhci-pci.c
1931     +++ b/drivers/usb/host/xhci-pci.c
1932     @@ -72,6 +72,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1933     xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
1934     "has broken MSI implementation\n",
1935     pdev->revision);
1936     + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1937     }
1938    
1939     if (pdev->vendor == PCI_VENDOR_ID_NEC)
1940     diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1941     index 3d9422f..525a1ee 100644
1942     --- a/drivers/usb/host/xhci-ring.c
1943     +++ b/drivers/usb/host/xhci-ring.c
1944     @@ -1377,6 +1377,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
1945     xhci_dbg(xhci, "resume HS port %d\n", port_id);
1946     bus_state->resume_done[faked_port_index] = jiffies +
1947     msecs_to_jiffies(20);
1948     + set_bit(faked_port_index, &bus_state->resuming_ports);
1949     mod_timer(&hcd->rh_timer,
1950     bus_state->resume_done[faked_port_index]);
1951     /* Do the rest in GetPortStatus */
1952     @@ -1786,8 +1787,12 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1953     /* handle completion code */
1954     switch (trb_comp_code) {
1955     case COMP_SUCCESS:
1956     - frame->status = 0;
1957     - break;
1958     + if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
1959     + frame->status = 0;
1960     + break;
1961     + }
1962     + if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
1963     + trb_comp_code = COMP_SHORT_TX;
1964     case COMP_SHORT_TX:
1965     frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
1966     -EREMOTEIO : 0;
1967     @@ -1803,6 +1808,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1968     break;
1969     case COMP_DEV_ERR:
1970     case COMP_STALL:
1971     + case COMP_TX_ERR:
1972     frame->status = -EPROTO;
1973     skip_td = true;
1974     break;
1975     @@ -1883,13 +1889,16 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
1976     switch (trb_comp_code) {
1977     case COMP_SUCCESS:
1978     /* Double check that the HW transferred everything. */
1979     - if (event_trb != td->last_trb) {
1980     + if (event_trb != td->last_trb ||
1981     + TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
1982     xhci_warn(xhci, "WARN Successful completion "
1983     "on short TX\n");
1984     if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
1985     *status = -EREMOTEIO;
1986     else
1987     *status = 0;
1988     + if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
1989     + trb_comp_code = COMP_SHORT_TX;
1990     } else {
1991     *status = 0;
1992     }
1993     @@ -2048,6 +2057,13 @@ static int handle_tx_event(struct xhci_hcd *xhci,
1994     * transfer type
1995     */
1996     case COMP_SUCCESS:
1997     + if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
1998     + break;
1999     + if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
2000     + trb_comp_code = COMP_SHORT_TX;
2001     + else
2002     + xhci_warn(xhci, "WARN Successful completion on short TX: "
2003     + "needs XHCI_TRUST_TX_LENGTH quirk?\n");
2004     case COMP_SHORT_TX:
2005     break;
2006     case COMP_STOP:
2007     diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
2008     index 36641a7..5910048 100644
2009     --- a/drivers/usb/host/xhci.c
2010     +++ b/drivers/usb/host/xhci.c
2011     @@ -152,7 +152,7 @@ int xhci_reset(struct xhci_hcd *xhci)
2012     {
2013     u32 command;
2014     u32 state;
2015     - int ret;
2016     + int ret, i;
2017    
2018     state = xhci_readl(xhci, &xhci->op_regs->status);
2019     if ((state & STS_HALT) == 0) {
2020     @@ -175,7 +175,15 @@ int xhci_reset(struct xhci_hcd *xhci)
2021     * xHCI cannot write to any doorbells or operational registers other
2022     * than status until the "Controller Not Ready" flag is cleared.
2023     */
2024     - return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
2025     + ret = handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
2026     +
2027     + for (i = 0; i < 2; ++i) {
2028     + xhci->bus_state[i].port_c_suspend = 0;
2029     + xhci->bus_state[i].suspended_ports = 0;
2030     + xhci->bus_state[i].resuming_ports = 0;
2031     + }
2032     +
2033     + return ret;
2034     }
2035    
2036     #ifdef CONFIG_PCI
2037     diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
2038     index 3d69c4b..ac14276 100644
2039     --- a/drivers/usb/host/xhci.h
2040     +++ b/drivers/usb/host/xhci.h
2041     @@ -1362,6 +1362,8 @@ struct xhci_bus_state {
2042     u32 suspended_ports;
2043     u32 port_remote_wakeup;
2044     unsigned long resume_done[USB_MAXCHILDREN];
2045     + /* which ports have started to resume */
2046     + unsigned long resuming_ports;
2047     };
2048    
2049     static inline unsigned int hcd_index(struct usb_hcd *hcd)
2050     @@ -1479,6 +1481,7 @@ struct xhci_hcd {
2051     #define XHCI_RESET_ON_RESUME (1 << 7)
2052     #define XHCI_SW_BW_CHECKING (1 << 8)
2053     #define XHCI_AMD_0x96_HOST (1 << 9)
2054     +#define XHCI_TRUST_TX_LENGTH (1 << 10)
2055     unsigned int num_active_eps;
2056     unsigned int limit_active_eps;
2057     /* There are two roothubs to keep track of bus suspend info for */
2058     diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
2059     index 9dcb68f..055b84a 100644
2060     --- a/drivers/usb/misc/usbtest.c
2061     +++ b/drivers/usb/misc/usbtest.c
2062     @@ -1028,7 +1028,10 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
2063     case 13: /* short read, resembling case 10 */
2064     req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
2065     /* last data packet "should" be DATA1, not DATA0 */
2066     - len = 1024 - udev->descriptor.bMaxPacketSize0;
2067     + if (udev->speed == USB_SPEED_SUPER)
2068     + len = 1024 - 512;
2069     + else
2070     + len = 1024 - udev->descriptor.bMaxPacketSize0;
2071     expected = -EREMOTEIO;
2072     break;
2073     case 14: /* short read; try to fill the last packet */
2074     @@ -1387,11 +1390,15 @@ static int test_halt(struct usbtest_dev *tdev, int ep, struct urb *urb)
2075    
2076     static int halt_simple(struct usbtest_dev *dev)
2077     {
2078     - int ep;
2079     - int retval = 0;
2080     - struct urb *urb;
2081     + int ep;
2082     + int retval = 0;
2083     + struct urb *urb;
2084     + struct usb_device *udev = testdev_to_usbdev(dev);
2085    
2086     - urb = simple_alloc_urb(testdev_to_usbdev(dev), 0, 512);
2087     + if (udev->speed == USB_SPEED_SUPER)
2088     + urb = simple_alloc_urb(udev, 0, 1024);
2089     + else
2090     + urb = simple_alloc_urb(udev, 0, 512);
2091     if (urb == NULL)
2092     return -ENOMEM;
2093    
2094     diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
2095     index a0a2178..fe20864 100644
2096     --- a/drivers/usb/otg/gpio_vbus.c
2097     +++ b/drivers/usb/otg/gpio_vbus.c
2098     @@ -37,7 +37,7 @@ struct gpio_vbus_data {
2099     struct regulator *vbus_draw;
2100     int vbus_draw_enabled;
2101     unsigned mA;
2102     - struct work_struct work;
2103     + struct delayed_work work;
2104     };
2105    
2106    
2107     @@ -94,7 +94,7 @@ static int is_vbus_powered(struct gpio_vbus_mach_info *pdata)
2108     static void gpio_vbus_work(struct work_struct *work)
2109     {
2110     struct gpio_vbus_data *gpio_vbus =
2111     - container_of(work, struct gpio_vbus_data, work);
2112     + container_of(work, struct gpio_vbus_data, work.work);
2113     struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data;
2114     int gpio, status;
2115    
2116     @@ -152,7 +152,7 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data)
2117     otg->gadget ? otg->gadget->name : "none");
2118    
2119     if (otg->gadget)
2120     - schedule_work(&gpio_vbus->work);
2121     + schedule_delayed_work(&gpio_vbus->work, msecs_to_jiffies(100));
2122    
2123     return IRQ_HANDLED;
2124     }
2125     @@ -300,7 +300,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
2126    
2127     ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier);
2128    
2129     - INIT_WORK(&gpio_vbus->work, gpio_vbus_work);
2130     + INIT_DELAYED_WORK(&gpio_vbus->work, gpio_vbus_work);
2131    
2132     gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
2133     if (IS_ERR(gpio_vbus->vbus_draw)) {
2134     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2135     index 02e7f2d..95bba99 100644
2136     --- a/drivers/usb/serial/ftdi_sio.c
2137     +++ b/drivers/usb/serial/ftdi_sio.c
2138     @@ -809,6 +809,7 @@ static struct usb_device_id id_table_combined [] = {
2139     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
2140     { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
2141     { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
2142     + { USB_DEVICE(PI_VID, PI_E861_PID) },
2143     { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
2144     { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
2145     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
2146     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
2147     index 0838baf8..f3c7c78 100644
2148     --- a/drivers/usb/serial/ftdi_sio_ids.h
2149     +++ b/drivers/usb/serial/ftdi_sio_ids.h
2150     @@ -785,6 +785,14 @@
2151     #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
2152     #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */
2153    
2154     +
2155     +/*
2156     + * Physik Instrumente
2157     + * http://www.physikinstrumente.com/en/products/
2158     + */
2159     +#define PI_VID 0x1a72 /* Vendor ID */
2160     +#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */
2161     +
2162     /*
2163     * Bayer Ascensia Contour blood glucose meter USB-converter cable.
2164     * http://winglucofacts.com/cables/
2165     diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
2166     index ab74123..3377437 100644
2167     --- a/drivers/usb/serial/ti_usb_3410_5052.c
2168     +++ b/drivers/usb/serial/ti_usb_3410_5052.c
2169     @@ -165,7 +165,7 @@ static unsigned int product_5052_count;
2170     /* the array dimension is the number of default entries plus */
2171     /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
2172     /* null entry */
2173     -static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
2174     +static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
2175     { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
2176     { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
2177     { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
2178     @@ -180,6 +180,7 @@ static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
2179     { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
2180     { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
2181     { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
2182     + { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
2183     };
2184    
2185     static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
2186     @@ -189,7 +190,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
2187     { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
2188     };
2189    
2190     -static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1] = {
2191     +static struct usb_device_id ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = {
2192     { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
2193     { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
2194     { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
2195     @@ -208,6 +209,7 @@ static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1]
2196     { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
2197     { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
2198     { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
2199     + { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
2200     { }
2201     };
2202    
2203     diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
2204     index f140f1b..b353e7e 100644
2205     --- a/drivers/usb/serial/ti_usb_3410_5052.h
2206     +++ b/drivers/usb/serial/ti_usb_3410_5052.h
2207     @@ -37,6 +37,7 @@
2208     #define TI_5152_BOOT_PRODUCT_ID 0x5152 /* no EEPROM, no firmware */
2209     #define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */
2210     #define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */
2211     +#define FRI2_PRODUCT_ID 0x5053 /* Fish River Island II */
2212    
2213     /* Multi-Tech vendor and product ids */
2214     #define MTS_VENDOR_ID 0x06E0
2215     diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
2216     index 97355a1..6933355 100644
2217     --- a/drivers/usb/serial/usb-serial.c
2218     +++ b/drivers/usb/serial/usb-serial.c
2219     @@ -1338,7 +1338,6 @@ static int usb_serial_register(struct usb_serial_driver *driver)
2220     driver->description);
2221     return -EINVAL;
2222     }
2223     - driver->usb_driver->supports_autosuspend = 1;
2224    
2225     /* Add this device to our list of devices */
2226     mutex_lock(&table_lock);
2227     @@ -1373,7 +1372,7 @@ static void usb_serial_deregister(struct usb_serial_driver *device)
2228     * @serial_drivers: NULL-terminated array of pointers to drivers to be registered
2229     *
2230     * Registers @udriver and all the drivers in the @serial_drivers array.
2231     - * Automatically fills in the .no_dynamic_id field in @udriver and
2232     + * Automatically fills in the .no_dynamic_id and PM fields in @udriver and
2233     * the .usb_driver field in each serial driver.
2234     */
2235     int usb_serial_register_drivers(struct usb_driver *udriver,
2236     @@ -1392,11 +1391,17 @@ int usb_serial_register_drivers(struct usb_driver *udriver,
2237     * the serial drivers are registered, because the probe would
2238     * simply fail for lack of a matching serial driver.
2239     * Therefore save off udriver's id_table until we are all set.
2240     + *
2241     + * Suspend/resume support is implemented in the usb-serial core,
2242     + * so fill in the PM-related fields in udriver.
2243     */
2244     saved_id_table = udriver->id_table;
2245     udriver->id_table = NULL;
2246    
2247     udriver->no_dynamic_id = 1;
2248     + udriver->supports_autosuspend = 1;
2249     + udriver->suspend = usb_serial_suspend;
2250     + udriver->resume = usb_serial_resume;
2251     rc = usb_register(udriver);
2252     if (rc)
2253     return rc;
2254     diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
2255     index 856ad92..8f3cbb8 100644
2256     --- a/drivers/usb/storage/unusual_devs.h
2257     +++ b/drivers/usb/storage/unusual_devs.h
2258     @@ -1885,6 +1885,13 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
2259     USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2260     US_FL_IGNORE_RESIDUE ),
2261    
2262     +/* Reported by Jesse Feddema <jdfeddema@gmail.com> */
2263     +UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000,
2264     + "Yarvik",
2265     + "PMP400",
2266     + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2267     + US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
2268     +
2269     /* Reported by Hans de Goede <hdegoede@redhat.com>
2270     * These Appotech controllers are found in Picture Frames, they provide a
2271     * (buggy) emulation of a cdrom drive which contains the windows software
2272     diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
2273     index 7a0b301..e672698 100644
2274     --- a/drivers/video/sh_mobile_lcdcfb.c
2275     +++ b/drivers/video/sh_mobile_lcdcfb.c
2276     @@ -758,7 +758,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
2277     }
2278    
2279     lcdc_write_chan(ch, LDDFR, tmp);
2280     - lcdc_write_chan(ch, LDMLSR, ch->pitch);
2281     + lcdc_write_chan(ch, LDMLSR, ch->line_size);
2282     lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
2283     if (ch->format->yuv)
2284     lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
2285     @@ -847,6 +847,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
2286    
2287     ch->base_addr_y = ch->dma_handle;
2288     ch->base_addr_c = ch->base_addr_y + ch->xres * ch->yres_virtual;
2289     + ch->line_size = ch->pitch;
2290    
2291     /* Enable MERAM if possible. */
2292     if (mdev == NULL || mdev->ops == NULL ||
2293     @@ -882,7 +883,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
2294    
2295     meram = mdev->ops->meram_register(mdev, ch->cfg->meram_cfg,
2296     ch->pitch, ch->yres, pixelformat,
2297     - &ch->pitch);
2298     + &ch->line_size);
2299     if (!IS_ERR(meram)) {
2300     mdev->ops->meram_update(mdev, meram,
2301     ch->base_addr_y, ch->base_addr_c,
2302     diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
2303     index da1c26e..5c3bddd 100644
2304     --- a/drivers/video/sh_mobile_lcdcfb.h
2305     +++ b/drivers/video/sh_mobile_lcdcfb.h
2306     @@ -84,6 +84,7 @@ struct sh_mobile_lcdc_chan {
2307    
2308     unsigned long base_addr_y;
2309     unsigned long base_addr_c;
2310     + unsigned int line_size;
2311    
2312     int (*notify)(struct sh_mobile_lcdc_chan *ch,
2313     enum sh_mobile_lcdc_entity_event event,
2314     diff --git a/drivers/xen/events.c b/drivers/xen/events.c
2315     index 0a8a17c..6908e4c 100644
2316     --- a/drivers/xen/events.c
2317     +++ b/drivers/xen/events.c
2318     @@ -611,7 +611,7 @@ static void disable_pirq(struct irq_data *data)
2319     disable_dynirq(data);
2320     }
2321    
2322     -static int find_irq_by_gsi(unsigned gsi)
2323     +int xen_irq_from_gsi(unsigned gsi)
2324     {
2325     struct irq_info *info;
2326    
2327     @@ -625,6 +625,7 @@ static int find_irq_by_gsi(unsigned gsi)
2328    
2329     return -1;
2330     }
2331     +EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
2332    
2333     /*
2334     * Do not make any assumptions regarding the relationship between the
2335     @@ -644,7 +645,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi,
2336    
2337     mutex_lock(&irq_mapping_update_lock);
2338    
2339     - irq = find_irq_by_gsi(gsi);
2340     + irq = xen_irq_from_gsi(gsi);
2341     if (irq != -1) {
2342     printk(KERN_INFO "xen_map_pirq_gsi: returning irq %d for gsi %u\n",
2343     irq, gsi);
2344     diff --git a/fs/aio.c b/fs/aio.c
2345     index 67a6db3..e7f2fad 100644
2346     --- a/fs/aio.c
2347     +++ b/fs/aio.c
2348     @@ -1456,6 +1456,10 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
2349     if (ret < 0)
2350     goto out;
2351    
2352     + ret = rw_verify_area(type, kiocb->ki_filp, &kiocb->ki_pos, ret);
2353     + if (ret < 0)
2354     + goto out;
2355     +
2356     kiocb->ki_nr_segs = kiocb->ki_nbytes;
2357     kiocb->ki_cur_seg = 0;
2358     /* ki_nbytes/left now reflect bytes instead of segs */
2359     @@ -1467,11 +1471,17 @@ out:
2360     return ret;
2361     }
2362    
2363     -static ssize_t aio_setup_single_vector(struct kiocb *kiocb)
2364     +static ssize_t aio_setup_single_vector(int type, struct file * file, struct kiocb *kiocb)
2365     {
2366     + int bytes;
2367     +
2368     + bytes = rw_verify_area(type, file, &kiocb->ki_pos, kiocb->ki_left);
2369     + if (bytes < 0)
2370     + return bytes;
2371     +
2372     kiocb->ki_iovec = &kiocb->ki_inline_vec;
2373     kiocb->ki_iovec->iov_base = kiocb->ki_buf;
2374     - kiocb->ki_iovec->iov_len = kiocb->ki_left;
2375     + kiocb->ki_iovec->iov_len = bytes;
2376     kiocb->ki_nr_segs = 1;
2377     kiocb->ki_cur_seg = 0;
2378     return 0;
2379     @@ -1496,10 +1506,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
2380     if (unlikely(!access_ok(VERIFY_WRITE, kiocb->ki_buf,
2381     kiocb->ki_left)))
2382     break;
2383     - ret = security_file_permission(file, MAY_READ);
2384     - if (unlikely(ret))
2385     - break;
2386     - ret = aio_setup_single_vector(kiocb);
2387     + ret = aio_setup_single_vector(READ, file, kiocb);
2388     if (ret)
2389     break;
2390     ret = -EINVAL;
2391     @@ -1514,10 +1521,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
2392     if (unlikely(!access_ok(VERIFY_READ, kiocb->ki_buf,
2393     kiocb->ki_left)))
2394     break;
2395     - ret = security_file_permission(file, MAY_WRITE);
2396     - if (unlikely(ret))
2397     - break;
2398     - ret = aio_setup_single_vector(kiocb);
2399     + ret = aio_setup_single_vector(WRITE, file, kiocb);
2400     if (ret)
2401     break;
2402     ret = -EINVAL;
2403     @@ -1528,9 +1532,6 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
2404     ret = -EBADF;
2405     if (unlikely(!(file->f_mode & FMODE_READ)))
2406     break;
2407     - ret = security_file_permission(file, MAY_READ);
2408     - if (unlikely(ret))
2409     - break;
2410     ret = aio_setup_vectored_rw(READ, kiocb, compat);
2411     if (ret)
2412     break;
2413     @@ -1542,9 +1543,6 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
2414     ret = -EBADF;
2415     if (unlikely(!(file->f_mode & FMODE_WRITE)))
2416     break;
2417     - ret = security_file_permission(file, MAY_WRITE);
2418     - if (unlikely(ret))
2419     - break;
2420     ret = aio_setup_vectored_rw(WRITE, kiocb, compat);
2421     if (ret)
2422     break;
2423     diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
2424     index cbde4b7..0707d22 100644
2425     --- a/include/linux/mmc/host.h
2426     +++ b/include/linux/mmc/host.h
2427     @@ -297,6 +297,7 @@ struct mmc_host {
2428    
2429     unsigned int sdio_irqs;
2430     struct task_struct *sdio_irq_thread;
2431     + bool sdio_irq_pending;
2432     atomic_t sdio_irq_thread_abort;
2433    
2434     mmc_pm_flag_t pm_flags; /* requested pm features */
2435     @@ -352,6 +353,7 @@ extern int mmc_cache_ctrl(struct mmc_host *, u8);
2436     static inline void mmc_signal_sdio_irq(struct mmc_host *host)
2437     {
2438     host->ops->enable_sdio_irq(host, 0);
2439     + host->sdio_irq_pending = true;
2440     wake_up_process(host->sdio_irq_thread);
2441     }
2442    
2443     diff --git a/include/linux/usb.h b/include/linux/usb.h
2444     index 73b68d1..26229fd 100644
2445     --- a/include/linux/usb.h
2446     +++ b/include/linux/usb.h
2447     @@ -1379,6 +1379,7 @@ extern int usb_unlink_urb(struct urb *urb);
2448     extern void usb_kill_urb(struct urb *urb);
2449     extern void usb_poison_urb(struct urb *urb);
2450     extern void usb_unpoison_urb(struct urb *urb);
2451     +extern void usb_block_urb(struct urb *urb);
2452     extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
2453     extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
2454     extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
2455     @@ -1391,6 +1392,8 @@ extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
2456     extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
2457     extern int usb_anchor_empty(struct usb_anchor *anchor);
2458    
2459     +#define usb_unblock_urb usb_unpoison_urb
2460     +
2461     /**
2462     * usb_urb_dir_in - check if an URB describes an IN transfer
2463     * @urb: URB to be checked
2464     diff --git a/include/xen/events.h b/include/xen/events.h
2465     index 0f77370..04399b2 100644
2466     --- a/include/xen/events.h
2467     +++ b/include/xen/events.h
2468     @@ -103,6 +103,9 @@ int xen_irq_from_pirq(unsigned pirq);
2469     /* Return the pirq allocated to the irq. */
2470     int xen_pirq_from_irq(unsigned irq);
2471    
2472     +/* Return the irq allocated to the gsi */
2473     +int xen_irq_from_gsi(unsigned gsi);
2474     +
2475     /* Determine whether to ignore this IRQ if it is passed to a guest. */
2476     int xen_test_irq_shared(int irq);
2477    
2478     diff --git a/init/main.c b/init/main.c
2479     index 44b2433..cb54cd3 100644
2480     --- a/init/main.c
2481     +++ b/init/main.c
2482     @@ -560,9 +560,6 @@ asmlinkage void __init start_kernel(void)
2483     early_boot_irqs_disabled = false;
2484     local_irq_enable();
2485    
2486     - /* Interrupts are enabled now so all GFP allocations are safe. */
2487     - gfp_allowed_mask = __GFP_BITS_MASK;
2488     -
2489     kmem_cache_init_late();
2490    
2491     /*
2492     @@ -842,6 +839,10 @@ static int __init kernel_init(void * unused)
2493     * Wait until kthreadd is all set-up.
2494     */
2495     wait_for_completion(&kthreadd_done);
2496     +
2497     + /* Now the scheduler is fully set up and can do blocking allocations */
2498     + gfp_allowed_mask = __GFP_BITS_MASK;
2499     +
2500     /*
2501     * init can allocate pages on any node
2502     */
2503     diff --git a/kernel/workqueue.c b/kernel/workqueue.c
2504     index 5abf42f..7da267c 100644
2505     --- a/kernel/workqueue.c
2506     +++ b/kernel/workqueue.c
2507     @@ -1210,8 +1210,13 @@ static void worker_enter_idle(struct worker *worker)
2508     } else
2509     wake_up_all(&gcwq->trustee_wait);
2510    
2511     - /* sanity check nr_running */
2512     - WARN_ON_ONCE(gcwq->nr_workers == gcwq->nr_idle &&
2513     + /*
2514     + * Sanity check nr_running. Because trustee releases gcwq->lock
2515     + * between setting %WORKER_ROGUE and zapping nr_running, the
2516     + * warning may trigger spuriously. Check iff trustee is idle.
2517     + */
2518     + WARN_ON_ONCE(gcwq->trustee_state == TRUSTEE_DONE &&
2519     + gcwq->nr_workers == gcwq->nr_idle &&
2520     atomic_read(get_gcwq_nr_running(gcwq->cpu)));
2521     }
2522    
2523     diff --git a/mm/mempolicy.c b/mm/mempolicy.c
2524     index b195691..bf5b485 100644
2525     --- a/mm/mempolicy.c
2526     +++ b/mm/mempolicy.c
2527     @@ -607,27 +607,6 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
2528     return first;
2529     }
2530    
2531     -/* Apply policy to a single VMA */
2532     -static int policy_vma(struct vm_area_struct *vma, struct mempolicy *new)
2533     -{
2534     - int err = 0;
2535     - struct mempolicy *old = vma->vm_policy;
2536     -
2537     - pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
2538     - vma->vm_start, vma->vm_end, vma->vm_pgoff,
2539     - vma->vm_ops, vma->vm_file,
2540     - vma->vm_ops ? vma->vm_ops->set_policy : NULL);
2541     -
2542     - if (vma->vm_ops && vma->vm_ops->set_policy)
2543     - err = vma->vm_ops->set_policy(vma, new);
2544     - if (!err) {
2545     - mpol_get(new);
2546     - vma->vm_policy = new;
2547     - mpol_put(old);
2548     - }
2549     - return err;
2550     -}
2551     -
2552     /* Step 2: apply policy to a range and do splits. */
2553     static int mbind_range(struct mm_struct *mm, unsigned long start,
2554     unsigned long end, struct mempolicy *new_pol)
2555     @@ -676,9 +655,23 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
2556     if (err)
2557     goto out;
2558     }
2559     - err = policy_vma(vma, new_pol);
2560     - if (err)
2561     - goto out;
2562     +
2563     + /*
2564     + * Apply policy to a single VMA. The reference counting of
2565     + * policy for vma_policy linkages has already been handled by
2566     + * vma_merge and split_vma as necessary. If this is a shared
2567     + * policy then ->set_policy will increment the reference count
2568     + * for an sp node.
2569     + */
2570     + pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
2571     + vma->vm_start, vma->vm_end, vma->vm_pgoff,
2572     + vma->vm_ops, vma->vm_file,
2573     + vma->vm_ops ? vma->vm_ops->set_policy : NULL);
2574     + if (vma->vm_ops && vma->vm_ops->set_policy) {
2575     + err = vma->vm_ops->set_policy(vma, new_pol);
2576     + if (err)
2577     + goto out;
2578     + }
2579     }
2580    
2581     out:
2582     diff --git a/net/wireless/reg.c b/net/wireless/reg.c
2583     index e9a0ac8..15f3474 100644
2584     --- a/net/wireless/reg.c
2585     +++ b/net/wireless/reg.c
2586     @@ -388,7 +388,15 @@ static void reg_regdb_query(const char *alpha2)
2587    
2588     schedule_work(&reg_regdb_work);
2589     }
2590     +
2591     +/* Feel free to add any other sanity checks here */
2592     +static void reg_regdb_size_check(void)
2593     +{
2594     + /* We should ideally BUILD_BUG_ON() but then random builds would fail */
2595     + WARN_ONCE(!reg_regdb_size, "db.txt is empty, you should update it...");
2596     +}
2597     #else
2598     +static inline void reg_regdb_size_check(void) {}
2599     static inline void reg_regdb_query(const char *alpha2) {}
2600     #endif /* CONFIG_CFG80211_INTERNAL_REGDB */
2601    
2602     @@ -2322,6 +2330,8 @@ int __init regulatory_init(void)
2603     spin_lock_init(&reg_requests_lock);
2604     spin_lock_init(&reg_pending_beacons_lock);
2605    
2606     + reg_regdb_size_check();
2607     +
2608     cfg80211_regdomain = cfg80211_world_regdom;
2609    
2610     user_alpha2[0] = '9';
2611     diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
2612     index d7018bf..3068d16 100644
2613     --- a/security/selinux/selinuxfs.c
2614     +++ b/security/selinux/selinuxfs.c
2615     @@ -1232,6 +1232,7 @@ static int sel_make_bools(void)
2616     kfree(bool_pending_names[i]);
2617     kfree(bool_pending_names);
2618     kfree(bool_pending_values);
2619     + bool_num = 0;
2620     bool_pending_names = NULL;
2621     bool_pending_values = NULL;
2622    
2623     diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
2624     index 4b107b5..8674b9e 100644
2625     --- a/tools/usb/ffs-test.c
2626     +++ b/tools/usb/ffs-test.c
2627     @@ -297,7 +297,7 @@ static void *start_thread_helper(void *arg)
2628    
2629     ret = t->in(t, t->buf, t->buf_size);
2630     if (ret > 0) {
2631     - ret = t->out(t, t->buf, t->buf_size);
2632     + ret = t->out(t, t->buf, ret);
2633     name = out_name;
2634     op = "write";
2635     } else {