aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/da8xx.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-04-24 10:21:42 -0400
committerFelipe Balbi <balbi@ti.com>2013-05-28 12:00:49 -0400
commit09fc7d22b024692b2fe8a943b246de1af307132b (patch)
treef7f48e981a398c43103110ca688d484810d11ba1 /drivers/usb/musb/da8xx.c
parente4aa937ec75df0eea0bee03bffa3303ad36c986b (diff)
usb: musb: fix incorrect usage of resource pointer
We can't simply pass the resource pointer from our device down to our children, otherwise module reinsertion will not work as the resource will continue to be marked as busy. Fix it by building a proper struct resource for our child musb device. Tested-by: Dmitry Lifshitz <lifshitz@compulab.co.il> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/da8xx.c')
-rw-r--r--drivers/usb/musb/da8xx.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index b903b744a224..0da6f648a9fe 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -476,6 +476,7 @@ static u64 da8xx_dmamask = DMA_BIT_MASK(32);
476 476
477static int da8xx_probe(struct platform_device *pdev) 477static int da8xx_probe(struct platform_device *pdev)
478{ 478{
479 struct resource musb_resources[2];
479 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 480 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
480 struct platform_device *musb; 481 struct platform_device *musb;
481 struct da8xx_glue *glue; 482 struct da8xx_glue *glue;
@@ -521,8 +522,21 @@ static int da8xx_probe(struct platform_device *pdev)
521 522
522 platform_set_drvdata(pdev, glue); 523 platform_set_drvdata(pdev, glue);
523 524
524 ret = platform_device_add_resources(musb, pdev->resource, 525 memset(musb_resources, 0x00, sizeof(*musb_resources) *
525 pdev->num_resources); 526 ARRAY_SIZE(musb_resources));
527
528 musb_resources[0].name = pdev->resource[0].name;
529 musb_resources[0].start = pdev->resource[0].start;
530 musb_resources[0].end = pdev->resource[0].end;
531 musb_resources[0].flags = pdev->resource[0].flags;
532
533 musb_resources[1].name = pdev->resource[1].name;
534 musb_resources[1].start = pdev->resource[1].start;
535 musb_resources[1].end = pdev->resource[1].end;
536 musb_resources[1].flags = pdev->resource[1].flags;
537
538 ret = platform_device_add_resources(musb, musb_resources,
539 ARRAY_SIZE(musb_resources));
526 if (ret) { 540 if (ret) {
527 dev_err(&pdev->dev, "failed to add resources\n"); 541 dev_err(&pdev->dev, "failed to add resources\n");
528 goto err5; 542 goto err5;