[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1426687464-2563-9-git-send-email-r.baldyga@samsung.com>
Date: Wed, 18 Mar 2015 15:04:13 +0100
From: Robert Baldyga <r.baldyga@...sung.com>
To: balbi@...com
Cc: gregkh@...uxfoundation.org, myungjoo.ham@...sung.com,
cw00.choi@...sung.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, m.szyprowski@...sung.com,
Robert Baldyga <r.baldyga@...sung.com>
Subject: [RFC 08/19] dwc3: core: handle event buffers in core_init/exit
This change is part of preparation for OTG feature. Event buffers setup
and cleanup are parts of core_init/exit process, so when core_init/exit
will be called in many places it would be better to have entire procedure
inside these functions instead of calling event_buffers_setup/cleanup
in each place separately.
Signed-off-by: Robert Baldyga <r.baldyga@...sung.com>
---
drivers/usb/dwc3/core.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b040ce0..56a4922 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -565,6 +565,12 @@ static int dwc3_core_init(struct dwc3 *dwc)
if (ret)
goto err2;
+ ret = dwc3_event_buffers_setup(dwc);
+ if (ret) {
+ dev_err(dwc->dev, "failed to setup event buffers\n");
+ goto err2;
+ }
+
return 0;
err2:
@@ -582,6 +588,7 @@ err0:
static void dwc3_core_exit(struct dwc3 *dwc)
{
+ dwc3_event_buffers_cleanup(dwc);
dwc3_free_scratch_buffers(dwc);
usb_phy_shutdown(dwc->usb2_phy);
usb_phy_shutdown(dwc->usb3_phy);
@@ -925,31 +932,22 @@ static int dwc3_probe(struct platform_device *pdev)
if (ret < 0)
goto err3;
- ret = dwc3_event_buffers_setup(dwc);
- if (ret) {
- dev_err(dwc->dev, "failed to setup event buffers\n");
- goto err4;
- }
-
ret = dwc3_core_init_mode(dwc);
if (ret)
- goto err5;
+ goto err4;
ret = dwc3_debugfs_init(dwc);
if (ret) {
dev_err(dev, "failed to initialize debugfs\n");
- goto err6;
+ goto err5;
}
pm_runtime_allow(dev);
return 0;
-err6:
- dwc3_core_exit_mode(dwc);
-
err5:
- dwc3_event_buffers_cleanup(dwc);
+ dwc3_core_exit_mode(dwc);
err4:
phy_power_off(dwc->usb3_generic_phy);
@@ -990,7 +988,6 @@ static int dwc3_remove(struct platform_device *pdev)
dwc3_debugfs_exit(dwc);
dwc3_core_exit_mode(dwc);
- dwc3_event_buffers_cleanup(dwc);
dwc3_free_event_buffers(dwc);
usb_phy_set_suspend(dwc->usb2_phy, 1);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists