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>
This commit is contained in:
Sascha Hauer 2012-03-03 14:09:26 +01:00 committed by Dave Airlie
parent 456a001e3f
commit 2b6848fcb3

View File

@ -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;