From patchwork Fri Jul 13 05:21:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9968 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 A4BBF23F4C for ; Fri, 13 Jul 2012 05:22:37 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 757CAA1814F for ; Fri, 13 Jul 2012 05:22:37 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so3631052yhp.11 for ; Thu, 12 Jul 2012 22:22:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=ZUtkKgqYdb3V7Jh7hdrSLwT2PcoH3qwxJddWhe0eIX4=; b=Oy/JqAs5aR8tEfnQdrQmT6hAaRcyF7/wixEl86KjrIThfqrjJiAz78WkY4V+zbixHP 9v6qtR/NIBOmEELr/CNb6IxleFKL2MIpoeMxLbeCSKd70Rya5Nv2R1PBuiB3acFjCjBQ gySLBAnOmEv/VrNQrhVz9aYPNDXuoh0feSMpK2gn83vIZdfwTPy4nQAhb2RnDOsoOJX8 W/OlxXfyImG784XRtlFBtMt5YlhrltuqDBq/2z+A4mX1RDNC5q3rW6gAGmx1COejQqXm 9+/ibJCgRb0kdgMAav2LU61yrsOBnRH5Zd0OV8BM3dJ4J4IMLsa2gDkJQLoMbusRRvl4 ZnSQ== Received: by 10.50.40.193 with SMTP id z1mr272803igk.0.1342156956632; Thu, 12 Jul 2012 22:22:36 -0700 (PDT) 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.241.2 with SMTP id lc2csp11719ibb; Thu, 12 Jul 2012 22:22:34 -0700 (PDT) Received: by 10.43.70.71 with SMTP id yf7mr451982icb.14.1342156953563; Thu, 12 Jul 2012 22:22:33 -0700 (PDT) Received: from e39.co.us.ibm.com (e39.co.us.ibm.com. [32.97.110.160]) by mx.google.com with ESMTPS id eu10si805189igc.55.2012.07.12.22.22.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jul 2012 22:22:33 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.110.160 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.110.160; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.110.160 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Jul 2012 23:22:32 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Jul 2012 23:22:23 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id CB9BB1FF0038; Fri, 13 Jul 2012 05:22:21 +0000 (WET) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6D5MMkL291666; Thu, 12 Jul 2012 23:22:22 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6D5MLP4017817; Thu, 12 Jul 2012 23:22:22 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6D5MIiO017604; Thu, 12 Jul 2012 23:22:20 -0600 From: John Stultz To: Linux Kernel Cc: John Stultz , Ingo Molnar , Peter Zijlstra , Richard Cochran , Prarit Bhargava , Thomas Gleixner Subject: [PATCH 3/8] time: Explicitly use u32 instead of int for shift values Date: Fri, 13 Jul 2012 01:21:52 -0400 Message-Id: <1342156917-25092-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1342156917-25092-1-git-send-email-john.stultz@linaro.org> References: <1342156917-25092-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071305-4242-0000-0000-0000024F2249 X-Gm-Message-State: ALoCoQm6we1JXFjKiMkPSLqIPE8gRAdLeDZLYZ5JT0FdTCZdpafKanxTvvKlH+I21Pyfd06FssqO 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: Peter Zijlstra CC: Richard Cochran CC: Prarit Bhargava CC: Thomas Gleixner Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index c2f12aa..4fd83df 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; /* Number of clock cycles in one NTP interval. */ cycle_t cycle_interval; /* Number of clock shifted nano seconds in one NTP interval. */ @@ -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; @@ -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;