diff options
| author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:56 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:19 -0500 |
| commit | ee94d523bf92d3b8b2de166943d48ac7fd695e10 (patch) | |
| tree | 841fc7212003a43da67a7da6eee05dbe7556b742 /kernel | |
| parent | 0e9c3be20d88aa5ed13fde4ece50f45eb96824ad (diff) | |
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>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/posix-timers.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 7edfe4b901e7..6edbb2c55c22 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
| @@ -552,24 +552,22 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
| 552 | return -EAGAIN; | 552 | return -EAGAIN; |
| 553 | 553 | ||
| 554 | spin_lock_init(&new_timer->it_lock); | 554 | spin_lock_init(&new_timer->it_lock); |
| 555 | retry: | 555 | |
| 556 | if (unlikely(!idr_pre_get(&posix_timers_id, GFP_KERNEL))) { | 556 | idr_preload(GFP_KERNEL); |
| 557 | error = -EAGAIN; | ||
| 558 | goto out; | ||
| 559 | } | ||
| 560 | spin_lock_irq(&idr_lock); | 557 | spin_lock_irq(&idr_lock); |
| 561 | error = idr_get_new(&posix_timers_id, new_timer, &new_timer_id); | 558 | error = idr_alloc(&posix_timers_id, new_timer, 0, 0, GFP_NOWAIT); |
| 562 | spin_unlock_irq(&idr_lock); | 559 | spin_unlock_irq(&idr_lock); |
| 563 | if (error) { | 560 | idr_preload_end(); |
| 564 | if (error == -EAGAIN) | 561 | if (error < 0) { |
| 565 | goto retry; | ||
| 566 | /* | 562 | /* |
| 567 | * Weird looking, but we return EAGAIN if the IDR is | 563 | * Weird looking, but we return EAGAIN if the IDR is |
| 568 | * full (proper POSIX return value for this) | 564 | * full (proper POSIX return value for this) |
| 569 | */ | 565 | */ |
| 570 | error = -EAGAIN; | 566 | if (error == -ENOSPC) |
| 567 | error = -EAGAIN; | ||
| 571 | goto out; | 568 | goto out; |
| 572 | } | 569 | } |
| 570 | new_timer_id = error; | ||
| 573 | 571 | ||
| 574 | it_id_set = IT_ID_SET; | 572 | it_id_set = IT_ID_SET; |
| 575 | new_timer->it_id = (timer_t) new_timer_id; | 573 | new_timer->it_id = (timer_t) new_timer_id; |
