95a21e1c9a39d7bf9e41abfa4758e11ea94ece3d
[openwrt/staging/ldir.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Thu, 17 Nov 2022 00:58:46 +0100
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: remove cpu_relax in
4 mtk_pending_work
5
6 Get rid of cpu_relax in mtk_pending_work routine since MTK_RESETTING is
7 set only in mtk_pending_work() and it runs holding rtnl lock
8
9 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10 Signed-off-by: David S. Miller <davem@davemloft.net>
11 ---
12
13 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 @@ -3481,11 +3481,8 @@ static void mtk_pending_work(struct work
16 rtnl_lock();
17
18 dev_dbg(eth->dev, "[%s][%d] reset\n", __func__, __LINE__);
19 + set_bit(MTK_RESETTING, &eth->state);
20
21 - while (test_and_set_bit_lock(MTK_RESETTING, &eth->state))
22 - cpu_relax();
23 -
24 - dev_dbg(eth->dev, "[%s][%d] mtk_stop starts\n", __func__, __LINE__);
25 /* stop all devices to make sure that dma is properly shut down */
26 for (i = 0; i < MTK_MAC_COUNT; i++) {
27 if (!eth->netdev[i])
28 @@ -3519,7 +3516,7 @@ static void mtk_pending_work(struct work
29
30 dev_dbg(eth->dev, "[%s][%d] reset done\n", __func__, __LINE__);
31
32 - clear_bit_unlock(MTK_RESETTING, &eth->state);
33 + clear_bit(MTK_RESETTING, &eth->state);
34
35 rtnl_unlock();
36 }