Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/atomic: scripts: factor out order template generation

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 <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230605070124.3741859-17-mark.rutland@arm.com

authored by

Mark Rutland and committed by
Peter Zijlstra
7ed7a156 e40e5298

+17 -17
+17 -17
scripts/atomic/gen-atomic-fallback.sh
··· 32 32 fi 33 33 } 34 34 35 + #gen_order_fallback(meta, pfx, name, sfx, order, atomic, int, args...) 36 + gen_order_fallback() 37 + { 38 + local meta="$1"; shift 39 + local pfx="$1"; shift 40 + local name="$1"; shift 41 + local sfx="$1"; shift 42 + local order="$1"; shift 43 + 44 + local tmpl_order=${order#_} 45 + local tmpl="${ATOMICDIR}/fallbacks/${tmpl_order:-fence}" 46 + gen_template_fallback "${tmpl}" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "$@" 47 + } 48 + 35 49 #gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...) 36 50 gen_proto_fallback() 37 51 { ··· 68 54 #define ${basename}_release ${basename} 69 55 #define ${basename}_relaxed ${basename} 70 56 EOF 71 - } 72 - 73 - gen_proto_order_variant() 74 - { 75 - local meta="$1"; shift 76 - local pfx="$1"; shift 77 - local name="$1"; shift 78 - local sfx="$1"; shift 79 - local order="$1"; shift 80 - local atomic="$1" 81 - 82 - local basename="arch_${atomic}_${pfx}${name}${sfx}" 83 - 84 - printf "#define ${basename}${order} ${basename}${order}\n" 85 57 } 86 58 87 59 #gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...) ··· 117 117 118 118 printf "#else /* ${basename}_relaxed */\n\n" 119 119 120 - gen_template_fallback "${ATOMICDIR}/fallbacks/acquire" "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" 121 - gen_template_fallback "${ATOMICDIR}/fallbacks/release" "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" 122 - gen_template_fallback "${ATOMICDIR}/fallbacks/fence" "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" 120 + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" 121 + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" 122 + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" 123 123 124 124 printf "#endif /* ${basename}_relaxed */\n\n" 125 125 }