diff options
author | Matthew Wilcox <matthew@wil.cx> | 2006-03-28 11:03:44 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-04-13 11:13:23 -0400 |
commit | ab19d52bec6c1b266228417b58ae6f36f3ea097c (patch) | |
tree | 24eeaeea4630e0fecceacc26f0e5d2d276046d12 /drivers/scsi | |
parent | b6d105d7ee188040a6e5eb86101e7476d94b3076 (diff) |
[SCSI] Simplify error handling a bit
- to_do was never set to SYM_EH_DO_COMPLETE, so remove that code
- move the spinlocks inside the common error handler code path
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_glue.c | 50 |
1 files changed, 8 insertions, 42 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index e6ff89a8524c..052ce11806ad 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -712,7 +712,6 @@ static void sym53c8xx_timer(unsigned long npref) | |||
712 | * What we will do regarding the involved SCSI command. | 712 | * What we will do regarding the involved SCSI command. |
713 | */ | 713 | */ |
714 | #define SYM_EH_DO_IGNORE 0 | 714 | #define SYM_EH_DO_IGNORE 0 |
715 | #define SYM_EH_DO_COMPLETE 1 | ||
716 | #define SYM_EH_DO_WAIT 2 | 715 | #define SYM_EH_DO_WAIT 2 |
717 | 716 | ||
718 | /* | 717 | /* |
@@ -764,25 +763,18 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd) | |||
764 | 763 | ||
765 | dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname); | 764 | dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname); |
766 | 765 | ||
766 | spin_lock_irq(cmd->device->host->host_lock); | ||
767 | /* This one is queued in some place -> to wait for completion */ | 767 | /* This one is queued in some place -> to wait for completion */ |
768 | FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { | 768 | FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { |
769 | struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); | 769 | struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); |
770 | if (cp->cmd == cmd) { | 770 | if (cp->cmd == cmd) { |
771 | to_do = SYM_EH_DO_WAIT; | 771 | to_do = SYM_EH_DO_WAIT; |
772 | goto prepare; | 772 | break; |
773 | } | 773 | } |
774 | } | 774 | } |
775 | 775 | ||
776 | prepare: | 776 | if (to_do == SYM_EH_DO_WAIT) { |
777 | /* Prepare stuff to either ignore, complete or wait for completion */ | ||
778 | switch(to_do) { | ||
779 | default: | ||
780 | case SYM_EH_DO_IGNORE: | ||
781 | break; | ||
782 | case SYM_EH_DO_WAIT: | ||
783 | init_completion(&ep->done); | 777 | init_completion(&ep->done); |
784 | /* fall through */ | ||
785 | case SYM_EH_DO_COMPLETE: | ||
786 | ep->old_done = cmd->scsi_done; | 778 | ep->old_done = cmd->scsi_done; |
787 | cmd->scsi_done = sym_eh_done; | 779 | cmd->scsi_done = sym_eh_done; |
788 | SYM_UCMD_PTR(cmd)->eh_wait = ep; | 780 | SYM_UCMD_PTR(cmd)->eh_wait = ep; |
@@ -818,9 +810,6 @@ prepare: | |||
818 | } | 810 | } |
819 | 811 | ||
820 | ep->to_do = to_do; | 812 | ep->to_do = to_do; |
821 | /* Complete the command with locks held as required by the driver */ | ||
822 | if (to_do == SYM_EH_DO_COMPLETE) | ||
823 | sym_xpt_done2(np, cmd, DID_ABORT); | ||
824 | 813 | ||
825 | /* Wait for completion with locks released, as required by kernel */ | 814 | /* Wait for completion with locks released, as required by kernel */ |
826 | if (to_do == SYM_EH_DO_WAIT) { | 815 | if (to_do == SYM_EH_DO_WAIT) { |
@@ -836,6 +825,7 @@ prepare: | |||
836 | if (ep->timed_out) | 825 | if (ep->timed_out) |
837 | sts = -2; | 826 | sts = -2; |
838 | } | 827 | } |
828 | spin_unlock_irq(cmd->device->host->host_lock); | ||
839 | dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname, | 829 | dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname, |
840 | sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed"); | 830 | sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed"); |
841 | return sts ? SCSI_FAILED : SCSI_SUCCESS; | 831 | return sts ? SCSI_FAILED : SCSI_SUCCESS; |
@@ -847,46 +837,22 @@ prepare: | |||
847 | */ | 837 | */ |
848 | static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd) | 838 | static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd) |
849 | { | 839 | { |
850 | int rc; | 840 | return sym_eh_handler(SYM_EH_ABORT, "ABORT", cmd); |
851 | |||
852 | spin_lock_irq(cmd->device->host->host_lock); | ||
853 | rc = sym_eh_handler(SYM_EH_ABORT, "ABORT", cmd); | ||
854 | spin_unlock_irq(cmd->device->host->host_lock); | ||
855 | |||
856 | return rc; | ||
857 | } | 841 | } |
858 | 842 | ||
859 | static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd) | 843 | static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd) |
860 | { | 844 | { |
861 | int rc; | 845 | return sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd); |
862 | |||
863 | spin_lock_irq(cmd->device->host->host_lock); | ||
864 | rc = sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd); | ||
865 | spin_unlock_irq(cmd->device->host->host_lock); | ||
866 | |||
867 | return rc; | ||
868 | } | 846 | } |
869 | 847 | ||
870 | static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) | 848 | static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) |
871 | { | 849 | { |
872 | int rc; | 850 | return sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd); |
873 | |||
874 | spin_lock_irq(cmd->device->host->host_lock); | ||
875 | rc = sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd); | ||
876 | spin_unlock_irq(cmd->device->host->host_lock); | ||
877 | |||
878 | return rc; | ||
879 | } | 851 | } |
880 | 852 | ||
881 | static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) | 853 | static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) |
882 | { | 854 | { |
883 | int rc; | 855 | return sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd); |
884 | |||
885 | spin_lock_irq(cmd->device->host->host_lock); | ||
886 | rc = sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd); | ||
887 | spin_unlock_irq(cmd->device->host->host_lock); | ||
888 | |||
889 | return rc; | ||
890 | } | 856 | } |
891 | 857 | ||
892 | /* | 858 | /* |