diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-09-09 10:56:35 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:47:59 -0400 |
commit | b2a7a4ba0497f73295e3f4d20a8cedb1e3d2b1a7 (patch) | |
tree | 933be186e56c83dced0c04e6f30eb2ad0e3999fb /drivers/scsi/advansys.c | |
parent | 349d2c44291d922614a273e9a4e6b43ee17c103d (diff) |
[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: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/advansys.c')
-rw-r--r-- | drivers/scsi/advansys.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 67cdfe6201ce..d7bc0cf72134 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -3176,23 +3176,24 @@ static void asc_scsi_done(struct scsi_cmnd *scp) | |||
3176 | * in the 'scp' result field. | 3176 | * in the 'scp' result field. |
3177 | */ | 3177 | */ |
3178 | static int | 3178 | static int |
3179 | advansys_queuecommand(struct scsi_cmnd *scp, void (*done) (struct scsi_cmnd *)) | 3179 | advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) |
3180 | { | 3180 | { |
3181 | struct Scsi_Host *shost; | 3181 | struct Scsi_Host *shost = scp->device->host; |
3182 | asc_board_t *boardp; | 3182 | asc_board_t *boardp = ASC_BOARDP(shost); |
3183 | ulong flags; | 3183 | unsigned long flags; |
3184 | int asc_res, result = 0; | 3184 | int asc_res, result = 0; |
3185 | 3185 | ||
3186 | shost = scp->device->host; | ||
3187 | boardp = ASC_BOARDP(shost); | ||
3188 | ASC_STATS(shost, queuecommand); | 3186 | ASC_STATS(shost, queuecommand); |
3187 | scp->scsi_done = done; | ||
3189 | 3188 | ||
3190 | /* host_lock taken by mid-level prior to call but need to protect */ | 3189 | /* |
3191 | /* against own ISR */ | 3190 | * host_lock taken by mid-level prior to call, but need |
3191 | * to protect against own ISR | ||
3192 | */ | ||
3192 | spin_lock_irqsave(&boardp->lock, flags); | 3193 | spin_lock_irqsave(&boardp->lock, flags); |
3193 | |||
3194 | scp->scsi_done = done; | ||
3195 | asc_res = asc_execute_scsi_cmnd(scp); | 3194 | asc_res = asc_execute_scsi_cmnd(scp); |
3195 | spin_unlock_irqrestore(&boardp->lock, flags); | ||
3196 | |||
3196 | switch (asc_res) { | 3197 | switch (asc_res) { |
3197 | case ASC_NOERROR: | 3198 | case ASC_NOERROR: |
3198 | break; | 3199 | break; |
@@ -3201,11 +3202,9 @@ advansys_queuecommand(struct scsi_cmnd *scp, void (*done) (struct scsi_cmnd *)) | |||
3201 | break; | 3202 | break; |
3202 | case ASC_ERROR: | 3203 | case ASC_ERROR: |
3203 | default: | 3204 | default: |
3204 | /* Interrupts could be enabled here. */ | ||
3205 | asc_scsi_done(scp); | 3205 | asc_scsi_done(scp); |
3206 | break; | 3206 | break; |
3207 | } | 3207 | } |
3208 | spin_unlock_irqrestore(&boardp->lock, flags); | ||
3209 | 3208 | ||
3210 | return result; | 3209 | return result; |
3211 | } | 3210 | } |