Skip to content

Commit e3cf8b3

Browse files
Russell KingJakub Kicinski
authored andcommitted
net: phy: remove phy_ethtool_sset()
There are no users of phy_ethtool_sset() in the kernel anymore, and as of commit 3c1bcc8 ("net: ethernet: Convert phydev advertize and supported from u32 to link mode"), the implementation is slightly buggy - it doesn't correctly check the masked advertising mask as it used to. Remove it, and update the phy documentation to refer to its replacement function. Signed-off-by: Russell King <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 84bb46c commit e3cf8b3

File tree

3 files changed

+2
-62
lines changed

3 files changed

+2
-62
lines changed

Documentation/networking/phy.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ Fills the phydev structure with up-to-date information about the current
352352
settings in the PHY.
353353
::
354354

355-
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
355+
int phy_ethtool_ksettings_set(struct phy_device *phydev,
356+
const struct ethtool_link_ksettings *cmd);
356357

357358
Ethtool convenience functions.
358359
::

drivers/net/phy/phy.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -253,66 +253,6 @@ static void phy_sanitize_settings(struct phy_device *phydev)
253253
}
254254
}
255255

256-
/**
257-
* phy_ethtool_sset - generic ethtool sset function, handles all the details
258-
* @phydev: target phy_device struct
259-
* @cmd: ethtool_cmd
260-
*
261-
* A few notes about parameter checking:
262-
*
263-
* - We don't set port or transceiver, so we don't care what they
264-
* were set to.
265-
* - phy_start_aneg() will make sure forced settings are sane, and
266-
* choose the next best ones from the ones selected, so we don't
267-
* care if ethtool tries to give us bad values.
268-
*/
269-
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
270-
{
271-
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
272-
u32 speed = ethtool_cmd_speed(cmd);
273-
274-
if (cmd->phy_address != phydev->mdio.addr)
275-
return -EINVAL;
276-
277-
/* We make sure that we don't pass unsupported values in to the PHY */
278-
ethtool_convert_legacy_u32_to_link_mode(advertising, cmd->advertising);
279-
linkmode_and(advertising, advertising, phydev->supported);
280-
281-
/* Verify the settings we care about. */
282-
if (cmd->autoneg != AUTONEG_ENABLE && cmd->autoneg != AUTONEG_DISABLE)
283-
return -EINVAL;
284-
285-
if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
286-
return -EINVAL;
287-
288-
if (cmd->autoneg == AUTONEG_DISABLE &&
289-
((speed != SPEED_1000 &&
290-
speed != SPEED_100 &&
291-
speed != SPEED_10) ||
292-
(cmd->duplex != DUPLEX_HALF &&
293-
cmd->duplex != DUPLEX_FULL)))
294-
return -EINVAL;
295-
296-
phydev->autoneg = cmd->autoneg;
297-
298-
phydev->speed = speed;
299-
300-
linkmode_copy(phydev->advertising, advertising);
301-
302-
linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
303-
phydev->advertising, AUTONEG_ENABLE == cmd->autoneg);
304-
305-
phydev->duplex = cmd->duplex;
306-
307-
phydev->mdix_ctrl = cmd->eth_tp_mdix_ctrl;
308-
309-
/* Restart the PHY */
310-
phy_start_aneg(phydev);
311-
312-
return 0;
313-
}
314-
EXPORT_SYMBOL(phy_ethtool_sset);
315-
316256
int phy_ethtool_ksettings_set(struct phy_device *phydev,
317257
const struct ethtool_link_ksettings *cmd)
318258
{

include/linux/phy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,6 @@ void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies);
11601160
void phy_mac_interrupt(struct phy_device *phydev);
11611161
void phy_start_machine(struct phy_device *phydev);
11621162
void phy_stop_machine(struct phy_device *phydev);
1163-
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
11641163
void phy_ethtool_ksettings_get(struct phy_device *phydev,
11651164
struct ethtool_link_ksettings *cmd);
11661165
int phy_ethtool_ksettings_set(struct phy_device *phydev,

0 commit comments

Comments
 (0)