diff mbox series

[7/7] net/mlx5: use anonymous DV allocator argument

Message ID 1592998387-28181-7-git-send-email-michaelba@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers show
Series [1/7] common/mlx5: fix code arrangement in tag allocation | expand


Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Michael Baum June 24, 2020, 11:33 a.m. UTC
The mlx5_dev_spawn function defines an struct mlx5dv_ctx_allocators type
variable several hundred rows after it starts, with the only use it
being passed as a parameter to the mlx5_glue->dv_set_context_attr
However, according to DPDK Coding Style Guidelines, variables should be
declared at the start of a block of code rather than in the middle.
Therefore, to improve the Coding Style, the variable is passed directly
to the function without declaring it before.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
 drivers/net/mlx5/linux/mlx5_os.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series


diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index f0147e6..2dc57b2 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -988,14 +988,13 @@ 
 	/* Hint libmlx5 to use PMD allocator for data plane resources */
-	struct mlx5dv_ctx_allocators alctr = {
-		.alloc = &mlx5_alloc_verbs_buf,
-		.free = &mlx5_free_verbs_buf,
-		.data = priv,
-	};
-				       (void *)((uintptr_t)&alctr));
+			(void *)((uintptr_t)&(struct mlx5dv_ctx_allocators){
+				.alloc = &mlx5_alloc_verbs_buf,
+				.free = &mlx5_free_verbs_buf,
+				.data = priv,
+			}));
 	/* Bring Ethernet device up. */
 	DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",