drm/panel: Use managed helpers in BOE panels
PATCH v4 1/6 drm/panel: Use managed helpers in BOE panels
Use the managed MIPI DSI attach and panel add helpers in BOE 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]>
---
v4:
- use devm_drm_panel_add instead of drm_panel_add.
drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c | 19 ++++----------- drivers/gpu/drm/panel/panel-boe-himax8279d.c | 23 ++---------------- drivers/gpu/drm/panel/panel-boe-td4320.c | 23 ++++-------------- drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 24 ++++++------------- drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c | 23 ++++-------------- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 24 ++----------------- 6 files changed, 25 insertions(+), 111 deletions(-)
drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c +4 -15
@@ -357,9 +357,11 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (boe->panel.backlight),"Failed to create backlight\n" ); -drm_panel_add (&boe->panel); + ret =devm_drm_panel_add (dev, &boe->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;
@@ -368,18 +370,6 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)return 0 ; } -static void boe_bf060y8m_aj0_remove (struct mipi_dsi_device *dsi) -{ -struct boe_bf060y8m_aj0 *boe =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 (&boe->panel); -} -static const struct of_device_id boe_bf060y8m_aj0_of_match[] = { { .compatible ="boe,bf060y8m-aj0" }, {/* sentinel */ }
@@ -388,7 +378,6 @@ MODULE_DEVICE_TABLE(of, boe_bf060y8m_aj0_of_match);static struct mipi_dsi_driver boe_bf060y8m_aj0_driver = { .probe = boe_bf060y8m_aj0_probe, - .remove = boe_bf060y8m_aj0_remove, .driver = { .name ="panel-sw43404-boe-fhd-amoled" , .of_match_table = boe_bf060y8m_aj0_of_match,
drivers/gpu/drm/panel/panel-boe-himax8279d.c +2 -21
@@ -851,9 +851,7 @@ static int panel_add(struct panel_info *pinfo)if (ret)return ret; -drm_panel_add (&pinfo->base); - -return 0 ; +return devm_drm_panel_add (dev, &pinfo->base); }static int panel_probe (struct mipi_dsi_device *dsi)
@@ -881,23 +879,7 @@ static int panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; - err =mipi_dsi_attach (dsi); -if (err <0 ) -drm_panel_remove (&pinfo->base); - -return err; -} - -static void panel_remove (struct mipi_dsi_device *dsi) -{ -struct panel_info *pinfo =mipi_dsi_get_drvdata (dsi); -int err; - - err =mipi_dsi_detach (dsi); -if (err <0 ) -dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , err); - -drm_panel_remove (&pinfo->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver panel_driver = {
@@ -906,7 +888,6 @@ static struct mipi_dsi_driver panel_driver = { .of_match_table = panel_of_match, }, .probe = panel_probe, - .remove = panel_remove, };module_mipi_dsi_driver (panel_driver);
drivers/gpu/drm/panel/panel-boe-td4320.c +5 -18
@@ -202,29 +202,17 @@ static int boe_td4320_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); -if (ret <0 ) { -drm_panel_remove (&ctx->panel); + ret =devm_mipi_dsi_attach (dev, dsi); +if (ret <0 )return dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); - }return 0 ; } -static void boe_td4320_remove (struct mipi_dsi_device *dsi) -{ -struct boe_td4320 *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 boe_td4320_of_match[] = { { .compatible ="boe,td4320" }, {/* sentinel */ }
@@ -233,7 +221,6 @@ MODULE_DEVICE_TABLE(of, boe_td4320_of_match);static struct mipi_dsi_driver boe_td4320_driver = { .probe = boe_td4320_probe, - .remove = boe_td4320_remove, .driver = { .name ="panel-boe-td4320" , .of_match_table = boe_td4320_of_match,
drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c +7 -17
@@ -391,25 +391,16 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); - - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -dev_err_probe (&dsi->dev, ret, -"Failed to attach panel to DSI host\n" ); -drm_panel_remove (&ctx->panel); + ret =devm_drm_panel_add (&dsi->dev, &ctx->panel); +if (ret)return ret; - } -return 0 ; -} - -static void boe_th101mb31ig002_dsi_remove (struct mipi_dsi_device *dsi) -{ -struct boe_th101mb31ig002 *ctx =mipi_dsi_get_drvdata (dsi); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi); +if (ret <0 ) +return dev_err_probe (&dsi->dev, ret, +"Failed to attach panel to DSI host\n" ); -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); +return 0 ; }static const struct of_device_id boe_th101mb31ig002_of_match[] = {
@@ -431,7 +422,6 @@ static struct mipi_dsi_driver boe_th101mb31ig002_driver = { .of_match_table = boe_th101mb31ig002_of_match, }, .probe = boe_th101mb31ig002_dsi_probe, - .remove = boe_th101mb31ig002_dsi_remove, };module_mipi_dsi_driver (boe_th101mb31ig002_driver);
drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c +5 -18
@@ -198,29 +198,17 @@ static int boe_tv101wum_ll2_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); -if (ret <0 ) { -drm_panel_remove (&ctx->panel); + ret =devm_mipi_dsi_attach (dev, dsi); +if (ret <0 )return dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); - }return 0 ; } -static void boe_tv101wum_ll2_remove (struct mipi_dsi_device *dsi) -{ -struct boe_tv101wum_ll2 *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 boe_tv101wum_ll2_of_match[] = { { .compatible ="boe,tv101wum-ll2" }, {/* sentinel */ }
@@ -229,7 +217,6 @@ MODULE_DEVICE_TABLE(of, boe_tv101wum_ll2_of_match);static struct mipi_dsi_driver boe_tv101wum_ll2_driver = { .probe = boe_tv101wum_ll2_probe, - .remove = boe_tv101wum_ll2_remove, .driver = { .name ="panel-boe-tv101wum_ll2" , .of_match_table = boe_tv101wum_ll2_of_match,
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +2 -22
@@ -1736,9 +1736,7 @@ static int boe_panel_add(struct boe_panel *boe) boe->base.funcs = &boe_panel_funcs; boe->base.dev = &boe->dsi->dev; -drm_panel_add (&boe->base); - -return 0 ; +return devm_drm_panel_add (dev, &boe->base); }static int boe_panel_probe (struct mipi_dsi_device *dsi)
@@ -1765,24 +1763,7 @@ static int boe_panel_probe(struct mipi_dsi_device *dsi)mipi_dsi_set_drvdata (dsi, boe); - ret =mipi_dsi_attach (dsi); -if (ret) -drm_panel_remove (&boe->base); - -return ret; -} - -static void boe_panel_remove (struct mipi_dsi_device *dsi) -{ -struct boe_panel *boe =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); - -if (boe->base.dev) -drm_panel_remove (&boe->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static const struct of_device_id boe_of_match[] = {
@@ -1820,7 +1801,6 @@ static struct mipi_dsi_driver boe_panel_driver = { .of_match_table = boe_of_match, }, .probe = boe_panel_probe, - .remove = boe_panel_remove, };module_mipi_dsi_driver (boe_panel_driver);
Signature · 1 line
2.43.0