Skip to content

Commit 3237fc6

Browse files
David Decotignydavem330
authored andcommitted
net: ethtool: remove unused __ethtool_get_settings
replaced by __ethtool_get_link_ksettings. Signed-off-by: David Decotigny <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7cad1ba commit 3237fc6

File tree

2 files changed

+14
-35
lines changed

2 files changed

+14
-35
lines changed

include/linux/ethtool.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ extern int
150150
__ethtool_get_link_ksettings(struct net_device *dev,
151151
struct ethtool_link_ksettings *link_ksettings);
152152

153-
/* DEPRECATED, use __ethtool_get_link_ksettings */
154-
extern int __ethtool_get_settings(struct net_device *dev,
155-
struct ethtool_cmd *cmd);
156-
157153
/**
158154
* struct ethtool_ops - optional netdev operations
159155
* @get_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings

net/core/ethtool.c

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,12 @@ int __ethtool_get_link_ksettings(struct net_device *dev,
551551
* legacy %ethtool_cmd API, unless it's not supported either.
552552
* TODO: remove when ethtool_ops::get_settings disappears internally
553553
*/
554-
err = __ethtool_get_settings(dev, &cmd);
554+
if (!dev->ethtool_ops->get_settings)
555+
return -EOPNOTSUPP;
556+
557+
memset(&cmd, 0, sizeof(cmd));
558+
cmd.cmd = ETHTOOL_GSET;
559+
err = dev->ethtool_ops->get_settings(dev, &cmd);
555560
if (err < 0)
556561
return err;
557562

@@ -729,30 +734,6 @@ static int ethtool_set_link_ksettings(struct net_device *dev,
729734
return dev->ethtool_ops->set_link_ksettings(dev, &link_ksettings);
730735
}
731736

732-
/* Internal kernel helper to query a device ethtool_cmd settings.
733-
*
734-
* Note about transition to ethtool_link_settings API: We do not need
735-
* (or want) this function to support "dev" instances that implement
736-
* the ethtool_link_settings API as we will update the drivers calling
737-
* this function to call __ethtool_get_link_ksettings instead, before
738-
* the first drivers implement ethtool_ops::get_link_ksettings.
739-
*
740-
* TODO 1: at least make this function static when no driver is using it
741-
* TODO 2: remove when ethtool_ops::get_settings disappears internally
742-
*/
743-
int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
744-
{
745-
ASSERT_RTNL();
746-
747-
if (!dev->ethtool_ops->get_settings)
748-
return -EOPNOTSUPP;
749-
750-
memset(cmd, 0, sizeof(struct ethtool_cmd));
751-
cmd->cmd = ETHTOOL_GSET;
752-
return dev->ethtool_ops->get_settings(dev, cmd);
753-
}
754-
EXPORT_SYMBOL(__ethtool_get_settings);
755-
756737
static void
757738
warn_incomplete_ethtool_legacy_settings_conversion(const char *details)
758739
{
@@ -796,16 +777,18 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
796777
/* send a sensible cmd tag back to user */
797778
cmd.cmd = ETHTOOL_GSET;
798779
} else {
799-
int err;
800-
/* TODO: return -EOPNOTSUPP when
801-
* ethtool_ops::get_settings disappears internally
802-
*/
803-
804780
/* driver doesn't support %ethtool_link_ksettings
805781
* API. revert to legacy %ethtool_cmd API, unless it's
806782
* not supported either.
807783
*/
808-
err = __ethtool_get_settings(dev, &cmd);
784+
int err;
785+
786+
if (!dev->ethtool_ops->get_settings)
787+
return -EOPNOTSUPP;
788+
789+
memset(&cmd, 0, sizeof(cmd));
790+
cmd.cmd = ETHTOOL_GSET;
791+
err = dev->ethtool_ops->get_settings(dev, &cmd);
809792
if (err < 0)
810793
return err;
811794
}

0 commit comments

Comments
 (0)