/[linux-patches]/genpatches-2.6/tags/2.6.38-5/1004_linux-2.6.38.5.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.38-5/1004_linux-2.6.38.5.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1910 - (show annotations) (download)
Tue May 3 13:08:58 2011 UTC (3 years, 7 months ago) by mpagano
File size: 63659 byte(s)
2.6.38-5 release
1 diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
2 index 02b7a03..8b3db1c 100644
3 --- a/arch/m68k/mm/motorola.c
4 +++ b/arch/m68k/mm/motorola.c
5 @@ -300,6 +300,8 @@ void __init paging_init(void)
6 zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT;
7 free_area_init_node(i, zones_size,
8 m68k_memory[i].addr >> PAGE_SHIFT, NULL);
9 + if (node_present_pages(i))
10 + node_set_state(i, N_NORMAL_MEMORY);
11 }
12 }
13
14 diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
15 index f4f4d70..7fd8aad 100644
16 --- a/arch/parisc/mm/init.c
17 +++ b/arch/parisc/mm/init.c
18 @@ -266,8 +266,10 @@ static void __init setup_bootmem(void)
19 }
20 memset(pfnnid_map, 0xff, sizeof(pfnnid_map));
21
22 - for (i = 0; i < npmem_ranges; i++)
23 + for (i = 0; i < npmem_ranges; i++) {
24 + node_set_state(i, N_NORMAL_MEMORY);
25 node_set_online(i);
26 + }
27 #endif
28
29 /*
30 diff --git a/arch/s390/kvm/sie64a.S b/arch/s390/kvm/sie64a.S
31 index 7e9d30d..ab0e041 100644
32 --- a/arch/s390/kvm/sie64a.S
33 +++ b/arch/s390/kvm/sie64a.S
34 @@ -48,10 +48,10 @@ sie_irq_handler:
35 tm __TI_flags+7(%r2),_TIF_EXIT_SIE
36 jz 0f
37 larl %r2,sie_exit # work pending, leave sie
38 - stg %r2,__LC_RETURN_PSW+8
39 + stg %r2,SPI_PSW+8(0,%r15)
40 br %r14
41 0: larl %r2,sie_reenter # re-enter with guest id
42 - stg %r2,__LC_RETURN_PSW+8
43 + stg %r2,SPI_PSW+8(0,%r15)
44 1: br %r14
45
46 /*
47 diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
48 index 2c57806..0f900c8 100644
49 --- a/arch/s390/mm/fault.c
50 +++ b/arch/s390/mm/fault.c
51 @@ -558,9 +558,9 @@ static void pfault_interrupt(unsigned int ext_int_code,
52 * Get the token (= address of the task structure of the affected task).
53 */
54 #ifdef CONFIG_64BIT
55 - tsk = *(struct task_struct **) param64;
56 + tsk = (struct task_struct *) param64;
57 #else
58 - tsk = *(struct task_struct **) param32;
59 + tsk = (struct task_struct *) param32;
60 #endif
61
62 if (subcode & 0x0080) {
63 diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
64 index 804b28d..b1da91c 100644
65 --- a/arch/um/sys-i386/Makefile
66 +++ b/arch/um/sys-i386/Makefile
67 @@ -4,7 +4,7 @@
68
69 obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
70 ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
71 - sys_call_table.o tls.o
72 + sys_call_table.o tls.o atomic64_cx8_32.o
73
74 obj-$(CONFIG_BINFMT_ELF) += elfcore.o
75
76 diff --git a/arch/um/sys-i386/atomic64_cx8_32.S b/arch/um/sys-i386/atomic64_cx8_32.S
77 new file mode 100644
78 index 0000000..1e901d3d
79 --- /dev/null
80 +++ b/arch/um/sys-i386/atomic64_cx8_32.S
81 @@ -0,0 +1,225 @@
82 +/*
83 + * atomic64_t for 586+
84 + *
85 + * Copied from arch/x86/lib/atomic64_cx8_32.S
86 + *
87 + * Copyright © 2010 Luca Barbieri
88 + *
89 + * This program is free software; you can redistribute it and/or modify
90 + * it under the terms of the GNU General Public License as published by
91 + * the Free Software Foundation; either version 2 of the License, or
92 + * (at your option) any later version.
93 + *
94 + */
95 +
96 +#include <linux/linkage.h>
97 +#include <asm/alternative-asm.h>
98 +#include <asm/dwarf2.h>
99 +
100 +.macro SAVE reg
101 + pushl_cfi %\reg
102 + CFI_REL_OFFSET \reg, 0
103 +.endm
104 +
105 +.macro RESTORE reg
106 + popl_cfi %\reg
107 + CFI_RESTORE \reg
108 +.endm
109 +
110 +.macro read64 reg
111 + movl %ebx, %eax
112 + movl %ecx, %edx
113 +/* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */
114 + LOCK_PREFIX
115 + cmpxchg8b (\reg)
116 +.endm
117 +
118 +ENTRY(atomic64_read_cx8)
119 + CFI_STARTPROC
120 +
121 + read64 %ecx
122 + ret
123 + CFI_ENDPROC
124 +ENDPROC(atomic64_read_cx8)
125 +
126 +ENTRY(atomic64_set_cx8)
127 + CFI_STARTPROC
128 +
129 +1:
130 +/* we don't need LOCK_PREFIX since aligned 64-bit writes
131 + * are atomic on 586 and newer */
132 + cmpxchg8b (%esi)
133 + jne 1b
134 +
135 + ret
136 + CFI_ENDPROC
137 +ENDPROC(atomic64_set_cx8)
138 +
139 +ENTRY(atomic64_xchg_cx8)
140 + CFI_STARTPROC
141 +
142 + movl %ebx, %eax
143 + movl %ecx, %edx
144 +1:
145 + LOCK_PREFIX
146 + cmpxchg8b (%esi)
147 + jne 1b
148 +
149 + ret
150 + CFI_ENDPROC
151 +ENDPROC(atomic64_xchg_cx8)
152 +
153 +.macro addsub_return func ins insc
154 +ENTRY(atomic64_\func\()_return_cx8)
155 + CFI_STARTPROC
156 + SAVE ebp
157 + SAVE ebx
158 + SAVE esi
159 + SAVE edi
160 +
161 + movl %eax, %esi
162 + movl %edx, %edi
163 + movl %ecx, %ebp
164 +
165 + read64 %ebp
166 +1:
167 + movl %eax, %ebx
168 + movl %edx, %ecx
169 + \ins\()l %esi, %ebx
170 + \insc\()l %edi, %ecx
171 + LOCK_PREFIX
172 + cmpxchg8b (%ebp)
173 + jne 1b
174 +
175 +10:
176 + movl %ebx, %eax
177 + movl %ecx, %edx
178 + RESTORE edi
179 + RESTORE esi
180 + RESTORE ebx
181 + RESTORE ebp
182 + ret
183 + CFI_ENDPROC
184 +ENDPROC(atomic64_\func\()_return_cx8)
185 +.endm
186 +
187 +addsub_return add add adc
188 +addsub_return sub sub sbb
189 +
190 +.macro incdec_return func ins insc
191 +ENTRY(atomic64_\func\()_return_cx8)
192 + CFI_STARTPROC
193 + SAVE ebx
194 +
195 + read64 %esi
196 +1:
197 + movl %eax, %ebx
198 + movl %edx, %ecx
199 + \ins\()l $1, %ebx
200 + \insc\()l $0, %ecx
201 + LOCK_PREFIX
202 + cmpxchg8b (%esi)
203 + jne 1b
204 +
205 +10:
206 + movl %ebx, %eax
207 + movl %ecx, %edx
208 + RESTORE ebx
209 + ret
210 + CFI_ENDPROC
211 +ENDPROC(atomic64_\func\()_return_cx8)
212 +.endm
213 +
214 +incdec_return inc add adc
215 +incdec_return dec sub sbb
216 +
217 +ENTRY(atomic64_dec_if_positive_cx8)
218 + CFI_STARTPROC
219 + SAVE ebx
220 +
221 + read64 %esi
222 +1:
223 + movl %eax, %ebx
224 + movl %edx, %ecx
225 + subl $1, %ebx
226 + sbb $0, %ecx
227 + js 2f
228 + LOCK_PREFIX
229 + cmpxchg8b (%esi)
230 + jne 1b
231 +
232 +2:
233 + movl %ebx, %eax
234 + movl %ecx, %edx
235 + RESTORE ebx
236 + ret
237 + CFI_ENDPROC
238 +ENDPROC(atomic64_dec_if_positive_cx8)
239 +
240 +ENTRY(atomic64_add_unless_cx8)
241 + CFI_STARTPROC
242 + SAVE ebp
243 + SAVE ebx
244 +/* these just push these two parameters on the stack */
245 + SAVE edi
246 + SAVE esi
247 +
248 + movl %ecx, %ebp
249 + movl %eax, %esi
250 + movl %edx, %edi
251 +
252 + read64 %ebp
253 +1:
254 + cmpl %eax, 0(%esp)
255 + je 4f
256 +2:
257 + movl %eax, %ebx
258 + movl %edx, %ecx
259 + addl %esi, %ebx
260 + adcl %edi, %ecx
261 + LOCK_PREFIX
262 + cmpxchg8b (%ebp)
263 + jne 1b
264 +
265 + movl $1, %eax
266 +3:
267 + addl $8, %esp
268 + CFI_ADJUST_CFA_OFFSET -8
269 + RESTORE ebx
270 + RESTORE ebp
271 + ret
272 +4:
273 + cmpl %edx, 4(%esp)
274 + jne 2b
275 + xorl %eax, %eax
276 + jmp 3b
277 + CFI_ENDPROC
278 +ENDPROC(atomic64_add_unless_cx8)
279 +
280 +ENTRY(atomic64_inc_not_zero_cx8)
281 + CFI_STARTPROC
282 + SAVE ebx
283 +
284 + read64 %esi
285 +1:
286 + testl %eax, %eax
287 + je 4f
288 +2:
289 + movl %eax, %ebx
290 + movl %edx, %ecx
291 + addl $1, %ebx
292 + adcl $0, %ecx
293 + LOCK_PREFIX
294 + cmpxchg8b (%esi)
295 + jne 1b
296 +
297 + movl $1, %eax
298 +3:
299 + RESTORE ebx
300 + ret
301 +4:
302 + testl %edx, %edx
303 + jne 2b
304 + jmp 3b
305 + CFI_ENDPROC
306 +ENDPROC(atomic64_inc_not_zero_cx8)
307 diff --git a/arch/x86/include/asm/gart.h b/arch/x86/include/asm/gart.h
308 index 43085bf..3e7349f 100644
309 --- a/arch/x86/include/asm/gart.h
310 +++ b/arch/x86/include/asm/gart.h
311 @@ -66,7 +66,7 @@ static inline void gart_set_size_and_enable(struct pci_dev *dev, u32 order)
312 * Don't enable translation but enable GART IO and CPU accesses.
313 * Also, set DISTLBWALKPRB since GART tables memory is UC.
314 */
315 - ctl = DISTLBWALKPRB | order << 1;
316 + ctl = order << 1;
317
318 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
319 }
320 @@ -83,7 +83,7 @@ static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
321
322 /* Enable GART translation for this hammer. */
323 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
324 - ctl |= GARTEN;
325 + ctl |= GARTEN | DISTLBWALKPRB;
326 ctl &= ~(DISGARTCPU | DISGARTIO);
327 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
328 }
329 diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
330 index 5955a78..f6a1c23 100644
331 --- a/arch/x86/kernel/aperture_64.c
332 +++ b/arch/x86/kernel/aperture_64.c
333 @@ -500,7 +500,7 @@ out:
334 * Don't enable translation yet but enable GART IO and CPU
335 * accesses and set DISTLBWALKPRB since GART table memory is UC.
336 */
337 - u32 ctl = DISTLBWALKPRB | aper_order << 1;
338 + u32 ctl = aper_order << 1;
339
340 bus = amd_nb_bus_dev_ranges[i].bus;
341 dev_base = amd_nb_bus_dev_ranges[i].dev_base;
342 diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
343 index c01ffa5..197a46f 100644
344 --- a/arch/x86/kernel/pci-gart_64.c
345 +++ b/arch/x86/kernel/pci-gart_64.c
346 @@ -81,6 +81,9 @@ static u32 gart_unmapped_entry;
347 #define AGPEXTERN
348 #endif
349
350 +/* GART can only remap to physical addresses < 1TB */
351 +#define GART_MAX_PHYS_ADDR (1ULL << 40)
352 +
353 /* backdoor interface to AGP driver */
354 AGPEXTERN int agp_memory_reserved;
355 AGPEXTERN __u32 *agp_gatt_table;
356 @@ -212,9 +215,13 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
357 size_t size, int dir, unsigned long align_mask)
358 {
359 unsigned long npages = iommu_num_pages(phys_mem, size, PAGE_SIZE);
360 - unsigned long iommu_page = alloc_iommu(dev, npages, align_mask);
361 + unsigned long iommu_page;
362 int i;
363
364 + if (unlikely(phys_mem + size > GART_MAX_PHYS_ADDR))
365 + return bad_dma_addr;
366 +
367 + iommu_page = alloc_iommu(dev, npages, align_mask);
368 if (iommu_page == -1) {
369 if (!nonforced_iommu(dev, phys_mem, size))
370 return phys_mem;
371 diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
372 index 41fb691..3655e19 100644
373 --- a/block/blk-sysfs.c
374 +++ b/block/blk-sysfs.c
375 @@ -511,8 +511,10 @@ int blk_register_queue(struct gendisk *disk)
376 return ret;
377
378 ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
379 - if (ret < 0)
380 + if (ret < 0) {
381 + blk_trace_remove_sysfs(dev);
382 return ret;
383 + }
384
385 kobject_uevent(&q->kobj, KOBJ_ADD);
386
387 diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
388 index ac1a599..fcc13ac 100644
389 --- a/drivers/acpi/battery.c
390 +++ b/drivers/acpi/battery.c
391 @@ -33,6 +33,7 @@
392 #include <linux/async.h>
393 #include <linux/dmi.h>
394 #include <linux/slab.h>
395 +#include <linux/suspend.h>
396
397 #ifdef CONFIG_ACPI_PROCFS_POWER
398 #include <linux/proc_fs.h>
399 @@ -102,6 +103,7 @@ struct acpi_battery {
400 struct mutex lock;
401 struct power_supply bat;
402 struct acpi_device *device;
403 + struct notifier_block pm_nb;
404 unsigned long update_time;
405 int rate_now;
406 int capacity_now;
407 @@ -940,6 +942,21 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
408 power_supply_changed(&battery->bat);
409 }
410
411 +static int battery_notify(struct notifier_block *nb,
412 + unsigned long mode, void *_unused)
413 +{
414 + struct acpi_battery *battery = container_of(nb, struct acpi_battery,
415 + pm_nb);
416 + switch (mode) {
417 + case PM_POST_SUSPEND:
418 + sysfs_remove_battery(battery);
419 + sysfs_add_battery(battery);
420 + break;
421 + }
422 +
423 + return 0;
424 +}
425 +
426 static int acpi_battery_add(struct acpi_device *device)
427 {
428 int result = 0;
429 @@ -972,6 +989,10 @@ static int acpi_battery_add(struct acpi_device *device)
430 #endif
431 kfree(battery);
432 }
433 +
434 + battery->pm_nb.notifier_call = battery_notify;
435 + register_pm_notifier(&battery->pm_nb);
436 +
437 return result;
438 }
439
440 @@ -982,6 +1003,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
441 if (!device || !acpi_driver_data(device))
442 return -EINVAL;
443 battery = acpi_driver_data(device);
444 + unregister_pm_notifier(&battery->pm_nb);
445 #ifdef CONFIG_ACPI_PROCFS_POWER
446 acpi_battery_remove_fs(device);
447 #endif
448 diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
449 index b99e624..8eee69f 100644
450 --- a/drivers/acpi/scan.c
451 +++ b/drivers/acpi/scan.c
452 @@ -944,6 +944,10 @@ static int acpi_bus_get_flags(struct acpi_device *device)
453 if (ACPI_SUCCESS(status))
454 device->flags.lockable = 1;
455
456 + /* Power resources cannot be power manageable. */
457 + if (device->device_type == ACPI_BUS_TYPE_POWER)
458 + return 0;
459 +
460 /* Presence of _PS0|_PR0 indicates 'power manageable' */
461 status = acpi_get_handle(device->handle, "_PS0", &temp);
462 if (ACPI_FAILURE(status))
463 diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
464 index 34e08f6..54c096b 100644
465 --- a/drivers/ata/ahci.c
466 +++ b/drivers/ata/ahci.c
467 @@ -150,7 +150,7 @@ static const struct ata_port_info ahci_port_info[] = {
468 {
469 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP |
470 AHCI_HFLAG_YES_NCQ),
471 - .flags = AHCI_FLAG_COMMON,
472 + .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM,
473 .pio_mask = ATA_PIO4,
474 .udma_mask = ATA_UDMA6,
475 .port_ops = &ahci_ops,
476 diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
477 index 26d4523..8498eb5 100644
478 --- a/drivers/ata/libahci.c
479 +++ b/drivers/ata/libahci.c
480 @@ -1897,7 +1897,17 @@ static void ahci_pmp_attach(struct ata_port *ap)
481 ahci_enable_fbs(ap);
482
483 pp->intr_mask |= PORT_IRQ_BAD_PMP;
484 - writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
485 +
486 + /*
487 + * We must not change the port interrupt mask register if the
488 + * port is marked frozen, the value in pp->intr_mask will be
489 + * restored later when the port is thawed.
490 + *
491 + * Note that during initialization, the port is marked as
492 + * frozen since the irq handler is not yet registered.
493 + */
494 + if (!(ap->pflags & ATA_PFLAG_FROZEN))
495 + writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
496 }
497
498 static void ahci_pmp_detach(struct ata_port *ap)
499 @@ -1913,7 +1923,10 @@ static void ahci_pmp_detach(struct ata_port *ap)
500 writel(cmd, port_mmio + PORT_CMD);
501
502 pp->intr_mask &= ~PORT_IRQ_BAD_PMP;
503 - writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
504 +
505 + /* see comment above in ahci_pmp_attach() */
506 + if (!(ap->pflags & ATA_PFLAG_FROZEN))
507 + writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
508 }
509
510 int ahci_port_resume(struct ata_port *ap)
511 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
512 index d4e52e2..4ccce0f 100644
513 --- a/drivers/ata/libata-core.c
514 +++ b/drivers/ata/libata-core.c
515 @@ -5479,8 +5479,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
516 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
517 if (!ap)
518 return NULL;
519 -
520 - ap->pflags |= ATA_PFLAG_INITIALIZING;
521 +
522 + ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
523 ap->lock = &host->lock;
524 ap->print_id = -1;
525 ap->host = host;
526 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
527 index e16850e..fe18c2d 100644
528 --- a/drivers/ata/libata-eh.c
529 +++ b/drivers/ata/libata-eh.c
530 @@ -3276,6 +3276,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
531 struct ata_eh_context *ehc = &link->eh_context;
532 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
533 enum ata_lpm_policy old_policy = link->lpm_policy;
534 + bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM;
535 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
536 unsigned int err_mask;
537 int rc;
538 @@ -3292,7 +3293,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
539 */
540 ata_for_each_dev(dev, link, ENABLED) {
541 bool hipm = ata_id_has_hipm(dev->id);
542 - bool dipm = ata_id_has_dipm(dev->id);
543 + bool dipm = ata_id_has_dipm(dev->id) && !no_dipm;
544
545 /* find the first enabled and LPM enabled devices */
546 if (!link_dev)
547 @@ -3349,7 +3350,8 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
548
549 /* host config updated, enable DIPM if transitioning to MIN_POWER */
550 ata_for_each_dev(dev, link, ENABLED) {
551 - if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) {
552 + if (policy == ATA_LPM_MIN_POWER && !no_dipm &&
553 + ata_id_has_dipm(dev->id)) {
554 err_mask = ata_dev_set_feature(dev,
555 SETFEATURES_SATA_ENABLE, SATA_DIPM);
556 if (err_mask && err_mask != AC_ERR_DEV) {
557 diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
558 index 012cba0..b072648 100644
559 --- a/drivers/char/agp/generic.c
560 +++ b/drivers/char/agp/generic.c
561 @@ -115,6 +115,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages)
562 struct agp_memory *new;
563 unsigned long alloc_size = num_agp_pages*sizeof(struct page *);
564
565 + if (INT_MAX/sizeof(struct page *) < num_agp_pages)
566 + return NULL;
567 +
568 new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL);
569 if (new == NULL)
570 return NULL;
571 @@ -234,11 +237,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
572 int scratch_pages;
573 struct agp_memory *new;
574 size_t i;
575 + int cur_memory;
576
577 if (!bridge)
578 return NULL;
579
580 - if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp)
581 + cur_memory = atomic_read(&bridge->current_memory_agp);
582 + if ((cur_memory + page_count > bridge->max_memory_agp) ||
583 + (cur_memory + page_count < page_count))
584 return NULL;
585
586 if (type >= AGP_USER_TYPES) {
587 @@ -1089,8 +1095,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
588 return -EINVAL;
589 }
590
591 - /* AK: could wrap */
592 - if ((pg_start + mem->page_count) > num_entries)
593 + if (((pg_start + mem->page_count) > num_entries) ||
594 + ((pg_start + mem->page_count) < pg_start))
595 return -EINVAL;
596
597 j = pg_start;
598 @@ -1124,7 +1130,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
599 {
600 size_t i;
601 struct agp_bridge_data *bridge;
602 - int mask_type;
603 + int mask_type, num_entries;
604
605 bridge = mem->bridge;
606 if (!bridge)
607 @@ -1136,6 +1142,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
608 if (type != mem->type)
609 return -EINVAL;
610
611 + num_entries = agp_num_entries();
612 + if (((pg_start + mem->page_count) > num_entries) ||
613 + ((pg_start + mem->page_count) < pg_start))
614 + return -EINVAL;
615 +
616 mask_type = bridge->driver->agp_type_to_mask_type(bridge, type);
617 if (mask_type != 0) {
618 /* The generic routines know nothing of memory types */
619 diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
620 index 84b164d..838568a 100644
621 --- a/drivers/char/virtio_console.c
622 +++ b/drivers/char/virtio_console.c
623 @@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port)
624 spin_lock_irq(&pdrvdata_lock);
625 list_del(&port->cons.list);
626 spin_unlock_irq(&pdrvdata_lock);
627 -#if 0
628 - /*
629 - * hvc_remove() not called as removing one hvc port
630 - * results in other hvc ports getting frozen.
631 - *
632 - * Once this is resolved in hvc, this functionality
633 - * will be enabled. Till that is done, the -EPIPE
634 - * return from get_chars() above will help
635 - * hvc_console.c to clean up on ports we remove here.
636 - */
637 hvc_remove(port->cons.hvc);
638 -#endif
639 }
640
641 /* Remove unused data this port might have received. */
642 diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
643 index 0902d44..4b4b545 100644
644 --- a/drivers/gpu/drm/Kconfig
645 +++ b/drivers/gpu/drm/Kconfig
646 @@ -24,6 +24,7 @@ config DRM_KMS_HELPER
647 depends on DRM
648 select FB
649 select FRAMEBUFFER_CONSOLE if !EXPERT
650 + select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
651 help
652 FB and CRTC helpers for KMS drivers.
653
654 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
655 index 49fb54f..ecf8f94 100644
656 --- a/drivers/gpu/drm/i915/intel_display.c
657 +++ b/drivers/gpu/drm/i915/intel_display.c
658 @@ -5630,36 +5630,6 @@ cleanup_work:
659 return ret;
660 }
661
662 -static void intel_crtc_reset(struct drm_crtc *crtc)
663 -{
664 - struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
665 -
666 - /* Reset flags back to the 'unknown' status so that they
667 - * will be correctly set on the initial modeset.
668 - */
669 - intel_crtc->dpms_mode = -1;
670 -}
671 -
672 -static struct drm_crtc_helper_funcs intel_helper_funcs = {
673 - .dpms = intel_crtc_dpms,
674 - .mode_fixup = intel_crtc_mode_fixup,
675 - .mode_set = intel_crtc_mode_set,
676 - .mode_set_base = intel_pipe_set_base,
677 - .mode_set_base_atomic = intel_pipe_set_base_atomic,
678 - .load_lut = intel_crtc_load_lut,
679 - .disable = intel_crtc_disable,
680 -};
681 -
682 -static const struct drm_crtc_funcs intel_crtc_funcs = {
683 - .reset = intel_crtc_reset,
684 - .cursor_set = intel_crtc_cursor_set,
685 - .cursor_move = intel_crtc_cursor_move,
686 - .gamma_set = intel_crtc_gamma_set,
687 - .set_config = drm_crtc_helper_set_config,
688 - .destroy = intel_crtc_destroy,
689 - .page_flip = intel_crtc_page_flip,
690 -};
691 -
692 static void intel_sanitize_modesetting(struct drm_device *dev,
693 int pipe, int plane)
694 {
695 @@ -5710,6 +5680,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev,
696 }
697 }
698
699 +static void intel_crtc_reset(struct drm_crtc *crtc)
700 +{
701 + struct drm_device *dev = crtc->dev;
702 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
703 +
704 + /* Reset flags back to the 'unknown' status so that they
705 + * will be correctly set on the initial modeset.
706 + */
707 + intel_crtc->dpms_mode = -1;
708 +
709 + /* We need to fix up any BIOS configuration that conflicts with
710 + * our expectations.
711 + */
712 + intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
713 +}
714 +
715 +static struct drm_crtc_helper_funcs intel_helper_funcs = {
716 + .dpms = intel_crtc_dpms,
717 + .mode_fixup = intel_crtc_mode_fixup,
718 + .mode_set = intel_crtc_mode_set,
719 + .mode_set_base = intel_pipe_set_base,
720 + .mode_set_base_atomic = intel_pipe_set_base_atomic,
721 + .load_lut = intel_crtc_load_lut,
722 + .disable = intel_crtc_disable,
723 +};
724 +
725 +static const struct drm_crtc_funcs intel_crtc_funcs = {
726 + .reset = intel_crtc_reset,
727 + .cursor_set = intel_crtc_cursor_set,
728 + .cursor_move = intel_crtc_cursor_move,
729 + .gamma_set = intel_crtc_gamma_set,
730 + .set_config = drm_crtc_helper_set_config,
731 + .destroy = intel_crtc_destroy,
732 + .page_flip = intel_crtc_page_flip,
733 +};
734 +
735 static void intel_crtc_init(struct drm_device *dev, int pipe)
736 {
737 drm_i915_private_t *dev_priv = dev->dev_private;
738 @@ -5759,8 +5765,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
739
740 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer,
741 (unsigned long)intel_crtc);
742 -
743 - intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
744 }
745
746 int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
747 diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
748 index fe4a53a..65edb22 100644
749 --- a/drivers/gpu/drm/i915/intel_tv.c
750 +++ b/drivers/gpu/drm/i915/intel_tv.c
751 @@ -1380,7 +1380,9 @@ intel_tv_detect(struct drm_connector *connector, bool force)
752 if (type < 0)
753 return connector_status_disconnected;
754
755 + intel_tv->type = type;
756 intel_tv_find_better_format(connector);
757 +
758 return connector_status_connected;
759 }
760
761 diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
762 index 60769d2..7826be0 100644
763 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
764 +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
765 @@ -181,13 +181,13 @@ nouveau_fbcon_sync(struct fb_info *info)
766 OUT_RING (chan, 0);
767 }
768
769 - nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy + 3, 0xffffffff);
770 + nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3, 0xffffffff);
771 FIRE_RING(chan);
772 mutex_unlock(&chan->mutex);
773
774 ret = -EBUSY;
775 for (i = 0; i < 100000; i++) {
776 - if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy + 3)) {
777 + if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3)) {
778 ret = 0;
779 break;
780 }
781 diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
782 index d71d375..7bd7456 100644
783 --- a/drivers/gpu/drm/radeon/atom.c
784 +++ b/drivers/gpu/drm/radeon/atom.c
785 @@ -135,7 +135,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
786 case ATOM_IIO_MOVE_INDEX:
787 temp &=
788 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
789 - CU8(base + 2));
790 + CU8(base + 3));
791 temp |=
792 ((index >> CU8(base + 2)) &
793 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
794 @@ -145,7 +145,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
795 case ATOM_IIO_MOVE_DATA:
796 temp &=
797 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
798 - CU8(base + 2));
799 + CU8(base + 3));
800 temp |=
801 ((data >> CU8(base + 2)) &
802 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
803 @@ -155,7 +155,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
804 case ATOM_IIO_MOVE_ATTR:
805 temp &=
806 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
807 - CU8(base + 2));
808 + CU8(base + 3));
809 temp |=
810 ((ctx->
811 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 -
812 diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
813 index 0861257..bede31c 100644
814 --- a/drivers/gpu/drm/radeon/atombios_crtc.c
815 +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
816 @@ -532,10 +532,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
817 else
818 pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
819
820 - if ((rdev->family == CHIP_R600) ||
821 - (rdev->family == CHIP_RV610) ||
822 - (rdev->family == CHIP_RV630) ||
823 - (rdev->family == CHIP_RV670))
824 + if (rdev->family < CHIP_RV770)
825 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
826 } else {
827 pll->flags |= RADEON_PLL_LEGACY;
828 @@ -565,7 +562,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
829 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
830 if (ss_enabled) {
831 if (ss->refdiv) {
832 - pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
833 pll->flags |= RADEON_PLL_USE_REF_DIV;
834 pll->reference_div = ss->refdiv;
835 if (ASIC_IS_AVIVO(rdev))
836 diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
837 index 53e6273..c35ab94 100644
838 --- a/drivers/input/xen-kbdfront.c
839 +++ b/drivers/input/xen-kbdfront.c
840 @@ -286,7 +286,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
841 enum xenbus_state backend_state)
842 {
843 struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
844 - int val;
845 + int ret, val;
846
847 switch (backend_state) {
848 case XenbusStateInitialising:
849 @@ -299,6 +299,16 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
850
851 case XenbusStateInitWait:
852 InitWait:
853 + ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
854 + "feature-abs-pointer", "%d", &val);
855 + if (ret < 0)
856 + val = 0;
857 + if (val) {
858 + ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
859 + "request-abs-pointer", "1");
860 + if (ret)
861 + pr_warning("can't request abs-pointer\n");
862 + }
863 xenbus_switch_state(dev, XenbusStateConnected);
864 break;
865
866 diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
867 index 227c020..4f3e3ce 100644
868 --- a/drivers/media/dvb/b2c2/flexcop-pci.c
869 +++ b/drivers/media/dvb/b2c2/flexcop-pci.c
870 @@ -38,7 +38,7 @@ MODULE_PARM_DESC(debug,
871 DEBSTATUS);
872
873 #define DRIVER_VERSION "0.1"
874 -#define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver"
875 +#define DRIVER_NAME "flexcop-pci"
876 #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>"
877
878 struct flexcop_pci {
879 diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
880 index a113805..10f86e0 100644
881 --- a/drivers/net/netxen/netxen_nic.h
882 +++ b/drivers/net/netxen/netxen_nic.h
883 @@ -174,7 +174,7 @@
884
885 #define MAX_NUM_CARDS 4
886
887 -#define MAX_BUFFERS_PER_CMD 32
888 +#define NETXEN_MAX_FRAGS_PER_TX 14
889 #define MAX_TSO_HEADER_DESC 2
890 #define MGMT_CMD_DESC_RESV 4
891 #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \
892 @@ -558,7 +558,7 @@ struct netxen_recv_crb {
893 */
894 struct netxen_cmd_buffer {
895 struct sk_buff *skb;
896 - struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1];
897 + struct netxen_skb_frag frag_array[MAX_SKB_FRAGS + 1];
898 u32 frag_count;
899 };
900
901 diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
902 index 33fac32..28139df 100644
903 --- a/drivers/net/netxen/netxen_nic_main.c
904 +++ b/drivers/net/netxen/netxen_nic_main.c
905 @@ -1841,6 +1841,8 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
906 struct cmd_desc_type0 *hwdesc, *first_desc;
907 struct pci_dev *pdev;
908 int i, k;
909 + int delta = 0;
910 + struct skb_frag_struct *frag;
911
912 u32 producer;
913 int frag_count, no_of_desc;
914 @@ -1848,6 +1850,21 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
915
916 frag_count = skb_shinfo(skb)->nr_frags + 1;
917
918 + /* 14 frags supported for normal packet and
919 + * 32 frags supported for TSO packet
920 + */
921 + if (!skb_is_gso(skb) && frag_count > NETXEN_MAX_FRAGS_PER_TX) {
922 +
923 + for (i = 0; i < (frag_count - NETXEN_MAX_FRAGS_PER_TX); i++) {
924 + frag = &skb_shinfo(skb)->frags[i];
925 + delta += frag->size;
926 + }
927 +
928 + if (!__pskb_pull_tail(skb, delta))
929 + goto drop_packet;
930 +
931 + frag_count = 1 + skb_shinfo(skb)->nr_frags;
932 + }
933 /* 4 fragments per cmd des */
934 no_of_desc = (frag_count + 3) >> 2;
935
936 diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
937 index 44e316f..0f136ff 100644
938 --- a/drivers/net/qlcnic/qlcnic.h
939 +++ b/drivers/net/qlcnic/qlcnic.h
940 @@ -99,6 +99,7 @@
941 #define TX_UDPV6_PKT 0x0c
942
943 /* Tx defines */
944 +#define QLCNIC_MAX_FRAGS_PER_TX 14
945 #define MAX_TSO_HEADER_DESC 2
946 #define MGMT_CMD_DESC_RESV 4
947 #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \
948 diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
949 index 37c04b4..92619d7 100644
950 --- a/drivers/net/qlcnic/qlcnic_main.c
951 +++ b/drivers/net/qlcnic/qlcnic_main.c
952 @@ -2099,6 +2099,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
953 struct cmd_desc_type0 *hwdesc, *first_desc;
954 struct pci_dev *pdev;
955 struct ethhdr *phdr;
956 + int delta = 0;
957 int i, k;
958
959 u32 producer;
960 @@ -2118,6 +2119,19 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
961 }
962
963 frag_count = skb_shinfo(skb)->nr_frags + 1;
964 + /* 14 frags supported for normal packet and
965 + * 32 frags supported for TSO packet
966 + */
967 + if (!skb_is_gso(skb) && frag_count > QLCNIC_MAX_FRAGS_PER_TX) {
968 +
969 + for (i = 0; i < (frag_count - QLCNIC_MAX_FRAGS_PER_TX); i++)
970 + delta += skb_shinfo(skb)->frags[i].size;
971 +
972 + if (!__pskb_pull_tail(skb, delta))
973 + goto drop_packet;
974 +
975 + frag_count = 1 + skb_shinfo(skb)->nr_frags;
976 + }
977
978 /* 4 fragments per cmd des */
979 no_of_desc = (frag_count + 3) >> 2;
980 diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
981 index 4ceddbb..038a0cb 100644
982 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
983 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
984 @@ -615,7 +615,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
985 */
986 if (rxsp->status11 & AR_CRCErr)
987 rxs->rs_status |= ATH9K_RXERR_CRC;
988 - if (rxsp->status11 & AR_PHYErr) {
989 + else if (rxsp->status11 & AR_PHYErr) {
990 phyerr = MS(rxsp->status11, AR_PHYErrCode);
991 /*
992 * If we reach a point here where AR_PostDelimCRCErr is
993 @@ -638,11 +638,11 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
994 rxs->rs_phyerr = phyerr;
995 }
996
997 - }
998 - if (rxsp->status11 & AR_DecryptCRCErr)
999 + } else if (rxsp->status11 & AR_DecryptCRCErr)
1000 rxs->rs_status |= ATH9K_RXERR_DECRYPT;
1001 - if (rxsp->status11 & AR_MichaelErr)
1002 + else if (rxsp->status11 & AR_MichaelErr)
1003 rxs->rs_status |= ATH9K_RXERR_MIC;
1004 +
1005 if (rxsp->status11 & AR_KeyMiss)
1006 rxs->rs_status |= ATH9K_RXERR_DECRYPT;
1007 }
1008 diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
1009 index 7c0a7c4..a3b77ae 100644
1010 --- a/drivers/net/wireless/ath/ath9k/hw.c
1011 +++ b/drivers/net/wireless/ath/ath9k/hw.c
1012 @@ -1218,15 +1218,6 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1013 ah->txchainmask = common->tx_chainmask;
1014 ah->rxchainmask = common->rx_chainmask;
1015
1016 - if ((common->bus_ops->ath_bus_type != ATH_USB) && !ah->chip_fullsleep) {
1017 - ath9k_hw_abortpcurecv(ah);
1018 - if (!ath9k_hw_stopdmarecv(ah)) {
1019 - ath_dbg(common, ATH_DBG_XMIT,
1020 - "Failed to stop receive dma\n");
1021 - bChannelChange = false;
1022 - }
1023 - }
1024 -
1025 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
1026 return -EIO;
1027
1028 diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
1029 index 2915b11..e9fc97d 100644
1030 --- a/drivers/net/wireless/ath/ath9k/mac.c
1031 +++ b/drivers/net/wireless/ath/ath9k/mac.c
1032 @@ -690,17 +690,23 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
1033 rs->rs_flags |= ATH9K_RX_DECRYPT_BUSY;
1034
1035 if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) {
1036 + /*
1037 + * Treat these errors as mutually exclusive to avoid spurious
1038 + * extra error reports from the hardware. If a CRC error is
1039 + * reported, then decryption and MIC errors are irrelevant,
1040 + * the frame is going to be dropped either way
1041 + */
1042 if (ads.ds_rxstatus8 & AR_CRCErr)
1043 rs->rs_status |= ATH9K_RXERR_CRC;
1044 - if (ads.ds_rxstatus8 & AR_PHYErr) {
1045 + else if (ads.ds_rxstatus8 & AR_PHYErr) {
1046 rs->rs_status |= ATH9K_RXERR_PHY;
1047 phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode);
1048 rs->rs_phyerr = phyerr;
1049 - }
1050 - if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
1051 + } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
1052 rs->rs_status |= ATH9K_RXERR_DECRYPT;
1053 - if (ads.ds_rxstatus8 & AR_MichaelErr)
1054 + else if (ads.ds_rxstatus8 & AR_MichaelErr)
1055 rs->rs_status |= ATH9K_RXERR_MIC;
1056 +
1057 if (ads.ds_rxstatus8 & AR_KeyMiss)
1058 rs->rs_status |= ATH9K_RXERR_DECRYPT;
1059 }
1060 @@ -770,28 +776,47 @@ void ath9k_hw_abortpcurecv(struct ath_hw *ah)
1061 }
1062 EXPORT_SYMBOL(ath9k_hw_abortpcurecv);
1063
1064 -bool ath9k_hw_stopdmarecv(struct ath_hw *ah)
1065 +bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset)
1066 {
1067 #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
1068 #define AH_RX_TIME_QUANTUM 100 /* usec */
1069 struct ath_common *common = ath9k_hw_common(ah);
1070 + u32 mac_status, last_mac_status = 0;
1071 int i;
1072
1073 + /* Enable access to the DMA observation bus */
1074 + REG_WRITE(ah, AR_MACMISC,
1075 + ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
1076 + (AR_MACMISC_MISC_OBS_BUS_1 <<
1077 + AR_MACMISC_MISC_OBS_BUS_MSB_S)));
1078 +
1079 REG_WRITE(ah, AR_CR, AR_CR_RXD);
1080
1081 /* Wait for rx enable bit to go low */
1082 for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) {
1083 if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0)
1084 break;
1085 +
1086 + if (!AR_SREV_9300_20_OR_LATER(ah)) {
1087 + mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0;
1088 + if (mac_status == 0x1c0 && mac_status == last_mac_status) {
1089 + *reset = true;
1090 + break;
1091 + }
1092 +
1093 + last_mac_status = mac_status;
1094 + }
1095 +
1096 udelay(AH_TIME_QUANTUM);
1097 }
1098
1099 if (i == 0) {
1100 ath_err(common,
1101 - "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n",
1102 + "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n",
1103 AH_RX_STOP_DMA_TIMEOUT / 1000,
1104 REG_READ(ah, AR_CR),
1105 - REG_READ(ah, AR_DIAG_SW));
1106 + REG_READ(ah, AR_DIAG_SW),
1107 + REG_READ(ah, AR_DMADBG_7));
1108 return false;
1109 } else {
1110 return true;
1111 diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
1112 index 7512f97..d9cc299 100644
1113 --- a/drivers/net/wireless/ath/ath9k/mac.h
1114 +++ b/drivers/net/wireless/ath/ath9k/mac.h
1115 @@ -692,7 +692,7 @@ bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set);
1116 void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
1117 void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning);
1118 void ath9k_hw_abortpcurecv(struct ath_hw *ah);
1119 -bool ath9k_hw_stopdmarecv(struct ath_hw *ah);
1120 +bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset);
1121 int ath9k_hw_beaconq_setup(struct ath_hw *ah);
1122
1123 /* Interrupt Handling */
1124 diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
1125 index 3867a2e..89546bc 100644
1126 --- a/drivers/net/wireless/ath/ath9k/recv.c
1127 +++ b/drivers/net/wireless/ath/ath9k/recv.c
1128 @@ -513,12 +513,12 @@ start_recv:
1129 bool ath_stoprecv(struct ath_softc *sc)
1130 {
1131 struct ath_hw *ah = sc->sc_ah;
1132 - bool stopped;
1133 + bool stopped, reset = false;
1134
1135 spin_lock_bh(&sc->rx.rxbuflock);
1136 ath9k_hw_abortpcurecv(ah);
1137 ath9k_hw_setrxfilter(ah, 0);
1138 - stopped = ath9k_hw_stopdmarecv(ah);
1139 + stopped = ath9k_hw_stopdmarecv(ah, &reset);
1140
1141 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
1142 ath_edma_stop_recv(sc);
1143 @@ -533,7 +533,7 @@ bool ath_stoprecv(struct ath_softc *sc)
1144 "confusing the DMA engine when we start RX up\n");
1145 ATH_DBG_WARN_ON_ONCE(!stopped);
1146 }
1147 - return stopped;
1148 + return stopped || reset;
1149 }
1150
1151 void ath_flushrecv(struct ath_softc *sc)
1152 diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h
1153 index 248c670..5c2cfe6 100644
1154 --- a/drivers/net/wireless/ath/regd_common.h
1155 +++ b/drivers/net/wireless/ath/regd_common.h
1156 @@ -195,6 +195,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = {
1157 {APL9_WORLD, CTL_ETSI, CTL_ETSI},
1158
1159 {APL3_FCCA, CTL_FCC, CTL_FCC},
1160 + {APL7_FCCA, CTL_FCC, CTL_FCC},
1161 {APL1_ETSIC, CTL_FCC, CTL_ETSI},
1162 {APL2_ETSIC, CTL_FCC, CTL_ETSI},
1163 {APL2_APLD, CTL_FCC, NO_CTL},
1164 diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
1165 index 65b5834..c2dd4cd 100644
1166 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
1167 +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
1168 @@ -74,8 +74,6 @@
1169 /* RSSI to dBm */
1170 #define IWL39_RSSI_OFFSET 95
1171
1172 -#define IWL_DEFAULT_TX_POWER 0x0F
1173 -
1174 /*
1175 * EEPROM related constants, enums, and structures.
1176 */
1177 diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
1178 index 39b6f16..4e7b58b 100644
1179 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c
1180 +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
1181 @@ -1823,7 +1823,7 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1182
1183 /* If we issue a new RXON command which required a tune then we must
1184 * send a new TXPOWER command or we won't be able to Tx any frames */
1185 - rc = priv->cfg->ops->lib->send_tx_power(priv);
1186 + rc = iwl_set_tx_power(priv, priv->tx_power_next, true);
1187 if (rc) {
1188 IWL_ERR(priv, "Error setting Tx power (%d).\n", rc);
1189 return rc;
1190 diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
1191 index 91a9f52..992caa0 100644
1192 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c
1193 +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
1194 @@ -1571,7 +1571,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1195
1196 /* If we issue a new RXON command which required a tune then we must
1197 * send a new TXPOWER command or we won't be able to Tx any frames */
1198 - ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
1199 + ret = iwl_set_tx_power(priv, priv->tx_power_next, true);
1200 if (ret) {
1201 IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
1202 return ret;
1203 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
1204 index 6d140bd..ee802fe 100644
1205 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
1206 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
1207 @@ -288,10 +288,9 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1208 * If we issue a new RXON command which required a tune then we must
1209 * send a new TXPOWER command or we won't be able to Tx any frames.
1210 *
1211 - * FIXME: which RXON requires a tune? Can we optimise this out in
1212 - * some cases?
1213 + * It's expected we set power here if channel is changing.
1214 */
1215 - ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
1216 + ret = iwl_set_tx_power(priv, priv->tx_power_next, true);
1217 if (ret) {
1218 IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
1219 return ret;
1220 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
1221 index c1cfd99..35239f0 100644
1222 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
1223 +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
1224 @@ -3841,12 +3841,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
1225 priv->dynamic_frag_thresh = BT_FRAG_THRESHOLD_DEF;
1226 }
1227
1228 - /* Set the tx_power_user_lmt to the lowest power level
1229 - * this value will get overwritten by channel max power avg
1230 - * from eeprom */
1231 - priv->tx_power_user_lmt = IWLAGN_TX_POWER_TARGET_POWER_MIN;
1232 - priv->tx_power_next = IWLAGN_TX_POWER_TARGET_POWER_MIN;
1233 -
1234 ret = iwl_init_channel_map(priv);
1235 if (ret) {
1236 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
1237 diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
1238 index efbde1f..294e9fc 100644
1239 --- a/drivers/net/wireless/iwlwifi/iwl-core.c
1240 +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
1241 @@ -168,6 +168,7 @@ int iwlcore_init_geos(struct iwl_priv *priv)
1242 struct ieee80211_channel *geo_ch;
1243 struct ieee80211_rate *rates;
1244 int i = 0;
1245 + s8 max_tx_power = 0;
1246
1247 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
1248 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
1249 @@ -244,8 +245,8 @@ int iwlcore_init_geos(struct iwl_priv *priv)
1250
1251 geo_ch->flags |= ch->ht40_extension_channel;
1252
1253 - if (ch->max_power_avg > priv->tx_power_device_lmt)
1254 - priv->tx_power_device_lmt = ch->max_power_avg;
1255 + if (ch->max_power_avg > max_tx_power)
1256 + max_tx_power = ch->max_power_avg;
1257 } else {
1258 geo_ch->flags |= IEEE80211_CHAN_DISABLED;
1259 }
1260 @@ -258,6 +259,10 @@ int iwlcore_init_geos(struct iwl_priv *priv)
1261 geo_ch->flags);
1262 }
1263
1264 + priv->tx_power_device_lmt = max_tx_power;
1265 + priv->tx_power_user_lmt = max_tx_power;
1266 + priv->tx_power_next = max_tx_power;
1267 +
1268 if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
1269 priv->cfg->sku & IWL_SKU_A) {
1270 IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
1271 @@ -1161,6 +1166,8 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1272 {
1273 int ret;
1274 s8 prev_tx_power;
1275 + bool defer;
1276 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1277
1278 lockdep_assert_held(&priv->mutex);
1279
1280 @@ -1188,10 +1195,15 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1281 if (!iwl_is_ready_rf(priv))
1282 return -EIO;
1283
1284 - /* scan complete use tx_power_next, need to be updated */
1285 + /* scan complete and commit_rxon use tx_power_next value,
1286 + * it always need to be updated for newest request */
1287 priv->tx_power_next = tx_power;
1288 - if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
1289 - IWL_DEBUG_INFO(priv, "Deferring tx power set while scanning\n");
1290 +
1291 + /* do not set tx power when scanning or channel changing */
1292 + defer = test_bit(STATUS_SCANNING, &priv->status) ||
1293 + memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
1294 + if (defer && !force) {
1295 + IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
1296 return 0;
1297 }
1298
1299 diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
1300 index 358cfd7..8b3c127 100644
1301 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
1302 +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
1303 @@ -724,13 +724,6 @@ int iwl_init_channel_map(struct iwl_priv *priv)
1304 flags & EEPROM_CHANNEL_RADAR))
1305 ? "" : "not ");
1306
1307 - /* Set the tx_power_user_lmt to the highest power
1308 - * supported by any channel */
1309 - if (eeprom_ch_info[ch].max_power_avg >
1310 - priv->tx_power_user_lmt)
1311 - priv->tx_power_user_lmt =
1312 - eeprom_ch_info[ch].max_power_avg;
1313 -
1314 ch_info++;
1315 }
1316 }
1317 diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
1318 index 371abbf..64917ed 100644
1319 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
1320 +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
1321 @@ -94,6 +94,7 @@ MODULE_LICENSE("GPL");
1322 struct iwl_mod_params iwl3945_mod_params = {
1323 .sw_crypto = 1,
1324 .restart_fw = 1,
1325 + .disable_hw_scan = 1,
1326 /* the rest are 0 by default */
1327 };
1328
1329 @@ -3858,10 +3859,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
1330 priv->force_reset[IWL_FW_RESET].reset_duration =
1331 IWL_DELAY_NEXT_FORCE_FW_RELOAD;
1332
1333 -
1334 - priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
1335 - priv->tx_power_next = IWL_DEFAULT_TX_POWER;
1336 -
1337 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
1338 IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
1339 eeprom->version);
1340 @@ -3995,8 +3992,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
1341 * "the hard way", rather than using device's scan.
1342 */
1343 if (iwl3945_mod_params.disable_hw_scan) {
1344 - dev_printk(KERN_DEBUG, &(pdev->dev),
1345 - "sw scan support is deprecated\n");
1346 + IWL_DEBUG_INFO(priv, "Disabling hw_scan\n");
1347 iwl3945_hw_ops.hw_scan = NULL;
1348 }
1349
1350 @@ -4318,8 +4314,7 @@ MODULE_PARM_DESC(debug, "debug output mask");
1351 #endif
1352 module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan,
1353 int, S_IRUGO);
1354 -MODULE_PARM_DESC(disable_hw_scan,
1355 - "disable hardware scanning (default 0) (deprecated)");
1356 +MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)");
1357 module_param_named(fw_restart3945, iwl3945_mod_params.restart_fw, int, S_IRUGO);
1358 MODULE_PARM_DESC(fw_restart3945, "restart firmware in case of error");
1359
1360 diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
1361 index f618b96..2cfdd38 100644
1362 --- a/drivers/net/wireless/p54/txrx.c
1363 +++ b/drivers/net/wireless/p54/txrx.c
1364 @@ -705,7 +705,7 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
1365 struct p54_tx_info *p54info;
1366 struct p54_hdr *hdr;
1367 struct p54_tx_data *txhdr;
1368 - unsigned int padding, len, extra_len;
1369 + unsigned int padding, len, extra_len = 0;
1370 int i, j, ridx;
1371 u16 hdr_flags = 0, aid = 0;
1372 u8 rate, queue = 0, crypt_offset = 0;
1373 diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
1374 index 4789f8e..5dc5d3e 100644
1375 --- a/drivers/pci/intel-iommu.c
1376 +++ b/drivers/pci/intel-iommu.c
1377 @@ -1835,7 +1835,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
1378
1379 ret = iommu_attach_domain(domain, iommu);
1380 if (ret) {
1381 - domain_exit(domain);
1382 + free_domain_mem(domain);
1383 goto error;
1384 }
1385
1386 @@ -3260,9 +3260,15 @@ static int device_notifier(struct notifier_block *nb,
1387 if (!domain)
1388 return 0;
1389
1390 - if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through)
1391 + if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) {
1392 domain_remove_one_dev_info(domain, pdev);
1393
1394 + if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
1395 + !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) &&
1396 + list_empty(&domain->devices))
1397 + domain_exit(domain);
1398 + }
1399 +
1400 return 0;
1401 }
1402
1403 @@ -3411,6 +3417,11 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
1404 domain->iommu_count--;
1405 domain_update_iommu_cap(domain);
1406 spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags);
1407 +
1408 + spin_lock_irqsave(&iommu->lock, tmp_flags);
1409 + clear_bit(domain->id, iommu->domain_ids);
1410 + iommu->domains[domain->id] = NULL;
1411 + spin_unlock_irqrestore(&iommu->lock, tmp_flags);
1412 }
1413
1414 spin_unlock_irqrestore(&device_domain_lock, flags);
1415 @@ -3627,9 +3638,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
1416
1417 pte = dmar_domain->pgd;
1418 if (dma_pte_present(pte)) {
1419 - free_pgtable_page(dmar_domain->pgd);
1420 dmar_domain->pgd = (struct dma_pte *)
1421 phys_to_virt(dma_pte_addr(pte));
1422 + free_pgtable_page(pte);
1423 }
1424 dmar_domain->agaw--;
1425 }
1426 diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
1427 index 114d952..21b1018 100644
1428 --- a/drivers/platform/x86/ideapad-laptop.c
1429 +++ b/drivers/platform/x86/ideapad-laptop.c
1430 @@ -459,6 +459,8 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
1431 if (test_bit(vpc_bit, &vpc1)) {
1432 if (vpc_bit == 9)
1433 ideapad_sync_rfk_state(adevice);
1434 + else if (vpc_bit == 4)
1435 + read_ec_data(handle, 0x12, &vpc2);
1436 else
1437 ideapad_input_report(priv, vpc_bit);
1438 }
1439 diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
1440 index aa2e5d3..c4b0ef1 100644
1441 --- a/drivers/tty/n_gsm.c
1442 +++ b/drivers/tty/n_gsm.c
1443 @@ -1659,8 +1659,12 @@ static void gsm_queue(struct gsm_mux *gsm)
1444
1445 if ((gsm->control & ~PF) == UI)
1446 gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len);
1447 - /* generate final CRC with received FCS */
1448 - gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
1449 + if (gsm->encoding == 0){
1450 + /* WARNING: gsm->received_fcs is used for gsm->encoding = 0 only.
1451 + In this case it contain the last piece of data
1452 + required to generate final CRC */
1453 + gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
1454 + }
1455 if (gsm->fcs != GOOD_FCS) {
1456 gsm->bad_fcs++;
1457 if (debug & 4)
1458 diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
1459 index dfcf4b1..0d66751 100644
1460 --- a/drivers/tty/serial/imx.c
1461 +++ b/drivers/tty/serial/imx.c
1462 @@ -382,12 +382,13 @@ static void imx_start_tx(struct uart_port *port)
1463 static irqreturn_t imx_rtsint(int irq, void *dev_id)
1464 {
1465 struct imx_port *sport = dev_id;
1466 - unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS;
1467 + unsigned int val;
1468 unsigned long flags;
1469
1470 spin_lock_irqsave(&sport->port.lock, flags);
1471
1472 writel(USR1_RTSD, sport->port.membase + USR1);
1473 + val = readl(sport->port.membase + USR1) & USR1_RTSS;
1474 uart_handle_cts_change(&sport->port, !!val);
1475 wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
1476
1477 diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
1478 index cc2f73e..b0043fb 100644
1479 --- a/drivers/virtio/virtio_ring.c
1480 +++ b/drivers/virtio/virtio_ring.c
1481 @@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq)
1482 /* detach_buf clears data, so grab it now. */
1483 buf = vq->data[i];
1484 detach_buf(vq, i);
1485 + vq->vring.avail->idx--;
1486 END_USE(vq);
1487 return buf;
1488 }
1489 diff --git a/fs/file.c b/fs/file.c
1490 index 0be3447..4c6992d 100644
1491 --- a/fs/file.c
1492 +++ b/fs/file.c
1493 @@ -9,6 +9,7 @@
1494 #include <linux/module.h>
1495 #include <linux/fs.h>
1496 #include <linux/mm.h>
1497 +#include <linux/mmzone.h>
1498 #include <linux/time.h>
1499 #include <linux/sched.h>
1500 #include <linux/slab.h>
1501 @@ -39,14 +40,17 @@ int sysctl_nr_open_max = 1024 * 1024; /* raised later */
1502 */
1503 static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list);
1504
1505 -static inline void *alloc_fdmem(unsigned int size)
1506 +static void *alloc_fdmem(unsigned int size)
1507 {
1508 - void *data;
1509 -
1510 - data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);
1511 - if (data != NULL)
1512 - return data;
1513 -
1514 + /*
1515 + * Very large allocations can stress page reclaim, so fall back to
1516 + * vmalloc() if the allocation size will be considered "large" by the VM.
1517 + */
1518 + if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
1519 + void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);
1520 + if (data != NULL)
1521 + return data;
1522 + }
1523 return vmalloc(size);
1524 }
1525
1526 diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
1527 index 0592288..6221640 100644
1528 --- a/fs/nfs/nfs4state.c
1529 +++ b/fs/nfs/nfs4state.c
1530 @@ -1600,7 +1600,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
1531 int status = 0;
1532
1533 /* Ensure exclusive access to NFSv4 state */
1534 - for(;;) {
1535 + do {
1536 if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
1537 /* We're going to have to re-establish a clientid */
1538 status = nfs4_reclaim_lease(clp);
1539 @@ -1684,7 +1684,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
1540 break;
1541 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
1542 break;
1543 - }
1544 + } while (atomic_read(&clp->cl_count) > 1);
1545 return;
1546 out_error:
1547 printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s"
1548 diff --git a/fs/nfs/super.c b/fs/nfs/super.c
1549 index b68c860..6a2ec50 100644
1550 --- a/fs/nfs/super.c
1551 +++ b/fs/nfs/super.c
1552 @@ -2077,6 +2077,15 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
1553 if (error < 0)
1554 goto out;
1555
1556 + /*
1557 + * noac is a special case. It implies -o sync, but that's not
1558 + * necessarily reflected in the mtab options. do_remount_sb
1559 + * will clear MS_SYNCHRONOUS if -o sync wasn't specified in the
1560 + * remount options, so we have to explicitly reset it.
1561 + */
1562 + if (data->flags & NFS_MOUNT_NOAC)
1563 + *flags |= MS_SYNCHRONOUS;
1564 +
1565 /* compare new mount options with old ones */
1566 error = nfs_compare_remount_data(nfss, data);
1567 out:
1568 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1569 index 96aaaa4..18c356c 100644
1570 --- a/fs/nfsd/nfs4state.c
1571 +++ b/fs/nfsd/nfs4state.c
1572 @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp)
1573 if (atomic_dec_and_test(&fp->fi_delegees)) {
1574 vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
1575 fp->fi_lease = NULL;
1576 + fput(fp->fi_deleg_file);
1577 fp->fi_deleg_file = NULL;
1578 }
1579 }
1580 @@ -402,8 +403,8 @@ static void free_generic_stateid(struct nfs4_stateid *stp)
1581 if (stp->st_access_bmap) {
1582 oflag = nfs4_access_bmap_to_omode(stp);
1583 nfs4_file_put_access(stp->st_file, oflag);
1584 - put_nfs4_file(stp->st_file);
1585 }
1586 + put_nfs4_file(stp->st_file);
1587 kmem_cache_free(stateid_slab, stp);
1588 }
1589
1590 diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
1591 index 77e9b87..c0c590f 100644
1592 --- a/fs/ubifs/recovery.c
1593 +++ b/fs/ubifs/recovery.c
1594 @@ -300,6 +300,32 @@ int ubifs_recover_master_node(struct ubifs_info *c)
1595 goto out_free;
1596 }
1597 memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ);
1598 +
1599 + /*
1600 + * We had to recover the master node, which means there was an
1601 + * unclean reboot. However, it is possible that the master node
1602 + * is clean at this point, i.e., %UBIFS_MST_DIRTY is not set.
1603 + * E.g., consider the following chain of events:
1604 + *
1605 + * 1. UBIFS was cleanly unmounted, so the master node is clean
1606 + * 2. UBIFS is being mounted R/W and starts changing the master
1607 + * node in the first (%UBIFS_MST_LNUM). A power cut happens,
1608 + * so this LEB ends up with some amount of garbage at the
1609 + * end.
1610 + * 3. UBIFS is being mounted R/O. We reach this place and
1611 + * recover the master node from the second LEB
1612 + * (%UBIFS_MST_LNUM + 1). But we cannot update the media
1613 + * because we are being mounted R/O. We have to defer the
1614 + * operation.
1615 + * 4. However, this master node (@c->mst_node) is marked as
1616 + * clean (since the step 1). And if we just return, the
1617 + * mount code will be confused and won't recover the master
1618 + * node when it is re-mounter R/W later.
1619 + *
1620 + * Thus, to force the recovery by marking the master node as
1621 + * dirty.
1622 + */
1623 + c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
1624 } else {
1625 /* Write the recovered master node */
1626 c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1;
1627 diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
1628 index 0f029e1..e94d962 100644
1629 --- a/fs/ubifs/super.c
1630 +++ b/fs/ubifs/super.c
1631 @@ -1643,15 +1643,27 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1632 if (err)
1633 goto out;
1634
1635 + dbg_gen("re-mounted read-write");
1636 + c->remounting_rw = 0;
1637 +
1638 if (c->need_recovery) {
1639 c->need_recovery = 0;
1640 ubifs_msg("deferred recovery completed");
1641 + } else {
1642 + /*
1643 + * Do not run the debugging space check if the were doing
1644 + * recovery, because when we saved the information we had the
1645 + * file-system in a state where the TNC and lprops has been
1646 + * modified in memory, but all the I/O operations (including a
1647 + * commit) were deferred. So the file-system was in
1648 + * "non-committed" state. Now the file-system is in committed
1649 + * state, and of course the amount of free space will change
1650 + * because, for example, the old index size was imprecise.
1651 + */
1652 + err = dbg_check_space_info(c);
1653 }
1654
1655 - dbg_gen("re-mounted read-write");
1656 - c->remounting_rw = 0;
1657 c->always_chk_crc = 0;
1658 - err = dbg_check_space_info(c);
1659 mutex_unlock(&c->umount_mutex);
1660 return err;
1661
1662 diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
1663 index df29c8f..8847c8c 100644
1664 --- a/include/linux/huge_mm.h
1665 +++ b/include/linux/huge_mm.h
1666 @@ -117,7 +117,7 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
1667 unsigned long end,
1668 long adjust_next)
1669 {
1670 - if (!vma->anon_vma || vma->vm_ops || vma->vm_file)
1671 + if (!vma->anon_vma || vma->vm_ops)
1672 return;
1673 __vma_adjust_trans_huge(vma, start, end, adjust_next);
1674 }
1675 diff --git a/include/linux/libata.h b/include/linux/libata.h
1676 index c9c5d7a..1f00080 100644
1677 --- a/include/linux/libata.h
1678 +++ b/include/linux/libata.h
1679 @@ -203,6 +203,7 @@ enum {
1680 * management */
1681 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
1682 * led */
1683 + ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */
1684
1685 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
1686
1687 diff --git a/include/linux/mm.h b/include/linux/mm.h
1688 index c67adb4..248c946 100644
1689 --- a/include/linux/mm.h
1690 +++ b/include/linux/mm.h
1691 @@ -137,7 +137,8 @@ extern unsigned int kobjsize(const void *objp);
1692 #define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
1693
1694 /*
1695 - * special vmas that are non-mergable, non-mlock()able
1696 + * Special vmas that are non-mergable, non-mlock()able.
1697 + * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
1698 */
1699 #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)
1700
1701 diff --git a/init/Kconfig b/init/Kconfig
1702 index be788c0..47dd02f 100644
1703 --- a/init/Kconfig
1704 +++ b/init/Kconfig
1705 @@ -1209,6 +1209,7 @@ config SLAB
1706 per cpu and per node queues.
1707
1708 config SLUB
1709 + depends on BROKEN || NUMA || !DISCONTIGMEM
1710 bool "SLUB (Unqueued Allocator)"
1711 help
1712 SLUB is a slab allocator that minimizes cache line usage
1713 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
1714 index 8f76561..56cac93 100644
1715 --- a/mm/huge_memory.c
1716 +++ b/mm/huge_memory.c
1717 @@ -1400,6 +1400,9 @@ out:
1718 return ret;
1719 }
1720
1721 +#define VM_NO_THP (VM_SPECIAL|VM_INSERTPAGE|VM_MIXEDMAP|VM_SAO| \
1722 + VM_HUGETLB|VM_SHARED|VM_MAYSHARE)
1723 +
1724 int hugepage_madvise(struct vm_area_struct *vma,
1725 unsigned long *vm_flags, int advice)
1726 {
1727 @@ -1408,11 +1411,7 @@ int hugepage_madvise(struct vm_area_struct *vma,
1728 /*
1729 * Be somewhat over-protective like KSM for now!
1730 */
1731 - if (*vm_flags & (VM_HUGEPAGE |
1732 - VM_SHARED | VM_MAYSHARE |
1733 - VM_PFNMAP | VM_IO | VM_DONTEXPAND |
1734 - VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE |
1735 - VM_MIXEDMAP | VM_SAO))
1736 + if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP))
1737 return -EINVAL;
1738 *vm_flags &= ~VM_NOHUGEPAGE;
1739 *vm_flags |= VM_HUGEPAGE;
1740 @@ -1428,11 +1427,7 @@ int hugepage_madvise(struct vm_area_struct *vma,
1741 /*
1742 * Be somewhat over-protective like KSM for now!
1743 */
1744 - if (*vm_flags & (VM_NOHUGEPAGE |
1745 - VM_SHARED | VM_MAYSHARE |
1746 - VM_PFNMAP | VM_IO | VM_DONTEXPAND |
1747 - VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE |
1748 - VM_MIXEDMAP | VM_SAO))
1749 + if (*vm_flags & (VM_NOHUGEPAGE | VM_NO_THP))
1750 return -EINVAL;
1751 *vm_flags &= ~VM_HUGEPAGE;
1752 *vm_flags |= VM_NOHUGEPAGE;
1753 @@ -1566,10 +1561,14 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma)
1754 * page fault if needed.
1755 */
1756 return 0;
1757 - if (vma->vm_file || vma->vm_ops)
1758 + if (vma->vm_ops)
1759 /* khugepaged not yet working on file or special mappings */
1760 return 0;
1761 - VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma));
1762 + /*
1763 + * If is_pfn_mapping() is true is_learn_pfn_mapping() must be
1764 + * true too, verify it here.
1765 + */
1766 + VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP);
1767 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
1768 hend = vma->vm_end & HPAGE_PMD_MASK;
1769 if (hstart < hend)
1770 @@ -1818,12 +1817,15 @@ static void collapse_huge_page(struct mm_struct *mm,
1771 (vma->vm_flags & VM_NOHUGEPAGE))
1772 goto out;
1773
1774 - /* VM_PFNMAP vmas may have vm_ops null but vm_file set */
1775 - if (!vma->anon_vma || vma->vm_ops || vma->vm_file)
1776 + if (!vma->anon_vma || vma->vm_ops)
1777 goto out;
1778 if (is_vma_temporary_stack(vma))
1779 goto out;
1780 - VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma));
1781 + /*
1782 + * If is_pfn_mapping() is true is_learn_pfn_mapping() must be
1783 + * true too, verify it here.
1784 + */
1785 + VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP);
1786
1787 pgd = pgd_offset(mm, address);
1788 if (!pgd_present(*pgd))
1789 @@ -2056,13 +2058,16 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
1790 progress++;
1791 continue;
1792 }
1793 - /* VM_PFNMAP vmas may have vm_ops null but vm_file set */
1794 - if (!vma->anon_vma || vma->vm_ops || vma->vm_file)
1795 + if (!vma->anon_vma || vma->vm_ops)
1796 goto skip;
1797 if (is_vma_temporary_stack(vma))
1798 goto skip;
1799 -
1800 - VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma));
1801 + /*
1802 + * If is_pfn_mapping() is true is_learn_pfn_mapping()
1803 + * must be true too, verify it here.
1804 + */
1805 + VM_BUG_ON(is_linear_pfn_mapping(vma) ||
1806 + vma->vm_flags & VM_NO_THP);
1807
1808 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
1809 hend = vma->vm_end & HPAGE_PMD_MASK;
1810 diff --git a/mm/memory.c b/mm/memory.c
1811 index f17746a..ab88d09 100644
1812 --- a/mm/memory.c
1813 +++ b/mm/memory.c
1814 @@ -3332,7 +3332,7 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
1815 * run pte_offset_map on the pmd, if an huge pmd could
1816 * materialize from under us from a different thread.
1817 */
1818 - if (unlikely(__pte_alloc(mm, vma, pmd, address)))
1819 + if (unlikely(pmd_none(*pmd)) && __pte_alloc(mm, vma, pmd, address))
1820 return VM_FAULT_OOM;
1821 /* if an huge pmd materialized from under us just retry later */
1822 if (unlikely(pmd_trans_huge(*pmd)))
1823 diff --git a/mm/oom_kill.c b/mm/oom_kill.c
1824 index ea16f72..49ea0cc 100644
1825 --- a/mm/oom_kill.c
1826 +++ b/mm/oom_kill.c
1827 @@ -172,10 +172,13 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
1828
1829 /*
1830 * The baseline for the badness score is the proportion of RAM that each
1831 - * task's rss and swap space use.
1832 + * task's rss, pagetable and swap space use.
1833 */
1834 - points = (get_mm_rss(p->mm) + get_mm_counter(p->mm, MM_SWAPENTS)) * 1000 /
1835 - totalpages;
1836 + points = get_mm_rss(p->mm) + p->mm->nr_ptes;
1837 + points += get_mm_counter(p->mm, MM_SWAPENTS);
1838 +
1839 + points *= 1000;
1840 + points /= totalpages;
1841 task_unlock(p);
1842
1843 /*
1844 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
1845 index 659326c..006ad81 100644
1846 --- a/scripts/kconfig/conf.c
1847 +++ b/scripts/kconfig/conf.c
1848 @@ -332,7 +332,7 @@ static int conf_choice(struct menu *menu)
1849 }
1850 if (!child)
1851 continue;
1852 - if (line[strlen(line) - 1] == '?') {
1853 + if (line[0] && line[strlen(line) - 1] == '?') {
1854 print_help(child);
1855 continue;
1856 }
1857 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1858 index da7cdca..8ff0223 100644
1859 --- a/sound/pci/hda/patch_realtek.c
1860 +++ b/sound/pci/hda/patch_realtek.c
1861 @@ -14945,6 +14945,23 @@ static void alc269_fixup_hweq(struct hda_codec *codec,
1862 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
1863 }
1864
1865 +static void alc271_fixup_dmic(struct hda_codec *codec,
1866 + const struct alc_fixup *fix, int action)
1867 +{
1868 + static struct hda_verb verbs[] = {
1869 + {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
1870 + {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
1871 + {}
1872 + };
1873 + unsigned int cfg;
1874 +
1875 + if (strcmp(codec->chip_name, "ALC271X"))
1876 + return;
1877 + cfg = snd_hda_codec_get_pincfg(codec, 0x12);
1878 + if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
1879 + snd_hda_sequence_write(codec, verbs);
1880 +}
1881 +
1882 enum {
1883 ALC269_FIXUP_SONY_VAIO,
1884 ALC275_FIXUP_SONY_VAIO_GPIO2,
1885 @@ -14953,6 +14970,7 @@ enum {
1886 ALC269_FIXUP_ASUS_G73JW,
1887 ALC269_FIXUP_LENOVO_EAPD,
1888 ALC275_FIXUP_SONY_HWEQ,
1889 + ALC271_FIXUP_DMIC,
1890 };
1891
1892 static const struct alc_fixup alc269_fixups[] = {
1893 @@ -15006,7 +15024,11 @@ static const struct alc_fixup alc269_fixups[] = {
1894 .v.func = alc269_fixup_hweq,
1895 .chained = true,
1896 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
1897 - }
1898 + },
1899 + [ALC271_FIXUP_DMIC] = {
1900 + .type = ALC_FIXUP_FUNC,
1901 + .v.func = alc271_fixup_dmic,
1902 + },
1903 };
1904
1905 static struct snd_pci_quirk alc269_fixup_tbl[] = {
1906 @@ -15015,6 +15037,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = {
1907 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
1908 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
1909 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
1910 + SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
1911 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
1912 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
1913 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
1914 diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c
1915 index f7cd346..f5ccdbf 100644
1916 --- a/sound/soc/codecs/jz4740.c
1917 +++ b/sound/soc/codecs/jz4740.c
1918 @@ -308,8 +308,6 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
1919 snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes,
1920 ARRAY_SIZE(jz4740_codec_dapm_routes));
1921
1922 - snd_soc_dapm_new_widgets(codec);
1923 -
1924 jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1925
1926 return 0;
1927 diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
1928 index 5168927..d365f43 100644
1929 --- a/sound/soc/codecs/wm_hubs.c
1930 +++ b/sound/soc/codecs/wm_hubs.c
1931 @@ -739,12 +739,12 @@ static const struct snd_soc_dapm_route analogue_routes[] = {
1932
1933 { "SPKL", "Input Switch", "MIXINL" },
1934 { "SPKL", "IN1LP Switch", "IN1LP" },
1935 - { "SPKL", "Output Switch", "Left Output Mixer" },
1936 + { "SPKL", "Output Switch", "Left Output PGA" },
1937 { "SPKL", NULL, "TOCLK" },
1938
1939 { "SPKR", "Input Switch", "MIXINR" },
1940 { "SPKR", "IN1RP Switch", "IN1RP" },
1941 - { "SPKR", "Output Switch", "Right Output Mixer" },
1942 + { "SPKR", "Output Switch", "Right Output PGA" },
1943 { "SPKR", NULL, "TOCLK" },
1944
1945 { "SPKL Boost", "Direct Voice Switch", "Direct Voice" },
1946 @@ -766,8 +766,8 @@ static const struct snd_soc_dapm_route analogue_routes[] = {
1947 { "SPKOUTRP", NULL, "SPKR Driver" },
1948 { "SPKOUTRN", NULL, "SPKR Driver" },
1949
1950 - { "Left Headphone Mux", "Mixer", "Left Output Mixer" },
1951 - { "Right Headphone Mux", "Mixer", "Right Output Mixer" },
1952 + { "Left Headphone Mux", "Mixer", "Left Output PGA" },
1953 + { "Right Headphone Mux", "Mixer", "Right Output PGA" },
1954
1955 { "Headphone PGA", NULL, "Left Headphone Mux" },
1956 { "Headphone PGA", NULL, "Right Headphone Mux" },

  ViewVC Help
Powered by ViewVC 1.1.20