aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c50
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 e6ff89a8524..052ce11806a 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
776prepare: 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 */
848static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd) 838static 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
859static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd) 843static 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
870static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) 848static 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
881static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) 853static 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/*