From patchwork Fri Apr 4 06:35:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27744 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4470F2036E for ; Fri, 4 Apr 2014 06:42:34 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf5335427ykp.5 for ; Thu, 03 Apr 2014 23:42:34 -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: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=Z7OOmRTPslJIqOhxHe+PoVRZHPlB03QFqK6bWEvcqAY=; b=IibpX0Es34Kj3koFEj/8v9R0Uq89gDeoyTFZtq5j6M9jGskpaPdHOfebJaaifNnbGJ RpRNgZGc8OaeyqpmbctHYfQeerEMQ41SbkM6VZ2qtB/vB7cmcIySA8TM3+ehfAvV2vXG maae/1cEOb6yIDkUMzqy39JL3sIbx5eJp0iz7lR4qdS1UqKXbpkW1MplpLnPbhTccX+p fbqriT2Qh3QxQBCS7Aw3A6y800Mijzpai03mV8IeKewFPqSvdxImvLv/1M4ay5kQOkFL uHtasgh2HR9pW646jMJcjpr5oAZRnUKf72YI7iGvonpljlya9TvUPrNMG6UEzrRwgQrx KkEw== X-Gm-Message-State: ALoCoQmlmoQvrjBQJzm1q5FFWSyPhmRafQTnk+V11/7v1X+M721+ozUvAvkxPxg6/nIwRaY8DX51 X-Received: by 10.58.168.137 with SMTP id zw9mr2740800veb.15.1396593753997; Thu, 03 Apr 2014 23:42:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.115 with SMTP id 106ls12333qgg.75.gmail; Thu, 03 Apr 2014 23:42:33 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr6847822vcb.0.1396593753929; Thu, 03 Apr 2014 23:42:33 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id nc1si626394vec.132.2014.04.03.23.42.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Apr 2014 23:42:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ik5so2884847vcb.0 for ; Thu, 03 Apr 2014 23:42:33 -0700 (PDT) X-Received: by 10.58.202.133 with SMTP id ki5mr3499069vec.19.1396593753858; Thu, 03 Apr 2014 23:42:33 -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.220.12.8 with SMTP id v8csp89279vcv; Thu, 3 Apr 2014 23:42:33 -0700 (PDT) X-Received: by 10.68.159.228 with SMTP id xf4mr12980864pbb.74.1396593750932; Thu, 03 Apr 2014 23:42:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xt7si4198997pab.20.2014.04.03.23.42.30; Thu, 03 Apr 2014 23:42:30 -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 S1752615AbaDDGle (ORCPT + 27 others); Fri, 4 Apr 2014 02:41:34 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:45848 "EHLO mail-we0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbaDDGlW (ORCPT ); Fri, 4 Apr 2014 02:41:22 -0400 Received: by mail-we0-f172.google.com with SMTP id t61so2958944wes.31 for ; Thu, 03 Apr 2014 23:41:21 -0700 (PDT) X-Received: by 10.180.11.36 with SMTP id n4mr1886675wib.4.1396593680973; Thu, 03 Apr 2014 23:41:20 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id wl6sm11029771wjb.3.2014.04.03.23.41.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Apr 2014 23:41:20 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, fweisbec@gmail.com, linaro-networking@linaro.org, Arvind.Chauhan@arm.com, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 16/36] hrtimer: Create hrtimer_get_monoexpires() Date: Fri, 4 Apr 2014 12:05:59 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: 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: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Following code is repeated at many places: ktime_sub(hrtimer_get_expires(timer), base->offset); and so it makes sense to create a separate inlined routine for this. Signed-off-by: Viresh Kumar --- include/linux/hrtimer.h | 6 ++++++ kernel/hrtimer.c | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 17c08ca..d1836cb 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -233,6 +233,12 @@ static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) return timer->node.expires; } +static inline ktime_t hrtimer_get_monoexpires(const struct hrtimer *timer, + struct hrtimer_clock_base *base) +{ + return ktime_sub(hrtimer_get_expires(timer), base->offset); +} + static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer) { return timer->_softexpires; diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 5b0cbe7..1a1fdc0 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -184,7 +184,7 @@ hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base) if (!new_base->cpu_base->hres_active) return 0; - expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset); + expires = hrtimer_get_monoexpires(timer, new_base); return expires.tv64 <= new_base->cpu_base->expires_next.tv64; #else return 0; @@ -554,7 +554,7 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal) continue; timer = container_of(next, struct hrtimer, node); - expires = ktime_sub(hrtimer_get_expires(timer), base->offset); + expires = hrtimer_get_monoexpires(timer, base); /* * clock_was_set() has changed base->offset so the * result might be negative. Fix it up to prevent a @@ -588,7 +588,7 @@ static int hrtimer_reprogram(struct hrtimer *timer, struct hrtimer_clock_base *base) { struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases); - ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset); + ktime_t expires = hrtimer_get_monoexpires(timer, base); int res; WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0); @@ -898,7 +898,7 @@ static void __remove_hrtimer(struct hrtimer *timer, &timer->node == next_timer) { ktime_t expires; - expires = ktime_sub(hrtimer_get_expires(timer), base->offset); + expires = hrtimer_get_monoexpires(timer, base); if (base->cpu_base->expires_next.tv64 == expires.tv64) hrtimer_force_reprogram(base->cpu_base, 1); } @@ -1309,8 +1309,7 @@ retry: if (basenow.tv64 < hrtimer_get_softexpires_tv64(timer)) { ktime_t expires; - expires = ktime_sub(hrtimer_get_expires(timer), - base->offset); + expires = hrtimer_get_monoexpires(timer, base); if (expires.tv64 < 0) expires.tv64 = KTIME_MAX; if (expires.tv64 < expires_next.tv64)