diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2013-05-25 09:48:31 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-06-05 15:49:36 -0400 |
commit | 8b1fce04dc2a2210f050484afa85acc3a81cfbba (patch) | |
tree | d790a4d12baf35c9f32cafde8386d505a7576067 /drivers/pci | |
parent | 3c6e6ae770f338ef3e54c5823c21063204f53537 (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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/iov.c | 8 | ||||
-rw-r--r-- | drivers/pci/probe.c | 5 |
2 files changed, 8 insertions, 5 deletions
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 | } |