aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov2016-11-30 10:41:27 -0600
committerEmil Velikov2016-12-05 11:17:22 -0600
commitb40a65d44857394966b25c5587f9dc978643f9c4 (patch)
tree54b3d963be470c1379d18671acd7ea4e801e2db7 /xf86drm.c
parentdae413e43866d36500538c2801cc66a5a89e426d (diff)
downloadexternal-libgbm-b40a65d44857394966b25c5587f9dc978643f9c4.tar.gz
external-libgbm-b40a65d44857394966b25c5587f9dc978643f9c4.tar.xz
external-libgbm-b40a65d44857394966b25c5587f9dc978643f9c4.zip
xf86drm: use maj/min in drmParsePciDeviceInfo()
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>
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/xf86drm.c b/xf86drm.c
index ed924a74..c788c932 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2946,7 +2946,7 @@ static int drmGetMaxNodeName(void)
2946 3 /* length of the node number */; 2946 3 /* length of the node number */;
2947} 2947}
2948 2948
2949static int drmParsePciDeviceInfo(const char *d_name, 2949static int drmParsePciDeviceInfo(int maj, int min,
2950 drmPciDeviceInfoPtr device) 2950 drmPciDeviceInfoPtr device)
2951{ 2951{
2952#ifdef __linux__ 2952#ifdef __linux__
@@ -2954,7 +2954,7 @@ static int drmParsePciDeviceInfo(const char *d_name,
2954 unsigned char config[64]; 2954 unsigned char config[64];
2955 int fd, ret; 2955 int fd, ret;
2956 2956
2957 snprintf(path, PATH_MAX, "/sys/class/drm/%s/device/config", d_name); 2957 snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/config", maj, min);
2958 fd = open(path, O_RDONLY); 2958 fd = open(path, O_RDONLY);
2959 if (fd < 0) 2959 if (fd < 0)
2960 return -errno; 2960 return -errno;
@@ -2998,7 +2998,7 @@ void drmFreeDevices(drmDevicePtr devices[], int count)
2998 drmFreeDevice(&devices[i]); 2998 drmFreeDevice(&devices[i]);
2999} 2999}
3000 3000
3001static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name, 3001static int drmProcessPciDevice(drmDevicePtr *device,
3002 const char *node, int node_type, 3002 const char *node, int node_type,
3003 int maj, int min, bool fetch_deviceinfo) 3003 int maj, int min, bool fetch_deviceinfo)
3004{ 3004{
@@ -3039,7 +3039,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
3039 addr += sizeof(drmPciBusInfo); 3039 addr += sizeof(drmPciBusInfo);
3040 (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; 3040 (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
3041 3041
3042 ret = drmParsePciDeviceInfo(d_name, (*device)->deviceinfo.pci); 3042 ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci);
3043 if (ret) 3043 if (ret)
3044 goto free_device; 3044 goto free_device;
3045 } 3045 }
@@ -3142,8 +3142,7 @@ int drmGetDevice(int fd, drmDevicePtr *device)
3142 3142
3143 switch (subsystem_type) { 3143 switch (subsystem_type) {
3144 case DRM_BUS_PCI: 3144 case DRM_BUS_PCI:
3145 ret = drmProcessPciDevice(&d, dent->d_name, node, node_type, 3145 ret = drmProcessPciDevice(&d, node, node_type, maj, min, true);
3146 maj, min, true);
3147 if (ret) 3146 if (ret)
3148 goto free_devices; 3147 goto free_devices;
3149 3148
@@ -3251,7 +3250,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices)
3251 3250
3252 switch (subsystem_type) { 3251 switch (subsystem_type) {
3253 case DRM_BUS_PCI: 3252 case DRM_BUS_PCI:
3254 ret = drmProcessPciDevice(&device, dent->d_name, node, node_type, 3253 ret = drmProcessPciDevice(&device, node, node_type,
3255 maj, min, devices != NULL); 3254 maj, min, devices != NULL);
3256 if (ret) 3255 if (ret)
3257 goto free_devices; 3256 goto free_devices;