Modify xf86FindPciDeviceVendor and xf86FindPciClass to use the
pci_interator interface instead of the xf86PciVideoInfo array.
This commit is contained in:
parent
23f44df900
commit
de8234606f
@ -1038,42 +1038,62 @@ xf86CheckPciSlot( const struct pci_device * d )
|
|||||||
* _excluded if required.
|
* _excluded if required.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT struct pci_device *
|
_X_EXPORT struct pci_device *
|
||||||
xf86FindPciDeviceVendor( CARD16 vendorID, CARD16 deviceID,
|
xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
|
||||||
char n, const struct pci_device * exclude )
|
char n, const struct pci_device * exclude)
|
||||||
{
|
{
|
||||||
struct pci_device * pvp;
|
struct pci_device *dev;
|
||||||
struct pci_device ** ppvp;
|
struct pci_id_match m;
|
||||||
|
struct pci_device_iterator *iter;
|
||||||
|
|
||||||
|
m.vendor_id = vendorID;
|
||||||
|
m.device_id = deviceID;
|
||||||
|
m.subvendor_id = PCI_MATCH_ANY;
|
||||||
|
m.subdevice_id = PCI_MATCH_ANY;
|
||||||
|
m.device_class = 0;
|
||||||
|
m.device_class_mask = 0;
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) {
|
iter = pci_id_match_iterator_create(& m);
|
||||||
if ( (pvp != exclude) && (pvp->vendor_id == vendorID)
|
while ((dev = pci_device_next(iter)) != NULL) {
|
||||||
&& (pvp->device_id == deviceID) ) {
|
if ((dev != exclude) && !(--n)) {
|
||||||
if (!(--n)) break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pvp;
|
pci_iterator_destroy(iter);
|
||||||
|
|
||||||
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT struct pci_device *
|
_X_EXPORT struct pci_device *
|
||||||
xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 _class,
|
xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 _class,
|
||||||
char n, const struct pci_device * exclude)
|
char n, const struct pci_device * exclude)
|
||||||
{
|
{
|
||||||
struct pci_device * pvp;
|
struct pci_device *dev;
|
||||||
struct pci_device ** ppvp;
|
struct pci_id_match m;
|
||||||
const uint32_t device_class = ( ((uint32_t)_class) << 16)
|
struct pci_device_iterator *iter;
|
||||||
| ( ((uint32_t)subClass) << 8) | intf;
|
|
||||||
|
m.vendor_id = PCI_MATCH_ANY;
|
||||||
|
m.device_id = PCI_MATCH_ANY;
|
||||||
|
m.subvendor_id = PCI_MATCH_ANY;
|
||||||
|
m.subdevice_id = PCI_MATCH_ANY;
|
||||||
|
m.device_class = (((uint32_t)_class) << 16)
|
||||||
|
| (((uint32_t)subClass) << 8) | intf;
|
||||||
|
m.device_class_mask = 0x00ffffff;
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) {
|
iter = pci_id_match_iterator_create(& m);
|
||||||
if ( (pvp != exclude) && (pvp->device_class == device_class) ) {
|
while ((dev = pci_device_next(iter)) != NULL) {
|
||||||
if (!(--n)) break;
|
if ((dev != exclude) && !(--n)) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pvp;
|
pci_iterator_destroy(iter);
|
||||||
|
|
||||||
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user