summaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 61921d4dbb13..98b8ac28e5a1 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -30,6 +30,7 @@
#include <linux/phy_led_triggers.h>
#include <linux/pse-pd/pse.h>
#include <linux/property.h>
+#include <linux/rtnetlink.h>
#include <linux/sfp.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
@@ -3451,7 +3452,9 @@ static int __init phy_init(void)
{
int rc;
+ rtnl_lock();
ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops);
+ rtnl_unlock();
rc = mdio_bus_init();
if (rc)
@@ -3474,7 +3477,9 @@ err_c45:
err_mdio_bus:
mdio_bus_exit();
err_ethtool_phy_ops:
+ rtnl_lock();
ethtool_set_ethtool_phy_ops(NULL);
+ rtnl_unlock();
return rc;
}
@@ -3484,7 +3489,9 @@ static void __exit phy_exit(void)
phy_driver_unregister(&genphy_c45_driver);
phy_driver_unregister(&genphy_driver);
mdio_bus_exit();
+ rtnl_lock();
ethtool_set_ethtool_phy_ops(NULL);
+ rtnl_unlock();
}
subsys_initcall(phy_init);