All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yinbo Zhu <zhuyinbo@loongson.cn>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"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
Cc: zhuyinbo@loongson.cn
Subject: [PATCH v4 2/2] net: mdio: rework mdio_uevent for mdio ethernet phy device
Date: Sat,  4 Dec 2021 17:13:28 +0800	[thread overview]
Message-ID: <1638609208-10339-2-git-send-email-zhuyinbo@loongson.cn> (raw)
In-Reply-To: <1638609208-10339-1-git-send-email-zhuyinbo@loongson.cn>

The of_device_uevent_modalias is service for 'of' type platform driver
, which ask the first args must be 'of' that use MODULE_DEVICE_TABLE
when driver was exported, but ethernet phy is a kind of 'mdio' type
device and it is inappropriate if driver use 'of' type for exporting,
in fact, most mainstream ethernet phy driver hasn't used 'of' type,
even though phy driver was exported use 'of' type and it's irrelevant
with mdio_uevent, at this time, platform_uevent was responsible for
reporting uevent to match modules.alias configure, so, whatever that
of_device_uevent_modalias was unnecessary, this patch was to remove it
and add phy_id as modio uevent then 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;
 }
@@ -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,
-- 
1.8.3.1


  reply	other threads:[~2021-12-04  9:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04  9:13 [PATCH v4 1/2] modpost: file2alias: make mdio alias configure match mdio uevent Yinbo Zhu
2021-12-04  9:13 ` Yinbo Zhu [this message]
2021-12-04  9:38   ` [PATCH v4 2/2] net: mdio: rework mdio_uevent for mdio ethernet phy device Russell King (Oracle)
2021-12-04  9:38 ` [PATCH v4 1/2] modpost: file2alias: make mdio alias configure match mdio uevent Russell King (Oracle)
2021-12-04 15:11 ` 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=1638609208-10339-2-git-send-email-zhuyinbo@loongson.cn \
    --to=zhuyinbo@loongson.cn \
    --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=linux@armlinux.org.uk \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.