diff options
author | Mark Rutland | 2021-07-13 11:52:50 +0100 |
---|---|---|
committer | Peter Zijlstra | 2021-07-16 18:46:44 +0200 |
commit | f3e615b4db1fb7034f1d76dc307b77cc848f040e (patch) | |
tree | 131fa0f8061d0faae81132f964e4e929a1ad4759 /scripts/atomic/gen-atomic-fallback.sh | |
parent | 47401d94947d507ff9f33fccf490baf47638fb69 (diff) |
locking/atomic: remove ARCH_ATOMIC remanants
Now that gen-atomic-fallback.sh is only used to generate the arch_*
fallbacks, we don't need to also generate the non-arch_* forms, and can
removethe infrastructure this needed.
There is no change to any of the generated headers as a result of this
patch.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210713105253.7615-3-mark.rutland@arm.com
Diffstat (limited to 'scripts/atomic/gen-atomic-fallback.sh')
-rwxr-xr-x | scripts/atomic/gen-atomic-fallback.sh | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/scripts/atomic/gen-atomic-fallback.sh b/scripts/atomic/gen-atomic-fallback.sh index 2601ff4f9468..8e2da71f1d5f 100755 --- a/scripts/atomic/gen-atomic-fallback.sh +++ b/scripts/atomic/gen-atomic-fallback.sh @@ -2,11 +2,10 @@ # SPDX-License-Identifier: GPL-2.0 ATOMICDIR=$(dirname $0) -ARCH=$2 . ${ATOMICDIR}/atomic-tbl.sh -#gen_template_fallback(template, meta, pfx, name, sfx, order, arch, atomic, int, args...) +#gen_template_fallback(template, meta, pfx, name, sfx, order, atomic, int, args...) gen_template_fallback() { local template="$1"; shift @@ -15,11 +14,10 @@ gen_template_fallback() local name="$1"; shift local sfx="$1"; shift local order="$1"; shift - local arch="$1"; shift local atomic="$1"; shift local int="$1"; shift - local atomicname="${arch}${atomic}_${pfx}${name}${sfx}${order}" + local atomicname="arch_${atomic}_${pfx}${name}${sfx}${order}" local ret="$(gen_ret_type "${meta}" "${int}")" local retstmt="$(gen_ret_stmt "${meta}")" @@ -34,7 +32,7 @@ gen_template_fallback() fi } -#gen_proto_fallback(meta, pfx, name, sfx, order, arch, atomic, int, args...) +#gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...) gen_proto_fallback() { local meta="$1"; shift @@ -65,44 +63,26 @@ gen_proto_order_variant() local name="$1"; shift local sfx="$1"; shift local order="$1"; shift - local arch="$1" - local atomic="$2" + local atomic="$1" - local basename="${arch}${atomic}_${pfx}${name}${sfx}" + local basename="arch_${atomic}_${pfx}${name}${sfx}" - printf "#define arch_${basename}${order} ${basename}${order}\n" + printf "#define ${basename}${order} ${basename}${order}\n" } -#gen_proto_order_variants(meta, pfx, name, sfx, arch, atomic, int, args...) +#gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...) gen_proto_order_variants() { local meta="$1"; shift local pfx="$1"; shift local name="$1"; shift local sfx="$1"; shift - local arch="$1" - local atomic="$2" + local atomic="$1" - local basename="${arch}${atomic}_${pfx}${name}${sfx}" + local basename="arch_${atomic}_${pfx}${name}${sfx}" local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")" - if [ -z "$arch" ]; then - gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" - - if meta_has_acquire "${meta}"; then - gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" - fi - if meta_has_release "${meta}"; then - gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" - fi - if meta_has_relaxed "${meta}"; then - gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_relaxed" "$@" - fi - - echo "" - fi - # If we don't have relaxed atomics, then we don't bother with ordering fallbacks # read_acquire and set_release need to be templated, though if ! meta_has_relaxed "${meta}"; then @@ -187,38 +167,38 @@ gen_try_cmpxchg_fallback() local order="$1"; shift; cat <<EOF -#ifndef ${ARCH}try_cmpxchg${order} -#define ${ARCH}try_cmpxchg${order}(_ptr, _oldp, _new) \\ +#ifndef arch_try_cmpxchg${order} +#define arch_try_cmpxchg${order}(_ptr, _oldp, _new) \\ ({ \\ typeof(*(_ptr)) *___op = (_oldp), ___o = *___op, ___r; \\ - ___r = ${ARCH}cmpxchg${order}((_ptr), ___o, (_new)); \\ + ___r = arch_cmpxchg${order}((_ptr), ___o, (_new)); \\ if (unlikely(___r != ___o)) \\ *___op = ___r; \\ likely(___r == ___o); \\ }) -#endif /* ${ARCH}try_cmpxchg${order} */ +#endif /* arch_try_cmpxchg${order} */ EOF } gen_try_cmpxchg_fallbacks() { - printf "#ifndef ${ARCH}try_cmpxchg_relaxed\n" - printf "#ifdef ${ARCH}try_cmpxchg\n" + printf "#ifndef arch_try_cmpxchg_relaxed\n" + printf "#ifdef arch_try_cmpxchg\n" - gen_basic_fallbacks "${ARCH}try_cmpxchg" + gen_basic_fallbacks "arch_try_cmpxchg" - printf "#endif /* ${ARCH}try_cmpxchg */\n\n" + printf "#endif /* arch_try_cmpxchg */\n\n" for order in "" "_acquire" "_release" "_relaxed"; do gen_try_cmpxchg_fallback "${order}" done - printf "#else /* ${ARCH}try_cmpxchg_relaxed */\n" + printf "#else /* arch_try_cmpxchg_relaxed */\n" - gen_order_fallbacks "${ARCH}try_cmpxchg" + gen_order_fallbacks "arch_try_cmpxchg" - printf "#endif /* ${ARCH}try_cmpxchg_relaxed */\n\n" + printf "#endif /* arch_try_cmpxchg_relaxed */\n\n" } cat << EOF @@ -234,14 +214,14 @@ cat << EOF EOF -for xchg in "${ARCH}xchg" "${ARCH}cmpxchg" "${ARCH}cmpxchg64"; do +for xchg in "arch_xchg" "arch_cmpxchg" "arch_cmpxchg64"; do gen_xchg_fallbacks "${xchg}" done gen_try_cmpxchg_fallbacks grep '^[a-z]' "$1" | while read name meta args; do - gen_proto "${meta}" "${name}" "${ARCH}" "atomic" "int" ${args} + gen_proto "${meta}" "${name}" "atomic" "int" ${args} done cat <<EOF @@ -252,7 +232,7 @@ cat <<EOF EOF grep '^[a-z]' "$1" | while read name meta args; do - gen_proto "${meta}" "${name}" "${ARCH}" "atomic64" "s64" ${args} + gen_proto "${meta}" "${name}" "atomic64" "s64" ${args} done cat <<EOF |