diff options
author | Daniel Lezcano <daniel.lezcano@free.fr> | 2011-03-26 22:06:18 +0100 |
---|---|---|
committer | Amit Kucheria <amit.kucheria@linaro.org> | 2011-04-04 03:14:16 +0300 |
commit | 934fc09f9c04fca837f15bd9e58219919942ab7c (patch) | |
tree | edf0496b77436eef023c3900df86dd2c214bcb41 | |
parent | eeb137699e1bfa86ba6c5cf0ab8efd1b3bfb3a8c (diff) |
Cleanup the code by removing weird initialization
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r-- | powerdebug.c | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/powerdebug.c b/powerdebug.c index 215b0fe..f67312c 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -142,19 +142,9 @@ int getoptions(int argc, char *argv[], struct powerdebug_options *options) } } - if (options->dump) { - - /* No system specified to be dump, let's default to all */ - if (!options->regulators && - !options->clocks && - !options->sensors) { - options->regulators = options->clocks = - options->sensors = true; - - return 0; - } - - } + /* No system specified to be dump, let's default to all */ + if (!options->regulators && !options->clocks && !options->sensors) + options->regulators = options->clocks = options->sensors = true; if (options->selectedwindow == -1) options->selectedwindow = CLOCK; @@ -249,21 +239,15 @@ int mainloop(struct powerdebug_options *options, bool findparent_ncurses = false; bool refreshwin = false; bool enter_hit = false; - int firsttime[TOTAL_FEATURE_WINS]; - int i; char clkname_str[64]; - for (i = 0; i < TOTAL_FEATURE_WINS; i++) - firsttime[i] = 1; + strcpy(clkname_str, ""); while (1) { int key = 0; struct timeval tval; fd_set readfds; - if (firsttime[0] && display_init()) - return -1; - create_windows(options->selectedwindow); show_header(options->selectedwindow); @@ -274,16 +258,9 @@ int mainloop(struct powerdebug_options *options, options->verbose); } - if (options->clocks || options->selectedwindow == CLOCK) { - int ret = 0; - if (firsttime[CLOCK]) { - ret = init_clock_details(options->dump, - options->selectedwindow); - if (!ret) - firsttime[CLOCK] = 0; - strcpy(clkname_str, ""); - } - if (!ret) { + if (options->selectedwindow == CLOCK) { + + if (options->clocks) { int hrow; create_selectedwindow(options->selectedwindow); @@ -401,6 +378,11 @@ int main(int argc, char **argv) return 1; } + if (init_clock_details(options->dump, options->selectedwindow)) { + printf("failed initialize clock details\n"); + options->clocks = false; + } + if (mainloop(options, regulators_info, numregulators)) return 1; |