From patchwork Wed Dec 8 19:29:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Saxena X-Patchwork-Id: 74775 X-Patchwork-Delegate: grant.likely@secretlab.ca Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id ADF66B8128 for ; Thu, 9 Dec 2010 07:05:23 +1100 (EST) Received: from relay1.mentorg.com (relay1.mentorg.com [192.94.38.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "relay1.mentorg.com", Issuer "Entrust Certification Authority - L1B" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8644CB7624 for ; Thu, 9 Dec 2010 07:04:34 +1100 (EST) Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1PQPhy-0000iq-Fz from Deepak_Saxena@mentor.com ; Wed, 08 Dec 2010 11:29:46 -0800 Received: from na2-mail.mgc.mentorg.com ([134.86.114.213]) by svr-orw-fem-01.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 8 Dec 2010 11:29:45 -0800 Received: from mentor.com ([172.30.3.85]) by na2-mail.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 8 Dec 2010 12:29:45 -0700 Received: by mentor.com (Postfix, from userid 1000) id A49F6F60AF; Wed, 8 Dec 2010 11:29:44 -0800 (PST) Date: Wed, 8 Dec 2010 11:29:44 -0800 From: Deepak Saxena To: devicetree-discuss@ozlabs.org Subject: [PATCH 3/5] of/device: Make of_get_next_child() check status properties Message-ID: <20101208192944.GE32473@mentor.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-OriginalArrivalTime: 08 Dec 2010 19:29:45.0796 (UTC) FILETIME=[45495040:01CB970E] Cc: linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org We only return the next child if the device is available. Signed-off-by: Hollis Blanchard Signed-off-by: Deepak Saxena --- drivers/of/base.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 5d269a4..81b2601 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -321,6 +321,8 @@ struct device_node *of_get_next_parent(struct device_node *node) * * Returns a node pointer with refcount incremented, use * of_node_put() on it when done. + * + * Does not return nodes marked unavailable by a status property. */ struct device_node *of_get_next_child(const struct device_node *node, struct device_node *prev) @@ -330,7 +332,7 @@ struct device_node *of_get_next_child(const struct device_node *node, read_lock(&devtree_lock); next = prev ? prev->sibling : node->child; for (; next; next = next->sibling) - if (of_node_get(next)) + if (of_device_is_available(next) && of_node_get(next)) break; of_node_put(prev); read_unlock(&devtree_lock);