Signed-off-by: Daniel Lezcano <daniel.lezc...@free.fr>
---
 powerdebug.c |   42 ++++++++++++------------------------------
 1 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/powerdebug.c b/powerdebug.c
index 215b0fe..ef2098c 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;
 
-- 
1.7.1


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to