MIPS: atomic: Unify 32b & 64b sub_if_positive
authorPaul Burton <paul.burton@mips.com>
Tue, 1 Oct 2019 21:53:23 +0000 (21:53 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 7 Oct 2019 16:42:34 +0000 (09:42 -0700)
commit40e784b4d4bc31dee5f1db6a20287777d3aaa4dc
tree47ab76acb9d27ec4d5300286ac2ffcb427a3188f
parent77d281b7966e476927a45c5fb272d720aa75bb95
MIPS: atomic: Unify 32b & 64b sub_if_positive

Unify the definitions of atomic_sub_if_positive() &
atomic64_sub_if_positive() using a macro like we do for most other
atomic functions. This allows us to share the implementation ensuring
consistency between the two. Notably this provides the appropriate
loongson3_war barriers in the atomic64_sub_if_positive() case which were
previously missing.

The code is rearranged a little to handle the !kernel_uses_llsc case
first in order to de-indent the LL/SC case & allow us not to go over 80
characters per line.

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/atomic.h