Skip to contentSkip to conversation

iommu/vt-d: unwrap __get_valid_domain_for_dev()

PATCH Applied Peter Xu 2 participants 2 messages May 22, 2017 – May 30, 2017 IOMMU

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 iommu/vt-d: unwrap __get_valid_domain_for_dev()

We do find_domain() in __get_valid_domain_for_dev(), while we do the same thing in get_valid_domain_for_dev(). No need to do it twice.

---
 drivers/iommu/intel-iommu.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/iommu/intel-iommu.c +2 -14
index fc2765c..cb96f1c 100644
@@ -2390,7 +2390,7 @@ static struct dmar_domain *find_domain(struct device *dev)
 
 	/* No lock here, assumes no domain exit in normal case */
 	info = dev->archdata.iommu;
-	if (info)
+	if (likely(info))
 		return info->domain;
 	return NULL;
 }
@@ -3478,7 +3478,7 @@ static unsigned long intel_alloc_iova(struct device *dev,
 	return iova_pfn;
 }
 
-static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
+static struct dmar_domain *get_valid_domain_for_dev(struct device *dev)
 {
 	struct dmar_domain *domain, *tmp;
 	struct dmar_rmrr_unit *rmrr;
@@ -3525,18 +3525,6 @@ static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
 	return domain;
 }
 
-static inline struct dmar_domain *get_valid_domain_for_dev(struct device *dev)
-{
-	struct device_domain_info *info;
-
-	/* No lock here, assumes no domain exit in normal case */
-	info = dev->archdata.iommu;
-	if (likely(info))
-		return info->domain;
-
-	return __get_valid_domain_for_dev(dev);
-}
-
 /* Check if the dev needs to go through non-identity map and unmap process.*/
 static int iommu_no_mapping(struct device *dev)
 {
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 7 lines · Peter Xu

We do find_domain() in __get_valid_domain_for_dev(), while we do the same thing in get_valid_domain_for_dev(). No need to do it twice.

---
 drivers/iommu/intel-iommu.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

Applied, thanks.