The regulator_read_info does no longer depend no the global variable numregulators.
Signed-off-by: Daniel Lezcano daniel.lezcano@free.fr --- powerdebug.c | 2 +- regulator.c | 4 ++-- regulator.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/powerdebug.c b/powerdebug.c index d310d5c..d705bb9 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -263,7 +263,7 @@ int mainloop(struct powerdebug_options *options) }
if (options->regulators || options->selectedwindow == REGULATOR) { - regulator_read_info(regulators_info); + regulator_read_info(regulators_info, numregulators); if (!options->dump) { create_selectedwindow(options->selectedwindow); show_regulator_info(regulators_info, options->verbose); diff --git a/regulator.c b/regulator.c index 93a03cf..60529ed 100644 --- a/regulator.c +++ b/regulator.c @@ -148,7 +148,7 @@ static void read_info_from_dirent(struct regulator_info *reg_info, reg_info[idx].num_users = atoi(str); }
-int regulator_read_info(struct regulator_info *reg_info) +int regulator_read_info(struct regulator_info *reg_info, int nr_reg) { FILE *file = NULL; DIR *regdir, *dir; @@ -173,7 +173,7 @@ int regulator_read_info(struct regulator_info *reg_info) continue; count++;
- if (count > numregulators) { + if (count > nr_reg) { ret = 1; goto exit; } diff --git a/regulator.h b/regulator.h index 0c843b3..8781f36 100644 --- a/regulator.h +++ b/regulator.h @@ -41,6 +41,6 @@ struct regulator_info { };
extern struct regulator_info *regulator_init(int *nr_regulators); -extern int regulator_read_info(struct regulator_info *reg_info); +extern int regulator_read_info(struct regulator_info *reg_info, int nr_reg); extern void regulator_print_info(struct regulator_info *reg_info, int nr_reg, int verbose);