aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2013-05-25 09:48:31 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-06-05 15:49:36 -0400
commit8b1fce04dc2a2210f050484afa85acc3a81cfbba (patch)
treed790a4d12baf35c9f32cafde8386d505a7576067
parent3c6e6ae770f338ef3e54c5823c21063204f53537 (diff)
PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus)
Use the new pci_alloc_dev(bus) to replace the existing using of alloc_pci_dev(void). [bhelgaas: drop pci_bus ref later in pci_release_dev()] Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: David Airlie <airlied@linux.ie> Cc: Neela Syam Kolli <megaraidlinux@lsi.com> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c3
-rw-r--r--arch/sparc/kernel/pci.c3
-rw-r--r--drivers/char/agp/alpha-agp.c2
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/pci/iov.c8
-rw-r--r--drivers/pci/probe.c5
-rw-r--r--drivers/scsi/megaraid.c2
7 files changed, 13 insertions, 12 deletions
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 2a67e9baa59f..24d01c4eac5c 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -128,7 +128,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
128 const char *type; 128 const char *type;
129 struct pci_slot *slot; 129 struct pci_slot *slot;
130 130
131 dev = alloc_pci_dev(); 131 dev = pci_alloc_dev(bus);
132 if (!dev) 132 if (!dev)
133 return NULL; 133 return NULL;
134 type = of_get_property(node, "device_type", NULL); 134 type = of_get_property(node, "device_type", NULL);
@@ -137,7 +137,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
137 137
138 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type); 138 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
139 139
140 dev->bus = bus;
141 dev->dev.of_node = of_node_get(node); 140 dev->dev.of_node = of_node_get(node);
142 dev->dev.parent = bus->bridge; 141 dev->dev.parent = bus->bridge;
143 dev->dev.bus = &pci_bus_type; 142 dev->dev.bus = &pci_bus_type;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index baf4366e2d6a..e5871fb455b3 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -254,7 +254,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
254 const char *type; 254 const char *type;
255 u32 class; 255 u32 class;
256 256
257 dev = alloc_pci_dev(); 257 dev = pci_alloc_dev(bus);
258 if (!dev) 258 if (!dev)
259 return NULL; 259 return NULL;
260 260
@@ -281,7 +281,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
281 printk(" create device, devfn: %x, type: %s\n", 281 printk(" create device, devfn: %x, type: %s\n",
282 devfn, type); 282 devfn, type);
283 283
284 dev->bus = bus;
285 dev->sysdata = node; 284 dev->sysdata = node;
286 dev->dev.parent = bus->bridge; 285 dev->dev.parent = bus->bridge;
287 dev->dev.bus = &pci_bus_type; 286 dev->dev.bus = &pci_bus_type;
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
index dd84af4d4f7e..199b8e99f7d7 100644
--- a/drivers/char/agp/alpha-agp.c
+++ b/drivers/char/agp/alpha-agp.c
@@ -174,7 +174,7 @@ alpha_core_agp_setup(void)
174 /* 174 /*
175 * Build a fake pci_dev struct 175 * Build a fake pci_dev struct
176 */ 176 */
177 pdev = alloc_pci_dev(); 177 pdev = pci_alloc_dev(NULL);
178 if (!pdev) 178 if (!pdev)
179 return -ENOMEM; 179 return -ENOMEM;
180 pdev->vendor = 0xffff; 180 pdev->vendor = 0xffff;
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 94821ab01c6d..bf5d2477cb77 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -333,7 +333,7 @@ parisc_agp_setup(void __iomem *ioc_hpa, void __iomem *lba_hpa)
333 struct agp_bridge_data *bridge; 333 struct agp_bridge_data *bridge;
334 int error = 0; 334 int error = 0;
335 335
336 fake_bridge_dev = alloc_pci_dev(); 336 fake_bridge_dev = pci_alloc_dev(NULL);
337 if (!fake_bridge_dev) { 337 if (!fake_bridge_dev) {
338 error = -ENOMEM; 338 error = -ENOMEM;
339 goto fail; 339 goto fail;
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index c93071d428f5..2652ca00fae7 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -75,18 +75,20 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
75 struct pci_dev *virtfn; 75 struct pci_dev *virtfn;
76 struct resource *res; 76 struct resource *res;
77 struct pci_sriov *iov = dev->sriov; 77 struct pci_sriov *iov = dev->sriov;
78 struct pci_bus *bus;
78 79
79 virtfn = alloc_pci_dev(); 80 virtfn = pci_alloc_dev(NULL);
80 if (!virtfn) 81 if (!virtfn)
81 return -ENOMEM; 82 return -ENOMEM;
82 83
83 mutex_lock(&iov->dev->sriov->lock); 84 mutex_lock(&iov->dev->sriov->lock);
84 virtfn->bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id)); 85 bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id));
85 if (!virtfn->bus) { 86 if (!bus) {
86 kfree(virtfn); 87 kfree(virtfn);
87 mutex_unlock(&iov->dev->sriov->lock); 88 mutex_unlock(&iov->dev->sriov->lock);
88 return -ENOMEM; 89 return -ENOMEM;
89 } 90 }
91 virtfn->bus = pci_bus_get(bus);
90 virtfn->devfn = virtfn_devfn(dev, id); 92 virtfn->devfn = virtfn_devfn(dev, id);
91 virtfn->vendor = dev->vendor; 93 virtfn->vendor = dev->vendor;
92 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device); 94 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index d47ce1400c26..ed5ce185eed9 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1132,6 +1132,7 @@ static void pci_release_dev(struct device *dev)
1132 pci_dev = to_pci_dev(dev); 1132 pci_dev = to_pci_dev(dev);
1133 pci_release_capabilities(pci_dev); 1133 pci_release_capabilities(pci_dev);
1134 pci_release_of_node(pci_dev); 1134 pci_release_of_node(pci_dev);
1135 pci_bus_put(pci_dev->bus);
1135 kfree(pci_dev); 1136 kfree(pci_dev);
1136} 1137}
1137 1138
@@ -1270,11 +1271,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
1270 if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000)) 1271 if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
1271 return NULL; 1272 return NULL;
1272 1273
1273 dev = alloc_pci_dev(); 1274 dev = pci_alloc_dev(bus);
1274 if (!dev) 1275 if (!dev)
1275 return NULL; 1276 return NULL;
1276 1277
1277 dev->bus = bus;
1278 dev->devfn = devfn; 1278 dev->devfn = devfn;
1279 dev->vendor = l & 0xffff; 1279 dev->vendor = l & 0xffff;
1280 dev->device = (l >> 16) & 0xffff; 1280 dev->device = (l >> 16) & 0xffff;
@@ -1282,6 +1282,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
1282 pci_set_of_node(dev); 1282 pci_set_of_node(dev);
1283 1283
1284 if (pci_setup_device(dev)) { 1284 if (pci_setup_device(dev)) {
1285 pci_bus_put(dev->bus);
1285 kfree(dev); 1286 kfree(dev);
1286 return NULL; 1287 return NULL;
1287 } 1288 }
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 846f475f62c1..90c95a3385d1 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2026,7 +2026,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
2026static inline int 2026static inline int
2027make_local_pdev(adapter_t *adapter, struct pci_dev **pdev) 2027make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
2028{ 2028{
2029 *pdev = alloc_pci_dev(); 2029 *pdev = pci_alloc_dev(NULL);
2030 2030
2031 if( *pdev == NULL ) return -1; 2031 if( *pdev == NULL ) return -1;
2032 2032