Skip to contentSkip to conversation

: sparc64: Refactor OBP cpu scanning code using an iterator.

PATCH In review David Miller 2 participants 3 messages Apr 9, 2009 – May 27, 2009 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 5/12 : sparc64: Refactor OBP cpu scanning code using an iterator.

---
 arch/sparc/include/asm/prom.h |    1 +
 arch/sparc/kernel/prom_64.c   |  235 ++++++++++++++++++++++-------------------
 2 files changed, 127 insertions(+), 109 deletions(-)
arch/sparc/include/asm/prom.h +1 -0
index 900d447..1b15212 100644
@@ -86,6 +86,7 @@ extern int of_node_to_nid(struct device_node *dp);
 #endif
 
 extern void prom_build_devicetree(void);
+extern void of_populate_present_mask(void);
 
 /* Dummy ref counting routines - to be implemented later */
 static inline struct device_node *of_node_get(struct device_node *node)
arch/sparc/kernel/prom_64.c +113 -94

252 lines not on this page · raw message

Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 44 lines · David Miller
---
 arch/sparc/include/asm/prom.h |    1 +
 arch/sparc/kernel/prom_64.c   |  235 ++++++++++++++++++++++-------------------
 2 files changed, 127 insertions(+), 109 deletions(-)
arch/sparc/include/asm/prom.h +1 -0
index 900d447..1b15212 100644
@@ -86,6 +86,7 @@ extern int of_node_to_nid(struct device_node *dp);
 #endif
 
 extern void prom_build_devicetree(void);
+extern void of_populate_present_mask(void);
 
 /* Dummy ref counting routines - to be implemented later */
 static inline struct device_node *of_node_get(struct device_node *node)
arch/sparc/kernel/prom_64.c +0 -17
index ca55c70..04b518d 100644
@@ -374,75 +374,26 @@ static const char *get_mid_prop(void)
 	return (tlb_type == spitfire ? "upa-portid" : "portid");
 }
 
-struct device_node *of_find_node_by_cpuid(int cpuid)
-{
-	struct device_node *dp;
-	const char *mid_prop = get_mid_prop();
-
-	for_each_node_by_type(dp, "cpu") {
-		int id = of_getintprop_default(dp, mid_prop, -1);
-		const char *this_mid_prop = mid_prop;
-
-		if (id < 0) {
-			this_mid_prop = "cpuid";
-			id = of_getintprop_default(dp, this_mid_prop, -1);
-		}
-
-		if (id < 0) {
-			prom_printf("OF: Serious problem, cpu lacks "
-				    "%s property", this_mid_prop);

arch/sparc/kernel/prom_64.c static const char *get_mid_prop(void) · line 377

Quoted 10 lines
arch/sparc/kernel/prom_64.c +1 -9
-			prom_halt();
-		}
-		if (cpuid == id)
-			return dp;
-	}
-	return NULL;
-}
-
-void __init of_fill_in_cpu_data(void)
+static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, void *), void *arg)

You never pass a "void *" as argument to this iterator. It seems cleaner to use a long or even an int as this is closer to the typical usage, and one can always pass a '0' when the argument is not used.

I have not looked through all patches yet so it may come later.

Sam

author maintainer
#2 lore raw

From: Sam Ravnborg <[email protected]>
Date: Thu, 9 Apr 2009 08:29:24 +0200

Quoted 4 lines

You never pass a "void *" as argument to this iterator. It seems cleaner to use a long or even an int as this is closer to the typical usage, and one can always pass a '0' when the argument is not used.

I've changed this to an 'int' while respinning this patch.

Thanks!