Skip to contentSkip to conversation

scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout

PATCH Applied Gustavo A. R. Silva 3 participants 4 messages Nov 3, 2017 – Nov 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout

Make use of the swap macro and remove unnecessary variable tmp. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

---
 drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -6
index e0640e0..9e3bf53 100644
@@ -547,12 +547,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
 	nopout_wqe->op_attr = ISCSI_FLAG_CMD_FINAL;
 	memcpy(nopout_wqe->lun, &nopout_hdr->lun, 8);
 
-	if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
-		u32 tmp = nopout_wqe->lun[0];
-		/* 57710 requires LUN field to be swapped */
-		nopout_wqe->lun[0] = nopout_wqe->lun[1];
-		nopout_wqe->lun[1] = tmp;
-	}
+	/* 57710 requires LUN field to be swapped */
+	if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type))
+		swap(nopout_wqe->lun[0], nopout_wqe->lun[1]);
 
 	nopout_wqe->itt = ((u16)task->itt |
 			   (ISCSI_TASK_TYPE_MPATH <<
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 31 lines · Gustavo A. R. Silva

Make use of the swap macro and remove unnecessary variable tmp. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

---
drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++------

1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -6
index e0640e0..9e3bf53 100644
@@ -547,12 +547,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn
 *bnx2i_conn,
 	nopout_wqe->op_attr = ISCSI_FLAG_CMD_FINAL;
 	memcpy(nopout_wqe->lun, &nopout_hdr->lun, 8);
 
-	if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
-		u32 tmp = nopout_wqe->lun[0];
-		/* 57710 requires LUN field to be swapped */
-		nopout_wqe->lun[0] = nopout_wqe->lun[1];
-		nopout_wqe->lun[1] = tmp;
-	}
+	/* 57710 requires LUN field to be swapped */
+	if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type))
+		swap(nopout_wqe->lun[0], nopout_wqe->lun[1]);
 
 	nopout_wqe->itt = ((u16)task->itt |
Quoted 3 lines

(ISCSI_TASK_TYPE_MPATH <<

Signature · 1 line
2.7.4

Thanks,

Quoted 1 line
#2 lore raw

Quoting "Rangankar, Manish" <[email protected]>:

Quoted 32 lines · Gustavo A. R. Silva
Quoted 31 lines

Make use of the swap macro and remove unnecessary variable tmp. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

---
drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++------

1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -6
index e0640e0..9e3bf53 100644
@@ -547,12 +547,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn
 *bnx2i_conn,
 	nopout_wqe->op_attr = ISCSI_FLAG_CMD_FINAL;
 	memcpy(nopout_wqe->lun, &nopout_hdr->lun, 8);
 
-	if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
-		u32 tmp = nopout_wqe->lun[0];
-		/* 57710 requires LUN field to be swapped */
-		nopout_wqe->lun[0] = nopout_wqe->lun[1];
-		nopout_wqe->lun[1] = tmp;
-	}
+	/* 57710 requires LUN field to be swapped */
+	if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type))
+		swap(nopout_wqe->lun[0], nopout_wqe->lun[1]);
 
Quoted 9 lines
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +0 -0
 	nopout_wqe->itt = ((u16)task->itt |

(ISCSI_TASK_TYPE_MPATH <<
--
2.7.4

Thanks,

Thank you, Manish.

--
Gustavo A. R. Silva

#3 lore raw
In reply to Gustavo A. R. Silva

Gustavo A.,

Quoted 2 lines

Make use of the swap macro and remove unnecessary variable tmp. This makes the code easier to read and maintain.

Applied to 4.16/scsi-queue. Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering