From: Sam Ravnborg <sam@ravnborg.org>
To: David Miller <davem@davemloft.net>
Cc: tj@kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/12]: sparc64: Refactor OBP cpu scanning code using an iterator.
Date: Thu, 9 Apr 2009 08:29:24 +0200 [thread overview]
Message-ID: <20090409062924.GA14255@uranus.ravnborg.org> (raw)
In-Reply-To: <20090408.223738.63750701.davem@davemloft.net>
On Wed, Apr 08, 2009 at 10:37:38PM -0700, David Miller wrote:
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> 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
next prev parent reply other threads:[~2009-04-09 6:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-09 5:37 David Miller
2009-04-09 6:29 ` Sam Ravnborg [this message]
2009-05-27 5:35 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090409062924.GA14255@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®