aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-01 08:51:17 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:13 -0500
commit59bd5bc24aa69f6c62da1e242c16f09f667def96 (patch)
tree4d6798876ff8ae3ea070ee28195630d5774fde05
parenta5cd2880106cb2c79b3fe24f1c53dadba6a542a0 (diff)
posix-timers: Convert clock_nanosleep_restart to clockid_to_kclock()
Use the new kclock decoding function in clock_nanosleep_restart. 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: <20110201134418.131263211@linutronix.de>
-rw-r--r--kernel/posix-timers.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index ee69b216d5c3..4dd86d15bbd0 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -277,12 +277,14 @@ static __init int init_posix_timers(void)
277 struct k_clock clock_realtime = { 277 struct k_clock clock_realtime = {
278 .clock_getres = hrtimer_get_res, 278 .clock_getres = hrtimer_get_res,
279 .nsleep = common_nsleep, 279 .nsleep = common_nsleep,
280 .nsleep_restart = hrtimer_nanosleep_restart,
280 }; 281 };
281 struct k_clock clock_monotonic = { 282 struct k_clock clock_monotonic = {
282 .clock_getres = hrtimer_get_res, 283 .clock_getres = hrtimer_get_res,
283 .clock_get = posix_ktime_get_ts, 284 .clock_get = posix_ktime_get_ts,
284 .clock_set = do_posix_clock_nosettime, 285 .clock_set = do_posix_clock_nosettime,
285 .nsleep = common_nsleep, 286 .nsleep = common_nsleep,
287 .nsleep_restart = hrtimer_nanosleep_restart,
286 }; 288 };
287 struct k_clock clock_monotonic_raw = { 289 struct k_clock clock_monotonic_raw = {
288 .clock_getres = hrtimer_get_res, 290 .clock_getres = hrtimer_get_res,
@@ -1027,22 +1029,16 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
1027} 1029}
1028 1030
1029/* 1031/*
1030 * nanosleep_restart for monotonic and realtime clocks
1031 */
1032static int common_nsleep_restart(struct restart_block *restart_block)
1033{
1034 return hrtimer_nanosleep_restart(restart_block);
1035}
1036
1037/*
1038 * This will restart clock_nanosleep. This is required only by 1032 * This will restart clock_nanosleep. This is required only by
1039 * compat_clock_nanosleep_restart for now. 1033 * compat_clock_nanosleep_restart for now.
1040 */ 1034 */
1041long 1035long clock_nanosleep_restart(struct restart_block *restart_block)
1042clock_nanosleep_restart(struct restart_block *restart_block)
1043{ 1036{
1044 clockid_t which_clock = restart_block->arg0; 1037 clockid_t which_clock = restart_block->arg0;
1038 struct k_clock *kc = clockid_to_kclock(which_clock);
1039
1040 if (WARN_ON_ONCE(!kc || !kc->nsleep_restart))
1041 return -EINVAL;
1045 1042
1046 return CLOCK_DISPATCH(which_clock, nsleep_restart, 1043 return kc->nsleep_restart(restart_block);
1047 (restart_block));
1048} 1044}