729-07-v6.1-net-ethernet-mtk_eth_soc-remove-cpu_relax-in-mtk_pen.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From: Lorenzo Bianconi <[email protected]>
  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. Get rid of cpu_relax in mtk_pending_work routine since MTK_RESETTING is
  6. set only in mtk_pending_work() and it runs holding rtnl lock
  7. Signed-off-by: Lorenzo Bianconi <[email protected]>
  8. Signed-off-by: David S. Miller <[email protected]>
  9. ---
  10. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  11. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  12. @@ -3422,11 +3422,8 @@ static void mtk_pending_work(struct work
  13. rtnl_lock();
  14. dev_dbg(eth->dev, "[%s][%d] reset\n", __func__, __LINE__);
  15. + set_bit(MTK_RESETTING, &eth->state);
  16. - while (test_and_set_bit_lock(MTK_RESETTING, &eth->state))
  17. - cpu_relax();
  18. -
  19. - dev_dbg(eth->dev, "[%s][%d] mtk_stop starts\n", __func__, __LINE__);
  20. /* stop all devices to make sure that dma is properly shut down */
  21. for (i = 0; i < MTK_MAC_COUNT; i++) {
  22. if (!eth->netdev[i])
  23. @@ -3460,7 +3457,7 @@ static void mtk_pending_work(struct work
  24. dev_dbg(eth->dev, "[%s][%d] reset done\n", __func__, __LINE__);
  25. - clear_bit_unlock(MTK_RESETTING, &eth->state);
  26. + clear_bit(MTK_RESETTING, &eth->state);
  27. rtnl_unlock();
  28. }