summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/musb_dsps.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-10-31 16:12:43 +0100
committerFelipe Balbi <balbi@ti.com>2012-11-01 12:32:23 +0200
commit2f7711642559851c187d09795a3eb51c2bde36ec (patch)
treecc0663e2d53d0f4d6a5355c51fd5e30c843cafcd /drivers/usb/musb/musb_dsps.c
parentb18d26f6ad8f00ea5f7c6a12ea52627ca3c3c6e2 (diff)
downloadop-kernel-dev-2f7711642559851c187d09795a3eb51c2bde36ec.zip
op-kernel-dev-2f7711642559851c187d09795a3eb51c2bde36ec.tar.gz
usb: musb: remove hand-crafted id handling
This replaced the handcrafted id handling by the PLATFORM_DEVID_AUTO value which should do the same thing. This patch probably also fixes ux500 because I did not find the "musbid" variable to remove. And we close a tiny-unlikely race window becuase the old code gave the id back before device was destroyed in the remove case. [ balbi@ti.com : fixed up two failed hunks when applying patch ] Cc: B, Ravi <ravibabu@ti.com> Cc: Santhapuri, Damodar <damodar.santhapuri@ti.com> Cc: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Cc: Bob Liu <lliubbo@gmail.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_dsps.c')
-rw-r--r--drivers/usb/musb/musb_dsps.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 828d2a2..2d2cd37 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -459,7 +459,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
struct resource *res;
struct resource resources[2];
char res_name[10];
- int ret, musbid;
+ int ret;
/* get memory resource */
sprintf(res_name, "musb%d", id);
@@ -484,22 +484,14 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
resources[1] = *res;
resources[1].name = "mc";
- /* get the musb id */
- musbid = musb_get_id(dev, GFP_KERNEL);
- if (musbid < 0) {
- dev_err(dev, "failed to allocate musb id\n");
- ret = -ENOMEM;
- goto err0;
- }
/* allocate the child platform device */
- musb = platform_device_alloc("musb-hdrc", musbid);
+ musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
dev_err(dev, "failed to allocate musb device\n");
ret = -ENOMEM;
- goto err1;
+ goto err0;
}
- musb->id = musbid;
musb->dev.parent = dev;
musb->dev.dma_mask = &musb_dmamask;
musb->dev.coherent_dma_mask = musb_dmamask;
@@ -556,18 +548,10 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
err2:
platform_device_put(musb);
-err1:
- musb_put_id(dev, musbid);
err0:
return ret;
}
-static void dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id)
-{
- musb_put_id(glue->dev, glue->musb[id]->id);
- platform_device_unregister(glue->musb[id]);
-}
-
static int __devinit dsps_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -627,7 +611,7 @@ static int __devinit dsps_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to create child pdev\n");
/* release resources of previously created instances */
for (i--; i >= 0 ; i--)
- dsps_delete_musb_pdev(glue, i);
+ platform_device_unregister(glue->musb[i]);
goto err3;
}
}
@@ -652,7 +636,7 @@ static int __devexit dsps_remove(struct platform_device *pdev)
/* delete the child platform device */
for (i = 0; i < wrp->instances ; i++)
- dsps_delete_musb_pdev(glue, i);
+ platform_device_unregister(glue->musb[i]);
/* disable usbss clocks */
pm_runtime_put(&pdev->dev);
OpenPOWER on IntegriCloud