patch-2.1.95 linux/drivers/scsi/scsi.c
Next file: linux/drivers/scsi/scsi.h
Previous file: linux/drivers/scsi/ncr53c8xx.c
Back to the patch index
Back to the overall index
- Lines: 246
- Date:
Thu Apr 9 22:11:00 1998
- Orig file:
v2.1.94/linux/drivers/scsi/scsi.c
- Orig date:
Mon Apr 6 17:41:00 1998
diff -u --recursive --new-file v2.1.94/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c
@@ -354,7 +354,6 @@
*/
- spin_lock_irqsave(&io_request_lock, flags);
host_active = NULL;
for(shpnt=scsi_hostlist; shpnt; shpnt = shpnt->next) {
@@ -386,7 +385,6 @@
sh[index]->host_no);
}
- spin_unlock_irqrestore(&io_request_lock, flags);
}
static void scan_scsis_done (Scsi_Cmnd * SCpnt)
@@ -653,9 +651,11 @@
struct semaphore sem = MUTEX_LOCKED;
SCpnt->request.sem = &sem;
SCpnt->request.rq_status = RQ_SCSI_BUSY;
+ spin_lock_irq(&io_request_lock);
scsi_do_cmd (SCpnt, (void *) scsi_cmd,
(void *) scsi_result,
256, scan_scsis_done, SCSI_TIMEOUT + 4 * HZ, 5);
+ spin_unlock_irq(&io_request_lock);
down (&sem);
SCpnt->request.sem = NULL;
}
@@ -694,9 +694,11 @@
struct semaphore sem = MUTEX_LOCKED;
SCpnt->request.sem = &sem;
SCpnt->request.rq_status = RQ_SCSI_BUSY;
+ spin_lock_irq(&io_request_lock);
scsi_do_cmd (SCpnt, (void *) scsi_cmd,
(void *) scsi_result,
256, scan_scsis_done, SCSI_TIMEOUT, 3);
+ spin_unlock_irq(&io_request_lock);
down (&sem);
SCpnt->request.sem = NULL;
}
@@ -836,9 +838,11 @@
struct semaphore sem = MUTEX_LOCKED;
SCpnt->request.rq_status = RQ_SCSI_BUSY;
SCpnt->request.sem = &sem;
+ spin_lock_irq(&io_request_lock);
scsi_do_cmd (SCpnt, (void *) scsi_cmd,
(void *) scsi_result, 0x2a,
scan_scsis_done, SCSI_TIMEOUT, 3);
+ spin_unlock_irq(&io_request_lock);
down (&sem);
SCpnt->request.sem = NULL;
}
@@ -1133,21 +1137,18 @@
SCpnt = found;
}
- __save_flags(flags);
- __cli();
/* See if this request has already been queued by an interrupt routine
*/
if (req && (req->rq_status == RQ_INACTIVE || req->rq_dev != dev)) {
- __restore_flags(flags);
return NULL;
}
if (!SCpnt || SCpnt->request.rq_status != RQ_INACTIVE) /* Might have changed */
{
if (wait && SCwait && SCwait->request.rq_status != RQ_INACTIVE){
+ spin_unlock(&io_request_lock); /* FIXME!!!! */
sleep_on(&device->device_wait);
- __restore_flags(flags);
+ spin_lock_irq(&io_request_lock); /* FIXME!!!! */
} else {
- __restore_flags(flags);
if (!wait) return NULL;
if (!SCwait) {
printk("Attempt to allocate device channel %d,"
@@ -1197,7 +1198,6 @@
* to complete */
}
atomic_inc(&SCpnt->host->host_active);
- __restore_flags(flags);
SCSI_LOG_MLQUEUE(5, printk("Activating command for device %d (%d)\n",
SCpnt->target,
atomic_read(&SCpnt->host->host_active)));
@@ -1294,7 +1294,6 @@
host = SCpnt->host;
- spin_lock_irqsave(&io_request_lock, flags);
/* Assign a unique nonzero serial_number. */
if (++serial_number == 0) serial_number = 1;
SCpnt->serial_number = serial_number;
@@ -1304,7 +1303,6 @@
* we can avoid the drive not being ready.
*/
timeout = host->last_reset + MIN_RESET_DELAY;
- spin_unlock(&io_request_lock);
if (jiffies < timeout) {
int ticks_remaining = timeout - jiffies;
@@ -1317,11 +1315,11 @@
* interrupt handler (assuming there is one irq-level per
* host).
*/
- __sti();
+ spin_unlock_irq(&io_request_lock);
while (--ticks_remaining >= 0) udelay(1000000/HZ);
host->last_reset = jiffies - MIN_RESET_DELAY;
+ spin_lock_irq(&io_request_lock);
}
- __restore_flags(flags); /* this possibly puts us back into __cli() */
if( host->hostt->use_new_eh_code )
{
@@ -1348,18 +1346,6 @@
{
SCSI_LOG_MLQUEUE(3,printk("queuecommand : routine at %p\n",
host->hostt->queuecommand));
- /* This locking tries to prevent all sorts of races between
- * queuecommand and the interrupt code. In effect,
- * we are only allowed to be in queuecommand once at
- * any given time, and we can only be in the interrupt
- * handler and the queuecommand function at the same time
- * when queuecommand is called while servicing the
- * interrupt.
- */
-
- if(!in_interrupt() && SCpnt->host->irq)
- disable_irq(SCpnt->host->irq);
-
/*
* Use the old error handling code if we haven't converted the driver
* to use the new one yet. Note - only the new queuecommand variant
@@ -1377,9 +1363,6 @@
{
host->hostt->queuecommand (SCpnt, scsi_old_done);
}
-
- if(!in_interrupt() && SCpnt->host->irq)
- enable_irq(SCpnt->host->irq);
}
else
{
@@ -1452,20 +1435,18 @@
* ourselves.
*/
- spin_lock_irqsave(&io_request_lock, flags);
SCpnt->pid = scsi_pid++;
while (SCSI_BLOCK((Scsi_Device *) NULL, host)) {
- spin_unlock_irqrestore(&io_request_lock, flags);
+ spin_unlock(&io_request_lock); /* FIXME!!! */
SCSI_SLEEP(&host->host_wait, SCSI_BLOCK((Scsi_Device *) NULL, host));
- spin_lock_irqsave(&io_request_lock, flags);
+ spin_lock_irq(&io_request_lock); /* FIXME!!! */
}
if (host->block) host_active = host;
host->host_busy++;
device->device_busy++;
- spin_unlock_irqrestore(&io_request_lock, flags);
/*
* Our own function scsi_done (which marks the host as not busy, disables
@@ -1819,7 +1800,6 @@
if(len % SECTOR_SIZE != 0 || len > PAGE_SIZE)
return NULL;
- spin_lock_irqsave(&io_request_lock, flags);
nbits = len >> 9;
mask = (1 << nbits) - 1;
@@ -1827,7 +1807,6 @@
for(j=0; j<=SECTORS_PER_PAGE - nbits; j++){
if ((dma_malloc_freelist[i] & (mask << j)) == 0){
dma_malloc_freelist[i] |= (mask << j);
- spin_unlock_irqrestore(&io_request_lock, flags);
scsi_dma_free_sectors -= nbits;
#ifdef DEBUG
SCSI_LOG_MLQUEUE(3,printk("SMalloc: %d %p [From:%p]\n",len, dma_malloc_pages[i] + (j << 9)));
@@ -1836,7 +1815,6 @@
return (void *) ((unsigned long) dma_malloc_pages[i] + (j << 9));
}
}
- spin_unlock_irqrestore(&io_request_lock, flags);
return NULL; /* Nope. No more */
}
@@ -1870,20 +1848,16 @@
if ((mask << sector) >= (1 << SECTORS_PER_PAGE))
panic ("scsi_free:Bad memory alignment");
- spin_lock_irqsave(&io_request_lock, flags);
if((dma_malloc_freelist[page] &
(mask << sector)) != (mask<<sector)){
- spin_unlock_irqrestore(&io_request_lock, flags);
#ifdef DEBUG
printk("scsi_free(obj=%p, len=%d) called from %08lx\n",
obj, len, ret);
#endif
panic("scsi_free:Trying to free unused memory");
- spin_lock_irqsave(&io_request_lock, flags);
}
scsi_dma_free_sectors += nbits;
dma_malloc_freelist[page] &= ~(mask << sector);
- spin_unlock_irqrestore(&io_request_lock, flags);
return 0;
}
}
@@ -2547,7 +2521,6 @@
/* When we dick with the actual DMA list, we need to
* protect things
*/
- spin_lock_irqsave(&io_request_lock, flags);
if (dma_malloc_freelist)
{
size = (dma_sectors / SECTORS_PER_PAGE)*sizeof(FreeSectorBitmap);
@@ -2567,7 +2540,6 @@
dma_malloc_pages = new_dma_malloc_pages;
dma_sectors = new_dma_sectors;
scsi_need_isa_buffer = new_need_isa_buffer;
- spin_unlock_irqrestore(&io_request_lock, flags);
#ifdef DEBUG_INIT
printk("resize_dma_pool: dma free sectors = %d\n", scsi_dma_free_sectors);
@@ -2806,10 +2778,8 @@
{
online_status = SDpnt->online;
SDpnt->online = FALSE;
- spin_lock_irqsave(&io_request_lock, flags);
if(SCpnt->request.rq_status != RQ_INACTIVE)
{
- spin_unlock_irqrestore(&io_request_lock, flags);
printk("SCSI device not inactive - state=%d, id=%d\n",
SCpnt->request.rq_status, SCpnt->target);
for(SDpnt1 = shpnt->host_queue; SDpnt1;
@@ -2830,7 +2800,6 @@
*/
SCpnt->state = SCSI_STATE_DISCONNECTING;
SCpnt->request.rq_status = RQ_SCSI_DISCONNECTING; /* Mark as busy */
- spin_unlock_irqrestore(&io_request_lock, flags);
}
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov