From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v8 10/14] eal/pci: Cleanup pci driver initialization code Date: Tue, 17 Feb 2015 02:18:53 +0100 Message-ID: <2049023.kebHdKAVjA@xps13> 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Tetsuya Mukawa Return-path: In-Reply-To: <1424060073-23484-11-git-send-email-mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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.