: sparc64: Refactor OBP cpu scanning code using an iterator.
David Miller
maintainerPATCH 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
@@ -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
Quoted 44 lines · David Miller
Signed-off-by David S. Miller <[email protected]>--- 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@@ -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@@ -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
David Miller
maintainerFrom: 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!