Commit 034d98cc authored by Joerg Roedel's avatar Joerg Roedel

iommu/vt-d: Move deferred device attachment into helper function

Move the code that does the deferred device attachment into a separate
helper function.

Fixes: 1ee0186b ("iommu/vt-d: Refactor find_domain() helper")
Cc: stable@vger.kernel.org # v5.5
Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Acked-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 1d461597
...@@ -2529,16 +2529,20 @@ struct dmar_domain *find_domain(struct device *dev) ...@@ -2529,16 +2529,20 @@ struct dmar_domain *find_domain(struct device *dev)
return NULL; 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; dev->archdata.iommu = NULL;
domain = iommu_get_domain_for_dev(dev); domain = iommu_get_domain_for_dev(dev);
if (domain) if (domain)
intel_iommu_attach_device(domain, dev); 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); return find_domain(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment