rockchip: stmmac: add devname configuration from OF

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit 9353f90342)
This commit is contained in:
Tianling Shen
2023-08-20 15:14:37 +08:00
parent 61cfcc61df
commit 0b0f0a5973

View File

@@ -0,0 +1,20 @@
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7149,6 +7149,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;
@@ -7157,6 +7158,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);