public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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: Tue, 11 Jun 2024 13:42:09 -0700	[thread overview]
Message-ID: <Zmi2oUOjh5elr57T@yury-ThinkPad> (raw)
In-Reply-To: <5a970f32-25c0-4955-b480-a4738bf86153@kili.mountain>

On Tue, Jun 11, 2024 at 03:38:12PM +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>
> ---
> v2: re-word the comment, put it right next to the macros and add a blank
>     line in front of the test_bit() macros so it's not mixed in with the
>     non-atomic macros
> 
>  include/linux/bitops.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> index 46d4bdc634c0..ba35bbf07798 100644
> --- a/include/linux/bitops.h
> +++ b/include/linux/bitops.h
> @@ -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)
>  
> -- 
> 2.39.2

Applied in bitmap-for-next. For the next time please make the subject
prefix [PATCH v2], then [PATCH v3], and so on. The motivation is to
avoid sending emails with identical subjects as some (not mine) email
clients consider one as a reply to another.

Thanks,
Yury

  parent reply	other threads:[~2024-06-11 20:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 12:38 [PATCH] bitops: Add a comment explaining the double underscore macros Dan Carpenter
2024-06-11 13:08 ` Linus Walleij
2024-06-11 20:42 ` Yury Norov [this message]
2024-06-12  5:15   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2024-06-10  9:18 Dan Carpenter
2024-06-10 12:45 ` Yury Norov

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=Zmi2oUOjh5elr57T@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