[PATCH 1/3] regulator: print state at boot

From: Michał Mirosław
Date: Sat Sep 26 2020 - 17:32:44 EST


Make the initial state of the regulator shown when debugging.

Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
---
drivers/regulator/core.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9238613a8c26..bf88d74f5401 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1114,10 +1114,15 @@ static void print_constraints(struct regulator_dev *rdev)
if (constraints->valid_modes_mask & REGULATOR_MODE_IDLE)
count += scnprintf(buf + count, len - count, "idle ");
if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY)
- count += scnprintf(buf + count, len - count, "standby");
+ count += scnprintf(buf + count, len - count, "standby ");

if (!count)
- scnprintf(buf, len, "no parameters");
+ count = scnprintf(buf, len, "no parameters");
+ else
+ --count;
+
+ count += scnprintf(buf + count, len - count, ", %s",
+ _regulator_is_enabled(rdev) ? "enabled" : "disabled");

rdev_dbg(rdev, "%s\n", buf);

--
2.20.1