diff options
-rw-r--r-- | drivers/of/base.c | 23 | ||||
-rw-r--r-- | include/linux/of.h | 6 |
2 files changed, 16 insertions, 13 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index b9864806e9b8..df9b2bb7bb27 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * as published by the Free Software Foundation; either version | 17 | * as published by the Free Software Foundation; either version |
18 | * 2 of the License, or (at your option) any later version. | 18 | * 2 of the License, or (at your option) any later version. |
19 | */ | 19 | */ |
20 | #include <linux/console.h> | ||
20 | #include <linux/ctype.h> | 21 | #include <linux/ctype.h> |
21 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
@@ -2180,20 +2181,22 @@ const char *of_prop_next_string(struct property *prop, const char *cur) | |||
2180 | EXPORT_SYMBOL_GPL(of_prop_next_string); | 2181 | EXPORT_SYMBOL_GPL(of_prop_next_string); |
2181 | 2182 | ||
2182 | /** | 2183 | /** |
2183 | * of_device_is_stdout_path - check if a device node matches the | 2184 | * of_console_check() - Test and setup console for DT setup |
2184 | * linux,stdout-path property | 2185 | * @dn - Pointer to device node |
2185 | * | 2186 | * @name - Name to use for preferred console without index. ex. "ttyS" |
2186 | * Check if this device node matches the linux,stdout-path property | 2187 | * @index - Index to use for preferred console. |
2187 | * in the chosen node. return true if yes, false otherwise. | 2188 | * |
2189 | * Check if the given device node matches the stdout-path property in the | ||
2190 | * /chosen node. If it does then register it as the preferred console and return | ||
2191 | * TRUE. Otherwise return FALSE. | ||
2188 | */ | 2192 | */ |
2189 | int of_device_is_stdout_path(struct device_node *dn) | 2193 | bool of_console_check(struct device_node *dn, char *name, int index) |
2190 | { | 2194 | { |
2191 | if (!of_stdout) | 2195 | if (!dn || dn != of_stdout || console_set_on_cmdline) |
2192 | return false; | 2196 | return false; |
2193 | 2197 | return add_preferred_console(name, index, NULL); | |
2194 | return of_stdout == dn; | ||
2195 | } | 2198 | } |
2196 | EXPORT_SYMBOL_GPL(of_device_is_stdout_path); | 2199 | EXPORT_SYMBOL_GPL(of_console_check); |
2197 | 2200 | ||
2198 | /** | 2201 | /** |
2199 | * of_find_next_cache_node - Find a node's subsidiary cache | 2202 | * of_find_next_cache_node - Find a node's subsidiary cache |
diff --git a/include/linux/of.h b/include/linux/of.h index 196b34c1ef4e..9d9734056e39 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -352,7 +352,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, | |||
352 | */ | 352 | */ |
353 | const char *of_prop_next_string(struct property *prop, const char *cur); | 353 | const char *of_prop_next_string(struct property *prop, const char *cur); |
354 | 354 | ||
355 | int of_device_is_stdout_path(struct device_node *dn); | 355 | bool of_console_check(struct device_node *dn, char *name, int index); |
356 | 356 | ||
357 | #else /* CONFIG_OF */ | 357 | #else /* CONFIG_OF */ |
358 | 358 | ||
@@ -564,9 +564,9 @@ static inline int of_machine_is_compatible(const char *compat) | |||
564 | return 0; | 564 | return 0; |
565 | } | 565 | } |
566 | 566 | ||
567 | static inline int of_device_is_stdout_path(struct device_node *dn) | 567 | static inline bool of_console_check(const struct device_node *dn, const char *name, int index) |
568 | { | 568 | { |
569 | return 0; | 569 | return false; |
570 | } | 570 | } |
571 | 571 | ||
572 | static inline const __be32 *of_prop_next_u32(struct property *prop, | 572 | static inline const __be32 *of_prop_next_u32(struct property *prop, |