summaryrefslogtreecommitdiffstats
path: root/kernel/hrtimer.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2006-03-31 12:31:17 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 22:18:58 +0200
commit00362e33f65f1cb5d15e62ea5509520ce2770360 (patch)
tree02694b1416f3d98c4eebaeca7864c7fd3bad6fa0 /kernel/hrtimer.c
parent[PATCH] LED: Add IDE disk activity LED trigger (diff)
downloadlinux-00362e33f65f1cb5d15e62ea5509520ce2770360.tar.xz
linux-00362e33f65f1cb5d15e62ea5509520ce2770360.zip
[PATCH] hrtimer: create generic sleeper
The removal of the data field in the hrtimer structure enforces the embedding of the timer into another data structure. nanosleep now uses a private implementation of the most common used timer callback function (simple task wakeup). In order to avoid the reimplentation of such functionality all over the place a generic hrtimer_sleeper functionality is created. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r--kernel/hrtimer.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 0237a556eb1f..877cdf9678bf 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -656,6 +656,25 @@ void hrtimer_run_queues(void)
* Sleep related functions:
*/
+static int hrtimer_wakeup(struct hrtimer *timer)
+{
+ struct hrtimer_sleeper *t =
+ container_of(timer, struct hrtimer_sleeper, timer);
+ struct task_struct *task = t->task;
+
+ t->task = NULL;
+ if (task)
+ wake_up_process(task);
+
+ return HRTIMER_NORESTART;
+}
+
+void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, task_t *task)
+{
+ sl->timer.function = hrtimer_wakeup;
+ sl->task = task;
+}
+
struct sleep_hrtimer {
struct hrtimer timer;
struct task_struct *task;