immortalwrt/target/linux/rockchip/patches-6.1/602-net-ethernet-r8169-add-devname-configuration-from-OF.patch

34 lines
789 B
Diff
Raw Normal View History

--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2142,6 +2142,22 @@ void r8169_apply_firmware(struct rtl8169
}
}
+static int rtl8169_devname_configuration(struct rtl8169_private *tp)
+{
+ const char *devname;
+ int ret;
+
+ ret = of_property_read_string(tp->pci_dev->dev.of_node,
+ "label", &devname);
+
+ if (ret)
+ return ret;
+
+ strlcpy(tp->dev->name, devname, IFNAMSIZ);
+
+ return 0;
+}
+
static int rtl8169_led_configuration(struct rtl8169_private *tp)
{
u32 led_data;
@@ -3715,6 +3731,7 @@ static void rtl_hw_start_8125b(struct rt
rtl_ephy_init(tp, e_info_8125b);
rtl_hw_start_8125_common(tp);
+ rtl8169_devname_configuration(tp);
rtl8169_led_configuration(tp);
rtl_hw_aspm_clkreq_enable(tp, true);