aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@free.fr>2011-03-26 22:06:02 +0100
committerAmit Kucheria <amit.kucheria@linaro.org>2011-04-04 02:30:42 +0300
commit08198265aceba7cb437925ee2f7575ec45e25766 (patch)
treeedd9fecfa0384d03b471c1e99f2e629e7012d742
parenta9fff863e30d715113fa5236163bd5713e9bedd0 (diff)
downloadpowerdebug-08198265aceba7cb437925ee2f7575ec45e25766.tar.gz
make regulators_info and numregulators local to main
Kill the global variables and make them local to the main function. Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r--powerdebug.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/powerdebug.c b/powerdebug.c
index 6dd4b8c..0b26678 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -20,9 +20,6 @@
int highlighted_row;
-static struct regulator_info *regulators_info;
-static int numregulators;
-
void usage(void)
{
printf("Usage: powerdebug [OPTIONS]\n");
@@ -239,7 +236,8 @@ int keystroke_callback(bool *enter_hit, bool *findparent_ncurses,
return 0;
}
-int mainloop(struct powerdebug_options *options)
+int mainloop(struct powerdebug_options *options,
+ struct regulator_info *reg_info, int nr_reg)
{
bool findparent_ncurses = false;
bool refreshwin = false;
@@ -264,14 +262,14 @@ int mainloop(struct powerdebug_options *options)
}
if (options->regulators || options->selectedwindow == REGULATOR) {
- regulator_read_info(regulators_info, numregulators);
+ regulator_read_info(reg_info, nr_reg);
if (!options->dump) {
create_selectedwindow(options->selectedwindow);
- show_regulator_info(regulators_info, numregulators,
+ show_regulator_info(reg_info, nr_reg,
options->verbose);
}
else
- regulator_print_info(regulators_info, numregulators,
+ regulator_print_info(reg_info, nr_reg,
options->verbose);
}
@@ -346,6 +344,8 @@ int mainloop(struct powerdebug_options *options)
int main(int argc, char **argv)
{
struct powerdebug_options *options;
+ struct regulator_info *regulators_info;
+ int numregulators;
options = malloc(sizeof(*options));
if (!options) {
@@ -364,7 +364,7 @@ int main(int argc, char **argv)
return 1;
}
- if (mainloop(options))
+ if (mainloop(options, regulators_info, numregulators))
return 1;
return 0;