Re: [PATCH 4/8] drivers: cleanup devargs lookup in bus scan

Hemant Agrawal
2026-03-24T05:16:40Z

On 23-03-2026 16:22, David Marchand wrote:
> Don't hardcode the bus names in the RTE_EAL_DEVARGS_FOREACH() calls.
> The bus name is set by code in EAL.
> Even if there is nothing broken, let's reuse the name from the bus object.
>
> And remove the now useless macros.
>
> Note: in the ifpga bus case, the call was using an incorrect macro
> (IFPGA_ARG_NAME instead of IFPGA_BUS_NAME), yet it was working fine
> as this macro is aligned with the ifpga bus name.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> drivers/bus/auxiliary/auxiliary_common.c | 2 +-
> drivers/bus/auxiliary/bus_auxiliary_driver.h | 2 --
> drivers/bus/cdx/cdx.c | 3 +--
> drivers/bus/dpaa/dpaa_bus.c | 6 ++----
> drivers/bus/fslmc/fslmc_bus.c | 8 +++-----
> drivers/bus/ifpga/bus_ifpga_driver.h | 2 --
> drivers/bus/ifpga/ifpga_bus.c | 4 ++--
> drivers/bus/pci/pci_common.c | 2 +-
> drivers/bus/platform/platform.c | 2 +-
> drivers/bus/uacce/uacce.c | 2 +-
> drivers/bus/vdev/vdev.c | 2 +-
> drivers/bus/vmbus/vmbus_common.c | 2 +-
> drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
> 13 files changed, 15 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
> index ac766e283e..119533df28 100644
> --- a/drivers/bus/auxiliary/auxiliary_common.c
> +++ b/drivers/bus/auxiliary/auxiliary_common.c
> @@ -30,7 +30,7 @@ auxiliary_devargs_lookup(const char *name)
> {
> struct rte_devargs *devargs;
>
> - RTE_EAL_DEVARGS_FOREACH(RTE_BUS_AUXILIARY_NAME, devargs) {
> + RTE_EAL_DEVARGS_FOREACH(auxiliary_bus.bus.name, devargs) {
> if (strcmp(devargs->name, name) == 0)
> return devargs;
> }
> diff --git a/drivers/bus/auxiliary/bus_auxiliary_driver.h b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> index 1dc814151e..8450d56583 100644
> --- a/drivers/bus/auxiliary/bus_auxiliary_driver.h
> +++ b/drivers/bus/auxiliary/bus_auxiliary_driver.h
> @@ -28,8 +28,6 @@
> extern "C" {
> #endif
>
> -#define RTE_BUS_AUXILIARY_NAME "auxiliary"
> -
> /* Forward declarations */
> struct rte_auxiliary_driver;
> struct rte_auxiliary_device;
> diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
> index 729d54337c..b183d98453 100644
> --- a/drivers/bus/cdx/cdx.c
> +++ b/drivers/bus/cdx/cdx.c
> @@ -82,7 +82,6 @@
> #include "cdx_logs.h"
> #include "private.h"
>
> -#define CDX_BUS_NAME cdx
> #define CDX_DEV_PREFIX "cdx-"
>
> /* CDX Bus iterators */
> @@ -157,7 +156,7 @@ cdx_devargs_lookup(const char *dev_name)
> {
> struct rte_devargs *devargs;
>
> - RTE_EAL_DEVARGS_FOREACH("cdx", devargs) {
> + RTE_EAL_DEVARGS_FOREACH(rte_cdx_bus.bus.name, devargs) {
> if (strcmp(devargs->name, dev_name) == 0)
> return devargs;
> }
> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
> index 5e0f32bfe8..e3c17d41f7 100644
> --- a/drivers/bus/dpaa/dpaa_bus.c
> +++ b/drivers/bus/dpaa/dpaa_bus.c
> @@ -77,8 +77,6 @@ static pthread_key_t dpaa_portal_key;
> struct dpaa_portal *dpaa_portals[RTE_MAX_LCORE] = {NULL};
> static int dpaa_bus_global_init;
>
> -#define FSL_DPAA_BUS_NAME dpaa_bus
> -
> RTE_EXPORT_INTERNAL_SYMBOL(per_lcore_dpaa_io)
> RTE_DEFINE_PER_LCORE(struct dpaa_portal *, dpaa_io);
>
> @@ -206,7 +204,7 @@ dpaa_devargs_lookup(struct rte_dpaa_device *dev)
> struct rte_devargs *devargs;
> char dev_name[32];
>
> - RTE_EAL_DEVARGS_FOREACH("dpaa_bus", devargs) {
> + RTE_EAL_DEVARGS_FOREACH(rte_dpaa_bus.bus.name, devargs) {
> devargs->bus->parse(devargs->name, &dev_name);
> if (strcmp(dev_name, dev->device.name) == 0) {
> DPAA_BUS_INFO("**Devargs matched %s", dev_name);
> @@ -1003,5 +1001,5 @@ static struct rte_dpaa_bus rte_dpaa_bus = {
> .device_count = 0,
> };
>
> -RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus);
> +RTE_REGISTER_BUS(dpaa_bus, rte_dpaa_bus.bus);
> RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_bus, NOTICE);
> diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
> index ac9fb7a08c..8f3e3dc1be 100644
> --- a/drivers/bus/fslmc/fslmc_bus.c
> +++ b/drivers/bus/fslmc/fslmc_bus.c
> @@ -26,7 +26,6 @@
> #include <dpaax_iova_table.h>
>
> #define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
> -#define FSLMC_BUS_NAME fslmc
>
> struct rte_fslmc_bus rte_fslmc_bus;
>
> @@ -106,7 +105,7 @@ fslmc_devargs_lookup(struct rte_dpaa2_device *dev)
> struct rte_devargs *devargs;
> char dev_name[32];
>
> - RTE_EAL_DEVARGS_FOREACH("fslmc", devargs) {
> + RTE_EAL_DEVARGS_FOREACH(rte_fslmc_bus.bus.name, devargs) {
> devargs->bus->parse(devargs->name, &dev_name);
> if (strcmp(dev_name, dev->device.name) == 0) {
> DPAA2_BUS_INFO("**Devargs matched %s", dev_name);
> @@ -266,8 +265,7 @@ rte_fslmc_parse(const char *name, void *addr)
> */
> if (sep_exists) {
> /* If either of "fslmc" or "name" are starting part */
> - if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
> - strlen(RTE_STR(FSLMC_BUS_NAME))) ||
> + if (!strncmp(name, rte_fslmc_bus.bus.name, strlen(rte_fslmc_bus.bus.name)) ||
> (!strncmp(name, "name", strlen("name")))) {
> goto jump_out;
> } else {
> @@ -704,5 +702,5 @@ struct rte_fslmc_bus rte_fslmc_bus = {
> .device_count = {0},
> };
>
> -RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus);
> +RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus);
> RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_bus, NOTICE);

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>