Re: Badness in pci_find_subsys

From: Tobias Oed
Date: Mon Feb 23 2004 - 18:17:55 EST


Greg KH wrote:

On Mon, Feb 23, 2004 at 08:51:45AM -0800, Tobias Oed wrote:
[*]
Do I need to hold the pci_bus_lock spinlock for the following (checks for
NULL omitted here)
dev = pci_find_slot(bus, PCI_DEVFN(slot, function));
dev = pci_dev_get(dev);
I'd rater use pci_get_slot instead of pci_find_slot, but I don't know how
to
get a struct pci_bus * from an int.

You should never need to use those functions at all anyway. Just use
the proper pci_register_driver() call and be done with it.

thanks,

greg k-h

Thanks for pointing that out. I don't know what I'm doing and starting by trying to fix a closed source driver is not making it any easier.
As Robin Rosenberg said elsethread, you may want to consider the following patch to warn programmers more consistently
Cheers, Tobias.
--- search.c.orig 2004-02-23 18:05:41.627162872 -0500
+++ search.c 2004-02-23 18:06:24.292676728 -0500
@@ -90,6 +90,10 @@
* is located in system global list of PCI devices. If the device
* is found, a pointer to its data structure is returned. If no
* device is found, %NULL is returned.
+ *
+ * NOTE: Do not use this function anymore, 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)

_________________________________________________________________
Dream of owning a home? Find out how in the First-time Home Buying Guide. http://special.msn.com/home/firsthome.armx

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/