aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
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
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')
-rw-r--r--drivers/usb/musb/blackfin.c18
-rw-r--r--drivers/usb/musb/da8xx.c18
-rw-r--r--drivers/usb/musb/davinci.c18
-rw-r--r--drivers/usb/musb/omap2430.c18
-rw-r--r--drivers/usb/musb/tusb6010.c18
-rw-r--r--drivers/usb/musb/ux500.c18
6 files changed, 96 insertions, 12 deletions
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 5e63b160db0c..6ba8439bd5a6 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -450,6 +450,7 @@ static u64 bfin_dmamask = DMA_BIT_MASK(32);
450 450
451static int bfin_probe(struct platform_device *pdev) 451static int bfin_probe(struct platform_device *pdev)
452{ 452{
453 struct resource musb_resources[2];
453 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 454 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
454 struct platform_device *musb; 455 struct platform_device *musb;
455 struct bfin_glue *glue; 456 struct bfin_glue *glue;
@@ -479,8 +480,21 @@ static int bfin_probe(struct platform_device *pdev)
479 480
480 platform_set_drvdata(pdev, glue); 481 platform_set_drvdata(pdev, glue);
481 482
482 ret = platform_device_add_resources(musb, pdev->resource, 483 memset(musb_resources, 0x00, sizeof(*musb_resources) *
483 pdev->num_resources); 484 ARRAY_SIZE(musb_resources));
485
486 musb_resources[0].name = pdev->resource[0].name;
487 musb_resources[0].start = pdev->resource[0].start;
488 musb_resources[0].end = pdev->resource[0].end;
489 musb_resources[0].flags = pdev->resource[0].flags;
490
491 musb_resources[1].name = pdev->resource[1].name;
492 musb_resources[1].start = pdev->resource[1].start;
493 musb_resources[1].end = pdev->resource[1].end;
494 musb_resources[1].flags = pdev->resource[1].flags;
495
496 ret = platform_device_add_resources(musb, musb_resources,
497 ARRAY_SIZE(musb_resources));
484 if (ret) { 498 if (ret) {
485 dev_err(&pdev->dev, "failed to add resources\n"); 499 dev_err(&pdev->dev, "failed to add resources\n");
486 goto err3; 500 goto err3;
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;
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index bea6cc35471c..f8aeaf2e2cd1 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -509,6 +509,7 @@ static u64 davinci_dmamask = DMA_BIT_MASK(32);
509 509
510static int davinci_probe(struct platform_device *pdev) 510static int davinci_probe(struct platform_device *pdev)
511{ 511{
512 struct resource musb_resources[2];
512 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 513 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
513 struct platform_device *musb; 514 struct platform_device *musb;
514 struct davinci_glue *glue; 515 struct davinci_glue *glue;
@@ -553,8 +554,21 @@ static int davinci_probe(struct platform_device *pdev)
553 554
554 platform_set_drvdata(pdev, glue); 555 platform_set_drvdata(pdev, glue);
555 556
556 ret = platform_device_add_resources(musb, pdev->resource, 557 memset(musb_resources, 0x00, sizeof(*musb_resources) *
557 pdev->num_resources); 558 ARRAY_SIZE(musb_resources));
559
560 musb_resources[0].name = pdev->resource[0].name;
561 musb_resources[0].start = pdev->resource[0].start;
562 musb_resources[0].end = pdev->resource[0].end;
563 musb_resources[0].flags = pdev->resource[0].flags;
564
565 musb_resources[1].name = pdev->resource[1].name;
566 musb_resources[1].start = pdev->resource[1].start;
567 musb_resources[1].end = pdev->resource[1].end;
568 musb_resources[1].flags = pdev->resource[1].flags;
569
570 ret = platform_device_add_resources(musb, musb_resources,
571 ARRAY_SIZE(musb_resources));
558 if (ret) { 572 if (ret) {
559 dev_err(&pdev->dev, "failed to add resources\n"); 573 dev_err(&pdev->dev, "failed to add resources\n");
560 goto err5; 574 goto err5;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 628b93fe5ccc..b3e77613e0af 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -481,6 +481,7 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
481 481
482static int omap2430_probe(struct platform_device *pdev) 482static int omap2430_probe(struct platform_device *pdev)
483{ 483{
484 struct resource musb_resouces[2];
484 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 485 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
485 struct omap_musb_board_data *data; 486 struct omap_musb_board_data *data;
486 struct platform_device *musb; 487 struct platform_device *musb;
@@ -567,8 +568,21 @@ static int omap2430_probe(struct platform_device *pdev)
567 568
568 INIT_WORK(&glue->omap_musb_mailbox_work, omap_musb_mailbox_work); 569 INIT_WORK(&glue->omap_musb_mailbox_work, omap_musb_mailbox_work);
569 570
570 ret = platform_device_add_resources(musb, pdev->resource, 571 memset(musb_resouces, 0x00, sizeof(*musb_resources) *
571 pdev->num_resources); 572 ARRAY_SIZE(musb_resources));
573
574 musb_resources[0].name = pdev->resource[0].name;
575 musb_resources[0].start = pdev->resource[0].start;
576 musb_resources[0].end = pdev->resource[0].end;
577 musb_resources[0].flags = pdev->resource[0].flags;
578
579 musb_resources[1].name = pdev->resource[1].name;
580 musb_resources[1].start = pdev->resource[1].start;
581 musb_resources[1].end = pdev->resource[1].end;
582 musb_resources[1].flags = pdev->resource[1].flags;
583
584 ret = platform_device_add_resources(musb, musb_resources,
585 ARRAY_SIZE(musb_resources));
572 if (ret) { 586 if (ret) {
573 dev_err(&pdev->dev, "failed to add resources\n"); 587 dev_err(&pdev->dev, "failed to add resources\n");
574 goto err2; 588 goto err2;
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 7369ba33c94f..2c06a8969a9f 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1156,6 +1156,7 @@ static u64 tusb_dmamask = DMA_BIT_MASK(32);
1156 1156
1157static int tusb_probe(struct platform_device *pdev) 1157static int tusb_probe(struct platform_device *pdev)
1158{ 1158{
1159 struct resource musb_resources[2];
1159 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 1160 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
1160 struct platform_device *musb; 1161 struct platform_device *musb;
1161 struct tusb6010_glue *glue; 1162 struct tusb6010_glue *glue;
@@ -1185,8 +1186,21 @@ static int tusb_probe(struct platform_device *pdev)
1185 1186
1186 platform_set_drvdata(pdev, glue); 1187 platform_set_drvdata(pdev, glue);
1187 1188
1188 ret = platform_device_add_resources(musb, pdev->resource, 1189 memset(musb_resources, 0x00, sizeof(*musb_resources) *
1189 pdev->num_resources); 1190 ARRAY_SIZE(musb_resources));
1191
1192 musb_resources[0].name = pdev->resource[0].name;
1193 musb_resources[0].start = pdev->resource[0].start;
1194 musb_resources[0].end = pdev->resource[0].end;
1195 musb_resources[0].flags = pdev->resource[0].flags;
1196
1197 musb_resources[1].name = pdev->resource[1].name;
1198 musb_resources[1].start = pdev->resource[1].start;
1199 musb_resources[1].end = pdev->resource[1].end;
1200 musb_resources[1].flags = pdev->resource[1].flags;
1201
1202 ret = platform_device_add_resources(musb, musb_resources,
1203 ARRAY_SIZE(musb_resources));
1190 if (ret) { 1204 if (ret) {
1191 dev_err(&pdev->dev, "failed to add resources\n"); 1205 dev_err(&pdev->dev, "failed to add resources\n");
1192 goto err3; 1206 goto err3;
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 2c80004e0a83..028ff4d07dc7 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -189,6 +189,7 @@ static const struct musb_platform_ops ux500_ops = {
189 189
190static int ux500_probe(struct platform_device *pdev) 190static int ux500_probe(struct platform_device *pdev)
191{ 191{
192 struct resource musb_resources[2];
192 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 193 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
193 struct platform_device *musb; 194 struct platform_device *musb;
194 struct ux500_glue *glue; 195 struct ux500_glue *glue;
@@ -232,8 +233,21 @@ static int ux500_probe(struct platform_device *pdev)
232 233
233 platform_set_drvdata(pdev, glue); 234 platform_set_drvdata(pdev, glue);
234 235
235 ret = platform_device_add_resources(musb, pdev->resource, 236 memset(musb_resources, 0x00, sizeof(*musb_resources) *
236 pdev->num_resources); 237 ARRAY_SIZE(musb_resources));
238
239 musb_resources[0].name = pdev->resource[0].name;
240 musb_resources[0].start = pdev->resource[0].start;
241 musb_resources[0].end = pdev->resource[0].end;
242 musb_resources[0].flags = pdev->resource[0].flags;
243
244 musb_resources[1].name = pdev->resource[1].name;
245 musb_resources[1].start = pdev->resource[1].start;
246 musb_resources[1].end = pdev->resource[1].end;
247 musb_resources[1].flags = pdev->resource[1].flags;
248
249 ret = platform_device_add_resources(musb, musb_resources,
250 ARRAY_SIZE(musb_resources));
237 if (ret) { 251 if (ret) {
238 dev_err(&pdev->dev, "failed to add resources\n"); 252 dev_err(&pdev->dev, "failed to add resources\n");
239 goto err5; 253 goto err5;