Advertisement
Guest User

Untitled

a guest
Feb 15th, 2022
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
  2. index 9b260a2a51ba..126df7d10ee7 100644
  3. --- a/drivers/nvme/host/apple.c
  4. +++ b/drivers/nvme/host/apple.c
  5. @@ -635,15 +636,20 @@ static bool apple_nvme_poll_cq(struct apple_nvme_queue *q,
  6. return found;
  7. }
  8.  
  9. +static bool __apple_nvme_handle_cq(struct apple_nvme_queue *q,
  10. + struct io_comp_batch *iob)
  11. +{
  12. + if (READ_ONCE(q->enabled))
  13. + return apple_nvme_poll_cq(q, iob);
  14. + return false;
  15. +}
  16. +
  17. static bool apple_nvme_handle_cq(struct apple_nvme_queue *q, bool force)
  18. {
  19. bool found;
  20. DEFINE_IO_COMP_BATCH(iob);
  21.  
  22. - if (!READ_ONCE(q->enabled) && !force)
  23. - return false;
  24. -
  25. - found = apple_nvme_poll_cq(q, &iob);
  26. + found = __apple_nvme_handle_cq(q, &iob);
  27.  
  28. if (!rq_list_empty(iob.req_list))
  29. apple_nvme_complete_batch(&iob);
  30. @@ -654,16 +660,18 @@ static bool apple_nvme_handle_cq(struct apple_nvme_queue *q, bool force)
  31. static irqreturn_t apple_nvme_irq(int irq, void *data)
  32. {
  33. struct apple_nvme *anv = data;
  34. - bool handled = false;
  35. + DEFINE_IO_COMP_BATCH(iob);
  36. unsigned long flags;
  37. + bool handled;
  38.  
  39. spin_lock_irqsave(&anv->lock, flags);
  40. - if (apple_nvme_handle_cq(&anv->ioq, false))
  41. - handled = true;
  42. - if (apple_nvme_handle_cq(&anv->adminq, false))
  43. - handled = true;
  44. + handled = __apple_nvme_handle_cq(&anv->ioq, &iob);
  45. + handled |= __apple_nvme_handle_cq(&anv->adminq, &iob);
  46. spin_unlock_irqrestore(&anv->lock, flags);
  47.  
  48. + if (!rq_list_empty(iob.req_list))
  49. + apple_nvme_complete_batch(&iob);
  50. +
  51. if (handled)
  52. return IRQ_HANDLED;
  53. return IRQ_NONE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement