]> Pileus Git - ~andy/linux/commitdiff
of: Add helper for printing an of_phandle_args structure
authorGrant Likely <grant.likely@linaro.org>
Fri, 11 Oct 2013 21:05:10 +0000 (22:05 +0100)
committerGrant Likely <grant.likely@linaro.org>
Thu, 24 Oct 2013 10:43:13 +0000 (11:43 +0100)
It is sometimes useful for debug to get the contents of an
of_phandle_args structure out into the kernel log.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
drivers/of/base.c
drivers/of/irq.c
include/linux/of.h

index 3ae106d8979149e57fb1bce2cab413191014da39..021db96245e718e402ab4e2dbfadf456ff4952b5 100644 (file)
@@ -1185,6 +1185,15 @@ int of_property_count_strings(struct device_node *np, const char *propname)
 }
 EXPORT_SYMBOL_GPL(of_property_count_strings);
 
+void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
+{
+       int i;
+       printk("%s %s", msg, of_node_full_name(args->np));
+       for (i = 0; i < args->args_count; i++)
+               printk(i ? ",%08x" : ":%08x", args->args[i]);
+       printk("\n");
+}
+
 static int __of_parse_phandle_with_args(const struct device_node *np,
                                        const char *list_name,
                                        const char *cells_name,
index 0ed5ed4a5f9bbcad2cac9cd2c597df131c7eae38..ddea945ec29ee5717921205498f68cbda99dc032 100644 (file)
@@ -101,9 +101,9 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
        u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
        int imaplen, match, i;
 
-       pr_debug("of_irq_parse_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
-                of_node_full_name(out_irq->np), out_irq->args[0], out_irq->args[1],
-                out_irq->args_count);
+#ifdef DEBUG
+       of_print_phandle_args("of_irq_parse_raw: ", out_irq);
+#endif
 
        ipar = of_node_get(out_irq->np);
 
index f95aee391e30fcb98eeec0f6569c0b4bc9b8ba31..374e035361353cbda6a37c9a58218fd99cf8e044 100644 (file)
@@ -275,6 +275,7 @@ extern int of_n_size_cells(struct device_node *np);
 extern const struct of_device_id *of_match_node(
        const struct of_device_id *matches, const struct device_node *node);
 extern int of_modalias_node(struct device_node *node, char *modalias, int len);
+extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args);
 extern struct device_node *of_parse_phandle(const struct device_node *np,
                                            const char *phandle_name,
                                            int index);