diff options
author | Felipe Balbi <balbi@ti.com> | 2014-04-16 16:16:33 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-04-21 14:07:25 -0500 |
commit | 2f36ff6915c6c00df8b9962d9c6c7992befcf8ce (patch) | |
tree | 86659a77a445a849073032e9b74fdfad828d147c /drivers/usb/musb/am35x.c | |
parent | e741e637a85a802a93125dca1ecf324bc414101b (diff) | |
download | linux-2f36ff6915c6c00df8b9962d9c6c7992befcf8ce.tar.gz linux-2f36ff6915c6c00df8b9962d9c6c7992befcf8ce.tar.bz2 linux-2f36ff6915c6c00df8b9962d9c6c7992befcf8ce.zip |
usb: phy: generic: allow multiples calls to usb_phy_generic_register()
it's now very easy to return a platform_device pointer
and have the caller pass it as argument when calling
usb_phy_generic_unregister().
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/am35x.c')
-rw-r--r-- | drivers/usb/musb/am35x.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 05459b56b2a8..0a34dd859555 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c @@ -85,6 +85,7 @@ struct am35x_glue { struct device *dev; struct platform_device *musb; + struct platform_device *phy; struct clk *phy_clk; struct clk *clk; }; @@ -503,7 +504,9 @@ static int am35x_probe(struct platform_device *pdev) pdata->platform_ops = &am35x_ops; - usb_phy_generic_register(); + glue->phy = usb_phy_generic_register(); + if (IS_ERR(glue->phy)) + goto err7; platform_set_drvdata(pdev, glue); pinfo = am35x_dev_info; @@ -517,11 +520,14 @@ static int am35x_probe(struct platform_device *pdev) if (IS_ERR(musb)) { ret = PTR_ERR(musb); dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); - goto err7; + goto err8; } return 0; +err8: + usb_phy_generic_unregister(glue->phy); + err7: clk_disable(clk); @@ -546,7 +552,7 @@ static int am35x_remove(struct platform_device *pdev) struct am35x_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); - usb_phy_generic_unregister(); + usb_phy_generic_unregister(glue->phy); clk_disable(glue->clk); clk_disable(glue->phy_clk); clk_put(glue->clk); |