From patchwork Sat Nov 8 04:26:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 40456 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 64A1620D85 for ; Sat, 8 Nov 2014 04:26:26 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf4027057eek.3 for ; Fri, 07 Nov 2014 20:26:25 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=LOoRA9Ywv3iCXGCJ4cAY/9hnyw/0Ih9z7ScLv20OGPM=; b=alrud3rgNwGXZKrYOLxlCrqQgAXXMN+9Abe9QUhPvRFmVNwMJwgQ9cTVRLfYGF4ms0 5gUvYxxBdqFQM94NifDBLgjMcamc259JNLFZ6aE/GLh3H8Q35QHwJDsEXD3x9opdFmyV Ok9G4Of/3/pZniS3/pAo15rvG9e0tbYaBuG233Cy4VEz2a2sTMYjk7PoFe3KiKCXHn1V ARZD4EGA8B6Kh9xOtGjIhhCUNc68y5pMDLvm+FGtPHKPTCwihNH9pZcRRushnsgLX952 QD30ttb2Y0fRy8rFCYJqWGUDaIW+70OVWVOdDIG7E+hGYJWrFrI4TvzwUQxc0JrsKrus X2fw== X-Gm-Message-State: ALoCoQk/snwWZqHErBmrgTlutj5Ol7g0jODQvb1sE7yvBSfMkr0gpifpNRS4IMIxUUFhL7mY8eY5 X-Received: by 10.112.55.10 with SMTP id n10mr20900lbp.14.1415420784966; Fri, 07 Nov 2014 20:26:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.68 with SMTP id da4ls225741lad.87.gmail; Fri, 07 Nov 2014 20:26:24 -0800 (PST) X-Received: by 10.152.18.166 with SMTP id x6mr14849264lad.18.1415420784669; Fri, 07 Nov 2014 20:26:24 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id s2si17450873lag.22.2014.11.07.20.26.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Nov 2014 20:26:24 -0800 (PST) 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 mail-la0-f42.google.com with SMTP id gq15so5475507lab.29 for ; Fri, 07 Nov 2014 20:26:24 -0800 (PST) X-Received: by 10.112.199.227 with SMTP id jn3mr69994lbc.86.1415420784504; Fri, 07 Nov 2014 20:26:24 -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.184.201 with SMTP id ew9csp306417lbc; Fri, 7 Nov 2014 20:26:23 -0800 (PST) X-Received: by 10.70.100.229 with SMTP id fb5mr16858412pdb.126.1415420782960; Fri, 07 Nov 2014 20:26:22 -0800 (PST) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com. [209.85.192.171]) by mx.google.com with ESMTPS id f5si10744072pat.226.2014.11.07.20.26.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Nov 2014 20:26:22 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.171 as permitted sender) client-ip=209.85.192.171; Received: by mail-pd0-f171.google.com with SMTP id r10so4491067pdi.16 for ; Fri, 07 Nov 2014 20:26:22 -0800 (PST) X-Received: by 10.66.119.175 with SMTP id kv15mr17360554pab.30.1415420782216; Fri, 07 Nov 2014 20:26:22 -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 n3sm10235061pda.7.2014.11.07.20.26.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Nov 2014 20:26:21 -0800 (PST) From: John Stultz To: "pang.xunlei" Cc: John Stultz , Arnd Bergmann Subject: [PATCH 1/4] time: Expose getrawmonotonic64 for in-kernel uses Date: Fri, 7 Nov 2014 20:26:12 -0800 Message-Id: <1415420775-4987-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 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.215.42 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 getrawmonotonic64() implementation that can be used as we convert internal users of getrawmonotonic away from using timespecs. Cc: Arnd Bergmann Signed-off-by: John Stultz --- include/linux/timekeeping.h | 15 ++++++++++++++- kernel/time/timekeeping.c | 11 ++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 1caa6b0..bdb63ea 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -26,7 +26,7 @@ struct timespec __current_kernel_time(void); * timespec based interfaces */ struct timespec get_monotonic_coarse(void); -extern void getrawmonotonic(struct timespec *ts); +extern void getrawmonotonic64(struct timespec64 *ts); extern void ktime_get_ts64(struct timespec64 *ts); extern int __getnstimeofday64(struct timespec64 *tv); @@ -53,6 +53,11 @@ static inline void ktime_get_real_ts(struct timespec *ts) getnstimeofday64(ts); } +static inline void getrawmonotonic(struct timespec *ts) +{ + getrawmonotonic64(ts); +} + #else static inline int __getnstimeofday(struct timespec *ts) { @@ -86,6 +91,14 @@ static inline void ktime_get_real_ts(struct timespec *ts) getnstimeofday64(&ts64); *ts = timespec64_to_timespec(ts64); } + +static inline void getrawmonotonic(struct timespec *ts) +{ + struct timespec64 ts64; + + getrawmonotonic64(&ts64); + *ts = timespec64_to_timespec(ts64); +} #endif extern void getboottime(struct timespec *ts); diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ec1791f..6cdd6c2 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -895,12 +895,12 @@ int timekeeping_notify(struct clocksource *clock) } /** - * getrawmonotonic - Returns the raw monotonic time in a timespec - * @ts: pointer to the timespec to be set + * getrawmonotonic64 - Returns the raw monotonic time in a timespec + * @ts: pointer to the timespec64 to be set * * Returns the raw monotonic time (completely un-modified by ntp) */ -void getrawmonotonic(struct timespec *ts) +void getrawmonotonic64(struct timespec64 *ts) { struct timekeeper *tk = &tk_core.timekeeper; struct timespec64 ts64; @@ -915,9 +915,10 @@ void getrawmonotonic(struct timespec *ts) } while (read_seqcount_retry(&tk_core.seq, seq)); timespec64_add_ns(&ts64, nsecs); - *ts = timespec64_to_timespec(ts64); + *ts = ts64; } -EXPORT_SYMBOL(getrawmonotonic); +EXPORT_SYMBOL(getrawmonotonic64); + /** * timekeeping_valid_for_hres - Check if timekeeping is suitable for hres