[PATCH 3/4] regulator: core: Add consumer-requested load in regulator_summary

From: Douglas Anderson
Date: Tue Aug 14 2018 - 13:06:59 EST


It's handy to see the load requested by a regulator consumer in the
regulator_summary. Add it. Since this patch comes after the patch
("regulator: core: If consumers don't call regulator_set_load() assume
max") we'll also differentiate between the case where a consumer
hasn't called regulator_set_load() and the case where a consumer
called it but the load is currently 0 mA.

Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
---

drivers/regulator/core.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b8b8048efbdd..23f64faa6961 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4709,9 +4709,16 @@ static void regulator_summary_show_subtree(struct seq_file *s,

switch (rdev->desc->type) {
case REGULATOR_VOLTAGE:
- seq_printf(s, "%45dmV %5dmV",
- consumer->voltage[PM_SUSPEND_ON].min_uV / 1000,
- consumer->voltage[PM_SUSPEND_ON].max_uV / 1000);
+ if (consumer->uA_load_set) {
+ seq_printf(s, "%37dmA %5dmV %5dmV",
+ consumer->uA_load / 1000,
+ consumer->voltage[PM_SUSPEND_ON].min_uV / 1000,
+ consumer->voltage[PM_SUSPEND_ON].max_uV / 1000);
+ } else {
+ seq_printf(s, "%45dmV %5dmV",
+ consumer->voltage[PM_SUSPEND_ON].min_uV / 1000,
+ consumer->voltage[PM_SUSPEND_ON].max_uV / 1000);
+ }
break;
case REGULATOR_CURRENT:
break;
--
2.18.0.865.gffc8e1a3cd6-goog