regulator: core: Fast path non-deferred disables
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 7 Sep 2012 03:00:53 +0000 (11:00 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 8 Sep 2012 00:51:12 +0000 (08:51 +0800)
Users (especially framework code) may end up passing in a zero deferral
time depending on runtime conditions or configuration. If they do then
just call regulator_disable() directly to save scheduling.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
drivers/regulator/core.c

index 50977a6..ed376d9 100644 (file)
@@ -1724,6 +1724,9 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
        if (regulator->always_on)
                return 0;
 
+       if (!ms)
+               return regulator_disable(regulator);
+
        mutex_lock(&rdev->mutex);
        rdev->deferred_disables++;
        mutex_unlock(&rdev->mutex);