summaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/ci13xxx_msm.c
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@freescale.com>2012-07-07 22:56:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-09 09:53:44 -0700
commitcbc6dc2af39e1395564445fd71cfcc1c70a96277 (patch)
tree24312066e797d7ae29bd84725c1b1994d4f5d6ba /drivers/usb/chipidea/ci13xxx_msm.c
parent26c696c678c4ce180599330999e895cded0f625b (diff)
downloadlinux-cbc6dc2af39e1395564445fd71cfcc1c70a96277.tar.gz
linux-cbc6dc2af39e1395564445fd71cfcc1c70a96277.tar.bz2
linux-cbc6dc2af39e1395564445fd71cfcc1c70a96277.zip
USB: Chipidea: add unified ci13xxx_{add,remove}_device for platform drivers
Platform drivers do the similar things to add/remove ci13xxx device, so create a unified one. Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/ci13xxx_msm.c')
-rw-r--r--drivers/usb/chipidea/ci13xxx_msm.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/usb/chipidea/ci13xxx_msm.c b/drivers/usb/chipidea/ci13xxx_msm.c
index 5a2fe5f9b6c3..b01feb3be92e 100644
--- a/drivers/usb/chipidea/ci13xxx_msm.c
+++ b/drivers/usb/chipidea/ci13xxx_msm.c
@@ -58,43 +58,23 @@ static struct ci13xxx_platform_data ci13xxx_msm_platdata = {
static int __devinit ci13xxx_msm_probe(struct platform_device *pdev)
{
struct platform_device *plat_ci;
- int ret;
dev_dbg(&pdev->dev, "ci13xxx_msm_probe\n");
- plat_ci = platform_device_alloc("ci_hdrc", -1);
- if (!plat_ci) {
- dev_err(&pdev->dev, "can't allocate ci_hdrc platform device\n");
- return -ENOMEM;
+ plat_ci = ci13xxx_add_device(&pdev->dev,
+ pdev->resource, pdev->num_resources,
+ &ci13xxx_msm_platdata);
+ if (IS_ERR(plat_ci)) {
+ dev_err(&pdev->dev, "ci13xxx_add_device failed!\n");
+ return PTR_ERR(plat_ci);
}
- ret = platform_device_add_resources(plat_ci, pdev->resource,
- pdev->num_resources);
- if (ret) {
- dev_err(&pdev->dev, "can't add resources to platform device\n");
- goto put_platform;
- }
-
- ret = platform_device_add_data(plat_ci, &ci13xxx_msm_platdata,
- sizeof(ci13xxx_msm_platdata));
- if (ret)
- goto put_platform;
-
- ret = platform_device_add(plat_ci);
- if (ret)
- goto put_platform;
-
platform_set_drvdata(pdev, plat_ci);
pm_runtime_no_callbacks(&pdev->dev);
pm_runtime_enable(&pdev->dev);
return 0;
-
-put_platform:
- platform_device_put(plat_ci);
-
- return ret;
}
static int __devexit ci13xxx_msm_remove(struct platform_device *pdev)
@@ -102,7 +82,7 @@ static int __devexit ci13xxx_msm_remove(struct platform_device *pdev)
struct platform_device *plat_ci = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev);
- platform_device_unregister(plat_ci);
+ ci13xxx_remove_device(plat_ci);
return 0;
}