regulator: core: Fast path non-deferred disables
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 <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 50977a6..ed376d9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1724,6 +1724,9 @@
if (regulator->always_on)
return 0;
+ if (!ms)
+ return regulator_disable(regulator);
+
mutex_lock(&rdev->mutex);
rdev->deferred_disables++;
mutex_unlock(&rdev->mutex);