All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] include: linux: pci.h: introduce pci_get_device_by_id()
@ 2019-11-28 12:54 ` Enrico Weigelt, metux IT consult
  0 siblings, 0 replies; 20+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-11-28 12:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: tim, james.morse, rrichter, jdelvare, linux, miquel.raynal,
	richard, vigneshr, linux-crypto, linux-edac, linux-hwmon,
	linux-mtd, linux-pci

From: Enrico Weigelt <info@metux.net>

Introduce a little helper for getting pci device via struct pci_device_id,
helpful for reducing a little bit of boilerplate.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 include/linux/pci.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index eb9f371aa77c..f6650b13724a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1050,6 +1050,21 @@ struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
 
 struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
 			       struct pci_dev *from);
+
+/**
+ * pci_get_device_by_id() - get pci dev by struct pci_device_id
+ * @id: pci_device_id struct
+ *
+ * Retrieve PCI device by struct pci_device_id struct
+ *
+ * @return: pointer to struct pci_dev if sucessful, NULL otherwise
+ */
+static inline struct pci_dev *pci_get_device_by_id(
+	const struct pci_device_id *id)
+{
+	return pci_get_device(id->vendor, id->device, NULL);
+}
+
 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
 			       unsigned int ss_vendor, unsigned int ss_device,
 			       struct pci_dev *from);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-01-08 10:18 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-28 12:54 [PATCH 1/6] include: linux: pci.h: introduce pci_get_device_by_id() Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 2/6] mtd: maps: esb2rom: use pci_get_device_by_id() Enrico Weigelt, metux IT consult
2019-11-28 12:54   ` Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 3/6] mtd: maps: amd76xrom: " Enrico Weigelt, metux IT consult
2019-11-28 12:54   ` Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 4/6] edac: i82443bxgx_edac: " Enrico Weigelt, metux IT consult
2019-11-28 12:54   ` Enrico Weigelt, metux IT consult
2019-11-28 13:28   ` Robert Richter
2019-11-28 13:28     ` Robert Richter
2019-11-28 12:54 ` [PATCH 5/6] char: hw_random: intel-rng: " Enrico Weigelt, metux IT consult
2019-11-28 12:54   ` Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 6/6] (v3) drivers: hwmon: i5k_amb: simplify probing / device identification Enrico Weigelt, metux IT consult
2019-11-28 12:54   ` Enrico Weigelt, metux IT consult
2019-11-28 14:21   ` Guenter Roeck
2019-11-28 14:21     ` Guenter Roeck
2019-12-10 23:25     ` Bjorn Helgaas
2019-12-10 23:25       ` Bjorn Helgaas
2020-01-08 10:16       ` Enrico Weigelt, metux IT consult
2020-01-08 10:16         ` Enrico Weigelt, metux IT consult

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.