diff mbox series

drm: panel: nt36523: use devm_mipi_dsi_* function to register and attach dsi

Message ID 20240904142907.367786-1-lujianhua000@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm: panel: nt36523: use devm_mipi_dsi_* function to register and attach dsi | expand

Commit Message

Jianhua Lu Sept. 4, 2024, 2:29 p.m. UTC
Switch to devm_mipi_dsi_* function, we don't need to detach and
unregister dsi manually any more.

Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>
---
 drivers/gpu/drm/panel/panel-novatek-nt36523.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

Comments

Neil Armstrong Sept. 13, 2024, 9:09 a.m. UTC | #1
On 04/09/2024 16:29, Jianhua Lu wrote:
> Switch to devm_mipi_dsi_* function, we don't need to detach and
> unregister dsi manually any more.
> 
> Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>
> ---
>   drivers/gpu/drm/panel/panel-novatek-nt36523.c | 16 ++--------------
>   1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> index 18bd2ee71201..04f1d2676c78 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
> @@ -1095,18 +1095,6 @@ static int nt36523_unprepare(struct drm_panel *panel)
>   static void nt36523_remove(struct mipi_dsi_device *dsi)
>   {
>   	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
> -	int ret;
> -
> -	ret = mipi_dsi_detach(pinfo->dsi[0]);
> -	if (ret < 0)
> -		dev_err(&dsi->dev, "failed to detach from DSI0 host: %d\n", ret);
> -
> -	if (pinfo->desc->is_dual_dsi) {
> -		ret = mipi_dsi_detach(pinfo->dsi[1]);
> -		if (ret < 0)
> -			dev_err(&pinfo->dsi[1]->dev, "failed to detach from DSI1 host: %d\n", ret);
> -		mipi_dsi_device_unregister(pinfo->dsi[1]);
> -	}
>   
>   	drm_panel_remove(&pinfo->panel);
>   }
> @@ -1251,7 +1239,7 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
>   		if (!dsi1_host)
>   			return dev_err_probe(dev, -EPROBE_DEFER, "cannot get secondary DSI host\n");
>   
> -		pinfo->dsi[1] = mipi_dsi_device_register_full(dsi1_host, info);
> +		pinfo->dsi[1] = devm_mipi_dsi_device_register_full(dev, dsi1_host, info);
>   		if (IS_ERR(pinfo->dsi[1])) {
>   			dev_err(dev, "cannot get secondary DSI device\n");
>   			return PTR_ERR(pinfo->dsi[1]);
> @@ -1288,7 +1276,7 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
>   		pinfo->dsi[i]->format = pinfo->desc->format;
>   		pinfo->dsi[i]->mode_flags = pinfo->desc->mode_flags;
>   
> -		ret = mipi_dsi_attach(pinfo->dsi[i]);
> +		ret = devm_mipi_dsi_attach(dev, pinfo->dsi[i]);
>   		if (ret < 0)
>   			return dev_err_probe(dev, ret, "cannot attach to DSI%d host.\n", i);
>   	}

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Neil Armstrong Sept. 13, 2024, 9:18 a.m. UTC | #2
Hi,

On Wed, 04 Sep 2024 22:29:07 +0800, Jianhua Lu wrote:
> Switch to devm_mipi_dsi_* function, we don't need to detach and
> unregister dsi manually any more.
> 
> 

Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next)

[1/1] drm: panel: nt36523: use devm_mipi_dsi_* function to register and attach dsi
      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/62f6bc14bbd12c13abe08b5a1bd8e55c843b776b
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
index 18bd2ee71201..04f1d2676c78 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
@@ -1095,18 +1095,6 @@  static int nt36523_unprepare(struct drm_panel *panel)
 static void nt36523_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(pinfo->dsi[0]);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI0 host: %d\n", ret);
-
-	if (pinfo->desc->is_dual_dsi) {
-		ret = mipi_dsi_detach(pinfo->dsi[1]);
-		if (ret < 0)
-			dev_err(&pinfo->dsi[1]->dev, "failed to detach from DSI1 host: %d\n", ret);
-		mipi_dsi_device_unregister(pinfo->dsi[1]);
-	}
 
 	drm_panel_remove(&pinfo->panel);
 }
@@ -1251,7 +1239,7 @@  static int nt36523_probe(struct mipi_dsi_device *dsi)
 		if (!dsi1_host)
 			return dev_err_probe(dev, -EPROBE_DEFER, "cannot get secondary DSI host\n");
 
-		pinfo->dsi[1] = mipi_dsi_device_register_full(dsi1_host, info);
+		pinfo->dsi[1] = devm_mipi_dsi_device_register_full(dev, dsi1_host, info);
 		if (IS_ERR(pinfo->dsi[1])) {
 			dev_err(dev, "cannot get secondary DSI device\n");
 			return PTR_ERR(pinfo->dsi[1]);
@@ -1288,7 +1276,7 @@  static int nt36523_probe(struct mipi_dsi_device *dsi)
 		pinfo->dsi[i]->format = pinfo->desc->format;
 		pinfo->dsi[i]->mode_flags = pinfo->desc->mode_flags;
 
-		ret = mipi_dsi_attach(pinfo->dsi[i]);
+		ret = devm_mipi_dsi_attach(dev, pinfo->dsi[i]);
 		if (ret < 0)
 			return dev_err_probe(dev, ret, "cannot attach to DSI%d host.\n", i);
 	}