/[linux-patches]/genpatches-2.6/trunk/2.6.18/1001_linux-2.6.18.2.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.18/1001_linux-2.6.18.2.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 693 - (show annotations) (download)
Sat Nov 4 13:52:39 2006 UTC (11 years, 1 month ago) by phreak
File size: 90269 byte(s)
Removing the Makefile hunk.
1 diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu
2 index 21c9a4e..fc4f2ab 100644
3 --- a/arch/i386/Kconfig.cpu
4 +++ b/arch/i386/Kconfig.cpu
5 @@ -7,6 +7,7 @@ choice
6
7 config M386
8 bool "386"
9 + depends on !UML
10 ---help---
11 This is the processor type of your CPU. This information is used for
12 optimizing purposes. In order to compile a kernel that can run on
13 @@ -301,7 +302,7 @@ config X86_USE_PPRO_CHECKSUM
14
15 config X86_USE_3DNOW
16 bool
17 - depends on MCYRIXIII || MK7 || MGEODE_LX
18 + depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML
19 default y
20
21 config X86_OOSTORE
22 diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
23 index 28ab806..583c238 100644
24 --- a/arch/i386/kernel/alternative.c
25 +++ b/arch/i386/kernel/alternative.c
26 @@ -344,6 +344,7 @@ #endif
27
28 void __init alternative_instructions(void)
29 {
30 + unsigned long flags;
31 if (no_replacement) {
32 printk(KERN_INFO "(SMP-)alternatives turned off\n");
33 free_init_pages("SMP alternatives",
34 @@ -351,6 +352,8 @@ void __init alternative_instructions(voi
35 (unsigned long)__smp_alt_end);
36 return;
37 }
38 +
39 + local_irq_save(flags);
40 apply_alternatives(__alt_instructions, __alt_instructions_end);
41
42 /* switch to patch-once-at-boottime-only mode and free the
43 @@ -386,4 +389,5 @@ #ifdef CONFIG_SMP
44 alternatives_smp_switch(0);
45 }
46 #endif
47 + local_irq_restore(flags);
48 }
49 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
50 index 694b0c6..f35bb14 100644
51 --- a/arch/powerpc/Kconfig
52 +++ b/arch/powerpc/Kconfig
53 @@ -729,6 +729,15 @@ config ARCH_MEMORY_PROBE
54 def_bool y
55 depends on MEMORY_HOTPLUG
56
57 +# Some NUMA nodes have memory ranges that span
58 +# other nodes. Even though a pfn is valid and
59 +# between a node's start and end pfns, it may not
60 +# reside on that node. See memmap_init_zone()
61 +# for details.
62 +config NODES_SPAN_OTHER_NODES
63 + def_bool y
64 + depends on NEED_MULTIPLE_NODES
65 +
66 config PPC_64K_PAGES
67 bool "64k page size"
68 depends on PPC64
69 diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
70 index a8cdf31..40782c0 100644
71 --- a/arch/powerpc/configs/pseries_defconfig
72 +++ b/arch/powerpc/configs/pseries_defconfig
73 @@ -184,6 +184,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
74 CONFIG_MIGRATION=y
75 CONFIG_RESOURCES_64BIT=y
76 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
77 +CONFIG_NODES_SPAN_OTHER_NODES=y
78 # CONFIG_PPC_64K_PAGES is not set
79 CONFIG_SCHED_SMT=y
80 CONFIG_PROC_DEVICETREE=y
81 diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
82 index 2f4f70c..bf25932 100644
83 --- a/arch/s390/Kconfig
84 +++ b/arch/s390/Kconfig
85 @@ -51,6 +51,10 @@ config 64BIT
86 Select this option if you have a 64 bit IBM zSeries machine
87 and want to use the 64 bit addressing mode.
88
89 +config 32BIT
90 + bool
91 + default y if !64BIT
92 +
93 config SMP
94 bool "Symmetric multi-processing support"
95 ---help---
96 diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
97 index e05d087..1400141 100644
98 --- a/arch/s390/lib/Makefile
99 +++ b/arch/s390/lib/Makefile
100 @@ -7,3 +7,4 @@ EXTRA_AFLAGS := -traditional
101 lib-y += delay.o string.o
102 lib-y += $(if $(CONFIG_64BIT),uaccess64.o,uaccess.o)
103 lib-$(CONFIG_SMP) += spinlock.o
104 +lib-$(CONFIG_32BIT) += div64.o
105 diff --git a/arch/s390/lib/div64.c b/arch/s390/lib/div64.c
106 new file mode 100644
107 index 0000000..0481f34
108 --- /dev/null
109 +++ b/arch/s390/lib/div64.c
110 @@ -0,0 +1,151 @@
111 +/*
112 + * arch/s390/lib/div64.c
113 + *
114 + * __div64_32 implementation for 31 bit.
115 + *
116 + * Copyright (C) IBM Corp. 2006
117 + * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
118 + */
119 +
120 +#include <linux/types.h>
121 +#include <linux/module.h>
122 +
123 +#ifdef CONFIG_MARCH_G5
124 +
125 +/*
126 + * Function to divide an unsigned 64 bit integer by an unsigned
127 + * 31 bit integer using signed 64/32 bit division.
128 + */
129 +static uint32_t __div64_31(uint64_t *n, uint32_t base)
130 +{
131 + register uint32_t reg2 asm("2");
132 + register uint32_t reg3 asm("3");
133 + uint32_t *words = (uint32_t *) n;
134 + uint32_t tmp;
135 +
136 + /* Special case base==1, remainder = 0, quotient = n */
137 + if (base == 1)
138 + return 0;
139 + /*
140 + * Special case base==0 will cause a fixed point divide exception
141 + * on the dr instruction and may not happen anyway. For the
142 + * following calculation we can assume base > 1. The first
143 + * signed 64 / 32 bit division with an upper half of 0 will
144 + * give the correct upper half of the 64 bit quotient.
145 + */
146 + reg2 = 0UL;
147 + reg3 = words[0];
148 + asm volatile(
149 + " dr %0,%2\n"
150 + : "+d" (reg2), "+d" (reg3) : "d" (base) : "cc" );
151 + words[0] = reg3;
152 + reg3 = words[1];
153 + /*
154 + * To get the lower half of the 64 bit quotient and the 32 bit
155 + * remainder we have to use a little trick. Since we only have
156 + * a signed division the quotient can get too big. To avoid this
157 + * the 64 bit dividend is halved, then the signed division will
158 + * work. Afterwards the quotient and the remainder are doubled.
159 + * If the last bit of the dividend has been one the remainder
160 + * is increased by one then checked against the base. If the
161 + * remainder has overflown subtract base and increase the
162 + * quotient. Simple, no ?
163 + */
164 + asm volatile(
165 + " nr %2,%1\n"
166 + " srdl %0,1\n"
167 + " dr %0,%3\n"
168 + " alr %0,%0\n"
169 + " alr %1,%1\n"
170 + " alr %0,%2\n"
171 + " clr %0,%3\n"
172 + " jl 0f\n"
173 + " slr %0,%3\n"
174 + " alr %1,%2\n"
175 + "0:\n"
176 + : "+d" (reg2), "+d" (reg3), "=d" (tmp)
177 + : "d" (base), "2" (1UL) : "cc" );
178 + words[1] = reg3;
179 + return reg2;
180 +}
181 +
182 +/*
183 + * Function to divide an unsigned 64 bit integer by an unsigned
184 + * 32 bit integer using the unsigned 64/31 bit division.
185 + */
186 +uint32_t __div64_32(uint64_t *n, uint32_t base)
187 +{
188 + uint32_t r;
189 +
190 + /*
191 + * If the most significant bit of base is set, divide n by
192 + * (base/2). That allows to use 64/31 bit division and gives a
193 + * good approximation of the result: n = (base/2)*q + r. The
194 + * result needs to be corrected with two simple transformations.
195 + * If base is already < 2^31-1 __div64_31 can be used directly.
196 + */
197 + r = __div64_31(n, ((signed) base < 0) ? (base/2) : base);
198 + if ((signed) base < 0) {
199 + uint64_t q = *n;
200 + /*
201 + * First transformation:
202 + * n = (base/2)*q + r
203 + * = ((base/2)*2)*(q/2) + ((q&1) ? (base/2) : 0) + r
204 + * Since r < (base/2), r + (base/2) < base.
205 + * With q1 = (q/2) and r1 = r + ((q&1) ? (base/2) : 0)
206 + * n = ((base/2)*2)*q1 + r1 with r1 < base.
207 + */
208 + if (q & 1)
209 + r += base/2;
210 + q >>= 1;
211 + /*
212 + * Second transformation. ((base/2)*2) could have lost the
213 + * last bit.
214 + * n = ((base/2)*2)*q1 + r1
215 + * = base*q1 - ((base&1) ? q1 : 0) + r1
216 + */
217 + if (base & 1) {
218 + int64_t rx = r - q;
219 + /*
220 + * base is >= 2^31. The worst case for the while
221 + * loop is n=2^64-1 base=2^31+1. That gives a
222 + * maximum for q=(2^64-1)/2^31 = 0x1ffffffff. Since
223 + * base >= 2^31 the loop is finished after a maximum
224 + * of three iterations.
225 + */
226 + while (rx < 0) {
227 + rx += base;
228 + q--;
229 + }
230 + r = rx;
231 + }
232 + *n = q;
233 + }
234 + return r;
235 +}
236 +
237 +#else /* MARCH_G5 */
238 +
239 +uint32_t __div64_32(uint64_t *n, uint32_t base)
240 +{
241 + register uint32_t reg2 asm("2");
242 + register uint32_t reg3 asm("3");
243 + uint32_t *words = (uint32_t *) n;
244 +
245 + reg2 = 0UL;
246 + reg3 = words[0];
247 + asm volatile(
248 + " dlr %0,%2\n"
249 + : "+d" (reg2), "+d" (reg3) : "d" (base) : "cc" );
250 + words[0] = reg3;
251 + reg3 = words[1];
252 + asm volatile(
253 + " dlr %0,%2\n"
254 + : "+d" (reg2), "+d" (reg3) : "d" (base) : "cc" );
255 + words[1] = reg3;
256 + return reg2;
257 +}
258 +
259 +#endif /* MARCH_G5 */
260 +
261 +EXPORT_SYMBOL(__div64_32);
262 diff --git a/arch/sparc64/kernel/central.c b/arch/sparc64/kernel/central.c
263 index b66336d..e724c54 100644
264 --- a/arch/sparc64/kernel/central.c
265 +++ b/arch/sparc64/kernel/central.c
266 @@ -126,6 +126,10 @@ static void probe_other_fhcs(void)
267 int board;
268 u32 tmp;
269
270 + if (dp->parent &&
271 + dp->parent->parent != NULL)
272 + continue;
273 +
274 fhc = (struct linux_fhc *)
275 central_alloc_bootmem(sizeof(struct linux_fhc));
276 if (fhc == NULL)
277 diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
278 index 238bbf6..c7bbd7a 100644
279 --- a/arch/sparc64/kernel/of_device.c
280 +++ b/arch/sparc64/kernel/of_device.c
281 @@ -398,16 +398,22 @@ static void of_bus_sbus_count_cells(stru
282 *sizec = 1;
283 }
284
285 -static int of_bus_sbus_map(u32 *addr, const u32 *range, int na, int ns, int pna)
286 -{
287 - return of_bus_default_map(addr, range, na, ns, pna);
288 -}
289 -
290 -static unsigned int of_bus_sbus_get_flags(u32 *addr)
291 +/*
292 + * FHC/Central bus specific translator.
293 + *
294 + * This is just needed to hard-code the address and size cell
295 + * counts. 'fhc' and 'central' nodes lack the #address-cells and
296 + * #size-cells properties, and if you walk to the root on such
297 + * Enterprise boxes all you'll get is a #size-cells of 2 which is
298 + * not what we want to use.
299 + */
300 +static int of_bus_fhc_match(struct device_node *np)
301 {
302 - return IORESOURCE_MEM;
303 + return !strcmp(np->name, "fhc") ||
304 + !strcmp(np->name, "central");
305 }
306
307 +#define of_bus_fhc_count_cells of_bus_sbus_count_cells
308
309 /*
310 * Array of bus specific translators
311 @@ -429,8 +435,17 @@ static struct of_bus of_busses[] = {
312 .addr_prop_name = "reg",
313 .match = of_bus_sbus_match,
314 .count_cells = of_bus_sbus_count_cells,
315 - .map = of_bus_sbus_map,
316 - .get_flags = of_bus_sbus_get_flags,
317 + .map = of_bus_default_map,
318 + .get_flags = of_bus_default_get_flags,
319 + },
320 + /* FHC */
321 + {
322 + .name = "fhc",
323 + .addr_prop_name = "reg",
324 + .match = of_bus_fhc_match,
325 + .count_cells = of_bus_fhc_count_cells,
326 + .map = of_bus_default_map,
327 + .get_flags = of_bus_default_get_flags,
328 },
329 /* Default */
330 {
331 diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
332 index 7a59cc7..827ae30 100644
333 --- a/arch/sparc64/kernel/pci_common.c
334 +++ b/arch/sparc64/kernel/pci_common.c
335 @@ -330,19 +330,6 @@ #endif
336 return res;
337 }
338
339 -static int __init pdev_resource_collisions_expected(struct pci_dev *pdev)
340 -{
341 - if (pdev->vendor != PCI_VENDOR_ID_SUN)
342 - return 0;
343 -
344 - if (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS ||
345 - pdev->device == PCI_DEVICE_ID_SUN_RIO_1394 ||
346 - pdev->device == PCI_DEVICE_ID_SUN_RIO_USB)
347 - return 1;
348 -
349 - return 0;
350 -}
351 -
352 static void __init pdev_record_assignments(struct pci_pbm_info *pbm,
353 struct pci_dev *pdev)
354 {
355 @@ -400,19 +387,23 @@ static void __init pdev_record_assignmen
356 pbm->parent->resource_adjust(pdev, res, root);
357
358 if (request_resource(root, res) < 0) {
359 + int rnum;
360 +
361 /* OK, there is some conflict. But this is fine
362 * since we'll reassign it in the fixup pass.
363 *
364 - * We notify the user that OBP made an error if it
365 - * is a case we don't expect.
366 + * Do not print the warning for ROM resources
367 + * as such a conflict is quite common and
368 + * harmless as the ROM bar is disabled.
369 */
370 - if (!pdev_resource_collisions_expected(pdev)) {
371 - printk(KERN_ERR "PCI: Address space collision on region %ld "
372 + rnum = (res - &pdev->resource[0]);
373 + if (rnum != PCI_ROM_RESOURCE)
374 + printk(KERN_ERR "PCI: Resource collision, "
375 + "region %d "
376 "[%016lx:%016lx] of device %s\n",
377 - (res - &pdev->resource[0]),
378 + rnum,
379 res->start, res->end,
380 pci_name(pdev));
381 - }
382 }
383 }
384 }
385 diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c
386 index 82e5455..2e7f142 100644
387 --- a/arch/sparc64/kernel/pci_iommu.c
388 +++ b/arch/sparc64/kernel/pci_iommu.c
389 @@ -281,7 +281,7 @@ static void pci_4u_free_consistent(struc
390
391 spin_lock_irqsave(&iommu->lock, flags);
392
393 - free_npages(iommu, dvma, npages);
394 + free_npages(iommu, dvma - iommu->page_table_map_base, npages);
395
396 spin_unlock_irqrestore(&iommu->lock, flags);
397
398 diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
399 index 4589185..f04c6d2 100644
400 --- a/arch/sparc64/kernel/pci_sabre.c
401 +++ b/arch/sparc64/kernel/pci_sabre.c
402 @@ -1196,7 +1196,7 @@ static void pbm_register_toplevel_resour
403 &pbm->mem_space);
404 }
405
406 -static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_begin)
407 +static void sabre_pbm_init(struct pci_controller_info *p, struct device_node *dp, u32 dma_start, u32 dma_end)
408 {
409 struct pci_pbm_info *pbm;
410 struct device_node *node;
411 @@ -1261,6 +1261,8 @@ static void sabre_pbm_init(struct pci_co
412 node = node->sibling;
413 }
414 if (simbas_found == 0) {
415 + struct resource *rp;
416 +
417 /* No APBs underneath, probably this is a hummingbird
418 * system.
419 */
420 @@ -1302,8 +1304,10 @@ static void sabre_pbm_init(struct pci_co
421 pbm->io_space.end = pbm->io_space.start + (1UL << 24) - 1UL;
422 pbm->io_space.flags = IORESOURCE_IO;
423
424 - pbm->mem_space.start = p->pbm_A.controller_regs + SABRE_MEMSPACE;
425 - pbm->mem_space.end = pbm->mem_space.start + (unsigned long)dma_begin - 1UL;
426 + pbm->mem_space.start =
427 + (p->pbm_A.controller_regs + SABRE_MEMSPACE);
428 + pbm->mem_space.end =
429 + (pbm->mem_space.start + ((1UL << 32UL) - 1UL));
430 pbm->mem_space.flags = IORESOURCE_MEM;
431
432 if (request_resource(&ioport_resource, &pbm->io_space) < 0) {
433 @@ -1315,6 +1319,17 @@ static void sabre_pbm_init(struct pci_co
434 prom_halt();
435 }
436
437 + rp = kmalloc(sizeof(*rp), GFP_KERNEL);
438 + if (!rp) {
439 + prom_printf("Cannot allocate IOMMU resource.\n");
440 + prom_halt();
441 + }
442 + rp->name = "IOMMU";
443 + rp->start = pbm->mem_space.start + (unsigned long) dma_start;
444 + rp->end = pbm->mem_space.start + (unsigned long) dma_end - 1UL;
445 + rp->flags = IORESOURCE_BUSY;
446 + request_resource(&pbm->mem_space, rp);
447 +
448 pci_register_legacy_regions(&pbm->io_space,
449 &pbm->mem_space);
450 }
451 @@ -1450,5 +1465,5 @@ void sabre_init(struct device_node *dp,
452 /*
453 * Look for APB underneath.
454 */
455 - sabre_pbm_init(p, dp, vdma[0]);
456 + sabre_pbm_init(p, dp, vdma[0], vdma[0] + vdma[1]);
457 }
458 diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
459 index 5cc5ab6..03d6be8 100644
460 --- a/arch/sparc64/kernel/prom.c
461 +++ b/arch/sparc64/kernel/prom.c
462 @@ -1080,23 +1080,22 @@ static void sun4v_vdev_irq_trans_init(st
463
464 static void irq_trans_init(struct device_node *dp)
465 {
466 - const char *model;
467 #ifdef CONFIG_PCI
468 + const char *model;
469 int i;
470 #endif
471
472 +#ifdef CONFIG_PCI
473 model = of_get_property(dp, "model", NULL);
474 if (!model)
475 model = of_get_property(dp, "compatible", NULL);
476 - if (!model)
477 - return;
478 -
479 -#ifdef CONFIG_PCI
480 - for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
481 - struct irq_trans *t = &pci_irq_trans_table[i];
482 + if (model) {
483 + for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
484 + struct irq_trans *t = &pci_irq_trans_table[i];
485
486 - if (!strcmp(model, t->name))
487 - return t->init(dp);
488 + if (!strcmp(model, t->name))
489 + return t->init(dp);
490 + }
491 }
492 #endif
493 #ifdef CONFIG_SBUS
494 @@ -1104,8 +1103,9 @@ #ifdef CONFIG_SBUS
495 !strcmp(dp->name, "sbi"))
496 return sbus_irq_trans_init(dp);
497 #endif
498 - if (!strcmp(dp->name, "central"))
499 - return central_irq_trans_init(dp->child);
500 + if (!strcmp(dp->name, "fhc") &&
501 + !strcmp(dp->parent->name, "central"))
502 + return central_irq_trans_init(dp);
503 if (!strcmp(dp->name, "virtual-devices"))
504 return sun4v_vdev_irq_trans_init(dp);
505 }
506 @@ -1517,7 +1517,7 @@ static char * __init get_one_property(ph
507 return buf;
508 }
509
510 -static struct device_node * __init create_node(phandle node)
511 +static struct device_node * __init create_node(phandle node, struct device_node *parent)
512 {
513 struct device_node *dp;
514
515 @@ -1526,6 +1526,7 @@ static struct device_node * __init creat
516
517 dp = prom_early_alloc(sizeof(*dp));
518 dp->unique_id = unique_id++;
519 + dp->parent = parent;
520
521 kref_init(&dp->kref);
522
523 @@ -1544,12 +1545,11 @@ static struct device_node * __init build
524 {
525 struct device_node *dp;
526
527 - dp = create_node(node);
528 + dp = create_node(node, parent);
529 if (dp) {
530 *(*nextp) = dp;
531 *nextp = &dp->allnext;
532
533 - dp->parent = parent;
534 dp->path_component_name = build_path_component(dp);
535 dp->full_name = build_full_name(dp);
536
537 @@ -1565,7 +1565,7 @@ void __init prom_build_devicetree(void)
538 {
539 struct device_node **nextp;
540
541 - allnodes = create_node(prom_root_node);
542 + allnodes = create_node(prom_root_node, NULL);
543 allnodes->path_component_name = "";
544 allnodes->full_name = "/";
545
546 diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
547 index b98bdd8..ab9c0b7 100644
548 --- a/arch/um/include/kern_util.h
549 +++ b/arch/um/include/kern_util.h
550 @@ -6,7 +6,6 @@
551 #ifndef __KERN_UTIL_H__
552 #define __KERN_UTIL_H__
553
554 -#include "linux/threads.h"
555 #include "sysdep/ptrace.h"
556 #include "sysdep/faultinfo.h"
557
558 diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c
559 index 64f547f..8dc6a49 100644
560 --- a/arch/um/os-Linux/sys-i386/tls.c
561 +++ b/arch/um/os-Linux/sys-i386/tls.c
562 @@ -1,4 +1,6 @@
563 #include <errno.h>
564 +#include <sys/syscall.h>
565 +#include <unistd.h>
566 #include <linux/unistd.h>
567 #include "sysdep/tls.h"
568 #include "user_util.h"
569 diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
570 index 297f263..3385784 100644
571 --- a/arch/um/os-Linux/tls.c
572 +++ b/arch/um/os-Linux/tls.c
573 @@ -1,6 +1,8 @@
574 #include <errno.h>
575 #include <sys/ptrace.h>
576 +#include <sys/syscall.h>
577 #include <asm/ldt.h>
578 +#include <unistd.h>
579 #include "sysdep/tls.h"
580 #include "uml-config.h"
581
582 diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
583 index 1c96702..652fa34 100644
584 --- a/arch/um/sys-x86_64/stub_segv.c
585 +++ b/arch/um/sys-x86_64/stub_segv.c
586 @@ -5,7 +5,6 @@
587
588 #include <stddef.h>
589 #include <signal.h>
590 -#include <linux/compiler.h>
591 #include <asm/unistd.h>
592 #include "uml-config.h"
593 #include "sysdep/sigcontext.h"
594 diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
595 index 7a9b182..ffd1cb8 100644
596 --- a/arch/x86_64/kernel/time.c
597 +++ b/arch/x86_64/kernel/time.c
598 @@ -960,7 +960,7 @@ #endif
599 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
600 #ifdef CONFIG_ACPI
601 /* But TSC doesn't tick in C3 so don't use it there */
602 - if (acpi_fadt.length > 0 && acpi_fadt.plvl3_lat < 100)
603 + if (acpi_fadt.length > 0 && acpi_fadt.plvl3_lat < 1000)
604 return 1;
605 #endif
606 return 0;
607 diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
608 index ddd9253..3ecdb34 100644
609 --- a/block/ll_rw_blk.c
610 +++ b/block/ll_rw_blk.c
611 @@ -3021,6 +3021,7 @@ void generic_make_request(struct bio *bi
612 {
613 request_queue_t *q;
614 sector_t maxsector;
615 + sector_t old_sector;
616 int ret, nr_sectors = bio_sectors(bio);
617 dev_t old_dev;
618
619 @@ -3049,7 +3050,7 @@ void generic_make_request(struct bio *bi
620 * NOTE: we don't repeat the blk_size check for each new device.
621 * Stacking drivers are expected to know what they are doing.
622 */
623 - maxsector = -1;
624 + old_sector = -1;
625 old_dev = 0;
626 do {
627 char b[BDEVNAME_SIZE];
628 @@ -3083,15 +3084,30 @@ end_io:
629 */
630 blk_partition_remap(bio);
631
632 - if (maxsector != -1)
633 + if (old_sector != -1)
634 blk_add_trace_remap(q, bio, old_dev, bio->bi_sector,
635 - maxsector);
636 + old_sector);
637
638 blk_add_trace_bio(q, bio, BLK_TA_QUEUE);
639
640 - maxsector = bio->bi_sector;
641 + old_sector = bio->bi_sector;
642 old_dev = bio->bi_bdev->bd_dev;
643
644 + maxsector = bio->bi_bdev->bd_inode->i_size >> 9;
645 + if (maxsector) {
646 + sector_t sector = bio->bi_sector;
647 +
648 + if (maxsector < nr_sectors || maxsector - nr_sectors < sector) {
649 + /*
650 + * This may well happen - partitions are not checked
651 + * to make sure they are within the size of the
652 + * whole device.
653 + */
654 + handle_bad_sector(bio);
655 + goto end_io;
656 + }
657 + }
658 +
659 ret = q->make_request_fn(q, bio);
660 } while (ret);
661 }
662 diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
663 index 4cd23c3..a360215 100644
664 --- a/drivers/block/DAC960.c
665 +++ b/drivers/block/DAC960.c
666 @@ -7115,7 +7115,7 @@ static struct pci_device_id DAC960_id_ta
667 {
668 .vendor = PCI_VENDOR_ID_MYLEX,
669 .device = PCI_DEVICE_ID_MYLEX_DAC960_GEM,
670 - .subvendor = PCI_ANY_ID,
671 + .subvendor = PCI_VENDOR_ID_MYLEX,
672 .subdevice = PCI_ANY_ID,
673 .driver_data = (unsigned long) &DAC960_GEM_privdata,
674 },
675 diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c
676 index ccd7e71..8efbc9c 100644
677 --- a/drivers/char/hw_random/intel-rng.c
678 +++ b/drivers/char/hw_random/intel-rng.c
679 @@ -50,6 +50,43 @@ #define INTEL_RNG_ADDR 0xFFBC015F
680 #define INTEL_RNG_ADDR_LEN 3
681
682 /*
683 + * LPC bridge PCI config space registers
684 + */
685 +#define FWH_DEC_EN1_REG_OLD 0xe3
686 +#define FWH_DEC_EN1_REG_NEW 0xd9 /* high byte of 16-bit register */
687 +#define FWH_F8_EN_MASK 0x80
688 +
689 +#define BIOS_CNTL_REG_OLD 0x4e
690 +#define BIOS_CNTL_REG_NEW 0xdc
691 +#define BIOS_CNTL_WRITE_ENABLE_MASK 0x01
692 +#define BIOS_CNTL_LOCK_ENABLE_MASK 0x02
693 +
694 +/*
695 + * Magic address at which Intel Firmware Hubs get accessed
696 + */
697 +#define INTEL_FWH_ADDR 0xffff0000
698 +#define INTEL_FWH_ADDR_LEN 2
699 +
700 +/*
701 + * Intel Firmware Hub command codes (write to any address inside the device)
702 + */
703 +#define INTEL_FWH_RESET_CMD 0xff /* aka READ_ARRAY */
704 +#define INTEL_FWH_READ_ID_CMD 0x90
705 +
706 +/*
707 + * Intel Firmware Hub Read ID command result addresses
708 + */
709 +#define INTEL_FWH_MANUFACTURER_CODE_ADDRESS 0x000000
710 +#define INTEL_FWH_DEVICE_CODE_ADDRESS 0x000001
711 +
712 +/*
713 + * Intel Firmware Hub Read ID command result values
714 + */
715 +#define INTEL_FWH_MANUFACTURER_CODE 0x89
716 +#define INTEL_FWH_DEVICE_CODE_8M 0xac
717 +#define INTEL_FWH_DEVICE_CODE_4M 0xad
718 +
719 +/*
720 * Data for PCI driver interface
721 *
722 * This data only exists for exporting the supported
723 @@ -58,12 +95,50 @@ #define INTEL_RNG_ADDR_LEN 3
724 * want to register another driver on the same PCI id.
725 */
726 static const struct pci_device_id pci_tbl[] = {
727 - { 0x8086, 0x2418, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
728 - { 0x8086, 0x2428, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
729 - { 0x8086, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
730 - { 0x8086, 0x2448, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
731 - { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
732 - { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
733 +/* AA
734 + { 0x8086, 0x2418, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
735 + { 0x8086, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* AA */
736 +/* AB
737 + { 0x8086, 0x2428, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
738 + { 0x8086, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* AB */
739 +/* ??
740 + { 0x8086, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
741 +/* BAM, CAM, DBM, FBM, GxM
742 + { 0x8086, 0x2448, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
743 + { 0x8086, 0x244c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* BAM */
744 + { 0x8086, 0x248c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CAM */
745 + { 0x8086, 0x24cc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* DBM */
746 + { 0x8086, 0x2641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* FBM */
747 + { 0x8086, 0x27b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* GxM */
748 + { 0x8086, 0x27bd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* GxM DH */
749 +/* BA, CA, DB, Ex, 6300, Fx, 631x/632x, Gx
750 + { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
751 + { 0x8086, 0x2440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* BA */
752 + { 0x8086, 0x2480, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CA */
753 + { 0x8086, 0x24c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* DB */
754 + { 0x8086, 0x24d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Ex */
755 + { 0x8086, 0x25a1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 6300 */
756 + { 0x8086, 0x2640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Fx */
757 + { 0x8086, 0x2670, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
758 + { 0x8086, 0x2671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
759 + { 0x8086, 0x2672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
760 + { 0x8086, 0x2673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
761 + { 0x8086, 0x2674, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
762 + { 0x8086, 0x2675, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
763 + { 0x8086, 0x2676, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
764 + { 0x8086, 0x2677, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
765 + { 0x8086, 0x2678, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
766 + { 0x8086, 0x2679, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
767 + { 0x8086, 0x267a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
768 + { 0x8086, 0x267b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
769 + { 0x8086, 0x267c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
770 + { 0x8086, 0x267d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
771 + { 0x8086, 0x267e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
772 + { 0x8086, 0x267f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* 631x/632x */
773 + { 0x8086, 0x27b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Gx */
774 +/* E
775 + { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, */
776 + { 0x8086, 0x2450, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* E */
777 { 0, }, /* terminate list */
778 };
779 MODULE_DEVICE_TABLE(pci, pci_tbl);
780 @@ -138,22 +213,115 @@ static struct hwrng intel_rng = {
781 };
782
783
784 +#ifdef CONFIG_SMP
785 +static char __initdata waitflag;
786 +
787 +static void __init intel_init_wait(void *unused)
788 +{
789 + while (waitflag)
790 + cpu_relax();
791 +}
792 +#endif
793 +
794 static int __init mod_init(void)
795 {
796 int err = -ENODEV;
797 + unsigned i;
798 + struct pci_dev *dev = NULL;
799 void __iomem *mem;
800 - u8 hw_status;
801 + unsigned long flags;
802 + u8 bios_cntl_off, fwh_dec_en1_off;
803 + u8 bios_cntl_val = 0xff, fwh_dec_en1_val = 0xff;
804 + u8 hw_status, mfc, dvc;
805
806 - if (!pci_dev_present(pci_tbl))
807 + for (i = 0; !dev && pci_tbl[i].vendor; ++i)
808 + dev = pci_get_device(pci_tbl[i].vendor, pci_tbl[i].device, NULL);
809 +
810 + if (!dev)
811 goto out; /* Device not found. */
812
813 + /* Check for Intel 82802 */
814 + if (dev->device < 0x2640) {
815 + fwh_dec_en1_off = FWH_DEC_EN1_REG_OLD;
816 + bios_cntl_off = BIOS_CNTL_REG_OLD;
817 + } else {
818 + fwh_dec_en1_off = FWH_DEC_EN1_REG_NEW;
819 + bios_cntl_off = BIOS_CNTL_REG_NEW;
820 + }
821 +
822 + pci_read_config_byte(dev, fwh_dec_en1_off, &fwh_dec_en1_val);
823 + pci_read_config_byte(dev, bios_cntl_off, &bios_cntl_val);
824 +
825 + mem = ioremap_nocache(INTEL_FWH_ADDR, INTEL_FWH_ADDR_LEN);
826 + if (mem == NULL) {
827 + pci_dev_put(dev);
828 + err = -EBUSY;
829 + goto out;
830 + }
831 +
832 + /*
833 + * Since the BIOS code/data is going to disappear from its normal
834 + * location with the Read ID command, all activity on the system
835 + * must be stopped until the state is back to normal.
836 + */
837 +#ifdef CONFIG_SMP
838 + set_mb(waitflag, 1);
839 + if (smp_call_function(intel_init_wait, NULL, 1, 0) != 0) {
840 + set_mb(waitflag, 0);
841 + pci_dev_put(dev);
842 + printk(KERN_ERR PFX "cannot run on all processors\n");
843 + err = -EAGAIN;
844 + goto err_unmap;
845 + }
846 +#endif
847 + local_irq_save(flags);
848 +
849 + if (!(fwh_dec_en1_val & FWH_F8_EN_MASK))
850 + pci_write_config_byte(dev,
851 + fwh_dec_en1_off,
852 + fwh_dec_en1_val | FWH_F8_EN_MASK);
853 + if (!(bios_cntl_val &
854 + (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)))
855 + pci_write_config_byte(dev,
856 + bios_cntl_off,
857 + bios_cntl_val | BIOS_CNTL_WRITE_ENABLE_MASK);
858 +
859 + writeb(INTEL_FWH_RESET_CMD, mem);
860 + writeb(INTEL_FWH_READ_ID_CMD, mem);
861 + mfc = readb(mem + INTEL_FWH_MANUFACTURER_CODE_ADDRESS);
862 + dvc = readb(mem + INTEL_FWH_DEVICE_CODE_ADDRESS);
863 + writeb(INTEL_FWH_RESET_CMD, mem);
864 +
865 + if (!(bios_cntl_val &
866 + (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)))
867 + pci_write_config_byte(dev, bios_cntl_off, bios_cntl_val);
868 + if (!(fwh_dec_en1_val & FWH_F8_EN_MASK))
869 + pci_write_config_byte(dev, fwh_dec_en1_off, fwh_dec_en1_val);
870 +
871 + local_irq_restore(flags);
872 +#ifdef CONFIG_SMP
873 + /* Tell other CPUs to resume. */
874 + set_mb(waitflag, 0);
875 +#endif
876 +
877 + iounmap(mem);
878 + pci_dev_put(dev);
879 +
880 + if (mfc != INTEL_FWH_MANUFACTURER_CODE ||
881 + (dvc != INTEL_FWH_DEVICE_CODE_8M &&
882 + dvc != INTEL_FWH_DEVICE_CODE_4M)) {
883 + printk(KERN_ERR PFX "FWH not detected\n");
884 + err = -ENODEV;
885 + goto out;
886 + }
887 +
888 err = -ENOMEM;
889 mem = ioremap(INTEL_RNG_ADDR, INTEL_RNG_ADDR_LEN);
890 if (!mem)
891 goto out;
892 intel_rng.priv = (unsigned long)mem;
893
894 - /* Check for Intel 82802 */
895 + /* Check for Random Number Generator */
896 err = -ENODEV;
897 hw_status = hwstatus_get(mem);
898 if ((hw_status & INTEL_RNG_PRESENT) == 0)
899 diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c
900 index 7c3cf29..cb92a1b 100644
901 --- a/drivers/char/watchdog/sc1200wdt.c
902 +++ b/drivers/char/watchdog/sc1200wdt.c
903 @@ -392,7 +392,7 @@ #endif
904 if (io == -1) {
905 printk(KERN_ERR PFX "io parameter must be specified\n");
906 ret = -EINVAL;
907 - goto out_clean;
908 + goto out_pnp;
909 }
910
911 #if defined CONFIG_PNP
912 @@ -405,7 +405,7 @@ #endif
913 if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
914 printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
915 ret = -EBUSY;
916 - goto out_clean;
917 + goto out_pnp;
918 }
919
920 ret = sc1200wdt_probe();
921 @@ -435,6 +435,11 @@ out_rbt:
922 out_io:
923 release_region(io, io_len);
924
925 +out_pnp:
926 +#if defined CONFIG_PNP
927 + if (isapnp)
928 + pnp_unregister_driver(&scl200wdt_pnp_driver);
929 +#endif
930 goto out_clean;
931 }
932
933 diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
934 index 6a1ddad..58e8efa 100644
935 --- a/drivers/ide/pci/generic.c
936 +++ b/drivers/ide/pci/generic.c
937 @@ -242,8 +242,10 @@ static int __devinit generic_init_one(st
938 (!(PCI_FUNC(dev->devfn) & 1)))
939 goto out;
940
941 - if (dev->vendor == PCI_VENDOR_ID_JMICRON && PCI_FUNC(dev->devfn) != 1)
942 - goto out;
943 + if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
944 + if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
945 + goto out;
946 + }
947
948 if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
949 pci_read_config_word(dev, PCI_COMMAND, &command);
950 diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
951 index 3e27a08..8030d6a 100644
952 --- a/drivers/infiniband/hw/mthca/mthca_cq.c
953 +++ b/drivers/infiniband/hw/mthca/mthca_cq.c
954 @@ -39,6 +39,8 @@
955 #include <linux/init.h>
956 #include <linux/hardirq.h>
957
958 +#include <asm/io.h>
959 +
960 #include <rdma/ib_pack.h>
961
962 #include "mthca_dev.h"
963 @@ -210,6 +212,11 @@ static inline void update_cons_index(str
964 mthca_write64(doorbell,
965 dev->kar + MTHCA_CQ_DOORBELL,
966 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
967 + /*
968 + * Make sure doorbells don't leak out of CQ spinlock
969 + * and reach the HCA out of order:
970 + */
971 + mmiowb();
972 }
973 }
974
975 diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
976 index 2e8f6f3..b66aa49 100644
977 --- a/drivers/infiniband/hw/mthca/mthca_qp.c
978 +++ b/drivers/infiniband/hw/mthca/mthca_qp.c
979 @@ -39,6 +39,8 @@ #include <linux/init.h>
980 #include <linux/string.h>
981 #include <linux/slab.h>
982
983 +#include <asm/io.h>
984 +
985 #include <rdma/ib_verbs.h>
986 #include <rdma/ib_cache.h>
987 #include <rdma/ib_pack.h>
988 @@ -1730,6 +1732,11 @@ out:
989 mthca_write64(doorbell,
990 dev->kar + MTHCA_SEND_DOORBELL,
991 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
992 + /*
993 + * Make sure doorbells don't leak out of SQ spinlock
994 + * and reach the HCA out of order:
995 + */
996 + mmiowb();
997 }
998
999 qp->sq.next_ind = ind;
1000 @@ -1849,6 +1856,12 @@ out:
1001 qp->rq.next_ind = ind;
1002 qp->rq.head += nreq;
1003
1004 + /*
1005 + * Make sure doorbells don't leak out of RQ spinlock and reach
1006 + * the HCA out of order:
1007 + */
1008 + mmiowb();
1009 +
1010 spin_unlock_irqrestore(&qp->rq.lock, flags);
1011 return err;
1012 }
1013 @@ -2110,6 +2123,12 @@ out:
1014 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
1015 }
1016
1017 + /*
1018 + * Make sure doorbells don't leak out of SQ spinlock and reach
1019 + * the HCA out of order:
1020 + */
1021 + mmiowb();
1022 +
1023 spin_unlock_irqrestore(&qp->sq.lock, flags);
1024 return err;
1025 }
1026 diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
1027 index b60a9d7..a01f1a8 100644
1028 --- a/drivers/infiniband/hw/mthca/mthca_srq.c
1029 +++ b/drivers/infiniband/hw/mthca/mthca_srq.c
1030 @@ -35,6 +35,8 @@
1031 #include <linux/slab.h>
1032 #include <linux/string.h>
1033
1034 +#include <asm/io.h>
1035 +
1036 #include "mthca_dev.h"
1037 #include "mthca_cmd.h"
1038 #include "mthca_memfree.h"
1039 @@ -593,6 +595,12 @@ int mthca_tavor_post_srq_recv(struct ib_
1040 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
1041 }
1042
1043 + /*
1044 + * Make sure doorbells don't leak out of SRQ spinlock and
1045 + * reach the HCA out of order:
1046 + */
1047 + mmiowb();
1048 +
1049 spin_unlock_irqrestore(&srq->lock, flags);
1050 return err;
1051 }
1052 diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1053 index 5033666..dcd996b 100644
1054 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1055 +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1056 @@ -619,8 +619,10 @@ void ipoib_ib_dev_flush(void *_dev)
1057 * The device could have been brought down between the start and when
1058 * we get here, don't bring it back up if it's not configured up
1059 */
1060 - if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
1061 + if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) {
1062 ipoib_ib_dev_up(dev);
1063 + ipoib_mcast_restart_task(dev);
1064 + }
1065
1066 mutex_lock(&priv->vlan_mutex);
1067
1068 diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
1069 index d10c8b8..b6f9476 100644
1070 --- a/drivers/isdn/capi/capidrv.c
1071 +++ b/drivers/isdn/capi/capidrv.c
1072 @@ -1907,7 +1907,8 @@ static int if_readstat(u8 __user *buf, i
1073 }
1074
1075 for (p=buf, count=0; count < len; p++, count++) {
1076 - put_user(*card->q931_read++, p);
1077 + if (put_user(*card->q931_read++, p))
1078 + return -EFAULT;
1079 if (card->q931_read > card->q931_end)
1080 card->q931_read = card->q931_buf;
1081 }
1082 diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
1083 index e103503..9280b58 100644
1084 --- a/drivers/isdn/hisax/config.c
1085 +++ b/drivers/isdn/hisax/config.c
1086 @@ -631,7 +631,8 @@ static int HiSax_readstatus(u_char __use
1087 count = cs->status_end - cs->status_read + 1;
1088 if (count >= len)
1089 count = len;
1090 - copy_to_user(p, cs->status_read, count);
1091 + if (copy_to_user(p, cs->status_read, count))
1092 + return -EFAULT;
1093 cs->status_read += count;
1094 if (cs->status_read > cs->status_end)
1095 cs->status_read = cs->status_buf;
1096 @@ -642,7 +643,8 @@ static int HiSax_readstatus(u_char __use
1097 cnt = HISAX_STATUS_BUFSIZE;
1098 else
1099 cnt = count;
1100 - copy_to_user(p, cs->status_read, cnt);
1101 + if (copy_to_user(p, cs->status_read, cnt))
1102 + return -EFAULT;
1103 p += cnt;
1104 cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
1105 count -= cnt;
1106 diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
1107 index c3d79ee..69aee26 100644
1108 --- a/drivers/isdn/i4l/isdn_common.c
1109 +++ b/drivers/isdn/i4l/isdn_common.c
1110 @@ -1134,9 +1134,12 @@ isdn_read(struct file *file, char __user
1111 if (dev->drv[drvidx]->interface->readstat) {
1112 if (count > dev->drv[drvidx]->stavail)
1113 count = dev->drv[drvidx]->stavail;
1114 - len = dev->drv[drvidx]->interface->
1115 - readstat(buf, count, drvidx,
1116 - isdn_minor2chan(minor));
1117 + len = dev->drv[drvidx]->interface->readstat(buf, count,
1118 + drvidx, isdn_minor2chan(minor));
1119 + if (len < 0) {
1120 + retval = len;
1121 + goto out;
1122 + }
1123 } else {
1124 len = 0;
1125 }
1126 diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
1127 index 6649f8b..730bbd0 100644
1128 --- a/drivers/isdn/icn/icn.c
1129 +++ b/drivers/isdn/icn/icn.c
1130 @@ -1010,7 +1010,8 @@ icn_readstatus(u_char __user *buf, int l
1131 for (p = buf, count = 0; count < len; p++, count++) {
1132 if (card->msg_buf_read == card->msg_buf_write)
1133 return count;
1134 - put_user(*card->msg_buf_read++, p);
1135 + if (put_user(*card->msg_buf_read++, p))
1136 + return -EFAULT;
1137 if (card->msg_buf_read > card->msg_buf_end)
1138 card->msg_buf_read = card->msg_buf;
1139 }
1140 diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
1141 index fabbd46..9a66524 100644
1142 --- a/drivers/isdn/isdnloop/isdnloop.c
1143 +++ b/drivers/isdn/isdnloop/isdnloop.c
1144 @@ -451,7 +451,8 @@ isdnloop_readstatus(u_char __user *buf,
1145 for (p = buf, count = 0; count < len; p++, count++) {
1146 if (card->msg_buf_read == card->msg_buf_write)
1147 return count;
1148 - put_user(*card->msg_buf_read++, p);
1149 + if (put_user(*card->msg_buf_read++, p))
1150 + return -EFAULT;
1151 if (card->msg_buf_read > card->msg_buf_end)
1152 card->msg_buf_read = card->msg_buf;
1153 }
1154 diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
1155 index 94f2148..6ead5e1 100644
1156 --- a/drivers/isdn/pcbit/drv.c
1157 +++ b/drivers/isdn/pcbit/drv.c
1158 @@ -725,23 +725,27 @@ static int pcbit_stat(u_char __user *buf
1159
1160 if (stat_st < stat_end)
1161 {
1162 - copy_to_user(buf, statbuf + stat_st, len);
1163 + if (copy_to_user(buf, statbuf + stat_st, len))
1164 + return -EFAULT;
1165 stat_st += len;
1166 }
1167 else
1168 {
1169 if (len > STATBUF_LEN - stat_st)
1170 {
1171 - copy_to_user(buf, statbuf + stat_st,
1172 - STATBUF_LEN - stat_st);
1173 - copy_to_user(buf, statbuf,
1174 - len - (STATBUF_LEN - stat_st));
1175 + if (copy_to_user(buf, statbuf + stat_st,
1176 + STATBUF_LEN - stat_st))
1177 + return -EFAULT;
1178 + if (copy_to_user(buf, statbuf,
1179 + len - (STATBUF_LEN - stat_st)))
1180 + return -EFAULT;
1181
1182 stat_st = len - (STATBUF_LEN - stat_st);
1183 }
1184 else
1185 {
1186 - copy_to_user(buf, statbuf + stat_st, len);
1187 + if (copy_to_user(buf, statbuf + stat_st, len))
1188 + return -EFAULT;
1189
1190 stat_st += len;
1191
1192 diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
1193 index a82f313..6c29fe7 100644
1194 --- a/drivers/macintosh/via-pmu-backlight.c
1195 +++ b/drivers/macintosh/via-pmu-backlight.c
1196 @@ -16,7 +16,7 @@ #include <asm/prom.h>
1197 #define MAX_PMU_LEVEL 0xFF
1198
1199 static struct backlight_properties pmu_backlight_data;
1200 -static spinlock_t pmu_backlight_lock;
1201 +static DEFINE_SPINLOCK(pmu_backlight_lock);
1202 static int sleeping;
1203 static u8 bl_curve[FB_BACKLIGHT_LEVELS];
1204
1205 diff --git a/drivers/md/md.c b/drivers/md/md.c
1206 index c9d2919..1869e81 100644
1207 --- a/drivers/md/md.c
1208 +++ b/drivers/md/md.c
1209 @@ -1994,6 +1994,7 @@ static mdk_rdev_t *md_import_device(dev_
1210 kobject_init(&rdev->kobj);
1211
1212 rdev->desc_nr = -1;
1213 + rdev->saved_raid_disk = -1;
1214 rdev->flags = 0;
1215 rdev->data_offset = 0;
1216 rdev->sb_events = 0;
1217 diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
1218 index 1cc9de4..33f67ca 100644
1219 --- a/drivers/md/multipath.c
1220 +++ b/drivers/md/multipath.c
1221 @@ -480,7 +480,7 @@ static int multipath_run (mddev_t *mddev
1222 mdname(mddev));
1223 goto out_free_conf;
1224 }
1225 - mddev->degraded = conf->raid_disks = conf->working_disks;
1226 + mddev->degraded = conf->raid_disks - conf->working_disks;
1227
1228 conf->pool = mempool_create_kzalloc_pool(NR_RESERVED_BUFS,
1229 sizeof(struct multipath_bh));
1230 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1231 index 016ddb8..115a6f8 100644
1232 --- a/drivers/md/raid10.c
1233 +++ b/drivers/md/raid10.c
1234 @@ -2042,7 +2042,7 @@ static int run(mddev_t *mddev)
1235 disk = conf->mirrors + i;
1236
1237 if (!disk->rdev ||
1238 - !test_bit(In_sync, &rdev->flags)) {
1239 + !test_bit(In_sync, &disk->rdev->flags)) {
1240 disk->head_position = 0;
1241 mddev->degraded++;
1242 }
1243 diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
1244 index 3be87c7..68bb56e 100644
1245 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
1246 +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
1247 @@ -527,7 +527,7 @@ int flexcop_frontend_init(struct flexcop
1248 /* try the air atsc 2nd generation (nxt2002) */
1249 if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
1250 fc->dev_type = FC_AIR_ATSC2;
1251 - dvb_pll_attach(fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_samsung_tbmv);
1252 + dvb_pll_attach(fc->fe, 0x61, NULL, &dvb_pll_samsung_tbmv);
1253 info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address);
1254 } else
1255 /* try the air atsc 3nd generation (lgdt3303) */
1256 diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
1257 index 2be33f2..887d6f4 100644
1258 --- a/drivers/media/dvb/frontends/dvb-pll.c
1259 +++ b/drivers/media/dvb/frontends/dvb-pll.c
1260 @@ -493,6 +493,9 @@ static int dvb_pll_sleep(struct dvb_fron
1261 int i;
1262 int result;
1263
1264 + if (priv->i2c == NULL)
1265 + return -EINVAL;
1266 +
1267 for (i = 0; i < priv->pll_desc->count; i++) {
1268 if (priv->pll_desc->entries[i].limit == 0)
1269 break;
1270 diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
1271 index afde378..fd3ef4c 100644
1272 --- a/drivers/media/video/cx88/cx88-dvb.c
1273 +++ b/drivers/media/video/cx88/cx88-dvb.c
1274 @@ -576,7 +576,7 @@ #ifdef HAVE_MT352
1275 &dev->core->i2c_adap);
1276 if (dev->dvb.frontend != NULL) {
1277 dvb_pll_attach(dev->dvb.frontend, 0x60,
1278 - &dev->core->i2c_adap,
1279 + NULL,
1280 &dvb_pll_thomson_dtt7579);
1281 break;
1282 }
1283 @@ -587,7 +587,7 @@ #ifdef HAVE_ZL10353
1284 &dev->core->i2c_adap);
1285 if (dev->dvb.frontend != NULL) {
1286 dvb_pll_attach(dev->dvb.frontend, 0x60,
1287 - &dev->core->i2c_adap,
1288 + NULL,
1289 &dvb_pll_thomson_dtt7579);
1290 }
1291 #endif
1292 @@ -600,7 +600,7 @@ #ifdef HAVE_MT352
1293 &dev->core->i2c_adap);
1294 if (dev->dvb.frontend != NULL) {
1295 dvb_pll_attach(dev->dvb.frontend, 0x61,
1296 - &dev->core->i2c_adap,
1297 + NULL,
1298 &dvb_pll_thomson_dtt7579);
1299 break;
1300 }
1301 @@ -611,7 +611,7 @@ #ifdef HAVE_ZL10353
1302 &dev->core->i2c_adap);
1303 if (dev->dvb.frontend != NULL) {
1304 dvb_pll_attach(dev->dvb.frontend, 0x61,
1305 - &dev->core->i2c_adap,
1306 + NULL,
1307 &dvb_pll_thomson_dtt7579);
1308 }
1309 #endif
1310 @@ -623,7 +623,7 @@ #ifdef HAVE_MT352
1311 &dev->core->i2c_adap);
1312 if (dev->dvb.frontend != NULL) {
1313 dvb_pll_attach(dev->dvb.frontend, 0x61,
1314 - &dev->core->i2c_adap,
1315 + NULL,
1316 &dvb_pll_lg_z201);
1317 }
1318 break;
1319 @@ -634,7 +634,7 @@ #ifdef HAVE_MT352
1320 &dev->core->i2c_adap);
1321 if (dev->dvb.frontend != NULL) {
1322 dvb_pll_attach(dev->dvb.frontend, 0x61,
1323 - &dev->core->i2c_adap,
1324 + NULL,
1325 &dvb_pll_unknown_1);
1326 }
1327 break;
1328 @@ -757,7 +757,7 @@ #ifdef HAVE_NXT200X
1329 &dev->core->i2c_adap);
1330 if (dev->dvb.frontend != NULL) {
1331 dvb_pll_attach(dev->dvb.frontend, 0x61,
1332 - &dev->core->i2c_adap,
1333 + NULL,
1334 &dvb_pll_tuv1236d);
1335 }
1336 break;
1337 diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
1338 index 279828b..449fe23 100644
1339 --- a/drivers/media/video/saa7134/saa7134-dvb.c
1340 +++ b/drivers/media/video/saa7134/saa7134-dvb.c
1341 @@ -1158,13 +1158,13 @@ #ifdef HAVE_NXT200X
1342 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
1343 dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap);
1344 if (dev->dvb.frontend) {
1345 - dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tdhu2);
1346 + dvb_pll_attach(dev->dvb.frontend, 0x61, NULL, &dvb_pll_tdhu2);
1347 }
1348 break;
1349 case SAA7134_BOARD_KWORLD_ATSC110:
1350 dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap);
1351 if (dev->dvb.frontend) {
1352 - dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tuv1236d);
1353 + dvb_pll_attach(dev->dvb.frontend, 0x61, NULL, &dvb_pll_tuv1236d);
1354 }
1355 break;
1356 #endif
1357 diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
1358 index c590c2d..ebe7e25 100644
1359 --- a/drivers/net/sky2.c
1360 +++ b/drivers/net/sky2.c
1361 @@ -678,7 +678,7 @@ static void sky2_mac_init(struct sky2_hw
1362 sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
1363
1364 if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
1365 - sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
1366 + sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 512/8);
1367 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
1368 if (hw->dev[port]->mtu > ETH_DATA_LEN) {
1369 /* set Tx GMAC FIFO Almost Empty Threshold */
1370 @@ -690,16 +690,10 @@ static void sky2_mac_init(struct sky2_hw
1371
1372 }
1373
1374 -/* Assign Ram Buffer allocation.
1375 - * start and end are in units of 4k bytes
1376 - * ram registers are in units of 64bit words
1377 - */
1378 -static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
1379 +/* Assign Ram Buffer allocation in units of 64bit (8 bytes) */
1380 +static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 end)
1381 {
1382 - u32 start, end;
1383 -
1384 - start = startk * 4096/8;
1385 - end = (endk * 4096/8) - 1;
1386 + pr_debug(PFX "q %d %#x %#x\n", q, start, end);
1387
1388 sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
1389 sky2_write32(hw, RB_ADDR(q, RB_START), start);
1390 @@ -708,7 +702,7 @@ static void sky2_ramset(struct sky2_hw *
1391 sky2_write32(hw, RB_ADDR(q, RB_RP), start);
1392
1393 if (q == Q_R1 || q == Q_R2) {
1394 - u32 space = (endk - startk) * 4096/8;
1395 + u32 space = end - start + 1;
1396 u32 tp = space - space/4;
1397
1398 /* On receive queue's set the thresholds
1399 @@ -1090,19 +1084,16 @@ static int sky2_up(struct net_device *de
1400
1401 sky2_mac_init(hw, port);
1402
1403 - /* Determine available ram buffer space (in 4K blocks).
1404 - * Note: not sure about the FE setting below yet
1405 - */
1406 - if (hw->chip_id == CHIP_ID_YUKON_FE)
1407 - ramsize = 4;
1408 - else
1409 - ramsize = sky2_read8(hw, B2_E_0);
1410 + /* Determine available ram buffer space in qwords. */
1411 + ramsize = sky2_read8(hw, B2_E_0) * 4096/8;
1412
1413 - /* Give transmitter one third (rounded up) */
1414 - rxspace = ramsize - (ramsize + 2) / 3;
1415 + if (ramsize > 6*1024/8)
1416 + rxspace = ramsize - (ramsize + 2) / 3;
1417 + else
1418 + rxspace = ramsize / 2;
1419
1420 - sky2_ramset(hw, rxqaddr[port], 0, rxspace);
1421 - sky2_ramset(hw, txqaddr[port], rxspace, ramsize);
1422 + sky2_ramset(hw, rxqaddr[port], 0, rxspace-1);
1423 + sky2_ramset(hw, txqaddr[port], rxspace, ramsize-1);
1424
1425 /* Make sure SyncQ is disabled */
1426 sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
1427 @@ -1429,6 +1420,11 @@ static int sky2_down(struct net_device *
1428 /* Stop more packets from being queued */
1429 netif_stop_queue(dev);
1430
1431 + /* Disable port IRQ */
1432 + imask = sky2_read32(hw, B0_IMSK);
1433 + imask &= ~portirq_msk[port];
1434 + sky2_write32(hw, B0_IMSK, imask);
1435 +
1436 sky2_phy_reset(hw, port);
1437
1438 /* Stop transmitter */
1439 @@ -1472,11 +1468,6 @@ static int sky2_down(struct net_device *
1440 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
1441 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
1442
1443 - /* Disable port IRQ */
1444 - imask = sky2_read32(hw, B0_IMSK);
1445 - imask &= ~portirq_msk[port];
1446 - sky2_write32(hw, B0_IMSK, imask);
1447 -
1448 /* turn off LED's */
1449 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
1450
1451 @@ -1687,13 +1678,13 @@ static void sky2_phy_intr(struct sky2_hw
1452 struct sky2_port *sky2 = netdev_priv(dev);
1453 u16 istatus, phystat;
1454
1455 + if (!netif_running(dev))
1456 + return;
1457 +
1458 spin_lock(&sky2->phy_lock);
1459 istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT);
1460 phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT);
1461
1462 - if (!netif_running(dev))
1463 - goto out;
1464 -
1465 if (netif_msg_intr(sky2))
1466 printk(KERN_INFO PFX "%s: phy interrupt status 0x%x 0x%x\n",
1467 sky2->netdev->name, istatus, phystat);
1468 @@ -2745,6 +2736,14 @@ static int sky2_set_mac_address(struct n
1469 return 0;
1470 }
1471
1472 +static void inline sky2_add_filter(u8 filter[8], const u8 *addr)
1473 +{
1474 + u32 bit;
1475 +
1476 + bit = ether_crc(ETH_ALEN, addr) & 63;
1477 + filter[bit >> 3] |= 1 << (bit & 7);
1478 +}
1479 +
1480 static void sky2_set_multicast(struct net_device *dev)
1481 {
1482 struct sky2_port *sky2 = netdev_priv(dev);
1483 @@ -2753,6 +2752,7 @@ static void sky2_set_multicast(struct ne
1484 struct dev_mc_list *list = dev->mc_list;
1485 u16 reg;
1486 u8 filter[8];
1487 + static const u8 pause_mc_addr[ETH_ALEN] = { 0x1, 0x80, 0xc2, 0x0, 0x0, 0x1 };
1488
1489 memset(filter, 0, sizeof(filter));
1490
1491 @@ -2763,16 +2763,17 @@ static void sky2_set_multicast(struct ne
1492 reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
1493 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > 16) /* all multicast */
1494 memset(filter, 0xff, sizeof(filter));
1495 - else if (dev->mc_count == 0) /* no multicast */
1496 + else if (dev->mc_count == 0 && !sky2->rx_pause)
1497 reg &= ~GM_RXCR_MCF_ENA;
1498 else {
1499 int i;
1500 reg |= GM_RXCR_MCF_ENA;
1501
1502 - for (i = 0; list && i < dev->mc_count; i++, list = list->next) {
1503 - u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f;
1504 - filter[bit / 8] |= 1 << (bit % 8);
1505 - }
1506 + if (sky2->rx_pause)
1507 + sky2_add_filter(filter, pause_mc_addr);
1508 +
1509 + for (i = 0; list && i < dev->mc_count; i++, list = list->next)
1510 + sky2_add_filter(filter, list->dmi_addr);
1511 }
1512
1513 gma_write16(hw, port, GM_MC_ADDR_H1,
1514 @@ -3208,6 +3209,8 @@ static int __devinit sky2_test_msi(struc
1515 struct pci_dev *pdev = hw->pdev;
1516 int err;
1517
1518 + init_waitqueue_head (&hw->msi_wait);
1519 +
1520 sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
1521
1522 err = request_irq(pdev->irq, sky2_test_intr, IRQF_SHARED, DRV_NAME, hw);
1523 @@ -3217,18 +3220,15 @@ static int __devinit sky2_test_msi(struc
1524 return err;
1525 }
1526
1527 - init_waitqueue_head (&hw->msi_wait);
1528 -
1529 sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
1530 - wmb();
1531 + sky2_read8(hw, B0_CTST);
1532
1533 wait_event_timeout(hw->msi_wait, hw->msi_detected, HZ/10);
1534
1535 if (!hw->msi_detected) {
1536 /* MSI test failed, go back to INTx mode */
1537 - printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, "
1538 - "switching to INTx mode. Please report this failure to "
1539 - "the PCI maintainer and include system chipset information.\n",
1540 + printk(KERN_INFO PFX "%s: No interrupt generated using MSI, "
1541 + "switching to INTx mode.\n",
1542 pci_name(pdev));
1543
1544 err = -EOPNOTSUPP;
1545 @@ -3236,6 +3236,7 @@ static int __devinit sky2_test_msi(struc
1546 }
1547
1548 sky2_write32(hw, B0_IMSK, 0);
1549 + sky2_read32(hw, B0_IMSK);
1550
1551 free_irq(pdev->irq, hw);
1552
1553 diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
1554 index ac5248b..7af5499 100644
1555 --- a/drivers/net/sky2.h
1556 +++ b/drivers/net/sky2.h
1557 @@ -1566,7 +1566,7 @@ enum {
1558
1559 GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR |
1560 GMR_FS_FRAGMENT | GMR_FS_LONG_ERR |
1561 - GMR_FS_MII_ERR | GMR_FS_BAD_FC |
1562 + GMR_FS_MII_ERR | GMR_FS_GOOD_FC | GMR_FS_BAD_FC |
1563 GMR_FS_UN_SIZE | GMR_FS_JABBER,
1564 };
1565
1566 diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
1567 index 3a73d89..f24ba4d 100644
1568 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
1569 +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
1570 @@ -3165,7 +3165,15 @@ static void bcm43xx_periodic_work_handle
1571
1572 badness = estimate_periodic_work_badness(bcm->periodic_state);
1573 mutex_lock(&bcm->mutex);
1574 +
1575 + /* We must fake a started transmission here, as we are going to
1576 + * disable TX. If we wouldn't fake a TX, it would be possible to
1577 + * trigger the netdev watchdog, if the last real TX is already
1578 + * some time on the past (slightly less than 5secs)
1579 + */
1580 + bcm->net_dev->trans_start = jiffies;
1581 netif_tx_disable(bcm->net_dev);
1582 +
1583 spin_lock_irqsave(&bcm->irq_lock, flags);
1584 if (badness > BADNESS_LIMIT) {
1585 /* Periodic work will take a long time, so we want it to
1586 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1587 index 17e709e..60b31ac 100644
1588 --- a/drivers/pci/quirks.c
1589 +++ b/drivers/pci/quirks.c
1590 @@ -685,33 +685,6 @@ static void __devinit quirk_vt82c598_id(
1591 }
1592 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id );
1593
1594 -#ifdef CONFIG_ACPI_SLEEP
1595 -
1596 -/*
1597 - * Some VIA systems boot with the abnormal status flag set. This can cause
1598 - * the BIOS to re-POST the system on resume rather than passing control
1599 - * back to the OS. Clear the flag on boot
1600 - */
1601 -static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev)
1602 -{
1603 - u32 reg;
1604 -
1605 - acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
1606 - &reg);
1607 -
1608 - if (reg & 0x800) {
1609 - printk("Clearing abnormal poweroff flag\n");
1610 - acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
1611 - ACPI_REGISTER_PM1_STATUS,
1612 - (u16)0x800);
1613 - }
1614 -}
1615 -
1616 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff);
1617 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff);
1618 -
1619 -#endif
1620 -
1621 /*
1622 * CardBus controllers have a legacy base address that enables them
1623 * to respond as i82365 pcmcia controllers. We don't want them to
1624 diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
1625 index 2c97395..b38208b 100644
1626 --- a/drivers/rtc/rtc-max6902.c
1627 +++ b/drivers/rtc/rtc-max6902.c
1628 @@ -137,7 +137,7 @@ static int max6902_get_datetime(struct d
1629 dt->tm_min = BCD2BIN(chip->buf[2]);
1630 dt->tm_hour = BCD2BIN(chip->buf[3]);
1631 dt->tm_mday = BCD2BIN(chip->buf[4]);
1632 - dt->tm_mon = BCD2BIN(chip->buf[5] - 1);
1633 + dt->tm_mon = BCD2BIN(chip->buf[5]) - 1;
1634 dt->tm_wday = BCD2BIN(chip->buf[6]);
1635 dt->tm_year = BCD2BIN(chip->buf[7]);
1636
1637 diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
1638 index aa4be8a..129444a 100644
1639 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
1640 +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
1641 @@ -2539,15 +2539,28 @@ #endif
1642 static void ahc_linux_get_signalling(struct Scsi_Host *shost)
1643 {
1644 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
1645 - u8 mode = ahc_inb(ahc, SBLKCTL);
1646 + unsigned long flags;
1647 + u8 mode;
1648
1649 - if (mode & ENAB40)
1650 - spi_signalling(shost) = SPI_SIGNAL_LVD;
1651 - else if (mode & ENAB20)
1652 + if (!(ahc->features & AHC_ULTRA2)) {
1653 + /* non-LVD chipset, may not have SBLKCTL reg */
1654 spi_signalling(shost) =
1655 ahc->features & AHC_HVD ?
1656 SPI_SIGNAL_HVD :
1657 SPI_SIGNAL_SE;
1658 + return;
1659 + }
1660 +
1661 + ahc_lock(ahc, &flags);
1662 + ahc_pause(ahc);
1663 + mode = ahc_inb(ahc, SBLKCTL);
1664 + ahc_unpause(ahc);
1665 + ahc_unlock(ahc, &flags);
1666 +
1667 + if (mode & ENAB40)
1668 + spi_signalling(shost) = SPI_SIGNAL_LVD;
1669 + else if (mode & ENAB20)
1670 + spi_signalling(shost) = SPI_SIGNAL_SE;
1671 else
1672 spi_signalling(shost) = SPI_SIGNAL_UNKNOWN;
1673 }
1674 diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
1675 index 372e47f..c59dcb7 100644
1676 --- a/drivers/serial/serial_core.c
1677 +++ b/drivers/serial/serial_core.c
1678 @@ -1932,6 +1932,9 @@ int uart_suspend_port(struct uart_driver
1679 if (state->info && state->info->flags & UIF_INITIALIZED) {
1680 const struct uart_ops *ops = port->ops;
1681
1682 + state->info->flags = (state->info->flags & ~UIF_INITIALIZED)
1683 + | UIF_SUSPENDED;
1684 +
1685 spin_lock_irq(&port->lock);
1686 ops->stop_tx(port);
1687 ops->set_mctrl(port, 0);
1688 @@ -1991,7 +1994,7 @@ int uart_resume_port(struct uart_driver
1689 console_start(port->cons);
1690 }
1691
1692 - if (state->info && state->info->flags & UIF_INITIALIZED) {
1693 + if (state->info && state->info->flags & UIF_SUSPENDED) {
1694 const struct uart_ops *ops = port->ops;
1695 int ret;
1696
1697 @@ -2003,15 +2006,17 @@ int uart_resume_port(struct uart_driver
1698 ops->set_mctrl(port, port->mctrl);
1699 ops->start_tx(port);
1700 spin_unlock_irq(&port->lock);
1701 + state->info->flags |= UIF_INITIALIZED;
1702 } else {
1703 /*
1704 * Failed to resume - maybe hardware went away?
1705 * Clear the "initialized" flag so we won't try
1706 * to call the low level drivers shutdown method.
1707 */
1708 - state->info->flags &= ~UIF_INITIALIZED;
1709 uart_shutdown(state);
1710 }
1711 +
1712 + state->info->flags &= ~UIF_SUSPENDED;
1713 }
1714
1715 mutex_unlock(&state->mutex);
1716 diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
1717 index cbf260b..06a246a 100644
1718 --- a/drivers/serial/serial_cs.c
1719 +++ b/drivers/serial/serial_cs.c
1720 @@ -185,14 +185,12 @@ static int serial_suspend(struct pcmcia_
1721
1722 static int serial_resume(struct pcmcia_device *link)
1723 {
1724 - if (pcmcia_dev_present(link)) {
1725 - struct serial_info *info = link->priv;
1726 - int i;
1727 + struct serial_info *info = link->priv;
1728 + int i;
1729
1730 - for (i = 0; i < info->ndev; i++)
1731 - serial8250_resume_port(info->line[i]);
1732 - wakeup_card(info);
1733 - }
1734 + for (i = 0; i < info->ndev; i++)
1735 + serial8250_resume_port(info->line[i]);
1736 + wakeup_card(info);
1737
1738 return 0;
1739 }
1740 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1741 index 218621b..ab6cc03 100644
1742 --- a/drivers/usb/core/devio.c
1743 +++ b/drivers/usb/core/devio.c
1744 @@ -59,6 +59,9 @@ #define USB_MAXBUS 64
1745 #define USB_DEVICE_MAX USB_MAXBUS * 128
1746 static struct class *usb_device_class;
1747
1748 +/* Mutual exclusion for removal, open, and release */
1749 +DEFINE_MUTEX(usbfs_mutex);
1750 +
1751 struct async {
1752 struct list_head asynclist;
1753 struct dev_state *ps;
1754 @@ -541,15 +544,13 @@ static int usbdev_open(struct inode *ino
1755 struct dev_state *ps;
1756 int ret;
1757
1758 - /*
1759 - * no locking necessary here, as chrdev_open has the kernel lock
1760 - * (still acquire the kernel lock for safety)
1761 - */
1762 + /* Protect against simultaneous removal or release */
1763 + mutex_lock(&usbfs_mutex);
1764 +
1765 ret = -ENOMEM;
1766 if (!(ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL)))
1767 - goto out_nolock;
1768 + goto out;
1769
1770 - lock_kernel();
1771 ret = -ENOENT;
1772 /* check if we are called from a real node or usbfs */
1773 if (imajor(inode) == USB_DEVICE_MAJOR)
1774 @@ -579,9 +580,8 @@ static int usbdev_open(struct inode *ino
1775 list_add_tail(&ps->list, &dev->filelist);
1776 file->private_data = ps;
1777 out:
1778 - unlock_kernel();
1779 - out_nolock:
1780 - return ret;
1781 + mutex_unlock(&usbfs_mutex);
1782 + return ret;
1783 }
1784
1785 static int usbdev_release(struct inode *inode, struct file *file)
1786 @@ -591,7 +591,12 @@ static int usbdev_release(struct inode *
1787 unsigned int ifnum;
1788
1789 usb_lock_device(dev);
1790 +
1791 + /* Protect against simultaneous open */
1792 + mutex_lock(&usbfs_mutex);
1793 list_del_init(&ps->list);
1794 + mutex_unlock(&usbfs_mutex);
1795 +
1796 for (ifnum = 0; ps->ifclaimed && ifnum < 8*sizeof(ps->ifclaimed);
1797 ifnum++) {
1798 if (test_bit(ifnum, &ps->ifclaimed))
1799 @@ -600,9 +605,8 @@ static int usbdev_release(struct inode *
1800 destroy_all_async(ps);
1801 usb_unlock_device(dev);
1802 usb_put_dev(dev);
1803 - ps->dev = NULL;
1804 kfree(ps);
1805 - return 0;
1806 + return 0;
1807 }
1808
1809 static int proc_control(struct dev_state *ps, void __user *arg)
1810 diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c
1811 index b042676..6b36897 100644
1812 --- a/drivers/usb/core/notify.c
1813 +++ b/drivers/usb/core/notify.c
1814 @@ -50,8 +50,11 @@ void usb_notify_add_device(struct usb_de
1815
1816 void usb_notify_remove_device(struct usb_device *udev)
1817 {
1818 + /* Protect against simultaneous usbfs open */
1819 + mutex_lock(&usbfs_mutex);
1820 blocking_notifier_call_chain(&usb_notifier_list,
1821 USB_DEVICE_REMOVE, udev);
1822 + mutex_unlock(&usbfs_mutex);
1823 }
1824
1825 void usb_notify_add_bus(struct usb_bus *ubus)
1826 diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
1827 index 49f6923..1217fbb 100644
1828 --- a/drivers/usb/core/usb.h
1829 +++ b/drivers/usb/core/usb.h
1830 @@ -59,6 +59,7 @@ static inline int is_active(struct usb_i
1831 extern const char *usbcore_name;
1832
1833 /* usbfs stuff */
1834 +extern struct mutex usbfs_mutex;
1835 extern struct usb_driver usbfs_driver;
1836 extern struct file_operations usbfs_devices_fops;
1837 extern struct file_operations usbfs_device_file_operations;
1838 diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
1839 index 409ce6a..5d7c726 100644
1840 --- a/fs/fuse/dir.c
1841 +++ b/fs/fuse/dir.c
1842 @@ -935,14 +935,30 @@ static void iattr_to_fattr(struct iattr
1843 }
1844 }
1845
1846 +static void fuse_vmtruncate(struct inode *inode, loff_t offset)
1847 +{
1848 + struct fuse_conn *fc = get_fuse_conn(inode);
1849 + int need_trunc;
1850 +
1851 + spin_lock(&fc->lock);
1852 + need_trunc = inode->i_size > offset;
1853 + i_size_write(inode, offset);
1854 + spin_unlock(&fc->lock);
1855 +
1856 + if (need_trunc) {
1857 + struct address_space *mapping = inode->i_mapping;
1858 + unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
1859 + truncate_inode_pages(mapping, offset);
1860 + }
1861 +}
1862 +
1863 /*
1864 * Set attributes, and at the same time refresh them.
1865 *
1866 * Truncation is slightly complicated, because the 'truncate' request
1867 * may fail, in which case we don't want to touch the mapping.
1868 - * vmtruncate() doesn't allow for this case. So do the rlimit
1869 - * checking by hand and call vmtruncate() only after the file has
1870 - * actually been truncated.
1871 + * vmtruncate() doesn't allow for this case, so do the rlimit checking
1872 + * and the actual truncation by hand.
1873 */
1874 static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1875 {
1876 @@ -993,12 +1009,8 @@ static int fuse_setattr(struct dentry *e
1877 make_bad_inode(inode);
1878 err = -EIO;
1879 } else {
1880 - if (is_truncate) {
1881 - loff_t origsize = i_size_read(inode);
1882 - i_size_write(inode, outarg.attr.size);
1883 - if (origsize > outarg.attr.size)
1884 - vmtruncate(inode, outarg.attr.size);
1885 - }
1886 + if (is_truncate)
1887 + fuse_vmtruncate(inode, outarg.attr.size);
1888 fuse_change_attributes(inode, &outarg.attr);
1889 fi->i_time = time_to_jiffies(outarg.attr_valid,
1890 outarg.attr_valid_nsec);
1891 diff --git a/fs/fuse/file.c b/fs/fuse/file.c
1892 index 5c4fcd1..4e174c8 100644
1893 --- a/fs/fuse/file.c
1894 +++ b/fs/fuse/file.c
1895 @@ -481,8 +481,10 @@ static int fuse_commit_write(struct file
1896 err = -EIO;
1897 if (!err) {
1898 pos += count;
1899 - if (pos > i_size_read(inode))
1900 + spin_lock(&fc->lock);
1901 + if (pos > inode->i_size)
1902 i_size_write(inode, pos);
1903 + spin_unlock(&fc->lock);
1904
1905 if (offset == 0 && to == PAGE_CACHE_SIZE) {
1906 clear_page_dirty(page);
1907 @@ -586,8 +588,12 @@ static ssize_t fuse_direct_io(struct fil
1908 }
1909 fuse_put_request(fc, req);
1910 if (res > 0) {
1911 - if (write && pos > i_size_read(inode))
1912 - i_size_write(inode, pos);
1913 + if (write) {
1914 + spin_lock(&fc->lock);
1915 + if (pos > inode->i_size)
1916 + i_size_write(inode, pos);
1917 + spin_unlock(&fc->lock);
1918 + }
1919 *ppos = pos;
1920 }
1921 fuse_invalidate_attr(inode);
1922 diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
1923 index 7d25092..65df8a4 100644
1924 --- a/fs/fuse/inode.c
1925 +++ b/fs/fuse/inode.c
1926 @@ -109,6 +109,7 @@ static int fuse_remount_fs(struct super_
1927
1928 void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
1929 {
1930 + struct fuse_conn *fc = get_fuse_conn(inode);
1931 if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
1932 invalidate_inode_pages(inode->i_mapping);
1933
1934 @@ -117,7 +118,9 @@ void fuse_change_attributes(struct inode
1935 inode->i_nlink = attr->nlink;
1936 inode->i_uid = attr->uid;
1937 inode->i_gid = attr->gid;
1938 + spin_lock(&fc->lock);
1939 i_size_write(inode, attr->size);
1940 + spin_unlock(&fc->lock);
1941 inode->i_blksize = PAGE_CACHE_SIZE;
1942 inode->i_blocks = attr->blocks;
1943 inode->i_atime.tv_sec = attr->atime;
1944 @@ -131,7 +134,7 @@ void fuse_change_attributes(struct inode
1945 static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr)
1946 {
1947 inode->i_mode = attr->mode & S_IFMT;
1948 - i_size_write(inode, attr->size);
1949 + inode->i_size = attr->size;
1950 if (S_ISREG(inode->i_mode)) {
1951 fuse_init_common(inode);
1952 fuse_init_file_inode(inode);
1953 diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
1954 index ccbe60a..3bdd90b 100644
1955 --- a/fs/jfs/jfs_imap.c
1956 +++ b/fs/jfs/jfs_imap.c
1957 @@ -318,7 +318,7 @@ int diRead(struct inode *ip)
1958 struct inomap *imap;
1959 int block_offset;
1960 int inodes_left;
1961 - uint pageno;
1962 + unsigned long pageno;
1963 int rel_inode;
1964
1965 jfs_info("diRead: ino = %ld", ip->i_ino);
1966 @@ -606,7 +606,7 @@ int diWrite(tid_t tid, struct inode *ip)
1967 int block_offset;
1968 int inodes_left;
1969 struct metapage *mp;
1970 - uint pageno;
1971 + unsigned long pageno;
1972 int rel_inode;
1973 int dioffset;
1974 struct inode *ipimap;
1975 diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
1976 index e7ffb4d..f86b9b4 100644
1977 --- a/fs/nfs/dir.c
1978 +++ b/fs/nfs/dir.c
1979 @@ -902,9 +902,15 @@ static struct dentry *nfs_lookup(struct
1980
1981 lock_kernel();
1982
1983 - /* If we're doing an exclusive create, optimize away the lookup */
1984 - if (nfs_is_exclusive_create(dir, nd))
1985 - goto no_entry;
1986 + /*
1987 + * If we're doing an exclusive create, optimize away the lookup
1988 + * but don't hash the dentry.
1989 + */
1990 + if (nfs_is_exclusive_create(dir, nd)) {
1991 + d_instantiate(dentry, NULL);
1992 + res = NULL;
1993 + goto out_unlock;
1994 + }
1995
1996 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
1997 if (error == -ENOENT)
1998 @@ -1156,6 +1162,8 @@ int nfs_instantiate(struct dentry *dentr
1999 if (IS_ERR(inode))
2000 goto out_err;
2001 d_instantiate(dentry, inode);
2002 + if (d_unhashed(dentry))
2003 + d_rehash(dentry);
2004 return 0;
2005 out_err:
2006 d_drop(dentry);
2007 diff --git a/fs/splice.c b/fs/splice.c
2008 index 684bca3..4eed2f6 100644
2009 --- a/fs/splice.c
2010 +++ b/fs/splice.c
2011 @@ -607,7 +607,7 @@ find_page:
2012 ret = -ENOMEM;
2013 page = page_cache_alloc_cold(mapping);
2014 if (unlikely(!page))
2015 - goto out_nomem;
2016 + goto out_ret;
2017
2018 /*
2019 * This will also lock the page
2020 @@ -666,7 +666,7 @@ find_page:
2021 if (sd->pos + this_len > isize)
2022 vmtruncate(mapping->host, isize);
2023
2024 - goto out;
2025 + goto out_ret;
2026 }
2027
2028 if (buf->page != page) {
2029 @@ -698,7 +698,7 @@ find_page:
2030 out:
2031 page_cache_release(page);
2032 unlock_page(page);
2033 -out_nomem:
2034 +out_ret:
2035 return ret;
2036 }
2037
2038 diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h
2039 index cb05bf6..5076455 100644
2040 --- a/include/asm-generic/audit_change_attr.h
2041 +++ b/include/asm-generic/audit_change_attr.h
2042 @@ -1,16 +1,20 @@
2043 __NR_chmod,
2044 __NR_fchmod,
2045 +#ifdef __NR_chown
2046 __NR_chown,
2047 __NR_fchown,
2048 __NR_lchown,
2049 +#endif
2050 __NR_setxattr,
2051 __NR_lsetxattr,
2052 __NR_fsetxattr,
2053 __NR_removexattr,
2054 __NR_lremovexattr,
2055 __NR_fremovexattr,
2056 +#ifdef __NR_fchownat
2057 __NR_fchownat,
2058 __NR_fchmodat,
2059 +#endif
2060 #ifdef __NR_chown32
2061 __NR_chown32,
2062 __NR_fchown32,
2063 diff --git a/include/asm-generic/audit_dir_write.h b/include/asm-generic/audit_dir_write.h
2064 index 161a7a5..6621bd8 100644
2065 --- a/include/asm-generic/audit_dir_write.h
2066 +++ b/include/asm-generic/audit_dir_write.h
2067 @@ -1,14 +1,18 @@
2068 __NR_rename,
2069 __NR_mkdir,
2070 __NR_rmdir,
2071 +#ifdef __NR_creat
2072 __NR_creat,
2073 +#endif
2074 __NR_link,
2075 __NR_unlink,
2076 __NR_symlink,
2077 __NR_mknod,
2078 +#ifdef __NR_mkdirat
2079 __NR_mkdirat,
2080 __NR_mknodat,
2081 __NR_unlinkat,
2082 __NR_renameat,
2083 __NR_linkat,
2084 __NR_symlinkat,
2085 +#endif
2086 diff --git a/include/asm-s390/div64.h b/include/asm-s390/div64.h
2087 index af098dc..6cd978c 100644
2088 --- a/include/asm-s390/div64.h
2089 +++ b/include/asm-s390/div64.h
2090 @@ -1,49 +1 @@
2091 -#ifndef __S390_DIV64
2092 -#define __S390_DIV64
2093 -
2094 -#ifndef __s390x__
2095 -
2096 -/* for do_div "base" needs to be smaller than 2^31-1 */
2097 -#define do_div(n, base) ({ \
2098 - unsigned long long __n = (n); \
2099 - unsigned long __r; \
2100 - \
2101 - asm (" slr 0,0\n" \
2102 - " l 1,%1\n" \
2103 - " srdl 0,1\n" \
2104 - " dr 0,%2\n" \
2105 - " alr 1,1\n" \
2106 - " alr 0,0\n" \
2107 - " lhi 2,1\n" \
2108 - " n 2,%1\n" \
2109 - " alr 0,2\n" \
2110 - " clr 0,%2\n" \
2111 - " jl 0f\n" \
2112 - " slr 0,%2\n" \
2113 - " ahi 1,1\n" \
2114 - "0: st 1,%1\n" \
2115 - " l 1,4+%1\n" \
2116 - " srdl 0,1\n" \
2117 - " dr 0,%2\n" \
2118 - " alr 1,1\n" \
2119 - " alr 0,0\n" \
2120 - " lhi 2,1\n" \
2121 - " n 2,4+%1\n" \
2122 - " alr 0,2\n" \
2123 - " clr 0,%2\n" \
2124 - " jl 1f\n" \
2125 - " slr 0,%2\n" \
2126 - " ahi 1,1\n" \
2127 - "1: st 1,4+%1\n" \
2128 - " lr %0,0" \
2129 - : "=d" (__r), "=m" (__n) \
2130 - : "d" (base), "m" (__n) : "0", "1", "2", "cc" ); \
2131 - (n) = (__n); \
2132 - __r; \
2133 -})
2134 -
2135 -#else /* __s390x__ */
2136 #include <asm-generic/div64.h>
2137 -#endif /* __s390x__ */
2138 -
2139 -#endif
2140 diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
2141 index 5951364..5dfe111 100644
2142 --- a/include/linux/mmzone.h
2143 +++ b/include/linux/mmzone.h
2144 @@ -200,13 +200,9 @@ #endif
2145 * under - it drives the swappiness decision: whether to unmap mapped
2146 * pages.
2147 *
2148 - * temp_priority is used to remember the scanning priority at which
2149 - * this zone was successfully refilled to free_pages == pages_high.
2150 - *
2151 - * Access to both these fields is quite racy even on uniprocessor. But
2152 + * Access to both this field is quite racy even on uniprocessor. But
2153 * it is expected to average out OK.
2154 */
2155 - int temp_priority;
2156 int prev_priority;
2157
2158
2159 @@ -632,6 +628,12 @@ #define sparse_init() do {} while (0)
2160 #define sparse_index_init(_sec, _nid) do {} while (0)
2161 #endif /* CONFIG_SPARSEMEM */
2162
2163 +#ifdef CONFIG_NODES_SPAN_OTHER_NODES
2164 +#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
2165 +#else
2166 +#define early_pfn_in_nid(pfn, nid) (1)
2167 +#endif
2168 +
2169 #ifndef early_pfn_valid
2170 #define early_pfn_valid(pfn) (1)
2171 #endif
2172 diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
2173 index 86501a3..f9fdf97 100644
2174 --- a/include/linux/serial_core.h
2175 +++ b/include/linux/serial_core.h
2176 @@ -319,6 +319,7 @@ #define UIF_CHECK_CD ((__force uif_t) (
2177 #define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
2178 #define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29))
2179 #define UIF_INITIALIZED ((__force uif_t) (1 << 31))
2180 +#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
2181
2182 int blocked_open;
2183
2184 diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
2185 index d38d9ec..0779b48 100644
2186 --- a/kernel/posix-cpu-timers.c
2187 +++ b/kernel/posix-cpu-timers.c
2188 @@ -88,6 +88,19 @@ static inline union cpu_time_count cpu_t
2189 }
2190
2191 /*
2192 + * Divide and limit the result to res >= 1
2193 + *
2194 + * This is necessary to prevent signal delivery starvation, when the result of
2195 + * the division would be rounded down to 0.
2196 + */
2197 +static inline cputime_t cputime_div_non_zero(cputime_t time, unsigned long div)
2198 +{
2199 + cputime_t res = cputime_div(time, div);
2200 +
2201 + return max_t(cputime_t, res, 1);
2202 +}
2203 +
2204 +/*
2205 * Update expiry time from increment, and increase overrun count,
2206 * given the current clock sample.
2207 */
2208 @@ -483,8 +496,8 @@ static void process_timer_rebalance(stru
2209 BUG();
2210 break;
2211 case CPUCLOCK_PROF:
2212 - left = cputime_div(cputime_sub(expires.cpu, val.cpu),
2213 - nthreads);
2214 + left = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu),
2215 + nthreads);
2216 do {
2217 if (likely(!(t->flags & PF_EXITING))) {
2218 ticks = cputime_add(prof_ticks(t), left);
2219 @@ -498,8 +511,8 @@ static void process_timer_rebalance(stru
2220 } while (t != p);
2221 break;
2222 case CPUCLOCK_VIRT:
2223 - left = cputime_div(cputime_sub(expires.cpu, val.cpu),
2224 - nthreads);
2225 + left = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu),
2226 + nthreads);
2227 do {
2228 if (likely(!(t->flags & PF_EXITING))) {
2229 ticks = cputime_add(virt_ticks(t), left);
2230 @@ -515,6 +528,7 @@ static void process_timer_rebalance(stru
2231 case CPUCLOCK_SCHED:
2232 nsleft = expires.sched - val.sched;
2233 do_div(nsleft, nthreads);
2234 + nsleft = max_t(unsigned long long, nsleft, 1);
2235 do {
2236 if (likely(!(t->flags & PF_EXITING))) {
2237 ns = t->sched_time + nsleft;
2238 @@ -1159,12 +1173,13 @@ static void check_process_timers(struct
2239
2240 prof_left = cputime_sub(prof_expires, utime);
2241 prof_left = cputime_sub(prof_left, stime);
2242 - prof_left = cputime_div(prof_left, nthreads);
2243 + prof_left = cputime_div_non_zero(prof_left, nthreads);
2244 virt_left = cputime_sub(virt_expires, utime);
2245 - virt_left = cputime_div(virt_left, nthreads);
2246 + virt_left = cputime_div_non_zero(virt_left, nthreads);
2247 if (sched_expires) {
2248 sched_left = sched_expires - sched_time;
2249 do_div(sched_left, nthreads);
2250 + sched_left = max_t(unsigned long long, sched_left, 1);
2251 } else {
2252 sched_left = 0;
2253 }
2254 diff --git a/kernel/taskstats.c b/kernel/taskstats.c
2255 index e781876..b90b2a7 100644
2256 --- a/kernel/taskstats.c
2257 +++ b/kernel/taskstats.c
2258 @@ -229,14 +229,17 @@ static int fill_tgid(pid_t tgid, struct
2259 } else
2260 get_task_struct(first);
2261
2262 - /* Start with stats from dead tasks */
2263 - spin_lock_irqsave(&first->signal->stats_lock, flags);
2264 - if (first->signal->stats)
2265 - memcpy(stats, first->signal->stats, sizeof(*stats));
2266 - spin_unlock_irqrestore(&first->signal->stats_lock, flags);
2267
2268 tsk = first;
2269 read_lock(&tasklist_lock);
2270 + /* Start with stats from dead tasks */
2271 + if (first->signal) {
2272 + spin_lock_irqsave(&first->signal->stats_lock, flags);
2273 + if (first->signal->stats)
2274 + memcpy(stats, first->signal->stats, sizeof(*stats));
2275 + spin_unlock_irqrestore(&first->signal->stats_lock, flags);
2276 + }
2277 +
2278 do {
2279 if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk))
2280 continue;
2281 @@ -256,7 +259,7 @@ static int fill_tgid(pid_t tgid, struct
2282 * Accounting subsytems can also add calls here to modify
2283 * fields of taskstats.
2284 */
2285 -
2286 + put_task_struct(first);
2287 return 0;
2288 }
2289
2290 diff --git a/lib/audit.c b/lib/audit.c
2291 index 8c21625..3b1289f 100644
2292 --- a/lib/audit.c
2293 +++ b/lib/audit.c
2294 @@ -28,8 +28,10 @@ int audit_classify_syscall(int abi, unsi
2295 switch(syscall) {
2296 case __NR_open:
2297 return 2;
2298 +#ifdef __NR_openat
2299 case __NR_openat:
2300 return 3;
2301 +#endif
2302 #ifdef __NR_socketcall
2303 case __NR_socketcall:
2304 return 4;
2305 diff --git a/mm/memory.c b/mm/memory.c
2306 index 109e986..d28450c 100644
2307 --- a/mm/memory.c
2308 +++ b/mm/memory.c
2309 @@ -1551,7 +1551,14 @@ gotten:
2310 entry = mk_pte(new_page, vma->vm_page_prot);
2311 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
2312 lazy_mmu_prot_update(entry);
2313 - ptep_establish(vma, address, page_table, entry);
2314 + /*
2315 + * Clear the pte entry and flush it first, before updating the
2316 + * pte with the new entry. This will avoid a race condition
2317 + * seen in the presence of one thread doing SMC and another
2318 + * thread doing COW.
2319 + */
2320 + ptep_clear_flush(vma, address, page_table);
2321 + set_pte_at(mm, address, page_table, entry);
2322 update_mmu_cache(vma, address, entry);
2323 lru_cache_add_active(new_page);
2324 page_add_new_anon_rmap(new_page, vma, address);
2325 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
2326 index 7e92c94..128b9f5 100644
2327 --- a/mm/page_alloc.c
2328 +++ b/mm/page_alloc.c
2329 @@ -1673,6 +1673,8 @@ void __meminit memmap_init_zone(unsigned
2330 for (pfn = start_pfn; pfn < end_pfn; pfn++) {
2331 if (!early_pfn_valid(pfn))
2332 continue;
2333 + if (!early_pfn_in_nid(pfn, nid))
2334 + continue;
2335 page = pfn_to_page(pfn);
2336 set_page_links(page, zone, nid, pfn);
2337 init_page_count(page);
2338 @@ -2019,7 +2021,7 @@ #endif
2339 zone->zone_pgdat = pgdat;
2340 zone->free_pages = 0;
2341
2342 - zone->temp_priority = zone->prev_priority = DEF_PRIORITY;
2343 + zone->prev_priority = DEF_PRIORITY;
2344
2345 zone_pcp_init(zone);
2346 INIT_LIST_HEAD(&zone->active_list);
2347 diff --git a/mm/vmscan.c b/mm/vmscan.c
2348 index 1dad4b6..a04fb41 100644
2349 --- a/mm/vmscan.c
2350 +++ b/mm/vmscan.c
2351 @@ -696,6 +696,20 @@ done:
2352 }
2353
2354 /*
2355 + * We are about to scan this zone at a certain priority level. If that priority
2356 + * level is smaller (ie: more urgent) than the previous priority, then note
2357 + * that priority level within the zone. This is done so that when the next
2358 + * process comes in to scan this zone, it will immediately start out at this
2359 + * priority level rather than having to build up its own scanning priority.
2360 + * Here, this priority affects only the reclaim-mapped threshold.
2361 + */
2362 +static inline void note_zone_scanning_priority(struct zone *zone, int priority)
2363 +{
2364 + if (priority < zone->prev_priority)
2365 + zone->prev_priority = priority;
2366 +}
2367 +
2368 +/*
2369 * This moves pages from the active list to the inactive list.
2370 *
2371 * We move them the other way if the page is referenced by one or more
2372 @@ -713,7 +727,7 @@ done:
2373 * But we had to alter page->flags anyway.
2374 */
2375 static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
2376 - struct scan_control *sc)
2377 + struct scan_control *sc, int priority)
2378 {
2379 unsigned long pgmoved;
2380 int pgdeactivate = 0;
2381 @@ -734,7 +748,7 @@ static void shrink_active_list(unsigned
2382 * `distress' is a measure of how much trouble we're having
2383 * reclaiming pages. 0 -> no problems. 100 -> great trouble.
2384 */
2385 - distress = 100 >> zone->prev_priority;
2386 + distress = 100 >> min(zone->prev_priority, priority);
2387
2388 /*
2389 * The point of this algorithm is to decide when to start
2390 @@ -885,7 +899,7 @@ static unsigned long shrink_zone(int pri
2391 nr_to_scan = min(nr_active,
2392 (unsigned long)sc->swap_cluster_max);
2393 nr_active -= nr_to_scan;
2394 - shrink_active_list(nr_to_scan, zone, sc);
2395 + shrink_active_list(nr_to_scan, zone, sc, priority);
2396 }
2397
2398 if (nr_inactive) {
2399 @@ -934,9 +948,7 @@ static unsigned long shrink_zones(int pr
2400 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
2401 continue;
2402
2403 - zone->temp_priority = priority;
2404 - if (zone->prev_priority > priority)
2405 - zone->prev_priority = priority;
2406 + note_zone_scanning_priority(zone, priority);
2407
2408 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
2409 continue; /* Let kswapd poll it */
2410 @@ -984,7 +996,6 @@ unsigned long try_to_free_pages(struct z
2411 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
2412 continue;
2413
2414 - zone->temp_priority = DEF_PRIORITY;
2415 lru_pages += zone->nr_active + zone->nr_inactive;
2416 }
2417
2418 @@ -1022,13 +1033,22 @@ unsigned long try_to_free_pages(struct z
2419 blk_congestion_wait(WRITE, HZ/10);
2420 }
2421 out:
2422 + /*
2423 + * Now that we've scanned all the zones at this priority level, note
2424 + * that level within the zone so that the next thread which performs
2425 + * scanning of this zone will immediately start out at this priority
2426 + * level. This affects only the decision whether or not to bring
2427 + * mapped pages onto the inactive list.
2428 + */
2429 + if (priority < 0)
2430 + priority = 0;
2431 for (i = 0; zones[i] != 0; i++) {
2432 struct zone *zone = zones[i];
2433
2434 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
2435 continue;
2436
2437 - zone->prev_priority = zone->temp_priority;
2438 + zone->prev_priority = priority;
2439 }
2440 return ret;
2441 }
2442 @@ -1068,6 +1088,11 @@ static unsigned long balance_pgdat(pg_da
2443 .swap_cluster_max = SWAP_CLUSTER_MAX,
2444 .swappiness = vm_swappiness,
2445 };
2446 + /*
2447 + * temp_priority is used to remember the scanning priority at which
2448 + * this zone was successfully refilled to free_pages == pages_high.
2449 + */
2450 + int temp_priority[MAX_NR_ZONES];
2451
2452 loop_again:
2453 total_scanned = 0;
2454 @@ -1075,11 +1100,8 @@ loop_again:
2455 sc.may_writepage = !laptop_mode;
2456 count_vm_event(PAGEOUTRUN);
2457
2458 - for (i = 0; i < pgdat->nr_zones; i++) {
2459 - struct zone *zone = pgdat->node_zones + i;
2460 -
2461 - zone->temp_priority = DEF_PRIORITY;
2462 - }
2463 + for (i = 0; i < pgdat->nr_zones; i++)
2464 + temp_priority[i] = DEF_PRIORITY;
2465
2466 for (priority = DEF_PRIORITY; priority >= 0; priority--) {
2467 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
2468 @@ -1140,10 +1162,9 @@ scan:
2469 if (!zone_watermark_ok(zone, order, zone->pages_high,
2470 end_zone, 0))
2471 all_zones_ok = 0;
2472 - zone->temp_priority = priority;
2473 - if (zone->prev_priority > priority)
2474 - zone->prev_priority = priority;
2475 + temp_priority[i] = priority;
2476 sc.nr_scanned = 0;
2477 + note_zone_scanning_priority(zone, priority);
2478 nr_reclaimed += shrink_zone(priority, zone, &sc);
2479 reclaim_state->reclaimed_slab = 0;
2480 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
2481 @@ -1183,10 +1204,15 @@ scan:
2482 break;
2483 }
2484 out:
2485 + /*
2486 + * Note within each zone the priority level at which this zone was
2487 + * brought into a happy state. So that the next thread which scans this
2488 + * zone will start out at that priority level.
2489 + */
2490 for (i = 0; i < pgdat->nr_zones; i++) {
2491 struct zone *zone = pgdat->node_zones + i;
2492
2493 - zone->prev_priority = zone->temp_priority;
2494 + zone->prev_priority = temp_priority[i];
2495 }
2496 if (!all_zones_ok) {
2497 cond_resched();
2498 @@ -1315,7 +1341,7 @@ static unsigned long shrink_all_zones(un
2499 if (zone->nr_scan_active >= nr_pages || pass > 3) {
2500 zone->nr_scan_active = 0;
2501 nr_to_scan = min(nr_pages, zone->nr_active);
2502 - shrink_active_list(nr_to_scan, zone, sc);
2503 + shrink_active_list(nr_to_scan, zone, sc, prio);
2504 }
2505 }
2506
2507 @@ -1570,6 +1596,7 @@ static int __zone_reclaim(struct zone *z
2508 */
2509 priority = ZONE_RECLAIM_PRIORITY;
2510 do {
2511 + note_zone_scanning_priority(zone, priority);
2512 nr_reclaimed += shrink_zone(priority, zone, &sc);
2513 priority--;
2514 } while (priority >= 0 && nr_reclaimed < nr_pages);
2515 diff --git a/mm/vmstat.c b/mm/vmstat.c
2516 index c1b5f41..0e3f7e2 100644
2517 --- a/mm/vmstat.c
2518 +++ b/mm/vmstat.c
2519 @@ -586,11 +586,9 @@ #endif
2520 seq_printf(m,
2521 "\n all_unreclaimable: %u"
2522 "\n prev_priority: %i"
2523 - "\n temp_priority: %i"
2524 "\n start_pfn: %lu",
2525 zone->all_unreclaimable,
2526 zone->prev_priority,
2527 - zone->temp_priority,
2528 zone->zone_start_pfn);
2529 spin_unlock_irqrestore(&zone->lock, flags);
2530 seq_putc(m, '\n');
2531 diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
2532 index bd8d671..5d65ceb 100644
2533 --- a/net/bluetooth/rfcomm/tty.c
2534 +++ b/net/bluetooth/rfcomm/tty.c
2535 @@ -748,6 +748,9 @@ static void rfcomm_tty_set_termios(struc
2536
2537 BT_DBG("tty %p termios %p", tty, old);
2538
2539 + if (!dev)
2540 + return;
2541 +
2542 /* Handle turning off CRTSCTS */
2543 if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS))
2544 BT_DBG("Turning off CRTSCTS unsupported");
2545 diff --git a/net/core/skbuff.c b/net/core/skbuff.c
2546 index c54f366..7de9857 100644
2547 --- a/net/core/skbuff.c
2548 +++ b/net/core/skbuff.c
2549 @@ -1945,7 +1945,7 @@ struct sk_buff *skb_segment(struct sk_bu
2550 do {
2551 struct sk_buff *nskb;
2552 skb_frag_t *frag;
2553 - int hsize, nsize;
2554 + int hsize;
2555 int k;
2556 int size;
2557
2558 @@ -1956,11 +1956,10 @@ struct sk_buff *skb_segment(struct sk_bu
2559 hsize = skb_headlen(skb) - offset;
2560 if (hsize < 0)
2561 hsize = 0;
2562 - nsize = hsize + doffset;
2563 - if (nsize > len + doffset || !sg)
2564 - nsize = len + doffset;
2565 + if (hsize > len || !sg)
2566 + hsize = len;
2567
2568 - nskb = alloc_skb(nsize + headroom, GFP_ATOMIC);
2569 + nskb = alloc_skb(hsize + doffset + headroom, GFP_ATOMIC);
2570 if (unlikely(!nskb))
2571 goto err;
2572
2573 diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
2574 index 5486247..07d9869 100644
2575 --- a/net/decnet/af_decnet.c
2576 +++ b/net/decnet/af_decnet.c
2577 @@ -1177,8 +1177,10 @@ static int dn_getname(struct socket *soc
2578 if (peer) {
2579 if ((sock->state != SS_CONNECTED &&
2580 sock->state != SS_CONNECTING) &&
2581 - scp->accept_mode == ACC_IMMED)
2582 + scp->accept_mode == ACC_IMMED) {
2583 + release_sock(sk);
2584 return -ENOTCONN;
2585 + }
2586
2587 memcpy(sa, &scp->peer, sizeof(struct sockaddr_dn));
2588 } else {
2589 diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
2590 index 2be2798..c3b01b5 100644
2591 --- a/net/ipv4/tcp_cubic.c
2592 +++ b/net/ipv4/tcp_cubic.c
2593 @@ -190,7 +190,7 @@ static inline void bictcp_update(struct
2594 */
2595
2596 /* change the unit from HZ to bictcp_HZ */
2597 - t = ((tcp_time_stamp + ca->delay_min - ca->epoch_start)
2598 + t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start)
2599 << BICTCP_HZ) / HZ;
2600
2601 if (t < ca->bic_K) /* t - K */
2602 @@ -259,7 +259,7 @@ static inline void measure_delay(struct
2603 (s32)(tcp_time_stamp - ca->epoch_start) < HZ)
2604 return;
2605
2606 - delay = tcp_time_stamp - tp->rx_opt.rcv_tsecr;
2607 + delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3;
2608 if (delay == 0)
2609 delay = 1;
2610
2611 @@ -366,7 +366,7 @@ static int __init cubictcp_register(void
2612
2613 beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta);
2614
2615 - cube_rtt_scale = (bic_scale << 3) / 10; /* 1024*c/rtt */
2616 + cube_rtt_scale = (bic_scale * 10); /* 1024*c/rtt */
2617
2618 /* calculate the "K" for (wmax-cwnd) = c/rtt * K^3
2619 * so K = cubic_root( (wmax-cwnd)*rtt/c )
2620 diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
2621 index 1d672b0..062e526 100644
2622 --- a/net/ipv6/ip6_flowlabel.c
2623 +++ b/net/ipv6/ip6_flowlabel.c
2624 @@ -587,6 +587,8 @@ static struct ip6_flowlabel *ip6fl_get_n
2625 while (!fl) {
2626 if (++state->bucket <= FL_HASH_MASK)
2627 fl = fl_ht[state->bucket];
2628 + else
2629 + break;
2630 }
2631 return fl;
2632 }
2633 diff --git a/net/sctp/input.c b/net/sctp/input.c
2634 index 42b66e7..2060bbe 100644
2635 --- a/net/sctp/input.c
2636 +++ b/net/sctp/input.c
2637 @@ -135,6 +135,9 @@ int sctp_rcv(struct sk_buff *skb)
2638
2639 SCTP_INC_STATS_BH(SCTP_MIB_INSCTPPACKS);
2640
2641 + if (skb_linearize(skb))
2642 + goto discard_it;
2643 +
2644 sh = (struct sctphdr *) skb->h.raw;
2645
2646 /* Pull up the IP and SCTP headers. */
2647 diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
2648 index d9a9573..2544acd 100644
2649 --- a/net/sunrpc/svcsock.c
2650 +++ b/net/sunrpc/svcsock.c
2651 @@ -902,7 +902,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
2652 return 0;
2653 }
2654
2655 - if (test_bit(SK_CONN, &svsk->sk_flags)) {
2656 + if (svsk->sk_sk->sk_state == TCP_LISTEN) {
2657 svc_tcp_accept(svsk);
2658 svc_sock_received(svsk);
2659 return 0;
2660 diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
2661 index 8bd0dcc..a562f96 100644
2662 --- a/sound/core/hwdep.c
2663 +++ b/sound/core/hwdep.c
2664 @@ -158,6 +158,7 @@ static int snd_hwdep_release(struct inod
2665 {
2666 int err = -ENXIO;
2667 struct snd_hwdep *hw = file->private_data;
2668 + struct module *mod = hw->card->module;
2669 mutex_lock(&hw->open_mutex);
2670 if (hw->ops.release) {
2671 err = hw->ops.release(hw, file);
2672 @@ -167,7 +168,7 @@ static int snd_hwdep_release(struct inod
2673 hw->used--;
2674 snd_card_file_remove(hw->card, file);
2675 mutex_unlock(&hw->open_mutex);
2676 - module_put(hw->card->module);
2677 + module_put(mod);
2678 return err;
2679 }
2680
2681 diff --git a/sound/core/info.c b/sound/core/info.c
2682 index 340332c..57821ce 100644
2683 --- a/sound/core/info.c
2684 +++ b/sound/core/info.c
2685 @@ -119,7 +119,10 @@ int snd_iprintf(struct snd_info_buffer *
2686 len = buffer->len - buffer->size;
2687 va_start(args, fmt);
2688 for (;;) {
2689 - res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args);
2690 + va_list ap;
2691 + va_copy(ap, args);
2692 + res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap);
2693 + va_end(ap);
2694 if (res < len)
2695 break;
2696 err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);
2697 diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
2698 index 84704cc..15b6c8a 100644
2699 --- a/sound/core/rtctimer.c
2700 +++ b/sound/core/rtctimer.c
2701 @@ -50,7 +50,9 @@ static int rtctimer_stop(struct snd_time
2702 * The hardware dependent description for this timer.
2703 */
2704 static struct snd_timer_hardware rtc_hw = {
2705 - .flags = SNDRV_TIMER_HW_FIRST|SNDRV_TIMER_HW_AUTO,
2706 + .flags = SNDRV_TIMER_HW_AUTO |
2707 + SNDRV_TIMER_HW_FIRST |
2708 + SNDRV_TIMER_HW_TASKLET,
2709 .ticks = 100000000L, /* FIXME: XXX */
2710 .open = rtctimer_open,
2711 .close = rtctimer_close,
2712 @@ -60,6 +62,7 @@ static struct snd_timer_hardware rtc_hw
2713
2714 static int rtctimer_freq = RTC_FREQ; /* frequency */
2715 static struct snd_timer *rtctimer;
2716 +static struct tasklet_struct rtc_tasklet;
2717 static rtc_task_t rtc_task;
2718
2719
2720 @@ -81,6 +84,7 @@ rtctimer_close(struct snd_timer *t)
2721 rtc_task_t *rtc = t->private_data;
2722 if (rtc) {
2723 rtc_unregister(rtc);
2724 + tasklet_kill(&rtc_tasklet);
2725 t->private_data = NULL;
2726 }
2727 return 0;
2728 @@ -105,12 +109,17 @@ rtctimer_stop(struct snd_timer *timer)
2729 return 0;
2730 }
2731
2732 +static void rtctimer_tasklet(unsigned long data)
2733 +{
2734 + snd_timer_interrupt((struct snd_timer *)data, 1);
2735 +}
2736 +
2737 /*
2738 * interrupt
2739 */
2740 static void rtctimer_interrupt(void *private_data)
2741 {
2742 - snd_timer_interrupt(private_data, 1);
2743 + tasklet_hi_schedule(private_data);
2744 }
2745
2746
2747 @@ -139,9 +148,11 @@ static int __init rtctimer_init(void)
2748 timer->hw = rtc_hw;
2749 timer->hw.resolution = NANO_SEC / rtctimer_freq;
2750
2751 + tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer);
2752 +
2753 /* set up RTC callback */
2754 rtc_task.func = rtctimer_interrupt;
2755 - rtc_task.private_data = timer;
2756 + rtc_task.private_data = &rtc_tasklet;
2757
2758 err = snd_timer_global_register(timer);
2759 if (err < 0) {
2760 diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
2761 index ef189d7..6ed5ad5 100644
2762 --- a/sound/pci/au88x0/au88x0.c
2763 +++ b/sound/pci/au88x0/au88x0.c
2764 @@ -128,6 +128,7 @@ static int snd_vortex_dev_free(struct sn
2765 // Take down PCI interface.
2766 synchronize_irq(vortex->irq);
2767 free_irq(vortex->irq, vortex);
2768 + iounmap(vortex->mmio);
2769 pci_release_regions(vortex->pci_dev);
2770 pci_disable_device(vortex->pci_dev);
2771 kfree(vortex);
2772 diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
2773 index 79f24cd..bc1dfdc 100644
2774 --- a/sound/pci/emu10k1/emu10k1_main.c
2775 +++ b/sound/pci/emu10k1/emu10k1_main.c
2776 @@ -1460,8 +1460,8 @@ void snd_emu10k1_resume_regs(struct snd_
2777
2778 /* resore for spdif */
2779 if (emu->audigy)
2780 - outl(emu->port + A_IOCFG, emu->saved_a_iocfg);
2781 - outl(emu->port + HCFG, emu->saved_hcfg);
2782 + outl(emu->saved_a_iocfg, emu->port + A_IOCFG);
2783 + outl(emu->saved_hcfg, emu->port + HCFG);
2784
2785 val = emu->saved_ptr;
2786 for (reg = saved_regs; *reg != 0xff; reg++)
2787 diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
2788 index 59482a4..272ae38 100644
2789 --- a/sound/ppc/keywest.c
2790 +++ b/sound/ppc/keywest.c
2791 @@ -117,6 +117,9 @@ int __init snd_pmac_tumbler_post_init(vo
2792 {
2793 int err;
2794
2795 + if (!keywest_ctx || !keywest_ctx->client)
2796 + return -ENXIO;
2797 +
2798 if ((err = keywest_ctx->init_client(keywest_ctx)) < 0) {
2799 snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err);
2800 return err;
2801 diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
2802 index f6bd0de..8d2f26d 100644
2803 --- a/sound/usb/usx2y/usbusx2yaudio.c
2804 +++ b/sound/usb/usx2y/usbusx2yaudio.c
2805 @@ -322,7 +322,7 @@ static void i_usX2Y_urb_complete(struct
2806 usX2Y_error_urb_status(usX2Y, subs, urb);
2807 return;
2808 }
2809 - if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame))
2810 + if (likely(urb->start_frame == usX2Y->wait_iso_frame))
2811 subs->completed_urb = urb;
2812 else {
2813 usX2Y_error_sequence(usX2Y, subs, urb);
2814 @@ -335,13 +335,9 @@ static void i_usX2Y_urb_complete(struct
2815 atomic_read(&capsubs->state) >= state_PREPARED &&
2816 (playbacksubs->completed_urb ||
2817 atomic_read(&playbacksubs->state) < state_PREPARED)) {
2818 - if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) {
2819 - if (nr_of_packs() <= urb->start_frame &&
2820 - urb->start_frame <= (2 * nr_of_packs() - 1)) // uhci and ohci
2821 - usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
2822 - else
2823 - usX2Y->wait_iso_frame += nr_of_packs();
2824 - } else {
2825 + if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame))
2826 + usX2Y->wait_iso_frame += nr_of_packs();
2827 + else {
2828 snd_printdd("\n");
2829 usX2Y_clients_stop(usX2Y);
2830 }
2831 @@ -495,7 +491,6 @@ static int usX2Y_urbs_start(struct snd_u
2832 if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
2833 goto start;
2834 }
2835 - usX2Y->wait_iso_frame = -1;
2836
2837 start:
2838 usX2Y_subs_startup(subs);
2839 @@ -516,10 +511,9 @@ static int usX2Y_urbs_start(struct snd_u
2840 snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
2841 err = -EPIPE;
2842 goto cleanup;
2843 - } else {
2844 - if (0 > usX2Y->wait_iso_frame)
2845 + } else
2846 + if (i == 0)
2847 usX2Y->wait_iso_frame = urb->start_frame;
2848 - }
2849 urb->transfer_flags = 0;
2850 } else {
2851 atomic_set(&subs->state, state_STARTING1);
2852 diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
2853 index 88b72b5..3bda17d 100644
2854 --- a/sound/usb/usx2y/usx2yhwdeppcm.c
2855 +++ b/sound/usb/usx2y/usx2yhwdeppcm.c
2856 @@ -243,7 +243,7 @@ static void i_usX2Y_usbpcm_urb_complete(
2857 usX2Y_error_urb_status(usX2Y, subs, urb);
2858 return;
2859 }
2860 - if (likely((0xFFFF & urb->start_frame) == usX2Y->wait_iso_frame))
2861 + if (likely(urb->start_frame == usX2Y->wait_iso_frame))
2862 subs->completed_urb = urb;
2863 else {
2864 usX2Y_error_sequence(usX2Y, subs, urb);
2865 @@ -256,13 +256,9 @@ static void i_usX2Y_usbpcm_urb_complete(
2866 if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED &&
2867 (NULL == capsubs2 || capsubs2->completed_urb) &&
2868 (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) {
2869 - if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) {
2870 - if (nr_of_packs() <= urb->start_frame &&
2871 - urb->start_frame <= (2 * nr_of_packs() - 1)) // uhci and ohci
2872 - usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
2873 - else
2874 - usX2Y->wait_iso_frame += nr_of_packs();
2875 - } else {
2876 + if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame))
2877 + usX2Y->wait_iso_frame += nr_of_packs();
2878 + else {
2879 snd_printdd("\n");
2880 usX2Y_clients_stop(usX2Y);
2881 }
2882 @@ -433,7 +429,6 @@ static int usX2Y_usbpcm_urbs_start(struc
2883 if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
2884 goto start;
2885 }
2886 - usX2Y->wait_iso_frame = -1;
2887
2888 start:
2889 usX2Y_usbpcm_subs_startup(subs);
2890 @@ -459,7 +454,7 @@ static int usX2Y_usbpcm_urbs_start(struc
2891 goto cleanup;
2892 } else {
2893 snd_printdd("%i\n", urb->start_frame);
2894 - if (0 > usX2Y->wait_iso_frame)
2895 + if (u == 0)
2896 usX2Y->wait_iso_frame = urb->start_frame;
2897 }
2898 urb->transfer_flags = 0;
2899 @@ -632,7 +627,7 @@ static int usX2Y_pcms_lock_check(struct
2900 for (s = 0; s < 2; ++s) {
2901 struct snd_pcm_substream *substream;
2902 substream = pcm->streams[s].substream;
2903 - if (SUBSTREAM_BUSY(substream))
2904 + if (substream && SUBSTREAM_BUSY(substream))
2905 err = -EBUSY;
2906 }
2907 }

  ViewVC Help
Powered by ViewVC 1.1.20