lkml.org 
[lkml]   [2021]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] completion: introduce complete_put() helper function
On Mon, Dec 06, 2021 at 12:03:19PM +0800, Yajun Deng wrote:
> There are many cases where it is necessary to decrease refcount and test,
> then called complete(). So introduce complete_put() helper function.
>
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
> kernel/sched/completion.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
> index a778554f9dad..dcb737f1edc2 100644
> --- a/kernel/sched/completion.c
> +++ b/kernel/sched/completion.c
> @@ -38,6 +38,13 @@ void complete(struct completion *x)
> }
> EXPORT_SYMBOL(complete);
>
> +void complete_put(refcount_t *r, struct completion *x)
> +{
> + if (refcount_dec_and_test(r))
> + complete(x);
> +}
> +EXPORT_SYMBOL(complete_put);

Please submit such things as part of the series that makes use of them.

\
 
 \ /
  Last update: 2021-12-06 09:35    [W:0.199 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site