patch-2.2.6 linux/drivers/scsi/NCR5380.c

Next file: linux/drivers/scsi/README.ncr53c8xx
Previous file: linux/drivers/scsi/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.5/linux/drivers/scsi/NCR5380.c linux/drivers/scsi/NCR5380.c
@@ -569,10 +569,6 @@
 	if (!main_running) {
 		main_running = 1;
 		NCR5380_main();
-		/* 
-		 * main_running is cleared in NCR5380_main once it can't do 
-		 * more work, and NCR5380_main exits with interrupts disabled.
-		 */
 	}
 	restore_flags(flags);
 }
@@ -702,7 +698,9 @@
 	}
 	restore_flags(flags);
 
+	spin_lock_irqsave(&io_request_lock, flags);
 	run_main();
+	spin_unlock_irqrestore(&io_request_lock, flags);
 }
 #endif				/* def USLEEP */
 
@@ -1266,6 +1264,7 @@
 	struct Scsi_Host *instance;
 	struct NCR5380_hostdata *hostdata;
 	int done;
+	unsigned long flags;
 
 	/*
 	 * We run (with interrupts disabled) until we're sure that none of 
@@ -1279,14 +1278,16 @@
 	 * this should prevent any race conditions.
 	 */
 
+	spin_unlock_irq(&io_request_lock);
+	
+	save_flags(flags);
+	
 	do {
 		cli();		/* Freeze request queues */
 		done = 1;
 		for (instance = first_instance; instance &&
 		     instance->hostt == the_template; instance = instance->next) {
-			unsigned long flags;
 			 hostdata = (struct NCR5380_hostdata *) instance->hostdata;
-			 save_flags(flags);
 			 cli();
 #ifdef USLEEP
 			if (!hostdata->connected && !hostdata->selecting) {
@@ -1365,8 +1366,6 @@
 							     TAG_NEXT)) {
 							break;
 						} else {
-							unsigned long flags;
-							save_flags(flags);
 							cli();
 							LIST(tmp, hostdata->issue_queue);
 							tmp->host_scribble = (unsigned char *)
@@ -1393,14 +1392,12 @@
 				}
 				else
 				{
-					unsigned long flags;
 					/* RvC: device failed, so we wait a long time
 					this is needed for Mustek scanners, that
 					do not respond to commands immediately
 					after a scan */
 					printk(KERN_DEBUG "scsi%d: device %d did not respond in time\n",
 						instance->host_no, tmp->target);
-					save_flags(flags);
 					cli();
 					LIST(tmp, hostdata->issue_queue);
 					tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
@@ -1434,7 +1431,8 @@
 				break;
 		}		/* for instance */
 	} while (!done);
-	cli();
+	spin_lock_irq(&io_request_lock);
+  /* 	cli();*/
 	main_running = 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)