diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-05 08:40:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-12 14:23:53 -0400 |
commit | 5c19e95216b93b0d29c6a4887e69a980edc6fc81 (patch) | |
tree | 345252b59a83bec24735caa96beead84f38a107d /drivers/of | |
parent | a324e4de0ce5c467b33a54ed65cc2f41c68855ae (diff) |
OF: Add helper for matching against linux,stdout-path
devicetrees may have a linux,stdout-path property in the chosen
node describing the console device. This adds a helper function
to match a device against this property so a driver can call
add_preferred_console for a matching device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 5c5427918eb2..1c3c79c79742 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -32,6 +32,7 @@ struct device_node *of_allnodes; | |||
32 | EXPORT_SYMBOL(of_allnodes); | 32 | EXPORT_SYMBOL(of_allnodes); |
33 | struct device_node *of_chosen; | 33 | struct device_node *of_chosen; |
34 | struct device_node *of_aliases; | 34 | struct device_node *of_aliases; |
35 | static struct device_node *of_stdout; | ||
35 | 36 | ||
36 | DEFINE_MUTEX(of_aliases_mutex); | 37 | DEFINE_MUTEX(of_aliases_mutex); |
37 | 38 | ||
@@ -1595,6 +1596,15 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1595 | of_chosen = of_find_node_by_path("/chosen"); | 1596 | of_chosen = of_find_node_by_path("/chosen"); |
1596 | if (of_chosen == NULL) | 1597 | if (of_chosen == NULL) |
1597 | of_chosen = of_find_node_by_path("/chosen@0"); | 1598 | of_chosen = of_find_node_by_path("/chosen@0"); |
1599 | |||
1600 | if (of_chosen) { | ||
1601 | const char *name; | ||
1602 | |||
1603 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); | ||
1604 | if (name) | ||
1605 | of_stdout = of_find_node_by_path(name); | ||
1606 | } | ||
1607 | |||
1598 | of_aliases = of_find_node_by_path("/aliases"); | 1608 | of_aliases = of_find_node_by_path("/aliases"); |
1599 | if (!of_aliases) | 1609 | if (!of_aliases) |
1600 | return; | 1610 | return; |
@@ -1703,3 +1713,19 @@ const char *of_prop_next_string(struct property *prop, const char *cur) | |||
1703 | return curv; | 1713 | return curv; |
1704 | } | 1714 | } |
1705 | EXPORT_SYMBOL_GPL(of_prop_next_string); | 1715 | EXPORT_SYMBOL_GPL(of_prop_next_string); |
1716 | |||
1717 | /** | ||
1718 | * of_device_is_stdout_path - check if a device node matches the | ||
1719 | * linux,stdout-path property | ||
1720 | * | ||
1721 | * Check if this device node matches the linux,stdout-path property | ||
1722 | * in the chosen node. return true if yes, false otherwise. | ||
1723 | */ | ||
1724 | int of_device_is_stdout_path(struct device_node *dn) | ||
1725 | { | ||
1726 | if (!of_stdout) | ||
1727 | return false; | ||
1728 | |||
1729 | return of_stdout == dn; | ||
1730 | } | ||
1731 | EXPORT_SYMBOL_GPL(of_device_is_stdout_path); | ||