aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/search.c
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2007-06-28 19:04:21 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:13 -0400
commit5463d9f0f323123d96989d318ac9c537158ad0a5 (patch)
treea6706e7f0e9ee3f0a5c14f123536dc51a3b2e111 /drivers/pci/search.c
parent0bbd6424c55f0ab9e7fcd6a851bc49e265259ff5 (diff)
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 <randy.dunlap@oracle.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/search.c')
-rw-r--r--drivers/pci/search.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index c13232435dc0..9f7090fa8771 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)
139} 139}
140 140
141/** 141/**
142 * pci_get_bus_and_slot - locate PCI device from a given PCI slot 142 * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot
143 * @bus: number of PCI bus on which desired PCI device resides 143 * @bus: number of PCI bus on which desired PCI device resides
144 * @devfn: encodes number of PCI slot in which the desired PCI 144 * @devfn: encodes number of PCI slot in which the desired PCI
145 * device resides and the logical device number within that slot 145 * device resides and the logical device number within that slot
146 * in case of multi-function devices. 146 * in case of multi-function devices.
147 * 147 *
148 * Note: the bus/slot search is limited to PCI domain (segment) 0.
149 *
148 * Given a PCI bus and slot/function number, the desired PCI device 150 * Given a PCI bus and slot/function number, the desired PCI device
149 * is located in system global list of PCI devices. If the device 151 * is located in system global list of PCI devices. If the device
150 * is found, a pointer to its data structure is returned. If no 152 * 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)
157 struct pci_dev *dev = NULL; 159 struct pci_dev *dev = NULL;
158 160
159 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 161 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
160 if (dev->bus->number == bus && dev->devfn == devfn) 162 if (pci_domain_nr(dev->bus) == 0 &&
163 (dev->bus->number == bus && dev->devfn == devfn))
161 return dev; 164 return dev;
162 } 165 }
163 return NULL; 166 return NULL;