From patchwork Fri Feb 24 08:16:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 124502 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68B8A41D5D; Fri, 24 Feb 2023 09:18:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7956142D3A; Fri, 24 Feb 2023 09:17:33 +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 0B82942D0B for ; Fri, 24 Feb 2023 09:17:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677226651; 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=EwUXfYcfsohDtcW6q6WSl+09WfG+QtOMR7thxQkUBa8YpRBgKFfwhjUpC3WGpZbztSbdEE XtI9JJB0UnraYjZvcezrxr8NSZIUI1hULU+llQrHlG+fXXjKvdL+gnWvMbXHfMHxGANtvZ bxLNvE8C+ydLVQDG9K6c0vh+dg9P8Qs= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-81-K9tNDryBNGGE_weYtvmkfg-1; Fri, 24 Feb 2023 03:17:27 -0500 X-MC-Unique: K9tNDryBNGGE_weYtvmkfg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6020E38041CF; Fri, 24 Feb 2023 08:17:27 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DECF404BEC1; Fri, 24 Feb 2023 08:17:26 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Rosen Xu , Tianfei Zhang Subject: [PATCH 12/14] raw/ifpga: inherit lock annotations Date: Fri, 24 Feb 2023 09:16:40 +0100 Message-Id: <20230224081642.2566619-13-david.marchand@redhat.com> In-Reply-To: <20230224081642.2566619-1-david.marchand@redhat.com> References: <20230224081642.2566619-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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)