Skip to content

Commit

Permalink
usb: phy: gpio-vbus: fix deferred probe from __init
Browse files Browse the repository at this point in the history
Move probe out of __init section and don't use platform_driver_probe
which cannot be used with deferred probing.

Since commit e935457 ("gpiolib: Defer failed gpio requests by default")
and 04bf301 ("regulator: Support driver probe deferral") this driver
might return -EPROBE_DEFER if a gpio_request or regulator_get fails.

Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Johan Hovold authored and Felipe Balbi committed Sep 23, 2013
1 parent 8233729 commit eaaa775
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/usb/phy/phy-gpio-vbus-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static int gpio_vbus_set_suspend(struct usb_phy *phy, int suspend)

/* platform driver interface */

static int __init gpio_vbus_probe(struct platform_device *pdev)
static int gpio_vbus_probe(struct platform_device *pdev)
{
struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev);
struct gpio_vbus_data *gpio_vbus;
Expand Down Expand Up @@ -349,7 +349,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
return err;
}

static int __exit gpio_vbus_remove(struct platform_device *pdev)
static int gpio_vbus_remove(struct platform_device *pdev)
{
struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev);
Expand Down Expand Up @@ -398,8 +398,6 @@ static const struct dev_pm_ops gpio_vbus_dev_pm_ops = {
};
#endif

/* NOTE: the gpio-vbus device may *NOT* be hotplugged */

MODULE_ALIAS("platform:gpio-vbus");

static struct platform_driver gpio_vbus_driver = {
Expand All @@ -410,10 +408,11 @@ static struct platform_driver gpio_vbus_driver = {
.pm = &gpio_vbus_dev_pm_ops,
#endif
},
.remove = __exit_p(gpio_vbus_remove),
.probe = gpio_vbus_probe,
.remove = gpio_vbus_remove,
};

module_platform_driver_probe(gpio_vbus_driver, gpio_vbus_probe);
module_platform_driver(gpio_vbus_driver);

MODULE_DESCRIPTION("simple GPIO controlled OTG transceiver driver");
MODULE_AUTHOR("Philipp Zabel");
Expand Down

0 comments on commit eaaa775

Please sign in to comment.