From patchwork Thu Apr 30 08:11:34 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: 47762 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C4302121F for ; Thu, 30 Apr 2015 08:12:04 +0000 (UTC) Received: by wixv7 with SMTP id v7sf2468367wix.0 for ; Thu, 30 Apr 2015 01:12:03 -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=JmF7LRojL9hUoYl65qYCjGHDmALi8Nbl7aRcx9SyzmuOolwSTLIUaon431slaf8eRH OxWCpybO2ItRlOEei7r1B5hGa0Zz81ahXvs3NJHivVkgejfJuSsDk0+KnHVjsiiRoRQ1 7qqd+lGB+sseXCYBHYgOT/xmFZaia6p72w7nRLsPAqTWdf505qZ4ODf10mkA8SSw9rYW PVkacr3m0i+rDi/UIRvXG/maUzzIzXtot0IENGdY1ctqnsvFcMF6lvuuk8NAXkrV58Tn V/cjBIdqR3KTNKA/eo2Ax/VDC2l7l5nkykyXfo+b38iPEuaGJA8oQWRx09fj2XOkCYry g/gQ== X-Gm-Message-State: ALoCoQnmjn3N5Y2Wtj1QPFLnxtXCmt/nYHYBR6QHj5bLABNLyuJA0OXcY7oP8H3A2KQGoBSvOGtR X-Received: by 10.112.42.236 with SMTP id r12mr1853101lbl.2.1430381523367; Thu, 30 Apr 2015 01:12:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.133 with SMTP id kq5ls312856lac.102.gmail; Thu, 30 Apr 2015 01:12:03 -0700 (PDT) X-Received: by 10.153.8.133 with SMTP id dk5mr2823529lad.58.1430381523189; Thu, 30 Apr 2015 01:12:03 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id x1si1192768lag.88.2015.04.30.01.12.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 01:12:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbcga7 with SMTP id ga7so38595698lbc.1 for ; Thu, 30 Apr 2015 01:12:02 -0700 (PDT) X-Received: by 10.112.161.226 with SMTP id xv2mr2750171lbb.106.1430381522902; Thu, 30 Apr 2015 01:12:02 -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 l1csp2964574lbt; Thu, 30 Apr 2015 01:12:02 -0700 (PDT) X-Received: by 10.70.128.130 with SMTP id no2mr5975273pdb.95.1430381521130; Thu, 30 Apr 2015 01:12:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sz9si2410206pac.80.2015.04.30.01.12.00; Thu, 30 Apr 2015 01:12:01 -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 S1751360AbbD3IL4 (ORCPT + 28 others); Thu, 30 Apr 2015 04:11:56 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34875 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013AbbD3ILw (ORCPT ); Thu, 30 Apr 2015 04:11:52 -0400 Received: by pabtp1 with SMTP id tp1so52726121pab.2 for ; Thu, 30 Apr 2015 01:11:52 -0700 (PDT) X-Received: by 10.70.89.199 with SMTP id bq7mr5892640pdb.168.1430381511971; Thu, 30 Apr 2015 01:11:51 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id nl16sm1366869pdb.56.2015.04.30.01.11.48 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 01:11:50 -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 v2 03/15] time/hrtimer:Introduce hrtimer_get_res64() with timespec64 type for getting the timer resolution Date: Thu, 30 Apr 2015 16:11:34 +0800 Message-Id: <1430381494-26310-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.169 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) {