From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 5F46BAABE; Wed, 9 May 2018 11:43:48 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0E5D92248D; Wed, 9 May 2018 05:43:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 09 May 2018 05:43: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=ToZL7KUPa5j6Lk hr0/9VPGNPd96GaDYfl6bfLKUpABM=; b=N+bX9QgsATayNRAtcH5GGRonv5Lgd+ v0HyOwidQlHOLR8IXILX2XZOCMGRPo9wdiMvJeF0iYB4BVryXOKoNKg6Y4kt4wGp XsmCB+bBs/BofCCtaH1oWEIUaNLY9kwzuDzSfKWQb6IOpCZKRB7G2hnKudYRebnC wdy5BZsCds5mE= 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=gi6MuDMG 4KE2Sy4Ql1oueJBNdr3kgOIqy9iaj/u8FHMpF51FwnL+IZm5OdQJUXj0c0ARBXf2 9Twgl4Vcw0f+bKIaQ3fty+JYCdryhTwxmmtaFhzx7J2r9Vzdh8qX83HmuyELez7w vhJEIzF6MGnXnkw/oF0KiDEGJl6qaHq529KSLWrbNcQvdZ1VQk/EVjra2kf011+N ophWunKfs2dKX0lta8Yo2EyPFzWegvL/1t+2/gHd47jRa59cH5TcjPfFI03ZFznD rASAqJ9qmmKjRepuvccPqI+7+eD1hknddFhBhT5Xh0qX6ZR8qv+eLj6cYsXeD2BP 6dyegFH41omz3A== 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 655FDE5086; Wed, 9 May 2018 05:43:47 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: stable@dpdk.org Date: Wed, 9 May 2018 11:43:30 +0200 Message-Id: <20180509094337.26112-5-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180509094337.26112-1-thomas@monjalon.net> References: <20180509094337.26112-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH 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 09:43: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 --- 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