Skip to content

Commit f90aa59

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/rockchip: Register in a sensible order
Currently Rockchip calls iommu_device_register() before it's finished setting up the hardware and driver state, and as such it now gets unhappy in various ways when registration starts working the way it was always intended to, and probing client devices straight away. Reorder the operations to ensure that what we're registering is a prepared and functional IOMMU instance. Fixes: bcb81ac ("iommu: Get DT/ACPI parsing into the proper probe path") Signed-off-by: Robin Murphy <[email protected]> Tested-by: Quentin Schulz <[email protected]> Tested-by: Dang Huynh <[email protected]> Reviewed-by: Nicolas Frattaroli <[email protected]> Tested-by: Nicolas Frattaroli <[email protected]> Link: https://lore.kernel.org/r/e69532f00bf49d98322b96788edb7e2e305e4006.1741886382.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent f48dcda commit f90aa59

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,14 +1256,6 @@ static int rk_iommu_probe(struct platform_device *pdev)
12561256
if (err)
12571257
return err;
12581258

1259-
err = iommu_device_sysfs_add(&iommu->iommu, dev, NULL, dev_name(dev));
1260-
if (err)
1261-
goto err_unprepare_clocks;
1262-
1263-
err = iommu_device_register(&iommu->iommu, &rk_iommu_ops, dev);
1264-
if (err)
1265-
goto err_remove_sysfs;
1266-
12671259
/*
12681260
* Use the first registered IOMMU device for domain to use with DMA
12691261
* API, since a domain might not physically correspond to a single
@@ -1290,12 +1282,19 @@ static int rk_iommu_probe(struct platform_device *pdev)
12901282

12911283
dma_set_mask_and_coherent(dev, rk_ops->dma_bit_mask);
12921284

1285+
err = iommu_device_sysfs_add(&iommu->iommu, dev, NULL, dev_name(dev));
1286+
if (err)
1287+
goto err_pm_disable;
1288+
1289+
err = iommu_device_register(&iommu->iommu, &rk_iommu_ops, dev);
1290+
if (err)
1291+
goto err_remove_sysfs;
1292+
12931293
return 0;
1294-
err_pm_disable:
1295-
pm_runtime_disable(dev);
12961294
err_remove_sysfs:
12971295
iommu_device_sysfs_remove(&iommu->iommu);
1298-
err_unprepare_clocks:
1296+
err_pm_disable:
1297+
pm_runtime_disable(dev);
12991298
clk_bulk_unprepare(iommu->num_clocks, iommu->clocks);
13001299
return err;
13011300
}

0 commit comments

Comments
 (0)