aboutsummaryrefslogtreecommitdiff
path: root/regulator.c
diff options
context:
space:
mode:
authorThara Gopinath <thara.gopinath@linaro.org>2017-07-14 13:15:45 -0400
committerLisa Nguyen <lisa.nguyen@linaro.org>2017-09-19 12:53:42 -0700
commitd78818c4670e4ebc59ed98a5322fcee286e3b4fc (patch)
tree0b1d5226da676fa3d8bf46a59e8c49ff653418c3 /regulator.c
parentd42d7ad53a619b4dd2fc3e9194721fd8b0c6de0a (diff)
Initialize tree pointers in the dump only option
The regulator, gpio, sensor and clock tree pointers were initialized only during the display option and not during the dump only option. This meant the dump option was not printing any info previously. This patch fixes it by initilaizing the tree pointers during the dump only option. Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Diffstat (limited to 'regulator.c')
-rw-r--r--regulator.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/regulator.c b/regulator.c
index 5fba6f1..b452f2b 100644
--- a/regulator.c
+++ b/regulator.c
@@ -111,14 +111,6 @@ static int regulator_dump_cb(struct tree *tree, void *data)
return 0;
}
-int regulator_dump(void)
-{
- printf("\nRegulator Information:\n");
- printf("*********************\n\n");
-
- return tree_for_each(reg_tree, regulator_dump_cb, NULL);
-}
-
static int regulator_display_cb(struct tree *t, void *data)
{
struct regulator_info *reg = t->private;
@@ -261,6 +253,24 @@ static int regulator_info_load(void)
return 0;
}
+int regulator_dump(void)
+{
+
+ if (!reg_tree) {
+ reg_tree = tree_load(SYSFS_REGULATOR, regulator_filter_cb,
+ false);
+ if (!reg_tree) {
+ printf("Failed to load regulator tree\n");
+ return -1;
+ }
+ }
+
+ printf("\nRegulator Information:\n");
+ printf("*********************\n\n");
+
+ return tree_for_each(reg_tree, regulator_dump_cb, NULL);
+}
+
static int regulator_display(bool refresh)
{
if (regulator_info_load()) {