aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-18 17:14:17 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-18 17:14:17 -0400
commit28af493cd7b89cba7e3ee534079cf4f41bb4b4f9 (patch)
treeea27df5ab7b728496a15602e0a7da74ff188378f
parent74cfe03f80adc320bde4dd37616354aefe2271aa (diff)
parent39ca371c45b04cd50d0974030ae051906fc516b6 (diff)
Merge branch 'master'
-rw-r--r--MAINTAINERS7
-rw-r--r--Makefile4
-rw-r--r--arch/arm/kernel/vmlinux.lds.S15
-rw-r--r--arch/arm/mach-l7200/core.c20
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c20
-rw-r--r--arch/arm/mach-pxa/generic.c5
-rw-r--r--arch/arm/mach-pxa/spitz.c4
-rw-r--r--arch/arm/mach-s3c2410/Kconfig1
-rw-r--r--arch/m32r/kernel/smp.c12
-rw-r--r--arch/mips/pci/fixup-tb0226.c33
-rw-r--r--arch/ppc64/kernel/pmac_setup.c3
-rw-r--r--arch/sparc64/kernel/pci_iommu.c363
-rw-r--r--arch/sparc64/kernel/pci_psycho.c44
-rw-r--r--arch/sparc64/kernel/pci_sabre.c39
-rw-r--r--arch/sparc64/kernel/pci_schizo.c57
-rw-r--r--arch/sparc64/kernel/smp.c7
-rw-r--r--arch/sparc64/mm/ultra.S16
-rw-r--r--arch/sparc64/prom/misc.c12
-rw-r--r--drivers/acpi/event.c5
-rw-r--r--drivers/char/mbcs.c3
-rw-r--r--drivers/char/n_r3964.c8
-rw-r--r--drivers/input/keyboard/Kconfig2
-rw-r--r--drivers/input/keyboard/spitzkbd.c2
-rw-r--r--drivers/input/misc/uinput.c4
-rw-r--r--drivers/media/radio/radio-cadet.c2
-rw-r--r--drivers/media/video/vpx3220.c32
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/pci/quirks.c4
-rw-r--r--drivers/pcmcia/soc_common.c14
-rw-r--r--drivers/scsi/Kconfig5
-rw-r--r--drivers/scsi/aacraid/linit.c2
-rw-r--r--drivers/scsi/qlogicpti.c39
-rw-r--r--drivers/serial/8250_pnp.c2
-rw-r--r--drivers/serial/sh-sci.c2
-rw-r--r--drivers/usb/host/isp116x-hcd.c3
-rw-r--r--drivers/usb/input/hid-core.c3
-rw-r--r--drivers/usb/serial/generic.c2
-rw-r--r--drivers/video/console/vgacon.c9
-rw-r--r--drivers/video/sa1100fb.c2
-rw-r--r--drivers/w1/w1.c3
-rw-r--r--fs/aio.c26
-rw-r--r--fs/nfs/delegation.c4
-rw-r--r--fs/nfs/file.c3
-rw-r--r--fs/nfs/inode.c9
-rw-r--r--fs/proc/base.c12
-rw-r--r--fs/proc/nommu.c1
-rw-r--r--include/asm-arm/arch-pxa/pxafb.h1
-rw-r--r--include/asm-arm/arch-s3c2410/io.h58
-rw-r--r--include/asm-sparc64/pbm.h30
-rw-r--r--include/linux/acct.h4
-rw-r--r--include/linux/aio.h7
-rw-r--r--include/linux/cpumask.h16
-rw-r--r--include/linux/list.h39
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--kernel/posix-cpu-timers.c3
-rw-r--r--kernel/rcupdate.c13
-rw-r--r--kernel/time.c1
-rw-r--r--mm/vmscan.c13
-rw-r--r--net/ipv6/netfilter/ip6_tables.c1
59 files changed, 494 insertions, 560 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index abf7f7a17ae0..767fb610963e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1618,6 +1618,13 @@ M: vandrove@vc.cvut.cz
1618L: linux-fbdev-devel@lists.sourceforge.net 1618L: linux-fbdev-devel@lists.sourceforge.net
1619S: Maintained 1619S: Maintained
1620 1620
1621MEGARAID SCSI DRIVERS
1622P: Neela Syam Kolli
1623M: Neela.Kolli@engenio.com
1624S: linux-scsi@vger.kernel.org
1625W: http://megaraid.lsilogic.com
1626S: Maintained
1627
1621MEMORY TECHNOLOGY DEVICES 1628MEMORY TECHNOLOGY DEVICES
1622P: David Woodhouse 1629P: David Woodhouse
1623M: dwmw2@infradead.org 1630M: dwmw2@infradead.org
diff --git a/Makefile b/Makefile
index 504ba3ceb296..be33d758c0fe 100644
--- a/Makefile
+++ b/Makefile
@@ -660,8 +660,10 @@ quiet_cmd_sysmap = SYSMAP
660# Link of vmlinux 660# Link of vmlinux
661# If CONFIG_KALLSYMS is set .version is already updated 661# If CONFIG_KALLSYMS is set .version is already updated
662# Generate System.map and verify that the content is consistent 662# Generate System.map and verify that the content is consistent
663 663# Use + in front of the vmlinux_version rule to silent warning with make -j2
664# First command is ':' to allow us to use + in front of the rule
664define rule_vmlinux__ 665define rule_vmlinux__
666 :
665 $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version)) 667 $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version))
666 668
667 $(call cmd,vmlinux__) 669 $(call cmd,vmlinux__)
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 08e58ecd44be..0d5db5279c5c 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -89,13 +89,6 @@ SECTIONS
89 *(.got) /* Global offset table */ 89 *(.got) /* Global offset table */
90 } 90 }
91 91
92 . = ALIGN(16);
93 __ex_table : { /* Exception table */
94 __start___ex_table = .;
95 *(__ex_table)
96 __stop___ex_table = .;
97 }
98
99 RODATA 92 RODATA
100 93
101 _etext = .; /* End of text and rodata section */ 94 _etext = .; /* End of text and rodata section */
@@ -138,6 +131,14 @@ SECTIONS
138 *(.data.cacheline_aligned) 131 *(.data.cacheline_aligned)
139 132
140 /* 133 /*
134 * The exception fixup table (might need resorting at runtime)
135 */
136 . = ALIGN(32);
137 __start___ex_table = .;
138 *(__ex_table)
139 __stop___ex_table = .;
140
141 /*
141 * and the usual data section 142 * and the usual data section
142 */ 143 */
143 *(.data) 144 *(.data)
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c
index 5fd8c9f97f9a..03ed742ae2be 100644
--- a/arch/arm/mach-l7200/core.c
+++ b/arch/arm/mach-l7200/core.c
@@ -7,11 +7,17 @@
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/device.h>
10 11
12#include <asm/types.h>
13#include <asm/irq.h>
14#include <asm/mach-types.h>
11#include <asm/hardware.h> 15#include <asm/hardware.h>
12#include <asm/page.h> 16#include <asm/page.h>
13 17
18#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <asm/mach/irq.h>
15 21
16/* 22/*
17 * IRQ base register 23 * IRQ base register
@@ -47,6 +53,12 @@ static void l7200_unmask_irq(unsigned int irq)
47{ 53{
48 IRQ_ENABLE = 1 << irq; 54 IRQ_ENABLE = 1 << irq;
49} 55}
56
57static struct irqchip l7200_irq_chip = {
58 .ack = l7200_mask_irq,
59 .mask = l7200_mask_irq,
60 .unmask = l7200_unmask_irq
61};
50 62
51static void __init l7200_init_irq(void) 63static void __init l7200_init_irq(void)
52{ 64{
@@ -56,11 +68,9 @@ static void __init l7200_init_irq(void)
56 FIQ_ENABLECLEAR = 0xffffffff; /* clear all fast interrupt enables */ 68 FIQ_ENABLECLEAR = 0xffffffff; /* clear all fast interrupt enables */
57 69
58 for (irq = 0; irq < NR_IRQS; irq++) { 70 for (irq = 0; irq < NR_IRQS; irq++) {
59 irq_desc[irq].valid = 1; 71 set_irq_chip(irq, &l7200_irq_chip);
60 irq_desc[irq].probe_ok = 1; 72 set_irq_flags(irq, IRQF_VALID);
61 irq_desc[irq].mask_ack = l7200_mask_irq; 73 set_irq_handler(irq, do_level_IRQ);
62 irq_desc[irq].mask = l7200_mask_irq;
63 irq_desc[irq].unmask = l7200_unmask_irq;
64 } 74 }
65 75
66 init_FIQ(); 76 init_FIQ();
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
index c02ef7c0f7ef..850538fadece 100644
--- a/arch/arm/mach-pxa/corgi_lcd.c
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -467,6 +467,7 @@ void corgi_put_hsync(void)
467{ 467{
468 if (get_hsync_time) 468 if (get_hsync_time)
469 symbol_put(w100fb_get_hsynclen); 469 symbol_put(w100fb_get_hsynclen);
470 get_hsync_time = NULL;
470} 471}
471 472
472void corgi_wait_hsync(void) 473void corgi_wait_hsync(void)
@@ -476,20 +477,37 @@ void corgi_wait_hsync(void)
476#endif 477#endif
477 478
478#ifdef CONFIG_PXA_SHARP_Cxx00 479#ifdef CONFIG_PXA_SHARP_Cxx00
480static struct device *spitz_pxafb_dev;
481
482static int is_pxafb_device(struct device * dev, void * data)
483{
484 struct platform_device *pdev = container_of(dev, struct platform_device, dev);
485
486 return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0);
487}
488
479unsigned long spitz_get_hsync_len(void) 489unsigned long spitz_get_hsync_len(void)
480{ 490{
491 if (!spitz_pxafb_dev) {
492 spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
493 if (!spitz_pxafb_dev)
494 return 0;
495 }
481 if (!get_hsync_time) 496 if (!get_hsync_time)
482 get_hsync_time = symbol_get(pxafb_get_hsync_time); 497 get_hsync_time = symbol_get(pxafb_get_hsync_time);
483 if (!get_hsync_time) 498 if (!get_hsync_time)
484 return 0; 499 return 0;
485 500
486 return pxafb_get_hsync_time(&pxafb_device.dev); 501 return pxafb_get_hsync_time(spitz_pxafb_dev);
487} 502}
488 503
489void spitz_put_hsync(void) 504void spitz_put_hsync(void)
490{ 505{
506 put_device(spitz_pxafb_dev);
491 if (get_hsync_time) 507 if (get_hsync_time)
492 symbol_put(pxafb_get_hsync_time); 508 symbol_put(pxafb_get_hsync_time);
509 spitz_pxafb_dev = NULL;
510 get_hsync_time = NULL;
493} 511}
494 512
495void spitz_wait_hsync(void) 513void spitz_wait_hsync(void)
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index d0660a8c4b70..d327c127eddb 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -208,6 +208,11 @@ static struct platform_device pxafb_device = {
208 .resource = pxafb_resources, 208 .resource = pxafb_resources,
209}; 209};
210 210
211void __init set_pxa_fb_parent(struct device *parent_dev)
212{
213 pxafb_device.dev.parent = parent_dev;
214}
215
211static struct platform_device ffuart_device = { 216static struct platform_device ffuart_device = {
212 .name = "pxa2xx-uart", 217 .name = "pxa2xx-uart",
213 .id = 0, 218 .id = 0,
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 568afe3d6e1a..d0ab428c2d7d 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -36,7 +36,6 @@
36#include <asm/arch/irq.h> 36#include <asm/arch/irq.h>
37#include <asm/arch/mmc.h> 37#include <asm/arch/mmc.h>
38#include <asm/arch/udc.h> 38#include <asm/arch/udc.h>
39#include <asm/arch/ohci.h>
40#include <asm/arch/pxafb.h> 39#include <asm/arch/pxafb.h>
41#include <asm/arch/akita.h> 40#include <asm/arch/akita.h>
42#include <asm/arch/spitz.h> 41#include <asm/arch/spitz.h>
@@ -304,7 +303,6 @@ static struct platform_device *devices[] __initdata = {
304 &spitzkbd_device, 303 &spitzkbd_device,
305 &spitzts_device, 304 &spitzts_device,
306 &spitzbl_device, 305 &spitzbl_device,
307 &spitzbattery_device,
308}; 306};
309 307
310static void __init common_init(void) 308static void __init common_init(void)
@@ -328,7 +326,7 @@ static void __init common_init(void)
328 326
329 platform_add_devices(devices, ARRAY_SIZE(devices)); 327 platform_add_devices(devices, ARRAY_SIZE(devices));
330 pxa_set_mci_info(&spitz_mci_platform_data); 328 pxa_set_mci_info(&spitz_mci_platform_data);
331 pxafb_device.dev.parent = &spitzssp_device.dev; 329 set_pxa_fb_parent(&spitzssp_device.dev);
332 set_pxa_fb_info(&spitz_pxafb_info); 330 set_pxa_fb_info(&spitz_pxafb_info);
333} 331}
334 332
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 06807c6ee68a..c796bcdd6158 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -12,6 +12,7 @@ config MACH_ANUBIS
12config ARCH_BAST 12config ARCH_BAST
13 bool "Simtec Electronics BAST (EB2410ITX)" 13 bool "Simtec Electronics BAST (EB2410ITX)"
14 select CPU_S3C2410 14 select CPU_S3C2410
15 select ISA
15 help 16 help
16 Say Y here if you are using the Simtec Electronics EB2410ITX 17 Say Y here if you are using the Simtec Electronics EB2410ITX
17 development board (also known as BAST) 18 development board (also known as BAST)
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index a4576ac7e870..8b1f6eb76870 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -275,12 +275,14 @@ static void flush_tlb_all_ipi(void *info)
275 *==========================================================================*/ 275 *==========================================================================*/
276void smp_flush_tlb_mm(struct mm_struct *mm) 276void smp_flush_tlb_mm(struct mm_struct *mm)
277{ 277{
278 int cpu_id = smp_processor_id(); 278 int cpu_id;
279 cpumask_t cpu_mask; 279 cpumask_t cpu_mask;
280 unsigned long *mmc = &mm->context[cpu_id]; 280 unsigned long *mmc;
281 unsigned long flags; 281 unsigned long flags;
282 282
283 preempt_disable(); 283 preempt_disable();
284 cpu_id = smp_processor_id();
285 mmc = &mm->context[cpu_id];
284 cpu_mask = mm->cpu_vm_mask; 286 cpu_mask = mm->cpu_vm_mask;
285 cpu_clear(cpu_id, cpu_mask); 287 cpu_clear(cpu_id, cpu_mask);
286 288
@@ -343,12 +345,14 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
343void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) 345void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
344{ 346{
345 struct mm_struct *mm = vma->vm_mm; 347 struct mm_struct *mm = vma->vm_mm;
346 int cpu_id = smp_processor_id(); 348 int cpu_id;
347 cpumask_t cpu_mask; 349 cpumask_t cpu_mask;
348 unsigned long *mmc = &mm->context[cpu_id]; 350 unsigned long *mmc;
349 unsigned long flags; 351 unsigned long flags;
350 352
351 preempt_disable(); 353 preempt_disable();
354 cpu_id = smp_processor_id();
355 mmc = &mm->context[cpu_id];
352 cpu_mask = mm->cpu_vm_mask; 356 cpu_mask = mm->cpu_vm_mask;
353 cpu_clear(cpu_id, cpu_mask); 357 cpu_clear(cpu_id, cpu_mask);
354 358
diff --git a/arch/mips/pci/fixup-tb0226.c b/arch/mips/pci/fixup-tb0226.c
index 61513d5d97da..b5d42b12de10 100644
--- a/arch/mips/pci/fixup-tb0226.c
+++ b/arch/mips/pci/fixup-tb0226.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fixup-tb0226.c, The TANBAC TB0226 specific PCI fixups. 2 * fixup-tb0226.c, The TANBAC TB0226 specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22 22
23#include <asm/vr41xx/giu.h>
23#include <asm/vr41xx/tb0226.h> 24#include <asm/vr41xx/tb0226.h>
24 25
25int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 26int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
@@ -29,42 +30,42 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
29 switch (slot) { 30 switch (slot) {
30 case 12: 31 case 12:
31 vr41xx_set_irq_trigger(GD82559_1_PIN, 32 vr41xx_set_irq_trigger(GD82559_1_PIN,
32 TRIGGER_LEVEL, 33 IRQ_TRIGGER_LEVEL,
33 SIGNAL_THROUGH); 34 IRQ_SIGNAL_THROUGH);
34 vr41xx_set_irq_level(GD82559_1_PIN, LEVEL_LOW); 35 vr41xx_set_irq_level(GD82559_1_PIN, IRQ_LEVEL_LOW);
35 irq = GD82559_1_IRQ; 36 irq = GD82559_1_IRQ;
36 break; 37 break;
37 case 13: 38 case 13:
38 vr41xx_set_irq_trigger(GD82559_2_PIN, 39 vr41xx_set_irq_trigger(GD82559_2_PIN,
39 TRIGGER_LEVEL, 40 IRQ_TRIGGER_LEVEL,
40 SIGNAL_THROUGH); 41 IRQ_SIGNAL_THROUGH);
41 vr41xx_set_irq_level(GD82559_2_PIN, LEVEL_LOW); 42 vr41xx_set_irq_level(GD82559_2_PIN, IRQ_LEVEL_LOW);
42 irq = GD82559_2_IRQ; 43 irq = GD82559_2_IRQ;
43 break; 44 break;
44 case 14: 45 case 14:
45 switch (pin) { 46 switch (pin) {
46 case 1: 47 case 1:
47 vr41xx_set_irq_trigger(UPD720100_INTA_PIN, 48 vr41xx_set_irq_trigger(UPD720100_INTA_PIN,
48 TRIGGER_LEVEL, 49 IRQ_TRIGGER_LEVEL,
49 SIGNAL_THROUGH); 50 IRQ_SIGNAL_THROUGH);
50 vr41xx_set_irq_level(UPD720100_INTA_PIN, 51 vr41xx_set_irq_level(UPD720100_INTA_PIN,
51 LEVEL_LOW); 52 IRQ_LEVEL_LOW);
52 irq = UPD720100_INTA_IRQ; 53 irq = UPD720100_INTA_IRQ;
53 break; 54 break;
54 case 2: 55 case 2:
55 vr41xx_set_irq_trigger(UPD720100_INTB_PIN, 56 vr41xx_set_irq_trigger(UPD720100_INTB_PIN,
56 TRIGGER_LEVEL, 57 IRQ_TRIGGER_LEVEL,
57 SIGNAL_THROUGH); 58 IRQ_SIGNAL_THROUGH);
58 vr41xx_set_irq_level(UPD720100_INTB_PIN, 59 vr41xx_set_irq_level(UPD720100_INTB_PIN,
59 LEVEL_LOW); 60 IRQ_LEVEL_LOW);
60 irq = UPD720100_INTB_IRQ; 61 irq = UPD720100_INTB_IRQ;
61 break; 62 break;
62 case 3: 63 case 3:
63 vr41xx_set_irq_trigger(UPD720100_INTC_PIN, 64 vr41xx_set_irq_trigger(UPD720100_INTC_PIN,
64 TRIGGER_LEVEL, 65 IRQ_TRIGGER_LEVEL,
65 SIGNAL_THROUGH); 66 IRQ_SIGNAL_THROUGH);
66 vr41xx_set_irq_level(UPD720100_INTC_PIN, 67 vr41xx_set_irq_level(UPD720100_INTC_PIN,
67 LEVEL_LOW); 68 IRQ_LEVEL_LOW);
68 irq = UPD720100_INTC_IRQ; 69 irq = UPD720100_INTC_IRQ;
69 break; 70 break;
70 default: 71 default:
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 25755252067a..fa8121d53b89 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -115,7 +115,7 @@ static void __pmac pmac_show_cpuinfo(struct seq_file *m)
115 115
116 /* find motherboard type */ 116 /* find motherboard type */
117 seq_printf(m, "machine\t\t: "); 117 seq_printf(m, "machine\t\t: ");
118 np = find_devices("device-tree"); 118 np = of_find_node_by_path("/");
119 if (np != NULL) { 119 if (np != NULL) {
120 pp = (char *) get_property(np, "model", NULL); 120 pp = (char *) get_property(np, "model", NULL);
121 if (pp != NULL) 121 if (pp != NULL)
@@ -133,6 +133,7 @@ static void __pmac pmac_show_cpuinfo(struct seq_file *m)
133 } 133 }
134 seq_printf(m, "\n"); 134 seq_printf(m, "\n");
135 } 135 }
136 of_node_put(np);
136 } else 137 } else
137 seq_printf(m, "PowerMac\n"); 138 seq_printf(m, "PowerMac\n");
138 139
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c
index 425c60cfea19..a11910be1013 100644
--- a/arch/sparc64/kernel/pci_iommu.c
+++ b/arch/sparc64/kernel/pci_iommu.c
@@ -49,12 +49,6 @@ static void __iommu_flushall(struct pci_iommu *iommu)
49 49
50 /* Ensure completion of previous PIO writes. */ 50 /* Ensure completion of previous PIO writes. */
51 (void) pci_iommu_read(iommu->write_complete_reg); 51 (void) pci_iommu_read(iommu->write_complete_reg);
52
53 /* Now update everyone's flush point. */
54 for (entry = 0; entry < PBM_NCLUSTERS; entry++) {
55 iommu->alloc_info[entry].flush =
56 iommu->alloc_info[entry].next;
57 }
58} 52}
59 53
60#define IOPTE_CONSISTENT(CTX) \ 54#define IOPTE_CONSISTENT(CTX) \
@@ -80,120 +74,117 @@ static void inline iopte_make_dummy(struct pci_iommu *iommu, iopte_t *iopte)
80 iopte_val(*iopte) = val; 74 iopte_val(*iopte) = val;
81} 75}
82 76
83void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize) 77/* Based largely upon the ppc64 iommu allocator. */
78static long pci_arena_alloc(struct pci_iommu *iommu, unsigned long npages)
84{ 79{
85 int i; 80 struct pci_iommu_arena *arena = &iommu->arena;
86 81 unsigned long n, i, start, end, limit;
87 tsbsize /= sizeof(iopte_t); 82 int pass;
88 83
89 for (i = 0; i < tsbsize; i++) 84 limit = arena->limit;
90 iopte_make_dummy(iommu, &iommu->page_table[i]); 85 start = arena->hint;
91} 86 pass = 0;
92 87
93static iopte_t *alloc_streaming_cluster(struct pci_iommu *iommu, unsigned long npages) 88again:
94{ 89 n = find_next_zero_bit(arena->map, limit, start);
95 iopte_t *iopte, *limit, *first; 90 end = n + npages;
96 unsigned long cnum, ent, flush_point; 91 if (unlikely(end >= limit)) {
97 92 if (likely(pass < 1)) {
98 cnum = 0; 93 limit = start;
99 while ((1UL << cnum) < npages) 94 start = 0;
100 cnum++; 95 __iommu_flushall(iommu);
101 iopte = (iommu->page_table + 96 pass++;
102 (cnum << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS))); 97 goto again;
103 98 } else {
104 if (cnum == 0) 99 /* Scanned the whole thing, give up. */
105 limit = (iommu->page_table + 100 return -1;
106 iommu->lowest_consistent_map);
107 else
108 limit = (iopte +
109 (1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS)));
110
111 iopte += ((ent = iommu->alloc_info[cnum].next) << cnum);
112 flush_point = iommu->alloc_info[cnum].flush;
113
114 first = iopte;
115 for (;;) {
116 if (IOPTE_IS_DUMMY(iommu, iopte)) {
117 if ((iopte + (1 << cnum)) >= limit)
118 ent = 0;
119 else
120 ent = ent + 1;
121 iommu->alloc_info[cnum].next = ent;
122 if (ent == flush_point)
123 __iommu_flushall(iommu);
124 break;
125 } 101 }
126 iopte += (1 << cnum); 102 }
127 ent++; 103
128 if (iopte >= limit) { 104 for (i = n; i < end; i++) {
129 iopte = (iommu->page_table + 105 if (test_bit(i, arena->map)) {
130 (cnum << 106 start = i + 1;
131 (iommu->page_table_sz_bits - PBM_LOGCLUSTERS))); 107 goto again;
132 ent = 0;
133 } 108 }
134 if (ent == flush_point)
135 __iommu_flushall(iommu);
136 if (iopte == first)
137 goto bad;
138 } 109 }
139 110
140 /* I've got your streaming cluster right here buddy boy... */ 111 for (i = n; i < end; i++)
141 return iopte; 112 __set_bit(i, arena->map);
142 113
143bad: 114 arena->hint = end;
144 printk(KERN_EMERG "pci_iommu: alloc_streaming_cluster of npages(%ld) failed!\n", 115
145 npages); 116 return n;
146 return NULL;
147} 117}
148 118
149static void free_streaming_cluster(struct pci_iommu *iommu, dma_addr_t base, 119static void pci_arena_free(struct pci_iommu_arena *arena, unsigned long base, unsigned long npages)
150 unsigned long npages, unsigned long ctx)
151{ 120{
152 unsigned long cnum, ent; 121 unsigned long i;
153 122
154 cnum = 0; 123 for (i = base; i < (base + npages); i++)
155 while ((1UL << cnum) < npages) 124 __clear_bit(i, arena->map);
156 cnum++; 125}
157 126
158 ent = (base << (32 - IO_PAGE_SHIFT + PBM_LOGCLUSTERS - iommu->page_table_sz_bits)) 127void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask)
159 >> (32 + PBM_LOGCLUSTERS + cnum - iommu->page_table_sz_bits); 128{
129 unsigned long i, tsbbase, order, sz, num_tsb_entries;
130
131 num_tsb_entries = tsbsize / sizeof(iopte_t);
132
133 /* Setup initial software IOMMU state. */
134 spin_lock_init(&iommu->lock);
135 iommu->ctx_lowest_free = 1;
136 iommu->page_table_map_base = dma_offset;
137 iommu->dma_addr_mask = dma_addr_mask;
138
139 /* Allocate and initialize the free area map. */
140 sz = num_tsb_entries / 8;
141 sz = (sz + 7UL) & ~7UL;
142 iommu->arena.map = kmalloc(sz, GFP_KERNEL);
143 if (!iommu->arena.map) {
144 prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
145 prom_halt();
146 }
147 memset(iommu->arena.map, 0, sz);
148 iommu->arena.limit = num_tsb_entries;
160 149
161 /* If the global flush might not have caught this entry, 150 /* Allocate and initialize the dummy page which we
162 * adjust the flush point such that we will flush before 151 * set inactive IO PTEs to point to.
163 * ever trying to reuse it.
164 */ 152 */
165#define between(X,Y,Z) (((Z) - (Y)) >= ((X) - (Y))) 153 iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0);
166 if (between(ent, iommu->alloc_info[cnum].next, iommu->alloc_info[cnum].flush)) 154 if (!iommu->dummy_page) {
167 iommu->alloc_info[cnum].flush = ent; 155 prom_printf("PCI_IOMMU: Error, gfp(dummy_page) failed.\n");
168#undef between 156 prom_halt();
157 }
158 memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
159 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
160
161 /* Now allocate and setup the IOMMU page table itself. */
162 order = get_order(tsbsize);
163 tsbbase = __get_free_pages(GFP_KERNEL, order);
164 if (!tsbbase) {
165 prom_printf("PCI_IOMMU: Error, gfp(tsb) failed.\n");
166 prom_halt();
167 }
168 iommu->page_table = (iopte_t *)tsbbase;
169
170 for (i = 0; i < num_tsb_entries; i++)
171 iopte_make_dummy(iommu, &iommu->page_table[i]);
169} 172}
170 173
171/* We allocate consistent mappings from the end of cluster zero. */ 174static inline iopte_t *alloc_npages(struct pci_iommu *iommu, unsigned long npages)
172static iopte_t *alloc_consistent_cluster(struct pci_iommu *iommu, unsigned long npages)
173{ 175{
174 iopte_t *iopte; 176 long entry;
175 177
176 iopte = iommu->page_table + (1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS)); 178 entry = pci_arena_alloc(iommu, npages);
177 while (iopte > iommu->page_table) { 179 if (unlikely(entry < 0))
178 iopte--; 180 return NULL;
179 if (IOPTE_IS_DUMMY(iommu, iopte)) {
180 unsigned long tmp = npages;
181 181
182 while (--tmp) { 182 return iommu->page_table + entry;
183 iopte--; 183}
184 if (!IOPTE_IS_DUMMY(iommu, iopte))
185 break;
186 }
187 if (tmp == 0) {
188 u32 entry = (iopte - iommu->page_table);
189 184
190 if (entry < iommu->lowest_consistent_map) 185static inline void free_npages(struct pci_iommu *iommu, dma_addr_t base, unsigned long npages)
191 iommu->lowest_consistent_map = entry; 186{
192 return iopte; 187 pci_arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages);
193 }
194 }
195 }
196 return NULL;
197} 188}
198 189
199static int iommu_alloc_ctx(struct pci_iommu *iommu) 190static int iommu_alloc_ctx(struct pci_iommu *iommu)
@@ -233,7 +224,7 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad
233 struct pcidev_cookie *pcp; 224 struct pcidev_cookie *pcp;
234 struct pci_iommu *iommu; 225 struct pci_iommu *iommu;
235 iopte_t *iopte; 226 iopte_t *iopte;
236 unsigned long flags, order, first_page, ctx; 227 unsigned long flags, order, first_page;
237 void *ret; 228 void *ret;
238 int npages; 229 int npages;
239 230
@@ -251,9 +242,10 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad
251 iommu = pcp->pbm->iommu; 242 iommu = pcp->pbm->iommu;
252 243
253 spin_lock_irqsave(&iommu->lock, flags); 244 spin_lock_irqsave(&iommu->lock, flags);
254 iopte = alloc_consistent_cluster(iommu, size >> IO_PAGE_SHIFT); 245 iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT);
255 if (iopte == NULL) { 246 spin_unlock_irqrestore(&iommu->lock, flags);
256 spin_unlock_irqrestore(&iommu->lock, flags); 247
248 if (unlikely(iopte == NULL)) {
257 free_pages(first_page, order); 249 free_pages(first_page, order);
258 return NULL; 250 return NULL;
259 } 251 }
@@ -262,31 +254,15 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad
262 ((iopte - iommu->page_table) << IO_PAGE_SHIFT)); 254 ((iopte - iommu->page_table) << IO_PAGE_SHIFT));
263 ret = (void *) first_page; 255 ret = (void *) first_page;
264 npages = size >> IO_PAGE_SHIFT; 256 npages = size >> IO_PAGE_SHIFT;
265 ctx = 0;
266 if (iommu->iommu_ctxflush)
267 ctx = iommu_alloc_ctx(iommu);
268 first_page = __pa(first_page); 257 first_page = __pa(first_page);
269 while (npages--) { 258 while (npages--) {
270 iopte_val(*iopte) = (IOPTE_CONSISTENT(ctx) | 259 iopte_val(*iopte) = (IOPTE_CONSISTENT(0UL) |
271 IOPTE_WRITE | 260 IOPTE_WRITE |
272 (first_page & IOPTE_PAGE)); 261 (first_page & IOPTE_PAGE));
273 iopte++; 262 iopte++;
274 first_page += IO_PAGE_SIZE; 263 first_page += IO_PAGE_SIZE;
275 } 264 }
276 265
277 {
278 int i;
279 u32 daddr = *dma_addrp;
280
281 npages = size >> IO_PAGE_SHIFT;
282 for (i = 0; i < npages; i++) {
283 pci_iommu_write(iommu->iommu_flush, daddr);
284 daddr += IO_PAGE_SIZE;
285 }
286 }
287
288 spin_unlock_irqrestore(&iommu->lock, flags);
289
290 return ret; 266 return ret;
291} 267}
292 268
@@ -296,7 +272,7 @@ void pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_
296 struct pcidev_cookie *pcp; 272 struct pcidev_cookie *pcp;
297 struct pci_iommu *iommu; 273 struct pci_iommu *iommu;
298 iopte_t *iopte; 274 iopte_t *iopte;
299 unsigned long flags, order, npages, i, ctx; 275 unsigned long flags, order, npages;
300 276
301 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT; 277 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
302 pcp = pdev->sysdata; 278 pcp = pdev->sysdata;
@@ -306,46 +282,7 @@ void pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_
306 282
307 spin_lock_irqsave(&iommu->lock, flags); 283 spin_lock_irqsave(&iommu->lock, flags);
308 284
309 if ((iopte - iommu->page_table) == 285 free_npages(iommu, dvma, npages);
310 iommu->lowest_consistent_map) {
311 iopte_t *walk = iopte + npages;
312 iopte_t *limit;
313
314 limit = (iommu->page_table +
315 (1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS)));
316 while (walk < limit) {
317 if (!IOPTE_IS_DUMMY(iommu, walk))
318 break;
319 walk++;
320 }
321 iommu->lowest_consistent_map =
322 (walk - iommu->page_table);
323 }
324
325 /* Data for consistent mappings cannot enter the streaming
326 * buffers, so we only need to update the TSB. We flush
327 * the IOMMU here as well to prevent conflicts with the
328 * streaming mapping deferred tlb flush scheme.
329 */
330
331 ctx = 0;
332 if (iommu->iommu_ctxflush)
333 ctx = (iopte_val(*iopte) & IOPTE_CONTEXT) >> 47UL;
334
335 for (i = 0; i < npages; i++, iopte++)
336 iopte_make_dummy(iommu, iopte);
337
338 if (iommu->iommu_ctxflush) {
339 pci_iommu_write(iommu->iommu_ctxflush, ctx);
340 } else {
341 for (i = 0; i < npages; i++) {
342 u32 daddr = dvma + (i << IO_PAGE_SHIFT);
343
344 pci_iommu_write(iommu->iommu_flush, daddr);
345 }
346 }
347
348 iommu_free_ctx(iommu, ctx);
349 286
350 spin_unlock_irqrestore(&iommu->lock, flags); 287 spin_unlock_irqrestore(&iommu->lock, flags);
351 288
@@ -372,25 +309,27 @@ dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direct
372 iommu = pcp->pbm->iommu; 309 iommu = pcp->pbm->iommu;
373 strbuf = &pcp->pbm->stc; 310 strbuf = &pcp->pbm->stc;
374 311
375 if (direction == PCI_DMA_NONE) 312 if (unlikely(direction == PCI_DMA_NONE))
376 BUG(); 313 goto bad_no_ctx;
377 314
378 oaddr = (unsigned long)ptr; 315 oaddr = (unsigned long)ptr;
379 npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK); 316 npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK);
380 npages >>= IO_PAGE_SHIFT; 317 npages >>= IO_PAGE_SHIFT;
381 318
382 spin_lock_irqsave(&iommu->lock, flags); 319 spin_lock_irqsave(&iommu->lock, flags);
320 base = alloc_npages(iommu, npages);
321 ctx = 0;
322 if (iommu->iommu_ctxflush)
323 ctx = iommu_alloc_ctx(iommu);
324 spin_unlock_irqrestore(&iommu->lock, flags);
383 325
384 base = alloc_streaming_cluster(iommu, npages); 326 if (unlikely(!base))
385 if (base == NULL)
386 goto bad; 327 goto bad;
328
387 bus_addr = (iommu->page_table_map_base + 329 bus_addr = (iommu->page_table_map_base +
388 ((base - iommu->page_table) << IO_PAGE_SHIFT)); 330 ((base - iommu->page_table) << IO_PAGE_SHIFT));
389 ret = bus_addr | (oaddr & ~IO_PAGE_MASK); 331 ret = bus_addr | (oaddr & ~IO_PAGE_MASK);
390 base_paddr = __pa(oaddr & IO_PAGE_MASK); 332 base_paddr = __pa(oaddr & IO_PAGE_MASK);
391 ctx = 0;
392 if (iommu->iommu_ctxflush)
393 ctx = iommu_alloc_ctx(iommu);
394 if (strbuf->strbuf_enabled) 333 if (strbuf->strbuf_enabled)
395 iopte_protection = IOPTE_STREAMING(ctx); 334 iopte_protection = IOPTE_STREAMING(ctx);
396 else 335 else
@@ -401,12 +340,13 @@ dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direct
401 for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE) 340 for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE)
402 iopte_val(*base) = iopte_protection | base_paddr; 341 iopte_val(*base) = iopte_protection | base_paddr;
403 342
404 spin_unlock_irqrestore(&iommu->lock, flags);
405
406 return ret; 343 return ret;
407 344
408bad: 345bad:
409 spin_unlock_irqrestore(&iommu->lock, flags); 346 iommu_free_ctx(iommu, ctx);
347bad_no_ctx:
348 if (printk_ratelimit())
349 WARN_ON(1);
410 return PCI_DMA_ERROR_CODE; 350 return PCI_DMA_ERROR_CODE;
411} 351}
412 352
@@ -481,10 +421,13 @@ void pci_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int
481 struct pci_iommu *iommu; 421 struct pci_iommu *iommu;
482 struct pci_strbuf *strbuf; 422 struct pci_strbuf *strbuf;
483 iopte_t *base; 423 iopte_t *base;
484 unsigned long flags, npages, ctx; 424 unsigned long flags, npages, ctx, i;
485 425
486 if (direction == PCI_DMA_NONE) 426 if (unlikely(direction == PCI_DMA_NONE)) {
487 BUG(); 427 if (printk_ratelimit())
428 WARN_ON(1);
429 return;
430 }
488 431
489 pcp = pdev->sysdata; 432 pcp = pdev->sysdata;
490 iommu = pcp->pbm->iommu; 433 iommu = pcp->pbm->iommu;
@@ -510,13 +453,14 @@ void pci_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int
510 453
511 /* Step 1: Kick data out of streaming buffers if necessary. */ 454 /* Step 1: Kick data out of streaming buffers if necessary. */
512 if (strbuf->strbuf_enabled) 455 if (strbuf->strbuf_enabled)
513 pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); 456 pci_strbuf_flush(strbuf, iommu, bus_addr, ctx,
457 npages, direction);
514 458
515 /* Step 2: Clear out first TSB entry. */ 459 /* Step 2: Clear out TSB entries. */
516 iopte_make_dummy(iommu, base); 460 for (i = 0; i < npages; i++)
461 iopte_make_dummy(iommu, base + i);
517 462
518 free_streaming_cluster(iommu, bus_addr - iommu->page_table_map_base, 463 free_npages(iommu, bus_addr - iommu->page_table_map_base, npages);
519 npages, ctx);
520 464
521 iommu_free_ctx(iommu, ctx); 465 iommu_free_ctx(iommu, ctx);
522 466
@@ -621,6 +565,8 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int
621 pci_map_single(pdev, 565 pci_map_single(pdev,
622 (page_address(sglist->page) + sglist->offset), 566 (page_address(sglist->page) + sglist->offset),
623 sglist->length, direction); 567 sglist->length, direction);
568 if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE))
569 return 0;
624 sglist->dma_length = sglist->length; 570 sglist->dma_length = sglist->length;
625 return 1; 571 return 1;
626 } 572 }
@@ -629,21 +575,29 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int
629 iommu = pcp->pbm->iommu; 575 iommu = pcp->pbm->iommu;
630 strbuf = &pcp->pbm->stc; 576 strbuf = &pcp->pbm->stc;
631 577
632 if (direction == PCI_DMA_NONE) 578 if (unlikely(direction == PCI_DMA_NONE))
633 BUG(); 579 goto bad_no_ctx;
634 580
635 /* Step 1: Prepare scatter list. */ 581 /* Step 1: Prepare scatter list. */
636 582
637 npages = prepare_sg(sglist, nelems); 583 npages = prepare_sg(sglist, nelems);
638 584
639 /* Step 2: Allocate a cluster. */ 585 /* Step 2: Allocate a cluster and context, if necessary. */
640 586
641 spin_lock_irqsave(&iommu->lock, flags); 587 spin_lock_irqsave(&iommu->lock, flags);
642 588
643 base = alloc_streaming_cluster(iommu, npages); 589 base = alloc_npages(iommu, npages);
590 ctx = 0;
591 if (iommu->iommu_ctxflush)
592 ctx = iommu_alloc_ctx(iommu);
593
594 spin_unlock_irqrestore(&iommu->lock, flags);
595
644 if (base == NULL) 596 if (base == NULL)
645 goto bad; 597 goto bad;
646 dma_base = iommu->page_table_map_base + ((base - iommu->page_table) << IO_PAGE_SHIFT); 598
599 dma_base = iommu->page_table_map_base +
600 ((base - iommu->page_table) << IO_PAGE_SHIFT);
647 601
648 /* Step 3: Normalize DMA addresses. */ 602 /* Step 3: Normalize DMA addresses. */
649 used = nelems; 603 used = nelems;
@@ -656,30 +610,28 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int
656 } 610 }
657 used = nelems - used; 611 used = nelems - used;
658 612
659 /* Step 4: Choose a context if necessary. */ 613 /* Step 4: Create the mappings. */
660 ctx = 0;
661 if (iommu->iommu_ctxflush)
662 ctx = iommu_alloc_ctx(iommu);
663
664 /* Step 5: Create the mappings. */
665 if (strbuf->strbuf_enabled) 614 if (strbuf->strbuf_enabled)
666 iopte_protection = IOPTE_STREAMING(ctx); 615 iopte_protection = IOPTE_STREAMING(ctx);
667 else 616 else
668 iopte_protection = IOPTE_CONSISTENT(ctx); 617 iopte_protection = IOPTE_CONSISTENT(ctx);
669 if (direction != PCI_DMA_TODEVICE) 618 if (direction != PCI_DMA_TODEVICE)
670 iopte_protection |= IOPTE_WRITE; 619 iopte_protection |= IOPTE_WRITE;
671 fill_sg (base, sglist, used, nelems, iopte_protection); 620
621 fill_sg(base, sglist, used, nelems, iopte_protection);
622
672#ifdef VERIFY_SG 623#ifdef VERIFY_SG
673 verify_sglist(sglist, nelems, base, npages); 624 verify_sglist(sglist, nelems, base, npages);
674#endif 625#endif
675 626
676 spin_unlock_irqrestore(&iommu->lock, flags);
677
678 return used; 627 return used;
679 628
680bad: 629bad:
681 spin_unlock_irqrestore(&iommu->lock, flags); 630 iommu_free_ctx(iommu, ctx);
682 return PCI_DMA_ERROR_CODE; 631bad_no_ctx:
632 if (printk_ratelimit())
633 WARN_ON(1);
634 return 0;
683} 635}
684 636
685/* Unmap a set of streaming mode DMA translations. */ 637/* Unmap a set of streaming mode DMA translations. */
@@ -692,8 +644,10 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems,
692 unsigned long flags, ctx, i, npages; 644 unsigned long flags, ctx, i, npages;
693 u32 bus_addr; 645 u32 bus_addr;
694 646
695 if (direction == PCI_DMA_NONE) 647 if (unlikely(direction == PCI_DMA_NONE)) {
696 BUG(); 648 if (printk_ratelimit())
649 WARN_ON(1);
650 }
697 651
698 pcp = pdev->sysdata; 652 pcp = pdev->sysdata;
699 iommu = pcp->pbm->iommu; 653 iommu = pcp->pbm->iommu;
@@ -705,7 +659,8 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems,
705 if (sglist[i].dma_length == 0) 659 if (sglist[i].dma_length == 0)
706 break; 660 break;
707 i--; 661 i--;
708 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) - bus_addr) >> IO_PAGE_SHIFT; 662 npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) -
663 bus_addr) >> IO_PAGE_SHIFT;
709 664
710 base = iommu->page_table + 665 base = iommu->page_table +
711 ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); 666 ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
@@ -726,11 +681,11 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems,
726 if (strbuf->strbuf_enabled) 681 if (strbuf->strbuf_enabled)
727 pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); 682 pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
728 683
729 /* Step 2: Clear out first TSB entry. */ 684 /* Step 2: Clear out the TSB entries. */
730 iopte_make_dummy(iommu, base); 685 for (i = 0; i < npages; i++)
686 iopte_make_dummy(iommu, base + i);
731 687
732 free_streaming_cluster(iommu, bus_addr - iommu->page_table_map_base, 688 free_npages(iommu, bus_addr - iommu->page_table_map_base, npages);
733 npages, ctx);
734 689
735 iommu_free_ctx(iommu, ctx); 690 iommu_free_ctx(iommu, ctx);
736 691
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 6ed1ef25e0ac..c03ed5f49d31 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1207,13 +1207,9 @@ static void psycho_scan_bus(struct pci_controller_info *p)
1207static void psycho_iommu_init(struct pci_controller_info *p) 1207static void psycho_iommu_init(struct pci_controller_info *p)
1208{ 1208{
1209 struct pci_iommu *iommu = p->pbm_A.iommu; 1209 struct pci_iommu *iommu = p->pbm_A.iommu;
1210 unsigned long tsbbase, i; 1210 unsigned long i;
1211 u64 control; 1211 u64 control;
1212 1212
1213 /* Setup initial software IOMMU state. */
1214 spin_lock_init(&iommu->lock);
1215 iommu->ctx_lowest_free = 1;
1216
1217 /* Register addresses. */ 1213 /* Register addresses. */
1218 iommu->iommu_control = p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL; 1214 iommu->iommu_control = p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL;
1219 iommu->iommu_tsbbase = p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE; 1215 iommu->iommu_tsbbase = p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE;
@@ -1240,40 +1236,10 @@ static void psycho_iommu_init(struct pci_controller_info *p)
1240 /* Leave diag mode enabled for full-flushing done 1236 /* Leave diag mode enabled for full-flushing done
1241 * in pci_iommu.c 1237 * in pci_iommu.c
1242 */ 1238 */
1239 pci_iommu_table_init(iommu, IO_TSB_SIZE, 0xc0000000, 0xffffffff);
1243 1240
1244 iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); 1241 psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE,
1245 if (!iommu->dummy_page) { 1242 __pa(iommu->page_table));
1246 prom_printf("PSYCHO_IOMMU: Error, gfp(dummy_page) failed.\n");
1247 prom_halt();
1248 }
1249 memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
1250 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
1251
1252 /* Using assumed page size 8K with 128K entries we need 1MB iommu page
1253 * table (128K ioptes * 8 bytes per iopte). This is
1254 * page order 7 on UltraSparc.
1255 */
1256 tsbbase = __get_free_pages(GFP_KERNEL, get_order(IO_TSB_SIZE));
1257 if (!tsbbase) {
1258 prom_printf("PSYCHO_IOMMU: Error, gfp(tsb) failed.\n");
1259 prom_halt();
1260 }
1261 iommu->page_table = (iopte_t *)tsbbase;
1262 iommu->page_table_sz_bits = 17;
1263 iommu->page_table_map_base = 0xc0000000;
1264 iommu->dma_addr_mask = 0xffffffff;
1265 pci_iommu_table_init(iommu, IO_TSB_SIZE);
1266
1267 /* We start with no consistent mappings. */
1268 iommu->lowest_consistent_map =
1269 1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS);
1270
1271 for (i = 0; i < PBM_NCLUSTERS; i++) {
1272 iommu->alloc_info[i].flush = 0;
1273 iommu->alloc_info[i].next = 0;
1274 }
1275
1276 psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_TSBBASE, __pa(tsbbase));
1277 1243
1278 control = psycho_read(p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL); 1244 control = psycho_read(p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL);
1279 control &= ~(PSYCHO_IOMMU_CTRL_TSBSZ | PSYCHO_IOMMU_CTRL_TBWSZ); 1245 control &= ~(PSYCHO_IOMMU_CTRL_TSBSZ | PSYCHO_IOMMU_CTRL_TBWSZ);
@@ -1281,7 +1247,7 @@ static void psycho_iommu_init(struct pci_controller_info *p)
1281 psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL, control); 1247 psycho_write(p->pbm_A.controller_regs + PSYCHO_IOMMU_CONTROL, control);
1282 1248
1283 /* If necessary, hook us up for starfire IRQ translations. */ 1249 /* If necessary, hook us up for starfire IRQ translations. */
1284 if(this_is_starfire) 1250 if (this_is_starfire)
1285 p->starfire_cookie = starfire_hookup(p->pbm_A.portid); 1251 p->starfire_cookie = starfire_hookup(p->pbm_A.portid);
1286 else 1252 else
1287 p->starfire_cookie = NULL; 1253 p->starfire_cookie = NULL;
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 0ee6bd5b9ac6..da8e1364194f 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -1267,13 +1267,9 @@ static void sabre_iommu_init(struct pci_controller_info *p,
1267 u32 dma_mask) 1267 u32 dma_mask)
1268{ 1268{
1269 struct pci_iommu *iommu = p->pbm_A.iommu; 1269 struct pci_iommu *iommu = p->pbm_A.iommu;
1270 unsigned long tsbbase, i, order; 1270 unsigned long i;
1271 u64 control; 1271 u64 control;
1272 1272
1273 /* Setup initial software IOMMU state. */
1274 spin_lock_init(&iommu->lock);
1275 iommu->ctx_lowest_free = 1;
1276
1277 /* Register addresses. */ 1273 /* Register addresses. */
1278 iommu->iommu_control = p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL; 1274 iommu->iommu_control = p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL;
1279 iommu->iommu_tsbbase = p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE; 1275 iommu->iommu_tsbbase = p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE;
@@ -1295,26 +1291,10 @@ static void sabre_iommu_init(struct pci_controller_info *p,
1295 /* Leave diag mode enabled for full-flushing done 1291 /* Leave diag mode enabled for full-flushing done
1296 * in pci_iommu.c 1292 * in pci_iommu.c
1297 */ 1293 */
1294 pci_iommu_table_init(iommu, tsbsize * 1024 * 8, dvma_offset, dma_mask);
1298 1295
1299 iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); 1296 sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE,
1300 if (!iommu->dummy_page) { 1297 __pa(iommu->page_table));
1301 prom_printf("PSYCHO_IOMMU: Error, gfp(dummy_page) failed.\n");
1302 prom_halt();
1303 }
1304 memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
1305 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
1306
1307 tsbbase = __get_free_pages(GFP_KERNEL, order = get_order(tsbsize * 1024 * 8));
1308 if (!tsbbase) {
1309 prom_printf("SABRE_IOMMU: Error, gfp(tsb) failed.\n");
1310 prom_halt();
1311 }
1312 iommu->page_table = (iopte_t *)tsbbase;
1313 iommu->page_table_map_base = dvma_offset;
1314 iommu->dma_addr_mask = dma_mask;
1315 pci_iommu_table_init(iommu, PAGE_SIZE << order);
1316
1317 sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_TSBBASE, __pa(tsbbase));
1318 1298
1319 control = sabre_read(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL); 1299 control = sabre_read(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL);
1320 control &= ~(SABRE_IOMMUCTRL_TSBSZ | SABRE_IOMMUCTRL_TBWSZ); 1300 control &= ~(SABRE_IOMMUCTRL_TSBSZ | SABRE_IOMMUCTRL_TBWSZ);
@@ -1322,11 +1302,9 @@ static void sabre_iommu_init(struct pci_controller_info *p,
1322 switch(tsbsize) { 1302 switch(tsbsize) {
1323 case 64: 1303 case 64:
1324 control |= SABRE_IOMMU_TSBSZ_64K; 1304 control |= SABRE_IOMMU_TSBSZ_64K;
1325 iommu->page_table_sz_bits = 16;
1326 break; 1305 break;
1327 case 128: 1306 case 128:
1328 control |= SABRE_IOMMU_TSBSZ_128K; 1307 control |= SABRE_IOMMU_TSBSZ_128K;
1329 iommu->page_table_sz_bits = 17;
1330 break; 1308 break;
1331 default: 1309 default:
1332 prom_printf("iommu_init: Illegal TSB size %d\n", tsbsize); 1310 prom_printf("iommu_init: Illegal TSB size %d\n", tsbsize);
@@ -1334,15 +1312,6 @@ static void sabre_iommu_init(struct pci_controller_info *p,
1334 break; 1312 break;
1335 } 1313 }
1336 sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL, control); 1314 sabre_write(p->pbm_A.controller_regs + SABRE_IOMMU_CONTROL, control);
1337
1338 /* We start with no consistent mappings. */
1339 iommu->lowest_consistent_map =
1340 1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS);
1341
1342 for (i = 0; i < PBM_NCLUSTERS; i++) {
1343 iommu->alloc_info[i].flush = 0;
1344 iommu->alloc_info[i].next = 0;
1345 }
1346} 1315}
1347 1316
1348static void pbm_register_toplevel_resources(struct pci_controller_info *p, 1317static void pbm_register_toplevel_resources(struct pci_controller_info *p,
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index cae5b61fe2f0..d8c4e0919b4e 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -1765,7 +1765,7 @@ static void schizo_pbm_strbuf_init(struct pci_pbm_info *pbm)
1765static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm) 1765static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1766{ 1766{
1767 struct pci_iommu *iommu = pbm->iommu; 1767 struct pci_iommu *iommu = pbm->iommu;
1768 unsigned long tsbbase, i, tagbase, database, order; 1768 unsigned long i, tagbase, database;
1769 u32 vdma[2], dma_mask; 1769 u32 vdma[2], dma_mask;
1770 u64 control; 1770 u64 control;
1771 int err, tsbsize; 1771 int err, tsbsize;
@@ -1800,10 +1800,6 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1800 prom_halt(); 1800 prom_halt();
1801 }; 1801 };
1802 1802
1803 /* Setup initial software IOMMU state. */
1804 spin_lock_init(&iommu->lock);
1805 iommu->ctx_lowest_free = 1;
1806
1807 /* Register addresses, SCHIZO has iommu ctx flushing. */ 1803 /* Register addresses, SCHIZO has iommu ctx flushing. */
1808 iommu->iommu_control = pbm->pbm_regs + SCHIZO_IOMMU_CONTROL; 1804 iommu->iommu_control = pbm->pbm_regs + SCHIZO_IOMMU_CONTROL;
1809 iommu->iommu_tsbbase = pbm->pbm_regs + SCHIZO_IOMMU_TSBBASE; 1805 iommu->iommu_tsbbase = pbm->pbm_regs + SCHIZO_IOMMU_TSBBASE;
@@ -1832,56 +1828,9 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
1832 /* Leave diag mode enabled for full-flushing done 1828 /* Leave diag mode enabled for full-flushing done
1833 * in pci_iommu.c 1829 * in pci_iommu.c
1834 */ 1830 */
1831 pci_iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
1835 1832
1836 iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); 1833 schizo_write(iommu->iommu_tsbbase, __pa(iommu->page_table));
1837 if (!iommu->dummy_page) {
1838 prom_printf("PSYCHO_IOMMU: Error, gfp(dummy_page) failed.\n");
1839 prom_halt();
1840 }
1841 memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
1842 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
1843
1844 /* Using assumed page size 8K with 128K entries we need 1MB iommu page
1845 * table (128K ioptes * 8 bytes per iopte). This is
1846 * page order 7 on UltraSparc.
1847 */
1848 order = get_order(tsbsize * 8 * 1024);
1849 tsbbase = __get_free_pages(GFP_KERNEL, order);
1850 if (!tsbbase) {
1851 prom_printf("%s: Error, gfp(tsb) failed.\n", pbm->name);
1852 prom_halt();
1853 }
1854
1855 iommu->page_table = (iopte_t *)tsbbase;
1856 iommu->page_table_map_base = vdma[0];
1857 iommu->dma_addr_mask = dma_mask;
1858 pci_iommu_table_init(iommu, PAGE_SIZE << order);
1859
1860 switch (tsbsize) {
1861 case 64:
1862 iommu->page_table_sz_bits = 16;
1863 break;
1864
1865 case 128:
1866 iommu->page_table_sz_bits = 17;
1867 break;
1868
1869 default:
1870 prom_printf("iommu_init: Illegal TSB size %d\n", tsbsize);
1871 prom_halt();
1872 break;
1873 };
1874
1875 /* We start with no consistent mappings. */
1876 iommu->lowest_consistent_map =
1877 1 << (iommu->page_table_sz_bits - PBM_LOGCLUSTERS);
1878
1879 for (i = 0; i < PBM_NCLUSTERS; i++) {
1880 iommu->alloc_info[i].flush = 0;
1881 iommu->alloc_info[i].next = 0;
1882 }
1883
1884 schizo_write(iommu->iommu_tsbbase, __pa(tsbbase));
1885 1834
1886 control = schizo_read(iommu->iommu_control); 1835 control = schizo_read(iommu->iommu_control);
1887 control &= ~(SCHIZO_IOMMU_CTRL_TSBSZ | SCHIZO_IOMMU_CTRL_TBWSZ); 1836 control &= ~(SCHIZO_IOMMU_CTRL_TSBSZ | SCHIZO_IOMMU_CTRL_TBWSZ);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 590df5a16f5a..b137fd63f5e1 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -1001,13 +1001,6 @@ void smp_penguin_jailcell(int irq, struct pt_regs *regs)
1001 preempt_enable(); 1001 preempt_enable();
1002} 1002}
1003 1003
1004extern unsigned long xcall_promstop;
1005
1006void smp_promstop_others(void)
1007{
1008 smp_cross_call(&xcall_promstop, 0, 0, 0);
1009}
1010
1011#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier 1004#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
1012#define prof_counter(__cpu) cpu_data(__cpu).counter 1005#define prof_counter(__cpu) cpu_data(__cpu).counter
1013 1006
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 058b8126c1a7..e4c9151fa116 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -453,22 +453,6 @@ xcall_flush_dcache_page_spitfire: /* %g1 == physical page address
453 nop 453 nop
454 nop 454 nop
455 455
456 .globl xcall_promstop
457xcall_promstop:
458 rdpr %pstate, %g2
459 wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
460 rdpr %pil, %g2
461 wrpr %g0, 15, %pil
462 sethi %hi(109f), %g7
463 b,pt %xcc, etrap_irq
464109: or %g7, %lo(109b), %g7
465 flushw
466 call prom_stopself
467 nop
468 /* We should not return, just spin if we do... */
4691: b,a,pt %xcc, 1b
470 nop
471
472 .data 456 .data
473 457
474errata32_hwbug: 458errata32_hwbug:
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c
index 9b895faf077b..87f5cfce23bb 100644
--- a/arch/sparc64/prom/misc.c
+++ b/arch/sparc64/prom/misc.c
@@ -68,19 +68,11 @@ void prom_cmdline(void)
68 local_irq_restore(flags); 68 local_irq_restore(flags);
69} 69}
70 70
71#ifdef CONFIG_SMP
72extern void smp_promstop_others(void);
73#endif
74
75/* Drop into the prom, but completely terminate the program. 71/* Drop into the prom, but completely terminate the program.
76 * No chance of continuing. 72 * No chance of continuing.
77 */ 73 */
78void prom_halt(void) 74void prom_halt(void)
79{ 75{
80#ifdef CONFIG_SMP
81 smp_promstop_others();
82 udelay(8000);
83#endif
84again: 76again:
85 p1275_cmd("exit", P1275_INOUT(0, 0)); 77 p1275_cmd("exit", P1275_INOUT(0, 0));
86 goto again; /* PROM is out to get me -DaveM */ 78 goto again; /* PROM is out to get me -DaveM */
@@ -88,10 +80,6 @@ again:
88 80
89void prom_halt_power_off(void) 81void prom_halt_power_off(void)
90{ 82{
91#ifdef CONFIG_SMP
92 smp_promstop_others();
93 udelay(8000);
94#endif
95 p1275_cmd("SUNW,power-off", P1275_INOUT(0, 0)); 83 p1275_cmd("SUNW,power-off", P1275_INOUT(0, 0));
96 84
97 /* if nothing else helps, we just halt */ 85 /* if nothing else helps, we just halt */
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index bfa8b76de403..2dbb1b0f11d5 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -58,9 +58,8 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
58 return_VALUE(-EAGAIN); 58 return_VALUE(-EAGAIN);
59 59
60 result = acpi_bus_receive_event(&event); 60 result = acpi_bus_receive_event(&event);
61 if (result) { 61 if (result)
62 return_VALUE(-EIO); 62 return_VALUE(result);
63 }
64 63
65 chars_remaining = sprintf(str, "%s %s %08x %08x\n", 64 chars_remaining = sprintf(str, "%s %s %08x %08x\n",
66 event.device_class ? event. 65 event.device_class ? event.
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c
index 3fa64c631108..c268ee04b2aa 100644
--- a/drivers/char/mbcs.c
+++ b/drivers/char/mbcs.c
@@ -830,6 +830,9 @@ static int __init mbcs_init(void)
830{ 830{
831 int rv; 831 int rv;
832 832
833 if (!ia64_platform_is("sn2"))
834 return -ENODEV;
835
833 // Put driver into chrdevs[]. Get major number. 836 // Put driver into chrdevs[]. Get major number.
834 rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops); 837 rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops);
835 if (rv < 0) { 838 if (rv < 0) {
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index 97d6dc24b800..853c98cee64f 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -695,7 +695,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c)
695 { 695 {
696 TRACE_PE("IDLE - got STX but no space in rx_queue!"); 696 TRACE_PE("IDLE - got STX but no space in rx_queue!");
697 pInfo->state=R3964_WAIT_FOR_RX_BUF; 697 pInfo->state=R3964_WAIT_FOR_RX_BUF;
698 mod_timer(&pInfo->tmr, R3964_TO_NO_BUF); 698 mod_timer(&pInfo->tmr, jiffies + R3964_TO_NO_BUF);
699 break; 699 break;
700 } 700 }
701start_receiving: 701start_receiving:
@@ -705,7 +705,7 @@ start_receiving:
705 pInfo->last_rx = 0; 705 pInfo->last_rx = 0;
706 pInfo->flags &= ~R3964_ERROR; 706 pInfo->flags &= ~R3964_ERROR;
707 pInfo->state=R3964_RECEIVING; 707 pInfo->state=R3964_RECEIVING;
708 mod_timer(&pInfo->tmr, R3964_TO_ZVZ); 708 mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ);
709 pInfo->nRetry = 0; 709 pInfo->nRetry = 0;
710 put_char(pInfo, DLE); 710 put_char(pInfo, DLE);
711 flush(pInfo); 711 flush(pInfo);
@@ -732,7 +732,7 @@ start_receiving:
732 if(pInfo->flags & R3964_BCC) 732 if(pInfo->flags & R3964_BCC)
733 { 733 {
734 pInfo->state = R3964_WAIT_FOR_BCC; 734 pInfo->state = R3964_WAIT_FOR_BCC;
735 mod_timer(&pInfo->tmr, R3964_TO_ZVZ); 735 mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ);
736 } 736 }
737 else 737 else
738 { 738 {
@@ -744,7 +744,7 @@ start_receiving:
744 pInfo->last_rx = c; 744 pInfo->last_rx = c;
745char_to_buf: 745char_to_buf:
746 pInfo->rx_buf[pInfo->rx_position++] = c; 746 pInfo->rx_buf[pInfo->rx_position++] = c;
747 mod_timer(&pInfo->tmr, R3964_TO_ZVZ); 747 mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ);
748 } 748 }
749 } 749 }
750 /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */ 750 /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 444f7756fee6..571a68691a4a 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -93,7 +93,7 @@ config KEYBOARD_LKKBD
93 93
94config KEYBOARD_LOCOMO 94config KEYBOARD_LOCOMO
95 tristate "LoCoMo Keyboard Support" 95 tristate "LoCoMo Keyboard Support"
96 depends on SHARP_LOCOMO 96 depends on SHARP_LOCOMO && INPUT_KEYBOARD
97 help 97 help
98 Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA 98 Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA
99 99
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 1714045a182b..344f46005401 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -53,7 +53,7 @@ static unsigned char spitzkbd_keycode[NR_SCANCODES] = {
53 KEY_LEFTCTRL, KEY_1, KEY_3, KEY_5, KEY_6, KEY_7, KEY_9, KEY_0, KEY_BACKSPACE, SPITZ_KEY_EXOK, SPITZ_KEY_EXCANCEL, 0, 0, 0, 0, 0, /* 1-16 */ 53 KEY_LEFTCTRL, KEY_1, KEY_3, KEY_5, KEY_6, KEY_7, KEY_9, KEY_0, KEY_BACKSPACE, SPITZ_KEY_EXOK, SPITZ_KEY_EXCANCEL, 0, 0, 0, 0, 0, /* 1-16 */
54 0, KEY_2, KEY_4, KEY_R, KEY_Y, KEY_8, KEY_I, KEY_O, KEY_P, SPITZ_KEY_EXJOGDOWN, SPITZ_KEY_EXJOGUP, 0, 0, 0, 0, 0, /* 17-32 */ 54 0, KEY_2, KEY_4, KEY_R, KEY_Y, KEY_8, KEY_I, KEY_O, KEY_P, SPITZ_KEY_EXJOGDOWN, SPITZ_KEY_EXJOGUP, 0, 0, 0, 0, 0, /* 17-32 */
55 KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */ 55 KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */
56 SPITZ_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, /* 49-64 */ 56 SPITZ_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, 0, /* 49-64 */
57 SPITZ_KEY_ADDRESS, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 65-80 */ 57 SPITZ_KEY_ADDRESS, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 65-80 */
58 SPITZ_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, SPITZ_KEY_FN, 0, 0, 0, 0, 0, /* 81-96 */ 58 SPITZ_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, SPITZ_KEY_FN, 0, 0, 0, 0, 0, /* 81-96 */
59 KEY_SYSRQ, SPITZ_KEY_JAP1, SPITZ_KEY_JAP2, SPITZ_KEY_CANCEL, SPITZ_KEY_OK, SPITZ_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0 /* 97-112 */ 59 KEY_SYSRQ, SPITZ_KEY_JAP1, SPITZ_KEY_JAP2, SPITZ_KEY_CANCEL, SPITZ_KEY_OK, SPITZ_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0 /* 97-112 */
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index d5c5b32045af..4015a91f4b6e 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -90,11 +90,11 @@ static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct
90 90
91static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) 91static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request)
92{ 92{
93 complete(&request->done);
94
95 /* Mark slot as available */ 93 /* Mark slot as available */
96 udev->requests[request->id] = NULL; 94 udev->requests[request->id] = NULL;
97 wake_up_interruptible(&udev->requests_waitq); 95 wake_up_interruptible(&udev->requests_waitq);
96
97 complete(&request->done);
98} 98}
99 99
100static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) 100static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request)
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 022913da8c59..9b0406318f2d 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -543,7 +543,7 @@ static int cadet_probe(void)
543 543
544 for(i=0;i<8;i++) { 544 for(i=0;i<8;i++) {
545 io=iovals[i]; 545 io=iovals[i];
546 if(request_region(io,2, "cadet-probe")>=0) { 546 if (request_region(io, 2, "cadet-probe")) {
547 cadet_setfreq(1410); 547 cadet_setfreq(1410);
548 if(cadet_getfreq()==1410) { 548 if(cadet_getfreq()==1410) {
549 release_region(io, 2); 549 release_region(io, 2);
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
index 4437bdebe24f..137b58f2c666 100644
--- a/drivers/media/video/vpx3220.c
+++ b/drivers/media/video/vpx3220.c
@@ -203,7 +203,7 @@ static const unsigned short init_ntsc[] = {
203 0x8c, 640, /* Horizontal length */ 203 0x8c, 640, /* Horizontal length */
204 0x8d, 640, /* Number of pixels */ 204 0x8d, 640, /* Number of pixels */
205 0x8f, 0xc00, /* Disable window 2 */ 205 0x8f, 0xc00, /* Disable window 2 */
206 0xf0, 0x173, /* 13.5 MHz transport, Forced 206 0xf0, 0x73, /* 13.5 MHz transport, Forced
207 * mode, latch windows */ 207 * mode, latch windows */
208 0xf2, 0x13, /* NTSC M, composite input */ 208 0xf2, 0x13, /* NTSC M, composite input */
209 0xe7, 0x1e1, /* Enable vertical standard 209 0xe7, 0x1e1, /* Enable vertical standard
@@ -212,38 +212,36 @@ static const unsigned short init_ntsc[] = {
212 212
213static const unsigned short init_pal[] = { 213static const unsigned short init_pal[] = {
214 0x88, 23, /* Window 1 vertical begin */ 214 0x88, 23, /* Window 1 vertical begin */
215 0x89, 288 + 16, /* Vertical lines in (16 lines 215 0x89, 288, /* Vertical lines in (16 lines
216 * skipped by the VFE) */ 216 * skipped by the VFE) */
217 0x8a, 288 + 16, /* Vertical lines out (16 lines 217 0x8a, 288, /* Vertical lines out (16 lines
218 * skipped by the VFE) */ 218 * skipped by the VFE) */
219 0x8b, 16, /* Horizontal begin */ 219 0x8b, 16, /* Horizontal begin */
220 0x8c, 768, /* Horizontal length */ 220 0x8c, 768, /* Horizontal length */
221 0x8d, 784, /* Number of pixels 221 0x8d, 784, /* Number of pixels
222 * Must be >= Horizontal begin + Horizontal length */ 222 * Must be >= Horizontal begin + Horizontal length */
223 0x8f, 0xc00, /* Disable window 2 */ 223 0x8f, 0xc00, /* Disable window 2 */
224 0xf0, 0x177, /* 13.5 MHz transport, Forced 224 0xf0, 0x77, /* 13.5 MHz transport, Forced
225 * mode, latch windows */ 225 * mode, latch windows */
226 0xf2, 0x3d1, /* PAL B,G,H,I, composite input */ 226 0xf2, 0x3d1, /* PAL B,G,H,I, composite input */
227 0xe7, 0x261, /* PAL/SECAM set to 288 + 16 lines 227 0xe7, 0x241, /* PAL/SECAM set to 288 lines */
228 * change to 0x241 for 288 lines */
229}; 228};
230 229
231static const unsigned short init_secam[] = { 230static const unsigned short init_secam[] = {
232 0x88, 23 - 16, /* Window 1 vertical begin */ 231 0x88, 23, /* Window 1 vertical begin */
233 0x89, 288 + 16, /* Vertical lines in (16 lines 232 0x89, 288, /* Vertical lines in (16 lines
234 * skipped by the VFE) */ 233 * skipped by the VFE) */
235 0x8a, 288 + 16, /* Vertical lines out (16 lines 234 0x8a, 288, /* Vertical lines out (16 lines
236 * skipped by the VFE) */ 235 * skipped by the VFE) */
237 0x8b, 16, /* Horizontal begin */ 236 0x8b, 16, /* Horizontal begin */
238 0x8c, 768, /* Horizontal length */ 237 0x8c, 768, /* Horizontal length */
239 0x8d, 784, /* Number of pixels 238 0x8d, 784, /* Number of pixels
240 * Must be >= Horizontal begin + Horizontal length */ 239 * Must be >= Horizontal begin + Horizontal length */
241 0x8f, 0xc00, /* Disable window 2 */ 240 0x8f, 0xc00, /* Disable window 2 */
242 0xf0, 0x177, /* 13.5 MHz transport, Forced 241 0xf0, 0x77, /* 13.5 MHz transport, Forced
243 * mode, latch windows */ 242 * mode, latch windows */
244 0xf2, 0x3d5, /* SECAM, composite input */ 243 0xf2, 0x3d5, /* SECAM, composite input */
245 0xe7, 0x261, /* PAL/SECAM set to 288 + 16 lines 244 0xe7, 0x241, /* PAL/SECAM set to 288 lines */
246 * change to 0x241 for 288 lines */
247}; 245};
248 246
249static const unsigned char init_common[] = { 247static const unsigned char init_common[] = {
@@ -410,6 +408,12 @@ vpx3220_command (struct i2c_client *client,
410 case DECODER_SET_NORM: 408 case DECODER_SET_NORM:
411 { 409 {
412 int *iarg = arg, data; 410 int *iarg = arg, data;
411 int temp_input;
412
413 /* Here we back up the input selection because it gets
414 overwritten when we fill the registers with the
415 choosen video norm */
416 temp_input = vpx3220_fp_read(client, 0xf2);
413 417
414 dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", 418 dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n",
415 I2C_NAME(client), *iarg); 419 I2C_NAME(client), *iarg);
@@ -449,6 +453,10 @@ vpx3220_command (struct i2c_client *client,
449 453
450 } 454 }
451 decoder->norm = *iarg; 455 decoder->norm = *iarg;
456
457 /* And here we set the backed up video input again */
458 vpx3220_fp_write(client, 0xf2, temp_input | 0x0010);
459 udelay(10);
452 } 460 }
453 break; 461 break;
454 462
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 00a07f32a81e..7187958e40ca 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -243,7 +243,7 @@ config IPW_DEBUG
243 243
244config AIRO 244config AIRO
245 tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" 245 tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
246 depends on NET_RADIO && ISA && (PCI || BROKEN) 246 depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN)
247 ---help--- 247 ---help---
248 This is the standard Linux driver to support Cisco/Aironet ISA and 248 This is the standard Linux driver to support Cisco/Aironet ISA and
249 PCI 802.11 wireless cards. 249 PCI 802.11 wireless cards.
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 11ca44387cb0..a6a630a950d0 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1233,7 +1233,7 @@ static void __init quirk_alder_ioapic(struct pci_dev *pdev)
1233DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic ); 1233DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic );
1234#endif 1234#endif
1235 1235
1236#ifdef CONFIG_SCSI_SATA 1236#ifdef CONFIG_SCSI_SATA_INTEL_COMBINED
1237static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) 1237static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev)
1238{ 1238{
1239 u8 prog, comb, tmp; 1239 u8 prog, comb, tmp;
@@ -1310,7 +1310,7 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev)
1310 request_region(0x170, 8, "libata"); /* port 1 */ 1310 request_region(0x170, 8, "libata"); /* port 1 */
1311} 1311}
1312DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined ); 1312DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined );
1313#endif /* CONFIG_SCSI_SATA */ 1313#endif /* CONFIG_SCSI_SATA_INTEL_COMBINED */
1314 1314
1315 1315
1316int pcie_mch_quirk; 1316int pcie_mch_quirk;
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 888b70e6a484..9e7ccd8a4321 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -66,7 +66,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
66 if (pc_debug > lvl) { 66 if (pc_debug > lvl) {
67 printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func); 67 printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func);
68 va_start(args, fmt); 68 va_start(args, fmt);
69 printk(fmt, args); 69 vprintk(fmt, args);
70 va_end(args); 70 va_end(args);
71 } 71 }
72} 72}
@@ -321,8 +321,6 @@ soc_common_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
321 * less punt all of this work and let the kernel handle the details 321 * less punt all of this work and let the kernel handle the details
322 * of power configuration, reset, &c. We also record the value of 322 * of power configuration, reset, &c. We also record the value of
323 * `state' in order to regurgitate it to the PCMCIA core later. 323 * `state' in order to regurgitate it to the PCMCIA core later.
324 *
325 * Returns: 0
326 */ 324 */
327static int 325static int
328soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state) 326soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
@@ -407,7 +405,7 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m
407 * the map speed as requested, but override the address ranges 405 * the map speed as requested, but override the address ranges
408 * supplied by Card Services. 406 * supplied by Card Services.
409 * 407 *
410 * Returns: 0 on success, -1 on error 408 * Returns: 0 on success, -ERRNO on error
411 */ 409 */
412static int 410static int
413soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map) 411soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map)
@@ -655,8 +653,8 @@ static void soc_pcmcia_cpufreq_unregister(void)
655} 653}
656 654
657#else 655#else
658#define soc_pcmcia_cpufreq_register() 656static int soc_pcmcia_cpufreq_register(void) { return 0; }
659#define soc_pcmcia_cpufreq_unregister() 657static void soc_pcmcia_cpufreq_unregister(void) {}
660#endif 658#endif
661 659
662int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) 660int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
@@ -738,7 +736,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
738 goto out_err_5; 736 goto out_err_5;
739 } 737 }
740 738
741 if ( list_empty(&soc_pcmcia_sockets) ) 739 if (list_empty(&soc_pcmcia_sockets))
742 soc_pcmcia_cpufreq_register(); 740 soc_pcmcia_cpufreq_register();
743 741
744 list_add(&skt->node, &soc_pcmcia_sockets); 742 list_add(&skt->node, &soc_pcmcia_sockets);
@@ -839,7 +837,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev)
839 release_resource(&skt->res_io); 837 release_resource(&skt->res_io);
840 release_resource(&skt->res_skt); 838 release_resource(&skt->res_skt);
841 } 839 }
842 if ( list_empty(&soc_pcmcia_sockets) ) 840 if (list_empty(&soc_pcmcia_sockets))
843 soc_pcmcia_cpufreq_unregister(); 841 soc_pcmcia_cpufreq_unregister();
844 842
845 up(&soc_pcmcia_sockets_lock); 843 up(&soc_pcmcia_sockets_lock);
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 20019b82b4a8..3ee9b8b33be0 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -553,6 +553,11 @@ config SCSI_SATA_VITESSE
553 553
554 If unsure, say N. 554 If unsure, say N.
555 555
556config SCSI_SATA_INTEL_COMBINED
557 bool
558 depends on IDE=y && !BLK_DEV_IDE_SATA && (SCSI_SATA_AHCI || SCSI_ATA_PIIX)
559 default y
560
556config SCSI_BUSLOGIC 561config SCSI_BUSLOGIC
557 tristate "BusLogic SCSI support" 562 tristate "BusLogic SCSI support"
558 depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API 563 depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index de8490a92831..a1f9ceef0ac9 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -453,9 +453,9 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
453 /* 453 /*
454 * We can exit If all the commands are complete 454 * We can exit If all the commands are complete
455 */ 455 */
456 spin_unlock_irq(host->host_lock);
456 if (active == 0) 457 if (active == 0)
457 return SUCCESS; 458 return SUCCESS;
458 spin_unlock_irq(host->host_lock);
459 ssleep(1); 459 ssleep(1);
460 spin_lock_irq(host->host_lock); 460 spin_lock_irq(host->host_lock);
461 } 461 }
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index a917ab7475ac..1fd5fc6d0fe3 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1119,6 +1119,36 @@ static inline void update_can_queue(struct Scsi_Host *host, u_int in_ptr, u_int
1119 host->sg_tablesize = QLOGICPTI_MAX_SG(num_free); 1119 host->sg_tablesize = QLOGICPTI_MAX_SG(num_free);
1120} 1120}
1121 1121
1122static unsigned int scsi_rbuf_get(struct scsi_cmnd *cmd, unsigned char **buf_out)
1123{
1124 unsigned char *buf;
1125 unsigned int buflen;
1126
1127 if (cmd->use_sg) {
1128 struct scatterlist *sg;
1129
1130 sg = (struct scatterlist *) cmd->request_buffer;
1131 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset;
1132 buflen = sg->length;
1133 } else {
1134 buf = cmd->request_buffer;
1135 buflen = cmd->request_bufflen;
1136 }
1137
1138 *buf_out = buf;
1139 return buflen;
1140}
1141
1142static void scsi_rbuf_put(struct scsi_cmnd *cmd, unsigned char *buf)
1143{
1144 if (cmd->use_sg) {
1145 struct scatterlist *sg;
1146
1147 sg = (struct scatterlist *) cmd->request_buffer;
1148 kunmap_atomic(buf - sg->offset, KM_IRQ0);
1149 }
1150}
1151
1122/* 1152/*
1123 * Until we scan the entire bus with inquiries, go throught this fella... 1153 * Until we scan the entire bus with inquiries, go throught this fella...
1124 */ 1154 */
@@ -1145,11 +1175,9 @@ static void ourdone(struct scsi_cmnd *Cmnd)
1145 int ok = host_byte(Cmnd->result) == DID_OK; 1175 int ok = host_byte(Cmnd->result) == DID_OK;
1146 if (Cmnd->cmnd[0] == 0x12 && ok) { 1176 if (Cmnd->cmnd[0] == 0x12 && ok) {
1147 unsigned char *iqd; 1177 unsigned char *iqd;
1178 unsigned int iqd_len;
1148 1179
1149 if (Cmnd->use_sg != 0) 1180 iqd_len = scsi_rbuf_get(Cmnd, &iqd);
1150 BUG();
1151
1152 iqd = ((unsigned char *)Cmnd->buffer);
1153 1181
1154 /* tags handled in midlayer */ 1182 /* tags handled in midlayer */
1155 /* enable sync mode? */ 1183 /* enable sync mode? */
@@ -1163,6 +1191,9 @@ static void ourdone(struct scsi_cmnd *Cmnd)
1163 if (iqd[7] & 0x20) { 1191 if (iqd[7] & 0x20) {
1164 qpti->dev_param[tgt].device_flags |= 0x20; 1192 qpti->dev_param[tgt].device_flags |= 0x20;
1165 } 1193 }
1194
1195 scsi_rbuf_put(Cmnd, iqd);
1196
1166 qpti->sbits |= (1 << tgt); 1197 qpti->sbits |= (1 << tgt);
1167 } else if (!ok) { 1198 } else if (!ok) {
1168 qpti->sbits |= (1 << tgt); 1199 qpti->sbits |= (1 << tgt);
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 6b321e82cafb..c2786fc41cc5 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -272,6 +272,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
272 { "SUP1421", 0 }, 272 { "SUP1421", 0 },
273 /* SupraExpress 33.6 Data/Fax PnP modem */ 273 /* SupraExpress 33.6 Data/Fax PnP modem */
274 { "SUP1590", 0 }, 274 { "SUP1590", 0 },
275 /* SupraExpress 336i Sp ASVD */
276 { "SUP1620", 0 },
275 /* SupraExpress 33.6 Data/Fax PnP modem */ 277 /* SupraExpress 33.6 Data/Fax PnP modem */
276 { "SUP1760", 0 }, 278 { "SUP1760", 0 },
277 /* Phoebe Micro */ 279 /* Phoebe Micro */
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 512266307866..430754ebac8a 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -967,7 +967,7 @@ static int sci_startup(struct uart_port *port)
967#endif 967#endif
968 968
969 sci_request_irq(s); 969 sci_request_irq(s);
970 sci_start_tx(port, 1); 970 sci_start_tx(port);
971 sci_start_rx(port, 1); 971 sci_start_rx(port, 1);
972 972
973 return 0; 973 return 0;
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 41bbae83fc71..e142056b0d2c 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -326,7 +326,8 @@ static void postproc_atl_queue(struct isp116x *isp116x)
326 usb_settoggle(udev, ep->epnum, 326 usb_settoggle(udev, ep->epnum,
327 ep->nextpid == 327 ep->nextpid ==
328 USB_PID_OUT, 328 USB_PID_OUT,
329 PTD_GET_TOGGLE(ptd) ^ 1); 329 PTD_GET_TOGGLE(ptd));
330 urb->actual_length += PTD_GET_COUNT(ptd);
330 urb->status = cc_to_error[TD_DATAUNDERRUN]; 331 urb->status = cc_to_error[TD_DATAUNDERRUN];
331 spin_unlock(&urb->lock); 332 spin_unlock(&urb->lock);
332 continue; 333 continue;
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index a99865c689c5..41f92b924761 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1702,10 +1702,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
1702 if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */ 1702 if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */
1703 continue; 1703 continue;
1704 1704
1705 /* handle potential highspeed HID correctly */
1706 interval = endpoint->bInterval; 1705 interval = endpoint->bInterval;
1707 if (dev->speed == USB_SPEED_HIGH)
1708 interval = 1 << (interval - 1);
1709 1706
1710 /* Change the polling interval of mice. */ 1707 /* Change the polling interval of mice. */
1711 if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) 1708 if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index ddde5fb13f6b..5f7d3193d355 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -223,7 +223,7 @@ int usb_serial_generic_write_room (struct usb_serial_port *port)
223 dbg("%s - port %d", __FUNCTION__, port->number); 223 dbg("%s - port %d", __FUNCTION__, port->number);
224 224
225 if (serial->num_bulk_out) { 225 if (serial->num_bulk_out) {
226 if (port->write_urb_busy) 226 if (!(port->write_urb_busy))
227 room = port->bulk_out_size; 227 room = port->bulk_out_size;
228 } 228 }
229 229
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 6ef6f7760e47..809fee2140ac 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -565,7 +565,11 @@ static int vgacon_switch(struct vc_data *c)
565 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, 565 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
566 c->vc_screenbuf_size > vga_vram_size ? 566 c->vc_screenbuf_size > vga_vram_size ?
567 vga_vram_size : c->vc_screenbuf_size); 567 vga_vram_size : c->vc_screenbuf_size);
568 vgacon_doresize(c, c->vc_cols, c->vc_rows); 568 if (!(vga_video_num_columns % 2) &&
569 vga_video_num_columns <= ORIG_VIDEO_COLS &&
570 vga_video_num_lines <= (ORIG_VIDEO_LINES *
571 vga_default_font_height) / c->vc_font.height)
572 vgacon_doresize(c, c->vc_cols, c->vc_rows);
569 } 573 }
570 574
571 return 0; /* Redrawing not needed */ 575 return 0; /* Redrawing not needed */
@@ -1023,7 +1027,8 @@ static int vgacon_resize(struct vc_data *c, unsigned int width,
1023 if (width % 2 || width > ORIG_VIDEO_COLS || 1027 if (width % 2 || width > ORIG_VIDEO_COLS ||
1024 height > (ORIG_VIDEO_LINES * vga_default_font_height)/ 1028 height > (ORIG_VIDEO_LINES * vga_default_font_height)/
1025 c->vc_font.height) 1029 c->vc_font.height)
1026 return -EINVAL; 1030 /* let svgatextmode tinker with video timings */
1031 return 0;
1027 1032
1028 if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */ 1033 if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */
1029 vgacon_doresize(c, width, height); 1034 vgacon_doresize(c, width, height);
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index beeec7b51425..8000890e4271 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -592,6 +592,7 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
592 return ret; 592 return ret;
593} 593}
594 594
595#ifdef CONFIG_CPU_FREQ
595/* 596/*
596 * sa1100fb_display_dma_period() 597 * sa1100fb_display_dma_period()
597 * Calculate the minimum period (in picoseconds) between two DMA 598 * Calculate the minimum period (in picoseconds) between two DMA
@@ -606,6 +607,7 @@ static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo
606 */ 607 */
607 return var->pixclock * 8 * 16 / var->bits_per_pixel; 608 return var->pixclock * 8 * 16 / var->bits_per_pixel;
608} 609}
610#endif
609 611
610/* 612/*
611 * sa1100fb_check_var(): 613 * sa1100fb_check_var():
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 1b6b74c116a9..14016b1cd948 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -77,8 +77,7 @@ static void w1_master_release(struct device *dev)
77 77
78 dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name); 78 dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name);
79 79
80 if (md->nls && md->nls->sk_socket) 80 dev_fini_netlink(md);
81 sock_release(md->nls->sk_socket);
82 memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master)); 81 memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master));
83 kfree(md); 82 kfree(md);
84} 83}
diff --git a/fs/aio.c b/fs/aio.c
index d6b1551342b7..9fe7216457d8 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -398,7 +398,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx)
398 if (unlikely(!req)) 398 if (unlikely(!req))
399 return NULL; 399 return NULL;
400 400
401 req->ki_flags = 1 << KIF_LOCKED; 401 req->ki_flags = 0;
402 req->ki_users = 2; 402 req->ki_users = 2;
403 req->ki_key = 0; 403 req->ki_key = 0;
404 req->ki_ctx = ctx; 404 req->ki_ctx = ctx;
@@ -547,25 +547,6 @@ struct kioctx *lookup_ioctx(unsigned long ctx_id)
547 return ioctx; 547 return ioctx;
548} 548}
549 549
550static int lock_kiocb_action(void *param)
551{
552 schedule();
553 return 0;
554}
555
556static inline void lock_kiocb(struct kiocb *iocb)
557{
558 wait_on_bit_lock(&iocb->ki_flags, KIF_LOCKED, lock_kiocb_action,
559 TASK_UNINTERRUPTIBLE);
560}
561
562static inline void unlock_kiocb(struct kiocb *iocb)
563{
564 kiocbClearLocked(iocb);
565 smp_mb__after_clear_bit();
566 wake_up_bit(&iocb->ki_flags, KIF_LOCKED);
567}
568
569/* 550/*
570 * use_mm 551 * use_mm
571 * Makes the calling kernel thread take on the specified 552 * Makes the calling kernel thread take on the specified
@@ -796,9 +777,7 @@ static int __aio_run_iocbs(struct kioctx *ctx)
796 * Hold an extra reference while retrying i/o. 777 * Hold an extra reference while retrying i/o.
797 */ 778 */
798 iocb->ki_users++; /* grab extra reference */ 779 iocb->ki_users++; /* grab extra reference */
799 lock_kiocb(iocb);
800 aio_run_iocb(iocb); 780 aio_run_iocb(iocb);
801 unlock_kiocb(iocb);
802 if (__aio_put_req(ctx, iocb)) /* drop extra ref */ 781 if (__aio_put_req(ctx, iocb)) /* drop extra ref */
803 put_ioctx(ctx); 782 put_ioctx(ctx);
804 } 783 }
@@ -1542,7 +1521,6 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
1542 1521
1543 spin_lock_irq(&ctx->ctx_lock); 1522 spin_lock_irq(&ctx->ctx_lock);
1544 aio_run_iocb(req); 1523 aio_run_iocb(req);
1545 unlock_kiocb(req);
1546 if (!list_empty(&ctx->run_list)) { 1524 if (!list_empty(&ctx->run_list)) {
1547 /* drain the run list */ 1525 /* drain the run list */
1548 while (__aio_run_iocbs(ctx)) 1526 while (__aio_run_iocbs(ctx))
@@ -1674,7 +1652,6 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1674 if (NULL != cancel) { 1652 if (NULL != cancel) {
1675 struct io_event tmp; 1653 struct io_event tmp;
1676 pr_debug("calling cancel\n"); 1654 pr_debug("calling cancel\n");
1677 lock_kiocb(kiocb);
1678 memset(&tmp, 0, sizeof(tmp)); 1655 memset(&tmp, 0, sizeof(tmp));
1679 tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user; 1656 tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user;
1680 tmp.data = kiocb->ki_user_data; 1657 tmp.data = kiocb->ki_user_data;
@@ -1686,7 +1663,6 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1686 if (copy_to_user(result, &tmp, sizeof(tmp))) 1663 if (copy_to_user(result, &tmp, sizeof(tmp)))
1687 ret = -EFAULT; 1664 ret = -EFAULT;
1688 } 1665 }
1689 unlock_kiocb(kiocb);
1690 } else 1666 } else
1691 ret = -EINVAL; 1667 ret = -EINVAL;
1692 1668
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index d7f7eb669d03..4a36839f0bbd 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -85,6 +85,10 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
85 struct nfs_delegation *delegation; 85 struct nfs_delegation *delegation;
86 int status = 0; 86 int status = 0;
87 87
88 /* Ensure we first revalidate the attributes and page cache! */
89 if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR)))
90 __nfs_revalidate_inode(NFS_SERVER(inode), inode);
91
88 delegation = nfs_alloc_delegation(); 92 delegation = nfs_alloc_delegation();
89 if (delegation == NULL) 93 if (delegation == NULL)
90 return -ENOMEM; 94 return -ENOMEM;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index f6b9eda925c5..6bdcfa95de94 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -137,7 +137,8 @@ static int nfs_revalidate_file(struct inode *inode, struct file *filp)
137 struct nfs_inode *nfsi = NFS_I(inode); 137 struct nfs_inode *nfsi = NFS_I(inode);
138 int retval = 0; 138 int retval = 0;
139 139
140 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) || nfs_attribute_timeout(inode)) 140 if ((nfsi->cache_validity & (NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATTR))
141 || nfs_attribute_timeout(inode))
141 retval = __nfs_revalidate_inode(NFS_SERVER(inode), inode); 142 retval = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
142 nfs_revalidate_mapping(inode, filp->f_mapping); 143 nfs_revalidate_mapping(inode, filp->f_mapping);
143 return 0; 144 return 0;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6922469d6fc5..d4eadeea128e 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -877,12 +877,10 @@ static int nfs_wait_on_inode(struct inode *inode)
877 sigset_t oldmask; 877 sigset_t oldmask;
878 int error; 878 int error;
879 879
880 atomic_inc(&inode->i_count);
881 rpc_clnt_sigmask(clnt, &oldmask); 880 rpc_clnt_sigmask(clnt, &oldmask);
882 error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING, 881 error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING,
883 nfs_wait_schedule, TASK_INTERRUPTIBLE); 882 nfs_wait_schedule, TASK_INTERRUPTIBLE);
884 rpc_clnt_sigunmask(clnt, &oldmask); 883 rpc_clnt_sigunmask(clnt, &oldmask);
885 iput(inode);
886 884
887 return error; 885 return error;
888} 886}
@@ -1226,10 +1224,6 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
1226 loff_t cur_size, new_isize; 1224 loff_t cur_size, new_isize;
1227 int data_unstable; 1225 int data_unstable;
1228 1226
1229 /* Do we hold a delegation? */
1230 if (nfs_have_delegation(inode, FMODE_READ))
1231 return 0;
1232
1233 spin_lock(&inode->i_lock); 1227 spin_lock(&inode->i_lock);
1234 1228
1235 /* Are we in the process of updating data on the server? */ 1229 /* Are we in the process of updating data on the server? */
@@ -1350,7 +1344,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
1350 nfsi->read_cache_jiffies = fattr->timestamp; 1344 nfsi->read_cache_jiffies = fattr->timestamp;
1351 1345
1352 /* Are we racing with known updates of the metadata on the server? */ 1346 /* Are we racing with known updates of the metadata on the server? */
1353 data_unstable = ! nfs_verify_change_attribute(inode, verifier); 1347 data_unstable = ! (nfs_verify_change_attribute(inode, verifier) ||
1348 (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE));
1354 1349
1355 /* Check if our cached file size is stale */ 1350 /* Check if our cached file size is stale */
1356 new_isize = nfs_size_to_loff_t(fattr->size); 1351 new_isize = nfs_size_to_loff_t(fattr->size);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3b33f94020db..a170450aadb1 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -103,7 +103,9 @@ enum pid_directory_inos {
103 PROC_TGID_NUMA_MAPS, 103 PROC_TGID_NUMA_MAPS,
104 PROC_TGID_MOUNTS, 104 PROC_TGID_MOUNTS,
105 PROC_TGID_WCHAN, 105 PROC_TGID_WCHAN,
106#ifdef CONFIG_MMU
106 PROC_TGID_SMAPS, 107 PROC_TGID_SMAPS,
108#endif
107#ifdef CONFIG_SCHEDSTATS 109#ifdef CONFIG_SCHEDSTATS
108 PROC_TGID_SCHEDSTAT, 110 PROC_TGID_SCHEDSTAT,
109#endif 111#endif
@@ -141,7 +143,9 @@ enum pid_directory_inos {
141 PROC_TID_NUMA_MAPS, 143 PROC_TID_NUMA_MAPS,
142 PROC_TID_MOUNTS, 144 PROC_TID_MOUNTS,
143 PROC_TID_WCHAN, 145 PROC_TID_WCHAN,
146#ifdef CONFIG_MMU
144 PROC_TID_SMAPS, 147 PROC_TID_SMAPS,
148#endif
145#ifdef CONFIG_SCHEDSTATS 149#ifdef CONFIG_SCHEDSTATS
146 PROC_TID_SCHEDSTAT, 150 PROC_TID_SCHEDSTAT,
147#endif 151#endif
@@ -195,7 +199,9 @@ static struct pid_entry tgid_base_stuff[] = {
195 E(PROC_TGID_ROOT, "root", S_IFLNK|S_IRWXUGO), 199 E(PROC_TGID_ROOT, "root", S_IFLNK|S_IRWXUGO),
196 E(PROC_TGID_EXE, "exe", S_IFLNK|S_IRWXUGO), 200 E(PROC_TGID_EXE, "exe", S_IFLNK|S_IRWXUGO),
197 E(PROC_TGID_MOUNTS, "mounts", S_IFREG|S_IRUGO), 201 E(PROC_TGID_MOUNTS, "mounts", S_IFREG|S_IRUGO),
202#ifdef CONFIG_MMU
198 E(PROC_TGID_SMAPS, "smaps", S_IFREG|S_IRUGO), 203 E(PROC_TGID_SMAPS, "smaps", S_IFREG|S_IRUGO),
204#endif
199#ifdef CONFIG_SECURITY 205#ifdef CONFIG_SECURITY
200 E(PROC_TGID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), 206 E(PROC_TGID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO),
201#endif 207#endif
@@ -235,7 +241,9 @@ static struct pid_entry tid_base_stuff[] = {
235 E(PROC_TID_ROOT, "root", S_IFLNK|S_IRWXUGO), 241 E(PROC_TID_ROOT, "root", S_IFLNK|S_IRWXUGO),
236 E(PROC_TID_EXE, "exe", S_IFLNK|S_IRWXUGO), 242 E(PROC_TID_EXE, "exe", S_IFLNK|S_IRWXUGO),
237 E(PROC_TID_MOUNTS, "mounts", S_IFREG|S_IRUGO), 243 E(PROC_TID_MOUNTS, "mounts", S_IFREG|S_IRUGO),
244#ifdef CONFIG_MMU
238 E(PROC_TID_SMAPS, "smaps", S_IFREG|S_IRUGO), 245 E(PROC_TID_SMAPS, "smaps", S_IFREG|S_IRUGO),
246#endif
239#ifdef CONFIG_SECURITY 247#ifdef CONFIG_SECURITY
240 E(PROC_TID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO), 248 E(PROC_TID_ATTR, "attr", S_IFDIR|S_IRUGO|S_IXUGO),
241#endif 249#endif
@@ -630,6 +638,7 @@ static struct file_operations proc_numa_maps_operations = {
630}; 638};
631#endif 639#endif
632 640
641#ifdef CONFIG_MMU
633extern struct seq_operations proc_pid_smaps_op; 642extern struct seq_operations proc_pid_smaps_op;
634static int smaps_open(struct inode *inode, struct file *file) 643static int smaps_open(struct inode *inode, struct file *file)
635{ 644{
@@ -648,6 +657,7 @@ static struct file_operations proc_smaps_operations = {
648 .llseek = seq_lseek, 657 .llseek = seq_lseek,
649 .release = seq_release, 658 .release = seq_release,
650}; 659};
660#endif
651 661
652extern struct seq_operations mounts_op; 662extern struct seq_operations mounts_op;
653static int mounts_open(struct inode *inode, struct file *file) 663static int mounts_open(struct inode *inode, struct file *file)
@@ -1681,10 +1691,12 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
1681 case PROC_TGID_MOUNTS: 1691 case PROC_TGID_MOUNTS:
1682 inode->i_fop = &proc_mounts_operations; 1692 inode->i_fop = &proc_mounts_operations;
1683 break; 1693 break;
1694#ifdef CONFIG_MMU
1684 case PROC_TID_SMAPS: 1695 case PROC_TID_SMAPS:
1685 case PROC_TGID_SMAPS: 1696 case PROC_TGID_SMAPS:
1686 inode->i_fop = &proc_smaps_operations; 1697 inode->i_fop = &proc_smaps_operations;
1687 break; 1698 break;
1699#endif
1688#ifdef CONFIG_SECURITY 1700#ifdef CONFIG_SECURITY
1689 case PROC_TID_ATTR: 1701 case PROC_TID_ATTR:
1690 inode->i_nlink = 2; 1702 inode->i_nlink = 2;
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index f3bf016d5ee3..cff10ab1af63 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -91,6 +91,7 @@ static void *nommu_vma_list_start(struct seq_file *m, loff_t *_pos)
91 next = _rb; 91 next = _rb;
92 break; 92 break;
93 } 93 }
94 pos--;
94 } 95 }
95 96
96 return next; 97 return next;
diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h
index 21c0e16dce5f..aba9b30f4249 100644
--- a/include/asm-arm/arch-pxa/pxafb.h
+++ b/include/asm-arm/arch-pxa/pxafb.h
@@ -66,4 +66,5 @@ struct pxafb_mach_info {
66 66
67}; 67};
68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); 68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
69void set_pxa_fb_parent(struct device *parent_dev);
69unsigned long pxafb_get_hsync_time(struct device *dev); 70unsigned long pxafb_get_hsync_time(struct device *dev);
diff --git a/include/asm-arm/arch-s3c2410/io.h b/include/asm-arm/arch-s3c2410/io.h
index 418233a7ee6f..4bf272ed9add 100644
--- a/include/asm-arm/arch-s3c2410/io.h
+++ b/include/asm-arm/arch-s3c2410/io.h
@@ -9,7 +9,7 @@
9 * 06-Dec-1997 RMK Created. 9 * 06-Dec-1997 RMK Created.
10 * 02-Sep-2003 BJD Modified for S3C2410 10 * 02-Sep-2003 BJD Modified for S3C2410
11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
12 * 12 * 13-Oct-2005 BJD Fixed problems with LDRH/STRH offset range
13 */ 13 */
14 14
15#ifndef __ASM_ARM_ARCH_IO_H 15#ifndef __ASM_ARM_ARCH_IO_H
@@ -97,7 +97,7 @@ DECLARE_IO(int,l,"")
97 else \ 97 else \
98 __asm__ __volatile__( \ 98 __asm__ __volatile__( \
99 "strb %0, [%1, #0] @ outbc" \ 99 "strb %0, [%1, #0] @ outbc" \
100 : : "r" (value), "r" ((port))); \ 100 : : "r" (value), "r" ((port))); \
101}) 101})
102 102
103#define __inbc(port) \ 103#define __inbc(port) \
@@ -110,35 +110,61 @@ DECLARE_IO(int,l,"")
110 else \ 110 else \
111 __asm__ __volatile__( \ 111 __asm__ __volatile__( \
112 "ldrb %0, [%1, #0] @ inbc" \ 112 "ldrb %0, [%1, #0] @ inbc" \
113 : "=r" (result) : "r" ((port))); \ 113 : "=r" (result) : "r" ((port))); \
114 result; \ 114 result; \
115}) 115})
116 116
117#define __outwc(value,port) \ 117#define __outwc(value,port) \
118({ \ 118({ \
119 unsigned long v = value; \ 119 unsigned long v = value; \
120 if (__PORT_PCIO((port))) \ 120 if (__PORT_PCIO((port))) { \
121 __asm__ __volatile__( \ 121 if ((port) < 256 && (port) > -256) \
122 "strh %0, [%1, %2] @ outwc" \ 122 __asm__ __volatile__( \
123 : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ 123 "strh %0, [%1, %2] @ outwc" \
124 else \ 124 : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \
125 else if ((port) > 0) \
126 __asm__ __volatile__( \
127 "strh %0, [%1, %2] @ outwc" \
128 : : "r" (v), \
129 "r" (PCIO_BASE + ((port) & ~0xff)), \
130 "Jr" (((port) & 0xff))); \
131 else \
132 __asm__ __volatile__( \
133 "strh %0, [%1, #0] @ outwc" \
134 : : "r" (v), \
135 "r" (PCIO_BASE + (port))); \
136 } else \
125 __asm__ __volatile__( \ 137 __asm__ __volatile__( \
126 "strh %0, [%1, #0] @ outwc" \ 138 "strh %0, [%1, #0] @ outwc" \
127 : : "r" (v), "r" ((port))); \ 139 : : "r" (v), "r" ((port))); \
128}) 140})
129 141
130#define __inwc(port) \ 142#define __inwc(port) \
131({ \ 143({ \
132 unsigned short result; \ 144 unsigned short result; \
133 if (__PORT_PCIO((port))) \ 145 if (__PORT_PCIO((port))) { \
134 __asm__ __volatile__( \ 146 if ((port) < 256 && (port) > -256 ) \
135 "ldrh %0, [%1, %2] @ inwc" \ 147 __asm__ __volatile__( \
136 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ 148 "ldrh %0, [%1, %2] @ inwc" \
137 else \ 149 : "=r" (result) \
150 : "r" (PCIO_BASE), \
151 "Jr" ((port))); \
152 else if ((port) > 0) \
153 __asm__ __volatile__( \
154 "ldrh %0, [%1, %2] @ inwc" \
155 : "=r" (result) \
156 : "r" (PCIO_BASE + ((port) & ~0xff)), \
157 "Jr" (((port) & 0xff))); \
158 else \
159 __asm__ __volatile__( \
160 "ldrh %0, [%1, #0] @ inwc" \
161 : "=r" (result) \
162 : "r" (PCIO_BASE + ((port)))); \
163 } else \
138 __asm__ __volatile__( \ 164 __asm__ __volatile__( \
139 "ldrh %0, [%1, #0] @ inwc" \ 165 "ldrh %0, [%1, #0] @ inwc" \
140 : "=r" (result) : "r" ((port))); \ 166 : "=r" (result) : "r" ((port))); \
141 result; \ 167 result; \
142}) 168})
143 169
144#define __outlc(value,port) \ 170#define __outlc(value,port) \
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 38bbbccb4068..dd35a2c7798a 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -27,23 +27,27 @@
27 * PCI bus. 27 * PCI bus.
28 */ 28 */
29 29
30#define PBM_LOGCLUSTERS 3
31#define PBM_NCLUSTERS (1 << PBM_LOGCLUSTERS)
32
33struct pci_controller_info; 30struct pci_controller_info;
34 31
35/* This contains the software state necessary to drive a PCI 32/* This contains the software state necessary to drive a PCI
36 * controller's IOMMU. 33 * controller's IOMMU.
37 */ 34 */
35struct pci_iommu_arena {
36 unsigned long *map;
37 unsigned int hint;
38 unsigned int limit;
39};
40
38struct pci_iommu { 41struct pci_iommu {
39 /* This protects the controller's IOMMU and all 42 /* This protects the controller's IOMMU and all
40 * streaming buffers underneath. 43 * streaming buffers underneath.
41 */ 44 */
42 spinlock_t lock; 45 spinlock_t lock;
43 46
47 struct pci_iommu_arena arena;
48
44 /* IOMMU page table, a linear array of ioptes. */ 49 /* IOMMU page table, a linear array of ioptes. */
45 iopte_t *page_table; /* The page table itself. */ 50 iopte_t *page_table; /* The page table itself. */
46 int page_table_sz_bits; /* log2 of ow many pages does it map? */
47 51
48 /* Base PCI memory space address where IOMMU mappings 52 /* Base PCI memory space address where IOMMU mappings
49 * begin. 53 * begin.
@@ -62,12 +66,6 @@ struct pci_iommu {
62 */ 66 */
63 unsigned long write_complete_reg; 67 unsigned long write_complete_reg;
64 68
65 /* The lowest used consistent mapping entry. Since
66 * we allocate consistent maps out of cluster 0 this
67 * is relative to the beginning of closter 0.
68 */
69 u32 lowest_consistent_map;
70
71 /* In order to deal with some buggy third-party PCI bridges that 69 /* In order to deal with some buggy third-party PCI bridges that
72 * do wrong prefetching, we never mark valid mappings as invalid. 70 * do wrong prefetching, we never mark valid mappings as invalid.
73 * Instead we point them at this dummy page. 71 * Instead we point them at this dummy page.
@@ -75,16 +73,6 @@ struct pci_iommu {
75 unsigned long dummy_page; 73 unsigned long dummy_page;
76 unsigned long dummy_page_pa; 74 unsigned long dummy_page_pa;
77 75
78 /* If PBM_NCLUSTERS is ever decreased to 4 or lower,
79 * or if largest supported page_table_sz * 8K goes above
80 * 2GB, you must increase the size of the type of
81 * these counters. You have been duly warned. -DaveM
82 */
83 struct {
84 u16 next;
85 u16 flush;
86 } alloc_info[PBM_NCLUSTERS];
87
88 /* CTX allocation. */ 76 /* CTX allocation. */
89 unsigned long ctx_lowest_free; 77 unsigned long ctx_lowest_free;
90 unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)]; 78 unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)];
@@ -102,7 +90,7 @@ struct pci_iommu {
102 u32 dma_addr_mask; 90 u32 dma_addr_mask;
103}; 91};
104 92
105extern void pci_iommu_table_init(struct pci_iommu *, int); 93extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
106 94
107/* This describes a PCI bus module's streaming buffer. */ 95/* This describes a PCI bus module's streaming buffer. */
108struct pci_strbuf { 96struct pci_strbuf {
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 1993a3691768..19f70462b3be 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -162,13 +162,13 @@ typedef struct acct acct_t;
162#ifdef __KERNEL__ 162#ifdef __KERNEL__
163/* 163/*
164 * Yet another set of HZ to *HZ helper functions. 164 * Yet another set of HZ to *HZ helper functions.
165 * See <linux/times.h> for the original. 165 * See <linux/jiffies.h> for the original.
166 */ 166 */
167 167
168static inline u32 jiffies_to_AHZ(unsigned long x) 168static inline u32 jiffies_to_AHZ(unsigned long x)
169{ 169{
170#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0 170#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0
171 return x / (HZ / USER_HZ); 171 return x / (HZ / AHZ);
172#else 172#else
173 u64 tmp = (u64)x * TICK_NSEC; 173 u64 tmp = (u64)x * TICK_NSEC;
174 do_div(tmp, (NSEC_PER_SEC / AHZ)); 174 do_div(tmp, (NSEC_PER_SEC / AHZ));
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 60def658b246..0decf66117c1 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -24,7 +24,12 @@ struct kioctx;
24#define KIOCB_SYNC_KEY (~0U) 24#define KIOCB_SYNC_KEY (~0U)
25 25
26/* ki_flags bits */ 26/* ki_flags bits */
27#define KIF_LOCKED 0 27/*
28 * This may be used for cancel/retry serialization in the future, but
29 * for now it's unused and we probably don't want modules to even
30 * think they can use it.
31 */
32/* #define KIF_LOCKED 0 */
28#define KIF_KICKED 1 33#define KIF_KICKED 1
29#define KIF_CANCELLED 2 34#define KIF_CANCELLED 2
30 35
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index fe9778301d07..9bdba8169b41 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -393,15 +393,13 @@ extern cpumask_t cpu_present_map;
393#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 393#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
394 394
395/* Find the highest possible smp_processor_id() */ 395/* Find the highest possible smp_processor_id() */
396static inline unsigned int highest_possible_processor_id(void) 396#define highest_possible_processor_id() \
397{ 397({ \
398 unsigned int cpu, highest = 0; 398 unsigned int cpu, highest = 0; \
399 399 for_each_cpu_mask(cpu, cpu_possible_map) \
400 for_each_cpu_mask(cpu, cpu_possible_map) 400 highest = cpu; \
401 highest = cpu; 401 highest; \
402 402})
403 return highest;
404}
405 403
406 404
407#endif /* __LINUX_CPUMASK_H */ 405#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/list.h b/include/linux/list.h
index e6ec59682274..084971f333fe 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -442,12 +442,14 @@ static inline void list_splice_init(struct list_head *list,
442 * as long as the traversal is guarded by rcu_read_lock(). 442 * as long as the traversal is guarded by rcu_read_lock().
443 */ 443 */
444#define list_for_each_rcu(pos, head) \ 444#define list_for_each_rcu(pos, head) \
445 for (pos = (head)->next; prefetch(pos->next), pos != (head); \ 445 for (pos = (head)->next; \
446 pos = rcu_dereference(pos->next)) 446 prefetch(rcu_dereference(pos)->next), pos != (head); \
447 pos = pos->next)
447 448
448#define __list_for_each_rcu(pos, head) \ 449#define __list_for_each_rcu(pos, head) \
449 for (pos = (head)->next; pos != (head); \ 450 for (pos = (head)->next; \
450 pos = rcu_dereference(pos->next)) 451 rcu_dereference(pos) != (head); \
452 pos = pos->next)
451 453
452/** 454/**
453 * list_for_each_safe_rcu - iterate over an rcu-protected list safe 455 * list_for_each_safe_rcu - iterate over an rcu-protected list safe
@@ -461,8 +463,9 @@ static inline void list_splice_init(struct list_head *list,
461 * as long as the traversal is guarded by rcu_read_lock(). 463 * as long as the traversal is guarded by rcu_read_lock().
462 */ 464 */
463#define list_for_each_safe_rcu(pos, n, head) \ 465#define list_for_each_safe_rcu(pos, n, head) \
464 for (pos = (head)->next, n = pos->next; pos != (head); \ 466 for (pos = (head)->next; \
465 pos = rcu_dereference(n), n = pos->next) 467 n = rcu_dereference(pos)->next, pos != (head); \
468 pos = n)
466 469
467/** 470/**
468 * list_for_each_entry_rcu - iterate over rcu list of given type 471 * list_for_each_entry_rcu - iterate over rcu list of given type
@@ -474,11 +477,11 @@ static inline void list_splice_init(struct list_head *list,
474 * the _rcu list-mutation primitives such as list_add_rcu() 477 * the _rcu list-mutation primitives such as list_add_rcu()
475 * as long as the traversal is guarded by rcu_read_lock(). 478 * as long as the traversal is guarded by rcu_read_lock().
476 */ 479 */
477#define list_for_each_entry_rcu(pos, head, member) \ 480#define list_for_each_entry_rcu(pos, head, member) \
478 for (pos = list_entry((head)->next, typeof(*pos), member); \ 481 for (pos = list_entry((head)->next, typeof(*pos), member); \
479 prefetch(pos->member.next), &pos->member != (head); \ 482 prefetch(rcu_dereference(pos)->member.next), \
480 pos = rcu_dereference(list_entry(pos->member.next, \ 483 &pos->member != (head); \
481 typeof(*pos), member))) 484 pos = list_entry(pos->member.next, typeof(*pos), member))
482 485
483 486
484/** 487/**
@@ -492,8 +495,9 @@ static inline void list_splice_init(struct list_head *list,
492 * as long as the traversal is guarded by rcu_read_lock(). 495 * as long as the traversal is guarded by rcu_read_lock().
493 */ 496 */
494#define list_for_each_continue_rcu(pos, head) \ 497#define list_for_each_continue_rcu(pos, head) \
495 for ((pos) = (pos)->next; prefetch((pos)->next), (pos) != (head); \ 498 for ((pos) = (pos)->next; \
496 (pos) = rcu_dereference((pos)->next)) 499 prefetch(rcu_dereference((pos))->next), (pos) != (head); \
500 (pos) = (pos)->next)
497 501
498/* 502/*
499 * Double linked lists with a single pointer list head. 503 * Double linked lists with a single pointer list head.
@@ -696,8 +700,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
696 pos = n) 700 pos = n)
697 701
698#define hlist_for_each_rcu(pos, head) \ 702#define hlist_for_each_rcu(pos, head) \
699 for ((pos) = (head)->first; pos && ({ prefetch((pos)->next); 1; }); \ 703 for ((pos) = (head)->first; \
700 (pos) = rcu_dereference((pos)->next)) 704 rcu_dereference((pos)) && ({ prefetch((pos)->next); 1; }); \
705 (pos) = (pos)->next)
701 706
702/** 707/**
703 * hlist_for_each_entry - iterate over list of given type 708 * hlist_for_each_entry - iterate over list of given type
@@ -762,9 +767,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
762 */ 767 */
763#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 768#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
764 for (pos = (head)->first; \ 769 for (pos = (head)->first; \
765 pos && ({ prefetch(pos->next); 1;}) && \ 770 rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) && \
766 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 771 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
767 pos = rcu_dereference(pos->next)) 772 pos = pos->next)
768 773
769#else 774#else
770#warning "don't include kernel headers in userspace" 775#warning "don't include kernel headers in userspace"
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 4e65eb44adfd..70191a5a148f 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -94,6 +94,7 @@ struct rcu_data {
94 long batch; /* Batch # for current RCU batch */ 94 long batch; /* Batch # for current RCU batch */
95 struct rcu_head *nxtlist; 95 struct rcu_head *nxtlist;
96 struct rcu_head **nxttail; 96 struct rcu_head **nxttail;
97 long count; /* # of queued items */
97 struct rcu_head *curlist; 98 struct rcu_head *curlist;
98 struct rcu_head **curtail; 99 struct rcu_head **curtail;
99 struct rcu_head *donelist; 100 struct rcu_head *donelist;
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index ad85d3f0dcc4..7a51a5597c33 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -424,6 +424,7 @@ static void cleanup_timers(struct list_head *head,
424 cputime_t ptime = cputime_add(utime, stime); 424 cputime_t ptime = cputime_add(utime, stime);
425 425
426 list_for_each_entry_safe(timer, next, head, entry) { 426 list_for_each_entry_safe(timer, next, head, entry) {
427 put_task_struct(timer->task);
427 timer->task = NULL; 428 timer->task = NULL;
428 list_del_init(&timer->entry); 429 list_del_init(&timer->entry);
429 if (cputime_lt(timer->expires.cpu, ptime)) { 430 if (cputime_lt(timer->expires.cpu, ptime)) {
@@ -436,6 +437,7 @@ static void cleanup_timers(struct list_head *head,
436 437
437 ++head; 438 ++head;
438 list_for_each_entry_safe(timer, next, head, entry) { 439 list_for_each_entry_safe(timer, next, head, entry) {
440 put_task_struct(timer->task);
439 timer->task = NULL; 441 timer->task = NULL;
440 list_del_init(&timer->entry); 442 list_del_init(&timer->entry);
441 if (cputime_lt(timer->expires.cpu, utime)) { 443 if (cputime_lt(timer->expires.cpu, utime)) {
@@ -448,6 +450,7 @@ static void cleanup_timers(struct list_head *head,
448 450
449 ++head; 451 ++head;
450 list_for_each_entry_safe(timer, next, head, entry) { 452 list_for_each_entry_safe(timer, next, head, entry) {
453 put_task_struct(timer->task);
451 timer->task = NULL; 454 timer->task = NULL;
452 list_del_init(&timer->entry); 455 list_del_init(&timer->entry);
453 if (timer->expires.sched < sched_time) { 456 if (timer->expires.sched < sched_time) {
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index bef3b6901b76..2559d4b8f23f 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -71,7 +71,7 @@ DEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L };
71 71
72/* Fake initialization required by compiler */ 72/* Fake initialization required by compiler */
73static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL}; 73static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL};
74static int maxbatch = 10; 74static int maxbatch = 10000;
75 75
76#ifndef __HAVE_ARCH_CMPXCHG 76#ifndef __HAVE_ARCH_CMPXCHG
77/* 77/*
@@ -109,6 +109,10 @@ void fastcall call_rcu(struct rcu_head *head,
109 rdp = &__get_cpu_var(rcu_data); 109 rdp = &__get_cpu_var(rcu_data);
110 *rdp->nxttail = head; 110 *rdp->nxttail = head;
111 rdp->nxttail = &head->next; 111 rdp->nxttail = &head->next;
112
113 if (unlikely(++rdp->count > 10000))
114 set_need_resched();
115
112 local_irq_restore(flags); 116 local_irq_restore(flags);
113} 117}
114 118
@@ -140,6 +144,12 @@ void fastcall call_rcu_bh(struct rcu_head *head,
140 rdp = &__get_cpu_var(rcu_bh_data); 144 rdp = &__get_cpu_var(rcu_bh_data);
141 *rdp->nxttail = head; 145 *rdp->nxttail = head;
142 rdp->nxttail = &head->next; 146 rdp->nxttail = &head->next;
147 rdp->count++;
148/*
149 * Should we directly call rcu_do_batch() here ?
150 * if (unlikely(rdp->count > 10000))
151 * rcu_do_batch(rdp);
152 */
143 local_irq_restore(flags); 153 local_irq_restore(flags);
144} 154}
145 155
@@ -157,6 +167,7 @@ static void rcu_do_batch(struct rcu_data *rdp)
157 next = rdp->donelist = list->next; 167 next = rdp->donelist = list->next;
158 list->func(list); 168 list->func(list);
159 list = next; 169 list = next;
170 rdp->count--;
160 if (++count >= maxbatch) 171 if (++count >= maxbatch)
161 break; 172 break;
162 } 173 }
diff --git a/kernel/time.c b/kernel/time.c
index dd5ae1162a8f..40c2410ac99a 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -570,6 +570,7 @@ void getnstimeofday(struct timespec *tv)
570 tv->tv_sec = x.tv_sec; 570 tv->tv_sec = x.tv_sec;
571 tv->tv_nsec = x.tv_usec * NSEC_PER_USEC; 571 tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
572} 572}
573EXPORT_SYMBOL_GPL(getnstimeofday);
573#endif 574#endif
574 575
575#if (BITS_PER_LONG < 64) 576#if (BITS_PER_LONG < 64)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0ea71e887bb6..64f9570cff56 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -511,10 +511,11 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc)
511 * PageDirty _after_ making sure that the page is freeable and 511 * PageDirty _after_ making sure that the page is freeable and
512 * not in use by anybody. (pagecache + us == 2) 512 * not in use by anybody. (pagecache + us == 2)
513 */ 513 */
514 if (page_count(page) != 2 || PageDirty(page)) { 514 if (unlikely(page_count(page) != 2))
515 write_unlock_irq(&mapping->tree_lock); 515 goto cannot_free;
516 goto keep_locked; 516 smp_rmb();
517 } 517 if (unlikely(PageDirty(page)))
518 goto cannot_free;
518 519
519#ifdef CONFIG_SWAP 520#ifdef CONFIG_SWAP
520 if (PageSwapCache(page)) { 521 if (PageSwapCache(page)) {
@@ -538,6 +539,10 @@ free_it:
538 __pagevec_release_nonlru(&freed_pvec); 539 __pagevec_release_nonlru(&freed_pvec);
539 continue; 540 continue;
540 541
542cannot_free:
543 write_unlock_irq(&mapping->tree_lock);
544 goto keep_locked;
545
541activate_locked: 546activate_locked:
542 SetPageActive(page); 547 SetPageActive(page);
543 pgactivate++; 548 pgactivate++;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index b03e90649eb5..21deec25a12b 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -975,7 +975,6 @@ replace_table(struct ip6t_table *table,
975 struct ip6t_entry *table_base; 975 struct ip6t_entry *table_base;
976 unsigned int i; 976 unsigned int i;
977 977
978 for (i = 0; i < num_possible_cpus(); i++) {
979 for_each_cpu(i) { 978 for_each_cpu(i) {
980 table_base = 979 table_base =
981 (void *)newinfo->entries 980 (void *)newinfo->entries