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 1940141D5F; Fri, 24 Feb 2023 16:13:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F36B042D32; Fri, 24 Feb 2023 16:12:29 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 294F040A87 for ; Fri, 24 Feb 2023 16:12:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677251547; 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=DlhyGHyu2iuDkPb9YLhvdlpR0IDaMFlp3a5uHtcSOIs=; b=IwkKKDpGdMSVvCGet4wP7dmLzJ9aaRF6LIz1iBNt2WSFTZ33xFWhrJDx8gvz0IVqjPdIcB s/vty3bZdHdmPLXhe26EJT5geUoG016F3jISCyuu9Q4VueAf9hA4xtT9TskATCZ6ituxL1 n+BcAuOExRC/cKJ2zU5n8+XNmeqRKFk= 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-553-GJkKx8L9Nu6f9tZfd1xoNA-1; Fri, 24 Feb 2023 10:12:26 -0500 X-MC-Unique: GJkKx8L9Nu6f9tZfd1xoNA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D46A80D0E3; Fri, 24 Feb 2023 15:12:26 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B38A2166B29; Fri, 24 Feb 2023 15:12:25 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Rosen Xu , Tianfei Zhang Subject: [PATCH v2 12/20] raw/ifpga: inherit lock annotations Date: Fri, 24 Feb 2023 16:11:35 +0100 Message-Id: <20230224151143.3274897-13-david.marchand@redhat.com> In-Reply-To: <20230224151143.3274897-1-david.marchand@redhat.com> References: <20230224081642.2566619-1-david.marchand@redhat.com> <20230224151143.3274897-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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 The checks in those helpers are useless: - all (start/stop/reset/test) callers ensure that dev != NULL, - dev->sd can't be NULL either as it would mean the application is calling those helpers for a dev pointer that did not pass initialisation, Once the checks are removed, the only thing that remains is calls to the rte_spinlock API, so simply use macros and inherit annotations from the lock API. Signed-off-by: David Marchand --- drivers/raw/ifpga/afu_pmd_core.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/raw/ifpga/afu_pmd_core.c b/drivers/raw/ifpga/afu_pmd_core.c index ddf7a34f33..3ab1f47ac1 100644 --- a/drivers/raw/ifpga/afu_pmd_core.c +++ b/drivers/raw/ifpga/afu_pmd_core.c @@ -23,21 +23,8 @@ static struct rte_afu_uuid afu_pmd_uuid_map[AFU_RAWDEV_MAX_DRVS+1]; TAILQ_HEAD(afu_drv_list, afu_rawdev_drv); static struct afu_drv_list afu_pmd_list = TAILQ_HEAD_INITIALIZER(afu_pmd_list); -static inline int afu_rawdev_trylock(struct afu_rawdev *dev) -{ - if (!dev || !dev->sd) - return 0; - - return rte_spinlock_trylock(&dev->sd->lock); -} - -static inline void afu_rawdev_unlock(struct afu_rawdev *dev) -{ - if (!dev || !dev->sd) - return; - - rte_spinlock_unlock(&dev->sd->lock); -} +#define afu_rawdev_trylock(dev) rte_spinlock_trylock(&dev->sd->lock) +#define afu_rawdev_unlock(dev) rte_spinlock_unlock(&dev->sd->lock) static int afu_rawdev_configure(const struct rte_rawdev *rawdev, rte_rawdev_obj_t config, size_t config_size) -- 2.39.2