From patchwork Fri Mar 28 11:41:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27260 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1BA1E20062 for ; Fri, 28 Mar 2014 11:42:23 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp18sf17207337obc.8 for ; Fri, 28 Mar 2014 04:42:23 -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=9Kc9CXFEnE4W33TtjCqbhg4yXVPIKJh5/WEne12SnlU=; b=EDrzLsqBv0fEgVu2nC/zcT0lRQAF0LgSzZ9sW56YcfFw4sjGh2ObTqeKJqWVFuCkBj Rygtv3lLjz6RsBE1YPwXWICKi9HqyrA8m2mlzEfemFD0xVdT4ViUv7ytZBgcjxW7vWlc vk1dewZn3yBLLk2JcWIQIkj69rual2ng7Q/ojW8KZUnN2F24tw2SeitlKQJMtrhlbdq+ JUNZ3qcmuR8Dqgf2G0PkWh1jxFi9eJNlhA/QSJVkkiwRir2OPoP2mkVAdB1XZPgmtsih uANE9OZ+k0Cjotk1EcCi+Xcpnu1HNK5SprbhPnVylnT74wy789Q/k24LXgi4TFog+CN2 0X2Q== X-Gm-Message-State: ALoCoQk7Z9xEgcGw4GyYHf4DE44gscY76OWcWji3lWlIB39rL2Ub0t1gfvACLR3uPU9QBzAlwO8B X-Received: by 10.43.75.198 with SMTP id zb6mr2561127icb.22.1396006943629; Fri, 28 Mar 2014 04:42:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.145 with SMTP id c17ls1557244qgd.60.gmail; Fri, 28 Mar 2014 04:42:23 -0700 (PDT) X-Received: by 10.58.31.136 with SMTP id a8mr6995343vei.20.1396006943528; Fri, 28 Mar 2014 04:42:23 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id cx4si1201781vcb.5.2014.03.28.04.42.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:42:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so5759894veb.0 for ; Fri, 28 Mar 2014 04:42:23 -0700 (PDT) X-Received: by 10.58.91.101 with SMTP id cd5mr6620071veb.5.1396006943436; Fri, 28 Mar 2014 04:42:23 -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 v8csp1536vcv; Fri, 28 Mar 2014 04:42:23 -0700 (PDT) X-Received: by 10.66.228.37 with SMTP id sf5mr8182047pac.19.1396006942722; Fri, 28 Mar 2014 04:42:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si3523370pbd.159.2014.03.28.04.42.21; Fri, 28 Mar 2014 04:42:22 -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 S1752028AbaC1LmP (ORCPT + 27 others); Fri, 28 Mar 2014 07:42:15 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:41753 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbaC1LmK (ORCPT ); Fri, 28 Mar 2014 07:42:10 -0400 Received: by mail-wg0-f45.google.com with SMTP id l18so3411886wgh.28 for ; Fri, 28 Mar 2014 04:42:09 -0700 (PDT) X-Received: by 10.181.13.11 with SMTP id eu11mr46636037wid.30.1396006929172; Fri, 28 Mar 2014 04:42:09 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id t18sm6423383wiv.16.2014.03.28.04.42.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:42:08 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, linaro-networking@linaro.org, Arvind.Chauhan@arm.com, Viresh Kumar Subject: [PATCH 03/16] hrtimer: Create hrtimer_get_monoexpires() Date: Fri, 28 Mar 2014 17:11:22 +0530 Message-Id: <2619470bbeea98a34d7f8b98bb9cef9751bd6e29.1396006658.git.viresh.kumar@linaro.org> 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.128.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 6f524db..377023b 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 6476152..675fe9e 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; @@ -555,7 +555,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 @@ -589,7 +589,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 == timerqueue_getnext(&base->active)) { 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); } @@ -1306,8 +1306,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)