summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-02-19 11:47:55 +0100
committerThierry Reding <treding@nvidia.com>2014-07-09 11:44:56 +0200
commita307cef92d0f0427b13b59c861d5dfee6b9494f1 (patch)
tree97071e4202a303a547bb0158da568415ea38d244
parentf123b71974eba9149792a5f4fbd0c6ee1bff4410 (diff)
Always open device by path
Using drmOpen() isn't a particularily good idea, since it will try to open potentially many devices and doesn't necessarily find the device that we want. Instead, rely on X to provide a path to the device. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--src/driver.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/driver.c b/src/driver.c
index 63f24a0..dbd5747 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -772,12 +772,12 @@ static Bool
TegraPlatformProbe(DriverPtr driver, int entity_num, int flags,
struct xf86_platform_device *dev, intptr_t match_data)
{
- char *busid = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_BUSID);
+ char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
ScrnInfoPtr scrn = NULL;
int fd;
- fd = drmOpen(NULL, busid);
- if (fd != -1) {
+ fd = open(path, O_RDWR);
+ if (fd >= 0) {
scrn = xf86AllocateScreen(driver, 0);
xf86AddEntityToScreen(scrn, entity_num);
@@ -793,10 +793,7 @@ TegraPlatformProbe(DriverPtr driver, int entity_num, int flags,
scrn->FreeScreen = TegraFreeScreen;
scrn->ValidMode = TegraValidMode;
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "using %s\n",
- busid ? busid : "default device");
-
- drmClose(fd);
+ close(fd);
}
return scrn != NULL;