* [PATCH] sparc: move is_root_node from private header to of.h
@ 2010-07-13 9:42 Andres Salomon
2010-07-12 15:53 ` Grant Likely
0 siblings, 1 reply; 4+ messages in thread
From: Andres Salomon @ 2010-07-13 9:42 UTC (permalink / raw)
To: Grant Likely; +Cc: devicetree-discuss, sparclinux, linux-kernel, davem
Make is_root_node available for all archs to use, as it's not PROM-specific.
Also rename it to of_is_root_node, and a few other minor changes for
style/consistency.
Signed-off-by: Andres Salomon <dilinger@queued.net>
---
arch/sparc/kernel/prom.h | 8 --------
arch/sparc/kernel/prom_64.c | 6 +++---
arch/sparc/kernel/prom_common.c | 2 +-
include/linux/of.h | 8 ++++++++
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index a8591ef..eeb04a7 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);
extern unsigned int prom_unique_id;
-static inline int is_root_node(const struct device_node *dp)
-{
- if (!dp)
- return 0;
-
- return (dp->parent == NULL);
-}
-
extern char *build_path_component(struct device_node *dp);
extern void of_console_init(void);
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index fb06ac2..dd5e487 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -21,7 +21,7 @@
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/lmb.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <asm/prom.h>
#include <asm/oplib.h>
@@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
return;
regs = rprop->value;
- if (!is_root_node(dp->parent)) {
+ if (!of_is_root_node(dp->parent)) {
sprintf(tmp_buf, "%s@%x,%x",
dp->name,
(unsigned int) (regs->phys_addr >> 32UL),
@@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
return;
regs = prop->value;
- if (!is_root_node(dp->parent)) {
+ if (!of_is_root_node(dp->parent)) {
sprintf(tmp_buf, "%s@%x,%x",
dp->name,
(unsigned int) (regs->phys_addr >> 32UL),
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 57ac9e2..40123a6 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)
n = prom_early_alloc(len);
strcpy(n, dp->parent->full_name);
- if (!is_root_node(dp->parent)) {
+ if (!of_is_root_node(dp->parent)) {
strcpy(n + plen, "/");
plen++;
}
diff --git a/include/linux/of.h b/include/linux/of.h
index a367e19..b38cdf7 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -97,6 +97,14 @@ extern struct device_node *of_node_get(struct device_node *node);
extern void of_node_put(struct device_node *node);
#endif
+static inline bool of_is_root_node(const struct device_node *node)
+{
+ if (!node)
+ return false;
+
+ return (node->parent == NULL);
+}
+
/*
* OF address retreival & translation
*/
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] sparc: move is_root_node from private header to of.h
2010-07-13 9:42 [PATCH] sparc: move is_root_node from private header to of.h Andres Salomon
@ 2010-07-12 15:53 ` Grant Likely
2010-07-13 20:05 ` Andres Salomon
0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2010-07-12 15:53 UTC (permalink / raw)
To: Andres Salomon; +Cc: devicetree-discuss, sparclinux, linux-kernel, davem
On Tue, Jul 13, 2010 at 3:42 AM, Andres Salomon <dilinger@queued.net> wrote:
>
> Make is_root_node available for all archs to use, as it's not PROM-specific.
> Also rename it to of_is_root_node, and a few other minor changes for
> style/consistency.
>
> Signed-off-by: Andres Salomon <dilinger@queued.net>
> ---
> arch/sparc/kernel/prom.h | 8 --------
> arch/sparc/kernel/prom_64.c | 6 +++---
> arch/sparc/kernel/prom_common.c | 2 +-
> include/linux/of.h | 8 ++++++++
> 4 files changed, 12 insertions(+), 12 deletions(-)
[...]
> diff --git a/include/linux/of.h b/include/linux/of.h
> index a367e19..b38cdf7 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -97,6 +97,14 @@ extern struct device_node *of_node_get(struct device_node *node);
> extern void of_node_put(struct device_node *node);
> #endif
>
> +static inline bool of_is_root_node(const struct device_node *node)
> +{
> + if (!node)
> + return false;
> +
> + return (node->parent == NULL);
> +}
Are you okay if I shorten this to?
+static inline bool of_is_root_node(const struct device_node *node)
+{
+ return (node && (node->parent == NULL));
+}
g.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] sparc: move is_root_node from private header to of.h
2010-07-12 15:53 ` Grant Likely
@ 2010-07-13 20:05 ` Andres Salomon
2010-07-13 4:17 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Andres Salomon @ 2010-07-13 20:05 UTC (permalink / raw)
To: Grant Likely; +Cc: devicetree-discuss, sparclinux, linux-kernel, davem
On Mon, 12 Jul 2010 09:53:04 -0600
Grant Likely <grant.likely@secretlab.ca> wrote:
> On Tue, Jul 13, 2010 at 3:42 AM, Andres Salomon <dilinger@queued.net>
> wrote:
> >
> > Make is_root_node available for all archs to use, as it's not
> > PROM-specific. Also rename it to of_is_root_node, and a few other
> > minor changes for style/consistency.
> >
> > Signed-off-by: Andres Salomon <dilinger@queued.net>
> > ---
> > arch/sparc/kernel/prom.h | 8 --------
> > arch/sparc/kernel/prom_64.c | 6 +++---
> > arch/sparc/kernel/prom_common.c | 2 +-
> > include/linux/of.h | 8 ++++++++
> > 4 files changed, 12 insertions(+), 12 deletions(-)
> [...]
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index a367e19..b38cdf7 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -97,6 +97,14 @@ extern struct device_node *of_node_get(struct
> > device_node *node); extern void of_node_put(struct device_node
> > *node); #endif
> >
> > +static inline bool of_is_root_node(const struct device_node *node)
> > +{
> > + if (!node)
> > + return false;
> > +
> > + return (node->parent == NULL);
> > +}
>
> Are you okay if I shorten this to?
>
> +static inline bool of_is_root_node(const struct device_node *node)
> +{
> + return (node && (node->parent == NULL));
> +}
>
> g.
It's fine with me.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] sparc: move is_root_node from private header to of.h
2010-07-13 20:05 ` Andres Salomon
@ 2010-07-13 4:17 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-07-13 4:17 UTC (permalink / raw)
To: dilinger; +Cc: grant.likely, devicetree-discuss, sparclinux, linux-kernel
From: Andres Salomon <dilinger@queued.net>
Date: Tue, 13 Jul 2010 20:05:41 +0000
> On Mon, 12 Jul 2010 09:53:04 -0600
> Grant Likely <grant.likely@secretlab.ca> wrote:
>
>> On Tue, Jul 13, 2010 at 3:42 AM, Andres Salomon <dilinger@queued.net>
>> wrote:
>> >
>> > Make is_root_node available for all archs to use, as it's not
>> > PROM-specific. Also rename it to of_is_root_node, and a few other
>> > minor changes for style/consistency.
>> >
>> > Signed-off-by: Andres Salomon <dilinger@queued.net>
>> > ---
>> > arch/sparc/kernel/prom.h | 8 --------
>> > arch/sparc/kernel/prom_64.c | 6 +++---
>> > arch/sparc/kernel/prom_common.c | 2 +-
>> > include/linux/of.h | 8 ++++++++
>> > 4 files changed, 12 insertions(+), 12 deletions(-)
>> [...]
>> > diff --git a/include/linux/of.h b/include/linux/of.h
>> > index a367e19..b38cdf7 100644
>> > --- a/include/linux/of.h
>> > +++ b/include/linux/of.h
>> > @@ -97,6 +97,14 @@ extern struct device_node *of_node_get(struct
>> > device_node *node); extern void of_node_put(struct device_node
>> > *node); #endif
>> >
>> > +static inline bool of_is_root_node(const struct device_node *node)
>> > +{
>> > + if (!node)
>> > + return false;
>> > +
>> > + return (node->parent == NULL);
>> > +}
>>
>> Are you okay if I shorten this to?
>>
>> +static inline bool of_is_root_node(const struct device_node *node)
>> +{
>> + return (node && (node->parent == NULL));
>> +}
>>
>> g.
>
> It's fine with me.
>
Me too:
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-13 4:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-13 9:42 [PATCH] sparc: move is_root_node from private header to of.h Andres Salomon
2010-07-12 15:53 ` Grant Likely
2010-07-13 20:05 ` Andres Salomon
2010-07-13 4:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox