Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d9b2f6e authored by Patrick Daly's avatar Patrick Daly Committed by Gerrit - the friendly Code Review server
Browse files

iommu: Fix compilation errors without CONFIG_IOMMU_API



Move code into appropriate #ifdef, and add an "inline" so the compiler no
longer gives a defined-but-not-used warning.

Change-Id: I226242bf994e659d8018a885f20c3a3f80b9b8e5
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 4d6c1487
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -52,19 +52,6 @@ static pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot,
	return prot;
}

static int __get_iommu_pgprot(unsigned long attrs, int prot,
			      bool coherent)
{
	if (!(attrs & DMA_ATTR_EXEC_MAPPING))
		prot |= IOMMU_NOEXEC;
	if (attrs & DMA_ATTR_IOMMU_USE_UPSTREAM_HINT)
		prot |= IOMMU_USE_UPSTREAM_HINT;
	if (coherent)
		prot |= IOMMU_CACHE;

	return prot;
}

static struct gen_pool *atomic_pool;
#define NO_KERNEL_MAPPING_DUMMY 0x2222
#define DEFAULT_DMA_COHERENT_POOL_SIZE  SZ_256K
@@ -1110,6 +1097,19 @@ EXPORT_SYMBOL(arch_setup_dma_ops);

#ifdef CONFIG_ARM64_DMA_USE_IOMMU

static int __get_iommu_pgprot(unsigned long attrs, int prot,
			      bool coherent)
{
	if (!(attrs & DMA_ATTR_EXEC_MAPPING))
		prot |= IOMMU_NOEXEC;
	if (attrs & DMA_ATTR_IOMMU_USE_UPSTREAM_HINT)
		prot |= IOMMU_USE_UPSTREAM_HINT;
	if (coherent)
		prot |= IOMMU_CACHE;

	return prot;
}

/*
 * Make an area consistent for devices.
 * Note: Drivers should NOT use this function directly, as it will break
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#include <linux/iommu.h>
#include <linux/io-pgtable-fast.h>

struct dma_iommu_mapping;

struct dma_fast_smmu_mapping {
	struct device		*dev;
	struct iommu_domain	*domain;
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ static inline void msm_dma_unmap_sg(struct device *dev,
{
}

int msm_dma_unmap_all_for_dev(struct device *dev)
static inline int msm_dma_unmap_all_for_dev(struct device *dev)
{
	return 0;
}