From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id A84215A6A for ; Thu, 1 Jun 2017 12:05:03 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id b84so151827446wmh.0 for ; Thu, 01 Jun 2017 03:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sATcZyePfyJY/cXt3RfPDM9Qp/FdUEjfmPYmgQQsPYk=; b=yBw49DifbE980bH4yIPjpLJ8lRHycpr0M+3zW8Ce+1a/fRSj5hRBGBxFQsn+4Lv0el ioZuvi+QHWaO70yhxQqPu/JfffJ38AYAQuEq+cPoykOsSBniqf4E/Bix00y/XDAWMmAu ZtVSAFcjmayYVlHnyQdyq1d4ks2mbKsrcPps3JV07z+7KF7EA+yFNBpozoIb+HuTb209 SyiegOsoIv1z2coGxxqcvfgkt6AQSlqiIGZgIiPjwzreM+ZAWgLmtV+XjdUntpN4TmTY ha0bAdF223eHqwZjTYsZ9LKBlGum3RnrnUinA/A1Jv45Ha9rltLXbeumQxR7PBEAW5ee jcjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sATcZyePfyJY/cXt3RfPDM9Qp/FdUEjfmPYmgQQsPYk=; b=GAFFy1Vs1fe4F2Uzaxnl1kWGa2KRsByha3MJvdBbaNWYnbByURRjjLkWGXydZtSKXE ga8g61kGq2IijI3+ywmVOG5xCuLUiRHimYcTYTStxnbodpefjUmvMJ4iHW8Q7ll3qLRD 9YBnW42BCbb7HdcQ7P6YcIBz6DFj/yiSLnSBPYeZviZ3VWGA9Zq6a3tOIjJN8nhcUi+I xlpQhUtcxhhWNAxI66drAjWvPI0Ffx22Jnk4w2jYoEHhSd0DvWmiW9t9ysokUdYoh3gi Wk0m9H5UUoaoTMcCxKkYockrKKdLOSCgLKy4YyU85ynvwVraHKcezTlyeIod9nVXHEGt Ctbg== X-Gm-Message-State: AODbwcB3gweJfzD2tL5WY2vB0elxhJvORMvWOZdMTuBCCjgqgAEgZplT JDG1Gz12fqH0MF+lAmU= X-Received: by 10.28.43.130 with SMTP id r124mr990597wmr.83.1496311503069; Thu, 01 Jun 2017 03:05:03 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id o24sm700503wro.21.2017.06.01.03.05.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Jun 2017 03:05:01 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 1 Jun 2017 12:04:51 +0200 Message-Id: <9d79d06e063c1337233dac6ab978bb98f52f6375.1496309620.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2] pci: implement find_device bus operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2017 10:05:03 -0000 Signed-off-by: Gaetan Rivet --- v1 --> v2 * Use the newly defined rte_dev_match_t type lib/librte_eal/common/eal_common_pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index b749991..2ab1d65 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -512,10 +512,23 @@ 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(rte_dev_match_t match, 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