From: Andrew Lunn <andrew@lunn.ch>
To: Charles Perry <charles.perry@microchip.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
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>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
netdev@vger.kernel.org,
Tim Menninger <tmenninger@purestorage.com>,
Florian Fainelli <florian.fainelli@broadcom.com>
Subject: Re: [PATCH net-next v2 1/2] net: phy: c45 scanning: Don't consider -ENODEV fatal
Date: Tue, 7 Apr 2026 20:57:33 +0200 [thread overview]
Message-ID: <edc33490-09b5-49fd-a1f9-72d76d5aaebf@lunn.ch> (raw)
In-Reply-To: <adVJ1YpHv1bWCxKL@bby-cbu-swbuild03.eng.microchip.com>
On Tue, Apr 07, 2026 at 11:15:49AM -0700, Charles Perry wrote:
> On Sun, Feb 04, 2024 at 05:14:14PM -0600, Andrew Lunn wrote:
> > When scanning the MDIO bus for C22 devices, the driver returning
> > -ENODEV is not considered fatal, it just indicates the MDIO bus master
> > knows there is no device at that address, maybe because of hardware
> > limitation.
> >
> > Make the C45 scan code act on -ENODEV the same way, to make C22 and
> > C45 more uniform.
> >
> > It is expected all reads for a given address will return -ENODEV, so
> > within get_phy_c45_ids() only the first place a read occurs has been
> > changed.
> >
> > Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > ---
> > drivers/net/phy/phy_device.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> > index 52828d1c64f7..962ab53c23ff 100644
> > --- a/drivers/net/phy/phy_device.c
> > +++ b/drivers/net/phy/phy_device.c
> > @@ -780,7 +780,7 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr,
> > * and identifiers in @c45_ids.
> > *
> > * Returns zero on success, %-EIO on bus access error, or %-ENODEV if
> > - * the "devices in package" is invalid.
> > + * the "devices in package" is invalid or no device responds.
> > */
> > static int get_phy_c45_ids(struct mii_bus *bus, int addr,
> > struct phy_c45_device_ids *c45_ids)
> > @@ -803,7 +803,11 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
> > */
> > ret = phy_c45_probe_present(bus, addr, i);
> > if (ret < 0)
> > - return -EIO;
> > + /* returning -ENODEV doesn't stop bus
> > + * scanning
> > + */
> > + return (phy_reg == -EIO ||
> > + phy_reg == -ENODEV) ? -ENODEV : -EIO;
>
> Hello Andrew,
>
> Did you meant "ret" instead of "phy_reg" here?
>
> "phy_reg" doesn't make sense here because you would have already returned
> in the previous iteration of the loop.
Hum, good catch. That makes no sense. Looks like i cut/pasted from the
C22 code, and did not fixup the variable name.
Andrew
next prev parent reply other threads:[~2026-04-07 18:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 23:14 [PATCH net-next v2 0/2] Unify C22 and C45 error handling during bus enumeration Andrew Lunn
2024-02-04 23:14 ` [PATCH net-next v2 1/2] net: phy: c45 scanning: Don't consider -ENODEV fatal Andrew Lunn
2026-04-07 18:15 ` Charles Perry
2026-04-07 18:57 ` Andrew Lunn [this message]
2024-02-04 23:14 ` [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: Return -ENODEV when C45 not supported Andrew Lunn
2024-02-05 1:07 ` Florian Fainelli
2024-02-07 13:50 ` [PATCH net-next v2 0/2] Unify C22 and C45 error handling during bus enumeration patchwork-bot+netdevbpf
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=edc33490-09b5-49fd-a1f9-72d76d5aaebf@lunn.ch \
--to=andrew@lunn.ch \
--cc=charles.perry@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=tmenninger@purestorage.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