aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f7670330f988..e3f3501d4347 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -238,6 +238,8 @@ static void phy_sanitize_settings(struct phy_device *phydev)
238 */ 238 */
239int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) 239int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
240{ 240{
241 u32 speed = ethtool_cmd_speed(cmd);
242
241 if (cmd->phy_address != phydev->addr) 243 if (cmd->phy_address != phydev->addr)
242 return -EINVAL; 244 return -EINVAL;
243 245
@@ -253,16 +255,16 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
253 return -EINVAL; 255 return -EINVAL;
254 256
255 if (cmd->autoneg == AUTONEG_DISABLE && 257 if (cmd->autoneg == AUTONEG_DISABLE &&
256 ((cmd->speed != SPEED_1000 && 258 ((speed != SPEED_1000 &&
257 cmd->speed != SPEED_100 && 259 speed != SPEED_100 &&
258 cmd->speed != SPEED_10) || 260 speed != SPEED_10) ||
259 (cmd->duplex != DUPLEX_HALF && 261 (cmd->duplex != DUPLEX_HALF &&
260 cmd->duplex != DUPLEX_FULL))) 262 cmd->duplex != DUPLEX_FULL)))
261 return -EINVAL; 263 return -EINVAL;
262 264
263 phydev->autoneg = cmd->autoneg; 265 phydev->autoneg = cmd->autoneg;
264 266
265 phydev->speed = cmd->speed; 267 phydev->speed = speed;
266 268
267 phydev->advertising = cmd->advertising; 269 phydev->advertising = cmd->advertising;
268 270