From: Thomas Monjalon Date: Sat, 18 Jul 2015 17:46:20 +0000 (+0200) Subject: ethdev: refactor port release X-Git-Tag: spdx-start~8701 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ff3ae4d4462bc8685bcb10f61b1f850eefad6f3e;p=dpdk.git ethdev: refactor port release Use DEV_DETACHED constant and deduplicate code in init. Signed-off-by: Thomas Monjalon --- diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 9596047bba..d00d10422c 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; }