rpcd: iwinfo plugin fixes
[openwrt.git] / target / linux / bcm53xx / patches-4.1 / 031-0001-PCI-iproc-Directly-add-PCI-resources.patch
1 From 18c4342aa56d70176eea85021e6fe8f6f8f39c7b Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 24 May 2015 22:37:02 +0200
4 Subject: [PATCH 1/2] PCI: iproc: Directly add PCI resources
5
6 The struct iproc_pcie.resources member was pointing to a stack variable and
7 is invalid after the registration function returned.
8
9 Remove this pointer and add a parameter to the function.
10
11 Tested-by: Ray Jui <rjui@broadcom.com>
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
13 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
14 Reviewed-by: Ray Jui <rjui@broadcom.com>
15 ---
16  drivers/pci/host/pcie-iproc-bcma.c     | 4 +---
17  drivers/pci/host/pcie-iproc-platform.c | 4 +---
18  drivers/pci/host/pcie-iproc.c          | 4 ++--
19  drivers/pci/host/pcie-iproc.h          | 3 +--
20  4 files changed, 5 insertions(+), 10 deletions(-)
21
22 --- a/drivers/pci/host/pcie-iproc-bcma.c
23 +++ b/drivers/pci/host/pcie-iproc-bcma.c
24 @@ -62,11 +62,9 @@ static int iproc_pcie_bcma_probe(struct
25         res_mem.flags = IORESOURCE_MEM;
26         pci_add_resource(&res, &res_mem);
27  
28 -       pcie->resources = &res;
29 -
30         pcie->map_irq = iproc_pcie_bcma_map_irq;
31  
32 -       ret = iproc_pcie_setup(pcie);
33 +       ret = iproc_pcie_setup(pcie, &res);
34         if (ret) {
35                 dev_err(pcie->dev, "PCIe controller setup failed\n");
36                 return ret;
37 --- a/drivers/pci/host/pcie-iproc-platform.c
38 +++ b/drivers/pci/host/pcie-iproc-platform.c
39 @@ -69,11 +69,9 @@ static int iproc_pcie_pltfm_probe(struct
40                 return ret;
41         }
42  
43 -       pcie->resources = &res;
44 -
45         pcie->map_irq = of_irq_parse_and_map_pci;
46  
47 -       ret = iproc_pcie_setup(pcie);
48 +       ret = iproc_pcie_setup(pcie, &res);
49         if (ret) {
50                 dev_err(pcie->dev, "PCIe controller setup failed\n");
51                 return ret;
52 --- a/drivers/pci/host/pcie-iproc.c
53 +++ b/drivers/pci/host/pcie-iproc.c
54 @@ -183,7 +183,7 @@ static void iproc_pcie_enable(struct ipr
55         writel(SYS_RC_INTX_MASK, pcie->base + SYS_RC_INTX_EN);
56  }
57  
58 -int iproc_pcie_setup(struct iproc_pcie *pcie)
59 +int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
60  {
61         int ret;
62         struct pci_bus *bus;
63 @@ -211,7 +211,7 @@ int iproc_pcie_setup(struct iproc_pcie *
64         pcie->sysdata.private_data = pcie;
65  
66         bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
67 -                                 &pcie->sysdata, pcie->resources);
68 +                                 &pcie->sysdata, res);
69         if (!bus) {
70                 dev_err(pcie->dev, "unable to create PCI root bus\n");
71                 ret = -ENOMEM;
72 --- a/drivers/pci/host/pcie-iproc.h
73 +++ b/drivers/pci/host/pcie-iproc.h
74 @@ -29,7 +29,6 @@
75  struct iproc_pcie {
76         struct device *dev;
77         void __iomem *base;
78 -       struct list_head *resources;
79         struct pci_sys_data sysdata;
80         struct pci_bus *root_bus;
81         struct phy *phy;
82 @@ -37,7 +36,7 @@ struct iproc_pcie {
83         int (*map_irq)(const struct pci_dev *, u8, u8);
84  };
85  
86 -int iproc_pcie_setup(struct iproc_pcie *pcie);
87 +int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
88  int iproc_pcie_remove(struct iproc_pcie *pcie);
89  
90  #endif /* _PCIE_IPROC_H */