From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Tony Breeds <tony@bakeyournoodle.com>
Cc: Olof Johansson <olof@lixom.net>,
linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
Jan-Bernd Themann <themann@de.ibm.com>
Subject: Re: [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible.
Date: Thu, 20 Mar 2008 20:41:00 +1100 [thread overview]
Message-ID: <1206006060.8420.5.camel@pasglop> (raw)
In-Reply-To: <63cdefde19cb2a4adc17ed771f21261673428ce7.1205987625.git.tony@bakeyournoodle.com>
On Thu, 2008-03-20 at 15:33 +1100, Tony Breeds wrote:
> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
> ---
What about a comment ? :-)
> arch/powerpc/kernel/prom.c | 21 ++++++++++++++-------
> include/asm-powerpc/prom.h | 2 ++
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index eac97f4..f73e18b 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -205,25 +205,32 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
> } while(1);
> }
>
> -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> +int __init of_flat_dt_search(unsigned long node, const char *str,
> + const char *prop_name)
> {
> - const char* cp;
> - unsigned long cplen, l;
> + const char *cp;
> + unsigned long plen, l;
>
> - cp = of_get_flat_dt_prop(node, "compatible", &cplen);
> + cp = of_get_flat_dt_prop(node, prop_name, &plen);
> if (cp == NULL)
> return 0;
> - while (cplen > 0) {
> - if (strncasecmp(cp, compat, strlen(compat)) == 0)
> + while (plen > 0) {
> + if (strncasecmp(cp, str, strlen(str)) == 0)
> return 1;
> l = strlen(cp) + 1;
> cp += l;
> - cplen -= l;
> + plen -= l;
> }
>
> return 0;
> }
>
> +int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> +{
> +
> + return of_flat_dt_search(node, compat, "compatible");
> +}
> +
> static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> unsigned long align)
> {
> diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
> index 78b7b0d..7b587f1 100644
> --- a/include/asm-powerpc/prom.h
> +++ b/include/asm-powerpc/prom.h
> @@ -134,6 +134,8 @@ extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
> void *data);
> extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
> unsigned long *size);
> +extern int __init of_flat_dt_search(unsigned long node, const char *str,
> + const char *prop_name);
> extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
> extern unsigned long __init of_get_flat_dt_root(void);
>
prev parent reply other threads:[~2008-03-20 10:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-20 4:33 [PATCH 1/2] Implement of_flat_dt_search() and use it for of_flat_dt_is_compatible Tony Breeds
2008-03-20 4:33 ` [PATCH 2/2] Force 4K IOPages when eHEA is present in the machine Tony Breeds
2008-03-20 7:18 ` Nathan Lynch
2008-03-20 9:23 ` Paul Mackerras
2008-03-20 9:41 ` Benjamin Herrenschmidt [this message]
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=1206006060.8420.5.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=olof@lixom.net \
--cc=paulus@samba.org \
--cc=themann@de.ibm.com \
--cc=tony@bakeyournoodle.com \
/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;
as well as URLs for NNTP newsgroup(s).