Commit f3631ab0 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: ethtool: Remove PHYLIB direct dependency

Now that we have introduced ethtool_phy_ops and the PHY library
dynamically registers its operations with that function pointer, we can
remove the direct PHYLIB dependency in favor of using dynamic
operations.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 55d8f053
...@@ -455,7 +455,6 @@ config FAILOVER ...@@ -455,7 +455,6 @@ config FAILOVER
config ETHTOOL_NETLINK config ETHTOOL_NETLINK
bool "Netlink interface for ethtool" bool "Netlink interface for ethtool"
default y default y
depends on PHYLIB=y || PHYLIB=n
help help
An alternative userspace interface for ethtool based on generic An alternative userspace interface for ethtool based on generic
netlink. It provides better extensibility and some new features, netlink. It provides better extensibility and some new features,
......
...@@ -58,6 +58,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info) ...@@ -58,6 +58,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
{ {
struct nlattr *tb[ETHTOOL_A_CABLE_TEST_MAX + 1]; struct nlattr *tb[ETHTOOL_A_CABLE_TEST_MAX + 1];
struct ethnl_req_info req_info = {}; struct ethnl_req_info req_info = {};
const struct ethtool_phy_ops *ops;
struct net_device *dev; struct net_device *dev;
int ret; int ret;
...@@ -81,11 +82,17 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info) ...@@ -81,11 +82,17 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
} }
rtnl_lock(); rtnl_lock();
ops = ethtool_phy_ops;
if (!ops || !ops->start_cable_test) {
ret = -EOPNOTSUPP;
goto out_rtnl;
}
ret = ethnl_ops_begin(dev); ret = ethnl_ops_begin(dev);
if (ret < 0) if (ret < 0)
goto out_rtnl; goto out_rtnl;
ret = phy_start_cable_test(dev->phydev, info->extack); ret = ops->start_cable_test(dev->phydev, info->extack);
ethnl_ops_complete(dev); ethnl_ops_complete(dev);
...@@ -308,6 +315,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info) ...@@ -308,6 +315,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
{ {
struct nlattr *tb[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1]; struct nlattr *tb[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1];
struct ethnl_req_info req_info = {}; struct ethnl_req_info req_info = {};
const struct ethtool_phy_ops *ops;
struct phy_tdr_config cfg; struct phy_tdr_config cfg;
struct net_device *dev; struct net_device *dev;
int ret; int ret;
...@@ -337,11 +345,17 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info) ...@@ -337,11 +345,17 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
goto out_dev_put; goto out_dev_put;
rtnl_lock(); rtnl_lock();
ops = ethtool_phy_ops;
if (!ops || !ops->start_cable_test_tdr) {
ret = -EOPNOTSUPP;
goto out_rtnl;
}
ret = ethnl_ops_begin(dev); ret = ethnl_ops_begin(dev);
if (ret < 0) if (ret < 0)
goto out_rtnl; goto out_rtnl;
ret = phy_start_cable_test_tdr(dev->phydev, info->extack, &cfg); ret = ops->start_cable_test_tdr(dev->phydev, info->extack, &cfg);
ethnl_ops_complete(dev); ethnl_ops_complete(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment