OSDN Git Service

MIPS: bitops: Implement test_and_set_bit() in terms of _lock variant
authorPaul Burton <paul.burton@mips.com>
Tue, 1 Oct 2019 21:53:30 +0000 (21:53 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 7 Oct 2019 16:42:47 +0000 (09:42 -0700)
commit6bbe043bd3f4766b089b7b51a80e75745868c038
tree4e2a4c6a1f357f3c92b6f5ed1ad3ee1f925562be
parent27aab27259aec1f200cf1f84f02b8192d27abe64
MIPS: bitops: Implement test_and_set_bit() in terms of _lock variant

The only difference between test_and_set_bit() & test_and_set_bit_lock()
is memory ordering barrier semantics - the former provides a full
barrier whilst the latter only provides acquire semantics.

We can therefore implement test_and_set_bit() in terms of
test_and_set_bit_lock() with the addition of the extra memory barrier.
Do this in order to avoid duplicating logic.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-kernel@vger.kernel.org
arch/mips/include/asm/bitops.h
arch/mips/lib/bitops.c