[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171213173751.12722-3-l.stach@pengutronix.de>
Date: Wed, 13 Dec 2017 18:37:51 +0100
From: Lucas Stach <l.stach@...gutronix.de>
To: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>
Cc: netdev@...r.kernel.org, kernel@...gutronix.de,
patchwork-lst@...gutronix.de
Subject: [PATCH 3/3] net: phy: sanitize autoneg in phy_start_aneg_priv
phy_sanitize_settings() is only called when autonegotiation has been
explicitly disabled. This breaks PHYs without any autonegotiation
capability, as the check for the capability happens inside this function.
Move the check out to the caller, so it is properly applied for those
PHYs.
Signed-off-by: Lucas Stach <l.stach@...gutronix.de>
---
drivers/net/phy/phy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 2b1e67bc1e73..433d859b6955 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -226,10 +226,6 @@ static void phy_sanitize_settings(struct phy_device *phydev)
const struct phy_setting *setting;
u32 features = phydev->supported;
- /* Sanitize settings based on PHY capabilities */
- if ((features & SUPPORTED_Autoneg) == 0)
- phydev->autoneg = AUTONEG_DISABLE;
-
setting = phy_find_valid(phydev->speed, phydev->duplex, features);
if (setting) {
phydev->speed = setting->speed;
@@ -487,6 +483,10 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync)
mutex_lock(&phydev->lock);
+ /* Sanitize settings based on PHY capabilities */
+ if ((phydev->supported & SUPPORTED_Autoneg) == 0)
+ phydev->autoneg = AUTONEG_DISABLE;
+
if (AUTONEG_DISABLE == phydev->autoneg)
phy_sanitize_settings(phydev);
--
2.11.0
Powered by blists - more mailing lists