From patchwork Sat Jan 24 01:43:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 43711 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B54C2218DB for ; Sat, 24 Jan 2015 01:44:18 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y19sf261179wgg.2 for ; Fri, 23 Jan 2015 17:44:18 -0800 (PST) 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3M0s+2fbMQ21toI1fxBbNEvkV+9LlzFcIArU3hEM6K8=; b=duQZkb+WpnR8ldRwIgzINzNEJflsUzdCqq4sTo5X8gyPhYwCObAPMB520S4RBF+gi6 yaC2pE8Ditco3D3OH7PrhbCLb5MESGvfJds+6rC3nUDcG/fxghkTYu43ZFMpz0iU+0Xk AEa6SvE6uiNTwgFduJ7Jd3v/Qgt2hVo5EhvIloK8jcwLo/XL4os2Ndo2MZjBmU2KD5nJ UhZFeY2hcjZECWeJZa4CDyk/Zc4uUtc3yVQzq5BISNsQ39B9Z95IB0u3Ha/V/HBsSP+o 8Sp7S02Z67pUHM8aSaUlejccpHD/XYqUqgy7sqeemuiPFRXPzA/zGyL4/rsbqVX+MFcH UK8A== X-Gm-Message-State: ALoCoQlsyhfBrPJsYiqoDrEi7OTXMCTfRIhI55c35C/K5OK5X+zA52aOIJJmAKBZn0iZQxUaePh9 X-Received: by 10.180.105.129 with SMTP id gm1mr647425wib.3.1422063857982; Fri, 23 Jan 2015 17:44:17 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.180 with SMTP id k20ls289494laa.18.gmail; Fri, 23 Jan 2015 17:44:17 -0800 (PST) X-Received: by 10.152.36.37 with SMTP id n5mr10100059laj.27.1422063857761; Fri, 23 Jan 2015 17:44:17 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id pr6si2869722lbb.30.2015.01.23.17.44.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id p9so468620lbv.8 for ; Fri, 23 Jan 2015 17:44:17 -0800 (PST) X-Received: by 10.112.170.36 with SMTP id aj4mr10238346lbc.3.1422063857643; Fri, 23 Jan 2015 17:44:17 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp90255lbj; Fri, 23 Jan 2015 17:44:16 -0800 (PST) X-Received: by 10.66.124.137 with SMTP id mi9mr15709589pab.144.1422063854513; Fri, 23 Jan 2015 17:44:14 -0800 (PST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com. [209.85.220.51]) by mx.google.com with ESMTPS id gr3si4055016pbc.13.2015.01.23.17.44.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:14 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.51 as permitted sender) client-ip=209.85.220.51; Received: by mail-pa0-f51.google.com with SMTP id fb1so468936pad.10 for ; Fri, 23 Jan 2015 17:44:13 -0800 (PST) X-Received: by 10.68.201.166 with SMTP id kb6mr16093157pbc.28.1422063853606; Fri, 23 Jan 2015 17:44:13 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id ci17sm3111170pdb.70.2015.01.23.17.44.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Jan 2015 17:44:13 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , "pang.xunlei" , Arnd Bergmann , Thomas Gleixner , Ingo Molnar Subject: [PATCH 2/8] time: Expose getboottime64 for in-kernel uses Date: Fri, 23 Jan 2015 17:43:54 -0800 Message-Id: <1422063840-2837-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422063840-2837-1-git-send-email-john.stultz@linaro.org> References: <1422063840-2837-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@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.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Adds a timespec64 based getboottime64() implementation that can be used as we convert internal users of getboottime away from using timespecs. Cc: pang.xunlei Cc: Arnd Bergmann Cc: Thomas Gleixner Cc: Ingo Molnar Signed-off-by: John Stultz --- include/linux/timekeeping.h | 16 ++++++++++++++-- kernel/time/timekeeping.c | 12 ++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 9b63d13..9148013 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -33,6 +33,7 @@ extern time64_t ktime_get_real_seconds(void); extern int __getnstimeofday64(struct timespec64 *tv); extern void getnstimeofday64(struct timespec64 *tv); +extern void getboottime64(struct timespec64 *ts); #if BITS_PER_LONG == 64 /** @@ -72,6 +73,11 @@ static inline struct timespec get_monotonic_coarse(void) { return get_monotonic_coarse64(); } + +static inline void getboottime(struct timespec *ts) +{ + return getboottime64(ts); +} #else /** * Deprecated. Use do_settimeofday64(). @@ -129,9 +135,15 @@ static inline struct timespec get_monotonic_coarse(void) { return timespec64_to_timespec(get_monotonic_coarse64()); } -#endif -extern void getboottime(struct timespec *ts); +static inline void getboottime(struct timespec *ts) +{ + struct timespec64 ts64; + + getboottime64(&ts64); + *ts = timespec64_to_timespec(ts64); +} +#endif #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) #define ktime_get_real_ts64(ts) getnstimeofday64(ts) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 6a93185..b124af2 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1659,24 +1659,24 @@ out: } /** - * getboottime - Return the real time of system boot. - * @ts: pointer to the timespec to be set + * getboottime64 - Return the real time of system boot. + * @ts: pointer to the timespec64 to be set * - * Returns the wall-time of boot in a timespec. + * Returns the wall-time of boot in a timespec64. * * This is based on the wall_to_monotonic offset and the total suspend * time. Calls to settimeofday will affect the value returned (which * basically means that however wrong your real time clock is at boot time, * you get the right time here). */ -void getboottime(struct timespec *ts) +void getboottime64(struct timespec64 *ts) { struct timekeeper *tk = &tk_core.timekeeper; ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot); - *ts = ktime_to_timespec(t); + *ts = ktime_to_timespec64(t); } -EXPORT_SYMBOL_GPL(getboottime); +EXPORT_SYMBOL_GPL(getboottime64); unsigned long get_seconds(void) {