Convert all callers of pci_bus_exists() to call pci_find_bus() instead.
Since all callers of pci_find_bus() are __init or __devinit, mark it as
__devinit too.
diff -u include/linux/pci.h include/linux/pci.h
--- a/include/linux/pci.h 3 Jul 2003 11:44:32 -0000
+++ b/include/linux/pci.h 3 Jul 2003 11:56:26 -0000
@@ -544,7 +544,6 @@
/* 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);
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)
{
diff -u drivers/pci/search.c drivers/pci/search.c
--- a/drivers/pci/search.c 3 Jul 2003 11:43:13 -0000
+++ b/drivers/pci/search.c 3 Jul 2003 11:58:53 -0000
@@ -7,12 +7,13 @@
* Copyright 2003 -- Greg Kroah-Hartman <
[email protected]>
*/
+#include <linux/init.h>
#include <linux/pci.h>
#include <linux/module.h>
spinlock_t pci_bus_lock = SPIN_LOCK_UNLOCKED;
-static struct pci_bus *
+static struct pci_bus * __devinit
pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
{
struct pci_bus* child;
@@ -38,7 +38,7 @@
* 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.
*/
-struct pci_bus * pci_find_bus(int domain, int busnr)
+struct pci_bus * __devinit pci_find_bus(int domain, int busnr)
{
struct pci_bus *bus = NULL;
struct pci_bus *tmp_bus;
only in patch2:
--- a/arch/i386/pci/legacy.c 23 Jun 2003 03:29:59 -0000 1.4
+++ b/arch/i386/pci/legacy.c 3 Jul 2003 11:55:11 -0000
@@ -28,7 +28,7 @@ static void __devinit pcibios_fixup_peer
}
for (n=0; n <= pcibios_last_bus; n++) {
- if (pci_bus_exists(&pci_root_buses, n))
+ if (pci_find_bus(0, n))
continue;
bus->number = n;
bus->ops = &pci_root_ops;
only in patch2:
--- a/arch/sh/kernel/cpu/sh4/pci-sh7751.c 2 Jul 2003 22:08:06 -0000 1.2
+++ b/arch/sh/kernel/cpu/sh4/pci-sh7751.c 3 Jul 2003 11:55:23 -0000
@@ -200,7 +200,7 @@ static void __init pcibios_fixup_peer_br
return;
PCIDBG(2,"PCI: Peer bridge fixup\n");
for (n=0; n <= pcibios_last_bus; n++) {
- if (pci_bus_exists(&pci_root_buses, n))
+ if (pci_find_bus(0, n))
continue;
bus.number = n;
bus.ops = pci_root_ops;
only in patch2:
--- a/drivers/pci/probe.c 2 Jul 2003 22:08:22 -0000 1.17
+++ b/drivers/pci/probe.c 3 Jul 2003 11:56:12 -0000
@@ -633,22 +633,11 @@ unsigned int __devinit pci_do_scan_bus(s
return max;
}
-int __devinit pci_bus_exists(const struct list_head *list, int nr)
-{
- const struct pci_bus *b;
-
- list_for_each_entry(b, list, node) {
- if (b->number == nr || pci_bus_exists(&b->children, nr))
- return 1;
- }
- return 0;
-}
-
struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata)
{
struct pci_bus *b;
- if (pci_bus_exists(&pci_root_buses, bus)) {
+ if (pci_find_bus(0, bus)) {
/* If we already got to this bus through a different bridge, ignore it */
DBG("PCI: Bus %02x already known\n", bus);
return NULL;