From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BC4FDA0547; Mon, 5 Sep 2022 10:36:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26C6742847; Mon, 5 Sep 2022 10:36:11 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id BFA7342847 for ; Mon, 5 Sep 2022 10:36:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662366968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ov8223pnVCudrwM3ulRY8LJCoOF3gG81hcVUI/2th6c=; b=cOgUWg7drkJZ0IYLuhZkd4rY/InjuLxI7ESjM+fApoWFV5LQQGJFzY7LEHlMQjSSS9PzwW eP/Mz1z7I0GZ4PDHi7wOiQty2fjaJYSRPzAMKK9BMjXiyHsk1qS7U8Zc5xSVPltiAOKaF+ L/2pu90Qst2pm2TRyzTVuvfV/jzbLoY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-dYT0ZdCAMtuJGlGwG2E6sw-1; Mon, 05 Sep 2022 04:35:53 -0400 X-MC-Unique: dYT0ZdCAMtuJGlGwG2E6sw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B44A85A58B; Mon, 5 Sep 2022 08:35:53 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BBC740C141D; Mon, 5 Sep 2022 08:35:51 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com, Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH v5 02/27] common/mlx5: rework check on driver registration Date: Mon, 5 Sep 2022 10:35:15 +0200 Message-Id: <20220905083540.2506490-3-david.marchand@redhat.com> In-Reply-To: <20220905083540.2506490-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220905083540.2506490-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Rely on a local flag rather than dereference a bus object. This will help next commits. Signed-off-by: David Marchand --- drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; + } } -- 2.37.2