## Automatically generated incremental diff
## From:   linux-2.5.63-bk2
## To:     linux-2.5.63-bk3
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.5.63-bk2/Documentation/networking/netdevices.txt linux-2.5.63-bk3/Documentation/networking/netdevices.txt
--- linux-2.5.63-bk2/Documentation/networking/netdevices.txt	Mon Feb 24 11:05:12 2003
+++ linux-2.5.63-bk3/Documentation/networking/netdevices.txt	Mon Mar 31 12:17:13 2003
@@ -18,7 +18,8 @@
 dev->stop:
 	Synchronization: rtnl_lock() semaphore.
 	Context: process
-	Notes: netif_running() is guaranteed false when this is called
+	Note1: netif_running() is guaranteed false
+	Note2: dev->poll() is guaranteed to be stopped
 
 dev->do_ioctl:
 	Synchronization: rtnl_lock() semaphore.
@@ -31,10 +32,12 @@
 dev->hard_start_xmit:
 	Synchronization: dev->xmit_lock spinlock.
 	Context: BHs disabled
+	Notes: netif_queue_stopped() is guaranteed false
 
 dev->tx_timeout:
 	Synchronization: dev->xmit_lock spinlock.
 	Context: BHs disabled
+	Notes: netif_queue_stopped() is guaranteed true
 
 dev->set_multicast_list:
 	Synchronization: dev->xmit_lock spinlock.
diff -urN linux-2.5.63-bk2/Makefile linux-2.5.63-bk3/Makefile
--- linux-2.5.63-bk2/Makefile	Mon Mar 31 12:17:10 2003
+++ linux-2.5.63-bk3/Makefile	Mon Mar 31 12:17:13 2003
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 5
 SUBLEVEL = 63
-EXTRAVERSION = bk2
+EXTRAVERSION = bk3
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
diff -urN linux-2.5.63-bk2/arch/i386/kernel/apic.c linux-2.5.63-bk3/arch/i386/kernel/apic.c
--- linux-2.5.63-bk2/arch/i386/kernel/apic.c	Mon Feb 24 11:06:02 2003
+++ linux-2.5.63-bk3/arch/i386/kernel/apic.c	Mon Mar 31 12:17:13 2003
@@ -665,7 +665,6 @@
 	}
 	set_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
 	mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
-	boot_cpu_physical_apicid = 0;
 	if (nmi_watchdog != NMI_NONE)
 		nmi_watchdog = NMI_LOCAL_APIC;
 
@@ -1154,8 +1153,7 @@
 
 	connect_bsp_APIC();
 
-	phys_cpu_present_map = 1;
-	apic_write_around(APIC_ID, boot_cpu_physical_apicid);
+	phys_cpu_present_map = 1 << boot_cpu_physical_apicid;
 
 	apic_pm_init2();
 
diff -urN linux-2.5.63-bk2/drivers/net/pcmcia/Kconfig linux-2.5.63-bk3/drivers/net/pcmcia/Kconfig
--- linux-2.5.63-bk2/drivers/net/pcmcia/Kconfig	Mon Feb 24 11:05:39 2003
+++ linux-2.5.63-bk3/drivers/net/pcmcia/Kconfig	Mon Mar 31 12:17:15 2003
@@ -153,19 +153,5 @@
 	  The module will be called ibmtr_cs.  If you want to compile it as
 	  a module, say M here and read <file:Documentation/modules.txt>.
 
-config AIRONET4500_CS
-	tristate "Aironet 4500/4800 PCMCIA support"
-	depends on NET_PCMCIA_RADIO && AIRONET4500 && PCMCIA
-	help
-	  Say Y here if you have a PCMCIA Aironet 4500/4800 card which you
-	  want to use with the standard PCMCIA cardservices provided by the
-	  pcmcia-cs package.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called aironet4500_cs. If you want to
-	  compile it as a module, say M here and read
-	  <file:Documentation/modules.txt>.
-
 endmenu
 
diff -urN linux-2.5.63-bk2/drivers/net/pcmcia/Makefile linux-2.5.63-bk3/drivers/net/pcmcia/Makefile
--- linux-2.5.63-bk2/drivers/net/pcmcia/Makefile	Mon Feb 24 11:05:04 2003
+++ linux-2.5.63-bk3/drivers/net/pcmcia/Makefile	Mon Mar 31 12:17:15 2003
@@ -13,7 +13,4 @@
 obj-$(CONFIG_ARCNET_COM20020_CS)+= com20020_cs.o
 obj-$(CONFIG_PCMCIA_AXNET)	+= axnet_cs.o
 
-# 16-bit wireless client drivers
-obj-$(CONFIG_AIRONET4500_CS)	+= aironet4500_cs.o
-
 obj-$(CONFIG_PCMCIA_IBMTR)	+= ibmtr_cs.o
diff -urN linux-2.5.63-bk2/drivers/net/pcmcia/aironet4500_cs.c linux-2.5.63-bk3/drivers/net/pcmcia/aironet4500_cs.c
--- linux-2.5.63-bk2/drivers/net/pcmcia/aironet4500_cs.c	Mon Feb 24 11:05:06 2003
+++ linux-2.5.63-bk3/drivers/net/pcmcia/aironet4500_cs.c	Wed Dec 31 16:00:00 1969
@@ -1,706 +0,0 @@
-/*
- *	 Aironet 4500 Pcmcia driver
- *
- *		Elmer Joandi, Januar 1999
- *	Copyright Elmer Joandi, all rights restricted
- *	
- *
- *	Revision 0.1 ,started  30.12.1998
- *
- *
- */
-
-#define DRV_NAME	"aironet4500_cs"
-#define DRV_VERSION	"0.1"
-
-static const char *awc_version =
-DRV_NAME ".c v" DRV_VERSION " 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
-
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/in.h>
-#include <linux/ethtool.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/ioport.h>
-
-#include <pcmcia/version.h>
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
-#include <pcmcia/cistpl.h>
-#include <pcmcia/cisreg.h>
-#include <pcmcia/ciscode.h>
-#include <pcmcia/ds.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/bitops.h>
-
-#include "../aironet4500.h"
-
-static u_int irq_mask = 0x5eF8;
-static int 	awc_ports[] = {0x140,0x100,0xc0, 0x80 };
-#if LINUX_VERSION_CODE > 0x20100
-MODULE_PARM(irq_mask, "i");
-
-#endif
-
-
-#define RUN_AT(x)               (jiffies+(x))
-
-#ifdef PCMCIA_DEBUG
-static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
-#define PC_DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"aironet4500_cs.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
-#else
-#define PC_DEBUG(n, args...)
-#endif
-
-/* Index of functions. */
-
-static dev_info_t dev_info = "aironet4500_cs";
-
-static dev_link_t *awc_attach(void);
-static void awc_detach(dev_link_t *);
-static void awc_release(u_long arg);
-static int awc_event(event_t event, int priority,
-					   event_callback_args_t *args);
-
-static dev_link_t *dev_list;
-
-static void cs_error(client_handle_t handle, int func, int ret)
-{
-#if CS_RELEASE_CODE < 0x2911
-    CardServices(ReportError, dev_info, (void *)func, (void *)ret);
-#else
-	error_info_t err = { func, ret };
-	CardServices(ReportError, handle, &err);
-#endif
-}
-
-#define CFG_CHECK(fn, args...) if (CardServices(fn, args) != 0) goto next_entry
-
-static void flush_stale_links(void)
-{
-    dev_link_t *link, *next;
-    for (link = dev_list; link; link = next) {
-	next = link->next;
-	if (link->state & DEV_STALE_LINK)
-	    awc_detach(link);
-    }
-}
-
-
-/*
-   We never need to do anything when a awc device is "initialized"
-   by the net software, because we only register already-found cards.
-*/
-
-static int awc_pcmcia_init(struct net_device *dev)
-{
-	return awc_init(dev);
-
-}
-
-static int awc_pcmcia_open(struct net_device *dev)
-{
-	dev_link_t *link;
-	int status;
-	
-	for (link = dev_list; link; link = link->next)
-		if (link->priv == dev) break;
-	if (!DEV_OK(link))
-		return -ENODEV;
-	
-	status = awc_open(dev);
-	
-	if (!status )
-		link->open++;
-	
-	return status;
-}
-
-static int awc_pcmcia_close(struct net_device *dev)
-{
-//	int ioaddr = dev->base_addr;
-	dev_link_t *link;
-	int ret;
-	
-	for (link = dev_list; link; link = link->next)
-		if (link->priv == dev) break;
-	if (link == NULL)
-		return -ENODEV;
-
-	PC_DEBUG(2, "%s: closing device.\n", dev->name);
-
-	link->open--;
-	ret = awc_close(dev);
-	
-	if (link->state & DEV_STALE_CONFIG) {
-		link->release.expires = RUN_AT( HZ/20 );
-		link->state |= DEV_RELEASE_PENDING;
-		add_timer(&link->release);
-	}
-	return ret;
-}
-
-static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
-{
-	u32 ethcmd;
-
-	/* dev_ioctl() in ../../net/core/dev.c has already checked
-	   capable(CAP_NET_ADMIN), so don't bother with that here.  */
-
-	if (get_user(ethcmd, (u32 *)useraddr))
-		return -EFAULT;
-
-	switch (ethcmd) {
-
-	case ETHTOOL_GDRVINFO: {
-		struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
-		strcpy (info.driver, DRV_NAME);
-		strcpy (info.version, DRV_VERSION);
-		sprintf(info.bus_info, "PCMCIA 0x%lx", dev->base_addr);
-		if (copy_to_user (useraddr, &info, sizeof (info)))
-			return -EFAULT;
-		return 0;
-	}
-
-#ifdef PCMCIA_DEBUG
-	/* get message-level */
-	case ETHTOOL_GMSGLVL: {
-		struct ethtool_value edata = {ETHTOOL_GMSGLVL};
-		edata.data = pc_debug;
-		if (copy_to_user(useraddr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
-	}
-	/* set message-level */
-	case ETHTOOL_SMSGLVL: {
-		struct ethtool_value edata;
-		if (copy_from_user(&edata, useraddr, sizeof(edata)))
-			return -EFAULT;
-		pc_debug = edata.data;
-		return 0;
-	}
-#endif
-
-	default:
-		break;
-	}
-
-	return -EOPNOTSUPP;
-}
-
-static int awc_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	switch (cmd) {
-	case SIOCETHTOOL:
-		return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
-
-	default:
-		return -EOPNOTSUPP;
-	}
-	return 0;
-}
-
-/*
-	awc_attach() creates an "instance" of the driver, allocating
-	local data structures for one device.  The device is registered
-	with Card Services.
-*/
-
-static dev_link_t *awc_attach(void)
-{
-	client_reg_t client_reg;
-	dev_link_t *link = NULL;
-	struct net_device *dev = NULL;
-	int  ret;
-
-	PC_DEBUG(0, "awc_attach()\n");
-	flush_stale_links();
-
-	/* Create the PC card device object. */
-	link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
-	if (!link)
-		return NULL;
-	memset(link, 0, sizeof(struct dev_link_t));
-
-	link->dev = kmalloc(sizeof(struct dev_node_t), GFP_KERNEL);
-	if (!link->dev) {
-		kfree(link);
-		return NULL;
-	}
-
-	memset(link->dev, 0, sizeof(struct dev_node_t));
-
-	init_timer(&link->release);
-	link->release.function = &awc_release;
-	link->release.data = (u_long)link;
-//	link->io.NumPorts1 = 32;
-	link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
-//	link->io.IOAddrLines = 5;
-	link->irq.Attributes = IRQ_HANDLE_PRESENT ; // |IRQ_TYPE_EXCLUSIVE  ;
-	link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID;
-	link->irq.IRQInfo2 = irq_mask;
-	link->irq.Handler = &awc_interrupt;
-	link->conf.Attributes = CONF_ENABLE_IRQ;
-	link->conf.Vcc = 50;
-	link->conf.IntType = INT_MEMORY_AND_IO;
-	link->conf.ConfigIndex = 1;
-	link->conf.Present = PRESENT_OPTION;
-
-	/* Create the network device object. */
-
-	dev = kmalloc(sizeof(struct net_device ), GFP_KERNEL);
-//	dev =  init_etherdev(0, sizeof(struct awc_private) );
-	if (!dev ) {
-		printk(KERN_CRIT "out of mem on dev alloc \n");
-		kfree(link->dev);
-		kfree(link);
-		return NULL;
-	};
-	memset(dev,0,sizeof(struct net_device));
-	dev->priv = kmalloc(sizeof(struct awc_private), GFP_KERNEL);
-	if (!dev->priv ) {printk(KERN_CRIT "out of mem on dev priv alloc \n"); return NULL;};
-	memset(dev->priv,0,sizeof(struct awc_private));
-	
-//	link->dev->minor = dev->minor;
-//	link->dev->major = dev->major;
-
-	/* The 4500-specific entries in the device structure. */
-
-//	dev->tx_queue_len = tx_queue_len;
-
-	dev->hard_start_xmit = 		&awc_start_xmit;
-//	dev->set_config = 		&awc_config_misiganes,aga mitte awc_config;
-	dev->get_stats = 		&awc_get_stats;
-//	dev->set_multicast_list = 	&awc_set_multicast_list;
-	dev->do_ioctl =			&awc_ioctl;
-	
-	strcpy(dev->name, ((struct awc_private *)dev->priv)->node.dev_name);
-
-	ether_setup(dev);
-
-	dev->init = &awc_pcmcia_init;
-	dev->open = &awc_pcmcia_open;
-	dev->stop = &awc_pcmcia_close;
-	
-	link->priv = dev;
-#if CS_RELEASE_CODE > 0x2911
-	link->irq.Instance = dev;
-#endif
-
-	/* Register with Card Services */
-	link->next = dev_list;
-	dev_list = link;
-	
-        
-	client_reg.dev_info = &dev_info;
-	client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
-	client_reg.EventMask =
-		CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
-			CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
-				CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
-	client_reg.event_handler = &awc_event;
-	client_reg.Version = 0x0210;
-	client_reg.event_callback_args.client_data = link;
-	ret = CardServices(RegisterClient, &link->handle, &client_reg);
-	if (ret != 0) {
-		cs_error(link->handle, RegisterClient, ret);
-		awc_detach(link);
-		return NULL;
-	}
-
-	return link;
-} /* awc_attach */
-
-/*
-
-	This deletes a driver "instance".  The device is de-registered
-	with Card Services.  If it has been released, all local data
-	structures are freed.  Otherwise, the structures will be freed
-	when the device is released.
-
-*/
-
-static void awc_detach(dev_link_t *link)
-{
-	dev_link_t **linkp;
-	unsigned long flags;
-	int i=0;
-
-	DEBUG(0, "awc_detach(0x%p)\n", link);
-
-	/* Locate device structure */
-	for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
-		if (*linkp == link) break;
-	if (*linkp == NULL)
-	return;
-
-	save_flags(flags);
-	cli();
-	if (link->state & DEV_RELEASE_PENDING) {
-		del_timer(&link->release);
-		link->state &= ~DEV_RELEASE_PENDING;
-	}
-	restore_flags(flags);
-
-	if (link->state & DEV_CONFIG) {
-		awc_release((u_long)link);
-		if (link->state & DEV_STALE_CONFIG) {
-			link->state |= DEV_STALE_LINK;
-			return;
-		}
-	}
-
-	if (link->handle)
-		CardServices(DeregisterClient, link->handle);
-
-	/* Unlink device structure, free bits */
-	*linkp = link->next;
-
-	i=0;
-	while ( i < MAX_AWCS) {
-		if (!aironet4500_devices[i])
-			{i++; continue;}
-		if (aironet4500_devices[i] == link->priv){
-			if (awc_proc_unset_fun)
-				awc_proc_unset_fun(i);
-
-			aironet4500_devices[i]=0;
-		}
-		i++;
-	}
-	
-	if (link->priv) {
-		//struct net_device *dev = link->priv;
-		// dam dam damn mif (dev->priv)
-		//	kfree(dev->priv);
-		kfree(link->priv);
-	}
-	kfree(link->dev);
-	kfree(link);
-
-} /* awc_detach */
-
-/*
-
-	awc_pcmcia_config() is scheduled to run after a CARD_INSERTION event
-	is received, to configure the PCMCIA socket, and to make the
-	ethernet device available to the system.
-
-*/
-
-#define CS_CHECK(fn, args...) \
-while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
-
-static void awc_pcmcia_config(dev_link_t *link)
-{
-	client_handle_t handle;
-	struct net_device *dev;
-	struct awc_private *lp;
-	tuple_t tuple;
-	int ii;
-	cisparse_t parse;
-	u_short buf[64];
-	int last_fn, last_ret, i = 0;
-//	int ioaddr;
-	u16 *phys_addr;
-	int retval;
-	
-	handle = link->handle;
-	dev = link->priv;
-	phys_addr = (u16 *)dev->dev_addr;
-
-	PC_DEBUG(0, "awc_pcmcia_config(0x%p)\n", link);
-
-	tuple.Attributes = 0;
-	tuple.DesiredTuple = CISTPL_CONFIG;
-	CS_CHECK(GetFirstTuple, handle, &tuple);
-	tuple.TupleData = (cisdata_t *)buf;
-	tuple.TupleDataMax = 64;
-	tuple.TupleOffset = 0;
-	CS_CHECK(GetTupleData, handle, &tuple);
-	CS_CHECK(ParseTuple, handle, &tuple, &parse);
-	link->conf.ConfigBase = parse.config.base;
-	link->conf.Present = parse.config.rmask[0];
-
-
-	/* Configure card */
-	link->state |= DEV_CONFIG;
-
-     	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
-        CS_CHECK(GetFirstTuple, handle, &tuple);
-
-    	while (1) {
-		cistpl_cftable_entry_t dflt = { 0 };
-		cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
-		CFG_CHECK(GetTupleData, handle, &tuple);
-		CFG_CHECK(ParseTuple, handle, &tuple, &parse);
-
-		if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
-		if (cfg->index == 0) goto next_entry;
-		link->conf.ConfigIndex = cfg->index;
-
-		/* Use power settings for Vcc and Vpp if present */
-		/*  Note that the CIS values need to be rescaled */
-		if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM))
-		    link->conf.Vcc = cfg->vcc.param[CISTPL_POWER_VNOM]/10000;
-		else if (dflt.vcc.present & (1<<CISTPL_POWER_VNOM))
-		    link->conf.Vcc = dflt.vcc.param[CISTPL_POWER_VNOM]/10000;
-	    
-		if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
-		    link->conf.Vpp1 = link->conf.Vpp2 =
-			cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
-		else if (dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
-		    link->conf.Vpp1 = link->conf.Vpp2 =
-			dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
-	
-		/* Do we need to allocate an interrupt? */
-		if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
-		    link->conf.Attributes |= CONF_ENABLE_IRQ;
-	
-		/* IO window settings */
-		link->io.NumPorts1 = link->io.NumPorts2 = 0;
-		if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
-	    		cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
-	    		link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
-	    		if (!(io->flags & CISTPL_IO_8BIT))
-				link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
-	    		if (!(io->flags & CISTPL_IO_16BIT)) {
-	    			
-				link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-				printk(KERN_CRIT "8-bit IO not supported on this aironet 4500 driver \n");
-	    		}
-	    		link->io.BasePort1 = io->win[0].base;
-	    		
-	    		link->io.NumPorts1 = io->win[0].len;
-	    		if (io->nwin > 1) {
-				link->io.Attributes2 = link->io.Attributes1;
-				link->io.BasePort2 = io->win[1].base;
-				link->io.NumPorts2 = io->win[1].len;
-	    		}
-		}
-		ii = 0;
-		last_fn = RequestIO;
-		while ((last_ret = CardServices(RequestIO, link->handle, &link->io)) ){
-		
-			if (ii > 4) 
-				goto cs_failed;
-			link->io.BasePort1 = awc_ports[ii];
-			ii++;
-		};
-
-
-		break;
-	
-    	next_entry:
-		if (CardServices(GetNextTuple, handle, &tuple))
-			break;
-    	}
-    
-    	if (link->conf.Attributes & CONF_ENABLE_IRQ){
-	
-		ii = 0;  last_fn = RequestIRQ; 
-		while ((last_ret  = CardServices(RequestIRQ, link->handle, &link->irq)) ){
-		
-			ii++;	
-			while (!(irq_mask & (1 << ii) ) && ii < 15)
-			 	ii++;
-			link->irq.IRQInfo2 = 1 << ii;
-
-			if(ii > 15)
-				goto cs_failed;
-			printk("trying irq %d , mask %x \n",ii, link->irq.IRQInfo2); 
-			 
-		};
-	}
-
-    	CS_CHECK(RequestConfiguration, link->handle, &link->conf);
-
-
-    	dev->irq = link->irq.AssignedIRQ;
-    	dev->base_addr = link->io.BasePort1;
-
-
-	awc_private_init( dev);
-
-
-	
-	retval = register_netdev(dev);
-	if (retval != 0) {
-		printk(KERN_NOTICE "awc_cs: register_netdev() failed for dev %x retval %x\n",(unsigned int)dev,retval);
-		goto failed;
-	}
-
-    	if(awc_pcmcia_init(dev)) goto failed;
-
-	i=0;
-	while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
-	if (!aironet4500_devices[i]){
-		aironet4500_devices[i]=dev;
-		if (awc_proc_set_fun)
-			awc_proc_set_fun(i);
-	}
-	
-
-	link->state &= ~DEV_CONFIG_PENDING;
-
-	lp = (struct awc_private *)dev->priv;
-
-	DEBUG(1,"pcmcia config complete on port %x \n",(unsigned int)dev->base_addr);
-
-	return;
-
-cs_failed:
-	cs_error(link->handle, last_fn, last_ret);
-	link->dev=NULL;
-failed:
-
-	awc_release((u_long)link);
-	return;
-
-} /* awc_pcmcia_config */
-
-/*
-	After a card is removed, awc_release() will unregister the net
-	device, and release the PCMCIA configuration.  If the device is
-	still open, this will be postponed until it is closed.
-
-*/
-
-static void awc_release(u_long arg)
-{
-	dev_link_t *link = (dev_link_t *)arg;
-	struct net_device *dev = link->priv;
-
-	DEBUG(0, "awc_release(0x%p)\n", link);
-
-	if (link->open) {
-		DEBUG(1, "awc_cs: release postponed, '%s' still open\n",
-			  link->dev->dev_name);
-		link->state |= DEV_STALE_CONFIG;
-		return;
-	}
-
-	CardServices(ReleaseConfiguration, link->handle);
-	CardServices(ReleaseIO, link->handle, &link->io);
-	CardServices(ReleaseIRQ, link->handle, &link->irq);
-
-	CardServices(ReleaseWindow, link->win);
-	if (link->dev)
-		unregister_netdev(dev);
-	// link->dev = NULL;
-
-	link->state &= ~DEV_CONFIG;
-	if (link->state & DEV_STALE_LINK)
-		awc_detach(link);
-
-} /* awc_release */
-
-/*
-
-	The card status event handler.  Mostly, this schedules other
-	stuff to run after an event is received.  A CARD_REMOVAL event
-	also sets some flags to discourage the net drivers from trying
-	to talk to the card any more.
-*/
-
-static int awc_event(event_t event, int priority,
-					   event_callback_args_t *args)
-{
-	dev_link_t *link = args->client_data;
-	struct net_device *dev = link->priv;
-
-	PC_DEBUG(1, "awc_event(0x%06x)\n", event);
-
-	switch (event) {
-	case CS_EVENT_CARD_REMOVAL:
-		link->state &= ~DEV_PRESENT;
-		if (link->state & DEV_CONFIG) {
-			netif_device_detach(dev);
-			link->release.expires = RUN_AT( HZ/20 );
-			add_timer(&link->release);
-		}
-		break;
-	case CS_EVENT_CARD_INSERTION:
-		link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-		awc_pcmcia_config(link);
-		break;
-	case CS_EVENT_PM_SUSPEND:
-		link->state |= DEV_SUSPEND;
-		/* Fall through... */
-	case CS_EVENT_RESET_PHYSICAL:
-		if (link->state & DEV_CONFIG) {
-			if (link->open)
-				netif_device_detach(dev);
-
-			CardServices(ReleaseConfiguration, link->handle);
-		}
-		break;
-	case CS_EVENT_PM_RESUME:
-		link->state &= ~DEV_SUSPEND;
-		/* Fall through... */
-	case CS_EVENT_CARD_RESET:
-		if (link->state & DEV_CONFIG) {
-			CardServices(RequestConfiguration, link->handle, &link->conf);
-			if (link->open) {
-				// awc_reset(dev);
-				netif_device_attach(dev);
-			}
-		}
-		break;
-	}
-	return 0;
-} /* awc_event */
-
-
-        
-static int __init aironet_cs_init(void)
-{
-	servinfo_t serv;
-
-	/* Always emit the version, before any failure. */
-	printk(KERN_INFO"%s", awc_version);
-	PC_DEBUG(0, "%s\n", version);
-	CardServices(GetCardServicesInfo, &serv);
-	if (serv.Revision != CS_RELEASE_CODE) {
-		printk(KERN_NOTICE "awc_cs: Card Services release "
-			   "does not match!\n");
-		return -1;
-	}
-	register_pcmcia_driver(&dev_info, &awc_attach, &awc_detach);
-	return 0;
-}
-
-static void __exit aironet_cs_exit(void)
-{
-	DEBUG(0, "awc_cs: unloading %c ",'\n');
-	unregister_pcmcia_driver(&dev_info);
-	
-	while (dev_list != NULL) {
-		if (dev_list->state & DEV_CONFIG)
-			awc_release((u_long)dev_list);
-		awc_detach(dev_list);
-	}
-	        
-//	while (dev_list != NULL)
-//		awc_detach(dev_list);
-}
-
-module_init(aironet_cs_init);
-module_exit(aironet_cs_exit);
-MODULE_LICENSE("GPL");
diff -urN linux-2.5.63-bk2/drivers/net/tg3.c linux-2.5.63-bk3/drivers/net/tg3.c
--- linux-2.5.63-bk2/drivers/net/tg3.c	Mon Mar 31 12:17:10 2003
+++ linux-2.5.63-bk3/drivers/net/tg3.c	Mon Mar 31 12:17:15 2003
@@ -25,6 +25,7 @@
 #include <linux/if_vlan.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
+#include <linux/workqueue.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -54,8 +55,8 @@
 
 #define DRV_MODULE_NAME		"tg3"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"1.4"
-#define DRV_MODULE_RELDATE	"Feb 1, 2003"
+#define DRV_MODULE_VERSION	"1.4c"
+#define DRV_MODULE_RELDATE	"Feb 18, 2003"
 
 #define TG3_DEF_MAC_MODE	0
 #define TG3_DEF_RX_MODE		0
@@ -216,6 +217,12 @@
 	tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
 }
 
+static inline void tg3_cond_int(struct tg3 *tp)
+{
+	if (tp->hw_status->status & SD_STATUS_UPDATED)
+		tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
+}
+
 static void tg3_enable_ints(struct tg3 *tp)
 {
 	tw32(TG3PCI_MISC_HOST_CTRL,
@@ -223,9 +230,55 @@
 	tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000000);
 	tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
 
-	if (tp->hw_status->status & SD_STATUS_UPDATED)
-		tw32(GRC_LOCAL_CTRL,
-		     tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
+	tg3_cond_int(tp);
+}
+
+/* these netif_xxx funcs should be moved into generic net layer */
+static void netif_poll_disable(struct net_device *dev)
+{
+	while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
+		current->state = TASK_INTERRUPTIBLE;
+		schedule_timeout(1);
+	}
+}
+
+static inline void netif_poll_enable(struct net_device *dev)
+{
+	clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
+}
+
+/* same as netif_rx_complete, except that local_irq_save(flags)
+ * has already been issued
+ */
+static inline void __netif_rx_complete(struct net_device *dev)
+{
+	if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
+	list_del(&dev->poll_list);
+	clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
+}
+
+static inline void netif_tx_disable(struct net_device *dev)
+{
+	spin_lock_bh(&dev->xmit_lock);
+	netif_stop_queue(dev);
+	spin_unlock_bh(&dev->xmit_lock);
+}
+
+static inline void tg3_netif_stop(struct tg3 *tp)
+{
+	netif_poll_disable(tp->dev);
+	netif_tx_disable(tp->dev);
+}
+
+static inline void tg3_netif_start(struct tg3 *tp)
+{
+	netif_wake_queue(tp->dev);
+	/* NOTE: unconditional netif_wake_queue is only appropriate
+	 * so long as all callers are assured to have free tx slots
+	 * (such as after tg3_init_hw)
+	 */
+	netif_poll_enable(tp->dev);
+	tg3_cond_int(tp);
 }
 
 static void tg3_switch_clocks(struct tg3 *tp)
@@ -387,7 +440,6 @@
 }
 
 static int tg3_setup_phy(struct tg3 *);
-static int tg3_halt(struct tg3 *);
 
 static int tg3_set_power_state(struct tg3 *tp, int state)
 {
@@ -458,8 +510,6 @@
 		tg3_setup_phy(tp);
 	}
 
-	tg3_halt(tp);
-
 	pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps);
 
 	if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) {
@@ -2044,7 +2094,12 @@
 		spin_unlock(&tp->tx_lock);
 	}
 
-	/* run RX thread, within the bounds set by NAPI */
+	spin_unlock_irqrestore(&tp->lock, flags);
+
+	/* run RX thread, within the bounds set by NAPI.
+	 * All RX "locking" is done by ensuring outside
+	 * code synchronizes with dev->poll()
+	 */
 	done = 1;
 	if (sblk->idx[0].rx_producer != tp->rx_rcb_ptr) {
 		int orig_budget = *budget;
@@ -2064,12 +2119,12 @@
 
 	/* if no more work, tell net stack and NIC we're done */
 	if (done) {
-		netif_rx_complete(netdev);
+		spin_lock_irqsave(&tp->lock, flags);
+		__netif_rx_complete(netdev);
 		tg3_enable_ints(tp);
+		spin_unlock_irqrestore(&tp->lock, flags);
 	}
 
-	spin_unlock_irqrestore(&tp->lock, flags);
-
 	return (done ? 0 : 1);
 }
 
@@ -2136,17 +2191,21 @@
 
 static void tg3_init_rings(struct tg3 *);
 static int tg3_init_hw(struct tg3 *);
+static int tg3_halt(struct tg3 *);
 
-static void tg3_tx_timeout(struct net_device *dev)
+static void tg3_reset_task(void *_data)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = _data;
+	unsigned int restart_timer;
 
-	printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
-	       dev->name);
+	tg3_netif_stop(tp);
 
 	spin_lock_irq(&tp->lock);
 	spin_lock(&tp->tx_lock);
 
+	restart_timer = tp->tg3_flags2 & TG3_FLG2_RESTART_TIMER;
+	tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER;
+
 	tg3_halt(tp);
 	tg3_init_rings(tp);
 	tg3_init_hw(tp);
@@ -2154,7 +2213,20 @@
 	spin_unlock(&tp->tx_lock);
 	spin_unlock_irq(&tp->lock);
 
-	netif_wake_queue(dev);
+	tg3_netif_start(tp);
+
+	if (restart_timer)
+		mod_timer(&tp->timer, jiffies + 1);
+}
+
+static void tg3_tx_timeout(struct net_device *dev)
+{
+	struct tg3 *tp = dev->priv;
+
+	printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
+	       dev->name);
+
+	schedule_work(&tp->reset_task);
 }
 
 #if !PCI_DMA_BUS_IS_PHYS
@@ -2686,6 +2758,7 @@
 		return 0;
 	}
 
+	tg3_netif_stop(tp);
 	spin_lock_irq(&tp->lock);
 	spin_lock(&tp->tx_lock);
 
@@ -2698,6 +2771,7 @@
 
 	spin_unlock(&tp->tx_lock);
 	spin_unlock_irq(&tp->lock);
+	tg3_netif_start(tp);
 
 	return 0;
 }
@@ -3073,6 +3147,7 @@
 static void tg3_chip_reset(struct tg3 *tp)
 {
 	u32 val;
+	u32 flags_save;
 
 	/* Force NVRAM to settle.
 	 * This deals with a chip bug which can result in EEPROM
@@ -3089,8 +3164,21 @@
 		}
 	}
 
+	/*
+	 * We must avoid the readl() that normally takes place.
+	 * It locks machines, causes machine checks, and other
+	 * fun things.  So, temporarily disable the 5701
+	 * hardware workaround, while we do the reset.
+	 */
+	flags_save = tp->tg3_flags;
+	tp->tg3_flags &= ~TG3_FLAG_5701_REG_WRITE_BUG;
+
+	/* do the reset */
 	tw32(GRC_MISC_CFG, GRC_MISC_CFG_CORECLK_RESET);
 
+	/* restore 5701 hardware bug workaround flag */
+	tp->tg3_flags = flags_save;
+
 	/* Flush PCI posted writes.  The normal MMIO registers
 	 * are inaccessible at this time so this is the only
 	 * way to make this reliably.  I tried to use indirect
@@ -4394,9 +4482,11 @@
 	}
 
 	if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
-		tg3_halt(tp);
-		tg3_init_rings(tp);
-		tg3_init_hw(tp);
+		tp->tg3_flags2 |= TG3_FLG2_RESTART_TIMER;
+		spin_unlock(&tp->tx_lock);
+		spin_unlock_irqrestore(&tp->lock, flags);
+		schedule_work(&tp->reset_task);
+		return;
 	}
 
 	/* This part only runs once per second. */
@@ -4527,8 +4617,6 @@
 		return err;
 	}
 
-	netif_start_queue(dev);
-
 	spin_lock_irq(&tp->lock);
 	spin_lock(&tp->tx_lock);
 
@@ -4537,6 +4625,8 @@
 	spin_unlock(&tp->tx_lock);
 	spin_unlock_irq(&tp->lock);
 
+	netif_start_queue(dev);
+
 	return 0;
 }
 
@@ -5302,6 +5392,7 @@
 		    (ering.tx_pending > TG3_TX_RING_SIZE - 1))
 			return -EINVAL;
 
+		tg3_netif_stop(tp);
 		spin_lock_irq(&tp->lock);
 		spin_lock(&tp->tx_lock);
 
@@ -5315,6 +5406,7 @@
 		netif_wake_queue(tp->dev);
 		spin_unlock(&tp->tx_lock);
 		spin_unlock_irq(&tp->lock);
+		tg3_netif_start(tp);
 
 		return 0;
 	}
@@ -5337,6 +5429,7 @@
 		if (copy_from_user(&epause, useraddr, sizeof(epause)))
 			return -EFAULT;
 
+		tg3_netif_stop(tp);
 		spin_lock_irq(&tp->lock);
 		spin_lock(&tp->tx_lock);
 		if (epause.autoneg)
@@ -5356,6 +5449,7 @@
 		tg3_init_hw(tp);
 		spin_unlock(&tp->tx_lock);
 		spin_unlock_irq(&tp->lock);
+		tg3_netif_start(tp);
 
 		return 0;
 	}
@@ -6710,6 +6804,7 @@
 	spin_lock_init(&tp->lock);
 	spin_lock_init(&tp->tx_lock);
 	spin_lock_init(&tp->indirect_lock);
+	PREPARE_WORK(&tp->reset_task, tg3_reset_task, tp);
 
 	tp->regs = (unsigned long) ioremap(tg3reg_base, tg3reg_len);
 	if (tp->regs == 0UL) {
@@ -6851,6 +6946,8 @@
 	if (!netif_running(dev))
 		return 0;
 
+	tg3_netif_stop(tp);
+
 	spin_lock_irq(&tp->lock);
 	spin_lock(&tp->tx_lock);
 	tg3_disable_ints(tp);
@@ -6877,6 +6974,7 @@
 		spin_unlock_irq(&tp->lock);
 
 		netif_device_attach(dev);
+		tg3_netif_start(tp);
 	}
 
 	return err;
@@ -6907,6 +7005,8 @@
 	spin_unlock(&tp->tx_lock);
 	spin_unlock_irq(&tp->lock);
 
+	tg3_netif_start(tp);
+
 	return 0;
 }
 
diff -urN linux-2.5.63-bk2/drivers/net/tg3.h linux-2.5.63-bk3/drivers/net/tg3.h
--- linux-2.5.63-bk2/drivers/net/tg3.h	Mon Feb 24 11:05:11 2003
+++ linux-2.5.63-bk3/drivers/net/tg3.h	Mon Mar 31 12:17:15 2003
@@ -1821,6 +1821,8 @@
 #define TG3_FLAG_GOT_SERDES_FLOWCTL	0x20000000
 #define TG3_FLAG_SPLIT_MODE		0x40000000
 #define TG3_FLAG_INIT_COMPLETE		0x80000000
+	u32				tg3_flags2;
+#define TG3_FLG2_RESTART_TIMER		0x00000001
 
 	u32				split_mode_max_reqs;
 #define SPLIT_MODE_5704_MAX_REQ		3
@@ -1889,6 +1891,7 @@
 
 	struct tg3_hw_stats		*hw_stats;
 	dma_addr_t			stats_mapping;
+	struct work_struct		reset_task;
 };
 
 #endif /* !(_T3_H) */
diff -urN linux-2.5.63-bk2/drivers/net/wireless/Kconfig linux-2.5.63-bk3/drivers/net/wireless/Kconfig
--- linux-2.5.63-bk2/drivers/net/wireless/Kconfig	Mon Feb 24 11:05:12 2003
+++ linux-2.5.63-bk3/drivers/net/wireless/Kconfig	Mon Mar 31 12:17:15 2003
@@ -6,13 +6,13 @@
 	depends on NETDEVICES
 
 config NET_RADIO
-	bool "Wireless LAN (non-hamradio)"
+	bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions"
 	---help---
 	  Support for wireless LANs and everything having to do with radio,
 	  but not with amateur radio or FM broadcasting.
 
 	  Saying Y here also enables the Wireless Extensions (creates
-	  /proc/net/wireless and enables ifconfig access). The Wireless
+	  /proc/net/wireless and enables iwconfig access). The Wireless
 	  Extension is a generic API allowing a driver to expose to the user
 	  space configuration and statistics specific to common Wireless LANs.
 	  The beauty of it is that a single set of tool can support all the
@@ -28,6 +28,11 @@
 	  special kernel support are available from
 	  <ftp://shadow.cabi.net/pub/Linux/>.
 
+# Note : the cards are obsolete (can't buy them anymore), but the drivers
+# are not, as people are still using them...
+comment "Obsolete Wireless cards support (pre-802.11)"
+	depends on NET_RADIO && (INET || ISA || PCMCIA)
+
 config STRIP
 	tristate "STRIP (Metricom starmode radio IP)"
 	depends on NET_RADIO && INET
@@ -68,10 +73,6 @@
 	  On some computers the card ends up in non-valid state after some
 	  time. Use a ping-reset script to clear it.
 
-comment "Wireless ISA/PCI cards support"
-	depends on NET_RADIO && (ISA || PCI || ALL_PPC || PCMCIA)
-
-# Good old obsolete Wavelan.
 config WAVELAN
 	tristate "AT&T/Lucent old WaveLAN & DEC RoamAbout DS ISA support"
 	depends on NET_RADIO && ISA
@@ -102,7 +103,54 @@
 	  module, say M here and read <file:Documentation/modules.txt> as well
 	  as <file:Documentation/networking/net-modules.txt>.
 
-# 802.11b cards
+config PCMCIA_WAVELAN
+	tristate "AT&T/Lucent old WaveLAN Pcmcia wireless support"
+	depends on NET_RADIO && PCMCIA
+	help
+	  Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA
+	  (PC-card) wireless Ethernet networking card to your computer.  This
+	  driver is for the non-IEEE-802.11 Wavelan cards.
+
+	  This driver is also available as a module ( = code which can be
+	  inserted in and removed from the running kernel whenever you want).
+	  The module will be called wavelan_cs.  If you want to compile it
+	  as a module, say M here and read <file:Documentation/modules.txt>.
+	  If unsure, say N.
+
+config PCMCIA_NETWAVE
+	tristate "Xircom Netwave AirSurfer Pcmcia wireless support"
+	depends on NET_RADIO && PCMCIA
+	help
+	  Say Y here if you intend to attach this type of PCMCIA (PC-card)
+	  wireless Ethernet networking card to your computer.
+
+	  This driver is also available as a module ( = code which can be
+	  inserted in and removed from the running kernel whenever you want).
+	  The module will be called netwave_cs.  If you want to compile it
+	  as a module, say M here and read <file:Documentation/modules.txt>.
+	  If unsure, say N.
+
+comment "Wireless 802.11 Frequency Hopping cards support"
+	depends on NET_RADIO && PCMCIA
+
+config PCMCIA_RAYCS
+	tristate "Aviator/Raytheon 2.4MHz wireless support"
+	depends on NET_RADIO && PCMCIA
+	---help---
+	  Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
+	  (PC-card) wireless Ethernet networking card to your computer.
+	  Please read the file <file:Documentation/networking/ray_cs.txt> for
+	  details.
+
+	  This driver is also available as a module ( = code which can be
+	  inserted in and removed from the running kernel whenever you want).
+	  The module will be called ray_cs.  If you want to compile it as a
+	  module, say M here and read <file:Documentation/modules.txt>.  If
+	  unsure, say N.
+
+comment "Wireless 802.11b ISA/PCI cards support"
+	depends on NET_RADIO && (ISA || PCI || ALL_PPC || PCMCIA)
+
 config AIRO
 	tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
 	depends on NET_RADIO && (ISA || PCI)
@@ -175,41 +223,12 @@
 	  this variety.
 
 # If Pcmcia is compiled in, offer Pcmcia cards...
-comment "Wireless Pcmcia/Cardbus cards support"
-	depends on NET_RADIO && PCMCIA
-
-# Obsolete cards
-config PCMCIA_NETWAVE
-	tristate "Xircom Netwave AirSurfer Pcmcia wireless support"
-	depends on NET_RADIO && PCMCIA
-	help
-	  Say Y here if you intend to attach this type of PCMCIA (PC-card)
-	  wireless Ethernet networking card to your computer.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called netwave_cs.  If you want to compile it
-	  as a module, say M here and read <file:Documentation/modules.txt>.
-	  If unsure, say N.
-
-config PCMCIA_WAVELAN
-	tristate "AT&T/Lucent old Wavelan Pcmcia wireless support"
+comment "Wireless 802.11b Pcmcia/Cardbus cards support"
 	depends on NET_RADIO && PCMCIA
-	help
-	  Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA
-	  (PC-card) wireless Ethernet networking card to your computer.  This
-	  driver is for the non-IEEE-802.11 Wavelan cards.
 
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called wavelan_cs.  If you want to compile it
-	  as a module, say M here and read <file:Documentation/modules.txt>.
-	  If unsure, say N.
-
-# 802.11b cards
 config PCMCIA_HERMES
 	tristate "Hermes PCMCIA card support"
-	depends on PCMCIA!=n && HERMES
+	depends on NET_RADIO && PCMCIA && HERMES
 	---help---
 	  A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
 	  as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
@@ -249,34 +268,6 @@
 	  for location).  You also want to check out the PCMCIA-HOWTO,
 	  available from <http://www.linuxdoc.org/docs.html#howto>.
 
-config NET_PCMCIA_RADIO
-	bool "PCMCIA Wireless LAN"
-	depends on NET_PCMCIA
-	help
-	  Say Y here if you would like to use a PCMCIA (PC-card) device to
-	  connect to a wireless local area network. Then say Y to the driver
-	  for your particular card below.
-
-	  To use your PC-cards, you will need supporting software from David
-	  Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
-	  for location). You also want to check out the PCMCIA-HOWTO,
-	  available from <http://www.linuxdoc.org/docs.html#howto>.
-
-config PCMCIA_RAYCS
-	tristate "Aviator/Raytheon 2.4MHz wireless support"
-	depends on NET_PCMCIA_RADIO && PCMCIA
-	---help---
-	  Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
-	  (PC-card) wireless Ethernet networking card to your computer.
-	  Please read the file <file:Documentation/networking/ray_cs.txt> for
-	  details.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called ray_cs.  If you want to compile it as a
-	  module, say M here and read <file:Documentation/modules.txt>.  If
-	  unsure, say N.
-
 # yes, this works even when no drivers are selected
 config NET_WIRELESS
 	bool
diff -urN linux-2.5.63-bk2/drivers/net/wireless/todo.txt linux-2.5.63-bk3/drivers/net/wireless/todo.txt
--- linux-2.5.63-bk2/drivers/net/wireless/todo.txt	Mon Feb 24 11:05:38 2003
+++ linux-2.5.63-bk3/drivers/net/wireless/todo.txt	Mon Mar 31 12:17:15 2003
@@ -2,28 +2,14 @@
 	-------------
 
 1) Bring other kernel Wireless LAN drivers here
-	Already done :
-	 o hermes.c/orinoco.c	-> Wavelan IEEE driver + Airport driver
-	 o airo.c/airo_cs.c	-> Ben's Aironet driver
-	 o wavelan.c		-> old Wavelan ISA driver
-	 o wavelan_cs.c		-> old Wavelan Pcmcia driver
-	 o netwave_cs.c		-> Netwave Pcmcia driver
-	Drivers likely to go :
-	 o ray_cs.c		-> Raytheon/Aviator driver (maintainer MIA)
-	Drivers I have absolutely no control over :
-	 o arlan.c		-> old Aironet Arlan 655 (need to ask Elmer)
-	 o aironet4500_xxx.c	-> Elmer's Aironet driver (need to ask Elmer)
-	 o strip.c		-> Metricom's stuff. Not a wlan. Hum...
-
-	ETA : Kernel 2.5.X
+	Completed
 
 2) Bring new Wireless LAN driver not yet in the kernel there
 	See my web page for details
+	In particular : HostAP
 
 3) Misc
 	o Mark wavelan, wavelan_cs, netwave_cs drivers as obsolete
 	o Maybe arlan.c, ray_cs.c and strip.c also deserve to be obsolete
-	o Use new Probe/module stuff in wavelan.c
-	o New Wireless Extension API (pending)
 
 	Jean II
diff -urN linux-2.5.63-bk2/drivers/scsi/AM53C974.c linux-2.5.63-bk3/drivers/scsi/AM53C974.c
--- linux-2.5.63-bk2/drivers/scsi/AM53C974.c	Mon Feb 24 11:05:32 2003
+++ linux-2.5.63-bk3/drivers/scsi/AM53C974.c	Mon Mar 31 12:17:15 2003
@@ -2091,7 +2091,7 @@
 		goto EXIT_ABORT;
 	}
 	msg[0] = AM53C974_read_8(FFREG);
-	if (!msg[0] & 0x80) {
+	if (!(msg[0] & 0x80)) {
 		printk("scsi%d: error: expecting IDENTIFY message, got ", instance->host_no);
 		print_msg(msg);
 		hostdata->aborted = 1;
diff -urN linux-2.5.63-bk2/drivers/scsi/FlashPoint.c linux-2.5.63-bk3/drivers/scsi/FlashPoint.c
--- linux-2.5.63-bk2/drivers/scsi/FlashPoint.c	Mon Mar 31 12:17:10 2003
+++ linux-2.5.63-bk3/drivers/scsi/FlashPoint.c	Mon Mar 31 12:17:15 2003
@@ -3846,7 +3846,7 @@
 	}
 	else
 	{
-		if(!currTar_Info->TarEEValue & EE_WIDE_SCSI)
+		if(!(currTar_Info->TarEEValue & EE_WIDE_SCSI))
 		{
 			return(0);
 		}
diff -urN linux-2.5.63-bk2/drivers/scsi/Kconfig linux-2.5.63-bk3/drivers/scsi/Kconfig
--- linux-2.5.63-bk2/drivers/scsi/Kconfig	Mon Feb 24 11:05:43 2003
+++ linux-2.5.63-bk3/drivers/scsi/Kconfig	Mon Mar 31 12:17:15 2003
@@ -1325,9 +1325,9 @@
 	bool "Include loadable firmware in driver"
 	depends on SCSI_QLOGIC_FC
   	help
-	  Say Y to include ISP2100 Fabric Initiator/Target Firmware, with
+	  Say Y to include ISP2X00 Fabric Initiator/Target Firmware, with
 	  expanded LUN addressing and FcTape (FCP-2) support, in the
-	  Qlogic QLA 1280 driver. This is required on some platforms.
+	  qlogicfc driver. This is required on some platforms.
 
 config SCSI_QLOGIC_1280
 	tristate "Qlogic QLA 1280 SCSI support"
diff -urN linux-2.5.63-bk2/drivers/scsi/Makefile linux-2.5.63-bk3/drivers/scsi/Makefile
--- linux-2.5.63-bk2/drivers/scsi/Makefile	Mon Feb 24 11:05:40 2003
+++ linux-2.5.63-bk3/drivers/scsi/Makefile	Mon Mar 31 12:17:15 2003
@@ -120,13 +120,11 @@
 obj-$(CONFIG_BLK_DEV_SR)	+= sr_mod.o
 obj-$(CONFIG_CHR_DEV_SG)	+= sg.o
 
-scsi_mod-objs	:= scsi.o hosts.o scsi_ioctl.o constants.o scsicam.o \
-		   scsi_error.o scsi_lib.o scsi_scan.o scsi_syms.o \
-		   scsi_sysfs.o
-
-ifdef CONFIG_PROC_FS
-scsi_mod-objs	+= scsi_proc.o
-endif
+scsi_mod-y			+= scsi.o hosts.o scsi_ioctl.o constants.o \
+				   scsicam.o scsi_error.o scsi_lib.o \
+				   scsi_scan.o scsi_syms.o scsi_sysfs.o
+scsi_mod-$(CONFIG_PROC_FS)	+= scsi_proc.o
+scsi_mod-$(CONFIG_X86_PC9800)	+= scsi_pc98.o
 			
 sd_mod-objs	:= sd.o
 sr_mod-objs	:= sr.o sr_ioctl.o sr_vendor.o
diff -urN linux-2.5.63-bk2/drivers/scsi/NCR5380.c linux-2.5.63-bk3/drivers/scsi/NCR5380.c
--- linux-2.5.63-bk2/drivers/scsi/NCR5380.c	Mon Feb 24 11:05:12 2003
+++ linux-2.5.63-bk3/drivers/scsi/NCR5380.c	Mon Mar 31 12:17:15 2003
@@ -2750,7 +2750,7 @@
 	phase = PHASE_MSGIN;
 	NCR5380_transfer_pio(instance, &phase, &len, &data);
 
-	if (!msg[0] & 0x80) {
+	if (!(msg[0] & 0x80)) {
 		printk(KERN_ERR "scsi%d : expecting IDENTIFY message, got ", instance->host_no);
 		print_msg(msg);
 		abort = 1;
diff -urN linux-2.5.63-bk2/drivers/scsi/NCR53c406a.c linux-2.5.63-bk3/drivers/scsi/NCR53c406a.c
--- linux-2.5.63-bk2/drivers/scsi/NCR53c406a.c	Mon Feb 24 11:05:32 2003
+++ linux-2.5.63-bk3/drivers/scsi/NCR53c406a.c	Mon Mar 31 12:17:15 2003
@@ -472,7 +472,7 @@
 		return 0;
 	}
 
-	DEB(printk("NCR53c406a BIOS found at %X\n", (unsigned int) bios_base);
+	DEB(printk("NCR53c406a BIOS found at 0x%x\n", (unsigned int) bios_base);
 	    );
 #endif				/* USE_BIOS */
 
@@ -487,14 +487,14 @@
 	} else {
 		for (i = 0; i < PORT_COUNT && !port_base; i++) {
 			if (!request_region(ports[i], 0x10, "NCR53c406a")) {
-				DEB(printk("NCR53c406a: port %x in use\n", ports[i]));
+				DEB(printk("NCR53c406a: port 0x%x in use\n", ports[i]));
 			} else {
-				VDEB(printk("NCR53c406a: port %x available\n", ports[i]));
+				VDEB(printk("NCR53c406a: port 0x%x available\n", ports[i]));
 				outb(C5_IMG, ports[i] + 0x0d);	/* reg set 1 */
 				if ((inb(ports[i] + 0x0e) ^ inb(ports[i] + 0x0e)) == 7 && (inb(ports[i] + 0x0e) ^ inb(ports[i] + 0x0e)) == 7 && (inb(ports[i] + 0x0e) & 0xf8) == 0x58) {
 					port_base = ports[i];
 					VDEB(printk("NCR53c406a: Sig register valid\n"));
-					VDEB(printk("port_base=%x\n", port_base));
+					VDEB(printk("port_base=0x%x\n", port_base));
 					break;
 				}
 				release_region(ports[i], 0x10);
@@ -523,7 +523,7 @@
 	}
 #endif
 
-	DEB(printk("NCR53c406a: using port_base %x\n", port_base));
+	DEB(printk("NCR53c406a: using port_base 0x%x\n", port_base));
 
 	tpnt->present = 1;
 	tpnt->proc_name = "NCR53c406a";
@@ -611,11 +611,11 @@
 	for (i = 0; i < PORT_COUNT && !port_base; i++)
 		if (ports[i] == ints[1]) {
 			port_base = ints[1];
-			DEB(printk("NCR53c406a: Specified port_base 0x%X\n", port_base);
+			DEB(printk("NCR53c406a: Specified port_base 0x%x\n", port_base);
 			    )
 		}
 	if (!port_base) {
-		printk("NCR53c406a: Invalid PORTBASE 0x%X specified\n", ints[1]);
+		printk("NCR53c406a: Invalid PORTBASE 0x%x specified\n", ints[1]);
 		return;
 	}
 
@@ -638,7 +638,7 @@
 	if (ints[0] > 2)
 		fast_pio = ints[3];
 
-	DEB(printk("NCR53c406a: port_base=0x%X, irq=%d, fast_pio=%d\n", port_base, irq_level, fast_pio);)
+	DEB(printk("NCR53c406a: port_base=0x%x, irq=%d, fast_pio=%d\n", port_base, irq_level, fast_pio);)
 }
 
 __setup("ncr53c406a=", NCR53c406a_setup);
diff -urN linux-2.5.63-bk2/drivers/scsi/aacraid/linit.c linux-2.5.63-bk3/drivers/scsi/aacraid/linit.c
--- linux-2.5.63-bk2/drivers/scsi/aacraid/linit.c	Mon Feb 24 11:05:16 2003
+++ linux-2.5.63-bk3/drivers/scsi/aacraid/linit.c	Mon Mar 31 12:17:15 2003
@@ -60,7 +60,7 @@
 #define AAC_DRIVERNAME	"aacraid"
 
 MODULE_AUTHOR("Red Hat Inc and Adaptec");
-MODULE_DESCRIPTION("Supports Dell PERC2, 2/Si, 3/Si, 3/Di, Adaptec 2120S, 2200S, 5400S, and HP NetRAID-4M devices. http://domsch.com/linux/ or http://linux.adaptec.com");
+MODULE_DESCRIPTION("Supports Dell PERC2, 2/Si, 3/Si, 3/Di, PERC 320/DC, Adaptec 2120S, 2200S, 5400S, and HP NetRAID-4M devices. http://domsch.com/linux/ or http://linux.adaptec.com");
 MODULE_LICENSE("GPL");
 MODULE_PARM(nondasd, "i");
 MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
@@ -96,6 +96,7 @@
 	{ 0x9005, 0x0285, 0x9005, 0x0286, aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2120S   ", 1 }, /* Adaptec 2120S (Crusader)*/
 	{ 0x9005, 0x0285, 0x9005, 0x0285, aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2200S   ", 2 }, /* Adaptec 2200S (Vulcan)*/
 	{ 0x9005, 0x0285, 0x9005, 0x0287, aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2200S   ", 2 }, /* Adaptec 2200S (Vulcan-2m)*/
+	{ 0x9005, 0x0285, 0x1028, 0x0287, aac_rx_init, "percraid", "DELL    ", "PERCRAID        ", 2 }, /* Dell PERC 320/DC */
 	{ 0x1011, 0x0046, 0x9005, 0x0365, aac_sa_init, "aacraid",  "ADAPTEC ", "Adaptec 5400S   ", 4 }, /* Adaptec 5400S (Mustang)*/
 	{ 0x1011, 0x0046, 0x9005, 0x0364, aac_sa_init, "aacraid",  "ADAPTEC ", "AAC-364         ", 4 }, /* Adaptec 5400S (Mustang)*/
 	{ 0x1011, 0x0046, 0x9005, 0x1364, aac_sa_init, "percraid", "DELL    ", "PERCRAID        ", 4 }, /* Dell PERC2 "Quad Channel" */
@@ -110,10 +111,10 @@
 static int aac_cfg_release(struct inode * inode,struct file * file);
 
 static struct file_operations aac_cfg_fops = {
-	owner: THIS_MODULE,
-	ioctl: aac_cfg_ioctl,
-	open: aac_cfg_open,
-	release: aac_cfg_release
+	.owner		= THIS_MODULE,
+	.ioctl		= aac_cfg_ioctl,
+	.open		= aac_cfg_open,
+	.release	= aac_cfg_release
 };
 
 static int aac_detect(Scsi_Host_Template *);
diff -urN linux-2.5.63-bk2/drivers/scsi/aha152x.c linux-2.5.63-bk3/drivers/scsi/aha152x.c
--- linux-2.5.63-bk2/drivers/scsi/aha152x.c	Mon Mar 31 12:17:10 2003
+++ linux-2.5.63-bk3/drivers/scsi/aha152x.c	Mon Mar 31 12:17:15 2003
@@ -2663,7 +2663,7 @@
 		 * STCNT to trigger ENSWRAP interrupt, instead of
 		 * polling for DFIFOFULL
 		 */
-		the_time=jiffies + 10*HZ;
+		the_time=jiffies + 100*HZ;
 		while(TESTLO(DMASTAT, DFIFOFULL|INTSTAT) && time_before(jiffies,the_time))
 			barrier();
 
@@ -2676,7 +2676,7 @@
 		if(TESTHI(DMASTAT, DFIFOFULL)) {
 			fifodata = 128;
 		} else {
-			the_time=jiffies + 10*HZ;
+			the_time=jiffies + 100*HZ;
 			while(TESTLO(SSTAT2, SEMPTY) && time_before(jiffies,the_time))
 				barrier();
 
@@ -2832,7 +2832,7 @@
 			CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
 		}
 
-		the_time=jiffies + 10*HZ;
+		the_time=jiffies + 100*HZ;
 		while(TESTLO(DMASTAT, DFIFOEMP|INTSTAT) && time_before(jiffies,the_time))
 			barrier();
 
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic79xx_osm.c linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic79xx_osm.c
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic79xx_osm.c	Mon Feb 24 11:05:33 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic79xx_osm.c	Mon Mar 31 12:17:15 2003
@@ -801,7 +801,6 @@
 
 /************************  Host template entry points *************************/
 static int	   ahd_linux_detect(Scsi_Host_Template *);
-static int	   ahd_linux_release(struct Scsi_Host *);
 static const char *ahd_linux_info(struct Scsi_Host *);
 static int	   ahd_linux_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
@@ -811,6 +810,7 @@
 static int	   ahd_linux_biosparam(struct scsi_device*,
 				       struct block_device*, sector_t, int[]);
 #else
+static int	   ahd_linux_release(struct Scsi_Host *);
 static void	   ahd_linux_select_queue_depth(struct Scsi_Host *host,
 						Scsi_Device *scsi_devs);
 static int	   ahd_linux_biosparam(Disk *, kdev_t, int[]);
@@ -874,7 +874,7 @@
 	ahd_list_lockinit();
 
 #ifdef CONFIG_PCI
-	ahd_linux_pci_probe(template);
+	ahd_linux_pci_init();
 #endif
 
 	/*
@@ -894,6 +894,7 @@
 	return (found);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 /*
  * Free the passed in Scsi_Host memory structures prior to unloading the
  * module.
@@ -925,6 +926,7 @@
 	ahd_list_unlock(&l);
 	return (0);
 }
+#endif
 
 /*
  * Return a string describing the driver.
@@ -1664,9 +1666,9 @@
 }
 
 Scsi_Host_Template aic79xx_driver_template = {
+	.module			= THIS_MODULE,
+	.name			= "aic79xx",
 	.proc_info		= ahd_linux_proc_info,
-	.detect			= ahd_linux_detect,
-	.release		= ahd_linux_release,
 	.info			= ahd_linux_info,
 	.queuecommand		= ahd_linux_queue,
 	.eh_abort_handler	= ahd_linux_abort,
@@ -1698,18 +1700,17 @@
 #endif
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	.name			= "aic79xx",
 	.slave_alloc		= ahd_linux_slave_alloc,
 	.slave_configure	= ahd_linux_slave_configure,
 	.slave_destroy		= ahd_linux_slave_destroy,
 #else
+	.detect			= ahd_linux_detect,
+	.release		= ahd_linux_release,
 	.select_queue_depths	= ahd_linux_select_queue_depth,
 	.use_new_eh_code	= 1,
 #endif
 };
 
-#define driver_template aic79xx_driver_template
-#include "scsi_module.c"
 /**************************** Tasklet Handler *********************************/
 
 static void
@@ -2381,9 +2382,8 @@
 		ahd_set_name(ahd, new_name);
 	}
 	host->unique_id = ahd->unit;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	scsi_set_device(host, &ahd->dev_softc->dev);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) && \
+    LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
 	scsi_set_pci_device(host, ahd->dev_softc);
 #endif
 	ahd_linux_initialize_scsi_bus(ahd);
@@ -2410,6 +2410,10 @@
 	ahd_intr_enable(ahd, TRUE);
 	ahd_linux_start_dv(ahd);
 	ahd_unlock(ahd, &s);
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	scsi_add_host(host, &ahd->dev_softc->dev);
+#endif
 	return (0);
 }
 
@@ -2556,8 +2560,12 @@
 					 __WCLONE) == -ERESTARTSYS);
 		}
 		ahd_teardown_runq_tasklet(ahd);
-		if (ahd->platform_data->host != NULL)
+		if (ahd->platform_data->host != NULL) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+			scsi_remove_host(ahd->platform_data->host);
+#endif
 			scsi_unregister(ahd->platform_data->host);
+		}
 
 		/* destroy all of the device and target objects */
 		for (i = 0; i < AHD_NUM_TARGETS; i++) {
@@ -2595,21 +2603,17 @@
 					   0x1000);
 #endif
 		}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-		/* XXX Need an instance detach in the PCI code */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) && \
+    LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+    		/*
+		 * In 2.4 we detach from the scsi midlayer before the PCI
+		 * layer invokes our remove callback.
+		 */
 		if (ahd->dev_softc != NULL)
 			ahd->dev_softc->driver = NULL;
 #endif
 		free(ahd->platform_data, M_DEVBUF);
 	}
-	if (TAILQ_EMPTY(&ahd_tailq)) {
-		unregister_reboot_notifier(&ahd_linux_notifier);
-#ifdef CONFIG_PCI
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-		pci_unregister_driver(&aic79xx_pci_driver);
-#endif
-#endif
-	}
 }
 
 void
@@ -5315,3 +5319,30 @@
 		}
 	}
 }
+
+static int __init ahd_linux_init(void)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+       return (ahd_linux_detect(&aic79xx_driver_template) ? 0 : -ENODEV);
+#else
+	scsi_register_module(MODULE_SCSI_HA, &aic79xx_driver_template);
+	if (!driver_template.present) {
+		scsi_unregister_module(MODULE_SCSI_HA,
+				       &aic79xx_driver_template);
+		return (-ENODEV);
+	}
+
+	return (0);
+#endif
+}
+
+static void __exit ahd_linux_exit(void)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+	scsi_unregister_module(MODULE_SCSI_HA, &aic79xx_driver_template);
+#endif
+	ahd_linux_pci_exit();
+}
+
+module_init(ahd_linux_init);
+module_exit(ahd_linux_exit);
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic79xx_osm.h linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic79xx_osm.h
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic79xx_osm.h	Mon Feb 24 11:05:34 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic79xx_osm.h	Mon Mar 31 12:17:15 2003
@@ -952,7 +952,8 @@
 #include <linux/bios32.h>
 #endif
 
-int			 ahd_linux_pci_probe(Scsi_Host_Template *);
+int			 ahd_linux_pci_init(void);
+void			 ahd_linux_pci_exit(void);
 int			 ahd_pci_map_registers(struct ahd_softc *ahd);
 int			 ahd_pci_map_int(struct ahd_softc *ahd);
 
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic79xx_osm_pci.c linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	Mon Feb 24 11:05:14 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	Mon Mar 31 12:17:15 2003
@@ -183,14 +183,21 @@
 	}
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	pci_set_drvdata(pdev, ahd);
-	if (aic79xx_detect_complete)
+	if (aic79xx_detect_complete) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 		ahd_linux_register_host(ahd, &aic79xx_driver_template);
+#else
+		printf("aic79xx: ignoring PCI device found after "
+		       "initialization\n");
+		return (-ENODEV);
+#endif
+	}
 #endif
 	return (0);
 }
 
 int
-ahd_linux_pci_probe(Scsi_Host_Template *template)
+ahd_linux_pci_init(void)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	return (pci_module_init(&aic79xx_pci_driver));
@@ -219,6 +226,12 @@
 #endif
 }
 
+void
+ahd_linux_pci_exit(void)
+{
+	pci_unregister_driver(&aic79xx_pci_driver);
+}
+
 static int
 ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base,
 				 u_long *base2)
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic7xxx_osm.c linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic7xxx_osm.c
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic7xxx_osm.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic7xxx_osm.c	Mon Mar 31 12:17:15 2003
@@ -875,7 +875,7 @@
 	ahc_list_lockinit();
 
 #ifdef CONFIG_PCI
-	ahc_linux_pci_probe(template);
+	ahc_linux_pci_init();
 #endif
 
 	if (aic7xxx_no_probe == 0)
@@ -1266,9 +1266,9 @@
 }
 
 Scsi_Host_Template aic7xxx_driver_template = {
+	.module			= THIS_MODULE,
+	.name			= "aic7xxx",
 	.proc_info		= ahc_linux_proc_info,
-	.detect			= ahc_linux_detect,
-	.release		= ahc_linux_release,
 	.info			= ahc_linux_info,
 	.queuecommand		= ahc_linux_queue,
 	.eh_abort_handler	= ahc_linux_abort,
@@ -1300,19 +1300,17 @@
 #endif
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	.name			= "aic7xxx",
 	.slave_alloc		= ahc_linux_slave_alloc,
 	.slave_configure	= ahc_linux_slave_configure,
 	.slave_destroy		= ahc_linux_slave_destroy,
 #else
+	.detect			= ahc_linux_detect,
+	.release		= ahc_linux_release,
 	.select_queue_depths	= ahc_linux_select_queue_depth,
 	.use_new_eh_code	= 1,
 #endif
 };
 
-#define driver_template aic7xxx_driver_template
-#include "scsi_module.c"
-
 /**************************** Tasklet Handler *********************************/
 
 static void
@@ -1861,9 +1859,8 @@
 		ahc_set_name(ahc, new_name);
 	}
 	host->unique_id = ahc->unit;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	scsi_set_device(host, &ahc->dev_softc->dev);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) && \
+    LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
 	scsi_set_pci_device(host, ahc->dev_softc);
 #endif
 	ahc_linux_initialize_scsi_bus(ahc);
@@ -1897,6 +1894,10 @@
 	ahc_intr_enable(ahc, TRUE);
 	ahc_linux_start_dv(ahc);
 	ahc_unlock(ahc, &s);
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	scsi_add_host(host, (ahc->dev_softc ? &ahc->dev_softc->dev : NULL));
+#endif
 	return (0);
 }
 
@@ -2075,8 +2076,12 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 		tasklet_kill(&ahc->platform_data->runq_tasklet);
 #endif
-		if (ahc->platform_data->host != NULL)
+		if (ahc->platform_data->host != NULL) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+			scsi_remove_host(ahc->platform_data->host);
+#endif
 			scsi_unregister(ahc->platform_data->host);
+		}
 
 		/* destroy all of the device and target objects */
 		for (i = 0; i < AHC_NUM_TARGETS; i++) {
@@ -2112,19 +2117,16 @@
 #endif
 		}
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-		/* XXX Need an instance detach in the PCI code */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+		/*
+		 * In 2.4 we detach from the scsi midlayer before the PCI
+		 * layer invokes our remove callback.
+		 */
 		if (ahc->dev_softc != NULL)
 			ahc->dev_softc->driver = NULL;
 #endif
-		free(ahc->platform_data, M_DEVBUF);
-	}
-	if (TAILQ_EMPTY(&ahc_tailq)) {
-		unregister_reboot_notifier(&ahc_linux_notifier);
-#ifdef CONFIG_PCI
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-		pci_unregister_driver(&aic7xxx_pci_driver);
-#endif
 #endif
+		free(ahc->platform_data, M_DEVBUF);
 	}
 }
 
@@ -5182,3 +5184,51 @@
 		}
 	}
 }
+
+static int __init ahc_linux_init(void)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	return (ahc_linux_detect(&aic7xxx_driver_template) ? 0 : -ENODEV);
+#else
+	scsi_register_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
+	if (!driver_template.present) {
+		scsi_unregister_module(MODULE_SCSI_HA,
+				       &aic7xxx_driver_template);
+		return (-ENODEV);
+	}
+
+	return (0);
+#endif
+}
+
+static void __exit ahc_linux_exit(void)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	struct	ahc_softc *ahc;
+
+	ahc_linux_pci_exit();
+
+	/*
+	 * Get rid of the non-pci devices.  
+	 *
+	 * XXX(hch): switch over eisa support to new LDM-based API
+	 */
+	TAILQ_FOREACH(ahc, &ahc_tailq, links)
+		ahc_linux_release(ahc->platform_data->host);
+#else
+	scsi_unregister_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
+
+	/*
+	 * In 2.4 we have to unregister from the PCI core _after_
+	 * unregistering from the scsi midlayer to avoid danling references.
+	 *
+	 * The 2.4 scsi midlayer is so f***ed..
+	 */
+	ahc_linux_pci_exit();
+#endif
+
+	unregister_reboot_notifier(&ahc_linux_notifier);
+}
+
+module_init(ahc_linux_init);
+module_exit(ahc_linux_exit);
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic7xxx_osm.h linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic7xxx_osm.h
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic7xxx_osm.h	Mon Feb 24 11:05:15 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic7xxx_osm.h	Mon Mar 31 12:17:15 2003
@@ -912,7 +912,8 @@
 #include <linux/bios32.h>
 #endif
 
-int			 ahc_linux_pci_probe(Scsi_Host_Template *);
+int			 ahc_linux_pci_init(void);
+void			 ahc_linux_pci_exit(void);
 int			 ahc_pci_map_registers(struct ahc_softc *ahc);
 int			 ahc_pci_map_int(struct ahc_softc *ahc);
 
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	Mon Feb 24 11:05:14 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	Mon Mar 31 12:17:15 2003
@@ -179,14 +179,21 @@
 	}
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	pci_set_drvdata(pdev, ahc);
-	if (aic7xxx_detect_complete)
+	if (aic7xxx_detect_complete) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 		ahc_linux_register_host(ahc, &aic7xxx_driver_template);
+#else
+		printf("aic7xxx: ignoring PCI device found after "
+		       "initialization\n");
+		return (-ENODEV);
+#endif
+	}
 #endif
 	return (0);
 }
 
 int
-ahc_linux_pci_probe(Scsi_Host_Template *template)
+ahc_linux_pci_init(void)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	return (pci_module_init(&aic7xxx_pci_driver));
@@ -215,6 +222,12 @@
 #endif
 }
 
+void
+ahc_linux_pci_exit(void)
+{
+	pci_unregister_driver(&aic7xxx_pci_driver);
+}
+
 static int
 ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, u_long *base)
 {
diff -urN linux-2.5.63-bk2/drivers/scsi/aic7xxx_old.c linux-2.5.63-bk3/drivers/scsi/aic7xxx_old.c
--- linux-2.5.63-bk2/drivers/scsi/aic7xxx_old.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/aic7xxx_old.c	Mon Mar 31 12:17:15 2003
@@ -10392,7 +10392,7 @@
   aic7xxx_done_cmds_complete(p);
   /* If the command was already complete or just completed, then we didn't
    * do a reset, return FAILED */
-  if(!scb->flags & SCB_ACTIVE)
+  if(!(scb->flags & SCB_ACTIVE))
     return FAILED;
 
   pause_sequencer(p);
@@ -10615,7 +10615,7 @@
   aic7xxx_done_cmds_complete(p);
   /* If the command was already complete or just completed, then we didn't
    * do a reset, return FAILED */
-  if(!scb->flags & SCB_ACTIVE)
+  if(!(scb->flags & SCB_ACTIVE))
     return FAILED;
 
   pause_sequencer(p);
diff -urN linux-2.5.63-bk2/drivers/scsi/atari_NCR5380.c linux-2.5.63-bk3/drivers/scsi/atari_NCR5380.c
--- linux-2.5.63-bk2/drivers/scsi/atari_NCR5380.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/atari_NCR5380.c	Mon Mar 31 12:17:15 2003
@@ -2543,7 +2543,7 @@
     phase = PHASE_MSGIN;
     NCR5380_transfer_pio(instance, &phase, &len, &data);
 
-    if (!msg[0] & 0x80) {
+    if (!(msg[0] & 0x80)) {
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
 	print_msg(msg);
 	do_abort(instance);
diff -urN linux-2.5.63-bk2/drivers/scsi/dpt_i2o.c linux-2.5.63-bk3/drivers/scsi/dpt_i2o.c
--- linux-2.5.63-bk2/drivers/scsi/dpt_i2o.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/dpt_i2o.c	Mon Mar 31 12:17:15 2003
@@ -86,7 +86,7 @@
 #elif defined(__alpha__)
 	PROC_ALPHA ,
 #else
-	(-1),
+	(-1),(-1)
 #endif
 	 FT_HBADRVR, 0, OEM_DPT, OS_LINUX, CAP_OVERLAP, DEV_ALL,
 	ADF_ALL_SC5, 0, 0, DPT_VERSION, DPT_REVISION, DPT_SUBREVISION,
@@ -1135,7 +1135,8 @@
        // to support async LCT get
 	wait_data->next = adpt_post_wait_queue;
 	adpt_post_wait_queue = wait_data;
-	adpt_post_wait_id = (++adpt_post_wait_id & 0x7fff);
+	adpt_post_wait_id++;
+	adpt_post_wait_id &= 0x7fff;
 	wait_data->id =  adpt_post_wait_id;
 	spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
 
diff -urN linux-2.5.63-bk2/drivers/scsi/fdomain.c linux-2.5.63-bk3/drivers/scsi/fdomain.c
--- linux-2.5.63-bk2/drivers/scsi/fdomain.c	Mon Feb 24 11:05:38 2003
+++ linux-2.5.63-bk3/drivers/scsi/fdomain.c	Mon Mar 31 12:17:15 2003
@@ -725,13 +725,13 @@
       switch (Quantum) {
       case 2:			/* ISA_200S */
       case 3:			/* ISA_250MG */
-	 base = readb(bios_base + 0x1fa2) + (readb(bios_base + 0x1fa3) << 8);
+	 base = isa_readb(bios_base + 0x1fa2) + (isa_readb(bios_base + 0x1fa3) << 8);
 	 break;
       case 4:			/* ISA_200S (another one) */
-	 base = readb(bios_base + 0x1fa3) + (readb(bios_base + 0x1fa4) << 8);
+	 base = isa_readb(bios_base + 0x1fa3) + (isa_readb(bios_base + 0x1fa4) << 8);
 	 break;
       default:
-	 base = readb(bios_base + 0x1fcc) + (readb(bios_base + 0x1fcd) << 8);
+	 base = isa_readb(bios_base + 0x1fcc) + (isa_readb(bios_base + 0x1fcd) << 8);
 	 break;
       }
    
@@ -1777,7 +1777,7 @@
 	 offset = bios_base + 0x1f31 + drive * 25;
 	 break;
       }
-      memcpy_fromio( &i, offset, sizeof( struct drive_info ) );
+      isa_memcpy_fromio( &i, offset, sizeof( struct drive_info ) );
       info_array[0] = i.heads;
       info_array[1] = i.sectors;
       info_array[2] = i.cylinders;
diff -urN linux-2.5.63-bk2/drivers/scsi/hosts.c linux-2.5.63-bk3/drivers/scsi/hosts.c
--- linux-2.5.63-bk2/drivers/scsi/hosts.c	Mon Feb 24 11:05:06 2003
+++ linux-2.5.63-bk3/drivers/scsi/hosts.c	Mon Mar 31 12:17:16 2003
@@ -270,21 +270,6 @@
 		if (scsi_check_device_busy(sdev))
 			return 1;
 
-	/*
-	 * Next we detach the high level drivers from the Scsi_Device
-	 * structures
-	 */
-	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		scsi_detach_device(sdev);
-
-		/* If something still attached, punt */
-		if (sdev->attached) {
-			printk(KERN_ERR "Attached usage count = %d\n",
-			       sdev->attached);
-			return 1;
-		}
-	}
-
 	scsi_forget_host(shost);
 	return 0;
 }
diff -urN linux-2.5.63-bk2/drivers/scsi/ips.c linux-2.5.63-bk3/drivers/scsi/ips.c
--- linux-2.5.63-bk2/drivers/scsi/ips.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/ips.c	Mon Mar 31 12:17:16 2003
@@ -2737,7 +2737,7 @@
 
       scb->dcdb.cmd_attribute = ips_command_direction[scb->scsi_cmd->cmnd[0]];
 
-      if (!scb->dcdb.cmd_attribute & 0x3)
+      if (!(scb->dcdb.cmd_attribute & 0x3))
          scb->dcdb.transfer_length = 0;
 
       if (scb->data_len >= IPS_MAX_XFER) {
@@ -3315,7 +3315,7 @@
          scb->dcdb.transfer_length = scb->data_len;
          scb->dcdb.cmd_attribute |= ips_command_direction[scb->scsi_cmd->cmnd[0]];
 
-         if (!scb->dcdb.cmd_attribute & 0x3)
+         if (!(scb->dcdb.cmd_attribute & 0x3))
             scb->dcdb.transfer_length = 0;
 
          if (scb->data_len >= IPS_MAX_XFER) {
diff -urN linux-2.5.63-bk2/drivers/scsi/mac_NCR5380.c linux-2.5.63-bk3/drivers/scsi/mac_NCR5380.c
--- linux-2.5.63-bk2/drivers/scsi/mac_NCR5380.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/mac_NCR5380.c	Mon Mar 31 12:17:16 2003
@@ -2694,7 +2694,7 @@
     phase = PHASE_MSGIN;
     NCR5380_transfer_pio(instance, &phase, &len, &data);
 
-    if (!msg[0] & 0x80) {
+    if (!(msg[0] & 0x80)) {
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
 	print_msg(msg);
 	do_abort(instance);
diff -urN linux-2.5.63-bk2/drivers/scsi/pcmcia/fdomain_stub.c linux-2.5.63-bk3/drivers/scsi/pcmcia/fdomain_stub.c
--- linux-2.5.63-bk2/drivers/scsi/pcmcia/fdomain_stub.c	Mon Feb 24 11:05:34 2003
+++ linux-2.5.63-bk3/drivers/scsi/pcmcia/fdomain_stub.c	Mon Mar 31 12:17:16 2003
@@ -2,7 +2,7 @@
 
     A driver for Future Domain-compatible PCMCIA SCSI cards
 
-    fdomain_cs.c 1.43 2000/06/12 21:27:25
+    fdomain_cs.c 1.47 2001/10/13 00:08:52
 
     The contents of this file are subject to the Mozilla Public
     License Version 1.1 (the "License"); you may not use this file
@@ -19,8 +19,8 @@
     are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
 
     Alternatively, the contents of this file may be used under the
-    terms of the GNU General Public License version 2 (the "GPL"), in which
-    case the provisions of the GPL are applicable instead of the
+    terms of the GNU General Public License version 2 (the "GPL"), in
+    which case the provisions of the GPL are applicable instead of the
     above.  If you wish to allow the use of your version of this file
     only under the terms of the GPL and not to allow others to use
     your version of this file under the MPL, indicate your decision
@@ -53,27 +53,30 @@
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 
-#ifdef PCMCIA_DEBUG
-static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"fdomain_cs.c 1.43 2000/06/12 21:27:25 (David Hinds)";
-#else
-#define DEBUG(n, args...)
-#endif
-
 /*====================================================================*/
 
-/* Parameters that can be set with 'insmod' */
+/* Module parameters */
+
+MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
+MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver");
+MODULE_LICENSE("Dual MPL/GPL");
+
+#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
 
 /* Bit map of interrupts to choose from */
-static u_int irq_mask = 0xdeb8;
+INT_MODULE_PARM(irq_mask, 0xdeb8);
 static int irq_list[4] = { -1 };
-
-MODULE_PARM(irq_mask, "i");
 MODULE_PARM(irq_list, "1-4i");
 
+#ifdef PCMCIA_DEBUG
+INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)";
+#else
+#define DEBUG(n, args...)
+#endif
+
 /*====================================================================*/
 
 typedef struct scsi_info_t {
@@ -213,6 +216,7 @@
     u_char tuple_data[64];
     Scsi_Device *dev;
     dev_node_t *node, **tail;
+    char str[16];
     struct Scsi_Host *host;
 
     DEBUG(0, "fdomain_config(0x%p)\n", link);
@@ -253,7 +257,8 @@
     ints[0] = 2;
     ints[1] = link->io.BasePort1;
     ints[2] = link->irq.AssignedIRQ;
-    fdomain_setup("PCMCIA setup", ints);
+    sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ);
+    fdomain_setup(str, ints);
     
     scsi_register_host(&driver_template);
 
diff -urN linux-2.5.63-bk2/drivers/scsi/pcmcia/nsp_cs.c linux-2.5.63-bk3/drivers/scsi/pcmcia/nsp_cs.c
--- linux-2.5.63-bk2/drivers/scsi/pcmcia/nsp_cs.c	Mon Feb 24 11:06:01 2003
+++ linux-2.5.63-bk3/drivers/scsi/pcmcia/nsp_cs.c	Mon Mar 31 12:17:16 2003
@@ -128,7 +128,7 @@
 MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 (=no))");
 
 /* /usr/src/linux/drivers/scsi/hosts.h */
-static Scsi_Host_Template driver_template = {
+static Scsi_Host_Template nsp_driver_template = {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0))
 	.proc_name	         = "nsp_cs",      /* kernel 2.4 */
 #else
@@ -136,8 +136,10 @@
 #endif
 	.proc_info		 = nsp_proc_info,
 	.name			 = "WorkBit NinjaSCSI-3/32Bi(16bit)",
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 	.detect			 = nsp_detect,
 	.release		 = nsp_release,
+#endif
 	.info			 = nsp_info,
 	.queuecommand		 = nsp_queuecommand,
 /*	.eh_strategy_handler	 = nsp_eh_strategy,*/
@@ -1215,7 +1217,7 @@
 /*----------------------------------------------------------------*/
 /* look for ninja3 card and init if found			  */
 /*----------------------------------------------------------------*/
-static int nsp_detect(Scsi_Host_Template *sht)
+static struct Scsi_Host *__nsp_detect(Scsi_Host_Template *sht)
 {
 	struct Scsi_Host *host;	/* registered host structure */
 	nsp_hw_data *data = &nsp_data;
@@ -1225,7 +1227,7 @@
 	request_region(data->BaseAddress, data->NumAddress, "nsp_cs");
 	host		  = scsi_register(sht, 0);
 	if(host == NULL)
-		return 0;
+		return NULL;
 
 	host->unique_id	  = data->BaseAddress;
 	host->io_port	  = data->BaseAddress;
@@ -1252,7 +1254,13 @@
 
 	//MOD_INC_USE_COUNT;
 
-	return 1; /* detect done. */
+	return host;
+}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+static int nsp_detect(Scsi_Host_Template *sht)
+{
+	return (__nsp_detect(sht) != NULL);
 }
 
 static int nsp_release(struct Scsi_Host *shpnt)
@@ -1271,6 +1279,7 @@
 
 	return 0;
 }
+#endif
 
 /*----------------------------------------------------------------*/
 /* return info string						  */
@@ -1763,55 +1772,53 @@
 	}
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2))
-	scsi_register_host(&driver_template);
+	host = __nsp_detect(&nsp_driver_template);
 #else
-	scsi_register_module(MODULE_SCSI_HA, &driver_template);
+	scsi_register_module(MODULE_SCSI_HA, &nsp_driver_template);
+	for (host = scsi_hostlist; host != NULL; host = host->next) {
+		if (host->hostt == &nsp_driver_template)
+			break;
 #endif
 
+	if (!host)
+		goto cs_failed;
+
 	DEBUG(0, "GET_SCSI_INFO\n");
 	tail = &link->dev;
 	info->ndev = 0;
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45))
-	for (host = scsi_host_get_next(NULL); host;
-	     host = scsi_host_get_next(host)) {
-#else
-	for (host = scsi_hostlist; host != NULL; host = host->next) {
-#endif
-		if (host->hostt == &driver_template) {
-	    		list_for_each_entry (dev, &host->my_devices, siblings) {
-				u_long arg[2], id;
-				kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
-				id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
-					((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
-				node = &info->node[info->ndev];
-				node->minor = 0;
-				switch (dev->type) {
-				case TYPE_TAPE:
-					node->major = SCSI_TAPE_MAJOR;
-					sprintf(node->dev_name, "st#%04lx", id);
-					break;
-				case TYPE_DISK:
-				case TYPE_MOD:
-					node->major = SCSI_DISK0_MAJOR;
-					sprintf(node->dev_name, "sd#%04lx", id);
-					break;
-				case TYPE_ROM:
-				case TYPE_WORM:
-					node->major = SCSI_CDROM_MAJOR;
-					sprintf(node->dev_name, "sr#%04lx", id);
-					break;
-				default:
-					node->major = SCSI_GENERIC_MAJOR;
-					sprintf(node->dev_name, "sg#%04lx", id);
-					break;
-				}
-				*tail = node; tail = &node->next;
-				info->ndev++;
-				info->host = dev->host;
-			}
+	list_for_each_entry (dev, &host->my_devices, siblings) {
+		u_long arg[2], id;
+		kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
+		id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
+			((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
+		node = &info->node[info->ndev];
+		node->minor = 0;
+		switch (dev->type) {
+		case TYPE_TAPE:
+			node->major = SCSI_TAPE_MAJOR;
+			sprintf(node->dev_name, "st#%04lx", id);
+			break;
+		case TYPE_DISK:
+		case TYPE_MOD:
+			node->major = SCSI_DISK0_MAJOR;
+			sprintf(node->dev_name, "sd#%04lx", id);
+			break;
+		case TYPE_ROM:
+		case TYPE_WORM:
+			node->major = SCSI_CDROM_MAJOR;
+			sprintf(node->dev_name, "sr#%04lx", id);
+			break;
+		default:
+			node->major = SCSI_GENERIC_MAJOR;
+			sprintf(node->dev_name, "sg#%04lx", id);
+			break;
 		}
+		*tail = node; tail = &node->next;
+		info->ndev++;
+		info->host = dev->host;
 	}
+
 	*tail = NULL;
 	if (info->ndev == 0) {
 		printk(KERN_INFO "nsp_cs: no SCSI devices found\n");
@@ -1839,6 +1846,10 @@
 		       req.Base+req.Size-1);
 	printk("\n");
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+	scsi_add_host(host, NULL);
+#endif
+
 	link->state &= ~DEV_CONFIG_PENDING;
 	return;
 
@@ -1859,6 +1870,7 @@
 static void nsp_cs_release(u_long arg)
 {
 	dev_link_t *link = (dev_link_t *)arg;
+	scsi_info_t *info = link->priv;
 
 	DEBUG(0, "%s(0x%p)\n", __FUNCTION__, link);
 
@@ -1874,10 +1886,11 @@
 	}
 
 	/* Unlink the device chain */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2))
-	scsi_unregister_host(&driver_template);
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,2))
+	scsi_unregister_module(MODULE_SCSI_HA, &nsp_driver_template);
 #else
-	scsi_unregister_module(MODULE_SCSI_HA, &driver_template);
+	scsi_remove_host(info->host);
+	scsi_unregister(info->host);
 #endif
 	link->dev = NULL;
 
diff -urN linux-2.5.63-bk2/drivers/scsi/pcmcia/nsp_cs.h linux-2.5.63-bk3/drivers/scsi/pcmcia/nsp_cs.h
--- linux-2.5.63-bk2/drivers/scsi/pcmcia/nsp_cs.h	Mon Feb 24 11:05:16 2003
+++ linux-2.5.63-bk3/drivers/scsi/pcmcia/nsp_cs.h	Mon Mar 31 12:17:16 2003
@@ -280,8 +280,6 @@
 static unsigned int nsphw_start_selection(Scsi_Cmnd *SCpnt, nsp_hw_data *data);
 static void nsp_start_timer(Scsi_Cmnd *SCpnt, nsp_hw_data *data, int time);
 
-static int nsp_detect(Scsi_Host_Template * );
-static int nsp_release(struct Scsi_Host *shpnt);
 static const char *nsp_info(struct Scsi_Host *shpnt);
 static int nsp_proc_info(char *buffer, char **start, off_t offset,
 			 int length, int hostno, int inout);
diff -urN linux-2.5.63-bk2/drivers/scsi/scsi.c linux-2.5.63-bk3/drivers/scsi/scsi.c
--- linux-2.5.63-bk2/drivers/scsi/scsi.c	Mon Feb 24 11:05:32 2003
+++ linux-2.5.63-bk3/drivers/scsi/scsi.c	Mon Mar 31 12:17:16 2003
@@ -1308,7 +1308,8 @@
 void scsi_set_device_offline(struct scsi_device *sdev)
 {
 	struct scsi_cmnd *scmd;
-	int	cmds_active = 0;
+	LIST_HEAD(active_list);
+	struct list_head *lh, *lh_sf;
 	unsigned long flags;
 
 	sdev->online = FALSE;
@@ -1324,15 +1325,17 @@
 			if (!scsi_delete_timer(scmd)) {
 				continue;
 			}
-
-			++cmds_active;
-
-			scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD);
+			list_add_tail(&scmd->eh_entry, &active_list);
 		}
 	}
 	spin_unlock_irqrestore(&sdev->list_lock, flags);
 
-	if (!cmds_active) {
+	if (!list_empty(&active_list)) {
+		list_for_each_safe(lh, lh_sf, &active_list) {
+			scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
+			scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD);
+		}
+	} else {
 		/* FIXME: Send online state change hotplug event */
 	}
 }
diff -urN linux-2.5.63-bk2/drivers/scsi/scsi.h linux-2.5.63-bk3/drivers/scsi/scsi.h
--- linux-2.5.63-bk2/drivers/scsi/scsi.h	Mon Feb 24 11:05:13 2003
+++ linux-2.5.63-bk3/drivers/scsi/scsi.h	Mon Mar 31 12:17:16 2003
@@ -503,8 +503,9 @@
 /*
  * Prototypes for functions in scsi_scan.c
  */
-extern int scsi_add_single_device(uint, uint, uint, uint);
-extern int scsi_remove_single_device(uint, uint, uint, uint);
+extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
+		uint, uint, uint);
+extern int scsi_remove_device(struct scsi_device *);
 extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
 
 /*
diff -urN linux-2.5.63-bk2/drivers/scsi/scsi_pc98.c linux-2.5.63-bk3/drivers/scsi/scsi_pc98.c
--- linux-2.5.63-bk2/drivers/scsi/scsi_pc98.c	Wed Dec 31 16:00:00 1969
+++ linux-2.5.63-bk3/drivers/scsi/scsi_pc98.c	Mon Mar 31 12:17:16 2003
@@ -0,0 +1,75 @@
+/*
+ *  Copyright (C) 2003  Osamu Tomita <tomita@cinet.co.jp>
+ *
+ *  PC9801 BIOS geometry handling.
+ */
+
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/genhd.h>
+#include <linux/blk.h>
+#include <asm/pc9800.h>
+
+#include "scsi.h"
+#include "hosts.h"
+
+
+/* XXX - For now, we assume the first (i.e. having the least host_no)
+   real (i.e. non-emulated) host adapter shall be BIOS-controlled one.
+   We *SHOULD* invent another way.  */
+static inline struct Scsi_Host *first_real_host(void)
+{
+	struct Scsi_Host *shost = NULL;
+
+	while ((shost = scsi_host_get_next(shost))) {
+		if (!shost->hostt->emulated)
+			break;
+	}
+
+	return shost;
+}
+
+static int pc98_first_bios_param(struct scsi_device *sdev, int *ip)
+{
+	const u8 *p = (&__PC9800SCA(u8, PC9800SCA_SCSI_PARAMS) + sdev->id * 4);
+
+	ip[0] = p[1];   /* # of heads */
+	ip[1] = p[0];   /* # of sectors/track */
+	ip[2] = *(u16 *)&p[2] & 0x0fff; /* # of cylinders */
+	if (p[3] & (1 << 6)) { /* #-of-cylinders is 16-bit */
+		ip[2] |= (ip[0] & 0xf0) << 8;
+		ip[0] &= 0x0f;
+	}
+
+	return 0;
+}
+
+int pc98_bios_param(struct scsi_device *sdev, struct block_device *bdev,
+			sector_t capacity, int *ip)
+{
+	static struct Scsi_Host *first_real = first_real_host();
+
+	if (sdev->host == first_real && sdev->id < 7 &&
+	    __PC9800SCA_TEST_BIT(PC9800SCA_DISK_EQUIPS, sdev->id))
+	    	return pc98_first_bios_param(sdev, ip);
+
+	/* Assume PC-9801-92 compatible parameters for HAs without BIOS.  */
+	ip[0] = 8;
+	ip[1] = 32;
+	ip[2] = capacity / (8 * 32);
+	if (ip[2] > 65535) {    /* if capacity >= 8GB */
+		/* Recent on-board adapters seem to use this parameter. */
+		ip[1] = 128;
+		ip[2] = capacity / (8 * 128);
+		if (ip[2] > 65535) { /* if capacity >= 32GB  */
+			/* Clip the number of cylinders.  Currently
+			   this is the limit that we deal with.  */
+			ip[2] = 65535;
+		}
+	}
+
+	return 0;
+}
+
+EXPORT_SYMBOL(pc98_bios_param);
diff -urN linux-2.5.63-bk2/drivers/scsi/scsi_proc.c linux-2.5.63-bk3/drivers/scsi/scsi_proc.c
--- linux-2.5.63-bk2/drivers/scsi/scsi_proc.c	Mon Feb 24 11:05:06 2003
+++ linux-2.5.63-bk3/drivers/scsi/scsi_proc.c	Mon Mar 31 12:17:16 2003
@@ -398,6 +398,50 @@
 }
 #endif	/* CONFIG_SCSI_LOGGING */ 
 
+static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
+{
+	struct Scsi_Host *shost;
+	struct scsi_device *sdev;
+	int error = -ENODEV;
+
+	shost = scsi_host_hn_get(host);
+	if (!shost)
+		return -ENODEV;
+
+	if (!scsi_find_device(shost, channel, id, lun)) {
+		sdev = scsi_add_device(shost, channel, id, lun);
+		if (IS_ERR(sdev))
+			error = PTR_ERR(sdev);
+		else
+			error = 0;
+	}
+
+	scsi_host_put(shost);
+	return error;
+}
+
+static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
+{
+	struct scsi_device *sdev;
+	struct Scsi_Host *shost;
+	int error = -ENODEV;
+
+	shost = scsi_host_hn_get(host);
+	if (!shost)
+		return -ENODEV;
+	sdev = scsi_find_device(shost, channel, id, lun);
+	if (!sdev)
+		goto out;
+	if (sdev->access_count)
+		goto out;
+
+	error = scsi_remove_device(sdev);
+out:
+	scsi_host_put(shost);
+	return error;
+}
+
+
 static int proc_scsi_gen_write(struct file * file, const char * buf,
                               unsigned long length, void *data)
 {
diff -urN linux-2.5.63-bk2/drivers/scsi/scsi_scan.c linux-2.5.63-bk3/drivers/scsi/scsi_scan.c
--- linux-2.5.63-bk2/drivers/scsi/scsi_scan.c	Mon Feb 24 11:05:39 2003
+++ linux-2.5.63-bk3/drivers/scsi/scsi_scan.c	Mon Mar 31 12:17:16 2003
@@ -189,6 +189,8 @@
 	{"HITACHI", "DF500", "*", BLIST_SPARSELUN},
 	{"HITACHI", "DF600", "*", BLIST_SPARSELUN},
 	{"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+	{"SUN", "T300", "*", BLIST_SPARSELUN},
+	{"SUN", "T4", "*", BLIST_SPARSELUN},
 	{ NULL, NULL, NULL, 0 },
 };
 
@@ -1259,14 +1261,6 @@
 	return SCSI_SCAN_LUN_PRESENT;
 }
 
-static void scsi_remove_lun(struct scsi_device *sdev)
-{
-	devfs_unregister(sdev->de);
-	scsi_device_unregister(sdev);
-
-	scsi_free_sdev(sdev);
-}
-
 /**
  * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
  * @sdevscan:	probe the LUN corresponding to this Scsi_Device
@@ -1284,90 +1278,77 @@
  *     SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized
  **/
 static int scsi_probe_and_add_lun(struct Scsi_Host *host,
-		struct request_queue **q, uint channel, uint id,
-	       	uint lun, int *bflagsp)
+		struct request_queue **q, uint channel, uint id, uint lun,
+		int *bflagsp, struct scsi_device **sdevp)
 {
-	Scsi_Device *sdev = NULL;
-	Scsi_Request *sreq = NULL;
-	unsigned char *scsi_result = NULL;
-	int bflags;
-	int res;
+	struct scsi_device *sdev;
+	struct scsi_request *sreq;
+	unsigned char *result;
+	int bflags, res = SCSI_SCAN_NO_RESPONSE;
 
 	sdev = scsi_alloc_sdev(host, q, channel, id, lun);
-	if (sdev == NULL)
-		return SCSI_SCAN_NO_RESPONSE;
+	if (!sdev)
+		goto out;
 	sreq = scsi_allocate_request(sdev);
-	if (sreq == NULL) {
-		printk(ALLOC_FAILURE_MSG, __FUNCTION__);
-		res = SCSI_SCAN_NO_RESPONSE;
-		goto bail_out;
-	}
-	/*
-	 * The sreq is for use only with sdevscan.
-	 */
+	if (!sreq)
+		goto out_free_sdev;
+	result = kmalloc(256, GFP_ATOMIC |
+			(host->unchecked_isa_dma) ? __GFP_DMA : 0);
+	if (!result)
+		goto out_free_sreq;
 
-	scsi_result = kmalloc(256, GFP_ATOMIC |
-			      (host->unchecked_isa_dma) ?
-			      GFP_DMA : 0);
-	if (scsi_result == NULL) {
-		printk(ALLOC_FAILURE_MSG, __FUNCTION__);
-		res = SCSI_SCAN_NO_RESPONSE;
-		goto bail_out;
-	}
-
-	scsi_probe_lun(sreq, scsi_result, &bflags);
+	scsi_probe_lun(sreq, result, &bflags);
 	if (sreq->sr_result)
-		res = SCSI_SCAN_NO_RESPONSE;
-	else {
+		goto out_free_result;
+
+	/*
+	 * result contains valid SCSI INQUIRY data.
+	 */
+	if ((result[0] >> 5) == 3) {
 		/*
-		 * scsi_result contains valid SCSI INQUIRY data.
+		 * For a Peripheral qualifier 3 (011b), the SCSI
+		 * spec says: The device server is not capable of
+		 * supporting a physical device on this logical
+		 * unit.
+		 *
+		 * For disks, this implies that there is no
+		 * logical disk configured at sdev->lun, but there
+		 * is a target id responding.
 		 */
-		if ((scsi_result[0] >> 5) == 3) {
-			/*
-			 * For a Peripheral qualifier 3 (011b), the SCSI
-			 * spec says: The device server is not capable of
-			 * supporting a physical device on this logical
-			 * unit.
-			 *
-			 * For disks, this implies that there is no
-			 * logical disk configured at sdev->lun, but there
-			 * is a target id responding.
-			 */
-			SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
+		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
 					"scsi scan: peripheral qualifier of 3,"
 					" no device added\n"));
-			res = SCSI_SCAN_TARGET_PRESENT;
-		} else {
-			res = scsi_add_lun(sdev, sreq, scsi_result, &bflags);
-			if (res == SCSI_SCAN_LUN_PRESENT) {
-				if ((bflags & BLIST_KEY) != 0) {
-					sdev->lockable = 0;
-					scsi_unlock_floptical(sreq,
-							      scsi_result);
-					/*
-					 * scsi_result no longer contains
-					 * the INQUIRY data.
-					 */
-				}
-				if (bflagsp != NULL)
-					*bflagsp = bflags;
-			}
+		res = SCSI_SCAN_TARGET_PRESENT;
+		goto out_free_result;
+	}
+
+	res = scsi_add_lun(sdev, sreq, result, &bflags);
+	if (res == SCSI_SCAN_LUN_PRESENT) {
+		if (bflags & BLIST_KEY) {
+			sdev->lockable = 0;
+			scsi_unlock_floptical(sreq, result);
 		}
+		if (bflagsp)
+			*bflagsp = bflags;
 	}
-bail_out:
-	if (scsi_result != NULL)
-		kfree(scsi_result);
-	if (sreq != NULL)
-		scsi_release_request(sreq);
-	if (res != SCSI_SCAN_LUN_PRESENT) {
-		if(q) {
+
+ out_free_result:
+	kfree(result);
+ out_free_sreq:
+	scsi_release_request(sreq);
+ out_free_sdev:
+	if (res == SCSI_SCAN_LUN_PRESENT) {
+		if (*sdevp)
+			*sdevp = sdev;
+	} else {
+		if (q) {
 			*q = sdev->request_queue;
 			sdev->request_queue = NULL;
 		}
 		scsi_free_sdev(sdev);
 	}
+ out:
 	return res;
-
 }
 
 /**
@@ -1453,8 +1434,8 @@
 	 * sparse_lun.
 	 */
 	for (lun = 1; lun < max_dev_lun; ++lun)
-		if ((scsi_probe_and_add_lun(shost, q, channel, id, lun, NULL)
-		     != SCSI_SCAN_LUN_PRESENT) && !sparse_lun)
+		if ((scsi_probe_and_add_lun(shost, q, channel, id, lun,
+		      NULL, NULL) != SCSI_SCAN_LUN_PRESENT) && !sparse_lun)
 			return;
 }
 
@@ -1669,7 +1650,7 @@
 			int res;
 
 			res = scsi_probe_and_add_lun(sdev->host, q,
-				       	sdev->channel, sdev->id, lun, NULL);
+				sdev->channel, sdev->id, lun, NULL, NULL);
 			if (res == SCSI_SCAN_NO_RESPONSE) {
 				/*
 				 * Got some results, but now none, abort.
@@ -1691,55 +1672,33 @@
 
 }
 
-int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
+struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
+				    uint channel, uint id, uint lun)
 {
-	struct Scsi_Host *shost;
-	int error = -ENODEV;
 	struct scsi_device *sdev;
+	int error = -ENODEV, res;
 
-	shost = scsi_host_hn_get(host);
-	if (!shost)
-		return -ENODEV;
-	if(scsi_find_device(shost, channel, id, lun) != NULL)
-		goto out;
+	res = scsi_probe_and_add_lun(shost, NULL, channel, id, lun,
+			NULL, &sdev);
+	if (res == SCSI_SCAN_LUN_PRESENT)
+		error = scsi_attach_device(sdev);
 
-	if (scsi_probe_and_add_lun(shost, NULL, channel, id, lun, NULL) ==
-			SCSI_SCAN_LUN_PRESENT) {
-		error = 0;
-		sdev = scsi_find_device(shost, channel, id, lun);
-		scsi_attach_device(sdev);
-	}
-out:
-	scsi_host_put(shost);
-	return error;
+	if (error)
+		sdev = ERR_PTR(error);
+	return sdev;
 }
 
-int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
+int scsi_remove_device(struct scsi_device *sdev)
 {
-	struct scsi_device *sdev;
-	struct Scsi_Host *shost;
-	int error = -ENODEV;
-
-	shost = scsi_host_hn_get(host);
-	if (!shost)
-		return -ENODEV;
-	sdev = scsi_find_device(shost, channel, id, lun);
-	if (!sdev)
-		goto out;
-
-	error = -EBUSY;
-	if (sdev->access_count)
-		goto out;
 	scsi_detach_device(sdev);
 	if (sdev->attached)
-		goto out;
+		return -EINVAL;
 
-	scsi_remove_lun(sdev);
-	error = 0;
+	devfs_unregister(sdev->de);
+	scsi_device_unregister(sdev);
 
-out:
-	scsi_host_put(shost);
-	return error;
+	scsi_free_sdev(sdev);
+	return 0;
 }
 
 /**
@@ -1778,9 +1737,8 @@
 	 * Scan LUN 0, if there is some response, scan further. Ideally, we
 	 * would not configure LUN 0 until all LUNs are scanned.
 	 */
-	res = scsi_probe_and_add_lun(shost, q, channel, id, 0, &bflags);
+	res = scsi_probe_and_add_lun(shost, q, channel, id, 0, &bflags, &sdev);
 	if (res == SCSI_SCAN_LUN_PRESENT) {
-		sdev = scsi_find_device(shost, channel, id, 0);
 		if (scsi_report_lun_scan(sdev, q, bflags) != 0)
 			/*
 			 * The REPORT LUN did not scan the target,
@@ -1846,9 +1804,13 @@
 void scsi_forget_host(struct Scsi_Host *shost)
 {
 	struct list_head *le, *lh;
+	struct scsi_device *sdev;
 
-	list_for_each_safe(le, lh, &shost->my_devices)
-		scsi_remove_lun(list_entry(le, struct scsi_device, siblings));
+	list_for_each_safe(le, lh, &shost->my_devices) {
+		sdev = list_entry(le, struct scsi_device, siblings);
+		
+		scsi_remove_device(sdev);
+	}
 }
 
 /*
diff -urN linux-2.5.63-bk2/drivers/scsi/scsi_syms.c linux-2.5.63-bk3/drivers/scsi/scsi_syms.c
--- linux-2.5.63-bk2/drivers/scsi/scsi_syms.c	Mon Feb 24 11:05:32 2003
+++ linux-2.5.63-bk3/drivers/scsi/scsi_syms.c	Mon Mar 31 12:17:16 2003
@@ -78,6 +78,8 @@
 EXPORT_SYMBOL(scsi_slave_detach);
 EXPORT_SYMBOL(scsi_device_get);
 EXPORT_SYMBOL(scsi_device_put);
+EXPORT_SYMBOL(scsi_add_device);
+EXPORT_SYMBOL(scsi_remove_device);
 EXPORT_SYMBOL(scsi_set_device_offline);
 
 /*
diff -urN linux-2.5.63-bk2/drivers/scsi/sgiwd93.c linux-2.5.63-bk3/drivers/scsi/sgiwd93.c
--- linux-2.5.63-bk2/drivers/scsi/sgiwd93.c	Mon Feb 24 11:05:45 2003
+++ linux-2.5.63-bk3/drivers/scsi/sgiwd93.c	Mon Mar 31 12:17:16 2003
@@ -4,10 +4,13 @@
  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  *		 1999 Andrew R. Baker (andrewb@uab.edu)
  *		      - Support for 2nd SCSI controller on Indigo2
+ *		 2001 Florian Lohoff (flo@rfc822.org)
+ *		      - Delete HPC scatter gather (Read corruption on 
+ *		        multiple disks)
+ *		      - Cleanup wback cache handling
  * 
  * (In all truth, Jed Schimmel wrote all this code.)
  *
- * $Id: sgiwd93.c,v 1.19 2000/02/04 07:40:47 ralf Exp $
  */
 #include <linux/init.h>
 #include <linux/types.h>
@@ -36,32 +39,13 @@
 
 struct hpc_chunk {
 	struct hpc_dma_desc desc;
-	unsigned long padding;
+	u32 _padding;	/* align to quadword boundary */
 };
 
 struct Scsi_Host *sgiwd93_host = NULL;
 struct Scsi_Host *sgiwd93_host1 = NULL;
 
 /* Wuff wuff, wuff, wd33c93.c, wuff wuff, object oriented, bow wow. */
-static inline void write_wd33c93_count(const wd33c93_regs regs,
-				       unsigned long value)
-{
-	*regs.SASR = WD_TRANSFER_COUNT_MSB;
-	*regs.SCMD = ((value >> 16) & 0xff);
-	*regs.SCMD = ((value >>  8) & 0xff);
-	*regs.SCMD = ((value >>  0) & 0xff);
-}
-
-static inline unsigned long read_wd33c93_count(const wd33c93_regs regs)
-{
-	unsigned long value;
-
-	*regs.SASR = WD_TRANSFER_COUNT_MSB;
-	value =  (*regs.SCMD << 16);
-	value |= (*regs.SCMD <<  8);
-	value |= (*regs.SCMD <<  0);
-	return value;
-}
 
 /* XXX woof! */
 static void sgiwd93_intr(int irq, void *dev_id, struct pt_regs *regs)
@@ -82,7 +66,6 @@
 	unsigned long physaddr;
 	unsigned long count;
 	
-	dma_cache_wback_inv((unsigned long)addr,len);
 	physaddr = PHYSADDR(addr);
 	while (len) {
 		/*
@@ -101,7 +84,6 @@
 static int dma_setup(Scsi_Cmnd *cmd, int datainp)
 {
 	struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)cmd->host->hostdata;
-	const wd33c93_regs regs = hdata->regs;
 	struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->host->base;
 	struct hpc_chunk *hcp = (struct hpc_chunk *) hdata->dma_bounce_buffer;
 
@@ -112,46 +94,17 @@
 
 	hdata->dma_dir = datainp;
 
-	if(cmd->SCp.buffers_residual) {
-		struct scatterlist *slp = cmd->SCp.buffer;
-		int i, totlen = 0;
+	/*
+	 * wd33c93 shouldn't pass us bogus dma_setups, but
+	 * it does:-( The other wd33c93 drivers deal with
+	 * it the same way (which isn't that obvious).
+	 * IMHO a better fix would be, not to do these
+	 * dma setups in the first place
+	 */
+	if (cmd->SCp.ptr == NULL)
+		return 1;
 
-#ifdef DEBUG_DMA
-		printk("SCLIST<");
-#endif
-		for(i = 0; i <= cmd->SCp.buffers_residual; i++) {
-#ifdef DEBUG_DMA
-			printk("[%p,%d]",
-			       page_address(slp[i].page) + slp[i].offset,
-			       slp[i].length);
-#endif
-			fill_hpc_entries (&hcp,
-					  page_address(slp[i].page) + slp[i].offset,
-					  slp[i].length);
-			totlen += slp[i].length;
-		}
-#ifdef DEBUG_DMA
-		printk(">tlen<%d>", totlen);
-#endif
-		hdata->dma_bounce_len = totlen; /* a trick... */
-		write_wd33c93_count(regs, totlen);
-	} else {
-		/* Non-scattered dma. */
-#ifdef DEBUG_DMA
-		printk("ONEBUF<%p,%d>", cmd->SCp.ptr, cmd->SCp.this_residual);
-#endif
-		/*
-		 * wd33c93 shouldn't pass us bogus dma_setups, but
-		 * it does:-( The other wd33c93 drivers deal with
-		 * it the same way (which isn't that obvious).
-		 * IMHO a better fix would be, not to do these
-		 * dma setups in the first place
-		 */
-		if (cmd->SCp.ptr == NULL)
-			return 1;
-		fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual);
-		write_wd33c93_count(regs, cmd->SCp.this_residual);
-	}
+	fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual);
 
 	/* To make sure, if we trip an HPC bug, that we transfer
 	 * every single byte, we tag on an extra zero length dma
@@ -166,10 +119,14 @@
 
 	/* Start up the HPC. */
 	hregs->ndptr = PHYSADDR(hdata->dma_bounce_buffer);
-	if(datainp)
+	if(datainp) {
+		dma_cache_inv((unsigned long) cmd->SCp.ptr, cmd->SCp.this_residual);
 		hregs->ctrl = (HPC3_SCTRL_ACTIVE);
-	else
+	} else {
+		dma_cache_wback_inv((unsigned long) cmd->SCp.ptr, cmd->SCp.this_residual);
 		hregs->ctrl = (HPC3_SCTRL_ACTIVE | HPC3_SCTRL_DIR);
+	}
+
 	return 0;
 }
 
@@ -177,7 +134,6 @@
 		     int status)
 {
 	struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)instance->hostdata;
-	const wd33c93_regs regs = hdata->regs;
 	struct hpc3_scsiregs *hregs;
 
 	if (!SCpnt)
@@ -197,44 +153,6 @@
 	}
 	hregs->ctrl = 0;
 
-	/* See how far we got and update scatterlist state if necessary. */
-	if(SCpnt->SCp.buffers_residual) {
-		struct scatterlist *slp = SCpnt->SCp.buffer;
-		int totlen, wd93_residual, transferred, i;
-
-		/* Yep, we were doing the scatterlist thang. */
-		totlen = hdata->dma_bounce_len;
-		wd93_residual = read_wd33c93_count(regs);
-		transferred = totlen - wd93_residual;
-
-#ifdef DEBUG_DMA
-		printk("tlen<%d>resid<%d>transf<%d> ",
-		       totlen, wd93_residual, transferred);
-#endif
-
-		/* Avoid long winded partial-transfer search for common case. */
-		if(transferred != totlen) {
-			/* This is the nut case. */
-#ifdef DEBUG_DMA
-			printk("Jed was here...");
-#endif
-			for(i = 0; i <= SCpnt->SCp.buffers_residual; i++) {
-				if(slp[i].length >= transferred)
-					break;
-				transferred -= slp[i].length;
-			}
-		} else {
-			/* This is the common case. */
-#ifdef DEBUG_DMA
-			printk("did it all...");
-#endif
-			i = SCpnt->SCp.buffers_residual;
-		}
-		SCpnt->SCp.buffer = &slp[i];
-		SCpnt->SCp.buffers_residual = SCpnt->SCp.buffers_residual - i;
-		SCpnt->SCp.ptr = (char *) page_address(slp[i].page) + slp[i].offset;
-		SCpnt->SCp.this_residual = slp[i].length;
-	}
 #ifdef DEBUG_DMA
 	printk("\n");
 #endif
@@ -264,6 +182,9 @@
 	};
 	hcp--;
 	hcp->desc.pnext = PHYSADDR(buf);
+
+	/* Force flush to memory */
+	dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
 }
 
 int __init sgiwd93_detect(Scsi_Host_Template *SGIblows)
@@ -273,8 +194,8 @@
 	struct hpc3_scsiregs *hregs1 = &hpc3c0->scsi_chan1;
 	struct WD33C93_hostdata *hdata;
 	struct WD33C93_hostdata *hdata1;
-	uchar *buf;
 	wd33c93_regs regs;
+	uchar *buf;
 	
 	if(called)
 		return 0; /* Should bitch on the console about this... */
@@ -294,10 +215,10 @@
 		return 0;
 	}
 	init_hpc_chain(buf);
-	dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
+	
 	/* HPC_SCSI_REG0 | 0x03 | KSEG1 */
-	regs.SASR = (volatile unsigned char *)KSEG1ADDR (0x1fbc0003);
-	regs.SCMD = (volatile unsigned char *)KSEG1ADDR (0x1fbc0007);
+	regs.SASR = (unsigned char*) KSEG1ADDR (0x1fbc0003);
+	regs.SCMD = (unsigned char*) KSEG1ADDR (0x1fbc0007);
 	wd33c93_init(sgiwd93_host, regs, dma_setup, dma_stop, WD33C93_FS_16_20);
 
 	hdata = (struct WD33C93_hostdata *)sgiwd93_host->hostdata;
@@ -329,17 +250,16 @@
 				return 1; /* We registered host0 so return success*/
 			}
 			init_hpc_chain(buf);
-			dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
+
 			/* HPC_SCSI_REG1 | 0x03 | KSEG1 */
-			regs.SASR = (volatile unsigned char *)KSEG1ADDR (0x1fbc8003);
-			regs.SCMD = (volatile unsigned char *)KSEG1ADDR (0x1fbc8007);
+			regs.SASR = (unsigned char*) KSEG1ADDR(0x1fbc8003);
+			regs.SCMD = (unsigned char*) KSEG1ADDR(0x1fbc8007);
 			wd33c93_init(sgiwd93_host1, regs, dma_setup, dma_stop,
-				     WD33C93_FS_16_20);
+			             WD33C93_FS_16_20);
 	
 			hdata1 = (struct WD33C93_hostdata *)sgiwd93_host1->hostdata;
 			hdata1->no_sync = 0;
 			hdata1->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf));
-			dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
 	
 			if (request_irq(SGI_WD93_1_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host1)) {
 				printk(KERN_WARNING "sgiwd93: Could not allocate irq %d (for host1).\n", SGI_WD93_1_IRQ);
diff -urN linux-2.5.63-bk2/drivers/scsi/sun3_NCR5380.c linux-2.5.63-bk3/drivers/scsi/sun3_NCR5380.c
--- linux-2.5.63-bk2/drivers/scsi/sun3_NCR5380.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/sun3_NCR5380.c	Mon Mar 31 12:17:16 2003
@@ -2564,7 +2564,7 @@
     msg[0] = NCR5380_read(CURRENT_SCSI_DATA_REG);
 #endif
 
-    if (!msg[0] & 0x80) {
+    if (!(msg[0] & 0x80)) {
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
 	print_msg(msg);
 	do_abort(instance);
diff -urN linux-2.5.63-bk2/drivers/scsi/sun3_scsi.c linux-2.5.63-bk3/drivers/scsi/sun3_scsi.c
--- linux-2.5.63-bk2/drivers/scsi/sun3_scsi.c	Mon Feb 24 11:05:06 2003
+++ linux-2.5.63-bk3/drivers/scsi/sun3_scsi.c	Mon Mar 31 12:17:16 2003
@@ -543,7 +543,7 @@
 #if 1
 	// check to empty the fifo on a read
 	if(!write_flag) {
-		int tmo = 200000; /* 2 sec */
+		int tmo = 20000; /* .2 sec */
 		
 		while(1) {
 			if(dregs->csr & CSR_FIFO_EMPTY)
diff -urN linux-2.5.63-bk2/drivers/scsi/sym53c416.c linux-2.5.63-bk3/drivers/scsi/sym53c416.c
--- linux-2.5.63-bk2/drivers/scsi/sym53c416.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/sym53c416.c	Mon Mar 31 12:17:16 2003
@@ -679,7 +679,7 @@
 				printk(KERN_WARNING "sym53c416: unable to attach PnP device.\n");
 				continue;
 			}
-			if(pnp_activate_dev(idev)<0)
+			if(pnp_activate_dev(idev) < 0)
 			{
 				printk(KERN_WARNING "sym53c416: unable to activate PnP device.\n");
 				pnp_device_detach(idev);
diff -urN linux-2.5.63-bk2/drivers/scsi/sym53c8xx.c linux-2.5.63-bk3/drivers/scsi/sym53c8xx.c
--- linux-2.5.63-bk2/drivers/scsi/sym53c8xx.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/drivers/scsi/sym53c8xx.c	Mon Mar 31 12:17:16 2003
@@ -6984,7 +6984,7 @@
 			INW (nc_sist);
 		}
 		else if (istat & DIP) {
-			if (INB (nc_dstat) & ABRT);
+			if (INB (nc_dstat) & ABRT)
 				break;
 		}
 		UDELAY(5);
diff -urN linux-2.5.63-bk2/drivers/scsi/sym53c8xx_2/sym_glue.c linux-2.5.63-bk3/drivers/scsi/sym53c8xx_2/sym_glue.c
--- linux-2.5.63-bk2/drivers/scsi/sym53c8xx_2/sym_glue.c	Mon Feb 24 11:06:03 2003
+++ linux-2.5.63-bk3/drivers/scsi/sym53c8xx_2/sym_glue.c	Mon Mar 31 12:17:16 2003
@@ -125,7 +125,7 @@
  *
  *  The whole SCSI sub-system under Linux is basically single-threaded.
  *  Everything, including low-level driver interrupt routine, happens 
- *  whith the `io_request_lock' held.
+ *  with the `io_request_lock' held.
  *  The sym53c8xx-1.x drivers series ran their interrupt code using a 
  *  spin mutex per controller. This added complexity without improving 
  *  scalability significantly. the sym-2 driver still use a spinlock 
diff -urN linux-2.5.63-bk2/drivers/scsi/sym53c8xx_2/sym_hipd.c linux-2.5.63-bk3/drivers/scsi/sym53c8xx_2/sym_hipd.c
--- linux-2.5.63-bk2/drivers/scsi/sym53c8xx_2/sym_hipd.c	Mon Feb 24 11:05:04 2003
+++ linux-2.5.63-bk3/drivers/scsi/sym53c8xx_2/sym_hipd.c	Mon Mar 31 12:17:16 2003
@@ -234,7 +234,7 @@
 			INW (nc_sist);
 		}
 		else if (istat & DIP) {
-			if (INB (nc_dstat) & ABRT);
+			if (INB (nc_dstat) & ABRT)
 				break;
 		}
 		UDELAY(5);
diff -urN linux-2.5.63-bk2/drivers/scsi/wd33c93.c linux-2.5.63-bk3/drivers/scsi/wd33c93.c
--- linux-2.5.63-bk2/drivers/scsi/wd33c93.c	Mon Feb 24 11:05:37 2003
+++ linux-2.5.63-bk3/drivers/scsi/wd33c93.c	Mon Mar 31 12:17:16 2003
@@ -1,7 +1,4 @@
 /*
- *    wd33c93.c - Linux-68k device driver for the Commodore
- *                Amiga A2091/590 SCSI controller card
- *
  * Copyright (c) 1996 John Shifflett, GeoLog Consulting
  *    john@geolog.com
  *    jshiffle@netcom.com
@@ -15,8 +12,9 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- *
+ */
+
+/*
  * Drew Eckhardt's excellent 'Generic NCR5380' sources from Linux-PC
  * provided much of the inspiration and some of the code for this
  * driver. Everything I know about Amiga DMA was gleaned from careful
@@ -76,38 +74,26 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
-#include <asm/system.h>
 #include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/delay.h>
 #include <linux/version.h>
 #include <linux/init.h>
-#include <asm/irq.h>
 #include <linux/blk.h>
+#include <asm/irq.h>
 
 #include "scsi.h"
 #include "hosts.h"
 
-
-#define WD33C93_VERSION    "1.25"
-#define WD33C93_DATE       "09/Jul/1997"
-/* NOTE: 1.25 for m68k is related to in2000-1.31 for x86 */
-
-/*
- * Note - the following defines have been moved to 'wd33c93.h':
- *
- *    PROC_INTERFACE
- *    PROC_STATISTICS
- *    SYNC_DEBUG
- *    DEBUGGING_ON
- *    DEBUG_DEFAULTS
- *
- */
-
-
 #include "wd33c93.h"
 
 
+#define WD33C93_VERSION    "1.26"
+#define WD33C93_DATE       "22/Feb/2003"
+
+MODULE_AUTHOR("John Shifflett");
+MODULE_DESCRIPTION("Generic WD33C93 SCSI driver");
+MODULE_LICENSE("GPL");
 
 /*
  * 'setup_strings' is a single string used to pass operating parameters and
@@ -163,172 +149,223 @@
  */
 
 /* Normally, no defaults are specified */
-static char *setup_args[] =
-      {"","","","","","","","",""};
-
-/* filled in by 'insmod' */
-static char *setup_strings = 0;
+static char *setup_args[] = { "", "", "", "", "", "", "", "", "" };
 
-#ifdef MODULE_PARM
+static char *setup_strings;
 MODULE_PARM(setup_strings, "s");
-#endif
-
 
+static void wd33c93_execute(struct Scsi_Host *instance);
 
-static inline uchar read_wd33c93(const wd33c93_regs regs, uchar reg_num)
+#ifdef CONFIG_WD33C93_PIO
+static inline uchar
+read_wd33c93(const wd33c93_regs regs, uchar reg_num)
 {
-   *regs.SASR = reg_num;
-   mb();
-   return(*regs.SCMD);
+	uchar data;
+
+	outb(reg_num, *regs.SASR);
+	data = inb(*regs.SCMD);
+	return data;
 }
 
+static inline unsigned long
+read_wd33c93_count(const wd33c93_regs regs)
+{
+	unsigned long value;
 
-#define READ_AUX_STAT() (*regs.SASR)
+	outb(WD_TRANSFER_COUNT_MSB, *regs.SASR);
+	value = inb(*regs.SCMD) << 16;
+	value |= inb(*regs.SCMD) << 8;
+	value |= inb(*regs.SCMD);
+	return value;
+}
 
+static inline uchar
+read_aux_stat(const wd33c93_regs regs)
+{
+	return inb(*regs.SASR);
+}
+
+static inline void
+write_wd33c93(const wd33c93_regs regs, uchar reg_num, uchar value)
+{
+      outb(reg_num, *regs.SASR);
+      outb(value, *regs.SCMD);
+}
 
-static inline void write_wd33c93(const wd33c93_regs regs, uchar reg_num,
-				 uchar value)
+static inline void
+write_wd33c93_count(const wd33c93_regs regs, unsigned long value)
 {
-   *regs.SASR = reg_num;
-   mb();
-   *regs.SCMD = value;
-   mb();
+	outb(WD_TRANSFER_COUNT_MSB, *regs.SASR);
+	outb((value >> 16) & 0xff, *regs.SCMD);
+	outb((value >> 8) & 0xff, *regs.SCMD);
+	outb( value & 0xff, *regs.SCMD);
 }
 
+#define write_wd33c93_cmd(regs, cmd) \
+	write_wd33c93((regs), WD_COMMAND, (cmd))
 
-static inline void write_wd33c93_cmd(const wd33c93_regs regs, uchar cmd)
+static inline void
+write_wd33c93_cdb(const wd33c93_regs regs, uint len, uchar cmnd[])
 {
-   *regs.SASR = WD_COMMAND;
-   mb();
-   *regs.SCMD = cmd;
-   mb();
+	int i;
+
+	outb(WD_CDB_1, *regs.SASR);
+	for (i=0; i<len; i++)
+		outb(cmnd[i], *regs.SCMD);
 }
 
+#else /* CONFIG_WD33C93_PIO */
+static inline uchar
+read_wd33c93(const wd33c93_regs regs, uchar reg_num)
+{
+	*regs.SASR = reg_num;
+	mb();
+	return (*regs.SCMD);
+}
 
-static inline uchar read_1_byte(const wd33c93_regs regs)
+static unsigned long
+read_wd33c93_count(const wd33c93_regs regs)
 {
-uchar asr;
-uchar x = 0;
+	unsigned long value;
 
-   write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
-   write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO|0x80);
-   do {
-      asr = READ_AUX_STAT();
-      if (asr & ASR_DBR)
-         x = read_wd33c93(regs, WD_DATA);
-      } while (!(asr & ASR_INT));
-   return x;
+	*regs.SASR = WD_TRANSFER_COUNT_MSB;
+	mb();
+	value = *regs.SCMD << 16;
+	value |= *regs.SCMD << 8;
+	value |= *regs.SCMD;
+	mb();
+	return value;
 }
 
+static inline uchar
+read_aux_stat(const wd33c93_regs regs)
+{
+	return *regs.SASR;
+}
 
-static void write_wd33c93_count(const wd33c93_regs regs, unsigned long value)
+static inline void
+write_wd33c93(const wd33c93_regs regs, uchar reg_num, uchar value)
 {
-   *regs.SASR = WD_TRANSFER_COUNT_MSB;
-   mb();
-   *regs.SCMD = value >> 16;
-   *regs.SCMD = value >> 8;
-   *regs.SCMD = value;
-   mb();
+	*regs.SASR = reg_num;
+	mb();
+	*regs.SCMD = value;
+	mb();
 }
 
+static void
+write_wd33c93_count(const wd33c93_regs regs, unsigned long value)
+{
+	*regs.SASR = WD_TRANSFER_COUNT_MSB;
+	mb();
+	*regs.SCMD = value >> 16;
+	*regs.SCMD = value >> 8;
+	*regs.SCMD = value;
+	mb();
+}
 
-static unsigned long read_wd33c93_count(const wd33c93_regs regs)
+static inline void
+write_wd33c93_cmd(const wd33c93_regs regs, uchar cmd)
 {
-unsigned long value;
+	*regs.SASR = WD_COMMAND;
+	mb();
+	*regs.SCMD = cmd;
+	mb();
+}
+
+static inline void
+write_wd33c93_cdb(const wd33c93_regs regs, uint len, uchar cmnd[])
+{
+	int i;
 
-   *regs.SASR = WD_TRANSFER_COUNT_MSB;
-   mb();
-   value = *regs.SCMD << 16;
-   value |= *regs.SCMD << 8;
-   value |= *regs.SCMD;
-   mb();
-   return value;
+	*regs.SASR = WD_CDB_1;
+	for (i = 0; i < len; i++)
+		*regs.SCMD = cmnd[i];
 }
+#endif /* CONFIG_WD33C93_PIO */
 
+static inline uchar
+read_1_byte(const wd33c93_regs regs)
+{
+	uchar asr;
+	uchar x = 0;
+
+	write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
+	write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO | 0x80);
+	do {
+		asr = read_aux_stat(regs);
+		if (asr & ASR_DBR)
+			x = read_wd33c93(regs, WD_DATA);
+	} while (!(asr & ASR_INT));
+	return x;
+}
 
 /* The 33c93 needs to be told which direction a command transfers its
  * data; we use this function to figure it out. Returns true if there
  * will be a DATA_OUT phase with this command, false otherwise.
  * (Thanks to Joerg Dorchain for the research and suggestion.)
  */
-static int is_dir_out(Scsi_Cmnd *cmd)
+static inline int
+is_dir_out(Scsi_Cmnd * cmd)
 {
-   switch (cmd->cmnd[0]) {
-      case WRITE_6:           case WRITE_10:          case WRITE_12:
-      case WRITE_LONG:        case WRITE_SAME:        case WRITE_BUFFER:
-      case WRITE_VERIFY:      case WRITE_VERIFY_12:      
-      case COMPARE:           case COPY:              case COPY_VERIFY:
-      case SEARCH_EQUAL:      case SEARCH_HIGH:       case SEARCH_LOW:
-      case SEARCH_EQUAL_12:   case SEARCH_HIGH_12:    case SEARCH_LOW_12:      
-      case FORMAT_UNIT:       case REASSIGN_BLOCKS:   case RESERVE:
-      case MODE_SELECT:       case MODE_SELECT_10:    case LOG_SELECT:
-      case SEND_DIAGNOSTIC:   case CHANGE_DEFINITION: case UPDATE_BLOCK:
-      case SET_WINDOW:        case MEDIUM_SCAN:       case SEND_VOLUME_TAG:
-      case 0xea:
-         return 1;
-      default:
-         return 0;
-      }
+	return cmd->sc_data_direction == SCSI_DATA_WRITE;
 }
 
+static struct sx_period sx_table[] = {
+	{1, 0x20},
+	{252, 0x20},
+	{376, 0x30},
+	{500, 0x40},
+	{624, 0x50},
+	{752, 0x60},
+	{876, 0x70},
+	{1000, 0x00},
+	{0, 0}
+};
 
+static int
+round_period(unsigned int period)
+{
+	int x;
 
-static struct sx_period sx_table[] = {
-   {  1, 0x20},
-   {252, 0x20},
-   {376, 0x30},
-   {500, 0x40},
-   {624, 0x50},
-   {752, 0x60},
-   {876, 0x70},
-   {1000,0x00},
-   {0,   0} };
-
-static int round_period(unsigned int period)
-{
-int x;
-
-   for (x=1; sx_table[x].period_ns; x++) {
-      if ((period <= sx_table[x-0].period_ns) &&
-          (period >  sx_table[x-1].period_ns)) {
-         return x;
-         }
-      }
-   return 7;
-}
-
-static uchar calc_sync_xfer(unsigned int period, unsigned int offset)
-{
-uchar result;
-
-   period *= 4;   /* convert SDTR code to ns */
-   result = sx_table[round_period(period)].reg_value;
-   result |= (offset < OPTIMUM_SX_OFF)?offset:OPTIMUM_SX_OFF;
-   return result;
+	for (x = 1; sx_table[x].period_ns; x++) {
+		if ((period <= sx_table[x - 0].period_ns) &&
+		    (period > sx_table[x - 1].period_ns)) {
+			return x;
+		}
+	}
+	return 7;
 }
 
+static uchar
+calc_sync_xfer(unsigned int period, unsigned int offset)
+{
+	uchar result;
 
+	period *= 4;		/* convert SDTR code to ns */
+	result = sx_table[round_period(period)].reg_value;
+	result |= (offset < OPTIMUM_SX_OFF) ? offset : OPTIMUM_SX_OFF;
+	return result;
+}
 
-static void wd33c93_execute(struct Scsi_Host *instance);
-
-int wd33c93_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
+int
+wd33c93_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
 {
-   struct WD33C93_hostdata *hostdata;
-   Scsi_Cmnd *tmp;
+	struct WD33C93_hostdata *hostdata;
+	Scsi_Cmnd *tmp;
 
-   hostdata = (struct WD33C93_hostdata *)cmd->host->hostdata;
+	hostdata = (struct WD33C93_hostdata *) cmd->device->host->hostdata;
 
-DB(DB_QUEUE_COMMAND,printk("Q-%d-%02x-%ld( ",cmd->target,cmd->cmnd[0],cmd->pid))
+	DB(DB_QUEUE_COMMAND,
+	   printk("Q-%d-%02x-%ld( ", cmd->device->id, cmd->cmnd[0], cmd->pid))
 
 /* Set up a few fields in the Scsi_Cmnd structure for our own use:
  *  - host_scribble is the pointer to the next cmd in the input queue
  *  - scsi_done points to the routine we call when a cmd is finished
  *  - result is what you'd expect
  */
-
-   cmd->host_scribble = NULL;
-   cmd->scsi_done = done;
-   cmd->result = 0;
+	cmd->host_scribble = NULL;
+	cmd->scsi_done = done;
+	cmd->result = 0;
 
 /* We use the Scsi_Pointer structure that's included with each command
  * as a scratchpad (as it's intended to be used!). The handy thing about
@@ -345,19 +382,18 @@
  *  - SCp.phase records this command's SRCID_ER bit setting
  */
 
-   if (cmd->use_sg) {
-      cmd->SCp.buffer = (struct scatterlist *)cmd->buffer;
-      cmd->SCp.buffers_residual = cmd->use_sg - 1;
-      cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
-		     cmd->SCp.buffer->offset;
-      cmd->SCp.this_residual = cmd->SCp.buffer->length;
-      }
-   else {
-      cmd->SCp.buffer = NULL;
-      cmd->SCp.buffers_residual = 0;
-      cmd->SCp.ptr = (char *)cmd->request_buffer;
-      cmd->SCp.this_residual = cmd->request_bufflen;
-      }
+	if (cmd->use_sg) {
+		cmd->SCp.buffer = (struct scatterlist *) cmd->buffer;
+		cmd->SCp.buffers_residual = cmd->use_sg - 1;
+		cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) +
+		    cmd->SCp.buffer->offset;
+		cmd->SCp.this_residual = cmd->SCp.buffer->length;
+	} else {
+		cmd->SCp.buffer = NULL;
+		cmd->SCp.buffers_residual = 0;
+		cmd->SCp.ptr = (char *) cmd->request_buffer;
+		cmd->SCp.this_residual = cmd->request_bufflen;
+	}
 
 /* WD docs state that at the conclusion of a "LEVEL2" command, the
  * status byte can be retrieved from the LUN register. Apparently,
@@ -376,41 +412,37 @@
  * status byte is stored.
  */
 
-   cmd->SCp.Status = ILLEGAL_STATUS_BYTE;
+	cmd->SCp.Status = ILLEGAL_STATUS_BYTE;
 
-   /*
-    * Add the cmd to the end of 'input_Q'. Note that REQUEST SENSE
-    * commands are added to the head of the queue so that the desired
-    * sense data is not lost before REQUEST_SENSE executes.
-    */
-
-   spin_lock_irq(&hostdata->lock);
-
-   if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) {
-      cmd->host_scribble = (uchar *)hostdata->input_Q;
-      hostdata->input_Q = cmd;
-      }
-   else {   /* find the end of the queue */
-      for (tmp=(Scsi_Cmnd *)hostdata->input_Q; tmp->host_scribble;
-            tmp=(Scsi_Cmnd *)tmp->host_scribble)
-         ;
-      tmp->host_scribble = (uchar *)cmd;
-      }
+	/*
+	 * Add the cmd to the end of 'input_Q'. Note that REQUEST SENSE
+	 * commands are added to the head of the queue so that the desired
+	 * sense data is not lost before REQUEST_SENSE executes.
+	 */
+
+	spin_lock_irq(&hostdata->lock);
+
+	if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) {
+		cmd->host_scribble = (uchar *) hostdata->input_Q;
+		hostdata->input_Q = cmd;
+	} else {		/* find the end of the queue */
+		for (tmp = (Scsi_Cmnd *) hostdata->input_Q; tmp->host_scribble;
+		     tmp = (Scsi_Cmnd *) tmp->host_scribble) ;
+		tmp->host_scribble = (uchar *) cmd;
+	}
 
 /* We know that there's at least one command in 'input_Q' now.
  * Go see if any of them are runnable!
  */
 
-   wd33c93_execute(cmd->host);
+	wd33c93_execute(cmd->device->host);
 
-DB(DB_QUEUE_COMMAND,printk(")Q-%ld ",cmd->pid))
+	DB(DB_QUEUE_COMMAND, printk(")Q-%ld ", cmd->pid))
 
-   spin_unlock_irq(&hostdata->lock);
-   return 0;
+	spin_unlock_irq(&hostdata->lock);
+	return 0;
 }
 
-
-
 /*
  * This routine attempts to start a scsi command. If the host_card is
  * already connected, we give up immediately. Otherwise, look through
@@ -421,64 +453,60 @@
  * the wd33c93_intr itself, which means that a wd33c93 interrupt
  * cannot occur while we are in here.
  */
-static void wd33c93_execute (struct Scsi_Host *instance)
+static void
+wd33c93_execute(struct Scsi_Host *instance)
 {
-struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *)instance->hostdata;
-const wd33c93_regs regs = hostdata->regs;
-Scsi_Cmnd *cmd, *prev;
-int i;
-
-DB(DB_EXECUTE,printk("EX("))
-
-   if (hostdata->selecting || hostdata->connected) {
-
-DB(DB_EXECUTE,printk(")EX-0 "))
-
-      return;
-      }
-
-    /*
-     * Search through the input_Q for a command destined
-     * for an idle target/lun.
-     */
-
-   cmd = (Scsi_Cmnd *)hostdata->input_Q;
-   prev = 0;
-   while (cmd) {
-      if (!(hostdata->busy[cmd->target] & (1 << cmd->lun)))
-         break;
-      prev = cmd;
-      cmd = (Scsi_Cmnd *)cmd->host_scribble;
-      }
-
-   /* quit if queue empty or all possible targets are busy */
-
-   if (!cmd) {
-
-DB(DB_EXECUTE,printk(")EX-1 "))
-
-      return;
-      }
-
-   /*  remove command from queue */
-   
-   if (prev)
-      prev->host_scribble = cmd->host_scribble;
-   else
-      hostdata->input_Q = (Scsi_Cmnd *)cmd->host_scribble;
+	struct WD33C93_hostdata *hostdata =
+	    (struct WD33C93_hostdata *) instance->hostdata;
+	const wd33c93_regs regs = hostdata->regs;
+	Scsi_Cmnd *cmd, *prev;
+
+	DB(DB_EXECUTE, printk("EX("))
+	if (hostdata->selecting || hostdata->connected) {
+		DB(DB_EXECUTE, printk(")EX-0 "))
+		return;
+	}
+
+	/*
+	 * Search through the input_Q for a command destined
+	 * for an idle target/lun.
+	 */
+
+	cmd = (Scsi_Cmnd *) hostdata->input_Q;
+	prev = 0;
+	while (cmd) {
+		if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)))
+			break;
+		prev = cmd;
+		cmd = (Scsi_Cmnd *) cmd->host_scribble;
+	}
+
+	/* quit if queue empty or all possible targets are busy */
+
+	if (!cmd) {
+		DB(DB_EXECUTE, printk(")EX-1 "))
+		return;
+	}
+
+	/*  remove command from queue */
+
+	if (prev)
+		prev->host_scribble = cmd->host_scribble;
+	else
+		hostdata->input_Q = (Scsi_Cmnd *) cmd->host_scribble;
 
 #ifdef PROC_STATISTICS
-   hostdata->cmd_cnt[cmd->target]++;
+	hostdata->cmd_cnt[cmd->device->id]++;
 #endif
 
-   /*
-    * Start the selection process
-    */
-
-   if (is_dir_out(cmd))
-      write_wd33c93(regs, WD_DESTINATION_ID, cmd->target);
-   else
-      write_wd33c93(regs, WD_DESTINATION_ID, cmd->target | DSTID_DPD);
+	/*
+	 * Start the selection process
+	 */
+
+	if (is_dir_out(cmd))
+		write_wd33c93(regs, WD_DESTINATION_ID, cmd->device->id);
+	else
+		write_wd33c93(regs, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD);
 
 /* Now we need to figure out whether or not this command is a good
  * candidate for disconnect/reselect. We guess to the best of our
@@ -503,55 +531,58 @@
  * to change around and experiment with for now.
  */
 
-   cmd->SCp.phase = 0;  /* assume no disconnect */
-   if (hostdata->disconnect == DIS_NEVER)
-      goto no;
-   if (hostdata->disconnect == DIS_ALWAYS)
-      goto yes;
-   if (cmd->device->type == 1)   /* tape drive? */
-      goto yes;
-   if (hostdata->disconnected_Q) /* other commands disconnected? */
-      goto yes;
-   if (!(hostdata->input_Q))     /* input_Q empty? */
-      goto no;
-   for (prev=(Scsi_Cmnd *)hostdata->input_Q; prev;
-         prev=(Scsi_Cmnd *)prev->host_scribble) {
-      if ((prev->target != cmd->target) || (prev->lun != cmd->lun)) {
-         for (prev=(Scsi_Cmnd *)hostdata->input_Q; prev;
-               prev=(Scsi_Cmnd *)prev->host_scribble)
-            prev->SCp.phase = 1;
-         goto yes;
-         }
-      }
-   goto no;
+	cmd->SCp.phase = 0;	/* assume no disconnect */
+	if (hostdata->disconnect == DIS_NEVER)
+		goto no;
+	if (hostdata->disconnect == DIS_ALWAYS)
+		goto yes;
+	if (cmd->device->type == 1)	/* tape drive? */
+		goto yes;
+	if (hostdata->disconnected_Q)	/* other commands disconnected? */
+		goto yes;
+	if (!(hostdata->input_Q))	/* input_Q empty? */
+		goto no;
+	for (prev = (Scsi_Cmnd *) hostdata->input_Q; prev;
+	     prev = (Scsi_Cmnd *) prev->host_scribble) {
+		if ((prev->device->id != cmd->device->id) ||
+		    (prev->device->lun != cmd->device->lun)) {
+			for (prev = (Scsi_Cmnd *) hostdata->input_Q; prev;
+			     prev = (Scsi_Cmnd *) prev->host_scribble)
+				prev->SCp.phase = 1;
+			goto yes;
+		}
+	}
 
-yes:
-   cmd->SCp.phase = 1;
+	goto no;
+
+ yes:
+	cmd->SCp.phase = 1;
 
 #ifdef PROC_STATISTICS
-   hostdata->disc_allowed_cnt[cmd->target]++;
+	hostdata->disc_allowed_cnt[cmd->device->id]++;
 #endif
 
-no:
+ no:
 
-   write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase)?SRCID_ER:0));
+	write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0));
 
-   write_wd33c93(regs, WD_TARGET_LUN, cmd->lun);
-   write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]);
-   hostdata->busy[cmd->target] |= (1 << cmd->lun);
-
-   if ((hostdata->level2 == L2_NONE) ||
-       (hostdata->sync_stat[cmd->target] == SS_UNSET)) {
-
-         /*
-          * Do a 'Select-With-ATN' command. This will end with
-          * one of the following interrupts:
-          *    CSR_RESEL_AM:  failure - can try again later.
-          *    CSR_TIMEOUT:   failure - give up.
-          *    CSR_SELECT:    success - proceed.
-          */
+	write_wd33c93(regs, WD_TARGET_LUN, cmd->device->lun);
+	write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,
+		      hostdata->sync_xfer[cmd->device->id]);
+	hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
+
+	if ((hostdata->level2 == L2_NONE) ||
+	    (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) {
+
+		/*
+		 * Do a 'Select-With-ATN' command. This will end with
+		 * one of the following interrupts:
+		 *    CSR_RESEL_AM:  failure - can try again later.
+		 *    CSR_TIMEOUT:   failure - give up.
+		 *    CSR_SELECT:    success - proceed.
+		 */
 
-      hostdata->selecting = cmd;
+		hostdata->selecting = cmd;
 
 /* Every target has its own synchronous transfer setting, kept in the
  * sync_xfer array, and a corresponding status byte in sync_stat[].
@@ -565,119 +596,115 @@
  * later, but at that time we'll negotiate for async by specifying a
  * sync fifo depth of 0.
  */
-      if (hostdata->sync_stat[cmd->target] == SS_UNSET)
-            hostdata->sync_stat[cmd->target] = SS_FIRST;
-      hostdata->state = S_SELECTING;
-      write_wd33c93_count(regs, 0); /* guarantee a DATA_PHASE interrupt */
-      write_wd33c93_cmd(regs, WD_CMD_SEL_ATN);
-      }
-
-   else {
-
-         /*
-          * Do a 'Select-With-ATN-Xfer' command. This will end with
-          * one of the following interrupts:
-          *    CSR_RESEL_AM:  failure - can try again later.
-          *    CSR_TIMEOUT:   failure - give up.
-          *    anything else: success - proceed.
-          */
-
-      hostdata->connected = cmd;
-      write_wd33c93(regs, WD_COMMAND_PHASE, 0);
-
-   /* copy command_descriptor_block into WD chip
-    * (take advantage of auto-incrementing)
-    */
-
-      *regs.SASR = WD_CDB_1;
-      for (i=0; i<cmd->cmd_len; i++)
-         *regs.SCMD = cmd->cmnd[i];
-
-   /* The wd33c93 only knows about Group 0, 1, and 5 commands when
-    * it's doing a 'select-and-transfer'. To be safe, we write the
-    * size of the CDB into the OWN_ID register for every case. This
-    * way there won't be problems with vendor-unique, audio, etc.
-    */
-
-      write_wd33c93(regs, WD_OWN_ID, cmd->cmd_len);
-
-   /* When doing a non-disconnect command with DMA, we can save
-    * ourselves a DATA phase interrupt later by setting everything
-    * up ahead of time.
-    */
-
-      if ((cmd->SCp.phase == 0) && (hostdata->no_dma == 0)) {
-         if (hostdata->dma_setup(cmd,
-                     (is_dir_out(cmd))?DATA_OUT_DIR:DATA_IN_DIR))
-            write_wd33c93_count(regs, 0); /* guarantee a DATA_PHASE interrupt */
-         else {
-            write_wd33c93_count(regs, cmd->SCp.this_residual);
-            write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_DMA);
-            hostdata->dma = D_DMA_RUNNING;
-            }
-         }
-      else
-         write_wd33c93_count(regs, 0); /* guarantee a DATA_PHASE interrupt */
-
-      hostdata->state = S_RUNNING_LEVEL2;
-      write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
-      }
-
-   /*
-    * Since the SCSI bus can handle only 1 connection at a time,
-    * we get out of here now. If the selection fails, or when
-    * the command disconnects, we'll come back to this routine
-    * to search the input_Q again...
-    */
-      
-DB(DB_EXECUTE,printk("%s%ld)EX-2 ",(cmd->SCp.phase)?"d:":"",cmd->pid))
-}
-
-
-
-static void transfer_pio(const wd33c93_regs regs, uchar *buf, int cnt,
-			 int data_in_dir, struct WD33C93_hostdata *hostdata)
-{
-uchar asr;
-
-DB(DB_TRANSFER,printk("(%p,%d,%s:",buf,cnt,data_in_dir?"in":"out"))
-
-   write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
-   write_wd33c93_count(regs, cnt);
-   write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO);
-   if (data_in_dir) {
-      do {
-         asr = READ_AUX_STAT();
-         if (asr & ASR_DBR)
-            *buf++ = read_wd33c93(regs, WD_DATA);
-         } while (!(asr & ASR_INT));
-      }
-   else {
-      do {
-         asr = READ_AUX_STAT();
-         if (asr & ASR_DBR)
-            write_wd33c93(regs, WD_DATA, *buf++);
-         } while (!(asr & ASR_INT));
-      }
-
-   /* Note: we are returning with the interrupt UN-cleared.
-   * Since (presumably) an entire I/O operation has
-   * completed, the bus phase is probably different, and
-   * the interrupt routine will discover this when it
-   * responds to the uncleared int.
-   */
+		if (hostdata->sync_stat[cmd->device->id] == SS_UNSET)
+			hostdata->sync_stat[cmd->device->id] = SS_FIRST;
+		hostdata->state = S_SELECTING;
+		write_wd33c93_count(regs, 0);	/* guarantee a DATA_PHASE interrupt */
+		write_wd33c93_cmd(regs, WD_CMD_SEL_ATN);
+	} else {
+
+		/*
+		 * Do a 'Select-With-ATN-Xfer' command. This will end with
+		 * one of the following interrupts:
+		 *    CSR_RESEL_AM:  failure - can try again later.
+		 *    CSR_TIMEOUT:   failure - give up.
+		 *    anything else: success - proceed.
+		 */
+
+		hostdata->connected = cmd;
+		write_wd33c93(regs, WD_COMMAND_PHASE, 0);
+
+		/* copy command_descriptor_block into WD chip
+		 * (take advantage of auto-incrementing)
+		 */
+
+		write_wd33c93_cdb(regs, cmd->cmd_len, cmd->cmnd);
+
+		/* The wd33c93 only knows about Group 0, 1, and 5 commands when
+		 * it's doing a 'select-and-transfer'. To be safe, we write the
+		 * size of the CDB into the OWN_ID register for every case. This
+		 * way there won't be problems with vendor-unique, audio, etc.
+		 */
+
+		write_wd33c93(regs, WD_OWN_ID, cmd->cmd_len);
+
+		/* When doing a non-disconnect command with DMA, we can save
+		 * ourselves a DATA phase interrupt later by setting everything
+		 * up ahead of time.
+		 */
+
+		if ((cmd->SCp.phase == 0) && (hostdata->no_dma == 0)) {
+			if (hostdata->dma_setup(cmd,
+						(is_dir_out(cmd)) ? DATA_OUT_DIR
+						: DATA_IN_DIR))
+				write_wd33c93_count(regs, 0);	/* guarantee a DATA_PHASE interrupt */
+			else {
+				write_wd33c93_count(regs,
+						    cmd->SCp.this_residual);
+				write_wd33c93(regs, WD_CONTROL,
+					      CTRL_IDI | CTRL_EDI | CTRL_DMA);
+				hostdata->dma = D_DMA_RUNNING;
+			}
+		} else
+			write_wd33c93_count(regs, 0);	/* guarantee a DATA_PHASE interrupt */
+
+		hostdata->state = S_RUNNING_LEVEL2;
+		write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
+	}
+
+	/*
+	 * Since the SCSI bus can handle only 1 connection at a time,
+	 * we get out of here now. If the selection fails, or when
+	 * the command disconnects, we'll come back to this routine
+	 * to search the input_Q again...
+	 */
+
+	DB(DB_EXECUTE,
+	   printk("%s%ld)EX-2 ", (cmd->SCp.phase) ? "d:" : "", cmd->pid))
+}
+
+static void
+transfer_pio(const wd33c93_regs regs, uchar * buf, int cnt,
+	     int data_in_dir, struct WD33C93_hostdata *hostdata)
+{
+	uchar asr;
+
+	DB(DB_TRANSFER,
+	   printk("(%p,%d,%s:", buf, cnt, data_in_dir ? "in" : "out"))
+
+	write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
+	write_wd33c93_count(regs, cnt);
+	write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO);
+	if (data_in_dir) {
+		do {
+			asr = read_aux_stat(regs);
+			if (asr & ASR_DBR)
+				*buf++ = read_wd33c93(regs, WD_DATA);
+		} while (!(asr & ASR_INT));
+	} else {
+		do {
+			asr = read_aux_stat(regs);
+			if (asr & ASR_DBR)
+				write_wd33c93(regs, WD_DATA, *buf++);
+		} while (!(asr & ASR_INT));
+	}
+
+	/* Note: we are returning with the interrupt UN-cleared.
+	 * Since (presumably) an entire I/O operation has
+	 * completed, the bus phase is probably different, and
+	 * the interrupt routine will discover this when it
+	 * responds to the uncleared int.
+	 */
 
 }
 
-
-
-static void transfer_bytes(const wd33c93_regs regs, Scsi_Cmnd *cmd,
-			   int data_in_dir)
+static void
+transfer_bytes(const wd33c93_regs regs, Scsi_Cmnd * cmd, int data_in_dir)
 {
-struct WD33C93_hostdata *hostdata;
-unsigned long length;
+	struct WD33C93_hostdata *hostdata;
+	unsigned long length;
 
-   hostdata = (struct WD33C93_hostdata *)cmd->host->hostdata;
+	hostdata = (struct WD33C93_hostdata *) cmd->device->host->hostdata;
 
 /* Normally, you'd expect 'this_residual' to be non-zero here.
  * In a series of scatter-gather transfers, however, this
@@ -687,38 +714,31 @@
  * now we need to setup the next scatter-gather buffer as the
  * source or destination for THIS transfer.
  */
-   if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
-      ++cmd->SCp.buffer;
-      --cmd->SCp.buffers_residual;
-      cmd->SCp.this_residual = cmd->SCp.buffer->length;
-      cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
-		     cmd->SCp.buffer->offset;
-      }
+	if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
+		++cmd->SCp.buffer;
+		--cmd->SCp.buffers_residual;
+		cmd->SCp.this_residual = cmd->SCp.buffer->length;
+		cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) +
+		    cmd->SCp.buffer->offset;
+	}
 
-   write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]);
+	write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,
+		      hostdata->sync_xfer[cmd->device->id]);
 
 /* 'hostdata->no_dma' is TRUE if we don't even want to try DMA.
  * Update 'this_residual' and 'ptr' after 'transfer_pio()' returns.
  */
 
-   if (hostdata->no_dma)
-      goto use_transfer_pio;
-
-/* 'dma_setup()' will return TRUE if we can't do DMA.
- * Update 'this_residual' and 'ptr' after 'transfer_pio()' returns.
- */
-
-   else if (hostdata->dma_setup(cmd, data_in_dir)) {
-use_transfer_pio:
+	if (hostdata->no_dma || hostdata->dma_setup(cmd, data_in_dir)) {
 #ifdef PROC_STATISTICS
-      hostdata->pio_cnt++;
+		hostdata->pio_cnt++;
 #endif
-      transfer_pio(regs, (uchar *)cmd->SCp.ptr, cmd->SCp.this_residual,
-                         data_in_dir, hostdata);
-      length = cmd->SCp.this_residual;
-      cmd->SCp.this_residual = read_wd33c93_count(regs);
-      cmd->SCp.ptr += (length - cmd->SCp.this_residual);
-      }
+		transfer_pio(regs, (uchar *) cmd->SCp.ptr,
+			     cmd->SCp.this_residual, data_in_dir, hostdata);
+		length = cmd->SCp.this_residual;
+		cmd->SCp.this_residual = read_wd33c93_count(regs);
+		cmd->SCp.ptr += (length - cmd->SCp.this_residual);
+	}
 
 /* We are able to do DMA (in fact, the Amiga hardware is
  * already going!), so start up the wd33c93 in DMA mode.
@@ -729,51 +749,50 @@
  * until then.
  */
 
-   else {
+	else {
 #ifdef PROC_STATISTICS
-      hostdata->dma_cnt++;
+		hostdata->dma_cnt++;
 #endif
-      write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_DMA);
-      write_wd33c93_count(regs, cmd->SCp.this_residual);
-
-      if ((hostdata->level2 >= L2_DATA) ||
-          (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) {
-         write_wd33c93(regs, WD_COMMAND_PHASE, 0x45);
-         write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
-         hostdata->state = S_RUNNING_LEVEL2;
-         }
-      else
-         write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO);
+		write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_DMA);
+		write_wd33c93_count(regs, cmd->SCp.this_residual);
 
-      hostdata->dma = D_DMA_RUNNING;
-      }
-}
+		if ((hostdata->level2 >= L2_DATA) ||
+		    (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) {
+			write_wd33c93(regs, WD_COMMAND_PHASE, 0x45);
+			write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
+			hostdata->state = S_RUNNING_LEVEL2;
+		} else
+			write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO);
+
+		hostdata->dma = D_DMA_RUNNING;
+	}
+}
+
+void
+wd33c93_intr(struct Scsi_Host *instance)
+{
+	struct WD33C93_hostdata *hostdata =
+	    (struct WD33C93_hostdata *) instance->hostdata;
+	const wd33c93_regs regs = hostdata->regs;
+	Scsi_Cmnd *patch, *cmd;
+	uchar asr, sr, phs, id, lun, *ucp, msg;
+	unsigned long length, flags;
+
+	asr = read_aux_stat(regs);
+	if (!(asr & ASR_INT) || (asr & ASR_BSY))
+		return;
 
-
-
-void wd33c93_intr (struct Scsi_Host *instance)
-{
-struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *)instance->hostdata;
-const wd33c93_regs regs = hostdata->regs;
-Scsi_Cmnd *patch, *cmd;
-uchar asr, sr, phs, id, lun, *ucp, msg;
-unsigned long length, flags;
-
-   asr = READ_AUX_STAT();
-   if (!(asr & ASR_INT) || (asr & ASR_BSY))
-      return;
-
-   spin_lock_irqsave(&hostdata->lock, flags);
+	spin_lock_irqsave(&hostdata->lock, flags);
 
 #ifdef PROC_STATISTICS
-   hostdata->int_cnt++;
+	hostdata->int_cnt++;
 #endif
 
-   cmd = (Scsi_Cmnd *)hostdata->connected;   /* assume we're connected */
-   sr = read_wd33c93(regs, WD_SCSI_STATUS);  /* clear the interrupt */
-   phs = read_wd33c93(regs, WD_COMMAND_PHASE);
+	cmd = (Scsi_Cmnd *) hostdata->connected;	/* assume we're connected */
+	sr = read_wd33c93(regs, WD_SCSI_STATUS);	/* clear the interrupt */
+	phs = read_wd33c93(regs, WD_COMMAND_PHASE);
 
-DB(DB_INTR,printk("{%02x:%02x-",asr,sr))
+	DB(DB_INTR, printk("{%02x:%02x-", asr, sr))
 
 /* After starting a DMA transfer, the next interrupt
  * is guaranteed to be in response to completion of
@@ -789,76 +808,74 @@
  * whatever is needed, we go on and service the WD3393
  * interrupt normally.
  */
-
-   if (hostdata->dma == D_DMA_RUNNING) {
-DB(DB_TRANSFER,printk("[%p/%d:",cmd->SCp.ptr,cmd->SCp.this_residual))
-      hostdata->dma_stop(cmd->host, cmd, 1);
-      hostdata->dma = D_DMA_OFF;
-      length = cmd->SCp.this_residual;
-      cmd->SCp.this_residual = read_wd33c93_count(regs);
-      cmd->SCp.ptr += (length - cmd->SCp.this_residual);
-DB(DB_TRANSFER,printk("%p/%d]",cmd->SCp.ptr,cmd->SCp.this_residual))
-      }
+	    if (hostdata->dma == D_DMA_RUNNING) {
+		DB(DB_TRANSFER,
+		   printk("[%p/%d:", cmd->SCp.ptr, cmd->SCp.this_residual))
+		    hostdata->dma_stop(cmd->device->host, cmd, 1);
+		hostdata->dma = D_DMA_OFF;
+		length = cmd->SCp.this_residual;
+		cmd->SCp.this_residual = read_wd33c93_count(regs);
+		cmd->SCp.ptr += (length - cmd->SCp.this_residual);
+		DB(DB_TRANSFER,
+		   printk("%p/%d]", cmd->SCp.ptr, cmd->SCp.this_residual))
+	}
 
 /* Respond to the specific WD3393 interrupt - there are quite a few! */
+	switch (sr) {
+	case CSR_TIMEOUT:
+		DB(DB_INTR, printk("TIMEOUT"))
+
+		    if (hostdata->state == S_RUNNING_LEVEL2)
+			hostdata->connected = NULL;
+		else {
+			cmd = (Scsi_Cmnd *) hostdata->selecting;	/* get a valid cmd */
+			hostdata->selecting = NULL;
+		}
+
+		cmd->result = DID_NO_CONNECT << 16;
+		hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+		hostdata->state = S_UNCONNECTED;
+		cmd->scsi_done(cmd);
+
+		/* From esp.c:
+		 * There is a window of time within the scsi_done() path
+		 * of execution where interrupts are turned back on full
+		 * blast and left that way.  During that time we could
+		 * reconnect to a disconnected command, then we'd bomb
+		 * out below.  We could also end up executing two commands
+		 * at _once_.  ...just so you know why the restore_flags()
+		 * is here...
+		 */
 
-   switch (sr) {
-
-      case CSR_TIMEOUT:
-DB(DB_INTR,printk("TIMEOUT"))
-
-         if (hostdata->state == S_RUNNING_LEVEL2)
-            hostdata->connected = NULL;
-         else {
-            cmd = (Scsi_Cmnd *)hostdata->selecting;   /* get a valid cmd */
-            hostdata->selecting = NULL;
-            }
-
-         cmd->result = DID_NO_CONNECT << 16;
-         hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-         hostdata->state = S_UNCONNECTED;
-         cmd->scsi_done(cmd);
-
-    /* From esp.c:
-     * There is a window of time within the scsi_done() path
-     * of execution where interrupts are turned back on full
-     * blast and left that way.  During that time we could
-     * reconnect to a disconnected command, then we'd bomb
-     * out below.  We could also end up executing two commands
-     * at _once_.  ...just so you know why the restore_flags()
-     * is here...
-     */
-
-         spin_unlock_irqrestore(&hostdata->lock, flags);
+		spin_unlock_irqrestore(&hostdata->lock, flags);
 
 /* We are not connected to a target - check to see if there
  * are commands waiting to be executed.
  */
 
-         wd33c93_execute(instance);
-         break;
-
+		wd33c93_execute(instance);
+		break;
 
 /* Note: this interrupt should not occur in a LEVEL2 command */
 
-      case CSR_SELECT:
-
-DB(DB_INTR,printk("SELECT"))
-         hostdata->connected = cmd = (Scsi_Cmnd *)hostdata->selecting;
-         hostdata->selecting = NULL;
+	case CSR_SELECT:
+		DB(DB_INTR, printk("SELECT"))
+		    hostdata->connected = cmd =
+		    (Scsi_Cmnd *) hostdata->selecting;
+		hostdata->selecting = NULL;
+
+		/* construct an IDENTIFY message with correct disconnect bit */
+
+		hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->device->lun);
+		if (cmd->SCp.phase)
+			hostdata->outgoing_msg[0] |= 0x40;
 
-      /* construct an IDENTIFY message with correct disconnect bit */
-
-         hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->lun);
-         if (cmd->SCp.phase)
-            hostdata->outgoing_msg[0] |= 0x40;
-
-         if (hostdata->sync_stat[cmd->target] == SS_FIRST) {
+		if (hostdata->sync_stat[cmd->device->id] == SS_FIRST) {
 #ifdef SYNC_DEBUG
-printk(" sending SDTR ");
+			printk(" sending SDTR ");
 #endif
 
-            hostdata->sync_stat[cmd->target] = SS_WAITING;
+			hostdata->sync_stat[cmd->device->id] = SS_WAITING;
 
 /* Tack on a 2nd message to ask about synchronous transfers. If we've
  * been asked to do only asynchronous transfers on this device, we
@@ -866,158 +883,155 @@
  * solve the problems some people have had with GVP's Guru ROM.
  */
 
-            hostdata->outgoing_msg[1] = EXTENDED_MESSAGE;
-            hostdata->outgoing_msg[2] = 3;
-            hostdata->outgoing_msg[3] = EXTENDED_SDTR;
-            if (hostdata->no_sync & (1 << cmd->target)) {
-               hostdata->outgoing_msg[4] = hostdata->default_sx_per/4;
-               hostdata->outgoing_msg[5] = 0;
-               }
-            else {
-            hostdata->outgoing_msg[4] = OPTIMUM_SX_PER/4;
-            hostdata->outgoing_msg[5] = OPTIMUM_SX_OFF;
-               }
-            hostdata->outgoing_len = 6;
-            }
-         else
-            hostdata->outgoing_len = 1;
-
-         hostdata->state = S_CONNECTED;
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
-
-      case CSR_XFER_DONE|PHS_DATA_IN:
-      case CSR_UNEXP    |PHS_DATA_IN:
-      case CSR_SRV_REQ  |PHS_DATA_IN:
-DB(DB_INTR,printk("IN-%d.%d",cmd->SCp.this_residual,cmd->SCp.buffers_residual))
-         transfer_bytes(regs, cmd, DATA_IN_DIR);
-         if (hostdata->state != S_RUNNING_LEVEL2)
-            hostdata->state = S_CONNECTED;
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
-
-      case CSR_XFER_DONE|PHS_DATA_OUT:
-      case CSR_UNEXP    |PHS_DATA_OUT:
-      case CSR_SRV_REQ  |PHS_DATA_OUT:
-DB(DB_INTR,printk("OUT-%d.%d",cmd->SCp.this_residual,cmd->SCp.buffers_residual))
-         transfer_bytes(regs, cmd, DATA_OUT_DIR);
-         if (hostdata->state != S_RUNNING_LEVEL2)
-            hostdata->state = S_CONNECTED;
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
+			hostdata->outgoing_msg[1] = EXTENDED_MESSAGE;
+			hostdata->outgoing_msg[2] = 3;
+			hostdata->outgoing_msg[3] = EXTENDED_SDTR;
+			if (hostdata->no_sync & (1 << cmd->device->id)) {
+				hostdata->outgoing_msg[4] =
+				    hostdata->default_sx_per / 4;
+				hostdata->outgoing_msg[5] = 0;
+			} else {
+				hostdata->outgoing_msg[4] = OPTIMUM_SX_PER / 4;
+				hostdata->outgoing_msg[5] = OPTIMUM_SX_OFF;
+			}
+			hostdata->outgoing_len = 6;
+		} else
+			hostdata->outgoing_len = 1;
+
+		hostdata->state = S_CONNECTED;
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
+
+	case CSR_XFER_DONE | PHS_DATA_IN:
+	case CSR_UNEXP | PHS_DATA_IN:
+	case CSR_SRV_REQ | PHS_DATA_IN:
+		DB(DB_INTR,
+		   printk("IN-%d.%d", cmd->SCp.this_residual,
+			  cmd->SCp.buffers_residual))
+		    transfer_bytes(regs, cmd, DATA_IN_DIR);
+		if (hostdata->state != S_RUNNING_LEVEL2)
+			hostdata->state = S_CONNECTED;
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
+
+	case CSR_XFER_DONE | PHS_DATA_OUT:
+	case CSR_UNEXP | PHS_DATA_OUT:
+	case CSR_SRV_REQ | PHS_DATA_OUT:
+		DB(DB_INTR,
+		   printk("OUT-%d.%d", cmd->SCp.this_residual,
+			  cmd->SCp.buffers_residual))
+		    transfer_bytes(regs, cmd, DATA_OUT_DIR);
+		if (hostdata->state != S_RUNNING_LEVEL2)
+			hostdata->state = S_CONNECTED;
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
 
 /* Note: this interrupt should not occur in a LEVEL2 command */
 
-      case CSR_XFER_DONE|PHS_COMMAND:
-      case CSR_UNEXP    |PHS_COMMAND:
-      case CSR_SRV_REQ  |PHS_COMMAND:
-DB(DB_INTR,printk("CMND-%02x,%ld",cmd->cmnd[0],cmd->pid))
-         transfer_pio(regs, cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR, hostdata);
-         hostdata->state = S_CONNECTED;
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
-
-      case CSR_XFER_DONE|PHS_STATUS:
-      case CSR_UNEXP    |PHS_STATUS:
-      case CSR_SRV_REQ  |PHS_STATUS:
-DB(DB_INTR,printk("STATUS="))
-
-         cmd->SCp.Status = read_1_byte(regs);
-DB(DB_INTR,printk("%02x",cmd->SCp.Status))
-         if (hostdata->level2 >= L2_BASIC) {
-            sr = read_wd33c93(regs, WD_SCSI_STATUS);  /* clear interrupt */
-            hostdata->state = S_RUNNING_LEVEL2;
-            write_wd33c93(regs, WD_COMMAND_PHASE, 0x50);
-            write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
-            }
-         else {
-            hostdata->state = S_CONNECTED;
-            }
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
-
-      case CSR_XFER_DONE|PHS_MESS_IN:
-      case CSR_UNEXP    |PHS_MESS_IN:
-      case CSR_SRV_REQ  |PHS_MESS_IN:
-DB(DB_INTR,printk("MSG_IN="))
-
-         msg = read_1_byte(regs);
-         sr = read_wd33c93(regs, WD_SCSI_STATUS);  /* clear interrupt */
-
-         hostdata->incoming_msg[hostdata->incoming_ptr] = msg;
-         if (hostdata->incoming_msg[0] == EXTENDED_MESSAGE)
-            msg = EXTENDED_MESSAGE;
-         else
-            hostdata->incoming_ptr = 0;
-
-         cmd->SCp.Message = msg;
-         switch (msg) {
-
-            case COMMAND_COMPLETE:
-DB(DB_INTR,printk("CCMP-%ld",cmd->pid))
-               write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-               hostdata->state = S_PRE_CMP_DISC;
-               break;
-
-            case SAVE_POINTERS:
-DB(DB_INTR,printk("SDP"))
-               write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-               hostdata->state = S_CONNECTED;
-               break;
-
-            case RESTORE_POINTERS:
-DB(DB_INTR,printk("RDP"))
-               if (hostdata->level2 >= L2_BASIC) {
-                  write_wd33c93(regs, WD_COMMAND_PHASE, 0x45);
-                  write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
-                  hostdata->state = S_RUNNING_LEVEL2;
-                  }
-               else {
-                  write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-                  hostdata->state = S_CONNECTED;
-                  }
-               break;
-
-            case DISCONNECT:
-DB(DB_INTR,printk("DIS"))
-               cmd->device->disconnect = 1;
-               write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-               hostdata->state = S_PRE_TMP_DISC;
-               break;
+	case CSR_XFER_DONE | PHS_COMMAND:
+	case CSR_UNEXP | PHS_COMMAND:
+	case CSR_SRV_REQ | PHS_COMMAND:
+		DB(DB_INTR, printk("CMND-%02x,%ld", cmd->cmnd[0], cmd->pid))
+		    transfer_pio(regs, cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR,
+				 hostdata);
+		hostdata->state = S_CONNECTED;
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
+
+	case CSR_XFER_DONE | PHS_STATUS:
+	case CSR_UNEXP | PHS_STATUS:
+	case CSR_SRV_REQ | PHS_STATUS:
+		DB(DB_INTR, printk("STATUS="))
+		cmd->SCp.Status = read_1_byte(regs);
+		DB(DB_INTR, printk("%02x", cmd->SCp.Status))
+		    if (hostdata->level2 >= L2_BASIC) {
+			sr = read_wd33c93(regs, WD_SCSI_STATUS);	/* clear interrupt */
+			hostdata->state = S_RUNNING_LEVEL2;
+			write_wd33c93(regs, WD_COMMAND_PHASE, 0x50);
+			write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
+		} else {
+			hostdata->state = S_CONNECTED;
+		}
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
+
+	case CSR_XFER_DONE | PHS_MESS_IN:
+	case CSR_UNEXP | PHS_MESS_IN:
+	case CSR_SRV_REQ | PHS_MESS_IN:
+		DB(DB_INTR, printk("MSG_IN="))
+
+		msg = read_1_byte(regs);
+		sr = read_wd33c93(regs, WD_SCSI_STATUS);	/* clear interrupt */
+
+		hostdata->incoming_msg[hostdata->incoming_ptr] = msg;
+		if (hostdata->incoming_msg[0] == EXTENDED_MESSAGE)
+			msg = EXTENDED_MESSAGE;
+		else
+			hostdata->incoming_ptr = 0;
+
+		cmd->SCp.Message = msg;
+		switch (msg) {
+
+		case COMMAND_COMPLETE:
+			DB(DB_INTR, printk("CCMP-%ld", cmd->pid))
+			    write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+			hostdata->state = S_PRE_CMP_DISC;
+			break;
+
+		case SAVE_POINTERS:
+			DB(DB_INTR, printk("SDP"))
+			    write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+			hostdata->state = S_CONNECTED;
+			break;
+
+		case RESTORE_POINTERS:
+			DB(DB_INTR, printk("RDP"))
+			    if (hostdata->level2 >= L2_BASIC) {
+				write_wd33c93(regs, WD_COMMAND_PHASE, 0x45);
+				write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
+				hostdata->state = S_RUNNING_LEVEL2;
+			} else {
+				write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+				hostdata->state = S_CONNECTED;
+			}
+			break;
+
+		case DISCONNECT:
+			DB(DB_INTR, printk("DIS"))
+			    cmd->device->disconnect = 1;
+			write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+			hostdata->state = S_PRE_TMP_DISC;
+			break;
 
-            case MESSAGE_REJECT:
-DB(DB_INTR,printk("REJ"))
+		case MESSAGE_REJECT:
+			DB(DB_INTR, printk("REJ"))
 #ifdef SYNC_DEBUG
-printk("-REJ-");
+			    printk("-REJ-");
 #endif
-               if (hostdata->sync_stat[cmd->target] == SS_WAITING)
-                  hostdata->sync_stat[cmd->target] = SS_SET;
-               write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-               hostdata->state = S_CONNECTED;
-               break;
+			if (hostdata->sync_stat[cmd->device->id] == SS_WAITING)
+				hostdata->sync_stat[cmd->device->id] = SS_SET;
+			write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+			hostdata->state = S_CONNECTED;
+			break;
 
-            case EXTENDED_MESSAGE:
-DB(DB_INTR,printk("EXT"))
+		case EXTENDED_MESSAGE:
+			DB(DB_INTR, printk("EXT"))
 
-               ucp = hostdata->incoming_msg;
+			    ucp = hostdata->incoming_msg;
 
 #ifdef SYNC_DEBUG
-printk("%02x",ucp[hostdata->incoming_ptr]);
+			printk("%02x", ucp[hostdata->incoming_ptr]);
 #endif
-         /* Is this the last byte of the extended message? */
+			/* Is this the last byte of the extended message? */
 
-               if ((hostdata->incoming_ptr >= 2) &&
-                   (hostdata->incoming_ptr == (ucp[1] + 1))) {
+			if ((hostdata->incoming_ptr >= 2) &&
+			    (hostdata->incoming_ptr == (ucp[1] + 1))) {
 
-                  switch (ucp[2]) {   /* what's the EXTENDED code? */
-                     case EXTENDED_SDTR:
-                        id = calc_sync_xfer(ucp[3],ucp[4]);
-                        if (hostdata->sync_stat[cmd->target] != SS_WAITING) {
+				switch (ucp[2]) {	/* what's the EXTENDED code? */
+				case EXTENDED_SDTR:
+					id = calc_sync_xfer(ucp[3], ucp[4]);
+					if (hostdata->sync_stat[cmd->device->id] !=
+					    SS_WAITING) {
 
 /* A device has sent an unsolicited SDTR message; rather than go
  * through the effort of decoding it and then figuring out what
@@ -1028,123 +1042,140 @@
  * specifically ask for sync transfers, we won't do any.
  */
 
-                           write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN); /* want MESS_OUT */
-                           hostdata->outgoing_msg[0] = EXTENDED_MESSAGE;
-                           hostdata->outgoing_msg[1] = 3;
-                           hostdata->outgoing_msg[2] = EXTENDED_SDTR;
-                           hostdata->outgoing_msg[3] = hostdata->default_sx_per/4;
-                           hostdata->outgoing_msg[4] = 0;
-                           hostdata->outgoing_len = 5;
-                           hostdata->sync_xfer[cmd->target] =
-                                       calc_sync_xfer(hostdata->default_sx_per/4,0);
-                           }
-                        else {
-                           hostdata->sync_xfer[cmd->target] = id;
-                           }
+						write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN);	/* want MESS_OUT */
+						hostdata->outgoing_msg[0] =
+						    EXTENDED_MESSAGE;
+						hostdata->outgoing_msg[1] = 3;
+						hostdata->outgoing_msg[2] =
+						    EXTENDED_SDTR;
+						hostdata->outgoing_msg[3] =
+						    hostdata->default_sx_per /
+						    4;
+						hostdata->outgoing_msg[4] = 0;
+						hostdata->outgoing_len = 5;
+						hostdata->sync_xfer[cmd->device->id] =
+						    calc_sync_xfer(hostdata->
+								   default_sx_per
+								   / 4, 0);
+					} else {
+						hostdata->sync_xfer[cmd->device->id] = id;
+					}
 #ifdef SYNC_DEBUG
-printk("sync_xfer=%02x",hostdata->sync_xfer[cmd->target]);
+					printk("sync_xfer=%02x",
+					       hostdata->sync_xfer[cmd->device->id]);
 #endif
-                        hostdata->sync_stat[cmd->target] = SS_SET;
-                        write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-                        hostdata->state = S_CONNECTED;
-                        break;
-                     case EXTENDED_WDTR:
-                        write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN); /* want MESS_OUT */
-                        printk("sending WDTR ");
-                        hostdata->outgoing_msg[0] = EXTENDED_MESSAGE;
-                        hostdata->outgoing_msg[1] = 2;
-                        hostdata->outgoing_msg[2] = EXTENDED_WDTR;
-                        hostdata->outgoing_msg[3] = 0;   /* 8 bit transfer width */
-                        hostdata->outgoing_len = 4;
-                        write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-                        hostdata->state = S_CONNECTED;
-                        break;
-                     default:
-                        write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN); /* want MESS_OUT */
-                        printk("Rejecting Unknown Extended Message(%02x). ",ucp[2]);
-                        hostdata->outgoing_msg[0] = MESSAGE_REJECT;
-                        hostdata->outgoing_len = 1;
-                        write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-                        hostdata->state = S_CONNECTED;
-                        break;
-                     }
-                  hostdata->incoming_ptr = 0;
-                  }
-
-         /* We need to read more MESS_IN bytes for the extended message */
-
-               else {
-                  hostdata->incoming_ptr++;
-                  write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-                  hostdata->state = S_CONNECTED;
-                  }
-               break;
-
-            default:
-               printk("Rejecting Unknown Message(%02x) ",msg);
-               write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN); /* want MESS_OUT */
-               hostdata->outgoing_msg[0] = MESSAGE_REJECT;
-               hostdata->outgoing_len = 1;
-               write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-               hostdata->state = S_CONNECTED;
-            }
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-         break;
-
+					hostdata->sync_stat[cmd->device->id] =
+					    SS_SET;
+					write_wd33c93_cmd(regs,
+							  WD_CMD_NEGATE_ACK);
+					hostdata->state = S_CONNECTED;
+					break;
+				case EXTENDED_WDTR:
+					write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN);	/* want MESS_OUT */
+					printk("sending WDTR ");
+					hostdata->outgoing_msg[0] =
+					    EXTENDED_MESSAGE;
+					hostdata->outgoing_msg[1] = 2;
+					hostdata->outgoing_msg[2] =
+					    EXTENDED_WDTR;
+					hostdata->outgoing_msg[3] = 0;	/* 8 bit transfer width */
+					hostdata->outgoing_len = 4;
+					write_wd33c93_cmd(regs,
+							  WD_CMD_NEGATE_ACK);
+					hostdata->state = S_CONNECTED;
+					break;
+				default:
+					write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN);	/* want MESS_OUT */
+					printk
+					    ("Rejecting Unknown Extended Message(%02x). ",
+					     ucp[2]);
+					hostdata->outgoing_msg[0] =
+					    MESSAGE_REJECT;
+					hostdata->outgoing_len = 1;
+					write_wd33c93_cmd(regs,
+							  WD_CMD_NEGATE_ACK);
+					hostdata->state = S_CONNECTED;
+					break;
+				}
+				hostdata->incoming_ptr = 0;
+			}
+
+			/* We need to read more MESS_IN bytes for the extended message */
+
+			else {
+				hostdata->incoming_ptr++;
+				write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+				hostdata->state = S_CONNECTED;
+			}
+			break;
+
+		default:
+			printk("Rejecting Unknown Message(%02x) ", msg);
+			write_wd33c93_cmd(regs, WD_CMD_ASSERT_ATN);	/* want MESS_OUT */
+			hostdata->outgoing_msg[0] = MESSAGE_REJECT;
+			hostdata->outgoing_len = 1;
+			write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+			hostdata->state = S_CONNECTED;
+		}
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
 
 /* Note: this interrupt will occur only after a LEVEL2 command */
 
-      case CSR_SEL_XFER_DONE:
+	case CSR_SEL_XFER_DONE:
 
 /* Make sure that reselection is enabled at this point - it may
  * have been turned off for the command that just completed.
  */
 
-         write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);
-         if (phs == 0x60) {
-DB(DB_INTR,printk("SX-DONE-%ld",cmd->pid))
-            cmd->SCp.Message = COMMAND_COMPLETE;
-            lun = read_wd33c93(regs, WD_TARGET_LUN);
-DB(DB_INTR,printk(":%d.%d",cmd->SCp.Status,lun))
-            hostdata->connected = NULL;
-            hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-            hostdata->state = S_UNCONNECTED;
-            if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
-               cmd->SCp.Status = lun;
-            if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
-               cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
-            else
-               cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-            cmd->scsi_done(cmd);
+		write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);
+		if (phs == 0x60) {
+			DB(DB_INTR, printk("SX-DONE-%ld", cmd->pid))
+			    cmd->SCp.Message = COMMAND_COMPLETE;
+			lun = read_wd33c93(regs, WD_TARGET_LUN);
+			DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun))
+			    hostdata->connected = NULL;
+			hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+			hostdata->state = S_UNCONNECTED;
+			if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
+				cmd->SCp.Status = lun;
+			if (cmd->cmnd[0] == REQUEST_SENSE
+			    && cmd->SCp.Status != GOOD)
+				cmd->result =
+				    (cmd->
+				     result & 0x00ffff) | (DID_ERROR << 16);
+			else
+				cmd->result =
+				    cmd->SCp.Status | (cmd->SCp.Message << 8);
+			cmd->scsi_done(cmd);
 
 /* We are no longer  connected to a target - check to see if
  * there are commands waiting to be executed.
  */
-            spin_unlock_irqrestore(&hostdata->lock, flags);
-            wd33c93_execute(instance);
-            }
-         else {
-            printk("%02x:%02x:%02x-%ld: Unknown SEL_XFER_DONE phase!!---",asr,sr,phs,cmd->pid);
-            spin_unlock_irqrestore(&hostdata->lock, flags);
-	 }
-         break;
-
+			spin_unlock_irqrestore(&hostdata->lock, flags);
+			wd33c93_execute(instance);
+		} else {
+			printk
+			    ("%02x:%02x:%02x-%ld: Unknown SEL_XFER_DONE phase!!---",
+			     asr, sr, phs, cmd->pid);
+			spin_unlock_irqrestore(&hostdata->lock, flags);
+		}
+		break;
 
 /* Note: this interrupt will occur only after a LEVEL2 command */
 
-      case CSR_SDP:
-DB(DB_INTR,printk("SDP"))
-            hostdata->state = S_RUNNING_LEVEL2;
-            write_wd33c93(regs, WD_COMMAND_PHASE, 0x41);
-            write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
-
-      case CSR_XFER_DONE|PHS_MESS_OUT:
-      case CSR_UNEXP    |PHS_MESS_OUT:
-      case CSR_SRV_REQ  |PHS_MESS_OUT:
-DB(DB_INTR,printk("MSG_OUT="))
+	case CSR_SDP:
+		DB(DB_INTR, printk("SDP"))
+		    hostdata->state = S_RUNNING_LEVEL2;
+		write_wd33c93(regs, WD_COMMAND_PHASE, 0x41);
+		write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
+
+	case CSR_XFER_DONE | PHS_MESS_OUT:
+	case CSR_UNEXP | PHS_MESS_OUT:
+	case CSR_SRV_REQ | PHS_MESS_OUT:
+		DB(DB_INTR, printk("MSG_OUT="))
 
 /* To get here, we've probably requested MESSAGE_OUT and have
  * already put the correct bytes in outgoing_msg[] and filled
@@ -1158,21 +1189,19 @@
  * NOP messages in these situations results in no harm and
  * makes everyone happy.
  */
+		    if (hostdata->outgoing_len == 0) {
+			hostdata->outgoing_len = 1;
+			hostdata->outgoing_msg[0] = NOP;
+		}
+		transfer_pio(regs, hostdata->outgoing_msg,
+			     hostdata->outgoing_len, DATA_OUT_DIR, hostdata);
+		DB(DB_INTR, printk("%02x", hostdata->outgoing_msg[0]))
+		    hostdata->outgoing_len = 0;
+		hostdata->state = S_CONNECTED;
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
 
-         if (hostdata->outgoing_len == 0) {
-            hostdata->outgoing_len = 1;
-            hostdata->outgoing_msg[0] = NOP;
-            }
-         transfer_pio(regs, hostdata->outgoing_msg, hostdata->outgoing_len,
-                            DATA_OUT_DIR, hostdata);
-DB(DB_INTR,printk("%02x",hostdata->outgoing_msg[0]))
-         hostdata->outgoing_len = 0;
-         hostdata->state = S_CONNECTED;
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-	 break;
-
-
-      case CSR_UNEXP_DISC:
+	case CSR_UNEXP_DISC:
 
 /* I think I've seen this after a request-sense that was in response
  * to an error condition, but not sure. We certainly need to do
@@ -1186,353 +1215,387 @@
  * have been turned off for the command that just completed.
  */
 
-         write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);
-         if (cmd == NULL) {
-            printk(" - Already disconnected! ");
-            hostdata->state = S_UNCONNECTED;
-            spin_unlock_irqrestore(&hostdata->lock, flags);
-	    return;
-            }
-DB(DB_INTR,printk("UNEXP_DISC-%ld",cmd->pid))
-         hostdata->connected = NULL;
-         hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-         hostdata->state = S_UNCONNECTED;
-         if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
-            cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
-         else
-            cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-         cmd->scsi_done(cmd);
+		write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);
+		if (cmd == NULL) {
+			printk(" - Already disconnected! ");
+			hostdata->state = S_UNCONNECTED;
+			spin_unlock_irqrestore(&hostdata->lock, flags);
+			return;
+		}
+		DB(DB_INTR, printk("UNEXP_DISC-%ld", cmd->pid))
+		    hostdata->connected = NULL;
+		hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+		hostdata->state = S_UNCONNECTED;
+		if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
+			cmd->result =
+			    (cmd->result & 0x00ffff) | (DID_ERROR << 16);
+		else
+			cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
+		cmd->scsi_done(cmd);
 
 /* We are no longer connected to a target - check to see if
  * there are commands waiting to be executed.
  */
-    /* look above for comments on scsi_done() */
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-         wd33c93_execute(instance);
-         break;
+		/* look above for comments on scsi_done() */
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		wd33c93_execute(instance);
+		break;
 
-
-      case CSR_DISC:
+	case CSR_DISC:
 
 /* Make sure that reselection is enabled at this point - it may
  * have been turned off for the command that just completed.
  */
 
-         write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);
-DB(DB_INTR,printk("DISC-%ld",cmd->pid))
-         if (cmd == NULL) {
-            printk(" - Already disconnected! ");
-            hostdata->state = S_UNCONNECTED;
-            }
-         switch (hostdata->state) {
-            case S_PRE_CMP_DISC:
-               hostdata->connected = NULL;
-               hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-               hostdata->state = S_UNCONNECTED;
-DB(DB_INTR,printk(":%d",cmd->SCp.Status))
-               if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
-                  cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
-               else
-                  cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-               cmd->scsi_done(cmd);
-               break;
-            case S_PRE_TMP_DISC:
-            case S_RUNNING_LEVEL2:
-               cmd->host_scribble = (uchar *)hostdata->disconnected_Q;
-               hostdata->disconnected_Q = cmd;
-               hostdata->connected = NULL;
-               hostdata->state = S_UNCONNECTED;
+		write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);
+		DB(DB_INTR, printk("DISC-%ld", cmd->pid))
+		    if (cmd == NULL) {
+			printk(" - Already disconnected! ");
+			hostdata->state = S_UNCONNECTED;
+		}
+		switch (hostdata->state) {
+		case S_PRE_CMP_DISC:
+			hostdata->connected = NULL;
+			hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+			hostdata->state = S_UNCONNECTED;
+			DB(DB_INTR, printk(":%d", cmd->SCp.Status))
+			    if (cmd->cmnd[0] == REQUEST_SENSE
+				&& cmd->SCp.Status != GOOD)
+				cmd->result =
+				    (cmd->
+				     result & 0x00ffff) | (DID_ERROR << 16);
+			else
+				cmd->result =
+				    cmd->SCp.Status | (cmd->SCp.Message << 8);
+			cmd->scsi_done(cmd);
+			break;
+		case S_PRE_TMP_DISC:
+		case S_RUNNING_LEVEL2:
+			cmd->host_scribble = (uchar *) hostdata->disconnected_Q;
+			hostdata->disconnected_Q = cmd;
+			hostdata->connected = NULL;
+			hostdata->state = S_UNCONNECTED;
 
 #ifdef PROC_STATISTICS
-               hostdata->disc_done_cnt[cmd->target]++;
+			hostdata->disc_done_cnt[cmd->device->id]++;
 #endif
 
-               break;
-            default:
-               printk("*** Unexpected DISCONNECT interrupt! ***");
-               hostdata->state = S_UNCONNECTED;
-            }
+			break;
+		default:
+			printk("*** Unexpected DISCONNECT interrupt! ***");
+			hostdata->state = S_UNCONNECTED;
+		}
 
 /* We are no longer connected to a target - check to see if
  * there are commands waiting to be executed.
  */
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-         wd33c93_execute(instance);
-         break;
-
-
-      case CSR_RESEL_AM:
-      case CSR_RESEL:
-DB(DB_INTR,printk("RESEL%s", sr == CSR_RESEL_AM ? "_AM" : ""))
-
-   /* Old chips (pre -A ???) don't have advanced features and will
-    * generate CSR_RESEL.  In that case we have to extract the LUN the
-    * hard way (see below).
-    * First we have to make sure this reselection didn't
-    * happen during Arbitration/Selection of some other device.
-    * If yes, put losing command back on top of input_Q.
-    */
-
-         if (hostdata->level2 <= L2_NONE) {
-
-            if (hostdata->selecting) {
-               cmd = (Scsi_Cmnd *)hostdata->selecting;
-               hostdata->selecting = NULL;
-               hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-               cmd->host_scribble = (uchar *)hostdata->input_Q;
-               hostdata->input_Q = cmd;
-               }
-            }
-
-         else {
-
-            if (cmd) {
-               if (phs == 0x00) {
-                  hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-                  cmd->host_scribble = (uchar *)hostdata->input_Q;
-                  hostdata->input_Q = cmd;
-                  }
-               else {
-                  printk("---%02x:%02x:%02x-TROUBLE: Intrusive ReSelect!---",asr,sr,phs);
-                  while (1)
-                     printk("\r");
-                  }
-               }
-
-            }
-
-   /* OK - find out which device reselected us. */
-
-         id = read_wd33c93(regs, WD_SOURCE_ID);
-         id &= SRCID_MASK;
-
-   /* and extract the lun from the ID message. (Note that we don't
-    * bother to check for a valid message here - I guess this is
-    * not the right way to go, but...)
-    */
-
-         if (sr == CSR_RESEL_AM) {
-            lun = read_wd33c93(regs, WD_DATA);
-            if (hostdata->level2 < L2_RESELECT)
-               write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-            lun &= 7;
-         }
-         else {
-            /* Old chip; wait for msgin phase to pick up the LUN. */
-            for (lun = 255; lun; lun--) {
-               if ((asr = READ_AUX_STAT()) & ASR_INT)
-                  break;
-               udelay(10);
-            }
-            if (!(asr & ASR_INT)) {
-               printk("wd33c93: Reselected without IDENTIFY\n");
-               lun = 0;
-            }
-            else {
-               /* Verify this is a change to MSG_IN and read the message */
-               sr = read_wd33c93(regs, WD_SCSI_STATUS);
-               if (sr == (CSR_ABORT   | PHS_MESS_IN) ||
-                   sr == (CSR_UNEXP   | PHS_MESS_IN) ||
-                   sr == (CSR_SRV_REQ | PHS_MESS_IN)) {
-                  /* Got MSG_IN, grab target LUN */
-                  lun = read_1_byte(regs);
-                  /* Now we expect a 'paused with ACK asserted' int.. */
-                  asr = READ_AUX_STAT();
-                  if (!(asr & ASR_INT)) {
-                     udelay(10);
-                     asr = READ_AUX_STAT();
-                     if (!(asr & ASR_INT))
-                        printk("wd33c93: No int after LUN on RESEL (%02x)\n",
-                              asr);
-                  }
-                  sr = read_wd33c93(regs, WD_SCSI_STATUS);
-                  if (sr != CSR_MSGIN)
-                     printk("wd33c93: Not paused with ACK on RESEL (%02x)\n",
-                           sr);
-                  lun &= 7;
-                  write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
-               }
-               else {
-                  printk("wd33c93: Not MSG_IN on reselect (%02x)\n", sr);
-                  lun = 0;
-               }
-            }
-         }
-
-   /* Now we look for the command that's reconnecting. */
-
-         cmd = (Scsi_Cmnd *)hostdata->disconnected_Q;
-         patch = NULL;
-         while (cmd) {
-            if (id == cmd->target && lun == cmd->lun)
-               break;
-            patch = cmd;
-            cmd = (Scsi_Cmnd *)cmd->host_scribble;
-            }
-
-   /* Hmm. Couldn't find a valid command.... What to do? */
-
-         if (!cmd) {
-            printk("---TROUBLE: target %d.%d not in disconnect queue---",id,lun);
-            spin_unlock_irqrestore(&hostdata->lock, flags);
-	    return;
-            }
-
-   /* Ok, found the command - now start it up again. */
-
-         if (patch)
-            patch->host_scribble = cmd->host_scribble;
-         else
-            hostdata->disconnected_Q = (Scsi_Cmnd *)cmd->host_scribble;
-         hostdata->connected = cmd;
-
-   /* We don't need to worry about 'initialize_SCp()' or 'hostdata->busy[]'
-    * because these things are preserved over a disconnect.
-    * But we DO need to fix the DPD bit so it's correct for this command.
-    */
-
-         if (is_dir_out(cmd))
-            write_wd33c93(regs, WD_DESTINATION_ID, cmd->target);
-         else
-            write_wd33c93(regs, WD_DESTINATION_ID, cmd->target | DSTID_DPD);
-         if (hostdata->level2 >= L2_RESELECT) {
-            write_wd33c93_count(regs, 0);  /* we want a DATA_PHASE interrupt */
-            write_wd33c93(regs, WD_COMMAND_PHASE, 0x45);
-            write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
-            hostdata->state = S_RUNNING_LEVEL2;
-            }
-         else
-            hostdata->state = S_CONNECTED;
-
-DB(DB_INTR,printk("-%ld",cmd->pid))
-         spin_unlock_irqrestore(&hostdata->lock, flags);
- break;
-         
-      default:
-         printk("--UNKNOWN INTERRUPT:%02x:%02x:%02x--",asr,sr,phs);
-         spin_unlock_irqrestore(&hostdata->lock, flags);
-      }
-
-DB(DB_INTR,printk("} "))
-
-}
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+		wd33c93_execute(instance);
+		break;
+
+	case CSR_RESEL_AM:
+	case CSR_RESEL:
+		DB(DB_INTR, printk("RESEL%s", sr == CSR_RESEL_AM ? "_AM" : ""))
+
+		    /* Old chips (pre -A ???) don't have advanced features and will
+		     * generate CSR_RESEL.  In that case we have to extract the LUN the
+		     * hard way (see below).
+		     * First we have to make sure this reselection didn't
+		     * happen during Arbitration/Selection of some other device.
+		     * If yes, put losing command back on top of input_Q.
+		     */
+		    if (hostdata->level2 <= L2_NONE) {
+
+			if (hostdata->selecting) {
+				cmd = (Scsi_Cmnd *) hostdata->selecting;
+				hostdata->selecting = NULL;
+				hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+				cmd->host_scribble =
+				    (uchar *) hostdata->input_Q;
+				hostdata->input_Q = cmd;
+			}
+		}
+
+		else {
+
+			if (cmd) {
+				if (phs == 0x00) {
+					hostdata->busy[cmd->device->id] &=
+					    ~(1 << cmd->device->lun);
+					cmd->host_scribble =
+					    (uchar *) hostdata->input_Q;
+					hostdata->input_Q = cmd;
+				} else {
+					printk
+					    ("---%02x:%02x:%02x-TROUBLE: Intrusive ReSelect!---",
+					     asr, sr, phs);
+					while (1)
+						printk("\r");
+				}
+			}
+
+		}
+
+		/* OK - find out which device reselected us. */
+
+		id = read_wd33c93(regs, WD_SOURCE_ID);
+		id &= SRCID_MASK;
+
+		/* and extract the lun from the ID message. (Note that we don't
+		 * bother to check for a valid message here - I guess this is
+		 * not the right way to go, but...)
+		 */
+
+		if (sr == CSR_RESEL_AM) {
+			lun = read_wd33c93(regs, WD_DATA);
+			if (hostdata->level2 < L2_RESELECT)
+				write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);
+			lun &= 7;
+		} else {
+			/* Old chip; wait for msgin phase to pick up the LUN. */
+			for (lun = 255; lun; lun--) {
+				if ((asr = read_aux_stat(regs)) & ASR_INT)
+					break;
+				udelay(10);
+			}
+			if (!(asr & ASR_INT)) {
+				printk
+				    ("wd33c93: Reselected without IDENTIFY\n");
+				lun = 0;
+			} else {
+				/* Verify this is a change to MSG_IN and read the message */
+				sr = read_wd33c93(regs, WD_SCSI_STATUS);
+				if (sr == (CSR_ABORT | PHS_MESS_IN) ||
+				    sr == (CSR_UNEXP | PHS_MESS_IN) ||
+				    sr == (CSR_SRV_REQ | PHS_MESS_IN)) {
+					/* Got MSG_IN, grab target LUN */
+					lun = read_1_byte(regs);
+					/* Now we expect a 'paused with ACK asserted' int.. */
+					asr = read_aux_stat(regs);
+					if (!(asr & ASR_INT)) {
+						udelay(10);
+						asr = read_aux_stat(regs);
+						if (!(asr & ASR_INT))
+							printk
+							    ("wd33c93: No int after LUN on RESEL (%02x)\n",
+							     asr);
+					}
+					sr = read_wd33c93(regs, WD_SCSI_STATUS);
+					if (sr != CSR_MSGIN)
+						printk
+						    ("wd33c93: Not paused with ACK on RESEL (%02x)\n",
+						     sr);
+					lun &= 7;
+					write_wd33c93_cmd(regs,
+							  WD_CMD_NEGATE_ACK);
+				} else {
+					printk
+					    ("wd33c93: Not MSG_IN on reselect (%02x)\n",
+					     sr);
+					lun = 0;
+				}
+			}
+		}
+
+		/* Now we look for the command that's reconnecting. */
+
+		cmd = (Scsi_Cmnd *) hostdata->disconnected_Q;
+		patch = NULL;
+		while (cmd) {
+			if (id == cmd->device->id && lun == cmd->device->lun)
+				break;
+			patch = cmd;
+			cmd = (Scsi_Cmnd *) cmd->host_scribble;
+		}
+
+		/* Hmm. Couldn't find a valid command.... What to do? */
+
+		if (!cmd) {
+			printk
+			    ("---TROUBLE: target %d.%d not in disconnect queue---",
+			     id, lun);
+			spin_unlock_irqrestore(&hostdata->lock, flags);
+			return;
+		}
+
+		/* Ok, found the command - now start it up again. */
+
+		if (patch)
+			patch->host_scribble = cmd->host_scribble;
+		else
+			hostdata->disconnected_Q =
+			    (Scsi_Cmnd *) cmd->host_scribble;
+		hostdata->connected = cmd;
+
+		/* We don't need to worry about 'initialize_SCp()' or 'hostdata->busy[]'
+		 * because these things are preserved over a disconnect.
+		 * But we DO need to fix the DPD bit so it's correct for this command.
+		 */
+
+		if (is_dir_out(cmd))
+			write_wd33c93(regs, WD_DESTINATION_ID, cmd->device->id);
+		else
+			write_wd33c93(regs, WD_DESTINATION_ID,
+				      cmd->device->id | DSTID_DPD);
+		if (hostdata->level2 >= L2_RESELECT) {
+			write_wd33c93_count(regs, 0);	/* we want a DATA_PHASE interrupt */
+			write_wd33c93(regs, WD_COMMAND_PHASE, 0x45);
+			write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
+			hostdata->state = S_RUNNING_LEVEL2;
+		} else
+			hostdata->state = S_CONNECTED;
+
+		DB(DB_INTR, printk("-%ld", cmd->pid))
+		    spin_unlock_irqrestore(&hostdata->lock, flags);
+		break;
+
+	default:
+		printk("--UNKNOWN INTERRUPT:%02x:%02x:%02x--", asr, sr, phs);
+		spin_unlock_irqrestore(&hostdata->lock, flags);
+	}
+
+	DB(DB_INTR, printk("} "))
+
+}
+
+static void
+reset_wd33c93(struct Scsi_Host *instance)
+{
+	struct WD33C93_hostdata *hostdata =
+	    (struct WD33C93_hostdata *) instance->hostdata;
+	const wd33c93_regs regs = hostdata->regs;
+	uchar sr;
+
+#ifdef CONFIG_SGI_IP22
+	{
+		int busycount = 0;
+		extern void sgiwd93_reset(unsigned long);
+		/* wait 'til the chip gets some time for us */
+		while ((READ_AUX_STAT() & ASR_BSY) && busycount++ < 100)
+			udelay (10);
+	/*
+ 	 * there are scsi devices out there, which manage to lock up
+	 * the wd33c93 in a busy condition. In this state it won't
+	 * accept the reset command. The only way to solve this is to
+ 	 * give the chip a hardware reset (if possible). The code below
+	 * does this for the SGI Indy, where this is possible
+	 */
+	/* still busy ? */
+	if (READ_AUX_STAT() & ASR_BSY)
+		sgiwd93_reset(instance->base); /* yeah, give it the hard one */
+	}
+#endif
 
+	write_wd33c93(regs, WD_OWN_ID, OWNID_EAF | OWNID_RAF |
+		      instance->this_id | hostdata->clock_freq);
+	write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
+	write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,
+		      calc_sync_xfer(hostdata->default_sx_per / 4,
+				     DEFAULT_SX_OFF));
+	write_wd33c93(regs, WD_COMMAND, WD_CMD_RESET);
 
 
-static void reset_wd33c93(struct Scsi_Host *instance)
-{
-struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *)instance->hostdata;
-const wd33c93_regs regs = hostdata->regs;
-uchar sr;
-
-   write_wd33c93(regs, WD_OWN_ID, OWNID_EAF | OWNID_RAF |
-                 instance->this_id | hostdata->clock_freq);
-   write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
-   write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,
-                 calc_sync_xfer(hostdata->default_sx_per/4,DEFAULT_SX_OFF));
-   write_wd33c93(regs, WD_COMMAND, WD_CMD_RESET);
 #ifdef CONFIG_MVME147_SCSI
-   udelay(25); /* The old wd33c93 on MVME147 needs this, at least */
+	udelay(25);		/* The old wd33c93 on MVME147 needs this, at least */
 #endif
 
-   while (!(READ_AUX_STAT() & ASR_INT))
-      ;
-   sr = read_wd33c93(regs, WD_SCSI_STATUS);
-
-   hostdata->microcode = read_wd33c93(regs, WD_CDB_1);
-   if (sr == 0x00)
-      hostdata->chip = C_WD33C93;
-   else if (sr == 0x01) {
-      write_wd33c93(regs, WD_QUEUE_TAG, 0xa5);  /* any random number */
-      sr = read_wd33c93(regs, WD_QUEUE_TAG);
-      if (sr == 0xa5) {
-         hostdata->chip = C_WD33C93B;
-         write_wd33c93(regs, WD_QUEUE_TAG, 0);
-         }
-      else
-         hostdata->chip = C_WD33C93A;
-      }
-   else
-      hostdata->chip = C_UNKNOWN_CHIP;
-
-   write_wd33c93(regs, WD_TIMEOUT_PERIOD, TIMEOUT_PERIOD_VALUE);
-   write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
-}
-
-
-
-int wd33c93_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags)
-{
-struct Scsi_Host *instance;
-struct WD33C93_hostdata *hostdata;
-int i;
-
-   instance = SCpnt->host;
-   hostdata = (struct WD33C93_hostdata *)instance->hostdata;
-
-   printk("scsi%d: reset. ", instance->host_no);
-   disable_irq(instance->irq);
-
-   ((struct WD33C93_hostdata *)instance->hostdata)->dma_stop(instance,NULL,0);
-   for (i = 0; i < 8; i++) {
-      hostdata->busy[i] = 0;
-      hostdata->sync_xfer[i] = calc_sync_xfer(DEFAULT_SX_PER/4,DEFAULT_SX_OFF);
-      hostdata->sync_stat[i] = SS_UNSET;  /* using default sync values */
-      }
-   hostdata->input_Q = NULL;
-   hostdata->selecting = NULL;
-   hostdata->connected = NULL;
-   hostdata->disconnected_Q = NULL;
-   hostdata->state = S_UNCONNECTED;
-   hostdata->dma = D_DMA_OFF;
-   hostdata->incoming_ptr = 0;
-   hostdata->outgoing_len = 0;
-
-   reset_wd33c93(instance);
-   SCpnt->result = DID_RESET << 16;
-   enable_irq(instance->irq);
-   return 0;
-}
-
-
-
-int wd33c93_abort (Scsi_Cmnd *cmd)
-{
-struct Scsi_Host *instance;
-struct WD33C93_hostdata *hostdata;
-wd33c93_regs regs;
-Scsi_Cmnd *tmp, *prev;
-
-   disable_irq(cmd->host->irq);
-
-   instance = cmd->host;
-   hostdata = (struct WD33C93_hostdata *)instance->hostdata;
-   regs = hostdata->regs;
+	while (!(read_aux_stat(regs) & ASR_INT))
+		;
+	sr = read_wd33c93(regs, WD_SCSI_STATUS);
+
+	hostdata->microcode = read_wd33c93(regs, WD_CDB_1);
+	if (sr == 0x00)
+		hostdata->chip = C_WD33C93;
+	else if (sr == 0x01) {
+		write_wd33c93(regs, WD_QUEUE_TAG, 0xa5);	/* any random number */
+		sr = read_wd33c93(regs, WD_QUEUE_TAG);
+		if (sr == 0xa5) {
+			hostdata->chip = C_WD33C93B;
+			write_wd33c93(regs, WD_QUEUE_TAG, 0);
+		} else
+			hostdata->chip = C_WD33C93A;
+	} else
+		hostdata->chip = C_UNKNOWN_CHIP;
+
+	write_wd33c93(regs, WD_TIMEOUT_PERIOD, TIMEOUT_PERIOD_VALUE);
+	write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
+}
+
+int
+wd33c93_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
+{
+	struct Scsi_Host *instance;
+	struct WD33C93_hostdata *hostdata;
+	int i;
+
+	instance = SCpnt->device->host;
+	hostdata = (struct WD33C93_hostdata *) instance->hostdata;
+
+	printk("scsi%d: reset. ", instance->host_no);
+	disable_irq(instance->irq);
+
+	hostdata->dma_stop(instance, NULL, 0);
+	for (i = 0; i < 8; i++) {
+		hostdata->busy[i] = 0;
+		hostdata->sync_xfer[i] =
+		    calc_sync_xfer(DEFAULT_SX_PER / 4, DEFAULT_SX_OFF);
+		hostdata->sync_stat[i] = SS_UNSET;	/* using default sync values */
+	}
+	hostdata->input_Q = NULL;
+	hostdata->selecting = NULL;
+	hostdata->connected = NULL;
+	hostdata->disconnected_Q = NULL;
+	hostdata->state = S_UNCONNECTED;
+	hostdata->dma = D_DMA_OFF;
+	hostdata->incoming_ptr = 0;
+	hostdata->outgoing_len = 0;
+
+	reset_wd33c93(instance);
+	SCpnt->result = DID_RESET << 16;
+	enable_irq(instance->irq);
+	return 0;
+}
+
+int
+wd33c93_abort(Scsi_Cmnd * cmd)
+{
+	struct Scsi_Host *instance;
+	struct WD33C93_hostdata *hostdata;
+	wd33c93_regs regs;
+	Scsi_Cmnd *tmp, *prev;
+
+	disable_irq(cmd->device->host->irq);
+
+	instance = cmd->device->host;
+	hostdata = (struct WD33C93_hostdata *) instance->hostdata;
+	regs = hostdata->regs;
 
 /*
  * Case 1 : If the command hasn't been issued yet, we simply remove it
  *     from the input_Q.
  */
 
-   tmp = (Scsi_Cmnd *)hostdata->input_Q;
-   prev = 0;
-   while (tmp) {
-      if (tmp == cmd) {
-         if (prev)
-            prev->host_scribble = cmd->host_scribble;
-	 else
-            hostdata->input_Q = (Scsi_Cmnd *)cmd->host_scribble;
-         cmd->host_scribble = NULL;
-         cmd->result = DID_ABORT << 16;
-         printk("scsi%d: Abort - removing command %ld from input_Q. ",
-           instance->host_no, cmd->pid);
-    enable_irq(cmd->host->irq);
-         cmd->scsi_done(cmd);
-         return SCSI_ABORT_SUCCESS;
-         }
-      prev = tmp;
-      tmp = (Scsi_Cmnd *)tmp->host_scribble;
-      }
+	tmp = (Scsi_Cmnd *) hostdata->input_Q;
+	prev = 0;
+	while (tmp) {
+		if (tmp == cmd) {
+			if (prev)
+				prev->host_scribble = cmd->host_scribble;
+			else
+				hostdata->input_Q =
+				    (Scsi_Cmnd *) cmd->host_scribble;
+			cmd->host_scribble = NULL;
+			cmd->result = DID_ABORT << 16;
+			printk
+			    ("scsi%d: Abort - removing command %ld from input_Q. ",
+			     instance->host_no, cmd->pid);
+			enable_irq(cmd->device->host->irq);
+			cmd->scsi_done(cmd);
+			return SCSI_ABORT_SUCCESS;
+		}
+		prev = tmp;
+		tmp = (Scsi_Cmnd *) tmp->host_scribble;
+	}
 
 /*
  * Case 2 : If the command is connected, we're going to fail the abort
@@ -1545,64 +1608,66 @@
  *     we fail.
  */
 
-   if (hostdata->connected == cmd) {
-      uchar sr, asr;
-      unsigned long timeout;
-
-      printk("scsi%d: Aborting connected command %ld - ",
-              instance->host_no, cmd->pid);
-
-      printk("stopping DMA - ");
-      if (hostdata->dma == D_DMA_RUNNING) {
-         hostdata->dma_stop(instance, cmd, 0);
-         hostdata->dma = D_DMA_OFF;
-         }
-
-      printk("sending wd33c93 ABORT command - ");
-      write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
-      write_wd33c93_cmd(regs, WD_CMD_ABORT);
+	if (hostdata->connected == cmd) {
+		uchar sr, asr;
+		unsigned long timeout;
+
+		printk("scsi%d: Aborting connected command %ld - ",
+		       instance->host_no, cmd->pid);
+
+		printk("stopping DMA - ");
+		if (hostdata->dma == D_DMA_RUNNING) {
+			hostdata->dma_stop(instance, cmd, 0);
+			hostdata->dma = D_DMA_OFF;
+		}
+
+		printk("sending wd33c93 ABORT command - ");
+		write_wd33c93(regs, WD_CONTROL,
+			      CTRL_IDI | CTRL_EDI | CTRL_POLLED);
+		write_wd33c93_cmd(regs, WD_CMD_ABORT);
 
 /* Now we have to attempt to flush out the FIFO... */
 
-      printk("flushing fifo - ");
-      timeout = 1000000;
-      do {
-         asr = READ_AUX_STAT();
-         if (asr & ASR_DBR)
-            read_wd33c93(regs, WD_DATA);
-         } while (!(asr & ASR_INT) && timeout-- > 0);
-      sr = read_wd33c93(regs, WD_SCSI_STATUS);
-      printk("asr=%02x, sr=%02x, %ld bytes un-transferred (timeout=%ld) - ",
-             asr, sr, read_wd33c93_count(regs), timeout);
-
-   /*
-    * Abort command processed.
-    * Still connected.
-    * We must disconnect.
-    */
-
-      printk("sending wd33c93 DISCONNECT command - ");
-      write_wd33c93_cmd(regs, WD_CMD_DISCONNECT);
-
-      timeout = 1000000;
-      asr = READ_AUX_STAT();
-      while ((asr & ASR_CIP) && timeout-- > 0)
-         asr = READ_AUX_STAT();
-      sr = read_wd33c93(regs, WD_SCSI_STATUS);
-      printk("asr=%02x, sr=%02x.",asr,sr);
-
-      hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
-      hostdata->connected = NULL;
-      hostdata->state = S_UNCONNECTED;
-      cmd->result = DID_ABORT << 16;
+		printk("flushing fifo - ");
+		timeout = 1000000;
+		do {
+			asr = read_aux_stat(regs);
+			if (asr & ASR_DBR)
+				read_wd33c93(regs, WD_DATA);
+		} while (!(asr & ASR_INT) && timeout-- > 0);
+		sr = read_wd33c93(regs, WD_SCSI_STATUS);
+		printk
+		    ("asr=%02x, sr=%02x, %ld bytes un-transferred (timeout=%ld) - ",
+		     asr, sr, read_wd33c93_count(regs), timeout);
+
+		/*
+		 * Abort command processed.
+		 * Still connected.
+		 * We must disconnect.
+		 */
+
+		printk("sending wd33c93 DISCONNECT command - ");
+		write_wd33c93_cmd(regs, WD_CMD_DISCONNECT);
+
+		timeout = 1000000;
+		asr = read_aux_stat(regs);
+		while ((asr & ASR_CIP) && timeout-- > 0)
+			asr = read_aux_stat(regs);
+		sr = read_wd33c93(regs, WD_SCSI_STATUS);
+		printk("asr=%02x, sr=%02x.", asr, sr);
+
+		hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+		hostdata->connected = NULL;
+		hostdata->state = S_UNCONNECTED;
+		cmd->result = DID_ABORT << 16;
 
 /*      sti();*/
-      wd33c93_execute (instance);
+		wd33c93_execute(instance);
 
-      enable_irq(cmd->host->irq);
-      cmd->scsi_done(cmd);
-      return SCSI_ABORT_SUCCESS;
-      }
+		enable_irq(cmd->device->host->irq);
+		cmd->scsi_done(cmd);
+		return SCSI_ABORT_SUCCESS;
+	}
 
 /*
  * Case 3: If the command is currently disconnected from the bus,
@@ -1610,17 +1675,18 @@
  * an ABORT_SNOOZE and hope for the best...
  */
 
-   tmp = (Scsi_Cmnd *)hostdata->disconnected_Q;
-   while (tmp) {
-      if (tmp == cmd) {
-         printk("scsi%d: Abort - command %ld found on disconnected_Q - ",
-                 instance->host_no, cmd->pid);
-         printk("returning ABORT_SNOOZE. ");
-    enable_irq(cmd->host->irq);
-         return SCSI_ABORT_SNOOZE;
-         }
-      tmp = (Scsi_Cmnd *)tmp->host_scribble;
-      }
+	tmp = (Scsi_Cmnd *) hostdata->disconnected_Q;
+	while (tmp) {
+		if (tmp == cmd) {
+			printk
+			    ("scsi%d: Abort - command %ld found on disconnected_Q - ",
+			     instance->host_no, cmd->pid);
+			printk("returning ABORT_SNOOZE. ");
+			enable_irq(cmd->device->host->irq);
+			return SCSI_ABORT_SNOOZE;
+		}
+		tmp = (Scsi_Cmnd *) tmp->host_scribble;
+	}
 
 /*
  * Case 4 : If we reached this point, the command was not found in any of
@@ -1633,16 +1699,14 @@
  */
 
 /*   sti();*/
-   wd33c93_execute (instance);
+	wd33c93_execute(instance);
 
-   enable_irq(cmd->host->irq);
-   printk("scsi%d: warning : SCSI command probably completed successfully"
-      "         before abortion. ", instance->host_no);
-   return SCSI_ABORT_NOT_RUNNING;
+	enable_irq(cmd->device->host->irq);
+	printk("scsi%d: warning : SCSI command probably completed successfully"
+	       "         before abortion. ", instance->host_no);
+	return SCSI_ABORT_NOT_RUNNING;
 }
 
-
-
 #define MAX_WD33C93_HOSTS 4
 #define MAX_SETUP_ARGS ((int)(sizeof(setup_args) / sizeof(char *)))
 #define SETUP_BUFFER_SIZE 200
@@ -1650,238 +1714,224 @@
 static char setup_used[MAX_SETUP_ARGS];
 static int done_setup = 0;
 
-int wd33c93_setup (char *str)
+int
+wd33c93_setup(char *str)
 {
-   int i;
-   char *p1,*p2;
+	int i;
+	char *p1, *p2;
 
-   /* The kernel does some processing of the command-line before calling
-    * this function: If it begins with any decimal or hex number arguments,
-    * ints[0] = how many numbers found and ints[1] through [n] are the values
-    * themselves. str points to where the non-numeric arguments (if any)
-    * start: We do our own parsing of those. We construct synthetic 'nosync'
-    * keywords out of numeric args (to maintain compatibility with older
-    * versions) and then add the rest of the arguments.
-    */
-
-   p1 = setup_buffer;
-   *p1 = '\0';
-#if 0
-/*
- * Old style command line arguments are now dead
- */
-   if (ints[0]) {
-      for (i=0; i<ints[0]; i++) {
-         x = vsprintf(p1,"nosync:0x%02x,",&(ints[i+1]));
-         p1 += x;
-         }
-      }
-#endif
-   if (str)
-      strncpy(p1, str, SETUP_BUFFER_SIZE - strlen(setup_buffer));
-   setup_buffer[SETUP_BUFFER_SIZE - 1] = '\0';
-   p1 = setup_buffer;
-   i = 0;
-   while (*p1 && (i < MAX_SETUP_ARGS)) {
-      p2 = strchr(p1, ',');
-      if (p2) {
-         *p2 = '\0';
-         if (p1 != p2)
-            setup_args[i] = p1;
-         p1 = p2 + 1;
-         i++;
-         }
-      else {
-         setup_args[i] = p1;
-         break;
-         }
-      }
-   for (i=0; i<MAX_SETUP_ARGS; i++)
-      setup_used[i] = 0;
-   done_setup = 1;
+	/* The kernel does some processing of the command-line before calling
+	 * this function: If it begins with any decimal or hex number arguments,
+	 * ints[0] = how many numbers found and ints[1] through [n] are the values
+	 * themselves. str points to where the non-numeric arguments (if any)
+	 * start: We do our own parsing of those. We construct synthetic 'nosync'
+	 * keywords out of numeric args (to maintain compatibility with older
+	 * versions) and then add the rest of the arguments.
+	 */
+
+	p1 = setup_buffer;
+	*p1 = '\0';
+	if (str)
+		strncpy(p1, str, SETUP_BUFFER_SIZE - strlen(setup_buffer));
+	setup_buffer[SETUP_BUFFER_SIZE - 1] = '\0';
+	p1 = setup_buffer;
+	i = 0;
+	while (*p1 && (i < MAX_SETUP_ARGS)) {
+		p2 = strchr(p1, ',');
+		if (p2) {
+			*p2 = '\0';
+			if (p1 != p2)
+				setup_args[i] = p1;
+			p1 = p2 + 1;
+			i++;
+		} else {
+			setup_args[i] = p1;
+			break;
+		}
+	}
+	for (i = 0; i < MAX_SETUP_ARGS; i++)
+		setup_used[i] = 0;
+	done_setup = 1;
 
-   return 1;
+	return 1;
 }
-
-__setup("wd33c93", wd33c93_setup);
-
+__setup("wd33c9=", wd33c93_setup);
 
 /* check_setup_args() returns index if key found, 0 if not
  */
-
-static int check_setup_args(char *key, int *flags, int *val, char *buf)
+static int
+check_setup_args(char *key, int *flags, int *val, char *buf)
 {
-int x;
-char *cp;
-
-   for  (x=0; x<MAX_SETUP_ARGS; x++) {
-      if (setup_used[x])
-         continue;
-      if (!strncmp(setup_args[x], key, strlen(key)))
-         break;
-      if (!strncmp(setup_args[x], "next", strlen("next")))
-         return 0;
-      }
-   if (x == MAX_SETUP_ARGS)
-      return 0;
-   setup_used[x] = 1;
-   cp = setup_args[x] + strlen(key);
-   *val = -1;
-   if (*cp != ':')
-      return ++x;
-   cp++;
-   if ((*cp >= '0') && (*cp <= '9')) {
-      *val = simple_strtoul(cp,NULL,0);
-      }
-   return ++x;
-}
-
-
+	int x;
+	char *cp;
 
-void wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs,
-		  dma_setup_t setup, dma_stop_t stop, int clock_freq)
-{
-struct WD33C93_hostdata *hostdata;
-int i;
-int flags;
-int val;
-char buf[32];
-
-   if (!done_setup && setup_strings)
-      wd33c93_setup(setup_strings);
-
-   hostdata = (struct WD33C93_hostdata *)instance->hostdata;
-
-   hostdata->regs = regs;
-   hostdata->clock_freq = clock_freq;
-   hostdata->dma_setup = setup;
-   hostdata->dma_stop = stop;
-   hostdata->dma_bounce_buffer = NULL;
-   hostdata->dma_bounce_len = 0;
-   for (i = 0; i < 8; i++) {
-      hostdata->busy[i] = 0;
-      hostdata->sync_xfer[i] = calc_sync_xfer(DEFAULT_SX_PER/4,DEFAULT_SX_OFF);
-      hostdata->sync_stat[i] = SS_UNSET;  /* using default sync values */
+	for (x = 0; x < MAX_SETUP_ARGS; x++) {
+		if (setup_used[x])
+			continue;
+		if (!strncmp(setup_args[x], key, strlen(key)))
+			break;
+		if (!strncmp(setup_args[x], "next", strlen("next")))
+			return 0;
+	}
+	if (x == MAX_SETUP_ARGS)
+		return 0;
+	setup_used[x] = 1;
+	cp = setup_args[x] + strlen(key);
+	*val = -1;
+	if (*cp != ':')
+		return ++x;
+	cp++;
+	if ((*cp >= '0') && (*cp <= '9')) {
+		*val = simple_strtoul(cp, NULL, 0);
+	}
+	return ++x;
+}
+
+void
+wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs,
+	     dma_setup_t setup, dma_stop_t stop, int clock_freq)
+{
+	struct WD33C93_hostdata *hostdata;
+	int i;
+	int flags;
+	int val;
+	char buf[32];
+
+	if (!done_setup && setup_strings)
+		wd33c93_setup(setup_strings);
+
+	hostdata = (struct WD33C93_hostdata *) instance->hostdata;
+
+	hostdata->regs = regs;
+	hostdata->clock_freq = clock_freq;
+	hostdata->dma_setup = setup;
+	hostdata->dma_stop = stop;
+	hostdata->dma_bounce_buffer = NULL;
+	hostdata->dma_bounce_len = 0;
+	for (i = 0; i < 8; i++) {
+		hostdata->busy[i] = 0;
+		hostdata->sync_xfer[i] =
+		    calc_sync_xfer(DEFAULT_SX_PER / 4, DEFAULT_SX_OFF);
+		hostdata->sync_stat[i] = SS_UNSET;	/* using default sync values */
 #ifdef PROC_STATISTICS
-      hostdata->cmd_cnt[i] = 0;
-      hostdata->disc_allowed_cnt[i] = 0;
-      hostdata->disc_done_cnt[i] = 0;
+		hostdata->cmd_cnt[i] = 0;
+		hostdata->disc_allowed_cnt[i] = 0;
+		hostdata->disc_done_cnt[i] = 0;
 #endif
-      }
-   hostdata->input_Q = NULL;
-   hostdata->selecting = NULL;
-   hostdata->connected = NULL;
-   hostdata->disconnected_Q = NULL;
-   hostdata->state = S_UNCONNECTED;
-   hostdata->dma = D_DMA_OFF;
-   hostdata->level2 = L2_BASIC;
-   hostdata->disconnect = DIS_ADAPTIVE;
-   hostdata->args = DEBUG_DEFAULTS;
-   hostdata->incoming_ptr = 0;
-   hostdata->outgoing_len = 0;
-   hostdata->default_sx_per = DEFAULT_SX_PER;
-   hostdata->no_sync = 0xff;     /* sync defaults to off */
-   hostdata->no_dma = 0;         /* default is DMA enabled */
+	}
+	hostdata->input_Q = NULL;
+	hostdata->selecting = NULL;
+	hostdata->connected = NULL;
+	hostdata->disconnected_Q = NULL;
+	hostdata->state = S_UNCONNECTED;
+	hostdata->dma = D_DMA_OFF;
+	hostdata->level2 = L2_BASIC;
+	hostdata->disconnect = DIS_ADAPTIVE;
+	hostdata->args = DEBUG_DEFAULTS;
+	hostdata->incoming_ptr = 0;
+	hostdata->outgoing_len = 0;
+	hostdata->default_sx_per = DEFAULT_SX_PER;
+	hostdata->no_sync = 0xff;	/* sync defaults to off */
+	hostdata->no_dma = 0;	/* default is DMA enabled */
 
 #ifdef PROC_INTERFACE
-   hostdata->proc = PR_VERSION|PR_INFO|PR_STATISTICS|
-                    PR_CONNECTED|PR_INPUTQ|PR_DISCQ|
-                    PR_STOP;
+	hostdata->proc = PR_VERSION | PR_INFO | PR_STATISTICS |
+	    PR_CONNECTED | PR_INPUTQ | PR_DISCQ | PR_STOP;
 #ifdef PROC_STATISTICS
-   hostdata->dma_cnt = 0;
-   hostdata->pio_cnt = 0;
-   hostdata->int_cnt = 0;
+	hostdata->dma_cnt = 0;
+	hostdata->pio_cnt = 0;
+	hostdata->int_cnt = 0;
 #endif
 #endif
 
+	if (check_setup_args("nosync", &flags, &val, buf))
+		hostdata->no_sync = val;
 
-   if (check_setup_args("nosync",&flags,&val,buf))
-      hostdata->no_sync = val;
-
-   if (check_setup_args("nodma",&flags,&val,buf))
-      hostdata->no_dma = (val == -1) ? 1 : val;
-
-   if (check_setup_args("period",&flags,&val,buf))
-      hostdata->default_sx_per = sx_table[round_period((unsigned int)val)].period_ns;
-
-   if (check_setup_args("disconnect",&flags,&val,buf)) {
-      if ((val >= DIS_NEVER) && (val <= DIS_ALWAYS))
-         hostdata->disconnect = val;
-      else
-         hostdata->disconnect = DIS_ADAPTIVE;
-      }
-
-   if (check_setup_args("level2",&flags,&val,buf))
-      hostdata->level2 = val;
-
-   if (check_setup_args("debug",&flags,&val,buf))
-      hostdata->args = val & DB_MASK;
-
-   if (check_setup_args("clock",&flags,&val,buf)) {
-      if (val>7 && val<11)
-         val = WD33C93_FS_8_10;
-      else if (val>11 && val<16)
-         val = WD33C93_FS_12_15;
-      else if (val>15 && val<21)
-         val = WD33C93_FS_16_20;
-      else
-         val = WD33C93_FS_8_10;
-      hostdata->clock_freq = val;
-      }
-
-   if ((i = check_setup_args("next",&flags,&val,buf))) {
-      while (i)
-         setup_used[--i] = 1;
-      }
+	if (check_setup_args("nodma", &flags, &val, buf))
+		hostdata->no_dma = (val == -1) ? 1 : val;
 
+	if (check_setup_args("period", &flags, &val, buf))
+		hostdata->default_sx_per =
+		    sx_table[round_period((unsigned int) val)].period_ns;
+
+	if (check_setup_args("disconnect", &flags, &val, buf)) {
+		if ((val >= DIS_NEVER) && (val <= DIS_ALWAYS))
+			hostdata->disconnect = val;
+		else
+			hostdata->disconnect = DIS_ADAPTIVE;
+	}
+
+	if (check_setup_args("level2", &flags, &val, buf))
+		hostdata->level2 = val;
+
+	if (check_setup_args("debug", &flags, &val, buf))
+		hostdata->args = val & DB_MASK;
+
+	if (check_setup_args("clock", &flags, &val, buf)) {
+		if (val > 7 && val < 11)
+			val = WD33C93_FS_8_10;
+		else if (val > 11 && val < 16)
+			val = WD33C93_FS_12_15;
+		else if (val > 15 && val < 21)
+			val = WD33C93_FS_16_20;
+		else
+			val = WD33C93_FS_8_10;
+		hostdata->clock_freq = val;
+	}
+
+	if ((i = check_setup_args("next", &flags, &val, buf))) {
+		while (i)
+			setup_used[--i] = 1;
+	}
 #ifdef PROC_INTERFACE
-   if (check_setup_args("proc",&flags,&val,buf))
-      hostdata->proc = val;
+	if (check_setup_args("proc", &flags, &val, buf))
+		hostdata->proc = val;
 #endif
 
-
-   spin_lock_irq(&hostdata->lock);
-   reset_wd33c93(instance);
-   spin_unlock_irq(&hostdata->lock);
-
-   printk("wd33c93-%d: chip=%s/%d no_sync=0x%x no_dma=%d",instance->host_no,
-         (hostdata->chip==C_WD33C93)?"WD33c93":
-         (hostdata->chip==C_WD33C93A)?"WD33c93A":
-         (hostdata->chip==C_WD33C93B)?"WD33c93B":"unknown",
-         hostdata->microcode,hostdata->no_sync,hostdata->no_dma);
+	spin_lock_irq(&hostdata->lock);
+	reset_wd33c93(instance);
+	spin_unlock_irq(&hostdata->lock);
+
+	printk("wd33c93-%d: chip=%s/%d no_sync=0x%x no_dma=%d",
+	       instance->host_no,
+	       (hostdata->chip == C_WD33C93) ? "WD33c93" : (hostdata->chip ==
+							    C_WD33C93A) ?
+	       "WD33c93A" : (hostdata->chip ==
+			     C_WD33C93B) ? "WD33c93B" : "unknown",
+	       hostdata->microcode, hostdata->no_sync, hostdata->no_dma);
 #ifdef DEBUGGING_ON
-   printk(" debug_flags=0x%02x\n",hostdata->args);
+	printk(" debug_flags=0x%02x\n", hostdata->args);
 #else
-   printk(" debugging=OFF\n");
+	printk(" debugging=OFF\n");
 #endif
-   printk("           setup_args=");
-   for (i=0; i<MAX_SETUP_ARGS; i++)
-      printk("%s,",setup_args[i]);
-   printk("\n");
-   printk("           Version %s - %s, Compiled %s at %s\n",
-               WD33C93_VERSION,WD33C93_DATE,__DATE__,__TIME__);
+	printk("           setup_args=");
+	for (i = 0; i < MAX_SETUP_ARGS; i++)
+		printk("%s,", setup_args[i]);
+	printk("\n");
+	printk("           Version %s - %s, Compiled %s at %s\n",
+	       WD33C93_VERSION, WD33C93_DATE, __DATE__, __TIME__);
 }
 
-
-int wd33c93_proc_info(char *buf, char **start, off_t off, int len, int hn, int in)
+int
+wd33c93_proc_info(char *buf, char **start, off_t off, int len, int hn, int in)
 {
 
 #ifdef PROC_INTERFACE
 
-char *bp;
-char tbuf[128];
-struct Scsi_Host *instance;
-struct WD33C93_hostdata *hd;
-Scsi_Cmnd *cmd;
-int x,i;
-static int stop = 0;
-
-   instance = scsi_host_hn_get(hn);
-   if (!instance) {
-      printk("*** Hmm... Can't find host #%d!\n",hn);
-      return (-ESRCH);
-      }
-   hd = (struct WD33C93_hostdata *)instance->hostdata;
+	char *bp;
+	char tbuf[128];
+	struct Scsi_Host *instance;
+	struct WD33C93_hostdata *hd;
+	Scsi_Cmnd *cmd;
+	int x, i;
+	static int stop = 0;
+
+	instance = scsi_host_hn_get(hn);
+	if (!instance) {
+		printk("*** Hmm... Can't find host #%d!\n", hn);
+		return (-ESRCH);
+	}
+	hd = (struct WD33C93_hostdata *) instance->hostdata;
 
 /* If 'in' is TRUE we need to _read_ the proc file. We accept the following
  * keywords (same format as command-line, but only ONE per read):
@@ -1893,148 +1943,146 @@
  *    nodma
  */
 
-   if (in) {
-      buf[len] = '\0';
-      bp = buf;
-      if (!strncmp(bp,"debug:",6)) {
-         bp += 6;
-         hd->args = simple_strtoul(bp,NULL,0) & DB_MASK;
-         }
-      else if (!strncmp(bp,"disconnect:",11)) {
-         bp += 11;
-         x = simple_strtoul(bp,NULL,0);
-         if (x < DIS_NEVER || x > DIS_ALWAYS)
-            x = DIS_ADAPTIVE;
-         hd->disconnect = x;
-         }
-      else if (!strncmp(bp,"period:",7)) {
-         bp += 7;
-         x = simple_strtoul(bp,NULL,0);
-         hd->default_sx_per = sx_table[round_period((unsigned int)x)].period_ns;
-         }
-      else if (!strncmp(bp,"resync:",7)) {
-         bp += 7;
-         x = simple_strtoul(bp,NULL,0);
-         for (i=0; i<7; i++)
-            if (x & (1<<i))
-               hd->sync_stat[i] = SS_UNSET;
-         }
-      else if (!strncmp(bp,"proc:",5)) {
-         bp += 5;
-         hd->proc = simple_strtoul(bp,NULL,0);
-         }
-      else if (!strncmp(bp,"nodma:",6)) {
-         bp += 6;
-         hd->no_dma = simple_strtoul(bp,NULL,0);
-         }
-      else if (!strncmp(bp,"level2:",7)) {
-         bp += 7;
-         hd->level2 = simple_strtoul(bp,NULL,0);
-         }
-      return len;
-      }
-
-   spin_lock_irq(&hd->lock);
-   bp = buf;
-   *bp = '\0';
-   if (hd->proc & PR_VERSION) {
-      sprintf(tbuf,"\nVersion %s - %s. Compiled %s %s",
-            WD33C93_VERSION,WD33C93_DATE,__DATE__,__TIME__);
-      strcat(bp,tbuf);
-      }
-   if (hd->proc & PR_INFO) {
-      sprintf(tbuf,"\nclock_freq=%02x no_sync=%02x no_dma=%d",
-            hd->clock_freq,hd->no_sync,hd->no_dma);
-      strcat(bp,tbuf);
-      strcat(bp,"\nsync_xfer[] =       ");
-      for (x=0; x<7; x++) {
-         sprintf(tbuf,"\t%02x",hd->sync_xfer[x]);
-         strcat(bp,tbuf);
-         }
-      strcat(bp,"\nsync_stat[] =       ");
-      for (x=0; x<7; x++) {
-         sprintf(tbuf,"\t%02x",hd->sync_stat[x]);
-         strcat(bp,tbuf);
-         }
-      }
+	if (in) {
+		buf[len] = '\0';
+		bp = buf;
+		if (!strncmp(bp, "debug:", 6)) {
+			bp += 6;
+			hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK;
+		} else if (!strncmp(bp, "disconnect:", 11)) {
+			bp += 11;
+			x = simple_strtoul(bp, NULL, 0);
+			if (x < DIS_NEVER || x > DIS_ALWAYS)
+				x = DIS_ADAPTIVE;
+			hd->disconnect = x;
+		} else if (!strncmp(bp, "period:", 7)) {
+			bp += 7;
+			x = simple_strtoul(bp, NULL, 0);
+			hd->default_sx_per =
+			    sx_table[round_period((unsigned int) x)].period_ns;
+		} else if (!strncmp(bp, "resync:", 7)) {
+			bp += 7;
+			x = simple_strtoul(bp, NULL, 0);
+			for (i = 0; i < 7; i++)
+				if (x & (1 << i))
+					hd->sync_stat[i] = SS_UNSET;
+		} else if (!strncmp(bp, "proc:", 5)) {
+			bp += 5;
+			hd->proc = simple_strtoul(bp, NULL, 0);
+		} else if (!strncmp(bp, "nodma:", 6)) {
+			bp += 6;
+			hd->no_dma = simple_strtoul(bp, NULL, 0);
+		} else if (!strncmp(bp, "level2:", 7)) {
+			bp += 7;
+			hd->level2 = simple_strtoul(bp, NULL, 0);
+		}
+		return len;
+	}
+
+	spin_lock_irq(&hd->lock);
+	bp = buf;
+	*bp = '\0';
+	if (hd->proc & PR_VERSION) {
+		sprintf(tbuf, "\nVersion %s - %s. Compiled %s %s",
+			WD33C93_VERSION, WD33C93_DATE, __DATE__, __TIME__);
+		strcat(bp, tbuf);
+	}
+	if (hd->proc & PR_INFO) {
+		sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d",
+			hd->clock_freq, hd->no_sync, hd->no_dma);
+		strcat(bp, tbuf);
+		strcat(bp, "\nsync_xfer[] =       ");
+		for (x = 0; x < 7; x++) {
+			sprintf(tbuf, "\t%02x", hd->sync_xfer[x]);
+			strcat(bp, tbuf);
+		}
+		strcat(bp, "\nsync_stat[] =       ");
+		for (x = 0; x < 7; x++) {
+			sprintf(tbuf, "\t%02x", hd->sync_stat[x]);
+			strcat(bp, tbuf);
+		}
+	}
 #ifdef PROC_STATISTICS
-   if (hd->proc & PR_STATISTICS) {
-      strcat(bp,"\ncommands issued:    ");
-      for (x=0; x<7; x++) {
-         sprintf(tbuf,"\t%ld",hd->cmd_cnt[x]);
-         strcat(bp,tbuf);
-         }
-      strcat(bp,"\ndisconnects allowed:");
-      for (x=0; x<7; x++) {
-         sprintf(tbuf,"\t%ld",hd->disc_allowed_cnt[x]);
-         strcat(bp,tbuf);
-         }
-      strcat(bp,"\ndisconnects done:   ");
-      for (x=0; x<7; x++) {
-         sprintf(tbuf,"\t%ld",hd->disc_done_cnt[x]);
-         strcat(bp,tbuf);
-         }
-      sprintf(tbuf,"\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",
-            hd->int_cnt,hd->dma_cnt,hd->pio_cnt);
-      strcat(bp,tbuf);
-      }
+	if (hd->proc & PR_STATISTICS) {
+		strcat(bp, "\ncommands issued:    ");
+		for (x = 0; x < 7; x++) {
+			sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]);
+			strcat(bp, tbuf);
+		}
+		strcat(bp, "\ndisconnects allowed:");
+		for (x = 0; x < 7; x++) {
+			sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]);
+			strcat(bp, tbuf);
+		}
+		strcat(bp, "\ndisconnects done:   ");
+		for (x = 0; x < 7; x++) {
+			sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]);
+			strcat(bp, tbuf);
+		}
+		sprintf(tbuf,
+			"\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",
+			hd->int_cnt, hd->dma_cnt, hd->pio_cnt);
+		strcat(bp, tbuf);
+	}
 #endif
-   if (hd->proc & PR_CONNECTED) {
-      strcat(bp,"\nconnected:     ");
-      if (hd->connected) {
-         cmd = (Scsi_Cmnd *)hd->connected;
-         sprintf(tbuf," %ld-%d:%d(%02x)",
-               cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]);
-         strcat(bp,tbuf);
-         }
-      }
-   if (hd->proc & PR_INPUTQ) {
-      strcat(bp,"\ninput_Q:       ");
-      cmd = (Scsi_Cmnd *)hd->input_Q;
-      while (cmd) {
-         sprintf(tbuf," %ld-%d:%d(%02x)",
-               cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]);
-         strcat(bp,tbuf);
-         cmd = (Scsi_Cmnd *)cmd->host_scribble;
-         }
-      }
-   if (hd->proc & PR_DISCQ) {
-      strcat(bp,"\ndisconnected_Q:");
-      cmd = (Scsi_Cmnd *)hd->disconnected_Q;
-      while (cmd) {
-         sprintf(tbuf," %ld-%d:%d(%02x)",
-               cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]);
-         strcat(bp,tbuf);
-         cmd = (Scsi_Cmnd *)cmd->host_scribble;
-         }
-      }
-   strcat(bp,"\n");
-   spin_unlock_irq(&hd->lock);
-   *start = buf;
-   if (stop) {
-      stop = 0;
-      return 0;
-      }
-   if (off > 0x40000)   /* ALWAYS stop after 256k bytes have been read */
-      stop = 1;;
-   if (hd->proc & PR_STOP)    /* stop every other time */
-      stop = 1;
-   return strlen(bp);
-
-#else    /* PROC_INTERFACE */
-
-   return 0;
-
-#endif   /* PROC_INTERFACE */
+	if (hd->proc & PR_CONNECTED) {
+		strcat(bp, "\nconnected:     ");
+		if (hd->connected) {
+			cmd = (Scsi_Cmnd *) hd->connected;
+			sprintf(tbuf, " %ld-%d:%d(%02x)",
+				cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+			strcat(bp, tbuf);
+		}
+	}
+	if (hd->proc & PR_INPUTQ) {
+		strcat(bp, "\ninput_Q:       ");
+		cmd = (Scsi_Cmnd *) hd->input_Q;
+		while (cmd) {
+			sprintf(tbuf, " %ld-%d:%d(%02x)",
+				cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+			strcat(bp, tbuf);
+			cmd = (Scsi_Cmnd *) cmd->host_scribble;
+		}
+	}
+	if (hd->proc & PR_DISCQ) {
+		strcat(bp, "\ndisconnected_Q:");
+		cmd = (Scsi_Cmnd *) hd->disconnected_Q;
+		while (cmd) {
+			sprintf(tbuf, " %ld-%d:%d(%02x)",
+				cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+			strcat(bp, tbuf);
+			cmd = (Scsi_Cmnd *) cmd->host_scribble;
+		}
+	}
+	strcat(bp, "\n");
+	spin_unlock_irq(&hd->lock);
+	*start = buf;
+	if (stop) {
+		stop = 0;
+		return 0;
+	}
+	if (off > 0x40000)	/* ALWAYS stop after 256k bytes have been read */
+		stop = 1;;
+	if (hd->proc & PR_STOP)	/* stop every other time */
+		stop = 1;
+	return strlen(bp);
+
+#else				/* PROC_INTERFACE */
+
+	return 0;
+
+#endif				/* PROC_INTERFACE */
 
 }
 
-#ifdef MODULE
-int init_module(void) { return 0; }
-void cleanup_module(void) {}
-#endif
-void wd33c93_release(void)
+void
+wd33c93_release(void)
 {
 }
 
-MODULE_LICENSE("GPL");
+EXPORT_SYMBOL(wd33c93_reset);
+EXPORT_SYMBOL(wd33c93_init);
+EXPORT_SYMBOL(wd33c93_release);
+EXPORT_SYMBOL(wd33c93_abort);
+EXPORT_SYMBOL(wd33c93_queuecommand);
+EXPORT_SYMBOL(wd33c93_intr);
diff -urN linux-2.5.63-bk2/net/core/Makefile linux-2.5.63-bk3/net/core/Makefile
--- linux-2.5.63-bk2/net/core/Makefile	Mon Feb 24 11:05:44 2003
+++ linux-2.5.63-bk3/net/core/Makefile	Mon Mar 31 12:17:17 2003
@@ -19,5 +19,3 @@
 obj-$(CONFIG_NET_PROFILE) += profile.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.o
 obj-$(CONFIG_NET_RADIO) += wireless.o
-# Ugly. I wish all wireless drivers were moved in drivers/net/wireless
-obj-$(CONFIG_NET_PCMCIA_RADIO) += wireless.o
diff -urN linux-2.5.63-bk2/net/core/dev.c linux-2.5.63-bk3/net/core/dev.c
--- linux-2.5.63-bk2/net/core/dev.c	Mon Mar 31 12:17:11 2003
+++ linux-2.5.63-bk3/net/core/dev.c	Mon Mar 31 12:17:17 2003
@@ -107,10 +107,10 @@
 #include <linux/kmod.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
-#if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
+#ifdef CONFIG_NET_RADIO
 #include <linux/wireless.h>		/* Note : will define WIRELESS_EXT */
 #include <net/iw_handler.h>
-#endif	/* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
+#endif	/* CONFIG_NET_RADIO */
 #ifdef CONFIG_PLIP
 extern int plip_init(void);
 #endif
diff -urN linux-2.5.63-bk2/net/netsyms.c linux-2.5.63-bk3/net/netsyms.c
--- linux-2.5.63-bk2/net/netsyms.c	Mon Feb 24 11:05:16 2003
+++ linux-2.5.63-bk3/net/netsyms.c	Mon Mar 31 12:17:17 2003
@@ -646,12 +646,12 @@
 
 EXPORT_SYMBOL(softnet_data);
 
-#if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
+#ifdef CONFIG_NET_RADIO
 /* Don't include the whole header mess for a single function */
 union iwreq_data;
 extern void wireless_send_event(struct net_device *dev, unsigned int cmd, union iwreq_data *wrqu, char *extra);
 EXPORT_SYMBOL(wireless_send_event);
-#endif	/* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
+#endif	/* CONFIG_NET_RADIO */
 
 EXPORT_SYMBOL(linkwatch_fire_event);
 
diff -urN linux-2.5.63-bk2/net/socket.c linux-2.5.63-bk3/net/socket.c
--- linux-2.5.63-bk2/net/socket.c	Mon Feb 24 11:05:15 2003
+++ linux-2.5.63-bk3/net/socket.c	Mon Mar 31 12:17:17 2003
@@ -83,9 +83,9 @@
 #include <linux/kmod.h>
 #endif
 
-#if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
+#ifdef CONFIG_NET_RADIO
 #include <linux/wireless.h>		/* Note : will define WIRELESS_EXT */
-#endif	/* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
+#endif	/* CONFIG_NET_RADIO */
 
 #include <asm/uaccess.h>
 
