From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id 4EAA0C6E8 for ; Fri, 29 Jan 2016 15:49:26 +0100 (CET) Received: by mail-wm0-f54.google.com with SMTP id l66so70424671wml.0 for ; Fri, 29 Jan 2016 06:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/pQ0z6gg6DeDtD2/CMacEkdzyJgx8je6OTJsz02XYPU=; b=n2N+uVgNNScK1vcJfCwWzvSvB4PLHIuZjMsCuL6O5MkukFnPq4FqgMlpL6iMlTP00R Ceb6saBUqNr3N4NOjR9sJ4AqLCGsErQZPr713ajrMlnUvdlPpXXpKtJp2KyeKVMBgxHk Pw7qhUbSbPJTbFdxIG5v5FtKyHRRBfN9HkmM+OYVdPahs1eL1Gx/8hUUCLVqq+GUPOuD y5pPmFqMrCj0ITGmmC7QsSr9WdOGnycT/0oKF5fBRw/OPVChQkvJeb82q4FanIBGlBcG V2u5CGf1U9sv6j5F5EuLJ3sumu+7a9PERCgXyfnj1Q5slWXV3k/Q71IGTsNXRCvLpzHR c7zA== 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=/pQ0z6gg6DeDtD2/CMacEkdzyJgx8je6OTJsz02XYPU=; b=avvsveNsHTrjaf3TBy0/TLd0pd8bGrlzWWsN9x2q9QQOGWzYA+D6N6T8RodRF8GT46 BbZ2osRp8cuNB1A6IHLibDRmMI55+YqEZTIRganiLthi04woqgXOQiMGOTdo6wYxV0yh nGJbOFt5wLAERQMumkTUstCeayF3ib88K6GErLf33EzTDlKikRzPNHiEu/TcM24YrMcT iBtBhpxZDEu6uOSztypQn+EJHFMQH2gIpiEVz6zxkqhsX4E9f7uQ8BkKFJL8aTETNioA rKgsCKix/koje7dhcpGNh8RAFNywnZFhB84WkOUCyA0eqDEYgDFNl8k4rzpymBm01GyN Kv+Q== X-Gm-Message-State: AG10YOT8NpUopwKRlQ7nDb0QKtK+FnddQT0rabN6CjcRIO43gIga2A8MDoupDv3UB8cSWCwT X-Received: by 10.194.206.71 with SMTP id lm7mr9192727wjc.118.1454078966210; Fri, 29 Jan 2016 06:49:26 -0800 (PST) Received: from gloops.dev.6wind.com (144.77.126.78.rev.sfr.net. [78.126.77.144]) by smtp.gmail.com with ESMTPSA id y188sm7811294wmy.11.2016.01.29.06.49.25 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 29 Jan 2016 06:49:25 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Fri, 29 Jan 2016 15:49:11 +0100 Message-Id: <1454078953-23744-8-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454078953-23744-1-git-send-email-david.marchand@6wind.com> References: <1453476464-31767-1-git-send-email-david.marchand@6wind.com> <1454078953-23744-1-git-send-email-david.marchand@6wind.com> Cc: viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v2 7/9] pci: remove driver lookup from detach 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: Fri, 29 Jan 2016 14:49:26 -0000 A device is linked to a driver at probe time. When detaching, we should call this same driver detach() function and no need for a driver lookup. Signed-off-by: David Marchand --- Changes since v1: - moved some logs for consistency --- lib/librte_eal/common/eal_common_pci.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 768421a..082eab8 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -256,13 +256,9 @@ pci_probe_device(struct rte_pci_driver *dr, struct rte_pci_device *dev) * driver. */ static int -pci_detach_device(struct rte_pci_driver *dr, struct rte_pci_device *dev) +pci_detach_device(struct rte_pci_device *dev) { - struct rte_pci_addr *loc = &dev->addr; - - RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", - loc->domain, loc->bus, loc->devid, - loc->function, dev->numa_node); + struct rte_pci_driver *dr = dev->driver; RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->name); @@ -337,20 +333,19 @@ int rte_eal_pci_detach(const struct rte_pci_addr *addr) { struct rte_pci_device *dev; - struct rte_pci_driver *dr; if (addr == NULL) return -1; dev = pci_find_device(addr); - if (!dev) + if (!dev || !dev->driver) goto err_return; - dr = pci_find_driver(dev); - if (!dr) - goto err_return; + RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", + dev->addr.domain, dev->addr.bus, dev->addr.devid, + dev->addr.function, dev->numa_node); - if (pci_detach_device(dr, dev) < 0) + if (pci_detach_device(dev) < 0) goto err_return; TAILQ_REMOVE(&pci_device_list, dev, next); -- 1.9.1