From patchwork Mon Jun 1 11:50:45 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: 49300 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 61F73218FC for ; Mon, 1 Jun 2015 11:51:22 +0000 (UTC) Received: by lani11 with SMTP id i11sf36252288lan.3 for ; Mon, 01 Jun 2015 04:51:20 -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=CP/AgZKT3Dy5Fplz9rKgHM+Q9iu+cnUwHzuERrCxwTc=; b=a4KY/y+hh67qh4CTe6mvG1hbsl6xWPHzGuXmKXoIxod/NNNMVY8cZuQguiUv1ppoAr lEtWXRI0+MBwLXng5jlHUvARh86uZRpscr4X2Fb+lsIhZM4QicaowJtrOXFJw98Liqzb B/VTtvZ/Z6uuZNQ2uKwsRgdmjJKYJ/6WEomay4MDqsOnbY6r290/H5E6LmdCemJKojCa LTqnkDev8k+cbmowF4GtVX0H5jRrdGiy+TmLq9rLWu2KMnh2ON1uUGWe4/vIEYEn4v8m B0y1J0XmlkdsU3iJtULiyOGh245CwXWKn9CrFIph9QV010c67N/gEp43w3sfRuckfhb+ friA== X-Gm-Message-State: ALoCoQm+foaejSmUDuCTwnulbJjBZ4FVkWvrj8wgzSQQnQPF+P4KYxQ9xYTsxYCjS7lqE8hxm6ty X-Received: by 10.152.22.71 with SMTP id b7mr19400056laf.3.1433159480941; Mon, 01 Jun 2015 04:51:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.98 with SMTP id lj2ls582129lab.94.gmail; Mon, 01 Jun 2015 04:51:20 -0700 (PDT) X-Received: by 10.152.45.9 with SMTP id i9mr20277171lam.87.1433159480765; Mon, 01 Jun 2015 04:51:20 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id t6si12129101lby.29.2015.06.01.04.51.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 04:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbqq2 with SMTP id qq2so82510599lbb.3 for ; Mon, 01 Jun 2015 04:51:20 -0700 (PDT) X-Received: by 10.112.93.37 with SMTP id cr5mr20936300lbb.106.1433159480657; Mon, 01 Jun 2015 04:51:20 -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 hn6csp2255119lbb; Mon, 1 Jun 2015 04:51:19 -0700 (PDT) X-Received: by 10.66.153.173 with SMTP id vh13mr39846075pab.130.1433159478920; Mon, 01 Jun 2015 04:51:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ni1si21272885pdb.6.2015.06.01.04.51.17; Mon, 01 Jun 2015 04:51:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752338AbbFALvM (ORCPT + 28 others); Mon, 1 Jun 2015 07:51:12 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:33199 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142AbbFALvB (ORCPT ); Mon, 1 Jun 2015 07:51:01 -0400 Received: by pdbqa5 with SMTP id qa5so106049703pdb.0 for ; Mon, 01 Jun 2015 04:51:00 -0700 (PDT) X-Received: by 10.66.63.33 with SMTP id d1mr836947pas.33.1433159460658; Mon, 01 Jun 2015 04:51:00 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id nq2sm14292959pdb.70.2015.06.01.04.50.58 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 04:51:00 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v4 03/25] time/hrtimer:Introduce hrtimer_get_res64() with timespec64 type Date: Mon, 1 Jun 2015 19:50:45 +0800 Message-Id: <1433159445-4666-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.172 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 hrtimer_get_res64() function to get the timer resolution with timespec64 type, and moves the hrtimer_get_res() function into include/linux/hrtimer.h as a 'static inline' helper that just calls hrtimer_get_res64. It is ready for 2038 year when getting the timer resolution by hrtimer_get_res64() function with timespec64 type, and it is convenient to remove the old hrtimer_get_res() function in hrtimer.h file. Signed-off-by: Baolin Wang --- include/linux/hrtimer.h | 16 +++++++++++++++- kernel/time/hrtimer.c | 10 +++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 05f6df1..17e9294 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -383,7 +383,21 @@ static inline int hrtimer_restart(struct hrtimer *timer) /* Query timers: */ extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer); -extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp); +extern int hrtimer_get_res64(const clockid_t which_clock, + struct timespec64 *tp); + +static inline int hrtimer_get_res(const clockid_t which_clock, + struct timespec *tp) +{ + struct timespec64 ts64; + int ret; + + ret = hrtimer_get_res64(which_clock, &ts64); + if (!ret) + *tp = timespec64_to_timespec(ts64); + + return ret; +} extern ktime_t hrtimer_get_next_event(void); diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index bee0c1f..508d936 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1175,24 +1175,24 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, EXPORT_SYMBOL_GPL(hrtimer_init); /** - * hrtimer_get_res - get the timer resolution for a clock + * hrtimer_get_res64 - get the timer resolution for a clock * @which_clock: which clock to query - * @tp: pointer to timespec variable to store the resolution + * @tp: pointer to timespec64 variable to store the resolution * * Store the resolution of the clock selected by @which_clock in the * variable pointed to by @tp. */ -int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) +int hrtimer_get_res64(const clockid_t which_clock, struct timespec64 *tp) { struct hrtimer_cpu_base *cpu_base; int base = hrtimer_clockid_to_base(which_clock); cpu_base = raw_cpu_ptr(&hrtimer_bases); - *tp = ktime_to_timespec(cpu_base->clock_base[base].resolution); + *tp = ktime_to_timespec64(cpu_base->clock_base[base].resolution); return 0; } -EXPORT_SYMBOL_GPL(hrtimer_get_res); +EXPORT_SYMBOL_GPL(hrtimer_get_res64); static void __run_hrtimer(struct hrtimer *timer, ktime_t *now) {