All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: implement find_device bus operation
@ 2017-05-24 15:09 Gaetan Rivet
  2017-06-01 10:04 ` [PATCH v2] " Gaetan Rivet
  0 siblings, 1 reply; 4+ messages in thread
From: Gaetan Rivet @ 2017-05-24 15:09 UTC (permalink / raw)
  To: dev; +Cc: Gaetan Rivet, Jan Blunck

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
This patch depends on:

bus: attach / detach API
http://dpdk.org/ml/archives/dev/2017-May/066330.html
http://dpdk.org/dev/patchwork/patch/24489/
---
 lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index b749991..8428006 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -512,10 +512,24 @@ rte_pci_remove_device(struct rte_pci_device *pci_dev)
 	TAILQ_REMOVE(&rte_pci_bus.device_list, pci_dev, next);
 }
 
+static struct rte_device *
+pci_find_device(int (*match)(const struct rte_device *dev, const void *data),
+		const void *data)
+{
+	struct rte_pci_device *dev;
+
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
+		if (match(&dev->device, data))
+			return &dev->device;
+	}
+	return NULL;
+}
+
 struct rte_pci_bus rte_pci_bus = {
 	.bus = {
 		.scan = rte_pci_scan,
 		.probe = rte_pci_probe,
+		.find_device = pci_find_device,
 	},
 	.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),
 	.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),
-- 
2.1.4

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

end of thread, other threads:[~2017-06-21 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 15:09 [PATCH] pci: implement find_device bus operation Gaetan Rivet
2017-06-01 10:04 ` [PATCH v2] " Gaetan Rivet
2017-06-07 23:54   ` [PATCH v3] " Gaetan Rivet
2017-06-21 14:39     ` Thomas Monjalon

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.