diff options
| author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-05 08:40:44 -0400 |
|---|---|---|
| committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:01:31 -0400 |
| commit | 28fd8737ec3845fc602484c30dcb6746f2fa9340 (patch) | |
| tree | afd73fae7db1c884ef52ee3c3595d27040bd602c /drivers/of | |
| parent | fd79520df80f3879d62388d57aa46c4e23b616c8 (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>
Signed-off-by: Huang Shijie <b32955@freescale.com>
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 1d10b4ec6814..fad95c811bec 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; |
| @@ -1704,3 +1714,19 @@ const char *of_prop_next_string(struct property *prop, const char *cur) | |||
| 1704 | return curv; | 1714 | return curv; |
| 1705 | } | 1715 | } |
| 1706 | EXPORT_SYMBOL_GPL(of_prop_next_string); | 1716 | EXPORT_SYMBOL_GPL(of_prop_next_string); |
| 1717 | |||
| 1718 | /** | ||
| 1719 | * of_device_is_stdout_path - check if a device node matches the | ||
| 1720 | * linux,stdout-path property | ||
| 1721 | * | ||
| 1722 | * Check if this device node matches the linux,stdout-path property | ||
| 1723 | * in the chosen node. return true if yes, false otherwise. | ||
| 1724 | */ | ||
| 1725 | int of_device_is_stdout_path(struct device_node *dn) | ||
| 1726 | { | ||
| 1727 | if (!of_stdout) | ||
| 1728 | return false; | ||
| 1729 | |||
| 1730 | return of_stdout == dn; | ||
| 1731 | } | ||
| 1732 | EXPORT_SYMBOL_GPL(of_device_is_stdout_path); | ||
