Skip to contentSkip to conversation

rcu: better document kfree_rcu()

PATCH Applied Mauro Carvalho Chehab 3 participants 3 messages Jan 14, 2021 – Jan 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: better document kfree_rcu()

After changeset 5130b8fd0690 ("rcu: Introduce kfree_rcu() single-argument macro"), kernel-doc now emits two warnings:

./include/linux/rcupdate.h:884: warning: Excess function parameter 'ptr' description in 'kfree_rcu' ./include/linux/rcupdate.h:884: warning: Excess function parameter 'rhf' description in 'kfree_rcu'

What's happening here is that some macro magic was added in order to call two different versions of kfree_rcu(), being the first one with just one argument and a second one with two arguments.

That makes harder to document the kfree_rcu() arguments, which also reflects on the documentation text.

In order to make clearer that this macro accepts optional arguments, by using macro concatenation, changing its definition from:

	#define kfree_rcu kvfree_rcu

to:

	#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)

That not only helps kernel-doc to understand the macro arguemnts, but also provides a better C definition that makes clearer that the first argument is mandatory and the second one is optional.

Fixes 5130b8fd0690 ("rcu: Introduce kfree_rcu() single-argument macro")
---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index bd04f722714f..5cc6deaa5df2 100644
@@ -881,7 +881,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
  * The BUILD_BUG_ON check must not involve any function calls, hence the
  * checks are done in macros here.
  */
-#define kfree_rcu kvfree_rcu
+#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)
 
 /**
  * kvfree_rcu() - kvfree an object after a grace period.
Signature · 1 line
2.29.2
maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 47 lines · Mauro Carvalho Chehab

After changeset 5130b8fd0690 ("rcu: Introduce kfree_rcu() single-argument macro"), kernel-doc now emits two warnings:

./include/linux/rcupdate.h:884: warning: Excess function parameter 'ptr' description in 'kfree_rcu' ./include/linux/rcupdate.h:884: warning: Excess function parameter 'rhf' description in 'kfree_rcu'

What's happening here is that some macro magic was added in order to call two different versions of kfree_rcu(), being the first one with just one argument and a second one with two arguments.

That makes harder to document the kfree_rcu() arguments, which also reflects on the documentation text.

In order to make clearer that this macro accepts optional arguments, by using macro concatenation, changing its definition from:

	#define kfree_rcu kvfree_rcu

to:

	#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)

That not only helps kernel-doc to understand the macro arguemnts, but also provides a better C definition that makes clearer that the first argument is mandatory and the second one is optional.

Fixes 5130b8fd0690 ("rcu: Introduce kfree_rcu() single-argument macro")
---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index bd04f722714f..5cc6deaa5df2 100644
@@ -881,7 +881,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
  * The BUILD_BUG_ON check must not involve any function calls, hence the
  * checks are done in macros here.
  */
-#define kfree_rcu kvfree_rcu
+#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)
 
 /**
  * kvfree_rcu() - kvfree an object after a grace period.
Signature · 1 line
2.29.2

I think it is fair enough. I checked the "kernel-doc" and after this change it does not detect any violations which are in question.

--
Vlad Rezki

maintainer Applied
#2 lore raw
Quoted 51 lines · Uladzislau Rezki
Quoted 47 lines · Mauro Carvalho Chehab

After changeset 5130b8fd0690 ("rcu: Introduce kfree_rcu() single-argument macro"), kernel-doc now emits two warnings:

./include/linux/rcupdate.h:884: warning: Excess function parameter 'ptr' description in 'kfree_rcu' ./include/linux/rcupdate.h:884: warning: Excess function parameter 'rhf' description in 'kfree_rcu'

What's happening here is that some macro magic was added in order to call two different versions of kfree_rcu(), being the first one with just one argument and a second one with two arguments.

That makes harder to document the kfree_rcu() arguments, which also reflects on the documentation text.

In order to make clearer that this macro accepts optional arguments, by using macro concatenation, changing its definition from:

	#define kfree_rcu kvfree_rcu

to:

	#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)

That not only helps kernel-doc to understand the macro arguemnts, but also provides a better C definition that makes clearer that the first argument is mandatory and the second one is optional.

Fixes 5130b8fd0690 ("rcu: Introduce kfree_rcu() single-argument macro")
---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index bd04f722714f..5cc6deaa5df2 100644
@@ -881,7 +881,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
  * The BUILD_BUG_ON check must not involve any function calls, hence the
  * checks are done in macros here.
  */
-#define kfree_rcu kvfree_rcu
+#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)
 
 /**
  * kvfree_rcu() - kvfree an object after a grace period.
Signature · 1 line
2.29.2

I think it is fair enough. I checked the "kernel-doc" and after this change it does not detect any violations which are in question.

Quoted 1 line

Queued, thank you both!

Thanx, Paul