From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id AD63B378E for ; Thu, 29 Jun 2017 20:22:32 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id y5so4063869wmh.3 for ; Thu, 29 Jun 2017 11:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=icXEjoY3Yn2NgF7plMbby76nShC1Gob8ZSvzapj0tz4=; b=ZNSZqiCdUlGvoBvLWEakK68rSb/lFdFd74KHlKqb0u7+ejHm8VwezX46Qi0HLWjpv/ BGsjx6mzewjq8zrXEareC1EaCgQ9GeLGU9yK2sBiPWYZiifYF9BHYUHSpcilB5G/2GC2 aBvSM691rGC3UgDDfYc3A45L1ZuYgne3A/Exzmc98Y0803CrWt7mCqtMs9BSNHW3CLaz B3GIJcaxN0AN4Fx4WXa22olu9ndb2OCBAiPfaB21AH0+5BpnUczhJAcMRY07a4cMZEk7 CJDw5w0bnnv07XaVVFengRIgVQFWP+8qluInF3+2yiLinGNJq7vmoBhTu4IzuDNY2DbO UVZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=icXEjoY3Yn2NgF7plMbby76nShC1Gob8ZSvzapj0tz4=; b=WnTNVLiXg+4c7IMDiKBAKLcT8hZS7ZOu2angc97aEEmOVB80Hoo7e9R36k+uW4g+H0 XvqhKSBXdvwL4r5DytAzNJ+8Yti/OyA1DOMd3DGDTrf7ifog4GZVqPb/p2e5OssMSv8q ZkxMwp4QC8St7Ugk5Z5+pG4FzhFJ52tE21NJ6TF3QiVjmM5QBxWSkNpPpEk/foEXMOGl 6ltlwm0AmOVv6K9akzo4Z7ubHDIQ08TZ1HYzBI1WskS+pz6zf9pIXSfuS9STKP2/3Bgt ycPdREKGHFthSvQD7eF+8hPJtCYk+uIEFkV+wzDg4wIyP1PUbpe3ztCZCA+cB39liA8Y NNtA== X-Gm-Message-State: AKS2vOz7CpdO/EB8BMEcVd4mOU/8T95JJSrKbNYHNedSUVXASlISd+dh /yvt7YAiqb7nSGqL X-Received: by 10.80.136.110 with SMTP id c43mr2587719edc.171.1498760552293; Thu, 29 Jun 2017 11:22:32 -0700 (PDT) Received: from weierstrass.local ([91.200.110.13]) by smtp.gmail.com with ESMTPSA id e28sm1446366ede.14.2017.06.29.11.22.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 11:22:31 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, shreyansh.jain@nxp.com Date: Thu, 29 Jun 2017 20:21:56 +0200 Message-Id: <20170629182206.1072-6-jblunck@infradead.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170629182206.1072-1-jblunck@infradead.org> References: <20170629182206.1072-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v7 05/15] bus/fslmc: 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, 29 Jun 2017 18:22:32 -0000 Signed-off-by: Jan Blunck --- drivers/bus/fslmc/fslmc_bus.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index b24642d..1e3bbee 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -105,6 +106,27 @@ rte_fslmc_probe(void) return ret; } +static struct rte_device * +rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, + const void *data) +{ + struct rte_dpaa2_device *dev; + bool start_found = !start; + + TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) { + if (!start_found) { + if (&dev->device == start) + start_found = 1; + continue; + } + + if (cmp(&dev->device, data) == 0) + return &dev->device; + } + + return NULL; +} + /*register a fslmc bus based dpaa2 driver */ void rte_fslmc_driver_register(struct rte_dpaa2_driver *driver) @@ -133,6 +155,7 @@ struct rte_fslmc_bus rte_fslmc_bus = { .bus = { .scan = rte_fslmc_scan, .probe = rte_fslmc_probe, + .find_device = rte_fslmc_find_device, }, .device_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.device_list), .driver_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.driver_list), -- 2.9.4