net: ethernet: mtk_eth_soc: remove cpu_relax in mtk_pending_work
authorLorenzo Bianconi <lorenzo@kernel.org>
Wed, 16 Nov 2022 23:58:46 +0000 (00:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2022 12:00:17 +0000 (12:00 +0000)
Get rid of cpu_relax in mtk_pending_work routine since MTK_RESETTING is
set only in mtk_pending_work() and it runs holding rtnl lock

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mediatek/mtk_eth_soc.c

index f3a03d6f1a924b8aa8a2a3897239d5c621ddef6f..cdc0ff5961967a26393ae69d479dd9458a4395de 100644 (file)
@@ -3546,11 +3546,8 @@ static void mtk_pending_work(struct work_struct *work)
        rtnl_lock();
 
        dev_dbg(eth->dev, "[%s][%d] reset\n", __func__, __LINE__);
+       set_bit(MTK_RESETTING, &eth->state);
 
-       while (test_and_set_bit_lock(MTK_RESETTING, &eth->state))
-               cpu_relax();
-
-       dev_dbg(eth->dev, "[%s][%d] mtk_stop starts\n", __func__, __LINE__);
        /* stop all devices to make sure that dma is properly shut down */
        for (i = 0; i < MTK_MAC_COUNT; i++) {
                if (!eth->netdev[i])
@@ -3584,7 +3581,7 @@ static void mtk_pending_work(struct work_struct *work)
 
        dev_dbg(eth->dev, "[%s][%d] reset done\n", __func__, __LINE__);
 
-       clear_bit_unlock(MTK_RESETTING, &eth->state);
+       clear_bit(MTK_RESETTING, &eth->state);
 
        rtnl_unlock();
 }