make 'dump' variable static

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
diff --git a/clocks.c b/clocks.c
index 9a76c19..ac9aaf5 100644
--- a/clocks.c
+++ b/clocks.c
@@ -20,7 +20,7 @@
 static char clk_name[NAME_MAX];
 static int  bold[MAX_LINES];
 
-int init_clock_details(void)
+int init_clock_details(bool dump)
 {
 	char *path = debugfs_locate_mpoint();
 	struct stat buf;
@@ -80,7 +80,73 @@
 	return atoi(result);
 }
 
-void find_parents_for_clock(char *clkname, int complete)
+static void dump_parent(struct clock_info *clk, int line, bool dump)
+{
+	char *unit = "Hz";
+	double drate;
+	static char spaces[64];
+	char str[256];
+	static int maxline;
+
+	if (maxline < line)
+		maxline = line;
+
+	if (clk && clk->parent)
+		dump_parent(clk->parent, ++line, dump);
+
+	drate = (double)clk->rate;
+	if (drate > 1000 && drate < 1000000) {
+		unit = "KHz";
+		drate /= 1000;
+	}
+	if (drate > 1000000) {
+		unit = "MHz";
+		drate /= 1000000;
+	}
+	if (clk == clocks_info) {
+		line++;
+		strcpy(spaces, "");
+		sprintf(str, "%s%s (flags:%d,usecount:%d,rate:%5.2f %s)\n",
+			spaces, clk->name, clk->flags, clk->usecount, drate,
+			unit);
+	} else {
+		if (!(clk->parent == clocks_info))
+			strcat(spaces, "  ");
+		sprintf(str, "%s`- %s (flags:%d,usecount:%d,rate:%5.2f %s)\n",
+			spaces, clk->name, clk->flags, clk->usecount, drate,
+			unit);
+	}
+	if (dump)
+		//printf("line=%d:m%d:l%d %s", maxline - line + 2, maxline, line, str);
+		printf("%s", str);
+	else
+		print_one_clock(maxline - line + 2, str, 1, 0);
+}
+
+static void dump_all_parents(char *clkarg, bool dump)
+{
+	struct clock_info *clk;
+	char spaces[1024];
+
+	strcpy(spaces, "");
+
+	clk = find_clock(clocks_info, clkarg);
+
+	if (!clk)
+		printf("Clock NOT found!\n");
+	else {
+		/* while(clk && clk != clocks_info) { */
+		/* 	printf("%s\n", clk->name); */
+		/* 	strcat(spaces, "  "); */
+		/* 	clk = clk->parent; */
+		/* 	printf("%s <-- ", spaces); */
+		/* } */
+		/* printf("  /\n"); */
+		dump_parent(clk, 1, dump);
+	}
+}
+
+void find_parents_for_clock(char *clkname, int complete, bool dump)
 {
 	char name[256];
 
@@ -95,7 +161,7 @@
 	}
 	sprintf(name, "Parents for \"%s\" Clock : \n", clkname);
 	print_one_clock(0, name, 1, 1);
-	dump_all_parents(clkname);
+	dump_all_parents(clkname, dump);
 }
 
 int read_and_print_clock_info(int verbose, int hrow, int selected)
@@ -261,11 +327,11 @@
 	}
 }
 
-void read_and_dump_clock_info_one(char *clk)
+void read_and_dump_clock_info_one(char *clk, bool dump)
 {
 	printf("\nParents for \"%s\" Clock :\n\n", clk);
 	read_clock_info(clk_dir_path);
-	dump_all_parents(clk);
+	dump_all_parents(clk, dump);
 	printf("\n\n");
 }
 
@@ -395,72 +461,6 @@
 	(*parent)->num_children++;
 }
 
-void dump_parent(struct clock_info *clk, int line)
-{
-	char *unit = "Hz";
-	double drate;
-	static char spaces[64];
-	char str[256];
-	static int maxline;
-
-	if (maxline < line)
-		maxline = line;
-
-	if (clk && clk->parent)
-		dump_parent(clk->parent, ++line);
-
- 	drate = (double)clk->rate;
-	if (drate > 1000 && drate < 1000000) {
-		unit = "KHz";
-		drate /= 1000;
-	}
-	if (drate > 1000000) {
-		unit = "MHz";
-		drate /= 1000000;
-	}
-	if (clk == clocks_info) {
-		line++;
-		strcpy(spaces, "");
-		sprintf(str, "%s%s (flags:%d,usecount:%d,rate:%5.2f %s)\n",
-			spaces, clk->name, clk->flags, clk->usecount, drate,
-			unit);
-	} else {
-		if (!(clk->parent == clocks_info))
-			strcat(spaces, "  ");
-		sprintf(str, "%s`- %s (flags:%d,usecount:%d,rate:%5.2f %s)\n",
-			spaces, clk->name, clk->flags, clk->usecount, drate,
-			unit);
-	}
-	if (dump)
-		//printf("line=%d:m%d:l%d %s", maxline - line + 2, maxline, line, str);
-		printf("%s", str);
-	else
-		print_one_clock(maxline - line + 2, str, 1, 0);
-}
-
-void dump_all_parents(char *clkarg)
-{
-	struct clock_info *clk;
-	char spaces[1024];
-
-	strcpy(spaces, "");
-
-	clk = find_clock(clocks_info, clkarg);
-
-	if (!clk)
-		printf("Clock NOT found!\n");
-	else {
-//		while(clk && clk != clocks_info) {
-//			printf("%s\n", clk->name);
-//			strcat(spaces, "  ");
-//			clk = clk->parent;
-//			printf("%s <-- ", spaces);
-//		}
-//		printf("  /\n");
-		dump_parent(clk, 1);
-	}
-}
-
 struct clock_info *find_clock(struct clock_info *clk, char *clkarg)
 {
 	int i;
diff --git a/clocks.h b/clocks.h
index a240b72..4b176d0 100644
--- a/clocks.h
+++ b/clocks.h
@@ -51,5 +51,4 @@
 void destroy_clocks_info(void);
 void destroy_clocks_info_recur(struct clock_info *clock);
 void collapse_all_subclocks(struct clock_info *clock);
-void dump_all_parents(char *clkarg);
 struct clock_info *find_clock(struct clock_info *clk, char *clkarg);
diff --git a/powerdebug.c b/powerdebug.c
index ca19a29..380803c 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -17,7 +17,7 @@
 #include <stdbool.h>
 #include "powerdebug.h"
 
-bool dump = false;
+static bool dump = false;
 int highlighted_row;
 int selectedwindow = -1;
 
@@ -275,7 +275,7 @@
 		if (options->clocks || selectedwindow == CLOCK) {
 			int ret = 0;
 			if (firsttime[CLOCK]) {
-				ret = init_clock_details();
+				ret = init_clock_details(dump);
 				if (!ret)
 					firsttime[CLOCK] = 0;
 				strcpy(clkname_str, "");
@@ -299,11 +299,11 @@
 					enter_hit = false;
 				} else
 					find_parents_for_clock(clkname_str,
-							enter_hit);
+							       enter_hit, dump);
 			}
 			if (!ret && dump) {
 				if (options->findparent)
-					read_and_dump_clock_info_one(options->clkarg);
+					read_and_dump_clock_info_one(options->clkarg, dump);
 				else
 					read_and_dump_clock_info(options->verbose);
 			}
diff --git a/powerdebug.h b/powerdebug.h
index e87932e..9fd18a5 100644
--- a/powerdebug.h
+++ b/powerdebug.h
@@ -33,7 +33,6 @@
 extern int selectedwindow;
 
 extern int numregulators;
-extern bool dump;
 
 extern int init_regulator_ds(void);
 extern void print_regulator_info(int verbose);
@@ -41,17 +40,17 @@
 extern void print_regulator_info(int verbose);
 
 extern void read_and_dump_clock_info(int verbose);
-extern void read_and_dump_clock_info_one(char *clk);
+extern void read_and_dump_clock_info_one(char *clk, bool dump);
 extern void read_clock_info(char *clkpath);
 extern struct clock_info *read_clock_info_recur(char *clkpath, int level,
 						struct clock_info *parent);
 extern void dump_clock_info(struct clock_info *clk, int level, int bmp);
 extern void insert_children(struct clock_info **parent, struct clock_info *clk);
-extern void find_parents_for_clock(char *clkname, int complete);
+extern void find_parents_for_clock(char *clkname, int complete, bool dump);
 extern int  read_and_print_clock_info(int verbose, int hrow, int selected);
 extern void print_clock_info(int verbose, int hrow, int selected);
 extern void print_string_val(char *name, char *val);
-extern int  init_clock_details(void);
+extern int  init_clock_details(bool dump);
 extern void print_clock_header(void);
 extern void print_one_clock(int line, char *str, int bold, int highlight);
 extern char *debugfs_locate_mpoint(void);