From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id F0675C332 for ; Sun, 19 Jul 2015 12:53:34 +0200 (CEST) Received: by wgkl9 with SMTP id l9so110874126wgk.1 for ; Sun, 19 Jul 2015 03:53:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TOAFv05YacD3JkJN61tmwEZrBVQLowcCOzbmbbsTGls=; b=RiJ/4hAUoBmnjNmgXGTnZNulC4oqokGd3GzWkO/wiHSIMi20TZQLYigUq2HPlMRO39 XQPfCUSUjQyHsGf0DFuOvxXHKk6r8u5tUwJK06KJR8ZfVVos26LVwn40lmfH3tsr0tnz H2Xq4bf9EGvL9Wl1rMYujsX9b7YQs75TtSYBU438qVdDiGNYhugHLQFy9BjVPWK2hzy9 vRp4Q/4r1iWkB4/e+UcM8syBRlL0WCfCIPl9PxHstjUX0bcyNiXyH/hd80iiPNeCI1mX bdhxsX/hK3H5GZNxc1BFwl2fOHXihatzaF/e3pcm15fKBPsjyAWdXAyO0bim2oVfeAs2 Ys2g== X-Gm-Message-State: ALoCoQlpHefBCk5CjyOeY0FS8MmatdJhI2EvSqxGEwyU3Ur+UlfoafXRIOTne0vtdlFAzIHEqIR+ X-Received: by 10.194.71.135 with SMTP id v7mr43588916wju.83.1437303214885; Sun, 19 Jul 2015 03:53:34 -0700 (PDT) Received: from XPS13.localdomain (117.114.118.80.rev.sfr.net. [80.118.114.117]) by smtp.gmail.com with ESMTPSA id d5sm6481160wiz.24.2015.07.19.03.53.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jul 2015 03:53:34 -0700 (PDT) From: Thomas Monjalon To: dev@dpdk.org Date: Sun, 19 Jul 2015 12:52:16 +0200 Message-Id: <1437303137-29430-4-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1437303137-29430-1-git-send-email-thomas.monjalon@6wind.com> References: <1437303137-29430-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH 3/4] ethdev: refactor port release X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jul 2015 10:53:35 -0000 Use DEV_DETACHED constant and deduplicate code in init. Signed-off-by: Thomas Monjalon --- lib/librte_ether/rte_ethdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 9596047..d00d104 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -287,7 +287,7 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) if (eth_dev == NULL) return -EINVAL; - eth_dev->attached = 0; + eth_dev->attached = DEV_DETACHED; nb_ports--; return 0; } @@ -342,8 +342,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, (unsigned) pci_dev->id.device_id); if (rte_eal_process_type() == RTE_PROC_PRIMARY) rte_free(eth_dev->data->dev_private); - eth_dev->attached = DEV_DETACHED; - nb_ports--; + rte_eth_dev_release_port(eth_dev); return diag; } -- 2.4.2