-Wall already set most the warning flags
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 0ac486d..295b7cb 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ BINDIR=/usr/sbin MANDIR=/usr/share/man/man8
-WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -CFLAGS?=-O1 -g ${WARNFLAGS} +CFLAGS?=-O1 -g -Wall -Wshadow CC?=gcc
OBJS = powerdebug.o sensor.o clocks.o regulator.o display.o @@ -23,4 +22,4 @@ install: powerdebug powerdebug.8.gz all: powerdebug powerdebug.8.gz
clean: - rm -f powerdebug *.o powerdebug.8.gz + rm -f powerdebug ${OBJS} powerdebug.8.gz
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- clocks.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/clocks.c b/clocks.c index b556644..3a93421 100644 --- a/clocks.c +++ b/clocks.c @@ -311,7 +311,7 @@ static void add_clock_details_recur(struct clock_info *clock,
sprintf(rate_str, "%.2f %s", drate, unit); prepare_name_str(name_str, clock); - sprintf(clock_lines[clock_line_no++], "%-55s %-4d %-12s %-12d %-12d", + sprintf(clock_lines[clock_line_no++], "%-55s 0x%-4x %-12s %-12d %-12d", name_str, clock->flags, rate_str, clock->usecount, clock->num_children);
Due to an internal error in clocks.c I am investigating, I am temporarly changing the test in the mainloop to have the clock being initialized when the option is set.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- powerdebug.c | 44 +++++++++++++++++++++----------------------- 1 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index 4d55f17..3e0272f 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -259,29 +259,27 @@ int mainloop(struct powerdebug_options *options, options->verbose); }
- if (options->selectedwindow == CLOCK) { - - if (options->clocks) { - int hrow; - - create_selectedwindow(options->selectedwindow); - if (!findparent_ncurses) { - int command = 0; - - if (enter_hit) - command = CLOCK_SELECTED; - if (refreshwin) - command = REFRESH_WINDOW; - hrow = read_and_print_clock_info( - options->verbose, - highlighted_row, - command); - highlighted_row = hrow; - enter_hit = false; - } else - find_parents_for_clock(clkname_str, - enter_hit); - } + if (options->clocks || options->selectedwindow == CLOCK) { + + int hrow; + + create_selectedwindow(options->selectedwindow); + if (!findparent_ncurses) { + int command = 0; + + if (enter_hit) + command = CLOCK_SELECTED; + if (refreshwin) + command = REFRESH_WINDOW; + hrow = read_and_print_clock_info( + options->verbose, + highlighted_row, + command); + highlighted_row = hrow; + enter_hit = false; + } else + find_parents_for_clock(clkname_str, + enter_hit); }
if (options->sensors || options->selectedwindow == SENSOR) {
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- powerdebug.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index 3e0272f..dd4fe91 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -164,10 +164,10 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, if (keystroke == EOF) exit(0);
- if (keystroke == KEY_RIGHT || keystroke == 9) + if (keystroke == KEY_RIGHT || keystroke == '\t') options->selectedwindow++;
- if (keystroke == KEY_LEFT || keystroke == 353) + if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) options->selectedwindow--;
if (options->selectedwindow >= TOTAL_FEATURE_WINS) @@ -181,20 +181,20 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, highlighted_row++; if (keystroke == KEY_UP && highlighted_row > 0) highlighted_row--; - if (keystroke == 47) + if (keystroke == '/') *findparent_ncurses = true;
- if ((keystroke == 27 || oldselectedwin != + if ((keystroke == '\e' || oldselectedwin != options->selectedwindow) && *findparent_ncurses) { *findparent_ncurses = false; clkname_str[0] = '\0'; }
- if (*findparent_ncurses && keystroke != 13) { + if (*findparent_ncurses && keystroke != '\r') { int len = strlen(clkname_str); char str[2];
- if (keystroke == 263) { + if (keystroke == KEY_BACKSPACE) { if (len > 0) len--;
@@ -220,7 +220,7 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, exit(1); #endif
- if (keystroke == 13) + if (keystroke == '\r') *enter_hit = true;
if (keychar == 'Q' && !*findparent_ncurses)
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- powerdebug.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index dd4fe91..5fe07de 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -15,6 +15,7 @@
#include <getopt.h> #include <stdbool.h> +#include <math.h> #include "regulator.h" #include "display.h" #include "clocks.h" @@ -164,17 +165,16 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, if (keystroke == EOF) exit(0);
- if (keystroke == KEY_RIGHT || keystroke == '\t') + if (keystroke == KEY_RIGHT || keystroke == '\t') { options->selectedwindow++; + options->selectedwindow %= TOTAL_FEATURE_WINS; + }
- if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) + if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) { options->selectedwindow--; - - if (options->selectedwindow >= TOTAL_FEATURE_WINS) - options->selectedwindow = 0; - - if (options->selectedwindow < 0) - options->selectedwindow = TOTAL_FEATURE_WINS - 1; + if (options->selectedwindow < 0) + options->selectedwindow = TOTAL_FEATURE_WINS - 1; + }
if (options->selectedwindow == CLOCK) { if (keystroke == KEY_DOWN)
-Wall already set most the warning flags
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 0ac486d..295b7cb 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ BINDIR=/usr/sbin MANDIR=/usr/share/man/man8
-WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -CFLAGS?=-O1 -g ${WARNFLAGS} +CFLAGS?=-O1 -g -Wall -Wshadow CC?=gcc
OBJS = powerdebug.o sensor.o clocks.o regulator.o display.o @@ -23,4 +22,4 @@ install: powerdebug powerdebug.8.gz all: powerdebug powerdebug.8.gz
clean: - rm -f powerdebug *.o powerdebug.8.gz + rm -f powerdebug ${OBJS} powerdebug.8.gz
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- clocks.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/clocks.c b/clocks.c index b556644..3a93421 100644 --- a/clocks.c +++ b/clocks.c @@ -311,7 +311,7 @@ static void add_clock_details_recur(struct clock_info *clock,
sprintf(rate_str, "%.2f %s", drate, unit); prepare_name_str(name_str, clock); - sprintf(clock_lines[clock_line_no++], "%-55s %-4d %-12s %-12d %-12d", + sprintf(clock_lines[clock_line_no++], "%-55s 0x%-4x %-12s %-12d %-12d", name_str, clock->flags, rate_str, clock->usecount, clock->num_children);
Due to an internal error in clocks.c I am investigating, I am temporarly changing the test in the mainloop to have the clock being initialized when the option is set.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- powerdebug.c | 44 +++++++++++++++++++++----------------------- 1 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index 4d55f17..3e0272f 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -259,29 +259,27 @@ int mainloop(struct powerdebug_options *options, options->verbose); }
- if (options->selectedwindow == CLOCK) { - - if (options->clocks) { - int hrow; - - create_selectedwindow(options->selectedwindow); - if (!findparent_ncurses) { - int command = 0; - - if (enter_hit) - command = CLOCK_SELECTED; - if (refreshwin) - command = REFRESH_WINDOW; - hrow = read_and_print_clock_info( - options->verbose, - highlighted_row, - command); - highlighted_row = hrow; - enter_hit = false; - } else - find_parents_for_clock(clkname_str, - enter_hit); - } + if (options->clocks || options->selectedwindow == CLOCK) { + + int hrow; + + create_selectedwindow(options->selectedwindow); + if (!findparent_ncurses) { + int command = 0; + + if (enter_hit) + command = CLOCK_SELECTED; + if (refreshwin) + command = REFRESH_WINDOW; + hrow = read_and_print_clock_info( + options->verbose, + highlighted_row, + command); + highlighted_row = hrow; + enter_hit = false; + } else + find_parents_for_clock(clkname_str, + enter_hit); }
if (options->sensors || options->selectedwindow == SENSOR) {
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- powerdebug.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index 3e0272f..dd4fe91 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -164,10 +164,10 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, if (keystroke == EOF) exit(0);
- if (keystroke == KEY_RIGHT || keystroke == 9) + if (keystroke == KEY_RIGHT || keystroke == '\t') options->selectedwindow++;
- if (keystroke == KEY_LEFT || keystroke == 353) + if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) options->selectedwindow--;
if (options->selectedwindow >= TOTAL_FEATURE_WINS) @@ -181,20 +181,20 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, highlighted_row++; if (keystroke == KEY_UP && highlighted_row > 0) highlighted_row--; - if (keystroke == 47) + if (keystroke == '/') *findparent_ncurses = true;
- if ((keystroke == 27 || oldselectedwin != + if ((keystroke == '\e' || oldselectedwin != options->selectedwindow) && *findparent_ncurses) { *findparent_ncurses = false; clkname_str[0] = '\0'; }
- if (*findparent_ncurses && keystroke != 13) { + if (*findparent_ncurses && keystroke != '\r') { int len = strlen(clkname_str); char str[2];
- if (keystroke == 263) { + if (keystroke == KEY_BACKSPACE) { if (len > 0) len--;
@@ -220,7 +220,7 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, exit(1); #endif
- if (keystroke == 13) + if (keystroke == '\r') *enter_hit = true;
if (keychar == 'Q' && !*findparent_ncurses)
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- powerdebug.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index dd4fe91..5fe07de 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -15,6 +15,7 @@
#include <getopt.h> #include <stdbool.h> +#include <math.h> #include "regulator.h" #include "display.h" #include "clocks.h" @@ -164,17 +165,16 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses, if (keystroke == EOF) exit(0);
- if (keystroke == KEY_RIGHT || keystroke == '\t') + if (keystroke == KEY_RIGHT || keystroke == '\t') { options->selectedwindow++; + options->selectedwindow %= TOTAL_FEATURE_WINS; + }
- if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) + if (keystroke == KEY_LEFT || keystroke == KEY_BTAB) { options->selectedwindow--; - - if (options->selectedwindow >= TOTAL_FEATURE_WINS) - options->selectedwindow = 0; - - if (options->selectedwindow < 0) - options->selectedwindow = TOTAL_FEATURE_WINS - 1; + if (options->selectedwindow < 0) + options->selectedwindow = TOTAL_FEATURE_WINS - 1; + }
if (options->selectedwindow == CLOCK) { if (keystroke == KEY_DOWN)