summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2013-08-07 09:33:26 +0200
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:44:05 +0900
commit60aa0d84e76374a40a92773ad401736470caf8ec (patch)
treed777dc990ea169a67f0b36d49a7c0d47aa9716b6 /drivers/iommu
parent15257da1bf4e2b2e7f4ef7ef3083f02c12678504 (diff)
downloadlinux-3.10-60aa0d84e76374a40a92773ad401736470caf8ec.tar.gz
linux-3.10-60aa0d84e76374a40a92773ad401736470caf8ec.tar.bz2
linux-3.10-60aa0d84e76374a40a92773ad401736470caf8ec.zip
iommu/exynos: simplify some functions
Some functions are now called directly with all data structures available at caller, so simplify them and remove code extracting private structures. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/exynos-iommu.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 1af54964ddd..8b0471d26e6 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -515,39 +515,28 @@ int exynos_sysmmu_enable(struct device *dev, unsigned long pgtable)
return ret;
}
-static bool exynos_sysmmu_disable(struct device *dev)
+static bool exynos_sysmmu_disable(struct sysmmu_drvdata *data)
{
- struct device *sysmmu = dev->archdata.iommu;
- struct sysmmu_drvdata *data;
- bool disabled = true;
-
- if (WARN_ON(!sysmmu))
- return -ENODEV;
+ bool disabled = __sysmmu_disable(data);
- data = dev_get_drvdata(sysmmu);
-
- disabled = __sysmmu_disable(data);
if (disabled)
data->master = NULL;
return disabled;
}
-static void sysmmu_tlb_invalidate_entry(struct device *dev, unsigned long iova)
+static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
+ unsigned long iova)
{
- struct device *sysmmu = dev->archdata.iommu;
- struct sysmmu_drvdata *data;
unsigned long flags;
- data = dev_get_drvdata(sysmmu);
-
spin_lock_irqsave(&data->lock, flags);
if (is_sysmmu_active(data) && data->runtime_active) {
clk_enable(data->clk_master);
__sysmmu_tlb_invalidate_entry(data->sfrbase, iova);
clk_disable(data->clk_master);
} else {
- dev_dbg(dev,
+ dev_dbg(data->master,
"disabled. Skipping TLB invalidation @ %#lx\n", iova);
}
spin_unlock_irqrestore(&data->lock, flags);
@@ -755,7 +744,7 @@ static void exynos_iommu_domain_destroy(struct iommu_domain *domain)
spin_lock_irqsave(&priv->lock, flags);
list_for_each_entry(data, &priv->clients, node) {
- while (!exynos_sysmmu_disable(data->master))
+ while (!exynos_sysmmu_disable(data))
; /* until System MMU is actually disabled */
}
@@ -814,7 +803,7 @@ static void exynos_iommu_detach_device(struct iommu_domain *domain,
list_for_each_entry(data, &priv->clients, node) {
if (data->sysmmu == dev->archdata.iommu) {
- if (exynos_sysmmu_disable(dev))
+ if (exynos_sysmmu_disable(data))
list_del_init(&data->node);
break;
}
@@ -1010,7 +999,7 @@ done:
spin_lock_irqsave(&priv->lock, flags);
list_for_each_entry(data, &priv->clients, node)
- sysmmu_tlb_invalidate_entry(data->master, iova);
+ sysmmu_tlb_invalidate_entry(data, iova);
spin_unlock_irqrestore(&priv->lock, flags);
return size;