r8125: support devname configuration from OF

This commit is contained in:
coolsnowwolf 2024-11-23 01:01:23 +08:00
parent 030f6f6ec6
commit 27a261c8df

View File

@ -0,0 +1,20 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -15345,6 +15345,7 @@ rtl8125_init_board(struct pci_dev *pdev,
void __iomem *ioaddr;
struct net_device *dev;
struct rtl8125_private *tp;
+ const char *devname = of_get_property(pdev->dev.of_node, "label", NULL);
int rc = -ENOMEM, i, pm_cap;
assert(ioaddr_out != NULL);
@@ -15359,6 +15360,9 @@ rtl8125_init_board(struct pci_dev *pdev,
goto err_out;
}
+ if (devname)
+ strscpy(dev->name, devname, IFNAMSIZ);
+
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
tp = netdev_priv(dev);