From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: barebox@lists.infradead.org
Subject: [PATCH] OF: base: fix iterator in of_get_next_available_child
Date: Thu, 4 Jul 2013 01:18:41 +0200 [thread overview]
Message-ID: <1372893521-4890-1-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
of_get_next_available_child does not iterate but always tries the
same node over and over again. This first prepares the entry and
then uses list_for_each_entry_continue, instead of for_each_child_of_node
before.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Note: This should be the last iterator fix required. I have tested all
for_each_ helpers. Thanks for Hiroki for reporting this and the initial
quick fix.
Unfortunately, I found this one after I sent the patch set.
Cc: barebox@lists.infradead.org
Cc: Hiroki Nishimoto <hiroki.nishimoto.if@gmail.com>
---
drivers/of/base.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 0500c86..8c6dbcf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1352,7 +1352,8 @@ EXPORT_SYMBOL(of_get_parent);
struct device_node *of_get_next_available_child(const struct device_node *node,
struct device_node *prev)
{
- for_each_child_of_node(node, prev)
+ prev = list_prepare_entry(prev, &node->children, parent_list);
+ list_for_each_entry_continue(prev, &node->children, parent_list)
if (of_device_is_available(prev))
return prev;
return NULL;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2013-07-03 23:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1372893521-4890-1-git-send-email-sebastian.hesselbarth@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=barebox@lists.infradead.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