From patchwork Fri Mar 2 07:12:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 7053 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2568023E4A for ; Fri, 2 Mar 2012 07:13:07 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id E1DEDA18497 for ; Fri, 2 Mar 2012 07:13:06 +0000 (UTC) Received: by iage36 with SMTP id e36so2587506iag.11 for ; Thu, 01 Mar 2012 23:13:06 -0800 (PST) Received: by 10.50.95.230 with SMTP id dn6mr713616igb.0.1330672386375; Thu, 01 Mar 2012 23:13:06 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp3345ibg; Thu, 1 Mar 2012 23:13:05 -0800 (PST) Received: by 10.68.216.132 with SMTP id oq4mr10434149pbc.41.1330672385288; Thu, 01 Mar 2012 23:13:05 -0800 (PST) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com. [32.97.110.158]) by mx.google.com with ESMTPS id o5si6926882pbd.58.2012.03.01.23.13.04 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Mar 2012 23:13:05 -0800 (PST) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.158 as permitted sender) client-ip=32.97.110.158; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.158 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Mar 2012 00:13:04 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 2 Mar 2012 00:13:03 -0700 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 6F8D519D804C; Fri, 2 Mar 2012 00:12:57 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q227D2rH253848; Fri, 2 Mar 2012 00:13:02 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q227D1ru004299; Fri, 2 Mar 2012 00:13:01 -0700 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q227D0kJ004269; Fri, 2 Mar 2012 00:13:00 -0700 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 2563DC03EA; Thu, 1 Mar 2012 23:12:59 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Ingo Molnar , Thomas Gleixner , Eric Dumazet , Richard Cochran Subject: [PATCH 9/9] time: Explicitly use u32 instead of int for shift values Date: Thu, 1 Mar 2012 23:12:48 -0800 Message-Id: <1330672368-32290-10-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1330672368-32290-1-git-send-email-john.stultz@linaro.org> References: <1330672368-32290-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12030207-7408-0000-0000-00000324BA8D X-Gm-Message-State: ALoCoQlcroK8dn1Ng7Fabq0KIwUU429e2plH2wC2md0a8H6cGgQuZ8LaxRz9lN28LGXOwFGNoOex 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. CC: Ingo Molnar CC: Thomas Gleixner CC: Eric Dumazet CC: Richard Cochran Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 67983ff..60351a8 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -28,7 +28,7 @@ struct timekeeper { /* NTP adjusted clock multiplier */ u32 mult; /* The shift value of the current clocksource. */ - int shift; + u32 shift; /* cycle value at last accumulation point */ cycle_t cycle_last; /* Number of clock cycles in one NTP interval. */ @@ -48,7 +48,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; /* * wall_to_monotonic is what we need to add to xtime (or xtime corrected * for sub jiffie times) to get to monotonic time. Monotonic is pegged @@ -1016,7 +1016,7 @@ static void timekeeping_adjust(struct timekeeper *tk, s64 offset) * Returns the unconsumed cycles. */ static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset, - int shift) + u32 shift) { u64 nsecps = (u64)NSEC_PER_SEC << tk->shift; u64 raw_nsecs;