fbdevhw: don't reject pci devices on the fallback probe

Now that we know the root couse of what this code tried to fix,
we can safely remove it.

Fixes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/-/issues/9
Fixes: fc78bcca21
Fixes: a8e41a8190
Fixes: 728b54528d
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1798
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1826

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2025-09-13 13:17:40 +03:00
committed by Enrico Weigelt
parent cf50d3b37b
commit da8a57809e

View File

@@ -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);
}