Use true/false for bool rather than 1|0 both in the code and the
documentation
Signed-off-by: Nicholas Mc Guire <[email protected]>
---
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