From patchwork Mon Apr 20 05:57:30 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: 47314 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C58F020553 for ; Mon, 20 Apr 2015 05:58:46 +0000 (UTC) Received: by wgin8 with SMTP id n8sf35244029wgi.0 for ; Sun, 19 Apr 2015 22:58:46 -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=9bHa57gRudCIafh2Lxxbz+AfzQn95AXtak9bSVeHB3U=; b=LAxdvId1n/zNOXC+vFZMTbUNqX8wfq3VMWnEYsEOxPh/1Gt0/YwYaK+l73793SKoUS 6L7eYj+dFU1YSP6vNQLEjYcmTKsYgQLbKxa+PmgywzmJFPp9ba1SlpHv9bKhRst6JfAa V9aZZM1ccDtAIos2LTZJbCfwTrW+g9GlwKLnwFmMONCzC2j9sckks9hCMyDztJUi2dFB fwI214Orwk0RjiZDiJ9xmn242B0Ze+sVP2tq4bEE0uNYav/nc75w7V2zPI3vQDBnvKlA AIJyOwb6loN34Dazfml8We4WtDJ246+oKbO1/2MlrndXF0O6sF+DhXDdsdDHe8gkI9wd DhAg== X-Gm-Message-State: ALoCoQnpJPQv3IANAdVpcDtM0Fe7hK7P6GuNRPaT4Ci5JOGd65WPlmE8HWVIxg2Pu0DVCDBqoAUH X-Received: by 10.112.203.168 with SMTP id kr8mr6473976lbc.10.1429509526023; Sun, 19 Apr 2015 22:58:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.171 with SMTP id az11ls790315lab.107.gmail; Sun, 19 Apr 2015 22:58:45 -0700 (PDT) X-Received: by 10.112.166.139 with SMTP id zg11mr13980479lbb.93.1429509525681; Sun, 19 Apr 2015 22:58:45 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id xg1si14236644lac.41.2015.04.19.22.58.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Apr 2015 22:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagv1 with SMTP id v1so118784937lag.3 for ; Sun, 19 Apr 2015 22:58:45 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr13952226lbd.72.1429509525547; Sun, 19 Apr 2015 22:58:45 -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.67.65 with SMTP id l1csp1242376lbt; Sun, 19 Apr 2015 22:58:44 -0700 (PDT) X-Received: by 10.68.222.231 with SMTP id qp7mr24941720pbc.7.1429509523765; Sun, 19 Apr 2015 22:58:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id km10si8091217pbc.44.2015.04.19.22.58.42; Sun, 19 Apr 2015 22:58:43 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754376AbbDTF6h (ORCPT + 26 others); Mon, 20 Apr 2015 01:58:37 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:33692 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754314AbbDTF6b (ORCPT ); Mon, 20 Apr 2015 01:58:31 -0400 Received: by pdbnk13 with SMTP id nk13so197393513pdb.0 for ; Sun, 19 Apr 2015 22:58:30 -0700 (PDT) X-Received: by 10.70.92.193 with SMTP id co1mr24949742pdb.7.1429509510315; Sun, 19 Apr 2015 22:58:30 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id cp10sm16888496pdb.44.2015.04.19.22.58.22 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Apr 2015 22:58:29 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, pang.xunlei@linaro.org, peterz@infradead.org, rafael.j.wysocki@intel.com, gregkh@linuxfoundation.org, richardcochran@gmail.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux390@de.ibm.com, rth@twiddle.net, riel@redhat.com, cl@linux.com, tj@kernel.org, fweisbec@gmail.com, ahh@google.com, pjt@google.com, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH 02/11] timekeeping:Introduce the current_kernel_time64() function with timespec64 type Date: Mon, 20 Apr 2015 13:57:30 +0800 Message-Id: <1429509459-17068-3-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1429509459-17068-1-git-send-email-baolin.wang@linaro.org> References: <1429509459-17068-1-git-send-email-baolin.wang@linaro.org> 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.54 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) {