{
        u32 fsr, fsynr, cbfrsynra;
        unsigned long iova;
-       struct iommu_domain *domain = dev;
-       struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
+       struct arm_smmu_domain *smmu_domain = dev;
        struct arm_smmu_device *smmu = smmu_domain->smmu;
        int idx = smmu_domain->cfg.cbndx;
        int ret;
        iova = arm_smmu_cb_readq(smmu, idx, ARM_SMMU_CB_FAR);
        cbfrsynra = arm_smmu_gr1_read(smmu, ARM_SMMU_GR1_CBFRSYNRA(idx));
 
-       ret = report_iommu_fault(domain, NULL, iova,
+       ret = report_iommu_fault(&smmu_domain->domain, NULL, iova,
                fsynr & ARM_SMMU_FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ);
 
        if (ret == -ENOSYS)
        return __arm_smmu_alloc_bitmap(smmu->context_map, start, smmu->num_context_banks);
 }
 
-static int arm_smmu_init_domain_context(struct iommu_domain *domain,
+static int arm_smmu_init_domain_context(struct arm_smmu_domain *smmu_domain,
                                        struct arm_smmu_device *smmu,
                                        struct device *dev)
 {
        struct io_pgtable_ops *pgtbl_ops;
        struct io_pgtable_cfg pgtbl_cfg;
        enum io_pgtable_fmt fmt;
-       struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
+       struct iommu_domain *domain = &smmu_domain->domain;
        struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
        irqreturn_t (*context_fault)(int irq, void *dev);
 
        else
                context_fault = arm_smmu_context_fault;
 
-       ret = devm_request_irq(smmu->dev, irq, context_fault,
-                              IRQF_SHARED, "arm-smmu-context-fault", domain);
+       ret = devm_request_irq(smmu->dev, irq, context_fault, IRQF_SHARED,
+                              "arm-smmu-context-fault", smmu_domain);
        if (ret < 0) {
                dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n",
                        cfg->irptndx, irq);
        return ret;
 }
 
-static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)
+static void arm_smmu_destroy_domain_context(struct arm_smmu_domain *smmu_domain)
 {
-       struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
        struct arm_smmu_device *smmu = smmu_domain->smmu;
        struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
        int ret, irq;
 
        if (cfg->irptndx != ARM_SMMU_INVALID_IRPTNDX) {
                irq = smmu->irqs[cfg->irptndx];
-               devm_free_irq(smmu->dev, irq, domain);
+               devm_free_irq(smmu->dev, irq, smmu_domain);
        }
 
        free_io_pgtable_ops(smmu_domain->pgtbl_ops);
         * Free the domain resources. We assume that all devices have
         * already been detached.
         */
-       arm_smmu_destroy_domain_context(domain);
+       arm_smmu_destroy_domain_context(smmu_domain);
        kfree(smmu_domain);
 }
 
                return ret;
 
        /* Ensure that the domain is finalised */
-       ret = arm_smmu_init_domain_context(domain, smmu, dev);
+       ret = arm_smmu_init_domain_context(smmu_domain, smmu, dev);
        if (ret < 0)
                goto rpm_put;