From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id AD5AA58F6 for ; Mon, 26 Jun 2017 02:22:36 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id r103so131769624wrb.0 for ; Sun, 25 Jun 2017 17:22:36 -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 :in-reply-to:references; bh=pA+mU8pfYda+efMirka/XDvMtihMZQK9G6sWVci2qvQ=; b=Q+zaynNWBh111wdc0AtEEg7KHFvdrG7KzcSdBxCkzw5wHkSCP8JeHMDhBZWa89eZpb rKQG8W1hehLI4MSezrD7oVHZ6W4l76kwoDyo2mDZ04nKzcWxxDkVdPJHYF69moU0d9Zj 7qKiPh3aJa+Vhry9qVqVx+F5KRo69uLn6fSV8dhTscbLwvodAX/Wa/6Vk3tzHn1ntp49 FAoZrAyHsQcrcW2Gwmv0neMazSOx2rr2prGlu4dg75pZRwqYtd95KjD6v09WCFsFJbc7 P0YRAB8GWjZBDrUFwes9/ZDZOas14yZSbI5F78Eo8zw3RI9997OY5bmznM2JfA3LAg5h PUdw== 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:in-reply-to:references; bh=pA+mU8pfYda+efMirka/XDvMtihMZQK9G6sWVci2qvQ=; b=dmRJVUHpAIUWTh9L5tpfC/y3hPT3LaYHY8SYv+rayinMG3bqcWASfmbSk2EGWKIYHk q//4b6008qtjFRoIQwp3evYKk8riKrdnkZPNxPvVRDsT7BRp6C0jUL3B4+dApsG3XH0I YaDzWPQi1gO5E17OX6Mbns+eBs3usdhq+XYmdzZXU/6ZyNxjSCK6nE9/DEl22M6NgUmP Iur8JrFRQShpi1mX9D1+aV07J8nSTAGDdDTu6iLSL9kmuoimN1CwBVcXJYrxfCjVdy6H KVZzoNs9TeWVuIvXFrQ26jXNjfNW95Y9WembG9r7g8c+cfq2dNusEZVlV+d9gIBq9koY /O5A== X-Gm-Message-State: AKS2vOzUhO7UxrSFmgPJFCDrFt1707r1pG0VmxL3aJHWMn3vC6W4fEob bfbnu6ZYidzNsLQQDQ4= X-Received: by 10.28.232.67 with SMTP id f64mr3583093wmh.54.1498436555989; Sun, 25 Jun 2017 17:22:35 -0700 (PDT) Received: from bidouze.dev.6wind.com ([62.23.145.78]) by smtp.gmail.com with ESMTPSA id 19sm16061626wrx.26.2017.06.25.17.22.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Jun 2017 17:22:35 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Mon, 26 Jun 2017 02:22:08 +0200 Message-Id: <73ac68500e9be8dc593f5aa21b8f7abb9735caa1.1498436062.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 10/12] 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: Mon, 26 Jun 2017 00:22:37 -0000 Signed-off-by: Gaetan Rivet --- 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 78b097e..00d48d9 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -488,10 +488,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_cmp_t cmp, const void *data) +{ + struct rte_pci_device *dev; + + FOREACH_DEVICE_ON_PCIBUS(dev) { + if (cmp(&dev->device, data) == 0) + 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