~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to debian/patches/bugfix/all/stable/2.6.38.5.patch

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

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