diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-01 08:51:11 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-02 09:28:13 -0500 |
commit | a5cd2880106cb2c79b3fe24f1c53dadba6a542a0 (patch) | |
tree | aa0d44b790a38975ff4429e3de3564df92c7b15f /kernel/posix-timers.c | |
parent | cc785ac22b17ed53e8ff5c1501e422be6d10be3c (diff) |
posix-timers: Convert clock_nanosleep to clockid_to_kclock()
Use the new kclock decoding function in clock_nanosleep and cleanup all
kclocks which use the default functions.
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.034175556@linutronix.de>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r-- | kernel/posix-timers.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 14b0a70ffb1e..ee69b216d5c3 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -216,12 +216,6 @@ static int no_timer_create(struct k_itimer *new_timer) | |||
216 | return -EOPNOTSUPP; | 216 | return -EOPNOTSUPP; |
217 | } | 217 | } |
218 | 218 | ||
219 | static int no_nsleep(const clockid_t which_clock, int flags, | ||
220 | struct timespec *tsave, struct timespec __user *rmtp) | ||
221 | { | ||
222 | return -EOPNOTSUPP; | ||
223 | } | ||
224 | |||
225 | /* | 219 | /* |
226 | * Return nonzero if we know a priori this clockid_t value is bogus. | 220 | * Return nonzero if we know a priori this clockid_t value is bogus. |
227 | */ | 221 | */ |
@@ -282,32 +276,31 @@ static __init int init_posix_timers(void) | |||
282 | { | 276 | { |
283 | struct k_clock clock_realtime = { | 277 | struct k_clock clock_realtime = { |
284 | .clock_getres = hrtimer_get_res, | 278 | .clock_getres = hrtimer_get_res, |
279 | .nsleep = common_nsleep, | ||
285 | }; | 280 | }; |
286 | struct k_clock clock_monotonic = { | 281 | struct k_clock clock_monotonic = { |
287 | .clock_getres = hrtimer_get_res, | 282 | .clock_getres = hrtimer_get_res, |
288 | .clock_get = posix_ktime_get_ts, | 283 | .clock_get = posix_ktime_get_ts, |
289 | .clock_set = do_posix_clock_nosettime, | 284 | .clock_set = do_posix_clock_nosettime, |
285 | .nsleep = common_nsleep, | ||
290 | }; | 286 | }; |
291 | struct k_clock clock_monotonic_raw = { | 287 | struct k_clock clock_monotonic_raw = { |
292 | .clock_getres = hrtimer_get_res, | 288 | .clock_getres = hrtimer_get_res, |
293 | .clock_get = posix_get_monotonic_raw, | 289 | .clock_get = posix_get_monotonic_raw, |
294 | .clock_set = do_posix_clock_nosettime, | 290 | .clock_set = do_posix_clock_nosettime, |
295 | .timer_create = no_timer_create, | 291 | .timer_create = no_timer_create, |
296 | .nsleep = no_nsleep, | ||
297 | }; | 292 | }; |
298 | struct k_clock clock_realtime_coarse = { | 293 | struct k_clock clock_realtime_coarse = { |
299 | .clock_getres = posix_get_coarse_res, | 294 | .clock_getres = posix_get_coarse_res, |
300 | .clock_get = posix_get_realtime_coarse, | 295 | .clock_get = posix_get_realtime_coarse, |
301 | .clock_set = do_posix_clock_nosettime, | 296 | .clock_set = do_posix_clock_nosettime, |
302 | .timer_create = no_timer_create, | 297 | .timer_create = no_timer_create, |
303 | .nsleep = no_nsleep, | ||
304 | }; | 298 | }; |
305 | struct k_clock clock_monotonic_coarse = { | 299 | struct k_clock clock_monotonic_coarse = { |
306 | .clock_getres = posix_get_coarse_res, | 300 | .clock_getres = posix_get_coarse_res, |
307 | .clock_get = posix_get_monotonic_coarse, | 301 | .clock_get = posix_get_monotonic_coarse, |
308 | .clock_set = do_posix_clock_nosettime, | 302 | .clock_set = do_posix_clock_nosettime, |
309 | .timer_create = no_timer_create, | 303 | .timer_create = no_timer_create, |
310 | .nsleep = no_nsleep, | ||
311 | }; | 304 | }; |
312 | 305 | ||
313 | register_posix_clock(CLOCK_REALTIME, &clock_realtime); | 306 | register_posix_clock(CLOCK_REALTIME, &clock_realtime); |
@@ -952,13 +945,6 @@ int do_posix_clock_nosettime(const clockid_t clockid, const struct timespec *tp) | |||
952 | } | 945 | } |
953 | EXPORT_SYMBOL_GPL(do_posix_clock_nosettime); | 946 | EXPORT_SYMBOL_GPL(do_posix_clock_nosettime); |
954 | 947 | ||
955 | int do_posix_clock_nonanosleep(const clockid_t clock, int flags, | ||
956 | struct timespec *t, struct timespec __user *r) | ||
957 | { | ||
958 | return -ENANOSLEEP_NOTSUP; | ||
959 | } | ||
960 | EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep); | ||
961 | |||
962 | SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, | 948 | SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, |
963 | const struct timespec __user *, tp) | 949 | const struct timespec __user *, tp) |
964 | { | 950 | { |
@@ -1023,10 +1009,13 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, | |||
1023 | const struct timespec __user *, rqtp, | 1009 | const struct timespec __user *, rqtp, |
1024 | struct timespec __user *, rmtp) | 1010 | struct timespec __user *, rmtp) |
1025 | { | 1011 | { |
1012 | struct k_clock *kc = clockid_to_kclock(which_clock); | ||
1026 | struct timespec t; | 1013 | struct timespec t; |
1027 | 1014 | ||
1028 | if (invalid_clockid(which_clock)) | 1015 | if (!kc) |
1029 | return -EINVAL; | 1016 | return -EINVAL; |
1017 | if (!kc->nsleep) | ||
1018 | return -ENANOSLEEP_NOTSUP; | ||
1030 | 1019 | ||
1031 | if (copy_from_user(&t, rqtp, sizeof (struct timespec))) | 1020 | if (copy_from_user(&t, rqtp, sizeof (struct timespec))) |
1032 | return -EFAULT; | 1021 | return -EFAULT; |
@@ -1034,8 +1023,7 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, | |||
1034 | if (!timespec_valid(&t)) | 1023 | if (!timespec_valid(&t)) |
1035 | return -EINVAL; | 1024 | return -EINVAL; |
1036 | 1025 | ||
1037 | return CLOCK_DISPATCH(which_clock, nsleep, | 1026 | return kc->nsleep(which_clock, flags, &t, rmtp); |
1038 | (which_clock, flags, &t, rmtp)); | ||
1039 | } | 1027 | } |
1040 | 1028 | ||
1041 | /* | 1029 | /* |