netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Yinbo Zhu <zhuyinbo@loongson.cn>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v2 2/2] net: mdio: fixup ethernet phy module auto-load function
Date: Fri, 26 Nov 2021 10:13:27 +0000	[thread overview]
Message-ID: <YaCzR5457hi4YI5G@shell.armlinux.org.uk> (raw)
In-Reply-To: <1637919957-21635-2-git-send-email-zhuyinbo@loongson.cn>

On Fri, Nov 26, 2021 at 05:45:57PM +0800, Yinbo Zhu wrote:
> 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(-)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 6865d93..999f0d4 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -962,12 +962,12 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
>  
>  static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
>  {
> -	int rc;
> +	struct phy_device *pdev;
>  
> -	/* Some devices have extra OF data and an OF-style MODALIAS */
> -	rc = of_device_uevent_modalias(dev, env);
> -	if (rc != -ENODEV)
> -		return rc;
> +	pdev = to_phy_device(dev);
> +
> +	if (add_uevent_var(env, "MODALIAS=mdio:p%08X", pdev->phy_id))
> +		return -ENOMEM;
>  
>  	return 0;
>  }

No. I think we've been over the reasons already. It _will_ break
existing module loading.

If I look at the PHY IDs on my Clearfog board:

/sys/bus/mdio_bus/devices/f1072004.mdio-mii:00/phy_id:0x01410dd1
/sys/bus/mdio_bus/devices/mv88e6xxx-0:00/phy_id:0x01410eb1
/sys/bus/mdio_bus/devices/mv88e6xxx-0:01/phy_id:0x01410eb1
/sys/bus/mdio_bus/devices/mv88e6xxx-0:02/phy_id:0x01410eb1
/sys/bus/mdio_bus/devices/mv88e6xxx-0:03/phy_id:0x01410eb1
/sys/bus/mdio_bus/devices/mv88e6xxx-0:04/phy_id:0x01410eb1
/sys/bus/mdio_bus/devices/mv88e6xxx-0:0f/phy_id:0x01410ea1

and then look at the PHY IDs that the kernel uses in the drivers, and
thus will be used in the module's alias tables.

#define MARVELL_PHY_ID_88E1510          0x01410dd0
#define MARVELL_PHY_ID_88E1540          0x01410eb0
#define MARVELL_PHY_ID_88E1545          0x01410ea0

These numbers are different. This is not just one board. The last nibble
of the PHY ID is generally the PHY revision, but that is not universal.
See Atheros PHYs, where we match the entire ID except bit 4.

You can not "simplify" the "ugly" matching like this. It's the way it is
for good reason. Using the whole ID will _not_ cause a match, and your
change will cause a regression.

> @@ -991,7 +991,7 @@ static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
>  };
>  
>  struct bus_type mdio_bus_type = {
> -	.name		= "mdio_bus",
> +	.name		= "mdio",
>  	.dev_groups	= mdio_bus_dev_groups,
>  	.match		= mdio_bus_match,
>  	.uevent		= mdio_uevent,

Definitely no, this won't be accepted, and is in any case a separate
change that is unrelated to the first hunk of the patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2021-11-26 10:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26  9:45 [PATCH v2 1/2] modpost: file2alias: fixup mdio alias garbled code in modules.alias Yinbo Zhu
2021-11-26  9:45 ` [PATCH v2 2/2] net: mdio: fixup ethernet phy module auto-load function Yinbo Zhu
2021-11-26 10:13   ` Russell King (Oracle) [this message]
2021-11-26 10:21 ` [PATCH v2 1/2] modpost: file2alias: fixup mdio alias garbled code in modules.alias Heiner Kallweit
2021-11-30  8:45   ` zhuyinbo
2021-11-30 11:46   ` Russell King (Oracle)
2021-12-01  0:38     ` Andrew Lunn
2021-12-01  9:02       ` Russell King (Oracle)
2021-12-06  2:27       ` zhuyinbo
2021-12-07  9:41       ` zhuyinbo
2021-12-07 11:18         ` Russell King (Oracle)
2022-01-04 13:11         ` zhuyinbo
2022-01-04 13:25           ` Russell King (Oracle)
2022-01-05  3:33           ` zhuyinbo
2022-01-05  9:42             ` Russell King (Oracle)
2022-01-06  3:56             ` zhuyinbo
2022-01-06 12:46               ` Andrew Lunn

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=YaCzR5457hi4YI5G@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=zhuyinbo@loongson.cn \
    /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;
as well as URLs for NNTP newsgroup(s).