Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1721 - genpatches-2.6/trunk/2.6.33
Date: Mon, 05 Jul 2010 23:10:03
Message-Id: 20100705230920.370312CF3A@corvid.gentoo.org
1 Author: mpagano
2 Date: 2010-07-05 23:09:19 +0000 (Mon, 05 Jul 2010)
3 New Revision: 1721
4
5 Added:
6 genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.4.patch
7 genpatches-2.6/trunk/2.6.33/1004_linux-2.6.33.5.patch
8 genpatches-2.6/trunk/2.6.33/1005_linux-2.6.33.6.patch
9 Removed:
10 genpatches-2.6/trunk/2.6.33/1002_linux-2.6.33.4.patch
11 genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.5.patch
12 Modified:
13 genpatches-2.6/trunk/2.6.33/0000_README
14 Log:
15 Reordering of patchsets and adding linux 2.6.33.6
16
17 Modified: genpatches-2.6/trunk/2.6.33/0000_README
18 ===================================================================
19 --- genpatches-2.6/trunk/2.6.33/0000_README 2010-07-05 22:42:35 UTC (rev 1720)
20 +++ genpatches-2.6/trunk/2.6.33/0000_README 2010-07-05 23:09:19 UTC (rev 1721)
21 @@ -47,6 +47,10 @@
22 From: http://www.kernel.org
23 Desc: Linux 2.6.33.2
24
25 +Patch: 1002_linux-2.6.33.3.patch
26 +From: http://www.kernel.org
27 +Desc: Linux 2.6.33.3
28 +
29 Patch: 1003_linux-2.6.33.4.patch
30 From: http://www.kernel.org
31 Desc: Linux 2.6.33.4
32 @@ -55,9 +59,9 @@
33 From: http://www.kernel.org
34 Desc: Linux 2.6.33.5
35
36 -Patch: 1002_linux-2.6.33.3.patch
37 +Patch: 1005_linux-2.6.33.6.patch
38 From: http://www.kernel.org
39 -Desc: Linux 2.6.33.3
40 +Desc: Linux 2.6.33.6
41
42 Patch: 2700_vbfb-section-cleanup.patch
43 From: http://lkml.org/lkml/2010/6/25/271
44
45 Deleted: genpatches-2.6/trunk/2.6.33/1002_linux-2.6.33.4.patch
46 ===================================================================
47 --- genpatches-2.6/trunk/2.6.33/1002_linux-2.6.33.4.patch 2010-07-05 22:42:35 UTC (rev 1720)
48 +++ genpatches-2.6/trunk/2.6.33/1002_linux-2.6.33.4.patch 2010-07-05 23:09:19 UTC (rev 1721)
49 @@ -1,4010 +0,0 @@
50 -diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h
51 -index 811743c..5f2ba8d 100644
52 ---- a/arch/arm/mach-pxa/include/mach/colibri.h
53 -+++ b/arch/arm/mach-pxa/include/mach/colibri.h
54 -@@ -2,6 +2,7 @@
55 - #define _COLIBRI_H_
56 -
57 - #include <net/ax88796.h>
58 -+#include <mach/mfp.h>
59 -
60 - /*
61 - * common settings for all modules
62 -diff --git a/arch/mips/include/asm/mach-sibyte/war.h b/arch/mips/include/asm/mach-sibyte/war.h
63 -index 7950ef4..743385d 100644
64 ---- a/arch/mips/include/asm/mach-sibyte/war.h
65 -+++ b/arch/mips/include/asm/mach-sibyte/war.h
66 -@@ -16,7 +16,11 @@
67 - #if defined(CONFIG_SB1_PASS_1_WORKAROUNDS) || \
68 - defined(CONFIG_SB1_PASS_2_WORKAROUNDS)
69 -
70 --#define BCM1250_M3_WAR 1
71 -+#ifndef __ASSEMBLY__
72 -+extern int sb1250_m3_workaround_needed(void);
73 -+#endif
74 -+
75 -+#define BCM1250_M3_WAR sb1250_m3_workaround_needed()
76 - #define SIBYTE_1956_WAR 1
77 -
78 - #else
79 -diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
80 -index 0444da1..92da315 100644
81 ---- a/arch/mips/sibyte/sb1250/setup.c
82 -+++ b/arch/mips/sibyte/sb1250/setup.c
83 -@@ -87,6 +87,21 @@ static int __init setup_bcm1250(void)
84 - return ret;
85 - }
86 -
87 -+int sb1250_m3_workaround_needed(void)
88 -+{
89 -+ switch (soc_type) {
90 -+ case K_SYS_SOC_TYPE_BCM1250:
91 -+ case K_SYS_SOC_TYPE_BCM1250_ALT:
92 -+ case K_SYS_SOC_TYPE_BCM1250_ALT2:
93 -+ case K_SYS_SOC_TYPE_BCM1125:
94 -+ case K_SYS_SOC_TYPE_BCM1125H:
95 -+ return soc_pass < K_SYS_REVISION_BCM1250_C0;
96 -+
97 -+ default:
98 -+ return 0;
99 -+ }
100 -+}
101 -+
102 - static int __init setup_bcm112x(void)
103 - {
104 - int ret = 0;
105 -diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
106 -index 9258074..567cd57 100644
107 ---- a/arch/powerpc/kernel/head_64.S
108 -+++ b/arch/powerpc/kernel/head_64.S
109 -@@ -615,6 +615,17 @@ _GLOBAL(start_secondary_prolog)
110 - std r3,0(r1) /* Zero the stack frame pointer */
111 - bl .start_secondary
112 - b .
113 -+/*
114 -+ * Reset stack pointer and call start_secondary
115 -+ * to continue with online operation when woken up
116 -+ * from cede in cpu offline.
117 -+ */
118 -+_GLOBAL(start_secondary_resume)
119 -+ ld r1,PACAKSAVE(r13) /* Reload kernel stack pointer */
120 -+ li r3,0
121 -+ std r3,0(r1) /* Zero the stack frame pointer */
122 -+ bl .start_secondary
123 -+ b .
124 - #endif
125 -
126 - /*
127 -diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
128 -index c539472..1ce9dd5 100644
129 ---- a/arch/powerpc/mm/fsl_booke_mmu.c
130 -+++ b/arch/powerpc/mm/fsl_booke_mmu.c
131 -@@ -155,15 +155,10 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
132 - if (cur_cpu_spec->cpu_features & MMU_FTR_BIG_PHYS)
133 - TLBCAM[index].MAS7 = (u64)phys >> 32;
134 -
135 --#ifndef CONFIG_KGDB /* want user access for breakpoints */
136 - if (flags & _PAGE_USER) {
137 - TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
138 - TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
139 - }
140 --#else
141 -- TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
142 -- TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
143 --#endif
144 -
145 - tlbcam_addrs[index].start = virt;
146 - tlbcam_addrs[index].limit = virt + size - 1;
147 -diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
148 -index 6ea4698..b842378 100644
149 ---- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
150 -+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
151 -@@ -122,44 +122,32 @@ static void pseries_mach_cpu_die(void)
152 - if (!get_lppaca()->shared_proc)
153 - get_lppaca()->donate_dedicated_cpu = 1;
154 -
155 -- printk(KERN_INFO
156 -- "cpu %u (hwid %u) ceding for offline with hint %d\n",
157 -- cpu, hwcpu, cede_latency_hint);
158 - while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
159 - extended_cede_processor(cede_latency_hint);
160 -- printk(KERN_INFO "cpu %u (hwid %u) returned from cede.\n",
161 -- cpu, hwcpu);
162 -- printk(KERN_INFO
163 -- "Decrementer value = %x Timebase value = %llx\n",
164 -- get_dec(), get_tb());
165 - }
166 -
167 -- printk(KERN_INFO "cpu %u (hwid %u) got prodded to go online\n",
168 -- cpu, hwcpu);
169 --
170 - if (!get_lppaca()->shared_proc)
171 - get_lppaca()->donate_dedicated_cpu = 0;
172 - get_lppaca()->idle = 0;
173 -- }
174 -
175 -- if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
176 -- unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
177 -+ if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
178 -+ unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
179 -
180 -- /*
181 -- * NOTE: Calling start_secondary() here for now to
182 -- * start new context.
183 -- * However, need to do it cleanly by resetting the
184 -- * stack pointer.
185 -- */
186 -- start_secondary();
187 -+ /*
188 -+ * Call to start_secondary_resume() will not return.
189 -+ * Kernel stack will be reset and start_secondary()
190 -+ * will be called to continue the online operation.
191 -+ */
192 -+ start_secondary_resume();
193 -+ }
194 -+ }
195 -
196 -- } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
197 -+ /* Requested state is CPU_STATE_OFFLINE at this point */
198 -+ WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
199 -
200 -- set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
201 -- unregister_slb_shadow(hard_smp_processor_id(),
202 -- __pa(get_slb_shadow()));
203 -- rtas_stop_self();
204 -- }
205 -+ set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
206 -+ unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
207 -+ rtas_stop_self();
208 -
209 - /* Should never get here... */
210 - BUG();
211 -diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h
212 -index 202d869..75a6f48 100644
213 ---- a/arch/powerpc/platforms/pseries/offline_states.h
214 -+++ b/arch/powerpc/platforms/pseries/offline_states.h
215 -@@ -35,4 +35,5 @@ static inline void set_default_offline_state(int cpu)
216 -
217 - extern enum cpu_state_vals get_preferred_offline_state(int cpu);
218 - extern int start_secondary(void);
219 -+extern void start_secondary_resume(void);
220 - #endif
221 -diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
222 -index 8b49bf9..bfa1ea4 100644
223 ---- a/arch/sparc/include/asm/irqflags_64.h
224 -+++ b/arch/sparc/include/asm/irqflags_64.h
225 -@@ -76,9 +76,26 @@ static inline int raw_irqs_disabled(void)
226 - */
227 - static inline unsigned long __raw_local_irq_save(void)
228 - {
229 -- unsigned long flags = __raw_local_save_flags();
230 --
231 -- raw_local_irq_disable();
232 -+ unsigned long flags, tmp;
233 -+
234 -+ /* Disable interrupts to PIL_NORMAL_MAX unless we already
235 -+ * are using PIL_NMI, in which case PIL_NMI is retained.
236 -+ *
237 -+ * The only values we ever program into the %pil are 0,
238 -+ * PIL_NORMAL_MAX and PIL_NMI.
239 -+ *
240 -+ * Since PIL_NMI is the largest %pil value and all bits are
241 -+ * set in it (0xf), it doesn't matter what PIL_NORMAL_MAX
242 -+ * actually is.
243 -+ */
244 -+ __asm__ __volatile__(
245 -+ "rdpr %%pil, %0\n\t"
246 -+ "or %0, %2, %1\n\t"
247 -+ "wrpr %1, 0x0, %%pil"
248 -+ : "=r" (flags), "=r" (tmp)
249 -+ : "i" (PIL_NORMAL_MAX)
250 -+ : "memory"
251 -+ );
252 -
253 - return flags;
254 - }
255 -diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
256 -index 39be9f2..3df02de 100644
257 ---- a/arch/sparc/include/asm/thread_info_64.h
258 -+++ b/arch/sparc/include/asm/thread_info_64.h
259 -@@ -121,7 +121,7 @@ struct thread_info {
260 - #define THREAD_SHIFT PAGE_SHIFT
261 - #endif /* PAGE_SHIFT == 13 */
262 -
263 --#define PREEMPT_ACTIVE 0x4000000
264 -+#define PREEMPT_ACTIVE 0x10000000
265 -
266 - /*
267 - * macros/functions for gaining access to the thread information structure
268 -diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
269 -index b775658..8a00058 100644
270 ---- a/arch/sparc/kernel/pci_common.c
271 -+++ b/arch/sparc/kernel/pci_common.c
272 -@@ -371,14 +371,19 @@ static void pci_register_iommu_region(struct pci_pbm_info *pbm)
273 - struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
274 -
275 - if (!rp) {
276 -- prom_printf("Cannot allocate IOMMU resource.\n");
277 -- prom_halt();
278 -+ pr_info("%s: Cannot allocate IOMMU resource.\n",
279 -+ pbm->name);
280 -+ return;
281 - }
282 - rp->name = "IOMMU";
283 - rp->start = pbm->mem_space.start + (unsigned long) vdma[0];
284 - rp->end = rp->start + (unsigned long) vdma[1] - 1UL;
285 - rp->flags = IORESOURCE_BUSY;
286 -- request_resource(&pbm->mem_space, rp);
287 -+ if (request_resource(&pbm->mem_space, rp)) {
288 -+ pr_info("%s: Unable to request IOMMU resource.\n",
289 -+ pbm->name);
290 -+ kfree(rp);
291 -+ }
292 - }
293 - }
294 -
295 -diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
296 -index fd3cee4..c720f0c 100644
297 ---- a/arch/sparc/kernel/rtrap_64.S
298 -+++ b/arch/sparc/kernel/rtrap_64.S
299 -@@ -172,7 +172,17 @@ rtrap_xcall:
300 - nop
301 - call trace_hardirqs_on
302 - nop
303 -- wrpr %l4, %pil
304 -+ /* Do not actually set the %pil here. We will do that
305 -+ * below after we clear PSTATE_IE in the %pstate register.
306 -+ * If we re-enable interrupts here, we can recurse down
307 -+ * the hardirq stack potentially endlessly, causing a
308 -+ * stack overflow.
309 -+ *
310 -+ * It is tempting to put this test and trace_hardirqs_on
311 -+ * call at the 'rt_continue' label, but that will not work
312 -+ * as that path hits unconditionally and we do not want to
313 -+ * execute this in NMI return paths, for example.
314 -+ */
315 - #endif
316 - rtrap_no_irq_enable:
317 - andcc %l1, TSTATE_PRIV, %l3
318 -diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
319 -index 10f7bb9..22cd475 100644
320 ---- a/arch/sparc/kernel/traps_64.c
321 -+++ b/arch/sparc/kernel/traps_64.c
322 -@@ -2202,27 +2202,6 @@ void dump_stack(void)
323 -
324 - EXPORT_SYMBOL(dump_stack);
325 -
326 --static inline int is_kernel_stack(struct task_struct *task,
327 -- struct reg_window *rw)
328 --{
329 -- unsigned long rw_addr = (unsigned long) rw;
330 -- unsigned long thread_base, thread_end;
331 --
332 -- if (rw_addr < PAGE_OFFSET) {
333 -- if (task != &init_task)
334 -- return 0;
335 -- }
336 --
337 -- thread_base = (unsigned long) task_stack_page(task);
338 -- thread_end = thread_base + sizeof(union thread_union);
339 -- if (rw_addr >= thread_base &&
340 -- rw_addr < thread_end &&
341 -- !(rw_addr & 0x7UL))
342 -- return 1;
343 --
344 -- return 0;
345 --}
346 --
347 - static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
348 - {
349 - unsigned long fp = rw->ins[6];
350 -@@ -2251,6 +2230,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
351 - show_regs(regs);
352 - add_taint(TAINT_DIE);
353 - if (regs->tstate & TSTATE_PRIV) {
354 -+ struct thread_info *tp = current_thread_info();
355 - struct reg_window *rw = (struct reg_window *)
356 - (regs->u_regs[UREG_FP] + STACK_BIAS);
357 -
358 -@@ -2258,8 +2238,8 @@ void die_if_kernel(char *str, struct pt_regs *regs)
359 - * find some badly aligned kernel stack.
360 - */
361 - while (rw &&
362 -- count++ < 30&&
363 -- is_kernel_stack(current, rw)) {
364 -+ count++ < 30 &&
365 -+ kstack_valid(tp, (unsigned long) rw)) {
366 - printk("Caller[%016lx]: %pS\n", rw->ins[7],
367 - (void *) rw->ins[7]);
368 -
369 -diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
370 -index 378ca82..95a8e9a 100644
371 ---- a/arch/sparc/kernel/unaligned_64.c
372 -+++ b/arch/sparc/kernel/unaligned_64.c
373 -@@ -49,7 +49,7 @@ static inline enum direction decode_direction(unsigned int insn)
374 - }
375 -
376 - /* 16 = double-word, 8 = extra-word, 4 = word, 2 = half-word */
377 --static inline int decode_access_size(unsigned int insn)
378 -+static inline int decode_access_size(struct pt_regs *regs, unsigned int insn)
379 - {
380 - unsigned int tmp;
381 -
382 -@@ -65,7 +65,7 @@ static inline int decode_access_size(unsigned int insn)
383 - return 2;
384 - else {
385 - printk("Impossible unaligned trap. insn=%08x\n", insn);
386 -- die_if_kernel("Byte sized unaligned access?!?!", current_thread_info()->kregs);
387 -+ die_if_kernel("Byte sized unaligned access?!?!", regs);
388 -
389 - /* GCC should never warn that control reaches the end
390 - * of this function without returning a value because
391 -@@ -289,7 +289,7 @@ static void log_unaligned(struct pt_regs *regs)
392 - asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
393 - {
394 - enum direction dir = decode_direction(insn);
395 -- int size = decode_access_size(insn);
396 -+ int size = decode_access_size(regs, insn);
397 - int orig_asi, asi;
398 -
399 - current_thread_info()->kern_una_regs = regs;
400 -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
401 -index eb40925..ddb52b8 100644
402 ---- a/arch/x86/Kconfig
403 -+++ b/arch/x86/Kconfig
404 -@@ -627,7 +627,7 @@ config GART_IOMMU
405 - bool "GART IOMMU support" if EMBEDDED
406 - default y
407 - select SWIOTLB
408 -- depends on X86_64 && PCI
409 -+ depends on X86_64 && PCI && K8_NB
410 - ---help---
411 - Support for full DMA access of devices with 32bit memory access only
412 - on systems with more than 3GB. This is usually needed for USB,
413 -@@ -2026,7 +2026,7 @@ endif # X86_32
414 -
415 - config K8_NB
416 - def_bool y
417 -- depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA)))
418 -+ depends on CPU_SUP_AMD && PCI
419 -
420 - source "drivers/pcmcia/Kconfig"
421 -
422 -diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
423 -index be37059..b35c160 100644
424 ---- a/arch/x86/kernel/apic/io_apic.c
425 -+++ b/arch/x86/kernel/apic/io_apic.c
426 -@@ -2539,6 +2539,9 @@ void irq_force_complete_move(int irq)
427 - struct irq_desc *desc = irq_to_desc(irq);
428 - struct irq_cfg *cfg = desc->chip_data;
429 -
430 -+ if (!cfg)
431 -+ return;
432 -+
433 - __irq_complete_move(&desc, cfg->vector);
434 - }
435 - #else
436 -diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
437 -index 6e44519..3b5ea38 100644
438 ---- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
439 -+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
440 -@@ -929,7 +929,8 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
441 - powernow_table[i].index = index;
442 -
443 - /* Frequency may be rounded for these */
444 -- if (boot_cpu_data.x86 == 0x10 || boot_cpu_data.x86 == 0x11) {
445 -+ if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
446 -+ || boot_cpu_data.x86 == 0x11) {
447 - powernow_table[i].frequency =
448 - freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7);
449 - } else
450 -diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
451 -index 7e1cca1..1366c7c 100644
452 ---- a/arch/x86/kernel/cpu/intel.c
453 -+++ b/arch/x86/kernel/cpu/intel.c
454 -@@ -47,6 +47,27 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
455 - (c->x86 == 0x6 && c->x86_model >= 0x0e))
456 - set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
457 -
458 -+ /*
459 -+ * Atom erratum AAE44/AAF40/AAG38/AAH41:
460 -+ *
461 -+ * A race condition between speculative fetches and invalidating
462 -+ * a large page. This is worked around in microcode, but we
463 -+ * need the microcode to have already been loaded... so if it is
464 -+ * not, recommend a BIOS update and disable large pages.
465 -+ */
466 -+ if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_mask <= 2) {
467 -+ u32 ucode, junk;
468 -+
469 -+ wrmsr(MSR_IA32_UCODE_REV, 0, 0);
470 -+ sync_core();
471 -+ rdmsr(MSR_IA32_UCODE_REV, junk, ucode);
472 -+
473 -+ if (ucode < 0x20e) {
474 -+ printk(KERN_WARNING "Atom PSE erratum detected, BIOS microcode update recommended\n");
475 -+ clear_cpu_cap(c, X86_FEATURE_PSE);
476 -+ }
477 -+ }
478 -+
479 - #ifdef CONFIG_X86_64
480 - set_cpu_cap(c, X86_FEATURE_SYSENTER32);
481 - #else
482 -diff --git a/arch/x86/kernel/k8.c b/arch/x86/kernel/k8.c
483 -index cbc4332..9b89546 100644
484 ---- a/arch/x86/kernel/k8.c
485 -+++ b/arch/x86/kernel/k8.c
486 -@@ -121,3 +121,17 @@ void k8_flush_garts(void)
487 - }
488 - EXPORT_SYMBOL_GPL(k8_flush_garts);
489 -
490 -+static __init int init_k8_nbs(void)
491 -+{
492 -+ int err = 0;
493 -+
494 -+ err = cache_k8_northbridges();
495 -+
496 -+ if (err < 0)
497 -+ printk(KERN_NOTICE "K8 NB: Cannot enumerate AMD northbridges.\n");
498 -+
499 -+ return err;
500 -+}
501 -+
502 -+/* This has to go after the PCI subsystem */
503 -+fs_initcall(init_k8_nbs);
504 -diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
505 -index 4f41b29..0ae24d9 100644
506 ---- a/arch/x86/kernel/pci-gart_64.c
507 -+++ b/arch/x86/kernel/pci-gart_64.c
508 -@@ -738,7 +738,7 @@ int __init gart_iommu_init(void)
509 - unsigned long scratch;
510 - long i;
511 -
512 -- if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0)
513 -+ if (num_k8_northbridges == 0)
514 - return 0;
515 -
516 - #ifndef CONFIG_AGP_AMD64
517 -diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
518 -index 126f0b4..11d0702 100644
519 ---- a/arch/x86/kernel/process_64.c
520 -+++ b/arch/x86/kernel/process_64.c
521 -@@ -282,12 +282,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
522 -
523 - set_tsk_thread_flag(p, TIF_FORK);
524 -
525 -- p->thread.fs = me->thread.fs;
526 -- p->thread.gs = me->thread.gs;
527 - p->thread.io_bitmap_ptr = NULL;
528 -
529 - savesegment(gs, p->thread.gsindex);
530 -+ p->thread.gs = p->thread.gsindex ? 0 : me->thread.gs;
531 - savesegment(fs, p->thread.fsindex);
532 -+ p->thread.fs = p->thread.fsindex ? 0 : me->thread.fs;
533 - savesegment(es, p->thread.es);
534 - savesegment(ds, p->thread.ds);
535 -
536 -diff --git a/block/blk-timeout.c b/block/blk-timeout.c
537 -index 1ba7e0a..4f0c06c 100644
538 ---- a/block/blk-timeout.c
539 -+++ b/block/blk-timeout.c
540 -@@ -109,6 +109,7 @@ void blk_rq_timed_out_timer(unsigned long data)
541 - struct request_queue *q = (struct request_queue *) data;
542 - unsigned long flags, next = 0;
543 - struct request *rq, *tmp;
544 -+ int next_set = 0;
545 -
546 - spin_lock_irqsave(q->queue_lock, flags);
547 -
548 -@@ -122,16 +123,13 @@ void blk_rq_timed_out_timer(unsigned long data)
549 - if (blk_mark_rq_complete(rq))
550 - continue;
551 - blk_rq_timed_out(rq);
552 -- } else if (!next || time_after(next, rq->deadline))
553 -+ } else if (!next_set || time_after(next, rq->deadline)) {
554 - next = rq->deadline;
555 -+ next_set = 1;
556 -+ }
557 - }
558 -
559 -- /*
560 -- * next can never be 0 here with the list non-empty, since we always
561 -- * bump ->deadline to 1 so we can detect if the timer was ever added
562 -- * or not. See comment in blk_add_timer()
563 -- */
564 -- if (next)
565 -+ if (next_set)
566 - mod_timer(&q->timeout, round_jiffies_up(next));
567 -
568 - spin_unlock_irqrestore(q->queue_lock, flags);
569 -diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c
570 -index 943f2ab..ce038d8 100644
571 ---- a/crypto/async_tx/async_raid6_recov.c
572 -+++ b/crypto/async_tx/async_raid6_recov.c
573 -@@ -324,6 +324,7 @@ struct dma_async_tx_descriptor *
574 - async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
575 - struct page **blocks, struct async_submit_ctl *submit)
576 - {
577 -+ void *scribble = submit->scribble;
578 - int non_zero_srcs, i;
579 -
580 - BUG_ON(faila == failb);
581 -@@ -332,11 +333,13 @@ async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
582 -
583 - pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes);
584 -
585 -- /* we need to preserve the contents of 'blocks' for the async
586 -- * case, so punt to synchronous if a scribble buffer is not available
587 -+ /* if a dma resource is not available or a scribble buffer is not
588 -+ * available punt to the synchronous path. In the 'dma not
589 -+ * available' case be sure to use the scribble buffer to
590 -+ * preserve the content of 'blocks' as the caller intended.
591 - */
592 -- if (!submit->scribble) {
593 -- void **ptrs = (void **) blocks;
594 -+ if (!async_dma_find_channel(DMA_PQ) || !scribble) {
595 -+ void **ptrs = scribble ? scribble : (void **) blocks;
596 -
597 - async_tx_quiesce(&submit->depend_tx);
598 - for (i = 0; i < disks; i++)
599 -@@ -406,11 +409,13 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
600 -
601 - pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes);
602 -
603 -- /* we need to preserve the contents of 'blocks' for the async
604 -- * case, so punt to synchronous if a scribble buffer is not available
605 -+ /* if a dma resource is not available or a scribble buffer is not
606 -+ * available punt to the synchronous path. In the 'dma not
607 -+ * available' case be sure to use the scribble buffer to
608 -+ * preserve the content of 'blocks' as the caller intended.
609 - */
610 -- if (!scribble) {
611 -- void **ptrs = (void **) blocks;
612 -+ if (!async_dma_find_channel(DMA_PQ) || !scribble) {
613 -+ void **ptrs = scribble ? scribble : (void **) blocks;
614 -
615 - async_tx_quiesce(&submit->depend_tx);
616 - for (i = 0; i < disks; i++)
617 -diff --git a/drivers/Makefile b/drivers/Makefile
618 -index 6ee53c7..8b0b948 100644
619 ---- a/drivers/Makefile
620 -+++ b/drivers/Makefile
621 -@@ -17,6 +17,7 @@ obj-$(CONFIG_SFI) += sfi/
622 - obj-$(CONFIG_PNP) += pnp/
623 - obj-$(CONFIG_ARM_AMBA) += amba/
624 -
625 -+obj-$(CONFIG_VIRTIO) += virtio/
626 - obj-$(CONFIG_XEN) += xen/
627 -
628 - # regulators early, since some subsystems rely on them to initialize
629 -@@ -106,7 +107,6 @@ obj-$(CONFIG_HID) += hid/
630 - obj-$(CONFIG_PPC_PS3) += ps3/
631 - obj-$(CONFIG_OF) += of/
632 - obj-$(CONFIG_SSB) += ssb/
633 --obj-$(CONFIG_VIRTIO) += virtio/
634 - obj-$(CONFIG_VLYNQ) += vlynq/
635 - obj-$(CONFIG_STAGING) += staging/
636 - obj-y += platform/
637 -diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
638 -index dc4ffad..e02d93c 100644
639 ---- a/drivers/acpi/power_meter.c
640 -+++ b/drivers/acpi/power_meter.c
641 -@@ -34,7 +34,7 @@
642 - #define ACPI_POWER_METER_NAME "power_meter"
643 - ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
644 - #define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
645 --#define ACPI_POWER_METER_CLASS "power_meter_resource"
646 -+#define ACPI_POWER_METER_CLASS "pwr_meter_resource"
647 -
648 - #define NUM_SENSORS 17
649 -
650 -diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
651 -index 79d33d9..7c85265 100644
652 ---- a/drivers/acpi/sleep.c
653 -+++ b/drivers/acpi/sleep.c
654 -@@ -450,6 +450,126 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
655 - },
656 - },
657 - {
658 -+ .callback = init_set_sci_en_on_resume,
659 -+ .ident = "Lenovo ThinkPad T410",
660 -+ .matches = {
661 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
662 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
663 -+ },
664 -+ },
665 -+ {
666 -+ .callback = init_set_sci_en_on_resume,
667 -+ .ident = "Lenovo ThinkPad T510",
668 -+ .matches = {
669 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
670 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
671 -+ },
672 -+ },
673 -+ {
674 -+ .callback = init_set_sci_en_on_resume,
675 -+ .ident = "Lenovo ThinkPad W510",
676 -+ .matches = {
677 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
678 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
679 -+ },
680 -+ },
681 -+ {
682 -+ .callback = init_set_sci_en_on_resume,
683 -+ .ident = "Lenovo ThinkPad X201",
684 -+ .matches = {
685 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
686 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
687 -+ },
688 -+ },
689 -+ {
690 -+ .callback = init_set_sci_en_on_resume,
691 -+ .ident = "Lenovo ThinkPad X201",
692 -+ .matches = {
693 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
694 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
695 -+ },
696 -+ },
697 -+ {
698 -+ .callback = init_set_sci_en_on_resume,
699 -+ .ident = "Lenovo ThinkPad T410",
700 -+ .matches = {
701 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
702 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
703 -+ },
704 -+ },
705 -+ {
706 -+ .callback = init_set_sci_en_on_resume,
707 -+ .ident = "Lenovo ThinkPad T510",
708 -+ .matches = {
709 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
710 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
711 -+ },
712 -+ },
713 -+ {
714 -+ .callback = init_set_sci_en_on_resume,
715 -+ .ident = "Lenovo ThinkPad W510",
716 -+ .matches = {
717 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
718 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
719 -+ },
720 -+ },
721 -+ {
722 -+ .callback = init_set_sci_en_on_resume,
723 -+ .ident = "Lenovo ThinkPad X201",
724 -+ .matches = {
725 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
726 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
727 -+ },
728 -+ },
729 -+ {
730 -+ .callback = init_set_sci_en_on_resume,
731 -+ .ident = "Lenovo ThinkPad X201",
732 -+ .matches = {
733 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
734 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
735 -+ },
736 -+ },
737 -+ {
738 -+ .callback = init_set_sci_en_on_resume,
739 -+ .ident = "Lenovo ThinkPad T410",
740 -+ .matches = {
741 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
742 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
743 -+ },
744 -+ },
745 -+ {
746 -+ .callback = init_set_sci_en_on_resume,
747 -+ .ident = "Lenovo ThinkPad T510",
748 -+ .matches = {
749 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
750 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
751 -+ },
752 -+ },
753 -+ {
754 -+ .callback = init_set_sci_en_on_resume,
755 -+ .ident = "Lenovo ThinkPad W510",
756 -+ .matches = {
757 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
758 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
759 -+ },
760 -+ },
761 -+ {
762 -+ .callback = init_set_sci_en_on_resume,
763 -+ .ident = "Lenovo ThinkPad X201",
764 -+ .matches = {
765 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
766 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
767 -+ },
768 -+ },
769 -+ {
770 -+ .callback = init_set_sci_en_on_resume,
771 -+ .ident = "Lenovo ThinkPad X201",
772 -+ .matches = {
773 -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
774 -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
775 -+ },
776 -+ },
777 -+ {
778 - .callback = init_old_suspend_ordering,
779 - .ident = "Panasonic CF51-2L",
780 - .matches = {
781 -@@ -458,6 +578,30 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
782 - DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
783 - },
784 - },
785 -+ {
786 -+ .callback = init_set_sci_en_on_resume,
787 -+ .ident = "Dell Studio 1558",
788 -+ .matches = {
789 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
790 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1558"),
791 -+ },
792 -+ },
793 -+ {
794 -+ .callback = init_set_sci_en_on_resume,
795 -+ .ident = "Dell Studio 1557",
796 -+ .matches = {
797 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
798 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"),
799 -+ },
800 -+ },
801 -+ {
802 -+ .callback = init_set_sci_en_on_resume,
803 -+ .ident = "Dell Studio 1555",
804 -+ .matches = {
805 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
806 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1555"),
807 -+ },
808 -+ },
809 - {},
810 - };
811 - #endif /* CONFIG_SUSPEND */
812 -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
813 -index 9f6cfac..228740f 100644
814 ---- a/drivers/ata/libata-eh.c
815 -+++ b/drivers/ata/libata-eh.c
816 -@@ -879,6 +879,8 @@ static void ata_eh_set_pending(struct ata_port *ap, int fastdrain)
817 - void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
818 - {
819 - struct ata_port *ap = qc->ap;
820 -+ struct request_queue *q = qc->scsicmd->device->request_queue;
821 -+ unsigned long flags;
822 -
823 - WARN_ON(!ap->ops->error_handler);
824 -
825 -@@ -890,7 +892,9 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
826 - * Note that ATA_QCFLAG_FAILED is unconditionally set after
827 - * this function completes.
828 - */
829 -+ spin_lock_irqsave(q->queue_lock, flags);
830 - blk_abort_request(qc->scsicmd->request);
831 -+ spin_unlock_irqrestore(q->queue_lock, flags);
832 - }
833 -
834 - /**
835 -@@ -1624,6 +1628,7 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
836 - }
837 -
838 - /* okay, this error is ours */
839 -+ memset(&tf, 0, sizeof(tf));
840 - rc = ata_eh_read_log_10h(dev, &tag, &tf);
841 - if (rc) {
842 - ata_link_printk(link, KERN_ERR, "failed to read log page 10h "
843 -diff --git a/drivers/base/memory.c b/drivers/base/memory.c
844 -index bd02505..d7d77d4 100644
845 ---- a/drivers/base/memory.c
846 -+++ b/drivers/base/memory.c
847 -@@ -311,7 +311,7 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL);
848 - static ssize_t
849 - print_block_size(struct class *class, char *buf)
850 - {
851 -- return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
852 -+ return sprintf(buf, "%lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
853 - }
854 -
855 - static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL);
856 -diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
857 -index 2fb3a48..4b66c69 100644
858 ---- a/drivers/char/agp/Kconfig
859 -+++ b/drivers/char/agp/Kconfig
860 -@@ -57,7 +57,7 @@ config AGP_AMD
861 -
862 - config AGP_AMD64
863 - tristate "AMD Opteron/Athlon64 on-CPU GART support"
864 -- depends on AGP && X86
865 -+ depends on AGP && X86 && K8_NB
866 - help
867 - This option gives you AGP support for the GLX component of
868 - X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
869 -diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
870 -index 73655ae..f8e57c6 100644
871 ---- a/drivers/cpuidle/governors/menu.c
872 -+++ b/drivers/cpuidle/governors/menu.c
873 -@@ -101,7 +101,6 @@ struct menu_device {
874 -
875 - unsigned int expected_us;
876 - u64 predicted_us;
877 -- unsigned int measured_us;
878 - unsigned int exit_us;
879 - unsigned int bucket;
880 - u64 correction_factor[BUCKETS];
881 -@@ -187,14 +186,14 @@ static int menu_select(struct cpuidle_device *dev)
882 - int i;
883 - int multiplier;
884 -
885 -- data->last_state_idx = 0;
886 -- data->exit_us = 0;
887 --
888 - if (data->needs_update) {
889 - menu_update(dev);
890 - data->needs_update = 0;
891 - }
892 -
893 -+ data->last_state_idx = 0;
894 -+ data->exit_us = 0;
895 -+
896 - /* Special case when user has set very strict latency requirement */
897 - if (unlikely(latency_req == 0))
898 - return 0;
899 -@@ -294,7 +293,7 @@ static void menu_update(struct cpuidle_device *dev)
900 - new_factor = data->correction_factor[data->bucket]
901 - * (DECAY - 1) / DECAY;
902 -
903 -- if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING)
904 -+ if (data->expected_us > 0 && measured_us < MAX_INTERESTING)
905 - new_factor += RESOLUTION * measured_us / data->expected_us;
906 - else
907 - /*
908 -diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c
909 -index f5b6d9f..97e64bc 100644
910 ---- a/drivers/edac/edac_mce_amd.c
911 -+++ b/drivers/edac/edac_mce_amd.c
912 -@@ -294,7 +294,6 @@ wrong_ls_mce:
913 - void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
914 - {
915 - u32 ec = ERROR_CODE(regs->nbsl);
916 -- u32 xec = EXT_ERROR_CODE(regs->nbsl);
917 -
918 - if (!handle_errors)
919 - return;
920 -@@ -324,7 +323,7 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
921 - pr_cont("\n");
922 - }
923 -
924 -- pr_emerg("%s.\n", EXT_ERR_MSG(xec));
925 -+ pr_emerg("%s.\n", EXT_ERR_MSG(regs->nbsl));
926 -
927 - if (BUS_ERROR(ec) && nb_bus_decoder)
928 - nb_bus_decoder(node_id, regs);
929 -@@ -374,7 +373,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val,
930 - ((m->status & MCI_STATUS_PCC) ? "yes" : "no"));
931 -
932 - /* do the two bits[14:13] together */
933 -- ecc = m->status & (3ULL << 45);
934 -+ ecc = (m->status >> 45) & 0x3;
935 - if (ecc)
936 - pr_cont(", %sECC Error", ((ecc == 2) ? "C" : "U"));
937 -
938 -diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
939 -index a894ade..1372796 100644
940 ---- a/drivers/gpu/drm/i915/i915_debugfs.c
941 -+++ b/drivers/gpu/drm/i915/i915_debugfs.c
942 -@@ -162,7 +162,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
943 - struct drm_device *dev = node->minor->dev;
944 - drm_i915_private_t *dev_priv = dev->dev_private;
945 -
946 -- if (!IS_IRONLAKE(dev)) {
947 -+ if (!HAS_PCH_SPLIT(dev)) {
948 - seq_printf(m, "Interrupt enable: %08x\n",
949 - I915_READ(IER));
950 - seq_printf(m, "Interrupt identity: %08x\n",
951 -diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
952 -index 2307f98..d642efd 100644
953 ---- a/drivers/gpu/drm/i915/i915_dma.c
954 -+++ b/drivers/gpu/drm/i915/i915_dma.c
955 -@@ -978,15 +978,21 @@ static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size,
956 - * Some of the preallocated space is taken by the GTT
957 - * and popup. GTT is 1K per MB of aperture size, and popup is 4K.
958 - */
959 -- if (IS_G4X(dev) || IS_PINEVIEW(dev) || IS_IRONLAKE(dev))
960 -+ if (IS_G4X(dev) || IS_PINEVIEW(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev))
961 - overhead = 4096;
962 - else
963 - overhead = (*aperture_size / 1024) + 4096;
964 -
965 - switch (tmp & INTEL_GMCH_GMS_MASK) {
966 - case INTEL_855_GMCH_GMS_DISABLED:
967 -- DRM_ERROR("video memory is disabled\n");
968 -- return -1;
969 -+ /* XXX: This is what my A1 silicon has. */
970 -+ if (IS_GEN6(dev)) {
971 -+ stolen = 64 * 1024 * 1024;
972 -+ } else {
973 -+ DRM_ERROR("video memory is disabled\n");
974 -+ return -1;
975 -+ }
976 -+ break;
977 - case INTEL_855_GMCH_GMS_STOLEN_1M:
978 - stolen = 1 * 1024 * 1024;
979 - break;
980 -@@ -1064,7 +1070,7 @@ static unsigned long i915_gtt_to_phys(struct drm_device *dev,
981 - int gtt_offset, gtt_size;
982 -
983 - if (IS_I965G(dev)) {
984 -- if (IS_G4X(dev) || IS_IRONLAKE(dev)) {
985 -+ if (IS_G4X(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev)) {
986 - gtt_offset = 2*1024*1024;
987 - gtt_size = 2*1024*1024;
988 - } else {
989 -@@ -1445,7 +1451,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
990 -
991 - dev->driver->get_vblank_counter = i915_get_vblank_counter;
992 - dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
993 -- if (IS_G4X(dev) || IS_IRONLAKE(dev)) {
994 -+ if (IS_G4X(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev)) {
995 - dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
996 - dev->driver->get_vblank_counter = gm45_get_vblank_counter;
997 - }
998 -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
999 -index b99b6a8..16ce3ba 100644
1000 ---- a/drivers/gpu/drm/i915/i915_drv.h
1001 -+++ b/drivers/gpu/drm/i915/i915_drv.h
1002 -@@ -1026,7 +1026,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1003 - #define IS_845G(dev) ((dev)->pci_device == 0x2562)
1004 - #define IS_I85X(dev) ((dev)->pci_device == 0x3582)
1005 - #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
1006 --#define IS_I8XX(dev) (INTEL_INFO(dev)->is_i8xx)
1007 -+#define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx)
1008 - #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
1009 - #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1010 - #define IS_I945G(dev) ((dev)->pci_device == 0x2772)
1011 -@@ -1045,8 +1045,29 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1012 - #define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx)
1013 - #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
1014 -
1015 -+#define IS_GEN3(dev) (IS_I915G(dev) || \
1016 -+ IS_I915GM(dev) || \
1017 -+ IS_I945G(dev) || \
1018 -+ IS_I945GM(dev) || \
1019 -+ IS_G33(dev) || \
1020 -+ IS_PINEVIEW(dev))
1021 -+#define IS_GEN4(dev) ((dev)->pci_device == 0x2972 || \
1022 -+ (dev)->pci_device == 0x2982 || \
1023 -+ (dev)->pci_device == 0x2992 || \
1024 -+ (dev)->pci_device == 0x29A2 || \
1025 -+ (dev)->pci_device == 0x2A02 || \
1026 -+ (dev)->pci_device == 0x2A12 || \
1027 -+ (dev)->pci_device == 0x2E02 || \
1028 -+ (dev)->pci_device == 0x2E12 || \
1029 -+ (dev)->pci_device == 0x2E22 || \
1030 -+ (dev)->pci_device == 0x2E32 || \
1031 -+ (dev)->pci_device == 0x2A42 || \
1032 -+ (dev)->pci_device == 0x2E42)
1033 -+
1034 - #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
1035 -
1036 -+#define IS_GEN6(dev) ((dev)->pci_device == 0x0102)
1037 -+
1038 - /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1039 - * rows, which changed the alignment requirements and fence programming.
1040 - */
1041 -@@ -1067,6 +1088,9 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1042 - #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
1043 - #define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6)
1044 -
1045 -+#define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \
1046 -+ IS_GEN6(dev))
1047 -+
1048 - #define PRIMARY_RINGBUFFER_SIZE (128*1024)
1049 -
1050 - #endif
1051 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
1052 -index fd099a1..6458400 100644
1053 ---- a/drivers/gpu/drm/i915/i915_gem.c
1054 -+++ b/drivers/gpu/drm/i915/i915_gem.c
1055 -@@ -1819,7 +1819,7 @@ i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible)
1056 - return -EIO;
1057 -
1058 - if (!i915_seqno_passed(i915_get_gem_seqno(dev), seqno)) {
1059 -- if (IS_IRONLAKE(dev))
1060 -+ if (HAS_PCH_SPLIT(dev))
1061 - ier = I915_READ(DEIER) | I915_READ(GTIER);
1062 - else
1063 - ier = I915_READ(IER);
1064 -@@ -2316,6 +2316,12 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
1065 - pitch_val = obj_priv->stride / tile_width;
1066 - pitch_val = ffs(pitch_val) - 1;
1067 -
1068 -+ if (obj_priv->tiling_mode == I915_TILING_Y &&
1069 -+ HAS_128_BYTE_Y_TILING(dev))
1070 -+ WARN_ON(pitch_val > I830_FENCE_MAX_PITCH_VAL);
1071 -+ else
1072 -+ WARN_ON(pitch_val > I915_FENCE_MAX_PITCH_VAL);
1073 -+
1074 - val = obj_priv->gtt_offset;
1075 - if (obj_priv->tiling_mode == I915_TILING_Y)
1076 - val |= 1 << I830_FENCE_TILING_Y_SHIFT;
1077 -diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
1078 -index df278b2..040e80c 100644
1079 ---- a/drivers/gpu/drm/i915/i915_gem_tiling.c
1080 -+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
1081 -@@ -209,7 +209,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
1082 - uint32_t swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
1083 - bool need_disable;
1084 -
1085 -- if (IS_IRONLAKE(dev)) {
1086 -+ if (IS_IRONLAKE(dev) || IS_GEN6(dev)) {
1087 - /* On Ironlake whatever DRAM config, GPU always do
1088 - * same swizzling setup.
1089 - */
1090 -@@ -357,21 +357,17 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
1091 - * reg, so dont bother to check the size */
1092 - if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
1093 - return false;
1094 -- } else if (IS_I9XX(dev)) {
1095 -- uint32_t pitch_val = ffs(stride / tile_width) - 1;
1096 --
1097 -- /* XXX: For Y tiling, FENCE_MAX_PITCH_VAL is actually 6 (8KB)
1098 -- * instead of 4 (2KB) on 945s.
1099 -- */
1100 -- if (pitch_val > I915_FENCE_MAX_PITCH_VAL ||
1101 -- size > (I830_FENCE_MAX_SIZE_VAL << 20))
1102 -+ } else if (IS_GEN3(dev) || IS_GEN2(dev)) {
1103 -+ if (stride > 8192)
1104 - return false;
1105 -- } else {
1106 -- uint32_t pitch_val = ffs(stride / tile_width) - 1;
1107 -
1108 -- if (pitch_val > I830_FENCE_MAX_PITCH_VAL ||
1109 -- size > (I830_FENCE_MAX_SIZE_VAL << 19))
1110 -- return false;
1111 -+ if (IS_GEN3(dev)) {
1112 -+ if (size > I830_FENCE_MAX_SIZE_VAL << 20)
1113 -+ return false;
1114 -+ } else {
1115 -+ if (size > I830_FENCE_MAX_SIZE_VAL << 19)
1116 -+ return false;
1117 -+ }
1118 - }
1119 -
1120 - /* 965+ just needs multiples of tile width */
1121 -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
1122 -index a17d6bd..032f667 100644
1123 ---- a/drivers/gpu/drm/i915/i915_irq.c
1124 -+++ b/drivers/gpu/drm/i915/i915_irq.c
1125 -@@ -576,7 +576,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
1126 -
1127 - atomic_inc(&dev_priv->irq_received);
1128 -
1129 -- if (IS_IRONLAKE(dev))
1130 -+ if (HAS_PCH_SPLIT(dev))
1131 - return ironlake_irq_handler(dev);
1132 -
1133 - iir = I915_READ(IIR);
1134 -@@ -737,7 +737,7 @@ void i915_user_irq_get(struct drm_device *dev)
1135 -
1136 - spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
1137 - if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) {
1138 -- if (IS_IRONLAKE(dev))
1139 -+ if (HAS_PCH_SPLIT(dev))
1140 - ironlake_enable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
1141 - else
1142 - i915_enable_irq(dev_priv, I915_USER_INTERRUPT);
1143 -@@ -753,7 +753,7 @@ void i915_user_irq_put(struct drm_device *dev)
1144 - spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
1145 - BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0);
1146 - if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) {
1147 -- if (IS_IRONLAKE(dev))
1148 -+ if (HAS_PCH_SPLIT(dev))
1149 - ironlake_disable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
1150 - else
1151 - i915_disable_irq(dev_priv, I915_USER_INTERRUPT);
1152 -@@ -861,7 +861,7 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
1153 - return -EINVAL;
1154 -
1155 - spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
1156 -- if (IS_IRONLAKE(dev))
1157 -+ if (HAS_PCH_SPLIT(dev))
1158 - ironlake_enable_display_irq(dev_priv, (pipe == 0) ?
1159 - DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
1160 - else if (IS_I965G(dev))
1161 -@@ -883,7 +883,7 @@ void i915_disable_vblank(struct drm_device *dev, int pipe)
1162 - unsigned long irqflags;
1163 -
1164 - spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
1165 -- if (IS_IRONLAKE(dev))
1166 -+ if (HAS_PCH_SPLIT(dev))
1167 - ironlake_disable_display_irq(dev_priv, (pipe == 0) ?
1168 - DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
1169 - else
1170 -@@ -897,7 +897,7 @@ void i915_enable_interrupt (struct drm_device *dev)
1171 - {
1172 - struct drm_i915_private *dev_priv = dev->dev_private;
1173 -
1174 -- if (!IS_IRONLAKE(dev))
1175 -+ if (!HAS_PCH_SPLIT(dev))
1176 - opregion_enable_asle(dev);
1177 - dev_priv->irq_enabled = 1;
1178 - }
1179 -@@ -1076,7 +1076,7 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
1180 - INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
1181 - INIT_WORK(&dev_priv->error_work, i915_error_work_func);
1182 -
1183 -- if (IS_IRONLAKE(dev)) {
1184 -+ if (HAS_PCH_SPLIT(dev)) {
1185 - ironlake_irq_preinstall(dev);
1186 - return;
1187 - }
1188 -@@ -1108,7 +1108,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
1189 -
1190 - dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
1191 -
1192 -- if (IS_IRONLAKE(dev))
1193 -+ if (HAS_PCH_SPLIT(dev))
1194 - return ironlake_irq_postinstall(dev);
1195 -
1196 - /* Unmask the interrupts that we always want on. */
1197 -@@ -1196,7 +1196,7 @@ void i915_driver_irq_uninstall(struct drm_device * dev)
1198 -
1199 - dev_priv->vblank_pipe = 0;
1200 -
1201 -- if (IS_IRONLAKE(dev)) {
1202 -+ if (HAS_PCH_SPLIT(dev)) {
1203 - ironlake_irq_uninstall(dev);
1204 - return;
1205 - }
1206 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
1207 -index ab1bd2d..fd95bdf 100644
1208 ---- a/drivers/gpu/drm/i915/i915_reg.h
1209 -+++ b/drivers/gpu/drm/i915/i915_reg.h
1210 -@@ -221,7 +221,7 @@
1211 - #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
1212 - #define I830_FENCE_PITCH_SHIFT 4
1213 - #define I830_FENCE_REG_VALID (1<<0)
1214 --#define I915_FENCE_MAX_PITCH_VAL 0x10
1215 -+#define I915_FENCE_MAX_PITCH_VAL 4
1216 - #define I830_FENCE_MAX_PITCH_VAL 6
1217 - #define I830_FENCE_MAX_SIZE_VAL (1<<8)
1218 -
1219 -diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
1220 -index 15fbc1b..70c9d4b 100644
1221 ---- a/drivers/gpu/drm/i915/intel_bios.c
1222 -+++ b/drivers/gpu/drm/i915/intel_bios.c
1223 -@@ -247,6 +247,7 @@ static void
1224 - parse_general_features(struct drm_i915_private *dev_priv,
1225 - struct bdb_header *bdb)
1226 - {
1227 -+ struct drm_device *dev = dev_priv->dev;
1228 - struct bdb_general_features *general;
1229 -
1230 - /* Set sensible defaults in case we can't find the general block */
1231 -@@ -263,7 +264,7 @@ parse_general_features(struct drm_i915_private *dev_priv,
1232 - if (IS_I85X(dev_priv->dev))
1233 - dev_priv->lvds_ssc_freq =
1234 - general->ssc_freq ? 66 : 48;
1235 -- else if (IS_IRONLAKE(dev_priv->dev))
1236 -+ else if (IS_IRONLAKE(dev_priv->dev) || IS_GEN6(dev))
1237 - dev_priv->lvds_ssc_freq =
1238 - general->ssc_freq ? 100 : 120;
1239 - else
1240 -diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
1241 -index 79dd402..fccf074 100644
1242 ---- a/drivers/gpu/drm/i915/intel_crt.c
1243 -+++ b/drivers/gpu/drm/i915/intel_crt.c
1244 -@@ -39,7 +39,7 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
1245 - struct drm_i915_private *dev_priv = dev->dev_private;
1246 - u32 temp, reg;
1247 -
1248 -- if (IS_IRONLAKE(dev))
1249 -+ if (HAS_PCH_SPLIT(dev))
1250 - reg = PCH_ADPA;
1251 - else
1252 - reg = ADPA;
1253 -@@ -113,7 +113,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
1254 - else
1255 - dpll_md_reg = DPLL_B_MD;
1256 -
1257 -- if (IS_IRONLAKE(dev))
1258 -+ if (HAS_PCH_SPLIT(dev))
1259 - adpa_reg = PCH_ADPA;
1260 - else
1261 - adpa_reg = ADPA;
1262 -@@ -122,7 +122,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
1263 - * Disable separate mode multiplier used when cloning SDVO to CRT
1264 - * XXX this needs to be adjusted when we really are cloning
1265 - */
1266 -- if (IS_I965G(dev) && !IS_IRONLAKE(dev)) {
1267 -+ if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) {
1268 - dpll_md = I915_READ(dpll_md_reg);
1269 - I915_WRITE(dpll_md_reg,
1270 - dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK);
1271 -@@ -136,11 +136,11 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
1272 -
1273 - if (intel_crtc->pipe == 0) {
1274 - adpa |= ADPA_PIPE_A_SELECT;
1275 -- if (!IS_IRONLAKE(dev))
1276 -+ if (!HAS_PCH_SPLIT(dev))
1277 - I915_WRITE(BCLRPAT_A, 0);
1278 - } else {
1279 - adpa |= ADPA_PIPE_B_SELECT;
1280 -- if (!IS_IRONLAKE(dev))
1281 -+ if (!HAS_PCH_SPLIT(dev))
1282 - I915_WRITE(BCLRPAT_B, 0);
1283 - }
1284 -
1285 -@@ -202,7 +202,7 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
1286 - u32 hotplug_en;
1287 - int i, tries = 0;
1288 -
1289 -- if (IS_IRONLAKE(dev))
1290 -+ if (HAS_PCH_SPLIT(dev))
1291 - return intel_ironlake_crt_detect_hotplug(connector);
1292 -
1293 - /*
1294 -@@ -524,7 +524,7 @@ void intel_crt_init(struct drm_device *dev)
1295 - &intel_output->enc);
1296 -
1297 - /* Set up the DDC bus. */
1298 -- if (IS_IRONLAKE(dev))
1299 -+ if (HAS_PCH_SPLIT(dev))
1300 - i2c_reg = PCH_GPIOA;
1301 - else {
1302 - i2c_reg = GPIOA;
1303 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1304 -index b27202d..4b2458d 100644
1305 ---- a/drivers/gpu/drm/i915/intel_display.c
1306 -+++ b/drivers/gpu/drm/i915/intel_display.c
1307 -@@ -232,7 +232,7 @@ struct intel_limit {
1308 - #define G4X_P2_DISPLAY_PORT_FAST 10
1309 - #define G4X_P2_DISPLAY_PORT_LIMIT 0
1310 -
1311 --/* Ironlake */
1312 -+/* Ironlake / Sandybridge */
1313 - /* as we calculate clock using (register_value + 2) for
1314 - N/M1/M2, so here the range value for them is (actual_value-2).
1315 - */
1316 -@@ -690,7 +690,7 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
1317 - struct drm_device *dev = crtc->dev;
1318 - const intel_limit_t *limit;
1319 -
1320 -- if (IS_IRONLAKE(dev))
1321 -+ if (HAS_PCH_SPLIT(dev))
1322 - limit = intel_ironlake_limit(crtc);
1323 - else if (IS_G4X(dev)) {
1324 - limit = intel_g4x_limit(crtc);
1325 -@@ -1366,7 +1366,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1326 - dspcntr &= ~DISPPLANE_TILED;
1327 - }
1328 -
1329 -- if (IS_IRONLAKE(dev))
1330 -+ if (HAS_PCH_SPLIT(dev))
1331 - /* must disable */
1332 - dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
1333 -
1334 -@@ -1427,7 +1427,7 @@ static void i915_disable_vga (struct drm_device *dev)
1335 - u8 sr1;
1336 - u32 vga_reg;
1337 -
1338 -- if (IS_IRONLAKE(dev))
1339 -+ if (HAS_PCH_SPLIT(dev))
1340 - vga_reg = CPU_VGACNTRL;
1341 - else
1342 - vga_reg = VGACNTRL;
1343 -@@ -2111,7 +2111,7 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
1344 - struct drm_display_mode *adjusted_mode)
1345 - {
1346 - struct drm_device *dev = crtc->dev;
1347 -- if (IS_IRONLAKE(dev)) {
1348 -+ if (HAS_PCH_SPLIT(dev)) {
1349 - /* FDI link clock is fixed at 2.7G */
1350 - if (mode->clock * 3 > 27000 * 4)
1351 - return MODE_CLOCK_HIGH;
1352 -@@ -2967,7 +2967,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1353 - refclk / 1000);
1354 - } else if (IS_I9XX(dev)) {
1355 - refclk = 96000;
1356 -- if (IS_IRONLAKE(dev))
1357 -+ if (HAS_PCH_SPLIT(dev))
1358 - refclk = 120000; /* 120Mhz refclk */
1359 - } else {
1360 - refclk = 48000;
1361 -@@ -3025,7 +3025,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1362 - }
1363 -
1364 - /* FDI link */
1365 -- if (IS_IRONLAKE(dev)) {
1366 -+ if (HAS_PCH_SPLIT(dev)) {
1367 - int lane, link_bw, bpp;
1368 - /* eDP doesn't require FDI link, so just set DP M/N
1369 - according to current link config */
1370 -@@ -3102,7 +3102,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1371 - * PCH B stepping, previous chipset stepping should be
1372 - * ignoring this setting.
1373 - */
1374 -- if (IS_IRONLAKE(dev)) {
1375 -+ if (HAS_PCH_SPLIT(dev)) {
1376 - temp = I915_READ(PCH_DREF_CONTROL);
1377 - /* Always enable nonspread source */
1378 - temp &= ~DREF_NONSPREAD_SOURCE_MASK;
1379 -@@ -3149,7 +3149,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1380 - reduced_clock.m2;
1381 - }
1382 -
1383 -- if (!IS_IRONLAKE(dev))
1384 -+ if (!HAS_PCH_SPLIT(dev))
1385 - dpll = DPLL_VGA_MODE_DIS;
1386 -
1387 - if (IS_I9XX(dev)) {
1388 -@@ -3162,7 +3162,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1389 - sdvo_pixel_multiply = adjusted_mode->clock / mode->clock;
1390 - if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
1391 - dpll |= (sdvo_pixel_multiply - 1) << SDVO_MULTIPLIER_SHIFT_HIRES;
1392 -- else if (IS_IRONLAKE(dev))
1393 -+ else if (HAS_PCH_SPLIT(dev))
1394 - dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT;
1395 - }
1396 - if (is_dp)
1397 -@@ -3174,7 +3174,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1398 - else {
1399 - dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
1400 - /* also FPA1 */
1401 -- if (IS_IRONLAKE(dev))
1402 -+ if (HAS_PCH_SPLIT(dev))
1403 - dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT;
1404 - if (IS_G4X(dev) && has_reduced_clock)
1405 - dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT;
1406 -@@ -3193,7 +3193,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1407 - dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14;
1408 - break;
1409 - }
1410 -- if (IS_I965G(dev) && !IS_IRONLAKE(dev))
1411 -+ if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev))
1412 - dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT);
1413 - } else {
1414 - if (is_lvds) {
1415 -@@ -3227,7 +3227,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1416 -
1417 - /* Ironlake's plane is forced to pipe, bit 24 is to
1418 - enable color space conversion */
1419 -- if (!IS_IRONLAKE(dev)) {
1420 -+ if (!HAS_PCH_SPLIT(dev)) {
1421 - if (pipe == 0)
1422 - dspcntr &= ~DISPPLANE_SEL_PIPE_MASK;
1423 - else
1424 -@@ -3254,14 +3254,14 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1425 -
1426 -
1427 - /* Disable the panel fitter if it was on our pipe */
1428 -- if (!IS_IRONLAKE(dev) && intel_panel_fitter_pipe(dev) == pipe)
1429 -+ if (!HAS_PCH_SPLIT(dev) && intel_panel_fitter_pipe(dev) == pipe)
1430 - I915_WRITE(PFIT_CONTROL, 0);
1431 -
1432 - DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
1433 - drm_mode_debug_printmodeline(mode);
1434 -
1435 - /* assign to Ironlake registers */
1436 -- if (IS_IRONLAKE(dev)) {
1437 -+ if (HAS_PCH_SPLIT(dev)) {
1438 - fp_reg = pch_fp_reg;
1439 - dpll_reg = pch_dpll_reg;
1440 - }
1441 -@@ -3282,7 +3282,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1442 - if (is_lvds) {
1443 - u32 lvds;
1444 -
1445 -- if (IS_IRONLAKE(dev))
1446 -+ if (HAS_PCH_SPLIT(dev))
1447 - lvds_reg = PCH_LVDS;
1448 -
1449 - lvds = I915_READ(lvds_reg);
1450 -@@ -3328,7 +3328,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1451 - /* Wait for the clocks to stabilize. */
1452 - udelay(150);
1453 -
1454 -- if (IS_I965G(dev) && !IS_IRONLAKE(dev)) {
1455 -+ if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) {
1456 - if (is_sdvo) {
1457 - sdvo_pixel_multiply = adjusted_mode->clock / mode->clock;
1458 - I915_WRITE(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) |
1459 -@@ -3375,14 +3375,14 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1460 - /* pipesrc and dspsize control the size that is scaled from, which should
1461 - * always be the user's requested size.
1462 - */
1463 -- if (!IS_IRONLAKE(dev)) {
1464 -+ if (!HAS_PCH_SPLIT(dev)) {
1465 - I915_WRITE(dspsize_reg, ((mode->vdisplay - 1) << 16) |
1466 - (mode->hdisplay - 1));
1467 - I915_WRITE(dsppos_reg, 0);
1468 - }
1469 - I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
1470 -
1471 -- if (IS_IRONLAKE(dev)) {
1472 -+ if (HAS_PCH_SPLIT(dev)) {
1473 - I915_WRITE(data_m1_reg, TU_SIZE(m_n.tu) | m_n.gmch_m);
1474 - I915_WRITE(data_n1_reg, TU_SIZE(m_n.tu) | m_n.gmch_n);
1475 - I915_WRITE(link_m1_reg, m_n.link_m);
1476 -@@ -3403,7 +3403,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1477 -
1478 - intel_wait_for_vblank(dev);
1479 -
1480 -- if (IS_IRONLAKE(dev)) {
1481 -+ if (HAS_PCH_SPLIT(dev)) {
1482 - /* enable address swizzle for tiling buffer */
1483 - temp = I915_READ(DISP_ARB_CTL);
1484 - I915_WRITE(DISP_ARB_CTL, temp | DISP_TILE_SURFACE_SWIZZLING);
1485 -@@ -3438,7 +3438,7 @@ void intel_crtc_load_lut(struct drm_crtc *crtc)
1486 - return;
1487 -
1488 - /* use legacy palette for Ironlake */
1489 -- if (IS_IRONLAKE(dev))
1490 -+ if (HAS_PCH_SPLIT(dev))
1491 - palreg = (intel_crtc->pipe == 0) ? LGC_PALETTE_A :
1492 - LGC_PALETTE_B;
1493 -
1494 -@@ -3922,7 +3922,7 @@ static void intel_increase_pllclock(struct drm_crtc *crtc, bool schedule)
1495 - int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
1496 - int dpll = I915_READ(dpll_reg);
1497 -
1498 -- if (IS_IRONLAKE(dev))
1499 -+ if (HAS_PCH_SPLIT(dev))
1500 - return;
1501 -
1502 - if (!dev_priv->lvds_downclock_avail)
1503 -@@ -3961,7 +3961,7 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)
1504 - int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
1505 - int dpll = I915_READ(dpll_reg);
1506 -
1507 -- if (IS_IRONLAKE(dev))
1508 -+ if (HAS_PCH_SPLIT(dev))
1509 - return;
1510 -
1511 - if (!dev_priv->lvds_downclock_avail)
1512 -@@ -4382,7 +4382,7 @@ static void intel_setup_outputs(struct drm_device *dev)
1513 - if (IS_MOBILE(dev) && !IS_I830(dev))
1514 - intel_lvds_init(dev);
1515 -
1516 -- if (IS_IRONLAKE(dev)) {
1517 -+ if (HAS_PCH_SPLIT(dev)) {
1518 - int found;
1519 -
1520 - if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED))
1521 -@@ -4451,7 +4451,7 @@ static void intel_setup_outputs(struct drm_device *dev)
1522 - DRM_DEBUG_KMS("probing DP_D\n");
1523 - intel_dp_init(dev, DP_D);
1524 - }
1525 -- } else if (IS_I8XX(dev))
1526 -+ } else if (IS_GEN2(dev))
1527 - intel_dvo_init(dev);
1528 -
1529 - if (SUPPORTS_TV(dev))
1530 -@@ -4599,7 +4599,7 @@ void intel_init_clock_gating(struct drm_device *dev)
1531 - * Disable clock gating reported to work incorrectly according to the
1532 - * specs, but enable as much else as we can.
1533 - */
1534 -- if (IS_IRONLAKE(dev)) {
1535 -+ if (HAS_PCH_SPLIT(dev)) {
1536 - return;
1537 - } else if (IS_G4X(dev)) {
1538 - uint32_t dspclk_gate;
1539 -@@ -4672,7 +4672,7 @@ static void intel_init_display(struct drm_device *dev)
1540 - struct drm_i915_private *dev_priv = dev->dev_private;
1541 -
1542 - /* We always want a DPMS function */
1543 -- if (IS_IRONLAKE(dev))
1544 -+ if (HAS_PCH_SPLIT(dev))
1545 - dev_priv->display.dpms = ironlake_crtc_dpms;
1546 - else
1547 - dev_priv->display.dpms = i9xx_crtc_dpms;
1548 -@@ -4715,7 +4715,7 @@ static void intel_init_display(struct drm_device *dev)
1549 - i830_get_display_clock_speed;
1550 -
1551 - /* For FIFO watermark updates */
1552 -- if (IS_IRONLAKE(dev))
1553 -+ if (HAS_PCH_SPLIT(dev))
1554 - dev_priv->display.update_wm = NULL;
1555 - else if (IS_G4X(dev))
1556 - dev_priv->display.update_wm = g4x_update_wm;
1557 -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
1558 -index 1238bc9..66df0c3 100644
1559 ---- a/drivers/gpu/drm/i915/intel_lvds.c
1560 -+++ b/drivers/gpu/drm/i915/intel_lvds.c
1561 -@@ -661,7 +661,7 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
1562 - /* ACPI lid methods were generally unreliable in this generation, so
1563 - * don't even bother.
1564 - */
1565 -- if (IS_I8XX(dev))
1566 -+ if (IS_GEN2(dev))
1567 - return connector_status_connected;
1568 -
1569 - if (!dmi_check_system(bad_lid_status) && !acpi_lid_open())
1570 -diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
1571 -index 63f569b..6b89042 100644
1572 ---- a/drivers/gpu/drm/i915/intel_overlay.c
1573 -+++ b/drivers/gpu/drm/i915/intel_overlay.c
1574 -@@ -172,7 +172,7 @@ struct overlay_registers {
1575 - #define OFC_UPDATE 0x1
1576 -
1577 - #define OVERLAY_NONPHYSICAL(dev) (IS_G33(dev) || IS_I965G(dev))
1578 --#define OVERLAY_EXISTS(dev) (!IS_G4X(dev) && !IS_IRONLAKE(dev))
1579 -+#define OVERLAY_EXISTS(dev) (!IS_G4X(dev) && !IS_IRONLAKE(dev) && !IS_GEN6(dev))
1580 -
1581 -
1582 - static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
1583 -diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
1584 -index 10be7b5..855911e 100644
1585 ---- a/drivers/i2c/i2c-core.c
1586 -+++ b/drivers/i2c/i2c-core.c
1587 -@@ -1210,12 +1210,23 @@ static int i2c_detect_address(struct i2c_client *temp_client,
1588 - return 0;
1589 -
1590 - /* Make sure there is something at this address */
1591 -- if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0)
1592 -- return 0;
1593 -+ if (addr == 0x73 && (adapter->class & I2C_CLASS_HWMON)) {
1594 -+ /* Special probe for FSC hwmon chips */
1595 -+ union i2c_smbus_data dummy;
1596 -
1597 -- /* Prevent 24RF08 corruption */
1598 -- if ((addr & ~0x0f) == 0x50)
1599 -- i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL);
1600 -+ if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_READ, 0,
1601 -+ I2C_SMBUS_BYTE_DATA, &dummy) < 0)
1602 -+ return 0;
1603 -+ } else {
1604 -+ if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
1605 -+ I2C_SMBUS_QUICK, NULL) < 0)
1606 -+ return 0;
1607 -+
1608 -+ /* Prevent 24RF08 corruption */
1609 -+ if ((addr & ~0x0f) == 0x50)
1610 -+ i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
1611 -+ I2C_SMBUS_QUICK, NULL);
1612 -+ }
1613 -
1614 - /* Finally call the custom detection function */
1615 - memset(&info, 0, sizeof(struct i2c_board_info));
1616 -diff --git a/drivers/md/md.c b/drivers/md/md.c
1617 -index a20a71e..2ecd1d5 100644
1618 ---- a/drivers/md/md.c
1619 -+++ b/drivers/md/md.c
1620 -@@ -2108,12 +2108,18 @@ repeat:
1621 - if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */
1622 - /* .. if the array isn't clean, an 'even' event must also go
1623 - * to spares. */
1624 -- if ((mddev->events&1)==0)
1625 -+ if ((mddev->events&1)==0) {
1626 - nospares = 0;
1627 -+ sync_req = 2; /* force a second update to get the
1628 -+ * even/odd in sync */
1629 -+ }
1630 - } else {
1631 - /* otherwise an 'odd' event must go to spares */
1632 -- if ((mddev->events&1))
1633 -+ if ((mddev->events&1)) {
1634 - nospares = 0;
1635 -+ sync_req = 2; /* force a second update to get the
1636 -+ * even/odd in sync */
1637 -+ }
1638 - }
1639 - }
1640 -
1641 -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1642 -index ceb24af..0468f5b 100644
1643 ---- a/drivers/md/raid5.c
1644 -+++ b/drivers/md/raid5.c
1645 -@@ -1526,7 +1526,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
1646 -
1647 - clear_bit(R5_UPTODATE, &sh->dev[i].flags);
1648 - atomic_inc(&rdev->read_errors);
1649 -- if (conf->mddev->degraded)
1650 -+ if (conf->mddev->degraded >= conf->max_degraded)
1651 - printk_rl(KERN_WARNING
1652 - "raid5:%s: read error not correctable "
1653 - "(sector %llu on %s).\n",
1654 -@@ -1649,8 +1649,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1655 - int previous, int *dd_idx,
1656 - struct stripe_head *sh)
1657 - {
1658 -- long stripe;
1659 -- unsigned long chunk_number;
1660 -+ sector_t stripe, stripe2;
1661 -+ sector_t chunk_number;
1662 - unsigned int chunk_offset;
1663 - int pd_idx, qd_idx;
1664 - int ddf_layout = 0;
1665 -@@ -1670,18 +1670,13 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1666 - */
1667 - chunk_offset = sector_div(r_sector, sectors_per_chunk);
1668 - chunk_number = r_sector;
1669 -- BUG_ON(r_sector != chunk_number);
1670 -
1671 - /*
1672 - * Compute the stripe number
1673 - */
1674 -- stripe = chunk_number / data_disks;
1675 --
1676 -- /*
1677 -- * Compute the data disk and parity disk indexes inside the stripe
1678 -- */
1679 -- *dd_idx = chunk_number % data_disks;
1680 --
1681 -+ stripe = chunk_number;
1682 -+ *dd_idx = sector_div(stripe, data_disks);
1683 -+ stripe2 = stripe;
1684 - /*
1685 - * Select the parity disk based on the user selected algorithm.
1686 - */
1687 -@@ -1693,21 +1688,21 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1688 - case 5:
1689 - switch (algorithm) {
1690 - case ALGORITHM_LEFT_ASYMMETRIC:
1691 -- pd_idx = data_disks - stripe % raid_disks;
1692 -+ pd_idx = data_disks - sector_div(stripe2, raid_disks);
1693 - if (*dd_idx >= pd_idx)
1694 - (*dd_idx)++;
1695 - break;
1696 - case ALGORITHM_RIGHT_ASYMMETRIC:
1697 -- pd_idx = stripe % raid_disks;
1698 -+ pd_idx = sector_div(stripe2, raid_disks);
1699 - if (*dd_idx >= pd_idx)
1700 - (*dd_idx)++;
1701 - break;
1702 - case ALGORITHM_LEFT_SYMMETRIC:
1703 -- pd_idx = data_disks - stripe % raid_disks;
1704 -+ pd_idx = data_disks - sector_div(stripe2, raid_disks);
1705 - *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
1706 - break;
1707 - case ALGORITHM_RIGHT_SYMMETRIC:
1708 -- pd_idx = stripe % raid_disks;
1709 -+ pd_idx = sector_div(stripe2, raid_disks);
1710 - *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
1711 - break;
1712 - case ALGORITHM_PARITY_0:
1713 -@@ -1727,7 +1722,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1714 -
1715 - switch (algorithm) {
1716 - case ALGORITHM_LEFT_ASYMMETRIC:
1717 -- pd_idx = raid_disks - 1 - (stripe % raid_disks);
1718 -+ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1719 - qd_idx = pd_idx + 1;
1720 - if (pd_idx == raid_disks-1) {
1721 - (*dd_idx)++; /* Q D D D P */
1722 -@@ -1736,7 +1731,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1723 - (*dd_idx) += 2; /* D D P Q D */
1724 - break;
1725 - case ALGORITHM_RIGHT_ASYMMETRIC:
1726 -- pd_idx = stripe % raid_disks;
1727 -+ pd_idx = sector_div(stripe2, raid_disks);
1728 - qd_idx = pd_idx + 1;
1729 - if (pd_idx == raid_disks-1) {
1730 - (*dd_idx)++; /* Q D D D P */
1731 -@@ -1745,12 +1740,12 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1732 - (*dd_idx) += 2; /* D D P Q D */
1733 - break;
1734 - case ALGORITHM_LEFT_SYMMETRIC:
1735 -- pd_idx = raid_disks - 1 - (stripe % raid_disks);
1736 -+ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1737 - qd_idx = (pd_idx + 1) % raid_disks;
1738 - *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks;
1739 - break;
1740 - case ALGORITHM_RIGHT_SYMMETRIC:
1741 -- pd_idx = stripe % raid_disks;
1742 -+ pd_idx = sector_div(stripe2, raid_disks);
1743 - qd_idx = (pd_idx + 1) % raid_disks;
1744 - *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks;
1745 - break;
1746 -@@ -1769,7 +1764,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1747 - /* Exactly the same as RIGHT_ASYMMETRIC, but or
1748 - * of blocks for computing Q is different.
1749 - */
1750 -- pd_idx = stripe % raid_disks;
1751 -+ pd_idx = sector_div(stripe2, raid_disks);
1752 - qd_idx = pd_idx + 1;
1753 - if (pd_idx == raid_disks-1) {
1754 - (*dd_idx)++; /* Q D D D P */
1755 -@@ -1784,7 +1779,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1756 - * D D D P Q rather than
1757 - * Q D D D P
1758 - */
1759 -- pd_idx = raid_disks - 1 - ((stripe + 1) % raid_disks);
1760 -+ stripe2 += 1;
1761 -+ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1762 - qd_idx = pd_idx + 1;
1763 - if (pd_idx == raid_disks-1) {
1764 - (*dd_idx)++; /* Q D D D P */
1765 -@@ -1796,7 +1792,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1766 -
1767 - case ALGORITHM_ROTATING_N_CONTINUE:
1768 - /* Same as left_symmetric but Q is before P */
1769 -- pd_idx = raid_disks - 1 - (stripe % raid_disks);
1770 -+ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
1771 - qd_idx = (pd_idx + raid_disks - 1) % raid_disks;
1772 - *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
1773 - ddf_layout = 1;
1774 -@@ -1804,27 +1800,27 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
1775 -
1776 - case ALGORITHM_LEFT_ASYMMETRIC_6:
1777 - /* RAID5 left_asymmetric, with Q on last device */
1778 -- pd_idx = data_disks - stripe % (raid_disks-1);
1779 -+ pd_idx = data_disks - sector_div(stripe2, raid_disks-1);
1780 - if (*dd_idx >= pd_idx)
1781 - (*dd_idx)++;
1782 - qd_idx = raid_disks - 1;
1783 - break;
1784 -
1785 - case ALGORITHM_RIGHT_ASYMMETRIC_6:
1786 -- pd_idx = stripe % (raid_disks-1);
1787 -+ pd_idx = sector_div(stripe2, raid_disks-1);
1788 - if (*dd_idx >= pd_idx)
1789 - (*dd_idx)++;
1790 - qd_idx = raid_disks - 1;
1791 - break;
1792 -
1793 - case ALGORITHM_LEFT_SYMMETRIC_6:
1794 -- pd_idx = data_disks - stripe % (raid_disks-1);
1795 -+ pd_idx = data_disks - sector_div(stripe2, raid_disks-1);
1796 - *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1);
1797 - qd_idx = raid_disks - 1;
1798 - break;
1799 -
1800 - case ALGORITHM_RIGHT_SYMMETRIC_6:
1801 -- pd_idx = stripe % (raid_disks-1);
1802 -+ pd_idx = sector_div(stripe2, raid_disks-1);
1803 - *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1);
1804 - qd_idx = raid_disks - 1;
1805 - break;
1806 -@@ -1869,14 +1865,14 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
1807 - : conf->algorithm;
1808 - sector_t stripe;
1809 - int chunk_offset;
1810 -- int chunk_number, dummy1, dd_idx = i;
1811 -+ sector_t chunk_number;
1812 -+ int dummy1, dd_idx = i;
1813 - sector_t r_sector;
1814 - struct stripe_head sh2;
1815 -
1816 -
1817 - chunk_offset = sector_div(new_sector, sectors_per_chunk);
1818 - stripe = new_sector;
1819 -- BUG_ON(new_sector != stripe);
1820 -
1821 - if (i == sh->pd_idx)
1822 - return 0;
1823 -@@ -1969,7 +1965,7 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
1824 - }
1825 -
1826 - chunk_number = stripe * data_disks + i;
1827 -- r_sector = (sector_t)chunk_number * sectors_per_chunk + chunk_offset;
1828 -+ r_sector = chunk_number * sectors_per_chunk + chunk_offset;
1829 -
1830 - check = raid5_compute_sector(conf, r_sector,
1831 - previous, &dummy1, &sh2);
1832 -diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
1833 -index e48380c..95a463c 100644
1834 ---- a/drivers/media/dvb/ttpci/budget.c
1835 -+++ b/drivers/media/dvb/ttpci/budget.c
1836 -@@ -643,9 +643,6 @@ static void frontend_init(struct budget *budget)
1837 - &budget->i2c_adap,
1838 - &tt1600_isl6423_config);
1839 -
1840 -- } else {
1841 -- dvb_frontend_detach(budget->dvb_frontend);
1842 -- budget->dvb_frontend = NULL;
1843 - }
1844 - }
1845 - break;
1846 -diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
1847 -index 65df1de..a555c90 100644
1848 ---- a/drivers/net/bnx2.c
1849 -+++ b/drivers/net/bnx2.c
1850 -@@ -4772,8 +4772,12 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
1851 - rc = bnx2_alloc_bad_rbuf(bp);
1852 - }
1853 -
1854 -- if (bp->flags & BNX2_FLAG_USING_MSIX)
1855 -+ if (bp->flags & BNX2_FLAG_USING_MSIX) {
1856 - bnx2_setup_msix_tbl(bp);
1857 -+ /* Prevent MSIX table reads and write from timing out */
1858 -+ REG_WR(bp, BNX2_MISC_ECO_HW_CTL,
1859 -+ BNX2_MISC_ECO_HW_CTL_LARGE_GRC_TMOUT_EN);
1860 -+ }
1861 -
1862 - return rc;
1863 - }
1864 -diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
1865 -index 3db85da..787befc 100644
1866 ---- a/drivers/net/r8169.c
1867 -+++ b/drivers/net/r8169.c
1868 -@@ -2832,8 +2832,13 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
1869 - spin_lock_irq(&tp->lock);
1870 -
1871 - RTL_W8(Cfg9346, Cfg9346_Unlock);
1872 -- RTL_W32(MAC0, low);
1873 -+
1874 - RTL_W32(MAC4, high);
1875 -+ RTL_R32(MAC4);
1876 -+
1877 -+ RTL_W32(MAC0, low);
1878 -+ RTL_R32(MAC0);
1879 -+
1880 - RTL_W8(Cfg9346, Cfg9346_Lock);
1881 -
1882 - spin_unlock_irq(&tp->lock);
1883 -@@ -4316,7 +4321,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
1884 -
1885 - tp->cur_tx += frags + 1;
1886 -
1887 -- smp_wmb();
1888 -+ wmb();
1889 -
1890 - RTL_W8(TxPoll, NPQ); /* set polling bit */
1891 -
1892 -@@ -4675,7 +4680,7 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
1893 - * until it does.
1894 - */
1895 - tp->intr_mask = 0xffff;
1896 -- smp_wmb();
1897 -+ wmb();
1898 - RTL_W16(IntrMask, tp->intr_event);
1899 - }
1900 -
1901 -@@ -4813,8 +4818,8 @@ static void rtl_set_rx_mode(struct net_device *dev)
1902 - mc_filter[1] = swab32(data);
1903 - }
1904 -
1905 -- RTL_W32(MAR0 + 0, mc_filter[0]);
1906 - RTL_W32(MAR0 + 4, mc_filter[1]);
1907 -+ RTL_W32(MAR0 + 0, mc_filter[0]);
1908 -
1909 - RTL_W32(RxConfig, tmp);
1910 -
1911 -diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
1912 -index 46997e1..fb52e47 100644
1913 ---- a/drivers/net/sfc/efx.c
1914 -+++ b/drivers/net/sfc/efx.c
1915 -@@ -1862,6 +1862,7 @@ out:
1916 - }
1917 -
1918 - if (disabled) {
1919 -+ dev_close(efx->net_dev);
1920 - EFX_ERR(efx, "has been disabled\n");
1921 - efx->state = STATE_DISABLED;
1922 - } else {
1923 -@@ -1885,8 +1886,7 @@ static void efx_reset_work(struct work_struct *data)
1924 - }
1925 -
1926 - rtnl_lock();
1927 -- if (efx_reset(efx, efx->reset_pending))
1928 -- dev_close(efx->net_dev);
1929 -+ (void)efx_reset(efx, efx->reset_pending);
1930 - rtnl_unlock();
1931 - }
1932 -
1933 -diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
1934 -index 9d009c4..e20a824 100644
1935 ---- a/drivers/net/sfc/falcon.c
1936 -+++ b/drivers/net/sfc/falcon.c
1937 -@@ -1317,7 +1317,9 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
1938 -
1939 - EFX_LOG(efx, "PHY is %d phy_id %d\n", efx->phy_type, efx->mdio.prtad);
1940 -
1941 -- falcon_probe_board(efx, board_rev);
1942 -+ rc = falcon_probe_board(efx, board_rev);
1943 -+ if (rc)
1944 -+ goto fail2;
1945 -
1946 - kfree(nvconfig);
1947 - return 0;
1948 -diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
1949 -index 5712fdd..c7a933a 100644
1950 ---- a/drivers/net/sfc/falcon_boards.c
1951 -+++ b/drivers/net/sfc/falcon_boards.c
1952 -@@ -728,15 +728,7 @@ static const struct falcon_board_type board_types[] = {
1953 - },
1954 - };
1955 -
1956 --static const struct falcon_board_type falcon_dummy_board = {
1957 -- .init = efx_port_dummy_op_int,
1958 -- .init_phy = efx_port_dummy_op_void,
1959 -- .fini = efx_port_dummy_op_void,
1960 -- .set_id_led = efx_port_dummy_op_set_id_led,
1961 -- .monitor = efx_port_dummy_op_int,
1962 --};
1963 --
1964 --void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
1965 -+int falcon_probe_board(struct efx_nic *efx, u16 revision_info)
1966 - {
1967 - struct falcon_board *board = falcon_board(efx);
1968 - u8 type_id = FALCON_BOARD_TYPE(revision_info);
1969 -@@ -754,8 +746,9 @@ void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
1970 - (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
1971 - ? board->type->ref_model : board->type->gen_type,
1972 - 'A' + board->major, board->minor);
1973 -+ return 0;
1974 - } else {
1975 - EFX_ERR(efx, "unknown board type %d\n", type_id);
1976 -- board->type = &falcon_dummy_board;
1977 -+ return -ENODEV;
1978 - }
1979 - }
1980 -diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
1981 -index 9351c03..3166baf 100644
1982 ---- a/drivers/net/sfc/nic.h
1983 -+++ b/drivers/net/sfc/nic.h
1984 -@@ -156,7 +156,7 @@ extern struct efx_nic_type siena_a0_nic_type;
1985 - **************************************************************************
1986 - */
1987 -
1988 --extern void falcon_probe_board(struct efx_nic *efx, u16 revision_info);
1989 -+extern int falcon_probe_board(struct efx_nic *efx, u16 revision_info);
1990 -
1991 - /* TX data path */
1992 - extern int efx_nic_probe_tx(struct efx_tx_queue *tx_queue);
1993 -diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
1994 -index f8c6771..afbac2d 100644
1995 ---- a/drivers/net/sfc/siena.c
1996 -+++ b/drivers/net/sfc/siena.c
1997 -@@ -454,8 +454,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
1998 -
1999 - static void siena_update_nic_stats(struct efx_nic *efx)
2000 - {
2001 -- while (siena_try_update_nic_stats(efx) == -EAGAIN)
2002 -- cpu_relax();
2003 -+ int retry;
2004 -+
2005 -+ /* If we're unlucky enough to read statistics wduring the DMA, wait
2006 -+ * up to 10ms for it to finish (typically takes <500us) */
2007 -+ for (retry = 0; retry < 100; ++retry) {
2008 -+ if (siena_try_update_nic_stats(efx) == 0)
2009 -+ return;
2010 -+ udelay(100);
2011 -+ }
2012 -+
2013 -+ /* Use the old values instead */
2014 - }
2015 -
2016 - static void siena_start_nic_stats(struct efx_nic *efx)
2017 -diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
2018 -index 17d1493..8405fb8 100644
2019 ---- a/drivers/net/tg3.c
2020 -+++ b/drivers/net/tg3.c
2021 -@@ -8572,6 +8572,7 @@ static int tg3_test_msi(struct tg3 *tp)
2022 - pci_disable_msi(tp->pdev);
2023 -
2024 - tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI;
2025 -+ tp->napi[0].irq_vec = tp->pdev->irq;
2026 -
2027 - err = tg3_request_irq(tp, 0);
2028 - if (err)
2029 -diff --git a/drivers/net/tun.c b/drivers/net/tun.c
2030 -index 2834a01..909b73d 100644
2031 ---- a/drivers/net/tun.c
2032 -+++ b/drivers/net/tun.c
2033 -@@ -380,6 +380,10 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
2034 - }
2035 - }
2036 -
2037 -+ /* Orphan the skb - required as we might hang on to it
2038 -+ * for indefinite time. */
2039 -+ skb_orphan(skb);
2040 -+
2041 - /* Enqueue packet */
2042 - skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb);
2043 - dev->trans_start = jiffies;
2044 -diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
2045 -index 5f3b9ea..8a6e027 100644
2046 ---- a/drivers/net/usb/cdc_ether.c
2047 -+++ b/drivers/net/usb/cdc_ether.c
2048 -@@ -433,6 +433,7 @@ static const struct driver_info mbm_info = {
2049 - .bind = cdc_bind,
2050 - .unbind = usbnet_cdc_unbind,
2051 - .status = cdc_status,
2052 -+ .manage_power = cdc_manage_power,
2053 - };
2054 -
2055 - /*-------------------------------------------------------------------------*/
2056 -diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
2057 -index 3d406f9..c60625b 100644
2058 ---- a/drivers/net/usb/dm9601.c
2059 -+++ b/drivers/net/usb/dm9601.c
2060 -@@ -238,7 +238,7 @@ static int dm_write_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 valu
2061 - goto out;
2062 -
2063 - dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg);
2064 -- dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1c : 0x14);
2065 -+ dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1a : 0x12);
2066 -
2067 - for (i = 0; i < DM_TIMEOUT; i++) {
2068 - u8 tmp;
2069 -diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
2070 -index b9b9d6b..941f053 100644
2071 ---- a/drivers/net/wan/hdlc_ppp.c
2072 -+++ b/drivers/net/wan/hdlc_ppp.c
2073 -@@ -628,9 +628,15 @@ static void ppp_stop(struct net_device *dev)
2074 - ppp_cp_event(dev, PID_LCP, STOP, 0, 0, 0, NULL);
2075 - }
2076 -
2077 -+static void ppp_close(struct net_device *dev)
2078 -+{
2079 -+ ppp_tx_flush();
2080 -+}
2081 -+
2082 - static struct hdlc_proto proto = {
2083 - .start = ppp_start,
2084 - .stop = ppp_stop,
2085 -+ .close = ppp_close,
2086 - .type_trans = ppp_type_trans,
2087 - .ioctl = ppp_ioctl,
2088 - .netif_rx = ppp_rx,
2089 -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
2090 -index 7b1eab4..e55f718 100644
2091 ---- a/drivers/net/wireless/ath/ath9k/main.c
2092 -+++ b/drivers/net/wireless/ath/ath9k/main.c
2093 -@@ -1358,9 +1358,9 @@ void ath_cleanup(struct ath_softc *sc)
2094 - free_irq(sc->irq, sc);
2095 - ath_bus_cleanup(common);
2096 - kfree(sc->sec_wiphy);
2097 -- ieee80211_free_hw(sc->hw);
2098 -
2099 - ath9k_uninit_hw(sc);
2100 -+ ieee80211_free_hw(sc->hw);
2101 - }
2102 -
2103 - static int ath9k_reg_notifier(struct wiphy *wiphy,
2104 -diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
2105 -index 4bf4c21..41d33cd 100644
2106 ---- a/drivers/net/wireless/p54/p54pci.c
2107 -+++ b/drivers/net/wireless/p54/p54pci.c
2108 -@@ -245,7 +245,7 @@ static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index,
2109 - u32 idx, i;
2110 -
2111 - i = (*index) % ring_limit;
2112 -- (*index) = idx = le32_to_cpu(ring_control->device_idx[1]);
2113 -+ (*index) = idx = le32_to_cpu(ring_control->device_idx[ring_index]);
2114 - idx %= ring_limit;
2115 -
2116 - while (i != idx) {
2117 -diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
2118 -index 8742640..b3c4fbd 100644
2119 ---- a/drivers/net/wireless/p54/p54usb.c
2120 -+++ b/drivers/net/wireless/p54/p54usb.c
2121 -@@ -36,6 +36,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
2122 - /* Version 1 devices (pci chip + net2280) */
2123 - {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */
2124 - {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */
2125 -+ {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */
2126 - {USB_DEVICE(0x083a, 0x4501)}, /* Accton 802.11g WN4501 USB */
2127 - {USB_DEVICE(0x083a, 0x4502)}, /* Siemens Gigaset USB Adapter */
2128 - {USB_DEVICE(0x083a, 0x5501)}, /* Phillips CPWUA054 */
2129 -diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
2130 -index b6dda2b..9d147de 100644
2131 ---- a/drivers/net/wireless/p54/txrx.c
2132 -+++ b/drivers/net/wireless/p54/txrx.c
2133 -@@ -186,7 +186,7 @@ static int p54_tx_qos_accounting_alloc(struct p54_common *priv,
2134 - struct ieee80211_tx_queue_stats *queue;
2135 - unsigned long flags;
2136 -
2137 -- if (WARN_ON(p54_queue > P54_QUEUE_NUM))
2138 -+ if (WARN_ON(p54_queue >= P54_QUEUE_NUM))
2139 - return -EINVAL;
2140 -
2141 - queue = &priv->tx_stats[p54_queue];
2142 -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
2143 -index c4fead1..b8eb5e7 100644
2144 ---- a/drivers/pci/pci.c
2145 -+++ b/drivers/pci/pci.c
2146 -@@ -624,7 +624,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
2147 - */
2148 - int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
2149 - {
2150 -- return state > PCI_D0 ?
2151 -+ return state >= PCI_D0 ?
2152 - pci_platform_power_transition(dev, state) : -EINVAL;
2153 - }
2154 - EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
2155 -@@ -661,10 +661,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
2156 - */
2157 - return 0;
2158 -
2159 -- /* Check if we're already there */
2160 -- if (dev->current_state == state)
2161 -- return 0;
2162 --
2163 - __pci_start_power_transition(dev, state);
2164 -
2165 - /* This device is quirked not to be put into D3, so
2166 -diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
2167 -index e6b67f2..741672f 100644
2168 ---- a/drivers/scsi/libiscsi.c
2169 -+++ b/drivers/scsi/libiscsi.c
2170 -@@ -470,12 +470,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
2171 -
2172 - WARN_ON(hdrlength >= 256);
2173 - hdr->hlength = hdrlength & 0xFF;
2174 -+ hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
2175 -
2176 - if (session->tt->init_task && session->tt->init_task(task))
2177 - return -EIO;
2178 -
2179 - task->state = ISCSI_TASK_RUNNING;
2180 -- hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
2181 - session->cmdsn++;
2182 -
2183 - conn->scsicmd_pdus_cnt++;
2184 -diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
2185 -index e155011..816ab97 100644
2186 ---- a/drivers/scsi/libsas/sas_ata.c
2187 -+++ b/drivers/scsi/libsas/sas_ata.c
2188 -@@ -394,11 +394,15 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
2189 - void sas_ata_task_abort(struct sas_task *task)
2190 - {
2191 - struct ata_queued_cmd *qc = task->uldd_task;
2192 -+ struct request_queue *q = qc->scsicmd->device->request_queue;
2193 - struct completion *waiting;
2194 -+ unsigned long flags;
2195 -
2196 - /* Bounce SCSI-initiated commands to the SCSI EH */
2197 - if (qc->scsicmd) {
2198 -+ spin_lock_irqsave(q->queue_lock, flags);
2199 - blk_abort_request(qc->scsicmd->request);
2200 -+ spin_unlock_irqrestore(q->queue_lock, flags);
2201 - scsi_schedule_eh(qc->scsicmd->device->host);
2202 - return;
2203 - }
2204 -diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
2205 -index 14b1319..b672d10 100644
2206 ---- a/drivers/scsi/libsas/sas_scsi_host.c
2207 -+++ b/drivers/scsi/libsas/sas_scsi_host.c
2208 -@@ -1029,6 +1029,8 @@ int __sas_task_abort(struct sas_task *task)
2209 - void sas_task_abort(struct sas_task *task)
2210 - {
2211 - struct scsi_cmnd *sc = task->uldd_task;
2212 -+ struct request_queue *q = sc->device->request_queue;
2213 -+ unsigned long flags;
2214 -
2215 - /* Escape for libsas internal commands */
2216 - if (!sc) {
2217 -@@ -1043,7 +1045,9 @@ void sas_task_abort(struct sas_task *task)
2218 - return;
2219 - }
2220 -
2221 -+ spin_lock_irqsave(q->queue_lock, flags);
2222 - blk_abort_request(sc->request);
2223 -+ spin_unlock_irqrestore(q->queue_lock, flags);
2224 - scsi_schedule_eh(sc->device->host);
2225 - }
2226 -
2227 -diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
2228 -index 0b575c8..aa2a2dc 100644
2229 ---- a/drivers/scsi/scsi_debug.c
2230 -+++ b/drivers/scsi/scsi_debug.c
2231 -@@ -956,7 +956,8 @@ static int resp_start_stop(struct scsi_cmnd * scp,
2232 - static sector_t get_sdebug_capacity(void)
2233 - {
2234 - if (scsi_debug_virtual_gb > 0)
2235 -- return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb;
2236 -+ return (sector_t)scsi_debug_virtual_gb *
2237 -+ (1073741824 / scsi_debug_sector_size);
2238 - else
2239 - return sdebug_store_sectors;
2240 - }
2241 -diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
2242 -index 08ed506..e46155b 100644
2243 ---- a/drivers/scsi/scsi_error.c
2244 -+++ b/drivers/scsi/scsi_error.c
2245 -@@ -301,7 +301,20 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
2246 - if (scmd->device->allow_restart &&
2247 - (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
2248 - return FAILED;
2249 -- return SUCCESS;
2250 -+
2251 -+ if (blk_barrier_rq(scmd->request))
2252 -+ /*
2253 -+ * barrier requests should always retry on UA
2254 -+ * otherwise block will get a spurious error
2255 -+ */
2256 -+ return NEEDS_RETRY;
2257 -+ else
2258 -+ /*
2259 -+ * for normal (non barrier) commands, pass the
2260 -+ * UA upwards for a determination in the
2261 -+ * completion functions
2262 -+ */
2263 -+ return SUCCESS;
2264 -
2265 - /* these three are not supported */
2266 - case COPY_ABORTED:
2267 -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
2268 -index c664242..5697709 100644
2269 ---- a/drivers/scsi/scsi_lib.c
2270 -+++ b/drivers/scsi/scsi_lib.c
2271 -@@ -773,8 +773,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
2272 - * we already took a copy of the original into rq->errors which
2273 - * is what gets returned to the user
2274 - */
2275 -- if (sense_valid && sshdr.sense_key == RECOVERED_ERROR) {
2276 -- if (!(req->cmd_flags & REQ_QUIET))
2277 -+ if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
2278 -+ /* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
2279 -+ * print since caller wants ATA registers. Only occurs on
2280 -+ * SCSI ATA PASS_THROUGH commands when CK_COND=1
2281 -+ */
2282 -+ if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
2283 -+ ;
2284 -+ else if (!(req->cmd_flags & REQ_QUIET))
2285 - scsi_print_sense("", cmd);
2286 - result = 0;
2287 - /* BLOCK_PC may have set error */
2288 -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
2289 -index 255da53..bf15920 100644
2290 ---- a/drivers/scsi/sd.c
2291 -+++ b/drivers/scsi/sd.c
2292 -@@ -1039,6 +1039,7 @@ static void sd_prepare_flush(struct request_queue *q, struct request *rq)
2293 - {
2294 - rq->cmd_type = REQ_TYPE_BLOCK_PC;
2295 - rq->timeout = SD_TIMEOUT;
2296 -+ rq->retries = SD_MAX_RETRIES;
2297 - rq->cmd[0] = SYNCHRONIZE_CACHE;
2298 - rq->cmd_len = 10;
2299 - }
2300 -diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
2301 -index 24485cc..4822cb5 100644
2302 ---- a/drivers/serial/8250_pnp.c
2303 -+++ b/drivers/serial/8250_pnp.c
2304 -@@ -348,6 +348,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
2305 - { "FUJ02E6", 0 },
2306 - /* Fujitsu Wacom 2FGT Tablet PC device */
2307 - { "FUJ02E7", 0 },
2308 -+ /* Fujitsu Wacom 1FGT Tablet PC device */
2309 -+ { "FUJ02E9", 0 },
2310 - /*
2311 - * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
2312 - * disguise)
2313 -diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
2314 -index c2809f2..b12237f 100644
2315 ---- a/drivers/staging/hv/Hv.c
2316 -+++ b/drivers/staging/hv/Hv.c
2317 -@@ -306,9 +306,9 @@ void HvCleanup(void)
2318 - DPRINT_ENTER(VMBUS);
2319 -
2320 - if (gHvContext.SignalEventBuffer) {
2321 -+ kfree(gHvContext.SignalEventBuffer);
2322 - gHvContext.SignalEventBuffer = NULL;
2323 - gHvContext.SignalEventParam = NULL;
2324 -- kfree(gHvContext.SignalEventBuffer);
2325 - }
2326 -
2327 - if (gHvContext.GuestId == HV_LINUX_GUEST_ID) {
2328 -diff --git a/drivers/staging/hv/RndisFilter.c b/drivers/staging/hv/RndisFilter.c
2329 -index 26d7997..f05f4e1 100644
2330 ---- a/drivers/staging/hv/RndisFilter.c
2331 -+++ b/drivers/staging/hv/RndisFilter.c
2332 -@@ -756,6 +756,7 @@ static int RndisFilterOpenDevice(struct rndis_device *Device)
2333 -
2334 - ret = RndisFilterSetPacketFilter(Device,
2335 - NDIS_PACKET_TYPE_BROADCAST |
2336 -+ NDIS_PACKET_TYPE_ALL_MULTICAST |
2337 - NDIS_PACKET_TYPE_DIRECTED);
2338 - if (ret == 0)
2339 - Device->State = RNDIS_DEV_DATAINITIALIZED;
2340 -diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
2341 -index 0d7459e..4c3c8bc 100644
2342 ---- a/drivers/staging/hv/netvsc_drv.c
2343 -+++ b/drivers/staging/hv/netvsc_drv.c
2344 -@@ -413,8 +413,7 @@ static int netvsc_probe(struct device *device)
2345 - if (!net_drv_obj->Base.OnDeviceAdd)
2346 - return -1;
2347 -
2348 -- net = alloc_netdev(sizeof(struct net_device_context), "seth%d",
2349 -- ether_setup);
2350 -+ net = alloc_etherdev(sizeof(struct net_device_context));
2351 - if (!net)
2352 - return -1;
2353 -
2354 -diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
2355 -index 6da1021..a2566f1 100644
2356 ---- a/drivers/staging/usbip/usbip_event.c
2357 -+++ b/drivers/staging/usbip/usbip_event.c
2358 -@@ -117,6 +117,9 @@ void usbip_stop_eh(struct usbip_device *ud)
2359 - {
2360 - struct usbip_task *eh = &ud->eh;
2361 -
2362 -+ if (eh->thread == current)
2363 -+ return; /* do not wait for myself */
2364 -+
2365 - wait_for_completion(&eh->thread_done);
2366 - usbip_dbg_eh("usbip_eh has finished\n");
2367 - }
2368 -diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
2369 -index ca479a7..d9d0bf5 100644
2370 ---- a/drivers/usb/core/driver.c
2371 -+++ b/drivers/usb/core/driver.c
2372 -@@ -1255,9 +1255,8 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
2373 - udev->state == USB_STATE_SUSPENDED)
2374 - goto done;
2375 -
2376 -- udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
2377 --
2378 - if (msg.event & PM_EVENT_AUTO) {
2379 -+ udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
2380 - status = autosuspend_check(udev, 0);
2381 - if (status < 0)
2382 - goto done;
2383 -@@ -1789,6 +1788,34 @@ int usb_external_resume_device(struct usb_device *udev, pm_message_t msg)
2384 - return status;
2385 - }
2386 -
2387 -+static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
2388 -+{
2389 -+ int w, i;
2390 -+ struct usb_interface *intf;
2391 -+
2392 -+ /* Remote wakeup is needed only when we actually go to sleep.
2393 -+ * For things like FREEZE and QUIESCE, if the device is already
2394 -+ * autosuspended then its current wakeup setting is okay.
2395 -+ */
2396 -+ if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_QUIESCE) {
2397 -+ udev->do_remote_wakeup = 0;
2398 -+ return;
2399 -+ }
2400 -+
2401 -+ /* If remote wakeup is permitted, see whether any interface drivers
2402 -+ * actually want it.
2403 -+ */
2404 -+ w = 0;
2405 -+ if (device_may_wakeup(&udev->dev) && udev->actconfig) {
2406 -+ for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
2407 -+ intf = udev->actconfig->interface[i];
2408 -+ w |= intf->needs_remote_wakeup;
2409 -+ }
2410 -+ }
2411 -+
2412 -+ udev->do_remote_wakeup = w;
2413 -+}
2414 -+
2415 - int usb_suspend(struct device *dev, pm_message_t msg)
2416 - {
2417 - struct usb_device *udev;
2418 -@@ -1808,6 +1835,7 @@ int usb_suspend(struct device *dev, pm_message_t msg)
2419 - }
2420 -
2421 - udev->skip_sys_resume = 0;
2422 -+ choose_wakeup(udev, msg);
2423 - return usb_external_suspend_device(udev, msg);
2424 - }
2425 -
2426 -diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
2427 -index bdf87a8..2c95153 100644
2428 ---- a/drivers/usb/core/generic.c
2429 -+++ b/drivers/usb/core/generic.c
2430 -@@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
2431 - * than a vendor-specific driver. */
2432 - else if (udev->descriptor.bDeviceClass !=
2433 - USB_CLASS_VENDOR_SPEC &&
2434 -- (!desc || desc->bInterfaceClass !=
2435 -+ (desc && desc->bInterfaceClass !=
2436 - USB_CLASS_VENDOR_SPEC)) {
2437 - best = c;
2438 - break;
2439 -diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
2440 -index 97b40ce..4a6366a 100644
2441 ---- a/drivers/usb/core/inode.c
2442 -+++ b/drivers/usb/core/inode.c
2443 -@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
2444 - *dentry = NULL;
2445 - mutex_lock(&parent->d_inode->i_mutex);
2446 - *dentry = lookup_one_len(name, parent, strlen(name));
2447 -- if (!IS_ERR(dentry)) {
2448 -+ if (!IS_ERR(*dentry)) {
2449 - if ((mode & S_IFMT) == S_IFDIR)
2450 - error = usbfs_mkdir (parent->d_inode, *dentry, mode);
2451 - else
2452 - error = usbfs_create (parent->d_inode, *dentry, mode);
2453 - } else
2454 -- error = PTR_ERR(dentry);
2455 -+ error = PTR_ERR(*dentry);
2456 - mutex_unlock(&parent->d_inode->i_mutex);
2457 -
2458 - return error;
2459 -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
2460 -index 9bc95fe..1a48aac 100644
2461 ---- a/drivers/usb/core/message.c
2462 -+++ b/drivers/usb/core/message.c
2463 -@@ -1471,7 +1471,7 @@ int usb_reset_configuration(struct usb_device *dev)
2464 - /* If not, reinstate the old alternate settings */
2465 - if (retval < 0) {
2466 - reset_old_alts:
2467 -- for (; i >= 0; i--) {
2468 -+ for (i--; i >= 0; i--) {
2469 - struct usb_interface *intf = config->interface[i];
2470 - struct usb_host_interface *alt;
2471 -
2472 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
2473 -index 9c90b67..efa0372 100644
2474 ---- a/drivers/usb/host/ehci-hcd.c
2475 -+++ b/drivers/usb/host/ehci-hcd.c
2476 -@@ -543,6 +543,7 @@ static int ehci_init(struct usb_hcd *hcd)
2477 - */
2478 - ehci->periodic_size = DEFAULT_I_TDPS;
2479 - INIT_LIST_HEAD(&ehci->cached_itd_list);
2480 -+ INIT_LIST_HEAD(&ehci->cached_sitd_list);
2481 - if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
2482 - return retval;
2483 -
2484 -diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
2485 -index aeda96e..1f3f01e 100644
2486 ---- a/drivers/usb/host/ehci-mem.c
2487 -+++ b/drivers/usb/host/ehci-mem.c
2488 -@@ -136,7 +136,7 @@ static inline void qh_put (struct ehci_qh *qh)
2489 -
2490 - static void ehci_mem_cleanup (struct ehci_hcd *ehci)
2491 - {
2492 -- free_cached_itd_list(ehci);
2493 -+ free_cached_lists(ehci);
2494 - if (ehci->async)
2495 - qh_put (ehci->async);
2496 - ehci->async = NULL;
2497 -diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
2498 -index df533ce..2064045 100644
2499 ---- a/drivers/usb/host/ehci-sched.c
2500 -+++ b/drivers/usb/host/ehci-sched.c
2501 -@@ -2137,13 +2137,27 @@ sitd_complete (
2502 - (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
2503 - }
2504 - iso_stream_put (ehci, stream);
2505 -- /* OK to recycle this SITD now that its completion callback ran. */
2506 -+
2507 - done:
2508 - sitd->urb = NULL;
2509 -- sitd->stream = NULL;
2510 -- list_move(&sitd->sitd_list, &stream->free_list);
2511 -- iso_stream_put(ehci, stream);
2512 --
2513 -+ if (ehci->clock_frame != sitd->frame) {
2514 -+ /* OK to recycle this SITD now. */
2515 -+ sitd->stream = NULL;
2516 -+ list_move(&sitd->sitd_list, &stream->free_list);
2517 -+ iso_stream_put(ehci, stream);
2518 -+ } else {
2519 -+ /* HW might remember this SITD, so we can't recycle it yet.
2520 -+ * Move it to a safe place until a new frame starts.
2521 -+ */
2522 -+ list_move(&sitd->sitd_list, &ehci->cached_sitd_list);
2523 -+ if (stream->refcount == 2) {
2524 -+ /* If iso_stream_put() were called here, stream
2525 -+ * would be freed. Instead, just prevent reuse.
2526 -+ */
2527 -+ stream->ep->hcpriv = NULL;
2528 -+ stream->ep = NULL;
2529 -+ }
2530 -+ }
2531 - return retval;
2532 - }
2533 -
2534 -@@ -2209,9 +2223,10 @@ done:
2535 -
2536 - /*-------------------------------------------------------------------------*/
2537 -
2538 --static void free_cached_itd_list(struct ehci_hcd *ehci)
2539 -+static void free_cached_lists(struct ehci_hcd *ehci)
2540 - {
2541 - struct ehci_itd *itd, *n;
2542 -+ struct ehci_sitd *sitd, *sn;
2543 -
2544 - list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
2545 - struct ehci_iso_stream *stream = itd->stream;
2546 -@@ -2219,6 +2234,13 @@ static void free_cached_itd_list(struct ehci_hcd *ehci)
2547 - list_move(&itd->itd_list, &stream->free_list);
2548 - iso_stream_put(ehci, stream);
2549 - }
2550 -+
2551 -+ list_for_each_entry_safe(sitd, sn, &ehci->cached_sitd_list, sitd_list) {
2552 -+ struct ehci_iso_stream *stream = sitd->stream;
2553 -+ sitd->stream = NULL;
2554 -+ list_move(&sitd->sitd_list, &stream->free_list);
2555 -+ iso_stream_put(ehci, stream);
2556 -+ }
2557 - }
2558 -
2559 - /*-------------------------------------------------------------------------*/
2560 -@@ -2245,7 +2267,7 @@ scan_periodic (struct ehci_hcd *ehci)
2561 - clock_frame = -1;
2562 - }
2563 - if (ehci->clock_frame != clock_frame) {
2564 -- free_cached_itd_list(ehci);
2565 -+ free_cached_lists(ehci);
2566 - ehci->clock_frame = clock_frame;
2567 - }
2568 - clock %= mod;
2569 -@@ -2408,7 +2430,7 @@ restart:
2570 - clock = now;
2571 - clock_frame = clock >> 3;
2572 - if (ehci->clock_frame != clock_frame) {
2573 -- free_cached_itd_list(ehci);
2574 -+ free_cached_lists(ehci);
2575 - ehci->clock_frame = clock_frame;
2576 - }
2577 - } else {
2578 -diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
2579 -index b1dce96..556c0b4 100644
2580 ---- a/drivers/usb/host/ehci.h
2581 -+++ b/drivers/usb/host/ehci.h
2582 -@@ -87,8 +87,9 @@ struct ehci_hcd { /* one per controller */
2583 - int next_uframe; /* scan periodic, start here */
2584 - unsigned periodic_sched; /* periodic activity count */
2585 -
2586 -- /* list of itds completed while clock_frame was still active */
2587 -+ /* list of itds & sitds completed while clock_frame was still active */
2588 - struct list_head cached_itd_list;
2589 -+ struct list_head cached_sitd_list;
2590 - unsigned clock_frame;
2591 -
2592 - /* per root hub port */
2593 -@@ -195,7 +196,7 @@ timer_action_done (struct ehci_hcd *ehci, enum ehci_timer_action action)
2594 - clear_bit (action, &ehci->actions);
2595 - }
2596 -
2597 --static void free_cached_itd_list(struct ehci_hcd *ehci);
2598 -+static void free_cached_lists(struct ehci_hcd *ehci);
2599 -
2600 - /*-------------------------------------------------------------------------*/
2601 -
2602 -diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
2603 -index 32bbce9..65cac8c 100644
2604 ---- a/drivers/usb/host/ohci-hub.c
2605 -+++ b/drivers/usb/host/ohci-hub.c
2606 -@@ -697,7 +697,7 @@ static int ohci_hub_control (
2607 - u16 wLength
2608 - ) {
2609 - struct ohci_hcd *ohci = hcd_to_ohci (hcd);
2610 -- int ports = hcd_to_bus (hcd)->root_hub->maxchild;
2611 -+ int ports = ohci->num_ports;
2612 - u32 temp;
2613 - int retval = 0;
2614 -
2615 -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
2616 -index bffcef7..6c1f673 100644
2617 ---- a/drivers/usb/host/xhci-mem.c
2618 -+++ b/drivers/usb/host/xhci-mem.c
2619 -@@ -549,6 +549,19 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
2620 - return EP_INTERVAL(interval);
2621 - }
2622 -
2623 -+/* The "Mult" field in the endpoint context is only set for SuperSpeed devices.
2624 -+ * High speed endpoint descriptors can define "the number of additional
2625 -+ * transaction opportunities per microframe", but that goes in the Max Burst
2626 -+ * endpoint context field.
2627 -+ */
2628 -+static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
2629 -+ struct usb_host_endpoint *ep)
2630 -+{
2631 -+ if (udev->speed != USB_SPEED_SUPER || !ep->ss_ep_comp)
2632 -+ return 0;
2633 -+ return ep->ss_ep_comp->desc.bmAttributes;
2634 -+}
2635 -+
2636 - static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
2637 - struct usb_host_endpoint *ep)
2638 - {
2639 -@@ -579,6 +592,36 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
2640 - return type;
2641 - }
2642 -
2643 -+/* Return the maximum endpoint service interval time (ESIT) payload.
2644 -+ * Basically, this is the maxpacket size, multiplied by the burst size
2645 -+ * and mult size.
2646 -+ */
2647 -+static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
2648 -+ struct usb_device *udev,
2649 -+ struct usb_host_endpoint *ep)
2650 -+{
2651 -+ int max_burst;
2652 -+ int max_packet;
2653 -+
2654 -+ /* Only applies for interrupt or isochronous endpoints */
2655 -+ if (usb_endpoint_xfer_control(&ep->desc) ||
2656 -+ usb_endpoint_xfer_bulk(&ep->desc))
2657 -+ return 0;
2658 -+
2659 -+ if (udev->speed == USB_SPEED_SUPER) {
2660 -+ if (ep->ss_ep_comp)
2661 -+ return ep->ss_ep_comp->desc.wBytesPerInterval;
2662 -+ xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n");
2663 -+ /* Assume no bursts, no multiple opportunities to send. */
2664 -+ return ep->desc.wMaxPacketSize;
2665 -+ }
2666 -+
2667 -+ max_packet = ep->desc.wMaxPacketSize & 0x3ff;
2668 -+ max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
2669 -+ /* A 0 in max burst means 1 transfer per ESIT */
2670 -+ return max_packet * (max_burst + 1);
2671 -+}
2672 -+
2673 - int xhci_endpoint_init(struct xhci_hcd *xhci,
2674 - struct xhci_virt_device *virt_dev,
2675 - struct usb_device *udev,
2676 -@@ -590,6 +633,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
2677 - struct xhci_ring *ep_ring;
2678 - unsigned int max_packet;
2679 - unsigned int max_burst;
2680 -+ u32 max_esit_payload;
2681 -
2682 - ep_index = xhci_get_endpoint_index(&ep->desc);
2683 - ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
2684 -@@ -611,6 +655,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
2685 - ep_ctx->deq = ep_ring->first_seg->dma | ep_ring->cycle_state;
2686 -
2687 - ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep);
2688 -+ ep_ctx->ep_info |= EP_MULT(xhci_get_endpoint_mult(udev, ep));
2689 -
2690 - /* FIXME dig Mult and streams info out of ep companion desc */
2691 -
2692 -@@ -656,6 +701,26 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
2693 - default:
2694 - BUG();
2695 - }
2696 -+ max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
2697 -+ ep_ctx->tx_info = MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload);
2698 -+
2699 -+ /*
2700 -+ * XXX no idea how to calculate the average TRB buffer length for bulk
2701 -+ * endpoints, as the driver gives us no clue how big each scatter gather
2702 -+ * list entry (or buffer) is going to be.
2703 -+ *
2704 -+ * For isochronous and interrupt endpoints, we set it to the max
2705 -+ * available, until we have new API in the USB core to allow drivers to
2706 -+ * declare how much bandwidth they actually need.
2707 -+ *
2708 -+ * Normally, it would be calculated by taking the total of the buffer
2709 -+ * lengths in the TD and then dividing by the number of TRBs in a TD,
2710 -+ * including link TRBs, No-op TRBs, and Event data TRBs. Since we don't
2711 -+ * use Event Data TRBs, and we don't chain in a link TRB on short
2712 -+ * transfers, we're basically dividing by 1.
2713 -+ */
2714 -+ ep_ctx->tx_info |= AVG_TRB_LENGTH_FOR_EP(max_esit_payload);
2715 -+
2716 - /* FIXME Debug endpoint context */
2717 - return 0;
2718 - }
2719 -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
2720 -index 8778135..9e904a6 100644
2721 ---- a/drivers/usb/host/xhci.h
2722 -+++ b/drivers/usb/host/xhci.h
2723 -@@ -609,6 +609,10 @@ struct xhci_ep_ctx {
2724 - #define MAX_PACKET_MASK (0xffff << 16)
2725 - #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)
2726 -
2727 -+/* tx_info bitmasks */
2728 -+#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
2729 -+#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
2730 -+
2731 -
2732 - /**
2733 - * struct xhci_input_control_context
2734 -diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
2735 -index 0cfd621..a442989 100644
2736 ---- a/drivers/usb/serial/sierra.c
2737 -+++ b/drivers/usb/serial/sierra.c
2738 -@@ -229,6 +229,7 @@ static const struct sierra_iface_info direct_ip_interface_blacklist = {
2739 - static struct usb_device_id id_table [] = {
2740 - { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */
2741 - { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */
2742 -+ { USB_DEVICE(0x03F0, 0x211D) }, /* HP ev2210 a.k.a MC5725 */
2743 - { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */
2744 -
2745 - { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
2746 -diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
2747 -index 1ed3d55..17726a0 100644
2748 ---- a/drivers/w1/slaves/w1_therm.c
2749 -+++ b/drivers/w1/slaves/w1_therm.c
2750 -@@ -115,9 +115,8 @@ static struct w1_therm_family_converter w1_therm_families[] = {
2751 -
2752 - static inline int w1_DS18B20_convert_temp(u8 rom[9])
2753 - {
2754 -- int t = ((s16)rom[1] << 8) | rom[0];
2755 -- t = t*1000/16;
2756 -- return t;
2757 -+ s16 t = le16_to_cpup((__le16 *)rom);
2758 -+ return t*1000/16;
2759 - }
2760 -
2761 - static inline int w1_DS18S20_convert_temp(u8 rom[9])
2762 -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
2763 -index c568779..cae75c1 100644
2764 ---- a/fs/ext4/extents.c
2765 -+++ b/fs/ext4/extents.c
2766 -@@ -3767,7 +3767,6 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
2767 - __u64 start, __u64 len)
2768 - {
2769 - ext4_lblk_t start_blk;
2770 -- ext4_lblk_t len_blks;
2771 - int error = 0;
2772 -
2773 - /* fallback to generic here if not in extents fmt */
2774 -@@ -3781,8 +3780,14 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
2775 - if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) {
2776 - error = ext4_xattr_fiemap(inode, fieinfo);
2777 - } else {
2778 -+ ext4_lblk_t len_blks;
2779 -+ __u64 last_blk;
2780 -+
2781 - start_blk = start >> inode->i_sb->s_blocksize_bits;
2782 -- len_blks = len >> inode->i_sb->s_blocksize_bits;
2783 -+ last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits;
2784 -+ if (last_blk >= EXT_MAX_BLOCK)
2785 -+ last_blk = EXT_MAX_BLOCK-1;
2786 -+ len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1;
2787 -
2788 - /*
2789 - * Walk the extent tree gathering extent information.
2790 -diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
2791 -index 7f24a0b..1aba003 100644
2792 ---- a/fs/jfs/resize.c
2793 -+++ b/fs/jfs/resize.c
2794 -@@ -81,6 +81,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
2795 - struct inode *iplist[1];
2796 - struct jfs_superblock *j_sb, *j_sb2;
2797 - uint old_agsize;
2798 -+ int agsizechanged = 0;
2799 - struct buffer_head *bh, *bh2;
2800 -
2801 - /* If the volume hasn't grown, get out now */
2802 -@@ -333,6 +334,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
2803 - */
2804 - if ((rc = dbExtendFS(ipbmap, XAddress, nblocks)))
2805 - goto error_out;
2806 -+
2807 -+ agsizechanged |= (bmp->db_agsize != old_agsize);
2808 -+
2809 - /*
2810 - * the map now has extended to cover additional nblocks:
2811 - * dn_mapsize = oldMapsize + nblocks;
2812 -@@ -432,7 +436,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
2813 - * will correctly identify the new ag);
2814 - */
2815 - /* if new AG size the same as old AG size, done! */
2816 -- if (bmp->db_agsize != old_agsize) {
2817 -+ if (agsizechanged) {
2818 - if ((rc = diExtendFS(ipimap, ipbmap)))
2819 - goto error_out;
2820 -
2821 -diff --git a/fs/nfs/client.c b/fs/nfs/client.c
2822 -index bd39abc..37d555c 100644
2823 ---- a/fs/nfs/client.c
2824 -+++ b/fs/nfs/client.c
2825 -@@ -965,6 +965,8 @@ out_error:
2826 - static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
2827 - {
2828 - target->flags = source->flags;
2829 -+ target->rsize = source->rsize;
2830 -+ target->wsize = source->wsize;
2831 - target->acregmin = source->acregmin;
2832 - target->acregmax = source->acregmax;
2833 - target->acdirmin = source->acdirmin;
2834 -diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
2835 -index af6948d..b5d55d3 100644
2836 ---- a/fs/nfs/dir.c
2837 -+++ b/fs/nfs/dir.c
2838 -@@ -837,6 +837,8 @@ out_zap_parent:
2839 - /* If we have submounts, don't unhash ! */
2840 - if (have_submounts(dentry))
2841 - goto out_valid;
2842 -+ if (dentry->d_flags & DCACHE_DISCONNECTED)
2843 -+ goto out_valid;
2844 - shrink_dcache_parent(dentry);
2845 - }
2846 - d_drop(dentry);
2847 -diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
2848 -index bbf72d8..718f3fb 100644
2849 ---- a/fs/nfsd/nfs4xdr.c
2850 -+++ b/fs/nfsd/nfs4xdr.c
2851 -@@ -160,10 +160,10 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
2852 - argp->p = page_address(argp->pagelist[0]);
2853 - argp->pagelist++;
2854 - if (argp->pagelen < PAGE_SIZE) {
2855 -- argp->end = p + (argp->pagelen>>2);
2856 -+ argp->end = argp->p + (argp->pagelen>>2);
2857 - argp->pagelen = 0;
2858 - } else {
2859 -- argp->end = p + (PAGE_SIZE>>2);
2860 -+ argp->end = argp->p + (PAGE_SIZE>>2);
2861 - argp->pagelen -= PAGE_SIZE;
2862 - }
2863 - memcpy(((char*)p)+avail, argp->p, (nbytes - avail));
2864 -@@ -1425,10 +1425,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
2865 - argp->p = page_address(argp->pagelist[0]);
2866 - argp->pagelist++;
2867 - if (argp->pagelen < PAGE_SIZE) {
2868 -- argp->end = p + (argp->pagelen>>2);
2869 -+ argp->end = argp->p + (argp->pagelen>>2);
2870 - argp->pagelen = 0;
2871 - } else {
2872 -- argp->end = p + (PAGE_SIZE>>2);
2873 -+ argp->end = argp->p + (PAGE_SIZE>>2);
2874 - argp->pagelen -= PAGE_SIZE;
2875 - }
2876 - }
2877 -diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
2878 -index 21c808f..b18c6d6 100644
2879 ---- a/fs/ocfs2/buffer_head_io.c
2880 -+++ b/fs/ocfs2/buffer_head_io.c
2881 -@@ -407,6 +407,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
2882 - struct buffer_head *bh)
2883 - {
2884 - int ret = 0;
2885 -+ struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
2886 -
2887 - mlog_entry_void();
2888 -
2889 -@@ -426,6 +427,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
2890 -
2891 - get_bh(bh); /* for end_buffer_write_sync() */
2892 - bh->b_end_io = end_buffer_write_sync;
2893 -+ ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check);
2894 - submit_bh(WRITE, bh);
2895 -
2896 - wait_on_buffer(bh);
2897 -diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
2898 -index 02bf178..18bc101 100644
2899 ---- a/fs/ocfs2/dlm/dlmfs.c
2900 -+++ b/fs/ocfs2/dlm/dlmfs.c
2901 -@@ -205,7 +205,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
2902 - if ((count + *ppos) > i_size_read(inode))
2903 - readlen = i_size_read(inode) - *ppos;
2904 - else
2905 -- readlen = count - *ppos;
2906 -+ readlen = count;
2907 -
2908 - lvb_buf = kmalloc(readlen, GFP_NOFS);
2909 - if (!lvb_buf)
2910 -diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
2911 -index 88459bd..ec4d97f 100644
2912 ---- a/fs/ocfs2/inode.c
2913 -+++ b/fs/ocfs2/inode.c
2914 -@@ -559,6 +559,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
2915 - handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
2916 - if (IS_ERR(handle)) {
2917 - status = PTR_ERR(handle);
2918 -+ handle = NULL;
2919 - mlog_errno(status);
2920 - goto out;
2921 - }
2922 -diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
2923 -index 8ae65c9..a8e8572 100644
2924 ---- a/fs/ocfs2/refcounttree.c
2925 -+++ b/fs/ocfs2/refcounttree.c
2926 -@@ -4083,6 +4083,9 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
2927 - di->i_attr = s_di->i_attr;
2928 -
2929 - if (preserve) {
2930 -+ t_inode->i_uid = s_inode->i_uid;
2931 -+ t_inode->i_gid = s_inode->i_gid;
2932 -+ t_inode->i_mode = s_inode->i_mode;
2933 - di->i_uid = s_di->i_uid;
2934 - di->i_gid = s_di->i_gid;
2935 - di->i_mode = s_di->i_mode;
2936 -diff --git a/fs/proc/base.c b/fs/proc/base.c
2937 -index 3cd449d..8dce96c 100644
2938 ---- a/fs/proc/base.c
2939 -+++ b/fs/proc/base.c
2940 -@@ -2910,7 +2910,7 @@ out_no_task:
2941 - */
2942 - static const struct pid_entry tid_base_stuff[] = {
2943 - DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
2944 -- DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fd_operations),
2945 -+ DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations),
2946 - REG("environ", S_IRUSR, proc_environ_operations),
2947 - INF("auxv", S_IRUSR, proc_pid_auxv),
2948 - ONE("status", S_IRUGO, proc_pid_status),
2949 -diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
2950 -index c094f58..1e686ee 100644
2951 ---- a/fs/reiserfs/dir.c
2952 -+++ b/fs/reiserfs/dir.c
2953 -@@ -45,8 +45,6 @@ static inline bool is_privroot_deh(struct dentry *dir,
2954 - struct reiserfs_de_head *deh)
2955 - {
2956 - struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root;
2957 -- if (reiserfs_expose_privroot(dir->d_sb))
2958 -- return 0;
2959 - return (dir == dir->d_parent && privroot->d_inode &&
2960 - deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
2961 - }
2962 -diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
2963 -index 81f09fa..0392e82 100644
2964 ---- a/fs/reiserfs/xattr.c
2965 -+++ b/fs/reiserfs/xattr.c
2966 -@@ -557,7 +557,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
2967 - if (!err && new_size < i_size_read(dentry->d_inode)) {
2968 - struct iattr newattrs = {
2969 - .ia_ctime = current_fs_time(inode->i_sb),
2970 -- .ia_size = buffer_size,
2971 -+ .ia_size = new_size,
2972 - .ia_valid = ATTR_SIZE | ATTR_CTIME,
2973 - };
2974 -
2975 -@@ -976,21 +976,13 @@ int reiserfs_permission(struct inode *inode, int mask)
2976 - return generic_permission(inode, mask, NULL);
2977 - }
2978 -
2979 --/* This will catch lookups from the fs root to .reiserfs_priv */
2980 --static int
2981 --xattr_lookup_poison(struct dentry *dentry, struct qstr *q1, struct qstr *name)
2982 -+static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd)
2983 - {
2984 -- struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root;
2985 -- if (container_of(q1, struct dentry, d_name) == priv_root)
2986 -- return -ENOENT;
2987 -- if (q1->len == name->len &&
2988 -- !memcmp(q1->name, name->name, name->len))
2989 -- return 0;
2990 -- return 1;
2991 -+ return -EPERM;
2992 - }
2993 -
2994 - static const struct dentry_operations xattr_lookup_poison_ops = {
2995 -- .d_compare = xattr_lookup_poison,
2996 -+ .d_revalidate = xattr_hide_revalidate,
2997 - };
2998 -
2999 - int reiserfs_lookup_privroot(struct super_block *s)
3000 -@@ -1004,8 +996,7 @@ int reiserfs_lookup_privroot(struct super_block *s)
3001 - strlen(PRIVROOT_NAME));
3002 - if (!IS_ERR(dentry)) {
3003 - REISERFS_SB(s)->priv_root = dentry;
3004 -- if (!reiserfs_expose_privroot(s))
3005 -- s->s_root->d_op = &xattr_lookup_poison_ops;
3006 -+ dentry->d_op = &xattr_lookup_poison_ops;
3007 - if (dentry->d_inode)
3008 - dentry->d_inode->i_flags |= S_PRIVATE;
3009 - } else
3010 -diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
3011 -index 77414db..146d491 100644
3012 ---- a/fs/xfs/linux-2.6/xfs_super.c
3013 -+++ b/fs/xfs/linux-2.6/xfs_super.c
3014 -@@ -1160,6 +1160,7 @@ xfs_fs_put_super(
3015 -
3016 - xfs_unmountfs(mp);
3017 - xfs_freesb(mp);
3018 -+ xfs_inode_shrinker_unregister(mp);
3019 - xfs_icsb_destroy_counters(mp);
3020 - xfs_close_devices(mp);
3021 - xfs_dmops_put(mp);
3022 -@@ -1523,6 +1524,8 @@ xfs_fs_fill_super(
3023 - if (error)
3024 - goto fail_vnrele;
3025 -
3026 -+ xfs_inode_shrinker_register(mp);
3027 -+
3028 - kfree(mtpt);
3029 - return 0;
3030 -
3031 -@@ -1767,6 +1770,7 @@ init_xfs_fs(void)
3032 - goto out_cleanup_procfs;
3033 -
3034 - vfs_initquota();
3035 -+ xfs_inode_shrinker_init();
3036 -
3037 - error = register_filesystem(&xfs_fs_type);
3038 - if (error)
3039 -@@ -1794,6 +1798,7 @@ exit_xfs_fs(void)
3040 - {
3041 - vfs_exitquota();
3042 - unregister_filesystem(&xfs_fs_type);
3043 -+ xfs_inode_shrinker_destroy();
3044 - xfs_sysctl_unregister();
3045 - xfs_cleanup_procfs();
3046 - xfs_buf_terminate();
3047 -diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
3048 -index 6b6b394..57adf2d 100644
3049 ---- a/fs/xfs/linux-2.6/xfs_sync.c
3050 -+++ b/fs/xfs/linux-2.6/xfs_sync.c
3051 -@@ -95,7 +95,8 @@ xfs_inode_ag_walk(
3052 - struct xfs_perag *pag, int flags),
3053 - int flags,
3054 - int tag,
3055 -- int exclusive)
3056 -+ int exclusive,
3057 -+ int *nr_to_scan)
3058 - {
3059 - struct xfs_perag *pag = &mp->m_perag[ag];
3060 - uint32_t first_index;
3061 -@@ -135,7 +136,7 @@ restart:
3062 - if (error == EFSCORRUPTED)
3063 - break;
3064 -
3065 -- } while (1);
3066 -+ } while ((*nr_to_scan)--);
3067 -
3068 - if (skipped) {
3069 - delay(1);
3070 -@@ -153,23 +154,30 @@ xfs_inode_ag_iterator(
3071 - struct xfs_perag *pag, int flags),
3072 - int flags,
3073 - int tag,
3074 -- int exclusive)
3075 -+ int exclusive,
3076 -+ int *nr_to_scan)
3077 - {
3078 - int error = 0;
3079 - int last_error = 0;
3080 - xfs_agnumber_t ag;
3081 -+ int nr;
3082 -
3083 -+ nr = nr_to_scan ? *nr_to_scan : INT_MAX;
3084 - for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) {
3085 - if (!mp->m_perag[ag].pag_ici_init)
3086 - continue;
3087 - error = xfs_inode_ag_walk(mp, ag, execute, flags, tag,
3088 -- exclusive);
3089 -+ exclusive, &nr);
3090 - if (error) {
3091 - last_error = error;
3092 - if (error == EFSCORRUPTED)
3093 - break;
3094 - }
3095 -+ if (nr <= 0)
3096 -+ break;
3097 - }
3098 -+ if (nr_to_scan)
3099 -+ *nr_to_scan = nr;
3100 - return XFS_ERROR(last_error);
3101 - }
3102 -
3103 -@@ -289,7 +297,7 @@ xfs_sync_data(
3104 - ASSERT((flags & ~(SYNC_TRYLOCK|SYNC_WAIT)) == 0);
3105 -
3106 - error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags,
3107 -- XFS_ICI_NO_TAG, 0);
3108 -+ XFS_ICI_NO_TAG, 0, NULL);
3109 - if (error)
3110 - return XFS_ERROR(error);
3111 -
3112 -@@ -311,7 +319,7 @@ xfs_sync_attr(
3113 - ASSERT((flags & ~SYNC_WAIT) == 0);
3114 -
3115 - return xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags,
3116 -- XFS_ICI_NO_TAG, 0);
3117 -+ XFS_ICI_NO_TAG, 0, NULL);
3118 - }
3119 -
3120 - STATIC int
3121 -@@ -679,6 +687,7 @@ __xfs_inode_set_reclaim_tag(
3122 - radix_tree_tag_set(&pag->pag_ici_root,
3123 - XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino),
3124 - XFS_ICI_RECLAIM_TAG);
3125 -+ pag->pag_ici_reclaimable++;
3126 - }
3127 -
3128 - /*
3129 -@@ -710,6 +719,7 @@ __xfs_inode_clear_reclaim_tag(
3130 - {
3131 - radix_tree_tag_clear(&pag->pag_ici_root,
3132 - XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
3133 -+ pag->pag_ici_reclaimable--;
3134 - }
3135 -
3136 - STATIC int
3137 -@@ -770,5 +780,88 @@ xfs_reclaim_inodes(
3138 - int mode)
3139 - {
3140 - return xfs_inode_ag_iterator(mp, xfs_reclaim_inode, mode,
3141 -- XFS_ICI_RECLAIM_TAG, 1);
3142 -+ XFS_ICI_RECLAIM_TAG, 1, NULL);
3143 -+}
3144 -+
3145 -+/*
3146 -+ * Shrinker infrastructure.
3147 -+ *
3148 -+ * This is all far more complex than it needs to be. It adds a global list of
3149 -+ * mounts because the shrinkers can only call a global context. We need to make
3150 -+ * the shrinkers pass a context to avoid the need for global state.
3151 -+ */
3152 -+static LIST_HEAD(xfs_mount_list);
3153 -+static struct rw_semaphore xfs_mount_list_lock;
3154 -+
3155 -+static int
3156 -+xfs_reclaim_inode_shrink(
3157 -+ int nr_to_scan,
3158 -+ gfp_t gfp_mask)
3159 -+{
3160 -+ struct xfs_mount *mp;
3161 -+ xfs_agnumber_t ag;
3162 -+ int reclaimable = 0;
3163 -+
3164 -+ if (nr_to_scan) {
3165 -+ if (!(gfp_mask & __GFP_FS))
3166 -+ return -1;
3167 -+
3168 -+ down_read(&xfs_mount_list_lock);
3169 -+ list_for_each_entry(mp, &xfs_mount_list, m_mplist) {
3170 -+ xfs_inode_ag_iterator(mp, xfs_reclaim_inode, 0,
3171 -+ XFS_ICI_RECLAIM_TAG, 1, &nr_to_scan);
3172 -+ if (nr_to_scan <= 0)
3173 -+ break;
3174 -+ }
3175 -+ up_read(&xfs_mount_list_lock);
3176 -+ }
3177 -+
3178 -+ down_read(&xfs_mount_list_lock);
3179 -+ list_for_each_entry(mp, &xfs_mount_list, m_mplist) {
3180 -+ for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) {
3181 -+
3182 -+ if (!mp->m_perag[ag].pag_ici_init)
3183 -+ continue;
3184 -+ reclaimable += mp->m_perag[ag].pag_ici_reclaimable;
3185 -+ }
3186 -+ }
3187 -+ up_read(&xfs_mount_list_lock);
3188 -+ return reclaimable;
3189 -+}
3190 -+
3191 -+static struct shrinker xfs_inode_shrinker = {
3192 -+ .shrink = xfs_reclaim_inode_shrink,
3193 -+ .seeks = DEFAULT_SEEKS,
3194 -+};
3195 -+
3196 -+void __init
3197 -+xfs_inode_shrinker_init(void)
3198 -+{
3199 -+ init_rwsem(&xfs_mount_list_lock);
3200 -+ register_shrinker(&xfs_inode_shrinker);
3201 -+}
3202 -+
3203 -+void
3204 -+xfs_inode_shrinker_destroy(void)
3205 -+{
3206 -+ ASSERT(list_empty(&xfs_mount_list));
3207 -+ unregister_shrinker(&xfs_inode_shrinker);
3208 -+}
3209 -+
3210 -+void
3211 -+xfs_inode_shrinker_register(
3212 -+ struct xfs_mount *mp)
3213 -+{
3214 -+ down_write(&xfs_mount_list_lock);
3215 -+ list_add_tail(&mp->m_mplist, &xfs_mount_list);
3216 -+ up_write(&xfs_mount_list_lock);
3217 -+}
3218 -+
3219 -+void
3220 -+xfs_inode_shrinker_unregister(
3221 -+ struct xfs_mount *mp)
3222 -+{
3223 -+ down_write(&xfs_mount_list_lock);
3224 -+ list_del(&mp->m_mplist);
3225 -+ up_write(&xfs_mount_list_lock);
3226 - }
3227 -diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h
3228 -index ea932b4..0b28c13 100644
3229 ---- a/fs/xfs/linux-2.6/xfs_sync.h
3230 -+++ b/fs/xfs/linux-2.6/xfs_sync.h
3231 -@@ -54,6 +54,11 @@ void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag,
3232 - int xfs_sync_inode_valid(struct xfs_inode *ip, struct xfs_perag *pag);
3233 - int xfs_inode_ag_iterator(struct xfs_mount *mp,
3234 - int (*execute)(struct xfs_inode *ip, struct xfs_perag *pag, int flags),
3235 -- int flags, int tag, int write_lock);
3236 -+ int flags, int tag, int write_lock, int *nr_to_scan);
3237 -+
3238 -+void xfs_inode_shrinker_init(void);
3239 -+void xfs_inode_shrinker_destroy(void);
3240 -+void xfs_inode_shrinker_register(struct xfs_mount *mp);
3241 -+void xfs_inode_shrinker_unregister(struct xfs_mount *mp);
3242 -
3243 - #endif
3244 -diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
3245 -index 873e07e..145f596 100644
3246 ---- a/fs/xfs/quota/xfs_qm_syscalls.c
3247 -+++ b/fs/xfs/quota/xfs_qm_syscalls.c
3248 -@@ -891,7 +891,8 @@ xfs_qm_dqrele_all_inodes(
3249 - uint flags)
3250 - {
3251 - ASSERT(mp->m_quotainfo);
3252 -- xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags, XFS_ICI_NO_TAG, 0);
3253 -+ xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags,
3254 -+ XFS_ICI_NO_TAG, 0, NULL);
3255 - }
3256 -
3257 - /*------------------------------------------------------------------------*/
3258 -diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
3259 -index 6702bd8..1182604 100644
3260 ---- a/fs/xfs/xfs_ag.h
3261 -+++ b/fs/xfs/xfs_ag.h
3262 -@@ -229,6 +229,7 @@ typedef struct xfs_perag
3263 - int pag_ici_init; /* incore inode cache initialised */
3264 - rwlock_t pag_ici_lock; /* incore inode lock */
3265 - struct radix_tree_root pag_ici_root; /* incore inode cache root */
3266 -+ int pag_ici_reclaimable; /* reclaimable inodes */
3267 - #endif
3268 - } xfs_perag_t;
3269 -
3270 -diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
3271 -index 1df7e45..c95f81a 100644
3272 ---- a/fs/xfs/xfs_mount.h
3273 -+++ b/fs/xfs/xfs_mount.h
3274 -@@ -257,6 +257,7 @@ typedef struct xfs_mount {
3275 - wait_queue_head_t m_wait_single_sync_task;
3276 - __int64_t m_update_flags; /* sb flags we need to update
3277 - on the next remount,rw */
3278 -+ struct list_head m_mplist; /* inode shrinker mount list */
3279 - } xfs_mount_t;
3280 -
3281 - /*
3282 -diff --git a/include/linux/ata.h b/include/linux/ata.h
3283 -index 20f3156..f8bd0f9 100644
3284 ---- a/include/linux/ata.h
3285 -+++ b/include/linux/ata.h
3286 -@@ -1024,8 +1024,8 @@ static inline int ata_ok(u8 status)
3287 -
3288 - static inline int lba_28_ok(u64 block, u32 n_block)
3289 - {
3290 -- /* check the ending block number */
3291 -- return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256);
3292 -+ /* check the ending block number: must be LESS THAN 0x0fffffff */
3293 -+ return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256);
3294 - }
3295 -
3296 - static inline int lba_48_ok(u64 block, u32 n_block)
3297 -diff --git a/include/linux/poison.h b/include/linux/poison.h
3298 -index 2110a81..34066ff 100644
3299 ---- a/include/linux/poison.h
3300 -+++ b/include/linux/poison.h
3301 -@@ -48,6 +48,15 @@
3302 - #define POISON_FREE 0x6b /* for use-after-free poisoning */
3303 - #define POISON_END 0xa5 /* end-byte of poisoning */
3304 -
3305 -+/********** mm/hugetlb.c **********/
3306 -+/*
3307 -+ * Private mappings of hugetlb pages use this poisoned value for
3308 -+ * page->mapping. The core VM should not be doing anything with this mapping
3309 -+ * but futex requires the existence of some page->mapping value even though it
3310 -+ * is unused if PAGE_MAPPING_ANON is set.
3311 -+ */
3312 -+#define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON))
3313 -+
3314 - /********** arch/$ARCH/mm/init.c **********/
3315 - #define POISON_FREE_INITMEM 0xcc
3316 -
3317 -diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
3318 -index 8be5135..2c55a7e 100644
3319 ---- a/include/net/sctp/command.h
3320 -+++ b/include/net/sctp/command.h
3321 -@@ -107,6 +107,7 @@ typedef enum {
3322 - SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
3323 - SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
3324 - SCTP_CMD_SEND_MSG, /* Send the whole use message */
3325 -+ SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
3326 - SCTP_CMD_LAST
3327 - } sctp_verb_t;
3328 -
3329 -diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
3330 -index 78740ec..fa6cde5 100644
3331 ---- a/include/net/sctp/sctp.h
3332 -+++ b/include/net/sctp/sctp.h
3333 -@@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
3334 - int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
3335 - int sctp_inet_listen(struct socket *sock, int backlog);
3336 - void sctp_write_space(struct sock *sk);
3337 -+void sctp_data_ready(struct sock *sk, int len);
3338 - unsigned int sctp_poll(struct file *file, struct socket *sock,
3339 - poll_table *wait);
3340 - void sctp_sock_rfree(struct sk_buff *skb);
3341 -diff --git a/init/initramfs.c b/init/initramfs.c
3342 -index b37d34b..b27d045 100644
3343 ---- a/init/initramfs.c
3344 -+++ b/init/initramfs.c
3345 -@@ -457,7 +457,8 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
3346 - compress_name);
3347 - message = msg_buf;
3348 - }
3349 -- }
3350 -+ } else
3351 -+ error("junk in compressed archive");
3352 - if (state != Reset)
3353 - error("junk in compressed archive");
3354 - this_header = saved_offset + my_inptr;
3355 -diff --git a/kernel/cred.c b/kernel/cred.c
3356 -index 1ed8ca1..099f5e6 100644
3357 ---- a/kernel/cred.c
3358 -+++ b/kernel/cred.c
3359 -@@ -786,8 +786,6 @@ bool creds_are_invalid(const struct cred *cred)
3360 - {
3361 - if (cred->magic != CRED_MAGIC)
3362 - return true;
3363 -- if (atomic_read(&cred->usage) < atomic_read(&cred->subscribers))
3364 -- return true;
3365 - #ifdef CONFIG_SECURITY_SELINUX
3366 - if (selinux_is_enabled()) {
3367 - if ((unsigned long) cred->security < PAGE_SIZE)
3368 -diff --git a/kernel/perf_event.c b/kernel/perf_event.c
3369 -index 32d0ae2..e928e1a 100644
3370 ---- a/kernel/perf_event.c
3371 -+++ b/kernel/perf_event.c
3372 -@@ -4811,7 +4811,7 @@ err_fput_free_put_context:
3373 -
3374 - err_free_put_context:
3375 - if (err < 0)
3376 -- kfree(event);
3377 -+ free_event(event);
3378 -
3379 - err_put_context:
3380 - if (err < 0)
3381 -diff --git a/lib/flex_array.c b/lib/flex_array.c
3382 -index 66eef2e..41b1804 100644
3383 ---- a/lib/flex_array.c
3384 -+++ b/lib/flex_array.c
3385 -@@ -99,7 +99,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total,
3386 - ret->element_size = element_size;
3387 - ret->total_nr_elements = total;
3388 - if (elements_fit_in_base(ret) && !(flags & __GFP_ZERO))
3389 -- memset(ret->parts[0], FLEX_ARRAY_FREE,
3390 -+ memset(&ret->parts[0], FLEX_ARRAY_FREE,
3391 - FLEX_ARRAY_BASE_BYTES_LEFT);
3392 - return ret;
3393 - }
3394 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
3395 -index 2d16fa6..fd9ba95 100644
3396 ---- a/mm/hugetlb.c
3397 -+++ b/mm/hugetlb.c
3398 -@@ -546,6 +546,7 @@ static void free_huge_page(struct page *page)
3399 -
3400 - mapping = (struct address_space *) page_private(page);
3401 - set_page_private(page, 0);
3402 -+ page->mapping = NULL;
3403 - BUG_ON(page_count(page));
3404 - INIT_LIST_HEAD(&page->lru);
3405 -
3406 -@@ -2447,8 +2448,10 @@ retry:
3407 - spin_lock(&inode->i_lock);
3408 - inode->i_blocks += blocks_per_huge_page(h);
3409 - spin_unlock(&inode->i_lock);
3410 -- } else
3411 -+ } else {
3412 - lock_page(page);
3413 -+ page->mapping = HUGETLB_POISON;
3414 -+ }
3415 - }
3416 -
3417 - /*
3418 -diff --git a/mm/memcontrol.c b/mm/memcontrol.c
3419 -index 954032b..dff3379 100644
3420 ---- a/mm/memcontrol.c
3421 -+++ b/mm/memcontrol.c
3422 -@@ -2215,12 +2215,12 @@ int mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
3423 - }
3424 - unlock_page_cgroup(pc);
3425 -
3426 -+ *ptr = mem;
3427 - if (mem) {
3428 -- ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, &mem, false,
3429 -+ ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, ptr, false,
3430 - page);
3431 - css_put(&mem->css);
3432 - }
3433 -- *ptr = mem;
3434 - return ret;
3435 - }
3436 -
3437 -diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
3438 -index bad1c49..72340dd 100644
3439 ---- a/net/ieee802154/af_ieee802154.c
3440 -+++ b/net/ieee802154/af_ieee802154.c
3441 -@@ -147,6 +147,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
3442 - dev_load(sock_net(sk), ifr.ifr_name);
3443 - dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
3444 -
3445 -+ if (!dev)
3446 -+ return -ENODEV;
3447 -+
3448 - if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl)
3449 - ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
3450 -
3451 -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
3452 -index 564a0f8..03c55ac 100644
3453 ---- a/net/ipv4/tcp.c
3454 -+++ b/net/ipv4/tcp.c
3455 -@@ -1368,6 +1368,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
3456 - sk_eat_skb(sk, skb, 0);
3457 - if (!desc->count)
3458 - break;
3459 -+ tp->copied_seq = seq;
3460 - }
3461 - tp->copied_seq = seq;
3462 -
3463 -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
3464 -index 112c611..16190ca 100644
3465 ---- a/net/ipv4/udp.c
3466 -+++ b/net/ipv4/udp.c
3467 -@@ -471,8 +471,8 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
3468 - if (hslot->count < hslot2->count)
3469 - goto begin;
3470 -
3471 -- result = udp4_lib_lookup2(net, INADDR_ANY, sport,
3472 -- daddr, hnum, dif,
3473 -+ result = udp4_lib_lookup2(net, saddr, sport,
3474 -+ INADDR_ANY, hnum, dif,
3475 - hslot2, slot2);
3476 - }
3477 - rcu_read_unlock();
3478 -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
3479 -index 548a06e..d2ef3a3 100644
3480 ---- a/net/ipv6/tcp_ipv6.c
3481 -+++ b/net/ipv6/tcp_ipv6.c
3482 -@@ -1006,7 +1006,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
3483 - skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len);
3484 -
3485 - t1 = (struct tcphdr *) skb_push(buff, tot_len);
3486 -- skb_reset_transport_header(skb);
3487 -+ skb_reset_transport_header(buff);
3488 -
3489 - /* Swap the send and the receive. */
3490 - memset(t1, 0, sizeof(*t1));
3491 -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
3492 -index d9714d2..4f57cd2 100644
3493 ---- a/net/ipv6/udp.c
3494 -+++ b/net/ipv6/udp.c
3495 -@@ -258,8 +258,8 @@ static struct sock *__udp6_lib_lookup(struct net *net,
3496 - if (hslot->count < hslot2->count)
3497 - goto begin;
3498 -
3499 -- result = udp6_lib_lookup2(net, &in6addr_any, sport,
3500 -- daddr, hnum, dif,
3501 -+ result = udp6_lib_lookup2(net, saddr, sport,
3502 -+ &in6addr_any, hnum, dif,
3503 - hslot2, slot2);
3504 - }
3505 - rcu_read_unlock();
3506 -diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
3507 -index 304b0b6..dfdc138 100644
3508 ---- a/net/mac80211/agg-tx.c
3509 -+++ b/net/mac80211/agg-tx.c
3510 -@@ -183,7 +183,6 @@ static void sta_addba_resp_timer_expired(unsigned long data)
3511 - HT_AGG_STATE_REQ_STOP_BA_MSK)) !=
3512 - HT_ADDBA_REQUESTED_MSK) {
3513 - spin_unlock_bh(&sta->lock);
3514 -- *state = HT_AGG_STATE_IDLE;
3515 - #ifdef CONFIG_MAC80211_HT_DEBUG
3516 - printk(KERN_DEBUG "timer expired on tid %d but we are not "
3517 - "(or no longer) expecting addBA response there",
3518 -diff --git a/net/sctp/associola.c b/net/sctp/associola.c
3519 -index df5abbf..99c93ee 100644
3520 ---- a/net/sctp/associola.c
3521 -+++ b/net/sctp/associola.c
3522 -@@ -1194,8 +1194,10 @@ void sctp_assoc_update(struct sctp_association *asoc,
3523 - /* Remove any peer addresses not present in the new association. */
3524 - list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
3525 - trans = list_entry(pos, struct sctp_transport, transports);
3526 -- if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
3527 -- sctp_assoc_del_peer(asoc, &trans->ipaddr);
3528 -+ if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) {
3529 -+ sctp_assoc_rm_peer(asoc, trans);
3530 -+ continue;
3531 -+ }
3532 -
3533 - if (asoc->state >= SCTP_STATE_ESTABLISHED)
3534 - sctp_transport_reset(trans);
3535 -diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
3536 -index 905fda5..7ec09ba 100644
3537 ---- a/net/sctp/endpointola.c
3538 -+++ b/net/sctp/endpointola.c
3539 -@@ -144,6 +144,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
3540 - /* Use SCTP specific send buffer space queues. */
3541 - ep->sndbuf_policy = sctp_sndbuf_policy;
3542 -
3543 -+ sk->sk_data_ready = sctp_data_ready;
3544 - sk->sk_write_space = sctp_write_space;
3545 - sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
3546 -
3547 -diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
3548 -index 9e73291..224db01 100644
3549 ---- a/net/sctp/sm_make_chunk.c
3550 -+++ b/net/sctp/sm_make_chunk.c
3551 -@@ -207,7 +207,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
3552 - sp = sctp_sk(asoc->base.sk);
3553 - num_types = sp->pf->supported_addrs(sp, types);
3554 -
3555 -- chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types);
3556 -+ chunksize = sizeof(init) + addrs_len;
3557 -+ chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types));
3558 - chunksize += sizeof(ecap_param);
3559 -
3560 - if (sctp_prsctp_enable)
3561 -@@ -237,14 +238,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
3562 - /* Add HMACS parameter length if any were defined */
3563 - auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
3564 - if (auth_hmacs->length)
3565 -- chunksize += ntohs(auth_hmacs->length);
3566 -+ chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
3567 - else
3568 - auth_hmacs = NULL;
3569 -
3570 - /* Add CHUNKS parameter length */
3571 - auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
3572 - if (auth_chunks->length)
3573 -- chunksize += ntohs(auth_chunks->length);
3574 -+ chunksize += WORD_ROUND(ntohs(auth_chunks->length));
3575 - else
3576 - auth_chunks = NULL;
3577 -
3578 -@@ -254,7 +255,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
3579 -
3580 - /* If we have any extensions to report, account for that */
3581 - if (num_ext)
3582 -- chunksize += sizeof(sctp_supported_ext_param_t) + num_ext;
3583 -+ chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
3584 -+ num_ext);
3585 -
3586 - /* RFC 2960 3.3.2 Initiation (INIT) (1)
3587 - *
3588 -@@ -396,13 +398,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
3589 -
3590 - auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
3591 - if (auth_hmacs->length)
3592 -- chunksize += ntohs(auth_hmacs->length);
3593 -+ chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
3594 - else
3595 - auth_hmacs = NULL;
3596 -
3597 - auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
3598 - if (auth_chunks->length)
3599 -- chunksize += ntohs(auth_chunks->length);
3600 -+ chunksize += WORD_ROUND(ntohs(auth_chunks->length));
3601 - else
3602 - auth_chunks = NULL;
3603 -
3604 -@@ -411,7 +413,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
3605 - }
3606 -
3607 - if (num_ext)
3608 -- chunksize += sizeof(sctp_supported_ext_param_t) + num_ext;
3609 -+ chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
3610 -+ num_ext);
3611 -
3612 - /* Now allocate and fill out the chunk. */
3613 - retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize);
3614 -@@ -3314,21 +3317,6 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
3615 - sctp_chunk_free(asconf);
3616 - asoc->addip_last_asconf = NULL;
3617 -
3618 -- /* Send the next asconf chunk from the addip chunk queue. */
3619 -- if (!list_empty(&asoc->addip_chunk_list)) {
3620 -- struct list_head *entry = asoc->addip_chunk_list.next;
3621 -- asconf = list_entry(entry, struct sctp_chunk, list);
3622 --
3623 -- list_del_init(entry);
3624 --
3625 -- /* Hold the chunk until an ASCONF_ACK is received. */
3626 -- sctp_chunk_hold(asconf);
3627 -- if (sctp_primitive_ASCONF(asoc, asconf))
3628 -- sctp_chunk_free(asconf);
3629 -- else
3630 -- asoc->addip_last_asconf = asconf;
3631 -- }
3632 --
3633 - return retval;
3634 - }
3635 -
3636 -diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
3637 -index 4e4ca65..42bbb24 100644
3638 ---- a/net/sctp/sm_sideeffect.c
3639 -+++ b/net/sctp/sm_sideeffect.c
3640 -@@ -961,6 +961,29 @@ static int sctp_cmd_send_msg(struct sctp_association *asoc,
3641 - }
3642 -
3643 -
3644 -+/* Sent the next ASCONF packet currently stored in the association.
3645 -+ * This happens after the ASCONF_ACK was succeffully processed.
3646 -+ */
3647 -+static void sctp_cmd_send_asconf(struct sctp_association *asoc)
3648 -+{
3649 -+ /* Send the next asconf chunk from the addip chunk
3650 -+ * queue.
3651 -+ */
3652 -+ if (!list_empty(&asoc->addip_chunk_list)) {
3653 -+ struct list_head *entry = asoc->addip_chunk_list.next;
3654 -+ struct sctp_chunk *asconf = list_entry(entry,
3655 -+ struct sctp_chunk, list);
3656 -+ list_del_init(entry);
3657 -+
3658 -+ /* Hold the chunk until an ASCONF_ACK is received. */
3659 -+ sctp_chunk_hold(asconf);
3660 -+ if (sctp_primitive_ASCONF(asoc, asconf))
3661 -+ sctp_chunk_free(asconf);
3662 -+ else
3663 -+ asoc->addip_last_asconf = asconf;
3664 -+ }
3665 -+}
3666 -+
3667 -
3668 - /* These three macros allow us to pull the debugging code out of the
3669 - * main flow of sctp_do_sm() to keep attention focused on the real
3670 -@@ -1616,6 +1639,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
3671 - }
3672 - error = sctp_cmd_send_msg(asoc, cmd->obj.msg);
3673 - break;
3674 -+ case SCTP_CMD_SEND_NEXT_ASCONF:
3675 -+ sctp_cmd_send_asconf(asoc);
3676 -+ break;
3677 - default:
3678 - printk(KERN_WARNING "Impossible command: %u, %p\n",
3679 - cmd->verb, cmd->obj.ptr);
3680 -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
3681 -index 47bc20d..c3f75e7 100644
3682 ---- a/net/sctp/sm_statefuns.c
3683 -+++ b/net/sctp/sm_statefuns.c
3684 -@@ -3675,8 +3675,14 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
3685 - SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
3686 -
3687 - if (!sctp_process_asconf_ack((struct sctp_association *)asoc,
3688 -- asconf_ack))
3689 -+ asconf_ack)) {
3690 -+ /* Successfully processed ASCONF_ACK. We can
3691 -+ * release the next asconf if we have one.
3692 -+ */
3693 -+ sctp_add_cmd_sf(commands, SCTP_CMD_SEND_NEXT_ASCONF,
3694 -+ SCTP_NULL());
3695 - return SCTP_DISPOSITION_CONSUME;
3696 -+ }
3697 -
3698 - abort = sctp_make_abort(asoc, asconf_ack,
3699 - sizeof(sctp_errhdr_t));
3700 -diff --git a/net/sctp/socket.c b/net/sctp/socket.c
3701 -index 9bd9d82..aa3ba60 100644
3702 ---- a/net/sctp/socket.c
3703 -+++ b/net/sctp/socket.c
3704 -@@ -3718,12 +3718,12 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
3705 - sp->hmac = NULL;
3706 -
3707 - SCTP_DBG_OBJCNT_INC(sock);
3708 -- percpu_counter_inc(&sctp_sockets_allocated);
3709 -
3710 - /* Set socket backlog limit. */
3711 - sk->sk_backlog.limit = sysctl_sctp_rmem[1];
3712 -
3713 - local_bh_disable();
3714 -+ percpu_counter_inc(&sctp_sockets_allocated);
3715 - sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
3716 - local_bh_enable();
3717 -
3718 -@@ -3740,8 +3740,8 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk)
3719 - /* Release our hold on the endpoint. */
3720 - ep = sctp_sk(sk)->ep;
3721 - sctp_endpoint_free(ep);
3722 -- percpu_counter_dec(&sctp_sockets_allocated);
3723 - local_bh_disable();
3724 -+ percpu_counter_dec(&sctp_sockets_allocated);
3725 - sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
3726 - local_bh_enable();
3727 - }
3728 -@@ -6188,6 +6188,16 @@ do_nonblock:
3729 - goto out;
3730 - }
3731 -
3732 -+void sctp_data_ready(struct sock *sk, int len)
3733 -+{
3734 -+ read_lock_bh(&sk->sk_callback_lock);
3735 -+ if (sk_has_sleeper(sk))
3736 -+ wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN |
3737 -+ POLLRDNORM | POLLRDBAND);
3738 -+ sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
3739 -+ read_unlock_bh(&sk->sk_callback_lock);
3740 -+}
3741 -+
3742 - /* If socket sndbuf has changed, wake up all per association waiters. */
3743 - void sctp_write_space(struct sock *sk)
3744 - {
3745 -diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
3746 -index 327011f..7809137 100644
3747 ---- a/net/tipc/bearer.c
3748 -+++ b/net/tipc/bearer.c
3749 -@@ -45,10 +45,10 @@
3750 -
3751 - #define MAX_ADDR_STR 32
3752 -
3753 --static struct media *media_list = NULL;
3754 -+static struct media media_list[MAX_MEDIA];
3755 - static u32 media_count = 0;
3756 -
3757 --struct bearer *tipc_bearers = NULL;
3758 -+struct bearer tipc_bearers[MAX_BEARERS];
3759 -
3760 - /**
3761 - * media_name_valid - validate media name
3762 -@@ -108,9 +108,11 @@ int tipc_register_media(u32 media_type,
3763 - int res = -EINVAL;
3764 -
3765 - write_lock_bh(&tipc_net_lock);
3766 -- if (!media_list)
3767 -- goto exit;
3768 -
3769 -+ if (tipc_mode != TIPC_NET_MODE) {
3770 -+ warn("Media <%s> rejected, not in networked mode yet\n", name);
3771 -+ goto exit;
3772 -+ }
3773 - if (!media_name_valid(name)) {
3774 - warn("Media <%s> rejected, illegal name\n", name);
3775 - goto exit;
3776 -@@ -660,33 +662,10 @@ int tipc_disable_bearer(const char *name)
3777 -
3778 -
3779 -
3780 --int tipc_bearer_init(void)
3781 --{
3782 -- int res;
3783 --
3784 -- write_lock_bh(&tipc_net_lock);
3785 -- tipc_bearers = kcalloc(MAX_BEARERS, sizeof(struct bearer), GFP_ATOMIC);
3786 -- media_list = kcalloc(MAX_MEDIA, sizeof(struct media), GFP_ATOMIC);
3787 -- if (tipc_bearers && media_list) {
3788 -- res = 0;
3789 -- } else {
3790 -- kfree(tipc_bearers);
3791 -- kfree(media_list);
3792 -- tipc_bearers = NULL;
3793 -- media_list = NULL;
3794 -- res = -ENOMEM;
3795 -- }
3796 -- write_unlock_bh(&tipc_net_lock);
3797 -- return res;
3798 --}
3799 --
3800 - void tipc_bearer_stop(void)
3801 - {
3802 - u32 i;
3803 -
3804 -- if (!tipc_bearers)
3805 -- return;
3806 --
3807 - for (i = 0; i < MAX_BEARERS; i++) {
3808 - if (tipc_bearers[i].active)
3809 - tipc_bearers[i].publ.blocked = 1;
3810 -@@ -695,10 +674,6 @@ void tipc_bearer_stop(void)
3811 - if (tipc_bearers[i].active)
3812 - bearer_disable(tipc_bearers[i].publ.name);
3813 - }
3814 -- kfree(tipc_bearers);
3815 -- kfree(media_list);
3816 -- tipc_bearers = NULL;
3817 -- media_list = NULL;
3818 - media_count = 0;
3819 - }
3820 -
3821 -diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
3822 -index ca57348..000228e 100644
3823 ---- a/net/tipc/bearer.h
3824 -+++ b/net/tipc/bearer.h
3825 -@@ -114,7 +114,7 @@ struct bearer_name {
3826 -
3827 - struct link;
3828 -
3829 --extern struct bearer *tipc_bearers;
3830 -+extern struct bearer tipc_bearers[];
3831 -
3832 - void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
3833 - struct sk_buff *tipc_media_get_names(void);
3834 -diff --git a/net/tipc/net.c b/net/tipc/net.c
3835 -index 7906608..f25b1cd 100644
3836 ---- a/net/tipc/net.c
3837 -+++ b/net/tipc/net.c
3838 -@@ -116,7 +116,8 @@
3839 - */
3840 -
3841 - DEFINE_RWLOCK(tipc_net_lock);
3842 --struct network tipc_net = { NULL };
3843 -+struct _zone *tipc_zones[256] = { NULL, };
3844 -+struct network tipc_net = { tipc_zones };
3845 -
3846 - struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref)
3847 - {
3848 -@@ -158,28 +159,12 @@ void tipc_net_send_external_routes(u32 dest)
3849 - }
3850 - }
3851 -
3852 --static int net_init(void)
3853 --{
3854 -- memset(&tipc_net, 0, sizeof(tipc_net));
3855 -- tipc_net.zones = kcalloc(tipc_max_zones + 1, sizeof(struct _zone *), GFP_ATOMIC);
3856 -- if (!tipc_net.zones) {
3857 -- return -ENOMEM;
3858 -- }
3859 -- return 0;
3860 --}
3861 --
3862 - static void net_stop(void)
3863 - {
3864 - u32 z_num;
3865 -
3866 -- if (!tipc_net.zones)
3867 -- return;
3868 --
3869 -- for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
3870 -+ for (z_num = 1; z_num <= tipc_max_zones; z_num++)
3871 - tipc_zone_delete(tipc_net.zones[z_num]);
3872 -- }
3873 -- kfree(tipc_net.zones);
3874 -- tipc_net.zones = NULL;
3875 - }
3876 -
3877 - static void net_route_named_msg(struct sk_buff *buf)
3878 -@@ -282,9 +267,7 @@ int tipc_net_start(u32 addr)
3879 - tipc_named_reinit();
3880 - tipc_port_reinit();
3881 -
3882 -- if ((res = tipc_bearer_init()) ||
3883 -- (res = net_init()) ||
3884 -- (res = tipc_cltr_init()) ||
3885 -+ if ((res = tipc_cltr_init()) ||
3886 - (res = tipc_bclink_init())) {
3887 - return res;
3888 - }
3889 -diff --git a/security/inode.c b/security/inode.c
3890 -index c3a7938..1c812e8 100644
3891 ---- a/security/inode.c
3892 -+++ b/security/inode.c
3893 -@@ -161,13 +161,13 @@ static int create_by_name(const char *name, mode_t mode,
3894 -
3895 - mutex_lock(&parent->d_inode->i_mutex);
3896 - *dentry = lookup_one_len(name, parent, strlen(name));
3897 -- if (!IS_ERR(dentry)) {
3898 -+ if (!IS_ERR(*dentry)) {
3899 - if ((mode & S_IFMT) == S_IFDIR)
3900 - error = mkdir(parent->d_inode, *dentry, mode);
3901 - else
3902 - error = create(parent->d_inode, *dentry, mode);
3903 - } else
3904 -- error = PTR_ERR(dentry);
3905 -+ error = PTR_ERR(*dentry);
3906 - mutex_unlock(&parent->d_inode->i_mutex);
3907 -
3908 - return error;
3909 -diff --git a/security/keys/request_key.c b/security/keys/request_key.c
3910 -index 03fe63e..9ac7bfd 100644
3911 ---- a/security/keys/request_key.c
3912 -+++ b/security/keys/request_key.c
3913 -@@ -336,8 +336,10 @@ static int construct_alloc_key(struct key_type *type,
3914 -
3915 - key_already_present:
3916 - mutex_unlock(&key_construction_mutex);
3917 -- if (dest_keyring)
3918 -+ if (dest_keyring) {
3919 -+ __key_link(dest_keyring, key_ref_to_ptr(key_ref));
3920 - up_write(&dest_keyring->sem);
3921 -+ }
3922 - mutex_unlock(&user->cons_lock);
3923 - key_put(key);
3924 - *_key = key = key_ref_to_ptr(key_ref);
3925 -@@ -428,6 +430,11 @@ struct key *request_key_and_link(struct key_type *type,
3926 -
3927 - if (!IS_ERR(key_ref)) {
3928 - key = key_ref_to_ptr(key_ref);
3929 -+ if (dest_keyring) {
3930 -+ construct_get_dest_keyring(&dest_keyring);
3931 -+ key_link(dest_keyring, key);
3932 -+ key_put(dest_keyring);
3933 -+ }
3934 - } else if (PTR_ERR(key_ref) != -EAGAIN) {
3935 - key = ERR_CAST(key_ref);
3936 - } else {
3937 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3938 -index 062a8b0..fd831bd 100644
3939 ---- a/sound/pci/hda/hda_intel.c
3940 -+++ b/sound/pci/hda/hda_intel.c
3941 -@@ -2273,6 +2273,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
3942 - SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
3943 - SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB),
3944 - SND_PCI_QUIRK(0x1565, 0x8218, "Biostar Microtech", POS_FIX_LPIB),
3945 -+ SND_PCI_QUIRK(0x8086, 0x2503, "DG965OT AAD63733-203", POS_FIX_LPIB),
3946 - SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB),
3947 - {}
3948 - };
3949 -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3950 -index 71b7a96..1a97c81 100644
3951 ---- a/sound/pci/hda/patch_conexant.c
3952 -+++ b/sound/pci/hda/patch_conexant.c
3953 -@@ -1174,9 +1174,10 @@ static int patch_cxt5045(struct hda_codec *codec)
3954 -
3955 - switch (codec->subsystem_id >> 16) {
3956 - case 0x103c:
3957 -+ case 0x1631:
3958 - case 0x1734:
3959 -- /* HP & Fujitsu-Siemens laptops have really bad sound over 0dB
3960 -- * on NID 0x17. Fix max PCM level to 0 dB
3961 -+ /* HP, Packard Bell, & Fujitsu-Siemens laptops have really bad
3962 -+ * sound over 0dB on NID 0x17. Fix max PCM level to 0 dB
3963 - * (originally it has 0x2b steps with 0dB offset 0x14)
3964 - */
3965 - snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
3966 -@@ -2471,6 +2472,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3967 - CXT5066_DELL_LAPTOP),
3968 - SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5),
3969 - SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO),
3970 -+ SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
3971 -+ SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
3972 - {}
3973 - };
3974 -
3975 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3976 -index bd8a567..b486daa 100644
3977 ---- a/sound/pci/hda/patch_realtek.c
3978 -+++ b/sound/pci/hda/patch_realtek.c
3979 -@@ -4033,7 +4033,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
3980 - SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3981 - SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3982 - SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3983 -- SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3984 -+ SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
3985 - SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3986 - SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3987 - SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3988 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
3989 -index 799ba25..ac2d528 100644
3990 ---- a/sound/pci/hda/patch_sigmatel.c
3991 -+++ b/sound/pci/hda/patch_sigmatel.c
3992 -@@ -1602,6 +1602,10 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
3993 - "Dell Studio 1555", STAC_DELL_M6_DMIC),
3994 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
3995 - "Dell Studio 1557", STAC_DELL_M6_DMIC),
3996 -+ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
3997 -+ "Dell Studio XPS 1645", STAC_DELL_M6_BOTH),
3998 -+ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
3999 -+ "Dell Studio 1558", STAC_DELL_M6_BOTH),
4000 - {} /* terminator */
4001 - };
4002 -
4003 -@@ -1725,6 +1729,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
4004 - "HP HDX", STAC_HP_HDX), /* HDX16 */
4005 - SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
4006 - "HP dv6", STAC_HP_DV5),
4007 -+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
4008 -+ "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
4009 - SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
4010 - "HP", STAC_HP_DV5),
4011 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
4012 -diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
4013 -index 75283fb..c2311f8 100644
4014 ---- a/sound/pci/maestro3.c
4015 -+++ b/sound/pci/maestro3.c
4016 -@@ -849,6 +849,7 @@ struct snd_m3 {
4017 - struct snd_kcontrol *master_switch;
4018 - struct snd_kcontrol *master_volume;
4019 - struct tasklet_struct hwvol_tq;
4020 -+ unsigned int in_suspend;
4021 -
4022 - #ifdef CONFIG_PM
4023 - u16 *suspend_mem;
4024 -@@ -884,6 +885,7 @@ static struct pci_device_id snd_m3_ids[] = {
4025 - MODULE_DEVICE_TABLE(pci, snd_m3_ids);
4026 -
4027 - static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = {
4028 -+ SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c),
4029 - SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d),
4030 - SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d),
4031 - SND_PCI_QUIRK(0x1033, 0x80f1, "NEC LM800J/7", 0x03),
4032 -@@ -1613,6 +1615,11 @@ static void snd_m3_update_hw_volume(unsigned long private_data)
4033 - outb(0x88, chip->iobase + SHADOW_MIX_REG_MASTER);
4034 - outb(0x88, chip->iobase + HW_VOL_COUNTER_MASTER);
4035 -
4036 -+ /* Ignore spurious HV interrupts during suspend / resume, this avoids
4037 -+ mistaking them for a mute button press. */
4038 -+ if (chip->in_suspend)
4039 -+ return;
4040 -+
4041 - if (!chip->master_switch || !chip->master_volume)
4042 - return;
4043 -
4044 -@@ -2424,6 +2431,7 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state)
4045 - if (chip->suspend_mem == NULL)
4046 - return 0;
4047 -
4048 -+ chip->in_suspend = 1;
4049 - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
4050 - snd_pcm_suspend_all(chip->pcm);
4051 - snd_ac97_suspend(chip->ac97);
4052 -@@ -2497,6 +2505,7 @@ static int m3_resume(struct pci_dev *pci)
4053 - snd_m3_hv_init(chip);
4054 -
4055 - snd_power_change_state(card, SNDRV_CTL_POWER_D0);
4056 -+ chip->in_suspend = 0;
4057 - return 0;
4058 - }
4059 - #endif /* CONFIG_PM */
4060
4061 Added: genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.4.patch
4062 ===================================================================
4063 --- genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.4.patch (rev 0)
4064 +++ genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.4.patch 2010-07-05 23:09:19 UTC (rev 1721)
4065 @@ -0,0 +1,4010 @@
4066 +diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h
4067 +index 811743c..5f2ba8d 100644
4068 +--- a/arch/arm/mach-pxa/include/mach/colibri.h
4069 ++++ b/arch/arm/mach-pxa/include/mach/colibri.h
4070 +@@ -2,6 +2,7 @@
4071 + #define _COLIBRI_H_
4072 +
4073 + #include <net/ax88796.h>
4074 ++#include <mach/mfp.h>
4075 +
4076 + /*
4077 + * common settings for all modules
4078 +diff --git a/arch/mips/include/asm/mach-sibyte/war.h b/arch/mips/include/asm/mach-sibyte/war.h
4079 +index 7950ef4..743385d 100644
4080 +--- a/arch/mips/include/asm/mach-sibyte/war.h
4081 ++++ b/arch/mips/include/asm/mach-sibyte/war.h
4082 +@@ -16,7 +16,11 @@
4083 + #if defined(CONFIG_SB1_PASS_1_WORKAROUNDS) || \
4084 + defined(CONFIG_SB1_PASS_2_WORKAROUNDS)
4085 +
4086 +-#define BCM1250_M3_WAR 1
4087 ++#ifndef __ASSEMBLY__
4088 ++extern int sb1250_m3_workaround_needed(void);
4089 ++#endif
4090 ++
4091 ++#define BCM1250_M3_WAR sb1250_m3_workaround_needed()
4092 + #define SIBYTE_1956_WAR 1
4093 +
4094 + #else
4095 +diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
4096 +index 0444da1..92da315 100644
4097 +--- a/arch/mips/sibyte/sb1250/setup.c
4098 ++++ b/arch/mips/sibyte/sb1250/setup.c
4099 +@@ -87,6 +87,21 @@ static int __init setup_bcm1250(void)
4100 + return ret;
4101 + }
4102 +
4103 ++int sb1250_m3_workaround_needed(void)
4104 ++{
4105 ++ switch (soc_type) {
4106 ++ case K_SYS_SOC_TYPE_BCM1250:
4107 ++ case K_SYS_SOC_TYPE_BCM1250_ALT:
4108 ++ case K_SYS_SOC_TYPE_BCM1250_ALT2:
4109 ++ case K_SYS_SOC_TYPE_BCM1125:
4110 ++ case K_SYS_SOC_TYPE_BCM1125H:
4111 ++ return soc_pass < K_SYS_REVISION_BCM1250_C0;
4112 ++
4113 ++ default:
4114 ++ return 0;
4115 ++ }
4116 ++}
4117 ++
4118 + static int __init setup_bcm112x(void)
4119 + {
4120 + int ret = 0;
4121 +diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
4122 +index 9258074..567cd57 100644
4123 +--- a/arch/powerpc/kernel/head_64.S
4124 ++++ b/arch/powerpc/kernel/head_64.S
4125 +@@ -615,6 +615,17 @@ _GLOBAL(start_secondary_prolog)
4126 + std r3,0(r1) /* Zero the stack frame pointer */
4127 + bl .start_secondary
4128 + b .
4129 ++/*
4130 ++ * Reset stack pointer and call start_secondary
4131 ++ * to continue with online operation when woken up
4132 ++ * from cede in cpu offline.
4133 ++ */
4134 ++_GLOBAL(start_secondary_resume)
4135 ++ ld r1,PACAKSAVE(r13) /* Reload kernel stack pointer */
4136 ++ li r3,0
4137 ++ std r3,0(r1) /* Zero the stack frame pointer */
4138 ++ bl .start_secondary
4139 ++ b .
4140 + #endif
4141 +
4142 + /*
4143 +diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
4144 +index c539472..1ce9dd5 100644
4145 +--- a/arch/powerpc/mm/fsl_booke_mmu.c
4146 ++++ b/arch/powerpc/mm/fsl_booke_mmu.c
4147 +@@ -155,15 +155,10 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
4148 + if (cur_cpu_spec->cpu_features & MMU_FTR_BIG_PHYS)
4149 + TLBCAM[index].MAS7 = (u64)phys >> 32;
4150 +
4151 +-#ifndef CONFIG_KGDB /* want user access for breakpoints */
4152 + if (flags & _PAGE_USER) {
4153 + TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
4154 + TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
4155 + }
4156 +-#else
4157 +- TLBCAM[index].MAS3 |= MAS3_UX | MAS3_UR;
4158 +- TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_UW : 0);
4159 +-#endif
4160 +
4161 + tlbcam_addrs[index].start = virt;
4162 + tlbcam_addrs[index].limit = virt + size - 1;
4163 +diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
4164 +index 6ea4698..b842378 100644
4165 +--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
4166 ++++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
4167 +@@ -122,44 +122,32 @@ static void pseries_mach_cpu_die(void)
4168 + if (!get_lppaca()->shared_proc)
4169 + get_lppaca()->donate_dedicated_cpu = 1;
4170 +
4171 +- printk(KERN_INFO
4172 +- "cpu %u (hwid %u) ceding for offline with hint %d\n",
4173 +- cpu, hwcpu, cede_latency_hint);
4174 + while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
4175 + extended_cede_processor(cede_latency_hint);
4176 +- printk(KERN_INFO "cpu %u (hwid %u) returned from cede.\n",
4177 +- cpu, hwcpu);
4178 +- printk(KERN_INFO
4179 +- "Decrementer value = %x Timebase value = %llx\n",
4180 +- get_dec(), get_tb());
4181 + }
4182 +
4183 +- printk(KERN_INFO "cpu %u (hwid %u) got prodded to go online\n",
4184 +- cpu, hwcpu);
4185 +-
4186 + if (!get_lppaca()->shared_proc)
4187 + get_lppaca()->donate_dedicated_cpu = 0;
4188 + get_lppaca()->idle = 0;
4189 +- }
4190 +
4191 +- if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
4192 +- unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
4193 ++ if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
4194 ++ unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
4195 +
4196 +- /*
4197 +- * NOTE: Calling start_secondary() here for now to
4198 +- * start new context.
4199 +- * However, need to do it cleanly by resetting the
4200 +- * stack pointer.
4201 +- */
4202 +- start_secondary();
4203 ++ /*
4204 ++ * Call to start_secondary_resume() will not return.
4205 ++ * Kernel stack will be reset and start_secondary()
4206 ++ * will be called to continue the online operation.
4207 ++ */
4208 ++ start_secondary_resume();
4209 ++ }
4210 ++ }
4211 +
4212 +- } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
4213 ++ /* Requested state is CPU_STATE_OFFLINE at this point */
4214 ++ WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
4215 +
4216 +- set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
4217 +- unregister_slb_shadow(hard_smp_processor_id(),
4218 +- __pa(get_slb_shadow()));
4219 +- rtas_stop_self();
4220 +- }
4221 ++ set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
4222 ++ unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
4223 ++ rtas_stop_self();
4224 +
4225 + /* Should never get here... */
4226 + BUG();
4227 +diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h
4228 +index 202d869..75a6f48 100644
4229 +--- a/arch/powerpc/platforms/pseries/offline_states.h
4230 ++++ b/arch/powerpc/platforms/pseries/offline_states.h
4231 +@@ -35,4 +35,5 @@ static inline void set_default_offline_state(int cpu)
4232 +
4233 + extern enum cpu_state_vals get_preferred_offline_state(int cpu);
4234 + extern int start_secondary(void);
4235 ++extern void start_secondary_resume(void);
4236 + #endif
4237 +diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
4238 +index 8b49bf9..bfa1ea4 100644
4239 +--- a/arch/sparc/include/asm/irqflags_64.h
4240 ++++ b/arch/sparc/include/asm/irqflags_64.h
4241 +@@ -76,9 +76,26 @@ static inline int raw_irqs_disabled(void)
4242 + */
4243 + static inline unsigned long __raw_local_irq_save(void)
4244 + {
4245 +- unsigned long flags = __raw_local_save_flags();
4246 +-
4247 +- raw_local_irq_disable();
4248 ++ unsigned long flags, tmp;
4249 ++
4250 ++ /* Disable interrupts to PIL_NORMAL_MAX unless we already
4251 ++ * are using PIL_NMI, in which case PIL_NMI is retained.
4252 ++ *
4253 ++ * The only values we ever program into the %pil are 0,
4254 ++ * PIL_NORMAL_MAX and PIL_NMI.
4255 ++ *
4256 ++ * Since PIL_NMI is the largest %pil value and all bits are
4257 ++ * set in it (0xf), it doesn't matter what PIL_NORMAL_MAX
4258 ++ * actually is.
4259 ++ */
4260 ++ __asm__ __volatile__(
4261 ++ "rdpr %%pil, %0\n\t"
4262 ++ "or %0, %2, %1\n\t"
4263 ++ "wrpr %1, 0x0, %%pil"
4264 ++ : "=r" (flags), "=r" (tmp)
4265 ++ : "i" (PIL_NORMAL_MAX)
4266 ++ : "memory"
4267 ++ );
4268 +
4269 + return flags;
4270 + }
4271 +diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
4272 +index 39be9f2..3df02de 100644
4273 +--- a/arch/sparc/include/asm/thread_info_64.h
4274 ++++ b/arch/sparc/include/asm/thread_info_64.h
4275 +@@ -121,7 +121,7 @@ struct thread_info {
4276 + #define THREAD_SHIFT PAGE_SHIFT
4277 + #endif /* PAGE_SHIFT == 13 */
4278 +
4279 +-#define PREEMPT_ACTIVE 0x4000000
4280 ++#define PREEMPT_ACTIVE 0x10000000
4281 +
4282 + /*
4283 + * macros/functions for gaining access to the thread information structure
4284 +diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
4285 +index b775658..8a00058 100644
4286 +--- a/arch/sparc/kernel/pci_common.c
4287 ++++ b/arch/sparc/kernel/pci_common.c
4288 +@@ -371,14 +371,19 @@ static void pci_register_iommu_region(struct pci_pbm_info *pbm)
4289 + struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
4290 +
4291 + if (!rp) {
4292 +- prom_printf("Cannot allocate IOMMU resource.\n");
4293 +- prom_halt();
4294 ++ pr_info("%s: Cannot allocate IOMMU resource.\n",
4295 ++ pbm->name);
4296 ++ return;
4297 + }
4298 + rp->name = "IOMMU";
4299 + rp->start = pbm->mem_space.start + (unsigned long) vdma[0];
4300 + rp->end = rp->start + (unsigned long) vdma[1] - 1UL;
4301 + rp->flags = IORESOURCE_BUSY;
4302 +- request_resource(&pbm->mem_space, rp);
4303 ++ if (request_resource(&pbm->mem_space, rp)) {
4304 ++ pr_info("%s: Unable to request IOMMU resource.\n",
4305 ++ pbm->name);
4306 ++ kfree(rp);
4307 ++ }
4308 + }
4309 + }
4310 +
4311 +diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
4312 +index fd3cee4..c720f0c 100644
4313 +--- a/arch/sparc/kernel/rtrap_64.S
4314 ++++ b/arch/sparc/kernel/rtrap_64.S
4315 +@@ -172,7 +172,17 @@ rtrap_xcall:
4316 + nop
4317 + call trace_hardirqs_on
4318 + nop
4319 +- wrpr %l4, %pil
4320 ++ /* Do not actually set the %pil here. We will do that
4321 ++ * below after we clear PSTATE_IE in the %pstate register.
4322 ++ * If we re-enable interrupts here, we can recurse down
4323 ++ * the hardirq stack potentially endlessly, causing a
4324 ++ * stack overflow.
4325 ++ *
4326 ++ * It is tempting to put this test and trace_hardirqs_on
4327 ++ * call at the 'rt_continue' label, but that will not work
4328 ++ * as that path hits unconditionally and we do not want to
4329 ++ * execute this in NMI return paths, for example.
4330 ++ */
4331 + #endif
4332 + rtrap_no_irq_enable:
4333 + andcc %l1, TSTATE_PRIV, %l3
4334 +diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
4335 +index 10f7bb9..22cd475 100644
4336 +--- a/arch/sparc/kernel/traps_64.c
4337 ++++ b/arch/sparc/kernel/traps_64.c
4338 +@@ -2202,27 +2202,6 @@ void dump_stack(void)
4339 +
4340 + EXPORT_SYMBOL(dump_stack);
4341 +
4342 +-static inline int is_kernel_stack(struct task_struct *task,
4343 +- struct reg_window *rw)
4344 +-{
4345 +- unsigned long rw_addr = (unsigned long) rw;
4346 +- unsigned long thread_base, thread_end;
4347 +-
4348 +- if (rw_addr < PAGE_OFFSET) {
4349 +- if (task != &init_task)
4350 +- return 0;
4351 +- }
4352 +-
4353 +- thread_base = (unsigned long) task_stack_page(task);
4354 +- thread_end = thread_base + sizeof(union thread_union);
4355 +- if (rw_addr >= thread_base &&
4356 +- rw_addr < thread_end &&
4357 +- !(rw_addr & 0x7UL))
4358 +- return 1;
4359 +-
4360 +- return 0;
4361 +-}
4362 +-
4363 + static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
4364 + {
4365 + unsigned long fp = rw->ins[6];
4366 +@@ -2251,6 +2230,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
4367 + show_regs(regs);
4368 + add_taint(TAINT_DIE);
4369 + if (regs->tstate & TSTATE_PRIV) {
4370 ++ struct thread_info *tp = current_thread_info();
4371 + struct reg_window *rw = (struct reg_window *)
4372 + (regs->u_regs[UREG_FP] + STACK_BIAS);
4373 +
4374 +@@ -2258,8 +2238,8 @@ void die_if_kernel(char *str, struct pt_regs *regs)
4375 + * find some badly aligned kernel stack.
4376 + */
4377 + while (rw &&
4378 +- count++ < 30&&
4379 +- is_kernel_stack(current, rw)) {
4380 ++ count++ < 30 &&
4381 ++ kstack_valid(tp, (unsigned long) rw)) {
4382 + printk("Caller[%016lx]: %pS\n", rw->ins[7],
4383 + (void *) rw->ins[7]);
4384 +
4385 +diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
4386 +index 378ca82..95a8e9a 100644
4387 +--- a/arch/sparc/kernel/unaligned_64.c
4388 ++++ b/arch/sparc/kernel/unaligned_64.c
4389 +@@ -49,7 +49,7 @@ static inline enum direction decode_direction(unsigned int insn)
4390 + }
4391 +
4392 + /* 16 = double-word, 8 = extra-word, 4 = word, 2 = half-word */
4393 +-static inline int decode_access_size(unsigned int insn)
4394 ++static inline int decode_access_size(struct pt_regs *regs, unsigned int insn)
4395 + {
4396 + unsigned int tmp;
4397 +
4398 +@@ -65,7 +65,7 @@ static inline int decode_access_size(unsigned int insn)
4399 + return 2;
4400 + else {
4401 + printk("Impossible unaligned trap. insn=%08x\n", insn);
4402 +- die_if_kernel("Byte sized unaligned access?!?!", current_thread_info()->kregs);
4403 ++ die_if_kernel("Byte sized unaligned access?!?!", regs);
4404 +
4405 + /* GCC should never warn that control reaches the end
4406 + * of this function without returning a value because
4407 +@@ -289,7 +289,7 @@ static void log_unaligned(struct pt_regs *regs)
4408 + asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
4409 + {
4410 + enum direction dir = decode_direction(insn);
4411 +- int size = decode_access_size(insn);
4412 ++ int size = decode_access_size(regs, insn);
4413 + int orig_asi, asi;
4414 +
4415 + current_thread_info()->kern_una_regs = regs;
4416 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
4417 +index eb40925..ddb52b8 100644
4418 +--- a/arch/x86/Kconfig
4419 ++++ b/arch/x86/Kconfig
4420 +@@ -627,7 +627,7 @@ config GART_IOMMU
4421 + bool "GART IOMMU support" if EMBEDDED
4422 + default y
4423 + select SWIOTLB
4424 +- depends on X86_64 && PCI
4425 ++ depends on X86_64 && PCI && K8_NB
4426 + ---help---
4427 + Support for full DMA access of devices with 32bit memory access only
4428 + on systems with more than 3GB. This is usually needed for USB,
4429 +@@ -2026,7 +2026,7 @@ endif # X86_32
4430 +
4431 + config K8_NB
4432 + def_bool y
4433 +- depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA)))
4434 ++ depends on CPU_SUP_AMD && PCI
4435 +
4436 + source "drivers/pcmcia/Kconfig"
4437 +
4438 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
4439 +index be37059..b35c160 100644
4440 +--- a/arch/x86/kernel/apic/io_apic.c
4441 ++++ b/arch/x86/kernel/apic/io_apic.c
4442 +@@ -2539,6 +2539,9 @@ void irq_force_complete_move(int irq)
4443 + struct irq_desc *desc = irq_to_desc(irq);
4444 + struct irq_cfg *cfg = desc->chip_data;
4445 +
4446 ++ if (!cfg)
4447 ++ return;
4448 ++
4449 + __irq_complete_move(&desc, cfg->vector);
4450 + }
4451 + #else
4452 +diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
4453 +index 6e44519..3b5ea38 100644
4454 +--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
4455 ++++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
4456 +@@ -929,7 +929,8 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
4457 + powernow_table[i].index = index;
4458 +
4459 + /* Frequency may be rounded for these */
4460 +- if (boot_cpu_data.x86 == 0x10 || boot_cpu_data.x86 == 0x11) {
4461 ++ if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
4462 ++ || boot_cpu_data.x86 == 0x11) {
4463 + powernow_table[i].frequency =
4464 + freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7);
4465 + } else
4466 +diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
4467 +index 7e1cca1..1366c7c 100644
4468 +--- a/arch/x86/kernel/cpu/intel.c
4469 ++++ b/arch/x86/kernel/cpu/intel.c
4470 +@@ -47,6 +47,27 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
4471 + (c->x86 == 0x6 && c->x86_model >= 0x0e))
4472 + set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
4473 +
4474 ++ /*
4475 ++ * Atom erratum AAE44/AAF40/AAG38/AAH41:
4476 ++ *
4477 ++ * A race condition between speculative fetches and invalidating
4478 ++ * a large page. This is worked around in microcode, but we
4479 ++ * need the microcode to have already been loaded... so if it is
4480 ++ * not, recommend a BIOS update and disable large pages.
4481 ++ */
4482 ++ if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_mask <= 2) {
4483 ++ u32 ucode, junk;
4484 ++
4485 ++ wrmsr(MSR_IA32_UCODE_REV, 0, 0);
4486 ++ sync_core();
4487 ++ rdmsr(MSR_IA32_UCODE_REV, junk, ucode);
4488 ++
4489 ++ if (ucode < 0x20e) {
4490 ++ printk(KERN_WARNING "Atom PSE erratum detected, BIOS microcode update recommended\n");
4491 ++ clear_cpu_cap(c, X86_FEATURE_PSE);
4492 ++ }
4493 ++ }
4494 ++
4495 + #ifdef CONFIG_X86_64
4496 + set_cpu_cap(c, X86_FEATURE_SYSENTER32);
4497 + #else
4498 +diff --git a/arch/x86/kernel/k8.c b/arch/x86/kernel/k8.c
4499 +index cbc4332..9b89546 100644
4500 +--- a/arch/x86/kernel/k8.c
4501 ++++ b/arch/x86/kernel/k8.c
4502 +@@ -121,3 +121,17 @@ void k8_flush_garts(void)
4503 + }
4504 + EXPORT_SYMBOL_GPL(k8_flush_garts);
4505 +
4506 ++static __init int init_k8_nbs(void)
4507 ++{
4508 ++ int err = 0;
4509 ++
4510 ++ err = cache_k8_northbridges();
4511 ++
4512 ++ if (err < 0)
4513 ++ printk(KERN_NOTICE "K8 NB: Cannot enumerate AMD northbridges.\n");
4514 ++
4515 ++ return err;
4516 ++}
4517 ++
4518 ++/* This has to go after the PCI subsystem */
4519 ++fs_initcall(init_k8_nbs);
4520 +diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
4521 +index 4f41b29..0ae24d9 100644
4522 +--- a/arch/x86/kernel/pci-gart_64.c
4523 ++++ b/arch/x86/kernel/pci-gart_64.c
4524 +@@ -738,7 +738,7 @@ int __init gart_iommu_init(void)
4525 + unsigned long scratch;
4526 + long i;
4527 +
4528 +- if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0)
4529 ++ if (num_k8_northbridges == 0)
4530 + return 0;
4531 +
4532 + #ifndef CONFIG_AGP_AMD64
4533 +diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
4534 +index 126f0b4..11d0702 100644
4535 +--- a/arch/x86/kernel/process_64.c
4536 ++++ b/arch/x86/kernel/process_64.c
4537 +@@ -282,12 +282,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
4538 +
4539 + set_tsk_thread_flag(p, TIF_FORK);
4540 +
4541 +- p->thread.fs = me->thread.fs;
4542 +- p->thread.gs = me->thread.gs;
4543 + p->thread.io_bitmap_ptr = NULL;
4544 +
4545 + savesegment(gs, p->thread.gsindex);
4546 ++ p->thread.gs = p->thread.gsindex ? 0 : me->thread.gs;
4547 + savesegment(fs, p->thread.fsindex);
4548 ++ p->thread.fs = p->thread.fsindex ? 0 : me->thread.fs;
4549 + savesegment(es, p->thread.es);
4550 + savesegment(ds, p->thread.ds);
4551 +
4552 +diff --git a/block/blk-timeout.c b/block/blk-timeout.c
4553 +index 1ba7e0a..4f0c06c 100644
4554 +--- a/block/blk-timeout.c
4555 ++++ b/block/blk-timeout.c
4556 +@@ -109,6 +109,7 @@ void blk_rq_timed_out_timer(unsigned long data)
4557 + struct request_queue *q = (struct request_queue *) data;
4558 + unsigned long flags, next = 0;
4559 + struct request *rq, *tmp;
4560 ++ int next_set = 0;
4561 +
4562 + spin_lock_irqsave(q->queue_lock, flags);
4563 +
4564 +@@ -122,16 +123,13 @@ void blk_rq_timed_out_timer(unsigned long data)
4565 + if (blk_mark_rq_complete(rq))
4566 + continue;
4567 + blk_rq_timed_out(rq);
4568 +- } else if (!next || time_after(next, rq->deadline))
4569 ++ } else if (!next_set || time_after(next, rq->deadline)) {
4570 + next = rq->deadline;
4571 ++ next_set = 1;
4572 ++ }
4573 + }
4574 +
4575 +- /*
4576 +- * next can never be 0 here with the list non-empty, since we always
4577 +- * bump ->deadline to 1 so we can detect if the timer was ever added
4578 +- * or not. See comment in blk_add_timer()
4579 +- */
4580 +- if (next)
4581 ++ if (next_set)
4582 + mod_timer(&q->timeout, round_jiffies_up(next));
4583 +
4584 + spin_unlock_irqrestore(q->queue_lock, flags);
4585 +diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c
4586 +index 943f2ab..ce038d8 100644
4587 +--- a/crypto/async_tx/async_raid6_recov.c
4588 ++++ b/crypto/async_tx/async_raid6_recov.c
4589 +@@ -324,6 +324,7 @@ struct dma_async_tx_descriptor *
4590 + async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
4591 + struct page **blocks, struct async_submit_ctl *submit)
4592 + {
4593 ++ void *scribble = submit->scribble;
4594 + int non_zero_srcs, i;
4595 +
4596 + BUG_ON(faila == failb);
4597 +@@ -332,11 +333,13 @@ async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
4598 +
4599 + pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes);
4600 +
4601 +- /* we need to preserve the contents of 'blocks' for the async
4602 +- * case, so punt to synchronous if a scribble buffer is not available
4603 ++ /* if a dma resource is not available or a scribble buffer is not
4604 ++ * available punt to the synchronous path. In the 'dma not
4605 ++ * available' case be sure to use the scribble buffer to
4606 ++ * preserve the content of 'blocks' as the caller intended.
4607 + */
4608 +- if (!submit->scribble) {
4609 +- void **ptrs = (void **) blocks;
4610 ++ if (!async_dma_find_channel(DMA_PQ) || !scribble) {
4611 ++ void **ptrs = scribble ? scribble : (void **) blocks;
4612 +
4613 + async_tx_quiesce(&submit->depend_tx);
4614 + for (i = 0; i < disks; i++)
4615 +@@ -406,11 +409,13 @@ async_raid6_datap_recov(int disks, size_t bytes, int faila,
4616 +
4617 + pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes);
4618 +
4619 +- /* we need to preserve the contents of 'blocks' for the async
4620 +- * case, so punt to synchronous if a scribble buffer is not available
4621 ++ /* if a dma resource is not available or a scribble buffer is not
4622 ++ * available punt to the synchronous path. In the 'dma not
4623 ++ * available' case be sure to use the scribble buffer to
4624 ++ * preserve the content of 'blocks' as the caller intended.
4625 + */
4626 +- if (!scribble) {
4627 +- void **ptrs = (void **) blocks;
4628 ++ if (!async_dma_find_channel(DMA_PQ) || !scribble) {
4629 ++ void **ptrs = scribble ? scribble : (void **) blocks;
4630 +
4631 + async_tx_quiesce(&submit->depend_tx);
4632 + for (i = 0; i < disks; i++)
4633 +diff --git a/drivers/Makefile b/drivers/Makefile
4634 +index 6ee53c7..8b0b948 100644
4635 +--- a/drivers/Makefile
4636 ++++ b/drivers/Makefile
4637 +@@ -17,6 +17,7 @@ obj-$(CONFIG_SFI) += sfi/
4638 + obj-$(CONFIG_PNP) += pnp/
4639 + obj-$(CONFIG_ARM_AMBA) += amba/
4640 +
4641 ++obj-$(CONFIG_VIRTIO) += virtio/
4642 + obj-$(CONFIG_XEN) += xen/
4643 +
4644 + # regulators early, since some subsystems rely on them to initialize
4645 +@@ -106,7 +107,6 @@ obj-$(CONFIG_HID) += hid/
4646 + obj-$(CONFIG_PPC_PS3) += ps3/
4647 + obj-$(CONFIG_OF) += of/
4648 + obj-$(CONFIG_SSB) += ssb/
4649 +-obj-$(CONFIG_VIRTIO) += virtio/
4650 + obj-$(CONFIG_VLYNQ) += vlynq/
4651 + obj-$(CONFIG_STAGING) += staging/
4652 + obj-y += platform/
4653 +diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
4654 +index dc4ffad..e02d93c 100644
4655 +--- a/drivers/acpi/power_meter.c
4656 ++++ b/drivers/acpi/power_meter.c
4657 +@@ -34,7 +34,7 @@
4658 + #define ACPI_POWER_METER_NAME "power_meter"
4659 + ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
4660 + #define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
4661 +-#define ACPI_POWER_METER_CLASS "power_meter_resource"
4662 ++#define ACPI_POWER_METER_CLASS "pwr_meter_resource"
4663 +
4664 + #define NUM_SENSORS 17
4665 +
4666 +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
4667 +index 79d33d9..7c85265 100644
4668 +--- a/drivers/acpi/sleep.c
4669 ++++ b/drivers/acpi/sleep.c
4670 +@@ -450,6 +450,126 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
4671 + },
4672 + },
4673 + {
4674 ++ .callback = init_set_sci_en_on_resume,
4675 ++ .ident = "Lenovo ThinkPad T410",
4676 ++ .matches = {
4677 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4678 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
4679 ++ },
4680 ++ },
4681 ++ {
4682 ++ .callback = init_set_sci_en_on_resume,
4683 ++ .ident = "Lenovo ThinkPad T510",
4684 ++ .matches = {
4685 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4686 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
4687 ++ },
4688 ++ },
4689 ++ {
4690 ++ .callback = init_set_sci_en_on_resume,
4691 ++ .ident = "Lenovo ThinkPad W510",
4692 ++ .matches = {
4693 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4694 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
4695 ++ },
4696 ++ },
4697 ++ {
4698 ++ .callback = init_set_sci_en_on_resume,
4699 ++ .ident = "Lenovo ThinkPad X201",
4700 ++ .matches = {
4701 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4702 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
4703 ++ },
4704 ++ },
4705 ++ {
4706 ++ .callback = init_set_sci_en_on_resume,
4707 ++ .ident = "Lenovo ThinkPad X201",
4708 ++ .matches = {
4709 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4710 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
4711 ++ },
4712 ++ },
4713 ++ {
4714 ++ .callback = init_set_sci_en_on_resume,
4715 ++ .ident = "Lenovo ThinkPad T410",
4716 ++ .matches = {
4717 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4718 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
4719 ++ },
4720 ++ },
4721 ++ {
4722 ++ .callback = init_set_sci_en_on_resume,
4723 ++ .ident = "Lenovo ThinkPad T510",
4724 ++ .matches = {
4725 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4726 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
4727 ++ },
4728 ++ },
4729 ++ {
4730 ++ .callback = init_set_sci_en_on_resume,
4731 ++ .ident = "Lenovo ThinkPad W510",
4732 ++ .matches = {
4733 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4734 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
4735 ++ },
4736 ++ },
4737 ++ {
4738 ++ .callback = init_set_sci_en_on_resume,
4739 ++ .ident = "Lenovo ThinkPad X201",
4740 ++ .matches = {
4741 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4742 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
4743 ++ },
4744 ++ },
4745 ++ {
4746 ++ .callback = init_set_sci_en_on_resume,
4747 ++ .ident = "Lenovo ThinkPad X201",
4748 ++ .matches = {
4749 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4750 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
4751 ++ },
4752 ++ },
4753 ++ {
4754 ++ .callback = init_set_sci_en_on_resume,
4755 ++ .ident = "Lenovo ThinkPad T410",
4756 ++ .matches = {
4757 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4758 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
4759 ++ },
4760 ++ },
4761 ++ {
4762 ++ .callback = init_set_sci_en_on_resume,
4763 ++ .ident = "Lenovo ThinkPad T510",
4764 ++ .matches = {
4765 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4766 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
4767 ++ },
4768 ++ },
4769 ++ {
4770 ++ .callback = init_set_sci_en_on_resume,
4771 ++ .ident = "Lenovo ThinkPad W510",
4772 ++ .matches = {
4773 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4774 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
4775 ++ },
4776 ++ },
4777 ++ {
4778 ++ .callback = init_set_sci_en_on_resume,
4779 ++ .ident = "Lenovo ThinkPad X201",
4780 ++ .matches = {
4781 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4782 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
4783 ++ },
4784 ++ },
4785 ++ {
4786 ++ .callback = init_set_sci_en_on_resume,
4787 ++ .ident = "Lenovo ThinkPad X201",
4788 ++ .matches = {
4789 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
4790 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
4791 ++ },
4792 ++ },
4793 ++ {
4794 + .callback = init_old_suspend_ordering,
4795 + .ident = "Panasonic CF51-2L",
4796 + .matches = {
4797 +@@ -458,6 +578,30 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
4798 + DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
4799 + },
4800 + },
4801 ++ {
4802 ++ .callback = init_set_sci_en_on_resume,
4803 ++ .ident = "Dell Studio 1558",
4804 ++ .matches = {
4805 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
4806 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1558"),
4807 ++ },
4808 ++ },
4809 ++ {
4810 ++ .callback = init_set_sci_en_on_resume,
4811 ++ .ident = "Dell Studio 1557",
4812 ++ .matches = {
4813 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
4814 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"),
4815 ++ },
4816 ++ },
4817 ++ {
4818 ++ .callback = init_set_sci_en_on_resume,
4819 ++ .ident = "Dell Studio 1555",
4820 ++ .matches = {
4821 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
4822 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1555"),
4823 ++ },
4824 ++ },
4825 + {},
4826 + };
4827 + #endif /* CONFIG_SUSPEND */
4828 +diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
4829 +index 9f6cfac..228740f 100644
4830 +--- a/drivers/ata/libata-eh.c
4831 ++++ b/drivers/ata/libata-eh.c
4832 +@@ -879,6 +879,8 @@ static void ata_eh_set_pending(struct ata_port *ap, int fastdrain)
4833 + void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
4834 + {
4835 + struct ata_port *ap = qc->ap;
4836 ++ struct request_queue *q = qc->scsicmd->device->request_queue;
4837 ++ unsigned long flags;
4838 +
4839 + WARN_ON(!ap->ops->error_handler);
4840 +
4841 +@@ -890,7 +892,9 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
4842 + * Note that ATA_QCFLAG_FAILED is unconditionally set after
4843 + * this function completes.
4844 + */
4845 ++ spin_lock_irqsave(q->queue_lock, flags);
4846 + blk_abort_request(qc->scsicmd->request);
4847 ++ spin_unlock_irqrestore(q->queue_lock, flags);
4848 + }
4849 +
4850 + /**
4851 +@@ -1624,6 +1628,7 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
4852 + }
4853 +
4854 + /* okay, this error is ours */
4855 ++ memset(&tf, 0, sizeof(tf));
4856 + rc = ata_eh_read_log_10h(dev, &tag, &tf);
4857 + if (rc) {
4858 + ata_link_printk(link, KERN_ERR, "failed to read log page 10h "
4859 +diff --git a/drivers/base/memory.c b/drivers/base/memory.c
4860 +index bd02505..d7d77d4 100644
4861 +--- a/drivers/base/memory.c
4862 ++++ b/drivers/base/memory.c
4863 +@@ -311,7 +311,7 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL);
4864 + static ssize_t
4865 + print_block_size(struct class *class, char *buf)
4866 + {
4867 +- return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
4868 ++ return sprintf(buf, "%lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
4869 + }
4870 +
4871 + static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL);
4872 +diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
4873 +index 2fb3a48..4b66c69 100644
4874 +--- a/drivers/char/agp/Kconfig
4875 ++++ b/drivers/char/agp/Kconfig
4876 +@@ -57,7 +57,7 @@ config AGP_AMD
4877 +
4878 + config AGP_AMD64
4879 + tristate "AMD Opteron/Athlon64 on-CPU GART support"
4880 +- depends on AGP && X86
4881 ++ depends on AGP && X86 && K8_NB
4882 + help
4883 + This option gives you AGP support for the GLX component of
4884 + X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
4885 +diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
4886 +index 73655ae..f8e57c6 100644
4887 +--- a/drivers/cpuidle/governors/menu.c
4888 ++++ b/drivers/cpuidle/governors/menu.c
4889 +@@ -101,7 +101,6 @@ struct menu_device {
4890 +
4891 + unsigned int expected_us;
4892 + u64 predicted_us;
4893 +- unsigned int measured_us;
4894 + unsigned int exit_us;
4895 + unsigned int bucket;
4896 + u64 correction_factor[BUCKETS];
4897 +@@ -187,14 +186,14 @@ static int menu_select(struct cpuidle_device *dev)
4898 + int i;
4899 + int multiplier;
4900 +
4901 +- data->last_state_idx = 0;
4902 +- data->exit_us = 0;
4903 +-
4904 + if (data->needs_update) {
4905 + menu_update(dev);
4906 + data->needs_update = 0;
4907 + }
4908 +
4909 ++ data->last_state_idx = 0;
4910 ++ data->exit_us = 0;
4911 ++
4912 + /* Special case when user has set very strict latency requirement */
4913 + if (unlikely(latency_req == 0))
4914 + return 0;
4915 +@@ -294,7 +293,7 @@ static void menu_update(struct cpuidle_device *dev)
4916 + new_factor = data->correction_factor[data->bucket]
4917 + * (DECAY - 1) / DECAY;
4918 +
4919 +- if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING)
4920 ++ if (data->expected_us > 0 && measured_us < MAX_INTERESTING)
4921 + new_factor += RESOLUTION * measured_us / data->expected_us;
4922 + else
4923 + /*
4924 +diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c
4925 +index f5b6d9f..97e64bc 100644
4926 +--- a/drivers/edac/edac_mce_amd.c
4927 ++++ b/drivers/edac/edac_mce_amd.c
4928 +@@ -294,7 +294,6 @@ wrong_ls_mce:
4929 + void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
4930 + {
4931 + u32 ec = ERROR_CODE(regs->nbsl);
4932 +- u32 xec = EXT_ERROR_CODE(regs->nbsl);
4933 +
4934 + if (!handle_errors)
4935 + return;
4936 +@@ -324,7 +323,7 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
4937 + pr_cont("\n");
4938 + }
4939 +
4940 +- pr_emerg("%s.\n", EXT_ERR_MSG(xec));
4941 ++ pr_emerg("%s.\n", EXT_ERR_MSG(regs->nbsl));
4942 +
4943 + if (BUS_ERROR(ec) && nb_bus_decoder)
4944 + nb_bus_decoder(node_id, regs);
4945 +@@ -374,7 +373,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val,
4946 + ((m->status & MCI_STATUS_PCC) ? "yes" : "no"));
4947 +
4948 + /* do the two bits[14:13] together */
4949 +- ecc = m->status & (3ULL << 45);
4950 ++ ecc = (m->status >> 45) & 0x3;
4951 + if (ecc)
4952 + pr_cont(", %sECC Error", ((ecc == 2) ? "C" : "U"));
4953 +
4954 +diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
4955 +index a894ade..1372796 100644
4956 +--- a/drivers/gpu/drm/i915/i915_debugfs.c
4957 ++++ b/drivers/gpu/drm/i915/i915_debugfs.c
4958 +@@ -162,7 +162,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
4959 + struct drm_device *dev = node->minor->dev;
4960 + drm_i915_private_t *dev_priv = dev->dev_private;
4961 +
4962 +- if (!IS_IRONLAKE(dev)) {
4963 ++ if (!HAS_PCH_SPLIT(dev)) {
4964 + seq_printf(m, "Interrupt enable: %08x\n",
4965 + I915_READ(IER));
4966 + seq_printf(m, "Interrupt identity: %08x\n",
4967 +diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
4968 +index 2307f98..d642efd 100644
4969 +--- a/drivers/gpu/drm/i915/i915_dma.c
4970 ++++ b/drivers/gpu/drm/i915/i915_dma.c
4971 +@@ -978,15 +978,21 @@ static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size,
4972 + * Some of the preallocated space is taken by the GTT
4973 + * and popup. GTT is 1K per MB of aperture size, and popup is 4K.
4974 + */
4975 +- if (IS_G4X(dev) || IS_PINEVIEW(dev) || IS_IRONLAKE(dev))
4976 ++ if (IS_G4X(dev) || IS_PINEVIEW(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev))
4977 + overhead = 4096;
4978 + else
4979 + overhead = (*aperture_size / 1024) + 4096;
4980 +
4981 + switch (tmp & INTEL_GMCH_GMS_MASK) {
4982 + case INTEL_855_GMCH_GMS_DISABLED:
4983 +- DRM_ERROR("video memory is disabled\n");
4984 +- return -1;
4985 ++ /* XXX: This is what my A1 silicon has. */
4986 ++ if (IS_GEN6(dev)) {
4987 ++ stolen = 64 * 1024 * 1024;
4988 ++ } else {
4989 ++ DRM_ERROR("video memory is disabled\n");
4990 ++ return -1;
4991 ++ }
4992 ++ break;
4993 + case INTEL_855_GMCH_GMS_STOLEN_1M:
4994 + stolen = 1 * 1024 * 1024;
4995 + break;
4996 +@@ -1064,7 +1070,7 @@ static unsigned long i915_gtt_to_phys(struct drm_device *dev,
4997 + int gtt_offset, gtt_size;
4998 +
4999 + if (IS_I965G(dev)) {
5000 +- if (IS_G4X(dev) || IS_IRONLAKE(dev)) {
5001 ++ if (IS_G4X(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev)) {
5002 + gtt_offset = 2*1024*1024;
5003 + gtt_size = 2*1024*1024;
5004 + } else {
5005 +@@ -1445,7 +1451,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
5006 +
5007 + dev->driver->get_vblank_counter = i915_get_vblank_counter;
5008 + dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
5009 +- if (IS_G4X(dev) || IS_IRONLAKE(dev)) {
5010 ++ if (IS_G4X(dev) || IS_IRONLAKE(dev) || IS_GEN6(dev)) {
5011 + dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
5012 + dev->driver->get_vblank_counter = gm45_get_vblank_counter;
5013 + }
5014 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
5015 +index b99b6a8..16ce3ba 100644
5016 +--- a/drivers/gpu/drm/i915/i915_drv.h
5017 ++++ b/drivers/gpu/drm/i915/i915_drv.h
5018 +@@ -1026,7 +1026,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
5019 + #define IS_845G(dev) ((dev)->pci_device == 0x2562)
5020 + #define IS_I85X(dev) ((dev)->pci_device == 0x3582)
5021 + #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
5022 +-#define IS_I8XX(dev) (INTEL_INFO(dev)->is_i8xx)
5023 ++#define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx)
5024 + #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
5025 + #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
5026 + #define IS_I945G(dev) ((dev)->pci_device == 0x2772)
5027 +@@ -1045,8 +1045,29 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
5028 + #define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx)
5029 + #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
5030 +
5031 ++#define IS_GEN3(dev) (IS_I915G(dev) || \
5032 ++ IS_I915GM(dev) || \
5033 ++ IS_I945G(dev) || \
5034 ++ IS_I945GM(dev) || \
5035 ++ IS_G33(dev) || \
5036 ++ IS_PINEVIEW(dev))
5037 ++#define IS_GEN4(dev) ((dev)->pci_device == 0x2972 || \
5038 ++ (dev)->pci_device == 0x2982 || \
5039 ++ (dev)->pci_device == 0x2992 || \
5040 ++ (dev)->pci_device == 0x29A2 || \
5041 ++ (dev)->pci_device == 0x2A02 || \
5042 ++ (dev)->pci_device == 0x2A12 || \
5043 ++ (dev)->pci_device == 0x2E02 || \
5044 ++ (dev)->pci_device == 0x2E12 || \
5045 ++ (dev)->pci_device == 0x2E22 || \
5046 ++ (dev)->pci_device == 0x2E32 || \
5047 ++ (dev)->pci_device == 0x2A42 || \
5048 ++ (dev)->pci_device == 0x2E42)
5049 ++
5050 + #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
5051 +
5052 ++#define IS_GEN6(dev) ((dev)->pci_device == 0x0102)
5053 ++
5054 + /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
5055 + * rows, which changed the alignment requirements and fence programming.
5056 + */
5057 +@@ -1067,6 +1088,9 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
5058 + #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
5059 + #define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6)
5060 +
5061 ++#define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \
5062 ++ IS_GEN6(dev))
5063 ++
5064 + #define PRIMARY_RINGBUFFER_SIZE (128*1024)
5065 +
5066 + #endif
5067 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
5068 +index fd099a1..6458400 100644
5069 +--- a/drivers/gpu/drm/i915/i915_gem.c
5070 ++++ b/drivers/gpu/drm/i915/i915_gem.c
5071 +@@ -1819,7 +1819,7 @@ i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible)
5072 + return -EIO;
5073 +
5074 + if (!i915_seqno_passed(i915_get_gem_seqno(dev), seqno)) {
5075 +- if (IS_IRONLAKE(dev))
5076 ++ if (HAS_PCH_SPLIT(dev))
5077 + ier = I915_READ(DEIER) | I915_READ(GTIER);
5078 + else
5079 + ier = I915_READ(IER);
5080 +@@ -2316,6 +2316,12 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
5081 + pitch_val = obj_priv->stride / tile_width;
5082 + pitch_val = ffs(pitch_val) - 1;
5083 +
5084 ++ if (obj_priv->tiling_mode == I915_TILING_Y &&
5085 ++ HAS_128_BYTE_Y_TILING(dev))
5086 ++ WARN_ON(pitch_val > I830_FENCE_MAX_PITCH_VAL);
5087 ++ else
5088 ++ WARN_ON(pitch_val > I915_FENCE_MAX_PITCH_VAL);
5089 ++
5090 + val = obj_priv->gtt_offset;
5091 + if (obj_priv->tiling_mode == I915_TILING_Y)
5092 + val |= 1 << I830_FENCE_TILING_Y_SHIFT;
5093 +diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
5094 +index df278b2..040e80c 100644
5095 +--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
5096 ++++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
5097 +@@ -209,7 +209,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
5098 + uint32_t swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
5099 + bool need_disable;
5100 +
5101 +- if (IS_IRONLAKE(dev)) {
5102 ++ if (IS_IRONLAKE(dev) || IS_GEN6(dev)) {
5103 + /* On Ironlake whatever DRAM config, GPU always do
5104 + * same swizzling setup.
5105 + */
5106 +@@ -357,21 +357,17 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
5107 + * reg, so dont bother to check the size */
5108 + if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
5109 + return false;
5110 +- } else if (IS_I9XX(dev)) {
5111 +- uint32_t pitch_val = ffs(stride / tile_width) - 1;
5112 +-
5113 +- /* XXX: For Y tiling, FENCE_MAX_PITCH_VAL is actually 6 (8KB)
5114 +- * instead of 4 (2KB) on 945s.
5115 +- */
5116 +- if (pitch_val > I915_FENCE_MAX_PITCH_VAL ||
5117 +- size > (I830_FENCE_MAX_SIZE_VAL << 20))
5118 ++ } else if (IS_GEN3(dev) || IS_GEN2(dev)) {
5119 ++ if (stride > 8192)
5120 + return false;
5121 +- } else {
5122 +- uint32_t pitch_val = ffs(stride / tile_width) - 1;
5123 +
5124 +- if (pitch_val > I830_FENCE_MAX_PITCH_VAL ||
5125 +- size > (I830_FENCE_MAX_SIZE_VAL << 19))
5126 +- return false;
5127 ++ if (IS_GEN3(dev)) {
5128 ++ if (size > I830_FENCE_MAX_SIZE_VAL << 20)
5129 ++ return false;
5130 ++ } else {
5131 ++ if (size > I830_FENCE_MAX_SIZE_VAL << 19)
5132 ++ return false;
5133 ++ }
5134 + }
5135 +
5136 + /* 965+ just needs multiples of tile width */
5137 +diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
5138 +index a17d6bd..032f667 100644
5139 +--- a/drivers/gpu/drm/i915/i915_irq.c
5140 ++++ b/drivers/gpu/drm/i915/i915_irq.c
5141 +@@ -576,7 +576,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
5142 +
5143 + atomic_inc(&dev_priv->irq_received);
5144 +
5145 +- if (IS_IRONLAKE(dev))
5146 ++ if (HAS_PCH_SPLIT(dev))
5147 + return ironlake_irq_handler(dev);
5148 +
5149 + iir = I915_READ(IIR);
5150 +@@ -737,7 +737,7 @@ void i915_user_irq_get(struct drm_device *dev)
5151 +
5152 + spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
5153 + if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) {
5154 +- if (IS_IRONLAKE(dev))
5155 ++ if (HAS_PCH_SPLIT(dev))
5156 + ironlake_enable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
5157 + else
5158 + i915_enable_irq(dev_priv, I915_USER_INTERRUPT);
5159 +@@ -753,7 +753,7 @@ void i915_user_irq_put(struct drm_device *dev)
5160 + spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
5161 + BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0);
5162 + if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) {
5163 +- if (IS_IRONLAKE(dev))
5164 ++ if (HAS_PCH_SPLIT(dev))
5165 + ironlake_disable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
5166 + else
5167 + i915_disable_irq(dev_priv, I915_USER_INTERRUPT);
5168 +@@ -861,7 +861,7 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
5169 + return -EINVAL;
5170 +
5171 + spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
5172 +- if (IS_IRONLAKE(dev))
5173 ++ if (HAS_PCH_SPLIT(dev))
5174 + ironlake_enable_display_irq(dev_priv, (pipe == 0) ?
5175 + DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
5176 + else if (IS_I965G(dev))
5177 +@@ -883,7 +883,7 @@ void i915_disable_vblank(struct drm_device *dev, int pipe)
5178 + unsigned long irqflags;
5179 +
5180 + spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
5181 +- if (IS_IRONLAKE(dev))
5182 ++ if (HAS_PCH_SPLIT(dev))
5183 + ironlake_disable_display_irq(dev_priv, (pipe == 0) ?
5184 + DE_PIPEA_VBLANK: DE_PIPEB_VBLANK);
5185 + else
5186 +@@ -897,7 +897,7 @@ void i915_enable_interrupt (struct drm_device *dev)
5187 + {
5188 + struct drm_i915_private *dev_priv = dev->dev_private;
5189 +
5190 +- if (!IS_IRONLAKE(dev))
5191 ++ if (!HAS_PCH_SPLIT(dev))
5192 + opregion_enable_asle(dev);
5193 + dev_priv->irq_enabled = 1;
5194 + }
5195 +@@ -1076,7 +1076,7 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
5196 + INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
5197 + INIT_WORK(&dev_priv->error_work, i915_error_work_func);
5198 +
5199 +- if (IS_IRONLAKE(dev)) {
5200 ++ if (HAS_PCH_SPLIT(dev)) {
5201 + ironlake_irq_preinstall(dev);
5202 + return;
5203 + }
5204 +@@ -1108,7 +1108,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
5205 +
5206 + dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
5207 +
5208 +- if (IS_IRONLAKE(dev))
5209 ++ if (HAS_PCH_SPLIT(dev))
5210 + return ironlake_irq_postinstall(dev);
5211 +
5212 + /* Unmask the interrupts that we always want on. */
5213 +@@ -1196,7 +1196,7 @@ void i915_driver_irq_uninstall(struct drm_device * dev)
5214 +
5215 + dev_priv->vblank_pipe = 0;
5216 +
5217 +- if (IS_IRONLAKE(dev)) {
5218 ++ if (HAS_PCH_SPLIT(dev)) {
5219 + ironlake_irq_uninstall(dev);
5220 + return;
5221 + }
5222 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
5223 +index ab1bd2d..fd95bdf 100644
5224 +--- a/drivers/gpu/drm/i915/i915_reg.h
5225 ++++ b/drivers/gpu/drm/i915/i915_reg.h
5226 +@@ -221,7 +221,7 @@
5227 + #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
5228 + #define I830_FENCE_PITCH_SHIFT 4
5229 + #define I830_FENCE_REG_VALID (1<<0)
5230 +-#define I915_FENCE_MAX_PITCH_VAL 0x10
5231 ++#define I915_FENCE_MAX_PITCH_VAL 4
5232 + #define I830_FENCE_MAX_PITCH_VAL 6
5233 + #define I830_FENCE_MAX_SIZE_VAL (1<<8)
5234 +
5235 +diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
5236 +index 15fbc1b..70c9d4b 100644
5237 +--- a/drivers/gpu/drm/i915/intel_bios.c
5238 ++++ b/drivers/gpu/drm/i915/intel_bios.c
5239 +@@ -247,6 +247,7 @@ static void
5240 + parse_general_features(struct drm_i915_private *dev_priv,
5241 + struct bdb_header *bdb)
5242 + {
5243 ++ struct drm_device *dev = dev_priv->dev;
5244 + struct bdb_general_features *general;
5245 +
5246 + /* Set sensible defaults in case we can't find the general block */
5247 +@@ -263,7 +264,7 @@ parse_general_features(struct drm_i915_private *dev_priv,
5248 + if (IS_I85X(dev_priv->dev))
5249 + dev_priv->lvds_ssc_freq =
5250 + general->ssc_freq ? 66 : 48;
5251 +- else if (IS_IRONLAKE(dev_priv->dev))
5252 ++ else if (IS_IRONLAKE(dev_priv->dev) || IS_GEN6(dev))
5253 + dev_priv->lvds_ssc_freq =
5254 + general->ssc_freq ? 100 : 120;
5255 + else
5256 +diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
5257 +index 79dd402..fccf074 100644
5258 +--- a/drivers/gpu/drm/i915/intel_crt.c
5259 ++++ b/drivers/gpu/drm/i915/intel_crt.c
5260 +@@ -39,7 +39,7 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
5261 + struct drm_i915_private *dev_priv = dev->dev_private;
5262 + u32 temp, reg;
5263 +
5264 +- if (IS_IRONLAKE(dev))
5265 ++ if (HAS_PCH_SPLIT(dev))
5266 + reg = PCH_ADPA;
5267 + else
5268 + reg = ADPA;
5269 +@@ -113,7 +113,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
5270 + else
5271 + dpll_md_reg = DPLL_B_MD;
5272 +
5273 +- if (IS_IRONLAKE(dev))
5274 ++ if (HAS_PCH_SPLIT(dev))
5275 + adpa_reg = PCH_ADPA;
5276 + else
5277 + adpa_reg = ADPA;
5278 +@@ -122,7 +122,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
5279 + * Disable separate mode multiplier used when cloning SDVO to CRT
5280 + * XXX this needs to be adjusted when we really are cloning
5281 + */
5282 +- if (IS_I965G(dev) && !IS_IRONLAKE(dev)) {
5283 ++ if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) {
5284 + dpll_md = I915_READ(dpll_md_reg);
5285 + I915_WRITE(dpll_md_reg,
5286 + dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK);
5287 +@@ -136,11 +136,11 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
5288 +
5289 + if (intel_crtc->pipe == 0) {
5290 + adpa |= ADPA_PIPE_A_SELECT;
5291 +- if (!IS_IRONLAKE(dev))
5292 ++ if (!HAS_PCH_SPLIT(dev))
5293 + I915_WRITE(BCLRPAT_A, 0);
5294 + } else {
5295 + adpa |= ADPA_PIPE_B_SELECT;
5296 +- if (!IS_IRONLAKE(dev))
5297 ++ if (!HAS_PCH_SPLIT(dev))
5298 + I915_WRITE(BCLRPAT_B, 0);
5299 + }
5300 +
5301 +@@ -202,7 +202,7 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
5302 + u32 hotplug_en;
5303 + int i, tries = 0;
5304 +
5305 +- if (IS_IRONLAKE(dev))
5306 ++ if (HAS_PCH_SPLIT(dev))
5307 + return intel_ironlake_crt_detect_hotplug(connector);
5308 +
5309 + /*
5310 +@@ -524,7 +524,7 @@ void intel_crt_init(struct drm_device *dev)
5311 + &intel_output->enc);
5312 +
5313 + /* Set up the DDC bus. */
5314 +- if (IS_IRONLAKE(dev))
5315 ++ if (HAS_PCH_SPLIT(dev))
5316 + i2c_reg = PCH_GPIOA;
5317 + else {
5318 + i2c_reg = GPIOA;
5319 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
5320 +index b27202d..4b2458d 100644
5321 +--- a/drivers/gpu/drm/i915/intel_display.c
5322 ++++ b/drivers/gpu/drm/i915/intel_display.c
5323 +@@ -232,7 +232,7 @@ struct intel_limit {
5324 + #define G4X_P2_DISPLAY_PORT_FAST 10
5325 + #define G4X_P2_DISPLAY_PORT_LIMIT 0
5326 +
5327 +-/* Ironlake */
5328 ++/* Ironlake / Sandybridge */
5329 + /* as we calculate clock using (register_value + 2) for
5330 + N/M1/M2, so here the range value for them is (actual_value-2).
5331 + */
5332 +@@ -690,7 +690,7 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
5333 + struct drm_device *dev = crtc->dev;
5334 + const intel_limit_t *limit;
5335 +
5336 +- if (IS_IRONLAKE(dev))
5337 ++ if (HAS_PCH_SPLIT(dev))
5338 + limit = intel_ironlake_limit(crtc);
5339 + else if (IS_G4X(dev)) {
5340 + limit = intel_g4x_limit(crtc);
5341 +@@ -1366,7 +1366,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
5342 + dspcntr &= ~DISPPLANE_TILED;
5343 + }
5344 +
5345 +- if (IS_IRONLAKE(dev))
5346 ++ if (HAS_PCH_SPLIT(dev))
5347 + /* must disable */
5348 + dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
5349 +
5350 +@@ -1427,7 +1427,7 @@ static void i915_disable_vga (struct drm_device *dev)
5351 + u8 sr1;
5352 + u32 vga_reg;
5353 +
5354 +- if (IS_IRONLAKE(dev))
5355 ++ if (HAS_PCH_SPLIT(dev))
5356 + vga_reg = CPU_VGACNTRL;
5357 + else
5358 + vga_reg = VGACNTRL;
5359 +@@ -2111,7 +2111,7 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
5360 + struct drm_display_mode *adjusted_mode)
5361 + {
5362 + struct drm_device *dev = crtc->dev;
5363 +- if (IS_IRONLAKE(dev)) {
5364 ++ if (HAS_PCH_SPLIT(dev)) {
5365 + /* FDI link clock is fixed at 2.7G */
5366 + if (mode->clock * 3 > 27000 * 4)
5367 + return MODE_CLOCK_HIGH;
5368 +@@ -2967,7 +2967,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5369 + refclk / 1000);
5370 + } else if (IS_I9XX(dev)) {
5371 + refclk = 96000;
5372 +- if (IS_IRONLAKE(dev))
5373 ++ if (HAS_PCH_SPLIT(dev))
5374 + refclk = 120000; /* 120Mhz refclk */
5375 + } else {
5376 + refclk = 48000;
5377 +@@ -3025,7 +3025,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5378 + }
5379 +
5380 + /* FDI link */
5381 +- if (IS_IRONLAKE(dev)) {
5382 ++ if (HAS_PCH_SPLIT(dev)) {
5383 + int lane, link_bw, bpp;
5384 + /* eDP doesn't require FDI link, so just set DP M/N
5385 + according to current link config */
5386 +@@ -3102,7 +3102,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5387 + * PCH B stepping, previous chipset stepping should be
5388 + * ignoring this setting.
5389 + */
5390 +- if (IS_IRONLAKE(dev)) {
5391 ++ if (HAS_PCH_SPLIT(dev)) {
5392 + temp = I915_READ(PCH_DREF_CONTROL);
5393 + /* Always enable nonspread source */
5394 + temp &= ~DREF_NONSPREAD_SOURCE_MASK;
5395 +@@ -3149,7 +3149,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5396 + reduced_clock.m2;
5397 + }
5398 +
5399 +- if (!IS_IRONLAKE(dev))
5400 ++ if (!HAS_PCH_SPLIT(dev))
5401 + dpll = DPLL_VGA_MODE_DIS;
5402 +
5403 + if (IS_I9XX(dev)) {
5404 +@@ -3162,7 +3162,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5405 + sdvo_pixel_multiply = adjusted_mode->clock / mode->clock;
5406 + if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
5407 + dpll |= (sdvo_pixel_multiply - 1) << SDVO_MULTIPLIER_SHIFT_HIRES;
5408 +- else if (IS_IRONLAKE(dev))
5409 ++ else if (HAS_PCH_SPLIT(dev))
5410 + dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT;
5411 + }
5412 + if (is_dp)
5413 +@@ -3174,7 +3174,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5414 + else {
5415 + dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
5416 + /* also FPA1 */
5417 +- if (IS_IRONLAKE(dev))
5418 ++ if (HAS_PCH_SPLIT(dev))
5419 + dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT;
5420 + if (IS_G4X(dev) && has_reduced_clock)
5421 + dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT;
5422 +@@ -3193,7 +3193,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5423 + dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14;
5424 + break;
5425 + }
5426 +- if (IS_I965G(dev) && !IS_IRONLAKE(dev))
5427 ++ if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev))
5428 + dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT);
5429 + } else {
5430 + if (is_lvds) {
5431 +@@ -3227,7 +3227,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5432 +
5433 + /* Ironlake's plane is forced to pipe, bit 24 is to
5434 + enable color space conversion */
5435 +- if (!IS_IRONLAKE(dev)) {
5436 ++ if (!HAS_PCH_SPLIT(dev)) {
5437 + if (pipe == 0)
5438 + dspcntr &= ~DISPPLANE_SEL_PIPE_MASK;
5439 + else
5440 +@@ -3254,14 +3254,14 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5441 +
5442 +
5443 + /* Disable the panel fitter if it was on our pipe */
5444 +- if (!IS_IRONLAKE(dev) && intel_panel_fitter_pipe(dev) == pipe)
5445 ++ if (!HAS_PCH_SPLIT(dev) && intel_panel_fitter_pipe(dev) == pipe)
5446 + I915_WRITE(PFIT_CONTROL, 0);
5447 +
5448 + DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
5449 + drm_mode_debug_printmodeline(mode);
5450 +
5451 + /* assign to Ironlake registers */
5452 +- if (IS_IRONLAKE(dev)) {
5453 ++ if (HAS_PCH_SPLIT(dev)) {
5454 + fp_reg = pch_fp_reg;
5455 + dpll_reg = pch_dpll_reg;
5456 + }
5457 +@@ -3282,7 +3282,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5458 + if (is_lvds) {
5459 + u32 lvds;
5460 +
5461 +- if (IS_IRONLAKE(dev))
5462 ++ if (HAS_PCH_SPLIT(dev))
5463 + lvds_reg = PCH_LVDS;
5464 +
5465 + lvds = I915_READ(lvds_reg);
5466 +@@ -3328,7 +3328,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5467 + /* Wait for the clocks to stabilize. */
5468 + udelay(150);
5469 +
5470 +- if (IS_I965G(dev) && !IS_IRONLAKE(dev)) {
5471 ++ if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) {
5472 + if (is_sdvo) {
5473 + sdvo_pixel_multiply = adjusted_mode->clock / mode->clock;
5474 + I915_WRITE(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) |
5475 +@@ -3375,14 +3375,14 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5476 + /* pipesrc and dspsize control the size that is scaled from, which should
5477 + * always be the user's requested size.
5478 + */
5479 +- if (!IS_IRONLAKE(dev)) {
5480 ++ if (!HAS_PCH_SPLIT(dev)) {
5481 + I915_WRITE(dspsize_reg, ((mode->vdisplay - 1) << 16) |
5482 + (mode->hdisplay - 1));
5483 + I915_WRITE(dsppos_reg, 0);
5484 + }
5485 + I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
5486 +
5487 +- if (IS_IRONLAKE(dev)) {
5488 ++ if (HAS_PCH_SPLIT(dev)) {
5489 + I915_WRITE(data_m1_reg, TU_SIZE(m_n.tu) | m_n.gmch_m);
5490 + I915_WRITE(data_n1_reg, TU_SIZE(m_n.tu) | m_n.gmch_n);
5491 + I915_WRITE(link_m1_reg, m_n.link_m);
5492 +@@ -3403,7 +3403,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5493 +
5494 + intel_wait_for_vblank(dev);
5495 +
5496 +- if (IS_IRONLAKE(dev)) {
5497 ++ if (HAS_PCH_SPLIT(dev)) {
5498 + /* enable address swizzle for tiling buffer */
5499 + temp = I915_READ(DISP_ARB_CTL);
5500 + I915_WRITE(DISP_ARB_CTL, temp | DISP_TILE_SURFACE_SWIZZLING);
5501 +@@ -3438,7 +3438,7 @@ void intel_crtc_load_lut(struct drm_crtc *crtc)
5502 + return;
5503 +
5504 + /* use legacy palette for Ironlake */
5505 +- if (IS_IRONLAKE(dev))
5506 ++ if (HAS_PCH_SPLIT(dev))
5507 + palreg = (intel_crtc->pipe == 0) ? LGC_PALETTE_A :
5508 + LGC_PALETTE_B;
5509 +
5510 +@@ -3922,7 +3922,7 @@ static void intel_increase_pllclock(struct drm_crtc *crtc, bool schedule)
5511 + int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
5512 + int dpll = I915_READ(dpll_reg);
5513 +
5514 +- if (IS_IRONLAKE(dev))
5515 ++ if (HAS_PCH_SPLIT(dev))
5516 + return;
5517 +
5518 + if (!dev_priv->lvds_downclock_avail)
5519 +@@ -3961,7 +3961,7 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)
5520 + int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
5521 + int dpll = I915_READ(dpll_reg);
5522 +
5523 +- if (IS_IRONLAKE(dev))
5524 ++ if (HAS_PCH_SPLIT(dev))
5525 + return;
5526 +
5527 + if (!dev_priv->lvds_downclock_avail)
5528 +@@ -4382,7 +4382,7 @@ static void intel_setup_outputs(struct drm_device *dev)
5529 + if (IS_MOBILE(dev) && !IS_I830(dev))
5530 + intel_lvds_init(dev);
5531 +
5532 +- if (IS_IRONLAKE(dev)) {
5533 ++ if (HAS_PCH_SPLIT(dev)) {
5534 + int found;
5535 +
5536 + if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED))
5537 +@@ -4451,7 +4451,7 @@ static void intel_setup_outputs(struct drm_device *dev)
5538 + DRM_DEBUG_KMS("probing DP_D\n");
5539 + intel_dp_init(dev, DP_D);
5540 + }
5541 +- } else if (IS_I8XX(dev))
5542 ++ } else if (IS_GEN2(dev))
5543 + intel_dvo_init(dev);
5544 +
5545 + if (SUPPORTS_TV(dev))
5546 +@@ -4599,7 +4599,7 @@ void intel_init_clock_gating(struct drm_device *dev)
5547 + * Disable clock gating reported to work incorrectly according to the
5548 + * specs, but enable as much else as we can.
5549 + */
5550 +- if (IS_IRONLAKE(dev)) {
5551 ++ if (HAS_PCH_SPLIT(dev)) {
5552 + return;
5553 + } else if (IS_G4X(dev)) {
5554 + uint32_t dspclk_gate;
5555 +@@ -4672,7 +4672,7 @@ static void intel_init_display(struct drm_device *dev)
5556 + struct drm_i915_private *dev_priv = dev->dev_private;
5557 +
5558 + /* We always want a DPMS function */
5559 +- if (IS_IRONLAKE(dev))
5560 ++ if (HAS_PCH_SPLIT(dev))
5561 + dev_priv->display.dpms = ironlake_crtc_dpms;
5562 + else
5563 + dev_priv->display.dpms = i9xx_crtc_dpms;
5564 +@@ -4715,7 +4715,7 @@ static void intel_init_display(struct drm_device *dev)
5565 + i830_get_display_clock_speed;
5566 +
5567 + /* For FIFO watermark updates */
5568 +- if (IS_IRONLAKE(dev))
5569 ++ if (HAS_PCH_SPLIT(dev))
5570 + dev_priv->display.update_wm = NULL;
5571 + else if (IS_G4X(dev))
5572 + dev_priv->display.update_wm = g4x_update_wm;
5573 +diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
5574 +index 1238bc9..66df0c3 100644
5575 +--- a/drivers/gpu/drm/i915/intel_lvds.c
5576 ++++ b/drivers/gpu/drm/i915/intel_lvds.c
5577 +@@ -661,7 +661,7 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
5578 + /* ACPI lid methods were generally unreliable in this generation, so
5579 + * don't even bother.
5580 + */
5581 +- if (IS_I8XX(dev))
5582 ++ if (IS_GEN2(dev))
5583 + return connector_status_connected;
5584 +
5585 + if (!dmi_check_system(bad_lid_status) && !acpi_lid_open())
5586 +diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
5587 +index 63f569b..6b89042 100644
5588 +--- a/drivers/gpu/drm/i915/intel_overlay.c
5589 ++++ b/drivers/gpu/drm/i915/intel_overlay.c
5590 +@@ -172,7 +172,7 @@ struct overlay_registers {
5591 + #define OFC_UPDATE 0x1
5592 +
5593 + #define OVERLAY_NONPHYSICAL(dev) (IS_G33(dev) || IS_I965G(dev))
5594 +-#define OVERLAY_EXISTS(dev) (!IS_G4X(dev) && !IS_IRONLAKE(dev))
5595 ++#define OVERLAY_EXISTS(dev) (!IS_G4X(dev) && !IS_IRONLAKE(dev) && !IS_GEN6(dev))
5596 +
5597 +
5598 + static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
5599 +diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
5600 +index 10be7b5..855911e 100644
5601 +--- a/drivers/i2c/i2c-core.c
5602 ++++ b/drivers/i2c/i2c-core.c
5603 +@@ -1210,12 +1210,23 @@ static int i2c_detect_address(struct i2c_client *temp_client,
5604 + return 0;
5605 +
5606 + /* Make sure there is something at this address */
5607 +- if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0)
5608 +- return 0;
5609 ++ if (addr == 0x73 && (adapter->class & I2C_CLASS_HWMON)) {
5610 ++ /* Special probe for FSC hwmon chips */
5611 ++ union i2c_smbus_data dummy;
5612 +
5613 +- /* Prevent 24RF08 corruption */
5614 +- if ((addr & ~0x0f) == 0x50)
5615 +- i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL);
5616 ++ if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_READ, 0,
5617 ++ I2C_SMBUS_BYTE_DATA, &dummy) < 0)
5618 ++ return 0;
5619 ++ } else {
5620 ++ if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
5621 ++ I2C_SMBUS_QUICK, NULL) < 0)
5622 ++ return 0;
5623 ++
5624 ++ /* Prevent 24RF08 corruption */
5625 ++ if ((addr & ~0x0f) == 0x50)
5626 ++ i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
5627 ++ I2C_SMBUS_QUICK, NULL);
5628 ++ }
5629 +
5630 + /* Finally call the custom detection function */
5631 + memset(&info, 0, sizeof(struct i2c_board_info));
5632 +diff --git a/drivers/md/md.c b/drivers/md/md.c
5633 +index a20a71e..2ecd1d5 100644
5634 +--- a/drivers/md/md.c
5635 ++++ b/drivers/md/md.c
5636 +@@ -2108,12 +2108,18 @@ repeat:
5637 + if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */
5638 + /* .. if the array isn't clean, an 'even' event must also go
5639 + * to spares. */
5640 +- if ((mddev->events&1)==0)
5641 ++ if ((mddev->events&1)==0) {
5642 + nospares = 0;
5643 ++ sync_req = 2; /* force a second update to get the
5644 ++ * even/odd in sync */
5645 ++ }
5646 + } else {
5647 + /* otherwise an 'odd' event must go to spares */
5648 +- if ((mddev->events&1))
5649 ++ if ((mddev->events&1)) {
5650 + nospares = 0;
5651 ++ sync_req = 2; /* force a second update to get the
5652 ++ * even/odd in sync */
5653 ++ }
5654 + }
5655 + }
5656 +
5657 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
5658 +index ceb24af..0468f5b 100644
5659 +--- a/drivers/md/raid5.c
5660 ++++ b/drivers/md/raid5.c
5661 +@@ -1526,7 +1526,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
5662 +
5663 + clear_bit(R5_UPTODATE, &sh->dev[i].flags);
5664 + atomic_inc(&rdev->read_errors);
5665 +- if (conf->mddev->degraded)
5666 ++ if (conf->mddev->degraded >= conf->max_degraded)
5667 + printk_rl(KERN_WARNING
5668 + "raid5:%s: read error not correctable "
5669 + "(sector %llu on %s).\n",
5670 +@@ -1649,8 +1649,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5671 + int previous, int *dd_idx,
5672 + struct stripe_head *sh)
5673 + {
5674 +- long stripe;
5675 +- unsigned long chunk_number;
5676 ++ sector_t stripe, stripe2;
5677 ++ sector_t chunk_number;
5678 + unsigned int chunk_offset;
5679 + int pd_idx, qd_idx;
5680 + int ddf_layout = 0;
5681 +@@ -1670,18 +1670,13 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5682 + */
5683 + chunk_offset = sector_div(r_sector, sectors_per_chunk);
5684 + chunk_number = r_sector;
5685 +- BUG_ON(r_sector != chunk_number);
5686 +
5687 + /*
5688 + * Compute the stripe number
5689 + */
5690 +- stripe = chunk_number / data_disks;
5691 +-
5692 +- /*
5693 +- * Compute the data disk and parity disk indexes inside the stripe
5694 +- */
5695 +- *dd_idx = chunk_number % data_disks;
5696 +-
5697 ++ stripe = chunk_number;
5698 ++ *dd_idx = sector_div(stripe, data_disks);
5699 ++ stripe2 = stripe;
5700 + /*
5701 + * Select the parity disk based on the user selected algorithm.
5702 + */
5703 +@@ -1693,21 +1688,21 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5704 + case 5:
5705 + switch (algorithm) {
5706 + case ALGORITHM_LEFT_ASYMMETRIC:
5707 +- pd_idx = data_disks - stripe % raid_disks;
5708 ++ pd_idx = data_disks - sector_div(stripe2, raid_disks);
5709 + if (*dd_idx >= pd_idx)
5710 + (*dd_idx)++;
5711 + break;
5712 + case ALGORITHM_RIGHT_ASYMMETRIC:
5713 +- pd_idx = stripe % raid_disks;
5714 ++ pd_idx = sector_div(stripe2, raid_disks);
5715 + if (*dd_idx >= pd_idx)
5716 + (*dd_idx)++;
5717 + break;
5718 + case ALGORITHM_LEFT_SYMMETRIC:
5719 +- pd_idx = data_disks - stripe % raid_disks;
5720 ++ pd_idx = data_disks - sector_div(stripe2, raid_disks);
5721 + *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
5722 + break;
5723 + case ALGORITHM_RIGHT_SYMMETRIC:
5724 +- pd_idx = stripe % raid_disks;
5725 ++ pd_idx = sector_div(stripe2, raid_disks);
5726 + *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
5727 + break;
5728 + case ALGORITHM_PARITY_0:
5729 +@@ -1727,7 +1722,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5730 +
5731 + switch (algorithm) {
5732 + case ALGORITHM_LEFT_ASYMMETRIC:
5733 +- pd_idx = raid_disks - 1 - (stripe % raid_disks);
5734 ++ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
5735 + qd_idx = pd_idx + 1;
5736 + if (pd_idx == raid_disks-1) {
5737 + (*dd_idx)++; /* Q D D D P */
5738 +@@ -1736,7 +1731,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5739 + (*dd_idx) += 2; /* D D P Q D */
5740 + break;
5741 + case ALGORITHM_RIGHT_ASYMMETRIC:
5742 +- pd_idx = stripe % raid_disks;
5743 ++ pd_idx = sector_div(stripe2, raid_disks);
5744 + qd_idx = pd_idx + 1;
5745 + if (pd_idx == raid_disks-1) {
5746 + (*dd_idx)++; /* Q D D D P */
5747 +@@ -1745,12 +1740,12 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5748 + (*dd_idx) += 2; /* D D P Q D */
5749 + break;
5750 + case ALGORITHM_LEFT_SYMMETRIC:
5751 +- pd_idx = raid_disks - 1 - (stripe % raid_disks);
5752 ++ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
5753 + qd_idx = (pd_idx + 1) % raid_disks;
5754 + *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks;
5755 + break;
5756 + case ALGORITHM_RIGHT_SYMMETRIC:
5757 +- pd_idx = stripe % raid_disks;
5758 ++ pd_idx = sector_div(stripe2, raid_disks);
5759 + qd_idx = (pd_idx + 1) % raid_disks;
5760 + *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks;
5761 + break;
5762 +@@ -1769,7 +1764,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5763 + /* Exactly the same as RIGHT_ASYMMETRIC, but or
5764 + * of blocks for computing Q is different.
5765 + */
5766 +- pd_idx = stripe % raid_disks;
5767 ++ pd_idx = sector_div(stripe2, raid_disks);
5768 + qd_idx = pd_idx + 1;
5769 + if (pd_idx == raid_disks-1) {
5770 + (*dd_idx)++; /* Q D D D P */
5771 +@@ -1784,7 +1779,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5772 + * D D D P Q rather than
5773 + * Q D D D P
5774 + */
5775 +- pd_idx = raid_disks - 1 - ((stripe + 1) % raid_disks);
5776 ++ stripe2 += 1;
5777 ++ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
5778 + qd_idx = pd_idx + 1;
5779 + if (pd_idx == raid_disks-1) {
5780 + (*dd_idx)++; /* Q D D D P */
5781 +@@ -1796,7 +1792,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5782 +
5783 + case ALGORITHM_ROTATING_N_CONTINUE:
5784 + /* Same as left_symmetric but Q is before P */
5785 +- pd_idx = raid_disks - 1 - (stripe % raid_disks);
5786 ++ pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks);
5787 + qd_idx = (pd_idx + raid_disks - 1) % raid_disks;
5788 + *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks;
5789 + ddf_layout = 1;
5790 +@@ -1804,27 +1800,27 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector,
5791 +
5792 + case ALGORITHM_LEFT_ASYMMETRIC_6:
5793 + /* RAID5 left_asymmetric, with Q on last device */
5794 +- pd_idx = data_disks - stripe % (raid_disks-1);
5795 ++ pd_idx = data_disks - sector_div(stripe2, raid_disks-1);
5796 + if (*dd_idx >= pd_idx)
5797 + (*dd_idx)++;
5798 + qd_idx = raid_disks - 1;
5799 + break;
5800 +
5801 + case ALGORITHM_RIGHT_ASYMMETRIC_6:
5802 +- pd_idx = stripe % (raid_disks-1);
5803 ++ pd_idx = sector_div(stripe2, raid_disks-1);
5804 + if (*dd_idx >= pd_idx)
5805 + (*dd_idx)++;
5806 + qd_idx = raid_disks - 1;
5807 + break;
5808 +
5809 + case ALGORITHM_LEFT_SYMMETRIC_6:
5810 +- pd_idx = data_disks - stripe % (raid_disks-1);
5811 ++ pd_idx = data_disks - sector_div(stripe2, raid_disks-1);
5812 + *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1);
5813 + qd_idx = raid_disks - 1;
5814 + break;
5815 +
5816 + case ALGORITHM_RIGHT_SYMMETRIC_6:
5817 +- pd_idx = stripe % (raid_disks-1);
5818 ++ pd_idx = sector_div(stripe2, raid_disks-1);
5819 + *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1);
5820 + qd_idx = raid_disks - 1;
5821 + break;
5822 +@@ -1869,14 +1865,14 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
5823 + : conf->algorithm;
5824 + sector_t stripe;
5825 + int chunk_offset;
5826 +- int chunk_number, dummy1, dd_idx = i;
5827 ++ sector_t chunk_number;
5828 ++ int dummy1, dd_idx = i;
5829 + sector_t r_sector;
5830 + struct stripe_head sh2;
5831 +
5832 +
5833 + chunk_offset = sector_div(new_sector, sectors_per_chunk);
5834 + stripe = new_sector;
5835 +- BUG_ON(new_sector != stripe);
5836 +
5837 + if (i == sh->pd_idx)
5838 + return 0;
5839 +@@ -1969,7 +1965,7 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
5840 + }
5841 +
5842 + chunk_number = stripe * data_disks + i;
5843 +- r_sector = (sector_t)chunk_number * sectors_per_chunk + chunk_offset;
5844 ++ r_sector = chunk_number * sectors_per_chunk + chunk_offset;
5845 +
5846 + check = raid5_compute_sector(conf, r_sector,
5847 + previous, &dummy1, &sh2);
5848 +diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
5849 +index e48380c..95a463c 100644
5850 +--- a/drivers/media/dvb/ttpci/budget.c
5851 ++++ b/drivers/media/dvb/ttpci/budget.c
5852 +@@ -643,9 +643,6 @@ static void frontend_init(struct budget *budget)
5853 + &budget->i2c_adap,
5854 + &tt1600_isl6423_config);
5855 +
5856 +- } else {
5857 +- dvb_frontend_detach(budget->dvb_frontend);
5858 +- budget->dvb_frontend = NULL;
5859 + }
5860 + }
5861 + break;
5862 +diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
5863 +index 65df1de..a555c90 100644
5864 +--- a/drivers/net/bnx2.c
5865 ++++ b/drivers/net/bnx2.c
5866 +@@ -4772,8 +4772,12 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
5867 + rc = bnx2_alloc_bad_rbuf(bp);
5868 + }
5869 +
5870 +- if (bp->flags & BNX2_FLAG_USING_MSIX)
5871 ++ if (bp->flags & BNX2_FLAG_USING_MSIX) {
5872 + bnx2_setup_msix_tbl(bp);
5873 ++ /* Prevent MSIX table reads and write from timing out */
5874 ++ REG_WR(bp, BNX2_MISC_ECO_HW_CTL,
5875 ++ BNX2_MISC_ECO_HW_CTL_LARGE_GRC_TMOUT_EN);
5876 ++ }
5877 +
5878 + return rc;
5879 + }
5880 +diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
5881 +index 3db85da..787befc 100644
5882 +--- a/drivers/net/r8169.c
5883 ++++ b/drivers/net/r8169.c
5884 +@@ -2832,8 +2832,13 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
5885 + spin_lock_irq(&tp->lock);
5886 +
5887 + RTL_W8(Cfg9346, Cfg9346_Unlock);
5888 +- RTL_W32(MAC0, low);
5889 ++
5890 + RTL_W32(MAC4, high);
5891 ++ RTL_R32(MAC4);
5892 ++
5893 ++ RTL_W32(MAC0, low);
5894 ++ RTL_R32(MAC0);
5895 ++
5896 + RTL_W8(Cfg9346, Cfg9346_Lock);
5897 +
5898 + spin_unlock_irq(&tp->lock);
5899 +@@ -4316,7 +4321,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5900 +
5901 + tp->cur_tx += frags + 1;
5902 +
5903 +- smp_wmb();
5904 ++ wmb();
5905 +
5906 + RTL_W8(TxPoll, NPQ); /* set polling bit */
5907 +
5908 +@@ -4675,7 +4680,7 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
5909 + * until it does.
5910 + */
5911 + tp->intr_mask = 0xffff;
5912 +- smp_wmb();
5913 ++ wmb();
5914 + RTL_W16(IntrMask, tp->intr_event);
5915 + }
5916 +
5917 +@@ -4813,8 +4818,8 @@ static void rtl_set_rx_mode(struct net_device *dev)
5918 + mc_filter[1] = swab32(data);
5919 + }
5920 +
5921 +- RTL_W32(MAR0 + 0, mc_filter[0]);
5922 + RTL_W32(MAR0 + 4, mc_filter[1]);
5923 ++ RTL_W32(MAR0 + 0, mc_filter[0]);
5924 +
5925 + RTL_W32(RxConfig, tmp);
5926 +
5927 +diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
5928 +index 46997e1..fb52e47 100644
5929 +--- a/drivers/net/sfc/efx.c
5930 ++++ b/drivers/net/sfc/efx.c
5931 +@@ -1862,6 +1862,7 @@ out:
5932 + }
5933 +
5934 + if (disabled) {
5935 ++ dev_close(efx->net_dev);
5936 + EFX_ERR(efx, "has been disabled\n");
5937 + efx->state = STATE_DISABLED;
5938 + } else {
5939 +@@ -1885,8 +1886,7 @@ static void efx_reset_work(struct work_struct *data)
5940 + }
5941 +
5942 + rtnl_lock();
5943 +- if (efx_reset(efx, efx->reset_pending))
5944 +- dev_close(efx->net_dev);
5945 ++ (void)efx_reset(efx, efx->reset_pending);
5946 + rtnl_unlock();
5947 + }
5948 +
5949 +diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
5950 +index 9d009c4..e20a824 100644
5951 +--- a/drivers/net/sfc/falcon.c
5952 ++++ b/drivers/net/sfc/falcon.c
5953 +@@ -1317,7 +1317,9 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
5954 +
5955 + EFX_LOG(efx, "PHY is %d phy_id %d\n", efx->phy_type, efx->mdio.prtad);
5956 +
5957 +- falcon_probe_board(efx, board_rev);
5958 ++ rc = falcon_probe_board(efx, board_rev);
5959 ++ if (rc)
5960 ++ goto fail2;
5961 +
5962 + kfree(nvconfig);
5963 + return 0;
5964 +diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
5965 +index 5712fdd..c7a933a 100644
5966 +--- a/drivers/net/sfc/falcon_boards.c
5967 ++++ b/drivers/net/sfc/falcon_boards.c
5968 +@@ -728,15 +728,7 @@ static const struct falcon_board_type board_types[] = {
5969 + },
5970 + };
5971 +
5972 +-static const struct falcon_board_type falcon_dummy_board = {
5973 +- .init = efx_port_dummy_op_int,
5974 +- .init_phy = efx_port_dummy_op_void,
5975 +- .fini = efx_port_dummy_op_void,
5976 +- .set_id_led = efx_port_dummy_op_set_id_led,
5977 +- .monitor = efx_port_dummy_op_int,
5978 +-};
5979 +-
5980 +-void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
5981 ++int falcon_probe_board(struct efx_nic *efx, u16 revision_info)
5982 + {
5983 + struct falcon_board *board = falcon_board(efx);
5984 + u8 type_id = FALCON_BOARD_TYPE(revision_info);
5985 +@@ -754,8 +746,9 @@ void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
5986 + (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
5987 + ? board->type->ref_model : board->type->gen_type,
5988 + 'A' + board->major, board->minor);
5989 ++ return 0;
5990 + } else {
5991 + EFX_ERR(efx, "unknown board type %d\n", type_id);
5992 +- board->type = &falcon_dummy_board;
5993 ++ return -ENODEV;
5994 + }
5995 + }
5996 +diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
5997 +index 9351c03..3166baf 100644
5998 +--- a/drivers/net/sfc/nic.h
5999 ++++ b/drivers/net/sfc/nic.h
6000 +@@ -156,7 +156,7 @@ extern struct efx_nic_type siena_a0_nic_type;
6001 + **************************************************************************
6002 + */
6003 +
6004 +-extern void falcon_probe_board(struct efx_nic *efx, u16 revision_info);
6005 ++extern int falcon_probe_board(struct efx_nic *efx, u16 revision_info);
6006 +
6007 + /* TX data path */
6008 + extern int efx_nic_probe_tx(struct efx_tx_queue *tx_queue);
6009 +diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
6010 +index f8c6771..afbac2d 100644
6011 +--- a/drivers/net/sfc/siena.c
6012 ++++ b/drivers/net/sfc/siena.c
6013 +@@ -454,8 +454,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
6014 +
6015 + static void siena_update_nic_stats(struct efx_nic *efx)
6016 + {
6017 +- while (siena_try_update_nic_stats(efx) == -EAGAIN)
6018 +- cpu_relax();
6019 ++ int retry;
6020 ++
6021 ++ /* If we're unlucky enough to read statistics wduring the DMA, wait
6022 ++ * up to 10ms for it to finish (typically takes <500us) */
6023 ++ for (retry = 0; retry < 100; ++retry) {
6024 ++ if (siena_try_update_nic_stats(efx) == 0)
6025 ++ return;
6026 ++ udelay(100);
6027 ++ }
6028 ++
6029 ++ /* Use the old values instead */
6030 + }
6031 +
6032 + static void siena_start_nic_stats(struct efx_nic *efx)
6033 +diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
6034 +index 17d1493..8405fb8 100644
6035 +--- a/drivers/net/tg3.c
6036 ++++ b/drivers/net/tg3.c
6037 +@@ -8572,6 +8572,7 @@ static int tg3_test_msi(struct tg3 *tp)
6038 + pci_disable_msi(tp->pdev);
6039 +
6040 + tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI;
6041 ++ tp->napi[0].irq_vec = tp->pdev->irq;
6042 +
6043 + err = tg3_request_irq(tp, 0);
6044 + if (err)
6045 +diff --git a/drivers/net/tun.c b/drivers/net/tun.c
6046 +index 2834a01..909b73d 100644
6047 +--- a/drivers/net/tun.c
6048 ++++ b/drivers/net/tun.c
6049 +@@ -380,6 +380,10 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
6050 + }
6051 + }
6052 +
6053 ++ /* Orphan the skb - required as we might hang on to it
6054 ++ * for indefinite time. */
6055 ++ skb_orphan(skb);
6056 ++
6057 + /* Enqueue packet */
6058 + skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb);
6059 + dev->trans_start = jiffies;
6060 +diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
6061 +index 5f3b9ea..8a6e027 100644
6062 +--- a/drivers/net/usb/cdc_ether.c
6063 ++++ b/drivers/net/usb/cdc_ether.c
6064 +@@ -433,6 +433,7 @@ static const struct driver_info mbm_info = {
6065 + .bind = cdc_bind,
6066 + .unbind = usbnet_cdc_unbind,
6067 + .status = cdc_status,
6068 ++ .manage_power = cdc_manage_power,
6069 + };
6070 +
6071 + /*-------------------------------------------------------------------------*/
6072 +diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
6073 +index 3d406f9..c60625b 100644
6074 +--- a/drivers/net/usb/dm9601.c
6075 ++++ b/drivers/net/usb/dm9601.c
6076 +@@ -238,7 +238,7 @@ static int dm_write_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 valu
6077 + goto out;
6078 +
6079 + dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg);
6080 +- dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1c : 0x14);
6081 ++ dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1a : 0x12);
6082 +
6083 + for (i = 0; i < DM_TIMEOUT; i++) {
6084 + u8 tmp;
6085 +diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
6086 +index b9b9d6b..941f053 100644
6087 +--- a/drivers/net/wan/hdlc_ppp.c
6088 ++++ b/drivers/net/wan/hdlc_ppp.c
6089 +@@ -628,9 +628,15 @@ static void ppp_stop(struct net_device *dev)
6090 + ppp_cp_event(dev, PID_LCP, STOP, 0, 0, 0, NULL);
6091 + }
6092 +
6093 ++static void ppp_close(struct net_device *dev)
6094 ++{
6095 ++ ppp_tx_flush();
6096 ++}
6097 ++
6098 + static struct hdlc_proto proto = {
6099 + .start = ppp_start,
6100 + .stop = ppp_stop,
6101 ++ .close = ppp_close,
6102 + .type_trans = ppp_type_trans,
6103 + .ioctl = ppp_ioctl,
6104 + .netif_rx = ppp_rx,
6105 +diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
6106 +index 7b1eab4..e55f718 100644
6107 +--- a/drivers/net/wireless/ath/ath9k/main.c
6108 ++++ b/drivers/net/wireless/ath/ath9k/main.c
6109 +@@ -1358,9 +1358,9 @@ void ath_cleanup(struct ath_softc *sc)
6110 + free_irq(sc->irq, sc);
6111 + ath_bus_cleanup(common);
6112 + kfree(sc->sec_wiphy);
6113 +- ieee80211_free_hw(sc->hw);
6114 +
6115 + ath9k_uninit_hw(sc);
6116 ++ ieee80211_free_hw(sc->hw);
6117 + }
6118 +
6119 + static int ath9k_reg_notifier(struct wiphy *wiphy,
6120 +diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
6121 +index 4bf4c21..41d33cd 100644
6122 +--- a/drivers/net/wireless/p54/p54pci.c
6123 ++++ b/drivers/net/wireless/p54/p54pci.c
6124 +@@ -245,7 +245,7 @@ static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index,
6125 + u32 idx, i;
6126 +
6127 + i = (*index) % ring_limit;
6128 +- (*index) = idx = le32_to_cpu(ring_control->device_idx[1]);
6129 ++ (*index) = idx = le32_to_cpu(ring_control->device_idx[ring_index]);
6130 + idx %= ring_limit;
6131 +
6132 + while (i != idx) {
6133 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
6134 +index 8742640..b3c4fbd 100644
6135 +--- a/drivers/net/wireless/p54/p54usb.c
6136 ++++ b/drivers/net/wireless/p54/p54usb.c
6137 +@@ -36,6 +36,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
6138 + /* Version 1 devices (pci chip + net2280) */
6139 + {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */
6140 + {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */
6141 ++ {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */
6142 + {USB_DEVICE(0x083a, 0x4501)}, /* Accton 802.11g WN4501 USB */
6143 + {USB_DEVICE(0x083a, 0x4502)}, /* Siemens Gigaset USB Adapter */
6144 + {USB_DEVICE(0x083a, 0x5501)}, /* Phillips CPWUA054 */
6145 +diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
6146 +index b6dda2b..9d147de 100644
6147 +--- a/drivers/net/wireless/p54/txrx.c
6148 ++++ b/drivers/net/wireless/p54/txrx.c
6149 +@@ -186,7 +186,7 @@ static int p54_tx_qos_accounting_alloc(struct p54_common *priv,
6150 + struct ieee80211_tx_queue_stats *queue;
6151 + unsigned long flags;
6152 +
6153 +- if (WARN_ON(p54_queue > P54_QUEUE_NUM))
6154 ++ if (WARN_ON(p54_queue >= P54_QUEUE_NUM))
6155 + return -EINVAL;
6156 +
6157 + queue = &priv->tx_stats[p54_queue];
6158 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
6159 +index c4fead1..b8eb5e7 100644
6160 +--- a/drivers/pci/pci.c
6161 ++++ b/drivers/pci/pci.c
6162 +@@ -624,7 +624,7 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
6163 + */
6164 + int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
6165 + {
6166 +- return state > PCI_D0 ?
6167 ++ return state >= PCI_D0 ?
6168 + pci_platform_power_transition(dev, state) : -EINVAL;
6169 + }
6170 + EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
6171 +@@ -661,10 +661,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
6172 + */
6173 + return 0;
6174 +
6175 +- /* Check if we're already there */
6176 +- if (dev->current_state == state)
6177 +- return 0;
6178 +-
6179 + __pci_start_power_transition(dev, state);
6180 +
6181 + /* This device is quirked not to be put into D3, so
6182 +diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
6183 +index e6b67f2..741672f 100644
6184 +--- a/drivers/scsi/libiscsi.c
6185 ++++ b/drivers/scsi/libiscsi.c
6186 +@@ -470,12 +470,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
6187 +
6188 + WARN_ON(hdrlength >= 256);
6189 + hdr->hlength = hdrlength & 0xFF;
6190 ++ hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
6191 +
6192 + if (session->tt->init_task && session->tt->init_task(task))
6193 + return -EIO;
6194 +
6195 + task->state = ISCSI_TASK_RUNNING;
6196 +- hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
6197 + session->cmdsn++;
6198 +
6199 + conn->scsicmd_pdus_cnt++;
6200 +diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
6201 +index e155011..816ab97 100644
6202 +--- a/drivers/scsi/libsas/sas_ata.c
6203 ++++ b/drivers/scsi/libsas/sas_ata.c
6204 +@@ -394,11 +394,15 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
6205 + void sas_ata_task_abort(struct sas_task *task)
6206 + {
6207 + struct ata_queued_cmd *qc = task->uldd_task;
6208 ++ struct request_queue *q = qc->scsicmd->device->request_queue;
6209 + struct completion *waiting;
6210 ++ unsigned long flags;
6211 +
6212 + /* Bounce SCSI-initiated commands to the SCSI EH */
6213 + if (qc->scsicmd) {
6214 ++ spin_lock_irqsave(q->queue_lock, flags);
6215 + blk_abort_request(qc->scsicmd->request);
6216 ++ spin_unlock_irqrestore(q->queue_lock, flags);
6217 + scsi_schedule_eh(qc->scsicmd->device->host);
6218 + return;
6219 + }
6220 +diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
6221 +index 14b1319..b672d10 100644
6222 +--- a/drivers/scsi/libsas/sas_scsi_host.c
6223 ++++ b/drivers/scsi/libsas/sas_scsi_host.c
6224 +@@ -1029,6 +1029,8 @@ int __sas_task_abort(struct sas_task *task)
6225 + void sas_task_abort(struct sas_task *task)
6226 + {
6227 + struct scsi_cmnd *sc = task->uldd_task;
6228 ++ struct request_queue *q = sc->device->request_queue;
6229 ++ unsigned long flags;
6230 +
6231 + /* Escape for libsas internal commands */
6232 + if (!sc) {
6233 +@@ -1043,7 +1045,9 @@ void sas_task_abort(struct sas_task *task)
6234 + return;
6235 + }
6236 +
6237 ++ spin_lock_irqsave(q->queue_lock, flags);
6238 + blk_abort_request(sc->request);
6239 ++ spin_unlock_irqrestore(q->queue_lock, flags);
6240 + scsi_schedule_eh(sc->device->host);
6241 + }
6242 +
6243 +diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
6244 +index 0b575c8..aa2a2dc 100644
6245 +--- a/drivers/scsi/scsi_debug.c
6246 ++++ b/drivers/scsi/scsi_debug.c
6247 +@@ -956,7 +956,8 @@ static int resp_start_stop(struct scsi_cmnd * scp,
6248 + static sector_t get_sdebug_capacity(void)
6249 + {
6250 + if (scsi_debug_virtual_gb > 0)
6251 +- return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb;
6252 ++ return (sector_t)scsi_debug_virtual_gb *
6253 ++ (1073741824 / scsi_debug_sector_size);
6254 + else
6255 + return sdebug_store_sectors;
6256 + }
6257 +diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
6258 +index 08ed506..e46155b 100644
6259 +--- a/drivers/scsi/scsi_error.c
6260 ++++ b/drivers/scsi/scsi_error.c
6261 +@@ -301,7 +301,20 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
6262 + if (scmd->device->allow_restart &&
6263 + (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
6264 + return FAILED;
6265 +- return SUCCESS;
6266 ++
6267 ++ if (blk_barrier_rq(scmd->request))
6268 ++ /*
6269 ++ * barrier requests should always retry on UA
6270 ++ * otherwise block will get a spurious error
6271 ++ */
6272 ++ return NEEDS_RETRY;
6273 ++ else
6274 ++ /*
6275 ++ * for normal (non barrier) commands, pass the
6276 ++ * UA upwards for a determination in the
6277 ++ * completion functions
6278 ++ */
6279 ++ return SUCCESS;
6280 +
6281 + /* these three are not supported */
6282 + case COPY_ABORTED:
6283 +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
6284 +index c664242..5697709 100644
6285 +--- a/drivers/scsi/scsi_lib.c
6286 ++++ b/drivers/scsi/scsi_lib.c
6287 +@@ -773,8 +773,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
6288 + * we already took a copy of the original into rq->errors which
6289 + * is what gets returned to the user
6290 + */
6291 +- if (sense_valid && sshdr.sense_key == RECOVERED_ERROR) {
6292 +- if (!(req->cmd_flags & REQ_QUIET))
6293 ++ if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
6294 ++ /* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
6295 ++ * print since caller wants ATA registers. Only occurs on
6296 ++ * SCSI ATA PASS_THROUGH commands when CK_COND=1
6297 ++ */
6298 ++ if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
6299 ++ ;
6300 ++ else if (!(req->cmd_flags & REQ_QUIET))
6301 + scsi_print_sense("", cmd);
6302 + result = 0;
6303 + /* BLOCK_PC may have set error */
6304 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
6305 +index 255da53..bf15920 100644
6306 +--- a/drivers/scsi/sd.c
6307 ++++ b/drivers/scsi/sd.c
6308 +@@ -1039,6 +1039,7 @@ static void sd_prepare_flush(struct request_queue *q, struct request *rq)
6309 + {
6310 + rq->cmd_type = REQ_TYPE_BLOCK_PC;
6311 + rq->timeout = SD_TIMEOUT;
6312 ++ rq->retries = SD_MAX_RETRIES;
6313 + rq->cmd[0] = SYNCHRONIZE_CACHE;
6314 + rq->cmd_len = 10;
6315 + }
6316 +diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
6317 +index 24485cc..4822cb5 100644
6318 +--- a/drivers/serial/8250_pnp.c
6319 ++++ b/drivers/serial/8250_pnp.c
6320 +@@ -348,6 +348,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
6321 + { "FUJ02E6", 0 },
6322 + /* Fujitsu Wacom 2FGT Tablet PC device */
6323 + { "FUJ02E7", 0 },
6324 ++ /* Fujitsu Wacom 1FGT Tablet PC device */
6325 ++ { "FUJ02E9", 0 },
6326 + /*
6327 + * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
6328 + * disguise)
6329 +diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
6330 +index c2809f2..b12237f 100644
6331 +--- a/drivers/staging/hv/Hv.c
6332 ++++ b/drivers/staging/hv/Hv.c
6333 +@@ -306,9 +306,9 @@ void HvCleanup(void)
6334 + DPRINT_ENTER(VMBUS);
6335 +
6336 + if (gHvContext.SignalEventBuffer) {
6337 ++ kfree(gHvContext.SignalEventBuffer);
6338 + gHvContext.SignalEventBuffer = NULL;
6339 + gHvContext.SignalEventParam = NULL;
6340 +- kfree(gHvContext.SignalEventBuffer);
6341 + }
6342 +
6343 + if (gHvContext.GuestId == HV_LINUX_GUEST_ID) {
6344 +diff --git a/drivers/staging/hv/RndisFilter.c b/drivers/staging/hv/RndisFilter.c
6345 +index 26d7997..f05f4e1 100644
6346 +--- a/drivers/staging/hv/RndisFilter.c
6347 ++++ b/drivers/staging/hv/RndisFilter.c
6348 +@@ -756,6 +756,7 @@ static int RndisFilterOpenDevice(struct rndis_device *Device)
6349 +
6350 + ret = RndisFilterSetPacketFilter(Device,
6351 + NDIS_PACKET_TYPE_BROADCAST |
6352 ++ NDIS_PACKET_TYPE_ALL_MULTICAST |
6353 + NDIS_PACKET_TYPE_DIRECTED);
6354 + if (ret == 0)
6355 + Device->State = RNDIS_DEV_DATAINITIALIZED;
6356 +diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
6357 +index 0d7459e..4c3c8bc 100644
6358 +--- a/drivers/staging/hv/netvsc_drv.c
6359 ++++ b/drivers/staging/hv/netvsc_drv.c
6360 +@@ -413,8 +413,7 @@ static int netvsc_probe(struct device *device)
6361 + if (!net_drv_obj->Base.OnDeviceAdd)
6362 + return -1;
6363 +
6364 +- net = alloc_netdev(sizeof(struct net_device_context), "seth%d",
6365 +- ether_setup);
6366 ++ net = alloc_etherdev(sizeof(struct net_device_context));
6367 + if (!net)
6368 + return -1;
6369 +
6370 +diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
6371 +index 6da1021..a2566f1 100644
6372 +--- a/drivers/staging/usbip/usbip_event.c
6373 ++++ b/drivers/staging/usbip/usbip_event.c
6374 +@@ -117,6 +117,9 @@ void usbip_stop_eh(struct usbip_device *ud)
6375 + {
6376 + struct usbip_task *eh = &ud->eh;
6377 +
6378 ++ if (eh->thread == current)
6379 ++ return; /* do not wait for myself */
6380 ++
6381 + wait_for_completion(&eh->thread_done);
6382 + usbip_dbg_eh("usbip_eh has finished\n");
6383 + }
6384 +diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
6385 +index ca479a7..d9d0bf5 100644
6386 +--- a/drivers/usb/core/driver.c
6387 ++++ b/drivers/usb/core/driver.c
6388 +@@ -1255,9 +1255,8 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
6389 + udev->state == USB_STATE_SUSPENDED)
6390 + goto done;
6391 +
6392 +- udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
6393 +-
6394 + if (msg.event & PM_EVENT_AUTO) {
6395 ++ udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
6396 + status = autosuspend_check(udev, 0);
6397 + if (status < 0)
6398 + goto done;
6399 +@@ -1789,6 +1788,34 @@ int usb_external_resume_device(struct usb_device *udev, pm_message_t msg)
6400 + return status;
6401 + }
6402 +
6403 ++static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
6404 ++{
6405 ++ int w, i;
6406 ++ struct usb_interface *intf;
6407 ++
6408 ++ /* Remote wakeup is needed only when we actually go to sleep.
6409 ++ * For things like FREEZE and QUIESCE, if the device is already
6410 ++ * autosuspended then its current wakeup setting is okay.
6411 ++ */
6412 ++ if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_QUIESCE) {
6413 ++ udev->do_remote_wakeup = 0;
6414 ++ return;
6415 ++ }
6416 ++
6417 ++ /* If remote wakeup is permitted, see whether any interface drivers
6418 ++ * actually want it.
6419 ++ */
6420 ++ w = 0;
6421 ++ if (device_may_wakeup(&udev->dev) && udev->actconfig) {
6422 ++ for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
6423 ++ intf = udev->actconfig->interface[i];
6424 ++ w |= intf->needs_remote_wakeup;
6425 ++ }
6426 ++ }
6427 ++
6428 ++ udev->do_remote_wakeup = w;
6429 ++}
6430 ++
6431 + int usb_suspend(struct device *dev, pm_message_t msg)
6432 + {
6433 + struct usb_device *udev;
6434 +@@ -1808,6 +1835,7 @@ int usb_suspend(struct device *dev, pm_message_t msg)
6435 + }
6436 +
6437 + udev->skip_sys_resume = 0;
6438 ++ choose_wakeup(udev, msg);
6439 + return usb_external_suspend_device(udev, msg);
6440 + }
6441 +
6442 +diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
6443 +index bdf87a8..2c95153 100644
6444 +--- a/drivers/usb/core/generic.c
6445 ++++ b/drivers/usb/core/generic.c
6446 +@@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
6447 + * than a vendor-specific driver. */
6448 + else if (udev->descriptor.bDeviceClass !=
6449 + USB_CLASS_VENDOR_SPEC &&
6450 +- (!desc || desc->bInterfaceClass !=
6451 ++ (desc && desc->bInterfaceClass !=
6452 + USB_CLASS_VENDOR_SPEC)) {
6453 + best = c;
6454 + break;
6455 +diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
6456 +index 97b40ce..4a6366a 100644
6457 +--- a/drivers/usb/core/inode.c
6458 ++++ b/drivers/usb/core/inode.c
6459 +@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
6460 + *dentry = NULL;
6461 + mutex_lock(&parent->d_inode->i_mutex);
6462 + *dentry = lookup_one_len(name, parent, strlen(name));
6463 +- if (!IS_ERR(dentry)) {
6464 ++ if (!IS_ERR(*dentry)) {
6465 + if ((mode & S_IFMT) == S_IFDIR)
6466 + error = usbfs_mkdir (parent->d_inode, *dentry, mode);
6467 + else
6468 + error = usbfs_create (parent->d_inode, *dentry, mode);
6469 + } else
6470 +- error = PTR_ERR(dentry);
6471 ++ error = PTR_ERR(*dentry);
6472 + mutex_unlock(&parent->d_inode->i_mutex);
6473 +
6474 + return error;
6475 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
6476 +index 9bc95fe..1a48aac 100644
6477 +--- a/drivers/usb/core/message.c
6478 ++++ b/drivers/usb/core/message.c
6479 +@@ -1471,7 +1471,7 @@ int usb_reset_configuration(struct usb_device *dev)
6480 + /* If not, reinstate the old alternate settings */
6481 + if (retval < 0) {
6482 + reset_old_alts:
6483 +- for (; i >= 0; i--) {
6484 ++ for (i--; i >= 0; i--) {
6485 + struct usb_interface *intf = config->interface[i];
6486 + struct usb_host_interface *alt;
6487 +
6488 +diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
6489 +index 9c90b67..efa0372 100644
6490 +--- a/drivers/usb/host/ehci-hcd.c
6491 ++++ b/drivers/usb/host/ehci-hcd.c
6492 +@@ -543,6 +543,7 @@ static int ehci_init(struct usb_hcd *hcd)
6493 + */
6494 + ehci->periodic_size = DEFAULT_I_TDPS;
6495 + INIT_LIST_HEAD(&ehci->cached_itd_list);
6496 ++ INIT_LIST_HEAD(&ehci->cached_sitd_list);
6497 + if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
6498 + return retval;
6499 +
6500 +diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
6501 +index aeda96e..1f3f01e 100644
6502 +--- a/drivers/usb/host/ehci-mem.c
6503 ++++ b/drivers/usb/host/ehci-mem.c
6504 +@@ -136,7 +136,7 @@ static inline void qh_put (struct ehci_qh *qh)
6505 +
6506 + static void ehci_mem_cleanup (struct ehci_hcd *ehci)
6507 + {
6508 +- free_cached_itd_list(ehci);
6509 ++ free_cached_lists(ehci);
6510 + if (ehci->async)
6511 + qh_put (ehci->async);
6512 + ehci->async = NULL;
6513 +diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
6514 +index df533ce..2064045 100644
6515 +--- a/drivers/usb/host/ehci-sched.c
6516 ++++ b/drivers/usb/host/ehci-sched.c
6517 +@@ -2137,13 +2137,27 @@ sitd_complete (
6518 + (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
6519 + }
6520 + iso_stream_put (ehci, stream);
6521 +- /* OK to recycle this SITD now that its completion callback ran. */
6522 ++
6523 + done:
6524 + sitd->urb = NULL;
6525 +- sitd->stream = NULL;
6526 +- list_move(&sitd->sitd_list, &stream->free_list);
6527 +- iso_stream_put(ehci, stream);
6528 +-
6529 ++ if (ehci->clock_frame != sitd->frame) {
6530 ++ /* OK to recycle this SITD now. */
6531 ++ sitd->stream = NULL;
6532 ++ list_move(&sitd->sitd_list, &stream->free_list);
6533 ++ iso_stream_put(ehci, stream);
6534 ++ } else {
6535 ++ /* HW might remember this SITD, so we can't recycle it yet.
6536 ++ * Move it to a safe place until a new frame starts.
6537 ++ */
6538 ++ list_move(&sitd->sitd_list, &ehci->cached_sitd_list);
6539 ++ if (stream->refcount == 2) {
6540 ++ /* If iso_stream_put() were called here, stream
6541 ++ * would be freed. Instead, just prevent reuse.
6542 ++ */
6543 ++ stream->ep->hcpriv = NULL;
6544 ++ stream->ep = NULL;
6545 ++ }
6546 ++ }
6547 + return retval;
6548 + }
6549 +
6550 +@@ -2209,9 +2223,10 @@ done:
6551 +
6552 + /*-------------------------------------------------------------------------*/
6553 +
6554 +-static void free_cached_itd_list(struct ehci_hcd *ehci)
6555 ++static void free_cached_lists(struct ehci_hcd *ehci)
6556 + {
6557 + struct ehci_itd *itd, *n;
6558 ++ struct ehci_sitd *sitd, *sn;
6559 +
6560 + list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
6561 + struct ehci_iso_stream *stream = itd->stream;
6562 +@@ -2219,6 +2234,13 @@ static void free_cached_itd_list(struct ehci_hcd *ehci)
6563 + list_move(&itd->itd_list, &stream->free_list);
6564 + iso_stream_put(ehci, stream);
6565 + }
6566 ++
6567 ++ list_for_each_entry_safe(sitd, sn, &ehci->cached_sitd_list, sitd_list) {
6568 ++ struct ehci_iso_stream *stream = sitd->stream;
6569 ++ sitd->stream = NULL;
6570 ++ list_move(&sitd->sitd_list, &stream->free_list);
6571 ++ iso_stream_put(ehci, stream);
6572 ++ }
6573 + }
6574 +
6575 + /*-------------------------------------------------------------------------*/
6576 +@@ -2245,7 +2267,7 @@ scan_periodic (struct ehci_hcd *ehci)
6577 + clock_frame = -1;
6578 + }
6579 + if (ehci->clock_frame != clock_frame) {
6580 +- free_cached_itd_list(ehci);
6581 ++ free_cached_lists(ehci);
6582 + ehci->clock_frame = clock_frame;
6583 + }
6584 + clock %= mod;
6585 +@@ -2408,7 +2430,7 @@ restart:
6586 + clock = now;
6587 + clock_frame = clock >> 3;
6588 + if (ehci->clock_frame != clock_frame) {
6589 +- free_cached_itd_list(ehci);
6590 ++ free_cached_lists(ehci);
6591 + ehci->clock_frame = clock_frame;
6592 + }
6593 + } else {
6594 +diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
6595 +index b1dce96..556c0b4 100644
6596 +--- a/drivers/usb/host/ehci.h
6597 ++++ b/drivers/usb/host/ehci.h
6598 +@@ -87,8 +87,9 @@ struct ehci_hcd { /* one per controller */
6599 + int next_uframe; /* scan periodic, start here */
6600 + unsigned periodic_sched; /* periodic activity count */
6601 +
6602 +- /* list of itds completed while clock_frame was still active */
6603 ++ /* list of itds & sitds completed while clock_frame was still active */
6604 + struct list_head cached_itd_list;
6605 ++ struct list_head cached_sitd_list;
6606 + unsigned clock_frame;
6607 +
6608 + /* per root hub port */
6609 +@@ -195,7 +196,7 @@ timer_action_done (struct ehci_hcd *ehci, enum ehci_timer_action action)
6610 + clear_bit (action, &ehci->actions);
6611 + }
6612 +
6613 +-static void free_cached_itd_list(struct ehci_hcd *ehci);
6614 ++static void free_cached_lists(struct ehci_hcd *ehci);
6615 +
6616 + /*-------------------------------------------------------------------------*/
6617 +
6618 +diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
6619 +index 32bbce9..65cac8c 100644
6620 +--- a/drivers/usb/host/ohci-hub.c
6621 ++++ b/drivers/usb/host/ohci-hub.c
6622 +@@ -697,7 +697,7 @@ static int ohci_hub_control (
6623 + u16 wLength
6624 + ) {
6625 + struct ohci_hcd *ohci = hcd_to_ohci (hcd);
6626 +- int ports = hcd_to_bus (hcd)->root_hub->maxchild;
6627 ++ int ports = ohci->num_ports;
6628 + u32 temp;
6629 + int retval = 0;
6630 +
6631 +diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
6632 +index bffcef7..6c1f673 100644
6633 +--- a/drivers/usb/host/xhci-mem.c
6634 ++++ b/drivers/usb/host/xhci-mem.c
6635 +@@ -549,6 +549,19 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
6636 + return EP_INTERVAL(interval);
6637 + }
6638 +
6639 ++/* The "Mult" field in the endpoint context is only set for SuperSpeed devices.
6640 ++ * High speed endpoint descriptors can define "the number of additional
6641 ++ * transaction opportunities per microframe", but that goes in the Max Burst
6642 ++ * endpoint context field.
6643 ++ */
6644 ++static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
6645 ++ struct usb_host_endpoint *ep)
6646 ++{
6647 ++ if (udev->speed != USB_SPEED_SUPER || !ep->ss_ep_comp)
6648 ++ return 0;
6649 ++ return ep->ss_ep_comp->desc.bmAttributes;
6650 ++}
6651 ++
6652 + static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
6653 + struct usb_host_endpoint *ep)
6654 + {
6655 +@@ -579,6 +592,36 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
6656 + return type;
6657 + }
6658 +
6659 ++/* Return the maximum endpoint service interval time (ESIT) payload.
6660 ++ * Basically, this is the maxpacket size, multiplied by the burst size
6661 ++ * and mult size.
6662 ++ */
6663 ++static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
6664 ++ struct usb_device *udev,
6665 ++ struct usb_host_endpoint *ep)
6666 ++{
6667 ++ int max_burst;
6668 ++ int max_packet;
6669 ++
6670 ++ /* Only applies for interrupt or isochronous endpoints */
6671 ++ if (usb_endpoint_xfer_control(&ep->desc) ||
6672 ++ usb_endpoint_xfer_bulk(&ep->desc))
6673 ++ return 0;
6674 ++
6675 ++ if (udev->speed == USB_SPEED_SUPER) {
6676 ++ if (ep->ss_ep_comp)
6677 ++ return ep->ss_ep_comp->desc.wBytesPerInterval;
6678 ++ xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n");
6679 ++ /* Assume no bursts, no multiple opportunities to send. */
6680 ++ return ep->desc.wMaxPacketSize;
6681 ++ }
6682 ++
6683 ++ max_packet = ep->desc.wMaxPacketSize & 0x3ff;
6684 ++ max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
6685 ++ /* A 0 in max burst means 1 transfer per ESIT */
6686 ++ return max_packet * (max_burst + 1);
6687 ++}
6688 ++
6689 + int xhci_endpoint_init(struct xhci_hcd *xhci,
6690 + struct xhci_virt_device *virt_dev,
6691 + struct usb_device *udev,
6692 +@@ -590,6 +633,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
6693 + struct xhci_ring *ep_ring;
6694 + unsigned int max_packet;
6695 + unsigned int max_burst;
6696 ++ u32 max_esit_payload;
6697 +
6698 + ep_index = xhci_get_endpoint_index(&ep->desc);
6699 + ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
6700 +@@ -611,6 +655,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
6701 + ep_ctx->deq = ep_ring->first_seg->dma | ep_ring->cycle_state;
6702 +
6703 + ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep);
6704 ++ ep_ctx->ep_info |= EP_MULT(xhci_get_endpoint_mult(udev, ep));
6705 +
6706 + /* FIXME dig Mult and streams info out of ep companion desc */
6707 +
6708 +@@ -656,6 +701,26 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
6709 + default:
6710 + BUG();
6711 + }
6712 ++ max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
6713 ++ ep_ctx->tx_info = MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload);
6714 ++
6715 ++ /*
6716 ++ * XXX no idea how to calculate the average TRB buffer length for bulk
6717 ++ * endpoints, as the driver gives us no clue how big each scatter gather
6718 ++ * list entry (or buffer) is going to be.
6719 ++ *
6720 ++ * For isochronous and interrupt endpoints, we set it to the max
6721 ++ * available, until we have new API in the USB core to allow drivers to
6722 ++ * declare how much bandwidth they actually need.
6723 ++ *
6724 ++ * Normally, it would be calculated by taking the total of the buffer
6725 ++ * lengths in the TD and then dividing by the number of TRBs in a TD,
6726 ++ * including link TRBs, No-op TRBs, and Event data TRBs. Since we don't
6727 ++ * use Event Data TRBs, and we don't chain in a link TRB on short
6728 ++ * transfers, we're basically dividing by 1.
6729 ++ */
6730 ++ ep_ctx->tx_info |= AVG_TRB_LENGTH_FOR_EP(max_esit_payload);
6731 ++
6732 + /* FIXME Debug endpoint context */
6733 + return 0;
6734 + }
6735 +diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
6736 +index 8778135..9e904a6 100644
6737 +--- a/drivers/usb/host/xhci.h
6738 ++++ b/drivers/usb/host/xhci.h
6739 +@@ -609,6 +609,10 @@ struct xhci_ep_ctx {
6740 + #define MAX_PACKET_MASK (0xffff << 16)
6741 + #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)
6742 +
6743 ++/* tx_info bitmasks */
6744 ++#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
6745 ++#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
6746 ++
6747 +
6748 + /**
6749 + * struct xhci_input_control_context
6750 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
6751 +index 0cfd621..a442989 100644
6752 +--- a/drivers/usb/serial/sierra.c
6753 ++++ b/drivers/usb/serial/sierra.c
6754 +@@ -229,6 +229,7 @@ static const struct sierra_iface_info direct_ip_interface_blacklist = {
6755 + static struct usb_device_id id_table [] = {
6756 + { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */
6757 + { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */
6758 ++ { USB_DEVICE(0x03F0, 0x211D) }, /* HP ev2210 a.k.a MC5725 */
6759 + { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */
6760 +
6761 + { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
6762 +diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
6763 +index 1ed3d55..17726a0 100644
6764 +--- a/drivers/w1/slaves/w1_therm.c
6765 ++++ b/drivers/w1/slaves/w1_therm.c
6766 +@@ -115,9 +115,8 @@ static struct w1_therm_family_converter w1_therm_families[] = {
6767 +
6768 + static inline int w1_DS18B20_convert_temp(u8 rom[9])
6769 + {
6770 +- int t = ((s16)rom[1] << 8) | rom[0];
6771 +- t = t*1000/16;
6772 +- return t;
6773 ++ s16 t = le16_to_cpup((__le16 *)rom);
6774 ++ return t*1000/16;
6775 + }
6776 +
6777 + static inline int w1_DS18S20_convert_temp(u8 rom[9])
6778 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
6779 +index c568779..cae75c1 100644
6780 +--- a/fs/ext4/extents.c
6781 ++++ b/fs/ext4/extents.c
6782 +@@ -3767,7 +3767,6 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
6783 + __u64 start, __u64 len)
6784 + {
6785 + ext4_lblk_t start_blk;
6786 +- ext4_lblk_t len_blks;
6787 + int error = 0;
6788 +
6789 + /* fallback to generic here if not in extents fmt */
6790 +@@ -3781,8 +3780,14 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
6791 + if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) {
6792 + error = ext4_xattr_fiemap(inode, fieinfo);
6793 + } else {
6794 ++ ext4_lblk_t len_blks;
6795 ++ __u64 last_blk;
6796 ++
6797 + start_blk = start >> inode->i_sb->s_blocksize_bits;
6798 +- len_blks = len >> inode->i_sb->s_blocksize_bits;
6799 ++ last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits;
6800 ++ if (last_blk >= EXT_MAX_BLOCK)
6801 ++ last_blk = EXT_MAX_BLOCK-1;
6802 ++ len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1;
6803 +
6804 + /*
6805 + * Walk the extent tree gathering extent information.
6806 +diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
6807 +index 7f24a0b..1aba003 100644
6808 +--- a/fs/jfs/resize.c
6809 ++++ b/fs/jfs/resize.c
6810 +@@ -81,6 +81,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
6811 + struct inode *iplist[1];
6812 + struct jfs_superblock *j_sb, *j_sb2;
6813 + uint old_agsize;
6814 ++ int agsizechanged = 0;
6815 + struct buffer_head *bh, *bh2;
6816 +
6817 + /* If the volume hasn't grown, get out now */
6818 +@@ -333,6 +334,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
6819 + */
6820 + if ((rc = dbExtendFS(ipbmap, XAddress, nblocks)))
6821 + goto error_out;
6822 ++
6823 ++ agsizechanged |= (bmp->db_agsize != old_agsize);
6824 ++
6825 + /*
6826 + * the map now has extended to cover additional nblocks:
6827 + * dn_mapsize = oldMapsize + nblocks;
6828 +@@ -432,7 +436,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
6829 + * will correctly identify the new ag);
6830 + */
6831 + /* if new AG size the same as old AG size, done! */
6832 +- if (bmp->db_agsize != old_agsize) {
6833 ++ if (agsizechanged) {
6834 + if ((rc = diExtendFS(ipimap, ipbmap)))
6835 + goto error_out;
6836 +
6837 +diff --git a/fs/nfs/client.c b/fs/nfs/client.c
6838 +index bd39abc..37d555c 100644
6839 +--- a/fs/nfs/client.c
6840 ++++ b/fs/nfs/client.c
6841 +@@ -965,6 +965,8 @@ out_error:
6842 + static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
6843 + {
6844 + target->flags = source->flags;
6845 ++ target->rsize = source->rsize;
6846 ++ target->wsize = source->wsize;
6847 + target->acregmin = source->acregmin;
6848 + target->acregmax = source->acregmax;
6849 + target->acdirmin = source->acdirmin;
6850 +diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
6851 +index af6948d..b5d55d3 100644
6852 +--- a/fs/nfs/dir.c
6853 ++++ b/fs/nfs/dir.c
6854 +@@ -837,6 +837,8 @@ out_zap_parent:
6855 + /* If we have submounts, don't unhash ! */
6856 + if (have_submounts(dentry))
6857 + goto out_valid;
6858 ++ if (dentry->d_flags & DCACHE_DISCONNECTED)
6859 ++ goto out_valid;
6860 + shrink_dcache_parent(dentry);
6861 + }
6862 + d_drop(dentry);
6863 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
6864 +index bbf72d8..718f3fb 100644
6865 +--- a/fs/nfsd/nfs4xdr.c
6866 ++++ b/fs/nfsd/nfs4xdr.c
6867 +@@ -160,10 +160,10 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
6868 + argp->p = page_address(argp->pagelist[0]);
6869 + argp->pagelist++;
6870 + if (argp->pagelen < PAGE_SIZE) {
6871 +- argp->end = p + (argp->pagelen>>2);
6872 ++ argp->end = argp->p + (argp->pagelen>>2);
6873 + argp->pagelen = 0;
6874 + } else {
6875 +- argp->end = p + (PAGE_SIZE>>2);
6876 ++ argp->end = argp->p + (PAGE_SIZE>>2);
6877 + argp->pagelen -= PAGE_SIZE;
6878 + }
6879 + memcpy(((char*)p)+avail, argp->p, (nbytes - avail));
6880 +@@ -1425,10 +1425,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
6881 + argp->p = page_address(argp->pagelist[0]);
6882 + argp->pagelist++;
6883 + if (argp->pagelen < PAGE_SIZE) {
6884 +- argp->end = p + (argp->pagelen>>2);
6885 ++ argp->end = argp->p + (argp->pagelen>>2);
6886 + argp->pagelen = 0;
6887 + } else {
6888 +- argp->end = p + (PAGE_SIZE>>2);
6889 ++ argp->end = argp->p + (PAGE_SIZE>>2);
6890 + argp->pagelen -= PAGE_SIZE;
6891 + }
6892 + }
6893 +diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
6894 +index 21c808f..b18c6d6 100644
6895 +--- a/fs/ocfs2/buffer_head_io.c
6896 ++++ b/fs/ocfs2/buffer_head_io.c
6897 +@@ -407,6 +407,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
6898 + struct buffer_head *bh)
6899 + {
6900 + int ret = 0;
6901 ++ struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
6902 +
6903 + mlog_entry_void();
6904 +
6905 +@@ -426,6 +427,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
6906 +
6907 + get_bh(bh); /* for end_buffer_write_sync() */
6908 + bh->b_end_io = end_buffer_write_sync;
6909 ++ ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check);
6910 + submit_bh(WRITE, bh);
6911 +
6912 + wait_on_buffer(bh);
6913 +diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
6914 +index 02bf178..18bc101 100644
6915 +--- a/fs/ocfs2/dlm/dlmfs.c
6916 ++++ b/fs/ocfs2/dlm/dlmfs.c
6917 +@@ -205,7 +205,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
6918 + if ((count + *ppos) > i_size_read(inode))
6919 + readlen = i_size_read(inode) - *ppos;
6920 + else
6921 +- readlen = count - *ppos;
6922 ++ readlen = count;
6923 +
6924 + lvb_buf = kmalloc(readlen, GFP_NOFS);
6925 + if (!lvb_buf)
6926 +diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
6927 +index 88459bd..ec4d97f 100644
6928 +--- a/fs/ocfs2/inode.c
6929 ++++ b/fs/ocfs2/inode.c
6930 +@@ -559,6 +559,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
6931 + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
6932 + if (IS_ERR(handle)) {
6933 + status = PTR_ERR(handle);
6934 ++ handle = NULL;
6935 + mlog_errno(status);
6936 + goto out;
6937 + }
6938 +diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
6939 +index 8ae65c9..a8e8572 100644
6940 +--- a/fs/ocfs2/refcounttree.c
6941 ++++ b/fs/ocfs2/refcounttree.c
6942 +@@ -4083,6 +4083,9 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
6943 + di->i_attr = s_di->i_attr;
6944 +
6945 + if (preserve) {
6946 ++ t_inode->i_uid = s_inode->i_uid;
6947 ++ t_inode->i_gid = s_inode->i_gid;
6948 ++ t_inode->i_mode = s_inode->i_mode;
6949 + di->i_uid = s_di->i_uid;
6950 + di->i_gid = s_di->i_gid;
6951 + di->i_mode = s_di->i_mode;
6952 +diff --git a/fs/proc/base.c b/fs/proc/base.c
6953 +index 3cd449d..8dce96c 100644
6954 +--- a/fs/proc/base.c
6955 ++++ b/fs/proc/base.c
6956 +@@ -2910,7 +2910,7 @@ out_no_task:
6957 + */
6958 + static const struct pid_entry tid_base_stuff[] = {
6959 + DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
6960 +- DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fd_operations),
6961 ++ DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations),
6962 + REG("environ", S_IRUSR, proc_environ_operations),
6963 + INF("auxv", S_IRUSR, proc_pid_auxv),
6964 + ONE("status", S_IRUGO, proc_pid_status),
6965 +diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
6966 +index c094f58..1e686ee 100644
6967 +--- a/fs/reiserfs/dir.c
6968 ++++ b/fs/reiserfs/dir.c
6969 +@@ -45,8 +45,6 @@ static inline bool is_privroot_deh(struct dentry *dir,
6970 + struct reiserfs_de_head *deh)
6971 + {
6972 + struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root;
6973 +- if (reiserfs_expose_privroot(dir->d_sb))
6974 +- return 0;
6975 + return (dir == dir->d_parent && privroot->d_inode &&
6976 + deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
6977 + }
6978 +diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
6979 +index 81f09fa..0392e82 100644
6980 +--- a/fs/reiserfs/xattr.c
6981 ++++ b/fs/reiserfs/xattr.c
6982 +@@ -557,7 +557,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
6983 + if (!err && new_size < i_size_read(dentry->d_inode)) {
6984 + struct iattr newattrs = {
6985 + .ia_ctime = current_fs_time(inode->i_sb),
6986 +- .ia_size = buffer_size,
6987 ++ .ia_size = new_size,
6988 + .ia_valid = ATTR_SIZE | ATTR_CTIME,
6989 + };
6990 +
6991 +@@ -976,21 +976,13 @@ int reiserfs_permission(struct inode *inode, int mask)
6992 + return generic_permission(inode, mask, NULL);
6993 + }
6994 +
6995 +-/* This will catch lookups from the fs root to .reiserfs_priv */
6996 +-static int
6997 +-xattr_lookup_poison(struct dentry *dentry, struct qstr *q1, struct qstr *name)
6998 ++static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd)
6999 + {
7000 +- struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root;
7001 +- if (container_of(q1, struct dentry, d_name) == priv_root)
7002 +- return -ENOENT;
7003 +- if (q1->len == name->len &&
7004 +- !memcmp(q1->name, name->name, name->len))
7005 +- return 0;
7006 +- return 1;
7007 ++ return -EPERM;
7008 + }
7009 +
7010 + static const struct dentry_operations xattr_lookup_poison_ops = {
7011 +- .d_compare = xattr_lookup_poison,
7012 ++ .d_revalidate = xattr_hide_revalidate,
7013 + };
7014 +
7015 + int reiserfs_lookup_privroot(struct super_block *s)
7016 +@@ -1004,8 +996,7 @@ int reiserfs_lookup_privroot(struct super_block *s)
7017 + strlen(PRIVROOT_NAME));
7018 + if (!IS_ERR(dentry)) {
7019 + REISERFS_SB(s)->priv_root = dentry;
7020 +- if (!reiserfs_expose_privroot(s))
7021 +- s->s_root->d_op = &xattr_lookup_poison_ops;
7022 ++ dentry->d_op = &xattr_lookup_poison_ops;
7023 + if (dentry->d_inode)
7024 + dentry->d_inode->i_flags |= S_PRIVATE;
7025 + } else
7026 +diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
7027 +index 77414db..146d491 100644
7028 +--- a/fs/xfs/linux-2.6/xfs_super.c
7029 ++++ b/fs/xfs/linux-2.6/xfs_super.c
7030 +@@ -1160,6 +1160,7 @@ xfs_fs_put_super(
7031 +
7032 + xfs_unmountfs(mp);
7033 + xfs_freesb(mp);
7034 ++ xfs_inode_shrinker_unregister(mp);
7035 + xfs_icsb_destroy_counters(mp);
7036 + xfs_close_devices(mp);
7037 + xfs_dmops_put(mp);
7038 +@@ -1523,6 +1524,8 @@ xfs_fs_fill_super(
7039 + if (error)
7040 + goto fail_vnrele;
7041 +
7042 ++ xfs_inode_shrinker_register(mp);
7043 ++
7044 + kfree(mtpt);
7045 + return 0;
7046 +
7047 +@@ -1767,6 +1770,7 @@ init_xfs_fs(void)
7048 + goto out_cleanup_procfs;
7049 +
7050 + vfs_initquota();
7051 ++ xfs_inode_shrinker_init();
7052 +
7053 + error = register_filesystem(&xfs_fs_type);
7054 + if (error)
7055 +@@ -1794,6 +1798,7 @@ exit_xfs_fs(void)
7056 + {
7057 + vfs_exitquota();
7058 + unregister_filesystem(&xfs_fs_type);
7059 ++ xfs_inode_shrinker_destroy();
7060 + xfs_sysctl_unregister();
7061 + xfs_cleanup_procfs();
7062 + xfs_buf_terminate();
7063 +diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
7064 +index 6b6b394..57adf2d 100644
7065 +--- a/fs/xfs/linux-2.6/xfs_sync.c
7066 ++++ b/fs/xfs/linux-2.6/xfs_sync.c
7067 +@@ -95,7 +95,8 @@ xfs_inode_ag_walk(
7068 + struct xfs_perag *pag, int flags),
7069 + int flags,
7070 + int tag,
7071 +- int exclusive)
7072 ++ int exclusive,
7073 ++ int *nr_to_scan)
7074 + {
7075 + struct xfs_perag *pag = &mp->m_perag[ag];
7076 + uint32_t first_index;
7077 +@@ -135,7 +136,7 @@ restart:
7078 + if (error == EFSCORRUPTED)
7079 + break;
7080 +
7081 +- } while (1);
7082 ++ } while ((*nr_to_scan)--);
7083 +
7084 + if (skipped) {
7085 + delay(1);
7086 +@@ -153,23 +154,30 @@ xfs_inode_ag_iterator(
7087 + struct xfs_perag *pag, int flags),
7088 + int flags,
7089 + int tag,
7090 +- int exclusive)
7091 ++ int exclusive,
7092 ++ int *nr_to_scan)
7093 + {
7094 + int error = 0;
7095 + int last_error = 0;
7096 + xfs_agnumber_t ag;
7097 ++ int nr;
7098 +
7099 ++ nr = nr_to_scan ? *nr_to_scan : INT_MAX;
7100 + for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) {
7101 + if (!mp->m_perag[ag].pag_ici_init)
7102 + continue;
7103 + error = xfs_inode_ag_walk(mp, ag, execute, flags, tag,
7104 +- exclusive);
7105 ++ exclusive, &nr);
7106 + if (error) {
7107 + last_error = error;
7108 + if (error == EFSCORRUPTED)
7109 + break;
7110 + }
7111 ++ if (nr <= 0)
7112 ++ break;
7113 + }
7114 ++ if (nr_to_scan)
7115 ++ *nr_to_scan = nr;
7116 + return XFS_ERROR(last_error);
7117 + }
7118 +
7119 +@@ -289,7 +297,7 @@ xfs_sync_data(
7120 + ASSERT((flags & ~(SYNC_TRYLOCK|SYNC_WAIT)) == 0);
7121 +
7122 + error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags,
7123 +- XFS_ICI_NO_TAG, 0);
7124 ++ XFS_ICI_NO_TAG, 0, NULL);
7125 + if (error)
7126 + return XFS_ERROR(error);
7127 +
7128 +@@ -311,7 +319,7 @@ xfs_sync_attr(
7129 + ASSERT((flags & ~SYNC_WAIT) == 0);
7130 +
7131 + return xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags,
7132 +- XFS_ICI_NO_TAG, 0);
7133 ++ XFS_ICI_NO_TAG, 0, NULL);
7134 + }
7135 +
7136 + STATIC int
7137 +@@ -679,6 +687,7 @@ __xfs_inode_set_reclaim_tag(
7138 + radix_tree_tag_set(&pag->pag_ici_root,
7139 + XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino),
7140 + XFS_ICI_RECLAIM_TAG);
7141 ++ pag->pag_ici_reclaimable++;
7142 + }
7143 +
7144 + /*
7145 +@@ -710,6 +719,7 @@ __xfs_inode_clear_reclaim_tag(
7146 + {
7147 + radix_tree_tag_clear(&pag->pag_ici_root,
7148 + XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
7149 ++ pag->pag_ici_reclaimable--;
7150 + }
7151 +
7152 + STATIC int
7153 +@@ -770,5 +780,88 @@ xfs_reclaim_inodes(
7154 + int mode)
7155 + {
7156 + return xfs_inode_ag_iterator(mp, xfs_reclaim_inode, mode,
7157 +- XFS_ICI_RECLAIM_TAG, 1);
7158 ++ XFS_ICI_RECLAIM_TAG, 1, NULL);
7159 ++}
7160 ++
7161 ++/*
7162 ++ * Shrinker infrastructure.
7163 ++ *
7164 ++ * This is all far more complex than it needs to be. It adds a global list of
7165 ++ * mounts because the shrinkers can only call a global context. We need to make
7166 ++ * the shrinkers pass a context to avoid the need for global state.
7167 ++ */
7168 ++static LIST_HEAD(xfs_mount_list);
7169 ++static struct rw_semaphore xfs_mount_list_lock;
7170 ++
7171 ++static int
7172 ++xfs_reclaim_inode_shrink(
7173 ++ int nr_to_scan,
7174 ++ gfp_t gfp_mask)
7175 ++{
7176 ++ struct xfs_mount *mp;
7177 ++ xfs_agnumber_t ag;
7178 ++ int reclaimable = 0;
7179 ++
7180 ++ if (nr_to_scan) {
7181 ++ if (!(gfp_mask & __GFP_FS))
7182 ++ return -1;
7183 ++
7184 ++ down_read(&xfs_mount_list_lock);
7185 ++ list_for_each_entry(mp, &xfs_mount_list, m_mplist) {
7186 ++ xfs_inode_ag_iterator(mp, xfs_reclaim_inode, 0,
7187 ++ XFS_ICI_RECLAIM_TAG, 1, &nr_to_scan);
7188 ++ if (nr_to_scan <= 0)
7189 ++ break;
7190 ++ }
7191 ++ up_read(&xfs_mount_list_lock);
7192 ++ }
7193 ++
7194 ++ down_read(&xfs_mount_list_lock);
7195 ++ list_for_each_entry(mp, &xfs_mount_list, m_mplist) {
7196 ++ for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) {
7197 ++
7198 ++ if (!mp->m_perag[ag].pag_ici_init)
7199 ++ continue;
7200 ++ reclaimable += mp->m_perag[ag].pag_ici_reclaimable;
7201 ++ }
7202 ++ }
7203 ++ up_read(&xfs_mount_list_lock);
7204 ++ return reclaimable;
7205 ++}
7206 ++
7207 ++static struct shrinker xfs_inode_shrinker = {
7208 ++ .shrink = xfs_reclaim_inode_shrink,
7209 ++ .seeks = DEFAULT_SEEKS,
7210 ++};
7211 ++
7212 ++void __init
7213 ++xfs_inode_shrinker_init(void)
7214 ++{
7215 ++ init_rwsem(&xfs_mount_list_lock);
7216 ++ register_shrinker(&xfs_inode_shrinker);
7217 ++}
7218 ++
7219 ++void
7220 ++xfs_inode_shrinker_destroy(void)
7221 ++{
7222 ++ ASSERT(list_empty(&xfs_mount_list));
7223 ++ unregister_shrinker(&xfs_inode_shrinker);
7224 ++}
7225 ++
7226 ++void
7227 ++xfs_inode_shrinker_register(
7228 ++ struct xfs_mount *mp)
7229 ++{
7230 ++ down_write(&xfs_mount_list_lock);
7231 ++ list_add_tail(&mp->m_mplist, &xfs_mount_list);
7232 ++ up_write(&xfs_mount_list_lock);
7233 ++}
7234 ++
7235 ++void
7236 ++xfs_inode_shrinker_unregister(
7237 ++ struct xfs_mount *mp)
7238 ++{
7239 ++ down_write(&xfs_mount_list_lock);
7240 ++ list_del(&mp->m_mplist);
7241 ++ up_write(&xfs_mount_list_lock);
7242 + }
7243 +diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h
7244 +index ea932b4..0b28c13 100644
7245 +--- a/fs/xfs/linux-2.6/xfs_sync.h
7246 ++++ b/fs/xfs/linux-2.6/xfs_sync.h
7247 +@@ -54,6 +54,11 @@ void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag,
7248 + int xfs_sync_inode_valid(struct xfs_inode *ip, struct xfs_perag *pag);
7249 + int xfs_inode_ag_iterator(struct xfs_mount *mp,
7250 + int (*execute)(struct xfs_inode *ip, struct xfs_perag *pag, int flags),
7251 +- int flags, int tag, int write_lock);
7252 ++ int flags, int tag, int write_lock, int *nr_to_scan);
7253 ++
7254 ++void xfs_inode_shrinker_init(void);
7255 ++void xfs_inode_shrinker_destroy(void);
7256 ++void xfs_inode_shrinker_register(struct xfs_mount *mp);
7257 ++void xfs_inode_shrinker_unregister(struct xfs_mount *mp);
7258 +
7259 + #endif
7260 +diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
7261 +index 873e07e..145f596 100644
7262 +--- a/fs/xfs/quota/xfs_qm_syscalls.c
7263 ++++ b/fs/xfs/quota/xfs_qm_syscalls.c
7264 +@@ -891,7 +891,8 @@ xfs_qm_dqrele_all_inodes(
7265 + uint flags)
7266 + {
7267 + ASSERT(mp->m_quotainfo);
7268 +- xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags, XFS_ICI_NO_TAG, 0);
7269 ++ xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags,
7270 ++ XFS_ICI_NO_TAG, 0, NULL);
7271 + }
7272 +
7273 + /*------------------------------------------------------------------------*/
7274 +diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
7275 +index 6702bd8..1182604 100644
7276 +--- a/fs/xfs/xfs_ag.h
7277 ++++ b/fs/xfs/xfs_ag.h
7278 +@@ -229,6 +229,7 @@ typedef struct xfs_perag
7279 + int pag_ici_init; /* incore inode cache initialised */
7280 + rwlock_t pag_ici_lock; /* incore inode lock */
7281 + struct radix_tree_root pag_ici_root; /* incore inode cache root */
7282 ++ int pag_ici_reclaimable; /* reclaimable inodes */
7283 + #endif
7284 + } xfs_perag_t;
7285 +
7286 +diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
7287 +index 1df7e45..c95f81a 100644
7288 +--- a/fs/xfs/xfs_mount.h
7289 ++++ b/fs/xfs/xfs_mount.h
7290 +@@ -257,6 +257,7 @@ typedef struct xfs_mount {
7291 + wait_queue_head_t m_wait_single_sync_task;
7292 + __int64_t m_update_flags; /* sb flags we need to update
7293 + on the next remount,rw */
7294 ++ struct list_head m_mplist; /* inode shrinker mount list */
7295 + } xfs_mount_t;
7296 +
7297 + /*
7298 +diff --git a/include/linux/ata.h b/include/linux/ata.h
7299 +index 20f3156..f8bd0f9 100644
7300 +--- a/include/linux/ata.h
7301 ++++ b/include/linux/ata.h
7302 +@@ -1024,8 +1024,8 @@ static inline int ata_ok(u8 status)
7303 +
7304 + static inline int lba_28_ok(u64 block, u32 n_block)
7305 + {
7306 +- /* check the ending block number */
7307 +- return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256);
7308 ++ /* check the ending block number: must be LESS THAN 0x0fffffff */
7309 ++ return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256);
7310 + }
7311 +
7312 + static inline int lba_48_ok(u64 block, u32 n_block)
7313 +diff --git a/include/linux/poison.h b/include/linux/poison.h
7314 +index 2110a81..34066ff 100644
7315 +--- a/include/linux/poison.h
7316 ++++ b/include/linux/poison.h
7317 +@@ -48,6 +48,15 @@
7318 + #define POISON_FREE 0x6b /* for use-after-free poisoning */
7319 + #define POISON_END 0xa5 /* end-byte of poisoning */
7320 +
7321 ++/********** mm/hugetlb.c **********/
7322 ++/*
7323 ++ * Private mappings of hugetlb pages use this poisoned value for
7324 ++ * page->mapping. The core VM should not be doing anything with this mapping
7325 ++ * but futex requires the existence of some page->mapping value even though it
7326 ++ * is unused if PAGE_MAPPING_ANON is set.
7327 ++ */
7328 ++#define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON))
7329 ++
7330 + /********** arch/$ARCH/mm/init.c **********/
7331 + #define POISON_FREE_INITMEM 0xcc
7332 +
7333 +diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
7334 +index 8be5135..2c55a7e 100644
7335 +--- a/include/net/sctp/command.h
7336 ++++ b/include/net/sctp/command.h
7337 +@@ -107,6 +107,7 @@ typedef enum {
7338 + SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
7339 + SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
7340 + SCTP_CMD_SEND_MSG, /* Send the whole use message */
7341 ++ SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
7342 + SCTP_CMD_LAST
7343 + } sctp_verb_t;
7344 +
7345 +diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
7346 +index 78740ec..fa6cde5 100644
7347 +--- a/include/net/sctp/sctp.h
7348 ++++ b/include/net/sctp/sctp.h
7349 +@@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
7350 + int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
7351 + int sctp_inet_listen(struct socket *sock, int backlog);
7352 + void sctp_write_space(struct sock *sk);
7353 ++void sctp_data_ready(struct sock *sk, int len);
7354 + unsigned int sctp_poll(struct file *file, struct socket *sock,
7355 + poll_table *wait);
7356 + void sctp_sock_rfree(struct sk_buff *skb);
7357 +diff --git a/init/initramfs.c b/init/initramfs.c
7358 +index b37d34b..b27d045 100644
7359 +--- a/init/initramfs.c
7360 ++++ b/init/initramfs.c
7361 +@@ -457,7 +457,8 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
7362 + compress_name);
7363 + message = msg_buf;
7364 + }
7365 +- }
7366 ++ } else
7367 ++ error("junk in compressed archive");
7368 + if (state != Reset)
7369 + error("junk in compressed archive");
7370 + this_header = saved_offset + my_inptr;
7371 +diff --git a/kernel/cred.c b/kernel/cred.c
7372 +index 1ed8ca1..099f5e6 100644
7373 +--- a/kernel/cred.c
7374 ++++ b/kernel/cred.c
7375 +@@ -786,8 +786,6 @@ bool creds_are_invalid(const struct cred *cred)
7376 + {
7377 + if (cred->magic != CRED_MAGIC)
7378 + return true;
7379 +- if (atomic_read(&cred->usage) < atomic_read(&cred->subscribers))
7380 +- return true;
7381 + #ifdef CONFIG_SECURITY_SELINUX
7382 + if (selinux_is_enabled()) {
7383 + if ((unsigned long) cred->security < PAGE_SIZE)
7384 +diff --git a/kernel/perf_event.c b/kernel/perf_event.c
7385 +index 32d0ae2..e928e1a 100644
7386 +--- a/kernel/perf_event.c
7387 ++++ b/kernel/perf_event.c
7388 +@@ -4811,7 +4811,7 @@ err_fput_free_put_context:
7389 +
7390 + err_free_put_context:
7391 + if (err < 0)
7392 +- kfree(event);
7393 ++ free_event(event);
7394 +
7395 + err_put_context:
7396 + if (err < 0)
7397 +diff --git a/lib/flex_array.c b/lib/flex_array.c
7398 +index 66eef2e..41b1804 100644
7399 +--- a/lib/flex_array.c
7400 ++++ b/lib/flex_array.c
7401 +@@ -99,7 +99,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total,
7402 + ret->element_size = element_size;
7403 + ret->total_nr_elements = total;
7404 + if (elements_fit_in_base(ret) && !(flags & __GFP_ZERO))
7405 +- memset(ret->parts[0], FLEX_ARRAY_FREE,
7406 ++ memset(&ret->parts[0], FLEX_ARRAY_FREE,
7407 + FLEX_ARRAY_BASE_BYTES_LEFT);
7408 + return ret;
7409 + }
7410 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
7411 +index 2d16fa6..fd9ba95 100644
7412 +--- a/mm/hugetlb.c
7413 ++++ b/mm/hugetlb.c
7414 +@@ -546,6 +546,7 @@ static void free_huge_page(struct page *page)
7415 +
7416 + mapping = (struct address_space *) page_private(page);
7417 + set_page_private(page, 0);
7418 ++ page->mapping = NULL;
7419 + BUG_ON(page_count(page));
7420 + INIT_LIST_HEAD(&page->lru);
7421 +
7422 +@@ -2447,8 +2448,10 @@ retry:
7423 + spin_lock(&inode->i_lock);
7424 + inode->i_blocks += blocks_per_huge_page(h);
7425 + spin_unlock(&inode->i_lock);
7426 +- } else
7427 ++ } else {
7428 + lock_page(page);
7429 ++ page->mapping = HUGETLB_POISON;
7430 ++ }
7431 + }
7432 +
7433 + /*
7434 +diff --git a/mm/memcontrol.c b/mm/memcontrol.c
7435 +index 954032b..dff3379 100644
7436 +--- a/mm/memcontrol.c
7437 ++++ b/mm/memcontrol.c
7438 +@@ -2215,12 +2215,12 @@ int mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
7439 + }
7440 + unlock_page_cgroup(pc);
7441 +
7442 ++ *ptr = mem;
7443 + if (mem) {
7444 +- ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, &mem, false,
7445 ++ ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, ptr, false,
7446 + page);
7447 + css_put(&mem->css);
7448 + }
7449 +- *ptr = mem;
7450 + return ret;
7451 + }
7452 +
7453 +diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
7454 +index bad1c49..72340dd 100644
7455 +--- a/net/ieee802154/af_ieee802154.c
7456 ++++ b/net/ieee802154/af_ieee802154.c
7457 +@@ -147,6 +147,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
7458 + dev_load(sock_net(sk), ifr.ifr_name);
7459 + dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
7460 +
7461 ++ if (!dev)
7462 ++ return -ENODEV;
7463 ++
7464 + if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl)
7465 + ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
7466 +
7467 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
7468 +index 564a0f8..03c55ac 100644
7469 +--- a/net/ipv4/tcp.c
7470 ++++ b/net/ipv4/tcp.c
7471 +@@ -1368,6 +1368,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
7472 + sk_eat_skb(sk, skb, 0);
7473 + if (!desc->count)
7474 + break;
7475 ++ tp->copied_seq = seq;
7476 + }
7477 + tp->copied_seq = seq;
7478 +
7479 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
7480 +index 112c611..16190ca 100644
7481 +--- a/net/ipv4/udp.c
7482 ++++ b/net/ipv4/udp.c
7483 +@@ -471,8 +471,8 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
7484 + if (hslot->count < hslot2->count)
7485 + goto begin;
7486 +
7487 +- result = udp4_lib_lookup2(net, INADDR_ANY, sport,
7488 +- daddr, hnum, dif,
7489 ++ result = udp4_lib_lookup2(net, saddr, sport,
7490 ++ INADDR_ANY, hnum, dif,
7491 + hslot2, slot2);
7492 + }
7493 + rcu_read_unlock();
7494 +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
7495 +index 548a06e..d2ef3a3 100644
7496 +--- a/net/ipv6/tcp_ipv6.c
7497 ++++ b/net/ipv6/tcp_ipv6.c
7498 +@@ -1006,7 +1006,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
7499 + skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len);
7500 +
7501 + t1 = (struct tcphdr *) skb_push(buff, tot_len);
7502 +- skb_reset_transport_header(skb);
7503 ++ skb_reset_transport_header(buff);
7504 +
7505 + /* Swap the send and the receive. */
7506 + memset(t1, 0, sizeof(*t1));
7507 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
7508 +index d9714d2..4f57cd2 100644
7509 +--- a/net/ipv6/udp.c
7510 ++++ b/net/ipv6/udp.c
7511 +@@ -258,8 +258,8 @@ static struct sock *__udp6_lib_lookup(struct net *net,
7512 + if (hslot->count < hslot2->count)
7513 + goto begin;
7514 +
7515 +- result = udp6_lib_lookup2(net, &in6addr_any, sport,
7516 +- daddr, hnum, dif,
7517 ++ result = udp6_lib_lookup2(net, saddr, sport,
7518 ++ &in6addr_any, hnum, dif,
7519 + hslot2, slot2);
7520 + }
7521 + rcu_read_unlock();
7522 +diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
7523 +index 304b0b6..dfdc138 100644
7524 +--- a/net/mac80211/agg-tx.c
7525 ++++ b/net/mac80211/agg-tx.c
7526 +@@ -183,7 +183,6 @@ static void sta_addba_resp_timer_expired(unsigned long data)
7527 + HT_AGG_STATE_REQ_STOP_BA_MSK)) !=
7528 + HT_ADDBA_REQUESTED_MSK) {
7529 + spin_unlock_bh(&sta->lock);
7530 +- *state = HT_AGG_STATE_IDLE;
7531 + #ifdef CONFIG_MAC80211_HT_DEBUG
7532 + printk(KERN_DEBUG "timer expired on tid %d but we are not "
7533 + "(or no longer) expecting addBA response there",
7534 +diff --git a/net/sctp/associola.c b/net/sctp/associola.c
7535 +index df5abbf..99c93ee 100644
7536 +--- a/net/sctp/associola.c
7537 ++++ b/net/sctp/associola.c
7538 +@@ -1194,8 +1194,10 @@ void sctp_assoc_update(struct sctp_association *asoc,
7539 + /* Remove any peer addresses not present in the new association. */
7540 + list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
7541 + trans = list_entry(pos, struct sctp_transport, transports);
7542 +- if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
7543 +- sctp_assoc_del_peer(asoc, &trans->ipaddr);
7544 ++ if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) {
7545 ++ sctp_assoc_rm_peer(asoc, trans);
7546 ++ continue;
7547 ++ }
7548 +
7549 + if (asoc->state >= SCTP_STATE_ESTABLISHED)
7550 + sctp_transport_reset(trans);
7551 +diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
7552 +index 905fda5..7ec09ba 100644
7553 +--- a/net/sctp/endpointola.c
7554 ++++ b/net/sctp/endpointola.c
7555 +@@ -144,6 +144,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
7556 + /* Use SCTP specific send buffer space queues. */
7557 + ep->sndbuf_policy = sctp_sndbuf_policy;
7558 +
7559 ++ sk->sk_data_ready = sctp_data_ready;
7560 + sk->sk_write_space = sctp_write_space;
7561 + sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
7562 +
7563 +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
7564 +index 9e73291..224db01 100644
7565 +--- a/net/sctp/sm_make_chunk.c
7566 ++++ b/net/sctp/sm_make_chunk.c
7567 +@@ -207,7 +207,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
7568 + sp = sctp_sk(asoc->base.sk);
7569 + num_types = sp->pf->supported_addrs(sp, types);
7570 +
7571 +- chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types);
7572 ++ chunksize = sizeof(init) + addrs_len;
7573 ++ chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types));
7574 + chunksize += sizeof(ecap_param);
7575 +
7576 + if (sctp_prsctp_enable)
7577 +@@ -237,14 +238,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
7578 + /* Add HMACS parameter length if any were defined */
7579 + auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
7580 + if (auth_hmacs->length)
7581 +- chunksize += ntohs(auth_hmacs->length);
7582 ++ chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
7583 + else
7584 + auth_hmacs = NULL;
7585 +
7586 + /* Add CHUNKS parameter length */
7587 + auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
7588 + if (auth_chunks->length)
7589 +- chunksize += ntohs(auth_chunks->length);
7590 ++ chunksize += WORD_ROUND(ntohs(auth_chunks->length));
7591 + else
7592 + auth_chunks = NULL;
7593 +
7594 +@@ -254,7 +255,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
7595 +
7596 + /* If we have any extensions to report, account for that */
7597 + if (num_ext)
7598 +- chunksize += sizeof(sctp_supported_ext_param_t) + num_ext;
7599 ++ chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
7600 ++ num_ext);
7601 +
7602 + /* RFC 2960 3.3.2 Initiation (INIT) (1)
7603 + *
7604 +@@ -396,13 +398,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
7605 +
7606 + auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
7607 + if (auth_hmacs->length)
7608 +- chunksize += ntohs(auth_hmacs->length);
7609 ++ chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
7610 + else
7611 + auth_hmacs = NULL;
7612 +
7613 + auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
7614 + if (auth_chunks->length)
7615 +- chunksize += ntohs(auth_chunks->length);
7616 ++ chunksize += WORD_ROUND(ntohs(auth_chunks->length));
7617 + else
7618 + auth_chunks = NULL;
7619 +
7620 +@@ -411,7 +413,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
7621 + }
7622 +
7623 + if (num_ext)
7624 +- chunksize += sizeof(sctp_supported_ext_param_t) + num_ext;
7625 ++ chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
7626 ++ num_ext);
7627 +
7628 + /* Now allocate and fill out the chunk. */
7629 + retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize);
7630 +@@ -3314,21 +3317,6 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
7631 + sctp_chunk_free(asconf);
7632 + asoc->addip_last_asconf = NULL;
7633 +
7634 +- /* Send the next asconf chunk from the addip chunk queue. */
7635 +- if (!list_empty(&asoc->addip_chunk_list)) {
7636 +- struct list_head *entry = asoc->addip_chunk_list.next;
7637 +- asconf = list_entry(entry, struct sctp_chunk, list);
7638 +-
7639 +- list_del_init(entry);
7640 +-
7641 +- /* Hold the chunk until an ASCONF_ACK is received. */
7642 +- sctp_chunk_hold(asconf);
7643 +- if (sctp_primitive_ASCONF(asoc, asconf))
7644 +- sctp_chunk_free(asconf);
7645 +- else
7646 +- asoc->addip_last_asconf = asconf;
7647 +- }
7648 +-
7649 + return retval;
7650 + }
7651 +
7652 +diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
7653 +index 4e4ca65..42bbb24 100644
7654 +--- a/net/sctp/sm_sideeffect.c
7655 ++++ b/net/sctp/sm_sideeffect.c
7656 +@@ -961,6 +961,29 @@ static int sctp_cmd_send_msg(struct sctp_association *asoc,
7657 + }
7658 +
7659 +
7660 ++/* Sent the next ASCONF packet currently stored in the association.
7661 ++ * This happens after the ASCONF_ACK was succeffully processed.
7662 ++ */
7663 ++static void sctp_cmd_send_asconf(struct sctp_association *asoc)
7664 ++{
7665 ++ /* Send the next asconf chunk from the addip chunk
7666 ++ * queue.
7667 ++ */
7668 ++ if (!list_empty(&asoc->addip_chunk_list)) {
7669 ++ struct list_head *entry = asoc->addip_chunk_list.next;
7670 ++ struct sctp_chunk *asconf = list_entry(entry,
7671 ++ struct sctp_chunk, list);
7672 ++ list_del_init(entry);
7673 ++
7674 ++ /* Hold the chunk until an ASCONF_ACK is received. */
7675 ++ sctp_chunk_hold(asconf);
7676 ++ if (sctp_primitive_ASCONF(asoc, asconf))
7677 ++ sctp_chunk_free(asconf);
7678 ++ else
7679 ++ asoc->addip_last_asconf = asconf;
7680 ++ }
7681 ++}
7682 ++
7683 +
7684 + /* These three macros allow us to pull the debugging code out of the
7685 + * main flow of sctp_do_sm() to keep attention focused on the real
7686 +@@ -1616,6 +1639,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
7687 + }
7688 + error = sctp_cmd_send_msg(asoc, cmd->obj.msg);
7689 + break;
7690 ++ case SCTP_CMD_SEND_NEXT_ASCONF:
7691 ++ sctp_cmd_send_asconf(asoc);
7692 ++ break;
7693 + default:
7694 + printk(KERN_WARNING "Impossible command: %u, %p\n",
7695 + cmd->verb, cmd->obj.ptr);
7696 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
7697 +index 47bc20d..c3f75e7 100644
7698 +--- a/net/sctp/sm_statefuns.c
7699 ++++ b/net/sctp/sm_statefuns.c
7700 +@@ -3675,8 +3675,14 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
7701 + SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
7702 +
7703 + if (!sctp_process_asconf_ack((struct sctp_association *)asoc,
7704 +- asconf_ack))
7705 ++ asconf_ack)) {
7706 ++ /* Successfully processed ASCONF_ACK. We can
7707 ++ * release the next asconf if we have one.
7708 ++ */
7709 ++ sctp_add_cmd_sf(commands, SCTP_CMD_SEND_NEXT_ASCONF,
7710 ++ SCTP_NULL());
7711 + return SCTP_DISPOSITION_CONSUME;
7712 ++ }
7713 +
7714 + abort = sctp_make_abort(asoc, asconf_ack,
7715 + sizeof(sctp_errhdr_t));
7716 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
7717 +index 9bd9d82..aa3ba60 100644
7718 +--- a/net/sctp/socket.c
7719 ++++ b/net/sctp/socket.c
7720 +@@ -3718,12 +3718,12 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
7721 + sp->hmac = NULL;
7722 +
7723 + SCTP_DBG_OBJCNT_INC(sock);
7724 +- percpu_counter_inc(&sctp_sockets_allocated);
7725 +
7726 + /* Set socket backlog limit. */
7727 + sk->sk_backlog.limit = sysctl_sctp_rmem[1];
7728 +
7729 + local_bh_disable();
7730 ++ percpu_counter_inc(&sctp_sockets_allocated);
7731 + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
7732 + local_bh_enable();
7733 +
7734 +@@ -3740,8 +3740,8 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk)
7735 + /* Release our hold on the endpoint. */
7736 + ep = sctp_sk(sk)->ep;
7737 + sctp_endpoint_free(ep);
7738 +- percpu_counter_dec(&sctp_sockets_allocated);
7739 + local_bh_disable();
7740 ++ percpu_counter_dec(&sctp_sockets_allocated);
7741 + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
7742 + local_bh_enable();
7743 + }
7744 +@@ -6188,6 +6188,16 @@ do_nonblock:
7745 + goto out;
7746 + }
7747 +
7748 ++void sctp_data_ready(struct sock *sk, int len)
7749 ++{
7750 ++ read_lock_bh(&sk->sk_callback_lock);
7751 ++ if (sk_has_sleeper(sk))
7752 ++ wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN |
7753 ++ POLLRDNORM | POLLRDBAND);
7754 ++ sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
7755 ++ read_unlock_bh(&sk->sk_callback_lock);
7756 ++}
7757 ++
7758 + /* If socket sndbuf has changed, wake up all per association waiters. */
7759 + void sctp_write_space(struct sock *sk)
7760 + {
7761 +diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
7762 +index 327011f..7809137 100644
7763 +--- a/net/tipc/bearer.c
7764 ++++ b/net/tipc/bearer.c
7765 +@@ -45,10 +45,10 @@
7766 +
7767 + #define MAX_ADDR_STR 32
7768 +
7769 +-static struct media *media_list = NULL;
7770 ++static struct media media_list[MAX_MEDIA];
7771 + static u32 media_count = 0;
7772 +
7773 +-struct bearer *tipc_bearers = NULL;
7774 ++struct bearer tipc_bearers[MAX_BEARERS];
7775 +
7776 + /**
7777 + * media_name_valid - validate media name
7778 +@@ -108,9 +108,11 @@ int tipc_register_media(u32 media_type,
7779 + int res = -EINVAL;
7780 +
7781 + write_lock_bh(&tipc_net_lock);
7782 +- if (!media_list)
7783 +- goto exit;
7784 +
7785 ++ if (tipc_mode != TIPC_NET_MODE) {
7786 ++ warn("Media <%s> rejected, not in networked mode yet\n", name);
7787 ++ goto exit;
7788 ++ }
7789 + if (!media_name_valid(name)) {
7790 + warn("Media <%s> rejected, illegal name\n", name);
7791 + goto exit;
7792 +@@ -660,33 +662,10 @@ int tipc_disable_bearer(const char *name)
7793 +
7794 +
7795 +
7796 +-int tipc_bearer_init(void)
7797 +-{
7798 +- int res;
7799 +-
7800 +- write_lock_bh(&tipc_net_lock);
7801 +- tipc_bearers = kcalloc(MAX_BEARERS, sizeof(struct bearer), GFP_ATOMIC);
7802 +- media_list = kcalloc(MAX_MEDIA, sizeof(struct media), GFP_ATOMIC);
7803 +- if (tipc_bearers && media_list) {
7804 +- res = 0;
7805 +- } else {
7806 +- kfree(tipc_bearers);
7807 +- kfree(media_list);
7808 +- tipc_bearers = NULL;
7809 +- media_list = NULL;
7810 +- res = -ENOMEM;
7811 +- }
7812 +- write_unlock_bh(&tipc_net_lock);
7813 +- return res;
7814 +-}
7815 +-
7816 + void tipc_bearer_stop(void)
7817 + {
7818 + u32 i;
7819 +
7820 +- if (!tipc_bearers)
7821 +- return;
7822 +-
7823 + for (i = 0; i < MAX_BEARERS; i++) {
7824 + if (tipc_bearers[i].active)
7825 + tipc_bearers[i].publ.blocked = 1;
7826 +@@ -695,10 +674,6 @@ void tipc_bearer_stop(void)
7827 + if (tipc_bearers[i].active)
7828 + bearer_disable(tipc_bearers[i].publ.name);
7829 + }
7830 +- kfree(tipc_bearers);
7831 +- kfree(media_list);
7832 +- tipc_bearers = NULL;
7833 +- media_list = NULL;
7834 + media_count = 0;
7835 + }
7836 +
7837 +diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
7838 +index ca57348..000228e 100644
7839 +--- a/net/tipc/bearer.h
7840 ++++ b/net/tipc/bearer.h
7841 +@@ -114,7 +114,7 @@ struct bearer_name {
7842 +
7843 + struct link;
7844 +
7845 +-extern struct bearer *tipc_bearers;
7846 ++extern struct bearer tipc_bearers[];
7847 +
7848 + void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
7849 + struct sk_buff *tipc_media_get_names(void);
7850 +diff --git a/net/tipc/net.c b/net/tipc/net.c
7851 +index 7906608..f25b1cd 100644
7852 +--- a/net/tipc/net.c
7853 ++++ b/net/tipc/net.c
7854 +@@ -116,7 +116,8 @@
7855 + */
7856 +
7857 + DEFINE_RWLOCK(tipc_net_lock);
7858 +-struct network tipc_net = { NULL };
7859 ++struct _zone *tipc_zones[256] = { NULL, };
7860 ++struct network tipc_net = { tipc_zones };
7861 +
7862 + struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref)
7863 + {
7864 +@@ -158,28 +159,12 @@ void tipc_net_send_external_routes(u32 dest)
7865 + }
7866 + }
7867 +
7868 +-static int net_init(void)
7869 +-{
7870 +- memset(&tipc_net, 0, sizeof(tipc_net));
7871 +- tipc_net.zones = kcalloc(tipc_max_zones + 1, sizeof(struct _zone *), GFP_ATOMIC);
7872 +- if (!tipc_net.zones) {
7873 +- return -ENOMEM;
7874 +- }
7875 +- return 0;
7876 +-}
7877 +-
7878 + static void net_stop(void)
7879 + {
7880 + u32 z_num;
7881 +
7882 +- if (!tipc_net.zones)
7883 +- return;
7884 +-
7885 +- for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
7886 ++ for (z_num = 1; z_num <= tipc_max_zones; z_num++)
7887 + tipc_zone_delete(tipc_net.zones[z_num]);
7888 +- }
7889 +- kfree(tipc_net.zones);
7890 +- tipc_net.zones = NULL;
7891 + }
7892 +
7893 + static void net_route_named_msg(struct sk_buff *buf)
7894 +@@ -282,9 +267,7 @@ int tipc_net_start(u32 addr)
7895 + tipc_named_reinit();
7896 + tipc_port_reinit();
7897 +
7898 +- if ((res = tipc_bearer_init()) ||
7899 +- (res = net_init()) ||
7900 +- (res = tipc_cltr_init()) ||
7901 ++ if ((res = tipc_cltr_init()) ||
7902 + (res = tipc_bclink_init())) {
7903 + return res;
7904 + }
7905 +diff --git a/security/inode.c b/security/inode.c
7906 +index c3a7938..1c812e8 100644
7907 +--- a/security/inode.c
7908 ++++ b/security/inode.c
7909 +@@ -161,13 +161,13 @@ static int create_by_name(const char *name, mode_t mode,
7910 +
7911 + mutex_lock(&parent->d_inode->i_mutex);
7912 + *dentry = lookup_one_len(name, parent, strlen(name));
7913 +- if (!IS_ERR(dentry)) {
7914 ++ if (!IS_ERR(*dentry)) {
7915 + if ((mode & S_IFMT) == S_IFDIR)
7916 + error = mkdir(parent->d_inode, *dentry, mode);
7917 + else
7918 + error = create(parent->d_inode, *dentry, mode);
7919 + } else
7920 +- error = PTR_ERR(dentry);
7921 ++ error = PTR_ERR(*dentry);
7922 + mutex_unlock(&parent->d_inode->i_mutex);
7923 +
7924 + return error;
7925 +diff --git a/security/keys/request_key.c b/security/keys/request_key.c
7926 +index 03fe63e..9ac7bfd 100644
7927 +--- a/security/keys/request_key.c
7928 ++++ b/security/keys/request_key.c
7929 +@@ -336,8 +336,10 @@ static int construct_alloc_key(struct key_type *type,
7930 +
7931 + key_already_present:
7932 + mutex_unlock(&key_construction_mutex);
7933 +- if (dest_keyring)
7934 ++ if (dest_keyring) {
7935 ++ __key_link(dest_keyring, key_ref_to_ptr(key_ref));
7936 + up_write(&dest_keyring->sem);
7937 ++ }
7938 + mutex_unlock(&user->cons_lock);
7939 + key_put(key);
7940 + *_key = key = key_ref_to_ptr(key_ref);
7941 +@@ -428,6 +430,11 @@ struct key *request_key_and_link(struct key_type *type,
7942 +
7943 + if (!IS_ERR(key_ref)) {
7944 + key = key_ref_to_ptr(key_ref);
7945 ++ if (dest_keyring) {
7946 ++ construct_get_dest_keyring(&dest_keyring);
7947 ++ key_link(dest_keyring, key);
7948 ++ key_put(dest_keyring);
7949 ++ }
7950 + } else if (PTR_ERR(key_ref) != -EAGAIN) {
7951 + key = ERR_CAST(key_ref);
7952 + } else {
7953 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
7954 +index 062a8b0..fd831bd 100644
7955 +--- a/sound/pci/hda/hda_intel.c
7956 ++++ b/sound/pci/hda/hda_intel.c
7957 +@@ -2273,6 +2273,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
7958 + SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
7959 + SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB),
7960 + SND_PCI_QUIRK(0x1565, 0x8218, "Biostar Microtech", POS_FIX_LPIB),
7961 ++ SND_PCI_QUIRK(0x8086, 0x2503, "DG965OT AAD63733-203", POS_FIX_LPIB),
7962 + SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB),
7963 + {}
7964 + };
7965 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
7966 +index 71b7a96..1a97c81 100644
7967 +--- a/sound/pci/hda/patch_conexant.c
7968 ++++ b/sound/pci/hda/patch_conexant.c
7969 +@@ -1174,9 +1174,10 @@ static int patch_cxt5045(struct hda_codec *codec)
7970 +
7971 + switch (codec->subsystem_id >> 16) {
7972 + case 0x103c:
7973 ++ case 0x1631:
7974 + case 0x1734:
7975 +- /* HP & Fujitsu-Siemens laptops have really bad sound over 0dB
7976 +- * on NID 0x17. Fix max PCM level to 0 dB
7977 ++ /* HP, Packard Bell, & Fujitsu-Siemens laptops have really bad
7978 ++ * sound over 0dB on NID 0x17. Fix max PCM level to 0 dB
7979 + * (originally it has 0x2b steps with 0dB offset 0x14)
7980 + */
7981 + snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
7982 +@@ -2471,6 +2472,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
7983 + CXT5066_DELL_LAPTOP),
7984 + SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5),
7985 + SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO),
7986 ++ SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
7987 ++ SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
7988 + {}
7989 + };
7990 +
7991 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
7992 +index bd8a567..b486daa 100644
7993 +--- a/sound/pci/hda/patch_realtek.c
7994 ++++ b/sound/pci/hda/patch_realtek.c
7995 +@@ -4033,7 +4033,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
7996 + SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
7997 + SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
7998 + SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
7999 +- SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
8000 ++ SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
8001 + SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
8002 + SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
8003 + SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
8004 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
8005 +index 799ba25..ac2d528 100644
8006 +--- a/sound/pci/hda/patch_sigmatel.c
8007 ++++ b/sound/pci/hda/patch_sigmatel.c
8008 +@@ -1602,6 +1602,10 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
8009 + "Dell Studio 1555", STAC_DELL_M6_DMIC),
8010 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
8011 + "Dell Studio 1557", STAC_DELL_M6_DMIC),
8012 ++ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
8013 ++ "Dell Studio XPS 1645", STAC_DELL_M6_BOTH),
8014 ++ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
8015 ++ "Dell Studio 1558", STAC_DELL_M6_BOTH),
8016 + {} /* terminator */
8017 + };
8018 +
8019 +@@ -1725,6 +1729,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
8020 + "HP HDX", STAC_HP_HDX), /* HDX16 */
8021 + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
8022 + "HP dv6", STAC_HP_DV5),
8023 ++ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
8024 ++ "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
8025 + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
8026 + "HP", STAC_HP_DV5),
8027 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
8028 +diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
8029 +index 75283fb..c2311f8 100644
8030 +--- a/sound/pci/maestro3.c
8031 ++++ b/sound/pci/maestro3.c
8032 +@@ -849,6 +849,7 @@ struct snd_m3 {
8033 + struct snd_kcontrol *master_switch;
8034 + struct snd_kcontrol *master_volume;
8035 + struct tasklet_struct hwvol_tq;
8036 ++ unsigned int in_suspend;
8037 +
8038 + #ifdef CONFIG_PM
8039 + u16 *suspend_mem;
8040 +@@ -884,6 +885,7 @@ static struct pci_device_id snd_m3_ids[] = {
8041 + MODULE_DEVICE_TABLE(pci, snd_m3_ids);
8042 +
8043 + static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = {
8044 ++ SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c),
8045 + SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d),
8046 + SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d),
8047 + SND_PCI_QUIRK(0x1033, 0x80f1, "NEC LM800J/7", 0x03),
8048 +@@ -1613,6 +1615,11 @@ static void snd_m3_update_hw_volume(unsigned long private_data)
8049 + outb(0x88, chip->iobase + SHADOW_MIX_REG_MASTER);
8050 + outb(0x88, chip->iobase + HW_VOL_COUNTER_MASTER);
8051 +
8052 ++ /* Ignore spurious HV interrupts during suspend / resume, this avoids
8053 ++ mistaking them for a mute button press. */
8054 ++ if (chip->in_suspend)
8055 ++ return;
8056 ++
8057 + if (!chip->master_switch || !chip->master_volume)
8058 + return;
8059 +
8060 +@@ -2424,6 +2431,7 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state)
8061 + if (chip->suspend_mem == NULL)
8062 + return 0;
8063 +
8064 ++ chip->in_suspend = 1;
8065 + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
8066 + snd_pcm_suspend_all(chip->pcm);
8067 + snd_ac97_suspend(chip->ac97);
8068 +@@ -2497,6 +2505,7 @@ static int m3_resume(struct pci_dev *pci)
8069 + snd_m3_hv_init(chip);
8070 +
8071 + snd_power_change_state(card, SNDRV_CTL_POWER_D0);
8072 ++ chip->in_suspend = 0;
8073 + return 0;
8074 + }
8075 + #endif /* CONFIG_PM */
8076
8077 Deleted: genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.5.patch
8078 ===================================================================
8079 --- genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.5.patch 2010-07-05 22:42:35 UTC (rev 1720)
8080 +++ genpatches-2.6/trunk/2.6.33/1003_linux-2.6.33.5.patch 2010-07-05 23:09:19 UTC (rev 1721)
8081 @@ -1,1623 +0,0 @@
8082 -diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
8083 -index 0d07513..bf241be 100644
8084 ---- a/Documentation/filesystems/proc.txt
8085 -+++ b/Documentation/filesystems/proc.txt
8086 -@@ -308,7 +308,7 @@ address perms offset dev inode pathname
8087 - 08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test
8088 - 0804a000-0806b000 rw-p 00000000 00:00 0 [heap]
8089 - a7cb1000-a7cb2000 ---p 00000000 00:00 0
8090 --a7cb2000-a7eb2000 rw-p 00000000 00:00 0 [threadstack:001ff4b4]
8091 -+a7cb2000-a7eb2000 rw-p 00000000 00:00 0
8092 - a7eb2000-a7eb3000 ---p 00000000 00:00 0
8093 - a7eb3000-a7ed5000 rw-p 00000000 00:00 0
8094 - a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6
8095 -@@ -344,7 +344,6 @@ is not associated with a file:
8096 - [stack] = the stack of the main process
8097 - [vdso] = the "virtual dynamic shared object",
8098 - the kernel system call handler
8099 -- [threadstack:xxxxxxxx] = the stack of the thread, xxxxxxxx is the stack size
8100 -
8101 - or if empty, the mapping is anonymous.
8102 -
8103 -diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
8104 -index 9f4c9d4..bd100fc 100644
8105 ---- a/arch/powerpc/include/asm/hw_irq.h
8106 -+++ b/arch/powerpc/include/asm/hw_irq.h
8107 -@@ -130,43 +130,5 @@ static inline int irqs_disabled_flags(unsigned long flags)
8108 - */
8109 - struct irq_chip;
8110 -
8111 --#ifdef CONFIG_PERF_EVENTS
8112 --
8113 --#ifdef CONFIG_PPC64
8114 --static inline unsigned long test_perf_event_pending(void)
8115 --{
8116 -- unsigned long x;
8117 --
8118 -- asm volatile("lbz %0,%1(13)"
8119 -- : "=r" (x)
8120 -- : "i" (offsetof(struct paca_struct, perf_event_pending)));
8121 -- return x;
8122 --}
8123 --
8124 --static inline void set_perf_event_pending(void)
8125 --{
8126 -- asm volatile("stb %0,%1(13)" : :
8127 -- "r" (1),
8128 -- "i" (offsetof(struct paca_struct, perf_event_pending)));
8129 --}
8130 --
8131 --static inline void clear_perf_event_pending(void)
8132 --{
8133 -- asm volatile("stb %0,%1(13)" : :
8134 -- "r" (0),
8135 -- "i" (offsetof(struct paca_struct, perf_event_pending)));
8136 --}
8137 --#endif /* CONFIG_PPC64 */
8138 --
8139 --#else /* CONFIG_PERF_EVENTS */
8140 --
8141 --static inline unsigned long test_perf_event_pending(void)
8142 --{
8143 -- return 0;
8144 --}
8145 --
8146 --static inline void clear_perf_event_pending(void) {}
8147 --#endif /* CONFIG_PERF_EVENTS */
8148 --
8149 - #endif /* __KERNEL__ */
8150 - #endif /* _ASM_POWERPC_HW_IRQ_H */
8151 -diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
8152 -index a6c2b63..11d0668 100644
8153 ---- a/arch/powerpc/kernel/asm-offsets.c
8154 -+++ b/arch/powerpc/kernel/asm-offsets.c
8155 -@@ -133,7 +133,6 @@ int main(void)
8156 - DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
8157 - DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
8158 - DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled));
8159 -- DEFINE(PACAPERFPEND, offsetof(struct paca_struct, perf_event_pending));
8160 - DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
8161 - #ifdef CONFIG_PPC_MM_SLICES
8162 - DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct,
8163 -diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
8164 -index bdcb557..afbf400 100644
8165 ---- a/arch/powerpc/kernel/entry_64.S
8166 -+++ b/arch/powerpc/kernel/entry_64.S
8167 -@@ -556,15 +556,6 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)
8168 - 2:
8169 - TRACE_AND_RESTORE_IRQ(r5);
8170 -
8171 --#ifdef CONFIG_PERF_EVENTS
8172 -- /* check paca->perf_event_pending if we're enabling ints */
8173 -- lbz r3,PACAPERFPEND(r13)
8174 -- and. r3,r3,r5
8175 -- beq 27f
8176 -- bl .perf_event_do_pending
8177 --27:
8178 --#endif /* CONFIG_PERF_EVENTS */
8179 --
8180 - /* extract EE bit and use it to restore paca->hard_enabled */
8181 - ld r3,_MSR(r1)
8182 - rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */
8183 -diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
8184 -index 9040330..dee83b8 100644
8185 ---- a/arch/powerpc/kernel/irq.c
8186 -+++ b/arch/powerpc/kernel/irq.c
8187 -@@ -53,7 +53,6 @@
8188 - #include <linux/bootmem.h>
8189 - #include <linux/pci.h>
8190 - #include <linux/debugfs.h>
8191 --#include <linux/perf_event.h>
8192 -
8193 - #include <asm/uaccess.h>
8194 - #include <asm/system.h>
8195 -@@ -143,11 +142,6 @@ notrace void raw_local_irq_restore(unsigned long en)
8196 - }
8197 - #endif /* CONFIG_PPC_STD_MMU_64 */
8198 -
8199 -- if (test_perf_event_pending()) {
8200 -- clear_perf_event_pending();
8201 -- perf_event_do_pending();
8202 -- }
8203 --
8204 - /*
8205 - * if (get_paca()->hard_enabled) return;
8206 - * But again we need to take care that gcc gets hard_enabled directly
8207 -diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
8208 -index 6c6093d..6f174e7 100644
8209 ---- a/arch/powerpc/kernel/time.c
8210 -+++ b/arch/powerpc/kernel/time.c
8211 -@@ -532,25 +532,60 @@ void __init iSeries_time_init_early(void)
8212 - }
8213 - #endif /* CONFIG_PPC_ISERIES */
8214 -
8215 --#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_PPC32)
8216 --DEFINE_PER_CPU(u8, perf_event_pending);
8217 -+#ifdef CONFIG_PERF_EVENTS
8218 -
8219 --void set_perf_event_pending(void)
8220 -+/*
8221 -+ * 64-bit uses a byte in the PACA, 32-bit uses a per-cpu variable...
8222 -+ */
8223 -+#ifdef CONFIG_PPC64
8224 -+static inline unsigned long test_perf_event_pending(void)
8225 - {
8226 -- get_cpu_var(perf_event_pending) = 1;
8227 -- set_dec(1);
8228 -- put_cpu_var(perf_event_pending);
8229 -+ unsigned long x;
8230 -+
8231 -+ asm volatile("lbz %0,%1(13)"
8232 -+ : "=r" (x)
8233 -+ : "i" (offsetof(struct paca_struct, perf_event_pending)));
8234 -+ return x;
8235 - }
8236 -
8237 -+static inline void set_perf_event_pending_flag(void)
8238 -+{
8239 -+ asm volatile("stb %0,%1(13)" : :
8240 -+ "r" (1),
8241 -+ "i" (offsetof(struct paca_struct, perf_event_pending)));
8242 -+}
8243 -+
8244 -+static inline void clear_perf_event_pending(void)
8245 -+{
8246 -+ asm volatile("stb %0,%1(13)" : :
8247 -+ "r" (0),
8248 -+ "i" (offsetof(struct paca_struct, perf_event_pending)));
8249 -+}
8250 -+
8251 -+#else /* 32-bit */
8252 -+
8253 -+DEFINE_PER_CPU(u8, perf_event_pending);
8254 -+
8255 -+#define set_perf_event_pending_flag() __get_cpu_var(perf_event_pending) = 1
8256 - #define test_perf_event_pending() __get_cpu_var(perf_event_pending)
8257 - #define clear_perf_event_pending() __get_cpu_var(perf_event_pending) = 0
8258 -
8259 --#else /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */
8260 -+#endif /* 32 vs 64 bit */
8261 -+
8262 -+void set_perf_event_pending(void)
8263 -+{
8264 -+ preempt_disable();
8265 -+ set_perf_event_pending_flag();
8266 -+ set_dec(1);
8267 -+ preempt_enable();
8268 -+}
8269 -+
8270 -+#else /* CONFIG_PERF_EVENTS */
8271 -
8272 - #define test_perf_event_pending() 0
8273 - #define clear_perf_event_pending()
8274 -
8275 --#endif /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */
8276 -+#endif /* CONFIG_PERF_EVENTS */
8277 -
8278 - /*
8279 - * For iSeries shared processors, we have to let the hypervisor
8280 -@@ -580,10 +615,6 @@ void timer_interrupt(struct pt_regs * regs)
8281 - set_dec(DECREMENTER_MAX);
8282 -
8283 - #ifdef CONFIG_PPC32
8284 -- if (test_perf_event_pending()) {
8285 -- clear_perf_event_pending();
8286 -- perf_event_do_pending();
8287 -- }
8288 - if (atomic_read(&ppc_n_lost_interrupts) != 0)
8289 - do_IRQ(regs);
8290 - #endif
8291 -@@ -602,6 +633,11 @@ void timer_interrupt(struct pt_regs * regs)
8292 -
8293 - calculate_steal_time();
8294 -
8295 -+ if (test_perf_event_pending()) {
8296 -+ clear_perf_event_pending();
8297 -+ perf_event_do_pending();
8298 -+ }
8299 -+
8300 - #ifdef CONFIG_PPC_ISERIES
8301 - if (firmware_has_feature(FW_FEATURE_ISERIES))
8302 - get_lppaca()->int_dword.fields.decr_int = 0;
8303 -diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
8304 -index 7cf4642..11e94de 100644
8305 ---- a/arch/s390/kernel/ptrace.c
8306 -+++ b/arch/s390/kernel/ptrace.c
8307 -@@ -640,7 +640,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
8308 -
8309 - asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
8310 - {
8311 -- long ret;
8312 -+ long ret = 0;
8313 -
8314 - /* Do the secure computing check first. */
8315 - secure_computing(regs->gprs[2]);
8316 -@@ -649,7 +649,6 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
8317 - * The sysc_tracesys code in entry.S stored the system
8318 - * call number to gprs[2].
8319 - */
8320 -- ret = regs->gprs[2];
8321 - if (test_thread_flag(TIF_SYSCALL_TRACE) &&
8322 - (tracehook_report_syscall_entry(regs) ||
8323 - regs->gprs[2] >= NR_syscalls)) {
8324 -@@ -671,7 +670,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
8325 - regs->gprs[2], regs->orig_gpr2,
8326 - regs->gprs[3], regs->gprs[4],
8327 - regs->gprs[5]);
8328 -- return ret;
8329 -+ return ret ?: regs->gprs[2];
8330 - }
8331 -
8332 - asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
8333 -diff --git a/arch/x86/include/asm/k8.h b/arch/x86/include/asm/k8.h
8334 -index f70e600..af00bd1 100644
8335 ---- a/arch/x86/include/asm/k8.h
8336 -+++ b/arch/x86/include/asm/k8.h
8337 -@@ -16,11 +16,16 @@ extern int k8_numa_init(unsigned long start_pfn, unsigned long end_pfn);
8338 - extern int k8_scan_nodes(void);
8339 -
8340 - #ifdef CONFIG_K8_NB
8341 -+extern int num_k8_northbridges;
8342 -+
8343 - static inline struct pci_dev *node_to_k8_nb_misc(int node)
8344 - {
8345 - return (node < num_k8_northbridges) ? k8_northbridges[node] : NULL;
8346 - }
8347 -+
8348 - #else
8349 -+#define num_k8_northbridges 0
8350 -+
8351 - static inline struct pci_dev *node_to_k8_nb_misc(int node)
8352 - {
8353 - return NULL;
8354 -diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
8355 -index d440123..581924b 100644
8356 ---- a/arch/x86/kernel/cpu/intel_cacheinfo.c
8357 -+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
8358 -@@ -338,6 +338,10 @@ amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf)
8359 - (boot_cpu_data.x86_mask < 0x1)))
8360 - return;
8361 -
8362 -+ /* not in virtualized environments */
8363 -+ if (num_k8_northbridges == 0)
8364 -+ return;
8365 -+
8366 - this_leaf->can_disable = true;
8367 - this_leaf->l3_indices = amd_calc_l3_indices();
8368 - }
8369 -diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
8370 -index 999c8a6..0571b72 100644
8371 ---- a/arch/x86/kernel/process.c
8372 -+++ b/arch/x86/kernel/process.c
8373 -@@ -539,11 +539,13 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
8374 - * check OSVW bit for CPUs that are not affected
8375 - * by erratum #400
8376 - */
8377 -- rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
8378 -- if (val >= 2) {
8379 -- rdmsrl(MSR_AMD64_OSVW_STATUS, val);
8380 -- if (!(val & BIT(1)))
8381 -- goto no_c1e_idle;
8382 -+ if (cpu_has(c, X86_FEATURE_OSVW)) {
8383 -+ rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
8384 -+ if (val >= 2) {
8385 -+ rdmsrl(MSR_AMD64_OSVW_STATUS, val);
8386 -+ if (!(val & BIT(1)))
8387 -+ goto no_c1e_idle;
8388 -+ }
8389 - }
8390 - return 1;
8391 - }
8392 -diff --git a/crypto/authenc.c b/crypto/authenc.c
8393 -index 4d6f49a..0d54de9 100644
8394 ---- a/crypto/authenc.c
8395 -+++ b/crypto/authenc.c
8396 -@@ -46,6 +46,12 @@ struct authenc_request_ctx {
8397 - char tail[];
8398 - };
8399 -
8400 -+static void authenc_request_complete(struct aead_request *req, int err)
8401 -+{
8402 -+ if (err != -EINPROGRESS)
8403 -+ aead_request_complete(req, err);
8404 -+}
8405 -+
8406 - static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
8407 - unsigned int keylen)
8408 - {
8409 -@@ -142,7 +148,7 @@ static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq,
8410 - crypto_aead_authsize(authenc), 1);
8411 -
8412 - out:
8413 -- aead_request_complete(req, err);
8414 -+ authenc_request_complete(req, err);
8415 - }
8416 -
8417 - static void authenc_geniv_ahash_done(struct crypto_async_request *areq, int err)
8418 -@@ -208,7 +214,7 @@ static void authenc_verify_ahash_update_done(struct crypto_async_request *areq,
8419 - err = crypto_ablkcipher_decrypt(abreq);
8420 -
8421 - out:
8422 -- aead_request_complete(req, err);
8423 -+ authenc_request_complete(req, err);
8424 - }
8425 -
8426 - static void authenc_verify_ahash_done(struct crypto_async_request *areq,
8427 -@@ -245,7 +251,7 @@ static void authenc_verify_ahash_done(struct crypto_async_request *areq,
8428 - err = crypto_ablkcipher_decrypt(abreq);
8429 -
8430 - out:
8431 -- aead_request_complete(req, err);
8432 -+ authenc_request_complete(req, err);
8433 - }
8434 -
8435 - static u8 *crypto_authenc_ahash_fb(struct aead_request *req, unsigned int flags)
8436 -@@ -379,7 +385,7 @@ static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
8437 - err = crypto_authenc_genicv(areq, iv, 0);
8438 - }
8439 -
8440 -- aead_request_complete(areq, err);
8441 -+ authenc_request_complete(areq, err);
8442 - }
8443 -
8444 - static int crypto_authenc_encrypt(struct aead_request *req)
8445 -@@ -418,7 +424,7 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req,
8446 - err = crypto_authenc_genicv(areq, greq->giv, 0);
8447 - }
8448 -
8449 -- aead_request_complete(areq, err);
8450 -+ authenc_request_complete(areq, err);
8451 - }
8452 -
8453 - static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req)
8454 -diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
8455 -index 7c85265..9ed9292 100644
8456 ---- a/drivers/acpi/sleep.c
8457 -+++ b/drivers/acpi/sleep.c
8458 -@@ -475,101 +475,13 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
8459 - },
8460 - {
8461 - .callback = init_set_sci_en_on_resume,
8462 -- .ident = "Lenovo ThinkPad X201",
8463 -+ .ident = "Lenovo ThinkPad X201[s]",
8464 - .matches = {
8465 - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8466 - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
8467 - },
8468 - },
8469 - {
8470 -- .callback = init_set_sci_en_on_resume,
8471 -- .ident = "Lenovo ThinkPad X201",
8472 -- .matches = {
8473 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8474 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
8475 -- },
8476 -- },
8477 -- {
8478 -- .callback = init_set_sci_en_on_resume,
8479 -- .ident = "Lenovo ThinkPad T410",
8480 -- .matches = {
8481 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8482 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
8483 -- },
8484 -- },
8485 -- {
8486 -- .callback = init_set_sci_en_on_resume,
8487 -- .ident = "Lenovo ThinkPad T510",
8488 -- .matches = {
8489 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8490 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
8491 -- },
8492 -- },
8493 -- {
8494 -- .callback = init_set_sci_en_on_resume,
8495 -- .ident = "Lenovo ThinkPad W510",
8496 -- .matches = {
8497 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8498 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
8499 -- },
8500 -- },
8501 -- {
8502 -- .callback = init_set_sci_en_on_resume,
8503 -- .ident = "Lenovo ThinkPad X201",
8504 -- .matches = {
8505 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8506 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
8507 -- },
8508 -- },
8509 -- {
8510 -- .callback = init_set_sci_en_on_resume,
8511 -- .ident = "Lenovo ThinkPad X201",
8512 -- .matches = {
8513 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8514 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
8515 -- },
8516 -- },
8517 -- {
8518 -- .callback = init_set_sci_en_on_resume,
8519 -- .ident = "Lenovo ThinkPad T410",
8520 -- .matches = {
8521 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8522 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
8523 -- },
8524 -- },
8525 -- {
8526 -- .callback = init_set_sci_en_on_resume,
8527 -- .ident = "Lenovo ThinkPad T510",
8528 -- .matches = {
8529 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8530 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
8531 -- },
8532 -- },
8533 -- {
8534 -- .callback = init_set_sci_en_on_resume,
8535 -- .ident = "Lenovo ThinkPad W510",
8536 -- .matches = {
8537 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8538 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
8539 -- },
8540 -- },
8541 -- {
8542 -- .callback = init_set_sci_en_on_resume,
8543 -- .ident = "Lenovo ThinkPad X201",
8544 -- .matches = {
8545 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8546 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
8547 -- },
8548 -- },
8549 -- {
8550 -- .callback = init_set_sci_en_on_resume,
8551 -- .ident = "Lenovo ThinkPad X201",
8552 -- .matches = {
8553 -- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
8554 -- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
8555 -- },
8556 -- },
8557 -- {
8558 - .callback = init_old_suspend_ordering,
8559 - .ident = "Panasonic CF51-2L",
8560 - .matches = {
8561 -diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
8562 -index 76253cf..9af6766 100644
8563 ---- a/drivers/char/tty_io.c
8564 -+++ b/drivers/char/tty_io.c
8565 -@@ -1875,6 +1875,7 @@ got_driver:
8566 - */
8567 - if (filp->f_op == &hung_up_tty_fops)
8568 - filp->f_op = &tty_fops;
8569 -+ unlock_kernel();
8570 - goto retry_open;
8571 - }
8572 - unlock_kernel();
8573 -diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
8574 -index cf4cb3e..4746bfe 100644
8575 ---- a/drivers/gpu/drm/i915/i915_drv.c
8576 -+++ b/drivers/gpu/drm/i915/i915_drv.c
8577 -@@ -79,14 +79,14 @@ const static struct intel_device_info intel_i915g_info = {
8578 - .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1,
8579 - };
8580 - const static struct intel_device_info intel_i915gm_info = {
8581 -- .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
8582 -+ .is_i9xx = 1, .is_mobile = 1,
8583 - .cursor_needs_physical = 1,
8584 - };
8585 - const static struct intel_device_info intel_i945g_info = {
8586 - .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1,
8587 - };
8588 - const static struct intel_device_info intel_i945gm_info = {
8589 -- .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
8590 -+ .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1,
8591 - .has_hotplug = 1, .cursor_needs_physical = 1,
8592 - };
8593 -
8594 -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
8595 -index 16ce3ba..0b33757 100644
8596 ---- a/drivers/gpu/drm/i915/i915_drv.h
8597 -+++ b/drivers/gpu/drm/i915/i915_drv.h
8598 -@@ -206,11 +206,14 @@ typedef struct drm_i915_private {
8599 -
8600 - drm_dma_handle_t *status_page_dmah;
8601 - void *hw_status_page;
8602 -+ void *seqno_page;
8603 - dma_addr_t dma_status_page;
8604 - uint32_t counter;
8605 - unsigned int status_gfx_addr;
8606 -+ unsigned int seqno_gfx_addr;
8607 - drm_local_map_t hws_map;
8608 - struct drm_gem_object *hws_obj;
8609 -+ struct drm_gem_object *seqno_obj;
8610 - struct drm_gem_object *pwrctx;
8611 -
8612 - struct resource mch_res;
8613 -@@ -1090,6 +1093,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
8614 -
8615 - #define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \
8616 - IS_GEN6(dev))
8617 -+#define HAS_PIPE_CONTROL(dev) (IS_IRONLAKE(dev) || IS_GEN6(dev))
8618 -
8619 - #define PRIMARY_RINGBUFFER_SIZE (128*1024)
8620 -
8621 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
8622 -index 6458400..c00c978 100644
8623 ---- a/drivers/gpu/drm/i915/i915_gem.c
8624 -+++ b/drivers/gpu/drm/i915/i915_gem.c
8625 -@@ -1559,6 +1559,13 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
8626 - i915_verify_inactive(dev, __FILE__, __LINE__);
8627 - }
8628 -
8629 -+#define PIPE_CONTROL_FLUSH(addr) \
8630 -+ OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE | \
8631 -+ PIPE_CONTROL_DEPTH_STALL); \
8632 -+ OUT_RING(addr | PIPE_CONTROL_GLOBAL_GTT); \
8633 -+ OUT_RING(0); \
8634 -+ OUT_RING(0); \
8635 -+
8636 - /**
8637 - * Creates a new sequence number, emitting a write of it to the status page
8638 - * plus an interrupt, which will trigger i915_user_interrupt_handler.
8639 -@@ -1593,13 +1600,47 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
8640 - if (dev_priv->mm.next_gem_seqno == 0)
8641 - dev_priv->mm.next_gem_seqno++;
8642 -
8643 -- BEGIN_LP_RING(4);
8644 -- OUT_RING(MI_STORE_DWORD_INDEX);
8645 -- OUT_RING(I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
8646 -- OUT_RING(seqno);
8647 -+ if (HAS_PIPE_CONTROL(dev)) {
8648 -+ u32 scratch_addr = dev_priv->seqno_gfx_addr + 128;
8649 -
8650 -- OUT_RING(MI_USER_INTERRUPT);
8651 -- ADVANCE_LP_RING();
8652 -+ /*
8653 -+ * Workaround qword write incoherence by flushing the
8654 -+ * PIPE_NOTIFY buffers out to memory before requesting
8655 -+ * an interrupt.
8656 -+ */
8657 -+ BEGIN_LP_RING(32);
8658 -+ OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
8659 -+ PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH);
8660 -+ OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
8661 -+ OUT_RING(seqno);
8662 -+ OUT_RING(0);
8663 -+ PIPE_CONTROL_FLUSH(scratch_addr);
8664 -+ scratch_addr += 128; /* write to separate cachelines */
8665 -+ PIPE_CONTROL_FLUSH(scratch_addr);
8666 -+ scratch_addr += 128;
8667 -+ PIPE_CONTROL_FLUSH(scratch_addr);
8668 -+ scratch_addr += 128;
8669 -+ PIPE_CONTROL_FLUSH(scratch_addr);
8670 -+ scratch_addr += 128;
8671 -+ PIPE_CONTROL_FLUSH(scratch_addr);
8672 -+ scratch_addr += 128;
8673 -+ PIPE_CONTROL_FLUSH(scratch_addr);
8674 -+ OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
8675 -+ PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH |
8676 -+ PIPE_CONTROL_NOTIFY);
8677 -+ OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
8678 -+ OUT_RING(seqno);
8679 -+ OUT_RING(0);
8680 -+ ADVANCE_LP_RING();
8681 -+ } else {
8682 -+ BEGIN_LP_RING(4);
8683 -+ OUT_RING(MI_STORE_DWORD_INDEX);
8684 -+ OUT_RING(I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
8685 -+ OUT_RING(seqno);
8686 -+
8687 -+ OUT_RING(MI_USER_INTERRUPT);
8688 -+ ADVANCE_LP_RING();
8689 -+ }
8690 -
8691 - DRM_DEBUG_DRIVER("%d\n", seqno);
8692 -
8693 -@@ -1744,7 +1785,10 @@ i915_get_gem_seqno(struct drm_device *dev)
8694 - {
8695 - drm_i915_private_t *dev_priv = dev->dev_private;
8696 -
8697 -- return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX);
8698 -+ if (HAS_PIPE_CONTROL(dev))
8699 -+ return ((volatile u32 *)(dev_priv->seqno_page))[0];
8700 -+ else
8701 -+ return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX);
8702 - }
8703 -
8704 - /**
8705 -@@ -4576,6 +4620,49 @@ i915_gem_idle(struct drm_device *dev)
8706 - return 0;
8707 - }
8708 -
8709 -+/*
8710 -+ * 965+ support PIPE_CONTROL commands, which provide finer grained control
8711 -+ * over cache flushing.
8712 -+ */
8713 -+static int
8714 -+i915_gem_init_pipe_control(struct drm_device *dev)
8715 -+{
8716 -+ drm_i915_private_t *dev_priv = dev->dev_private;
8717 -+ struct drm_gem_object *obj;
8718 -+ struct drm_i915_gem_object *obj_priv;
8719 -+ int ret;
8720 -+
8721 -+ obj = drm_gem_object_alloc(dev, 4096);
8722 -+ if (obj == NULL) {
8723 -+ DRM_ERROR("Failed to allocate seqno page\n");
8724 -+ ret = -ENOMEM;
8725 -+ goto err;
8726 -+ }
8727 -+ obj_priv = obj->driver_private;
8728 -+ obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
8729 -+
8730 -+ ret = i915_gem_object_pin(obj, 4096);
8731 -+ if (ret)
8732 -+ goto err_unref;
8733 -+
8734 -+ dev_priv->seqno_gfx_addr = obj_priv->gtt_offset;
8735 -+ dev_priv->seqno_page = kmap(obj_priv->pages[0]);
8736 -+ if (dev_priv->seqno_page == NULL)
8737 -+ goto err_unpin;
8738 -+
8739 -+ dev_priv->seqno_obj = obj;
8740 -+ memset(dev_priv->seqno_page, 0, PAGE_SIZE);
8741 -+
8742 -+ return 0;
8743 -+
8744 -+err_unpin:
8745 -+ i915_gem_object_unpin(obj);
8746 -+err_unref:
8747 -+ drm_gem_object_unreference(obj);
8748 -+err:
8749 -+ return ret;
8750 -+}
8751 -+
8752 - static int
8753 - i915_gem_init_hws(struct drm_device *dev)
8754 - {
8755 -@@ -4593,7 +4680,8 @@ i915_gem_init_hws(struct drm_device *dev)
8756 - obj = drm_gem_object_alloc(dev, 4096);
8757 - if (obj == NULL) {
8758 - DRM_ERROR("Failed to allocate status page\n");
8759 -- return -ENOMEM;
8760 -+ ret = -ENOMEM;
8761 -+ goto err;
8762 - }
8763 - obj_priv = obj->driver_private;
8764 - obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
8765 -@@ -4601,7 +4689,7 @@ i915_gem_init_hws(struct drm_device *dev)
8766 - ret = i915_gem_object_pin(obj, 4096);
8767 - if (ret != 0) {
8768 - drm_gem_object_unreference(obj);
8769 -- return ret;
8770 -+ goto err_unref;
8771 - }
8772 -
8773 - dev_priv->status_gfx_addr = obj_priv->gtt_offset;
8774 -@@ -4610,10 +4698,16 @@ i915_gem_init_hws(struct drm_device *dev)
8775 - if (dev_priv->hw_status_page == NULL) {
8776 - DRM_ERROR("Failed to map status page.\n");
8777 - memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
8778 -- i915_gem_object_unpin(obj);
8779 -- drm_gem_object_unreference(obj);
8780 -- return -EINVAL;
8781 -+ ret = -EINVAL;
8782 -+ goto err_unpin;
8783 - }
8784 -+
8785 -+ if (HAS_PIPE_CONTROL(dev)) {
8786 -+ ret = i915_gem_init_pipe_control(dev);
8787 -+ if (ret)
8788 -+ goto err_unpin;
8789 -+ }
8790 -+
8791 - dev_priv->hws_obj = obj;
8792 - memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
8793 - I915_WRITE(HWS_PGA, dev_priv->status_gfx_addr);
8794 -@@ -4621,6 +4715,30 @@ i915_gem_init_hws(struct drm_device *dev)
8795 - DRM_DEBUG_DRIVER("hws offset: 0x%08x\n", dev_priv->status_gfx_addr);
8796 -
8797 - return 0;
8798 -+
8799 -+err_unpin:
8800 -+ i915_gem_object_unpin(obj);
8801 -+err_unref:
8802 -+ drm_gem_object_unreference(obj);
8803 -+err:
8804 -+ return 0;
8805 -+}
8806 -+
8807 -+static void
8808 -+i915_gem_cleanup_pipe_control(struct drm_device *dev)
8809 -+{
8810 -+ drm_i915_private_t *dev_priv = dev->dev_private;
8811 -+ struct drm_gem_object *obj;
8812 -+ struct drm_i915_gem_object *obj_priv;
8813 -+
8814 -+ obj = dev_priv->seqno_obj;
8815 -+ obj_priv = obj->driver_private;
8816 -+ kunmap(obj_priv->pages[0]);
8817 -+ i915_gem_object_unpin(obj);
8818 -+ drm_gem_object_unreference(obj);
8819 -+ dev_priv->seqno_obj = NULL;
8820 -+
8821 -+ dev_priv->seqno_page = NULL;
8822 - }
8823 -
8824 - static void
8825 -@@ -4644,6 +4762,9 @@ i915_gem_cleanup_hws(struct drm_device *dev)
8826 - memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
8827 - dev_priv->hw_status_page = NULL;
8828 -
8829 -+ if (HAS_PIPE_CONTROL(dev))
8830 -+ i915_gem_cleanup_pipe_control(dev);
8831 -+
8832 - /* Write high address into HWS_PGA when disabling. */
8833 - I915_WRITE(HWS_PGA, 0x1ffff000);
8834 - }
8835 -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
8836 -index 032f667..d6466d5 100644
8837 ---- a/drivers/gpu/drm/i915/i915_irq.c
8838 -+++ b/drivers/gpu/drm/i915/i915_irq.c
8839 -@@ -297,7 +297,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
8840 - READ_BREADCRUMB(dev_priv);
8841 - }
8842 -
8843 -- if (gt_iir & GT_USER_INTERRUPT) {
8844 -+ if (gt_iir & GT_PIPE_NOTIFY) {
8845 - u32 seqno = i915_get_gem_seqno(dev);
8846 - dev_priv->mm.irq_gem_seqno = seqno;
8847 - trace_i915_gem_request_complete(dev, seqno);
8848 -@@ -738,7 +738,7 @@ void i915_user_irq_get(struct drm_device *dev)
8849 - spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
8850 - if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) {
8851 - if (HAS_PCH_SPLIT(dev))
8852 -- ironlake_enable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
8853 -+ ironlake_enable_graphics_irq(dev_priv, GT_PIPE_NOTIFY);
8854 - else
8855 - i915_enable_irq(dev_priv, I915_USER_INTERRUPT);
8856 - }
8857 -@@ -754,7 +754,7 @@ void i915_user_irq_put(struct drm_device *dev)
8858 - BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0);
8859 - if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) {
8860 - if (HAS_PCH_SPLIT(dev))
8861 -- ironlake_disable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
8862 -+ ironlake_disable_graphics_irq(dev_priv, GT_PIPE_NOTIFY);
8863 - else
8864 - i915_disable_irq(dev_priv, I915_USER_INTERRUPT);
8865 - }
8866 -@@ -1034,7 +1034,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
8867 - /* enable kind of interrupts always enabled */
8868 - u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
8869 - DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
8870 -- u32 render_mask = GT_USER_INTERRUPT;
8871 -+ u32 render_mask = GT_PIPE_NOTIFY;
8872 - u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
8873 - SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
8874 -
8875 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
8876 -index fd95bdf..30a2322 100644
8877 ---- a/drivers/gpu/drm/i915/i915_reg.h
8878 -+++ b/drivers/gpu/drm/i915/i915_reg.h
8879 -@@ -210,6 +210,16 @@
8880 - #define ASYNC_FLIP (1<<22)
8881 - #define DISPLAY_PLANE_A (0<<20)
8882 - #define DISPLAY_PLANE_B (1<<20)
8883 -+#define GFX_OP_PIPE_CONTROL ((0x3<<29)|(0x3<<27)|(0x2<<24)|2)
8884 -+#define PIPE_CONTROL_QW_WRITE (1<<14)
8885 -+#define PIPE_CONTROL_DEPTH_STALL (1<<13)
8886 -+#define PIPE_CONTROL_WC_FLUSH (1<<12)
8887 -+#define PIPE_CONTROL_IS_FLUSH (1<<11) /* MBZ on Ironlake */
8888 -+#define PIPE_CONTROL_TC_FLUSH (1<<10) /* GM45+ only */
8889 -+#define PIPE_CONTROL_ISP_DIS (1<<9)
8890 -+#define PIPE_CONTROL_NOTIFY (1<<8)
8891 -+#define PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
8892 -+#define PIPE_CONTROL_STALL_EN (1<<1) /* in addr word, Ironlake+ only */
8893 -
8894 - /*
8895 - * Fence registers
8896 -@@ -2111,6 +2121,7 @@
8897 - #define DEIER 0x4400c
8898 -
8899 - /* GT interrupt */
8900 -+#define GT_PIPE_NOTIFY (1 << 4)
8901 - #define GT_SYNC_STATUS (1 << 2)
8902 - #define GT_USER_INTERRUPT (1 << 0)
8903 -
8904 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
8905 -index 4b2458d..3f00902 100644
8906 ---- a/drivers/gpu/drm/i915/intel_display.c
8907 -+++ b/drivers/gpu/drm/i915/intel_display.c
8908 -@@ -4683,7 +4683,7 @@ static void intel_init_display(struct drm_device *dev)
8909 - dev_priv->display.fbc_enabled = g4x_fbc_enabled;
8910 - dev_priv->display.enable_fbc = g4x_enable_fbc;
8911 - dev_priv->display.disable_fbc = g4x_disable_fbc;
8912 -- } else if (IS_I965GM(dev) || IS_I945GM(dev) || IS_I915GM(dev)) {
8913 -+ } else if (IS_I965GM(dev)) {
8914 - dev_priv->display.fbc_enabled = i8xx_fbc_enabled;
8915 - dev_priv->display.enable_fbc = i8xx_enable_fbc;
8916 - dev_priv->display.disable_fbc = i8xx_disable_fbc;
8917 -diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
8918 -index be475e8..f16d60f 100644
8919 ---- a/drivers/hwmon/hp_accel.c
8920 -+++ b/drivers/hwmon/hp_accel.c
8921 -@@ -324,8 +324,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
8922 - lis3lv02d_joystick_disable();
8923 - lis3lv02d_poweroff(&lis3_dev);
8924 -
8925 -- flush_work(&hpled_led.work);
8926 - led_classdev_unregister(&hpled_led.led_classdev);
8927 -+ flush_work(&hpled_led.work);
8928 -
8929 - return lis3lv02d_remove_fs(&lis3_dev);
8930 - }
8931 -diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
8932 -index 8072128..ee337df 100644
8933 ---- a/drivers/mmc/host/atmel-mci.c
8934 -+++ b/drivers/mmc/host/atmel-mci.c
8935 -@@ -568,9 +568,10 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
8936 - {
8937 - struct mmc_data *data = host->data;
8938 -
8939 -- dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len,
8940 -- ((data->flags & MMC_DATA_WRITE)
8941 -- ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
8942 -+ if (data)
8943 -+ dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len,
8944 -+ ((data->flags & MMC_DATA_WRITE)
8945 -+ ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
8946 - }
8947 -
8948 - static void atmci_stop_dma(struct atmel_mci *host)
8949 -@@ -1098,8 +1099,8 @@ static void atmci_command_complete(struct atmel_mci *host,
8950 - "command error: status=0x%08x\n", status);
8951 -
8952 - if (cmd->data) {
8953 -- host->data = NULL;
8954 - atmci_stop_dma(host);
8955 -+ host->data = NULL;
8956 - mci_writel(host, IDR, MCI_NOTBUSY
8957 - | MCI_TXRDY | MCI_RXRDY
8958 - | ATMCI_DATA_ERROR_FLAGS);
8959 -@@ -1292,6 +1293,7 @@ static void atmci_tasklet_func(unsigned long priv)
8960 - } else {
8961 - data->bytes_xfered = data->blocks * data->blksz;
8962 - data->error = 0;
8963 -+ mci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS);
8964 - }
8965 -
8966 - if (!data->stop) {
8967 -@@ -1750,13 +1752,13 @@ static int __init atmci_probe(struct platform_device *pdev)
8968 - ret = -ENODEV;
8969 - if (pdata->slot[0].bus_width) {
8970 - ret = atmci_init_slot(host, &pdata->slot[0],
8971 -- MCI_SDCSEL_SLOT_A, 0);
8972 -+ 0, MCI_SDCSEL_SLOT_A);
8973 - if (!ret)
8974 - nr_slots++;
8975 - }
8976 - if (pdata->slot[1].bus_width) {
8977 - ret = atmci_init_slot(host, &pdata->slot[1],
8978 -- MCI_SDCSEL_SLOT_B, 1);
8979 -+ 1, MCI_SDCSEL_SLOT_B);
8980 - if (!ret)
8981 - nr_slots++;
8982 - }
8983 -diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
8984 -index c3ce920..8b7c267 100644
8985 ---- a/drivers/net/wireless/ath/ath9k/xmit.c
8986 -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
8987 -@@ -2244,7 +2244,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
8988 - if (ATH_TXQ_SETUP(sc, i)) {
8989 - txq = &sc->tx.txq[i];
8990 -
8991 -- spin_lock_bh(&txq->axq_lock);
8992 -+ spin_lock(&txq->axq_lock);
8993 -
8994 - list_for_each_entry_safe(ac,
8995 - ac_tmp, &txq->axq_acq, list) {
8996 -@@ -2265,7 +2265,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
8997 - }
8998 - }
8999 -
9000 -- spin_unlock_bh(&txq->axq_lock);
9001 -+ spin_unlock(&txq->axq_lock);
9002 - }
9003 - }
9004 - }
9005 -diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
9006 -index 3b4c5a4..82c1d2e 100644
9007 ---- a/drivers/net/wireless/iwlwifi/iwl-4965.c
9008 -+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
9009 -@@ -581,6 +581,11 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
9010 -
9011 - iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
9012 -
9013 -+ /* make sure all queue are not stopped */
9014 -+ memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
9015 -+ for (i = 0; i < 4; i++)
9016 -+ atomic_set(&priv->queue_stop_count[i], 0);
9017 -+
9018 - /* reset to 0 to enable all the queue first */
9019 - priv->txq_ctx_active_msk = 0;
9020 - /* Map each Tx/cmd queue to its corresponding fifo */
9021 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
9022 -index c610e5f..f7d41c7 100644
9023 ---- a/drivers/net/wireless/iwlwifi/iwl-5000.c
9024 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
9025 -@@ -657,6 +657,11 @@ int iwl5000_alive_notify(struct iwl_priv *priv)
9026 -
9027 - iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
9028 -
9029 -+ /* make sure all queue are not stopped */
9030 -+ memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
9031 -+ for (i = 0; i < 4; i++)
9032 -+ atomic_set(&priv->queue_stop_count[i], 0);
9033 -+
9034 - /* reset to 0 to enable all the queue first */
9035 - priv->txq_ctx_active_msk = 0;
9036 - /* map qos queues to fifos one-to-one */
9037 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
9038 -index b93e491..3534d86 100644
9039 ---- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
9040 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
9041 -@@ -298,10 +298,23 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
9042 - struct iwl_lq_sta *lq_data, u8 tid,
9043 - struct ieee80211_sta *sta)
9044 - {
9045 -+ int ret;
9046 -+
9047 - if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
9048 - IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
9049 - sta->addr, tid);
9050 -- ieee80211_start_tx_ba_session(sta, tid);
9051 -+ ret = ieee80211_start_tx_ba_session(sta, tid);
9052 -+ if (ret == -EAGAIN) {
9053 -+ /*
9054 -+ * driver and mac80211 is out of sync
9055 -+ * this might be cause by reloading firmware
9056 -+ * stop the tx ba session here
9057 -+ */
9058 -+ IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n",
9059 -+ tid);
9060 -+ ret = ieee80211_stop_tx_ba_session(sta, tid,
9061 -+ WLAN_BACK_INITIATOR);
9062 -+ }
9063 - }
9064 - }
9065 -
9066 -diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
9067 -index 88470fb..e0ce039 100644
9068 ---- a/drivers/net/wireless/iwlwifi/iwl-tx.c
9069 -+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
9070 -@@ -821,8 +821,10 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
9071 - hdr->seq_ctrl |= cpu_to_le16(seq_number);
9072 - seq_number += 0x10;
9073 - /* aggregation is on for this <sta,tid> */
9074 -- if (info->flags & IEEE80211_TX_CTL_AMPDU)
9075 -+ if (info->flags & IEEE80211_TX_CTL_AMPDU &&
9076 -+ priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) {
9077 - txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
9078 -+ }
9079 - }
9080 -
9081 - txq = &priv->txq[txq_id];
9082 -@@ -1347,7 +1349,7 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
9083 - {
9084 - int tx_fifo_id, txq_id, sta_id, ssn = -1;
9085 - struct iwl_tid_data *tid_data;
9086 -- int ret, write_ptr, read_ptr;
9087 -+ int write_ptr, read_ptr;
9088 - unsigned long flags;
9089 -
9090 - if (!ra) {
9091 -@@ -1399,13 +1401,17 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
9092 - priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
9093 -
9094 - spin_lock_irqsave(&priv->lock, flags);
9095 -- ret = priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, ssn,
9096 -+ /*
9097 -+ * the only reason this call can fail is queue number out of range,
9098 -+ * which can happen if uCode is reloaded and all the station
9099 -+ * information are lost. if it is outside the range, there is no need
9100 -+ * to deactivate the uCode queue, just return "success" to allow
9101 -+ * mac80211 to clean up it own data.
9102 -+ */
9103 -+ priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, ssn,
9104 - tx_fifo_id);
9105 - spin_unlock_irqrestore(&priv->lock, flags);
9106 -
9107 -- if (ret)
9108 -- return ret;
9109 --
9110 - ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid);
9111 -
9112 - return 0;
9113 -diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
9114 -index 5905936..e4bd795 100644
9115 ---- a/drivers/s390/block/dasd.c
9116 -+++ b/drivers/s390/block/dasd.c
9117 -@@ -35,6 +35,9 @@
9118 - */
9119 - #define DASD_CHANQ_MAX_SIZE 4
9120 -
9121 -+#define DASD_SLEEPON_START_TAG (void *) 1
9122 -+#define DASD_SLEEPON_END_TAG (void *) 2
9123 -+
9124 - /*
9125 - * SECTION: exported variables of dasd.c
9126 - */
9127 -@@ -1460,7 +1463,10 @@ void dasd_add_request_tail(struct dasd_ccw_req *cqr)
9128 - */
9129 - static void dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data)
9130 - {
9131 -- wake_up((wait_queue_head_t *) data);
9132 -+ spin_lock_irq(get_ccwdev_lock(cqr->startdev->cdev));
9133 -+ cqr->callback_data = DASD_SLEEPON_END_TAG;
9134 -+ spin_unlock_irq(get_ccwdev_lock(cqr->startdev->cdev));
9135 -+ wake_up(&generic_waitq);
9136 - }
9137 -
9138 - static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
9139 -@@ -1470,10 +1476,7 @@ static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
9140 -
9141 - device = cqr->startdev;
9142 - spin_lock_irq(get_ccwdev_lock(device->cdev));
9143 -- rc = ((cqr->status == DASD_CQR_DONE ||
9144 -- cqr->status == DASD_CQR_NEED_ERP ||
9145 -- cqr->status == DASD_CQR_TERMINATED) &&
9146 -- list_empty(&cqr->devlist));
9147 -+ rc = (cqr->callback_data == DASD_SLEEPON_END_TAG);
9148 - spin_unlock_irq(get_ccwdev_lock(device->cdev));
9149 - return rc;
9150 - }
9151 -@@ -1561,7 +1564,7 @@ static int _dasd_sleep_on(struct dasd_ccw_req *maincqr, int interruptible)
9152 - wait_event(generic_waitq, !(device->stopped));
9153 -
9154 - cqr->callback = dasd_wakeup_cb;
9155 -- cqr->callback_data = (void *) &generic_waitq;
9156 -+ cqr->callback_data = DASD_SLEEPON_START_TAG;
9157 - dasd_add_request_tail(cqr);
9158 - if (interruptible) {
9159 - rc = wait_event_interruptible(
9160 -@@ -1640,7 +1643,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
9161 - }
9162 -
9163 - cqr->callback = dasd_wakeup_cb;
9164 -- cqr->callback_data = (void *) &generic_waitq;
9165 -+ cqr->callback_data = DASD_SLEEPON_START_TAG;
9166 - cqr->status = DASD_CQR_QUEUED;
9167 - list_add(&cqr->devlist, &device->ccw_queue);
9168 -
9169 -diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
9170 -index d00fcf8..fd6b135 100644
9171 ---- a/drivers/serial/imx.c
9172 -+++ b/drivers/serial/imx.c
9173 -@@ -119,7 +119,8 @@
9174 - #define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */
9175 - #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
9176 - #define UCR3_BPEN (1<<0) /* Preset registers enable */
9177 --#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */
9178 -+#define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */
9179 -+#define UCR4_CTSTL_MASK 0x3F /* CTS trigger is 6 bits wide */
9180 - #define UCR4_INVR (1<<9) /* Inverted infrared reception */
9181 - #define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */
9182 - #define UCR4_WKEN (1<<7) /* Wake interrupt enable */
9183 -@@ -590,6 +591,9 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
9184 - return 0;
9185 - }
9186 -
9187 -+/* half the RX buffer size */
9188 -+#define CTSTL 16
9189 -+
9190 - static int imx_startup(struct uart_port *port)
9191 - {
9192 - struct imx_port *sport = (struct imx_port *)port;
9193 -@@ -606,6 +610,10 @@ static int imx_startup(struct uart_port *port)
9194 - if (USE_IRDA(sport))
9195 - temp |= UCR4_IRSC;
9196 -
9197 -+ /* set the trigger level for CTS */
9198 -+ temp &= ~(UCR4_CTSTL_MASK<< UCR4_CTSTL_SHF);
9199 -+ temp |= CTSTL<< UCR4_CTSTL_SHF;
9200 -+
9201 - writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
9202 -
9203 - if (USE_IRDA(sport)) {
9204 -diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
9205 -index 2549c53..6c8b6b6 100644
9206 ---- a/drivers/video/bfin-t350mcqb-fb.c
9207 -+++ b/drivers/video/bfin-t350mcqb-fb.c
9208 -@@ -515,9 +515,9 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
9209 - fbinfo->fbops = &bfin_t350mcqb_fb_ops;
9210 - fbinfo->flags = FBINFO_FLAG_DEFAULT;
9211 -
9212 -- info->fb_buffer =
9213 -- dma_alloc_coherent(NULL, fbinfo->fix.smem_len, &info->dma_handle,
9214 -- GFP_KERNEL);
9215 -+ info->fb_buffer = dma_alloc_coherent(NULL, fbinfo->fix.smem_len +
9216 -+ ACTIVE_VIDEO_MEM_OFFSET,
9217 -+ &info->dma_handle, GFP_KERNEL);
9218 -
9219 - if (NULL == info->fb_buffer) {
9220 - printk(KERN_ERR DRIVER_NAME
9221 -@@ -587,8 +587,8 @@ out7:
9222 - out6:
9223 - fb_dealloc_cmap(&fbinfo->cmap);
9224 - out4:
9225 -- dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
9226 -- info->dma_handle);
9227 -+ dma_free_coherent(NULL, fbinfo->fix.smem_len + ACTIVE_VIDEO_MEM_OFFSET,
9228 -+ info->fb_buffer, info->dma_handle);
9229 - out3:
9230 - framebuffer_release(fbinfo);
9231 - out2:
9232 -@@ -611,8 +611,9 @@ static int __devexit bfin_t350mcqb_remove(struct platform_device *pdev)
9233 - free_irq(info->irq, info);
9234 -
9235 - if (info->fb_buffer != NULL)
9236 -- dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
9237 -- info->dma_handle);
9238 -+ dma_free_coherent(NULL, fbinfo->fix.smem_len +
9239 -+ ACTIVE_VIDEO_MEM_OFFSET, info->fb_buffer,
9240 -+ info->dma_handle);
9241 -
9242 - fb_dealloc_cmap(&fbinfo->cmap);
9243 -
9244 -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
9245 -index 645a179..2c6ee6a 100644
9246 ---- a/fs/btrfs/ioctl.c
9247 -+++ b/fs/btrfs/ioctl.c
9248 -@@ -964,12 +964,17 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
9249 - ret = -EBADF;
9250 - goto out_drop_write;
9251 - }
9252 -+
9253 - src = src_file->f_dentry->d_inode;
9254 -
9255 - ret = -EINVAL;
9256 - if (src == inode)
9257 - goto out_fput;
9258 -
9259 -+ /* the src must be open for reading */
9260 -+ if (!(src_file->f_mode & FMODE_READ))
9261 -+ goto out_fput;
9262 -+
9263 - ret = -EISDIR;
9264 - if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode))
9265 - goto out_fput;
9266 -diff --git a/fs/cachefiles/security.c b/fs/cachefiles/security.c
9267 -index b5808cd..039b501 100644
9268 ---- a/fs/cachefiles/security.c
9269 -+++ b/fs/cachefiles/security.c
9270 -@@ -77,6 +77,8 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache,
9271 - /*
9272 - * check the security details of the on-disk cache
9273 - * - must be called with security override in force
9274 -+ * - must return with a security override in force - even in the case of an
9275 -+ * error
9276 - */
9277 - int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
9278 - struct dentry *root,
9279 -@@ -99,6 +101,8 @@ int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
9280 - * which create files */
9281 - ret = set_create_files_as(new, root->d_inode);
9282 - if (ret < 0) {
9283 -+ abort_creds(new);
9284 -+ cachefiles_begin_secure(cache, _saved_cred);
9285 - _leave(" = %d [cfa]", ret);
9286 - return ret;
9287 - }
9288 -diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
9289 -index ed751bb..2568889 100644
9290 ---- a/fs/cifs/cifsglob.h
9291 -+++ b/fs/cifs/cifsglob.h
9292 -@@ -500,6 +500,7 @@ struct dfs_info3_param {
9293 - #define CIFS_FATTR_DFS_REFERRAL 0x1
9294 - #define CIFS_FATTR_DELETE_PENDING 0x2
9295 - #define CIFS_FATTR_NEED_REVAL 0x4
9296 -+#define CIFS_FATTR_INO_COLLISION 0x8
9297 -
9298 - struct cifs_fattr {
9299 - u32 cf_flags;
9300 -diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
9301 -index e3fda97..7ec8555 100644
9302 ---- a/fs/cifs/inode.c
9303 -+++ b/fs/cifs/inode.c
9304 -@@ -610,6 +610,16 @@ cifs_find_inode(struct inode *inode, void *opaque)
9305 - if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid)
9306 - return 0;
9307 -
9308 -+ /*
9309 -+ * uh oh -- it's a directory. We can't use it since hardlinked dirs are
9310 -+ * verboten. Disable serverino and return it as if it were found, the
9311 -+ * caller can discard it, generate a uniqueid and retry the find
9312 -+ */
9313 -+ if (S_ISDIR(inode->i_mode) && !list_empty(&inode->i_dentry)) {
9314 -+ fattr->cf_flags |= CIFS_FATTR_INO_COLLISION;
9315 -+ cifs_autodisable_serverino(CIFS_SB(inode->i_sb));
9316 -+ }
9317 -+
9318 - return 1;
9319 - }
9320 -
9321 -@@ -629,15 +639,22 @@ cifs_iget(struct super_block *sb, struct cifs_fattr *fattr)
9322 - unsigned long hash;
9323 - struct inode *inode;
9324 -
9325 -+retry_iget5_locked:
9326 - cFYI(1, ("looking for uniqueid=%llu", fattr->cf_uniqueid));
9327 -
9328 - /* hash down to 32-bits on 32-bit arch */
9329 - hash = cifs_uniqueid_to_ino_t(fattr->cf_uniqueid);
9330 -
9331 - inode = iget5_locked(sb, hash, cifs_find_inode, cifs_init_inode, fattr);
9332 --
9333 -- /* we have fattrs in hand, update the inode */
9334 - if (inode) {
9335 -+ /* was there a problematic inode number collision? */
9336 -+ if (fattr->cf_flags & CIFS_FATTR_INO_COLLISION) {
9337 -+ iput(inode);
9338 -+ fattr->cf_uniqueid = iunique(sb, ROOT_I);
9339 -+ fattr->cf_flags &= ~CIFS_FATTR_INO_COLLISION;
9340 -+ goto retry_iget5_locked;
9341 -+ }
9342 -+
9343 - cifs_fattr_to_inode(inode, fattr);
9344 - if (sb->s_flags & MS_NOATIME)
9345 - inode->i_flags |= S_NOATIME | S_NOCMTIME;
9346 -diff --git a/fs/compat.c b/fs/compat.c
9347 -index 00d90c2..514b623 100644
9348 ---- a/fs/compat.c
9349 -+++ b/fs/compat.c
9350 -@@ -1530,8 +1530,6 @@ int compat_do_execve(char * filename,
9351 - if (retval < 0)
9352 - goto out;
9353 -
9354 -- current->stack_start = current->mm->start_stack;
9355 --
9356 - /* execve succeeded */
9357 - current->fs->in_exec = 0;
9358 - current->in_execve = 0;
9359 -diff --git a/fs/exec.c b/fs/exec.c
9360 -index 9071360..332f781 100644
9361 ---- a/fs/exec.c
9362 -+++ b/fs/exec.c
9363 -@@ -1386,8 +1386,6 @@ int do_execve(char * filename,
9364 - if (retval < 0)
9365 - goto out;
9366 -
9367 -- current->stack_start = current->mm->start_stack;
9368 --
9369 - /* execve succeeded */
9370 - current->fs->in_exec = 0;
9371 - current->in_execve = 0;
9372 -diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
9373 -index 8173fae..4d3ddcc 100644
9374 ---- a/fs/nilfs2/super.c
9375 -+++ b/fs/nilfs2/super.c
9376 -@@ -746,6 +746,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent,
9377 - sb->s_export_op = &nilfs_export_ops;
9378 - sb->s_root = NULL;
9379 - sb->s_time_gran = 1;
9380 -+ sb->s_bdi = nilfs->ns_bdi;
9381 -
9382 - err = load_nilfs(nilfs, sbi);
9383 - if (err)
9384 -diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
9385 -index 1afb0a1..e27960c 100644
9386 ---- a/fs/notify/inotify/inotify_fsnotify.c
9387 -+++ b/fs/notify/inotify/inotify_fsnotify.c
9388 -@@ -28,6 +28,7 @@
9389 - #include <linux/path.h> /* struct path */
9390 - #include <linux/slab.h> /* kmem_* */
9391 - #include <linux/types.h>
9392 -+#include <linux/sched.h>
9393 -
9394 - #include "inotify.h"
9395 -
9396 -@@ -146,6 +147,7 @@ static void inotify_free_group_priv(struct fsnotify_group *group)
9397 - idr_for_each(&group->inotify_data.idr, idr_callback, group);
9398 - idr_remove_all(&group->inotify_data.idr);
9399 - idr_destroy(&group->inotify_data.idr);
9400 -+ free_uid(group->inotify_data.user);
9401 - }
9402 -
9403 - void inotify_free_event_priv(struct fsnotify_event_private_data *fsn_event_priv)
9404 -diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
9405 -index a94e8bd..75aa15a 100644
9406 ---- a/fs/notify/inotify/inotify_user.c
9407 -+++ b/fs/notify/inotify/inotify_user.c
9408 -@@ -550,21 +550,24 @@ retry:
9409 - if (unlikely(!idr_pre_get(&group->inotify_data.idr, GFP_KERNEL)))
9410 - goto out_err;
9411 -
9412 -+ /* we are putting the mark on the idr, take a reference */
9413 -+ fsnotify_get_mark(&tmp_ientry->fsn_entry);
9414 -+
9415 - spin_lock(&group->inotify_data.idr_lock);
9416 - ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry,
9417 - group->inotify_data.last_wd+1,
9418 - &tmp_ientry->wd);
9419 - spin_unlock(&group->inotify_data.idr_lock);
9420 - if (ret) {
9421 -+ /* we didn't get on the idr, drop the idr reference */
9422 -+ fsnotify_put_mark(&tmp_ientry->fsn_entry);
9423 -+
9424 - /* idr was out of memory allocate and try again */
9425 - if (ret == -EAGAIN)
9426 - goto retry;
9427 - goto out_err;
9428 - }
9429 -
9430 -- /* we put the mark on the idr, take a reference */
9431 -- fsnotify_get_mark(&tmp_ientry->fsn_entry);
9432 --
9433 - /* we are on the idr, now get on the inode */
9434 - ret = fsnotify_add_mark(&tmp_ientry->fsn_entry, group, inode);
9435 - if (ret) {
9436 -diff --git a/fs/proc/array.c b/fs/proc/array.c
9437 -index 13b5d07..69eb4c4 100644
9438 ---- a/fs/proc/array.c
9439 -+++ b/fs/proc/array.c
9440 -@@ -82,7 +82,6 @@
9441 - #include <linux/pid_namespace.h>
9442 - #include <linux/ptrace.h>
9443 - #include <linux/tracehook.h>
9444 --#include <linux/swapops.h>
9445 -
9446 - #include <asm/pgtable.h>
9447 - #include <asm/processor.h>
9448 -@@ -494,7 +493,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
9449 - rsslim,
9450 - mm ? mm->start_code : 0,
9451 - mm ? mm->end_code : 0,
9452 -- (permitted && mm) ? task->stack_start : 0,
9453 -+ (permitted && mm) ? mm->start_stack : 0,
9454 - esp,
9455 - eip,
9456 - /* The signal information here is obsolete.
9457 -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
9458 -index f277c4a..9df34a5 100644
9459 ---- a/fs/proc/task_mmu.c
9460 -+++ b/fs/proc/task_mmu.c
9461 -@@ -243,25 +243,6 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
9462 - } else if (vma->vm_start <= mm->start_stack &&
9463 - vma->vm_end >= mm->start_stack) {
9464 - name = "[stack]";
9465 -- } else {
9466 -- unsigned long stack_start;
9467 -- struct proc_maps_private *pmp;
9468 --
9469 -- pmp = m->private;
9470 -- stack_start = pmp->task->stack_start;
9471 --
9472 -- if (vma->vm_start <= stack_start &&
9473 -- vma->vm_end >= stack_start) {
9474 -- pad_len_spaces(m, len);
9475 -- seq_printf(m,
9476 -- "[threadstack:%08lx]",
9477 --#ifdef CONFIG_STACK_GROWSUP
9478 -- vma->vm_end - stack_start
9479 --#else
9480 -- stack_start - vma->vm_start
9481 --#endif
9482 -- );
9483 -- }
9484 - }
9485 - } else {
9486 - name = "[vdso]";
9487 -diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
9488 -index e694263..6920695 100644
9489 ---- a/include/asm-generic/dma-mapping-common.h
9490 -+++ b/include/asm-generic/dma-mapping-common.h
9491 -@@ -131,7 +131,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
9492 - debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
9493 -
9494 - } else
9495 -- dma_sync_single_for_cpu(dev, addr, size, dir);
9496 -+ dma_sync_single_for_cpu(dev, addr + offset, size, dir);
9497 - }
9498 -
9499 - static inline void dma_sync_single_range_for_device(struct device *dev,
9500 -@@ -148,7 +148,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
9501 - debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
9502 -
9503 - } else
9504 -- dma_sync_single_for_device(dev, addr, size, dir);
9505 -+ dma_sync_single_for_device(dev, addr + offset, size, dir);
9506 - }
9507 -
9508 - static inline void
9509 -diff --git a/include/linux/sched.h b/include/linux/sched.h
9510 -index 1f5fa53..db821a4 100644
9511 ---- a/include/linux/sched.h
9512 -+++ b/include/linux/sched.h
9513 -@@ -1560,7 +1560,6 @@ struct task_struct {
9514 - /* bitmask of trace recursion */
9515 - unsigned long trace_recursion;
9516 - #endif /* CONFIG_TRACING */
9517 -- unsigned long stack_start;
9518 - #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
9519 - struct memcg_batch_info {
9520 - int do_batch; /* incremented when batch uncharge started */
9521 -diff --git a/kernel/fork.c b/kernel/fork.c
9522 -index f88bd98..0ea67a3 100644
9523 ---- a/kernel/fork.c
9524 -+++ b/kernel/fork.c
9525 -@@ -1134,8 +1134,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
9526 -
9527 - p->bts = NULL;
9528 -
9529 -- p->stack_start = stack_start;
9530 --
9531 - /* Perform scheduler related setup. Assign this task to a CPU. */
9532 - sched_fork(p, clone_flags);
9533 -
9534 -diff --git a/kernel/profile.c b/kernel/profile.c
9535 -index a55d3a3..dfadc5b 100644
9536 ---- a/kernel/profile.c
9537 -+++ b/kernel/profile.c
9538 -@@ -127,8 +127,10 @@ int __ref profile_init(void)
9539 - return 0;
9540 -
9541 - prof_buffer = vmalloc(buffer_bytes);
9542 -- if (prof_buffer)
9543 -+ if (prof_buffer) {
9544 -+ memset(prof_buffer, 0, buffer_bytes);
9545 - return 0;
9546 -+ }
9547 -
9548 - free_cpumask_var(prof_cpu_mask);
9549 - return -ENOMEM;
9550 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
9551 -index fd9ba95..e8d9544 100644
9552 ---- a/mm/hugetlb.c
9553 -+++ b/mm/hugetlb.c
9554 -@@ -1039,7 +1039,7 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
9555 - page = alloc_buddy_huge_page(h, vma, addr);
9556 - if (!page) {
9557 - hugetlb_put_quota(inode->i_mapping, chg);
9558 -- return ERR_PTR(-VM_FAULT_OOM);
9559 -+ return ERR_PTR(-VM_FAULT_SIGBUS);
9560 - }
9561 - }
9562 -
9563 -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
9564 -index 16190ca..955f0b2 100644
9565 ---- a/net/ipv4/udp.c
9566 -+++ b/net/ipv4/udp.c
9567 -@@ -1527,6 +1527,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
9568 -
9569 - uh = udp_hdr(skb);
9570 - ulen = ntohs(uh->len);
9571 -+ saddr = ip_hdr(skb)->saddr;
9572 -+ daddr = ip_hdr(skb)->daddr;
9573 -+
9574 - if (ulen > skb->len)
9575 - goto short_packet;
9576 -
9577 -@@ -1540,9 +1543,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
9578 - if (udp4_csum_init(skb, uh, proto))
9579 - goto csum_error;
9580 -
9581 -- saddr = ip_hdr(skb)->saddr;
9582 -- daddr = ip_hdr(skb)->daddr;
9583 --
9584 - if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
9585 - return __udp4_lib_mcast_deliver(net, skb, uh,
9586 - saddr, daddr, udptable);
9587 -diff --git a/security/min_addr.c b/security/min_addr.c
9588 -index e86f297..f728728 100644
9589 ---- a/security/min_addr.c
9590 -+++ b/security/min_addr.c
9591 -@@ -33,7 +33,7 @@ int mmap_min_addr_handler(struct ctl_table *table, int write,
9592 - {
9593 - int ret;
9594 -
9595 -- if (!capable(CAP_SYS_RAWIO))
9596 -+ if (write && !capable(CAP_SYS_RAWIO))
9597 - return -EPERM;
9598 -
9599 - ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
9600 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
9601 -index fd831bd..a747871 100644
9602 ---- a/sound/pci/hda/hda_intel.c
9603 -+++ b/sound/pci/hda/hda_intel.c
9604 -@@ -2718,6 +2718,7 @@ static struct pci_device_id azx_ids[] = {
9605 - { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH },
9606 - /* PCH */
9607 - { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_ICH },
9608 -+ { PCI_DEVICE(0x8086, 0x3b57), .driver_data = AZX_DRIVER_ICH },
9609 - /* CPT */
9610 - { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH },
9611 - /* SCH */
9612 -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
9613 -index 1a97c81..a978645 100644
9614 ---- a/sound/pci/hda/patch_conexant.c
9615 -+++ b/sound/pci/hda/patch_conexant.c
9616 -@@ -1176,9 +1176,10 @@ static int patch_cxt5045(struct hda_codec *codec)
9617 - case 0x103c:
9618 - case 0x1631:
9619 - case 0x1734:
9620 -- /* HP, Packard Bell, & Fujitsu-Siemens laptops have really bad
9621 -- * sound over 0dB on NID 0x17. Fix max PCM level to 0 dB
9622 -- * (originally it has 0x2b steps with 0dB offset 0x14)
9623 -+ case 0x17aa:
9624 -+ /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have
9625 -+ * really bad sound over 0dB on NID 0x17. Fix max PCM level to
9626 -+ * 0 dB (originally it has 0x2b steps with 0dB offset 0x14)
9627 - */
9628 - snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
9629 - (0x14 << AC_AMPCAP_OFFSET_SHIFT) |
9630 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
9631 -index b486daa..abfc558 100644
9632 ---- a/sound/pci/hda/patch_realtek.c
9633 -+++ b/sound/pci/hda/patch_realtek.c
9634 -@@ -17348,7 +17348,6 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
9635 - ALC662_3ST_6ch_DIG),
9636 - SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
9637 - ALC663_ASUS_H13),
9638 -- SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
9639 - {}
9640 - };
9641 -
9642 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
9643 -index ac2d528..cb474c0 100644
9644 ---- a/sound/pci/hda/patch_sigmatel.c
9645 -+++ b/sound/pci/hda/patch_sigmatel.c
9646 -@@ -1539,11 +1539,9 @@ static unsigned int alienware_m17x_pin_configs[13] = {
9647 - 0x904601b0,
9648 - };
9649 -
9650 --static unsigned int intel_dg45id_pin_configs[14] = {
9651 -+static unsigned int intel_dg45id_pin_configs[13] = {
9652 - 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
9653 -- 0x01A19250, 0x01011212, 0x01016211, 0x40f000f0,
9654 -- 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x014510A0,
9655 -- 0x074510B0, 0x40f000f0
9656 -+ 0x01A19250, 0x01011212, 0x01016211
9657 - };
9658 -
9659 - static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
9660 -diff --git a/sound/pci/ice1712/maya44.c b/sound/pci/ice1712/maya44.c
9661 -index 3e1c20a..726fd4b 100644
9662 ---- a/sound/pci/ice1712/maya44.c
9663 -+++ b/sound/pci/ice1712/maya44.c
9664 -@@ -347,7 +347,7 @@ static int maya_gpio_sw_put(struct snd_kcontrol *kcontrol,
9665 -
9666 - /* known working input slots (0-4) */
9667 - #define MAYA_LINE_IN 1 /* in-2 */
9668 --#define MAYA_MIC_IN 4 /* in-5 */
9669 -+#define MAYA_MIC_IN 3 /* in-4 */
9670 -
9671 - static void wm8776_select_input(struct snd_maya44 *chip, int idx, int line)
9672 - {
9673 -@@ -393,8 +393,8 @@ static int maya_rec_src_put(struct snd_kcontrol *kcontrol,
9674 - int changed;
9675 -
9676 - mutex_lock(&chip->mutex);
9677 -- changed = maya_set_gpio_bits(chip->ice, GPIO_MIC_RELAY,
9678 -- sel ? GPIO_MIC_RELAY : 0);
9679 -+ changed = maya_set_gpio_bits(chip->ice, 1 << GPIO_MIC_RELAY,
9680 -+ sel ? (1 << GPIO_MIC_RELAY) : 0);
9681 - wm8776_select_input(chip, 0, sel ? MAYA_MIC_IN : MAYA_LINE_IN);
9682 - mutex_unlock(&chip->mutex);
9683 - return changed;
9684 -diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
9685 -index 16c226b..7c4986b 100644
9686 ---- a/sound/pci/oxygen/xonar_cs43xx.c
9687 -+++ b/sound/pci/oxygen/xonar_cs43xx.c
9688 -@@ -56,6 +56,7 @@
9689 - #include <sound/pcm_params.h>
9690 - #include <sound/tlv.h>
9691 - #include "xonar.h"
9692 -+#include "cm9780.h"
9693 - #include "cs4398.h"
9694 - #include "cs4362a.h"
9695 -
9696 -@@ -172,6 +173,8 @@ static void xonar_d1_init(struct oxygen *chip)
9697 - oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA,
9698 - GPIO_D1_FRONT_PANEL | GPIO_D1_INPUT_ROUTE);
9699 -
9700 -+ oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC);
9701 -+
9702 - xonar_init_cs53x1(chip);
9703 - xonar_enable_output(chip);
9704 -
9705
9706 Added: genpatches-2.6/trunk/2.6.33/1004_linux-2.6.33.5.patch
9707 ===================================================================
9708 --- genpatches-2.6/trunk/2.6.33/1004_linux-2.6.33.5.patch (rev 0)
9709 +++ genpatches-2.6/trunk/2.6.33/1004_linux-2.6.33.5.patch 2010-07-05 23:09:19 UTC (rev 1721)
9710 @@ -0,0 +1,1623 @@
9711 +diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
9712 +index 0d07513..bf241be 100644
9713 +--- a/Documentation/filesystems/proc.txt
9714 ++++ b/Documentation/filesystems/proc.txt
9715 +@@ -308,7 +308,7 @@ address perms offset dev inode pathname
9716 + 08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test
9717 + 0804a000-0806b000 rw-p 00000000 00:00 0 [heap]
9718 + a7cb1000-a7cb2000 ---p 00000000 00:00 0
9719 +-a7cb2000-a7eb2000 rw-p 00000000 00:00 0 [threadstack:001ff4b4]
9720 ++a7cb2000-a7eb2000 rw-p 00000000 00:00 0
9721 + a7eb2000-a7eb3000 ---p 00000000 00:00 0
9722 + a7eb3000-a7ed5000 rw-p 00000000 00:00 0
9723 + a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6
9724 +@@ -344,7 +344,6 @@ is not associated with a file:
9725 + [stack] = the stack of the main process
9726 + [vdso] = the "virtual dynamic shared object",
9727 + the kernel system call handler
9728 +- [threadstack:xxxxxxxx] = the stack of the thread, xxxxxxxx is the stack size
9729 +
9730 + or if empty, the mapping is anonymous.
9731 +
9732 +diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
9733 +index 9f4c9d4..bd100fc 100644
9734 +--- a/arch/powerpc/include/asm/hw_irq.h
9735 ++++ b/arch/powerpc/include/asm/hw_irq.h
9736 +@@ -130,43 +130,5 @@ static inline int irqs_disabled_flags(unsigned long flags)
9737 + */
9738 + struct irq_chip;
9739 +
9740 +-#ifdef CONFIG_PERF_EVENTS
9741 +-
9742 +-#ifdef CONFIG_PPC64
9743 +-static inline unsigned long test_perf_event_pending(void)
9744 +-{
9745 +- unsigned long x;
9746 +-
9747 +- asm volatile("lbz %0,%1(13)"
9748 +- : "=r" (x)
9749 +- : "i" (offsetof(struct paca_struct, perf_event_pending)));
9750 +- return x;
9751 +-}
9752 +-
9753 +-static inline void set_perf_event_pending(void)
9754 +-{
9755 +- asm volatile("stb %0,%1(13)" : :
9756 +- "r" (1),
9757 +- "i" (offsetof(struct paca_struct, perf_event_pending)));
9758 +-}
9759 +-
9760 +-static inline void clear_perf_event_pending(void)
9761 +-{
9762 +- asm volatile("stb %0,%1(13)" : :
9763 +- "r" (0),
9764 +- "i" (offsetof(struct paca_struct, perf_event_pending)));
9765 +-}
9766 +-#endif /* CONFIG_PPC64 */
9767 +-
9768 +-#else /* CONFIG_PERF_EVENTS */
9769 +-
9770 +-static inline unsigned long test_perf_event_pending(void)
9771 +-{
9772 +- return 0;
9773 +-}
9774 +-
9775 +-static inline void clear_perf_event_pending(void) {}
9776 +-#endif /* CONFIG_PERF_EVENTS */
9777 +-
9778 + #endif /* __KERNEL__ */
9779 + #endif /* _ASM_POWERPC_HW_IRQ_H */
9780 +diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
9781 +index a6c2b63..11d0668 100644
9782 +--- a/arch/powerpc/kernel/asm-offsets.c
9783 ++++ b/arch/powerpc/kernel/asm-offsets.c
9784 +@@ -133,7 +133,6 @@ int main(void)
9785 + DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
9786 + DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
9787 + DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled));
9788 +- DEFINE(PACAPERFPEND, offsetof(struct paca_struct, perf_event_pending));
9789 + DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
9790 + #ifdef CONFIG_PPC_MM_SLICES
9791 + DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct,
9792 +diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
9793 +index bdcb557..afbf400 100644
9794 +--- a/arch/powerpc/kernel/entry_64.S
9795 ++++ b/arch/powerpc/kernel/entry_64.S
9796 +@@ -556,15 +556,6 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)
9797 + 2:
9798 + TRACE_AND_RESTORE_IRQ(r5);
9799 +
9800 +-#ifdef CONFIG_PERF_EVENTS
9801 +- /* check paca->perf_event_pending if we're enabling ints */
9802 +- lbz r3,PACAPERFPEND(r13)
9803 +- and. r3,r3,r5
9804 +- beq 27f
9805 +- bl .perf_event_do_pending
9806 +-27:
9807 +-#endif /* CONFIG_PERF_EVENTS */
9808 +-
9809 + /* extract EE bit and use it to restore paca->hard_enabled */
9810 + ld r3,_MSR(r1)
9811 + rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */
9812 +diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
9813 +index 9040330..dee83b8 100644
9814 +--- a/arch/powerpc/kernel/irq.c
9815 ++++ b/arch/powerpc/kernel/irq.c
9816 +@@ -53,7 +53,6 @@
9817 + #include <linux/bootmem.h>
9818 + #include <linux/pci.h>
9819 + #include <linux/debugfs.h>
9820 +-#include <linux/perf_event.h>
9821 +
9822 + #include <asm/uaccess.h>
9823 + #include <asm/system.h>
9824 +@@ -143,11 +142,6 @@ notrace void raw_local_irq_restore(unsigned long en)
9825 + }
9826 + #endif /* CONFIG_PPC_STD_MMU_64 */
9827 +
9828 +- if (test_perf_event_pending()) {
9829 +- clear_perf_event_pending();
9830 +- perf_event_do_pending();
9831 +- }
9832 +-
9833 + /*
9834 + * if (get_paca()->hard_enabled) return;
9835 + * But again we need to take care that gcc gets hard_enabled directly
9836 +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
9837 +index 6c6093d..6f174e7 100644
9838 +--- a/arch/powerpc/kernel/time.c
9839 ++++ b/arch/powerpc/kernel/time.c
9840 +@@ -532,25 +532,60 @@ void __init iSeries_time_init_early(void)
9841 + }
9842 + #endif /* CONFIG_PPC_ISERIES */
9843 +
9844 +-#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_PPC32)
9845 +-DEFINE_PER_CPU(u8, perf_event_pending);
9846 ++#ifdef CONFIG_PERF_EVENTS
9847 +
9848 +-void set_perf_event_pending(void)
9849 ++/*
9850 ++ * 64-bit uses a byte in the PACA, 32-bit uses a per-cpu variable...
9851 ++ */
9852 ++#ifdef CONFIG_PPC64
9853 ++static inline unsigned long test_perf_event_pending(void)
9854 + {
9855 +- get_cpu_var(perf_event_pending) = 1;
9856 +- set_dec(1);
9857 +- put_cpu_var(perf_event_pending);
9858 ++ unsigned long x;
9859 ++
9860 ++ asm volatile("lbz %0,%1(13)"
9861 ++ : "=r" (x)
9862 ++ : "i" (offsetof(struct paca_struct, perf_event_pending)));
9863 ++ return x;
9864 + }
9865 +
9866 ++static inline void set_perf_event_pending_flag(void)
9867 ++{
9868 ++ asm volatile("stb %0,%1(13)" : :
9869 ++ "r" (1),
9870 ++ "i" (offsetof(struct paca_struct, perf_event_pending)));
9871 ++}
9872 ++
9873 ++static inline void clear_perf_event_pending(void)
9874 ++{
9875 ++ asm volatile("stb %0,%1(13)" : :
9876 ++ "r" (0),
9877 ++ "i" (offsetof(struct paca_struct, perf_event_pending)));
9878 ++}
9879 ++
9880 ++#else /* 32-bit */
9881 ++
9882 ++DEFINE_PER_CPU(u8, perf_event_pending);
9883 ++
9884 ++#define set_perf_event_pending_flag() __get_cpu_var(perf_event_pending) = 1
9885 + #define test_perf_event_pending() __get_cpu_var(perf_event_pending)
9886 + #define clear_perf_event_pending() __get_cpu_var(perf_event_pending) = 0
9887 +
9888 +-#else /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */
9889 ++#endif /* 32 vs 64 bit */
9890 ++
9891 ++void set_perf_event_pending(void)
9892 ++{
9893 ++ preempt_disable();
9894 ++ set_perf_event_pending_flag();
9895 ++ set_dec(1);
9896 ++ preempt_enable();
9897 ++}
9898 ++
9899 ++#else /* CONFIG_PERF_EVENTS */
9900 +
9901 + #define test_perf_event_pending() 0
9902 + #define clear_perf_event_pending()
9903 +
9904 +-#endif /* CONFIG_PERF_EVENTS && CONFIG_PPC32 */
9905 ++#endif /* CONFIG_PERF_EVENTS */
9906 +
9907 + /*
9908 + * For iSeries shared processors, we have to let the hypervisor
9909 +@@ -580,10 +615,6 @@ void timer_interrupt(struct pt_regs * regs)
9910 + set_dec(DECREMENTER_MAX);
9911 +
9912 + #ifdef CONFIG_PPC32
9913 +- if (test_perf_event_pending()) {
9914 +- clear_perf_event_pending();
9915 +- perf_event_do_pending();
9916 +- }
9917 + if (atomic_read(&ppc_n_lost_interrupts) != 0)
9918 + do_IRQ(regs);
9919 + #endif
9920 +@@ -602,6 +633,11 @@ void timer_interrupt(struct pt_regs * regs)
9921 +
9922 + calculate_steal_time();
9923 +
9924 ++ if (test_perf_event_pending()) {
9925 ++ clear_perf_event_pending();
9926 ++ perf_event_do_pending();
9927 ++ }
9928 ++
9929 + #ifdef CONFIG_PPC_ISERIES
9930 + if (firmware_has_feature(FW_FEATURE_ISERIES))
9931 + get_lppaca()->int_dword.fields.decr_int = 0;
9932 +diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
9933 +index 7cf4642..11e94de 100644
9934 +--- a/arch/s390/kernel/ptrace.c
9935 ++++ b/arch/s390/kernel/ptrace.c
9936 +@@ -640,7 +640,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
9937 +
9938 + asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
9939 + {
9940 +- long ret;
9941 ++ long ret = 0;
9942 +
9943 + /* Do the secure computing check first. */
9944 + secure_computing(regs->gprs[2]);
9945 +@@ -649,7 +649,6 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
9946 + * The sysc_tracesys code in entry.S stored the system
9947 + * call number to gprs[2].
9948 + */
9949 +- ret = regs->gprs[2];
9950 + if (test_thread_flag(TIF_SYSCALL_TRACE) &&
9951 + (tracehook_report_syscall_entry(regs) ||
9952 + regs->gprs[2] >= NR_syscalls)) {
9953 +@@ -671,7 +670,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
9954 + regs->gprs[2], regs->orig_gpr2,
9955 + regs->gprs[3], regs->gprs[4],
9956 + regs->gprs[5]);
9957 +- return ret;
9958 ++ return ret ?: regs->gprs[2];
9959 + }
9960 +
9961 + asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
9962 +diff --git a/arch/x86/include/asm/k8.h b/arch/x86/include/asm/k8.h
9963 +index f70e600..af00bd1 100644
9964 +--- a/arch/x86/include/asm/k8.h
9965 ++++ b/arch/x86/include/asm/k8.h
9966 +@@ -16,11 +16,16 @@ extern int k8_numa_init(unsigned long start_pfn, unsigned long end_pfn);
9967 + extern int k8_scan_nodes(void);
9968 +
9969 + #ifdef CONFIG_K8_NB
9970 ++extern int num_k8_northbridges;
9971 ++
9972 + static inline struct pci_dev *node_to_k8_nb_misc(int node)
9973 + {
9974 + return (node < num_k8_northbridges) ? k8_northbridges[node] : NULL;
9975 + }
9976 ++
9977 + #else
9978 ++#define num_k8_northbridges 0
9979 ++
9980 + static inline struct pci_dev *node_to_k8_nb_misc(int node)
9981 + {
9982 + return NULL;
9983 +diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
9984 +index d440123..581924b 100644
9985 +--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
9986 ++++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
9987 +@@ -338,6 +338,10 @@ amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf)
9988 + (boot_cpu_data.x86_mask < 0x1)))
9989 + return;
9990 +
9991 ++ /* not in virtualized environments */
9992 ++ if (num_k8_northbridges == 0)
9993 ++ return;
9994 ++
9995 + this_leaf->can_disable = true;
9996 + this_leaf->l3_indices = amd_calc_l3_indices();
9997 + }
9998 +diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
9999 +index 999c8a6..0571b72 100644
10000 +--- a/arch/x86/kernel/process.c
10001 ++++ b/arch/x86/kernel/process.c
10002 +@@ -539,11 +539,13 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
10003 + * check OSVW bit for CPUs that are not affected
10004 + * by erratum #400
10005 + */
10006 +- rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
10007 +- if (val >= 2) {
10008 +- rdmsrl(MSR_AMD64_OSVW_STATUS, val);
10009 +- if (!(val & BIT(1)))
10010 +- goto no_c1e_idle;
10011 ++ if (cpu_has(c, X86_FEATURE_OSVW)) {
10012 ++ rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
10013 ++ if (val >= 2) {
10014 ++ rdmsrl(MSR_AMD64_OSVW_STATUS, val);
10015 ++ if (!(val & BIT(1)))
10016 ++ goto no_c1e_idle;
10017 ++ }
10018 + }
10019 + return 1;
10020 + }
10021 +diff --git a/crypto/authenc.c b/crypto/authenc.c
10022 +index 4d6f49a..0d54de9 100644
10023 +--- a/crypto/authenc.c
10024 ++++ b/crypto/authenc.c
10025 +@@ -46,6 +46,12 @@ struct authenc_request_ctx {
10026 + char tail[];
10027 + };
10028 +
10029 ++static void authenc_request_complete(struct aead_request *req, int err)
10030 ++{
10031 ++ if (err != -EINPROGRESS)
10032 ++ aead_request_complete(req, err);
10033 ++}
10034 ++
10035 + static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
10036 + unsigned int keylen)
10037 + {
10038 +@@ -142,7 +148,7 @@ static void authenc_geniv_ahash_update_done(struct crypto_async_request *areq,
10039 + crypto_aead_authsize(authenc), 1);
10040 +
10041 + out:
10042 +- aead_request_complete(req, err);
10043 ++ authenc_request_complete(req, err);
10044 + }
10045 +
10046 + static void authenc_geniv_ahash_done(struct crypto_async_request *areq, int err)
10047 +@@ -208,7 +214,7 @@ static void authenc_verify_ahash_update_done(struct crypto_async_request *areq,
10048 + err = crypto_ablkcipher_decrypt(abreq);
10049 +
10050 + out:
10051 +- aead_request_complete(req, err);
10052 ++ authenc_request_complete(req, err);
10053 + }
10054 +
10055 + static void authenc_verify_ahash_done(struct crypto_async_request *areq,
10056 +@@ -245,7 +251,7 @@ static void authenc_verify_ahash_done(struct crypto_async_request *areq,
10057 + err = crypto_ablkcipher_decrypt(abreq);
10058 +
10059 + out:
10060 +- aead_request_complete(req, err);
10061 ++ authenc_request_complete(req, err);
10062 + }
10063 +
10064 + static u8 *crypto_authenc_ahash_fb(struct aead_request *req, unsigned int flags)
10065 +@@ -379,7 +385,7 @@ static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
10066 + err = crypto_authenc_genicv(areq, iv, 0);
10067 + }
10068 +
10069 +- aead_request_complete(areq, err);
10070 ++ authenc_request_complete(areq, err);
10071 + }
10072 +
10073 + static int crypto_authenc_encrypt(struct aead_request *req)
10074 +@@ -418,7 +424,7 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req,
10075 + err = crypto_authenc_genicv(areq, greq->giv, 0);
10076 + }
10077 +
10078 +- aead_request_complete(areq, err);
10079 ++ authenc_request_complete(areq, err);
10080 + }
10081 +
10082 + static int crypto_authenc_givencrypt(struct aead_givcrypt_request *req)
10083 +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
10084 +index 7c85265..9ed9292 100644
10085 +--- a/drivers/acpi/sleep.c
10086 ++++ b/drivers/acpi/sleep.c
10087 +@@ -475,101 +475,13 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
10088 + },
10089 + {
10090 + .callback = init_set_sci_en_on_resume,
10091 +- .ident = "Lenovo ThinkPad X201",
10092 ++ .ident = "Lenovo ThinkPad X201[s]",
10093 + .matches = {
10094 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10095 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
10096 + },
10097 + },
10098 + {
10099 +- .callback = init_set_sci_en_on_resume,
10100 +- .ident = "Lenovo ThinkPad X201",
10101 +- .matches = {
10102 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10103 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
10104 +- },
10105 +- },
10106 +- {
10107 +- .callback = init_set_sci_en_on_resume,
10108 +- .ident = "Lenovo ThinkPad T410",
10109 +- .matches = {
10110 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10111 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
10112 +- },
10113 +- },
10114 +- {
10115 +- .callback = init_set_sci_en_on_resume,
10116 +- .ident = "Lenovo ThinkPad T510",
10117 +- .matches = {
10118 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10119 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
10120 +- },
10121 +- },
10122 +- {
10123 +- .callback = init_set_sci_en_on_resume,
10124 +- .ident = "Lenovo ThinkPad W510",
10125 +- .matches = {
10126 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10127 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
10128 +- },
10129 +- },
10130 +- {
10131 +- .callback = init_set_sci_en_on_resume,
10132 +- .ident = "Lenovo ThinkPad X201",
10133 +- .matches = {
10134 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10135 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
10136 +- },
10137 +- },
10138 +- {
10139 +- .callback = init_set_sci_en_on_resume,
10140 +- .ident = "Lenovo ThinkPad X201",
10141 +- .matches = {
10142 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10143 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
10144 +- },
10145 +- },
10146 +- {
10147 +- .callback = init_set_sci_en_on_resume,
10148 +- .ident = "Lenovo ThinkPad T410",
10149 +- .matches = {
10150 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10151 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
10152 +- },
10153 +- },
10154 +- {
10155 +- .callback = init_set_sci_en_on_resume,
10156 +- .ident = "Lenovo ThinkPad T510",
10157 +- .matches = {
10158 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10159 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
10160 +- },
10161 +- },
10162 +- {
10163 +- .callback = init_set_sci_en_on_resume,
10164 +- .ident = "Lenovo ThinkPad W510",
10165 +- .matches = {
10166 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10167 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
10168 +- },
10169 +- },
10170 +- {
10171 +- .callback = init_set_sci_en_on_resume,
10172 +- .ident = "Lenovo ThinkPad X201",
10173 +- .matches = {
10174 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10175 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
10176 +- },
10177 +- },
10178 +- {
10179 +- .callback = init_set_sci_en_on_resume,
10180 +- .ident = "Lenovo ThinkPad X201",
10181 +- .matches = {
10182 +- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
10183 +- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
10184 +- },
10185 +- },
10186 +- {
10187 + .callback = init_old_suspend_ordering,
10188 + .ident = "Panasonic CF51-2L",
10189 + .matches = {
10190 +diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
10191 +index 76253cf..9af6766 100644
10192 +--- a/drivers/char/tty_io.c
10193 ++++ b/drivers/char/tty_io.c
10194 +@@ -1875,6 +1875,7 @@ got_driver:
10195 + */
10196 + if (filp->f_op == &hung_up_tty_fops)
10197 + filp->f_op = &tty_fops;
10198 ++ unlock_kernel();
10199 + goto retry_open;
10200 + }
10201 + unlock_kernel();
10202 +diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
10203 +index cf4cb3e..4746bfe 100644
10204 +--- a/drivers/gpu/drm/i915/i915_drv.c
10205 ++++ b/drivers/gpu/drm/i915/i915_drv.c
10206 +@@ -79,14 +79,14 @@ const static struct intel_device_info intel_i915g_info = {
10207 + .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1,
10208 + };
10209 + const static struct intel_device_info intel_i915gm_info = {
10210 +- .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
10211 ++ .is_i9xx = 1, .is_mobile = 1,
10212 + .cursor_needs_physical = 1,
10213 + };
10214 + const static struct intel_device_info intel_i945g_info = {
10215 + .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1,
10216 + };
10217 + const static struct intel_device_info intel_i945gm_info = {
10218 +- .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
10219 ++ .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1,
10220 + .has_hotplug = 1, .cursor_needs_physical = 1,
10221 + };
10222 +
10223 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
10224 +index 16ce3ba..0b33757 100644
10225 +--- a/drivers/gpu/drm/i915/i915_drv.h
10226 ++++ b/drivers/gpu/drm/i915/i915_drv.h
10227 +@@ -206,11 +206,14 @@ typedef struct drm_i915_private {
10228 +
10229 + drm_dma_handle_t *status_page_dmah;
10230 + void *hw_status_page;
10231 ++ void *seqno_page;
10232 + dma_addr_t dma_status_page;
10233 + uint32_t counter;
10234 + unsigned int status_gfx_addr;
10235 ++ unsigned int seqno_gfx_addr;
10236 + drm_local_map_t hws_map;
10237 + struct drm_gem_object *hws_obj;
10238 ++ struct drm_gem_object *seqno_obj;
10239 + struct drm_gem_object *pwrctx;
10240 +
10241 + struct resource mch_res;
10242 +@@ -1090,6 +1093,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
10243 +
10244 + #define HAS_PCH_SPLIT(dev) (IS_IRONLAKE(dev) || \
10245 + IS_GEN6(dev))
10246 ++#define HAS_PIPE_CONTROL(dev) (IS_IRONLAKE(dev) || IS_GEN6(dev))
10247 +
10248 + #define PRIMARY_RINGBUFFER_SIZE (128*1024)
10249 +
10250 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
10251 +index 6458400..c00c978 100644
10252 +--- a/drivers/gpu/drm/i915/i915_gem.c
10253 ++++ b/drivers/gpu/drm/i915/i915_gem.c
10254 +@@ -1559,6 +1559,13 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
10255 + i915_verify_inactive(dev, __FILE__, __LINE__);
10256 + }
10257 +
10258 ++#define PIPE_CONTROL_FLUSH(addr) \
10259 ++ OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE | \
10260 ++ PIPE_CONTROL_DEPTH_STALL); \
10261 ++ OUT_RING(addr | PIPE_CONTROL_GLOBAL_GTT); \
10262 ++ OUT_RING(0); \
10263 ++ OUT_RING(0); \
10264 ++
10265 + /**
10266 + * Creates a new sequence number, emitting a write of it to the status page
10267 + * plus an interrupt, which will trigger i915_user_interrupt_handler.
10268 +@@ -1593,13 +1600,47 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
10269 + if (dev_priv->mm.next_gem_seqno == 0)
10270 + dev_priv->mm.next_gem_seqno++;
10271 +
10272 +- BEGIN_LP_RING(4);
10273 +- OUT_RING(MI_STORE_DWORD_INDEX);
10274 +- OUT_RING(I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
10275 +- OUT_RING(seqno);
10276 ++ if (HAS_PIPE_CONTROL(dev)) {
10277 ++ u32 scratch_addr = dev_priv->seqno_gfx_addr + 128;
10278 +
10279 +- OUT_RING(MI_USER_INTERRUPT);
10280 +- ADVANCE_LP_RING();
10281 ++ /*
10282 ++ * Workaround qword write incoherence by flushing the
10283 ++ * PIPE_NOTIFY buffers out to memory before requesting
10284 ++ * an interrupt.
10285 ++ */
10286 ++ BEGIN_LP_RING(32);
10287 ++ OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
10288 ++ PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH);
10289 ++ OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
10290 ++ OUT_RING(seqno);
10291 ++ OUT_RING(0);
10292 ++ PIPE_CONTROL_FLUSH(scratch_addr);
10293 ++ scratch_addr += 128; /* write to separate cachelines */
10294 ++ PIPE_CONTROL_FLUSH(scratch_addr);
10295 ++ scratch_addr += 128;
10296 ++ PIPE_CONTROL_FLUSH(scratch_addr);
10297 ++ scratch_addr += 128;
10298 ++ PIPE_CONTROL_FLUSH(scratch_addr);
10299 ++ scratch_addr += 128;
10300 ++ PIPE_CONTROL_FLUSH(scratch_addr);
10301 ++ scratch_addr += 128;
10302 ++ PIPE_CONTROL_FLUSH(scratch_addr);
10303 ++ OUT_RING(GFX_OP_PIPE_CONTROL | PIPE_CONTROL_QW_WRITE |
10304 ++ PIPE_CONTROL_WC_FLUSH | PIPE_CONTROL_TC_FLUSH |
10305 ++ PIPE_CONTROL_NOTIFY);
10306 ++ OUT_RING(dev_priv->seqno_gfx_addr | PIPE_CONTROL_GLOBAL_GTT);
10307 ++ OUT_RING(seqno);
10308 ++ OUT_RING(0);
10309 ++ ADVANCE_LP_RING();
10310 ++ } else {
10311 ++ BEGIN_LP_RING(4);
10312 ++ OUT_RING(MI_STORE_DWORD_INDEX);
10313 ++ OUT_RING(I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
10314 ++ OUT_RING(seqno);
10315 ++
10316 ++ OUT_RING(MI_USER_INTERRUPT);
10317 ++ ADVANCE_LP_RING();
10318 ++ }
10319 +
10320 + DRM_DEBUG_DRIVER("%d\n", seqno);
10321 +
10322 +@@ -1744,7 +1785,10 @@ i915_get_gem_seqno(struct drm_device *dev)
10323 + {
10324 + drm_i915_private_t *dev_priv = dev->dev_private;
10325 +
10326 +- return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX);
10327 ++ if (HAS_PIPE_CONTROL(dev))
10328 ++ return ((volatile u32 *)(dev_priv->seqno_page))[0];
10329 ++ else
10330 ++ return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX);
10331 + }
10332 +
10333 + /**
10334 +@@ -4576,6 +4620,49 @@ i915_gem_idle(struct drm_device *dev)
10335 + return 0;
10336 + }
10337 +
10338 ++/*
10339 ++ * 965+ support PIPE_CONTROL commands, which provide finer grained control
10340 ++ * over cache flushing.
10341 ++ */
10342 ++static int
10343 ++i915_gem_init_pipe_control(struct drm_device *dev)
10344 ++{
10345 ++ drm_i915_private_t *dev_priv = dev->dev_private;
10346 ++ struct drm_gem_object *obj;
10347 ++ struct drm_i915_gem_object *obj_priv;
10348 ++ int ret;
10349 ++
10350 ++ obj = drm_gem_object_alloc(dev, 4096);
10351 ++ if (obj == NULL) {
10352 ++ DRM_ERROR("Failed to allocate seqno page\n");
10353 ++ ret = -ENOMEM;
10354 ++ goto err;
10355 ++ }
10356 ++ obj_priv = obj->driver_private;
10357 ++ obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
10358 ++
10359 ++ ret = i915_gem_object_pin(obj, 4096);
10360 ++ if (ret)
10361 ++ goto err_unref;
10362 ++
10363 ++ dev_priv->seqno_gfx_addr = obj_priv->gtt_offset;
10364 ++ dev_priv->seqno_page = kmap(obj_priv->pages[0]);
10365 ++ if (dev_priv->seqno_page == NULL)
10366 ++ goto err_unpin;
10367 ++
10368 ++ dev_priv->seqno_obj = obj;
10369 ++ memset(dev_priv->seqno_page, 0, PAGE_SIZE);
10370 ++
10371 ++ return 0;
10372 ++
10373 ++err_unpin:
10374 ++ i915_gem_object_unpin(obj);
10375 ++err_unref:
10376 ++ drm_gem_object_unreference(obj);
10377 ++err:
10378 ++ return ret;
10379 ++}
10380 ++
10381 + static int
10382 + i915_gem_init_hws(struct drm_device *dev)
10383 + {
10384 +@@ -4593,7 +4680,8 @@ i915_gem_init_hws(struct drm_device *dev)
10385 + obj = drm_gem_object_alloc(dev, 4096);
10386 + if (obj == NULL) {
10387 + DRM_ERROR("Failed to allocate status page\n");
10388 +- return -ENOMEM;
10389 ++ ret = -ENOMEM;
10390 ++ goto err;
10391 + }
10392 + obj_priv = obj->driver_private;
10393 + obj_priv->agp_type = AGP_USER_CACHED_MEMORY;
10394 +@@ -4601,7 +4689,7 @@ i915_gem_init_hws(struct drm_device *dev)
10395 + ret = i915_gem_object_pin(obj, 4096);
10396 + if (ret != 0) {
10397 + drm_gem_object_unreference(obj);
10398 +- return ret;
10399 ++ goto err_unref;
10400 + }
10401 +
10402 + dev_priv->status_gfx_addr = obj_priv->gtt_offset;
10403 +@@ -4610,10 +4698,16 @@ i915_gem_init_hws(struct drm_device *dev)
10404 + if (dev_priv->hw_status_page == NULL) {
10405 + DRM_ERROR("Failed to map status page.\n");
10406 + memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
10407 +- i915_gem_object_unpin(obj);
10408 +- drm_gem_object_unreference(obj);
10409 +- return -EINVAL;
10410 ++ ret = -EINVAL;
10411 ++ goto err_unpin;
10412 + }
10413 ++
10414 ++ if (HAS_PIPE_CONTROL(dev)) {
10415 ++ ret = i915_gem_init_pipe_control(dev);
10416 ++ if (ret)
10417 ++ goto err_unpin;
10418 ++ }
10419 ++
10420 + dev_priv->hws_obj = obj;
10421 + memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
10422 + I915_WRITE(HWS_PGA, dev_priv->status_gfx_addr);
10423 +@@ -4621,6 +4715,30 @@ i915_gem_init_hws(struct drm_device *dev)
10424 + DRM_DEBUG_DRIVER("hws offset: 0x%08x\n", dev_priv->status_gfx_addr);
10425 +
10426 + return 0;
10427 ++
10428 ++err_unpin:
10429 ++ i915_gem_object_unpin(obj);
10430 ++err_unref:
10431 ++ drm_gem_object_unreference(obj);
10432 ++err:
10433 ++ return 0;
10434 ++}
10435 ++
10436 ++static void
10437 ++i915_gem_cleanup_pipe_control(struct drm_device *dev)
10438 ++{
10439 ++ drm_i915_private_t *dev_priv = dev->dev_private;
10440 ++ struct drm_gem_object *obj;
10441 ++ struct drm_i915_gem_object *obj_priv;
10442 ++
10443 ++ obj = dev_priv->seqno_obj;
10444 ++ obj_priv = obj->driver_private;
10445 ++ kunmap(obj_priv->pages[0]);
10446 ++ i915_gem_object_unpin(obj);
10447 ++ drm_gem_object_unreference(obj);
10448 ++ dev_priv->seqno_obj = NULL;
10449 ++
10450 ++ dev_priv->seqno_page = NULL;
10451 + }
10452 +
10453 + static void
10454 +@@ -4644,6 +4762,9 @@ i915_gem_cleanup_hws(struct drm_device *dev)
10455 + memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
10456 + dev_priv->hw_status_page = NULL;
10457 +
10458 ++ if (HAS_PIPE_CONTROL(dev))
10459 ++ i915_gem_cleanup_pipe_control(dev);
10460 ++
10461 + /* Write high address into HWS_PGA when disabling. */
10462 + I915_WRITE(HWS_PGA, 0x1ffff000);
10463 + }
10464 +diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
10465 +index 032f667..d6466d5 100644
10466 +--- a/drivers/gpu/drm/i915/i915_irq.c
10467 ++++ b/drivers/gpu/drm/i915/i915_irq.c
10468 +@@ -297,7 +297,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
10469 + READ_BREADCRUMB(dev_priv);
10470 + }
10471 +
10472 +- if (gt_iir & GT_USER_INTERRUPT) {
10473 ++ if (gt_iir & GT_PIPE_NOTIFY) {
10474 + u32 seqno = i915_get_gem_seqno(dev);
10475 + dev_priv->mm.irq_gem_seqno = seqno;
10476 + trace_i915_gem_request_complete(dev, seqno);
10477 +@@ -738,7 +738,7 @@ void i915_user_irq_get(struct drm_device *dev)
10478 + spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
10479 + if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) {
10480 + if (HAS_PCH_SPLIT(dev))
10481 +- ironlake_enable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
10482 ++ ironlake_enable_graphics_irq(dev_priv, GT_PIPE_NOTIFY);
10483 + else
10484 + i915_enable_irq(dev_priv, I915_USER_INTERRUPT);
10485 + }
10486 +@@ -754,7 +754,7 @@ void i915_user_irq_put(struct drm_device *dev)
10487 + BUG_ON(dev->irq_enabled && dev_priv->user_irq_refcount <= 0);
10488 + if (dev->irq_enabled && (--dev_priv->user_irq_refcount == 0)) {
10489 + if (HAS_PCH_SPLIT(dev))
10490 +- ironlake_disable_graphics_irq(dev_priv, GT_USER_INTERRUPT);
10491 ++ ironlake_disable_graphics_irq(dev_priv, GT_PIPE_NOTIFY);
10492 + else
10493 + i915_disable_irq(dev_priv, I915_USER_INTERRUPT);
10494 + }
10495 +@@ -1034,7 +1034,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
10496 + /* enable kind of interrupts always enabled */
10497 + u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
10498 + DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
10499 +- u32 render_mask = GT_USER_INTERRUPT;
10500 ++ u32 render_mask = GT_PIPE_NOTIFY;
10501 + u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
10502 + SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
10503 +
10504 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
10505 +index fd95bdf..30a2322 100644
10506 +--- a/drivers/gpu/drm/i915/i915_reg.h
10507 ++++ b/drivers/gpu/drm/i915/i915_reg.h
10508 +@@ -210,6 +210,16 @@
10509 + #define ASYNC_FLIP (1<<22)
10510 + #define DISPLAY_PLANE_A (0<<20)
10511 + #define DISPLAY_PLANE_B (1<<20)
10512 ++#define GFX_OP_PIPE_CONTROL ((0x3<<29)|(0x3<<27)|(0x2<<24)|2)
10513 ++#define PIPE_CONTROL_QW_WRITE (1<<14)
10514 ++#define PIPE_CONTROL_DEPTH_STALL (1<<13)
10515 ++#define PIPE_CONTROL_WC_FLUSH (1<<12)
10516 ++#define PIPE_CONTROL_IS_FLUSH (1<<11) /* MBZ on Ironlake */
10517 ++#define PIPE_CONTROL_TC_FLUSH (1<<10) /* GM45+ only */
10518 ++#define PIPE_CONTROL_ISP_DIS (1<<9)
10519 ++#define PIPE_CONTROL_NOTIFY (1<<8)
10520 ++#define PIPE_CONTROL_GLOBAL_GTT (1<<2) /* in addr dword */
10521 ++#define PIPE_CONTROL_STALL_EN (1<<1) /* in addr word, Ironlake+ only */
10522 +
10523 + /*
10524 + * Fence registers
10525 +@@ -2111,6 +2121,7 @@
10526 + #define DEIER 0x4400c
10527 +
10528 + /* GT interrupt */
10529 ++#define GT_PIPE_NOTIFY (1 << 4)
10530 + #define GT_SYNC_STATUS (1 << 2)
10531 + #define GT_USER_INTERRUPT (1 << 0)
10532 +
10533 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
10534 +index 4b2458d..3f00902 100644
10535 +--- a/drivers/gpu/drm/i915/intel_display.c
10536 ++++ b/drivers/gpu/drm/i915/intel_display.c
10537 +@@ -4683,7 +4683,7 @@ static void intel_init_display(struct drm_device *dev)
10538 + dev_priv->display.fbc_enabled = g4x_fbc_enabled;
10539 + dev_priv->display.enable_fbc = g4x_enable_fbc;
10540 + dev_priv->display.disable_fbc = g4x_disable_fbc;
10541 +- } else if (IS_I965GM(dev) || IS_I945GM(dev) || IS_I915GM(dev)) {
10542 ++ } else if (IS_I965GM(dev)) {
10543 + dev_priv->display.fbc_enabled = i8xx_fbc_enabled;
10544 + dev_priv->display.enable_fbc = i8xx_enable_fbc;
10545 + dev_priv->display.disable_fbc = i8xx_disable_fbc;
10546 +diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
10547 +index be475e8..f16d60f 100644
10548 +--- a/drivers/hwmon/hp_accel.c
10549 ++++ b/drivers/hwmon/hp_accel.c
10550 +@@ -324,8 +324,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
10551 + lis3lv02d_joystick_disable();
10552 + lis3lv02d_poweroff(&lis3_dev);
10553 +
10554 +- flush_work(&hpled_led.work);
10555 + led_classdev_unregister(&hpled_led.led_classdev);
10556 ++ flush_work(&hpled_led.work);
10557 +
10558 + return lis3lv02d_remove_fs(&lis3_dev);
10559 + }
10560 +diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
10561 +index 8072128..ee337df 100644
10562 +--- a/drivers/mmc/host/atmel-mci.c
10563 ++++ b/drivers/mmc/host/atmel-mci.c
10564 +@@ -568,9 +568,10 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
10565 + {
10566 + struct mmc_data *data = host->data;
10567 +
10568 +- dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len,
10569 +- ((data->flags & MMC_DATA_WRITE)
10570 +- ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
10571 ++ if (data)
10572 ++ dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len,
10573 ++ ((data->flags & MMC_DATA_WRITE)
10574 ++ ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
10575 + }
10576 +
10577 + static void atmci_stop_dma(struct atmel_mci *host)
10578 +@@ -1098,8 +1099,8 @@ static void atmci_command_complete(struct atmel_mci *host,
10579 + "command error: status=0x%08x\n", status);
10580 +
10581 + if (cmd->data) {
10582 +- host->data = NULL;
10583 + atmci_stop_dma(host);
10584 ++ host->data = NULL;
10585 + mci_writel(host, IDR, MCI_NOTBUSY
10586 + | MCI_TXRDY | MCI_RXRDY
10587 + | ATMCI_DATA_ERROR_FLAGS);
10588 +@@ -1292,6 +1293,7 @@ static void atmci_tasklet_func(unsigned long priv)
10589 + } else {
10590 + data->bytes_xfered = data->blocks * data->blksz;
10591 + data->error = 0;
10592 ++ mci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS);
10593 + }
10594 +
10595 + if (!data->stop) {
10596 +@@ -1750,13 +1752,13 @@ static int __init atmci_probe(struct platform_device *pdev)
10597 + ret = -ENODEV;
10598 + if (pdata->slot[0].bus_width) {
10599 + ret = atmci_init_slot(host, &pdata->slot[0],
10600 +- MCI_SDCSEL_SLOT_A, 0);
10601 ++ 0, MCI_SDCSEL_SLOT_A);
10602 + if (!ret)
10603 + nr_slots++;
10604 + }
10605 + if (pdata->slot[1].bus_width) {
10606 + ret = atmci_init_slot(host, &pdata->slot[1],
10607 +- MCI_SDCSEL_SLOT_B, 1);
10608 ++ 1, MCI_SDCSEL_SLOT_B);
10609 + if (!ret)
10610 + nr_slots++;
10611 + }
10612 +diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
10613 +index c3ce920..8b7c267 100644
10614 +--- a/drivers/net/wireless/ath/ath9k/xmit.c
10615 ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
10616 +@@ -2244,7 +2244,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
10617 + if (ATH_TXQ_SETUP(sc, i)) {
10618 + txq = &sc->tx.txq[i];
10619 +
10620 +- spin_lock_bh(&txq->axq_lock);
10621 ++ spin_lock(&txq->axq_lock);
10622 +
10623 + list_for_each_entry_safe(ac,
10624 + ac_tmp, &txq->axq_acq, list) {
10625 +@@ -2265,7 +2265,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
10626 + }
10627 + }
10628 +
10629 +- spin_unlock_bh(&txq->axq_lock);
10630 ++ spin_unlock(&txq->axq_lock);
10631 + }
10632 + }
10633 + }
10634 +diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
10635 +index 3b4c5a4..82c1d2e 100644
10636 +--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
10637 ++++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
10638 +@@ -581,6 +581,11 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
10639 +
10640 + iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
10641 +
10642 ++ /* make sure all queue are not stopped */
10643 ++ memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
10644 ++ for (i = 0; i < 4; i++)
10645 ++ atomic_set(&priv->queue_stop_count[i], 0);
10646 ++
10647 + /* reset to 0 to enable all the queue first */
10648 + priv->txq_ctx_active_msk = 0;
10649 + /* Map each Tx/cmd queue to its corresponding fifo */
10650 +diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
10651 +index c610e5f..f7d41c7 100644
10652 +--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
10653 ++++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
10654 +@@ -657,6 +657,11 @@ int iwl5000_alive_notify(struct iwl_priv *priv)
10655 +
10656 + iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
10657 +
10658 ++ /* make sure all queue are not stopped */
10659 ++ memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
10660 ++ for (i = 0; i < 4; i++)
10661 ++ atomic_set(&priv->queue_stop_count[i], 0);
10662 ++
10663 + /* reset to 0 to enable all the queue first */
10664 + priv->txq_ctx_active_msk = 0;
10665 + /* map qos queues to fifos one-to-one */
10666 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
10667 +index b93e491..3534d86 100644
10668 +--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
10669 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
10670 +@@ -298,10 +298,23 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
10671 + struct iwl_lq_sta *lq_data, u8 tid,
10672 + struct ieee80211_sta *sta)
10673 + {
10674 ++ int ret;
10675 ++
10676 + if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
10677 + IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
10678 + sta->addr, tid);
10679 +- ieee80211_start_tx_ba_session(sta, tid);
10680 ++ ret = ieee80211_start_tx_ba_session(sta, tid);
10681 ++ if (ret == -EAGAIN) {
10682 ++ /*
10683 ++ * driver and mac80211 is out of sync
10684 ++ * this might be cause by reloading firmware
10685 ++ * stop the tx ba session here
10686 ++ */
10687 ++ IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n",
10688 ++ tid);
10689 ++ ret = ieee80211_stop_tx_ba_session(sta, tid,
10690 ++ WLAN_BACK_INITIATOR);
10691 ++ }
10692 + }
10693 + }
10694 +
10695 +diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
10696 +index 88470fb..e0ce039 100644
10697 +--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
10698 ++++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
10699 +@@ -821,8 +821,10 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
10700 + hdr->seq_ctrl |= cpu_to_le16(seq_number);
10701 + seq_number += 0x10;
10702 + /* aggregation is on for this <sta,tid> */
10703 +- if (info->flags & IEEE80211_TX_CTL_AMPDU)
10704 ++ if (info->flags & IEEE80211_TX_CTL_AMPDU &&
10705 ++ priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) {
10706 + txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
10707 ++ }
10708 + }
10709 +
10710 + txq = &priv->txq[txq_id];
10711 +@@ -1347,7 +1349,7 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
10712 + {
10713 + int tx_fifo_id, txq_id, sta_id, ssn = -1;
10714 + struct iwl_tid_data *tid_data;
10715 +- int ret, write_ptr, read_ptr;
10716 ++ int write_ptr, read_ptr;
10717 + unsigned long flags;
10718 +
10719 + if (!ra) {
10720 +@@ -1399,13 +1401,17 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
10721 + priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
10722 +
10723 + spin_lock_irqsave(&priv->lock, flags);
10724 +- ret = priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, ssn,
10725 ++ /*
10726 ++ * the only reason this call can fail is queue number out of range,
10727 ++ * which can happen if uCode is reloaded and all the station
10728 ++ * information are lost. if it is outside the range, there is no need
10729 ++ * to deactivate the uCode queue, just return "success" to allow
10730 ++ * mac80211 to clean up it own data.
10731 ++ */
10732 ++ priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, ssn,
10733 + tx_fifo_id);
10734 + spin_unlock_irqrestore(&priv->lock, flags);
10735 +
10736 +- if (ret)
10737 +- return ret;
10738 +-
10739 + ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid);
10740 +
10741 + return 0;
10742 +diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
10743 +index 5905936..e4bd795 100644
10744 +--- a/drivers/s390/block/dasd.c
10745 ++++ b/drivers/s390/block/dasd.c
10746 +@@ -35,6 +35,9 @@
10747 + */
10748 + #define DASD_CHANQ_MAX_SIZE 4
10749 +
10750 ++#define DASD_SLEEPON_START_TAG (void *) 1
10751 ++#define DASD_SLEEPON_END_TAG (void *) 2
10752 ++
10753 + /*
10754 + * SECTION: exported variables of dasd.c
10755 + */
10756 +@@ -1460,7 +1463,10 @@ void dasd_add_request_tail(struct dasd_ccw_req *cqr)
10757 + */
10758 + static void dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data)
10759 + {
10760 +- wake_up((wait_queue_head_t *) data);
10761 ++ spin_lock_irq(get_ccwdev_lock(cqr->startdev->cdev));
10762 ++ cqr->callback_data = DASD_SLEEPON_END_TAG;
10763 ++ spin_unlock_irq(get_ccwdev_lock(cqr->startdev->cdev));
10764 ++ wake_up(&generic_waitq);
10765 + }
10766 +
10767 + static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
10768 +@@ -1470,10 +1476,7 @@ static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
10769 +
10770 + device = cqr->startdev;
10771 + spin_lock_irq(get_ccwdev_lock(device->cdev));
10772 +- rc = ((cqr->status == DASD_CQR_DONE ||
10773 +- cqr->status == DASD_CQR_NEED_ERP ||
10774 +- cqr->status == DASD_CQR_TERMINATED) &&
10775 +- list_empty(&cqr->devlist));
10776 ++ rc = (cqr->callback_data == DASD_SLEEPON_END_TAG);
10777 + spin_unlock_irq(get_ccwdev_lock(device->cdev));
10778 + return rc;
10779 + }
10780 +@@ -1561,7 +1564,7 @@ static int _dasd_sleep_on(struct dasd_ccw_req *maincqr, int interruptible)
10781 + wait_event(generic_waitq, !(device->stopped));
10782 +
10783 + cqr->callback = dasd_wakeup_cb;
10784 +- cqr->callback_data = (void *) &generic_waitq;
10785 ++ cqr->callback_data = DASD_SLEEPON_START_TAG;
10786 + dasd_add_request_tail(cqr);
10787 + if (interruptible) {
10788 + rc = wait_event_interruptible(
10789 +@@ -1640,7 +1643,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
10790 + }
10791 +
10792 + cqr->callback = dasd_wakeup_cb;
10793 +- cqr->callback_data = (void *) &generic_waitq;
10794 ++ cqr->callback_data = DASD_SLEEPON_START_TAG;
10795 + cqr->status = DASD_CQR_QUEUED;
10796 + list_add(&cqr->devlist, &device->ccw_queue);
10797 +
10798 +diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
10799 +index d00fcf8..fd6b135 100644
10800 +--- a/drivers/serial/imx.c
10801 ++++ b/drivers/serial/imx.c
10802 +@@ -119,7 +119,8 @@
10803 + #define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */
10804 + #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
10805 + #define UCR3_BPEN (1<<0) /* Preset registers enable */
10806 +-#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */
10807 ++#define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */
10808 ++#define UCR4_CTSTL_MASK 0x3F /* CTS trigger is 6 bits wide */
10809 + #define UCR4_INVR (1<<9) /* Inverted infrared reception */
10810 + #define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */
10811 + #define UCR4_WKEN (1<<7) /* Wake interrupt enable */
10812 +@@ -590,6 +591,9 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
10813 + return 0;
10814 + }
10815 +
10816 ++/* half the RX buffer size */
10817 ++#define CTSTL 16
10818 ++
10819 + static int imx_startup(struct uart_port *port)
10820 + {
10821 + struct imx_port *sport = (struct imx_port *)port;
10822 +@@ -606,6 +610,10 @@ static int imx_startup(struct uart_port *port)
10823 + if (USE_IRDA(sport))
10824 + temp |= UCR4_IRSC;
10825 +
10826 ++ /* set the trigger level for CTS */
10827 ++ temp &= ~(UCR4_CTSTL_MASK<< UCR4_CTSTL_SHF);
10828 ++ temp |= CTSTL<< UCR4_CTSTL_SHF;
10829 ++
10830 + writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
10831 +
10832 + if (USE_IRDA(sport)) {
10833 +diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
10834 +index 2549c53..6c8b6b6 100644
10835 +--- a/drivers/video/bfin-t350mcqb-fb.c
10836 ++++ b/drivers/video/bfin-t350mcqb-fb.c
10837 +@@ -515,9 +515,9 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
10838 + fbinfo->fbops = &bfin_t350mcqb_fb_ops;
10839 + fbinfo->flags = FBINFO_FLAG_DEFAULT;
10840 +
10841 +- info->fb_buffer =
10842 +- dma_alloc_coherent(NULL, fbinfo->fix.smem_len, &info->dma_handle,
10843 +- GFP_KERNEL);
10844 ++ info->fb_buffer = dma_alloc_coherent(NULL, fbinfo->fix.smem_len +
10845 ++ ACTIVE_VIDEO_MEM_OFFSET,
10846 ++ &info->dma_handle, GFP_KERNEL);
10847 +
10848 + if (NULL == info->fb_buffer) {
10849 + printk(KERN_ERR DRIVER_NAME
10850 +@@ -587,8 +587,8 @@ out7:
10851 + out6:
10852 + fb_dealloc_cmap(&fbinfo->cmap);
10853 + out4:
10854 +- dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
10855 +- info->dma_handle);
10856 ++ dma_free_coherent(NULL, fbinfo->fix.smem_len + ACTIVE_VIDEO_MEM_OFFSET,
10857 ++ info->fb_buffer, info->dma_handle);
10858 + out3:
10859 + framebuffer_release(fbinfo);
10860 + out2:
10861 +@@ -611,8 +611,9 @@ static int __devexit bfin_t350mcqb_remove(struct platform_device *pdev)
10862 + free_irq(info->irq, info);
10863 +
10864 + if (info->fb_buffer != NULL)
10865 +- dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,
10866 +- info->dma_handle);
10867 ++ dma_free_coherent(NULL, fbinfo->fix.smem_len +
10868 ++ ACTIVE_VIDEO_MEM_OFFSET, info->fb_buffer,
10869 ++ info->dma_handle);
10870 +
10871 + fb_dealloc_cmap(&fbinfo->cmap);
10872 +
10873 +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
10874 +index 645a179..2c6ee6a 100644
10875 +--- a/fs/btrfs/ioctl.c
10876 ++++ b/fs/btrfs/ioctl.c
10877 +@@ -964,12 +964,17 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
10878 + ret = -EBADF;
10879 + goto out_drop_write;
10880 + }
10881 ++
10882 + src = src_file->f_dentry->d_inode;
10883 +
10884 + ret = -EINVAL;
10885 + if (src == inode)
10886 + goto out_fput;
10887 +
10888 ++ /* the src must be open for reading */
10889 ++ if (!(src_file->f_mode & FMODE_READ))
10890 ++ goto out_fput;
10891 ++
10892 + ret = -EISDIR;
10893 + if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode))
10894 + goto out_fput;
10895 +diff --git a/fs/cachefiles/security.c b/fs/cachefiles/security.c
10896 +index b5808cd..039b501 100644
10897 +--- a/fs/cachefiles/security.c
10898 ++++ b/fs/cachefiles/security.c
10899 +@@ -77,6 +77,8 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache,
10900 + /*
10901 + * check the security details of the on-disk cache
10902 + * - must be called with security override in force
10903 ++ * - must return with a security override in force - even in the case of an
10904 ++ * error
10905 + */
10906 + int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
10907 + struct dentry *root,
10908 +@@ -99,6 +101,8 @@ int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
10909 + * which create files */
10910 + ret = set_create_files_as(new, root->d_inode);
10911 + if (ret < 0) {
10912 ++ abort_creds(new);
10913 ++ cachefiles_begin_secure(cache, _saved_cred);
10914 + _leave(" = %d [cfa]", ret);
10915 + return ret;
10916 + }
10917 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
10918 +index ed751bb..2568889 100644
10919 +--- a/fs/cifs/cifsglob.h
10920 ++++ b/fs/cifs/cifsglob.h
10921 +@@ -500,6 +500,7 @@ struct dfs_info3_param {
10922 + #define CIFS_FATTR_DFS_REFERRAL 0x1
10923 + #define CIFS_FATTR_DELETE_PENDING 0x2
10924 + #define CIFS_FATTR_NEED_REVAL 0x4
10925 ++#define CIFS_FATTR_INO_COLLISION 0x8
10926 +
10927 + struct cifs_fattr {
10928 + u32 cf_flags;
10929 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
10930 +index e3fda97..7ec8555 100644
10931 +--- a/fs/cifs/inode.c
10932 ++++ b/fs/cifs/inode.c
10933 +@@ -610,6 +610,16 @@ cifs_find_inode(struct inode *inode, void *opaque)
10934 + if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid)
10935 + return 0;
10936 +
10937 ++ /*
10938 ++ * uh oh -- it's a directory. We can't use it since hardlinked dirs are
10939 ++ * verboten. Disable serverino and return it as if it were found, the
10940 ++ * caller can discard it, generate a uniqueid and retry the find
10941 ++ */
10942 ++ if (S_ISDIR(inode->i_mode) && !list_empty(&inode->i_dentry)) {
10943 ++ fattr->cf_flags |= CIFS_FATTR_INO_COLLISION;
10944 ++ cifs_autodisable_serverino(CIFS_SB(inode->i_sb));
10945 ++ }
10946 ++
10947 + return 1;
10948 + }
10949 +
10950 +@@ -629,15 +639,22 @@ cifs_iget(struct super_block *sb, struct cifs_fattr *fattr)
10951 + unsigned long hash;
10952 + struct inode *inode;
10953 +
10954 ++retry_iget5_locked:
10955 + cFYI(1, ("looking for uniqueid=%llu", fattr->cf_uniqueid));
10956 +
10957 + /* hash down to 32-bits on 32-bit arch */
10958 + hash = cifs_uniqueid_to_ino_t(fattr->cf_uniqueid);
10959 +
10960 + inode = iget5_locked(sb, hash, cifs_find_inode, cifs_init_inode, fattr);
10961 +-
10962 +- /* we have fattrs in hand, update the inode */
10963 + if (inode) {
10964 ++ /* was there a problematic inode number collision? */
10965 ++ if (fattr->cf_flags & CIFS_FATTR_INO_COLLISION) {
10966 ++ iput(inode);
10967 ++ fattr->cf_uniqueid = iunique(sb, ROOT_I);
10968 ++ fattr->cf_flags &= ~CIFS_FATTR_INO_COLLISION;
10969 ++ goto retry_iget5_locked;
10970 ++ }
10971 ++
10972 + cifs_fattr_to_inode(inode, fattr);
10973 + if (sb->s_flags & MS_NOATIME)
10974 + inode->i_flags |= S_NOATIME | S_NOCMTIME;
10975 +diff --git a/fs/compat.c b/fs/compat.c
10976 +index 00d90c2..514b623 100644
10977 +--- a/fs/compat.c
10978 ++++ b/fs/compat.c
10979 +@@ -1530,8 +1530,6 @@ int compat_do_execve(char * filename,
10980 + if (retval < 0)
10981 + goto out;
10982 +
10983 +- current->stack_start = current->mm->start_stack;
10984 +-
10985 + /* execve succeeded */
10986 + current->fs->in_exec = 0;
10987 + current->in_execve = 0;
10988 +diff --git a/fs/exec.c b/fs/exec.c
10989 +index 9071360..332f781 100644
10990 +--- a/fs/exec.c
10991 ++++ b/fs/exec.c
10992 +@@ -1386,8 +1386,6 @@ int do_execve(char * filename,
10993 + if (retval < 0)
10994 + goto out;
10995 +
10996 +- current->stack_start = current->mm->start_stack;
10997 +-
10998 + /* execve succeeded */
10999 + current->fs->in_exec = 0;
11000 + current->in_execve = 0;
11001 +diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
11002 +index 8173fae..4d3ddcc 100644
11003 +--- a/fs/nilfs2/super.c
11004 ++++ b/fs/nilfs2/super.c
11005 +@@ -746,6 +746,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent,
11006 + sb->s_export_op = &nilfs_export_ops;
11007 + sb->s_root = NULL;
11008 + sb->s_time_gran = 1;
11009 ++ sb->s_bdi = nilfs->ns_bdi;
11010 +
11011 + err = load_nilfs(nilfs, sbi);
11012 + if (err)
11013 +diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
11014 +index 1afb0a1..e27960c 100644
11015 +--- a/fs/notify/inotify/inotify_fsnotify.c
11016 ++++ b/fs/notify/inotify/inotify_fsnotify.c
11017 +@@ -28,6 +28,7 @@
11018 + #include <linux/path.h> /* struct path */
11019 + #include <linux/slab.h> /* kmem_* */
11020 + #include <linux/types.h>
11021 ++#include <linux/sched.h>
11022 +
11023 + #include "inotify.h"
11024 +
11025 +@@ -146,6 +147,7 @@ static void inotify_free_group_priv(struct fsnotify_group *group)
11026 + idr_for_each(&group->inotify_data.idr, idr_callback, group);
11027 + idr_remove_all(&group->inotify_data.idr);
11028 + idr_destroy(&group->inotify_data.idr);
11029 ++ free_uid(group->inotify_data.user);
11030 + }
11031 +
11032 + void inotify_free_event_priv(struct fsnotify_event_private_data *fsn_event_priv)
11033 +diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
11034 +index a94e8bd..75aa15a 100644
11035 +--- a/fs/notify/inotify/inotify_user.c
11036 ++++ b/fs/notify/inotify/inotify_user.c
11037 +@@ -550,21 +550,24 @@ retry:
11038 + if (unlikely(!idr_pre_get(&group->inotify_data.idr, GFP_KERNEL)))
11039 + goto out_err;
11040 +
11041 ++ /* we are putting the mark on the idr, take a reference */
11042 ++ fsnotify_get_mark(&tmp_ientry->fsn_entry);
11043 ++
11044 + spin_lock(&group->inotify_data.idr_lock);
11045 + ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry,
11046 + group->inotify_data.last_wd+1,
11047 + &tmp_ientry->wd);
11048 + spin_unlock(&group->inotify_data.idr_lock);
11049 + if (ret) {
11050 ++ /* we didn't get on the idr, drop the idr reference */
11051 ++ fsnotify_put_mark(&tmp_ientry->fsn_entry);
11052 ++
11053 + /* idr was out of memory allocate and try again */
11054 + if (ret == -EAGAIN)
11055 + goto retry;
11056 + goto out_err;
11057 + }
11058 +
11059 +- /* we put the mark on the idr, take a reference */
11060 +- fsnotify_get_mark(&tmp_ientry->fsn_entry);
11061 +-
11062 + /* we are on the idr, now get on the inode */
11063 + ret = fsnotify_add_mark(&tmp_ientry->fsn_entry, group, inode);
11064 + if (ret) {
11065 +diff --git a/fs/proc/array.c b/fs/proc/array.c
11066 +index 13b5d07..69eb4c4 100644
11067 +--- a/fs/proc/array.c
11068 ++++ b/fs/proc/array.c
11069 +@@ -82,7 +82,6 @@
11070 + #include <linux/pid_namespace.h>
11071 + #include <linux/ptrace.h>
11072 + #include <linux/tracehook.h>
11073 +-#include <linux/swapops.h>
11074 +
11075 + #include <asm/pgtable.h>
11076 + #include <asm/processor.h>
11077 +@@ -494,7 +493,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
11078 + rsslim,
11079 + mm ? mm->start_code : 0,
11080 + mm ? mm->end_code : 0,
11081 +- (permitted && mm) ? task->stack_start : 0,
11082 ++ (permitted && mm) ? mm->start_stack : 0,
11083 + esp,
11084 + eip,
11085 + /* The signal information here is obsolete.
11086 +diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
11087 +index f277c4a..9df34a5 100644
11088 +--- a/fs/proc/task_mmu.c
11089 ++++ b/fs/proc/task_mmu.c
11090 +@@ -243,25 +243,6 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
11091 + } else if (vma->vm_start <= mm->start_stack &&
11092 + vma->vm_end >= mm->start_stack) {
11093 + name = "[stack]";
11094 +- } else {
11095 +- unsigned long stack_start;
11096 +- struct proc_maps_private *pmp;
11097 +-
11098 +- pmp = m->private;
11099 +- stack_start = pmp->task->stack_start;
11100 +-
11101 +- if (vma->vm_start <= stack_start &&
11102 +- vma->vm_end >= stack_start) {
11103 +- pad_len_spaces(m, len);
11104 +- seq_printf(m,
11105 +- "[threadstack:%08lx]",
11106 +-#ifdef CONFIG_STACK_GROWSUP
11107 +- vma->vm_end - stack_start
11108 +-#else
11109 +- stack_start - vma->vm_start
11110 +-#endif
11111 +- );
11112 +- }
11113 + }
11114 + } else {
11115 + name = "[vdso]";
11116 +diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
11117 +index e694263..6920695 100644
11118 +--- a/include/asm-generic/dma-mapping-common.h
11119 ++++ b/include/asm-generic/dma-mapping-common.h
11120 +@@ -131,7 +131,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
11121 + debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
11122 +
11123 + } else
11124 +- dma_sync_single_for_cpu(dev, addr, size, dir);
11125 ++ dma_sync_single_for_cpu(dev, addr + offset, size, dir);
11126 + }
11127 +
11128 + static inline void dma_sync_single_range_for_device(struct device *dev,
11129 +@@ -148,7 +148,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
11130 + debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
11131 +
11132 + } else
11133 +- dma_sync_single_for_device(dev, addr, size, dir);
11134 ++ dma_sync_single_for_device(dev, addr + offset, size, dir);
11135 + }
11136 +
11137 + static inline void
11138 +diff --git a/include/linux/sched.h b/include/linux/sched.h
11139 +index 1f5fa53..db821a4 100644
11140 +--- a/include/linux/sched.h
11141 ++++ b/include/linux/sched.h
11142 +@@ -1560,7 +1560,6 @@ struct task_struct {
11143 + /* bitmask of trace recursion */
11144 + unsigned long trace_recursion;
11145 + #endif /* CONFIG_TRACING */
11146 +- unsigned long stack_start;
11147 + #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
11148 + struct memcg_batch_info {
11149 + int do_batch; /* incremented when batch uncharge started */
11150 +diff --git a/kernel/fork.c b/kernel/fork.c
11151 +index f88bd98..0ea67a3 100644
11152 +--- a/kernel/fork.c
11153 ++++ b/kernel/fork.c
11154 +@@ -1134,8 +1134,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
11155 +
11156 + p->bts = NULL;
11157 +
11158 +- p->stack_start = stack_start;
11159 +-
11160 + /* Perform scheduler related setup. Assign this task to a CPU. */
11161 + sched_fork(p, clone_flags);
11162 +
11163 +diff --git a/kernel/profile.c b/kernel/profile.c
11164 +index a55d3a3..dfadc5b 100644
11165 +--- a/kernel/profile.c
11166 ++++ b/kernel/profile.c
11167 +@@ -127,8 +127,10 @@ int __ref profile_init(void)
11168 + return 0;
11169 +
11170 + prof_buffer = vmalloc(buffer_bytes);
11171 +- if (prof_buffer)
11172 ++ if (prof_buffer) {
11173 ++ memset(prof_buffer, 0, buffer_bytes);
11174 + return 0;
11175 ++ }
11176 +
11177 + free_cpumask_var(prof_cpu_mask);
11178 + return -ENOMEM;
11179 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
11180 +index fd9ba95..e8d9544 100644
11181 +--- a/mm/hugetlb.c
11182 ++++ b/mm/hugetlb.c
11183 +@@ -1039,7 +1039,7 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
11184 + page = alloc_buddy_huge_page(h, vma, addr);
11185 + if (!page) {
11186 + hugetlb_put_quota(inode->i_mapping, chg);
11187 +- return ERR_PTR(-VM_FAULT_OOM);
11188 ++ return ERR_PTR(-VM_FAULT_SIGBUS);
11189 + }
11190 + }
11191 +
11192 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
11193 +index 16190ca..955f0b2 100644
11194 +--- a/net/ipv4/udp.c
11195 ++++ b/net/ipv4/udp.c
11196 +@@ -1527,6 +1527,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
11197 +
11198 + uh = udp_hdr(skb);
11199 + ulen = ntohs(uh->len);
11200 ++ saddr = ip_hdr(skb)->saddr;
11201 ++ daddr = ip_hdr(skb)->daddr;
11202 ++
11203 + if (ulen > skb->len)
11204 + goto short_packet;
11205 +
11206 +@@ -1540,9 +1543,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
11207 + if (udp4_csum_init(skb, uh, proto))
11208 + goto csum_error;
11209 +
11210 +- saddr = ip_hdr(skb)->saddr;
11211 +- daddr = ip_hdr(skb)->daddr;
11212 +-
11213 + if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
11214 + return __udp4_lib_mcast_deliver(net, skb, uh,
11215 + saddr, daddr, udptable);
11216 +diff --git a/security/min_addr.c b/security/min_addr.c
11217 +index e86f297..f728728 100644
11218 +--- a/security/min_addr.c
11219 ++++ b/security/min_addr.c
11220 +@@ -33,7 +33,7 @@ int mmap_min_addr_handler(struct ctl_table *table, int write,
11221 + {
11222 + int ret;
11223 +
11224 +- if (!capable(CAP_SYS_RAWIO))
11225 ++ if (write && !capable(CAP_SYS_RAWIO))
11226 + return -EPERM;
11227 +
11228 + ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
11229 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
11230 +index fd831bd..a747871 100644
11231 +--- a/sound/pci/hda/hda_intel.c
11232 ++++ b/sound/pci/hda/hda_intel.c
11233 +@@ -2718,6 +2718,7 @@ static struct pci_device_id azx_ids[] = {
11234 + { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH },
11235 + /* PCH */
11236 + { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_ICH },
11237 ++ { PCI_DEVICE(0x8086, 0x3b57), .driver_data = AZX_DRIVER_ICH },
11238 + /* CPT */
11239 + { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH },
11240 + /* SCH */
11241 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
11242 +index 1a97c81..a978645 100644
11243 +--- a/sound/pci/hda/patch_conexant.c
11244 ++++ b/sound/pci/hda/patch_conexant.c
11245 +@@ -1176,9 +1176,10 @@ static int patch_cxt5045(struct hda_codec *codec)
11246 + case 0x103c:
11247 + case 0x1631:
11248 + case 0x1734:
11249 +- /* HP, Packard Bell, & Fujitsu-Siemens laptops have really bad
11250 +- * sound over 0dB on NID 0x17. Fix max PCM level to 0 dB
11251 +- * (originally it has 0x2b steps with 0dB offset 0x14)
11252 ++ case 0x17aa:
11253 ++ /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have
11254 ++ * really bad sound over 0dB on NID 0x17. Fix max PCM level to
11255 ++ * 0 dB (originally it has 0x2b steps with 0dB offset 0x14)
11256 + */
11257 + snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
11258 + (0x14 << AC_AMPCAP_OFFSET_SHIFT) |
11259 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
11260 +index b486daa..abfc558 100644
11261 +--- a/sound/pci/hda/patch_realtek.c
11262 ++++ b/sound/pci/hda/patch_realtek.c
11263 +@@ -17348,7 +17348,6 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
11264 + ALC662_3ST_6ch_DIG),
11265 + SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
11266 + ALC663_ASUS_H13),
11267 +- SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
11268 + {}
11269 + };
11270 +
11271 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
11272 +index ac2d528..cb474c0 100644
11273 +--- a/sound/pci/hda/patch_sigmatel.c
11274 ++++ b/sound/pci/hda/patch_sigmatel.c
11275 +@@ -1539,11 +1539,9 @@ static unsigned int alienware_m17x_pin_configs[13] = {
11276 + 0x904601b0,
11277 + };
11278 +
11279 +-static unsigned int intel_dg45id_pin_configs[14] = {
11280 ++static unsigned int intel_dg45id_pin_configs[13] = {
11281 + 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
11282 +- 0x01A19250, 0x01011212, 0x01016211, 0x40f000f0,
11283 +- 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x014510A0,
11284 +- 0x074510B0, 0x40f000f0
11285 ++ 0x01A19250, 0x01011212, 0x01016211
11286 + };
11287 +
11288 + static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
11289 +diff --git a/sound/pci/ice1712/maya44.c b/sound/pci/ice1712/maya44.c
11290 +index 3e1c20a..726fd4b 100644
11291 +--- a/sound/pci/ice1712/maya44.c
11292 ++++ b/sound/pci/ice1712/maya44.c
11293 +@@ -347,7 +347,7 @@ static int maya_gpio_sw_put(struct snd_kcontrol *kcontrol,
11294 +
11295 + /* known working input slots (0-4) */
11296 + #define MAYA_LINE_IN 1 /* in-2 */
11297 +-#define MAYA_MIC_IN 4 /* in-5 */
11298 ++#define MAYA_MIC_IN 3 /* in-4 */
11299 +
11300 + static void wm8776_select_input(struct snd_maya44 *chip, int idx, int line)
11301 + {
11302 +@@ -393,8 +393,8 @@ static int maya_rec_src_put(struct snd_kcontrol *kcontrol,
11303 + int changed;
11304 +
11305 + mutex_lock(&chip->mutex);
11306 +- changed = maya_set_gpio_bits(chip->ice, GPIO_MIC_RELAY,
11307 +- sel ? GPIO_MIC_RELAY : 0);
11308 ++ changed = maya_set_gpio_bits(chip->ice, 1 << GPIO_MIC_RELAY,
11309 ++ sel ? (1 << GPIO_MIC_RELAY) : 0);
11310 + wm8776_select_input(chip, 0, sel ? MAYA_MIC_IN : MAYA_LINE_IN);
11311 + mutex_unlock(&chip->mutex);
11312 + return changed;
11313 +diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
11314 +index 16c226b..7c4986b 100644
11315 +--- a/sound/pci/oxygen/xonar_cs43xx.c
11316 ++++ b/sound/pci/oxygen/xonar_cs43xx.c
11317 +@@ -56,6 +56,7 @@
11318 + #include <sound/pcm_params.h>
11319 + #include <sound/tlv.h>
11320 + #include "xonar.h"
11321 ++#include "cm9780.h"
11322 + #include "cs4398.h"
11323 + #include "cs4362a.h"
11324 +
11325 +@@ -172,6 +173,8 @@ static void xonar_d1_init(struct oxygen *chip)
11326 + oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA,
11327 + GPIO_D1_FRONT_PANEL | GPIO_D1_INPUT_ROUTE);
11328 +
11329 ++ oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC);
11330 ++
11331 + xonar_init_cs53x1(chip);
11332 + xonar_enable_output(chip);
11333 +
11334
11335 Added: genpatches-2.6/trunk/2.6.33/1005_linux-2.6.33.6.patch
11336 ===================================================================
11337 --- genpatches-2.6/trunk/2.6.33/1005_linux-2.6.33.6.patch (rev 0)
11338 +++ genpatches-2.6/trunk/2.6.33/1005_linux-2.6.33.6.patch 2010-07-05 23:09:19 UTC (rev 1721)
11339 @@ -0,0 +1,5360 @@
11340 +diff --git a/Documentation/hwmon/ltc4245 b/Documentation/hwmon/ltc4245
11341 +index 02838a4..86b5880 100644
11342 +--- a/Documentation/hwmon/ltc4245
11343 ++++ b/Documentation/hwmon/ltc4245
11344 +@@ -72,9 +72,7 @@ in6_min_alarm 5v output undervoltage alarm
11345 + in7_min_alarm 3v output undervoltage alarm
11346 + in8_min_alarm Vee (-12v) output undervoltage alarm
11347 +
11348 +-in9_input GPIO #1 voltage data
11349 +-in10_input GPIO #2 voltage data
11350 +-in11_input GPIO #3 voltage data
11351 ++in9_input GPIO voltage data
11352 +
11353 + power1_input 12v power usage (mW)
11354 + power2_input 5v power usage (mW)
11355 +diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
11356 +index 8ba7044..b07bfee 100644
11357 +--- a/arch/arm/common/sa1111.c
11358 ++++ b/arch/arm/common/sa1111.c
11359 +@@ -887,8 +887,6 @@ static int sa1111_resume(struct platform_device *dev)
11360 + if (!save)
11361 + return 0;
11362 +
11363 +- spin_lock_irqsave(&sachip->lock, flags);
11364 +-
11365 + /*
11366 + * Ensure that the SA1111 is still here.
11367 + * FIXME: shouldn't do this here.
11368 +@@ -905,6 +903,13 @@ static int sa1111_resume(struct platform_device *dev)
11369 + * First of all, wake up the chip.
11370 + */
11371 + sa1111_wake(sachip);
11372 ++
11373 ++ /*
11374 ++ * Only lock for write ops. Also, sa1111_wake must be called with
11375 ++ * released spinlock!
11376 ++ */
11377 ++ spin_lock_irqsave(&sachip->lock, flags);
11378 ++
11379 + sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN0);
11380 + sa1111_writel(0, sachip->base + SA1111_INTC + SA1111_INTEN1);
11381 +
11382 +diff --git a/arch/arm/mm/copypage-feroceon.c b/arch/arm/mm/copypage-feroceon.c
11383 +index 70997d5..dd9598b 100644
11384 +--- a/arch/arm/mm/copypage-feroceon.c
11385 ++++ b/arch/arm/mm/copypage-feroceon.c
11386 +@@ -18,7 +18,7 @@ feroceon_copy_user_page(void *kto, const void *kfrom)
11387 + {
11388 + asm("\
11389 + stmfd sp!, {r4-r9, lr} \n\
11390 +- mov ip, %0 \n\
11391 ++ mov ip, %2 \n\
11392 + 1: mov lr, r1 \n\
11393 + ldmia r1!, {r2 - r9} \n\
11394 + pld [lr, #32] \n\
11395 +@@ -64,7 +64,7 @@ feroceon_copy_user_page(void *kto, const void *kfrom)
11396 + mcr p15, 0, ip, c7, c10, 4 @ drain WB\n\
11397 + ldmfd sp!, {r4-r9, pc}"
11398 + :
11399 +- : "I" (PAGE_SIZE));
11400 ++ : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE));
11401 + }
11402 +
11403 + void feroceon_copy_user_highpage(struct page *to, struct page *from,
11404 +diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c
11405 +index 9ab0984..7bc0ac7 100644
11406 +--- a/arch/arm/mm/copypage-v4wb.c
11407 ++++ b/arch/arm/mm/copypage-v4wb.c
11408 +@@ -27,7 +27,7 @@ v4wb_copy_user_page(void *kto, const void *kfrom)
11409 + {
11410 + asm("\
11411 + stmfd sp!, {r4, lr} @ 2\n\
11412 +- mov r2, %0 @ 1\n\
11413 ++ mov r2, %2 @ 1\n\
11414 + ldmia r1!, {r3, r4, ip, lr} @ 4\n\
11415 + 1: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\
11416 + stmia r0!, {r3, r4, ip, lr} @ 4\n\
11417 +@@ -44,7 +44,7 @@ v4wb_copy_user_page(void *kto, const void *kfrom)
11418 + mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB\n\
11419 + ldmfd sp!, {r4, pc} @ 3"
11420 + :
11421 +- : "I" (PAGE_SIZE / 64));
11422 ++ : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64));
11423 + }
11424 +
11425 + void v4wb_copy_user_highpage(struct page *to, struct page *from,
11426 +diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c
11427 +index 300efaf..35bf609 100644
11428 +--- a/arch/arm/mm/copypage-v4wt.c
11429 ++++ b/arch/arm/mm/copypage-v4wt.c
11430 +@@ -25,7 +25,7 @@ v4wt_copy_user_page(void *kto, const void *kfrom)
11431 + {
11432 + asm("\
11433 + stmfd sp!, {r4, lr} @ 2\n\
11434 +- mov r2, %0 @ 1\n\
11435 ++ mov r2, %2 @ 1\n\
11436 + ldmia r1!, {r3, r4, ip, lr} @ 4\n\
11437 + 1: stmia r0!, {r3, r4, ip, lr} @ 4\n\
11438 + ldmia r1!, {r3, r4, ip, lr} @ 4+1\n\
11439 +@@ -40,7 +40,7 @@ v4wt_copy_user_page(void *kto, const void *kfrom)
11440 + mcr p15, 0, r2, c7, c7, 0 @ flush ID cache\n\
11441 + ldmfd sp!, {r4, pc} @ 3"
11442 + :
11443 +- : "I" (PAGE_SIZE / 64));
11444 ++ : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64));
11445 + }
11446 +
11447 + void v4wt_copy_user_highpage(struct page *to, struct page *from,
11448 +diff --git a/arch/arm/mm/copypage-xsc3.c b/arch/arm/mm/copypage-xsc3.c
11449 +index bc4525f..27dc363 100644
11450 +--- a/arch/arm/mm/copypage-xsc3.c
11451 ++++ b/arch/arm/mm/copypage-xsc3.c
11452 +@@ -34,7 +34,7 @@ xsc3_mc_copy_user_page(void *kto, const void *kfrom)
11453 + {
11454 + asm("\
11455 + stmfd sp!, {r4, r5, lr} \n\
11456 +- mov lr, %0 \n\
11457 ++ mov lr, %2 \n\
11458 + \n\
11459 + pld [r1, #0] \n\
11460 + pld [r1, #32] \n\
11461 +@@ -67,7 +67,7 @@ xsc3_mc_copy_user_page(void *kto, const void *kfrom)
11462 + \n\
11463 + ldmfd sp!, {r4, r5, pc}"
11464 + :
11465 +- : "I" (PAGE_SIZE / 64 - 1));
11466 ++ : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64 - 1));
11467 + }
11468 +
11469 + void xsc3_mc_copy_user_highpage(struct page *to, struct page *from,
11470 +diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
11471 +index 10e0680..3191cd6 100644
11472 +--- a/arch/arm/mm/fault.c
11473 ++++ b/arch/arm/mm/fault.c
11474 +@@ -386,6 +386,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr,
11475 + if (addr < TASK_SIZE)
11476 + return do_page_fault(addr, fsr, regs);
11477 +
11478 ++ if (user_mode(regs))
11479 ++ goto bad_area;
11480 ++
11481 + index = pgd_index(addr);
11482 +
11483 + /*
11484 +diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
11485 +index a04ffbb..3cbdd5c 100644
11486 +--- a/arch/arm/mm/init.c
11487 ++++ b/arch/arm/mm/init.c
11488 +@@ -632,10 +632,10 @@ void __init mem_init(void)
11489 + void free_initmem(void)
11490 + {
11491 + #ifdef CONFIG_HAVE_TCM
11492 +- extern char *__tcm_start, *__tcm_end;
11493 ++ extern char __tcm_start, __tcm_end;
11494 +
11495 +- totalram_pages += free_area(__phys_to_pfn(__pa(__tcm_start)),
11496 +- __phys_to_pfn(__pa(__tcm_end)),
11497 ++ totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
11498 ++ __phys_to_pfn(__pa(&__tcm_end)),
11499 + "TCM link");
11500 + #endif
11501 +
11502 +diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
11503 +index 66dc2d0..d66cead 100644
11504 +--- a/arch/arm/vfp/vfphw.S
11505 ++++ b/arch/arm/vfp/vfphw.S
11506 +@@ -277,7 +277,7 @@ ENTRY(vfp_put_double)
11507 + #ifdef CONFIG_VFPv3
11508 + @ d16 - d31 registers
11509 + .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
11510 +-1: mcrr p11, 3, r1, r2, c\dr @ fmdrr r1, r2, d\dr
11511 ++1: mcrr p11, 3, r0, r1, c\dr @ fmdrr r0, r1, d\dr
11512 + mov pc, lr
11513 + .org 1b + 8
11514 + .endr
11515 +diff --git a/arch/blackfin/include/asm/cache.h b/arch/blackfin/include/asm/cache.h
11516 +index 8542bc3..93f6c63 100644
11517 +--- a/arch/blackfin/include/asm/cache.h
11518 ++++ b/arch/blackfin/include/asm/cache.h
11519 +@@ -15,6 +15,8 @@
11520 + #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
11521 + #define SMP_CACHE_BYTES L1_CACHE_BYTES
11522 +
11523 ++#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
11524 ++
11525 + #ifdef CONFIG_SMP
11526 + #define __cacheline_aligned
11527 + #else
11528 +diff --git a/arch/frv/include/asm/cache.h b/arch/frv/include/asm/cache.h
11529 +index 2797163..7dc0f0f 100644
11530 +--- a/arch/frv/include/asm/cache.h
11531 ++++ b/arch/frv/include/asm/cache.h
11532 +@@ -17,6 +17,8 @@
11533 + #define L1_CACHE_SHIFT (CONFIG_FRV_L1_CACHE_SHIFT)
11534 + #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
11535 +
11536 ++#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
11537 ++
11538 + #define __cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
11539 + #define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
11540 +
11541 +diff --git a/arch/m68k/include/asm/cache.h b/arch/m68k/include/asm/cache.h
11542 +index fed3fd3..ecafbe1 100644
11543 +--- a/arch/m68k/include/asm/cache.h
11544 ++++ b/arch/m68k/include/asm/cache.h
11545 +@@ -8,4 +8,6 @@
11546 + #define L1_CACHE_SHIFT 4
11547 + #define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT)
11548 +
11549 ++#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
11550 ++
11551 + #endif
11552 +diff --git a/arch/mn10300/include/asm/cache.h b/arch/mn10300/include/asm/cache.h
11553 +index e03cfa2..6e2fe28 100644
11554 +--- a/arch/mn10300/include/asm/cache.h
11555 ++++ b/arch/mn10300/include/asm/cache.h
11556 +@@ -21,6 +21,8 @@
11557 + #define L1_CACHE_DISPARITY L1_CACHE_NENTRIES * L1_CACHE_BYTES
11558 + #endif
11559 +
11560 ++#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
11561 ++
11562 + /* data cache purge registers
11563 + * - read from the register to unconditionally purge that cache line
11564 + * - write address & 0xffffff00 to conditionally purge that cache line
11565 +diff --git a/arch/parisc/math-emu/decode_exc.c b/arch/parisc/math-emu/decode_exc.c
11566 +index 3ca1c61..27a7492 100644
11567 +--- a/arch/parisc/math-emu/decode_exc.c
11568 ++++ b/arch/parisc/math-emu/decode_exc.c
11569 +@@ -342,6 +342,7 @@ decode_fpu(unsigned int Fpu_register[], unsigned int trap_counts[])
11570 + return SIGNALCODE(SIGFPE, FPE_FLTINV);
11571 + case DIVISIONBYZEROEXCEPTION:
11572 + update_trap_counts(Fpu_register, aflags, bflags, trap_counts);
11573 ++ Clear_excp_register(exception_index);
11574 + return SIGNALCODE(SIGFPE, FPE_FLTDIV);
11575 + case INEXACTEXCEPTION:
11576 + update_trap_counts(Fpu_register, aflags, bflags, trap_counts);
11577 +diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
11578 +index e6dc595..0ca0b99 100644
11579 +--- a/arch/powerpc/kvm/book3s.c
11580 ++++ b/arch/powerpc/kvm/book3s.c
11581 +@@ -766,6 +766,8 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
11582 + struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
11583 + int i;
11584 +
11585 ++ vcpu_load(vcpu);
11586 ++
11587 + sregs->pvr = vcpu->arch.pvr;
11588 +
11589 + sregs->u.s.sdr1 = to_book3s(vcpu)->sdr1;
11590 +@@ -784,6 +786,9 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
11591 + sregs->u.s.ppc32.dbat[i] = vcpu3s->dbat[i].raw;
11592 + }
11593 + }
11594 ++
11595 ++ vcpu_put(vcpu);
11596 ++
11597 + return 0;
11598 + }
11599 +
11600 +@@ -793,6 +798,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
11601 + struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
11602 + int i;
11603 +
11604 ++ vcpu_load(vcpu);
11605 ++
11606 + kvmppc_set_pvr(vcpu, sregs->pvr);
11607 +
11608 + vcpu3s->sdr1 = sregs->u.s.sdr1;
11609 +@@ -819,6 +826,9 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
11610 +
11611 + /* Flush the MMU after messing with the segments */
11612 + kvmppc_mmu_pte_flush(vcpu, 0, 0);
11613 ++
11614 ++ vcpu_put(vcpu);
11615 ++
11616 + return 0;
11617 + }
11618 +
11619 +diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
11620 +index 06f5a9e..0a5263e 100644
11621 +--- a/arch/powerpc/kvm/booke.c
11622 ++++ b/arch/powerpc/kvm/booke.c
11623 +@@ -443,6 +443,8 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
11624 + {
11625 + int i;
11626 +
11627 ++ vcpu_load(vcpu);
11628 ++
11629 + regs->pc = vcpu->arch.pc;
11630 + regs->cr = vcpu->arch.cr;
11631 + regs->ctr = vcpu->arch.ctr;
11632 +@@ -463,6 +465,8 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
11633 + for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
11634 + regs->gpr[i] = vcpu->arch.gpr[i];
11635 +
11636 ++ vcpu_put(vcpu);
11637 ++
11638 + return 0;
11639 + }
11640 +
11641 +@@ -470,6 +474,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
11642 + {
11643 + int i;
11644 +
11645 ++ vcpu_load(vcpu);
11646 ++
11647 + vcpu->arch.pc = regs->pc;
11648 + vcpu->arch.cr = regs->cr;
11649 + vcpu->arch.ctr = regs->ctr;
11650 +@@ -489,6 +495,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
11651 + for (i = 0; i < ARRAY_SIZE(vcpu->arch.gpr); i++)
11652 + vcpu->arch.gpr[i] = regs->gpr[i];
11653 +
11654 ++ vcpu_put(vcpu);
11655 ++
11656 + return 0;
11657 + }
11658 +
11659 +@@ -517,7 +525,12 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
11660 + int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
11661 + struct kvm_translation *tr)
11662 + {
11663 +- return kvmppc_core_vcpu_translate(vcpu, tr);
11664 ++ int r;
11665 ++
11666 ++ vcpu_load(vcpu);
11667 ++ r = kvmppc_core_vcpu_translate(vcpu, tr);
11668 ++ vcpu_put(vcpu);
11669 ++ return r;
11670 + }
11671 +
11672 + int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
11673 +diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
11674 +index f06cf93..82098ae 100644
11675 +--- a/arch/powerpc/kvm/powerpc.c
11676 ++++ b/arch/powerpc/kvm/powerpc.c
11677 +@@ -181,7 +181,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
11678 + {
11679 + struct kvm_vcpu *vcpu;
11680 + vcpu = kvmppc_core_vcpu_create(kvm, id);
11681 +- kvmppc_create_vcpu_debugfs(vcpu, id);
11682 ++ if (!IS_ERR(vcpu))
11683 ++ kvmppc_create_vcpu_debugfs(vcpu, id);
11684 + return vcpu;
11685 + }
11686 +
11687 +diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S
11688 +index 64e2e49..3ac0cd3 100644
11689 +--- a/arch/powerpc/lib/string.S
11690 ++++ b/arch/powerpc/lib/string.S
11691 +@@ -71,7 +71,7 @@ _GLOBAL(strcmp)
11692 +
11693 + _GLOBAL(strncmp)
11694 + PPC_LCMPI r5,0
11695 +- beqlr
11696 ++ ble- 2f
11697 + mtctr r5
11698 + addi r5,r3,-1
11699 + addi r4,r4,-1
11700 +@@ -82,6 +82,8 @@ _GLOBAL(strncmp)
11701 + beqlr 1
11702 + bdnzt eq,1b
11703 + blr
11704 ++2: li r3,0
11705 ++ blr
11706 +
11707 + _GLOBAL(strlen)
11708 + addi r4,r3,-1
11709 +diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
11710 +index 2c9e522..7fd90d0 100644
11711 +--- a/arch/powerpc/oprofile/op_model_cell.c
11712 ++++ b/arch/powerpc/oprofile/op_model_cell.c
11713 +@@ -1077,7 +1077,7 @@ static int calculate_lfsr(int n)
11714 + index = ENTRIES-1;
11715 +
11716 + /* make sure index is valid */
11717 +- if ((index > ENTRIES) || (index < 0))
11718 ++ if ((index >= ENTRIES) || (index < 0))
11719 + index = ENTRIES-1;
11720 +
11721 + return initial_lfsr[index];
11722 +diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
11723 +index b842378..da684a7 100644
11724 +--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
11725 ++++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
11726 +@@ -154,30 +154,6 @@ static void pseries_mach_cpu_die(void)
11727 + for(;;);
11728 + }
11729 +
11730 +-static int qcss_tok; /* query-cpu-stopped-state token */
11731 +-
11732 +-/* Get state of physical CPU.
11733 +- * Return codes:
11734 +- * 0 - The processor is in the RTAS stopped state
11735 +- * 1 - stop-self is in progress
11736 +- * 2 - The processor is not in the RTAS stopped state
11737 +- * -1 - Hardware Error
11738 +- * -2 - Hardware Busy, Try again later.
11739 +- */
11740 +-static int query_cpu_stopped(unsigned int pcpu)
11741 +-{
11742 +- int cpu_status, status;
11743 +-
11744 +- status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
11745 +- if (status != 0) {
11746 +- printk(KERN_ERR
11747 +- "RTAS query-cpu-stopped-state failed: %i\n", status);
11748 +- return status;
11749 +- }
11750 +-
11751 +- return cpu_status;
11752 +-}
11753 +-
11754 + static int pseries_cpu_disable(void)
11755 + {
11756 + int cpu = smp_processor_id();
11757 +@@ -224,8 +200,9 @@ static void pseries_cpu_die(unsigned int cpu)
11758 + } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
11759 +
11760 + for (tries = 0; tries < 25; tries++) {
11761 +- cpu_status = query_cpu_stopped(pcpu);
11762 +- if (cpu_status == 0 || cpu_status == -1)
11763 ++ cpu_status = smp_query_cpu_stopped(pcpu);
11764 ++ if (cpu_status == QCSS_STOPPED ||
11765 ++ cpu_status == QCSS_HARDWARE_ERROR)
11766 + break;
11767 + cpu_relax();
11768 + }
11769 +@@ -400,6 +377,7 @@ static int __init pseries_cpu_hotplug_init(void)
11770 + struct device_node *np;
11771 + const char *typep;
11772 + int cpu;
11773 ++ int qcss_tok;
11774 +
11775 + for_each_node_by_name(np, "interrupt-controller") {
11776 + typep = of_get_property(np, "compatible", NULL);
11777 +diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
11778 +index 0603c91..e724ef8 100644
11779 +--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
11780 ++++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
11781 +@@ -4,6 +4,14 @@
11782 + #include <asm/hvcall.h>
11783 + #include <asm/page.h>
11784 +
11785 ++/* Get state of physical CPU from query_cpu_stopped */
11786 ++int smp_query_cpu_stopped(unsigned int pcpu);
11787 ++#define QCSS_STOPPED 0
11788 ++#define QCSS_STOPPING 1
11789 ++#define QCSS_NOT_STOPPED 2
11790 ++#define QCSS_HARDWARE_ERROR -1
11791 ++#define QCSS_HARDWARE_BUSY -2
11792 ++
11793 + static inline long poll_pending(void)
11794 + {
11795 + return plpar_hcall_norets(H_POLL_PENDING);
11796 +diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
11797 +index b488663..5530b4b 100644
11798 +--- a/arch/powerpc/platforms/pseries/smp.c
11799 ++++ b/arch/powerpc/platforms/pseries/smp.c
11800 +@@ -57,6 +57,28 @@
11801 + */
11802 + static cpumask_t of_spin_map;
11803 +
11804 ++/* Query where a cpu is now. Return codes #defined in plpar_wrappers.h */
11805 ++int smp_query_cpu_stopped(unsigned int pcpu)
11806 ++{
11807 ++ int cpu_status, status;
11808 ++ int qcss_tok = rtas_token("query-cpu-stopped-state");
11809 ++
11810 ++ if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
11811 ++ printk(KERN_INFO "Firmware doesn't support "
11812 ++ "query-cpu-stopped-state\n");
11813 ++ return QCSS_HARDWARE_ERROR;
11814 ++ }
11815 ++
11816 ++ status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
11817 ++ if (status != 0) {
11818 ++ printk(KERN_ERR
11819 ++ "RTAS query-cpu-stopped-state failed: %i\n", status);
11820 ++ return status;
11821 ++ }
11822 ++
11823 ++ return cpu_status;
11824 ++}
11825 ++
11826 + /**
11827 + * smp_startup_cpu() - start the given cpu
11828 + *
11829 +@@ -82,6 +104,12 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
11830 +
11831 + pcpu = get_hard_smp_processor_id(lcpu);
11832 +
11833 ++ /* Check to see if the CPU out of FW already for kexec */
11834 ++ if (smp_query_cpu_stopped(pcpu) == QCSS_NOT_STOPPED){
11835 ++ cpu_set(lcpu, of_spin_map);
11836 ++ return 1;
11837 ++ }
11838 ++
11839 + /* Fixup atomic count: it exited inside IRQ handler. */
11840 + task_thread_info(paca[lcpu].__current)->preempt_count = 0;
11841 +
11842 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
11843 +index f8bcaef..e06d18c 100644
11844 +--- a/arch/s390/kvm/kvm-s390.c
11845 ++++ b/arch/s390/kvm/kvm-s390.c
11846 +@@ -339,11 +339,13 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
11847 +
11848 + rc = kvm_vcpu_init(vcpu, kvm, id);
11849 + if (rc)
11850 +- goto out_free_cpu;
11851 ++ goto out_free_sie_block;
11852 + VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu,
11853 + vcpu->arch.sie_block);
11854 +
11855 + return vcpu;
11856 ++out_free_sie_block:
11857 ++ free_page((unsigned long)(vcpu->arch.sie_block));
11858 + out_free_cpu:
11859 + kfree(vcpu);
11860 + out_nomem:
11861 +diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
11862 +index 4f865e8..e62b4b9 100644
11863 +--- a/arch/x86/include/asm/kvm_host.h
11864 ++++ b/arch/x86/include/asm/kvm_host.h
11865 +@@ -193,6 +193,7 @@ union kvm_mmu_page_role {
11866 + unsigned invalid:1;
11867 + unsigned cr4_pge:1;
11868 + unsigned nxe:1;
11869 ++ unsigned cr0_wp:1;
11870 + };
11871 + };
11872 +
11873 +@@ -533,6 +534,8 @@ struct kvm_x86_ops {
11874 + u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio);
11875 + bool (*gb_page_enable)(void);
11876 +
11877 ++ void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry);
11878 ++
11879 + const struct trace_print_flags *exit_reasons_str;
11880 + };
11881 +
11882 +diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
11883 +index 4604e6a..d86da72 100644
11884 +--- a/arch/x86/include/asm/msr-index.h
11885 ++++ b/arch/x86/include/asm/msr-index.h
11886 +@@ -199,8 +199,9 @@
11887 + #define MSR_IA32_EBL_CR_POWERON 0x0000002a
11888 + #define MSR_IA32_FEATURE_CONTROL 0x0000003a
11889 +
11890 +-#define FEATURE_CONTROL_LOCKED (1<<0)
11891 +-#define FEATURE_CONTROL_VMXON_ENABLED (1<<2)
11892 ++#define FEATURE_CONTROL_LOCKED (1<<0)
11893 ++#define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX (1<<1)
11894 ++#define FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX (1<<2)
11895 +
11896 + #define MSR_IA32_APICBASE 0x0000001b
11897 + #define MSR_IA32_APICBASE_BSP (1<<8)
11898 +diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
11899 +index 2e77516..ca15b93 100644
11900 +--- a/arch/x86/kernel/amd_iommu.c
11901 ++++ b/arch/x86/kernel/amd_iommu.c
11902 +@@ -1419,6 +1419,7 @@ static int __attach_device(struct device *dev,
11903 + struct protection_domain *domain)
11904 + {
11905 + struct iommu_dev_data *dev_data, *alias_data;
11906 ++ int ret;
11907 +
11908 + dev_data = get_dev_data(dev);
11909 + alias_data = get_dev_data(dev_data->alias);
11910 +@@ -1430,13 +1431,14 @@ static int __attach_device(struct device *dev,
11911 + spin_lock(&domain->lock);
11912 +
11913 + /* Some sanity checks */
11914 ++ ret = -EBUSY;
11915 + if (alias_data->domain != NULL &&
11916 + alias_data->domain != domain)
11917 +- return -EBUSY;
11918 ++ goto out_unlock;
11919 +
11920 + if (dev_data->domain != NULL &&
11921 + dev_data->domain != domain)
11922 +- return -EBUSY;
11923 ++ goto out_unlock;
11924 +
11925 + /* Do real assignment */
11926 + if (dev_data->alias != dev) {
11927 +@@ -1452,10 +1454,14 @@ static int __attach_device(struct device *dev,
11928 +
11929 + atomic_inc(&dev_data->bind);
11930 +
11931 ++ ret = 0;
11932 ++
11933 ++out_unlock:
11934 ++
11935 + /* ready */
11936 + spin_unlock(&domain->lock);
11937 +
11938 +- return 0;
11939 ++ return ret;
11940 + }
11941 +
11942 + /*
11943 +@@ -2256,10 +2262,6 @@ int __init amd_iommu_init_dma_ops(void)
11944 +
11945 + iommu_detected = 1;
11946 + swiotlb = 0;
11947 +-#ifdef CONFIG_GART_IOMMU
11948 +- gart_iommu_aperture_disabled = 1;
11949 +- gart_iommu_aperture = 0;
11950 +-#endif
11951 +
11952 + /* Make the driver finally visible to the drivers */
11953 + dma_ops = &amd_iommu_dma_ops;
11954 +diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
11955 +index 883d619..86a5a11 100644
11956 +--- a/arch/x86/kernel/amd_iommu_init.c
11957 ++++ b/arch/x86/kernel/amd_iommu_init.c
11958 +@@ -286,8 +286,12 @@ static u8 * __init iommu_map_mmio_space(u64 address)
11959 + {
11960 + u8 *ret;
11961 +
11962 +- if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu"))
11963 ++ if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu")) {
11964 ++ pr_err("AMD-Vi: Can not reserve memory region %llx for mmio\n",
11965 ++ address);
11966 ++ pr_err("AMD-Vi: This is a BIOS bug. Please contact your hardware vendor\n");
11967 + return NULL;
11968 ++ }
11969 +
11970 + ret = ioremap_nocache(address, MMIO_REGION_LENGTH);
11971 + if (ret != NULL)
11972 +@@ -1296,7 +1300,7 @@ static int __init amd_iommu_init(void)
11973 + ret = amd_iommu_init_dma_ops();
11974 +
11975 + if (ret)
11976 +- goto free;
11977 ++ goto free_disable;
11978 +
11979 + amd_iommu_init_api();
11980 +
11981 +@@ -1314,9 +1318,10 @@ static int __init amd_iommu_init(void)
11982 + out:
11983 + return ret;
11984 +
11985 +-free:
11986 ++free_disable:
11987 + disable_iommus();
11988 +
11989 ++free:
11990 + amd_iommu_uninit_devices();
11991 +
11992 + free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
11993 +@@ -1335,6 +1340,15 @@ free:
11994 +
11995 + free_unity_maps();
11996 +
11997 ++#ifdef CONFIG_GART_IOMMU
11998 ++ /*
11999 ++ * We failed to initialize the AMD IOMMU - try fallback to GART
12000 ++ * if possible.
12001 ++ */
12002 ++ gart_iommu_init();
12003 ++
12004 ++#endif
12005 ++
12006 + goto out;
12007 + }
12008 +
12009 +diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
12010 +index c7ca8e2..16307ff 100644
12011 +--- a/arch/x86/kernel/cpu/perf_event.c
12012 ++++ b/arch/x86/kernel/cpu/perf_event.c
12013 +@@ -1060,8 +1060,11 @@ static int __hw_perf_event_init(struct perf_event *event)
12014 + if (atomic_read(&active_events) == 0) {
12015 + if (!reserve_pmc_hardware())
12016 + err = -EBUSY;
12017 +- else
12018 ++ else {
12019 + err = reserve_bts_hardware();
12020 ++ if (err)
12021 ++ release_pmc_hardware();
12022 ++ }
12023 + }
12024 + if (!err)
12025 + atomic_inc(&active_events);
12026 +diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
12027 +index 03801f2..dfdfe46 100644
12028 +--- a/arch/x86/kernel/pvclock.c
12029 ++++ b/arch/x86/kernel/pvclock.c
12030 +@@ -109,11 +109,14 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
12031 + return pv_tsc_khz;
12032 + }
12033 +
12034 ++static atomic64_t last_value = ATOMIC64_INIT(0);
12035 ++
12036 + cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
12037 + {
12038 + struct pvclock_shadow_time shadow;
12039 + unsigned version;
12040 + cycle_t ret, offset;
12041 ++ u64 last;
12042 +
12043 + do {
12044 + version = pvclock_get_time_values(&shadow, src);
12045 +@@ -123,6 +126,27 @@ cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
12046 + barrier();
12047 + } while (version != src->version);
12048 +
12049 ++ /*
12050 ++ * Assumption here is that last_value, a global accumulator, always goes
12051 ++ * forward. If we are less than that, we should not be much smaller.
12052 ++ * We assume there is an error marging we're inside, and then the correction
12053 ++ * does not sacrifice accuracy.
12054 ++ *
12055 ++ * For reads: global may have changed between test and return,
12056 ++ * but this means someone else updated poked the clock at a later time.
12057 ++ * We just need to make sure we are not seeing a backwards event.
12058 ++ *
12059 ++ * For updates: last_value = ret is not enough, since two vcpus could be
12060 ++ * updating at the same time, and one of them could be slightly behind,
12061 ++ * making the assumption that last_value always go forward fail to hold.
12062 ++ */
12063 ++ last = atomic64_read(&last_value);
12064 ++ do {
12065 ++ if (ret < last)
12066 ++ return last;
12067 ++ last = atomic64_cmpxchg(&last_value, last, ret);
12068 ++ } while (unlikely(last != ret));
12069 ++
12070 + return ret;
12071 + }
12072 +
12073 +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
12074 +index 5d9e40c..4772a9f 100644
12075 +--- a/arch/x86/kernel/setup.c
12076 ++++ b/arch/x86/kernel/setup.c
12077 +@@ -663,6 +663,17 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
12078 + DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
12079 + },
12080 + },
12081 ++ /*
12082 ++ * The Dell Inspiron Mini 1012 has DMI_BIOS_VENDOR = "Dell Inc.", so
12083 ++ * match on the product name.
12084 ++ */
12085 ++ {
12086 ++ .callback = dmi_low_memory_corruption,
12087 ++ .ident = "Phoenix BIOS",
12088 ++ .matches = {
12089 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"),
12090 ++ },
12091 ++ },
12092 + #endif
12093 + {}
12094 + };
12095 +diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
12096 +index 86c9f91..46b8277 100644
12097 +--- a/arch/x86/kernel/tboot.c
12098 ++++ b/arch/x86/kernel/tboot.c
12099 +@@ -46,6 +46,7 @@
12100 +
12101 + /* Global pointer to shared data; NULL means no measured launch. */
12102 + struct tboot *tboot __read_mostly;
12103 ++EXPORT_SYMBOL(tboot);
12104 +
12105 + /* timeout for APs (in secs) to enter wait-for-SIPI state during shutdown */
12106 + #define AP_WAIT_TIMEOUT 1
12107 +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
12108 +index 28c3d81..8822021 100644
12109 +--- a/arch/x86/kvm/mmu.c
12110 ++++ b/arch/x86/kvm/mmu.c
12111 +@@ -227,7 +227,7 @@ void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
12112 + }
12113 + EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes);
12114 +
12115 +-static int is_write_protection(struct kvm_vcpu *vcpu)
12116 ++static bool is_write_protection(struct kvm_vcpu *vcpu)
12117 + {
12118 + return vcpu->arch.cr0 & X86_CR0_WP;
12119 + }
12120 +@@ -2097,11 +2097,14 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
12121 + direct = 1;
12122 + if (mmu_check_root(vcpu, root_gfn))
12123 + return 1;
12124 ++
12125 ++ spin_lock(&vcpu->kvm->mmu_lock);
12126 + sp = kvm_mmu_get_page(vcpu, root_gfn, 0,
12127 + PT64_ROOT_LEVEL, direct,
12128 + ACC_ALL, NULL);
12129 + root = __pa(sp->spt);
12130 + ++sp->root_count;
12131 ++ spin_unlock(&vcpu->kvm->mmu_lock);
12132 + vcpu->arch.mmu.root_hpa = root;
12133 + return 0;
12134 + }
12135 +@@ -2123,11 +2126,15 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
12136 + root_gfn = 0;
12137 + if (mmu_check_root(vcpu, root_gfn))
12138 + return 1;
12139 ++
12140 ++ spin_lock(&vcpu->kvm->mmu_lock);
12141 + sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
12142 + PT32_ROOT_LEVEL, direct,
12143 + ACC_ALL, NULL);
12144 + root = __pa(sp->spt);
12145 + ++sp->root_count;
12146 ++ spin_unlock(&vcpu->kvm->mmu_lock);
12147 ++
12148 + vcpu->arch.mmu.pae_root[i] = root | PT_PRESENT_MASK;
12149 + }
12150 + vcpu->arch.mmu.root_hpa = __pa(vcpu->arch.mmu.pae_root);
12151 +@@ -2448,6 +2455,7 @@ static int init_kvm_softmmu(struct kvm_vcpu *vcpu)
12152 + r = paging32_init_context(vcpu);
12153 +
12154 + vcpu->arch.mmu.base_role.glevels = vcpu->arch.mmu.root_level;
12155 ++ vcpu->arch.mmu.base_role.cr0_wp = is_write_protection(vcpu);
12156 +
12157 + return r;
12158 + }
12159 +@@ -2487,7 +2495,9 @@ int kvm_mmu_load(struct kvm_vcpu *vcpu)
12160 + goto out;
12161 + spin_lock(&vcpu->kvm->mmu_lock);
12162 + kvm_mmu_free_some_pages(vcpu);
12163 ++ spin_unlock(&vcpu->kvm->mmu_lock);
12164 + r = mmu_alloc_roots(vcpu);
12165 ++ spin_lock(&vcpu->kvm->mmu_lock);
12166 + mmu_sync_roots(vcpu);
12167 + spin_unlock(&vcpu->kvm->mmu_lock);
12168 + if (r)
12169 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
12170 +index d42e191..a2f839c 100644
12171 +--- a/arch/x86/kvm/svm.c
12172 ++++ b/arch/x86/kvm/svm.c
12173 +@@ -128,6 +128,7 @@ static void svm_flush_tlb(struct kvm_vcpu *vcpu);
12174 + static void svm_complete_interrupts(struct vcpu_svm *svm);
12175 +
12176 + static int nested_svm_exit_handled(struct vcpu_svm *svm);
12177 ++static int nested_svm_intercept(struct vcpu_svm *svm);
12178 + static int nested_svm_vmexit(struct vcpu_svm *svm);
12179 + static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr,
12180 + bool has_error_code, u32 error_code);
12181 +@@ -1359,6 +1360,8 @@ static int nested_svm_check_permissions(struct vcpu_svm *svm)
12182 + static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr,
12183 + bool has_error_code, u32 error_code)
12184 + {
12185 ++ int vmexit;
12186 ++
12187 + if (!is_nested(svm))
12188 + return 0;
12189 +
12190 +@@ -1367,19 +1370,24 @@ static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr,
12191 + svm->vmcb->control.exit_info_1 = error_code;
12192 + svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2;
12193 +
12194 +- return nested_svm_exit_handled(svm);
12195 ++ vmexit = nested_svm_intercept(svm);
12196 ++ if (vmexit == NESTED_EXIT_DONE)
12197 ++ svm->nested.exit_required = true;
12198 ++
12199 ++ return vmexit;
12200 + }
12201 +
12202 +-static inline int nested_svm_intr(struct vcpu_svm *svm)
12203 ++/* This function returns true if it is save to enable the irq window */
12204 ++static inline bool nested_svm_intr(struct vcpu_svm *svm)
12205 + {
12206 + if (!is_nested(svm))
12207 +- return 0;
12208 ++ return true;
12209 +
12210 + if (!(svm->vcpu.arch.hflags & HF_VINTR_MASK))
12211 +- return 0;
12212 ++ return true;
12213 +
12214 + if (!(svm->vcpu.arch.hflags & HF_HIF_MASK))
12215 +- return 0;
12216 ++ return false;
12217 +
12218 + svm->vmcb->control.exit_code = SVM_EXIT_INTR;
12219 +
12220 +@@ -1392,13 +1400,13 @@ static inline int nested_svm_intr(struct vcpu_svm *svm)
12221 + */
12222 + svm->nested.exit_required = true;
12223 + trace_kvm_nested_intr_vmexit(svm->vmcb->save.rip);
12224 +- return 1;
12225 ++ return false;
12226 + }
12227 +
12228 +- return 0;
12229 ++ return true;
12230 + }
12231 +
12232 +-static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, enum km_type idx)
12233 ++static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, struct page **_page)
12234 + {
12235 + struct page *page;
12236 +
12237 +@@ -1406,7 +1414,9 @@ static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, enum km_type idx)
12238 + if (is_error_page(page))
12239 + goto error;
12240 +
12241 +- return kmap_atomic(page, idx);
12242 ++ *_page = page;
12243 ++
12244 ++ return kmap(page);
12245 +
12246 + error:
12247 + kvm_release_page_clean(page);
12248 +@@ -1415,16 +1425,9 @@ error:
12249 + return NULL;
12250 + }
12251 +
12252 +-static void nested_svm_unmap(void *addr, enum km_type idx)
12253 ++static void nested_svm_unmap(struct page *page)
12254 + {
12255 +- struct page *page;
12256 +-
12257 +- if (!addr)
12258 +- return;
12259 +-
12260 +- page = kmap_atomic_to_page(addr);
12261 +-
12262 +- kunmap_atomic(addr, idx);
12263 ++ kunmap(page);
12264 + kvm_release_page_dirty(page);
12265 + }
12266 +
12267 +@@ -1434,16 +1437,11 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm)
12268 + u32 msr = svm->vcpu.arch.regs[VCPU_REGS_RCX];
12269 + bool ret = false;
12270 + u32 t0, t1;
12271 +- u8 *msrpm;
12272 ++ u8 val;
12273 +
12274 + if (!(svm->nested.intercept & (1ULL << INTERCEPT_MSR_PROT)))
12275 + return false;
12276 +
12277 +- msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, KM_USER0);
12278 +-
12279 +- if (!msrpm)
12280 +- goto out;
12281 +-
12282 + switch (msr) {
12283 + case 0 ... 0x1fff:
12284 + t0 = (msr * 2) % 8;
12285 +@@ -1464,11 +1462,10 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm)
12286 + goto out;
12287 + }
12288 +
12289 +- ret = msrpm[t1] & ((1 << param) << t0);
12290 ++ if (!kvm_read_guest(svm->vcpu.kvm, svm->nested.vmcb_msrpm + t1, &val, 1))
12291 ++ ret = val & ((1 << param) << t0);
12292 +
12293 + out:
12294 +- nested_svm_unmap(msrpm, KM_USER0);
12295 +-
12296 + return ret;
12297 + }
12298 +
12299 +@@ -1500,7 +1497,7 @@ static int nested_svm_exit_special(struct vcpu_svm *svm)
12300 + /*
12301 + * If this function returns true, this #vmexit was already handled
12302 + */
12303 +-static int nested_svm_exit_handled(struct vcpu_svm *svm)
12304 ++static int nested_svm_intercept(struct vcpu_svm *svm)
12305 + {
12306 + u32 exit_code = svm->vmcb->control.exit_code;
12307 + int vmexit = NESTED_EXIT_HOST;
12308 +@@ -1546,9 +1543,17 @@ static int nested_svm_exit_handled(struct vcpu_svm *svm)
12309 + }
12310 + }
12311 +
12312 +- if (vmexit == NESTED_EXIT_DONE) {
12313 ++ return vmexit;
12314 ++}
12315 ++
12316 ++static int nested_svm_exit_handled(struct vcpu_svm *svm)
12317 ++{
12318 ++ int vmexit;
12319 ++
12320 ++ vmexit = nested_svm_intercept(svm);
12321 ++
12322 ++ if (vmexit == NESTED_EXIT_DONE)
12323 + nested_svm_vmexit(svm);
12324 +- }
12325 +
12326 + return vmexit;
12327 + }
12328 +@@ -1590,6 +1595,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
12329 + struct vmcb *nested_vmcb;
12330 + struct vmcb *hsave = svm->nested.hsave;
12331 + struct vmcb *vmcb = svm->vmcb;
12332 ++ struct page *page;
12333 +
12334 + trace_kvm_nested_vmexit_inject(vmcb->control.exit_code,
12335 + vmcb->control.exit_info_1,
12336 +@@ -1597,7 +1603,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
12337 + vmcb->control.exit_int_info,
12338 + vmcb->control.exit_int_info_err);
12339 +
12340 +- nested_vmcb = nested_svm_map(svm, svm->nested.vmcb, KM_USER0);
12341 ++ nested_vmcb = nested_svm_map(svm, svm->nested.vmcb, &page);
12342 + if (!nested_vmcb)
12343 + return 1;
12344 +
12345 +@@ -1610,9 +1616,13 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
12346 + nested_vmcb->save.ds = vmcb->save.ds;
12347 + nested_vmcb->save.gdtr = vmcb->save.gdtr;
12348 + nested_vmcb->save.idtr = vmcb->save.idtr;
12349 ++ nested_vmcb->save.cr0 = svm->vcpu.arch.cr0;
12350 + if (npt_enabled)
12351 + nested_vmcb->save.cr3 = vmcb->save.cr3;
12352 ++ else
12353 ++ nested_vmcb->save.cr3 = svm->vcpu.arch.cr3;
12354 + nested_vmcb->save.cr2 = vmcb->save.cr2;
12355 ++ nested_vmcb->save.cr4 = svm->vcpu.arch.cr4;
12356 + nested_vmcb->save.rflags = vmcb->save.rflags;
12357 + nested_vmcb->save.rip = vmcb->save.rip;
12358 + nested_vmcb->save.rsp = vmcb->save.rsp;
12359 +@@ -1687,7 +1697,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
12360 + /* Exit nested SVM mode */
12361 + svm->nested.vmcb = 0;
12362 +
12363 +- nested_svm_unmap(nested_vmcb, KM_USER0);
12364 ++ nested_svm_unmap(page);
12365 +
12366 + kvm_mmu_reset_context(&svm->vcpu);
12367 + kvm_mmu_load(&svm->vcpu);
12368 +@@ -1698,9 +1708,10 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
12369 + static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
12370 + {
12371 + u32 *nested_msrpm;
12372 ++ struct page *page;
12373 + int i;
12374 +
12375 +- nested_msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, KM_USER0);
12376 ++ nested_msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, &page);
12377 + if (!nested_msrpm)
12378 + return false;
12379 +
12380 +@@ -1709,7 +1720,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
12381 +
12382 + svm->vmcb->control.msrpm_base_pa = __pa(svm->nested.msrpm);
12383 +
12384 +- nested_svm_unmap(nested_msrpm, KM_USER0);
12385 ++ nested_svm_unmap(page);
12386 +
12387 + return true;
12388 + }
12389 +@@ -1719,8 +1730,9 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
12390 + struct vmcb *nested_vmcb;
12391 + struct vmcb *hsave = svm->nested.hsave;
12392 + struct vmcb *vmcb = svm->vmcb;
12393 ++ struct page *page;
12394 +
12395 +- nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, KM_USER0);
12396 ++ nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page);
12397 + if (!nested_vmcb)
12398 + return false;
12399 +
12400 +@@ -1794,21 +1806,6 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
12401 + svm->vmcb->save.dr6 = nested_vmcb->save.dr6;
12402 + svm->vmcb->save.cpl = nested_vmcb->save.cpl;
12403 +
12404 +- /* We don't want a nested guest to be more powerful than the guest,
12405 +- so all intercepts are ORed */
12406 +- svm->vmcb->control.intercept_cr_read |=
12407 +- nested_vmcb->control.intercept_cr_read;
12408 +- svm->vmcb->control.intercept_cr_write |=
12409 +- nested_vmcb->control.intercept_cr_write;
12410 +- svm->vmcb->control.intercept_dr_read |=
12411 +- nested_vmcb->control.intercept_dr_read;
12412 +- svm->vmcb->control.intercept_dr_write |=
12413 +- nested_vmcb->control.intercept_dr_write;
12414 +- svm->vmcb->control.intercept_exceptions |=
12415 +- nested_vmcb->control.intercept_exceptions;
12416 +-
12417 +- svm->vmcb->control.intercept |= nested_vmcb->control.intercept;
12418 +-
12419 + svm->nested.vmcb_msrpm = nested_vmcb->control.msrpm_base_pa;
12420 +
12421 + /* cache intercepts */
12422 +@@ -1826,13 +1823,40 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
12423 + else
12424 + svm->vcpu.arch.hflags &= ~HF_VINTR_MASK;
12425 +
12426 ++ if (svm->vcpu.arch.hflags & HF_VINTR_MASK) {
12427 ++ /* We only want the cr8 intercept bits of the guest */
12428 ++ svm->vmcb->control.intercept_cr_read &= ~INTERCEPT_CR8_MASK;
12429 ++ svm->vmcb->control.intercept_cr_write &= ~INTERCEPT_CR8_MASK;
12430 ++ }
12431 ++
12432 ++ /* We don't want to see VMMCALLs from a nested guest */
12433 ++ svm->vmcb->control.intercept &= ~(1ULL << INTERCEPT_VMMCALL);
12434 ++
12435 ++ /*
12436 ++ * We don't want a nested guest to be more powerful than the guest, so
12437 ++ * all intercepts are ORed
12438 ++ */
12439 ++ svm->vmcb->control.intercept_cr_read |=
12440 ++ nested_vmcb->control.intercept_cr_read;
12441 ++ svm->vmcb->control.intercept_cr_write |=
12442 ++ nested_vmcb->control.intercept_cr_write;
12443 ++ svm->vmcb->control.intercept_dr_read |=
12444 ++ nested_vmcb->control.intercept_dr_read;
12445 ++ svm->vmcb->control.intercept_dr_write |=
12446 ++ nested_vmcb->control.intercept_dr_write;
12447 ++ svm->vmcb->control.intercept_exceptions |=
12448 ++ nested_vmcb->control.intercept_exceptions;
12449 ++
12450 ++ svm->vmcb->control.intercept |= nested_vmcb->control.intercept;
12451 ++
12452 ++ svm->vmcb->control.lbr_ctl = nested_vmcb->control.lbr_ctl;
12453 + svm->vmcb->control.int_vector = nested_vmcb->control.int_vector;
12454 + svm->vmcb->control.int_state = nested_vmcb->control.int_state;
12455 + svm->vmcb->control.tsc_offset += nested_vmcb->control.tsc_offset;
12456 + svm->vmcb->control.event_inj = nested_vmcb->control.event_inj;
12457 + svm->vmcb->control.event_inj_err = nested_vmcb->control.event_inj_err;
12458 +
12459 +- nested_svm_unmap(nested_vmcb, KM_USER0);
12460 ++ nested_svm_unmap(page);
12461 +
12462 + enable_gif(svm);
12463 +
12464 +@@ -1858,6 +1882,7 @@ static void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
12465 + static int vmload_interception(struct vcpu_svm *svm)
12466 + {
12467 + struct vmcb *nested_vmcb;
12468 ++ struct page *page;
12469 +
12470 + if (nested_svm_check_permissions(svm))
12471 + return 1;
12472 +@@ -1865,12 +1890,12 @@ static int vmload_interception(struct vcpu_svm *svm)
12473 + svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
12474 + skip_emulated_instruction(&svm->vcpu);
12475 +
12476 +- nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, KM_USER0);
12477 ++ nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page);
12478 + if (!nested_vmcb)
12479 + return 1;
12480 +
12481 + nested_svm_vmloadsave(nested_vmcb, svm->vmcb);
12482 +- nested_svm_unmap(nested_vmcb, KM_USER0);
12483 ++ nested_svm_unmap(page);
12484 +
12485 + return 1;
12486 + }
12487 +@@ -1878,6 +1903,7 @@ static int vmload_interception(struct vcpu_svm *svm)
12488 + static int vmsave_interception(struct vcpu_svm *svm)
12489 + {
12490 + struct vmcb *nested_vmcb;
12491 ++ struct page *page;
12492 +
12493 + if (nested_svm_check_permissions(svm))
12494 + return 1;
12495 +@@ -1885,12 +1911,12 @@ static int vmsave_interception(struct vcpu_svm *svm)
12496 + svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
12497 + skip_emulated_instruction(&svm->vcpu);
12498 +
12499 +- nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, KM_USER0);
12500 ++ nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page);
12501 + if (!nested_vmcb)
12502 + return 1;
12503 +
12504 + nested_svm_vmloadsave(svm->vmcb, nested_vmcb);
12505 +- nested_svm_unmap(nested_vmcb, KM_USER0);
12506 ++ nested_svm_unmap(page);
12507 +
12508 + return 1;
12509 + }
12510 +@@ -2487,6 +2513,9 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
12511 + {
12512 + struct vcpu_svm *svm = to_svm(vcpu);
12513 +
12514 ++ if (is_nested(svm) && (vcpu->arch.hflags & HF_VINTR_MASK))
12515 ++ return;
12516 ++
12517 + if (irr == -1)
12518 + return;
12519 +
12520 +@@ -2544,13 +2573,11 @@ static void enable_irq_window(struct kvm_vcpu *vcpu)
12521 + {
12522 + struct vcpu_svm *svm = to_svm(vcpu);
12523 +
12524 +- nested_svm_intr(svm);
12525 +-
12526 + /* In case GIF=0 we can't rely on the CPU to tell us when
12527 + * GIF becomes 1, because that's a separate STGI/VMRUN intercept.
12528 + * The next time we get that intercept, this function will be
12529 + * called again though and we'll get the vintr intercept. */
12530 +- if (gif_set(svm)) {
12531 ++ if (gif_set(svm) && nested_svm_intr(svm)) {
12532 + svm_set_vintr(svm);
12533 + svm_inject_irq(svm, 0x0);
12534 + }
12535 +@@ -2590,6 +2617,9 @@ static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu)
12536 + {
12537 + struct vcpu_svm *svm = to_svm(vcpu);
12538 +
12539 ++ if (is_nested(svm) && (vcpu->arch.hflags & HF_VINTR_MASK))
12540 ++ return;
12541 ++
12542 + if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR8_MASK)) {
12543 + int cr8 = svm->vmcb->control.int_ctl & V_TPR_MASK;
12544 + kvm_set_cr8(vcpu, cr8);
12545 +@@ -2601,6 +2631,9 @@ static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
12546 + struct vcpu_svm *svm = to_svm(vcpu);
12547 + u64 cr8;
12548 +
12549 ++ if (is_nested(svm) && (vcpu->arch.hflags & HF_VINTR_MASK))
12550 ++ return;
12551 ++
12552 + cr8 = kvm_get_cr8(vcpu);
12553 + svm->vmcb->control.int_ctl &= ~V_TPR_MASK;
12554 + svm->vmcb->control.int_ctl |= cr8 & V_TPR_MASK;
12555 +@@ -2857,6 +2890,20 @@ static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
12556 + return 0;
12557 + }
12558 +
12559 ++static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
12560 ++{
12561 ++ switch (func) {
12562 ++ case 0x8000000A:
12563 ++ entry->eax = 1; /* SVM revision 1 */
12564 ++ entry->ebx = 8; /* Lets support 8 ASIDs in case we add proper
12565 ++ ASID emulation to nested SVM */
12566 ++ entry->ecx = 0; /* Reserved */
12567 ++ entry->edx = 0; /* Do not support any additional features */
12568 ++
12569 ++ break;
12570 ++ }
12571 ++}
12572 ++
12573 + static const struct trace_print_flags svm_exit_reasons_str[] = {
12574 + { SVM_EXIT_READ_CR0, "read_cr0" },
12575 + { SVM_EXIT_READ_CR3, "read_cr3" },
12576 +@@ -2981,6 +3028,7 @@ static struct kvm_x86_ops svm_x86_ops = {
12577 +
12578 + .exit_reasons_str = svm_exit_reasons_str,
12579 + .gb_page_enable = svm_gb_page_enable,
12580 ++ .set_supported_cpuid = svm_set_supported_cpuid,
12581 + };
12582 +
12583 + static int __init svm_init(void)
12584 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
12585 +index 3acbe19..2840568 100644
12586 +--- a/arch/x86/kvm/vmx.c
12587 ++++ b/arch/x86/kvm/vmx.c
12588 +@@ -26,6 +26,7 @@
12589 + #include <linux/sched.h>
12590 + #include <linux/moduleparam.h>
12591 + #include <linux/ftrace_event.h>
12592 ++#include <linux/tboot.h>
12593 + #include "kvm_cache_regs.h"
12594 + #include "x86.h"
12595 +
12596 +@@ -1125,9 +1126,16 @@ static __init int vmx_disabled_by_bios(void)
12597 + u64 msr;
12598 +
12599 + rdmsrl(MSR_IA32_FEATURE_CONTROL, msr);
12600 +- return (msr & (FEATURE_CONTROL_LOCKED |
12601 +- FEATURE_CONTROL_VMXON_ENABLED))
12602 +- == FEATURE_CONTROL_LOCKED;
12603 ++ if (msr & FEATURE_CONTROL_LOCKED) {
12604 ++ if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX)
12605 ++ && tboot_enabled())
12606 ++ return 1;
12607 ++ if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX)
12608 ++ && !tboot_enabled())
12609 ++ return 1;
12610 ++ }
12611 ++
12612 ++ return 0;
12613 + /* locked but not enabled */
12614 + }
12615 +
12616 +@@ -1135,21 +1143,23 @@ static int hardware_enable(void *garbage)
12617 + {
12618 + int cpu = raw_smp_processor_id();
12619 + u64 phys_addr = __pa(per_cpu(vmxarea, cpu));
12620 +- u64 old;
12621 ++ u64 old, test_bits;
12622 +
12623 + if (read_cr4() & X86_CR4_VMXE)
12624 + return -EBUSY;
12625 +
12626 + INIT_LIST_HEAD(&per_cpu(vcpus_on_cpu, cpu));
12627 + rdmsrl(MSR_IA32_FEATURE_CONTROL, old);
12628 +- if ((old & (FEATURE_CONTROL_LOCKED |
12629 +- FEATURE_CONTROL_VMXON_ENABLED))
12630 +- != (FEATURE_CONTROL_LOCKED |
12631 +- FEATURE_CONTROL_VMXON_ENABLED))
12632 ++
12633 ++ test_bits = FEATURE_CONTROL_LOCKED;
12634 ++ test_bits |= FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
12635 ++ if (tboot_enabled())
12636 ++ test_bits |= FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX;
12637 ++
12638 ++ if ((old & test_bits) != test_bits) {
12639 + /* enable and lock */
12640 +- wrmsrl(MSR_IA32_FEATURE_CONTROL, old |
12641 +- FEATURE_CONTROL_LOCKED |
12642 +- FEATURE_CONTROL_VMXON_ENABLED);
12643 ++ wrmsrl(MSR_IA32_FEATURE_CONTROL, old | test_bits);
12644 ++ }
12645 + write_cr4(read_cr4() | X86_CR4_VMXE); /* FIXME: not cpu hotplug safe */
12646 + asm volatile (ASM_VMX_VMXON_RAX
12647 + : : "a"(&phys_addr), "m"(phys_addr)
12648 +@@ -3993,6 +4003,10 @@ static bool vmx_gb_page_enable(void)
12649 + return false;
12650 + }
12651 +
12652 ++static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
12653 ++{
12654 ++}
12655 ++
12656 + static struct kvm_x86_ops vmx_x86_ops = {
12657 + .cpu_has_kvm_support = cpu_has_kvm_support,
12658 + .disabled_by_bios = vmx_disabled_by_bios,
12659 +@@ -4057,6 +4071,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
12660 +
12661 + .exit_reasons_str = vmx_exit_reasons_str,
12662 + .gb_page_enable = vmx_gb_page_enable,
12663 ++ .set_supported_cpuid = vmx_set_supported_cpuid,
12664 + };
12665 +
12666 + static int __init vmx_init(void)
12667 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
12668 +index dd78927..07750de 100644
12669 +--- a/arch/x86/kvm/x86.c
12670 ++++ b/arch/x86/kvm/x86.c
12671 +@@ -432,7 +432,7 @@ EXPORT_SYMBOL_GPL(kvm_set_cr0);
12672 +
12673 + void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw)
12674 + {
12675 +- kvm_set_cr0(vcpu, (vcpu->arch.cr0 & ~0x0ful) | (msw & 0x0f));
12676 ++ kvm_set_cr0(vcpu, (vcpu->arch.cr0 & ~0x0eul) | (msw & 0x0f));
12677 + }
12678 + EXPORT_SYMBOL_GPL(kvm_lmsw);
12679 +
12680 +@@ -570,48 +570,42 @@ static u32 emulated_msrs[] = {
12681 + MSR_IA32_MISC_ENABLE,
12682 + };
12683 +
12684 +-static void set_efer(struct kvm_vcpu *vcpu, u64 efer)
12685 ++static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
12686 + {
12687 +- if (efer & efer_reserved_bits) {
12688 +- kvm_inject_gp(vcpu, 0);
12689 +- return;
12690 +- }
12691 ++ if (efer & efer_reserved_bits)
12692 ++ return 1;
12693 +
12694 + if (is_paging(vcpu)
12695 +- && (vcpu->arch.shadow_efer & EFER_LME) != (efer & EFER_LME)) {
12696 +- kvm_inject_gp(vcpu, 0);
12697 +- return;
12698 +- }
12699 ++ && (vcpu->arch.shadow_efer & EFER_LME) != (efer & EFER_LME))
12700 ++ return 1;
12701 +
12702 + if (efer & EFER_FFXSR) {
12703 + struct kvm_cpuid_entry2 *feat;
12704 +
12705 + feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
12706 +- if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT))) {
12707 +- kvm_inject_gp(vcpu, 0);
12708 +- return;
12709 +- }
12710 ++ if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT)))
12711 ++ return 1;
12712 + }
12713 +
12714 + if (efer & EFER_SVME) {
12715 + struct kvm_cpuid_entry2 *feat;
12716 +
12717 + feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
12718 +- if (!feat || !(feat->ecx & bit(X86_FEATURE_SVM))) {
12719 +- kvm_inject_gp(vcpu, 0);
12720 +- return;
12721 +- }
12722 ++ if (!feat || !(feat->ecx & bit(X86_FEATURE_SVM)))
12723 ++ return 1;
12724 + }
12725 +
12726 +- kvm_x86_ops->set_efer(vcpu, efer);
12727 +-
12728 + efer &= ~EFER_LMA;
12729 + efer |= vcpu->arch.shadow_efer & EFER_LMA;
12730 +
12731 ++ kvm_x86_ops->set_efer(vcpu, efer);
12732 ++
12733 + vcpu->arch.shadow_efer = efer;
12734 +
12735 + vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled;
12736 + kvm_mmu_reset_context(vcpu);
12737 ++
12738 ++ return 0;
12739 + }
12740 +
12741 + void kvm_enable_efer_bits(u64 mask)
12742 +@@ -641,14 +635,22 @@ static int do_set_msr(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
12743 +
12744 + static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
12745 + {
12746 +- static int version;
12747 ++ int version;
12748 ++ int r;
12749 + struct pvclock_wall_clock wc;
12750 + struct timespec boot;
12751 +
12752 + if (!wall_clock)
12753 + return;
12754 +
12755 +- version++;
12756 ++ r = kvm_read_guest(kvm, wall_clock, &version, sizeof(version));
12757 ++ if (r)
12758 ++ return;
12759 ++
12760 ++ if (version & 1)
12761 ++ ++version; /* first time write, random junk */
12762 ++
12763 ++ ++version;
12764 +
12765 + kvm_write_guest(kvm, wall_clock, &version, sizeof(version));
12766 +
12767 +@@ -938,8 +940,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
12768 + {
12769 + switch (msr) {
12770 + case MSR_EFER:
12771 +- set_efer(vcpu, data);
12772 +- break;
12773 ++ return set_efer(vcpu, data);
12774 + case MSR_K7_HWCR:
12775 + data &= ~(u64)0x40; /* ignore flush filter disable */
12776 + if (data != 0) {
12777 +@@ -1542,6 +1543,7 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
12778 + {
12779 + int r;
12780 +
12781 ++ vcpu_load(vcpu);
12782 + r = -E2BIG;
12783 + if (cpuid->nent < vcpu->arch.cpuid_nent)
12784 + goto out;
12785 +@@ -1553,6 +1555,7 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
12786 +
12787 + out:
12788 + cpuid->nent = vcpu->arch.cpuid_nent;
12789 ++ vcpu_put(vcpu);
12790 + return r;
12791 + }
12792 +
12793 +@@ -1688,6 +1691,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
12794 + entry->ecx &= kvm_supported_word6_x86_features;
12795 + break;
12796 + }
12797 ++
12798 ++ kvm_x86_ops->set_supported_cpuid(function, entry);
12799 ++
12800 + put_cpu();
12801 + }
12802 +
12803 +@@ -1802,6 +1808,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
12804 + int r;
12805 + unsigned bank_num = mcg_cap & 0xff, bank;
12806 +
12807 ++ vcpu_load(vcpu);
12808 + r = -EINVAL;
12809 + if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS)
12810 + goto out;
12811 +@@ -1816,6 +1823,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
12812 + for (bank = 0; bank < bank_num; bank++)
12813 + vcpu->arch.mce_banks[bank*4] = ~(u64)0;
12814 + out:
12815 ++ vcpu_put(vcpu);
12816 + return r;
12817 + }
12818 +
12819 +@@ -2083,7 +2091,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
12820 + r = -EFAULT;
12821 + if (copy_from_user(&mce, argp, sizeof mce))
12822 + goto out;
12823 ++ vcpu_load(vcpu);
12824 + r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce);
12825 ++ vcpu_put(vcpu);
12826 + break;
12827 + }
12828 + case KVM_GET_VCPU_EVENTS: {
12829 +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
12830 +index 2c505ee..f1fb411 100644
12831 +--- a/arch/x86/oprofile/nmi_int.c
12832 ++++ b/arch/x86/oprofile/nmi_int.c
12833 +@@ -95,7 +95,10 @@ static void nmi_cpu_save_registers(struct op_msrs *msrs)
12834 + static void nmi_cpu_start(void *dummy)
12835 + {
12836 + struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs);
12837 +- model->start(msrs);
12838 ++ if (!msrs->controls)
12839 ++ WARN_ON_ONCE(1);
12840 ++ else
12841 ++ model->start(msrs);
12842 + }
12843 +
12844 + static int nmi_start(void)
12845 +@@ -107,7 +110,10 @@ static int nmi_start(void)
12846 + static void nmi_cpu_stop(void *dummy)
12847 + {
12848 + struct op_msrs const *msrs = &__get_cpu_var(cpu_msrs);
12849 +- model->stop(msrs);
12850 ++ if (!msrs->controls)
12851 ++ WARN_ON_ONCE(1);
12852 ++ else
12853 ++ model->stop(msrs);
12854 + }
12855 +
12856 + static void nmi_stop(void)
12857 +diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
12858 +index 987267f..a9c6611 100644
12859 +--- a/arch/x86/xen/suspend.c
12860 ++++ b/arch/x86/xen/suspend.c
12861 +@@ -60,6 +60,6 @@ static void xen_vcpu_notify_restore(void *data)
12862 +
12863 + void xen_arch_resume(void)
12864 + {
12865 +- smp_call_function(xen_vcpu_notify_restore,
12866 +- (void *)CLOCK_EVT_NOTIFY_RESUME, 1);
12867 ++ on_each_cpu(xen_vcpu_notify_restore,
12868 ++ (void *)CLOCK_EVT_NOTIFY_RESUME, 1);
12869 + }
12870 +diff --git a/arch/xtensa/include/asm/cache.h b/arch/xtensa/include/asm/cache.h
12871 +index f04c989..ed8cd3c 100644
12872 +--- a/arch/xtensa/include/asm/cache.h
12873 ++++ b/arch/xtensa/include/asm/cache.h
12874 +@@ -29,5 +29,6 @@
12875 + # define CACHE_WAY_SIZE ICACHE_WAY_SIZE
12876 + #endif
12877 +
12878 ++#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
12879 +
12880 + #endif /* _XTENSA_CACHE_H */
12881 +diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
12882 +index 023f4e6..d0f8146 100644
12883 +--- a/block/cfq-iosched.c
12884 ++++ b/block/cfq-iosched.c
12885 +@@ -2481,15 +2481,10 @@ static void cfq_free_io_context(struct io_context *ioc)
12886 + __call_for_each_cic(ioc, cic_free_func);
12887 + }
12888 +
12889 +-static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
12890 ++static void cfq_put_cooperator(struct cfq_queue *cfqq)
12891 + {
12892 + struct cfq_queue *__cfqq, *next;
12893 +
12894 +- if (unlikely(cfqq == cfqd->active_queue)) {
12895 +- __cfq_slice_expired(cfqd, cfqq, 0);
12896 +- cfq_schedule_dispatch(cfqd);
12897 +- }
12898 +-
12899 + /*
12900 + * If this queue was scheduled to merge with another queue, be
12901 + * sure to drop the reference taken on that queue (and others in
12902 +@@ -2505,6 +2500,16 @@ static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
12903 + cfq_put_queue(__cfqq);
12904 + __cfqq = next;
12905 + }
12906 ++}
12907 ++
12908 ++static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
12909 ++{
12910 ++ if (unlikely(cfqq == cfqd->active_queue)) {
12911 ++ __cfq_slice_expired(cfqd, cfqq, 0);
12912 ++ cfq_schedule_dispatch(cfqd);
12913 ++ }
12914 ++
12915 ++ cfq_put_cooperator(cfqq);
12916 +
12917 + cfq_put_queue(cfqq);
12918 + }
12919 +@@ -3459,6 +3464,9 @@ split_cfqq(struct cfq_io_context *cic, struct cfq_queue *cfqq)
12920 + }
12921 +
12922 + cic_set_cfqq(cic, NULL, 1);
12923 ++
12924 ++ cfq_put_cooperator(cfqq);
12925 ++
12926 + cfq_put_queue(cfqq);
12927 + return NULL;
12928 + }
12929 +diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
12930 +index fc2f26b..c5fef01 100644
12931 +--- a/drivers/acpi/video_detect.c
12932 ++++ b/drivers/acpi/video_detect.c
12933 +@@ -250,7 +250,7 @@ static int __init acpi_backlight(char *str)
12934 + ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR;
12935 + if (!strcmp("video", str))
12936 + acpi_video_support |=
12937 +- ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO;
12938 ++ ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO;
12939 + }
12940 + return 1;
12941 + }
12942 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
12943 +index 2401c9c..8e9b132 100644
12944 +--- a/drivers/ata/libata-core.c
12945 ++++ b/drivers/ata/libata-core.c
12946 +@@ -159,6 +159,10 @@ int libata_allow_tpm = 0;
12947 + module_param_named(allow_tpm, libata_allow_tpm, int, 0444);
12948 + MODULE_PARM_DESC(allow_tpm, "Permit the use of TPM commands (0=off [default], 1=on)");
12949 +
12950 ++static int atapi_an;
12951 ++module_param(atapi_an, int, 0444);
12952 ++MODULE_PARM_DESC(atapi_an, "Enable ATAPI AN media presence notification (0=0ff [default], 1=on)");
12953 ++
12954 + MODULE_AUTHOR("Jeff Garzik");
12955 + MODULE_DESCRIPTION("Library module for ATA devices");
12956 + MODULE_LICENSE("GPL");
12957 +@@ -2570,7 +2574,8 @@ int ata_dev_configure(struct ata_device *dev)
12958 + * to enable ATAPI AN to discern between PHY status
12959 + * changed notifications and ATAPI ANs.
12960 + */
12961 +- if ((ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) &&
12962 ++ if (atapi_an &&
12963 ++ (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) &&
12964 + (!sata_pmp_attached(ap) ||
12965 + sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) {
12966 + unsigned int err_mask;
12967 +diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
12968 +index 730ef3c..06e7204 100644
12969 +--- a/drivers/ata/libata-sff.c
12970 ++++ b/drivers/ata/libata-sff.c
12971 +@@ -893,7 +893,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
12972 + do_write);
12973 + }
12974 +
12975 +- if (!do_write)
12976 ++ if (!do_write && !PageSlab(page))
12977 + flush_dcache_page(page);
12978 +
12979 + qc->curbytes += qc->sect_size;
12980 +diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
12981 +index 0c82d33..952641e 100644
12982 +--- a/drivers/ata/sata_nv.c
12983 ++++ b/drivers/ata/sata_nv.c
12984 +@@ -1673,7 +1673,6 @@ static void nv_mcp55_freeze(struct ata_port *ap)
12985 + mask = readl(mmio_base + NV_INT_ENABLE_MCP55);
12986 + mask &= ~(NV_INT_ALL_MCP55 << shift);
12987 + writel(mask, mmio_base + NV_INT_ENABLE_MCP55);
12988 +- ata_sff_freeze(ap);
12989 + }
12990 +
12991 + static void nv_mcp55_thaw(struct ata_port *ap)
12992 +@@ -1687,7 +1686,6 @@ static void nv_mcp55_thaw(struct ata_port *ap)
12993 + mask = readl(mmio_base + NV_INT_ENABLE_MCP55);
12994 + mask |= (NV_INT_MASK_MCP55 << shift);
12995 + writel(mask, mmio_base + NV_INT_ENABLE_MCP55);
12996 +- ata_sff_thaw(ap);
12997 + }
12998 +
12999 + static void nv_adma_error_handler(struct ata_port *ap)
13000 +@@ -2478,8 +2476,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
13001 + }
13002 +
13003 + pci_set_master(pdev);
13004 +- return ata_host_activate(host, pdev->irq, ipriv->irq_handler,
13005 +- IRQF_SHARED, ipriv->sht);
13006 ++ return ata_pci_sff_activate_host(host, ipriv->irq_handler, ipriv->sht);
13007 + }
13008 +
13009 + #ifdef CONFIG_PM
13010 +diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
13011 +index 02efd9a..e35596b 100644
13012 +--- a/drivers/ata/sata_via.c
13013 ++++ b/drivers/ata/sata_via.c
13014 +@@ -558,6 +558,19 @@ static void svia_configure(struct pci_dev *pdev)
13015 + tmp8 |= NATIVE_MODE_ALL;
13016 + pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
13017 + }
13018 ++
13019 ++ /*
13020 ++ * vt6421 has problems talking to some drives. The following
13021 ++ * is the magic fix from Joseph Chan <JosephChan@×××××××.tw>.
13022 ++ * Please add proper documentation if possible.
13023 ++ *
13024 ++ * https://bugzilla.kernel.org/show_bug.cgi?id=15173
13025 ++ */
13026 ++ if (pdev->device == 0x3249) {
13027 ++ pci_read_config_byte(pdev, 0x52, &tmp8);
13028 ++ tmp8 |= 1 << 2;
13029 ++ pci_write_config_byte(pdev, 0x52, tmp8);
13030 ++ }
13031 + }
13032 +
13033 + static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
13034 +diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
13035 +index 958bd15..7b71a15 100644
13036 +--- a/drivers/base/cpu.c
13037 ++++ b/drivers/base/cpu.c
13038 +@@ -183,7 +183,7 @@ static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf)
13039 + /* display offline cpus < nr_cpu_ids */
13040 + if (!alloc_cpumask_var(&offline, GFP_KERNEL))
13041 + return -ENOMEM;
13042 +- cpumask_complement(offline, cpu_online_mask);
13043 ++ cpumask_andnot(offline, cpu_possible_mask, cpu_online_mask);
13044 + n = cpulist_scnprintf(buf, len, offline);
13045 + free_cpumask_var(offline);
13046 +
13047 +diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
13048 +index 176f175..aa79cfd 100644
13049 +--- a/drivers/char/ipmi/ipmi_si_intf.c
13050 ++++ b/drivers/char/ipmi/ipmi_si_intf.c
13051 +@@ -311,9 +311,14 @@ static void deliver_recv_msg(struct smi_info *smi_info,
13052 + {
13053 + /* Deliver the message to the upper layer with the lock
13054 + released. */
13055 +- spin_unlock(&(smi_info->si_lock));
13056 +- ipmi_smi_msg_received(smi_info->intf, msg);
13057 +- spin_lock(&(smi_info->si_lock));
13058 ++
13059 ++ if (smi_info->run_to_completion) {
13060 ++ ipmi_smi_msg_received(smi_info->intf, msg);
13061 ++ } else {
13062 ++ spin_unlock(&(smi_info->si_lock));
13063 ++ ipmi_smi_msg_received(smi_info->intf, msg);
13064 ++ spin_lock(&(smi_info->si_lock));
13065 ++ }
13066 + }
13067 +
13068 + static void return_hosed_msg(struct smi_info *smi_info, int cCode)
13069 +diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
13070 +index 6fe4f77..234d9f6 100644
13071 +--- a/drivers/clocksource/sh_cmt.c
13072 ++++ b/drivers/clocksource/sh_cmt.c
13073 +@@ -413,18 +413,10 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
13074 + static int sh_cmt_clocksource_enable(struct clocksource *cs)
13075 + {
13076 + struct sh_cmt_priv *p = cs_to_sh_cmt(cs);
13077 +- int ret;
13078 +
13079 + p->total_cycles = 0;
13080 +
13081 +- ret = sh_cmt_start(p, FLAG_CLOCKSOURCE);
13082 +- if (ret)
13083 +- return ret;
13084 +-
13085 +- /* TODO: calculate good shift from rate and counter bit width */
13086 +- cs->shift = 0;
13087 +- cs->mult = clocksource_hz2mult(p->rate, cs->shift);
13088 +- return 0;
13089 ++ return sh_cmt_start(p, FLAG_CLOCKSOURCE);
13090 + }
13091 +
13092 + static void sh_cmt_clocksource_disable(struct clocksource *cs)
13093 +@@ -444,7 +436,18 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
13094 + cs->disable = sh_cmt_clocksource_disable;
13095 + cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
13096 + cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
13097 ++
13098 ++ /* clk_get_rate() needs an enabled clock */
13099 ++ clk_enable(p->clk);
13100 ++ p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
13101 ++ clk_disable(p->clk);
13102 ++
13103 ++ /* TODO: calculate good shift from rate and counter bit width */
13104 ++ cs->shift = 10;
13105 ++ cs->mult = clocksource_hz2mult(p->rate, cs->shift);
13106 ++
13107 + pr_info("sh_cmt: %s used as clock source\n", cs->name);
13108 ++
13109 + clocksource_register(cs);
13110 + return 0;
13111 + }
13112 +diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
13113 +index 961f5b5..c073246 100644
13114 +--- a/drivers/clocksource/sh_tmu.c
13115 ++++ b/drivers/clocksource/sh_tmu.c
13116 +@@ -199,16 +199,8 @@ static cycle_t sh_tmu_clocksource_read(struct clocksource *cs)
13117 + static int sh_tmu_clocksource_enable(struct clocksource *cs)
13118 + {
13119 + struct sh_tmu_priv *p = cs_to_sh_tmu(cs);
13120 +- int ret;
13121 +-
13122 +- ret = sh_tmu_enable(p);
13123 +- if (ret)
13124 +- return ret;
13125 +
13126 +- /* TODO: calculate good shift from rate and counter bit width */
13127 +- cs->shift = 10;
13128 +- cs->mult = clocksource_hz2mult(p->rate, cs->shift);
13129 +- return 0;
13130 ++ return sh_tmu_enable(p);
13131 + }
13132 +
13133 + static void sh_tmu_clocksource_disable(struct clocksource *cs)
13134 +@@ -228,6 +220,16 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
13135 + cs->disable = sh_tmu_clocksource_disable;
13136 + cs->mask = CLOCKSOURCE_MASK(32);
13137 + cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
13138 ++
13139 ++ /* clk_get_rate() needs an enabled clock */
13140 ++ clk_enable(p->clk);
13141 ++ /* channel will be configured at parent clock / 4 */
13142 ++ p->rate = clk_get_rate(p->clk) / 4;
13143 ++ clk_disable(p->clk);
13144 ++ /* TODO: calculate good shift from rate and counter bit width */
13145 ++ cs->shift = 10;
13146 ++ cs->mult = clocksource_hz2mult(p->rate, cs->shift);
13147 ++
13148 + pr_info("sh_tmu: %s used as clock source\n", cs->name);
13149 + clocksource_register(cs);
13150 + return 0;
13151 +diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
13152 +index 5045156..991447b 100644
13153 +--- a/drivers/firewire/core-card.c
13154 ++++ b/drivers/firewire/core-card.c
13155 +@@ -231,7 +231,7 @@ void fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
13156 + static void fw_card_bm_work(struct work_struct *work)
13157 + {
13158 + struct fw_card *card = container_of(work, struct fw_card, work.work);
13159 +- struct fw_device *root_device;
13160 ++ struct fw_device *root_device, *irm_device;
13161 + struct fw_node *root_node;
13162 + unsigned long flags;
13163 + int root_id, new_root_id, irm_id, local_id;
13164 +@@ -239,6 +239,7 @@ static void fw_card_bm_work(struct work_struct *work)
13165 + bool do_reset = false;
13166 + bool root_device_is_running;
13167 + bool root_device_is_cmc;
13168 ++ bool irm_is_1394_1995_only;
13169 +
13170 + spin_lock_irqsave(&card->lock, flags);
13171 +
13172 +@@ -248,12 +249,18 @@ static void fw_card_bm_work(struct work_struct *work)
13173 + }
13174 +
13175 + generation = card->generation;
13176 ++
13177 + root_node = card->root_node;
13178 + fw_node_get(root_node);
13179 + root_device = root_node->data;
13180 + root_device_is_running = root_device &&
13181 + atomic_read(&root_device->state) == FW_DEVICE_RUNNING;
13182 + root_device_is_cmc = root_device && root_device->cmc;
13183 ++
13184 ++ irm_device = card->irm_node->data;
13185 ++ irm_is_1394_1995_only = irm_device && irm_device->config_rom &&
13186 ++ (irm_device->config_rom[2] & 0x000000f0) == 0;
13187 ++
13188 + root_id = root_node->node_id;
13189 + irm_id = card->irm_node->node_id;
13190 + local_id = card->local_node->node_id;
13191 +@@ -276,8 +283,15 @@ static void fw_card_bm_work(struct work_struct *work)
13192 +
13193 + if (!card->irm_node->link_on) {
13194 + new_root_id = local_id;
13195 +- fw_notify("IRM has link off, making local node (%02x) root.\n",
13196 +- new_root_id);
13197 ++ fw_notify("%s, making local node (%02x) root.\n",
13198 ++ "IRM has link off", new_root_id);
13199 ++ goto pick_me;
13200 ++ }
13201 ++
13202 ++ if (irm_is_1394_1995_only) {
13203 ++ new_root_id = local_id;
13204 ++ fw_notify("%s, making local node (%02x) root.\n",
13205 ++ "IRM is not 1394a compliant", new_root_id);
13206 + goto pick_me;
13207 + }
13208 +
13209 +@@ -316,8 +330,8 @@ static void fw_card_bm_work(struct work_struct *work)
13210 + * root, and thus, IRM.
13211 + */
13212 + new_root_id = local_id;
13213 +- fw_notify("BM lock failed, making local node (%02x) root.\n",
13214 +- new_root_id);
13215 ++ fw_notify("%s, making local node (%02x) root.\n",
13216 ++ "BM lock failed", new_root_id);
13217 + goto pick_me;
13218 + }
13219 + } else if (card->bm_generation != generation) {
13220 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
13221 +index bfd0e4a..48b07ef 100644
13222 +--- a/drivers/gpu/drm/drm_edid.c
13223 ++++ b/drivers/gpu/drm/drm_edid.c
13224 +@@ -334,7 +334,7 @@ static struct drm_display_mode drm_dmt_modes[] = {
13225 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
13226 + /* 1024x768@85Hz */
13227 + { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072,
13228 +- 1072, 1376, 0, 768, 769, 772, 808, 0,
13229 ++ 1168, 1376, 0, 768, 769, 772, 808, 0,
13230 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
13231 + /* 1152x864@75Hz */
13232 + { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216,
13233 +diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
13234 +index 4746bfe..930664c 100644
13235 +--- a/drivers/gpu/drm/i915/i915_drv.c
13236 ++++ b/drivers/gpu/drm/i915/i915_drv.c
13237 +@@ -68,7 +68,8 @@ const static struct intel_device_info intel_845g_info = {
13238 + };
13239 +
13240 + const static struct intel_device_info intel_i85x_info = {
13241 +- .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1,
13242 ++ .is_i8xx = 1, .is_i85x = 1, .is_mobile = 1,
13243 ++ .cursor_needs_physical = 1,
13244 + };
13245 +
13246 + const static struct intel_device_info intel_i865g_info = {
13247 +@@ -140,7 +141,7 @@ const static struct pci_device_id pciidlist[] = {
13248 + INTEL_VGA_DEVICE(0x3577, &intel_i830_info),
13249 + INTEL_VGA_DEVICE(0x2562, &intel_845g_info),
13250 + INTEL_VGA_DEVICE(0x3582, &intel_i85x_info),
13251 +- INTEL_VGA_DEVICE(0x35e8, &intel_i85x_info),
13252 ++ INTEL_VGA_DEVICE(0x358e, &intel_i85x_info),
13253 + INTEL_VGA_DEVICE(0x2572, &intel_i865g_info),
13254 + INTEL_VGA_DEVICE(0x2582, &intel_i915g_info),
13255 + INTEL_VGA_DEVICE(0x258a, &intel_i915g_info),
13256 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
13257 +index 0b33757..6679741 100644
13258 +--- a/drivers/gpu/drm/i915/i915_drv.h
13259 ++++ b/drivers/gpu/drm/i915/i915_drv.h
13260 +@@ -175,6 +175,7 @@ struct intel_overlay;
13261 + struct intel_device_info {
13262 + u8 is_mobile : 1;
13263 + u8 is_i8xx : 1;
13264 ++ u8 is_i85x : 1;
13265 + u8 is_i915g : 1;
13266 + u8 is_i9xx : 1;
13267 + u8 is_i945gm : 1;
13268 +@@ -1027,7 +1028,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
13269 +
13270 + #define IS_I830(dev) ((dev)->pci_device == 0x3577)
13271 + #define IS_845G(dev) ((dev)->pci_device == 0x2562)
13272 +-#define IS_I85X(dev) ((dev)->pci_device == 0x3582)
13273 ++#define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x)
13274 + #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
13275 + #define IS_GEN2(dev) (INTEL_INFO(dev)->is_i8xx)
13276 + #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
13277 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
13278 +index c00c978..4a44de4 100644
13279 +--- a/drivers/gpu/drm/i915/i915_gem.c
13280 ++++ b/drivers/gpu/drm/i915/i915_gem.c
13281 +@@ -2641,6 +2641,14 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
13282 + return -EINVAL;
13283 + }
13284 +
13285 ++ /* If the object is bigger than the entire aperture, reject it early
13286 ++ * before evicting everything in a vain attempt to find space.
13287 ++ */
13288 ++ if (obj->size > dev->gtt_total) {
13289 ++ DRM_ERROR("Attempting to bind an object larger than the aperture\n");
13290 ++ return -E2BIG;
13291 ++ }
13292 ++
13293 + search_free:
13294 + free_space = drm_mm_search_free(&dev_priv->mm.gtt_space,
13295 + obj->size, alignment, 0);
13296 +@@ -4175,6 +4183,17 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
13297 + int ret;
13298 +
13299 + i915_verify_inactive(dev, __FILE__, __LINE__);
13300 ++
13301 ++ if (obj_priv->gtt_space != NULL) {
13302 ++ if (alignment == 0)
13303 ++ alignment = i915_gem_get_gtt_alignment(obj);
13304 ++ if (obj_priv->gtt_offset & (alignment - 1)) {
13305 ++ ret = i915_gem_object_unbind(obj);
13306 ++ if (ret)
13307 ++ return ret;
13308 ++ }
13309 ++ }
13310 ++
13311 + if (obj_priv->gtt_space == NULL) {
13312 + ret = i915_gem_object_bind_to_gtt(obj, alignment);
13313 + if (ret)
13314 +diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
13315 +index 4d88315..ff02664 100644
13316 +--- a/drivers/gpu/drm/radeon/radeon_atombios.c
13317 ++++ b/drivers/gpu/drm/radeon/radeon_atombios.c
13318 +@@ -514,6 +514,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
13319 + }
13320 +
13321 + /* look up gpio for ddc, hpd */
13322 ++ ddc_bus.valid = false;
13323 ++ hpd.hpd = RADEON_HPD_NONE;
13324 + if ((le16_to_cpu(path->usDeviceTag) &
13325 + (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) == 0) {
13326 + for (j = 0; j < con_obj->ucNumberOfObjects; j++) {
13327 +@@ -569,9 +571,6 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
13328 + break;
13329 + }
13330 + }
13331 +- } else {
13332 +- hpd.hpd = RADEON_HPD_NONE;
13333 +- ddc_bus.valid = false;
13334 + }
13335 +
13336 + conn_id = le16_to_cpu(path->usConnObjectId);
13337 +@@ -1137,7 +1136,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
13338 + lvds->native_mode.vtotal = lvds->native_mode.vdisplay +
13339 + le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time);
13340 + lvds->native_mode.vsync_start = lvds->native_mode.vdisplay +
13341 +- le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth);
13342 ++ le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncOffset);
13343 + lvds->native_mode.vsync_end = lvds->native_mode.vsync_start +
13344 + le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth);
13345 + lvds->panel_pwr_delay =
13346 +diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
13347 +index f129bbb..419630d 100644
13348 +--- a/drivers/gpu/drm/radeon/radeon_cp.c
13349 ++++ b/drivers/gpu/drm/radeon/radeon_cp.c
13350 +@@ -1646,6 +1646,7 @@ static int radeon_do_resume_cp(struct drm_device *dev, struct drm_file *file_pri
13351 + radeon_cp_load_microcode(dev_priv);
13352 + radeon_cp_init_ring_buffer(dev, dev_priv, file_priv);
13353 +
13354 ++ dev_priv->have_z_offset = 0;
13355 + radeon_do_engine_reset(dev);
13356 + radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
13357 +
13358 +diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
13359 +index c57ad60..ebaee61 100644
13360 +--- a/drivers/gpu/drm/radeon/radeon_drv.h
13361 ++++ b/drivers/gpu/drm/radeon/radeon_drv.h
13362 +@@ -268,6 +268,8 @@ typedef struct drm_radeon_private {
13363 +
13364 + u32 scratch_ages[5];
13365 +
13366 ++ int have_z_offset;
13367 ++
13368 + /* starting from here on, data is preserved accross an open */
13369 + uint32_t flags; /* see radeon_chip_flags */
13370 + resource_size_t fb_aper_offset;
13371 +diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c
13372 +index 067167c..16436bb 100644
13373 +--- a/drivers/gpu/drm/radeon/radeon_state.c
13374 ++++ b/drivers/gpu/drm/radeon/radeon_state.c
13375 +@@ -101,6 +101,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
13376 + DRM_ERROR("Invalid depth buffer offset\n");
13377 + return -EINVAL;
13378 + }
13379 ++ dev_priv->have_z_offset = 1;
13380 + break;
13381 +
13382 + case RADEON_EMIT_PP_CNTL:
13383 +@@ -876,6 +877,12 @@ static void radeon_cp_dispatch_clear(struct drm_device * dev,
13384 + if (tmp & RADEON_BACK)
13385 + flags |= RADEON_FRONT;
13386 + }
13387 ++ if (flags & (RADEON_DEPTH|RADEON_STENCIL)) {
13388 ++ if (!dev_priv->have_z_offset) {
13389 ++ printk_once(KERN_ERR "radeon: illegal depth clear request. Buggy mesa detected - please update.\n");
13390 ++ flags &= ~(RADEON_DEPTH | RADEON_STENCIL);
13391 ++ }
13392 ++ }
13393 +
13394 + if (flags & (RADEON_FRONT | RADEON_BACK)) {
13395 +
13396 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
13397 +index 8455f3d..0a404db 100644
13398 +--- a/drivers/hid/hid-core.c
13399 ++++ b/drivers/hid/hid-core.c
13400 +@@ -1305,6 +1305,7 @@ static const struct hid_device_id hid_blacklist[] = {
13401 + { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) },
13402 + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
13403 + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
13404 ++ { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
13405 + { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
13406 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
13407 + { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
13408 +diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c
13409 +index 62416e6..3975e03 100644
13410 +--- a/drivers/hid/hid-gyration.c
13411 ++++ b/drivers/hid/hid-gyration.c
13412 +@@ -73,6 +73,7 @@ static int gyration_event(struct hid_device *hdev, struct hid_field *field,
13413 + static const struct hid_device_id gyration_devices[] = {
13414 + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
13415 + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
13416 ++ { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
13417 + { }
13418 + };
13419 + MODULE_DEVICE_TABLE(hid, gyration_devices);
13420 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
13421 +index 793691f..5ec8a79 100644
13422 +--- a/drivers/hid/hid-ids.h
13423 ++++ b/drivers/hid/hid-ids.h
13424 +@@ -256,6 +256,7 @@
13425 + #define USB_VENDOR_ID_GYRATION 0x0c16
13426 + #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002
13427 + #define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003
13428 ++#define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008
13429 +
13430 + #define USB_VENDOR_ID_HAPP 0x078b
13431 + #define USB_DEVICE_ID_UGCI_DRIVING 0x0010
13432 +diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c
13433 +index 65c232a..21d201b 100644
13434 +--- a/drivers/hwmon/ltc4245.c
13435 ++++ b/drivers/hwmon/ltc4245.c
13436 +@@ -45,9 +45,7 @@ enum ltc4245_cmd {
13437 + LTC4245_VEEIN = 0x19,
13438 + LTC4245_VEESENSE = 0x1a,
13439 + LTC4245_VEEOUT = 0x1b,
13440 +- LTC4245_GPIOADC1 = 0x1c,
13441 +- LTC4245_GPIOADC2 = 0x1d,
13442 +- LTC4245_GPIOADC3 = 0x1e,
13443 ++ LTC4245_GPIOADC = 0x1c,
13444 + };
13445 +
13446 + struct ltc4245_data {
13447 +@@ -61,7 +59,7 @@ struct ltc4245_data {
13448 + u8 cregs[0x08];
13449 +
13450 + /* Voltage registers */
13451 +- u8 vregs[0x0f];
13452 ++ u8 vregs[0x0d];
13453 + };
13454 +
13455 + static struct ltc4245_data *ltc4245_update_device(struct device *dev)
13456 +@@ -86,7 +84,7 @@ static struct ltc4245_data *ltc4245_update_device(struct device *dev)
13457 + data->cregs[i] = val;
13458 + }
13459 +
13460 +- /* Read voltage registers -- 0x10 to 0x1f */
13461 ++ /* Read voltage registers -- 0x10 to 0x1c */
13462 + for (i = 0; i < ARRAY_SIZE(data->vregs); i++) {
13463 + val = i2c_smbus_read_byte_data(client, i+0x10);
13464 + if (unlikely(val < 0))
13465 +@@ -128,9 +126,7 @@ static int ltc4245_get_voltage(struct device *dev, u8 reg)
13466 + case LTC4245_VEEOUT:
13467 + voltage = regval * -55;
13468 + break;
13469 +- case LTC4245_GPIOADC1:
13470 +- case LTC4245_GPIOADC2:
13471 +- case LTC4245_GPIOADC3:
13472 ++ case LTC4245_GPIOADC:
13473 + voltage = regval * 10;
13474 + break;
13475 + default:
13476 +@@ -297,9 +293,7 @@ LTC4245_ALARM(in7_min_alarm, (1 << 2), LTC4245_FAULT2);
13477 + LTC4245_ALARM(in8_min_alarm, (1 << 3), LTC4245_FAULT2);
13478 +
13479 + /* GPIO voltages */
13480 +-LTC4245_VOLTAGE(in9_input, LTC4245_GPIOADC1);
13481 +-LTC4245_VOLTAGE(in10_input, LTC4245_GPIOADC2);
13482 +-LTC4245_VOLTAGE(in11_input, LTC4245_GPIOADC3);
13483 ++LTC4245_VOLTAGE(in9_input, LTC4245_GPIOADC);
13484 +
13485 + /* Power Consumption (virtual) */
13486 + LTC4245_POWER(power1_input, LTC4245_12VSENSE);
13487 +@@ -342,8 +336,6 @@ static struct attribute *ltc4245_attributes[] = {
13488 + &sensor_dev_attr_in8_min_alarm.dev_attr.attr,
13489 +
13490 + &sensor_dev_attr_in9_input.dev_attr.attr,
13491 +- &sensor_dev_attr_in10_input.dev_attr.attr,
13492 +- &sensor_dev_attr_in11_input.dev_attr.attr,
13493 +
13494 + &sensor_dev_attr_power1_input.dev_attr.attr,
13495 + &sensor_dev_attr_power2_input.dev_attr.attr,
13496 +diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
13497 +index d8c0c8d..6cda023 100644
13498 +--- a/drivers/input/mouse/psmouse-base.c
13499 ++++ b/drivers/input/mouse/psmouse-base.c
13500 +@@ -1382,6 +1382,7 @@ static int psmouse_reconnect(struct serio *serio)
13501 + struct psmouse *psmouse = serio_get_drvdata(serio);
13502 + struct psmouse *parent = NULL;
13503 + struct serio_driver *drv = serio->drv;
13504 ++ unsigned char type;
13505 + int rc = -1;
13506 +
13507 + if (!drv || !psmouse) {
13508 +@@ -1401,10 +1402,15 @@ static int psmouse_reconnect(struct serio *serio)
13509 + if (psmouse->reconnect) {
13510 + if (psmouse->reconnect(psmouse))
13511 + goto out;
13512 +- } else if (psmouse_probe(psmouse) < 0 ||
13513 +- psmouse->type != psmouse_extensions(psmouse,
13514 +- psmouse_max_proto, false)) {
13515 +- goto out;
13516 ++ } else {
13517 ++ psmouse_reset(psmouse);
13518 ++
13519 ++ if (psmouse_probe(psmouse) < 0)
13520 ++ goto out;
13521 ++
13522 ++ type = psmouse_extensions(psmouse, psmouse_max_proto, false);
13523 ++ if (psmouse->type != type)
13524 ++ goto out;
13525 + }
13526 +
13527 + /* ok, the device type (and capabilities) match the old one,
13528 +diff --git a/drivers/md/linear.c b/drivers/md/linear.c
13529 +index 001317b..12f4acb 100644
13530 +--- a/drivers/md/linear.c
13531 ++++ b/drivers/md/linear.c
13532 +@@ -281,6 +281,7 @@ static int linear_stop (mddev_t *mddev)
13533 + rcu_barrier();
13534 + blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
13535 + kfree(conf);
13536 ++ mddev->private = NULL;
13537 +
13538 + return 0;
13539 + }
13540 +diff --git a/drivers/md/md.c b/drivers/md/md.c
13541 +index 2ecd1d5..ec10d74 100644
13542 +--- a/drivers/md/md.c
13543 ++++ b/drivers/md/md.c
13544 +@@ -507,9 +507,36 @@ static inline int mddev_trylock(mddev_t * mddev)
13545 + return mutex_trylock(&mddev->reconfig_mutex);
13546 + }
13547 +
13548 +-static inline void mddev_unlock(mddev_t * mddev)
13549 +-{
13550 +- mutex_unlock(&mddev->reconfig_mutex);
13551 ++static struct attribute_group md_redundancy_group;
13552 ++
13553 ++static void mddev_unlock(mddev_t * mddev)
13554 ++{
13555 ++ if (mddev->to_remove) {
13556 ++ /* These cannot be removed under reconfig_mutex as
13557 ++ * an access to the files will try to take reconfig_mutex
13558 ++ * while holding the file unremovable, which leads to
13559 ++ * a deadlock.
13560 ++ * So hold open_mutex instead - we are allowed to take
13561 ++ * it while holding reconfig_mutex, and md_run can
13562 ++ * use it to wait for the remove to complete.
13563 ++ */
13564 ++ struct attribute_group *to_remove = mddev->to_remove;
13565 ++ mddev->to_remove = NULL;
13566 ++ mutex_lock(&mddev->open_mutex);
13567 ++ mutex_unlock(&mddev->reconfig_mutex);
13568 ++
13569 ++ if (to_remove != &md_redundancy_group)
13570 ++ sysfs_remove_group(&mddev->kobj, to_remove);
13571 ++ if (mddev->pers == NULL ||
13572 ++ mddev->pers->sync_request == NULL) {
13573 ++ sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
13574 ++ if (mddev->sysfs_action)
13575 ++ sysfs_put(mddev->sysfs_action);
13576 ++ mddev->sysfs_action = NULL;
13577 ++ }
13578 ++ mutex_unlock(&mddev->open_mutex);
13579 ++ } else
13580 ++ mutex_unlock(&mddev->reconfig_mutex);
13581 +
13582 + md_wakeup_thread(mddev->thread);
13583 + }
13584 +@@ -2979,6 +3006,23 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
13585 + /* Looks like we have a winner */
13586 + mddev_suspend(mddev);
13587 + mddev->pers->stop(mddev);
13588 ++
13589 ++ if (mddev->pers->sync_request == NULL &&
13590 ++ pers->sync_request != NULL) {
13591 ++ /* need to add the md_redundancy_group */
13592 ++ if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
13593 ++ printk(KERN_WARNING
13594 ++ "md: cannot register extra attributes for %s\n",
13595 ++ mdname(mddev));
13596 ++ mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
13597 ++ }
13598 ++ if (mddev->pers->sync_request != NULL &&
13599 ++ pers->sync_request == NULL) {
13600 ++ /* need to remove the md_redundancy_group */
13601 ++ if (mddev->to_remove == NULL)
13602 ++ mddev->to_remove = &md_redundancy_group;
13603 ++ }
13604 ++
13605 + module_put(mddev->pers->owner);
13606 + /* Invalidate devices that are now superfluous */
13607 + list_for_each_entry(rdev, &mddev->disks, same_set)
13608 +@@ -4081,15 +4125,6 @@ static void mddev_delayed_delete(struct work_struct *ws)
13609 + {
13610 + mddev_t *mddev = container_of(ws, mddev_t, del_work);
13611 +
13612 +- if (mddev->private) {
13613 +- sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
13614 +- if (mddev->private != (void*)1)
13615 +- sysfs_remove_group(&mddev->kobj, mddev->private);
13616 +- if (mddev->sysfs_action)
13617 +- sysfs_put(mddev->sysfs_action);
13618 +- mddev->sysfs_action = NULL;
13619 +- mddev->private = NULL;
13620 +- }
13621 + sysfs_remove_group(&mddev->kobj, &md_bitmap_group);
13622 + kobject_del(&mddev->kobj);
13623 + kobject_put(&mddev->kobj);
13624 +@@ -4247,6 +4282,13 @@ static int do_md_run(mddev_t * mddev)
13625 + if (mddev->pers)
13626 + return -EBUSY;
13627 +
13628 ++ /* These two calls synchronise us with the
13629 ++ * sysfs_remove_group calls in mddev_unlock,
13630 ++ * so they must have completed.
13631 ++ */
13632 ++ mutex_lock(&mddev->open_mutex);
13633 ++ mutex_unlock(&mddev->open_mutex);
13634 ++
13635 + /*
13636 + * Analyze all RAID superblock(s)
13637 + */
13638 +@@ -4535,8 +4577,8 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
13639 + mddev->queue->unplug_fn = NULL;
13640 + mddev->queue->backing_dev_info.congested_fn = NULL;
13641 + module_put(mddev->pers->owner);
13642 +- if (mddev->pers->sync_request && mddev->private == NULL)
13643 +- mddev->private = (void*)1;
13644 ++ if (mddev->pers->sync_request && mddev->to_remove == NULL)
13645 ++ mddev->to_remove = &md_redundancy_group;
13646 + mddev->pers = NULL;
13647 + /* tell userspace to handle 'inactive' */
13648 + sysfs_notify_dirent(mddev->sysfs_state);
13649 +@@ -5495,6 +5537,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
13650 + int err = 0;
13651 + void __user *argp = (void __user *)arg;
13652 + mddev_t *mddev = NULL;
13653 ++ int ro;
13654 +
13655 + if (!capable(CAP_SYS_ADMIN))
13656 + return -EACCES;
13657 +@@ -5630,6 +5673,34 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
13658 + err = do_md_stop(mddev, 1, 1);
13659 + goto done_unlock;
13660 +
13661 ++ case BLKROSET:
13662 ++ if (get_user(ro, (int __user *)(arg))) {
13663 ++ err = -EFAULT;
13664 ++ goto done_unlock;
13665 ++ }
13666 ++ err = -EINVAL;
13667 ++
13668 ++ /* if the bdev is going readonly the value of mddev->ro
13669 ++ * does not matter, no writes are coming
13670 ++ */
13671 ++ if (ro)
13672 ++ goto done_unlock;
13673 ++
13674 ++ /* are we are already prepared for writes? */
13675 ++ if (mddev->ro != 1)
13676 ++ goto done_unlock;
13677 ++
13678 ++ /* transitioning to readauto need only happen for
13679 ++ * arrays that call md_write_start
13680 ++ */
13681 ++ if (mddev->pers) {
13682 ++ err = restart_array(mddev);
13683 ++ if (err == 0) {
13684 ++ mddev->ro = 2;
13685 ++ set_disk_ro(mddev->gendisk, 0);
13686 ++ }
13687 ++ }
13688 ++ goto done_unlock;
13689 + }
13690 +
13691 + /*
13692 +diff --git a/drivers/md/md.h b/drivers/md/md.h
13693 +index 8e4c75c..722f5df 100644
13694 +--- a/drivers/md/md.h
13695 ++++ b/drivers/md/md.h
13696 +@@ -305,6 +305,7 @@ struct mddev_s
13697 + atomic_t max_corr_read_errors; /* max read retries */
13698 + struct list_head all_mddevs;
13699 +
13700 ++ struct attribute_group *to_remove;
13701 + /* Generic barrier handling.
13702 + * If there is a pending barrier request, all other
13703 + * writes are blocked while the devices are flushed.
13704 +diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
13705 +index 859bd3f..db2de5a 100644
13706 +--- a/drivers/md/raid1.c
13707 ++++ b/drivers/md/raid1.c
13708 +@@ -417,7 +417,7 @@ static void raid1_end_write_request(struct bio *bio, int error)
13709 + */
13710 + static int read_balance(conf_t *conf, r1bio_t *r1_bio)
13711 + {
13712 +- const unsigned long this_sector = r1_bio->sector;
13713 ++ const sector_t this_sector = r1_bio->sector;
13714 + int new_disk = conf->last_used, disk = new_disk;
13715 + int wonly_disk = -1;
13716 + const int sectors = r1_bio->sectors;
13717 +@@ -433,7 +433,7 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
13718 + retry:
13719 + if (conf->mddev->recovery_cp < MaxSector &&
13720 + (this_sector + sectors >= conf->next_resync)) {
13721 +- /* Choose the first operation device, for consistancy */
13722 ++ /* Choose the first operational device, for consistancy */
13723 + new_disk = 0;
13724 +
13725 + for (rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
13726 +@@ -911,9 +911,10 @@ static int make_request(struct request_queue *q, struct bio * bio)
13727 + if (test_bit(Faulty, &rdev->flags)) {
13728 + rdev_dec_pending(rdev, mddev);
13729 + r1_bio->bios[i] = NULL;
13730 +- } else
13731 ++ } else {
13732 + r1_bio->bios[i] = bio;
13733 +- targets++;
13734 ++ targets++;
13735 ++ }
13736 + } else
13737 + r1_bio->bios[i] = NULL;
13738 + }
13739 +diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
13740 +index 047c468..5fb1ad6 100644
13741 +--- a/drivers/md/raid10.c
13742 ++++ b/drivers/md/raid10.c
13743 +@@ -493,7 +493,7 @@ static int raid10_mergeable_bvec(struct request_queue *q,
13744 + */
13745 + static int read_balance(conf_t *conf, r10bio_t *r10_bio)
13746 + {
13747 +- const unsigned long this_sector = r10_bio->sector;
13748 ++ const sector_t this_sector = r10_bio->sector;
13749 + int disk, slot, nslot;
13750 + const int sectors = r10_bio->sectors;
13751 + sector_t new_distance, current_distance;
13752 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
13753 +index 0468f5b..105a3dc 100644
13754 +--- a/drivers/md/raid5.c
13755 ++++ b/drivers/md/raid5.c
13756 +@@ -5086,7 +5086,9 @@ static int run(mddev_t *mddev)
13757 + }
13758 +
13759 + /* Ok, everything is just fine now */
13760 +- if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
13761 ++ if (mddev->to_remove == &raid5_attrs_group)
13762 ++ mddev->to_remove = NULL;
13763 ++ else if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
13764 + printk(KERN_WARNING
13765 + "raid5: failed to create sysfs attributes for %s\n",
13766 + mdname(mddev));
13767 +@@ -5133,7 +5135,8 @@ static int stop(mddev_t *mddev)
13768 + mddev->queue->backing_dev_info.congested_fn = NULL;
13769 + blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
13770 + free_conf(conf);
13771 +- mddev->private = &raid5_attrs_group;
13772 ++ mddev->private = NULL;
13773 ++ mddev->to_remove = &raid5_attrs_group;
13774 + return 0;
13775 + }
13776 +
13777 +diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
13778 +index 5d0241b..06e0e86 100644
13779 +--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
13780 ++++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
13781 +@@ -496,8 +496,6 @@ static const __devinitdata struct usb_device_id device_table[] = {
13782 + {USB_DEVICE(0x046D, 0x08F5), .driver_info = BRIDGE_ST6422 },
13783 + /* QuickCam Messenger (new) */
13784 + {USB_DEVICE(0x046D, 0x08F6), .driver_info = BRIDGE_ST6422 },
13785 +- /* QuickCam Messenger (new) */
13786 +- {USB_DEVICE(0x046D, 0x08DA), .driver_info = BRIDGE_ST6422 },
13787 + {}
13788 + };
13789 + MODULE_DEVICE_TABLE(usb, device_table);
13790 +diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
13791 +index dbf4de3..69698e5 100644
13792 +--- a/drivers/net/arcnet/com20020-pci.c
13793 ++++ b/drivers/net/arcnet/com20020-pci.c
13794 +@@ -165,8 +165,8 @@ static struct pci_device_id com20020pci_id_table[] = {
13795 + { 0x1571, 0xa204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13796 + { 0x1571, 0xa205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13797 + { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13798 +- { 0x10B5, 0x9030, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13799 +- { 0x10B5, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13800 ++ { 0x10B5, 0x9030, 0x10B5, 0x2978, 0, 0, ARC_CAN_10MBIT },
13801 ++ { 0x10B5, 0x9050, 0x10B5, 0x2273, 0, 0, ARC_CAN_10MBIT },
13802 + { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13803 + { 0x10B5, 0x2200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
13804 + {0,}
13805 +diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
13806 +index 542a4f7..2ee19d1 100644
13807 +--- a/drivers/net/can/sja1000/sja1000.c
13808 ++++ b/drivers/net/can/sja1000/sja1000.c
13809 +@@ -84,6 +84,20 @@ static struct can_bittiming_const sja1000_bittiming_const = {
13810 + .brp_inc = 1,
13811 + };
13812 +
13813 ++static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
13814 ++{
13815 ++ unsigned long flags;
13816 ++
13817 ++ /*
13818 ++ * The command register needs some locking and time to settle
13819 ++ * the write_reg() operation - especially on SMP systems.
13820 ++ */
13821 ++ spin_lock_irqsave(&priv->cmdreg_lock, flags);
13822 ++ priv->write_reg(priv, REG_CMR, val);
13823 ++ priv->read_reg(priv, REG_SR);
13824 ++ spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
13825 ++}
13826 ++
13827 + static int sja1000_probe_chip(struct net_device *dev)
13828 + {
13829 + struct sja1000_priv *priv = netdev_priv(dev);
13830 +@@ -279,7 +293,7 @@ static netdev_tx_t sja1000_start_xmit(struct sk_buff *skb,
13831 +
13832 + can_put_echo_skb(skb, dev, 0);
13833 +
13834 +- priv->write_reg(priv, REG_CMR, CMD_TR);
13835 ++ sja1000_write_cmdreg(priv, CMD_TR);
13836 +
13837 + return NETDEV_TX_OK;
13838 + }
13839 +@@ -328,7 +342,7 @@ static void sja1000_rx(struct net_device *dev)
13840 + cf->can_id = id;
13841 +
13842 + /* release receive buffer */
13843 +- priv->write_reg(priv, REG_CMR, CMD_RRB);
13844 ++ sja1000_write_cmdreg(priv, CMD_RRB);
13845 +
13846 + netif_rx(skb);
13847 +
13848 +@@ -356,7 +370,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
13849 + cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
13850 + stats->rx_over_errors++;
13851 + stats->rx_errors++;
13852 +- priv->write_reg(priv, REG_CMR, CMD_CDO); /* clear bit */
13853 ++ sja1000_write_cmdreg(priv, CMD_CDO); /* clear bit */
13854 + }
13855 +
13856 + if (isrc & IRQ_EI) {
13857 +diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h
13858 +index 97a622b..de8e778 100644
13859 +--- a/drivers/net/can/sja1000/sja1000.h
13860 ++++ b/drivers/net/can/sja1000/sja1000.h
13861 +@@ -167,6 +167,7 @@ struct sja1000_priv {
13862 +
13863 + void __iomem *reg_base; /* ioremap'ed address to registers */
13864 + unsigned long irq_flags; /* for request_irq() */
13865 ++ spinlock_t cmdreg_lock; /* lock for concurrent cmd register writes */
13866 +
13867 + u16 flags; /* custom mode flags */
13868 + u8 ocr; /* output control register */
13869 +diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
13870 +index 04b382f..83eef8e 100644
13871 +--- a/drivers/net/mlx4/icm.c
13872 ++++ b/drivers/net/mlx4/icm.c
13873 +@@ -174,9 +174,10 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
13874 +
13875 + if (chunk->nsg <= 0)
13876 + goto fail;
13877 ++ }
13878 +
13879 ++ if (chunk->npages == MLX4_ICM_CHUNK_LEN)
13880 + chunk = NULL;
13881 +- }
13882 +
13883 + npages -= 1 << cur_order;
13884 + } else {
13885 +diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
13886 +index 449a982..8015310 100644
13887 +--- a/drivers/net/pppol2tp.c
13888 ++++ b/drivers/net/pppol2tp.c
13889 +@@ -977,7 +977,8 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
13890 + /* Calculate UDP checksum if configured to do so */
13891 + if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT)
13892 + skb->ip_summed = CHECKSUM_NONE;
13893 +- else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) {
13894 ++ else if ((skb_dst(skb) && skb_dst(skb)->dev) &&
13895 ++ (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM))) {
13896 + skb->ip_summed = CHECKSUM_COMPLETE;
13897 + csum = skb_checksum(skb, 0, udp_len, 0);
13898 + uh->check = csum_tcpudp_magic(inet->inet_saddr,
13899 +diff --git a/drivers/net/wireless/ath/ar9170/hw.h b/drivers/net/wireless/ath/ar9170/hw.h
13900 +index 701ddb7..5e7e1bd 100644
13901 +--- a/drivers/net/wireless/ath/ar9170/hw.h
13902 ++++ b/drivers/net/wireless/ath/ar9170/hw.h
13903 +@@ -424,5 +424,6 @@ enum ar9170_txq {
13904 +
13905 + #define AR9170_TXQ_DEPTH 32
13906 + #define AR9170_TX_MAX_PENDING 128
13907 ++#define AR9170_RX_STREAM_MAX_SIZE 65535
13908 +
13909 + #endif /* __AR9170_HW_H */
13910 +diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
13911 +index f9d6db8..9ea9845 100644
13912 +--- a/drivers/net/wireless/ath/ar9170/main.c
13913 ++++ b/drivers/net/wireless/ath/ar9170/main.c
13914 +@@ -2538,7 +2538,7 @@ void *ar9170_alloc(size_t priv_size)
13915 + * tends to split the streams into seperate rx descriptors.
13916 + */
13917 +
13918 +- skb = __dev_alloc_skb(AR9170_MAX_RX_BUFFER_SIZE, GFP_KERNEL);
13919 ++ skb = __dev_alloc_skb(AR9170_RX_STREAM_MAX_SIZE, GFP_KERNEL);
13920 + if (!skb)
13921 + goto err_nomem;
13922 +
13923 +diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
13924 +index 0387658..db541d4 100644
13925 +--- a/drivers/net/wireless/ath/ar9170/usb.c
13926 ++++ b/drivers/net/wireless/ath/ar9170/usb.c
13927 +@@ -66,18 +66,28 @@ static struct usb_device_id ar9170_usb_ids[] = {
13928 + { USB_DEVICE(0x0cf3, 0x1001) },
13929 + /* TP-Link TL-WN821N v2 */
13930 + { USB_DEVICE(0x0cf3, 0x1002) },
13931 ++ /* 3Com Dual Band 802.11n USB Adapter */
13932 ++ { USB_DEVICE(0x0cf3, 0x1010) },
13933 ++ /* H3C Dual Band 802.11n USB Adapter */
13934 ++ { USB_DEVICE(0x0cf3, 0x1011) },
13935 + /* Cace Airpcap NX */
13936 + { USB_DEVICE(0xcace, 0x0300) },
13937 + /* D-Link DWA 160 A1 */
13938 + { USB_DEVICE(0x07d1, 0x3c10) },
13939 + /* D-Link DWA 160 A2 */
13940 + { USB_DEVICE(0x07d1, 0x3a09) },
13941 ++ /* Netgear WNA1000 */
13942 ++ { USB_DEVICE(0x0846, 0x9040) },
13943 + /* Netgear WNDA3100 */
13944 + { USB_DEVICE(0x0846, 0x9010) },
13945 + /* Netgear WN111 v2 */
13946 + { USB_DEVICE(0x0846, 0x9001) },
13947 + /* Zydas ZD1221 */
13948 + { USB_DEVICE(0x0ace, 0x1221) },
13949 ++ /* Proxim ORiNOCO 802.11n USB */
13950 ++ { USB_DEVICE(0x1435, 0x0804) },
13951 ++ /* WNC Generic 11n USB Dongle */
13952 ++ { USB_DEVICE(0x1435, 0x0326) },
13953 + /* ZyXEL NWD271N */
13954 + { USB_DEVICE(0x0586, 0x3417) },
13955 + /* Z-Com UB81 BG */
13956 +diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
13957 +index ced648b..d377809 100644
13958 +--- a/drivers/net/wireless/ath/ath5k/base.c
13959 ++++ b/drivers/net/wireless/ath/ath5k/base.c
13960 +@@ -1210,6 +1210,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
13961 + struct ath5k_hw *ah = sc->ah;
13962 + struct sk_buff *skb = bf->skb;
13963 + struct ath5k_desc *ds;
13964 ++ int ret;
13965 +
13966 + if (!skb) {
13967 + skb = ath5k_rx_skb_alloc(sc, &bf->skbaddr);
13968 +@@ -1236,9 +1237,9 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
13969 + ds = bf->desc;
13970 + ds->ds_link = bf->daddr; /* link to self */
13971 + ds->ds_data = bf->skbaddr;
13972 +- ah->ah_setup_rx_desc(ah, ds,
13973 +- skb_tailroom(skb), /* buffer size */
13974 +- 0);
13975 ++ ret = ah->ah_setup_rx_desc(ah, ds, ah->common.rx_bufsize, 0);
13976 ++ if (ret)
13977 ++ return ret;
13978 +
13979 + if (sc->rxlink != NULL)
13980 + *sc->rxlink = bf->daddr;
13981 +@@ -2996,13 +2997,15 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
13982 +
13983 + if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
13984 + if (*new_flags & FIF_PROMISC_IN_BSS) {
13985 +- rfilt |= AR5K_RX_FILTER_PROM;
13986 + __set_bit(ATH_STAT_PROMISC, sc->status);
13987 + } else {
13988 + __clear_bit(ATH_STAT_PROMISC, sc->status);
13989 + }
13990 + }
13991 +
13992 ++ if (test_bit(ATH_STAT_PROMISC, sc->status))
13993 ++ rfilt |= AR5K_RX_FILTER_PROM;
13994 ++
13995 + /* Note, AR5K_RX_FILTER_MCAST is already enabled */
13996 + if (*new_flags & FIF_ALLMULTI) {
13997 + mfilt[0] = ~0;
13998 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
13999 +index 3534d86..2423068 100644
14000 +--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
14001 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
14002 +@@ -2083,10 +2083,12 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
14003 + }
14004 + /* Else we have enough samples; calculate estimate of
14005 + * actual average throughput */
14006 +-
14007 +- /* Sanity-check TPT calculations */
14008 +- BUG_ON(window->average_tpt != ((window->success_ratio *
14009 +- tbl->expected_tpt[index] + 64) / 128));
14010 ++ if (window->average_tpt != ((window->success_ratio *
14011 ++ tbl->expected_tpt[index] + 64) / 128)) {
14012 ++ IWL_ERR(priv, "expected_tpt should have been calculated by now\n");
14013 ++ window->average_tpt = ((window->success_ratio *
14014 ++ tbl->expected_tpt[index] + 64) / 128);
14015 ++ }
14016 +
14017 + /* If we are searching for better modulation mode, check success. */
14018 + if (lq_sta->search_better_tbl &&
14019 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
14020 +index 5622a55..664dcd5 100644
14021 +--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
14022 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
14023 +@@ -3365,6 +3365,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
14024 + */
14025 + spin_lock_init(&priv->reg_lock);
14026 + spin_lock_init(&priv->lock);
14027 ++
14028 ++ /*
14029 ++ * stop and reset the on-board processor just in case it is in a
14030 ++ * strange state ... like being left stranded by a primary kernel
14031 ++ * and this is now the kdump kernel trying to start up
14032 ++ */
14033 ++ iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
14034 ++
14035 + iwl_hw_detect(priv);
14036 + IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n",
14037 + priv->cfg->name, priv->hw_rev);
14038 +diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
14039 +index adbb3ea..ca0fb8b 100644
14040 +--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
14041 ++++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
14042 +@@ -4022,6 +4022,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
14043 + spin_lock_init(&priv->reg_lock);
14044 + spin_lock_init(&priv->lock);
14045 +
14046 ++ /*
14047 ++ * stop and reset the on-board processor just in case it is in a
14048 ++ * strange state ... like being left stranded by a primary kernel
14049 ++ * and this is now the kdump kernel trying to start up
14050 ++ */
14051 ++ iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
14052 ++
14053 + /***********************
14054 + * 4. Read EEPROM
14055 + * ********************/
14056 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
14057 +index b3c4fbd..805284d 100644
14058 +--- a/drivers/net/wireless/p54/p54usb.c
14059 ++++ b/drivers/net/wireless/p54/p54usb.c
14060 +@@ -78,6 +78,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
14061 + {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
14062 + {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
14063 + {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
14064 ++ {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */
14065 + {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
14066 + {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */
14067 + {}
14068 +diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
14069 +index 8a40a14..77b7657 100644
14070 +--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
14071 ++++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
14072 +@@ -189,6 +189,7 @@ static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio)
14073 + info->flags |= IEEE80211_TX_STAT_ACK;
14074 +
14075 + info->status.rates[0].count = (flags & 0xFF) + 1;
14076 ++ info->status.rates[1].idx = -1;
14077 +
14078 + ieee80211_tx_status_irqsafe(dev, skb);
14079 + if (ring->entries - skb_queue_len(&ring->queue) == 2)
14080 +diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c
14081 +index 9423f22..d74b89b 100644
14082 +--- a/drivers/net/wireless/wl12xx/wl1251_sdio.c
14083 ++++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c
14084 +@@ -160,6 +160,7 @@ disable:
14085 + sdio_disable_func(func);
14086 + release:
14087 + sdio_release_host(func);
14088 ++ wl1251_free_hw(wl);
14089 + return ret;
14090 + }
14091 +
14092 +diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
14093 +index 166b67e..de82183 100644
14094 +--- a/drivers/oprofile/cpu_buffer.c
14095 ++++ b/drivers/oprofile/cpu_buffer.c
14096 +@@ -30,23 +30,7 @@
14097 +
14098 + #define OP_BUFFER_FLAGS 0
14099 +
14100 +-/*
14101 +- * Read and write access is using spin locking. Thus, writing to the
14102 +- * buffer by NMI handler (x86) could occur also during critical
14103 +- * sections when reading the buffer. To avoid this, there are 2
14104 +- * buffers for independent read and write access. Read access is in
14105 +- * process context only, write access only in the NMI handler. If the
14106 +- * read buffer runs empty, both buffers are swapped atomically. There
14107 +- * is potentially a small window during swapping where the buffers are
14108 +- * disabled and samples could be lost.
14109 +- *
14110 +- * Using 2 buffers is a little bit overhead, but the solution is clear
14111 +- * and does not require changes in the ring buffer implementation. It
14112 +- * can be changed to a single buffer solution when the ring buffer
14113 +- * access is implemented as non-locking atomic code.
14114 +- */
14115 +-static struct ring_buffer *op_ring_buffer_read;
14116 +-static struct ring_buffer *op_ring_buffer_write;
14117 ++static struct ring_buffer *op_ring_buffer;
14118 + DEFINE_PER_CPU(struct oprofile_cpu_buffer, op_cpu_buffer);
14119 +
14120 + static void wq_sync_buffer(struct work_struct *work);
14121 +@@ -68,12 +52,9 @@ void oprofile_cpu_buffer_inc_smpl_lost(void)
14122 +
14123 + void free_cpu_buffers(void)
14124 + {
14125 +- if (op_ring_buffer_read)
14126 +- ring_buffer_free(op_ring_buffer_read);
14127 +- op_ring_buffer_read = NULL;
14128 +- if (op_ring_buffer_write)
14129 +- ring_buffer_free(op_ring_buffer_write);
14130 +- op_ring_buffer_write = NULL;
14131 ++ if (op_ring_buffer)
14132 ++ ring_buffer_free(op_ring_buffer);
14133 ++ op_ring_buffer = NULL;
14134 + }
14135 +
14136 + #define RB_EVENT_HDR_SIZE 4
14137 +@@ -86,11 +67,8 @@ int alloc_cpu_buffers(void)
14138 + unsigned long byte_size = buffer_size * (sizeof(struct op_sample) +
14139 + RB_EVENT_HDR_SIZE);
14140 +
14141 +- op_ring_buffer_read = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
14142 +- if (!op_ring_buffer_read)
14143 +- goto fail;
14144 +- op_ring_buffer_write = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
14145 +- if (!op_ring_buffer_write)
14146 ++ op_ring_buffer = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
14147 ++ if (!op_ring_buffer)
14148 + goto fail;
14149 +
14150 + for_each_possible_cpu(i) {
14151 +@@ -162,16 +140,11 @@ struct op_sample
14152 + *op_cpu_buffer_write_reserve(struct op_entry *entry, unsigned long size)
14153 + {
14154 + entry->event = ring_buffer_lock_reserve
14155 +- (op_ring_buffer_write, sizeof(struct op_sample) +
14156 ++ (op_ring_buffer, sizeof(struct op_sample) +
14157 + size * sizeof(entry->sample->data[0]));
14158 +- if (entry->event)
14159 +- entry->sample = ring_buffer_event_data(entry->event);
14160 +- else
14161 +- entry->sample = NULL;
14162 +-
14163 +- if (!entry->sample)
14164 ++ if (!entry->event)
14165 + return NULL;
14166 +-
14167 ++ entry->sample = ring_buffer_event_data(entry->event);
14168 + entry->size = size;
14169 + entry->data = entry->sample->data;
14170 +
14171 +@@ -180,25 +153,16 @@ struct op_sample
14172 +
14173 + int op_cpu_buffer_write_commit(struct op_entry *entry)
14174 + {
14175 +- return ring_buffer_unlock_commit(op_ring_buffer_write, entry->event);
14176 ++ return ring_buffer_unlock_commit(op_ring_buffer, entry->event);
14177 + }
14178 +
14179 + struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu)
14180 + {
14181 + struct ring_buffer_event *e;
14182 +- e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL);
14183 +- if (e)
14184 +- goto event;
14185 +- if (ring_buffer_swap_cpu(op_ring_buffer_read,
14186 +- op_ring_buffer_write,
14187 +- cpu))
14188 ++ e = ring_buffer_consume(op_ring_buffer, cpu, NULL);
14189 ++ if (!e)
14190 + return NULL;
14191 +- e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL);
14192 +- if (e)
14193 +- goto event;
14194 +- return NULL;
14195 +
14196 +-event:
14197 + entry->event = e;
14198 + entry->sample = ring_buffer_event_data(e);
14199 + entry->size = (ring_buffer_event_length(e) - sizeof(struct op_sample))
14200 +@@ -209,8 +173,7 @@ event:
14201 +
14202 + unsigned long op_cpu_buffer_entries(int cpu)
14203 + {
14204 +- return ring_buffer_entries_cpu(op_ring_buffer_read, cpu)
14205 +- + ring_buffer_entries_cpu(op_ring_buffer_write, cpu);
14206 ++ return ring_buffer_entries_cpu(op_ring_buffer, cpu);
14207 + }
14208 +
14209 + static int
14210 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
14211 +index 456c265..197e38f 100644
14212 +--- a/drivers/pci/quirks.c
14213 ++++ b/drivers/pci/quirks.c
14214 +@@ -1461,7 +1461,8 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
14215 + conf5 &= ~(1 << 24); /* Clear bit 24 */
14216 +
14217 + switch (pdev->device) {
14218 +- case PCI_DEVICE_ID_JMICRON_JMB360:
14219 ++ case PCI_DEVICE_ID_JMICRON_JMB360: /* SATA single port */
14220 ++ case PCI_DEVICE_ID_JMICRON_JMB362: /* SATA dual ports */
14221 + /* The controller should be in single function ahci mode */
14222 + conf1 |= 0x0002A100; /* Set 8, 13, 15, 17 */
14223 + break;
14224 +@@ -1497,12 +1498,14 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
14225 + }
14226 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
14227 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);
14228 ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata);
14229 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata);
14230 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata);
14231 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata);
14232 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata);
14233 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
14234 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);
14235 ++DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata);
14236 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata);
14237 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata);
14238 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata);
14239 +@@ -2113,6 +2116,8 @@ static void __devinit quirk_disable_msi(struct pci_dev *dev)
14240 + }
14241 + }
14242 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi);
14243 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xa238, quirk_disable_msi);
14244 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x5a3f, quirk_disable_msi);
14245 +
14246 + /* Go through the list of Hypertransport capabilities and
14247 + * return 1 if a HT MSI capability is found and enabled */
14248 +@@ -2204,15 +2209,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
14249 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE,
14250 + ht_enable_msi_mapping);
14251 +
14252 +-/* The P5N32-SLI Premium motherboard from Asus has a problem with msi
14253 ++/* The P5N32-SLI motherboards from Asus have a problem with msi
14254 + * for the MCP55 NIC. It is not yet determined whether the msi problem
14255 + * also affects other devices. As for now, turn off msi for this device.
14256 + */
14257 + static void __devinit nvenet_msi_disable(struct pci_dev *dev)
14258 + {
14259 +- if (dmi_name_in_vendors("P5N32-SLI PREMIUM")) {
14260 ++ if (dmi_name_in_vendors("P5N32-SLI PREMIUM") ||
14261 ++ dmi_name_in_vendors("P5N32-E SLI")) {
14262 + dev_info(&dev->dev,
14263 +- "Disabling msi for MCP55 NIC on P5N32-SLI Premium\n");
14264 ++ "Disabling msi for MCP55 NIC on P5N32-SLI\n");
14265 + dev->no_msi = 1;
14266 + }
14267 + }
14268 +diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
14269 +index 6a47bb7..9a844ca 100644
14270 +--- a/drivers/platform/x86/eeepc-laptop.c
14271 ++++ b/drivers/platform/x86/eeepc-laptop.c
14272 +@@ -578,6 +578,8 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
14273 + struct pci_dev *dev;
14274 + struct pci_bus *bus;
14275 + bool blocked = eeepc_wlan_rfkill_blocked(eeepc);
14276 ++ bool absent;
14277 ++ u32 l;
14278 +
14279 + if (eeepc->wlan_rfkill)
14280 + rfkill_set_sw_state(eeepc->wlan_rfkill, blocked);
14281 +@@ -591,6 +593,22 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
14282 + goto out_unlock;
14283 + }
14284 +
14285 ++ if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) {
14286 ++ pr_err("Unable to read PCI config space?\n");
14287 ++ goto out_unlock;
14288 ++ }
14289 ++ absent = (l == 0xffffffff);
14290 ++
14291 ++ if (blocked != absent) {
14292 ++ pr_warning("BIOS says wireless lan is %s, "
14293 ++ "but the pci device is %s\n",
14294 ++ blocked ? "blocked" : "unblocked",
14295 ++ absent ? "absent" : "present");
14296 ++ pr_warning("skipped wireless hotplug as probably "
14297 ++ "inappropriate for this model\n");
14298 ++ goto out_unlock;
14299 ++ }
14300 ++
14301 + if (!blocked) {
14302 + dev = pci_get_slot(bus, 0);
14303 + if (dev) {
14304 +diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
14305 +index e9aa814..aa13875 100644
14306 +--- a/drivers/rtc/rtc-cmos.c
14307 ++++ b/drivers/rtc/rtc-cmos.c
14308 +@@ -719,6 +719,9 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
14309 + }
14310 + }
14311 +
14312 ++ cmos_rtc.dev = dev;
14313 ++ dev_set_drvdata(dev, &cmos_rtc);
14314 ++
14315 + cmos_rtc.rtc = rtc_device_register(driver_name, dev,
14316 + &cmos_rtc_ops, THIS_MODULE);
14317 + if (IS_ERR(cmos_rtc.rtc)) {
14318 +@@ -726,8 +729,6 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
14319 + goto cleanup0;
14320 + }
14321 +
14322 +- cmos_rtc.dev = dev;
14323 +- dev_set_drvdata(dev, &cmos_rtc);
14324 + rename_region(ports, dev_name(&cmos_rtc.rtc->dev));
14325 +
14326 + spin_lock_irq(&rtc_lock);
14327 +diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
14328 +index e0d7b99..43bfffe 100644
14329 +--- a/drivers/rtc/rtc-s3c.c
14330 ++++ b/drivers/rtc/rtc-s3c.c
14331 +@@ -456,8 +456,6 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
14332 + pr_debug("s3c2410_rtc: RTCCON=%02x\n",
14333 + readb(s3c_rtc_base + S3C2410_RTCCON));
14334 +
14335 +- s3c_rtc_setfreq(&pdev->dev, 1);
14336 +-
14337 + device_init_wakeup(&pdev->dev, 1);
14338 +
14339 + /* register RTC and exit */
14340 +@@ -474,6 +472,9 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
14341 + rtc->max_user_freq = 128;
14342 +
14343 + platform_set_drvdata(pdev, rtc);
14344 ++
14345 ++ s3c_rtc_setfreq(&pdev->dev, 1);
14346 ++
14347 + return 0;
14348 +
14349 + err_nortc:
14350 +diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
14351 +index 6fc63b9..40807e4 100644
14352 +--- a/drivers/scsi/qla2xxx/qla_isr.c
14353 ++++ b/drivers/scsi/qla2xxx/qla_isr.c
14354 +@@ -2169,30 +2169,28 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
14355 +
14356 + /* If possible, enable MSI-X. */
14357 + if (!IS_QLA2432(ha) && !IS_QLA2532(ha) &&
14358 +- !IS_QLA8432(ha) && !IS_QLA8001(ha))
14359 +- goto skip_msix;
14360 ++ !IS_QLA8432(ha) && !IS_QLA8001(ha))
14361 ++ goto skip_msi;
14362 ++
14363 ++ if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
14364 ++ (ha->pdev->subsystem_device == 0x7040 ||
14365 ++ ha->pdev->subsystem_device == 0x7041 ||
14366 ++ ha->pdev->subsystem_device == 0x1705)) {
14367 ++ DEBUG2(qla_printk(KERN_WARNING, ha,
14368 ++ "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X,0x%X).\n",
14369 ++ ha->pdev->subsystem_vendor,
14370 ++ ha->pdev->subsystem_device));
14371 ++ goto skip_msi;
14372 ++ }
14373 +
14374 + if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX ||
14375 + !QLA_MSIX_FW_MODE_1(ha->fw_attributes))) {
14376 + DEBUG2(qla_printk(KERN_WARNING, ha,
14377 + "MSI-X: Unsupported ISP2432 (0x%X, 0x%X).\n",
14378 + ha->pdev->revision, ha->fw_attributes));
14379 +-
14380 + goto skip_msix;
14381 + }
14382 +
14383 +- if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
14384 +- (ha->pdev->subsystem_device == 0x7040 ||
14385 +- ha->pdev->subsystem_device == 0x7041 ||
14386 +- ha->pdev->subsystem_device == 0x1705)) {
14387 +- DEBUG2(qla_printk(KERN_WARNING, ha,
14388 +- "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X, 0x%X).\n",
14389 +- ha->pdev->subsystem_vendor,
14390 +- ha->pdev->subsystem_device));
14391 +-
14392 +- goto skip_msi;
14393 +- }
14394 +-
14395 + ret = qla24xx_enable_msix(ha, rsp);
14396 + if (!ret) {
14397 + DEBUG2(qla_printk(KERN_INFO, ha,
14398 +diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c
14399 +index dc4849a..9855608 100644
14400 +--- a/drivers/staging/comedi/drivers/ni_mio_cs.c
14401 ++++ b/drivers/staging/comedi/drivers/ni_mio_cs.c
14402 +@@ -123,7 +123,7 @@ static const struct ni_board_struct ni_boards[] = {
14403 + .adbits = 12,
14404 + .ai_fifo_depth = 1024,
14405 + .alwaysdither = 0,
14406 +- .gainlkup = ai_gain_16,
14407 ++ .gainlkup = ai_gain_4,
14408 + .ai_speed = 5000,
14409 + .n_aochan = 2,
14410 + .aobits = 12,
14411 +diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c
14412 +index 925a236..2ebc599 100644
14413 +--- a/drivers/staging/rt2860/usb_main_dev.c
14414 ++++ b/drivers/staging/rt2860/usb_main_dev.c
14415 +@@ -97,6 +97,7 @@ struct usb_device_id rtusb_usb_id[] = {
14416 + {USB_DEVICE(0x5A57, 0x0282)}, /* Zinwell */
14417 + {USB_DEVICE(0x7392, 0x7718)},
14418 + {USB_DEVICE(0x7392, 0x7717)},
14419 ++ {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */
14420 + {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */
14421 + {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */
14422 + {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */
14423 +diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c
14424 +index ccb9d5b..55337c8 100644
14425 +--- a/drivers/staging/rtl8192su/r8192U_core.c
14426 ++++ b/drivers/staging/rtl8192su/r8192U_core.c
14427 +@@ -120,6 +120,7 @@ static struct usb_device_id rtl8192_usb_id_tbl[] = {
14428 + {USB_DEVICE(0x050d, 0x805E)},
14429 + /* Sitecom */
14430 + {USB_DEVICE(0x0df6, 0x0031)},
14431 ++ {USB_DEVICE(0x0df6, 0x004b)}, /* WL-349 */
14432 + /* EnGenius */
14433 + {USB_DEVICE(0x1740, 0x9201)},
14434 + /* Dlink */
14435 +diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
14436 +index 0db8d7b..433c403 100644
14437 +--- a/drivers/staging/vt6655/device_main.c
14438 ++++ b/drivers/staging/vt6655/device_main.c
14439 +@@ -1089,11 +1089,13 @@ device_found1(struct pci_dev *pcid, const struct pci_device_id *ent)
14440 + }
14441 + //2008-07-21-01<Add>by MikeLiu
14442 + //register wpadev
14443 ++#if 0
14444 + if(wpa_set_wpadev(pDevice, 1)!=0) {
14445 + printk("Fail to Register WPADEV?\n");
14446 + unregister_netdev(pDevice->dev);
14447 + free_netdev(dev);
14448 + }
14449 ++#endif
14450 + device_print_info(pDevice);
14451 + pci_set_drvdata(pcid, pDevice);
14452 + return 0;
14453 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
14454 +index db6b071..d1c2108 100644
14455 +--- a/drivers/usb/class/cdc-acm.c
14456 ++++ b/drivers/usb/class/cdc-acm.c
14457 +@@ -1201,7 +1201,7 @@ made_compressed_probe:
14458 + if (rcv->urb == NULL) {
14459 + dev_dbg(&intf->dev,
14460 + "out of memory (read urbs usb_alloc_urb)\n");
14461 +- goto alloc_fail7;
14462 ++ goto alloc_fail6;
14463 + }
14464 +
14465 + rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
14466 +@@ -1225,7 +1225,7 @@ made_compressed_probe:
14467 + if (snd->urb == NULL) {
14468 + dev_dbg(&intf->dev,
14469 + "out of memory (write urbs usb_alloc_urb)");
14470 +- goto alloc_fail7;
14471 ++ goto alloc_fail8;
14472 + }
14473 +
14474 + if (usb_endpoint_xfer_int(epwrite))
14475 +@@ -1264,6 +1264,7 @@ made_compressed_probe:
14476 + i = device_create_file(&intf->dev,
14477 + &dev_attr_iCountryCodeRelDate);
14478 + if (i < 0) {
14479 ++ device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
14480 + kfree(acm->country_codes);
14481 + goto skip_countries;
14482 + }
14483 +@@ -1300,6 +1301,7 @@ alloc_fail8:
14484 + usb_free_urb(acm->wb[i].urb);
14485 + alloc_fail7:
14486 + acm_read_buffers_free(acm);
14487 ++alloc_fail6:
14488 + for (i = 0; i < num_rx_buf; i++)
14489 + usb_free_urb(acm->ru[i].urb);
14490 + usb_free_urb(acm->ctrlurb);
14491 +diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
14492 +index fa3d142..08a9a62 100644
14493 +--- a/drivers/usb/gadget/fsl_udc_core.c
14494 ++++ b/drivers/usb/gadget/fsl_udc_core.c
14495 +@@ -489,7 +489,7 @@ static int fsl_ep_enable(struct usb_ep *_ep,
14496 + case USB_ENDPOINT_XFER_ISOC:
14497 + /* Calculate transactions needed for high bandwidth iso */
14498 + mult = (unsigned char)(1 + ((max >> 11) & 0x03));
14499 +- max = max & 0x8ff; /* bit 0~10 */
14500 ++ max = max & 0x7ff; /* bit 0~10 */
14501 + /* 3 transactions at most */
14502 + if (mult > 3)
14503 + goto en_done;
14504 +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
14505 +index 1937267..ec45293 100644
14506 +--- a/drivers/usb/host/ehci-hub.c
14507 ++++ b/drivers/usb/host/ehci-hub.c
14508 +@@ -294,6 +294,16 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
14509 + /* manually resume the ports we suspended during bus_suspend() */
14510 + i = HCS_N_PORTS (ehci->hcs_params);
14511 + while (i--) {
14512 ++ /* clear phy low power mode before resume */
14513 ++ if (ehci->has_hostpc) {
14514 ++ u32 __iomem *hostpc_reg =
14515 ++ (u32 __iomem *)((u8 *)ehci->regs
14516 ++ + HOSTPC0 + 4 * (i & 0xff));
14517 ++ temp = ehci_readl(ehci, hostpc_reg);
14518 ++ ehci_writel(ehci, temp & ~HOSTPC_PHCD,
14519 ++ hostpc_reg);
14520 ++ mdelay(5);
14521 ++ }
14522 + temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
14523 + temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
14524 + if (test_bit(i, &ehci->bus_suspended) &&
14525 +@@ -678,6 +688,13 @@ static int ehci_hub_control (
14526 + if (temp & PORT_SUSPEND) {
14527 + if ((temp & PORT_PE) == 0)
14528 + goto error;
14529 ++ /* clear phy low power mode before resume */
14530 ++ if (hostpc_reg) {
14531 ++ temp1 = ehci_readl(ehci, hostpc_reg);
14532 ++ ehci_writel(ehci, temp1 & ~HOSTPC_PHCD,
14533 ++ hostpc_reg);
14534 ++ mdelay(5);
14535 ++ }
14536 + /* resume signaling for 20 msec */
14537 + temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
14538 + ehci_writel(ehci, temp | PORT_RESUME,
14539 +diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h
14540 +index 72dae1c..3b6e864 100644
14541 +--- a/drivers/usb/host/fhci.h
14542 ++++ b/drivers/usb/host/fhci.h
14543 +@@ -20,6 +20,7 @@
14544 +
14545 + #include <linux/kernel.h>
14546 + #include <linux/types.h>
14547 ++#include <linux/bug.h>
14548 + #include <linux/spinlock.h>
14549 + #include <linux/interrupt.h>
14550 + #include <linux/kfifo.h>
14551 +@@ -515,9 +516,13 @@ static inline int cq_put(struct kfifo *kfifo, void *p)
14552 +
14553 + static inline void *cq_get(struct kfifo *kfifo)
14554 + {
14555 +- void *p = NULL;
14556 ++ unsigned int sz;
14557 ++ void *p;
14558 ++
14559 ++ sz = kfifo_out(kfifo, (void *)&p, sizeof(p));
14560 ++ if (sz != sizeof(p))
14561 ++ return NULL;
14562 +
14563 +- kfifo_out(kfifo, (void *)&p, sizeof(p));
14564 + return p;
14565 + }
14566 +
14567 +diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c
14568 +index fa920c7..53d90ca 100644
14569 +--- a/drivers/usb/host/xhci-hcd.c
14570 ++++ b/drivers/usb/host/xhci-hcd.c
14571 +@@ -104,6 +104,33 @@ int xhci_halt(struct xhci_hcd *xhci)
14572 + }
14573 +
14574 + /*
14575 ++ * Set the run bit and wait for the host to be running.
14576 ++ */
14577 ++int xhci_start(struct xhci_hcd *xhci)
14578 ++{
14579 ++ u32 temp;
14580 ++ int ret;
14581 ++
14582 ++ temp = xhci_readl(xhci, &xhci->op_regs->command);
14583 ++ temp |= (CMD_RUN);
14584 ++ xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
14585 ++ temp);
14586 ++ xhci_writel(xhci, temp, &xhci->op_regs->command);
14587 ++
14588 ++ /*
14589 ++ * Wait for the HCHalted Status bit to be 0 to indicate the host is
14590 ++ * running.
14591 ++ */
14592 ++ ret = handshake(xhci, &xhci->op_regs->status,
14593 ++ STS_HALT, 0, XHCI_MAX_HALT_USEC);
14594 ++ if (ret == -ETIMEDOUT)
14595 ++ xhci_err(xhci, "Host took too long to start, "
14596 ++ "waited %u microseconds.\n",
14597 ++ XHCI_MAX_HALT_USEC);
14598 ++ return ret;
14599 ++}
14600 ++
14601 ++/*
14602 + * Reset a halted HC, and set the internal HC state to HC_STATE_HALT.
14603 + *
14604 + * This resets pipelines, timers, counters, state machines, etc.
14605 +@@ -114,6 +141,7 @@ int xhci_reset(struct xhci_hcd *xhci)
14606 + {
14607 + u32 command;
14608 + u32 state;
14609 ++ int ret;
14610 +
14611 + state = xhci_readl(xhci, &xhci->op_regs->status);
14612 + if ((state & STS_HALT) == 0) {
14613 +@@ -128,7 +156,17 @@ int xhci_reset(struct xhci_hcd *xhci)
14614 + /* XXX: Why does EHCI set this here? Shouldn't other code do this? */
14615 + xhci_to_hcd(xhci)->state = HC_STATE_HALT;
14616 +
14617 +- return handshake(xhci, &xhci->op_regs->command, CMD_RESET, 0, 250 * 1000);
14618 ++ ret = handshake(xhci, &xhci->op_regs->command,
14619 ++ CMD_RESET, 0, 250 * 1000);
14620 ++ if (ret)
14621 ++ return ret;
14622 ++
14623 ++ xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n");
14624 ++ /*
14625 ++ * xHCI cannot write to any doorbells or operational registers other
14626 ++ * than status until the "Controller Not Ready" flag is cleared.
14627 ++ */
14628 ++ return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
14629 + }
14630 +
14631 +
14632 +@@ -451,13 +489,11 @@ int xhci_run(struct usb_hcd *hcd)
14633 + if (NUM_TEST_NOOPS > 0)
14634 + doorbell = xhci_setup_one_noop(xhci);
14635 +
14636 +- temp = xhci_readl(xhci, &xhci->op_regs->command);
14637 +- temp |= (CMD_RUN);
14638 +- xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
14639 +- temp);
14640 +- xhci_writel(xhci, temp, &xhci->op_regs->command);
14641 +- /* Flush PCI posted writes */
14642 +- temp = xhci_readl(xhci, &xhci->op_regs->command);
14643 ++ if (xhci_start(xhci)) {
14644 ++ xhci_halt(xhci);
14645 ++ return -ENODEV;
14646 ++ }
14647 ++
14648 + xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp);
14649 + if (doorbell)
14650 + (*doorbell)(xhci);
14651 +@@ -1452,6 +1488,8 @@ void xhci_endpoint_reset(struct usb_hcd *hcd,
14652 + kfree(virt_ep->stopped_td);
14653 + xhci_ring_cmd_db(xhci);
14654 + }
14655 ++ virt_ep->stopped_td = NULL;
14656 ++ virt_ep->stopped_trb = NULL;
14657 + spin_unlock_irqrestore(&xhci->lock, flags);
14658 +
14659 + if (ret)
14660 +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
14661 +index e097008..4361b2d 100644
14662 +--- a/drivers/usb/host/xhci-pci.c
14663 ++++ b/drivers/usb/host/xhci-pci.c
14664 +@@ -54,7 +54,7 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
14665 + struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
14666 + int retval;
14667 +
14668 +- hcd->self.sg_tablesize = TRBS_PER_SEGMENT - 1;
14669 ++ hcd->self.sg_tablesize = TRBS_PER_SEGMENT - 2;
14670 +
14671 + xhci->cap_regs = hcd->regs;
14672 + xhci->op_regs = hcd->regs +
14673 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
14674 +index ee7bc7e..2b26b5e 100644
14675 +--- a/drivers/usb/host/xhci-ring.c
14676 ++++ b/drivers/usb/host/xhci-ring.c
14677 +@@ -241,10 +241,27 @@ static int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring,
14678 + int i;
14679 + union xhci_trb *enq = ring->enqueue;
14680 + struct xhci_segment *enq_seg = ring->enq_seg;
14681 ++ struct xhci_segment *cur_seg;
14682 ++ unsigned int left_on_ring;
14683 +
14684 + /* Check if ring is empty */
14685 +- if (enq == ring->dequeue)
14686 ++ if (enq == ring->dequeue) {
14687 ++ /* Can't use link trbs */
14688 ++ left_on_ring = TRBS_PER_SEGMENT - 1;
14689 ++ for (cur_seg = enq_seg->next; cur_seg != enq_seg;
14690 ++ cur_seg = cur_seg->next)
14691 ++ left_on_ring += TRBS_PER_SEGMENT - 1;
14692 ++
14693 ++ /* Always need one TRB free in the ring. */
14694 ++ left_on_ring -= 1;
14695 ++ if (num_trbs > left_on_ring) {
14696 ++ xhci_warn(xhci, "Not enough room on ring; "
14697 ++ "need %u TRBs, %u TRBs left\n",
14698 ++ num_trbs, left_on_ring);
14699 ++ return 0;
14700 ++ }
14701 + return 1;
14702 ++ }
14703 + /* Make sure there's an extra empty TRB available */
14704 + for (i = 0; i <= num_trbs; ++i) {
14705 + if (enq == ring->dequeue)
14706 +@@ -333,7 +350,8 @@ static struct xhci_segment *find_trb_seg(
14707 + while (cur_seg->trbs > trb ||
14708 + &cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {
14709 + generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic;
14710 +- if (TRB_TYPE(generic_trb->field[3]) == TRB_LINK &&
14711 ++ if ((generic_trb->field[3] & TRB_TYPE_BITMASK) ==
14712 ++ TRB_TYPE(TRB_LINK) &&
14713 + (generic_trb->field[3] & LINK_TOGGLE))
14714 + *cycle_state = ~(*cycle_state) & 0x1;
14715 + cur_seg = cur_seg->next;
14716 +@@ -389,7 +407,7 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
14717 + BUG();
14718 +
14719 + trb = &state->new_deq_ptr->generic;
14720 +- if (TRB_TYPE(trb->field[3]) == TRB_LINK &&
14721 ++ if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) &&
14722 + (trb->field[3] & LINK_TOGGLE))
14723 + state->new_cycle_state = ~(state->new_cycle_state) & 0x1;
14724 + next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr);
14725 +@@ -577,6 +595,8 @@ static void handle_stopped_endpoint(struct xhci_hcd *xhci,
14726 + /* Otherwise just ring the doorbell to restart the ring */
14727 + ring_ep_doorbell(xhci, slot_id, ep_index);
14728 + }
14729 ++ ep->stopped_td = NULL;
14730 ++ ep->stopped_trb = NULL;
14731 +
14732 + /*
14733 + * Drop the lock and complete the URBs in the cancelled TD list.
14734 +@@ -1049,8 +1069,13 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
14735 + ep->ep_state |= EP_HALTED;
14736 + ep->stopped_td = td;
14737 + ep->stopped_trb = event_trb;
14738 ++
14739 + xhci_queue_reset_ep(xhci, slot_id, ep_index);
14740 + xhci_cleanup_stalled_ring(xhci, td->urb->dev, ep_index);
14741 ++
14742 ++ ep->stopped_td = NULL;
14743 ++ ep->stopped_trb = NULL;
14744 ++
14745 + xhci_ring_cmd_db(xhci);
14746 + }
14747 +
14748 +@@ -1370,8 +1395,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
14749 + for (cur_trb = ep_ring->dequeue, cur_seg = ep_ring->deq_seg;
14750 + cur_trb != event_trb;
14751 + next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
14752 +- if (TRB_TYPE(cur_trb->generic.field[3]) != TRB_TR_NOOP &&
14753 +- TRB_TYPE(cur_trb->generic.field[3]) != TRB_LINK)
14754 ++ if ((cur_trb->generic.field[3] &
14755 ++ TRB_TYPE_BITMASK) != TRB_TYPE(TRB_TR_NOOP) &&
14756 ++ (cur_trb->generic.field[3] &
14757 ++ TRB_TYPE_BITMASK) != TRB_TYPE(TRB_LINK))
14758 + td->urb->actual_length +=
14759 + TRB_LEN(cur_trb->generic.field[2]);
14760 + }
14761 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
14762 +index 7d920f2..e3e087e 100644
14763 +--- a/drivers/usb/serial/cp210x.c
14764 ++++ b/drivers/usb/serial/cp210x.c
14765 +@@ -61,6 +61,8 @@ static struct usb_device_id id_table [] = {
14766 + { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */
14767 + { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
14768 + { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
14769 ++ { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
14770 ++ { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
14771 + { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
14772 + { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */
14773 + { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */
14774 +@@ -72,9 +74,12 @@ static struct usb_device_id id_table [] = {
14775 + { USB_DEVICE(0x10C4, 0x1601) }, /* Arkham Technology DS101 Adapter */
14776 + { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */
14777 + { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */
14778 ++ { USB_DEVICE(0x10C4, 0x8044) }, /* Cygnal Debug Adapter */
14779 ++ { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */
14780 + { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */
14781 + { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */
14782 + { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */
14783 ++ { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */
14784 + { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */
14785 + { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
14786 + { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
14787 +@@ -82,12 +87,15 @@ static struct usb_device_id id_table [] = {
14788 + { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
14789 + { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
14790 + { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
14791 ++ { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */
14792 + { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
14793 + { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
14794 + { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
14795 ++ { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */
14796 + { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
14797 + { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
14798 + { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */
14799 ++ { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */
14800 + { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
14801 + { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
14802 + { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
14803 +@@ -105,6 +113,7 @@ static struct usb_device_id id_table [] = {
14804 + { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
14805 + { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
14806 + { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
14807 ++ { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */
14808 + { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
14809 + { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */
14810 + { USB_DEVICE(0x10C4, 0xF003) }, /* Elan Digital Systems USBpulse100 */
14811 +@@ -115,6 +124,8 @@ static struct usb_device_id id_table [] = {
14812 + { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
14813 + { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
14814 + { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
14815 ++ { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
14816 ++ { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
14817 + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
14818 + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
14819 + { } /* Terminating Entry */
14820 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
14821 +index ca9e3ba..8c19ad5 100644
14822 +--- a/drivers/usb/serial/ftdi_sio.c
14823 ++++ b/drivers/usb/serial/ftdi_sio.c
14824 +@@ -2312,6 +2312,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
14825 + "urb failed to set to rts/cts flow control\n");
14826 + }
14827 +
14828 ++ /* raise DTR/RTS */
14829 ++ set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
14830 + } else {
14831 + /*
14832 + * Xon/Xoff code
14833 +@@ -2359,6 +2361,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
14834 + }
14835 + }
14836 +
14837 ++ /* lower DTR/RTS */
14838 ++ clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
14839 + }
14840 + return;
14841 + }
14842 +diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
14843 +index 95d8d26..2e0497b 100644
14844 +--- a/drivers/usb/serial/ir-usb.c
14845 ++++ b/drivers/usb/serial/ir-usb.c
14846 +@@ -312,6 +312,7 @@ static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
14847 + kfree(port->read_urb->transfer_buffer);
14848 + port->read_urb->transfer_buffer = buffer;
14849 + port->read_urb->transfer_buffer_length = buffer_size;
14850 ++ port->bulk_in_buffer = buffer;
14851 +
14852 + buffer = kmalloc(buffer_size, GFP_KERNEL);
14853 + if (!buffer) {
14854 +@@ -321,6 +322,7 @@ static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
14855 + kfree(port->write_urb->transfer_buffer);
14856 + port->write_urb->transfer_buffer = buffer;
14857 + port->write_urb->transfer_buffer_length = buffer_size;
14858 ++ port->bulk_out_buffer = buffer;
14859 + port->bulk_out_size = buffer_size;
14860 + }
14861 +
14862 +diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
14863 +index 3a78738..6825082 100644
14864 +--- a/drivers/usb/serial/kl5kusb105.c
14865 ++++ b/drivers/usb/serial/kl5kusb105.c
14866 +@@ -310,6 +310,7 @@ err_cleanup:
14867 + usb_free_urb(priv->write_urb_pool[j]);
14868 + }
14869 + }
14870 ++ kfree(priv);
14871 + usb_set_serial_port_data(serial->port[i], NULL);
14872 + }
14873 + return -ENOMEM;
14874 +diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
14875 +index 45ea694..9d99e68 100644
14876 +--- a/drivers/usb/serial/kobil_sct.c
14877 ++++ b/drivers/usb/serial/kobil_sct.c
14878 +@@ -345,7 +345,8 @@ static void kobil_close(struct usb_serial_port *port)
14879 +
14880 + /* FIXME: Add rts/dtr methods */
14881 + if (port->write_urb) {
14882 +- usb_kill_urb(port->write_urb);
14883 ++ usb_poison_urb(port->write_urb);
14884 ++ kfree(port->write_urb->transfer_buffer);
14885 + usb_free_urb(port->write_urb);
14886 + port->write_urb = NULL;
14887 + }
14888 +diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
14889 +index 2cfe245..fb472dd 100644
14890 +--- a/drivers/usb/serial/mos7840.c
14891 ++++ b/drivers/usb/serial/mos7840.c
14892 +@@ -717,7 +717,6 @@ static void mos7840_bulk_in_callback(struct urb *urb)
14893 + mos7840_port = urb->context;
14894 + if (!mos7840_port) {
14895 + dbg("%s", "NULL mos7840_port pointer");
14896 +- mos7840_port->read_urb_busy = false;
14897 + return;
14898 + }
14899 +
14900 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
14901 +index d93283d..64b50f6 100644
14902 +--- a/drivers/usb/serial/option.c
14903 ++++ b/drivers/usb/serial/option.c
14904 +@@ -334,6 +334,24 @@ static int option_resume(struct usb_serial *serial);
14905 + #define ALCATEL_VENDOR_ID 0x1bbb
14906 + #define ALCATEL_PRODUCT_X060S 0x0000
14907 +
14908 ++#define PIRELLI_VENDOR_ID 0x1266
14909 ++#define PIRELLI_PRODUCT_C100_1 0x1002
14910 ++#define PIRELLI_PRODUCT_C100_2 0x1003
14911 ++#define PIRELLI_PRODUCT_1004 0x1004
14912 ++#define PIRELLI_PRODUCT_1005 0x1005
14913 ++#define PIRELLI_PRODUCT_1006 0x1006
14914 ++#define PIRELLI_PRODUCT_1007 0x1007
14915 ++#define PIRELLI_PRODUCT_1008 0x1008
14916 ++#define PIRELLI_PRODUCT_1009 0x1009
14917 ++#define PIRELLI_PRODUCT_100A 0x100a
14918 ++#define PIRELLI_PRODUCT_100B 0x100b
14919 ++#define PIRELLI_PRODUCT_100C 0x100c
14920 ++#define PIRELLI_PRODUCT_100D 0x100d
14921 ++#define PIRELLI_PRODUCT_100E 0x100e
14922 ++#define PIRELLI_PRODUCT_100F 0x100f
14923 ++#define PIRELLI_PRODUCT_1011 0x1011
14924 ++#define PIRELLI_PRODUCT_1012 0x1012
14925 ++
14926 + /* Airplus products */
14927 + #define AIRPLUS_VENDOR_ID 0x1011
14928 + #define AIRPLUS_PRODUCT_MCD650 0x3198
14929 +@@ -346,6 +364,12 @@ static int option_resume(struct usb_serial *serial);
14930 + #define HAIER_VENDOR_ID 0x201e
14931 + #define HAIER_PRODUCT_CE100 0x2009
14932 +
14933 ++#define CINTERION_VENDOR_ID 0x0681
14934 ++
14935 ++/* Olivetti products */
14936 ++#define OLIVETTI_VENDOR_ID 0x0b3c
14937 ++#define OLIVETTI_PRODUCT_OLICARD100 0xc000
14938 ++
14939 + static struct usb_device_id option_ids[] = {
14940 + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
14941 + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
14942 +@@ -621,6 +645,180 @@ static struct usb_device_id option_ids[] = {
14943 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) },
14944 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
14945 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
14946 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) },
14947 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) },
14948 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
14949 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
14950 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
14951 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
14952 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1060, 0xff, 0xff, 0xff) },
14953 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1061, 0xff, 0xff, 0xff) },
14954 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1062, 0xff, 0xff, 0xff) },
14955 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1063, 0xff, 0xff, 0xff) },
14956 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1064, 0xff, 0xff, 0xff) },
14957 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1065, 0xff, 0xff, 0xff) },
14958 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1066, 0xff, 0xff, 0xff) },
14959 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1067, 0xff, 0xff, 0xff) },
14960 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1068, 0xff, 0xff, 0xff) },
14961 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1069, 0xff, 0xff, 0xff) },
14962 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1070, 0xff, 0xff, 0xff) },
14963 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1071, 0xff, 0xff, 0xff) },
14964 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1072, 0xff, 0xff, 0xff) },
14965 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1073, 0xff, 0xff, 0xff) },
14966 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1074, 0xff, 0xff, 0xff) },
14967 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1075, 0xff, 0xff, 0xff) },
14968 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1076, 0xff, 0xff, 0xff) },
14969 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1077, 0xff, 0xff, 0xff) },
14970 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1078, 0xff, 0xff, 0xff) },
14971 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1079, 0xff, 0xff, 0xff) },
14972 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1080, 0xff, 0xff, 0xff) },
14973 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1081, 0xff, 0xff, 0xff) },
14974 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1082, 0xff, 0xff, 0xff) },
14975 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1083, 0xff, 0xff, 0xff) },
14976 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1084, 0xff, 0xff, 0xff) },
14977 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1085, 0xff, 0xff, 0xff) },
14978 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1086, 0xff, 0xff, 0xff) },
14979 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1087, 0xff, 0xff, 0xff) },
14980 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1088, 0xff, 0xff, 0xff) },
14981 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1089, 0xff, 0xff, 0xff) },
14982 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1090, 0xff, 0xff, 0xff) },
14983 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1091, 0xff, 0xff, 0xff) },
14984 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1092, 0xff, 0xff, 0xff) },
14985 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1093, 0xff, 0xff, 0xff) },
14986 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1094, 0xff, 0xff, 0xff) },
14987 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1095, 0xff, 0xff, 0xff) },
14988 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1096, 0xff, 0xff, 0xff) },
14989 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1097, 0xff, 0xff, 0xff) },
14990 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1098, 0xff, 0xff, 0xff) },
14991 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1099, 0xff, 0xff, 0xff) },
14992 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1100, 0xff, 0xff, 0xff) },
14993 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1101, 0xff, 0xff, 0xff) },
14994 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1102, 0xff, 0xff, 0xff) },
14995 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1103, 0xff, 0xff, 0xff) },
14996 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1104, 0xff, 0xff, 0xff) },
14997 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1105, 0xff, 0xff, 0xff) },
14998 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1106, 0xff, 0xff, 0xff) },
14999 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1107, 0xff, 0xff, 0xff) },
15000 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1108, 0xff, 0xff, 0xff) },
15001 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1109, 0xff, 0xff, 0xff) },
15002 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1110, 0xff, 0xff, 0xff) },
15003 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1111, 0xff, 0xff, 0xff) },
15004 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1112, 0xff, 0xff, 0xff) },
15005 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1113, 0xff, 0xff, 0xff) },
15006 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1114, 0xff, 0xff, 0xff) },
15007 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1115, 0xff, 0xff, 0xff) },
15008 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1116, 0xff, 0xff, 0xff) },
15009 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1117, 0xff, 0xff, 0xff) },
15010 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1118, 0xff, 0xff, 0xff) },
15011 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1119, 0xff, 0xff, 0xff) },
15012 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1120, 0xff, 0xff, 0xff) },
15013 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1121, 0xff, 0xff, 0xff) },
15014 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1122, 0xff, 0xff, 0xff) },
15015 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1123, 0xff, 0xff, 0xff) },
15016 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1124, 0xff, 0xff, 0xff) },
15017 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1125, 0xff, 0xff, 0xff) },
15018 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1126, 0xff, 0xff, 0xff) },
15019 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1127, 0xff, 0xff, 0xff) },
15020 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1128, 0xff, 0xff, 0xff) },
15021 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1129, 0xff, 0xff, 0xff) },
15022 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1130, 0xff, 0xff, 0xff) },
15023 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1131, 0xff, 0xff, 0xff) },
15024 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1132, 0xff, 0xff, 0xff) },
15025 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1133, 0xff, 0xff, 0xff) },
15026 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1134, 0xff, 0xff, 0xff) },
15027 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1135, 0xff, 0xff, 0xff) },
15028 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1136, 0xff, 0xff, 0xff) },
15029 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1137, 0xff, 0xff, 0xff) },
15030 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1138, 0xff, 0xff, 0xff) },
15031 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1139, 0xff, 0xff, 0xff) },
15032 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1140, 0xff, 0xff, 0xff) },
15033 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1141, 0xff, 0xff, 0xff) },
15034 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1142, 0xff, 0xff, 0xff) },
15035 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1143, 0xff, 0xff, 0xff) },
15036 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1144, 0xff, 0xff, 0xff) },
15037 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1145, 0xff, 0xff, 0xff) },
15038 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1146, 0xff, 0xff, 0xff) },
15039 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1147, 0xff, 0xff, 0xff) },
15040 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1148, 0xff, 0xff, 0xff) },
15041 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1149, 0xff, 0xff, 0xff) },
15042 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1150, 0xff, 0xff, 0xff) },
15043 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1151, 0xff, 0xff, 0xff) },
15044 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1152, 0xff, 0xff, 0xff) },
15045 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1153, 0xff, 0xff, 0xff) },
15046 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1154, 0xff, 0xff, 0xff) },
15047 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1155, 0xff, 0xff, 0xff) },
15048 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1156, 0xff, 0xff, 0xff) },
15049 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1157, 0xff, 0xff, 0xff) },
15050 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1158, 0xff, 0xff, 0xff) },
15051 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1159, 0xff, 0xff, 0xff) },
15052 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1160, 0xff, 0xff, 0xff) },
15053 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1161, 0xff, 0xff, 0xff) },
15054 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1162, 0xff, 0xff, 0xff) },
15055 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1163, 0xff, 0xff, 0xff) },
15056 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1164, 0xff, 0xff, 0xff) },
15057 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1165, 0xff, 0xff, 0xff) },
15058 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1166, 0xff, 0xff, 0xff) },
15059 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1167, 0xff, 0xff, 0xff) },
15060 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1168, 0xff, 0xff, 0xff) },
15061 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1169, 0xff, 0xff, 0xff) },
15062 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) },
15063 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) },
15064 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff) },
15065 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) },
15066 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff) },
15067 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) },
15068 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) },
15069 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) },
15070 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) },
15071 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff) },
15072 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) },
15073 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff) },
15074 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff) },
15075 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff) },
15076 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) },
15077 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) },
15078 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) },
15079 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1260, 0xff, 0xff, 0xff) },
15080 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1261, 0xff, 0xff, 0xff) },
15081 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1262, 0xff, 0xff, 0xff) },
15082 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1263, 0xff, 0xff, 0xff) },
15083 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1264, 0xff, 0xff, 0xff) },
15084 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1265, 0xff, 0xff, 0xff) },
15085 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1266, 0xff, 0xff, 0xff) },
15086 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1267, 0xff, 0xff, 0xff) },
15087 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1268, 0xff, 0xff, 0xff) },
15088 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1269, 0xff, 0xff, 0xff) },
15089 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1270, 0xff, 0xff, 0xff) },
15090 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1271, 0xff, 0xff, 0xff) },
15091 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) },
15092 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) },
15093 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1274, 0xff, 0xff, 0xff) },
15094 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1275, 0xff, 0xff, 0xff) },
15095 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1276, 0xff, 0xff, 0xff) },
15096 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1277, 0xff, 0xff, 0xff) },
15097 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1278, 0xff, 0xff, 0xff) },
15098 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1279, 0xff, 0xff, 0xff) },
15099 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1280, 0xff, 0xff, 0xff) },
15100 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1281, 0xff, 0xff, 0xff) },
15101 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1282, 0xff, 0xff, 0xff) },
15102 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1283, 0xff, 0xff, 0xff) },
15103 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1284, 0xff, 0xff, 0xff) },
15104 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1285, 0xff, 0xff, 0xff) },
15105 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1286, 0xff, 0xff, 0xff) },
15106 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1287, 0xff, 0xff, 0xff) },
15107 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1288, 0xff, 0xff, 0xff) },
15108 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1289, 0xff, 0xff, 0xff) },
15109 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1290, 0xff, 0xff, 0xff) },
15110 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1291, 0xff, 0xff, 0xff) },
15111 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1292, 0xff, 0xff, 0xff) },
15112 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1293, 0xff, 0xff, 0xff) },
15113 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1294, 0xff, 0xff, 0xff) },
15114 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1295, 0xff, 0xff, 0xff) },
15115 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1296, 0xff, 0xff, 0xff) },
15116 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1297, 0xff, 0xff, 0xff) },
15117 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
15118 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
15119 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
15120 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
15121 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) },
15122 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
15123 +@@ -649,6 +847,27 @@ static struct usb_device_id option_ids[] = {
15124 + { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
15125 + { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14) },
15126 + { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
15127 ++ /* Pirelli */
15128 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)},
15129 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2)},
15130 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1004)},
15131 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1005)},
15132 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1006)},
15133 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1007)},
15134 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1008)},
15135 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1009)},
15136 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100A)},
15137 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100B) },
15138 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100C) },
15139 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100D) },
15140 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100E) },
15141 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
15142 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
15143 ++ { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
15144 ++
15145 ++ { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
15146 ++
15147 ++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
15148 + { } /* Terminating entry */
15149 + };
15150 + MODULE_DEVICE_TABLE(usb, option_ids);
15151 +@@ -771,12 +990,19 @@ static int option_probe(struct usb_serial *serial,
15152 + const struct usb_device_id *id)
15153 + {
15154 + struct option_intf_private *data;
15155 ++
15156 + /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */
15157 + if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID &&
15158 + serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 &&
15159 + serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8)
15160 + return -ENODEV;
15161 +
15162 ++ /* Bandrich modem and AT command interface is 0xff */
15163 ++ if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID ||
15164 ++ serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) &&
15165 ++ serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff)
15166 ++ return -ENODEV;
15167 ++
15168 + data = serial->private = kzalloc(sizeof(struct option_intf_private), GFP_KERNEL);
15169 + if (!data)
15170 + return -ENOMEM;
15171 +diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
15172 +index ad1f923..c140870 100644
15173 +--- a/drivers/usb/serial/visor.c
15174 ++++ b/drivers/usb/serial/visor.c
15175 +@@ -249,6 +249,7 @@ static struct usb_serial_driver clie_3_5_device = {
15176 + .throttle = visor_throttle,
15177 + .unthrottle = visor_unthrottle,
15178 + .attach = clie_3_5_startup,
15179 ++ .release = visor_release,
15180 + .write = visor_write,
15181 + .write_room = visor_write_room,
15182 + .write_bulk_callback = visor_write_bulk_callback,
15183 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
15184 +index 98b549b..b6e0e0e 100644
15185 +--- a/drivers/usb/storage/unusual_devs.h
15186 ++++ b/drivers/usb/storage/unusual_devs.h
15187 +@@ -1858,6 +1858,21 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
15188 + US_SC_DEVICE, US_PR_DEVICE, NULL,
15189 + US_FL_IGNORE_RESIDUE ),
15190 +
15191 ++/* Reported by Hans de Goede <hdegoede@××××××.com>
15192 ++ * These Appotech controllers are found in Picture Frames, they provide a
15193 ++ * (buggy) emulation of a cdrom drive which contains the windows software
15194 ++ * Uploading of pictures happens over the corresponding /dev/sg device. */
15195 ++UNUSUAL_DEV( 0x1908, 0x1315, 0x0000, 0x0000,
15196 ++ "BUILDWIN",
15197 ++ "Photo Frame",
15198 ++ US_SC_DEVICE, US_PR_DEVICE, NULL,
15199 ++ US_FL_BAD_SENSE ),
15200 ++UNUSUAL_DEV( 0x1908, 0x1320, 0x0000, 0x0000,
15201 ++ "BUILDWIN",
15202 ++ "Photo Frame",
15203 ++ US_SC_DEVICE, US_PR_DEVICE, NULL,
15204 ++ US_FL_BAD_SENSE ),
15205 ++
15206 + UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
15207 + "ST",
15208 + "2A",
15209 +diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
15210 +index eab33f1..7b547f5 100644
15211 +--- a/drivers/xen/xenbus/xenbus_xs.c
15212 ++++ b/drivers/xen/xenbus/xenbus_xs.c
15213 +@@ -499,7 +499,7 @@ int xenbus_printf(struct xenbus_transaction t,
15214 + #define PRINTF_BUFFER_SIZE 4096
15215 + char *printf_buffer;
15216 +
15217 +- printf_buffer = kmalloc(PRINTF_BUFFER_SIZE, GFP_KERNEL);
15218 ++ printf_buffer = kmalloc(PRINTF_BUFFER_SIZE, GFP_NOIO | __GFP_HIGH);
15219 + if (printf_buffer == NULL)
15220 + return -ENOMEM;
15221 +
15222 +diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
15223 +index 6df6d6e..9be949a 100644
15224 +--- a/fs/btrfs/acl.c
15225 ++++ b/fs/btrfs/acl.c
15226 +@@ -159,6 +159,9 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
15227 + int ret;
15228 + struct posix_acl *acl = NULL;
15229 +
15230 ++ if (!is_owner_or_cap(dentry->d_inode))
15231 ++ return -EPERM;
15232 ++
15233 + if (value) {
15234 + acl = posix_acl_from_xattr(value, size);
15235 + if (acl == NULL) {
15236 +diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
15237 +index 5646727..05a9b77 100644
15238 +--- a/fs/cifs/cifsproto.h
15239 ++++ b/fs/cifs/cifsproto.h
15240 +@@ -95,8 +95,10 @@ extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode,
15241 + __u16 fileHandle, struct file *file,
15242 + struct vfsmount *mnt, unsigned int oflags);
15243 + extern int cifs_posix_open(char *full_path, struct inode **pinode,
15244 +- struct vfsmount *mnt, int mode, int oflags,
15245 +- __u32 *poplock, __u16 *pnetfid, int xid);
15246 ++ struct vfsmount *mnt,
15247 ++ struct super_block *sb,
15248 ++ int mode, int oflags,
15249 ++ __u32 *poplock, __u16 *pnetfid, int xid);
15250 + extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
15251 + FILE_UNIX_BASIC_INFO *info,
15252 + struct cifs_sb_info *cifs_sb);
15253 +diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
15254 +index 6ccf726..9e9d48f 100644
15255 +--- a/fs/cifs/dir.c
15256 ++++ b/fs/cifs/dir.c
15257 +@@ -183,13 +183,14 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
15258 + }
15259 +
15260 + int cifs_posix_open(char *full_path, struct inode **pinode,
15261 +- struct vfsmount *mnt, int mode, int oflags,
15262 +- __u32 *poplock, __u16 *pnetfid, int xid)
15263 ++ struct vfsmount *mnt, struct super_block *sb,
15264 ++ int mode, int oflags,
15265 ++ __u32 *poplock, __u16 *pnetfid, int xid)
15266 + {
15267 + int rc;
15268 + FILE_UNIX_BASIC_INFO *presp_data;
15269 + __u32 posix_flags = 0;
15270 +- struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb);
15271 ++ struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
15272 + struct cifs_fattr fattr;
15273 +
15274 + cFYI(1, ("posix open %s", full_path));
15275 +@@ -242,7 +243,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
15276 +
15277 + /* get new inode and set it up */
15278 + if (*pinode == NULL) {
15279 +- *pinode = cifs_iget(mnt->mnt_sb, &fattr);
15280 ++ *pinode = cifs_iget(sb, &fattr);
15281 + if (!*pinode) {
15282 + rc = -ENOMEM;
15283 + goto posix_open_ret;
15284 +@@ -251,7 +252,8 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
15285 + cifs_fattr_to_inode(*pinode, &fattr);
15286 + }
15287 +
15288 +- cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags);
15289 ++ if (mnt)
15290 ++ cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags);
15291 +
15292 + posix_open_ret:
15293 + kfree(presp_data);
15294 +@@ -315,13 +317,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
15295 + if (nd && (nd->flags & LOOKUP_OPEN))
15296 + oflags = nd->intent.open.flags;
15297 + else
15298 +- oflags = FMODE_READ;
15299 ++ oflags = FMODE_READ | SMB_O_CREAT;
15300 +
15301 + if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) &&
15302 + (CIFS_UNIX_POSIX_PATH_OPS_CAP &
15303 + le64_to_cpu(tcon->fsUnixInfo.Capability))) {
15304 +- rc = cifs_posix_open(full_path, &newinode, nd->path.mnt,
15305 +- mode, oflags, &oplock, &fileHandle, xid);
15306 ++ rc = cifs_posix_open(full_path, &newinode,
15307 ++ nd ? nd->path.mnt : NULL,
15308 ++ inode->i_sb, mode, oflags, &oplock, &fileHandle, xid);
15309 + /* EIO could indicate that (posix open) operation is not
15310 + supported, despite what server claimed in capability
15311 + negotation. EREMOTE indicates DFS junction, which is not
15312 +@@ -678,6 +681,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
15313 + (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open &&
15314 + (nd->intent.open.flags & O_CREAT)) {
15315 + rc = cifs_posix_open(full_path, &newInode, nd->path.mnt,
15316 ++ parent_dir_inode->i_sb,
15317 + nd->intent.open.create_mode,
15318 + nd->intent.open.flags, &oplock,
15319 + &fileHandle, xid);
15320 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
15321 +index 057e1da..8639dd7 100644
15322 +--- a/fs/cifs/file.c
15323 ++++ b/fs/cifs/file.c
15324 +@@ -297,10 +297,12 @@ int cifs_open(struct inode *inode, struct file *file)
15325 + (CIFS_UNIX_POSIX_PATH_OPS_CAP &
15326 + le64_to_cpu(tcon->fsUnixInfo.Capability))) {
15327 + int oflags = (int) cifs_posix_convert_flags(file->f_flags);
15328 ++ oflags |= SMB_O_CREAT;
15329 + /* can not refresh inode info since size could be stale */
15330 + rc = cifs_posix_open(full_path, &inode, file->f_path.mnt,
15331 +- cifs_sb->mnt_file_mode /* ignored */,
15332 +- oflags, &oplock, &netfid, xid);
15333 ++ inode->i_sb,
15334 ++ cifs_sb->mnt_file_mode /* ignored */,
15335 ++ oflags, &oplock, &netfid, xid);
15336 + if (rc == 0) {
15337 + cFYI(1, ("posix open succeeded"));
15338 + /* no need for special case handling of setting mode
15339 +@@ -512,8 +514,9 @@ reopen_error_exit:
15340 + int oflags = (int) cifs_posix_convert_flags(file->f_flags);
15341 + /* can not refresh inode info since size could be stale */
15342 + rc = cifs_posix_open(full_path, NULL, file->f_path.mnt,
15343 +- cifs_sb->mnt_file_mode /* ignored */,
15344 +- oflags, &oplock, &netfid, xid);
15345 ++ inode->i_sb,
15346 ++ cifs_sb->mnt_file_mode /* ignored */,
15347 ++ oflags, &oplock, &netfid, xid);
15348 + if (rc == 0) {
15349 + cFYI(1, ("posix reopen succeeded"));
15350 + goto reopen_success;
15351 +diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
15352 +index 4cfab1c..d91e9d8 100644
15353 +--- a/fs/exofs/dir.c
15354 ++++ b/fs/exofs/dir.c
15355 +@@ -608,7 +608,7 @@ int exofs_make_empty(struct inode *inode, struct inode *parent)
15356 + de->inode_no = cpu_to_le64(parent->i_ino);
15357 + memcpy(de->name, PARENT_DIR, sizeof(PARENT_DIR));
15358 + exofs_set_de_type(de, inode);
15359 +- kunmap_atomic(page, KM_USER0);
15360 ++ kunmap_atomic(kaddr, KM_USER0);
15361 + err = exofs_commit_chunk(page, 0, chunk_size);
15362 + fail:
15363 + page_cache_release(page);
15364 +diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
15365 +index 82c415b..e86f91e 100644
15366 +--- a/fs/ext4/move_extent.c
15367 ++++ b/fs/ext4/move_extent.c
15368 +@@ -964,6 +964,9 @@ mext_check_arguments(struct inode *orig_inode,
15369 + return -EINVAL;
15370 + }
15371 +
15372 ++ if (IS_IMMUTABLE(donor_inode) || IS_APPEND(donor_inode))
15373 ++ return -EPERM;
15374 ++
15375 + /* Ext4 move extent does not support swapfile */
15376 + if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) {
15377 + ext4_debug("ext4 move extent: The argument files should "
15378 +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
15379 +index 3b2c554..433ea27 100644
15380 +--- a/fs/ext4/resize.c
15381 ++++ b/fs/ext4/resize.c
15382 +@@ -930,7 +930,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
15383 + percpu_counter_add(&sbi->s_freeinodes_counter,
15384 + EXT4_INODES_PER_GROUP(sb));
15385 +
15386 +- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
15387 ++ if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG) &&
15388 ++ sbi->s_log_groups_per_flex) {
15389 + ext4_group_t flex_group;
15390 + flex_group = ext4_flex_group(sbi, input->group);
15391 + atomic_add(input->free_blocks_count,
15392 +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
15393 +index 1a7c42c..e7fb19c 100644
15394 +--- a/fs/fs-writeback.c
15395 ++++ b/fs/fs-writeback.c
15396 +@@ -834,6 +834,12 @@ static long wb_check_old_data_flush(struct bdi_writeback *wb)
15397 + unsigned long expired;
15398 + long nr_pages;
15399 +
15400 ++ /*
15401 ++ * When set to zero, disable periodic writeback
15402 ++ */
15403 ++ if (!dirty_writeback_interval)
15404 ++ return 0;
15405 ++
15406 + expired = wb->last_old_flush +
15407 + msecs_to_jiffies(dirty_writeback_interval * 10);
15408 + if (time_before(jiffies, expired))
15409 +@@ -929,8 +935,12 @@ int bdi_writeback_task(struct bdi_writeback *wb)
15410 + break;
15411 + }
15412 +
15413 +- wait_jiffies = msecs_to_jiffies(dirty_writeback_interval * 10);
15414 +- schedule_timeout_interruptible(wait_jiffies);
15415 ++ if (dirty_writeback_interval) {
15416 ++ wait_jiffies = msecs_to_jiffies(dirty_writeback_interval * 10);
15417 ++ schedule_timeout_interruptible(wait_jiffies);
15418 ++ } else
15419 ++ schedule();
15420 ++
15421 + try_to_freeze();
15422 + }
15423 +
15424 +diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
15425 +index e6dd2ae..b20bfcc 100644
15426 +--- a/fs/gfs2/file.c
15427 ++++ b/fs/gfs2/file.c
15428 +@@ -218,6 +218,11 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
15429 + if (error)
15430 + goto out_drop_write;
15431 +
15432 ++ error = -EACCES;
15433 ++ if (!is_owner_or_cap(inode))
15434 ++ goto out;
15435 ++
15436 ++ error = 0;
15437 + flags = ip->i_diskflags;
15438 + new_flags = (flags & ~mask) | (reqflags & mask);
15439 + if ((new_flags ^ flags) == 0)
15440 +@@ -275,8 +280,10 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
15441 + {
15442 + struct inode *inode = filp->f_path.dentry->d_inode;
15443 + u32 fsflags, gfsflags;
15444 ++
15445 + if (get_user(fsflags, ptr))
15446 + return -EFAULT;
15447 ++
15448 + gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags);
15449 + if (!S_ISDIR(inode->i_mode)) {
15450 + if (gfsflags & GFS2_DIF_INHERIT_JDATA)
15451 +diff --git a/fs/libfs.c b/fs/libfs.c
15452 +index 6e8d17e..9e0fc76 100644
15453 +--- a/fs/libfs.c
15454 ++++ b/fs/libfs.c
15455 +@@ -415,7 +415,8 @@ int simple_write_end(struct file *file, struct address_space *mapping,
15456 + * unique inode values later for this filesystem, then you must take care
15457 + * to pass it an appropriate max_reserved value to avoid collisions.
15458 + */
15459 +-int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files)
15460 ++int simple_fill_super(struct super_block *s, unsigned long magic,
15461 ++ struct tree_descr *files)
15462 + {
15463 + struct inode *inode;
15464 + struct dentry *root;
15465 +diff --git a/fs/namespace.c b/fs/namespace.c
15466 +index c768f73..bf6b6fe 100644
15467 +--- a/fs/namespace.c
15468 ++++ b/fs/namespace.c
15469 +@@ -1121,8 +1121,15 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
15470 + {
15471 + struct path path;
15472 + int retval;
15473 ++ int lookup_flags = 0;
15474 +
15475 +- retval = user_path(name, &path);
15476 ++ if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))
15477 ++ return -EINVAL;
15478 ++
15479 ++ if (!(flags & UMOUNT_NOFOLLOW))
15480 ++ lookup_flags |= LOOKUP_FOLLOW;
15481 ++
15482 ++ retval = user_path_at(AT_FDCWD, name, lookup_flags, &path);
15483 + if (retval)
15484 + goto out;
15485 + retval = -EINVAL;
15486 +diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
15487 +index 171699e..06b2a26 100644
15488 +--- a/fs/nfsd/nfssvc.c
15489 ++++ b/fs/nfsd/nfssvc.c
15490 +@@ -120,7 +120,7 @@ u32 nfsd_supported_minorversion;
15491 + int nfsd_vers(int vers, enum vers_op change)
15492 + {
15493 + if (vers < NFSD_MINVERS || vers >= NFSD_NRVERS)
15494 +- return -1;
15495 ++ return 0;
15496 + switch(change) {
15497 + case NFSD_SET:
15498 + nfsd_versions[vers] = nfsd_version[vers];
15499 +diff --git a/include/linux/fs.h b/include/linux/fs.h
15500 +index 66b0705..899a4d6 100644
15501 +--- a/include/linux/fs.h
15502 ++++ b/include/linux/fs.h
15503 +@@ -1308,6 +1308,8 @@ extern int send_sigurg(struct fown_struct *fown);
15504 + #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
15505 + #define MNT_DETACH 0x00000002 /* Just detach from the tree */
15506 + #define MNT_EXPIRE 0x00000004 /* Mark for expiry */
15507 ++#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */
15508 ++#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */
15509 +
15510 + extern struct list_head super_blocks;
15511 + extern spinlock_t sb_lock;
15512 +@@ -2359,7 +2361,7 @@ extern const struct file_operations simple_dir_operations;
15513 + extern const struct inode_operations simple_dir_inode_operations;
15514 + struct tree_descr { char *name; const struct file_operations *ops; int mode; };
15515 + struct dentry *d_alloc_name(struct dentry *, const char *);
15516 +-extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
15517 ++extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *);
15518 + extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
15519 + extern void simple_release_fs(struct vfsmount **mount, int *count);
15520 +
15521 +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
15522 +index 0be8243..be29806 100644
15523 +--- a/include/linux/pci_ids.h
15524 ++++ b/include/linux/pci_ids.h
15525 +@@ -2322,6 +2322,7 @@
15526 + #define PCI_VENDOR_ID_JMICRON 0x197B
15527 + #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
15528 + #define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
15529 ++#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362
15530 + #define PCI_DEVICE_ID_JMICRON_JMB363 0x2363
15531 + #define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
15532 + #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
15533 +diff --git a/include/linux/swap.h b/include/linux/swap.h
15534 +index a2602a8..d8029c2 100644
15535 +--- a/include/linux/swap.h
15536 ++++ b/include/linux/swap.h
15537 +@@ -223,21 +223,11 @@ static inline void lru_cache_add_anon(struct page *page)
15538 + __lru_cache_add(page, LRU_INACTIVE_ANON);
15539 + }
15540 +
15541 +-static inline void lru_cache_add_active_anon(struct page *page)
15542 +-{
15543 +- __lru_cache_add(page, LRU_ACTIVE_ANON);
15544 +-}
15545 +-
15546 + static inline void lru_cache_add_file(struct page *page)
15547 + {
15548 + __lru_cache_add(page, LRU_INACTIVE_FILE);
15549 + }
15550 +
15551 +-static inline void lru_cache_add_active_file(struct page *page)
15552 +-{
15553 +- __lru_cache_add(page, LRU_ACTIVE_FILE);
15554 +-}
15555 +-
15556 + /* linux/mm/vmscan.c */
15557 + extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
15558 + gfp_t gfp_mask, nodemask_t *mask);
15559 +diff --git a/include/linux/tboot.h b/include/linux/tboot.h
15560 +index bf2a0c7..1dba6ee 100644
15561 +--- a/include/linux/tboot.h
15562 ++++ b/include/linux/tboot.h
15563 +@@ -150,6 +150,7 @@ extern int tboot_force_iommu(void);
15564 +
15565 + #else
15566 +
15567 ++#define tboot_enabled() 0
15568 + #define tboot_probe() do { } while (0)
15569 + #define tboot_shutdown(shutdown_type) do { } while (0)
15570 + #define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
15571 +diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
15572 +index ff30177..597f8e2 100644
15573 +--- a/include/net/sctp/structs.h
15574 ++++ b/include/net/sctp/structs.h
15575 +@@ -778,6 +778,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,
15576 + struct iovec *data);
15577 + void sctp_chunk_free(struct sctp_chunk *);
15578 + void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
15579 ++void *sctp_addto_chunk_fixed(struct sctp_chunk *, int len, const void *data);
15580 + struct sctp_chunk *sctp_chunkify(struct sk_buff *,
15581 + const struct sctp_association *,
15582 + struct sock *);
15583 +diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
15584 +index a510b75..32c0697 100644
15585 +--- a/include/trace/events/signal.h
15586 ++++ b/include/trace/events/signal.h
15587 +@@ -10,7 +10,8 @@
15588 +
15589 + #define TP_STORE_SIGINFO(__entry, info) \
15590 + do { \
15591 +- if (info == SEND_SIG_NOINFO) { \
15592 ++ if (info == SEND_SIG_NOINFO || \
15593 ++ info == SEND_SIG_FORCED) { \
15594 + __entry->errno = 0; \
15595 + __entry->code = SI_USER; \
15596 + } else if (info == SEND_SIG_PRIV) { \
15597 +diff --git a/kernel/compat.c b/kernel/compat.c
15598 +index f6c204f..180d188 100644
15599 +--- a/kernel/compat.c
15600 ++++ b/kernel/compat.c
15601 +@@ -494,29 +494,26 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
15602 + {
15603 + int ret;
15604 + cpumask_var_t mask;
15605 +- unsigned long *k;
15606 +- unsigned int min_length = cpumask_size();
15607 +-
15608 +- if (nr_cpu_ids <= BITS_PER_COMPAT_LONG)
15609 +- min_length = sizeof(compat_ulong_t);
15610 +
15611 +- if (len < min_length)
15612 ++ if ((len * BITS_PER_BYTE) < nr_cpu_ids)
15613 ++ return -EINVAL;
15614 ++ if (len & (sizeof(compat_ulong_t)-1))
15615 + return -EINVAL;
15616 +
15617 + if (!alloc_cpumask_var(&mask, GFP_KERNEL))
15618 + return -ENOMEM;
15619 +
15620 + ret = sched_getaffinity(pid, mask);
15621 +- if (ret < 0)
15622 +- goto out;
15623 ++ if (ret == 0) {
15624 ++ size_t retlen = min_t(size_t, len, cpumask_size());
15625 +
15626 +- k = cpumask_bits(mask);
15627 +- ret = compat_put_bitmap(user_mask_ptr, k, min_length * 8);
15628 +- if (ret == 0)
15629 +- ret = min_length;
15630 +-
15631 +-out:
15632 ++ if (compat_put_bitmap(user_mask_ptr, cpumask_bits(mask), retlen * 8))
15633 ++ ret = -EFAULT;
15634 ++ else
15635 ++ ret = retlen;
15636 ++ }
15637 + free_cpumask_var(mask);
15638 ++
15639 + return ret;
15640 + }
15641 +
15642 +diff --git a/kernel/mutex.c b/kernel/mutex.c
15643 +index 632f04c..4c0b7b3 100644
15644 +--- a/kernel/mutex.c
15645 ++++ b/kernel/mutex.c
15646 +@@ -172,6 +172,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
15647 + struct thread_info *owner;
15648 +
15649 + /*
15650 ++ * If we own the BKL, then don't spin. The owner of
15651 ++ * the mutex might be waiting on us to release the BKL.
15652 ++ */
15653 ++ if (unlikely(current->lock_depth >= 0))
15654 ++ break;
15655 ++
15656 ++ /*
15657 + * If there's an owner, wait for it to either
15658 + * release the lock or go to sleep.
15659 + */
15660 +diff --git a/kernel/perf_event.c b/kernel/perf_event.c
15661 +index e928e1a..fbbe79b 100644
15662 +--- a/kernel/perf_event.c
15663 ++++ b/kernel/perf_event.c
15664 +@@ -1417,13 +1417,16 @@ do { \
15665 + divisor = nsec * frequency;
15666 + }
15667 +
15668 ++ if (!divisor)
15669 ++ return dividend;
15670 ++
15671 + return div64_u64(dividend, divisor);
15672 + }
15673 +
15674 + static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
15675 + {
15676 + struct hw_perf_event *hwc = &event->hw;
15677 +- u64 period, sample_period;
15678 ++ s64 period, sample_period;
15679 + s64 delta;
15680 +
15681 + period = perf_calculate_period(event, nsec, count);
15682 +@@ -4712,8 +4715,8 @@ SYSCALL_DEFINE5(perf_event_open,
15683 + struct perf_event_context *ctx;
15684 + struct file *event_file = NULL;
15685 + struct file *group_file = NULL;
15686 ++ int event_fd;
15687 + int fput_needed = 0;
15688 +- int fput_needed2 = 0;
15689 + int err;
15690 +
15691 + /* for future expandability... */
15692 +@@ -4734,12 +4737,18 @@ SYSCALL_DEFINE5(perf_event_open,
15693 + return -EINVAL;
15694 + }
15695 +
15696 ++ event_fd = get_unused_fd_flags(O_RDWR);
15697 ++ if (event_fd < 0)
15698 ++ return event_fd;
15699 ++
15700 + /*
15701 + * Get the target context (task or percpu):
15702 + */
15703 + ctx = find_get_context(pid, cpu);
15704 +- if (IS_ERR(ctx))
15705 +- return PTR_ERR(ctx);
15706 ++ if (IS_ERR(ctx)) {
15707 ++ err = PTR_ERR(ctx);
15708 ++ goto err_fd;
15709 ++ }
15710 +
15711 + /*
15712 + * Look up the group leader (we will attach this event to it):
15713 +@@ -4779,13 +4788,11 @@ SYSCALL_DEFINE5(perf_event_open,
15714 + if (IS_ERR(event))
15715 + goto err_put_context;
15716 +
15717 +- err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR);
15718 +- if (err < 0)
15719 +- goto err_free_put_context;
15720 +-
15721 +- event_file = fget_light(err, &fput_needed2);
15722 +- if (!event_file)
15723 ++ event_file = anon_inode_getfile("[perf_event]", &perf_fops, event, O_RDWR);
15724 ++ if (IS_ERR(event_file)) {
15725 ++ err = PTR_ERR(event_file);
15726 + goto err_free_put_context;
15727 ++ }
15728 +
15729 + if (flags & PERF_FLAG_FD_OUTPUT) {
15730 + err = perf_event_set_output(event, group_fd);
15731 +@@ -4806,19 +4813,19 @@ SYSCALL_DEFINE5(perf_event_open,
15732 + list_add_tail(&event->owner_entry, &current->perf_event_list);
15733 + mutex_unlock(&current->perf_event_mutex);
15734 +
15735 +-err_fput_free_put_context:
15736 +- fput_light(event_file, fput_needed2);
15737 ++ fput_light(group_file, fput_needed);
15738 ++ fd_install(event_fd, event_file);
15739 ++ return event_fd;
15740 +
15741 ++err_fput_free_put_context:
15742 ++ fput(event_file);
15743 + err_free_put_context:
15744 +- if (err < 0)
15745 +- free_event(event);
15746 +-
15747 ++ free_event(event);
15748 + err_put_context:
15749 +- if (err < 0)
15750 +- put_ctx(ctx);
15751 +-
15752 + fput_light(group_file, fput_needed);
15753 +-
15754 ++ put_ctx(ctx);
15755 ++err_fd:
15756 ++ put_unused_fd(event_fd);
15757 + return err;
15758 + }
15759 +
15760 +diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
15761 +index 4954407..5e76d22 100644
15762 +--- a/kernel/posix-timers.c
15763 ++++ b/kernel/posix-timers.c
15764 +@@ -559,14 +559,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
15765 + new_timer->it_id = (timer_t) new_timer_id;
15766 + new_timer->it_clock = which_clock;
15767 + new_timer->it_overrun = -1;
15768 +- error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));
15769 +- if (error)
15770 +- goto out;
15771 +
15772 +- /*
15773 +- * return the timer_id now. The next step is hard to
15774 +- * back out if there is an error.
15775 +- */
15776 + if (copy_to_user(created_timer_id,
15777 + &new_timer_id, sizeof (new_timer_id))) {
15778 + error = -EFAULT;
15779 +@@ -597,6 +590,10 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
15780 + new_timer->sigq->info.si_tid = new_timer->it_id;
15781 + new_timer->sigq->info.si_code = SI_TIMER;
15782 +
15783 ++ error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));
15784 ++ if (error)
15785 ++ goto out;
15786 ++
15787 + spin_lock_irq(&current->sighand->siglock);
15788 + new_timer->it_signal = current->signal;
15789 + list_add(&new_timer->list, &current->signal->posix_timers);
15790 +diff --git a/kernel/signal.c b/kernel/signal.c
15791 +index 934ae5e..6ca731b 100644
15792 +--- a/kernel/signal.c
15793 ++++ b/kernel/signal.c
15794 +@@ -625,7 +625,7 @@ static inline bool si_fromuser(const struct siginfo *info)
15795 + static int check_kill_permission(int sig, struct siginfo *info,
15796 + struct task_struct *t)
15797 + {
15798 +- const struct cred *cred = current_cred(), *tcred;
15799 ++ const struct cred *cred, *tcred;
15800 + struct pid *sid;
15801 + int error;
15802 +
15803 +@@ -639,8 +639,10 @@ static int check_kill_permission(int sig, struct siginfo *info,
15804 + if (error)
15805 + return error;
15806 +
15807 ++ cred = current_cred();
15808 + tcred = __task_cred(t);
15809 +- if ((cred->euid ^ tcred->suid) &&
15810 ++ if (!same_thread_group(current, t) &&
15811 ++ (cred->euid ^ tcred->suid) &&
15812 + (cred->euid ^ tcred->uid) &&
15813 + (cred->uid ^ tcred->suid) &&
15814 + (cred->uid ^ tcred->uid) &&
15815 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
15816 +index 45cfb6d..7d12c17 100644
15817 +--- a/kernel/trace/trace.c
15818 ++++ b/kernel/trace/trace.c
15819 +@@ -32,6 +32,7 @@
15820 + #include <linux/splice.h>
15821 + #include <linux/kdebug.h>
15822 + #include <linux/string.h>
15823 ++#include <linux/rwsem.h>
15824 + #include <linux/ctype.h>
15825 + #include <linux/init.h>
15826 + #include <linux/poll.h>
15827 +@@ -102,9 +103,6 @@ static inline void ftrace_enable_cpu(void)
15828 +
15829 + static cpumask_var_t __read_mostly tracing_buffer_mask;
15830 +
15831 +-/* Define which cpu buffers are currently read in trace_pipe */
15832 +-static cpumask_var_t tracing_reader_cpumask;
15833 +-
15834 + #define for_each_tracing_cpu(cpu) \
15835 + for_each_cpu(cpu, tracing_buffer_mask)
15836 +
15837 +@@ -243,12 +241,91 @@ static struct tracer *current_trace __read_mostly;
15838 +
15839 + /*
15840 + * trace_types_lock is used to protect the trace_types list.
15841 +- * This lock is also used to keep user access serialized.
15842 +- * Accesses from userspace will grab this lock while userspace
15843 +- * activities happen inside the kernel.
15844 + */
15845 + static DEFINE_MUTEX(trace_types_lock);
15846 +
15847 ++/*
15848 ++ * serialize the access of the ring buffer
15849 ++ *
15850 ++ * ring buffer serializes readers, but it is low level protection.
15851 ++ * The validity of the events (which returns by ring_buffer_peek() ..etc)
15852 ++ * are not protected by ring buffer.
15853 ++ *
15854 ++ * The content of events may become garbage if we allow other process consumes
15855 ++ * these events concurrently:
15856 ++ * A) the page of the consumed events may become a normal page
15857 ++ * (not reader page) in ring buffer, and this page will be rewrited
15858 ++ * by events producer.
15859 ++ * B) The page of the consumed events may become a page for splice_read,
15860 ++ * and this page will be returned to system.
15861 ++ *
15862 ++ * These primitives allow multi process access to different cpu ring buffer
15863 ++ * concurrently.
15864 ++ *
15865 ++ * These primitives don't distinguish read-only and read-consume access.
15866 ++ * Multi read-only access are also serialized.
15867 ++ */
15868 ++
15869 ++#ifdef CONFIG_SMP
15870 ++static DECLARE_RWSEM(all_cpu_access_lock);
15871 ++static DEFINE_PER_CPU(struct mutex, cpu_access_lock);
15872 ++
15873 ++static inline void trace_access_lock(int cpu)
15874 ++{
15875 ++ if (cpu == TRACE_PIPE_ALL_CPU) {
15876 ++ /* gain it for accessing the whole ring buffer. */
15877 ++ down_write(&all_cpu_access_lock);
15878 ++ } else {
15879 ++ /* gain it for accessing a cpu ring buffer. */
15880 ++
15881 ++ /* Firstly block other trace_access_lock(TRACE_PIPE_ALL_CPU). */
15882 ++ down_read(&all_cpu_access_lock);
15883 ++
15884 ++ /* Secondly block other access to this @cpu ring buffer. */
15885 ++ mutex_lock(&per_cpu(cpu_access_lock, cpu));
15886 ++ }
15887 ++}
15888 ++
15889 ++static inline void trace_access_unlock(int cpu)
15890 ++{
15891 ++ if (cpu == TRACE_PIPE_ALL_CPU) {
15892 ++ up_write(&all_cpu_access_lock);
15893 ++ } else {
15894 ++ mutex_unlock(&per_cpu(cpu_access_lock, cpu));
15895 ++ up_read(&all_cpu_access_lock);
15896 ++ }
15897 ++}
15898 ++
15899 ++static inline void trace_access_lock_init(void)
15900 ++{
15901 ++ int cpu;
15902 ++
15903 ++ for_each_possible_cpu(cpu)
15904 ++ mutex_init(&per_cpu(cpu_access_lock, cpu));
15905 ++}
15906 ++
15907 ++#else
15908 ++
15909 ++static DEFINE_MUTEX(access_lock);
15910 ++
15911 ++static inline void trace_access_lock(int cpu)
15912 ++{
15913 ++ (void)cpu;
15914 ++ mutex_lock(&access_lock);
15915 ++}
15916 ++
15917 ++static inline void trace_access_unlock(int cpu)
15918 ++{
15919 ++ (void)cpu;
15920 ++ mutex_unlock(&access_lock);
15921 ++}
15922 ++
15923 ++static inline void trace_access_lock_init(void)
15924 ++{
15925 ++}
15926 ++
15927 ++#endif
15928 ++
15929 + /* trace_wait is a waitqueue for tasks blocked on trace_poll */
15930 + static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
15931 +
15932 +@@ -1601,12 +1678,6 @@ static void tracing_iter_reset(struct trace_iterator *iter, int cpu)
15933 + }
15934 +
15935 + /*
15936 +- * No necessary locking here. The worst thing which can
15937 +- * happen is loosing events consumed at the same time
15938 +- * by a trace_pipe reader.
15939 +- * Other than that, we don't risk to crash the ring buffer
15940 +- * because it serializes the readers.
15941 +- *
15942 + * The current tracer is copied to avoid a global locking
15943 + * all around.
15944 + */
15945 +@@ -1662,12 +1733,16 @@ static void *s_start(struct seq_file *m, loff_t *pos)
15946 + }
15947 +
15948 + trace_event_read_lock();
15949 ++ trace_access_lock(cpu_file);
15950 + return p;
15951 + }
15952 +
15953 + static void s_stop(struct seq_file *m, void *p)
15954 + {
15955 ++ struct trace_iterator *iter = m->private;
15956 ++
15957 + atomic_dec(&trace_record_cmdline_disabled);
15958 ++ trace_access_unlock(iter->cpu_file);
15959 + trace_event_read_unlock();
15960 + }
15961 +
15962 +@@ -2858,22 +2933,6 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
15963 +
15964 + mutex_lock(&trace_types_lock);
15965 +
15966 +- /* We only allow one reader per cpu */
15967 +- if (cpu_file == TRACE_PIPE_ALL_CPU) {
15968 +- if (!cpumask_empty(tracing_reader_cpumask)) {
15969 +- ret = -EBUSY;
15970 +- goto out;
15971 +- }
15972 +- cpumask_setall(tracing_reader_cpumask);
15973 +- } else {
15974 +- if (!cpumask_test_cpu(cpu_file, tracing_reader_cpumask))
15975 +- cpumask_set_cpu(cpu_file, tracing_reader_cpumask);
15976 +- else {
15977 +- ret = -EBUSY;
15978 +- goto out;
15979 +- }
15980 +- }
15981 +-
15982 + /* create a buffer to store the information to pass to userspace */
15983 + iter = kzalloc(sizeof(*iter), GFP_KERNEL);
15984 + if (!iter) {
15985 +@@ -2929,12 +2988,6 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
15986 +
15987 + mutex_lock(&trace_types_lock);
15988 +
15989 +- if (iter->cpu_file == TRACE_PIPE_ALL_CPU)
15990 +- cpumask_clear(tracing_reader_cpumask);
15991 +- else
15992 +- cpumask_clear_cpu(iter->cpu_file, tracing_reader_cpumask);
15993 +-
15994 +-
15995 + if (iter->trace->pipe_close)
15996 + iter->trace->pipe_close(iter);
15997 +
15998 +@@ -3096,6 +3149,7 @@ waitagain:
15999 + iter->pos = -1;
16000 +
16001 + trace_event_read_lock();
16002 ++ trace_access_lock(iter->cpu_file);
16003 + while (find_next_entry_inc(iter) != NULL) {
16004 + enum print_line_t ret;
16005 + int len = iter->seq.len;
16006 +@@ -3112,6 +3166,7 @@ waitagain:
16007 + if (iter->seq.len >= cnt)
16008 + break;
16009 + }
16010 ++ trace_access_unlock(iter->cpu_file);
16011 + trace_event_read_unlock();
16012 +
16013 + /* Now copy what we have to the user */
16014 +@@ -3237,6 +3292,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
16015 + }
16016 +
16017 + trace_event_read_lock();
16018 ++ trace_access_lock(iter->cpu_file);
16019 +
16020 + /* Fill as many pages as possible. */
16021 + for (i = 0, rem = len; i < PIPE_BUFFERS && rem; i++) {
16022 +@@ -3260,6 +3316,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
16023 + trace_seq_init(&iter->seq);
16024 + }
16025 +
16026 ++ trace_access_unlock(iter->cpu_file);
16027 + trace_event_read_unlock();
16028 + mutex_unlock(&iter->mutex);
16029 +
16030 +@@ -3561,10 +3618,12 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
16031 +
16032 + info->read = 0;
16033 +
16034 ++ trace_access_lock(info->cpu);
16035 + ret = ring_buffer_read_page(info->tr->buffer,
16036 + &info->spare,
16037 + count,
16038 + info->cpu, 0);
16039 ++ trace_access_unlock(info->cpu);
16040 + if (ret < 0)
16041 + return 0;
16042 +
16043 +@@ -3692,6 +3751,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
16044 + len &= PAGE_MASK;
16045 + }
16046 +
16047 ++ trace_access_lock(info->cpu);
16048 + entries = ring_buffer_entries_cpu(info->tr->buffer, info->cpu);
16049 +
16050 + for (i = 0; i < PIPE_BUFFERS && len && entries; i++, len -= PAGE_SIZE) {
16051 +@@ -3739,6 +3799,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
16052 + entries = ring_buffer_entries_cpu(info->tr->buffer, info->cpu);
16053 + }
16054 +
16055 ++ trace_access_unlock(info->cpu);
16056 + spd.nr_pages = i;
16057 +
16058 + /* did we read anything? */
16059 +@@ -4175,6 +4236,8 @@ static __init int tracer_init_debugfs(void)
16060 + struct dentry *d_tracer;
16061 + int cpu;
16062 +
16063 ++ trace_access_lock_init();
16064 ++
16065 + d_tracer = tracing_init_dentry();
16066 +
16067 + trace_create_file("tracing_enabled", 0644, d_tracer,
16068 +@@ -4409,9 +4472,6 @@ __init static int tracer_alloc_buffers(void)
16069 + if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL))
16070 + goto out_free_buffer_mask;
16071 +
16072 +- if (!zalloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL))
16073 +- goto out_free_tracing_cpumask;
16074 +-
16075 + /* To save memory, keep the ring buffer size to its minimum */
16076 + if (ring_buffer_expanded)
16077 + ring_buf_size = trace_buf_size;
16078 +@@ -4469,8 +4529,6 @@ __init static int tracer_alloc_buffers(void)
16079 + return 0;
16080 +
16081 + out_free_cpumask:
16082 +- free_cpumask_var(tracing_reader_cpumask);
16083 +-out_free_tracing_cpumask:
16084 + free_cpumask_var(tracing_cpumask);
16085 + out_free_buffer_mask:
16086 + free_cpumask_var(tracing_buffer_mask);
16087 +diff --git a/mm/filemap.c b/mm/filemap.c
16088 +index 698ea80..96398d3 100644
16089 +--- a/mm/filemap.c
16090 ++++ b/mm/filemap.c
16091 +@@ -441,7 +441,7 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
16092 + /*
16093 + * Splice_read and readahead add shmem/tmpfs pages into the page cache
16094 + * before shmem_readpage has a chance to mark them as SwapBacked: they
16095 +- * need to go on the active_anon lru below, and mem_cgroup_cache_charge
16096 ++ * need to go on the anon lru below, and mem_cgroup_cache_charge
16097 + * (called in add_to_page_cache) needs to know where they're going too.
16098 + */
16099 + if (mapping_cap_swap_backed(mapping))
16100 +@@ -452,7 +452,7 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
16101 + if (page_is_file_cache(page))
16102 + lru_cache_add_file(page);
16103 + else
16104 +- lru_cache_add_active_anon(page);
16105 ++ lru_cache_add_anon(page);
16106 + }
16107 + return ret;
16108 + }
16109 +@@ -1099,6 +1099,12 @@ page_not_up_to_date_locked:
16110 + }
16111 +
16112 + readpage:
16113 ++ /*
16114 ++ * A previous I/O error may have been due to temporary
16115 ++ * failures, eg. multipath errors.
16116 ++ * PG_error will be set again if readpage fails.
16117 ++ */
16118 ++ ClearPageError(page);
16119 + /* Start the actual read. The read will unlock the page. */
16120 + error = mapping->a_ops->readpage(filp, page);
16121 +
16122 +diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
16123 +index a10d508..9f6f8d3 100644
16124 +--- a/net/mac80211/Kconfig
16125 ++++ b/net/mac80211/Kconfig
16126 +@@ -15,8 +15,12 @@ comment "CFG80211 needs to be enabled for MAC80211"
16127 +
16128 + if MAC80211 != n
16129 +
16130 ++config MAC80211_HAS_RC
16131 ++ def_bool n
16132 ++
16133 + config MAC80211_RC_PID
16134 + bool "PID controller based rate control algorithm" if EMBEDDED
16135 ++ select MAC80211_HAS_RC
16136 + ---help---
16137 + This option enables a TX rate control algorithm for
16138 + mac80211 that uses a PID controller to select the TX
16139 +@@ -24,12 +28,14 @@ config MAC80211_RC_PID
16140 +
16141 + config MAC80211_RC_MINSTREL
16142 + bool "Minstrel" if EMBEDDED
16143 ++ select MAC80211_HAS_RC
16144 + default y
16145 + ---help---
16146 + This option enables the 'minstrel' TX rate control algorithm
16147 +
16148 + choice
16149 + prompt "Default rate control algorithm"
16150 ++ depends on MAC80211_HAS_RC
16151 + default MAC80211_RC_DEFAULT_MINSTREL
16152 + ---help---
16153 + This option selects the default rate control algorithm
16154 +@@ -62,6 +68,9 @@ config MAC80211_RC_DEFAULT
16155 +
16156 + endif
16157 +
16158 ++comment "Some wireless drivers require a rate control algorithm"
16159 ++ depends on MAC80211_HAS_RC=n
16160 ++
16161 + config MAC80211_MESH
16162 + bool "Enable mac80211 mesh networking (pre-802.11s) support"
16163 + depends on MAC80211 && EXPERIMENTAL
16164 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
16165 +index 9ae1a47..e2b4345 100644
16166 +--- a/net/mac80211/cfg.c
16167 ++++ b/net/mac80211/cfg.c
16168 +@@ -98,9 +98,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
16169 + params->mesh_id_len,
16170 + params->mesh_id);
16171 +
16172 +- if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
16173 +- return 0;
16174 +-
16175 + if (type == NL80211_IFTYPE_AP_VLAN &&
16176 + params && params->use_4addr == 0)
16177 + rcu_assign_pointer(sdata->u.vlan.sta, NULL);
16178 +@@ -108,7 +105,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
16179 + params && params->use_4addr >= 0)
16180 + sdata->u.mgd.use_4addr = params->use_4addr;
16181 +
16182 +- sdata->u.mntr_flags = *flags;
16183 ++ if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags)
16184 ++ sdata->u.mntr_flags = *flags;
16185 ++
16186 + return 0;
16187 + }
16188 +
16189 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
16190 +index edfa036..48d8fdf 100644
16191 +--- a/net/mac80211/rx.c
16192 ++++ b/net/mac80211/rx.c
16193 +@@ -1399,7 +1399,8 @@ ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
16194 + (rx->key || rx->sdata->drop_unencrypted)))
16195 + return -EACCES;
16196 + if (rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP)) {
16197 +- if (unlikely(ieee80211_is_unicast_robust_mgmt_frame(rx->skb) &&
16198 ++ if (unlikely(!ieee80211_has_protected(fc) &&
16199 ++ ieee80211_is_unicast_robust_mgmt_frame(rx->skb) &&
16200 + rx->key))
16201 + return -EACCES;
16202 + /* BIP does not use Protected field, so need to check MMIE */
16203 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
16204 +index 1fdc0a5..9b50183 100644
16205 +--- a/net/mac80211/tx.c
16206 ++++ b/net/mac80211/tx.c
16207 +@@ -501,7 +501,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
16208 + struct ieee80211_hdr *hdr = (void *)tx->skb->data;
16209 + struct ieee80211_supported_band *sband;
16210 + struct ieee80211_rate *rate;
16211 +- int i, len;
16212 ++ int i;
16213 ++ u32 len;
16214 + bool inval = false, rts = false, short_preamble = false;
16215 + struct ieee80211_tx_rate_control txrc;
16216 + u32 sta_flags;
16217 +@@ -510,7 +511,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
16218 +
16219 + sband = tx->local->hw.wiphy->bands[tx->channel->band];
16220 +
16221 +- len = min_t(int, tx->skb->len + FCS_LEN,
16222 ++ len = min_t(u32, tx->skb->len + FCS_LEN,
16223 + tx->local->hw.wiphy->frag_threshold);
16224 +
16225 + /* set up the tx rate control struct we give the RC algo */
16226 +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
16227 +index 224db01..35fa684 100644
16228 +--- a/net/sctp/sm_make_chunk.c
16229 ++++ b/net/sctp/sm_make_chunk.c
16230 +@@ -107,7 +107,7 @@ static const struct sctp_paramhdr prsctp_param = {
16231 + cpu_to_be16(sizeof(struct sctp_paramhdr)),
16232 + };
16233 +
16234 +-/* A helper to initialize to initialize an op error inside a
16235 ++/* A helper to initialize an op error inside a
16236 + * provided chunk, as most cause codes will be embedded inside an
16237 + * abort chunk.
16238 + */
16239 +@@ -124,6 +124,29 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code,
16240 + chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err);
16241 + }
16242 +
16243 ++/* A helper to initialize an op error inside a
16244 ++ * provided chunk, as most cause codes will be embedded inside an
16245 ++ * abort chunk. Differs from sctp_init_cause in that it won't oops
16246 ++ * if there isn't enough space in the op error chunk
16247 ++ */
16248 ++int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code,
16249 ++ size_t paylen)
16250 ++{
16251 ++ sctp_errhdr_t err;
16252 ++ __u16 len;
16253 ++
16254 ++ /* Cause code constants are now defined in network order. */
16255 ++ err.cause = cause_code;
16256 ++ len = sizeof(sctp_errhdr_t) + paylen;
16257 ++ err.length = htons(len);
16258 ++
16259 ++ if (skb_tailroom(chunk->skb) < len)
16260 ++ return -ENOSPC;
16261 ++ chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk,
16262 ++ sizeof(sctp_errhdr_t),
16263 ++ &err);
16264 ++ return 0;
16265 ++}
16266 + /* 3.3.2 Initiation (INIT) (1)
16267 + *
16268 + * This chunk is used to initiate a SCTP association between two
16269 +@@ -1131,6 +1154,24 @@ nodata:
16270 + return retval;
16271 + }
16272 +
16273 ++/* Create an Operation Error chunk of a fixed size,
16274 ++ * specifically, max(asoc->pathmtu, SCTP_DEFAULT_MAXSEGMENT)
16275 ++ * This is a helper function to allocate an error chunk for
16276 ++ * for those invalid parameter codes in which we may not want
16277 ++ * to report all the errors, if the incomming chunk is large
16278 ++ */
16279 ++static inline struct sctp_chunk *sctp_make_op_error_fixed(
16280 ++ const struct sctp_association *asoc,
16281 ++ const struct sctp_chunk *chunk)
16282 ++{
16283 ++ size_t size = asoc ? asoc->pathmtu : 0;
16284 ++
16285 ++ if (!size)
16286 ++ size = SCTP_DEFAULT_MAXSEGMENT;
16287 ++
16288 ++ return sctp_make_op_error_space(asoc, chunk, size);
16289 ++}
16290 ++
16291 + /* Create an Operation Error chunk. */
16292 + struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc,
16293 + const struct sctp_chunk *chunk,
16294 +@@ -1373,6 +1414,18 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
16295 + return target;
16296 + }
16297 +
16298 ++/* Append bytes to the end of a chunk. Returns NULL if there isn't sufficient
16299 ++ * space in the chunk
16300 ++ */
16301 ++void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk,
16302 ++ int len, const void *data)
16303 ++{
16304 ++ if (skb_tailroom(chunk->skb) >= len)
16305 ++ return sctp_addto_chunk(chunk, len, data);
16306 ++ else
16307 ++ return NULL;
16308 ++}
16309 ++
16310 + /* Append bytes from user space to the end of a chunk. Will panic if
16311 + * chunk is not big enough.
16312 + * Returns a kernel err value.
16313 +@@ -1976,13 +2029,12 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,
16314 + * returning multiple unknown parameters.
16315 + */
16316 + if (NULL == *errp)
16317 +- *errp = sctp_make_op_error_space(asoc, chunk,
16318 +- ntohs(chunk->chunk_hdr->length));
16319 ++ *errp = sctp_make_op_error_fixed(asoc, chunk);
16320 +
16321 + if (*errp) {
16322 +- sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM,
16323 ++ sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM,
16324 + WORD_ROUND(ntohs(param.p->length)));
16325 +- sctp_addto_chunk(*errp,
16326 ++ sctp_addto_chunk_fixed(*errp,
16327 + WORD_ROUND(ntohs(param.p->length)),
16328 + param.v);
16329 + } else {
16330 +diff --git a/net/wireless/core.h b/net/wireless/core.h
16331 +index 4ef3efc..35b7121 100644
16332 +--- a/net/wireless/core.h
16333 ++++ b/net/wireless/core.h
16334 +@@ -378,6 +378,8 @@ int rdev_set_freq(struct cfg80211_registered_device *rdev,
16335 + struct wireless_dev *for_wdev,
16336 + int freq, enum nl80211_channel_type channel_type);
16337 +
16338 ++u16 cfg80211_calculate_bitrate(struct rate_info *rate);
16339 ++
16340 + #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS
16341 + #define CFG80211_DEV_WARN_ON(cond) WARN_ON(cond)
16342 + #else
16343 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
16344 +index a602843..7cb0d64 100644
16345 +--- a/net/wireless/nl80211.c
16346 ++++ b/net/wireless/nl80211.c
16347 +@@ -1637,39 +1637,6 @@ static int parse_station_flags(struct genl_info *info,
16348 + return 0;
16349 + }
16350 +
16351 +-static u16 nl80211_calculate_bitrate(struct rate_info *rate)
16352 +-{
16353 +- int modulation, streams, bitrate;
16354 +-
16355 +- if (!(rate->flags & RATE_INFO_FLAGS_MCS))
16356 +- return rate->legacy;
16357 +-
16358 +- /* the formula below does only work for MCS values smaller than 32 */
16359 +- if (rate->mcs >= 32)
16360 +- return 0;
16361 +-
16362 +- modulation = rate->mcs & 7;
16363 +- streams = (rate->mcs >> 3) + 1;
16364 +-
16365 +- bitrate = (rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) ?
16366 +- 13500000 : 6500000;
16367 +-
16368 +- if (modulation < 4)
16369 +- bitrate *= (modulation + 1);
16370 +- else if (modulation == 4)
16371 +- bitrate *= (modulation + 2);
16372 +- else
16373 +- bitrate *= (modulation + 3);
16374 +-
16375 +- bitrate *= streams;
16376 +-
16377 +- if (rate->flags & RATE_INFO_FLAGS_SHORT_GI)
16378 +- bitrate = (bitrate / 9) * 10;
16379 +-
16380 +- /* do NOT round down here */
16381 +- return (bitrate + 50000) / 100000;
16382 +-}
16383 +-
16384 + static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
16385 + int flags, struct net_device *dev,
16386 + u8 *mac_addr, struct station_info *sinfo)
16387 +@@ -1716,8 +1683,8 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
16388 + if (!txrate)
16389 + goto nla_put_failure;
16390 +
16391 +- /* nl80211_calculate_bitrate will return 0 for mcs >= 32 */
16392 +- bitrate = nl80211_calculate_bitrate(&sinfo->txrate);
16393 ++ /* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */
16394 ++ bitrate = cfg80211_calculate_bitrate(&sinfo->txrate);
16395 + if (bitrate > 0)
16396 + NLA_PUT_U16(msg, NL80211_RATE_INFO_BITRATE, bitrate);
16397 +
16398 +diff --git a/net/wireless/util.c b/net/wireless/util.c
16399 +index 59361fd..a3c841a 100644
16400 +--- a/net/wireless/util.c
16401 ++++ b/net/wireless/util.c
16402 +@@ -720,3 +720,36 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
16403 +
16404 + return err;
16405 + }
16406 ++
16407 ++u16 cfg80211_calculate_bitrate(struct rate_info *rate)
16408 ++{
16409 ++ int modulation, streams, bitrate;
16410 ++
16411 ++ if (!(rate->flags & RATE_INFO_FLAGS_MCS))
16412 ++ return rate->legacy;
16413 ++
16414 ++ /* the formula below does only work for MCS values smaller than 32 */
16415 ++ if (rate->mcs >= 32)
16416 ++ return 0;
16417 ++
16418 ++ modulation = rate->mcs & 7;
16419 ++ streams = (rate->mcs >> 3) + 1;
16420 ++
16421 ++ bitrate = (rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) ?
16422 ++ 13500000 : 6500000;
16423 ++
16424 ++ if (modulation < 4)
16425 ++ bitrate *= (modulation + 1);
16426 ++ else if (modulation == 4)
16427 ++ bitrate *= (modulation + 2);
16428 ++ else
16429 ++ bitrate *= (modulation + 3);
16430 ++
16431 ++ bitrate *= streams;
16432 ++
16433 ++ if (rate->flags & RATE_INFO_FLAGS_SHORT_GI)
16434 ++ bitrate = (bitrate / 9) * 10;
16435 ++
16436 ++ /* do NOT round down here */
16437 ++ return (bitrate + 50000) / 100000;
16438 ++}
16439 +diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
16440 +index 54face3..4198243 100644
16441 +--- a/net/wireless/wext-compat.c
16442 ++++ b/net/wireless/wext-compat.c
16443 +@@ -1257,10 +1257,7 @@ int cfg80211_wext_giwrate(struct net_device *dev,
16444 + if (!(sinfo.filled & STATION_INFO_TX_BITRATE))
16445 + return -EOPNOTSUPP;
16446 +
16447 +- rate->value = 0;
16448 +-
16449 +- if (!(sinfo.txrate.flags & RATE_INFO_FLAGS_MCS))
16450 +- rate->value = 100000 * sinfo.txrate.legacy;
16451 ++ rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
16452 +
16453 + return 0;
16454 + }
16455 +diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
16456 +index 999e8a7..25a5183 100644
16457 +--- a/scripts/kconfig/Makefile
16458 ++++ b/scripts/kconfig/Makefile
16459 +@@ -198,7 +198,7 @@ HOSTCFLAGS_zconf.tab.o := -I$(src)
16460 + HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
16461 + HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
16462 +
16463 +-HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
16464 ++HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
16465 + HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
16466 + -D LKC_DIRECT_LINK
16467 +
16468 +diff --git a/security/keys/keyring.c b/security/keys/keyring.c
16469 +index 8ec0274..e031952 100644
16470 +--- a/security/keys/keyring.c
16471 ++++ b/security/keys/keyring.c
16472 +@@ -524,9 +524,8 @@ struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
16473 + struct key *keyring;
16474 + int bucket;
16475 +
16476 +- keyring = ERR_PTR(-EINVAL);
16477 + if (!name)
16478 +- goto error;
16479 ++ return ERR_PTR(-EINVAL);
16480 +
16481 + bucket = keyring_hash(name);
16482 +
16483 +@@ -553,17 +552,18 @@ struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
16484 + KEY_SEARCH) < 0)
16485 + continue;
16486 +
16487 +- /* we've got a match */
16488 +- atomic_inc(&keyring->usage);
16489 +- read_unlock(&keyring_name_lock);
16490 +- goto error;
16491 ++ /* we've got a match but we might end up racing with
16492 ++ * key_cleanup() if the keyring is currently 'dead'
16493 ++ * (ie. it has a zero usage count) */
16494 ++ if (!atomic_inc_not_zero(&keyring->usage))
16495 ++ continue;
16496 ++ goto out;
16497 + }
16498 + }
16499 +
16500 +- read_unlock(&keyring_name_lock);
16501 + keyring = ERR_PTR(-ENOKEY);
16502 +-
16503 +- error:
16504 ++out:
16505 ++ read_unlock(&keyring_name_lock);
16506 + return keyring;
16507 +
16508 + } /* end find_keyring_by_name() */
16509 +diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
16510 +index 5c23afb..931cfda 100644
16511 +--- a/security/keys/process_keys.c
16512 ++++ b/security/keys/process_keys.c
16513 +@@ -509,7 +509,7 @@ try_again:
16514 +
16515 + ret = install_thread_keyring();
16516 + if (ret < 0) {
16517 +- key = ERR_PTR(ret);
16518 ++ key_ref = ERR_PTR(ret);
16519 + goto error;
16520 + }
16521 + goto reget_creds;
16522 +@@ -527,7 +527,7 @@ try_again:
16523 +
16524 + ret = install_process_keyring();
16525 + if (ret < 0) {
16526 +- key = ERR_PTR(ret);
16527 ++ key_ref = ERR_PTR(ret);
16528 + goto error;
16529 + }
16530 + goto reget_creds;
16531 +@@ -586,7 +586,7 @@ try_again:
16532 +
16533 + case KEY_SPEC_GROUP_KEYRING:
16534 + /* group keyrings are not yet supported */
16535 +- key = ERR_PTR(-EINVAL);
16536 ++ key_ref = ERR_PTR(-EINVAL);
16537 + goto error;
16538 +
16539 + case KEY_SPEC_REQKEY_AUTH_KEY:
16540 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
16541 +index a747871..0dc3418 100644
16542 +--- a/sound/pci/hda/hda_intel.c
16543 ++++ b/sound/pci/hda/hda_intel.c
16544 +@@ -2263,16 +2263,23 @@ static int azx_dev_free(struct snd_device *device)
16545 + * white/black-listing for position_fix
16546 + */
16547 + static struct snd_pci_quirk position_fix_list[] __devinitdata = {
16548 ++ SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB),
16549 + SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
16550 + SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
16551 + SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
16552 + SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
16553 +- SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
16554 + SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
16555 ++ SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
16556 ++ SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
16557 ++ SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
16558 ++ SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
16559 ++ SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),
16560 ++ SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
16561 + SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
16562 + SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
16563 + SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB),
16564 + SND_PCI_QUIRK(0x1565, 0x8218, "Biostar Microtech", POS_FIX_LPIB),
16565 ++ SND_PCI_QUIRK(0x1849, 0x0888, "775Dual-VSTA", POS_FIX_LPIB),
16566 + SND_PCI_QUIRK(0x8086, 0x2503, "DG965OT AAD63733-203", POS_FIX_LPIB),
16567 + SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB),
16568 + {}
16569 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
16570 +index abfc558..187a467 100644
16571 +--- a/sound/pci/hda/patch_realtek.c
16572 ++++ b/sound/pci/hda/patch_realtek.c
16573 +@@ -9116,6 +9116,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
16574 + SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
16575 + SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
16576 + SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
16577 ++ SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
16578 + SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
16579 + SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
16580 + SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
16581 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
16582 +index cb474c0..256ad3a 100644
16583 +--- a/sound/pci/hda/patch_sigmatel.c
16584 ++++ b/sound/pci/hda/patch_sigmatel.c
16585 +@@ -2070,12 +2070,12 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
16586 + SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
16587 + "Intel D965", STAC_D965_3ST),
16588 + /* Dell 3 stack systems */
16589 +- SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST),
16590 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
16591 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
16592 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
16593 + /* Dell 3 stack systems with verb table in BIOS */
16594 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
16595 ++ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
16596 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
16597 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
16598 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
16599 +diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
16600 +index 718ef91..b1be92a 100644
16601 +--- a/sound/soc/codecs/wm8350.c
16602 ++++ b/sound/soc/codecs/wm8350.c
16603 +@@ -423,8 +423,8 @@ static const struct soc_enum wm8350_enum[] = {
16604 + SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME, 15, 2, wm8350_lr),
16605 + };
16606 +
16607 +-static DECLARE_TLV_DB_LINEAR(pre_amp_tlv, -1200, 3525);
16608 +-static DECLARE_TLV_DB_LINEAR(out_pga_tlv, -5700, 600);
16609 ++static DECLARE_TLV_DB_SCALE(pre_amp_tlv, -1200, 3525, 0);
16610 ++static DECLARE_TLV_DB_SCALE(out_pga_tlv, -5700, 600, 0);
16611 + static DECLARE_TLV_DB_SCALE(dac_pcm_tlv, -7163, 36, 1);
16612 + static DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -12700, 50, 1);
16613 + static DECLARE_TLV_DB_SCALE(out_mix_tlv, -1500, 300, 1);
16614 +diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
16615 +index b432f4d..6390ffe 100644
16616 +--- a/sound/soc/codecs/wm8400.c
16617 ++++ b/sound/soc/codecs/wm8400.c
16618 +@@ -106,21 +106,21 @@ static void wm8400_codec_reset(struct snd_soc_codec *codec)
16619 + wm8400_reset_codec_reg_cache(wm8400->wm8400);
16620 + }
16621 +
16622 +-static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600);
16623 ++static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0);
16624 +
16625 +-static const DECLARE_TLV_DB_LINEAR(in_pga_tlv, -1650, 3000);
16626 ++static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);
16627 +
16628 +-static const DECLARE_TLV_DB_LINEAR(out_mix_tlv, -2100, 0);
16629 ++static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -2100, 0, 0);
16630 +
16631 +-static const DECLARE_TLV_DB_LINEAR(out_pga_tlv, -7300, 600);
16632 ++static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);
16633 +
16634 +-static const DECLARE_TLV_DB_LINEAR(out_omix_tlv, -600, 0);
16635 ++static const DECLARE_TLV_DB_SCALE(out_omix_tlv, -600, 0, 0);
16636 +
16637 +-static const DECLARE_TLV_DB_LINEAR(out_dac_tlv, -7163, 0);
16638 ++static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);
16639 +
16640 +-static const DECLARE_TLV_DB_LINEAR(in_adc_tlv, -7163, 1763);
16641 ++static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);
16642 +
16643 +-static const DECLARE_TLV_DB_LINEAR(out_sidetone_tlv, -3600, 0);
16644 ++static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
16645 +
16646 + static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
16647 + struct snd_ctl_elem_value *ucontrol)
16648 +@@ -439,7 +439,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
16649 + /* INMIX dB values */
16650 + static const unsigned int in_mix_tlv[] = {
16651 + TLV_DB_RANGE_HEAD(1),
16652 +- 0,7, TLV_DB_LINEAR_ITEM(-1200, 600),
16653 ++ 0,7, TLV_DB_SCALE_ITEM(-1200, 600, 0),
16654 + };
16655 +
16656 + /* Left In PGA Connections */
16657 +diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
16658 +index 341481e..2f76f4d 100644
16659 +--- a/sound/soc/codecs/wm8990.c
16660 ++++ b/sound/soc/codecs/wm8990.c
16661 +@@ -110,21 +110,21 @@ static const u16 wm8990_reg[] = {
16662 +
16663 + #define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0)
16664 +
16665 +-static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -1500, 600);
16666 ++static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0);
16667 +
16668 +-static const DECLARE_TLV_DB_LINEAR(in_pga_tlv, -1650, 3000);
16669 ++static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);
16670 +
16671 +-static const DECLARE_TLV_DB_LINEAR(out_mix_tlv, 0, -2100);
16672 ++static const DECLARE_TLV_DB_SCALE(out_mix_tlv, 0, -2100, 0);
16673 +
16674 +-static const DECLARE_TLV_DB_LINEAR(out_pga_tlv, -7300, 600);
16675 ++static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);
16676 +
16677 +-static const DECLARE_TLV_DB_LINEAR(out_omix_tlv, -600, 0);
16678 ++static const DECLARE_TLV_DB_SCALE(out_omix_tlv, -600, 0, 0);
16679 +
16680 +-static const DECLARE_TLV_DB_LINEAR(out_dac_tlv, -7163, 0);
16681 ++static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);
16682 +
16683 +-static const DECLARE_TLV_DB_LINEAR(in_adc_tlv, -7163, 1763);
16684 ++static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);
16685 +
16686 +-static const DECLARE_TLV_DB_LINEAR(out_sidetone_tlv, -3600, 0);
16687 ++static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
16688 +
16689 + static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
16690 + struct snd_ctl_elem_value *ucontrol)
16691 +@@ -450,7 +450,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
16692 + /* INMIX dB values */
16693 + static const unsigned int in_mix_tlv[] = {
16694 + TLV_DB_RANGE_HEAD(1),
16695 +- 0, 7, TLV_DB_LINEAR_ITEM(-1200, 600),
16696 ++ 0, 7, TLV_DB_SCALE_ITEM(-1200, 600, 0),
16697 + };
16698 +
16699 + /* Left In PGA Connections */