]> Git Repo - J-linux.git/commitdiff
bitops: Add a comment explaining the double underscore macros
authorDan Carpenter <[email protected]>
Tue, 11 Jun 2024 12:38:12 +0000 (15:38 +0300)
committerYury Norov <[email protected]>
Tue, 18 Jun 2024 17:40:53 +0000 (10:40 -0700)
Linus Walleij pointed out that a new comer might be confused about the
difference between set_bit() and __set_bit().  Add a comment explaining
the difference.

Link: https://lore.kernel.org/all/CACRpkdZFPG_YLici-BmYfk9HZ36f4WavCN3JNotkk8cPgCODCg@mail.gmail.com/
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Yury Norov <[email protected]>
include/linux/bitops.h

index 46d4bdc634c0bbaa7da315529d43937abaf205c2..ba35bbf07798b9548ddf28e9efb97eadc3a9a016 100644 (file)
@@ -47,12 +47,17 @@ extern unsigned long __sw_hweight64(__u64 w);
          __builtin_constant_p(*(const unsigned long *)(addr))) ?       \
         const##op(nr, addr) : op(nr, addr))
 
+/*
+ * The following macros are non-atomic versions of their non-underscored
+ * counterparts.
+ */
 #define __set_bit(nr, addr)            bitop(___set_bit, nr, addr)
 #define __clear_bit(nr, addr)          bitop(___clear_bit, nr, addr)
 #define __change_bit(nr, addr)         bitop(___change_bit, nr, addr)
 #define __test_and_set_bit(nr, addr)   bitop(___test_and_set_bit, nr, addr)
 #define __test_and_clear_bit(nr, addr) bitop(___test_and_clear_bit, nr, addr)
 #define __test_and_change_bit(nr, addr)        bitop(___test_and_change_bit, nr, addr)
+
 #define test_bit(nr, addr)             bitop(_test_bit, nr, addr)
 #define test_bit_acquire(nr, addr)     bitop(_test_bit_acquire, nr, addr)
 
This page took 0.049255 seconds and 4 git commands to generate.