Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7702799rwr; Wed, 10 May 2023 11:21:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hl5JKiN+neLnVN8a7xlF6Tjr6NZ0jepZxNfbimPdIBQKLkpt3Pv7fNYfgUq1mWFwi6Lob X-Received: by 2002:a05:6a20:160a:b0:103:7b79:1506 with SMTP id l10-20020a056a20160a00b001037b791506mr2397541pzj.24.1683742872393; Wed, 10 May 2023 11:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683742872; cv=none; d=google.com; s=arc-20160816; b=mX8+9wdw+5xP923ktte+zh0QYPL9dJqWa81wrCSj5jKMPZzg0hEvHiYsqfCXjn6InM AiscUF14xMpp7fPeg6BDYw/beAUipj1V9xp2ftkLyOEDt50qO/avNf97DohursOnx3iN 3bYY22AHAuQDzQaK49EdUoF39DbqJJPdAWna+2+69gEWes3rDLXT6ATe/8CKVfa4AONJ Fwkek56ldibv4Y0gLq2ZW1Vr9Zw5EIDaM8us2u/bb0Dne2mnzcoeoluHYSsiG3JFjdSc 482aEGydYlKcRdSj8ExcdgZHDJDArEEyOJLCdP22Q5CfoWIwbXdQmuxIbdVtkmmnKl+k Cygg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NHuC+8jlI7bfnoyqxU4mlGdTZF3jMrWMDyfLelsJaTw=; b=TQnCD073ziEW14RIzP27OaJVQVfCA9ZeArMIvgVcpRpFcHLZw0sPcAZlGJwkJvtpde Mv89luziRq6O4ktWCy4j0JE4ehI39Ucn1W0CogQw2P8u28z0kha3I1bpmfz0w35taPp0 Rt63/lX5nT2iLkofgMQKROjItJ3Na4LzBozrBqT94NtUj4kUqMDJqlwiQb56S6+YB+Y1 ZUv/JLerbdA5QdqgvvrEaMid4w600TAz2i6N/E2UGAeu1SNRj67u1MOsYR/CtYYB/b9K sO3ZlblAmDww0HKbuAodY4ISKzhDuqujMtyGIjydLIyiDVrCNvtmJMSX3wEgr5zmV+sC +Vng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ikm2NLQz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mz7-20020a17090b378700b0024e0eec665fsi18292934pjb.73.2023.05.10.11.20.58; Wed, 10 May 2023 11:21:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ikm2NLQz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236619AbjEJST3 (ORCPT + 99 others); Wed, 10 May 2023 14:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236175AbjEJSSV (ORCPT ); Wed, 10 May 2023 14:18:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D0AE8691; Wed, 10 May 2023 11:18:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B804263F8C; Wed, 10 May 2023 18:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7BE4C433A1; Wed, 10 May 2023 18:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683742644; bh=8scz+UOnvZTcnS7Ykx6CtnedJmiFq1UdjUUnARLlRyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ikm2NLQzY332FjMNQM5/hRKYkRj1qvK9ycCfMuNvYarVrdkH7vu9gGrRyZzmY39W3 csCAizD3aExQlgib+ooni6h+XqWhfDENU0i4TX4ordvGKdI+LcmEEmHi8WcSw8BxeU KCyFlSqhuxoaEYD/zv9ggp7VUAMRCS+MtSMsNarZSe2eBE55lvF/rDi4EUSutdhjBm jod4i728JsV3IwNVAEZs9audTUe7WRlVUaj7DoqsgEGleeLf8InmphipjzJVtwiDIt xv9Xx2nhOLMQXNVBdpZp2G7CfiHA/p6V6B7sIhiJZV3jVWWOQssXQFBWqxj66ArXCb zU/CeO0M/1dTA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E2BB4CE1BC1; Wed, 10 May 2023 11:17:18 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, akiyks@gmail.com, linux-doc@vger.kernel.org, kernel-team@meta.com, "Paul E. McKenney" , Will Deacon , Peter Zijlstra , Boqun Feng , Mark Rutland Subject: [PATCH locking/atomic 08/19] locking/atomic: Add kernel-doc header for arch_${atomic}_dec_if_positive Date: Wed, 10 May 2023 11:17:06 -0700 Message-Id: <20230510181717.2200934-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <19135936-06d7-4705-8bc8-bb31c2a478ca@paulmck-laptop> References: <19135936-06d7-4705-8bc8-bb31c2a478ca@paulmck-laptop> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add kernel-doc header template for arch_${atomic}_dec_if_positive function family. Signed-off-by: Paul E. McKenney Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Mark Rutland --- include/linux/atomic/atomic-arch-fallback.h | 22 ++++++++++++++++++++- scripts/atomic/fallbacks/dec_if_positive | 10 ++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/linux/atomic/atomic-arch-fallback.h b/include/linux/atomic/atomic-arch-fallback.h index ed72d94346e9..4d4d94925cb0 100644 --- a/include/linux/atomic/atomic-arch-fallback.h +++ b/include/linux/atomic/atomic-arch-fallback.h @@ -1641,6 +1641,16 @@ arch_atomic_dec_unless_positive(atomic_t *v) #endif #ifndef arch_atomic_dec_if_positive +/** + * arch_atomic_dec_if_positive - Atomic decrement if old value is positive + * @v: pointer of type atomic_t + * + * Atomically decrement @v, but only if the original value is greater than zero, + * returning new value. Note that the desired new value will be returned + * even if the decrement did not occur, so that if the old value is -3, then + * there @v will not be decremented, but -4 will be returned. As a result, + * if the return value is non-negative, then the value was in fact decremented. + */ static __always_inline int arch_atomic_dec_if_positive(atomic_t *v) { @@ -3063,6 +3073,16 @@ arch_atomic64_dec_unless_positive(atomic64_t *v) #endif #ifndef arch_atomic64_dec_if_positive +/** + * arch_atomic64_dec_if_positive - Atomic decrement if old value is positive + * @v: pointer of type atomic64_t + * + * Atomically decrement @v, but only if the original value is greater than zero, + * returning new value. Note that the desired new value will be returned + * even if the decrement did not occur, so that if the old value is -3, then + * there @v will not be decremented, but -4 will be returned. As a result, + * if the return value is non-negative, then the value was in fact decremented. + */ static __always_inline s64 arch_atomic64_dec_if_positive(atomic64_t *v) { @@ -3080,4 +3100,4 @@ arch_atomic64_dec_if_positive(atomic64_t *v) #endif #endif /* _LINUX_ATOMIC_FALLBACK_H */ -// 3b29d5595f48f921507f19bc794c91aecb782ad3 +// c7041896e7e66a52d8005ba021f3b3b05f99bcb3 diff --git a/scripts/atomic/fallbacks/dec_if_positive b/scripts/atomic/fallbacks/dec_if_positive index 86bdced3428d..dedbdbc1487d 100755 --- a/scripts/atomic/fallbacks/dec_if_positive +++ b/scripts/atomic/fallbacks/dec_if_positive @@ -1,4 +1,14 @@ cat <