From: Dong Aisheng <b29396@freescale.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linus.walleij@stericsson.com>, <s.hauer@pengutronix.de>,
<shawn.guo@freescale.com>, <kernel@pengutronix.de>,
<grant.likely@secretlab.ca>, <rob.herring@calxeda.com>
Subject: [RFC PATCH v2 1/4] dt: add of_get_child_number helper function
Date: Thu, 15 Dec 2011 00:03:39 +0800 [thread overview]
Message-ID: <1323878622-26602-2-git-send-email-b29396@freescale.com> (raw)
In-Reply-To: <1323878622-26602-1-git-send-email-b29396@freescale.com>
From: Dong Aisheng <dong.aisheng@linaro.org>
Currently most code to get child number in kernel are almost same,
add a helper to implement this function for dt to use.
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
---
include/linux/of.h | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/linux/of.h b/include/linux/of.h
index 4948552..09d53dc 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -189,6 +189,18 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
for (child = of_get_next_child(parent, NULL); child != NULL; \
child = of_get_next_child(parent, child))
+static inline int of_get_child_number(struct device_node *np)
+
+{
+ struct device_node *child = NULL;
+ int num = 0;
+
+ while((child = of_get_next_child(np, child)))
+ num++;
+
+ return num;
+}
+
extern struct device_node *of_find_node_with_property(
struct device_node *from, const char *prop_name);
#define for_each_node_with_property(dn, prop_name) \
@@ -262,6 +274,11 @@ static inline bool of_have_populated_dt(void)
#define for_each_child_of_node(parent, child) \
while (0)
+static inline int of_get_child_number(struct device_node *np)
+{
+ return -ENOSYS;
+}
+
static inline int of_device_is_compatible(const struct device_node *device,
const char *name)
{
--
1.7.0.4
next prev parent reply other threads:[~2011-12-14 15:52 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 16:03 [RFC PATCH v2 0/4] pinctrl: imx: add pinnmux support Dong Aisheng
2011-12-14 16:03 ` Dong Aisheng [this message]
2011-12-14 18:04 ` [RFC PATCH v2 1/4] dt: add of_get_child_number helper function Rob Herring
2011-12-14 21:41 ` Grant Likely
2011-12-15 5:49 ` Dong Aisheng-B29396
2011-12-14 16:03 ` [RFC PATCH v2 2/4] pinctrl: imx: add pinmux imx driver Dong Aisheng
2011-12-14 16:01 ` Fabio Estevam
2011-12-15 5:48 ` Dong Aisheng-B29396
2011-12-14 18:00 ` Linus Walleij
2011-12-14 21:47 ` Grant Likely
2011-12-15 7:38 ` Dong Aisheng-B29396
2011-12-15 7:35 ` Dong Aisheng-B29396
2011-12-15 8:18 ` Shawn Guo
2011-12-15 8:16 ` Dong Aisheng-B29396
2011-12-14 16:03 ` [RFC PATCH v2 3/4] ARM: imx6q: using pinmux subsystem Dong Aisheng
2011-12-14 18:02 ` Linus Walleij
2011-12-15 7:36 ` Dong Aisheng-B29396
2011-12-14 16:03 ` [RFC PATCH v2 4/4] mmc: sdhci-esdhc-imx: " Dong Aisheng
2011-12-14 17:46 ` Linus Walleij
2011-12-14 21:11 ` Sascha Hauer
2011-12-14 22:15 ` Linus Walleij
2011-12-15 7:05 ` Shawn Guo
2011-12-15 8:26 ` Linus Walleij
2011-12-15 8:59 ` Dong Aisheng-B29396
2011-12-15 9:33 ` Sascha Hauer
2011-12-15 11:21 ` Shawn Guo
2011-12-15 11:28 ` Dong Aisheng-B29396
2011-12-15 11:53 ` Shawn Guo
2011-12-15 11:54 ` Sascha Hauer
2011-12-15 12:17 ` Shawn Guo
2011-12-15 13:23 ` Sascha Hauer
2011-12-15 14:00 ` Shawn Guo
2011-12-15 16:34 ` Sascha Hauer
2011-12-15 9:03 ` Shawn Guo
2011-12-15 7:23 ` Dong Aisheng-B29396
2011-12-15 8:28 ` Linus Walleij
2011-12-15 8:55 ` Dong Aisheng-B29396
2011-12-15 9:32 ` Sascha Hauer
2011-12-15 10:40 ` Dong Aisheng-B29396
2011-12-14 17:40 ` [RFC PATCH v2 0/4] pinctrl: imx: add pinnmux support Linus Walleij
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=1323878622-26602-2-git-send-email-b29396@freescale.com \
--to=b29396@freescale.com \
--cc=grant.likely@secretlab.ca \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@freescale.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
all inboxes | Powered by JetHome®