aboutsummaryrefslogtreecommitdiff
path: root/clocks.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@free.fr>2011-03-26 22:06:19 +0100
committerAmit Kucheria <amit.kucheria@linaro.org>2011-04-04 03:19:05 +0300
commitf0e0665c69f430b0c42e5dc6b8a6b7e5957da030 (patch)
tree094f1d8e3cbb88a984767623f799352f0def40de /clocks.c
parent934fc09f9c04fca837f15bd9e58219919942ab7c (diff)
downloadpowerdebug-f0e0665c69f430b0c42e5dc6b8a6b7e5957da030.tar.gz
simplify clock_init function
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Diffstat (limited to 'clocks.c')
-rw-r--r--clocks.c39
1 files changed, 4 insertions, 35 deletions
diff --git a/clocks.c b/clocks.c
index 9577267..c83055f 100644
--- a/clocks.c
+++ b/clocks.c
@@ -47,45 +47,14 @@ static int locate_debugfs(char *clk_path)
return ret;
}
-int init_clock_details(bool dump, int selectedwindow)
+int clock_init(void)
{
- struct stat buf;
-
- if (locate_debugfs(clk_dir_path)) {
- if (!dump) {
- create_selectedwindow(selectedwindow);
- sprintf(clock_lines[0], "Unable to locate debugfs "
- "mount point. Mount debugfs "
- "and try again..\n");
- print_one_clock(0, clock_lines[0], 1, 0);
- old_clock_line_no = 1;
- return(1);
- } else {
- fprintf(stderr, "powerdebug: Unable to locate debugfs "
- "mount point. Mount debugfs and try "
- "again..\n");
- return -1;
- }
- }
+ if (locate_debugfs(clk_dir_path))
+ return -1;
sprintf(clk_dir_path, "%s/clock", clk_dir_path);
- //strcpy(clk_dir_path, "/debug/clock"); // Hardcoded for testing..
- if (stat(clk_dir_path, &buf)) {
- if (!dump) {
- create_selectedwindow(selectedwindow);
- sprintf(clock_lines[0], "Unable to find clock tree"
- " information at %s.\n", clk_dir_path);
- print_one_clock(0, clock_lines[0], 1, 0);
- old_clock_line_no = 1;
- return(1);
- } else {
- fprintf(stderr, "powerdebug: Unable to find clock tree"
- " information at %s.\n", clk_dir_path);
- return -1;
- }
- }
- return 0;
+ return access(clk_dir_path, F_OK);
}
static int file_read_from_format(char *file, int *value, const char *format)