summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/am35x.c
diff options
context:
space:
mode:
authorFelipe Balbi2014-04-16 23:16:33 +0200
committerFelipe Balbi2014-04-21 21:07:25 +0200
commit2f36ff6915c6c00df8b9962d9c6c7992befcf8ce (patch)
tree86659a77a445a849073032e9b74fdfad828d147c /drivers/usb/musb/am35x.c
parentusb: musb: move usb_phy_generic_{un,}register calls to probe()/remove() (diff)
downloadkernel-qcow2-linux-2f36ff6915c6c00df8b9962d9c6c7992befcf8ce.tar.gz
kernel-qcow2-linux-2f36ff6915c6c00df8b9962d9c6c7992befcf8ce.tar.xz
kernel-qcow2-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.c12
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);