[v2,04/16] drivers/event: 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>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
drivers/event/cnxk/cnxk_tim_worker.h | 2 +-
drivers/event/dsw/dsw_event.c | 4 ++--
drivers/event/octeontx/timvf_worker.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
@@ -123,7 +123,7 @@
const uint64_t v =
~(TIM_BUCKET_W1_M_NUM_ENTRIES << TIM_BUCKET_W1_S_NUM_ENTRIES);
- return __atomic_and_fetch(&bktp->w1, v, __ATOMIC_ACQ_REL);
+ return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL) & v;
}
static inline uint64_t
@@ -45,8 +45,8 @@
* allocation.
*/
new_total_on_loan =
- __atomic_add_fetch(&dsw->credits_on_loan, acquired_credits,
- __ATOMIC_RELAXED);
+ __atomic_fetch_add(&dsw->credits_on_loan, acquired_credits,
+ __ATOMIC_RELAXED) + acquired_credits;
if (unlikely(new_total_on_loan > dsw->max_inflight)) {
/* Some other port took the last credits */
@@ -135,7 +135,7 @@
{
const uint64_t v = ~(TIM_BUCKET_W1_M_NUM_ENTRIES <<
TIM_BUCKET_W1_S_NUM_ENTRIES);
- return __atomic_and_fetch(&bktp->w1, v, __ATOMIC_ACQ_REL);
+ return __atomic_fetch_and(&bktp->w1, v, __ATOMIC_ACQ_REL) & v;
}
static inline struct tim_mem_entry *