All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: linux-scsi@vger.kernel.org
Cc: Matthew Wilcox <matthew@wil.cx>
Subject: [PATCH 20/22] advansys: Improve reset handler
Date: Sun,  9 Sep 2007 08:56:45 -0600	[thread overview]
Message-ID: <11893498073093-git-send-email-matthew@wil.cx> (raw)
In-Reply-To: <20070909145358.GG6809@parisc-linux.org>

 - 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 <matthew@wil.cx>
---
 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 3fbeea7..76dfb0c 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2229,7 +2229,6 @@ do { \
 #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata))
 
 /* asc_board_t flags */
-#define ASC_HOST_IN_RESET       0x01
 #define ASC_IS_WIDE_BOARD       0x04	/* AdvanSys Wide Board */
 #define ASC_SELECT_QUEUE_DEPTHS 0x08
 
@@ -9751,106 +9750,68 @@ static int AscISR(ASC_DVC_VAR *asc_dvc)
  */
 static int advansys_reset(struct scsi_cmnd *scp)
 {
-	struct Scsi_Host *shost;
-	asc_board_t *boardp;
-	ASC_DVC_VAR *asc_dvc_varp;
-	ADV_DVC_VAR *adv_dvc_varp;
-	ulong flags;
+	struct Scsi_Host *shost = scp->device->host;
+	struct asc_board *boardp = ASC_BOARDP(shost);
+	unsigned long flags;
 	int status;
 	int ret = SUCCESS;
 
-	ASC_DBG1(1, "advansys_reset: 0x%lx\n", (ulong)scp);
+	ASC_DBG1(1, "advansys_reset: 0x%p\n", scp);
 
-#ifdef ADVANSYS_STATS
-	if (scp->device->host != NULL) {
-		ASC_STATS(scp->device->host, reset);
-	}
-#endif /* ADVANSYS_STATS */
-
-	if ((shost = scp->device->host) == NULL) {
-		scp->result = HOST_BYTE(DID_ERROR);
-		return FAILED;
-	}
+	ASC_STATS(shost, reset);
 
-	boardp = ASC_BOARDP(shost);
-
-	ASC_PRINT1("advansys_reset: board %d: SCSI bus reset started...\n",
-		   boardp->id);
-	/*
-	 * Check for re-entrancy.
-	 */
-	spin_lock_irqsave(&boardp->lock, flags);
-	if (boardp->flags & ASC_HOST_IN_RESET) {
-		spin_unlock_irqrestore(&boardp->lock, flags);
-		return FAILED;
-	}
-	boardp->flags |= ASC_HOST_IN_RESET;
-	spin_unlock_irqrestore(&boardp->lock, flags);
+	scmd_printk(KERN_INFO, scp, "SCSI bus reset started...\n");
 
 	if (ASC_NARROW_BOARD(boardp)) {
-		/*
-		 * Narrow Board
-		 */
-		asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
+		ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
 
-		/*
-		 * Reset the chip and SCSI bus.
-		 */
+		/* Reset the chip and SCSI bus. */
 		ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n");
-		status = AscInitAsc1000Driver(asc_dvc_varp);
+		status = AscInitAsc1000Driver(asc_dvc);
 
 		/* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */
-		if (asc_dvc_varp->err_code) {
-			ASC_PRINT2("advansys_reset: board %d: SCSI bus reset "
-				   "error: 0x%x\n", boardp->id,
-				   asc_dvc_varp->err_code);
+		if (asc_dvc->err_code) {
+			scmd_printk(KERN_INFO, scp, "SCSI bus reset error: "
+				    "0x%x\n", asc_dvc->err_code);
 			ret = FAILED;
 		} else if (status) {
-			ASC_PRINT2("advansys_reset: board %d: SCSI bus reset "
-				   "warning: 0x%x\n", boardp->id, status);
+			scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: "
+				    "0x%x\n", status);
 		} else {
-			ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
-				   "successful.\n", boardp->id);
+			scmd_printk(KERN_INFO, scp, "SCSI bus reset "
+				    "successful\n");
 		}
 
 		ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n");
 		spin_lock_irqsave(&boardp->lock, flags);
-
 	} else {
 		/*
-		 * Wide Board
-		 *
 		 * If the suggest reset bus flags are set, then reset the bus.
 		 * Otherwise only reset the device.
 		 */
-		adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
+		ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var;
 
 		/*
 		 * Reset the target's SCSI bus.
 		 */
 		ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n");
-		switch (AdvResetChipAndSB(adv_dvc_varp)) {
+		switch (AdvResetChipAndSB(adv_dvc)) {
 		case ASC_TRUE:
-			ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
-				   "successful.\n", boardp->id);
+			scmd_printk(KERN_INFO, scp, "SCSI bus reset "
+				    "successful\n");
 			break;
 		case ASC_FALSE:
 		default:
-			ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
-				   "error.\n", boardp->id);
+			scmd_printk(KERN_INFO, scp, "SCSI bus reset error\n");
 			ret = FAILED;
 			break;
 		}
 		spin_lock_irqsave(&boardp->lock, flags);
-		AdvISR(adv_dvc_varp);
+		AdvISR(adv_dvc);
 	}
-	/* Board lock is held. */
 
 	/* Save the time of the most recently completed reset. */
 	boardp->last_reset = jiffies;
-
-	/* Clear reset flag. */
-	boardp->flags &= ~ASC_HOST_IN_RESET;
 	spin_unlock_irqrestore(&boardp->lock, flags);
 
 	ASC_DBG1(1, "advansys_reset: ret %d\n", ret);
-- 
1.5.2.4


  parent reply	other threads:[~2007-09-09 14:56 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-09 14:53 [0/22] Advansys updates 2007-09-09 Matthew Wilcox
2007-09-09 14:56 ` [PATCH 01/22] advansys: Fix VLB driver name Matthew Wilcox
2007-09-09 14:56 ` [PATCH 02/22] advansys: Create AdvBuildCarrierFreelist Matthew Wilcox
2007-09-09 14:56 ` [PATCH 03/22] advansys: Create AdvLoadMicrocode Matthew Wilcox
2007-09-09 14:56 ` [PATCH 04/22] advansys: Reformat microcode Matthew Wilcox
2007-09-09 14:56 ` [PATCH 05/22] advansys: Shrink advansys_board_found a little more Matthew Wilcox
2007-09-09 14:56 ` [PATCH 06/22] advansys: Remove `waiting' queue Matthew Wilcox
2007-09-09 14:56 ` [PATCH 07/22] advansys: Remove a check for an impossible condition Matthew Wilcox
2007-09-09 14:56 ` [PATCH 08/22] advansys: Remove `done' queue Matthew Wilcox
2007-09-09 14:56 ` [PATCH 09/22] advansys: Remove `active' queue and all remaining internal queueing code Matthew Wilcox
2007-09-09 14:56 ` [PATCH 10/22] advansys: Enable interrupts earlier in queuecommand Matthew Wilcox
2007-09-09 14:56 ` [PATCH 11/22] advansys: Support 16-byte commands properly Matthew Wilcox
2007-09-09 14:56 ` [PATCH 12/22] advansys: Remove a check for an impossible condition Matthew Wilcox
2007-09-09 14:56 ` [PATCH 13/22] advansys: Remove some custom wrappers Matthew Wilcox
2007-09-09 14:56 ` [PATCH 14/22] advansys: Comment/indentation/macro cleanup Matthew Wilcox
2007-09-09 14:56 ` [PATCH 15/22] advansys: Use DRV_NAME Matthew Wilcox
2007-09-09 14:56 ` [PATCH 16/22] advansys: Eliminate prototypes Matthew Wilcox
2007-09-09 15:29   ` Jeff Garzik
2007-09-09 17:48     ` Matthew Wilcox
2007-09-15 14:39   ` James Bottomley
2007-09-16 15:31     ` Matthew Wilcox
2007-09-16 22:41       ` FUJITA Tomonori
2007-09-16 23:03         ` Matthew Wilcox
2007-09-16 23:17           ` FUJITA Tomonori
2007-09-17 12:21             ` Matthew Wilcox
2007-09-16 15:37     ` [PATCH 01/17] " Matthew Wilcox
2007-09-16 15:37     ` [PATCH 02/17] advansys: Remove array of scsi targets Matthew Wilcox
2007-09-16 15:37     ` [PATCH 03/17] advansys: Restructure asc_execute_scsi_cmnd() Matthew Wilcox
2007-09-16 15:37     ` [PATCH 04/17] advansys: Fix simultaneous calls to ->queuecommand Matthew Wilcox
2007-09-16 15:37     ` [PATCH 05/17] advansys: Improve reset handler Matthew Wilcox
2007-09-16 15:37     ` [PATCH 06/17] advansys: Remove ASC_SELECT_QUEUE_DEPTHS Matthew Wilcox
2007-09-16 15:37     ` [PATCH 07/17] advansys: Remove ASC_WIDE_BOARD predicate Matthew Wilcox
2007-09-16 15:37     ` [PATCH 08/17] advansys: Sort out irq number mess Matthew Wilcox
2007-09-16 15:37     ` [PATCH 09/17] advansys: Merge ASC_IERR definitions Matthew Wilcox
2007-09-16 15:37     ` [PATCH 10/17] advansys: Remove asc_board_t typedef and ASC_BOARDP macro Matthew Wilcox
2007-09-16 16:14       ` Matthew Wilcox
2007-09-16 15:37     ` [PATCH 11/17] advansys: Remove library version & serial numbers Matthew Wilcox
2007-09-16 15:37     ` [PATCH 12/17] advansys: Sort out debug macros Matthew Wilcox
2007-09-16 15:37     ` [PATCH 13/17] advansys: Remove private lock Matthew Wilcox
2007-09-16 15:37     ` [PATCH 14/17] advansys: Get rid of board index number Matthew Wilcox
2007-09-16 15:37     ` [PATCH 15/17] advansys: Make sdtr_period_tbl a pointer Matthew Wilcox
2007-09-16 15:37     ` [PATCH 16/17] advansys: Move a couple of fields from struct board to struct adv_dvc Matthew Wilcox
2007-09-16 15:37     ` [PATCH 17/17] advansys: Remove DvcGetPhyAddr Matthew Wilcox
2007-09-16 20:39     ` [PATCH 10/17] advansys: Remove asc_board_t typedef and ASC_BOARDP macro Matthew Wilcox
2007-09-09 14:56 ` [PATCH 17/22] advansys: Remove array of scsi targets Matthew Wilcox
2007-09-09 14:56 ` [PATCH 18/22] advansys: Restructure asc_execute_scsi_cmnd() Matthew Wilcox
2007-09-09 14:56 ` [PATCH 19/22] advansys: Fix simultaneous calls to ->queuecommand Matthew Wilcox
2007-09-09 14:56 ` Matthew Wilcox [this message]
2007-09-09 14:56 ` [PATCH 21/22] advansys: Remove ASC_SELECT_QUEUE_DEPTHS Matthew Wilcox
2007-09-09 14:56 ` [PATCH 22/22] advansys: Remove ASC_WIDE_BOARD predicate Matthew Wilcox
2007-09-10 20:00 ` [0/22] Advansys updates 2007-09-09 FUJITA Tomonori
2007-09-11 18:18   ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11893498073093-git-send-email-matthew@wil.cx \
    --to=matthew@wil.cx \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.