From patchwork Fri Aug 23 03:04:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 269268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3A2042C0099 for ; Fri, 23 Aug 2013 13:05:01 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VChgE-0002Qp-8l; Fri, 23 Aug 2013 03:04:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VChgC-0007tO-1q; Fri, 23 Aug 2013 03:04:52 +0000 Received: from mail-bk0-x231.google.com ([2a00:1450:4008:c01::231]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VChg9-0007sa-I6 for linux-mtd@lists.infradead.org; Fri, 23 Aug 2013 03:04:50 +0000 Received: by mail-bk0-f49.google.com with SMTP id r7so33236bkg.8 for ; Thu, 22 Aug 2013 20:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=bGZETE/fkwrkDYU7un3kuGaEPTM1kXpfU8piozw1Zko=; b=Qv5WI1W0QlPiDPppFR0Txp9+1a6Z+V0Tv6adgyhwGh8Pi49BbrBpYjGvJARBCwUDSx lk7kFGUWhZABDH3dZctB6BlwwkC+nHgQlYsnwldI/KUatNAs8qz5hktvE9/CX0VNCEjd 11tBi5XPZIUegOEr2OuKzIxCG7xeV3mARjs1fNOiM6SkTbhjnkQb/KP7yBMWzw1znmh0 dUh8AZ4RvqG4ZYBxoywF0GOS0SB5/BC+p2lpvjE4+bPYxFUakiYat/oLD2KJ7I34Hv8y Kw+a8I+zXMeYvClvKf3fjmGiNtfJGZNH0H12xjdyT68agwCjwq8CrV2+OoyYavSMaaf7 HRKg== MIME-Version: 1.0 X-Received: by 10.205.120.78 with SMTP id fx14mr13004466bkc.7.1377227067467; Thu, 22 Aug 2013 20:04:27 -0700 (PDT) Received: by 10.205.13.74 with HTTP; Thu, 22 Aug 2013 20:04:27 -0700 (PDT) Date: Fri, 23 Aug 2013 11:04:27 +0800 Message-ID: Subject: [PATCH -next] mtd: ofpart: use for_each_child_of_node() macro From: Wei Yongjun To: dwmw2@infradead.org, grant.likely@linaro.org, rob.herring@calxeda.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130822_230449_786566_D4B2FE59 X-CRM114-Status: GOOD ( 10.17 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (weiyj.lk[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: devicetree@vger.kernel.org, yongjun_wei@trendmicro.com.cn, linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Wei Yongjun Use for_each_child_of_node() macro instead of open coding it. Signed-off-by: Wei Yongjun Acked-by: Huang Shijie --- drivers/mtd/ofpart.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c index 7843a44..d64f8c3 100644 --- a/drivers/mtd/ofpart.c +++ b/drivers/mtd/ofpart.c @@ -43,9 +43,8 @@ static int parse_ofpart_partitions(struct mtd_info *master, return 0; /* First count the subnodes */ - pp = NULL; nr_parts = 0; - while ((pp = of_get_next_child(node, pp))) { + for_each_child_of_node(node, pp) { if (node_has_compatible(pp)) continue; @@ -59,9 +58,8 @@ static int parse_ofpart_partitions(struct mtd_info *master, if (!*pparts) return -ENOMEM; - pp = NULL; i = 0; - while ((pp = of_get_next_child(node, pp))) { + for_each_child_of_node(node, pp) { const __be32 *reg; int len; int a_cells, s_cells;