Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5241091rwd; Mon, 5 Jun 2023 00:04:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PwQB37S2pY8gNQE0jjSRYXhUApomSw0VnX02doTjjNfL9riwBT5U6eypYF6FMFHXJHHgs X-Received: by 2002:a05:6358:c097:b0:129:a24c:f696 with SMTP id fa23-20020a056358c09700b00129a24cf696mr1410391rwb.29.1685948656893; Mon, 05 Jun 2023 00:04:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685948656; cv=none; d=google.com; s=arc-20160816; b=wsmQrGe9rftNyCG1j8PWq66QTJs+4+VkVVk2oJRUKR4EACs2jqbLBjNI6RVfbzBnMZ C0Is1z2S2HsSkm7hDgwfkgDzHXCEQVJ5p8LcJpGScL3i+BKDnIHGv5A7hV7JiBh4Olsr 3OMkj5O59G8CW06/beee9zcSttv23yYFvD7UWO9/TzISVAoAksqGIkAtzxMaalUKTxXR /08hpsyUze3Eq2ulmDz9Buo3Cp0kYF+Oc6wHYVR6hnPraFTq9DiFkQCYEASNaojKGIcP ecGpnjVr+e8rKyYT2oL94NvRPJnddFjMJrkvXEuxFR9OokRpsLXXyaJEVy7hZhKVJzPU fSfQ== 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; bh=5KytyxGgZNOk2hbRPbjU4ZDbbQU3UMchkl1+Uukl5ww=; b=gmU1zrlHEwJwmygcrqnlAqx2yBj511UpL/xZ8Yozrgt2ceQEeuNWsUPi8GdhKZmG1Y ZKXypJgU7c6IqX4OZ/rh7slfY/clWebvfhFUfO2E9vIXXYsZcT5Z0n2T8+mnFpdOyr6v OjUSY5ZkufnT8e7i+Lpl0lmWk59q05uHOHuHIOoBE899rGal/SmhKJpuohqnCR08+1jZ UNmSmm+Aya6hTPD+WaIYQPQl5ey0pVx5lhGTzMYkkJYr3/u4wvAcAbI26P+v4uAeF2qo y/3fvt+DxnH1Y2OP742QKqLzFXqsg942lrZsZig9dyqmKyuNNP1daTQO/Dly9iF+UDv0 51DA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a17090ab00700b00258c1cef517si6243982pjq.135.2023.06.05.00.04.02; Mon, 05 Jun 2023 00:04:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbjFEHDZ (ORCPT + 99 others); Mon, 5 Jun 2023 03:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbjFEHCv (ORCPT ); Mon, 5 Jun 2023 03:02:51 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8DED9E6F; Mon, 5 Jun 2023 00:02:17 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 328DD1682; Mon, 5 Jun 2023 00:02:59 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E1EDF3F793; Mon, 5 Jun 2023 00:02:11 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: akiyks@gmail.com, boqun.feng@gmail.com, corbet@lwn.net, keescook@chromium.org, linux@armlinux.org.uk, linux-doc@vger.kernel.org, mark.rutland@arm.com, mchehab@kernel.org, paulmck@kernel.org, peterz@infradead.org, rdunlap@infradead.org, sstabellini@kernel.org, will@kernel.org Subject: [PATCH v2 16/27] locking/atomic: scripts: factor out order template generation Date: Mon, 5 Jun 2023 08:01:13 +0100 Message-Id: <20230605070124.3741859-17-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605070124.3741859-1-mark.rutland@arm.com> References: <20230605070124.3741859-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 Currently gen_proto_order_variants() hard codes the path for the templates used for order fallbacks. Factor this out into a helper so that it can be reused elsewhere. This results in no change to the generated headers, so there should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Reviewed-by: Kees Cook Cc: Boqun Feng Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Will Deacon --- scripts/atomic/gen-atomic-fallback.sh | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/atomic/gen-atomic-fallback.sh b/scripts/atomic/gen-atomic-fallback.sh index 7a6bcea8f565b..337330865fa2e 100755 --- a/scripts/atomic/gen-atomic-fallback.sh +++ b/scripts/atomic/gen-atomic-fallback.sh @@ -32,6 +32,20 @@ gen_template_fallback() fi } +#gen_order_fallback(meta, pfx, name, sfx, order, atomic, int, args...) +gen_order_fallback() +{ + local meta="$1"; shift + local pfx="$1"; shift + local name="$1"; shift + local sfx="$1"; shift + local order="$1"; shift + + local tmpl_order=${order#_} + local tmpl="${ATOMICDIR}/fallbacks/${tmpl_order:-fence}" + gen_template_fallback "${tmpl}" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "$@" +} + #gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...) gen_proto_fallback() { @@ -56,20 +70,6 @@ cat << EOF EOF } -gen_proto_order_variant() -{ - local meta="$1"; shift - local pfx="$1"; shift - local name="$1"; shift - local sfx="$1"; shift - local order="$1"; shift - local atomic="$1" - - local basename="arch_${atomic}_${pfx}${name}${sfx}" - - printf "#define ${basename}${order} ${basename}${order}\n" -} - #gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...) gen_proto_order_variants() { @@ -117,9 +117,9 @@ gen_proto_order_variants() printf "#else /* ${basename}_relaxed */\n\n" - gen_template_fallback "${ATOMICDIR}/fallbacks/acquire" "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" - gen_template_fallback "${ATOMICDIR}/fallbacks/release" "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" - gen_template_fallback "${ATOMICDIR}/fallbacks/fence" "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" printf "#endif /* ${basename}_relaxed */\n\n" } -- 2.30.2