Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.39-r2/0101-2.6.39.2-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1424 - (show annotations) (download)
Mon Jul 18 14:29:21 2011 UTC (12 years, 9 months ago) by niro
File size: 97911 byte(s)
-2.6.39-magellan-r2: -using linux-2.6.39.3 and removed deprecated acpi procfs options from config
1 diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
2 index cc85a92..066b642 100644
3 --- a/Documentation/kernel-parameters.txt
4 +++ b/Documentation/kernel-parameters.txt
5 @@ -2590,6 +2590,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
6 unlock ejectable media);
7 m = MAX_SECTORS_64 (don't transfer more
8 than 64 sectors = 32 KB at a time);
9 + n = INITIAL_READ10 (force a retry of the
10 + initial READ(10) command);
11 o = CAPACITY_OK (accept the capacity
12 reported by the device);
13 r = IGNORE_RESIDUE (the device reports
14 diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
15 index c5c24be..727f40a 100644
16 --- a/arch/powerpc/kernel/head_32.S
17 +++ b/arch/powerpc/kernel/head_32.S
18 @@ -896,7 +896,7 @@ _GLOBAL(start_secondary_resume)
19 rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
20 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
21 li r3,0
22 - std r3,0(r1) /* Zero the stack frame pointer */
23 + stw r3,0(r1) /* Zero the stack frame pointer */
24 bl start_secondary
25 b .
26 #endif /* CONFIG_SMP */
27 diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
28 index cbdbb14..f2dcab7 100644
29 --- a/arch/powerpc/kernel/smp.c
30 +++ b/arch/powerpc/kernel/smp.c
31 @@ -410,8 +410,6 @@ int __cpuinit __cpu_up(unsigned int cpu)
32 {
33 int rc, c;
34
35 - secondary_ti = current_set[cpu];
36 -
37 if (smp_ops == NULL ||
38 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
39 return -EINVAL;
40 @@ -421,6 +419,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
41 if (rc)
42 return rc;
43
44 + secondary_ti = current_set[cpu];
45 +
46 /* Make sure callin-map entry is 0 (can be leftover a CPU
47 * hotplug
48 */
49 diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
50 index ea38f0c..1073269 100644
51 --- a/arch/tile/kernel/pci.c
52 +++ b/arch/tile/kernel/pci.c
53 @@ -179,12 +179,6 @@ int __init tile_pci_init(void)
54
55 controller = &controllers[num_controllers];
56
57 - if (tile_init_irqs(i, controller)) {
58 - pr_err("PCI: Could not initialize "
59 - "IRQs, aborting.\n");
60 - goto err_cont;
61 - }
62 -
63 controller->index = num_controllers;
64 controller->hv_cfg_fd[0] = hv_cfg_fd0;
65 controller->hv_cfg_fd[1] = hv_cfg_fd1;
66 @@ -300,6 +294,11 @@ static int __init pcibios_init(void)
67 struct pci_controller *controller = &controllers[i];
68 struct pci_bus *bus;
69
70 + if (tile_init_irqs(i, controller)) {
71 + pr_err("PCI: Could not initialize IRQS\n");
72 + continue;
73 + }
74 +
75 pr_info("PCI: initializing controller #%d\n", i);
76
77 /*
78 diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
79 index 57ca777..e7115c8 100644
80 --- a/arch/x86/kernel/amd_iommu.c
81 +++ b/arch/x86/kernel/amd_iommu.c
82 @@ -28,6 +28,7 @@
83 #include <asm/proto.h>
84 #include <asm/iommu.h>
85 #include <asm/gart.h>
86 +#include <asm/dma.h>
87 #include <asm/amd_iommu_proto.h>
88 #include <asm/amd_iommu_types.h>
89 #include <asm/amd_iommu.h>
90 @@ -153,6 +154,10 @@ static int iommu_init_device(struct device *dev)
91 pdev = pci_get_bus_and_slot(PCI_BUS(alias), alias & 0xff);
92 if (pdev)
93 dev_data->alias = &pdev->dev;
94 + else {
95 + kfree(dev_data);
96 + return -ENOTSUPP;
97 + }
98
99 atomic_set(&dev_data->bind, 0);
100
101 @@ -162,6 +167,20 @@ static int iommu_init_device(struct device *dev)
102 return 0;
103 }
104
105 +static void iommu_ignore_device(struct device *dev)
106 +{
107 + u16 devid, alias;
108 +
109 + devid = get_device_id(dev);
110 + alias = amd_iommu_alias_table[devid];
111 +
112 + memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry));
113 + memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry));
114 +
115 + amd_iommu_rlookup_table[devid] = NULL;
116 + amd_iommu_rlookup_table[alias] = NULL;
117 +}
118 +
119 static void iommu_uninit_device(struct device *dev)
120 {
121 kfree(dev->archdata.iommu);
122 @@ -191,7 +210,9 @@ int __init amd_iommu_init_devices(void)
123 continue;
124
125 ret = iommu_init_device(&pdev->dev);
126 - if (ret)
127 + if (ret == -ENOTSUPP)
128 + iommu_ignore_device(&pdev->dev);
129 + else if (ret)
130 goto out_free;
131 }
132
133 @@ -2296,6 +2317,23 @@ static struct dma_map_ops amd_iommu_dma_ops = {
134 .dma_supported = amd_iommu_dma_supported,
135 };
136
137 +static unsigned device_dma_ops_init(void)
138 +{
139 + struct pci_dev *pdev = NULL;
140 + unsigned unhandled = 0;
141 +
142 + for_each_pci_dev(pdev) {
143 + if (!check_device(&pdev->dev)) {
144 + unhandled += 1;
145 + continue;
146 + }
147 +
148 + pdev->dev.archdata.dma_ops = &amd_iommu_dma_ops;
149 + }
150 +
151 + return unhandled;
152 +}
153 +
154 /*
155 * The function which clues the AMD IOMMU driver into dma_ops.
156 */
157 @@ -2308,7 +2346,7 @@ void __init amd_iommu_init_api(void)
158 int __init amd_iommu_init_dma_ops(void)
159 {
160 struct amd_iommu *iommu;
161 - int ret;
162 + int ret, unhandled;
163
164 /*
165 * first allocate a default protection domain for every IOMMU we
166 @@ -2334,7 +2372,11 @@ int __init amd_iommu_init_dma_ops(void)
167 swiotlb = 0;
168
169 /* Make the driver finally visible to the drivers */
170 - dma_ops = &amd_iommu_dma_ops;
171 + unhandled = device_dma_ops_init();
172 + if (unhandled && max_pfn > MAX_DMA32_PFN) {
173 + /* There are unhandled devices - initialize swiotlb for them */
174 + swiotlb = 1;
175 + }
176
177 amd_iommu_stats_init();
178
179 diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
180 index 246d727..b9e207e 100644
181 --- a/arch/x86/kernel/amd_iommu_init.c
182 +++ b/arch/x86/kernel/amd_iommu_init.c
183 @@ -701,8 +701,8 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
184 {
185 u8 *p = (u8 *)h;
186 u8 *end = p, flags = 0;
187 - u16 dev_i, devid = 0, devid_start = 0, devid_to = 0;
188 - u32 ext_flags = 0;
189 + u16 devid = 0, devid_start = 0, devid_to = 0;
190 + u32 dev_i, ext_flags = 0;
191 bool alias = false;
192 struct ivhd_entry *e;
193
194 @@ -857,7 +857,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
195 /* Initializes the device->iommu mapping for the driver */
196 static int __init init_iommu_devices(struct amd_iommu *iommu)
197 {
198 - u16 i;
199 + u32 i;
200
201 for (i = iommu->first_device; i <= iommu->last_device; ++i)
202 set_iommu_for_device(iommu, i);
203 @@ -1146,7 +1146,7 @@ static int __init init_memory_definitions(struct acpi_table_header *table)
204 */
205 static void init_device_table(void)
206 {
207 - u16 devid;
208 + u32 devid;
209
210 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) {
211 set_dev_entry_bit(devid, DEV_ENTRY_VALID);
212 diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
213 index e90f084..bea9c03 100644
214 --- a/arch/x86/kernel/devicetree.c
215 +++ b/arch/x86/kernel/devicetree.c
216 @@ -13,6 +13,7 @@
217 #include <linux/slab.h>
218 #include <linux/pci.h>
219 #include <linux/of_pci.h>
220 +#include <linux/initrd.h>
221
222 #include <asm/hpet.h>
223 #include <asm/irq_controller.h>
224 @@ -98,6 +99,16 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
225 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
226 }
227
228 +#ifdef CONFIG_BLK_DEV_INITRD
229 +void __init early_init_dt_setup_initrd_arch(unsigned long start,
230 + unsigned long end)
231 +{
232 + initrd_start = (unsigned long)__va(start);
233 + initrd_end = (unsigned long)__va(end);
234 + initrd_below_start_ok = 1;
235 +}
236 +#endif
237 +
238 void __init add_dtb(u64 data)
239 {
240 initial_dtb = data + offsetof(struct setup_data, data);
241 diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
242 index 8d12878..a3d0dc5 100644
243 --- a/arch/x86/kernel/process_32.c
244 +++ b/arch/x86/kernel/process_32.c
245 @@ -245,7 +245,6 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
246 {
247 set_user_gs(regs, 0);
248 regs->fs = 0;
249 - set_fs(USER_DS);
250 regs->ds = __USER_DS;
251 regs->es = __USER_DS;
252 regs->ss = __USER_DS;
253 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
254 index 6c9dd92..ca6f7ab 100644
255 --- a/arch/x86/kernel/process_64.c
256 +++ b/arch/x86/kernel/process_64.c
257 @@ -338,7 +338,6 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
258 regs->cs = _cs;
259 regs->ss = _ss;
260 regs->flags = X86_EFLAGS_IF;
261 - set_fs(USER_DS);
262 /*
263 * Free the old FP and other extended state
264 */
265 diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
266 index c6724e4..4be9b39 100644
267 --- a/arch/x86/kernel/setup.c
268 +++ b/arch/x86/kernel/setup.c
269 @@ -912,13 +912,6 @@ void __init setup_arch(char **cmdline_p)
270 memblock.current_limit = get_max_mapped();
271 memblock_x86_fill();
272
273 - /*
274 - * The EFI specification says that boot service code won't be called
275 - * after ExitBootServices(). This is, in fact, a lie.
276 - */
277 - if (efi_enabled)
278 - efi_reserve_boot_services();
279 -
280 /* preallocate 4k for mptable mpc */
281 early_reserve_e820_mpc_new();
282
283 diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
284 index c2871d3..c58d144 100644
285 --- a/arch/x86/kernel/smpboot.c
286 +++ b/arch/x86/kernel/smpboot.c
287 @@ -285,6 +285,19 @@ notrace static void __cpuinit start_secondary(void *unused)
288 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
289 x86_platform.nmi_init();
290
291 + /*
292 + * Wait until the cpu which brought this one up marked it
293 + * online before enabling interrupts. If we don't do that then
294 + * we can end up waking up the softirq thread before this cpu
295 + * reached the active state, which makes the scheduler unhappy
296 + * and schedule the softirq thread on the wrong cpu. This is
297 + * only observable with forced threaded interrupts, but in
298 + * theory it could also happen w/o them. It's just way harder
299 + * to achieve.
300 + */
301 + while (!cpumask_test_cpu(smp_processor_id(), cpu_active_mask))
302 + cpu_relax();
303 +
304 /* enable local interrupts */
305 local_irq_enable();
306
307 diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
308 index 1cd6089..493ea1f 100644
309 --- a/arch/x86/lguest/boot.c
310 +++ b/arch/x86/lguest/boot.c
311 @@ -995,6 +995,7 @@ static void lguest_time_irq(unsigned int irq, struct irq_desc *desc)
312 static void lguest_time_init(void)
313 {
314 /* Set up the timer interrupt (0) to go to our simple timer routine */
315 + lguest_setup_irq(0);
316 irq_set_handler(0, lguest_time_irq);
317
318 clocksource_register(&lguest_clock);
319 diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
320 index b00c4ea..0fe27d7 100644
321 --- a/arch/x86/platform/efi/efi.c
322 +++ b/arch/x86/platform/efi/efi.c
323 @@ -315,40 +315,6 @@ static void __init print_efi_memmap(void)
324 }
325 #endif /* EFI_DEBUG */
326
327 -void __init efi_reserve_boot_services(void)
328 -{
329 - void *p;
330 -
331 - for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
332 - efi_memory_desc_t *md = p;
333 - unsigned long long start = md->phys_addr;
334 - unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
335 -
336 - if (md->type != EFI_BOOT_SERVICES_CODE &&
337 - md->type != EFI_BOOT_SERVICES_DATA)
338 - continue;
339 -
340 - memblock_x86_reserve_range(start, start + size, "EFI Boot");
341 - }
342 -}
343 -
344 -static void __init efi_free_boot_services(void)
345 -{
346 - void *p;
347 -
348 - for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
349 - efi_memory_desc_t *md = p;
350 - unsigned long long start = md->phys_addr;
351 - unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
352 -
353 - if (md->type != EFI_BOOT_SERVICES_CODE &&
354 - md->type != EFI_BOOT_SERVICES_DATA)
355 - continue;
356 -
357 - free_bootmem_late(start, size);
358 - }
359 -}
360 -
361 void __init efi_init(void)
362 {
363 efi_config_table_t *config_tables;
364 @@ -541,9 +507,7 @@ void __init efi_enter_virtual_mode(void)
365 efi.systab = NULL;
366 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
367 md = p;
368 - if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
369 - md->type != EFI_BOOT_SERVICES_CODE &&
370 - md->type != EFI_BOOT_SERVICES_DATA)
371 + if (!(md->attribute & EFI_MEMORY_RUNTIME))
372 continue;
373
374 size = md->num_pages << EFI_PAGE_SHIFT;
375 @@ -594,13 +558,6 @@ void __init efi_enter_virtual_mode(void)
376 }
377
378 /*
379 - * Thankfully, it does seem that no runtime services other than
380 - * SetVirtualAddressMap() will touch boot services code, so we can
381 - * get rid of it all at this point
382 - */
383 - efi_free_boot_services();
384 -
385 - /*
386 * Now that EFI is in virtual mode, update the function
387 * pointers in the runtime service table to the new virtual addresses.
388 *
389 diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
390 index 641264c..ac0621a 100644
391 --- a/arch/x86/platform/efi/efi_64.c
392 +++ b/arch/x86/platform/efi/efi_64.c
393 @@ -64,11 +64,10 @@ static void __init early_runtime_code_mapping_set_exec(int executable)
394 if (!(__supported_pte_mask & _PAGE_NX))
395 return;
396
397 - /* Make EFI service code area executable */
398 + /* Make EFI runtime service code area executable */
399 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
400 md = p;
401 - if (md->type == EFI_RUNTIME_SERVICES_CODE ||
402 - md->type == EFI_BOOT_SERVICES_CODE) {
403 + if (md->type == EFI_RUNTIME_SERVICES_CODE) {
404 unsigned long end;
405 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
406 early_mapping_set_exec(md->phys_addr, end, executable);
407 diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
408 index 8bff7e7..1b2b73f 100644
409 --- a/arch/x86/xen/multicalls.c
410 +++ b/arch/x86/xen/multicalls.c
411 @@ -189,10 +189,10 @@ struct multicall_space __xen_mc_entry(size_t args)
412 unsigned argidx = roundup(b->argidx, sizeof(u64));
413
414 BUG_ON(preemptible());
415 - BUG_ON(b->argidx > MC_ARGS);
416 + BUG_ON(b->argidx >= MC_ARGS);
417
418 if (b->mcidx == MC_BATCH ||
419 - (argidx + args) > MC_ARGS) {
420 + (argidx + args) >= MC_ARGS) {
421 mc_stats_flush(b->mcidx == MC_BATCH ? FL_SLOTS : FL_ARGS);
422 xen_mc_flush();
423 argidx = roundup(b->argidx, sizeof(u64));
424 @@ -206,7 +206,7 @@ struct multicall_space __xen_mc_entry(size_t args)
425 ret.args = &b->args[argidx];
426 b->argidx = argidx + args;
427
428 - BUG_ON(b->argidx > MC_ARGS);
429 + BUG_ON(b->argidx >= MC_ARGS);
430 return ret;
431 }
432
433 @@ -216,7 +216,7 @@ struct multicall_space xen_mc_extend_args(unsigned long op, size_t size)
434 struct multicall_space ret = { NULL, NULL };
435
436 BUG_ON(preemptible());
437 - BUG_ON(b->argidx > MC_ARGS);
438 + BUG_ON(b->argidx >= MC_ARGS);
439
440 if (b->mcidx == 0)
441 return ret;
442 @@ -224,14 +224,14 @@ struct multicall_space xen_mc_extend_args(unsigned long op, size_t size)
443 if (b->entries[b->mcidx - 1].op != op)
444 return ret;
445
446 - if ((b->argidx + size) > MC_ARGS)
447 + if ((b->argidx + size) >= MC_ARGS)
448 return ret;
449
450 ret.mc = &b->entries[b->mcidx - 1];
451 ret.args = &b->args[b->argidx];
452 b->argidx += size;
453
454 - BUG_ON(b->argidx > MC_ARGS);
455 + BUG_ON(b->argidx >= MC_ARGS);
456 return ret;
457 }
458
459 diff --git a/block/blk-core.c b/block/blk-core.c
460 index 3fe00a1..5323076 100644
461 --- a/block/blk-core.c
462 +++ b/block/blk-core.c
463 @@ -345,6 +345,7 @@ void blk_put_queue(struct request_queue *q)
464 {
465 kobject_put(&q->kobj);
466 }
467 +EXPORT_SYMBOL(blk_put_queue);
468
469 /*
470 * Note: If a driver supplied the queue lock, it should not zap that lock
471 @@ -566,6 +567,7 @@ int blk_get_queue(struct request_queue *q)
472
473 return 1;
474 }
475 +EXPORT_SYMBOL(blk_get_queue);
476
477 static inline void blk_free_request(struct request_queue *q, struct request *rq)
478 {
479 diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
480 index e6fc716..a576406 100644
481 --- a/drivers/block/nbd.c
482 +++ b/drivers/block/nbd.c
483 @@ -756,6 +756,12 @@ static int __init nbd_init(void)
484 if (max_part > 0)
485 part_shift = fls(max_part);
486
487 + if ((1UL << part_shift) > DISK_MAX_PARTS)
488 + return -EINVAL;
489 +
490 + if (nbds_max > 1UL << (MINORBITS - part_shift))
491 + return -EINVAL;
492 +
493 for (i = 0; i < nbds_max; i++) {
494 struct gendisk *disk = alloc_disk(1 << part_shift);
495 if (!disk)
496 diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
497 index 4f1b8de..7c7a1e4 100644
498 --- a/drivers/cpufreq/cpufreq_stats.c
499 +++ b/drivers/cpufreq/cpufreq_stats.c
500 @@ -388,6 +388,7 @@ static void __exit cpufreq_stats_exit(void)
501 unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
502 for_each_online_cpu(cpu) {
503 cpufreq_stats_free_table(cpu);
504 + cpufreq_stats_free_sysfs(cpu);
505 }
506 }
507
508 diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
509 index 67cb076..b28f7bd 100644
510 --- a/drivers/gpu/drm/i915/intel_lvds.c
511 +++ b/drivers/gpu/drm/i915/intel_lvds.c
512 @@ -727,6 +727,14 @@ static const struct dmi_system_id intel_no_lvds[] = {
513 DMI_MATCH(DMI_PRODUCT_NAME, "U800"),
514 },
515 },
516 + {
517 + .callback = intel_no_lvds_dmi_callback,
518 + .ident = "Asus EeeBox PC EB1007",
519 + .matches = {
520 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
521 + DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"),
522 + },
523 + },
524
525 { } /* terminating entry */
526 };
527 diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
528 index 529a3a7..02705c7 100644
529 --- a/drivers/gpu/drm/radeon/atombios_crtc.c
530 +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
531 @@ -1011,7 +1011,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
532 uint64_t fb_location;
533 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
534 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
535 - u32 tmp;
536 + u32 tmp, viewport_w, viewport_h;
537 int r;
538
539 /* no fb bound */
540 @@ -1137,8 +1137,10 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
541 y &= ~1;
542 WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset,
543 (x << 16) | y);
544 + viewport_w = crtc->mode.hdisplay;
545 + viewport_h = (crtc->mode.vdisplay + 1) & ~1;
546 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
547 - (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
548 + (viewport_w << 16) | viewport_h);
549
550 /* pageflip setup */
551 /* make sure flip is at vb rather than hb */
552 @@ -1179,7 +1181,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
553 uint64_t fb_location;
554 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
555 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE;
556 - u32 tmp;
557 + u32 tmp, viewport_w, viewport_h;
558 int r;
559
560 /* no fb bound */
561 @@ -1304,8 +1306,10 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
562 y &= ~1;
563 WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset,
564 (x << 16) | y);
565 + viewport_w = crtc->mode.hdisplay;
566 + viewport_h = (crtc->mode.vdisplay + 1) & ~1;
567 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
568 - (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
569 + (viewport_w << 16) | viewport_h);
570
571 /* pageflip setup */
572 /* make sure flip is at vb rather than hb */
573 diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
574 index 2fef9de..686f9dc 100644
575 --- a/drivers/gpu/drm/radeon/r100_track.h
576 +++ b/drivers/gpu/drm/radeon/r100_track.h
577 @@ -63,7 +63,7 @@ struct r100_cs_track {
578 unsigned num_arrays;
579 unsigned max_indx;
580 unsigned color_channel_mask;
581 - struct r100_cs_track_array arrays[11];
582 + struct r100_cs_track_array arrays[16];
583 struct r100_cs_track_cb cb[R300_MAX_CB];
584 struct r100_cs_track_cb zb;
585 struct r100_cs_track_cb aa;
586 @@ -146,6 +146,12 @@ static inline int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
587 ib = p->ib->ptr;
588 track = (struct r100_cs_track *)p->track;
589 c = radeon_get_ib_value(p, idx++) & 0x1F;
590 + if (c > 16) {
591 + DRM_ERROR("Only 16 vertex buffers are allowed %d\n",
592 + pkt->opcode);
593 + r100_cs_dump_packet(p, pkt);
594 + return -EINVAL;
595 + }
596 track->num_arrays = c;
597 for (i = 0; i < (c - 1); i+=2, idx+=3) {
598 r = r100_cs_packet_next_reloc(p, &reloc);
599 diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
600 index 890217e..5d6ccc3 100644
601 --- a/drivers/gpu/drm/radeon/radeon_device.c
602 +++ b/drivers/gpu/drm/radeon/radeon_device.c
603 @@ -752,6 +752,7 @@ int radeon_device_init(struct radeon_device *rdev,
604 dma_bits = rdev->need_dma32 ? 32 : 40;
605 r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits));
606 if (r) {
607 + rdev->need_dma32 = true;
608 printk(KERN_WARNING "radeon: No suitable DMA available.\n");
609 }
610
611 diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
612 index 194ca0a..08cea44 100644
613 --- a/drivers/hwmon/coretemp.c
614 +++ b/drivers/hwmon/coretemp.c
615 @@ -263,7 +263,7 @@ static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id,
616 * If the TjMax is not plausible, an assumption
617 * will be used
618 */
619 - if ((val > 80) && (val < 120)) {
620 + if (val >= 70 && val <= 125) {
621 dev_info(dev, "TjMax is %d C.\n", val);
622 return val * 1000;
623 }
624 @@ -271,24 +271,9 @@ static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id,
625
626 /*
627 * An assumption is made for early CPUs and unreadable MSR.
628 - * NOTE: the given value may not be correct.
629 + * NOTE: the calculated value may not be correct.
630 */
631 -
632 - switch (c->x86_model) {
633 - case 0xe:
634 - case 0xf:
635 - case 0x16:
636 - case 0x1a:
637 - dev_warn(dev, "TjMax is assumed as 100 C!\n");
638 - return 100000;
639 - case 0x17:
640 - case 0x1c: /* Atom CPUs */
641 - return adjust_tjmax(c, id, dev);
642 - default:
643 - dev_warn(dev, "CPU (model=0x%x) is not supported yet,"
644 - " using default TjMax of 100C.\n", c->x86_model);
645 - return 100000;
646 - }
647 + return adjust_tjmax(c, id, dev);
648 }
649
650 static void __devinit get_ucode_rev_on_cpu(void *edx)
651 diff --git a/drivers/md/md.c b/drivers/md/md.c
652 index 4a4c0f8..9930792 100644
653 --- a/drivers/md/md.c
654 +++ b/drivers/md/md.c
655 @@ -2462,7 +2462,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
656 if (rdev->raid_disk == -1)
657 return -EEXIST;
658 /* personality does all needed checks */
659 - if (rdev->mddev->pers->hot_add_disk == NULL)
660 + if (rdev->mddev->pers->hot_remove_disk == NULL)
661 return -EINVAL;
662 err = rdev->mddev->pers->
663 hot_remove_disk(rdev->mddev, rdev->raid_disk);
664 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
665 index 49bf5f8..3d13d11 100644
666 --- a/drivers/md/raid5.c
667 +++ b/drivers/md/raid5.c
668 @@ -129,7 +129,7 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio)
669
670 static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt)
671 {
672 - bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16);
673 + bio->bi_phys_segments = raid5_bi_phys_segments(bio) | (cnt << 16);
674 }
675
676 /* Find first data disk in a raid6 stripe */
677 @@ -514,7 +514,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
678 bi = &sh->dev[i].req;
679
680 bi->bi_rw = rw;
681 - if (rw == WRITE)
682 + if (rw & WRITE)
683 bi->bi_end_io = raid5_end_write_request;
684 else
685 bi->bi_end_io = raid5_end_read_request;
686 @@ -548,13 +548,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
687 bi->bi_io_vec[0].bv_offset = 0;
688 bi->bi_size = STRIPE_SIZE;
689 bi->bi_next = NULL;
690 - if (rw == WRITE &&
691 + if ((rw & WRITE) &&
692 test_bit(R5_ReWrite, &sh->dev[i].flags))
693 atomic_add(STRIPE_SECTORS,
694 &rdev->corrected_errors);
695 generic_make_request(bi);
696 } else {
697 - if (rw == WRITE)
698 + if (rw & WRITE)
699 set_bit(STRIPE_DEGRADED, &sh->state);
700 pr_debug("skip op %ld on disc %d for sector %llu\n",
701 bi->bi_rw, i, (unsigned long long)sh->sector);
702 diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
703 index af5263c..7b42ace 100644
704 --- a/drivers/media/media-devnode.c
705 +++ b/drivers/media/media-devnode.c
706 @@ -213,14 +213,14 @@ int __must_check media_devnode_register(struct media_devnode *mdev)
707
708 /* Part 1: Find a free minor number */
709 mutex_lock(&media_devnode_lock);
710 - minor = find_next_zero_bit(media_devnode_nums, 0, MEDIA_NUM_DEVICES);
711 + minor = find_next_zero_bit(media_devnode_nums, MEDIA_NUM_DEVICES, 0);
712 if (minor == MEDIA_NUM_DEVICES) {
713 mutex_unlock(&media_devnode_lock);
714 printk(KERN_ERR "could not get a free minor\n");
715 return -ENFILE;
716 }
717
718 - set_bit(mdev->minor, media_devnode_nums);
719 + set_bit(minor, media_devnode_nums);
720 mutex_unlock(&media_devnode_lock);
721
722 mdev->minor = minor;
723 diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
724 index 0dfd1b9..0e3fccb 100644
725 --- a/drivers/net/igb/igb_main.c
726 +++ b/drivers/net/igb/igb_main.c
727 @@ -2372,6 +2372,9 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
728 }
729 #endif /* CONFIG_PCI_IOV */
730 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
731 + /* i350 cannot do RSS and SR-IOV at the same time */
732 + if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
733 + adapter->rss_queues = 1;
734
735 /*
736 * if rss_queues > 4 or vfs are going to be allocated with rss_queues
737 diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
738 index 1033ef6..f2b974d 100644
739 --- a/drivers/net/usb/cdc_ncm.c
740 +++ b/drivers/net/usb/cdc_ncm.c
741 @@ -1254,6 +1254,7 @@ static struct usb_driver cdc_ncm_driver = {
742 .disconnect = cdc_ncm_disconnect,
743 .suspend = usbnet_suspend,
744 .resume = usbnet_resume,
745 + .reset_resume = usbnet_resume,
746 .supports_autosuspend = 1,
747 };
748
749 diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
750 index 37af3f4..db4416c 100644
751 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
752 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
753 @@ -4598,10 +4598,16 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
754 case 1:
755 break;
756 case 2:
757 - scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
758 + if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
759 + scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
760 + else
761 + scaledPower = 0;
762 break;
763 case 3:
764 - scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
765 + if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
766 + scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
767 + else
768 + scaledPower = 0;
769 break;
770 }
771
772 diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
773 index 8cd8333..945e448 100644
774 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
775 +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
776 @@ -522,10 +522,16 @@ static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah,
777 case 1:
778 break;
779 case 2:
780 - scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
781 + if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
782 + scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
783 + else
784 + scaledPower = 0;
785 break;
786 case 3:
787 - scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
788 + if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
789 + scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
790 + else
791 + scaledPower = 0;
792 break;
793 }
794 scaledPower = max((u16)0, scaledPower);
795 diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
796 index 1482fa6..846bb4f 100644
797 --- a/drivers/net/wireless/ath/ath9k/main.c
798 +++ b/drivers/net/wireless/ath/ath9k/main.c
799 @@ -633,7 +633,8 @@ void ath9k_tasklet(unsigned long data)
800 u32 status = sc->intrstatus;
801 u32 rxmask;
802
803 - if (status & ATH9K_INT_FATAL) {
804 + if ((status & ATH9K_INT_FATAL) ||
805 + (status & ATH9K_INT_BB_WATCHDOG)) {
806 ath_reset(sc, true);
807 return;
808 }
809 @@ -699,6 +700,7 @@ irqreturn_t ath_isr(int irq, void *dev)
810 {
811 #define SCHED_INTR ( \
812 ATH9K_INT_FATAL | \
813 + ATH9K_INT_BB_WATCHDOG | \
814 ATH9K_INT_RXORN | \
815 ATH9K_INT_RXEOL | \
816 ATH9K_INT_RX | \
817 diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
818 index 4c0d36a..a39dfc4 100644
819 --- a/drivers/net/wireless/ath/ath9k/rc.c
820 +++ b/drivers/net/wireless/ath/ath9k/rc.c
821 @@ -689,7 +689,8 @@ static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table,
822
823 if (WLAN_RC_PHY_HT(rate_table->info[rix].phy)) {
824 rate->flags |= IEEE80211_TX_RC_MCS;
825 - if (WLAN_RC_PHY_40(rate_table->info[rix].phy))
826 + if (WLAN_RC_PHY_40(rate_table->info[rix].phy) &&
827 + conf_is_ht40(&txrc->hw->conf))
828 rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
829 if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy))
830 rate->flags |= IEEE80211_TX_RC_SHORT_GI;
831 diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
832 index 5a8a3cc..455f1f7 100644
833 --- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
834 +++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
835 @@ -628,11 +628,11 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
836
837 /* rx_status carries information about the packet to mac80211 */
838 rx_status.mactime = le64_to_cpu(phy_res->timestamp);
839 + rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
840 + IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
841 rx_status.freq =
842 ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel),
843 rx_status.band);
844 - rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
845 - IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
846 rx_status.rate_idx =
847 iwl4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band);
848 rx_status.flag = 0;
849 diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
850 index f5433c7..facc94e 100644
851 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c
852 +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
853 @@ -1218,10 +1218,10 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
854 * receive commit_rxon request
855 * abort any previous channel switch if still in process
856 */
857 - if (priv->switch_rxon.switch_in_progress &&
858 - (priv->switch_rxon.channel != ctx->staging.channel)) {
859 + if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
860 + (priv->switch_channel != ctx->staging.channel)) {
861 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
862 - le16_to_cpu(priv->switch_rxon.channel));
863 + le16_to_cpu(priv->switch_channel));
864 iwl_legacy_chswitch_done(priv, false);
865 }
866
867 @@ -1237,7 +1237,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
868
869 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
870 iwl_legacy_print_rx_config_cmd(priv, ctx);
871 - return 0;
872 + goto set_tx_power;
873 }
874
875 /* If we are currently associated and the new config requires
876 @@ -1317,6 +1317,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
877
878 iwl4965_init_sensitivity(priv);
879
880 +set_tx_power:
881 /* If we issue a new RXON command which required a tune then we must
882 * send a new TXPOWER command or we won't be able to Tx any frames */
883 ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true);
884 @@ -1403,9 +1404,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
885 return rc;
886 }
887
888 - priv->switch_rxon.channel = cmd.channel;
889 - priv->switch_rxon.switch_in_progress = true;
890 -
891 return iwl_legacy_send_cmd_pdu(priv,
892 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
893 }
894 @@ -1543,7 +1541,7 @@ static void iwl4965_temperature_calib(struct iwl_priv *priv)
895 s32 temp;
896
897 temp = iwl4965_hw_get_temperature(priv);
898 - if (temp < 0)
899 + if (IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp))
900 return;
901
902 if (priv->temperature != temp) {
903 diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
904 index 42db0fc..8ad7922 100644
905 --- a/drivers/net/wireless/iwlegacy/iwl-core.c
906 +++ b/drivers/net/wireless/iwlegacy/iwl-core.c
907 @@ -862,12 +862,8 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success)
908 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
909 return;
910
911 - if (priv->switch_rxon.switch_in_progress) {
912 + if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
913 ieee80211_chswitch_done(ctx->vif, is_success);
914 - mutex_lock(&priv->mutex);
915 - priv->switch_rxon.switch_in_progress = false;
916 - mutex_unlock(&priv->mutex);
917 - }
918 }
919 EXPORT_SYMBOL(iwl_legacy_chswitch_done);
920
921 @@ -879,19 +875,19 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
922 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
923 struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active;
924
925 - if (priv->switch_rxon.switch_in_progress) {
926 - if (!le32_to_cpu(csa->status) &&
927 - (csa->channel == priv->switch_rxon.channel)) {
928 - rxon->channel = csa->channel;
929 - ctx->staging.channel = csa->channel;
930 - IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
931 - le16_to_cpu(csa->channel));
932 - iwl_legacy_chswitch_done(priv, true);
933 - } else {
934 - IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
935 + if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
936 + return;
937 +
938 + if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
939 + rxon->channel = csa->channel;
940 + ctx->staging.channel = csa->channel;
941 + IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
942 le16_to_cpu(csa->channel));
943 - iwl_legacy_chswitch_done(priv, false);
944 - }
945 + iwl_legacy_chswitch_done(priv, true);
946 + } else {
947 + IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
948 + le16_to_cpu(csa->channel));
949 + iwl_legacy_chswitch_done(priv, false);
950 }
951 }
952 EXPORT_SYMBOL(iwl_legacy_rx_csa);
953 diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h
954 index f03b463..e49176a 100644
955 --- a/drivers/net/wireless/iwlegacy/iwl-core.h
956 +++ b/drivers/net/wireless/iwlegacy/iwl-core.h
957 @@ -561,7 +561,7 @@ void iwl_legacy_free_geos(struct iwl_priv *priv);
958 #define STATUS_SCAN_HW 15
959 #define STATUS_POWER_PMI 16
960 #define STATUS_FW_ERROR 17
961 -
962 +#define STATUS_CHANNEL_SWITCH_PENDING 18
963
964 static inline int iwl_legacy_is_ready(struct iwl_priv *priv)
965 {
966 diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
967 index f43ac1e..54f89b4 100644
968 --- a/drivers/net/wireless/iwlegacy/iwl-dev.h
969 +++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
970 @@ -854,17 +854,6 @@ struct traffic_stats {
971 };
972
973 /*
974 - * iwl_switch_rxon: "channel switch" structure
975 - *
976 - * @ switch_in_progress: channel switch in progress
977 - * @ channel: new channel
978 - */
979 -struct iwl_switch_rxon {
980 - bool switch_in_progress;
981 - __le16 channel;
982 -};
983 -
984 -/*
985 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
986 * to perform continuous uCode event logging operation if enabled
987 */
988 @@ -1115,7 +1104,7 @@ struct iwl_priv {
989
990 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
991
992 - struct iwl_switch_rxon switch_rxon;
993 + __le16 switch_channel;
994
995 /* 1st responses from initialize and runtime uCode images.
996 * _4965's initialize alive response contains some calibration data. */
997 diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
998 index a62fe24..d654876 100644
999 --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
1000 +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
1001 @@ -2851,16 +2851,13 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
1002 goto out_exit;
1003
1004 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
1005 - test_bit(STATUS_SCANNING, &priv->status))
1006 + test_bit(STATUS_SCANNING, &priv->status) ||
1007 + test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
1008 goto out_exit;
1009
1010 if (!iwl_legacy_is_associated_ctx(ctx))
1011 goto out_exit;
1012
1013 - /* channel switch in progress */
1014 - if (priv->switch_rxon.switch_in_progress == true)
1015 - goto out_exit;
1016 -
1017 mutex_lock(&priv->mutex);
1018 if (priv->cfg->ops->lib->set_channel_switch) {
1019
1020 @@ -2910,16 +2907,20 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
1021 * at this point, staging_rxon has the
1022 * configuration for channel switch
1023 */
1024 + set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
1025 + priv->switch_channel = cpu_to_le16(ch);
1026 if (priv->cfg->ops->lib->set_channel_switch(priv,
1027 - ch_switch))
1028 - priv->switch_rxon.switch_in_progress = false;
1029 + ch_switch)) {
1030 + clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
1031 + &priv->status);
1032 + priv->switch_channel = 0;
1033 + ieee80211_chswitch_done(ctx->vif, false);
1034 + }
1035 }
1036 }
1037 out:
1038 mutex_unlock(&priv->mutex);
1039 out_exit:
1040 - if (!priv->switch_rxon.switch_in_progress)
1041 - ieee80211_chswitch_done(ctx->vif, false);
1042 IWL_DEBUG_MAC80211(priv, "leave\n");
1043 }
1044
1045 diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
1046 index d7b6126..d474cf3 100644
1047 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c
1048 +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
1049 @@ -181,79 +181,6 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
1050 return 0;
1051 }
1052
1053 -static int iwl2030_hw_channel_switch(struct iwl_priv *priv,
1054 - struct ieee80211_channel_switch *ch_switch)
1055 -{
1056 - /*
1057 - * MULTI-FIXME
1058 - * See iwl_mac_channel_switch.
1059 - */
1060 - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1061 - struct iwl6000_channel_switch_cmd cmd;
1062 - const struct iwl_channel_info *ch_info;
1063 - u32 switch_time_in_usec, ucode_switch_time;
1064 - u16 ch;
1065 - u32 tsf_low;
1066 - u8 switch_count;
1067 - u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
1068 - struct ieee80211_vif *vif = ctx->vif;
1069 - struct iwl_host_cmd hcmd = {
1070 - .id = REPLY_CHANNEL_SWITCH,
1071 - .len = sizeof(cmd),
1072 - .flags = CMD_SYNC,
1073 - .data = &cmd,
1074 - };
1075 -
1076 - cmd.band = priv->band == IEEE80211_BAND_2GHZ;
1077 - ch = ch_switch->channel->hw_value;
1078 - IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
1079 - ctx->active.channel, ch);
1080 - cmd.channel = cpu_to_le16(ch);
1081 - cmd.rxon_flags = ctx->staging.flags;
1082 - cmd.rxon_filter_flags = ctx->staging.filter_flags;
1083 - switch_count = ch_switch->count;
1084 - tsf_low = ch_switch->timestamp & 0x0ffffffff;
1085 - /*
1086 - * calculate the ucode channel switch time
1087 - * adding TSF as one of the factor for when to switch
1088 - */
1089 - if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
1090 - if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
1091 - beacon_interval)) {
1092 - switch_count -= (priv->ucode_beacon_time -
1093 - tsf_low) / beacon_interval;
1094 - } else
1095 - switch_count = 0;
1096 - }
1097 - if (switch_count <= 1)
1098 - cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
1099 - else {
1100 - switch_time_in_usec =
1101 - vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
1102 - ucode_switch_time = iwl_usecs_to_beacons(priv,
1103 - switch_time_in_usec,
1104 - beacon_interval);
1105 - cmd.switch_time = iwl_add_beacon_time(priv,
1106 - priv->ucode_beacon_time,
1107 - ucode_switch_time,
1108 - beacon_interval);
1109 - }
1110 - IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
1111 - cmd.switch_time);
1112 - ch_info = iwl_get_channel_info(priv, priv->band, ch);
1113 - if (ch_info)
1114 - cmd.expect_beacon = is_channel_radar(ch_info);
1115 - else {
1116 - IWL_ERR(priv, "invalid channel switch from %u to %u\n",
1117 - ctx->active.channel, ch);
1118 - return -EFAULT;
1119 - }
1120 - priv->switch_rxon.channel = cmd.channel;
1121 - priv->switch_rxon.switch_in_progress = true;
1122 -
1123 - return iwl_send_cmd_sync(priv, &hcmd);
1124 -}
1125 -
1126 static struct iwl_lib_ops iwl2000_lib = {
1127 .set_hw_params = iwl2000_hw_set_hw_params,
1128 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
1129 @@ -277,7 +204,6 @@ static struct iwl_lib_ops iwl2000_lib = {
1130 .alive_notify = iwlagn_alive_notify,
1131 .send_tx_power = iwlagn_send_tx_power,
1132 .update_chain_flags = iwl_update_chain_flags,
1133 - .set_channel_switch = iwl2030_hw_channel_switch,
1134 .apm_ops = {
1135 .init = iwl_apm_init,
1136 .config = iwl2000_nic_config,
1137 diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
1138 index 22e045b..dcf40e8 100644
1139 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c
1140 +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
1141 @@ -337,8 +337,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
1142 ctx->active.channel, ch);
1143 return -EFAULT;
1144 }
1145 - priv->switch_rxon.channel = cmd.channel;
1146 - priv->switch_rxon.switch_in_progress = true;
1147
1148 return iwl_send_cmd_sync(priv, &hcmd);
1149 }
1150 @@ -513,7 +511,6 @@ static struct iwl_base_params iwl5000_base_params = {
1151 };
1152 static struct iwl_ht_params iwl5000_ht_params = {
1153 .ht_greenfield_support = true,
1154 - .use_rts_for_aggregation = true, /* use rts/cts protection */
1155 };
1156
1157 #define IWL_DEVICE_5000 \
1158 diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
1159 index a745b01..9035255 100644
1160 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c
1161 +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
1162 @@ -277,8 +277,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
1163 ctx->active.channel, ch);
1164 return -EFAULT;
1165 }
1166 - priv->switch_rxon.channel = cmd.channel;
1167 - priv->switch_rxon.switch_in_progress = true;
1168
1169 return iwl_send_cmd_sync(priv, &hcmd);
1170 }
1171 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
1172 index 41543ad..129a551 100644
1173 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
1174 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
1175 @@ -217,17 +217,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
1176 __le16 fc, __le32 *tx_flags)
1177 {
1178 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
1179 - info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
1180 + info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
1181 + info->flags & IEEE80211_TX_CTL_AMPDU)
1182 *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
1183 - return;
1184 - }
1185 -
1186 - if (priv->cfg->ht_params &&
1187 - priv->cfg->ht_params->use_rts_for_aggregation &&
1188 - info->flags & IEEE80211_TX_CTL_AMPDU) {
1189 - *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
1190 - return;
1191 - }
1192 }
1193
1194 /* Calc max signal level (dBm) among 3 possible receivers */
1195 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
1196 index fbbde07..7c0f80c 100644
1197 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
1198 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
1199 @@ -173,6 +173,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1200 return 0;
1201 }
1202
1203 + /*
1204 + * force CTS-to-self frames protection if RTS-CTS is not preferred
1205 + * one aggregation protection method
1206 + */
1207 + if (!(priv->cfg->ht_params &&
1208 + priv->cfg->ht_params->use_rts_for_aggregation))
1209 + ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1210 +
1211 if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
1212 !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
1213 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
1214 @@ -189,10 +197,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1215 * receive commit_rxon request
1216 * abort any previous channel switch if still in process
1217 */
1218 - if (priv->switch_rxon.switch_in_progress &&
1219 - (priv->switch_rxon.channel != ctx->staging.channel)) {
1220 + if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
1221 + (priv->switch_channel != ctx->staging.channel)) {
1222 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
1223 - le16_to_cpu(priv->switch_rxon.channel));
1224 + le16_to_cpu(priv->switch_channel));
1225 iwl_chswitch_done(priv, false);
1226 }
1227
1228 @@ -210,6 +218,11 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1229
1230 memcpy(active, &ctx->staging, sizeof(*active));
1231 iwl_print_rx_config_cmd(priv, ctx);
1232 + /*
1233 + * We do not commit tx power settings while channel changing,
1234 + * do it now if after settings changed.
1235 + */
1236 + iwl_set_tx_power(priv, priv->tx_power_next, false);
1237 return 0;
1238 }
1239
1240 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
1241 index 321b18b..5941e61 100644
1242 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
1243 +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
1244 @@ -3461,16 +3461,13 @@ void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
1245 goto out_exit;
1246
1247 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
1248 - test_bit(STATUS_SCANNING, &priv->status))
1249 + test_bit(STATUS_SCANNING, &priv->status) ||
1250 + test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
1251 goto out_exit;
1252
1253 if (!iwl_is_associated_ctx(ctx))
1254 goto out_exit;
1255
1256 - /* channel switch in progress */
1257 - if (priv->switch_rxon.switch_in_progress == true)
1258 - goto out_exit;
1259 -
1260 mutex_lock(&priv->mutex);
1261 if (priv->cfg->ops->lib->set_channel_switch) {
1262
1263 @@ -3520,16 +3517,20 @@ void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
1264 * at this point, staging_rxon has the
1265 * configuration for channel switch
1266 */
1267 + set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
1268 + priv->switch_channel = cpu_to_le16(ch);
1269 if (priv->cfg->ops->lib->set_channel_switch(priv,
1270 - ch_switch))
1271 - priv->switch_rxon.switch_in_progress = false;
1272 + ch_switch)) {
1273 + clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
1274 + &priv->status);
1275 + priv->switch_channel = 0;
1276 + ieee80211_chswitch_done(ctx->vif, false);
1277 + }
1278 }
1279 }
1280 out:
1281 mutex_unlock(&priv->mutex);
1282 out_exit:
1283 - if (!priv->switch_rxon.switch_in_progress)
1284 - ieee80211_chswitch_done(ctx->vif, false);
1285 IWL_DEBUG_MAC80211(priv, "leave\n");
1286 }
1287
1288 diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
1289 index 1755729..7950bc4 100644
1290 --- a/drivers/net/wireless/iwlwifi/iwl-core.c
1291 +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
1292 @@ -861,12 +861,8 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
1293 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1294 return;
1295
1296 - if (priv->switch_rxon.switch_in_progress) {
1297 + if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
1298 ieee80211_chswitch_done(ctx->vif, is_success);
1299 - mutex_lock(&priv->mutex);
1300 - priv->switch_rxon.switch_in_progress = false;
1301 - mutex_unlock(&priv->mutex);
1302 - }
1303 }
1304
1305 #ifdef CONFIG_IWLWIFI_DEBUG
1306 diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
1307 index b316d83..92f65b6 100644
1308 --- a/drivers/net/wireless/iwlwifi/iwl-core.h
1309 +++ b/drivers/net/wireless/iwlwifi/iwl-core.h
1310 @@ -662,7 +662,7 @@ void iwlcore_free_geos(struct iwl_priv *priv);
1311 #define STATUS_SCAN_HW 15
1312 #define STATUS_POWER_PMI 16
1313 #define STATUS_FW_ERROR 17
1314 -
1315 +#define STATUS_CHANNEL_SWITCH_PENDING 19
1316
1317 static inline int iwl_is_ready(struct iwl_priv *priv)
1318 {
1319 diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
1320 index c0a4cfb..65a16ae 100644
1321 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h
1322 +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
1323 @@ -1037,17 +1037,6 @@ struct traffic_stats {
1324 };
1325
1326 /*
1327 - * iwl_switch_rxon: "channel switch" structure
1328 - *
1329 - * @ switch_in_progress: channel switch in progress
1330 - * @ channel: new channel
1331 - */
1332 -struct iwl_switch_rxon {
1333 - bool switch_in_progress;
1334 - __le16 channel;
1335 -};
1336 -
1337 -/*
1338 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
1339 * to perform continuous uCode event logging operation if enabled
1340 */
1341 @@ -1344,7 +1333,7 @@ struct iwl_priv {
1342
1343 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
1344
1345 - struct iwl_switch_rxon switch_rxon;
1346 + __le16 switch_channel;
1347
1348 /* 1st responses from initialize and runtime uCode images.
1349 * _agn's initialize alive response contains some calibration data. */
1350 diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
1351 index 6f9a2fa..8055910 100644
1352 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c
1353 +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
1354 @@ -299,19 +299,19 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1355 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1356 struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
1357
1358 - if (priv->switch_rxon.switch_in_progress) {
1359 - if (!le32_to_cpu(csa->status) &&
1360 - (csa->channel == priv->switch_rxon.channel)) {
1361 - rxon->channel = csa->channel;
1362 - ctx->staging.channel = csa->channel;
1363 - IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
1364 - le16_to_cpu(csa->channel));
1365 - iwl_chswitch_done(priv, true);
1366 - } else {
1367 - IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
1368 + if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
1369 + return;
1370 +
1371 + if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
1372 + rxon->channel = csa->channel;
1373 + ctx->staging.channel = csa->channel;
1374 + IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
1375 le16_to_cpu(csa->channel));
1376 - iwl_chswitch_done(priv, false);
1377 - }
1378 + iwl_chswitch_done(priv, true);
1379 + } else {
1380 + IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
1381 + le16_to_cpu(csa->channel));
1382 + iwl_chswitch_done(priv, false);
1383 }
1384 }
1385
1386 diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
1387 index ab607bb..13c0c77 100644
1388 --- a/drivers/net/wireless/zd1211rw/zd_usb.c
1389 +++ b/drivers/net/wireless/zd1211rw/zd_usb.c
1390 @@ -1533,6 +1533,31 @@ static void __exit usb_exit(void)
1391 module_init(usb_init);
1392 module_exit(usb_exit);
1393
1394 +static int zd_ep_regs_out_msg(struct usb_device *udev, void *data, int len,
1395 + int *actual_length, int timeout)
1396 +{
1397 + /* In USB 2.0 mode EP_REGS_OUT endpoint is interrupt type. However in
1398 + * USB 1.1 mode endpoint is bulk. Select correct type URB by endpoint
1399 + * descriptor.
1400 + */
1401 + struct usb_host_endpoint *ep;
1402 + unsigned int pipe;
1403 +
1404 + pipe = usb_sndintpipe(udev, EP_REGS_OUT);
1405 + ep = usb_pipe_endpoint(udev, pipe);
1406 + if (!ep)
1407 + return -EINVAL;
1408 +
1409 + if (usb_endpoint_xfer_int(&ep->desc)) {
1410 + return usb_interrupt_msg(udev, pipe, data, len,
1411 + actual_length, timeout);
1412 + } else {
1413 + pipe = usb_sndbulkpipe(udev, EP_REGS_OUT);
1414 + return usb_bulk_msg(udev, pipe, data, len, actual_length,
1415 + timeout);
1416 + }
1417 +}
1418 +
1419 static int usb_int_regs_length(unsigned int count)
1420 {
1421 return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
1422 @@ -1648,15 +1673,14 @@ int zd_usb_ioread16v(struct zd_usb *usb, u16 *values,
1423
1424 udev = zd_usb_to_usbdev(usb);
1425 prepare_read_regs_int(usb);
1426 - r = usb_interrupt_msg(udev, usb_sndintpipe(udev, EP_REGS_OUT),
1427 - req, req_len, &actual_req_len, 50 /* ms */);
1428 + r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/);
1429 if (r) {
1430 dev_dbg_f(zd_usb_dev(usb),
1431 - "error in usb_interrupt_msg(). Error number %d\n", r);
1432 + "error in zd_ep_regs_out_msg(). Error number %d\n", r);
1433 goto error;
1434 }
1435 if (req_len != actual_req_len) {
1436 - dev_dbg_f(zd_usb_dev(usb), "error in usb_interrupt_msg()\n"
1437 + dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()\n"
1438 " req_len %d != actual_req_len %d\n",
1439 req_len, actual_req_len);
1440 r = -EIO;
1441 @@ -1818,9 +1842,17 @@ int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs,
1442 rw->value = cpu_to_le16(ioreqs[i].value);
1443 }
1444
1445 - usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT),
1446 - req, req_len, iowrite16v_urb_complete, usb,
1447 - ep->desc.bInterval);
1448 + /* In USB 2.0 mode endpoint is interrupt type. However in USB 1.1 mode
1449 + * endpoint is bulk. Select correct type URB by endpoint descriptor.
1450 + */
1451 + if (usb_endpoint_xfer_int(&ep->desc))
1452 + usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT),
1453 + req, req_len, iowrite16v_urb_complete, usb,
1454 + ep->desc.bInterval);
1455 + else
1456 + usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_REGS_OUT),
1457 + req, req_len, iowrite16v_urb_complete, usb);
1458 +
1459 urb->transfer_flags |= URB_FREE_BUFFER;
1460
1461 /* Submit previous URB */
1462 @@ -1924,15 +1956,14 @@ int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits)
1463 }
1464
1465 udev = zd_usb_to_usbdev(usb);
1466 - r = usb_interrupt_msg(udev, usb_sndintpipe(udev, EP_REGS_OUT),
1467 - req, req_len, &actual_req_len, 50 /* ms */);
1468 + r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/);
1469 if (r) {
1470 dev_dbg_f(zd_usb_dev(usb),
1471 - "error in usb_interrupt_msg(). Error number %d\n", r);
1472 + "error in zd_ep_regs_out_msg(). Error number %d\n", r);
1473 goto out;
1474 }
1475 if (req_len != actual_req_len) {
1476 - dev_dbg_f(zd_usb_dev(usb), "error in usb_interrupt_msg()"
1477 + dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()"
1478 " req_len %d != actual_req_len %d\n",
1479 req_len, actual_req_len);
1480 r = -EIO;
1481 diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
1482 index a3984f4..f34b5b2 100644
1483 --- a/drivers/oprofile/buffer_sync.c
1484 +++ b/drivers/oprofile/buffer_sync.c
1485 @@ -141,6 +141,13 @@ static struct notifier_block module_load_nb = {
1486 .notifier_call = module_load_notify,
1487 };
1488
1489 +static void free_all_tasks(void)
1490 +{
1491 + /* make sure we don't leak task structs */
1492 + process_task_mortuary();
1493 + process_task_mortuary();
1494 +}
1495 +
1496 int sync_start(void)
1497 {
1498 int err;
1499 @@ -148,8 +155,6 @@ int sync_start(void)
1500 if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL))
1501 return -ENOMEM;
1502
1503 - mutex_lock(&buffer_mutex);
1504 -
1505 err = task_handoff_register(&task_free_nb);
1506 if (err)
1507 goto out1;
1508 @@ -166,7 +171,6 @@ int sync_start(void)
1509 start_cpu_work();
1510
1511 out:
1512 - mutex_unlock(&buffer_mutex);
1513 return err;
1514 out4:
1515 profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
1516 @@ -174,6 +178,7 @@ out3:
1517 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
1518 out2:
1519 task_handoff_unregister(&task_free_nb);
1520 + free_all_tasks();
1521 out1:
1522 free_cpumask_var(marked_cpus);
1523 goto out;
1524 @@ -182,20 +187,16 @@ out1:
1525
1526 void sync_stop(void)
1527 {
1528 - /* flush buffers */
1529 - mutex_lock(&buffer_mutex);
1530 end_cpu_work();
1531 unregister_module_notifier(&module_load_nb);
1532 profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
1533 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
1534 task_handoff_unregister(&task_free_nb);
1535 - mutex_unlock(&buffer_mutex);
1536 - flush_cpu_work();
1537 + barrier(); /* do all of the above first */
1538
1539 - /* make sure we don't leak task structs */
1540 - process_task_mortuary();
1541 - process_task_mortuary();
1542 + flush_cpu_work();
1543
1544 + free_all_tasks();
1545 free_cpumask_var(marked_cpus);
1546 }
1547
1548 diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c
1549 index 80b461c..749fdf0 100644
1550 --- a/drivers/pci/hotplug/pcihp_slot.c
1551 +++ b/drivers/pci/hotplug/pcihp_slot.c
1552 @@ -158,6 +158,47 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
1553 */
1554 }
1555
1556 +/* Program PCIE MaxPayload setting on device: ensure parent maxpayload <= device */
1557 +static int pci_set_payload(struct pci_dev *dev)
1558 +{
1559 + int pos, ppos;
1560 + u16 pctl, psz;
1561 + u16 dctl, dsz, dcap, dmax;
1562 + struct pci_dev *parent;
1563 +
1564 + parent = dev->bus->self;
1565 + pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
1566 + if (!pos)
1567 + return 0;
1568 +
1569 + /* Read Device MaxPayload capability and setting */
1570 + pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &dctl);
1571 + pci_read_config_word(dev, pos + PCI_EXP_DEVCAP, &dcap);
1572 + dsz = (dctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5;
1573 + dmax = (dcap & PCI_EXP_DEVCAP_PAYLOAD);
1574 +
1575 + /* Read Parent MaxPayload setting */
1576 + ppos = pci_find_capability(parent, PCI_CAP_ID_EXP);
1577 + if (!ppos)
1578 + return 0;
1579 + pci_read_config_word(parent, ppos + PCI_EXP_DEVCTL, &pctl);
1580 + psz = (pctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5;
1581 +
1582 + /* If parent payload > device max payload -> error
1583 + * If parent payload > device payload -> set speed
1584 + * If parent payload <= device payload -> do nothing
1585 + */
1586 + if (psz > dmax)
1587 + return -1;
1588 + else if (psz > dsz) {
1589 + dev_info(&dev->dev, "Setting MaxPayload to %d\n", 128 << psz);
1590 + pci_write_config_word(dev, pos + PCI_EXP_DEVCTL,
1591 + (dctl & ~PCI_EXP_DEVCTL_PAYLOAD) +
1592 + (psz << 5));
1593 + }
1594 + return 0;
1595 +}
1596 +
1597 void pci_configure_slot(struct pci_dev *dev)
1598 {
1599 struct pci_dev *cdev;
1600 @@ -169,6 +210,10 @@ void pci_configure_slot(struct pci_dev *dev)
1601 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI)))
1602 return;
1603
1604 + ret = pci_set_payload(dev);
1605 + if (ret)
1606 + dev_warn(&dev->dev, "could not set device max payload\n");
1607 +
1608 memset(&hpp, 0, sizeof(hpp));
1609 ret = pci_get_hp_params(dev, &hpp);
1610 if (ret)
1611 diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
1612 index d552d2c..5db70c7 100644
1613 --- a/drivers/pci/intel-iommu.c
1614 +++ b/drivers/pci/intel-iommu.c
1615 @@ -46,6 +46,8 @@
1616 #define ROOT_SIZE VTD_PAGE_SIZE
1617 #define CONTEXT_SIZE VTD_PAGE_SIZE
1618
1619 +#define IS_BRIDGE_HOST_DEVICE(pdev) \
1620 + ((pdev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
1621 #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
1622 #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
1623 #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
1624 @@ -1416,6 +1418,10 @@ static void domain_exit(struct dmar_domain *domain)
1625 if (!domain)
1626 return;
1627
1628 + /* Flush any lazy unmaps that may reference this domain */
1629 + if (!intel_iommu_strict)
1630 + flush_unmaps_timeout(0);
1631 +
1632 domain_remove_dev_info(domain);
1633 /* destroy iovas */
1634 put_iova_domain(&domain->iovad);
1635 @@ -2105,10 +2111,10 @@ static int identity_mapping(struct pci_dev *pdev)
1636 if (likely(!iommu_identity_mapping))
1637 return 0;
1638
1639 + info = pdev->dev.archdata.iommu;
1640 + if (info && info != DUMMY_DEVICE_DOMAIN_INFO)
1641 + return (info->domain == si_domain);
1642
1643 - list_for_each_entry(info, &si_domain->devices, link)
1644 - if (info->dev == pdev)
1645 - return 1;
1646 return 0;
1647 }
1648
1649 @@ -2186,8 +2192,19 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
1650 * Assume that they will -- if they turn out not to be, then we can
1651 * take them out of the 1:1 domain later.
1652 */
1653 - if (!startup)
1654 - return pdev->dma_mask > DMA_BIT_MASK(32);
1655 + if (!startup) {
1656 + /*
1657 + * If the device's dma_mask is less than the system's memory
1658 + * size then this is not a candidate for identity mapping.
1659 + */
1660 + u64 dma_mask = pdev->dma_mask;
1661 +
1662 + if (pdev->dev.coherent_dma_mask &&
1663 + pdev->dev.coherent_dma_mask < dma_mask)
1664 + dma_mask = pdev->dev.coherent_dma_mask;
1665 +
1666 + return dma_mask >= dma_get_required_mask(&pdev->dev);
1667 + }
1668
1669 return 1;
1670 }
1671 @@ -2202,6 +2219,9 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
1672 return -EFAULT;
1673
1674 for_each_pci_dev(pdev) {
1675 + /* Skip Host/PCI Bridge devices */
1676 + if (IS_BRIDGE_HOST_DEVICE(pdev))
1677 + continue;
1678 if (iommu_should_identity_map(pdev, 1)) {
1679 printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n",
1680 hw ? "hardware" : "software", pci_name(pdev));
1681 @@ -2591,8 +2611,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
1682 iommu = domain_get_iommu(domain);
1683 size = aligned_nrpages(paddr, size);
1684
1685 - iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size),
1686 - pdev->dma_mask);
1687 + iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), dma_mask);
1688 if (!iova)
1689 goto error;
1690
1691 @@ -3379,8 +3398,8 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
1692 spin_lock_irqsave(&device_domain_lock, flags);
1693 list_for_each_safe(entry, tmp, &domain->devices) {
1694 info = list_entry(entry, struct device_domain_info, link);
1695 - /* No need to compare PCI domain; it has to be the same */
1696 - if (info->bus == pdev->bus->number &&
1697 + if (info->segment == pci_domain_nr(pdev->bus) &&
1698 + info->bus == pdev->bus->number &&
1699 info->devfn == pdev->devfn) {
1700 list_del(&info->link);
1701 list_del(&info->global);
1702 @@ -3418,10 +3437,13 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
1703 domain_update_iommu_cap(domain);
1704 spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags);
1705
1706 - spin_lock_irqsave(&iommu->lock, tmp_flags);
1707 - clear_bit(domain->id, iommu->domain_ids);
1708 - iommu->domains[domain->id] = NULL;
1709 - spin_unlock_irqrestore(&iommu->lock, tmp_flags);
1710 + if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
1711 + !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)) {
1712 + spin_lock_irqsave(&iommu->lock, tmp_flags);
1713 + clear_bit(domain->id, iommu->domain_ids);
1714 + iommu->domains[domain->id] = NULL;
1715 + spin_unlock_irqrestore(&iommu->lock, tmp_flags);
1716 + }
1717 }
1718
1719 spin_unlock_irqrestore(&device_domain_lock, flags);
1720 diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c
1721 index 9606e59..c5c274a 100644
1722 --- a/drivers/pci/iova.c
1723 +++ b/drivers/pci/iova.c
1724 @@ -63,8 +63,16 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free)
1725 curr = iovad->cached32_node;
1726 cached_iova = container_of(curr, struct iova, node);
1727
1728 - if (free->pfn_lo >= cached_iova->pfn_lo)
1729 - iovad->cached32_node = rb_next(&free->node);
1730 + if (free->pfn_lo >= cached_iova->pfn_lo) {
1731 + struct rb_node *node = rb_next(&free->node);
1732 + struct iova *iova = container_of(node, struct iova, node);
1733 +
1734 + /* only cache if it's below 32bit pfn */
1735 + if (node && iova->pfn_lo < iovad->dma_32bit_pfn)
1736 + iovad->cached32_node = node;
1737 + else
1738 + iovad->cached32_node = NULL;
1739 + }
1740 }
1741
1742 /* Computes the padding size required, to make the
1743 diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
1744 index 832a3fd7..c8c9842 100644
1745 --- a/drivers/platform/x86/asus-wmi.c
1746 +++ b/drivers/platform/x86/asus-wmi.c
1747 @@ -1223,7 +1223,7 @@ static int asus_wmi_sysfs_init(struct platform_device *device)
1748 /*
1749 * Platform device
1750 */
1751 -static int __init asus_wmi_platform_init(struct asus_wmi *asus)
1752 +static int asus_wmi_platform_init(struct asus_wmi *asus)
1753 {
1754 int rv;
1755
1756 diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
1757 index 58584dc..44e8ca3 100644
1758 --- a/drivers/scsi/scsi_scan.c
1759 +++ b/drivers/scsi/scsi_scan.c
1760 @@ -297,7 +297,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
1761 kfree(sdev);
1762 goto out;
1763 }
1764 -
1765 + blk_get_queue(sdev->request_queue);
1766 sdev->request_queue->queuedata = sdev;
1767 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
1768
1769 diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
1770 index e639125..e0bd3f7 100644
1771 --- a/drivers/scsi/scsi_sysfs.c
1772 +++ b/drivers/scsi/scsi_sysfs.c
1773 @@ -322,6 +322,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
1774 kfree(evt);
1775 }
1776
1777 + blk_put_queue(sdev->request_queue);
1778 /* NULL queue means the device can't be used */
1779 sdev->request_queue = NULL;
1780
1781 diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
1782 index f67f53b..1b96199 100644
1783 --- a/drivers/staging/gma500/psb_fb.c
1784 +++ b/drivers/staging/gma500/psb_fb.c
1785 @@ -489,6 +489,16 @@ static int psbfb_create(struct psb_fbdev *fbdev,
1786 info->screen_size = size;
1787 memset(info->screen_base, 0, size);
1788
1789 + if (dev_priv->pg->stolen_size) {
1790 + info->apertures = alloc_apertures(1);
1791 + if (!info->apertures) {
1792 + ret = -ENOMEM;
1793 + goto out_err0;
1794 + }
1795 + info->apertures->ranges[0].base = dev->mode_config.fb_base;
1796 + info->apertures->ranges[0].size = dev_priv->pg->stolen_size;
1797 + }
1798 +
1799 drm_fb_helper_fill_fix(info, fb->pitch, fb->depth);
1800 drm_fb_helper_fill_var(info, &fbdev->psb_fb_helper,
1801 sizes->fb_width, sizes->fb_height);
1802 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
1803 index 733fe8e..d4bee1b 100644
1804 --- a/drivers/tty/serial/serial_core.c
1805 +++ b/drivers/tty/serial/serial_core.c
1806 @@ -172,12 +172,16 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in
1807
1808 retval = uport->ops->startup(uport);
1809 if (retval == 0) {
1810 - if (init_hw) {
1811 - /*
1812 - * Initialise the hardware port settings.
1813 - */
1814 - uart_change_speed(tty, state, NULL);
1815 + if (uart_console(uport) && uport->cons->cflag) {
1816 + tty->termios->c_cflag = uport->cons->cflag;
1817 + uport->cons->cflag = 0;
1818 + }
1819 + /*
1820 + * Initialise the hardware port settings.
1821 + */
1822 + uart_change_speed(tty, state, NULL);
1823
1824 + if (init_hw) {
1825 /*
1826 * Setup the RTS and DTR signals once the
1827 * port is open and ready to respond.
1828 @@ -1466,45 +1470,6 @@ static void uart_hangup(struct tty_struct *tty)
1829 mutex_unlock(&port->mutex);
1830 }
1831
1832 -/**
1833 - * uart_update_termios - update the terminal hw settings
1834 - * @tty: tty associated with UART
1835 - * @state: UART to update
1836 - *
1837 - * Copy across the serial console cflag setting into the termios settings
1838 - * for the initial open of the port. This allows continuity between the
1839 - * kernel settings, and the settings init adopts when it opens the port
1840 - * for the first time.
1841 - */
1842 -static void uart_update_termios(struct tty_struct *tty,
1843 - struct uart_state *state)
1844 -{
1845 - struct uart_port *port = state->uart_port;
1846 -
1847 - if (uart_console(port) && port->cons->cflag) {
1848 - tty->termios->c_cflag = port->cons->cflag;
1849 - port->cons->cflag = 0;
1850 - }
1851 -
1852 - /*
1853 - * If the device failed to grab its irq resources,
1854 - * or some other error occurred, don't try to talk
1855 - * to the port hardware.
1856 - */
1857 - if (!(tty->flags & (1 << TTY_IO_ERROR))) {
1858 - /*
1859 - * Make termios settings take effect.
1860 - */
1861 - uart_change_speed(tty, state, NULL);
1862 -
1863 - /*
1864 - * And finally enable the RTS and DTR signals.
1865 - */
1866 - if (tty->termios->c_cflag & CBAUD)
1867 - uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1868 - }
1869 -}
1870 -
1871 static int uart_carrier_raised(struct tty_port *port)
1872 {
1873 struct uart_state *state = container_of(port, struct uart_state, port);
1874 @@ -1524,16 +1489,8 @@ static void uart_dtr_rts(struct tty_port *port, int onoff)
1875 struct uart_state *state = container_of(port, struct uart_state, port);
1876 struct uart_port *uport = state->uart_port;
1877
1878 - if (onoff) {
1879 + if (onoff)
1880 uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
1881 -
1882 - /*
1883 - * If this is the first open to succeed,
1884 - * adjust things to suit.
1885 - */
1886 - if (!test_and_set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags))
1887 - uart_update_termios(port->tty, state);
1888 - }
1889 else
1890 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
1891 }
1892 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1893 index caa2535..d0b84ff 100644
1894 --- a/drivers/usb/class/cdc-acm.c
1895 +++ b/drivers/usb/class/cdc-acm.c
1896 @@ -1617,6 +1617,8 @@ static const struct usb_device_id acm_ids[] = {
1897 { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */
1898 { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */
1899 { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */
1900 + { NOKIA_PCSUITE_ACM_INFO(0x0335), }, /* Nokia E7 */
1901 + { NOKIA_PCSUITE_ACM_INFO(0x03cd), }, /* Nokia C7 */
1902 { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */
1903
1904 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
1905 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1906 index 93720bd..78e7f25 100644
1907 --- a/drivers/usb/core/hub.c
1908 +++ b/drivers/usb/core/hub.c
1909 @@ -339,7 +339,8 @@ static int get_hub_status(struct usb_device *hdev,
1910 {
1911 int i, status = -ETIMEDOUT;
1912
1913 - for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) {
1914 + for (i = 0; i < USB_STS_RETRIES &&
1915 + (status == -ETIMEDOUT || status == -EPIPE); i++) {
1916 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
1917 USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0,
1918 data, sizeof(*data), USB_STS_TIMEOUT);
1919 @@ -355,7 +356,8 @@ static int get_port_status(struct usb_device *hdev, int port1,
1920 {
1921 int i, status = -ETIMEDOUT;
1922
1923 - for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) {
1924 + for (i = 0; i < USB_STS_RETRIES &&
1925 + (status == -ETIMEDOUT || status == -EPIPE); i++) {
1926 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
1927 USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1,
1928 data, sizeof(*data), USB_STS_TIMEOUT);
1929 diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
1930 index 0231814..ff00bd8 100644
1931 --- a/drivers/usb/host/xhci-dbg.c
1932 +++ b/drivers/usb/host/xhci-dbg.c
1933 @@ -437,13 +437,13 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci,
1934 struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
1935
1936 switch (GET_SLOT_STATE(slot_ctx->dev_state)) {
1937 - case 0:
1938 + case SLOT_STATE_ENABLED:
1939 return "enabled/disabled";
1940 - case 1:
1941 + case SLOT_STATE_DEFAULT:
1942 return "default";
1943 - case 2:
1944 + case SLOT_STATE_ADDRESSED:
1945 return "addressed";
1946 - case 3:
1947 + case SLOT_STATE_CONFIGURED:
1948 return "configured";
1949 default:
1950 return "reserved";
1951 diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
1952 index 783e5e0..976422a 100644
1953 --- a/drivers/usb/host/xhci-mem.c
1954 +++ b/drivers/usb/host/xhci-mem.c
1955 @@ -986,9 +986,19 @@ static unsigned int xhci_parse_exponent_interval(struct usb_device *udev,
1956 interval = clamp_val(ep->desc.bInterval, 1, 16) - 1;
1957 if (interval != ep->desc.bInterval - 1)
1958 dev_warn(&udev->dev,
1959 - "ep %#x - rounding interval to %d microframes\n",
1960 + "ep %#x - rounding interval to %d %sframes\n",
1961 ep->desc.bEndpointAddress,
1962 - 1 << interval);
1963 + 1 << interval,
1964 + udev->speed == USB_SPEED_FULL ? "" : "micro");
1965 +
1966 + if (udev->speed == USB_SPEED_FULL) {
1967 + /*
1968 + * Full speed isoc endpoints specify interval in frames,
1969 + * not microframes. We are using microframes everywhere,
1970 + * so adjust accordingly.
1971 + */
1972 + interval += 3; /* 1 frame = 2^3 uframes */
1973 + }
1974
1975 return interval;
1976 }
1977 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1978 index a10494c..4940717 100644
1979 --- a/drivers/usb/host/xhci-pci.c
1980 +++ b/drivers/usb/host/xhci-pci.c
1981 @@ -105,12 +105,22 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
1982
1983 /* Look for vendor-specific quirks */
1984 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
1985 - pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK &&
1986 - pdev->revision == 0x0) {
1987 + pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) {
1988 + if (pdev->revision == 0x0) {
1989 xhci->quirks |= XHCI_RESET_EP_QUIRK;
1990 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
1991 " endpoint cmd after reset endpoint\n");
1992 + }
1993 + /* Fresco Logic confirms: all revisions of this chip do not
1994 + * support MSI, even though some of them claim to in their PCI
1995 + * capabilities.
1996 + */
1997 + xhci->quirks |= XHCI_BROKEN_MSI;
1998 + xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
1999 + "has broken MSI implementation\n",
2000 + pdev->revision);
2001 }
2002 +
2003 if (pdev->vendor == PCI_VENDOR_ID_NEC)
2004 xhci->quirks |= XHCI_NEC_HOST;
2005
2006 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
2007 index d2cd3ce..e5c4861 100644
2008 --- a/drivers/usb/host/xhci.c
2009 +++ b/drivers/usb/host/xhci.c
2010 @@ -430,12 +430,19 @@ int xhci_run(struct usb_hcd *hcd)
2011 free_irq(hcd->irq, hcd);
2012 hcd->irq = -1;
2013
2014 + /* Some Fresco Logic host controllers advertise MSI, but fail to
2015 + * generate interrupts. Don't even try to enable MSI.
2016 + */
2017 + if (xhci->quirks & XHCI_BROKEN_MSI)
2018 + goto legacy_irq;
2019 +
2020 ret = xhci_setup_msix(xhci);
2021 if (ret)
2022 /* fall back to msi*/
2023 ret = xhci_setup_msi(xhci);
2024
2025 if (ret) {
2026 +legacy_irq:
2027 /* fall back to legacy interrupt*/
2028 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED,
2029 hcd->irq_descr, hcd);
2030 @@ -2284,6 +2291,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2031 struct xhci_command *reset_device_cmd;
2032 int timeleft;
2033 int last_freed_endpoint;
2034 + struct xhci_slot_ctx *slot_ctx;
2035
2036 ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__);
2037 if (ret <= 0)
2038 @@ -2316,6 +2324,12 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2039 return -EINVAL;
2040 }
2041
2042 + /* If device is not setup, there is no point in resetting it */
2043 + slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx);
2044 + if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) ==
2045 + SLOT_STATE_DISABLED)
2046 + return 0;
2047 +
2048 xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id);
2049 /* Allocate the command structure that holds the struct completion.
2050 * Assume we're in process context, since the normal device reset
2051 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
2052 index ba1be6b..fb85ce3 100644
2053 --- a/drivers/usb/host/xhci.h
2054 +++ b/drivers/usb/host/xhci.h
2055 @@ -560,6 +560,11 @@ struct xhci_slot_ctx {
2056 #define SLOT_STATE (0x1f << 27)
2057 #define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27)
2058
2059 +#define SLOT_STATE_DISABLED 0
2060 +#define SLOT_STATE_ENABLED SLOT_STATE_DISABLED
2061 +#define SLOT_STATE_DEFAULT 1
2062 +#define SLOT_STATE_ADDRESSED 2
2063 +#define SLOT_STATE_CONFIGURED 3
2064
2065 /**
2066 * struct xhci_ep_ctx
2067 @@ -1281,6 +1286,7 @@ struct xhci_hcd {
2068 #define XHCI_RESET_EP_QUIRK (1 << 1)
2069 #define XHCI_NEC_HOST (1 << 2)
2070 #define XHCI_AMD_PLL_FIX (1 << 3)
2071 +#define XHCI_BROKEN_MSI (1 << 6)
2072 /* There are two roothubs to keep track of bus suspend info for */
2073 struct xhci_bus_state bus_state[2];
2074 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
2075 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2076 index e8dbde5..1627289 100644
2077 --- a/drivers/usb/serial/ftdi_sio.c
2078 +++ b/drivers/usb/serial/ftdi_sio.c
2079 @@ -647,6 +647,7 @@ static struct usb_device_id id_table_combined [] = {
2080 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
2081 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
2082 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
2083 + { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_3_PID) },
2084 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) },
2085 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) },
2086 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) },
2087 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
2088 index 1d946cd..ab1fcdf 100644
2089 --- a/drivers/usb/serial/ftdi_sio_ids.h
2090 +++ b/drivers/usb/serial/ftdi_sio_ids.h
2091 @@ -351,6 +351,7 @@
2092 */
2093 #define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
2094 #define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
2095 +#define FTDI_4N_GALAXY_DE_3_PID 0xF3C2
2096
2097 /*
2098 * Linx Technologies product ids
2099 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2100 index 318dd00..60b25d8 100644
2101 --- a/drivers/usb/serial/option.c
2102 +++ b/drivers/usb/serial/option.c
2103 @@ -311,10 +311,6 @@ static void option_instat_callback(struct urb *urb);
2104 #define ZTE_PRODUCT_AC2726 0xfff5
2105 #define ZTE_PRODUCT_AC8710T 0xffff
2106
2107 -/* ZTE PRODUCTS -- alternate vendor ID */
2108 -#define ZTE_VENDOR_ID2 0x1d6b
2109 -#define ZTE_PRODUCT_MF_330 0x0002
2110 -
2111 #define BENQ_VENDOR_ID 0x04a5
2112 #define BENQ_PRODUCT_H10 0x4068
2113
2114 @@ -340,11 +336,12 @@ static void option_instat_callback(struct urb *urb);
2115 #define TOSHIBA_PRODUCT_G450 0x0d45
2116
2117 #define ALINK_VENDOR_ID 0x1e0e
2118 +#define ALINK_PRODUCT_PH300 0x9100
2119 #define ALINK_PRODUCT_3GU 0x9200
2120
2121 /* ALCATEL PRODUCTS */
2122 #define ALCATEL_VENDOR_ID 0x1bbb
2123 -#define ALCATEL_PRODUCT_X060S 0x0000
2124 +#define ALCATEL_PRODUCT_X060S_X200 0x0000
2125
2126 #define PIRELLI_VENDOR_ID 0x1266
2127 #define PIRELLI_PRODUCT_C100_1 0x1002
2128 @@ -379,6 +376,9 @@ static void option_instat_callback(struct urb *urb);
2129 * It seems to contain a Qualcomm QSC6240/6290 chipset */
2130 #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
2131
2132 +/* Zoom */
2133 +#define ZOOM_PRODUCT_4597 0x9607
2134 +
2135 /* Haier products */
2136 #define HAIER_VENDOR_ID 0x201e
2137 #define HAIER_PRODUCT_CE100 0x2009
2138 @@ -432,6 +432,20 @@ static const struct option_blacklist_info four_g_w14_blacklist = {
2139 .reason = OPTION_BLACKLIST_SENDSETUP
2140 };
2141
2142 +static const u8 alcatel_x200_no_sendsetup[] = { 0, 1 };
2143 +static const struct option_blacklist_info alcatel_x200_blacklist = {
2144 + .infolen = ARRAY_SIZE(alcatel_x200_no_sendsetup),
2145 + .ifaceinfo = alcatel_x200_no_sendsetup,
2146 + .reason = OPTION_BLACKLIST_SENDSETUP
2147 +};
2148 +
2149 +static const u8 zte_k3765_z_no_sendsetup[] = { 0, 1, 2 };
2150 +static const struct option_blacklist_info zte_k3765_z_blacklist = {
2151 + .infolen = ARRAY_SIZE(zte_k3765_z_no_sendsetup),
2152 + .ifaceinfo = zte_k3765_z_no_sendsetup,
2153 + .reason = OPTION_BLACKLIST_SENDSETUP
2154 +};
2155 +
2156 static const struct usb_device_id option_ids[] = {
2157 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
2158 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
2159 @@ -916,13 +930,13 @@ static const struct usb_device_id option_ids[] = {
2160 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
2161 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
2162 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
2163 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) },
2164 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
2165 + 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
2166 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
2167 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
2168 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
2169 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
2170 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
2171 - { USB_DEVICE(ZTE_VENDOR_ID2, ZTE_PRODUCT_MF_330) },
2172 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
2173 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
2174 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
2175 @@ -935,13 +949,17 @@ static const struct usb_device_id option_ids[] = {
2176 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
2177 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
2178 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
2179 + { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) },
2180 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
2181 - { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
2182 + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
2183 + .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
2184 + },
2185 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
2186 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
2187 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
2188 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
2189 },
2190 + { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
2191 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
2192 /* Pirelli */
2193 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)},
2194 diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
2195 index 0041899..e8ae21b 100644
2196 --- a/drivers/usb/storage/transport.c
2197 +++ b/drivers/usb/storage/transport.c
2198 @@ -819,6 +819,35 @@ Retry_Sense:
2199 }
2200 }
2201
2202 + /*
2203 + * Some devices don't work or return incorrect data the first
2204 + * time they get a READ(10) command, or for the first READ(10)
2205 + * after a media change. If the INITIAL_READ10 flag is set,
2206 + * keep track of whether READ(10) commands succeed. If the
2207 + * previous one succeeded and this one failed, set the REDO_READ10
2208 + * flag to force a retry.
2209 + */
2210 + if (unlikely((us->fflags & US_FL_INITIAL_READ10) &&
2211 + srb->cmnd[0] == READ_10)) {
2212 + if (srb->result == SAM_STAT_GOOD) {
2213 + set_bit(US_FLIDX_READ10_WORKED, &us->dflags);
2214 + } else if (test_bit(US_FLIDX_READ10_WORKED, &us->dflags)) {
2215 + clear_bit(US_FLIDX_READ10_WORKED, &us->dflags);
2216 + set_bit(US_FLIDX_REDO_READ10, &us->dflags);
2217 + }
2218 +
2219 + /*
2220 + * Next, if the REDO_READ10 flag is set, return a result
2221 + * code that will cause the SCSI core to retry the READ(10)
2222 + * command immediately.
2223 + */
2224 + if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) {
2225 + clear_bit(US_FLIDX_REDO_READ10, &us->dflags);
2226 + srb->result = DID_IMM_RETRY << 16;
2227 + srb->sense_buffer[0] = 0;
2228 + }
2229 + }
2230 +
2231 /* Did we transfer less than the minimum amount required? */
2232 if ((srb->result == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) &&
2233 scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow)
2234 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
2235 index c1602b8..ccff348 100644
2236 --- a/drivers/usb/storage/unusual_devs.h
2237 +++ b/drivers/usb/storage/unusual_devs.h
2238 @@ -1114,6 +1114,16 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
2239 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2240 US_FL_FIX_CAPACITY ),
2241
2242 +/* Reported by Paul Hartman <paul.hartman+linux@gmail.com>
2243 + * This card reader returns "Illegal Request, Logical Block Address
2244 + * Out of Range" for the first READ(10) after a new card is inserted.
2245 + */
2246 +UNUSUAL_DEV( 0x090c, 0x6000, 0x0100, 0x0100,
2247 + "Feiya",
2248 + "SD/SDHC Card Reader",
2249 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2250 + US_FL_INITIAL_READ10 ),
2251 +
2252 /* This Pentax still camera is not conformant
2253 * to the USB storage specification: -
2254 * - It does not like the INQUIRY command. So we must handle this command
2255 @@ -1888,6 +1898,15 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200,
2256 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2257 US_FL_NO_READ_DISC_INFO ),
2258
2259 +/* Reported by Sven Geggus <sven-usbst@geggus.net>
2260 + * This encrypted pen drive returns bogus data for the initial READ(10).
2261 + */
2262 +UNUSUAL_DEV( 0x1b1c, 0x1ab5, 0x0200, 0x0200,
2263 + "Corsair",
2264 + "Padlock v2",
2265 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2266 + US_FL_INITIAL_READ10 ),
2267 +
2268 /* Patch by Richard Schütz <r.schtz@t-online.de>
2269 * This external hard drive enclosure uses a JMicron chip which
2270 * needs the US_FL_IGNORE_RESIDUE flag to work properly. */
2271 diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
2272 index 4219c19..07d6d73 100644
2273 --- a/drivers/usb/storage/usb.c
2274 +++ b/drivers/usb/storage/usb.c
2275 @@ -439,7 +439,8 @@ static void adjust_quirks(struct us_data *us)
2276 US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE |
2277 US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 |
2278 US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE |
2279 - US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT);
2280 + US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT |
2281 + US_FL_INITIAL_READ10);
2282
2283 p = quirks;
2284 while (*p) {
2285 @@ -483,6 +484,9 @@ static void adjust_quirks(struct us_data *us)
2286 case 'm':
2287 f |= US_FL_MAX_SECTORS_64;
2288 break;
2289 + case 'n':
2290 + f |= US_FL_INITIAL_READ10;
2291 + break;
2292 case 'o':
2293 f |= US_FL_CAPACITY_OK;
2294 break;
2295 @@ -946,6 +950,13 @@ int usb_stor_probe2(struct us_data *us)
2296 if (result)
2297 goto BadDevice;
2298
2299 + /*
2300 + * If the device returns invalid data for the first READ(10)
2301 + * command, indicate the command should be retried.
2302 + */
2303 + if (us->fflags & US_FL_INITIAL_READ10)
2304 + set_bit(US_FLIDX_REDO_READ10, &us->dflags);
2305 +
2306 /* Acquire all the other resources and add the host */
2307 result = usb_stor_acquire_resources(us);
2308 if (result)
2309 diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
2310 index 89d3bff..7b0f211 100644
2311 --- a/drivers/usb/storage/usb.h
2312 +++ b/drivers/usb/storage/usb.h
2313 @@ -73,6 +73,8 @@ struct us_unusual_dev {
2314 #define US_FLIDX_RESETTING 4 /* device reset in progress */
2315 #define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */
2316 #define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */
2317 +#define US_FLIDX_REDO_READ10 7 /* redo READ(10) command */
2318 +#define US_FLIDX_READ10_WORKED 8 /* previous READ(10) succeeded */
2319
2320 #define USB_STOR_STRING_LEN 32
2321
2322 diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
2323 index 53b2c5a..305c975 100644
2324 --- a/drivers/video/vga16fb.c
2325 +++ b/drivers/video/vga16fb.c
2326 @@ -1265,9 +1265,11 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image
2327
2328 static void vga16fb_destroy(struct fb_info *info)
2329 {
2330 + struct platform_device *dev = container_of(info->device, struct platform_device, dev);
2331 iounmap(info->screen_base);
2332 fb_dealloc_cmap(&info->cmap);
2333 /* XXX unshare VGA regions */
2334 + platform_set_drvdata(dev, NULL);
2335 framebuffer_release(info);
2336 }
2337
2338 diff --git a/fs/block_dev.c b/fs/block_dev.c
2339 index 1f2b199..1a2421f 100644
2340 --- a/fs/block_dev.c
2341 +++ b/fs/block_dev.c
2342 @@ -1272,8 +1272,8 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
2343 * individual writeable reference is too fragile given the
2344 * way @mode is used in blkdev_get/put().
2345 */
2346 - if ((disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE) &&
2347 - !res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) {
2348 + if (!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder &&
2349 + (disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE)) {
2350 bdev->bd_write_holder = true;
2351 disk_block_events(disk);
2352 }
2353 diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
2354 index d1a016b..ba3d95b 100644
2355 --- a/fs/cifs/cifsencrypt.c
2356 +++ b/fs/cifs/cifsencrypt.c
2357 @@ -184,7 +184,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
2358 if (cifs_pdu == NULL || server == NULL)
2359 return -EINVAL;
2360
2361 - if (cifs_pdu->Command == SMB_COM_NEGOTIATE)
2362 + if (!server->session_estab)
2363 return 0;
2364
2365 if (cifs_pdu->Command == SMB_COM_LOCKING_ANDX) {
2366 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
2367 index 29fac128..5236582 100644
2368 --- a/fs/cifs/connect.c
2369 +++ b/fs/cifs/connect.c
2370 @@ -199,7 +199,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
2371 }
2372 spin_unlock(&GlobalMid_Lock);
2373
2374 - while (server->tcpStatus == CifsNeedReconnect) {
2375 + do {
2376 try_to_freeze();
2377
2378 /* we should try only the port we connected to before */
2379 @@ -214,7 +214,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
2380 server->tcpStatus = CifsNeedNegotiate;
2381 spin_unlock(&GlobalMid_Lock);
2382 }
2383 - }
2384 + } while (server->tcpStatus == CifsNeedReconnect);
2385
2386 return rc;
2387 }
2388 @@ -3208,7 +3208,7 @@ int cifs_negotiate_protocol(unsigned int xid, struct cifsSesInfo *ses)
2389 }
2390 if (rc == 0) {
2391 spin_lock(&GlobalMid_Lock);
2392 - if (server->tcpStatus != CifsExiting)
2393 + if (server->tcpStatus == CifsNeedNegotiate)
2394 server->tcpStatus = CifsGood;
2395 else
2396 rc = -EHOSTDOWN;
2397 diff --git a/fs/dcookies.c b/fs/dcookies.c
2398 index a21cabd..dda0dc7 100644
2399 --- a/fs/dcookies.c
2400 +++ b/fs/dcookies.c
2401 @@ -178,6 +178,8 @@ SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
2402 /* FIXME: (deleted) ? */
2403 path = d_path(&dcs->path, kbuf, PAGE_SIZE);
2404
2405 + mutex_unlock(&dcookie_mutex);
2406 +
2407 if (IS_ERR(path)) {
2408 err = PTR_ERR(path);
2409 goto out_free;
2410 @@ -194,6 +196,7 @@ SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
2411
2412 out_free:
2413 kfree(kbuf);
2414 + return err;
2415 out:
2416 mutex_unlock(&dcookie_mutex);
2417 return err;
2418 diff --git a/fs/exec.c b/fs/exec.c
2419 index 5e62d26..0c3682d 100644
2420 --- a/fs/exec.c
2421 +++ b/fs/exec.c
2422 @@ -1046,6 +1046,7 @@ int flush_old_exec(struct linux_binprm * bprm)
2423
2424 bprm->mm = NULL; /* We're using it now */
2425
2426 + set_fs(USER_DS);
2427 current->flags &= ~(PF_RANDOMIZE | PF_KTHREAD);
2428 flush_thread();
2429 current->personality &= ~bprm->per_clear;
2430 @@ -1310,10 +1311,6 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
2431 if (retval)
2432 return retval;
2433
2434 - /* kernel module loader fixup */
2435 - /* so we don't try to load run modprobe in kernel space. */
2436 - set_fs(USER_DS);
2437 -
2438 retval = audit_bprm(bprm);
2439 if (retval)
2440 return retval;
2441 diff --git a/fs/fat/file.c b/fs/fat/file.c
2442 index 7257752..7018e1d 100644
2443 --- a/fs/fat/file.c
2444 +++ b/fs/fat/file.c
2445 @@ -102,7 +102,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
2446 if (attr & ATTR_SYS)
2447 inode->i_flags |= S_IMMUTABLE;
2448 else
2449 - inode->i_flags &= S_IMMUTABLE;
2450 + inode->i_flags &= ~S_IMMUTABLE;
2451 }
2452
2453 fat_save_attrs(inode, attr);
2454 diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
2455 index aed25e8..e5cb2ce 100644
2456 --- a/fs/ubifs/journal.c
2457 +++ b/fs/ubifs/journal.c
2458 @@ -666,6 +666,7 @@ out_free:
2459
2460 out_release:
2461 release_head(c, BASEHD);
2462 + kfree(dent);
2463 out_ro:
2464 ubifs_ro_mode(c, err);
2465 if (last_reference)
2466 diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c
2467 index 46961c0..d8f5d0f 100644
2468 --- a/fs/ubifs/shrinker.c
2469 +++ b/fs/ubifs/shrinker.c
2470 @@ -283,7 +283,11 @@ int ubifs_shrinker(struct shrinker *shrink, int nr, gfp_t gfp_mask)
2471 long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt);
2472
2473 if (nr == 0)
2474 - return clean_zn_cnt;
2475 + /*
2476 + * Due to the way UBIFS updates the clean znode counter it may
2477 + * temporarily be negative.
2478 + */
2479 + return clean_zn_cnt >= 0 ? clean_zn_cnt : 1;
2480
2481 if (!clean_zn_cnt) {
2482 /*
2483 diff --git a/include/linux/efi.h b/include/linux/efi.h
2484 index e376270..33fa120 100644
2485 --- a/include/linux/efi.h
2486 +++ b/include/linux/efi.h
2487 @@ -299,7 +299,6 @@ extern void efi_initialize_iomem_resources(struct resource *code_resource,
2488 struct resource *data_resource, struct resource *bss_resource);
2489 extern unsigned long efi_get_time(void);
2490 extern int efi_set_rtc_mmss(unsigned long nowtime);
2491 -extern void efi_reserve_boot_services(void);
2492 extern struct efi_memory_map memmap;
2493
2494 /**
2495 diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
2496 index 71693d4..17df360 100644
2497 --- a/include/linux/usb_usual.h
2498 +++ b/include/linux/usb_usual.h
2499 @@ -62,7 +62,9 @@
2500 US_FLAG(NO_READ_DISC_INFO, 0x00040000) \
2501 /* cannot handle READ_DISC_INFO */ \
2502 US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
2503 - /* cannot handle READ_CAPACITY_16 */
2504 + /* cannot handle READ_CAPACITY_16 */ \
2505 + US_FLAG(INITIAL_READ10, 0x00100000) \
2506 + /* Initial READ(10) (and others) must be retried */
2507
2508 #define US_FLAG(name, value) US_FL_##name = value ,
2509 enum { US_DO_ALL_FLAGS };
2510 diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
2511 index 2c039c9..51e4944 100644
2512 --- a/kernel/irq/irqdesc.c
2513 +++ b/kernel/irq/irqdesc.c
2514 @@ -257,13 +257,11 @@ int __init early_irq_init(void)
2515 count = ARRAY_SIZE(irq_desc);
2516
2517 for (i = 0; i < count; i++) {
2518 - desc[i].irq_data.irq = i;
2519 - desc[i].irq_data.chip = &no_irq_chip;
2520 desc[i].kstat_irqs = alloc_percpu(unsigned int);
2521 - irq_settings_clr_and_set(desc, ~0, _IRQ_DEFAULT_INIT_FLAGS);
2522 - alloc_masks(desc + i, GFP_KERNEL, node);
2523 - desc_smp_init(desc + i, node);
2524 + alloc_masks(&desc[i], GFP_KERNEL, node);
2525 + raw_spin_lock_init(&desc[i].lock);
2526 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
2527 + desc_set_defaults(i, &desc[i], node);
2528 }
2529 return arch_early_irq_init();
2530 }
2531 diff --git a/kernel/lockdep.c b/kernel/lockdep.c
2532 index 53a6895..49452a7 100644
2533 --- a/kernel/lockdep.c
2534 +++ b/kernel/lockdep.c
2535 @@ -3242,7 +3242,7 @@ int lock_is_held(struct lockdep_map *lock)
2536 int ret = 0;
2537
2538 if (unlikely(current->lockdep_recursion))
2539 - return ret;
2540 + return 1; /* avoid false negative lockdep_assert_held() */
2541
2542 raw_local_irq_save(flags);
2543 check_flags(flags);
2544 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2545 index 8ee3bd8..39f86fc 100644
2546 --- a/mm/hugetlb.c
2547 +++ b/mm/hugetlb.c
2548 @@ -1033,10 +1033,10 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
2549 */
2550 chg = vma_needs_reservation(h, vma, addr);
2551 if (chg < 0)
2552 - return ERR_PTR(chg);
2553 + return ERR_PTR(-VM_FAULT_OOM);
2554 if (chg)
2555 if (hugetlb_get_quota(inode->i_mapping, chg))
2556 - return ERR_PTR(-ENOSPC);
2557 + return ERR_PTR(-VM_FAULT_SIGBUS);
2558
2559 spin_lock(&hugetlb_lock);
2560 page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve);
2561 diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
2562 index 3e81af1..821590d 100644
2563 --- a/net/mac80211/ibss.c
2564 +++ b/net/mac80211/ibss.c
2565 @@ -967,6 +967,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
2566
2567 mutex_lock(&sdata->u.ibss.mtx);
2568
2569 + sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
2570 + memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
2571 + sdata->u.ibss.ssid_len = 0;
2572 +
2573 active_ibss = ieee80211_sta_active_ibss(sdata);
2574
2575 if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
2576 @@ -1000,8 +1004,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
2577 kfree_skb(skb);
2578
2579 skb_queue_purge(&sdata->skb_queue);
2580 - memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
2581 - sdata->u.ibss.ssid_len = 0;
2582
2583 del_timer_sync(&sdata->u.ibss.timer);
2584
2585 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2586 index 2c70a1e..29a1ce1 100644
2587 --- a/net/wireless/nl80211.c
2588 +++ b/net/wireless/nl80211.c
2589 @@ -3239,12 +3239,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
2590 i = 0;
2591 if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) {
2592 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) {
2593 + request->ssids[i].ssid_len = nla_len(attr);
2594 if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) {
2595 err = -EINVAL;
2596 goto out_free;
2597 }
2598 memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr));
2599 - request->ssids[i].ssid_len = nla_len(attr);
2600 i++;
2601 }
2602 }
2603 diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
2604 index ec1bcec..3d2fd14 100644
2605 --- a/security/apparmor/lsm.c
2606 +++ b/security/apparmor/lsm.c
2607 @@ -612,7 +612,7 @@ static int apparmor_setprocattr(struct task_struct *task, char *name,
2608 static int apparmor_task_setrlimit(struct task_struct *task,
2609 unsigned int resource, struct rlimit *new_rlim)
2610 {
2611 - struct aa_profile *profile = aa_current_profile();
2612 + struct aa_profile *profile = __aa_current_profile();
2613 int error = 0;
2614
2615 if (!unconfined(profile))
2616 diff --git a/security/tomoyo/mount.c b/security/tomoyo/mount.c
2617 index 82bf8c2..afa07cf 100644
2618 --- a/security/tomoyo/mount.c
2619 +++ b/security/tomoyo/mount.c
2620 @@ -138,7 +138,7 @@ static int tomoyo_mount_acl(struct tomoyo_request_info *r, char *dev_name,
2621 }
2622 if (need_dev) {
2623 /* Get mount point or device file. */
2624 - if (kern_path(dev_name, LOOKUP_FOLLOW, &path)) {
2625 + if (!dev_name || kern_path(dev_name, LOOKUP_FOLLOW, &path)) {
2626 error = -ENOENT;
2627 goto out;
2628 }
2629 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2630 index c82979a..2e95f01 100644
2631 --- a/sound/pci/hda/patch_realtek.c
2632 +++ b/sound/pci/hda/patch_realtek.c
2633 @@ -13804,6 +13804,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
2634 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
2635 ALC268_ACER_ASPIRE_ONE),
2636 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
2637 + SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
2638 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
2639 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
2640 /* almost compatible with toshiba but with optional digital outs;
2641 diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
2642 index ab63d52..754c496 100644
2643 --- a/sound/soc/codecs/ad1836.c
2644 +++ b/sound/soc/codecs/ad1836.c
2645 @@ -145,22 +145,22 @@ static int ad1836_hw_params(struct snd_pcm_substream *substream,
2646 /* bit size */
2647 switch (params_format(params)) {
2648 case SNDRV_PCM_FORMAT_S16_LE:
2649 - word_len = 3;
2650 + word_len = AD1836_WORD_LEN_16;
2651 break;
2652 case SNDRV_PCM_FORMAT_S20_3LE:
2653 - word_len = 1;
2654 + word_len = AD1836_WORD_LEN_20;
2655 break;
2656 case SNDRV_PCM_FORMAT_S24_LE:
2657 case SNDRV_PCM_FORMAT_S32_LE:
2658 - word_len = 0;
2659 + word_len = AD1836_WORD_LEN_24;
2660 break;
2661 }
2662
2663 - snd_soc_update_bits(codec, AD1836_DAC_CTRL1,
2664 - AD1836_DAC_WORD_LEN_MASK, word_len);
2665 + snd_soc_update_bits(codec, AD1836_DAC_CTRL1, AD1836_DAC_WORD_LEN_MASK,
2666 + word_len << AD1836_DAC_WORD_LEN_OFFSET);
2667
2668 - snd_soc_update_bits(codec, AD1836_ADC_CTRL2,
2669 - AD1836_ADC_WORD_LEN_MASK, word_len);
2670 + snd_soc_update_bits(codec, AD1836_ADC_CTRL2, AD1836_ADC_WORD_LEN_MASK,
2671 + word_len << AD1836_ADC_WORD_OFFSET);
2672
2673 return 0;
2674 }
2675 diff --git a/sound/soc/codecs/ad1836.h b/sound/soc/codecs/ad1836.h
2676 index 8455967..9d6a3f8 100644
2677 --- a/sound/soc/codecs/ad1836.h
2678 +++ b/sound/soc/codecs/ad1836.h
2679 @@ -25,6 +25,7 @@
2680 #define AD1836_DAC_SERFMT_PCK256 (0x4 << 5)
2681 #define AD1836_DAC_SERFMT_PCK128 (0x5 << 5)
2682 #define AD1836_DAC_WORD_LEN_MASK 0x18
2683 +#define AD1836_DAC_WORD_LEN_OFFSET 3
2684
2685 #define AD1836_DAC_CTRL2 1
2686 #define AD1836_DACL1_MUTE 0
2687 @@ -51,6 +52,7 @@
2688 #define AD1836_ADCL2_MUTE 2
2689 #define AD1836_ADCR2_MUTE 3
2690 #define AD1836_ADC_WORD_LEN_MASK 0x30
2691 +#define AD1836_ADC_WORD_OFFSET 5
2692 #define AD1836_ADC_SERFMT_MASK (7 << 6)
2693 #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6)
2694 #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6)
2695 @@ -60,4 +62,8 @@
2696
2697 #define AD1836_NUM_REGS 16
2698
2699 +#define AD1836_WORD_LEN_24 0x0
2700 +#define AD1836_WORD_LEN_20 0x1
2701 +#define AD1836_WORD_LEN_16 0x2
2702 +
2703 #endif
2704 diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
2705 index 6785688..9a5e67c 100644
2706 --- a/sound/soc/codecs/wm8804.c
2707 +++ b/sound/soc/codecs/wm8804.c
2708 @@ -680,20 +680,25 @@ static struct snd_soc_dai_ops wm8804_dai_ops = {
2709 #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
2710 SNDRV_PCM_FMTBIT_S24_LE)
2711
2712 +#define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
2713 + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \
2714 + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | \
2715 + SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000)
2716 +
2717 static struct snd_soc_dai_driver wm8804_dai = {
2718 .name = "wm8804-spdif",
2719 .playback = {
2720 .stream_name = "Playback",
2721 .channels_min = 2,
2722 .channels_max = 2,
2723 - .rates = SNDRV_PCM_RATE_8000_192000,
2724 + .rates = WM8804_RATES,
2725 .formats = WM8804_FORMATS,
2726 },
2727 .capture = {
2728 .stream_name = "Capture",
2729 .channels_min = 2,
2730 .channels_max = 2,
2731 - .rates = SNDRV_PCM_RATE_8000_192000,
2732 + .rates = WM8804_RATES,
2733 .formats = WM8804_FORMATS,
2734 },
2735 .ops = &wm8804_dai_ops,
2736 diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
2737 index 500011e..c22659e 100644
2738 --- a/sound/soc/codecs/wm8962.c
2739 +++ b/sound/soc/codecs/wm8962.c
2740 @@ -1998,12 +1998,12 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
2741 return 0;
2742
2743 /* If the left PGA is enabled hit that VU bit... */
2744 - if (reg_cache[WM8962_PWR_MGMT_2] & WM8962_HPOUTL_PGA_ENA)
2745 + if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTL_PGA_ENA)
2746 return snd_soc_write(codec, WM8962_HPOUTL_VOLUME,
2747 reg_cache[WM8962_HPOUTL_VOLUME]);
2748
2749 /* ...otherwise the right. The VU is stereo. */
2750 - if (reg_cache[WM8962_PWR_MGMT_2] & WM8962_HPOUTR_PGA_ENA)
2751 + if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTR_PGA_ENA)
2752 return snd_soc_write(codec, WM8962_HPOUTR_VOLUME,
2753 reg_cache[WM8962_HPOUTR_VOLUME]);
2754
2755 diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
2756 index ffa09b3..992a732 100644
2757 --- a/sound/soc/samsung/i2s.c
2758 +++ b/sound/soc/samsung/i2s.c
2759 @@ -191,7 +191,7 @@ static inline bool tx_active(struct i2s_dai *i2s)
2760 if (!i2s)
2761 return false;
2762
2763 - active = readl(i2s->addr + I2SMOD);
2764 + active = readl(i2s->addr + I2SCON);
2765
2766 if (is_secondary(i2s))
2767 active &= CON_TXSDMA_ACTIVE;
2768 @@ -223,7 +223,7 @@ static inline bool rx_active(struct i2s_dai *i2s)
2769 if (!i2s)
2770 return false;
2771
2772 - active = readl(i2s->addr + I2SMOD) & CON_RXDMA_ACTIVE;
2773 + active = readl(i2s->addr + I2SCON) & CON_RXDMA_ACTIVE;
2774
2775 return active ? true : false;
2776 }
2777 diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
2778 index 81c4052..586d10b 100644
2779 --- a/sound/soc/soc-dapm.c
2780 +++ b/sound/soc/soc-dapm.c
2781 @@ -362,9 +362,9 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
2782 }
2783
2784 /* create new dapm mixer control */
2785 -static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
2786 - struct snd_soc_dapm_widget *w)
2787 +static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
2788 {
2789 + struct snd_soc_dapm_context *dapm = w->dapm;
2790 int i, ret = 0;
2791 size_t name_len, prefix_len;
2792 struct snd_soc_dapm_path *path;
2793 @@ -443,9 +443,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
2794 }
2795
2796 /* create new dapm mux control */
2797 -static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
2798 - struct snd_soc_dapm_widget *w)
2799 +static int dapm_new_mux(struct snd_soc_dapm_widget *w)
2800 {
2801 + struct snd_soc_dapm_context *dapm = w->dapm;
2802 struct snd_soc_dapm_path *path = NULL;
2803 struct snd_kcontrol *kcontrol;
2804 struct snd_card *card = dapm->card->snd_card;
2805 @@ -490,8 +490,7 @@ err:
2806 }
2807
2808 /* create new dapm volume control */
2809 -static int dapm_new_pga(struct snd_soc_dapm_context *dapm,
2810 - struct snd_soc_dapm_widget *w)
2811 +static int dapm_new_pga(struct snd_soc_dapm_widget *w)
2812 {
2813 if (w->num_kcontrols)
2814 dev_err(w->dapm->dev,
2815 @@ -1735,13 +1734,13 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
2816 case snd_soc_dapm_mixer:
2817 case snd_soc_dapm_mixer_named_ctl:
2818 w->power_check = dapm_generic_check_power;
2819 - dapm_new_mixer(dapm, w);
2820 + dapm_new_mixer(w);
2821 break;
2822 case snd_soc_dapm_mux:
2823 case snd_soc_dapm_virt_mux:
2824 case snd_soc_dapm_value_mux:
2825 w->power_check = dapm_generic_check_power;
2826 - dapm_new_mux(dapm, w);
2827 + dapm_new_mux(w);
2828 break;
2829 case snd_soc_dapm_adc:
2830 case snd_soc_dapm_aif_out:
2831 @@ -1754,7 +1753,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
2832 case snd_soc_dapm_pga:
2833 case snd_soc_dapm_out_drv:
2834 w->power_check = dapm_generic_check_power;
2835 - dapm_new_pga(dapm, w);
2836 + dapm_new_pga(w);
2837 break;
2838 case snd_soc_dapm_input:
2839 case snd_soc_dapm_output: