Messages in this thread | | | From | Rabin Vincent <> | Date | Thu, 30 Aug 2012 20:24:15 +0200 | Subject | Re: [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().
| |