diff mbox series

[RFC,01/11] common/mlx5: rework check on driver registration

Message ID 20220628144643.1213026-2-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series Bus cleanup for 22.11 | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand June 28, 2022, 2:46 p.m. UTC
Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@  static struct rte_auxiliary_driver mlx5_auxiliary_driver = {
 	.dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-	if (mlx5_auxiliary_driver.bus == NULL)
+	if (!mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_register(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = true;
+	}
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-	if (mlx5_auxiliary_driver.bus != NULL)
+	if (mlx5_common_auxiliary_initialized) {
 		rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+		mlx5_common_auxiliary_initialized = false;
+	}
 }