From: Heiner Kallweit <hkallweit1@gmail.com>
To: Daniel Golle <daniel@makrotopia.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Lunn <andrew@lunn.ch>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Chen Minqiang <ptpt52@gmail.com>, Chukun Pan <amadeus@jmu.edu.cn>,
Yevhen Kolomeiko <jarvis2709@gmail.com>,
Alexander Couzens <lynxis@fe80.eu>
Subject: Re: [RFC PATCH net-next 5/8] net: phy: realtek: use phy_read_paged instead of open coding
Date: Sat, 22 Apr 2023 17:11:57 +0200 [thread overview]
Message-ID: <d7eaf73b-282a-df7d-d9a5-530e431701a1@gmail.com> (raw)
In-Reply-To: <85eb0791bd614ccfdeccdc6fe39be55e602c521c.1682163424.git.daniel@makrotopia.org>
On 22.04.2023 13:48, Daniel Golle wrote:
> Instead of open coding a paged read, use the phy_read_paged function
> in rtlgen_supports_2_5gbps.
>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> drivers/net/phy/realtek.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index f97b5e49fae58..62fb965b6d338 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -735,9 +735,7 @@ static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
> {
> int val;
>
> - phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61);
> - val = phy_read(phydev, 0x13);
> - phy_write(phydev, RTL821x_PAGE_SELECT, 0);
> + val = phy_read_paged(phydev, 0xa61, 0x13);
>
> return val >= 0 && val & RTL_SUPPORTS_2500FULL;
> }
I remember I had a reason to open-code it, it took me some minutes
to recall it.
phy_read_paged() calls __phy_read_page() that relies on phydev->drv
being set. phydev->drv is set in phy_probe(). And probing is done
after matching. __phy_read_paged() should have given you a warning.
Did you test this patch? If yes and you didn't get the warning,
then apparently I miss something.
next prev parent reply other threads:[~2023-04-22 15:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-22 11:48 [RFC PATCH net-next 0/8] Improvements for RealTek 2.5G Ethernet PHYs Daniel Golle
2023-04-22 11:48 ` [RFC PATCH net-next 1/8] net: phy: realtek: rtl8221: allow to configure SERDES mode Daniel Golle
2023-04-22 11:48 ` [RFC PATCH net-next 2/8] net: phy: realtek: switch interface mode for RTL822x series Daniel Golle
2023-04-22 11:48 ` [RFC PATCH net-next 3/8] net: phy: realtek: use genphy_soft_reset for 2.5G PHYs Daniel Golle
2023-04-22 11:48 ` [RFC PATCH net-next 4/8] net: phy: realtek: disable SGMII in-band AN " Daniel Golle
2023-04-22 11:48 ` [RFC PATCH net-next 5/8] net: phy: realtek: use phy_read_paged instead of open coding Daniel Golle
2023-04-22 15:11 ` Heiner Kallweit [this message]
2023-04-23 18:01 ` Daniel Golle
2023-05-01 10:32 ` Heiner Kallweit
2023-04-22 11:49 ` [RFC PATCH net-next 6/8] net: phy: realtek: use inline functions for 10GbE advertisement Daniel Golle
2023-04-22 11:49 ` [RFC PATCH net-next 7/8] net: phy: realtek: check validity of 10GbE link-partner advertisement Daniel Golle
2023-04-22 11:49 ` [RFC PATCH net-next 8/8] net: phy: realtek: setup ALDPS on RTL822x Daniel Golle
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=d7eaf73b-282a-df7d-d9a5-530e431701a1@gmail.com \
--to=hkallweit1@gmail.com \
--cc=amadeus@jmu.edu.cn \
--cc=andrew@lunn.ch \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jarvis2709@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lynxis@fe80.eu \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ptpt52@gmail.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
all inboxes | Powered by JetHome®