From patchwork Wed Sep 23 17:17:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 521769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CC219140187 for ; Thu, 24 Sep 2015 03:17:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=arm.linux.org.uk header.i=@arm.linux.org.uk header.b=JQAnM13N; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755681AbbIWRRo (ORCPT ); Wed, 23 Sep 2015 13:17:44 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:42276 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754598AbbIWRRn (ORCPT ); Wed, 23 Sep 2015 13:17:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=vv61Ro9oT5VgUnn/rJlQlBW4BKLcodJ/UzgpLu2SCRo=; b=JQAnM13Nozmyyf3KgucTn0C++QFJb1pCXhTSXnoLYqsx84AzGtUjjRSeZHbAIq6E7g1N+UCkoi1tI+7PmbRtkU5lUkqqCgLq/Gfj/vNG/VWrBel0qqxyZV86GC/Exv7q1p/n4lSr9mclkn947PHeZIv3blQW9vrC28FzoE/nDQo=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:44483 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Zenfn-0001Ej-9V; Wed, 23 Sep 2015 18:17:39 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Zenfl-0004dB-HA; Wed, 23 Sep 2015 18:17:37 +0100 In-Reply-To: <20150923171706.GL21084@n2100.arm.linux.org.uk> References: <20150923171706.GL21084@n2100.arm.linux.org.uk> From: Russell King To: Jason Cooper , Thomas Petazzoni Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] pci: mvebu: use of_get_available_child_count() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Wed, 23 Sep 2015 18:17:37 +0100 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Rather than open-coding of_get_available_child_count(), use the provided helper instead. Signed-off-by: Russell King --- drivers/pci/host/pci-mvebu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 0d9f3eae4315..0ed14f477bf8 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -933,7 +933,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) struct mvebu_pcie *pcie; struct device_node *np = pdev->dev.of_node; struct device_node *child; - int i, ret; + int num, i, ret; pcie = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pcie), GFP_KERNEL); @@ -969,14 +969,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev) return ret; } - i = 0; - for_each_child_of_node(pdev->dev.of_node, child) { - if (!of_device_is_available(child)) - continue; - i++; - } + num = of_get_available_child_count(pdev->dev.of_node); - pcie->ports = devm_kzalloc(&pdev->dev, i * + pcie->ports = devm_kzalloc(&pdev->dev, num * sizeof(struct mvebu_pcie_port), GFP_KERNEL); if (!pcie->ports)