regulator: print state at boot
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Sat, 26 Sep 2020 21:32:40 +0000 (23:32 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 28 Sep 2020 18:03:15 +0000 (19:03 +0100)
Make the initial state of the regulator shown when debugging.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/53c4f3d394d68f0989174f89e3b0882cebbbd787.1601155770.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c

index 6ef99df1a7d23a01c3bdef4f571158f9047db7fc..42cffbe84080b5c1ad9dc89393f7fb091838a890 100644 (file)
@@ -1111,10 +1111,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);