From patchwork Mon May 11 11:25:19 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: 48268 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2CF3021550 for ; Mon, 11 May 2015 11:25:56 +0000 (UTC) Received: by lbcne10 with SMTP id ne10sf37844816lbc.1 for ; Mon, 11 May 2015 04:25:55 -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=ZoauhOBIw4Ci+3RzHwW1k/lJZodU2/+Isx/ksH4D8WQaW733f4u0P0U1rv8wUOtdfN N+uz5Ev1/e7u7CrlF6WeCzsqzBh48PlRQ6v+9iFfW7p9Ful+9Rz3tM0RE24aVhXDBohw XDcMEdrJQryaH0fSGJv/4Fn1f1Uyh/hx3/0lcJFxHX+b/27ohKkWj0fGhtsJp/qyFJKV G6REhopNsfy984laOkdJneVcRiyY07Xn+Opn1/tnV2tx/uVqXcBV2EN7l4s9pQugOgD9 iImMmnl1jo9c8ldy0e6vathb+Gfs21Td+fYE4wDGSNgaySIKqsw5VibnPiK1n1lSfN0r nOkQ== X-Gm-Message-State: ALoCoQnNoP1oj4Zq7Cle1Yym1cp16+RXrWJrZwU0vnMkTwcnVMqbs9Ux9UVakgN76bxDwaRIDjoF X-Received: by 10.152.88.73 with SMTP id be9mr7238750lab.2.1431343555134; Mon, 11 May 2015 04:25:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.168 with SMTP id kz8ls518366lac.105.gmail; Mon, 11 May 2015 04:25:54 -0700 (PDT) X-Received: by 10.112.16.227 with SMTP id j3mr7673821lbd.43.1431343554966; Mon, 11 May 2015 04:25:54 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id le13si8202147lbb.27.2015.05.11.04.25.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:25:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by layy10 with SMTP id y10so90812537lay.0 for ; Mon, 11 May 2015 04:25:54 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr7572804lag.112.1431343554876; Mon, 11 May 2015 04:25:54 -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.108.230 with SMTP id hn6csp1447286lbb; Mon, 11 May 2015 04:25:53 -0700 (PDT) X-Received: by 10.68.130.42 with SMTP id ob10mr18421368pbb.151.1431343553154; Mon, 11 May 2015 04:25:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si12574277pat.229.2015.05.11.04.25.52; Mon, 11 May 2015 04:25:53 -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 S1754013AbbEKLZr (ORCPT + 28 others); Mon, 11 May 2015 07:25:47 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:36814 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbbEKLZ1 (ORCPT ); Mon, 11 May 2015 07:25:27 -0400 Received: by pdea3 with SMTP id a3so145856037pde.3 for ; Mon, 11 May 2015 04:25:26 -0700 (PDT) X-Received: by 10.68.227.42 with SMTP id rx10mr18460609pbc.28.1431343526835; Mon, 11 May 2015 04:25:26 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id c16sm12845825pdl.61.2015.05.11.04.25.23 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:25:26 -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 v3 19/22] time/time:Introduce the timespec64_to_jiffies/jiffies_to_timespec64 function Date: Mon, 11 May 2015 19:25:19 +0800 Message-Id: <1431343519-30119-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.215.49 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