From: Grant Likely <[EMAIL PROTECTED]> of_lookup_stdout() is useful for figuring out what device to use as output for early boot progress messages. It returns the node pointed to by the linux,stdout-path property in the chosen node.
Signed-off-by: Grant Likely <[EMAIL PROTECTED]> --- drivers/of/base.c | 24 ++++++++++++++++++++++++ include/linux/of.h | 1 + 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index ad8ac1a..10c6a46 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -473,3 +473,27 @@ int of_modalias_node(struct device_node *node, char *modalias, int len) } EXPORT_SYMBOL_GPL(of_modalias_node); +/** + * of_lookup_stdout - find node pointed to by chosen linux,stdout-path property + * + * This routine returns a pointer to the stdout node or NULL on failure + */ +struct device_node __init *of_lookup_stdout(void) +{ + struct device_node *chosen, *stdout_node; + const char *stdout_path; + + chosen = of_find_node_by_path("/chosen"); + if (!chosen) + return NULL; + + stdout_path = of_get_property(chosen, "linux,stdout-path", NULL); + if (!stdout_path) { + of_node_put(chosen); + return NULL; + } + + stdout_node = of_find_node_by_path(stdout_path); + of_node_put(chosen); + return stdout_node; +} diff --git a/include/linux/of.h b/include/linux/of.h index 79886ad..e8b215b 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -71,5 +71,6 @@ 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); +struct device_node __init *of_lookup_stdout(void); #endif /* _LINUX_OF_H */ _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev