From patchwork Mon May 22 12:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 97398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1411426vqo; Mon, 22 May 2023 05:31:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78C+yPTxtIg1F5+YeX5p/ujalJYc9vIloRt/25ygCywKhem0ytLjh3fcYNXcBUHiHfxulv X-Received: by 2002:a05:6a20:54a4:b0:10b:2203:6ab1 with SMTP id i36-20020a056a2054a400b0010b22036ab1mr4773131pzk.4.1684758683899; Mon, 22 May 2023 05:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684758683; cv=none; d=google.com; s=arc-20160816; b=eaR/8dHWnGMWzS6tcSKHjRA0qsAR19h0WgKIjcfBeJmm4wzbYVkoWrvAColrTUwS8C yyBY3zlGsRQjYj+Uu+fDBPUfmcBcFLH7t0E6FLWD0tEvymJagbbsrjOCZbKxFYO2Jl0z wo2jBSTI7dXuinvuoqGCEgOutJ9v4X9BXsBUXhEH7QGjQZvjSb492PBRhYWC0aJ0F/my fWPQFaXi2jEEfC+G9eACYSr31G10jc5LojBQwdwI6zo7ZrowABMd3Hh77COKwBqwDcaB awOkR1Rexm3xHZYzUs4kMNQqwAFvOjvRUMNoYtOuSXX5mV/ow8uzpy4BgzczVgR8edOO w9Zg== 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=XUj6Oj222/mpr27SuFOkM51Ydsi0FSikoAA8fgJC0Ms=; b=eoBaQNTq7boP8tYYRu56R/XNb+8bRReGBUwKbjWeKUS7ym81rwGFKMsRopPiW/2RoJ ExlP1he+bMgmHfthNUmRMdl9sXjGv04KaXAFU+FANUGv7ZTyWp5+LSfo7sVxeXkNSUir KkgpLzQkbDhYFWq8oMGEYqGgNqZE2CkfHPCbUCC5Vv7w0cRQsLai6dLXYcjgzFcn1Iaa 08BTHH57Dn+YDThKE4gd02W0WInTRHnQTKYh/8V+mMaaz1/G+tD/OTk1RQ3xjOHyuQBP O5WLPJYIHQNyJoAvNx75uCm6six+P3uGMXt+MCxtTB6EMT4QZ6jRL+QNz5OoGT1TcQIE m5+w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a638c18000000b0053481a225desi4534057pgd.340.2023.05.22.05.31.11; Mon, 22 May 2023 05:31:23 -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 S233739AbjEVM2p (ORCPT + 99 others); Mon, 22 May 2023 08:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234049AbjEVM1R (ORCPT ); Mon, 22 May 2023 08:27:17 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E8F310F3; Mon, 22 May 2023 05:25:23 -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 347DC1515; Mon, 22 May 2023 05:26:02 -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 8A6683F59C; Mon, 22 May 2023 05:25:15 -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-arch@vger.kernel.org, linux@armlinux.org.uk, linux-doc@vger.kernel.org, mark.rutland@arm.com, paulmck@kernel.org, peterz@infradead.org, sstabellini@kernel.org, will@kernel.org Subject: [PATCH 16/26] locking/atomic: scripts: factor out order template generation Date: Mon, 22 May 2023 13:24:19 +0100 Message-Id: <20230522122429.1915021-17-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230522122429.1915021-1-mark.rutland@arm.com> References: <20230522122429.1915021-1-mark.rutland@arm.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766597521733625034?= X-GMAIL-MSGID: =?utf-8?q?1766597521733625034?= 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 Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Paul E. McKenney --- 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" }