aboutsummaryrefslogtreecommitdiff
path: root/clocks.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
commitd577aaaffc5398ae59558e888071e8214c6cd852 (patch)
tree50640984286b92b2f359f7e665d68aabd6468aca /clocks.c
parent73b400238f53a18c4d35b7ba9a7de7dd26755035 (diff)
downloadpowerdebug-d577aaaffc5398ae59558e888071e8214c6cd852.tar.gz
Optimize the code
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>
Diffstat (limited to 'clocks.c')
-rw-r--r--clocks.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/clocks.c b/clocks.c
index 6943b70..0bd0a0e 100644
--- a/clocks.c
+++ b/clocks.c
@@ -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);