Skip to content

Commit c822b37

Browse files
committed
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: Joerg Roedel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 6580c8a commit c822b37

File tree

1 file changed

+4
-50
lines changed

1 file changed

+4
-50
lines changed

drivers/iommu/omap-iommu.c

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@
3535

3636
static const struct iommu_ops omap_iommu_ops;
3737

38-
struct orphan_dev {
39-
struct device *dev;
40-
struct list_head node;
41-
};
42-
43-
static LIST_HEAD(orphan_dev_list);
44-
45-
static DEFINE_SPINLOCK(orphan_lock);
46-
4738
#define to_iommu(dev) ((struct omap_iommu *)dev_get_drvdata(dev))
4839

4940
/* bitmap of the page sizes currently supported */
@@ -62,8 +53,6 @@ static DEFINE_SPINLOCK(orphan_lock);
6253
static struct platform_driver omap_iommu_driver;
6354
static struct kmem_cache *iopte_cachep;
6455

65-
static int _omap_iommu_add_device(struct device *dev);
66-
6756
/**
6857
* to_omap_domain - Get struct omap_iommu_domain from generic iommu_domain
6958
* @dom: generic iommu domain handle
@@ -1177,7 +1166,6 @@ static int omap_iommu_probe(struct platform_device *pdev)
11771166
struct omap_iommu *obj;
11781167
struct resource *res;
11791168
struct device_node *of = pdev->dev.of_node;
1180-
struct orphan_dev *orphan_dev, *tmp;
11811169

11821170
if (!of) {
11831171
pr_err("%s: only DT-based devices are supported\n", __func__);
@@ -1260,13 +1248,8 @@ static int omap_iommu_probe(struct platform_device *pdev)
12601248

12611249
dev_info(&pdev->dev, "%s registered\n", obj->name);
12621250

1263-
list_for_each_entry_safe(orphan_dev, tmp, &orphan_dev_list, node) {
1264-
err = _omap_iommu_add_device(orphan_dev->dev);
1265-
if (!err) {
1266-
list_del(&orphan_dev->node);
1267-
kfree(orphan_dev);
1268-
}
1269-
}
1251+
/* Re-probe bus to probe device attached to this IOMMU */
1252+
bus_iommu_probe(&platform_bus_type);
12701253

12711254
return 0;
12721255

@@ -1657,7 +1640,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
16571640
return ret;
16581641
}
16591642

1660-
static int _omap_iommu_add_device(struct device *dev)
1643+
static int omap_iommu_add_device(struct device *dev)
16611644
{
16621645
struct omap_iommu_arch_data *arch_data, *tmp;
16631646
struct omap_iommu *oiommu;
@@ -1666,8 +1649,6 @@ static int _omap_iommu_add_device(struct device *dev)
16661649
struct platform_device *pdev;
16671650
int num_iommus, i;
16681651
int ret;
1669-
struct orphan_dev *orphan_dev;
1670-
unsigned long flags;
16711652

16721653
/*
16731654
* Allocate the archdata iommu structure for DT-based devices.
@@ -1702,23 +1683,7 @@ static int _omap_iommu_add_device(struct device *dev)
17021683
if (!pdev) {
17031684
of_node_put(np);
17041685
kfree(arch_data);
1705-
spin_lock_irqsave(&orphan_lock, flags);
1706-
list_for_each_entry(orphan_dev, &orphan_dev_list,
1707-
node) {
1708-
if (orphan_dev->dev == dev)
1709-
break;
1710-
}
1711-
spin_unlock_irqrestore(&orphan_lock, flags);
1712-
1713-
if (orphan_dev && orphan_dev->dev == dev)
1714-
return -EPROBE_DEFER;
1715-
1716-
orphan_dev = kzalloc(sizeof(*orphan_dev), GFP_KERNEL);
1717-
orphan_dev->dev = dev;
1718-
spin_lock_irqsave(&orphan_lock, flags);
1719-
list_add(&orphan_dev->node, &orphan_dev_list);
1720-
spin_unlock_irqrestore(&orphan_lock, flags);
1721-
return -EPROBE_DEFER;
1686+
return -ENODEV;
17221687
}
17231688

17241689
oiommu = platform_get_drvdata(pdev);
@@ -1764,17 +1729,6 @@ static int _omap_iommu_add_device(struct device *dev)
17641729
return 0;
17651730
}
17661731

1767-
static int omap_iommu_add_device(struct device *dev)
1768-
{
1769-
int ret;
1770-
1771-
ret = _omap_iommu_add_device(dev);
1772-
if (ret == -EPROBE_DEFER)
1773-
return 0;
1774-
1775-
return ret;
1776-
}
1777-
17781732
static void omap_iommu_remove_device(struct device *dev)
17791733
{
17801734
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;

0 commit comments

Comments
 (0)