aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-10-11 13:54:36 +0300
committerFelipe Balbi <balbi@ti.com>2012-10-15 14:58:56 +0300
commit3921426b13b1e0b2db6872a8d22d9fe2a4afe332 (patch)
treecdc4cd76426fa93ea3ce72c1b6c78724835e3680 /drivers/usb/dwc3
parent380f0d28431e852e07e3fa0d5f6e36cf9ea5aa5a (diff)
usb: dwc3: core: move event buffer allocation out of dwc3_core_init()
This patch is in preparation for adding PM support dwc3 driver. We want to re-use dwc3_core_init and dwc3_core_exit() functions on resume() and suspend() callbacks respectively. Moving even buffer allocation away from dwc3_core_init() will allow us to reuse the event buffer which was allocated long ago on our probe() routine. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/core.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 8d543ea4352..b923183c43c 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -381,24 +381,14 @@ static int __devinit dwc3_core_init(struct dwc3 *dwc)
dwc3_writel(dwc->regs, DWC3_GCTL, reg);
- ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
- if (ret) {
- dev_err(dwc->dev, "failed to allocate event buffers\n");
- ret = -ENOMEM;
- goto err1;
- }
-
ret = dwc3_event_buffers_setup(dwc);
if (ret) {
dev_err(dwc->dev, "failed to setup event buffers\n");
- goto err1;
+ goto err0;
}
return 0;
-err1:
- dwc3_free_event_buffers(dwc);
-
err0:
return ret;
}
@@ -406,7 +396,6 @@ err0:
static void dwc3_core_exit(struct dwc3 *dwc)
{
dwc3_event_buffers_cleanup(dwc);
- dwc3_free_event_buffers(dwc);
}
#define DWC3_ALIGN_MASK (16 - 1)
@@ -509,10 +498,17 @@ static int __devinit dwc3_probe(struct platform_device *pdev)
pm_runtime_get_sync(dev);
pm_runtime_forbid(dev);
+ ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
+ if (ret) {
+ dev_err(dwc->dev, "failed to allocate event buffers\n");
+ ret = -ENOMEM;
+ goto err0;
+ }
+
ret = dwc3_core_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize core\n");
- return ret;
+ goto err0;
}
mode = DWC3_MODE(dwc->hwparams.hwparams0);
@@ -584,6 +580,9 @@ err2:
err1:
dwc3_core_exit(dwc);
+err0:
+ dwc3_free_event_buffers(dwc);
+
return ret;
}