Badness in pci_find_subsys
Quoted 10 lines · Greg KH
Quoted 8 lines · Tobias Oed
[*]
Do I need to hold thepci_bus_lockspinlock 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 usepci_get_slotinstead ofpci_find_slot, but I don't know how to
get a structpci_bus* from an int.
Quoted 6 lines
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 2004-02-23 18:06:24.292676728 -0500 renamed from search.c.orig 2004-02-23 18:05:41.627162872 -0500 +4 -0
@@ -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