[PATCH libdrm 2/4] kms: remove commented out libudev code

Emil Velikov emil.l.velikov at gmail.com
Wed Nov 30 20:37:05 UTC 2016


Cc: Jakob Bornecrantz <wallbraker at gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
Jakob, seems like libkms did not get the traction one would have
expected. With gbm, mini-gbm around and plans brewing for gbm2/liballoc
should we keep the library around ?

Afaict there hasn't been any distributions building/shipping it in a
while.
---
 libkms/Makefile.am |  4 ---
 libkms/linux.c     | 94 ------------------------------------------------------
 2 files changed, 98 deletions(-)

diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 7c1debe..461fc35 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -10,10 +10,6 @@ libkms_ladir = $(libdir)
 libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined
 libkms_la_LIBADD = ../libdrm.la
 
-#if HAVE_LIBUDEV
-#libkms_la_LIBADD += $(LIBUDEV_LIBS)
-#endif
-
 libkms_la_SOURCES = $(LIBKMS_FILES)
 
 if HAVE_VMWGFX
diff --git a/libkms/linux.c b/libkms/linux.c
index 69eb1aa..0b50777 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -141,105 +141,11 @@ linux_from_sysfs(int fd, struct kms_driver **out)
 	return ret;
 }
 
-#if 0
-#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
-#include <libudev.h>
-
-struct create_record
-{
-	unsigned vendor;
-	unsigned chip;
-	int (*func)(int fd, struct kms_driver **out);
-};
-
-static const struct create_record table[] = {
-	{ 0x8086, 0x2a42, intel_create }, /* i965 */
-#ifdef HAVE_VMWGFX
-	{ 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */
-#endif
-	{ 0, 0, NULL },
-};
-
-static int
-linux_get_pciid_from_fd(int fd, unsigned *vendor_id, unsigned *chip_id)
-{
-	struct udev *udev;
-	struct udev_device *device;
-	struct udev_device *parent;
-	const char *pci_id;
-	struct stat buffer;
-	int ret;
-
-	ret = fstat(fd, &buffer);
-	if (ret)
-		return -EINVAL;
-
-	if (!S_ISCHR(buffer.st_mode))
-		return -EINVAL;
-
-	udev = udev_new();
-	if (!udev)
-		return -ENOMEM;
-
-	device = udev_device_new_from_devnum(udev, 'c', buffer.st_rdev);
-	if (!device)
-		goto err_free_udev;
-
-	parent = udev_device_get_parent(device);
-	if (!parent)
-		goto err_free_device;
-
-	pci_id = udev_device_get_property_value(parent, "PCI_ID");
-	if (!pci_id)
-		goto err_free_device;
-
-	if (sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2)
-		goto err_free_device;
-
-	udev_device_unref(device);
-	udev_unref(udev);
-
-	return 0;
-
-err_free_device:
-	udev_device_unref(device);
-err_free_udev:
-	udev_unref(udev);
-	return -EINVAL;
-}
-
-static int
-linux_from_udev(int fd, struct kms_driver **out)
-{
-	unsigned vendor_id, chip_id;
-	int ret, i;
-
-	ret = linux_get_pciid_from_fd(fd, &vendor_id, &chip_id);
-	if (ret)
-		return ret;
-
-	for (i = 0; table[i].func; i++)
-		if (table[i].vendor == vendor_id && table[i].chip == chip_id)
-			return table[i].func(fd, out);
-
-	return -ENOSYS;
-}
-#else
-static int
-linux_from_udev(int fd, struct kms_driver **out)
-{
-	return -ENOSYS;
-}
-#endif
-
 drm_private int
 linux_create(int fd, struct kms_driver **out)
 {
 	if (!dumb_create(fd, out))
 		return 0;
 
-	if (!linux_from_udev(fd, out))
-		return 0;
-
 	return linux_from_sysfs(fd, out);
 }
-- 
2.10.2



More information about the dri-devel mailing list