mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
net: stmmac: add state tracking for legacy serdes power state
Avoid calling the serdes_powerdown() method if we have not had a preceeding successful call to the serdes_powerup() method. This avoids unbalancing refcounted resources that may be used in the these platform glue serdes methods. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1vnDDj-00000007Xx3-2xZ0@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3302126a9b
commit
9bfcf5460b
|
|
@ -303,6 +303,7 @@ struct stmmac_priv {
|
|||
bool eee_enabled;
|
||||
bool eee_active;
|
||||
bool eee_sw_timer_en;
|
||||
bool legacy_serdes_is_powered;
|
||||
unsigned int mode;
|
||||
unsigned int chain_mode;
|
||||
int extend_desc;
|
||||
|
|
|
|||
|
|
@ -884,8 +884,10 @@ static void stmmac_release_ptp(struct stmmac_priv *priv)
|
|||
|
||||
static void stmmac_legacy_serdes_power_down(struct stmmac_priv *priv)
|
||||
{
|
||||
if (priv->plat->serdes_powerdown)
|
||||
if (priv->plat->serdes_powerdown && priv->legacy_serdes_is_powered)
|
||||
priv->plat->serdes_powerdown(priv->dev, priv->plat->bsp_priv);
|
||||
|
||||
priv->legacy_serdes_is_powered = false;
|
||||
}
|
||||
|
||||
static int stmmac_legacy_serdes_power_up(struct stmmac_priv *priv)
|
||||
|
|
@ -898,6 +900,8 @@ static int stmmac_legacy_serdes_power_up(struct stmmac_priv *priv)
|
|||
ret = priv->plat->serdes_powerup(priv->dev, priv->plat->bsp_priv);
|
||||
if (ret < 0)
|
||||
netdev_err(priv->dev, "SerDes powerup failed\n");
|
||||
else
|
||||
priv->legacy_serdes_is_powered = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user