]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'pci/jiang-get-domain-bus-slot' into next
authorBjorn Helgaas <bhelgaas@google.com>
Mon, 17 Sep 2012 21:44:20 +0000 (15:44 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 17 Sep 2012 21:44:20 +0000 (15:44 -0600)
* pci/jiang-get-domain-bus-slot:
  xen-pcifront: Use hotplug-safe pci_get_domain_bus_and_slot()
  PCI: Use hotplug-safe pci_get_domain_bus_and_slot()
  PCI/cpcihp: Use hotplug-safe pci_get_domain_bus_and_slot()
  PCI/vga: Use hotplug-safe pci_get_domain_bus_and_slot()
  ia64/PCI: Use hotplug-safe pci_get_domain_bus_and_slot()

arch/ia64/sn/kernel/io_common.c
drivers/gpu/vga/vgaarb.c
drivers/pci/hotplug/cpcihp_generic.c
drivers/pci/iov.c
drivers/pci/xen-pcifront.c

index fbb5f2f87eedb0a3c5d934873435a23267cf5599..8630875e74b5770ce3a02e3cf32175b3cbfeb6ba 100644 (file)
@@ -229,7 +229,6 @@ void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info,
 {
        int segment = pci_domain_nr(dev->bus);
        struct pcibus_bussoft *bs;
-       struct pci_bus *host_pci_bus;
        struct pci_dev *host_pci_dev;
        unsigned int bus_no, devfn;
 
@@ -245,8 +244,7 @@ void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info,
 
        bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
        devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff;
-       host_pci_bus = pci_find_bus(segment, bus_no);
-       host_pci_dev = pci_get_slot(host_pci_bus, devfn);
+       host_pci_dev = pci_get_domain_bus_and_slot(segment, bus_no, devfn);
 
        pcidev_info->host_pci_dev = host_pci_dev;
        pcidev_info->pdi_linux_pcidev = dev;
index 3df8fc0ec01a93ab95883139b2c3f531b72e5934..b6852b776931e8c8482c0c8754951708ca99954f 100644 (file)
@@ -1066,7 +1066,6 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
                }
 
        } else if (strncmp(curr_pos, "target ", 7) == 0) {
-               struct pci_bus *pbus;
                unsigned int domain, bus, devfn;
                struct vga_device *vgadev;
 
@@ -1085,19 +1084,11 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
                        pr_debug("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos,
                                domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
 
-                       pbus = pci_find_bus(domain, bus);
-                       pr_debug("vgaarb: pbus %p\n", pbus);
-                       if (pbus == NULL) {
-                               pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n",
-                                       domain, bus);
-                               ret_val = -ENODEV;
-                               goto done;
-                       }
-                       pdev = pci_get_slot(pbus, devfn);
+                       pdev = pci_get_domain_bus_and_slot(domain, bus, devfn);
                        pr_debug("vgaarb: pdev %p\n", pdev);
                        if (!pdev) {
-                               pr_err("vgaarb: invalid PCI address %x:%x\n",
-                                       bus, devfn);
+                               pr_err("vgaarb: invalid PCI address %x:%x:%x\n",
+                                       domain, bus, devfn);
                                ret_val = -ENODEV;
                                goto done;
                        }
index 81af764c629b6d34573fc2bb9297b26316fa79c6..a6a71c41cdf8cab3e69f5436456cca36fdf0b5a7 100644 (file)
@@ -154,12 +154,8 @@ static int __init cpcihp_generic_init(void)
        if(!r)
                return -EBUSY;
 
-       bus = pci_find_bus(0, bridge_busnr);
-       if (!bus) {
-               err("Invalid bus number %d", bridge_busnr);
-               return -EINVAL;
-       }
-       dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0));
+       dev = pci_get_domain_bus_and_slot(0, bridge_busnr,
+                                         PCI_DEVFN(bridge_slot, 0));
        if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
                err("Invalid bridge device %s", bridge);
                pci_dev_put(dev);
index aeccc911abb829182cbee0b82ecb4c0b49640aa2..b0fe7712b4d4bc153aa23964260562c470dda39a 100644 (file)
@@ -152,15 +152,11 @@ failed1:
 static void virtfn_remove(struct pci_dev *dev, int id, int reset)
 {
        char buf[VIRTFN_ID_LEN];
-       struct pci_bus *bus;
        struct pci_dev *virtfn;
        struct pci_sriov *iov = dev->sriov;
 
-       bus = pci_find_bus(pci_domain_nr(dev->bus), virtfn_bus(dev, id));
-       if (!bus)
-               return;
-
-       virtfn = pci_get_slot(bus, virtfn_devfn(dev, id));
+       virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
+                       virtfn_bus(dev, id), virtfn_devfn(dev, id));
        if (!virtfn)
                return;
 
index d6cc62cb4cf7465fe22cb643fbde7a3f79f88a29..def8d0b5620c01bf4b8fd372a0ee0f68f57dabab 100644 (file)
@@ -982,7 +982,6 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
        int err = 0;
        int i, num_devs;
        unsigned int domain, bus, slot, func;
-       struct pci_bus *pci_bus;
        struct pci_dev *pci_dev;
        char str[64];
 
@@ -1032,13 +1031,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
                        goto out;
                }
 
-               pci_bus = pci_find_bus(domain, bus);
-               if (!pci_bus) {
-                       dev_dbg(&pdev->xdev->dev, "Cannot get bus %04x:%02x\n",
-                               domain, bus);
-                       continue;
-               }
-               pci_dev = pci_get_slot(pci_bus, PCI_DEVFN(slot, func));
+               pci_dev = pci_get_domain_bus_and_slot(domain, bus,
+                               PCI_DEVFN(slot, func));
                if (!pci_dev) {
                        dev_dbg(&pdev->xdev->dev,
                                "Cannot get PCI device %04x:%02x:%02x.%d\n",