mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
posix-timers: Convert clock_nanosleep_restart to clockid_to_kclock()
Use the new kclock decoding function in clock_nanosleep_restart. 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.131263211@linutronix.de>
This commit is contained in:
parent
a5cd288010
commit
59bd5bc24a
@ -277,12 +277,14 @@ static __init int init_posix_timers(void)
|
||||
struct k_clock clock_realtime = {
|
||||
.clock_getres = hrtimer_get_res,
|
||||
.nsleep = common_nsleep,
|
||||
.nsleep_restart = hrtimer_nanosleep_restart,
|
||||
};
|
||||
struct k_clock clock_monotonic = {
|
||||
.clock_getres = hrtimer_get_res,
|
||||
.clock_get = posix_ktime_get_ts,
|
||||
.clock_set = do_posix_clock_nosettime,
|
||||
.nsleep = common_nsleep,
|
||||
.nsleep_restart = hrtimer_nanosleep_restart,
|
||||
};
|
||||
struct k_clock clock_monotonic_raw = {
|
||||
.clock_getres = hrtimer_get_res,
|
||||
@ -1026,23 +1028,17 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
|
||||
return kc->nsleep(which_clock, flags, &t, rmtp);
|
||||
}
|
||||
|
||||
/*
|
||||
* nanosleep_restart for monotonic and realtime clocks
|
||||
*/
|
||||
static int common_nsleep_restart(struct restart_block *restart_block)
|
||||
{
|
||||
return hrtimer_nanosleep_restart(restart_block);
|
||||
}
|
||||
|
||||
/*
|
||||
* This will restart clock_nanosleep. This is required only by
|
||||
* compat_clock_nanosleep_restart for now.
|
||||
*/
|
||||
long
|
||||
clock_nanosleep_restart(struct restart_block *restart_block)
|
||||
long clock_nanosleep_restart(struct restart_block *restart_block)
|
||||
{
|
||||
clockid_t which_clock = restart_block->arg0;
|
||||
struct k_clock *kc = clockid_to_kclock(which_clock);
|
||||
|
||||
return CLOCK_DISPATCH(which_clock, nsleep_restart,
|
||||
(restart_block));
|
||||
if (WARN_ON_ONCE(!kc || !kc->nsleep_restart))
|
||||
return -EINVAL;
|
||||
|
||||
return kc->nsleep_restart(restart_block);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user