* [PATCH] rcu: better document kfree_rcu()
@ 2021-01-14 7:22 Mauro Carvalho Chehab
2021-01-14 11:36 ` Uladzislau Rezki
0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2021-01-14 7:22 UTC (permalink / raw)
To: Paul E. McKenney, Linux Doc Mailing List
Cc: Mauro Carvalho Chehab, Jonathan Corbet, Uladzislau Rezki (Sony),
Joel Fernandes, Josh Triplett, Lai Jiangshan, Mathieu Desnoyers,
Steven Rostedt, linux-kernel, 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")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
include/linux/rcupdate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index bd04f722714f..5cc6deaa5df2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -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.
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rcu: better document kfree_rcu()
2021-01-14 7:22 [PATCH] rcu: better document kfree_rcu() Mauro Carvalho Chehab
@ 2021-01-14 11:36 ` Uladzislau Rezki
2021-01-15 18:54 ` Paul E. McKenney
0 siblings, 1 reply; 3+ messages in thread
From: Uladzislau Rezki @ 2021-01-14 11:36 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Paul E. McKenney, Linux Doc Mailing List, Jonathan Corbet,
Uladzislau Rezki (Sony),
Joel Fernandes, Josh Triplett, Lai Jiangshan, Mathieu Desnoyers,
Steven Rostedt, linux-kernel, rcu
On Thu, Jan 14, 2021 at 08:22:02AM +0100, Mauro Carvalho Chehab wrote:
> 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")
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
> include/linux/rcupdate.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index bd04f722714f..5cc6deaa5df2 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -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.
> --
> 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.
Tested-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Vlad Rezki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rcu: better document kfree_rcu()
2021-01-14 11:36 ` Uladzislau Rezki
@ 2021-01-15 18:54 ` Paul E. McKenney
0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2021-01-15 18:54 UTC (permalink / raw)
To: Uladzislau Rezki
Cc: Mauro Carvalho Chehab, Linux Doc Mailing List, Jonathan Corbet,
Joel Fernandes, Josh Triplett, Lai Jiangshan, Mathieu Desnoyers,
Steven Rostedt, linux-kernel, rcu
On Thu, Jan 14, 2021 at 12:36:19PM +0100, Uladzislau Rezki wrote:
> On Thu, Jan 14, 2021 at 08:22:02AM +0100, Mauro Carvalho Chehab wrote:
> > 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")
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > ---
> > include/linux/rcupdate.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > index bd04f722714f..5cc6deaa5df2 100644
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -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.
> > --
> > 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.
>
> Tested-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Queued, thank you both!
Thanx, Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-15 18:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 7:22 [PATCH] rcu: better document kfree_rcu() Mauro Carvalho Chehab
2021-01-14 11:36 ` Uladzislau Rezki
2021-01-15 18:54 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).