2016-11-12 11:35:56 +00:00
|
|
|
From 696c8b1282205caa5206264449f80ef756f14ef7 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Felipe Balbi <felipe.balbi@linux.intel.com>
|
|
|
|
Date: Wed, 30 Mar 2016 09:37:03 +0300
|
|
|
|
Subject: usb: dwc3: drop ev_buffs array
|
|
|
|
|
|
|
|
we will be using a single event buffer and that
|
|
|
|
renders ev_buffs array unnecessary. Let's remove it
|
|
|
|
in favor of a single pointer to a single event
|
|
|
|
buffer.
|
|
|
|
|
|
|
|
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
|
|
|
|
---
|
|
|
|
drivers/usb/dwc3/core.c | 13 ++++---------
|
|
|
|
drivers/usb/dwc3/core.h | 2 +-
|
|
|
|
drivers/usb/dwc3/gadget.c | 4 ++--
|
|
|
|
3 files changed, 7 insertions(+), 12 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/usb/dwc3/core.c
|
|
|
|
+++ b/drivers/usb/dwc3/core.c
|
2016-11-21 18:18:47 +00:00
|
|
|
@@ -204,7 +204,7 @@ static void dwc3_free_event_buffers(stru
|
2016-11-12 11:35:56 +00:00
|
|
|
{
|
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
|
|
|
|
|
- evt = dwc->ev_buffs[0];
|
|
|
|
+ evt = dwc->ev_buf;
|
|
|
|
if (evt)
|
|
|
|
dwc3_free_one_event_buffer(dwc, evt);
|
|
|
|
}
|
2016-11-21 18:18:47 +00:00
|
|
|
@@ -221,17 +221,12 @@ static int dwc3_alloc_event_buffers(stru
|
2016-11-12 11:35:56 +00:00
|
|
|
{
|
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
|
|
|
|
|
- dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs),
|
|
|
|
- GFP_KERNEL);
|
|
|
|
- if (!dwc->ev_buffs)
|
|
|
|
- return -ENOMEM;
|
|
|
|
-
|
|
|
|
evt = dwc3_alloc_one_event_buffer(dwc, length);
|
|
|
|
if (IS_ERR(evt)) {
|
|
|
|
dev_err(dwc->dev, "can't allocate event buffer\n");
|
|
|
|
return PTR_ERR(evt);
|
|
|
|
}
|
|
|
|
- dwc->ev_buffs[0] = evt;
|
|
|
|
+ dwc->ev_buf = evt;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2016-11-21 18:18:47 +00:00
|
|
|
@@ -246,7 +241,7 @@ static int dwc3_event_buffers_setup(stru
|
2016-11-12 11:35:56 +00:00
|
|
|
{
|
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
|
|
|
|
|
- evt = dwc->ev_buffs[0];
|
|
|
|
+ evt = dwc->ev_buf;
|
|
|
|
dwc3_trace(trace_dwc3_core,
|
|
|
|
"Event buf %p dma %08llx length %d\n",
|
|
|
|
evt->buf, (unsigned long long) evt->dma,
|
2016-11-21 18:18:47 +00:00
|
|
|
@@ -269,7 +264,7 @@ static void dwc3_event_buffers_cleanup(s
|
2016-11-12 11:35:56 +00:00
|
|
|
{
|
|
|
|
struct dwc3_event_buffer *evt;
|
|
|
|
|
|
|
|
- evt = dwc->ev_buffs[0];
|
|
|
|
+ evt = dwc->ev_buf;
|
|
|
|
|
|
|
|
evt->lpos = 0;
|
|
|
|
|
|
|
|
--- a/drivers/usb/dwc3/core.h
|
|
|
|
+++ b/drivers/usb/dwc3/core.h
|
2017-01-13 21:35:45 +00:00
|
|
|
@@ -748,7 +748,7 @@ struct dwc3 {
|
2016-11-12 11:35:56 +00:00
|
|
|
struct platform_device *xhci;
|
|
|
|
struct resource xhci_resources[DWC3_XHCI_RESOURCES_NUM];
|
|
|
|
|
|
|
|
- struct dwc3_event_buffer **ev_buffs;
|
|
|
|
+ struct dwc3_event_buffer *ev_buf;
|
|
|
|
struct dwc3_ep *eps[DWC3_ENDPOINTS_NUM];
|
|
|
|
|
|
|
|
struct usb_gadget gadget;
|
|
|
|
--- a/drivers/usb/dwc3/gadget.c
|
|
|
|
+++ b/drivers/usb/dwc3/gadget.c
|
2017-05-24 20:39:28 +00:00
|
|
|
@@ -2576,7 +2576,7 @@ static irqreturn_t dwc3_process_event_bu
|
2016-11-12 11:35:56 +00:00
|
|
|
int left;
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
- evt = dwc->ev_buffs[0];
|
|
|
|
+ evt = dwc->ev_buf;
|
|
|
|
left = evt->count;
|
|
|
|
|
|
|
|
if (!(evt->flags & DWC3_EVENT_PENDING))
|
2017-05-24 20:39:28 +00:00
|
|
|
@@ -2635,7 +2635,7 @@ static irqreturn_t dwc3_check_event_buf(
|
2016-11-12 11:35:56 +00:00
|
|
|
u32 count;
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
- evt = dwc->ev_buffs[0];
|
|
|
|
+ evt = dwc->ev_buf;
|
|
|
|
|
|
|
|
count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0));
|
|
|
|
count &= DWC3_GEVNTCOUNT_MASK;
|