Commit f9cc1da5 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Greg Kroah-Hartman

[PATCH] PCI: pci_find_bus needs a domain

Give pci_find_bus a domain argument and move its declaration to <linux/pci.h>
parent 235d9018
...@@ -385,7 +385,7 @@ static void add_host_bridge (acpi_handle *handle, int seg, int bus) ...@@ -385,7 +385,7 @@ static void add_host_bridge (acpi_handle *handle, int seg, int bus)
bridge->seg = seg; bridge->seg = seg;
bridge->bus = bus; bridge->bus = bus;
bridge->pci_bus = pci_find_bus(bus); bridge->pci_bus = pci_find_bus(seg, bus);
bridge->res_lock = SPIN_LOCK_UNLOCKED; bridge->res_lock = SPIN_LOCK_UNLOCKED;
......
...@@ -395,7 +395,7 @@ static int cpci_configure_bridge(struct pci_bus* bus, struct pci_dev* dev) ...@@ -395,7 +395,7 @@ static int cpci_configure_bridge(struct pci_bus* bus, struct pci_dev* dev)
/* Scan behind bridge */ /* Scan behind bridge */
n = pci_scan_bridge(bus, dev, max, 2); n = pci_scan_bridge(bus, dev, max, 2);
child = pci_find_bus(max + 1); child = pci_find_bus(0, max + 1);
if (!child) if (!child)
return -ENODEV; return -ENODEV;
pci_proc_attach_bus(child); pci_proc_attach_bus(child);
......
...@@ -774,7 +774,7 @@ static u8 bus_structure_fixup (u8 busno) ...@@ -774,7 +774,7 @@ static u8 bus_structure_fixup (u8 busno)
struct pci_dev *dev; struct pci_dev *dev;
u16 l; u16 l;
if (pci_find_bus(busno) || !(ibmphp_find_same_bus_num (busno))) if (pci_find_bus(0, busno) || !(ibmphp_find_same_bus_num (busno)))
return 1; return 1;
bus = kmalloc (sizeof (*bus), GFP_KERNEL); bus = kmalloc (sizeof (*bus), GFP_KERNEL);
...@@ -819,7 +819,7 @@ static int ibm_configure_device (struct pci_func *func) ...@@ -819,7 +819,7 @@ static int ibm_configure_device (struct pci_func *func)
func->dev = pci_find_slot (func->busno, PCI_DEVFN(func->device, func->function)); func->dev = pci_find_slot (func->busno, PCI_DEVFN(func->device, func->function));
if (func->dev == NULL) { if (func->dev == NULL) {
struct pci_bus *bus = pci_find_bus(func->busno); struct pci_bus *bus = pci_find_bus(0, func->busno);
if (!bus) if (!bus)
return 0; return 0;
...@@ -1335,7 +1335,7 @@ static int __init ibmphp_init (void) ...@@ -1335,7 +1335,7 @@ static int __init ibmphp_init (void)
goto exit; goto exit;
} }
bus = pci_find_bus(0); bus = pci_find_bus(0, 0);
if (!bus) { if (!bus) {
err ("Can't find the root pci bus, can not continue\n"); err ("Can't find the root pci bus, can not continue\n");
rc = -ENODEV; rc = -ENODEV;
......
...@@ -29,7 +29,6 @@ extern int pci_remove_device_safe(struct pci_dev *dev); ...@@ -29,7 +29,6 @@ extern int pci_remove_device_safe(struct pci_dev *dev);
extern unsigned char pci_max_busnr(void); extern unsigned char pci_max_busnr(void);
extern unsigned char pci_bus_max_busnr(struct pci_bus *bus); extern unsigned char pci_bus_max_busnr(struct pci_bus *bus);
extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
extern struct pci_bus *pci_find_bus(unsigned char busnr);
struct pci_dev_wrapped { struct pci_dev_wrapped {
struct pci_dev *dev; struct pci_dev *dev;
......
...@@ -31,22 +31,24 @@ pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) ...@@ -31,22 +31,24 @@ pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
} }
/** /**
* pci_find_bus - locate PCI bus from a given bus number * pci_find_bus - locate PCI bus from a given domain and bus number
* @domain: number of PCI domain to search
* @busnr: number of desired PCI bus * @busnr: number of desired PCI bus
* *
* Given a PCI bus number, the desired PCI bus is located in system * Given a PCI bus number and domain number, the desired PCI bus is located
* global list of PCI buses. If the bus is found, a pointer to its * in the global list of PCI buses. If the bus is found, a pointer to its
* data structure is returned. If no bus is found, %NULL is returned. * data structure is returned. If no bus is found, %NULL is returned.
*/ */
struct pci_bus * struct pci_bus * pci_find_bus(int domain, int busnr)
pci_find_bus(unsigned char busnr)
{ {
struct pci_bus* bus = NULL; struct pci_bus *bus = NULL;
struct pci_bus* tmp_bus; struct pci_bus *tmp_bus;
while ((bus = pci_find_next_bus(bus)) != NULL) { while ((bus = pci_find_next_bus(bus)) != NULL) {
if (pci_domain_nr(bus) != domain)
continue;
tmp_bus = pci_do_find_bus(bus, busnr); tmp_bus = pci_do_find_bus(bus, busnr);
if(tmp_bus) if (tmp_bus)
return tmp_bus; return tmp_bus;
} }
return NULL; return NULL;
......
...@@ -543,6 +543,7 @@ void pcibios_update_irq(struct pci_dev *, int irq); ...@@ -543,6 +543,7 @@ void pcibios_update_irq(struct pci_dev *, int irq);
/* Generic PCI functions used internally */ /* Generic PCI functions used internally */
extern struct pci_bus *pci_find_bus(int domain, int busnr);
int pci_bus_exists(const struct list_head *list, int nr); int pci_bus_exists(const struct list_head *list, int nr);
struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata);
static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment