public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] bitops: use common function parameter names
@ 2026-05-03  5:25 Randy Dunlap
  2026-05-05 19:01 ` Yury Norov
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2026-05-03  5:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Yury Norov, Rasmus Villemoes, Arnd Bergmann,
	linux-arch

Fix the function prototypes to use the common parameter name 'addr'
instead of 'p' (common to arch-specific implementations of these
functions).
This avoids the kernel-doc warnings:

Warning: include/asm-generic/bitops/lock.h:19 function parameter 'p'
 not described in 'arch_test_and_set_bit_lock'
Warning: include/asm-generic/bitops/lock.h:41 function parameter 'p'
 not described in 'arch_clear_bit_unlock'
Warning: include/asm-generic/bitops/lock.h:59 function parameter 'p'
 not described in 'arch___clear_bit_unlock'

Fixes: 84c6591103db ("locking/atomics, asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
v2: rebase & resend
v3: change the function parameter names instead of the kernel-doc
    comments (Yury) (Fixes: can be kept or dropped at maintainer discretion.)
v4: convert function usage of p to addr (thanks, Yury)

Cc: Yury Norov <yury.norov@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org

Note: Shouldn't this line in the MAINTAINERS file:
F:	include/asm-generic/bitops
instead be
F:	include/asm-generic/bitops/

 include/asm-generic/bitops/lock.h |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

--- linux-next-20260429.orig/include/asm-generic/bitops/lock.h
+++ linux-next-20260429/include/asm-generic/bitops/lock.h
@@ -16,16 +16,16 @@
  * It can be used to implement bit locks.
  */
 static __always_inline int
-arch_test_and_set_bit_lock(unsigned int nr, volatile unsigned long *p)
+arch_test_and_set_bit_lock(unsigned int nr, volatile unsigned long *addr)
 {
 	long old;
 	unsigned long mask = BIT_MASK(nr);
 
-	p += BIT_WORD(nr);
-	if (READ_ONCE(*p) & mask)
+	addr += BIT_WORD(nr);
+	if (READ_ONCE(*addr) & mask)
 		return 1;
 
-	old = raw_atomic_long_fetch_or_acquire(mask, (atomic_long_t *)p);
+	old = raw_atomic_long_fetch_or_acquire(mask, (atomic_long_t *)addr);
 	return !!(old & mask);
 }
 
@@ -38,10 +38,10 @@ arch_test_and_set_bit_lock(unsigned int
  * This operation is atomic and provides release barrier semantics.
  */
 static __always_inline void
-arch_clear_bit_unlock(unsigned int nr, volatile unsigned long *p)
+arch_clear_bit_unlock(unsigned int nr, volatile unsigned long *addr)
 {
-	p += BIT_WORD(nr);
-	raw_atomic_long_fetch_andnot_release(BIT_MASK(nr), (atomic_long_t *)p);
+	addr += BIT_WORD(nr);
+	raw_atomic_long_fetch_andnot_release(BIT_MASK(nr), (atomic_long_t *)addr);
 }
 
 /**
@@ -56,14 +56,14 @@ arch_clear_bit_unlock(unsigned int nr, v
  * See for example x86's implementation.
  */
 static inline void
-arch___clear_bit_unlock(unsigned int nr, volatile unsigned long *p)
+arch___clear_bit_unlock(unsigned int nr, volatile unsigned long *addr)
 {
 	unsigned long old;
 
-	p += BIT_WORD(nr);
-	old = READ_ONCE(*p);
+	addr += BIT_WORD(nr);
+	old = READ_ONCE(*addr);
 	old &= ~BIT_MASK(nr);
-	raw_atomic_long_set_release((atomic_long_t *)p, old);
+	raw_atomic_long_set_release((atomic_long_t *)addr, old);
 }
 
 #ifndef arch_xor_unlock_is_negative_byte

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v4] bitops: use common function parameter names
  2026-05-03  5:25 [PATCH v4] bitops: use common function parameter names Randy Dunlap
@ 2026-05-05 19:01 ` Yury Norov
  0 siblings, 0 replies; 2+ messages in thread
From: Yury Norov @ 2026-05-05 19:01 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, Yury Norov, Rasmus Villemoes, Arnd Bergmann,
	linux-arch

On Sat, May 02, 2026 at 10:25:08PM -0700, Randy Dunlap wrote:
> Fix the function prototypes to use the common parameter name 'addr'
> instead of 'p' (common to arch-specific implementations of these
> functions).
> This avoids the kernel-doc warnings:
> 
> Warning: include/asm-generic/bitops/lock.h:19 function parameter 'p'
>  not described in 'arch_test_and_set_bit_lock'
> Warning: include/asm-generic/bitops/lock.h:41 function parameter 'p'
>  not described in 'arch_clear_bit_unlock'
> Warning: include/asm-generic/bitops/lock.h:59 function parameter 'p'
>  not described in 'arch___clear_bit_unlock'
> 
> Fixes: 84c6591103db ("locking/atomics, asm-generic/bitops/lock.h: Rewrite using atomic_fetch_*()")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>

Added in bitmap-for-next for testing.

Thanks,
Yury

> ---
> v2: rebase & resend
> v3: change the function parameter names instead of the kernel-doc
>     comments (Yury) (Fixes: can be kept or dropped at maintainer discretion.)
> v4: convert function usage of p to addr (thanks, Yury)
> 
> Cc: Yury Norov <yury.norov@gmail.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-arch@vger.kernel.org
> 
> Note: Shouldn't this line in the MAINTAINERS file:
> F:	include/asm-generic/bitops
> instead be
> F:	include/asm-generic/bitops/

scripts/get_maintainers.pl is able to find a proper entry for the
files under the direcory. So, I guess, we're OK.

$ scripts/get_maintainer.pl include/asm-generic/bitops/atomic.h
Yury Norov <yury.norov@gmail.com> (maintainer:BITOPS API)
Rasmus Villemoes <linux@rasmusvillemoes.dk> (reviewer:BITOPS API)
Arnd Bergmann <arnd@arndb.de> (maintainer:GENERIC INCLUDE/ASM HEADER FILES)
linux-arch@vger.kernel.org (open list:GENERIC INCLUDE/ASM HEADER FILES)
linux-kernel@vger.kernel.org (open list)

>  include/asm-generic/bitops/lock.h |   22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> --- linux-next-20260429.orig/include/asm-generic/bitops/lock.h
> +++ linux-next-20260429/include/asm-generic/bitops/lock.h
> @@ -16,16 +16,16 @@
>   * It can be used to implement bit locks.
>   */
>  static __always_inline int
> -arch_test_and_set_bit_lock(unsigned int nr, volatile unsigned long *p)
> +arch_test_and_set_bit_lock(unsigned int nr, volatile unsigned long *addr)
>  {
>  	long old;
>  	unsigned long mask = BIT_MASK(nr);
>  
> -	p += BIT_WORD(nr);
> -	if (READ_ONCE(*p) & mask)
> +	addr += BIT_WORD(nr);
> +	if (READ_ONCE(*addr) & mask)
>  		return 1;
>  
> -	old = raw_atomic_long_fetch_or_acquire(mask, (atomic_long_t *)p);
> +	old = raw_atomic_long_fetch_or_acquire(mask, (atomic_long_t *)addr);
>  	return !!(old & mask);
>  }
>  
> @@ -38,10 +38,10 @@ arch_test_and_set_bit_lock(unsigned int
>   * This operation is atomic and provides release barrier semantics.
>   */
>  static __always_inline void
> -arch_clear_bit_unlock(unsigned int nr, volatile unsigned long *p)
> +arch_clear_bit_unlock(unsigned int nr, volatile unsigned long *addr)
>  {
> -	p += BIT_WORD(nr);
> -	raw_atomic_long_fetch_andnot_release(BIT_MASK(nr), (atomic_long_t *)p);
> +	addr += BIT_WORD(nr);
> +	raw_atomic_long_fetch_andnot_release(BIT_MASK(nr), (atomic_long_t *)addr);
>  }
>  
>  /**
> @@ -56,14 +56,14 @@ arch_clear_bit_unlock(unsigned int nr, v
>   * See for example x86's implementation.
>   */
>  static inline void
> -arch___clear_bit_unlock(unsigned int nr, volatile unsigned long *p)
> +arch___clear_bit_unlock(unsigned int nr, volatile unsigned long *addr)
>  {
>  	unsigned long old;
>  
> -	p += BIT_WORD(nr);
> -	old = READ_ONCE(*p);
> +	addr += BIT_WORD(nr);
> +	old = READ_ONCE(*addr);
>  	old &= ~BIT_MASK(nr);
> -	raw_atomic_long_set_release((atomic_long_t *)p, old);
> +	raw_atomic_long_set_release((atomic_long_t *)addr, old);
>  }
>  
>  #ifndef arch_xor_unlock_is_negative_byte

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-05 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03  5:25 [PATCH v4] bitops: use common function parameter names Randy Dunlap
2026-05-05 19:01 ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox