[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1 3/3] xen/arm: smmu: Renaming struct iommu_domain *domain to, struct iommu_domain *iommu_domain
It is good for code readability as there are many structures ending with the name domain. Also a code like this one is now easy to understand with the rename old: dev_iommu_domain(dev) = domain; new: dev_iommu_domain(dev) = iommu_domain; Also in current code struct smmu_domain pointer variable name is always smmu_domain. The change is on the same lines Signed-off-by: Manish Jaggi <manish.jaggi@xxxxxxxxxxxxxxxxxx> --- xen/drivers/passthrough/arm/smmu.c | 86 +++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index fe0549e..1d294be 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -248,12 +248,12 @@ struct domain_iommu_info { * place. * */ struct device_iommu_info { - struct iommu_domain *domain; + struct iommu_domain *iommu_domain; struct iommu_group *group; };#define dev_archdata(dev) ((struct device_iommu_info *)dev->archdata.iommu) -#define dev_iommu_domain(dev) (dev_archdata(dev)->domain) +#define dev_iommu_domain(dev) (dev_archdata(dev)->iommu_domain) #define dev_iommu_group(dev) (dev_archdata(dev)->group)/* Xen: Dummy iommu_group */ @@ -916,8 +916,8 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) int flags, ret; u32 fsr, far, fsynr, resume; unsigned long iova; - struct iommu_domain *domain = dev; - struct arm_smmu_domain *smmu_domain = domain->priv; + struct iommu_domain *iommu_domain = dev; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv; struct arm_smmu_cfg *cfg = &smmu_domain->cfg; struct arm_smmu_device *smmu = smmu_domain->smmu; void __iomem *cb_base; @@ -943,7 +943,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) iova |= ((unsigned long)far << 32); #endif- if (!report_iommu_fault(domain, smmu->dev, iova, flags)) { + if (!report_iommu_fault(iommu_domain, smmu->dev, iova, flags)) { ret = IRQ_HANDLED; resume = RESUME_RETRY; } else { @@ -1205,12 +1205,12 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) writel_relaxed(reg, cb_base + ARM_SMMU_CB_SCTLR); }-static int arm_smmu_init_domain_context(struct iommu_domain *domain, +static int arm_smmu_init_domain_context(struct iommu_domain *iommu_domain, struct arm_smmu_device *smmu) { int irq, start, ret = 0; unsigned long flags; - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv; struct arm_smmu_cfg *cfg = &smmu_domain->cfg;spin_lock_irqsave(&smmu_domain->lock, flags); @@ -1278,7 +1278,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, - "arm-smmu-context-fault", domain); + "arm-smmu-context-fault", iommu_domain); if (IS_ERR_VALUE(ret)) { dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", cfg->irptndx, irq); @@ -1292,9 +1292,9 @@ out_unlock: return ret; }-static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) +static void arm_smmu_destroy_domain_context(struct iommu_domain *iommu_domain) { - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv; struct arm_smmu_device *smmu = smmu_domain->smmu; struct arm_smmu_cfg *cfg = &smmu_domain->cfg; void __iomem *cb_base; @@ -1310,13 +1310,13 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)if (cfg->irptndx != INVALID_IRPTNDX) { irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; - free_irq(irq, domain); + free_irq(irq, iommu_domain); }__arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx); }-static int arm_smmu_domain_init(struct iommu_domain *domain) +static int arm_smmu_domain_init(struct iommu_domain *iommu_domain) { struct arm_smmu_domain *smmu_domain;@@ -1330,7 +1330,7 @@ static int arm_smmu_domain_init(struct iommu_domain *domain) return -ENOMEM;spin_lock_init(&smmu_domain->lock); - domain->priv = smmu_domain; + iommu_domain->priv = smmu_domain; return 0; }@@ -1399,15 +1399,15 @@ static void arm_smmu_free_pgtables(struct arm_smmu_domain *smmu_domain) } #endif-static void arm_smmu_domain_destroy(struct iommu_domain *domain) +static void arm_smmu_domain_destroy(struct iommu_domain *iommu_domain) { - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv;/* * Free the domain resources. We assume that all devices have * already been detached. */ - arm_smmu_destroy_domain_context(domain); + arm_smmu_destroy_domain_context(iommu_domain); kfree(smmu_domain); }@@ -1536,10 +1536,10 @@ static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, arm_smmu_master_free_smrs(smmu, cfg); }-static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) +static int arm_smmu_attach_dev(struct iommu_domain *iommu_domain, struct device *dev) { int ret; - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv; struct arm_smmu_device *smmu, *dom_smmu; struct arm_smmu_master_cfg *cfg;@@ -1561,7 +1561,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) dom_smmu = ACCESS_ONCE(smmu_domain->smmu); if (!dom_smmu) { /* Now that we have a master, we can finalise the domain */ - ret = arm_smmu_init_domain_context(domain, smmu); + ret = arm_smmu_init_domain_context(iommu_domain, smmu); if (IS_ERR_VALUE(ret)) return ret;@@ -1583,13 +1583,13 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) ret = arm_smmu_domain_add_master(smmu_domain, cfg);if (!ret) - dev_iommu_domain(dev) = domain; + dev_iommu_domain(dev) = iommu_domain; return ret; }-static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) +static void arm_smmu_detach_dev(struct iommu_domain *iommu_domain, struct device *dev) { - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv; struct arm_smmu_master_cfg *cfg;cfg = find_smmu_master_cfg(dev); @@ -1838,10 +1838,10 @@ out_unlock: return ret; }-static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, +static int arm_smmu_map(struct iommu_domain *iommu_domain, unsigned long iova, phys_addr_t paddr, size_t size, int prot) { - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv;if (!smmu_domain) return -ENODEV; @@ -1849,25 +1849,25 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, return arm_smmu_handle_mapping(smmu_domain, iova, paddr, size, prot); }-static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, +static size_t arm_smmu_unmap(struct iommu_domain *iommu_domain, unsigned long iova, size_t size) { int ret; - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv;ret = arm_smmu_handle_mapping(smmu_domain, iova, 0, size, 0); arm_smmu_tlb_inv_context(smmu_domain); return ret ? 0 : size; }-static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, +static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *iommu_domain, dma_addr_t iova) { pgd_t *pgdp, pgd; pud_t pud; pmd_t pmd; pte_t pte; - struct arm_smmu_domain *smmu_domain = domain->priv; + struct arm_smmu_domain *smmu_domain = iommu_domain->priv; struct arm_smmu_cfg *cfg = &smmu_domain->cfg;pgdp = cfg->pgd; @@ -2567,7 +2567,7 @@ static void arm_smmu_iotlb_flush(struct domain *d, unsigned long gfn, static int arm_smmu_assign_dev(struct domain *d, u8 devfn, struct device *dev) { - struct iommu_domain *domain; + struct iommu_domain *iommu_domain; struct domain_iommu_info *domain_iommu_info; int ret;@@ -2590,55 +2590,55 @@ static int arm_smmu_assign_dev(struct domain *d, u8 devfn, * under the same SMMU as another device assigned to this domain. * Would it useful for PCI */ - domain = xzalloc(struct iommu_domain); - if (!domain) + iommu_domain = xzalloc(struct iommu_domain); + if (!iommu_domain) return -ENOMEM;- ret = arm_smmu_domain_init(domain); + ret = arm_smmu_domain_init(iommu_domain); if (ret) goto err_dom_init;- domain->priv->cfg.domain = d; + iommu_domain->priv->cfg.domain = d;- ret = arm_smmu_attach_dev(domain, dev); + ret = arm_smmu_attach_dev(iommu_domain, dev); if (ret) goto err_attach_dev;spin_lock(&domain_iommu_info->lock); /* Chain the new context to the domain */ - list_add(&domain->list, &domain_iommu_info->contexts); + list_add(&iommu_domain->list, &domain_iommu_info->contexts); spin_unlock(&domain_iommu_info->lock);return 0; err_attach_dev: - arm_smmu_domain_destroy(domain); + arm_smmu_domain_destroy(iommu_domain); err_dom_init: - xfree(domain); + xfree(iommu_domain);return ret; }static int arm_smmu_deassign_dev(struct domain *d, struct device *dev) { - struct iommu_domain *domain = dev_iommu_domain(dev); + struct iommu_domain *iommu_domain = dev_iommu_domain(dev); struct domain_iommu_info *domain_iommu_info;domain_iommu_info = domain_hvm_iommu(d)->arch.priv; - if (!domain || domain->priv->cfg.domain != d) { + if (!iommu_domain || iommu_domain->priv->cfg.domain != d) { dev_err(dev, " not attached to domain %d\n", d->domain_id); return -ESRCH; }- arm_smmu_detach_dev(domain, dev); + arm_smmu_detach_dev(iommu_domain, dev);spin_lock(&domain_iommu_info->lock); - list_del(&domain->list); + list_del(&iommu_domain->list); spin_unlock(&domain_iommu_info->lock);- arm_smmu_domain_destroy(domain); - xfree(domain); + arm_smmu_domain_destroy(iommu_domain); + xfree(iommu_domain);return 0; } -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |