[v3,11/16] raw/ifpga: use previous value atomic fetch operations
Checks
Commit Message
Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch adding the necessary code to
allow consumption of the resulting value.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/raw/ifpga/ifpga_rawdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -573,7 +573,7 @@ static int set_surprise_link_check_aer(
dev->poll_enabled = 0;
- if (!__atomic_sub_fetch(&ifpga_monitor_refcnt, 1, __ATOMIC_RELAXED) &&
+ if (!(__atomic_fetch_sub(&ifpga_monitor_refcnt, 1, __ATOMIC_RELAXED) - 1) &&
ifpga_monitor_start_thread) {
ret = pthread_cancel(ifpga_monitor_start_thread);
if (ret)