[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1637919957-21635-1-git-send-email-zhuyinbo@loongson.cn>
Date: Fri, 26 Nov 2021 17:45:56 +0800
From: Yinbo Zhu <zhuyinbo@...ngson.cn>
To: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nick Desaulniers <ndesaulniers@...gle.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org
Cc: zhuyinbo@...ngson.cn
Subject: [PATCH v2 1/2] modpost: file2alias: fixup mdio alias garbled code in modules.alias
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@...ngson.cn>
---
Change in v2:
Add a MDIO_ANY_ID for considering some special phy device
which phy id doesn't be read from phy register.
include/linux/mod_devicetable.h | 2 ++
scripts/mod/file2alias.c | 17 +----------------
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index ae2e75d..7bd23bf 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -595,6 +595,8 @@ struct platform_device_id {
kernel_ulong_t driver_data;
};
+#define MDIO_ANY_ID (~0)
+
#define MDIO_NAME_SIZE 32
#define MDIO_MODULE_PREFIX "mdio:"
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 49aba86..63f3149 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1027,24 +1027,9 @@ static int do_platform_entry(const char *filename,
static int do_mdio_entry(const char *filename,
void *symval, char *alias)
{
- int i;
DEF_FIELD(symval, mdio_device_id, phy_id);
- DEF_FIELD(symval, mdio_device_id, phy_id_mask);
-
alias += sprintf(alias, MDIO_MODULE_PREFIX);
-
- for (i = 0; i < 32; i++) {
- if (!((phy_id_mask >> (31-i)) & 1))
- *(alias++) = '?';
- else if ((phy_id >> (31-i)) & 1)
- *(alias++) = '1';
- else
- *(alias++) = '0';
- }
-
- /* Terminate the string */
- *alias = 0;
-
+ ADD(alias, "p", phy_id != MDIO_ANY_ID, phy_id);
return 1;
}
--
1.8.3.1
Powered by blists - more mailing lists