diff options
author | B, Ravi <ravibabu@ti.com> | 2012-08-31 11:09:49 +0000 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-11 17:34:41 +0300 |
commit | 65b3d52d02a558fbfe08e43688e15390c5ab3067 (patch) | |
tree | 0082a0e45c26ff015a7b0976e917c83d87db8e70 /drivers/usb/musb/musb_dsps.c | |
parent | 00a0b1d58af873d842580dcac55f3b156c3a4077 (diff) | |
download | op-kernel-dev-65b3d52d02a558fbfe08e43688e15390c5ab3067.zip op-kernel-dev-65b3d52d02a558fbfe08e43688e15390c5ab3067.tar.gz |
usb: musb: add musb_ida for multi instance support
Added musb_ida in musb_core.c to manage the multi core ids.
Signed-off-by: Ravi Babu <ravibabu@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Santhapuri, Damodar <damodar.santhapuri@ti.com>
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.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 51ff1bb..5351e96 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -448,7 +448,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; + int ret, musbid; /* get memory resource */ sprintf(res_name, "musb%d", id); @@ -473,14 +473,22 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) res->parent = NULL; resources[1] = *res; + /* 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", -1); + musb = platform_device_alloc("musb-hdrc", musbid); if (!musb) { dev_err(dev, "failed to allocate musb device\n"); ret = -ENOMEM; - goto err0; + goto err1; } + musb->id = musbid; musb->dev.parent = dev; musb->dev.dma_mask = &musb_dmamask; musb->dev.coherent_dma_mask = musb_dmamask; @@ -492,31 +500,34 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) ret = platform_device_add_resources(musb, resources, 2); if (ret) { dev_err(dev, "failed to add resources\n"); - goto err1; + goto err2; } ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); if (ret) { dev_err(dev, "failed to add platform_data\n"); - goto err1; + goto err2; } ret = platform_device_add(musb); if (ret) { dev_err(dev, "failed to register musb device\n"); - goto err1; + goto err2; } return 0; -err1: +err2: platform_device_put(musb); +err1: + musb_put_id(dev, musbid); err0: return ret; } static void __devexit dsps_delete_musb_pdev(struct dsps_glue *glue) { + musb_put_id(glue->dev, glue->musb->id); platform_device_del(glue->musb); platform_device_put(glue->musb); } |