/* idr_remove - remove the given id and free it's slot @idp: idr handle @id: unique key  */
void idr_remove(struct idr *idp, int id)
/* idr_remove - remove the given id and free it's slot @idp: idr handle @id: unique key  */
void idr_remove(struct idr *idp, int id)
{
	struct idr_layer *p;
	struct idr_layer *to_free;
	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]) {
		to_free = idp->top;
		p = idp->top->ary[0];
		rcu_assign_pointer(idp->top, p);
		--idp->layers;
		to_free->bitmap = to_free->count = 0;
		free_layer(to_free);
	}
	while (idp->id_free_cnt >= IDR_FREE_MAX) {
		p = get_from_free_list(idp);
		kmem_cache_free(idr_layer_cache, p);
	}
	return;
}