diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-01 08:51:06 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-02 09:28:12 -0500 |
commit | 1976945eeaab5fa461735a6225a82c3cf1e65d62 (patch) | |
tree | e718c8b8dd04ce7f2c2441aa69e7798a3d155f82 | |
parent | 2fd1f04089cb657c5d6c484b280ec4d3398aa157 (diff) |
posix-timers: Introduce clock_posix_cpu
The CLOCK_DISPATCH() macro is a horrible magic. We call common
functions if a function pointer is not set. That's just backwards.
To support dynamic file decriptor based clocks we need to cleanup that
dispatch logic.
Create a k_clock struct clock_posix_cpu which has all the
posix-cpu-timer functions filled in. After the cleanup the functions
can be made static.
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: <20110201134417.841974553@linutronix.de>
-rw-r--r-- | include/linux/posix-timers.h | 2 | ||||
-rw-r--r-- | kernel/posix-cpu-timers.c | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index b2c14cbd47a6..1330ff331526 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -85,6 +85,8 @@ struct k_clock { | |||
85 | struct itimerspec * cur_setting); | 85 | struct itimerspec * cur_setting); |
86 | }; | 86 | }; |
87 | 87 | ||
88 | extern struct k_clock clock_posix_cpu; | ||
89 | |||
88 | void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); | 90 | void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); |
89 | 91 | ||
90 | /* error handlers for timer_create, nanosleep and settime */ | 92 | /* error handlers for timer_create, nanosleep and settime */ |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 11b91dc0992b..816cd49a5ad9 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -1604,6 +1604,18 @@ static long thread_cpu_nsleep_restart(struct restart_block *restart_block) | |||
1604 | return -EINVAL; | 1604 | return -EINVAL; |
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | struct k_clock clock_posix_cpu = { | ||
1608 | .clock_getres = posix_cpu_clock_getres, | ||
1609 | .clock_set = posix_cpu_clock_set, | ||
1610 | .clock_get = posix_cpu_clock_get, | ||
1611 | .timer_create = posix_cpu_timer_create, | ||
1612 | .nsleep = posix_cpu_nsleep, | ||
1613 | .nsleep_restart = posix_cpu_nsleep_restart, | ||
1614 | .timer_set = posix_cpu_timer_set, | ||
1615 | .timer_del = posix_cpu_timer_del, | ||
1616 | .timer_get = posix_cpu_timer_get, | ||
1617 | }; | ||
1618 | |||
1607 | static __init int init_posix_cpu_timers(void) | 1619 | static __init int init_posix_cpu_timers(void) |
1608 | { | 1620 | { |
1609 | struct k_clock process = { | 1621 | struct k_clock process = { |