Re: [PATCH] net: dsa: mv88e6xxx: Make *_c45 callbacks agree with phy_*_c45 callbacks

From: Tim Menninger
Date: Tue Jan 16 2024 - 20:51:39 EST


On Tue, Jan 16, 2024 at 3:21 PM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> > Hi Andrew,
> >
> > It bubbles up as EIO (the translation happens in get_phy_c45_ids when
> > get_phy_c45_devs_in_pkg fails) and ultimately causes the probe to fail.
> >
> > The EIO causes the scan to stop and fail immediately - the way I read
> > mdiobus_scan_bus_c45, only ENODEV is permissible.
>
> O.K. At minimum, this should be added to the commit message.
>
> However, i'm wondering if this is the correct fix. I would prefer that
> the scan code just acts on the -EOPNOTSUPP the same was as
> -ENODEV. Maybe the error code from phy_c45_probe_present() should be
> returned as is. And mdiobus_scan_bus_c45() is extended to handle
> -EOPNOTSUPP ?
>
> Andrew

Noted about the commit message.

To return -EOPNOTSUPP high enough up that the mdiobus_scan function(s) can
directly handle it would mean at minimum, these functions have -EOPNOTSUPP
added to their respective list of possible return values:
- get_phy_c45_ids (static)
- phy_get_c45_ids
- get_phy_device
- mdiobus_scan (static)
- mdiobus_scan_c22 (static)
- mdiobus_scan_c45 (static)

I didn't look beyond to see whether any callers of phy_get_c45_ids or
get_phy_device also return errors as-are, but it feels a little broad in
scope to me.

My impression is still that the read_c45 function should agree with the
phy_read_c45 function, but that isn't a hill I care to die on if you still
think otherwise. Thoughts?