summaryrefslogtreecommitdiff
path: root/drivers/usb/phy/phy-generic.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2014-04-16 16:16:33 -0500
committerFelipe Balbi <balbi@ti.com>2014-04-21 14:07:25 -0500
commit2f36ff6915c6c00df8b9962d9c6c7992befcf8ce (patch)
tree86659a77a445a849073032e9b74fdfad828d147c /drivers/usb/phy/phy-generic.c
parente741e637a85a802a93125dca1ecf324bc414101b (diff)
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/phy/phy-generic.c')
-rw-r--r--drivers/usb/phy/phy-generic.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 2c49cd8f6d25..7594e5069ae5 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -41,25 +41,16 @@
#include "phy-generic.h"
-static struct platform_device *pd;
-
-void usb_phy_generic_register(void)
+struct platform_device *usb_phy_generic_register(void)
{
- if (pd)
- return;
- pd = platform_device_register_simple("usb_phy_generic", -1, NULL, 0);
- if (IS_ERR(pd)) {
- pr_err("Unable to register generic usb transceiver\n");
- pd = NULL;
- return;
- }
+ return platform_device_register_simple("usb_phy_generic",
+ PLATFORM_DEVID_AUTO, NULL, 0);
}
EXPORT_SYMBOL_GPL(usb_phy_generic_register);
-void usb_phy_generic_unregister(void)
+void usb_phy_generic_unregister(struct platform_device *pdev)
{
- platform_device_unregister(pd);
- pd = NULL;
+ platform_device_unregister(pdev);
}
EXPORT_SYMBOL_GPL(usb_phy_generic_unregister);