From: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> Make the regulator setup code cope more consistently with regulators left enabled by the bootloader ... making it act as if the "boot_on" flag were being set by the boot loader (as needed) instead of by Linux board init code (always). This eliminates the other half of the bug whereby regulators that were enabled during the boot sequence would be enabled with enable count of zero ... preventing regulator_disable() from working when called from drivers. (The first half was fixed by the "regulator: refcount fixes" patch, and related specifically to the "boot_on" flag.) One open issue involves systems that need to force a regulator off at boot time -- the converse of today's "boot_on" flag. There can be arbitrarily long delays between system startup and when a driver can be loaded to turn off the regulator, during which power is being wasted. Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> --- drivers/regulator/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -815,6 +815,14 @@ static int set_machine_constraints(struc goto out; } rdev->use_count = 1; + } else if (ops->is_enabled) { + /* ... if the bootloader left it on, drivers need a + * nonzero enable count else it can't be disabled. + */ + ret = ops->is_enabled(rdev); + if (ret > 0) + rdev->use_count = 1; + ret = 0; } print_constraints(rdev); -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html