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.
Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
scripts/mod/file2alias.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
the phy_id is only phy identifier, that phy module auto-load function
should according the phy_id event rather than other information, this
patch is remove other unnecessary information and add phy_id event in
mdio_uevent function and ethernet phy module auto-load function will
work well.
Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
drivers/net/phy/mdio_bus.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
@@ -962,12 +962,12 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)staticintmdio_uevent(structdevice*dev,structkobj_uevent_env*env){-intrc;+structphy_device*pdev;-/* Some devices have extra OF data and an OF-style MODALIAS */-rc=of_device_uevent_modalias(dev,env);-if(rc!=-ENODEV)-returnrc;+pdev=to_phy_device(dev);++if(add_uevent_var(env,"MODALIAS=mdio:p%08X",pdev->phy_id))+return-ENOMEM;return0;}
From: Andrew Lunn <andrew@lunn.ch> Date: 2021-11-22 14:07:58
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
From: "Russell King (Oracle)" <linux@armlinux.org.uk> Date: 2021-11-22 14:54:32
On Mon, Nov 22, 2021 at 08:14:58PM +0800, Yinbo Zhu wrote:
quoted hunk
the phy_id is only phy identifier, that phy module auto-load function
should according the phy_id event rather than other information, this
patch is remove other unnecessary information and add phy_id event in
mdio_uevent function and ethernet phy module auto-load function will
work well.
Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
drivers/net/phy/mdio_bus.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
@@ -962,12 +962,12 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)staticintmdio_uevent(structdevice*dev,structkobj_uevent_env*env){-intrc;+structphy_device*pdev;-/* Some devices have extra OF data and an OF-style MODALIAS */-rc=of_device_uevent_modalias(dev,env);-if(rc!=-ENODEV)-returnrc;+pdev=to_phy_device(dev);++if(add_uevent_var(env,"MODALIAS=mdio:p%08X",pdev->phy_id))+return-ENOMEM;
The MDIO bus contains more than just PHYs. This completely breaks
anything that isn't a PHY device - likely by performing an
out-of-bounds access.
This change also _totally_ breaks any MDIO devices that rely on
matching via the "of:" mechanism using the compatible specified in
DT. An example of that is the B53 DSA switch.
Sorry, but we've already learnt this lesson from a similar case with
SPI. Once one particular way of dealing with MODALIAS has been
established for auto-loading modules for a subsystem, it is very
difficult to change it without causing regressions.
We need a very clear description of the problem that these patches are
attempting to address, and then we need to see that effort has been
put in to verify that changing the auto-loading mechanism is safe to
do - such as auditing every single driver that use the MDIO subsystem.
This looks like an unrelated user-interface breaking change. This
changes the path of all MDIO devices and drivers in /sys/bus/mdio_bus/*
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
On Mon, Nov 22, 2021 at 08:14:57PM +0800, Yinbo Zhu wrote:
quoted
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.
about that phy id, phy dev read it from PHY Identifier 1 and
Identifier 2 register, phy driver will call MODULE_DEVICE_TABLE to
configure
phy id to mdio_device_id, phy id was used to do a match phy driver
with phy device. that phy problems is phy driver was select 'M' then it
doesn't be auto load.
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 "alias mdio:0000000101000001000011111001???? marvell"
and it doesn't match the match phy dev(mdio dev) uevent, because
the mdio alias configure "0000000101000001000011111001????"
include "?" and "binary number", as general, uevent it include
one string or some string that string consist of one character and one
hexadecimal digit ,
which uevent is reported by mdio when mdio register a device for
ethernet phy device, only uevent from phy dev match alias configure from
phy driver that phy driver will can be auto-load when phy driver
was selected 'M'.
BRs
Yinbo Zhu.