diff options
author | Felipe Balbi <balbi@ti.com> | 2011-10-24 05:03:13 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-12-12 04:48:24 -0500 |
commit | 457d3f214f97783c392dd4d64e2427c121b1a4d6 (patch) | |
tree | 37ce34cb8a336c30d0a24589358c94bb85ee957a /drivers/usb/dwc3 | |
parent | 5ddcee27c19e36711992a0e6ed3249fd06faa0e7 (diff) |
usb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAX
hardware will tell us how many event buffers we
need to support, so let's allocate the array
dynamically too.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/core.c | 6 | ||||
-rw-r--r-- | drivers/usb/dwc3/core.h | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 83e382b4ae28..a2db41162575 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -221,6 +221,12 @@ static int __devinit dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length) | |||
221 | num = DWC3_NUM_INT(dwc->hwparams.hwparams1); | 221 | num = DWC3_NUM_INT(dwc->hwparams.hwparams1); |
222 | dwc->num_event_buffers = num; | 222 | dwc->num_event_buffers = num; |
223 | 223 | ||
224 | dwc->ev_buffs = kzalloc(sizeof(*dwc->ev_buffs) * num, GFP_KERNEL); | ||
225 | if (!dwc->ev_buffs) { | ||
226 | dev_err(dwc->dev, "can't allocate event buffers array\n"); | ||
227 | return -ENOMEM; | ||
228 | } | ||
229 | |||
224 | for (i = 0; i < num; i++) { | 230 | for (i = 0; i < num; i++) { |
225 | struct dwc3_event_buffer *evt; | 231 | struct dwc3_event_buffer *evt; |
226 | 232 | ||
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 95d5a87b4091..d6f1b793cd04 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
@@ -53,7 +53,6 @@ | |||
53 | /* Global constants */ | 53 | /* Global constants */ |
54 | #define DWC3_ENDPOINTS_NUM 32 | 54 | #define DWC3_ENDPOINTS_NUM 32 |
55 | 55 | ||
56 | #define DWC3_EVENT_BUFFERS_MAX 2 | ||
57 | #define DWC3_EVENT_BUFFERS_SIZE PAGE_SIZE | 56 | #define DWC3_EVENT_BUFFERS_SIZE PAGE_SIZE |
58 | #define DWC3_EVENT_TYPE_MASK 0xfe | 57 | #define DWC3_EVENT_TYPE_MASK 0xfe |
59 | 58 | ||
@@ -603,7 +602,7 @@ struct dwc3 { | |||
603 | struct platform_device *xhci; | 602 | struct platform_device *xhci; |
604 | struct resource *res; | 603 | struct resource *res; |
605 | 604 | ||
606 | struct dwc3_event_buffer *ev_buffs[DWC3_EVENT_BUFFERS_MAX]; | 605 | struct dwc3_event_buffer **ev_buffs; |
607 | struct dwc3_ep *eps[DWC3_ENDPOINTS_NUM]; | 606 | struct dwc3_ep *eps[DWC3_ENDPOINTS_NUM]; |
608 | 607 | ||
609 | struct usb_gadget gadget; | 608 | struct usb_gadget gadget; |