forked from Minki/linux
USB: gpio-vbus: ask for vbus_draw regulator before registering xceiv
Ask for vbus_draw regulator before registering tranceiver to disallow possible race between registration and set_power/etc. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
ce97cac813
commit
2887ba9e3e
@ -279,6 +279,13 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
INIT_WORK(&gpio_vbus->work, gpio_vbus_work);
|
INIT_WORK(&gpio_vbus->work, gpio_vbus_work);
|
||||||
|
|
||||||
|
gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
|
||||||
|
if (IS_ERR(gpio_vbus->vbus_draw)) {
|
||||||
|
dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n",
|
||||||
|
PTR_ERR(gpio_vbus->vbus_draw));
|
||||||
|
gpio_vbus->vbus_draw = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* only active when a gadget is registered */
|
/* only active when a gadget is registered */
|
||||||
err = otg_set_transceiver(&gpio_vbus->otg);
|
err = otg_set_transceiver(&gpio_vbus->otg);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -287,13 +294,6 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
|
|||||||
goto err_otg;
|
goto err_otg;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
|
|
||||||
if (IS_ERR(gpio_vbus->vbus_draw)) {
|
|
||||||
dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n",
|
|
||||||
PTR_ERR(gpio_vbus->vbus_draw));
|
|
||||||
gpio_vbus->vbus_draw = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err_otg:
|
err_otg:
|
||||||
free_irq(irq, &pdev->dev);
|
free_irq(irq, &pdev->dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user