From patchwork Fri Mar 28 11:41:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27267 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3198A20062 for ; Fri, 28 Mar 2014 11:43:16 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id l13sf1888432iga.7 for ; Fri, 28 Mar 2014 04:43:15 -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=a8Un5WfFbRNWcdz7B5nGstmPow/GYOe+LDLKd/IoKw4=; b=eku9mSxc2o224wGxO/2cJlpcMobuDeYvZttBFJ/s65/rszE1hwclZ/EoiX7JZ1F16b SoIkN4bJlSE4xSoufr7SB6Q74tTbenUMX/lDKiBTxTlRgPlnlyQV0C8u/x1lm2q0ufYI YCJDMdT4KK7xIFu1dLmkWB9vJ5eEyPbKtzzYxoRordJCMO4wmNx4ih34JWQ0I8kZuCnc 9tL0Mill7Sks/GyOWacJYVhMFmWiKc8GKJv669sSmjc3/6QO33GGW2r8kwH8rByx6MsU t29YkmSELtr8NmZPKGJOJJEc3nUmT1Ori/2EmMJ2YhbQjFKJF1/+RV/Po+6hQ692f3hF Y/9Q== X-Gm-Message-State: ALoCoQnesG8Gv80X+V5w/XxrSMRJQ5GPEXoQXqkMOslU3XJTvxVyhVwiplTh1OfM3dCQNy/Z5Dlc X-Received: by 10.182.19.34 with SMTP id b2mr351812obe.17.1396006995677; Fri, 28 Mar 2014 04:43:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.165 with SMTP id e34ls1446732qgf.29.gmail; Fri, 28 Mar 2014 04:43:15 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr6811919vcb.0.1396006995573; Fri, 28 Mar 2014 04:43:15 -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 uz9si1088400vcb.155.2014.03.28.04.43.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:43:15 -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 pa12so5760811veb.0 for ; Fri, 28 Mar 2014 04:43:15 -0700 (PDT) X-Received: by 10.52.51.197 with SMTP id m5mr5682188vdo.9.1396006995491; Fri, 28 Mar 2014 04:43:15 -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 v8csp1583vcv; Fri, 28 Mar 2014 04:43:14 -0700 (PDT) X-Received: by 10.66.181.70 with SMTP id du6mr8090227pac.23.1396006994524; Fri, 28 Mar 2014 04:43:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tk9si3522806pac.170.2014.03.28.04.43.13; Fri, 28 Mar 2014 04:43:13 -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 S1752272AbaC1LnG (ORCPT + 27 others); Fri, 28 Mar 2014 07:43:06 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:40629 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752239AbaC1LnC (ORCPT ); Fri, 28 Mar 2014 07:43:02 -0400 Received: by mail-we0-f180.google.com with SMTP id p61so2491902wes.25 for ; Fri, 28 Mar 2014 04:43:01 -0700 (PDT) X-Received: by 10.181.13.82 with SMTP id ew18mr11933203wid.22.1396006981571; Fri, 28 Mar 2014 04:43:01 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id fs16sm6426908wic.18.2014.03.28.04.42.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 04:43:00 -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 10/16] hrtimer: make enqueue_hrtimer() return void Date: Fri, 28 Mar 2014 17:11:29 +0530 Message-Id: <74a3a18c379fa500d122649daff7568b56827af6.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: , enqueue_hrtimer() routine is called from three places and only one of them effectively uses its return value. Also, by its name enqueue_hrtimer() isn't supposed to return "if the queued timer is the leftmost". So it makes more sense to separate this routine into two parts, first one enqueues a timer and the other one tells if the timer is leftmost or not. Signed-off-by: Viresh Kumar --- include/linux/hrtimer.h | 5 +++++ kernel/hrtimer.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 377023b..7ca9fd0 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -263,6 +263,11 @@ static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) return ktime_sub(timer->node.expires, timer->base->get_time()); } +static inline int hrtimer_is_leftmost(struct hrtimer *timer) +{ + return &timer->node == timer->base->active.next; +} + #ifdef CONFIG_HIGH_RES_TIMERS struct clock_event_device; diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 7d85b8f..2702185 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -844,7 +844,7 @@ EXPORT_SYMBOL_GPL(hrtimer_forward); * * Returns 1 when the new timer is the leftmost timer in the tree. */ -static int enqueue_hrtimer(struct hrtimer *timer) +static void enqueue_hrtimer(struct hrtimer *timer) { struct hrtimer_clock_base *base = timer->base; @@ -858,8 +858,6 @@ static int enqueue_hrtimer(struct hrtimer *timer) * state of a possibly running callback. */ timer->state |= HRTIMER_STATE_ENQUEUED; - - return (&timer->node == base->active.next); } /* @@ -936,7 +934,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, { struct hrtimer_clock_base *base, *new_base; unsigned long flags; - int ret, leftmost; + int ret; lock_hrtimer_base(timer, &flags); base = timer->base; @@ -966,7 +964,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, timer_stats_hrtimer_set_start_info(timer); - leftmost = enqueue_hrtimer(timer); + enqueue_hrtimer(timer); /* * Only allow reprogramming if the new base is on this CPU. @@ -974,7 +972,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, * * XXX send_remote_softirq() ? */ - if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases) + if (hrtimer_is_leftmost(timer) && + new_base->cpu_base == &__get_cpu_var(hrtimer_bases) && hrtimer_enqueue_reprogram(timer)) { if (wakeup) { /*