2012/8/29 Laxman Dewangan <ldewan...@nvidia.com>:
> @@ -3614,8 +3615,11 @@ static int __init regulator_init_complete(void)
>
>                 mutex_lock(&rdev->mutex);
>
> -               if (rdev->use_count)
> +               if (rdev->use_count) {
> +                       if (rdev->supply && c->boot_on)
> +                               supply_disable = true;
>                         goto unlock;
> +               }
>
>                 /* If we can't read the status assume it's on. */
>                 if (ops->is_enabled)
> @@ -3634,6 +3638,8 @@ static int __init regulator_init_complete(void)
>                         if (ret != 0) {
>                                 rdev_err(rdev, "couldn't disable: %d\n", ret);
>                         }
> +                       if (rdev->supply)
> +                               supply_disable = true;
>                 } else {
>                         /* The intention is that in future we will
>                          * assume that full constraints are provided

This does not handle the case where a regulator is not set boot_on but
is considered on (for example, because of the lack of an is_enabled
callback), and is later actually enabled by a consumer before
regulator_init_complete().  In this case, the supply's use count will
still be one more than it should be, because the "&& c->boot_on"
condition above will fail.

To fix this, you should probably note which regulators' supplies you
enable in regulator_register() and use that information in the above two
checks here in regulator_init_complete().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to