diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2019-02-06 17:22:06 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-02-11 08:47:46 +0100 |
commit | eff0435d57634bc62c9fc05ad54a8829dfec3b96 (patch) | |
tree | c0dbd11d32c90129142a6cfa864230b1eb48ac92 /drivers/net/e1000 | |
parent | e487e808b682706cba6dcf1340769528d371fb6e (diff) | |
download | barebox-eff0435d57634bc62c9fc05ad54a8829dfec3b96.tar.gz barebox-eff0435d57634bc62c9fc05ad54a8829dfec3b96.tar.xz |
net/e1000: Improve Rx descriptor handling in e1000_poll()
Drop explicit volatile specifier as well as endianness conversion by
changing the code to use appropriate read*() IO accessors.
While at it if fix incorrect width used for "status" (8 vs 32) and
"len" (16 vs 32).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/main.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/e1000/main.c b/drivers/net/e1000/main.c index f13b48e0c8..b8222c7ae2 100644 --- a/drivers/net/e1000/main.c +++ b/drivers/net/e1000/main.c @@ -3391,11 +3391,10 @@ static void e1000_configure_rx(struct e1000_hw *hw) static int e1000_poll(struct eth_device *edev) { struct e1000_hw *hw = edev->priv; - volatile struct e1000_rx_desc *rd = &hw->rx_base[hw->rx_last]; - uint32_t len; + struct e1000_rx_desc *rd = &hw->rx_base[hw->rx_last]; - if (le32_to_cpu(rd->status) & E1000_RXD_STAT_DD) { - len = le32_to_cpu(rd->length); + if (readb(&rd->status) & E1000_RXD_STAT_DD) { + const uint16_t len = readw(&rd->length); dma_sync_single_for_cpu(hw->packet_dma, len, DMA_FROM_DEVICE); |