提交 b0d4c861 编写于 作者: M Marek Szyprowski 提交者: Joerg Roedel

iommu/exynos: Remove dead code

__sysmmu_enable/disable functions were designed to do ref-count based
operations, but current code always calls them only once, so the code for
checking the conditions and invalid conditions can be simply removed
without any influence to the driver operation.
Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
上级 e7689f0d
...@@ -491,9 +491,6 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) ...@@ -491,9 +491,6 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data)
__sysmmu_disable_nocount(data); __sysmmu_disable_nocount(data);
dev_dbg(data->sysmmu, "Disabled\n"); dev_dbg(data->sysmmu, "Disabled\n");
} else {
dev_dbg(data->sysmmu, "%d times left to disable\n",
data->activations);
} }
spin_unlock_irqrestore(&data->lock, flags); spin_unlock_irqrestore(&data->lock, flags);
...@@ -541,29 +538,18 @@ static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data) ...@@ -541,29 +538,18 @@ static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data)
static int __sysmmu_enable(struct sysmmu_drvdata *data, phys_addr_t pgtable, static int __sysmmu_enable(struct sysmmu_drvdata *data, phys_addr_t pgtable,
struct exynos_iommu_domain *domain) struct exynos_iommu_domain *domain)
{ {
int ret = 0;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&data->lock, flags); spin_lock_irqsave(&data->lock, flags);
if (set_sysmmu_active(data)) { if (set_sysmmu_active(data)) {
data->pgtable = pgtable; data->pgtable = pgtable;
data->domain = domain; data->domain = domain;
__sysmmu_enable_nocount(data); __sysmmu_enable_nocount(data);
dev_dbg(data->sysmmu, "Enabled\n"); dev_dbg(data->sysmmu, "Enabled\n");
} else {
ret = (pgtable == data->pgtable) ? 1 : -EBUSY;
dev_dbg(data->sysmmu, "already enabled\n");
} }
if (WARN_ON(ret < 0))
set_sysmmu_inactive(data); /* decrement count */
spin_unlock_irqrestore(&data->lock, flags); spin_unlock_irqrestore(&data->lock, flags);
return ret; return 0;
} }
static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data, static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data,
...@@ -831,8 +817,8 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain) ...@@ -831,8 +817,8 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
spin_lock_irqsave(&domain->lock, flags); spin_lock_irqsave(&domain->lock, flags);
list_for_each_entry_safe(data, next, &domain->clients, domain_node) { list_for_each_entry_safe(data, next, &domain->clients, domain_node) {
if (__sysmmu_disable(data)) __sysmmu_disable(data);
data->master = NULL; data->master = NULL;
list_del_init(&data->domain_node); list_del_init(&data->domain_node);
} }
...@@ -867,31 +853,23 @@ static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain, ...@@ -867,31 +853,23 @@ static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain,
phys_addr_t pagetable = virt_to_phys(domain->pgtable); phys_addr_t pagetable = virt_to_phys(domain->pgtable);
struct sysmmu_drvdata *data, *next; struct sysmmu_drvdata *data, *next;
unsigned long flags; unsigned long flags;
bool found = false;
if (!has_sysmmu(dev) || owner->domain != iommu_domain) if (!has_sysmmu(dev) || owner->domain != iommu_domain)
return; return;
spin_lock_irqsave(&domain->lock, flags); spin_lock_irqsave(&domain->lock, flags);
list_for_each_entry_safe(data, next, &domain->clients, domain_node) { list_for_each_entry_safe(data, next, &domain->clients, domain_node) {
if (data->master == dev) { __sysmmu_disable(data);
if (__sysmmu_disable(data)) { data->master = NULL;
data->master = NULL; list_del_init(&data->domain_node);
list_del_init(&data->domain_node); pm_runtime_put(data->sysmmu);
}
pm_runtime_put(data->sysmmu);
found = true;
}
} }
spin_unlock_irqrestore(&domain->lock, flags); spin_unlock_irqrestore(&domain->lock, flags);
owner->domain = NULL; owner->domain = NULL;
if (found) dev_dbg(dev, "%s: Detached IOMMU with pgtable %pa\n", __func__,
dev_dbg(dev, "%s: Detached IOMMU with pgtable %pa\n", &pagetable);
__func__, &pagetable);
else
dev_err(dev, "%s: No IOMMU is attached\n", __func__);
} }
static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain, static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain,
...@@ -902,7 +880,6 @@ static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain, ...@@ -902,7 +880,6 @@ static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain,
struct sysmmu_drvdata *data; struct sysmmu_drvdata *data;
phys_addr_t pagetable = virt_to_phys(domain->pgtable); phys_addr_t pagetable = virt_to_phys(domain->pgtable);
unsigned long flags; unsigned long flags;
int ret = -ENODEV;
if (!has_sysmmu(dev)) if (!has_sysmmu(dev))
return -ENODEV; return -ENODEV;
...@@ -912,27 +889,19 @@ static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain, ...@@ -912,27 +889,19 @@ static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain,
list_for_each_entry(data, &owner->controllers, owner_node) { list_for_each_entry(data, &owner->controllers, owner_node) {
pm_runtime_get_sync(data->sysmmu); pm_runtime_get_sync(data->sysmmu);
ret = __sysmmu_enable(data, pagetable, domain); __sysmmu_enable(data, pagetable, domain);
if (ret >= 0) { data->master = dev;
data->master = dev;
spin_lock_irqsave(&domain->lock, flags); spin_lock_irqsave(&domain->lock, flags);
list_add_tail(&data->domain_node, &domain->clients); list_add_tail(&data->domain_node, &domain->clients);
spin_unlock_irqrestore(&domain->lock, flags); spin_unlock_irqrestore(&domain->lock, flags);
}
}
if (ret < 0) {
dev_err(dev, "%s: Failed to attach IOMMU with pgtable %pa\n",
__func__, &pagetable);
return ret;
} }
owner->domain = iommu_domain; owner->domain = iommu_domain;
dev_dbg(dev, "%s: Attached IOMMU with pgtable %pa %s\n", dev_dbg(dev, "%s: Attached IOMMU with pgtable %pa\n", __func__,
__func__, &pagetable, (ret == 0) ? "" : ", again"); &pagetable);
return ret; return 0;
} }
static sysmmu_pte_t *alloc_lv2entry(struct exynos_iommu_domain *domain, static sysmmu_pte_t *alloc_lv2entry(struct exynos_iommu_domain *domain,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册