svn commit: r361246 - head/sys/compat/linuxkpi/common/include/linux

Emmanuel Vadot manu at FreeBSD.org
Tue May 19 08:44:33 UTC 2020


Author: manu
Date: Tue May 19 08:44:33 2020
New Revision: 361246
URL: https://svnweb.freebsd.org/changeset/base/361246

Log:
  linuxkpi: add pci_dev_present
  
  pci_dev_present shows if a set of pci ids are present in the system.
  It just wraps pci_find_device.
  Needed by DRMv5.2
  
  Submitted by:	Austing Shafer (ashafer at badland.io)
  Differential Revision:	https://reviews.freebsd.org/D24796

Modified:
  head/sys/compat/linuxkpi/common/include/linux/pci.h

Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/pci.h	Tue May 19 08:43:17 2020	(r361245)
+++ head/sys/compat/linuxkpi/common/include/linux/pci.h	Tue May 19 08:44:33 2020	(r361246)
@@ -1050,4 +1050,16 @@ extern int linux_pci_attach_device(device_t, struct pc
     const struct pci_device_id *, struct pci_dev *);
 extern int linux_pci_detach_device(struct pci_dev *);
 
+static inline int
+pci_dev_present(const struct pci_device_id *cur)
+{
+	while (cur != NULL && (cur->vendor || cur->device)) {
+		if (pci_find_device(cur->vendor, cur->device) != NULL) {
+			return (1);
+		}
+		cur++;
+	}
+	return (0);
+}
+
 #endif	/* _LINUX_PCI_H_ */


More information about the svn-src-head mailing list