All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Daniel Wagner <dwagner@suse.de>, Quinn Tran <qutran@marvell.com>,
	Martin Wilck <mwilck@suse.com>,
	Roman Bolshakov <r.bolshakov@yadro.com>
Subject: [PATCH v3 2/5] qla2xxx: Suppress endianness complaints in qla2x00_configure_local_loop()
Date: Wed, 19 Feb 2020 20:34:38 -0800	[thread overview]
Message-ID: <20200220043441.20504-3-bvanassche@acm.org> (raw)
In-Reply-To: <20200220043441.20504-1-bvanassche@acm.org>

Instead of changing endianness in-place, write the data in CPU endian format
in another buffer and copy that buffer back. This patch does not change any
functionality but silences some sparse endianness warnings.

Reviewed-by: Daniel Wagner <dwagner@suse.de>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla2xxx/qla_def.h  |  2 +-
 drivers/scsi/qla2xxx/qla_init.c | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index c5a067f45005..b04d334933ef 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -414,7 +414,7 @@ struct els_logo_payload {
 struct els_plogi_payload {
 	uint8_t opcode;
 	uint8_t rsvd[3];
-	uint8_t data[112];
+	__be32	data[112 / 4];
 };
 
 struct ct_arg {
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 9e6b56527b25..880f2be062a9 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -5060,7 +5060,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
 	if (N2N_TOPO(ha)) {
 		if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) {
 			/* borrowing */
-			u32 *bp, i, sz;
+			u32 *bp, sz;
 
 			memset(ha->init_cb, 0, ha->init_cb_size);
 			sz = min_t(int, sizeof(struct els_plogi_payload),
@@ -5068,13 +5068,12 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
 			rval = qla24xx_get_port_login_templ(vha,
 			    ha->init_cb_dma, (void *)ha->init_cb, sz);
 			if (rval == QLA_SUCCESS) {
+				__be32 *q = &ha->plogi_els_payld.data[0];
+
 				bp = (uint32_t *)ha->init_cb;
-				for (i = 0; i < sz/4 ; i++, bp++)
-					*bp = cpu_to_be32(*bp);
+				cpu_to_be32_array(q, bp, sz / 4);
 
-				memcpy(&ha->plogi_els_payld.data,
-				    (void *)ha->init_cb,
-				    sizeof(ha->plogi_els_payld.data));
+				memcpy(bp, q, sizeof(ha->plogi_els_payld.data));
 			} else {
 				ql_dbg(ql_dbg_init, vha, 0x00d1,
 				    "PLOGI ELS param read fail.\n");

  parent reply	other threads:[~2020-02-20  4:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  4:34 [PATCH v3 0/5] qla2xxx patches for kernel v5.7 Bart Van Assche
2020-02-20  4:34 ` [PATCH v3 1/5] qla2xxx: Simplify the code for aborting SCSI commands Bart Van Assche
2020-02-20  4:34 ` Bart Van Assche [this message]
2020-02-23 19:32   ` [PATCH v3 2/5] qla2xxx: Suppress endianness complaints in qla2x00_configure_local_loop() Roman Bolshakov
2020-02-20  4:34 ` [PATCH v3 3/5] qla2xxx: Fix sparse warnings triggered by the PCI state checking code Bart Van Assche
2020-02-25 19:13   ` Roman Bolshakov
2020-02-20  4:34 ` [PATCH v3 4/5] qla2xxx: Convert MAKE_HANDLE() from a define into an inline function Bart Van Assche
2020-02-20  8:21   ` Daniel Wagner
2020-02-20 16:28     ` Bart Van Assche
2020-02-21 15:37       ` Daniel Wagner
2020-02-26  0:28   ` Roman Bolshakov
2020-02-20  4:34 ` [PATCH v3 5/5] qla2xxx: Fix the endianness annotations for the port attribute max_frame_size member Bart Van Assche
2020-02-25 19:34   ` Roman Bolshakov
2020-02-29  1:10 ` [PATCH v3 0/5] qla2xxx patches for kernel v5.7 Martin K. Petersen

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=20200220043441.20504-3-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=dwagner@suse.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mwilck@suse.com \
    --cc=qutran@marvell.com \
    --cc=r.bolshakov@yadro.com \
    /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.