summaryrefslogtreecommitdiff
path: root/drivers/usb/musb/tusb6010.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-04-24 17:21:42 +0300
committerFelipe Balbi <balbi@ti.com>2013-05-28 19:00:49 +0300
commit09fc7d22b024692b2fe8a943b246de1af307132b (patch)
treef7f48e981a398c43103110ca688d484810d11ba1 /drivers/usb/musb/tusb6010.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/tusb6010.c')
-rw-r--r--drivers/usb/musb/tusb6010.c18
1 files changed, 16 insertions, 2 deletions
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);
static int tusb_probe(struct platform_device *pdev)
{
+ struct resource musb_resources[2];
struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
struct platform_device *musb;
struct tusb6010_glue *glue;
@@ -1185,8 +1186,21 @@ static int tusb_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, glue);
- ret = platform_device_add_resources(musb, pdev->resource,
- pdev->num_resources);
+ memset(musb_resources, 0x00, sizeof(*musb_resources) *
+ ARRAY_SIZE(musb_resources));
+
+ musb_resources[0].name = pdev->resource[0].name;
+ musb_resources[0].start = pdev->resource[0].start;
+ musb_resources[0].end = pdev->resource[0].end;
+ musb_resources[0].flags = pdev->resource[0].flags;
+
+ musb_resources[1].name = pdev->resource[1].name;
+ musb_resources[1].start = pdev->resource[1].start;
+ musb_resources[1].end = pdev->resource[1].end;
+ musb_resources[1].flags = pdev->resource[1].flags;
+
+ ret = platform_device_add_resources(musb, musb_resources,
+ ARRAY_SIZE(musb_resources));
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
goto err3;