diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-05-03 04:46:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-03 13:17:14 -0400 |
commit | 2887ba9e3e478522a4a3f1f64506fe1e8b0c740c (patch) | |
tree | 46ab1701d5f4e976b792d91a2b6176141ccc8c87 | |
parent | ce97cac813340eb8ecb1c5410041c9eade58f870 (diff) |
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>
-rw-r--r-- | drivers/usb/otg/gpio_vbus.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 221c44444ec6..52733d9959b4 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
@@ -279,6 +279,13 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
279 | } | 279 | } |
280 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); | 280 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); |
281 | 281 | ||
282 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); | ||
283 | if (IS_ERR(gpio_vbus->vbus_draw)) { | ||
284 | dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", | ||
285 | PTR_ERR(gpio_vbus->vbus_draw)); | ||
286 | gpio_vbus->vbus_draw = NULL; | ||
287 | } | ||
288 | |||
282 | /* only active when a gadget is registered */ | 289 | /* only active when a gadget is registered */ |
283 | err = otg_set_transceiver(&gpio_vbus->otg); | 290 | err = otg_set_transceiver(&gpio_vbus->otg); |
284 | if (err) { | 291 | if (err) { |
@@ -287,13 +294,6 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
287 | goto err_otg; | 294 | goto err_otg; |
288 | } | 295 | } |
289 | 296 | ||
290 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); | ||
291 | if (IS_ERR(gpio_vbus->vbus_draw)) { | ||
292 | dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n", | ||
293 | PTR_ERR(gpio_vbus->vbus_draw)); | ||
294 | gpio_vbus->vbus_draw = NULL; | ||
295 | } | ||
296 | |||
297 | return 0; | 297 | return 0; |
298 | err_otg: | 298 | err_otg: |
299 | free_irq(irq, &pdev->dev); | 299 | free_irq(irq, &pdev->dev); |