aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@free.fr>2011-03-26 22:06:05 +0100
committerAmit Kucheria <amit.kucheria@linaro.org>2011-04-04 02:38:37 +0300
commitb57467126ac56a59aef4f7627f4b4c0427341179 (patch)
tree17c623319feed7b4c0f6f54233756a8a0444b3dc
parent21c04d4cbf3760a033467f42d6d7907637aa3d18 (diff)
downloadpowerdebug-b57467126ac56a59aef4f7627f4b4c0427341179.tar.gz
Reduce the usage of the dump variable
When we reach the mainloop, that means we are not in dump-mode, so we can remove the test with the dump mode. In the other side, let's use the dump function when we are in dump-mode. Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r--powerdebug.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/powerdebug.c b/powerdebug.c
index bb024fc..ca7db7a 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -254,23 +254,16 @@ int mainloop(struct powerdebug_options *options,
struct timeval tval;
fd_set readfds;
- if (!options->dump) {
- if (firsttime[0])
- init_curses();
- create_windows(options->selectedwindow);
- show_header(options->selectedwindow);
- }
+ if (firsttime[0])
+ init_curses();
+ create_windows(options->selectedwindow);
+ show_header(options->selectedwindow);
if (options->regulators || options->selectedwindow == REGULATOR) {
regulator_read_info(reg_info, nr_reg);
- if (!options->dump) {
- create_selectedwindow(options->selectedwindow);
- show_regulator_info(reg_info, nr_reg,
- options->verbose);
- }
- else
- regulator_print_info(reg_info, nr_reg,
- options->verbose);
+ create_selectedwindow(options->selectedwindow);
+ show_regulator_info(reg_info, nr_reg,
+ options->verbose);
}
if (options->clocks || options->selectedwindow == CLOCK) {
@@ -282,7 +275,7 @@ int mainloop(struct powerdebug_options *options,
firsttime[CLOCK] = 0;
strcpy(clkname_str, "");
}
- if (!ret && !options->dump) {
+ if (!ret) {
int hrow;
create_selectedwindow(options->selectedwindow);
@@ -304,25 +297,13 @@ int mainloop(struct powerdebug_options *options,
enter_hit,
options->dump);
}
- if (!ret && options->dump) {
- if (options->findparent)
- read_and_dump_clock_info_one(options->clkarg, options->dump);
- else
- read_and_dump_clock_info(options->verbose);
- }
}
if (options->sensors || options->selectedwindow == SENSOR) {
- if (!options->dump) {
- create_selectedwindow(options->selectedwindow);
- print_sensor_header();
- } else
- read_and_print_sensor_info(options->verbose);
+ create_selectedwindow(options->selectedwindow);
+ print_sensor_header();
}
- if (options->dump)
- break;
-
FD_ZERO(&readfds);
FD_SET(0, &readfds);
tval.tv_sec = options->ticktime;
@@ -344,6 +325,24 @@ int mainloop(struct powerdebug_options *options,
static int powerdebug_dump(struct powerdebug_options *options,
struct regulator_info *reg_info, int nr_reg)
{
+ if (options->regulators) {
+ regulator_read_info(reg_info, nr_reg);
+ regulator_print_info(reg_info, nr_reg, options->verbose);
+ }
+
+ if (options->clocks) {
+ init_clock_details(options->dump, options->selectedwindow);
+
+ if (options->findparent)
+ read_and_dump_clock_info_one(options->clkarg,
+ options->dump);
+ else
+ read_and_dump_clock_info(options->verbose);
+ }
+
+ if (options->sensors)
+ read_and_print_sensor_info(options->verbose);
+
return 0;
}