@@ -262,6 +262,10 @@ static int _clock_print_info_cb(struct tree *t, void *data)
static int clock_print_info_cb(struct tree *t, void *data)
{
+ /* we skip the root node of the tree */
+ if (!t->parent)
+ return 0;
+
/* show the clock when *all* its parent is expanded */
if (tree_for_each_parent(t->parent, is_collapsed, NULL))
return 0;
@@ -315,9 +319,9 @@ static int clock_select(void)
* found in the files. Then print the result to the text based interface
* Return 0 on success, < 0 otherwise
*/
-static int clock_display(void)
+static int clock_display(bool refresh)
{
- if (read_clock_info(clock_tree))
+ if (refresh && read_clock_info(clock_tree))
return -1;
return clock_print_info(clock_tree);
@@ -334,13 +338,10 @@ static int clock_find(const char *name)
for (i = 0; i < nr; i++) {
- ret = read_clock_info(ptree[i]);
- if (ret)
- break;
-
ret = _clock_print_info_cb(ptree[i], &line);
if (ret)
break;
+
}
display_refresh_pad(CLOCK);
@@ -111,14 +111,14 @@ static int display_show_footer(int win, char *string)
return 0;
}
-int display_refresh(int win)
+static int display_refresh(int win, bool read)
{
/* we are trying to refresh a window which is not showed */
if (win != current_win)
return 0;
if (windata[win].ops && windata[win].ops->display)
- return windata[win].ops->display();
+ return windata[win].ops->display(read);
return 0;
}
@@ -391,13 +391,12 @@ static int display_keystroke(int fd, void *data)
case 'r':
case 'R':
- /* refresh will be done after */
- break;
+ return display_refresh(current_win, true);
default:
return 0;
}
- display_refresh(current_win);
+ display_refresh(current_win, false);
return 0;
}
@@ -416,7 +415,7 @@ static int display_switch_to_main(int fd)
if (display_show_footer(current_win, NULL))
return -1;
- return display_refresh(current_win);
+ return display_refresh(current_win, false);
}
static int display_find_keystroke(int fd, void *data)
@@ -547,7 +546,7 @@ int display_init(int wdefault)
if (display_show_footer(wdefault, NULL))
return -1;
- return display_refresh(wdefault);
+ return display_refresh(wdefault, true);
}
int display_column_name(const char *line)
@@ -16,7 +16,7 @@
enum { CLOCK, REGULATOR, SENSOR };
struct display_ops {
- int (*display)(void);
+ int (*display)(bool refresh);
int (*select)(void);
int (*find)(const char *);
int (*selectf)(void);
@@ -31,5 +31,4 @@ extern void *display_get_row_data(int window);
extern int display_init(int wdefault);
extern int display_register(int win, struct display_ops *ops);
-extern int display_refresh(int win);
extern int display_column_name(const char *line);
@@ -156,7 +156,7 @@ static int regulator_print_header(void)
}
-static int regulator_display(void)
+static int regulator_display(bool refresh)
{
int ret, line = 0;
@@ -250,7 +250,7 @@ static int sensor_print_header(void)
return ret;
}
-static int sensor_display(void)
+static int sensor_display(bool refresh)
{
int ret, line = 0;
With this patch the content of the debugfs file is readen only when the 'refresh' button is hit and at the init of powerdebug. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- clocks.c | 13 +++++++------ display.c | 13 ++++++------- display.h | 3 +-- regulator.c | 2 +- sensor.c | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-)