/[linux-patches]/genpatches-2.6/tags/3.4-10/1000_linux-3.4.1.patch
Gentoo

Contents of /genpatches-2.6/tags/3.4-10/1000_linux-3.4.1.patch

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20