diff options
author | <htejun@gmail.com> | 2005-04-17 16:00:23 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic> | 2005-04-18 13:35:56 -0400 |
commit | f59114b7b5dc677bbd7cc7e26a5fcb3572a3445c (patch) | |
tree | 250f46d1d99247f3d7b67d991929ed6aedb7145d /drivers/scsi | |
parent | 06f81ea8ca09b880cadf101d7e23b500e9c164bc (diff) |
[PATCH] scsi: scsi_send_eh_cmnd() cleanup
This patch makes scsi_send_eh_cmnd() use sdev and shost instead of
referencing them through scmd-> everytime.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_error.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 203a0812508a..1a135f38e78d 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -476,7 +476,8 @@ static void scsi_eh_done(struct scsi_cmnd *scmd) | |||
476 | **/ | 476 | **/ |
477 | static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | 477 | static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) |
478 | { | 478 | { |
479 | struct Scsi_Host *host = scmd->device->host; | 479 | struct scsi_device *sdev = scmd->device; |
480 | struct Scsi_Host *shost = sdev->host; | ||
480 | DECLARE_MUTEX_LOCKED(sem); | 481 | DECLARE_MUTEX_LOCKED(sem); |
481 | unsigned long flags; | 482 | unsigned long flags; |
482 | int rtn = SUCCESS; | 483 | int rtn = SUCCESS; |
@@ -487,27 +488,27 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | |||
487 | */ | 488 | */ |
488 | scmd->owner = SCSI_OWNER_LOWLEVEL; | 489 | scmd->owner = SCSI_OWNER_LOWLEVEL; |
489 | 490 | ||
490 | if (scmd->device->scsi_level <= SCSI_2) | 491 | if (sdev->scsi_level <= SCSI_2) |
491 | scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | | 492 | scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | |
492 | (scmd->device->lun << 5 & 0xe0); | 493 | (sdev->lun << 5 & 0xe0); |
493 | 494 | ||
494 | scsi_add_timer(scmd, timeout, scsi_eh_times_out); | 495 | scsi_add_timer(scmd, timeout, scsi_eh_times_out); |
495 | 496 | ||
496 | /* | 497 | /* |
497 | * set up the semaphore so we wait for the command to complete. | 498 | * set up the semaphore so we wait for the command to complete. |
498 | */ | 499 | */ |
499 | scmd->device->host->eh_action = &sem; | 500 | shost->eh_action = &sem; |
500 | scmd->request->rq_status = RQ_SCSI_BUSY; | 501 | scmd->request->rq_status = RQ_SCSI_BUSY; |
501 | 502 | ||
502 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | 503 | spin_lock_irqsave(shost->host_lock, flags); |
503 | scsi_log_send(scmd); | 504 | scsi_log_send(scmd); |
504 | host->hostt->queuecommand(scmd, scsi_eh_done); | 505 | shost->hostt->queuecommand(scmd, scsi_eh_done); |
505 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | 506 | spin_unlock_irqrestore(shost->host_lock, flags); |
506 | 507 | ||
507 | down(&sem); | 508 | down(&sem); |
508 | scsi_log_completion(scmd, SUCCESS); | 509 | scsi_log_completion(scmd, SUCCESS); |
509 | 510 | ||
510 | scmd->device->host->eh_action = NULL; | 511 | shost->eh_action = NULL; |
511 | 512 | ||
512 | /* | 513 | /* |
513 | * see if timeout. if so, tell the host to forget about it. | 514 | * see if timeout. if so, tell the host to forget about it. |
@@ -527,10 +528,10 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | |||
527 | * abort a timed out command or not. not sure how | 528 | * abort a timed out command or not. not sure how |
528 | * we should treat them differently anyways. | 529 | * we should treat them differently anyways. |
529 | */ | 530 | */ |
530 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | 531 | spin_lock_irqsave(shost->host_lock, flags); |
531 | if (scmd->device->host->hostt->eh_abort_handler) | 532 | if (shost->hostt->eh_abort_handler) |
532 | scmd->device->host->hostt->eh_abort_handler(scmd); | 533 | shost->hostt->eh_abort_handler(scmd); |
533 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | 534 | spin_unlock_irqrestore(shost->host_lock, flags); |
534 | 535 | ||
535 | scmd->request->rq_status = RQ_SCSI_DONE; | 536 | scmd->request->rq_status = RQ_SCSI_DONE; |
536 | scmd->owner = SCSI_OWNER_ERROR_HANDLER; | 537 | scmd->owner = SCSI_OWNER_ERROR_HANDLER; |