aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-timers.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-01 08:52:07 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:17 -0500
commit6761c6702e2c647582e1829abe8cf90794f61d9d (patch)
tree10efe955348f5271fdf657b82d6ccd01c26dbe08 /kernel/posix-timers.c
parenta7319fa253a549c4c6528fb550ae6e72a9c83811 (diff)
posix-timers: Convert timer_delete() to clockid_to_kclock()
Set the common function for CLOCK_MONOTONIC and CLOCK_REALTIME kclocks and use the new decoding function. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <johnstul@us.ibm.com> Tested-by: Richard Cochran <richard.cochran@omicron.at> LKML-Reference: <20110201134419.198999420@linutronix.de>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r--kernel/posix-timers.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index c1e2636f9e45..ade7dec49f96 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -254,6 +254,7 @@ static __init int init_posix_timers(void)
254 .timer_create = common_timer_create, 254 .timer_create = common_timer_create,
255 .timer_set = common_timer_set, 255 .timer_set = common_timer_set,
256 .timer_get = common_timer_get, 256 .timer_get = common_timer_get,
257 .timer_del = common_timer_del,
257 }; 258 };
258 struct k_clock clock_monotonic = { 259 struct k_clock clock_monotonic = {
259 .clock_getres = hrtimer_get_res, 260 .clock_getres = hrtimer_get_res,
@@ -263,6 +264,7 @@ static __init int init_posix_timers(void)
263 .timer_create = common_timer_create, 264 .timer_create = common_timer_create,
264 .timer_set = common_timer_set, 265 .timer_set = common_timer_set,
265 .timer_get = common_timer_get, 266 .timer_get = common_timer_get,
267 .timer_del = common_timer_del,
266 }; 268 };
267 struct k_clock clock_monotonic_raw = { 269 struct k_clock clock_monotonic_raw = {
268 .clock_getres = hrtimer_get_res, 270 .clock_getres = hrtimer_get_res,
@@ -859,7 +861,7 @@ retry:
859 return error; 861 return error;
860} 862}
861 863
862static inline int common_timer_del(struct k_itimer *timer) 864static int common_timer_del(struct k_itimer *timer)
863{ 865{
864 timer->it.real.interval.tv64 = 0; 866 timer->it.real.interval.tv64 = 0;
865 867
@@ -870,7 +872,11 @@ static inline int common_timer_del(struct k_itimer *timer)
870 872
871static inline int timer_delete_hook(struct k_itimer *timer) 873static inline int timer_delete_hook(struct k_itimer *timer)
872{ 874{
873 return CLOCK_DISPATCH(timer->it_clock, timer_del, (timer)); 875 struct k_clock *kc = clockid_to_kclock(timer->it_clock);
876
877 if (WARN_ON_ONCE(!kc || !kc->timer_del))
878 return -EINVAL;
879 return kc->timer_del(timer);
874} 880}
875 881
876/* Delete a POSIX.1b interval timer. */ 882/* Delete a POSIX.1b interval timer. */