From: Viresh Kumar <viresh.kumar@linaro.org>
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 <viresh.kumar@linaro.org>
Subject: [PATCH V2 33/36] hrtimer: make lock_hrtimer_base() return void
Date: Fri, 4 Apr 2014 12:06:16 +0530 [thread overview]
Message-ID: <70dd1920bcbc74a98a61340e44a5915ec4e8e1bf.1396592516.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1396592516.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1396592516.git.viresh.kumar@linaro.org>
lock_hrtimer_base() always returns after taking lock and so timer->base can't
change further. So, callers of this routine can simply do timer->base to get the
base and so we can make this routine return void.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
kernel/hrtimer.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index e581bba..ea620e5 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -166,9 +166,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
* possible to set timer->base = NULL and drop the lock: the timer remains
* locked.
*/
-static
-struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
- unsigned long *flags)
+static void lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
{
struct hrtimer_clock_base *base;
@@ -177,7 +175,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
if (likely(base != NULL)) {
raw_spin_lock_irqsave(&base->cpu_base->lock, *flags);
if (likely(base == timer->base))
- return base;
+ return;
/* The timer has migrated to another CPU: */
raw_spin_unlock_irqrestore(&base->cpu_base->lock, *flags);
}
@@ -254,14 +252,10 @@ again:
#else /* CONFIG_SMP */
-static inline struct hrtimer_clock_base *
+static inline void
lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
{
- struct hrtimer_clock_base *base = timer->base;
-
- raw_spin_lock_irqsave(&base->cpu_base->lock, *flags);
-
- return base;
+ raw_spin_lock_irqsave(&timer->base->cpu_base->lock, *flags);
}
static inline void switch_hrtimer_base(struct hrtimer *timer, int pinned) {}
@@ -951,7 +945,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
unsigned long flags;
int ret, leftmost;
- base = lock_hrtimer_base(timer, &flags);
+ lock_hrtimer_base(timer, &flags);
+ base = timer->base;
/* Remove an active timer from the queue: */
ret = remove_hrtimer(timer);
--
1.7.12.rc2.18.g61b472e
next prev parent reply other threads:[~2014-04-04 6:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-04 6:35 [PATCH V2 00/36] timers/hrtimers: Cleanups & Fixes Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 01/36] hrtimer: replace 'tab' with 'space' after 'comma' Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 02/36] hrtimer: Fix comment mistake over hrtimer_force_reprogram() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 03/36] hrtimer: fix routine names in comments Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 04/36] hrtimer: remove {} around a single liner 'for' loop in migrate_hrtimers() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 05/36] hrtimer: Coalesce format fragments in printk() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 06/36] hrtimer: remove dummy definition of hrtimer_force_reprogram() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 07/36] hrtimer: replace sizeof(struct hrtimer) with sizeof(*timer) Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 08/36] hrtimer: move unlock_hrtimer_base() upwards Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 09/36] hrtimer: call hrtimer_set_expires_range() from hrtimer_set_expires_range_ns() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 10/36] hrtimer: use base->index instead of basenum in switch_hrtimer_base() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 11/36] hrtimer: no need to rewrite '1' to hrtimer_hres_enabled Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 12/36] hrtimer: use base->hres_active directly instead of hrtimer_hres_active() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 13/36] hrtimer: don't check state of base->hres_active in hrtimer_switch_to_hres() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 14/36] hrtimer: reorder code in __remove_hrtimer() Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 15/36] hrtimer: don't emulate notifier call to initialize timer base Viresh Kumar
2014-04-04 6:35 ` [PATCH V2 16/36] hrtimer: Create hrtimer_get_monoexpires() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 17/36] hrtimer: don't check if timer is queued in __remove_hrtimer() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 18/36] hrtimer: rewrite switch_hrtimer_base() to remove extra indentation level Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 19/36] hrtimer: rewrite remove_hrtimer() " Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 20/36] hrtimer: replace base by new_base to get resolution: __hrtimer_start_range_ns() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 21/36] hrtimer: create base_on_this_cpu() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 22/36] hrtimer: clear active_bases as soon as the timer is removed Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 23/36] hrtimer: create for_each_active_base() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 24/36] hrtimer: Use for_each_active_base() to iterate over active clock bases Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 25/36] hrtimer: call hrtimer_get_softirq_time() only if cpu_base->active_bases is set Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 26/36] hrtimer: take lock only once for a cpu_base in hrtimer_run_queues() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 27/36] hrtimer: call switch_hrtimer_base() after setting new expiry time Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 28/36] hrtimer: remove 'base' parameter from remove_timer() and __remove_timer() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 29/36] hrtimer: remove 'base' parameter from switch_hrtimer_base() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 30/36] hrtimer: remove 'base' parameter from enqueue_hrtimer() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 31/36] hrtimer: remove 'base' parameter from hrtimer_{enqueue_}reprogram() Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 32/36] hrtimer: make switch_hrtimer_base() return void Viresh Kumar
2014-04-04 6:36 ` Viresh Kumar [this message]
2014-04-04 6:36 ` [PATCH V2 34/36] hrtimer: make enqueue_hrtimer() " Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 35/36] timer: simplify CPU_UP_PREPARE notifier code path Viresh Kumar
2014-04-04 6:36 ` [PATCH V2 36/36] timer: don't emulate notifier call to initialize timer base Viresh Kumar
2014-04-30 8:51 ` [PATCH V2 00/36] timers/hrtimers: Cleanups & Fixes 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=70dd1920bcbc74a98a61340e44a5915ec4e8e1bf.1396592516.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®