From patchwork Thu Apr 30 08:20:02 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: 47771 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED2512121F for ; Thu, 30 Apr 2015 08:20:31 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf12979278wgt.1 for ; Thu, 30 Apr 2015 01:20:31 -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=YNveqEIr3ttbS/svoulbLlJpc0D2n932znfGTBKpCb0=; b=eRitGvXC5fgwLrxRDvXQO2aZbF1gEmkvtFim3NXy/g6vICFDpv19bZVYmFYiroj29x DgPmC0Bu+TBh4nsRt1wZxK4ecbSj3eoW+AgHpPj8eOviSkQuP8JpxaSOtqam3cpCqYS/ iEm+GQX0UvagqefL3TV2quselwsHKwu4WYZAwS/QlLTTsUVTDGrnXQhR9wazvyw0joTe fyCQzEqP71ZMr0oo9oZVTRI/eW5d6XegOtRcQUJM0p+QQYG566Yt+QoUsXS3DvM7r4/J RvJqDM2OcRCHk2W+1e5t/Bogp5vsuZIHLAbE1u52jqTRA98cQ0v4HiD1NWAgtGhsp1rU Renw== X-Gm-Message-State: ALoCoQmKj6lvJzuhtGN8Gn+FKUWZC83Phy2IUpntyv4HRTYgrzXNNzgM2amxwKcGf+4GA9HsRGGz X-Received: by 10.152.26.134 with SMTP id l6mr1873054lag.10.1430382031131; Thu, 30 Apr 2015 01:20:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.10 with SMTP id p10ls362490lag.29.gmail; Thu, 30 Apr 2015 01:20:30 -0700 (PDT) X-Received: by 10.152.36.136 with SMTP id q8mr2713866laj.96.1430382030956; Thu, 30 Apr 2015 01:20:30 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id qh5si1227687lbb.28.2015.04.30.01.20.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 01:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbqq2 with SMTP id qq2so38637756lbb.3 for ; Thu, 30 Apr 2015 01:20:30 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr2786269lbb.36.1430382030678; Thu, 30 Apr 2015 01:20:30 -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 l1csp2968210lbt; Thu, 30 Apr 2015 01:20:29 -0700 (PDT) X-Received: by 10.67.7.162 with SMTP id dd2mr5789499pad.151.1430382028942; Thu, 30 Apr 2015 01:20:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5si2395588pbu.180.2015.04.30.01.20.28; Thu, 30 Apr 2015 01:20:28 -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 S1751417AbbD3IUX (ORCPT + 28 others); Thu, 30 Apr 2015 04:20:23 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35829 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750866AbbD3IUU (ORCPT ); Thu, 30 Apr 2015 04:20:20 -0400 Received: by pabtp1 with SMTP id tp1so52912079pab.2 for ; Thu, 30 Apr 2015 01:20:20 -0700 (PDT) X-Received: by 10.66.236.167 with SMTP id uv7mr6013671pac.58.1430382020182; Thu, 30 Apr 2015 01:20:20 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id e5sm1379345pdc.94.2015.04.30.01.20.16 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 01:20:19 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, ahh@google.com, pjt@google.com, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v2 12/15] time/time:Introduce the timespec64_to_jiffies/jiffies_to_timespec64 function Date: Thu, 30 Apr 2015 16:20:02 +0800 Message-Id: <1430382002-26666-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.170 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 introduces the timespec64_to_jiffies() and jiffies_to_timespec64() functions, that implement the conversion between cputime and timespec64. And remove the old functions timespec64_to_jiffies()/jiffies_to_timespec64() to jiffies.h file. Signed-off-by: Baolin Wang --- include/linux/jiffies.h | 21 ++++++++++++++++++--- kernel/time/time.c | 12 ++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index c367cbd..16a30c1 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -290,9 +290,24 @@ static inline u64 jiffies_to_nsecs(const unsigned long j) extern unsigned long msecs_to_jiffies(const unsigned int m); extern unsigned long usecs_to_jiffies(const unsigned int u); -extern unsigned long timespec_to_jiffies(const struct timespec *value); -extern void jiffies_to_timespec(const unsigned long jiffies, - struct timespec *value); +extern unsigned long __timespec_to_jiffies(unsigned long sec, long nsec); +extern unsigned long timespec64_to_jiffies(const struct timespec64 *value); +extern void jiffies_to_timespec64(const unsigned long jiffies, + struct timespec64 *value); +static inline unsigned long timespec_to_jiffies(const struct timespec *value) +{ + return __timespec_to_jiffies(value->tv_sec, value->tv_nsec); +} + +static inline void jiffies_to_timespec(const unsigned long jiffies, + struct timespec *value) +{ + struct timespec64 *ts; + + *ts = timespec_to_timespec64(*value); + jiffies_to_timespec64(jiffies, ts); +} + extern unsigned long timeval_to_jiffies(const struct timeval *value); extern void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value); diff --git a/kernel/time/time.c b/kernel/time/time.c index f43011b..3aba16f 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -571,7 +571,7 @@ EXPORT_SYMBOL(usecs_to_jiffies); * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec * value to a scaled second value. */ -static unsigned long +unsigned long __timespec_to_jiffies(unsigned long sec, long nsec) { nsec = nsec + TICK_NSEC - 1; @@ -585,17 +585,17 @@ __timespec_to_jiffies(unsigned long sec, long nsec) (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; } +EXPORT_SYMBOL(__timespec_to_jiffies); unsigned long -timespec_to_jiffies(const struct timespec *value) +timespec64_to_jiffies(const struct timespec64 *value) { return __timespec_to_jiffies(value->tv_sec, value->tv_nsec); } - -EXPORT_SYMBOL(timespec_to_jiffies); +EXPORT_SYMBOL(timespec64_to_jiffies); void -jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) +jiffies_to_timespec64(const unsigned long jiffies, struct timespec64 *value) { /* * Convert jiffies to nanoseconds and separate with @@ -606,7 +606,7 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) NSEC_PER_SEC, &rem); value->tv_nsec = rem; } -EXPORT_SYMBOL(jiffies_to_timespec); +EXPORT_SYMBOL(jiffies_to_timespec64); /* * We could use a similar algorithm to timespec_to_jiffies (with a