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

Commit 5657933d authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford
Browse files

treewide: Move dma_ops from struct dev_archdata into struct device



Some but not all architectures provide set_dma_ops(). Move dma_ops
from struct dev_archdata into struct device such that it becomes
possible on all architectures to configure dma_ops per device.

Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>
Cc: x86@kernel.org
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 5299709d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
#define ASMARM_DEVICE_H

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

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

@@ -34,7 +34,7 @@ static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline void set_dma_ops(struct device *dev, const struct dma_map_ops *ops)
{
	BUG_ON(!dev);
	dev->archdata.dma_ops = ops;
	dev->dma_ops = ops;
}

#define HAVE_ARCH_DMA_SUPPORTED 1
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
#define __ASM_DEVICE_H

struct dev_archdata {
	const struct dma_map_ops *dma_ops;
#ifdef CONFIG_IOMMU_API
	void *iommu;			/* private IOMMU data */
#endif
+2 −2
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ extern const struct dma_map_ops dummy_dma_ops;

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

	/*
	 * We expect no ISA devices, and all other DMA masters are expected to
+4 −4
Original line number Diff line number Diff line
@@ -837,7 +837,7 @@ static bool do_iommu_attach(struct device *dev, const struct iommu_ops *ops,
		return false;
	}

	dev->archdata.dma_ops = &iommu_dma_ops;
	dev->dma_ops = &iommu_dma_ops;
	return true;
}

@@ -941,7 +941,7 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,

void arch_teardown_dma_ops(struct device *dev)
{
	dev->archdata.dma_ops = NULL;
	dev->dma_ops = NULL;
}

#else
@@ -955,8 +955,8 @@ static void __iommu_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)
{
	if (!dev->archdata.dma_ops)
		dev->archdata.dma_ops = &swiotlb_dma_ops;
	if (!dev->dma_ops)
		dev->dma_ops = &swiotlb_dma_ops;

	dev->archdata.dma_coherent = coherent;
	__iommu_setup_dma_ops(dev, dma_base, size, iommu);
Loading