From patchwork Wed Jul 29 12:09:43 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: 51657 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 125B122DB5 for ; Wed, 29 Jul 2015 12:11:50 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf3228074lbc.0 for ; Wed, 29 Jul 2015 05:11:48 -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=E2VQ0u+ud+pDxvAVvm+GZoSLY4El5fdAMjjU2y702tQVQ+ry06sVN0BFB2g5IVc8Ug IRZxe1PMG91xYMX/GGh5cszFEOEvaDufv3xXZLTuKfBQgZAI3JKx3h+66uFMCeTCu3UB 90mnycCf3Vko714e9AZbQmmSvOlMmetj7VRhLCU/Nmj7vgJZtDHxfplp8RXt0EtQv46E jkGX4MwQfYbO5yKSlt3AWIWsWSPE8j4bpzdm1d72oMgnP+4kMRkrs0wAfLGRAi5blQFZ UWPsR4HUUPo1P+pKrcBf2o0YK8VcDGjKrzY3HU3kAGgX2gQcDX2UP2C+aXn30JDVyH4F uOaw== X-Gm-Message-State: ALoCoQkxLPlIq/PvOqLdZaho1A1RslQVoeZKTyFarf1DBJNiYlDCKorKTl/VaxYmN9/176V9MJoN X-Received: by 10.180.11.226 with SMTP id t2mr3085573wib.0.1438171908957; Wed, 29 Jul 2015 05:11:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.108 with SMTP id ud12ls36096lac.43.gmail; Wed, 29 Jul 2015 05:11:48 -0700 (PDT) X-Received: by 10.152.21.103 with SMTP id u7mr37700153lae.49.1438171908493; Wed, 29 Jul 2015 05:11:48 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id a5si21337586lbq.168.2015.07.29.05.11.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 05:11:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lahh5 with SMTP id h5so4934445lah.2 for ; Wed, 29 Jul 2015 05:11:48 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr38181789lbb.36.1438171908397; Wed, 29 Jul 2015 05:11:48 -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.7.198 with SMTP id l6csp2716714lba; Wed, 29 Jul 2015 05:11:47 -0700 (PDT) X-Received: by 10.202.4.7 with SMTP id 7mr38412004oie.93.1438171906654; Wed, 29 Jul 2015 05:11:46 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vt1si9178393pab.197.2015.07.29.05.11.45; Wed, 29 Jul 2015 05:11:46 -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 S1753333AbbG2MLn (ORCPT + 27 others); Wed, 29 Jul 2015 08:11:43 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:33260 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752844AbbG2MKz (ORCPT ); Wed, 29 Jul 2015 08:10:55 -0400 Received: by padck2 with SMTP id ck2so4933531pad.0 for ; Wed, 29 Jul 2015 05:10:54 -0700 (PDT) X-Received: by 10.67.8.71 with SMTP id di7mr94350559pad.46.1438171854703; Wed, 29 Jul 2015 05:10:54 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id t2sm40499240pdo.81.2015.07.29.05.10.51 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jul 2015 05:10:53 -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 v2 2/5] timekeeping: Introduce current_kernel_time64() Date: Wed, 29 Jul 2015 20:09:43 +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.49 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) {