Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5463d9f0f323123d96989d318ac9c537158ad0a5
Commit:     5463d9f0f323123d96989d318ac9c537158ad0a5
Parent:     0bbd6424c55f0ab9e7fcd6a851bc49e265259ff5
Author:     Randy Dunlap <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 28 16:04:21 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Jul 11 16:02:13 2007 -0700

    PCI: limit pci_get_bus_and_slot to domain 0
    
    Limit pci_get_bus_and_slot() to domain (segment) 0 since domain is not
    specified in the function call and defaulting to domain 0 is the only
    reasonable thing to do (rather than returning a device from some other
    unknown domain).
    
    Signed-off-by: Randy Dunlap <[EMAIL PROTECTED]>
    Acked-by: H. Peter Anvin <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/pci/search.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index c132324..9f7090f 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -139,12 +139,14 @@ struct pci_dev * pci_get_slot(struct pci_bus *bus, 
unsigned int devfn)
 }
 
 /**
- * pci_get_bus_and_slot - locate PCI device from a given PCI slot
+ * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot
  * @bus: number of PCI bus on which desired PCI device resides
  * @devfn: encodes number of PCI slot in which the desired PCI
  * device resides and the logical device number within that slot
  * in case of multi-function devices.
  *
+ * Note: the bus/slot search is limited to PCI domain (segment) 0.
+ *
  * Given a PCI bus and slot/function number, the desired PCI device
  * is located in system global list of PCI devices.  If the device
  * is found, a pointer to its data structure is returned.  If no
@@ -157,7 +159,8 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, 
unsigned int devfn)
        struct pci_dev *dev = NULL;
 
        while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
-               if (dev->bus->number == bus && dev->devfn == devfn)
+               if (pci_domain_nr(dev->bus) == 0 &&
+                  (dev->bus->number == bus && dev->devfn == devfn))
                        return dev;
        }
        return NULL;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to