]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
usb: dwc3: core: drop DWC3_EVENT_BUFFERS_MAX
authorFelipe Balbi <balbi@ti.com>
Mon, 24 Oct 2011 09:03:13 +0000 (12:03 +0300)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Dec 2011 09:48:24 +0000 (11:48 +0200)
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>
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h

index 83e382b4ae282ec60eb13d2b354f4afbbe8715c5..a2db4116257535dc850388d25c56d4d5f1ace260 100644 (file)
@@ -221,6 +221,12 @@ static int __devinit dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length)
        num = DWC3_NUM_INT(dwc->hwparams.hwparams1);
        dwc->num_event_buffers = num;
 
+       dwc->ev_buffs = kzalloc(sizeof(*dwc->ev_buffs) * num, GFP_KERNEL);
+       if (!dwc->ev_buffs) {
+               dev_err(dwc->dev, "can't allocate event buffers array\n");
+               return -ENOMEM;
+       }
+
        for (i = 0; i < num; i++) {
                struct dwc3_event_buffer        *evt;
 
index 95d5a87b4091c4c61d095a986e5290bfdceae44f..d6f1b793cd047d6ca55a346a12a7960c10516259 100644 (file)
@@ -53,7 +53,6 @@
 /* Global constants */
 #define DWC3_ENDPOINTS_NUM     32
 
-#define DWC3_EVENT_BUFFERS_MAX 2
 #define DWC3_EVENT_BUFFERS_SIZE        PAGE_SIZE
 #define DWC3_EVENT_TYPE_MASK   0xfe
 
@@ -603,7 +602,7 @@ struct dwc3 {
        struct platform_device  *xhci;
        struct resource         *res;
 
-       struct dwc3_event_buffer *ev_buffs[DWC3_EVENT_BUFFERS_MAX];
+       struct dwc3_event_buffer **ev_buffs;
        struct dwc3_ep          *eps[DWC3_ENDPOINTS_NUM];
 
        struct usb_gadget       gadget;