diff mbox

[PATCH/RFC,6/7] drm: omapdrm: Register omapdrm platform device in omapdss driver

Message ID 1481672306-22564-7-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Dec. 13, 2016, 11:38 p.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>
---
 drivers/gpu/drm/omapdrm/dss/core.c | 17 +++++++++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

Comments

Tomi Valkeinen Dec. 14, 2016, 8:20 a.m. UTC | #1
On 14/12/16 01:38, 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>
> ---
>  drivers/gpu/drm/omapdrm/dss/core.c | 17 +++++++++++++++++
>  drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
> index 1bf978b5c5bc..b7c44b85b7c3 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>
> @@ -285,6 +286,16 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
>  	dss_uninit_platform_driver,
>  };
>  
> +#if IS_ENABLED(CONFIG_DRM_OMAP)

The #ifs are not needed, don't compile this file if there's no DRM_OMAP.

> +static struct platform_device omap_drm_device = {
> +	.dev = {
> +		.coherent_dma_mask = DMA_BIT_MASK(32),
> +	},
> +	.name = "omapdrm_",
> +	.id = 0,
> +};
> +#endif
> +
>  static int __init omap_dss_init(void)
>  {
>  	int r;
> @@ -300,6 +311,12 @@ static int __init omap_dss_init(void)
>  			goto err_reg;
>  	}
>  
> +#if IS_ENABLED(CONFIG_DRM_OMAP)
> +	r = platform_device_register(&omap_drm_device);
> +	if (r)
> +		goto err_reg;
> +#endif

Where is the unregister?

 Tomi
Laurent Pinchart Dec. 14, 2016, 11:54 a.m. UTC | #2
Hi Tomi,

On Wednesday 14 Dec 2016 10:20:39 Tomi Valkeinen wrote:
> On 14/12/16 01:38, 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>
> > ---
> >  drivers/gpu/drm/omapdrm/dss/core.c | 17 +++++++++++++++++
> >  drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
> >  2 files changed, 18 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/dss/core.c
> > b/drivers/gpu/drm/omapdrm/dss/core.c index 1bf978b5c5bc..b7c44b85b7c3
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/core.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/core.c

[snip]

> > @@ -285,6 +286,16 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
> > 
> >  	dss_uninit_platform_driver,
> >  
> >  };
> > 
> > +#if IS_ENABLED(CONFIG_DRM_OMAP)
> 
> The #ifs are not needed, don't compile this file if there's no DRM_OMAP.

Right, for a moment I forgot that the dss core isn't shared anymore between 
DRM and FBDEV. I'll fix this.

> > +static struct platform_device omap_drm_device = {
> > +	.dev = {
> > +		.coherent_dma_mask = DMA_BIT_MASK(32),
> > +	},
> > +	.name = "omapdrm_",
> > +	.id = 0,
> > +};
> > +#endif
> > +
> >  static int __init omap_dss_init(void)
> >  {
> >  	int r;
> > @@ -300,6 +311,12 @@ static int __init omap_dss_init(void)
> >  			goto err_reg;
> >  	}
> > 
> > +#if IS_ENABLED(CONFIG_DRM_OMAP)
> > +	r = platform_device_register(&omap_drm_device);
> > +	if (r)
> > +		goto err_reg;
> > +#endif
> 
> Where is the unregister?

Oops. Will fix too.
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
index 1bf978b5c5bc..b7c44b85b7c3 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>
@@ -285,6 +286,16 @@  static void (*dss_output_drv_unreg_funcs[])(void) = {
 	dss_uninit_platform_driver,
 };
 
+#if IS_ENABLED(CONFIG_DRM_OMAP)
+static struct platform_device omap_drm_device = {
+	.dev = {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	},
+	.name = "omapdrm_",
+	.id = 0,
+};
+#endif
+
 static int __init omap_dss_init(void)
 {
 	int r;
@@ -300,6 +311,12 @@  static int __init omap_dss_init(void)
 			goto err_reg;
 	}
 
+#if IS_ENABLED(CONFIG_DRM_OMAP)
+	r = platform_device_register(&omap_drm_device);
+	if (r)
+		goto err_reg;
+#endif
+
 	return 0;
 
 err_reg:
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 0e54e3c9c291..581bb12bdd30 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -937,7 +937,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,