mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 07:51:31 -04:00
net: phy: realtek: get rid of magic numbers in rtl8201_config_intr()
Replace the magic numbers with defines. Register names were obtained from publicly available documentation[1]. This should make it clear what's going on in the code. 1. RTL8201F/RTL8201FL/RTL8201FN Rev. 1.4 Datasheet Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Reviewed-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Nicolai Buchwitz nb@tipi-net.de Link: https://patch.msgid.link/20260406201222.1043396-1-olek2@wp.pl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
f81f4e79b1
commit
dbc2bb4e87
@@ -22,7 +22,14 @@
|
||||
#include "../phylib.h"
|
||||
#include "realtek.h"
|
||||
|
||||
#define RTL8201F_IER_PAGE 0x07
|
||||
#define RTL8201F_IER 0x13
|
||||
#define RTL8201F_IER_LINK BIT(13)
|
||||
#define RTL8201F_IER_DUPLEX BIT(12)
|
||||
#define RTL8201F_IER_ANERR BIT(11)
|
||||
#define RTL8201F_IER_MASK (RTL8201F_IER_ANERR | \
|
||||
RTL8201F_IER_DUPLEX | \
|
||||
RTL8201F_IER_LINK)
|
||||
|
||||
#define RTL8201F_ISR 0x1e
|
||||
#define RTL8201F_ISR_ANERR BIT(15)
|
||||
@@ -349,11 +356,13 @@ static int rtl8201_config_intr(struct phy_device *phydev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
val = BIT(13) | BIT(12) | BIT(11);
|
||||
err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
|
||||
val = RTL8201F_IER_MASK;
|
||||
err = phy_write_paged(phydev, RTL8201F_IER_PAGE,
|
||||
RTL8201F_IER, val);
|
||||
} else {
|
||||
val = 0;
|
||||
err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
|
||||
err = phy_write_paged(phydev, RTL8201F_IER_PAGE,
|
||||
RTL8201F_IER, val);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user