Commit fee84c43 authored by John Stultz's avatar John Stultz Committed by Thomas Gleixner

time: Explicitly use u32 instead of int for shift values

Ingo noted that using a u32 instead of int for shift values
would be better to make sure the compiler doesn't unnecessarily
use complex signed arithmetic.
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Reviewed-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Link: http://lkml.kernel.org/r/1342156917-25092-4-git-send-email-john.stultz@linaro.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 42e71e81
...@@ -28,7 +28,7 @@ struct timekeeper { ...@@ -28,7 +28,7 @@ struct timekeeper {
/* NTP adjusted clock multiplier */ /* NTP adjusted clock multiplier */
u32 mult; u32 mult;
/* The shift value of the current clocksource. */ /* The shift value of the current clocksource. */
int shift; u32 shift;
/* Number of clock cycles in one NTP interval. */ /* Number of clock cycles in one NTP interval. */
cycle_t cycle_interval; cycle_t cycle_interval;
/* Number of clock shifted nano seconds in one NTP interval. */ /* Number of clock shifted nano seconds in one NTP interval. */
...@@ -45,7 +45,7 @@ struct timekeeper { ...@@ -45,7 +45,7 @@ struct timekeeper {
s64 ntp_error; s64 ntp_error;
/* Shift conversion between clock shifted nano seconds and /* Shift conversion between clock shifted nano seconds and
* ntp shifted nano seconds. */ * ntp shifted nano seconds. */
int ntp_error_shift; u32 ntp_error_shift;
/* The current time */ /* The current time */
struct timespec xtime; struct timespec xtime;
...@@ -960,7 +960,7 @@ static void timekeeping_adjust(s64 offset) ...@@ -960,7 +960,7 @@ static void timekeeping_adjust(s64 offset)
* *
* Returns the unconsumed cycles. * Returns the unconsumed cycles.
*/ */
static cycle_t logarithmic_accumulation(cycle_t offset, int shift) static cycle_t logarithmic_accumulation(cycle_t offset, u32 shift)
{ {
u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift; u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift;
u64 raw_nsecs; u64 raw_nsecs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment