From patchwork Thu Jun 11 22:54:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 49774 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 67F1F20C81 for ; Thu, 11 Jun 2015 22:55:12 +0000 (UTC) Received: by wifx6 with SMTP id x6sf203730wif.1 for ; Thu, 11 Jun 2015 15:55:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=7nmEQ5F8mOJ/JuYHkzHXBy+0r03smH52LHD2NbQefsU=; b=fngs/4eBlV8y8CKjtYUHgxGhxx5HPukIIZBSO7QQGuKFBLkfa2nCfuWQEr/OTlxUGo lbS9dekM3HQkdGY39+SD5FjjATiDejl+ksZslZMzJY7MFCMRgb3xNpR2HrZknyHEk3Vw wYojaOWGuaf8d0VoIFc0xL9ATIBGgBdjz/T+CxK9kmaXI0UV80Bn1YHyV2vkb2zCCRKC R0ru078QD6fS79OzvvxyHwKdTbsq975dLGzlfr2vAAKo54jWxfgjTL82AkKfxsAO8EoK 6EuZz57yVHkH2U7DWhI2hQh9DrTBzdnFI6mWkaXquoXdF8dHeLm77A6SCf2+EamhrpC+ vi8g== X-Gm-Message-State: ALoCoQm7lngIm6oBce6IwNxt4AZyNxG5I83uv6Q97n1v4RNPn5aQkM+NxIQrfduRP+62F3EDpYWa X-Received: by 10.112.26.5 with SMTP id h5mr10935505lbg.4.1434063311747; Thu, 11 Jun 2015 15:55:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.35 with SMTP id lt3ls457024lac.38.gmail; Thu, 11 Jun 2015 15:55:11 -0700 (PDT) X-Received: by 10.152.27.197 with SMTP id v5mr12210667lag.23.1434063311598; Thu, 11 Jun 2015 15:55:11 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id jp13si1834540lab.37.2015.06.11.15.55.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 15:55:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lazv15 with SMTP id v15so11416932laz.3 for ; Thu, 11 Jun 2015 15:55:11 -0700 (PDT) X-Received: by 10.152.1.40 with SMTP id 8mr12552489laj.56.1434063311507; Thu, 11 Jun 2015 15:55:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp135156lbb; Thu, 11 Jun 2015 15:55:10 -0700 (PDT) X-Received: by 10.68.65.68 with SMTP id v4mr18218524pbs.31.1434063308171; Thu, 11 Jun 2015 15:55:08 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com. [209.85.192.169]) by mx.google.com with ESMTPS id bm1si2648924pbd.212.2015.06.11.15.55.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 15:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.169 as permitted sender) client-ip=209.85.192.169; Received: by pdbki1 with SMTP id ki1so11474162pdb.1 for ; Thu, 11 Jun 2015 15:55:07 -0700 (PDT) X-Received: by 10.68.167.131 with SMTP id zo3mr18039093pbb.123.1434063307271; Thu, 11 Jun 2015 15:55:07 -0700 (PDT) Received: from localhost.localdomain (c-71-63-136-39.hsd1.or.comcast.net. [71.63.136.39]) by mx.google.com with ESMTPSA id ax2sm1676093pac.21.2015.06.11.15.55.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jun 2015 15:55:06 -0700 (PDT) From: John Stultz To: linux-kernel@vger.kernel.org Cc: John Stultz , Prarit Bhargava , Daniel Bristot de Oliveira , Richard Cochran , Jan Kara , Jiri Bohac , Thomas Gleixner , Ingo Molnar Subject: [PATCH 2/5] ntp: Introduce and use SECS_PER_DAY macro instead of 86400 Date: Thu, 11 Jun 2015 15:54:54 -0700 Message-Id: <1434063297-28657-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434063297-28657-1-git-send-email-john.stultz@linaro.org> References: <1434063297-28657-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently the leapsecond logic uses what looks like magic values. Improve this by defining SECS_PER_DAY and using that macro to make the logic more clear. Cc: Prarit Bhargava Cc: Daniel Bristot de Oliveira Cc: Richard Cochran Cc: Jan Kara Cc: Jiri Bohac Cc: Thomas Gleixner Cc: Ingo Molnar Signed-off-by: John Stultz --- kernel/time/ntp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 7a68100..7aa2161 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -35,6 +35,7 @@ unsigned long tick_nsec; static u64 tick_length; static u64 tick_length_base; +#define SECS_PER_DAY 86400 #define MAX_TICKADJ 500LL /* usecs */ #define MAX_TICKADJ_SCALED \ (((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) @@ -390,7 +391,7 @@ int second_overflow(unsigned long secs) case TIME_INS: if (!(time_status & STA_INS)) time_state = TIME_OK; - else if (secs % 86400 == 0) { + else if (secs % SECS_PER_DAY == 0) { leap = -1; time_state = TIME_OOP; printk(KERN_NOTICE @@ -400,7 +401,7 @@ int second_overflow(unsigned long secs) case TIME_DEL: if (!(time_status & STA_DEL)) time_state = TIME_OK; - else if ((secs + 1) % 86400 == 0) { + else if ((secs + 1) % SECS_PER_DAY == 0) { leap = 1; time_state = TIME_WAIT; printk(KERN_NOTICE