Re: [PATCH 2/2] genalloc: add support to specify the physicaladdress

From: Jean-Christophe PLAGNIOL-VILLARD
Date: Wed Apr 13 2011 - 11:28:19 EST


>
> But this documentation is incorrect. @addr is not "the starting
> address of memory".
>
> > +unsigned long gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long addr)
> > +{
> > + struct list_head *_chunk;
> > + struct gen_pool_chunk *chunk;
> > +
> > + read_lock(&pool->lock);
> > + list_for_each(_chunk, &pool->chunks) {
> > + chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
> > +
> > + if (addr >= chunk->start_addr && addr < chunk->end_addr)
> > + return chunk->phys_addr + addr - chunk->start_addr;
>
> It is in fact "some address within one of the chunks".
yes
do you want a v2 or you fix it in your patch?
>
>
> > + }
> > + read_unlock(&pool->lock);
> > +
> > + return ~0UL;
> > +}
> > +EXPORT_SYMBOL(gen_pool_virt_to_phys);
>
> Was that intentional? If so, what is the reasoning?
yes as 0 can be a valid physical address
and the export as the drivers can be compiled as module
>
>
> Please review...
>
> Subject: lib/genpool.c: document return values, fix gen_pool_add_virt() return value
> From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx>
> Cc: Jes Sorensen <jes@xxxxxxxxxxxxxxxxxx>
> Cc: Nicolas Ferre <nicolas.ferre@xxxxxxxxx>
> Cc: Patrice VILCHEZ <patrice.vilchez@xxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> ---
>
> include/linux/genalloc.h | 2 ++
> lib/genalloc.c | 6 +++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx>

Best Regards,
J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/