Subject: [PATCH 3/5] DMA: reduce the number of memory allocations

From: [email-masked] (Michał Nazarewicz)
Date: Fri, 20 Aug 2010 03:15:22 +0200

On Thu, 19 Aug 2010 16:40:15 +0200, Guennadi Liakhovetski <[email-masked]> wrote:

> Allocate the bitmap in dma_declare_coherent_memory() together with the struct
> dma_coherent_mem object.
>
> Signed-off-by: Guennadi Liakhovetski <[email-masked]>
> ---
>  drivers/base/dma-coherent.c |   11 +++--------
>  1 files changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c
> index f369e27..8efdfd4 100644
> --- a/drivers/base/dma-coherent.c
> +++ b/drivers/base/dma-coherent.c
> @@ -11,7 +11,7 @@ struct dma_coherent_mem {
>  	dma_addr_t	device_base;
>  	int		size;
>  	int		flags;
> -	unsigned long	*bitmap;
> +	unsigned long	bitmap[0];
>  };

Wouldn't "bitmap[]" be better? AFAIR "bitmap[0]" is really a GCC extension and
C99 has introduced "bitmap[]" for exactly the above purpose.

-- 
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  Micha? "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--