qcacmn: add QDF wrapper for qdf_atomic_inc_not_zero

Add API to increment atomic variable only when current
value is non zero

Change-Id: I3d0df35e39fb1b08b45e0731a86f002b5dbcb662
This commit is contained in:
Chaithanya Garrepalli
2020-01-13 16:00:34 +05:30
committed by nshrivas
parent 752b5a18a2
commit 06f280e5b5
2 changed files with 24 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -154,6 +154,17 @@ static inline int32_t qdf_atomic_dec_return(qdf_atomic_t *v)
return __qdf_atomic_dec_return(v);
}
/**
* qdf_atomic_inc_not_zero() - increment if not zero
* @v: A pointer to an opaque atomic variable
*
* Return: Returns non-zero on successful increment and zero otherwise
*/
static inline int32_t qdf_atomic_inc_not_zero(qdf_atomic_t *v)
{
return __qdf_atomic_inc_not_zero(v);
}
/**
* qdf_atomic_set_bit - Atomically set a bit in memory
* @nr: bit to set

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -147,6 +147,17 @@ static inline int32_t __qdf_atomic_dec_return(__qdf_atomic_t *v)
return atomic_dec_return(v);
}
/**
* __qdf_atomic_inc_not_zero() - increment if not zero
* @v: A pointer to an opaque atomic variable
*
* Return: Returns non-zero on successful increment and zero otherwise
*/
static inline int32_t __qdf_atomic_inc_not_zero(__qdf_atomic_t *v)
{
return atomic_inc_not_zero(v);
}
/**
* __qdf_atomic_set_bit - Atomically set a bit in memory
* @nr: bit to set