2 # SPDX-License-Identifier: GPL-2.0
4 ATOMICDIR=$(dirname $0)
6 . ${ATOMICDIR}/atomic-tbl.sh
8 #gen_cast(arg, int, atomic)
13 local atomic="$1"; shift
15 [ "${arg%%:*}" = "p" ] || return
17 printf "($(gen_param_type "${arg}" "${int}" "${atomic}"))"
20 #gen_args_cast(int, atomic, arg...)
24 local atomic="$1"; shift
26 while [ "$#" -gt 0 ]; do
27 local cast="$(gen_cast "$1" "${int}" "${atomic}")"
28 local arg="$(gen_param_name "$1")"
29 printf "${cast}${arg}"
30 [ "$#" -gt 1 ] && printf ", "
35 #gen_proto_order_variant(meta, pfx, name, sfx, order, arg...)
36 gen_proto_order_variant()
38 local meta="$1"; shift
40 local name="$1"; shift
42 local order="$1"; shift
44 local atomicname="${pfx}${name}${sfx}${order}"
46 local ret="$(gen_ret_type "${meta}" "long")"
47 local params="$(gen_params "long" "atomic_long" "$@")"
48 local argscast_32="$(gen_args_cast "int" "atomic" "$@")"
49 local argscast_64="$(gen_args_cast "s64" "atomic64" "$@")"
50 local retstmt="$(gen_ret_stmt "${meta}")"
52 gen_kerneldoc "raw_" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "atomic_long" "long" "$@"
55 static __always_inline ${ret}
56 raw_atomic_long_${atomicname}(${params})
59 ${retstmt}raw_atomic64_${atomicname}(${argscast_64});
61 ${retstmt}raw_atomic_${atomicname}(${argscast_32});
69 // SPDX-License-Identifier: GPL-2.0
72 // DO NOT MODIFY THIS FILE DIRECTLY
74 #ifndef _LINUX_ATOMIC_LONG_H
75 #define _LINUX_ATOMIC_LONG_H
77 #include <linux/compiler.h>
78 #include <asm/types.h>
81 typedef atomic64_t atomic_long_t;
82 #define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
83 #define atomic_long_cond_read_acquire atomic64_cond_read_acquire
84 #define atomic_long_cond_read_relaxed atomic64_cond_read_relaxed
86 typedef atomic_t atomic_long_t;
87 #define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
88 #define atomic_long_cond_read_acquire atomic_cond_read_acquire
89 #define atomic_long_cond_read_relaxed atomic_cond_read_relaxed
94 grep '^[a-z]' "$1" | while read name meta args; do
95 gen_proto "${meta}" "${name}" ${args}
99 #endif /* _LINUX_ATOMIC_LONG_H */