Re: [PATCH v1 1/2] modpost: file2alias: fixup mdio alias garbled code in modules.alias

From: Andrew Lunn
Date: Mon Nov 22 2021 - 23:14:34 EST

On Tue, Nov 23, 2021 at 09:33:03AM +0800, zhuyinbo wrote:
> 在 2021/11/22 下午10:07, Andrew Lunn 写道:
> On Mon, Nov 22, 2021 at 08:14:57PM +0800, Yinbo Zhu wrote:
> After module compilation, module alias mechanism will generate a ugly
> mdio modules alias configure if ethernet phy was selected, this patch
> is to fixup mdio alias garbled code.
> In addition, that ugly alias configure will cause ethernet phy module
> doens't match udev, phy module auto-load is fail, but add this patch
> that it is well mdio driver alias configure match phy device uevent.
> What PHY do you have problems with? What is the PHY id and which
> driver should be loaded.
> This code has existed a long time, so suddenly saying it is wrong and
> changing it needs a good explanation why it is wrong. Being ugly is
> not a good reason.
> Andrew
> Hi Andrew,
>     Use default mdio configure, After module compilation, mdio alias configure
> is following and it doesn't match
>     the match phy dev(mdio dev)  uevent, because the mdio alias configure 
> "0000000101000001000011111001????"  include "?" and

A PHY ID generally break up into 3 parts.

The OUI of the manufacture.
The device.
The revision

The ? means these bits don't matter. Those correspond to the
revision. Generally, a driver can driver any revision of the PHY,
which is why those bits don't matter.

So when a driver probes with the id 00000001010000010000111110010110
we expect user space to find the best match, performing wildcard
expansion. So the ? will match anything.

Since this is worked for a long time, do you have an example where it
is broken? If so, which PHY driver? If it is broken, no driver is
loaded, or the wrong driver is loaded, i expect it is a bug in a
specific driver. And we should fix that bug in the specific driver.