[PATCH 4/5] qla2xxx: Reinstated the union in qla_tgt_mgmt_cmd struct in qla_target.h.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxx>

Removing the union required adding typecasts in the code, which was
felt to be even worse than before.
Also, removed the iocb_t struct added earlier. This struct had replaced
the union earlier. Now that the union has been reinstated, this struct
is not needed.

Signed-off-by: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_target.c |   14 +++++++-------
 drivers/scsi/qla2xxx/qla_target.h |   11 +++++------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 48d807c..9b198ac 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1496,7 +1496,7 @@ static int __qla_tgt_24xx_handle_abts(struct scsi_qla_host *vha,
 	memset(mcmd, 0, sizeof(*mcmd));
 
 	mcmd->sess = sess;
-	memcpy(&mcmd->orig_iocb, abts, sizeof(mcmd->orig_iocb));
+	memcpy(&mcmd->orig_iocb.abts, abts, sizeof(mcmd->orig_iocb.abts));
 
 	rc = ha->tgt_ops->handle_tmr(mcmd, 0, ABORT_TASK);
 	if (rc != 0) {
@@ -1571,7 +1571,7 @@ static void qla_tgt_24xx_handle_abts(struct scsi_qla_host *vha,
 static void qla_tgt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha,
 	struct qla_tgt_mgmt_cmd *mcmd, uint32_t resp_code)
 {
-	atio_from_isp_t *atio = (atio_from_isp_t *)&mcmd->orig_iocb;
+	atio_from_isp_t *atio = &mcmd->orig_iocb.atio;
 	ctio7_to_24xx_t *ctio;
 
 	ql_dbg(ql_dbg_tgt, ha, 0xe00a, "Sending task mgmt CTIO7 (ha=%p,"
@@ -1628,12 +1628,11 @@ void qla_tgt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd)
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 	if (IS_FWI2_CAPABLE(ha)) {
 		if (mcmd->flags == QLA24XX_MGMT_SEND_NACK)
-			qla_tgt_send_notify_ack(vha, (imm_ntfy_from_isp_t *)&mcmd->orig_iocb,
+			qla_tgt_send_notify_ack(vha, &mcmd->orig_iocb.imm_ntfy,
 				0, 0, 0, 0, 0, 0);
 		else {
 			if (mcmd->se_tmr_req->function == ABORT_TASK)
-				qla_tgt_24xx_send_abts_resp(vha,
-					(abts_recv_from_24xx_t *)&mcmd->orig_iocb,
+				qla_tgt_24xx_send_abts_resp(vha, &mcmd->orig_iocb.abts,
 					mcmd->fc_tm_rsp, false);
 			else
 				qla_tgt_24xx_send_task_mgmt_ctio(vha, mcmd, mcmd->fc_tm_rsp);
@@ -3268,7 +3267,8 @@ static int qla_tgt_issue_task_mgmt(struct qla_tgt_sess *sess, uint32_t lun,
 	mcmd->sess = sess;
 
 	if (iocb) {
-		memcpy(&mcmd->orig_iocb, iocb, sizeof(mcmd->orig_iocb));
+		memcpy(&mcmd->orig_iocb.imm_ntfy, iocb,
+			sizeof(mcmd->orig_iocb.imm_ntfy));
 	}
 	mcmd->tmr_func = fn;
 	mcmd->flags = flags;
@@ -3409,7 +3409,7 @@ static int __qla_tgt_abort_task(struct scsi_qla_host *vha,
 	memset(mcmd, 0, sizeof(*mcmd));
 
 	mcmd->sess = sess;
-	memcpy(&mcmd->orig_iocb, iocb, sizeof(mcmd->orig_iocb));
+	memcpy(&mcmd->orig_iocb.imm_ntfy, iocb, sizeof(mcmd->orig_iocb.imm_ntfy));
 
 	tag = le16_to_cpu(iocb->u.isp2x.seq_id);
 
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 7767d2e..63e4d84 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -113,11 +113,6 @@
  * ISP Queue types left out of new QLogic driver (from old version)
 \********************************************************************/
 
-/* Generic IOCB struct */
-typedef struct {
-	uint8_t data[64];
-} iocb_t;
-
 #ifndef ENABLE_LUN_TYPE
 #define ENABLE_LUN_TYPE 0x0B		/* Enable LUN entry. */
 /*
@@ -978,7 +973,11 @@ struct qla_tgt_mgmt_cmd {
 	struct se_tmr_req *se_tmr_req;
 	unsigned int flags;
 #define QLA24XX_MGMT_SEND_NACK	1
-	iocb_t orig_iocb;
+	union {
+		atio_from_isp_t atio;
+		imm_ntfy_from_isp_t imm_ntfy;
+		abts_recv_from_24xx_t abts;
+	} __attribute__((packed)) orig_iocb;
 };
 
 struct qla_tgt_prm {
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux