diff options
author | Joerg Roedel <jroedel@suse.de> | 2017-02-02 06:19:12 -0500 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2017-02-10 08:54:37 -0500 |
commit | d0f6f5832603931b0a8da044fb9abe8289e201ee (patch) | |
tree | 3e461c39cf3666d42aa6eaed9a6605f6023ae475 | |
parent | d2c302b6e8b1a5c0735b59d63075132bae9c52ac (diff) |
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>
-rw-r--r-- | drivers/iommu/arm-smmu-v3.c | 2 | ||||
-rw-r--r-- | drivers/iommu/arm-smmu.c | 1 | ||||
-rw-r--r-- | drivers/iommu/exynos-iommu.c | 2 | ||||
-rw-r--r-- | drivers/iommu/iommu.c | 37 | ||||
-rw-r--r-- | drivers/iommu/msm_iommu.c | 2 | ||||
-rw-r--r-- | drivers/iommu/mtk_iommu.c | 1 | ||||
-rw-r--r-- | include/linux/iommu.h | 7 | ||||
-rw-r--r-- | include/linux/of_iommu.h | 6 |
8 files changed, 6 insertions, 52 deletions
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 32133e289ff6..53751379dee3 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
@@ -2702,8 +2702,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev) | |||
2702 | 2702 | ||
2703 | ret = iommu_device_register(&smmu->iommu); | 2703 | ret = iommu_device_register(&smmu->iommu); |
2704 | 2704 | ||
2705 | iommu_register_instance(dev->fwnode, &arm_smmu_ops); | ||
2706 | |||
2707 | #ifdef CONFIG_PCI | 2705 | #ifdef CONFIG_PCI |
2708 | if (pci_bus_type.iommu_ops != &arm_smmu_ops) { | 2706 | if (pci_bus_type.iommu_ops != &arm_smmu_ops) { |
2709 | pci_request_acs(); | 2707 | pci_request_acs(); |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f4ce1e77344e..8fb4af2dfbfa 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -2121,7 +2121,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev) | |||
2121 | return err; | 2121 | return err; |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | iommu_register_instance(dev->fwnode, &arm_smmu_ops); | ||
2125 | platform_set_drvdata(pdev, smmu); | 2124 | platform_set_drvdata(pdev, smmu); |
2126 | arm_smmu_device_reset(smmu); | 2125 | arm_smmu_device_reset(smmu); |
2127 | 2126 | ||
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 64325d8ddd40..778ecccd7a29 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c | |||
@@ -642,8 +642,6 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) | |||
642 | 642 | ||
643 | pm_runtime_enable(dev); | 643 | pm_runtime_enable(dev); |
644 | 644 | ||
645 | of_iommu_set_ops(dev->of_node, &exynos_iommu_ops); | ||
646 | |||
647 | return 0; | 645 | return 0; |
648 | } | 646 | } |
649 | 647 | ||
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 1dfd70ea27e4..162d865e2e29 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -1658,43 +1658,18 @@ out: | |||
1658 | return ret; | 1658 | return ret; |
1659 | } | 1659 | } |
1660 | 1660 | ||
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 | |||
1686 | const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) | 1661 | const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) |
1687 | { | 1662 | { |
1688 | struct iommu_instance *instance; | ||
1689 | const struct iommu_ops *ops = NULL; | 1663 | const struct iommu_ops *ops = NULL; |
1664 | struct iommu_device *iommu; | ||
1690 | 1665 | ||
1691 | spin_lock(&iommu_instance_lock); | 1666 | spin_lock(&iommu_device_lock); |
1692 | list_for_each_entry(instance, &iommu_instance_list, list) | 1667 | list_for_each_entry(iommu, &iommu_device_list, list) |
1693 | if (instance->fwnode == fwnode) { | 1668 | if (iommu->fwnode == fwnode) { |
1694 | ops = instance->ops; | 1669 | ops = iommu->ops; |
1695 | break; | 1670 | break; |
1696 | } | 1671 | } |
1697 | spin_unlock(&iommu_instance_lock); | 1672 | spin_unlock(&iommu_device_lock); |
1698 | return ops; | 1673 | return ops; |
1699 | } | 1674 | } |
1700 | 1675 | ||
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 30795cbab5ef..d0448353d501 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c | |||
@@ -810,8 +810,6 @@ static int msm_iommu_probe(struct platform_device *pdev) | |||
810 | goto fail; | 810 | goto fail; |
811 | } | 811 | } |
812 | 812 | ||
813 | of_iommu_set_ops(pdev->dev.of_node, &msm_iommu_ops); | ||
814 | |||
815 | pr_info("device mapped at %p, irq %d with %d ctx banks\n", | 813 | pr_info("device mapped at %p, irq %d with %d ctx banks\n", |
816 | iommu->base, iommu->irq, iommu->ncb); | 814 | iommu->base, iommu->irq, iommu->ncb); |
817 | 815 | ||
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d484fa608db8..5d14cd15198d 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c | |||
@@ -681,7 +681,6 @@ static int mtk_iommu_init_fn(struct device_node *np) | |||
681 | return ret; | 681 | return ret; |
682 | } | 682 | } |
683 | 683 | ||
684 | of_iommu_set_ops(np, &mtk_iommu_ops); | ||
685 | return 0; | 684 | return 0; |
686 | } | 685 | } |
687 | 686 | ||
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 626c935edee1..9e82fc83765e 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -382,8 +382,6 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode, | |||
382 | const struct iommu_ops *ops); | 382 | const struct iommu_ops *ops); |
383 | void iommu_fwspec_free(struct device *dev); | 383 | void iommu_fwspec_free(struct device *dev); |
384 | int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids); | 384 | 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); | ||
387 | const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); | 385 | const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); |
388 | 386 | ||
389 | #else /* CONFIG_IOMMU_API */ | 387 | #else /* CONFIG_IOMMU_API */ |
@@ -634,11 +632,6 @@ static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids, | |||
634 | return -ENODEV; | 632 | return -ENODEV; |
635 | } | 633 | } |
636 | 634 | ||
637 | static inline void iommu_register_instance(struct fwnode_handle *fwnode, | ||
638 | const struct iommu_ops *ops) | ||
639 | { | ||
640 | } | ||
641 | |||
642 | static inline | 635 | static inline |
643 | const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) | 636 | const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) |
644 | { | 637 | { |
diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index 66fcbc949899..fc4add39361a 100644 --- a/include/linux/of_iommu.h +++ b/include/linux/of_iommu.h | |||
@@ -31,12 +31,6 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev, | |||
31 | 31 | ||
32 | #endif /* CONFIG_OF_IOMMU */ | 32 | #endif /* CONFIG_OF_IOMMU */ |
33 | 33 | ||
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 | |||
40 | static inline const struct iommu_ops *of_iommu_get_ops(struct device_node *np) | 34 | static inline const struct iommu_ops *of_iommu_get_ops(struct device_node *np) |
41 | { | 35 | { |
42 | return iommu_ops_from_fwnode(&np->fwnode); | 36 | return iommu_ops_from_fwnode(&np->fwnode); |