2020-02-17 19:43:10

by Joerg Roedel

[permalink] [raw]
Subject: [PATCH 2/5] iommu/vt-d: Move deferred device attachment into helper function

From: Joerg Roedel <[email protected]>

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

Signed-off-by: Joerg Roedel <[email protected]>
---
drivers/iommu/intel-iommu.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 80f2332a5466..42cdcce1602e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -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);
}
--
2.17.1


2020-02-17 19:55:19

by Jerry Snitselaar

[permalink] [raw]
Subject: Re: [PATCH 2/5] iommu/vt-d: Move deferred device attachment into helper function

On Mon Feb 17 20, Joerg Roedel wrote:
>From: Joerg Roedel <[email protected]>
>
>Move the code that does the deferred device attachment into a separate
>helper function.
>
>Signed-off-by: Joerg Roedel <[email protected]>

Reviewed-by: Jerry Snitselaar <[email protected]>

2020-02-18 17:16:44

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 2/5] iommu/vt-d: Move deferred device attachment into helper function

> +static void do_deferred_attach(struct device *dev)
> {
> + struct iommu_domain *domain;
>
> + 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);
> }

Can we start using proper sybmbol prefixes and avoid do_* names where
possible?