From patchwork Mon Jun 1 11:49:53 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: 49299 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 58733218FC for ; Mon, 1 Jun 2015 11:50:31 +0000 (UTC) Received: by wibbk2 with SMTP id bk2sf22093965wib.2 for ; Mon, 01 Jun 2015 04:50:30 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=9bHa57gRudCIafh2Lxxbz+AfzQn95AXtak9bSVeHB3U=; b=Zn+ZWO1iBDGqh6u1wsnDdV0Ms3wYqbwqhatunZsBzM7CJllvsmeud6I9d8mOzg/trQ NyVX1trg3iro0CpdA5lhiYU/rmHXTgQOXyn/HZn0nKxbUaAZU0HR5Ff+fu+Cr6OiWG4t AzcRi9mi9Ee1SpU+hFLsGiHoQs+XG2W9Af7UB7NhH5wh2NMen5Qggp8ZD5BT8GoEoCq5 O6Uyl+kTywdfzmdtyY3Z3ZyLJcAiasWxKKSPLPrggCyO0yN8OTzJ3jZkE5H27IIwxw3g DJm957ukZ0MoGYzYwQBYGffEmHnsieJhmJV8k3Nd5ZY5PdSasz0uFhz4/6nlGOFBbqYg 8GIg== X-Gm-Message-State: ALoCoQmfmOUG+tSxjVnPIo+Jw90iImlF0iFGLWNTx8TGriPwXw8yLhgGik2MxBW7tC+PbyVrnQKP X-Received: by 10.152.8.17 with SMTP id n17mr20619463laa.0.1433159430521; Mon, 01 Jun 2015 04:50:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.164 with SMTP id cf4ls311059lad.66.gmail; Mon, 01 Jun 2015 04:50:30 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr20451285lah.76.1433159430343; Mon, 01 Jun 2015 04:50:30 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id q10si12107812lbp.109.2015.06.01.04.50.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 04:50:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labpy14 with SMTP id py14so87521694lab.0 for ; Mon, 01 Jun 2015 04:50:29 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr21063619lad.56.1433159429733; Mon, 01 Jun 2015 04:50:29 -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 hn6csp2254691lbb; Mon, 1 Jun 2015 04:50:28 -0700 (PDT) X-Received: by 10.70.34.176 with SMTP id a16mr40177822pdj.66.1433159427848; Mon, 01 Jun 2015 04:50:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kf7si3567417pab.234.2015.06.01.04.50.26; Mon, 01 Jun 2015 04:50:27 -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 S1751948AbbFALuV (ORCPT + 28 others); Mon, 1 Jun 2015 07:50:21 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:34617 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751332AbbFALuP (ORCPT ); Mon, 1 Jun 2015 07:50:15 -0400 Received: by pdbki1 with SMTP id ki1so106021229pdb.1 for ; Mon, 01 Jun 2015 04:50:15 -0700 (PDT) X-Received: by 10.66.119.70 with SMTP id ks6mr39914505pab.78.1433159415232; Mon, 01 Jun 2015 04:50:15 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id nw8sm14302606pdb.30.2015.06.01.04.50.11 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 04:50:14 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, pang.xunlei@linaro.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v4 02/25] timekeeping:Introduce the current_kernel_time64() function with timespec64 type Date: Mon, 1 Jun 2015 19:49:53 +0800 Message-Id: <1433159393-4629-1-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 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.42 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: , This patch adds current_kernel_time64() function with timespec64 type, and makes current_kernel_time() 'static inline' and moves it to timekeeping.h file. It is convenient for user to get the current kernel time with timespec64 type, and delete the current_kernel_time() function easily in timekeeping.h file. That is ready for 2038 when get the current 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 3eaae47..c6d5ae9 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; + + 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 91db941..8ccc02c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1721,7 +1721,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; @@ -1733,9 +1733,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) {