pass regulators_info parameter to show_regulator_info
The show_regulator_info function does no longer rely on the
global regulators_info variable.
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
diff --git a/display.c b/display.c
index 8b03444..b439814 100644
--- a/display.c
+++ b/display.c
@@ -176,7 +176,7 @@
}
-void show_regulator_info(int verbose)
+void show_regulator_info(struct regulator_info *reg_info, int verbose)
{
int i, count = 1;
@@ -200,34 +200,34 @@
if ((i + 2) > (maxy-2))
break;
- if (regulators_info[i].num_users > 0)
+ if (reg_info[i].num_users > 0)
wattron(regulator_win, WA_BOLD);
else
wattroff(regulator_win, WA_BOLD);
print(regulator_win, col, count, "%s",
- regulators_info[i].name);
+ reg_info[i].name);
col += 12;
print(regulator_win, col, count, "%s",
- regulators_info[i].status);
+ reg_info[i].status);
col += 12;
print(regulator_win, col, count, "%s",
- regulators_info[i].state);
+ reg_info[i].state);
col += 12;
print(regulator_win, col, count, "%s",
- regulators_info[i].type);
+ reg_info[i].type);
col += 12;
print(regulator_win, col, count, "%d",
- regulators_info[i].num_users);
+ reg_info[i].num_users);
col += 12;
print(regulator_win, col, count, "%d",
- regulators_info[i].microvolts);
+ reg_info[i].microvolts);
col += 12;
print(regulator_win, col, count, "%d",
- regulators_info[i].min_microvolts);
+ reg_info[i].min_microvolts);
col += 12;
print(regulator_win, col, count, "%d",
- regulators_info[i].max_microvolts);
+ reg_info[i].max_microvolts);
count++;
}
diff --git a/powerdebug.c b/powerdebug.c
index a8e98c9..15194da 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -264,7 +264,7 @@
regulator_read_info(regulators_info);
if (!options->dump) {
create_selectedwindow(options->selectedwindow);
- show_regulator_info(options->verbose);
+ show_regulator_info(regulators_info, options->verbose);
}
else
regulator_print_info(regulators_info, options->verbose);
diff --git a/powerdebug.h b/powerdebug.h
index d04cfce..ac2b042 100644
--- a/powerdebug.h
+++ b/powerdebug.h
@@ -58,4 +58,4 @@
extern void show_header(int selectedwindow);
extern void create_windows(int selectedwindow);
extern void create_selectedwindow(int selectedwindow);
-extern void show_regulator_info(int verbose);
+extern void show_regulator_info(struct regulator_info *reg_info, int verbose);