Commit 48e58723 authored by Ulrich Drepper's avatar Ulrich Drepper Committed by Linus Torvalds

[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: default avatarUlrich Drepper <drepper@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ce7772b
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment