Re: [PATCH 2/2] lib/genalloc.c: export symbol addr_in_gen_pool

From: Andrew Morton
Date: Fri Dec 28 2018 - 01:04:10 EST


On Mon, 24 Dec 2018 15:06:22 +0800 Huang Shijie <sjhuang@xxxxxxxxxxx> wrote:

> We may use the addr_in_gen_pool() in the driver module.
> So export the addr_in_gen_pool for the compiling.
>
> ...
>
> --- a/lib/genalloc.c
> +++ b/lib/genalloc.c
> @@ -450,6 +450,7 @@ bool addr_in_gen_pool(struct gen_pool *pool, unsigned long start,
> rcu_read_unlock();
> return found;
> }
> +EXPORT_SYMBOL(addr_in_gen_pool);
>
> /**
> * gen_pool_avail - get available free space of the pool

OK, but... The name is poor.

q:/usr/src/25> grep EXPORT_SYMBOL lib/genalloc.c
EXPORT_SYMBOL(gen_pool_create);
EXPORT_SYMBOL(gen_pool_add_virt);
EXPORT_SYMBOL(gen_pool_virt_to_phys);
EXPORT_SYMBOL(gen_pool_destroy);
EXPORT_SYMBOL(gen_pool_alloc);
EXPORT_SYMBOL(gen_pool_alloc_algo);
EXPORT_SYMBOL(gen_pool_dma_alloc);
EXPORT_SYMBOL(gen_pool_free);
EXPORT_SYMBOL(gen_pool_for_each_chunk);
EXPORT_SYMBOL_GPL(gen_pool_avail);
EXPORT_SYMBOL_GPL(gen_pool_size);
EXPORT_SYMBOL(gen_pool_set_algo);
EXPORT_SYMBOL(gen_pool_first_fit);
EXPORT_SYMBOL(gen_pool_first_fit_align);
EXPORT_SYMBOL(gen_pool_fixed_alloc);
EXPORT_SYMBOL(gen_pool_first_fit_order_align);
EXPORT_SYMBOL(gen_pool_best_fit);
EXPORT_SYMBOL_GPL(gen_pool_get);
EXPORT_SYMBOL(devm_gen_pool_create);
EXPORT_SYMBOL_GPL(of_gen_pool_get);

See? Almost everything is called gen_pool_foo. Which is correct as
per kernel conventions. We should globally rename this to
gen_pool_has_addr or similar.