Skip to content

Commit 624cfca

Browse files
committed
of: Add helper for printing an of_phandle_args structure
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 <[email protected]>
1 parent 2361613 commit 624cfca

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

drivers/of/base.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,15 @@ int of_property_count_strings(struct device_node *np, const char *propname)
11851185
}
11861186
EXPORT_SYMBOL_GPL(of_property_count_strings);
11871187

1188+
void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
1189+
{
1190+
int i;
1191+
printk("%s %s", msg, of_node_full_name(args->np));
1192+
for (i = 0; i < args->args_count; i++)
1193+
printk(i ? ",%08x" : ":%08x", args->args[i]);
1194+
printk("\n");
1195+
}
1196+
11881197
static int __of_parse_phandle_with_args(const struct device_node *np,
11891198
const char *list_name,
11901199
const char *cells_name,

drivers/of/irq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
101101
u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
102102
int imaplen, match, i;
103103

104-
pr_debug("of_irq_parse_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
105-
of_node_full_name(out_irq->np), out_irq->args[0], out_irq->args[1],
106-
out_irq->args_count);
104+
#ifdef DEBUG
105+
of_print_phandle_args("of_irq_parse_raw: ", out_irq);
106+
#endif
107107

108108
ipar = of_node_get(out_irq->np);
109109

include/linux/of.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ extern int of_n_size_cells(struct device_node *np);
275275
extern const struct of_device_id *of_match_node(
276276
const struct of_device_id *matches, const struct device_node *node);
277277
extern int of_modalias_node(struct device_node *node, char *modalias, int len);
278+
extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args);
278279
extern struct device_node *of_parse_phandle(const struct device_node *np,
279280
const char *phandle_name,
280281
int index);

0 commit comments

Comments
 (0)