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

Commit 481931f8 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dma: fix arguments when calling dma APIs" into msm-4.9

parents a9323c4c bc1b0007
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -7,7 +7,7 @@
#define ASMARM_DEVICE_H
#define ASMARM_DEVICE_H


struct dev_archdata {
struct dev_archdata {
	struct dma_map_ops	*dma_ops;
	const struct dma_map_ops	*dma_ops;
#ifdef CONFIG_DMABOUNCE
#ifdef CONFIG_DMABOUNCE
	struct dmabounce_device_info *dmabounce;
	struct dmabounce_device_info *dmabounce;
#endif
#endif
+4 −3
Original line number Original line Diff line number Diff line
@@ -16,14 +16,14 @@
extern struct dma_map_ops arm_dma_ops;
extern struct dma_map_ops arm_dma_ops;
extern struct dma_map_ops arm_coherent_dma_ops;
extern struct dma_map_ops arm_coherent_dma_ops;


static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
{
{
	if (dev && dev->archdata.dma_ops)
	if (dev && dev->archdata.dma_ops)
		return dev->archdata.dma_ops;
		return dev->archdata.dma_ops;
	return &arm_dma_ops;
	return &arm_dma_ops;
}
}


static inline struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
{
{
	if (xen_initial_domain())
	if (xen_initial_domain())
		return xen_dma_ops;
		return xen_dma_ops;
@@ -31,7 +31,8 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
		return __generic_dma_ops(dev);
		return __generic_dma_ops(dev);
}
}


static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
static inline void set_dma_ops(struct device *dev,
				const struct dma_map_ops *ops)
{
{
	BUG_ON(!dev);
	BUG_ON(!dev);
	dev->archdata.dma_ops = ops;
	dev->archdata.dma_ops = ops;
+10 −10
Original line number Original line Diff line number Diff line
@@ -372,7 +372,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot,
static void __dma_free_remap(void *cpu_addr, size_t size)
static void __dma_free_remap(void *cpu_addr, size_t size)
{
{
	dma_common_free_remap(cpu_addr, size,
	dma_common_free_remap(cpu_addr, size,
			VM_ARM_DMA_CONSISTENT | VM_USERMAP);
			VM_ARM_DMA_CONSISTENT | VM_USERMAP, false);
}
}


#define DEFAULT_DMA_COHERENT_POOL_SIZE	SZ_256K
#define DEFAULT_DMA_COHERENT_POOL_SIZE	SZ_256K
@@ -1068,7 +1068,7 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
int arm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
int arm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
		enum dma_data_direction dir, unsigned long attrs)
		enum dma_data_direction dir, unsigned long attrs)
{
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	const struct dma_map_ops *ops = get_dma_ops(dev);
	struct scatterlist *s;
	struct scatterlist *s;
	int i, j;
	int i, j;


@@ -1102,7 +1102,7 @@ int arm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
		enum dma_data_direction dir, unsigned long attrs)
		enum dma_data_direction dir, unsigned long attrs)
{
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	const struct dma_map_ops *ops = get_dma_ops(dev);
	struct scatterlist *s;
	struct scatterlist *s;


	int i;
	int i;
@@ -1121,7 +1121,7 @@ void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
			int nents, enum dma_data_direction dir)
			int nents, enum dma_data_direction dir)
{
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	const struct dma_map_ops *ops = get_dma_ops(dev);
	struct scatterlist *s;
	struct scatterlist *s;
	int i;
	int i;


@@ -1140,7 +1140,7 @@ void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
			int nents, enum dma_data_direction dir)
			int nents, enum dma_data_direction dir)
{
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	const struct dma_map_ops *ops = get_dma_ops(dev);
	struct scatterlist *s;
	struct scatterlist *s;
	int i;
	int i;


@@ -1640,7 +1640,7 @@ void __arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,


	if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0) {
	if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0) {
		dma_common_free_remap(cpu_addr, size,
		dma_common_free_remap(cpu_addr, size,
			VM_ARM_DMA_CONSISTENT | VM_USERMAP);
			VM_ARM_DMA_CONSISTENT | VM_USERMAP, false);
	}
	}


	__iommu_remove_mapping(dev, handle, size);
	__iommu_remove_mapping(dev, handle, size);
@@ -2100,7 +2100,7 @@ static void arm_iommu_sync_single_for_device(struct device *dev,
	__dma_page_cpu_to_dev(page, offset, size, dir);
	__dma_page_cpu_to_dev(page, offset, size, dir);
}
}


struct dma_map_ops iommu_ops = {
const struct dma_map_ops iommu_ops = {
	.alloc		= arm_iommu_alloc_attrs,
	.alloc		= arm_iommu_alloc_attrs,
	.free		= arm_iommu_free_attrs,
	.free		= arm_iommu_free_attrs,
	.mmap		= arm_iommu_mmap_attrs,
	.mmap		= arm_iommu_mmap_attrs,
@@ -2120,7 +2120,7 @@ struct dma_map_ops iommu_ops = {
	.unmap_resource		= arm_iommu_unmap_resource,
	.unmap_resource		= arm_iommu_unmap_resource,
};
};


struct dma_map_ops iommu_coherent_ops = {
const struct dma_map_ops iommu_coherent_ops = {
	.alloc		= arm_coherent_iommu_alloc_attrs,
	.alloc		= arm_coherent_iommu_alloc_attrs,
	.free		= arm_coherent_iommu_free_attrs,
	.free		= arm_coherent_iommu_free_attrs,
	.mmap		= arm_coherent_iommu_mmap_attrs,
	.mmap		= arm_coherent_iommu_mmap_attrs,
@@ -2323,7 +2323,7 @@ void arm_iommu_detach_device(struct device *dev)
}
}
EXPORT_SYMBOL_GPL(arm_iommu_detach_device);
EXPORT_SYMBOL_GPL(arm_iommu_detach_device);


static struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent)
static const struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent)
{
{
	return coherent ? &iommu_coherent_ops : &iommu_ops;
	return coherent ? &iommu_coherent_ops : &iommu_ops;
}
}
@@ -2386,7 +2386,7 @@ static struct dma_map_ops *arm_get_dma_map_ops(bool coherent)
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
			const struct iommu_ops *iommu, bool coherent)
			const struct iommu_ops *iommu, bool coherent)
{
{
	struct dma_map_ops *dma_ops;
	const struct dma_map_ops *dma_ops;


	dev->archdata.dma_coherent = coherent;
	dev->archdata.dma_coherent = coherent;
	if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu))
	if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu))