lkml.org 
[lkml]   [2012]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V2] regulator: disable supply regulator if it is enabled for boot-on
2012/8/29 Laxman Dewangan <ldewangan@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().


\
 
 \ /
  Last update: 2012-08-30 23:21    [W:0.038 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site