All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
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 <viresh.kumar@linaro.org>
Subject: [PATCH 10/16] hrtimer: make enqueue_hrtimer() return void
Date: Fri, 28 Mar 2014 17:11:29 +0530	[thread overview]
Message-ID: <74a3a18c379fa500d122649daff7568b56827af6.1396006658.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1396006658.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1396006658.git.viresh.kumar@linaro.org>

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 <viresh.kumar@linaro.org>
---
 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) {
 			/*
-- 
1.7.12.rc2.18.g61b472e


  parent reply	other threads:[~2014-03-28 11:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 11:41 [PATCH 00/16] timers/hrtimers: Minor cleanups: Part II Viresh Kumar
2014-03-28 11:41 ` [PATCH 01/16] hrtimer: move unlock_hrtimer_base() upwards Viresh Kumar
2014-03-28 11:41 ` [PATCH 02/16] hrtimer: reorder code in __remove_hrtimer() Viresh Kumar
2014-04-02  5:41   ` Viresh Kumar
2014-03-28 11:41 ` [PATCH 03/16] hrtimer: Create hrtimer_get_monoexpires() Viresh Kumar
2014-03-28 11:41 ` [PATCH 04/16] hrtimer: remove 'base' parameter from remove_timer() and __remove_timer() Viresh Kumar
2014-03-28 11:41 ` [PATCH 05/16] hrtimer: remove 'base' parameter from switch_hrtimer_base() Viresh Kumar
2014-03-28 11:41 ` [PATCH 06/16] hrtimer: remove 'base' parameter from enqueue_hrtimer() Viresh Kumar
2014-03-28 11:41 ` [PATCH 07/16] hrtimer: remove 'base' parameter from hrtimer_{enqueue_}reprogram() Viresh Kumar
2014-03-28 11:41 ` [PATCH 08/16] hrtimer: make switch_hrtimer_base() return void Viresh Kumar
2014-03-28 11:41 ` [PATCH 09/16] hrtimer: make lock_hrtimer_base() " Viresh Kumar
2014-03-28 11:41 ` Viresh Kumar [this message]
2014-03-28 11:41 ` [PATCH 11/16] hrtimer: don't check if timer is queued in __remove_hrtimer() Viresh Kumar
2014-03-28 11:41 ` [PATCH 12/16] hrtimer: rewrite switch_hrtimer_base() to remove extra indentation level Viresh Kumar
2014-03-28 11:41 ` [PATCH 13/16] hrtimer: rewrite remove_hrtimer() " Viresh Kumar
2014-03-28 11:41 ` [PATCH 14/16] hrtimer: replace base by new_base to get resolution: __hrtimer_start_range_ns() Viresh Kumar
2014-03-28 11:41 ` [PATCH 15/16] hrtimer: create base_on_this_cpu() Viresh Kumar
2014-03-28 11:41 ` [PATCH 16/16] hrtimer: use base->hres_active directly instead of hrtimer_hres_active() Viresh Kumar
2014-03-28 12:24   ` Viresh Kumar
2014-03-28 12:26   ` [PATCH V2 " Viresh Kumar
2014-03-31 13:38 ` [PATCH 00/16] timers/hrtimers: Minor cleanups: Part II Thomas Gleixner
2014-03-31 14:31   ` Viresh Kumar
2014-03-31 15:51     ` Thomas Gleixner
2014-04-01  6:33   ` Viresh Kumar
2014-04-01  7:02     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74a3a18c379fa500d122649daff7568b56827af6.1396006658.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=Arvind.Chauhan@arm.com \
    --cc=fweisbec@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linaro-networking@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.