summaryrefslogtreecommitdiff
path: root/common/miiphyutil.c
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2025-02-22 21:33:22 +0100
committerMarek Vasut <[email protected]>2025-02-26 18:26:57 +0100
commitf15919436bea3336f2dcb86f564180aceccc9c47 (patch)
treeeac9b843bc8309ad4effef16ca7d494015118560 /common/miiphyutil.c
parenta6a38bba5d14d68d2d86e137b7408393f29c5b7a (diff)
net: miiphy: Introduce mdio_init()
Introduce mdio_init() split off from mdio_alloc(), which is used to initialize already allocated struct mii_dev. Reviewed-by: Paul Barker <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'common/miiphyutil.c')
-rw-r--r--common/miiphyutil.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 9b8744e5d8b..2a034d3a77c 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -65,6 +65,14 @@ void miiphy_init(void)
current_mii = NULL;
}
+void mdio_init(struct mii_dev *bus)
+{
+ memset(bus, 0, sizeof(*bus));
+
+ /* initialize mii_dev struct fields */
+ INIT_LIST_HEAD(&bus->link);
+}
+
struct mii_dev *mdio_alloc(void)
{
struct mii_dev *bus;
@@ -73,10 +81,7 @@ struct mii_dev *mdio_alloc(void)
if (!bus)
return bus;
- memset(bus, 0, sizeof(*bus));
-
- /* initalize mii_dev struct fields */
- INIT_LIST_HEAD(&bus->link);
+ mdio_init(bus);
return bus;
}