096-09-usb-dwc3-drop-ev_buffs-array.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From 696c8b1282205caa5206264449f80ef756f14ef7 Mon Sep 17 00:00:00 2001
  2. From: Felipe Balbi <felipe.balbi@linux.intel.com>
  3. Date: Wed, 30 Mar 2016 09:37:03 +0300
  4. Subject: usb: dwc3: drop ev_buffs array
  5. we will be using a single event buffer and that
  6. renders ev_buffs array unnecessary. Let's remove it
  7. in favor of a single pointer to a single event
  8. buffer.
  9. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  10. ---
  11. drivers/usb/dwc3/core.c | 13 ++++---------
  12. drivers/usb/dwc3/core.h | 2 +-
  13. drivers/usb/dwc3/gadget.c | 4 ++--
  14. 3 files changed, 7 insertions(+), 12 deletions(-)
  15. --- a/drivers/usb/dwc3/core.c
  16. +++ b/drivers/usb/dwc3/core.c
  17. @@ -204,7 +204,7 @@ static void dwc3_free_event_buffers(stru
  18. {
  19. struct dwc3_event_buffer *evt;
  20. - evt = dwc->ev_buffs[0];
  21. + evt = dwc->ev_buf;
  22. if (evt)
  23. dwc3_free_one_event_buffer(dwc, evt);
  24. }
  25. @@ -221,17 +221,12 @@ static int dwc3_alloc_event_buffers(stru
  26. {
  27. struct dwc3_event_buffer *evt;
  28. - dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs),
  29. - GFP_KERNEL);
  30. - if (!dwc->ev_buffs)
  31. - return -ENOMEM;
  32. -
  33. evt = dwc3_alloc_one_event_buffer(dwc, length);
  34. if (IS_ERR(evt)) {
  35. dev_err(dwc->dev, "can't allocate event buffer\n");
  36. return PTR_ERR(evt);
  37. }
  38. - dwc->ev_buffs[0] = evt;
  39. + dwc->ev_buf = evt;
  40. return 0;
  41. }
  42. @@ -246,7 +241,7 @@ static int dwc3_event_buffers_setup(stru
  43. {
  44. struct dwc3_event_buffer *evt;
  45. - evt = dwc->ev_buffs[0];
  46. + evt = dwc->ev_buf;
  47. dwc3_trace(trace_dwc3_core,
  48. "Event buf %p dma %08llx length %d\n",
  49. evt->buf, (unsigned long long) evt->dma,
  50. @@ -269,7 +264,7 @@ static void dwc3_event_buffers_cleanup(s
  51. {
  52. struct dwc3_event_buffer *evt;
  53. - evt = dwc->ev_buffs[0];
  54. + evt = dwc->ev_buf;
  55. evt->lpos = 0;
  56. --- a/drivers/usb/dwc3/core.h
  57. +++ b/drivers/usb/dwc3/core.h
  58. @@ -750,7 +750,7 @@ struct dwc3 {
  59. struct platform_device *xhci;
  60. struct resource xhci_resources[DWC3_XHCI_RESOURCES_NUM];
  61. - struct dwc3_event_buffer **ev_buffs;
  62. + struct dwc3_event_buffer *ev_buf;
  63. struct dwc3_ep *eps[DWC3_ENDPOINTS_NUM];
  64. struct usb_gadget gadget;
  65. --- a/drivers/usb/dwc3/gadget.c
  66. +++ b/drivers/usb/dwc3/gadget.c
  67. @@ -2579,7 +2579,7 @@ static irqreturn_t dwc3_process_event_bu
  68. int left;
  69. u32 reg;
  70. - evt = dwc->ev_buffs[0];
  71. + evt = dwc->ev_buf;
  72. left = evt->count;
  73. if (!(evt->flags & DWC3_EVENT_PENDING))
  74. @@ -2638,7 +2638,7 @@ static irqreturn_t dwc3_check_event_buf(
  75. u32 count;
  76. u32 reg;
  77. - evt = dwc->ev_buffs[0];
  78. + evt = dwc->ev_buf;
  79. count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
  80. count &= DWC3_GEVNTCOUNT_MASK;