mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
s390/processor: add test_and_set_cpu_flag() and test_and_clear_cpu_flag()
Add test_and_set_cpu_flag() and test_and_clear_cpu_flag() helper functions. Reviewed-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
b977f03ec4
commit
f96f41aae2
@ -59,6 +59,22 @@ static __always_inline bool test_cpu_flag(int flag)
|
||||
return S390_lowcore.cpu_flags & (1UL << flag);
|
||||
}
|
||||
|
||||
static __always_inline bool test_and_set_cpu_flag(int flag)
|
||||
{
|
||||
if (test_cpu_flag(flag))
|
||||
return true;
|
||||
set_cpu_flag(flag);
|
||||
return false;
|
||||
}
|
||||
|
||||
static __always_inline bool test_and_clear_cpu_flag(int flag)
|
||||
{
|
||||
if (!test_cpu_flag(flag))
|
||||
return false;
|
||||
clear_cpu_flag(flag);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test CIF flag of another CPU. The caller needs to ensure that
|
||||
* CPU hotplug can not happen, e.g. by disabling preemption.
|
||||
|
Loading…
Reference in New Issue
Block a user