Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b1fce04 authored by Gu Zheng's avatar Gu Zheng Committed by Bjorn Helgaas
Browse files

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: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarBjorn 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>
parent 3c6e6ae7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
	const char *type;
	struct pci_slot *slot;

	dev = alloc_pci_dev();
	dev = pci_alloc_dev(bus);
	if (!dev)
		return NULL;
	type = of_get_property(node, "device_type", NULL);
@@ -137,7 +137,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,

	pr_debug("    create device, devfn: %x, type: %s\n", devfn, type);

	dev->bus = bus;
	dev->dev.of_node = of_node_get(node);
	dev->dev.parent = bus->bridge;
	dev->dev.bus = &pci_bus_type;
+1 −2
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
	const char *type;
	u32 class;

	dev = alloc_pci_dev();
	dev = pci_alloc_dev(bus);
	if (!dev)
		return NULL;

@@ -281,7 +281,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
		printk("    create device, devfn: %x, type: %s\n",
		       devfn, type);

	dev->bus = bus;
	dev->sysdata = node;
	dev->dev.parent = bus->bridge;
	dev->dev.bus = &pci_bus_type;
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ alpha_core_agp_setup(void)
	/*
	 * Build a fake pci_dev struct
	 */
	pdev = alloc_pci_dev();
	pdev = pci_alloc_dev(NULL);
	if (!pdev)
		return -ENOMEM;
	pdev->vendor = 0xffff;
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ parisc_agp_setup(void __iomem *ioc_hpa, void __iomem *lba_hpa)
	struct agp_bridge_data *bridge;
	int error = 0;

	fake_bridge_dev = alloc_pci_dev();
	fake_bridge_dev = pci_alloc_dev(NULL);
	if (!fake_bridge_dev) {
		error = -ENOMEM;
		goto fail;
+5 −3
Original line number Diff line number Diff line
@@ -75,18 +75,20 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
	struct pci_dev *virtfn;
	struct resource *res;
	struct pci_sriov *iov = dev->sriov;
	struct pci_bus *bus;

	virtfn = alloc_pci_dev();
	virtfn = pci_alloc_dev(NULL);
	if (!virtfn)
		return -ENOMEM;

	mutex_lock(&iov->dev->sriov->lock);
	virtfn->bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id));
	if (!virtfn->bus) {
	bus = virtfn_add_bus(dev->bus, virtfn_bus(dev, id));
	if (!bus) {
		kfree(virtfn);
		mutex_unlock(&iov->dev->sriov->lock);
		return -ENOMEM;
	}
	virtfn->bus = pci_bus_get(bus);
	virtfn->devfn = virtfn_devfn(dev, id);
	virtfn->vendor = dev->vendor;
	pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
Loading