xf86drm: rename "real_path" to "pci_path"

"real_path" was getting confusing when there are other *paths in the
same functions.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
main
Eric Engestrom 2018-09-05 13:29:08 +01:00
parent 564995316e
commit 9030a0f453
1 changed files with 13 additions and 13 deletions

View File

@ -2999,17 +2999,17 @@ static int drmParseSubsystemType(int maj, int min)
} }
static void static void
get_real_pci_path(int maj, int min, char *real_path) get_pci_path(int maj, int min, char *pci_path)
{ {
char path[PATH_MAX + 1], *term; char path[PATH_MAX + 1], *term;
snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min); snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
if (!realpath(path, real_path)) { if (!realpath(path, pci_path)) {
strcpy(real_path, path); strcpy(pci_path, path);
return; return;
} }
term = strrchr(real_path, '/'); term = strrchr(pci_path, '/');
if (term && strncmp(term, "/virtio", 7) == 0) if (term && strncmp(term, "/virtio", 7) == 0)
*term = 0; *term = 0;
} }
@ -3018,12 +3018,12 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
{ {
#ifdef __linux__ #ifdef __linux__
unsigned int domain, bus, dev, func; unsigned int domain, bus, dev, func;
char real_path[PATH_MAX + 1], *value; char pci_path[PATH_MAX + 1], *value;
int num; int num;
get_real_pci_path(maj, min, real_path); get_pci_path(maj, min, pci_path);
value = sysfs_uevent_get(real_path, "PCI_SLOT_NAME"); value = sysfs_uevent_get(pci_path, "PCI_SLOT_NAME");
if (!value) if (!value)
return -ENOENT; return -ENOENT;
@ -3136,15 +3136,15 @@ static int parse_separate_sysfs_files(int maj, int min,
"subsystem_vendor", "subsystem_vendor",
"subsystem_device", "subsystem_device",
}; };
char path[PATH_MAX + 1], real_path[PATH_MAX + 1]; char path[PATH_MAX + 1], pci_path[PATH_MAX + 1];
unsigned int data[ARRAY_SIZE(attrs)]; unsigned int data[ARRAY_SIZE(attrs)];
FILE *fp; FILE *fp;
int ret; int ret;
get_real_pci_path(maj, min, real_path); get_pci_path(maj, min, pci_path);
for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) { for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) {
snprintf(path, PATH_MAX, "%s/%s", real_path, attrs[i]); snprintf(path, PATH_MAX, "%s/%s", pci_path, attrs[i]);
fp = fopen(path, "r"); fp = fopen(path, "r");
if (!fp) if (!fp)
return -errno; return -errno;
@ -3168,13 +3168,13 @@ static int parse_separate_sysfs_files(int maj, int min,
static int parse_config_sysfs_file(int maj, int min, static int parse_config_sysfs_file(int maj, int min,
drmPciDeviceInfoPtr device) drmPciDeviceInfoPtr device)
{ {
char path[PATH_MAX + 1], real_path[PATH_MAX + 1]; char path[PATH_MAX + 1], pci_path[PATH_MAX + 1];
unsigned char config[64]; unsigned char config[64];
int fd, ret; int fd, ret;
get_real_pci_path(maj, min, real_path); get_pci_path(maj, min, pci_path);
snprintf(path, PATH_MAX, "%s/config", real_path); snprintf(path, PATH_MAX, "%s/config", pci_path);
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd < 0) if (fd < 0)
return -errno; return -errno;