|
@@ -395,20 +395,15 @@ static int msm_iommu_add_device(struct device *dev)
|
|
|
struct msm_iommu_dev *iommu;
|
|
|
struct iommu_group *group;
|
|
|
unsigned long flags;
|
|
|
- int ret = 0;
|
|
|
|
|
|
spin_lock_irqsave(&msm_iommu_lock, flags);
|
|
|
-
|
|
|
iommu = find_iommu_for_dev(dev);
|
|
|
+ spin_unlock_irqrestore(&msm_iommu_lock, flags);
|
|
|
+
|
|
|
if (iommu)
|
|
|
iommu_device_link(&iommu->iommu, dev);
|
|
|
else
|
|
|
- ret = -ENODEV;
|
|
|
-
|
|
|
- spin_unlock_irqrestore(&msm_iommu_lock, flags);
|
|
|
-
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
+ return -ENODEV;
|
|
|
|
|
|
group = iommu_group_get_for_dev(dev);
|
|
|
if (IS_ERR(group))
|
|
@@ -425,13 +420,12 @@ static void msm_iommu_remove_device(struct device *dev)
|
|
|
unsigned long flags;
|
|
|
|
|
|
spin_lock_irqsave(&msm_iommu_lock, flags);
|
|
|
-
|
|
|
iommu = find_iommu_for_dev(dev);
|
|
|
+ spin_unlock_irqrestore(&msm_iommu_lock, flags);
|
|
|
+
|
|
|
if (iommu)
|
|
|
iommu_device_unlink(&iommu->iommu, dev);
|
|
|
|
|
|
- spin_unlock_irqrestore(&msm_iommu_lock, flags);
|
|
|
-
|
|
|
iommu_group_remove_device(dev);
|
|
|
}
|
|
|
|