From patchwork Mon Apr 20 05:57:31 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: 47315 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B80E20553 for ; Mon, 20 Apr 2015 05:58:56 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf36399351lab.1 for ; Sun, 19 Apr 2015 22:58: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:in-reply-to:references: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=ZaqdCk5i41gwY4aDVsVjevkUHJvtTTIJ2giVOmsQOjveTrk0KoBLRK3Qvm65PpeJUf wbLkM69N1eqgu8L6EkNuXHRDTGWi3dglmjpiydm0vzxZwEpdQh98dpaYLa1dexVg1tAt 9w82ERnMKHWA4TXzl6l6fjDcSf8SWO43qi1x/MD9E6c56UQkQRTDmAbs/+kD4pmEZz+l JMMdXDguOKt26CteWM2XcD+0E6XLvjJ9easgVyvEz4PXtN38M9jS1M9bm8+8gGbkLfLy 7wAGVyIgaoyavMbFSo7ZNYdvXLFTlyibnCCX5HPkXivuN3E6OJ4y48pW1I0BtUDvT1KG 4dWw== X-Gm-Message-State: ALoCoQld9UBJ5rhMBiTivITvCMtEf7A0fiUlno/EfYuxa0E3Wtfh9OQSsjTeS0Ima6KQlIWLrCh6 X-Received: by 10.152.5.168 with SMTP id t8mr6494993lat.3.1429509535220; Sun, 19 Apr 2015 22:58:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.162 with SMTP id g2ls779307lae.80.gmail; Sun, 19 Apr 2015 22:58:55 -0700 (PDT) X-Received: by 10.112.159.162 with SMTP id xd2mr13959628lbb.67.1429509534980; Sun, 19 Apr 2015 22:58:54 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id rk9si11287964lbb.152.2015.04.19.22.58.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Apr 2015 22:58:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lagv1 with SMTP id v1so118786767lag.3 for ; Sun, 19 Apr 2015 22:58:54 -0700 (PDT) X-Received: by 10.152.23.70 with SMTP id k6mr13837860laf.76.1429509534884; Sun, 19 Apr 2015 22:58: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.67.65 with SMTP id l1csp1242425lbt; Sun, 19 Apr 2015 22:58:54 -0700 (PDT) X-Received: by 10.68.192.193 with SMTP id hi1mr24965310pbc.142.1429509532957; Sun, 19 Apr 2015 22:58:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dv4si26788683pdb.70.2015.04.19.22.58.51; Sun, 19 Apr 2015 22:58:52 -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 S1754454AbbDTF6p (ORCPT + 26 others); Mon, 20 Apr 2015 01:58:45 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:35349 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754381AbbDTF6k (ORCPT ); Mon, 20 Apr 2015 01:58:40 -0400 Received: by pabtp1 with SMTP id tp1so196468140pab.2 for ; Sun, 19 Apr 2015 22:58:39 -0700 (PDT) X-Received: by 10.68.215.35 with SMTP id of3mr15905266pbc.50.1429509519804; Sun, 19 Apr 2015 22:58:39 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id cp10sm16888496pdb.44.2015.04.19.22.58.31 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Apr 2015 22:58:38 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, pang.xunlei@linaro.org, peterz@infradead.org, rafael.j.wysocki@intel.com, gregkh@linuxfoundation.org, richardcochran@gmail.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux390@de.ibm.com, rth@twiddle.net, riel@redhat.com, cl@linux.com, tj@kernel.org, fweisbec@gmail.com, ahh@google.com, pjt@google.com, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH 03/11] time/hrtimer:Introduce hrtimer_get_res64() with timespec64 type for getting the timer resolution Date: Mon, 20 Apr 2015 13:57:31 +0800 Message-Id: <1429509459-17068-4-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1429509459-17068-1-git-send-email-baolin.wang@linaro.org> References: <1429509459-17068-1-git-send-email-baolin.wang@linaro.org> 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.41 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) {