linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout
@ 2017-11-03 19:58 Gustavo A. R. Silva
  2017-11-13  8:33 ` Rangankar, Manish
  2017-11-21  2:28 ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-03 19:58 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, 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.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index e0640e0..9e3bf53 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -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 <<
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout
  2017-11-03 19:58 [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout Gustavo A. R. Silva
@ 2017-11-13  8:33 ` Rangankar, Manish
  2017-11-20  5:04   ` Gustavo A. R. Silva
  2017-11-21  2:28 ` Martin K. Petersen
  1 sibling, 1 reply; 4+ messages in thread
From: Rangankar, Manish @ 2017-11-13  8:33 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Dept-Eng QLogic Storage Upstream,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel


On 04/11/17 1:28 AM, "Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:

>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.
>
>Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>---
> drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c
>b/drivers/scsi/bnx2i/bnx2i_hwi.c
>index e0640e0..9e3bf53 100644
>--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
>+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
>@@ -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 <<
>-- 
>2.7.4

Thanks,

Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>

>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout
  2017-11-13  8:33 ` Rangankar, Manish
@ 2017-11-20  5:04   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-20  5:04 UTC (permalink / raw)
  To: Rangankar, Manish
  Cc: Dept-Eng QLogic Storage Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel


Quoting "Rangankar, Manish" <Manish.Rangankar@cavium.com>:

> On 04/11/17 1:28 AM, "Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:
>
>> 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.
>>
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>> drivers/scsi/bnx2i/bnx2i_hwi.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c
>> b/drivers/scsi/bnx2i/bnx2i_hwi.c
>> index e0640e0..9e3bf53 100644
>> --- a/drivers/scsi/bnx2i/bnx2i_hwi.c
>> +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
>> @@ -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 <<
>> --
>> 2.7.4
>
> Thanks,
>
> Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
>

Thank you, Manish.

--
Gustavo A. R. Silva

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout
  2017-11-03 19:58 [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout Gustavo A. R. Silva
  2017-11-13  8:33 ` Rangankar, Manish
@ 2017-11-21  2:28 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-11-21  2:28 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel


Gustavo A.,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-21  2:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 19:58 [PATCH] scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout Gustavo A. R. Silva
2017-11-13  8:33 ` Rangankar, Manish
2017-11-20  5:04   ` Gustavo A. R. Silva
2017-11-21  2:28 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).