From patchwork Fri Jun 12 07:30:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 49786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9CB9B228DB for ; Fri, 12 Jun 2015 07:32:09 +0000 (UTC) Received: by lbcue7 with SMTP id ue7sf7512952lbc.3 for ; Fri, 12 Jun 2015 00:32:08 -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:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=SiZpDoiUicXdrYURxywRRkPLG/OOmwUlOjplySiWl5Y=; b=eBxWZ0r7yQ4zQt0U1+vrghCecchcqCCwBiDIr8nDlv3dYK5gE6z6Tfh3kiXTVfK3Iz PHal7LZ+9XhdAFG+s1juLne6OngLXA4V0eYxRBBpTinxX4pss+cvVjjm/oBpAyh67JNx B3W91u3MpP0nQlqTbPWacp3zBCnnethE+AZ5l7wqBnNjTfI2YxZQwwSUNCfGIuoT0v/4 DnBRPY08/EdfAia8P3EIA4/lipL54owu+afEvsZIzJWKMUjGNNQy6Wf1/ta0gxYmCyr/ 2SittWY3eNXoByfolLNE/b77CSbR1ENDWREA+CswgxANWioQir4QEQGPO0+DSGdvEPqA LcpQ== X-Gm-Message-State: ALoCoQnGuAb34IQHg0lUcoOYu+a+TvNltAkCqalSGsPv0+7br/lrp5kdXHIFERiwgqwlIdkHGBmG X-Received: by 10.112.97.210 with SMTP id ec18mr12937329lbb.15.1434094328578; Fri, 12 Jun 2015 00:32:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.105 with SMTP id lb9ls543717lab.10.gmail; Fri, 12 Jun 2015 00:32:08 -0700 (PDT) X-Received: by 10.112.122.9 with SMTP id lo9mr13890510lbb.104.1434094328401; Fri, 12 Jun 2015 00:32:08 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id zc2si2712790lbb.27.2015.06.12.00.32.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 00:32:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by laew7 with SMTP id w7so16464245lae.1 for ; Fri, 12 Jun 2015 00:32:08 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr13785709lae.19.1434094328122; Fri, 12 Jun 2015 00:32:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp346966lbb; Fri, 12 Jun 2015 00:32:07 -0700 (PDT) X-Received: by 10.70.102.11 with SMTP id fk11mr20896797pdb.144.1434094326312; Fri, 12 Jun 2015 00:32:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pf6si4216754pbb.67.2015.06.12.00.32.05; Fri, 12 Jun 2015 00:32:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753997AbbFLHb7 (ORCPT + 29 others); Fri, 12 Jun 2015 03:31:59 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:35482 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbbFLHbr (ORCPT ); Fri, 12 Jun 2015 03:31:47 -0400 Received: by pdbnf5 with SMTP id nf5so19392069pdb.2 for ; Fri, 12 Jun 2015 00:31:46 -0700 (PDT) X-Received: by 10.68.193.232 with SMTP id hr8mr21085524pbc.145.1434094306618; Fri, 12 Jun 2015 00:31:46 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id v4sm2690431pbs.0.2015.06.12.00.31.43 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 00:31:46 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, pang.xunlei@linaro.org, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v5 02/24] timekeeping: Introduce current_kernel_time64() Date: Fri, 12 Jun 2015 15:30:32 +0800 Message-Id: <33ad31f2dbcb7613dec1b44c9a5e23ef38fe76bc.1434079262.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: baolin.wang@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.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The current_kernel_time() is not year 2038 safe on 32bit systems due to return timespec value. Introduce current_kernel_time64() function which returns timespec64 value, also as a helper function calling by current_kernel_time(). Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 10 +++++++++- kernel/time/timekeeping.c | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3aa72e6..f886bdb 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -18,10 +18,18 @@ extern int do_sys_settimeofday(const struct timespec *tv, * Kernel time accessors */ unsigned long get_seconds(void); -struct timespec current_kernel_time(void); +struct timespec64 current_kernel_time64(void); /* does not take xtime_lock */ struct timespec __current_kernel_time(void); +static inline struct timespec current_kernel_time(void) +{ + struct timespec64 now = current_kernel_time64(); + + return timespec64_to_timespec(now); +} + /* * timespec based interfaces */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 0d784b3..5fe9b77 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1857,7 +1857,7 @@ struct timespec __current_kernel_time(void) return timespec64_to_timespec(tk_xtime(tk)); } -struct timespec current_kernel_time(void) +struct timespec64 current_kernel_time64(void) { struct timekeeper *tk = &tk_core.timekeeper; struct timespec64 now; @@ -1869,9 +1869,9 @@ struct timespec current_kernel_time(void) now = tk_xtime(tk); } while (read_seqcount_retry(&tk_core.seq, seq)); - return timespec64_to_timespec(now); + return now; } -EXPORT_SYMBOL(current_kernel_time); +EXPORT_SYMBOL(current_kernel_time64); struct timespec64 get_monotonic_coarse64(void) {