diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2011-06-15 15:45:12 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2011-06-15 15:45:12 +0200 |
commit | b301b089be6e59da46216ce33451063a81e54206 (patch) | |
tree | d63c2406897efd9077b5713a6cf9728bf6328498 /clocks.c | |
parent | aff647aaca077370451785c8c68b2af3926a7a3d (diff) | |
download | powerdebug-b301b089be6e59da46216ce33451063a81e54206.tar.gz |
Encapsulate the display (6)
Let's create some ops to be registered by the pm blocks to the display.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'clocks.c')
-rw-r--r-- | clocks.c | 53 |
1 files changed, 31 insertions, 22 deletions
@@ -26,6 +26,7 @@ #include <sys/stat.h> #include "powerdebug.h" +#include "display.h" #include "clocks.h" #include "tree.h" #include "utils.h" @@ -306,28 +307,6 @@ int clock_toggle_expanded(void) } /* - * Initialize the clock framework - */ -int clock_init(void) -{ - char clk_dir_path[PATH_MAX]; - - if (locate_debugfs(clk_dir_path)) - return -1; - - sprintf(clk_dir_path, "%s/clock", clk_dir_path); - - if (access(clk_dir_path, F_OK)) - return -1; - - clock_tree = tree_load(clk_dir_path, NULL); - if (!clock_tree) - return -1; - - return fill_clock_tree(); -} - -/* * Read the clock information and fill the tree with the information * found in the files. Then print the result to the text based interface * Return 0 on success, < 0 otherwise @@ -366,3 +345,33 @@ int clock_dump(char *clk) return ret; } + +static struct display_ops clock_ops = { + .display = clock_display, + .select = clock_toggle_expanded, +}; + +/* + * Initialize the clock framework + */ +int clock_init(void) +{ + char clk_dir_path[PATH_MAX]; + + if (display_register(CLOCK, &clock_ops)) + return -1; + + if (locate_debugfs(clk_dir_path)) + return -1; + + sprintf(clk_dir_path, "%s/clock", clk_dir_path); + + if (access(clk_dir_path, F_OK)) + return -1; + + clock_tree = tree_load(clk_dir_path, NULL); + if (!clock_tree) + return -1; + + return fill_clock_tree(); +} |