From patchwork Thu Apr 30 08:10:27 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: 47761 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 148C02121F for ; Thu, 30 Apr 2015 08:10:59 +0000 (UTC) Received: by wicmx19 with SMTP id mx19sf2417488wic.3 for ; Thu, 30 Apr 2015 01:10:58 -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=YsqwmCWwpOH9xZF6Dbus7iuHUcwaVJzY+9F27KRAH9Qr6KW9lGCCrpSPpOdVmSNkBL mfno6jw/nA1bweXs9ha1Fj2bpPff3cQMiTxlY3Z2m4VzfoQcdlJh4NyOy/y8EMyKd6Dp rfr4TNaeTJiFCsJjsQkmEMqs8iXKpKPHNqWovfbezNvvOmJDBDGyrRW4PFiBx1vWrKq8 lAwnpWsvdhyuWvGmFE0wPJO0Z7jvQHyzqPxH/ApgNo6P3hYHioY7aSNyEs3HmRHVoaAv BMy/L4mweIo1GKQwr21q9CwuutJ7bxmaBuYYZYvLN/v135+eEJ7gf+GZtOFkSD3AHJfy /V+w== X-Gm-Message-State: ALoCoQksmZ3Q69yrOByeuG41hVaGljiB2LS3osuil6/sBaO42pU88RcF9rpS6hLEug5kvgH9UsZ1 X-Received: by 10.180.211.168 with SMTP id nd8mr1053013wic.4.1430381458414; Thu, 30 Apr 2015 01:10:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.204 with SMTP id ba12ls345180lab.41.gmail; Thu, 30 Apr 2015 01:10:58 -0700 (PDT) X-Received: by 10.112.42.16 with SMTP id j16mr2679844lbl.98.1430381458153; Thu, 30 Apr 2015 01:10:58 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id pw2si1208678lbb.33.2015.04.30.01.10.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 01:10:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbuc2 with SMTP id uc2so38499919lbb.2 for ; Thu, 30 Apr 2015 01:10:57 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr2741062lbc.19.1430381457610; Thu, 30 Apr 2015 01:10:57 -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 l1csp2964113lbt; Thu, 30 Apr 2015 01:10:56 -0700 (PDT) X-Received: by 10.66.146.100 with SMTP id tb4mr6062839pab.104.1430381455752; Thu, 30 Apr 2015 01:10:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gm10si2372097pbd.148.2015.04.30.01.10.54; Thu, 30 Apr 2015 01:10:55 -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 S1751314AbbD3IKt (ORCPT + 28 others); Thu, 30 Apr 2015 04:10:49 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:33544 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbbD3IKn (ORCPT ); Thu, 30 Apr 2015 04:10:43 -0400 Received: by pdbnk13 with SMTP id nk13so53522423pdb.0 for ; Thu, 30 Apr 2015 01:10:42 -0700 (PDT) X-Received: by 10.70.91.37 with SMTP id cb5mr5913305pdb.151.1430381442601; Thu, 30 Apr 2015 01:10:42 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id qm2sm1363799pdb.57.2015.04.30.01.10.38 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 01:10:41 -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 v2 02/15] timekeeping:Introduce the current_kernel_time64() function with timespec64 type Date: Thu, 30 Apr 2015 16:10:27 +0800 Message-Id: <1430381427-26270-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.217.174 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) {