Skip to content

Commit

Permalink
tools: Drop conflicting non-atomic test_and_{clear,set}_bit() helpers
Browse files Browse the repository at this point in the history
Drop tools' non-atomic test_and_set_bit() and test_and_clear_bit() helpers
now that all users are gone.  The names will be claimed in the future for
atomic versions.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221119013450.2643007-8-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 03a0c81 commit 7f32a6c
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions tools/include/linux/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,6 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
__bitmap_or(dst, src1, src2, nbits);
}

/**
* test_and_set_bit - Set a bit and return its old value
* @nr: Bit to set
* @addr: Address to count from
*/
static inline int test_and_set_bit(int nr, unsigned long *addr)
{
unsigned long mask = BIT_MASK(nr);
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
unsigned long old;

old = *p;
*p = old | mask;

return (old & mask) != 0;
}

/**
* test_and_clear_bit - Clear a bit and return its old value
* @nr: Bit to clear
* @addr: Address to count from
*/
static inline int test_and_clear_bit(int nr, unsigned long *addr)
{
unsigned long mask = BIT_MASK(nr);
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
unsigned long old;

old = *p;
*p = old & ~mask;

return (old & mask) != 0;
}

/**
* bitmap_zalloc - Allocate bitmap
* @nbits: Number of bits
Expand Down

0 comments on commit 7f32a6c

Please sign in to comment.