diff mbox

[v2,24/28] drm: omapdrm: Register omapdrm platform device in omapdss driver

Message ID 20170508113303.27521-25-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart May 8, 2017, 11:32 a.m. UTC
The omapdrm platform device is a virtual device created for the sole
purpose of handling the omapdss/omapdrm driver split. It should
eventually be removed. As a first step to ease refactoring move its
registration from platform code to driver code.

The omapdrm driver name must be changed internally to avoid probing both
the device registered in platform code and the device registered in the
omapdss driver, as that would otherwise break bisection.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v1:

- Drop the CONFIG_DRM_OMAP conditional compilation
- Unregister the platform device at exit time
---
 drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

Comments

Tomi Valkeinen May 9, 2017, 11:48 a.m. UTC | #1
On 08/05/17 14:32, Laurent Pinchart wrote:
> The omapdrm platform device is a virtual device created for the sole
> purpose of handling the omapdss/omapdrm driver split. It should
> eventually be removed. As a first step to ease refactoring move its
> registration from platform code to driver code.
> 
> The omapdrm driver name must be changed internally to avoid probing both
> the device registered in platform code and the device registered in the
> omapdss driver, as that would otherwise break bisection.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> Changes since v1:
> 
> - Drop the CONFIG_DRM_OMAP conditional compilation
> - Unregister the platform device at exit time
> ---
>  drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
>  drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
>  2 files changed, 16 insertions(+), 1 deletion(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

I think you could rename the device back at the end of the series.

 Tomi
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
index 2a8bf441d38d..e4781356de96 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -22,6 +22,7 @@ 
 
 #define DSS_SUBSYS_NAME "CORE"
 
+#include <linux/dma-mapping.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/clk.h>
@@ -110,6 +111,14 @@  static void (*dss_output_drv_unreg_funcs[])(void) = {
 	dss_uninit_platform_driver,
 };
 
+static struct platform_device omap_drm_device = {
+	.dev = {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	},
+	.name = "omapdrm_",
+	.id = 0,
+};
+
 static int __init omap_dss_init(void)
 {
 	int r;
@@ -125,6 +134,10 @@  static int __init omap_dss_init(void)
 			goto err_reg;
 	}
 
+	r = platform_device_register(&omap_drm_device);
+	if (r)
+		goto err_reg;
+
 	return 0;
 
 err_reg:
@@ -142,6 +155,8 @@  static void __exit omap_dss_exit(void)
 {
 	int i;
 
+	platform_device_unregister(&omap_drm_device);
+
 	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
 		dss_output_drv_unreg_funcs[i]();
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 343301ed4741..6f5fddbaea65 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -957,7 +957,7 @@  static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);
 
 static struct platform_driver pdev = {
 	.driver = {
-		.name = DRIVER_NAME,
+		.name = "omapdrm_",
 		.pm = &omapdrm_pm_ops,
 	},
 	.probe = pdev_probe,