[RFC/PATCH 3/3] omap3-iommu: remote registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This allows devices to be registered only when they are used. The
current dsp-bridge driver for example is not using iommu so registering
the iommu iva2 device would conflict. By allowing remote registration
the dsp-bridge can decide when the iommu iva2 device is registered.

Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 arch/arm/mach-omap2/omap3-iommu.c       |   36 +-----------------------------
 arch/arm/plat-omap/include/mach/iommu.h |    2 +
 2 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c
index 149c624..8380cd5 100644
--- a/arch/arm/mach-omap2/omap3-iommu.c
+++ b/arch/arm/mach-omap2/omap3-iommu.c
@@ -41,11 +41,8 @@ static struct iommu_device devices[] = {
 		},
 	},
 };
-#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata)
 
-static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
-
-static struct platform_device *omap_iommu_add(const char *name)
+struct platform_device *omap_iommu_add(const char *name)
 {
 	struct platform_device *pdev;
 	const struct iommu_device *d = NULL;
@@ -91,36 +88,7 @@ err_out:
 	platform_device_put(pdev);
 	return NULL;
 }
-
-static int __init omap3_iommu_init(void)
-{
-	struct platform_device *pdev;
-	int i, err;
-
-	for (i = 0; i < ARRAY_SIZE(devices); i++) {
-		pdev = omap_iommu_add(devices[i].pdata.name);
-		if (!pdev)
-			goto err_out;
-		omap3_iommu_pdev[i] = pdev;
-	}
-
-	return 0;
-
-err_out:
-	while (i--)
-		platform_device_put(omap3_iommu_pdev[i]);
-	return err;
-}
-module_init(omap3_iommu_init);
-
-static void __exit omap3_iommu_exit(void)
-{
-	int i;
-
-	for (i = 0; i < NR_IOMMU_DEVICES; i++)
-		platform_device_unregister(omap3_iommu_pdev[i]);
-}
-module_exit(omap3_iommu_exit);
+EXPORT_SYMBOL_GPL(omap_iommu_add);
 
 MODULE_AUTHOR("Hiroshi DOYU");
 MODULE_DESCRIPTION("omap iommu: omap3 device registration");
diff --git a/arch/arm/plat-omap/include/mach/iommu.h b/arch/arm/plat-omap/include/mach/iommu.h
index 769b00b..e22a4a4 100644
--- a/arch/arm/plat-omap/include/mach/iommu.h
+++ b/arch/arm/plat-omap/include/mach/iommu.h
@@ -165,4 +165,6 @@ extern int foreach_iommu_device(void *data,
 extern ssize_t iommu_dump_ctx(struct iommu *obj, char *buf);
 extern size_t dump_tlb_entries(struct iommu *obj, char *buf);
 
+struct platform_device *omap_iommu_add(const char *name);
+
 #endif /* __MACH_IOMMU_H */
-- 
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux