mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Cc: John Stultz <[email protected]> Acked-by: Richard Cochran <[email protected]> LKML-Reference: <[email protected]>
This commit is contained in:
parent
1976945eea
commit
cc785ac22b
1 changed files with 10 additions and 0 deletions
|
|
@ -531,6 +531,16 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set)
|
|||
kmem_cache_free(posix_timers_cache, tmr);
|
||||
}
|
||||
|
||||
static struct k_clock *clockid_to_kclock(const clockid_t id)
|
||||
{
|
||||
if (id < 0)
|
||||
return &clock_posix_cpu;
|
||||
|
||||
if (id >= MAX_CLOCKS || !posix_clocks[id].clock_getres)
|
||||
return NULL;
|
||||
return &posix_clocks[id];
|
||||
}
|
||||
|
||||
/* Create a POSIX.1b interval timer. */
|
||||
|
||||
SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
|
||||
|
|
|
|||
Loading…
Reference in a new issue