rockchip: stmmac: add devname configuration from OF

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-08-20 15:14:37 +08:00
parent 85f33fceb3
commit 9353f90342
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 20 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
@@ -7083,6 +7083,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;
@@ -7091,6 +7092,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);