Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2020 08:44:33 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361246 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <202005190844.04J8iXrB031893@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005190844.04J8iXrB031893>