Commit f96f41aa authored by Heiko Carstens's avatar Heiko Carstens

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: default avatarSven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent b977f03e
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment