mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Michal Kubecek <mkubecek@suse.cz>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net-next 4/4] net: ethtool: Remove PHYLIB dependency
Date: Wed,  1 Jul 2020 21:29:42 -0700	[thread overview]
Message-ID: <20200702042942.76674-5-f.fainelli@gmail.com> (raw)
In-Reply-To: <20200702042942.76674-1-f.fainelli@gmail.com>

Now that we have converted the ethtool/cabletest code to use netdev_ops,
we can remove the PHY library dependency since the function pointers
will now be provided upon PHY attachment to the network device.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/Kconfig             |  1 -
 net/ethtool/cabletest.c | 12 ++++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/net/Kconfig b/net/Kconfig
index d1672280d6a4..3831206977a1 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -455,7 +455,6 @@ config FAILOVER
 config ETHTOOL_NETLINK
 	bool "Netlink interface for ethtool"
 	default y
-	depends on PHYLIB=y || PHYLIB=n
 	help
 	  An alternative userspace interface for ethtool based on generic
 	  netlink. It provides better extensibility and some new features,
diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c
index 0d940a91493b..d8e2eb427613 100644
--- a/net/ethtool/cabletest.c
+++ b/net/ethtool/cabletest.c
@@ -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 ethnl_req_info req_info = {};
+	const struct net_device_ops *ops;
 	struct net_device *dev;
 	int ret;
 
@@ -75,7 +76,8 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
 		return ret;
 
 	dev = req_info.dev;
-	if (!dev->phydev) {
+	ops = dev->netdev_ops;
+	if (!ops->ndo_cable_test_start) {
 		ret = -EOPNOTSUPP;
 		goto out_dev_put;
 	}
@@ -85,7 +87,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
 	if (ret < 0)
 		goto out_rtnl;
 
-	ret = phy_start_cable_test(dev, info->extack);
+	ret = ops->ndo_cable_test_start(dev, info->extack);
 
 	ethnl_ops_complete(dev);
 
@@ -308,6 +310,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 ethnl_req_info req_info = {};
+	const struct net_device_ops *ops;
 	struct phy_tdr_config cfg;
 	struct net_device *dev;
 	int ret;
@@ -326,7 +329,8 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
 		return ret;
 
 	dev = req_info.dev;
-	if (!dev->phydev) {
+	ops = dev->netdev_ops;
+	if (!ops->ndo_cable_test_tdr_start) {
 		ret = -EOPNOTSUPP;
 		goto out_dev_put;
 	}
@@ -341,7 +345,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
 	if (ret < 0)
 		goto out_rtnl;
 
-	ret = phy_start_cable_test_tdr(dev, info->extack, &cfg);
+	ret = ops->ndo_cable_test_tdr_start(dev, info->extack, &cfg);
 
 	ethnl_ops_complete(dev);
 
-- 
2.25.1


  parent reply	other threads:[~2020-07-02  4:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02  4:29 [PATCH net-next 0/4] net: ethtool: Untangle " Florian Fainelli
2020-07-02  4:29 ` [PATCH net-next 1/4] net: Add cable test netdevice operations Florian Fainelli
2020-07-02  4:29 ` [PATCH net-next 2/4] net: phy: Change cable test arguments to net_device Florian Fainelli
2020-07-02  4:29 ` [PATCH net-next 3/4] net: phy: Automatically set-up cable test netdev_ops Florian Fainelli
2020-07-02  4:29 ` Florian Fainelli [this message]
2020-07-02 15:56 ` [PATCH net-next 0/4] net: ethtool: Untangle PHYLIB dependency Michal Kubecek
2020-07-02 16:34   ` Andrew Lunn
2020-07-02 16:35     ` Jakub Kicinski
2020-07-02 16:43       ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200702042942.76674-5-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®