aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--clocks.c9
-rw-r--r--gpio.c26
-rw-r--r--regulator.c26
-rw-r--r--sensor.c19
4 files changed, 51 insertions, 29 deletions
diff --git a/clocks.c b/clocks.c
index c115d8e..4b2a11c 100644
--- a/clocks.c
+++ b/clocks.c
@@ -459,8 +459,13 @@ int clock_dump(char *clk)
{
int ret;
- if (read_clock_info(clock_tree))
- return -1;
+ if (!clock_tree) {
+ if (clock_info_load())
+ return -1;
+ } else {
+ if (read_clock_info(clock_tree))
+ return -1;
+ }
if (clk) {
printf("\nParents for \"%s\" Clock :\n\n", clk);
diff --git a/gpio.c b/gpio.c
index d7df0e3..9f323eb 100644
--- a/gpio.c
+++ b/gpio.c
@@ -176,17 +176,6 @@ int dump_gpio_info(void)
return tree_for_each(gpio_tree, dump_gpio_cb, NULL);
}
-int gpio_dump(void)
-{
- int ret;
-
- printf("\nGpio Tree :\n");
- printf("***********\n");
- ret = dump_gpio_info();
- printf("\n\n");
-
- return ret;
-}
static char *gpio_line(struct tree *t)
{
@@ -325,6 +314,21 @@ static int gpio_load_info(void)
return 0;
}
+int gpio_dump(void)
+{
+ int ret;
+
+ if (gpio_load_info())
+ return -1;
+
+ printf("\nGpio Tree :\n");
+ printf("***********\n");
+ ret = dump_gpio_info();
+ printf("\n\n");
+
+ return ret;
+}
+
static int gpio_display(bool refresh)
{
if (gpio_load_info()) {
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()) {
diff --git a/sensor.c b/sensor.c
index cdc86b2..e054a7b 100644
--- a/sensor.c
+++ b/sensor.c
@@ -77,14 +77,6 @@ static int sensor_dump_cb(struct tree *tree, void *data)
return 0;
}
-int sensor_dump(void)
-{
- printf("\nSensor Information:\n");
- printf("*******************\n\n");
-
- return tree_for_each(sensor_tree, sensor_dump_cb, NULL);
-}
-
static struct sensor_info *sensor_alloc(void)
{
struct sensor_info *sensor;
@@ -291,6 +283,17 @@ static int sensor_load_info(void)
return 0;
}
+int sensor_dump(void)
+{
+ if (sensor_load_info())
+ return -1;
+
+ printf("\nSensor Information:\n");
+ printf("*******************\n\n");
+
+ return tree_for_each(sensor_tree, sensor_dump_cb, NULL);
+}
+
static int sensor_display(bool refresh)
{
if (sensor_load_info()) {