From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 9AC39CFBC
 for <stable@dpdk.org>; Wed,  9 May 2018 11:31:16 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 4A161221F0;
 Wed,  9 May 2018 05:31:16 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Wed, 09 May 2018 05:31:16 -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=ToZL7KUPa5j6Lk
 hr0/9VPGNPd96GaDYfl6bfLKUpABM=; b=rLCDWFV450DQnJikifZSYDMuBexjZk
 9pBD6jnCi6y3yInx6lRouyU9VE29Gr4Twr9yzeMKzEzB9qf8eaQStsbkmia+3CG/
 P3+XRmn+pWKLd+xYnarjQSQ2tL8q6bTWRLzDc+KPDBPvuGkYRLyMWif2vBBEhGdU
 JPofwEkcvtbpI=
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=ToZL7KUPa5j6Lkhr0/9VPGNPd96GaDYfl6bfLKUpABM=; b=O+OUu9rB
 /2Rs6s42J7UYH4YjPIaaw+PAo37PKJRB1gaFXpu2gTyITsjGnUy2IrvJpffBEW3P
 Y5wXGtXGBmxH+65WzBR1+PaXvUnCN/ieP+ghmv5/1pB2mzlWth39FS2+OHD3KuyW
 g94l/6bJa3+N3hgy5vhDO3W907XmqRN2b2PgUm98W9H0BsDvPKsaMawlpXqEl7Pd
 AjaKinq21bG8gAiPUU1AkqWkKULyycFYzUxkR6JXfafMdeuGrB5wH8D6c44LhzSK
 egIIx+o2e+jcgw+gkT07BczPqFlO6FmODFfd8a4jBfwvyzbLYKYMdzg+8efUtP7m
 6XwlTBLagFwDzg==
X-ME-Sender: <xms:5L_yWu8gGzjn_pXe9zb5S1d0JKiSScnhRLl7H_eowP2k5T7iHNQ8ww>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 8EE09E4120;
 Wed,  9 May 2018 05:31:15 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: matan@mellanox.com
Cc: stable@dpdk.org
Date: Wed,  9 May 2018 11:30:58 +0200
Message-Id: <20180509093105.25984-5-thomas@monjalon.net>
X-Mailer: git-send-email 2.16.2
In-Reply-To: <20180509093105.25984-1-thomas@monjalon.net>
References: <20180509093105.25984-1-thomas@monjalon.net>
Subject: [dpdk-stable] [PATCH 04/11] drivers/net: use higher level of
	probing helper for PCI
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 09 May 2018 09:31:17 -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 <thomas@monjalon.net>
---
 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