[PATCH] Whitespace and CodingStyle cleanup for lib/idr.c
Cleanup trailing whitespace, blank lines, CodingStyle issues etc, for lib/idr.c Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Родитель
850b924792
Коммит
e15ae2dd3e
21
lib/idr.c
21
lib/idr.c
|
@ -77,7 +77,7 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
|
|||
while (idp->id_free_cnt < IDR_FREE_MAX) {
|
||||
struct idr_layer *new;
|
||||
new = kmem_cache_alloc(idr_layer_cache, gfp_mask);
|
||||
if(new == NULL)
|
||||
if (new == NULL)
|
||||
return (0);
|
||||
free_layer(idp, new);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ static int sub_alloc(struct idr *idp, void *ptr, int *starting_id)
|
|||
if (m == IDR_SIZE) {
|
||||
/* no space available go back to previous layer. */
|
||||
l++;
|
||||
id = (id | ((1 << (IDR_BITS*l))-1)) + 1;
|
||||
id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
|
||||
if (!(p = pa[l])) {
|
||||
*starting_id = id;
|
||||
return -2;
|
||||
|
@ -225,6 +225,7 @@ build_up:
|
|||
int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = idr_get_new_above_int(idp, ptr, starting_id);
|
||||
/*
|
||||
* This is a cheap hack until the IDR code can be fixed to
|
||||
|
@ -259,6 +260,7 @@ EXPORT_SYMBOL(idr_get_new_above);
|
|||
int idr_get_new(struct idr *idp, void *ptr, int *id)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = idr_get_new_above_int(idp, ptr, 0);
|
||||
/*
|
||||
* This is a cheap hack until the IDR code can be fixed to
|
||||
|
@ -306,11 +308,10 @@ static void sub_remove(struct idr *idp, int shift, int id)
|
|||
free_layer(idp, **paa);
|
||||
**paa-- = NULL;
|
||||
}
|
||||
if ( ! *paa )
|
||||
if (!*paa)
|
||||
idp->layers = 0;
|
||||
} else {
|
||||
} else
|
||||
idr_remove_warning(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -326,9 +327,8 @@ void idr_remove(struct idr *idp, int id)
|
|||
id &= MAX_ID_MASK;
|
||||
|
||||
sub_remove(idp, (idp->layers - 1) * IDR_BITS, id);
|
||||
if ( idp->top && idp->top->count == 1 &&
|
||||
(idp->layers > 1) &&
|
||||
idp->top->ary[0]){ // We can drop a layer
|
||||
if (idp->top && idp->top->count == 1 && (idp->layers > 1) &&
|
||||
idp->top->ary[0]) { // We can drop a layer
|
||||
|
||||
p = idp->top->ary[0];
|
||||
idp->top->bitmap = idp->top->count = 0;
|
||||
|
@ -337,7 +337,6 @@ void idr_remove(struct idr *idp, int id)
|
|||
--idp->layers;
|
||||
}
|
||||
while (idp->id_free_cnt >= IDR_FREE_MAX) {
|
||||
|
||||
p = alloc_layer(idp);
|
||||
kmem_cache_free(idr_layer_cache, p);
|
||||
return;
|
||||
|
@ -391,8 +390,8 @@ void *idr_find(struct idr *idp, int id)
|
|||
}
|
||||
EXPORT_SYMBOL(idr_find);
|
||||
|
||||
static void idr_cache_ctor(void * idr_layer,
|
||||
kmem_cache_t *idr_layer_cache, unsigned long flags)
|
||||
static void idr_cache_ctor(void * idr_layer, kmem_cache_t *idr_layer_cache,
|
||||
unsigned long flags)
|
||||
{
|
||||
memset(idr_layer, 0, sizeof(struct idr_layer));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче