Commit b2a7a4ba authored by Matthew Wilcox's avatar Matthew Wilcox Committed by James Bottomley

[SCSI] advansys: Enable interrupts earlier in queuecommand

Move as much as possible outside the critical section in queuecommand, eg:
 - Set the scsi_done field before acquiring the lock
 - Call asc_scsi_done after dropping the lock

Also remove a comment suggesting we should enable interrupts (now we do)
and do some minor reformatting for readability.
Signed-off-by: default avatarMatthew Wilcox <matthew@wil.cx>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 349d2c44
...@@ -3176,23 +3176,24 @@ static void asc_scsi_done(struct scsi_cmnd *scp) ...@@ -3176,23 +3176,24 @@ static void asc_scsi_done(struct scsi_cmnd *scp)
* in the 'scp' result field. * in the 'scp' result field.
*/ */
static int static int
advansys_queuecommand(struct scsi_cmnd *scp, void (*done) (struct scsi_cmnd *)) advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
{ {
struct Scsi_Host *shost; struct Scsi_Host *shost = scp->device->host;
asc_board_t *boardp; asc_board_t *boardp = ASC_BOARDP(shost);
ulong flags; unsigned long flags;
int asc_res, result = 0; int asc_res, result = 0;
shost = scp->device->host;
boardp = ASC_BOARDP(shost);
ASC_STATS(shost, queuecommand); ASC_STATS(shost, queuecommand);
scp->scsi_done = done;
/* host_lock taken by mid-level prior to call but need to protect */ /*
/* against own ISR */ * host_lock taken by mid-level prior to call, but need
* to protect against own ISR
*/
spin_lock_irqsave(&boardp->lock, flags); spin_lock_irqsave(&boardp->lock, flags);
scp->scsi_done = done;
asc_res = asc_execute_scsi_cmnd(scp); asc_res = asc_execute_scsi_cmnd(scp);
spin_unlock_irqrestore(&boardp->lock, flags);
switch (asc_res) { switch (asc_res) {
case ASC_NOERROR: case ASC_NOERROR:
break; break;
...@@ -3201,11 +3202,9 @@ advansys_queuecommand(struct scsi_cmnd *scp, void (*done) (struct scsi_cmnd *)) ...@@ -3201,11 +3202,9 @@ advansys_queuecommand(struct scsi_cmnd *scp, void (*done) (struct scsi_cmnd *))
break; break;
case ASC_ERROR: case ASC_ERROR:
default: default:
/* Interrupts could be enabled here. */
asc_scsi_done(scp); asc_scsi_done(scp);
break; break;
} }
spin_unlock_irqrestore(&boardp->lock, flags);
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment