Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933562AbdCWOGE (ORCPT ); Thu, 23 Mar 2017 10:06:04 -0400 Received: from www.osadl.org ([62.245.132.105]:35391 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932471AbdCWOGC (ORCPT ); Thu, 23 Mar 2017 10:06:02 -0400 From: Nicholas Mc Guire To: Ingo Molnar Cc: Peter Zijlstra , Oleg Nesterov , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] sched/completions: use true/false for bool returns Date: Thu, 23 Mar 2017 15:05:45 +0100 Message-Id: <1490277945-22429-1-git-send-email-der.herr@hofr.at> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2483 Lines: 71 Use true/false for bool rather than 1|0 both in the code and the documentation Signed-off-by: Nicholas Mc Guire --- Found by coccinelle: boolreturn.cocci complains about ./kernel/sched/completion.c:281:9-10: WARNING: return of 0/1 in function 'try_wait_for_completion' with return type bool in addition the int type should also be a bool here and assigned appropriately along with fixing up the documentation. completion_done() was using true/false but the header still was showing 0|1 - so fix up the header to reflect the bool type there as well. Patch was compile tested with: x86_64_defconfig Patch is against 4.11-rc3 (localversion-next is next-20170323) kernel/sched/completion.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c index 53f9558..ef92b15 100644 --- a/kernel/sched/completion.c +++ b/kernel/sched/completion.c @@ -258,8 +258,8 @@ EXPORT_SYMBOL(wait_for_completion_killable_timeout); * try_wait_for_completion - try to decrement a completion without blocking * @x: completion structure * - * Return: 0 if a decrement cannot be done without blocking - * 1 if a decrement succeeded. + * Return: false if a decrement cannot be done without blocking + * true if a decrement succeeded. * * If a completion is being used as a counting completion, * attempt to decrement the counter without blocking. This @@ -269,7 +269,7 @@ EXPORT_SYMBOL(wait_for_completion_killable_timeout); bool try_wait_for_completion(struct completion *x) { unsigned long flags; - int ret = 1; + bool ret = true; /* * Since x->done will need to be locked only @@ -278,11 +278,11 @@ bool try_wait_for_completion(struct completion *x) * return early in the blocking case. */ if (!READ_ONCE(x->done)) - return 0; + return false; spin_lock_irqsave(&x->wait.lock, flags); if (!x->done) - ret = 0; + ret = false; else if (x->done != UINT_MAX) x->done--; spin_unlock_irqrestore(&x->wait.lock, flags); @@ -294,8 +294,8 @@ EXPORT_SYMBOL(try_wait_for_completion); * completion_done - Test to see if a completion has any waiters * @x: completion structure * - * Return: 0 if there are waiters (wait_for_completion() in progress) - * 1 if there are no waiters. + * Return: false if there are waiters (wait_for_completion() in progress) + * true if there are no waiters. * */ bool completion_done(struct completion *x) -- 2.1.4