All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Dhananjay Phadke <dhananjay@netxen.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] netxen: endian annotation of netxen_nic_write_w1, netxen_nic_read_w1
Date: Wed, 22 Oct 2008 21:58:17 -0700	[thread overview]
Message-ID: <1224737897.6823.26.camel@brick> (raw)

The value parameter was always a le32, mark it as such.  Also a small
fix for the msi vector which is a le16, not a le32.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Patches 1 and 2 are fairly non-controversial, patch 3 is not comprehensive
as it only covers the places sparse warns about, a comprehensive audit
of the struct endianness would be helpful.

Also, once this was all done, it pointed out a possible problem in
netxen_nic_ctx.c:nx_fw_cmd_create_rx_ctx, line 291:

recv_ctx->virt_port = le16_to_cpu(prsp->virt_port);

You should check the definition of prsp->virt_port, as currently it is a u8,
other than the le32/le16 mixup noted in this changelog, this was the only endian
mismatch/oddity I found.

 drivers/net/netxen/netxen_nic.h     |    4 ++--
 drivers/net/netxen/netxen_nic_ctx.c |   10 ++++++----
 drivers/net/netxen/netxen_nic_hw.c  |    4 ++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index f8e601c..18c699d 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1411,8 +1411,8 @@ void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val);
 int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off);
 void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value);
 void netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index, u32 *value);
-void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, u32 value);
-void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, u32 *value);
+void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, __le32 value);
+void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, __le32 *value);
 
 int netxen_nic_get_board_info(struct netxen_adapter *adapter);
 
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 64b5164..dd1b653 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -76,7 +76,8 @@ netxen_api_unlock(struct netxen_adapter *adapter)
 static u32
 netxen_poll_rsp(struct netxen_adapter *adapter)
 {
-	u32 raw_rsp, rsp = NX_CDRP_RSP_OK;
+	__le32 raw_rsp;
+	u32 rsp = NX_CDRP_RSP_OK;
 	int	timeout = 0;
 
 	do {
@@ -132,8 +133,9 @@ netxen_issue_cmd(struct netxen_adapter *adapter,
 
 		rcode = NX_RCODE_TIMEOUT;
 	} else if (rsp == NX_CDRP_RSP_FAIL) {
-		netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode);
-		rcode = le32_to_cpu(rcode);
+		__le32 raw_rcode;
+		netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &raw_rcode);
+		rcode = le32_to_cpu(raw_rcode);
 
 		printk(KERN_ERR "%s: failed card response code:0x%x\n",
 				netxen_nic_driver_name, rcode);
@@ -247,7 +249,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
 		cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr);
 	prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count);
 	/* only one msix vector for now */
-	prq_sds[0].msi_index = cpu_to_le32(0);
+	prq_sds[0].msi_index = cpu_to_le16(0);
 
 	/* now byteswap offsets */
 	prq->rds_ring_offset = cpu_to_le32(prq->rds_ring_offset);
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 84978f8..fcba06d 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1191,12 +1191,12 @@ void netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index, u32 *value)
 	adapter->hw_read_wx(adapter, index, value, 4);
 }
 
-void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, u32 value)
+void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, __le32 value)
 {
 	adapter->hw_write_wx(adapter, index, &value, 4);
 }
 
-void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, u32 *value)
+void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, __le32 *value)
 {
 	adapter->hw_read_wx(adapter, index, value, 4);
 }
-- 
1.6.0.3.723.g757e



                 reply	other threads:[~2008-10-23  4:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1224737897.6823.26.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhananjay@netxen.com \
    --cc=linux-kernel@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.