]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
driver: net: ethernet: mtk_star_emac: fix suspend/resume issue
authorYanqing Wang <ot_yanqing.wang@mediatek.com>
Wed, 28 May 2025 07:53:51 +0000 (15:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:04:07 +0000 (11:04 +0100)
[ Upstream commit ba99c627aac85bc746fb4a6e2d79edb3ad100326 ]

Identify the cause of the suspend/resume hang: netif_carrier_off()
is called during link state changes and becomes stuck while
executing linkwatch_work().

To resolve this issue, call netif_device_detach() during the Ethernet
suspend process to temporarily detach the network device from the
kernel and prevent the suspend/resume hang.

Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
Signed-off-by: Yanqing Wang <ot_yanqing.wang@mediatek.com>
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
Link: https://patch.msgid.link/20250528075351.593068-1-macpaul.lin@mediatek.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mediatek/mtk_star_emac.c

index 96d2891f1675ab80c4b0a1d04fc78b7e5ce115f9..9d884699ed9cc1332fd5502d355714a060a837d2 100644 (file)
@@ -1409,6 +1409,8 @@ static __maybe_unused int mtk_star_suspend(struct device *dev)
        if (netif_running(ndev))
                mtk_star_disable(ndev);
 
+       netif_device_detach(ndev);
+
        clk_bulk_disable_unprepare(MTK_STAR_NCLKS, priv->clks);
 
        return 0;
@@ -1433,6 +1435,8 @@ static __maybe_unused int mtk_star_resume(struct device *dev)
                        clk_bulk_disable_unprepare(MTK_STAR_NCLKS, priv->clks);
        }
 
+       netif_device_attach(ndev);
+
        return ret;
 }