Re: [PATCH 7/7] gpio-vbus: ask for vbus_draw regulator before registering xceiv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 1, 2011 at 9:56 PM, Dmitry Eremin-Solenikov
<dbaryshkov@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>

Acked-by: Eric Miao <eric.y.miao@xxxxxxxxx>

Greg, can you help take this patch. This looks like a good fix.

> ---
> Â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 221c444..52733d9 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)
> Â Â Â Â}
> Â Â Â Â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 */
> Â Â Â Âerr = otg_set_transceiver(&gpio_vbus->otg);
> Â Â Â Âif (err) {
> @@ -287,13 +294,6 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
> Â Â Â Â Â Â Â Â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;
> Âerr_otg:
> Â Â Â Âfree_irq(irq, &pdev->dev);
> --
> 1.7.4.1
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux