Re: [PATCH] usb: otg: twl4030-usb: Fix unbalanced regulator disables at module removal

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

 



2010/11/30 Jarkko Nikula <jhnikula@xxxxxxxxx>:
> Function twl4030_usb_remove can cause unbalanced regulator disables in
> twl4030_phy_power if the cable is not connected. Regulator enable/disable
> calls are in balance only if the twl4030_phy_resume was called prior the
> twl4030_usb_remove, that is, the cable was connected.
>
> Fix this by checking the 'asleep' variable in twl4030_usb_remove since that
> variable is used to check state in other functions.
>
> Signed-off-by: Jarkko Nikula <jhnikula@xxxxxxxxx>
> Cc: Felipe Balbi <balbi@xxxxxx>
> ---
> For 2.6.38 as not fatal issue.
> WARNING: at drivers/regulator/core.c:1365 _regulator_disable+0x34/0x114()
> unbalanced disables for VUSB1V5
> ...
> ---
>  drivers/usb/otg/twl4030-usb.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
> index d335f48..6ca505f 100644
> --- a/drivers/usb/otg/twl4030-usb.c
> +++ b/drivers/usb/otg/twl4030-usb.c
> @@ -678,7 +678,8 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
>        /* disable complete OTG block */
>        twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB);
>
> -       twl4030_phy_power(twl, 0);
> +       if (!twl->asleep)
> +               twl4030_phy_power(twl, 0);

In fact, regulator enalbe/disable has been balanced and phy has
been powered down already if twl->alseep is true.

Acked-by: Ming Lei <tom.leiming@xxxxxxxxx>

thanks,
-- 
Lei Ming
--
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