drm/panel: Use managed helpers in display vendor panels
Subsystems (3)
PATCH v4 5/6 drm/panel: Use managed helpers in display vendor panels
Use the managed MIPI DSI attach and panel add helpers in display vendor panel drivers and drop the corresponding manual detach and panel remove calls from remove paths.
---
v4:
- use devm_drm_panel_add instead of drm_panel_add.
drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 19 +++-------- .../gpu/drm/panel/panel-jdi-lt070me05000.c | 32 ++----------------- .../drm/panel/panel-leadtek-ltk050h3146w.c | 20 +++--------- .../drm/panel/panel-leadtek-ltk500hd1829.c | 20 +++--------- .../gpu/drm/panel/panel-sharp-ls043t1le01.c | 31 ++---------------- .../gpu/drm/panel/panel-sharp-ls060t1sx01.c | 20 +++--------- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 20 +++--------- .../panel/panel-sony-tulip-truly-nt35521.c | 20 +++--------- drivers/gpu/drm/panel/panel-visionox-r66451.c | 23 +++---------- .../gpu/drm/panel/panel-visionox-rm69299.c | 21 +++--------- 10 files changed, 38 insertions(+), 188 deletions(-)
drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c +4 -15
@@ -200,9 +200,11 @@ static int jdi_fhd_r63452_probe(struct mipi_dsi_device *dsi)if (ret)return dev_err_probe (dev, ret,"Failed to get backlight\n" ); -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret);return ret;
@@ -211,18 +213,6 @@ static int jdi_fhd_r63452_probe(struct mipi_dsi_device *dsi)return 0 ; } -static void jdi_fhd_r63452_remove (struct mipi_dsi_device *dsi) -{ -struct jdi_fhd_r63452 *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id jdi_fhd_r63452_of_match[] = { { .compatible ="jdi,fhd-r63452" }, {/* sentinel */ }
@@ -231,7 +221,6 @@ MODULE_DEVICE_TABLE(of, jdi_fhd_r63452_of_match);static struct mipi_dsi_driver jdi_fhd_r63452_driver = { .probe = jdi_fhd_r63452_probe, - .remove = jdi_fhd_r63452_remove, .driver = { .name ="panel-jdi-fhd-r63452" , .of_match_table = jdi_fhd_r63452_of_match,
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +2 -30
@@ -345,15 +345,7 @@ static int jdi_panel_add(struct jdi_panel *jdi)return dev_err_probe (dev,PTR_ERR (jdi->backlight),"failed to register backlight %d\n" , ret); -drm_panel_add (&jdi->base); - -return 0 ; -} - -static void jdi_panel_del (struct jdi_panel *jdi) -{ -if (jdi->base.dev) -drm_panel_remove (&jdi->base); +return devm_drm_panel_add (dev, &jdi->base); }static int jdi_panel_probe (struct mipi_dsi_device *dsi)
@@ -380,26 +372,7 @@ static int jdi_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -jdi_panel_del (jdi); -return ret; - } - -return 0 ; -} - -static void jdi_panel_remove (struct mipi_dsi_device *dsi) -{ -struct jdi_panel *jdi =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , - ret); - -jdi_panel_del (jdi); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver jdi_panel_driver = {
@@ -408,7 +381,6 @@ static struct mipi_dsi_driver jdi_panel_driver = { .of_match_table = jdi_of_match, }, .probe = jdi_panel_probe, - .remove = jdi_panel_remove, };module_mipi_dsi_driver (jdi_panel_driver);
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +4 -16
@@ -583,30 +583,19 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"mipi_dsi_attach failed: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }return 0 ; } -static void ltk050h3146w_remove (struct mipi_dsi_device *dsi) -{ -struct ltk050h3146w *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id ltk050h3146w_of_match[] = { { .compatible ="leadtek,ltk050h3146w" ,
@@ -630,7 +619,6 @@ static struct mipi_dsi_driver ltk050h3146w_driver = { .of_match_table = ltk050h3146w_of_match, }, .probe = ltk050h3146w_probe, - .remove = ltk050h3146w_remove, };module_mipi_dsi_driver (ltk050h3146w_driver);
drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c +4 -16
@@ -649,30 +649,19 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"mipi_dsi_attach failed: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }return 0 ; } -static void ltk500hd1829_remove (struct mipi_dsi_device *dsi) -{ -struct ltk500hd1829 *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id ltk500hd1829_of_match[] = { { .compatible ="leadtek,ltk101b4029w" ,
@@ -692,7 +681,6 @@ static struct mipi_dsi_driver ltk500hd1829_driver = { .of_match_table = ltk500hd1829_of_match, }, .probe = ltk500hd1829_probe, - .remove = ltk500hd1829_remove, };module_mipi_dsi_driver (ltk500hd1829_driver);
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +2 -29
@@ -205,15 +205,7 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)if (ret)return ret; -drm_panel_add (&sharp_nt->base); - -return 0 ; -} - -static void sharp_nt_panel_del (struct sharp_nt_panel *sharp_nt) -{ -if (sharp_nt->base.dev) -drm_panel_remove (&sharp_nt->base); +return devm_drm_panel_add (dev, &sharp_nt->base); }static int sharp_nt_panel_probe (struct mipi_dsi_device *dsi)
@@ -244,25 +236,7 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -sharp_nt_panel_del (sharp_nt); -return ret; - } - -return 0 ; -} - -static void sharp_nt_panel_remove (struct mipi_dsi_device *dsi) -{ -struct sharp_nt_panel *sharp_nt =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , ret); - -sharp_nt_panel_del (sharp_nt); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static const struct of_device_id sharp_nt_of_match[] = {
@@ -277,7 +251,6 @@ static struct mipi_dsi_driver sharp_nt_panel_driver = { .of_match_table = sharp_nt_of_match, }, .probe = sharp_nt_panel_probe, - .remove = sharp_nt_panel_remove, };module_mipi_dsi_driver (sharp_nt_panel_driver);
drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c +4 -16
@@ -233,30 +233,19 @@ static int sharp_ls060_probe(struct mipi_dsi_device *dsi)if (ret)return dev_err_probe (dev, ret,"Failed to get backlight\n" ); -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }return 0 ; } -static void sharp_ls060_remove (struct mipi_dsi_device *dsi) -{ -struct sharp_ls060 *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id sharp_ls060t1sx01_of_match[] = { { .compatible ="sharp,ls060t1sx01" }, {/* sentinel */ }
@@ -265,7 +254,6 @@ MODULE_DEVICE_TABLE(of, sharp_ls060t1sx01_of_match);static struct mipi_dsi_driver sharp_ls060_driver = { .probe = sharp_ls060_probe, - .remove = sharp_ls060_remove, .driver = { .name ="panel-sharp-ls060t1sx01" , .of_match_table = sharp_ls060t1sx01_of_match,
drivers/gpu/drm/panel/panel-sony-td4353-jdi.c +4 -16
@@ -214,30 +214,19 @@ static int sony_td4353_jdi_probe(struct mipi_dsi_device *dsi) ctx->panel.prepare_prev_first = true; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }return 0 ; } -static void sony_td4353_jdi_remove (struct mipi_dsi_device *dsi) -{ -struct sony_td4353_jdi *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id sony_td4353_jdi_of_match[] = { { .compatible ="sony,td4353-jdi-tama" , .data = (void *)TYPE_TAMA_60HZ }, {/* sentinel */ }
@@ -246,7 +235,6 @@ MODULE_DEVICE_TABLE(of, sony_td4353_jdi_of_match);static struct mipi_dsi_driver sony_td4353_jdi_driver = { .probe = sony_td4353_jdi_probe, - .remove = sony_td4353_jdi_remove, .driver = { .name ="panel-sony-td4353-jdi" , .of_match_table = sony_td4353_jdi_of_match,
drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c +4 -16
@@ -472,30 +472,19 @@ static int truly_nt35521_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->panel.backlight),"Failed to create backlight\n" ); -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }return 0 ; } -static void truly_nt35521_remove (struct mipi_dsi_device *dsi) -{ -struct truly_nt35521 *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id truly_nt35521_of_match[] = { { .compatible ="sony,tulip-truly-nt35521" }, {/* sentinel */ }
@@ -504,7 +493,6 @@ MODULE_DEVICE_TABLE(of, truly_nt35521_of_match);static struct mipi_dsi_driver truly_nt35521_driver = { .probe = truly_nt35521_probe, - .remove = truly_nt35521_remove, .driver = { .name ="panel-truly-nt35521" , .of_match_table = truly_nt35521_of_match,
drivers/gpu/drm/panel/panel-visionox-r66451.c +5 -18
@@ -304,29 +304,17 @@ static int visionox_r66451_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->panel.backlight),"Failed to create backlight\n" ); -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { + ret =devm_mipi_dsi_attach (dev, dsi); +if (ret <0 )dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); -drm_panel_remove (&ctx->panel); - }return ret; } -static void visionox_r66451_remove (struct mipi_dsi_device *dsi) -{ -struct visionox_r66451 *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id visionox_r66451_of_match[] = { {.compatible ="visionox,r66451" }, {/*sentinel*/ }
@@ -335,7 +323,6 @@ MODULE_DEVICE_TABLE(of, visionox_r66451_of_match);static struct mipi_dsi_driver visionox_r66451_driver = { .probe = visionox_r66451_probe, - .remove = visionox_r66451_remove, .driver = { .name ="panel-visionox-r66451" , .of_match_table = visionox_r66451_of_match,
drivers/gpu/drm/panel/panel-visionox-rm69299.c +5 -16
@@ -382,31 +382,21 @@ static int visionox_rm69299_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->panel.backlight),"Failed to create backlight\n" ); -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel); +if (ret) +return ret; dsi->lanes =4 ; dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_LPM |MIPI_DSI_CLOCK_NON_CONTINUOUS ; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (dev, dsi);if (ret <0 ) {dev_err (dev,"dsi attach failed ret = %d\n" , ret); - goto err_dsi_attach; +return ret; }return 0 ; - -err_dsi_attach: -drm_panel_remove (&ctx->panel); -return ret; -} - -static void visionox_rm69299_remove (struct mipi_dsi_device *dsi) -{ -struct visionox_rm69299 *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (ctx->dsi); -drm_panel_remove (&ctx->panel); }const struct visionox_rm69299_panel_desc visionox_rm69299_1080p_display_desc = {
@@ -438,7 +428,6 @@ static struct mipi_dsi_driver visionox_rm69299_driver = { .of_match_table = visionox_rm69299_of_match, }, .probe = visionox_rm69299_probe, - .remove = visionox_rm69299_remove, };module_mipi_dsi_driver (visionox_rm69299_driver);
Signature · 1 line
2.43.0
Quoted 6 lines · Osama Abdelkader
Use the managed MIPI DSI attach and panel add helpers in display vendor panel drivers and drop the corresponding manual detach and panel remove calls from remove paths.
Suggested-by Luca Ceresoli <[email protected]>Signed-off-by Osama Abdelkader <[email protected]>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Luca Ceresoli
AppliedQuoted 3 lines · Osama Abdelkader
Use the managed MIPI DSI attach and panel add helpers in display vendor panel drivers and drop the corresponding manual detach and panel remove calls from remove paths.
Applied, thanks!
[5/6] drm/panel: Use managed helpers in display vendor panels
commit: a2419a3e63274fcd34c83c94d3730f1b3aa8d2ad
Best regards,
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com