rockchip: stmmac: add devname configuration from OF

This commit is contained in:
coolsnowwolf 2024-03-05 18:14:47 +08:00
parent 892b843ec5
commit de9f57fc50
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,20 @@
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7085,6 +7085,7 @@ int stmmac_dvr_probe(struct device *devi
{
struct net_device *ndev = NULL;
struct stmmac_priv *priv;
+ const char *devname = of_get_property(device->of_node, "label", NULL);
u32 rxq;
int i, ret = 0;
@@ -7093,6 +7094,9 @@ int stmmac_dvr_probe(struct device *devi
if (!ndev)
return -ENOMEM;
+ if (devname)
+ strlcpy(ndev->name, devname, IFNAMSIZ);
+
SET_NETDEV_DEV(ndev, device);
priv = netdev_priv(ndev);

View File

@ -0,0 +1,20 @@
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7085,6 +7085,7 @@ int stmmac_dvr_probe(struct device *devi
{
struct net_device *ndev = NULL;
struct stmmac_priv *priv;
+ const char *devname = of_get_property(device->of_node, "label", NULL);
u32 rxq;
int i, ret = 0;
@@ -7093,6 +7094,9 @@ int stmmac_dvr_probe(struct device *devi
if (!ndev)
return -ENOMEM;
+ if (devname)
+ strlcpy(ndev->name, devname, IFNAMSIZ);
+
SET_NETDEV_DEV(ndev, device);
priv = netdev_priv(ndev);