dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libdrm 1/5] xf86drm: use maj/min in drmParsePciDeviceInfo()
@ 2016-11-30 20:35 Emil Velikov
  2016-11-30 20:35 ` [PATCH libdrm 2/5] xf86drm: add plumbing to not retrieve PCI device revision Emil Velikov
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Emil Velikov @ 2016-11-30 20:35 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov

From: Emil Velikov <emil.velikov@collabora.com>

Be consistent with drmParsePciBusInfo() and use solely the device
major/minor pair.

Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
Jonathan, please respin your patches on top of this series.
---
 xf86drm.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index ed924a7..c788c93 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2946,7 +2946,7 @@ static int drmGetMaxNodeName(void)
            3 /* length of the node number */;
 }
 
-static int drmParsePciDeviceInfo(const char *d_name,
+static int drmParsePciDeviceInfo(int maj, int min,
                                  drmPciDeviceInfoPtr device)
 {
 #ifdef __linux__
@@ -2954,7 +2954,7 @@ static int drmParsePciDeviceInfo(const char *d_name,
     unsigned char config[64];
     int fd, ret;
 
-    snprintf(path, PATH_MAX, "/sys/class/drm/%s/device/config", d_name);
+    snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/config", maj, min);
     fd = open(path, O_RDONLY);
     if (fd < 0)
         return -errno;
@@ -2998,7 +2998,7 @@ void drmFreeDevices(drmDevicePtr devices[], int count)
             drmFreeDevice(&devices[i]);
 }
 
-static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
+static int drmProcessPciDevice(drmDevicePtr *device,
                                const char *node, int node_type,
                                int maj, int min, bool fetch_deviceinfo)
 {
@@ -3039,7 +3039,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
         addr += sizeof(drmPciBusInfo);
         (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
 
-        ret = drmParsePciDeviceInfo(d_name, (*device)->deviceinfo.pci);
+        ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci);
         if (ret)
             goto free_device;
     }
@@ -3142,8 +3142,7 @@ int drmGetDevice(int fd, drmDevicePtr *device)
 
         switch (subsystem_type) {
         case DRM_BUS_PCI:
-            ret = drmProcessPciDevice(&d, dent->d_name, node, node_type,
-                                      maj, min, true);
+            ret = drmProcessPciDevice(&d, node, node_type, maj, min, true);
             if (ret)
                 goto free_devices;
 
@@ -3251,7 +3250,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices)
 
         switch (subsystem_type) {
         case DRM_BUS_PCI:
-            ret = drmProcessPciDevice(&device, dent->d_name, node, node_type,
+            ret = drmProcessPciDevice(&device, node, node_type,
                                       maj, min, devices != NULL);
             if (ret)
                 goto free_devices;
-- 
2.10.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH libdrm 1/5] xf86drm: use maj/min in drmParsePciDeviceInfo()
@ 2016-12-02 16:32 Emil Velikov
  2016-12-02 16:32 ` [PATCH libdrm 2/5] xf86drm: add plumbing to not retrieve PCI device revision Emil Velikov
  0 siblings, 1 reply; 9+ messages in thread
From: Emil Velikov @ 2016-12-02 16:32 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov

From: Emil Velikov <emil.velikov@collabora.com>

Be consistent with drmParsePciBusInfo() and use solely the device
major/minor pair.

Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
Jonathan, please respin your patches on top of this series.
---
 xf86drm.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index ed924a7..c788c93 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2946,7 +2946,7 @@ static int drmGetMaxNodeName(void)
            3 /* length of the node number */;
 }
 
-static int drmParsePciDeviceInfo(const char *d_name,
+static int drmParsePciDeviceInfo(int maj, int min,
                                  drmPciDeviceInfoPtr device)
 {
 #ifdef __linux__
@@ -2954,7 +2954,7 @@ static int drmParsePciDeviceInfo(const char *d_name,
     unsigned char config[64];
     int fd, ret;
 
-    snprintf(path, PATH_MAX, "/sys/class/drm/%s/device/config", d_name);
+    snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/config", maj, min);
     fd = open(path, O_RDONLY);
     if (fd < 0)
         return -errno;
@@ -2998,7 +2998,7 @@ void drmFreeDevices(drmDevicePtr devices[], int count)
             drmFreeDevice(&devices[i]);
 }
 
-static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
+static int drmProcessPciDevice(drmDevicePtr *device,
                                const char *node, int node_type,
                                int maj, int min, bool fetch_deviceinfo)
 {
@@ -3039,7 +3039,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
         addr += sizeof(drmPciBusInfo);
         (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
 
-        ret = drmParsePciDeviceInfo(d_name, (*device)->deviceinfo.pci);
+        ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci);
         if (ret)
             goto free_device;
     }
@@ -3142,8 +3142,7 @@ int drmGetDevice(int fd, drmDevicePtr *device)
 
         switch (subsystem_type) {
         case DRM_BUS_PCI:
-            ret = drmProcessPciDevice(&d, dent->d_name, node, node_type,
-                                      maj, min, true);
+            ret = drmProcessPciDevice(&d, node, node_type, maj, min, true);
             if (ret)
                 goto free_devices;
 
@@ -3251,7 +3250,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices)
 
         switch (subsystem_type) {
         case DRM_BUS_PCI:
-            ret = drmProcessPciDevice(&device, dent->d_name, node, node_type,
+            ret = drmProcessPciDevice(&device, node, node_type,
                                       maj, min, devices != NULL);
             if (ret)
                 goto free_devices;
-- 
2.10.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-12-02 16:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 20:35 [PATCH libdrm 1/5] xf86drm: use maj/min in drmParsePciDeviceInfo() Emil Velikov
2016-11-30 20:35 ` [PATCH libdrm 2/5] xf86drm: add plumbing to not retrieve PCI device revision Emil Velikov
2016-11-30 20:35 ` [PATCH libdrm 3/5] xf86drm: parse the separate sysfs files for vendor... info Emil Velikov
2016-11-30 20:35 ` [PATCH libdrm 4/5] xf86drm: introduce drmGetDevice[s]2 Emil Velikov
2016-12-01  3:09   ` Michel Dänzer
2016-12-01  3:56     ` Michel Dänzer
2016-12-01 13:35       ` Emil Velikov
2016-11-30 20:35 ` [PATCH libdrm 5/5] tests/drmdevice: use drmGetDevice[s]2 Emil Velikov
  -- strict thread matches above, loose matches on Subject: below --
2016-12-02 16:32 [PATCH libdrm 1/5] xf86drm: use maj/min in drmParsePciDeviceInfo() Emil Velikov
2016-12-02 16:32 ` [PATCH libdrm 2/5] xf86drm: add plumbing to not retrieve PCI device revision Emil Velikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).