All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: James Bottomley <James.Bottomley@SteelEye.com>,
	Linux-SCSI Mailing List <linux-scsi@vger.kernel.org>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Subject: [PATCH 3/12]  qla2xxx: Collapse ISP2xxx queuecommand implementations.
Date: Thu, 13 Oct 2005 16:16:04 -0700 (PDT)	[thread overview]
Message-ID: <20051013231604.27191.9981.sendpatchset@plap.qlogic.com> (raw)
In-Reply-To: <20051013231534.27191.19815.sendpatchset@plap.qlogic.com>

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>

---

 drivers/scsi/qla2xxx/qla_os.c |  144 ++++++++++++-----------------------------
 1 files changed, 41 insertions(+), 103 deletions(-)

applies-to: 78d6d6feb3837ff269b56e589bfba93fd55f9d81
6575ef7122e7f3ce8fc8c90412b2ad4dba65e03c
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 141ff12..04d06a3 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -355,111 +355,49 @@ qla2x00_get_new_sp(scsi_qla_host_t *ha, 
 	return sp;
 }
 
-static int
-qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
-{
-	scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
-	fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
-	srb_t *sp;
-	int rval;
-
-	if (!fcport) {
-		cmd->result = DID_NO_CONNECT << 16;
-		goto qc_fail_command;
-	}
-
-	if (atomic_read(&fcport->state) != FCS_ONLINE) {
-		if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-		    atomic_read(&ha->loop_state) == LOOP_DEAD) {
-			cmd->result = DID_NO_CONNECT << 16;
-			goto qc_fail_command;
-		}
-		goto qc_host_busy;
-	}
-
-	spin_unlock_irq(ha->host->host_lock);
-
-	sp = qla2x00_get_new_sp(ha, fcport, cmd, done);
-	if (!sp)
-		goto qc_host_busy_lock;
-
-	rval = qla2x00_start_scsi(sp);
-	if (rval != QLA_SUCCESS)
-		goto qc_host_busy_free_sp;
-
-	spin_lock_irq(ha->host->host_lock);
-
-	return 0;
-
-qc_host_busy_free_sp:
-	qla2x00_sp_free_dma(ha, sp);
-	mempool_free(sp, ha->srb_mempool);
-
-qc_host_busy_lock:
-	spin_lock_irq(ha->host->host_lock);
-
-qc_host_busy:
-	return SCSI_MLQUEUE_HOST_BUSY;
-
-qc_fail_command:
-	done(cmd);
-
-	return 0;
-}
-
-
-static int
-qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
-{
-	scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
-	fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
-	srb_t *sp;
-	int rval;
-
-	if (!fcport) {
-		cmd->result = DID_NO_CONNECT << 16;
-		goto qc24_fail_command;
-	}
-
-	if (atomic_read(&fcport->state) != FCS_ONLINE) {
-		if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
-		    atomic_read(&ha->loop_state) == LOOP_DEAD) {
-			cmd->result = DID_NO_CONNECT << 16;
-			goto qc24_fail_command;
-		}
-		goto qc24_host_busy;
-	}
-
-	spin_unlock_irq(ha->host->host_lock);
-
-	sp = qla2x00_get_new_sp(ha, fcport, cmd, done);
-	if (!sp)
-		goto qc24_host_busy_lock;
-
-	rval = qla24xx_start_scsi(sp);
-	if (rval != QLA_SUCCESS)
-		goto qc24_host_busy_free_sp;
-
-	spin_lock_irq(ha->host->host_lock);
-
-	return 0;
-
-qc24_host_busy_free_sp:
-	qla2x00_sp_free_dma(ha, sp);
-	mempool_free(sp, ha->srb_mempool);
-
-qc24_host_busy_lock:
-	spin_lock_irq(ha->host->host_lock);
-
-qc24_host_busy:
-	return SCSI_MLQUEUE_HOST_BUSY;
-
-qc24_fail_command:
-	done(cmd);
-
-	return 0;
+#define QLA_QUEUE_COMMAND(isp)  \
+static int \
+isp##_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) \
+{ \
+	scsi_qla_host_t *ha = to_qla_host(cmd->device->host); \
+	fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; \
+	srb_t *sp; \
+	int rval; \
+	if (!fcport) { \
+		cmd->result = DID_NO_CONNECT << 16; \
+		goto fail_command; \
+	} \
+	if (atomic_read(&fcport->state) != FCS_ONLINE) { \
+		if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || \
+		    atomic_read(&ha->loop_state) == LOOP_DEAD) { \
+			cmd->result = DID_NO_CONNECT << 16; \
+			goto fail_command; \
+		} \
+		goto host_busy; \
+	} \
+	spin_unlock_irq(ha->host->host_lock); \
+	sp = qla2x00_get_new_sp(ha, fcport, cmd, done); \
+	if (!sp) \
+		goto host_busy_lock; \
+	rval = isp##_start_scsi(sp); \
+	if (rval != QLA_SUCCESS) \
+		goto host_busy_free_sp; \
+	spin_lock_irq(ha->host->host_lock); \
+	return 0; \
+host_busy_free_sp: \
+	qla2x00_sp_free_dma(ha, sp); \
+	mempool_free(sp, ha->srb_mempool); \
+host_busy_lock: \
+	spin_lock_irq(ha->host->host_lock); \
+host_busy: \
+	return SCSI_MLQUEUE_HOST_BUSY; \
+fail_command: \
+	done(cmd); \
+	return 0; \
 }
 
+QLA_QUEUE_COMMAND(qla2x00);
+QLA_QUEUE_COMMAND(qla24xx);
 
 /*
  * qla2x00_eh_wait_on_command
---
0.99.8.GIT

-- 
Andrew Vasquez

  parent reply	other threads:[~2005-10-13 23:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 23:15 [PATCH 0/16] qla2xxx: update qla2xxx driver to 8.01.02-k Andrew Vasquez
2005-10-13 23:15 ` [PATCH 1/12] qla2xxx: Correct issue where fcport is prematurely marked DEAD Andrew Vasquez
2005-10-13 23:15 ` [PATCH 2/12] qla2xxx: Add support to dynamically enable/disable ZIO Andrew Vasquez
2005-10-13 23:16 ` Andrew Vasquez [this message]
2005-10-14 10:24   ` [PATCH 3/12] qla2xxx: Collapse ISP2xxx queuecommand implementations Christoph Hellwig
2005-10-14 22:43     ` Andrew Vasquez
2005-10-13 23:16 ` [PATCH 4/12] qla2xxx: Update license Andrew Vasquez
2005-10-14  7:30   ` Arjan van de Ven
2005-10-14 13:37     ` Douglas Gilbert
2005-10-14 13:53       ` Arjan van de Ven
2005-10-14 16:27     ` Andrew Vasquez
2005-10-14 18:47       ` Arjan van de Ven
2005-10-19 17:37         ` Andrew Vasquez
2005-10-19 17:43           ` Christoph Hellwig
2005-10-19 17:50             ` Andrew Vasquez
2005-10-19 18:22               ` Christoph Hellwig
2005-10-19 18:18           ` Arjan van de Ven
2005-10-15 11:56   ` Christoph Hellwig
2005-10-16  0:38     ` Douglas Gilbert
2005-10-16  8:32       ` Arjan van de Ven
2005-10-13 23:16 ` [PATCH 5/12] qla2xxx: Add support for embedded ISP24xx firmware Andrew Vasquez
2005-10-14  9:47   ` Christoph Hellwig
2005-10-14 16:50     ` Andrew Vasquez
2005-10-15 11:58       ` Christoph Hellwig
2005-10-17 21:34         ` Andrew Vasquez
2005-10-19 16:19           ` Christoph Hellwig
2005-10-13 23:16 ` [PATCH 6/12] qla2xxx: Resync with latest released firmware -- 4.00.12 Andrew Vasquez
2005-10-13 23:16 ` [PATCH 7/12] qla2xxx: Add hotplug firmware-load support for all ISP types Andrew Vasquez
2005-10-13 23:16 ` [PATCH 8/12] qla2xxx: Resync with latest released ISP23xx/63xx firmware -- 3.03.18 Andrew Vasquez
2005-10-13 23:17 ` [PATCH 9/12] qla2xxx: Use midlayer's int_to_scsilun() function Andrew Vasquez
2005-10-15 11:58   ` Christoph Hellwig
2005-10-13 23:17 ` [PATCH 10/12] qla2xxx: Correct fw-loader module-use referencing Andrew Vasquez
2005-10-13 23:17 ` [PATCH 11/12] qla2xxx: Add an 'Issue LIP' device attribute Andrew Vasquez
2005-10-14  9:48   ` Christoph Hellwig
2005-10-14 22:44     ` Andrew Vasquez
2005-10-27 23:03     ` Andrew Vasquez
2005-10-28 22:53       ` Christoph Hellwig
2005-10-13 23:17 ` [PATCH 12/12] qla2xxx: Update version number to 8.01.02-k Andrew Vasquez
2005-10-19 17:42 ` [PATCH 0/16] qla2xxx: update qla2xxx driver " Andrew Vasquez
2005-10-20 23:47   ` James Bottomley
2005-10-21 21:07     ` Andrew Vasquez

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=20051013231604.27191.9981.sendpatchset@plap.qlogic.com \
    --to=andrew.vasquez@qlogic.com \
    --cc=James.Bottomley@SteelEye.com \
    --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.