aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-01 08:51:09 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:12 -0500
commitcc785ac22b17ed53e8ff5c1501e422be6d10be3c (patch)
treec2e1dc5e367f55882f7abf259a2b4a94beefcc79
parent1976945eeaab5fa461735a6225a82c3cf1e65d62 (diff)
posix-timers: Introduce clockid_to_kclock()
New function to find the kclock for a given clockid. Returns a pointer to clock_posix_cpu if clockid < 0. If clockid >= MAXCLOCK or if the clock_getres pointer is not set it returns NULL. For valid clocks it returns a pointer to the matching posix_clock. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <johnstul@us.ibm.com> Acked-by: Richard Cochran <richard.cochran@omicron.at> LKML-Reference: <20110201134417.938447839@linutronix.de>
-rw-r--r--kernel/posix-timers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index e7d26afd8ee5..14b0a70ffb1e 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -531,6 +531,16 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set)
531 kmem_cache_free(posix_timers_cache, tmr); 531 kmem_cache_free(posix_timers_cache, tmr);
532} 532}
533 533
534static struct k_clock *clockid_to_kclock(const clockid_t id)
535{
536 if (id < 0)
537 return &clock_posix_cpu;
538
539 if (id >= MAX_CLOCKS || !posix_clocks[id].clock_getres)
540 return NULL;
541 return &posix_clocks[id];
542}
543
534/* Create a POSIX.1b interval timer. */ 544/* Create a POSIX.1b interval timer. */
535 545
536SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, 546SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,