diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-01 08:51:53 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-02 09:28:15 -0500 |
commit | e5e542eea9075dd008993c2ee80b2cc9f31fc494 (patch) | |
tree | 5e63edaec5a5e0ce34b479ccc70fa311610d2abc /kernel | |
parent | 4359ac0ace1a2a267927390ad27f781a2f8e0ab8 (diff) |
posix-timers: Convert clock_getres() to clockid_to_kclock()
Use the new kclock decoding. Fixup the fallout in mmtimer.c
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.709802797@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/posix-timers.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 7f66143d1ce5..748497fffd0f 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -182,14 +182,6 @@ static inline void unlock_timer(struct k_itimer *timr, unsigned long flags) | |||
182 | * the function pointer CALL in struct k_clock. | 182 | * the function pointer CALL in struct k_clock. |
183 | */ | 183 | */ |
184 | 184 | ||
185 | static inline int common_clock_getres(const clockid_t which_clock, | ||
186 | struct timespec *tp) | ||
187 | { | ||
188 | tp->tv_sec = 0; | ||
189 | tp->tv_nsec = posix_clocks[which_clock].res; | ||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static int common_timer_create(struct k_itimer *new_timer) | 185 | static int common_timer_create(struct k_itimer *new_timer) |
194 | { | 186 | { |
195 | hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0); | 187 | hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0); |
@@ -984,18 +976,17 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, | |||
984 | SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, | 976 | SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, |
985 | struct timespec __user *, tp) | 977 | struct timespec __user *, tp) |
986 | { | 978 | { |
979 | struct k_clock *kc = clockid_to_kclock(which_clock); | ||
987 | struct timespec rtn_tp; | 980 | struct timespec rtn_tp; |
988 | int error; | 981 | int error; |
989 | 982 | ||
990 | if (invalid_clockid(which_clock)) | 983 | if (!kc) |
991 | return -EINVAL; | 984 | return -EINVAL; |
992 | 985 | ||
993 | error = CLOCK_DISPATCH(which_clock, clock_getres, | 986 | error = kc->clock_getres(which_clock, &rtn_tp); |
994 | (which_clock, &rtn_tp)); | ||
995 | 987 | ||
996 | if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) { | 988 | if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) |
997 | error = -EFAULT; | 989 | error = -EFAULT; |
998 | } | ||
999 | 990 | ||
1000 | return error; | 991 | return error; |
1001 | } | 992 | } |