aboutsummaryrefslogtreecommitdiff
path: root/sensor.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 /sensor.c
parentd42d7ad53a619b4dd2fc3e9194721fd8b0c6de0a (diff)
downloadpowerdebug-d78818c4670e4ebc59ed98a5322fcee286e3b4fc.tar.gz
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 'sensor.c')
-rw-r--r--sensor.c19
1 files changed, 11 insertions, 8 deletions
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()) {