Thread (16 messages) flat view 16 messages, 5 authors, 2018-07-22

[PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_*

From: peterz@infradead.org (Peter Zijlstra)
Date: 2018-05-24 12:44:18
Also in: lkml

On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote:
+static inline void set_bit(unsigned int nr, volatile unsigned long *p)
 {
+	p += BIT_WORD(nr);
+	atomic_long_fetch_or_relaxed(BIT_MASK(nr), (atomic_long_t *)p);
 }
 
+static inline void clear_bit(unsigned int nr, volatile unsigned long *p)
 {
+	p += BIT_WORD(nr);
+	atomic_long_fetch_andnot_relaxed(BIT_MASK(nr), (atomic_long_t *)p);
 }
 
+static inline void change_bit(unsigned int nr, volatile unsigned long *p)
 {
+	p += BIT_WORD(nr);
+	atomic_long_fetch_xor_relaxed(BIT_MASK(nr), (atomic_long_t *)p);
 }
Why use the fetch variants here?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help