From: David Miller <davem@davemloft.net>
To: michael@ellerman.id.au
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/4] Add helpers for finding a device node which as a certain property
Date: Wed, 12 Nov 2008 22:46:48 -0800 (PST) [thread overview]
Message-ID: <20081112.224648.106631825.davem@davemloft.net> (raw)
In-Reply-To: <2743c30c538d24a0befee055bd6e0fcd746d0e82.1226550015.git.michael@ellerman.id.au>
From: Michael Ellerman <michael@ellerman.id.au>
Date: Thu, 13 Nov 2008 15:20:35 +1100 (EST)
> + np = from ? from->allnext : allnodes;
> + for (; np; np = np->allnext) {
> + for (pp = np->properties; pp != 0; pp = pp->next) {
> + if (of_prop_cmp(pp->name, prop_name) == 0) {
> + goto out;
> + }
> + }
> + }
We're starting to duplicate a lot of code in this file.
Perhaps split out the locked section of of_find_proeprty() into
a __of_find_property() and use that here and in of_find_property()
as well?
staitc struct property *__of_find_property(const struct device_node *np,
const char *name,
int *lenp)
{
struct property *pp;
for (pp = np->properties; pp != 0; pp = pp->next) {
if (of_prop_cmp(pp->name, name) == 0) {
if (lenp != 0)
*lenp = pp->length;
break;
}
}
return pp;
}
struct property *of_find_property(const struct device_node *np,
const char *name,
int *lenp)
{
struct property *pp;
if (!np)
return NULL;
read_lock(&devtree_lock);
pp = __of_find_property(np, name, lenp);
read_unlock(&devtree_lock);
return pp;
}
EXPORT_SYMBOL(of_find_property);
next prev parent reply other threads:[~2008-11-13 6:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-13 4:20 [PATCH 1/4] Add helpers for finding a device node which as a certain property Michael Ellerman
2008-11-13 4:20 ` [PATCH 2/4] Use for_each_node_with_property() in of_irq_map_init() Michael Ellerman
2008-11-13 4:20 ` [PATCH 3/4] Use of_find_node_with_property() in cell_iommu_fixed_mapping_init() Michael Ellerman
2008-11-13 4:20 ` [PATCH 4/4] Use of_find_node_with_property() in pmac_setup_arch() Michael Ellerman
2008-11-13 9:27 ` Benjamin Herrenschmidt
2008-11-13 6:46 ` David Miller [this message]
2008-11-13 6:49 ` [PATCH 1/4] Add helpers for finding a device node which as a certain property Michael Ellerman
2008-11-13 7:11 ` Michael Ellerman
2008-11-13 7:31 ` 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=20081112.224648.106631825.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=michael@ellerman.id.au \
/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).