mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
posix-timers: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0e9c3be20d
commit
ee94d523bf
1 changed files with 8 additions and 10 deletions
|
@ -552,24 +552,22 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
spin_lock_init(&new_timer->it_lock);
|
spin_lock_init(&new_timer->it_lock);
|
||||||
retry:
|
|
||||||
if (unlikely(!idr_pre_get(&posix_timers_id, GFP_KERNEL))) {
|
idr_preload(GFP_KERNEL);
|
||||||
error = -EAGAIN;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
spin_lock_irq(&idr_lock);
|
spin_lock_irq(&idr_lock);
|
||||||
error = idr_get_new(&posix_timers_id, new_timer, &new_timer_id);
|
error = idr_alloc(&posix_timers_id, new_timer, 0, 0, GFP_NOWAIT);
|
||||||
spin_unlock_irq(&idr_lock);
|
spin_unlock_irq(&idr_lock);
|
||||||
if (error) {
|
idr_preload_end();
|
||||||
if (error == -EAGAIN)
|
if (error < 0) {
|
||||||
goto retry;
|
|
||||||
/*
|
/*
|
||||||
* Weird looking, but we return EAGAIN if the IDR is
|
* Weird looking, but we return EAGAIN if the IDR is
|
||||||
* full (proper POSIX return value for this)
|
* full (proper POSIX return value for this)
|
||||||
*/
|
*/
|
||||||
error = -EAGAIN;
|
if (error == -ENOSPC)
|
||||||
|
error = -EAGAIN;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
new_timer_id = error;
|
||||||
|
|
||||||
it_id_set = IT_ID_SET;
|
it_id_set = IT_ID_SET;
|
||||||
new_timer->it_id = (timer_t) new_timer_id;
|
new_timer->it_id = (timer_t) new_timer_id;
|
||||||
|
|
Loading…
Add table
Reference in a new issue