diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-01 08:52:01 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-02 09:28:16 -0500 |
commit | 27722df16ef143017db55ac7baac1703a68017ff (patch) | |
tree | eb3bc5743adbddb7811627beb3f8981120cc3a79 /kernel/posix-timers.c | |
parent | 838394fbf989973ec7f5a0ad82cb6ff09e5c39aa (diff) |
posix-timers: Convert timer_settime() 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.001863714@linutronix.de>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r-- | kernel/posix-timers.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 4f71382a4ca8..a4dbfe71c5a5 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -252,6 +252,7 @@ static __init int init_posix_timers(void) | |||
252 | .nsleep = common_nsleep, | 252 | .nsleep = common_nsleep, |
253 | .nsleep_restart = hrtimer_nanosleep_restart, | 253 | .nsleep_restart = hrtimer_nanosleep_restart, |
254 | .timer_create = common_timer_create, | 254 | .timer_create = common_timer_create, |
255 | .timer_set = common_timer_set, | ||
255 | }; | 256 | }; |
256 | struct k_clock clock_monotonic = { | 257 | struct k_clock clock_monotonic = { |
257 | .clock_getres = hrtimer_get_res, | 258 | .clock_getres = hrtimer_get_res, |
@@ -259,6 +260,7 @@ static __init int init_posix_timers(void) | |||
259 | .nsleep = common_nsleep, | 260 | .nsleep = common_nsleep, |
260 | .nsleep_restart = hrtimer_nanosleep_restart, | 261 | .nsleep_restart = hrtimer_nanosleep_restart, |
261 | .timer_create = common_timer_create, | 262 | .timer_create = common_timer_create, |
263 | .timer_set = common_timer_set, | ||
262 | }; | 264 | }; |
263 | struct k_clock clock_monotonic_raw = { | 265 | struct k_clock clock_monotonic_raw = { |
264 | .clock_getres = hrtimer_get_res, | 266 | .clock_getres = hrtimer_get_res, |
@@ -814,6 +816,7 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, | |||
814 | int error = 0; | 816 | int error = 0; |
815 | unsigned long flag; | 817 | unsigned long flag; |
816 | struct itimerspec *rtn = old_setting ? &old_spec : NULL; | 818 | struct itimerspec *rtn = old_setting ? &old_spec : NULL; |
819 | struct k_clock *kc; | ||
817 | 820 | ||
818 | if (!new_setting) | 821 | if (!new_setting) |
819 | return -EINVAL; | 822 | return -EINVAL; |
@@ -829,8 +832,11 @@ retry: | |||
829 | if (!timr) | 832 | if (!timr) |
830 | return -EINVAL; | 833 | return -EINVAL; |
831 | 834 | ||
832 | error = CLOCK_DISPATCH(timr->it_clock, timer_set, | 835 | kc = clockid_to_kclock(timr->it_clock); |
833 | (timr, flags, &new_spec, rtn)); | 836 | if (WARN_ON_ONCE(!kc || !kc->timer_set)) |
837 | error = -EINVAL; | ||
838 | else | ||
839 | error = kc->timer_set(timr, flags, &new_spec, rtn); | ||
834 | 840 | ||
835 | unlock_timer(timr, flag); | 841 | unlock_timer(timr, flag); |
836 | if (error == TIMER_RETRY) { | 842 | if (error == TIMER_RETRY) { |