diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2004-10-18 18:15:27 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-18 18:15:27 -0700 |
| commit | 48e5872368b1ada27804e5c4c15fbeea9eb3c284 (patch) | |
| tree | f0d447de057ae2f4f628406f68b1b0dc59359eca /lib | |
| parent | 1ce7772b18bca39ab7d8190c5054c9e0b0d41ea4 (diff) | |
[PATCH] Simplify last lib/idr.c change
The last change to alloc_layer in lib/idr.c unnecessarily complicates
the code and depending on the definition of spin_unlock will cause worse
code to be generated than necessary. The following patch should improve
the situation.
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/idr.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/idr.c b/lib/idr.c index 972eefcce2b3..7d92cfc23ac2 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -39,13 +39,11 @@ static struct idr_layer *alloc_layer(struct idr *idp) struct idr_layer *p; spin_lock(&idp->lock); - if (!(p = idp->id_free)) { - spin_unlock(&idp->lock); - return NULL; + if ((p = idp->id_free)) { + idp->id_free = p->ary[0]; + idp->id_free_cnt--; + p->ary[0] = NULL; } - idp->id_free = p->ary[0]; - idp->id_free_cnt--; - p->ary[0] = NULL; spin_unlock(&idp->lock); return(p); } |
