Skip to content

Commit

Permalink
iommu/vt-d: Move deferred device attachment into helper function
Browse files Browse the repository at this point in the history
Move the code that does the deferred device attachment into a separate
helper function.

Fixes: 1ee0186 ("iommu/vt-d: Refactor find_domain() helper")
Cc: stable@vger.kernel.org # v5.5
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
joergroedel committed Feb 18, 2020
1 parent 1d46159 commit 034d98c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2529,16 +2529,20 @@ struct dmar_domain *find_domain(struct device *dev)
return NULL;
}

static struct dmar_domain *deferred_attach_domain(struct device *dev)
static void do_deferred_attach(struct device *dev)
{
if (unlikely(attach_deferred(dev))) {
struct iommu_domain *domain;
struct iommu_domain *domain;

dev->archdata.iommu = NULL;
domain = iommu_get_domain_for_dev(dev);
if (domain)
intel_iommu_attach_device(domain, dev);
}
dev->archdata.iommu = NULL;
domain = iommu_get_domain_for_dev(dev);
if (domain)
intel_iommu_attach_device(domain, dev);
}

static struct dmar_domain *deferred_attach_domain(struct device *dev)
{
if (unlikely(attach_deferred(dev)))
do_deferred_attach(dev);

return find_domain(dev);
}
Expand Down

0 comments on commit 034d98c

Please sign in to comment.