提交 7de36cd5 编写于 作者: R Russell King 提交者: Bjorn Helgaas

PCI: mvebu: Use of_get_available_child_count()

Rather than open-coding of_get_available_child_count(), use the provided
helper instead.

Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> (Armada XP GP)
Tested-by: Andrew Lunn <andrew@lunn.ch> (Kirkwood DIR665)
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
上级 79e3f6ce
...@@ -933,7 +933,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) ...@@ -933,7 +933,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
struct mvebu_pcie *pcie; struct mvebu_pcie *pcie;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct device_node *child; struct device_node *child;
int i, ret; int num, i, ret;
pcie = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pcie), pcie = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pcie),
GFP_KERNEL); GFP_KERNEL);
...@@ -969,14 +969,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev) ...@@ -969,14 +969,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
return ret; return ret;
} }
i = 0; num = of_get_available_child_count(pdev->dev.of_node);
for_each_child_of_node(pdev->dev.of_node, child) {
if (!of_device_is_available(child))
continue;
i++;
}
pcie->ports = devm_kzalloc(&pdev->dev, i * pcie->ports = devm_kzalloc(&pdev->dev, num *
sizeof(struct mvebu_pcie_port), sizeof(struct mvebu_pcie_port),
GFP_KERNEL); GFP_KERNEL);
if (!pcie->ports) if (!pcie->ports)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册