summaryrefslogtreecommitdiffstats
path: root/net/ethtool
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2023-08-01 16:28:22 +0200
committerJakub Kicinski <kuba@kernel.org>2023-08-03 04:11:06 +0200
commit70ef7d87f62a86674c21a99341dabc175c19681a (patch)
tree45483922267932b4dcd9fb072941b99b2796af9f /net/ethtool
parentnet: lan966x: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() (diff)
downloadlinux-70ef7d87f62a86674c21a99341dabc175c19681a.tar.xz
linux-70ef7d87f62a86674c21a99341dabc175c19681a.zip
net: transfer rtnl_lock() requirement from ethtool_set_ethtool_phy_ops() to caller
phy_init() and phy_exit() will have to do more stuff under rtnl_lock() in a future change. Since rtnl_unlock() -> netdev_run_todo() does a lot of stuff under the hood, it's a pity to lock and unlock the rtnetlink mutex twice in a row. Change the calling convention such that the only caller of ethtool_set_ethtool_phy_ops(), phy_device.c, provides a context where the rtnl_mutex is already acquired. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://lore.kernel.org/r/20230801142824.1772134-11-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ethtool')
-rw-r--r--net/ethtool/common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 5fb19050991e..f5598c5f50de 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -665,9 +665,8 @@ const struct ethtool_phy_ops *ethtool_phy_ops;
void ethtool_set_ethtool_phy_ops(const struct ethtool_phy_ops *ops)
{
- rtnl_lock();
+ ASSERT_RTNL();
ethtool_phy_ops = ops;
- rtnl_unlock();
}
EXPORT_SYMBOL_GPL(ethtool_set_ethtool_phy_ops);