File 0001-Unclaim-PCI-slot-if-driver-probing-fails.patch of Package xorg-x11-server
From 593348b46a21c6f291194fa9ff61bd5bc7c5cb9f Mon Sep 17 00:00:00 2001
From: Matthias Hopf <mhopf@suse.de>
Date: Wed, 24 Jun 2009 18:26:23 +0200
Subject: [PATCH] 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.
---
 hw/xfree86/common/xf86.h       |    1 +
 hw/xfree86/common/xf86Init.c   |    3 ++-
 hw/xfree86/common/xf86pciBus.c |   19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)
Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86.h
===================================================================
--- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86.h
+++ xorg-server-1.6.3.901/hw/xfree86/common/xf86.h
@@ -97,6 +97,7 @@ extern Bool xf86DRI2Enabled(void);
 Bool xf86CheckPciSlot( const struct pci_device * );
 int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
 		     int chipset, GDevPtr dev, Bool active);
+void xf86UnclaimPciSlot(struct pci_device *);
 Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
 			   int *func);
 Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86Init.c
===================================================================
--- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86Init.c
+++ xorg-server-1.6.3.901/hw/xfree86/common/xf86Init.c
@@ -514,7 +514,8 @@ probe_devices_from_device_sections(Drive
 		    if ((*drvp->PciProbe)(drvp, entry, pPci,
 					  devices[j].match_data)) {
 			foundScreen = TRUE;
-		    }
+		    } else
+			xf86UnclaimPciSlot(pPci);
 		}
 
 		break;
Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86pciBus.c
===================================================================
--- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86pciBus.c
+++ xorg-server-1.6.3.901/hw/xfree86/common/xf86pciBus.c
@@ -753,6 +753,25 @@ xf86ClaimPciSlot(struct pci_device * d,
 }
 
 /*
+ * 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.
  */