aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS4
-rw-r--r--arch/alpha/kernel/machvec_impl.h2
-rw-r--r--arch/arm/kernel/module.c2
-rw-r--r--arch/arm/mach-pxa/pm.c9
-rw-r--r--arch/i386/mm/ioremap.c2
-rw-r--r--arch/i386/pci/mmconfig.c2
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_reg.c48
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c12
-rw-r--r--arch/powerpc/kernel/syscalls.c2
-rw-r--r--arch/sparc/kernel/ebus.c24
-rw-r--r--arch/sparc/kernel/led.c2
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/time.c4
-rw-r--r--arch/sparc/mm/sun4c.c2
-rw-r--r--arch/x86_64/mm/ioremap.c2
-rw-r--r--arch/x86_64/pci/mmconfig.c14
-rw-r--r--drivers/atm/adummy.c2
-rw-r--r--drivers/base/memory.c1
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c6
-rw-r--r--drivers/char/mwave/mwavepub.h2
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c13
-rw-r--r--drivers/char/watchdog/booke_wdt.c13
-rw-r--r--drivers/char/watchdog/wdrtas.c2
-rw-r--r--drivers/firmware/dell_rbu.c6
-rw-r--r--drivers/ide/Kconfig10
-rw-r--r--drivers/ide/ide-cd.c7
-rw-r--r--drivers/ide/ide-cd.h1
-rw-r--r--drivers/ide/ide-disk.c4
-rw-r--r--drivers/ide/ide-dma.c15
-rw-r--r--drivers/ide/mips/Makefile3
-rw-r--r--drivers/ide/mips/au1xxx-ide.c1498
-rw-r--r--drivers/ide/pci/sgiioc4.c8
-rw-r--r--drivers/ide/pci/via82cxxx.c1
-rw-r--r--drivers/input/misc/wistron_btns.c2
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/media/dvb/bt8xx/dst_ca.c6
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c2
-rw-r--r--drivers/mmc/mmc.c10
-rw-r--r--drivers/net/s2io.c10
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/tg3.c66
-rw-r--r--drivers/net/tg3.h7
-rw-r--r--drivers/sbus/char/jsflash.c19
-rw-r--r--drivers/sbus/char/uctrl.c10
-rw-r--r--drivers/sbus/char/vfc.h2
-rw-r--r--drivers/sbus/char/vfc_dev.c6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/iseries_vscsi.c3
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c8
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/libata-scsi.c7
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h10
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c15
-rw-r--r--drivers/scsi/sata_mv.c3
-rw-r--r--drivers/scsi/sata_promise.c12
-rw-r--r--drivers/scsi/sata_sx4.c3
-rw-r--r--drivers/scsi/scsi_error.c7
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/sd.c16
-rw-r--r--drivers/scsi/sr.c20
-rw-r--r--drivers/scsi/st.c19
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c4
-rw-r--r--drivers/usb/input/hid-core.c4
-rw-r--r--drivers/usb/misc/auerswald.c2
-rw-r--r--drivers/video/arcfb.c2
-rw-r--r--drivers/video/cyber2000fb.c4
-rw-r--r--drivers/video/pxafb.c3
-rw-r--r--fs/reiserfs/inode.c26
-rw-r--r--fs/reiserfs/journal.c18
-rw-r--r--fs/xfs/quota/xfs_qm.c4
-rw-r--r--include/asm-arm/elf.h2
-rw-r--r--include/asm-ia64/sal.h3
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h22
-rw-r--r--include/asm-sparc/memreg.h2
-rw-r--r--include/asm-sparc/pcic.h6
-rw-r--r--include/linux/ide.h131
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/scsi/scsi_cmnd.h1
-rw-r--r--init/Kconfig28
-rw-r--r--mm/memory_hotplug.c2
-rw-r--r--mm/page_alloc.c2
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/sched/act_api.c2
-rw-r--r--net/sctp/socket.c2
-rw-r--r--sound/oss/au1550_ac97.c29
91 files changed, 921 insertions, 1397 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 77bb08606912..da6973adacda 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1284,8 +1284,8 @@ T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
1284S: Supported 1284S: Supported
1285 1285
1286INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS 1286INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS
1287P: Vojtech Pavlik 1287P: Dmitry Torokhov
1288M: vojtech@suse.cz 1288M: dtor_core@ameritech.net
1289L: linux-input@atrey.karlin.mff.cuni.cz 1289L: linux-input@atrey.karlin.mff.cuni.cz
1290L: linux-joystick@atrey.karlin.mff.cuni.cz 1290L: linux-joystick@atrey.karlin.mff.cuni.cz
1291T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git 1291T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git
diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
index 4959b7a3e1e6..11f996f24fde 100644
--- a/arch/alpha/kernel/machvec_impl.h
+++ b/arch/alpha/kernel/machvec_impl.h
@@ -41,7 +41,7 @@
41#define CAT1(x,y) x##y 41#define CAT1(x,y) x##y
42#define CAT(x,y) CAT1(x,y) 42#define CAT(x,y) CAT1(x,y)
43 43
44#define DO_DEFAULT_RTC rtc_port: 0x70 44#define DO_DEFAULT_RTC .rtc_port = 0x70
45 45
46#define DO_EV4_MMU \ 46#define DO_EV4_MMU \
47 .max_asn = EV4_MAX_ASN, \ 47 .max_asn = EV4_MAX_ASN, \
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 6055e1427ba3..055bf5d28894 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -101,6 +101,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
101 break; 101 break;
102 102
103 case R_ARM_PC24: 103 case R_ARM_PC24:
104 case R_ARM_CALL:
105 case R_ARM_JUMP24:
104 offset = (*(u32 *)loc & 0x00ffffff) << 2; 106 offset = (*(u32 *)loc & 0x00ffffff) << 2;
105 if (offset & 0x02000000) 107 if (offset & 0x02000000)
106 offset -= 0x04000000; 108 offset -= 0x04000000;
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index f74b9af112dc..852ea72d8c80 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -155,19 +155,20 @@ int pxa_pm_enter(suspend_state_t state)
155 PSPR = 0; 155 PSPR = 0;
156 156
157 /* restore registers */ 157 /* restore registers */
158 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
159 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
158 RESTORE(GAFR0_L); RESTORE(GAFR0_U); 160 RESTORE(GAFR0_L); RESTORE(GAFR0_U);
159 RESTORE(GAFR1_L); RESTORE(GAFR1_U); 161 RESTORE(GAFR1_L); RESTORE(GAFR1_U);
160 RESTORE(GAFR2_L); RESTORE(GAFR2_U); 162 RESTORE(GAFR2_L); RESTORE(GAFR2_U);
161 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
162 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
163 RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2); 163 RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2);
164 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2); 164 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
165 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2); 165 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2);
166 166
167#ifdef CONFIG_PXA27x 167#ifdef CONFIG_PXA27x
168 RESTORE(MDREFR); 168 RESTORE(MDREFR);
169 RESTORE(GAFR3_L); RESTORE(GAFR3_U); RESTORE_GPLEVEL(3); 169 RESTORE_GPLEVEL(3); RESTORE(GPDR3);
170 RESTORE(GPDR3); RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3); 170 RESTORE(GAFR3_L); RESTORE(GAFR3_U);
171 RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3);
171 RESTORE(PWER); RESTORE(PCFR); RESTORE(PRER); 172 RESTORE(PWER); RESTORE(PCFR); RESTORE(PRER);
172 RESTORE(PFER); RESTORE(PKWR); 173 RESTORE(PFER); RESTORE(PKWR);
173#endif 174#endif
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
index 8498b5ac3955..247fde76aaed 100644
--- a/arch/i386/mm/ioremap.c
+++ b/arch/i386/mm/ioremap.c
@@ -245,7 +245,7 @@ void iounmap(volatile void __iomem *addr)
245 addr < phys_to_virt(ISA_END_ADDRESS)) 245 addr < phys_to_virt(ISA_END_ADDRESS))
246 return; 246 return;
247 247
248 addr = (volatile void *)(PAGE_MASK & (unsigned long __force)addr); 248 addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr);
249 249
250 /* Use the vm area unlocked, assuming the caller 250 /* Use the vm area unlocked, assuming the caller
251 ensures there isn't another iounmap for the same address 251 ensures there isn't another iounmap for the same address
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index 08a084901212..70a9cc132cf7 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -155,7 +155,7 @@ static __init void unreachable_devices(void)
155 addr = get_base_addr(0, 0, PCI_DEVFN(i, 0)); 155 addr = get_base_addr(0, 0, PCI_DEVFN(i, 0));
156 if (addr != 0) 156 if (addr != 0)
157 pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0)); 157 pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0));
158 if (addr == 0 || readl((u32 *)addr) != val1) 158 if (addr == 0 || readl((u32 __iomem *)addr) != val1)
159 set_bit(i, fallback_slots); 159 set_bit(i, fallback_slots);
160 spin_unlock_irqrestore(&pci_config_lock, flags); 160 spin_unlock_irqrestore(&pci_config_lock, flags);
161 } 161 }
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index a4da715a360c..e9904c74d2ba 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -721,11 +721,13 @@ flush_thread (void)
721 /* drop floating-point and debug-register state if it exists: */ 721 /* drop floating-point and debug-register state if it exists: */
722 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); 722 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
723 ia64_drop_fpu(current); 723 ia64_drop_fpu(current);
724#ifdef CONFIG_IA32_SUPPORT
724 if (IS_IA32_PROCESS(ia64_task_regs(current))) { 725 if (IS_IA32_PROCESS(ia64_task_regs(current))) {
725 ia32_drop_partial_page_list(current); 726 ia32_drop_partial_page_list(current);
726 current->thread.task_size = IA32_PAGE_OFFSET; 727 current->thread.task_size = IA32_PAGE_OFFSET;
727 set_fs(USER_DS); 728 set_fs(USER_DS);
728 } 729 }
730#endif
729} 731}
730 732
731/* 733/*
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
index 5d534091262c..79fdb91d7259 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
@@ -25,7 +25,7 @@ union br_ptr {
25 */ 25 */
26void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) 26void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
27{ 27{
28 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 28 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
29 29
30 if (pcibus_info) { 30 if (pcibus_info) {
31 switch (pcibus_info->pbi_bridge_type) { 31 switch (pcibus_info->pbi_bridge_type) {
@@ -38,14 +38,14 @@ void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
38 default: 38 default:
39 panic 39 panic
40 ("pcireg_control_bit_clr: unknown bridgetype bridge 0x%p", 40 ("pcireg_control_bit_clr: unknown bridgetype bridge 0x%p",
41 (void *)ptr); 41 ptr);
42 } 42 }
43 } 43 }
44} 44}
45 45
46void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) 46void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
47{ 47{
48 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 48 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
49 49
50 if (pcibus_info) { 50 if (pcibus_info) {
51 switch (pcibus_info->pbi_bridge_type) { 51 switch (pcibus_info->pbi_bridge_type) {
@@ -58,7 +58,7 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
58 default: 58 default:
59 panic 59 panic
60 ("pcireg_control_bit_set: unknown bridgetype bridge 0x%p", 60 ("pcireg_control_bit_set: unknown bridgetype bridge 0x%p",
61 (void *)ptr); 61 ptr);
62 } 62 }
63 } 63 }
64} 64}
@@ -68,7 +68,7 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
68 */ 68 */
69uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info) 69uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
70{ 70{
71 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 71 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
72 uint64_t ret = 0; 72 uint64_t ret = 0;
73 73
74 if (pcibus_info) { 74 if (pcibus_info) {
@@ -82,7 +82,7 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
82 default: 82 default:
83 panic 83 panic
84 ("pcireg_tflush_get: unknown bridgetype bridge 0x%p", 84 ("pcireg_tflush_get: unknown bridgetype bridge 0x%p",
85 (void *)ptr); 85 ptr);
86 } 86 }
87 } 87 }
88 88
@@ -98,7 +98,7 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
98 */ 98 */
99uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info) 99uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
100{ 100{
101 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 101 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
102 uint64_t ret = 0; 102 uint64_t ret = 0;
103 103
104 if (pcibus_info) { 104 if (pcibus_info) {
@@ -112,7 +112,7 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
112 default: 112 default:
113 panic 113 panic
114 ("pcireg_intr_status_get: unknown bridgetype bridge 0x%p", 114 ("pcireg_intr_status_get: unknown bridgetype bridge 0x%p",
115 (void *)ptr); 115 ptr);
116 } 116 }
117 } 117 }
118 return ret; 118 return ret;
@@ -123,7 +123,7 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
123 */ 123 */
124void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) 124void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
125{ 125{
126 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 126 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
127 127
128 if (pcibus_info) { 128 if (pcibus_info) {
129 switch (pcibus_info->pbi_bridge_type) { 129 switch (pcibus_info->pbi_bridge_type) {
@@ -136,14 +136,14 @@ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
136 default: 136 default:
137 panic 137 panic
138 ("pcireg_intr_enable_bit_clr: unknown bridgetype bridge 0x%p", 138 ("pcireg_intr_enable_bit_clr: unknown bridgetype bridge 0x%p",
139 (void *)ptr); 139 ptr);
140 } 140 }
141 } 141 }
142} 142}
143 143
144void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) 144void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
145{ 145{
146 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 146 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
147 147
148 if (pcibus_info) { 148 if (pcibus_info) {
149 switch (pcibus_info->pbi_bridge_type) { 149 switch (pcibus_info->pbi_bridge_type) {
@@ -156,7 +156,7 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
156 default: 156 default:
157 panic 157 panic
158 ("pcireg_intr_enable_bit_set: unknown bridgetype bridge 0x%p", 158 ("pcireg_intr_enable_bit_set: unknown bridgetype bridge 0x%p",
159 (void *)ptr); 159 ptr);
160 } 160 }
161 } 161 }
162} 162}
@@ -167,7 +167,7 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
167void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n, 167void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
168 uint64_t addr) 168 uint64_t addr)
169{ 169{
170 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 170 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
171 171
172 if (pcibus_info) { 172 if (pcibus_info) {
173 switch (pcibus_info->pbi_bridge_type) { 173 switch (pcibus_info->pbi_bridge_type) {
@@ -186,7 +186,7 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
186 default: 186 default:
187 panic 187 panic
188 ("pcireg_intr_addr_addr_get: unknown bridgetype bridge 0x%p", 188 ("pcireg_intr_addr_addr_get: unknown bridgetype bridge 0x%p",
189 (void *)ptr); 189 ptr);
190 } 190 }
191 } 191 }
192} 192}
@@ -196,7 +196,7 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
196 */ 196 */
197void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n) 197void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
198{ 198{
199 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 199 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
200 200
201 if (pcibus_info) { 201 if (pcibus_info) {
202 switch (pcibus_info->pbi_bridge_type) { 202 switch (pcibus_info->pbi_bridge_type) {
@@ -209,7 +209,7 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
209 default: 209 default:
210 panic 210 panic
211 ("pcireg_force_intr_set: unknown bridgetype bridge 0x%p", 211 ("pcireg_force_intr_set: unknown bridgetype bridge 0x%p",
212 (void *)ptr); 212 ptr);
213 } 213 }
214 } 214 }
215} 215}
@@ -219,7 +219,7 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
219 */ 219 */
220uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device) 220uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
221{ 221{
222 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 222 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
223 uint64_t ret = 0; 223 uint64_t ret = 0;
224 224
225 if (pcibus_info) { 225 if (pcibus_info) {
@@ -233,7 +233,7 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
233 __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]); 233 __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]);
234 break; 234 break;
235 default: 235 default:
236 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr); 236 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", ptr);
237 } 237 }
238 238
239 } 239 }
@@ -244,7 +244,7 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
244void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index, 244void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
245 uint64_t val) 245 uint64_t val)
246{ 246{
247 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 247 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
248 248
249 if (pcibus_info) { 249 if (pcibus_info) {
250 switch (pcibus_info->pbi_bridge_type) { 250 switch (pcibus_info->pbi_bridge_type) {
@@ -257,15 +257,15 @@ void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
257 default: 257 default:
258 panic 258 panic
259 ("pcireg_int_ate_set: unknown bridgetype bridge 0x%p", 259 ("pcireg_int_ate_set: unknown bridgetype bridge 0x%p",
260 (void *)ptr); 260 ptr);
261 } 261 }
262 } 262 }
263} 263}
264 264
265uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index) 265uint64_t __iomem *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
266{ 266{
267 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 267 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
268 uint64_t *ret = (uint64_t *) 0; 268 uint64_t __iomem *ret = NULL;
269 269
270 if (pcibus_info) { 270 if (pcibus_info) {
271 switch (pcibus_info->pbi_bridge_type) { 271 switch (pcibus_info->pbi_bridge_type) {
@@ -278,7 +278,7 @@ uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
278 default: 278 default:
279 panic 279 panic
280 ("pcireg_int_ate_addr: unknown bridgetype bridge 0x%p", 280 ("pcireg_int_ate_addr: unknown bridgetype bridge 0x%p",
281 (void *)ptr); 281 ptr);
282 } 282 }
283 } 283 }
284 return ret; 284 return ret;
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 46b646a6d345..27aa1842dacc 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -38,10 +38,10 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
38 uint64_t offset; 38 uint64_t offset;
39 struct page *tmp; 39 struct page *tmp;
40 struct tioca_common *tioca_common; 40 struct tioca_common *tioca_common;
41 struct tioca *ca_base; 41 struct tioca __iomem *ca_base;
42 42
43 tioca_common = tioca_kern->ca_common; 43 tioca_common = tioca_kern->ca_common;
44 ca_base = (struct tioca *)tioca_common->ca_common.bs_base; 44 ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base;
45 45
46 if (list_empty(tioca_kern->ca_devices)) 46 if (list_empty(tioca_kern->ca_devices))
47 return 0; 47 return 0;
@@ -215,7 +215,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
215{ 215{
216 int cap_ptr; 216 int cap_ptr;
217 uint32_t reg; 217 uint32_t reg;
218 struct tioca *tioca_base; 218 struct tioca __iomem *tioca_base;
219 struct pci_dev *pdev; 219 struct pci_dev *pdev;
220 struct tioca_common *common; 220 struct tioca_common *common;
221 221
@@ -257,7 +257,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
257 * Set ca's fw to match 257 * Set ca's fw to match
258 */ 258 */
259 259
260 tioca_base = (struct tioca *)common->ca_common.bs_base; 260 tioca_base = (struct tioca __iomem*)common->ca_common.bs_base;
261 __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE); 261 __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE);
262} 262}
263 263
@@ -322,7 +322,7 @@ static uint64_t
322tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr) 322tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr)
323{ 323{
324 struct tioca_common *tioca_common; 324 struct tioca_common *tioca_common;
325 struct tioca *ca_base; 325 struct tioca __iomem *ca_base;
326 uint64_t ct_addr; 326 uint64_t ct_addr;
327 dma_addr_t bus_addr; 327 dma_addr_t bus_addr;
328 uint32_t node_upper; 328 uint32_t node_upper;
@@ -330,7 +330,7 @@ tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr)
330 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(pdev); 330 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(pdev);
331 331
332 tioca_common = (struct tioca_common *)pcidev_info->pdi_pcibus_info; 332 tioca_common = (struct tioca_common *)pcidev_info->pdi_pcibus_info;
333 ca_base = (struct tioca *)tioca_common->ca_common.bs_base; 333 ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base;
334 334
335 ct_addr = PHYS_TO_TIODMA(paddr); 335 ct_addr = PHYS_TO_TIODMA(paddr);
336 if (!ct_addr) 336 if (!ct_addr)
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index f72ced11212d..91b93d917b64 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -247,7 +247,7 @@ long ppc64_personality(unsigned long personality)
247#define OVERRIDE_MACHINE 0 247#define OVERRIDE_MACHINE 0
248#endif 248#endif
249 249
250static inline int override_machine(char *mach) 250static inline int override_machine(char __user *mach)
251{ 251{
252 if (OVERRIDE_MACHINE) { 252 if (OVERRIDE_MACHINE) {
253 /* change ppc64 to ppc */ 253 /* change ppc64 to ppc */
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 1754192c69d0..5c3529ceb5d6 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -22,7 +22,7 @@
22#include <asm/oplib.h> 22#include <asm/oplib.h>
23#include <asm/bpp.h> 23#include <asm/bpp.h>
24 24
25struct linux_ebus *ebus_chain = 0; 25struct linux_ebus *ebus_chain = NULL;
26 26
27/* We are together with pcic.c under CONFIG_PCI. */ 27/* We are together with pcic.c under CONFIG_PCI. */
28extern unsigned int pcic_pin_to_irq(unsigned int, char *name); 28extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
@@ -46,7 +46,7 @@ static struct ebus_device_irq je1_1[] = {
46 { "SUNW,CS4231", 0 }, 46 { "SUNW,CS4231", 0 },
47 { "parallel", 0 }, 47 { "parallel", 0 },
48 { "se", 2 }, 48 { "se", 2 },
49 { 0, 0 } 49 { NULL, 0 }
50}; 50};
51 51
52/* 52/*
@@ -55,7 +55,7 @@ static struct ebus_device_irq je1_1[] = {
55 */ 55 */
56static struct ebus_system_entry ebus_blacklist[] = { 56static struct ebus_system_entry ebus_blacklist[] = {
57 { "SUNW,JavaEngine1", je1_1 }, 57 { "SUNW,JavaEngine1", je1_1 },
58 { 0, 0 } 58 { NULL, NULL }
59}; 59};
60 60
61static struct ebus_device_irq *ebus_blackp = NULL; 61static struct ebus_device_irq *ebus_blackp = NULL;
@@ -233,7 +233,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
233 ebus_alloc(sizeof(struct linux_ebus_child)); 233 ebus_alloc(sizeof(struct linux_ebus_child));
234 234
235 child = dev->children; 235 child = dev->children;
236 child->next = 0; 236 child->next = NULL;
237 child->parent = dev; 237 child->parent = dev;
238 child->bus = dev->bus; 238 child->bus = dev->bus;
239 fill_ebus_child(node, &regs[0], child); 239 fill_ebus_child(node, &regs[0], child);
@@ -243,7 +243,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
243 ebus_alloc(sizeof(struct linux_ebus_child)); 243 ebus_alloc(sizeof(struct linux_ebus_child));
244 244
245 child = child->next; 245 child = child->next;
246 child->next = 0; 246 child->next = NULL;
247 child->parent = dev; 247 child->parent = dev;
248 child->bus = dev->bus; 248 child->bus = dev->bus;
249 fill_ebus_child(node, &regs[0], child); 249 fill_ebus_child(node, &regs[0], child);
@@ -275,7 +275,7 @@ void __init ebus_init(void)
275 } 275 }
276 } 276 }
277 277
278 pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0); 278 pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, NULL);
279 if (!pdev) { 279 if (!pdev) {
280 return; 280 return;
281 } 281 }
@@ -284,7 +284,7 @@ void __init ebus_init(void)
284 284
285 ebus_chain = ebus = (struct linux_ebus *) 285 ebus_chain = ebus = (struct linux_ebus *)
286 ebus_alloc(sizeof(struct linux_ebus)); 286 ebus_alloc(sizeof(struct linux_ebus));
287 ebus->next = 0; 287 ebus->next = NULL;
288 288
289 while (ebusnd) { 289 while (ebusnd) {
290 290
@@ -325,8 +325,8 @@ void __init ebus_init(void)
325 ebus_alloc(sizeof(struct linux_ebus_device)); 325 ebus_alloc(sizeof(struct linux_ebus_device));
326 326
327 dev = ebus->devices; 327 dev = ebus->devices;
328 dev->next = 0; 328 dev->next = NULL;
329 dev->children = 0; 329 dev->children = NULL;
330 dev->bus = ebus; 330 dev->bus = ebus;
331 fill_ebus_device(nd, dev); 331 fill_ebus_device(nd, dev);
332 332
@@ -335,8 +335,8 @@ void __init ebus_init(void)
335 ebus_alloc(sizeof(struct linux_ebus_device)); 335 ebus_alloc(sizeof(struct linux_ebus_device));
336 336
337 dev = dev->next; 337 dev = dev->next;
338 dev->next = 0; 338 dev->next = NULL;
339 dev->children = 0; 339 dev->children = NULL;
340 dev->bus = ebus; 340 dev->bus = ebus;
341 fill_ebus_device(nd, dev); 341 fill_ebus_device(nd, dev);
342 } 342 }
@@ -353,7 +353,7 @@ void __init ebus_init(void)
353 ebus->next = (struct linux_ebus *) 353 ebus->next = (struct linux_ebus *)
354 ebus_alloc(sizeof(struct linux_ebus)); 354 ebus_alloc(sizeof(struct linux_ebus));
355 ebus = ebus->next; 355 ebus = ebus->next;
356 ebus->next = 0; 356 ebus->next = NULL;
357 ++num_ebus; 357 ++num_ebus;
358 } 358 }
359 if (pdev) 359 if (pdev)
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c
index 2a3afca453c9..313d1620ae8e 100644
--- a/arch/sparc/kernel/led.c
+++ b/arch/sparc/kernel/led.c
@@ -55,7 +55,7 @@ static int led_read_proc(char *buf, char **start, off_t offset, int count,
55 return len; 55 return len;
56} 56}
57 57
58static int led_write_proc(struct file *file, const char *buffer, 58static int led_write_proc(struct file *file, const char __user *buffer,
59 unsigned long count, void *data) 59 unsigned long count, void *data)
60{ 60{
61 char *buf = NULL; 61 char *buf = NULL;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index cccfc12802ed..42002b742deb 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -161,7 +161,7 @@ static struct pcic_sn2list pcic_known_sysnames[] = {
161static int pcic0_up; 161static int pcic0_up;
162static struct linux_pcic pcic0; 162static struct linux_pcic pcic0;
163 163
164void * __iomem pcic_regs; 164void __iomem *pcic_regs;
165volatile int pcic_speculative; 165volatile int pcic_speculative;
166volatile int pcic_trapped; 166volatile int pcic_trapped;
167 167
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 24814d58f9e1..7dadcdb4ca42 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -49,7 +49,7 @@ DEFINE_SPINLOCK(rtc_lock);
49enum sparc_clock_type sp_clock_typ; 49enum sparc_clock_type sp_clock_typ;
50DEFINE_SPINLOCK(mostek_lock); 50DEFINE_SPINLOCK(mostek_lock);
51void __iomem *mstk48t02_regs = NULL; 51void __iomem *mstk48t02_regs = NULL;
52static struct mostek48t08 *mstk48t08_regs = NULL; 52static struct mostek48t08 __iomem *mstk48t08_regs = NULL;
53static int set_rtc_mmss(unsigned long); 53static int set_rtc_mmss(unsigned long);
54static int sbus_do_settimeofday(struct timespec *tv); 54static int sbus_do_settimeofday(struct timespec *tv);
55 55
@@ -342,7 +342,7 @@ static __inline__ void clock_probe(void)
342 /* XXX r/o attribute is somewhere in r.flags */ 342 /* XXX r/o attribute is somewhere in r.flags */
343 r.flags = clk_reg[0].which_io; 343 r.flags = clk_reg[0].which_io;
344 r.start = clk_reg[0].phys_addr; 344 r.start = clk_reg[0].phys_addr;
345 mstk48t08_regs = (struct mostek48t08 *) sbus_ioremap(&r, 0, 345 mstk48t08_regs = sbus_ioremap(&r, 0,
346 sizeof(struct mostek48t08), "mk48t08"); 346 sizeof(struct mostek48t08), "mk48t08");
347 347
348 mstk48t02_regs = &mstk48t08_regs->regs; 348 mstk48t02_regs = &mstk48t08_regs->regs;
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 1d560390e282..731f19603cad 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -497,7 +497,7 @@ static void __init sun4c_probe_mmu(void)
497 patch_kernel_fault_handler(); 497 patch_kernel_fault_handler();
498} 498}
499 499
500volatile unsigned long *sun4c_memerr_reg = NULL; 500volatile unsigned long __iomem *sun4c_memerr_reg = NULL;
501 501
502void __init sun4c_probe_memerr_reg(void) 502void __init sun4c_probe_memerr_reg(void)
503{ 503{
diff --git a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c
index 0d260e4492f7..ae207064201e 100644
--- a/arch/x86_64/mm/ioremap.c
+++ b/arch/x86_64/mm/ioremap.c
@@ -263,7 +263,7 @@ void iounmap(volatile void __iomem *addr)
263 addr < phys_to_virt(ISA_END_ADDRESS)) 263 addr < phys_to_virt(ISA_END_ADDRESS))
264 return; 264 return;
265 265
266 addr = (volatile void *)(PAGE_MASK & (unsigned long __force)addr); 266 addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr);
267 /* Use the vm area unlocked, assuming the caller 267 /* Use the vm area unlocked, assuming the caller
268 ensures there isn't another iounmap for the same address 268 ensures there isn't another iounmap for the same address
269 in parallel. Reuse of the virtual address is prevented by 269 in parallel. Reuse of the virtual address is prevented by
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 9c4f907e301c..f16c0d57c552 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -18,11 +18,11 @@ static DECLARE_BITMAP(fallback_slots, 32);
18/* Static virtual mapping of the MMCONFIG aperture */ 18/* Static virtual mapping of the MMCONFIG aperture */
19struct mmcfg_virt { 19struct mmcfg_virt {
20 struct acpi_table_mcfg_config *cfg; 20 struct acpi_table_mcfg_config *cfg;
21 char *virt; 21 char __iomem *virt;
22}; 22};
23static struct mmcfg_virt *pci_mmcfg_virt; 23static struct mmcfg_virt *pci_mmcfg_virt;
24 24
25static char *get_virt(unsigned int seg, unsigned bus) 25static char __iomem *get_virt(unsigned int seg, unsigned bus)
26{ 26{
27 int cfg_num = -1; 27 int cfg_num = -1;
28 struct acpi_table_mcfg_config *cfg; 28 struct acpi_table_mcfg_config *cfg;
@@ -43,9 +43,9 @@ static char *get_virt(unsigned int seg, unsigned bus)
43 } 43 }
44} 44}
45 45
46static char *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 46static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
47{ 47{
48 char *addr; 48 char __iomem *addr;
49 if (seg == 0 && bus == 0 && test_bit(PCI_SLOT(devfn), &fallback_slots)) 49 if (seg == 0 && bus == 0 && test_bit(PCI_SLOT(devfn), &fallback_slots))
50 return NULL; 50 return NULL;
51 addr = get_virt(seg, bus); 51 addr = get_virt(seg, bus);
@@ -57,7 +57,7 @@ static char *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn
57static int pci_mmcfg_read(unsigned int seg, unsigned int bus, 57static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
58 unsigned int devfn, int reg, int len, u32 *value) 58 unsigned int devfn, int reg, int len, u32 *value)
59{ 59{
60 char *addr; 60 char __iomem *addr;
61 61
62 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ 62 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
63 if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) 63 if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095)))
@@ -85,7 +85,7 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
85static int pci_mmcfg_write(unsigned int seg, unsigned int bus, 85static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
86 unsigned int devfn, int reg, int len, u32 value) 86 unsigned int devfn, int reg, int len, u32 value)
87{ 87{
88 char *addr; 88 char __iomem *addr;
89 89
90 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ 90 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
91 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) 91 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095)))
@@ -127,7 +127,7 @@ static __init void unreachable_devices(void)
127 int i; 127 int i;
128 for (i = 0; i < 32; i++) { 128 for (i = 0; i < 32; i++) {
129 u32 val1; 129 u32 val1;
130 char *addr; 130 char __iomem *addr;
131 131
132 pci_conf1_read(0, 0, PCI_DEVFN(i,0), 0, 4, &val1); 132 pci_conf1_read(0, 0, PCI_DEVFN(i,0), 0, 4, &val1);
133 if (val1 == 0xffffffff) 133 if (val1 == 0xffffffff)
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index d15c194be44a..d1387cfe2d30 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -123,7 +123,7 @@ static int __init adummy_init(void)
123 } 123 }
124 memset(adummy_dev, 0, sizeof(struct adummy_dev)); 124 memset(adummy_dev, 0, sizeof(struct adummy_dev));
125 125
126 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0); 126 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL);
127 if (!atm_dev) { 127 if (!atm_dev) {
128 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); 128 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n");
129 err = -ENODEV; 129 err = -ENODEV;
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index b7ddd651d664..bc3ca6a656b2 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -28,7 +28,6 @@
28static struct sysdev_class memory_sysdev_class = { 28static struct sysdev_class memory_sysdev_class = {
29 set_kset_name(MEMORY_CLASS_NAME), 29 set_kset_name(MEMORY_CLASS_NAME),
30}; 30};
31EXPORT_SYMBOL(memory_sysdev_class);
32 31
33static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj) 32static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj)
34{ 33{
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 01a1f6badb53..beea450ee4b2 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2399,7 +2399,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
2399 new_smi->handlers->cleanup(new_smi->si_sm); 2399 new_smi->handlers->cleanup(new_smi->si_sm);
2400 kfree(new_smi->si_sm); 2400 kfree(new_smi->si_sm);
2401 } 2401 }
2402 new_smi->io_cleanup(new_smi); 2402 if (new_smi->io_cleanup)
2403 new_smi->io_cleanup(new_smi);
2403 2404
2404 return rv; 2405 return rv;
2405} 2406}
@@ -2518,7 +2519,8 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
2518 2519
2519 kfree(to_clean->si_sm); 2520 kfree(to_clean->si_sm);
2520 2521
2521 to_clean->io_cleanup(to_clean); 2522 if (to_clean->io_cleanup)
2523 to_clean->io_cleanup(to_clean);
2522} 2524}
2523 2525
2524static __exit void cleanup_ipmi_si(void) 2526static __exit void cleanup_ipmi_si(void)
diff --git a/drivers/char/mwave/mwavepub.h b/drivers/char/mwave/mwavepub.h
index f1f9da7a65c1..60c961ae23b4 100644
--- a/drivers/char/mwave/mwavepub.h
+++ b/drivers/char/mwave/mwavepub.h
@@ -69,7 +69,7 @@ typedef struct _MW_ABILITIES {
69typedef struct _MW_READWRITE { 69typedef struct _MW_READWRITE {
70 unsigned short usDspAddress; /* The dsp address */ 70 unsigned short usDspAddress; /* The dsp address */
71 unsigned long ulDataLength; /* The size in bytes of the data or user buffer */ 71 unsigned long ulDataLength; /* The size in bytes of the data or user buffer */
72 void *pBuf; /* Input:variable sized buffer */ 72 void __user *pBuf; /* Input:variable sized buffer */
73} MW_READWRITE, *pMW_READWRITE; 73} MW_READWRITE, *pMW_READWRITE;
74 74
75#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1) 75#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1)
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index ef011ef5dc46..61681c9f3f72 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1444,6 +1444,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1444 dev_link_t *link; 1444 dev_link_t *link;
1445 int size; 1445 int size;
1446 int rc; 1446 int rc;
1447 void __user *argp = (void __user *)arg;
1447#ifdef PCMCIA_DEBUG 1448#ifdef PCMCIA_DEBUG
1448 char *ioctl_names[CM_IOC_MAXNR + 1] = { 1449 char *ioctl_names[CM_IOC_MAXNR + 1] = {
1449 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", 1450 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
@@ -1481,11 +1482,11 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1481 _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd); 1482 _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd);
1482 1483
1483 if (_IOC_DIR(cmd) & _IOC_READ) { 1484 if (_IOC_DIR(cmd) & _IOC_READ) {
1484 if (!access_ok(VERIFY_WRITE, (void *)arg, size)) 1485 if (!access_ok(VERIFY_WRITE, argp, size))
1485 return -EFAULT; 1486 return -EFAULT;
1486 } 1487 }
1487 if (_IOC_DIR(cmd) & _IOC_WRITE) { 1488 if (_IOC_DIR(cmd) & _IOC_WRITE) {
1488 if (!access_ok(VERIFY_READ, (void *)arg, size)) 1489 if (!access_ok(VERIFY_READ, argp, size))
1489 return -EFAULT; 1490 return -EFAULT;
1490 } 1491 }
1491 1492
@@ -1506,14 +1507,14 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1506 status |= CM_NO_READER; 1507 status |= CM_NO_READER;
1507 if (test_bit(IS_BAD_CARD, &dev->flags)) 1508 if (test_bit(IS_BAD_CARD, &dev->flags))
1508 status |= CM_BAD_CARD; 1509 status |= CM_BAD_CARD;
1509 if (copy_to_user((int *)arg, &status, sizeof(int))) 1510 if (copy_to_user(argp, &status, sizeof(int)))
1510 return -EFAULT; 1511 return -EFAULT;
1511 } 1512 }
1512 return 0; 1513 return 0;
1513 case CM_IOCGATR: 1514 case CM_IOCGATR:
1514 DEBUGP(4, dev, "... in CM_IOCGATR\n"); 1515 DEBUGP(4, dev, "... in CM_IOCGATR\n");
1515 { 1516 {
1516 struct atreq *atreq = (struct atreq *) arg; 1517 struct atreq __user *atreq = argp;
1517 int tmp; 1518 int tmp;
1518 /* allow nonblocking io and being interrupted */ 1519 /* allow nonblocking io and being interrupted */
1519 if (wait_event_interruptible 1520 if (wait_event_interruptible
@@ -1597,7 +1598,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1597 { 1598 {
1598 struct ptsreq krnptsreq; 1599 struct ptsreq krnptsreq;
1599 1600
1600 if (copy_from_user(&krnptsreq, (struct ptsreq *) arg, 1601 if (copy_from_user(&krnptsreq, argp,
1601 sizeof(struct ptsreq))) 1602 sizeof(struct ptsreq)))
1602 return -EFAULT; 1603 return -EFAULT;
1603 1604
@@ -1641,7 +1642,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1641 int old_pc_debug = 0; 1642 int old_pc_debug = 0;
1642 1643
1643 old_pc_debug = pc_debug; 1644 old_pc_debug = pc_debug;
1644 if (copy_from_user(&pc_debug, (int *)arg, sizeof(int))) 1645 if (copy_from_user(&pc_debug, argp, sizeof(int)))
1645 return -EFAULT; 1646 return -EFAULT;
1646 1647
1647 if (old_pc_debug != pc_debug) 1648 if (old_pc_debug != pc_debug)
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c
index 65830ec71042..c800cce73c1e 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/char/watchdog/booke_wdt.c
@@ -72,7 +72,7 @@ static __inline__ void booke_wdt_ping(void)
72/* 72/*
73 * booke_wdt_write: 73 * booke_wdt_write:
74 */ 74 */
75static ssize_t booke_wdt_write (struct file *file, const char *buf, 75static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
76 size_t count, loff_t *ppos) 76 size_t count, loff_t *ppos)
77{ 77{
78 booke_wdt_ping(); 78 booke_wdt_ping();
@@ -92,14 +92,15 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
92 unsigned int cmd, unsigned long arg) 92 unsigned int cmd, unsigned long arg)
93{ 93{
94 u32 tmp = 0; 94 u32 tmp = 0;
95 u32 __user *p = (u32 __user *)arg;
95 96
96 switch (cmd) { 97 switch (cmd) {
97 case WDIOC_GETSUPPORT: 98 case WDIOC_GETSUPPORT:
98 if (copy_to_user ((struct watchdog_info *) arg, &ident, 99 if (copy_to_user ((struct watchdog_info __user *) arg, &ident,
99 sizeof(struct watchdog_info))) 100 sizeof(struct watchdog_info)))
100 return -EFAULT; 101 return -EFAULT;
101 case WDIOC_GETSTATUS: 102 case WDIOC_GETSTATUS:
102 return put_user(ident.options, (u32 *) arg); 103 return put_user(ident.options, p);
103 case WDIOC_GETBOOTSTATUS: 104 case WDIOC_GETBOOTSTATUS:
104 /* XXX: something is clearing TSR */ 105 /* XXX: something is clearing TSR */
105 tmp = mfspr(SPRN_TSR) & TSR_WRS(3); 106 tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
@@ -109,14 +110,14 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
109 booke_wdt_ping(); 110 booke_wdt_ping();
110 return 0; 111 return 0;
111 case WDIOC_SETTIMEOUT: 112 case WDIOC_SETTIMEOUT:
112 if (get_user(booke_wdt_period, (u32 *) arg)) 113 if (get_user(booke_wdt_period, p))
113 return -EFAULT; 114 return -EFAULT;
114 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); 115 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
115 return 0; 116 return 0;
116 case WDIOC_GETTIMEOUT: 117 case WDIOC_GETTIMEOUT:
117 return put_user(booke_wdt_period, (u32 *) arg); 118 return put_user(booke_wdt_period, p);
118 case WDIOC_SETOPTIONS: 119 case WDIOC_SETOPTIONS:
119 if (get_user(tmp, (u32 *) arg)) 120 if (get_user(tmp, p))
120 return -EINVAL; 121 return -EINVAL;
121 if (tmp == WDIOS_ENABLECARD) { 122 if (tmp == WDIOS_ENABLECARD) {
122 booke_wdt_ping(); 123 booke_wdt_ping();
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c
index 619e2ffca33f..dacfe31caccf 100644
--- a/drivers/char/watchdog/wdrtas.c
+++ b/drivers/char/watchdog/wdrtas.c
@@ -320,7 +320,7 @@ static int
320wdrtas_ioctl(struct inode *inode, struct file *file, 320wdrtas_ioctl(struct inode *inode, struct file *file,
321 unsigned int cmd, unsigned long arg) 321 unsigned int cmd, unsigned long arg)
322{ 322{
323 int __user *argp = (void *)arg; 323 int __user *argp = (void __user *)arg;
324 int i; 324 int i;
325 static struct watchdog_info wdinfo = { 325 static struct watchdog_info wdinfo = {
326 .options = WDRTAS_SUPPORTED_MASK, 326 .options = WDRTAS_SUPPORTED_MASK,
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index 6d83299e7c9b..dfedb777d8c9 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -105,8 +105,8 @@ static int create_packet(void *data, size_t length)
105 int ordernum = 0; 105 int ordernum = 0;
106 int retval = 0; 106 int retval = 0;
107 unsigned int packet_array_size = 0; 107 unsigned int packet_array_size = 0;
108 void **invalid_addr_packet_array = 0; 108 void **invalid_addr_packet_array = NULL;
109 void *packet_data_temp_buf = 0; 109 void *packet_data_temp_buf = NULL;
110 unsigned int idx = 0; 110 unsigned int idx = 0;
111 111
112 pr_debug("create_packet: entry \n"); 112 pr_debug("create_packet: entry \n");
@@ -178,7 +178,7 @@ static int create_packet(void *data, size_t length)
178 packet_data_temp_buf), 178 packet_data_temp_buf),
179 allocation_floor); 179 allocation_floor);
180 invalid_addr_packet_array[idx++] = packet_data_temp_buf; 180 invalid_addr_packet_array[idx++] = packet_data_temp_buf;
181 packet_data_temp_buf = 0; 181 packet_data_temp_buf = NULL;
182 } 182 }
183 } 183 }
184 spin_lock(&rbu_data.lock); 184 spin_lock(&rbu_data.lock);
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 31e649a9ff71..1c81174595b3 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -807,14 +807,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
807 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX 807 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX
808endchoice 808endchoice
809 809
810config BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
811 bool "Enable burstable Mode on DbDMA"
812 default false
813 depends BLK_DEV_IDE_AU1XXX
814 help
815 This option enable the burstable Flag on DbDMA controller
816 (cf. "AMD Alchemy 'Au1200' Processor Data Book - PRELIMINARY").
817
818config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ 810config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
819 int "Maximum transfer size (KB) per request (up to 128)" 811 int "Maximum transfer size (KB) per request (up to 128)"
820 default "128" 812 default "128"
@@ -940,7 +932,7 @@ config BLK_DEV_Q40IDE
940 932
941config BLK_DEV_MPC8xx_IDE 933config BLK_DEV_MPC8xx_IDE
942 bool "MPC8xx IDE support" 934 bool "MPC8xx IDE support"
943 depends on 8xx 935 depends on 8xx && IDE=y && BLK_DEV_IDE=y
944 help 936 help
945 This option provides support for IDE on Motorola MPC8xx Systems. 937 This option provides support for IDE on Motorola MPC8xx Systems.
946 Please see 'Type of MPC8xx IDE interface' for details. 938 Please see 'Type of MPC8xx IDE interface' for details.
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 9455e42abb23..b4d7a3efb90f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1292,7 +1292,6 @@ static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
1292 struct cdrom_info *info = drive->driver_data; 1292 struct cdrom_info *info = drive->driver_data;
1293 1293
1294 info->dma = 0; 1294 info->dma = 0;
1295 info->cmd = 0;
1296 info->start_seek = jiffies; 1295 info->start_seek = jiffies;
1297 return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation); 1296 return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation);
1298} 1297}
@@ -1344,8 +1343,6 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
1344 (rq->nr_sectors & (sectors_per_frame - 1))) 1343 (rq->nr_sectors & (sectors_per_frame - 1)))
1345 info->dma = 0; 1344 info->dma = 0;
1346 1345
1347 info->cmd = READ;
1348
1349 /* Start sending the read request to the drive. */ 1346 /* Start sending the read request to the drive. */
1350 return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation); 1347 return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation);
1351} 1348}
@@ -1484,7 +1481,6 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
1484 struct cdrom_info *info = drive->driver_data; 1481 struct cdrom_info *info = drive->driver_data;
1485 1482
1486 info->dma = 0; 1483 info->dma = 0;
1487 info->cmd = 0;
1488 rq->flags &= ~REQ_FAILED; 1484 rq->flags &= ~REQ_FAILED;
1489 len = rq->data_len; 1485 len = rq->data_len;
1490 1486
@@ -1891,7 +1887,6 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
1891 /* use dma, if possible. we don't need to check more, since we 1887 /* use dma, if possible. we don't need to check more, since we
1892 * know that the transfer is always (at least!) frame aligned */ 1888 * know that the transfer is always (at least!) frame aligned */
1893 info->dma = drive->using_dma ? 1 : 0; 1889 info->dma = drive->using_dma ? 1 : 0;
1894 info->cmd = WRITE;
1895 1890
1896 info->devinfo.media_written = 1; 1891 info->devinfo.media_written = 1;
1897 1892
@@ -1916,7 +1911,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1916 rq->flags |= REQ_QUIET; 1911 rq->flags |= REQ_QUIET;
1917 1912
1918 info->dma = 0; 1913 info->dma = 0;
1919 info->cmd = 0;
1920 1914
1921 /* 1915 /*
1922 * sg request 1916 * sg request
@@ -1925,7 +1919,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1925 int mask = drive->queue->dma_alignment; 1919 int mask = drive->queue->dma_alignment;
1926 unsigned long addr = (unsigned long) page_address(bio_page(rq->bio)); 1920 unsigned long addr = (unsigned long) page_address(bio_page(rq->bio));
1927 1921
1928 info->cmd = rq_data_dir(rq);
1929 info->dma = drive->using_dma; 1922 info->dma = drive->using_dma;
1930 1923
1931 /* 1924 /*
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 7ca3e5afc665..ad1f2ed14a37 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -480,7 +480,6 @@ struct cdrom_info {
480 480
481 struct request request_sense_request; 481 struct request request_sense_request;
482 int dma; 482 int dma;
483 int cmd;
484 unsigned long last_block; 483 unsigned long last_block;
485 unsigned long start_seek; 484 unsigned long start_seek;
486 /* Buffer to hold mechanism status and changer slot table. */ 485 /* Buffer to hold mechanism status and changer slot table. */
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index f4e3d3527b0e..449522f0540c 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1034,12 +1034,12 @@ static int ide_disk_remove(struct device *dev)
1034 struct ide_disk_obj *idkp = drive->driver_data; 1034 struct ide_disk_obj *idkp = drive->driver_data;
1035 struct gendisk *g = idkp->disk; 1035 struct gendisk *g = idkp->disk;
1036 1036
1037 ide_cacheflush_p(drive);
1038
1039 ide_unregister_subdriver(drive, idkp->driver); 1037 ide_unregister_subdriver(drive, idkp->driver);
1040 1038
1041 del_gendisk(g); 1039 del_gendisk(g);
1042 1040
1041 ide_cacheflush_p(drive);
1042
1043 ide_disk_put(idkp); 1043 ide_disk_put(idkp);
1044 1044
1045 return 0; 1045 return 0;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 1e1531334c25..0523da77425a 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -90,11 +90,6 @@
90#include <asm/io.h> 90#include <asm/io.h>
91#include <asm/irq.h> 91#include <asm/irq.h>
92 92
93struct drive_list_entry {
94 const char *id_model;
95 const char *id_firmware;
96};
97
98static const struct drive_list_entry drive_whitelist [] = { 93static const struct drive_list_entry drive_whitelist [] = {
99 94
100 { "Micropolis 2112A" , "ALL" }, 95 { "Micropolis 2112A" , "ALL" },
@@ -139,7 +134,7 @@ static const struct drive_list_entry drive_blacklist [] = {
139}; 134};
140 135
141/** 136/**
142 * in_drive_list - look for drive in black/white list 137 * ide_in_drive_list - look for drive in black/white list
143 * @id: drive identifier 138 * @id: drive identifier
144 * @drive_table: list to inspect 139 * @drive_table: list to inspect
145 * 140 *
@@ -147,7 +142,7 @@ static const struct drive_list_entry drive_blacklist [] = {
147 * Returns 1 if the drive is found in the table. 142 * Returns 1 if the drive is found in the table.
148 */ 143 */
149 144
150static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) 145int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
151{ 146{
152 for ( ; drive_table->id_model ; drive_table++) 147 for ( ; drive_table->id_model ; drive_table++)
153 if ((!strcmp(drive_table->id_model, id->model)) && 148 if ((!strcmp(drive_table->id_model, id->model)) &&
@@ -157,6 +152,8 @@ static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *d
157 return 0; 152 return 0;
158} 153}
159 154
155EXPORT_SYMBOL_GPL(ide_in_drive_list);
156
160/** 157/**
161 * ide_dma_intr - IDE DMA interrupt handler 158 * ide_dma_intr - IDE DMA interrupt handler
162 * @drive: the drive the interrupt is for 159 * @drive: the drive the interrupt is for
@@ -663,7 +660,7 @@ int __ide_dma_bad_drive (ide_drive_t *drive)
663{ 660{
664 struct hd_driveid *id = drive->id; 661 struct hd_driveid *id = drive->id;
665 662
666 int blacklist = in_drive_list(id, drive_blacklist); 663 int blacklist = ide_in_drive_list(id, drive_blacklist);
667 if (blacklist) { 664 if (blacklist) {
668 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n", 665 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n",
669 drive->name, id->model); 666 drive->name, id->model);
@@ -677,7 +674,7 @@ EXPORT_SYMBOL(__ide_dma_bad_drive);
677int __ide_dma_good_drive (ide_drive_t *drive) 674int __ide_dma_good_drive (ide_drive_t *drive)
678{ 675{
679 struct hd_driveid *id = drive->id; 676 struct hd_driveid *id = drive->id;
680 return in_drive_list(id, drive_whitelist); 677 return ide_in_drive_list(id, drive_whitelist);
681} 678}
682 679
683EXPORT_SYMBOL(__ide_dma_good_drive); 680EXPORT_SYMBOL(__ide_dma_good_drive);
diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile
index 578e52a59588..677c7b2bac92 100644
--- a/drivers/ide/mips/Makefile
+++ b/drivers/ide/mips/Makefile
@@ -1 +1,4 @@
1obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o 1obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o
2obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o
3
4EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 2b6327c576b9..32431dcf5d8e 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -31,865 +31,638 @@
31 */ 31 */
32#undef REALLY_SLOW_IO /* most systems can safely undef this */ 32#undef REALLY_SLOW_IO /* most systems can safely undef this */
33 33
34#include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */
35#include <linux/types.h> 34#include <linux/types.h>
36#include <linux/module.h> 35#include <linux/module.h>
37#include <linux/kernel.h> 36#include <linux/kernel.h>
38#include <linux/delay.h> 37#include <linux/delay.h>
39#include <linux/timer.h> 38#include <linux/platform_device.h>
40#include <linux/mm.h> 39
41#include <linux/ioport.h>
42#include <linux/hdreg.h>
43#include <linux/init.h> 40#include <linux/init.h>
44#include <linux/ide.h> 41#include <linux/ide.h>
45#include <linux/sysdev.h> 42#include <linux/sysdev.h>
46 43
47#include <linux/dma-mapping.h> 44#include <linux/dma-mapping.h>
48 45
46#include "ide-timing.h"
47
49#include <asm/io.h> 48#include <asm/io.h>
50#include <asm/mach-au1x00/au1xxx.h> 49#include <asm/mach-au1x00/au1xxx.h>
51#include <asm/mach-au1x00/au1xxx_dbdma.h> 50#include <asm/mach-au1x00/au1xxx_dbdma.h>
52 51
53#if CONFIG_PM
54#include <asm/mach-au1x00/au1xxx_pm.h>
55#endif
56
57#include <asm/mach-au1x00/au1xxx_ide.h> 52#include <asm/mach-au1x00/au1xxx_ide.h>
58 53
59#define DRV_NAME "au1200-ide" 54#define DRV_NAME "au1200-ide"
60#define DRV_VERSION "1.0" 55#define DRV_VERSION "1.0"
61#define DRV_AUTHOR "AMD PCS / Pete Popov <ppopov@embeddedalley.com>" 56#define DRV_AUTHOR "Enrico Walther <enrico.walther@amd.com> / Pete Popov <ppopov@embeddedalley.com>"
62#define DRV_DESC "Au1200 IDE"
63
64static _auide_hwif auide_hwif;
65static spinlock_t ide_tune_drive_spin_lock = SPIN_LOCK_UNLOCKED;
66static spinlock_t ide_tune_chipset_spin_lock = SPIN_LOCK_UNLOCKED;
67static int dbdma_init_done = 0;
68
69/*
70 * local I/O functions
71 */
72u8 auide_inb(unsigned long port)
73{
74 return (au_readb(port));
75}
76 57
77u16 auide_inw(unsigned long port) 58/* enable the burstmode in the dbdma */
78{ 59#define IDE_AU1XXX_BURSTMODE 1
79 return (au_readw(port));
80}
81 60
82u32 auide_inl(unsigned long port) 61static _auide_hwif auide_hwif;
83{ 62static int dbdma_init_done;
84 return (au_readl(port));
85}
86 63
87void auide_insw(unsigned long port, void *addr, u32 count)
88{
89#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) 64#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
90 65
91 _auide_hwif *ahwif = &auide_hwif; 66void auide_insw(unsigned long port, void *addr, u32 count)
92 chan_tab_t *ctp;
93 au1x_ddma_desc_t *dp;
94
95 if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1,
96 DDMA_FLAGS_NOIE)) {
97 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
98 return;
99 }
100 ctp = *((chan_tab_t **)ahwif->rx_chan);
101 dp = ctp->cur_ptr;
102 while (dp->dscr_cmd0 & DSCR_CMD0_V)
103 ;
104 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
105#else
106 while (count--)
107 {
108 *(u16 *)addr = au_readw(port);
109 addr +=2 ;
110 }
111#endif
112}
113
114void auide_insl(unsigned long port, void *addr, u32 count)
115{
116 while (count--)
117 {
118 *(u32 *)addr = au_readl(port);
119 /* NOTE: For IDE interfaces over PCMCIA,
120 * 32-bit access does not work
121 */
122 addr += 4;
123 }
124}
125
126void auide_outb(u8 addr, unsigned long port)
127{ 67{
128 return (au_writeb(addr, port)); 68 _auide_hwif *ahwif = &auide_hwif;
129} 69 chan_tab_t *ctp;
70 au1x_ddma_desc_t *dp;
130 71
131void auide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port) 72 if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1,
132{ 73 DDMA_FLAGS_NOIE)) {
133 return (au_writeb(addr, port)); 74 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
75 return;
76 }
77 ctp = *((chan_tab_t **)ahwif->rx_chan);
78 dp = ctp->cur_ptr;
79 while (dp->dscr_cmd0 & DSCR_CMD0_V)
80 ;
81 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
134} 82}
135 83
136void auide_outw(u16 addr, unsigned long port) 84void auide_outsw(unsigned long port, void *addr, u32 count)
137{ 85{
138 return (au_writew(addr, port)); 86 _auide_hwif *ahwif = &auide_hwif;
139} 87 chan_tab_t *ctp;
88 au1x_ddma_desc_t *dp;
140 89
141void auide_outl(u32 addr, unsigned long port) 90 if(!put_source_flags(ahwif->tx_chan, (void*)addr,
142{ 91 count << 1, DDMA_FLAGS_NOIE)) {
143 return (au_writel(addr, port)); 92 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
93 return;
94 }
95 ctp = *((chan_tab_t **)ahwif->tx_chan);
96 dp = ctp->cur_ptr;
97 while (dp->dscr_cmd0 & DSCR_CMD0_V)
98 ;
99 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
144} 100}
145 101
146void auide_outsw(unsigned long port, void *addr, u32 count)
147{
148#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
149 _auide_hwif *ahwif = &auide_hwif;
150 chan_tab_t *ctp;
151 au1x_ddma_desc_t *dp;
152
153 if(!put_source_flags(ahwif->tx_chan, (void*)addr,
154 count << 1, DDMA_FLAGS_NOIE)) {
155 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
156 return;
157 }
158 ctp = *((chan_tab_t **)ahwif->tx_chan);
159 dp = ctp->cur_ptr;
160 while (dp->dscr_cmd0 & DSCR_CMD0_V)
161 ;
162 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
163#else
164 while (count--)
165 {
166 au_writew(*(u16 *)addr, port);
167 addr += 2;
168 }
169#endif 102#endif
170}
171
172void auide_outsl(unsigned long port, void *addr, u32 count)
173{
174 while (count--)
175 {
176 au_writel(*(u32 *)addr, port);
177 /* NOTE: For IDE interfaces over PCMCIA,
178 * 32-bit access does not work
179 */
180 addr += 4;
181 }
182}
183 103
184static void auide_tune_drive(ide_drive_t *drive, byte pio) 104static void auide_tune_drive(ide_drive_t *drive, byte pio)
185{ 105{
186 int mem_sttime; 106 int mem_sttime;
187 int mem_stcfg; 107 int mem_stcfg;
188 unsigned long flags; 108 u8 speed;
189 u8 speed; 109
190 110 /* get the best pio mode for the drive */
191 /* get the best pio mode for the drive */ 111 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
192 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 112
193 113 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n",
194 printk("%s: setting Au1XXX IDE to PIO mode%d\n", 114 drive->name, pio);
195 drive->name, pio); 115
196 116 mem_sttime = 0;
197 spin_lock_irqsave(&ide_tune_drive_spin_lock, flags); 117 mem_stcfg = au_readl(MEM_STCFG2);
198 118
199 mem_sttime = 0; 119 /* set pio mode! */
200 mem_stcfg = au_readl(MEM_STCFG2); 120 switch(pio) {
201 121 case 0:
202 /* set pio mode! */ 122 mem_sttime = SBC_IDE_TIMING(PIO0);
203 switch(pio) { 123
204 case 0: 124 /* set configuration for RCS2# */
205 /* set timing parameters for RCS2# */ 125 mem_stcfg |= TS_MASK;
206 mem_sttime = SBC_IDE_PIO0_TWCS 126 mem_stcfg &= ~TCSOE_MASK;
207 | SBC_IDE_PIO0_TCSH 127 mem_stcfg &= ~TOECS_MASK;
208 | SBC_IDE_PIO0_TCSOFF 128 mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS;
209 | SBC_IDE_PIO0_TWP 129 break;
210 | SBC_IDE_PIO0_TCSW 130
211 | SBC_IDE_PIO0_TPM 131 case 1:
212 | SBC_IDE_PIO0_TA; 132 mem_sttime = SBC_IDE_TIMING(PIO1);
213 /* set configuration for RCS2# */ 133
214 mem_stcfg |= TS_MASK; 134 /* set configuration for RCS2# */
215 mem_stcfg &= ~TCSOE_MASK; 135 mem_stcfg |= TS_MASK;
216 mem_stcfg &= ~TOECS_MASK; 136 mem_stcfg &= ~TCSOE_MASK;
217 mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS; 137 mem_stcfg &= ~TOECS_MASK;
218 138 mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS;
219 au_writel(mem_sttime,MEM_STTIME2); 139 break;
220 au_writel(mem_stcfg,MEM_STCFG2); 140
221 break; 141 case 2:
222 142 mem_sttime = SBC_IDE_TIMING(PIO2);
223 case 1: 143
224 /* set timing parameters for RCS2# */ 144 /* set configuration for RCS2# */
225 mem_sttime = SBC_IDE_PIO1_TWCS 145 mem_stcfg &= ~TS_MASK;
226 | SBC_IDE_PIO1_TCSH 146 mem_stcfg &= ~TCSOE_MASK;
227 | SBC_IDE_PIO1_TCSOFF 147 mem_stcfg &= ~TOECS_MASK;
228 | SBC_IDE_PIO1_TWP 148 mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS;
229 | SBC_IDE_PIO1_TCSW 149 break;
230 | SBC_IDE_PIO1_TPM 150
231 | SBC_IDE_PIO1_TA; 151 case 3:
232 /* set configuration for RCS2# */ 152 mem_sttime = SBC_IDE_TIMING(PIO3);
233 mem_stcfg |= TS_MASK; 153
234 mem_stcfg &= ~TCSOE_MASK; 154 /* set configuration for RCS2# */
235 mem_stcfg &= ~TOECS_MASK; 155 mem_stcfg &= ~TS_MASK;
236 mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS; 156 mem_stcfg &= ~TCSOE_MASK;
237 break; 157 mem_stcfg &= ~TOECS_MASK;
238 158 mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS;
239 case 2: 159
240 /* set timing parameters for RCS2# */ 160 break;
241 mem_sttime = SBC_IDE_PIO2_TWCS 161
242 | SBC_IDE_PIO2_TCSH 162 case 4:
243 | SBC_IDE_PIO2_TCSOFF 163 mem_sttime = SBC_IDE_TIMING(PIO4);
244 | SBC_IDE_PIO2_TWP 164
245 | SBC_IDE_PIO2_TCSW 165 /* set configuration for RCS2# */
246 | SBC_IDE_PIO2_TPM 166 mem_stcfg &= ~TS_MASK;
247 | SBC_IDE_PIO2_TA; 167 mem_stcfg &= ~TCSOE_MASK;
248 /* set configuration for RCS2# */ 168 mem_stcfg &= ~TOECS_MASK;
249 mem_stcfg &= ~TS_MASK; 169 mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS;
250 mem_stcfg &= ~TCSOE_MASK; 170 break;
251 mem_stcfg &= ~TOECS_MASK; 171 }
252 mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS; 172
253 break; 173 au_writel(mem_sttime,MEM_STTIME2);
254 174 au_writel(mem_stcfg,MEM_STCFG2);
255 case 3: 175
256 /* set timing parameters for RCS2# */ 176 speed = pio + XFER_PIO_0;
257 mem_sttime = SBC_IDE_PIO3_TWCS 177 ide_config_drive_speed(drive, speed);
258 | SBC_IDE_PIO3_TCSH
259 | SBC_IDE_PIO3_TCSOFF
260 | SBC_IDE_PIO3_TWP
261 | SBC_IDE_PIO3_TCSW
262 | SBC_IDE_PIO3_TPM
263 | SBC_IDE_PIO3_TA;
264 /* set configuration for RCS2# */
265 mem_stcfg |= TS_MASK;
266 mem_stcfg &= ~TS_MASK;
267 mem_stcfg &= ~TCSOE_MASK;
268 mem_stcfg &= ~TOECS_MASK;
269 mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS;
270
271 break;
272
273 case 4:
274 /* set timing parameters for RCS2# */
275 mem_sttime = SBC_IDE_PIO4_TWCS
276 | SBC_IDE_PIO4_TCSH
277 | SBC_IDE_PIO4_TCSOFF
278 | SBC_IDE_PIO4_TWP
279 | SBC_IDE_PIO4_TCSW
280 | SBC_IDE_PIO4_TPM
281 | SBC_IDE_PIO4_TA;
282 /* set configuration for RCS2# */
283 mem_stcfg &= ~TS_MASK;
284 mem_stcfg &= ~TCSOE_MASK;
285 mem_stcfg &= ~TOECS_MASK;
286 mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS;
287 break;
288 }
289
290 au_writel(mem_sttime,MEM_STTIME2);
291 au_writel(mem_stcfg,MEM_STCFG2);
292
293 spin_unlock_irqrestore(&ide_tune_drive_spin_lock, flags);
294
295 speed = pio + XFER_PIO_0;
296 ide_config_drive_speed(drive, speed);
297} 178}
298 179
299static int auide_tune_chipset (ide_drive_t *drive, u8 speed) 180static int auide_tune_chipset (ide_drive_t *drive, u8 speed)
300{ 181{
301 u8 mode = 0; 182 int mem_sttime;
302 int mem_sttime; 183 int mem_stcfg;
303 int mem_stcfg; 184 unsigned long mode;
304 unsigned long flags; 185
305#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 186#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
306 struct hd_driveid *id = drive->id; 187 if (ide_use_dma(drive))
307 188 mode = ide_dma_speed(drive, 0);
308 /*
309 * Now see what the current drive is capable of,
310 * selecting UDMA only if the mate said it was ok.
311 */
312 if (id && (id->capability & 1) && drive->autodma &&
313 !__ide_dma_bad_drive(drive)) {
314 if (!mode && (id->field_valid & 2) && (id->dma_mword & 7)) {
315 if (id->dma_mword & 4)
316 mode = XFER_MW_DMA_2;
317 else if (id->dma_mword & 2)
318 mode = XFER_MW_DMA_1;
319 else if (id->dma_mword & 1)
320 mode = XFER_MW_DMA_0;
321 }
322 }
323#endif 189#endif
324 190
325 spin_lock_irqsave(&ide_tune_chipset_spin_lock, flags); 191 mem_sttime = 0;
192 mem_stcfg = au_readl(MEM_STCFG2);
326 193
327 mem_sttime = 0; 194 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
328 mem_stcfg = au_readl(MEM_STCFG2); 195 auide_tune_drive(drive, speed - XFER_PIO_0);
329 196 return 0;
330 switch(speed) { 197 }
331 case XFER_PIO_4: 198
332 case XFER_PIO_3: 199 switch(speed) {
333 case XFER_PIO_2:
334 case XFER_PIO_1:
335 case XFER_PIO_0:
336 auide_tune_drive(drive, (speed - XFER_PIO_0));
337 break;
338#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 200#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
339 case XFER_MW_DMA_2: 201 case XFER_MW_DMA_2:
340 /* set timing parameters for RCS2# */ 202 mem_sttime = SBC_IDE_TIMING(MDMA2);
341 mem_sttime = SBC_IDE_MDMA2_TWCS 203
342 | SBC_IDE_MDMA2_TCSH 204 /* set configuration for RCS2# */
343 | SBC_IDE_MDMA2_TCSOFF 205 mem_stcfg &= ~TS_MASK;
344 | SBC_IDE_MDMA2_TWP 206 mem_stcfg &= ~TCSOE_MASK;
345 | SBC_IDE_MDMA2_TCSW 207 mem_stcfg &= ~TOECS_MASK;
346 | SBC_IDE_MDMA2_TPM 208 mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS;
347 | SBC_IDE_MDMA2_TA; 209
348 /* set configuration for RCS2# */ 210 mode = XFER_MW_DMA_2;
349 mem_stcfg &= ~TS_MASK; 211 break;
350 mem_stcfg &= ~TCSOE_MASK; 212 case XFER_MW_DMA_1:
351 mem_stcfg &= ~TOECS_MASK; 213 mem_sttime = SBC_IDE_TIMING(MDMA1);
352 mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS; 214
353 215 /* set configuration for RCS2# */
354 mode = XFER_MW_DMA_2; 216 mem_stcfg &= ~TS_MASK;
355 break; 217 mem_stcfg &= ~TCSOE_MASK;
356 case XFER_MW_DMA_1: 218 mem_stcfg &= ~TOECS_MASK;
357 /* set timing parameters for RCS2# */ 219 mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS;
358 mem_sttime = SBC_IDE_MDMA1_TWCS 220
359 | SBC_IDE_MDMA1_TCSH 221 mode = XFER_MW_DMA_1;
360 | SBC_IDE_MDMA1_TCSOFF 222 break;
361 | SBC_IDE_MDMA1_TWP 223 case XFER_MW_DMA_0:
362 | SBC_IDE_MDMA1_TCSW 224 mem_sttime = SBC_IDE_TIMING(MDMA0);
363 | SBC_IDE_MDMA1_TPM 225
364 | SBC_IDE_MDMA1_TA; 226 /* set configuration for RCS2# */
365 /* set configuration for RCS2# */ 227 mem_stcfg |= TS_MASK;
366 mem_stcfg &= ~TS_MASK; 228 mem_stcfg &= ~TCSOE_MASK;
367 mem_stcfg &= ~TCSOE_MASK; 229 mem_stcfg &= ~TOECS_MASK;
368 mem_stcfg &= ~TOECS_MASK; 230 mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS;
369 mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS; 231
370 232 mode = XFER_MW_DMA_0;
371 mode = XFER_MW_DMA_1; 233 break;
372 break;
373 case XFER_MW_DMA_0:
374 /* set timing parameters for RCS2# */
375 mem_sttime = SBC_IDE_MDMA0_TWCS
376 | SBC_IDE_MDMA0_TCSH
377 | SBC_IDE_MDMA0_TCSOFF
378 | SBC_IDE_MDMA0_TWP
379 | SBC_IDE_MDMA0_TCSW
380 | SBC_IDE_MDMA0_TPM
381 | SBC_IDE_MDMA0_TA;
382 /* set configuration for RCS2# */
383 mem_stcfg |= TS_MASK;
384 mem_stcfg &= ~TCSOE_MASK;
385 mem_stcfg &= ~TOECS_MASK;
386 mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS;
387
388 mode = XFER_MW_DMA_0;
389 break;
390#endif 234#endif
391 default: 235 default:
392 return 1; 236 return 1;
393 } 237 }
394 238
395 /* 239 if (ide_config_drive_speed(drive, mode))
396 * Tell the drive to switch to the new mode; abort on failure. 240 return 1;
397 */
398 if (!mode || ide_config_drive_speed(drive, mode))
399 {
400 return 1; /* failure */
401 }
402
403
404 au_writel(mem_sttime,MEM_STTIME2);
405 au_writel(mem_stcfg,MEM_STCFG2);
406 241
407 spin_unlock_irqrestore(&ide_tune_chipset_spin_lock, flags); 242 au_writel(mem_sttime,MEM_STTIME2);
243 au_writel(mem_stcfg,MEM_STCFG2);
408 244
409 return 0; 245 return 0;
410} 246}
411 247
412/* 248/*
413 * Multi-Word DMA + DbDMA functions 249 * Multi-Word DMA + DbDMA functions
414 */ 250 */
415#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
416 251
417static int in_drive_list(struct hd_driveid *id, 252#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
418 const struct drive_list_entry *drive_table)
419{
420 for ( ; drive_table->id_model ; drive_table++){
421 if ((!strcmp(drive_table->id_model, id->model)) &&
422 ((strstr(drive_table->id_firmware, id->fw_rev)) ||
423 (!strcmp(drive_table->id_firmware, "ALL")))
424 )
425 return 1;
426 }
427 return 0;
428}
429 253
430static int auide_build_sglist(ide_drive_t *drive, struct request *rq) 254static int auide_build_sglist(ide_drive_t *drive, struct request *rq)
431{ 255{
432 ide_hwif_t *hwif = drive->hwif; 256 ide_hwif_t *hwif = drive->hwif;
433 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; 257 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
434 struct scatterlist *sg = hwif->sg_table; 258 struct scatterlist *sg = hwif->sg_table;
435 259
436 ide_map_sg(drive, rq); 260 ide_map_sg(drive, rq);
437 261
438 if (rq_data_dir(rq) == READ) 262 if (rq_data_dir(rq) == READ)
439 hwif->sg_dma_direction = DMA_FROM_DEVICE; 263 hwif->sg_dma_direction = DMA_FROM_DEVICE;
440 else 264 else
441 hwif->sg_dma_direction = DMA_TO_DEVICE; 265 hwif->sg_dma_direction = DMA_TO_DEVICE;
442 266
443 return dma_map_sg(ahwif->dev, sg, hwif->sg_nents, 267 return dma_map_sg(ahwif->dev, sg, hwif->sg_nents,
444 hwif->sg_dma_direction); 268 hwif->sg_dma_direction);
445} 269}
446 270
447static int auide_build_dmatable(ide_drive_t *drive) 271static int auide_build_dmatable(ide_drive_t *drive)
448{ 272{
449 int i, iswrite, count = 0; 273 int i, iswrite, count = 0;
450 ide_hwif_t *hwif = HWIF(drive); 274 ide_hwif_t *hwif = HWIF(drive);
451 275
452 struct request *rq = HWGROUP(drive)->rq; 276 struct request *rq = HWGROUP(drive)->rq;
453 277
454 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; 278 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
455 struct scatterlist *sg; 279 struct scatterlist *sg;
456 280
457 iswrite = (rq_data_dir(rq) == WRITE); 281 iswrite = (rq_data_dir(rq) == WRITE);
458 /* Save for interrupt context */ 282 /* Save for interrupt context */
459 ahwif->drive = drive; 283 ahwif->drive = drive;
460 284
461 /* Build sglist */ 285 /* Build sglist */
462 hwif->sg_nents = i = auide_build_sglist(drive, rq); 286 hwif->sg_nents = i = auide_build_sglist(drive, rq);
463 287
464 if (!i) 288 if (!i)
465 return 0; 289 return 0;
466 290
467 /* fill the descriptors */ 291 /* fill the descriptors */
468 sg = hwif->sg_table; 292 sg = hwif->sg_table;
469 while (i && sg_dma_len(sg)) { 293 while (i && sg_dma_len(sg)) {
470 u32 cur_addr; 294 u32 cur_addr;
471 u32 cur_len; 295 u32 cur_len;
472 296
473 cur_addr = sg_dma_address(sg); 297 cur_addr = sg_dma_address(sg);
474 cur_len = sg_dma_len(sg); 298 cur_len = sg_dma_len(sg);
475 299
476 while (cur_len) { 300 while (cur_len) {
477 u32 flags = DDMA_FLAGS_NOIE; 301 u32 flags = DDMA_FLAGS_NOIE;
478 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00; 302 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;
479 303
480 if (++count >= PRD_ENTRIES) { 304 if (++count >= PRD_ENTRIES) {
481 printk(KERN_WARNING "%s: DMA table too small\n", 305 printk(KERN_WARNING "%s: DMA table too small\n",
482 drive->name); 306 drive->name);
483 goto use_pio_instead; 307 goto use_pio_instead;
484 } 308 }
485 309
486 /* Lets enable intr for the last descriptor only */ 310 /* Lets enable intr for the last descriptor only */
487 if (1==i) 311 if (1==i)
488 flags = DDMA_FLAGS_IE; 312 flags = DDMA_FLAGS_IE;
489 else 313 else
490 flags = DDMA_FLAGS_NOIE; 314 flags = DDMA_FLAGS_NOIE;
491 315
492 if (iswrite) { 316 if (iswrite) {
493 if(!put_source_flags(ahwif->tx_chan, 317 if(!put_source_flags(ahwif->tx_chan,
494 (void*)(page_address(sg->page) 318 (void*)(page_address(sg->page)
495 + sg->offset), 319 + sg->offset),
496 tc, flags)) { 320 tc, flags)) {
497 printk(KERN_ERR "%s failed %d\n", 321 printk(KERN_ERR "%s failed %d\n",
498 __FUNCTION__, __LINE__); 322 __FUNCTION__, __LINE__);
499 } 323 }
500 } else 324 } else
501 { 325 {
502 if(!put_dest_flags(ahwif->rx_chan, 326 if(!put_dest_flags(ahwif->rx_chan,
503 (void*)(page_address(sg->page) 327 (void*)(page_address(sg->page)
504 + sg->offset), 328 + sg->offset),
505 tc, flags)) { 329 tc, flags)) {
506 printk(KERN_ERR "%s failed %d\n", 330 printk(KERN_ERR "%s failed %d\n",
507 __FUNCTION__, __LINE__); 331 __FUNCTION__, __LINE__);
508 } 332 }
509 } 333 }
510 334
511 cur_addr += tc; 335 cur_addr += tc;
512 cur_len -= tc; 336 cur_len -= tc;
513 } 337 }
514 sg++; 338 sg++;
515 i--; 339 i--;
516 } 340 }
517 341
518 if (count) 342 if (count)
519 return 1; 343 return 1;
520 344
521use_pio_instead: 345 use_pio_instead:
522 dma_unmap_sg(ahwif->dev, 346 dma_unmap_sg(ahwif->dev,
523 hwif->sg_table, 347 hwif->sg_table,
524 hwif->sg_nents, 348 hwif->sg_nents,
525 hwif->sg_dma_direction); 349 hwif->sg_dma_direction);
526 350
527 return 0; /* revert to PIO for this request */ 351 return 0; /* revert to PIO for this request */
528} 352}
529 353
530static int auide_dma_end(ide_drive_t *drive) 354static int auide_dma_end(ide_drive_t *drive)
531{ 355{
532 ide_hwif_t *hwif = HWIF(drive); 356 ide_hwif_t *hwif = HWIF(drive);
533 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; 357 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
534 358
535 if (hwif->sg_nents) { 359 if (hwif->sg_nents) {
536 dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents, 360 dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents,
537 hwif->sg_dma_direction); 361 hwif->sg_dma_direction);
538 hwif->sg_nents = 0; 362 hwif->sg_nents = 0;
539 } 363 }
540 364
541 return 0; 365 return 0;
542} 366}
543 367
544static void auide_dma_start(ide_drive_t *drive ) 368static void auide_dma_start(ide_drive_t *drive )
545{ 369{
546// printk("%s\n", __FUNCTION__);
547} 370}
548 371
549ide_startstop_t auide_dma_intr(ide_drive_t *drive)
550{
551 //printk("%s\n", __FUNCTION__);
552
553 u8 stat = 0, dma_stat = 0;
554
555 dma_stat = HWIF(drive)->ide_dma_end(drive);
556 stat = HWIF(drive)->INB(IDE_STATUS_REG); /* get drive status */
557 if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
558 if (!dma_stat) {
559 struct request *rq = HWGROUP(drive)->rq;
560
561 ide_end_request(drive, 1, rq->nr_sectors);
562 return ide_stopped;
563 }
564 printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
565 drive->name, dma_stat);
566 }
567 return ide_error(drive, "dma_intr", stat);
568}
569 372
570static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) 373static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command)
571{ 374{
572 //printk("%s\n", __FUNCTION__); 375 /* issue cmd to drive */
573 376 ide_execute_command(drive, command, &ide_dma_intr,
574 /* issue cmd to drive */ 377 (2*WAIT_CMD), NULL);
575 ide_execute_command(drive, command, &auide_dma_intr,
576 (2*WAIT_CMD), NULL);
577} 378}
578 379
579static int auide_dma_setup(ide_drive_t *drive) 380static int auide_dma_setup(ide_drive_t *drive)
580{ 381{
581// printk("%s\n", __FUNCTION__); 382 struct request *rq = HWGROUP(drive)->rq;
582
583 if (drive->media != ide_disk)
584 return 1;
585
586 if (!auide_build_dmatable(drive))
587 /* try PIO instead of DMA */
588 return 1;
589 383
590 drive->waiting_for_dma = 1; 384 if (!auide_build_dmatable(drive)) {
385 ide_map_sg(drive, rq);
386 return 1;
387 }
591 388
592 return 0; 389 drive->waiting_for_dma = 1;
390 return 0;
593} 391}
594 392
595static int auide_dma_check(ide_drive_t *drive) 393static int auide_dma_check(ide_drive_t *drive)
596{ 394{
597// printk("%s\n", __FUNCTION__); 395 u8 speed;
598 396
599#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 397#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
600 if( !dbdma_init_done ){ 398
601 auide_hwif.white_list = in_drive_list(drive->id, 399 if( dbdma_init_done == 0 ){
602 dma_white_list); 400 auide_hwif.white_list = ide_in_drive_list(drive->id,
603 auide_hwif.black_list = in_drive_list(drive->id, 401 dma_white_list);
604 dma_black_list); 402 auide_hwif.black_list = ide_in_drive_list(drive->id,
605 auide_hwif.drive = drive; 403 dma_black_list);
606 auide_ddma_init(&auide_hwif); 404 auide_hwif.drive = drive;
607 dbdma_init_done = 1; 405 auide_ddma_init(&auide_hwif);
608 } 406 dbdma_init_done = 1;
407 }
609#endif 408#endif
610 409
611 /* Is the drive in our DMA black list? */ 410 /* Is the drive in our DMA black list? */
612 if ( auide_hwif.black_list ) { 411
613 drive->using_dma = 0; 412 if ( auide_hwif.black_list ) {
614 printk("%s found in dma_blacklist[]! Disabling DMA.\n", 413 drive->using_dma = 0;
615 drive->id->model); 414
616 } 415 /* Borrowed the warning message from ide-dma.c */
617 else
618 drive->using_dma = 1;
619 416
620 return HWIF(drive)->ide_dma_host_on(drive); 417 printk(KERN_WARNING "%s: Disabling DMA for %s (blacklisted)\n",
418 drive->name, drive->id->model);
419 }
420 else
421 drive->using_dma = 1;
422
423 speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA);
424
425 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
426 return HWIF(drive)->ide_dma_on(drive);
427
428 return HWIF(drive)->ide_dma_off_quietly(drive);
621} 429}
622 430
623static int auide_dma_test_irq(ide_drive_t *drive) 431static int auide_dma_test_irq(ide_drive_t *drive)
624{ 432{
625// printk("%s\n", __FUNCTION__); 433 if (drive->waiting_for_dma == 0)
626 434 printk(KERN_WARNING "%s: ide_dma_test_irq \
627 if (!drive->waiting_for_dma)
628 printk(KERN_WARNING "%s: ide_dma_test_irq \
629 called while not waiting\n", drive->name); 435 called while not waiting\n", drive->name);
630 436
631 /* If dbdma didn't execute the STOP command yet, the 437 /* If dbdma didn't execute the STOP command yet, the
632 * active bit is still set 438 * active bit is still set
633 */ 439 */
634 drive->waiting_for_dma++; 440 drive->waiting_for_dma++;
635 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) { 441 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {
636 printk(KERN_WARNING "%s: timeout waiting for ddma to \ 442 printk(KERN_WARNING "%s: timeout waiting for ddma to \
637 complete\n", drive->name); 443 complete\n", drive->name);
638 return 1; 444 return 1;
639 } 445 }
640 udelay(10); 446 udelay(10);
641 return 0; 447 return 0;
642} 448}
643 449
644static int auide_dma_host_on(ide_drive_t *drive) 450static int auide_dma_host_on(ide_drive_t *drive)
645{ 451{
646// printk("%s\n", __FUNCTION__); 452 return 0;
647 return 0;
648} 453}
649 454
650static int auide_dma_on(ide_drive_t *drive) 455static int auide_dma_on(ide_drive_t *drive)
651{ 456{
652// printk("%s\n", __FUNCTION__); 457 drive->using_dma = 1;
653 drive->using_dma = 1; 458 return auide_dma_host_on(drive);
654 return auide_dma_host_on(drive);
655} 459}
656 460
657 461
658static int auide_dma_host_off(ide_drive_t *drive) 462static int auide_dma_host_off(ide_drive_t *drive)
659{ 463{
660// printk("%s\n", __FUNCTION__); 464 return 0;
661 return 0;
662} 465}
663 466
664static int auide_dma_off_quietly(ide_drive_t *drive) 467static int auide_dma_off_quietly(ide_drive_t *drive)
665{ 468{
666// printk("%s\n", __FUNCTION__); 469 drive->using_dma = 0;
667 drive->using_dma = 0; 470 return auide_dma_host_off(drive);
668 return auide_dma_host_off(drive);
669} 471}
670 472
671static int auide_dma_lostirq(ide_drive_t *drive) 473static int auide_dma_lostirq(ide_drive_t *drive)
672{ 474{
673// printk("%s\n", __FUNCTION__); 475 printk(KERN_ERR "%s: IRQ lost\n", drive->name);
674 476 return 0;
675 printk(KERN_ERR "%s: IRQ lost\n", drive->name);
676 return 0;
677} 477}
678 478
679static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs) 479static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs)
680{ 480{
681// printk("%s\n", __FUNCTION__); 481 _auide_hwif *ahwif = (_auide_hwif*)param;
682 482 ahwif->drive->waiting_for_dma = 0;
683 _auide_hwif *ahwif = (_auide_hwif*)param;
684 ahwif->drive->waiting_for_dma = 0;
685 return;
686} 483}
687 484
688static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs) 485static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs)
689{ 486{
690// printk("%s\n", __FUNCTION__); 487 _auide_hwif *ahwif = (_auide_hwif*)param;
488 ahwif->drive->waiting_for_dma = 0;
489}
490
491#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
691 492
692 _auide_hwif *ahwif = (_auide_hwif*)param; 493static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags)
693 ahwif->drive->waiting_for_dma = 0; 494{
694 return; 495 dev->dev_id = dev_id;
496 dev->dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
497 dev->dev_intlevel = 0;
498 dev->dev_intpolarity = 0;
499 dev->dev_tsize = tsize;
500 dev->dev_devwidth = devwidth;
501 dev->dev_flags = flags;
695} 502}
503
504#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
696 505
697static int auide_dma_timeout(ide_drive_t *drive) 506static int auide_dma_timeout(ide_drive_t *drive)
698{ 507{
699// printk("%s\n", __FUNCTION__); 508// printk("%s\n", __FUNCTION__);
700 509
701 printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); 510 printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
702 511
703 if (HWIF(drive)->ide_dma_test_irq(drive)) 512 if (HWIF(drive)->ide_dma_test_irq(drive))
704 return 0; 513 return 0;
705 514
706 return HWIF(drive)->ide_dma_end(drive); 515 return HWIF(drive)->ide_dma_end(drive);
707} 516}
708#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 517
709 518
519static int auide_ddma_init(_auide_hwif *auide) {
520
521 dbdev_tab_t source_dev_tab, target_dev_tab;
522 u32 dev_id, tsize, devwidth, flags;
523 ide_hwif_t *hwif = auide->hwif;
710 524
711static int auide_ddma_init( _auide_hwif *auide ) 525 dev_id = AU1XXX_ATA_DDMA_REQ;
712{
713// printk("%s\n", __FUNCTION__);
714 526
715 dbdev_tab_t source_dev_tab; 527 if (auide->white_list || auide->black_list) {
716#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 528 tsize = 8;
717 dbdev_tab_t target_dev_tab; 529 devwidth = 32;
718 ide_hwif_t *hwif = auide->hwif; 530 }
719 char warning_output [2][80]; 531 else {
720 int i; 532 tsize = 1;
721#endif 533 devwidth = 16;
534
535 printk(KERN_ERR "au1xxx-ide: %s is not on ide driver whitelist.\n",auide_hwif.drive->id->model);
536 printk(KERN_ERR " please read 'Documentation/mips/AU1xxx_IDE.README'");
537 }
722 538
723 /* Add our custom device to DDMA device table */ 539#ifdef IDE_AU1XXX_BURSTMODE
724 /* Create our new device entries in the table */ 540 flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE;
725#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
726 source_dev_tab.dev_id = AU1XXX_ATA_DDMA_REQ;
727
728 if( auide->white_list || auide->black_list ){
729 source_dev_tab.dev_tsize = 8;
730 source_dev_tab.dev_devwidth = 32;
731 source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
732 source_dev_tab.dev_intlevel = 0;
733 source_dev_tab.dev_intpolarity = 0;
734
735 /* init device table for target - static bus controller - */
736 target_dev_tab.dev_id = DSCR_CMD0_ALWAYS;
737 target_dev_tab.dev_tsize = 8;
738 target_dev_tab.dev_devwidth = 32;
739 target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
740 target_dev_tab.dev_intlevel = 0;
741 target_dev_tab.dev_intpolarity = 0;
742 target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE;
743 }
744 else{
745 source_dev_tab.dev_tsize = 1;
746 source_dev_tab.dev_devwidth = 16;
747 source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
748 source_dev_tab.dev_intlevel = 0;
749 source_dev_tab.dev_intpolarity = 0;
750
751 /* init device table for target - static bus controller - */
752 target_dev_tab.dev_id = DSCR_CMD0_ALWAYS;
753 target_dev_tab.dev_tsize = 1;
754 target_dev_tab.dev_devwidth = 16;
755 target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
756 target_dev_tab.dev_intlevel = 0;
757 target_dev_tab.dev_intpolarity = 0;
758 target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE;
759
760 sprintf(&warning_output[0][0],
761 "%s is not on ide driver white list.",
762 auide_hwif.drive->id->model);
763 for ( i=strlen(&warning_output[0][0]) ; i<76; i++ ){
764 sprintf(&warning_output[0][i]," ");
765 }
766
767 sprintf(&warning_output[1][0],
768 "To add %s please read 'Documentation/mips/AU1xxx_IDE.README'.",
769 auide_hwif.drive->id->model);
770 for ( i=strlen(&warning_output[1][0]) ; i<76; i++ ){
771 sprintf(&warning_output[1][i]," ");
772 }
773
774 printk("\n****************************************");
775 printk("****************************************\n");
776 printk("* %s *\n",&warning_output[0][0]);
777 printk("* Switch to safe MWDMA Mode! ");
778 printk(" *\n");
779 printk("* %s *\n",&warning_output[1][0]);
780 printk("****************************************");
781 printk("****************************************\n\n");
782 }
783#else 541#else
784 source_dev_tab.dev_id = DSCR_CMD0_ALWAYS; 542 flags = DEV_FLAGS_SYNC;
785 source_dev_tab.dev_tsize = 8;
786 source_dev_tab.dev_devwidth = 32;
787 source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
788 source_dev_tab.dev_intlevel = 0;
789 source_dev_tab.dev_intpolarity = 0;
790#endif 543#endif
791 544
792#if CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 545 /* setup dev_tab for tx channel */
793 /* set flags for tx channel */ 546 auide_init_dbdma_dev( &source_dev_tab,
794 source_dev_tab.dev_flags = DEV_FLAGS_OUT 547 dev_id,
795 | DEV_FLAGS_SYNC 548 tsize, devwidth, DEV_FLAGS_OUT | flags);
796 | DEV_FLAGS_BURSTABLE; 549 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
797 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); 550
798 /* set flags for rx channel */ 551 auide_init_dbdma_dev( &source_dev_tab,
799 source_dev_tab.dev_flags = DEV_FLAGS_IN 552 dev_id,
800 | DEV_FLAGS_SYNC 553 tsize, devwidth, DEV_FLAGS_IN | flags);
801 | DEV_FLAGS_BURSTABLE; 554 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
802 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); 555
556 /* We also need to add a target device for the DMA */
557 auide_init_dbdma_dev( &target_dev_tab,
558 (u32)DSCR_CMD0_ALWAYS,
559 tsize, devwidth, DEV_FLAGS_ANYUSE);
560 auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab);
561
562 /* Get a channel for TX */
563 auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id,
564 auide->tx_dev_id,
565 auide_ddma_tx_callback,
566 (void*)auide);
567
568 /* Get a channel for RX */
569 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
570 auide->target_dev_id,
571 auide_ddma_rx_callback,
572 (void*)auide);
573
574 auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,
575 NUM_DESCRIPTORS);
576 auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,
577 NUM_DESCRIPTORS);
578
579 hwif->dmatable_cpu = dma_alloc_coherent(auide->dev,
580 PRD_ENTRIES * PRD_BYTES, /* 1 Page */
581 &hwif->dmatable_dma, GFP_KERNEL);
582
583 au1xxx_dbdma_start( auide->tx_chan );
584 au1xxx_dbdma_start( auide->rx_chan );
585
586 return 0;
587}
803#else 588#else
804 /* set flags for tx channel */ 589
805 source_dev_tab.dev_flags = DEV_FLAGS_OUT | DEV_FLAGS_SYNC; 590static int auide_ddma_init( _auide_hwif *auide )
806 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); 591{
807 /* set flags for rx channel */ 592 dbdev_tab_t source_dev_tab;
808 source_dev_tab.dev_flags = DEV_FLAGS_IN | DEV_FLAGS_SYNC; 593 int flags;
809 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
810#endif
811 594
812#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 595#ifdef IDE_AU1XXX_BURSTMODE
813 596 flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE;
814 auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab); 597#else
815 598 flags = DEV_FLAGS_SYNC;
816 /* Get a channel for TX */
817 auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id,
818 auide->tx_dev_id,
819 auide_ddma_tx_callback,
820 (void*)auide);
821 /* Get a channel for RX */
822 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
823 auide->target_dev_id,
824 auide_ddma_rx_callback,
825 (void*)auide);
826#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */
827 /*
828 * Note: if call back is not enabled, update ctp->cur_ptr manually
829 */
830 auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS,
831 auide->tx_dev_id,
832 NULL,
833 (void*)auide);
834 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
835 DSCR_CMD0_ALWAYS,
836 NULL,
837 (void*)auide);
838#endif 599#endif
839 auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,
840 NUM_DESCRIPTORS);
841 auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,
842 NUM_DESCRIPTORS);
843 600
844#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 601 /* setup dev_tab for tx channel */
845 hwif->dmatable_cpu = dma_alloc_coherent(auide->dev, 602 auide_init_dbdma_dev( &source_dev_tab,
846 PRD_ENTRIES * PRD_BYTES, /* 1 Page */ 603 (u32)DSCR_CMD0_ALWAYS,
847 &hwif->dmatable_dma, GFP_KERNEL); 604 8, 32, DEV_FLAGS_OUT | flags);
848 605 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
849 auide->sg_table = kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, 606
850 GFP_KERNEL|GFP_DMA); 607 auide_init_dbdma_dev( &source_dev_tab,
851 if (auide->sg_table == NULL) { 608 (u32)DSCR_CMD0_ALWAYS,
852 return -ENOMEM; 609 8, 32, DEV_FLAGS_IN | flags);
853 } 610 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
854#endif 611
855 au1xxx_dbdma_start( auide->tx_chan ); 612 /* Get a channel for TX */
856 au1xxx_dbdma_start( auide->rx_chan ); 613 auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS,
857 return 0; 614 auide->tx_dev_id,
615 NULL,
616 (void*)auide);
617
618 /* Get a channel for RX */
619 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
620 DSCR_CMD0_ALWAYS,
621 NULL,
622 (void*)auide);
623
624 auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,
625 NUM_DESCRIPTORS);
626 auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,
627 NUM_DESCRIPTORS);
628
629 au1xxx_dbdma_start( auide->tx_chan );
630 au1xxx_dbdma_start( auide->rx_chan );
631
632 return 0;
858} 633}
634#endif
859 635
860static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) 636static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
861{ 637{
862 int i; 638 int i;
863#define ide_ioreg_t unsigned long 639 unsigned long *ata_regs = hw->io_ports;
864 ide_ioreg_t *ata_regs = hw->io_ports; 640
865 641 /* FIXME? */
866 /* fixme */ 642 for (i = 0; i < IDE_CONTROL_OFFSET; i++) {
867 for (i = 0; i < IDE_CONTROL_OFFSET; i++) { 643 *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET);
868 *ata_regs++ = (ide_ioreg_t) ahwif->regbase 644 }
869 + (ide_ioreg_t)(i << AU1XXX_ATA_REG_OFFSET); 645
870 } 646 /* set the Alternative Status register */
871 647 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);
872 /* set the Alternative Status register */
873 *ata_regs = (ide_ioreg_t) ahwif->regbase
874 + (ide_ioreg_t)(14 << AU1XXX_ATA_REG_OFFSET);
875} 648}
876 649
877static int au_ide_probe(struct device *dev) 650static int au_ide_probe(struct device *dev)
878{ 651{
879 struct platform_device *pdev = to_platform_device(dev); 652 struct platform_device *pdev = to_platform_device(dev);
880 _auide_hwif *ahwif = &auide_hwif; 653 _auide_hwif *ahwif = &auide_hwif;
881 ide_hwif_t *hwif; 654 ide_hwif_t *hwif;
882 struct resource *res; 655 struct resource *res;
883 int ret = 0; 656 int ret = 0;
884 657
885#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 658#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
886 char *mode = "MWDMA2"; 659 char *mode = "MWDMA2";
887#elif defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) 660#elif defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
888 char *mode = "PIO+DDMA(offload)"; 661 char *mode = "PIO+DDMA(offload)";
889#endif 662#endif
890 663
891 memset(&auide_hwif, 0, sizeof(_auide_hwif)); 664 memset(&auide_hwif, 0, sizeof(_auide_hwif));
892 auide_hwif.dev = 0; 665 auide_hwif.dev = 0;
893 666
894 ahwif->dev = dev; 667 ahwif->dev = dev;
895 ahwif->irq = platform_get_irq(pdev, 0); 668 ahwif->irq = platform_get_irq(pdev, 0);
@@ -902,11 +675,11 @@ static int au_ide_probe(struct device *dev)
902 goto out; 675 goto out;
903 } 676 }
904 677
905 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) { 678 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {
906 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 679 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
907 ret = -EBUSY; 680 ret = -EBUSY;
908 goto out; 681 goto out;
909 } 682 }
910 683
911 ahwif->regbase = (u32)ioremap(res->start, res->end-res->start); 684 ahwif->regbase = (u32)ioremap(res->start, res->end-res->start);
912 if (ahwif->regbase == 0) { 685 if (ahwif->regbase == 0) {
@@ -914,130 +687,92 @@ static int au_ide_probe(struct device *dev)
914 goto out; 687 goto out;
915 } 688 }
916 689
917 hwif = &ide_hwifs[pdev->id]; 690 /* FIXME: This might possibly break PCMCIA IDE devices */
691
692 hwif = &ide_hwifs[pdev->id];
918 hw_regs_t *hw = &hwif->hw; 693 hw_regs_t *hw = &hwif->hw;
919 hwif->irq = hw->irq = ahwif->irq; 694 hwif->irq = hw->irq = ahwif->irq;
920 hwif->chipset = ide_au1xxx; 695 hwif->chipset = ide_au1xxx;
921 696
922 auide_setup_ports(hw, ahwif); 697 auide_setup_ports(hw, ahwif);
923 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); 698 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
924 699
925#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ 700 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
926 hwif->rqsize = CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ;
927 hwif->rqsize = ((hwif->rqsize > AU1XXX_ATA_RQSIZE)
928 || (hwif->rqsize < 32)) ? AU1XXX_ATA_RQSIZE : hwif->rqsize;
929#else /* if kernel config is not set */
930 hwif->rqsize = AU1XXX_ATA_RQSIZE;
931#endif
932
933 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
934#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 701#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
935 hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */ 702 hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */
936 hwif->swdma_mask = 0x07; 703 hwif->swdma_mask = 0x00;
937#else 704#else
938 hwif->mwdma_mask = 0x0; 705 hwif->mwdma_mask = 0x0;
939 hwif->swdma_mask = 0x0; 706 hwif->swdma_mask = 0x0;
707#endif
708
709 hwif->noprobe = 0;
710 hwif->drives[0].unmask = 1;
711 hwif->drives[1].unmask = 1;
712
713 /* hold should be on in all cases */
714 hwif->hold = 1;
715 hwif->mmio = 2;
716
717 /* If the user has selected DDMA assisted copies,
718 then set up a few local I/O function entry points
719 */
720
721#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
722 hwif->INSW = auide_insw;
723 hwif->OUTSW = auide_outsw;
940#endif 724#endif
941 //hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 725
942 hwif->noprobe = 0; 726 hwif->tuneproc = &auide_tune_drive;
943 hwif->drives[0].unmask = 1; 727 hwif->speedproc = &auide_tune_chipset;
944 hwif->drives[1].unmask = 1;
945
946 /* hold should be on in all cases */
947 hwif->hold = 1;
948 hwif->mmio = 2;
949
950 /* set up local I/O function entry points */
951 hwif->INB = auide_inb;
952 hwif->INW = auide_inw;
953 hwif->INL = auide_inl;
954 hwif->INSW = auide_insw;
955 hwif->INSL = auide_insl;
956 hwif->OUTB = auide_outb;
957 hwif->OUTBSYNC = auide_outbsync;
958 hwif->OUTW = auide_outw;
959 hwif->OUTL = auide_outl;
960 hwif->OUTSW = auide_outsw;
961 hwif->OUTSL = auide_outsl;
962
963 hwif->tuneproc = &auide_tune_drive;
964 hwif->speedproc = &auide_tune_chipset;
965 728
966#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 729#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
967 hwif->ide_dma_off_quietly = &auide_dma_off_quietly; 730 hwif->ide_dma_off_quietly = &auide_dma_off_quietly;
968 hwif->ide_dma_timeout = &auide_dma_timeout; 731 hwif->ide_dma_timeout = &auide_dma_timeout;
969 732
970 hwif->ide_dma_check = &auide_dma_check; 733 hwif->ide_dma_check = &auide_dma_check;
971 hwif->dma_exec_cmd = &auide_dma_exec_cmd; 734 hwif->dma_exec_cmd = &auide_dma_exec_cmd;
972 hwif->dma_start = &auide_dma_start; 735 hwif->dma_start = &auide_dma_start;
973 hwif->ide_dma_end = &auide_dma_end; 736 hwif->ide_dma_end = &auide_dma_end;
974 hwif->dma_setup = &auide_dma_setup; 737 hwif->dma_setup = &auide_dma_setup;
975 hwif->ide_dma_test_irq = &auide_dma_test_irq; 738 hwif->ide_dma_test_irq = &auide_dma_test_irq;
976 hwif->ide_dma_host_off = &auide_dma_host_off; 739 hwif->ide_dma_host_off = &auide_dma_host_off;
977 hwif->ide_dma_host_on = &auide_dma_host_on; 740 hwif->ide_dma_host_on = &auide_dma_host_on;
978 hwif->ide_dma_lostirq = &auide_dma_lostirq; 741 hwif->ide_dma_lostirq = &auide_dma_lostirq;
979 hwif->ide_dma_on = &auide_dma_on; 742 hwif->ide_dma_on = &auide_dma_on;
980 743
981 hwif->autodma = 1; 744 hwif->autodma = 1;
982 hwif->drives[0].autodma = hwif->autodma; 745 hwif->drives[0].autodma = hwif->autodma;
983 hwif->drives[1].autodma = hwif->autodma; 746 hwif->drives[1].autodma = hwif->autodma;
984 hwif->atapi_dma = 1; 747 hwif->atapi_dma = 1;
985 hwif->drives[0].using_dma = 1; 748
986 hwif->drives[1].using_dma = 1;
987#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 749#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
988 hwif->autodma = 0; 750 hwif->autodma = 0;
989 hwif->channel = 0; 751 hwif->channel = 0;
990 hwif->hold = 1; 752 hwif->hold = 1;
991 hwif->select_data = 0; /* no chipset-specific code */ 753 hwif->select_data = 0; /* no chipset-specific code */
992 hwif->config_data = 0; /* no chipset-specific code */ 754 hwif->config_data = 0; /* no chipset-specific code */
993 755
994 hwif->drives[0].autodma = 0; 756 hwif->drives[0].autodma = 0;
995 hwif->drives[0].drive_data = 0; /* no drive data */ 757 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
996 hwif->drives[0].using_dma = 0;
997 hwif->drives[0].waiting_for_dma = 0;
998 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
999 /* secondary hdd not supported */
1000 hwif->drives[1].autodma = 0;
1001
1002 hwif->drives[1].drive_data = 0;
1003 hwif->drives[1].using_dma = 0;
1004 hwif->drives[1].waiting_for_dma = 0;
1005 hwif->drives[1].autotune = 2; /* 1=autotune, 2=noautotune, 0=default */
1006#endif
1007 hwif->drives[0].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
1008 hwif->drives[1].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
1009
1010 /*Register Driver with PM Framework*/
1011#ifdef CONFIG_PM
1012 auide_hwif.pm.lock = SPIN_LOCK_UNLOCKED;
1013 auide_hwif.pm.stopped = 0;
1014
1015 auide_hwif.pm.dev = new_au1xxx_power_device( "ide",
1016 &au1200ide_pm_callback,
1017 NULL);
1018 if ( auide_hwif.pm.dev == NULL )
1019 printk(KERN_INFO "Unable to create a power management \
1020 device entry for the au1200-IDE.\n");
1021 else
1022 printk(KERN_INFO "Power management device entry for the \
1023 au1200-IDE loaded.\n");
1024#endif 758#endif
759 hwif->drives[0].no_io_32bit = 1;
1025 760
1026 auide_hwif.hwif = hwif; 761 auide_hwif.hwif = hwif;
1027 hwif->hwif_data = &auide_hwif; 762 hwif->hwif_data = &auide_hwif;
1028 763
1029#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA 764#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
1030 auide_ddma_init(&auide_hwif); 765 auide_ddma_init(&auide_hwif);
1031 dbdma_init_done = 1; 766 dbdma_init_done = 1;
1032#endif 767#endif
1033 768
1034 probe_hwif_init(hwif); 769 probe_hwif_init(hwif);
1035 dev_set_drvdata(dev, hwif); 770 dev_set_drvdata(dev, hwif);
1036 771
1037 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); 772 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );
1038 773
1039out: 774 out:
1040 return ret; 775 return ret;
1041} 776}
1042 777
1043static int au_ide_remove(struct device *dev) 778static int au_ide_remove(struct device *dev)
@@ -1045,7 +780,7 @@ static int au_ide_remove(struct device *dev)
1045 struct platform_device *pdev = to_platform_device(dev); 780 struct platform_device *pdev = to_platform_device(dev);
1046 struct resource *res; 781 struct resource *res;
1047 ide_hwif_t *hwif = dev_get_drvdata(dev); 782 ide_hwif_t *hwif = dev_get_drvdata(dev);
1048 _auide_hwif *ahwif = &auide_hwif; 783 _auide_hwif *ahwif = &auide_hwif;
1049 784
1050 ide_unregister(hwif - ide_hwifs); 785 ide_unregister(hwif - ide_hwifs);
1051 786
@@ -1069,180 +804,11 @@ static int __init au_ide_init(void)
1069 return driver_register(&au1200_ide_driver); 804 return driver_register(&au1200_ide_driver);
1070} 805}
1071 806
1072static void __init au_ide_exit(void) 807static void __exit au_ide_exit(void)
1073{ 808{
1074 driver_unregister(&au1200_ide_driver); 809 driver_unregister(&au1200_ide_driver);
1075} 810}
1076 811
1077#ifdef CONFIG_PM
1078int au1200ide_pm_callback( au1xxx_power_dev_t *dev,\
1079 au1xxx_request_t request, void *data) {
1080
1081 unsigned int d, err = 0;
1082 unsigned long flags;
1083
1084 spin_lock_irqsave(auide_hwif.pm.lock, flags);
1085
1086 switch (request){
1087 case AU1XXX_PM_SLEEP:
1088 err = au1xxxide_pm_sleep(dev);
1089 break;
1090 case AU1XXX_PM_WAKEUP:
1091 d = *((unsigned int*)data);
1092 if ( d > 0 && d <= 99) {
1093 err = au1xxxide_pm_standby(dev);
1094 }
1095 else {
1096 err = au1xxxide_pm_resume(dev);
1097 }
1098 break;
1099 case AU1XXX_PM_GETSTATUS:
1100 err = au1xxxide_pm_getstatus(dev);
1101 break;
1102 case AU1XXX_PM_ACCESS:
1103 err = au1xxxide_pm_access(dev);
1104 break;
1105 case AU1XXX_PM_IDLE:
1106 err = au1xxxide_pm_idle(dev);
1107 break;
1108 case AU1XXX_PM_CLEANUP:
1109 err = au1xxxide_pm_cleanup(dev);
1110 break;
1111 default:
1112 err = -1;
1113 break;
1114 }
1115
1116 spin_unlock_irqrestore(auide_hwif.pm.lock, flags);
1117
1118 return err;
1119}
1120
1121static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev ) {
1122 return 0;
1123}
1124
1125static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev ) {
1126
1127 int retval;
1128 ide_hwif_t *hwif = auide_hwif.hwif;
1129 struct request rq;
1130 struct request_pm_state rqpm;
1131 ide_task_t args;
1132
1133 if(auide_hwif.pm.stopped)
1134 return -1;
1135
1136 /*
1137 * wait until hard disc is ready
1138 */
1139 if ( wait_for_ready(&hwif->drives[0], 35000) ) {
1140 printk("Wait for drive sleep timeout!\n");
1141 retval = -1;
1142 }
1143
1144 /*
1145 * sequenz to tell the high level ide driver that pm is resuming
1146 */
1147 memset(&rq, 0, sizeof(rq));
1148 memset(&rqpm, 0, sizeof(rqpm));
1149 memset(&args, 0, sizeof(args));
1150 rq.flags = REQ_PM_SUSPEND;
1151 rq.special = &args;
1152 rq.pm = &rqpm;
1153 rqpm.pm_step = ide_pm_state_start_suspend;
1154 rqpm.pm_state = PMSG_SUSPEND;
1155
1156 retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_wait);
1157
1158 if (wait_for_ready (&hwif->drives[0], 35000)) {
1159 printk("Wait for drive sleep timeout!\n");
1160 retval = -1;
1161 }
1162
1163 /*
1164 * stop dbdma channels
1165 */
1166 au1xxx_dbdma_reset(auide_hwif.tx_chan);
1167 au1xxx_dbdma_reset(auide_hwif.rx_chan);
1168
1169 auide_hwif.pm.stopped = 1;
1170
1171 return retval;
1172}
1173
1174static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev ) {
1175
1176 int retval;
1177 ide_hwif_t *hwif = auide_hwif.hwif;
1178 struct request rq;
1179 struct request_pm_state rqpm;
1180 ide_task_t args;
1181
1182 if(!auide_hwif.pm.stopped)
1183 return -1;
1184
1185 /*
1186 * start dbdma channels
1187 */
1188 au1xxx_dbdma_start(auide_hwif.tx_chan);
1189 au1xxx_dbdma_start(auide_hwif.rx_chan);
1190
1191 /*
1192 * wait until hard disc is ready
1193 */
1194 if (wait_for_ready ( &hwif->drives[0], 35000)) {
1195 printk("Wait for drive wake up timeout!\n");
1196 retval = -1;
1197 }
1198
1199 /*
1200 * sequenz to tell the high level ide driver that pm is resuming
1201 */
1202 memset(&rq, 0, sizeof(rq));
1203 memset(&rqpm, 0, sizeof(rqpm));
1204 memset(&args, 0, sizeof(args));
1205 rq.flags = REQ_PM_RESUME;
1206 rq.special = &args;
1207 rq.pm = &rqpm;
1208 rqpm.pm_step = ide_pm_state_start_resume;
1209 rqpm.pm_state = PMSG_ON;
1210
1211 retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_head_wait);
1212
1213 /*
1214 * wait for hard disc
1215 */
1216 if ( wait_for_ready(&hwif->drives[0], 35000) ) {
1217 printk("Wait for drive wake up timeout!\n");
1218 retval = -1;
1219 }
1220
1221 auide_hwif.pm.stopped = 0;
1222
1223 return retval;
1224}
1225
1226static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev ) {
1227 return dev->cur_state;
1228}
1229
1230static int au1xxxide_pm_access( au1xxx_power_dev_t *dev ) {
1231 if (dev->cur_state != AWAKE_STATE)
1232 return 0;
1233 else
1234 return -1;
1235}
1236
1237static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev ) {
1238 return 0;
1239}
1240
1241static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev ) {
1242 return 0;
1243}
1244#endif /* CONFIG_PM */
1245
1246MODULE_LICENSE("GPL"); 812MODULE_LICENSE("GPL");
1247MODULE_DESCRIPTION("AU1200 IDE driver"); 813MODULE_DESCRIPTION("AU1200 IDE driver");
1248 814
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index af526b671c4e..4ee597d08797 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -622,12 +622,18 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d)
622 ide_hwif_t *hwif; 622 ide_hwif_t *hwif;
623 int h; 623 int h;
624 624
625 /*
626 * Find an empty HWIF; if none available, return -ENOMEM.
627 */
625 for (h = 0; h < MAX_HWIFS; ++h) { 628 for (h = 0; h < MAX_HWIFS; ++h) {
626 hwif = &ide_hwifs[h]; 629 hwif = &ide_hwifs[h];
627 /* Find an empty HWIF */
628 if (hwif->chipset == ide_unknown) 630 if (hwif->chipset == ide_unknown)
629 break; 631 break;
630 } 632 }
633 if (h == MAX_HWIFS) {
634 printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", d->name);
635 return -ENOMEM;
636 }
631 637
632 /* Get the CmdBlk and CtrlBlk Base Registers */ 638 /* Get the CmdBlk and CtrlBlk Base Registers */
633 base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET; 639 base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET;
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 7161ce0ef5aa..86fb1e0286d3 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -80,6 +80,7 @@ static struct via_isa_bridge {
80 u16 flags; 80 u16 flags;
81} via_isa_bridges[] = { 81} via_isa_bridges[] = {
82 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 82 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
83 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
83 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 84 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
84 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 85 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
85 { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 86 { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 49d0416a2a9a..bac3085185fe 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -320,7 +320,7 @@ static struct dmi_system_id dmi_ids[] = {
320 }, 320 },
321 .driver_data = keymap_acer_aspire_1500 321 .driver_data = keymap_acer_aspire_1500
322 }, 322 },
323 { 0, } 323 { NULL, }
324}; 324};
325 325
326static int __init select_keymap(void) 326static int __init select_keymap(void)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4acc7fd4cd0f..4f41ec3e4332 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -42,7 +42,7 @@ static struct alps_model_info alps_model_data[] = {
42 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, 42 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 },
43 { { 0x63, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, 43 { { 0x63, 0x02, 0x0a }, 0xf8, 0xf8, 0 },
44 { { 0x63, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, 44 { { 0x63, 0x02, 0x14 }, 0xf8, 0xf8, 0 },
45 { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, 0 }, 45 { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */
46 { { 0x63, 0x02, 0x3c }, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ 46 { { 0x63, 0x02, 0x3c }, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */
47 { { 0x63, 0x02, 0x50 }, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ 47 { { 0x63, 0x02, 0x50 }, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */
48 { { 0x63, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, 48 { { 0x63, 0x02, 0x64 }, 0xf8, 0xf8, 0 },
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c
index e6541aff3996..2239651969c8 100644
--- a/drivers/media/dvb/bt8xx/dst_ca.c
+++ b/drivers/media/dvb/bt8xx/dst_ca.c
@@ -406,7 +406,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message,
406 } 406 }
407 dprintk(verbose, DST_CA_DEBUG, 1, " "); 407 dprintk(verbose, DST_CA_DEBUG, 1, " ");
408 408
409 if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) { 409 if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) {
410 result = -EFAULT; 410 result = -EFAULT;
411 goto free_mem_and_exit; 411 goto free_mem_and_exit;
412 } 412 }
@@ -579,7 +579,7 @@ static int dst_ca_release(struct inode *inode, struct file *file)
579 return 0; 579 return 0;
580} 580}
581 581
582static int dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset) 582static ssize_t dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset)
583{ 583{
584 int bytes_read = 0; 584 int bytes_read = 0;
585 585
@@ -588,7 +588,7 @@ static int dst_ca_read(struct file *file, char __user *buffer, size_t length, lo
588 return bytes_read; 588 return bytes_read;
589} 589}
590 590
591static int dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset) 591static ssize_t dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset)
592{ 592{
593 dprintk(verbose, DST_CA_DEBUG, 1, " Device write."); 593 dprintk(verbose, DST_CA_DEBUG, 1, " Device write.");
594 594
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index e8a1c2247567..ec11619f8ea9 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -126,7 +126,7 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count)
126 const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ 126 const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */
127 void *buff = NULL; 127 void *buff = NULL;
128 u32 i; 128 u32 i;
129 em28xx_coredbg("requested %i buffers with size %i", count, imagesize); 129 em28xx_coredbg("requested %i buffers with size %zd", count, imagesize);
130 if (count > EM28XX_NUM_FRAMES) 130 if (count > EM28XX_NUM_FRAMES)
131 count = EM28XX_NUM_FRAMES; 131 count = EM28XX_NUM_FRAMES;
132 132
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b586a83a9b4c..eb41391e06e9 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -679,7 +679,15 @@ static void mmc_idle_cards(struct mmc_host *host)
679} 679}
680 680
681/* 681/*
682 * Apply power to the MMC stack. 682 * Apply power to the MMC stack. This is a two-stage process.
683 * First, we enable power to the card without the clock running.
684 * We then wait a bit for the power to stabilise. Finally,
685 * enable the bus drivers and clock to the card.
686 *
687 * We must _NOT_ enable the clock prior to power stablising.
688 *
689 * If a host does all the power sequencing itself, ignore the
690 * initial MMC_POWER_UP stage.
683 */ 691 */
684static void mmc_power_up(struct mmc_host *host) 692static void mmc_power_up(struct mmc_host *host)
685{ 693{
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index e57df8dfe6b4..669dd52c412a 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -3078,7 +3078,7 @@ int s2io_set_swapper(nic_t * sp)
3078 3078
3079static int wait_for_msix_trans(nic_t *nic, int i) 3079static int wait_for_msix_trans(nic_t *nic, int i)
3080{ 3080{
3081 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3081 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3082 u64 val64; 3082 u64 val64;
3083 int ret = 0, cnt = 0; 3083 int ret = 0, cnt = 0;
3084 3084
@@ -3099,7 +3099,7 @@ static int wait_for_msix_trans(nic_t *nic, int i)
3099 3099
3100void restore_xmsi_data(nic_t *nic) 3100void restore_xmsi_data(nic_t *nic)
3101{ 3101{
3102 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3102 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3103 u64 val64; 3103 u64 val64;
3104 int i; 3104 int i;
3105 3105
@@ -3117,7 +3117,7 @@ void restore_xmsi_data(nic_t *nic)
3117 3117
3118static void store_xmsi_data(nic_t *nic) 3118static void store_xmsi_data(nic_t *nic)
3119{ 3119{
3120 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3120 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3121 u64 val64, addr, data; 3121 u64 val64, addr, data;
3122 int i; 3122 int i;
3123 3123
@@ -3140,7 +3140,7 @@ static void store_xmsi_data(nic_t *nic)
3140 3140
3141int s2io_enable_msi(nic_t *nic) 3141int s2io_enable_msi(nic_t *nic)
3142{ 3142{
3143 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3143 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3144 u16 msi_ctrl, msg_val; 3144 u16 msi_ctrl, msg_val;
3145 struct config_param *config = &nic->config; 3145 struct config_param *config = &nic->config;
3146 struct net_device *dev = nic->dev; 3146 struct net_device *dev = nic->dev;
@@ -3190,7 +3190,7 @@ int s2io_enable_msi(nic_t *nic)
3190 3190
3191int s2io_enable_msi_x(nic_t *nic) 3191int s2io_enable_msi_x(nic_t *nic)
3192{ 3192{
3193 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3193 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3194 u64 tx_mat, rx_mat; 3194 u64 tx_mat, rx_mat;
3195 u16 msi_control; /* Temp variable */ 3195 u16 msi_control; /* Temp variable */
3196 int ret, i, j, msix_indx = 1; 3196 int ret, i, j, msix_indx = 1;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 8b6e2a11e28d..00d683063c01 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2280,7 +2280,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
2280 } 2280 }
2281 2281
2282 if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) { 2282 if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) {
2283 if (!netif_stopped(dev)) { 2283 if (!netif_queue_stopped(dev)) {
2284 netif_stop_queue(dev); 2284 netif_stop_queue(dev);
2285 2285
2286 printk(KERN_WARNING PFX "%s: ring full when queue awake!\n", 2286 printk(KERN_WARNING PFX "%s: ring full when queue awake!\n",
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 47bd4a394420..a23ed28a72b8 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.44" 71#define DRV_MODULE_VERSION "3.45"
72#define DRV_MODULE_RELDATE "Dec 6, 2005" 72#define DRV_MODULE_RELDATE "Dec 13, 2005"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -1025,7 +1025,9 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1025 1025
1026 1026
1027 if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || 1027 if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 ||
1028 (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0) { 1028 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 ||
1029 (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 ||
1030 (tp_peer->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0) {
1029 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 1031 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
1030 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) { 1032 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
1031 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1033 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
@@ -1105,6 +1107,8 @@ static int tg3_setup_phy(struct tg3 *, int);
1105 1107
1106static void tg3_write_sig_post_reset(struct tg3 *, int); 1108static void tg3_write_sig_post_reset(struct tg3 *, int);
1107static int tg3_halt_cpu(struct tg3 *, u32); 1109static int tg3_halt_cpu(struct tg3 *, u32);
1110static int tg3_nvram_lock(struct tg3 *);
1111static void tg3_nvram_unlock(struct tg3 *);
1108 1112
1109static int tg3_set_power_state(struct tg3 *tp, int state) 1113static int tg3_set_power_state(struct tg3 *tp, int state)
1110{ 1114{
@@ -1179,6 +1183,21 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1179 tg3_setup_phy(tp, 0); 1183 tg3_setup_phy(tp, 0);
1180 } 1184 }
1181 1185
1186 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
1187 int i;
1188 u32 val;
1189
1190 for (i = 0; i < 200; i++) {
1191 tg3_read_mem(tp, NIC_SRAM_FW_ASF_STATUS_MBOX, &val);
1192 if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
1193 break;
1194 msleep(1);
1195 }
1196 }
1197 tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE |
1198 WOL_DRV_STATE_SHUTDOWN |
1199 WOL_DRV_WOL | WOL_SET_MAGIC_PKT);
1200
1182 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps); 1201 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps);
1183 1202
1184 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) { 1203 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) {
@@ -1268,6 +1287,17 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1268 } 1287 }
1269 } 1288 }
1270 1289
1290 if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) &&
1291 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
1292 /* Turn off the PHY */
1293 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
1294 tg3_writephy(tp, MII_TG3_EXT_CTRL,
1295 MII_TG3_EXT_CTRL_FORCE_LED_OFF);
1296 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
1297 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
1298 }
1299 }
1300
1271 tg3_frob_aux_power(tp); 1301 tg3_frob_aux_power(tp);
1272 1302
1273 /* Workaround for unstable PLL clock */ 1303 /* Workaround for unstable PLL clock */
@@ -1277,8 +1307,12 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1277 1307
1278 val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); 1308 val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1);
1279 tw32(0x7d00, val); 1309 tw32(0x7d00, val);
1280 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) 1310 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
1311 tg3_nvram_lock(tp);
1281 tg3_halt_cpu(tp, RX_CPU_BASE); 1312 tg3_halt_cpu(tp, RX_CPU_BASE);
1313 tw32_f(NVRAM_SWARB, SWARB_REQ_CLR0);
1314 tg3_nvram_unlock(tp);
1315 }
1282 } 1316 }
1283 1317
1284 /* Finally, set the new power state. */ 1318 /* Finally, set the new power state. */
@@ -1812,7 +1846,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
1812 } 1846 }
1813 } 1847 }
1814relink: 1848relink:
1815 if (current_link_up == 0) { 1849 if (current_link_up == 0 || tp->link_config.phy_is_low_power) {
1816 u32 tmp; 1850 u32 tmp;
1817 1851
1818 tg3_phy_copper_begin(tp); 1852 tg3_phy_copper_begin(tp);
@@ -8533,6 +8567,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
8533 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { 8567 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
8534 tp->tg3_flags |= TG3_FLAG_NVRAM; 8568 tp->tg3_flags |= TG3_FLAG_NVRAM;
8535 8569
8570 tg3_nvram_lock(tp);
8536 tg3_enable_nvram_access(tp); 8571 tg3_enable_nvram_access(tp);
8537 8572
8538 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 8573 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
@@ -8543,6 +8578,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
8543 tg3_get_nvram_size(tp); 8578 tg3_get_nvram_size(tp);
8544 8579
8545 tg3_disable_nvram_access(tp); 8580 tg3_disable_nvram_access(tp);
8581 tg3_nvram_unlock(tp);
8546 8582
8547 } else { 8583 } else {
8548 tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED); 8584 tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED);
@@ -8640,10 +8676,10 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
8640 if (ret == 0) 8676 if (ret == 0)
8641 *val = swab32(tr32(NVRAM_RDDATA)); 8677 *val = swab32(tr32(NVRAM_RDDATA));
8642 8678
8643 tg3_nvram_unlock(tp);
8644
8645 tg3_disable_nvram_access(tp); 8679 tg3_disable_nvram_access(tp);
8646 8680
8681 tg3_nvram_unlock(tp);
8682
8647 return ret; 8683 return ret;
8648} 8684}
8649 8685
@@ -8728,6 +8764,10 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
8728 8764
8729 offset = offset + (pagesize - page_off); 8765 offset = offset + (pagesize - page_off);
8730 8766
8767 /* Nvram lock released by tg3_nvram_read() above,
8768 * so need to get it again.
8769 */
8770 tg3_nvram_lock(tp);
8731 tg3_enable_nvram_access(tp); 8771 tg3_enable_nvram_access(tp);
8732 8772
8733 /* 8773 /*
@@ -10437,8 +10477,13 @@ static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp)
10437 break; 10477 break;
10438 pci_dev_put(peer); 10478 pci_dev_put(peer);
10439 } 10479 }
10440 if (!peer || peer == tp->pdev) 10480 /* 5704 can be configured in single-port mode, set peer to
10441 BUG(); 10481 * tp->pdev in that case.
10482 */
10483 if (!peer) {
10484 peer = tp->pdev;
10485 return peer;
10486 }
10442 10487
10443 /* 10488 /*
10444 * We don't need to keep the refcount elevated; there's no way 10489 * We don't need to keep the refcount elevated; there's no way
@@ -10820,12 +10865,14 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
10820 10865
10821 tg3_full_lock(tp, 0); 10866 tg3_full_lock(tp, 0);
10822 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 10867 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
10868 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
10823 tg3_full_unlock(tp); 10869 tg3_full_unlock(tp);
10824 10870
10825 err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); 10871 err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
10826 if (err) { 10872 if (err) {
10827 tg3_full_lock(tp, 0); 10873 tg3_full_lock(tp, 0);
10828 10874
10875 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
10829 tg3_init_hw(tp); 10876 tg3_init_hw(tp);
10830 10877
10831 tp->timer.expires = jiffies + tp->timer_offset; 10878 tp->timer.expires = jiffies + tp->timer_offset;
@@ -10859,6 +10906,7 @@ static int tg3_resume(struct pci_dev *pdev)
10859 10906
10860 tg3_full_lock(tp, 0); 10907 tg3_full_lock(tp, 0);
10861 10908
10909 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
10862 tg3_init_hw(tp); 10910 tg3_init_hw(tp);
10863 10911
10864 tp->timer.expires = jiffies + tp->timer_offset; 10912 tp->timer.expires = jiffies + tp->timer_offset;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index fb7e2a5f4a08..94dbcf3537ec 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1529,6 +1529,12 @@
1529#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14 1529#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14
1530#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18 1530#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18
1531 1531
1532#define NIC_SRAM_WOL_MBOX 0x00000d30
1533#define WOL_SIGNATURE 0x474c0000
1534#define WOL_DRV_STATE_SHUTDOWN 0x00000001
1535#define WOL_DRV_WOL 0x00000002
1536#define WOL_SET_MAGIC_PKT 0x00000004
1537
1532#define NIC_SRAM_DATA_CFG_2 0x00000d38 1538#define NIC_SRAM_DATA_CFG_2 0x00000d38
1533 1539
1534#define SHASTA_EXT_LED_MODE_MASK 0x00018000 1540#define SHASTA_EXT_LED_MODE_MASK 0x00018000
@@ -1565,6 +1571,7 @@
1565#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */ 1571#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */
1566#define MII_TG3_EXT_CTRL_FIFO_ELASTIC 0x0001 1572#define MII_TG3_EXT_CTRL_FIFO_ELASTIC 0x0001
1567#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002 1573#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002
1574#define MII_TG3_EXT_CTRL_FORCE_LED_OFF 0x0008
1568#define MII_TG3_EXT_CTRL_TBI 0x8000 1575#define MII_TG3_EXT_CTRL_TBI 0x8000
1569 1576
1570#define MII_TG3_EXT_STAT 0x11 /* Extended status register */ 1577#define MII_TG3_EXT_STAT 0x11 /* Extended status register */
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index c12c5046e2fa..14631ac11bc7 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -249,11 +249,11 @@ static loff_t jsf_lseek(struct file * file, loff_t offset, int orig)
249/* 249/*
250 * OS SIMM Cannot be read in other size but a 32bits word. 250 * OS SIMM Cannot be read in other size but a 32bits word.
251 */ 251 */
252static ssize_t jsf_read(struct file * file, char * buf, 252static ssize_t jsf_read(struct file * file, char __user * buf,
253 size_t togo, loff_t *ppos) 253 size_t togo, loff_t *ppos)
254{ 254{
255 unsigned long p = *ppos; 255 unsigned long p = *ppos;
256 char *tmp = buf; 256 char __user *tmp = buf;
257 257
258 union byte4 { 258 union byte4 {
259 char s[4]; 259 char s[4];
@@ -305,7 +305,7 @@ static ssize_t jsf_read(struct file * file, char * buf,
305 return tmp-buf; 305 return tmp-buf;
306} 306}
307 307
308static ssize_t jsf_write(struct file * file, const char * buf, 308static ssize_t jsf_write(struct file * file, const char __user * buf,
309 size_t count, loff_t *ppos) 309 size_t count, loff_t *ppos)
310{ 310{
311 return -ENOSPC; 311 return -ENOSPC;
@@ -356,10 +356,10 @@ static int jsf_ioctl_erase(unsigned long arg)
356 * Program a block of flash. 356 * Program a block of flash.
357 * Very simple because we can do it byte by byte anyway. 357 * Very simple because we can do it byte by byte anyway.
358 */ 358 */
359static int jsf_ioctl_program(unsigned long arg) 359static int jsf_ioctl_program(void __user *arg)
360{ 360{
361 struct jsflash_program_arg abuf; 361 struct jsflash_program_arg abuf;
362 char *uptr; 362 char __user *uptr;
363 unsigned long p; 363 unsigned long p;
364 unsigned int togo; 364 unsigned int togo;
365 union { 365 union {
@@ -367,13 +367,13 @@ static int jsf_ioctl_program(unsigned long arg)
367 char s[4]; 367 char s[4];
368 } b; 368 } b;
369 369
370 if (copy_from_user(&abuf, (char *)arg, JSFPRGSZ)) 370 if (copy_from_user(&abuf, arg, JSFPRGSZ))
371 return -EFAULT; 371 return -EFAULT;
372 p = abuf.off; 372 p = abuf.off;
373 togo = abuf.size; 373 togo = abuf.size;
374 if ((togo & 3) || (p & 3)) return -EINVAL; 374 if ((togo & 3) || (p & 3)) return -EINVAL;
375 375
376 uptr = (char *) (unsigned long) abuf.data; 376 uptr = (char __user *) (unsigned long) abuf.data;
377 while (togo != 0) { 377 while (togo != 0) {
378 togo -= 4; 378 togo -= 4;
379 if (copy_from_user(&b.s[0], uptr, 4)) 379 if (copy_from_user(&b.s[0], uptr, 4))
@@ -390,19 +390,20 @@ static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd,
390 unsigned long arg) 390 unsigned long arg)
391{ 391{
392 int error = -ENOTTY; 392 int error = -ENOTTY;
393 void __user *argp = (void __user *)arg;
393 394
394 if (!capable(CAP_SYS_ADMIN)) 395 if (!capable(CAP_SYS_ADMIN))
395 return -EPERM; 396 return -EPERM;
396 switch (cmd) { 397 switch (cmd) {
397 case JSFLASH_IDENT: 398 case JSFLASH_IDENT:
398 if (copy_to_user((void *)arg, &jsf0.id, JSFIDSZ)) 399 if (copy_to_user(argp, &jsf0.id, JSFIDSZ))
399 return -EFAULT; 400 return -EFAULT;
400 break; 401 break;
401 case JSFLASH_ERASE: 402 case JSFLASH_ERASE:
402 error = jsf_ioctl_erase(arg); 403 error = jsf_ioctl_erase(arg);
403 break; 404 break;
404 case JSFLASH_PROGRAM: 405 case JSFLASH_PROGRAM:
405 error = jsf_ioctl_program(arg); 406 error = jsf_ioctl_program(argp);
406 break; 407 break;
407 } 408 }
408 409
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 858cc683f85c..e2d9a7c85427 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -309,7 +309,7 @@ static void uctrl_do_txn(struct uctrl_txn *txn)
309 } 309 }
310} 310}
311 311
312void uctrl_get_event_status() 312void uctrl_get_event_status(void)
313{ 313{
314 struct uctrl_driver *driver = &drv; 314 struct uctrl_driver *driver = &drv;
315 struct uctrl_txn txn; 315 struct uctrl_txn txn;
@@ -318,7 +318,7 @@ void uctrl_get_event_status()
318 txn.opcode = READ_EVENT_STATUS; 318 txn.opcode = READ_EVENT_STATUS;
319 txn.inbits = 0; 319 txn.inbits = 0;
320 txn.outbits = 2; 320 txn.outbits = 2;
321 txn.inbuf = 0; 321 txn.inbuf = NULL;
322 txn.outbuf = outbits; 322 txn.outbuf = outbits;
323 323
324 uctrl_do_txn(&txn); 324 uctrl_do_txn(&txn);
@@ -329,7 +329,7 @@ void uctrl_get_event_status()
329 dprintk(("ev is %x\n", driver->status.event_status)); 329 dprintk(("ev is %x\n", driver->status.event_status));
330} 330}
331 331
332void uctrl_get_external_status() 332void uctrl_get_external_status(void)
333{ 333{
334 struct uctrl_driver *driver = &drv; 334 struct uctrl_driver *driver = &drv;
335 struct uctrl_txn txn; 335 struct uctrl_txn txn;
@@ -339,7 +339,7 @@ void uctrl_get_external_status()
339 txn.opcode = READ_EXTERNAL_STATUS; 339 txn.opcode = READ_EXTERNAL_STATUS;
340 txn.inbits = 0; 340 txn.inbits = 0;
341 txn.outbits = 2; 341 txn.outbits = 2;
342 txn.inbuf = 0; 342 txn.inbuf = NULL;
343 txn.outbuf = outbits; 343 txn.outbuf = outbits;
344 344
345 uctrl_do_txn(&txn); 345 uctrl_do_txn(&txn);
@@ -414,7 +414,7 @@ static void __exit ts102_uctrl_cleanup(void)
414 if (driver->irq) 414 if (driver->irq)
415 free_irq(driver->irq, driver); 415 free_irq(driver->irq, driver);
416 if (driver->regs) 416 if (driver->regs)
417 driver->regs = 0; 417 driver->regs = NULL;
418} 418}
419 419
420module_init(ts102_uctrl_init); 420module_init(ts102_uctrl_init);
diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h
index a7782e7da42e..8045cd5e7cb3 100644
--- a/drivers/sbus/char/vfc.h
+++ b/drivers/sbus/char/vfc.h
@@ -125,7 +125,7 @@ struct vfc_regs {
125 125
126 126
127struct vfc_dev { 127struct vfc_dev {
128 volatile struct vfc_regs *regs; 128 volatile struct vfc_regs __iomem *regs;
129 struct vfc_regs *phys_regs; 129 struct vfc_regs *phys_regs;
130 unsigned int control_reg; 130 unsigned int control_reg;
131 struct semaphore device_lock_sem; 131 struct semaphore device_lock_sem;
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 7a103698fa3c..dfdd6be551f3 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -149,7 +149,7 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance)
149 } 149 }
150 printk("Initializing vfc%d\n",instance); 150 printk("Initializing vfc%d\n",instance);
151 dev->regs = NULL; 151 dev->regs = NULL;
152 dev->regs = (volatile struct vfc_regs *) 152 dev->regs = (volatile struct vfc_regs __iomem *)
153 sbus_ioremap(&sdev->resource[0], 0, 153 sbus_ioremap(&sdev->resource[0], 0,
154 sizeof(struct vfc_regs), vfcstr); 154 sizeof(struct vfc_regs), vfcstr);
155 dev->which_io = sdev->reg_addrs[0].which_io; 155 dev->which_io = sdev->reg_addrs[0].which_io;
@@ -319,7 +319,7 @@ int vfc_capture_poll(struct vfc_dev *dev)
319 int timeout = 1000; 319 int timeout = 1000;
320 320
321 while (!timeout--) { 321 while (!timeout--) {
322 if (dev->regs->control & VFC_STATUS_CAPTURE) 322 if (sbus_readl(&dev->regs->control) & VFC_STATUS_CAPTURE)
323 break; 323 break;
324 vfc_i2c_delay_no_busy(dev, 100); 324 vfc_i2c_delay_no_busy(dev, 100);
325 } 325 }
@@ -718,7 +718,7 @@ static void deinit_vfc_device(struct vfc_dev *dev)
718 if(dev == NULL) 718 if(dev == NULL)
719 return; 719 return;
720 devfs_remove("vfc/%d", dev->instance); 720 devfs_remove("vfc/%d", dev->instance);
721 sbus_iounmap((unsigned long)dev->regs, sizeof(struct vfc_regs)); 721 sbus_iounmap(dev->regs, sizeof(struct vfc_regs));
722 kfree(dev); 722 kfree(dev);
723} 723}
724 724
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 8bec0438dc8a..5b0edd1f1921 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -100,7 +100,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
100void ibmvscsi_release_crq_queue(struct crq_queue *queue, 100void ibmvscsi_release_crq_queue(struct crq_queue *queue,
101 struct ibmvscsi_host_data *hostdata, 101 struct ibmvscsi_host_data *hostdata,
102 int max_requests); 102 int max_requests);
103void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 103int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
104 struct ibmvscsi_host_data *hostdata); 104 struct ibmvscsi_host_data *hostdata);
105 105
106void ibmvscsi_handle_crq(struct viosrp_crq *crq, 106void ibmvscsi_handle_crq(struct viosrp_crq *crq,
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
index 1045872b0175..ce15d9e39621 100644
--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
+++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
@@ -117,9 +117,10 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
117 * 117 *
118 * no-op for iSeries 118 * no-op for iSeries
119 */ 119 */
120void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 120int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
121 struct ibmvscsi_host_data *hostdata) 121 struct ibmvscsi_host_data *hostdata)
122{ 122{
123 return 0;
123} 124}
124 125
125/** 126/**
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 8bf5652f1060..75db2f5c545e 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -230,6 +230,11 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
230 rc = plpar_hcall_norets(H_REG_CRQ, 230 rc = plpar_hcall_norets(H_REG_CRQ,
231 vdev->unit_address, 231 vdev->unit_address,
232 queue->msg_token, PAGE_SIZE); 232 queue->msg_token, PAGE_SIZE);
233 if (rc == H_Resource)
234 /* maybe kexecing and resource is busy. try a reset */
235 rc = ibmvscsi_reset_crq_queue(queue,
236 hostdata);
237
233 if (rc == 2) { 238 if (rc == 2) {
234 /* Adapter is good, but other end is not ready */ 239 /* Adapter is good, but other end is not ready */
235 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); 240 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
@@ -281,7 +286,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
281 * @hostdata: ibmvscsi_host_data of host 286 * @hostdata: ibmvscsi_host_data of host
282 * 287 *
283 */ 288 */
284void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 289int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
285 struct ibmvscsi_host_data *hostdata) 290 struct ibmvscsi_host_data *hostdata)
286{ 291{
287 int rc; 292 int rc;
@@ -309,4 +314,5 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue,
309 printk(KERN_WARNING 314 printk(KERN_WARNING
310 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc); 315 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
311 } 316 }
317 return rc;
312} 318}
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 2d12355eed33..10bcf42cb65c 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -3391,7 +3391,7 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param,
3391 switch(param) { 3391 switch(param) {
3392 case ISCSI_PARAM_MAX_RECV_DLENGTH: { 3392 case ISCSI_PARAM_MAX_RECV_DLENGTH: {
3393 char *saveptr = conn->data; 3393 char *saveptr = conn->data;
3394 int flags = GFP_KERNEL; 3394 gfp_t flags = GFP_KERNEL;
3395 3395
3396 if (conn->data_size >= value) { 3396 if (conn->data_size >= value) {
3397 conn->max_recv_dlength = value; 3397 conn->max_recv_dlength = value;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 379e87089764..72ddba98f8fb 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2173,9 +2173,12 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2173 if (unlikely(!ata_dev_present(dev))) 2173 if (unlikely(!ata_dev_present(dev)))
2174 return NULL; 2174 return NULL;
2175 2175
2176 if (!atapi_enabled) { 2176 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
2177 if (unlikely(dev->class == ATA_DEV_ATAPI)) 2177 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2178 printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n",
2179 ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled");
2178 return NULL; 2180 return NULL;
2181 }
2179 } 2182 }
2180 2183
2181 return dev; 2184 return dev;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 9fa41ccadef2..4a6feb1e5e3d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -665,7 +665,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
665 sg->offset; 665 sg->offset;
666 } else 666 } else
667 buf = cmd->request_buffer; 667 buf = cmd->request_buffer;
668 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 668 memset(buf, 0, cmd->cmnd[4]);
669 if (cmd->use_sg) { 669 if (cmd->use_sg) {
670 struct scatterlist *sg; 670 struct scatterlist *sg;
671 671
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index ce0d88bbaa06..79d8a914f9d0 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2498,17 +2498,9 @@ typedef struct scsi_qla_host {
2498 */ 2498 */
2499#define LOOP_TRANSITION(ha) \ 2499#define LOOP_TRANSITION(ha) \
2500 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2500 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2501 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2501 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2502
2503#define LOOP_NOT_READY(ha) \
2504 ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2505 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
2506 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2507 test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
2508 atomic_read(&ha->loop_state) == LOOP_DOWN) 2502 atomic_read(&ha->loop_state) == LOOP_DOWN)
2509 2503
2510#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
2511
2512#define TGT_Q(ha, t) (ha->otgt[t]) 2504#define TGT_Q(ha, t) (ha->otgt[t])
2513 2505
2514#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) 2506#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index dadc91bd0ea9..7d973bd9022b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1258,7 +1258,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1258 rval = qla2x00_get_adapter_id(ha, 1258 rval = qla2x00_get_adapter_id(ha,
1259 &loop_id, &al_pa, &area, &domain, &topo); 1259 &loop_id, &al_pa, &area, &domain, &topo);
1260 if (rval != QLA_SUCCESS) { 1260 if (rval != QLA_SUCCESS) {
1261 if (LOOP_NOT_READY(ha) || atomic_read(&ha->loop_down_timer) || 1261 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1262 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 1262 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
1263 DEBUG2(printk("%s(%ld) Loop is in a transition state\n", 1263 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
1264 __func__, ha->host_no)); 1264 __func__, ha->host_no));
@@ -1795,7 +1795,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1795 } 1795 }
1796 1796
1797 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { 1797 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
1798 if (LOOP_NOT_READY(ha)) { 1798 if (LOOP_TRANSITION(ha)) {
1799 rval = QLA_FUNCTION_FAILED; 1799 rval = QLA_FUNCTION_FAILED;
1800 } else { 1800 } else {
1801 rval = qla2x00_configure_fabric(ha); 1801 rval = qla2x00_configure_fabric(ha);
@@ -2368,7 +2368,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2368 if (qla2x00_is_reserved_id(ha, loop_id)) 2368 if (qla2x00_is_reserved_id(ha, loop_id))
2369 continue; 2369 continue;
2370 2370
2371 if (atomic_read(&ha->loop_down_timer) || LOOP_NOT_READY(ha)) 2371 if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha))
2372 break; 2372 break;
2373 2373
2374 if (swl != NULL) { 2374 if (swl != NULL) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 09afc0f06bd4..5181d966fecb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
909 resid = resid_len; 909 resid = resid_len;
910 cp->resid = resid; 910 cp->resid = resid;
911 CMD_RESID_LEN(cp) = resid; 911 CMD_RESID_LEN(cp) = resid;
912
913 if (!lscsi_status &&
914 ((unsigned)(cp->request_bufflen - resid) <
915 cp->underflow)) {
916 qla_printk(KERN_INFO, ha,
917 "scsi(%ld:%d:%d:%d): Mid-layer underflow "
918 "detected (%x of %x bytes)...returning "
919 "error status.\n", ha->host_no,
920 cp->device->channel, cp->device->id,
921 cp->device->lun, resid,
922 cp->request_bufflen);
923
924 cp->result = DID_ERROR << 16;
925 break;
926 }
912 } 927 }
913 cp->result = DID_OK << 16 | lscsi_status; 928 cp->result = DID_OK << 16 | lscsi_status;
914 929
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index ab7432a5778e..9321cdf45680 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -86,7 +86,8 @@ enum {
86 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ 86 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */
87 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ 87 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */
88 MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 88 MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
89 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), 89 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
90 ATA_FLAG_NO_ATAPI),
90 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, 91 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE,
91 92
92 CRQB_FLAG_READ = (1 << 0), 93 CRQB_FLAG_READ = (1 << 0),
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 8a8e3e3ef0ed..2691625f9bce 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -70,6 +70,9 @@ enum {
70 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ 70 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */
71 71
72 PDC_RESET = (1 << 11), /* HDMA reset */ 72 PDC_RESET = (1 << 11), /* HDMA reset */
73
74 PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST |
75 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI,
73}; 76};
74 77
75 78
@@ -162,8 +165,7 @@ static struct ata_port_info pdc_port_info[] = {
162 /* board_2037x */ 165 /* board_2037x */
163 { 166 {
164 .sht = &pdc_ata_sht, 167 .sht = &pdc_ata_sht,
165 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 168 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
166 ATA_FLAG_SRST | ATA_FLAG_MMIO,
167 .pio_mask = 0x1f, /* pio0-4 */ 169 .pio_mask = 0x1f, /* pio0-4 */
168 .mwdma_mask = 0x07, /* mwdma0-2 */ 170 .mwdma_mask = 0x07, /* mwdma0-2 */
169 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 171 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -173,8 +175,7 @@ static struct ata_port_info pdc_port_info[] = {
173 /* board_20319 */ 175 /* board_20319 */
174 { 176 {
175 .sht = &pdc_ata_sht, 177 .sht = &pdc_ata_sht,
176 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 178 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
177 ATA_FLAG_SRST | ATA_FLAG_MMIO,
178 .pio_mask = 0x1f, /* pio0-4 */ 179 .pio_mask = 0x1f, /* pio0-4 */
179 .mwdma_mask = 0x07, /* mwdma0-2 */ 180 .mwdma_mask = 0x07, /* mwdma0-2 */
180 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 181 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -184,8 +185,7 @@ static struct ata_port_info pdc_port_info[] = {
184 /* board_20619 */ 185 /* board_20619 */
185 { 186 {
186 .sht = &pdc_ata_sht, 187 .sht = &pdc_ata_sht,
187 .host_flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | 188 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
188 ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS,
189 .pio_mask = 0x1f, /* pio0-4 */ 189 .pio_mask = 0x1f, /* pio0-4 */
190 .mwdma_mask = 0x07, /* mwdma0-2 */ 190 .mwdma_mask = 0x07, /* mwdma0-2 */
191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index dcc3ad9a9d6e..ac7b0d819ebc 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -220,7 +220,8 @@ static struct ata_port_info pdc_port_info[] = {
220 { 220 {
221 .sht = &pdc_sata_sht, 221 .sht = &pdc_sata_sht,
222 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 222 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
223 ATA_FLAG_SRST | ATA_FLAG_MMIO, 223 ATA_FLAG_SRST | ATA_FLAG_MMIO |
224 ATA_FLAG_NO_ATAPI,
224 .pio_mask = 0x1f, /* pio0-4 */ 225 .pio_mask = 0x1f, /* pio0-4 */
225 .mwdma_mask = 0x07, /* mwdma0-2 */ 226 .mwdma_mask = 0x07, /* mwdma0-2 */
226 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 227 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 53ea62d3b53d..a2333d2c7af0 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -422,10 +422,15 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
422 **/ 422 **/
423static void scsi_eh_done(struct scsi_cmnd *scmd) 423static void scsi_eh_done(struct scsi_cmnd *scmd)
424{ 424{
425 struct completion *eh_action;
426
425 SCSI_LOG_ERROR_RECOVERY(3, 427 SCSI_LOG_ERROR_RECOVERY(3,
426 printk("%s scmd: %p result: %x\n", 428 printk("%s scmd: %p result: %x\n",
427 __FUNCTION__, scmd, scmd->result)); 429 __FUNCTION__, scmd, scmd->result));
428 complete(scmd->device->host->eh_action); 430
431 eh_action = scmd->device->host->eh_action;
432 if (eh_action)
433 complete(eh_action);
429} 434}
430 435
431/** 436/**
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 49fd18c1a9c6..e08462d50c97 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -249,7 +249,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
249} 249}
250 250
251static void* 251static void*
252mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 252mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
253{ 253{
254 struct mempool_zone *zone = pool_data; 254 struct mempool_zone *zone = pool_data;
255 255
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d82795455efb..9d893f085015 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -245,24 +245,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
245 * SG_IO from block layer already setup, just copy cdb basically 245 * SG_IO from block layer already setup, just copy cdb basically
246 */ 246 */
247 if (blk_pc_request(rq)) { 247 if (blk_pc_request(rq)) {
248 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 248 scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES);
249 return 0;
250
251 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
252 SCpnt->cmd_len = rq->cmd_len;
253 if (rq_data_dir(rq) == WRITE)
254 SCpnt->sc_data_direction = DMA_TO_DEVICE;
255 else if (rq->data_len)
256 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
257 else
258 SCpnt->sc_data_direction = DMA_NONE;
259
260 this_count = rq->data_len;
261 if (rq->timeout) 249 if (rq->timeout)
262 timeout = rq->timeout; 250 timeout = rq->timeout;
263 251
264 SCpnt->transfersize = rq->data_len;
265 SCpnt->allowed = SD_PASSTHROUGH_RETRIES;
266 goto queue; 252 goto queue;
267 } 253 }
268 254
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index a3fa64cf6650..7e7398d563cc 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -320,25 +320,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
320 * these are already setup, just copy cdb basically 320 * these are already setup, just copy cdb basically
321 */ 321 */
322 if (SCpnt->request->flags & REQ_BLOCK_PC) { 322 if (SCpnt->request->flags & REQ_BLOCK_PC) {
323 struct request *rq = SCpnt->request; 323 scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES);
324 324
325 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 325 if (SCpnt->timeout_per_command)
326 return 0; 326 timeout = SCpnt->timeout_per_command;
327
328 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
329 SCpnt->cmd_len = rq->cmd_len;
330 if (!rq->data_len)
331 SCpnt->sc_data_direction = DMA_NONE;
332 else if (rq_data_dir(rq) == WRITE)
333 SCpnt->sc_data_direction = DMA_TO_DEVICE;
334 else
335 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
336
337 this_count = rq->data_len;
338 if (rq->timeout)
339 timeout = rq->timeout;
340 327
341 SCpnt->transfersize = rq->data_len;
342 goto queue; 328 goto queue;
343 } 329 }
344 330
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 2096d137f5ee..894ad53be04b 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4195,27 +4195,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
4195 */ 4195 */
4196static int st_init_command(struct scsi_cmnd *SCpnt) 4196static int st_init_command(struct scsi_cmnd *SCpnt)
4197{ 4197{
4198 struct request *rq;
4199
4200 if (!(SCpnt->request->flags & REQ_BLOCK_PC)) 4198 if (!(SCpnt->request->flags & REQ_BLOCK_PC))
4201 return 0; 4199 return 0;
4202 4200
4203 rq = SCpnt->request; 4201 scsi_setup_blk_pc_cmnd(SCpnt, 0);
4204 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
4205 return 0;
4206
4207 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
4208 SCpnt->cmd_len = rq->cmd_len;
4209
4210 if (rq_data_dir(rq) == WRITE)
4211 SCpnt->sc_data_direction = DMA_TO_DEVICE;
4212 else if (rq->data_len)
4213 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
4214 else
4215 SCpnt->sc_data_direction = DMA_NONE;
4216
4217 SCpnt->timeout_per_command = rq->timeout;
4218 SCpnt->transfersize = rq->data_len;
4219 SCpnt->done = st_intr; 4202 SCpnt->done = st_intr;
4220 return 1; 4203 return 1;
4221} 4204}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 7a3c807dcfca..1010e716162e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1356,7 +1356,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget,
1356 goal->iu = 0; 1356 goal->iu = 0;
1357 goal->dt = 0; 1357 goal->dt = 0;
1358 goal->qas = 0; 1358 goal->qas = 0;
1359 goal->period = 0;
1360 goal->offset = 0; 1359 goal->offset = 0;
1361 return; 1360 return;
1362 } 1361 }
@@ -1416,7 +1415,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1416 * Many devices implement PPR in a buggy way, so only use it if we 1415 * Many devices implement PPR in a buggy way, so only use it if we
1417 * really want to. 1416 * really want to.
1418 */ 1417 */
1419 if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { 1418 if (goal->offset &&
1419 (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {
1420 nego = NS_PPR; 1420 nego = NS_PPR;
1421 } else if (spi_width(starget) != goal->width) { 1421 } else if (spi_width(starget) != goal->width) {
1422 nego = NS_WIDE; 1422 nego = NS_WIDE;
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 45f3130fadea..a3e44ef1df43 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -893,8 +893,10 @@ static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_
893 893
894 size = ((report->size - 1) >> 3) + 1; 894 size = ((report->size - 1) >> 3) + 1;
895 895
896 if (len < size) 896 if (len < size) {
897 dbg("report %d is too short, (%d < %d)", report->id, len, size); 897 dbg("report %d is too short, (%d < %d)", report->id, len, size);
898 memset(data + len, 0, size - len);
899 }
898 900
899 if (hid->claimed & HID_CLAIMED_HIDDEV) 901 if (hid->claimed & HID_CLAIMED_HIDDEV)
900 hiddev_report_event(hid, report); 902 hiddev_report_event(hid, report);
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index 2a28ceeaa66a..b293db3c28c3 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -1696,7 +1696,7 @@ static ssize_t auerchar_write (struct file *file, const char __user *buf, size_t
1696 int ret; 1696 int ret;
1697 wait_queue_t wait; 1697 wait_queue_t wait;
1698 1698
1699 dbg ("auerchar_write %d bytes", len); 1699 dbg ("auerchar_write %zd bytes", len);
1700 1700
1701 /* Error checking */ 1701 /* Error checking */
1702 if (!ccp) 1702 if (!ccp)
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index 080db812ca48..2784f0a9d693 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -441,7 +441,7 @@ static int arcfb_ioctl(struct inode *inode, struct file *file,
441 * the fb. it's inefficient for them to do anything less than 64*8 441 * the fb. it's inefficient for them to do anything less than 64*8
442 * writes since we update the lcd in each write() anyway. 442 * writes since we update the lcd in each write() anyway.
443 */ 443 */
444static ssize_t arcfb_write(struct file *file, const char *buf, size_t count, 444static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t count,
445 loff_t *ppos) 445 loff_t *ppos)
446{ 446{
447 /* modded from epson 1355 */ 447 /* modded from epson 1355 */
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index c589d23e7f91..a9300f930ef2 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1512,7 +1512,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1512 * I/O cycles storing into a reserved memory space at 1512 * I/O cycles storing into a reserved memory space at
1513 * physical address 0x3000000 1513 * physical address 0x3000000
1514 */ 1514 */
1515 unsigned char *iop; 1515 unsigned char __iomem *iop;
1516 1516
1517 iop = ioremap(0x3000000, 0x5000); 1517 iop = ioremap(0x3000000, 0x5000);
1518 if (iop == NULL) { 1518 if (iop == NULL) {
@@ -1526,7 +1526,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1526 writeb(EXT_BIU_MISC, iop + 0x3ce); 1526 writeb(EXT_BIU_MISC, iop + 0x3ce);
1527 writeb(EXT_BIU_MISC_LIN_ENABLE, iop + 0x3cf); 1527 writeb(EXT_BIU_MISC_LIN_ENABLE, iop + 0x3cf);
1528 1528
1529 iounmap((void *)iop); 1529 iounmap(iop);
1530#else 1530#else
1531 /* 1531 /*
1532 * Most other machine types are "normal", so 1532 * Most other machine types are "normal", so
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 7b4cd250bec8..9fc10b9e6f57 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1396,7 +1396,8 @@ static struct platform_driver pxafb_driver = {
1396int __devinit pxafb_setup(char *options) 1396int __devinit pxafb_setup(char *options)
1397{ 1397{
1398# ifdef CONFIG_FB_PXA_PARAMETERS 1398# ifdef CONFIG_FB_PXA_PARAMETERS
1399 strlcpy(g_options, options, sizeof(g_options)); 1399 if (options)
1400 strlcpy(g_options, options, sizeof(g_options));
1400# endif 1401# endif
1401 return 0; 1402 return 0;
1402} 1403}
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 0a044ad98885..a5e3a0ddbe53 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -32,6 +32,7 @@ void reiserfs_delete_inode(struct inode *inode)
32 JOURNAL_PER_BALANCE_CNT * 2 + 32 JOURNAL_PER_BALANCE_CNT * 2 +
33 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); 33 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
34 struct reiserfs_transaction_handle th; 34 struct reiserfs_transaction_handle th;
35 int err;
35 36
36 truncate_inode_pages(&inode->i_data, 0); 37 truncate_inode_pages(&inode->i_data, 0);
37 38
@@ -49,15 +50,13 @@ void reiserfs_delete_inode(struct inode *inode)
49 } 50 }
50 reiserfs_update_inode_transaction(inode); 51 reiserfs_update_inode_transaction(inode);
51 52
52 if (reiserfs_delete_object(&th, inode)) { 53 err = reiserfs_delete_object(&th, inode);
53 up(&inode->i_sem);
54 goto out;
55 }
56 54
57 /* Do quota update inside a transaction for journaled quotas. We must do that 55 /* Do quota update inside a transaction for journaled quotas. We must do that
58 * after delete_object so that quota updates go into the same transaction as 56 * after delete_object so that quota updates go into the same transaction as
59 * stat data deletion */ 57 * stat data deletion */
60 DQUOT_FREE_INODE(inode); 58 if (!err)
59 DQUOT_FREE_INODE(inode);
61 60
62 if (journal_end(&th, inode->i_sb, jbegin_count)) { 61 if (journal_end(&th, inode->i_sb, jbegin_count)) {
63 up(&inode->i_sem); 62 up(&inode->i_sem);
@@ -66,6 +65,12 @@ void reiserfs_delete_inode(struct inode *inode)
66 65
67 up(&inode->i_sem); 66 up(&inode->i_sem);
68 67
68 /* check return value from reiserfs_delete_object after
69 * ending the transaction
70 */
71 if (err)
72 goto out;
73
69 /* all items of file are deleted, so we can remove "save" link */ 74 /* all items of file are deleted, so we can remove "save" link */
70 remove_save_link(inode, 0 /* not truncate */ ); /* we can't do anything 75 remove_save_link(inode, 0 /* not truncate */ ); /* we can't do anything
71 * about an error here */ 76 * about an error here */
@@ -2099,6 +2104,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
2099 struct page *page = NULL; 2104 struct page *page = NULL;
2100 int error; 2105 int error;
2101 struct buffer_head *bh = NULL; 2106 struct buffer_head *bh = NULL;
2107 int err2;
2102 2108
2103 reiserfs_write_lock(p_s_inode->i_sb); 2109 reiserfs_write_lock(p_s_inode->i_sb);
2104 2110
@@ -2136,14 +2142,18 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
2136 transaction of truncating gets committed - on reboot the file 2142 transaction of truncating gets committed - on reboot the file
2137 either appears truncated properly or not truncated at all */ 2143 either appears truncated properly or not truncated at all */
2138 add_save_link(&th, p_s_inode, 1); 2144 add_save_link(&th, p_s_inode, 1);
2139 error = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); 2145 err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps);
2140 if (error)
2141 goto out;
2142 error = 2146 error =
2143 journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1); 2147 journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);
2144 if (error) 2148 if (error)
2145 goto out; 2149 goto out;
2146 2150
2151 /* check reiserfs_do_truncate after ending the transaction */
2152 if (err2) {
2153 error = err2;
2154 goto out;
2155 }
2156
2147 if (update_timestamps) { 2157 if (update_timestamps) {
2148 error = remove_save_link(p_s_inode, 1 /* truncate */ ); 2158 error = remove_save_link(p_s_inode, 1 /* truncate */ );
2149 if (error) 2159 if (error)
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 68b7b78638ff..3f17ef844fb6 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -1039,6 +1039,10 @@ static int flush_commit_list(struct super_block *s,
1039 } 1039 }
1040 atomic_dec(&journal->j_async_throttle); 1040 atomic_dec(&journal->j_async_throttle);
1041 1041
1042 /* We're skipping the commit if there's an error */
1043 if (retval || reiserfs_is_journal_aborted(journal))
1044 barrier = 0;
1045
1042 /* wait on everything written so far before writing the commit 1046 /* wait on everything written so far before writing the commit
1043 * if we are in barrier mode, send the commit down now 1047 * if we are in barrier mode, send the commit down now
1044 */ 1048 */
@@ -1077,10 +1081,16 @@ static int flush_commit_list(struct super_block *s,
1077 BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); 1081 BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);
1078 1082
1079 if (!barrier) { 1083 if (!barrier) {
1080 if (buffer_dirty(jl->j_commit_bh)) 1084 /* If there was a write error in the journal - we can't commit
1081 BUG(); 1085 * this transaction - it will be invalid and, if successful,
1082 mark_buffer_dirty(jl->j_commit_bh); 1086 * will just end up propogating the write error out to
1083 sync_dirty_buffer(jl->j_commit_bh); 1087 * the file system. */
1088 if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
1089 if (buffer_dirty(jl->j_commit_bh))
1090 BUG();
1091 mark_buffer_dirty(jl->j_commit_bh) ;
1092 sync_dirty_buffer(jl->j_commit_bh) ;
1093 }
1084 } else 1094 } else
1085 wait_on_buffer(jl->j_commit_bh); 1095 wait_on_buffer(jl->j_commit_bh);
1086 1096
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 1aea42d71a64..5328a2937127 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -78,7 +78,7 @@ STATIC int xfs_qm_dqhashlock_nowait(xfs_dquot_t *);
78 78
79STATIC int xfs_qm_init_quotainos(xfs_mount_t *); 79STATIC int xfs_qm_init_quotainos(xfs_mount_t *);
80STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); 80STATIC int xfs_qm_init_quotainfo(xfs_mount_t *);
81STATIC int xfs_qm_shake(int, unsigned int); 81STATIC int xfs_qm_shake(int, gfp_t);
82 82
83#ifdef DEBUG 83#ifdef DEBUG
84extern mutex_t qcheck_lock; 84extern mutex_t qcheck_lock;
@@ -2197,7 +2197,7 @@ xfs_qm_shake_freelist(
2197 */ 2197 */
2198/* ARGSUSED */ 2198/* ARGSUSED */
2199STATIC int 2199STATIC int
2200xfs_qm_shake(int nr_to_scan, unsigned int gfp_mask) 2200xfs_qm_shake(int nr_to_scan, gfp_t gfp_mask)
2201{ 2201{
2202 int ndqused, nfree, n; 2202 int ndqused, nfree, n;
2203 2203
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index 7da97a937548..2d44b42d1847 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -22,6 +22,8 @@ typedef unsigned long elf_freg_t[3];
22#define R_ARM_NONE 0 22#define R_ARM_NONE 0
23#define R_ARM_PC24 1 23#define R_ARM_PC24 1
24#define R_ARM_ABS32 2 24#define R_ARM_ABS32 2
25#define R_ARM_CALL 28
26#define R_ARM_JUMP24 29
25 27
26#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 28#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
27typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 29typedef elf_greg_t elf_gregset_t[ELF_NGREG];
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index 29df88bdd2bc..313cad0628d0 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -320,7 +320,8 @@ typedef struct sal_log_timestamp {
320typedef struct sal_log_record_header { 320typedef struct sal_log_record_header {
321 u64 id; /* Unique monotonically increasing ID */ 321 u64 id; /* Unique monotonically increasing ID */
322 sal_log_revision_t revision; /* Major and Minor revision of header */ 322 sal_log_revision_t revision; /* Major and Minor revision of header */
323 u16 severity; /* Error Severity */ 323 u8 severity; /* Error Severity */
324 u8 validation_bits; /* 0: platform_guid, 1: !timestamp */
324 u32 len; /* Length of this error log in bytes */ 325 u32 len; /* Length of this error log in bytes */
325 sal_log_timestamp_t timestamp; /* Timestamp */ 326 sal_log_timestamp_t timestamp; /* Timestamp */
326 efi_guid_t platform_guid; /* Unique OEM Platform ID */ 327 efi_guid_t platform_guid; /* Unique OEM Platform ID */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index 33d275c3b84c..e867b4ef96d1 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -74,9 +74,6 @@ typedef struct
74 u8 white_list, black_list; 74 u8 white_list, black_list;
75 struct dbdma_cmd *dma_table_cpu; 75 struct dbdma_cmd *dma_table_cpu;
76 dma_addr_t dma_table_dma; 76 dma_addr_t dma_table_dma;
77 struct scatterlist *sg_table;
78 int sg_nents;
79 int sg_dma_direction;
80#endif 77#endif
81 struct device *dev; 78 struct device *dev;
82 int irq; 79 int irq;
@@ -87,11 +84,6 @@ typedef struct
87} _auide_hwif; 84} _auide_hwif;
88 85
89#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 86#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
90struct drive_list_entry {
91 const char * id_model;
92 const char * id_firmware;
93};
94
95/* HD white list */ 87/* HD white list */
96static const struct drive_list_entry dma_white_list [] = { 88static const struct drive_list_entry dma_white_list [] = {
97/* 89/*
@@ -167,13 +159,9 @@ int __init auide_probe(void);
167 * Multi-Word DMA + DbDMA functions 159 * Multi-Word DMA + DbDMA functions
168 */ 160 */
169#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 161#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
170
171 static int in_drive_list(struct hd_driveid *id,
172 const struct drive_list_entry *drive_table);
173 static int auide_build_sglist(ide_drive_t *drive, struct request *rq); 162 static int auide_build_sglist(ide_drive_t *drive, struct request *rq);
174 static int auide_build_dmatable(ide_drive_t *drive); 163 static int auide_build_dmatable(ide_drive_t *drive);
175 static int auide_dma_end(ide_drive_t *drive); 164 static int auide_dma_end(ide_drive_t *drive);
176 static void auide_dma_start(ide_drive_t *drive );
177 ide_startstop_t auide_dma_intr (ide_drive_t *drive); 165 ide_startstop_t auide_dma_intr (ide_drive_t *drive);
178 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command); 166 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command);
179 static int auide_dma_setup(ide_drive_t *drive); 167 static int auide_dma_setup(ide_drive_t *drive);
@@ -188,8 +176,6 @@ int __init auide_probe(void);
188 static void auide_ddma_rx_callback(int irq, void *param, 176 static void auide_ddma_rx_callback(int irq, void *param,
189 struct pt_regs *regs); 177 struct pt_regs *regs);
190 static int auide_dma_off_quietly(ide_drive_t *drive); 178 static int auide_dma_off_quietly(ide_drive_t *drive);
191 static int auide_dma_timeout(ide_drive_t *drive);
192
193#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 179#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
194 180
195/******************************************************************************* 181/*******************************************************************************
@@ -299,3 +285,11 @@ int __init auide_probe(void);
299#define SBC_IDE_MDMA2_TPM (0x00<<6) 285#define SBC_IDE_MDMA2_TPM (0x00<<6)
300#define SBC_IDE_MDMA2_TA (0x12<<0) 286#define SBC_IDE_MDMA2_TA (0x12<<0)
301 287
288#define SBC_IDE_TIMING(mode) \
289 SBC_IDE_##mode##_TWCS | \
290 SBC_IDE_##mode##_TCSH | \
291 SBC_IDE_##mode##_TCSOFF | \
292 SBC_IDE_##mode##_TWP | \
293 SBC_IDE_##mode##_TCSW | \
294 SBC_IDE_##mode##_TPM | \
295 SBC_IDE_##mode##_TA
diff --git a/include/asm-sparc/memreg.h b/include/asm-sparc/memreg.h
index c0498d3baf93..5fb95c828da6 100644
--- a/include/asm-sparc/memreg.h
+++ b/include/asm-sparc/memreg.h
@@ -36,7 +36,7 @@
36 36
37/* Memory parity error register with associated bit constants. */ 37/* Memory parity error register with associated bit constants. */
38#ifndef __ASSEMBLY__ 38#ifndef __ASSEMBLY__
39extern __volatile__ unsigned long *sun4c_memerr_reg; 39extern __volatile__ unsigned long __iomem *sun4c_memerr_reg;
40#endif 40#endif
41 41
42#define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */ 42#define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */
diff --git a/include/asm-sparc/pcic.h b/include/asm-sparc/pcic.h
index 301ae8022ddd..dedea14d87c8 100644
--- a/include/asm-sparc/pcic.h
+++ b/include/asm-sparc/pcic.h
@@ -16,10 +16,10 @@
16#include <asm/pbm.h> 16#include <asm/pbm.h>
17 17
18struct linux_pcic { 18struct linux_pcic {
19 void * __iomem pcic_regs; 19 void __iomem *pcic_regs;
20 unsigned long pcic_io; 20 unsigned long pcic_io;
21 void * __iomem pcic_config_space_addr; 21 void __iomem *pcic_config_space_addr;
22 void * __iomem pcic_config_space_data; 22 void __iomem *pcic_config_space_data;
23 struct resource pcic_res_regs; 23 struct resource pcic_res_regs;
24 struct resource pcic_res_io; 24 struct resource pcic_res_io;
25 struct resource pcic_res_cfg_addr; 25 struct resource pcic_res_cfg_addr;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a39c3c59789d..7b6a6a58e465 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -23,17 +23,6 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/semaphore.h> 24#include <asm/semaphore.h>
25 25
26/*
27 * This is the multiple IDE interface driver, as evolved from hd.c.
28 * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15).
29 * There can be up to two drives per interface, as per the ATA-2 spec.
30 *
31 * Primary i/f: ide0: major=3; (hda) minor=0; (hdb) minor=64
32 * Secondary i/f: ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64
33 * Tertiary i/f: ide2: major=33; (hde) minor=0; (hdf) minor=64
34 * Quaternary i/f: ide3: major=34; (hdg) minor=0; (hdh) minor=64
35 */
36
37/****************************************************************************** 26/******************************************************************************
38 * IDE driver configuration options (play with these as desired): 27 * IDE driver configuration options (play with these as desired):
39 * 28 *
@@ -193,11 +182,6 @@ typedef unsigned char byte; /* used everywhere */
193#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ 182#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
194#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ 183#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
195 184
196#define HOST(hwif,chipset) \
197{ \
198 return ((hwif)->chipset == chipset) ? 1 : 0; \
199}
200
201/* 185/*
202 * Check for an interrupt and acknowledge the interrupt status 186 * Check for an interrupt and acknowledge the interrupt status
203 */ 187 */
@@ -391,45 +375,6 @@ typedef union {
391} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; 375} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t;
392 376
393/* 377/*
394 * ATA-IDE Error Register
395 *
396 * mark : Bad address mark
397 * tzero : Couldn't find track 0
398 * abrt : Aborted Command
399 * mcr : Media Change Request
400 * id : ID field not found
401 * mce : Media Change Event
402 * ecc : Uncorrectable ECC error
403 * bdd : dual meaing
404 */
405typedef union {
406 unsigned all :8;
407 struct {
408#if defined(__LITTLE_ENDIAN_BITFIELD)
409 unsigned mark :1;
410 unsigned tzero :1;
411 unsigned abrt :1;
412 unsigned mcr :1;
413 unsigned id :1;
414 unsigned mce :1;
415 unsigned ecc :1;
416 unsigned bdd :1;
417#elif defined(__BIG_ENDIAN_BITFIELD)
418 unsigned bdd :1;
419 unsigned ecc :1;
420 unsigned mce :1;
421 unsigned id :1;
422 unsigned mcr :1;
423 unsigned abrt :1;
424 unsigned tzero :1;
425 unsigned mark :1;
426#else
427#error "Please fix <asm/byteorder.h>"
428#endif
429 } b;
430} ata_error_t;
431
432/*
433 * ATA-IDE Select Register, aka Device-Head 378 * ATA-IDE Select Register, aka Device-Head
434 * 379 *
435 * head : always zeros here 380 * head : always zeros here
@@ -504,39 +449,6 @@ typedef union {
504} ata_status_t, atapi_status_t; 449} ata_status_t, atapi_status_t;
505 450
506/* 451/*
507 * ATA-IDE Control Register
508 *
509 * bit0 : Should be set to zero
510 * nIEN : device INTRQ to host
511 * SRST : host soft reset bit
512 * bit3 : ATA-2 thingy, Should be set to 1
513 * reserved456 : Reserved
514 * HOB : 48-bit address ordering, High Ordered Bit
515 */
516typedef union {
517 unsigned all : 8;
518 struct {
519#if defined(__LITTLE_ENDIAN_BITFIELD)
520 unsigned bit0 : 1;
521 unsigned nIEN : 1;
522 unsigned SRST : 1;
523 unsigned bit3 : 1;
524 unsigned reserved456 : 3;
525 unsigned HOB : 1;
526#elif defined(__BIG_ENDIAN_BITFIELD)
527 unsigned HOB : 1;
528 unsigned reserved456 : 3;
529 unsigned bit3 : 1;
530 unsigned SRST : 1;
531 unsigned nIEN : 1;
532 unsigned bit0 : 1;
533#else
534#error "Please fix <asm/byteorder.h>"
535#endif
536 } b;
537} ata_control_t;
538
539/*
540 * ATAPI Feature Register 452 * ATAPI Feature Register
541 * 453 *
542 * dma : Using DMA or PIO 454 * dma : Using DMA or PIO
@@ -618,39 +530,6 @@ typedef union {
618} atapi_error_t; 530} atapi_error_t;
619 531
620/* 532/*
621 * ATAPI floppy Drive Select Register
622 *
623 * sam_lun : Logical unit number
624 * reserved3 : Reserved
625 * drv : The responding drive will be drive 0 (0) or drive 1 (1)
626 * one5 : Should be set to 1
627 * reserved6 : Reserved
628 * one7 : Should be set to 1
629 */
630typedef union {
631 unsigned all :8;
632 struct {
633#if defined(__LITTLE_ENDIAN_BITFIELD)
634 unsigned sam_lun :3;
635 unsigned reserved3 :1;
636 unsigned drv :1;
637 unsigned one5 :1;
638 unsigned reserved6 :1;
639 unsigned one7 :1;
640#elif defined(__BIG_ENDIAN_BITFIELD)
641 unsigned one7 :1;
642 unsigned reserved6 :1;
643 unsigned one5 :1;
644 unsigned drv :1;
645 unsigned reserved3 :1;
646 unsigned sam_lun :3;
647#else
648#error "Please fix <asm/byteorder.h>"
649#endif
650 } b;
651} atapi_select_t;
652
653/*
654 * Status returned from various ide_ functions 533 * Status returned from various ide_ functions
655 */ 534 */
656typedef enum { 535typedef enum {
@@ -1101,10 +980,7 @@ typedef struct ide_driver_s {
1101 int (*end_request)(ide_drive_t *, int, int); 980 int (*end_request)(ide_drive_t *, int, int);
1102 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 981 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
1103 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 982 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
1104 int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
1105 ide_proc_entry_t *proc; 983 ide_proc_entry_t *proc;
1106 void (*ata_prebuilder)(ide_drive_t *);
1107 void (*atapi_prebuilder)(ide_drive_t *);
1108 struct device_driver gen_driver; 984 struct device_driver gen_driver;
1109} ide_driver_t; 985} ide_driver_t;
1110 986
@@ -1298,7 +1174,6 @@ extern int ide_spin_wait_hwgroup(ide_drive_t *);
1298extern void ide_timer_expiry(unsigned long); 1174extern void ide_timer_expiry(unsigned long);
1299extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs); 1175extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs);
1300extern void do_ide_request(request_queue_t *); 1176extern void do_ide_request(request_queue_t *);
1301extern void ide_init_subdrivers(void);
1302 1177
1303void ide_init_disk(struct gendisk *, ide_drive_t *); 1178void ide_init_disk(struct gendisk *, ide_drive_t *);
1304 1179
@@ -1371,6 +1246,12 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *);
1371#define GOOD_DMA_DRIVE 1 1246#define GOOD_DMA_DRIVE 1
1372 1247
1373#ifdef CONFIG_BLK_DEV_IDEDMA 1248#ifdef CONFIG_BLK_DEV_IDEDMA
1249struct drive_list_entry {
1250 const char *id_model;
1251 const char *id_firmware;
1252};
1253
1254int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1374int __ide_dma_bad_drive(ide_drive_t *); 1255int __ide_dma_bad_drive(ide_drive_t *);
1375int __ide_dma_good_drive(ide_drive_t *); 1256int __ide_dma_good_drive(ide_drive_t *);
1376int ide_use_dma(ide_drive_t *); 1257int ide_use_dma(ide_drive_t *);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index f2dbb684ce9e..41ea7dbc1755 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -122,6 +122,7 @@ enum {
122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once 122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
123 * proper HSM is in place. */ 123 * proper HSM is in place. */
124 ATA_FLAG_DEBUGMSG = (1 << 10), 124 ATA_FLAG_DEBUGMSG = (1 << 10),
125 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */
125 126
126 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 127 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
127 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 128 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index aa76fc4e38c2..a17e171384ef 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1245,6 +1245,7 @@
1245#define PCI_DEVICE_ID_VIA_8378_0 0x3205 1245#define PCI_DEVICE_ID_VIA_8378_0 0x3205
1246#define PCI_DEVICE_ID_VIA_8783_0 0x3208 1246#define PCI_DEVICE_ID_VIA_8783_0 0x3208
1247#define PCI_DEVICE_ID_VIA_8237 0x3227 1247#define PCI_DEVICE_ID_VIA_8237 0x3227
1248#define PCI_DEVICE_ID_VIA_8251 0x3287
1248#define PCI_DEVICE_ID_VIA_3296_0 0x0296 1249#define PCI_DEVICE_ID_VIA_3296_0 0x0296
1249#define PCI_DEVICE_ID_VIA_8231 0x8231 1250#define PCI_DEVICE_ID_VIA_8231 0x8231
1250#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1251#define PCI_DEVICE_ID_VIA_8231_4 0x8235
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 7529f4388bb4..20da282d4abb 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,5 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
151extern void scsi_put_command(struct scsi_cmnd *); 151extern void scsi_put_command(struct scsi_cmnd *);
152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
153extern void scsi_finish_command(struct scsi_cmnd *cmd); 153extern void scsi_finish_command(struct scsi_cmnd *cmd);
154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries);
154 155
155#endif /* _SCSI_SCSI_CMND_H */ 156#endif /* _SCSI_SCSI_CMND_H */
diff --git a/init/Kconfig b/init/Kconfig
index ea097e0a9c02..6c5dbedc6e96 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -206,7 +206,7 @@ config HOTPLUG
206 outside the kernel tree does. Such modules require Y here. 206 outside the kernel tree does. Such modules require Y here.
207 207
208config KOBJECT_UEVENT 208config KOBJECT_UEVENT
209 bool "Kernel Userspace Events" 209 bool "Kernel Userspace Events" if EMBEDDED
210 depends on NET 210 depends on NET
211 default y 211 default y
212 help 212 help
@@ -256,6 +256,20 @@ config CPUSETS
256 256
257source "usr/Kconfig" 257source "usr/Kconfig"
258 258
259config CC_OPTIMIZE_FOR_SIZE
260 bool "Optimize for size (Look out for broken compilers!)"
261 default y
262 depends on ARM || H8300 || EXPERIMENTAL
263 depends on !SPARC64
264 help
265 Enabling this option will pass "-Os" instead of "-O2" to gcc
266 resulting in a smaller kernel.
267
268 WARNING: some versions of gcc may generate incorrect code with this
269 option. If problems are observed, a gcc upgrade may be needed.
270
271 If unsure, say N.
272
259menuconfig EMBEDDED 273menuconfig EMBEDDED
260 bool "Configure standard kernel features (for small systems)" 274 bool "Configure standard kernel features (for small systems)"
261 help 275 help
@@ -338,18 +352,6 @@ config EPOLL
338 Disabling this option will cause the kernel to be built without 352 Disabling this option will cause the kernel to be built without
339 support for epoll family of system calls. 353 support for epoll family of system calls.
340 354
341config CC_OPTIMIZE_FOR_SIZE
342 bool "Optimize for size" if EMBEDDED
343 default y if ARM || H8300
344 help
345 Enabling this option will pass "-Os" instead of "-O2" to gcc
346 resulting in a smaller kernel.
347
348 WARNING: some versions of gcc may generate incorrect code with this
349 option. If problems are observed, a gcc upgrade may be needed.
350
351 If unsure, say N.
352
353config SHMEM 355config SHMEM
354 bool "Use full shmem filesystem" if EMBEDDED 356 bool "Use full shmem filesystem" if EMBEDDED
355 default y 357 default y
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 431a64f021c0..f6d4af8af8a8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -104,7 +104,7 @@ static void grow_pgdat_span(struct pglist_data *pgdat,
104 pgdat->node_start_pfn = start_pfn; 104 pgdat->node_start_pfn = start_pfn;
105 105
106 if (end_pfn > old_pgdat_end_pfn) 106 if (end_pfn > old_pgdat_end_pfn)
107 pgdat->node_spanned_pages = end_pfn - pgdat->node_spanned_pages; 107 pgdat->node_spanned_pages = end_pfn - pgdat->node_start_pfn;
108} 108}
109 109
110int online_pages(unsigned long pfn, unsigned long nr_pages) 110int online_pages(unsigned long pfn, unsigned long nr_pages)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3b21a13d841c..fe14a8c87fc2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1896,7 +1896,7 @@ static int __devinit pageset_cpuup_callback(struct notifier_block *nfb,
1896static struct notifier_block pageset_notifier = 1896static struct notifier_block pageset_notifier =
1897 { &pageset_cpuup_callback, NULL, 0 }; 1897 { &pageset_cpuup_callback, NULL, 0 };
1898 1898
1899void __init setup_per_cpu_pageset() 1899void __init setup_per_cpu_pageset(void)
1900{ 1900{
1901 int err; 1901 int err;
1902 1902
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index b74864889670..f2a8750bbf1d 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -165,6 +165,9 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
165 165
166 skb_pull(skb, VLAN_HLEN); /* take off the VLAN header (4 bytes currently) */ 166 skb_pull(skb, VLAN_HLEN); /* take off the VLAN header (4 bytes currently) */
167 167
168 /* Need to correct hardware checksum */
169 skb_postpull_rcsum(skb, vhdr, VLAN_HLEN);
170
168 /* Ok, lets check to make sure the device (dev) we 171 /* Ok, lets check to make sure the device (dev) we
169 * came in on is what this VLAN is attached to. 172 * came in on is what this VLAN is attached to.
170 */ 173 */
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index a4c347c3b8e3..46f9d9cf7a5f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -618,7 +618,7 @@ static int ipgre_rcv(struct sk_buff *skb)
618 618
619 skb->mac.raw = skb->nh.raw; 619 skb->mac.raw = skb->nh.raw;
620 skb->nh.raw = __pskb_pull(skb, offset); 620 skb->nh.raw = __pskb_pull(skb, offset);
621 skb_postpull_rcsum(skb, skb->mac.raw, offset); 621 skb_postpull_rcsum(skb, skb->h.raw, offset);
622 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); 622 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
623 skb->pkt_type = PACKET_HOST; 623 skb->pkt_type = PACKET_HOST;
624#ifdef CONFIG_NET_IPGRE_BROADCAST 624#ifdef CONFIG_NET_IPGRE_BROADCAST
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 76ff9f4fe89d..73a23b4130a5 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -379,8 +379,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
379 dev->type == ARPHRD_NONE || 379 dev->type == ARPHRD_NONE ||
380 dev->type == ARPHRD_SIT) { 380 dev->type == ARPHRD_SIT) {
381 printk(KERN_INFO 381 printk(KERN_INFO
382 "Disabled Privacy Extensions on device %p(%s)\n", 382 "%s: Disabled Privacy Extensions\n",
383 dev, dev->name); 383 dev->name);
384 ndev->cnf.use_tempaddr = -1; 384 ndev->cnf.use_tempaddr = -1;
385 } else { 385 } else {
386 in6_dev_hold(ndev); 386 in6_dev_hold(ndev);
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 8aebe8f6d271..2ce1cb2aa2ed 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -34,7 +34,7 @@
34#include <net/sch_generic.h> 34#include <net/sch_generic.h>
35#include <net/act_api.h> 35#include <net/act_api.h>
36 36
37#if 1 /* control */ 37#if 0 /* control */
38#define DPRINTK(format, args...) printk(KERN_DEBUG format, ##args) 38#define DPRINTK(format, args...) printk(KERN_DEBUG format, ##args)
39#else 39#else
40#define DPRINTK(format, args...) 40#define DPRINTK(format, args...)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d890dfa8818f..1f7f244806b7 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3425,7 +3425,7 @@ static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_add
3425} 3425}
3426 3426
3427static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, 3427static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port,
3428 void * __user *to, size_t space_left) 3428 void __user **to, size_t space_left)
3429{ 3429{
3430 struct list_head *pos; 3430 struct list_head *pos;
3431 struct sctp_sockaddr_entry *addr; 3431 struct sctp_sockaddr_entry *addr;
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index 6b46a8a4b1cc..b963c550dae6 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -578,17 +578,15 @@ set_recv_slots(int num_channels)
578 } while ((stat & PSC_AC97STAT_DR) == 0); 578 } while ((stat & PSC_AC97STAT_DR) == 0);
579} 579}
580 580
581/* Hold spinlock for both start_dac() and start_adc() calls */
581static void 582static void
582start_dac(struct au1550_state *s) 583start_dac(struct au1550_state *s)
583{ 584{
584 struct dmabuf *db = &s->dma_dac; 585 struct dmabuf *db = &s->dma_dac;
585 unsigned long flags;
586 586
587 if (!db->stopped) 587 if (!db->stopped)
588 return; 588 return;
589 589
590 spin_lock_irqsave(&s->lock, flags);
591
592 set_xmit_slots(db->num_channels); 590 set_xmit_slots(db->num_channels);
593 au_writel(PSC_AC97PCR_TC, PSC_AC97PCR); 591 au_writel(PSC_AC97PCR_TC, PSC_AC97PCR);
594 au_sync(); 592 au_sync();
@@ -598,8 +596,6 @@ start_dac(struct au1550_state *s)
598 au1xxx_dbdma_start(db->dmanr); 596 au1xxx_dbdma_start(db->dmanr);
599 597
600 db->stopped = 0; 598 db->stopped = 0;
601
602 spin_unlock_irqrestore(&s->lock, flags);
603} 599}
604 600
605static void 601static void
@@ -718,7 +714,6 @@ prog_dmabuf_dac(struct au1550_state *s)
718} 714}
719 715
720 716
721/* hold spinlock for the following */
722static void 717static void
723dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) 718dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
724{ 719{
@@ -726,6 +721,8 @@ dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
726 struct dmabuf *db = &s->dma_dac; 721 struct dmabuf *db = &s->dma_dac;
727 u32 ac97c_stat; 722 u32 ac97c_stat;
728 723
724 spin_lock(&s->lock);
725
729 ac97c_stat = au_readl(PSC_AC97STAT); 726 ac97c_stat = au_readl(PSC_AC97STAT);
730 if (ac97c_stat & (AC97C_XU | AC97C_XO | AC97C_TE)) 727 if (ac97c_stat & (AC97C_XU | AC97C_XO | AC97C_TE))
731 pr_debug("AC97C status = 0x%08x\n", ac97c_stat); 728 pr_debug("AC97C status = 0x%08x\n", ac97c_stat);
@@ -747,6 +744,8 @@ dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
747 /* wake up anybody listening */ 744 /* wake up anybody listening */
748 if (waitqueue_active(&db->wait)) 745 if (waitqueue_active(&db->wait))
749 wake_up(&db->wait); 746 wake_up(&db->wait);
747
748 spin_unlock(&s->lock);
750} 749}
751 750
752 751
@@ -758,6 +757,8 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
758 u32 obytes; 757 u32 obytes;
759 char *obuf; 758 char *obuf;
760 759
760 spin_lock(&s->lock);
761
761 /* Pull the buffer from the dma queue. 762 /* Pull the buffer from the dma queue.
762 */ 763 */
763 au1xxx_dbdma_get_dest(dp->dmanr, (void *)(&obuf), &obytes); 764 au1xxx_dbdma_get_dest(dp->dmanr, (void *)(&obuf), &obytes);
@@ -765,6 +766,7 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
765 if ((dp->count + obytes) > dp->dmasize) { 766 if ((dp->count + obytes) > dp->dmasize) {
766 /* Overrun. Stop ADC and log the error 767 /* Overrun. Stop ADC and log the error
767 */ 768 */
769 spin_unlock(&s->lock);
768 stop_adc(s); 770 stop_adc(s);
769 dp->error++; 771 dp->error++;
770 err("adc overrun"); 772 err("adc overrun");
@@ -787,6 +789,7 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
787 if (waitqueue_active(&dp->wait)) 789 if (waitqueue_active(&dp->wait))
788 wake_up(&dp->wait); 790 wake_up(&dp->wait);
789 791
792 spin_unlock(&s->lock);
790} 793}
791 794
792static loff_t 795static loff_t
@@ -1048,9 +1051,9 @@ au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
1048 /* wait for samples in ADC dma buffer 1051 /* wait for samples in ADC dma buffer
1049 */ 1052 */
1050 do { 1053 do {
1054 spin_lock_irqsave(&s->lock, flags);
1051 if (db->stopped) 1055 if (db->stopped)
1052 start_adc(s); 1056 start_adc(s);
1053 spin_lock_irqsave(&s->lock, flags);
1054 avail = db->count; 1057 avail = db->count;
1055 if (avail <= 0) 1058 if (avail <= 0)
1056 __set_current_state(TASK_INTERRUPTIBLE); 1059 __set_current_state(TASK_INTERRUPTIBLE);
@@ -1570,15 +1573,19 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
1570 if (get_user(val, (int *) arg)) 1573 if (get_user(val, (int *) arg))
1571 return -EFAULT; 1574 return -EFAULT;
1572 if (file->f_mode & FMODE_READ) { 1575 if (file->f_mode & FMODE_READ) {
1573 if (val & PCM_ENABLE_INPUT) 1576 if (val & PCM_ENABLE_INPUT) {
1577 spin_lock_irqsave(&s->lock, flags);
1574 start_adc(s); 1578 start_adc(s);
1575 else 1579 spin_unlock_irqrestore(&s->lock, flags);
1580 } else
1576 stop_adc(s); 1581 stop_adc(s);
1577 } 1582 }
1578 if (file->f_mode & FMODE_WRITE) { 1583 if (file->f_mode & FMODE_WRITE) {
1579 if (val & PCM_ENABLE_OUTPUT) 1584 if (val & PCM_ENABLE_OUTPUT) {
1585 spin_lock_irqsave(&s->lock, flags);
1580 start_dac(s); 1586 start_dac(s);
1581 else 1587 spin_unlock_irqrestore(&s->lock, flags);
1588 } else
1582 stop_dac(s); 1589 stop_dac(s);
1583 } 1590 }
1584 return 0; 1591 return 0;