Commit c822b37c authored by Joerg Roedel's avatar Joerg Roedel

iommu/omap: Remove orphan_dev tracking

Remove the tracking of device which could not be probed because
their IOMMU is not probed yet. Replace it with a call to
bus_iommu_probe() when a new IOMMU is probed.
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20200429133712.31431-29-joro@8bytes.orgSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 6580c8a7
...@@ -35,15 +35,6 @@ ...@@ -35,15 +35,6 @@
static const struct iommu_ops omap_iommu_ops; static const struct iommu_ops omap_iommu_ops;
struct orphan_dev {
struct device *dev;
struct list_head node;
};
static LIST_HEAD(orphan_dev_list);
static DEFINE_SPINLOCK(orphan_lock);
#define to_iommu(dev) ((struct omap_iommu *)dev_get_drvdata(dev)) #define to_iommu(dev) ((struct omap_iommu *)dev_get_drvdata(dev))
/* bitmap of the page sizes currently supported */ /* bitmap of the page sizes currently supported */
...@@ -62,8 +53,6 @@ static DEFINE_SPINLOCK(orphan_lock); ...@@ -62,8 +53,6 @@ static DEFINE_SPINLOCK(orphan_lock);
static struct platform_driver omap_iommu_driver; static struct platform_driver omap_iommu_driver;
static struct kmem_cache *iopte_cachep; static struct kmem_cache *iopte_cachep;
static int _omap_iommu_add_device(struct device *dev);
/** /**
* to_omap_domain - Get struct omap_iommu_domain from generic iommu_domain * to_omap_domain - Get struct omap_iommu_domain from generic iommu_domain
* @dom: generic iommu domain handle * @dom: generic iommu domain handle
...@@ -1177,7 +1166,6 @@ static int omap_iommu_probe(struct platform_device *pdev) ...@@ -1177,7 +1166,6 @@ static int omap_iommu_probe(struct platform_device *pdev)
struct omap_iommu *obj; struct omap_iommu *obj;
struct resource *res; struct resource *res;
struct device_node *of = pdev->dev.of_node; struct device_node *of = pdev->dev.of_node;
struct orphan_dev *orphan_dev, *tmp;
if (!of) { if (!of) {
pr_err("%s: only DT-based devices are supported\n", __func__); pr_err("%s: only DT-based devices are supported\n", __func__);
...@@ -1260,13 +1248,8 @@ static int omap_iommu_probe(struct platform_device *pdev) ...@@ -1260,13 +1248,8 @@ static int omap_iommu_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "%s registered\n", obj->name); dev_info(&pdev->dev, "%s registered\n", obj->name);
list_for_each_entry_safe(orphan_dev, tmp, &orphan_dev_list, node) { /* Re-probe bus to probe device attached to this IOMMU */
err = _omap_iommu_add_device(orphan_dev->dev); bus_iommu_probe(&platform_bus_type);
if (!err) {
list_del(&orphan_dev->node);
kfree(orphan_dev);
}
}
return 0; return 0;
...@@ -1657,7 +1640,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain, ...@@ -1657,7 +1640,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
return ret; return ret;
} }
static int _omap_iommu_add_device(struct device *dev) static int omap_iommu_add_device(struct device *dev)
{ {
struct omap_iommu_arch_data *arch_data, *tmp; struct omap_iommu_arch_data *arch_data, *tmp;
struct omap_iommu *oiommu; struct omap_iommu *oiommu;
...@@ -1666,8 +1649,6 @@ static int _omap_iommu_add_device(struct device *dev) ...@@ -1666,8 +1649,6 @@ static int _omap_iommu_add_device(struct device *dev)
struct platform_device *pdev; struct platform_device *pdev;
int num_iommus, i; int num_iommus, i;
int ret; int ret;
struct orphan_dev *orphan_dev;
unsigned long flags;
/* /*
* Allocate the archdata iommu structure for DT-based devices. * Allocate the archdata iommu structure for DT-based devices.
...@@ -1702,23 +1683,7 @@ static int _omap_iommu_add_device(struct device *dev) ...@@ -1702,23 +1683,7 @@ static int _omap_iommu_add_device(struct device *dev)
if (!pdev) { if (!pdev) {
of_node_put(np); of_node_put(np);
kfree(arch_data); kfree(arch_data);
spin_lock_irqsave(&orphan_lock, flags); return -ENODEV;
list_for_each_entry(orphan_dev, &orphan_dev_list,
node) {
if (orphan_dev->dev == dev)
break;
}
spin_unlock_irqrestore(&orphan_lock, flags);
if (orphan_dev && orphan_dev->dev == dev)
return -EPROBE_DEFER;
orphan_dev = kzalloc(sizeof(*orphan_dev), GFP_KERNEL);
orphan_dev->dev = dev;
spin_lock_irqsave(&orphan_lock, flags);
list_add(&orphan_dev->node, &orphan_dev_list);
spin_unlock_irqrestore(&orphan_lock, flags);
return -EPROBE_DEFER;
} }
oiommu = platform_get_drvdata(pdev); oiommu = platform_get_drvdata(pdev);
...@@ -1764,17 +1729,6 @@ static int _omap_iommu_add_device(struct device *dev) ...@@ -1764,17 +1729,6 @@ static int _omap_iommu_add_device(struct device *dev)
return 0; return 0;
} }
static int omap_iommu_add_device(struct device *dev)
{
int ret;
ret = _omap_iommu_add_device(dev);
if (ret == -EPROBE_DEFER)
return 0;
return ret;
}
static void omap_iommu_remove_device(struct device *dev) static void omap_iommu_remove_device(struct device *dev)
{ {
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment