From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 9A571B64F for ; Tue, 17 Feb 2015 02:19:25 +0100 (CET) Received: by mail-wg0-f42.google.com with SMTP id n12so15788683wgh.1 for ; Mon, 16 Feb 2015 17:19:25 -0800 (PST) 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:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=qkKdCWLAa/y27Ic8lYTjuU14xHdiuVGLmzYXaaQhO5s=; b=hFyjYH4aPQGv4iUYhHAqtLVLOXDagsO+XRccOkr2JxMT+RYWZHbjy65ucS0VmtAffS HgcohKOT3GWNKVNn733xg1PsRIhPBGdjllQlnGDHGsoWpJjzdh+liXhgOacU+LKk++Ny WHtLJuB5QK5PpHiyx+3swUQ0Uw2GmMlNjiSxyF4Btq5AmV/qnPOJDjTmGBQRXbZRUrH7 kzGtOB/XEeQ9jdCf+NP7nMP4TWmleONvnqVT6fmXIZsxchB3LGVQ+XWWldkhaqSnM9Og 0XU2eQdR3UYJ1bqCLilCckHApU2YI3CukcRrIIRLqzvNmNknjkaWMvvEscb0nj57IM// U2Xg== X-Gm-Message-State: ALoCoQl6fIxCefTX0tbg5ZZvbPECKRATehLvSIy5sNiVtTFGSA676PpQ8IlH9OQdJgMry0nnfDMY X-Received: by 10.180.102.73 with SMTP id fm9mr10445417wib.12.1424135965446; Mon, 16 Feb 2015 17:19:25 -0800 (PST) Received: from xps13.localnet (guy78-1-82-235-116-147.fbx.proxad.net. [82.235.116.147]) by mx.google.com with ESMTPSA id p6sm21941589wia.14.2015.02.16.17.19.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 17:19:24 -0800 (PST) From: Thomas Monjalon To: Tetsuya Mukawa Date: Tue, 17 Feb 2015 02:18:53 +0100 Message-ID: <2049023.kebHdKAVjA@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <1424060073-23484-11-git-send-email-mukawa@igel.co.jp> References: <1423470639-15744-2-git-send-email-mukawa@igel.co.jp> <1424060073-23484-1-git-send-email-mukawa@igel.co.jp> <1424060073-23484-11-git-send-email-mukawa@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v8 10/14] eal/pci: Cleanup pci driver initialization code 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: Tue, 17 Feb 2015 01:19:25 -0000 2015-02-16 13:14, Tetsuya Mukawa: > - Add rte_eal_pci_close_one_dirver() > The function is used for closing the specified driver and device. > - Add pci_invoke_all_drivers() > The function is based on pci_probe_all_drivers. But it can not only > probe but also close drivers. > - Add pci_close_all_drivers() > The function tries to find a driver for the specified device, and > then close the driver. > - Add rte_eal_pci_probe_one() and rte_eal_pci_close_one() > The functions are used for probe and close a device. > First the function tries to find a device that has the specified > PCI address. Then, probe or close the device. > > v5: > - Remove RTE_EAL_INVOKE_TYPE_UNKNOWN, because it's unused. > v4: > - Fix parameter checking. > - Fix indent of 'if' statement. > > Signed-off-by: Tetsuya Mukawa > --- > lib/librte_eal/common/eal_common_pci.c | 90 +++++++++++++++++++++++++++++---- > lib/librte_eal/common/eal_private.h | 24 +++++++++ > lib/librte_eal/common/include/rte_pci.h | 33 ++++++++++++ > lib/librte_eal/linuxapp/eal/eal_pci.c | 69 +++++++++++++++++++++++++ > 4 files changed, 206 insertions(+), 10 deletions(-) 206 insertions and 10 deletions: it cannot really be a cleanup ;) Maybe the title should be reworded. [...] > - rc = rte_eal_pci_probe_one_driver(dr, dev); > + switch (type) { > + case RTE_EAL_INVOKE_TYPE_PROBE: > + rc = rte_eal_pci_probe_one_driver(dr, dev); > + break; > + case RTE_EAL_INVOKE_TYPE_CLOSE: > + rc = rte_eal_pci_close_one_driver(dr, dev); > + break; Honestly, I don't like this kind of functions with a switch to toggle different actions. It makes code unclear.