Skip to content

Commit f02dd25

Browse files
Zongmin ZhouPaul Walmsley
authored andcommitted
riscv/atomic.h: use RISCV_FULL_BARRIER in _arch_atomic* function.
Replace the same code with the pre-defined macro RISCV_FULL_BARRIER to simplify the code. Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn> Link: https://patch.msgid.link/20251120095831.64211-1-min_halo@163.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
1 parent 6118ebe commit f02dd25

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/riscv/include/asm/atomic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ ATOMIC_OPS(xor, xor, i)
203203
" add %[rc], %[p], %[a]\n" \
204204
" sc." sfx ".rl %[rc], %[rc], %[c]\n" \
205205
" bnez %[rc], 0b\n" \
206-
" fence rw, rw\n" \
206+
RISCV_FULL_BARRIER \
207207
"1:\n" \
208208
: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter) \
209209
: [a]"r" (_a), [u]"r" (_u) \
@@ -242,7 +242,7 @@ static __always_inline s64 arch_atomic64_fetch_add_unless(atomic64_t *v, s64 a,
242242
" addi %[rc], %[p], 1\n" \
243243
" sc." sfx ".rl %[rc], %[rc], %[c]\n" \
244244
" bnez %[rc], 0b\n" \
245-
" fence rw, rw\n" \
245+
RISCV_FULL_BARRIER \
246246
"1:\n" \
247247
: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter) \
248248
: \
@@ -268,7 +268,7 @@ static __always_inline bool arch_atomic_inc_unless_negative(atomic_t *v)
268268
" addi %[rc], %[p], -1\n" \
269269
" sc." sfx ".rl %[rc], %[rc], %[c]\n" \
270270
" bnez %[rc], 0b\n" \
271-
" fence rw, rw\n" \
271+
RISCV_FULL_BARRIER \
272272
"1:\n" \
273273
: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter) \
274274
: \
@@ -294,7 +294,7 @@ static __always_inline bool arch_atomic_dec_unless_positive(atomic_t *v)
294294
" bltz %[rc], 1f\n" \
295295
" sc." sfx ".rl %[rc], %[rc], %[c]\n" \
296296
" bnez %[rc], 0b\n" \
297-
" fence rw, rw\n" \
297+
RISCV_FULL_BARRIER \
298298
"1:\n" \
299299
: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter) \
300300
: \

0 commit comments

Comments
 (0)