NCR5380 stuff

Alan Cox (alan@lxorguk.ukuu.org.uk)
Wed, 31 Mar 99 15:47 BST


Ok how does this look. I think this correctly interprets the 2,0 drivers
intention unlike 2.2 which as you pointed out got the one case of
USLEEP/NCR5380_main wrong

--- ../linux.vanilla/drivers/scsi/NCR5380.c Tue Dec 22 23:19:48 1998
+++ drivers/scsi/NCR5380.c Wed Mar 31 14:51:07 1999
@@ -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_irqsave(&io_request_lock);
}
#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,6 +1431,7 @@
break;
} /* for instance */
} while (!done);
+ spin_lock_irq(&io_request_lock);
cli();
main_running = 0;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/