Skip to content

Commit 4694e6e

Browse files
Philippe Reynesdavem330
authored andcommitted
net: ethernet: arc: emac: use phy_ethtool_{get|set}_link_ksettings
There are two generics functions phy_ethtool_{get|set}_link_ksettings, so we can use them instead of defining the same code in the driver. Signed-off-by: Philippe Reynes <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 01dea53 commit 4694e6e

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

drivers/net/ethernet/arc/emac_main.c

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -79,42 +79,6 @@ static void arc_emac_adjust_link(struct net_device *ndev)
7979
phy_print_status(phy_dev);
8080
}
8181

82-
/**
83-
* arc_emac_get_settings - Get PHY settings.
84-
* @ndev: Pointer to net_device structure.
85-
* @cmd: Pointer to ethtool_cmd structure.
86-
*
87-
* This implements ethtool command for getting PHY settings. If PHY could
88-
* not be found, the function returns -ENODEV. This function calls the
89-
* relevant PHY ethtool API to get the PHY settings.
90-
* Issue "ethtool ethX" under linux prompt to execute this function.
91-
*/
92-
static int arc_emac_get_settings(struct net_device *ndev,
93-
struct ethtool_cmd *cmd)
94-
{
95-
return phy_ethtool_gset(ndev->phydev, cmd);
96-
}
97-
98-
/**
99-
* arc_emac_set_settings - Set PHY settings as passed in the argument.
100-
* @ndev: Pointer to net_device structure.
101-
* @cmd: Pointer to ethtool_cmd structure.
102-
*
103-
* This implements ethtool command for setting various PHY settings. If PHY
104-
* could not be found, the function returns -ENODEV. This function calls the
105-
* relevant PHY ethtool API to set the PHY.
106-
* Issue e.g. "ethtool -s ethX speed 1000" under linux prompt to execute this
107-
* function.
108-
*/
109-
static int arc_emac_set_settings(struct net_device *ndev,
110-
struct ethtool_cmd *cmd)
111-
{
112-
if (!capable(CAP_NET_ADMIN))
113-
return -EPERM;
114-
115-
return phy_ethtool_sset(ndev->phydev, cmd);
116-
}
117-
11882
/**
11983
* arc_emac_get_drvinfo - Get EMAC driver information.
12084
* @ndev: Pointer to net_device structure.
@@ -133,10 +97,10 @@ static void arc_emac_get_drvinfo(struct net_device *ndev,
13397
}
13498

13599
static const struct ethtool_ops arc_emac_ethtool_ops = {
136-
.get_settings = arc_emac_get_settings,
137-
.set_settings = arc_emac_set_settings,
138100
.get_drvinfo = arc_emac_get_drvinfo,
139101
.get_link = ethtool_op_get_link,
102+
.get_link_ksettings = phy_ethtool_get_link_ksettings,
103+
.set_link_ksettings = phy_ethtool_set_link_ksettings,
140104
};
141105

142106
#define FIRST_OR_LAST_MASK (FIRST_MASK | LAST_MASK)

0 commit comments

Comments
 (0)