027-rt2800mmio-fetch-tx-status-changes.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. From f6a9618198e190a2ba09ce3f0aa8e9ee1763bd38 Mon Sep 17 00:00:00 2001
  2. From: Stanislaw Gruszka <[email protected]>
  3. Date: Sat, 9 Feb 2019 12:08:34 +0100
  4. X-Patchwork-Submitter: Stanislaw Gruszka <[email protected]>
  5. X-Patchwork-Id: 10804443
  6. X-Patchwork-Delegate: [email protected]
  7. Subject: [PATCH 24/28] rt2800mmio: fetch tx status changes
  8. Prepare to use rt2800mmio_fetch_txstatus() in concurrent manner and drop
  9. return value since is not longer needed.
  10. Signed-off-by: Stanislaw Gruszka <[email protected]>
  11. ---
  12. drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 17 +++++++++--------
  13. 1 file changed, 9 insertions(+), 8 deletions(-)
  14. --- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  15. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  16. @@ -255,12 +255,12 @@ void rt2800mmio_autowake_tasklet(unsigne
  17. }
  18. EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
  19. -static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
  20. +static void rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
  21. {
  22. u32 status;
  23. - bool more = false;
  24. + unsigned long flags;
  25. - /* FIXEME: rewrite this comment
  26. + /*
  27. * The TX_FIFO_STATUS interrupt needs special care. We should
  28. * read TX_STA_FIFO but we should do it immediately as otherwise
  29. * the register can overflow and we would lose status reports.
  30. @@ -271,20 +271,21 @@ static bool rt2800mmio_fetch_txstatus(st
  31. * because we can schedule the tasklet multiple times (when the
  32. * interrupt fires again during tx status processing).
  33. *
  34. - * txstatus tasklet is called with INT_SOURCE_CSR_TX_FIFO_STATUS
  35. - * disabled so have only one producer and one consumer - we don't
  36. - * need to lock the kfifo.
  37. + * We also read statuses from tx status timeout timer, use
  38. + * lock to prevent concurent writes to fifo.
  39. */
  40. +
  41. + spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags);
  42. +
  43. while (!kfifo_is_full(&rt2x00dev->txstatus_fifo)) {
  44. status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO);
  45. if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))
  46. break;
  47. kfifo_put(&rt2x00dev->txstatus_fifo, status);
  48. - more = true;
  49. }
  50. - return more;
  51. + spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags);
  52. }
  53. void rt2800mmio_txstatus_tasklet(unsigned long data)