Skip to content

Commit

Permalink
locking/atomic: scripts: split pfx/name/sfx/order
Browse files Browse the repository at this point in the history
Currently gen-atomic-long.sh's gen_proto_order_variant() function
combines the pfx/name/sfx/order variables immediately, unlike other
functions in gen-atomic-*.sh.

This is fine today, but subsequent patches will require the individual
individual pfx/name/sfx/order variables within gen-atomic-long.sh's
gen_proto_order_variant() function. In preparation for this, split the
variables in the style of other gen-atomic-*.sh scripts.

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-22-mark.rutland@arm.com
  • Loading branch information
Mark Rutland authored and Peter Zijlstra committed Jun 5, 2023
1 parent 9257959 commit b916a8c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/atomic/gen-atomic-long.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,25 @@ gen_args_cast()
gen_proto_order_variant()
{
local meta="$1"; shift
local name="$1$2$3$4"; shift; shift; shift; shift
local pfx="$1"; shift
local name="$1"; shift
local sfx="$1"; shift
local order="$1"; shift
local atomic="$1"; shift
local int="$1"; shift

local atomicname="${pfx}${name}${sfx}${order}"

local ret="$(gen_ret_type "${meta}" "long")"
local params="$(gen_params "long" "atomic_long" "$@")"
local argscast="$(gen_args_cast "${int}" "${atomic}" "$@")"
local retstmt="$(gen_ret_stmt "${meta}")"

cat <<EOF
static __always_inline ${ret}
raw_atomic_long_${name}(${params})
raw_atomic_long_${atomicname}(${params})
{
${retstmt}raw_${atomic}_${name}(${argscast});
${retstmt}raw_${atomic}_${atomicname}(${argscast});
}
EOF
Expand Down

0 comments on commit b916a8c

Please sign in to comment.