summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-03-03 14:09:26 +0100
committerDave Airlie <airlied@redhat.com>2012-03-05 15:19:09 +0000
commita9bc885e92ac1c34d6630e2331c4fbfb8876b09f (patch)
tree105699da9203bf87b358dba0a9dfc476f22f9d04
parent90caeb0839a7bd0f0e49e6ad0d8bd948e1fd9faa (diff)
Fix non PCI device probing
When no devicename is found in the option then the driver probes by PciInfo no matter if it's valid or not. Instead of doing this use PciInfo only when it's valid and fall back to the devicename otherwise. With devicename probing use open_hw() to fall back on the KMSDEVICE environment variable or to the default device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/driver.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/driver.c b/src/driver.c
index dc90e04..45643a8 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -418,8 +418,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
if (ms->pEnt->location.type != BUS_PCI)
return FALSE;
- ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
-
/* Allocate an entity private if necessary */
if (xf86IsEntityShared(pScrn->entityList[0])) {
msEnt = xf86GetEntityPrivate(pScrn->entityList[0],
@@ -465,8 +463,8 @@ PreInit(ScrnInfoPtr pScrn, int flags)
memcpy(ms->Options, Options, sizeof(Options));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
- devicename = xf86GetOptValString(ms->Options, OPTION_DEVICE_PATH);
- if (!devicename) {
+ ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
+ if (ms->PciInfo) {
BusID = malloc(64);
sprintf(BusID, "PCI:%d:%d:%d",
#if XSERVER_LIBPCIACCESS
@@ -481,7 +479,8 @@ PreInit(ScrnInfoPtr pScrn, int flags)
ms->fd = drmOpen(NULL, BusID);
} else {
- ms->fd = open(devicename, O_RDWR, 0);
+ devicename = xf86GetOptValString(ms->Options, OPTION_DEVICE_PATH);
+ ms->fd = open_hw(devicename);
}
if (ms->fd < 0)
return FALSE;