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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 08, 2009 at 10:37:38PM -0700, David Miller wrote:
> 
> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
> ---
>  arch/sparc/include/asm/prom.h |    1 +
>  arch/sparc/kernel/prom_64.c   |  235 ++++++++++++++++++++++-------------------
>  2 files changed, 127 insertions(+), 109 deletions(-)
> 
> diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
> index 900d447..1b15212 100644
> --- a/arch/sparc/include/asm/prom.h
> +++ b/arch/sparc/include/asm/prom.h
> @@ -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)
> diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
> index ca55c70..04b518d 100644
> --- a/arch/sparc/kernel/prom_64.c
> +++ b/arch/sparc/kernel/prom_64.c
> @@ -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);
> -			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
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux