Blob Blame History Raw
From 78a9e96e0fa041ac7581aa5fbef8862996855cb7 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 8 Dec 2010 13:45:32 -0500
Subject: [PATCH] Refuse to load if there's a kernel driver bound to the device

Ported from the equivalent check in nv.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 src/vesa.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/vesa.c b/src/vesa.c
index 168fde1..204297e 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -431,8 +431,14 @@ VESAPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev,
     pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL, 
 				NULL, NULL, NULL, NULL, NULL);
     if (pScrn != NULL) {
-	VESAPtr pVesa = VESAGetRec(pScrn);
+	VESAPtr pVesa;
 
+	if (pci_device_has_kernel_driver(dev)) {
+	    ErrorF("Refusing to touch device with a bound kernel driver\n");
+	    return FALSE;
+	}
+
+	pVesa = VESAGetRec(pScrn);
 	VESAInitScrn(pScrn);
 	pVesa->pciInfo = dev;
     }
-- 
1.7.3.2