0094-net-next-mediatek-don-t-use-intermediate-variables-t.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 441d87495f33fd444a2b2a16f6df07892dac3f89 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <john@phrozen.org>
  3. Date: Tue, 3 May 2016 04:12:35 +0200
  4. Subject: [PATCH 094/102] net-next: mediatek: don't use intermediate variables
  5. to store IRQ masks
  6. The code currently uses variables to store and never modify the bit masks
  7. of interrupts. This is legacy code from an early version of the driver
  8. that supported MIPS based SoCs where the IRQ bits depended on the actual
  9. SoC. As the bits are the same for all ARM based SoC using this driver we
  10. can remove the intermediate variables.
  11. Signed-off-by: John Crispin <john@phrozen.org>
  12. ---
  13. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 22 ++++++++++------------
  14. 1 file changed, 10 insertions(+), 12 deletions(-)
  15. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  16. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  17. @@ -806,7 +806,7 @@ drop:
  18. }
  19. static int mtk_poll_rx(struct napi_struct *napi, int budget,
  20. - struct mtk_eth *eth, u32 rx_intr)
  21. + struct mtk_eth *eth)
  22. {
  23. struct mtk_rx_ring *ring = &eth->rx_ring;
  24. int idx = ring->calc_idx;
  25. @@ -894,7 +894,7 @@ release_desc:
  26. }
  27. if (done < budget)
  28. - mtk_w32(eth, rx_intr, MTK_QMTK_INT_STATUS);
  29. + mtk_w32(eth, MTK_RX_DONE_INT, MTK_QMTK_INT_STATUS);
  30. return done;
  31. }
  32. @@ -977,28 +977,26 @@ static int mtk_poll_tx(struct mtk_eth *e
  33. static int mtk_poll(struct napi_struct *napi, int budget)
  34. {
  35. struct mtk_eth *eth = container_of(napi, struct mtk_eth, rx_napi);
  36. - u32 status, status2, mask, tx_intr, rx_intr, status_intr;
  37. + u32 status, status2, mask;
  38. int tx_done, rx_done;
  39. bool tx_again = false;
  40. status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
  41. status2 = mtk_r32(eth, MTK_INT_STATUS2);
  42. - tx_intr = MTK_TX_DONE_INT;
  43. - rx_intr = MTK_RX_DONE_INT;
  44. - status_intr = (MTK_GDM1_AF | MTK_GDM2_AF);
  45. tx_done = 0;
  46. rx_done = 0;
  47. tx_again = 0;
  48. - if (status & tx_intr)
  49. + if (status & MTK_TX_DONE_INT)
  50. tx_done = mtk_poll_tx(eth, budget, &tx_again);
  51. - if (status & rx_intr)
  52. - rx_done = mtk_poll_rx(napi, budget, eth, rx_intr);
  53. + if (status & MTK_RX_DONE_INT)
  54. + rx_done = mtk_poll_rx(napi, budget, eth);
  55. - if (unlikely(status2 & status_intr)) {
  56. + if (unlikely(status2 & (MTK_GDM1_AF | MTK_GDM2_AF))) {
  57. mtk_stats_update(eth);
  58. - mtk_w32(eth, status_intr, MTK_INT_STATUS2);
  59. + mtk_w32(eth, (MTK_GDM1_AF | MTK_GDM2_AF),
  60. + MTK_INT_STATUS2);
  61. }
  62. if (unlikely(netif_msg_intr(eth))) {
  63. @@ -1016,7 +1014,7 @@ static int mtk_poll(struct napi_struct *
  64. return budget;
  65. napi_complete(napi);
  66. - mtk_irq_enable(eth, tx_intr | rx_intr);
  67. + mtk_irq_enable(eth, MTK_RX_DONE_INT | MTK_RX_DONE_INT);
  68. return rx_done;
  69. }