diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-10-31 11:12:43 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-11-01 06:32:23 -0400 |
commit | 2f7711642559851c187d09795a3eb51c2bde36ec (patch) | |
tree | cc0663e2d53d0f4d6a5355c51fd5e30c843cafcd /drivers/usb/musb/omap2430.c | |
parent | b18d26f6ad8f00ea5f7c6a12ea52627ca3c3c6e2 (diff) |
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/omap2430.c')
-rw-r--r-- | drivers/usb/musb/omap2430.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index a538fe17a966..dddd8f71a176 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -478,7 +478,6 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
478 | struct musb_hdrc_config *config; | 478 | struct musb_hdrc_config *config; |
479 | struct resource *res; | 479 | struct resource *res; |
480 | int ret = -ENOMEM; | 480 | int ret = -ENOMEM; |
481 | int musbid; | ||
482 | 481 | ||
483 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); | 482 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); |
484 | if (!glue) { | 483 | if (!glue) { |
@@ -486,21 +485,12 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
486 | goto err0; | 485 | goto err0; |
487 | } | 486 | } |
488 | 487 | ||
489 | /* get the musb id */ | 488 | musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); |
490 | musbid = musb_get_id(&pdev->dev, GFP_KERNEL); | ||
491 | if (musbid < 0) { | ||
492 | dev_err(&pdev->dev, "failed to allocate musb id\n"); | ||
493 | ret = -ENOMEM; | ||
494 | goto err0; | ||
495 | } | ||
496 | |||
497 | musb = platform_device_alloc("musb-hdrc", musbid); | ||
498 | if (!musb) { | 489 | if (!musb) { |
499 | dev_err(&pdev->dev, "failed to allocate musb device\n"); | 490 | dev_err(&pdev->dev, "failed to allocate musb device\n"); |
500 | goto err1; | 491 | goto err0; |
501 | } | 492 | } |
502 | 493 | ||
503 | musb->id = musbid; | ||
504 | musb->dev.parent = &pdev->dev; | 494 | musb->dev.parent = &pdev->dev; |
505 | musb->dev.dma_mask = &omap2430_dmamask; | 495 | musb->dev.dma_mask = &omap2430_dmamask; |
506 | musb->dev.coherent_dma_mask = omap2430_dmamask; | 496 | musb->dev.coherent_dma_mask = omap2430_dmamask; |
@@ -521,7 +511,7 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
521 | dev_err(&pdev->dev, | 511 | dev_err(&pdev->dev, |
522 | "failed to allocate musb platfrom data\n"); | 512 | "failed to allocate musb platfrom data\n"); |
523 | ret = -ENOMEM; | 513 | ret = -ENOMEM; |
524 | goto err1; | 514 | goto err2; |
525 | } | 515 | } |
526 | 516 | ||
527 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | 517 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
@@ -529,14 +519,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
529 | dev_err(&pdev->dev, | 519 | dev_err(&pdev->dev, |
530 | "failed to allocate musb board data\n"); | 520 | "failed to allocate musb board data\n"); |
531 | ret = -ENOMEM; | 521 | ret = -ENOMEM; |
532 | goto err1; | 522 | goto err2; |
533 | } | 523 | } |
534 | 524 | ||
535 | config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); | 525 | config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); |
536 | if (!data) { | 526 | if (!data) { |
537 | dev_err(&pdev->dev, | 527 | dev_err(&pdev->dev, |
538 | "failed to allocate musb hdrc config\n"); | 528 | "failed to allocate musb hdrc config\n"); |
539 | goto err1; | 529 | goto err2; |
540 | } | 530 | } |
541 | 531 | ||
542 | of_property_read_u32(np, "mode", (u32 *)&pdata->mode); | 532 | of_property_read_u32(np, "mode", (u32 *)&pdata->mode); |
@@ -589,9 +579,6 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
589 | err2: | 579 | err2: |
590 | platform_device_put(musb); | 580 | platform_device_put(musb); |
591 | 581 | ||
592 | err1: | ||
593 | musb_put_id(&pdev->dev, musbid); | ||
594 | |||
595 | err0: | 582 | err0: |
596 | return ret; | 583 | return ret; |
597 | } | 584 | } |
@@ -601,7 +588,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev) | |||
601 | struct omap2430_glue *glue = platform_get_drvdata(pdev); | 588 | struct omap2430_glue *glue = platform_get_drvdata(pdev); |
602 | 589 | ||
603 | cancel_work_sync(&glue->omap_musb_mailbox_work); | 590 | cancel_work_sync(&glue->omap_musb_mailbox_work); |
604 | musb_put_id(&pdev->dev, glue->musb->id); | ||
605 | platform_device_unregister(glue->musb); | 591 | platform_device_unregister(glue->musb); |
606 | 592 | ||
607 | return 0; | 593 | return 0; |