summaryrefslogtreecommitdiff
path: root/include/linux/wait_bit.h
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2018-05-09 17:40:44 +0200
committerWolfram Sang <wsa@the-dreams.de>2018-05-09 17:40:44 +0200
commit4c0330208f6bfe5285bae239fdb2a7ec1ce1f78d (patch)
tree257c871b0be4c7eafa0e6911ab596bfb0f51a104 /include/linux/wait_bit.h
parent7781edaed63e9396fc913e0899cb197562e6f1a0 (diff)
parent76aa3de7095f15af7300012cb29ea8ab93eec348 (diff)
Merge tag 'at24-4.17-rc5-fixes-for-wolfram' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-current
Single bug-fix for a regression introduced during the 4.17 merge window.
Diffstat (limited to 'include/linux/wait_bit.h')
-rw-r--r--include/linux/wait_bit.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index 9318b2166439..2b0072fa5e92 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -305,4 +305,21 @@ do { \
__ret; \
})
+/**
+ * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit
+ *
+ * @bit: the bit of the word being waited on
+ * @word: the word being waited on, a kernel virtual address
+ *
+ * You can use this helper if bitflags are manipulated atomically rather than
+ * non-atomically under a lock.
+ */
+static inline void clear_and_wake_up_bit(int bit, void *word)
+{
+ clear_bit_unlock(bit, word);
+ /* See wake_up_bit() for which memory barrier you need to use. */
+ smp_mb__after_atomic();
+ wake_up_bit(word, bit);
+}
+
#endif /* _LINUX_WAIT_BIT_H */