* [PATCH] timekeeping: no conversion to bool needed
@ 2017-03-24 19:03 Nicholas Mc Guire
2017-03-31 8:30 ` [tip:timers/core] timekeeping: Remove pointless conversion to bool tip-bot for Nicholas Mc Guire
0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2017-03-24 19:03 UTC (permalink / raw)
To: John Stultz
Cc: Thomas Gleixner, Christopher S. Hall, linux-kernel, Nicholas Mc Guire
As interp_forward is type bool assignment to a logical operation directly
is sufficient here.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
Found by coccinelle: boolconv.cocci
./kernel/time/timekeeping.c:1000:9-14: WARNING: conversion to bool not needed he
re
The explicit conversion to bool is not needed here as the logical operator
ensures that the right-side is a bool anyway.
Patch was compiletested with: x86_64_defconfig
Patch is against 4.11-rc3 (localversion-next is next-20170324)
kernel/time/timekeeping.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5b63a21..2921469 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -992,16 +992,15 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
bool interp_forward;
int ret;
if (total_history_cycles == 0 || partial_history_cycles == 0)
return 0;
/* Interpolate shortest distance from beginning or end of history */
- interp_forward = partial_history_cycles > total_history_cycles/2 ?
- true : false;
+ interp_forward = partial_history_cycles > total_history_cycles / 2;
partial_history_cycles = interp_forward ?
total_history_cycles - partial_history_cycles :
partial_history_cycles;
/*
* Scale the monotonic raw time delta by:
* partial_history_cycles / total_history_cycles
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:timers/core] timekeeping: Remove pointless conversion to bool
2017-03-24 19:03 [PATCH] timekeeping: no conversion to bool needed Nicholas Mc Guire
@ 2017-03-31 8:30 ` tip-bot for Nicholas Mc Guire
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Nicholas Mc Guire @ 2017-03-31 8:30 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, der.herr, john.stultz, mingo, christopher.s.hall, hpa,
linux-kernel
Commit-ID: 5fc63f9577322d11019b6d357f73f5ce9031f263
Gitweb: http://git.kernel.org/tip/5fc63f9577322d11019b6d357f73f5ce9031f263
Author: Nicholas Mc Guire <der.herr@hofr.at>
AuthorDate: Fri, 24 Mar 2017 20:03:35 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 31 Mar 2017 10:26:56 +0200
timekeeping: Remove pointless conversion to bool
interp_forward is type bool so assignment from a logical operation directly
is sufficient.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Cc: "Christopher S. Hall" <christopher.s.hall@intel.com>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/1490382215-30505-1-git-send-email-der.herr@hofr.at
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/time/timekeeping.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5b63a21..9652bc5 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -996,8 +996,7 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
return 0;
/* Interpolate shortest distance from beginning or end of history */
- interp_forward = partial_history_cycles > total_history_cycles/2 ?
- true : false;
+ interp_forward = partial_history_cycles > total_history_cycles / 2;
partial_history_cycles = interp_forward ?
total_history_cycles - partial_history_cycles :
partial_history_cycles;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-31 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 19:03 [PATCH] timekeeping: no conversion to bool needed Nicholas Mc Guire
2017-03-31 8:30 ` [tip:timers/core] timekeeping: Remove pointless conversion to bool tip-bot for Nicholas Mc Guire
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).