[PATCH 08/16] net/e1000: Improve Rx descriptor handling in e1000_poll()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/net/e1000/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/e1000/main.c b/drivers/net/e1000/main.c
index f13b48e0c..b8222c7ae 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);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux