Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338596
b: refs/heads/master
c: 2f77116
h: refs/heads/master
v: v3
  • Loading branch information
Sebastian Andrzej Siewior authored and Felipe Balbi committed Nov 1, 2012
1 parent 0f52487 commit d28ab8b
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 169 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b18d26f6ad8f00ea5f7c6a12ea52627ca3c3c6e2
refs/heads/master: 2f7711642559851c187d09795a3eb51c2bde36ec
18 changes: 2 additions & 16 deletions trunk/drivers/usb/musb/am35x.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,26 +459,17 @@ static int __devinit am35x_probe(struct platform_device *pdev)
struct clk *clk;

int ret = -ENOMEM;
int musbid;

glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(&pdev->dev, "failed to allocate glue context\n");
goto err0;
}

/* get the musb id */
musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
if (musbid < 0) {
dev_err(&pdev->dev, "failed to allocate musb id\n");
ret = -ENOMEM;
goto err1;
}

musb = platform_device_alloc("musb-hdrc", musbid);
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err2;
goto err1;
}

phy_clk = clk_get(&pdev->dev, "fck");
Expand Down Expand Up @@ -507,7 +498,6 @@ static int __devinit am35x_probe(struct platform_device *pdev)
goto err6;
}

musb->id = musbid;
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &am35x_dmamask;
musb->dev.coherent_dma_mask = am35x_dmamask;
Expand Down Expand Up @@ -557,9 +547,6 @@ static int __devinit am35x_probe(struct platform_device *pdev)
err3:
platform_device_put(musb);

err2:
musb_put_id(&pdev->dev, musbid);

err1:
kfree(glue);

Expand All @@ -571,7 +558,6 @@ static int __devexit am35x_remove(struct platform_device *pdev)
{
struct am35x_glue *glue = platform_get_drvdata(pdev);

musb_put_id(&pdev->dev, glue->musb->id);
platform_device_unregister(glue->musb);
clk_disable(glue->clk);
clk_disable(glue->phy_clk);
Expand Down
18 changes: 2 additions & 16 deletions trunk/drivers/usb/musb/blackfin.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,29 +455,19 @@ static int __devinit bfin_probe(struct platform_device *pdev)
struct bfin_glue *glue;

int ret = -ENOMEM;
int musbid;

glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(&pdev->dev, "failed to allocate glue context\n");
goto err0;
}

/* get the musb id */
musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
if (musbid < 0) {
dev_err(&pdev->dev, "failed to allocate musb id\n");
ret = -ENOMEM;
goto err1;
}

musb = platform_device_alloc("musb-hdrc", musbid);
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err2;
goto err1;
}

musb->id = musbid;
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &bfin_dmamask;
musb->dev.coherent_dma_mask = bfin_dmamask;
Expand Down Expand Up @@ -513,9 +503,6 @@ static int __devinit bfin_probe(struct platform_device *pdev)
err3:
platform_device_put(musb);

err2:
musb_put_id(&pdev->dev, musbid);

err1:
kfree(glue);

Expand All @@ -527,7 +514,6 @@ static int __devexit bfin_remove(struct platform_device *pdev)
{
struct bfin_glue *glue = platform_get_drvdata(pdev);

musb_put_id(&pdev->dev, glue->musb->id);
platform_device_unregister(glue->musb);
kfree(glue);

Expand Down
18 changes: 2 additions & 16 deletions trunk/drivers/usb/musb/da8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,26 +480,17 @@ static int __devinit da8xx_probe(struct platform_device *pdev)
struct clk *clk;

int ret = -ENOMEM;
int musbid;

glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(&pdev->dev, "failed to allocate glue context\n");
goto err0;
}

/* get the musb id */
musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
if (musbid < 0) {
dev_err(&pdev->dev, "failed to allocate musb id\n");
ret = -ENOMEM;
goto err1;
}

musb = platform_device_alloc("musb-hdrc", musbid);
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err2;
goto err1;
}

clk = clk_get(&pdev->dev, "usb20");
Expand All @@ -515,7 +506,6 @@ static int __devinit da8xx_probe(struct platform_device *pdev)
goto err4;
}

musb->id = musbid;
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &da8xx_dmamask;
musb->dev.coherent_dma_mask = da8xx_dmamask;
Expand Down Expand Up @@ -558,9 +548,6 @@ static int __devinit da8xx_probe(struct platform_device *pdev)
err3:
platform_device_put(musb);

err2:
musb_put_id(&pdev->dev, musbid);

err1:
kfree(glue);

Expand All @@ -572,7 +559,6 @@ static int __devexit da8xx_remove(struct platform_device *pdev)
{
struct da8xx_glue *glue = platform_get_drvdata(pdev);

musb_put_id(&pdev->dev, glue->musb->id);
platform_device_unregister(glue->musb);
clk_disable(glue->clk);
clk_put(glue->clk);
Expand Down
18 changes: 2 additions & 16 deletions trunk/drivers/usb/musb/davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,26 +512,17 @@ static int __devinit davinci_probe(struct platform_device *pdev)
struct clk *clk;

int ret = -ENOMEM;
int musbid;

glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(&pdev->dev, "failed to allocate glue context\n");
goto err0;
}

/* get the musb id */
musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
if (musbid < 0) {
dev_err(&pdev->dev, "failed to allocate musb id\n");
ret = -ENOMEM;
goto err1;
}

musb = platform_device_alloc("musb-hdrc", musbid);
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
goto err2;
goto err1;
}

clk = clk_get(&pdev->dev, "usb");
Expand All @@ -547,7 +538,6 @@ static int __devinit davinci_probe(struct platform_device *pdev)
goto err4;
}

musb->id = musbid;
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &davinci_dmamask;
musb->dev.coherent_dma_mask = davinci_dmamask;
Expand Down Expand Up @@ -590,9 +580,6 @@ static int __devinit davinci_probe(struct platform_device *pdev)
err3:
platform_device_put(musb);

err2:
musb_put_id(&pdev->dev, musbid);

err1:
kfree(glue);

Expand All @@ -604,7 +591,6 @@ static int __devexit davinci_remove(struct platform_device *pdev)
{
struct davinci_glue *glue = platform_get_drvdata(pdev);

musb_put_id(&pdev->dev, glue->musb->id);
platform_device_unregister(glue->musb);
clk_disable(glue->clk);
clk_put(glue->clk);
Expand Down
30 changes: 0 additions & 30 deletions trunk/drivers/usb/musb/musb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@

#define MUSB_DRIVER_NAME "musb-hdrc"
const char musb_driver_name[] = MUSB_DRIVER_NAME;
static DEFINE_IDA(musb_ida);

MODULE_DESCRIPTION(DRIVER_INFO);
MODULE_AUTHOR(DRIVER_AUTHOR);
Expand All @@ -133,35 +132,6 @@ static inline struct musb *dev_to_musb(struct device *dev)

/*-------------------------------------------------------------------------*/

int musb_get_id(struct device *dev, gfp_t gfp_mask)
{
int ret;
int id;

ret = ida_pre_get(&musb_ida, gfp_mask);
if (!ret) {
dev_err(dev, "failed to reserve resource for id\n");
return -ENOMEM;
}

ret = ida_get_new(&musb_ida, &id);
if (ret < 0) {
dev_err(dev, "failed to allocate a new id\n");
return ret;
}

return id;
}
EXPORT_SYMBOL_GPL(musb_get_id);

void musb_put_id(struct device *dev, int id)
{

dev_dbg(dev, "removing id %d\n", id);
ida_remove(&musb_ida, id);
}
EXPORT_SYMBOL_GPL(musb_put_id);

#ifndef CONFIG_BLACKFIN
static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
{
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/usb/musb/musb_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,6 @@ extern const char musb_driver_name[];

extern void musb_start(struct musb *musb);
extern void musb_stop(struct musb *musb);
extern int musb_get_id(struct device *dev, gfp_t gfp_mask);
extern void musb_put_id(struct device *dev, int id);

extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src);
extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 *dst);
Expand Down
26 changes: 5 additions & 21 deletions trunk/drivers/usb/musb/musb_dsps.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,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, musbid;
int ret;

/* get memory resource */
sprintf(res_name, "musb%d", id);
Expand All @@ -484,22 +484,14 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
resources[1] = *res;
resources[1].name = "mc";

/* 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", musbid);
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
dev_err(dev, "failed to allocate musb device\n");
ret = -ENOMEM;
goto err1;
goto err0;
}

musb->id = musbid;
musb->dev.parent = dev;
musb->dev.dma_mask = &musb_dmamask;
musb->dev.coherent_dma_mask = musb_dmamask;
Expand Down Expand Up @@ -556,18 +548,10 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)

err2:
platform_device_put(musb);
err1:
musb_put_id(dev, musbid);
err0:
return ret;
}

static void dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id)
{
musb_put_id(glue->dev, glue->musb[id]->id);
platform_device_unregister(glue->musb[id]);
}

static int __devinit dsps_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
Expand Down Expand Up @@ -627,7 +611,7 @@ static int __devinit dsps_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to create child pdev\n");
/* release resources of previously created instances */
for (i--; i >= 0 ; i--)
dsps_delete_musb_pdev(glue, i);
platform_device_unregister(glue->musb[i]);
goto err3;
}
}
Expand All @@ -652,7 +636,7 @@ static int __devexit dsps_remove(struct platform_device *pdev)

/* delete the child platform device */
for (i = 0; i < wrp->instances ; i++)
dsps_delete_musb_pdev(glue, i);
platform_device_unregister(glue->musb[i]);

/* disable usbss clocks */
pm_runtime_put(&pdev->dev);
Expand Down
Loading

0 comments on commit d28ab8b

Please sign in to comment.