[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260117232932.1005051-1-kuba@kernel.org>
Date: Sat, 17 Jan 2026 15:29:32 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: u.kleine-koenig@...libre.com
Cc: Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org,
andrew@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
linux@...linux.org.uk,
hkallweit1@...il.com,
pabeni@...hat.com
Subject: Re: [RESEND,net-next] mdio: Make use of bus callbacks
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
mdio: Make use of bus callbacks
This patch moves MDIO device probe/remove/shutdown callbacks from the
device_driver level to the bus_type level, with the goal of eventually
removing device_driver callbacks.
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index afdf1ad6c0e6..dea67470a7bf 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
[ ... ]
> @@ -1004,11 +1004,67 @@ static const struct attribute_group *mdio_bus_dev_groups[] = {
> NULL,
> };
>
> +/**
> + * mdio_bus_probe - probe an MDIO device
> + * @dev: device to probe
> + *
> + * Description: Take care of setting up the mdio_device structure
> + * and calling the driver to probe the device.
> + *
> + * Return: Zero if successful, negative error code on failure
> + */
> +static int mdio_bus_probe(struct device *dev)
> +{
> + struct mdio_device *mdiodev = to_mdio_device(dev);
> + struct device_driver *drv = dev->driver;
> + struct mdio_driver *mdiodrv = to_mdio_driver(drv);
[ ... ]
> const struct bus_type mdio_bus_type = {
> .name = "mdio_bus",
> .dev_groups = mdio_bus_dev_groups,
> .match = mdio_bus_match,
> .uevent = mdio_uevent,
> + .probe = mdio_bus_probe,
> + .remove = mdio_bus_remove,
> + .shutdown = mdio_bus_shutdown,
> };
Does adding these bus-level callbacks break PHY device probing?
PHY drivers register via phy_driver_register() which sets:
new_driver->mdiodrv.driver.probe = phy_probe;
new_driver->mdiodrv.driver.remove = phy_remove;
The driver core in call_driver_probe() prioritizes bus callbacks over driver
callbacks:
if (dev->bus->probe)
ret = dev->bus->probe(dev);
else if (drv->probe)
ret = drv->probe(dev);
With mdio_bus_type.probe now set, phy_probe() will never be called for PHY
devices. The same applies to phy_remove() being bypassed by mdio_bus_remove().
phy_probe() performs essential initialization including setting phydev->drv,
reading PHY abilities, configuring EEE, and setting up the state machine.
Without this, PHY devices would fail to initialize properly.
Was there a plan to update phy_driver_register() as part of this change, or
is a separate patch needed to handle PHY drivers?
--
pw-bot: cr
Powered by blists - more mailing lists