1
0
Fork 0

MLK-19952 net: phy: tja110x: avoid PHY driver resume methods to take phydev->lock mutex

commit f5e64032a7 ("net: phy: fix resume handling") and commit 6bccf8962b
(net: phy: Restore phy_resume() locking assumption) make phy_resume() take
phydev->lock mutex, not PHY driver resume callback take that lock.
(The two commits enter kernel tree after v4.9, so v4.9 has no such issue)

To avoid dead lock, fix it by ensuring that the PHY driver resume methods
do not take the phydev->lock mutex themselves, but phy_resume() only take
that lock.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
pull/10/head
Andy Duan 2018-10-16 17:46:59 +08:00 committed by Jason Liu
parent 96c043b789
commit 3ece78f25f
1 changed files with 0 additions and 5 deletions

View File

@ -946,7 +946,6 @@ static int nxp_resume(struct phy_device *phydev)
if (verbosity > 0)
dev_alert(&phydev->mdio.dev, "resuming PHY %x\n", phydev->mdio.addr);
mutex_lock(&phydev->lock);
/* clear BMCR_PDOWN bit in MII_BMCR register */
err = phy_configure_bit(phydev, MII_BMCR, BMCR_PDOWN, 0);
if (err < 0)
@ -974,23 +973,19 @@ static int nxp_resume(struct phy_device *phydev)
/* reenable link control */
set_link_control(phydev, 1);
mutex_unlock(&phydev->lock);
return 0;
/* error handling */
phy_configure_error:
mutex_unlock(&phydev->lock);
dev_err(&phydev->mdio.dev, "phy r/w error: resume failed\n");
return err;
phy_transition_error:
mutex_unlock(&phydev->lock);
dev_err(&phydev->mdio.dev, "power mode transition failed\n");
return err;
phy_pll_error:
mutex_unlock(&phydev->lock);
dev_err(&phydev->mdio.dev, "Error: PLL is unstable and not locked\n");
return err;
}