[PATCH 1/2] net: r8169: use lower/upper_32_bits for clarity

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Oct 14 04:52:31 PDT 2024


No functional difference, but the code is much more readable without the
casts and shifts.

Additional benefit is removing the strange use of DMA_BIT_MASK here.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/net/r8169_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/r8169_main.c b/drivers/net/r8169_main.c
index cd45677131ab..2d895cf88b43 100644
--- a/drivers/net/r8169_main.c
+++ b/drivers/net/r8169_main.c
@@ -1542,10 +1542,10 @@ static void rtl_set_rx_tx_desc_registers(struct rtl8169_private *tp)
 	 * register to be written before TxDescAddrLow to work.
 	 * Switching from MMIO to I/O access fixes the issue as well.
 	 */
-	RTL_W32(tp, TxDescStartAddrHigh, ((u64) tp->TxPhyAddr) >> 32);
-	RTL_W32(tp, TxDescStartAddrLow, ((u64) tp->TxPhyAddr) & DMA_BIT_MASK(32));
-	RTL_W32(tp, RxDescAddrHigh, ((u64) tp->RxPhyAddr) >> 32);
-	RTL_W32(tp, RxDescAddrLow, ((u64) tp->RxPhyAddr) & DMA_BIT_MASK(32));
+	RTL_W32(tp, TxDescStartAddrHigh, upper_32_bits(tp->TxPhyAddr));
+	RTL_W32(tp, TxDescStartAddrLow, lower_32_bits(tp->TxPhyAddr));
+	RTL_W32(tp, RxDescAddrHigh, upper_32_bits(tp->RxPhyAddr));
+	RTL_W32(tp, RxDescAddrLow, lower_32_bits(tp->RxPhyAddr));
 }
 
 static void rtl8169_set_magic_reg(struct rtl8169_private *tp)
-- 
2.39.5




More information about the barebox mailing list