Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1770 - genpatches-2.6/trunk/2.6.34
Date: Tue, 31 Aug 2010 14:11:58
Message-Id: 20100831141147.5D91420051@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2010-08-31 14:11:46 +0000 (Tue, 31 Aug 2010)
3 New Revision: 1770
4
5 Added:
6 genpatches-2.6/trunk/2.6.34/1005_linux-2.6.34.6.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.34/0000_README
9 Log:
10 Linux patch 2.6.34.6
11
12 Modified: genpatches-2.6/trunk/2.6.34/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.34/0000_README 2010-08-27 22:01:15 UTC (rev 1769)
15 +++ genpatches-2.6/trunk/2.6.34/0000_README 2010-08-31 14:11:46 UTC (rev 1770)
16 @@ -59,6 +59,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 2.6.34.5
19
20 +Patch: 1005_linux-2.6.34.6.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 2.6.34.6
23 +
24 Patch: 2600_synaptic-cap-ID-check-fix.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=328527
26 Desc: Synaptics capability ID check fix
27
28 Added: genpatches-2.6/trunk/2.6.34/1005_linux-2.6.34.6.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.34/1005_linux-2.6.34.6.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.34/1005_linux-2.6.34.6.patch 2010-08-31 14:11:46 UTC (rev 1770)
32 @@ -0,0 +1,3033 @@
33 +diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
34 +index 9dcb11e..bf62c44 100644
35 +--- a/arch/arm/include/asm/ptrace.h
36 ++++ b/arch/arm/include/asm/ptrace.h
37 +@@ -158,15 +158,24 @@ struct pt_regs {
38 + */
39 + static inline int valid_user_regs(struct pt_regs *regs)
40 + {
41 +- if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) {
42 +- regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
43 +- return 1;
44 ++ unsigned long mode = regs->ARM_cpsr & MODE_MASK;
45 ++
46 ++ /*
47 ++ * Always clear the F (FIQ) and A (delayed abort) bits
48 ++ */
49 ++ regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT);
50 ++
51 ++ if ((regs->ARM_cpsr & PSR_I_BIT) == 0) {
52 ++ if (mode == USR_MODE)
53 ++ return 1;
54 ++ if (elf_hwcap & HWCAP_26BIT && mode == USR26_MODE)
55 ++ return 1;
56 + }
57 +
58 + /*
59 + * Force CPSR to something logical...
60 + */
61 +- regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT;
62 ++ regs->ARM_cpsr &= PSR_f | PSR_s | PSR_x | PSR_T_BIT | MODE32_BIT;
63 + if (!(elf_hwcap & HWCAP_26BIT))
64 + regs->ARM_cpsr |= USR_MODE;
65 +
66 +diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
67 +index 827cbc4..ea9ee4e 100644
68 +--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
69 ++++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
70 +@@ -100,6 +100,7 @@ ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
71 +
72 + static struct platform_nand_data ixdp425_flash_nand_data = {
73 + .chip = {
74 ++ .nr_chips = 1,
75 + .chip_delay = 30,
76 + .options = NAND_NO_AUTOINCR,
77 + #ifdef CONFIG_MTD_PARTITIONS
78 +diff --git a/arch/arm/mach-mx3/mach-qong.c b/arch/arm/mach-mx3/mach-qong.c
79 +index e5b5b83..1f9363f 100644
80 +--- a/arch/arm/mach-mx3/mach-qong.c
81 ++++ b/arch/arm/mach-mx3/mach-qong.c
82 +@@ -169,6 +169,7 @@ static void qong_nand_select_chip(struct mtd_info *mtd, int chip)
83 +
84 + static struct platform_nand_data qong_nand_data = {
85 + .chip = {
86 ++ .nr_chips = 1,
87 + .chip_delay = 20,
88 + .options = 0,
89 + },
90 +diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
91 +index 5041d1b..696b1a9 100644
92 +--- a/arch/arm/mach-orion5x/ts78xx-setup.c
93 ++++ b/arch/arm/mach-orion5x/ts78xx-setup.c
94 +@@ -216,6 +216,7 @@ static struct mtd_partition ts78xx_ts_nand_parts[] = {
95 +
96 + static struct platform_nand_data ts78xx_ts_nand_data = {
97 + .chip = {
98 ++ .nr_chips = 1,
99 + .part_probe_types = ts_nand_part_probes,
100 + .partitions = ts78xx_ts_nand_parts,
101 + .nr_partitions = ARRAY_SIZE(ts78xx_ts_nand_parts),
102 +diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
103 +index 9eaf5b0..68a27bc 100644
104 +--- a/arch/blackfin/mach-bf537/boards/stamp.c
105 ++++ b/arch/blackfin/mach-bf537/boards/stamp.c
106 +@@ -400,6 +400,7 @@ static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
107 +
108 + static struct platform_nand_data bfin_plat_nand_data = {
109 + .chip = {
110 ++ .nr_chips = 1,
111 + .chip_delay = 30,
112 + #ifdef CONFIG_MTD_PARTITIONS
113 + .part_probe_types = part_probes,
114 +diff --git a/arch/blackfin/mach-bf561/boards/acvilon.c b/arch/blackfin/mach-bf561/boards/acvilon.c
115 +index 5163e2c..7aa6a22 100644
116 +--- a/arch/blackfin/mach-bf561/boards/acvilon.c
117 ++++ b/arch/blackfin/mach-bf561/boards/acvilon.c
118 +@@ -283,6 +283,7 @@ static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
119 +
120 + static struct platform_nand_data bfin_plat_nand_data = {
121 + .chip = {
122 ++ .nr_chips = 1,
123 + .chip_delay = 30,
124 + #ifdef CONFIG_MTD_PARTITIONS
125 + .part_probe_types = part_probes,
126 +diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
127 +index 7546e2c..c107b74 100644
128 +--- a/arch/powerpc/Makefile
129 ++++ b/arch/powerpc/Makefile
130 +@@ -159,7 +159,7 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
131 + all: zImage
132 +
133 + # With make 3.82 we cannot mix normal and wildcard targets
134 +-BOOT_TARGETS1 := zImage zImage.initrd uImaged
135 ++BOOT_TARGETS1 := zImage zImage.initrd uImage
136 + BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
137 +
138 + PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
139 +diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
140 +index f2e4800..f5cc06f 100644
141 +--- a/arch/sparc/include/asm/atomic_64.h
142 ++++ b/arch/sparc/include/asm/atomic_64.h
143 +@@ -20,14 +20,14 @@
144 + #define atomic64_set(v, i) (((v)->counter) = i)
145 +
146 + extern void atomic_add(int, atomic_t *);
147 +-extern void atomic64_add(int, atomic64_t *);
148 ++extern void atomic64_add(long, atomic64_t *);
149 + extern void atomic_sub(int, atomic_t *);
150 +-extern void atomic64_sub(int, atomic64_t *);
151 ++extern void atomic64_sub(long, atomic64_t *);
152 +
153 + extern int atomic_add_ret(int, atomic_t *);
154 +-extern int atomic64_add_ret(int, atomic64_t *);
155 ++extern long atomic64_add_ret(long, atomic64_t *);
156 + extern int atomic_sub_ret(int, atomic_t *);
157 +-extern int atomic64_sub_ret(int, atomic64_t *);
158 ++extern long atomic64_sub_ret(long, atomic64_t *);
159 +
160 + #define atomic_dec_return(v) atomic_sub_ret(1, v)
161 + #define atomic64_dec_return(v) atomic64_sub_ret(1, v)
162 +@@ -91,7 +91,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
163 + ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
164 + #define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
165 +
166 +-static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
167 ++static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
168 + {
169 + long c, old;
170 + c = atomic64_read(v);
171 +diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
172 +index ff9ead6..43cf002 100644
173 +--- a/arch/sparc/include/asm/parport.h
174 ++++ b/arch/sparc/include/asm/parport.h
175 +@@ -228,6 +228,10 @@ static const struct of_device_id ecpp_match[] = {
176 + .name = "parallel",
177 + .compatible = "ns87317-ecpp",
178 + },
179 ++ {
180 ++ .name = "parallel",
181 ++ .compatible = "pnpALI,1533,3",
182 ++ },
183 + {},
184 + };
185 +
186 +diff --git a/arch/sparc/include/asm/rwsem-const.h b/arch/sparc/include/asm/rwsem-const.h
187 +index a303c9d..e4c61a1 100644
188 +--- a/arch/sparc/include/asm/rwsem-const.h
189 ++++ b/arch/sparc/include/asm/rwsem-const.h
190 +@@ -5,7 +5,7 @@
191 + #define RWSEM_UNLOCKED_VALUE 0x00000000
192 + #define RWSEM_ACTIVE_BIAS 0x00000001
193 + #define RWSEM_ACTIVE_MASK 0x0000ffff
194 +-#define RWSEM_WAITING_BIAS 0xffff0000
195 ++#define RWSEM_WAITING_BIAS (-0x00010000)
196 + #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
197 + #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
198 +
199 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
200 +index 9458685..b99909c 100644
201 +--- a/arch/x86/Kconfig
202 ++++ b/arch/x86/Kconfig
203 +@@ -240,6 +240,11 @@ config X86_32_LAZY_GS
204 +
205 + config KTIME_SCALAR
206 + def_bool X86_32
207 ++
208 ++config ARCH_CPU_PROBE_RELEASE
209 ++ def_bool y
210 ++ depends on HOTPLUG_CPU
211 ++
212 + source "init/Kconfig"
213 + source "kernel/Kconfig.freezer"
214 +
215 +diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h
216 +index a6d360e..6dcb69b 100644
217 +--- a/arch/x86/include/asm/cmpxchg_32.h
218 ++++ b/arch/x86/include/asm/cmpxchg_32.h
219 +@@ -53,60 +53,33 @@ struct __xchg_dummy {
220 + __xchg((v), (ptr), sizeof(*ptr))
221 +
222 + /*
223 +- * The semantics of XCHGCMP8B are a bit strange, this is why
224 +- * there is a loop and the loading of %%eax and %%edx has to
225 +- * be inside. This inlines well in most cases, the cached
226 +- * cost is around ~38 cycles. (in the future we might want
227 +- * to do an SIMD/3DNOW!/MMX/FPU 64-bit store here, but that
228 +- * might have an implicit FPU-save as a cost, so it's not
229 +- * clear which path to go.)
230 ++ * CMPXCHG8B only writes to the target if we had the previous
231 ++ * value in registers, otherwise it acts as a read and gives us the
232 ++ * "new previous" value. That is why there is a loop. Preloading
233 ++ * EDX:EAX is a performance optimization: in the common case it means
234 ++ * we need only one locked operation.
235 + *
236 +- * cmpxchg8b must be used with the lock prefix here to allow
237 +- * the instruction to be executed atomically, see page 3-102
238 +- * of the instruction set reference 24319102.pdf. We need
239 +- * the reader side to see the coherent 64bit value.
240 ++ * A SIMD/3DNOW!/MMX/FPU 64-bit store here would require at the very
241 ++ * least an FPU save and/or %cr0.ts manipulation.
242 ++ *
243 ++ * cmpxchg8b must be used with the lock prefix here to allow the
244 ++ * instruction to be executed atomically. We need to have the reader
245 ++ * side to see the coherent 64bit value.
246 + */
247 +-static inline void __set_64bit(unsigned long long *ptr,
248 +- unsigned int low, unsigned int high)
249 ++static inline void set_64bit(volatile u64 *ptr, u64 value)
250 + {
251 ++ u32 low = value;
252 ++ u32 high = value >> 32;
253 ++ u64 prev = *ptr;
254 ++
255 + asm volatile("\n1:\t"
256 +- "movl (%1), %%eax\n\t"
257 +- "movl 4(%1), %%edx\n\t"
258 +- LOCK_PREFIX "cmpxchg8b (%1)\n\t"
259 ++ LOCK_PREFIX "cmpxchg8b %0\n\t"
260 + "jnz 1b"
261 +- : "=m" (*ptr)
262 +- : "D" (ptr),
263 +- "b" (low),
264 +- "c" (high)
265 +- : "ax", "dx", "memory");
266 +-}
267 +-
268 +-static inline void __set_64bit_constant(unsigned long long *ptr,
269 +- unsigned long long value)
270 +-{
271 +- __set_64bit(ptr, (unsigned int)value, (unsigned int)(value >> 32));
272 +-}
273 +-
274 +-#define ll_low(x) *(((unsigned int *)&(x)) + 0)
275 +-#define ll_high(x) *(((unsigned int *)&(x)) + 1)
276 +-
277 +-static inline void __set_64bit_var(unsigned long long *ptr,
278 +- unsigned long long value)
279 +-{
280 +- __set_64bit(ptr, ll_low(value), ll_high(value));
281 ++ : "=m" (*ptr), "+A" (prev)
282 ++ : "b" (low), "c" (high)
283 ++ : "memory");
284 + }
285 +
286 +-#define set_64bit(ptr, value) \
287 +- (__builtin_constant_p((value)) \
288 +- ? __set_64bit_constant((ptr), (value)) \
289 +- : __set_64bit_var((ptr), (value)))
290 +-
291 +-#define _set_64bit(ptr, value) \
292 +- (__builtin_constant_p(value) \
293 +- ? __set_64bit(ptr, (unsigned int)(value), \
294 +- (unsigned int)((value) >> 32)) \
295 +- : __set_64bit(ptr, ll_low((value)), ll_high((value))))
296 +-
297 + extern void __cmpxchg_wrong_size(void);
298 +
299 + /*
300 +diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h
301 +index b92f147..9596e7c 100644
302 +--- a/arch/x86/include/asm/cmpxchg_64.h
303 ++++ b/arch/x86/include/asm/cmpxchg_64.h
304 +@@ -5,13 +5,11 @@
305 +
306 + #define __xg(x) ((volatile long *)(x))
307 +
308 +-static inline void set_64bit(volatile unsigned long *ptr, unsigned long val)
309 ++static inline void set_64bit(volatile u64 *ptr, u64 val)
310 + {
311 + *ptr = val;
312 + }
313 +
314 +-#define _set_64bit set_64bit
315 +-
316 + extern void __xchg_wrong_size(void);
317 + extern void __cmpxchg_wrong_size(void);
318 +
319 +diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
320 +index 93e2a13..a96489e 100644
321 +--- a/arch/x86/kernel/apic/apic.c
322 ++++ b/arch/x86/kernel/apic/apic.c
323 +@@ -51,6 +51,7 @@
324 + #include <asm/smp.h>
325 + #include <asm/mce.h>
326 + #include <asm/kvm_para.h>
327 ++#include <asm/tsc.h>
328 +
329 + unsigned int num_processors;
330 +
331 +@@ -1151,8 +1152,13 @@ static void __cpuinit lapic_setup_esr(void)
332 + */
333 + void __cpuinit setup_local_APIC(void)
334 + {
335 +- unsigned int value;
336 +- int i, j;
337 ++ unsigned int value, queued;
338 ++ int i, j, acked = 0;
339 ++ unsigned long long tsc = 0, ntsc;
340 ++ long long max_loops = cpu_khz;
341 ++
342 ++ if (cpu_has_tsc)
343 ++ rdtscll(tsc);
344 +
345 + if (disable_apic) {
346 + arch_disable_smp_support();
347 +@@ -1204,13 +1210,32 @@ void __cpuinit setup_local_APIC(void)
348 + * the interrupt. Hence a vector might get locked. It was noticed
349 + * for timer irq (vector 0x31). Issue an extra EOI to clear ISR.
350 + */
351 +- for (i = APIC_ISR_NR - 1; i >= 0; i--) {
352 +- value = apic_read(APIC_ISR + i*0x10);
353 +- for (j = 31; j >= 0; j--) {
354 +- if (value & (1<<j))
355 +- ack_APIC_irq();
356 ++ do {
357 ++ queued = 0;
358 ++ for (i = APIC_ISR_NR - 1; i >= 0; i--)
359 ++ queued |= apic_read(APIC_IRR + i*0x10);
360 ++
361 ++ for (i = APIC_ISR_NR - 1; i >= 0; i--) {
362 ++ value = apic_read(APIC_ISR + i*0x10);
363 ++ for (j = 31; j >= 0; j--) {
364 ++ if (value & (1<<j)) {
365 ++ ack_APIC_irq();
366 ++ acked++;
367 ++ }
368 ++ }
369 + }
370 +- }
371 ++ if (acked > 256) {
372 ++ printk(KERN_ERR "LAPIC pending interrupts after %d EOI\n",
373 ++ acked);
374 ++ break;
375 ++ }
376 ++ if (cpu_has_tsc) {
377 ++ rdtscll(ntsc);
378 ++ max_loops = (cpu_khz << 10) - (ntsc - tsc);
379 ++ } else
380 ++ max_loops--;
381 ++ } while (queued && max_loops > 0);
382 ++ WARN_ON(max_loops <= 0);
383 +
384 + /*
385 + * Now that we are all set up, enable the APIC
386 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
387 +index eb2789c..c64499c 100644
388 +--- a/arch/x86/kernel/apic/io_apic.c
389 ++++ b/arch/x86/kernel/apic/io_apic.c
390 +@@ -1732,6 +1732,8 @@ __apicdebuginit(void) print_IO_APIC(void)
391 + struct irq_pin_list *entry;
392 +
393 + cfg = desc->chip_data;
394 ++ if (!cfg)
395 ++ continue;
396 + entry = cfg->irq_2_pin;
397 + if (!entry)
398 + continue;
399 +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
400 +index 763d815..8931d05 100644
401 +--- a/arch/x86/kernel/smpboot.c
402 ++++ b/arch/x86/kernel/smpboot.c
403 +@@ -91,6 +91,25 @@ DEFINE_PER_CPU(int, cpu_state) = { 0 };
404 + static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
405 + #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
406 + #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
407 ++
408 ++/*
409 ++ * We need this for trampoline_base protection from concurrent accesses when
410 ++ * off- and onlining cores wildly.
411 ++ */
412 ++static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);
413 ++
414 ++void cpu_hotplug_driver_lock()
415 ++{
416 ++ mutex_lock(&x86_cpu_hotplug_driver_mutex);
417 ++}
418 ++
419 ++void cpu_hotplug_driver_unlock()
420 ++{
421 ++ mutex_unlock(&x86_cpu_hotplug_driver_mutex);
422 ++}
423 ++
424 ++ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
425 ++ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
426 + #else
427 + static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
428 + #define get_idle_for_cpu(x) (idle_thread_array[(x)])
429 +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
430 +index f1fb411..c41ad50 100644
431 +--- a/arch/x86/oprofile/nmi_int.c
432 ++++ b/arch/x86/oprofile/nmi_int.c
433 +@@ -584,6 +584,18 @@ static int __init ppro_init(char **cpu_type)
434 + if (force_arch_perfmon && cpu_has_arch_perfmon)
435 + return 0;
436 +
437 ++ /*
438 ++ * Documentation on identifying Intel processors by CPU family
439 ++ * and model can be found in the Intel Software Developer's
440 ++ * Manuals (SDM):
441 ++ *
442 ++ * http://www.intel.com/products/processor/manuals/
443 ++ *
444 ++ * As of May 2010 the documentation for this was in the:
445 ++ * "Intel 64 and IA-32 Architectures Software Developer's
446 ++ * Manual Volume 3B: System Programming Guide", "Table B-1
447 ++ * CPUID Signature Values of DisplayFamily_DisplayModel".
448 ++ */
449 + switch (cpu_model) {
450 + case 0 ... 2:
451 + *cpu_type = "i386/ppro";
452 +@@ -605,12 +617,13 @@ static int __init ppro_init(char **cpu_type)
453 + case 15: case 23:
454 + *cpu_type = "i386/core_2";
455 + break;
456 ++ case 0x1a:
457 ++ case 0x1e:
458 + case 0x2e:
459 +- case 26:
460 + spec = &op_arch_perfmon_spec;
461 + *cpu_type = "i386/core_i7";
462 + break;
463 +- case 28:
464 ++ case 0x1c:
465 + *cpu_type = "i386/atom";
466 + break;
467 + default:
468 +diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
469 +index 4a66201..c9736ed 100644
470 +--- a/drivers/gpu/drm/drm_drv.c
471 ++++ b/drivers/gpu/drm/drm_drv.c
472 +@@ -502,7 +502,9 @@ long drm_ioctl(struct file *filp,
473 + retcode = -EFAULT;
474 + goto err_i1;
475 + }
476 +- }
477 ++ } else
478 ++ memset(kdata, 0, _IOC_SIZE(cmd));
479 ++
480 + if (ioctl->flags & DRM_UNLOCKED)
481 + retcode = func(dev, kdata, file_priv);
482 + else {
483 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
484 +index 44c07f8..66eb458 100644
485 +--- a/drivers/gpu/drm/i915/intel_display.c
486 ++++ b/drivers/gpu/drm/i915/intel_display.c
487 +@@ -1470,6 +1470,7 @@ static void ironlake_enable_pll_edp (struct drm_crtc *crtc)
488 + dpa_ctl = I915_READ(DP_A);
489 + dpa_ctl |= DP_PLL_ENABLE;
490 + I915_WRITE(DP_A, dpa_ctl);
491 ++ POSTING_READ(DP_A);
492 + udelay(200);
493 + }
494 +
495 +@@ -4290,14 +4291,16 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
496 + work->pending_flip_obj = obj;
497 +
498 + if (intel_crtc->plane)
499 +- flip_mask = I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
500 ++ flip_mask = MI_WAIT_FOR_PLANE_B_FLIP;
501 + else
502 +- flip_mask = I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT;
503 ++ flip_mask = MI_WAIT_FOR_PLANE_A_FLIP;
504 +
505 +- /* Wait for any previous flip to finish */
506 +- if (IS_GEN3(dev))
507 +- while (I915_READ(ISR) & flip_mask)
508 +- ;
509 ++ if (IS_GEN3(dev) || IS_GEN2(dev)) {
510 ++ BEGIN_LP_RING(2);
511 ++ OUT_RING(MI_WAIT_FOR_EVENT | flip_mask);
512 ++ OUT_RING(0);
513 ++ ADVANCE_LP_RING();
514 ++ }
515 +
516 + /* Offset into the new buffer for cases of shared fbs between CRTCs */
517 + offset = obj_priv->gtt_offset;
518 +@@ -4311,12 +4314,18 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
519 + OUT_RING(offset | obj_priv->tiling_mode);
520 + pipesrc = I915_READ(pipesrc_reg);
521 + OUT_RING(pipesrc & 0x0fff0fff);
522 +- } else {
523 ++ } else if (IS_GEN3(dev)) {
524 + OUT_RING(MI_DISPLAY_FLIP_I915 |
525 + MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
526 + OUT_RING(fb->pitch);
527 + OUT_RING(offset);
528 + OUT_RING(MI_NOOP);
529 ++ } else {
530 ++ OUT_RING(MI_DISPLAY_FLIP |
531 ++ MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
532 ++ OUT_RING(fb->pitch);
533 ++ OUT_RING(offset);
534 ++ OUT_RING(MI_NOOP);
535 + }
536 + ADVANCE_LP_RING();
537 +
538 +diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
539 +index 0fb8fc1..05ef0c4 100644
540 +--- a/drivers/gpu/drm/radeon/radeon_atombios.c
541 ++++ b/drivers/gpu/drm/radeon/radeon_atombios.c
542 +@@ -206,6 +206,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
543 + uint16_t *line_mux,
544 + struct radeon_hpd *hpd)
545 + {
546 ++ struct radeon_device *rdev = dev->dev_private;
547 +
548 + /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
549 + if ((dev->pdev->device == 0x791e) &&
550 +@@ -308,13 +309,22 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
551 + }
552 + }
553 +
554 +- /* Acer laptop reports DVI-D as DVI-I */
555 ++ /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */
556 + if ((dev->pdev->device == 0x95c4) &&
557 + (dev->pdev->subsystem_vendor == 0x1025) &&
558 + (dev->pdev->subsystem_device == 0x013c)) {
559 ++ struct radeon_gpio_rec gpio;
560 ++
561 + if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
562 +- (supported_device == ATOM_DEVICE_DFP1_SUPPORT))
563 ++ (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
564 ++ gpio = radeon_lookup_gpio(rdev, 6);
565 ++ *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
566 + *connector_type = DRM_MODE_CONNECTOR_DVID;
567 ++ } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
568 ++ (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
569 ++ gpio = radeon_lookup_gpio(rdev, 7);
570 ++ *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
571 ++ }
572 + }
573 +
574 + /* XFX Pine Group device rv730 reports no VGA DDC lines
575 +@@ -1038,7 +1048,7 @@ bool radeon_atombios_sideport_present(struct radeon_device *rdev)
576 + return true;
577 + break;
578 + case 2:
579 +- if (igp_info->info_2.ucMemoryType & 0x0f)
580 ++ if (igp_info->info_2.ulBootUpSidePortClock)
581 + return true;
582 + break;
583 + default:
584 +diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
585 +index ed6a724..2008481 100644
586 +--- a/drivers/gpu/drm/radeon/radeon_device.c
587 ++++ b/drivers/gpu/drm/radeon/radeon_device.c
588 +@@ -199,7 +199,7 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64
589 + mc->mc_vram_size = mc->aper_size;
590 + }
591 + mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
592 +- if (rdev->flags & RADEON_IS_AGP && mc->vram_end > mc->gtt_start && mc->vram_end <= mc->gtt_end) {
593 ++ if (rdev->flags & RADEON_IS_AGP && mc->vram_end > mc->gtt_start && mc->vram_start <= mc->gtt_end) {
594 + dev_warn(rdev->dev, "limiting VRAM to PCI aperture size\n");
595 + mc->real_vram_size = mc->aper_size;
596 + mc->mc_vram_size = mc->aper_size;
597 +diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
598 +index 5def6f5..0cd2704 100644
599 +--- a/drivers/gpu/drm/radeon/radeon_i2c.c
600 ++++ b/drivers/gpu/drm/radeon/radeon_i2c.c
601 +@@ -95,6 +95,13 @@ static void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state)
602 + }
603 + }
604 +
605 ++ /* switch the pads to ddc mode */
606 ++ if (ASIC_IS_DCE3(rdev) && rec->hw_capable) {
607 ++ temp = RREG32(rec->mask_clk_reg);
608 ++ temp &= ~(1 << 16);
609 ++ WREG32(rec->mask_clk_reg, temp);
610 ++ }
611 ++
612 + /* clear the output pin values */
613 + temp = RREG32(rec->a_clk_reg) & ~rec->a_clk_mask;
614 + WREG32(rec->a_clk_reg, temp);
615 +diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
616 +index a212041..b05051f 100644
617 +--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
618 ++++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
619 +@@ -118,11 +118,12 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
620 + * chips. Disable MSI on them for now.
621 + */
622 + if ((rdev->family >= CHIP_RV380) &&
623 +- (!(rdev->flags & RADEON_IS_IGP))) {
624 ++ (!(rdev->flags & RADEON_IS_IGP)) &&
625 ++ (!(rdev->flags & RADEON_IS_AGP))) {
626 + int ret = pci_enable_msi(rdev->pdev);
627 + if (!ret) {
628 + rdev->msi_enabled = 1;
629 +- DRM_INFO("radeon: using MSI.\n");
630 ++ dev_info(rdev->dev, "radeon: using MSI.\n");
631 + }
632 + }
633 + rdev->irq.installed = true;
634 +diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
635 +index 88865e3..d6871ea 100644
636 +--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
637 ++++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
638 +@@ -272,7 +272,7 @@ static uint8_t radeon_compute_pll_gain(uint16_t ref_freq, uint16_t ref_div,
639 + if (!ref_div)
640 + return 1;
641 +
642 +- vcoFreq = ((unsigned)ref_freq & fb_div) / ref_div;
643 ++ vcoFreq = ((unsigned)ref_freq * fb_div) / ref_div;
644 +
645 + /*
646 + * This is horribly crude: the VCO frequency range is divided into
647 +diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
648 +index 4a64b85..68e69a4 100644
649 +--- a/drivers/hwmon/pc87360.c
650 ++++ b/drivers/hwmon/pc87360.c
651 +@@ -1610,11 +1610,8 @@ static struct pc87360_data *pc87360_update_device(struct device *dev)
652 +
653 + static int __init pc87360_device_add(unsigned short address)
654 + {
655 +- struct resource res = {
656 +- .name = "pc87360",
657 +- .flags = IORESOURCE_IO,
658 +- };
659 +- int err, i;
660 ++ struct resource res[3];
661 ++ int err, i, res_count;
662 +
663 + pdev = platform_device_alloc("pc87360", address);
664 + if (!pdev) {
665 +@@ -1623,22 +1620,28 @@ static int __init pc87360_device_add(unsigned short address)
666 + goto exit;
667 + }
668 +
669 ++ memset(res, 0, 3 * sizeof(struct resource));
670 ++ res_count = 0;
671 + for (i = 0; i < 3; i++) {
672 + if (!extra_isa[i])
673 + continue;
674 +- res.start = extra_isa[i];
675 +- res.end = extra_isa[i] + PC87360_EXTENT - 1;
676 ++ res[res_count].start = extra_isa[i];
677 ++ res[res_count].end = extra_isa[i] + PC87360_EXTENT - 1;
678 ++ res[res_count].name = "pc87360",
679 ++ res[res_count].flags = IORESOURCE_IO,
680 +
681 +- err = acpi_check_resource_conflict(&res);
682 ++ err = acpi_check_resource_conflict(&res[res_count]);
683 + if (err)
684 + goto exit_device_put;
685 +
686 +- err = platform_device_add_resources(pdev, &res, 1);
687 +- if (err) {
688 +- printk(KERN_ERR "pc87360: Device resource[%d] "
689 +- "addition failed (%d)\n", i, err);
690 +- goto exit_device_put;
691 +- }
692 ++ res_count++;
693 ++ }
694 ++
695 ++ err = platform_device_add_resources(pdev, res, res_count);
696 ++ if (err) {
697 ++ printk(KERN_ERR "pc87360: Device resources addition failed "
698 ++ "(%d)\n", err);
699 ++ goto exit_device_put;
700 + }
701 +
702 + err = platform_device_add(pdev);
703 +diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
704 +index bedc8b0..b4093f2 100644
705 +--- a/drivers/isdn/gigaset/capi.c
706 ++++ b/drivers/isdn/gigaset/capi.c
707 +@@ -389,13 +389,13 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb)
708 + ++bcs->trans_up;
709 +
710 + if (!ap) {
711 +- dev_err(cs->dev, "%s: no application\n", __func__);
712 ++ gig_dbg(DEBUG_MCMD, "%s: application gone", __func__);
713 + return;
714 + }
715 +
716 + /* don't send further B3 messages if disconnected */
717 + if (bcs->apconnstate < APCONN_ACTIVE) {
718 +- gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack");
719 ++ gig_dbg(DEBUG_MCMD, "%s: disconnected", __func__);
720 + return;
721 + }
722 +
723 +@@ -433,13 +433,14 @@ void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb)
724 + bcs->trans_down++;
725 +
726 + if (!ap) {
727 +- dev_err(cs->dev, "%s: no application\n", __func__);
728 ++ gig_dbg(DEBUG_MCMD, "%s: application gone", __func__);
729 ++ dev_kfree_skb_any(skb);
730 + return;
731 + }
732 +
733 + /* don't send further B3 messages if disconnected */
734 + if (bcs->apconnstate < APCONN_ACTIVE) {
735 +- gig_dbg(DEBUG_LLDATA, "disconnected, discarding data");
736 ++ gig_dbg(DEBUG_MCMD, "%s: disconnected", __func__);
737 + dev_kfree_skb_any(skb);
738 + return;
739 + }
740 +@@ -758,7 +759,7 @@ void gigaset_isdn_connD(struct bc_state *bcs)
741 + ap = bcs->ap;
742 + if (!ap) {
743 + spin_unlock_irqrestore(&bcs->aplock, flags);
744 +- dev_err(cs->dev, "%s: no application\n", __func__);
745 ++ gig_dbg(DEBUG_CMD, "%s: application gone", __func__);
746 + return;
747 + }
748 + if (bcs->apconnstate == APCONN_NONE) {
749 +@@ -854,7 +855,7 @@ void gigaset_isdn_connB(struct bc_state *bcs)
750 + ap = bcs->ap;
751 + if (!ap) {
752 + spin_unlock_irqrestore(&bcs->aplock, flags);
753 +- dev_err(cs->dev, "%s: no application\n", __func__);
754 ++ gig_dbg(DEBUG_CMD, "%s: application gone", __func__);
755 + return;
756 + }
757 + if (!bcs->apconnstate) {
758 +@@ -912,13 +913,12 @@ void gigaset_isdn_connB(struct bc_state *bcs)
759 + */
760 + void gigaset_isdn_hupB(struct bc_state *bcs)
761 + {
762 +- struct cardstate *cs = bcs->cs;
763 + struct gigaset_capi_appl *ap = bcs->ap;
764 +
765 + /* ToDo: assure order of DISCONNECT_B3_IND and DISCONNECT_IND ? */
766 +
767 + if (!ap) {
768 +- dev_err(cs->dev, "%s: no application\n", __func__);
769 ++ gig_dbg(DEBUG_CMD, "%s: application gone", __func__);
770 + return;
771 + }
772 +
773 +@@ -1055,6 +1055,7 @@ static inline void remove_appl_from_channel(struct bc_state *bcs,
774 + do {
775 + if (bcap->bcnext == ap) {
776 + bcap->bcnext = bcap->bcnext->bcnext;
777 ++ spin_unlock_irqrestore(&bcs->aplock, flags);
778 + return;
779 + }
780 + bcap = bcap->bcnext;
781 +diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c
782 +index 1081091..2655e3a 100644
783 +--- a/drivers/isdn/sc/ioctl.c
784 ++++ b/drivers/isdn/sc/ioctl.c
785 +@@ -174,7 +174,7 @@ int sc_ioctl(int card, scs_ioctl *data)
786 + pr_debug("%s: SCIOGETSPID: ioctl received\n",
787 + sc_adapter[card]->devicename);
788 +
789 +- spid = kmalloc(SCIOC_SPIDSIZE, GFP_KERNEL);
790 ++ spid = kzalloc(SCIOC_SPIDSIZE, GFP_KERNEL);
791 + if (!spid) {
792 + kfree(rcvmsg);
793 + return -ENOMEM;
794 +@@ -194,7 +194,7 @@ int sc_ioctl(int card, scs_ioctl *data)
795 + kfree(rcvmsg);
796 + return status;
797 + }
798 +- strcpy(spid, rcvmsg->msg_data.byte_array);
799 ++ strlcpy(spid, rcvmsg->msg_data.byte_array, SCIOC_SPIDSIZE);
800 +
801 + /*
802 + * Package the switch type and send to user space
803 +@@ -272,12 +272,12 @@ int sc_ioctl(int card, scs_ioctl *data)
804 + return status;
805 + }
806 +
807 +- dn = kmalloc(SCIOC_DNSIZE, GFP_KERNEL);
808 ++ dn = kzalloc(SCIOC_DNSIZE, GFP_KERNEL);
809 + if (!dn) {
810 + kfree(rcvmsg);
811 + return -ENOMEM;
812 + }
813 +- strcpy(dn, rcvmsg->msg_data.byte_array);
814 ++ strlcpy(dn, rcvmsg->msg_data.byte_array, SCIOC_DNSIZE);
815 + kfree(rcvmsg);
816 +
817 + /*
818 +@@ -348,7 +348,7 @@ int sc_ioctl(int card, scs_ioctl *data)
819 + pr_debug("%s: SCIOSTAT: ioctl received\n",
820 + sc_adapter[card]->devicename);
821 +
822 +- bi = kmalloc (sizeof(boardInfo), GFP_KERNEL);
823 ++ bi = kzalloc(sizeof(boardInfo), GFP_KERNEL);
824 + if (!bi) {
825 + kfree(rcvmsg);
826 + return -ENOMEM;
827 +diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
828 +index 2b7907b..0bdb201 100644
829 +--- a/drivers/md/dm-exception-store.c
830 ++++ b/drivers/md/dm-exception-store.c
831 +@@ -173,7 +173,9 @@ int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
832 +
833 + /* Validate the chunk size against the device block size */
834 + if (chunk_size %
835 +- (bdev_logical_block_size(dm_snap_cow(store->snap)->bdev) >> 9)) {
836 ++ (bdev_logical_block_size(dm_snap_cow(store->snap)->bdev) >> 9) ||
837 ++ chunk_size %
838 ++ (bdev_logical_block_size(dm_snap_origin(store->snap)->bdev) >> 9)) {
839 + *error = "Chunk size is not a multiple of device blocksize";
840 + return -EINVAL;
841 + }
842 +diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
843 +index e8dfa06..0b25362 100644
844 +--- a/drivers/md/dm-exception-store.h
845 ++++ b/drivers/md/dm-exception-store.h
846 +@@ -126,8 +126,9 @@ struct dm_exception_store {
847 + };
848 +
849 + /*
850 +- * Obtain the cow device used by a given snapshot.
851 ++ * Obtain the origin or cow device used by a given snapshot.
852 + */
853 ++struct dm_dev *dm_snap_origin(struct dm_snapshot *snap);
854 + struct dm_dev *dm_snap_cow(struct dm_snapshot *snap);
855 +
856 + /*
857 +diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
858 +index d7500e1..f81c536 100644
859 +--- a/drivers/md/dm-ioctl.c
860 ++++ b/drivers/md/dm-ioctl.c
861 +@@ -249,40 +249,46 @@ static void __hash_remove(struct hash_cell *hc)
862 +
863 + static void dm_hash_remove_all(int keep_open_devices)
864 + {
865 +- int i, dev_skipped, dev_removed;
866 ++ int i, dev_skipped;
867 + struct hash_cell *hc;
868 +- struct list_head *tmp, *n;
869 ++ struct mapped_device *md;
870 ++
871 ++retry:
872 ++ dev_skipped = 0;
873 +
874 + down_write(&_hash_lock);
875 +
876 +-retry:
877 +- dev_skipped = dev_removed = 0;
878 + for (i = 0; i < NUM_BUCKETS; i++) {
879 +- list_for_each_safe (tmp, n, _name_buckets + i) {
880 +- hc = list_entry(tmp, struct hash_cell, name_list);
881 ++ list_for_each_entry(hc, _name_buckets + i, name_list) {
882 ++ md = hc->md;
883 ++ dm_get(md);
884 +
885 +- if (keep_open_devices &&
886 +- dm_lock_for_deletion(hc->md)) {
887 ++ if (keep_open_devices && dm_lock_for_deletion(md)) {
888 ++ dm_put(md);
889 + dev_skipped++;
890 + continue;
891 + }
892 ++
893 + __hash_remove(hc);
894 +- dev_removed = 1;
895 +- }
896 +- }
897 +
898 +- /*
899 +- * Some mapped devices may be using other mapped devices, so if any
900 +- * still exist, repeat until we make no further progress.
901 +- */
902 +- if (dev_skipped) {
903 +- if (dev_removed)
904 +- goto retry;
905 ++ up_write(&_hash_lock);
906 +
907 +- DMWARN("remove_all left %d open device(s)", dev_skipped);
908 ++ dm_put(md);
909 ++
910 ++ /*
911 ++ * Some mapped devices may be using other mapped
912 ++ * devices, so repeat until we make no further
913 ++ * progress. If a new mapped device is created
914 ++ * here it will also get removed.
915 ++ */
916 ++ goto retry;
917 ++ }
918 + }
919 +
920 + up_write(&_hash_lock);
921 ++
922 ++ if (dev_skipped)
923 ++ DMWARN("remove_all left %d open device(s)", dev_skipped);
924 + }
925 +
926 + static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old,
927 +diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
928 +index 826bce7..da2223a 100644
929 +--- a/drivers/md/dm-mpath.c
930 ++++ b/drivers/md/dm-mpath.c
931 +@@ -706,6 +706,7 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
932 +
933 + if (as->argc < nr_params) {
934 + ti->error = "not enough path parameters";
935 ++ r = -EINVAL;
936 + goto bad;
937 + }
938 +
939 +diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
940 +index 5485377..a1f2ab5 100644
941 +--- a/drivers/md/dm-snap.c
942 ++++ b/drivers/md/dm-snap.c
943 +@@ -148,6 +148,12 @@ struct dm_snapshot {
944 + #define RUNNING_MERGE 0
945 + #define SHUTDOWN_MERGE 1
946 +
947 ++struct dm_dev *dm_snap_origin(struct dm_snapshot *s)
948 ++{
949 ++ return s->origin;
950 ++}
951 ++EXPORT_SYMBOL(dm_snap_origin);
952 ++
953 + struct dm_dev *dm_snap_cow(struct dm_snapshot *s)
954 + {
955 + return s->cow;
956 +@@ -1065,10 +1071,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
957 + origin_mode = FMODE_WRITE;
958 + }
959 +
960 +- origin_path = argv[0];
961 +- argv++;
962 +- argc--;
963 +-
964 + s = kmalloc(sizeof(*s), GFP_KERNEL);
965 + if (!s) {
966 + ti->error = "Cannot allocate snapshot context private "
967 +@@ -1077,6 +1079,16 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
968 + goto bad;
969 + }
970 +
971 ++ origin_path = argv[0];
972 ++ argv++;
973 ++ argc--;
974 ++
975 ++ r = dm_get_device(ti, origin_path, origin_mode, &s->origin);
976 ++ if (r) {
977 ++ ti->error = "Cannot get origin device";
978 ++ goto bad_origin;
979 ++ }
980 ++
981 + cow_path = argv[0];
982 + argv++;
983 + argc--;
984 +@@ -1097,12 +1109,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
985 + argv += args_used;
986 + argc -= args_used;
987 +
988 +- r = dm_get_device(ti, origin_path, origin_mode, &s->origin);
989 +- if (r) {
990 +- ti->error = "Cannot get origin device";
991 +- goto bad_origin;
992 +- }
993 +-
994 + s->ti = ti;
995 + s->valid = 1;
996 + s->active = 0;
997 +@@ -1212,15 +1218,15 @@ bad_kcopyd:
998 + dm_exception_table_exit(&s->complete, exception_cache);
999 +
1000 + bad_hash_tables:
1001 +- dm_put_device(ti, s->origin);
1002 +-
1003 +-bad_origin:
1004 + dm_exception_store_destroy(s->store);
1005 +
1006 + bad_store:
1007 + dm_put_device(ti, s->cow);
1008 +
1009 + bad_cow:
1010 ++ dm_put_device(ti, s->origin);
1011 ++
1012 ++bad_origin:
1013 + kfree(s);
1014 +
1015 + bad:
1016 +@@ -1314,12 +1320,12 @@ static void snapshot_dtr(struct dm_target *ti)
1017 +
1018 + mempool_destroy(s->pending_pool);
1019 +
1020 +- dm_put_device(ti, s->origin);
1021 +-
1022 + dm_exception_store_destroy(s->store);
1023 +
1024 + dm_put_device(ti, s->cow);
1025 +
1026 ++ dm_put_device(ti, s->origin);
1027 ++
1028 + kfree(s);
1029 + }
1030 +
1031 +@@ -1899,8 +1905,14 @@ static int snapshot_iterate_devices(struct dm_target *ti,
1032 + iterate_devices_callout_fn fn, void *data)
1033 + {
1034 + struct dm_snapshot *snap = ti->private;
1035 ++ int r;
1036 ++
1037 ++ r = fn(ti, snap->origin, 0, ti->len, data);
1038 +
1039 +- return fn(ti, snap->origin, 0, ti->len, data);
1040 ++ if (!r)
1041 ++ r = fn(ti, snap->cow, 0, get_dev_size(snap->cow->bdev), data);
1042 ++
1043 ++ return r;
1044 + }
1045 +
1046 +
1047 +diff --git a/drivers/md/dm.c b/drivers/md/dm.c
1048 +index d21e128..56d192d 100644
1049 +--- a/drivers/md/dm.c
1050 ++++ b/drivers/md/dm.c
1051 +@@ -2141,6 +2141,7 @@ static struct mapped_device *dm_find_md(dev_t dev)
1052 + md = idr_find(&_minor_idr, minor);
1053 + if (md && (md == MINOR_ALLOCED ||
1054 + (MINOR(disk_devt(dm_disk(md))) != minor) ||
1055 ++ dm_deleting_md(md) ||
1056 + test_bit(DMF_FREEING, &md->flags))) {
1057 + md = NULL;
1058 + goto out;
1059 +diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
1060 +index 8327e24..300ec15 100644
1061 +--- a/drivers/memstick/core/mspro_block.c
1062 ++++ b/drivers/memstick/core/mspro_block.c
1063 +@@ -1040,6 +1040,7 @@ static int mspro_block_read_attributes(struct memstick_dev *card)
1064 + snprintf(s_attr->name, sizeof(s_attr->name),
1065 + "attr_x%02x", attr->entries[cnt].id);
1066 +
1067 ++ sysfs_attr_init(&s_attr->dev_attr.attr);
1068 + s_attr->dev_attr.attr.name = s_attr->name;
1069 + s_attr->dev_attr.attr.mode = S_IRUGO;
1070 + s_attr->dev_attr.show = mspro_block_attr_show(s_attr->id);
1071 +@@ -1330,13 +1331,14 @@ static void mspro_block_remove(struct memstick_dev *card)
1072 + struct mspro_block_data *msb = memstick_get_drvdata(card);
1073 + unsigned long flags;
1074 +
1075 +- del_gendisk(msb->disk);
1076 +- dev_dbg(&card->dev, "mspro block remove\n");
1077 + spin_lock_irqsave(&msb->q_lock, flags);
1078 + msb->eject = 1;
1079 + blk_start_queue(msb->queue);
1080 + spin_unlock_irqrestore(&msb->q_lock, flags);
1081 +
1082 ++ del_gendisk(msb->disk);
1083 ++ dev_dbg(&card->dev, "mspro block remove\n");
1084 ++
1085 + blk_cleanup_queue(msb->queue);
1086 + msb->queue = NULL;
1087 +
1088 +diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
1089 +index 5d55152..33f1165 100644
1090 +--- a/drivers/mtd/nand/pxa3xx_nand.c
1091 ++++ b/drivers/mtd/nand/pxa3xx_nand.c
1092 +@@ -363,7 +363,7 @@ static struct pxa3xx_nand_flash *builtin_flash_types[] = {
1093 + #define tAR_NDTR1(r) (((r) >> 0) & 0xf)
1094 +
1095 + /* convert nano-seconds to nand flash controller clock cycles */
1096 +-#define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) - 1)
1097 ++#define ns2cycle(ns, clk) (int)((ns) * (clk / 1000000) / 1000)
1098 +
1099 + /* convert nand flash controller clock cycles to nano-seconds */
1100 + #define cycle2ns(c, clk) ((((c) + 1) * 1000000 + clk / 500) / (clk / 1000))
1101 +diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
1102 +index 9015555..4c2a31f 100644
1103 +--- a/drivers/net/e1000e/82571.c
1104 ++++ b/drivers/net/e1000e/82571.c
1105 +@@ -926,12 +926,14 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
1106 + ew32(IMC, 0xffffffff);
1107 + icr = er32(ICR);
1108 +
1109 +- /* Install any alternate MAC address into RAR0 */
1110 +- ret_val = e1000_check_alt_mac_addr_generic(hw);
1111 +- if (ret_val)
1112 +- return ret_val;
1113 ++ if (hw->mac.type == e1000_82571) {
1114 ++ /* Install any alternate MAC address into RAR0 */
1115 ++ ret_val = e1000_check_alt_mac_addr_generic(hw);
1116 ++ if (ret_val)
1117 ++ return ret_val;
1118 +
1119 +- e1000e_set_laa_state_82571(hw, true);
1120 ++ e1000e_set_laa_state_82571(hw, true);
1121 ++ }
1122 +
1123 + /* Reinitialize the 82571 serdes link state machine */
1124 + if (hw->phy.media_type == e1000_media_type_internal_serdes)
1125 +@@ -1609,14 +1611,16 @@ static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw)
1126 + {
1127 + s32 ret_val = 0;
1128 +
1129 +- /*
1130 +- * If there's an alternate MAC address place it in RAR0
1131 +- * so that it will override the Si installed default perm
1132 +- * address.
1133 +- */
1134 +- ret_val = e1000_check_alt_mac_addr_generic(hw);
1135 +- if (ret_val)
1136 +- goto out;
1137 ++ if (hw->mac.type == e1000_82571) {
1138 ++ /*
1139 ++ * If there's an alternate MAC address place it in RAR0
1140 ++ * so that it will override the Si installed default perm
1141 ++ * address.
1142 ++ */
1143 ++ ret_val = e1000_check_alt_mac_addr_generic(hw);
1144 ++ if (ret_val)
1145 ++ goto out;
1146 ++ }
1147 +
1148 + ret_val = e1000_read_mac_addr_generic(hw);
1149 +
1150 +@@ -1826,6 +1830,7 @@ struct e1000_info e1000_82573_info = {
1151 + | FLAG_HAS_SMART_POWER_DOWN
1152 + | FLAG_HAS_AMT
1153 + | FLAG_HAS_SWSM_ON_LOAD,
1154 ++ .flags2 = FLAG2_DISABLE_ASPM_L1,
1155 + .pba = 20,
1156 + .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
1157 + .get_variants = e1000_get_variants_82571,
1158 +diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
1159 +index e301e26..57d7a76 100644
1160 +--- a/drivers/net/e1000e/defines.h
1161 ++++ b/drivers/net/e1000e/defines.h
1162 +@@ -613,6 +613,7 @@
1163 + #define E1000_FLASH_UPDATES 2000
1164 +
1165 + /* NVM Word Offsets */
1166 ++#define NVM_COMPAT 0x0003
1167 + #define NVM_ID_LED_SETTINGS 0x0004
1168 + #define NVM_INIT_CONTROL2_REG 0x000F
1169 + #define NVM_INIT_CONTROL3_PORT_B 0x0014
1170 +@@ -633,6 +634,9 @@
1171 + /* Mask bits for fields in Word 0x1a of the NVM */
1172 + #define NVM_WORD1A_ASPM_MASK 0x000C
1173 +
1174 ++/* Mask bits for fields in Word 0x03 of the EEPROM */
1175 ++#define NVM_COMPAT_LOM 0x0800
1176 ++
1177 + /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
1178 + #define NVM_SUM 0xBABA
1179 +
1180 +diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
1181 +index a8b2c0d..02f57f9 100644
1182 +--- a/drivers/net/e1000e/lib.c
1183 ++++ b/drivers/net/e1000e/lib.c
1184 +@@ -183,6 +183,16 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
1185 + u16 offset, nvm_alt_mac_addr_offset, nvm_data;
1186 + u8 alt_mac_addr[ETH_ALEN];
1187 +
1188 ++ ret_val = e1000_read_nvm(hw, NVM_COMPAT, 1, &nvm_data);
1189 ++ if (ret_val)
1190 ++ goto out;
1191 ++
1192 ++ /* Check for LOM (vs. NIC) or one of two valid mezzanine cards */
1193 ++ if (!((nvm_data & NVM_COMPAT_LOM) ||
1194 ++ (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_DUAL) ||
1195 ++ (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD)))
1196 ++ goto out;
1197 ++
1198 + ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1,
1199 + &nvm_alt_mac_addr_offset);
1200 + if (ret_val) {
1201 +diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
1202 +index ea90997..a350147 100644
1203 +--- a/drivers/net/wireless/ath/ath5k/base.c
1204 ++++ b/drivers/net/wireless/ath/ath5k/base.c
1205 +@@ -48,6 +48,7 @@
1206 + #include <linux/netdevice.h>
1207 + #include <linux/cache.h>
1208 + #include <linux/pci.h>
1209 ++#include <linux/pci-aspm.h>
1210 + #include <linux/ethtool.h>
1211 + #include <linux/uaccess.h>
1212 + #include <linux/slab.h>
1213 +@@ -469,6 +470,26 @@ ath5k_pci_probe(struct pci_dev *pdev,
1214 + int ret;
1215 + u8 csz;
1216 +
1217 ++ /*
1218 ++ * L0s needs to be disabled on all ath5k cards.
1219 ++ *
1220 ++ * For distributions shipping with CONFIG_PCIEASPM (this will be enabled
1221 ++ * by default in the future in 2.6.36) this will also mean both L1 and
1222 ++ * L0s will be disabled when a pre 1.1 PCIe device is detected. We do
1223 ++ * know L1 works correctly even for all ath5k pre 1.1 PCIe devices
1224 ++ * though but cannot currently undue the effect of a blacklist, for
1225 ++ * details you can read pcie_aspm_sanity_check() and see how it adjusts
1226 ++ * the device link capability.
1227 ++ *
1228 ++ * It may be possible in the future to implement some PCI API to allow
1229 ++ * drivers to override blacklists for pre 1.1 PCIe but for now it is
1230 ++ * best to accept that both L0s and L1 will be disabled completely for
1231 ++ * distributions shipping with CONFIG_PCIEASPM rather than having this
1232 ++ * issue present. Motivation for adding this new API will be to help
1233 ++ * with power consumption for some of these devices.
1234 ++ */
1235 ++ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S);
1236 ++
1237 + ret = pci_enable_device(pdev);
1238 + if (ret) {
1239 + dev_err(&pdev->dev, "can't enable device\n");
1240 +diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c
1241 +index a37b30c..ce3722f 100644
1242 +--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
1243 ++++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
1244 +@@ -484,7 +484,7 @@ int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout)
1245 +
1246 + cmd->timeout = timeout;
1247 +
1248 +- ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd));
1249 ++ ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, cmd, sizeof(*cmd));
1250 + if (ret < 0) {
1251 + wl1251_error("cmd trigger scan to failed: %d", ret);
1252 + goto out;
1253 +diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
1254 +index 7c3d03b..cfcf868 100644
1255 +--- a/drivers/pcmcia/pcmcia_resource.c
1256 ++++ b/drivers/pcmcia/pcmcia_resource.c
1257 +@@ -41,7 +41,7 @@ module_param(io_speed, int, 0444);
1258 + #ifdef CONFIG_PCMCIA_PROBE
1259 + #include <asm/irq.h>
1260 + /* mask of IRQs already reserved by other cards, we should avoid using them */
1261 +-static u8 pcmcia_used_irq[NR_IRQS];
1262 ++static u8 pcmcia_used_irq[32];
1263 + #endif
1264 +
1265 + static int pcmcia_adjust_io_region(struct resource *res, unsigned long start,
1266 +@@ -768,6 +768,9 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
1267 + for (try = 0; try < 64; try++) {
1268 + irq = try % 32;
1269 +
1270 ++ if (irq > NR_IRQS)
1271 ++ continue;
1272 ++
1273 + /* marked as available by driver, and not blocked by userspace? */
1274 + if (!((mask >> irq) & 1))
1275 + continue;
1276 +diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
1277 +index 71ff154..90111d7 100644
1278 +--- a/drivers/platform/x86/compal-laptop.c
1279 ++++ b/drivers/platform/x86/compal-laptop.c
1280 +@@ -259,6 +259,14 @@ static struct dmi_system_id __initdata compal_dmi_table[] = {
1281 + .callback = dmi_check_cb
1282 + },
1283 + {
1284 ++ .ident = "Dell Mini 1012",
1285 ++ .matches = {
1286 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1287 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"),
1288 ++ },
1289 ++ .callback = dmi_check_cb
1290 ++ },
1291 ++ {
1292 + .ident = "Dell Inspiron 11z",
1293 + .matches = {
1294 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1295 +@@ -375,5 +383,6 @@ MODULE_ALIAS("dmi:*:rnIFT00:rvrIFT00:*");
1296 + MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron910:*");
1297 + MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1010:*");
1298 + MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1011:*");
1299 ++MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1012:*");
1300 + MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1110:*");
1301 + MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1210:*");
1302 +diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
1303 +index 661e3ac..6110601 100644
1304 +--- a/drivers/platform/x86/dell-laptop.c
1305 ++++ b/drivers/platform/x86/dell-laptop.c
1306 +@@ -116,6 +116,13 @@ static struct dmi_system_id __devinitdata dell_blacklist[] = {
1307 + },
1308 + },
1309 + {
1310 ++ .ident = "Dell Mini 1012",
1311 ++ .matches = {
1312 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1313 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"),
1314 ++ },
1315 ++ },
1316 ++ {
1317 + .ident = "Dell Inspiron 11z",
1318 + .matches = {
1319 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1320 +diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
1321 +index 5a1dc8a..03713bc 100644
1322 +--- a/drivers/regulator/wm8994-regulator.c
1323 ++++ b/drivers/regulator/wm8994-regulator.c
1324 +@@ -219,8 +219,6 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
1325 +
1326 + ldo->wm8994 = wm8994;
1327 +
1328 +- ldo->is_enabled = true;
1329 +-
1330 + if (pdata->ldo[id].enable && gpio_is_valid(pdata->ldo[id].enable)) {
1331 + ldo->enable = pdata->ldo[id].enable;
1332 +
1333 +@@ -237,7 +235,8 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
1334 + ret);
1335 + goto err_gpio;
1336 + }
1337 +- }
1338 ++ } else
1339 ++ ldo->is_enabled = true;
1340 +
1341 + ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &pdev->dev,
1342 + pdata->ldo[id].init_data, ldo);
1343 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1344 +index 40cba25..632a7b6 100644
1345 +--- a/drivers/usb/host/xhci-ring.c
1346 ++++ b/drivers/usb/host/xhci-ring.c
1347 +@@ -125,7 +125,7 @@ static void next_trb(struct xhci_hcd *xhci,
1348 + *seg = (*seg)->next;
1349 + *trb = ((*seg)->trbs);
1350 + } else {
1351 +- *trb = (*trb)++;
1352 ++ (*trb)++;
1353 + }
1354 + }
1355 +
1356 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1357 +index 2128d2c..2d36ed2 100644
1358 +--- a/drivers/usb/serial/cp210x.c
1359 ++++ b/drivers/usb/serial/cp210x.c
1360 +@@ -223,8 +223,8 @@ static struct usb_serial_driver cp210x_device = {
1361 + #define BITS_STOP_2 0x0002
1362 +
1363 + /* CP210X_SET_BREAK */
1364 +-#define BREAK_ON 0x0000
1365 +-#define BREAK_OFF 0x0001
1366 ++#define BREAK_ON 0x0001
1367 ++#define BREAK_OFF 0x0000
1368 +
1369 + /* CP210X_(SET_MHS|GET_MDMSTS) */
1370 + #define CONTROL_DTR 0x0001
1371 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1372 +index 738383a..ce929e4 100644
1373 +--- a/drivers/usb/serial/ftdi_sio.c
1374 ++++ b/drivers/usb/serial/ftdi_sio.c
1375 +@@ -185,6 +185,7 @@ static struct usb_device_id id_table_combined [] = {
1376 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
1377 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
1378 + { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
1379 ++ { USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) },
1380 + { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) },
1381 + { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) },
1382 + { USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) },
1383 +@@ -756,6 +757,8 @@ static struct usb_device_id id_table_combined [] = {
1384 + { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
1385 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1386 + { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
1387 ++ { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
1388 ++ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1389 + { }, /* Optional parameter entry */
1390 + { } /* Terminating entry */
1391 + };
1392 +@@ -1399,7 +1402,7 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port)
1393 + }
1394 +
1395 + /* set max packet size based on descriptor */
1396 +- priv->max_packet_size = ep_desc->wMaxPacketSize;
1397 ++ priv->max_packet_size = le16_to_cpu(ep_desc->wMaxPacketSize);
1398 +
1399 + dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
1400 + }
1401 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1402 +index c101821..792f005 100644
1403 +--- a/drivers/usb/serial/ftdi_sio_ids.h
1404 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
1405 +@@ -110,6 +110,9 @@
1406 + /* Propox devices */
1407 + #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738
1408 +
1409 ++/* Lenz LI-USB Computer Interface. */
1410 ++#define FTDI_LENZ_LIUSB_PID 0xD780
1411 ++
1412 + /*
1413 + * Xsens Technologies BV products (http://www.xsens.com).
1414 + */
1415 +@@ -996,6 +999,12 @@
1416 + #define ALTI2_N3_PID 0x6001 /* Neptune 3 */
1417 +
1418 + /*
1419 ++ * Ionics PlugComputer
1420 ++ */
1421 ++#define IONICS_VID 0x1c0c
1422 ++#define IONICS_PLUGCOMPUTER_PID 0x0102
1423 ++
1424 ++/*
1425 + * Dresden Elektronik Sensor Terminal Board
1426 + */
1427 + #define DE_VID 0x1cf1 /* Vendor ID */
1428 +diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
1429 +index aa876f7..b6e8908 100644
1430 +--- a/drivers/usb/serial/io_ti.c
1431 ++++ b/drivers/usb/serial/io_ti.c
1432 +@@ -1174,7 +1174,7 @@ static int download_fw(struct edgeport_serial *serial)
1433 +
1434 + /* Check if we have an old version in the I2C and
1435 + update if necessary */
1436 +- if (download_cur_ver != download_new_ver) {
1437 ++ if (download_cur_ver < download_new_ver) {
1438 + dbg("%s - Update I2C dld from %d.%d to %d.%d",
1439 + __func__,
1440 + firmware_version->Ver_Major,
1441 +diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
1442 +index a6b207c..1f00f24 100644
1443 +--- a/drivers/usb/serial/navman.c
1444 ++++ b/drivers/usb/serial/navman.c
1445 +@@ -25,6 +25,7 @@ static int debug;
1446 +
1447 + static const struct usb_device_id id_table[] = {
1448 + { USB_DEVICE(0x0a99, 0x0001) }, /* Talon Technology device */
1449 ++ { USB_DEVICE(0x0df7, 0x0900) }, /* Mobile Action i-gotU */
1450 + { },
1451 + };
1452 + MODULE_DEVICE_TABLE(usb, id_table);
1453 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1454 +index 20d1585..0e8abb5 100644
1455 +--- a/drivers/usb/serial/option.c
1456 ++++ b/drivers/usb/serial/option.c
1457 +@@ -389,6 +389,10 @@ static int option_resume(struct usb_serial *serial);
1458 + #define OLIVETTI_VENDOR_ID 0x0b3c
1459 + #define OLIVETTI_PRODUCT_OLICARD100 0xc000
1460 +
1461 ++/* Celot products */
1462 ++#define CELOT_VENDOR_ID 0x211f
1463 ++#define CELOT_PRODUCT_CT680M 0x6801
1464 ++
1465 + /* some devices interfaces need special handling due to a number of reasons */
1466 + enum option_blacklist_reason {
1467 + OPTION_BLACKLIST_NONE = 0,
1468 +@@ -912,10 +916,9 @@ static const struct usb_device_id option_ids[] = {
1469 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
1470 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
1471 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
1472 +-
1473 + { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
1474 +-
1475 + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
1476 ++ { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
1477 + { } /* Terminating entry */
1478 + };
1479 + MODULE_DEVICE_TABLE(usb, option_ids);
1480 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1481 +index c28b160..89609e1 100644
1482 +--- a/drivers/usb/serial/pl2303.c
1483 ++++ b/drivers/usb/serial/pl2303.c
1484 +@@ -96,6 +96,7 @@ static const struct usb_device_id id_table[] = {
1485 + { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) },
1486 + { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) },
1487 + { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) },
1488 ++ { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) },
1489 + { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
1490 + { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
1491 + { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
1492 +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1493 +index 23c09b3..e8b7c5b 100644
1494 +--- a/drivers/usb/serial/pl2303.h
1495 ++++ b/drivers/usb/serial/pl2303.h
1496 +@@ -128,6 +128,10 @@
1497 + #define CRESSI_VENDOR_ID 0x04b8
1498 + #define CRESSI_EDY_PRODUCT_ID 0x0521
1499 +
1500 ++/* Zeagle dive computer interface */
1501 ++#define ZEAGLE_VENDOR_ID 0x04b8
1502 ++#define ZEAGLE_N2ITION3_PRODUCT_ID 0x0522
1503 ++
1504 + /* Sony, USB data cable for CMD-Jxx mobile phones */
1505 + #define SONY_VENDOR_ID 0x054c
1506 + #define SONY_QN3USB_PRODUCT_ID 0x0437
1507 +diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
1508 +index f3a4e15..f96a471 100644
1509 +--- a/drivers/video/matrox/matroxfb_base.h
1510 ++++ b/drivers/video/matrox/matroxfb_base.h
1511 +@@ -151,13 +151,13 @@ static inline void mga_writel(vaddr_t va, unsigned int offs, u_int32_t value) {
1512 + static inline void mga_memcpy_toio(vaddr_t va, const void* src, int len) {
1513 + #if defined(__alpha__) || defined(__i386__) || defined(__x86_64__)
1514 + /*
1515 +- * memcpy_toio works for us if:
1516 ++ * iowrite32_rep works for us if:
1517 + * (1) Copies data as 32bit quantities, not byte after byte,
1518 + * (2) Performs LE ordered stores, and
1519 + * (3) It copes with unaligned source (destination is guaranteed to be page
1520 + * aligned and length is guaranteed to be multiple of 4).
1521 + */
1522 +- memcpy_toio(va.vaddr, src, len);
1523 ++ iowrite32_rep(va.vaddr, src, len >> 2);
1524 + #else
1525 + u_int32_t __iomem* addr = va.vaddr;
1526 +
1527 +diff --git a/firmware/Makefile b/firmware/Makefile
1528 +index 8af0fc7..955c7e7 100644
1529 +--- a/firmware/Makefile
1530 ++++ b/firmware/Makefile
1531 +@@ -141,7 +141,7 @@ fw-shipped-$(CONFIG_YAM) += yam/1200.bin yam/9600.bin
1532 + fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-)
1533 +
1534 + # Directories which we _might_ need to create, so we have a rule for them.
1535 +-firmware-dirs := $(sort $(patsubst %,$(objtree)/$(obj)/%/,$(dir $(fw-external-y) $(fw-shipped-all))))
1536 ++firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
1537 +
1538 + quiet_cmd_mkdir = MKDIR $(patsubst $(objtree)/%,%,$@)
1539 + cmd_mkdir = mkdir -p $@
1540 +diff --git a/fs/nfs/super.c b/fs/nfs/super.c
1541 +index f35316c..ae570b0 100644
1542 +--- a/fs/nfs/super.c
1543 ++++ b/fs/nfs/super.c
1544 +@@ -648,6 +648,13 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
1545 +
1546 + if (nfss->options & NFS_OPTION_FSCACHE)
1547 + seq_printf(m, ",fsc");
1548 ++
1549 ++ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
1550 ++ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
1551 ++ seq_printf(m, ",lookupcache=none");
1552 ++ else
1553 ++ seq_printf(m, ",lookupcache=pos");
1554 ++ }
1555 + }
1556 +
1557 + /*
1558 +diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
1559 +index 48145f5..fadefe1 100644
1560 +--- a/fs/nilfs2/super.c
1561 ++++ b/fs/nilfs2/super.c
1562 +@@ -360,9 +360,10 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
1563 + list_add(&sbi->s_list, &nilfs->ns_supers);
1564 + up_write(&nilfs->ns_super_sem);
1565 +
1566 ++ err = -ENOMEM;
1567 + sbi->s_ifile = nilfs_ifile_new(sbi, nilfs->ns_inode_size);
1568 + if (!sbi->s_ifile)
1569 +- return -ENOMEM;
1570 ++ goto delist;
1571 +
1572 + down_read(&nilfs->ns_segctor_sem);
1573 + err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp,
1574 +@@ -393,6 +394,7 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
1575 + nilfs_mdt_destroy(sbi->s_ifile);
1576 + sbi->s_ifile = NULL;
1577 +
1578 ++ delist:
1579 + down_write(&nilfs->ns_super_sem);
1580 + list_del_init(&sbi->s_list);
1581 + up_write(&nilfs->ns_super_sem);
1582 +diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
1583 +index e13fc9e..9ad30db 100644
1584 +--- a/fs/ocfs2/acl.c
1585 ++++ b/fs/ocfs2/acl.c
1586 +@@ -290,12 +290,30 @@ static int ocfs2_set_acl(handle_t *handle,
1587 +
1588 + int ocfs2_check_acl(struct inode *inode, int mask)
1589 + {
1590 +- struct posix_acl *acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
1591 ++ struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1592 ++ struct buffer_head *di_bh = NULL;
1593 ++ struct posix_acl *acl;
1594 ++ int ret = -EAGAIN;
1595 +
1596 +- if (IS_ERR(acl))
1597 ++ if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
1598 ++ return ret;
1599 ++
1600 ++ ret = ocfs2_read_inode_block(inode, &di_bh);
1601 ++ if (ret < 0) {
1602 ++ mlog_errno(ret);
1603 ++ return ret;
1604 ++ }
1605 ++
1606 ++ acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, di_bh);
1607 ++
1608 ++ brelse(di_bh);
1609 ++
1610 ++ if (IS_ERR(acl)) {
1611 ++ mlog_errno(PTR_ERR(acl));
1612 + return PTR_ERR(acl);
1613 ++ }
1614 + if (acl) {
1615 +- int ret = posix_acl_permission(inode, acl, mask);
1616 ++ ret = posix_acl_permission(inode, acl, mask);
1617 + posix_acl_release(acl);
1618 + return ret;
1619 + }
1620 +@@ -344,7 +362,7 @@ int ocfs2_init_acl(handle_t *handle,
1621 + {
1622 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1623 + struct posix_acl *acl = NULL;
1624 +- int ret = 0;
1625 ++ int ret = 0, ret2;
1626 + mode_t mode;
1627 +
1628 + if (!S_ISLNK(inode->i_mode)) {
1629 +@@ -381,7 +399,12 @@ int ocfs2_init_acl(handle_t *handle,
1630 + mode = inode->i_mode;
1631 + ret = posix_acl_create_masq(clone, &mode);
1632 + if (ret >= 0) {
1633 +- ret = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
1634 ++ ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
1635 ++ if (ret2) {
1636 ++ mlog_errno(ret2);
1637 ++ ret = ret2;
1638 ++ goto cleanup;
1639 ++ }
1640 + if (ret > 0) {
1641 + ret = ocfs2_set_acl(handle, inode,
1642 + di_bh, ACL_TYPE_ACCESS,
1643 +diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
1644 +index 9289b43..f9ea9d0 100644
1645 +--- a/fs/ocfs2/dlm/dlmmaster.c
1646 ++++ b/fs/ocfs2/dlm/dlmmaster.c
1647 +@@ -511,8 +511,6 @@ static void dlm_lockres_release(struct kref *kref)
1648 +
1649 + atomic_dec(&dlm->res_cur_count);
1650 +
1651 +- dlm_put(dlm);
1652 +-
1653 + if (!hlist_unhashed(&res->hash_node) ||
1654 + !list_empty(&res->granted) ||
1655 + !list_empty(&res->converting) ||
1656 +@@ -585,8 +583,6 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
1657 + res->migration_pending = 0;
1658 + res->inflight_locks = 0;
1659 +
1660 +- /* put in dlm_lockres_release */
1661 +- dlm_grab(dlm);
1662 + res->dlm = dlm;
1663 +
1664 + kref_init(&res->refs);
1665 +@@ -3044,8 +3040,6 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
1666 + /* check for pre-existing lock */
1667 + spin_lock(&dlm->spinlock);
1668 + res = __dlm_lookup_lockres(dlm, name, namelen, hash);
1669 +- spin_lock(&dlm->master_lock);
1670 +-
1671 + if (res) {
1672 + spin_lock(&res->spinlock);
1673 + if (res->state & DLM_LOCK_RES_RECOVERING) {
1674 +@@ -3063,14 +3057,15 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
1675 + spin_unlock(&res->spinlock);
1676 + }
1677 +
1678 ++ spin_lock(&dlm->master_lock);
1679 + /* ignore status. only nonzero status would BUG. */
1680 + ret = dlm_add_migration_mle(dlm, res, mle, &oldmle,
1681 + name, namelen,
1682 + migrate->new_master,
1683 + migrate->master);
1684 +
1685 +-unlock:
1686 + spin_unlock(&dlm->master_lock);
1687 ++unlock:
1688 + spin_unlock(&dlm->spinlock);
1689 +
1690 + if (oldmle) {
1691 +diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
1692 +index b4f99de..0cadae2 100644
1693 +--- a/fs/ocfs2/dlm/dlmrecovery.c
1694 ++++ b/fs/ocfs2/dlm/dlmrecovery.c
1695 +@@ -1991,6 +1991,8 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm,
1696 + struct list_head *queue;
1697 + struct dlm_lock *lock, *next;
1698 +
1699 ++ assert_spin_locked(&dlm->spinlock);
1700 ++ assert_spin_locked(&res->spinlock);
1701 + res->state |= DLM_LOCK_RES_RECOVERING;
1702 + if (!list_empty(&res->recovering)) {
1703 + mlog(0,
1704 +@@ -2320,19 +2322,15 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
1705 + /* zero the lvb if necessary */
1706 + dlm_revalidate_lvb(dlm, res, dead_node);
1707 + if (res->owner == dead_node) {
1708 +- if (res->state & DLM_LOCK_RES_DROPPING_REF)
1709 +- mlog(0, "%s:%.*s: owned by "
1710 +- "dead node %u, this node was "
1711 +- "dropping its ref when it died. "
1712 +- "continue, dropping the flag.\n",
1713 +- dlm->name, res->lockname.len,
1714 +- res->lockname.name, dead_node);
1715 +-
1716 +- /* the wake_up for this will happen when the
1717 +- * RECOVERING flag is dropped later */
1718 +- res->state &= ~DLM_LOCK_RES_DROPPING_REF;
1719 ++ if (res->state & DLM_LOCK_RES_DROPPING_REF) {
1720 ++ mlog(ML_NOTICE, "Ignore %.*s for "
1721 ++ "recovery as it is being freed\n",
1722 ++ res->lockname.len,
1723 ++ res->lockname.name);
1724 ++ } else
1725 ++ dlm_move_lockres_to_recovery_list(dlm,
1726 ++ res);
1727 +
1728 +- dlm_move_lockres_to_recovery_list(dlm, res);
1729 + } else if (res->owner == dlm->node_num) {
1730 + dlm_free_dead_locks(dlm, res, dead_node);
1731 + __dlm_lockres_calc_usage(dlm, res);
1732 +diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
1733 +index 11a6d1f..47e32c0 100644
1734 +--- a/fs/ocfs2/dlm/dlmthread.c
1735 ++++ b/fs/ocfs2/dlm/dlmthread.c
1736 +@@ -92,19 +92,27 @@ int __dlm_lockres_has_locks(struct dlm_lock_resource *res)
1737 + * truly ready to be freed. */
1738 + int __dlm_lockres_unused(struct dlm_lock_resource *res)
1739 + {
1740 +- if (!__dlm_lockres_has_locks(res) &&
1741 +- (list_empty(&res->dirty) && !(res->state & DLM_LOCK_RES_DIRTY))) {
1742 +- /* try not to scan the bitmap unless the first two
1743 +- * conditions are already true */
1744 +- int bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
1745 +- if (bit >= O2NM_MAX_NODES) {
1746 +- /* since the bit for dlm->node_num is not
1747 +- * set, inflight_locks better be zero */
1748 +- BUG_ON(res->inflight_locks != 0);
1749 +- return 1;
1750 +- }
1751 +- }
1752 +- return 0;
1753 ++ int bit;
1754 ++
1755 ++ if (__dlm_lockres_has_locks(res))
1756 ++ return 0;
1757 ++
1758 ++ if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY)
1759 ++ return 0;
1760 ++
1761 ++ if (res->state & DLM_LOCK_RES_RECOVERING)
1762 ++ return 0;
1763 ++
1764 ++ bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
1765 ++ if (bit < O2NM_MAX_NODES)
1766 ++ return 0;
1767 ++
1768 ++ /*
1769 ++ * since the bit for dlm->node_num is not set, inflight_locks better
1770 ++ * be zero
1771 ++ */
1772 ++ BUG_ON(res->inflight_locks != 0);
1773 ++ return 1;
1774 + }
1775 +
1776 +
1777 +@@ -152,45 +160,25 @@ void dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
1778 + spin_unlock(&dlm->spinlock);
1779 + }
1780 +
1781 +-static int dlm_purge_lockres(struct dlm_ctxt *dlm,
1782 ++static void dlm_purge_lockres(struct dlm_ctxt *dlm,
1783 + struct dlm_lock_resource *res)
1784 + {
1785 + int master;
1786 + int ret = 0;
1787 +
1788 +- spin_lock(&res->spinlock);
1789 +- if (!__dlm_lockres_unused(res)) {
1790 +- mlog(0, "%s:%.*s: tried to purge but not unused\n",
1791 +- dlm->name, res->lockname.len, res->lockname.name);
1792 +- __dlm_print_one_lock_resource(res);
1793 +- spin_unlock(&res->spinlock);
1794 +- BUG();
1795 +- }
1796 +-
1797 +- if (res->state & DLM_LOCK_RES_MIGRATING) {
1798 +- mlog(0, "%s:%.*s: Delay dropref as this lockres is "
1799 +- "being remastered\n", dlm->name, res->lockname.len,
1800 +- res->lockname.name);
1801 +- /* Re-add the lockres to the end of the purge list */
1802 +- if (!list_empty(&res->purge)) {
1803 +- list_del_init(&res->purge);
1804 +- list_add_tail(&res->purge, &dlm->purge_list);
1805 +- }
1806 +- spin_unlock(&res->spinlock);
1807 +- return 0;
1808 +- }
1809 ++ assert_spin_locked(&dlm->spinlock);
1810 ++ assert_spin_locked(&res->spinlock);
1811 +
1812 + master = (res->owner == dlm->node_num);
1813 +
1814 +- if (!master)
1815 +- res->state |= DLM_LOCK_RES_DROPPING_REF;
1816 +- spin_unlock(&res->spinlock);
1817 +
1818 + mlog(0, "purging lockres %.*s, master = %d\n", res->lockname.len,
1819 + res->lockname.name, master);
1820 +
1821 + if (!master) {
1822 ++ res->state |= DLM_LOCK_RES_DROPPING_REF;
1823 + /* drop spinlock... retake below */
1824 ++ spin_unlock(&res->spinlock);
1825 + spin_unlock(&dlm->spinlock);
1826 +
1827 + spin_lock(&res->spinlock);
1828 +@@ -208,31 +196,35 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
1829 + mlog(0, "%s:%.*s: dlm_deref_lockres returned %d\n",
1830 + dlm->name, res->lockname.len, res->lockname.name, ret);
1831 + spin_lock(&dlm->spinlock);
1832 ++ spin_lock(&res->spinlock);
1833 + }
1834 +
1835 +- spin_lock(&res->spinlock);
1836 + if (!list_empty(&res->purge)) {
1837 + mlog(0, "removing lockres %.*s:%p from purgelist, "
1838 + "master = %d\n", res->lockname.len, res->lockname.name,
1839 + res, master);
1840 + list_del_init(&res->purge);
1841 +- spin_unlock(&res->spinlock);
1842 + dlm_lockres_put(res);
1843 + dlm->purge_count--;
1844 +- } else
1845 +- spin_unlock(&res->spinlock);
1846 ++ }
1847 ++
1848 ++ if (!__dlm_lockres_unused(res)) {
1849 ++ mlog(ML_ERROR, "found lockres %s:%.*s: in use after deref\n",
1850 ++ dlm->name, res->lockname.len, res->lockname.name);
1851 ++ __dlm_print_one_lock_resource(res);
1852 ++ BUG();
1853 ++ }
1854 +
1855 + __dlm_unhash_lockres(res);
1856 +
1857 + /* lockres is not in the hash now. drop the flag and wake up
1858 + * any processes waiting in dlm_get_lock_resource. */
1859 + if (!master) {
1860 +- spin_lock(&res->spinlock);
1861 + res->state &= ~DLM_LOCK_RES_DROPPING_REF;
1862 + spin_unlock(&res->spinlock);
1863 + wake_up(&res->wq);
1864 +- }
1865 +- return 0;
1866 ++ } else
1867 ++ spin_unlock(&res->spinlock);
1868 + }
1869 +
1870 + static void dlm_run_purge_list(struct dlm_ctxt *dlm,
1871 +@@ -251,17 +243,7 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
1872 + lockres = list_entry(dlm->purge_list.next,
1873 + struct dlm_lock_resource, purge);
1874 +
1875 +- /* Status of the lockres *might* change so double
1876 +- * check. If the lockres is unused, holding the dlm
1877 +- * spinlock will prevent people from getting and more
1878 +- * refs on it -- there's no need to keep the lockres
1879 +- * spinlock. */
1880 + spin_lock(&lockres->spinlock);
1881 +- unused = __dlm_lockres_unused(lockres);
1882 +- spin_unlock(&lockres->spinlock);
1883 +-
1884 +- if (!unused)
1885 +- continue;
1886 +
1887 + purge_jiffies = lockres->last_used +
1888 + msecs_to_jiffies(DLM_PURGE_INTERVAL_MS);
1889 +@@ -273,15 +255,29 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
1890 + * in tail order, we can stop at the first
1891 + * unpurgable resource -- anyone added after
1892 + * him will have a greater last_used value */
1893 ++ spin_unlock(&lockres->spinlock);
1894 + break;
1895 + }
1896 +
1897 ++ /* Status of the lockres *might* change so double
1898 ++ * check. If the lockres is unused, holding the dlm
1899 ++ * spinlock will prevent people from getting and more
1900 ++ * refs on it. */
1901 ++ unused = __dlm_lockres_unused(lockres);
1902 ++ if (!unused ||
1903 ++ (lockres->state & DLM_LOCK_RES_MIGRATING)) {
1904 ++ mlog(0, "lockres %s:%.*s: is in use or "
1905 ++ "being remastered, used %d, state %d\n",
1906 ++ dlm->name, lockres->lockname.len,
1907 ++ lockres->lockname.name, !unused, lockres->state);
1908 ++ list_move_tail(&dlm->purge_list, &lockres->purge);
1909 ++ spin_unlock(&lockres->spinlock);
1910 ++ continue;
1911 ++ }
1912 ++
1913 + dlm_lockres_get(lockres);
1914 +
1915 +- /* This may drop and reacquire the dlm spinlock if it
1916 +- * has to do migration. */
1917 +- if (dlm_purge_lockres(dlm, lockres))
1918 +- BUG();
1919 ++ dlm_purge_lockres(dlm, lockres);
1920 +
1921 + dlm_lockres_put(lockres);
1922 +
1923 +diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
1924 +index 5cbcd0f..9e6dc1d 100644
1925 +--- a/fs/ocfs2/refcounttree.c
1926 ++++ b/fs/ocfs2/refcounttree.c
1927 +@@ -2437,16 +2437,26 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
1928 + len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) +
1929 + le32_to_cpu(rec.r_clusters)) - cpos;
1930 + /*
1931 +- * If the refcount rec already exist, cool. We just need
1932 +- * to check whether there is a split. Otherwise we just need
1933 +- * to increase the refcount.
1934 +- * If we will insert one, increases recs_add.
1935 +- *
1936 + * We record all the records which will be inserted to the
1937 + * same refcount block, so that we can tell exactly whether
1938 + * we need a new refcount block or not.
1939 ++ *
1940 ++ * If we will insert a new one, this is easy and only happens
1941 ++ * during adding refcounted flag to the extent, so we don't
1942 ++ * have a chance of spliting. We just need one record.
1943 ++ *
1944 ++ * If the refcount rec already exists, that would be a little
1945 ++ * complicated. we may have to:
1946 ++ * 1) split at the beginning if the start pos isn't aligned.
1947 ++ * we need 1 more record in this case.
1948 ++ * 2) split int the end if the end pos isn't aligned.
1949 ++ * we need 1 more record in this case.
1950 ++ * 3) split in the middle because of file system fragmentation.
1951 ++ * we need 2 more records in this case(we can't detect this
1952 ++ * beforehand, so always think of the worst case).
1953 + */
1954 + if (rec.r_refcount) {
1955 ++ recs_add += 2;
1956 + /* Check whether we need a split at the beginning. */
1957 + if (cpos == start_cpos &&
1958 + cpos != le64_to_cpu(rec.r_cpos))
1959 +diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
1960 +index b8bb9a6..ee7e258 100644
1961 +--- a/include/linux/mm_types.h
1962 ++++ b/include/linux/mm_types.h
1963 +@@ -134,7 +134,7 @@ struct vm_area_struct {
1964 + within vm_mm. */
1965 +
1966 + /* linked list of VM areas per task, sorted by address */
1967 +- struct vm_area_struct *vm_next;
1968 ++ struct vm_area_struct *vm_next, *vm_prev;
1969 +
1970 + pgprot_t vm_page_prot; /* Access permissions of this VMA. */
1971 + unsigned long vm_flags; /* Flags, see mm.h. */
1972 +diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
1973 +index 6a664c3..7dc97d1 100644
1974 +--- a/include/sound/emu10k1.h
1975 ++++ b/include/sound/emu10k1.h
1976 +@@ -1707,6 +1707,7 @@ struct snd_emu10k1 {
1977 + unsigned int card_type; /* EMU10K1_CARD_* */
1978 + unsigned int ecard_ctrl; /* ecard control bits */
1979 + unsigned long dma_mask; /* PCI DMA mask */
1980 ++ unsigned int delay_pcm_irq; /* in samples */
1981 + int max_cache_pages; /* max memory size / PAGE_SIZE */
1982 + struct snd_dma_buffer silent_page; /* silent page */
1983 + struct snd_dma_buffer ptb_pages; /* page table pages */
1984 +diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
1985 +index 9496b96..fa8223a 100644
1986 +--- a/include/trace/events/timer.h
1987 ++++ b/include/trace/events/timer.h
1988 +@@ -74,14 +74,16 @@ TRACE_EVENT(timer_expire_entry,
1989 + TP_STRUCT__entry(
1990 + __field( void *, timer )
1991 + __field( unsigned long, now )
1992 ++ __field( void *, function)
1993 + ),
1994 +
1995 + TP_fast_assign(
1996 + __entry->timer = timer;
1997 + __entry->now = jiffies;
1998 ++ __entry->function = timer->function;
1999 + ),
2000 +
2001 +- TP_printk("timer=%p now=%lu", __entry->timer, __entry->now)
2002 ++ TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now)
2003 + );
2004 +
2005 + /**
2006 +@@ -213,14 +215,16 @@ TRACE_EVENT(hrtimer_expire_entry,
2007 + TP_STRUCT__entry(
2008 + __field( void *, hrtimer )
2009 + __field( s64, now )
2010 ++ __field( void *, function)
2011 + ),
2012 +
2013 + TP_fast_assign(
2014 + __entry->hrtimer = hrtimer;
2015 + __entry->now = now->tv64;
2016 ++ __entry->function = hrtimer->function;
2017 + ),
2018 +
2019 +- TP_printk("hrtimer=%p now=%llu", __entry->hrtimer,
2020 ++ TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function,
2021 + (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
2022 + );
2023 +
2024 +diff --git a/kernel/fork.c b/kernel/fork.c
2025 +index 4c14942..32fdbd4 100644
2026 +--- a/kernel/fork.c
2027 ++++ b/kernel/fork.c
2028 +@@ -287,7 +287,7 @@ out:
2029 + #ifdef CONFIG_MMU
2030 + static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
2031 + {
2032 +- struct vm_area_struct *mpnt, *tmp, **pprev;
2033 ++ struct vm_area_struct *mpnt, *tmp, *prev, **pprev;
2034 + struct rb_node **rb_link, *rb_parent;
2035 + int retval;
2036 + unsigned long charge;
2037 +@@ -315,6 +315,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
2038 + if (retval)
2039 + goto out;
2040 +
2041 ++ prev = NULL;
2042 + for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
2043 + struct file *file;
2044 +
2045 +@@ -346,7 +347,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
2046 + goto fail_nomem_anon_vma_fork;
2047 + tmp->vm_flags &= ~VM_LOCKED;
2048 + tmp->vm_mm = mm;
2049 +- tmp->vm_next = NULL;
2050 ++ tmp->vm_next = tmp->vm_prev = NULL;
2051 + file = tmp->vm_file;
2052 + if (file) {
2053 + struct inode *inode = file->f_path.dentry->d_inode;
2054 +@@ -379,6 +380,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
2055 + */
2056 + *pprev = tmp;
2057 + pprev = &tmp->vm_next;
2058 ++ tmp->vm_prev = prev;
2059 ++ prev = tmp;
2060 +
2061 + __vma_link_rb(mm, tmp, rb_link, rb_parent);
2062 + rb_link = &tmp->vm_rb.rb_right;
2063 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
2064 +index 41ca394..1b6197a 100644
2065 +--- a/kernel/trace/ring_buffer.c
2066 ++++ b/kernel/trace/ring_buffer.c
2067 +@@ -3757,6 +3757,9 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
2068 + rpos = reader->read;
2069 + pos += size;
2070 +
2071 ++ if (rpos >= commit)
2072 ++ break;
2073 ++
2074 + event = rb_reader_event(cpu_buffer);
2075 + size = rb_event_length(event);
2076 + } while (len > size);
2077 +diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
2078 +index 9aed1a5..72a0d96 100644
2079 +--- a/kernel/trace/trace_functions_graph.c
2080 ++++ b/kernel/trace/trace_functions_graph.c
2081 +@@ -506,7 +506,15 @@ get_return_for_leaf(struct trace_iterator *iter,
2082 + * if the output fails.
2083 + */
2084 + data->ent = *curr;
2085 +- data->ret = *next;
2086 ++ /*
2087 ++ * If the next event is not a return type, then
2088 ++ * we only care about what type it is. Otherwise we can
2089 ++ * safely copy the entire event.
2090 ++ */
2091 ++ if (next->ent.type == TRACE_GRAPH_RET)
2092 ++ data->ret = *next;
2093 ++ else
2094 ++ data->ret.ent.type = next->ent.type;
2095 + }
2096 + }
2097 +
2098 +diff --git a/mm/memory.c b/mm/memory.c
2099 +index e48eb86..47fb0a0 100644
2100 +--- a/mm/memory.c
2101 ++++ b/mm/memory.c
2102 +@@ -2761,11 +2761,18 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo
2103 + {
2104 + address &= PAGE_MASK;
2105 + if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
2106 +- address -= PAGE_SIZE;
2107 +- if (find_vma(vma->vm_mm, address) != vma)
2108 +- return -ENOMEM;
2109 ++ struct vm_area_struct *prev = vma->vm_prev;
2110 ++
2111 ++ /*
2112 ++ * Is there a mapping abutting this one below?
2113 ++ *
2114 ++ * That's only ok if it's the same stack mapping
2115 ++ * that has gotten split..
2116 ++ */
2117 ++ if (prev && prev->vm_end == address)
2118 ++ return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
2119 +
2120 +- expand_stack(vma, address);
2121 ++ expand_stack(vma, address - PAGE_SIZE);
2122 + }
2123 + return 0;
2124 + }
2125 +diff --git a/mm/mlock.c b/mm/mlock.c
2126 +index 8268859..5e57ebc 100644
2127 +--- a/mm/mlock.c
2128 ++++ b/mm/mlock.c
2129 +@@ -135,6 +135,19 @@ void munlock_vma_page(struct page *page)
2130 + }
2131 + }
2132 +
2133 ++/* Is the vma a continuation of the stack vma above it? */
2134 ++static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr)
2135 ++{
2136 ++ return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);
2137 ++}
2138 ++
2139 ++static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)
2140 ++{
2141 ++ return (vma->vm_flags & VM_GROWSDOWN) &&
2142 ++ (vma->vm_start == addr) &&
2143 ++ !vma_stack_continue(vma->vm_prev, addr);
2144 ++}
2145 ++
2146 + /**
2147 + * __mlock_vma_pages_range() - mlock a range of pages in the vma.
2148 + * @vma: target vma
2149 +@@ -168,11 +181,9 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
2150 + gup_flags |= FOLL_WRITE;
2151 +
2152 + /* We don't try to access the guard page of a stack vma */
2153 +- if (vma->vm_flags & VM_GROWSDOWN) {
2154 +- if (start == vma->vm_start) {
2155 +- start += PAGE_SIZE;
2156 +- nr_pages--;
2157 +- }
2158 ++ if (stack_guard_page(vma, start)) {
2159 ++ addr += PAGE_SIZE;
2160 ++ nr_pages--;
2161 + }
2162 +
2163 + while (nr_pages > 0) {
2164 +diff --git a/mm/mmap.c b/mm/mmap.c
2165 +index 456ec6f..3867cfc 100644
2166 +--- a/mm/mmap.c
2167 ++++ b/mm/mmap.c
2168 +@@ -388,17 +388,23 @@ static inline void
2169 + __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
2170 + struct vm_area_struct *prev, struct rb_node *rb_parent)
2171 + {
2172 ++ struct vm_area_struct *next;
2173 ++
2174 ++ vma->vm_prev = prev;
2175 + if (prev) {
2176 +- vma->vm_next = prev->vm_next;
2177 ++ next = prev->vm_next;
2178 + prev->vm_next = vma;
2179 + } else {
2180 + mm->mmap = vma;
2181 + if (rb_parent)
2182 +- vma->vm_next = rb_entry(rb_parent,
2183 ++ next = rb_entry(rb_parent,
2184 + struct vm_area_struct, vm_rb);
2185 + else
2186 +- vma->vm_next = NULL;
2187 ++ next = NULL;
2188 + }
2189 ++ vma->vm_next = next;
2190 ++ if (next)
2191 ++ next->vm_prev = vma;
2192 + }
2193 +
2194 + void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma,
2195 +@@ -485,7 +491,11 @@ static inline void
2196 + __vma_unlink(struct mm_struct *mm, struct vm_area_struct *vma,
2197 + struct vm_area_struct *prev)
2198 + {
2199 +- prev->vm_next = vma->vm_next;
2200 ++ struct vm_area_struct *next = vma->vm_next;
2201 ++
2202 ++ prev->vm_next = next;
2203 ++ if (next)
2204 ++ next->vm_prev = prev;
2205 + rb_erase(&vma->vm_rb, &mm->mm_rb);
2206 + if (mm->mmap_cache == vma)
2207 + mm->mmap_cache = prev;
2208 +@@ -1900,6 +1910,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
2209 + unsigned long addr;
2210 +
2211 + insertion_point = (prev ? &prev->vm_next : &mm->mmap);
2212 ++ vma->vm_prev = NULL;
2213 + do {
2214 + rb_erase(&vma->vm_rb, &mm->mm_rb);
2215 + mm->map_count--;
2216 +@@ -1907,6 +1918,8 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
2217 + vma = vma->vm_next;
2218 + } while (vma && vma->vm_start < end);
2219 + *insertion_point = vma;
2220 ++ if (vma)
2221 ++ vma->vm_prev = prev;
2222 + tail_vma->vm_next = NULL;
2223 + if (mm->unmap_area == arch_unmap_area)
2224 + addr = prev ? prev->vm_end : mm->mmap_base;
2225 +diff --git a/mm/nommu.c b/mm/nommu.c
2226 +index 63fa17d..28994ee 100644
2227 +--- a/mm/nommu.c
2228 ++++ b/mm/nommu.c
2229 +@@ -609,7 +609,7 @@ static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
2230 + */
2231 + static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
2232 + {
2233 +- struct vm_area_struct *pvma, **pp;
2234 ++ struct vm_area_struct *pvma, **pp, *next;
2235 + struct address_space *mapping;
2236 + struct rb_node **p, *parent;
2237 +
2238 +@@ -669,8 +669,11 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
2239 + break;
2240 + }
2241 +
2242 +- vma->vm_next = *pp;
2243 ++ next = *pp;
2244 + *pp = vma;
2245 ++ vma->vm_next = next;
2246 ++ if (next)
2247 ++ next->vm_prev = vma;
2248 + }
2249 +
2250 + /*
2251 +diff --git a/mm/slab.c b/mm/slab.c
2252 +index bac0f4f..9ec5de0 100644
2253 +--- a/mm/slab.c
2254 ++++ b/mm/slab.c
2255 +@@ -2262,8 +2262,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2256 + }
2257 + #if FORCED_DEBUG && defined(CONFIG_DEBUG_PAGEALLOC)
2258 + if (size >= malloc_sizes[INDEX_L3 + 1].cs_size
2259 +- && cachep->obj_size > cache_line_size() && size < PAGE_SIZE) {
2260 +- cachep->obj_offset += PAGE_SIZE - size;
2261 ++ && cachep->obj_size > cache_line_size() && ALIGN(size, align) < PAGE_SIZE) {
2262 ++ cachep->obj_offset += PAGE_SIZE - ALIGN(size, align);
2263 + size = PAGE_SIZE;
2264 + }
2265 + #endif
2266 +diff --git a/mm/vmscan.c b/mm/vmscan.c
2267 +index 3ff3311..5c46206 100644
2268 +--- a/mm/vmscan.c
2269 ++++ b/mm/vmscan.c
2270 +@@ -1118,6 +1118,48 @@ static int too_many_isolated(struct zone *zone, int file,
2271 + }
2272 +
2273 + /*
2274 ++ * Returns true if the caller should wait to clean dirty/writeback pages.
2275 ++ *
2276 ++ * If we are direct reclaiming for contiguous pages and we do not reclaim
2277 ++ * everything in the list, try again and wait for writeback IO to complete.
2278 ++ * This will stall high-order allocations noticeably. Only do that when really
2279 ++ * need to free the pages under high memory pressure.
2280 ++ */
2281 ++static inline bool should_reclaim_stall(unsigned long nr_taken,
2282 ++ unsigned long nr_freed,
2283 ++ int priority,
2284 ++ int lumpy_reclaim,
2285 ++ struct scan_control *sc)
2286 ++{
2287 ++ int lumpy_stall_priority;
2288 ++
2289 ++ /* kswapd should not stall on sync IO */
2290 ++ if (current_is_kswapd())
2291 ++ return false;
2292 ++
2293 ++ /* Only stall on lumpy reclaim */
2294 ++ if (!lumpy_reclaim)
2295 ++ return false;
2296 ++
2297 ++ /* If we have relaimed everything on the isolated list, no stall */
2298 ++ if (nr_freed == nr_taken)
2299 ++ return false;
2300 ++
2301 ++ /*
2302 ++ * For high-order allocations, there are two stall thresholds.
2303 ++ * High-cost allocations stall immediately where as lower
2304 ++ * order allocations such as stacks require the scanning
2305 ++ * priority to be much higher before stalling.
2306 ++ */
2307 ++ if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
2308 ++ lumpy_stall_priority = DEF_PRIORITY;
2309 ++ else
2310 ++ lumpy_stall_priority = DEF_PRIORITY / 3;
2311 ++
2312 ++ return priority <= lumpy_stall_priority;
2313 ++}
2314 ++
2315 ++/*
2316 + * shrink_inactive_list() is a helper for shrink_zone(). It returns the number
2317 + * of reclaimed pages
2318 + */
2319 +@@ -1209,14 +1251,9 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
2320 + nr_scanned += nr_scan;
2321 + nr_freed = shrink_page_list(&page_list, sc, PAGEOUT_IO_ASYNC);
2322 +
2323 +- /*
2324 +- * If we are direct reclaiming for contiguous pages and we do
2325 +- * not reclaim everything in the list, try again and wait
2326 +- * for IO to complete. This will stall high-order allocations
2327 +- * but that should be acceptable to the caller
2328 +- */
2329 +- if (nr_freed < nr_taken && !current_is_kswapd() &&
2330 +- lumpy_reclaim) {
2331 ++ /* Check if we should syncronously wait for writeback */
2332 ++ if (should_reclaim_stall(nr_taken, nr_freed, priority,
2333 ++ lumpy_reclaim, sc)) {
2334 + congestion_wait(BLK_RW_ASYNC, HZ/10);
2335 +
2336 + /*
2337 +diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
2338 +index 90a9024..5c8ee83 100644
2339 +--- a/net/bridge/br_device.c
2340 ++++ b/net/bridge/br_device.c
2341 +@@ -19,7 +19,7 @@
2342 + #include <asm/uaccess.h>
2343 + #include "br_private.h"
2344 +
2345 +-/* net device transmit always called with no BH (preempt_disabled) */
2346 ++/* net device transmit always called with BH disabled */
2347 + netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
2348 + {
2349 + struct net_bridge *br = netdev_priv(dev);
2350 +@@ -35,9 +35,12 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
2351 + skb_reset_mac_header(skb);
2352 + skb_pull(skb, ETH_HLEN);
2353 +
2354 ++ rcu_read_lock();
2355 + if (dest[0] & 1) {
2356 +- if (br_multicast_rcv(br, NULL, skb))
2357 ++ if (br_multicast_rcv(br, NULL, skb)) {
2358 ++ kfree_skb(skb);
2359 + goto out;
2360 ++ }
2361 +
2362 + mdst = br_mdb_get(br, skb);
2363 + if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb))
2364 +@@ -50,6 +53,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
2365 + br_flood_deliver(br, skb);
2366 +
2367 + out:
2368 ++ rcu_read_unlock();
2369 + return NETDEV_TX_OK;
2370 + }
2371 +
2372 +diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
2373 +index 26c0cbe..5c96374 100644
2374 +--- a/net/bridge/br_fdb.c
2375 ++++ b/net/bridge/br_fdb.c
2376 +@@ -214,7 +214,7 @@ void br_fdb_delete_by_port(struct net_bridge *br,
2377 + spin_unlock_bh(&br->hash_lock);
2378 + }
2379 +
2380 +-/* No locking or refcounting, assumes caller has no preempt (rcu_read_lock) */
2381 ++/* No locking or refcounting, assumes caller has rcu_read_lock */
2382 + struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
2383 + const unsigned char *addr)
2384 + {
2385 +diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
2386 +index a82dde2..9015a20 100644
2387 +--- a/net/bridge/br_input.c
2388 ++++ b/net/bridge/br_input.c
2389 +@@ -35,7 +35,7 @@ static int br_pass_frame_up(struct sk_buff *skb)
2390 + netif_receive_skb);
2391 + }
2392 +
2393 +-/* note: already called with rcu_read_lock (preempt_disabled) */
2394 ++/* note: already called with rcu_read_lock */
2395 + int br_handle_frame_finish(struct sk_buff *skb)
2396 + {
2397 + const unsigned char *dest = eth_hdr(skb)->h_dest;
2398 +@@ -106,7 +106,7 @@ drop:
2399 + goto out;
2400 + }
2401 +
2402 +-/* note: already called with rcu_read_lock (preempt_disabled) */
2403 ++/* note: already called with rcu_read_lock */
2404 + static int br_handle_local_finish(struct sk_buff *skb)
2405 + {
2406 + struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
2407 +@@ -131,7 +131,7 @@ static inline int is_link_local(const unsigned char *dest)
2408 + /*
2409 + * Called via br_handle_frame_hook.
2410 + * Return NULL if skb is handled
2411 +- * note: already called with rcu_read_lock (preempt_disabled)
2412 ++ * note: already called with rcu_read_lock
2413 + */
2414 + struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
2415 + {
2416 +diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
2417 +index d66cce1..edc7111 100644
2418 +--- a/net/bridge/br_stp_bpdu.c
2419 ++++ b/net/bridge/br_stp_bpdu.c
2420 +@@ -131,7 +131,7 @@ void br_send_tcn_bpdu(struct net_bridge_port *p)
2421 + /*
2422 + * Called from llc.
2423 + *
2424 +- * NO locks, but rcu_read_lock (preempt_disabled)
2425 ++ * NO locks, but rcu_read_lock
2426 + */
2427 + void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
2428 + struct net_device *dev)
2429 +diff --git a/net/can/bcm.c b/net/can/bcm.c
2430 +index 907dc87..e10ee05 100644
2431 +--- a/net/can/bcm.c
2432 ++++ b/net/can/bcm.c
2433 +@@ -60,6 +60,13 @@
2434 + #include <net/sock.h>
2435 + #include <net/net_namespace.h>
2436 +
2437 ++/*
2438 ++ * To send multiple CAN frame content within TX_SETUP or to filter
2439 ++ * CAN messages with multiplex index within RX_SETUP, the number of
2440 ++ * different filters is limited to 256 due to the one byte index value.
2441 ++ */
2442 ++#define MAX_NFRAMES 256
2443 ++
2444 + /* use of last_frames[index].can_dlc */
2445 + #define RX_RECV 0x40 /* received data for this element */
2446 + #define RX_THR 0x80 /* element not been sent due to throttle feature */
2447 +@@ -89,16 +96,16 @@ struct bcm_op {
2448 + struct list_head list;
2449 + int ifindex;
2450 + canid_t can_id;
2451 +- int flags;
2452 ++ u32 flags;
2453 + unsigned long frames_abs, frames_filtered;
2454 + struct timeval ival1, ival2;
2455 + struct hrtimer timer, thrtimer;
2456 + struct tasklet_struct tsklet, thrtsklet;
2457 + ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg;
2458 + int rx_ifindex;
2459 +- int count;
2460 +- int nframes;
2461 +- int currframe;
2462 ++ u32 count;
2463 ++ u32 nframes;
2464 ++ u32 currframe;
2465 + struct can_frame *frames;
2466 + struct can_frame *last_frames;
2467 + struct can_frame sframe;
2468 +@@ -175,7 +182,7 @@ static int bcm_proc_show(struct seq_file *m, void *v)
2469 +
2470 + seq_printf(m, "rx_op: %03X %-5s ",
2471 + op->can_id, bcm_proc_getifname(ifname, op->ifindex));
2472 +- seq_printf(m, "[%d]%c ", op->nframes,
2473 ++ seq_printf(m, "[%u]%c ", op->nframes,
2474 + (op->flags & RX_CHECK_DLC)?'d':' ');
2475 + if (op->kt_ival1.tv64)
2476 + seq_printf(m, "timeo=%lld ",
2477 +@@ -198,7 +205,7 @@ static int bcm_proc_show(struct seq_file *m, void *v)
2478 +
2479 + list_for_each_entry(op, &bo->tx_ops, list) {
2480 +
2481 +- seq_printf(m, "tx_op: %03X %s [%d] ",
2482 ++ seq_printf(m, "tx_op: %03X %s [%u] ",
2483 + op->can_id,
2484 + bcm_proc_getifname(ifname, op->ifindex),
2485 + op->nframes);
2486 +@@ -283,7 +290,7 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
2487 + struct can_frame *firstframe;
2488 + struct sockaddr_can *addr;
2489 + struct sock *sk = op->sk;
2490 +- int datalen = head->nframes * CFSIZ;
2491 ++ unsigned int datalen = head->nframes * CFSIZ;
2492 + int err;
2493 +
2494 + skb = alloc_skb(sizeof(*head) + datalen, gfp_any());
2495 +@@ -468,7 +475,7 @@ rx_changed_settime:
2496 + * bcm_rx_cmp_to_index - (bit)compares the currently received data to formerly
2497 + * received data stored in op->last_frames[]
2498 + */
2499 +-static void bcm_rx_cmp_to_index(struct bcm_op *op, int index,
2500 ++static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index,
2501 + const struct can_frame *rxdata)
2502 + {
2503 + /*
2504 +@@ -554,7 +561,8 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
2505 + /*
2506 + * bcm_rx_do_flush - helper for bcm_rx_thr_flush
2507 + */
2508 +-static inline int bcm_rx_do_flush(struct bcm_op *op, int update, int index)
2509 ++static inline int bcm_rx_do_flush(struct bcm_op *op, int update,
2510 ++ unsigned int index)
2511 + {
2512 + if ((op->last_frames) && (op->last_frames[index].can_dlc & RX_THR)) {
2513 + if (update)
2514 +@@ -575,7 +583,7 @@ static int bcm_rx_thr_flush(struct bcm_op *op, int update)
2515 + int updated = 0;
2516 +
2517 + if (op->nframes > 1) {
2518 +- int i;
2519 ++ unsigned int i;
2520 +
2521 + /* for MUX filter we start at index 1 */
2522 + for (i = 1; i < op->nframes; i++)
2523 +@@ -624,7 +632,7 @@ static void bcm_rx_handler(struct sk_buff *skb, void *data)
2524 + {
2525 + struct bcm_op *op = (struct bcm_op *)data;
2526 + const struct can_frame *rxframe = (struct can_frame *)skb->data;
2527 +- int i;
2528 ++ unsigned int i;
2529 +
2530 + /* disable timeout */
2531 + hrtimer_cancel(&op->timer);
2532 +@@ -824,14 +832,15 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
2533 + {
2534 + struct bcm_sock *bo = bcm_sk(sk);
2535 + struct bcm_op *op;
2536 +- int i, err;
2537 ++ unsigned int i;
2538 ++ int err;
2539 +
2540 + /* we need a real device to send frames */
2541 + if (!ifindex)
2542 + return -ENODEV;
2543 +
2544 +- /* we need at least one can_frame */
2545 +- if (msg_head->nframes < 1)
2546 ++ /* check nframes boundaries - we need at least one can_frame */
2547 ++ if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES)
2548 + return -EINVAL;
2549 +
2550 + /* check the given can_id */
2551 +@@ -995,6 +1004,10 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
2552 + msg_head->nframes = 0;
2553 + }
2554 +
2555 ++ /* the first element contains the mux-mask => MAX_NFRAMES + 1 */
2556 ++ if (msg_head->nframes > MAX_NFRAMES + 1)
2557 ++ return -EINVAL;
2558 ++
2559 + if ((msg_head->flags & RX_RTR_FRAME) &&
2560 + ((msg_head->nframes != 1) ||
2561 + (!(msg_head->can_id & CAN_RTR_FLAG))))
2562 +diff --git a/net/core/dev.c b/net/core/dev.c
2563 +index ece33fd..740e71f 100644
2564 +--- a/net/core/dev.c
2565 ++++ b/net/core/dev.c
2566 +@@ -1464,6 +1464,7 @@ static inline void net_timestamp(struct sk_buff *skb)
2567 + int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
2568 + {
2569 + skb_orphan(skb);
2570 ++ nf_reset(skb);
2571 +
2572 + if (!(dev->flags & IFF_UP) ||
2573 + (skb->len > (dev->mtu + dev->hard_header_len))) {
2574 +@@ -2665,7 +2666,7 @@ enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2575 + int mac_len;
2576 + enum gro_result ret;
2577 +
2578 +- if (!(skb->dev->features & NETIF_F_GRO))
2579 ++ if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
2580 + goto normal;
2581 +
2582 + if (skb_is_gso(skb) || skb_has_frags(skb))
2583 +@@ -2734,7 +2735,7 @@ pull:
2584 + put_page(skb_shinfo(skb)->frags[0].page);
2585 + memmove(skb_shinfo(skb)->frags,
2586 + skb_shinfo(skb)->frags + 1,
2587 +- --skb_shinfo(skb)->nr_frags);
2588 ++ --skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
2589 + }
2590 + }
2591 +
2592 +@@ -2752,9 +2753,6 @@ __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2593 + {
2594 + struct sk_buff *p;
2595 +
2596 +- if (netpoll_rx_on(skb))
2597 +- return GRO_NORMAL;
2598 +-
2599 + for (p = napi->gro_list; p; p = p->next) {
2600 + NAPI_GRO_CB(p)->same_flow =
2601 + (p->dev == skb->dev) &&
2602 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
2603 +index 296150b..4fbf481 100644
2604 +--- a/net/ipv4/tcp.c
2605 ++++ b/net/ipv4/tcp.c
2606 +@@ -2175,6 +2175,8 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2607 + GFP_KERNEL);
2608 + if (cvp == NULL)
2609 + return -ENOMEM;
2610 ++
2611 ++ kref_init(&cvp->kref);
2612 + }
2613 + lock_sock(sk);
2614 + tp->rx_opt.cookie_in_always =
2615 +@@ -2189,12 +2191,11 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2616 + */
2617 + kref_put(&tp->cookie_values->kref,
2618 + tcp_cookie_values_release);
2619 +- kref_init(&cvp->kref);
2620 +- tp->cookie_values = cvp;
2621 + } else {
2622 + cvp = tp->cookie_values;
2623 + }
2624 + }
2625 ++
2626 + if (cvp != NULL) {
2627 + cvp->cookie_desired = ctd.tcpct_cookie_desired;
2628 +
2629 +@@ -2208,6 +2209,8 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2630 + cvp->s_data_desired = ctd.tcpct_s_data_desired;
2631 + cvp->s_data_constant = 0; /* false */
2632 + }
2633 ++
2634 ++ tp->cookie_values = cvp;
2635 + }
2636 + release_sock(sk);
2637 + return err;
2638 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
2639 +index 7954243..fe63131 100644
2640 +--- a/net/netlink/af_netlink.c
2641 ++++ b/net/netlink/af_netlink.c
2642 +@@ -1383,7 +1383,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
2643 + struct netlink_sock *nlk = nlk_sk(sk);
2644 + int noblock = flags&MSG_DONTWAIT;
2645 + size_t copied;
2646 +- struct sk_buff *skb, *frag __maybe_unused = NULL;
2647 ++ struct sk_buff *skb, *data_skb;
2648 + int err;
2649 +
2650 + if (flags&MSG_OOB)
2651 +@@ -1395,45 +1395,35 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
2652 + if (skb == NULL)
2653 + goto out;
2654 +
2655 ++ data_skb = skb;
2656 ++
2657 + #ifdef CONFIG_COMPAT_NETLINK_MESSAGES
2658 + if (unlikely(skb_shinfo(skb)->frag_list)) {
2659 +- bool need_compat = !!(flags & MSG_CMSG_COMPAT);
2660 +-
2661 + /*
2662 +- * If this skb has a frag_list, then here that means that
2663 +- * we will have to use the frag_list skb for compat tasks
2664 +- * and the regular skb for non-compat tasks.
2665 ++ * If this skb has a frag_list, then here that means that we
2666 ++ * will have to use the frag_list skb's data for compat tasks
2667 ++ * and the regular skb's data for normal (non-compat) tasks.
2668 + *
2669 +- * The skb might (and likely will) be cloned, so we can't
2670 +- * just reset frag_list and go on with things -- we need to
2671 +- * keep that. For the compat case that's easy -- simply get
2672 +- * a reference to the compat skb and free the regular one
2673 +- * including the frag. For the non-compat case, we need to
2674 +- * avoid sending the frag to the user -- so assign NULL but
2675 +- * restore it below before freeing the skb.
2676 ++ * If we need to send the compat skb, assign it to the
2677 ++ * 'data_skb' variable so that it will be used below for data
2678 ++ * copying. We keep 'skb' for everything else, including
2679 ++ * freeing both later.
2680 + */
2681 +- if (need_compat) {
2682 +- struct sk_buff *compskb = skb_shinfo(skb)->frag_list;
2683 +- skb_get(compskb);
2684 +- kfree_skb(skb);
2685 +- skb = compskb;
2686 +- } else {
2687 +- frag = skb_shinfo(skb)->frag_list;
2688 +- skb_shinfo(skb)->frag_list = NULL;
2689 +- }
2690 ++ if (flags & MSG_CMSG_COMPAT)
2691 ++ data_skb = skb_shinfo(skb)->frag_list;
2692 + }
2693 + #endif
2694 +
2695 + msg->msg_namelen = 0;
2696 +
2697 +- copied = skb->len;
2698 ++ copied = data_skb->len;
2699 + if (len < copied) {
2700 + msg->msg_flags |= MSG_TRUNC;
2701 + copied = len;
2702 + }
2703 +
2704 +- skb_reset_transport_header(skb);
2705 +- err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
2706 ++ skb_reset_transport_header(data_skb);
2707 ++ err = skb_copy_datagram_iovec(data_skb, 0, msg->msg_iov, copied);
2708 +
2709 + if (msg->msg_name) {
2710 + struct sockaddr_nl *addr = (struct sockaddr_nl *)msg->msg_name;
2711 +@@ -1453,11 +1443,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
2712 + }
2713 + siocb->scm->creds = *NETLINK_CREDS(skb);
2714 + if (flags & MSG_TRUNC)
2715 +- copied = skb->len;
2716 +-
2717 +-#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
2718 +- skb_shinfo(skb)->frag_list = frag;
2719 +-#endif
2720 ++ copied = data_skb->len;
2721 +
2722 + skb_free_datagram(sk, skb);
2723 +
2724 +diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
2725 +index d885ba3..37e198c 100644
2726 +--- a/net/sched/act_nat.c
2727 ++++ b/net/sched/act_nat.c
2728 +@@ -240,7 +240,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
2729 + iph->saddr = new_addr;
2730 +
2731 + inet_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr,
2732 +- 1);
2733 ++ 0);
2734 + break;
2735 + }
2736 + default:
2737 +diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
2738 +index c5a9ac5..d716d9b 100644
2739 +--- a/net/sched/sch_sfq.c
2740 ++++ b/net/sched/sch_sfq.c
2741 +@@ -497,11 +497,22 @@ nla_put_failure:
2742 + return -1;
2743 + }
2744 +
2745 ++static struct Qdisc *sfq_leaf(struct Qdisc *sch, unsigned long arg)
2746 ++{
2747 ++ return NULL;
2748 ++}
2749 ++
2750 + static unsigned long sfq_get(struct Qdisc *sch, u32 classid)
2751 + {
2752 + return 0;
2753 + }
2754 +
2755 ++static unsigned long sfq_bind(struct Qdisc *sch, unsigned long parent,
2756 ++ u32 classid)
2757 ++{
2758 ++ return 0;
2759 ++}
2760 ++
2761 + static struct tcf_proto **sfq_find_tcf(struct Qdisc *sch, unsigned long cl)
2762 + {
2763 + struct sfq_sched_data *q = qdisc_priv(sch);
2764 +@@ -554,8 +565,10 @@ static void sfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
2765 + }
2766 +
2767 + static const struct Qdisc_class_ops sfq_class_ops = {
2768 ++ .leaf = sfq_leaf,
2769 + .get = sfq_get,
2770 + .tcf_chain = sfq_find_tcf,
2771 ++ .bind_tcf = sfq_bind,
2772 + .dump = sfq_dump_class,
2773 + .dump_stats = sfq_dump_class_stats,
2774 + .walk = sfq_walk,
2775 +diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
2776 +index 04c6dfd..007133d 100644
2777 +--- a/net/wireless/mlme.c
2778 ++++ b/net/wireless/mlme.c
2779 +@@ -825,12 +825,18 @@ int cfg80211_mlme_action(struct cfg80211_registered_device *rdev,
2780 + return -EINVAL;
2781 + if (mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) {
2782 + /* Verify that we are associated with the destination AP */
2783 ++ wdev_lock(wdev);
2784 ++
2785 + if (!wdev->current_bss ||
2786 + memcmp(wdev->current_bss->pub.bssid, mgmt->bssid,
2787 + ETH_ALEN) != 0 ||
2788 + memcmp(wdev->current_bss->pub.bssid, mgmt->da,
2789 +- ETH_ALEN) != 0)
2790 ++ ETH_ALEN) != 0) {
2791 ++ wdev_unlock(wdev);
2792 + return -ENOTCONN;
2793 ++ }
2794 ++ wdev_unlock(wdev);
2795 ++
2796 + }
2797 +
2798 + if (memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0)
2799 +diff --git a/scripts/mkmakefile b/scripts/mkmakefile
2800 +index 67d59c7..5325423 100644
2801 +--- a/scripts/mkmakefile
2802 ++++ b/scripts/mkmakefile
2803 +@@ -44,7 +44,9 @@ all:
2804 +
2805 + Makefile:;
2806 +
2807 +-\$(all) %/: all
2808 ++\$(all): all
2809 + @:
2810 +
2811 ++%/: all
2812 ++ @:
2813 + EOF
2814 +diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
2815 +index d124e95..9e1b5f5 100644
2816 +--- a/sound/core/pcm_native.c
2817 ++++ b/sound/core/pcm_native.c
2818 +@@ -979,6 +979,10 @@ static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push)
2819 + {
2820 + if (substream->runtime->trigger_master != substream)
2821 + return 0;
2822 ++ /* some drivers might use hw_ptr to recover from the pause -
2823 ++ update the hw_ptr now */
2824 ++ if (push)
2825 ++ snd_pcm_update_hw_ptr(substream);
2826 + /* The jiffies check in snd_pcm_update_hw_ptr*() is done by
2827 + * a delta betwen the current jiffies, this gives a large enough
2828 + * delta, effectively to skip the check once.
2829 +diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
2830 +index 4203782..aff8387 100644
2831 +--- a/sound/pci/emu10k1/emu10k1.c
2832 ++++ b/sound/pci/emu10k1/emu10k1.c
2833 +@@ -52,6 +52,7 @@ static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
2834 + static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
2835 + static int enable_ir[SNDRV_CARDS];
2836 + static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
2837 ++static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
2838 +
2839 + module_param_array(index, int, NULL, 0444);
2840 + MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard.");
2841 +@@ -73,6 +74,8 @@ module_param_array(enable_ir, bool, NULL, 0444);
2842 + MODULE_PARM_DESC(enable_ir, "Enable IR.");
2843 + module_param_array(subsystem, uint, NULL, 0444);
2844 + MODULE_PARM_DESC(subsystem, "Force card subsystem model.");
2845 ++module_param_array(delay_pcm_irq, uint, NULL, 0444);
2846 ++MODULE_PARM_DESC(delay_pcm_irq, "Delay PCM interrupt by specified number of samples (default 0).");
2847 + /*
2848 + * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400
2849 + */
2850 +@@ -127,6 +130,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
2851 + &emu)) < 0)
2852 + goto error;
2853 + card->private_data = emu;
2854 ++ emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;
2855 + if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0)
2856 + goto error;
2857 + if ((err = snd_emu10k1_pcm_mic(emu, 1, NULL)) < 0)
2858 +diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
2859 +index 55b83ef..622bace 100644
2860 +--- a/sound/pci/emu10k1/emupcm.c
2861 ++++ b/sound/pci/emu10k1/emupcm.c
2862 +@@ -332,7 +332,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
2863 + evoice->epcm->ccca_start_addr = start_addr + ccis;
2864 + if (extra) {
2865 + start_addr += ccis;
2866 +- end_addr += ccis;
2867 ++ end_addr += ccis + emu->delay_pcm_irq;
2868 + }
2869 + if (stereo && !extra) {
2870 + snd_emu10k1_ptr_write(emu, CPF, voice, CPF_STEREO_MASK);
2871 +@@ -360,7 +360,9 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
2872 + /* Assumption that PT is already 0 so no harm overwriting */
2873 + snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]);
2874 + snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24));
2875 +- snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24));
2876 ++ snd_emu10k1_ptr_write(emu, PSST, voice,
2877 ++ (start_addr + (extra ? emu->delay_pcm_irq : 0)) |
2878 ++ (send_amount[2] << 24));
2879 + if (emu->card_capabilities->emu_model)
2880 + pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */
2881 + else
2882 +@@ -732,6 +734,23 @@ static void snd_emu10k1_playback_stop_voice(struct snd_emu10k1 *emu, struct snd_
2883 + snd_emu10k1_ptr_write(emu, IP, voice, 0);
2884 + }
2885 +
2886 ++static inline void snd_emu10k1_playback_mangle_extra(struct snd_emu10k1 *emu,
2887 ++ struct snd_emu10k1_pcm *epcm,
2888 ++ struct snd_pcm_substream *substream,
2889 ++ struct snd_pcm_runtime *runtime)
2890 ++{
2891 ++ unsigned int ptr, period_pos;
2892 ++
2893 ++ /* try to sychronize the current position for the interrupt
2894 ++ source voice */
2895 ++ period_pos = runtime->status->hw_ptr - runtime->hw_ptr_interrupt;
2896 ++ period_pos %= runtime->period_size;
2897 ++ ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->extra->number);
2898 ++ ptr &= ~0x00ffffff;
2899 ++ ptr |= epcm->ccca_start_addr + period_pos;
2900 ++ snd_emu10k1_ptr_write(emu, CCCA, epcm->extra->number, ptr);
2901 ++}
2902 ++
2903 + static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
2904 + int cmd)
2905 + {
2906 +@@ -753,6 +772,8 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
2907 + /* follow thru */
2908 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
2909 + case SNDRV_PCM_TRIGGER_RESUME:
2910 ++ if (cmd == SNDRV_PCM_TRIGGER_PAUSE_RELEASE)
2911 ++ snd_emu10k1_playback_mangle_extra(emu, epcm, substream, runtime);
2912 + mix = &emu->pcm_mixer[substream->number];
2913 + snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix);
2914 + snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix);
2915 +@@ -869,8 +890,9 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream *
2916 + #endif
2917 + /*
2918 + printk(KERN_DEBUG
2919 +- "ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n",
2920 +- ptr, runtime->buffer_size, runtime->period_size);
2921 ++ "ptr = 0x%lx, buffer_size = 0x%lx, period_size = 0x%lx\n",
2922 ++ (long)ptr, (long)runtime->buffer_size,
2923 ++ (long)runtime->period_size);
2924 + */
2925 + return ptr;
2926 + }
2927 +diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
2928 +index ffb1ddb..957a311 100644
2929 +--- a/sound/pci/emu10k1/memory.c
2930 ++++ b/sound/pci/emu10k1/memory.c
2931 +@@ -310,8 +310,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
2932 + if (snd_BUG_ON(!hdr))
2933 + return NULL;
2934 +
2935 ++ idx = runtime->period_size >= runtime->buffer_size ?
2936 ++ (emu->delay_pcm_irq * 2) : 0;
2937 + mutex_lock(&hdr->block_mutex);
2938 +- blk = search_empty(emu, runtime->dma_bytes);
2939 ++ blk = search_empty(emu, runtime->dma_bytes + idx);
2940 + if (blk == NULL) {
2941 + mutex_unlock(&hdr->block_mutex);
2942 + return NULL;
2943 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
2944 +index feabb44..405492d 100644
2945 +--- a/sound/pci/hda/patch_conexant.c
2946 ++++ b/sound/pci/hda/patch_conexant.c
2947 +@@ -2843,6 +2843,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
2948 + SND_PCI_QUIRK(0x1028, 0x02f5, "Dell",
2949 + CXT5066_DELL_LAPTOP),
2950 + SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5),
2951 ++ SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTO),
2952 + SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO),
2953 + SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
2954 + SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
2955 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2956 +index c260b1b..aa93b0b 100644
2957 +--- a/sound/pci/hda/patch_realtek.c
2958 ++++ b/sound/pci/hda/patch_realtek.c
2959 +@@ -6757,6 +6757,7 @@ static int patch_alc260(struct hda_codec *codec)
2960 +
2961 + spec->stream_analog_playback = &alc260_pcm_analog_playback;
2962 + spec->stream_analog_capture = &alc260_pcm_analog_capture;
2963 ++ spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
2964 +
2965 + spec->stream_digital_playback = &alc260_pcm_digital_playback;
2966 + spec->stream_digital_capture = &alc260_pcm_digital_capture;
2967 +diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
2968 +index 6433e65..4677492 100644
2969 +--- a/sound/pci/intel8x0.c
2970 ++++ b/sound/pci/intel8x0.c
2971 +@@ -1776,6 +1776,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
2972 + },
2973 + {
2974 + .subvendor = 0x1014,
2975 ++ .subdevice = 0x0534,
2976 ++ .name = "ThinkPad X31",
2977 ++ .type = AC97_TUNE_INV_EAPD
2978 ++ },
2979 ++ {
2980 ++ .subvendor = 0x1014,
2981 + .subdevice = 0x1f00,
2982 + .name = "MS-9128",
2983 + .type = AC97_TUNE_ALC_JACK
2984 +diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
2985 +index ad44626..c737287 100644
2986 +--- a/sound/pci/riptide/riptide.c
2987 ++++ b/sound/pci/riptide/riptide.c
2988 +@@ -1224,15 +1224,14 @@ static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
2989 + firmware.firmware.ASIC, firmware.firmware.CODEC,
2990 + firmware.firmware.AUXDSP, firmware.firmware.PROG);
2991 +
2992 ++ if (!chip)
2993 ++ return 1;
2994 ++
2995 + for (i = 0; i < FIRMWARE_VERSIONS; i++) {
2996 + if (!memcmp(&firmware_versions[i], &firmware, sizeof(firmware)))
2997 +- break;
2998 +- }
2999 +- if (i >= FIRMWARE_VERSIONS)
3000 +- return 0; /* no match */
3001 ++ return 1; /* OK */
3002 +
3003 +- if (!chip)
3004 +- return 1; /* OK */
3005 ++ }
3006 +
3007 + snd_printdd("Writing Firmware\n");
3008 + if (!chip->fw_entry) {
3009 +diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
3010 +index 8cc9042..c907c76 100644
3011 +--- a/sound/soc/codecs/wm8580.c
3012 ++++ b/sound/soc/codecs/wm8580.c
3013 +@@ -269,9 +269,9 @@ SOC_DOUBLE("DAC2 Invert Switch", WM8580_DAC_CONTROL4, 2, 3, 1, 0),
3014 + SOC_DOUBLE("DAC3 Invert Switch", WM8580_DAC_CONTROL4, 4, 5, 1, 0),
3015 +
3016 + SOC_SINGLE("DAC ZC Switch", WM8580_DAC_CONTROL5, 5, 1, 0),
3017 +-SOC_SINGLE("DAC1 Switch", WM8580_DAC_CONTROL5, 0, 1, 0),
3018 +-SOC_SINGLE("DAC2 Switch", WM8580_DAC_CONTROL5, 1, 1, 0),
3019 +-SOC_SINGLE("DAC3 Switch", WM8580_DAC_CONTROL5, 2, 1, 0),
3020 ++SOC_SINGLE("DAC1 Switch", WM8580_DAC_CONTROL5, 0, 1, 1),
3021 ++SOC_SINGLE("DAC2 Switch", WM8580_DAC_CONTROL5, 1, 1, 1),
3022 ++SOC_SINGLE("DAC3 Switch", WM8580_DAC_CONTROL5, 2, 1, 1),
3023 +
3024 + SOC_DOUBLE("ADC Mute Switch", WM8580_ADC_CONTROL1, 0, 1, 1, 0),
3025 + SOC_SINGLE("ADC High-Pass Filter Switch", WM8580_ADC_CONTROL1, 4, 1, 0),
3026 +diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
3027 +index e02ef53..4eb77f5 100644
3028 +--- a/sound/soc/codecs/wm8776.c
3029 ++++ b/sound/soc/codecs/wm8776.c
3030 +@@ -178,13 +178,6 @@ static int wm8776_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
3031 + case SND_SOC_DAIFMT_LEFT_J:
3032 + iface |= 0x0001;
3033 + break;
3034 +- /* FIXME: CHECK A/B */
3035 +- case SND_SOC_DAIFMT_DSP_A:
3036 +- iface |= 0x0003;
3037 +- break;
3038 +- case SND_SOC_DAIFMT_DSP_B:
3039 +- iface |= 0x0007;
3040 +- break;
3041 + default:
3042 + return -EINVAL;
3043 + }
3044 +diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
3045 +index 5869dc3..a0b45be 100644
3046 +--- a/sound/soc/soc-cache.c
3047 ++++ b/sound/soc/soc-cache.c
3048 +@@ -296,7 +296,7 @@ static unsigned int snd_soc_16_8_read_i2c(struct snd_soc_codec *codec,
3049 + static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec,
3050 + unsigned int reg)
3051 + {
3052 +- u16 *cache = codec->reg_cache;
3053 ++ u8 *cache = codec->reg_cache;
3054 +
3055 + reg &= 0xff;
3056 + if (reg >= codec->reg_cache_size)
3057 +@@ -307,7 +307,7 @@ static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec,
3058 + static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
3059 + unsigned int value)
3060 + {
3061 +- u16 *cache = codec->reg_cache;
3062 ++ u8 *cache = codec->reg_cache;
3063 + u8 data[3];
3064 + int ret;
3065 +