diff mbox series

[v5,2/3] devargs: make bus key parsing optional

Message ID 20211020154739.2514499-3-xuemingl@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series devargs: support path in global syntax | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming(Steven) Li Oct. 20, 2021, 3:47 p.m. UTC
Global devargs syntax is used as device iteration filter like
"class=vdpa", a devargs without bus args is valid from parsing
perspective.

This patch makes bus args optional.

Fixes: d2a66ad79480 ("bus: add device arguments name parsing")

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
---
 drivers/bus/pci/pci_params.c        | 8 +++-----
 lib/eal/common/eal_common_devargs.c | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index 21c2e1d0368..60b424b8297 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -87,11 +87,10 @@  rte_pci_devargs_parse(struct rte_devargs *da)
 	struct rte_kvargs *kvargs;
 	const char *addr_str;
 	struct rte_pci_addr addr;
-	int ret;
+	int ret = 0;
 
-	if (da == NULL)
+	if (da == NULL || da->bus_str == NULL)
 		return 0;
-	RTE_ASSERT(da->bus_str != NULL);
 
 	kvargs = rte_kvargs_parse(da->bus_str, NULL);
 	if (kvargs == NULL) {
@@ -103,9 +102,8 @@  rte_pci_devargs_parse(struct rte_devargs *da)
 
 	addr_str = rte_kvargs_get(kvargs, pci_params_keys[RTE_PCI_PARAM_ADDR]);
 	if (addr_str == NULL) {
-		RTE_LOG(ERR, EAL, "No PCI address specified using '%s=<id>' in: %s\n",
+		RTE_LOG(DEBUG, EAL, "No PCI address specified using '%s=<id>' in: %s\n",
 			pci_params_keys[RTE_PCI_PARAM_ADDR], da->bus_str);
-		ret = -ENODEV;
 		goto out;
 	}
 
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index d673598032d..8c7650cf6c2 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -39,7 +39,7 @@  devargs_bus_parse_default(struct rte_devargs *devargs,
 	/* Parse devargs name from bus key-value list. */
 	name = rte_kvargs_get(bus_args, "name");
 	if (name == NULL) {
-		RTE_LOG(INFO, EAL, "devargs name not found: %s\n",
+		RTE_LOG(DEBUG, EAL, "devargs name not found: %s\n",
 			devargs->data);
 		return 0;
 	}