Skip to content

Commit e0eeb93

Browse files
Dan CarpenterYuryNorov
authored andcommitted
bitops: Add a comment explaining the double underscore macros
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 <dan.carpenter@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Yury Norov <yury.norov@gmail.com>
1 parent e334771 commit e0eeb93

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

include/linux/bitops.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,17 @@ extern unsigned long __sw_hweight64(__u64 w);
4747
__builtin_constant_p(*(const unsigned long *)(addr))) ? \
4848
const##op(nr, addr) : op(nr, addr))
4949

50+
/*
51+
* The following macros are non-atomic versions of their non-underscored
52+
* counterparts.
53+
*/
5054
#define __set_bit(nr, addr) bitop(___set_bit, nr, addr)
5155
#define __clear_bit(nr, addr) bitop(___clear_bit, nr, addr)
5256
#define __change_bit(nr, addr) bitop(___change_bit, nr, addr)
5357
#define __test_and_set_bit(nr, addr) bitop(___test_and_set_bit, nr, addr)
5458
#define __test_and_clear_bit(nr, addr) bitop(___test_and_clear_bit, nr, addr)
5559
#define __test_and_change_bit(nr, addr) bitop(___test_and_change_bit, nr, addr)
60+
5661
#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
5762
#define test_bit_acquire(nr, addr) bitop(_test_bit_acquire, nr, addr)
5863

0 commit comments

Comments
 (0)