aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/ci13xxx_msm.c
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@freescale.com>2012-07-07 10:56:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-09 12:53:44 -0400
commitcbc6dc2af39e1395564445fd71cfcc1c70a96277 (patch)
tree24312066e797d7ae29bd84725c1b1994d4f5d6ba /drivers/usb/chipidea/ci13xxx_msm.c
parent26c696c678c4ce180599330999e895cded0f625b (diff)
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 = {
58static int __devinit ci13xxx_msm_probe(struct platform_device *pdev) 58static int __devinit ci13xxx_msm_probe(struct platform_device *pdev)
59{ 59{
60 struct platform_device *plat_ci; 60 struct platform_device *plat_ci;
61 int ret;
62 61
63 dev_dbg(&pdev->dev, "ci13xxx_msm_probe\n"); 62 dev_dbg(&pdev->dev, "ci13xxx_msm_probe\n");
64 63
65 plat_ci = platform_device_alloc("ci_hdrc", -1); 64 plat_ci = ci13xxx_add_device(&pdev->dev,
66 if (!plat_ci) { 65 pdev->resource, pdev->num_resources,
67 dev_err(&pdev->dev, "can't allocate ci_hdrc platform device\n"); 66 &ci13xxx_msm_platdata);
68 return -ENOMEM; 67 if (IS_ERR(plat_ci)) {
68 dev_err(&pdev->dev, "ci13xxx_add_device failed!\n");
69 return PTR_ERR(plat_ci);
69 } 70 }
70 71
71 ret = platform_device_add_resources(plat_ci, pdev->resource,
72 pdev->num_resources);
73 if (ret) {
74 dev_err(&pdev->dev, "can't add resources to platform device\n");
75 goto put_platform;
76 }
77
78 ret = platform_device_add_data(plat_ci, &ci13xxx_msm_platdata,
79 sizeof(ci13xxx_msm_platdata));
80 if (ret)
81 goto put_platform;
82
83 ret = platform_device_add(plat_ci);
84 if (ret)
85 goto put_platform;
86
87 platform_set_drvdata(pdev, plat_ci); 72 platform_set_drvdata(pdev, plat_ci);
88 73
89 pm_runtime_no_callbacks(&pdev->dev); 74 pm_runtime_no_callbacks(&pdev->dev);
90 pm_runtime_enable(&pdev->dev); 75 pm_runtime_enable(&pdev->dev);
91 76
92 return 0; 77 return 0;
93
94put_platform:
95 platform_device_put(plat_ci);
96
97 return ret;
98} 78}
99 79
100static int __devexit ci13xxx_msm_remove(struct platform_device *pdev) 80static int __devexit ci13xxx_msm_remove(struct platform_device *pdev)
@@ -102,7 +82,7 @@ static int __devexit ci13xxx_msm_remove(struct platform_device *pdev)
102 struct platform_device *plat_ci = platform_get_drvdata(pdev); 82 struct platform_device *plat_ci = platform_get_drvdata(pdev);
103 83
104 pm_runtime_disable(&pdev->dev); 84 pm_runtime_disable(&pdev->dev);
105 platform_device_unregister(plat_ci); 85 ci13xxx_remove_device(plat_ci);
106 86
107 return 0; 87 return 0;
108} 88}