drm: fixup for new sysfs API
authorDave Airlie <airlied@redhat.com>
Thu, 6 Mar 2008 22:56:20 +0000 (08:56 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 6 Mar 2008 22:56:20 +0000 (08:56 +1000)
libdrm/xf86drmMode.c

index 07b14db..f86cc48 100644 (file)
@@ -568,6 +568,25 @@ int drmCheckModesettingSupported(const char *busid)
        if (ret != 4)
                return -EINVAL;
 
+       sprintf(pci_dev_dir, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/drm",
+               domain, bus, dev, func);
+
+       sysdir = opendir(pci_dev_dir);
+       if (sysdir) {
+               dent = readdir(sysdir);
+               while (dent) {
+                       if (!strncmp(dent->d_name, "controlD", 8)) {
+                               found = 1;
+                               break;
+                       }
+               
+                       dent = readdir(sysdir);
+               }
+               closedir(sysdir);
+               if (found)
+                       return 0;
+       }
+
        sprintf(pci_dev_dir, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/",
                domain, bus, dev, func);