Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1772 - genpatches-2.6/trunk/2.6.32
Date: Tue, 31 Aug 2010 14:28:41
Message-Id: 20100831142833.3243E20051@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2010-08-31 14:28:32 +0000 (Tue, 31 Aug 2010)
3 New Revision: 1772
4
5 Added:
6 genpatches-2.6/trunk/2.6.32/1020_linux-2.6.32.21.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.32/0000_README
9 Log:
10 Linux patch 2.6.32.21
11
12 Modified: genpatches-2.6/trunk/2.6.32/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.32/0000_README 2010-08-31 14:13:10 UTC (rev 1771)
15 +++ genpatches-2.6/trunk/2.6.32/0000_README 2010-08-31 14:28:32 UTC (rev 1772)
16 @@ -119,6 +119,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 2.6.32.20
19
20 +Patch: 1020_linux-2.6.32.21.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 2.6.32.21
23 +
24 Patch: 2500_libata-fix-truncated-LBA48-ret-vals.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=303313
26 Desc: Fix bug which truncated LBA48 return values
27
28 Added: genpatches-2.6/trunk/2.6.32/1020_linux-2.6.32.21.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.32/1020_linux-2.6.32.21.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.32/1020_linux-2.6.32.21.patch 2010-08-31 14:28:32 UTC (rev 1772)
32 @@ -0,0 +1,2068 @@
33 +diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
34 +index bbecccd..1df6457 100644
35 +--- a/arch/arm/include/asm/ptrace.h
36 ++++ b/arch/arm/include/asm/ptrace.h
37 +@@ -150,15 +150,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/powerpc/Makefile b/arch/powerpc/Makefile
67 +index 7546e2c..c107b74 100644
68 +--- a/arch/powerpc/Makefile
69 ++++ b/arch/powerpc/Makefile
70 +@@ -159,7 +159,7 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
71 + all: zImage
72 +
73 + # With make 3.82 we cannot mix normal and wildcard targets
74 +-BOOT_TARGETS1 := zImage zImage.initrd uImaged
75 ++BOOT_TARGETS1 := zImage zImage.initrd uImage
76 + BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
77 +
78 + PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
79 +diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
80 +index f2e4800..f5cc06f 100644
81 +--- a/arch/sparc/include/asm/atomic_64.h
82 ++++ b/arch/sparc/include/asm/atomic_64.h
83 +@@ -20,14 +20,14 @@
84 + #define atomic64_set(v, i) (((v)->counter) = i)
85 +
86 + extern void atomic_add(int, atomic_t *);
87 +-extern void atomic64_add(int, atomic64_t *);
88 ++extern void atomic64_add(long, atomic64_t *);
89 + extern void atomic_sub(int, atomic_t *);
90 +-extern void atomic64_sub(int, atomic64_t *);
91 ++extern void atomic64_sub(long, atomic64_t *);
92 +
93 + extern int atomic_add_ret(int, atomic_t *);
94 +-extern int atomic64_add_ret(int, atomic64_t *);
95 ++extern long atomic64_add_ret(long, atomic64_t *);
96 + extern int atomic_sub_ret(int, atomic_t *);
97 +-extern int atomic64_sub_ret(int, atomic64_t *);
98 ++extern long atomic64_sub_ret(long, atomic64_t *);
99 +
100 + #define atomic_dec_return(v) atomic_sub_ret(1, v)
101 + #define atomic64_dec_return(v) atomic64_sub_ret(1, v)
102 +@@ -91,7 +91,7 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
103 + ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
104 + #define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
105 +
106 +-static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
107 ++static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
108 + {
109 + long c, old;
110 + c = atomic64_read(v);
111 +diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
112 +index ff9ead6..43cf002 100644
113 +--- a/arch/sparc/include/asm/parport.h
114 ++++ b/arch/sparc/include/asm/parport.h
115 +@@ -228,6 +228,10 @@ static const struct of_device_id ecpp_match[] = {
116 + .name = "parallel",
117 + .compatible = "ns87317-ecpp",
118 + },
119 ++ {
120 ++ .name = "parallel",
121 ++ .compatible = "pnpALI,1533,3",
122 ++ },
123 + {},
124 + };
125 +
126 +diff --git a/arch/sparc/include/asm/rwsem-const.h b/arch/sparc/include/asm/rwsem-const.h
127 +index a303c9d..e4c61a1 100644
128 +--- a/arch/sparc/include/asm/rwsem-const.h
129 ++++ b/arch/sparc/include/asm/rwsem-const.h
130 +@@ -5,7 +5,7 @@
131 + #define RWSEM_UNLOCKED_VALUE 0x00000000
132 + #define RWSEM_ACTIVE_BIAS 0x00000001
133 + #define RWSEM_ACTIVE_MASK 0x0000ffff
134 +-#define RWSEM_WAITING_BIAS 0xffff0000
135 ++#define RWSEM_WAITING_BIAS (-0x00010000)
136 + #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
137 + #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
138 +
139 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
140 +index fbc161d..cb5a57c 100644
141 +--- a/arch/x86/Kconfig
142 ++++ b/arch/x86/Kconfig
143 +@@ -227,6 +227,11 @@ config X86_32_LAZY_GS
144 +
145 + config KTIME_SCALAR
146 + def_bool X86_32
147 ++
148 ++config ARCH_CPU_PROBE_RELEASE
149 ++ def_bool y
150 ++ depends on HOTPLUG_CPU
151 ++
152 + source "init/Kconfig"
153 + source "kernel/Kconfig.freezer"
154 +
155 +diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
156 +index bc9cd5a..6702ab7 100644
157 +--- a/arch/x86/kernel/apic/apic.c
158 ++++ b/arch/x86/kernel/apic/apic.c
159 +@@ -51,6 +51,7 @@
160 + #include <asm/smp.h>
161 + #include <asm/mce.h>
162 + #include <asm/kvm_para.h>
163 ++#include <asm/tsc.h>
164 +
165 + unsigned int num_processors;
166 +
167 +@@ -1172,8 +1173,13 @@ static void __cpuinit lapic_setup_esr(void)
168 + */
169 + void __cpuinit setup_local_APIC(void)
170 + {
171 +- unsigned int value;
172 +- int i, j;
173 ++ unsigned int value, queued;
174 ++ int i, j, acked = 0;
175 ++ unsigned long long tsc = 0, ntsc;
176 ++ long long max_loops = cpu_khz;
177 ++
178 ++ if (cpu_has_tsc)
179 ++ rdtscll(tsc);
180 +
181 + if (disable_apic) {
182 + arch_disable_smp_support();
183 +@@ -1225,13 +1231,32 @@ void __cpuinit setup_local_APIC(void)
184 + * the interrupt. Hence a vector might get locked. It was noticed
185 + * for timer irq (vector 0x31). Issue an extra EOI to clear ISR.
186 + */
187 +- for (i = APIC_ISR_NR - 1; i >= 0; i--) {
188 +- value = apic_read(APIC_ISR + i*0x10);
189 +- for (j = 31; j >= 0; j--) {
190 +- if (value & (1<<j))
191 +- ack_APIC_irq();
192 ++ do {
193 ++ queued = 0;
194 ++ for (i = APIC_ISR_NR - 1; i >= 0; i--)
195 ++ queued |= apic_read(APIC_IRR + i*0x10);
196 ++
197 ++ for (i = APIC_ISR_NR - 1; i >= 0; i--) {
198 ++ value = apic_read(APIC_ISR + i*0x10);
199 ++ for (j = 31; j >= 0; j--) {
200 ++ if (value & (1<<j)) {
201 ++ ack_APIC_irq();
202 ++ acked++;
203 ++ }
204 ++ }
205 + }
206 +- }
207 ++ if (acked > 256) {
208 ++ printk(KERN_ERR "LAPIC pending interrupts after %d EOI\n",
209 ++ acked);
210 ++ break;
211 ++ }
212 ++ if (cpu_has_tsc) {
213 ++ rdtscll(ntsc);
214 ++ max_loops = (cpu_khz << 10) - (ntsc - tsc);
215 ++ } else
216 ++ max_loops--;
217 ++ } while (queued && max_loops > 0);
218 ++ WARN_ON(max_loops <= 0);
219 +
220 + /*
221 + * Now that we are all set up, enable the APIC
222 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
223 +index 9f9fded..1acd1c4 100644
224 +--- a/arch/x86/kernel/apic/io_apic.c
225 ++++ b/arch/x86/kernel/apic/io_apic.c
226 +@@ -1736,6 +1736,8 @@ __apicdebuginit(void) print_IO_APIC(void)
227 + struct irq_pin_list *entry;
228 +
229 + cfg = desc->chip_data;
230 ++ if (!cfg)
231 ++ continue;
232 + entry = cfg->irq_2_pin;
233 + if (!entry)
234 + continue;
235 +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
236 +index 28e963d..29ec560 100644
237 +--- a/arch/x86/kernel/smpboot.c
238 ++++ b/arch/x86/kernel/smpboot.c
239 +@@ -88,6 +88,25 @@ DEFINE_PER_CPU(int, cpu_state) = { 0 };
240 + static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
241 + #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
242 + #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
243 ++
244 ++/*
245 ++ * We need this for trampoline_base protection from concurrent accesses when
246 ++ * off- and onlining cores wildly.
247 ++ */
248 ++static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);
249 ++
250 ++void cpu_hotplug_driver_lock()
251 ++{
252 ++ mutex_lock(&x86_cpu_hotplug_driver_mutex);
253 ++}
254 ++
255 ++void cpu_hotplug_driver_unlock()
256 ++{
257 ++ mutex_unlock(&x86_cpu_hotplug_driver_mutex);
258 ++}
259 ++
260 ++ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
261 ++ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
262 + #else
263 + static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
264 + #define get_idle_for_cpu(x) (idle_thread_array[(x)])
265 +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
266 +index f1fb411..c41ad50 100644
267 +--- a/arch/x86/oprofile/nmi_int.c
268 ++++ b/arch/x86/oprofile/nmi_int.c
269 +@@ -584,6 +584,18 @@ static int __init ppro_init(char **cpu_type)
270 + if (force_arch_perfmon && cpu_has_arch_perfmon)
271 + return 0;
272 +
273 ++ /*
274 ++ * Documentation on identifying Intel processors by CPU family
275 ++ * and model can be found in the Intel Software Developer's
276 ++ * Manuals (SDM):
277 ++ *
278 ++ * http://www.intel.com/products/processor/manuals/
279 ++ *
280 ++ * As of May 2010 the documentation for this was in the:
281 ++ * "Intel 64 and IA-32 Architectures Software Developer's
282 ++ * Manual Volume 3B: System Programming Guide", "Table B-1
283 ++ * CPUID Signature Values of DisplayFamily_DisplayModel".
284 ++ */
285 + switch (cpu_model) {
286 + case 0 ... 2:
287 + *cpu_type = "i386/ppro";
288 +@@ -605,12 +617,13 @@ static int __init ppro_init(char **cpu_type)
289 + case 15: case 23:
290 + *cpu_type = "i386/core_2";
291 + break;
292 ++ case 0x1a:
293 ++ case 0x1e:
294 + case 0x2e:
295 +- case 26:
296 + spec = &op_arch_perfmon_spec;
297 + *cpu_type = "i386/core_i7";
298 + break;
299 +- case 28:
300 ++ case 0x1c:
301 + *cpu_type = "i386/atom";
302 + break;
303 + default:
304 +diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
305 +index a75ca63..0e27d98 100644
306 +--- a/drivers/gpu/drm/drm_drv.c
307 ++++ b/drivers/gpu/drm/drm_drv.c
308 +@@ -470,7 +470,9 @@ int drm_ioctl(struct inode *inode, struct file *filp,
309 + retcode = -EFAULT;
310 + goto err_i1;
311 + }
312 +- }
313 ++ } else
314 ++ memset(kdata, 0, _IOC_SIZE(cmd));
315 ++
316 + retcode = func(dev, kdata, file_priv);
317 +
318 + if (cmd & IOC_OUT) {
319 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
320 +index 952c844..176a6df 100644
321 +--- a/drivers/gpu/drm/i915/i915_gem.c
322 ++++ b/drivers/gpu/drm/i915/i915_gem.c
323 +@@ -2262,8 +2262,9 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
324 + mapping = inode->i_mapping;
325 + for (i = 0; i < page_count; i++) {
326 + page = read_cache_page_gfp(mapping, i,
327 +- mapping_gfp_mask (mapping) |
328 ++ GFP_HIGHUSER |
329 + __GFP_COLD |
330 ++ __GFP_RECLAIMABLE |
331 + gfpmask);
332 + if (IS_ERR(page))
333 + goto err_pages;
334 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
335 +index 88d5e3a..4f5c733 100644
336 +--- a/drivers/gpu/drm/i915/intel_display.c
337 ++++ b/drivers/gpu/drm/i915/intel_display.c
338 +@@ -1402,6 +1402,7 @@ static void igdng_enable_pll_edp (struct drm_crtc *crtc)
339 + dpa_ctl = I915_READ(DP_A);
340 + dpa_ctl |= DP_PLL_ENABLE;
341 + I915_WRITE(DP_A, dpa_ctl);
342 ++ POSTING_READ(DP_A);
343 + udelay(200);
344 + }
345 +
346 +diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
347 +index 22ce4d6..7547ec6 100644
348 +--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
349 ++++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
350 +@@ -261,7 +261,7 @@ static uint8_t radeon_compute_pll_gain(uint16_t ref_freq, uint16_t ref_div,
351 + if (!ref_div)
352 + return 1;
353 +
354 +- vcoFreq = ((unsigned)ref_freq & fb_div) / ref_div;
355 ++ vcoFreq = ((unsigned)ref_freq * fb_div) / ref_div;
356 +
357 + /*
358 + * This is horribly crude: the VCO frequency range is divided into
359 +diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
360 +index 4a64b85..68e69a4 100644
361 +--- a/drivers/hwmon/pc87360.c
362 ++++ b/drivers/hwmon/pc87360.c
363 +@@ -1610,11 +1610,8 @@ static struct pc87360_data *pc87360_update_device(struct device *dev)
364 +
365 + static int __init pc87360_device_add(unsigned short address)
366 + {
367 +- struct resource res = {
368 +- .name = "pc87360",
369 +- .flags = IORESOURCE_IO,
370 +- };
371 +- int err, i;
372 ++ struct resource res[3];
373 ++ int err, i, res_count;
374 +
375 + pdev = platform_device_alloc("pc87360", address);
376 + if (!pdev) {
377 +@@ -1623,22 +1620,28 @@ static int __init pc87360_device_add(unsigned short address)
378 + goto exit;
379 + }
380 +
381 ++ memset(res, 0, 3 * sizeof(struct resource));
382 ++ res_count = 0;
383 + for (i = 0; i < 3; i++) {
384 + if (!extra_isa[i])
385 + continue;
386 +- res.start = extra_isa[i];
387 +- res.end = extra_isa[i] + PC87360_EXTENT - 1;
388 ++ res[res_count].start = extra_isa[i];
389 ++ res[res_count].end = extra_isa[i] + PC87360_EXTENT - 1;
390 ++ res[res_count].name = "pc87360",
391 ++ res[res_count].flags = IORESOURCE_IO,
392 +
393 +- err = acpi_check_resource_conflict(&res);
394 ++ err = acpi_check_resource_conflict(&res[res_count]);
395 + if (err)
396 + goto exit_device_put;
397 +
398 +- err = platform_device_add_resources(pdev, &res, 1);
399 +- if (err) {
400 +- printk(KERN_ERR "pc87360: Device resource[%d] "
401 +- "addition failed (%d)\n", i, err);
402 +- goto exit_device_put;
403 +- }
404 ++ res_count++;
405 ++ }
406 ++
407 ++ err = platform_device_add_resources(pdev, res, res_count);
408 ++ if (err) {
409 ++ printk(KERN_ERR "pc87360: Device resources addition failed "
410 ++ "(%d)\n", err);
411 ++ goto exit_device_put;
412 + }
413 +
414 + err = platform_device_add(pdev);
415 +diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c
416 +index 1081091..2655e3a 100644
417 +--- a/drivers/isdn/sc/ioctl.c
418 ++++ b/drivers/isdn/sc/ioctl.c
419 +@@ -174,7 +174,7 @@ int sc_ioctl(int card, scs_ioctl *data)
420 + pr_debug("%s: SCIOGETSPID: ioctl received\n",
421 + sc_adapter[card]->devicename);
422 +
423 +- spid = kmalloc(SCIOC_SPIDSIZE, GFP_KERNEL);
424 ++ spid = kzalloc(SCIOC_SPIDSIZE, GFP_KERNEL);
425 + if (!spid) {
426 + kfree(rcvmsg);
427 + return -ENOMEM;
428 +@@ -194,7 +194,7 @@ int sc_ioctl(int card, scs_ioctl *data)
429 + kfree(rcvmsg);
430 + return status;
431 + }
432 +- strcpy(spid, rcvmsg->msg_data.byte_array);
433 ++ strlcpy(spid, rcvmsg->msg_data.byte_array, SCIOC_SPIDSIZE);
434 +
435 + /*
436 + * Package the switch type and send to user space
437 +@@ -272,12 +272,12 @@ int sc_ioctl(int card, scs_ioctl *data)
438 + return status;
439 + }
440 +
441 +- dn = kmalloc(SCIOC_DNSIZE, GFP_KERNEL);
442 ++ dn = kzalloc(SCIOC_DNSIZE, GFP_KERNEL);
443 + if (!dn) {
444 + kfree(rcvmsg);
445 + return -ENOMEM;
446 + }
447 +- strcpy(dn, rcvmsg->msg_data.byte_array);
448 ++ strlcpy(dn, rcvmsg->msg_data.byte_array, SCIOC_DNSIZE);
449 + kfree(rcvmsg);
450 +
451 + /*
452 +@@ -348,7 +348,7 @@ int sc_ioctl(int card, scs_ioctl *data)
453 + pr_debug("%s: SCIOSTAT: ioctl received\n",
454 + sc_adapter[card]->devicename);
455 +
456 +- bi = kmalloc (sizeof(boardInfo), GFP_KERNEL);
457 ++ bi = kzalloc(sizeof(boardInfo), GFP_KERNEL);
458 + if (!bi) {
459 + kfree(rcvmsg);
460 + return -ENOMEM;
461 +diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
462 +index d19854c..818b617 100644
463 +--- a/drivers/md/dm-ioctl.c
464 ++++ b/drivers/md/dm-ioctl.c
465 +@@ -249,40 +249,46 @@ static void __hash_remove(struct hash_cell *hc)
466 +
467 + static void dm_hash_remove_all(int keep_open_devices)
468 + {
469 +- int i, dev_skipped, dev_removed;
470 ++ int i, dev_skipped;
471 + struct hash_cell *hc;
472 +- struct list_head *tmp, *n;
473 ++ struct mapped_device *md;
474 ++
475 ++retry:
476 ++ dev_skipped = 0;
477 +
478 + down_write(&_hash_lock);
479 +
480 +-retry:
481 +- dev_skipped = dev_removed = 0;
482 + for (i = 0; i < NUM_BUCKETS; i++) {
483 +- list_for_each_safe (tmp, n, _name_buckets + i) {
484 +- hc = list_entry(tmp, struct hash_cell, name_list);
485 ++ list_for_each_entry(hc, _name_buckets + i, name_list) {
486 ++ md = hc->md;
487 ++ dm_get(md);
488 +
489 +- if (keep_open_devices &&
490 +- dm_lock_for_deletion(hc->md)) {
491 ++ if (keep_open_devices && dm_lock_for_deletion(md)) {
492 ++ dm_put(md);
493 + dev_skipped++;
494 + continue;
495 + }
496 ++
497 + __hash_remove(hc);
498 +- dev_removed = 1;
499 +- }
500 +- }
501 +
502 +- /*
503 +- * Some mapped devices may be using other mapped devices, so if any
504 +- * still exist, repeat until we make no further progress.
505 +- */
506 +- if (dev_skipped) {
507 +- if (dev_removed)
508 +- goto retry;
509 ++ up_write(&_hash_lock);
510 +
511 +- DMWARN("remove_all left %d open device(s)", dev_skipped);
512 ++ dm_put(md);
513 ++
514 ++ /*
515 ++ * Some mapped devices may be using other mapped
516 ++ * devices, so repeat until we make no further
517 ++ * progress. If a new mapped device is created
518 ++ * here it will also get removed.
519 ++ */
520 ++ goto retry;
521 ++ }
522 + }
523 +
524 + up_write(&_hash_lock);
525 ++
526 ++ if (dev_skipped)
527 ++ DMWARN("remove_all left %d open device(s)", dev_skipped);
528 + }
529 +
530 + static int dm_hash_rename(uint32_t cookie, const char *old, const char *new)
531 +diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
532 +index 32d0b87..f336c69 100644
533 +--- a/drivers/md/dm-mpath.c
534 ++++ b/drivers/md/dm-mpath.c
535 +@@ -691,6 +691,7 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
536 +
537 + if (as->argc < nr_params) {
538 + ti->error = "not enough path parameters";
539 ++ r = -EINVAL;
540 + goto bad;
541 + }
542 +
543 +diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
544 +index bd83fa0..46bd7e2 100644
545 +--- a/drivers/memstick/core/mspro_block.c
546 ++++ b/drivers/memstick/core/mspro_block.c
547 +@@ -1330,13 +1330,14 @@ static void mspro_block_remove(struct memstick_dev *card)
548 + struct mspro_block_data *msb = memstick_get_drvdata(card);
549 + unsigned long flags;
550 +
551 +- del_gendisk(msb->disk);
552 +- dev_dbg(&card->dev, "mspro block remove\n");
553 + spin_lock_irqsave(&msb->q_lock, flags);
554 + msb->eject = 1;
555 + blk_start_queue(msb->queue);
556 + spin_unlock_irqrestore(&msb->q_lock, flags);
557 +
558 ++ del_gendisk(msb->disk);
559 ++ dev_dbg(&card->dev, "mspro block remove\n");
560 ++
561 + blk_cleanup_queue(msb->queue);
562 + msb->queue = NULL;
563 +
564 +diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
565 +index 6ea520a..776183f 100644
566 +--- a/drivers/mtd/nand/pxa3xx_nand.c
567 ++++ b/drivers/mtd/nand/pxa3xx_nand.c
568 +@@ -316,7 +316,7 @@ static struct pxa3xx_nand_flash *builtin_flash_types[] = {
569 + #define tAR_NDTR1(r) (((r) >> 0) & 0xf)
570 +
571 + /* convert nano-seconds to nand flash controller clock cycles */
572 +-#define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) - 1)
573 ++#define ns2cycle(ns, clk) (int)((ns) * (clk / 1000000) / 1000)
574 +
575 + /* convert nand flash controller clock cycles to nano-seconds */
576 + #define cycle2ns(c, clk) ((((c) + 1) * 1000000 + clk / 500) / (clk / 1000))
577 +diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
578 +index 7ee61d4..ce166ae 100644
579 +--- a/drivers/net/wireless/ath/ath5k/base.c
580 ++++ b/drivers/net/wireless/ath/ath5k/base.c
581 +@@ -48,6 +48,7 @@
582 + #include <linux/netdevice.h>
583 + #include <linux/cache.h>
584 + #include <linux/pci.h>
585 ++#include <linux/pci-aspm.h>
586 + #include <linux/ethtool.h>
587 + #include <linux/uaccess.h>
588 +
589 +@@ -448,6 +449,26 @@ ath5k_pci_probe(struct pci_dev *pdev,
590 + int ret;
591 + u8 csz;
592 +
593 ++ /*
594 ++ * L0s needs to be disabled on all ath5k cards.
595 ++ *
596 ++ * For distributions shipping with CONFIG_PCIEASPM (this will be enabled
597 ++ * by default in the future in 2.6.36) this will also mean both L1 and
598 ++ * L0s will be disabled when a pre 1.1 PCIe device is detected. We do
599 ++ * know L1 works correctly even for all ath5k pre 1.1 PCIe devices
600 ++ * though but cannot currently undue the effect of a blacklist, for
601 ++ * details you can read pcie_aspm_sanity_check() and see how it adjusts
602 ++ * the device link capability.
603 ++ *
604 ++ * It may be possible in the future to implement some PCI API to allow
605 ++ * drivers to override blacklists for pre 1.1 PCIe but for now it is
606 ++ * best to accept that both L0s and L1 will be disabled completely for
607 ++ * distributions shipping with CONFIG_PCIEASPM rather than having this
608 ++ * issue present. Motivation for adding this new API will be to help
609 ++ * with power consumption for some of these devices.
610 ++ */
611 ++ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S);
612 ++
613 + ret = pci_enable_device(pdev);
614 + if (ret) {
615 + dev_err(&pdev->dev, "can't enable device\n");
616 +diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
617 +index d919e96..7905285 100644
618 +--- a/drivers/pcmcia/pcmcia_resource.c
619 ++++ b/drivers/pcmcia/pcmcia_resource.c
620 +@@ -39,7 +39,7 @@ module_param(io_speed, int, 0444);
621 + #ifdef CONFIG_PCMCIA_PROBE
622 + #include <asm/irq.h>
623 + /* mask of IRQs already reserved by other cards, we should avoid using them */
624 +-static u8 pcmcia_used_irq[NR_IRQS];
625 ++static u8 pcmcia_used_irq[32];
626 + #endif
627 +
628 +
629 +@@ -719,6 +719,9 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
630 + for (try = 0; try < 64; try++) {
631 + irq = try % 32;
632 +
633 ++ if (irq > NR_IRQS)
634 ++ continue;
635 ++
636 + /* marked as available by driver, and not blocked by userspace? */
637 + if (!((mask >> irq) & 1))
638 + continue;
639 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
640 +index 317e8dc..6416a0f 100644
641 +--- a/drivers/usb/host/xhci-ring.c
642 ++++ b/drivers/usb/host/xhci-ring.c
643 +@@ -124,7 +124,7 @@ static void next_trb(struct xhci_hcd *xhci,
644 + *seg = (*seg)->next;
645 + *trb = ((*seg)->trbs);
646 + } else {
647 +- *trb = (*trb)++;
648 ++ (*trb)++;
649 + }
650 + }
651 +
652 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
653 +index ae4b181..99bde5fc 100644
654 +--- a/drivers/usb/serial/cp210x.c
655 ++++ b/drivers/usb/serial/cp210x.c
656 +@@ -223,8 +223,8 @@ static struct usb_serial_driver cp210x_device = {
657 + #define BITS_STOP_2 0x0002
658 +
659 + /* CP210X_SET_BREAK */
660 +-#define BREAK_ON 0x0000
661 +-#define BREAK_OFF 0x0001
662 ++#define BREAK_ON 0x0001
663 ++#define BREAK_OFF 0x0000
664 +
665 + /* CP210X_(SET_MHS|GET_MDMSTS) */
666 + #define CONTROL_DTR 0x0001
667 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
668 +index b2353a9..813ec3d 100644
669 +--- a/drivers/usb/serial/ftdi_sio.c
670 ++++ b/drivers/usb/serial/ftdi_sio.c
671 +@@ -185,6 +185,7 @@ static struct usb_device_id id_table_combined [] = {
672 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
673 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
674 + { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
675 ++ { USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) },
676 + { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) },
677 + { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) },
678 + { USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) },
679 +@@ -756,6 +757,8 @@ static struct usb_device_id id_table_combined [] = {
680 + { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
681 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
682 + { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
683 ++ { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
684 ++ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
685 + { }, /* Optional parameter entry */
686 + { } /* Terminating entry */
687 + };
688 +@@ -1410,7 +1413,7 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port)
689 + }
690 +
691 + /* set max packet size based on descriptor */
692 +- priv->max_packet_size = ep_desc->wMaxPacketSize;
693 ++ priv->max_packet_size = le16_to_cpu(ep_desc->wMaxPacketSize);
694 +
695 + dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
696 + }
697 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
698 +index a0a7796..52c3b68 100644
699 +--- a/drivers/usb/serial/ftdi_sio_ids.h
700 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
701 +@@ -110,6 +110,9 @@
702 + /* Propox devices */
703 + #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738
704 +
705 ++/* Lenz LI-USB Computer Interface. */
706 ++#define FTDI_LENZ_LIUSB_PID 0xD780
707 ++
708 + /*
709 + * Xsens Technologies BV products (http://www.xsens.com).
710 + */
711 +@@ -996,6 +999,12 @@
712 + #define ALTI2_N3_PID 0x6001 /* Neptune 3 */
713 +
714 + /*
715 ++ * Ionics PlugComputer
716 ++ */
717 ++#define IONICS_VID 0x1c0c
718 ++#define IONICS_PLUGCOMPUTER_PID 0x0102
719 ++
720 ++/*
721 + * Dresden Elektronic Sensor Terminal Board
722 + */
723 + #define DE_VID 0x1cf1 /* Vendor ID */
724 +diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
725 +index d4cc0f7..fbdbac5 100644
726 +--- a/drivers/usb/serial/io_ti.c
727 ++++ b/drivers/usb/serial/io_ti.c
728 +@@ -1157,7 +1157,7 @@ static int download_fw(struct edgeport_serial *serial)
729 +
730 + /* Check if we have an old version in the I2C and
731 + update if necessary */
732 +- if (download_cur_ver != download_new_ver) {
733 ++ if (download_cur_ver < download_new_ver) {
734 + dbg("%s - Update I2C dld from %d.%d to %d.%d",
735 + __func__,
736 + firmware_version->Ver_Major,
737 +diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
738 +index 5ceaa4c..061a083 100644
739 +--- a/drivers/usb/serial/navman.c
740 ++++ b/drivers/usb/serial/navman.c
741 +@@ -24,6 +24,7 @@ static int debug;
742 +
743 + static struct usb_device_id id_table [] = {
744 + { USB_DEVICE(0x0a99, 0x0001) }, /* Talon Technology device */
745 ++ { USB_DEVICE(0x0df7, 0x0900) }, /* Mobile Action i-gotU */
746 + { },
747 + };
748 + MODULE_DEVICE_TABLE(usb, id_table);
749 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
750 +index e864052..19cedb9 100644
751 +--- a/drivers/usb/serial/option.c
752 ++++ b/drivers/usb/serial/option.c
753 +@@ -375,6 +375,10 @@ static int option_resume(struct usb_serial *serial);
754 + #define OLIVETTI_VENDOR_ID 0x0b3c
755 + #define OLIVETTI_PRODUCT_OLICARD100 0xc000
756 +
757 ++/* Celot products */
758 ++#define CELOT_VENDOR_ID 0x211f
759 ++#define CELOT_PRODUCT_CT680M 0x6801
760 ++
761 + static struct usb_device_id option_ids[] = {
762 + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
763 + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
764 +@@ -874,10 +878,9 @@ static struct usb_device_id option_ids[] = {
765 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
766 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
767 + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
768 +-
769 + { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
770 +-
771 + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
772 ++ { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
773 + { } /* Terminating entry */
774 + };
775 + MODULE_DEVICE_TABLE(usb, option_ids);
776 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
777 +index 9ec1a49..ecb1708 100644
778 +--- a/drivers/usb/serial/pl2303.c
779 ++++ b/drivers/usb/serial/pl2303.c
780 +@@ -95,6 +95,7 @@ static struct usb_device_id id_table [] = {
781 + { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) },
782 + { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) },
783 + { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) },
784 ++ { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) },
785 + { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
786 + { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
787 + { } /* Terminating entry */
788 +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
789 +index d640dc9..01bc64b 100644
790 +--- a/drivers/usb/serial/pl2303.h
791 ++++ b/drivers/usb/serial/pl2303.h
792 +@@ -127,6 +127,10 @@
793 + #define CRESSI_VENDOR_ID 0x04b8
794 + #define CRESSI_EDY_PRODUCT_ID 0x0521
795 +
796 ++/* Zeagle dive computer interface */
797 ++#define ZEAGLE_VENDOR_ID 0x04b8
798 ++#define ZEAGLE_N2ITION3_PRODUCT_ID 0x0522
799 ++
800 + /* Sony, USB data cable for CMD-Jxx mobile phones */
801 + #define SONY_VENDOR_ID 0x054c
802 + #define SONY_QN3USB_PRODUCT_ID 0x0437
803 +diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
804 +index 4cd5049..3803745 100644
805 +--- a/drivers/video/sunxvr500.c
806 ++++ b/drivers/video/sunxvr500.c
807 +@@ -242,11 +242,27 @@ static int __devinit e3d_set_fbinfo(struct e3d_info *ep)
808 + static int __devinit e3d_pci_register(struct pci_dev *pdev,
809 + const struct pci_device_id *ent)
810 + {
811 ++ struct device_node *of_node;
812 ++ const char *device_type;
813 + struct fb_info *info;
814 + struct e3d_info *ep;
815 + unsigned int line_length;
816 + int err;
817 +
818 ++ of_node = pci_device_to_OF_node(pdev);
819 ++ if (!of_node) {
820 ++ printk(KERN_ERR "e3d: Cannot find OF node of %s\n",
821 ++ pci_name(pdev));
822 ++ return -ENODEV;
823 ++ }
824 ++
825 ++ device_type = of_get_property(of_node, "device_type", NULL);
826 ++ if (!device_type) {
827 ++ printk(KERN_INFO "e3d: Ignoring secondary output device "
828 ++ "at %s\n", pci_name(pdev));
829 ++ return -ENODEV;
830 ++ }
831 ++
832 + err = pci_enable_device(pdev);
833 + if (err < 0) {
834 + printk(KERN_ERR "e3d: Cannot enable PCI device %s\n",
835 +@@ -265,13 +281,7 @@ static int __devinit e3d_pci_register(struct pci_dev *pdev,
836 + ep->info = info;
837 + ep->pdev = pdev;
838 + spin_lock_init(&ep->lock);
839 +- ep->of_node = pci_device_to_OF_node(pdev);
840 +- if (!ep->of_node) {
841 +- printk(KERN_ERR "e3d: Cannot find OF node of %s\n",
842 +- pci_name(pdev));
843 +- err = -ENODEV;
844 +- goto err_release_fb;
845 +- }
846 ++ ep->of_node = of_node;
847 +
848 + /* Read the PCI base register of the frame buffer, which we
849 + * need in order to interpret the RAMDAC_VID_*FB* values in
850 +diff --git a/firmware/Makefile b/firmware/Makefile
851 +index f4ca0c7..aeabd95 100644
852 +--- a/firmware/Makefile
853 ++++ b/firmware/Makefile
854 +@@ -140,7 +140,7 @@ fw-shipped-$(CONFIG_YAM) += yam/1200.bin yam/9600.bin
855 + fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-)
856 +
857 + # Directories which we _might_ need to create, so we have a rule for them.
858 +-firmware-dirs := $(sort $(patsubst %,$(objtree)/$(obj)/%/,$(dir $(fw-external-y) $(fw-shipped-all))))
859 ++firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
860 +
861 + quiet_cmd_mkdir = MKDIR $(patsubst $(objtree)/%,%,$@)
862 + cmd_mkdir = mkdir -p $@
863 +diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
864 +index f3032c9..e85b63c 100644
865 +--- a/fs/ext4/balloc.c
866 ++++ b/fs/ext4/balloc.c
867 +@@ -189,9 +189,6 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
868 + * when a file system is mounted (see ext4_fill_super).
869 + */
870 +
871 +-
872 +-#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
873 +-
874 + /**
875 + * ext4_get_group_desc() -- load group descriptor from disk
876 + * @sb: super block
877 +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
878 +index fa6b79f..0773352 100644
879 +--- a/fs/ext4/ext4.h
880 ++++ b/fs/ext4/ext4.h
881 +@@ -1888,6 +1888,8 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh)
882 + set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state);
883 + }
884 +
885 ++#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
886 ++
887 + #endif /* __KERNEL__ */
888 +
889 + #endif /* _EXT4_H */
890 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
891 +index 99482ea..f375559 100644
892 +--- a/fs/ext4/extents.c
893 ++++ b/fs/ext4/extents.c
894 +@@ -1948,7 +1948,7 @@ ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block,
895 +
896 + BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP &&
897 + cex->ec_type != EXT4_EXT_CACHE_EXTENT);
898 +- if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) {
899 ++ if (in_range(block, cex->ec_block, cex->ec_len)) {
900 + ex->ee_block = cpu_to_le32(cex->ec_block);
901 + ext4_ext_store_pblock(ex, cex->ec_start);
902 + ex->ee_len = cpu_to_le16(cex->ec_len);
903 +@@ -3302,7 +3302,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
904 + */
905 + ee_len = ext4_ext_get_actual_len(ex);
906 + /* if found extent covers block, simply return it */
907 +- if (iblock >= ee_block && iblock < ee_block + ee_len) {
908 ++ if (in_range(iblock, ee_block, ee_len)) {
909 + newblock = iblock - ee_block + ee_start;
910 + /* number of remaining blocks in the extent */
911 + allocated = ee_len - (iblock - ee_block);
912 +diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
913 +index 0ca8110..ceb9d41 100644
914 +--- a/fs/ext4/mballoc.h
915 ++++ b/fs/ext4/mballoc.h
916 +@@ -221,8 +221,6 @@ struct ext4_buddy {
917 + #define EXT4_MB_BITMAP(e4b) ((e4b)->bd_bitmap)
918 + #define EXT4_MB_BUDDY(e4b) ((e4b)->bd_buddy)
919 +
920 +-#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
921 +-
922 + static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb,
923 + struct ext4_free_extent *fex)
924 + {
925 +diff --git a/fs/nfs/super.c b/fs/nfs/super.c
926 +index a53b9e5..c0173a8 100644
927 +--- a/fs/nfs/super.c
928 ++++ b/fs/nfs/super.c
929 +@@ -616,6 +616,13 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
930 +
931 + if (nfss->options & NFS_OPTION_FSCACHE)
932 + seq_printf(m, ",fsc");
933 ++
934 ++ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
935 ++ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
936 ++ seq_printf(m, ",lookupcache=none");
937 ++ else
938 ++ seq_printf(m, ",lookupcache=pos");
939 ++ }
940 + }
941 +
942 + /*
943 +diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
944 +index d8fe53a..c8288df 100644
945 +--- a/fs/ocfs2/acl.c
946 ++++ b/fs/ocfs2/acl.c
947 +@@ -293,12 +293,30 @@ static int ocfs2_set_acl(handle_t *handle,
948 +
949 + int ocfs2_check_acl(struct inode *inode, int mask)
950 + {
951 +- struct posix_acl *acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
952 ++ struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
953 ++ struct buffer_head *di_bh = NULL;
954 ++ struct posix_acl *acl;
955 ++ int ret = -EAGAIN;
956 +
957 +- if (IS_ERR(acl))
958 ++ if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
959 ++ return ret;
960 ++
961 ++ ret = ocfs2_read_inode_block(inode, &di_bh);
962 ++ if (ret < 0) {
963 ++ mlog_errno(ret);
964 ++ return ret;
965 ++ }
966 ++
967 ++ acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, di_bh);
968 ++
969 ++ brelse(di_bh);
970 ++
971 ++ if (IS_ERR(acl)) {
972 ++ mlog_errno(PTR_ERR(acl));
973 + return PTR_ERR(acl);
974 ++ }
975 + if (acl) {
976 +- int ret = posix_acl_permission(inode, acl, mask);
977 ++ ret = posix_acl_permission(inode, acl, mask);
978 + posix_acl_release(acl);
979 + return ret;
980 + }
981 +@@ -347,7 +365,7 @@ int ocfs2_init_acl(handle_t *handle,
982 + {
983 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
984 + struct posix_acl *acl = NULL;
985 +- int ret = 0;
986 ++ int ret = 0, ret2;
987 + mode_t mode;
988 +
989 + if (!S_ISLNK(inode->i_mode)) {
990 +@@ -384,7 +402,12 @@ int ocfs2_init_acl(handle_t *handle,
991 + mode = inode->i_mode;
992 + ret = posix_acl_create_masq(clone, &mode);
993 + if (ret >= 0) {
994 +- ret = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
995 ++ ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
996 ++ if (ret2) {
997 ++ mlog_errno(ret2);
998 ++ ret = ret2;
999 ++ goto cleanup;
1000 ++ }
1001 + if (ret > 0) {
1002 + ret = ocfs2_set_acl(handle, inode,
1003 + di_bh, ACL_TYPE_ACCESS,
1004 +diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
1005 +index 83bcaf2..ef1ac9a 100644
1006 +--- a/fs/ocfs2/dlm/dlmmaster.c
1007 ++++ b/fs/ocfs2/dlm/dlmmaster.c
1008 +@@ -511,8 +511,6 @@ static void dlm_lockres_release(struct kref *kref)
1009 +
1010 + atomic_dec(&dlm->res_cur_count);
1011 +
1012 +- dlm_put(dlm);
1013 +-
1014 + if (!hlist_unhashed(&res->hash_node) ||
1015 + !list_empty(&res->granted) ||
1016 + !list_empty(&res->converting) ||
1017 +@@ -585,8 +583,6 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
1018 + res->migration_pending = 0;
1019 + res->inflight_locks = 0;
1020 +
1021 +- /* put in dlm_lockres_release */
1022 +- dlm_grab(dlm);
1023 + res->dlm = dlm;
1024 +
1025 + kref_init(&res->refs);
1026 +@@ -3046,8 +3042,6 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
1027 + /* check for pre-existing lock */
1028 + spin_lock(&dlm->spinlock);
1029 + res = __dlm_lookup_lockres(dlm, name, namelen, hash);
1030 +- spin_lock(&dlm->master_lock);
1031 +-
1032 + if (res) {
1033 + spin_lock(&res->spinlock);
1034 + if (res->state & DLM_LOCK_RES_RECOVERING) {
1035 +@@ -3065,14 +3059,15 @@ int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data,
1036 + spin_unlock(&res->spinlock);
1037 + }
1038 +
1039 ++ spin_lock(&dlm->master_lock);
1040 + /* ignore status. only nonzero status would BUG. */
1041 + ret = dlm_add_migration_mle(dlm, res, mle, &oldmle,
1042 + name, namelen,
1043 + migrate->new_master,
1044 + migrate->master);
1045 +
1046 +-unlock:
1047 + spin_unlock(&dlm->master_lock);
1048 ++unlock:
1049 + spin_unlock(&dlm->spinlock);
1050 +
1051 + if (oldmle) {
1052 +diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
1053 +index d9fa3d2..3492550 100644
1054 +--- a/fs/ocfs2/dlm/dlmrecovery.c
1055 ++++ b/fs/ocfs2/dlm/dlmrecovery.c
1056 +@@ -1941,6 +1941,8 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm,
1057 + struct list_head *queue;
1058 + struct dlm_lock *lock, *next;
1059 +
1060 ++ assert_spin_locked(&dlm->spinlock);
1061 ++ assert_spin_locked(&res->spinlock);
1062 + res->state |= DLM_LOCK_RES_RECOVERING;
1063 + if (!list_empty(&res->recovering)) {
1064 + mlog(0,
1065 +@@ -2265,19 +2267,15 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
1066 + /* zero the lvb if necessary */
1067 + dlm_revalidate_lvb(dlm, res, dead_node);
1068 + if (res->owner == dead_node) {
1069 +- if (res->state & DLM_LOCK_RES_DROPPING_REF)
1070 +- mlog(0, "%s:%.*s: owned by "
1071 +- "dead node %u, this node was "
1072 +- "dropping its ref when it died. "
1073 +- "continue, dropping the flag.\n",
1074 +- dlm->name, res->lockname.len,
1075 +- res->lockname.name, dead_node);
1076 +-
1077 +- /* the wake_up for this will happen when the
1078 +- * RECOVERING flag is dropped later */
1079 +- res->state &= ~DLM_LOCK_RES_DROPPING_REF;
1080 ++ if (res->state & DLM_LOCK_RES_DROPPING_REF) {
1081 ++ mlog(ML_NOTICE, "Ignore %.*s for "
1082 ++ "recovery as it is being freed\n",
1083 ++ res->lockname.len,
1084 ++ res->lockname.name);
1085 ++ } else
1086 ++ dlm_move_lockres_to_recovery_list(dlm,
1087 ++ res);
1088 +
1089 +- dlm_move_lockres_to_recovery_list(dlm, res);
1090 + } else if (res->owner == dlm->node_num) {
1091 + dlm_free_dead_locks(dlm, res, dead_node);
1092 + __dlm_lockres_calc_usage(dlm, res);
1093 +diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
1094 +index 52ec020..86491f5 100644
1095 +--- a/fs/ocfs2/dlm/dlmthread.c
1096 ++++ b/fs/ocfs2/dlm/dlmthread.c
1097 +@@ -93,19 +93,27 @@ int __dlm_lockres_has_locks(struct dlm_lock_resource *res)
1098 + * truly ready to be freed. */
1099 + int __dlm_lockres_unused(struct dlm_lock_resource *res)
1100 + {
1101 +- if (!__dlm_lockres_has_locks(res) &&
1102 +- (list_empty(&res->dirty) && !(res->state & DLM_LOCK_RES_DIRTY))) {
1103 +- /* try not to scan the bitmap unless the first two
1104 +- * conditions are already true */
1105 +- int bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
1106 +- if (bit >= O2NM_MAX_NODES) {
1107 +- /* since the bit for dlm->node_num is not
1108 +- * set, inflight_locks better be zero */
1109 +- BUG_ON(res->inflight_locks != 0);
1110 +- return 1;
1111 +- }
1112 +- }
1113 +- return 0;
1114 ++ int bit;
1115 ++
1116 ++ if (__dlm_lockres_has_locks(res))
1117 ++ return 0;
1118 ++
1119 ++ if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY)
1120 ++ return 0;
1121 ++
1122 ++ if (res->state & DLM_LOCK_RES_RECOVERING)
1123 ++ return 0;
1124 ++
1125 ++ bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
1126 ++ if (bit < O2NM_MAX_NODES)
1127 ++ return 0;
1128 ++
1129 ++ /*
1130 ++ * since the bit for dlm->node_num is not set, inflight_locks better
1131 ++ * be zero
1132 ++ */
1133 ++ BUG_ON(res->inflight_locks != 0);
1134 ++ return 1;
1135 + }
1136 +
1137 +
1138 +@@ -153,45 +161,25 @@ void dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
1139 + spin_unlock(&dlm->spinlock);
1140 + }
1141 +
1142 +-static int dlm_purge_lockres(struct dlm_ctxt *dlm,
1143 ++static void dlm_purge_lockres(struct dlm_ctxt *dlm,
1144 + struct dlm_lock_resource *res)
1145 + {
1146 + int master;
1147 + int ret = 0;
1148 +
1149 +- spin_lock(&res->spinlock);
1150 +- if (!__dlm_lockres_unused(res)) {
1151 +- mlog(0, "%s:%.*s: tried to purge but not unused\n",
1152 +- dlm->name, res->lockname.len, res->lockname.name);
1153 +- __dlm_print_one_lock_resource(res);
1154 +- spin_unlock(&res->spinlock);
1155 +- BUG();
1156 +- }
1157 +-
1158 +- if (res->state & DLM_LOCK_RES_MIGRATING) {
1159 +- mlog(0, "%s:%.*s: Delay dropref as this lockres is "
1160 +- "being remastered\n", dlm->name, res->lockname.len,
1161 +- res->lockname.name);
1162 +- /* Re-add the lockres to the end of the purge list */
1163 +- if (!list_empty(&res->purge)) {
1164 +- list_del_init(&res->purge);
1165 +- list_add_tail(&res->purge, &dlm->purge_list);
1166 +- }
1167 +- spin_unlock(&res->spinlock);
1168 +- return 0;
1169 +- }
1170 ++ assert_spin_locked(&dlm->spinlock);
1171 ++ assert_spin_locked(&res->spinlock);
1172 +
1173 + master = (res->owner == dlm->node_num);
1174 +
1175 +- if (!master)
1176 +- res->state |= DLM_LOCK_RES_DROPPING_REF;
1177 +- spin_unlock(&res->spinlock);
1178 +
1179 + mlog(0, "purging lockres %.*s, master = %d\n", res->lockname.len,
1180 + res->lockname.name, master);
1181 +
1182 + if (!master) {
1183 ++ res->state |= DLM_LOCK_RES_DROPPING_REF;
1184 + /* drop spinlock... retake below */
1185 ++ spin_unlock(&res->spinlock);
1186 + spin_unlock(&dlm->spinlock);
1187 +
1188 + spin_lock(&res->spinlock);
1189 +@@ -209,31 +197,35 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
1190 + mlog(0, "%s:%.*s: dlm_deref_lockres returned %d\n",
1191 + dlm->name, res->lockname.len, res->lockname.name, ret);
1192 + spin_lock(&dlm->spinlock);
1193 ++ spin_lock(&res->spinlock);
1194 + }
1195 +
1196 +- spin_lock(&res->spinlock);
1197 + if (!list_empty(&res->purge)) {
1198 + mlog(0, "removing lockres %.*s:%p from purgelist, "
1199 + "master = %d\n", res->lockname.len, res->lockname.name,
1200 + res, master);
1201 + list_del_init(&res->purge);
1202 +- spin_unlock(&res->spinlock);
1203 + dlm_lockres_put(res);
1204 + dlm->purge_count--;
1205 +- } else
1206 +- spin_unlock(&res->spinlock);
1207 ++ }
1208 ++
1209 ++ if (!__dlm_lockres_unused(res)) {
1210 ++ mlog(ML_ERROR, "found lockres %s:%.*s: in use after deref\n",
1211 ++ dlm->name, res->lockname.len, res->lockname.name);
1212 ++ __dlm_print_one_lock_resource(res);
1213 ++ BUG();
1214 ++ }
1215 +
1216 + __dlm_unhash_lockres(res);
1217 +
1218 + /* lockres is not in the hash now. drop the flag and wake up
1219 + * any processes waiting in dlm_get_lock_resource. */
1220 + if (!master) {
1221 +- spin_lock(&res->spinlock);
1222 + res->state &= ~DLM_LOCK_RES_DROPPING_REF;
1223 + spin_unlock(&res->spinlock);
1224 + wake_up(&res->wq);
1225 +- }
1226 +- return 0;
1227 ++ } else
1228 ++ spin_unlock(&res->spinlock);
1229 + }
1230 +
1231 + static void dlm_run_purge_list(struct dlm_ctxt *dlm,
1232 +@@ -252,17 +244,7 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
1233 + lockres = list_entry(dlm->purge_list.next,
1234 + struct dlm_lock_resource, purge);
1235 +
1236 +- /* Status of the lockres *might* change so double
1237 +- * check. If the lockres is unused, holding the dlm
1238 +- * spinlock will prevent people from getting and more
1239 +- * refs on it -- there's no need to keep the lockres
1240 +- * spinlock. */
1241 + spin_lock(&lockres->spinlock);
1242 +- unused = __dlm_lockres_unused(lockres);
1243 +- spin_unlock(&lockres->spinlock);
1244 +-
1245 +- if (!unused)
1246 +- continue;
1247 +
1248 + purge_jiffies = lockres->last_used +
1249 + msecs_to_jiffies(DLM_PURGE_INTERVAL_MS);
1250 +@@ -274,15 +256,29 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
1251 + * in tail order, we can stop at the first
1252 + * unpurgable resource -- anyone added after
1253 + * him will have a greater last_used value */
1254 ++ spin_unlock(&lockres->spinlock);
1255 + break;
1256 + }
1257 +
1258 ++ /* Status of the lockres *might* change so double
1259 ++ * check. If the lockres is unused, holding the dlm
1260 ++ * spinlock will prevent people from getting and more
1261 ++ * refs on it. */
1262 ++ unused = __dlm_lockres_unused(lockres);
1263 ++ if (!unused ||
1264 ++ (lockres->state & DLM_LOCK_RES_MIGRATING)) {
1265 ++ mlog(0, "lockres %s:%.*s: is in use or "
1266 ++ "being remastered, used %d, state %d\n",
1267 ++ dlm->name, lockres->lockname.len,
1268 ++ lockres->lockname.name, !unused, lockres->state);
1269 ++ list_move_tail(&dlm->purge_list, &lockres->purge);
1270 ++ spin_unlock(&lockres->spinlock);
1271 ++ continue;
1272 ++ }
1273 ++
1274 + dlm_lockres_get(lockres);
1275 +
1276 +- /* This may drop and reacquire the dlm spinlock if it
1277 +- * has to do migration. */
1278 +- if (dlm_purge_lockres(dlm, lockres))
1279 +- BUG();
1280 ++ dlm_purge_lockres(dlm, lockres);
1281 +
1282 + dlm_lockres_put(lockres);
1283 +
1284 +diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
1285 +index bb0465f..10e9527 100644
1286 +--- a/fs/ocfs2/refcounttree.c
1287 ++++ b/fs/ocfs2/refcounttree.c
1288 +@@ -2454,16 +2454,26 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
1289 + len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) +
1290 + le32_to_cpu(rec.r_clusters)) - cpos;
1291 + /*
1292 +- * If the refcount rec already exist, cool. We just need
1293 +- * to check whether there is a split. Otherwise we just need
1294 +- * to increase the refcount.
1295 +- * If we will insert one, increases recs_add.
1296 +- *
1297 + * We record all the records which will be inserted to the
1298 + * same refcount block, so that we can tell exactly whether
1299 + * we need a new refcount block or not.
1300 ++ *
1301 ++ * If we will insert a new one, this is easy and only happens
1302 ++ * during adding refcounted flag to the extent, so we don't
1303 ++ * have a chance of spliting. We just need one record.
1304 ++ *
1305 ++ * If the refcount rec already exists, that would be a little
1306 ++ * complicated. we may have to:
1307 ++ * 1) split at the beginning if the start pos isn't aligned.
1308 ++ * we need 1 more record in this case.
1309 ++ * 2) split int the end if the end pos isn't aligned.
1310 ++ * we need 1 more record in this case.
1311 ++ * 3) split in the middle because of file system fragmentation.
1312 ++ * we need 2 more records in this case(we can't detect this
1313 ++ * beforehand, so always think of the worst case).
1314 + */
1315 + if (rec.r_refcount) {
1316 ++ recs_add += 2;
1317 + /* Check whether we need a split at the beginning. */
1318 + if (cpos == start_cpos &&
1319 + cpos != le64_to_cpu(rec.r_cpos))
1320 +diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
1321 +index 84a524a..9d12ed5 100644
1322 +--- a/include/linux/mm_types.h
1323 ++++ b/include/linux/mm_types.h
1324 +@@ -138,7 +138,7 @@ struct vm_area_struct {
1325 + within vm_mm. */
1326 +
1327 + /* linked list of VM areas per task, sorted by address */
1328 +- struct vm_area_struct *vm_next;
1329 ++ struct vm_area_struct *vm_next, *vm_prev;
1330 +
1331 + pgprot_t vm_page_prot; /* Access permissions of this VMA. */
1332 + unsigned long vm_flags; /* Flags, see mm.h. */
1333 +diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
1334 +index 6a664c3..7dc97d1 100644
1335 +--- a/include/sound/emu10k1.h
1336 ++++ b/include/sound/emu10k1.h
1337 +@@ -1707,6 +1707,7 @@ struct snd_emu10k1 {
1338 + unsigned int card_type; /* EMU10K1_CARD_* */
1339 + unsigned int ecard_ctrl; /* ecard control bits */
1340 + unsigned long dma_mask; /* PCI DMA mask */
1341 ++ unsigned int delay_pcm_irq; /* in samples */
1342 + int max_cache_pages; /* max memory size / PAGE_SIZE */
1343 + struct snd_dma_buffer silent_page; /* silent page */
1344 + struct snd_dma_buffer ptb_pages; /* page table pages */
1345 +diff --git a/kernel/fork.c b/kernel/fork.c
1346 +index ce2f585..9f3b066 100644
1347 +--- a/kernel/fork.c
1348 ++++ b/kernel/fork.c
1349 +@@ -277,7 +277,7 @@ out:
1350 + #ifdef CONFIG_MMU
1351 + static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
1352 + {
1353 +- struct vm_area_struct *mpnt, *tmp, **pprev;
1354 ++ struct vm_area_struct *mpnt, *tmp, *prev, **pprev;
1355 + struct rb_node **rb_link, *rb_parent;
1356 + int retval;
1357 + unsigned long charge;
1358 +@@ -305,6 +305,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
1359 + if (retval)
1360 + goto out;
1361 +
1362 ++ prev = NULL;
1363 + for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
1364 + struct file *file;
1365 +
1366 +@@ -333,7 +334,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
1367 + vma_set_policy(tmp, pol);
1368 + tmp->vm_flags &= ~VM_LOCKED;
1369 + tmp->vm_mm = mm;
1370 +- tmp->vm_next = NULL;
1371 ++ tmp->vm_next = tmp->vm_prev = NULL;
1372 + anon_vma_link(tmp);
1373 + file = tmp->vm_file;
1374 + if (file) {
1375 +@@ -367,6 +368,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
1376 + */
1377 + *pprev = tmp;
1378 + pprev = &tmp->vm_next;
1379 ++ tmp->vm_prev = prev;
1380 ++ prev = tmp;
1381 +
1382 + __vma_link_rb(mm, tmp, rb_link, rb_parent);
1383 + rb_link = &tmp->vm_rb.rb_right;
1384 +diff --git a/mm/memory.c b/mm/memory.c
1385 +index babb991..194dc17 100644
1386 +--- a/mm/memory.c
1387 ++++ b/mm/memory.c
1388 +@@ -2640,11 +2640,18 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo
1389 + {
1390 + address &= PAGE_MASK;
1391 + if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
1392 +- address -= PAGE_SIZE;
1393 +- if (find_vma(vma->vm_mm, address) != vma)
1394 +- return -ENOMEM;
1395 ++ struct vm_area_struct *prev = vma->vm_prev;
1396 ++
1397 ++ /*
1398 ++ * Is there a mapping abutting this one below?
1399 ++ *
1400 ++ * That's only ok if it's the same stack mapping
1401 ++ * that has gotten split..
1402 ++ */
1403 ++ if (prev && prev->vm_end == address)
1404 ++ return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
1405 +
1406 +- expand_stack(vma, address);
1407 ++ expand_stack(vma, address - PAGE_SIZE);
1408 + }
1409 + return 0;
1410 + }
1411 +diff --git a/mm/mlock.c b/mm/mlock.c
1412 +index 524d2a4..380ea89 100644
1413 +--- a/mm/mlock.c
1414 ++++ b/mm/mlock.c
1415 +@@ -138,6 +138,19 @@ void munlock_vma_page(struct page *page)
1416 + }
1417 + }
1418 +
1419 ++/* Is the vma a continuation of the stack vma above it? */
1420 ++static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr)
1421 ++{
1422 ++ return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);
1423 ++}
1424 ++
1425 ++static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)
1426 ++{
1427 ++ return (vma->vm_flags & VM_GROWSDOWN) &&
1428 ++ (vma->vm_start == addr) &&
1429 ++ !vma_stack_continue(vma->vm_prev, addr);
1430 ++}
1431 ++
1432 + /**
1433 + * __mlock_vma_pages_range() - mlock a range of pages in the vma.
1434 + * @vma: target vma
1435 +@@ -171,11 +184,9 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
1436 + gup_flags |= FOLL_WRITE;
1437 +
1438 + /* We don't try to access the guard page of a stack vma */
1439 +- if (vma->vm_flags & VM_GROWSDOWN) {
1440 +- if (start == vma->vm_start) {
1441 +- start += PAGE_SIZE;
1442 +- nr_pages--;
1443 +- }
1444 ++ if (stack_guard_page(vma, start)) {
1445 ++ addr += PAGE_SIZE;
1446 ++ nr_pages--;
1447 + }
1448 +
1449 + while (nr_pages > 0) {
1450 +diff --git a/mm/mmap.c b/mm/mmap.c
1451 +index ae19746..b309c75 100644
1452 +--- a/mm/mmap.c
1453 ++++ b/mm/mmap.c
1454 +@@ -389,17 +389,23 @@ static inline void
1455 + __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
1456 + struct vm_area_struct *prev, struct rb_node *rb_parent)
1457 + {
1458 ++ struct vm_area_struct *next;
1459 ++
1460 ++ vma->vm_prev = prev;
1461 + if (prev) {
1462 +- vma->vm_next = prev->vm_next;
1463 ++ next = prev->vm_next;
1464 + prev->vm_next = vma;
1465 + } else {
1466 + mm->mmap = vma;
1467 + if (rb_parent)
1468 +- vma->vm_next = rb_entry(rb_parent,
1469 ++ next = rb_entry(rb_parent,
1470 + struct vm_area_struct, vm_rb);
1471 + else
1472 +- vma->vm_next = NULL;
1473 ++ next = NULL;
1474 + }
1475 ++ vma->vm_next = next;
1476 ++ if (next)
1477 ++ next->vm_prev = vma;
1478 + }
1479 +
1480 + void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma,
1481 +@@ -487,7 +493,11 @@ static inline void
1482 + __vma_unlink(struct mm_struct *mm, struct vm_area_struct *vma,
1483 + struct vm_area_struct *prev)
1484 + {
1485 +- prev->vm_next = vma->vm_next;
1486 ++ struct vm_area_struct *next = vma->vm_next;
1487 ++
1488 ++ prev->vm_next = next;
1489 ++ if (next)
1490 ++ next->vm_prev = prev;
1491 + rb_erase(&vma->vm_rb, &mm->mm_rb);
1492 + if (mm->mmap_cache == vma)
1493 + mm->mmap_cache = prev;
1494 +@@ -1798,6 +1808,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
1495 + unsigned long addr;
1496 +
1497 + insertion_point = (prev ? &prev->vm_next : &mm->mmap);
1498 ++ vma->vm_prev = NULL;
1499 + do {
1500 + rb_erase(&vma->vm_rb, &mm->mm_rb);
1501 + mm->map_count--;
1502 +@@ -1805,6 +1816,8 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
1503 + vma = vma->vm_next;
1504 + } while (vma && vma->vm_start < end);
1505 + *insertion_point = vma;
1506 ++ if (vma)
1507 ++ vma->vm_prev = prev;
1508 + tail_vma->vm_next = NULL;
1509 + if (mm->unmap_area == arch_unmap_area)
1510 + addr = prev ? prev->vm_end : mm->mmap_base;
1511 +diff --git a/mm/nommu.c b/mm/nommu.c
1512 +index 9876fa0..ebb3154 100644
1513 +--- a/mm/nommu.c
1514 ++++ b/mm/nommu.c
1515 +@@ -608,7 +608,7 @@ static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
1516 + */
1517 + static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
1518 + {
1519 +- struct vm_area_struct *pvma, **pp;
1520 ++ struct vm_area_struct *pvma, **pp, *next;
1521 + struct address_space *mapping;
1522 + struct rb_node **p, *parent;
1523 +
1524 +@@ -668,8 +668,11 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
1525 + break;
1526 + }
1527 +
1528 +- vma->vm_next = *pp;
1529 ++ next = *pp;
1530 + *pp = vma;
1531 ++ vma->vm_next = next;
1532 ++ if (next)
1533 ++ next->vm_prev = vma;
1534 + }
1535 +
1536 + /*
1537 +diff --git a/mm/slab.c b/mm/slab.c
1538 +index 5d1a782..c8d466a 100644
1539 +--- a/mm/slab.c
1540 ++++ b/mm/slab.c
1541 +@@ -2249,8 +2249,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1542 + }
1543 + #if FORCED_DEBUG && defined(CONFIG_DEBUG_PAGEALLOC)
1544 + if (size >= malloc_sizes[INDEX_L3 + 1].cs_size
1545 +- && cachep->obj_size > cache_line_size() && size < PAGE_SIZE) {
1546 +- cachep->obj_offset += PAGE_SIZE - size;
1547 ++ && cachep->obj_size > cache_line_size() && ALIGN(size, align) < PAGE_SIZE) {
1548 ++ cachep->obj_offset += PAGE_SIZE - ALIGN(size, align);
1549 + size = PAGE_SIZE;
1550 + }
1551 + #endif
1552 +diff --git a/mm/vmscan.c b/mm/vmscan.c
1553 +index 692807f..4649929 100644
1554 +--- a/mm/vmscan.c
1555 ++++ b/mm/vmscan.c
1556 +@@ -1083,6 +1083,48 @@ static int too_many_isolated(struct zone *zone, int file,
1557 + }
1558 +
1559 + /*
1560 ++ * Returns true if the caller should wait to clean dirty/writeback pages.
1561 ++ *
1562 ++ * If we are direct reclaiming for contiguous pages and we do not reclaim
1563 ++ * everything in the list, try again and wait for writeback IO to complete.
1564 ++ * This will stall high-order allocations noticeably. Only do that when really
1565 ++ * need to free the pages under high memory pressure.
1566 ++ */
1567 ++static inline bool should_reclaim_stall(unsigned long nr_taken,
1568 ++ unsigned long nr_freed,
1569 ++ int priority,
1570 ++ int lumpy_reclaim,
1571 ++ struct scan_control *sc)
1572 ++{
1573 ++ int lumpy_stall_priority;
1574 ++
1575 ++ /* kswapd should not stall on sync IO */
1576 ++ if (current_is_kswapd())
1577 ++ return false;
1578 ++
1579 ++ /* Only stall on lumpy reclaim */
1580 ++ if (!lumpy_reclaim)
1581 ++ return false;
1582 ++
1583 ++ /* If we have relaimed everything on the isolated list, no stall */
1584 ++ if (nr_freed == nr_taken)
1585 ++ return false;
1586 ++
1587 ++ /*
1588 ++ * For high-order allocations, there are two stall thresholds.
1589 ++ * High-cost allocations stall immediately where as lower
1590 ++ * order allocations such as stacks require the scanning
1591 ++ * priority to be much higher before stalling.
1592 ++ */
1593 ++ if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
1594 ++ lumpy_stall_priority = DEF_PRIORITY;
1595 ++ else
1596 ++ lumpy_stall_priority = DEF_PRIORITY / 3;
1597 ++
1598 ++ return priority <= lumpy_stall_priority;
1599 ++}
1600 ++
1601 ++/*
1602 + * shrink_inactive_list() is a helper for shrink_zone(). It returns the number
1603 + * of reclaimed pages
1604 + */
1605 +@@ -1176,14 +1218,9 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
1606 + nr_scanned += nr_scan;
1607 + nr_freed = shrink_page_list(&page_list, sc, PAGEOUT_IO_ASYNC);
1608 +
1609 +- /*
1610 +- * If we are direct reclaiming for contiguous pages and we do
1611 +- * not reclaim everything in the list, try again and wait
1612 +- * for IO to complete. This will stall high-order allocations
1613 +- * but that should be acceptable to the caller
1614 +- */
1615 +- if (nr_freed < nr_taken && !current_is_kswapd() &&
1616 +- lumpy_reclaim) {
1617 ++ /* Check if we should syncronously wait for writeback */
1618 ++ if (should_reclaim_stall(nr_taken, nr_freed, priority,
1619 ++ lumpy_reclaim, sc)) {
1620 + congestion_wait(BLK_RW_ASYNC, HZ/10);
1621 +
1622 + /*
1623 +diff --git a/net/can/bcm.c b/net/can/bcm.c
1624 +index e8d58f3..ff8c690 100644
1625 +--- a/net/can/bcm.c
1626 ++++ b/net/can/bcm.c
1627 +@@ -59,6 +59,13 @@
1628 + #include <net/sock.h>
1629 + #include <net/net_namespace.h>
1630 +
1631 ++/*
1632 ++ * To send multiple CAN frame content within TX_SETUP or to filter
1633 ++ * CAN messages with multiplex index within RX_SETUP, the number of
1634 ++ * different filters is limited to 256 due to the one byte index value.
1635 ++ */
1636 ++#define MAX_NFRAMES 256
1637 ++
1638 + /* use of last_frames[index].can_dlc */
1639 + #define RX_RECV 0x40 /* received data for this element */
1640 + #define RX_THR 0x80 /* element not been sent due to throttle feature */
1641 +@@ -88,16 +95,16 @@ struct bcm_op {
1642 + struct list_head list;
1643 + int ifindex;
1644 + canid_t can_id;
1645 +- int flags;
1646 ++ u32 flags;
1647 + unsigned long frames_abs, frames_filtered;
1648 + struct timeval ival1, ival2;
1649 + struct hrtimer timer, thrtimer;
1650 + struct tasklet_struct tsklet, thrtsklet;
1651 + ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg;
1652 + int rx_ifindex;
1653 +- int count;
1654 +- int nframes;
1655 +- int currframe;
1656 ++ u32 count;
1657 ++ u32 nframes;
1658 ++ u32 currframe;
1659 + struct can_frame *frames;
1660 + struct can_frame *last_frames;
1661 + struct can_frame sframe;
1662 +@@ -174,7 +181,7 @@ static int bcm_proc_show(struct seq_file *m, void *v)
1663 +
1664 + seq_printf(m, "rx_op: %03X %-5s ",
1665 + op->can_id, bcm_proc_getifname(ifname, op->ifindex));
1666 +- seq_printf(m, "[%d]%c ", op->nframes,
1667 ++ seq_printf(m, "[%u]%c ", op->nframes,
1668 + (op->flags & RX_CHECK_DLC)?'d':' ');
1669 + if (op->kt_ival1.tv64)
1670 + seq_printf(m, "timeo=%lld ",
1671 +@@ -197,7 +204,7 @@ static int bcm_proc_show(struct seq_file *m, void *v)
1672 +
1673 + list_for_each_entry(op, &bo->tx_ops, list) {
1674 +
1675 +- seq_printf(m, "tx_op: %03X %s [%d] ",
1676 ++ seq_printf(m, "tx_op: %03X %s [%u] ",
1677 + op->can_id,
1678 + bcm_proc_getifname(ifname, op->ifindex),
1679 + op->nframes);
1680 +@@ -282,7 +289,7 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
1681 + struct can_frame *firstframe;
1682 + struct sockaddr_can *addr;
1683 + struct sock *sk = op->sk;
1684 +- int datalen = head->nframes * CFSIZ;
1685 ++ unsigned int datalen = head->nframes * CFSIZ;
1686 + int err;
1687 +
1688 + skb = alloc_skb(sizeof(*head) + datalen, gfp_any());
1689 +@@ -467,7 +474,7 @@ rx_changed_settime:
1690 + * bcm_rx_cmp_to_index - (bit)compares the currently received data to formerly
1691 + * received data stored in op->last_frames[]
1692 + */
1693 +-static void bcm_rx_cmp_to_index(struct bcm_op *op, int index,
1694 ++static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index,
1695 + const struct can_frame *rxdata)
1696 + {
1697 + /*
1698 +@@ -553,7 +560,8 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
1699 + /*
1700 + * bcm_rx_do_flush - helper for bcm_rx_thr_flush
1701 + */
1702 +-static inline int bcm_rx_do_flush(struct bcm_op *op, int update, int index)
1703 ++static inline int bcm_rx_do_flush(struct bcm_op *op, int update,
1704 ++ unsigned int index)
1705 + {
1706 + if ((op->last_frames) && (op->last_frames[index].can_dlc & RX_THR)) {
1707 + if (update)
1708 +@@ -574,7 +582,7 @@ static int bcm_rx_thr_flush(struct bcm_op *op, int update)
1709 + int updated = 0;
1710 +
1711 + if (op->nframes > 1) {
1712 +- int i;
1713 ++ unsigned int i;
1714 +
1715 + /* for MUX filter we start at index 1 */
1716 + for (i = 1; i < op->nframes; i++)
1717 +@@ -623,7 +631,7 @@ static void bcm_rx_handler(struct sk_buff *skb, void *data)
1718 + {
1719 + struct bcm_op *op = (struct bcm_op *)data;
1720 + const struct can_frame *rxframe = (struct can_frame *)skb->data;
1721 +- int i;
1722 ++ unsigned int i;
1723 +
1724 + /* disable timeout */
1725 + hrtimer_cancel(&op->timer);
1726 +@@ -823,14 +831,15 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1727 + {
1728 + struct bcm_sock *bo = bcm_sk(sk);
1729 + struct bcm_op *op;
1730 +- int i, err;
1731 ++ unsigned int i;
1732 ++ int err;
1733 +
1734 + /* we need a real device to send frames */
1735 + if (!ifindex)
1736 + return -ENODEV;
1737 +
1738 +- /* we need at least one can_frame */
1739 +- if (msg_head->nframes < 1)
1740 ++ /* check nframes boundaries - we need at least one can_frame */
1741 ++ if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES)
1742 + return -EINVAL;
1743 +
1744 + /* check the given can_id */
1745 +@@ -994,6 +1003,10 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1746 + msg_head->nframes = 0;
1747 + }
1748 +
1749 ++ /* the first element contains the mux-mask => MAX_NFRAMES + 1 */
1750 ++ if (msg_head->nframes > MAX_NFRAMES + 1)
1751 ++ return -EINVAL;
1752 ++
1753 + if ((msg_head->flags & RX_RTR_FRAME) &&
1754 + ((msg_head->nframes != 1) ||
1755 + (!(msg_head->can_id & CAN_RTR_FLAG))))
1756 +diff --git a/net/core/dev.c b/net/core/dev.c
1757 +index 74d0cce..915d0ae 100644
1758 +--- a/net/core/dev.c
1759 ++++ b/net/core/dev.c
1760 +@@ -2519,7 +2519,7 @@ pull:
1761 + put_page(skb_shinfo(skb)->frags[0].page);
1762 + memmove(skb_shinfo(skb)->frags,
1763 + skb_shinfo(skb)->frags + 1,
1764 +- --skb_shinfo(skb)->nr_frags);
1765 ++ --skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
1766 + }
1767 + }
1768 +
1769 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
1770 +index 19e9800..5a7dcdf 100644
1771 +--- a/net/netlink/af_netlink.c
1772 ++++ b/net/netlink/af_netlink.c
1773 +@@ -1363,7 +1363,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
1774 + struct netlink_sock *nlk = nlk_sk(sk);
1775 + int noblock = flags&MSG_DONTWAIT;
1776 + size_t copied;
1777 +- struct sk_buff *skb, *frag __maybe_unused = NULL;
1778 ++ struct sk_buff *skb, *data_skb;
1779 + int err;
1780 +
1781 + if (flags&MSG_OOB)
1782 +@@ -1375,45 +1375,35 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
1783 + if (skb == NULL)
1784 + goto out;
1785 +
1786 ++ data_skb = skb;
1787 ++
1788 + #ifdef CONFIG_COMPAT_NETLINK_MESSAGES
1789 + if (unlikely(skb_shinfo(skb)->frag_list)) {
1790 +- bool need_compat = !!(flags & MSG_CMSG_COMPAT);
1791 +-
1792 + /*
1793 +- * If this skb has a frag_list, then here that means that
1794 +- * we will have to use the frag_list skb for compat tasks
1795 +- * and the regular skb for non-compat tasks.
1796 ++ * If this skb has a frag_list, then here that means that we
1797 ++ * will have to use the frag_list skb's data for compat tasks
1798 ++ * and the regular skb's data for normal (non-compat) tasks.
1799 + *
1800 +- * The skb might (and likely will) be cloned, so we can't
1801 +- * just reset frag_list and go on with things -- we need to
1802 +- * keep that. For the compat case that's easy -- simply get
1803 +- * a reference to the compat skb and free the regular one
1804 +- * including the frag. For the non-compat case, we need to
1805 +- * avoid sending the frag to the user -- so assign NULL but
1806 +- * restore it below before freeing the skb.
1807 ++ * If we need to send the compat skb, assign it to the
1808 ++ * 'data_skb' variable so that it will be used below for data
1809 ++ * copying. We keep 'skb' for everything else, including
1810 ++ * freeing both later.
1811 + */
1812 +- if (need_compat) {
1813 +- struct sk_buff *compskb = skb_shinfo(skb)->frag_list;
1814 +- skb_get(compskb);
1815 +- kfree_skb(skb);
1816 +- skb = compskb;
1817 +- } else {
1818 +- frag = skb_shinfo(skb)->frag_list;
1819 +- skb_shinfo(skb)->frag_list = NULL;
1820 +- }
1821 ++ if (flags & MSG_CMSG_COMPAT)
1822 ++ data_skb = skb_shinfo(skb)->frag_list;
1823 + }
1824 + #endif
1825 +
1826 + msg->msg_namelen = 0;
1827 +
1828 +- copied = skb->len;
1829 ++ copied = data_skb->len;
1830 + if (len < copied) {
1831 + msg->msg_flags |= MSG_TRUNC;
1832 + copied = len;
1833 + }
1834 +
1835 +- skb_reset_transport_header(skb);
1836 +- err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
1837 ++ skb_reset_transport_header(data_skb);
1838 ++ err = skb_copy_datagram_iovec(data_skb, 0, msg->msg_iov, copied);
1839 +
1840 + if (msg->msg_name) {
1841 + struct sockaddr_nl *addr = (struct sockaddr_nl *)msg->msg_name;
1842 +@@ -1433,11 +1423,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
1843 + }
1844 + siocb->scm->creds = *NETLINK_CREDS(skb);
1845 + if (flags & MSG_TRUNC)
1846 +- copied = skb->len;
1847 +-
1848 +-#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
1849 +- skb_shinfo(skb)->frag_list = frag;
1850 +-#endif
1851 ++ copied = data_skb->len;
1852 +
1853 + skb_free_datagram(sk, skb);
1854 +
1855 +diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
1856 +index d885ba3..37e198c 100644
1857 +--- a/net/sched/act_nat.c
1858 ++++ b/net/sched/act_nat.c
1859 +@@ -240,7 +240,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
1860 + iph->saddr = new_addr;
1861 +
1862 + inet_proto_csum_replace4(&icmph->checksum, skb, addr, new_addr,
1863 +- 1);
1864 ++ 0);
1865 + break;
1866 + }
1867 + default:
1868 +diff --git a/scripts/mkmakefile b/scripts/mkmakefile
1869 +index 67d59c7..5325423 100644
1870 +--- a/scripts/mkmakefile
1871 ++++ b/scripts/mkmakefile
1872 +@@ -44,7 +44,9 @@ all:
1873 +
1874 + Makefile:;
1875 +
1876 +-\$(all) %/: all
1877 ++\$(all): all
1878 + @:
1879 +
1880 ++%/: all
1881 ++ @:
1882 + EOF
1883 +diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
1884 +index 7ba779d..e6d2d97 100644
1885 +--- a/sound/core/pcm_native.c
1886 ++++ b/sound/core/pcm_native.c
1887 +@@ -972,6 +972,10 @@ static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push)
1888 + {
1889 + if (substream->runtime->trigger_master != substream)
1890 + return 0;
1891 ++ /* some drivers might use hw_ptr to recover from the pause -
1892 ++ update the hw_ptr now */
1893 ++ if (push)
1894 ++ snd_pcm_update_hw_ptr(substream);
1895 + /* The jiffies check in snd_pcm_update_hw_ptr*() is done by
1896 + * a delta betwen the current jiffies, this gives a large enough
1897 + * delta, effectively to skip the check once.
1898 +diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
1899 +index 168af67..92626f3 100644
1900 +--- a/sound/pci/emu10k1/emu10k1.c
1901 ++++ b/sound/pci/emu10k1/emu10k1.c
1902 +@@ -52,6 +52,7 @@ static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
1903 + static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
1904 + static int enable_ir[SNDRV_CARDS];
1905 + static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
1906 ++static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
1907 +
1908 + module_param_array(index, int, NULL, 0444);
1909 + MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard.");
1910 +@@ -73,6 +74,8 @@ module_param_array(enable_ir, bool, NULL, 0444);
1911 + MODULE_PARM_DESC(enable_ir, "Enable IR.");
1912 + module_param_array(subsystem, uint, NULL, 0444);
1913 + MODULE_PARM_DESC(subsystem, "Force card subsystem model.");
1914 ++module_param_array(delay_pcm_irq, uint, NULL, 0444);
1915 ++MODULE_PARM_DESC(delay_pcm_irq, "Delay PCM interrupt by specified number of samples (default 0).");
1916 + /*
1917 + * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400
1918 + */
1919 +@@ -127,6 +130,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
1920 + &emu)) < 0)
1921 + goto error;
1922 + card->private_data = emu;
1923 ++ emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;
1924 + if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0)
1925 + goto error;
1926 + if ((err = snd_emu10k1_pcm_mic(emu, 1, NULL)) < 0)
1927 +diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
1928 +index 55b83ef..622bace 100644
1929 +--- a/sound/pci/emu10k1/emupcm.c
1930 ++++ b/sound/pci/emu10k1/emupcm.c
1931 +@@ -332,7 +332,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
1932 + evoice->epcm->ccca_start_addr = start_addr + ccis;
1933 + if (extra) {
1934 + start_addr += ccis;
1935 +- end_addr += ccis;
1936 ++ end_addr += ccis + emu->delay_pcm_irq;
1937 + }
1938 + if (stereo && !extra) {
1939 + snd_emu10k1_ptr_write(emu, CPF, voice, CPF_STEREO_MASK);
1940 +@@ -360,7 +360,9 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
1941 + /* Assumption that PT is already 0 so no harm overwriting */
1942 + snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]);
1943 + snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24));
1944 +- snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24));
1945 ++ snd_emu10k1_ptr_write(emu, PSST, voice,
1946 ++ (start_addr + (extra ? emu->delay_pcm_irq : 0)) |
1947 ++ (send_amount[2] << 24));
1948 + if (emu->card_capabilities->emu_model)
1949 + pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */
1950 + else
1951 +@@ -732,6 +734,23 @@ static void snd_emu10k1_playback_stop_voice(struct snd_emu10k1 *emu, struct snd_
1952 + snd_emu10k1_ptr_write(emu, IP, voice, 0);
1953 + }
1954 +
1955 ++static inline void snd_emu10k1_playback_mangle_extra(struct snd_emu10k1 *emu,
1956 ++ struct snd_emu10k1_pcm *epcm,
1957 ++ struct snd_pcm_substream *substream,
1958 ++ struct snd_pcm_runtime *runtime)
1959 ++{
1960 ++ unsigned int ptr, period_pos;
1961 ++
1962 ++ /* try to sychronize the current position for the interrupt
1963 ++ source voice */
1964 ++ period_pos = runtime->status->hw_ptr - runtime->hw_ptr_interrupt;
1965 ++ period_pos %= runtime->period_size;
1966 ++ ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->extra->number);
1967 ++ ptr &= ~0x00ffffff;
1968 ++ ptr |= epcm->ccca_start_addr + period_pos;
1969 ++ snd_emu10k1_ptr_write(emu, CCCA, epcm->extra->number, ptr);
1970 ++}
1971 ++
1972 + static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
1973 + int cmd)
1974 + {
1975 +@@ -753,6 +772,8 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
1976 + /* follow thru */
1977 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1978 + case SNDRV_PCM_TRIGGER_RESUME:
1979 ++ if (cmd == SNDRV_PCM_TRIGGER_PAUSE_RELEASE)
1980 ++ snd_emu10k1_playback_mangle_extra(emu, epcm, substream, runtime);
1981 + mix = &emu->pcm_mixer[substream->number];
1982 + snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix);
1983 + snd_emu10k1_playback_prepare_voice(emu, epcm->voices[1], 0, 0, mix);
1984 +@@ -869,8 +890,9 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream *
1985 + #endif
1986 + /*
1987 + printk(KERN_DEBUG
1988 +- "ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n",
1989 +- ptr, runtime->buffer_size, runtime->period_size);
1990 ++ "ptr = 0x%lx, buffer_size = 0x%lx, period_size = 0x%lx\n",
1991 ++ (long)ptr, (long)runtime->buffer_size,
1992 ++ (long)runtime->period_size);
1993 + */
1994 + return ptr;
1995 + }
1996 +diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
1997 +index 6a47672..7c3ce5f 100644
1998 +--- a/sound/pci/emu10k1/memory.c
1999 ++++ b/sound/pci/emu10k1/memory.c
2000 +@@ -309,8 +309,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
2001 + if (snd_BUG_ON(!hdr))
2002 + return NULL;
2003 +
2004 ++ idx = runtime->period_size >= runtime->buffer_size ?
2005 ++ (emu->delay_pcm_irq * 2) : 0;
2006 + mutex_lock(&hdr->block_mutex);
2007 +- blk = search_empty(emu, runtime->dma_bytes);
2008 ++ blk = search_empty(emu, runtime->dma_bytes + idx);
2009 + if (blk == NULL) {
2010 + mutex_unlock(&hdr->block_mutex);
2011 + return NULL;
2012 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2013 +index aa2ec23..7b4e74d 100644
2014 +--- a/sound/pci/hda/patch_realtek.c
2015 ++++ b/sound/pci/hda/patch_realtek.c
2016 +@@ -6455,6 +6455,7 @@ static int patch_alc260(struct hda_codec *codec)
2017 +
2018 + spec->stream_analog_playback = &alc260_pcm_analog_playback;
2019 + spec->stream_analog_capture = &alc260_pcm_analog_capture;
2020 ++ spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
2021 +
2022 + spec->stream_digital_playback = &alc260_pcm_digital_playback;
2023 + spec->stream_digital_capture = &alc260_pcm_digital_capture;
2024 +diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
2025 +index aac20fb..4196e3d 100644
2026 +--- a/sound/pci/intel8x0.c
2027 ++++ b/sound/pci/intel8x0.c
2028 +@@ -1776,6 +1776,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
2029 + },
2030 + {
2031 + .subvendor = 0x1014,
2032 ++ .subdevice = 0x0534,
2033 ++ .name = "ThinkPad X31",
2034 ++ .type = AC97_TUNE_INV_EAPD
2035 ++ },
2036 ++ {
2037 ++ .subvendor = 0x1014,
2038 + .subdevice = 0x1f00,
2039 + .name = "MS-9128",
2040 + .type = AC97_TUNE_ALC_JACK
2041 +diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
2042 +index b5ca02e..246b7c6 100644
2043 +--- a/sound/pci/riptide/riptide.c
2044 ++++ b/sound/pci/riptide/riptide.c
2045 +@@ -1224,15 +1224,14 @@ static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
2046 + firmware.firmware.ASIC, firmware.firmware.CODEC,
2047 + firmware.firmware.AUXDSP, firmware.firmware.PROG);
2048 +
2049 ++ if (!chip)
2050 ++ return 1;
2051 ++
2052 + for (i = 0; i < FIRMWARE_VERSIONS; i++) {
2053 + if (!memcmp(&firmware_versions[i], &firmware, sizeof(firmware)))
2054 +- break;
2055 +- }
2056 +- if (i >= FIRMWARE_VERSIONS)
2057 +- return 0; /* no match */
2058 ++ return 1; /* OK */
2059 +
2060 +- if (!chip)
2061 +- return 1; /* OK */
2062 ++ }
2063 +
2064 + snd_printdd("Writing Firmware\n");
2065 + if (!chip->fw_entry) {
2066 +diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
2067 +index 6bded8c..c1e767d 100644
2068 +--- a/sound/soc/codecs/wm8580.c
2069 ++++ b/sound/soc/codecs/wm8580.c
2070 +@@ -268,9 +268,9 @@ SOC_DOUBLE("DAC2 Invert Switch", WM8580_DAC_CONTROL4, 2, 3, 1, 0),
2071 + SOC_DOUBLE("DAC3 Invert Switch", WM8580_DAC_CONTROL4, 4, 5, 1, 0),
2072 +
2073 + SOC_SINGLE("DAC ZC Switch", WM8580_DAC_CONTROL5, 5, 1, 0),
2074 +-SOC_SINGLE("DAC1 Switch", WM8580_DAC_CONTROL5, 0, 1, 0),
2075 +-SOC_SINGLE("DAC2 Switch", WM8580_DAC_CONTROL5, 1, 1, 0),
2076 +-SOC_SINGLE("DAC3 Switch", WM8580_DAC_CONTROL5, 2, 1, 0),
2077 ++SOC_SINGLE("DAC1 Switch", WM8580_DAC_CONTROL5, 0, 1, 1),
2078 ++SOC_SINGLE("DAC2 Switch", WM8580_DAC_CONTROL5, 1, 1, 1),
2079 ++SOC_SINGLE("DAC3 Switch", WM8580_DAC_CONTROL5, 2, 1, 1),
2080 +
2081 + SOC_DOUBLE("ADC Mute Switch", WM8580_ADC_CONTROL1, 0, 1, 1, 0),
2082 + SOC_SINGLE("ADC High-Pass Filter Switch", WM8580_ADC_CONTROL1, 4, 1, 0),
2083 +diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
2084 +index 8286c62..38a53a6 100644
2085 +--- a/sound/soc/codecs/wm8776.c
2086 ++++ b/sound/soc/codecs/wm8776.c
2087 +@@ -177,13 +177,6 @@ static int wm8776_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
2088 + case SND_SOC_DAIFMT_LEFT_J:
2089 + iface |= 0x0001;
2090 + break;
2091 +- /* FIXME: CHECK A/B */
2092 +- case SND_SOC_DAIFMT_DSP_A:
2093 +- iface |= 0x0003;
2094 +- break;
2095 +- case SND_SOC_DAIFMT_DSP_B:
2096 +- iface |= 0x0007;
2097 +- break;
2098 + default:
2099 + return -EINVAL;
2100 + }