summaryrefslogtreecommitdiffstats
path: root/drivers/staging/android
diff options
context:
space:
mode:
authorArve Hjønnevåg2012-02-09 23:24:38 +0100
committerGreg Kroah-Hartman2012-02-10 19:08:00 +0100
commit66c48107719b751e8ec360034bc84ee1511147e4 (patch)
tree7b9196acf3a4ac5c1d2d5bb42e35fd437c7f5c68 /drivers/staging/android
parentstaging: android-alarm: Disable Android alarm driver by default (diff)
downloadkernel-qcow2-linux-66c48107719b751e8ec360034bc84ee1511147e4.tar.gz
kernel-qcow2-linux-66c48107719b751e8ec360034bc84ee1511147e4.tar.xz
kernel-qcow2-linux-66c48107719b751e8ec360034bc84ee1511147e4.zip
staging: android-alarm: Update hrtimer if alarm at the head of the queue is reprogrammed
If an alarm was restarted with a value that moved it away from the head of a queue, the hrtimer would not be updated. This would cause unnecessary wakeups. CC: Arve Hjønnevåg <arve@android.com> CC: Android Kernel Team <kernel-team@android.com> Change-Id: If379f8dd92b0bdb3173bd8d057adfe0dc1d15259 Signed-off-by: Arve Hjønnevåg <arve@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r--drivers/staging/android/alarm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/staging/android/alarm.c b/drivers/staging/android/alarm.c
index 5370fdc8b016..445c0b12c473 100644
--- a/drivers/staging/android/alarm.c
+++ b/drivers/staging/android/alarm.c
@@ -119,12 +119,15 @@ static void alarm_enqueue_locked(struct android_alarm *alarm)
struct rb_node *parent = NULL;
struct android_alarm *entry;
int leftmost = 1;
+ bool was_first = false;
pr_alarm(FLOW, "added alarm, type %d, func %pF at %lld\n",
alarm->type, alarm->function, ktime_to_ns(alarm->expires));
- if (base->first == &alarm->node)
+ if (base->first == &alarm->node) {
base->first = rb_next(&alarm->node);
+ was_first = true;
+ }
if (!RB_EMPTY_NODE(&alarm->node)) {
rb_erase(&alarm->node, &base->alarms);
RB_CLEAR_NODE(&alarm->node);
@@ -144,10 +147,10 @@ static void alarm_enqueue_locked(struct android_alarm *alarm)
leftmost = 0;
}
}
- if (leftmost) {
+ if (leftmost)
base->first = &alarm->node;
- update_timer_locked(base, false);
- }
+ if (leftmost || was_first)
+ update_timer_locked(base, was_first);
rb_link_node(&alarm->node, parent, link);
rb_insert_color(&alarm->node, &base->alarms);