Unclaim PCI slot if driver probing fails.

Otherwise no subsequent driver will be able to claim this pci slot.
Example for this: fbdev tries to claim, but framebuffer device is not
available. Later on VESA cannot claim the device.
This commit is contained in:
Matthias Hopf 2009-06-24 18:26:23 +02:00
parent 73abdc94c3
commit 43ee8d2ead
3 changed files with 22 additions and 1 deletions

View File

@ -97,6 +97,7 @@ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
extern _X_EXPORT Bool xf86CheckPciSlot( const struct pci_device * );
extern _X_EXPORT int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *);
extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
int *func);
extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);

View File

@ -495,7 +495,8 @@ probe_devices_from_device_sections(DriverPtr drvp)
if ((*drvp->PciProbe)(drvp, entry, pPci,
devices[j].match_data)) {
foundScreen = TRUE;
}
} else
xf86UnclaimPciSlot(pPci);
}
break;

View File

@ -752,6 +752,25 @@ xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
return -1;
}
/*
* Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim.
*/
void
xf86UnclaimPciSlot(struct pci_device *d)
{
int i;
for (i = 0; i < xf86NumEntities; i++) {
const EntityPtr p = xf86Entities[i];
if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
/* Probably the slot should be deallocated? */
p->bus.type = BUS_NONE;
return;
}
}
}
/*
* Parse a BUS ID string, and return the PCI bus parameters if it was
* in the correct format for a PCI bus id.