base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0201-PCI-mvebu-increment-nports-only-for-registered-ports.patch
1 From e619fe9eb65d8064739f16eca2015145ac920f13 Mon Sep 17 00:00:00 2001
2 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
3 Date: Tue, 13 Aug 2013 14:25:21 +0200
4 Subject: [PATCH 201/203] PCI: mvebu: increment nports only for registered
5  ports
6
7 The number of ports is probed by counting the number of available child nodes.
8 Later on, the registration of a port can fail and cause a mismatch between
9 the ->nports counter and registered ports. This patch modifies the counting
10 strategy, to make ->nports represent the number of registered ports instead
11 of the number of available childs.
12
13 Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
14 Signed-off-by: Jason Cooper <jason@lakedaemon.net>
15 ---
16  drivers/pci/host/pci-mvebu.c | 7 ++++---
17  1 file changed, 4 insertions(+), 3 deletions(-)
18
19 --- a/drivers/pci/host/pci-mvebu.c
20 +++ b/drivers/pci/host/pci-mvebu.c
21 @@ -841,13 +841,14 @@ static int __init mvebu_pcie_probe(struc
22                 return ret;
23         }
24  
25 +       i = 0;
26         for_each_child_of_node(pdev->dev.of_node, child) {
27                 if (!of_device_is_available(child))
28                         continue;
29 -               pcie->nports++;
30 +               i++;
31         }
32  
33 -       pcie->ports = devm_kzalloc(&pdev->dev, pcie->nports *
34 +       pcie->ports = devm_kzalloc(&pdev->dev, i *
35                                    sizeof(struct mvebu_pcie_port),
36                                    GFP_KERNEL);
37         if (!pcie->ports)
38 @@ -934,8 +935,8 @@ static int __init mvebu_pcie_probe(struc
39                 i++;
40         }
41  
42 +       pcie->nports = i;
43         mvebu_pcie_msi_enable(pcie);
44 -
45         mvebu_pcie_enable(pcie);
46  
47         return 0;