Commit 8b9cfca6 authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

[PATCH] posix-timers: tidy up clock interfaces and consolidate dispatch logic

This patch cleans up the posix-timers interfaces for defining clocks, and the
calls to them.  It fixes some sloppy types, adds a clockid_t parameter to the
calls that lacked it, and adds a function pointer that can be used for
clock_getres.  It further cleans up the posix-timers.c code using the k_clock
function pointers or default functions when no hooks are supplied,
consolidating repeated code into shared inline functions or macros.  This
paves the way for adding the CPU clock hooks.

The mmtimer.c changes are untested, but obviously can't be wrong.  There
aren't any other struct k_clock definitions in the tree, but any others would
need to be updated for the function signature changes.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d6b7a781
...@@ -376,7 +376,7 @@ static int sgi_clock_period; ...@@ -376,7 +376,7 @@ static int sgi_clock_period;
static struct timespec sgi_clock_offset; static struct timespec sgi_clock_offset;
static int sgi_clock_period; static int sgi_clock_period;
static int sgi_clock_get(struct timespec *tp) static int sgi_clock_get(clockid_t clockid, struct timespec *tp)
{ {
u64 nsec; u64 nsec;
...@@ -387,7 +387,7 @@ static int sgi_clock_get(struct timespec *tp) ...@@ -387,7 +387,7 @@ static int sgi_clock_get(struct timespec *tp)
return 0; return 0;
}; };
static int sgi_clock_set(struct timespec *tp) static int sgi_clock_set(clockid_t clockid, struct timespec *tp)
{ {
u64 nsec; u64 nsec;
......
...@@ -30,12 +30,12 @@ struct k_clock_abs { ...@@ -30,12 +30,12 @@ struct k_clock_abs {
}; };
struct k_clock { struct k_clock {
int res; /* in nano seconds */ int res; /* in nano seconds */
int (*clock_getres) (clockid_t which_clock, struct timespec *tp);
struct k_clock_abs *abs_struct; struct k_clock_abs *abs_struct;
int (*clock_set) (struct timespec * tp); int (*clock_set) (clockid_t which_clock, struct timespec * tp);
int (*clock_get) (struct timespec * tp); int (*clock_get) (clockid_t which_clock, struct timespec * tp);
int (*timer_create) (struct k_itimer *timer); int (*timer_create) (struct k_itimer *timer);
int (*nsleep) (int which_clock, int flags, int (*nsleep) (clockid_t which_clock, int flags, struct timespec *);
struct timespec * t);
int (*timer_set) (struct k_itimer * timr, int flags, int (*timer_set) (struct k_itimer * timr, int flags,
struct itimerspec * new_setting, struct itimerspec * new_setting,
struct itimerspec * old_setting); struct itimerspec * old_setting);
...@@ -44,12 +44,12 @@ struct k_clock { ...@@ -44,12 +44,12 @@ struct k_clock {
struct itimerspec * cur_setting); struct itimerspec * cur_setting);
}; };
void register_posix_clock(int clock_id, struct k_clock *new_clock); void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock);
/* Error handlers for timer_create, nanosleep and settime */ /* Error handlers for timer_create, nanosleep and settime */
int do_posix_clock_notimer_create(struct k_itimer *timer); int do_posix_clock_notimer_create(struct k_itimer *timer);
int do_posix_clock_nonanosleep(int which_clock, int flags, struct timespec * t); int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *);
int do_posix_clock_nosettime(struct timespec *tp); int do_posix_clock_nosettime(clockid_t, struct timespec *tp);
/* function to call to trigger timer event */ /* function to call to trigger timer event */
int posix_timer_event(struct k_itimer *timr, int si_private); int posix_timer_event(struct k_itimer *timr, int si_private);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment