cefe1eefff2ca7847ed689d20e8b7b13e8e1eab7
[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 @@ -3480,11 +3480,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 @@ -3518,7 +3515,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 }