diff options
author | Andres Salomon <dilinger@queued.net> | 2010-07-13 05:42:26 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-07-14 19:08:03 -0400 |
commit | 035ebefc737cce56d3938e9b7eaa5ac0e9c28715 (patch) | |
tree | 37593760f4411ec3d3db9b46e2b9a21255624549 | |
parent | ef2a4524d6e776bbce819eeccbdcaeee5ce74027 (diff) |
of/sparc: move is_root_node() to of.h
Rename is_root_node() to of_node_is_root() and make it available for
all archs to use, as it's not PROM-specific.
Signed-off-by: Andres Salomon <dilinger@queued.net>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r-- | arch/sparc/kernel/prom.h | 8 | ||||
-rw-r--r-- | arch/sparc/kernel/prom_64.c | 6 | ||||
-rw-r--r-- | arch/sparc/kernel/prom_common.c | 2 | ||||
-rw-r--r-- | include/linux/of.h | 5 |
4 files changed, 9 insertions, 12 deletions
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index a8591ef2636d..eeb04a782ec8 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h | |||
@@ -9,14 +9,6 @@ extern void irq_trans_init(struct device_node *dp); | |||
9 | 9 | ||
10 | extern unsigned int prom_unique_id; | 10 | extern unsigned int prom_unique_id; |
11 | 11 | ||
12 | static inline int is_root_node(const struct device_node *dp) | ||
13 | { | ||
14 | if (!dp) | ||
15 | return 0; | ||
16 | |||
17 | return (dp->parent == NULL); | ||
18 | } | ||
19 | |||
20 | extern char *build_path_component(struct device_node *dp); | 12 | extern char *build_path_component(struct device_node *dp); |
21 | extern void of_console_init(void); | 13 | extern void of_console_init(void); |
22 | 14 | ||
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index fb06ac2bd38f..0bffafdee350 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/lmb.h> | 23 | #include <linux/lmb.h> |
24 | #include <linux/of_device.h> | 24 | #include <linux/of.h> |
25 | 25 | ||
26 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
27 | #include <asm/oplib.h> | 27 | #include <asm/oplib.h> |
@@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf) | |||
81 | return; | 81 | return; |
82 | 82 | ||
83 | regs = rprop->value; | 83 | regs = rprop->value; |
84 | if (!is_root_node(dp->parent)) { | 84 | if (!of_node_is_root(dp->parent)) { |
85 | sprintf(tmp_buf, "%s@%x,%x", | 85 | sprintf(tmp_buf, "%s@%x,%x", |
86 | dp->name, | 86 | dp->name, |
87 | (unsigned int) (regs->phys_addr >> 32UL), | 87 | (unsigned int) (regs->phys_addr >> 32UL), |
@@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf) | |||
121 | return; | 121 | return; |
122 | 122 | ||
123 | regs = prop->value; | 123 | regs = prop->value; |
124 | if (!is_root_node(dp->parent)) { | 124 | if (!of_node_is_root(dp->parent)) { |
125 | sprintf(tmp_buf, "%s@%x,%x", | 125 | sprintf(tmp_buf, "%s@%x,%x", |
126 | dp->name, | 126 | dp->name, |
127 | (unsigned int) (regs->phys_addr >> 32UL), | 127 | (unsigned int) (regs->phys_addr >> 32UL), |
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 57ac9e28be0c..1f830da2ddf2 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c | |||
@@ -244,7 +244,7 @@ char * __init build_full_name(struct device_node *dp) | |||
244 | 244 | ||
245 | n = prom_early_alloc(len); | 245 | n = prom_early_alloc(len); |
246 | strcpy(n, dp->parent->full_name); | 246 | strcpy(n, dp->parent->full_name); |
247 | if (!is_root_node(dp->parent)) { | 247 | if (!of_node_is_root(dp->parent)) { |
248 | strcpy(n + plen, "/"); | 248 | strcpy(n + plen, "/"); |
249 | plen++; | 249 | plen++; |
250 | } | 250 | } |
diff --git a/include/linux/of.h b/include/linux/of.h index a367e19bb3af..b0756f33249e 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -70,6 +70,11 @@ extern struct device_node *allnodes; | |||
70 | extern struct device_node *of_chosen; | 70 | extern struct device_node *of_chosen; |
71 | extern rwlock_t devtree_lock; | 71 | extern rwlock_t devtree_lock; |
72 | 72 | ||
73 | static inline bool of_node_is_root(const struct device_node *node) | ||
74 | { | ||
75 | return node && (node->parent == NULL); | ||
76 | } | ||
77 | |||
73 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) | 78 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) |
74 | { | 79 | { |
75 | return test_bit(flag, &n->_flags); | 80 | return test_bit(flag, &n->_flags); |