From nobody Fri May 10 17:49:12 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=Jeolee62dkHueoqgjHJiBVYOg3N8c4yGXub0yUOyp9o+kWCyiyihY/JFH/ARe5Xd4wUdmQq/YxuLwpFVZ/cSKpTk2JQ1xo0JAir2lNB9begl0H6eD/iBw/S0gErC7oyHbUBf+j/7BdcUVZWjaQo2X4gxeEGY9U1A1jtFdVuyZLs= 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=Sr36E178oOiHf/oBlcKx56G0wtwJzlQ3IQ/GwcMVaRU1LkhwE4QMIedAmHCioMQJUpcc6SHL/EVUwwaPUkdzgOWkqoNSYulDWCYcNxphEh/OpSmjSC8NLdSBoiATStrd+ATZ0HW2blWrLpNepQkRK9D9zhv2tfDYNTWcEkEkJ4Q= 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 1675103369974657.4090916746679; Mon, 30 Jan 2023 10:29:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.487151.754656 (Exim 4.92) (envelope-from ) id 1pMYtY-0004Ap-KK; Mon, 30 Jan 2023 18:28:44 +0000 Received: by outflank-mailman (output) from mailman id 487151.754656; Mon, 30 Jan 2023 18:28:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYtY-0004Ai-Ha; Mon, 30 Jan 2023 18:28:44 +0000 Received: by outflank-mailman (input) for mailman id 487151; Mon, 30 Jan 2023 18:28:43 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYtX-0004Aa-5y for xen-devel@lists.xenproject.org; Mon, 30 Jan 2023 18:28:43 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYtX-0000h3-41; Mon, 30 Jan 2023 18:28:43 +0000 Received: from 54-240-197-232.amazon.com ([54.240.197.232] 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 1pMYtW-0004Ps-S0; Mon, 30 Jan 2023 18:28:43 +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=qYChNV uGSGzG8G0/IL4MYnug029eOK+NZO9TKW3l2K5Q0rWyepqUN1Idraz1S/e0rHlmSTnYaiNMENU9BF2 5E9ES212yhB2gQx7sOf7WTb0PllYA8/ke3CrMc2VhbyxJzaaX9QCaLoUTJFweOrETOsDor4+KRv7H vwJ5AYfL6gg=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall Subject: [PATCH] xen/common: rwlock: Constify the parameter of _rw_is{,_write}_locked() Date: Mon, 30 Jan 2023 18:28:40 +0000 Message-Id: <20230130182840.86744-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: 1675103370544100001 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 --- 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