diff mbox

[U-Boot,v2] net: e1000: use correct helper to do endianness conversion

Message ID 1450692422-51492-1-git-send-email-yanmiaobest@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Miao Yan Dec. 21, 2015, 10:07 a.m. UTC
In struct e1000_rx_desc, field 'length' is declared as
uint16_t, so use le16_to_cpu() to do endianness conversion.

Also drop conversion on 'status' which is declared as
uint8_t.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
---
Changes in v2: 
  - fix typos in commit message

 drivers/net/e1000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bin Meng Dec. 21, 2015, 12:06 p.m. UTC | #1
On Mon, Dec 21, 2015 at 6:07 PM, Miao Yan <yanmiaobest@gmail.com> wrote:
> In struct e1000_rx_desc, field 'length' is declared as
> uint16_t, so use le16_to_cpu() to do endianness conversion.
>
> Also drop conversion on 'status' which is declared as
> uint8_t.
>
> Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
> ---
> Changes in v2:
>   - fix typos in commit message
>
>  drivers/net/e1000.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tom Rini Jan. 4, 2016, 10:23 p.m. UTC | #2
On Mon, Dec 21, 2015 at 02:07:02AM -0800, Miao Yan wrote:

> In struct e1000_rx_desc, field 'length' is declared as
> uint16_t, so use le16_to_cpu() to do endianness conversion.
> 
> Also drop conversion on 'status' which is declared as
> uint8_t.
> 
> Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 2ba03ed..6124bf0 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5165,11 +5165,11 @@  _e1000_poll(struct e1000_hw *hw)
 	inval_end = inval_start + roundup(sizeof(*rd), ARCH_DMA_MINALIGN);
 	invalidate_dcache_range(inval_start, inval_end);
 
-	if (!(le32_to_cpu(rd->status)) & E1000_RXD_STAT_DD)
+	if (!(rd->status & E1000_RXD_STAT_DD))
 		return 0;
 	/* DEBUGOUT("recv: packet len=%d\n", rd->length); */
 	/* Packet received, make sure the data are re-loaded from RAM. */
-	len = le32_to_cpu(rd->length);
+	len = le16_to_cpu(rd->length);
 	invalidate_dcache_range((unsigned long)packet,
 				(unsigned long)packet +
 				roundup(len, ARCH_DMA_MINALIGN));