From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 153651B79D for ; Thu, 10 May 2018 00:43:25 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B5D3A2281B; Wed, 9 May 2018 18:43:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 09 May 2018 18:43:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=xb1trWYztZa3ya 3SEfNjHBK9888tVGicqduWww1eSsU=; b=HrmXLHWDEQ6gHQW4m8VtNIjI4DiR2o f3+3zisEds8v/U/hP8EalIh6vYJknojiyY1zXhtQpMpPU6on+j5Lp175lWxsMLCr kmmlZ2Hf6EwFsvdZTr/oeWq3+G+OL/NdHgWVqfl3+73aijZSHgX5yV0H7+DeysTC pHFdFC8YQQes0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=xb1trWYztZa3ya3SEfNjHBK9888tVGicqduWww1eSsU=; b=h270t1v0 E6o4Cfvc6MaDdrMi93A51CinuLDNpCviap5bO5pNMQGL7+34vYPSYO3VNJNtMs0n NUKIO6b9qh3OzaL4DI8ZPUeyK9EUXB/bg3M6p5srwushdIPQlL9lOK2vcJRFk1UW LdVv0X0zgqK7EgAHPg8IX7lMnXU0PN6dpIDqHjY2Fc63twYQqxVl14MrwINDDGt5 Tk31CTt9J2oHWB8MZrwMOLL9aFUrmIdmqZl4+WxtA1i3WI0hd2rMNAhzEAIj3xO8 VKGK/MOjEwQ5WcNlmAAyeExWym1Jny2M/B7m4OLMoKkzCZ2Oiu5lHa4Lg3I/VhyI ifE39Sj8OwlAiA== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 3D95DE46C1 for ; Wed, 9 May 2018 18:43:24 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Date: Thu, 10 May 2018 00:43:06 +0200 Message-Id: <20180509224313.27289-5-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180509224313.27289-1-thomas@monjalon.net> References: <20180509094337.26112-1-thomas@monjalon.net> <20180509224313.27289-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v2 04/11] drivers/net: use higher level of probing helper for PCI 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: Wed, 09 May 2018 22:43:25 -0000 The drivers avp, bnx2x and liquidio were using the helper function rte_eth_dev_pci_allocate() and can be replaced by rte_eth_dev_pci_generic_probe() which calls the former. Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- drivers/net/avp/avp_ethdev.c | 15 ++------------- drivers/net/bnx2x/bnx2x_ethdev.c | 20 +++++--------------- drivers/net/liquidio/lio_ethdev.c | 15 ++------------- 3 files changed, 9 insertions(+), 41 deletions(-) diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 5b3c4cebf..dc97e60e6 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -1048,19 +1048,8 @@ static int eth_avp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { - struct rte_eth_dev *eth_dev; - int ret; - - eth_dev = rte_eth_dev_pci_allocate(pci_dev, - sizeof(struct avp_adapter)); - if (eth_dev == NULL) - return -ENOMEM; - - ret = eth_avp_dev_init(eth_dev); - if (ret) - rte_eth_dev_pci_release(eth_dev); - - return ret; + return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct avp_adapter), + eth_avp_dev_init); } static int diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 6ccbb99c9..7a1e9f583 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -644,24 +644,14 @@ static struct rte_pci_driver rte_bnx2xvf_pmd; static int eth_bnx2x_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) { - struct rte_eth_dev *eth_dev; - int ret; - - eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct bnx2x_softc)); - if (!eth_dev) - return -ENOMEM; - if (pci_drv == &rte_bnx2x_pmd) - ret = eth_bnx2x_dev_init(eth_dev); + return rte_eth_dev_pci_generic_probe(pci_dev, + sizeof(struct bnx2x_softc), eth_bnx2x_dev_init); else if (pci_drv == &rte_bnx2xvf_pmd) - ret = eth_bnx2xvf_dev_init(eth_dev); + return rte_eth_dev_pci_generic_probe(pci_dev, + sizeof(struct bnx2x_softc), eth_bnx2xvf_dev_init); else - ret = -EINVAL; - - if (ret) - rte_eth_dev_pci_release(eth_dev); - - return ret; + return -EINVAL; } static int eth_bnx2x_pci_remove(struct rte_pci_device *pci_dev) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index a13a566f9..0e0b5d84d 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -2110,19 +2110,8 @@ static int lio_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { - struct rte_eth_dev *eth_dev; - int ret; - - eth_dev = rte_eth_dev_pci_allocate(pci_dev, - sizeof(struct lio_device)); - if (eth_dev == NULL) - return -ENOMEM; - - ret = lio_eth_dev_init(eth_dev); - if (ret) - rte_eth_dev_pci_release(eth_dev); - - return ret; + return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct lio_device), + lio_eth_dev_init); } static int -- 2.16.2