From: Yury Norov <yury.norov@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] bitops: Add a comment explaining the double underscore macros
Date: Mon, 10 Jun 2024 05:45:45 -0700 [thread overview]
Message-ID: <Zmb1ebn3HWPZc6Bo@yury-ThinkPad> (raw)
In-Reply-To: <0ffbc9c3-7a7c-4cbe-bdb7-1041df44ce53@kili.mountain>
On Mon, Jun 10, 2024 at 12:18:03PM +0300, Dan Carpenter wrote:
> 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>
> ---
> include/linux/bitops.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> index 46d4bdc634c0..b35a5c3783f6 100644
> --- a/include/linux/bitops.h
> +++ b/include/linux/bitops.h
> @@ -29,6 +29,9 @@ extern unsigned long __sw_hweight64(__u64 w);
> #include <asm-generic/bitops/generic-non-atomic.h>
>
> /*
> + * These double underscore __set_bit(), __clear_bit() macros are non-atomic
> + * versions of set_bit(), clear_bit() and so on.
> + *
> * Many architecture-specific non-atomic bitops contain inline asm code and due
> * to that the compiler can't optimize them to compile-time expressions or
> * constants. In contrary, generic_*() helpers are defined in pure C and
> --
> 2.39.2
If you find the underscored notation confusing (everyone does),
and want to add an extra notice, I'm OK with that. But...
The comment you're prepending relates to the bitop() macro, not
those individual bit ops. bitop() is used to generate test_bit()
as well, with is not split to atomic/non-atomic.
Can you put your note on top of the actual macro declarations, one
starting with '#define __set_bit()'. Can you also please use a more
neutral language. Maybe something like this?
The following macros are non-atomic versions of their
non-underscored counterparts.
Now that you explicitly mention non-atomic macros, and for test_bit()
and test_bit_aquire() there's no such separation, can you add a blank
line to split them out and make it clear that the comment is not
related to the test_bit() guys.
Thanks,
Yury
next prev parent reply other threads:[~2024-06-10 12:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 9:18 [PATCH] bitops: Add a comment explaining the double underscore macros Dan Carpenter
2024-06-10 12:45 ` Yury Norov [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-06-11 12:38 Dan Carpenter
2024-06-11 13:08 ` Linus Walleij
2024-06-11 20:42 ` Yury Norov
2024-06-12 5:15 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zmb1ebn3HWPZc6Bo@yury-ThinkPad \
--to=yury.norov@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox