Skip to content

Commit 2f74198

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Replace iommu_group_do_dma_first_attach with __iommu_device_set_domain
Since __iommu_device_set_domain() now knows how to handle deferred attach we can just call it directly from the only call site. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/8-v5-1b99ae392328+44574-iommu_err_unwind_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 0046a43 commit 2f74198

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

drivers/iommu/iommu.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ enum {
106106
IOMMU_SET_DOMAIN_MUST_SUCCEED = 1 << 0,
107107
};
108108

109+
static int __iommu_device_set_domain(struct iommu_group *group,
110+
struct device *dev,
111+
struct iommu_domain *new_domain,
112+
unsigned int flags);
109113
static int __iommu_group_set_domain_internal(struct iommu_group *group,
110114
struct iommu_domain *new_domain,
111115
unsigned int flags);
@@ -401,17 +405,6 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
401405
return ret;
402406
}
403407

404-
static int iommu_group_do_dma_first_attach(struct device *dev, void *data)
405-
{
406-
struct iommu_domain *domain = data;
407-
408-
lockdep_assert_held(&dev->iommu_group->mutex);
409-
410-
if (dev->iommu->attach_deferred)
411-
return 0;
412-
return __iommu_attach_device(domain, dev);
413-
}
414-
415408
int iommu_probe_device(struct device *dev)
416409
{
417410
const struct iommu_ops *ops;
@@ -442,7 +435,7 @@ int iommu_probe_device(struct device *dev)
442435
* attach the default domain.
443436
*/
444437
if (group->default_domain && !group->owner) {
445-
ret = iommu_group_do_dma_first_attach(dev, group->default_domain);
438+
ret = __iommu_device_set_domain(group, dev, group->domain, 0);
446439
if (ret) {
447440
mutex_unlock(&group->mutex);
448441
iommu_group_put(group);

0 commit comments

Comments
 (0)