public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: u.kleine-koenig@baylibre.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, andrew@lunn.ch, davem@davemloft.net,
	edumazet@google.com, linux@armlinux.org.uk, hkallweit1@gmail.com,
	pabeni@redhat.com
Subject: Re: [RESEND,net-next] mdio: Make use of bus callbacks
Date: Sat, 17 Jan 2026 15:29:32 -0800	[thread overview]
Message-ID: <20260117232932.1005051-1-kuba@kernel.org> (raw)
In-Reply-To: <20260113102636.3822825-2-u.kleine-koenig@baylibre.com>

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

  parent reply	other threads:[~2026-01-17 23:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 10:26 [PATCH RESEND net-next] mdio: Make use of bus callbacks Uwe Kleine-König
2026-01-13 14:05 ` Andrew Lunn
2026-01-17 23:29 ` Jakub Kicinski [this message]
2026-01-19  9:40   ` [RESEND,net-next] " Uwe Kleine-König

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=20260117232932.1005051-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=u.kleine-koenig@baylibre.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