From patchwork Wed Jun 24 11:33:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72113 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B20D6A0350; Wed, 24 Jun 2020 13:35:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9456C1D8D9; Wed, 24 Jun 2020 13:35:30 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 0C32E1D608 for ; Wed, 24 Jun 2020 13:35:28 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 14:35:23 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuK007248; Wed, 24 Jun 2020 14:34:23 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com Date: Wed, 24 Jun 2020 11:33:04 +0000 Message-Id: <1592998387-28181-4-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 4/7] net/mlx4: use anonymous DV allocator argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The mlx4_pci_probe function defines an struct mlx4dv_ctx_allocators type variable several hundred rows after it starts, with the only use it being passed as a parameter to the mlx4_glue->dv_set_context_attr function. 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 Acked-by: Matan Azrad --- drivers/net/mlx4/mlx4.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 5d72027..ff270b4 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -1054,14 +1054,13 @@ struct mlx4_conf { eth_dev->dev_ops = &mlx4_dev_ops; #ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS /* Hint libmlx4 to use PMD allocator for data plane resources */ - struct mlx4dv_ctx_allocators alctr = { - .alloc = &mlx4_alloc_verbs_buf, - .free = &mlx4_free_verbs_buf, - .data = priv, - }; err = mlx4_glue->dv_set_context_attr (ctx, MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS, - (void *)((uintptr_t)&alctr)); + (void *)((uintptr_t)&(struct mlx4dv_ctx_allocators){ + .alloc = &mlx4_alloc_verbs_buf, + .free = &mlx4_free_verbs_buf, + .data = priv, + })); if (err) WARN("Verbs external allocator is not supported"); else