Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1081109rdb; Mon, 19 Feb 2024 03:51:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXvr0s4noylrVOCo7LwOQXG/gipetZgZK2S6DqBOek/N8bf2lpnbbM6oUarCPtrE8EeOjZ27lIAekK9MG/rqvTCQaGcEfKvbKVdMuRs1Q== X-Google-Smtp-Source: AGHT+IFGshGYIhhXqpCHm8z6U9AdMaX1JJzoO1TGVEDBvTcl9Ug6W6rGAFJKMTTg/x+tx2n03zME X-Received: by 2002:a0d:e243:0:b0:607:8b5c:9b2d with SMTP id l64-20020a0de243000000b006078b5c9b2dmr11643025ywe.38.1708343479178; Mon, 19 Feb 2024 03:51:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708343479; cv=pass; d=google.com; s=arc-20160816; b=iikQHYja1ySrY4ykklV8nDB7QQDchviCsOD7Q+Ew0jOm39f8vFwuS0FOVxbZe+SDRa /5yAEsjkaITfe7eGbhzi5WgABYcdM/gvYNAmVi4F6aYqtCicfLaxoCL9bs74g1Ej3+xD Cow5ekov/lBWGzLQo7EYINXYhXqmALlFLdsb1lRdJlL2pYzov4yA3Ks2evWZ1cFroO07 2jeehi8NMXT1Cu8q1CcMkPwUXgNUNeqSQsY38FUFxBu3Q24K1GzZy2OMIYwgkBATU1FH 87ermg9I4CI0vGggfphZBZ7rKurOE6YB2AGWOBhUdKI8aM8dM4ZnhHhmLEjDYaGAurFm jDSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=VyWKOSxwcQHNibzu/v4MfsGCZbSTWY+RhQKWmyKFqjY=; fh=1fBYa+8Pml540vLlrdjBsXlvSPmHDDPa+wyK108iM94=; b=0uItGOyFl16Lsdib1TY0mKtpnQDEeFTblhpLpuLV3IZjed7XhZO9xttqi2Acfzm7pU h1KIQqGMRebZyIJgzXzuGdIRVpWtjcOfuWZ1i3/amNN5i58GiRCgWVK1SeAIh6hieT1H 2LlMZEvds/7GQB2uuINah+t1IX8hsg5LPQYwHB3gQRy1AD4TSJM5W+cqxTjVwbp9IZfr 3NG4j/iXB7Wo/nEZ+6IPzFTZEGzaopFzEIqxZ9WenEmzXbb0M7hkfdXuncIigx0yY20G NuiSZ49+7qeoFfPqXQOUmTJRwq2DRzWdqv7Z/bMI095dHeft1VG8FetOGltzSUaTZ8YL f1Fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-71251-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z26-20020ac8711a000000b0042dd90f54c5si5541180qto.547.2024.02.19.03.51.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 03:51:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71251-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-71251-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E7DE61C21072 for ; Mon, 19 Feb 2024 11:51:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CB012D042; Mon, 19 Feb 2024 11:51:15 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C5342C856; Mon, 19 Feb 2024 11:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343474; cv=none; b=Ks0SuLQZhRiCDqphm/1T+4lGYzLmnXoZB7p4AzR5S2UhQIkkUSr+KSKnX9EmQDouvInPQtTHLwoHW3xJFcaFq0+LGsGD68A0AAZ3MhamwuxMGT+GVlqEsPxebAoDFJn889i8Q9ZZko4GKoxSHk+lnMlsK6AmhhDDaSx7k208UxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343474; c=relaxed/simple; bh=u8TUJFmzFu3voi1EVgnpbMlRsT1vKI0cpUQEGm899u0=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TeowzFz0hAih1qtF7fngG3hPAJ/ctaZVS8k6nHU93RtZ6k+1SUvLqQ+J1Kd7CXxCxVvYGsWfkIydzArLmCrFix1plnRNiWI+1sMpk/6zVs5Yv3a42MHutihtOtiPIXxP6Gqhgob9pvEK88gKhZJ+X3FzabFp8ezVx+j7MtZx7zg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Tdgkw3YNlz6K8p6; Mon, 19 Feb 2024 19:47:36 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 997B5140DDF; Mon, 19 Feb 2024 19:51:09 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 19 Feb 2024 11:51:09 +0000 Date: Mon, 19 Feb 2024 11:51:08 +0000 From: Jonathan Cameron To: "Fabio M. De Francesco" CC: Peter Zijlstra , Dan Williams , , , Ingo Molnar , Dave Jiang , Ira Weiny Subject: Re: [PATCH 1/3 v5] cleanup: Add cond_guard() to conditional guards Message-ID: <20240219115108.00002be2@Huawei.com> In-Reply-To: <20240217105904.1912368-2-fabio.maria.de.francesco@linux.intel.com> References: <20240217105904.1912368-1-fabio.maria.de.francesco@linux.intel.com> <20240217105904.1912368-2-fabio.maria.de.francesco@linux.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) On Sat, 17 Feb 2024 11:59:02 +0100 "Fabio M. De Francesco" wrote: > Add cond_guard() macro to conditional guards. > > cond_guard() is a guard to be used with the conditional variants of locks, > like down_read_trylock() or mutex_lock_interruptible(). > > It takes a statement (or statement-expression) that is passed as its > second argument. That statement (or statement-expression) is executed if > waiting for a lock is interrupted or if a _trylock() fails in case of > contention. > > Usage example: > > cond_guard(mutex_intr, return -EINTR, &mutex); > > Consistent with other usage of _guard(), locks are unlocked at the exit of > the scope where cond_guard() is called. This macro can be called multiple > times in the same scope. > > Cc: Dave Jiang > Cc: Peter Zijlstra > Suggested-by: Dan Williams > Suggested-by: Ira Weiny > Suggested-by: Jonathan Cameron > Signed-off-by: Fabio M. De Francesco Looks good. Reviewed-by: Jonathan Cameron