Skip to contentSkip to conversation

sparc: move is_root_node from private header to of.h

PATCH In review Andres Salomon 4 participants 6 messages Jul 12, 2010 – Jul 13, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: move is_root_node from private header to of.h

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.

---
 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(-)
arch/sparc/kernel/prom.h +0 -8
index a8591ef..eeb04a7 100644
@@ -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);
 
arch/sparc/kernel/prom_64.c +3 -3
index fb06ac2..dd5e487 100644
@@ -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),
arch/sparc/kernel/prom_common.c +1 -1
index 57ac9e2..40123a6 100644
@@ -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++;
 	}
include/linux/of.h +8 -0
index a367e19..b38cdf7 100644
@@ -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
  */
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 12 lines · Andres Salomon

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.

---
 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(-)

[...]

Quoted 5 lines
include/linux/of.h +0 -0
index a367e19..b38cdf7 100644

include/linux/of.h extern struct device_node *of_node_get(struct device_node *node); · line 106

Quoted 10 lines
include/linux/of.h +7 -0
@@ -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.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 38 lines · On Mon, 12 Jul 2010 09:53:04 -0600 Grant Likely <[email protected]>…
Quoted 12 lines · Andres Salomon

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.

---
 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(-)

[...]

Quoted 8 lines
include/linux/of.h +0 -0
index a367e19..b38cdf7 100644
@@ -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

include/linux/of.h extern struct device_node *of_node_get(struct device_node *node); · line 106

Quoted 7 lines
include/linux/of.h +7 -0
+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?

include/linux/of.h +4 -0
+static inline bool of_is_root_node(const struct device_node *node)
+{
+       return (node && (node->parent == NULL));
+}
Quoted 1 line

g.

It's fine with me.

maintainer Acked-by
#3 lore raw

From: Andres Salomon <[email protected]>
Date: Tue, 13 Jul 2010 20:05:41 +0000

Quoted 36 lines
Quoted 33 lines · On Mon, 12 Jul 2010 09:53:04 -0600 Grant Likely <[email protected]>…
Quoted 12 lines · Andres Salomon

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.

---
 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(-)

[...]

Quoted 8 lines
include/linux/of.h +0 -0
index a367e19..b38cdf7 100644
@@ -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

include/linux/of.h extern struct device_node *of_node_get(struct device_node *node); · line 106

Quoted 7 lines
include/linux/of.h +7 -0
+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?

Quoted 9 lines
Quoted 6 lines
include/linux/of.h +4 -0
+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:

A message that is not in the archive (sent off-list or not yet received): AANLkTinVpBjQQa93DZ17ULQdspDByGV8h037bVJ2qxGC-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 38 lines · On Mon, 12 Jul 2010 09:53:04 -0600 Grant Likely…
Quoted 12 lines · Andres Salomon

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.

---
 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(-)

[...]

Quoted 8 lines
include/linux/of.h +0 -0
index a367e19..b38cdf7 100644
@@ -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

include/linux/of.h extern struct device_node *of_node_get(struct device_node *node); · line 106

Quoted 7 lines
include/linux/of.h +7 -0
+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?

include/linux/of.h +4 -0
+static inline bool of_is_root_node(const struct device_node *node)
+{
+       return (node && (node->parent == NULL));
+}
Quoted 1 line

g.

It's fine with me.

#6 lore raw
In reply to Grant Likely
Quoted 38 lines · On Mon, 12 Jul 2010 09:53:04 -0600 Grant Likely <[email protected]>…
Quoted 12 lines · Andres Salomon

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.

---
 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(-)

[...]

Quoted 8 lines
include/linux/of.h +0 -0
index a367e19..b38cdf7 100644
@@ -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

include/linux/of.h extern struct device_node *of_node_get(struct device_node *node); · line 106

Quoted 7 lines
include/linux/of.h +7 -0
+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?

include/linux/of.h +4 -0
+static inline bool of_is_root_node(const struct device_node *node)
+{
+       return (node && (node->parent == NULL));
+}
Quoted 1 line

g.

It's fine with me.