Skip to content

Commit

Permalink
time: Explicitly use u32 instead of int for shift values
Browse files Browse the repository at this point in the history
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: John Stultz <john.stultz@linaro.org>
Reviewed-by: Ingo 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.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
johnstultz-work authored and KAGA-KOKO committed Jul 15, 2012
1 parent 42e71e8 commit fee84c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct timekeeper {
/* NTP adjusted clock multiplier */
u32 mult;
/* The shift value of the current clocksource. */
int shift;
u32 shift;
/* Number of clock cycles in one NTP interval. */
cycle_t cycle_interval;
/* Number of clock shifted nano seconds in one NTP interval. */
Expand All @@ -45,7 +45,7 @@ struct timekeeper {
s64 ntp_error;
/* Shift conversion between clock shifted nano seconds and
* ntp shifted nano seconds. */
int ntp_error_shift;
u32 ntp_error_shift;

/* The current time */
struct timespec xtime;
Expand Down Expand Up @@ -960,7 +960,7 @@ static void timekeeping_adjust(s64 offset)
*
* 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 raw_nsecs;
Expand Down

0 comments on commit fee84c4

Please sign in to comment.