Skip to content

Commit d0f6f58

Browse files
committed
iommu: Remove iommu_register_instance interface
And also move its remaining functionality to iommu_device_register() and 'struct iommu_device'. Cc: Rob Herring <robh+dt@kernel.org> Cc: Frank Rowand <frowand.list@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: devicetree@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent d2c302b commit d0f6f58

File tree

8 files changed

+6
-52
lines changed

8 files changed

+6
-52
lines changed

drivers/iommu/arm-smmu-v3.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,8 +2702,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
27022702

27032703
ret = iommu_device_register(&smmu->iommu);
27042704

2705-
iommu_register_instance(dev->fwnode, &arm_smmu_ops);
2706-
27072705
#ifdef CONFIG_PCI
27082706
if (pci_bus_type.iommu_ops != &arm_smmu_ops) {
27092707
pci_request_acs();

drivers/iommu/arm-smmu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
21212121
return err;
21222122
}
21232123

2124-
iommu_register_instance(dev->fwnode, &arm_smmu_ops);
21252124
platform_set_drvdata(pdev, smmu);
21262125
arm_smmu_device_reset(smmu);
21272126

drivers/iommu/exynos-iommu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,6 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev)
642642

643643
pm_runtime_enable(dev);
644644

645-
of_iommu_set_ops(dev->of_node, &exynos_iommu_ops);
646-
647645
return 0;
648646
}
649647

drivers/iommu/iommu.c

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,43 +1658,18 @@ int iommu_request_dm_for_dev(struct device *dev)
16581658
return ret;
16591659
}
16601660

1661-
struct iommu_instance {
1662-
struct list_head list;
1663-
struct fwnode_handle *fwnode;
1664-
const struct iommu_ops *ops;
1665-
};
1666-
static LIST_HEAD(iommu_instance_list);
1667-
static DEFINE_SPINLOCK(iommu_instance_lock);
1668-
1669-
void iommu_register_instance(struct fwnode_handle *fwnode,
1670-
const struct iommu_ops *ops)
1671-
{
1672-
struct iommu_instance *iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
1673-
1674-
if (WARN_ON(!iommu))
1675-
return;
1676-
1677-
of_node_get(to_of_node(fwnode));
1678-
INIT_LIST_HEAD(&iommu->list);
1679-
iommu->fwnode = fwnode;
1680-
iommu->ops = ops;
1681-
spin_lock(&iommu_instance_lock);
1682-
list_add_tail(&iommu->list, &iommu_instance_list);
1683-
spin_unlock(&iommu_instance_lock);
1684-
}
1685-
16861661
const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
16871662
{
1688-
struct iommu_instance *instance;
16891663
const struct iommu_ops *ops = NULL;
1664+
struct iommu_device *iommu;
16901665

1691-
spin_lock(&iommu_instance_lock);
1692-
list_for_each_entry(instance, &iommu_instance_list, list)
1693-
if (instance->fwnode == fwnode) {
1694-
ops = instance->ops;
1666+
spin_lock(&iommu_device_lock);
1667+
list_for_each_entry(iommu, &iommu_device_list, list)
1668+
if (iommu->fwnode == fwnode) {
1669+
ops = iommu->ops;
16951670
break;
16961671
}
1697-
spin_unlock(&iommu_instance_lock);
1672+
spin_unlock(&iommu_device_lock);
16981673
return ops;
16991674
}
17001675

drivers/iommu/msm_iommu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,6 @@ static int msm_iommu_probe(struct platform_device *pdev)
810810
goto fail;
811811
}
812812

813-
of_iommu_set_ops(pdev->dev.of_node, &msm_iommu_ops);
814-
815813
pr_info("device mapped at %p, irq %d with %d ctx banks\n",
816814
iommu->base, iommu->irq, iommu->ncb);
817815

drivers/iommu/mtk_iommu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,6 @@ static int mtk_iommu_init_fn(struct device_node *np)
681681
return ret;
682682
}
683683

684-
of_iommu_set_ops(np, &mtk_iommu_ops);
685684
return 0;
686685
}
687686

include/linux/iommu.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
382382
const struct iommu_ops *ops);
383383
void iommu_fwspec_free(struct device *dev);
384384
int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids);
385-
void iommu_register_instance(struct fwnode_handle *fwnode,
386-
const struct iommu_ops *ops);
387385
const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode);
388386

389387
#else /* CONFIG_IOMMU_API */
@@ -634,11 +632,6 @@ static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
634632
return -ENODEV;
635633
}
636634

637-
static inline void iommu_register_instance(struct fwnode_handle *fwnode,
638-
const struct iommu_ops *ops)
639-
{
640-
}
641-
642635
static inline
643636
const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
644637
{

include/linux/of_iommu.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
3131

3232
#endif /* CONFIG_OF_IOMMU */
3333

34-
static inline void of_iommu_set_ops(struct device_node *np,
35-
const struct iommu_ops *ops)
36-
{
37-
iommu_register_instance(&np->fwnode, ops);
38-
}
39-
4034
static inline const struct iommu_ops *of_iommu_get_ops(struct device_node *np)
4135
{
4236
return iommu_ops_from_fwnode(&np->fwnode);

0 commit comments

Comments
 (0)