net: phy: Restore phy_resume() locking assumption
commitf5e64032a7
("net: phy: fix resume handling") changes the locking semantics for phy_resume() such that the caller now needs to hold the phy mutex. Not all call sites were adopted to this new semantic, resulting in warnings from the added WARN_ON(!mutex_is_locked(&phydev->lock)). Rather than change the semantics, add a __phy_resume() and restore the old behavior of phy_resume(). Reported-by: Heiner Kallweit <hkallweit1@gmail.com> Fixes:f5e64032a7
("net: phy: fix resume handling") Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1b22bcad7e
commit
9c2c2e62df
@ -819,7 +819,7 @@ void phy_start(struct phy_device *phydev)
|
|||||||
break;
|
break;
|
||||||
case PHY_HALTED:
|
case PHY_HALTED:
|
||||||
/* if phy was suspended, bring the physical link up again */
|
/* if phy was suspended, bring the physical link up again */
|
||||||
phy_resume(phydev);
|
__phy_resume(phydev);
|
||||||
|
|
||||||
/* make sure interrupts are re-enabled for the PHY */
|
/* make sure interrupts are re-enabled for the PHY */
|
||||||
if (phy_interrupt_is_valid(phydev)) {
|
if (phy_interrupt_is_valid(phydev)) {
|
||||||
|
@ -135,9 +135,7 @@ static int mdio_bus_phy_resume(struct device *dev)
|
|||||||
if (!mdio_bus_phy_may_suspend(phydev))
|
if (!mdio_bus_phy_may_suspend(phydev))
|
||||||
goto no_resume;
|
goto no_resume;
|
||||||
|
|
||||||
mutex_lock(&phydev->lock);
|
|
||||||
ret = phy_resume(phydev);
|
ret = phy_resume(phydev);
|
||||||
mutex_unlock(&phydev->lock);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -1041,9 +1039,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
|||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mutex_lock(&phydev->lock);
|
|
||||||
phy_resume(phydev);
|
phy_resume(phydev);
|
||||||
mutex_unlock(&phydev->lock);
|
|
||||||
phy_led_triggers_register(phydev);
|
phy_led_triggers_register(phydev);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -1172,7 +1168,7 @@ int phy_suspend(struct phy_device *phydev)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(phy_suspend);
|
EXPORT_SYMBOL(phy_suspend);
|
||||||
|
|
||||||
int phy_resume(struct phy_device *phydev)
|
int __phy_resume(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
|
struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -1189,6 +1185,18 @@ int phy_resume(struct phy_device *phydev)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(__phy_resume);
|
||||||
|
|
||||||
|
int phy_resume(struct phy_device *phydev)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
mutex_lock(&phydev->lock);
|
||||||
|
ret = __phy_resume(phydev);
|
||||||
|
mutex_unlock(&phydev->lock);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
EXPORT_SYMBOL(phy_resume);
|
EXPORT_SYMBOL(phy_resume);
|
||||||
|
|
||||||
int phy_loopback(struct phy_device *phydev, bool enable)
|
int phy_loopback(struct phy_device *phydev, bool enable)
|
||||||
|
@ -924,6 +924,7 @@ void phy_device_remove(struct phy_device *phydev);
|
|||||||
int phy_init_hw(struct phy_device *phydev);
|
int phy_init_hw(struct phy_device *phydev);
|
||||||
int phy_suspend(struct phy_device *phydev);
|
int phy_suspend(struct phy_device *phydev);
|
||||||
int phy_resume(struct phy_device *phydev);
|
int phy_resume(struct phy_device *phydev);
|
||||||
|
int __phy_resume(struct phy_device *phydev);
|
||||||
int phy_loopback(struct phy_device *phydev, bool enable);
|
int phy_loopback(struct phy_device *phydev, bool enable);
|
||||||
struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,
|
struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,
|
||||||
phy_interface_t interface);
|
phy_interface_t interface);
|
||||||
|
Loading…
Reference in New Issue
Block a user