On 2015/02/17 10:18, Thomas Monjalon wrote: > 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 <mukawa at igel.co.jp> >> --- >> 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.
I will reword the tile. > > [...] >> - 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. > Sure, I will remove such a toggle. Probably I will separate the function.