From patchwork Mon May 11 11:13:05 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: 48239 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C28C721550 for ; Mon, 11 May 2015 11:13:21 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf38669277wgt.1 for ; Mon, 11 May 2015 04:13:21 -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=2RSbQU9j7I8MSVSqB+27o/VjVtvO2C49TXljuFdckbQ=; b=eJX8ctFyHV/hAOkJB1BG+GNtcV1jNWUMryolNO6VtZoeVPyfRt1g3rNHMdqcWu81PQ qRLet1vb2J9OkggJe5cIoBhIYuIgb1Ig889N4x6GyNrxK80CGdJUOY5jn6Vanwvd8PvQ FxHwXPFHmQBsDl1dqge4fnZXxk3DcrymKvszgPnr6ziOdGSaU9ZFIHBT7J7I9/Ghqime eEBlYCPakgbAfua2mTDgacv4NE2ZgsSwc090JVTbsJc3f+vDmCVfZmnoRcy2PpLHNzSE bzyWewr9O5DtpjQjNWaDMQzhxEYFIt5BLEURnYWjk70kw/nPcc0i36j1WLThC82L9vYl VSMQ== X-Gm-Message-State: ALoCoQmt7f+vOa7dtUtUh7IoWdg5xuB65kqpD6qrgFKQ+jOyc08YB0/Tj7yIQLrKW/UrMDqKcwgj X-Received: by 10.180.88.226 with SMTP id bj2mr7652690wib.7.1431342801139; Mon, 11 May 2015 04:13:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.197 with SMTP id o5ls569881laf.66.gmail; Mon, 11 May 2015 04:13:20 -0700 (PDT) X-Received: by 10.112.170.7 with SMTP id ai7mr7502901lbc.85.1431342800952; Mon, 11 May 2015 04:13:20 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id k9si8188573lak.13.2015.05.11.04.13.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbqq2 with SMTP id qq2so91207985lbb.3 for ; Mon, 11 May 2015 04:13:20 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr7674868laa.36.1431342800848; Mon, 11 May 2015 04:13: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 hn6csp1441713lbb; Mon, 11 May 2015 04:13:19 -0700 (PDT) X-Received: by 10.70.91.104 with SMTP id cd8mr18434405pdb.94.1431342798444; Mon, 11 May 2015 04:13:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si17585501pdf.43.2015.05.11.04.13.17; Mon, 11 May 2015 04:13:18 -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 S1753847AbbEKLNO (ORCPT + 28 others); Mon, 11 May 2015 07:13:14 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35138 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753385AbbEKLNM (ORCPT ); Mon, 11 May 2015 07:13:12 -0400 Received: by pabtp1 with SMTP id tp1so107619294pab.2 for ; Mon, 11 May 2015 04:13:12 -0700 (PDT) X-Received: by 10.68.178.229 with SMTP id db5mr18435573pbc.17.1431342792123; Mon, 11 May 2015 04:13:12 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id l14sm12795224pdn.96.2015.05.11.04.13.09 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:13:11 -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 v3 03/22] time/hrtimer:Introduce hrtimer_get_res64() with timespec64 type for getting the timer resolution Date: Mon, 11 May 2015 19:13:05 +0800 Message-Id: <1431342785-29483-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.174 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 delete the old hrtimer_get_res() function in hrtimer.h file. Signed-off-by: Baolin Wang --- include/linux/hrtimer.h | 12 +++++++++++- kernel/time/hrtimer.c | 10 +++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 05f6df1..ee8ed44 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -383,7 +383,17 @@ 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; + + *ts64 = timespec_to_timespec64(*tp); + return hrtimer_get_res64(which_clock, ts64); +} 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) {