Pressing "R" to refresh does not update regulator and sensor values

Fix this bug, and read regulator and sensor datas again when "R"
key pressed.

Signed-off-by: Shaojie Sun <shaojie.sun@linaro.com>
diff --git a/regulator.c b/regulator.c
index 68c686f..9cd89fd 100644
--- a/regulator.c
+++ b/regulator.c
@@ -160,21 +160,6 @@
 
 }
 
-static int regulator_display(bool refresh)
-{
-	int ret, line = 0;
-
-	display_reset_cursor(REGULATOR);
-
-	regulator_print_header();
-
-	ret = tree_for_each(reg_tree, regulator_display_cb, &line);
-
-	display_refresh_pad(REGULATOR);
-
-	return ret;
-}
-
 static int regulator_filter_cb(const char *name)
 {
 	/* let's ignore some directories in order to avoid to be
@@ -213,6 +198,34 @@
 	return 0;
 }
 
+static int read_regulator_info(struct tree *tree)
+{
+	return tree_for_each(tree, read_regulator_cb, NULL);
+}
+
+static int regulator_print_info(struct tree *tree)
+{
+	int ret, line = 0;
+
+	display_reset_cursor(REGULATOR);
+
+	regulator_print_header();
+
+	ret = tree_for_each(tree, regulator_display_cb, &line);
+
+	display_refresh_pad(REGULATOR);
+
+	return ret;
+}
+
+static int regulator_display(bool refresh)
+{
+	if (refresh && read_regulator_info(reg_tree))
+		return -1;
+
+	return regulator_print_info(reg_tree);
+}
+
 static int fill_regulator_cb(struct tree *t, void *data)
 {
 	struct regulator_info *reg;