Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1681 - genpatches-2.6/trunk/2.6.32
Date: Tue, 23 Feb 2010 16:36:57
Message-Id: E1Njxkd-0003P0-9a@stork.gentoo.org
1 Author: mpagano
2 Date: 2010-02-23 16:36:46 +0000 (Tue, 23 Feb 2010)
3 New Revision: 1681
4
5 Added:
6 genpatches-2.6/trunk/2.6.32/1008_linux-2.6.32.9.patch
7 Removed:
8 genpatches-2.6/trunk/2.6.32/2410_rtl8187se-compilation-fix.patch
9 Modified:
10 genpatches-2.6/trunk/2.6.32/0000_README
11 Log:
12 Adding linux patch 2.6.32.9 and removal of redundant patch
13
14 Modified: genpatches-2.6/trunk/2.6.32/0000_README
15 ===================================================================
16 --- genpatches-2.6/trunk/2.6.32/0000_README 2010-02-19 15:35:20 UTC (rev 1680)
17 +++ genpatches-2.6/trunk/2.6.32/0000_README 2010-02-23 16:36:46 UTC (rev 1681)
18 @@ -71,14 +71,14 @@
19 From: http://www.kernel.org
20 Desc: Linux 2.6.32.8
21
22 +Patch: 1008_linux-2.6.32.9.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 2.6.32.9
25 +
26 Patch: 2400_5906-transmit-hang-fix.patch
27 From: http://bugs.gentoo.org/show_bug.cgi?id=304625
28 Desc: tg3: Fix 5906 transmit hangs
29
30 -Patch: 2410_rtl8187se-compilation-fix.patch
31 -From: http://bugs.gentoo.org/show_bug.cgi?id=296920
32 -Desc: Fix rtl8187se compilation errors with mac80211
33 -
34 Patch: 2500_libata-fix-truncated-LBA48-ret-vals.patch
35 From: http://bugs.gentoo.org/show_bug.cgi?id=303313
36 Desc: Fix bug which truncated LBA48 return values
37
38 Added: genpatches-2.6/trunk/2.6.32/1008_linux-2.6.32.9.patch
39 ===================================================================
40 --- genpatches-2.6/trunk/2.6.32/1008_linux-2.6.32.9.patch (rev 0)
41 +++ genpatches-2.6/trunk/2.6.32/1008_linux-2.6.32.9.patch 2010-02-23 16:36:46 UTC (rev 1681)
42 @@ -0,0 +1,3886 @@
43 +diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
44 +index c0d359c..ba64e7f 100644
45 +--- a/arch/sh/include/asm/pgtable_32.h
46 ++++ b/arch/sh/include/asm/pgtable_32.h
47 +@@ -344,7 +344,8 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
48 + #define pte_special(pte) ((pte).pte_low & _PAGE_SPECIAL)
49 +
50 + #ifdef CONFIG_X2TLB
51 +-#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
52 ++#define pte_write(pte) \
53 ++ ((pte).pte_high & (_PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE))
54 + #else
55 + #define pte_write(pte) ((pte).pte_low & _PAGE_RW)
56 + #endif
57 +@@ -358,7 +359,7 @@ static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
58 + * individually toggled (and user permissions are entirely decoupled from
59 + * kernel permissions), we attempt to couple them a bit more sanely here.
60 + */
61 +-PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
62 ++PTE_BIT_FUNC(high, wrprotect, &= ~(_PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE));
63 + PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
64 + PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
65 + #else
66 +diff --git a/arch/x86/include/asm/amd_iommu.h b/arch/x86/include/asm/amd_iommu.h
67 +index 4b18089..18aa3f8 100644
68 +--- a/arch/x86/include/asm/amd_iommu.h
69 ++++ b/arch/x86/include/asm/amd_iommu.h
70 +@@ -32,6 +32,7 @@ extern void amd_iommu_flush_all_domains(void);
71 + extern void amd_iommu_flush_all_devices(void);
72 + extern void amd_iommu_shutdown(void);
73 + extern void amd_iommu_apply_erratum_63(u16 devid);
74 ++extern void amd_iommu_init_api(void);
75 + #else
76 + static inline int amd_iommu_init(void) { return -ENODEV; }
77 + static inline void amd_iommu_detect(void) { }
78 +diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
79 +index e3f85fe..23fc9fe 100644
80 +--- a/arch/x86/kernel/amd_iommu.c
81 ++++ b/arch/x86/kernel/amd_iommu.c
82 +@@ -1230,9 +1230,10 @@ static void __detach_device(struct protection_domain *domain, u16 devid)
83 +
84 + /*
85 + * If we run in passthrough mode the device must be assigned to the
86 +- * passthrough domain if it is detached from any other domain
87 ++ * passthrough domain if it is detached from any other domain.
88 ++ * Make sure we can deassign from the pt_domain itself.
89 + */
90 +- if (iommu_pass_through) {
91 ++ if (iommu_pass_through && domain != pt_domain) {
92 + struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
93 + __attach_device(iommu, pt_domain, devid);
94 + }
95 +@@ -2083,6 +2084,11 @@ static struct dma_map_ops amd_iommu_dma_ops = {
96 + .dma_supported = amd_iommu_dma_supported,
97 + };
98 +
99 ++void __init amd_iommu_init_api(void)
100 ++{
101 ++ register_iommu(&amd_iommu_ops);
102 ++}
103 ++
104 + /*
105 + * The function which clues the AMD IOMMU driver into dma_ops.
106 + */
107 +@@ -2124,8 +2130,6 @@ int __init amd_iommu_init_dma_ops(void)
108 + /* Make the driver finally visible to the drivers */
109 + dma_ops = &amd_iommu_dma_ops;
110 +
111 +- register_iommu(&amd_iommu_ops);
112 +-
113 + bus_register_notifier(&pci_bus_type, &device_nb);
114 +
115 + amd_iommu_stats_init();
116 +diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
117 +index c8243f0..362ab88 100644
118 +--- a/arch/x86/kernel/amd_iommu_init.c
119 ++++ b/arch/x86/kernel/amd_iommu_init.c
120 +@@ -1288,9 +1288,12 @@ int __init amd_iommu_init(void)
121 + ret = amd_iommu_init_passthrough();
122 + else
123 + ret = amd_iommu_init_dma_ops();
124 ++
125 + if (ret)
126 + goto free;
127 +
128 ++ amd_iommu_init_api();
129 ++
130 + enable_iommus();
131 +
132 + if (iommu_pass_through)
133 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
134 +index dc69f28..c107e83 100644
135 +--- a/arch/x86/kernel/apic/io_apic.c
136 ++++ b/arch/x86/kernel/apic/io_apic.c
137 +@@ -3157,6 +3157,7 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)
138 + continue;
139 +
140 + desc_new = move_irq_desc(desc_new, node);
141 ++ cfg_new = desc_new->chip_data;
142 +
143 + if (__assign_irq_vector(new, cfg_new, apic->target_cpus()) == 0)
144 + irq = new;
145 +diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
146 +index 3f12dab..ab1cd30 100644
147 +--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
148 ++++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
149 +@@ -1351,6 +1351,7 @@ static int __devexit powernowk8_cpu_exit(struct cpufreq_policy *pol)
150 +
151 + kfree(data->powernow_table);
152 + kfree(data);
153 ++ per_cpu(powernow_data, pol->cpu) = NULL;
154 +
155 + return 0;
156 + }
157 +@@ -1370,7 +1371,7 @@ static unsigned int powernowk8_get(unsigned int cpu)
158 + int err;
159 +
160 + if (!data)
161 +- return -EINVAL;
162 ++ return 0;
163 +
164 + smp_call_function_single(cpu, query_values_on_cpu, &err, true);
165 + if (err)
166 +diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
167 +index 144e7f6..88ad162 100644
168 +--- a/arch/x86/kvm/i8254.c
169 ++++ b/arch/x86/kvm/i8254.c
170 +@@ -465,6 +465,9 @@ static int pit_ioport_read(struct kvm_io_device *this,
171 + return -EOPNOTSUPP;
172 +
173 + addr &= KVM_PIT_CHANNEL_MASK;
174 ++ if (addr == 3)
175 ++ return 0;
176 ++
177 + s = &pit_state->channels[addr];
178 +
179 + mutex_lock(&pit_state->lock);
180 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
181 +index 145741c..e78d990 100644
182 +--- a/arch/x86/kvm/x86.c
183 ++++ b/arch/x86/kvm/x86.c
184 +@@ -583,7 +583,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
185 + {
186 + static int version;
187 + struct pvclock_wall_clock wc;
188 +- struct timespec now, sys, boot;
189 ++ struct timespec boot;
190 +
191 + if (!wall_clock)
192 + return;
193 +@@ -598,9 +598,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
194 + * wall clock specified here. guest system time equals host
195 + * system time for us, thus we must fill in host boot time here.
196 + */
197 +- now = current_kernel_time();
198 +- ktime_get_ts(&sys);
199 +- boot = ns_to_timespec(timespec_to_ns(&now) - timespec_to_ns(&sys));
200 ++ getboottime(&boot);
201 +
202 + wc.sec = boot.tv_sec;
203 + wc.nsec = boot.tv_nsec;
204 +@@ -675,6 +673,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
205 + local_irq_save(flags);
206 + kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
207 + ktime_get_ts(&ts);
208 ++ monotonic_to_bootbased(&ts);
209 + local_irq_restore(flags);
210 +
211 + /* With all the info we got, fill in the values */
212 +diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
213 +index a8f3ca6..d9f78f6 100644
214 +--- a/drivers/acpi/processor_idle.c
215 ++++ b/drivers/acpi/processor_idle.c
216 +@@ -110,6 +110,14 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = {
217 + DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
218 + DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")},
219 + (void *)2},
220 ++ { set_max_cstate, "Pavilion zv5000", {
221 ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
222 ++ DMI_MATCH(DMI_PRODUCT_NAME,"Pavilion zv5000 (DS502A#ABA)")},
223 ++ (void *)1},
224 ++ { set_max_cstate, "Asus L8400B", {
225 ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
226 ++ DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")},
227 ++ (void *)1},
228 + {},
229 + };
230 +
231 +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
232 +index 14a7481..0b09703 100644
233 +--- a/drivers/acpi/scan.c
234 ++++ b/drivers/acpi/scan.c
235 +@@ -1357,6 +1357,9 @@ int acpi_bus_start(struct acpi_device *device)
236 + {
237 + struct acpi_bus_ops ops;
238 +
239 ++ if (!device)
240 ++ return -EINVAL;
241 ++
242 + memset(&ops, 0, sizeof(ops));
243 + ops.acpi_op_start = 1;
244 +
245 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
246 +index 9519c77..9b37502 100644
247 +--- a/drivers/ata/ahci.c
248 ++++ b/drivers/ata/ahci.c
249 +@@ -2868,6 +2868,21 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
250 + },
251 + .driver_data = "F.23", /* cutoff BIOS version */
252 + },
253 ++ /*
254 ++ * Acer eMachines G725 has the same problem. BIOS
255 ++ * V1.03 is known to be broken. V3.04 is known to
256 ++ * work. Inbetween, there are V1.06, V2.06 and V3.03
257 ++ * that we don't have much idea about. For now,
258 ++ * blacklist anything older than V3.04.
259 ++ */
260 ++ {
261 ++ .ident = "G725",
262 ++ .matches = {
263 ++ DMI_MATCH(DMI_SYS_VENDOR, "eMachines"),
264 ++ DMI_MATCH(DMI_PRODUCT_NAME, "eMachines G725"),
265 ++ },
266 ++ .driver_data = "V3.04", /* cutoff BIOS version */
267 ++ },
268 + { } /* terminate list */
269 + };
270 + const struct dmi_system_id *dmi = dmi_first_match(sysids);
271 +diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
272 +index bbbb1fa..2ae15c3 100644
273 +--- a/drivers/ata/libata-sff.c
274 ++++ b/drivers/ata/libata-sff.c
275 +@@ -893,6 +893,9 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
276 + do_write);
277 + }
278 +
279 ++ if (!do_write)
280 ++ flush_dcache_page(page);
281 ++
282 + qc->curbytes += qc->sect_size;
283 + qc->cursg_ofs += qc->sect_size;
284 +
285 +diff --git a/drivers/base/class.c b/drivers/base/class.c
286 +index 161746d..6e2c3b0 100644
287 +--- a/drivers/base/class.c
288 ++++ b/drivers/base/class.c
289 +@@ -59,6 +59,8 @@ static void class_release(struct kobject *kobj)
290 + else
291 + pr_debug("class '%s' does not have a release() function, "
292 + "be careful\n", class->name);
293 ++
294 ++ kfree(cp);
295 + }
296 +
297 + static struct sysfs_ops class_sysfs_ops = {
298 +diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
299 +index 92b1263..ca9c548 100644
300 +--- a/drivers/block/cciss.c
301 ++++ b/drivers/block/cciss.c
302 +@@ -339,6 +339,9 @@ static int cciss_seq_show(struct seq_file *seq, void *v)
303 + if (*pos > h->highest_lun)
304 + return 0;
305 +
306 ++ if (drv == NULL) /* it's possible for h->drv[] to have holes. */
307 ++ return 0;
308 ++
309 + if (drv->heads == 0)
310 + return 0;
311 +
312 +diff --git a/drivers/char/mem.c b/drivers/char/mem.c
313 +index a074fce..aef3fb4 100644
314 +--- a/drivers/char/mem.c
315 ++++ b/drivers/char/mem.c
316 +@@ -35,6 +35,19 @@
317 + # include <linux/efi.h>
318 + #endif
319 +
320 ++static inline unsigned long size_inside_page(unsigned long start,
321 ++ unsigned long size)
322 ++{
323 ++ unsigned long sz;
324 ++
325 ++ if (-start & (PAGE_SIZE - 1))
326 ++ sz = -start & (PAGE_SIZE - 1);
327 ++ else
328 ++ sz = PAGE_SIZE;
329 ++
330 ++ return min_t(unsigned long, sz, size);
331 ++}
332 ++
333 + /*
334 + * Architectures vary in how they handle caching for addresses
335 + * outside of main memory.
336 +@@ -408,6 +421,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
337 + unsigned long p = *ppos;
338 + ssize_t low_count, read, sz;
339 + char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
340 ++ int err = 0;
341 +
342 + read = 0;
343 + if (p < (unsigned long) high_memory) {
344 +@@ -430,15 +444,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
345 + }
346 + #endif
347 + while (low_count > 0) {
348 +- /*
349 +- * Handle first page in case it's not aligned
350 +- */
351 +- if (-p & (PAGE_SIZE - 1))
352 +- sz = -p & (PAGE_SIZE - 1);
353 +- else
354 +- sz = PAGE_SIZE;
355 +-
356 +- sz = min_t(unsigned long, sz, low_count);
357 ++ sz = size_inside_page(p, low_count);
358 +
359 + /*
360 + * On ia64 if a page has been mapped somewhere as
361 +@@ -462,16 +468,18 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
362 + if (!kbuf)
363 + return -ENOMEM;
364 + while (count > 0) {
365 +- int len = count;
366 ++ int len = size_inside_page(p, count);
367 +
368 +- if (len > PAGE_SIZE)
369 +- len = PAGE_SIZE;
370 ++ if (!is_vmalloc_or_module_addr((void *)p)) {
371 ++ err = -ENXIO;
372 ++ break;
373 ++ }
374 + len = vread(kbuf, (char *)p, len);
375 + if (!len)
376 + break;
377 + if (copy_to_user(buf, kbuf, len)) {
378 +- free_page((unsigned long)kbuf);
379 +- return -EFAULT;
380 ++ err = -EFAULT;
381 ++ break;
382 + }
383 + count -= len;
384 + buf += len;
385 +@@ -480,8 +488,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
386 + }
387 + free_page((unsigned long)kbuf);
388 + }
389 +- *ppos = p;
390 +- return read;
391 ++ *ppos = p;
392 ++ return read ? read : err;
393 + }
394 +
395 +
396 +@@ -510,15 +518,8 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf,
397 +
398 + while (count > 0) {
399 + char *ptr;
400 +- /*
401 +- * Handle first page in case it's not aligned
402 +- */
403 +- if (-realp & (PAGE_SIZE - 1))
404 +- sz = -realp & (PAGE_SIZE - 1);
405 +- else
406 +- sz = PAGE_SIZE;
407 +
408 +- sz = min_t(unsigned long, sz, count);
409 ++ sz = size_inside_page(realp, count);
410 +
411 + /*
412 + * On ia64 if a page has been mapped somewhere as
413 +@@ -557,6 +558,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
414 + ssize_t virtr = 0;
415 + ssize_t written;
416 + char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
417 ++ int err = 0;
418 +
419 + if (p < (unsigned long) high_memory) {
420 +
421 +@@ -578,20 +580,20 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
422 + if (!kbuf)
423 + return wrote ? wrote : -ENOMEM;
424 + while (count > 0) {
425 +- int len = count;
426 ++ int len = size_inside_page(p, count);
427 +
428 +- if (len > PAGE_SIZE)
429 +- len = PAGE_SIZE;
430 ++ if (!is_vmalloc_or_module_addr((void *)p)) {
431 ++ err = -ENXIO;
432 ++ break;
433 ++ }
434 + if (len) {
435 + written = copy_from_user(kbuf, buf, len);
436 + if (written) {
437 +- if (wrote + virtr)
438 +- break;
439 +- free_page((unsigned long)kbuf);
440 +- return -EFAULT;
441 ++ err = -EFAULT;
442 ++ break;
443 + }
444 + }
445 +- len = vwrite(kbuf, (char *)p, len);
446 ++ vwrite(kbuf, (char *)p, len);
447 + count -= len;
448 + buf += len;
449 + virtr += len;
450 +@@ -600,8 +602,8 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
451 + free_page((unsigned long)kbuf);
452 + }
453 +
454 +- *ppos = p;
455 +- return virtr + wrote;
456 ++ *ppos = p;
457 ++ return virtr + wrote ? : err;
458 + }
459 + #endif
460 +
461 +diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
462 +index ecba494..f584407 100644
463 +--- a/drivers/char/tpm/tpm_infineon.c
464 ++++ b/drivers/char/tpm/tpm_infineon.c
465 +@@ -39,12 +39,12 @@
466 + struct tpm_inf_dev {
467 + int iotype;
468 +
469 +- void __iomem *mem_base; /* MMIO ioremap'd addr */
470 +- unsigned long map_base; /* phys MMIO base */
471 +- unsigned long map_size; /* MMIO region size */
472 +- unsigned int index_off; /* index register offset */
473 ++ void __iomem *mem_base; /* MMIO ioremap'd addr */
474 ++ unsigned long map_base; /* phys MMIO base */
475 ++ unsigned long map_size; /* MMIO region size */
476 ++ unsigned int index_off; /* index register offset */
477 +
478 +- unsigned int data_regs; /* Data registers */
479 ++ unsigned int data_regs; /* Data registers */
480 + unsigned int data_size;
481 +
482 + unsigned int config_port; /* IO Port config index reg */
483 +@@ -406,14 +406,14 @@ static const struct tpm_vendor_specific tpm_inf = {
484 + .miscdev = {.fops = &inf_ops,},
485 + };
486 +
487 +-static const struct pnp_device_id tpm_pnp_tbl[] = {
488 ++static const struct pnp_device_id tpm_inf_pnp_tbl[] = {
489 + /* Infineon TPMs */
490 + {"IFX0101", 0},
491 + {"IFX0102", 0},
492 + {"", 0}
493 + };
494 +
495 +-MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl);
496 ++MODULE_DEVICE_TABLE(pnp, tpm_inf_pnp_tbl);
497 +
498 + static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
499 + const struct pnp_device_id *dev_id)
500 +@@ -430,7 +430,7 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
501 + if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
502 + !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) {
503 +
504 +- tpm_dev.iotype = TPM_INF_IO_PORT;
505 ++ tpm_dev.iotype = TPM_INF_IO_PORT;
506 +
507 + tpm_dev.config_port = pnp_port_start(dev, 0);
508 + tpm_dev.config_size = pnp_port_len(dev, 0);
509 +@@ -459,9 +459,9 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
510 + goto err_last;
511 + }
512 + } else if (pnp_mem_valid(dev, 0) &&
513 +- !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
514 ++ !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
515 +
516 +- tpm_dev.iotype = TPM_INF_IO_MEM;
517 ++ tpm_dev.iotype = TPM_INF_IO_MEM;
518 +
519 + tpm_dev.map_base = pnp_mem_start(dev, 0);
520 + tpm_dev.map_size = pnp_mem_len(dev, 0);
521 +@@ -563,11 +563,11 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev,
522 + "product id 0x%02x%02x"
523 + "%s\n",
524 + tpm_dev.iotype == TPM_INF_IO_PORT ?
525 +- tpm_dev.config_port :
526 +- tpm_dev.map_base + tpm_dev.index_off,
527 ++ tpm_dev.config_port :
528 ++ tpm_dev.map_base + tpm_dev.index_off,
529 + tpm_dev.iotype == TPM_INF_IO_PORT ?
530 +- tpm_dev.data_regs :
531 +- tpm_dev.map_base + tpm_dev.data_regs,
532 ++ tpm_dev.data_regs :
533 ++ tpm_dev.map_base + tpm_dev.data_regs,
534 + version[0], version[1],
535 + vendorid[0], vendorid[1],
536 + productid[0], productid[1], chipname);
537 +@@ -607,20 +607,55 @@ static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev)
538 + iounmap(tpm_dev.mem_base);
539 + release_mem_region(tpm_dev.map_base, tpm_dev.map_size);
540 + }
541 ++ tpm_dev_vendor_release(chip);
542 + tpm_remove_hardware(chip->dev);
543 + }
544 + }
545 +
546 ++static int tpm_inf_pnp_suspend(struct pnp_dev *dev, pm_message_t pm_state)
547 ++{
548 ++ struct tpm_chip *chip = pnp_get_drvdata(dev);
549 ++ int rc;
550 ++ if (chip) {
551 ++ u8 savestate[] = {
552 ++ 0, 193, /* TPM_TAG_RQU_COMMAND */
553 ++ 0, 0, 0, 10, /* blob length (in bytes) */
554 ++ 0, 0, 0, 152 /* TPM_ORD_SaveState */
555 ++ };
556 ++ dev_info(&dev->dev, "saving TPM state\n");
557 ++ rc = tpm_inf_send(chip, savestate, sizeof(savestate));
558 ++ if (rc < 0) {
559 ++ dev_err(&dev->dev, "error while saving TPM state\n");
560 ++ return rc;
561 ++ }
562 ++ }
563 ++ return 0;
564 ++}
565 ++
566 ++static int tpm_inf_pnp_resume(struct pnp_dev *dev)
567 ++{
568 ++ /* Re-configure TPM after suspending */
569 ++ tpm_config_out(ENABLE_REGISTER_PAIR, TPM_INF_ADDR);
570 ++ tpm_config_out(IOLIMH, TPM_INF_ADDR);
571 ++ tpm_config_out((tpm_dev.data_regs >> 8) & 0xff, TPM_INF_DATA);
572 ++ tpm_config_out(IOLIML, TPM_INF_ADDR);
573 ++ tpm_config_out((tpm_dev.data_regs & 0xff), TPM_INF_DATA);
574 ++ /* activate register */
575 ++ tpm_config_out(TPM_DAR, TPM_INF_ADDR);
576 ++ tpm_config_out(0x01, TPM_INF_DATA);
577 ++ tpm_config_out(DISABLE_REGISTER_PAIR, TPM_INF_ADDR);
578 ++ /* disable RESET, LP and IRQC */
579 ++ tpm_data_out(RESET_LP_IRQC_DISABLE, CMD);
580 ++ return tpm_pm_resume(&dev->dev);
581 ++}
582 ++
583 + static struct pnp_driver tpm_inf_pnp_driver = {
584 + .name = "tpm_inf_pnp",
585 +- .driver = {
586 +- .owner = THIS_MODULE,
587 +- .suspend = tpm_pm_suspend,
588 +- .resume = tpm_pm_resume,
589 +- },
590 +- .id_table = tpm_pnp_tbl,
591 ++ .id_table = tpm_inf_pnp_tbl,
592 + .probe = tpm_inf_pnp_probe,
593 +- .remove = __devexit_p(tpm_inf_pnp_remove),
594 ++ .suspend = tpm_inf_pnp_suspend,
595 ++ .resume = tpm_inf_pnp_resume,
596 ++ .remove = __devexit_p(tpm_inf_pnp_remove)
597 + };
598 +
599 + static int __init init_inf(void)
600 +@@ -638,5 +673,5 @@ module_exit(cleanup_inf);
601 +
602 + MODULE_AUTHOR("Marcel Selhorst <m.selhorst@××××××.com>");
603 + MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
604 +-MODULE_VERSION("1.9");
605 ++MODULE_VERSION("1.9.2");
606 + MODULE_LICENSE("GPL");
607 +diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
608 +index e919bd9..05cab2c 100644
609 +--- a/drivers/char/tty_io.c
610 ++++ b/drivers/char/tty_io.c
611 +@@ -1930,8 +1930,10 @@ static int tty_fasync(int fd, struct file *filp, int on)
612 + pid = task_pid(current);
613 + type = PIDTYPE_PID;
614 + }
615 +- retval = __f_setown(filp, pid, type, 0);
616 ++ get_pid(pid);
617 + spin_unlock_irqrestore(&tty->ctrl_lock, flags);
618 ++ retval = __f_setown(filp, pid, type, 0);
619 ++ put_pid(pid);
620 + if (retval)
621 + goto out;
622 + } else {
623 +diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
624 +index 0af8057..d3a27e0 100644
625 +--- a/drivers/crypto/padlock-sha.c
626 ++++ b/drivers/crypto/padlock-sha.c
627 +@@ -57,6 +57,23 @@ static int padlock_sha_update(struct shash_desc *desc,
628 + return crypto_shash_update(&dctx->fallback, data, length);
629 + }
630 +
631 ++static int padlock_sha_export(struct shash_desc *desc, void *out)
632 ++{
633 ++ struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
634 ++
635 ++ return crypto_shash_export(&dctx->fallback, out);
636 ++}
637 ++
638 ++static int padlock_sha_import(struct shash_desc *desc, const void *in)
639 ++{
640 ++ struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
641 ++ struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm);
642 ++
643 ++ dctx->fallback.tfm = ctx->fallback;
644 ++ dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
645 ++ return crypto_shash_import(&dctx->fallback, in);
646 ++}
647 ++
648 + static inline void padlock_output_block(uint32_t *src,
649 + uint32_t *dst, size_t count)
650 + {
651 +@@ -235,7 +252,10 @@ static struct shash_alg sha1_alg = {
652 + .update = padlock_sha_update,
653 + .finup = padlock_sha1_finup,
654 + .final = padlock_sha1_final,
655 ++ .export = padlock_sha_export,
656 ++ .import = padlock_sha_import,
657 + .descsize = sizeof(struct padlock_sha_desc),
658 ++ .statesize = sizeof(struct sha1_state),
659 + .base = {
660 + .cra_name = "sha1",
661 + .cra_driver_name = "sha1-padlock",
662 +@@ -256,7 +276,10 @@ static struct shash_alg sha256_alg = {
663 + .update = padlock_sha_update,
664 + .finup = padlock_sha256_finup,
665 + .final = padlock_sha256_final,
666 ++ .export = padlock_sha_export,
667 ++ .import = padlock_sha_import,
668 + .descsize = sizeof(struct padlock_sha_desc),
669 ++ .statesize = sizeof(struct sha256_state),
670 + .base = {
671 + .cra_name = "sha256",
672 + .cra_driver_name = "sha256-padlock",
673 +diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
674 +index 5f7a500..5cc37af 100644
675 +--- a/drivers/dma/ioat/dma_v2.c
676 ++++ b/drivers/dma/ioat/dma_v2.c
677 +@@ -249,7 +249,7 @@ int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo)
678 + if (is_ioat_active(status) || is_ioat_idle(status))
679 + ioat_suspend(chan);
680 + while (is_ioat_active(status) || is_ioat_idle(status)) {
681 +- if (end && time_after(jiffies, end)) {
682 ++ if (tmo && time_after(jiffies, end)) {
683 + err = -ETIMEDOUT;
684 + break;
685 + }
686 +diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
687 +index a0bcfba..01bc8e2 100644
688 +--- a/drivers/edac/amd64_edac.c
689 ++++ b/drivers/edac/amd64_edac.c
690 +@@ -2801,10 +2801,11 @@ static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt)
691 + * the memory system completely. A command line option allows to force-enable
692 + * hardware ECC later in amd64_enable_ecc_error_reporting().
693 + */
694 +-static const char *ecc_warning =
695 +- "WARNING: ECC is disabled by BIOS. Module will NOT be loaded.\n"
696 +- " Either Enable ECC in the BIOS, or set 'ecc_enable_override'.\n"
697 +- " Also, use of the override can cause unknown side effects.\n";
698 ++static const char *ecc_msg =
699 ++ "ECC disabled in the BIOS or no ECC capability, module will not load.\n"
700 ++ " Either enable ECC checking or force module loading by setting "
701 ++ "'ecc_enable_override'.\n"
702 ++ " (Note that use of the override may cause unknown side effects.)\n";
703 +
704 + static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
705 + {
706 +@@ -2819,7 +2820,7 @@ static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
707 +
708 + ecc_enabled = !!(value & K8_NBCFG_ECC_ENABLE);
709 + if (!ecc_enabled)
710 +- amd64_printk(KERN_WARNING, "This node reports that Memory ECC "
711 ++ amd64_printk(KERN_NOTICE, "This node reports that Memory ECC "
712 + "is currently disabled, set F3x%x[22] (%s).\n",
713 + K8_NBCFG, pci_name(pvt->misc_f3_ctl));
714 + else
715 +@@ -2827,13 +2828,13 @@ static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
716 +
717 + nb_mce_en = amd64_nb_mce_bank_enabled_on_node(pvt->mc_node_id);
718 + if (!nb_mce_en)
719 +- amd64_printk(KERN_WARNING, "NB MCE bank disabled, set MSR "
720 ++ amd64_printk(KERN_NOTICE, "NB MCE bank disabled, set MSR "
721 + "0x%08x[4] on node %d to enable.\n",
722 + MSR_IA32_MCG_CTL, pvt->mc_node_id);
723 +
724 + if (!ecc_enabled || !nb_mce_en) {
725 + if (!ecc_enable_override) {
726 +- amd64_printk(KERN_WARNING, "%s", ecc_warning);
727 ++ amd64_printk(KERN_NOTICE, "%s", ecc_msg);
728 + return -ENODEV;
729 + }
730 + ecc_enable_override = 0;
731 +diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
732 +index af655e8..7e859d6 100644
733 +--- a/drivers/gpu/drm/i915/i915_debugfs.c
734 ++++ b/drivers/gpu/drm/i915/i915_debugfs.c
735 +@@ -384,37 +384,7 @@ out:
736 + return 0;
737 + }
738 +
739 +-static int i915_registers_info(struct seq_file *m, void *data) {
740 +- struct drm_info_node *node = (struct drm_info_node *) m->private;
741 +- struct drm_device *dev = node->minor->dev;
742 +- drm_i915_private_t *dev_priv = dev->dev_private;
743 +- uint32_t reg;
744 +-
745 +-#define DUMP_RANGE(start, end) \
746 +- for (reg=start; reg < end; reg += 4) \
747 +- seq_printf(m, "%08x\t%08x\n", reg, I915_READ(reg));
748 +-
749 +- DUMP_RANGE(0x00000, 0x00fff); /* VGA registers */
750 +- DUMP_RANGE(0x02000, 0x02fff); /* instruction, memory, interrupt control registers */
751 +- DUMP_RANGE(0x03000, 0x031ff); /* FENCE and PPGTT control registers */
752 +- DUMP_RANGE(0x03200, 0x03fff); /* frame buffer compression registers */
753 +- DUMP_RANGE(0x05000, 0x05fff); /* I/O control registers */
754 +- DUMP_RANGE(0x06000, 0x06fff); /* clock control registers */
755 +- DUMP_RANGE(0x07000, 0x07fff); /* 3D internal debug registers */
756 +- DUMP_RANGE(0x07400, 0x088ff); /* GPE debug registers */
757 +- DUMP_RANGE(0x0a000, 0x0afff); /* display palette registers */
758 +- DUMP_RANGE(0x10000, 0x13fff); /* MMIO MCHBAR */
759 +- DUMP_RANGE(0x30000, 0x3ffff); /* overlay registers */
760 +- DUMP_RANGE(0x60000, 0x6ffff); /* display engine pipeline registers */
761 +- DUMP_RANGE(0x70000, 0x72fff); /* display and cursor registers */
762 +- DUMP_RANGE(0x73000, 0x73fff); /* performance counters */
763 +-
764 +- return 0;
765 +-}
766 +-
767 +-
768 + static struct drm_info_list i915_debugfs_list[] = {
769 +- {"i915_regs", i915_registers_info, 0},
770 + {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
771 + {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
772 + {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
773 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
774 +index 7277246..f5d49a7 100644
775 +--- a/drivers/gpu/drm/i915/i915_drv.h
776 ++++ b/drivers/gpu/drm/i915/i915_drv.h
777 +@@ -467,6 +467,15 @@ typedef struct drm_i915_private {
778 + struct list_head flushing_list;
779 +
780 + /**
781 ++ * List of objects currently pending a GPU write flush.
782 ++ *
783 ++ * All elements on this list will belong to either the
784 ++ * active_list or flushing_list, last_rendering_seqno can
785 ++ * be used to differentiate between the two elements.
786 ++ */
787 ++ struct list_head gpu_write_list;
788 ++
789 ++ /**
790 + * LRU list of objects which are not in the ringbuffer and
791 + * are ready to unbind, but are still in the GTT.
792 + *
793 +@@ -558,6 +567,8 @@ struct drm_i915_gem_object {
794 +
795 + /** This object's place on the active/flushing/inactive lists */
796 + struct list_head list;
797 ++ /** This object's place on GPU write list */
798 ++ struct list_head gpu_write_list;
799 +
800 + /** This object's place on the fenced object LRU */
801 + struct list_head fence_list;
802 +@@ -814,9 +825,11 @@ void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
803 + int i915_gem_do_init(struct drm_device *dev, unsigned long start,
804 + unsigned long end);
805 + int i915_gem_idle(struct drm_device *dev);
806 ++int i915_lp_ring_sync(struct drm_device *dev);
807 + int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
808 + int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
809 + int write);
810 ++int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj);
811 + int i915_gem_attach_phys_object(struct drm_device *dev,
812 + struct drm_gem_object *obj, int id);
813 + void i915_gem_detach_phys_object(struct drm_device *dev,
814 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
815 +index 8ad244a..04da731 100644
816 +--- a/drivers/gpu/drm/i915/i915_gem.c
817 ++++ b/drivers/gpu/drm/i915/i915_gem.c
818 +@@ -1552,6 +1552,8 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
819 + else
820 + list_move_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
821 +
822 ++ BUG_ON(!list_empty(&obj_priv->gpu_write_list));
823 ++
824 + obj_priv->last_rendering_seqno = 0;
825 + if (obj_priv->active) {
826 + obj_priv->active = 0;
827 +@@ -1622,7 +1624,8 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
828 + struct drm_i915_gem_object *obj_priv, *next;
829 +
830 + list_for_each_entry_safe(obj_priv, next,
831 +- &dev_priv->mm.flushing_list, list) {
832 ++ &dev_priv->mm.gpu_write_list,
833 ++ gpu_write_list) {
834 + struct drm_gem_object *obj = obj_priv->obj;
835 +
836 + if ((obj->write_domain & flush_domains) ==
837 +@@ -1630,6 +1633,7 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
838 + uint32_t old_write_domain = obj->write_domain;
839 +
840 + obj->write_domain = 0;
841 ++ list_del_init(&obj_priv->gpu_write_list);
842 + i915_gem_object_move_to_active(obj, seqno);
843 +
844 + trace_i915_gem_object_change_domain(obj,
845 +@@ -1805,12 +1809,8 @@ i915_gem_retire_work_handler(struct work_struct *work)
846 + mutex_unlock(&dev->struct_mutex);
847 + }
848 +
849 +-/**
850 +- * Waits for a sequence number to be signaled, and cleans up the
851 +- * request and object lists appropriately for that event.
852 +- */
853 + static int
854 +-i915_wait_request(struct drm_device *dev, uint32_t seqno)
855 ++i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible)
856 + {
857 + drm_i915_private_t *dev_priv = dev->dev_private;
858 + u32 ier;
859 +@@ -1837,10 +1837,15 @@ i915_wait_request(struct drm_device *dev, uint32_t seqno)
860 +
861 + dev_priv->mm.waiting_gem_seqno = seqno;
862 + i915_user_irq_get(dev);
863 +- ret = wait_event_interruptible(dev_priv->irq_queue,
864 +- i915_seqno_passed(i915_get_gem_seqno(dev),
865 +- seqno) ||
866 +- atomic_read(&dev_priv->mm.wedged));
867 ++ if (interruptible)
868 ++ ret = wait_event_interruptible(dev_priv->irq_queue,
869 ++ i915_seqno_passed(i915_get_gem_seqno(dev), seqno) ||
870 ++ atomic_read(&dev_priv->mm.wedged));
871 ++ else
872 ++ wait_event(dev_priv->irq_queue,
873 ++ i915_seqno_passed(i915_get_gem_seqno(dev), seqno) ||
874 ++ atomic_read(&dev_priv->mm.wedged));
875 ++
876 + i915_user_irq_put(dev);
877 + dev_priv->mm.waiting_gem_seqno = 0;
878 +
879 +@@ -1864,6 +1869,34 @@ i915_wait_request(struct drm_device *dev, uint32_t seqno)
880 + return ret;
881 + }
882 +
883 ++/**
884 ++ * Waits for a sequence number to be signaled, and cleans up the
885 ++ * request and object lists appropriately for that event.
886 ++ */
887 ++static int
888 ++i915_wait_request(struct drm_device *dev, uint32_t seqno)
889 ++{
890 ++ return i915_do_wait_request(dev, seqno, 1);
891 ++}
892 ++
893 ++/**
894 ++ * Waits for the ring to finish up to the latest request. Usefull for waiting
895 ++ * for flip events, e.g for the overlay support. */
896 ++int i915_lp_ring_sync(struct drm_device *dev)
897 ++{
898 ++ uint32_t seqno;
899 ++ int ret;
900 ++
901 ++ seqno = i915_add_request(dev, NULL, 0);
902 ++
903 ++ if (seqno == 0)
904 ++ return -ENOMEM;
905 ++
906 ++ ret = i915_do_wait_request(dev, seqno, 0);
907 ++ BUG_ON(ret == -ERESTARTSYS);
908 ++ return ret;
909 ++}
910 ++
911 + static void
912 + i915_gem_flush(struct drm_device *dev,
913 + uint32_t invalidate_domains,
914 +@@ -1932,7 +1965,7 @@ i915_gem_flush(struct drm_device *dev,
915 + #endif
916 + BEGIN_LP_RING(2);
917 + OUT_RING(cmd);
918 +- OUT_RING(0); /* noop */
919 ++ OUT_RING(MI_NOOP);
920 + ADVANCE_LP_RING();
921 + }
922 + }
923 +@@ -2073,8 +2106,8 @@ static int
924 + i915_gem_evict_everything(struct drm_device *dev)
925 + {
926 + drm_i915_private_t *dev_priv = dev->dev_private;
927 +- uint32_t seqno;
928 + int ret;
929 ++ uint32_t seqno;
930 + bool lists_empty;
931 +
932 + spin_lock(&dev_priv->mm.active_list_lock);
933 +@@ -2096,6 +2129,8 @@ i915_gem_evict_everything(struct drm_device *dev)
934 + if (ret)
935 + return ret;
936 +
937 ++ BUG_ON(!list_empty(&dev_priv->mm.flushing_list));
938 ++
939 + ret = i915_gem_evict_from_inactive_list(dev);
940 + if (ret)
941 + return ret;
942 +@@ -2690,7 +2725,7 @@ i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj)
943 + old_write_domain = obj->write_domain;
944 + i915_gem_flush(dev, 0, obj->write_domain);
945 + seqno = i915_add_request(dev, NULL, obj->write_domain);
946 +- obj->write_domain = 0;
947 ++ BUG_ON(obj->write_domain);
948 + i915_gem_object_move_to_active(obj, seqno);
949 +
950 + trace_i915_gem_object_change_domain(obj,
951 +@@ -2790,6 +2825,57 @@ i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write)
952 + return 0;
953 + }
954 +
955 ++/*
956 ++ * Prepare buffer for display plane. Use uninterruptible for possible flush
957 ++ * wait, as in modesetting process we're not supposed to be interrupted.
958 ++ */
959 ++int
960 ++i915_gem_object_set_to_display_plane(struct drm_gem_object *obj)
961 ++{
962 ++ struct drm_device *dev = obj->dev;
963 ++ struct drm_i915_gem_object *obj_priv = obj->driver_private;
964 ++ uint32_t old_write_domain, old_read_domains;
965 ++ int ret;
966 ++
967 ++ /* Not valid to be called on unbound objects. */
968 ++ if (obj_priv->gtt_space == NULL)
969 ++ return -EINVAL;
970 ++
971 ++ i915_gem_object_flush_gpu_write_domain(obj);
972 ++
973 ++ /* Wait on any GPU rendering and flushing to occur. */
974 ++ if (obj_priv->active) {
975 ++#if WATCH_BUF
976 ++ DRM_INFO("%s: object %p wait for seqno %08x\n",
977 ++ __func__, obj, obj_priv->last_rendering_seqno);
978 ++#endif
979 ++ ret = i915_do_wait_request(dev, obj_priv->last_rendering_seqno, 0);
980 ++ if (ret != 0)
981 ++ return ret;
982 ++ }
983 ++
984 ++ old_write_domain = obj->write_domain;
985 ++ old_read_domains = obj->read_domains;
986 ++
987 ++ obj->read_domains &= I915_GEM_DOMAIN_GTT;
988 ++
989 ++ i915_gem_object_flush_cpu_write_domain(obj);
990 ++
991 ++ /* It should now be out of any other write domains, and we can update
992 ++ * the domain values for our changes.
993 ++ */
994 ++ BUG_ON((obj->write_domain & ~I915_GEM_DOMAIN_GTT) != 0);
995 ++ obj->read_domains |= I915_GEM_DOMAIN_GTT;
996 ++ obj->write_domain = I915_GEM_DOMAIN_GTT;
997 ++ obj_priv->dirty = 1;
998 ++
999 ++ trace_i915_gem_object_change_domain(obj,
1000 ++ old_read_domains,
1001 ++ old_write_domain);
1002 ++
1003 ++ return 0;
1004 ++}
1005 ++
1006 + /**
1007 + * Moves a single object to the CPU read, and possibly write domain.
1008 + *
1009 +@@ -3710,16 +3796,23 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
1010 + i915_gem_flush(dev,
1011 + dev->invalidate_domains,
1012 + dev->flush_domains);
1013 +- if (dev->flush_domains)
1014 ++ if (dev->flush_domains & I915_GEM_GPU_DOMAINS)
1015 + (void)i915_add_request(dev, file_priv,
1016 + dev->flush_domains);
1017 + }
1018 +
1019 + for (i = 0; i < args->buffer_count; i++) {
1020 + struct drm_gem_object *obj = object_list[i];
1021 ++ struct drm_i915_gem_object *obj_priv = obj->driver_private;
1022 + uint32_t old_write_domain = obj->write_domain;
1023 +
1024 + obj->write_domain = obj->pending_write_domain;
1025 ++ if (obj->write_domain)
1026 ++ list_move_tail(&obj_priv->gpu_write_list,
1027 ++ &dev_priv->mm.gpu_write_list);
1028 ++ else
1029 ++ list_del_init(&obj_priv->gpu_write_list);
1030 ++
1031 + trace_i915_gem_object_change_domain(obj,
1032 + obj->read_domains,
1033 + old_write_domain);
1034 +@@ -4112,6 +4205,7 @@ int i915_gem_init_object(struct drm_gem_object *obj)
1035 + obj_priv->obj = obj;
1036 + obj_priv->fence_reg = I915_FENCE_REG_NONE;
1037 + INIT_LIST_HEAD(&obj_priv->list);
1038 ++ INIT_LIST_HEAD(&obj_priv->gpu_write_list);
1039 + INIT_LIST_HEAD(&obj_priv->fence_list);
1040 + obj_priv->madv = I915_MADV_WILLNEED;
1041 +
1042 +@@ -4563,6 +4657,7 @@ i915_gem_load(struct drm_device *dev)
1043 + spin_lock_init(&dev_priv->mm.active_list_lock);
1044 + INIT_LIST_HEAD(&dev_priv->mm.active_list);
1045 + INIT_LIST_HEAD(&dev_priv->mm.flushing_list);
1046 ++ INIT_LIST_HEAD(&dev_priv->mm.gpu_write_list);
1047 + INIT_LIST_HEAD(&dev_priv->mm.inactive_list);
1048 + INIT_LIST_HEAD(&dev_priv->mm.request_list);
1049 + INIT_LIST_HEAD(&dev_priv->mm.fence_list);
1050 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
1051 +index fd537f4..cc9b49a 100644
1052 +--- a/drivers/gpu/drm/i915/i915_reg.h
1053 ++++ b/drivers/gpu/drm/i915/i915_reg.h
1054 +@@ -329,6 +329,7 @@
1055 + #define FBC_CTL_PERIODIC (1<<30)
1056 + #define FBC_CTL_INTERVAL_SHIFT (16)
1057 + #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
1058 ++#define FBC_C3_IDLE (1<<13)
1059 + #define FBC_CTL_STRIDE_SHIFT (5)
1060 + #define FBC_CTL_FENCENO (1<<0)
1061 + #define FBC_COMMAND 0x0320c
1062 +@@ -405,6 +406,13 @@
1063 + # define GPIO_DATA_VAL_IN (1 << 12)
1064 + # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
1065 +
1066 ++#define GMBUS0 0x5100
1067 ++#define GMBUS1 0x5104
1068 ++#define GMBUS2 0x5108
1069 ++#define GMBUS3 0x510c
1070 ++#define GMBUS4 0x5110
1071 ++#define GMBUS5 0x5120
1072 ++
1073 + /*
1074 + * Clock control & power management
1075 + */
1076 +@@ -2153,6 +2161,13 @@
1077 + #define PCH_GPIOE 0xc5020
1078 + #define PCH_GPIOF 0xc5024
1079 +
1080 ++#define PCH_GMBUS0 0xc5100
1081 ++#define PCH_GMBUS1 0xc5104
1082 ++#define PCH_GMBUS2 0xc5108
1083 ++#define PCH_GMBUS3 0xc510c
1084 ++#define PCH_GMBUS4 0xc5110
1085 ++#define PCH_GMBUS5 0xc5120
1086 ++
1087 + #define PCH_DPLL_A 0xc6014
1088 + #define PCH_DPLL_B 0xc6018
1089 +
1090 +diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
1091 +index 6eec817..7ad742f 100644
1092 +--- a/drivers/gpu/drm/i915/i915_suspend.c
1093 ++++ b/drivers/gpu/drm/i915/i915_suspend.c
1094 +@@ -27,7 +27,7 @@
1095 + #include "drmP.h"
1096 + #include "drm.h"
1097 + #include "i915_drm.h"
1098 +-#include "i915_drv.h"
1099 ++#include "intel_drv.h"
1100 +
1101 + static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe)
1102 + {
1103 +@@ -846,6 +846,9 @@ int i915_restore_state(struct drm_device *dev)
1104 + for (i = 0; i < 3; i++)
1105 + I915_WRITE(SWF30 + (i << 2), dev_priv->saveSWF2[i]);
1106 +
1107 ++ /* I2C state */
1108 ++ intel_i2c_reset_gmbus(dev);
1109 ++
1110 + return 0;
1111 + }
1112 +
1113 +diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
1114 +index 6d3730f..5e730e6 100644
1115 +--- a/drivers/gpu/drm/i915/intel_crt.c
1116 ++++ b/drivers/gpu/drm/i915/intel_crt.c
1117 +@@ -185,6 +185,9 @@ static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
1118 + adpa = I915_READ(PCH_ADPA);
1119 +
1120 + adpa &= ~ADPA_CRT_HOTPLUG_MASK;
1121 ++ /* disable HPD first */
1122 ++ I915_WRITE(PCH_ADPA, adpa);
1123 ++ (void)I915_READ(PCH_ADPA);
1124 +
1125 + adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 |
1126 + ADPA_CRT_HOTPLUG_WARMUP_10MS |
1127 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1128 +index 601415d..b00a1aa 100644
1129 +--- a/drivers/gpu/drm/i915/intel_display.c
1130 ++++ b/drivers/gpu/drm/i915/intel_display.c
1131 +@@ -988,6 +988,8 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
1132 +
1133 + /* enable it... */
1134 + fbc_ctl = FBC_CTL_EN | FBC_CTL_PERIODIC;
1135 ++ if (IS_I945GM(dev))
1136 ++ fbc_ctl |= FBC_C3_IDLE; /* 945 needs special SR handling */
1137 + fbc_ctl |= (dev_priv->cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT;
1138 + fbc_ctl |= (interval & 0x2fff) << FBC_CTL_INTERVAL_SHIFT;
1139 + if (obj_priv->tiling_mode != I915_TILING_NONE)
1140 +@@ -1251,7 +1253,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
1141 + return ret;
1142 + }
1143 +
1144 +- ret = i915_gem_object_set_to_gtt_domain(obj, 1);
1145 ++ ret = i915_gem_object_set_to_display_plane(obj);
1146 + if (ret != 0) {
1147 + i915_gem_object_unpin(obj);
1148 + mutex_unlock(&dev->struct_mutex);
1149 +@@ -2538,6 +2540,10 @@ static void g4x_update_wm(struct drm_device *dev, int planea_clock,
1150 + sr_entries = roundup(sr_entries / cacheline_size, 1);
1151 + DRM_DEBUG("self-refresh entries: %d\n", sr_entries);
1152 + I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
1153 ++ } else {
1154 ++ /* Turn off self refresh if both pipes are enabled */
1155 ++ I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
1156 ++ & ~FW_BLC_SELF_EN);
1157 + }
1158 +
1159 + DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, SR %d\n",
1160 +@@ -2556,15 +2562,43 @@ static void g4x_update_wm(struct drm_device *dev, int planea_clock,
1161 + (cursor_sr << DSPFW_CURSOR_SR_SHIFT));
1162 + }
1163 +
1164 +-static void i965_update_wm(struct drm_device *dev, int unused, int unused2,
1165 +- int unused3, int unused4)
1166 ++static void i965_update_wm(struct drm_device *dev, int planea_clock,
1167 ++ int planeb_clock, int sr_hdisplay, int pixel_size)
1168 + {
1169 + struct drm_i915_private *dev_priv = dev->dev_private;
1170 ++ unsigned long line_time_us;
1171 ++ int sr_clock, sr_entries, srwm = 1;
1172 ++
1173 ++ /* Calc sr entries for one plane configs */
1174 ++ if (sr_hdisplay && (!planea_clock || !planeb_clock)) {
1175 ++ /* self-refresh has much higher latency */
1176 ++ const static int sr_latency_ns = 12000;
1177 ++
1178 ++ sr_clock = planea_clock ? planea_clock : planeb_clock;
1179 ++ line_time_us = ((sr_hdisplay * 1000) / sr_clock);
1180 +
1181 +- DRM_DEBUG("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR 8\n");
1182 ++ /* Use ns/us then divide to preserve precision */
1183 ++ sr_entries = (((sr_latency_ns / line_time_us) + 1) *
1184 ++ pixel_size * sr_hdisplay) / 1000;
1185 ++ sr_entries = roundup(sr_entries / I915_FIFO_LINE_SIZE, 1);
1186 ++ DRM_DEBUG("self-refresh entries: %d\n", sr_entries);
1187 ++ srwm = I945_FIFO_SIZE - sr_entries;
1188 ++ if (srwm < 0)
1189 ++ srwm = 1;
1190 ++ srwm &= 0x3f;
1191 ++ I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
1192 ++ } else {
1193 ++ /* Turn off self refresh if both pipes are enabled */
1194 ++ I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
1195 ++ & ~FW_BLC_SELF_EN);
1196 ++ }
1197 ++
1198 ++ DRM_DEBUG_KMS("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR %d\n",
1199 ++ srwm);
1200 +
1201 + /* 965 has limitations... */
1202 +- I915_WRITE(DSPFW1, (8 << 16) | (8 << 8) | (8 << 0));
1203 ++ I915_WRITE(DSPFW1, (srwm << DSPFW_SR_SHIFT) | (8 << 16) | (8 << 8) |
1204 ++ (8 << 0));
1205 + I915_WRITE(DSPFW2, (8 << 8) | (8 << 0));
1206 + }
1207 +
1208 +@@ -2625,6 +2659,10 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock,
1209 + if (srwm < 0)
1210 + srwm = 1;
1211 + I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN | (srwm & 0x3f));
1212 ++ } else {
1213 ++ /* Turn off self refresh if both pipes are enabled */
1214 ++ I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF)
1215 ++ & ~FW_BLC_SELF_EN);
1216 + }
1217 +
1218 + DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, C: %d, SR %d\n",
1219 +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
1220 +index ef61fe9..6c7c19f 100644
1221 +--- a/drivers/gpu/drm/i915/intel_drv.h
1222 ++++ b/drivers/gpu/drm/i915/intel_drv.h
1223 +@@ -134,6 +134,8 @@ void intel_i2c_destroy(struct i2c_adapter *adapter);
1224 + int intel_ddc_get_modes(struct intel_output *intel_output);
1225 + extern bool intel_ddc_probe(struct intel_output *intel_output);
1226 + void intel_i2c_quirk_set(struct drm_device *dev, bool enable);
1227 ++void intel_i2c_reset_gmbus(struct drm_device *dev);
1228 ++
1229 + extern void intel_crt_init(struct drm_device *dev);
1230 + extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg);
1231 + extern bool intel_sdvo_init(struct drm_device *dev, int output_device);
1232 +diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
1233 +index 2b0fe54..1318ac2 100644
1234 +--- a/drivers/gpu/drm/i915/intel_fb.c
1235 ++++ b/drivers/gpu/drm/i915/intel_fb.c
1236 +@@ -148,7 +148,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
1237 +
1238 + mutex_lock(&dev->struct_mutex);
1239 +
1240 +- ret = i915_gem_object_pin(fbo, PAGE_SIZE);
1241 ++ ret = i915_gem_object_pin(fbo, 64*1024);
1242 + if (ret) {
1243 + DRM_ERROR("failed to pin fb: %d\n", ret);
1244 + goto out_unref;
1245 +diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
1246 +index c7eab72..b94acc4 100644
1247 +--- a/drivers/gpu/drm/i915/intel_i2c.c
1248 ++++ b/drivers/gpu/drm/i915/intel_i2c.c
1249 +@@ -118,6 +118,23 @@ static void set_data(void *data, int state_high)
1250 + udelay(I2C_RISEFALL_TIME); /* wait for the line to change state */
1251 + }
1252 +
1253 ++/* Clears the GMBUS setup. Our driver doesn't make use of the GMBUS I2C
1254 ++ * engine, but if the BIOS leaves it enabled, then that can break our use
1255 ++ * of the bit-banging I2C interfaces. This is notably the case with the
1256 ++ * Mac Mini in EFI mode.
1257 ++ */
1258 ++void
1259 ++intel_i2c_reset_gmbus(struct drm_device *dev)
1260 ++{
1261 ++ struct drm_i915_private *dev_priv = dev->dev_private;
1262 ++
1263 ++ if (IS_IGDNG(dev)) {
1264 ++ I915_WRITE(PCH_GMBUS0, 0);
1265 ++ } else {
1266 ++ I915_WRITE(GMBUS0, 0);
1267 ++ }
1268 ++}
1269 ++
1270 + /**
1271 + * intel_i2c_create - instantiate an Intel i2c bus using the specified GPIO reg
1272 + * @dev: DRM device
1273 +@@ -168,6 +185,8 @@ struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg,
1274 + if(i2c_bit_add_bus(&chan->adapter))
1275 + goto out_free;
1276 +
1277 ++ intel_i2c_reset_gmbus(dev);
1278 ++
1279 + /* JJJ: raise SCL and SDA? */
1280 + intel_i2c_quirk_set(dev, true);
1281 + set_data(chan, 1);
1282 +diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
1283 +index 0e0e4b4..952bb4e 100644
1284 +--- a/drivers/gpu/drm/i915/intel_lvds.c
1285 ++++ b/drivers/gpu/drm/i915/intel_lvds.c
1286 +@@ -602,12 +602,33 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
1287 + /* Some lid devices report incorrect lid status, assume they're connected */
1288 + static const struct dmi_system_id bad_lid_status[] = {
1289 + {
1290 ++ .ident = "Compaq nx9020",
1291 ++ .matches = {
1292 ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1293 ++ DMI_MATCH(DMI_BOARD_NAME, "3084"),
1294 ++ },
1295 ++ },
1296 ++ {
1297 ++ .ident = "Samsung SX20S",
1298 ++ .matches = {
1299 ++ DMI_MATCH(DMI_SYS_VENDOR, "Samsung Electronics"),
1300 ++ DMI_MATCH(DMI_BOARD_NAME, "SX20S"),
1301 ++ },
1302 ++ },
1303 ++ {
1304 + .ident = "Aspire One",
1305 + .matches = {
1306 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1307 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"),
1308 + },
1309 + },
1310 ++ {
1311 ++ .ident = "PC-81005",
1312 ++ .matches = {
1313 ++ DMI_MATCH(DMI_SYS_VENDOR, "MALATA"),
1314 ++ DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"),
1315 ++ },
1316 ++ },
1317 + { }
1318 + };
1319 +
1320 +diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
1321 +index d67c425..fed2291 100644
1322 +--- a/drivers/gpu/drm/radeon/atom.c
1323 ++++ b/drivers/gpu/drm/radeon/atom.c
1324 +@@ -607,7 +607,7 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)
1325 + uint8_t count = U8((*ptr)++);
1326 + SDEBUG(" count: %d\n", count);
1327 + if (arg == ATOM_UNIT_MICROSEC)
1328 +- schedule_timeout_uninterruptible(usecs_to_jiffies(count));
1329 ++ udelay(count);
1330 + else
1331 + schedule_timeout_uninterruptible(msecs_to_jiffies(count));
1332 + }
1333 +diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
1334 +index 262c133..14f910d 100644
1335 +--- a/drivers/hwmon/adt7462.c
1336 ++++ b/drivers/hwmon/adt7462.c
1337 +@@ -182,7 +182,7 @@ I2C_CLIENT_INSMOD_1(adt7462);
1338 + *
1339 + * Some, but not all, of these voltages have low/high limits.
1340 + */
1341 +-#define ADT7462_VOLT_COUNT 12
1342 ++#define ADT7462_VOLT_COUNT 13
1343 +
1344 + #define ADT7462_VENDOR 0x41
1345 + #define ADT7462_DEVICE 0x62
1346 +diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
1347 +index f7e7016..1508e0a 100644
1348 +--- a/drivers/hwmon/lm78.c
1349 ++++ b/drivers/hwmon/lm78.c
1350 +@@ -870,17 +870,16 @@ static struct lm78_data *lm78_update_device(struct device *dev)
1351 + static int __init lm78_isa_found(unsigned short address)
1352 + {
1353 + int val, save, found = 0;
1354 +-
1355 +- /* We have to request the region in two parts because some
1356 +- boards declare base+4 to base+7 as a PNP device */
1357 +- if (!request_region(address, 4, "lm78")) {
1358 +- pr_debug("lm78: Failed to request low part of region\n");
1359 +- return 0;
1360 +- }
1361 +- if (!request_region(address + 4, 4, "lm78")) {
1362 +- pr_debug("lm78: Failed to request high part of region\n");
1363 +- release_region(address, 4);
1364 +- return 0;
1365 ++ int port;
1366 ++
1367 ++ /* Some boards declare base+0 to base+7 as a PNP device, some base+4
1368 ++ * to base+7 and some base+5 to base+6. So we better request each port
1369 ++ * individually for the probing phase. */
1370 ++ for (port = address; port < address + LM78_EXTENT; port++) {
1371 ++ if (!request_region(port, 1, "lm78")) {
1372 ++ pr_debug("lm78: Failed to request port 0x%x\n", port);
1373 ++ goto release;
1374 ++ }
1375 + }
1376 +
1377 + #define REALLY_SLOW_IO
1378 +@@ -944,8 +943,8 @@ static int __init lm78_isa_found(unsigned short address)
1379 + val & 0x80 ? "LM79" : "LM78", (int)address);
1380 +
1381 + release:
1382 +- release_region(address + 4, 4);
1383 +- release_region(address, 4);
1384 ++ for (port--; port >= address; port--)
1385 ++ release_region(port, 1);
1386 + return found;
1387 + }
1388 +
1389 +diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
1390 +index d27ed1b..f0b6883 100644
1391 +--- a/drivers/hwmon/w83781d.c
1392 ++++ b/drivers/hwmon/w83781d.c
1393 +@@ -1818,17 +1818,17 @@ static int __init
1394 + w83781d_isa_found(unsigned short address)
1395 + {
1396 + int val, save, found = 0;
1397 +-
1398 +- /* We have to request the region in two parts because some
1399 +- boards declare base+4 to base+7 as a PNP device */
1400 +- if (!request_region(address, 4, "w83781d")) {
1401 +- pr_debug("w83781d: Failed to request low part of region\n");
1402 +- return 0;
1403 +- }
1404 +- if (!request_region(address + 4, 4, "w83781d")) {
1405 +- pr_debug("w83781d: Failed to request high part of region\n");
1406 +- release_region(address, 4);
1407 +- return 0;
1408 ++ int port;
1409 ++
1410 ++ /* Some boards declare base+0 to base+7 as a PNP device, some base+4
1411 ++ * to base+7 and some base+5 to base+6. So we better request each port
1412 ++ * individually for the probing phase. */
1413 ++ for (port = address; port < address + W83781D_EXTENT; port++) {
1414 ++ if (!request_region(port, 1, "w83781d")) {
1415 ++ pr_debug("w83781d: Failed to request port 0x%x\n",
1416 ++ port);
1417 ++ goto release;
1418 ++ }
1419 + }
1420 +
1421 + #define REALLY_SLOW_IO
1422 +@@ -1902,8 +1902,8 @@ w83781d_isa_found(unsigned short address)
1423 + val == 0x30 ? "W83782D" : "W83781D", (int)address);
1424 +
1425 + release:
1426 +- release_region(address + 4, 4);
1427 +- release_region(address, 4);
1428 ++ for (port--; port >= address; port--)
1429 ++ release_region(port, 1);
1430 + return found;
1431 + }
1432 +
1433 +diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
1434 +index b1c050f..e29b6d5 100644
1435 +--- a/drivers/i2c/busses/i2c-tiny-usb.c
1436 ++++ b/drivers/i2c/busses/i2c-tiny-usb.c
1437 +@@ -13,6 +13,7 @@
1438 + #include <linux/kernel.h>
1439 + #include <linux/errno.h>
1440 + #include <linux/module.h>
1441 ++#include <linux/types.h>
1442 +
1443 + /* include interfaces to usb layer */
1444 + #include <linux/usb.h>
1445 +@@ -31,8 +32,8 @@
1446 + #define CMD_I2C_IO_END (1<<1)
1447 +
1448 + /* i2c bit delay, default is 10us -> 100kHz */
1449 +-static int delay = 10;
1450 +-module_param(delay, int, 0);
1451 ++static unsigned short delay = 10;
1452 ++module_param(delay, ushort, 0);
1453 + MODULE_PARM_DESC(delay, "bit delay in microseconds, "
1454 + "e.g. 10 for 100kHz (default is 100kHz)");
1455 +
1456 +@@ -109,7 +110,7 @@ static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
1457 +
1458 + static u32 usb_func(struct i2c_adapter *adapter)
1459 + {
1460 +- u32 func;
1461 ++ __le32 func;
1462 +
1463 + /* get functionality from adapter */
1464 + if (usb_read(adapter, CMD_GET_FUNC, 0, 0, &func, sizeof(func)) !=
1465 +@@ -118,7 +119,7 @@ static u32 usb_func(struct i2c_adapter *adapter)
1466 + return 0;
1467 + }
1468 +
1469 +- return func;
1470 ++ return le32_to_cpu(func);
1471 + }
1472 +
1473 + /* This is the actual algorithm we define */
1474 +@@ -216,8 +217,7 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
1475 + "i2c-tiny-usb at bus %03d device %03d",
1476 + dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
1477 +
1478 +- if (usb_write(&dev->adapter, CMD_SET_DELAY,
1479 +- cpu_to_le16(delay), 0, NULL, 0) != 0) {
1480 ++ if (usb_write(&dev->adapter, CMD_SET_DELAY, delay, 0, NULL, 0) != 0) {
1481 + dev_err(&dev->adapter.dev,
1482 + "failure setting delay to %dus\n", delay);
1483 + retval = -EIO;
1484 +diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
1485 +index 54abf9e..f1c8cae 100644
1486 +--- a/drivers/md/dm-log-userspace-transfer.c
1487 ++++ b/drivers/md/dm-log-userspace-transfer.c
1488 +@@ -172,11 +172,15 @@ int dm_consult_userspace(const char *uuid, uint64_t luid, int request_type,
1489 + {
1490 + int r = 0;
1491 + size_t dummy = 0;
1492 +- int overhead_size =
1493 +- sizeof(struct dm_ulog_request *) + sizeof(struct cn_msg);
1494 ++ int overhead_size = sizeof(struct dm_ulog_request) + sizeof(struct cn_msg);
1495 + struct dm_ulog_request *tfr = prealloced_ulog_tfr;
1496 + struct receiving_pkg pkg;
1497 +
1498 ++ /*
1499 ++ * Given the space needed to hold the 'struct cn_msg' and
1500 ++ * 'struct dm_ulog_request' - do we have enough payload
1501 ++ * space remaining?
1502 ++ */
1503 + if (data_size > (DM_ULOG_PREALLOCED_SIZE - overhead_size)) {
1504 + DMINFO("Size of tfr exceeds preallocated size");
1505 + return -EINVAL;
1506 +@@ -191,7 +195,7 @@ resend:
1507 + */
1508 + mutex_lock(&dm_ulog_lock);
1509 +
1510 +- memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - overhead_size);
1511 ++ memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - sizeof(struct cn_msg));
1512 + memcpy(tfr->uuid, uuid, DM_UUID_LEN);
1513 + tfr->luid = luid;
1514 + tfr->seq = dm_ulog_seq++;
1515 +diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
1516 +index e0efc1a..bd58703 100644
1517 +--- a/drivers/md/dm-stripe.c
1518 ++++ b/drivers/md/dm-stripe.c
1519 +@@ -110,7 +110,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1520 + }
1521 +
1522 + stripes = simple_strtoul(argv[0], &end, 10);
1523 +- if (*end) {
1524 ++ if (!stripes || *end) {
1525 + ti->error = "Invalid stripe count";
1526 + return -EINVAL;
1527 + }
1528 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1529 +index d29215d..431b9b2 100644
1530 +--- a/drivers/md/raid5.c
1531 ++++ b/drivers/md/raid5.c
1532 +@@ -5432,11 +5432,11 @@ static int raid5_start_reshape(mddev_t *mddev)
1533 + !test_bit(Faulty, &rdev->flags)) {
1534 + if (raid5_add_disk(mddev, rdev) == 0) {
1535 + char nm[20];
1536 +- if (rdev->raid_disk >= conf->previous_raid_disks)
1537 ++ if (rdev->raid_disk >= conf->previous_raid_disks) {
1538 + set_bit(In_sync, &rdev->flags);
1539 +- else
1540 ++ added_devices++;
1541 ++ } else
1542 + rdev->recovery_offset = 0;
1543 +- added_devices++;
1544 + sprintf(nm, "rd%d", rdev->raid_disk);
1545 + if (sysfs_create_link(&mddev->kobj,
1546 + &rdev->kobj, nm))
1547 +@@ -5448,9 +5448,12 @@ static int raid5_start_reshape(mddev_t *mddev)
1548 + break;
1549 + }
1550 +
1551 ++ /* When a reshape changes the number of devices, ->degraded
1552 ++ * is measured against the large of the pre and post number of
1553 ++ * devices.*/
1554 + if (mddev->delta_disks > 0) {
1555 + spin_lock_irqsave(&conf->device_lock, flags);
1556 +- mddev->degraded = (conf->raid_disks - conf->previous_raid_disks)
1557 ++ mddev->degraded += (conf->raid_disks - conf->previous_raid_disks)
1558 + - added_devices;
1559 + spin_unlock_irqrestore(&conf->device_lock, flags);
1560 + }
1561 +diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
1562 +index c37790a..9ddc579 100644
1563 +--- a/drivers/media/dvb/dvb-core/dmxdev.c
1564 ++++ b/drivers/media/dvb/dvb-core/dmxdev.c
1565 +@@ -761,7 +761,6 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
1566 + dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192);
1567 + dmxdevfilter->type = DMXDEV_TYPE_NONE;
1568 + dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED);
1569 +- INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
1570 + init_timer(&dmxdevfilter->timer);
1571 +
1572 + dvbdev->users++;
1573 +@@ -887,6 +886,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev,
1574 + dmxdevfilter->type = DMXDEV_TYPE_PES;
1575 + memcpy(&dmxdevfilter->params, params,
1576 + sizeof(struct dmx_pes_filter_params));
1577 ++ INIT_LIST_HEAD(&dmxdevfilter->feed.ts);
1578 +
1579 + dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_SET);
1580 +
1581 +diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
1582 +index c295786..6cea718 100644
1583 +--- a/drivers/message/fusion/mptscsih.c
1584 ++++ b/drivers/message/fusion/mptscsih.c
1585 +@@ -1720,7 +1720,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1586 + dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: "
1587 + "Command not in the active list! (sc=%p)\n", ioc->name,
1588 + SCpnt));
1589 +- retval = 0;
1590 ++ retval = SUCCESS;
1591 + goto out;
1592 + }
1593 +
1594 +diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
1595 +index 2c6b063..9009bac 100644
1596 +--- a/drivers/net/wireless/ath/ath9k/xmit.c
1597 ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
1598 +@@ -1563,7 +1563,7 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
1599 +
1600 + bf->bf_frmlen = skb->len + FCS_LEN - (hdrlen & 3);
1601 +
1602 +- if (conf_is_ht(&sc->hw->conf) && !is_pae(skb))
1603 ++ if (conf_is_ht(&sc->hw->conf))
1604 + bf->bf_state.bf_type |= BUF_HT;
1605 +
1606 + bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq);
1607 +@@ -1648,7 +1648,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
1608 + goto tx_done;
1609 + }
1610 +
1611 +- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
1612 ++ if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && !is_pae(skb)) {
1613 + /*
1614 + * Try aggregation if it's a unicast data frame
1615 + * and the destination is HT capable.
1616 +diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
1617 +index 6607162..0e6b154 100644
1618 +--- a/drivers/net/wireless/b43/b43.h
1619 ++++ b/drivers/net/wireless/b43/b43.h
1620 +@@ -117,6 +117,7 @@
1621 + #define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */
1622 + #define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */
1623 + #define B43_MMIO_RNG 0x65A
1624 ++#define B43_MMIO_IFSSLOT 0x684 /* Interframe slot time */
1625 + #define B43_MMIO_IFSCTL 0x688 /* Interframe space control */
1626 + #define B43_MMIO_IFSCTL_USE_EDCF 0x0004
1627 + #define B43_MMIO_POWERUP_DELAY 0x6A8
1628 +diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
1629 +index 098dda1..9ca253e 100644
1630 +--- a/drivers/net/wireless/b43/main.c
1631 ++++ b/drivers/net/wireless/b43/main.c
1632 +@@ -628,10 +628,17 @@ static void b43_upload_card_macaddress(struct b43_wldev *dev)
1633 + static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time)
1634 + {
1635 + /* slot_time is in usec. */
1636 +- if (dev->phy.type != B43_PHYTYPE_G)
1637 ++ /* This test used to exit for all but a G PHY. */
1638 ++ if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
1639 + return;
1640 +- b43_write16(dev, 0x684, 510 + slot_time);
1641 +- b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time);
1642 ++ b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time);
1643 ++ /* Shared memory location 0x0010 is the slot time and should be
1644 ++ * set to slot_time; however, this register is initially 0 and changing
1645 ++ * the value adversely affects the transmit rate for BCM4311
1646 ++ * devices. Until this behavior is unterstood, delete this step
1647 ++ *
1648 ++ * b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time);
1649 ++ */
1650 + }
1651 +
1652 + static void b43_short_slot_timing_enable(struct b43_wldev *dev)
1653 +diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
1654 +index 2dc9287..0cd4ec4 100644
1655 +--- a/drivers/net/wireless/iwlwifi/iwl-core.c
1656 ++++ b/drivers/net/wireless/iwlwifi/iwl-core.c
1657 +@@ -2645,6 +2645,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
1658 + if ((le16_to_cpu(priv->staging_rxon.channel) != ch))
1659 + priv->staging_rxon.flags = 0;
1660 +
1661 ++ iwl_set_rxon_ht(priv, ht_conf);
1662 + iwl_set_rxon_channel(priv, conf->channel);
1663 +
1664 + iwl_set_flags_for_band(priv, conf->channel->band);
1665 +diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
1666 +index ea49918..9921147 100644
1667 +--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
1668 ++++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
1669 +@@ -65,6 +65,7 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
1670 + /* Sitecom */
1671 + {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
1672 + {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
1673 ++ {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B},
1674 + /* Sphairon Access Systems GmbH */
1675 + {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
1676 + /* Dick Smith Electronics */
1677 +diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
1678 +index 0f900cc..6dec7cc 100644
1679 +--- a/drivers/platform/x86/dell-wmi.c
1680 ++++ b/drivers/platform/x86/dell-wmi.c
1681 +@@ -158,8 +158,13 @@ static void dell_wmi_notify(u32 value, void *context)
1682 + struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
1683 + static struct key_entry *key;
1684 + union acpi_object *obj;
1685 ++ acpi_status status;
1686 +
1687 +- wmi_get_event_data(value, &response);
1688 ++ status = wmi_get_event_data(value, &response);
1689 ++ if (status != AE_OK) {
1690 ++ printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status);
1691 ++ return;
1692 ++ }
1693 +
1694 + obj = (union acpi_object *)response.pointer;
1695 +
1696 +@@ -180,6 +185,7 @@ static void dell_wmi_notify(u32 value, void *context)
1697 + printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
1698 + buffer[1] & 0xFFFF);
1699 + }
1700 ++ kfree(obj);
1701 + }
1702 +
1703 + static int __init dell_wmi_input_setup(void)
1704 +diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
1705 +index c284217..deb53b5 100644
1706 +--- a/drivers/platform/x86/hp-wmi.c
1707 ++++ b/drivers/platform/x86/hp-wmi.c
1708 +@@ -334,8 +334,13 @@ static void hp_wmi_notify(u32 value, void *context)
1709 + struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
1710 + static struct key_entry *key;
1711 + union acpi_object *obj;
1712 ++ acpi_status status;
1713 +
1714 +- wmi_get_event_data(value, &response);
1715 ++ status = wmi_get_event_data(value, &response);
1716 ++ if (status != AE_OK) {
1717 ++ printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
1718 ++ return;
1719 ++ }
1720 +
1721 + obj = (union acpi_object *)response.pointer;
1722 +
1723 +@@ -377,6 +382,8 @@ static void hp_wmi_notify(u32 value, void *context)
1724 + eventcode);
1725 + } else
1726 + printk(KERN_INFO "HP WMI: Unknown response received\n");
1727 ++
1728 ++ kfree(obj);
1729 + }
1730 +
1731 + static int __init hp_wmi_input_setup(void)
1732 +diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
1733 +index 177f8d7..87f4c97 100644
1734 +--- a/drivers/platform/x86/wmi.c
1735 ++++ b/drivers/platform/x86/wmi.c
1736 +@@ -510,8 +510,8 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
1737 + /**
1738 + * wmi_get_event_data - Get WMI data associated with an event
1739 + *
1740 +- * @event - Event to find
1741 +- * &out - Buffer to hold event data
1742 ++ * @event: Event to find
1743 ++ * @out: Buffer to hold event data. out->pointer should be freed with kfree()
1744 + *
1745 + * Returns extra data associated with an event in WMI.
1746 + */
1747 +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
1748 +index efe568d..1836053 100644
1749 +--- a/drivers/regulator/core.c
1750 ++++ b/drivers/regulator/core.c
1751 +@@ -640,7 +640,7 @@ static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
1752 + static void print_constraints(struct regulator_dev *rdev)
1753 + {
1754 + struct regulation_constraints *constraints = rdev->constraints;
1755 +- char buf[80];
1756 ++ char buf[80] = "";
1757 + int count;
1758 +
1759 + if (rdev->desc->type == REGULATOR_VOLTAGE) {
1760 +diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c
1761 +index 3a7be11..812c667 100644
1762 +--- a/drivers/rtc/rtc-fm3130.c
1763 ++++ b/drivers/rtc/rtc-fm3130.c
1764 +@@ -376,20 +376,22 @@ static int __devinit fm3130_probe(struct i2c_client *client,
1765 + }
1766 +
1767 + /* Disabling calibration mode */
1768 +- if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL)
1769 ++ if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL) {
1770 + i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
1771 + fm3130->regs[FM3130_RTC_CONTROL] &
1772 + ~(FM3130_RTC_CONTROL_BIT_CAL));
1773 + dev_warn(&client->dev, "Disabling calibration mode!\n");
1774 ++ }
1775 +
1776 + /* Disabling read and write modes */
1777 + if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_WRITE ||
1778 +- fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ)
1779 ++ fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ) {
1780 + i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
1781 + fm3130->regs[FM3130_RTC_CONTROL] &
1782 + ~(FM3130_RTC_CONTROL_BIT_READ |
1783 + FM3130_RTC_CONTROL_BIT_WRITE));
1784 + dev_warn(&client->dev, "Disabling READ or WRITE mode!\n");
1785 ++ }
1786 +
1787 + /* oscillator off? turn it on, so clock can tick. */
1788 + if (fm3130->regs[FM3130_CAL_CONTROL] & FM3130_CAL_CONTROL_BIT_nOSCEN)
1789 +diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
1790 +index 513dec9..d0ef15a 100644
1791 +--- a/drivers/s390/block/dasd.c
1792 ++++ b/drivers/s390/block/dasd.c
1793 +@@ -994,10 +994,9 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
1794 + return;
1795 + cqr = (struct dasd_ccw_req *) intparm;
1796 + if (cqr->status != DASD_CQR_IN_IO) {
1797 +- DBF_EVENT(DBF_DEBUG,
1798 +- "invalid status in handle_killed_request: "
1799 +- "bus_id %s, status %02x",
1800 +- dev_name(&cdev->dev), cqr->status);
1801 ++ DBF_EVENT_DEVID(DBF_DEBUG, cdev,
1802 ++ "invalid status in handle_killed_request: "
1803 ++ "%02x", cqr->status);
1804 + return;
1805 + }
1806 +
1807 +@@ -1045,12 +1044,13 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
1808 + case -EIO:
1809 + break;
1810 + case -ETIMEDOUT:
1811 +- DBF_EVENT(DBF_WARNING, "%s(%s): request timed out\n",
1812 +- __func__, dev_name(&cdev->dev));
1813 ++ DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s: "
1814 ++ "request timed out\n", __func__);
1815 + break;
1816 + default:
1817 +- DBF_EVENT(DBF_WARNING, "%s(%s): unknown error %ld\n",
1818 +- __func__, dev_name(&cdev->dev), PTR_ERR(irb));
1819 ++ DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s: "
1820 ++ "unknown error %ld\n", __func__,
1821 ++ PTR_ERR(irb));
1822 + }
1823 + dasd_handle_killed_request(cdev, intparm);
1824 + return;
1825 +@@ -2217,9 +2217,9 @@ int dasd_generic_probe(struct ccw_device *cdev,
1826 + }
1827 + ret = dasd_add_sysfs_files(cdev);
1828 + if (ret) {
1829 +- DBF_EVENT(DBF_WARNING,
1830 +- "dasd_generic_probe: could not add sysfs entries "
1831 +- "for %s\n", dev_name(&cdev->dev));
1832 ++ DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s",
1833 ++ "dasd_generic_probe: could not add "
1834 ++ "sysfs entries");
1835 + return ret;
1836 + }
1837 + cdev->handler = &dasd_int_handler;
1838 +diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
1839 +index 80c205b..678bb94 100644
1840 +--- a/drivers/s390/block/dasd_eckd.c
1841 ++++ b/drivers/s390/block/dasd_eckd.c
1842 +@@ -88,9 +88,9 @@ dasd_eckd_probe (struct ccw_device *cdev)
1843 + /* set ECKD specific ccw-device options */
1844 + ret = ccw_device_set_options(cdev, CCWDEV_ALLOW_FORCE);
1845 + if (ret) {
1846 +- DBF_EVENT(DBF_WARNING,
1847 +- "dasd_eckd_probe: could not set ccw-device options "
1848 +- "for %s\n", dev_name(&cdev->dev));
1849 ++ DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s",
1850 ++ "dasd_eckd_probe: could not set "
1851 ++ "ccw-device options");
1852 + return ret;
1853 + }
1854 + ret = dasd_generic_probe(cdev, &dasd_eckd_discipline);
1855 +@@ -885,16 +885,15 @@ static int dasd_eckd_read_conf(struct dasd_device *device)
1856 + rc = dasd_eckd_read_conf_lpm(device, &conf_data,
1857 + &conf_len, lpm);
1858 + if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */
1859 +- DBF_EVENT(DBF_WARNING,
1860 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev,
1861 + "Read configuration data returned "
1862 +- "error %d for device: %s", rc,
1863 +- dev_name(&device->cdev->dev));
1864 ++ "error %d", rc);
1865 + return rc;
1866 + }
1867 + if (conf_data == NULL) {
1868 +- DBF_EVENT(DBF_WARNING, "No configuration "
1869 +- "data retrieved for device: %s",
1870 +- dev_name(&device->cdev->dev));
1871 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s",
1872 ++ "No configuration data "
1873 ++ "retrieved");
1874 + continue; /* no error */
1875 + }
1876 + /* save first valid configuration data */
1877 +@@ -941,9 +940,8 @@ static int dasd_eckd_read_features(struct dasd_device *device)
1878 + sizeof(struct dasd_rssd_features)),
1879 + device);
1880 + if (IS_ERR(cqr)) {
1881 +- DBF_EVENT(DBF_WARNING, "Could not allocate initialization "
1882 +- "request for device: %s",
1883 +- dev_name(&device->cdev->dev));
1884 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", "Could not "
1885 ++ "allocate initialization request");
1886 + return PTR_ERR(cqr);
1887 + }
1888 + cqr->startdev = device;
1889 +@@ -1071,10 +1069,8 @@ static int dasd_eckd_validate_server(struct dasd_device *device)
1890 + /* may be requested feature is not available on server,
1891 + * therefore just report error and go ahead */
1892 + private = (struct dasd_eckd_private *) device->private;
1893 +- DBF_EVENT(DBF_WARNING, "PSF-SSC on storage subsystem %s.%s.%04x "
1894 +- "returned rc=%d for device: %s",
1895 +- private->uid.vendor, private->uid.serial,
1896 +- private->uid.ssid, rc, dev_name(&device->cdev->dev));
1897 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "PSF-SSC for SSID %04x "
1898 ++ "returned rc=%d", private->uid.ssid, rc);
1899 + /* RE-Read Configuration Data */
1900 + return dasd_eckd_read_conf(device);
1901 + }
1902 +@@ -1123,9 +1119,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
1903 + if (private->uid.type == UA_BASE_DEVICE) {
1904 + block = dasd_alloc_block();
1905 + if (IS_ERR(block)) {
1906 +- DBF_EVENT(DBF_WARNING, "could not allocate dasd "
1907 +- "block structure for device: %s",
1908 +- dev_name(&device->cdev->dev));
1909 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s",
1910 ++ "could not allocate dasd "
1911 ++ "block structure");
1912 + rc = PTR_ERR(block);
1913 + goto out_err1;
1914 + }
1915 +@@ -1153,9 +1149,8 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
1916 + rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC,
1917 + &private->rdc_data, 64);
1918 + if (rc) {
1919 +- DBF_EVENT(DBF_WARNING,
1920 +- "Read device characteristics failed, rc=%d for "
1921 +- "device: %s", rc, dev_name(&device->cdev->dev));
1922 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev,
1923 ++ "Read device characteristic failed, rc=%d", rc);
1924 + goto out_err3;
1925 + }
1926 + /* find the vaild cylinder size */
1927 +@@ -3253,9 +3248,8 @@ int dasd_eckd_restore_device(struct dasd_device *device)
1928 + rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC,
1929 + &temp_rdc_data, 64);
1930 + if (rc) {
1931 +- DBF_EVENT(DBF_WARNING,
1932 +- "Read device characteristics failed, rc=%d for "
1933 +- "device: %s", rc, dev_name(&device->cdev->dev));
1934 ++ DBF_EVENT_DEVID(DBF_WARNING, device->cdev,
1935 ++ "Read device characteristic failed, rc=%d", rc);
1936 + goto out_err;
1937 + }
1938 + spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
1939 +diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
1940 +index f245377..227b4e9 100644
1941 +--- a/drivers/s390/block/dasd_fba.c
1942 ++++ b/drivers/s390/block/dasd_fba.c
1943 +@@ -141,9 +141,8 @@ dasd_fba_check_characteristics(struct dasd_device *device)
1944 + }
1945 + block = dasd_alloc_block();
1946 + if (IS_ERR(block)) {
1947 +- DBF_EVENT(DBF_WARNING, "could not allocate dasd block "
1948 +- "structure for device: %s",
1949 +- dev_name(&device->cdev->dev));
1950 ++ DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s", "could not allocate "
1951 ++ "dasd block structure");
1952 + device->private = NULL;
1953 + kfree(private);
1954 + return PTR_ERR(block);
1955 +@@ -155,9 +154,8 @@ dasd_fba_check_characteristics(struct dasd_device *device)
1956 + rc = dasd_generic_read_dev_chars(device, DASD_FBA_MAGIC,
1957 + &private->rdc_data, 32);
1958 + if (rc) {
1959 +- DBF_EVENT(DBF_WARNING, "Read device characteristics returned "
1960 +- "error %d for device: %s",
1961 +- rc, dev_name(&device->cdev->dev));
1962 ++ DBF_EVENT_DEVID(DBF_WARNING, cdev, "Read device "
1963 ++ "characteristics returned error %d", rc);
1964 + device->block = NULL;
1965 + dasd_free_block(block);
1966 + device->private = NULL;
1967 +diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
1968 +index 8afd9fa..b19f309 100644
1969 +--- a/drivers/s390/block/dasd_int.h
1970 ++++ b/drivers/s390/block/dasd_int.h
1971 +@@ -108,6 +108,16 @@ do { \
1972 + d_data); \
1973 + } while(0)
1974 +
1975 ++#define DBF_EVENT_DEVID(d_level, d_cdev, d_str, d_data...) \
1976 ++do { \
1977 ++ struct ccw_dev_id __dev_id; \
1978 ++ ccw_device_get_id(d_cdev, &__dev_id); \
1979 ++ debug_sprintf_event(dasd_debug_area, \
1980 ++ d_level, \
1981 ++ "0.%x.%04x " d_str "\n", \
1982 ++ __dev_id.ssid, __dev_id.devno, d_data); \
1983 ++} while (0)
1984 ++
1985 + #define DBF_EXC(d_level, d_str, d_data...)\
1986 + do { \
1987 + debug_sprintf_exception(dasd_debug_area, \
1988 +diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
1989 +index 807042b..5ed1b82 100644
1990 +--- a/drivers/serial/8250.c
1991 ++++ b/drivers/serial/8250.c
1992 +@@ -83,6 +83,9 @@ static unsigned int skip_txen_test; /* force skip of txen test at init time */
1993 +
1994 + #define PASS_LIMIT 256
1995 +
1996 ++#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
1997 ++
1998 ++
1999 + /*
2000 + * We default to IRQ0 for the "no irq" hack. Some
2001 + * machine types want others as well - they're free
2002 +@@ -1792,7 +1795,7 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
2003 + up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
2004 + spin_unlock_irqrestore(&up->port.lock, flags);
2005 +
2006 +- return lsr & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
2007 ++ return (lsr & BOTH_EMPTY) == BOTH_EMPTY ? TIOCSER_TEMT : 0;
2008 + }
2009 +
2010 + static unsigned int serial8250_get_mctrl(struct uart_port *port)
2011 +@@ -1850,8 +1853,6 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state)
2012 + spin_unlock_irqrestore(&up->port.lock, flags);
2013 + }
2014 +
2015 +-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
2016 +-
2017 + /*
2018 + * Wait for transmitter & holding register to empty
2019 + */
2020 +diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
2021 +index 3222c22..0d490c1 100644
2022 +--- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
2023 ++++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
2024 +@@ -1318,13 +1318,13 @@ extern int ieee80211_encrypt_fragment(
2025 + struct sk_buff *frag,
2026 + int hdr_len);
2027 +
2028 +-extern int ieee80211_xmit(struct sk_buff *skb,
2029 ++extern int ieee80211_rtl_xmit(struct sk_buff *skb,
2030 + struct net_device *dev);
2031 + extern void ieee80211_txb_free(struct ieee80211_txb *);
2032 +
2033 +
2034 + /* ieee80211_rx.c */
2035 +-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2036 ++extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2037 + struct ieee80211_rx_stats *rx_stats);
2038 + extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
2039 + struct ieee80211_hdr_4addr *header,
2040 +@@ -1376,8 +1376,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
2041 + extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
2042 + extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
2043 + extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
2044 +-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
2045 +-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
2046 ++extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
2047 ++extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
2048 + extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
2049 + extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
2050 + extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
2051 +@@ -1385,7 +1385,7 @@ extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct
2052 + extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
2053 + extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
2054 + extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn);
2055 +-extern void ieee80211_start_scan(struct ieee80211_device *ieee);
2056 ++extern void ieee80211_rtl_start_scan(struct ieee80211_device *ieee);
2057 +
2058 + //Add for RF power on power off by lizhaoming 080512
2059 + extern void SendDisassociation(struct ieee80211_device *ieee,
2060 +diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
2061 +index 5e2e79b..7ad305b 100644
2062 +--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
2063 ++++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
2064 +@@ -470,7 +470,7 @@ drop:
2065 + /* All received frames are sent to this function. @skb contains the frame in
2066 + * IEEE 802.11 format, i.e., in the format it was sent over air.
2067 + * This function is called only as a tasklet (software IRQ). */
2068 +-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2069 ++int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2070 + struct ieee80211_rx_stats *rx_stats)
2071 + {
2072 + struct net_device *dev = ieee->dev;
2073 +diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
2074 +index 334e4c7..a2fa9a9 100644
2075 +--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
2076 ++++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
2077 +@@ -689,7 +689,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee)
2078 + }
2079 +
2080 + /* called with ieee->lock held */
2081 +-void ieee80211_start_scan(struct ieee80211_device *ieee)
2082 ++void ieee80211_rtl_start_scan(struct ieee80211_device *ieee)
2083 + {
2084 + if(IS_DOT11D_ENABLE(ieee) )
2085 + {
2086 +@@ -1196,7 +1196,7 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
2087 + }
2088 + }
2089 +
2090 +-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
2091 ++void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
2092 + {
2093 + u8 *c;
2094 + struct sk_buff *skb;
2095 +@@ -1898,7 +1898,7 @@ associate_complete:
2096 +
2097 + ieee80211_associate_step2(ieee);
2098 + }else{
2099 +- ieee80211_auth_challenge(ieee, challenge, chlen);
2100 ++ ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
2101 + }
2102 + }else{
2103 + ieee->softmac_stats.rx_auth_rs_err++;
2104 +@@ -2047,7 +2047,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee)
2105 +
2106 + }
2107 +
2108 +-void ieee80211_wake_queue(struct ieee80211_device *ieee)
2109 ++void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
2110 + {
2111 +
2112 + unsigned long flags;
2113 +@@ -2089,7 +2089,7 @@ exit :
2114 + }
2115 +
2116 +
2117 +-void ieee80211_stop_queue(struct ieee80211_device *ieee)
2118 ++void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
2119 + {
2120 + //unsigned long flags;
2121 + //spin_lock_irqsave(&ieee->lock,flags);
2122 +@@ -2301,7 +2301,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
2123 + //#else
2124 + if (ieee->state == IEEE80211_NOLINK){
2125 + ieee->actscanning = true;
2126 +- ieee80211_start_scan(ieee);
2127 ++ ieee80211_rtl_start_scan(ieee);
2128 + }
2129 + //#endif
2130 + spin_unlock_irqrestore(&ieee->lock, flags);
2131 +@@ -2357,7 +2357,7 @@ void ieee80211_associate_retry_wq(struct work_struct *work)
2132 + if(ieee->state == IEEE80211_NOLINK){
2133 + ieee->beinretry = false;
2134 + ieee->actscanning = true;
2135 +- ieee80211_start_scan(ieee);
2136 ++ ieee80211_rtl_start_scan(ieee);
2137 + }
2138 + //YJ,add,080828, notify os here
2139 + if(ieee->state == IEEE80211_NOLINK)
2140 +diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
2141 +index e2945db..c7996ea 100644
2142 +--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
2143 ++++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
2144 +@@ -305,7 +305,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network)
2145 + }
2146 +
2147 + /* SKBs are added to the ieee->tx_queue. */
2148 +-int ieee80211_xmit(struct sk_buff *skb,
2149 ++int ieee80211_rtl_xmit(struct sk_buff *skb,
2150 + struct net_device *dev)
2151 + {
2152 + struct ieee80211_device *ieee = netdev_priv(dev);
2153 +diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
2154 +index 53e654d..3f19143 100644
2155 +--- a/drivers/staging/rtl8187se/r8180_core.c
2156 ++++ b/drivers/staging/rtl8187se/r8180_core.c
2157 +@@ -1830,7 +1830,7 @@ void rtl8180_rx(struct net_device *dev)
2158 + if(priv->rx_skb->len > 4)
2159 + skb_trim(priv->rx_skb,priv->rx_skb->len-4);
2160 + #ifndef RX_DONT_PASS_UL
2161 +- if(!ieee80211_rx(priv->ieee80211,
2162 ++ if(!ieee80211_rtl_rx(priv->ieee80211,
2163 + priv->rx_skb, &stats)){
2164 + #endif // RX_DONT_PASS_UL
2165 +
2166 +@@ -1936,11 +1936,11 @@ rate)
2167 + if (!check_nic_enought_desc(dev, priority)){
2168 + DMESGW("Error: no descriptor left by previous TX (avail %d) ",
2169 + get_curr_tx_free_desc(dev, priority));
2170 +- ieee80211_stop_queue(priv->ieee80211);
2171 ++ ieee80211_rtl_stop_queue(priv->ieee80211);
2172 + }
2173 + rtl8180_tx(dev, skb->data, skb->len, priority, morefrag,0,rate);
2174 + if (!check_nic_enought_desc(dev, priority))
2175 +- ieee80211_stop_queue(priv->ieee80211);
2176 ++ ieee80211_rtl_stop_queue(priv->ieee80211);
2177 +
2178 + spin_unlock_irqrestore(&priv->tx_lock,flags);
2179 + }
2180 +@@ -3846,7 +3846,7 @@ static const struct net_device_ops rtl8180_netdev_ops = {
2181 + .ndo_set_mac_address = r8180_set_mac_adr,
2182 + .ndo_validate_addr = eth_validate_addr,
2183 + .ndo_change_mtu = eth_change_mtu,
2184 +- .ndo_start_xmit = ieee80211_xmit,
2185 ++ .ndo_start_xmit = ieee80211_rtl_xmit,
2186 + };
2187 +
2188 + static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
2189 +@@ -4066,7 +4066,7 @@ void rtl8180_try_wake_queue(struct net_device *dev, int pri)
2190 + spin_unlock_irqrestore(&priv->tx_lock,flags);
2191 +
2192 + if(enough_desc)
2193 +- ieee80211_wake_queue(priv->ieee80211);
2194 ++ ieee80211_rtl_wake_queue(priv->ieee80211);
2195 + }
2196 +
2197 + void rtl8180_tx_isr(struct net_device *dev, int pri,short error)
2198 +diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c
2199 +index 766892e..637ee8e 100644
2200 +--- a/drivers/staging/rtl8187se/r8180_wx.c
2201 ++++ b/drivers/staging/rtl8187se/r8180_wx.c
2202 +@@ -377,7 +377,7 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
2203 + // queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq);
2204 + //printk("start scan============================>\n");
2205 + ieee80211_softmac_ips_scan_syncro(priv->ieee80211);
2206 +-//ieee80211_start_scan(priv->ieee80211);
2207 ++//ieee80211_rtl_start_scan(priv->ieee80211);
2208 + /* intentionally forget to up sem */
2209 + // up(&priv->ieee80211->wx_sem);
2210 + ret = 0;
2211 +diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
2212 +index 181f78c..24120db 100644
2213 +--- a/drivers/usb/core/devio.c
2214 ++++ b/drivers/usb/core/devio.c
2215 +@@ -1312,9 +1312,9 @@ static int processcompl(struct async *as, void __user * __user *arg)
2216 + void __user *addr = as->userurb;
2217 + unsigned int i;
2218 +
2219 +- if (as->userbuffer)
2220 ++ if (as->userbuffer && urb->actual_length)
2221 + if (copy_to_user(as->userbuffer, urb->transfer_buffer,
2222 +- urb->transfer_buffer_length))
2223 ++ urb->actual_length))
2224 + goto err_out;
2225 + if (put_user(as->status, &userurb->status))
2226 + goto err_out;
2227 +@@ -1334,14 +1334,11 @@ static int processcompl(struct async *as, void __user * __user *arg)
2228 + }
2229 + }
2230 +
2231 +- free_async(as);
2232 +-
2233 + if (put_user(addr, (void __user * __user *)arg))
2234 + return -EFAULT;
2235 + return 0;
2236 +
2237 + err_out:
2238 +- free_async(as);
2239 + return -EFAULT;
2240 + }
2241 +
2242 +@@ -1371,8 +1368,11 @@ static struct async *reap_as(struct dev_state *ps)
2243 + static int proc_reapurb(struct dev_state *ps, void __user *arg)
2244 + {
2245 + struct async *as = reap_as(ps);
2246 +- if (as)
2247 +- return processcompl(as, (void __user * __user *)arg);
2248 ++ if (as) {
2249 ++ int retval = processcompl(as, (void __user * __user *)arg);
2250 ++ free_async(as);
2251 ++ return retval;
2252 ++ }
2253 + if (signal_pending(current))
2254 + return -EINTR;
2255 + return -EIO;
2256 +@@ -1380,11 +1380,16 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg)
2257 +
2258 + static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)
2259 + {
2260 ++ int retval;
2261 + struct async *as;
2262 +
2263 +- if (!(as = async_getcompleted(ps)))
2264 +- return -EAGAIN;
2265 +- return processcompl(as, (void __user * __user *)arg);
2266 ++ as = async_getcompleted(ps);
2267 ++ retval = -EAGAIN;
2268 ++ if (as) {
2269 ++ retval = processcompl(as, (void __user * __user *)arg);
2270 ++ free_async(as);
2271 ++ }
2272 ++ return retval;
2273 + }
2274 +
2275 + #ifdef CONFIG_COMPAT
2276 +@@ -1435,9 +1440,9 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
2277 + void __user *addr = as->userurb;
2278 + unsigned int i;
2279 +
2280 +- if (as->userbuffer)
2281 ++ if (as->userbuffer && urb->actual_length)
2282 + if (copy_to_user(as->userbuffer, urb->transfer_buffer,
2283 +- urb->transfer_buffer_length))
2284 ++ urb->actual_length))
2285 + return -EFAULT;
2286 + if (put_user(as->status, &userurb->status))
2287 + return -EFAULT;
2288 +@@ -1457,7 +1462,6 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
2289 + }
2290 + }
2291 +
2292 +- free_async(as);
2293 + if (put_user(ptr_to_compat(addr), (u32 __user *)arg))
2294 + return -EFAULT;
2295 + return 0;
2296 +@@ -1466,8 +1470,11 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
2297 + static int proc_reapurb_compat(struct dev_state *ps, void __user *arg)
2298 + {
2299 + struct async *as = reap_as(ps);
2300 +- if (as)
2301 +- return processcompl_compat(as, (void __user * __user *)arg);
2302 ++ if (as) {
2303 ++ int retval = processcompl_compat(as, (void __user * __user *)arg);
2304 ++ free_async(as);
2305 ++ return retval;
2306 ++ }
2307 + if (signal_pending(current))
2308 + return -EINTR;
2309 + return -EIO;
2310 +@@ -1475,11 +1482,16 @@ static int proc_reapurb_compat(struct dev_state *ps, void __user *arg)
2311 +
2312 + static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
2313 + {
2314 ++ int retval;
2315 + struct async *as;
2316 +
2317 +- if (!(as = async_getcompleted(ps)))
2318 +- return -EAGAIN;
2319 +- return processcompl_compat(as, (void __user * __user *)arg);
2320 ++ retval = -EAGAIN;
2321 ++ as = async_getcompleted(ps);
2322 ++ if (as) {
2323 ++ retval = processcompl_compat(as, (void __user * __user *)arg);
2324 ++ free_async(as);
2325 ++ }
2326 ++ return retval;
2327 + }
2328 +
2329 + #endif
2330 +diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
2331 +index 5b56f53..9260c74 100644
2332 +--- a/drivers/usb/host/r8a66597-hcd.c
2333 ++++ b/drivers/usb/host/r8a66597-hcd.c
2334 +@@ -35,7 +35,9 @@
2335 + #include <linux/usb.h>
2336 + #include <linux/platform_device.h>
2337 + #include <linux/io.h>
2338 ++#include <linux/mm.h>
2339 + #include <linux/irq.h>
2340 ++#include <asm/cacheflush.h>
2341 +
2342 + #include "../core/hcd.h"
2343 + #include "r8a66597.h"
2344 +@@ -820,6 +822,26 @@ static void enable_r8a66597_pipe(struct r8a66597 *r8a66597, struct urb *urb,
2345 + enable_r8a66597_pipe_dma(r8a66597, dev, pipe, urb);
2346 + }
2347 +
2348 ++static void r8a66597_urb_done(struct r8a66597 *r8a66597, struct urb *urb,
2349 ++ int status)
2350 ++__releases(r8a66597->lock)
2351 ++__acquires(r8a66597->lock)
2352 ++{
2353 ++ if (usb_pipein(urb->pipe) && usb_pipetype(urb->pipe) != PIPE_CONTROL) {
2354 ++ void *ptr;
2355 ++
2356 ++ for (ptr = urb->transfer_buffer;
2357 ++ ptr < urb->transfer_buffer + urb->transfer_buffer_length;
2358 ++ ptr += PAGE_SIZE)
2359 ++ flush_dcache_page(virt_to_page(ptr));
2360 ++ }
2361 ++
2362 ++ usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597), urb);
2363 ++ spin_unlock(&r8a66597->lock);
2364 ++ usb_hcd_giveback_urb(r8a66597_to_hcd(r8a66597), urb, status);
2365 ++ spin_lock(&r8a66597->lock);
2366 ++}
2367 ++
2368 + /* this function must be called with interrupt disabled */
2369 + static void force_dequeue(struct r8a66597 *r8a66597, u16 pipenum, u16 address)
2370 + {
2371 +@@ -840,15 +862,9 @@ static void force_dequeue(struct r8a66597 *r8a66597, u16 pipenum, u16 address)
2372 + list_del(&td->queue);
2373 + kfree(td);
2374 +
2375 +- if (urb) {
2376 +- usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597),
2377 +- urb);
2378 ++ if (urb)
2379 ++ r8a66597_urb_done(r8a66597, urb, -ENODEV);
2380 +
2381 +- spin_unlock(&r8a66597->lock);
2382 +- usb_hcd_giveback_urb(r8a66597_to_hcd(r8a66597), urb,
2383 +- -ENODEV);
2384 +- spin_lock(&r8a66597->lock);
2385 +- }
2386 + break;
2387 + }
2388 + }
2389 +@@ -1285,10 +1301,7 @@ __releases(r8a66597->lock) __acquires(r8a66597->lock)
2390 + if (usb_pipeisoc(urb->pipe))
2391 + urb->start_frame = r8a66597_get_frame(hcd);
2392 +
2393 +- usb_hcd_unlink_urb_from_ep(r8a66597_to_hcd(r8a66597), urb);
2394 +- spin_unlock(&r8a66597->lock);
2395 +- usb_hcd_giveback_urb(hcd, urb, status);
2396 +- spin_lock(&r8a66597->lock);
2397 ++ r8a66597_urb_done(r8a66597, urb, status);
2398 + }
2399 +
2400 + if (restart) {
2401 +diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
2402 +index 33baf27..34ddda8 100644
2403 +--- a/fs/befs/linuxvfs.c
2404 ++++ b/fs/befs/linuxvfs.c
2405 +@@ -873,6 +873,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
2406 + brelse(bh);
2407 +
2408 + unacquire_priv_sbp:
2409 ++ kfree(befs_sb->mount_opts.iocharset);
2410 + kfree(sb->s_fs_info);
2411 +
2412 + unacquire_none:
2413 +diff --git a/fs/block_dev.c b/fs/block_dev.c
2414 +index 8bed055..34e2d20 100644
2415 +--- a/fs/block_dev.c
2416 ++++ b/fs/block_dev.c
2417 +@@ -246,7 +246,8 @@ struct super_block *freeze_bdev(struct block_device *bdev)
2418 + if (!sb)
2419 + goto out;
2420 + if (sb->s_flags & MS_RDONLY) {
2421 +- deactivate_locked_super(sb);
2422 ++ sb->s_frozen = SB_FREEZE_TRANS;
2423 ++ up_write(&sb->s_umount);
2424 + mutex_unlock(&bdev->bd_fsfreeze_mutex);
2425 + return sb;
2426 + }
2427 +@@ -307,7 +308,7 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
2428 + BUG_ON(sb->s_bdev != bdev);
2429 + down_write(&sb->s_umount);
2430 + if (sb->s_flags & MS_RDONLY)
2431 +- goto out_deactivate;
2432 ++ goto out_unfrozen;
2433 +
2434 + if (sb->s_op->unfreeze_fs) {
2435 + error = sb->s_op->unfreeze_fs(sb);
2436 +@@ -321,11 +322,11 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
2437 + }
2438 + }
2439 +
2440 ++out_unfrozen:
2441 + sb->s_frozen = SB_UNFROZEN;
2442 + smp_wmb();
2443 + wake_up(&sb->s_wait_unfrozen);
2444 +
2445 +-out_deactivate:
2446 + if (sb)
2447 + deactivate_locked_super(sb);
2448 + out_unlock:
2449 +diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
2450 +index f84062f..f5618f8 100644
2451 +--- a/fs/cifs/readdir.c
2452 ++++ b/fs/cifs/readdir.c
2453 +@@ -666,6 +666,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
2454 + min(len, max_len), nlt,
2455 + cifs_sb->mnt_cifs_flags &
2456 + CIFS_MOUNT_MAP_SPECIAL_CHR);
2457 ++ pqst->len -= nls_nullsize(nlt);
2458 + } else {
2459 + pqst->name = filename;
2460 + pqst->len = len;
2461 +diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
2462 +index 056fed6..728f07e 100644
2463 +--- a/fs/ecryptfs/inode.c
2464 ++++ b/fs/ecryptfs/inode.c
2465 +@@ -971,6 +971,21 @@ out:
2466 + return rc;
2467 + }
2468 +
2469 ++int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
2470 ++ struct kstat *stat)
2471 ++{
2472 ++ struct kstat lower_stat;
2473 ++ int rc;
2474 ++
2475 ++ rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry),
2476 ++ ecryptfs_dentry_to_lower(dentry), &lower_stat);
2477 ++ if (!rc) {
2478 ++ generic_fillattr(dentry->d_inode, stat);
2479 ++ stat->blocks = lower_stat.blocks;
2480 ++ }
2481 ++ return rc;
2482 ++}
2483 ++
2484 + int
2485 + ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
2486 + size_t size, int flags)
2487 +@@ -1100,6 +1115,7 @@ const struct inode_operations ecryptfs_dir_iops = {
2488 + const struct inode_operations ecryptfs_main_iops = {
2489 + .permission = ecryptfs_permission,
2490 + .setattr = ecryptfs_setattr,
2491 ++ .getattr = ecryptfs_getattr,
2492 + .setxattr = ecryptfs_setxattr,
2493 + .getxattr = ecryptfs_getxattr,
2494 + .listxattr = ecryptfs_listxattr,
2495 +diff --git a/fs/exec.c b/fs/exec.c
2496 +index 7fa4efd..da36c20 100644
2497 +--- a/fs/exec.c
2498 ++++ b/fs/exec.c
2499 +@@ -572,6 +572,9 @@ int setup_arg_pages(struct linux_binprm *bprm,
2500 + struct vm_area_struct *prev = NULL;
2501 + unsigned long vm_flags;
2502 + unsigned long stack_base;
2503 ++ unsigned long stack_size;
2504 ++ unsigned long stack_expand;
2505 ++ unsigned long rlim_stack;
2506 +
2507 + #ifdef CONFIG_STACK_GROWSUP
2508 + /* Limit stack size to 1GB */
2509 +@@ -628,10 +631,24 @@ int setup_arg_pages(struct linux_binprm *bprm,
2510 + goto out_unlock;
2511 + }
2512 +
2513 ++ stack_expand = EXTRA_STACK_VM_PAGES * PAGE_SIZE;
2514 ++ stack_size = vma->vm_end - vma->vm_start;
2515 ++ /*
2516 ++ * Align this down to a page boundary as expand_stack
2517 ++ * will align it up.
2518 ++ */
2519 ++ rlim_stack = rlimit(RLIMIT_STACK) & PAGE_MASK;
2520 ++ rlim_stack = min(rlim_stack, stack_size);
2521 + #ifdef CONFIG_STACK_GROWSUP
2522 +- stack_base = vma->vm_end + EXTRA_STACK_VM_PAGES * PAGE_SIZE;
2523 ++ if (stack_size + stack_expand > rlim_stack)
2524 ++ stack_base = vma->vm_start + rlim_stack;
2525 ++ else
2526 ++ stack_base = vma->vm_end + stack_expand;
2527 + #else
2528 +- stack_base = vma->vm_start - EXTRA_STACK_VM_PAGES * PAGE_SIZE;
2529 ++ if (stack_size + stack_expand > rlim_stack)
2530 ++ stack_base = vma->vm_end - rlim_stack;
2531 ++ else
2532 ++ stack_base = vma->vm_start - stack_expand;
2533 + #endif
2534 + ret = expand_stack(vma, stack_base);
2535 + if (ret)
2536 +diff --git a/fs/fcntl.c b/fs/fcntl.c
2537 +index 5ef953e..97e01dc 100644
2538 +--- a/fs/fcntl.c
2539 ++++ b/fs/fcntl.c
2540 +@@ -199,9 +199,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
2541 + static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
2542 + int force)
2543 + {
2544 +- unsigned long flags;
2545 +-
2546 +- write_lock_irqsave(&filp->f_owner.lock, flags);
2547 ++ write_lock_irq(&filp->f_owner.lock);
2548 + if (force || !filp->f_owner.pid) {
2549 + put_pid(filp->f_owner.pid);
2550 + filp->f_owner.pid = get_pid(pid);
2551 +@@ -213,7 +211,7 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
2552 + filp->f_owner.euid = cred->euid;
2553 + }
2554 + }
2555 +- write_unlock_irqrestore(&filp->f_owner.lock, flags);
2556 ++ write_unlock_irq(&filp->f_owner.lock);
2557 + }
2558 +
2559 + int __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
2560 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
2561 +index e1d415e..0d28982 100644
2562 +--- a/fs/nfs/direct.c
2563 ++++ b/fs/nfs/direct.c
2564 +@@ -342,6 +342,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
2565 + data->res.fattr = &data->fattr;
2566 + data->res.eof = 0;
2567 + data->res.count = bytes;
2568 ++ nfs_fattr_init(&data->fattr);
2569 + msg.rpc_argp = &data->args;
2570 + msg.rpc_resp = &data->res;
2571 +
2572 +@@ -575,6 +576,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
2573 + data->res.count = 0;
2574 + data->res.fattr = &data->fattr;
2575 + data->res.verf = &data->verf;
2576 ++ nfs_fattr_init(&data->fattr);
2577 +
2578 + NFS_PROTO(data->inode)->commit_setup(data, &msg);
2579 +
2580 +@@ -766,6 +768,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
2581 + data->res.fattr = &data->fattr;
2582 + data->res.count = bytes;
2583 + data->res.verf = &data->verf;
2584 ++ nfs_fattr_init(&data->fattr);
2585 +
2586 + task_setup_data.task = &data->task;
2587 + task_setup_data.callback_data = data;
2588 +diff --git a/fs/nfs/file.c b/fs/nfs/file.c
2589 +index f5fdd39..393d40f 100644
2590 +--- a/fs/nfs/file.c
2591 ++++ b/fs/nfs/file.c
2592 +@@ -486,6 +486,8 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
2593 + {
2594 + dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
2595 +
2596 ++ if (gfp & __GFP_WAIT)
2597 ++ nfs_wb_page(page->mapping->host, page);
2598 + /* If PagePrivate() is set, then the page is not freeable */
2599 + if (PagePrivate(page))
2600 + return 0;
2601 +diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
2602 +index fa58800..237874f 100644
2603 +--- a/fs/nfs/fscache.c
2604 ++++ b/fs/nfs/fscache.c
2605 +@@ -354,12 +354,11 @@ void nfs_fscache_reset_inode_cookie(struct inode *inode)
2606 + */
2607 + int nfs_fscache_release_page(struct page *page, gfp_t gfp)
2608 + {
2609 +- struct nfs_inode *nfsi = NFS_I(page->mapping->host);
2610 +- struct fscache_cookie *cookie = nfsi->fscache;
2611 +-
2612 +- BUG_ON(!cookie);
2613 +-
2614 + if (PageFsCache(page)) {
2615 ++ struct nfs_inode *nfsi = NFS_I(page->mapping->host);
2616 ++ struct fscache_cookie *cookie = nfsi->fscache;
2617 ++
2618 ++ BUG_ON(!cookie);
2619 + dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n",
2620 + cookie, page, nfsi);
2621 +
2622 +diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
2623 +index 0adefc4..59047f8 100644
2624 +--- a/fs/nfs/mount_clnt.c
2625 ++++ b/fs/nfs/mount_clnt.c
2626 +@@ -120,7 +120,7 @@ static struct {
2627 + { .status = MNT3ERR_INVAL, .errno = -EINVAL, },
2628 + { .status = MNT3ERR_NAMETOOLONG, .errno = -ENAMETOOLONG, },
2629 + { .status = MNT3ERR_NOTSUPP, .errno = -ENOTSUPP, },
2630 +- { .status = MNT3ERR_SERVERFAULT, .errno = -ESERVERFAULT, },
2631 ++ { .status = MNT3ERR_SERVERFAULT, .errno = -EREMOTEIO, },
2632 + };
2633 +
2634 + struct mountres {
2635 +diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
2636 +index 5e078b2..7bc2da8 100644
2637 +--- a/fs/nfs/nfs2xdr.c
2638 ++++ b/fs/nfs/nfs2xdr.c
2639 +@@ -699,7 +699,7 @@ static struct {
2640 + { NFSERR_BAD_COOKIE, -EBADCOOKIE },
2641 + { NFSERR_NOTSUPP, -ENOTSUPP },
2642 + { NFSERR_TOOSMALL, -ETOOSMALL },
2643 +- { NFSERR_SERVERFAULT, -ESERVERFAULT },
2644 ++ { NFSERR_SERVERFAULT, -EREMOTEIO },
2645 + { NFSERR_BADTYPE, -EBADTYPE },
2646 + { NFSERR_JUKEBOX, -EJUKEBOX },
2647 + { -1, -EIO }
2648 +diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
2649 +index 6ea07a3..b4a6b1a 100644
2650 +--- a/fs/nfs/nfs4_fs.h
2651 ++++ b/fs/nfs/nfs4_fs.h
2652 +@@ -141,6 +141,7 @@ enum {
2653 + NFS_O_RDWR_STATE, /* OPEN stateid has read/write state */
2654 + NFS_STATE_RECLAIM_REBOOT, /* OPEN stateid server rebooted */
2655 + NFS_STATE_RECLAIM_NOGRACE, /* OPEN stateid needs to recover state */
2656 ++ NFS_STATE_POSIX_LOCKS, /* Posix locks are supported */
2657 + };
2658 +
2659 + struct nfs4_state {
2660 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2661 +index 741a562..6c20059 100644
2662 +--- a/fs/nfs/nfs4proc.c
2663 ++++ b/fs/nfs/nfs4proc.c
2664 +@@ -1573,6 +1573,8 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, in
2665 + status = PTR_ERR(state);
2666 + if (IS_ERR(state))
2667 + goto err_opendata_put;
2668 ++ if ((opendata->o_res.rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) != 0)
2669 ++ set_bit(NFS_STATE_POSIX_LOCKS, &state->flags);
2670 + nfs4_opendata_put(opendata);
2671 + nfs4_put_state_owner(sp);
2672 + *res = state;
2673 +@@ -3976,6 +3978,22 @@ static const struct rpc_call_ops nfs4_lock_ops = {
2674 + .rpc_release = nfs4_lock_release,
2675 + };
2676 +
2677 ++static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_state *lsp, int new_lock_owner, int error)
2678 ++{
2679 ++ struct nfs_client *clp = server->nfs_client;
2680 ++ struct nfs4_state *state = lsp->ls_state;
2681 ++
2682 ++ switch (error) {
2683 ++ case -NFS4ERR_ADMIN_REVOKED:
2684 ++ case -NFS4ERR_BAD_STATEID:
2685 ++ case -NFS4ERR_EXPIRED:
2686 ++ if (new_lock_owner != 0 ||
2687 ++ (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0)
2688 ++ nfs4_state_mark_reclaim_nograce(clp, state);
2689 ++ lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED;
2690 ++ };
2691 ++}
2692 ++
2693 + static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int reclaim)
2694 + {
2695 + struct nfs4_lockdata *data;
2696 +@@ -4011,6 +4029,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
2697 + ret = nfs4_wait_for_completion_rpc_task(task);
2698 + if (ret == 0) {
2699 + ret = data->rpc_status;
2700 ++ if (ret)
2701 ++ nfs4_handle_setlk_error(data->server, data->lsp,
2702 ++ data->arg.new_lock_owner, ret);
2703 + } else
2704 + data->cancelled = 1;
2705 + rpc_put_task(task);
2706 +@@ -4060,8 +4081,11 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
2707 + {
2708 + struct nfs_inode *nfsi = NFS_I(state->inode);
2709 + unsigned char fl_flags = request->fl_flags;
2710 +- int status;
2711 ++ int status = -ENOLCK;
2712 +
2713 ++ if ((fl_flags & FL_POSIX) &&
2714 ++ !test_bit(NFS_STATE_POSIX_LOCKS, &state->flags))
2715 ++ goto out;
2716 + /* Is this a delegated open? */
2717 + status = nfs4_set_lock_state(state, request);
2718 + if (status != 0)
2719 +diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
2720 +index 20b4e30..a4cd1b7 100644
2721 +--- a/fs/nfs/nfs4xdr.c
2722 ++++ b/fs/nfs/nfs4xdr.c
2723 +@@ -4554,7 +4554,7 @@ static int decode_sequence(struct xdr_stream *xdr,
2724 + * If the server returns different values for sessionID, slotID or
2725 + * sequence number, the server is looney tunes.
2726 + */
2727 +- status = -ESERVERFAULT;
2728 ++ status = -EREMOTEIO;
2729 +
2730 + if (memcmp(id.data, res->sr_session->sess_id.data,
2731 + NFS4_MAX_SESSIONID_LEN)) {
2732 +@@ -5678,7 +5678,7 @@ static struct {
2733 + { NFS4ERR_BAD_COOKIE, -EBADCOOKIE },
2734 + { NFS4ERR_NOTSUPP, -ENOTSUPP },
2735 + { NFS4ERR_TOOSMALL, -ETOOSMALL },
2736 +- { NFS4ERR_SERVERFAULT, -ESERVERFAULT },
2737 ++ { NFS4ERR_SERVERFAULT, -EREMOTEIO },
2738 + { NFS4ERR_BADTYPE, -EBADTYPE },
2739 + { NFS4ERR_LOCKED, -EAGAIN },
2740 + { NFS4ERR_SYMLINK, -ELOOP },
2741 +@@ -5705,7 +5705,7 @@ nfs4_stat_to_errno(int stat)
2742 + }
2743 + if (stat <= 10000 || stat > 10100) {
2744 + /* The server is looney tunes. */
2745 +- return -ESERVERFAULT;
2746 ++ return -EREMOTEIO;
2747 + }
2748 + /* If we cannot translate the error, the recovery routines should
2749 + * handle it.
2750 +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
2751 +index e297593..a12c45b 100644
2752 +--- a/fs/nfs/pagelist.c
2753 ++++ b/fs/nfs/pagelist.c
2754 +@@ -176,6 +176,12 @@ void nfs_release_request(struct nfs_page *req)
2755 + kref_put(&req->wb_kref, nfs_free_request);
2756 + }
2757 +
2758 ++static int nfs_wait_bit_uninterruptible(void *word)
2759 ++{
2760 ++ io_schedule();
2761 ++ return 0;
2762 ++}
2763 ++
2764 + /**
2765 + * nfs_wait_on_request - Wait for a request to complete.
2766 + * @req: request to wait upon.
2767 +@@ -186,14 +192,9 @@ void nfs_release_request(struct nfs_page *req)
2768 + int
2769 + nfs_wait_on_request(struct nfs_page *req)
2770 + {
2771 +- int ret = 0;
2772 +-
2773 +- if (!test_bit(PG_BUSY, &req->wb_flags))
2774 +- goto out;
2775 +- ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY,
2776 +- nfs_wait_bit_killable, TASK_KILLABLE);
2777 +-out:
2778 +- return ret;
2779 ++ return wait_on_bit(&req->wb_flags, PG_BUSY,
2780 ++ nfs_wait_bit_uninterruptible,
2781 ++ TASK_UNINTERRUPTIBLE);
2782 + }
2783 +
2784 + /**
2785 +diff --git a/fs/nfs/super.c b/fs/nfs/super.c
2786 +index e71f0fd..4bf23f6 100644
2787 +--- a/fs/nfs/super.c
2788 ++++ b/fs/nfs/super.c
2789 +@@ -241,6 +241,7 @@ static int nfs_show_stats(struct seq_file *, struct vfsmount *);
2790 + static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
2791 + static int nfs_xdev_get_sb(struct file_system_type *fs_type,
2792 + int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
2793 ++static void nfs_put_super(struct super_block *);
2794 + static void nfs_kill_super(struct super_block *);
2795 + static int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
2796 +
2797 +@@ -264,6 +265,7 @@ static const struct super_operations nfs_sops = {
2798 + .alloc_inode = nfs_alloc_inode,
2799 + .destroy_inode = nfs_destroy_inode,
2800 + .write_inode = nfs_write_inode,
2801 ++ .put_super = nfs_put_super,
2802 + .statfs = nfs_statfs,
2803 + .clear_inode = nfs_clear_inode,
2804 + .umount_begin = nfs_umount_begin,
2805 +@@ -333,6 +335,7 @@ static const struct super_operations nfs4_sops = {
2806 + .alloc_inode = nfs_alloc_inode,
2807 + .destroy_inode = nfs_destroy_inode,
2808 + .write_inode = nfs_write_inode,
2809 ++ .put_super = nfs_put_super,
2810 + .statfs = nfs_statfs,
2811 + .clear_inode = nfs4_clear_inode,
2812 + .umount_begin = nfs_umount_begin,
2813 +@@ -2196,6 +2199,17 @@ error_splat_super:
2814 + }
2815 +
2816 + /*
2817 ++ * Ensure that we unregister the bdi before kill_anon_super
2818 ++ * releases the device name
2819 ++ */
2820 ++static void nfs_put_super(struct super_block *s)
2821 ++{
2822 ++ struct nfs_server *server = NFS_SB(s);
2823 ++
2824 ++ bdi_unregister(&server->backing_dev_info);
2825 ++}
2826 ++
2827 ++/*
2828 + * Destroy an NFS2/3 superblock
2829 + */
2830 + static void nfs_kill_super(struct super_block *s)
2831 +@@ -2203,7 +2217,6 @@ static void nfs_kill_super(struct super_block *s)
2832 + struct nfs_server *server = NFS_SB(s);
2833 +
2834 + kill_anon_super(s);
2835 +- bdi_unregister(&server->backing_dev_info);
2836 + nfs_fscache_release_super_cookie(s);
2837 + nfs_free_server(server);
2838 + }
2839 +diff --git a/fs/nfs/write.c b/fs/nfs/write.c
2840 +index 6fc3776..cf6c06f 100644
2841 +--- a/fs/nfs/write.c
2842 ++++ b/fs/nfs/write.c
2843 +@@ -1542,6 +1542,7 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
2844 + break;
2845 + }
2846 + ret = nfs_wait_on_request(req);
2847 ++ nfs_release_request(req);
2848 + if (ret < 0)
2849 + goto out;
2850 + }
2851 +diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
2852 +index e28cecf..02a022a 100644
2853 +--- a/fs/sysfs/inode.c
2854 ++++ b/fs/sysfs/inode.c
2855 +@@ -94,30 +94,29 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
2856 + if (!sd_attrs)
2857 + return -ENOMEM;
2858 + sd->s_iattr = sd_attrs;
2859 +- } else {
2860 +- /* attributes were changed at least once in past */
2861 +- iattrs = &sd_attrs->ia_iattr;
2862 +-
2863 +- if (ia_valid & ATTR_UID)
2864 +- iattrs->ia_uid = iattr->ia_uid;
2865 +- if (ia_valid & ATTR_GID)
2866 +- iattrs->ia_gid = iattr->ia_gid;
2867 +- if (ia_valid & ATTR_ATIME)
2868 +- iattrs->ia_atime = timespec_trunc(iattr->ia_atime,
2869 +- inode->i_sb->s_time_gran);
2870 +- if (ia_valid & ATTR_MTIME)
2871 +- iattrs->ia_mtime = timespec_trunc(iattr->ia_mtime,
2872 +- inode->i_sb->s_time_gran);
2873 +- if (ia_valid & ATTR_CTIME)
2874 +- iattrs->ia_ctime = timespec_trunc(iattr->ia_ctime,
2875 +- inode->i_sb->s_time_gran);
2876 +- if (ia_valid & ATTR_MODE) {
2877 +- umode_t mode = iattr->ia_mode;
2878 +-
2879 +- if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
2880 +- mode &= ~S_ISGID;
2881 +- iattrs->ia_mode = sd->s_mode = mode;
2882 +- }
2883 ++ }
2884 ++ /* attributes were changed at least once in past */
2885 ++ iattrs = &sd_attrs->ia_iattr;
2886 ++
2887 ++ if (ia_valid & ATTR_UID)
2888 ++ iattrs->ia_uid = iattr->ia_uid;
2889 ++ if (ia_valid & ATTR_GID)
2890 ++ iattrs->ia_gid = iattr->ia_gid;
2891 ++ if (ia_valid & ATTR_ATIME)
2892 ++ iattrs->ia_atime = timespec_trunc(iattr->ia_atime,
2893 ++ inode->i_sb->s_time_gran);
2894 ++ if (ia_valid & ATTR_MTIME)
2895 ++ iattrs->ia_mtime = timespec_trunc(iattr->ia_mtime,
2896 ++ inode->i_sb->s_time_gran);
2897 ++ if (ia_valid & ATTR_CTIME)
2898 ++ iattrs->ia_ctime = timespec_trunc(iattr->ia_ctime,
2899 ++ inode->i_sb->s_time_gran);
2900 ++ if (ia_valid & ATTR_MODE) {
2901 ++ umode_t mode = iattr->ia_mode;
2902 ++
2903 ++ if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
2904 ++ mode &= ~S_ISGID;
2905 ++ iattrs->ia_mode = sd->s_mode = mode;
2906 + }
2907 + return error;
2908 + }
2909 +diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
2910 +index 26641e9..3933691 100644
2911 +--- a/include/drm/drm_os_linux.h
2912 ++++ b/include/drm/drm_os_linux.h
2913 +@@ -123,5 +123,5 @@ do { \
2914 + remove_wait_queue(&(queue), &entry); \
2915 + } while (0)
2916 +
2917 +-#define DRM_WAKEUP( queue ) wake_up_interruptible( queue )
2918 ++#define DRM_WAKEUP( queue ) wake_up( queue )
2919 + #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue )
2920 +diff --git a/include/linux/sched.h b/include/linux/sched.h
2921 +index d3dce7d..e48311e 100644
2922 +--- a/include/linux/sched.h
2923 ++++ b/include/linux/sched.h
2924 +@@ -2583,6 +2583,28 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2925 +
2926 + #define TASK_STATE_TO_CHAR_STR "RSDTtZX"
2927 +
2928 ++static inline unsigned long task_rlimit(const struct task_struct *tsk,
2929 ++ unsigned int limit)
2930 ++{
2931 ++ return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur);
2932 ++}
2933 ++
2934 ++static inline unsigned long task_rlimit_max(const struct task_struct *tsk,
2935 ++ unsigned int limit)
2936 ++{
2937 ++ return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max);
2938 ++}
2939 ++
2940 ++static inline unsigned long rlimit(unsigned int limit)
2941 ++{
2942 ++ return task_rlimit(current, limit);
2943 ++}
2944 ++
2945 ++static inline unsigned long rlimit_max(unsigned int limit)
2946 ++{
2947 ++ return task_rlimit_max(current, limit);
2948 ++}
2949 ++
2950 + #endif /* __KERNEL__ */
2951 +
2952 + #endif
2953 +diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
2954 +index ba1ba0c..63d4498 100644
2955 +--- a/include/net/netns/conntrack.h
2956 ++++ b/include/net/netns/conntrack.h
2957 +@@ -11,6 +11,8 @@ struct nf_conntrack_ecache;
2958 + struct netns_ct {
2959 + atomic_t count;
2960 + unsigned int expect_count;
2961 ++ unsigned int htable_size;
2962 ++ struct kmem_cache *nf_conntrack_cachep;
2963 + struct hlist_nulls_head *hash;
2964 + struct hlist_head *expect_hash;
2965 + struct hlist_nulls_head unconfirmed;
2966 +@@ -28,5 +30,6 @@ struct netns_ct {
2967 + #endif
2968 + int hash_vmalloc;
2969 + int expect_vmalloc;
2970 ++ char *slabname;
2971 + };
2972 + #endif
2973 +diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
2974 +index 2eb3814..9a4b8b7 100644
2975 +--- a/include/net/netns/ipv4.h
2976 ++++ b/include/net/netns/ipv4.h
2977 +@@ -40,6 +40,7 @@ struct netns_ipv4 {
2978 + struct xt_table *iptable_security;
2979 + struct xt_table *nat_table;
2980 + struct hlist_head *nat_bysource;
2981 ++ unsigned int nat_htable_size;
2982 + int nat_vmalloced;
2983 + #endif
2984 +
2985 +diff --git a/kernel/futex.c b/kernel/futex.c
2986 +index 3b74909..1ad4fa6 100644
2987 +--- a/kernel/futex.c
2988 ++++ b/kernel/futex.c
2989 +@@ -530,8 +530,25 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
2990 + return -EINVAL;
2991 +
2992 + WARN_ON(!atomic_read(&pi_state->refcount));
2993 +- WARN_ON(pid && pi_state->owner &&
2994 +- pi_state->owner->pid != pid);
2995 ++
2996 ++ /*
2997 ++ * When pi_state->owner is NULL then the owner died
2998 ++ * and another waiter is on the fly. pi_state->owner
2999 ++ * is fixed up by the task which acquires
3000 ++ * pi_state->rt_mutex.
3001 ++ *
3002 ++ * We do not check for pid == 0 which can happen when
3003 ++ * the owner died and robust_list_exit() cleared the
3004 ++ * TID.
3005 ++ */
3006 ++ if (pid && pi_state->owner) {
3007 ++ /*
3008 ++ * Bail out if user space manipulated the
3009 ++ * futex value.
3010 ++ */
3011 ++ if (pid != task_pid_vnr(pi_state->owner))
3012 ++ return -EINVAL;
3013 ++ }
3014 +
3015 + atomic_inc(&pi_state->refcount);
3016 + *ps = pi_state;
3017 +@@ -758,6 +775,13 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
3018 + if (!pi_state)
3019 + return -EINVAL;
3020 +
3021 ++ /*
3022 ++ * If current does not own the pi_state then the futex is
3023 ++ * inconsistent and user space fiddled with the futex value.
3024 ++ */
3025 ++ if (pi_state->owner != current)
3026 ++ return -EINVAL;
3027 ++
3028 + spin_lock(&pi_state->pi_mutex.wait_lock);
3029 + new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
3030 +
3031 +@@ -1971,7 +1995,7 @@ retry_private:
3032 + /* Unqueue and drop the lock */
3033 + unqueue_me_pi(&q);
3034 +
3035 +- goto out;
3036 ++ goto out_put_key;
3037 +
3038 + out_unlock_put_key:
3039 + queue_unlock(&q, hb);
3040 +diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
3041 +index 66d090e..8b709de 100644
3042 +--- a/kernel/time/timekeeping.c
3043 ++++ b/kernel/time/timekeeping.c
3044 +@@ -845,6 +845,7 @@ void getboottime(struct timespec *ts)
3045 +
3046 + set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
3047 + }
3048 ++EXPORT_SYMBOL_GPL(getboottime);
3049 +
3050 + /**
3051 + * monotonic_to_bootbased - Convert the monotonic time to boot based.
3052 +@@ -854,6 +855,7 @@ void monotonic_to_bootbased(struct timespec *ts)
3053 + {
3054 + *ts = timespec_add_safe(*ts, total_sleep_time);
3055 + }
3056 ++EXPORT_SYMBOL_GPL(monotonic_to_bootbased);
3057 +
3058 + unsigned long get_seconds(void)
3059 + {
3060 +diff --git a/mm/migrate.c b/mm/migrate.c
3061 +index 7dbcb22..0e39f94 100644
3062 +--- a/mm/migrate.c
3063 ++++ b/mm/migrate.c
3064 +@@ -953,6 +953,9 @@ static int do_pages_move(struct mm_struct *mm, struct task_struct *task,
3065 + goto out_pm;
3066 +
3067 + err = -ENODEV;
3068 ++ if (node < 0 || node >= MAX_NUMNODES)
3069 ++ goto out_pm;
3070 ++
3071 + if (!node_state(node, N_HIGH_MEMORY))
3072 + goto out_pm;
3073 +
3074 +diff --git a/net/core/dst.c b/net/core/dst.c
3075 +index 57bc4d5..cb1b348 100644
3076 +--- a/net/core/dst.c
3077 ++++ b/net/core/dst.c
3078 +@@ -17,6 +17,7 @@
3079 + #include <linux/string.h>
3080 + #include <linux/types.h>
3081 + #include <net/net_namespace.h>
3082 ++#include <linux/sched.h>
3083 +
3084 + #include <net/dst.h>
3085 +
3086 +@@ -79,6 +80,7 @@ loop:
3087 + while ((dst = next) != NULL) {
3088 + next = dst->next;
3089 + prefetch(&next->next);
3090 ++ cond_resched();
3091 + if (likely(atomic_read(&dst->__refcnt))) {
3092 + last->next = dst;
3093 + last = dst;
3094 +diff --git a/net/core/pktgen.c b/net/core/pktgen.c
3095 +index 6e79e96..6a993b1 100644
3096 +--- a/net/core/pktgen.c
3097 ++++ b/net/core/pktgen.c
3098 +@@ -3516,6 +3516,7 @@ static int pktgen_thread_worker(void *arg)
3099 + wait_event_interruptible_timeout(t->queue,
3100 + t->control != 0,
3101 + HZ/10);
3102 ++ try_to_freeze();
3103 + continue;
3104 + }
3105 +
3106 +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
3107 +index 27774c9..98442f3 100644
3108 +--- a/net/ipv4/netfilter/arp_tables.c
3109 ++++ b/net/ipv4/netfilter/arp_tables.c
3110 +@@ -925,10 +925,10 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
3111 + if (t && !IS_ERR(t)) {
3112 + struct arpt_getinfo info;
3113 + const struct xt_table_info *private = t->private;
3114 +-
3115 + #ifdef CONFIG_COMPAT
3116 ++ struct xt_table_info tmp;
3117 ++
3118 + if (compat) {
3119 +- struct xt_table_info tmp;
3120 + ret = compat_table_info(private, &tmp);
3121 + xt_compat_flush_offsets(NFPROTO_ARP);
3122 + private = &tmp;
3123 +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
3124 +index cde755d..62aff31 100644
3125 +--- a/net/ipv4/netfilter/ip_tables.c
3126 ++++ b/net/ipv4/netfilter/ip_tables.c
3127 +@@ -1132,10 +1132,10 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
3128 + if (t && !IS_ERR(t)) {
3129 + struct ipt_getinfo info;
3130 + const struct xt_table_info *private = t->private;
3131 +-
3132 + #ifdef CONFIG_COMPAT
3133 ++ struct xt_table_info tmp;
3134 ++
3135 + if (compat) {
3136 +- struct xt_table_info tmp;
3137 + ret = compat_table_info(private, &tmp);
3138 + xt_compat_flush_offsets(AF_INET);
3139 + private = &tmp;
3140 +diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
3141 +index aa95bb8..1032a15 100644
3142 +--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
3143 ++++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
3144 +@@ -213,7 +213,7 @@ static ctl_table ip_ct_sysctl_table[] = {
3145 + {
3146 + .ctl_name = NET_IPV4_NF_CONNTRACK_BUCKETS,
3147 + .procname = "ip_conntrack_buckets",
3148 +- .data = &nf_conntrack_htable_size,
3149 ++ .data = &init_net.ct.htable_size,
3150 + .maxlen = sizeof(unsigned int),
3151 + .mode = 0444,
3152 + .proc_handler = proc_dointvec,
3153 +diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
3154 +index 8668a3d..2fb7b76 100644
3155 +--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
3156 ++++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
3157 +@@ -32,7 +32,7 @@ static struct hlist_nulls_node *ct_get_first(struct seq_file *seq)
3158 + struct hlist_nulls_node *n;
3159 +
3160 + for (st->bucket = 0;
3161 +- st->bucket < nf_conntrack_htable_size;
3162 ++ st->bucket < net->ct.htable_size;
3163 + st->bucket++) {
3164 + n = rcu_dereference(net->ct.hash[st->bucket].first);
3165 + if (!is_a_nulls(n))
3166 +@@ -50,7 +50,7 @@ static struct hlist_nulls_node *ct_get_next(struct seq_file *seq,
3167 + head = rcu_dereference(head->next);
3168 + while (is_a_nulls(head)) {
3169 + if (likely(get_nulls_value(head) == st->bucket)) {
3170 +- if (++st->bucket >= nf_conntrack_htable_size)
3171 ++ if (++st->bucket >= net->ct.htable_size)
3172 + return NULL;
3173 + }
3174 + head = rcu_dereference(net->ct.hash[st->bucket].first);
3175 +diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
3176 +index fe1a644..26066a2 100644
3177 +--- a/net/ipv4/netfilter/nf_nat_core.c
3178 ++++ b/net/ipv4/netfilter/nf_nat_core.c
3179 +@@ -35,9 +35,6 @@ static DEFINE_SPINLOCK(nf_nat_lock);
3180 +
3181 + static struct nf_conntrack_l3proto *l3proto __read_mostly;
3182 +
3183 +-/* Calculated at init based on memory size */
3184 +-static unsigned int nf_nat_htable_size __read_mostly;
3185 +-
3186 + #define MAX_IP_NAT_PROTO 256
3187 + static const struct nf_nat_protocol *nf_nat_protos[MAX_IP_NAT_PROTO]
3188 + __read_mostly;
3189 +@@ -72,7 +69,7 @@ EXPORT_SYMBOL_GPL(nf_nat_proto_put);
3190 +
3191 + /* We keep an extra hash for each conntrack, for fast searching. */
3192 + static inline unsigned int
3193 +-hash_by_src(const struct nf_conntrack_tuple *tuple)
3194 ++hash_by_src(const struct net *net, const struct nf_conntrack_tuple *tuple)
3195 + {
3196 + unsigned int hash;
3197 +
3198 +@@ -80,7 +77,7 @@ hash_by_src(const struct nf_conntrack_tuple *tuple)
3199 + hash = jhash_3words((__force u32)tuple->src.u3.ip,
3200 + (__force u32)tuple->src.u.all,
3201 + tuple->dst.protonum, 0);
3202 +- return ((u64)hash * nf_nat_htable_size) >> 32;
3203 ++ return ((u64)hash * net->ipv4.nat_htable_size) >> 32;
3204 + }
3205 +
3206 + /* Is this tuple already taken? (not by us) */
3207 +@@ -147,7 +144,7 @@ find_appropriate_src(struct net *net,
3208 + struct nf_conntrack_tuple *result,
3209 + const struct nf_nat_range *range)
3210 + {
3211 +- unsigned int h = hash_by_src(tuple);
3212 ++ unsigned int h = hash_by_src(net, tuple);
3213 + const struct nf_conn_nat *nat;
3214 + const struct nf_conn *ct;
3215 + const struct hlist_node *n;
3216 +@@ -330,7 +327,7 @@ nf_nat_setup_info(struct nf_conn *ct,
3217 + if (have_to_hash) {
3218 + unsigned int srchash;
3219 +
3220 +- srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
3221 ++ srchash = hash_by_src(net, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
3222 + spin_lock_bh(&nf_nat_lock);
3223 + /* nf_conntrack_alter_reply might re-allocate exntension aera */
3224 + nat = nfct_nat(ct);
3225 +@@ -679,8 +676,10 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,
3226 +
3227 + static int __net_init nf_nat_net_init(struct net *net)
3228 + {
3229 +- net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size,
3230 +- &net->ipv4.nat_vmalloced, 0);
3231 ++ /* Leave them the same for the moment. */
3232 ++ net->ipv4.nat_htable_size = net->ct.htable_size;
3233 ++ net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&net->ipv4.nat_htable_size,
3234 ++ &net->ipv4.nat_vmalloced, 0);
3235 + if (!net->ipv4.nat_bysource)
3236 + return -ENOMEM;
3237 + return 0;
3238 +@@ -703,7 +702,7 @@ static void __net_exit nf_nat_net_exit(struct net *net)
3239 + nf_ct_iterate_cleanup(net, &clean_nat, NULL);
3240 + synchronize_rcu();
3241 + nf_ct_free_hashtable(net->ipv4.nat_bysource, net->ipv4.nat_vmalloced,
3242 +- nf_nat_htable_size);
3243 ++ net->ipv4.nat_htable_size);
3244 + }
3245 +
3246 + static struct pernet_operations nf_nat_net_ops = {
3247 +@@ -724,9 +723,6 @@ static int __init nf_nat_init(void)
3248 + return ret;
3249 + }
3250 +
3251 +- /* Leave them the same for the moment. */
3252 +- nf_nat_htable_size = nf_conntrack_htable_size;
3253 +-
3254 + ret = register_pernet_subsys(&nf_nat_net_ops);
3255 + if (ret < 0)
3256 + goto cleanup_extend;
3257 +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
3258 +index cc9f8ef..1de56fd 100644
3259 +--- a/net/ipv6/netfilter/ip6_tables.c
3260 ++++ b/net/ipv6/netfilter/ip6_tables.c
3261 +@@ -1164,10 +1164,10 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
3262 + if (t && !IS_ERR(t)) {
3263 + struct ip6t_getinfo info;
3264 + const struct xt_table_info *private = t->private;
3265 +-
3266 + #ifdef CONFIG_COMPAT
3267 ++ struct xt_table_info tmp;
3268 ++
3269 + if (compat) {
3270 +- struct xt_table_info tmp;
3271 + ret = compat_table_info(private, &tmp);
3272 + xt_compat_flush_offsets(AF_INET6);
3273 + private = &tmp;
3274 +diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
3275 +index fbffce9..07600a6 100644
3276 +--- a/net/mac80211/ibss.c
3277 ++++ b/net/mac80211/ibss.c
3278 +@@ -643,7 +643,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
3279 + }
3280 + if (pos[1] != 0 &&
3281 + (pos[1] != ifibss->ssid_len ||
3282 +- !memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) {
3283 ++ memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) {
3284 + /* Ignore ProbeReq for foreign SSID */
3285 + return;
3286 + }
3287 +diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
3288 +index b9168c1..1374179 100644
3289 +--- a/net/netfilter/nf_conntrack_core.c
3290 ++++ b/net/netfilter/nf_conntrack_core.c
3291 +@@ -30,6 +30,7 @@
3292 + #include <linux/netdevice.h>
3293 + #include <linux/socket.h>
3294 + #include <linux/mm.h>
3295 ++#include <linux/nsproxy.h>
3296 + #include <linux/rculist_nulls.h>
3297 +
3298 + #include <net/netfilter/nf_conntrack.h>
3299 +@@ -63,8 +64,6 @@ EXPORT_SYMBOL_GPL(nf_conntrack_max);
3300 + struct nf_conn nf_conntrack_untracked __read_mostly;
3301 + EXPORT_SYMBOL_GPL(nf_conntrack_untracked);
3302 +
3303 +-static struct kmem_cache *nf_conntrack_cachep __read_mostly;
3304 +-
3305 + static int nf_conntrack_hash_rnd_initted;
3306 + static unsigned int nf_conntrack_hash_rnd;
3307 +
3308 +@@ -86,9 +85,10 @@ static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple,
3309 + return ((u64)h * size) >> 32;
3310 + }
3311 +
3312 +-static inline u_int32_t hash_conntrack(const struct nf_conntrack_tuple *tuple)
3313 ++static inline u_int32_t hash_conntrack(const struct net *net,
3314 ++ const struct nf_conntrack_tuple *tuple)
3315 + {
3316 +- return __hash_conntrack(tuple, nf_conntrack_htable_size,
3317 ++ return __hash_conntrack(tuple, net->ct.htable_size,
3318 + nf_conntrack_hash_rnd);
3319 + }
3320 +
3321 +@@ -296,7 +296,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple)
3322 + {
3323 + struct nf_conntrack_tuple_hash *h;
3324 + struct hlist_nulls_node *n;
3325 +- unsigned int hash = hash_conntrack(tuple);
3326 ++ unsigned int hash = hash_conntrack(net, tuple);
3327 +
3328 + /* Disable BHs the entire time since we normally need to disable them
3329 + * at least once for the stats anyway.
3330 +@@ -366,10 +366,11 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
3331 +
3332 + void nf_conntrack_hash_insert(struct nf_conn *ct)
3333 + {
3334 ++ struct net *net = nf_ct_net(ct);
3335 + unsigned int hash, repl_hash;
3336 +
3337 +- hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
3338 +- repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
3339 ++ hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
3340 ++ repl_hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
3341 +
3342 + __nf_conntrack_hash_insert(ct, hash, repl_hash);
3343 + }
3344 +@@ -397,8 +398,8 @@ __nf_conntrack_confirm(struct sk_buff *skb)
3345 + if (CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL)
3346 + return NF_ACCEPT;
3347 +
3348 +- hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
3349 +- repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
3350 ++ hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
3351 ++ repl_hash = hash_conntrack(net, &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
3352 +
3353 + /* We're not in hash table, and we refuse to set up related
3354 + connections for unconfirmed conns. But packet copies and
3355 +@@ -468,7 +469,7 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
3356 + struct net *net = nf_ct_net(ignored_conntrack);
3357 + struct nf_conntrack_tuple_hash *h;
3358 + struct hlist_nulls_node *n;
3359 +- unsigned int hash = hash_conntrack(tuple);
3360 ++ unsigned int hash = hash_conntrack(net, tuple);
3361 +
3362 + /* Disable BHs the entire time since we need to disable them at
3363 + * least once for the stats anyway.
3364 +@@ -503,7 +504,7 @@ static noinline int early_drop(struct net *net, unsigned int hash)
3365 + int dropped = 0;
3366 +
3367 + rcu_read_lock();
3368 +- for (i = 0; i < nf_conntrack_htable_size; i++) {
3369 ++ for (i = 0; i < net->ct.htable_size; i++) {
3370 + hlist_nulls_for_each_entry_rcu(h, n, &net->ct.hash[hash],
3371 + hnnode) {
3372 + tmp = nf_ct_tuplehash_to_ctrack(h);
3373 +@@ -517,7 +518,8 @@ static noinline int early_drop(struct net *net, unsigned int hash)
3374 + ct = NULL;
3375 + if (ct || cnt >= NF_CT_EVICTION_RANGE)
3376 + break;
3377 +- hash = (hash + 1) % nf_conntrack_htable_size;
3378 ++
3379 ++ hash = (hash + 1) % net->ct.htable_size;
3380 + }
3381 + rcu_read_unlock();
3382 +
3383 +@@ -551,7 +553,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
3384 +
3385 + if (nf_conntrack_max &&
3386 + unlikely(atomic_read(&net->ct.count) > nf_conntrack_max)) {
3387 +- unsigned int hash = hash_conntrack(orig);
3388 ++ unsigned int hash = hash_conntrack(net, orig);
3389 + if (!early_drop(net, hash)) {
3390 + atomic_dec(&net->ct.count);
3391 + if (net_ratelimit())
3392 +@@ -566,7 +568,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
3393 + * Do not use kmem_cache_zalloc(), as this cache uses
3394 + * SLAB_DESTROY_BY_RCU.
3395 + */
3396 +- ct = kmem_cache_alloc(nf_conntrack_cachep, gfp);
3397 ++ ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp);
3398 + if (ct == NULL) {
3399 + pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
3400 + atomic_dec(&net->ct.count);
3401 +@@ -605,7 +607,7 @@ void nf_conntrack_free(struct nf_conn *ct)
3402 + nf_ct_ext_destroy(ct);
3403 + atomic_dec(&net->ct.count);
3404 + nf_ct_ext_free(ct);
3405 +- kmem_cache_free(nf_conntrack_cachep, ct);
3406 ++ kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
3407 + }
3408 + EXPORT_SYMBOL_GPL(nf_conntrack_free);
3409 +
3410 +@@ -1008,7 +1010,7 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
3411 + struct hlist_nulls_node *n;
3412 +
3413 + spin_lock_bh(&nf_conntrack_lock);
3414 +- for (; *bucket < nf_conntrack_htable_size; (*bucket)++) {
3415 ++ for (; *bucket < net->ct.htable_size; (*bucket)++) {
3416 + hlist_nulls_for_each_entry(h, n, &net->ct.hash[*bucket], hnnode) {
3417 + ct = nf_ct_tuplehash_to_ctrack(h);
3418 + if (iter(ct, data))
3419 +@@ -1107,9 +1109,12 @@ static void nf_ct_release_dying_list(struct net *net)
3420 +
3421 + static void nf_conntrack_cleanup_init_net(void)
3422 + {
3423 ++ /* wait until all references to nf_conntrack_untracked are dropped */
3424 ++ while (atomic_read(&nf_conntrack_untracked.ct_general.use) > 1)
3425 ++ schedule();
3426 ++
3427 + nf_conntrack_helper_fini();
3428 + nf_conntrack_proto_fini();
3429 +- kmem_cache_destroy(nf_conntrack_cachep);
3430 + }
3431 +
3432 + static void nf_conntrack_cleanup_net(struct net *net)
3433 +@@ -1121,15 +1126,14 @@ static void nf_conntrack_cleanup_net(struct net *net)
3434 + schedule();
3435 + goto i_see_dead_people;
3436 + }
3437 +- /* wait until all references to nf_conntrack_untracked are dropped */
3438 +- while (atomic_read(&nf_conntrack_untracked.ct_general.use) > 1)
3439 +- schedule();
3440 +
3441 + nf_ct_free_hashtable(net->ct.hash, net->ct.hash_vmalloc,
3442 +- nf_conntrack_htable_size);
3443 ++ net->ct.htable_size);
3444 + nf_conntrack_ecache_fini(net);
3445 + nf_conntrack_acct_fini(net);
3446 + nf_conntrack_expect_fini(net);
3447 ++ kmem_cache_destroy(net->ct.nf_conntrack_cachep);
3448 ++ kfree(net->ct.slabname);
3449 + free_percpu(net->ct.stat);
3450 + }
3451 +
3452 +@@ -1184,10 +1188,12 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
3453 + {
3454 + int i, bucket, vmalloced, old_vmalloced;
3455 + unsigned int hashsize, old_size;
3456 +- int rnd;
3457 + struct hlist_nulls_head *hash, *old_hash;
3458 + struct nf_conntrack_tuple_hash *h;
3459 +
3460 ++ if (current->nsproxy->net_ns != &init_net)
3461 ++ return -EOPNOTSUPP;
3462 ++
3463 + /* On boot, we can set this without any fancy locking. */
3464 + if (!nf_conntrack_htable_size)
3465 + return param_set_uint(val, kp);
3466 +@@ -1200,33 +1206,29 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
3467 + if (!hash)
3468 + return -ENOMEM;
3469 +
3470 +- /* We have to rehahs for the new table anyway, so we also can
3471 +- * use a newrandom seed */
3472 +- get_random_bytes(&rnd, sizeof(rnd));
3473 +-
3474 + /* Lookups in the old hash might happen in parallel, which means we
3475 + * might get false negatives during connection lookup. New connections
3476 + * created because of a false negative won't make it into the hash
3477 + * though since that required taking the lock.
3478 + */
3479 + spin_lock_bh(&nf_conntrack_lock);
3480 +- for (i = 0; i < nf_conntrack_htable_size; i++) {
3481 ++ for (i = 0; i < init_net.ct.htable_size; i++) {
3482 + while (!hlist_nulls_empty(&init_net.ct.hash[i])) {
3483 + h = hlist_nulls_entry(init_net.ct.hash[i].first,
3484 + struct nf_conntrack_tuple_hash, hnnode);
3485 + hlist_nulls_del_rcu(&h->hnnode);
3486 +- bucket = __hash_conntrack(&h->tuple, hashsize, rnd);
3487 ++ bucket = __hash_conntrack(&h->tuple, hashsize,
3488 ++ nf_conntrack_hash_rnd);
3489 + hlist_nulls_add_head_rcu(&h->hnnode, &hash[bucket]);
3490 + }
3491 + }
3492 +- old_size = nf_conntrack_htable_size;
3493 ++ old_size = init_net.ct.htable_size;
3494 + old_vmalloced = init_net.ct.hash_vmalloc;
3495 + old_hash = init_net.ct.hash;
3496 +
3497 +- nf_conntrack_htable_size = hashsize;
3498 ++ init_net.ct.htable_size = nf_conntrack_htable_size = hashsize;
3499 + init_net.ct.hash_vmalloc = vmalloced;
3500 + init_net.ct.hash = hash;
3501 +- nf_conntrack_hash_rnd = rnd;
3502 + spin_unlock_bh(&nf_conntrack_lock);
3503 +
3504 + nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
3505 +@@ -1265,15 +1267,6 @@ static int nf_conntrack_init_init_net(void)
3506 + NF_CONNTRACK_VERSION, nf_conntrack_htable_size,
3507 + nf_conntrack_max);
3508 +
3509 +- nf_conntrack_cachep = kmem_cache_create("nf_conntrack",
3510 +- sizeof(struct nf_conn),
3511 +- 0, SLAB_DESTROY_BY_RCU, NULL);
3512 +- if (!nf_conntrack_cachep) {
3513 +- printk(KERN_ERR "Unable to create nf_conn slab cache\n");
3514 +- ret = -ENOMEM;
3515 +- goto err_cache;
3516 +- }
3517 +-
3518 + ret = nf_conntrack_proto_init();
3519 + if (ret < 0)
3520 + goto err_proto;
3521 +@@ -1282,13 +1275,19 @@ static int nf_conntrack_init_init_net(void)
3522 + if (ret < 0)
3523 + goto err_helper;
3524 +
3525 ++ /* Set up fake conntrack: to never be deleted, not in any hashes */
3526 ++#ifdef CONFIG_NET_NS
3527 ++ nf_conntrack_untracked.ct_net = &init_net;
3528 ++#endif
3529 ++ atomic_set(&nf_conntrack_untracked.ct_general.use, 1);
3530 ++ /* - and look it like as a confirmed connection */
3531 ++ set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status);
3532 ++
3533 + return 0;
3534 +
3535 + err_helper:
3536 + nf_conntrack_proto_fini();
3537 + err_proto:
3538 +- kmem_cache_destroy(nf_conntrack_cachep);
3539 +-err_cache:
3540 + return ret;
3541 + }
3542 +
3543 +@@ -1310,7 +1309,24 @@ static int nf_conntrack_init_net(struct net *net)
3544 + ret = -ENOMEM;
3545 + goto err_stat;
3546 + }
3547 +- net->ct.hash = nf_ct_alloc_hashtable(&nf_conntrack_htable_size,
3548 ++
3549 ++ net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%p", net);
3550 ++ if (!net->ct.slabname) {
3551 ++ ret = -ENOMEM;
3552 ++ goto err_slabname;
3553 ++ }
3554 ++
3555 ++ net->ct.nf_conntrack_cachep = kmem_cache_create(net->ct.slabname,
3556 ++ sizeof(struct nf_conn), 0,
3557 ++ SLAB_DESTROY_BY_RCU, NULL);
3558 ++ if (!net->ct.nf_conntrack_cachep) {
3559 ++ printk(KERN_ERR "Unable to create nf_conn slab cache\n");
3560 ++ ret = -ENOMEM;
3561 ++ goto err_cache;
3562 ++ }
3563 ++
3564 ++ net->ct.htable_size = nf_conntrack_htable_size;
3565 ++ net->ct.hash = nf_ct_alloc_hashtable(&net->ct.htable_size,
3566 + &net->ct.hash_vmalloc, 1);
3567 + if (!net->ct.hash) {
3568 + ret = -ENOMEM;
3569 +@@ -1327,15 +1343,6 @@ static int nf_conntrack_init_net(struct net *net)
3570 + if (ret < 0)
3571 + goto err_ecache;
3572 +
3573 +- /* Set up fake conntrack:
3574 +- - to never be deleted, not in any hashes */
3575 +-#ifdef CONFIG_NET_NS
3576 +- nf_conntrack_untracked.ct_net = &init_net;
3577 +-#endif
3578 +- atomic_set(&nf_conntrack_untracked.ct_general.use, 1);
3579 +- /* - and look it like as a confirmed connection */
3580 +- set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status);
3581 +-
3582 + return 0;
3583 +
3584 + err_ecache:
3585 +@@ -1344,8 +1351,12 @@ err_acct:
3586 + nf_conntrack_expect_fini(net);
3587 + err_expect:
3588 + nf_ct_free_hashtable(net->ct.hash, net->ct.hash_vmalloc,
3589 +- nf_conntrack_htable_size);
3590 ++ net->ct.htable_size);
3591 + err_hash:
3592 ++ kmem_cache_destroy(net->ct.nf_conntrack_cachep);
3593 ++err_cache:
3594 ++ kfree(net->ct.slabname);
3595 ++err_slabname:
3596 + free_percpu(net->ct.stat);
3597 + err_stat:
3598 + return ret;
3599 +diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
3600 +index 2032dfe..e73eb04 100644
3601 +--- a/net/netfilter/nf_conntrack_expect.c
3602 ++++ b/net/netfilter/nf_conntrack_expect.c
3603 +@@ -569,7 +569,7 @@ static void exp_proc_remove(struct net *net)
3604 + #endif /* CONFIG_PROC_FS */
3605 + }
3606 +
3607 +-module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0600);
3608 ++module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0400);
3609 +
3610 + int nf_conntrack_expect_init(struct net *net)
3611 + {
3612 +@@ -577,7 +577,7 @@ int nf_conntrack_expect_init(struct net *net)
3613 +
3614 + if (net_eq(net, &init_net)) {
3615 + if (!nf_ct_expect_hsize) {
3616 +- nf_ct_expect_hsize = nf_conntrack_htable_size / 256;
3617 ++ nf_ct_expect_hsize = net->ct.htable_size / 256;
3618 + if (!nf_ct_expect_hsize)
3619 + nf_ct_expect_hsize = 1;
3620 + }
3621 +diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
3622 +index 65c2a7b..4b1a56b 100644
3623 +--- a/net/netfilter/nf_conntrack_helper.c
3624 ++++ b/net/netfilter/nf_conntrack_helper.c
3625 +@@ -192,7 +192,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,
3626 + /* Get rid of expecteds, set helpers to NULL. */
3627 + hlist_nulls_for_each_entry(h, nn, &net->ct.unconfirmed, hnnode)
3628 + unhelp(h, me);
3629 +- for (i = 0; i < nf_conntrack_htable_size; i++) {
3630 ++ for (i = 0; i < net->ct.htable_size; i++) {
3631 + hlist_nulls_for_each_entry(h, nn, &net->ct.hash[i], hnnode)
3632 + unhelp(h, me);
3633 + }
3634 +diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
3635 +index 59d8064..d521718 100644
3636 +--- a/net/netfilter/nf_conntrack_netlink.c
3637 ++++ b/net/netfilter/nf_conntrack_netlink.c
3638 +@@ -594,7 +594,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
3639 +
3640 + rcu_read_lock();
3641 + last = (struct nf_conn *)cb->args[1];
3642 +- for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
3643 ++ for (; cb->args[0] < init_net.ct.htable_size; cb->args[0]++) {
3644 + restart:
3645 + hlist_nulls_for_each_entry_rcu(h, n, &init_net.ct.hash[cb->args[0]],
3646 + hnnode) {
3647 +diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
3648 +index 1935153..1a84bf6 100644
3649 +--- a/net/netfilter/nf_conntrack_standalone.c
3650 ++++ b/net/netfilter/nf_conntrack_standalone.c
3651 +@@ -51,7 +51,7 @@ static struct hlist_nulls_node *ct_get_first(struct seq_file *seq)
3652 + struct hlist_nulls_node *n;
3653 +
3654 + for (st->bucket = 0;
3655 +- st->bucket < nf_conntrack_htable_size;
3656 ++ st->bucket < net->ct.htable_size;
3657 + st->bucket++) {
3658 + n = rcu_dereference(net->ct.hash[st->bucket].first);
3659 + if (!is_a_nulls(n))
3660 +@@ -69,7 +69,7 @@ static struct hlist_nulls_node *ct_get_next(struct seq_file *seq,
3661 + head = rcu_dereference(head->next);
3662 + while (is_a_nulls(head)) {
3663 + if (likely(get_nulls_value(head) == st->bucket)) {
3664 +- if (++st->bucket >= nf_conntrack_htable_size)
3665 ++ if (++st->bucket >= net->ct.htable_size)
3666 + return NULL;
3667 + }
3668 + head = rcu_dereference(net->ct.hash[st->bucket].first);
3669 +@@ -358,7 +358,7 @@ static ctl_table nf_ct_sysctl_table[] = {
3670 + {
3671 + .ctl_name = NET_NF_CONNTRACK_BUCKETS,
3672 + .procname = "nf_conntrack_buckets",
3673 +- .data = &nf_conntrack_htable_size,
3674 ++ .data = &init_net.ct.htable_size,
3675 + .maxlen = sizeof(unsigned int),
3676 + .mode = 0444,
3677 + .proc_handler = proc_dointvec,
3678 +@@ -429,6 +429,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
3679 + goto out_kmemdup;
3680 +
3681 + table[1].data = &net->ct.count;
3682 ++ table[2].data = &net->ct.htable_size;
3683 + table[3].data = &net->ct.sysctl_checksum;
3684 + table[4].data = &net->ct.sysctl_log_invalid;
3685 +
3686 +diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
3687 +index 7545464..cb1f533 100644
3688 +--- a/sound/pci/ctxfi/ctatc.c
3689 ++++ b/sound/pci/ctxfi/ctatc.c
3690 +@@ -166,18 +166,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
3691 +
3692 + static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
3693 + {
3694 +- struct ct_vm *vm;
3695 +- void *kvirt_addr;
3696 +- unsigned long phys_addr;
3697 +-
3698 +- vm = atc->vm;
3699 +- kvirt_addr = vm->get_ptp_virt(vm, index);
3700 +- if (kvirt_addr == NULL)
3701 +- phys_addr = (~0UL);
3702 +- else
3703 +- phys_addr = virt_to_phys(kvirt_addr);
3704 +-
3705 +- return phys_addr;
3706 ++ return atc->vm->get_ptp_phys(atc->vm, index);
3707 + }
3708 +
3709 + static unsigned int convert_format(snd_pcm_format_t snd_format)
3710 +@@ -1669,7 +1658,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
3711 + }
3712 +
3713 + /* Set up device virtual memory management object */
3714 +- err = ct_vm_create(&atc->vm);
3715 ++ err = ct_vm_create(&atc->vm, pci);
3716 + if (err < 0)
3717 + goto error1;
3718 +
3719 +diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c
3720 +index 6b78752..65da6e4 100644
3721 +--- a/sound/pci/ctxfi/ctvmem.c
3722 ++++ b/sound/pci/ctxfi/ctvmem.c
3723 +@@ -138,7 +138,7 @@ ct_vm_map(struct ct_vm *vm, struct snd_pcm_substream *substream, int size)
3724 + return NULL;
3725 + }
3726 +
3727 +- ptp = vm->ptp[0];
3728 ++ ptp = (unsigned long *)vm->ptp[0].area;
3729 + pte_start = (block->addr >> CT_PAGE_SHIFT);
3730 + pages = block->size >> CT_PAGE_SHIFT;
3731 + for (i = 0; i < pages; i++) {
3732 +@@ -158,25 +158,25 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block)
3733 + }
3734 +
3735 + /* *
3736 +- * return the host (kmalloced) addr of the @index-th device
3737 +- * page talbe page on success, or NULL on failure.
3738 +- * The first returned NULL indicates the termination.
3739 ++ * return the host physical addr of the @index-th device
3740 ++ * page table page on success, or ~0UL on failure.
3741 ++ * The first returned ~0UL indicates the termination.
3742 + * */
3743 +-static void *
3744 +-ct_get_ptp_virt(struct ct_vm *vm, int index)
3745 ++static dma_addr_t
3746 ++ct_get_ptp_phys(struct ct_vm *vm, int index)
3747 + {
3748 +- void *addr;
3749 ++ dma_addr_t addr;
3750 +
3751 +- addr = (index >= CT_PTP_NUM) ? NULL : vm->ptp[index];
3752 ++ addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
3753 +
3754 + return addr;
3755 + }
3756 +
3757 +-int ct_vm_create(struct ct_vm **rvm)
3758 ++int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
3759 + {
3760 + struct ct_vm *vm;
3761 + struct ct_vm_block *block;
3762 +- int i;
3763 ++ int i, err = 0;
3764 +
3765 + *rvm = NULL;
3766 +
3767 +@@ -188,23 +188,21 @@ int ct_vm_create(struct ct_vm **rvm)
3768 +
3769 + /* Allocate page table pages */
3770 + for (i = 0; i < CT_PTP_NUM; i++) {
3771 +- vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL);
3772 +- if (!vm->ptp[i])
3773 ++ err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
3774 ++ snd_dma_pci_data(pci),
3775 ++ PAGE_SIZE, &vm->ptp[i]);
3776 ++ if (err < 0)
3777 + break;
3778 + }
3779 +- if (!i) {
3780 ++ if (err < 0) {
3781 + /* no page table pages are allocated */
3782 +- kfree(vm);
3783 ++ ct_vm_destroy(vm);
3784 + return -ENOMEM;
3785 + }
3786 + vm->size = CT_ADDRS_PER_PAGE * i;
3787 +- /* Initialise remaining ptps */
3788 +- for (; i < CT_PTP_NUM; i++)
3789 +- vm->ptp[i] = NULL;
3790 +-
3791 + vm->map = ct_vm_map;
3792 + vm->unmap = ct_vm_unmap;
3793 +- vm->get_ptp_virt = ct_get_ptp_virt;
3794 ++ vm->get_ptp_phys = ct_get_ptp_phys;
3795 + INIT_LIST_HEAD(&vm->unused);
3796 + INIT_LIST_HEAD(&vm->used);
3797 + block = kzalloc(sizeof(*block), GFP_KERNEL);
3798 +@@ -242,7 +240,7 @@ void ct_vm_destroy(struct ct_vm *vm)
3799 +
3800 + /* free allocated page table pages */
3801 + for (i = 0; i < CT_PTP_NUM; i++)
3802 +- kfree(vm->ptp[i]);
3803 ++ snd_dma_free_pages(&vm->ptp[i]);
3804 +
3805 + vm->size = 0;
3806 +
3807 +diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
3808 +index 01e4fd0..b23adfc 100644
3809 +--- a/sound/pci/ctxfi/ctvmem.h
3810 ++++ b/sound/pci/ctxfi/ctvmem.h
3811 +@@ -22,6 +22,8 @@
3812 +
3813 + #include <linux/mutex.h>
3814 + #include <linux/list.h>
3815 ++#include <linux/pci.h>
3816 ++#include <sound/memalloc.h>
3817 +
3818 + /* The chip can handle the page table of 4k pages
3819 + * (emu20k1 can handle even 8k pages, but we don't use it right now)
3820 +@@ -41,7 +43,7 @@ struct snd_pcm_substream;
3821 +
3822 + /* Virtual memory management object for card device */
3823 + struct ct_vm {
3824 +- void *ptp[CT_PTP_NUM]; /* Device page table pages */
3825 ++ struct snd_dma_buffer ptp[CT_PTP_NUM]; /* Device page table pages */
3826 + unsigned int size; /* Available addr space in bytes */
3827 + struct list_head unused; /* List of unused blocks */
3828 + struct list_head used; /* List of used blocks */
3829 +@@ -52,10 +54,10 @@ struct ct_vm {
3830 + int size);
3831 + /* Unmap device logical addr area. */
3832 + void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
3833 +- void *(*get_ptp_virt)(struct ct_vm *vm, int index);
3834 ++ dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
3835 + };
3836 +
3837 +-int ct_vm_create(struct ct_vm **rvm);
3838 ++int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
3839 + void ct_vm_destroy(struct ct_vm *vm);
3840 +
3841 + #endif /* CTVMEM_H */
3842 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3843 +index 03784da..fec8724 100644
3844 +--- a/sound/pci/hda/hda_intel.c
3845 ++++ b/sound/pci/hda/hda_intel.c
3846 +@@ -1858,6 +1858,9 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
3847 +
3848 + if (!bdl_pos_adj[chip->dev_index])
3849 + return 1; /* no delayed ack */
3850 ++ if (WARN_ONCE(!azx_dev->period_bytes,
3851 ++ "hda-intel: zero azx_dev->period_bytes"))
3852 ++ return 0; /* this shouldn't happen! */
3853 + if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2)
3854 + return 0; /* NG - it's below the period boundary */
3855 + return 1; /* OK, it's fine */
3856 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3857 +index c2e9370..911dd1f 100644
3858 +--- a/sound/pci/hda/patch_realtek.c
3859 ++++ b/sound/pci/hda/patch_realtek.c
3860 +@@ -7042,8 +7042,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
3861 + HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
3862 + HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
3863 + HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
3864 +- HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
3865 +- HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
3866 ++ HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
3867 ++ HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
3868 + HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3869 + HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3870 + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3871 +@@ -7430,6 +7430,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
3872 + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3873 + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3874 + {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
3875 ++ {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
3876 + /* Front Mic pin: input vref at 80% */
3877 + {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3878 + {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3879 +@@ -7554,6 +7555,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
3880 + spec->autocfg.speaker_pins[0] = 0x14;
3881 + }
3882 +
3883 ++static void alc885_mb5_automute(struct hda_codec *codec)
3884 ++{
3885 ++ unsigned int present;
3886 ++
3887 ++ present = snd_hda_codec_read(codec, 0x14, 0,
3888 ++ AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
3889 ++ snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
3890 ++ HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
3891 ++ snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
3892 ++ HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
3893 ++
3894 ++}
3895 ++
3896 ++static void alc885_mb5_unsol_event(struct hda_codec *codec,
3897 ++ unsigned int res)
3898 ++{
3899 ++ /* Headphone insertion or removal. */
3900 ++ if ((res >> 26) == ALC880_HP_EVENT)
3901 ++ alc885_mb5_automute(codec);
3902 ++}
3903 ++
3904 +
3905 + static struct hda_verb alc882_targa_verbs[] = {
3906 + {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3907 +@@ -8996,6 +9018,8 @@ static struct alc_config_preset alc882_presets[] = {
3908 + .input_mux = &mb5_capture_source,
3909 + .dig_out_nid = ALC882_DIGOUT_NID,
3910 + .dig_in_nid = ALC882_DIGIN_NID,
3911 ++ .unsol_event = alc885_mb5_unsol_event,
3912 ++ .init_hook = alc885_mb5_automute,
3913 + },
3914 + [ALC885_MACPRO] = {
3915 + .mixers = { alc882_macpro_mixer },
3916 +diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
3917 +index 8803d9d..f26a125 100644
3918 +--- a/sound/usb/usbaudio.c
3919 ++++ b/sound/usb/usbaudio.c
3920 +@@ -1936,7 +1936,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
3921 + struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
3922 + struct snd_usb_substream *subs = &as->substream[direction];
3923 +
3924 +- if (subs->interface >= 0) {
3925 ++ if (!as->chip->shutdown && subs->interface >= 0) {
3926 + usb_set_interface(subs->dev, subs->interface, 0);
3927 + subs->interface = -1;
3928 + }
3929
3930 Deleted: genpatches-2.6/trunk/2.6.32/2410_rtl8187se-compilation-fix.patch
3931 ===================================================================
3932 --- genpatches-2.6/trunk/2.6.32/2410_rtl8187se-compilation-fix.patch 2010-02-19 15:35:20 UTC (rev 1680)
3933 +++ genpatches-2.6/trunk/2.6.32/2410_rtl8187se-compilation-fix.patch 2010-02-23 16:36:46 UTC (rev 1681)
3934 @@ -1,207 +0,0 @@
3935 -From: George Kadianakis <desnacked@×××××.com>
3936 -Date: Wed, 16 Dec 2009 23:16:00 +0000 (+0200)
3937 -Subject: Staging: fix rtl8187se compilation errors with mac80211
3938 -X-Git-Tag: v2.6.33-rc2~13^2~11
3939 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=df574b8ecfb3a84af96229f336a6be88ca4a7055
3940 -
3941 -Staging: fix rtl8187se compilation errors with mac80211
3942 -
3943 -This patch fixes compilation problems that were caused by function
3944 -naming conflicts between the rtl8187se driver and the mac80211 stack.
3945 -
3946 -Signed-off-by: George Kadianakis <desnacked at gmail.com>
3947 -Signed-off-by: Greg Kroah-Hartman <gregkh@××××.de>
3948 ----
3949 -
3950 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
3951 -index 3222c22..0d490c1 100644
3952 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
3953 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
3954 -@@ -1318,13 +1318,13 @@ extern int ieee80211_encrypt_fragment(
3955 - struct sk_buff *frag,
3956 - int hdr_len);
3957 -
3958 --extern int ieee80211_xmit(struct sk_buff *skb,
3959 -+extern int ieee80211_rtl_xmit(struct sk_buff *skb,
3960 - struct net_device *dev);
3961 - extern void ieee80211_txb_free(struct ieee80211_txb *);
3962 -
3963 -
3964 - /* ieee80211_rx.c */
3965 --extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
3966 -+extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
3967 - struct ieee80211_rx_stats *rx_stats);
3968 - extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
3969 - struct ieee80211_hdr_4addr *header,
3970 -@@ -1376,8 +1376,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
3971 - extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
3972 - extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
3973 - extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
3974 --extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
3975 --extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
3976 -+extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
3977 -+extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
3978 - extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
3979 - extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
3980 - extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
3981 -@@ -1385,7 +1385,7 @@ extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct
3982 - extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
3983 - extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
3984 - extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn);
3985 --extern void ieee80211_start_scan(struct ieee80211_device *ieee);
3986 -+extern void ieee80211_rtl_start_scan(struct ieee80211_device *ieee);
3987 -
3988 - //Add for RF power on power off by lizhaoming 080512
3989 - extern void SendDisassociation(struct ieee80211_device *ieee,
3990 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
3991 -index f882dd8..9128c18 100644
3992 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
3993 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
3994 -@@ -469,7 +469,7 @@ drop:
3995 - /* All received frames are sent to this function. @skb contains the frame in
3996 - * IEEE 802.11 format, i.e., in the format it was sent over air.
3997 - * This function is called only as a tasklet (software IRQ). */
3998 --int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
3999 -+int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
4000 - struct ieee80211_rx_stats *rx_stats)
4001 - {
4002 - struct net_device *dev = ieee->dev;
4003 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
4004 -index 1fe19c3..c7c645a 100644
4005 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
4006 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
4007 -@@ -689,7 +689,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee)
4008 - }
4009 -
4010 - /* called with ieee->lock held */
4011 --void ieee80211_start_scan(struct ieee80211_device *ieee)
4012 -+void ieee80211_rtl_start_scan(struct ieee80211_device *ieee)
4013 - {
4014 - if(IS_DOT11D_ENABLE(ieee) )
4015 - {
4016 -@@ -1196,7 +1196,7 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
4017 - }
4018 - }
4019 -
4020 --void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
4021 -+void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
4022 - {
4023 - u8 *c;
4024 - struct sk_buff *skb;
4025 -@@ -1898,7 +1898,7 @@ associate_complete:
4026 -
4027 - ieee80211_associate_step2(ieee);
4028 - }else{
4029 -- ieee80211_auth_challenge(ieee, challenge, chlen);
4030 -+ ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
4031 - }
4032 - }else{
4033 - ieee->softmac_stats.rx_auth_rs_err++;
4034 -@@ -2047,7 +2047,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee)
4035 -
4036 - }
4037 -
4038 --void ieee80211_wake_queue(struct ieee80211_device *ieee)
4039 -+void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
4040 - {
4041 -
4042 - unsigned long flags;
4043 -@@ -2089,7 +2089,7 @@ exit :
4044 - }
4045 -
4046 -
4047 --void ieee80211_stop_queue(struct ieee80211_device *ieee)
4048 -+void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
4049 - {
4050 - //unsigned long flags;
4051 - //spin_lock_irqsave(&ieee->lock,flags);
4052 -@@ -2301,7 +2301,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
4053 - //#else
4054 - if (ieee->state == IEEE80211_NOLINK){
4055 - ieee->actscanning = true;
4056 -- ieee80211_start_scan(ieee);
4057 -+ ieee80211_rtl_start_scan(ieee);
4058 - }
4059 - //#endif
4060 - spin_unlock_irqrestore(&ieee->lock, flags);
4061 -@@ -2357,7 +2357,7 @@ void ieee80211_associate_retry_wq(struct work_struct *work)
4062 - if(ieee->state == IEEE80211_NOLINK){
4063 - ieee->beinretry = false;
4064 - ieee->actscanning = true;
4065 -- ieee80211_start_scan(ieee);
4066 -+ ieee80211_rtl_start_scan(ieee);
4067 - }
4068 - //YJ,add,080828, notify os here
4069 - if(ieee->state == IEEE80211_NOLINK)
4070 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
4071 -index dde1f2e..69bd021 100644
4072 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
4073 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
4074 -@@ -304,7 +304,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network)
4075 - }
4076 -
4077 - /* SKBs are added to the ieee->tx_queue. */
4078 --int ieee80211_xmit(struct sk_buff *skb,
4079 -+int ieee80211_rtl_xmit(struct sk_buff *skb,
4080 - struct net_device *dev)
4081 - {
4082 - struct ieee80211_device *ieee = netdev_priv(dev);
4083 -diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
4084 -index 57c62b0..e0f13ef 100644
4085 ---- a/drivers/staging/rtl8187se/r8180_core.c
4086 -+++ b/drivers/staging/rtl8187se/r8180_core.c
4087 -@@ -1811,7 +1811,7 @@ void rtl8180_rx(struct net_device *dev)
4088 - if(priv->rx_skb->len > 4)
4089 - skb_trim(priv->rx_skb,priv->rx_skb->len-4);
4090 - #ifndef RX_DONT_PASS_UL
4091 -- if(!ieee80211_rx(priv->ieee80211,
4092 -+ if(!ieee80211_rtl_rx(priv->ieee80211,
4093 - priv->rx_skb, &stats)){
4094 - #endif // RX_DONT_PASS_UL
4095 -
4096 -@@ -1917,11 +1917,11 @@ rate)
4097 - if (!check_nic_enought_desc(dev, priority)){
4098 - DMESGW("Error: no descriptor left by previous TX (avail %d) ",
4099 - get_curr_tx_free_desc(dev, priority));
4100 -- ieee80211_stop_queue(priv->ieee80211);
4101 -+ ieee80211_rtl_stop_queue(priv->ieee80211);
4102 - }
4103 - rtl8180_tx(dev, skb->data, skb->len, priority, morefrag,0,rate);
4104 - if (!check_nic_enought_desc(dev, priority))
4105 -- ieee80211_stop_queue(priv->ieee80211);
4106 -+ ieee80211_rtl_stop_queue(priv->ieee80211);
4107 -
4108 - spin_unlock_irqrestore(&priv->tx_lock,flags);
4109 - }
4110 -@@ -3680,7 +3680,7 @@ static const struct net_device_ops rtl8180_netdev_ops = {
4111 - .ndo_set_mac_address = r8180_set_mac_adr,
4112 - .ndo_validate_addr = eth_validate_addr,
4113 - .ndo_change_mtu = eth_change_mtu,
4114 -- .ndo_start_xmit = ieee80211_xmit,
4115 -+ .ndo_start_xmit = ieee80211_rtl_xmit,
4116 - };
4117 -
4118 - static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
4119 -@@ -3900,7 +3900,7 @@ void rtl8180_try_wake_queue(struct net_device *dev, int pri)
4120 - spin_unlock_irqrestore(&priv->tx_lock,flags);
4121 -
4122 - if(enough_desc)
4123 -- ieee80211_wake_queue(priv->ieee80211);
4124 -+ ieee80211_rtl_wake_queue(priv->ieee80211);
4125 - }
4126 -
4127 - void rtl8180_tx_isr(struct net_device *dev, int pri,short error)
4128 -diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c
4129 -index 536cb6e..124cde3 100644
4130 ---- a/drivers/staging/rtl8187se/r8180_wx.c
4131 -+++ b/drivers/staging/rtl8187se/r8180_wx.c
4132 -@@ -377,7 +377,7 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
4133 - // queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq);
4134 - //printk("start scan============================>\n");
4135 - ieee80211_softmac_ips_scan_syncro(priv->ieee80211);
4136 --//ieee80211_start_scan(priv->ieee80211);
4137 -+//ieee80211_rtl_start_scan(priv->ieee80211);
4138 - /* intentionally forget to up sem */
4139 - // up(&priv->ieee80211->wx_sem);
4140 - ret = 0;
4141 -