9
0
Fork 0

blackfin, mips, openrisc, ppc, sandbox, x86: add generic dma_alloc, dma_free inlines

Some drivers call dma_inv_range() on buffers, on arm these buffers must
be cache line aligned. This patch introduces a generic dma_alloc,
dma_free. Archs can implement in their own functions in "asm/dma.h" and add a:

	#define dma_alloc dma_alloc
	#define dma_free dma_free

On all other archs the generic versions, which translate into xmalloc
and free are used.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde 2012-06-20 13:57:31 +02:00 committed by Sascha Hauer
parent 76df95bde1
commit ed2180d658
7 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __ASM_DMA_H
#define __ASM_DMA_H
/* empty */
#endif /* __ASM_DMA_H */

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __ASM_DMA_H
#define __ASM_DMA_H
/* empty */
#endif /* __ASM_DMA_H */

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __ASM_DMA_H
#define __ASM_DMA_H
/* empty */
#endif /* __ASM_DMA_H */

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __ASM_DMA_H
#define __ASM_DMA_H
/* empty */
#endif /* __ASM_DMA_H */

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __ASM_DMA_H
#define __ASM_DMA_H
/* empty*/
#endif /* __ASM_DMA_H */

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __ASM_DMA_H
#define __ASM_DMA_H
/* empty */
#endif /* __ASM_DMA_H */

30
include/dma.h Normal file
View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
*
* This file is released under the GPLv2
*
*/
#ifndef __DMA_H
#define __DMA_H
#include <malloc.h>
#include <xfuncs.h>
#include <asm/dma.h>
#ifndef dma_alloc
static inline void *dma_alloc(size_t size)
{
return xmalloc(size);
}
#endif
#ifndef dma_free
static inline void dma_free(void *mem)
{
free(mem);
}
#endif
#endif /* __DMA_H */