aboutsummaryrefslogtreecommitdiff
path: root/regulator.c
diff options
context:
space:
mode:
authorSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-05-26 11:35:02 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-05-26 11:36:33 +0530
commit96f6e050107da5d258280b785e5ed410d534a775 (patch)
treebc7d7ee8c131fbf7b061a0eefb8324e4a77cbcca /regulator.c
parent1540b3c8a3ddfd0d2d592bfe47eae5024b3b9df3 (diff)
downloadpowerdebug-96f6e050107da5d258280b785e5ed410d534a775.tar.gz
display error on module window
- Currently errors are displayed on stdout. This patch puts the error on subscreens also. - bug 1298171 Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
Diffstat (limited to 'regulator.c')
-rw-r--r--regulator.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/regulator.c b/regulator.c
index 9cd89fd..27d75b6 100644
--- a/regulator.c
+++ b/regulator.c
@@ -68,6 +68,7 @@ static struct regulator_data regdata[] = {
};
static struct tree *reg_tree;
+static bool regulator_error = false;
static struct regulator_info *regulator_alloc(void)
{
@@ -220,6 +221,12 @@ static int regulator_print_info(struct tree *tree)
static int regulator_display(bool refresh)
{
+ if (regulator_error) {
+ display_message(REGULATOR,
+ "error: path " SYSFS_REGULATOR " not found");
+ return -2;
+ }
+
if (refresh && read_regulator_info(reg_tree))
return -1;
@@ -255,6 +262,15 @@ static struct display_ops regulator_ops = {
int regulator_init(void)
{
+ int ret = 0;
+
+ ret = display_register(REGULATOR, &regulator_ops);
+ if (!ret)
+ printf("error: regulator display register failed");
+
+ if (access(SYSFS_REGULATOR, F_OK))
+ regulator_error = true; /* set the flag */
+
reg_tree = tree_load(SYSFS_REGULATOR, regulator_filter_cb, false);
if (!reg_tree)
return -1;
@@ -262,5 +278,5 @@ int regulator_init(void)
if (fill_regulator_tree())
return -1;
- return display_register(REGULATOR, &regulator_ops);
+ return ret;
}