diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 95ea7096ff..0cb19724aa 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -338,31 +338,6 @@ fbdev_open_pci(int scrnIndex, struct pci_device *pPci, const char *device, char return -1; } -/* * - * Try to resolve a filename as symbolic link. If the file is not a link, the - * original filename is returned. NULL is returned if readlink raised an - * error. - */ -static const char * -resolve_link(const char *filename, char *resolve_buf, size_t resolve_buf_size) -{ - ssize_t len = readlink(filename, resolve_buf, resolve_buf_size - 1); - /* if it is a link resolve it */ - if (len >= 0) { - resolve_buf[len] = '\0'; - return resolve_buf; - } - else { - if (errno == EINVAL) { - return filename; - } - else { - /* Have caller handle error condition */ - return NULL; - } - } -} - static int fbdev_open(int scrnIndex, const char *dev, char **namep) { @@ -371,7 +346,7 @@ fbdev_open(int scrnIndex, const char *dev, char **namep) fd = check_user_devices(scrnIndex, dev, namep); if (fd != -1) { - /* fbdev was provided by the user and not guessed, skip non-pci check */ + /* fbdev was provided by the user and not guessed, just return it */ return fd; } @@ -391,40 +366,6 @@ fbdev_open(int scrnIndex, const char *dev, char **namep) return -1; } - /* only touch non-PCI devices on this path */ - /* TODO: Should we keep doing this? */ - { - char device_path_buf[PATH_MAX]; - char buf[PATH_MAX] = {0}; - char *sysfs_path = NULL; - char const *real_dev = resolve_link(dev, device_path_buf, - sizeof(device_path_buf)); - if (real_dev == NULL) { - xf86DrvMsg(scrnIndex, X_ERROR, - "Failed resolving symbolic link for device '%s': %s", - dev, strerror(errno)); - return -1; - } - - const char *node = strrchr(real_dev, '/'); - - if (node == NULL) { - node = real_dev; - } - else { - node++; - } - - if (asprintf(&sysfs_path, "/sys/class/graphics/%s/device/subsystem", node) < 0 || - readlink(sysfs_path, buf, sizeof(buf) - 1) < 0 || - strstr(buf, "bus/pci")) { - free(sysfs_path); - close(fd); - return -1; - } - free(sysfs_path); - } - return set_name(scrnIndex, fd, namep, TRUE, TRUE); }