Skip to content

Commit

Permalink
tools: Drop "atomic_" prefix from atomic test_and_set_bit()
Browse files Browse the repository at this point in the history
Drop the "atomic_" prefix from tools' atomic_test_and_set_bit() to
match the kernel nomenclature where test_and_set_bit() is atomic,
and __test_and_set_bit() provides the non-atomic variant.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221119013450.2643007-9-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed Dec 2, 2022
1 parent 7f32a6c commit 3629335
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tools/arch/x86/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ static __always_inline int atomic_cmpxchg(atomic_t *v, int old, int new)
return cmpxchg(&v->counter, old, new);
}

static inline int atomic_test_and_set_bit(long nr, unsigned long *addr)
static inline int test_and_set_bit(long nr, unsigned long *addr)
{
GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(bts), *addr, "Ir", nr, "%0", "c");

}

#endif /* _TOOLS_LINUX_ASM_X86_ATOMIC_H */
2 changes: 1 addition & 1 deletion tools/include/asm-generic/atomic-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int oldval, int newval)
return cmpxchg(&(v)->counter, oldval, newval);
}

static inline int atomic_test_and_set_bit(long nr, unsigned long *addr)
static inline int test_and_set_bit(long nr, unsigned long *addr)
{
unsigned long mask = BIT_MASK(nr);
long old;
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/kvm/lib/ucall_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static struct ucall *ucall_alloc(void)
GUEST_ASSERT(ucall_pool);

for (i = 0; i < KVM_MAX_VCPUS; ++i) {
if (!atomic_test_and_set_bit(i, ucall_pool->in_use)) {
if (!test_and_set_bit(i, ucall_pool->in_use)) {
uc = &ucall_pool->ucalls[i];
memset(uc->args, 0, sizeof(uc->args));
return uc;
Expand Down

0 comments on commit 3629335

Please sign in to comment.