diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-09-23 13:17:37 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-10-08 12:22:52 -0400 |
commit | 7de36cd5742be100641684349cd7a70715b8cf8d (patch) | |
tree | 6e1e64b869003ab115de70ee43ef2db401e76b53 | |
parent | 79e3f6ce167ff429084bfdd839e30d7983011108 (diff) |
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: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r-- | drivers/pci/host/pci-mvebu.c | 11 |
1 files 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) | |||
933 | struct mvebu_pcie *pcie; | 933 | struct mvebu_pcie *pcie; |
934 | struct device_node *np = pdev->dev.of_node; | 934 | struct device_node *np = pdev->dev.of_node; |
935 | struct device_node *child; | 935 | struct device_node *child; |
936 | int i, ret; | 936 | int num, i, ret; |
937 | 937 | ||
938 | pcie = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pcie), | 938 | pcie = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pcie), |
939 | GFP_KERNEL); | 939 | GFP_KERNEL); |
@@ -969,14 +969,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev) | |||
969 | return ret; | 969 | return ret; |
970 | } | 970 | } |
971 | 971 | ||
972 | i = 0; | 972 | num = of_get_available_child_count(pdev->dev.of_node); |
973 | for_each_child_of_node(pdev->dev.of_node, child) { | ||
974 | if (!of_device_is_available(child)) | ||
975 | continue; | ||
976 | i++; | ||
977 | } | ||
978 | 973 | ||
979 | pcie->ports = devm_kzalloc(&pdev->dev, i * | 974 | pcie->ports = devm_kzalloc(&pdev->dev, num * |
980 | sizeof(struct mvebu_pcie_port), | 975 | sizeof(struct mvebu_pcie_port), |
981 | GFP_KERNEL); | 976 | GFP_KERNEL); |
982 | if (!pcie->ports) | 977 | if (!pcie->ports) |