@@ -87,7 +87,6 @@ struct iommu_dma_cookie {
87
87
struct iommu_domain * fq_domain ;
88
88
/* Options for dma-iommu use */
89
89
struct iommu_dma_options options ;
90
- struct mutex mutex ;
91
90
};
92
91
93
92
static DEFINE_STATIC_KEY_FALSE (iommu_deferred_attach_enabled );
@@ -401,7 +400,6 @@ int iommu_get_dma_cookie(struct iommu_domain *domain)
401
400
if (!domain -> iova_cookie )
402
401
return - ENOMEM ;
403
402
404
- mutex_init (& domain -> iova_cookie -> mutex );
405
403
iommu_domain_set_sw_msi (domain , iommu_dma_sw_msi );
406
404
return 0 ;
407
405
}
@@ -709,23 +707,20 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, struct device *dev
709
707
domain -> geometry .aperture_start >> order );
710
708
711
709
/* start_pfn is always nonzero for an already-initialised domain */
712
- mutex_lock (& cookie -> mutex );
713
710
if (iovad -> start_pfn ) {
714
711
if (1UL << order != iovad -> granule ||
715
712
base_pfn != iovad -> start_pfn ) {
716
713
pr_warn ("Incompatible range for DMA domain\n" );
717
- ret = - EFAULT ;
718
- goto done_unlock ;
714
+ return - EFAULT ;
719
715
}
720
716
721
- ret = 0 ;
722
- goto done_unlock ;
717
+ return 0 ;
723
718
}
724
719
725
720
init_iova_domain (iovad , 1UL << order , base_pfn );
726
721
ret = iova_domain_init_rcaches (iovad );
727
722
if (ret )
728
- goto done_unlock ;
723
+ return ret ;
729
724
730
725
iommu_dma_init_options (& cookie -> options , dev );
731
726
@@ -734,11 +729,7 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, struct device *dev
734
729
(!device_iommu_capable (dev , IOMMU_CAP_DEFERRED_FLUSH ) || iommu_dma_init_fq (domain )))
735
730
domain -> type = IOMMU_DOMAIN_DMA ;
736
731
737
- ret = iova_reserve_iommu_regions (dev , domain );
738
-
739
- done_unlock :
740
- mutex_unlock (& cookie -> mutex );
741
- return ret ;
732
+ return iova_reserve_iommu_regions (dev , domain );
742
733
}
743
734
744
735
/**
0 commit comments