diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-10-02 21:55:26 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:53:06 -0400 |
commit | 52fa07770921d9cbe815d3aff36702c88cdec978 (patch) | |
tree | 5215e01dea0d152979523916405214498736d6c1 /drivers | |
parent | 05848b6e66ee237c4496c2b49821d2622b0f677e (diff) |
[SCSI] advansys: Improve reset handler
- Don't need to set ASC_HOST_IN_RESET any more
- Don't need to test scp->device->host for NULL -- if it's NULL, we
couldn't've been called.
- Use scmd_printk instead of ASC_PRINT
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/advansys.c | 83 |
1 files changed, 22 insertions, 61 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index fd4d6695fea9..52ea41d175af 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -2229,7 +2229,6 @@ do { \ | |||
2229 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) | 2229 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) |
2230 | 2230 | ||
2231 | /* asc_board_t flags */ | 2231 | /* asc_board_t flags */ |
2232 | #define ASC_HOST_IN_RESET 0x01 | ||
2233 | #define ASC_IS_WIDE_BOARD 0x04 /* AdvanSys Wide Board */ | 2232 | #define ASC_IS_WIDE_BOARD 0x04 /* AdvanSys Wide Board */ |
2234 | #define ASC_SELECT_QUEUE_DEPTHS 0x08 | 2233 | #define ASC_SELECT_QUEUE_DEPTHS 0x08 |
2235 | 2234 | ||
@@ -9751,106 +9750,68 @@ static int AscISR(ASC_DVC_VAR *asc_dvc) | |||
9751 | */ | 9750 | */ |
9752 | static int advansys_reset(struct scsi_cmnd *scp) | 9751 | static int advansys_reset(struct scsi_cmnd *scp) |
9753 | { | 9752 | { |
9754 | struct Scsi_Host *shost; | 9753 | struct Scsi_Host *shost = scp->device->host; |
9755 | asc_board_t *boardp; | 9754 | struct asc_board *boardp = ASC_BOARDP(shost); |
9756 | ASC_DVC_VAR *asc_dvc_varp; | 9755 | unsigned long flags; |
9757 | ADV_DVC_VAR *adv_dvc_varp; | ||
9758 | ulong flags; | ||
9759 | int status; | 9756 | int status; |
9760 | int ret = SUCCESS; | 9757 | int ret = SUCCESS; |
9761 | 9758 | ||
9762 | ASC_DBG1(1, "advansys_reset: 0x%lx\n", (ulong)scp); | 9759 | ASC_DBG1(1, "advansys_reset: 0x%p\n", scp); |
9763 | 9760 | ||
9764 | #ifdef ADVANSYS_STATS | 9761 | ASC_STATS(shost, reset); |
9765 | if (scp->device->host != NULL) { | ||
9766 | ASC_STATS(scp->device->host, reset); | ||
9767 | } | ||
9768 | #endif /* ADVANSYS_STATS */ | ||
9769 | |||
9770 | if ((shost = scp->device->host) == NULL) { | ||
9771 | scp->result = HOST_BYTE(DID_ERROR); | ||
9772 | return FAILED; | ||
9773 | } | ||
9774 | 9762 | ||
9775 | boardp = ASC_BOARDP(shost); | 9763 | scmd_printk(KERN_INFO, scp, "SCSI bus reset started...\n"); |
9776 | |||
9777 | ASC_PRINT1("advansys_reset: board %d: SCSI bus reset started...\n", | ||
9778 | boardp->id); | ||
9779 | /* | ||
9780 | * Check for re-entrancy. | ||
9781 | */ | ||
9782 | spin_lock_irqsave(&boardp->lock, flags); | ||
9783 | if (boardp->flags & ASC_HOST_IN_RESET) { | ||
9784 | spin_unlock_irqrestore(&boardp->lock, flags); | ||
9785 | return FAILED; | ||
9786 | } | ||
9787 | boardp->flags |= ASC_HOST_IN_RESET; | ||
9788 | spin_unlock_irqrestore(&boardp->lock, flags); | ||
9789 | 9764 | ||
9790 | if (ASC_NARROW_BOARD(boardp)) { | 9765 | if (ASC_NARROW_BOARD(boardp)) { |
9791 | /* | 9766 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; |
9792 | * Narrow Board | ||
9793 | */ | ||
9794 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; | ||
9795 | 9767 | ||
9796 | /* | 9768 | /* Reset the chip and SCSI bus. */ |
9797 | * Reset the chip and SCSI bus. | ||
9798 | */ | ||
9799 | ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n"); | 9769 | ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n"); |
9800 | status = AscInitAsc1000Driver(asc_dvc_varp); | 9770 | status = AscInitAsc1000Driver(asc_dvc); |
9801 | 9771 | ||
9802 | /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */ | 9772 | /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */ |
9803 | if (asc_dvc_varp->err_code) { | 9773 | if (asc_dvc->err_code) { |
9804 | ASC_PRINT2("advansys_reset: board %d: SCSI bus reset " | 9774 | scmd_printk(KERN_INFO, scp, "SCSI bus reset error: " |
9805 | "error: 0x%x\n", boardp->id, | 9775 | "0x%x\n", asc_dvc->err_code); |
9806 | asc_dvc_varp->err_code); | ||
9807 | ret = FAILED; | 9776 | ret = FAILED; |
9808 | } else if (status) { | 9777 | } else if (status) { |
9809 | ASC_PRINT2("advansys_reset: board %d: SCSI bus reset " | 9778 | scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: " |
9810 | "warning: 0x%x\n", boardp->id, status); | 9779 | "0x%x\n", status); |
9811 | } else { | 9780 | } else { |
9812 | ASC_PRINT1("advansys_reset: board %d: SCSI bus reset " | 9781 | scmd_printk(KERN_INFO, scp, "SCSI bus reset " |
9813 | "successful.\n", boardp->id); | 9782 | "successful\n"); |
9814 | } | 9783 | } |
9815 | 9784 | ||
9816 | ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n"); | 9785 | ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n"); |
9817 | spin_lock_irqsave(&boardp->lock, flags); | 9786 | spin_lock_irqsave(&boardp->lock, flags); |
9818 | |||
9819 | } else { | 9787 | } else { |
9820 | /* | 9788 | /* |
9821 | * Wide Board | ||
9822 | * | ||
9823 | * If the suggest reset bus flags are set, then reset the bus. | 9789 | * If the suggest reset bus flags are set, then reset the bus. |
9824 | * Otherwise only reset the device. | 9790 | * Otherwise only reset the device. |
9825 | */ | 9791 | */ |
9826 | adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; | 9792 | ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var; |
9827 | 9793 | ||
9828 | /* | 9794 | /* |
9829 | * Reset the target's SCSI bus. | 9795 | * Reset the target's SCSI bus. |
9830 | */ | 9796 | */ |
9831 | ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n"); | 9797 | ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n"); |
9832 | switch (AdvResetChipAndSB(adv_dvc_varp)) { | 9798 | switch (AdvResetChipAndSB(adv_dvc)) { |
9833 | case ASC_TRUE: | 9799 | case ASC_TRUE: |
9834 | ASC_PRINT1("advansys_reset: board %d: SCSI bus reset " | 9800 | scmd_printk(KERN_INFO, scp, "SCSI bus reset " |
9835 | "successful.\n", boardp->id); | 9801 | "successful\n"); |
9836 | break; | 9802 | break; |
9837 | case ASC_FALSE: | 9803 | case ASC_FALSE: |
9838 | default: | 9804 | default: |
9839 | ASC_PRINT1("advansys_reset: board %d: SCSI bus reset " | 9805 | scmd_printk(KERN_INFO, scp, "SCSI bus reset error\n"); |
9840 | "error.\n", boardp->id); | ||
9841 | ret = FAILED; | 9806 | ret = FAILED; |
9842 | break; | 9807 | break; |
9843 | } | 9808 | } |
9844 | spin_lock_irqsave(&boardp->lock, flags); | 9809 | spin_lock_irqsave(&boardp->lock, flags); |
9845 | AdvISR(adv_dvc_varp); | 9810 | AdvISR(adv_dvc); |
9846 | } | 9811 | } |
9847 | /* Board lock is held. */ | ||
9848 | 9812 | ||
9849 | /* Save the time of the most recently completed reset. */ | 9813 | /* Save the time of the most recently completed reset. */ |
9850 | boardp->last_reset = jiffies; | 9814 | boardp->last_reset = jiffies; |
9851 | |||
9852 | /* Clear reset flag. */ | ||
9853 | boardp->flags &= ~ASC_HOST_IN_RESET; | ||
9854 | spin_unlock_irqrestore(&boardp->lock, flags); | 9815 | spin_unlock_irqrestore(&boardp->lock, flags); |
9855 | 9816 | ||
9856 | ASC_DBG1(1, "advansys_reset: ret %d\n", ret); | 9817 | ASC_DBG1(1, "advansys_reset: ret %d\n", ret); |