[PATCH] pci_get_device

Hi,

The last change to the gsc_hpdi driver makes it use 'pci_get_subsys()' 
to find the PCI device instead of 'pci_find_subsys()' which was removed 
from the 2.6.10 kernel sources.  Unlike pci_find_subsys, the 
pci_get_subsys function increments a usage counter for the last found 
device, which needs to be decremented with a call to 'pci_dev_put()'. 
Calling 'pci_get_subsys()' with the previously found device as a 
starting point also decrements its usage count.

Compatibility definitions for 'pci_get_subsys()' and 'pci_dev_put()' was 
added to comedi's linux/pci.h compatibility header for 2.4 and older 
kernels.

Now I'll get to the point. :-)

The first attached patch "pcicompat.patch" adds two more compatibility 
definitions for 'pci_dev_get()' and 'pci_get_device()'.  The 
'pci_dev_get()' function increments a PCI device's usage count (and also 
returns the supplied PCI device pointer).  The 'pci_get_device()' 
function is like 'pci_find_device()' but increments the usage count like 
'pci_get_subsys()'.

The second attached patch "pciget.patch" updates the drivers to use 
pci_get_device() instead of pci_find_device() and fixes a few other bits 
that seemed to be broken: mostly insufficient checking in the 'detach' 
routines.  My guess is that 'pci_find_device()' is headed the same way 
as 'pci_find_subsys' and will be removed from the 2.6 kernel.

-- 
-=( Ian Abbott _at_ MEV Ltd.    E-mail: <abbotti_at_mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Received on 2005-02-28Z15:02:51