[PATCH] net: stmmac: fix wrong place to call pinctrl state change

From: Clark Wang
Date: Thu Jan 25 2024 - 21:45:43 EST


The previous patch put the phylink_suspend after the pm_runtime_force_suspend
to fix an issue. But in phylink_suspend, it will call mdio read/write. If the
iomux of the pins of MDIO bus have been changed to others, the MDIO bus will
not functional.
So put pinctrl_pm_select_sleep_state to the right place to fix this issue.

Fixes: 90702dcd19c0 ("net: stmmac: fix MAC not working when system resume back with WoL active")
Signed-off-by: Clark Wang <xiaoning.wang@xxxxxxx>
Reviewed-by: Wei Fang <wei.fang@xxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b334eb16da23..9104ebf49c5d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7851,7 +7851,6 @@ int stmmac_suspend(struct device *dev)
priv->irq_wake = 1;
} else {
stmmac_mac_set(priv, priv->ioaddr, false);
- pinctrl_pm_select_sleep_state(priv->device);
}

mutex_unlock(&priv->lock);
@@ -7863,6 +7862,7 @@ int stmmac_suspend(struct device *dev)
if (device_may_wakeup(priv->device))
phylink_speed_down(priv->phylink, false);
phylink_suspend(priv->phylink, false);
+ pinctrl_pm_select_sleep_state(priv->device);
}
rtnl_unlock();

--
2.34.1