LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RFC] PCI: remove the "shadow" device list
@ 2008-02-15 0:39 Greg KH
2008-02-15 0:39 ` [PATCH 01/12] PCI: remove pci_find_present Greg Kroah-Hartman
` (11 more replies)
0 siblings, 12 replies; 15+ messages in thread
From: Greg KH @ 2008-02-15 0:39 UTC (permalink / raw)
To: linux-kernel, linux-pci, pcihpd-discuss
Here are a series of 12 patches that I've added to my quilt tree for
2.6.26 that delete the "shadow" PCI device tree. There is no real need
to keep two lists of all PCI devices in the kernel, the driver core
should be able to properly handle all of this.
We do keep the bus list of devices, as that is still useful for a lot of
things, and I don't see any obviously easy way to clean that up at the
moment.
Overall, the patch ends up deleting a lot of code, which is always a
good thing.
Comments are appreciated.
thanks,
greg k-h
----------------------
Documentation/kernel-parameters.txt | 4 -
arch/frv/mb93090-mb00/pci-frv.h | 2 -
arch/frv/mb93090-mb00/pci-vdk.c | 53 -----
arch/mn10300/unit-asb2305/pci-asb2305.h | 2 -
arch/powerpc/platforms/pseries/pci_dlpar.c | 7 +-
arch/sh/drivers/pci/pci-sh4.h | 2 -
arch/x86/kernel/pci-calgary_64.c | 3 +-
arch/x86/pci/common.c | 61 ------
arch/x86/pci/pcbios.c | 72 -------
arch/x86/pci/pci.h | 3 -
drivers/ide/ide-scan-pci.c | 9 +-
drivers/ide/ide.c | 12 -
drivers/pci/bus.c | 15 +-
drivers/pci/hotplug/Kconfig | 4 +-
drivers/pci/hotplug/cpcihp_generic.c | 8 +-
drivers/pci/probe.c | 56 ++----
drivers/pci/remove.c | 10 +-
drivers/pci/search.c | 313 +++++++++++-----------------
include/asm-sh/mpc1211/pci.h | 2 -
include/linux/ide.h | 1 -
include/linux/pci.h | 20 +--
21 files changed, 159 insertions(+), 500 deletions(-)
---------------
Greg Kroah-Hartman (12):
PCI: remove pci_find_present
PCI: remove pci_get_device_reverse from calgary driver
IDE: remove ide=reverse IDE core
PCI: remove pci_get_device_reverse
PCI: clean up search.c a lot
PCI Hotplug: make cpcihp driver use modern apis
PCI Hotplug: the ibm driver is not dependant on PCI_LEGACY
PCI: remove initial bios sort of PCI devices on x86
PCI: make no_pci_devices() use the pci_bus_type list
PCI: add is_added flag to struct pci_dev
PCI: remove pcibious_fixup_ghosts()
PCI: remove global list of PCI devices
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 01/12] PCI: remove pci_find_present
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
@ 2008-02-15 0:39 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 02/12] PCI: remove pci_get_device_reverse from calgary driver Greg Kroah-Hartman
` (10 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:39 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
No one is using this function anymore for quite some time, so remove it.
Everyone calls pci_dev_present() instead anyway...
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/search.c | 35 +++++++++++++++--------------------
include/linux/pci.h | 2 --
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 8541034..1aabe3d 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -436,7 +436,18 @@ exit:
return dev;
}
-const struct pci_device_id *pci_find_present(const struct pci_device_id *ids)
+/**
+ * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
+ * @ids: A pointer to a null terminated list of struct pci_device_id structures
+ * that describe the type of PCI device the caller is trying to find.
+ *
+ * Obvious fact: You do not have a reference to any device that might be found
+ * by this function, so if that device is removed from the system right after
+ * this function is finished, the value will be stale. Use this function to
+ * find devices that are usually built into a system, or for a general hint as
+ * to if another device happens to be present at this specific moment in time.
+ */
+int pci_dev_present(const struct pci_device_id *ids)
{
struct pci_dev *dev;
const struct pci_device_id *found = NULL;
@@ -452,27 +463,11 @@ const struct pci_device_id *pci_find_present(const struct pci_device_id *ids)
}
exit:
up_read(&pci_bus_sem);
- return found;
-}
-
-/**
- * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
- * @ids: A pointer to a null terminated list of struct pci_device_id structures
- * that describe the type of PCI device the caller is trying to find.
- *
- * Obvious fact: You do not have a reference to any device that might be found
- * by this function, so if that device is removed from the system right after
- * this function is finished, the value will be stale. Use this function to
- * find devices that are usually built into a system, or for a general hint as
- * to if another device happens to be present at this specific moment in time.
- */
-int pci_dev_present(const struct pci_device_id *ids)
-{
- return pci_find_present(ids) == NULL ? 0 : 1;
+ if (found)
+ return 1;
+ return 0;
}
-
EXPORT_SYMBOL(pci_dev_present);
-EXPORT_SYMBOL(pci_find_present);
#ifdef CONFIG_PCI_LEGACY
EXPORT_SYMBOL(pci_find_device);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 87195b6..8eebbff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -517,7 +517,6 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
int pci_dev_present(const struct pci_device_id *ids);
-const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
int where, u8 *val);
@@ -807,7 +806,6 @@ static inline struct pci_dev *pci_get_class(unsigned int class,
#define pci_dev_present(ids) (0)
#define no_pci_devices() (1)
-#define pci_find_present(ids) (NULL)
#define pci_dev_put(dev) do { } while (0)
static inline void pci_set_master(struct pci_dev *dev)
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 02/12] PCI: remove pci_get_device_reverse from calgary driver
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
2008-02-15 0:39 ` [PATCH 01/12] PCI: remove pci_find_present Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 03/12] IDE: remove ide=reverse IDE core Greg Kroah-Hartman
` (9 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman, Jon Mason
This isn't needed, we can just walk the devices in bus order with no
problems at all, as we really want to remove pci_get_device_reverse from
the kernel tree.
Acked-by: Muli Ben-Yehuda <muli@il.ibm.com>
Cc: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/x86/kernel/pci-calgary_64.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 1b5464c..67a3feb 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1232,8 +1232,7 @@ static int __init calgary_init(void)
error:
do {
- dev = pci_get_device_reverse(PCI_VENDOR_ID_IBM,
- PCI_ANY_ID, dev);
+ dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev);
if (!dev)
break;
if (!is_cal_pci_dev(dev->device))
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 03/12] IDE: remove ide=reverse IDE core
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
2008-02-15 0:39 ` [PATCH 01/12] PCI: remove pci_find_present Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 02/12] PCI: remove pci_get_device_reverse from calgary driver Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 04/12] PCI: remove pci_get_device_reverse Greg Kroah-Hartman
` (8 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci
Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman,
Bartlomiej Zolnierkiewicz
This option is obsolete and can be removed safely.
It allows us to remove the pci_get_device_reverse() function from the
PCI core.
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/ide/ide-scan-pci.c | 9 ++-------
drivers/ide/ide.c | 12 ------------
include/linux/ide.h | 1 -
3 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c
index 93d2e41..98888da 100644
--- a/drivers/ide/ide-scan-pci.c
+++ b/drivers/ide/ide-scan-pci.c
@@ -88,13 +88,8 @@ static int __init ide_scan_pcibus(void)
struct list_head *l, *n;
pre_init = 0;
- if (!ide_scan_direction)
- while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)))
- ide_scan_pcidev(dev);
- else
- while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID,
- dev)))
- ide_scan_pcidev(dev);
+ while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)))
+ ide_scan_pcidev(dev);
/*
* Hand the drivers over to the PCI layer now we
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 4a8952a..eed7ead 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -90,10 +90,6 @@ static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */
DEFINE_MUTEX(ide_cfg_mtx);
__cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
-#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
-int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
-#endif
-
int noautodma = 0;
#ifdef CONFIG_BLK_DEV_IDEACPI
@@ -1225,14 +1221,6 @@ static int __init ide_setup(char *s)
goto obsolete_option;
}
-#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
- if (!strcmp(s, "ide=reverse")) {
- ide_scan_direction = 1;
- printk(" : Enabled support for IDE inverse scan order.\n");
- return 1;
- }
-#endif
-
#ifdef CONFIG_BLK_DEV_IDEACPI
if (!strcmp(s, "ide=noacpi")) {
//printk(" : Disable IDE ACPI support.\n");
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a3b69c1..415adbb 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -990,7 +990,6 @@ extern void do_ide_request(struct request_queue *);
void ide_init_disk(struct gendisk *, ide_drive_t *);
#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
-extern int ide_scan_direction;
extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
#else
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 04/12] PCI: remove pci_get_device_reverse
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (2 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 03/12] IDE: remove ide=reverse IDE core Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 05/12] PCI: clean up search.c a lot Greg Kroah-Hartman
` (7 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
This removes the pci_get_device_reverse function as there should not be
any need to walk pci devices backwards anymore. All users of this call
are now gone from the tree, so it is safe to remove it.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/search.c | 41 -----------------------------------------
include/linux/pci.h | 10 ----------
2 files changed, 0 insertions(+), 51 deletions(-)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 1aabe3d..a04c43f 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -360,46 +360,6 @@ pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from)
}
/**
- * pci_get_device_reverse - begin or continue searching for a PCI device by vendor/device id
- * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
- * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
- * @from: Previous PCI device found in search, or %NULL for new search.
- *
- * Iterates through the list of known PCI devices in the reverse order of
- * pci_get_device.
- * If a PCI device is found with a matching @vendor and @device, the reference
- * count to the device is incremented and a pointer to its device structure
- * is returned Otherwise, %NULL is returned. A new search is initiated by
- * passing %NULL as the @from argument. Otherwise if @from is not %NULL,
- * searches continue from next device on the global list. The reference
- * count for @from is always decremented if it is not %NULL.
- */
-struct pci_dev *
-pci_get_device_reverse(unsigned int vendor, unsigned int device, struct pci_dev *from)
-{
- struct list_head *n;
- struct pci_dev *dev;
-
- WARN_ON(in_interrupt());
- down_read(&pci_bus_sem);
- n = from ? from->global_list.prev : pci_devices.prev;
-
- while (n && (n != &pci_devices)) {
- dev = pci_dev_g(n);
- if ((vendor == PCI_ANY_ID || dev->vendor == vendor) &&
- (device == PCI_ANY_ID || dev->device == device))
- goto exit;
- n = n->prev;
- }
- dev = NULL;
-exit:
- dev = pci_dev_get(dev);
- up_read(&pci_bus_sem);
- pci_dev_put(from);
- return dev;
-}
-
-/**
* pci_get_class - begin or continue searching for a PCI device by class
* @class: search for a PCI device with this class designation
* @from: Previous PCI device found in search, or %NULL for new search.
@@ -479,7 +439,6 @@ EXPORT_SYMBOL(pci_find_bus);
EXPORT_SYMBOL(pci_find_next_bus);
/* For everyone */
EXPORT_SYMBOL(pci_get_device);
-EXPORT_SYMBOL(pci_get_device_reverse);
EXPORT_SYMBOL(pci_get_subsys);
EXPORT_SYMBOL(pci_get_slot);
EXPORT_SYMBOL(pci_get_bus_and_slot);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8eebbff..99cd9b2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -507,9 +507,6 @@ struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
struct pci_dev *from);
-struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
- struct pci_dev *from);
-
struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
unsigned int ss_vendor, unsigned int ss_device,
struct pci_dev *from);
@@ -782,13 +779,6 @@ static inline struct pci_dev *pci_get_device(unsigned int vendor,
return NULL;
}
-static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
- unsigned int device,
- struct pci_dev *from)
-{
- return NULL;
-}
-
static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
unsigned int device,
unsigned int ss_vendor,
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 05/12] PCI: clean up search.c a lot
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (3 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 04/12] PCI: remove pci_get_device_reverse Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis Greg Kroah-Hartman
` (6 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
This cleans up the search.c file, now using the pci list of devices that
are created for the driver core, instead of relying on our separate list
of devices. It's better to use the functions already created for this
kind of thing, instead of rolling our own all the time.
This work is done in anticipation of getting rid of that second list of
pci devices all together.
And it ends up saving code, always a nice benefit.
This also removes one compiler warning for when CONFIG_PCI_LEGACY is
enabled as we no longer internally use the deprecated functions anymore.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/search.c | 249 ++++++++++++++++++++++---------------------------
include/linux/pci.h | 4 +-
2 files changed, 114 insertions(+), 139 deletions(-)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index a04c43f..217814f 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -114,31 +114,63 @@ pci_find_next_bus(const struct pci_bus *from)
}
#ifdef CONFIG_PCI_LEGACY
-
/**
* pci_find_slot - locate PCI device from a given PCI 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
+ * @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.
*
- * Given a PCI bus and slot/function number, the desired PCI device
+ * 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
+ * is found, a pointer to its data structure is returned. If no
* device is found, %NULL is returned.
+ *
+ * NOTE: Do not use this function any more; use pci_get_slot() instead, as
+ * the PCI device returned by this function can disappear at any moment in
+ * time.
*/
-struct pci_dev *
-pci_find_slot(unsigned int bus, unsigned int devfn)
+struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn)
{
struct pci_dev *dev = NULL;
- while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
- if (dev->bus->number == bus && dev->devfn == devfn)
+ while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+ if (dev->bus->number == bus && dev->devfn == devfn) {
+ pci_dev_put(dev);
return dev;
+ }
}
return NULL;
}
+EXPORT_SYMBOL(pci_find_slot);
+/**
+ * pci_find_device - begin or continue searching for a PCI device by vendor/device id
+ * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
+ * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
+ * @from: Previous PCI device found in search, or %NULL for new search.
+ *
+ * Iterates through the list of known PCI devices. If a PCI device is found
+ * with a matching @vendor and @device, a pointer to its device structure is
+ * returned. Otherwise, %NULL is returned.
+ * A new search is initiated by passing %NULL as the @from argument.
+ * Otherwise if @from is not %NULL, searches continue from next device
+ * on the global list.
+ *
+ * NOTE: Do not use this function any more; use pci_get_device() instead, as
+ * the PCI device returned by this function can disappear at any moment in
+ * time.
+ */
+struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device,
+ const struct pci_dev *from)
+{
+ struct pci_dev *pdev;
+
+ pdev = pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
+ pci_dev_put(pdev);
+ return pdev;
+}
+EXPORT_SYMBOL(pci_find_device);
#endif /* CONFIG_PCI_LEGACY */
/**
@@ -204,86 +236,52 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
return NULL;
}
-#ifdef CONFIG_PCI_LEGACY
-/**
- * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
- * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
- * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
- * @ss_vendor: PCI subsystem vendor id to match, or %PCI_ANY_ID to match all vendor ids
- * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids
- * @from: Previous PCI device found in search, or %NULL for new search.
- *
- * Iterates through the list of known PCI devices. If a PCI device is
- * found with a matching @vendor, @device, @ss_vendor and @ss_device, a
- * pointer to its device structure is returned. Otherwise, %NULL is returned.
- * A new search is initiated by passing %NULL as the @from argument.
- * Otherwise if @from is not %NULL, searches continue from next device
- * on the global list.
- *
- * NOTE: Do not use this function any more; use pci_get_subsys() instead, as
- * the PCI device returned by this function can disappear at any moment in
- * time.
- */
-static struct pci_dev * pci_find_subsys(unsigned int vendor,
- unsigned int device,
- unsigned int ss_vendor,
- unsigned int ss_device,
- const struct pci_dev *from)
+static int match_pci_dev_by_id(struct device *dev, void *data)
{
- struct list_head *n;
- struct pci_dev *dev;
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct pci_device_id *id = data;
- WARN_ON(in_interrupt());
-
- /*
- * pci_find_subsys() can be called on the ide_setup() path, super-early
- * in boot. But the down_read() will enable local interrupts, which
- * can cause some machines to crash. So here we detect and flag that
- * situation and bail out early.
- */
- if (unlikely(no_pci_devices()))
- return NULL;
- down_read(&pci_bus_sem);
- n = from ? from->global_list.next : pci_devices.next;
-
- while (n && (n != &pci_devices)) {
- dev = pci_dev_g(n);
- if ((vendor == PCI_ANY_ID || dev->vendor == vendor) &&
- (device == PCI_ANY_ID || dev->device == device) &&
- (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) &&
- (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device))
- goto exit;
- n = n->next;
- }
- dev = NULL;
-exit:
- up_read(&pci_bus_sem);
- return dev;
+ if (pci_match_one_device(id, pdev))
+ return 1;
+ return 0;
}
-/**
- * pci_find_device - begin or continue searching for a PCI device by vendor/device id
- * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
- * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
+/*
+ * pci_get_dev_by_id - begin or continue searching for a PCI device by id
+ * @id: pointer to struct pci_device_id to match for the device
* @from: Previous PCI device found in search, or %NULL for new search.
*
* Iterates through the list of known PCI devices. If a PCI device is found
- * with a matching @vendor and @device, a pointer to its device structure is
- * returned. Otherwise, %NULL is returned.
- * A new search is initiated by passing %NULL as the @from argument.
- * Otherwise if @from is not %NULL, searches continue from next device
- * on the global list.
- *
- * NOTE: Do not use this function any more; use pci_get_device() instead, as
- * the PCI device returned by this function can disappear at any moment in
- * time.
+ * with a matching id a pointer to its device structure is returned, and the
+ * reference count to the device is incremented. Otherwise, %NULL is returned.
+ * A new search is initiated by passing %NULL as the @from argument. Otherwise
+ * if @from is not %NULL, searches continue from next device on the global
+ * list. The reference count for @from is always decremented if it is not
+ * %NULL.
+ *
+ * This is an internal function for use by the other search functions in
+ * this file.
*/
-struct pci_dev *
-pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from)
+static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
+ const struct pci_dev *from)
{
- return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
+ struct device *dev;
+ struct device *dev_start = NULL;
+ struct pci_dev *pdev = NULL;
+
+ WARN_ON(in_interrupt());
+ if (from) {
+ /* FIXME
+ * take the cast off, when bus_find_device is made const.
+ */
+ dev_start = (struct device *)&from->dev;
+ }
+ dev = bus_find_device(&pci_bus_type, dev_start, (void *)id,
+ match_pci_dev_by_id);
+ if (dev)
+ pdev = to_pci_dev(dev);
+ return pdev;
}
-#endif /* CONFIG_PCI_LEGACY */
/**
* pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
@@ -301,42 +299,34 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *
* searches continue from next device on the global list.
* The reference count for @from is always decremented if it is not %NULL.
*/
-struct pci_dev *
-pci_get_subsys(unsigned int vendor, unsigned int device,
- unsigned int ss_vendor, unsigned int ss_device,
- struct pci_dev *from)
+struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
+ unsigned int ss_vendor, unsigned int ss_device,
+ const struct pci_dev *from)
{
- struct list_head *n;
- struct pci_dev *dev;
-
- WARN_ON(in_interrupt());
+ struct pci_dev *pdev;
+ struct pci_device_id *id;
/*
- * pci_get_subsys() can potentially be called by drivers super-early
- * in boot. But the down_read() will enable local interrupts, which
- * can cause some machines to crash. So here we detect and flag that
- * situation and bail out early.
+ * pci_find_subsys() can be called on the ide_setup() path,
+ * super-early in boot. But the down_read() will enable local
+ * interrupts, which can cause some machines to crash. So here we
+ * detect and flag that situation and bail out early.
*/
if (unlikely(no_pci_devices()))
return NULL;
- down_read(&pci_bus_sem);
- n = from ? from->global_list.next : pci_devices.next;
-
- while (n && (n != &pci_devices)) {
- dev = pci_dev_g(n);
- if ((vendor == PCI_ANY_ID || dev->vendor == vendor) &&
- (device == PCI_ANY_ID || dev->device == device) &&
- (ss_vendor == PCI_ANY_ID || dev->subsystem_vendor == ss_vendor) &&
- (ss_device == PCI_ANY_ID || dev->subsystem_device == ss_device))
- goto exit;
- n = n->next;
- }
- dev = NULL;
-exit:
- dev = pci_dev_get(dev);
- up_read(&pci_bus_sem);
- pci_dev_put(from);
- return dev;
+
+ id = kzalloc(sizeof(*id), GFP_KERNEL);
+ if (!id)
+ return NULL;
+ id->vendor = vendor;
+ id->device = device;
+ id->subvendor = ss_vendor;
+ id->subdevice = ss_device;
+
+ pdev = pci_get_dev_by_id(id, from);
+ kfree(id);
+
+ return pdev;
}
/**
@@ -375,24 +365,18 @@ pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from)
*/
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
{
- struct list_head *n;
struct pci_dev *dev;
+ struct pci_device_id *id;
- WARN_ON(in_interrupt());
- down_read(&pci_bus_sem);
- n = from ? from->global_list.next : pci_devices.next;
+ id = kzalloc(sizeof(*id), GFP_KERNEL);
+ if (!id)
+ return NULL;
+ id->vendor = id->device = id->subvendor = id->subdevice = PCI_ANY_ID;
+ id->class_mask = PCI_ANY_ID;
+ id->class = class;
- while (n && (n != &pci_devices)) {
- dev = pci_dev_g(n);
- if (dev->class == class)
- goto exit;
- n = n->next;
- }
- dev = NULL;
-exit:
- dev = pci_dev_get(dev);
- up_read(&pci_bus_sem);
- pci_dev_put(from);
+ dev = pci_get_dev_by_id(id, from);
+ kfree(id);
return dev;
}
@@ -409,31 +393,22 @@ exit:
*/
int pci_dev_present(const struct pci_device_id *ids)
{
- struct pci_dev *dev;
- const struct pci_device_id *found = NULL;
+ struct pci_dev *found = NULL;
WARN_ON(in_interrupt());
- down_read(&pci_bus_sem);
while (ids->vendor || ids->subvendor || ids->class_mask) {
- list_for_each_entry(dev, &pci_devices, global_list) {
- if ((found = pci_match_one_device(ids, dev)) != NULL)
- goto exit;
- }
+ found = pci_get_dev_by_id(ids, NULL);
+ if (found)
+ goto exit;
ids++;
}
exit:
- up_read(&pci_bus_sem);
if (found)
return 1;
return 0;
}
EXPORT_SYMBOL(pci_dev_present);
-#ifdef CONFIG_PCI_LEGACY
-EXPORT_SYMBOL(pci_find_device);
-EXPORT_SYMBOL(pci_find_slot);
-#endif /* CONFIG_PCI_LEGACY */
-
/* For boot time work */
EXPORT_SYMBOL(pci_find_bus);
EXPORT_SYMBOL(pci_find_next_bus);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 99cd9b2..a38c855 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -509,7 +509,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
struct pci_dev *from);
struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
unsigned int ss_vendor, unsigned int ss_device,
- struct pci_dev *from);
+ const struct pci_dev *from);
struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
@@ -783,7 +783,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
unsigned int device,
unsigned int ss_vendor,
unsigned int ss_device,
- struct pci_dev *from)
+ const struct pci_dev *from)
{
return NULL;
}
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (4 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 05/12] PCI: clean up search.c a lot Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 22:45 ` Scott Murray
2008-02-15 0:40 ` [PATCH 07/12] PCI Hotplug: the ibm driver is not dependant on PCI_LEGACY Greg Kroah-Hartman
` (5 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci
Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman,
Kristen Carlson Accardi, Scott Murray
This removes the depandancy of the cpcihp driver from the PCI_LEGACY
config option by removing its usage of the pci_find_bus() function.
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Cc: Scott Murray <scottm@somanetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/hotplug/Kconfig | 2 +-
drivers/pci/hotplug/cpcihp_generic.c | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index 2cdd832..17fb3d6 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
config HOTPLUG_PCI_CPCI_GENERIC
tristate "Generic port I/O CompactPCI Hotplug driver"
- depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY
+ depends on HOTPLUG_PCI_CPCI && X86
help
Say Y here if you have a CompactPCI system card that exposes the #ENUM
hotswap signal as a bit in a system register that can be read through
diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c
index f3852a6..148fb46 100644
--- a/drivers/pci/hotplug/cpcihp_generic.c
+++ b/drivers/pci/hotplug/cpcihp_generic.c
@@ -154,12 +154,18 @@ static int __init cpcihp_generic_init(void)
if(!r)
return -EBUSY;
- dev = pci_find_slot(bridge_busnr, PCI_DEVFN(bridge_slot, 0));
+ 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));
if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
err("Invalid bridge device %s", bridge);
return -EINVAL;
}
bus = dev->subordinate;
+ pci_dev_put(dev);
memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller));
generic_hpc_ops.query_enum = query_enum;
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 07/12] PCI Hotplug: the ibm driver is not dependant on PCI_LEGACY
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (5 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 08/12] PCI: remove initial bios sort of PCI devices on x86 Greg Kroah-Hartman
` (4 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci
Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman,
Kristen Carlson Accardi
This was marked incorrectly for some reason. Allow the ibmphp driver to
be built even if PCI_LEGACY is not enabled.
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/hotplug/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index 17fb3d6..eacfb13 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -63,7 +63,7 @@ config HOTPLUG_PCI_COMPAQ_NVRAM
config HOTPLUG_PCI_IBM
tristate "IBM PCI Hotplug driver"
- depends on X86_IO_APIC && X86 && PCI_BIOS && PCI_LEGACY
+ depends on X86_IO_APIC && X86 && PCI_BIOS
help
Say Y here if you have a motherboard with a IBM PCI Hotplug
controller.
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 08/12] PCI: remove initial bios sort of PCI devices on x86
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (6 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 07/12] PCI Hotplug: the ibm driver is not dependant on PCI_LEGACY Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 09/12] PCI: make no_pci_devices() use the pci_bus_type list Greg Kroah-Hartman
` (3 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman, Matt Domsch
We currently keep 2 lists of PCI devices in the system, one in the
driver core, and one all on its own. This second list is sorted at boot
time, in "BIOS" order, to try to remain compatible with older kernels
(2.2 and earlier days). There was also a "nosort" option to turn this
sorting off, to remain compatible with even older kernel versions, but
that just ends up being what we have been doing from 2.5 days...
Unfortunately, the second list of devices is not really ever used to
determine the probing order of PCI devices or drivers[1]. That is done
using the driver core list instead. This change happened back in the
early 2.5 days.
Relying on BIOS ording for the binding of drivers to specific device
names is problematic for many reasons, and userspace tools like udev
exist to properly name devices in a persistant manner if that is needed,
no reliance on the BIOS is needed.
Matt Domsch and others at Dell noticed this back in 2006, and added a
boot option to sort the PCI device lists (both of them) in a
breadth-first manner to help remain compatible with the 2.4 order, if
needed for any reason. This option is not going away, as some systems
rely on them.
This patch removes the sorting of the internal PCI device list in "BIOS"
mode, as it's not needed at all anymore, and hasn't for many years.
I've also removed the PCI flags for this from some other arches that for
some reason defined them, but never used them.
This should not change the ordering of any drivers or device probing.
[1] The old-style pci_get_device and pci_find_device() still used this
sorting order, but there are very few drivers that use these functions,
as they are deprecated for use in this manner. If for some reason, a
driver rely on the order and uses these functions, the breadth-first
boot option will resolve any problem.
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/kernel-parameters.txt | 4 --
arch/frv/mb93090-mb00/pci-frv.h | 2 -
arch/mn10300/unit-asb2305/pci-asb2305.h | 2 -
arch/sh/drivers/pci/pci-sh4.h | 2 -
arch/x86/pci/common.c | 7 ---
arch/x86/pci/pcbios.c | 72 -------------------------------
arch/x86/pci/pci.h | 3 -
include/asm-sh/mpc1211/pci.h | 2 -
8 files changed, 0 insertions(+), 94 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a4fc7fc..c64dfd7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1393,10 +1393,6 @@ and is between 256 and 4096 characters. It is defined in the file
nomsi [MSI] If the PCI_MSI kernel config parameter is
enabled, this kernel boot option can be used to
disable the use of MSI interrupts system-wide.
- nosort [X86-32] Don't sort PCI devices according to
- order given by the PCI BIOS. This sorting is
- done to get a device order compatible with
- older kernels.
biosirq [X86-32] Use PCI BIOS calls to get the interrupt
routing table. These calls are known to be buggy
on several machines and they hang the machine
diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h
index 7481797..0c7bf39 100644
--- a/arch/frv/mb93090-mb00/pci-frv.h
+++ b/arch/frv/mb93090-mb00/pci-frv.h
@@ -17,8 +17,6 @@
#define PCI_PROBE_BIOS 0x0001
#define PCI_PROBE_CONF1 0x0002
#define PCI_PROBE_CONF2 0x0004
-#define PCI_NO_SORT 0x0100
-#define PCI_BIOS_SORT 0x0200
#define PCI_NO_CHECKS 0x0400
#define PCI_ASSIGN_ROMS 0x1000
#define PCI_BIOS_IRQ_SCAN 0x2000
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h
index 84634fa..9763d1c 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.h
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.h
@@ -23,8 +23,6 @@
#define PCI_PROBE_BIOS 1
#define PCI_PROBE_CONF1 2
#define PCI_PROBE_CONF2 4
-#define PCI_NO_SORT 0x100
-#define PCI_BIOS_SORT 0x200
#define PCI_NO_CHECKS 0x400
#define PCI_ASSIGN_ROMS 0x1000
#define PCI_BIOS_IRQ_SCAN 0x2000
diff --git a/arch/sh/drivers/pci/pci-sh4.h b/arch/sh/drivers/pci/pci-sh4.h
index 4925c79..5f43bc9 100644
--- a/arch/sh/drivers/pci/pci-sh4.h
+++ b/arch/sh/drivers/pci/pci-sh4.h
@@ -15,8 +15,6 @@
#define PCI_PROBE_BIOS 1
#define PCI_PROBE_CONF1 2
#define PCI_PROBE_CONF2 4
-#define PCI_NO_SORT 0x100
-#define PCI_BIOS_SORT 0x200
#define PCI_NO_CHECKS 0x400
#define PCI_ASSIGN_ROMS 0x1000
#define PCI_BIOS_IRQ_SCAN 0x2000
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index b7c67a1..a67c1fe 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -427,10 +427,6 @@ static int __init pcibios_init(void)
if (pci_bf_sort >= pci_force_bf)
pci_sort_breadthfirst();
-#ifdef CONFIG_PCI_BIOS
- if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
- pcibios_sort();
-#endif
return 0;
}
@@ -455,9 +451,6 @@ char * __devinit pcibios_setup(char *str)
} else if (!strcmp(str, "nobios")) {
pci_probe &= ~PCI_PROBE_BIOS;
return NULL;
- } else if (!strcmp(str, "nosort")) {
- pci_probe |= PCI_NO_SORT;
- return NULL;
} else if (!strcmp(str, "biosirq")) {
pci_probe |= PCI_BIOS_IRQ_SCAN;
return NULL;
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 10ac8c3..ee003d7 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -152,28 +152,6 @@ static int __devinit check_pcibios(void)
return 0;
}
-static int __devinit pci_bios_find_device (unsigned short vendor, unsigned short device_id,
- unsigned short index, unsigned char *bus, unsigned char *device_fn)
-{
- unsigned short bx;
- unsigned short ret;
-
- __asm__("lcall *(%%edi); cld\n\t"
- "jc 1f\n\t"
- "xor %%ah, %%ah\n"
- "1:"
- : "=b" (bx),
- "=a" (ret)
- : "1" (PCIBIOS_FIND_PCI_DEVICE),
- "c" (device_id),
- "d" (vendor),
- "S" ((int) index),
- "D" (&pci_indirect));
- *bus = (bx >> 8) & 0xff;
- *device_fn = bx & 0xff;
- return (int) (ret & 0xff00) >> 8;
-}
-
static int pci_bios_read(unsigned int seg, unsigned int bus,
unsigned int devfn, int reg, int len, u32 *value)
{
@@ -354,55 +332,6 @@ static struct pci_raw_ops * __devinit pci_find_bios(void)
}
/*
- * Sort the device list according to PCI BIOS. Nasty hack, but since some
- * fool forgot to define the `correct' device order in the PCI BIOS specs
- * and we want to be (possibly bug-to-bug ;-]) compatible with older kernels
- * which used BIOS ordering, we are bound to do this...
- */
-
-void __devinit pcibios_sort(void)
-{
- LIST_HEAD(sorted_devices);
- struct list_head *ln;
- struct pci_dev *dev, *d;
- int idx, found;
- unsigned char bus, devfn;
-
- DBG("PCI: Sorting device list...\n");
- while (!list_empty(&pci_devices)) {
- ln = pci_devices.next;
- dev = pci_dev_g(ln);
- idx = found = 0;
- while (pci_bios_find_device(dev->vendor, dev->device, idx, &bus, &devfn) == PCIBIOS_SUCCESSFUL) {
- idx++;
- list_for_each(ln, &pci_devices) {
- d = pci_dev_g(ln);
- if (d->bus->number == bus && d->devfn == devfn) {
- list_move_tail(&d->global_list, &sorted_devices);
- if (d == dev)
- found = 1;
- break;
- }
- }
- if (ln == &pci_devices) {
- printk(KERN_WARNING "PCI: BIOS reporting unknown device %02x:%02x\n", bus, devfn);
- /*
- * We must not continue scanning as several buggy BIOSes
- * return garbage after the last device. Grr.
- */
- break;
- }
- }
- if (!found) {
- printk(KERN_WARNING "PCI: Device %s not found by BIOS\n",
- pci_name(dev));
- list_move_tail(&dev->global_list, &sorted_devices);
- }
- }
- list_splice(&sorted_devices, &pci_devices);
-}
-
-/*
* BIOS Functions for IRQ Routing
*/
@@ -485,7 +414,6 @@ void __init pci_pcbios_init(void)
{
if ((pci_probe & PCI_PROBE_BIOS)
&& ((raw_pci_ops = pci_find_bios()))) {
- pci_probe |= PCI_BIOS_SORT;
pci_bios_present = 1;
}
}
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index 3431518..02b016a 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -19,8 +19,6 @@
#define PCI_PROBE_MASK 0x000f
#define PCI_PROBE_NOEARLY 0x0010
-#define PCI_NO_SORT 0x0100
-#define PCI_BIOS_SORT 0x0200
#define PCI_NO_CHECKS 0x0400
#define PCI_USE_PIRQ_MASK 0x0800
#define PCI_ASSIGN_ROMS 0x1000
@@ -101,7 +99,6 @@ extern int pci_direct_probe(void);
extern void pci_direct_init(int type);
extern void pci_pcbios_init(void);
extern void pci_mmcfg_init(int type);
-extern void pcibios_sort(void);
/* pci-mmconfig.c */
diff --git a/include/asm-sh/mpc1211/pci.h b/include/asm-sh/mpc1211/pci.h
index 5d3712c..d9162c5 100644
--- a/include/asm-sh/mpc1211/pci.h
+++ b/include/asm-sh/mpc1211/pci.h
@@ -24,8 +24,6 @@
#define PCI_PROBE_BIOS 1
#define PCI_PROBE_CONF1 2
#define PCI_PROBE_CONF2 4
-#define PCI_NO_SORT 0x100
-#define PCI_BIOS_SORT 0x200
#define PCI_NO_CHECKS 0x400
#define PCI_ASSIGN_ROMS 0x1000
#define PCI_BIOS_IRQ_SCAN 0x2000
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 09/12] PCI: make no_pci_devices() use the pci_bus_type list
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (7 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 08/12] PCI: remove initial bios sort of PCI devices on x86 Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 10/12] PCI: add is_added flag to struct pci_dev Greg Kroah-Hartman
` (2 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
no_pci_devices() should use the driver core list of PCI devices, not our
"separate" one.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/probe.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4d23b9f..5fd662e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -22,16 +22,27 @@ EXPORT_SYMBOL(pci_root_buses);
LIST_HEAD(pci_devices);
+
+static int find_anything(struct device *dev, void *data)
+{
+ return 1;
+}
+
/*
* Some device drivers need know if pci is initiated.
* Basically, we think pci is not initiated when there
- * is no device in list of pci_devices.
+ * is no device to be found on the pci_bus_type.
*/
int no_pci_devices(void)
{
- return list_empty(&pci_devices);
-}
+ struct device *dev;
+ int no_devices;
+ dev = bus_find_device(&pci_bus_type, NULL, NULL, find_anything);
+ no_devices = (dev == NULL);
+ put_device(dev);
+ return no_devices;
+}
EXPORT_SYMBOL(no_pci_devices);
#ifdef HAVE_PCI_LEGACY
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 10/12] PCI: add is_added flag to struct pci_dev
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (8 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 09/12] PCI: make no_pci_devices() use the pci_bus_type list Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 11/12] PCI: remove pcibious_fixup_ghosts() Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 12/12] PCI: remove global list of PCI devices Greg Kroah-Hartman
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
This lets us check if the device is really added to the driver core or
not, which is what we need when walking some of the bus lists. The flag
is there in anticipation of getting rid of the other PCI device list,
which is what we used to check in this situation.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/powerpc/platforms/pseries/pci_dlpar.c | 7 ++-----
drivers/pci/bus.c | 11 ++++-------
drivers/pci/probe.c | 2 +-
drivers/pci/remove.c | 6 ++----
include/linux/pci.h | 1 +
5 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 5a5a19e..d26a7bc 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -88,11 +88,8 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus)
struct pci_dev *dev;
list_for_each_entry(dev, &bus->devices, bus_list) {
- /*
- * Skip already-present devices (which are on the
- * global device list.)
- */
- if (list_empty(&dev->global_list)) {
+ /* Skip already-added devices */
+ if (!dev->is_added) {
int i;
/* Fill device archdata and setup iommu table */
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index ef5a6a2..f2eae65 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -84,6 +84,7 @@ int pci_bus_add_device(struct pci_dev *dev)
if (retval)
return retval;
+ dev->is_added = 1;
down_write(&pci_bus_sem);
list_add_tail(&dev->global_list, &pci_devices);
up_write(&pci_bus_sem);
@@ -112,11 +113,8 @@ void pci_bus_add_devices(struct pci_bus *bus)
int retval;
list_for_each_entry(dev, &bus->devices, bus_list) {
- /*
- * Skip already-present devices (which are on the
- * global device list.)
- */
- if (!list_empty(&dev->global_list))
+ /* Skip already-added devices */
+ if (dev->is_added)
continue;
retval = pci_bus_add_device(dev);
if (retval)
@@ -124,8 +122,7 @@ void pci_bus_add_devices(struct pci_bus *bus)
}
list_for_each_entry(dev, &bus->devices, bus_list) {
-
- BUG_ON(list_empty(&dev->global_list));
+ BUG_ON(!dev->is_added);
/*
* If there is an unattached subordinate bus, attach
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5fd662e..7a1efc1 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -984,7 +984,7 @@ EXPORT_SYMBOL(pci_scan_single_device);
*
* Scan a PCI slot on the specified PCI bus for devices, adding
* discovered devices to the @bus->devices list. New devices
- * will have an empty dev->global_list head.
+ * will not have is_added set.
*/
int pci_scan_slot(struct pci_bus *bus, int devfn)
{
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 9684e1b..d3c77cb 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -18,13 +18,11 @@ static void pci_free_resources(struct pci_dev *dev)
static void pci_stop_dev(struct pci_dev *dev)
{
- if (!dev->global_list.next)
- return;
-
- if (!list_empty(&dev->global_list)) {
+ if (dev->is_added) {
pci_proc_detach_device(dev);
pci_remove_sysfs_dev_files(dev);
device_unregister(&dev->dev);
+ dev->is_added = 0;
down_write(&pci_bus_sem);
list_del(&dev->global_list);
dev->global_list.next = dev->global_list.prev = NULL;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a38c855..b567d37 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -181,6 +181,7 @@ struct pci_dev {
unsigned int transparent:1; /* Transparent PCI bridge */
unsigned int multifunction:1;/* Part of multi-function device */
/* keep track of device state */
+ unsigned int is_added:1;
unsigned int is_busmaster:1; /* device is busmaster */
unsigned int no_msi:1; /* device may not use msi */
unsigned int no_d1d2:1; /* only allow d0 or d3 */
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 11/12] PCI: remove pcibious_fixup_ghosts()
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (9 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 10/12] PCI: add is_added flag to struct pci_dev Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 12/12] PCI: remove global list of PCI devices Greg Kroah-Hartman
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
This function was obviously never being used since early 2.5 days as any
device that it would try to remove would never really be removed from
the system due to the PCI device list being held in the driver core, not
the general list of PCI devices.
As we have not had a single report of a problem here in 4 years, I think
it's safe to remove now.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/frv/mb93090-mb00/pci-vdk.c | 53 --------------------------------------
arch/x86/pci/common.c | 54 ---------------------------------------
2 files changed, 0 insertions(+), 107 deletions(-)
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index 6d51f13..f003cfa 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -199,58 +199,6 @@ static struct pci_ops * __init pci_check_direct(void)
}
/*
- * Several buggy motherboards address only 16 devices and mirror
- * them to next 16 IDs. We try to detect this `feature' on all
- * primary buses (those containing host bridges as they are
- * expected to be unique) and remove the ghost devices.
- */
-
-static void __init pcibios_fixup_ghosts(struct pci_bus *b)
-{
- struct list_head *ln, *mn;
- struct pci_dev *d, *e;
- int mirror = PCI_DEVFN(16,0);
- int seen_host_bridge = 0;
- int i;
-
- for (ln=b->devices.next; ln != &b->devices; ln=ln->next) {
- d = pci_dev_b(ln);
- if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST)
- seen_host_bridge++;
- for (mn=ln->next; mn != &b->devices; mn=mn->next) {
- e = pci_dev_b(mn);
- if (e->devfn != d->devfn + mirror ||
- e->vendor != d->vendor ||
- e->device != d->device ||
- e->class != d->class)
- continue;
- for(i=0; i<PCI_NUM_RESOURCES; i++)
- if (e->resource[i].start != d->resource[i].start ||
- e->resource[i].end != d->resource[i].end ||
- e->resource[i].flags != d->resource[i].flags)
- continue;
- break;
- }
- if (mn == &b->devices)
- return;
- }
- if (!seen_host_bridge)
- return;
- printk("PCI: Ignoring ghost devices on bus %02x\n", b->number);
-
- ln = &b->devices;
- while (ln->next != &b->devices) {
- d = pci_dev_b(ln->next);
- if (d->devfn >= mirror) {
- list_del(&d->global_list);
- list_del(&d->bus_list);
- kfree(d);
- } else
- ln = ln->next;
- }
-}
-
-/*
* Discover remaining PCI buses in case there are peer host bridges.
* We use the number of last PCI bus provided by the PCI BIOS.
*/
@@ -356,7 +304,6 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
#if 0
printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number);
#endif
- pcibios_fixup_ghosts(bus);
pci_read_bridge_bases(bus);
if (bus->number == 0) {
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index a67c1fe..86430d1 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -77,59 +77,6 @@ int pcibios_scanned;
*/
DEFINE_SPINLOCK(pci_config_lock);
-/*
- * Several buggy motherboards address only 16 devices and mirror
- * them to next 16 IDs. We try to detect this `feature' on all
- * primary buses (those containing host bridges as they are
- * expected to be unique) and remove the ghost devices.
- */
-
-static void __devinit pcibios_fixup_ghosts(struct pci_bus *b)
-{
- struct list_head *ln, *mn;
- struct pci_dev *d, *e;
- int mirror = PCI_DEVFN(16,0);
- int seen_host_bridge = 0;
- int i;
-
- DBG("PCI: Scanning for ghost devices on bus %d\n", b->number);
- list_for_each(ln, &b->devices) {
- d = pci_dev_b(ln);
- if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST)
- seen_host_bridge++;
- for (mn=ln->next; mn != &b->devices; mn=mn->next) {
- e = pci_dev_b(mn);
- if (e->devfn != d->devfn + mirror ||
- e->vendor != d->vendor ||
- e->device != d->device ||
- e->class != d->class)
- continue;
- for(i=0; i<PCI_NUM_RESOURCES; i++)
- if (e->resource[i].start != d->resource[i].start ||
- e->resource[i].end != d->resource[i].end ||
- e->resource[i].flags != d->resource[i].flags)
- continue;
- break;
- }
- if (mn == &b->devices)
- return;
- }
- if (!seen_host_bridge)
- return;
- printk(KERN_WARNING "PCI: Ignoring ghost devices on bus %02x\n", b->number);
-
- ln = &b->devices;
- while (ln->next != &b->devices) {
- d = pci_dev_b(ln->next);
- if (d->devfn >= mirror) {
- list_del(&d->global_list);
- list_del(&d->bus_list);
- kfree(d);
- } else
- ln = ln->next;
- }
-}
-
static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
{
struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
@@ -152,7 +99,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *b)
{
struct pci_dev *dev;
- pcibios_fixup_ghosts(b);
pci_read_bridge_bases(b);
list_for_each_entry(dev, &b->devices, bus_list)
pcibios_fixup_device_resources(dev);
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 12/12] PCI: remove global list of PCI devices
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
` (10 preceding siblings ...)
2008-02-15 0:40 ` [PATCH 11/12] PCI: remove pcibious_fixup_ghosts() Greg Kroah-Hartman
@ 2008-02-15 0:40 ` Greg Kroah-Hartman
11 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2008-02-15 0:40 UTC (permalink / raw)
To: linux-pci; +Cc: linux-kernel, pcihpd-discuss, Greg Kroah-Hartman
This patch finally removes the global list of PCI devices. We are
relying entirely on the list held in the driver core now, and do not
need a separate "shadow" list as no one uses it.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/bus.c | 4 ----
drivers/pci/probe.c | 39 +--------------------------------------
drivers/pci/remove.c | 4 ----
include/linux/pci.h | 3 ---
4 files changed, 1 insertions(+), 49 deletions(-)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index f2eae65..2a3ad5d 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -85,10 +85,6 @@ int pci_bus_add_device(struct pci_dev *dev)
return retval;
dev->is_added = 1;
- down_write(&pci_bus_sem);
- list_add_tail(&dev->global_list, &pci_devices);
- up_write(&pci_bus_sem);
-
pci_proc_attach_device(dev);
pci_create_sysfs_dev_files(dev);
return 0;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7a1efc1..1076876 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -20,8 +20,6 @@
LIST_HEAD(pci_root_buses);
EXPORT_SYMBOL(pci_root_buses);
-LIST_HEAD(pci_devices);
-
static int find_anything(struct device *dev, void *data)
{
@@ -860,7 +858,6 @@ struct pci_dev *alloc_pci_dev(void)
if (!dev)
return NULL;
- INIT_LIST_HEAD(&dev->global_list);
INIT_LIST_HEAD(&dev->bus_list);
pci_msi_init_pci_dev(dev);
@@ -957,7 +954,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
* Add the device to our list of discovered devices
* and the bus list for fixup functions, etc.
*/
- INIT_LIST_HEAD(&dev->global_list);
down_write(&pci_bus_sem);
list_add_tail(&dev->bus_list, &bus->devices);
up_write(&pci_bus_sem);
@@ -1186,7 +1182,7 @@ static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head
list_move_tail(&a->dev.knode_bus.n_node, list);
}
-static void __init pci_sort_breadthfirst_klist(void)
+void __init pci_sort_breadthfirst(void)
{
LIST_HEAD(sorted_devices);
struct list_head *pos, *tmp;
@@ -1207,36 +1203,3 @@ static void __init pci_sort_breadthfirst_klist(void)
list_splice(&sorted_devices, &device_klist->k_list);
spin_unlock(&device_klist->k_lock);
}
-
-static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list)
-{
- struct pci_dev *b;
-
- list_for_each_entry(b, list, global_list) {
- if (pci_sort_bf_cmp(a, b) <= 0) {
- list_move_tail(&a->global_list, &b->global_list);
- return;
- }
- }
- list_move_tail(&a->global_list, list);
-}
-
-static void __init pci_sort_breadthfirst_devices(void)
-{
- LIST_HEAD(sorted_devices);
- struct pci_dev *dev, *tmp;
-
- down_write(&pci_bus_sem);
- list_for_each_entry_safe(dev, tmp, &pci_devices, global_list) {
- pci_insertion_sort_devices(dev, &sorted_devices);
- }
- list_splice(&sorted_devices, &pci_devices);
- up_write(&pci_bus_sem);
-}
-
-void __init pci_sort_breadthfirst(void)
-{
- pci_sort_breadthfirst_devices();
- pci_sort_breadthfirst_klist();
-}
-
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index d3c77cb..b682483 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -23,10 +23,6 @@ static void pci_stop_dev(struct pci_dev *dev)
pci_remove_sysfs_dev_files(dev);
device_unregister(&dev->dev);
dev->is_added = 0;
- down_write(&pci_bus_sem);
- list_del(&dev->global_list);
- dev->global_list.next = dev->global_list.prev = NULL;
- up_write(&pci_bus_sem);
}
}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b567d37..511edbf 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -132,7 +132,6 @@ struct pci_cap_saved_state {
* The pci_dev structure is used to describe PCI devices.
*/
struct pci_dev {
- struct list_head global_list; /* node in list of all PCI devices */
struct list_head bus_list; /* node in per-bus list */
struct pci_bus *bus; /* bus this device is on */
struct pci_bus *subordinate; /* bus this device bridges to */
@@ -206,7 +205,6 @@ struct pci_dev {
extern struct pci_dev *alloc_pci_dev(void);
-#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -439,7 +437,6 @@ extern struct bus_type pci_bus_type;
/* Do NOT directly access these two variables, unless you are arch specific pci
* code, or pci core code. */
extern struct list_head pci_root_buses; /* list of all known PCI buses */
-extern struct list_head pci_devices; /* list of all devices */
/* Some device drivers need know if pci is initiated */
extern int no_pci_devices(void);
--
1.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis
2008-02-15 0:40 ` [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis Greg Kroah-Hartman
@ 2008-02-15 22:45 ` Scott Murray
2008-02-19 19:32 ` [Pcihpd-discuss] " Greg KH
0 siblings, 1 reply; 15+ messages in thread
From: Scott Murray @ 2008-02-15 22:45 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-pci, linux-kernel, pcihpd-discuss, Kristen Carlson Accardi
On Thu, 14 Feb 2008, Greg Kroah-Hartman wrote:
> This removes the depandancy of the cpcihp driver from the PCI_LEGACY
> config option by removing its usage of the pci_find_bus() function.
>
>
> Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
> Cc: Scott Murray <scottm@somanetworks.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sorry for the slow reply, this looks fine to me.
Signed-off-by: Scott Murray <scottm@somanetworks.com>
Scott
> ---
> drivers/pci/hotplug/Kconfig | 2 +-
> drivers/pci/hotplug/cpcihp_generic.c | 8 +++++++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
> index 2cdd832..17fb3d6 100644
> --- a/drivers/pci/hotplug/Kconfig
> +++ b/drivers/pci/hotplug/Kconfig
> @@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
>
> config HOTPLUG_PCI_CPCI_GENERIC
> tristate "Generic port I/O CompactPCI Hotplug driver"
> - depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY
> + depends on HOTPLUG_PCI_CPCI && X86
> help
> Say Y here if you have a CompactPCI system card that exposes the #ENUM
> hotswap signal as a bit in a system register that can be read through
> diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c
> index f3852a6..148fb46 100644
> --- a/drivers/pci/hotplug/cpcihp_generic.c
> +++ b/drivers/pci/hotplug/cpcihp_generic.c
> @@ -154,12 +154,18 @@ static int __init cpcihp_generic_init(void)
> if(!r)
> return -EBUSY;
>
> - dev = pci_find_slot(bridge_busnr, PCI_DEVFN(bridge_slot, 0));
> + 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));
> if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
> err("Invalid bridge device %s", bridge);
> return -EINVAL;
> }
> bus = dev->subordinate;
> + pci_dev_put(dev);
>
> memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller));
> generic_hpc_ops.query_enum = query_enum;
>
--
Scott Murray
SOMA Networks, Inc.
Toronto, Ontario
e-mail: scottm@somanetworks.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Pcihpd-discuss] [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis
2008-02-15 22:45 ` Scott Murray
@ 2008-02-19 19:32 ` Greg KH
0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2008-02-19 19:32 UTC (permalink / raw)
To: Scott Murray
Cc: Greg Kroah-Hartman, linux-pci, linux-kernel,
Kristen Carlson Accardi, pcihpd-discuss
On Fri, Feb 15, 2008 at 05:45:47PM -0500, Scott Murray wrote:
> On Thu, 14 Feb 2008, Greg Kroah-Hartman wrote:
>
> > This removes the depandancy of the cpcihp driver from the PCI_LEGACY
> > config option by removing its usage of the pci_find_bus() function.
> >
> >
> > Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
> > Cc: Scott Murray <scottm@somanetworks.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> Sorry for the slow reply, this looks fine to me.
>
> Signed-off-by: Scott Murray <scottm@somanetworks.com>
Great, thanks for reviewing it.
greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2008-02-19 19:40 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 0:39 [RFC] PCI: remove the "shadow" device list Greg KH
2008-02-15 0:39 ` [PATCH 01/12] PCI: remove pci_find_present Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 02/12] PCI: remove pci_get_device_reverse from calgary driver Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 03/12] IDE: remove ide=reverse IDE core Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 04/12] PCI: remove pci_get_device_reverse Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 05/12] PCI: clean up search.c a lot Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 06/12] PCI Hotplug: make cpcihp driver use modern apis Greg Kroah-Hartman
2008-02-15 22:45 ` Scott Murray
2008-02-19 19:32 ` [Pcihpd-discuss] " Greg KH
2008-02-15 0:40 ` [PATCH 07/12] PCI Hotplug: the ibm driver is not dependant on PCI_LEGACY Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 08/12] PCI: remove initial bios sort of PCI devices on x86 Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 09/12] PCI: make no_pci_devices() use the pci_bus_type list Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 10/12] PCI: add is_added flag to struct pci_dev Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 11/12] PCI: remove pcibious_fixup_ghosts() Greg Kroah-Hartman
2008-02-15 0:40 ` [PATCH 12/12] PCI: remove global list of PCI devices Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).