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>
This commit is contained in:
Felipe Balbi
2014-04-16 16:16:33 -05:00
parent e741e637a8
commit 2f36ff6915
6 changed files with 40 additions and 27 deletions

View File

@@ -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);