public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi uodate to remove io_request_lock
@ 2002-01-28  4:33 Evgeniy Polyakov
  2002-01-28  9:08 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Evgeniy Polyakov @ 2002-01-28  4:33 UTC (permalink / raw)
  To: Jens Axboe, Linus Torvalds; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 533 bytes --]

Hello, Jens Axboe, Linus Torvalds and other linux kernel hackers.

Here is patch against 2.5.3-pre5 which removes io_request_lock.
But unfortunnually here is 1 file (drivers/scsi/3w-xxxx.c), 
which still use spinning locks with io_request_lock because of detect()
method, in which we cann't send Scsi_Host pointer. So this file must be
corrected in some other way.

Also ./drivers/mtd/mtdblock_ro.c file still use this lock.

So, please check and apply.

Thanks in advance for answers and suggestions.

	Evgeniy Polyakov ( s0mbre ).

[-- Attachment #2: scsi.diff --]
[-- Type: application/octet-stream, Size: 62299 bytes --]

Only in ./linux/drivers/scsi/: .depend
diff -ur ./linux.orig/drivers/scsi/3w-xxxx.c ./linux/drivers/scsi/3w-xxxx.c
--- ./linux.orig/drivers/scsi/3w-xxxx.c	Sat Nov 10 01:05:02 2001
+++ ./linux/drivers/scsi/3w-xxxx.c	Mon Jan 28 06:43:30 2002
@@ -1326,7 +1326,7 @@
 	TW_Command *command_packet;
 	if (test_and_set_bit(TW_IN_INTR, &tw_dev->flags))
 		return;
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&tw_dev->host->host_lock, flags);
 
 	if (tw_dev->tw_pci_dev->irq == irq) {
 		spin_lock(&tw_dev->tw_lock);
@@ -1475,7 +1475,7 @@
 		}
 		spin_unlock(&tw_dev->tw_lock);
 	}
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&tw_dev->host->host_lock, flags);
 	clear_bit(TW_IN_INTR, &tw_dev->flags);
 }	/* End tw_interrupt() */
 
@@ -1929,9 +1929,9 @@
 	}
 
 	/* We have to let AEN requests through before the reset */
-	spin_unlock_irq(&io_request_lock);
+	spin_unlock_irq(&tw_dev->host->host_lock);
 	mdelay(TW_AEN_WAIT_TIME);
-	spin_lock_irq(&io_request_lock);
+	spin_lock_irq(&tw_dev->host->host_lock);
 
 	spin_lock(&tw_dev->tw_lock);
 	tw_dev->num_aborts++;
@@ -1993,9 +1993,9 @@
 	}
 
 	/* We have to let AEN requests through before the reset */
-	spin_unlock_irq(&io_request_lock);
+	spin_unlock_irq(&tw_dev->host->host_lock);
 	mdelay(TW_AEN_WAIT_TIME);
-	spin_lock_irq(&io_request_lock);
+	spin_lock_irq(&tw_dev->host->host_lock);
 
 	spin_lock(&tw_dev->tw_lock);
 	tw_dev->num_resets++;
Only in ./linux/drivers/scsi/: 3w-xxxx.c~
diff -ur ./linux.orig/drivers/scsi/53c7,8xx.c ./linux/drivers/scsi/53c7,8xx.c
--- ./linux.orig/drivers/scsi/53c7,8xx.c	Tue Nov 27 01:23:58 2001
+++ ./linux/drivers/scsi/53c7,8xx.c	Mon Jan 28 05:41:57 2002
@@ -1108,9 +1108,9 @@
 
     if (!search) {
 #ifdef __powerpc__
-	if (request_irq(host->irq, do_NCR53c7x0_intr, SA_SHIRQ, "53c7,8xx", NULL)) 
+	if (request_irq(host->irq, do_NCR53c7x0_intr, SA_SHIRQ, "53c7,8xx", host)) 
 #else
-	if (request_irq(host->irq, do_NCR53c7x0_intr, SA_INTERRUPT, "53c7,8xx", NULL))
+	if (request_irq(host->irq, do_NCR53c7x0_intr, SA_INTERRUPT, "53c7,8xx", host))
 #endif
 	  {
 	  
@@ -4360,9 +4360,11 @@
 do_NCR53c7x0_intr(int irq, void *dev_id, struct pt_regs * regs) {
     unsigned long flags;
 
-    spin_lock_irqsave(&io_request_lock, flags);
+    struct Scsi_Host *dev = dev_id;
+    
+    spin_lock_irqsave(&dev->host_lock, flags);
     NCR53c7x0_intr(irq, dev_id, regs);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 /*
Only in ./linux/drivers/scsi/: 53c7,8xx.c~
diff -ur ./linux.orig/drivers/scsi/53c700.c ./linux/drivers/scsi/53c700.c
--- ./linux.orig/drivers/scsi/53c700.c	Wed Nov 28 21:22:27 2001
+++ ./linux/drivers/scsi/53c700.c	Mon Jan 28 06:47:06 2002
@@ -1508,18 +1508,7 @@
 	__u8 pun = 0xff, lun = 0xff;
 	unsigned long flags;
 
-	/* Unfortunately, we have to take the io_request_lock here
-	 * rather than the host lock hostdata->lock because we're
-	 * looking to exclude queuecommand from messing with the
-	 * registers while we're processing the interrupt.  Since
-	 * queuecommand is called holding io_request_lock, and we have
-	 * to take io_request_lock before we call the command
-	 * scsi_done, we would get a deadlock if we took
-	 * hostdata->lock here and in queuecommand (because the order
-	 * of locking in queuecommand: 1) io_request_lock then 2)
-	 * hostdata->lock would be the reverse of taking it in this
-	 * routine */
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&host->host_lock, flags);
 	if((istat = NCR_700_readb(host, ISTAT_REG))
 	      & (SCSI_INT_PENDING | DMA_INT_PENDING)) {
 		__u32 dsps;
@@ -1764,7 +1753,7 @@
 		}
 	}
  out_unlock:
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&host->host_lock, flags);
 }
 
 /* FIXME: Need to put some proc information in and plumb it
Only in ./linux/drivers/scsi/: 53c700.c~
diff -ur ./linux.orig/drivers/scsi/AM53C974.c ./linux/drivers/scsi/AM53C974.c
--- ./linux.orig/drivers/scsi/AM53C974.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/AM53C974.c	Mon Jan 28 05:54:08 2002
@@ -1021,10 +1021,11 @@
 static void do_AM53C974_intr(int irq, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
-	spin_lock_irqsave(&io_request_lock, flags);
+	struct Scsi_Host *dev = dev_id;
+	
+	spin_lock_irqsave(&dev->hpst_lock, flags);
 	AM53C974_intr(irq, dev_id, regs);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 /************************************************************************
Only in ./linux/drivers/scsi/: AM53C974.c~
diff -ur ./linux.orig/drivers/scsi/NCR5380.c ./linux/drivers/scsi/NCR5380.c
--- ./linux.orig/drivers/scsi/NCR5380.c	Sat Feb 17 03:02:36 2001
+++ ./linux/drivers/scsi/NCR5380.c	Mon Jan 28 05:25:36 2002
@@ -692,9 +692,9 @@
 	}
 	restore_flags(flags);
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&instance->host_lock, flags);
 	run_main();
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&instance->host_lock, flags);
 }
 #endif				/* def USLEEP */
 
@@ -745,7 +745,7 @@
 	NCR5380_setup(instance);
 
 	for (trying_irqs = i = 0, mask = 1; i < 16; ++i, mask <<= 1)
-		if ((mask & possible) && (request_irq(i, &probe_intr, SA_INTERRUPT, "NCR-probe", NULL)
+		if ((mask & possible) && (request_irq(i, &probe_intr, SA_INTERRUPT, "NCR-probe", instance)
 					  == 0))
 			trying_irqs |= mask;
 
@@ -1271,7 +1271,7 @@
 	 * this should prevent any race conditions.
 	 */
 
-	spin_unlock_irq(&io_request_lock);
+	spin_unlock_irq(&instance->host_lock);
 	
 	save_flags(flags);
 	
@@ -1424,7 +1424,7 @@
 				break;
 		}		/* for instance */
 	} while (!done);
-	spin_lock_irq(&io_request_lock);
+	spin_lock_irq(&instance->host_lock);
   /* 	cli();*/
 	main_running = 0;
 }
@@ -1521,10 +1521,10 @@
 							{
 								unsigned long timeout = jiffies + NCR_TIMEOUT;
 
-								spin_unlock_irq(&io_request_lock);
+								spin_unlock_irq(&instance->host_lock);
 								while (NCR5380_read(BUS_AND_STATUS_REG) & BASR_ACK
 								       && time_before(jiffies, timeout));
-								spin_lock_irq(&io_request_lock);
+								spin_lock_irq(&instance->host_lock);
 								
 								if (time_after_eq(jiffies, timeout) )
 									printk("scsi%d: timeout at NCR5380.c:%d\n",
@@ -1554,10 +1554,12 @@
 
 static void do_NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
 	unsigned long flags;
-
-	 spin_lock_irqsave(&io_request_lock, flags);
+	 
+	 struct Scsi_Host *dev = dev_id;
+	
+	 spin_lock_irqsave(&dev->host_lock, flags);
 	 NCR5380_intr(irq, dev_id, regs);
-	 spin_unlock_irqrestore(&io_request_lock, flags);
+	 spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 #endif
@@ -1669,12 +1671,12 @@
 	{
 		unsigned long timeout = jiffies + 2 * NCR_TIMEOUT;
 
-		spin_unlock_irq(&io_request_lock);
+		spin_unlock_irq(&instance->host_lock);
 
 		while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS)
 		       && time_before(jiffies,timeout));
 
-		spin_lock_irq(&io_request_lock);
+		spin_lock_irq(&instance->host_lock);
 		       
 		if (time_after_eq(jiffies,timeout)) {
 			printk("scsi: arbitration timeout at %d\n", __LINE__);
@@ -1834,10 +1836,10 @@
 	hostdata->selecting = 0; /* clear this pointer, because we passed the
 				waiting period */
 #else
-	spin_unlock_irq(&io_request_lock);
+	spin_unlock_irq(&instance->host_lock);
 	while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) &
 					(SR_BSY | SR_IO)));
-	spin_lock_irq(&io_request_lock);
+	spin_lock_irq(&instance->host_lock);
 #endif
 	if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) ==
 	    (SR_SEL | SR_IO)) {
@@ -1905,9 +1907,9 @@
 	{
 		unsigned long timeout = jiffies + NCR_TIMEOUT;
 
-		spin_unlock_irq(&io_request_lock);
+		spin_unlock_irq(&instance->host_lock);
 		while (!(NCR5380_read(STATUS_REG) & SR_REQ) && time_before(jiffies, timeout));
-		spin_lock_irq(&io_request_lock);
+		spin_lock_irq(&instance->host_lock);
 		
 		if (time_after_eq(jiffies, timeout)) {
 			printk("scsi%d: timeout at NCR5380.c:%d\n", instance->host_no, __LINE__);
Only in ./linux/drivers/scsi/: NCR5380.c~
diff -ur ./linux.orig/drivers/scsi/NCR53C9x.c ./linux/drivers/scsi/NCR53C9x.c
--- ./linux.orig/drivers/scsi/NCR53C9x.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/NCR53C9x.c	Mon Jan 28 06:30:44 2002
@@ -3546,9 +3546,10 @@
 	struct NCR_ESP *esp;
 	unsigned long flags;
 	int again;
+	struct Scsi_Host *dev = dev_id;
 
 	/* Handle all ESP interrupts showing at this IRQ level. */
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 repeat:
 	again = 0;
 	for_each_esp(esp) {
@@ -3572,7 +3573,7 @@
 	}
 	if(again)
 		goto repeat;
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 #else
 /* For SMP we only service one ESP on the list list at our IRQ level! */
@@ -3580,9 +3581,10 @@
 {
 	struct NCR_ESP *esp;
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	/* Handle all ESP interrupts showing at this IRQ level. */
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 	for_each_esp(esp) {
 		if(((esp)->irq & 0xf) == irq) {
 			if(esp->dma_irq_p(esp)) {
@@ -3599,7 +3601,7 @@
 		}
 	}
 out:
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 #endif
 
Only in ./linux/drivers/scsi/: NCR53C9x.c~
diff -ur ./linux.orig/drivers/scsi/NCR53c406a.c ./linux/drivers/scsi/NCR53c406a.c
--- ./linux.orig/drivers/scsi/NCR53c406a.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/NCR53c406a.c	Mon Jan 28 04:51:26 2002
@@ -537,7 +537,7 @@
     DEB(printk("NCR53c406a: using port_base %x\n", port_base));
     
     if(irq_level > 0) {
-        if(request_irq(irq_level, do_NCR53c406a_intr, 0, "NCR53c406a", NULL)){
+        if(request_irq(irq_level, do_NCR53c406a_intr, 0, "NCR53c406a", shpnt)){
             printk("NCR53c406a: unable to allocate IRQ %d\n", irq_level);
             goto err_release;
         }
@@ -780,10 +780,11 @@
      static void
 do_NCR53c406a_intr(int unused, void *dev_id, struct pt_regs *regs){
     unsigned long flags;
-
-    spin_lock_irqsave(&io_request_lock, flags);
+    struct Scsi_Host * dev = dev_id;
+    
+    spin_lock_irqsave(&dev->host_lock, flags);
     NCR53c406a_intr(0, dev_id, regs);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
      static void
Only in ./linux/drivers/scsi/: NCR53c406a.c~
diff -ur ./linux.orig/drivers/scsi/a2091.c ./linux/drivers/scsi/a2091.c
--- ./linux.orig/drivers/scsi/a2091.c	Fri Oct 26 00:53:48 2001
+++ ./linux/drivers/scsi/a2091.c	Mon Jan 28 05:57:24 2002
@@ -40,9 +40,9 @@
 		continue;
 
 	if (status & ISTR_INTS) {
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&instance->host_lock, flags);
 		wd33c93_intr (instance);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&instance->host_lock, flags);
 	}
     }
 }
Only in ./linux/drivers/scsi/: a2091.c~
diff -ur ./linux.orig/drivers/scsi/a3000.c ./linux/drivers/scsi/a3000.c
--- ./linux.orig/drivers/scsi/a3000.c	Fri Oct 26 00:53:48 2001
+++ ./linux/drivers/scsi/a3000.c	Mon Jan 28 05:58:57 2002
@@ -30,14 +30,15 @@
 {
 	unsigned long flags;
 	unsigned int status = DMA(a3000_host)->ISTR;
-
+	struct Scsi_Host *dev = dummy;
+	
 	if (!(status & ISTR_INT_P))
 		return;
 	if (status & ISTR_INTS)
 	{
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		wd33c93_intr (a3000_host);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 	} else
 		printk("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n",
 		       status);
Only in ./linux/drivers/scsi/: a3000.c~
Only in ./linux/drivers/scsi/aic7xxx: .depend
diff -ur ./linux.orig/drivers/scsi/atp870u.c ./linux/drivers/scsi/atp870u.c
--- ./linux.orig/drivers/scsi/atp870u.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/atp870u.c	Mon Jan 28 06:36:08 2002
@@ -433,7 +433,7 @@
 			/*
 			 *	Complete the command
 			 */
-			spin_lock_irqsave(&io_request_lock, flags);
+			spin_lock_irqsave(&workrequ->host->host_lock, flags);
 			(*workrequ->scsi_done) (workrequ);
 
 			/*
@@ -441,7 +441,7 @@
 			 */
 			dev->id[target_id].curr_req = 0;
 			dev->working--;
-			spin_unlock_irqrestore(&io_request_lock, flags);
+			spin_unlock_irqrestore(&workrequ->host->host_lock, flags);
 			/*
 			 *	Take it back wide
 			 */
Only in ./linux/drivers/scsi/: atp870u.c~
diff -ur ./linux.orig/drivers/scsi/blz1230.c ./linux/drivers/scsi/blz1230.c
--- ./linux.orig/drivers/scsi/blz1230.c	Fri Oct 26 00:53:49 2001
+++ ./linux/drivers/scsi/blz1230.c	Mon Jan 28 06:28:46 2002
@@ -137,7 +137,7 @@
 		esp->irq = IRQ_AMIGA_PORTS;
 		esp->slot = board+REAL_BLZ1230_ESP_ADDR;
 		if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
-				 "Blizzard 1230 SCSI IV", esp_intr))
+				 "Blizzard 1230 SCSI IV", esp->ehost))
 			goto err_out;
 
 		/* Figure out our scsi ID on the bus */
Only in ./linux/drivers/scsi/: blz1230.c~
diff -ur ./linux.orig/drivers/scsi/blz2060.c ./linux/drivers/scsi/blz2060.c
--- ./linux.orig/drivers/scsi/blz2060.c	Fri Oct 26 00:53:49 2001
+++ ./linux/drivers/scsi/blz2060.c	Mon Jan 28 06:27:57 2002
@@ -115,7 +115,7 @@
 
 		esp->irq = IRQ_AMIGA_PORTS;
 		request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
-			    "Blizzard 2060 SCSI", esp_intr);
+			    "Blizzard 2060 SCSI", esp->ehost);
 
 		/* Figure out our scsi ID on the bus */
 		esp->scsi_id = 7;
Only in ./linux/drivers/scsi/: blz2060.c~
diff -ur ./linux.orig/drivers/scsi/cyberstorm.c ./linux/drivers/scsi/cyberstorm.c
--- ./linux.orig/drivers/scsi/cyberstorm.c	Fri Oct 26 00:53:50 2001
+++ ./linux/drivers/scsi/cyberstorm.c	Mon Jan 28 06:27:34 2002
@@ -136,7 +136,7 @@
 
 		esp->irq = IRQ_AMIGA_PORTS;
 		request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
-			    "CyberStorm SCSI", esp_intr);
+			    "CyberStorm SCSI", esp->ehost);
 		/* Figure out our scsi ID on the bus */
 		/* The DMA cond flag contains a hardcoded jumper bit
 		 * which can be used to select host number 6 or 7.
Only in ./linux/drivers/scsi/: cyberstorm.c~
diff -ur ./linux.orig/drivers/scsi/cyberstormII.c ./linux/drivers/scsi/cyberstormII.c
--- ./linux.orig/drivers/scsi/cyberstormII.c	Fri Oct 26 00:53:50 2001
+++ ./linux/drivers/scsi/cyberstormII.c	Mon Jan 28 06:27:11 2002
@@ -130,7 +130,7 @@
 
 		esp->irq = IRQ_AMIGA_PORTS;
 		request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
-			    "CyberStorm SCSI Mk II", esp_intr);
+			    "CyberStorm SCSI Mk II", esp->ehost);
 
 		/* Figure out our scsi ID on the bus */
 		esp->scsi_id = 7;
Only in ./linux/drivers/scsi/: cyberstormII.c~
diff -ur ./linux.orig/drivers/scsi/dec_esp.c ./linux/drivers/scsi/dec_esp.c
--- ./linux.orig/drivers/scsi/dec_esp.c	Sun Sep  9 21:52:35 2001
+++ ./linux/drivers/scsi/dec_esp.c	Mon Jan 28 06:22:58 2002
@@ -189,10 +189,10 @@
 		esp_initialize(esp);
 
 		if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, 
-				"NCR 53C94 SCSI", NULL))
+				"NCR 53C94 SCSI", esp->ehost))
 			goto err_dealloc;
 		if (request_irq(SCSI_DMA_INT, scsi_dma_int, SA_INTERRUPT, 
-				"JUNKIO SCSI DMA", NULL))
+				"JUNKIO SCSI DMA", esp->ehost))
 			goto err_free_irq;
  			
 	}
@@ -253,7 +253,7 @@
 			esp->dma_advance_sg = 0;
 
  			if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, 
- 					 "PMAZ_AA", NULL)) {
+ 					 "PMAZ_AA", esp->ehost)) {
  				esp_deallocate(esp);
  				release_tc_card(slot);
  				continue;
Only in ./linux/drivers/scsi/: dec_esp.c~
diff -ur ./linux.orig/drivers/scsi/dtc.c ./linux/drivers/scsi/dtc.c
--- ./linux.orig/drivers/scsi/dtc.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/dtc.c	Mon Jan 28 05:29:13 2002
@@ -259,7 +259,7 @@
 /* With interrupts enabled, it will sometimes hang when doing heavy
  * reads. So better not enable them until I finger it out. */
       if (instance->irq != IRQ_NONE)
-	 if (request_irq(instance->irq, do_dtc_intr, SA_INTERRUPT, "dtc")) {
+	 if (request_irq(instance->irq, do_dtc_intr, SA_INTERRUPT, "dtc", instance)) {
 	 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
 	      instance->host_no, instance->irq);
 	 instance->irq = IRQ_NONE;
Only in ./linux/drivers/scsi/: dtc.c~
diff -ur ./linux.orig/drivers/scsi/eata_dma.c ./linux/drivers/scsi/eata_dma.c
--- ./linux.orig/drivers/scsi/eata_dma.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/eata_dma.c	Mon Jan 28 05:44:41 2002
@@ -229,10 +229,11 @@
 void do_eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
 {
     unsigned long flags;
-
-    spin_lock_irqsave(&io_request_lock, flags);
+    struct Scsi_Host *dev = dev_id;
+    
+    spin_lock_irqsave(&dev->host_lock, flags);
     eata_int_handler(irq, dev_id, regs);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 void eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
@@ -1503,7 +1504,7 @@
 	if (reg_IRQ[i] >= 1){       /* exchange the interrupt handler which  */
 	    free_irq(i, NULL);      /* we used for probing with the real one */
 	    request_irq(i, (void *)(do_eata_int_handler), SA_INTERRUPT|SA_SHIRQ, 
-			"eata_dma", NULL);
+			"eata_dma", first_HBA); /* Check it */
 	}
     }
 
Only in ./linux/drivers/scsi/: eata_dma.c~
diff -ur ./linux.orig/drivers/scsi/eata_pio.c ./linux/drivers/scsi/eata_pio.c
--- ./linux.orig/drivers/scsi/eata_pio.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/eata_pio.c	Mon Jan 28 05:53:08 2002
@@ -110,10 +110,11 @@
 void do_eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
 {
     unsigned long flags;
-
-    spin_lock_irqsave(&io_request_lock, flags);
+    struct Scsi_Host *dev = dev_id;
+    
+    spin_lock_irqsave(&dev->host_lock, flags);
     eata_pio_int_handler(irq, dev_id, regs);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
@@ -704,34 +705,36 @@
 	return (FALSE);
     }
     
+    request_region(base, 8, "eata_pio");
+    
+    size = sizeof(hostdata) + (sizeof(struct eata_ccb) * ntohs(gc->queuesiz));
+    
+    sh = scsi_register(tpnt, size);
+    if(sh == NULL)
+    {
+    	release_region(base, 8);
+    	return FALSE;
+    }
+    
     if (!reg_IRQ[gc->IRQ]) {    /* Interrupt already registered ? */
 	if (!request_irq(gc->IRQ, do_eata_pio_int_handler, SA_INTERRUPT, 
-			 "EATA-PIO", NULL)){
+			 "EATA-PIO", sh)){
 	    reg_IRQ[gc->IRQ]++;
 	    if (!gc->IRQ_TR)
 		reg_IRQL[gc->IRQ] = TRUE;   /* IRQ is edge triggered */
 	} else {
 	    printk("Couldn't allocate IRQ %d, Sorry.\n", gc->IRQ);
+	    release_region(base, 8);
 	    return (FALSE);
 	}
     } else {            /* More than one HBA on this IRQ */
 	if (reg_IRQL[gc->IRQ] == TRUE) {
 	    printk("Can't support more than one HBA on this IRQ,\n"
 		   "  if the IRQ is edge triggered. Sorry.\n");
+	    release_region(base, 8);
 	    return (FALSE);
 	} else
 	    reg_IRQ[gc->IRQ]++;
-    }
-    
-    request_region(base, 8, "eata_pio");
-    
-    size = sizeof(hostdata) + (sizeof(struct eata_ccb) * ntohs(gc->queuesiz));
-    
-    sh = scsi_register(tpnt, size);
-    if(sh == NULL)
-    {
-    	release_region(base, 8);
-    	return FALSE;
     }
     
     hd = SD(sh);                   
Only in ./linux/drivers/scsi/: eata_pio.c~
diff -ur ./linux.orig/drivers/scsi/esp.c ./linux/drivers/scsi/esp.c
--- ./linux.orig/drivers/scsi/esp.c	Mon Jan 28 06:55:16 2002
+++ ./linux/drivers/scsi/esp.c	Mon Jan 28 06:29:27 2002
@@ -813,7 +813,7 @@
 	 * sanely maintain.
 	 */
 	if (request_irq(esp->ehost->irq, esp_intr,
-			SA_SHIRQ, "ESP SCSI", esp)) {
+			SA_SHIRQ, "ESP SCSI", esp->ehost)) {
 		printk("esp%d: Cannot acquire irq line\n",
 		       esp->esp_id);
 		return -1;
Only in ./linux/drivers/scsi/: esp.c~
diff -ur ./linux.orig/drivers/scsi/fastlane.c ./linux/drivers/scsi/fastlane.c
--- ./linux.orig/drivers/scsi/fastlane.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/fastlane.c	Mon Jan 28 06:28:15 2002
@@ -167,7 +167,7 @@
 		esp->irq = IRQ_AMIGA_PORTS;
 		esp->slot = board+FASTLANE_ESP_ADDR;
 		if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
-				"Fastlane SCSI", esp_intr)) {
+				"Fastlane SCSI", esp->ehost)) {
 			printk(KERN_WARNING "Fastlane: Could not get IRQ%d, aborting.\n", IRQ_AMIGA_PORTS);
 			goto err_unmap;
 		}			
Only in ./linux/drivers/scsi/: fastlane.c~
diff -ur ./linux.orig/drivers/scsi/fd_mcs.c ./linux/drivers/scsi/fd_mcs.c
--- ./linux.orig/drivers/scsi/fd_mcs.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/fd_mcs.c	Mon Jan 28 06:33:48 2002
@@ -740,9 +740,9 @@
 #if EVERY_ACCESS
       printk( " AFAIL " );
 #endif
-      spin_lock_irqsave(&io_request_lock, flags);
+      spin_lock_irqsave(&shpnt->host_lock, flags);
       my_done( shpnt, DID_BUS_BUSY << 16 );
-      spin_unlock_irqrestore(&io_request_lock, flags);
+      spin_unlock_irqrestore(&shpnt->host_lock, flags);
       return;
     }
     current_SC->SCp.phase = in_selection;
@@ -766,9 +766,9 @@
 #if EVERY_ACCESS
 	printk( " SFAIL " );
 #endif
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&shpnt->host_lock, flags);
 	my_done( shpnt, DID_NO_CONNECT << 16 );
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&shpnt->host_lock, flags);
 	return;
       } else {
 #if EVERY_ACCESS
@@ -1117,11 +1117,11 @@
 #if EVERY_ACCESS
     printk( "BEFORE MY_DONE. . ." );
 #endif
-    spin_lock_irqsave(&io_request_lock, flags);
+    spin_lock_irqsave(&shpnt->host_lock, flags);
     my_done( shpnt,
 	     (current_SC->SCp.Status & 0xff)
 	     | ((current_SC->SCp.Message & 0xff) << 8) | (DID_OK << 16) );
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&shpnt->host_lock, flags);
 #if EVERY_ACCESS
     printk( "RETURNING.\n" );
 #endif
@@ -1342,9 +1342,9 @@
   restore_flags( flags );
    
   /* Aborts are not done well. . . */
-  spin_lock_irqsave(&io_request_lock, flags);
+  spin_lock_irqsave(&shpnt->host_lock, flags);
   my_done( shpnt, DID_ABORT << 16 );
-  spin_unlock_irqrestore(&io_request_lock, flags);
+  spin_unlock_irqrestore(&shpnt->host_lock, flags);
 
   return SCSI_ABORT_SUCCESS;
 }
Only in ./linux/drivers/scsi/: fd_mcs.c~
diff -ur ./linux.orig/drivers/scsi/gdth.c ./linux/drivers/scsi/gdth.c
--- ./linux.orig/drivers/scsi/gdth.c	Sat Nov 10 01:05:06 2001
+++ ./linux/drivers/scsi/gdth.c	Mon Jan 28 05:19:07 2002
@@ -629,19 +629,19 @@
 #define GDTH_LOCK_HA(ha,flags)          spin_lock_irqsave(&(ha)->smp_lock,flags)
 #define GDTH_UNLOCK_HA(ha,flags)        spin_unlock_irqrestore(&(ha)->smp_lock,flags)
 
-#define GDTH_LOCK_SCSI_DONE(flags)      spin_lock_irqsave(&io_request_lock,flags)
-#define GDTH_UNLOCK_SCSI_DONE(flags)    spin_unlock_irqrestore(&io_request_lock,flags)
-#define GDTH_LOCK_SCSI_DOCMD()          spin_lock_irq(&io_request_lock)
-#define GDTH_UNLOCK_SCSI_DOCMD()        spin_unlock_irq(&io_request_lock)
+#define GDTH_LOCK_SCSI_DONE(dev, flags)      spin_lock_irqsave(&((struct Scsi_Host *)dev)->host_lock,flags)
+#define GDTH_UNLOCK_SCSI_DONE(flags)    spin_unlock_irqrestore(&((struct Scsi_Host *)dev)->host_lock,flags)
+#define GDTH_LOCK_SCSI_DOCMD(dev)          spin_lock_irq(&((struct Scsi_Host *)dev)->host_lock)
+#define GDTH_UNLOCK_SCSI_DOCMD(dev)        spin_unlock_irq(&((struct Scsi_Host *)dev)->host_lock)
 #else
 #define GDTH_INIT_LOCK_HA(ha)           do {} while (0)
 #define GDTH_LOCK_HA(ha,flags)          do {save_flags(flags); cli();} while (0)
 #define GDTH_UNLOCK_HA(ha,flags)        do {restore_flags(flags);} while (0)
 
-#define GDTH_LOCK_SCSI_DONE(flags)      do {} while (0)
-#define GDTH_UNLOCK_SCSI_DONE(flags)    do {} while (0)
-#define GDTH_LOCK_SCSI_DOCMD()          do {} while (0)
-#define GDTH_UNLOCK_SCSI_DOCMD()        do {} while (0)
+#define GDTH_LOCK_SCSI_DONE(dev, flags)      do {} while (0)
+#define GDTH_UNLOCK_SCSI_DONE(dev, flags)    do {} while (0)
+#define GDTH_LOCK_SCSI_DOCMD(dev)          do {} while (0)
+#define GDTH_UNLOCK_SCSI_DOCMD(dev)        do {} while (0)
 #endif
 
 /* LILO and modprobe/insmod parameters */
@@ -3339,9 +3339,9 @@
     if (rval == 2) {
         gdth_putq(hanum,scp,scp->SCp.this_residual);
     } else if (rval == 1) {
-        GDTH_LOCK_SCSI_DONE(flags);
+        GDTH_LOCK_SCSI_DONE(scp->host, flags);
         scp->scsi_done(scp);
-        GDTH_UNLOCK_SCSI_DONE(flags);
+        GDTH_UNLOCK_SCSI_DONE(scp->host,flags);
     }
     gdth_next(hanum);
 }
Only in ./linux/drivers/scsi/: gdth.c~
diff -ur ./linux.orig/drivers/scsi/gvp11.c ./linux/drivers/scsi/gvp11.c
--- ./linux.orig/drivers/scsi/gvp11.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/gvp11.c	Mon Jan 28 05:59:28 2002
@@ -40,9 +40,9 @@
 	if (!(status & GVP11_DMAC_INT_PENDING))
 	    continue;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&instance->host_lock, flags);
 	wd33c93_intr (instance);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&instance->host_lock, flags);
     }
 }
 
Only in ./linux/drivers/scsi/: gvp11.c~
diff -ur ./linux.orig/drivers/scsi/ibmmca.c ./linux/drivers/scsi/ibmmca.c
--- ./linux.orig/drivers/scsi/ibmmca.c	Wed May  2 03:05:00 2001
+++ ./linux/drivers/scsi/ibmmca.c	Mon Jan 28 05:40:08 2002
@@ -41,8 +41,8 @@
 /* current version of this driver-source: */
 #define IBMMCA_SCSI_DRIVER_VERSION "4.0b"
 
-#define IBMLOCK spin_lock_irqsave(&io_request_lock, flags);
-#define IBMUNLOCK spin_unlock_irqrestore(&io_request_lock, flags);
+#define IBMLOCK(dev) spin_lock_irqsave(&((struct Scsi_Host *)dev)->host_lock, flags);
+#define IBMUNLOCK(dev) spin_unlock_irqrestore(&((struct Scsi_Host *)dev)->host_lock, flags);
 
 /* driver configuration */
 #define IM_MAX_HOSTS     8 /* maximum number of host adapters */
@@ -505,14 +505,14 @@
    Scsi_Cmnd *cmd;
    int lastSCSI;
 
-   IBMLOCK
+   IBMLOCK(dev_id)
    /* search for one adapter-response on shared interrupt */
    for (host_index=0;
 	hosts[host_index] && !(inb(IM_STAT_REG(host_index)) & IM_INTR_REQUEST);
 	host_index++);
    /* return if some other device on this IRQ caused the interrupt */
    if (!hosts[host_index]) {
-      IBMUNLOCK
+      IBMUNLOCK(dev_id)
       return;
    }
 
@@ -521,15 +521,15 @@
    if ((reset_status(host_index) == IM_RESET_NOT_IN_PROGRESS_NO_INT)||
        (reset_status(host_index) == IM_RESET_FINISHED_OK_NO_INT)) {
       reset_status(host_index) = IM_RESET_NOT_IN_PROGRESS;
-      IBMUNLOCK
+      IBMUNLOCK(dev_id)
       return;
    }
 
    /*must wait for attention reg not busy, then send EOI to subsystem */
    while (1) {
       if (!(inb (IM_STAT_REG(host_index)) & IM_BUSY)) break;
-      IBMUNLOCK /* cycle interrupt */
-      IBMLOCK
+      IBMUNLOCK(dev_id) /* cycle interrupt */
+      IBMLOCK(dev_id)
    }
    ihost_index=host_index;
    /*get command result and logical device */
@@ -539,7 +539,7 @@
    /* get the last_scsi_command here */
    lastSCSI = last_scsi_command(ihost_index)[ldn];
    outb (IM_EOI | ldn, IM_ATTN_REG(ihost_index));
-   IBMUNLOCK
+   IBMUNLOCK(dev_id)
    /*these should never happen (hw fails, or a local programming bug) */
    if (!global_command_error_excuse) {
       switch (cmd_result) {
@@ -731,14 +731,14 @@
    unsigned long flags;
    /* must wait for attention reg not busy */
    while (1) {
-      IBMLOCK
+      IBMLOCK(hosts[host_index])
       if (!(inb(IM_STAT_REG(host_index)) & IM_BUSY)) break;
-      IBMUNLOCK
+      IBMUNLOCK(hosts[host_index])
    }
    /* write registers and enable system interrupts */
    outl (cmd_reg, IM_CMD_REG(host_index));
    outb (attn_reg, IM_ATTN_REG(host_index));
-   IBMUNLOCK
+   IBMUNLOCK(hosts[host_index])
    return;
 }
 
@@ -1442,7 +1442,7 @@
    unsigned int pos[8];
    unsigned long flags;
 
-   IBMLOCK
+   IBMLOCK(dev)
    shpnt = dev; /* assign host-structure to local pointer */
    len = 0; /* set filled text-buffer index to 0 */
    /* get the _special contents of the hostdata structure */
@@ -1496,7 +1496,7 @@
    while ( len % sizeof( int ) != ( sizeof ( int ) - 1 ) )
      len += sprintf (buf+len, " ");
    len += sprintf (buf+len, "\n");
-   IBMUNLOCK
+   IBMUNLOCK(shpnt)
    return len;
 }
 
@@ -2192,7 +2192,7 @@
 #ifdef IM_DEBUG_PROBE
    printk("IBM MCA SCSI: Abort subroutine called...\n");
 #endif
-   IBMLOCK
+   IBMLOCK(cmd->host)
    shpnt = cmd->host;
    /* search for the right hostadapter */
    for (host_index = 0; hosts[host_index] && hosts[host_index]->host_no != shpnt->host_no; host_index++);
@@ -2201,7 +2201,7 @@
       cmd->result = DID_NO_CONNECT << 16;
       if (cmd->scsi_done) (cmd->scsi_done) (cmd);
       shpnt = cmd->host;
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
 #ifdef IM_DEBUG_PROBE
       printk("IBM MCA SCSI: Abort adapter selection failed!\n");
 #endif
@@ -2224,7 +2224,7 @@
 
    /*if cmd for this ldn has already finished, no need to abort */
    if (!ld(host_index)[ldn].cmd) {
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
       return SCSI_ABORT_NOT_RUNNING;
    }
 
@@ -2244,13 +2244,13 @@
    while (1) {
       if (!(inb (IM_STAT_REG(host_index)) & IM_BUSY))
 	break;
-      IBMUNLOCK
-      IBMLOCK
+      IBMUNLOCK(shpnt)
+      IBMLOCK(shpnt)
    }
    /* write registers and enable system interrupts */
    outl (imm_command, IM_CMD_REG(host_index));
    outb (IM_IMM_CMD | ldn, IM_ATTN_REG(host_index));
-   IBMUNLOCK
+   IBMUNLOCK(shpnt)
 #ifdef IM_DEBUG_PROBE
    printk("IBM MCA SCSI: Abort queued to adapter...\n");
 #endif
@@ -2262,21 +2262,21 @@
 
    /*if abort went well, call saved done, then return success or error */
    if (cmd->result == (DID_ABORT << 16)) {
-      IBMLOCK
+      IBMLOCK(shpnt)
       cmd->result |= DID_ABORT << 16;
       if (cmd->scsi_done) (cmd->scsi_done) (cmd);
       ld(host_index)[ldn].cmd = NULL;
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
 #ifdef IM_DEBUG_PROBE
       printk("IBM MCA SCSI: Abort finished with success.\n");
 #endif
       return SCSI_ABORT_SUCCESS;
    } else {
-      IBMLOCK
+      IBMLOCK(shpnt)
       cmd->result |= DID_NO_CONNECT << 16;
       if (cmd->scsi_done) (cmd->scsi_done) (cmd);
       ld(host_index)[ldn].cmd = NULL;
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
 #ifdef IM_DEBUG_PROBE
       printk("IBM MCA SCSI: Abort failed.\n");
 #endif
@@ -2297,7 +2297,7 @@
       printk("IBM MCA SCSI: Reset called with NULL-command!\n");
       return(SCSI_RESET_SNOOZE);
    }
-   IBMLOCK
+   IBMLOCK(cmd->host)
    ticks = IM_RESET_DELAY*HZ;
    shpnt = cmd->host;
    /* search for the right hostadapter */
@@ -2308,7 +2308,7 @@
 
    if (local_checking_phase_flag(host_index)) {
       printk("IBM MCA SCSI: unable to reset while checking devices.\n");
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
       return SCSI_RESET_SNOOZE;
    }
 
@@ -2324,8 +2324,8 @@
    while (1) {
       if (!(inb (IM_STAT_REG(host_index)) & IM_BUSY))
 	break;
-      IBMUNLOCK
-      IBMLOCK
+      IBMUNLOCK(shpnt)
+      IBMLOCK(shpnt)
    }
    /*write registers and enable system interrupts */
    outl (imm_command, IM_CMD_REG(host_index));
@@ -2342,7 +2342,7 @@
       printk("IBM MCA SCSI: reset did not complete within %d seconds.\n",
 	     IM_RESET_DELAY);
       reset_status(host_index) = IM_RESET_FINISHED_FAIL;
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
       return SCSI_RESET_ERROR;
    }
 
@@ -2360,13 +2360,13 @@
    /* if reset failed, just return an error */
    if (reset_status(host_index) == IM_RESET_FINISHED_FAIL) {
       printk("IBM MCA SCSI: reset failed.\n");
-      IBMUNLOCK
+      IBMUNLOCK(shpnt)
       return SCSI_RESET_ERROR;
    }
 
    /* so reset finished ok - call outstanding done's, and return success */
    printk ("IBM MCA SCSI: Reset successfully completed.\n");
-   IBMUNLOCK
+   IBMUNLOCK(shpnt)
    for (i = 0; i < MAX_LOG_DEV; i++) {
       cmd_aid = ld(host_index)[i].cmd;
       if (cmd_aid && cmd_aid->scsi_done) {
@@ -2454,8 +2454,8 @@
    unsigned long flags;
    int max_pun;
 
-   IBMLOCK
    for (i = 0; hosts[i] && hosts[i]->host_no != hostno; i++);
+   IBMLOCK(hosts[i]) /* Check it */
    shpnt = hosts[i];
    host_index = i;
    if (!shpnt) {
@@ -2537,7 +2537,7 @@
    *start = buffer + offset;
    len -= offset;
    if (len > length) len = length;
-   IBMUNLOCK
+   IBMUNLOCK(shpnt)
    return len;
 }
 
Only in ./linux/drivers/scsi/: ibmmca.c~
diff -ur ./linux.orig/drivers/scsi/ini9100u.c ./linux/drivers/scsi/ini9100u.c
--- ./linux.orig/drivers/scsi/ini9100u.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/ini9100u.c	Mon Jan 28 06:38:51 2002
@@ -699,113 +699,121 @@
 static void i91u_intr0(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[0].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[0]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr1(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[1].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[1]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr2(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[2].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[2]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr3(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[3].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[3]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr4(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[4].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[4]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr5(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[5].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[5]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr6(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[6].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[6]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void i91u_intr7(int irqno, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
+	struct Scsi_Host *dev = dev_id;
+	
 	if (tul_hcs[7].HCS_Intr != irqno)
 		return;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	tul_isr(&tul_hcs[7]);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 /* 
Only in ./linux/drivers/scsi/: ini9100u.c~
diff -ur ./linux.orig/drivers/scsi/inia100.c ./linux/drivers/scsi/inia100.c
--- ./linux.orig/drivers/scsi/inia100.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/inia100.c	Mon Jan 28 05:00:33 2002
@@ -717,19 +717,19 @@
 }
 
 
-static void subIntr(ORC_HCS * pHCB, int irqno)
+static void subIntr(ORC_HCS * pHCB, int irqno, struct Scsi_Host *dev)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&io_request_lock, flags);
+	spin_lock_irqsave(&dev->host_lock, flags);
 
 	if (pHCB->HCS_Intr != irqno) {
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	orc_interrupt(pHCB);
 
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 /*
@@ -737,42 +737,42 @@
  */
 static void inia100_intr0(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[0], irqno);
+	subIntr(&orc_hcs[0], irqno, dev_id);
 }
 
 static void inia100_intr1(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[1], irqno);
+	subIntr(&orc_hcs[1], irqno, dev_id);
 }
 
 static void inia100_intr2(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[2], irqno);
+	subIntr(&orc_hcs[2], irqno, dev_id);
 }
 
 static void inia100_intr3(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[3], irqno);
+	subIntr(&orc_hcs[3], irqno, dev_id);
 }
 
 static void inia100_intr4(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[4], irqno);
+	subIntr(&orc_hcs[4], irqno, dev_id);
 }
 
 static void inia100_intr5(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[5], irqno);
+	subIntr(&orc_hcs[5], irqno, dev_id);
 }
 
 static void inia100_intr6(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[6], irqno);
+	subIntr(&orc_hcs[6], irqno, dev_id);
 }
 
 static void inia100_intr7(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	subIntr(&orc_hcs[7], irqno);
+	subIntr(&orc_hcs[7], irqno, dev_id);
 }
 
 /* 
Only in ./linux/drivers/scsi/: inia100.c~
diff -ur ./linux.orig/drivers/scsi/jazz_esp.c ./linux/drivers/scsi/jazz_esp.c
--- ./linux.orig/drivers/scsi/jazz_esp.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/jazz_esp.c	Mon Jan 28 06:26:52 2002
@@ -120,7 +120,7 @@
 	
 	esp->irq = JAZZ_SCSI_IRQ;
 	request_irq(JAZZ_SCSI_IRQ, esp_intr, SA_INTERRUPT, "JAZZ SCSI",
-	            NULL);
+	            esp->ehost);
 
 	/*
 	 * FIXME, look if the scsi id is availabe from NVRAM
Only in ./linux/drivers/scsi/: jazz_esp.c~
diff -ur ./linux.orig/drivers/scsi/mac53c94.c ./linux/drivers/scsi/mac53c94.c
--- ./linux.orig/drivers/scsi/mac53c94.c	Fri Feb  9 22:30:23 2001
+++ ./linux/drivers/scsi/mac53c94.c	Mon Jan 28 06:18:20 2002
@@ -292,10 +292,11 @@
 do_mac53c94_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
 {
 	unsigned long flags;
-
-	spin_lock_irqsave(&io_request_lock, flags);
+	struct Scsi_Host *dev = ((struct fsc_state *) dev_id)->current_req->host;
+	
+	spin_lock_irqsave(&dev->host_lock, flags);
 	mac53c94_interrupt(irq, dev_id, ptregs);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void
Only in ./linux/drivers/scsi/: mac53c94.c~
diff -ur ./linux.orig/drivers/scsi/mac_esp.c ./linux/drivers/scsi/mac_esp.c
--- ./linux.orig/drivers/scsi/mac_esp.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/mac_esp.c	Mon Jan 28 06:25:57 2002
@@ -417,9 +417,9 @@
 
 			esp->irq = IRQ_MAC_SCSI;
 
-			request_irq(IRQ_MAC_SCSI, esp_intr, 0, "Mac ESP SCSI", esp);
+			request_irq(IRQ_MAC_SCSI, esp_intr, 0, "Mac ESP SCSI", esp->ehost);
 #if 0	/* conflicts with IOP ADB */
-			request_irq(IRQ_MAC_SCSIDRQ, fake_drq, 0, "Mac ESP DRQ", esp);
+			request_irq(IRQ_MAC_SCSIDRQ, fake_drq, 0, "Mac ESP DRQ", esp->ehost);
 #endif
 
 			if (macintosh_config->scsi_type == MAC_SCSI_QUADRA) {
@@ -433,7 +433,7 @@
 
 			esp->irq = IRQ_MAC_SCSIDRQ;
 #if 0	/* conflicts with IOP ADB */
-			request_irq(IRQ_MAC_SCSIDRQ, esp_intr, 0, "Mac ESP SCSI 2", esp);
+			request_irq(IRQ_MAC_SCSIDRQ, esp_intr, 0, "Mac ESP SCSI 2", esp->ehost);
 #endif
 
 			esp->cfreq = 25000000;
Only in ./linux/drivers/scsi/: mac_esp.c~
diff -ur ./linux.orig/drivers/scsi/mca_53c9x.c ./linux/drivers/scsi/mca_53c9x.c
--- ./linux.orig/drivers/scsi/mca_53c9x.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/mca_53c9x.c	Mon Jan 28 06:26:30 2002
@@ -153,7 +153,7 @@
 			esp->slot = slot;
 
 			if (request_irq(esp->irq, esp_intr, 0,
-			 "NCR 53c9x SCSI", esp_intr))
+			 "NCR 53c9x SCSI", esp->ehost))
 			{
 				printk("Unable to request IRQ %d.\n", esp->irq);
 				esp_deallocate(esp);
Only in ./linux/drivers/scsi/: mca_53c9x.c~
diff -ur ./linux.orig/drivers/scsi/megaraid.c ./linux/drivers/scsi/megaraid.c
--- ./linux.orig/drivers/scsi/megaraid.c	Thu Dec 27 19:17:43 2001
+++ ./linux/drivers/scsi/megaraid.c	Mon Jan 28 05:55:56 2002
@@ -614,8 +614,8 @@
 #define DRIVER_LOCK(p)
 #define DRIVER_UNLOCK(p)
 #define IO_LOCK_T unsigned long io_flags = 0
-#define IO_LOCK(host) spin_lock_irqsave(&io_request_lock,io_flags);
-#define IO_UNLOCK(host) spin_unlock_irqrestore(&io_request_lock,io_flags);
+#define IO_LOCK(host) spin_lock_irqsave(&host->host_lock,io_flags);
+#define IO_UNLOCK(host) spin_unlock_irqrestore(&host->host_lock,io_flags);
 
 #define pci_free_consistent(a,b,c,d)
 #define pci_unmap_single(a,b,c,d)
Only in ./linux/drivers/scsi/: megaraid.c~
diff -ur ./linux.orig/drivers/scsi/mesh.c ./linux/drivers/scsi/mesh.c
--- ./linux.orig/drivers/scsi/mesh.c	Wed Sep 19 01:23:14 2001
+++ ./linux/drivers/scsi/mesh.c	Mon Jan 28 06:19:25 2002
@@ -795,15 +795,15 @@
 	unsigned long flags;
 
 	for (;;) {
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&ms->host->host_lock, flags);
 		cmd = ms->completed_q;
 		if (cmd == NULL) {
-			spin_unlock_irqrestore(&io_request_lock, flags);
+			spin_unlock_irqrestore(&ms->host->host_lock, flags);
 			break;
 		}
 		ms->completed_q = (Scsi_Cmnd *) cmd->host_scribble;
 		(*cmd->scsi_done)(cmd);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&ms->host->host_lock, flags);
 	}
 }
 #endif /* MESH_NEW_STYLE_EH */
@@ -1458,10 +1458,11 @@
 do_mesh_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
 {
 	unsigned long flags;
-
-	spin_lock_irqsave(&io_request_lock, flags);
+	struct Scsi_Host *dev = ((struct mech_state *)dev_id)->host;
+	
+	spin_lock_irqsave(&dev->host_lock, flags);
 	mesh_interrupt(irq, dev_id, ptregs);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 static void handle_error(struct mesh_state *ms)
Only in ./linux/drivers/scsi/: mesh.c~
diff -ur ./linux.orig/drivers/scsi/oktagon_esp.c ./linux/drivers/scsi/oktagon_esp.c
--- ./linux.orig/drivers/scsi/oktagon_esp.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/oktagon_esp.c	Mon Jan 28 06:25:09 2002
@@ -198,7 +198,7 @@
 
 		esp->irq = IRQ_AMIGA_PORTS;
 		request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
-			    "BSC Oktagon SCSI", esp_intr);
+			    "BSC Oktagon SCSI", esp->ehost);
 
 		/* Figure out our scsi ID on the bus */
 		esp->scsi_id = 7;
Only in ./linux/drivers/scsi/: oktagon_esp.c~
diff -ur ./linux.orig/drivers/scsi/pas16.c ./linux/drivers/scsi/pas16.c
--- ./linux.orig/drivers/scsi/pas16.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/pas16.c	Mon Jan 28 05:27:34 2002
@@ -451,7 +451,7 @@
 	    instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS);
 
 	if (instance->irq != IRQ_NONE) 
-	    if (request_irq(instance->irq, do_pas16_intr, SA_INTERRUPT, "pas16", NULL)) {
+	    if (request_irq(instance->irq, do_pas16_intr, SA_INTERRUPT, "pas16", instance)) {
 		printk("scsi%d : IRQ%d not free, interrupts disabled\n", 
 		    instance->host_no, instance->irq);
 		instance->irq = IRQ_NONE;
Only in ./linux/drivers/scsi/: pas16.c~
Only in ./linux/drivers/scsi/pcmcia: .depend
diff -ur ./linux.orig/drivers/scsi/ppa.c ./linux/drivers/scsi/ppa.c
--- ./linux.orig/drivers/scsi/ppa.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/ppa.c	Mon Jan 28 05:49:42 2002
@@ -119,7 +119,6 @@
      * unlock to allow the lowlevel parport driver to probe
      * the irqs
      */
-    spin_unlock_irq(&io_request_lock);
     pb = parport_enumerate();
 
     printk("ppa: Version %s\n", PPA_VERSION);
@@ -128,7 +127,6 @@
 
     if (!pb) {
 	printk("ppa: parport reports no devices.\n");
-	spin_lock_irq(&io_request_lock);
 	return 0;
     }
   retry_entry:
@@ -154,7 +152,7 @@
 		      "pardevice is owning the port for too longtime!\n",
 			   i);
 		    parport_unregister_device(ppa_hosts[i].dev);
-		    spin_lock_irq(&io_request_lock);
+		    spin_lock_irq(&ppa_hosts[i].cur_cmd->host->host_lock);
 		    return 0;
 		}
 	    }
@@ -223,13 +221,13 @@
 	    printk("  supported by the imm (ZIP Plus) driver. If the\n");
 	    printk("  cable is marked with \"AutoDetect\", this is what has\n");
 	    printk("  happened.\n");
-	    spin_lock_irq(&io_request_lock);
+	    spin_lock_irq(&hreg->host_lock);
 	    return 0;
 	}
 	try_again = 1;
 	goto retry_entry;
     } else {
-	spin_lock_irq(&io_request_lock);
+	spin_lock_irq(&hreg->host_lock);
 	return 1;		/* return number of hosts detected */
     }
 }
@@ -847,9 +845,9 @@
 
     tmp->cur_cmd = 0;
     
-    spin_lock_irqsave(&io_request_lock, flags);
+    spin_lock_irqsave(&cmd->host->host_lock, flags);
     cmd->scsi_done(cmd);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&cmd->host->host_lock, flags);
     return;
 }
 
Only in ./linux/drivers/scsi/: ppa.c~
diff -ur ./linux.orig/drivers/scsi/psi240i.c ./linux/drivers/scsi/psi240i.c
--- ./linux.orig/drivers/scsi/psi240i.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/psi240i.c	Mon Jan 28 06:12:47 2002
@@ -370,10 +370,11 @@
 static void do_Irq_Handler (int irq, void *dev_id, struct pt_regs *regs)
 	{
 	unsigned long flags;
-
-	spin_lock_irqsave(&io_request_lock, flags);
+	struct Scsi_Host *dev = dev_id;
+	
+	spin_lock_irqsave(&dev->host_lock, flags);
 	Irq_Handler(irq, dev_id, regs);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 	}
 /****************************************************************
  *	Name:	Psi240i_QueueCommand
@@ -602,7 +603,7 @@
 
 		save_flags (flags);
 		cli ();
-		if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", NULL) )
+		if ( request_irq (chipConfig.irq, do_Irq_Handler, 0, "psi240i", pshost) )
 			{
 			printk ("Unable to allocate IRQ for PSI-240I controller.\n");
 			restore_flags (flags);
Only in ./linux/drivers/scsi/: psi240i.c~
diff -ur ./linux.orig/drivers/scsi/qla1280.c ./linux/drivers/scsi/qla1280.c
--- ./linux.orig/drivers/scsi/qla1280.c	Sun Dec 30 21:31:51 2001
+++ ./linux/drivers/scsi/qla1280.c	Mon Jan 28 06:41:02 2002
@@ -1523,11 +1523,11 @@
         return;
     }
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,95)
-    spin_lock_irqsave(&io_request_lock, cpu_flags);
+    spin_lock_irqsave(&ha->host->host_lock, cpu_flags);
     if(test_and_set_bit(QLA1280_IN_ISR_BIT, &ha->flags))
     {
         COMTRACE('X')
-        spin_unlock_irqrestore(&io_request_lock, cpu_flags);
+        spin_unlock_irqrestore(&ha->host->host_lock, cpu_flags);
         return;
     }
     ha->isr_count++;
@@ -1548,7 +1548,7 @@
         qla1280_done(ha, (srb_t **)&ha->done_q_first, (srb_t **)&ha->done_q_last);
 
     clear_bit(QLA1280_IN_ISR_BIT, &ha->flags);
-    spin_unlock_irqrestore(&io_request_lock, cpu_flags);
+    spin_unlock_irqrestore(&ha->host->host_lock, cpu_flags);
 #else  /* LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) */
 
     if( test_bit(QLA1280_IN_ISR_BIT, (int *)&ha->flags) )
@@ -1619,7 +1619,7 @@
 
     COMTRACE('p')  
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,95)
-    spin_lock_irqsave(&io_request_lock, cpu_flags);
+    spin_lock_irqsave(&ha->host->host_lock, cpu_flags);
 #endif
     if (ha->flags.isp_abort_needed)
         qla1280_abort_isp(ha);
@@ -1631,7 +1631,7 @@
         qla1280_done(ha, (srb_t **)&ha->done_q_first, (srb_t **)&ha->done_q_last);
     ha->flags.dpc_sched = FALSE;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,95)
-    spin_unlock_irqrestore(&io_request_lock, cpu_flags);
+    spin_unlock_irqrestore(&ha->host->host_lock, cpu_flags);
 #endif
 }
 
Only in ./linux/drivers/scsi/: qla1280.c~
diff -ur ./linux.orig/drivers/scsi/seagate.c ./linux/drivers/scsi/seagate.c
--- ./linux.orig/drivers/scsi/seagate.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/seagate.c	Mon Jan 28 06:00:47 2002
@@ -503,7 +503,7 @@
 	hostno = instance->host_no;
 	if (request_irq (irq, do_seagate_reconnect_intr, SA_INTERRUPT,
 			 (controller_type == SEAGATE) ? "seagate" : "tmc-8xx",
-			 NULL)) {
+			 instance)) {
 		printk ("scsi%d : unable to allocate IRQ%d\n", hostno, irq);
 		return 0;
 	}
@@ -629,10 +629,11 @@
 static void do_seagate_reconnect_intr (int irq, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
-	spin_lock_irqsave (&io_request_lock, flags);
+	struct Scsi_Host *dev = dev_id;
+	
+	spin_lock_irqsave (&dev->host_lock, flags);
 	seagate_reconnect_intr (irq, dev_id, regs);
-	spin_unlock_irqrestore (&io_request_lock, flags);
+	spin_unlock_irqrestore (&dev->host_lock, flags);
 }
 
 static void seagate_reconnect_intr (int irq, void *dev_id, struct pt_regs *regs)
Only in ./linux/drivers/scsi/: seagate.c~
diff -ur ./linux.orig/drivers/scsi/sgiwd93.c ./linux/drivers/scsi/sgiwd93.c
--- ./linux.orig/drivers/scsi/sgiwd93.c	Sun Sep  9 21:52:35 2001
+++ ./linux/drivers/scsi/sgiwd93.c	Mon Jan 28 06:31:52 2002
@@ -66,10 +66,11 @@
 static void sgiwd93_intr(int irq, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
-
-	spin_lock_irqsave(&io_request_lock, flags);
+	struct Scsi_Host *dev = dev_id;
+	
+	spin_lock_irqsave(&dev->host_lock, flags);
 	wd33c93_intr((struct Scsi_Host *) dev_id);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 #undef DEBUG_DMA
Only in ./linux/drivers/scsi/: sgiwd93.c~
diff -ur ./linux.orig/drivers/scsi/sun3x_esp.c ./linux/drivers/scsi/sun3x_esp.c
--- ./linux.orig/drivers/scsi/sun3x_esp.c	Fri Oct 26 00:53:51 2001
+++ ./linux/drivers/scsi/sun3x_esp.c	Mon Jan 28 06:23:40 2002
@@ -112,7 +112,7 @@
 
 	esp->irq = 2;
 	if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, 
-			"SUN3X SCSI", NULL)) {
+			"SUN3X SCSI", esp->ehost)) {
 		esp_deallocate(esp);
 		return 0;
 	}
Only in ./linux/drivers/scsi/: sun3x_esp.c~
diff -ur ./linux.orig/drivers/scsi/sym53c416.c ./linux/drivers/scsi/sym53c416.c
--- ./linux.orig/drivers/scsi/sym53c416.c	Sun Sep 30 23:26:07 2001
+++ ./linux/drivers/scsi/sym53c416.c	Mon Jan 28 04:26:48 2002
@@ -337,6 +337,7 @@
 
 static void sym53c416_intr_handle(int irq, void *dev_id, struct pt_regs *regs)
 {
+	struct Scsi_Host *dev = dev_id;
 	int base = 0;
 	int i;
 	unsigned long flags = 0;
@@ -359,11 +360,11 @@
 	}
 	/* Now we have the base address and we can start handling the interrupt */
 
-	spin_lock_irqsave(&io_request_lock,flags);
+	spin_lock_irqsave(&dev->host_lock,flags);
 	status_reg = inb(base + STATUS_REG);
 	pio_int_reg = inb(base + PIO_INT_REG);
 	int_reg = inb(base + INT_REG);
-	spin_unlock_irqrestore(&io_request_lock, flags);
+	spin_unlock_irqrestore(&dev->host_lock, flags);
 
 	/* First, we handle error conditions */
 	if(int_reg & SCI)         /* SCSI Reset */
@@ -371,9 +372,9 @@
 		printk(KERN_DEBUG "sym53c416: Reset received\n");
 		current_command->SCp.phase = idle;
 		current_command->result = DID_RESET << 16;
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		current_command->scsi_done(current_command);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	if(int_reg & ILCMD)       /* Illegal Command */
@@ -381,9 +382,9 @@
 		printk(KERN_WARNING "sym53c416: Illegal Command: 0x%02x.\n", inb(base + COMMAND_REG));
 		current_command->SCp.phase = idle;
 		current_command->result = DID_ERROR << 16;
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		current_command->scsi_done(current_command);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	if(status_reg & GE)         /* Gross Error */
@@ -391,9 +392,9 @@
 		printk(KERN_WARNING "sym53c416: Controller reports gross error.\n");
 		current_command->SCp.phase = idle;
 		current_command->result = DID_ERROR << 16;
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		current_command->scsi_done(current_command);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	if(status_reg & PE)         /* Parity Error */
@@ -401,9 +402,9 @@
 		printk(KERN_WARNING "sym53c416:SCSI parity error.\n");
 		current_command->SCp.phase = idle;
 		current_command->result = DID_PARITY << 16;
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		current_command->scsi_done(current_command);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	if(pio_int_reg & (CE | OUE))
@@ -411,9 +412,9 @@
 		printk(KERN_WARNING "sym53c416: PIO interrupt error.\n");
 		current_command->SCp.phase = idle;
 		current_command->result = DID_ERROR << 16;
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		current_command->scsi_done(current_command);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	if(int_reg & DIS)           /* Disconnect */
@@ -423,9 +424,9 @@
 		else
 			current_command->result = (current_command->SCp.Status & 0xFF) | ((current_command->SCp.Message & 0xFF) << 8) | (DID_OK << 16);
 		current_command->SCp.phase = idle;
-		spin_lock_irqsave(&io_request_lock, flags);
+		spin_lock_irqsave(&dev->host_lock, flags);
 		current_command->scsi_done(current_command);
-		spin_unlock_irqrestore(&io_request_lock, flags);
+		spin_unlock_irqrestore(&dev->host_lock, flags);
 		return;
 	}
 	/* Now we handle SCSI phases         */
@@ -719,7 +720,7 @@
 				cli();
 				/* FIXME: Request_irq with CLI is not safe */
 				/* Request for specified IRQ */
-				if(request_irq(hosts[i].irq, sym53c416_intr_handle, 0, ID, NULL))
+				if(request_irq(hosts[i].irq, sym53c416_intr_handle, 0, ID, shpnt))
 				{
 					restore_flags(flags);
 					printk(KERN_ERR "sym53c416: Unable to assign IRQ %d\n", hosts[i].irq);
Only in ./linux/drivers/scsi/: sym53c416.c~
Only in ./linux/drivers/scsi/sym53c8xx_2: .depend
diff -ur ./linux.orig/drivers/scsi/t128.c ./linux/drivers/scsi/t128.c
--- ./linux.orig/drivers/scsi/t128.c	Sun Sep 30 23:26:08 2001
+++ ./linux/drivers/scsi/t128.c	Mon Jan 28 05:28:10 2002
@@ -248,7 +248,7 @@
 	    instance->irq = NCR5380_probe_irq(instance, T128_IRQS);
 
 	if (instance->irq != IRQ_NONE) 
-	    if (request_irq(instance->irq, do_t128_intr, SA_INTERRUPT, "t128", NULL)) {
+	    if (request_irq(instance->irq, do_t128_intr, SA_INTERRUPT, "t128", instance)) {
 		printk("scsi%d : IRQ%d not free, interrupts disabled\n", 
 		    instance->host_no, instance->irq);
 		instance->irq = IRQ_NONE;
Only in ./linux/drivers/scsi/: t128.c~
diff -ur ./linux.orig/drivers/scsi/tmscsim.c ./linux/drivers/scsi/tmscsim.c
--- ./linux.orig/drivers/scsi/tmscsim.c	Thu Dec 27 19:17:43 2001
+++ ./linux/drivers/scsi/tmscsim.c	Mon Jan 28 06:09:07 2002
@@ -304,8 +304,8 @@
 #  define DC390_IFLAGS unsigned long iflags;
 #  define DC390_DFLAGS unsigned long dflags; 
 
-#  define DC390_LOCK_IO spin_lock_irqsave (&io_request_lock, iflags)
-#  define DC390_UNLOCK_IO spin_unlock_irqrestore (&io_request_lock, iflags)
+#  define DC390_LOCK_IO spin_lock_irqsave (&((struct Scsi_Host *)dev)->host_lock, iflags)
+#  define DC390_UNLOCK_IO spin_unlock_irqrestore (&((struct Scsi_Host *)dev)->host_lock, iflags)
 
 #  define DC390_LOCK_DRV spin_lock_irqsave (&dc390_drvlock, dflags)
 #  define DC390_UNLOCK_DRV spin_unlock_irqrestore (&dc390_drvlock, dflags)
@@ -331,8 +331,8 @@
 #   define DC390_AFLAGS unsigned long aflags;
 #   define DC390_IFLAGS 
 #  define DC390_DFLAGS unsigned long dflags; 
-#   define DC390_LOCK_IO /* spin_lock_irqsave (&io_request_lock, iflags) */
-#   define DC390_UNLOCK_IO /* spin_unlock_irqrestore (&io_request_lock, iflags) */
+#   define DC390_LOCK_IO(dev) /* spin_lock_irqsave (&io_request_lock, iflags) */
+#   define DC390_UNLOCK_IO(dev) /* spin_unlock_irqrestore (&io_request_lock, iflags) */
 #   define DC390_LOCK_DRV spin_lock_irqsave (&dc390_drvlock, dflags)
 #   define DC390_UNLOCK_DRV spin_unlock_irqrestore (&dc390_drvlock, dflags)
 #   define DC390_LOCK_DRV_NI spin_lock (&dc390_drvlock)
@@ -349,8 +349,8 @@
 #   define DC390_IFLAGS unsigned long iflags;
 #   define DC390_DFLAGS unsigned long dflags; 
     spinlock_t dc390_drvlock = SPIN_LOCK_UNLOCKED;
-#   define DC390_LOCK_IO spin_lock_irqsave (&io_request_lock, iflags)
-#   define DC390_UNLOCK_IO spin_unlock_irqrestore (&io_request_lock, iflags)
+#   define DC390_LOCK_IO(dev) spin_lock_irqsave (&((struct Scsi_Host *)dev)->host_lock, iflags)
+#   define DC390_UNLOCK_IO(dev) spin_unlock_irqrestore (&((struct Scsi_Host *)dev)->host_lock, iflags)
 #   define DC390_LOCK_DRV spin_lock_irqsave (&dc390_drvlock, dflags)
 #   define DC390_UNLOCK_DRV spin_unlock_irqrestore (&dc390_drvlock, dflags)
 #   define DC390_LOCK_DRV_NI spin_lock (&dc390_drvlock)
@@ -1074,11 +1074,11 @@
 	DC390_IFLAGS
 	DC390_AFLAGS
 	DEBUG0(printk ("DC390: Debug: Waiting queue woken up by timer!\n");)
-	DC390_LOCK_IO;
+	DC390_LOCK_IO(pACB.pScsiHost);
 	DC390_LOCK_ACB;
 	dc390_Waiting_process (pACB);
 	DC390_UNLOCK_ACB;
-	DC390_UNLOCK_IO;
+	DC390_UNLOCK_IO(pACB.pScsiHost);
 }
 
 /***********************************************************************
@@ -2558,7 +2558,7 @@
   DC390_AFLAGS 
   pos[length] = 0;
 
-  DC390_LOCK_IO;
+  DC390_LOCK_IO(pACB.pScsiHost);
   DC390_LOCK_ACB;
   /* UPPERCASE */ 
   /* Don't use kernel toupper, because of 2.0.x bug: ctmp unexported */
@@ -2726,7 +2726,7 @@
   DC390_UNLOCK_ACB;
   if (needs_inquiry) 
      { dc390_updateDCB (pACB, pDCB); dc390_inquiry (pACB, pDCB); };
-  DC390_UNLOCK_IO;
+  DC390_UNLOCK_IO(pACB.pScsiHost);
   return (length);
 
  einv2:
@@ -2734,7 +2734,7 @@
  einv:
   /* spin_unlock (strtok_lock); */
   DC390_UNLOCK_ACB;
-  DC390_UNLOCK_IO;
+  DC390_UNLOCK_IO(pACB.pScsiHost);
   printk (KERN_WARNING "DC390: parse error near \"%s\"\n", (pos? pos: "NULL"));
   return (-EINVAL);
    
@@ -2744,7 +2744,7 @@
 	printk (KERN_WARNING "DC390: Driver reset requested!\n");
 	DC390_UNLOCK_ACB;
 	DC390_reset (&cmd, 0);
-	DC390_UNLOCK_IO;
+	DC390_UNLOCK_IO(pACB.pScsiHost);
      };
   return (length);
 
@@ -2752,7 +2752,7 @@
      {
 	dc390_dumpinfo (pACB, 0, 0);
 	DC390_UNLOCK_ACB;
-	DC390_UNLOCK_IO;       
+	DC390_UNLOCK_IO(pACB.pScsiHost);       
      }
   return (length);
 	
@@ -2766,7 +2766,7 @@
 		dev, pDCB->TargetID, pDCB->TargetLUN);
 	DC390_UNLOCK_ACB;
 	dc390_inquiry (pACB, pDCB);
-	DC390_UNLOCK_IO;
+	DC390_UNLOCK_IO(pACB.pScsiHost);
      };
    return (length);
 
@@ -2781,7 +2781,7 @@
 	/* TO DO: We should make sure no pending commands are left */
 	dc390_remove_dev (pACB, pDCB);
 	DC390_UNLOCK_ACB;
-	DC390_UNLOCK_IO;
+	DC390_UNLOCK_IO(pACB.pScsiHost);
      };
    return (length);
 
@@ -2796,7 +2796,7 @@
 	dc390_initDCB (pACB, &pDCB, id, lun);
 	DC390_UNLOCK_ACB;
 	dc390_inquiry (pACB, pDCB);
-	DC390_UNLOCK_IO;
+	DC390_UNLOCK_IO(pACB.pScsiHost);
      };
    return (length);
 
@@ -2812,7 +2812,7 @@
 	DC390_UNLOCK_ACB;
 	dc390_sendstart (pACB, pDCB);
 	dc390_inquiry (pACB, pDCB);
-	DC390_UNLOCK_IO;
+	DC390_UNLOCK_IO(pACB.pScsiHost);
      };
    return (length);
 
@@ -2820,7 +2820,7 @@
    printk (KERN_WARNING "DC390: Ignore cmnd to illegal Dev(Idx) %i. Valid range: 0 - %i.\n", 
 	   dev, pACB->DCBCnt - 1);
    DC390_UNLOCK_ACB;
-   DC390_UNLOCK_IO;
+   DC390_UNLOCK_IO(pACB.pScsiHost);
    return (-EINVAL);
 	     
 	     
@@ -3041,7 +3041,7 @@
     DC390_AFLAGS DC390_IFLAGS
     PACB pACB = (PACB)(host->hostdata);
 
-    DC390_LOCK_IO;
+    DC390_LOCK_IO(host);
     DC390_LOCK_ACB;
 
     /* TO DO: We should check for outstanding commands first. */
@@ -3056,7 +3056,7 @@
     release_region(host->io_port,host->n_io_port);
     dc390_freeDCBs (host);
     DC390_UNLOCK_ACB;
-    DC390_UNLOCK_IO;
+    DC390_UNLOCK_IO(host);
     return( 1 );
 }
 #endif /* def MODULE */
--- ./drivers/scsi/ultrastor.c~	Sun Sep 30 23:26:08 2001
+++ ./drivers/scsi/ultrastor.c	Mon Jan 28 07:30:33 2002
@@ -500,7 +500,11 @@
     config.mscp_free = ~0;
 #endif
 
-    if (request_irq(config.interrupt, do_ultrastor_interrupt, 0, "Ultrastor", NULL)) {
+    /*
+     * Brrr, &config.mscp[0].SCint->host) it is something magical....
+     * XXX and FIXME
+     */
+    if (request_irq(config.interrupt, do_ultrastor_interrupt, 0, "Ultrastor", &config.mscp[0].SCint->host)) {
 	printk("Unable to allocate IRQ%u for UltraStor controller.\n",
 	       config.interrupt);
 	return FALSE;
@@ -570,12 +574,7 @@
 	  printk("U24F: invalid IRQ\n");
 	  return FALSE;
 	}
-      if (request_irq(config.interrupt, do_ultrastor_interrupt, 0, "Ultrastor", NULL))
-	{
-	  printk("Unable to allocate IRQ%u for UltraStor controller.\n",
-		 config.interrupt);
-	  return FALSE;
-	}
+
       /* BIOS addr set */
       /* base port set */
       config.port_address = addr;
@@ -605,6 +604,13 @@
              free_irq(config.interrupt, do_ultrastor_interrupt);
              return FALSE;
       }
+      
+      if (request_irq(config.interrupt, do_ultrastor_interrupt, 0, "Ultrastor", shpnt))
+	{
+	  printk("Unable to allocate IRQ%u for UltraStor controller.\n",
+		 config.interrupt);
+	  return FALSE;
+	}
 
       shpnt->irq = config.interrupt;
       shpnt->dma_channel = config.dma_channel;
@@ -1159,10 +1165,11 @@
 static void do_ultrastor_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
     unsigned long flags;
-
-    spin_lock_irqsave(&io_request_lock, flags);
+    struct Scsi_Host *dev = dev_id;
+    
+    spin_lock_irqsave(&dev->host_lock, flags);
     ultrastor_interrupt(irq, dev_id, regs);
-    spin_unlock_irqrestore(&io_request_lock, flags);
+    spin_unlock_irqrestore(&dev->host_lock, flags);
 }
 
 MODULE_LICENSE("GPL");

^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <20020129043528.47f020a7.johnpol@2ka.mipt.ru>]

end of thread, other threads:[~2002-01-29  2:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-28  4:33 [PATCH] scsi uodate to remove io_request_lock Evgeniy Polyakov
2002-01-28  9:08 ` Jens Axboe
     [not found] <20020129043528.47f020a7.johnpol@2ka.mipt.ru>
2002-01-29  1:46 ` Linus Torvalds
2002-01-29  2:29   ` Evgeniy Polyakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox