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 56F971BBA5 for ; Fri, 11 May 2018 01:58:48 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 063EE227FE; Thu, 10 May 2018 19:58:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 10 May 2018 19:58:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=b7yJ56Td2zB2PV 7zWMDMcZDRyCOMyVMjBb+lY3eu8DQ=; b=pXc8ueROmiZ9Ijr90mfAoJ4P6GL4nj faOUFffCJ1yBLE7LtE5hgyAtOqwipyVBccSP+8itGud5ILW5CeZaEgyQ8kYMZd8S TEx7JwXRWcBwjECGfzrn+J0nzu/IOb7FX57nKpheGbc4+V2O8gOjHvF7GXhrAagI C/Y4JIn205lB8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=b7yJ56Td2zB2PV7zWMDMcZDRyCOMyVMjBb+lY3eu8DQ=; b=DtB3MEwj BDu1woouJidikudZBVbMXw6tYA4zVwc2gj77QRqVYX4j37O91W63Bkw+Cq5yX8Jd X9VWiG6edhM5cvNKx6Lj3dKe8kHjhKJYogaH2WHk7iLXtaRpKt96viCCS1uaN+FI SLz0I3YTDerByrorjrZddf6zbXwjYSCoUUKDjogJUdxr6EE8PrxA2G5advdB/V3C QhUrrhD2UlisVI+lDx++PefXQymX47bUQbjNYOmbptEdi7hetiF10PfPa4lHjCsY UE2xGtGf2VhDbdJ8kJPnYbtByJXTcINGDcMWVhpAYX1kHKlpBIndjaELfrGQVe/o Q/Aax/88NSRC9Q== 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 1E667E442F; Thu, 10 May 2018 19:58:47 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: matan@mellanox.com, arybchenko@solarflare.com, stephen@networkplumber.org, ferruh.yigit@intel.com Date: Fri, 11 May 2018 01:58:29 +0200 Message-Id: <20180510235836.1099-5-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180510235836.1099-1-thomas@monjalon.net> References: <20180509094337.26112-1-thomas@monjalon.net> <20180510235836.1099-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v3 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: Thu, 10 May 2018 23:58:48 -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 Reviewed-by: Andrew Rybchenko Reviewed-by: Stephen Hemminger --- 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