Patch from abbotti@mev.co.uk (Ian Abbott). Note, I am planning
to revert/alter parts of this patch shortly, I am commiting
the original patch so it is clear what I changed.
I've been through the PCI code of all the drivers (apart from the ones in the
addi_data directory) to apply the following rules:
1. Call pci_enable_device before looking at resources. (I didn't do this for
the card list display code in amcc_s5933.c as it's only for debugging; it might
display bogus values on some platforms.)
2. Call pci_request_regions to request all PCI I/O and memory areas. (Some
drivers were calling request_region on a subset of the valid regions, but
pci_request_regions is preferred. Some drivers didn't bother requesting regions
and just used them anyway.)
3. If 1 and 2 succeeded, then when done with the device (on comedi detach), call
pci_release_regions and pci_disable_device. Note that pci_disable_device is not
called if rule 2 failed, because that indicates that the device is being used by
something else (most likely another comedi device).
I've fixed some brokenness along the way, but the amcc_s5933 driver will still
break if more than one client driver uses it (but at least it now works if more
than one device is using that client driver). To fix it properly will require
separate device lists for each vendor ID and maybe a reference count for each of
those lists - a job for another day!
More brokenness in the adv_pci_dio driver has been fixed. It tried to be clever
by keeping a list of PCI devices in use, but its list handling code was
completely broken.
I changed the s626 driver to use pci_get_device and pci_put_device instead of
the old pci_find_device.
I've checked over the changes twice, but am not able to test all the drivers of
course, so I might have introduced an odd bug or two, but I hope not!
31 files changed: