From patchwork Sat Nov 8 04:26:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 40457 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 497772406C for ; Sat, 8 Nov 2014 04:26:27 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf3648438lab.9 for ; Fri, 07 Nov 2014 20:26:26 -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=f8tw0KNY+npoB/vQJGEqKakbG+IqEQKKWJGBqH0dPqM=; b=Ja2PfTSmsaw0YkoOGBf4n0J/Vk6QFa4Ko7Q+7VhNPCpK8SsaIz6IcFodJXTy9YWcqD XfOCIgLr0Z31ssVXUc4JGiSR4KVGKHdEwjc3eUR7p5+qAMBdmtwvr5CLNjb5hX0gXvYw jYldRqzCKzh69QeQiP4zREt9xaKTtNUzDeo34NR/Qq/vNUg1Js8uU2xkdtUqU93SJXF3 jvWHYkx0ez6cVaNHqpe0nNuTPBe8QW0teDZ2XNzKK+Os+rcZy8CAx8IcUQ00Hfe34Ea8 oezV0GBDkXiDDFZnYHuzYYclpnAqJQ4wrH7/XRPULHq/Kb/bhl1EksboLMHNVp3k9qAG sq4Q== X-Gm-Message-State: ALoCoQnEvDR4MXTLD8rrDO97VNlkyZWlZ66OIyzYf/7/Lxyf9cqBMhPsoQbP41vhuwtvcCrxqf/b X-Received: by 10.180.219.40 with SMTP id pl8mr1386578wic.3.1415420786190; Fri, 07 Nov 2014 20:26:26 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.169 with SMTP id c9ls252370laa.104.gmail; Fri, 07 Nov 2014 20:26:25 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr14831570lbc.23.1415420785769; Fri, 07 Nov 2014 20:26:25 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id tb1si17205018lbb.130.2014.11.07.20.26.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Nov 2014 20:26:25 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id s18so5513616lam.28 for ; Fri, 07 Nov 2014 20:26:25 -0800 (PST) X-Received: by 10.152.43.229 with SMTP id z5mr60321lal.86.1415420785657; Fri, 07 Nov 2014 20:26:25 -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 ew9csp306422lbc; Fri, 7 Nov 2014 20:26:24 -0800 (PST) X-Received: by 10.67.14.129 with SMTP id fg1mr16673540pad.114.1415420784130; Fri, 07 Nov 2014 20:26:24 -0800 (PST) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com. [209.85.192.173]) by mx.google.com with ESMTPS id fj4si9596619pdb.73.2014.11.07.20.26.23 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 john.stultz@linaro.org designates 209.85.192.173 as permitted sender) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id v10so4501252pde.4 for ; Fri, 07 Nov 2014 20:26:23 -0800 (PST) X-Received: by 10.70.88.233 with SMTP id bj9mr8966076pdb.23.1415420783381; Fri, 07 Nov 2014 20:26:23 -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.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Nov 2014 20:26:22 -0800 (PST) From: John Stultz To: "pang.xunlei" Cc: John Stultz , Arnd Bergmann Subject: [PATCH 2/4] time: Expose get_monotonic_corase64() for in-kernel uses Date: Fri, 7 Nov 2014 20:26:13 -0800 Message-Id: <1415420775-4987-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415420775-4987-1-git-send-email-john.stultz@linaro.org> References: <1415420775-4987-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.215.41 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 get_monotonic_coarse64() implementation that can be used as we convert internal users of get_monotonic_corase away from usingtimespecs. Cc: Arnd Bergmann Signed-off-by: John Stultz --- include/linux/timekeeping.h | 11 ++++++++++- kernel/time/timekeeping.c | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index bdb63ea..b94db3c 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -25,7 +25,7 @@ struct timespec __current_kernel_time(void); /* * timespec based interfaces */ -struct timespec get_monotonic_coarse(void); +struct timespec64 get_monotonic_coarse64(void); extern void getrawmonotonic64(struct timespec64 *ts); extern void ktime_get_ts64(struct timespec64 *ts); @@ -58,6 +58,10 @@ static inline void getrawmonotonic(struct timespec *ts) getrawmonotonic64(ts); } +static inline struct timespec get_monotonic_coarse(void) +{ + return get_monotonic_coarse64(); +} #else static inline int __getnstimeofday(struct timespec *ts) { @@ -99,6 +103,11 @@ static inline void getrawmonotonic(struct timespec *ts) getrawmonotonic64(&ts64); *ts = timespec64_to_timespec(ts64); } + +static inline struct timespec get_monotonic_coarse(void) +{ + return timespec64_to_timespec(get_monotonic_coarse64()); +} #endif extern void getboottime(struct timespec *ts); diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 6cdd6c2..653d251 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1647,7 +1647,7 @@ struct timespec current_kernel_time(void) } EXPORT_SYMBOL(current_kernel_time); -struct timespec get_monotonic_coarse(void) +struct timespec64 get_monotonic_coarse64(void) { struct timekeeper *tk = &tk_core.timekeeper; struct timespec64 now, mono; @@ -1663,7 +1663,7 @@ struct timespec get_monotonic_coarse(void) set_normalized_timespec64(&now, now.tv_sec + mono.tv_sec, now.tv_nsec + mono.tv_nsec); - return timespec64_to_timespec(now); + return now; } /*