Skip to content

Commit eaaa775

Browse files
jhovoldFelipe Balbi
authored andcommitted
usb: phy: gpio-vbus: fix deferred probe from __init
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 <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 8233729 commit eaaa775

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/usb/phy/phy-gpio-vbus-usb.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static int gpio_vbus_set_suspend(struct usb_phy *phy, int suspend)
241241

242242
/* platform driver interface */
243243

244-
static int __init gpio_vbus_probe(struct platform_device *pdev)
244+
static int gpio_vbus_probe(struct platform_device *pdev)
245245
{
246246
struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev);
247247
struct gpio_vbus_data *gpio_vbus;
@@ -349,7 +349,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
349349
return err;
350350
}
351351

352-
static int __exit gpio_vbus_remove(struct platform_device *pdev)
352+
static int gpio_vbus_remove(struct platform_device *pdev)
353353
{
354354
struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
355355
struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev);
@@ -398,8 +398,6 @@ static const struct dev_pm_ops gpio_vbus_dev_pm_ops = {
398398
};
399399
#endif
400400

401-
/* NOTE: the gpio-vbus device may *NOT* be hotplugged */
402-
403401
MODULE_ALIAS("platform:gpio-vbus");
404402

405403
static struct platform_driver gpio_vbus_driver = {
@@ -410,10 +408,11 @@ static struct platform_driver gpio_vbus_driver = {
410408
.pm = &gpio_vbus_dev_pm_ops,
411409
#endif
412410
},
413-
.remove = __exit_p(gpio_vbus_remove),
411+
.probe = gpio_vbus_probe,
412+
.remove = gpio_vbus_remove,
414413
};
415414

416-
module_platform_driver_probe(gpio_vbus_driver, gpio_vbus_probe);
415+
module_platform_driver(gpio_vbus_driver);
417416

418417
MODULE_DESCRIPTION("simple GPIO controlled OTG transceiver driver");
419418
MODULE_AUTHOR("Philipp Zabel");

0 commit comments

Comments
 (0)