Skip to content

Commit f96f41a

Browse files
committed
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 <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent b977f03 commit f96f41a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

arch/s390/include/asm/processor.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ static __always_inline bool test_cpu_flag(int flag)
5959
return S390_lowcore.cpu_flags & (1UL << flag);
6060
}
6161

62+
static __always_inline bool test_and_set_cpu_flag(int flag)
63+
{
64+
if (test_cpu_flag(flag))
65+
return true;
66+
set_cpu_flag(flag);
67+
return false;
68+
}
69+
70+
static __always_inline bool test_and_clear_cpu_flag(int flag)
71+
{
72+
if (!test_cpu_flag(flag))
73+
return false;
74+
clear_cpu_flag(flag);
75+
return true;
76+
}
77+
6278
/*
6379
* Test CIF flag of another CPU. The caller needs to ensure that
6480
* CPU hotplug can not happen, e.g. by disabling preemption.

0 commit comments

Comments
 (0)