net: phy: realtek: get rid of magic numbers in rtl8201_config_intr()
Subsystems (3)
PATCH 1/1 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
--- drivers/net/phy/realtek/realtek_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/net/phy/realtek/realtek_main.c +12 -3
@@ -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)
@@ -346,11 +353,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;
Signature · 1 line
2.51.0
Quoted 6 lines · Aleksander Jan Bajkowski
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 <[email protected]>
Quoted 36 lines · Aleksander Jan Bajkowski
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 <[email protected]>--- drivers/net/phy/realtek/realtek_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)drivers/net/phy/realtek/realtek_main.c +7
-2@@ -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)@@ -346,11 +353,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);
drivers/net/phy/realtek/realtek_main.c static int rtl8201_config_intr(struct phy_device · line 365
Quoted 10 lines
drivers/net/phy/realtek/realtek_main.c +5
-1+ 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;
Matches the datasheet (RTL8201F/RTL8201FL/RTL8201FN Rev. 1.4 Datasheet)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 6 Apr 2026 22:12:12 +0200 you wrote:
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 <[email protected]>[...]
Here is the summary with links:
- [net-next] net: phy: realtek: get rid of magic numbers in rtl8201_config_intr()
https://git.kernel.org/netdev/net-next/c/dbc2bb4e8742
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html