From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 479FC37A6 for ; Fri, 30 Jun 2017 20:20:07 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id p204so9336240wmg.1 for ; Fri, 30 Jun 2017 11:20:07 -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=FMJMQla20EslUOznYhoUKtlmNHvOdtjfYhZcgY73bs6et65BU9b5QasXNelCUgOhhL gS9S6QOweQQOtCosvlmjo8t5D2ZGUcLEXOw5FoytpmYNIdb+tx0o0tTQ6q/PMamGnoxB 6wqULDj5QPJmAtrGC4v2E9BMBnMJwXcxghYMKDYvhSMRSy3g7lznzmpSmn/1ZT1+vWnJ V6Z7O2xWlhH0GfFz3KI7r836vnjcc4eZVMs/nzal6f2RvM7/GJVm0cWJuribwTW7mLam PDRgZcdiIZc17K/6YfoZNy3YYkKFGOhKNKynSSvmS1SOUs7qyr9V3cDk6nJXKzevEvoc hw7g== 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=r2bfmWjhAX2QL3k+tqtFz5ZGpXViaZkOxa5Np5w2SiIKJdTOvs3x179X+u0DlpyhWb yuNu/aGIk82DmKzs5JMjbf3bIukQDkc2PNbKAxHnEekWlItB+bZAHpWsjzCimdIpl3+r HzhRZ6doFLuT4n2oSmW3zGN0f6VfOJvhZAeXFQv48Hb0XC7yoBvogSFRGpbU1oXVQNFB /n4ypDk1+KK6Kb9JcDiy2qJJBmrZEyvJioAndVlVsNrTHVcszdj/F3rLehlC+/xJCQQu a3xX5m0XYmOWYSejwB1aLEslnkN+qwIVBOoCWuscVf/t4W/XbQuB30Ac6JN0DrcpBh/P Hd9Q== X-Gm-Message-State: AKS2vOzaeBeY9vh6q9fIVXGaPJbRZ3SGfaGF2g14EJvdD3uMloNMcJak Fb+TMd05WOBHmEfM X-Received: by 10.80.224.206 with SMTP id j14mr6437364edl.107.1498846806935; Fri, 30 Jun 2017 11:20:06 -0700 (PDT) Received: from weierstrass.local ([91.200.110.13]) by smtp.gmail.com with ESMTPSA id r28sm2826940edd.33.2017.06.30.11.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 11:20:06 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, shreyansh.jain@nxp.com Date: Fri, 30 Jun 2017 20:19:34 +0200 Message-Id: <20170630181943.23929-6-jblunck@infradead.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170630181943.23929-1-jblunck@infradead.org> References: <20170629182206.1072-1-jblunck@infradead.org> <20170630181943.23929-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v8 05/14] 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: Fri, 30 Jun 2017 18:20:07 -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