[PATCH 1/1] regulator: of: Hide wrong warning regarding suspend state configuration

From: Robert Karszniewicz
Date: Mon Dec 16 2019 - 12:21:41 EST


A "No configuration" warning is falsely emitted in the case when the
of-property regulator-always-on is set but regulator-(on|off)-in-suspend
isn't set.
This patch fixes the warning by explicitly setting always-on regulator's
states to ENABLE_IN_SUSPEND.

Signed-off-by: Robert Karszniewicz <r.karszniewicz@xxxxxxxxx>
---
Tested on v4.19.67, applies cleanly on v5.5-rc2.

drivers/regulator/of_regulator.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 210fc20..3acb1571 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -188,8 +188,14 @@ static void of_get_regulation_constraints(struct device_node *np,
continue;
}

+ if (!suspend_state)
+ continue;
+
+ if (constraints->always_on)
+ suspend_state->enabled = ENABLE_IN_SUSPEND;
+
suspend_np = of_get_child_by_name(np, regulator_states[i]);
- if (!suspend_np || !suspend_state)
+ if (!suspend_np)
continue;

if (!of_property_read_u32(suspend_np, "regulator-mode",
--
2.7.4