Re: [PATCHv2] drm: omapdrm: Register omapdrm platform device in omapdss driver

2017-08-16 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Wednesday 16 Aug 2017 12:49:01 Tomi Valkeinen wrote:
> From: Laurent Pinchart 
> 
> 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 
> Reviewed-by: Tomi Valkeinen 
> Signed-off-by: Tomi Valkeinen 

This looks good to me, so

Reviewed-by: Laurent Pinchart 

I trust that you have tested the patch with module unloading given that was 
how you found the original issue :-)

> ---
> 
> I reworked this patch to create the platform device dynamically.
> 
>  drivers/gpu/drm/omapdrm/dss/core.c | 10 ++
>  drivers/gpu/drm/omapdrm/omap_drv.c |  8 +++-
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c
> b/drivers/gpu/drm/omapdrm/dss/core.c index 4dabe32c7098..6b3247c4f857
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -103,6 +103,8 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
>   dss_uninit_platform_driver,
>  };
> 
> +static struct platform_device *omap_drm_device;
> +
>  static int __init omap_dss_init(void)
>  {
>   int r;
> @@ -118,6 +120,12 @@ static int __init omap_dss_init(void)
>   goto err_reg;
>   }
> 
> + omap_drm_device = platform_device_register_simple("omapdrm_", 0, NULL, 
0);
> + if (IS_ERR(omap_drm_device)) {
> + r = PTR_ERR(omap_drm_device);
> + goto err_reg;
> + }
> +
>   return 0;
> 
>  err_reg:
> @@ -135,6 +143,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 10e24ca928f2..2b990daf0052
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -575,6 +575,12 @@ static int pdev_probe(struct platform_device *pdev)
>   if (omapdss_is_initialized() == false)
>   return -EPROBE_DEFER;
> 
> + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to set the DMA mask\n");
> + return ret;
> + }
> +
>   omap_crtc_pre_init();
> 
>   ret = omap_connect_dssdevs();
> @@ -762,7 +768,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,

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv2] drm: omapdrm: Register omapdrm platform device in omapdss driver

2017-08-16 Thread Tomi Valkeinen
From: Laurent Pinchart 

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 
Reviewed-by: Tomi Valkeinen 
Signed-off-by: Tomi Valkeinen 
---

I reworked this patch to create the platform device dynamically.

 drivers/gpu/drm/omapdrm/dss/core.c | 10 ++
 drivers/gpu/drm/omapdrm/omap_drv.c |  8 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c 
b/drivers/gpu/drm/omapdrm/dss/core.c
index 4dabe32c7098..6b3247c4f857 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -103,6 +103,8 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
dss_uninit_platform_driver,
 };
 
+static struct platform_device *omap_drm_device;
+
 static int __init omap_dss_init(void)
 {
int r;
@@ -118,6 +120,12 @@ static int __init omap_dss_init(void)
goto err_reg;
}
 
+   omap_drm_device = platform_device_register_simple("omapdrm_", 0, NULL, 
0);
+   if (IS_ERR(omap_drm_device)) {
+   r = PTR_ERR(omap_drm_device);
+   goto err_reg;
+   }
+
return 0;
 
 err_reg:
@@ -135,6 +143,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 10e24ca928f2..2b990daf0052 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -575,6 +575,12 @@ static int pdev_probe(struct platform_device *pdev)
if (omapdss_is_initialized() == false)
return -EPROBE_DEFER;
 
+   ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+   if (ret) {
+   dev_err(&pdev->dev, "Failed to set the DMA mask\n");
+   return ret;
+   }
+
omap_crtc_pre_init();
 
ret = omap_connect_dssdevs();
@@ -762,7 +768,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,
-- 
2.7.4


Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel