bus/pci: 'RTE_PMD_REGISTER_PCI' support expand 'nm'
Checks
Commit Message
Before, 'RTE_PMD_REGISTER_PCI' can not expand nm. So, it can not
work in this situation:
#define TEST(a, b) a##_##b
RTE_PMD_REGISTER_PCI(TEST(a, b), test_pmd_driver)
Signed-off-by: Lichao Liu <liulichao.09679@bytedance.com>
---
drivers/bus/pci/rte_bus_pci.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
On Tue, 2 Aug 2022 16:48:39 +0800
Lichao Liu <liulichao.09679@bytedance.com> wrote:
> Before, 'RTE_PMD_REGISTER_PCI' can not expand nm. So, it can not
> work in this situation:
> #define TEST(a, b) a##_##b
> RTE_PMD_REGISTER_PCI(TEST(a, b), test_pmd_driver)
>
> Signed-off-by: Lichao Liu <liulichao.09679@bytedance.com>
It is not clear what the problem is.
All the existing drivers work fine.
Did you follow the coding conventions and patterns of existing drivers
or try and do something different.
Recommend not accepting this patch.
If you have a more verbose example of why this won't work for you
please resubmit the patch.
@@ -270,8 +270,7 @@ int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
*/
void rte_pci_register(struct rte_pci_driver *driver);
-/** Helper for PCI device registration from driver (eth, crypto) instance */
-#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \
+#define _RTE_PMD_REGISTER_PCI(nm, pci_drv) \
RTE_INIT(pciinitfn_ ##nm) \
{\
(pci_drv).driver.name = RTE_STR(nm);\
@@ -279,6 +278,10 @@ RTE_INIT(pciinitfn_ ##nm) \
} \
RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
+/** Helper for PCI device registration from driver (eth, crypto) instance */
+#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \
+ _RTE_PMD_REGISTER_PCI(nm, pci_drv)
+
/**
* Unregister a PCI driver.
*