From: Nicolai Buchwitz <nb@tipi-net.de>
To: Aleksander Jan Bajkowski <olek2@wp.pl>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, daniel@makrotopia.org,
vladimir.oltean@nxp.com, michael@fossekall.de,
markus.stockhausen@gmx.de, ih@simonwunderlich.de,
rmk+kernel@armlinux.org.uk, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: phy: realtek: get rid of magic numbers in rtl8201_config_intr()
Date: Mon, 06 Apr 2026 22:44:10 +0200 [thread overview]
Message-ID: <bfd0b7c94c9bda4e8fc5789ce7b3fbee@tipi-net.de> (raw)
In-Reply-To: <20260406201222.1043396-1-olek2@wp.pl>
On 6.4.2026 22:12, Aleksander Jan Bajkowski 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 <olek2@wp.pl>
> ---
> drivers/net/phy/realtek/realtek_main.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/realtek/realtek_main.c
> b/drivers/net/phy/realtek/realtek_main.c
> index 75565fbdbf6d..e78f3b9e89db 100644
> --- a/drivers/net/phy/realtek/realtek_main.c
> +++ b/drivers/net/phy/realtek/realtek_main.c
> @@ -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;
Matches the datasheet (RTL8201F/RTL8201FL/RTL8201FN Rev. 1.4 Datasheet)
Reviewed-by: Nicolai Buchwitz nb@tipi-net.de
prev parent reply other threads:[~2026-04-06 20:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 20:12 [PATCH net-next] net: phy: realtek: get rid of magic numbers in rtl8201_config_intr() Aleksander Jan Bajkowski
2026-04-06 20:43 ` Daniel Golle
2026-04-06 20:44 ` Nicolai Buchwitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bfd0b7c94c9bda4e8fc5789ce7b3fbee@tipi-net.de \
--to=nb@tipi-net.de \
--cc=andrew@lunn.ch \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=ih@simonwunderlich.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=markus.stockhausen@gmx.de \
--cc=michael@fossekall.de \
--cc=netdev@vger.kernel.org \
--cc=olek2@wp.pl \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox