On 11/30/26 05:05, Andrew Lunn wrote:
> On Mon, Nov 30, 2026 at 12:49:36AM +0800, Hans Zhang wrote:
>>
>>
>> On 11/30/26 00:34, Andrew Lunn wrote:
>>>> The phylib change does exactly that: __mdiobus_register() returns
>>>> -EPROBE_DEFER and lets the driver core's existing deferred-probe mechanism
>>>> do the re-probe, rather than spawning any workqueue in phylib or the MAC
>>>> drivers. For the corner cases you raised, I audited the mdiobus_register()
>>>> callers and found three that fold -EPROBE_DEFER into a hard -ENXIO:
>>>> lantiq_etop, smsc911x and smsc9420; the 4-patch series fixes those alongside
>>>> the __mdiobus_register() defer.
>>>
>>> https://elixir.bootlin.com/linux/v7.3.4/source/arch/powerpc/platforms/pasemi/gpio_mdio.c#L244
>>>
>>> The error message is no longer correct.
>>>
>>> https://elixir.bootlin.com/linux/v7.3.4/source/drivers/net/dsa/mv88e6xxx/chip.c#L3896
>>>
>>> Same problem,
>>>
>>> https://elixir.bootlin.com/linux/v7.3.4/source/drivers/net/ethernet/altera/altera_tse_main.c#L158
>>> https://elixir.bootlin.com/linux/v7.3.4/source/drivers/net/ethernet/arc/emac_mdio.c#L173
>>> https://elixir.bootlin.com/linux/v7.3.4/source/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c#L236
>>> https://elixir.bootlin.com/linux/v7.3.4/source/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c#L293
>>>
>>> I will let you review all the calls to of_mdiobus_register().
>>
>>
>> Hi Andrew,
>>
>> Thanks, that's fair. I reviewed all the mdiobus_register(),
>> of_mdiobus_register() and devm_mdiobus_register() callers, and the fallout
>> from returning -EPROBE_DEFER splits into two classes:
>>
>> Correctness: callers that discard the error and fold it into a hard
>> -ENXIO/-ENODEV. Only three do that (lantiq_etop, smsc911x, smsc9420),
>> which are already in the series; the rest propagate the error.
>>
>> Logging: callers that dev_err()/netdev_err()/pr_err() on failure. They
>> still propagate -EPROBE_DEFER, but the message becomes misleading and
>> would spam on each defer. There are about fifty of these across net/dsa,
>> net/mdio, net/ethernet, net/usb and a couple of arch callers, fixed by a
>> mechanical dev_err() -> dev_err_probe(). Two of the links you posted
>> (arc/emac_mdio.c and enetc's OF path) are already dev_err_probe() in the
>> current tree; enetc's internal mdiobus_register() path still needs it.
>>
>> Note that class 2 already mishandles -EPROBE_DEFER today via the reset-GPIO
>> dev_err_probe() path in __mdiobus_register(), so it is a pre-existing
>> cleanup independent of this change.
>>
>> Would you prefer the whole thing as one series, or the core change
>> (__mdiobus_register() defer plus the three correctness fixes) with a
>> separate treewide dev_err_probe() cleanup series?
>
> The mechanical change to dev_err_probe() within networking can be one
> patch, in a series with the three changes for -ENXIO/-ENODEV.
>
> For the arch changes, you need to submit them individually to the arch
> Maintainers.
>
> Once you have them all accepted, then please submit the phylib core
> change to return -EPROBE_DEFER in async probe.
Hello Andrew,
Thanks for the guidance. I've sent the networking part as a four-patch
series:
net: ethernet: lantiq_etop: propagate mdiobus_register() errors
net: ethernet: smsc911x: propagate mdiobus_register() errors
net: ethernet: smsc9420: propagate mdiobus_register() errors
net: use dev_err_probe() for MDIO bus registration errors
and sent the powerpc/pasemi gpio_mdio dev_err_probe() change separately
to the powerpc maintainers.
Once those are accepted, I'll submit the phylib core change that makes
__mdiobus_register() return -EPROBE_DEFER in async probe context.
Best regards,
Hans