[PATCH 1/2] clk: add flags parameter to clk_dump(_one)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We currently customize dumping by means of a single verbose argument.
Follow-up commit will want to customize the dumping further, so turn
the verbose parameter into a general flags parameter.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 commands/clk.c      |  8 ++++----
 drivers/clk/clk.c   | 28 ++++++++++++++--------------
 include/linux/clk.h |  5 +++--
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/commands/clk.c b/commands/clk.c
index 606519091e86..290acd842e78 100644
--- a/commands/clk.c
+++ b/commands/clk.c
@@ -163,13 +163,13 @@ BAREBOX_CMD_END
 
 static int do_clk_dump(int argc, char *argv[])
 {
-	int opt, verbose = 0;
+	int opt, flags = 0;
 	struct clk *clk;
 
 	while ((opt = getopt(argc, argv, "v")) > 0) {
 		switch(opt) {
 		case 'v':
-			verbose = 1;
+			flags |= CLK_DUMP_VERBOSE;
 			break;
 		default:
 			return -EINVAL;
@@ -178,7 +178,7 @@ static int do_clk_dump(int argc, char *argv[])
 	}
 
 	if (optind == argc) {
-		clk_dump(verbose);
+		clk_dump(flags);
 		return COMMAND_SUCCESS;
 	}
 
@@ -186,7 +186,7 @@ static int do_clk_dump(int argc, char *argv[])
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-	clk_dump_one(clk, verbose);
+	clk_dump_one(clk, flags);
 
 	return COMMAND_SUCCESS;
 }
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 03533b61df0a..f9abd3147766 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1033,7 +1033,7 @@ static const char *clk_parent_name_by_index(struct clk *clk, u8 idx)
 	return "unknown";
 }
 
-static void dump_one(struct clk *clk, int verbose, int indent)
+static void dump_one(struct clk *clk, int flags, int indent)
 {
 	int enabled = clk_is_enabled(clk);
 	const char *hwstat, *stat;
@@ -1051,7 +1051,7 @@ static void dump_one(struct clk *clk, int verbose, int indent)
 	       clk->enable_count,
 	       hwstat);
 
-	if (verbose) {
+	if (flags & CLK_DUMP_VERBOSE) {
 
 		if (clk->num_parents > 1) {
 			int i;
@@ -1063,21 +1063,21 @@ static void dump_one(struct clk *clk, int verbose, int indent)
 	}
 }
 
-static void dump_subtree(struct clk *clk, int verbose, int indent)
+static void dump_subtree(struct clk *clk, int flags, int indent)
 {
 	struct clk *c;
 
-	dump_one(clk, verbose, indent);
+	dump_one(clk, flags, indent);
 
 	list_for_each_entry(c, &clks, list) {
 		struct clk *parent = clk_get_parent(c);
 
 		if (parent == clk)
-			dump_subtree(c, verbose, indent + 1);
+			dump_subtree(c, flags, indent + 1);
 	}
 }
 
-void clk_dump(int verbose)
+void clk_dump(int flags)
 {
 	struct clk *c;
 
@@ -1085,11 +1085,11 @@ void clk_dump(int verbose)
 		struct clk *parent = clk_get_parent(c);
 
 		if (IS_ERR_OR_NULL(parent))
-			dump_subtree(c, verbose, 0);
+			dump_subtree(c, flags, 0);
 	}
 }
 
-static int clk_print_parent(struct clk *clk, int verbose)
+static int clk_print_parent(struct clk *clk, int flags)
 {
 	struct clk *c;
 	int indent;
@@ -1098,29 +1098,29 @@ static int clk_print_parent(struct clk *clk, int verbose)
 	if (IS_ERR_OR_NULL(c))
 		return 0;
 
-	indent = clk_print_parent(c, verbose);
+	indent = clk_print_parent(c, flags);
 
-	dump_one(c, verbose, indent);
+	dump_one(c, flags, indent);
 
 	return indent + 1;
 }
 
-void clk_dump_one(struct clk *clk, int verbose)
+void clk_dump_one(struct clk *clk, int flags)
 {
 	int indent;
 	struct clk *c;
 
-	indent = clk_print_parent(clk, verbose);
+	indent = clk_print_parent(clk, flags);
 
 	printf("\033[1m");
-	dump_one(clk, verbose, indent);
+	dump_one(clk, flags, indent);
 	printf("\033[0m");
 
 	list_for_each_entry(c, &clks, list) {
 		struct clk *parent = clk_get_parent(c);
 
 		if (parent == clk)
-			dump_subtree(c, verbose, indent + 1);
+			dump_subtree(c, flags, indent + 1);
 	}
 }
 
diff --git a/include/linux/clk.h b/include/linux/clk.h
index e4efc2b77044..f2e3a443c20f 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -724,8 +724,9 @@ static inline int clk_hw_register(struct device *dev, struct clk_hw *hw)
 
 struct clk *clk_lookup(const char *name);
 
-void clk_dump(int verbose);
-void clk_dump_one(struct clk *clk, int verbose);
+#define CLK_DUMP_VERBOSE	(1 << 0)
+void clk_dump(int flags);
+void clk_dump_one(struct clk *clk, int flags);
 
 struct clk *clk_register_composite(const char *name,
 			const char * const *parent_names, int num_parents,
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux