mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 16:12:52 +00:00
cc2caea5b6
dev_set_cma_area incorrectly assigned cma to global area on first call due to incorrect check. This patch fixes this issue. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
29 lines
526 B
C
29 lines
526 B
C
#ifndef ASM_DMA_CONTIGUOUS_H
|
|
#define ASM_DMA_CONTIGUOUS_H
|
|
|
|
#ifdef __KERNEL__
|
|
#ifdef CONFIG_CMA
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/dma-contiguous.h>
|
|
|
|
static inline struct cma *dev_get_cma_area(struct device *dev)
|
|
{
|
|
if (dev && dev->cma_area)
|
|
return dev->cma_area;
|
|
return dma_contiguous_default_area;
|
|
}
|
|
|
|
static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
|
|
{
|
|
if (dev)
|
|
dev->cma_area = cma;
|
|
if (!dev && !dma_contiguous_default_area)
|
|
dma_contiguous_default_area = cma;
|
|
}
|
|
|
|
#endif
|
|
#endif
|
|
|
|
#endif
|