From patchwork Wed Jul 15 05:54:02 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: 51115 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0D4122A24 for ; Wed, 15 Jul 2015 05:55:28 +0000 (UTC) Received: by lbbpo10 with SMTP id po10sf7755812lbb.1 for ; Tue, 14 Jul 2015 22:55:27 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=8uVA12sDhAsa4Y27CtaGozI+pbV8rULcNISfrCQaBYo=; b=Ki07H0YymdI7OUkm7wHCyZVHcJUmC9PBDGm7MJamgS1rT8YfybOTWM/p2S71vyFN+V 4ETRoCiArjB3YWJNTHsHUvc252wlQsRmHSiavllqHIkkqyqYPDauaZ3OkQPC51gRcbRw lII4IJuA1FfcbYIhjS7HJZxcsachr+QvEDYy9tlWYtJ331ZR6uM7DWdB6qTv0eULNwcZ a57L3/uLNjaqyFN1nQ6SRaDtgUgAecW8UVGy5soAOkP0pclL6F812KKPTl9nj+j9Z7bN IgmbiZkvhzJNaiSY7J4tb+pItxaMYGPj5Wz9FJxsnVfg/yS1cRMQrYEv+QVfELm7godJ BNcA== X-Gm-Message-State: ALoCoQkLJX7MbfLAkR0VbB9vU/nbShkz+9/dCHt3GFy3Z/Exug0X+u4sH1uR5kdXijc15fdyv8gR X-Received: by 10.112.215.67 with SMTP id og3mr1255375lbc.8.1436939727291; Tue, 14 Jul 2015 22:55:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.164 with SMTP id cz4ls150460lac.3.gmail; Tue, 14 Jul 2015 22:55:27 -0700 (PDT) X-Received: by 10.152.22.4 with SMTP id z4mr2283107lae.81.1436939726980; Tue, 14 Jul 2015 22:55:26 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id g10si2998402lam.152.2015.07.14.22.55.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2015 22:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagx9 with SMTP id x9so18196164lag.1 for ; Tue, 14 Jul 2015 22:55:26 -0700 (PDT) X-Received: by 10.152.42.177 with SMTP id p17mr2297653lal.29.1436939726406; Tue, 14 Jul 2015 22:55:26 -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 hn6csp2843356lbb; Tue, 14 Jul 2015 22:55:25 -0700 (PDT) X-Received: by 10.67.7.162 with SMTP id dd2mr4399441pad.151.1436939724497; Tue, 14 Jul 2015 22:55:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ko5si5645237pdb.135.2015.07.14.22.55.23; Tue, 14 Jul 2015 22:55:24 -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 S1752007AbbGOFzV (ORCPT + 26 others); Wed, 15 Jul 2015 01:55:21 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:33868 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbbGOFzU (ORCPT ); Wed, 15 Jul 2015 01:55:20 -0400 Received: by pacan13 with SMTP id an13so18133091pac.1 for ; Tue, 14 Jul 2015 22:55:19 -0700 (PDT) X-Received: by 10.68.91.5 with SMTP id ca5mr4561245pbb.105.1436939719879; Tue, 14 Jul 2015 22:55:19 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id nt6sm3257337pbc.18.2015.07.14.22.55.16 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jul 2015 22:55:19 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, 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 2/6] timekeeping: Introduce current_kernel_time64() Date: Wed, 15 Jul 2015 13:54:02 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 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.50 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 since it returns a timespec value. Introduce current_kernel_time64() which returns a timespec64 value. Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 9 ++++++++- kernel/time/timekeeping.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3aa72e6..657ea03 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -18,10 +18,17 @@ 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 bca3667..2d58742 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1874,7 +1874,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; @@ -1886,9 +1886,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) {