aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2014-10-22 18:22:19 -0400
committerJoerg Roedel <jroedel@suse.de>2014-10-23 08:32:25 -0400
commit2088ecba93f68252464b95375d80a12fe723ba5e (patch)
tree7bda9073a94f94caadcb72c92169fc5c1599e0dc
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
iommu/omap: Remove refcount field from omap_iommu object
The refcount field in omap_iommu object is primarily used to check if an IOMMU device has already been enabled, but this is already implicit in the omap_iommu_attach_dev() which ensures that only a single device can attach to an IOMMU. This field is redundant, and so has been cleaned up. Signed-off-by: Suman Anna <s-anna@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/omap-iommu.c15
-rw-r--r--drivers/iommu/omap-iommu.h1
2 files changed, 3 insertions, 13 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 36278870e84a..ea04e4d30bbf 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -819,8 +819,9 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
819 u32 *iopgd, *iopte; 819 u32 *iopgd, *iopte;
820 struct omap_iommu *obj = data; 820 struct omap_iommu *obj = data;
821 struct iommu_domain *domain = obj->domain; 821 struct iommu_domain *domain = obj->domain;
822 struct omap_iommu_domain *omap_domain = domain->priv;
822 823
823 if (!obj->refcount) 824 if (!omap_domain->iommu_dev)
824 return IRQ_NONE; 825 return IRQ_NONE;
825 826
826 errs = iommu_report_fault(obj, &da); 827 errs = iommu_report_fault(obj, &da);
@@ -880,13 +881,6 @@ static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd)
880 881
881 spin_lock(&obj->iommu_lock); 882 spin_lock(&obj->iommu_lock);
882 883
883 /* an iommu device can only be attached once */
884 if (++obj->refcount > 1) {
885 dev_err(dev, "%s: already attached!\n", obj->name);
886 err = -EBUSY;
887 goto err_enable;
888 }
889
890 obj->iopgd = iopgd; 884 obj->iopgd = iopgd;
891 err = iommu_enable(obj); 885 err = iommu_enable(obj);
892 if (err) 886 if (err)
@@ -899,7 +893,6 @@ static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd)
899 return obj; 893 return obj;
900 894
901err_enable: 895err_enable:
902 obj->refcount--;
903 spin_unlock(&obj->iommu_lock); 896 spin_unlock(&obj->iommu_lock);
904 return ERR_PTR(err); 897 return ERR_PTR(err);
905} 898}
@@ -915,9 +908,7 @@ static void omap_iommu_detach(struct omap_iommu *obj)
915 908
916 spin_lock(&obj->iommu_lock); 909 spin_lock(&obj->iommu_lock);
917 910
918 if (--obj->refcount == 0) 911 iommu_disable(obj);
919 iommu_disable(obj);
920
921 obj->iopgd = NULL; 912 obj->iopgd = NULL;
922 913
923 spin_unlock(&obj->iommu_lock); 914 spin_unlock(&obj->iommu_lock);
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index 4f1b68c08c15..5c1400024e35 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -33,7 +33,6 @@ struct omap_iommu {
33 void *isr_priv; 33 void *isr_priv;
34 struct iommu_domain *domain; 34 struct iommu_domain *domain;
35 35
36 unsigned int refcount;
37 spinlock_t iommu_lock; /* global for this whole object */ 36 spinlock_t iommu_lock; /* global for this whole object */
38 37
39 /* 38 /*