From nobody Fri May 10 12:48:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1675103370; cv=none; d=zohomail.com; s=zohoarc; b=eVzuyPKmXOm4OG1KiIpIs07LhrmDMO2AtztBEMRRZA2LhaYs9ISES3YUbwXMvcoB8okCgluVSgiV99LD5BZkL0s9hkc5pPQQl02A/tDNb+4LNNrDjDDc+XOwL4h/J6sDvVOjt5nIz/VJ3PzeWU0vX9ItpAxcUJDJLQTaxdAcWyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675103370; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=QHeyb39BAUbBq7kVi2Vj45hoLod0vCzIr6POB59arQY=; b=J+o00XbUTnwqL8Jy9lUshHtDaifddP3Nh6m/XkUM28L6euNDLcQaNlay281avaedrQQ1o3qgXWzcDgEUsqfE6fFZdze2/b5+E5+ah1+U6d2uwWs3djaXqHA2zGFhLLVLfVlsnsECeYRYteqqkShoBXvRZotS4gxYBPPdjBmF4rE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1675103369912555.3398189710117; Mon, 30 Jan 2023 10:29:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.487152.754667 (Exim 4.92) (envelope-from ) id 1pMYtr-0004VU-SC; Mon, 30 Jan 2023 18:29:03 +0000 Received: by outflank-mailman (output) from mailman id 487152.754667; Mon, 30 Jan 2023 18:29:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYtr-0004VN-P8; Mon, 30 Jan 2023 18:29:03 +0000 Received: by outflank-mailman (input) for mailman id 487152; Mon, 30 Jan 2023 18:29:02 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYtq-0004V1-I9 for xen-devel@lists.xenproject.org; Mon, 30 Jan 2023 18:29:02 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYtq-0000hQ-Cp; Mon, 30 Jan 2023 18:29:02 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pMYtq-0004Q6-48; Mon, 30 Jan 2023 18:29:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From; bh=QHeyb39BAUbBq7kVi2Vj45hoLod0vCzIr6POB59arQY=; b=5MW5wf IktPHTedVDpOTeYX5WQ+DysHeLljYLx4BjQFlHICsbg2pqmyHE3LrLuLekE5DTpdBrxkp+Tie8UWs YswpKmQPjvkr7VDY82wZiwde+rVPSfzl98xQGXJFaf1ptGKLr4gNZJ8XXhlj6YoCgRQm0FObAEw6E k6iFmibySDo=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Andrew Cooper , George Dunlap , Jan Beulich , Stefano Stabellini , Wei Liu Subject: [PATCH] xen/common: rwlock: Constify the parameter of _rw_is{,_write}_locked() Date: Mon, 30 Jan 2023 18:28:58 +0000 Message-Id: <20230130182858.86886-1-julien@xen.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1675103370547100002 Content-Type: text/plain; charset="utf-8" From: Julien Grall The lock is not meant to be modified by _rw_is{,_write}_locked(). So constify it. This is helpful to be able to assert if the lock is taken when the underlying structure is const. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich --- xen/include/xen/rwlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h index b8d52a5aa939..e0d2b41c5c7e 100644 --- a/xen/include/xen/rwlock.h +++ b/xen/include/xen/rwlock.h @@ -149,7 +149,7 @@ static inline void _read_unlock_irqrestore(rwlock_t *lo= ck, unsigned long flags) local_irq_restore(flags); } =20 -static inline int _rw_is_locked(rwlock_t *lock) +static inline int _rw_is_locked(const rwlock_t *lock) { return atomic_read(&lock->cnts); } @@ -254,7 +254,7 @@ static inline void _write_unlock_irqrestore(rwlock_t *l= ock, unsigned long flags) local_irq_restore(flags); } =20 -static inline int _rw_is_write_locked(rwlock_t *lock) +static inline int _rw_is_write_locked(const rwlock_t *lock) { return (atomic_read(&lock->cnts) & _QW_WMASK) =3D=3D _QW_LOCKED; } --=20 2.38.1